From: Mike D. Lowis Date: Sun, 12 Feb 2012 15:34:06 +0000 (-0500) Subject: Attached flex-bison projects. X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=9ee552b802a03f21caecd52d076e1dcd1134f69b;p=archive%2Fbitbucket.git Attached flex-bison projects. --- diff --git a/flex-bison/calculator_ast/Makefile b/flex-bison/calculator_ast/Makefile new file mode 100644 index 0000000..6fc0590 --- /dev/null +++ b/flex-bison/calculator_ast/Makefile @@ -0,0 +1,50 @@ +# Tools +LEX=flex +BISON=bison +CC=gcc + +# File Locations +GRAMMAR_FILE=src/parser.y +TOKENS_FILE=src/lexer.l +APP_NAME=parser + +INCLUDE_PATH= \ + -I. \ + -Isrc \ + -Isrc/ast \ + -Isrc/linked_list + +SRC_FILES= \ + src/main.c \ + parser.tab.c \ + lex.yy.c \ + src/ast/ast.c \ + src/ast/ast_debug.c \ + src/linked_list/linked_list.c + +#------------------------------------------------------------------------------ + +all: clean test $(APP_NAME).exe + +$(APP_NAME).exe: $(SRC_FILES) + $(CC) -o $(APP_NAME) $(INCLUDE_PATH) $(SRC_FILES) + +clean: + rake clobber + rm -f lex.yy.c + rm -f parser.tab.c + rm -f parser.tab.h + rm -f $(APP_NAME).exe + rm -f test.bmp + +test: + rake + +#------------------------------------------------------------------------------ + +parser.tab.c: $(GRAMMAR_FILE) + $(BISON) -d $(GRAMMAR_FILE) + +lex.yy.c: $(TOKENS_FILE) + $(LEX) $(TOKENS_FILE) + diff --git a/flex-bison/calculator_ast/README b/flex-bison/calculator_ast/README new file mode 100644 index 0000000..e69de29 diff --git a/flex-bison/calculator_ast/docs/test.lang b/flex-bison/calculator_ast/docs/test.lang new file mode 100644 index 0000000..ace833b --- /dev/null +++ b/flex-bison/calculator_ast/docs/test.lang @@ -0,0 +1,60 @@ +// Variables +var A +var B = 0 +A = 1 + 1 +B = A + +// If +if ( 1 == 1 ) + var C = 1 + 1 + C = 2 +end + +// If-Else +if ( 1 == 1) + var C = 1 + 1 + C = 2 +else + var C = 1 + 1 + C = 2 +end + +// If-ElseIF-Else +if ( 1 == 1) + var C = 1 + 1 + C = 2 +else if ( 1 == 1 ) + var C = 1 + 1 + C = 2 +else + var C = 1 + 1 + C = 2 +end + +// Multiple Else-Ifs +if ( 1 == 1) + var C = 1 + 1 + C = 2 +else if ( 1 == 1 ) + var C = 1 + 1 + C = 2 +else if ( 1 == 1 ) + var C = 1 + 1 + C = 2 +else + var C = 1 + 1 + C = 2 +end + +// While Loop +while ( 1 == 1 ) + var C = 1 + 1 + C = 2 +end + +// Functions +var foo(A,B) + var C = A + B + return C +end +var D = foo(1,2) diff --git a/flex-bison/calculator_ast/rakefile.rb b/flex-bison/calculator_ast/rakefile.rb new file mode 100644 index 0000000..076e499 --- /dev/null +++ b/flex-bison/calculator_ast/rakefile.rb @@ -0,0 +1,31 @@ +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require './tools/cmock/rakefile_helper' + +include RakefileHelpers + +# Load default configuration, for now +DEFAULT_CONFIG_FILE = 'tools/cmock/cmock.yml' +configure_toolchain(DEFAULT_CONFIG_FILE) + +desc "Run unit tests" +task :unit do + run_tests(get_unit_test_files) +end + +desc "Generate test summary" +task :summary do + report_summary +end + +desc "Build and test Unity" +task :all => [:clean, :unit, :summary] +task :default => [:clobber, :all] + +desc "Load configuration" +task :config, :config_file do |t, args| + configure_toolchain(args[:config_file]) +end diff --git a/flex-bison/calculator_ast/src/ast/ast.c b/flex-bison/calculator_ast/src/ast/ast.c new file mode 100644 index 0000000..cea3c31 --- /dev/null +++ b/flex-bison/calculator_ast/src/ast/ast.c @@ -0,0 +1,75 @@ +#include "ast.h" +#include + +static Node_T* New_ASTValNode(int type, Value_T value); + +// Private -------------------------------------------------------------------- +static Node_T* New_ASTValNode(int type, Value_T value) +{ + ValueNode_T* node = (ValueNode_T*) malloc( sizeof(ValueNode_T) ); + node->node_type = type; + node->value = value; + return (Node_T *) node; +} + +// Public --------------------------------------------------------------------- +Node_T* NODE(int type, int child_count, ...) +{ + va_list arg_list; + int i = 0; + Node_T* node = (Node_T*) malloc( sizeof(Node_T) ); + node->node_type = type; + node->children = NULL; + + va_start (arg_list, child_count); + for (i = 0; i < child_count ; i++) + { + if (node->children == NULL) + { + node->children = LL_New( va_arg(arg_list, Node_T*) ); + } + else + { + LL_Add(node->children, va_arg(arg_list, Node_T*)); + } + } + va_end(arg_list); + + return (Node_T*) node; +} + +Node_T* VAL_CHAR(char value) +{ + Value_T val; + val.Char = value; + return New_ASTValNode(CHAR, val); +} + +Node_T* VAL_INT(int value) +{ + Value_T val; + val.Int = value; + return New_ASTValNode(INT, val); +} + +Node_T* VAL_LONG(long int value) +{ + Value_T val; + val.Long = value; + return New_ASTValNode(LONG, val); +} + +Node_T* VAL_FLOAT(double value) +{ + Value_T val; + val.Float = value; + return New_ASTValNode(FLOAT, val); +} + +Node_T* VAL_STRING(char* value) +{ + Value_T val; + val.String = value; + return New_ASTValNode(STRING, val); +} + diff --git a/flex-bison/calculator_ast/src/ast/ast.h b/flex-bison/calculator_ast/src/ast/ast.h new file mode 100644 index 0000000..f7e95f3 --- /dev/null +++ b/flex-bison/calculator_ast/src/ast/ast.h @@ -0,0 +1,45 @@ +#ifndef AST_H +#define AST_H + +#include "stdarg.h" +#include "parser.tab.h" +#include "linked_list.h" + +// Possible Node Values +union NodeValue +{ + char Char; + int Int; + long int Long; + double Float; + char* String; +}; + +// Structure of Non-Value Node +struct ASTNode +{ + int node_type; + LinkedList_T* children; +}; + +// Structure of Value Node +struct ASTValNode +{ + int node_type; + union NodeValue value; +}; + +// Convenience Types +typedef struct ASTNode Node_T; +typedef struct ASTValNode ValueNode_T; +typedef union NodeValue Value_T; + +// AST Creating Functions +Node_T* NODE(int type, int child_count, ...); +Node_T* VAL_CHAR(char value); +Node_T* VAL_INT(int value); +Node_T* VAL_LONG(long int value); +Node_T* VAL_FLOAT(double value); +Node_T* VAL_STRING(char* value); + +#endif diff --git a/flex-bison/calculator_ast/src/ast/ast_debug.c b/flex-bison/calculator_ast/src/ast/ast_debug.c new file mode 100644 index 0000000..6333225 --- /dev/null +++ b/flex-bison/calculator_ast/src/ast/ast_debug.c @@ -0,0 +1,112 @@ +#include "ast_debug.h" +#include + +// Types +typedef unsigned char BOOL; +typedef unsigned char U8; +typedef enum +{ + NONE = 0, + UNKNOWN = 1, + FLOAT_FMT = 2 +} ParamType_T; +typedef struct +{ + int node_type; + BOOL has_children; + char* label_string; + ParamType_T param_type; +} NodeDef_T; + +#define TRUE 1 +#define FALSE 0 +#define CHILDREN 1 +#define NO_CHILDREN 0 + +// Prototypes +void PrintNodeDefinition(Node_T* tree, NodeDef_T* def); +void PrintChildNode(Node_T* tree, int parent); +NodeDef_T* LookupNodeDef(int node_type); + +// Globals +static int Node_Count = 0; +#define NODE_DEF_COUNT 7 +static const NodeDef_T Node_Lookup_Table[ NODE_DEF_COUNT ] = { + { FLOAT, NO_CHILDREN, "\t%d [label=\"%4.2f\"]\n", FLOAT_FMT }, + { ADD, CHILDREN, "\t%d [label=\"+\"]\n", NONE }, + { SUB, CHILDREN, "\t%d [label=\"-\"]\n", NONE }, + { MUL, CHILDREN, "\t%d [label=\"*\"]\n", NONE }, + { DIV, CHILDREN, "\t%d [label=\"/\"]\n", NONE }, + { MOD, CHILDREN, "\t%d [label=\"MOD\"]\n", NONE }, + { 0, CHILDREN, "\t%d [label=\"%d\"]\n", UNKNOWN } +}; + + +// Function Definitions +NodeDef_T* LookupNodeDef(int node_type) +{ + U8 i = 0; + NodeDef_T* def = (NodeDef_T*) &Node_Lookup_Table[ NODE_DEF_COUNT - 1 ]; + for (i = 0; i < NODE_DEF_COUNT; i++) + { + if ( Node_Lookup_Table[i].node_type == node_type ) + { + def = (NodeDef_T*) &Node_Lookup_Table[ i ]; + break; + } + } + return def; +} + +void PrintNodeDefinition(Node_T* tree, NodeDef_T* def) +{ + switch (def->param_type) + { + case NONE: + printf(def->label_string, Node_Count); + break; + + case FLOAT_FMT: + printf(def->label_string, Node_Count, ((ValueNode_T*)tree)->value.Float); + break; + + case UNKNOWN: + default: + printf( Node_Lookup_Table[NODE_DEF_COUNT-1].label_string, Node_Count, tree->node_type); + break; + } +} + +void PrintChildNode(Node_T* tree, int parent) +{ + if (tree != NULL) + { + printf("\t%d->%d\n", parent, ++Node_Count); + PrintNode( tree, parent); + } +} + +void PrintNode(Node_T* tree, int parent) +{ + int current_node = Node_Count; + int i = 0; + NodeDef_T* def = LookupNodeDef(tree->node_type); + PrintNodeDefinition(tree,def); + if ( def->has_children ) + { + LinkedList_T* child = tree->children; + while (child != NULL) + { + PrintChildNode( (Node_T*)child->contents, current_node ); + child = child->next; + } + } +} + +void PrintAST(Node_T* tree) +{ + Node_Count = 0; + printf("digraph {\n"); + PrintNode(tree,0); + printf("}\n"); +} diff --git a/flex-bison/calculator_ast/src/ast/ast_debug.h b/flex-bison/calculator_ast/src/ast/ast_debug.h new file mode 100644 index 0000000..808be8e --- /dev/null +++ b/flex-bison/calculator_ast/src/ast/ast_debug.h @@ -0,0 +1,9 @@ +#ifndef AST_DEBUG_H +#define AST_DEBUG_H + +#include "ast.h" + +void PrintNode(Node_T* tree, int parent); +void PrintAST(Node_T* tree); + +#endif diff --git a/flex-bison/calculator_ast/src/lexer.l b/flex-bison/calculator_ast/src/lexer.l new file mode 100644 index 0000000..ac55f3e --- /dev/null +++ b/flex-bison/calculator_ast/src/lexer.l @@ -0,0 +1,25 @@ +%{ + +/* Includes */ +#include "parser.tab.h" + +%} + +%option noyywrap + +%% + +"+" { return ADD; } +"-" { return SUB; } +"*" { return MUL; } +"/" { return DIV; } +"%" { return MOD; } +"&&" { return AND; } +"||" { return OR; } +"!" { return NOT; } +[\n] { return EOL; } +[ \t] ; +[0-9]+(\.[0-9][0-9]*)? { yylval.Float = atof(yytext); return FLOAT; } +. { yyerror(yytext); } + +%% diff --git a/flex-bison/calculator_ast/src/linked_list/linked_list.c b/flex-bison/calculator_ast/src/linked_list/linked_list.c new file mode 100644 index 0000000..d7f9c89 --- /dev/null +++ b/flex-bison/calculator_ast/src/linked_list/linked_list.c @@ -0,0 +1,72 @@ +#include "linked_list.h" +#include + +LinkedList_T* LL_New( PTR_TYPE contents ) +{ + LinkedList_T* list = (LinkedList_T*)malloc( sizeof(LinkedList_T) ); + list->contents = contents; + list->next = NULL; + return list; +} + +LinkedList_T* LL_Last(LinkedList_T* list) +{ + LinkedList_T* node = list; + while((node != NULL) && (node->next != NULL)) + { + node = node->next; + } + return node; +} + +LinkedList_T* LL_Get(LinkedList_T* list, int index) +{ + int current = 0; + LinkedList_T* node = list; + LinkedList_T* indexed_node = NULL; + while ((node != NULL) && (node->next != NULL)) + { + current++; + node = node->next; + if ( current == index ) + { + indexed_node = node; + break; + } + } + return indexed_node; +} + +void LL_Add( LinkedList_T* list, PTR_TYPE contents ) +{ + LinkedList_T* node = LL_Last( list ); + node->next = LL_New( contents ); +} + +void LL_Insert( LinkedList_T* list, int index, PTR_TYPE contents) +{ + LinkedList_T* node = LL_Get( list, index ); + node->next = LL_New( contents ); +} + +void LL_Delete( LinkedList_T* list, int index ) +{ + LinkedList_T* node = LL_Get( list, (index-1)); + if((node != NULL) && (node->next != NULL)) + { + LinkedList_T* node_to_delete = node->next; + node->next = node_to_delete->next; + free(node_to_delete); + } +} + +void LL_Free( LinkedList_T* list) +{ + LinkedList_T* node = list; + while( node != NULL ) + { + LinkedList_T* next = node->next; + free(node); + node = next; + } +} diff --git a/flex-bison/calculator_ast/src/linked_list/linked_list.h b/flex-bison/calculator_ast/src/linked_list/linked_list.h new file mode 100644 index 0000000..2c6d2bd --- /dev/null +++ b/flex-bison/calculator_ast/src/linked_list/linked_list.h @@ -0,0 +1,22 @@ +#ifndef LINKED_LIST_H +#define LINKED_LIST_H + +// Some macro magic to change the pointer type of each cell +//#include "ast.h" // The include that contains the necessary typedef +#define PTR_TYPE void * // The macro used within this module (default: (void *)) + +typedef struct LinkedList +{ + PTR_TYPE contents; + struct LinkedList * next; +} LinkedList_T; + +LinkedList_T* LL_New( PTR_TYPE contents ); +LinkedList_T* LL_Last(LinkedList_T* list); +LinkedList_T* LL_Get(LinkedList_T* list, int index); +void LL_Add( LinkedList_T* list, PTR_TYPE contents ); +void LL_Insert( LinkedList_T* list, int index, PTR_TYPE contents); +void LL_Delete( LinkedList_T* list, int index ); +void LL_Free( LinkedList_T* list); + +#endif diff --git a/flex-bison/calculator_ast/src/main.c b/flex-bison/calculator_ast/src/main.c new file mode 100644 index 0000000..bc5c0e3 --- /dev/null +++ b/flex-bison/calculator_ast/src/main.c @@ -0,0 +1,11 @@ +#include + +int main(int argc, char** argv) +{ + yyparse(); +} + +void yyerror(char *s) +{ + fprintf(stderr,"Error: %s\n",s); +} diff --git a/flex-bison/calculator_ast/src/parser.y b/flex-bison/calculator_ast/src/parser.y new file mode 100644 index 0000000..fc3224d --- /dev/null +++ b/flex-bison/calculator_ast/src/parser.y @@ -0,0 +1,66 @@ +%{ + +#include +#include "ast.h" + +%} + +/* Values Union */ +%union +{ + char Char; + int Int; + long int Long; + double Float; + char* String; + struct ASTNode * Node; +} + +/* Tokens */ +%token CHAR +%token INT +%token LONG +%token FLOAT +%token STRING +%token ADD SUB MUL DIV MOD AND OR NOT +%token IF WHILE +%token EOL END + +/* Rule Return Types */ +%type exp +%type bool_exp + +/* Order of Precedence for Operators */ +%left ADD SUB +%left MUL DIV MOD +%left AND OR +%nonassoc NOT + + +/* Starting Rule */ +%start program + +%% + +program: + | program exp EOL { PrintAST($2); } + ; + +exp: + exp ADD exp { $$ = NODE( ADD, 2, $1, $3 ); } + | exp SUB exp { $$ = NODE( SUB, 2, $1, $3 ); } + | exp MUL exp { $$ = NODE( MUL, 2, $1, $3 ); } + | exp DIV exp { $$ = NODE( DIV, 2, $1, $3 ); } + | exp MOD exp { $$ = NODE( MOD, 2, $1, $3 ); } + | bool_exp + | FLOAT { $$ = VAL_FLOAT( $1 ); } + ; + +bool_exp: + exp AND exp { $$ = NODE( AND, 2, $1, $3 ); } + | exp OR exp { $$ = NODE( OR, 2, $1, $3 ); } + | NOT exp { $$ = NODE( NOT, 1, $2); } + ; + +%% + diff --git a/flex-bison/calculator_ast/tests/ast/test_ast.c b/flex-bison/calculator_ast/tests/ast/test_ast.c new file mode 100644 index 0000000..1effaa5 --- /dev/null +++ b/flex-bison/calculator_ast/tests/ast/test_ast.c @@ -0,0 +1,12 @@ +#include "unity.h" + +void setUp(void) +{ + +} + +void tearDown(void) +{ + +} + diff --git a/flex-bison/calculator_ast/tests/ast/test_ast_debug.c b/flex-bison/calculator_ast/tests/ast/test_ast_debug.c new file mode 100644 index 0000000..1effaa5 --- /dev/null +++ b/flex-bison/calculator_ast/tests/ast/test_ast_debug.c @@ -0,0 +1,12 @@ +#include "unity.h" + +void setUp(void) +{ + +} + +void tearDown(void) +{ + +} + diff --git a/flex-bison/calculator_ast/tests/linked_list/test_linked_list.c b/flex-bison/calculator_ast/tests/linked_list/test_linked_list.c new file mode 100644 index 0000000..20f8494 --- /dev/null +++ b/flex-bison/calculator_ast/tests/linked_list/test_linked_list.c @@ -0,0 +1,85 @@ +#include "unity.h" + +// File to Test +#include "linked_list.c" + +void setUp(void) +{ + +} + +void tearDown(void) +{ + +} + +//----------------------------------------------------------------------------- +void test_LL_New_should_return_a_new_linked_list_with_the_supplied_contents(void) +{ +// Setup + int num = 42; +// Expected Function Calls +// Function to Test + LinkedList_T* list = LL_New(&num); +// Asserts + TEST_ASSERT_NOT_EQUAL(NULL, list); + TEST_ASSERT_EQUAL(&num, list->contents); + TEST_ASSERT_EQUAL(NULL, list->next); +} + +//----------------------------------------------------------------------------- +void test_LL_Last(void) +{ +// Setup +// Expected Function Calls +// Function to Test +// Asserts +} + +//----------------------------------------------------------------------------- +void test_LL_Get(void) +{ +// Setup +// Expected Function Calls +// Function to Test +// Asserts +} + +//----------------------------------------------------------------------------- +void test_LL_Add(void) +{ +// Setup +// Expected Function Calls +// Function to Test +// Asserts +} + +//----------------------------------------------------------------------------- +void test_LL_Insert(void) +{ +// Setup +// Expected Function Calls +// Function to Test +// Asserts +} + +//----------------------------------------------------------------------------- +void test_Delete(void) +{ +// Setup +// Expected Function Calls +// Function to Test +// Asserts +} + +//----------------------------------------------------------------------------- +void test_Free(void) +{ +// Setup +// Expected Function Calls +// Function to Test +// Asserts +} + +//----------------------------------------------------------------------------- + diff --git a/flex-bison/calculator_ast/tests/test_main.c b/flex-bison/calculator_ast/tests/test_main.c new file mode 100644 index 0000000..1effaa5 --- /dev/null +++ b/flex-bison/calculator_ast/tests/test_main.c @@ -0,0 +1,12 @@ +#include "unity.h" + +void setUp(void) +{ + +} + +void tearDown(void) +{ + +} + diff --git a/flex-bison/calculator_ast/tools/cmock/cmock.yml b/flex-bison/calculator_ast/tools/cmock/cmock.yml new file mode 100644 index 0000000..0a56c4c --- /dev/null +++ b/flex-bison/calculator_ast/tools/cmock/cmock.yml @@ -0,0 +1,43 @@ +compiler: + path: gcc + source_path: 'src/' + unit_tests_path: &unit_tests_path 'tests/' + build_path: &build_path 'build/' + options: + - -c + includes: + prefix: '-I' + items: + - 'src/' + - 'src/ast/' + - 'src/linked_list/' + - 'tools/cmock/src/' + - 'tools/unity/src/' + - 'tools/unity/helper/' + - 'mocks/' + - *unit_tests_path + defines: + prefix: '-D' + items: + - __monitor + object_files: + prefix: '-o' + extension: '.o' + destination: *build_path +linker: + path: gcc + options: + - -lm + includes: + prefix: '-I' + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.exe' + destination: *build_path +:cmock: + :plugins: [] + :mock_prefix: 'mock_' +colour: true diff --git a/flex-bison/calculator_ast/tools/cmock/rakefile_helper.rb b/flex-bison/calculator_ast/tools/cmock/rakefile_helper.rb new file mode 100644 index 0000000..6dbf86f --- /dev/null +++ b/flex-bison/calculator_ast/tools/cmock/rakefile_helper.rb @@ -0,0 +1,270 @@ +require 'yaml' +require 'fileutils' +require './tools/unity/auto/unity_test_summary' +require './tools/unity/auto/generate_test_runner' +require './tools/unity/auto/colour_reporter' + +module RakefileHelpers + + C_EXTENSION = '.c' + + def load_configuration(config_file) + $cfg_file = config_file + $cfg = YAML.load(File.read($cfg_file)) + $colour_output = false unless $cfg['colour'] + end + + def configure_clean + CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil? + end + + def configure_toolchain(config_file=DEFAULT_CONFIG_FILE) + config_file += '.yml' unless config_file =~ /\.yml$/ + load_configuration(config_file) + configure_clean + end + + def get_unit_test_files + path = $cfg['compiler']['unit_tests_path'] + '**/test_*' + C_EXTENSION + path.gsub!(/\\/, '/') + FileList.new(path) + end + + def get_local_include_dirs + include_dirs = $cfg['compiler']['includes']['items'].dup + include_dirs.delete_if {|dir| dir.is_a?(Array)} + return include_dirs + end + + def extract_headers(filename) + includes = [] + lines = File.readlines(filename) + lines.each do |line| + m = line.match(/^\s*#include\s+\"\s*(.+\.[hH])\s*\"/) + if not m.nil? + includes << m[1] + end + end + return includes + end + + def find_source_file(header, paths) + paths.each do |dir| + src_file = dir + header.ext(C_EXTENSION) + if (File.exists?(src_file)) + return src_file + end + end + return nil + end + + def tackit(strings) + case(strings) + when Array + "\"#{strings.join}\"" + when /^-/ + strings + when /\s/ + "\"#{strings}\"" + else + strings + end + end + + def squash(prefix, items) + result = '' + items.each { |item| result += " #{prefix}#{tackit(item)}" } + return result + end + + def build_compiler_fields + command = tackit($cfg['compiler']['path']) + if $cfg['compiler']['defines']['items'].nil? + defines = '' + else + defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items']) + end + options = squash('', $cfg['compiler']['options']) + includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :defines => defines, :options => options, :includes => includes} + end + + def compile(file, defines=[]) + compiler = build_compiler_fields + cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{file} " + + "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" + + "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" + execute(cmd_str) + end + + def build_linker_fields + command = tackit($cfg['linker']['path']) + if $cfg['linker']['options'].nil? + options = '' + else + options = squash('', $cfg['linker']['options']) + end + if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?) + includes = '' + else + includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) + end + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :options => options, :includes => includes} + end + + def link(exe_name, obj_list) + linker = build_linker_fields + cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + + (obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).join + + $cfg['linker']['bin_files']['prefix'] + ' ' + + $cfg['linker']['bin_files']['destination'] + + exe_name + $cfg['linker']['bin_files']['extension'] + execute(cmd_str) + end + + def build_simulator_fields + return nil if $cfg['simulator'].nil? + if $cfg['simulator']['path'].nil? + command = '' + else + command = (tackit($cfg['simulator']['path']) + ' ') + end + if $cfg['simulator']['pre_support'].nil? + pre_support = '' + else + pre_support = squash('', $cfg['simulator']['pre_support']) + end + if $cfg['simulator']['post_support'].nil? + post_support = '' + else + post_support = squash('', $cfg['simulator']['post_support']) + end + return {:command => command, :pre_support => pre_support, :post_support => post_support} + end + + def execute(command_string, verbose=true) + report command_string + output = `#{command_string}`.chomp + report(output) if (verbose && !output.nil? && (output.length > 0)) + if $?.exitstatus != 0 + raise "Command failed. (Returned #{$?.exitstatus})" + end + return output + end + + def report_summary + summary = UnityTestSummary.new + summary.set_root_path(HERE) + results_glob = "#{$cfg['compiler']['build_path']}*.test*" + results_glob.gsub!(/\\/, '/') + results = Dir[results_glob] + summary.set_targets(results) + report summary.run + raise "There were failures" if (summary.failures > 0) + end + + def run_tests(test_files) + + report 'Running system tests...' + + # Tack on TEST define for compiling unit tests + load_configuration($cfg_file) + test_defines = ['TEST'] + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + $cfg['compiler']['defines']['items'] << 'TEST' + + include_dirs = get_local_include_dirs + + # Build and execute each unit test + test_files.each do |test| + obj_list = [] + + # Detect dependencies and build required required modules + header_list = extract_headers(test) + ['cmock.h'] + header_list.each do |header| + + #create mocks if needed + if (header =~ /Mock/) + require "../lib/cmock.rb" + @cmock ||= CMock.new($cfg_file) + @cmock.setup_mocks([$cfg['compiler']['source_path']+header.gsub('Mock','')]) + end + + # Compile corresponding source file if it exists + src_file = find_source_file(header, include_dirs) + if !src_file.nil? + compile(src_file, test_defines) + obj_list << header.ext($cfg['compiler']['object_files']['extension']) + end + end + + # Build the test runner (generate if configured to do so) + test_base = File.basename(test, C_EXTENSION) + runner_name = test_base + '_Runner.c' + if $cfg['compiler']['runner_path'].nil? + runner_path = $cfg['compiler']['build_path'] + runner_name + test_gen = UnityTestRunnerGenerator.new($cfg_file) + test_gen.run(test, runner_path) + else + runner_path = $cfg['compiler']['runner_path'] + runner_name + end + + compile(runner_path, test_defines) + obj_list << runner_name.ext($cfg['compiler']['object_files']['extension']) + + # Build the test module + compile(test, test_defines) + obj_list << test_base.ext($cfg['compiler']['object_files']['extension']) + + # Link the test executable + link(test_base, obj_list) + + # Execute unit test and generate results file + simulator = build_simulator_fields + executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] + if simulator.nil? + cmd_str = executable + else + cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" + end + output = execute(cmd_str) + test_results = $cfg['compiler']['build_path'] + test_base + if output.match(/OK$/m).nil? + test_results += '.testfail' + else + test_results += '.testpass' + end + File.open(test_results, 'w') { |f| f.print output } + end + end + + def build_application(main) + + report "Building application..." + + obj_list = [] + load_configuration($cfg_file) + main_path = $cfg['compiler']['source_path'] + main + C_EXTENSION + + # Detect dependencies and build required required modules + include_dirs = get_local_include_dirs + extract_headers(main_path).each do |header| + src_file = find_source_file(header, include_dirs) + if !src_file.nil? + compile(src_file) + obj_list << header.ext($cfg['compiler']['object_files']['extension']) + end + end + + # Build the main source file + main_base = File.basename(main_path, C_EXTENSION) + compile(main_path) + obj_list << main_base.ext($cfg['compiler']['object_files']['extension']) + + # Create the executable + link(main_base, obj_list) + end + +end diff --git a/flex-bison/calculator_ast/tools/cmock/src/cmock.c b/flex-bison/calculator_ast/tools/cmock/src/cmock.c new file mode 100644 index 0000000..1eec694 --- /dev/null +++ b/flex-bison/calculator_ast/tools/cmock/src/cmock.c @@ -0,0 +1,164 @@ +/* ========================================== + CMock Project - Automatic Mock Generation for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity.h" +#include "cmock.h" + +//define CMOCK_MEM_DYNAMIC to grab memory as needed with malloc +//when you do that, CMOCK_MEM_SIZE is used for incremental size instead of total +#ifdef CMOCK_MEM_STATIC +#undef CMOCK_MEM_DYNAMIC +#endif + +#ifdef CMOCK_MEM_DYNAMIC +#include +#endif + +//should be big enough to index full range of CMOCK_MEM_MAX +#ifndef CMOCK_MEM_INDEX_TYPE +#define CMOCK_MEM_INDEX_TYPE unsigned int +#endif + +//this is used internally during pointer arithmetic. make sure this type is the same size as the target's pointer type +#ifndef CMOCK_MEM_PTR_AS_INT +#define CMOCK_MEM_PTR_AS_INT unsigned long +#endif + +//0 for no alignment, 1 for 16-bit, 2 for 32-bit, 3 for 64-bit +#ifndef CMOCK_MEM_ALIGN +#define CMOCK_MEM_ALIGN (2) +#endif + +//amount of memory to allow cmock to use in its internal heap +#ifndef CMOCK_MEM_SIZE +#define CMOCK_MEM_SIZE (32768) +#endif + +//automatically calculated defs for easier reading +#define CMOCK_MEM_ALIGN_SIZE (1u << CMOCK_MEM_ALIGN) +#define CMOCK_MEM_ALIGN_MASK (CMOCK_MEM_ALIGN_SIZE - 1) +#define CMOCK_MEM_INDEX_SIZE ((sizeof(CMOCK_MEM_INDEX_TYPE) > CMOCK_MEM_ALIGN_SIZE) ? sizeof(CMOCK_MEM_INDEX_TYPE) : CMOCK_MEM_ALIGN_SIZE) + +//private variables +#ifdef CMOCK_MEM_DYNAMIC +static unsigned char* CMock_Guts_Buffer = NULL; +static unsigned int CMock_Guts_BufferSize = 0; +static unsigned int CMock_Guts_FreePtr; +#else +static unsigned char CMock_Guts_Buffer[CMOCK_MEM_SIZE]; +static unsigned int CMock_Guts_BufferSize = CMOCK_MEM_SIZE; +static unsigned int CMock_Guts_FreePtr; +#endif +//------------------------------------------------------- +// CMock_Guts_MemNew +//------------------------------------------------------- +void* CMock_Guts_MemNew(unsigned int size) +{ + unsigned int index; + + //verify arguments valid (we must be allocating space for at least 1 byte, and the existing chain must be in memory somewhere) + if (size < 1) + return NULL; + + //verify we have enough room + size = size + CMOCK_MEM_INDEX_SIZE; + if (size & CMOCK_MEM_ALIGN_MASK) + size = (size + CMOCK_MEM_ALIGN_MASK) & ~CMOCK_MEM_ALIGN_MASK; + if ((CMock_Guts_BufferSize - CMock_Guts_FreePtr) < size) + { +#ifdef CMOCK_MEM_DYNAMIC + CMock_Guts_BufferSize += CMOCK_MEM_SIZE + size; + CMock_Guts_Buffer = realloc(CMock_Guts_Buffer, CMock_Guts_BufferSize); + if (CMock_Guts_Buffer == NULL) +#endif //yes that if will continue to the return below if TRUE + return NULL; + } + + //determine where we're putting this new block, and init its pointer to be the end of the line + index = CMock_Guts_FreePtr + CMOCK_MEM_INDEX_SIZE; + *(CMOCK_MEM_INDEX_TYPE*)(&CMock_Guts_Buffer[CMock_Guts_FreePtr]) = 0; + CMock_Guts_FreePtr += size; + + return (&CMock_Guts_Buffer[index]); +} + +//------------------------------------------------------- +// CMock_Guts_MemChain +//------------------------------------------------------- +void* CMock_Guts_MemChain(void* root, void* obj) +{ + unsigned int index; + void* next; + + if (root == NULL) + { + //if there is no root currently, we return this object as the root of the chain + return obj; + } + else + { + //reject illegal nodes + if ((root < (void*)CMock_Guts_Buffer) || (root >= (void*)(&CMock_Guts_Buffer[CMock_Guts_FreePtr]))) + return NULL; + if ((obj < (void*)CMock_Guts_Buffer) || (obj >= (void*)(&CMock_Guts_Buffer[CMock_Guts_FreePtr]))) + return NULL; + + //find the end of the existing chain and add us + next = root; + do { + index = *(CMOCK_MEM_INDEX_TYPE*)((CMOCK_MEM_PTR_AS_INT)next - CMOCK_MEM_INDEX_SIZE); + if (index >= CMock_Guts_FreePtr) + return NULL; + if (index > 0) + next = (void*)(&CMock_Guts_Buffer[index]); + } while (index > 0); + *(CMOCK_MEM_INDEX_TYPE*)((CMOCK_MEM_PTR_AS_INT)next - CMOCK_MEM_INDEX_SIZE) = ((CMOCK_MEM_PTR_AS_INT)obj - (CMOCK_MEM_PTR_AS_INT)CMock_Guts_Buffer); + return root; + } +} + +//------------------------------------------------------- +// CMock_Guts_MemNext +//------------------------------------------------------- +void* CMock_Guts_MemNext(void* previous_item) +{ + CMOCK_MEM_INDEX_TYPE index; + + //There is nothing "next" if the pointer isn't from our buffer + if ((previous_item < (void*)CMock_Guts_Buffer) || (previous_item >= (void*)(&CMock_Guts_Buffer[CMock_Guts_FreePtr]))) + return NULL; + + //if the pointer is good, then use it to look up the next index (we know the first element always goes in zero, so NEXT must always be > 1) + index = *(CMOCK_MEM_INDEX_TYPE*)((CMOCK_MEM_PTR_AS_INT)previous_item - CMOCK_MEM_INDEX_SIZE); + if ((index > 1) && (index < CMock_Guts_FreePtr)) + return (void*)(&CMock_Guts_Buffer[index]); + else + return NULL; +} + +//------------------------------------------------------- +// CMock_Guts_MemBytesFree +//------------------------------------------------------- +unsigned int CMock_Guts_MemBytesFree(void) +{ + return CMock_Guts_BufferSize - CMock_Guts_FreePtr; +} + +//------------------------------------------------------- +// CMock_Guts_MemBytesUsed +//------------------------------------------------------- +unsigned int CMock_Guts_MemBytesUsed(void) +{ + return CMock_Guts_FreePtr; +} + +//------------------------------------------------------- +// CMock_Guts_MemFreeAll +//------------------------------------------------------- +void CMock_Guts_MemFreeAll(void) +{ + CMock_Guts_FreePtr = 0; +} diff --git a/flex-bison/calculator_ast/tools/cmock/src/cmock.h b/flex-bison/calculator_ast/tools/cmock/src/cmock.h new file mode 100644 index 0000000..5a1bd7c --- /dev/null +++ b/flex-bison/calculator_ast/tools/cmock/src/cmock.h @@ -0,0 +1,20 @@ +/* ========================================== + CMock Project - Automatic Mock Generation for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef CMOCK_FRAMEWORK_H +#define CMOCK_FRAMEWORK_H + +//------------------------------------------------------- +// Memory API +//------------------------------------------------------- +void* CMock_Guts_MemNew(unsigned int size); +void* CMock_Guts_MemChain(void* root, void* obj); +void* CMock_Guts_MemNext(void* previous_item); +unsigned int CMock_Guts_MemBytesFree(void); +unsigned int CMock_Guts_MemBytesUsed(void); +void CMock_Guts_MemFreeAll(void); + +#endif //CMOCK_FRAMEWORK diff --git a/flex-bison/calculator_ast/tools/make/config.mak b/flex-bison/calculator_ast/tools/make/config.mak new file mode 100644 index 0000000..428d643 --- /dev/null +++ b/flex-bison/calculator_ast/tools/make/config.mak @@ -0,0 +1,12 @@ + +CC +CFLAGS + +LEX +LFLAGS + +YACC +YFLAGS + +RM + diff --git a/flex-bison/calculator_ast/tools/scripts/generate_ast_graph.bat b/flex-bison/calculator_ast/tools/scripts/generate_ast_graph.bat new file mode 100644 index 0000000..9bcb43a --- /dev/null +++ b/flex-bison/calculator_ast/tools/scripts/generate_ast_graph.bat @@ -0,0 +1,3 @@ +@echo off +echo %* | parser.exe | dot -Tbmp > test.bmp +test.bmp diff --git a/flex-bison/calculator_ast/tools/unity/auto/colour_prompt.rb b/flex-bison/calculator_ast/tools/unity/auto/colour_prompt.rb new file mode 100644 index 0000000..81003dd --- /dev/null +++ b/flex-bison/calculator_ast/tools/unity/auto/colour_prompt.rb @@ -0,0 +1,94 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +if RUBY_PLATFORM =~/(win|w)32$/ + begin + require 'Win32API' + rescue LoadError + puts "ERROR! \"Win32API\" library not found" + puts "\"Win32API\" is required for colour on a windows machine" + puts " try => \"gem install Win32API\" on the command line" + puts + end + # puts + # puts 'Windows Environment Detected...' + # puts 'Win32API Library Found.' + # puts +end + +class ColourCommandLine + def initialize + if RUBY_PLATFORM =~/(win|w)32$/ + get_std_handle = Win32API.new("kernel32", "GetStdHandle", ['L'], 'L') + @set_console_txt_attrb = + Win32API.new("kernel32","SetConsoleTextAttribute",['L','N'], 'I') + @hout = get_std_handle.call(-11) + end + end + + def change_to(new_colour) + if RUBY_PLATFORM =~/(win|w)32$/ + @set_console_txt_attrb.call(@hout,self.win32_colour(new_colour)) + else + "\033[30;#{posix_colour(new_colour)};22m" + end + end + + def win32_colour(colour) + case colour + when :black then 0 + when :dark_blue then 1 + when :dark_green then 2 + when :dark_cyan then 3 + when :dark_red then 4 + when :dark_purple then 5 + when :dark_yellow, :narrative then 6 + when :default_white, :default, :dark_white then 7 + when :silver then 8 + when :blue then 9 + when :green, :success then 10 + when :cyan, :output then 11 + when :red, :failure then 12 + when :purple then 13 + when :yellow then 14 + when :white then 15 + else + 0 + end + end + + def posix_colour(colour) + case colour + when :black then 30 + when :red, :failure then 31 + when :green, :success then 32 + when :yellow then 33 + when :blue, :narrative then 34 + when :purple, :magenta then 35 + when :cyan, :output then 36 + when :white, :default_white, :default then 37 + else + 30 + end + end + + def out_c(mode, colour, str) + case RUBY_PLATFORM + when /(win|w)32$/ + change_to(colour) + $stdout.puts str if mode == :puts + $stdout.print str if mode == :print + change_to(:default_white) + else + $stdout.puts("#{change_to(colour)}#{str}\033[0m") if mode == :puts + $stdout.print("#{change_to(colour)}#{str}\033[0m") if mode == :print + end + end +end # ColourCommandLine + +def colour_puts(role,str) ColourCommandLine.new.out_c(:puts, role, str) end +def colour_print(role,str) ColourCommandLine.new.out_c(:print, role, str) end + diff --git a/flex-bison/calculator_ast/tools/unity/auto/colour_reporter.rb b/flex-bison/calculator_ast/tools/unity/auto/colour_reporter.rb new file mode 100644 index 0000000..5aa1d27 --- /dev/null +++ b/flex-bison/calculator_ast/tools/unity/auto/colour_reporter.rb @@ -0,0 +1,39 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require "#{File.expand_path(File.dirname(__FILE__))}/colour_prompt" + +$colour_output = true + +def report(message) + if not $colour_output + $stdout.puts(message) + else + message = message.join('\n') if (message.class == Array) + message.each_line do |line| + line.chomp! + colour = case(line) + when /(?:total\s+)?tests:?\s+(\d+)\s+(?:total\s+)?failures:?\s+\d+\s+Ignored:?/i + ($1.to_i == 0) ? :green : :red + when /PASS/ + :green + when /^OK$/ + :green + when /(?:FAIL|ERROR)/ + :red + when /IGNORE/ + :yellow + when /^(?:Creating|Compiling|Linking)/ + :white + else + :silver + end + colour_puts(colour, line) + end + end + $stdout.flush + $stderr.flush +end \ No newline at end of file diff --git a/flex-bison/calculator_ast/tools/unity/auto/generate_config.yml b/flex-bison/calculator_ast/tools/unity/auto/generate_config.yml new file mode 100644 index 0000000..4a5e474 --- /dev/null +++ b/flex-bison/calculator_ast/tools/unity/auto/generate_config.yml @@ -0,0 +1,36 @@ +#this is a sample configuration file for generate_module +#you would use it by calling generate_module with the -ygenerate_config.yml option +#files like this are useful for customizing generate_module to your environment +:generate_module: + :defaults: + #these defaults are used in place of any missing options at the command line + :path_src: ../src/ + :path_inc: ../src/ + :path_tst: ../test/ + :update_svn: true + :includes: + #use [] for no additional includes, otherwise list the includes on separate lines + :src: + - Defs.h + - Board.h + :inc: [] + :tst: + - Defs.h + - Board.h + - Exception.h + :boilerplates: + #these are inserted at the top of generated files. + #just comment out or remove if not desired. + #use %1$s where you would like the file name to appear (path/extension not included) + :src: | + //------------------------------------------- + // %1$s.c + //------------------------------------------- + :inc: | + //------------------------------------------- + // %1$s.h + //------------------------------------------- + :tst: | + //------------------------------------------- + // Test%1$s.c : Units tests for %1$s.c + //------------------------------------------- diff --git a/flex-bison/calculator_ast/tools/unity/auto/generate_module.rb b/flex-bison/calculator_ast/tools/unity/auto/generate_module.rb new file mode 100644 index 0000000..c1fd02f --- /dev/null +++ b/flex-bison/calculator_ast/tools/unity/auto/generate_module.rb @@ -0,0 +1,200 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +# This script creates all the files with start code necessary for a new module. +# A simple module only requires a source file, header file, and test file. +# Triad modules require a source, header, and test file for each triad type (like model, conductor, and hardware). + +require 'rubygems' +require 'fileutils' + +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +#help text when requested +HELP_TEXT = [ "\nGENERATE MODULE\n-------- ------", + "\nUsage: ruby generate_module [options] module_name", + " -i\"include\" sets the path to output headers to 'include' (DEFAULT ../src)", + " -s\"../src\" sets the path to output source to '../src' (DEFAULT ../src)", + " -t\"C:/test\" sets the path to output source to 'C:/test' (DEFAULT ../test)", + " -p\"MCH\" sets the output pattern to MCH.", + " dh - driver hardware.", + " dih - driver interrupt hardware.", + " mch - model conductor hardware.", + " mvp - model view presenter.", + " src - just a single source module. (DEFAULT)", + " -d destroy module instead of creating it.", + " -u update subversion too (requires subversion command line)", + " -y\"my.yml\" selects a different yaml config file for module generation", + "" ].join("\n") + +#Built in patterns +PATTERNS = { 'src' => {'' => { :inc => [] } }, + 'dh' => {'Driver' => { :inc => ['%1$sHardware.h'] }, + 'Hardware' => { :inc => [] } + }, + 'dih' => {'Driver' => { :inc => ['%1$sHardware.h', '%1$sInterrupt.h'] }, + 'Interrupt'=> { :inc => ['%1$sHardware.h'] }, + 'Hardware' => { :inc => [] } + }, + 'mch' => {'Model' => { :inc => [] }, + 'Conductor'=> { :inc => ['%1$sModel.h', '%1$sHardware.h'] }, + 'Hardware' => { :inc => [] } + }, + 'mvp' => {'Model' => { :inc => [] }, + 'Presenter'=> { :inc => ['%1$sModel.h', '%1$sView.h'] }, + 'View' => { :inc => [] } + } + } + +#TEMPLATE_TST +TEMPLATE_TST = %q[#include "unity.h" +%2$s#include "%1$s.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void test_%1$s_NeedToImplement(void) +{ + TEST_IGNORE(); +} +] + +#TEMPLATE_SRC +TEMPLATE_SRC = %q[%2$s#include "%1$s.h" +] + +#TEMPLATE_INC +TEMPLATE_INC = %q[#ifndef _%3$s_H +#define _%3$s_H%2$s + +#endif // _%3$s_H +] + +# Parse the command line parameters. +ARGV.each do |arg| + case(arg) + when /^-d/ then @destroy = true + when /^-u/ then @update_svn = true + when /^-p(\w+)/ then @pattern = $1 + when /^-s(.+)/ then @path_src = $1 + when /^-i(.+)/ then @path_inc = $1 + when /^-t(.+)/ then @path_tst = $1 + when /^-y(.+)/ then @yaml_config = $1 + when /^(\w+)/ + raise "ERROR: You can't have more than one Module name specified!" unless @module_name.nil? + @module_name = arg + when /^-(h|-help)/ + puts HELP_TEXT + exit + else + raise "ERROR: Unknown option specified '#{arg}'" + end +end +raise "ERROR: You must have a Module name specified! (use option -h for help)" if @module_name.nil? + +#load yaml file if one was requested +if @yaml_config + require 'yaml' + cfg = YAML.load_file(HERE + @yaml_config)[:generate_module] + @path_src = cfg[:defaults][:path_src] if @path_src.nil? + @path_inc = cfg[:defaults][:path_inc] if @path_inc.nil? + @path_tst = cfg[:defaults][:path_tst] if @path_tst.nil? + @update_svn = cfg[:defaults][:update_svn] if @update_svn.nil? + @extra_inc = cfg[:includes] + @boilerplates = cfg[:boilerplates] +end + +# Create default file paths if none were provided +@path_src = HERE + "../src/" if @path_src.nil? +@path_inc = @path_src if @path_inc.nil? +@path_tst = HERE + "../test/" if @path_tst.nil? +@path_src += '/' unless (@path_src[-1] == 47) +@path_inc += '/' unless (@path_inc[-1] == 47) +@path_tst += '/' unless (@path_tst[-1] == 47) +@pattern = 'src' if @pattern.nil? +@includes = { :src => [], :inc => [], :tst => [] } +@includes.merge!(@extra_inc) unless @extra_inc.nil? + +#create triad definition +TRIAD = [ { :ext => '.c', :path => @path_src, :template => TEMPLATE_SRC, :inc => :src, :boilerplate => @boilerplates[:src] }, + { :ext => '.h', :path => @path_inc, :template => TEMPLATE_INC, :inc => :inc, :boilerplate => @boilerplates[:inc] }, + { :ext => '.c', :path => @path_tst+'Test', :template => TEMPLATE_TST, :inc => :tst, :boilerplate => @boilerplates[:tst] }, + ] + +#prepare the pattern for use +@patterns = PATTERNS[@pattern.downcase] +raise "ERROR: The design pattern specified isn't one that I recognize!" if @patterns.nil? + +# Assemble the path/names of the files we need to work with. +files = [] +TRIAD.each do |triad| + @patterns.each_pair do |pattern_file, pattern_traits| + files << { + :path => "#{triad[:path]}#{@module_name}#{pattern_file}#{triad[:ext]}", + :name => "#{@module_name}#{pattern_file}", + :template => triad[:template], + :boilerplate => triad[:boilerplate], + :includes => case(triad[:inc]) + when :src then @includes[:src] | pattern_traits[:inc].map{|f| f % [@module_name]} + when :inc then @includes[:inc] + when :tst then @includes[:tst] | pattern_traits[:inc].map{|f| "Mock#{f}"% [@module_name]} + end + } + end +end + +# destroy files if that was what was requested +if @destroy + files.each do |filespec| + file = filespec[:path] + if File.exist?(file) + if @update_svn + `svn delete \"#{file}\" --force` + puts "File #{file} deleted and removed from source control" + else + FileUtils.remove(file) + puts "File #{file} deleted" + end + else + puts "File #{file} does not exist so cannot be removed." + end + end + puts "Destroy Complete" + exit +end + +#Abort if any module already exists +files.each do |file| + raise "ERROR: File #{file[:name]} already exists. Exiting." if File.exist?(file[:path]) +end + +# Create Source Modules +files.each_with_index do |file, i| + File.open(file[:path], 'w') do |f| + f.write(file[:boilerplate] % [file[:name]]) unless file[:boilerplate].nil? + f.write(file[:template] % [ file[:name], + file[:includes].map{|f| "#include \"#{f}\"\n"}.join, + file[:name].upcase ] + ) + end + if (@update_svn) + `svn add \"#{file[:path]}\"` + if $?.exitstatus == 0 + puts "File #{file[:path]} created and added to source control" + else + puts "File #{file[:path]} created but FAILED adding to source control!" + end + else + puts "File #{file[:path]} created" + end +end + +puts 'Generate Complete' diff --git a/flex-bison/calculator_ast/tools/unity/auto/generate_test_runner.rb b/flex-bison/calculator_ast/tools/unity/auto/generate_test_runner.rb new file mode 100644 index 0000000..a5b7fe2 --- /dev/null +++ b/flex-bison/calculator_ast/tools/unity/auto/generate_test_runner.rb @@ -0,0 +1,298 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +File.expand_path(File.join(File.dirname(__FILE__),'colour_prompt')) + +class UnityTestRunnerGenerator + + def initialize(options = nil) + @options = { :includes => [], :plugins => [], :framework => :unity } + case(options) + when NilClass then @options + when String then @options.merge!(UnityTestRunnerGenerator.grab_config(options)) + when Hash then @options.merge!(options) + else raise "If you specify arguments, it should be a filename or a hash of options" + end + end + + def self.grab_config(config_file) + options = { :includes => [], :plugins => [], :framework => :unity } + unless (config_file.nil? or config_file.empty?) + require 'yaml' + yaml_guts = YAML.load_file(config_file) + options.merge!(yaml_guts[:unity] ? yaml_guts[:unity] : yaml_guts[:cmock]) + raise "No :unity or :cmock section found in #{config_file}" unless options + end + return(options) + end + + def run(input_file, output_file, options=nil) + tests = [] + includes = [] + used_mocks = [] + + @options.merge!(options) unless options.nil? + module_name = File.basename(input_file) + + #pull required data from source file + File.open(input_file, 'r') do |input| + tests = find_tests(input) + includes = find_includes(input) + used_mocks = find_mocks(includes) + end + + #build runner file + File.open(output_file, 'w') do |output| + create_header(output, used_mocks) + create_externs(output, tests, used_mocks) + create_mock_management(output, used_mocks) + create_suite_setup_and_teardown(output) + create_reset(output, used_mocks) + create_main(output, input_file, tests) + end + + all_files_used = [input_file, output_file] + all_files_used += includes.map {|filename| filename + '.c'} unless includes.empty? + all_files_used += @options[:includes] unless @options[:includes].empty? + return all_files_used.uniq + end + + def find_tests(input_file) + tests_raw = [] + tests_args = [] + tests_and_line_numbers = [] + + input_file.rewind + source_raw = input_file.read + source_scrubbed = source_raw.gsub(/\/\/.*$/, '') # remove line comments + source_scrubbed = source_scrubbed.gsub(/\/\*.*?\*\//m, '') # remove block comments + lines = source_scrubbed.split(/(^\s*\#.*$) # Treat preprocessor directives as a logical line + | (;|\{|\}) /x) # Match ;, {, and } as end of lines + + lines.each_with_index do |line, index| + #find tests + if line =~ /^((?:\s*TEST_CASE\s*\(.*?\)\s*)*)\s*void\s+(test.*?)\s*\(\s*(.*)\s*\)/ + name = $2 + call = $3 + args = (@options[:use_param_tests] and $1) ? ($1.gsub(/\s*TEST_CASE\s*\(\s*/,'').strip.split(/\s*\)/).compact) : nil + tests_and_line_numbers << { :name => name, :args => args, :call => call, :line_number => 0 } + tests_args = [] + end + end + + #determine line numbers and create tests to run + source_lines = source_raw.split("\n") + source_index = 0; + tests_and_line_numbers.size.times do |i| + source_lines[source_index..-1].each_with_index do |line, index| + if (line =~ /#{tests_and_line_numbers[i][:name]}/) + source_index += index + tests_and_line_numbers[i][:line_number] = source_index + 1 + break + end + end + end + + return tests_and_line_numbers + end + + def find_includes(input_file) + input_file.rewind + includes = [] + input_file.readlines.each do |line| + scan_results = line.scan(/^\s*#include\s+\"\s*(.+)\.[hH]\s*\"/) + includes << scan_results[0][0] if (scan_results.size > 0) + end + return includes + end + + def find_mocks(includes) + mock_headers = [] + includes.each do |include_file| + mock_headers << File.basename(include_file) if (include_file =~ /^mock/i) + end + return mock_headers + end + + def create_header(output, mocks) + output.puts('/* AUTOGENERATED FILE. DO NOT EDIT. */') + create_runtest(output, mocks) + output.puts("\n//=======Automagically Detected Files To Include=====") + output.puts("#include \"#{@options[:framework].to_s}.h\"") + output.puts('#include "cmock.h"') unless (mocks.empty?) + @options[:includes].flatten.uniq.compact.each do |includes| + output.puts("#include \"#{includes.gsub('.h','')}.h\"") + end + output.puts('#include ') + output.puts('#include ') + output.puts('#include "CException.h"') if @options[:plugins].include?(:cexception) + mocks.each do |mock| + output.puts("#include \"#{mock.gsub('.h','')}.h\"") + end + if @options[:enforce_strict_ordering] + output.puts('') + output.puts('int GlobalExpectCount;') + output.puts('int GlobalVerifyOrder;') + output.puts('char* GlobalOrderError;') + end + end + + def create_externs(output, tests, mocks) + output.puts("\n//=======External Functions This Runner Calls=====") + output.puts("extern void setUp(void);") + output.puts("extern void tearDown(void);") + tests.each do |test| + output.puts("extern void #{test[:name]}(#{test[:call]});") + end + output.puts('') + end + + def create_mock_management(output, mocks) + unless (mocks.empty?) + output.puts("\n//=======Mock Management=====") + output.puts("static void CMock_Init(void)") + output.puts("{") + if @options[:enforce_strict_ordering] + output.puts(" GlobalExpectCount = 0;") + output.puts(" GlobalVerifyOrder = 0;") + output.puts(" GlobalOrderError = NULL;") + end + mocks.each do |mock| + output.puts(" #{mock}_Init();") + end + output.puts("}\n") + + output.puts("static void CMock_Verify(void)") + output.puts("{") + mocks.each do |mock| + output.puts(" #{mock}_Verify();") + end + output.puts("}\n") + + output.puts("static void CMock_Destroy(void)") + output.puts("{") + mocks.each do |mock| + output.puts(" #{mock}_Destroy();") + end + output.puts("}\n") + end + end + + def create_suite_setup_and_teardown(output) + unless (@options[:suite_setup].nil?) + output.puts("\n//=======Suite Setup=====") + output.puts("static int suite_setup(void)") + output.puts("{") + output.puts(@options[:suite_setup]) + output.puts("}") + end + unless (@options[:suite_teardown].nil?) + output.puts("\n//=======Suite Teardown=====") + output.puts("static int suite_teardown(int num_failures)") + output.puts("{") + output.puts(@options[:suite_teardown]) + output.puts("}") + end + end + + def create_runtest(output, used_mocks) + cexception = @options[:plugins].include? :cexception + va_args1 = @options[:use_param_tests] ? ', ...' : '' + va_args2 = @options[:use_param_tests] ? '__VA_ARGS__' : '' + output.puts("\n//=======Test Runner Used To Run Each Test Below=====") + output.puts("#define RUN_TEST_NO_ARGS") if @options[:use_param_tests] + output.puts("#define RUN_TEST(TestFunc, TestLineNum#{va_args1}) \\") + output.puts("{ \\") + output.puts(" Unity.CurrentTestName = #TestFunc; \\") + output.puts(" Unity.CurrentTestLineNumber = TestLineNum; \\") + output.puts(" Unity.NumberOfTests++; \\") + output.puts(" if (TEST_PROTECT()) \\") + output.puts(" { \\") + output.puts(" CEXCEPTION_T e; \\") if cexception + output.puts(" Try { \\") if cexception + output.puts(" CMock_Init(); \\") unless (used_mocks.empty?) + output.puts(" setUp(); \\") + output.puts(" TestFunc(#{va_args2}); \\") + output.puts(" CMock_Verify(); \\") unless (used_mocks.empty?) + output.puts(" } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, \"Unhandled Exception!\"); } \\") if cexception + output.puts(" } \\") + output.puts(" CMock_Destroy(); \\") unless (used_mocks.empty?) + output.puts(" if (TEST_PROTECT() && !TEST_IS_IGNORED) \\") + output.puts(" { \\") + output.puts(" tearDown(); \\") + output.puts(" } \\") + output.puts(" UnityConcludeTest(); \\") + output.puts("}\n") + end + + def create_reset(output, used_mocks) + output.puts("\n//=======Test Reset Option=====") + output.puts("void resetTest()") + output.puts("{") + output.puts(" CMock_Verify();") unless (used_mocks.empty?) + output.puts(" CMock_Destroy();") unless (used_mocks.empty?) + output.puts(" tearDown();") + output.puts(" CMock_Init();") unless (used_mocks.empty?) + output.puts(" setUp();") + output.puts("}") + end + + def create_main(output, filename, tests) + output.puts("\n\n//=======MAIN=====") + output.puts("int main(void)") + output.puts("{") + output.puts(" suite_setup();") unless @options[:suite_setup].nil? + output.puts(" Unity.TestFile = \"#{filename}\";") + output.puts(" UnityBegin();") + if (@options[:use_param_tests]) + tests.each do |test| + if ((test[:args].nil?) or (test[:args].empty?)) + output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]}, RUN_TEST_NO_ARGS);") + else + test[:args].each {|args| output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]}, #{args});")} + end + end + else + tests.each { |test| output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]});") } + end + output.puts() + output.puts(" return #{@options[:suite_teardown].nil? ? "" : "suite_teardown"}(UnityEnd());") + output.puts("}") + end +end + + +if ($0 == __FILE__) + options = { :includes => [] } + yaml_file = nil + + #parse out all the options first + ARGV.reject! do |arg| + case(arg) + when '-cexception' + options[:plugins] = [:cexception]; true + when /\w+\.yml/ + options = UnityTestRunnerGenerator.grab_config(arg); true + else false + end + end + + #make sure there is at least one parameter left (the input file) + if !ARGV[0] + puts ["usage: ruby #{__FILE__} (yaml) (options) input_test_file output_test_runner (includes)", + " blah.yml - will use config options in the yml file (see docs)", + " -cexception - include cexception support"].join("\n") + exit 1 + end + + #create the default test runner name if not specified + ARGV[1] = ARGV[0].gsub(".c","_Runner.c") if (!ARGV[1]) + + #everything else is an include file + options[:includes] = (ARGV.slice(2..-1).flatten.compact) if (ARGV.size > 2) + + UnityTestRunnerGenerator.new(options).run(ARGV[0], ARGV[1]) +end diff --git a/flex-bison/calculator_ast/tools/unity/auto/test_file_filter.rb b/flex-bison/calculator_ast/tools/unity/auto/test_file_filter.rb new file mode 100644 index 0000000..3dbc26a --- /dev/null +++ b/flex-bison/calculator_ast/tools/unity/auto/test_file_filter.rb @@ -0,0 +1,23 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require'yaml' + +module RakefileHelpers + class TestFileFilter + def initialize(all_files = false) + @all_files = all_files + if not @all_files == true + if File.exist?('test_file_filter.yml') + filters = YAML.load_file( 'test_file_filter.yml' ) + @all_files, @only_files, @exclude_files = + filters[:all_files], filters[:only_files], filters[:exclude_files] + end + end + end + attr_accessor :all_files, :only_files, :exclude_files + end +end diff --git a/flex-bison/calculator_ast/tools/unity/auto/unity_test_summary.rb b/flex-bison/calculator_ast/tools/unity/auto/unity_test_summary.rb new file mode 100644 index 0000000..69ec2e8 --- /dev/null +++ b/flex-bison/calculator_ast/tools/unity/auto/unity_test_summary.rb @@ -0,0 +1,126 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +#!/usr/bin/ruby +# +# unity_test_summary.rb +# +require 'fileutils' +require 'set' + +class UnityTestSummary + include FileUtils::Verbose + + attr_reader :report, :total_tests, :failures, :ignored + + def initialize + @report = '' + @total_tests = 0 + @failures = 0 + @ignored = 0 + end + + def run + # Clean up result file names + results = @targets.map {|target| target.gsub(/\\/,'/')} + + # Dig through each result file, looking for details on pass/fail: + failure_output = [] + ignore_output = [] + + results.each do |result_file| + lines = File.readlines(result_file).map { |line| line.chomp } + if lines.length == 0 + raise "Empty test result file: #{result_file}" + else + output = get_details(result_file, lines) + failure_output << output[:failures] unless output[:failures].empty? + ignore_output << output[:ignores] unless output[:ignores].empty? + tests,failures,ignored = parse_test_summary(lines) + @total_tests += tests + @failures += failures + @ignored += ignored + end + end + + if @ignored > 0 + @report += "\n" + @report += "--------------------------\n" + @report += "UNITY IGNORED TEST SUMMARY\n" + @report += "--------------------------\n" + @report += ignore_output.flatten.join("\n") + end + + if @failures > 0 + @report += "\n" + @report += "--------------------------\n" + @report += "UNITY FAILED TEST SUMMARY\n" + @report += "--------------------------\n" + @report += failure_output.flatten.join("\n") + end + + @report += "\n" + @report += "--------------------------\n" + @report += "OVERALL UNITY TEST SUMMARY\n" + @report += "--------------------------\n" + @report += "#{@total_tests} TOTAL TESTS #{@failures} TOTAL FAILURES #{@ignored} IGNORED\n" + @report += "\n" + end + + def set_targets(target_array) + @targets = target_array + end + + def set_root_path(path) + @root = path + end + + def usage(err_msg=nil) + puts err_msg if err_msg + puts "Usage: unity_test_summary.rb" + exit 1 + end + + protected + + @@targets=nil + @@path=nil + @@root=nil + + def get_details(result_file, lines) + results = { :failures => [], :ignores => [], :successes => [] } + lines.each do |line| + src_file,src_line,test_name,status,msg = line.split(/:/) + line_out = ((@root and (@root != 0)) ? "#{@root}#{line}" : line ).gsub(/\//, "\\") + case(status) + when 'IGNORE' then results[:ignores] << line_out + when 'FAIL' then results[:failures] << line_out + when 'PASS' then results[:successes] << line_out + end + end + return results + end + + def parse_test_summary(summary) + if summary[-3..-1].join("\n") =~ /(\d+) Tests (\d+) Failures (\d+) Ignored/ + [$1.to_i,$2.to_i,$3.to_i] + else + raise "Couldn't parse test results: #{summary}" + end + end + + def here; File.expand_path(File.dirname(__FILE__)); end + +end + +if $0 == __FILE__ + script = UnityTestSummary.new + begin + script.run + rescue Exception => e + script.usage e.message + end +end diff --git a/flex-bison/calculator_ast/tools/unity/src/unity.c b/flex-bison/calculator_ast/tools/unity/src/unity.c new file mode 100644 index 0000000..a6ca962 --- /dev/null +++ b/flex-bison/calculator_ast/tools/unity/src/unity.c @@ -0,0 +1,841 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity.h" +#include +#include + +#define UNITY_FAIL_AND_BAIL { Unity.CurrentTestFailed = 1; UNITY_OUTPUT_CHAR('\n'); longjmp(Unity.AbortFrame, 1); } +#define UNITY_IGNORE_AND_BAIL { Unity.CurrentTestIgnored = 1; UNITY_OUTPUT_CHAR('\n'); longjmp(Unity.AbortFrame, 1); } +/// return prematurely if we are already in failure or ignore state +#define UNITY_SKIP_EXECUTION { if ((Unity.CurrentTestFailed != 0) || (Unity.CurrentTestIgnored != 0)) {return;} } +#define UNITY_PRINT_EOL { UNITY_OUTPUT_CHAR('\n'); } + +struct _Unity Unity = { 0 }; + +const char* UnityStrNull = "NULL"; +const char* UnityStrSpacer = ". "; +const char* UnityStrExpected = " Expected "; +const char* UnityStrWas = " Was "; +const char* UnityStrTo = " To "; +const char* UnityStrElement = " Element "; +const char* UnityStrMemory = " Memory Mismatch"; +const char* UnityStrDelta = " Values Not Within Delta "; +const char* UnityStrPointless= " You Asked Me To Compare Nothing, Which Was Pointless."; +const char* UnityStrNullPointerForExpected= " Expected pointer to be NULL"; +const char* UnityStrNullPointerForActual = " Actual pointer was NULL"; + +//----------------------------------------------- +// Pretty Printers & Test Result Output Handlers +//----------------------------------------------- + +void UnityPrint(const char* string) +{ + const char* pch = string; + + if (pch != NULL) + { + while (*pch) + { + // printable characters plus CR & LF are printed + if ((*pch <= 126) && (*pch >= 32)) + { + UNITY_OUTPUT_CHAR(*pch); + } + //write escaped carriage returns + else if (*pch == 13) + { + UNITY_OUTPUT_CHAR('\\'); + UNITY_OUTPUT_CHAR('r'); + } + //write escaped line feeds + else if (*pch == 10) + { + UNITY_OUTPUT_CHAR('\\'); + UNITY_OUTPUT_CHAR('n'); + } + // unprintable characters are shown as codes + else + { + UNITY_OUTPUT_CHAR('\\'); + UnityPrintNumberHex((_U_SINT)*pch, 2); + } + pch++; + } + } +} + +//----------------------------------------------- +void UnityPrintNumberByStyle(const _U_SINT number, const UNITY_DISPLAY_STYLE_T style) +{ + if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT) + { + UnityPrintNumber(number); + } + else if ((style & UNITY_DISPLAY_RANGE_UINT) == UNITY_DISPLAY_RANGE_UINT) + { + UnityPrintNumberUnsigned((_U_UINT)number); + } + else + { + UnityPrintNumberHex((_U_UINT)number, (style & 0x000F) << 1); + } +} + +//----------------------------------------------- +/// basically do an itoa using as little ram as possible +void UnityPrintNumber(const _U_SINT number_to_print) +{ + _U_SINT divisor = 1; + _U_SINT next_divisor; + _U_SINT number = number_to_print; + + if (number < 0) + { + UNITY_OUTPUT_CHAR('-'); + number = -number; + } + + // figure out initial divisor + while (number / divisor > 9) + { + next_divisor = divisor * 10; + if (next_divisor > divisor) + divisor = next_divisor; + else + break; + } + + // now mod and print, then divide divisor + do + { + UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10))); + divisor /= 10; + } + while (divisor > 0); +} + +//----------------------------------------------- +/// basically do an itoa using as little ram as possible +void UnityPrintNumberUnsigned(const _U_UINT number) +{ + _U_UINT divisor = 1; + _U_UINT next_divisor; + + // figure out initial divisor + while (number / divisor > 9) + { + next_divisor = divisor * 10; + if (next_divisor > divisor) + divisor = next_divisor; + else + break; + } + + // now mod and print, then divide divisor + do + { + UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10))); + divisor /= 10; + } + while (divisor > 0); +} + +//----------------------------------------------- +void UnityPrintNumberHex(const _U_UINT number, const char nibbles_to_print) +{ + _U_UINT nibble; + char nibbles = nibbles_to_print; + UNITY_OUTPUT_CHAR('0'); + UNITY_OUTPUT_CHAR('x'); + + while (nibbles > 0) + { + nibble = (number >> (--nibbles << 2)) & 0x0000000F; + if (nibble <= 9) + { + UNITY_OUTPUT_CHAR((char)('0' + nibble)); + } + else + { + UNITY_OUTPUT_CHAR((char)('A' - 10 + nibble)); + } + } +} + +//----------------------------------------------- +void UnityPrintMask(const _U_UINT mask, const _U_UINT number) +{ + _U_UINT current_bit = (_U_UINT)1 << (UNITY_INT_WIDTH - 1); + _US32 i; + + for (i = 0; i < UNITY_INT_WIDTH; i++) + { + if (current_bit & mask) + { + if (current_bit & number) + { + UNITY_OUTPUT_CHAR('1'); + } + else + { + UNITY_OUTPUT_CHAR('0'); + } + } + else + { + UNITY_OUTPUT_CHAR('X'); + } + current_bit = current_bit >> 1; + } +} + +//----------------------------------------------- +#ifdef UNITY_FLOAT_VERBOSE +void UnityPrintFloat(_UF number) +{ + char TempBuffer[32]; + sprintf(TempBuffer, "%.6f", number); + UnityPrint(TempBuffer); +} +#endif + +//----------------------------------------------- +void UnityTestResultsBegin(const char* file, const UNITY_LINE_TYPE line) +{ + UnityPrint(file); + UNITY_OUTPUT_CHAR(':'); + UnityPrintNumber(line); + UNITY_OUTPUT_CHAR(':'); + UnityPrint(Unity.CurrentTestName); + UNITY_OUTPUT_CHAR(':'); +} + +//----------------------------------------------- +void UnityTestResultsFailBegin(const UNITY_LINE_TYPE line) +{ + UnityTestResultsBegin(Unity.TestFile, line); + UnityPrint("FAIL:"); +} + +//----------------------------------------------- +void UnityConcludeTest(void) +{ + if (Unity.CurrentTestIgnored) + { + Unity.TestIgnores++; + } + else if (!Unity.CurrentTestFailed) + { + UnityTestResultsBegin(Unity.TestFile, Unity.CurrentTestLineNumber); + UnityPrint("PASS"); + UNITY_PRINT_EOL; + } + else + { + Unity.TestFailures++; + } + + Unity.CurrentTestFailed = 0; + Unity.CurrentTestIgnored = 0; +} + +//----------------------------------------------- +void UnityAddMsgIfSpecified(const char* msg) +{ + if (msg) + { + UnityPrint(UnityStrSpacer); + UnityPrint(msg); + } +} + +//----------------------------------------------- +void UnityPrintExpectedAndActualStrings(const char* expected, const char* actual) +{ + UnityPrint(UnityStrExpected); + if (expected != NULL) + { + UNITY_OUTPUT_CHAR('\''); + UnityPrint(expected); + UNITY_OUTPUT_CHAR('\''); + } + else + { + UnityPrint(UnityStrNull); + } + UnityPrint(UnityStrWas); + if (actual != NULL) + { + UNITY_OUTPUT_CHAR('\''); + UnityPrint(actual); + UNITY_OUTPUT_CHAR('\''); + } + else + { + UnityPrint(UnityStrNull); + } +} + +//----------------------------------------------- +// Assertion & Control Helpers +//----------------------------------------------- + +int UnityCheckArraysForNull(const void* expected, const void* actual, const UNITY_LINE_TYPE lineNumber, const char* msg) +{ + //return true if they are both NULL + if ((expected == NULL) && (actual == NULL)) + return 1; + + //throw error if just expected is NULL + if (expected == NULL) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrNullPointerForExpected); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + //throw error if just actual is NULL + if (actual == NULL) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrNullPointerForActual); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + //return false if neither is NULL + return 0; +} + +//----------------------------------------------- +// Assertion Functions +//----------------------------------------------- + +void UnityAssertBits(const _U_SINT mask, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + UNITY_SKIP_EXECUTION; + + if ((mask & expected) != (mask & actual)) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrExpected); + UnityPrintMask(mask, expected); + UnityPrint(UnityStrWas); + UnityPrintMask(mask, actual); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualNumber(const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style) +{ + UNITY_SKIP_EXECUTION; + + if (expected != actual) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(expected, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(actual, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualIntArray(const _U_SINT* expected, + const _U_SINT* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style) +{ + _UU32 elements = num_elements; + const _US8* ptr_exp = (_US8*)expected; + const _US8* ptr_act = (_US8*)actual; + + UNITY_SKIP_EXECUTION; + + if (elements == 0) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + switch(style) + { + case UNITY_DISPLAY_STYLE_HEX8: + case UNITY_DISPLAY_STYLE_INT8: + case UNITY_DISPLAY_STYLE_UINT8: + while (elements--) + { + if (*ptr_exp != *ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 1; + ptr_act += 1; + } + break; + case UNITY_DISPLAY_STYLE_HEX16: + case UNITY_DISPLAY_STYLE_INT16: + case UNITY_DISPLAY_STYLE_UINT16: + while (elements--) + { + if (*(_US16*)ptr_exp != *(_US16*)ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*(_US16*)ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*(_US16*)ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 2; + ptr_act += 2; + } + break; +#ifdef UNITY_SUPPORT_64 + case UNITY_DISPLAY_STYLE_HEX64: + case UNITY_DISPLAY_STYLE_INT64: + case UNITY_DISPLAY_STYLE_UINT64: + while (elements--) + { + if (*(_US64*)ptr_exp != *(_US64*)ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*(_US64*)ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*(_US64*)ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 8; + ptr_act += 8; + } + break; +#endif + default: + while (elements--) + { + if (*(_US32*)ptr_exp != *(_US32*)ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*(_US32*)ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*(_US32*)ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 4; + ptr_act += 4; + } + break; + } +} + +//----------------------------------------------- +#ifndef UNITY_EXCLUDE_FLOAT +void UnityAssertEqualFloatArray(const _UF* expected, + const _UF* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UU32 elements = num_elements; + const _UF* ptr_expected = expected; + const _UF* ptr_actual = actual; + _UF diff, tol; + + UNITY_SKIP_EXECUTION; + + if (elements == 0) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + while (elements--) + { + diff = *ptr_expected - *ptr_actual; + if (diff < 0.0) + diff = 0.0 - diff; + tol = UNITY_FLOAT_PRECISION * *ptr_expected; + if (tol < 0.0) + tol = 0.0 - tol; + if (diff > tol) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); +#ifdef UNITY_FLOAT_VERBOSE + UnityPrint(UnityStrExpected); + UnityPrintFloat(*ptr_expected); + UnityPrint(UnityStrWas); + UnityPrintFloat(*ptr_actual); +#else + UnityPrint(UnityStrDelta); +#endif + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_expected++; + ptr_actual++; + } +} + +//----------------------------------------------- +void UnityAssertFloatsWithin(const _UF delta, + const _UF expected, + const _UF actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UF diff = actual - expected; + _UF pos_delta = delta; + + UNITY_SKIP_EXECUTION; + + if (diff < 0) + { + diff = 0.0f - diff; + } + if (pos_delta < 0) + { + pos_delta = 0.0f - pos_delta; + } + + if (pos_delta < diff) + { + UnityTestResultsFailBegin(lineNumber); +#ifdef UNITY_FLOAT_VERBOSE + UnityPrint(UnityStrExpected); + UnityPrintFloat(expected); + UnityPrint(UnityStrWas); + UnityPrintFloat(actual); +#else + UnityPrint(UnityStrDelta); +#endif + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} +#endif + +//----------------------------------------------- +void UnityAssertNumbersWithin( const _U_SINT delta, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style) +{ + UNITY_SKIP_EXECUTION; + + if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT) + { + if (actual > expected) + Unity.CurrentTestFailed = ((actual - expected) > delta); + else + Unity.CurrentTestFailed = ((expected - actual) > delta); + } + else + { + if ((_U_UINT)actual > (_U_UINT)expected) + Unity.CurrentTestFailed = ((_U_UINT)(actual - expected) > (_U_UINT)delta); + else + Unity.CurrentTestFailed = ((_U_UINT)(expected - actual) > (_U_UINT)delta); + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrDelta); + UnityPrintNumberByStyle(delta, style); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(expected, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(actual, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualString(const char* expected, + const char* actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UU32 i; + + UNITY_SKIP_EXECUTION; + + // if both pointers not null compare the strings + if (expected && actual) + { + for (i = 0; expected[i] || actual[i]; i++) + { + if (expected[i] != actual[i]) + { + Unity.CurrentTestFailed = 1; + break; + } + } + } + else + { // handle case of one pointers being null (if both null, test should pass) + if (expected != actual) + { + Unity.CurrentTestFailed = 1; + } + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrintExpectedAndActualStrings(expected, actual); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualStringArray( const char** expected, + const char** actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UU32 i, j = 0; + + UNITY_SKIP_EXECUTION; + + // if no elements, it's an error + if (num_elements == 0) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + do + { + // if both pointers not null compare the strings + if (expected[j] && actual[j]) + { + for (i = 0; expected[j][i] || actual[j][i]; i++) + { + if (expected[j][i] != actual[j][i]) + { + Unity.CurrentTestFailed = 1; + break; + } + } + } + else + { // handle case of one pointers being null (if both null, test should pass) + if (expected[j] != actual[j]) + { + Unity.CurrentTestFailed = 1; + } + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + if (num_elements > 1) + { + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - j - 1), UNITY_DISPLAY_STYLE_UINT); + } + UnityPrintExpectedAndActualStrings((const char*)(expected[j]), (const char*)(actual[j])); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + } while (++j < num_elements); +} + +//----------------------------------------------- +void UnityAssertEqualMemory( const void* expected, + const void* actual, + _UU32 length, + _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + unsigned char* expected_ptr = (unsigned char*)expected; + unsigned char* actual_ptr = (unsigned char*)actual; + _UU32 elements = num_elements; + + UNITY_SKIP_EXECUTION; + + if ((elements == 0) || (length == 0)) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + while (elements--) + { + if (memcmp((const void*)expected_ptr, (const void*)actual_ptr, length) != 0) + { + Unity.CurrentTestFailed = 1; + break; + } + expected_ptr += length; + actual_ptr += length; + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + if (num_elements > 1) + { + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + } + UnityPrint(UnityStrMemory); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +// Control Functions +//----------------------------------------------- + +void UnityFail(const char* msg, const UNITY_LINE_TYPE line) +{ + UNITY_SKIP_EXECUTION; + + UnityTestResultsBegin(Unity.TestFile, line); + UnityPrint("FAIL"); + if (msg != NULL) + { + UNITY_OUTPUT_CHAR(':'); + if (msg[0] != ' ') + { + UNITY_OUTPUT_CHAR(' '); + } + UnityPrint(msg); + } + UNITY_FAIL_AND_BAIL; +} + +//----------------------------------------------- +void UnityIgnore(const char* msg, const UNITY_LINE_TYPE line) +{ + UNITY_SKIP_EXECUTION; + + UnityTestResultsBegin(Unity.TestFile, line); + UnityPrint("IGNORE"); + if (msg != NULL) + { + UNITY_OUTPUT_CHAR(':'); + UNITY_OUTPUT_CHAR(' '); + UnityPrint(msg); + } + UNITY_IGNORE_AND_BAIL; +} + +//----------------------------------------------- +void setUp(void); +void tearDown(void); +void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum) +{ + Unity.CurrentTestName = FuncName; + Unity.CurrentTestLineNumber = FuncLineNum; + Unity.NumberOfTests++; + if (TEST_PROTECT()) + { + setUp(); + Func(); + } + if (TEST_PROTECT() && !(Unity.CurrentTestIgnored)) + { + tearDown(); + } + UnityConcludeTest(); +} + +//----------------------------------------------- +void UnityBegin(void) +{ + Unity.NumberOfTests = 0; +} + +//----------------------------------------------- +int UnityEnd(void) +{ + UnityPrint("-----------------------"); + UNITY_PRINT_EOL; + UnityPrintNumber(Unity.NumberOfTests); + UnityPrint(" Tests "); + UnityPrintNumber(Unity.TestFailures); + UnityPrint(" Failures "); + UnityPrintNumber(Unity.TestIgnores); + UnityPrint(" Ignored"); + UNITY_PRINT_EOL; + if (Unity.TestFailures == 0U) + { + UnityPrint("OK"); + } + else + { + UnityPrint("FAIL"); + } + UNITY_PRINT_EOL; + return Unity.TestFailures; +} diff --git a/flex-bison/calculator_ast/tools/unity/src/unity.h b/flex-bison/calculator_ast/tools/unity/src/unity.h new file mode 100644 index 0000000..8b16111 --- /dev/null +++ b/flex-bison/calculator_ast/tools/unity/src/unity.h @@ -0,0 +1,209 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FRAMEWORK_H +#define UNITY_FRAMEWORK_H + +#define UNITY + +#include "unity_internals.h" + +//------------------------------------------------------- +// Configuration Options +//------------------------------------------------------- + +// Integers +// - Unity assumes 32 bit integers by default +// - If your compiler treats ints of a different size, define UNITY_INT_WIDTH + +// Floats +// - define UNITY_EXCLUDE_FLOAT to disallow floating point comparisons +// - define UNITY_FLOAT_PRECISION to specify the precision to use when doing TEST_ASSERT_EQUAL_FLOAT +// - define UNITY_FLOAT_TYPE to specify doubles instead of single precision floats +// - define UNITY_FLOAT_VERBOSE to print floating point values in errors (uses sprintf) + +// Output +// - by default, Unity prints to standard out with putchar. define UNITY_OUTPUT_CHAR(a) with a different function if desired + +// Optimization +// - by default, line numbers are stored in unsigned shorts. Define UNITY_LINE_TYPE with a different type if your files are huge +// - by default, test and failure counters are unsigned shorts. Define UNITY_COUNTER_TYPE with a different type if you want to save space or have more than 65535 Tests. + +//------------------------------------------------------- +// Test Running Macros +//------------------------------------------------------- + +#define TEST_PROTECT() (setjmp(Unity.AbortFrame) == 0) + +#define TEST_ABORT() {longjmp(Unity.AbortFrame, 1);} + +#ifndef RUN_TEST +#define RUN_TEST(func, line_num) UnityDefaultTestRun(func, #func, line_num) +#endif + +#define TEST_LINE_NUM (Unity.CurrentTestLineNumber) +#define TEST_IS_IGNORED (Unity.CurrentTestIgnored) + +#define TEST_CASE(...) + +//------------------------------------------------------- +// Basic Fail and Ignore +//------------------------------------------------------- + +#define TEST_FAIL_MESSAGE(message) UNITY_TEST_FAIL(__LINE__, message) +#define TEST_FAIL() UNITY_TEST_FAIL(__LINE__, NULL) +#define TEST_IGNORE_MESSAGE(message) UNITY_TEST_IGNORE(__LINE__, message) +#define TEST_IGNORE() UNITY_TEST_IGNORE(__LINE__, NULL) +#define TEST_ONLY() + +//------------------------------------------------------- +// Test Asserts (simple) +//------------------------------------------------------- + +//Boolean +#define TEST_ASSERT(condition) UNITY_TEST_ASSERT( (condition), __LINE__, " Expression Evaluated To FALSE") +#define TEST_ASSERT_TRUE(condition) UNITY_TEST_ASSERT( (condition), __LINE__, " Expected TRUE Was FALSE") +#define TEST_ASSERT_UNLESS(condition) UNITY_TEST_ASSERT( !(condition), __LINE__, " Expression Evaluated To TRUE") +#define TEST_ASSERT_FALSE(condition) UNITY_TEST_ASSERT( !(condition), __LINE__, " Expected FALSE Was TRUE") +#define TEST_ASSERT_NULL(pointer) UNITY_TEST_ASSERT_NULL( (pointer), __LINE__, " Expected NULL") +#define TEST_ASSERT_NOT_NULL(pointer) UNITY_TEST_ASSERT_NOT_NULL((pointer), __LINE__, " Expected Non-NULL") + +//Integers (of all sizes) +#define TEST_ASSERT_EQUAL_INT(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT8(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT8((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT16(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT16((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT32(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT32((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT64(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT64((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_NOT_EQUAL(expected, actual) UNITY_TEST_ASSERT(((expected) != (actual)), __LINE__, " Expected Not-Equal") +#define TEST_ASSERT_EQUAL_UINT(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT8(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT8( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT16(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT16( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT32(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT32( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT64(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT64( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX8(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX8( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX16(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX16((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX32(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX64(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX64((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_BITS(mask, expected, actual) UNITY_TEST_ASSERT_BITS((mask), (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_BITS_HIGH(mask, actual) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(-1), (actual), __LINE__, NULL) +#define TEST_ASSERT_BITS_LOW(mask, actual) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(0), (actual), __LINE__, NULL) +#define TEST_ASSERT_BIT_HIGH(bit, actual) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(-1), (actual), __LINE__, NULL) +#define TEST_ASSERT_BIT_LOW(bit, actual) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(0), (actual), __LINE__, NULL) + +//Integer Ranges (of all sizes) +#define TEST_ASSERT_INT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_UINT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX8_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX16_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX32_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX64_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, __LINE__, NULL) + +//Structs and Strings +#define TEST_ASSERT_EQUAL_PTR(expected, actual) UNITY_TEST_ASSERT_EQUAL_PTR((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_STRING(expected, actual) UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_MEMORY(expected, actual, len) UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, __LINE__, NULL) + +//Arrays +#define TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements) UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, __LINE__, NULL) + +//Floating Point (If Enabled) +#define TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_FLOAT(expected, actual) UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, __LINE__, NULL) + +//------------------------------------------------------- +// Test Asserts (with additional messages) +//------------------------------------------------------- + +//Boolean +#define TEST_ASSERT_MESSAGE(condition, message) UNITY_TEST_ASSERT( (condition), __LINE__, message) +#define TEST_ASSERT_TRUE_MESSAGE(condition, message) UNITY_TEST_ASSERT( (condition), __LINE__, message) +#define TEST_ASSERT_UNLESS_MESSAGE(condition, message) UNITY_TEST_ASSERT( !(condition), __LINE__, message) +#define TEST_ASSERT_FALSE_MESSAGE(condition, message) UNITY_TEST_ASSERT( !(condition), __LINE__, message) +#define TEST_ASSERT_NULL_MESSAGE(pointer, message) UNITY_TEST_ASSERT_NULL( (pointer), __LINE__, message) +#define TEST_ASSERT_NOT_NULL_MESSAGE(pointer, message) UNITY_TEST_ASSERT_NOT_NULL((pointer), __LINE__, message) + +//Integers (of all sizes) +#define TEST_ASSERT_EQUAL_INT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT8((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT16((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT32((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT64((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, message) +#define TEST_ASSERT_NOT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT(((expected) != (actual)), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT8( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT16( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT32( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT64( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX8( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX16((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX64((expected), (actual), __LINE__, message) +#define TEST_ASSERT_BITS_MESSAGE(mask, expected, actual, message) UNITY_TEST_ASSERT_BITS((mask), (expected), (actual), __LINE__, message) +#define TEST_ASSERT_BITS_HIGH_MESSAGE(mask, actual, message) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(-1), (actual), __LINE__, message) +#define TEST_ASSERT_BITS_LOW_MESSAGE(mask, actual, message) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(0), (actual), __LINE__, message) +#define TEST_ASSERT_BIT_HIGH_MESSAGE(bit, actual, message) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(-1), (actual), __LINE__, message) +#define TEST_ASSERT_BIT_LOW_MESSAGE(bit, actual, message) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(0), (actual), __LINE__, message) + +//Integer Ranges (of all sizes) +#define TEST_ASSERT_INT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_UINT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX8_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX16_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX32_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX64_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, __LINE__, message) + +//Structs and Strings +#define TEST_ASSERT_EQUAL_PTR_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_PTR(expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_STRING_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_MEMORY_MESSAGE(expected, actual, len, message) UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, __LINE__, message) + +//Arrays +#define TEST_ASSERT_EQUAL_INT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_STRING_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_MEMORY_ARRAY_MESSAGE(expected, actual, len, num_elements, message) UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, __LINE__, message) + +//Floating Point (If Enabled) +#define TEST_ASSERT_FLOAT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_FLOAT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_FLOAT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, __LINE__, message) +#endif diff --git a/flex-bison/calculator_ast/tools/unity/src/unity_internals.h b/flex-bison/calculator_ast/tools/unity/src/unity_internals.h new file mode 100644 index 0000000..d2064a4 --- /dev/null +++ b/flex-bison/calculator_ast/tools/unity/src/unity_internals.h @@ -0,0 +1,353 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_INTERNALS_H +#define UNITY_INTERNALS_H + +#include +#include + +//------------------------------------------------------- +// Int Support +//------------------------------------------------------- + +#ifndef UNITY_INT_WIDTH +#define UNITY_INT_WIDTH (32) +#endif + +#ifndef UNITY_LONG_WIDTH +#define UNITY_LONG_WIDTH (32) +#endif + +#if (UNITY_INT_WIDTH == 32) + typedef unsigned char _UU8; + typedef unsigned short _UU16; + typedef unsigned int _UU32; + typedef signed char _US8; + typedef signed short _US16; + typedef signed int _US32; +#elif (UNITY_INT_WIDTH == 16) + typedef unsigned char _UU8; + typedef unsigned int _UU16; + typedef unsigned long _UU32; + typedef signed char _US8; + typedef signed int _US16; + typedef signed long _US32; +#else + #error Invalid UNITY_INT_WIDTH specified! (16 or 32 are supported) +#endif + +//------------------------------------------------------- +// 64-bit Support +//------------------------------------------------------- + +#ifndef UNITY_SUPPORT_64 + +//No 64-bit Support +typedef _UU32 _U_UINT; +typedef _US32 _U_SINT; + +#else + +//64-bit Support +#if (UNITY_LONG_WIDTH == 32) + typedef unsigned long long _UU64; + typedef signed long long _US64; +#elif (UNITY_LONG_WIDTH == 64) + typedef unsigned long _UU64; + typedef signed long _US64; +#else + #error Invalid UNITY_LONG_WIDTH specified! (32 or 64 are supported) +#endif +typedef _UU64 _U_UINT; +typedef _US64 _U_SINT; + +#endif + +//------------------------------------------------------- +// Pointer Support +//------------------------------------------------------- + +#ifndef UNITY_POINTER_WIDTH +#define UNITY_POINTER_WIDTH (32) +#endif + +#if (UNITY_POINTER_WIDTH == 32) + typedef _UU32 _UP; +#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX32 +#elif (UNITY_POINTER_WIDTH == 64) + typedef _UU64 _UP; +#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX64 +#elif (UNITY_POINTER_WIDTH == 16) + typedef _UU16 _UP; +#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX16 +#else + #error Invalid UNITY_POINTER_WIDTH specified! (16, 32 or 64 are supported) +#endif + +//------------------------------------------------------- +// Float Support +//------------------------------------------------------- + +#ifdef UNITY_EXCLUDE_FLOAT + +//No Floating Point Support +#undef UNITY_FLOAT_PRECISION +#undef UNITY_FLOAT_TYPE +#undef UNITY_FLOAT_VERBOSE + +#else + +//Floating Point Support +#ifndef UNITY_FLOAT_PRECISION +#define UNITY_FLOAT_PRECISION (0.00001f) +#endif +#ifndef UNITY_FLOAT_TYPE +#define UNITY_FLOAT_TYPE float +#endif +typedef UNITY_FLOAT_TYPE _UF; + +#endif + +//------------------------------------------------------- +// Output Method +//------------------------------------------------------- + +#ifndef UNITY_OUTPUT_CHAR +#define UNITY_OUTPUT_CHAR(a) putchar(a) +#endif + +extern int UNITY_OUTPUT_CHAR(int); + +//------------------------------------------------------- +// Footprint +//------------------------------------------------------- + +#ifndef UNITY_LINE_TYPE +#define UNITY_LINE_TYPE unsigned short +#endif + +#ifndef UNITY_COUNTER_TYPE +#define UNITY_COUNTER_TYPE unsigned short +#endif + +//------------------------------------------------------- +// Internal Structs Needed +//------------------------------------------------------- + +typedef void (*UnityTestFunction)(void); + +#define UNITY_DISPLAY_RANGE_INT (0x10) +#define UNITY_DISPLAY_RANGE_UINT (0x20) +#define UNITY_DISPLAY_RANGE_HEX (0x40) +#define UNITY_DISPLAY_RANGE_AUTO (0x80) + +typedef enum +{ + UNITY_DISPLAY_STYLE_INT = 4 + UNITY_DISPLAY_RANGE_INT + UNITY_DISPLAY_RANGE_AUTO, + UNITY_DISPLAY_STYLE_INT8 = 1 + UNITY_DISPLAY_RANGE_INT, + UNITY_DISPLAY_STYLE_INT16 = 2 + UNITY_DISPLAY_RANGE_INT, + UNITY_DISPLAY_STYLE_INT32 = 4 + UNITY_DISPLAY_RANGE_INT, +#ifdef UNITY_SUPPORT_64 + UNITY_DISPLAY_STYLE_INT64 = 8 + UNITY_DISPLAY_RANGE_INT, +#endif + UNITY_DISPLAY_STYLE_UINT = 4 + UNITY_DISPLAY_RANGE_UINT + UNITY_DISPLAY_RANGE_AUTO, + UNITY_DISPLAY_STYLE_UINT8 = 1 + UNITY_DISPLAY_RANGE_UINT, + UNITY_DISPLAY_STYLE_UINT16 = 2 + UNITY_DISPLAY_RANGE_UINT, + UNITY_DISPLAY_STYLE_UINT32 = 4 + UNITY_DISPLAY_RANGE_UINT, +#ifdef UNITY_SUPPORT_64 + UNITY_DISPLAY_STYLE_UINT64 = 8 + UNITY_DISPLAY_RANGE_UINT, +#endif + UNITY_DISPLAY_STYLE_HEX8 = 1 + UNITY_DISPLAY_RANGE_HEX, + UNITY_DISPLAY_STYLE_HEX16 = 2 + UNITY_DISPLAY_RANGE_HEX, + UNITY_DISPLAY_STYLE_HEX32 = 4 + UNITY_DISPLAY_RANGE_HEX, +#ifdef UNITY_SUPPORT_64 + UNITY_DISPLAY_STYLE_HEX64 = 8 + UNITY_DISPLAY_RANGE_HEX, +#endif +} UNITY_DISPLAY_STYLE_T; + +struct _Unity +{ + const char* TestFile; + const char* CurrentTestName; + _UU32 CurrentTestLineNumber; + UNITY_COUNTER_TYPE NumberOfTests; + UNITY_COUNTER_TYPE TestFailures; + UNITY_COUNTER_TYPE TestIgnores; + UNITY_COUNTER_TYPE CurrentTestFailed; + UNITY_COUNTER_TYPE CurrentTestIgnored; + jmp_buf AbortFrame; +}; + +extern struct _Unity Unity; + +//------------------------------------------------------- +// Test Suite Management +//------------------------------------------------------- + +void UnityBegin(void); +int UnityEnd(void); +void UnityConcludeTest(void); +void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum); + +//------------------------------------------------------- +// Test Output +//------------------------------------------------------- + +void UnityPrint(const char* string); +void UnityPrintMask(const _U_UINT mask, const _U_UINT number); +void UnityPrintNumberByStyle(const _U_SINT number, const UNITY_DISPLAY_STYLE_T style); +void UnityPrintNumber(const _U_SINT number); +void UnityPrintNumberUnsigned(const _U_UINT number); +void UnityPrintNumberHex(const _U_UINT number, const char nibbles); + +#ifdef UNITY_FLOAT_VERBOSE +void UnityPrintFloat(const _UF number); +#endif + +//------------------------------------------------------- +// Test Assertion Fuctions +//------------------------------------------------------- +// Use the macros below this section instead of calling +// these directly. The macros have a consistent naming +// convention and will pull in file and line information +// for you. + +void UnityAssertEqualNumber(const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style); + +void UnityAssertEqualIntArray(const _U_SINT* expected, + const _U_SINT* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style); + +void UnityAssertBits(const _U_SINT mask, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualString(const char* expected, + const char* actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualStringArray( const char** expected, + const char** actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualMemory( const void* expected, + const void* actual, + const _UU32 length, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertNumbersWithin(const _U_SINT delta, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style); + +void UnityFail(const char* message, const UNITY_LINE_TYPE line); + +void UnityIgnore(const char* message, const UNITY_LINE_TYPE line); + +#ifndef UNITY_EXCLUDE_FLOAT +void UnityAssertFloatsWithin(const _UF delta, + const _UF expected, + const _UF actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualFloatArray(const _UF* expected, + const _UF* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber); +#endif + +//------------------------------------------------------- +// Basic Fail and Ignore +//------------------------------------------------------- + +#define UNITY_TEST_FAIL(line, message) UnityFail( (message), (UNITY_LINE_TYPE)line); +#define UNITY_TEST_IGNORE(line, message) UnityIgnore( (message), (UNITY_LINE_TYPE)line); + +//------------------------------------------------------- +// Test Asserts +//------------------------------------------------------- + +#define UNITY_TEST_ASSERT(condition, line, message) if (condition) {} else {UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, message);} +#define UNITY_TEST_ASSERT_NULL(pointer, line, message) UNITY_TEST_ASSERT(((pointer) == NULL), (UNITY_LINE_TYPE)line, message) +#define UNITY_TEST_ASSERT_NOT_NULL(pointer, line, message) UNITY_TEST_ASSERT(((pointer) != NULL), (UNITY_LINE_TYPE)line, message) + +#define UNITY_TEST_ASSERT_EQUAL_INT(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_UINT(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_HEX8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX8) +#define UNITY_TEST_ASSERT_EQUAL_HEX16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX16) +#define UNITY_TEST_ASSERT_EQUAL_HEX32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX32) +#define UNITY_TEST_ASSERT_BITS(mask, expected, actual, line, message) UnityAssertBits((_U_SINT)(mask), (_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line) + +#define UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX8) +#define UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX16) +#define UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX32) +#define UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64) + +#define UNITY_TEST_ASSERT_EQUAL_PTR(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(_UP)(expected), (_U_SINT)(_UP)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_POINTER) +#define UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, line, message) UnityAssertEqualString((const char*)(expected), (const char*)(actual), (message), (UNITY_LINE_TYPE)line) +#define UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, line, message) UnityAssertEqualMemory((void*)(expected), (void*)(actual), (_UU32)(len), 1, (message), (UNITY_LINE_TYPE)line) + +#define UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT8) +#define UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT16) +#define UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT32) +#define UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT8) +#define UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT16) +#define UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT32) +#define UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX8) +#define UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX16) +#define UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX32) +#define UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualStringArray((const char**)(expected), (const char**)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line) +#define UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, line, message) UnityAssertEqualMemory((void*)(expected), (void*)(actual), (_UU32)(len), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line) + +#ifdef UNITY_SUPPORT_64 +#define UNITY_TEST_ASSERT_EQUAL_INT64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT64) +#define UNITY_TEST_ASSERT_EQUAL_UINT64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT64) +#define UNITY_TEST_ASSERT_EQUAL_HEX64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64) +#define UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT64) +#define UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT64) +#define UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64) +#endif + +#ifdef UNITY_EXCLUDE_FLOAT +#define UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled") +#define UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled") +#define UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled") +#else +#define UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, line, message) UnityAssertFloatsWithin((_UF)(delta), (_UF)(expected), (_UF)(actual), (message), (UNITY_LINE_TYPE)line) +#define UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, line, message) UNITY_TEST_ASSERT_FLOAT_WITHIN((_UF)(expected) * (_UF)UNITY_FLOAT_PRECISION, (_UF)expected, (_UF)actual, (UNITY_LINE_TYPE)line, message) +#define UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualFloatArray((_UF*)(expected), (_UF*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line) +#endif + +#endif diff --git a/flex-bison/calculator_otf/Makefile b/flex-bison/calculator_otf/Makefile new file mode 100644 index 0000000..53bcc6e --- /dev/null +++ b/flex-bison/calculator_otf/Makefile @@ -0,0 +1,26 @@ +LEX=flex +BISON=bison +CC=gcc + +#------------------------------------------------------------------------------ + +all: parser.exe + +parser.exe: parser.tab.c lex.yy.c + $(CC) -o parser parser.tab.c lex.yy.c + +clean: + rm -f lex.yy.c + rm -f lexer.exe + rm -f parser.tab.c + rm -f parser.tab.h + rm -f parser.exe + +#------------------------------------------------------------------------------ + +parser.tab.c: parser.y + $(BISON) -d parser.y + +lex.yy.c: lexer.l + $(LEX) lexer.l + diff --git a/flex-bison/calculator_otf/lexer.l b/flex-bison/calculator_otf/lexer.l new file mode 100644 index 0000000..d218610 --- /dev/null +++ b/flex-bison/calculator_otf/lexer.l @@ -0,0 +1,22 @@ +%{ + +/* Includes */ +#include "parser.tab.h" + +%} + +%option noyywrap + +%% + +"+" { return ADD; } +"-" { return SUB; } +"*" { return MUL; } +"/" { return DIV; } +"%" { return MOD; } +[\n] { return EOL; } +[ \t] ; +[0-9]+(\.[0-9])? { yylval.num = atof(yytext); return NUM; } +. { yyerror(yytext); } + +%% diff --git a/flex-bison/calculator_otf/parser.y b/flex-bison/calculator_otf/parser.y new file mode 100644 index 0000000..747caa3 --- /dev/null +++ b/flex-bison/calculator_otf/parser.y @@ -0,0 +1,61 @@ +%{ + +/* Includes */ +#include + +%} + +%union +{ + double num; +} + +/* Tokens */ +%token NUM +%token ADD SUB MUL DIV MOD +%token OUBIN OUHEX OUDEC OUOCT /* Output modes */ +%token EOL + +%type exp +%type factor +%type term + +%start calclist + +%% + +calclist: + /* Nothing */ + | calclist exp EOL { printf("=> %f\n> ", $2); } + | calclist EOL { printf("> "); } + ; + +exp: + factor { $$ = $1; } + | exp ADD factor { $$ = $1 + $3; } + | exp SUB factor { $$ = $1 - $3; } + ; + +factor: + term { $$ = $1; } + | factor MUL term { $$ = $1 * $3; } + | factor DIV term { $$ = $1 / $3; } + | factor MOD term { $$ = ((int) $1) % ((int) $3); } + ; + +term: + NUM { $$ = $1; } + ; + +%% + +main(int argc, char** argv) +{ + printf("> "); + yyparse(); +} + +yyerror(char *s) +{ + fprintf(stderr,"Error: %s\n",s); +} diff --git a/flex-bison/clcalc/Doxyfile b/flex-bison/clcalc/Doxyfile new file mode 100644 index 0000000..1ad0495 --- /dev/null +++ b/flex-bison/clcalc/Doxyfile @@ -0,0 +1,1719 @@ +# Doxyfile 1.7.3 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# http://www.gnu.org/software/libiconv for the list of possible encodings. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = Mark1 + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = 0.1 + +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer +# a quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = "Experimental Programming Language" + +# With the PROJECT_LOGO tag one can specify an logo or icon that is +# included in the documentation. The maximum height of the logo should not +# exceed 55 pixels and the maximum width should not exceed 200 pixels. +# Doxygen will copy the logo to the output directory. + +PROJECT_LOGO = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = docs + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, +# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, +# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English +# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, +# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, +# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = YES + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful if your file system +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like regular Qt-style comments +# (thus requiring an explicit @brief command for a brief description.) + +JAVADOC_AUTOBRIEF = NO + +# If the QT_AUTOBRIEF tag is set to YES then Doxygen will +# interpret the first line (until the first dot) of a Qt-style +# comment as the brief description. If set to NO, the comments +# will behave just like regular Qt-style comments (thus requiring +# an explicit \brief command for a brief description.) + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 8 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = YES + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for +# Java. For instance, namespaces will be presented as packages, qualified +# scopes will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources only. Doxygen will then generate output that is more tailored for +# Fortran. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for +# VHDL. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given extension. +# Doxygen has a built-in mapping, but you can override or extend it using this +# tag. The format is ext=language, where ext is a file extension, and language +# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C, +# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make +# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C +# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions +# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. + +EXTENSION_MAPPING = + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also makes the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. +# Doxygen will parse them like normal C++ but will assume all classes use public +# instead of private inheritance when no explicit protection keyword is present. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate getter +# and setter methods for a property. Setting this option to YES (the default) +# will make doxygen replace the get and set methods by a property in the +# documentation. This will only work if the methods are indeed getting or +# setting a simple type. If this is not the case, or you want to show the +# methods anyway, you should set this option to NO. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum +# is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically +# be useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. + +TYPEDEF_HIDES_STRUCT = NO + +# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to +# determine which symbols to keep in memory and which to flush to disk. +# When the cache is full, less often used symbols will be written to disk. +# For small to medium size projects (<1000 input files) the default value is +# probably good enough. For larger projects a too small cache size can cause +# doxygen to be busy swapping symbols to and from disk most of the time +# causing a significant performance penalty. +# If the system has enough physical memory increasing the cache will improve the +# performance by keeping more symbols in memory. Note that the value works on +# a logarithmic scale so increasing the size by one will roughly double the +# memory usage. The cache size is given by this formula: +# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, +# corresponding to a cache size of 2^16 = 65536 symbols + +SYMBOL_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = YES + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base +# name of the file that contains the anonymous namespace. By default +# anonymous namespaces are hidden. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = NO + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = YES + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen +# will list include files with double quotes in the documentation +# rather than with sharp brackets. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen +# will sort the (brief and detailed) documentation of class members so that +# constructors and destructors are listed first. If set to NO (the default) +# the constructors will appear in the respective orders defined by +# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. +# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO +# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the +# hierarchy of group names into alphabetical order. If set to NO (the default) +# the group names will appear in their defined order. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to +# do proper type resolution of all parameters of a function it will reject a +# match between the prototype and the implementation of a member function even +# if there is only one candidate or it is obvious which candidate to choose +# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen +# will still accept a match between prototype and implementation in such cases. + +STRICT_PROTO_MATCHING = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or macro consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and macros in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +# If the sources in your project are distributed over multiple directories +# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy +# in the documentation. The default is NO. + +SHOW_DIRECTORIES = NO + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. +# This will remove the Files entry from the Quick Index and from the +# Folder Tree View (if specified). The default is YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the +# Namespaces page. This will remove the Namespaces entry from the Quick Index +# and from the Folder Tree View (if specified). The default is YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command , where is the value of +# the FILE_VERSION_FILTER tag, and is the name of an input file +# provided by doxygen. Whatever the program writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. The create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. +# You can optionally specify a file name after the option, if omitted +# DoxygenLayout.xml will be used as the name of the layout file. + +LAYOUT_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# The WARN_NO_PARAMDOC option can be enabled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = src + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is +# also the default input encoding. Doxygen uses libiconv (or the iconv built +# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for +# the list of possible encodings. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh +# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py +# *.f90 *.f *.for *.vhd *.vhdl + +FILE_PATTERNS = *.c \ + *.cc \ + *.cxx \ + *.cpp \ + *.c++ \ + *.d \ + *.java \ + *.ii \ + *.ixx \ + *.ipp \ + *.i++ \ + *.inl \ + *.h \ + *.hh \ + *.hxx \ + *.hpp \ + *.h++ \ + *.idl \ + *.odl \ + *.cs \ + *.php \ + *.php3 \ + *.inc \ + *.m \ + *.mm \ + *.dox \ + *.py \ + *.f90 \ + *.f \ + *.for \ + *.vhd \ + *.vhdl + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = * + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty or if +# non of the patterns match the file name, INPUT_FILTER is applied. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) +# and it is also possible to disable source filtering for a specific pattern +# using *.ext= (so without naming a filter). This option only has effect when +# FILTER_SOURCE_FILES is enabled. + +FILTER_SOURCE_PATTERNS = + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. + +SOURCE_BROWSER = YES + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. Otherwise they will link to the documentation. + +REFERENCES_LINK_SOURCE = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = YES + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own +# stylesheet in the HTML output directory as well, or it will be erased! + +HTML_STYLESHEET = + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. +# Doxygen will adjust the colors in the stylesheet and background images +# according to this color. Hue is specified as an angle on a colorwheel, +# see http://en.wikipedia.org/wiki/Hue for more information. +# For instance the value 0 represents red, 60 is yellow, 120 is green, +# 180 is cyan, 240 is blue, 300 purple, and 360 is red again. +# The allowed range is 0 to 359. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of +# the colors in the HTML output. For a value of 0 the output will use +# grayscales only. A value of 255 will produce the most vivid colors. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to +# the luminance component of the colors in the HTML output. Values below +# 100 gradually make the output lighter, whereas values above 100 make +# the output darker. The value divided by 100 is the actual gamma applied, +# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, +# and 100 does not change the gamma. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting +# this to NO can help when comparing the output of multiple runs. + +HTML_TIMESTAMP = YES + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +HTML_ALIGN_MEMBERS = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. For this to work a browser that supports +# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox +# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). + +HTML_DYNAMIC_SECTIONS = NO + +# If the GENERATE_DOCSET tag is set to YES, additional index files +# will be generated that can be used as input for Apple's Xcode 3 +# integrated development environment, introduced with OSX 10.5 (Leopard). +# To create a documentation set, doxygen will generate a Makefile in the +# HTML output directory. Running make will produce the docset in that +# directory and running "make install" will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find +# it at startup. +# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html +# for more information. + +GENERATE_DOCSET = NO + +# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the +# feed. A documentation feed provides an umbrella under which multiple +# documentation sets from a single provider (such as a company or product suite) +# can be grouped. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that +# should uniquely identify the documentation set bundle. This should be a +# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen +# will append .docset to the name. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify +# the documentation publisher. This should be a reverse domain-name style +# string, e.g. com.mycompany.MyDocSet.documentation. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING +# is used to encode HtmlHelp index (hhk), content (hhc) and project file +# content. + +CHM_INDEX_ENCODING = + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated +# that can be used as input for Qt's qhelpgenerator to generate a +# Qt Compressed Help (.qch) of the generated HTML documentation. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can +# be used to specify the file name of the resulting .qch file. +# The path specified is relative to the HTML output folder. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#namespace + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#virtual-folders + +QHP_VIRTUAL_FOLDER = doc + +# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to +# add. For more information please see +# http://doc.trolltech.com/qthelpproject.html#custom-filters + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see +# +# Qt Help Project / Custom Filters. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's +# filter section matches. +# +# Qt Help Project / Filter Attributes. + +QHP_SECT_FILTER_ATTRS = + +# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can +# be used to specify the location of Qt's qhelpgenerator. +# If non-empty doxygen will try to run qhelpgenerator on the generated +# .qhp file. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files +# will be generated, which together with the HTML files, form an Eclipse help +# plugin. To install this plugin and make it available under the help contents +# menu in Eclipse, the contents of the directory containing the HTML and XML +# files needs to be copied into the plugins directory of eclipse. The name of +# the directory within the plugins directory should be the same as +# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before +# the help appears. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have +# this name. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + +DISABLE_INDEX = NO + +# This tag can be used to set the number of enum values (range [0,1..20]) +# that doxygen will group on one line in the generated HTML documentation. +# Note that a value of 0 will completely suppress the enum values from +# appearing in the overview section. + +ENUM_VALUES_PER_LINE = 4 + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. +# If the tag value is set to YES, a side panel will be generated +# containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). +# Windows users are probably better off using the HTML help feature. + +GENERATE_TREEVIEW = YES + +# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, +# and Class Hierarchy pages using a tree view instead of an ordered list. + +USE_INLINE_TREES = NO + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open +# links to external symbols imported via tag files in a separate window. + +EXT_LINKS_IN_WINDOW = NO + +# Use this tag to change the font size of Latex formulas included +# as images in the HTML documentation. The default is 10. Note that +# when you change the font size after a successful doxygen run you need +# to manually remove any form_*.png images from the HTML output directory +# to force them to be regenerated. + +FORMULA_FONTSIZE = 10 + +# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# generated for formulas are transparent PNGs. Transparent PNGs are +# not supported properly for IE 6.0, but are supported on all modern browsers. +# Note that when changing this option you need to delete any form_*.png files +# in the HTML output before the changes have effect. + +FORMULA_TRANSPARENT = YES + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax +# (see http://www.mathjax.org) which uses client side Javascript for the +# rendering instead of using prerendered bitmaps. Use this if you do not +# have LaTeX installed or if you want to formulas look prettier in the HTML +# output. When enabled you also need to install MathJax separately and +# configure the path to it using the MATHJAX_RELPATH option. + +USE_MATHJAX = NO + +# When MathJax is enabled you need to specify the location relative to the +# HTML output directory using the MATHJAX_RELPATH option. The destination +# directory should contain the MathJax.js script. For instance, if the mathjax +# directory is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to the +# mathjax.org site, so you can quickly see the result without installing +# MathJax, but it is strongly recommended to install a local copy of MathJax +# before deployment. + +MATHJAX_RELPATH = http://www.mathjax.org/mathjax + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box +# for the HTML output. The underlying search engine uses javascript +# and DHTML and should work on any modern browser. Note that when using +# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets +# (GENERATE_DOCSET) there is already a search function so this one should +# typically be disabled. For large projects the javascript based search engine +# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. + +SEARCHENGINE = YES + +# When the SERVER_BASED_SEARCH tag is enabled the search engine will be +# implemented using a PHP enabled web server instead of at the web client +# using Javascript. Doxygen will generate the search PHP script and index +# file to put on the web server. The advantage of the server +# based approach is that it scales better to large projects and allows +# full text search. The disadvantages are that it is more difficult to setup +# and does not have live searching capabilities. + +SERVER_BASED_SEARCH = NO + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = NO + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. +# Note that when enabling USE_PDFLATEX this option is only used for +# generating bitmaps for formulas in the HTML output, but not in the +# Makefile that is written to the output directory. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4 + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = YES + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = YES + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +# If LATEX_SOURCE_CODE is set to YES then doxygen will include +# source code with syntax highlighting in the LaTeX output. +# Note that which sources are shown also depends on other settings +# such as SOURCE_BROWSER. + +LATEX_SOURCE_CODE = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. This is useful +# if you want to understand what is going on. On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_DEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# in the INCLUDE_PATH (see below) will be search if a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition that +# overrules the definition found in the source code. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all references to function-like macros +# that are alone on a line, have an all uppercase name, and do not end with a +# semicolon, because these will confuse the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. +# Optionally an initial location of the external documentation +# can be added for each tagfile. The format of a tag file without +# this location is as follows: +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths or +# URLs. If a location is present for each tag, the installdox tool +# does not have to be run to correct the links. +# Note that each tag file must have a unique name +# (where the name does NOT include the path) +# If a tag file is not located in the directory in which doxygen +# is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option also works with HAVE_DOT disabled, but it is recommended to +# install and use dot, since it yields more powerful graphs. + +CLASS_DIAGRAMS = NO + +# You can define message sequence charts within doxygen comments using the \msc +# command. Doxygen will then run the mscgen tool (see +# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the +# documentation. The MSCGEN_PATH tag allows you to specify the directory where +# the mscgen tool resides. If left empty the tool is assumed to be found in the +# default search path. + +MSCGEN_PATH = + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = YES + +# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is +# allowed to run in parallel. When set to 0 (the default) doxygen will +# base this on the number of processors available in the system. You can set it +# explicitly to a value larger than 0 to get control over the balance +# between CPU load and processing speed. + +DOT_NUM_THREADS = 0 + +# By default doxygen will write a font called Helvetica to the output +# directory and reference it in all dot files that doxygen generates. +# When you want a differently looking font you can specify the font name +# using DOT_FONTNAME. You need to make sure dot is able to find the font, +# which can be done by putting it in a standard location or by setting the +# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory +# containing the font. + +DOT_FONTNAME = Helvetica + +# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. +# The default size is 10pt. + +DOT_FONTSIZE = 10 + +# By default doxygen will tell dot to use the output directory to look for the +# FreeSans.ttf font (which doxygen will put there itself). If you specify a +# different font using DOT_FONTNAME you can set the path where dot +# can find it using this tag. + +DOT_FONTPATH = + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# the CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + +GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = NO + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = NO + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH and HAVE_DOT options are set to YES then +# doxygen will generate a call dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable call graphs +# for selected functions only using the \callgraph command. + +CALL_GRAPH = YES + +# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then +# doxygen will generate a caller dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable caller +# graphs for selected functions only using the \callergraph command. + +CALLER_GRAPH = YES + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will generate a graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are png, svg, gif or svg. +# If left blank png will be used. + +DOT_IMAGE_FORMAT = png + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The MSCFILE_DIRS tag can be used to specify one or more directories that +# contain msc files that are included in the documentation (see the +# \mscfile command). + +MSCFILE_DIRS = + +# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of +# nodes that will be shown in the graph. If the number of nodes in a graph +# becomes larger than this value, doxygen will truncate the graph, which is +# visualized by representing a node as a red box. Note that doxygen if the +# number of direct children of the root node in a graph is already larger than +# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note +# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. + +DOT_GRAPH_MAX_NODES = 50 + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes +# that lay further from the root node will be omitted. Note that setting this +# option to 1 or 2 may greatly reduce the computation time needed for large +# code bases. Also note that the size of a graph can be further restricted by +# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. + +MAX_DOT_GRAPH_DEPTH = 0 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, because dot on Windows does not +# seem to support this out of the box. Warning: Depending on the platform used, +# enabling this option may lead to badly anti-aliased labels on the edges of +# a graph (i.e. they become hard to read). + +DOT_TRANSPARENT = NO + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = NO + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES diff --git a/flex-bison/clcalc/LICENSE b/flex-bison/clcalc/LICENSE new file mode 100644 index 0000000..94a9ed0 --- /dev/null +++ b/flex-bison/clcalc/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/flex-bison/clcalc/README b/flex-bison/clcalc/README new file mode 100644 index 0000000..a5f9105 --- /dev/null +++ b/flex-bison/clcalc/README @@ -0,0 +1,25 @@ +=============================================================================== +Project Goals +=============================================================================== + +=============================================================================== +Build Requirements +=============================================================================== + +=============================================================================== +Build Instructions +=============================================================================== + +=============================================================================== +Installation Instructions +=============================================================================== + +=============================================================================== +Unit Tests +=============================================================================== + +=============================================================================== +TODO +=============================================================================== + + diff --git a/flex-bison/clcalc/TODO b/flex-bison/clcalc/TODO new file mode 100644 index 0000000..14d527c --- /dev/null +++ b/flex-bison/clcalc/TODO @@ -0,0 +1,8 @@ +Feature and Maintenance TODO List +------------------------------------------------------------------------------- +ASM translation +Integrate Assembler +Integrate Linker + +document source +gcov ceedling plugin diff --git a/flex-bison/clcalc/build/DUMMY b/flex-bison/clcalc/build/DUMMY new file mode 100644 index 0000000..e69de29 diff --git a/flex-bison/clcalc/docs/design/phases.dot b/flex-bison/clcalc/docs/design/phases.dot new file mode 100644 index 0000000..3cd861f --- /dev/null +++ b/flex-bison/clcalc/docs/design/phases.dot @@ -0,0 +1,14 @@ +digraph { + 0 [label="Phase 1: Parse"] + 1 [label="Phase 2: Translate"] + 2 [label="Phase 3: Optimize"] + 3 [label="Phase 4: Assemble"] + 4 [label="Phase 5: Link"] + + 0->1 + 0->0 + 1->2 + 2->3 + 3->4 + 3->0 +} diff --git a/flex-bison/clcalc/docs/lang.txt b/flex-bison/clcalc/docs/lang.txt new file mode 100644 index 0000000..b009714 --- /dev/null +++ b/flex-bison/clcalc/docs/lang.txt @@ -0,0 +1,17 @@ +Implement: + Numbers + Strings + Boolean + Function + +????: + Tables + List + Tuple + Dictionary + + Symbols + Lists + Vectors + Maps + diff --git a/flex-bison/clcalc/docs/literals.lang b/flex-bison/clcalc/docs/literals.lang new file mode 100644 index 0000000..1d55877 --- /dev/null +++ b/flex-bison/clcalc/docs/literals.lang @@ -0,0 +1,29 @@ +// Integers +a = 1; + +// Floats +b = 1.0; + +// Numbers + + +// Strings +c = "foo"; + +// Arrays +d = []; +d = [1.0, 2.0, 3.0, 4.0, 5.0]; + +// Maps +e = {}; +e = { + "foo1": "bar" + ,"foo2": 1.0 + ,"foo3": a +}; +f = e["foo1"]; + +// Functions +max a,b = + 1; +end diff --git a/flex-bison/clcalc/docs/test.lang b/flex-bison/clcalc/docs/test.lang new file mode 100644 index 0000000..3d913eb --- /dev/null +++ b/flex-bison/clcalc/docs/test.lang @@ -0,0 +1,34 @@ +1 + 1. +1 - 1. +1 * 1. +1 / 1. +1 % 1. +1 + 2 * 3 - 4 / 5. +(1 + 1) * 1. + +1 && 1. +1 || 1. +! 1. +! 1 || 1 && 1. + +1 == 1. +1 != 1. +1 < 1. +1 > 1. +1 <= 1. +1 >= 1. + +1 == (1 != 1). + +a = 1. +a = 1 + 1. + +foo(a). +max a,b = + if b > a: + b. + else: + a. + end +end + diff --git a/flex-bison/clcalc/ex.lang b/flex-bison/clcalc/ex.lang new file mode 100644 index 0000000..915b71b --- /dev/null +++ b/flex-bison/clcalc/ex.lang @@ -0,0 +1,7 @@ +// Example assignment statement +foo1 = 1 + 1; +foo2 = 1 - 1; +foo3 = 1 * 1; +foo4 = 1 / 1; +foo5 = 1 % 1; + diff --git a/flex-bison/clcalc/modules/common-includes/LICENSE b/flex-bison/clcalc/modules/common-includes/LICENSE new file mode 100644 index 0000000..94a9ed0 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/flex-bison/clcalc/modules/common-includes/README b/flex-bison/clcalc/modules/common-includes/README new file mode 100644 index 0000000..238275a --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/README @@ -0,0 +1,7 @@ +=============================================================================== +Project Goals +=============================================================================== +This project is a collection of C files and headers that provide common +functionality such as typedefs, macros, and debugging utilities. These files +are meant to be used by multiple projects. + diff --git a/flex-bison/clcalc/modules/common-includes/build/DUMMY b/flex-bison/clcalc/modules/common-includes/build/DUMMY new file mode 100644 index 0000000..e69de29 diff --git a/flex-bison/clcalc/modules/common-includes/project.yml b/flex-bison/clcalc/modules/common-includes/project.yml new file mode 100644 index 0000000..a2fc78b --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/project.yml @@ -0,0 +1,38 @@ +--- + +:project: + :use_exceptions: FALSE + :use_test_preprocessor: TRUE + :use_auxiliary_dependencies: TRUE + :build_root: build + :test_file_prefix: test_ + +:paths: + :test: + - tests/** + :source: + - src/** + +:defines: + :commmon: &common_defines + :test: + - *common_defines + - TEST + :test_preprocess: + - *common_defines + - TEST + +:cmock: + :mock_prefix: mock_ + :when_no_prototypes: :warn + :enforce_strict_ordering: TRUE + :plugins: + - :ignore + +:plugins: + :load_paths: + - tools/ceedling/plugins + :enabled: + - stdout_pretty_tests_report + +... diff --git a/flex-bison/clcalc/modules/common-includes/rakefile.rb b/flex-bison/clcalc/modules/common-includes/rakefile.rb new file mode 100644 index 0000000..a23ac80 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/rakefile.rb @@ -0,0 +1,3 @@ +require 'rake' +load 'tools/ceedling/lib/rakefile.rb' +task :default => ['test:all'] diff --git a/flex-bison/clcalc/modules/common-includes/src/common/common.h b/flex-bison/clcalc/modules/common-includes/src/common/common.h new file mode 100644 index 0000000..78736d8 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/src/common/common.h @@ -0,0 +1,136 @@ +/****************************************************************************** + * Copyright (C) 2011 Michael D. Lowis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ +#ifndef COMMON_H +#define COMMON_H + +/****************************************************************************** + * Types + *****************************************************************************/ +//! Boolean enum definition +typedef enum +{ + TRUE = 1, + FALSE = 0 +} BOOL; + +/**** Unsigned Integers ****/ +//! 8-bit unsigned integer +typedef unsigned char U8; + +//! 16-bit unsigned integer +typedef unsigned short int U16; + +//! 32-bit unsigned integer +typedef unsigned long U32; + +/**** Signed Integers ****/ +//! 8-bit signed integer +typedef signed char S8; + +//! 16-bit signed integer +typedef short int S16; + +//! 32-bit signed integer +typedef long int S32; + +//! 64-bit signed integer +typedef long long int S64; + +// Floating Point +//! 32-bit floating point number +typedef float F32; + +//! 64-bit floating point number +typedef double F64; + +/**** String ****/ +//! String definition +typedef char * String; + +/****************************************************************************** + * Defines + *****************************************************************************/ + +#ifdef TEST + #define STATIC +#else + #define STATIC static +#endif + +#ifndef NULL + #define NULL ((U8)0) +#endif +#define NULL_PTR ((void *)0u) + +#define BIT_0 0x01u +#define BIT_1 0x02u +#define BIT_2 0x04u +#define BIT_3 0x08u +#define BIT_4 0x10u +#define BIT_5 0x20u +#define BIT_6 0x40u +#define BIT_7 0x80u + +#define BIT_8 0x0100u +#define BIT_9 0x0200u +#define BIT_10 0x0400u +#define BIT_11 0x0800u +#define BIT_12 0x1000u +#define BIT_13 0x2000u +#define BIT_14 0x4000u +#define BIT_15 0x8000u + +#define BIT_16 0x010000u +#define BIT_17 0x020000u +#define BIT_18 0x040000u +#define BIT_19 0x080000u +#define BIT_20 0x100000u +#define BIT_21 0x200000u +#define BIT_22 0x400000u +#define BIT_23 0x800000u + +#define BIT_24 0x01000000u +#define BIT_25 0x02000000u +#define BIT_26 0x04000000u +#define BIT_27 0x08000000u +#define BIT_28 0x10000000u +#define BIT_29 0x20000000u +#define BIT_30 0x40000000u +#define BIT_31 0x80000000u + +/****************************************************************************** + * Macros + *****************************************************************************/ + +#define VERIFY_RANGE(x, Min, Max) ((((x)>=(Min)) && ((x)<=(Max)))? (TRUE) : (FALSE)) +#define VERIFY_RANGE_VALUE(x, Default, Min, Max) (VERIFY_RANGE((x), (Min), (Max))? (x) : (Default)) +#define VERIFY_MAX_VALUE(x, Default, Max) (((x)<=(Max)) ? (x) : (Default)) +#define VERIFY_MIN_VALUE(x, Default, Min) (((x)>=(Min)) ? (x) : (Default)) +#define _ABS(x, type) (((x) < (type)0) ? (type)-(x):(x)) +#define ABS(x) (((x) < 0) ? -(x):(x)) +#define MAX(a,b) (((a) > (b)) ? (a):(b)) +#define MIN(a,b) (((a) < (b)) ? (a):(b)) +#define SIGN(x,y) (((y) < 0) ? (-(x)):(x)) +#define NUM_ELEMENTS(x) (sizeof(x)/sizeof(x[0])) +#define LIMIT_RANGE(x,Min,Max) (MAX(MIN((x),(Max)),(Min))) +#define LOW_BYTE(x) ((U8)((x) & 0x00FFu)) +#define HIGH_BYTE(x) ((U8)(((x)>>8u) & 0x00FFu)) +#define LOW_WORD(x) ((U16)((x) & 0x0000FFFFUL)) +#define HIGH_WORD(x) ((U16)(((x)>>16) & 0x0000FFFFUL)) +#define QUOTE(x) #x + +#endif diff --git a/flex-bison/clcalc/modules/common-includes/src/dbg/dbg.c b/flex-bison/clcalc/modules/common-includes/src/dbg/dbg.c new file mode 100644 index 0000000..041c0f9 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/src/dbg/dbg.c @@ -0,0 +1,39 @@ +/****************************************************************************** + * Copyright (C) 2011 Michael D. Lowis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ +#include "dbg.h" + +#include +#include + +/****************************************************************************** + * Public Functions + *****************************************************************************/ +inline void DBG_Breakpoint(String file, U32 line) +{ + U8 c = 0; + printf("Breakpoint [%s line %d] ", file, (int)line); + c = getchar(); +} + +inline void DBG_Assert(String file, U32 line, String cond_text, BOOL condition) +{ + if(!condition) + { + printf("Assertion Failure [%s line %d] (%s)\n", file, (int)line, cond_text); + exit(1); + } +} diff --git a/flex-bison/clcalc/modules/common-includes/src/dbg/dbg.h b/flex-bison/clcalc/modules/common-includes/src/dbg/dbg.h new file mode 100644 index 0000000..b3952c4 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/src/dbg/dbg.h @@ -0,0 +1,36 @@ +/****************************************************************************** + * Copyright (C) 2011 Michael D. Lowis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ +#ifndef DBG_H +#define DBG_H + +#include "common.h" + +#define DEBUG +#ifdef DEBUG + #define DBG_BREAKPOINT() DBG_Breakpoint(__FILE__, __LINE__) + #define DBG_ASSERT(cond) DBG_Assert(__FILE__, __LINE__, QUOTE(cond), cond) + #define DBG_WATCH() +#else + #define DBG_BREAKPOINT() + #define DBG_ASSERT() + #define DBG_WATCH() +#endif + +inline void DBG_Breakpoint(String file, U32 line); +inline void DBG_Assert(String file, U32 line, String cond_text, BOOL condition); + +#endif diff --git a/flex-bison/clcalc/modules/common-includes/src/memutils/memutils.c b/flex-bison/clcalc/modules/common-includes/src/memutils/memutils.c new file mode 100644 index 0000000..e69de29 diff --git a/flex-bison/clcalc/modules/common-includes/src/memutils/memutils.h b/flex-bison/clcalc/modules/common-includes/src/memutils/memutils.h new file mode 100644 index 0000000..e69de29 diff --git a/flex-bison/clcalc/modules/common-includes/tests/DUMMY b/flex-bison/clcalc/modules/common-includes/tests/DUMMY new file mode 100644 index 0000000..e69de29 diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/config/test_environment.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/config/test_environment.rb new file mode 100644 index 0000000..2290f29 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/config/test_environment.rb @@ -0,0 +1,12 @@ + +# Setup our load path: +[ + 'lib', + 'test', + 'vendor/behaviors/lib', + 'vendor/hardmock/lib', + 'vendor/constructor/lib', + 'vendor/deep_merge/lib', +].each do |dir| + $LOAD_PATH.unshift( File.join( File.expand_path(File.dirname(__FILE__) + "/../"), dir) ) +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/docs/Ceedling Packet.odt b/flex-bison/clcalc/modules/common-includes/tools/ceedling/docs/Ceedling Packet.odt new file mode 100644 index 0000000..3e9902d Binary files /dev/null and b/flex-bison/clcalc/modules/common-includes/tools/ceedling/docs/Ceedling Packet.odt differ diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/docs/Ceedling Packet.pdf b/flex-bison/clcalc/modules/common-includes/tools/ceedling/docs/Ceedling Packet.pdf new file mode 100644 index 0000000..1c9cce8 Binary files /dev/null and b/flex-bison/clcalc/modules/common-includes/tools/ceedling/docs/Ceedling Packet.pdf differ diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/docs/CeedlingLogo.png b/flex-bison/clcalc/modules/common-includes/tools/ceedling/docs/CeedlingLogo.png new file mode 100644 index 0000000..52f1ce6 Binary files /dev/null and b/flex-bison/clcalc/modules/common-includes/tools/ceedling/docs/CeedlingLogo.png differ diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/cacheinator.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/cacheinator.rb new file mode 100644 index 0000000..47953dd --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/cacheinator.rb @@ -0,0 +1,42 @@ + +class Cacheinator + + constructor :cacheinator_helper, :file_path_utils, :file_wrapper, :yaml_wrapper + + def cache_test_config(hash) + @yaml_wrapper.dump( @file_path_utils.form_test_build_cache_path( INPUT_CONFIGURATION_CACHE_FILE), hash ) + end + + def cache_release_config(hash) + @yaml_wrapper.dump( @file_path_utils.form_release_build_cache_path( INPUT_CONFIGURATION_CACHE_FILE ), hash ) + end + + + def diff_cached_test_file( filepath ) + cached_filepath = @file_path_utils.form_test_build_cache_path( filepath ) + + if (@file_wrapper.exist?( cached_filepath ) and (!@file_wrapper.compare( filepath, cached_filepath ))) + @file_wrapper.cp(filepath, cached_filepath, {:preserve => false}) + return filepath + elsif (!@file_wrapper.exist?( cached_filepath )) + @file_wrapper.cp(filepath, cached_filepath, {:preserve => false}) + return filepath + end + + return cached_filepath + end + + + def diff_cached_test_config?(hash) + cached_filepath = @file_path_utils.form_test_build_cache_path(INPUT_CONFIGURATION_CACHE_FILE) + + return @cacheinator_helper.diff_cached_config?( cached_filepath, hash ) + end + + def diff_cached_release_config?(hash) + cached_filepath = @file_path_utils.form_release_build_cache_path(INPUT_CONFIGURATION_CACHE_FILE) + + return @cacheinator_helper.diff_cached_config?( cached_filepath, hash ) + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/cacheinator_helper.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/cacheinator_helper.rb new file mode 100644 index 0000000..cb0ef78 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/cacheinator_helper.rb @@ -0,0 +1,12 @@ + +class CacheinatorHelper + + constructor :file_wrapper, :yaml_wrapper + + def diff_cached_config?(cached_filepath, hash) + return true if ( not @file_wrapper.exist?(cached_filepath) ) + return true if ( (@file_wrapper.exist?(cached_filepath)) and (!(@yaml_wrapper.load(cached_filepath) == hash)) ) + return false + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/cmock_builder.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/cmock_builder.rb new file mode 100644 index 0000000..4a74aa8 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/cmock_builder.rb @@ -0,0 +1,15 @@ +require 'cmock' + +class CmockBuilder + + attr_accessor :cmock + + def setup + @cmock = nil + end + + def manufacture(cmock_config) + @cmock = CMock.new(cmock_config) + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/configurator.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/configurator.rb new file mode 100644 index 0000000..82b1e61 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/configurator.rb @@ -0,0 +1,248 @@ +require 'defaults' +require 'constants' +require 'file_path_utils' +require 'deep_merge' + + + +class Configurator + + attr_reader :project_config_hash, :environment, :script_plugins, :rake_plugins + attr_accessor :project_logging, :project_debug, :project_verbosity, :sanity_checks + + constructor(:configurator_setup, :configurator_builder, :configurator_plugins, :cmock_builder, :yaml_wrapper, :system_wrapper) do + @project_logging = false + @project_debug = false + @project_verbosity = Verbosity::NORMAL + @sanity_checks = TestResultsSanityChecks::NORMAL + end + + + def setup + # special copy of cmock config to provide to cmock for construction + @cmock_config_hash = {} + + # capture our source config for later merge operations + @source_config_hash = {} + + # note: project_config_hash is an instance variable so constants and accessors created + # in eval() statements in build() have something of proper scope and persistence to reference + @project_config_hash = {} + @project_config_hash_backup = {} + + @script_plugins = [] + @rake_plugins = [] + end + + + def replace_flattened_config(config) + @project_config_hash.merge!(config) + @configurator_setup.build_constants_and_accessors(@project_config_hash, binding()) + end + + + def store_config + @project_config_hash_backup = @project_config_hash.clone + end + + + def restore_config + @project_config_hash = @project_config_hash_backup + @configurator_setup.build_constants_and_accessors(@project_config_hash, binding()) + end + + + def reset_defaults(config) + [:test_compiler, + :test_linker, + :test_fixture, + :test_includes_preprocessor, + :test_file_preprocessor, + :test_dependencies_generator, + :release_compiler, + :release_assembler, + :release_linker, + :release_dependencies_generator].each do |tool| + config[:tools].delete(tool) if (not (config[:tools][tool].nil?)) + end + end + + + def populate_defaults(config) + new_config = DEFAULT_CEEDLING_CONFIG.clone + new_config.deep_merge!(config) + config.replace(new_config) + + @configurator_builder.populate_defaults( config, DEFAULT_TOOLS_TEST ) + @configurator_builder.populate_defaults( config, DEFAULT_TOOLS_TEST_PREPROCESSORS ) if (config[:project][:use_test_preprocessor]) + @configurator_builder.populate_defaults( config, DEFAULT_TOOLS_TEST_DEPENDENCIES ) if (config[:project][:use_auxiliary_dependencies]) + + @configurator_builder.populate_defaults( config, DEFAULT_TOOLS_RELEASE ) if (config[:project][:release_build]) + @configurator_builder.populate_defaults( config, DEFAULT_TOOLS_RELEASE_ASSEMBLER ) if (config[:project][:release_build] and config[:release_build][:use_assembly]) + @configurator_builder.populate_defaults( config, DEFAULT_TOOLS_RELEASE_DEPENDENCIES ) if (config[:project][:release_build] and config[:project][:use_auxiliary_dependencies]) + end + + + def populate_unity_defines(config) + run_test = true + + config[:unity][:defines].each do |define| + if (define =~ /RUN_TEST\s*\(.+\)\s*=/) + run_test = false + break + end + end + + if (run_test) + config[:unity][:defines] << "\"RUN_TEST(func, line_num)=TestRun(func, #func, line_num)\"" + end + end + + + def populate_cmock_defaults(config) + # cmock has its own internal defaults handling, but we need to set these specific values + # so they're present for the build environment to access; + # note: these need to end up in the hash given to initialize cmock for this to be successful + cmock = config[:cmock] + + # yes, we're duplicating the default mock_prefix in cmock, but it's because we need CMOCK_MOCK_PREFIX always available in Ceedling's environment + cmock[:mock_prefix] = 'Mock' if (cmock[:mock_prefix].nil?) + + # just because strict ordering is the way to go + cmock[:enforce_strict_ordering] = true if (cmock[:enforce_strict_ordering].nil?) + + cmock[:mock_path] = File.join(config[:project][:build_root], TESTS_BASE_PATH, 'mocks') if (cmock[:mock_path].nil?) + cmock[:verbosity] = @project_verbosity if (cmock[:verbosity].nil?) + + cmock[:plugins] = [] if (cmock[:plugins].nil?) + cmock[:plugins].map! { |plugin| plugin.to_sym } + cmock[:plugins] << (:cexception) if (!cmock[:plugins].include?(:cexception) and (config[:project][:use_exceptions])) + cmock[:plugins].uniq! + + cmock[:unity_helper] = false if (cmock[:unity_helper].nil?) + + if (cmock[:unity_helper]) + cmock[:includes] << File.basename(cmock[:unity_helper]) + cmock[:includes].uniq! + end + + @cmock_builder.manufacture(cmock) + end + + + # grab tool names from yaml and insert into tool structures so available for error messages + def populate_tool_names_and_stderr_redirect(config) + config[:tools].each_key do |name| + tool = config[:tools][name] + + # populate name if not given + tool[:name] = name.to_s if (tool[:name].nil?) + + # populate stderr redirect option + tool[:stderr_redirect] = StdErrRedirect::NONE if (tool[:stderr_redirect].nil?) + end + end + + + def find_and_merge_plugins(config) + @configurator_plugins.add_load_paths(config) + + @rake_plugins = @configurator_plugins.find_rake_plugins(config) + @script_plugins = @configurator_plugins.find_script_plugins(config) + config_plugins = @configurator_plugins.find_config_plugins(config) + plugin_defaults = @configurator_plugins.find_plugin_defaults(config) + + config_plugins.each do |plugin| + config.deep_merge( @yaml_wrapper.load(plugin) ) + end + + plugin_defaults.each do |defaults| + @configurator_builder.populate_defaults( config, @yaml_wrapper.load(defaults) ) + end + + # special plugin setting for results printing + config[:plugins][:display_raw_test_results] = true if (config[:plugins][:display_raw_test_results].nil?) + end + + + def eval_environment_variables(config) + config[:environment].each do |hash| + key = hash.keys[0] + value_string = hash[key].to_s + if (value_string =~ RUBY_STRING_REPLACEMENT_PATTERN) + value_string.replace(@system_wrapper.module_eval(value_string)) + end + @system_wrapper.env_set(key.to_s.upcase, value_string) + end + end + + + def eval_paths(config) + individual_paths = [ + config[:project][:build_root], + config[:project][:options_paths], + config[:plugins][:load_paths]] + + individual_paths.flatten.each do |path| + path.replace(@system_wrapper.module_eval(path)) if (path =~ RUBY_STRING_REPLACEMENT_PATTERN) + end + + config[:paths].each_pair do |key, list| + list.each { |path_entry| path_entry.replace(@system_wrapper.module_eval(path_entry)) if (path_entry =~ RUBY_STRING_REPLACEMENT_PATTERN) } + end + end + + + def standardize_paths(config) + individual_paths = [ + config[:project][:build_root], + config[:project][:options_paths], + config[:plugins][:load_paths], + config[:cmock][:mock_path]] # cmock path in case it was explicitly set in config + + individual_paths.flatten.each { |path| FilePathUtils::standardize(path) } + + config[:paths].each_pair do |key, list| + list.each{|path| FilePathUtils::standardize(path)} + # ensure that list is an array (i.e. handle case of list being a single string) + config[:paths][key] = [list].flatten + end + + config[:tools].each_pair do |key, tool_config| + FilePathUtils::standardize(tool_config[:executable]) + end + end + + + def validate(config) + # collect felonies and go straight to jail + raise if (not @configurator_setup.validate_required_sections(config)) + + # collect all misdemeanors, everybody on probation + blotter = [] + blotter << @configurator_setup.validate_required_section_values(config) + blotter << @configurator_setup.validate_paths(config) + blotter << @configurator_setup.validate_tools(config) + + raise if (blotter.include?(false)) + end + + + def build(config) + built_config = @configurator_setup.build_project_config(config) + + @source_config_hash = config.clone + @project_config_hash = built_config.clone + store_config() + + @configurator_setup.build_constants_and_accessors(built_config, binding()) + end + + + def insert_rake_plugins(plugins) + plugins.each do |plugin| + @project_config_hash[:project_rakefile_component_files] << plugin + end + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/configurator_builder.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/configurator_builder.rb new file mode 100644 index 0000000..48d99eb --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/configurator_builder.rb @@ -0,0 +1,408 @@ +require 'rubygems' +require 'rake' # for ext() method +require 'file_path_utils' # for class methods +require 'defaults' +require 'constants' # for Verbosity constants class & base file paths + + + +class ConfiguratorBuilder + + constructor :file_system_utils, :file_wrapper, :system_wrapper + + + def build_global_constants(config) + config.each_pair do |key, value| + formatted_key = key.to_s.upcase + # undefine global constant if it already exists + Object.send(:remove_const, formatted_key.to_sym) if @system_wrapper.constants_include?(formatted_key) + # create global constant + Object.module_eval("#{formatted_key} = value") + end + end + + + def build_accessor_methods(config, context) + config.each_pair do |key, value| + # fill configurator object with accessor methods + eval("def #{key.to_s.downcase}() return @project_config_hash[:#{key.to_s}] end", context) + end + end + + + # create a flattened hash from the original configuration structure + def flattenify(config) + new_hash = {} + + config.each_key do | parent | + + # gracefully handle empty top-level entries + next if (config[parent].nil?) + + case config[parent] + when Array + config[parent].each do |hash| + key = "#{parent.to_s.downcase}_#{hash.keys[0].to_s.downcase}".to_sym + new_hash[key] = hash[hash.keys[0]] + end + when Hash + config[parent].each_pair do | child, value | + key = "#{parent.to_s.downcase}_#{child.to_s.downcase}".to_sym + new_hash[key] = value + end + # handle entries with no children, only values + else + new_hash["#{parent.to_s.downcase}".to_sym] = config[parent] + end + + end + + return new_hash + end + + + def populate_defaults(config, defaults) + defaults.keys.sort.each do |section| + defaults[section].keys.sort.each do |entry| + config[section][entry] = defaults[section][entry] if (config[section].nil? or config[section][entry].nil?) + end + end + end + + + def clean(in_hash) + # ensure that include files inserted into test runners have file extensions & proper ones at that + in_hash[:test_runner_includes].map!{|include| include.ext(in_hash[:extension_header])} + end + + + def set_build_paths(in_hash) + out_hash = {} + + project_build_artifacts_root = File.join(in_hash[:project_build_root], 'artifacts') + project_build_tests_root = File.join(in_hash[:project_build_root], TESTS_BASE_PATH) + project_build_release_root = File.join(in_hash[:project_build_root], RELEASE_BASE_PATH) + + paths = [ + [:project_build_artifacts_root, project_build_artifacts_root, true ], + [:project_build_tests_root, project_build_tests_root, true ], + [:project_build_release_root, project_build_release_root, in_hash[:project_release_build] ], + + [:project_test_artifacts_path, File.join(project_build_artifacts_root, TESTS_BASE_PATH), true ], + [:project_test_runners_path, File.join(project_build_tests_root, 'runners'), true ], + [:project_test_results_path, File.join(project_build_tests_root, 'results'), true ], + [:project_test_build_output_path, File.join(project_build_tests_root, 'out'), true ], + [:project_test_build_cache_path, File.join(project_build_tests_root, 'cache'), true ], + [:project_test_dependencies_path, File.join(project_build_tests_root, 'dependencies'), true ], + + [:project_release_artifacts_path, File.join(project_build_artifacts_root, RELEASE_BASE_PATH), in_hash[:project_release_build] ], + [:project_release_build_cache_path, File.join(project_build_release_root, 'cache'), in_hash[:project_release_build] ], + [:project_release_build_output_path, File.join(project_build_release_root, 'out'), in_hash[:project_release_build] ], + [:project_release_build_output_asm_path, File.join(project_build_release_root, 'out', 'asm'), in_hash[:project_release_build] ], + [:project_release_build_output_c_path, File.join(project_build_release_root, 'out', 'c'), in_hash[:project_release_build] ], + [:project_release_dependencies_path, File.join(project_build_release_root, 'dependencies'), in_hash[:project_release_build] ], + + [:project_log_path, File.join(in_hash[:project_build_root], 'logs'), true ], + [:project_temp_path, File.join(in_hash[:project_build_root], 'temp'), true ], + + [:project_test_preprocess_includes_path, File.join(project_build_tests_root, 'preprocess/includes'), in_hash[:project_use_test_preprocessor] ], + [:project_test_preprocess_files_path, File.join(project_build_tests_root, 'preprocess/files'), in_hash[:project_use_test_preprocessor] ], + ] + + out_hash[:project_build_paths] = [] + + # fetch already set mock path + out_hash[:project_build_paths] << in_hash[:cmock_mock_path] if (in_hash[:project_use_mocks]) + + paths.each do |path| + build_path_name = path[0] + build_path = path[1] + build_path_add_condition = path[2] + + # insert path into build paths if associated with true condition + out_hash[:project_build_paths] << build_path if build_path_add_condition + # set path symbol name and path for each entry in paths array + out_hash[build_path_name] = build_path + end + + return out_hash + end + + + def set_force_build_filepaths(in_hash) + out_hash = {} + + out_hash[:project_test_force_rebuild_filepath] = File.join( in_hash[:project_test_dependencies_path], 'force_build' ) + out_hash[:project_release_force_rebuild_filepath] = File.join( in_hash[:project_release_dependencies_path], 'force_build' ) if (in_hash[:project_release_build]) + + return out_hash + end + + + def set_rakefile_components(in_hash) + out_hash = { + :project_rakefile_component_files => + [File.join(CEEDLING_LIB, 'tasks_base.rake'), + File.join(CEEDLING_LIB, 'tasks_filesystem.rake'), + File.join(CEEDLING_LIB, 'tasks_tests.rake'), + File.join(CEEDLING_LIB, 'tasks_vendor.rake'), + File.join(CEEDLING_LIB, 'rules_tests.rake')]} + + out_hash[:project_rakefile_component_files] << File.join(CEEDLING_LIB, 'rules_cmock.rake') if (in_hash[:project_use_mocks]) + out_hash[:project_rakefile_component_files] << File.join(CEEDLING_LIB, 'rules_preprocess.rake') if (in_hash[:project_use_test_preprocessor]) + out_hash[:project_rakefile_component_files] << File.join(CEEDLING_LIB, 'rules_tests_aux_dependencies.rake') if (in_hash[:project_use_auxiliary_dependencies]) + + out_hash[:project_rakefile_component_files] << File.join(CEEDLING_LIB, 'rules_release_aux_dependencies.rake') if (in_hash[:project_release_build] and in_hash[:project_use_auxiliary_dependencies]) + out_hash[:project_rakefile_component_files] << File.join(CEEDLING_LIB, 'rules_release.rake') if (in_hash[:project_release_build]) + out_hash[:project_rakefile_component_files] << File.join(CEEDLING_LIB, 'tasks_release.rake') if (in_hash[:project_release_build]) + + return out_hash + end + + + def set_library_build_info_filepaths(hash) + + # Notes: + # - Dependency on a change to our input configuration hash is handled elsewhere as it is + # dynamically formed during ceedling's execution + # - Compiled vendor dependencies like cmock.o, unity.o, cexception.o are handled below; + # here we're interested only in ceedling-based code generation dependencies + + ceedling_build_info_filepath = File.join(CEEDLING_RELEASE, 'build.info') + cmock_build_info_filepath = FilePathUtils::form_ceedling_vendor_path('cmock/release', 'build.info') + + out_hash = { + :ceedling_build_info_filepath => ceedling_build_info_filepath, + :cmock_build_info_filepath => cmock_build_info_filepath + } + + return out_hash + end + + + def set_release_target(in_hash) + return {} if (not in_hash[:project_release_build]) + + release_target_file = ((in_hash[:release_build_output].nil?) ? (DEFAULT_RELEASE_TARGET_NAME.ext(in_hash[:extension_executable])) : in_hash[:release_build_output]) + + return { + # tempted to make a helper method in file_path_utils? stop right there, pal. you'll introduce a cyclical dependency + :project_release_build_target => File.join(in_hash[:project_release_artifacts_path], release_target_file) + } + end + + + def collect_environment_variables(in_hash) + return { + :collection_environment => in_hash[:environment] + } + end + + + def collect_project_options(in_hash) + options = [] + + in_hash[:project_options_paths].each do |path| + options << @file_wrapper.directory_listing( File.join(path, '*.yml') ) + end + + return { + :collection_project_options => options.flatten + } + end + + + def expand_all_path_globs(in_hash) + out_hash = {} + path_keys = [] + + in_hash.each_key do |key| + next if (not key.to_s[0..4] == 'paths') + path_keys << key + end + + # sorted to provide assured order of traversal in test calls on mocks + path_keys.sort.each do |key| + out_hash["collection_#{key.to_s}".to_sym] = @file_system_utils.collect_paths( in_hash[key] ) + end + + return out_hash + end + + + def collect_source_and_include_paths(in_hash) + return { + :collection_paths_source_and_include => + in_hash[:collection_paths_source] + + in_hash[:collection_paths_include] + } + end + + + def collect_source_include_vendor_paths(in_hash) + extra_paths = [] + extra_paths << FilePathUtils::form_ceedling_vendor_path(CEXCEPTION_LIB_PATH) if (in_hash[:project_use_exceptions]) + + return { + :collection_paths_source_include_vendor => + in_hash[:collection_paths_source_and_include] + + extra_paths + } + end + + + def collect_test_support_source_include_paths(in_hash) + return { + :collection_paths_test_support_source_include => + in_hash[:collection_paths_test] + + in_hash[:collection_paths_support] + + in_hash[:collection_paths_source] + + in_hash[:collection_paths_include] + } + end + + + def collect_test_support_source_include_vendor_paths(in_hash) + extra_paths = [] + extra_paths << FilePathUtils::form_ceedling_vendor_path(UNITY_LIB_PATH) + extra_paths << FilePathUtils::form_ceedling_vendor_path(CEXCEPTION_LIB_PATH) if (in_hash[:project_use_exceptions]) + extra_paths << FilePathUtils::form_ceedling_vendor_path(CMOCK_LIB_PATH) if (in_hash[:project_use_mocks]) + extra_paths << in_hash[:cmock_mock_path] if (in_hash[:project_use_mocks]) + + return { + :collection_paths_test_support_source_include_vendor => + in_hash[:collection_paths_test_support_source_include] + + extra_paths + } + end + + + def collect_tests(in_hash) + all_tests = @file_wrapper.instantiate_file_list + + in_hash[:collection_paths_test].each do |path| + all_tests.include( File.join(path, "#{in_hash[:project_test_file_prefix]}*#{in_hash[:extension_source]}") ) + end + + return {:collection_all_tests => all_tests} + end + + + def collect_assembly(in_hash) + all_assembly = @file_wrapper.instantiate_file_list + + return {:collection_all_assembly => all_assembly} if (not in_hash[:release_build_use_assembly]) + + in_hash[:collection_paths_source].each do |path| + all_assembly.include( File.join(path, "*#{in_hash[:extension_assembly]}") ) + end + + return {:collection_all_assembly => all_assembly} + end + + + def collect_source(in_hash) + all_source = @file_wrapper.instantiate_file_list + + in_hash[:collection_paths_source].each do |path| + all_source.include( File.join(path, "*#{in_hash[:extension_source]}") ) + end + + return {:collection_all_source => all_source} + end + + + def collect_headers(in_hash) + all_headers = @file_wrapper.instantiate_file_list + + paths = + in_hash[:collection_paths_test] + + in_hash[:collection_paths_support] + + in_hash[:collection_paths_source] + + in_hash[:collection_paths_include] + + (paths).each do |path| + all_headers.include( File.join(path, "*#{in_hash[:extension_header]}") ) + end + + return {:collection_all_headers => all_headers} + end + + + def collect_all_existing_compilation_input(in_hash) + all_input = @file_wrapper.instantiate_file_list + + paths = + in_hash[:collection_paths_test] + + in_hash[:collection_paths_support] + + in_hash[:collection_paths_source] + + in_hash[:collection_paths_include] + + [FilePathUtils::form_ceedling_vendor_path(UNITY_LIB_PATH)] + + paths << FilePathUtils::form_ceedling_vendor_path(CEXCEPTION_LIB_PATH) if (in_hash[:project_use_exceptions]) + paths << FilePathUtils::form_ceedling_vendor_path(CMOCK_LIB_PATH) if (in_hash[:project_use_mocks]) + + (paths).each do |path| + all_input.include( File.join(path, "*#{in_hash[:extension_header]}") ) + all_input.include( File.join(path, "*#{in_hash[:extension_source]}") ) + end + + return {:collection_all_existing_compilation_input => all_input} + end + + + def collect_test_and_vendor_defines(in_hash) + test_defines = in_hash[:defines_test].clone + + test_defines.concat(in_hash[:unity_defines]) + test_defines.concat(in_hash[:cmock_defines]) if (in_hash[:project_use_mocks]) + test_defines.concat(in_hash[:cexception_defines]) if (in_hash[:project_use_exceptions]) + + return {:collection_defines_test_and_vendor => test_defines} + end + + + def collect_release_and_vendor_defines(in_hash) + release_defines = in_hash[:defines_release].clone + + release_defines.concat(in_hash[:cexception_defines]) if (in_hash[:project_use_exceptions]) + + return {:collection_defines_release_and_vendor => release_defines} + end + + + def collect_release_artifact_extra_link_objects(in_hash) + objects = [] + + # no build paths here so plugins can remap if necessary (i.e. path mapping happens at runtime) + objects << CEXCEPTION_C_FILE.ext( in_hash[:extension_object] ) if (in_hash[:project_use_exceptions]) + + return {:collection_release_artifact_extra_link_objects => objects} + end + + + def collect_test_fixture_extra_link_objects(in_hash) + # Note: Symbols passed to compiler at command line can change Unity and CException behavior / configuration; + # we also handle those dependencies elsewhere in compilation dependencies + + objects = [UNITY_C_FILE] + + # we don't include paths here because use of plugins or mixing different compilers may require different build paths + objects << CEXCEPTION_C_FILE if (in_hash[:project_use_exceptions]) + objects << CMOCK_C_FILE if (in_hash[:project_use_mocks]) + + # if we're using mocks & a unity helper is defined & that unity helper includes a source file component (not only a header of macros), + # then link in the unity_helper object file too + if ( in_hash[:project_use_mocks] and + in_hash[:cmock_unity_helper] and + @file_wrapper.exist?(in_hash[:cmock_unity_helper].ext(in_hash[:extension_source])) ) + objects << File.basename(in_hash[:cmock_unity_helper]) + end + + # no build paths here so plugins can remap if necessary (i.e. path mapping happens at runtime) + objects.map! { |object| object.ext(in_hash[:extension_object]) } + + return { :collection_test_fixture_extra_link_objects => objects } + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/configurator_plugins.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/configurator_plugins.rb new file mode 100644 index 0000000..4a65579 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/configurator_plugins.rb @@ -0,0 +1,96 @@ +require 'constants' + +class ConfiguratorPlugins + + constructor :stream_wrapper, :file_wrapper, :system_wrapper + + def setup + @rake_plugins = [] + @script_plugins = [] + end + + + def add_load_paths(config) + config[:plugins][:load_paths].each do |root| + @system_wrapper.add_load_path( root ) if ( not @file_wrapper.directory_listing( File.join( root, '*.rb' ) ).empty? ) + + config[:plugins][:enabled].each do |plugin| + path = File.join( root, plugin ) + @system_wrapper.add_load_path( path ) if ( not @file_wrapper.directory_listing( File.join( path, '*.rb' ) ).empty? ) + end + end + end + + + # gather up and return .rake filepaths that exist on-disk + def find_rake_plugins(config) + plugins_with_path = [] + + config[:plugins][:load_paths].each do |root| + config[:plugins][:enabled].each do |plugin| + rake_plugin_path = File.join(root, plugin, "#{plugin}.rake") + if (@file_wrapper.exist?(rake_plugin_path)) + plugins_with_path << rake_plugin_path + @rake_plugins << plugin + end + end + end + + return plugins_with_path + end + + + # gather up and return just names of .rb classes that exist on-disk + def find_script_plugins(config) + config[:plugins][:load_paths].each do |root| + config[:plugins][:enabled].each do |plugin| + script_plugin_path = File.join(root, plugin, "#{plugin}.rb") + @script_plugins << plugin if @file_wrapper.exist?(script_plugin_path) + end + end + + return @script_plugins + end + + + # gather up and return configuration .yml filepaths that exist on-disk + def find_config_plugins(config) + plugins_with_path = [] + + config[:plugins][:load_paths].each do |root| + config[:plugins][:enabled].each do |plugin| + config_plugin_path = File.join(root, plugin, "#{plugin}.yml") + plugins_with_path << config_plugin_path if @file_wrapper.exist?(config_plugin_path) + end + end + + return plugins_with_path + end + + + # gather up and return default .yml filepaths that exist on-disk + def find_plugin_defaults(config) + defaults_with_path = [] + + config[:plugins][:load_paths].each do |root| + config[:plugins][:enabled].each do |plugin| + default_path = File.join(root, plugin, 'defaults.yml') + defaults_with_path << default_path if @file_wrapper.exist?(default_path) + end + end + + return defaults_with_path + end + + + def validate_plugins(enabled_plugins) + missing_plugins = Set.new(enabled_plugins) - Set.new(@rake_plugins) - Set.new(@script_plugins) + + missing_plugins.each do |plugin| + @stream_wrapper.stdout_puts.stderr_puts("ERROR: Ceedling plugin '#{plugin}' contains no rake or ruby class entry point. (Misspelled or missing files?)") + end + + raise if (missing_plugins.size > 0) + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/configurator_setup.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/configurator_setup.rb new file mode 100644 index 0000000..e404727 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/configurator_setup.rb @@ -0,0 +1,114 @@ + +# add sort-ability to symbol so we can order keys array in hash for test-ability +class Symbol + include Comparable + + def <=>(other) + self.to_s <=> other.to_s + end +end + + +class ConfiguratorSetup + + constructor :configurator_builder, :configurator_validator + + + def build_project_config(config) + # convert config object to flattened hash + new_config = @configurator_builder.flattenify(config) + + # flesh out config + @configurator_builder.clean(new_config) + + # add to hash values we build up from configuration & file system contents + new_config.merge!(@configurator_builder.set_build_paths(new_config)) + new_config.merge!(@configurator_builder.set_force_build_filepaths(new_config)) + new_config.merge!(@configurator_builder.set_rakefile_components(new_config)) + new_config.merge!(@configurator_builder.set_library_build_info_filepaths(new_config)) + new_config.merge!(@configurator_builder.set_release_target(new_config)) + new_config.merge!(@configurator_builder.collect_project_options(new_config)) + new_config.merge!(@configurator_builder.collect_environment_variables(config)) + + # iterate through all entries in paths section and expand any & all globs to actual paths + new_config.merge!(@configurator_builder.expand_all_path_globs(new_config)) + + new_config.merge!(@configurator_builder.collect_source_and_include_paths(new_config)) + new_config.merge!(@configurator_builder.collect_source_include_vendor_paths(new_config)) + new_config.merge!(@configurator_builder.collect_test_support_source_include_paths(new_config)) + new_config.merge!(@configurator_builder.collect_test_support_source_include_vendor_paths(new_config)) + new_config.merge!(@configurator_builder.collect_tests(new_config)) + new_config.merge!(@configurator_builder.collect_assembly(new_config)) + new_config.merge!(@configurator_builder.collect_source(new_config)) + new_config.merge!(@configurator_builder.collect_headers(new_config)) + new_config.merge!(@configurator_builder.collect_all_existing_compilation_input(new_config)) + new_config.merge!(@configurator_builder.collect_test_and_vendor_defines(new_config)) + new_config.merge!(@configurator_builder.collect_release_and_vendor_defines(new_config)) + new_config.merge!(@configurator_builder.collect_release_artifact_extra_link_objects(new_config)) + new_config.merge!(@configurator_builder.collect_test_fixture_extra_link_objects(new_config)) + + return new_config + end + + + def build_constants_and_accessors(config, context) + @configurator_builder.build_global_constants(config) + @configurator_builder.build_accessor_methods(config, context) + end + + + def validate_required_sections(config) + validation = [] + validation << @configurator_validator.exists?(config, :project) + validation << @configurator_validator.exists?(config, :paths) + + return false if (validation.include?(false)) + return true + end + + def validate_required_section_values(config) + validation = [] + validation << @configurator_validator.exists?(config, :project, :build_root) + validation << @configurator_validator.exists?(config, :paths, :test) + validation << @configurator_validator.exists?(config, :paths, :source) + + return false if (validation.include?(false)) + return true + end + + def validate_paths(config) + validation = [] + + validation << @configurator_validator.validate_filepath(config, {:search_system_path => false}, :project, :build_root) + validation << @configurator_validator.validate_filepath(config, {:search_system_path => false}, :cmock, :unity_helper) if config[:cmock][:unity_helper] + + config[:project][:options_paths].each do |path| + validation << @configurator_validator.validate_filepath_simple( path, :project, :options_paths ) + end + + config[:plugins][:load_paths].each do |path| + validation << @configurator_validator.validate_filepath_simple( path, :plugins, :load_paths ) + end + + config[:paths].keys.sort.each do |key| + validation << @configurator_validator.validate_path_list(config, :paths, key) + end + + return false if (validation.include?(false)) + return true + end + + def validate_tools(config) + validation = [] + + config[:tools].keys.sort.each do |key| + validation << @configurator_validator.exists?(config, :tools, key, :executable) + validation << @configurator_validator.validate_filepath(config, {:search_system_path => true}, :tools, key, :executable) + validation << @configurator_validator.validate_tool_stderr_redirect(config, :tools, key) + end + + return false if (validation.include?(false)) + return true + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/configurator_validator.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/configurator_validator.rb new file mode 100644 index 0000000..e50c0d4 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/configurator_validator.rb @@ -0,0 +1,154 @@ +require 'constants' +require 'tool_executor' # for argument replacement pattern +require 'file_path_utils' # for glob handling class methods + + +class ConfiguratorValidator + + constructor :file_wrapper, :stream_wrapper, :system_wrapper + + # walk into config hash verify existence of data at key depth + def exists?(config, *keys) + hash = retrieve_value(config, keys) + exist = !hash[:value].nil? + + if (not exist) + # no verbosity checking since this is lowest level anyhow & verbosity checking depends on configurator + @stream_wrapper.stderr_puts("ERROR: Required config file entry #{format_key_sequence(keys, hash[:depth])} does not exist.") + end + + return exist + end + + + # walk into config hash. verify directory path(s) at given key depth + def validate_path_list(config, *keys) + hash = retrieve_value(config, keys) + list = hash[:value] + + # return early if we couldn't walk into hash and find a value + return false if (list.nil?) + + path_list = [] + exist = true + + case list + when String then path_list << list + when Array then path_list = list + end + + path_list.each do |path| + base_path = FilePathUtils::extract_path(path) # lop off add/subtract notation & glob specifiers + + if (not @file_wrapper.exist?(base_path)) + # no verbosity checking since this is lowest level anyhow & verbosity checking depends on configurator + @stream_wrapper.stderr_puts("ERROR: Config path #{format_key_sequence(keys, hash[:depth])}['#{base_path}'] does not exist on disk.") + exist = false + end + end + + return exist + end + + + # simple path verification + def validate_filepath_simple(path, *keys) + validate_path = path + + if (not @file_wrapper.exist?(validate_path)) + # no verbosity checking since this is lowest level anyhow & verbosity checking depends on configurator + @stream_wrapper.stderr_puts("ERROR: Config path '#{validate_path}' associated with #{format_key_sequence(keys, keys.size)} does not exist on disk.") + return false + end + + return true + end + + + # walk into config hash. verify specified file exists. + def validate_filepath(config, options, *keys) + hash = retrieve_value(config, keys) + filepath = hash[:value] + + # return early if we couldn't walk into hash and find a value + return false if (filepath.nil?) + + # skip everything if we've got an argument replacement pattern + return true if (filepath =~ TOOL_EXECUTOR_ARGUMENT_REPLACEMENT_PATTERN) + + # if there's no path included, verify file exists somewhere in system search paths + if (not filepath.include?('/') and options[:search_system_path]) + exists = false + + @system_wrapper.search_paths.each do |path| + if (@file_wrapper.exist?(File.join(path, filepath))) + exists = true + break + end + end + + if (not exists) + # no verbosity checking since this is lowest level anyhow & verbosity checking depends on configurator + @stream_wrapper.stderr_puts("ERROR: Config filepath #{format_key_sequence(keys, hash[:depth])}['#{filepath}'] does not exist in system search paths.") + return false + end + + # if there is a path included, check that explicit filepath exists + else + if (not @file_wrapper.exist?(filepath)) + # no verbosity checking since this is lowest level anyhow & verbosity checking depends on configurator + @stream_wrapper.stderr_puts("ERROR: Config filepath #{format_key_sequence(keys, hash[:depth])}['#{filepath}'] does not exist on disk.") + return false + end + end + + return true + end + + def validate_tool_stderr_redirect(config, tools, tool) + redirect = config[tools][tool][:stderr_redirect] + if (redirect.class == Symbol) + # map constants and force to array of strings for runtime universality across ruby versions + if (not StdErrRedirect.constants.map{|constant| constant.to_s}.include?(redirect.to_s.upcase)) + error = "ERROR: [:#{tools}][:#{tool}][:stderr_redirect][:#{redirect}] is not a recognized option " + + "{#{StdErrRedirect.constants.map{|constant| ':' + constant.to_s.downcase}.join(', ')}}." + @stream_wrapper.stderr_puts(error) + return false + end + end + + return true + end + + private ######################################### + + + def retrieve_value(config, keys) + value = nil + hash = config + depth = 0 + + # walk into hash & extract value at requested key sequence + keys.each do |symbol| + depth += 1 + if (not hash[symbol].nil?) + hash = hash[symbol] + value = hash + else + value = nil + break + end + end + + return {:value => value, :depth => depth} + end + + + def format_key_sequence(keys, depth) + walked_keys = keys.slice(0, depth) + formatted_keys = walked_keys.map{|key| "[:#{key.to_s}]"} + + return formatted_keys.join + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/constants.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/constants.rb new file mode 100644 index 0000000..634a7e4 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/constants.rb @@ -0,0 +1,62 @@ + +class Verbosity + SILENT = 0 # as silent as possible (though there are some messages that must be spit out) + ERRORS = 1 # only errors + COMPLAIN = 2 # spit out errors and warnings/notices + NORMAL = 3 # errors, warnings/notices, standard status messages + OBNOXIOUS = 4 # all messages including extra verbose output (used for lite debugging / verification) + DEBUG = 5 # special extra verbose output for hardcore debugging +end + + +class TestResultsSanityChecks + NONE = 0 # no sanity checking of test results + NORMAL = 1 # perform non-problematic checks + THOROUGH = 2 # perform checks that require inside knowledge of system workings +end + + +class StdErrRedirect + NONE = :none + AUTO = :auto + WIN = :win + UNIX = :unix + TCSH = :tcsh +end + +CEXCEPTION_ROOT_PATH = 'c_exception' +CEXCEPTION_LIB_PATH = "#{CEXCEPTION_ROOT_PATH}/lib" +CEXCEPTION_C_FILE = 'CException.c' +CEXCEPTION_H_FILE = 'CException.h' + +UNITY_ROOT_PATH = 'unity' +UNITY_LIB_PATH = "#{UNITY_ROOT_PATH}/src" +UNITY_C_FILE = 'unity.c' +UNITY_H_FILE = 'unity.h' +UNITY_INTERNALS_H_FILE = 'unity_internals.h' + +CMOCK_ROOT_PATH = 'cmock' +CMOCK_LIB_PATH = "#{CMOCK_ROOT_PATH}/src" +CMOCK_C_FILE = 'cmock.c' +CMOCK_H_FILE = 'cmock.h' + + +DEFAULT_CEEDLING_MAIN_PROJECT_FILE = 'project.yml' # main project file +DEFAULT_CEEDLING_USER_PROJECT_FILE = 'user.yml' # supplemental user config file + +INPUT_CONFIGURATION_CACHE_FILE = 'input.yml' # input configuration file dump + + +TEST_ROOT_NAME = 'test' +TEST_TASK_ROOT = TEST_ROOT_NAME + ':' +TEST_CONTEXT = TEST_ROOT_NAME.to_sym +RELEASE_ROOT_NAME = 'release' + +RUBY_STRING_REPLACEMENT_PATTERN = /#\{.+\}/ +RUBY_EVAL_REPLACEMENT_PATTERN = /^\{(.+)\}$/ +TOOL_EXECUTOR_ARGUMENT_REPLACEMENT_PATTERN = /(\$\{(\d+)\})/ + +NULL_FILE_PATH = '/dev/null' + +TESTS_BASE_PATH = 'tests' +RELEASE_BASE_PATH = 'release' diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/defaults.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/defaults.rb new file mode 100644 index 0000000..78cbcbd --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/defaults.rb @@ -0,0 +1,349 @@ +require 'constants' +require 'system_wrapper' +require 'file_path_utils' + + +DEFAULT_TEST_COMPILER_TOOL = { + :executable => FilePathUtils.os_executable_ext('gcc'), + :name => 'default_test_compiler', + :stderr_redirect => StdErrRedirect::NONE, + :arguments => [ + {"-I\"$\"" => 'COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR'}, + {"-I\"$\"" => 'COLLECTION_PATHS_TEST_TOOLCHAIN_INCLUDE'}, + {"-D$" => 'COLLECTION_DEFINES_TEST_AND_VENDOR'}, + "-DGNU_COMPILER", + {"$" => 'TEST_COMPILER_ARGUMENTS'}, + "-c \"${1}\"", + "-o \"${2}\"", + ] + } + +DEFAULT_TEST_LINKER_TOOL = { + :executable => FilePathUtils.os_executable_ext('gcc'), + :name => 'default_test_linker', + :stderr_redirect => StdErrRedirect::NONE, + :arguments => [ + {"$" => 'TEST_LINKER_ARGUMENTS'}, + "\"${1}\"", + "-o \"${2}\"", + ] + } + +DEFAULT_TEST_FIXTURE_TOOL = { + :executable => '${1}', + :name => 'default_test_fixture', + :stderr_redirect => StdErrRedirect::AUTO, + :arguments => [ + {"$" => 'TEST_FIXTURE_ARGUMENTS'}, + ] + } + + + +DEFAULT_TEST_INCLUDES_PREPROCESSOR_TOOL = { + :executable => FilePathUtils.os_executable_ext('cpp'), + :name => 'default_test_includes_preprocessor', + :stderr_redirect => StdErrRedirect::NONE, + :arguments => [ + '-MM', '-MG', + # avoid some possibility of deep system lib header file complications by omitting vendor paths + # if cpp is run on *nix system, escape spaces in paths; if cpp on windows just use the paths collection as is + {"-I\"$\"" => "{SystemWrapper.is_windows? ? COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE : COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE.map{|path| path.gsub(\/ \/, \'\\\\ \') }}"}, + {"-D$" => 'COLLECTION_DEFINES_TEST_AND_VENDOR'}, + {"-D$" => 'DEFINES_TEST_PREPROCESS'}, + "-DGNU_PREPROCESSOR", + {"$" => 'TEST_INCLUDES_PREPROCESSOR_ARGUMENTS'}, + '-w', + '-nostdinc', + "\"${1}\"" + ] + } + +DEFAULT_TEST_FILE_PREPROCESSOR_TOOL = { + :executable => FilePathUtils.os_executable_ext('gcc'), + :name => 'default_test_file_preprocessor', + :stderr_redirect => StdErrRedirect::NONE, + :arguments => [ + '-E', + {"-I\"$\"" => 'COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR'}, + {"-I\"$\"" => 'PATHS_TEST_TOOLCHAIN_INCLUDE'}, + {"-D$" => 'COLLECTION_DEFINES_TEST_AND_VENDOR'}, + {"-D$" => 'DEFINES_TEST_PREPROCESS'}, + "-DGNU_PREPROCESSOR", + {"$" => 'TEST_FILE_PREPROCESSOR_ARGUMENTS'}, + "\"${1}\"", + "-o \"${2}\"" + ] + } + +DEFAULT_TEST_DEPENDENCIES_GENERATOR_TOOL = { + :executable => FilePathUtils.os_executable_ext('gcc'), + :name => 'default_test_dependencies_generator', + :stderr_redirect => StdErrRedirect::NONE, + :arguments => [ + {"-I\"$\"" => 'COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR'}, + {"-I\"$\"" => 'COLLECTION_PATHS_TEST_TOOLCHAIN_INCLUDE'}, + {"-D$" => 'COLLECTION_DEFINES_TEST_AND_VENDOR'}, + {"-D$" => 'DEFINES_TEST_PREPROCESS'}, + "-DGNU_PREPROCESSOR", + "-MT \"${3}\"", + '-MM', '-MD', '-MG', + "-MF \"${2}\"", + {"$" => 'TEST_DEPENDENCIES_GENERATOR_ARGUMENTS'}, + "-c \"${1}\"", + ] + } + +DEFAULT_RELEASE_DEPENDENCIES_GENERATOR_TOOL = { + :executable => FilePathUtils.os_executable_ext('gcc'), + :name => 'default_release_dependencies_generator', + :stderr_redirect => StdErrRedirect::NONE, + :arguments => [ + {"-I\"$\"" => 'COLLECTION_PATHS_SOURCE_AND_INCLUDE'}, + {"-I\"$\"" => 'COLLECTION_PATHS_RELEASE_TOOLCHAIN_INCLUDE'}, + {"-D$" => 'COLLECTION_DEFINES_RELEASE_AND_VENDOR'}, + {"-D$" => 'DEFINES_RELEASE_PREPROCESS'}, + "-DGNU_PREPROCESSOR", + "-MT \"${3}\"", + '-MM', '-MD', '-MG', + "-MF \"${2}\"", + {"$" => 'RELEASE_DEPENDENCIES_GENERATOR_ARGUMENTS'}, + "-c \"${1}\"", + ] + } + + +DEFAULT_RELEASE_COMPILER_TOOL = { + :executable => FilePathUtils.os_executable_ext('gcc'), + :name => 'default_release_compiler', + :stderr_redirect => StdErrRedirect::NONE, + :arguments => [ + {"-I\"$\"" => 'COLLECTION_PATHS_SOURCE_INCLUDE_VENDOR'}, + {"-I\"$\"" => 'COLLECTION_PATHS_RELEASE_TOOLCHAIN_INCLUDE'}, + {"-D$" => 'COLLECTION_DEFINES_RELEASE_AND_VENDOR'}, + "-DGNU_COMPILER", + {"$" => 'RELEASE_COMPILER_ARGUMENTS'}, + "-c \"${1}\"", + "-o \"${2}\"", + ] + } + +DEFAULT_RELEASE_ASSEMBLER_TOOL = { + :executable => FilePathUtils.os_executable_ext('as'), + :name => 'default_release_assembler', + :stderr_redirect => StdErrRedirect::NONE, + :arguments => [ + {"-I\"$\"" => 'COLLECTION_PATHS_SOURCE_AND_INCLUDE'}, + {"$" => 'RELEASE_ASSEMBLER_ARGUMENTS'}, + "\"${1}\"", + "-o \"${2}\"", + ] + } + +DEFAULT_RELEASE_LINKER_TOOL = { + :executable => FilePathUtils.os_executable_ext('gcc'), + :name => 'default_release_linker', + :stderr_redirect => StdErrRedirect::NONE, + :arguments => [ + {"$" => 'RELEASE_LINKER_ARGUMENTS'}, + "\"${1}\"", + "-o \"${2}\"", + ] + } + + +DEFAULT_TOOLS_TEST = { + :tools => { + :test_compiler => DEFAULT_TEST_COMPILER_TOOL, + :test_linker => DEFAULT_TEST_LINKER_TOOL, + :test_fixture => DEFAULT_TEST_FIXTURE_TOOL, + } + } + +DEFAULT_TOOLS_TEST_PREPROCESSORS = { + :tools => { + :test_includes_preprocessor => DEFAULT_TEST_INCLUDES_PREPROCESSOR_TOOL, + :test_file_preprocessor => DEFAULT_TEST_FILE_PREPROCESSOR_TOOL, + } + } + +DEFAULT_TOOLS_TEST_DEPENDENCIES = { + :tools => { + :test_dependencies_generator => DEFAULT_TEST_DEPENDENCIES_GENERATOR_TOOL, + } + } + + +DEFAULT_TOOLS_RELEASE = { + :tools => { + :release_compiler => DEFAULT_RELEASE_COMPILER_TOOL, + :release_linker => DEFAULT_RELEASE_LINKER_TOOL, + } + } + +DEFAULT_TOOLS_RELEASE_ASSEMBLER = { + :tools => { + :release_assembler => DEFAULT_RELEASE_ASSEMBLER_TOOL, + } + } + +DEFAULT_TOOLS_RELEASE_DEPENDENCIES = { + :tools => { + :release_dependencies_generator => DEFAULT_RELEASE_DEPENDENCIES_GENERATOR_TOOL, + } + } + + +DEFAULT_RELEASE_TARGET_NAME = 'project' + +DEFAULT_CEEDLING_CONFIG = { + :project => { + # :build_root must be set by user + :use_exceptions => true, + :use_mocks => true, + :use_test_preprocessor => false, + :use_auxiliary_dependencies => false, + :test_file_prefix => 'test_', + :options_paths => [], + :release_build => false, + }, + + :release_build => { + # :output is set while building configuration -- allows smart default system-dependent file extension handling + :use_assembly => false, + }, + + :paths => { + :test => [], # must be populated by user + :source => [], # must be populated by user + :support => [], + :include => [], + :test_toolchain_include => [], + :release_toolchain_include => [], + }, + + # unlike other top-level entries, environment's value is an array to preserve order + :environment => [ + # when evaluated, this provides wider text field for rake task comments + {:rake_columns => '120'}, + ], + + :defines => { + :test => [], + :test_preprocess => [], + :release => [], + :release_preprocess => [], + }, + + :extension => { + :header => '.h', + :source => '.c', + :assembly => '.s', + :object => '.o', + :executable => ( SystemWrapper.is_windows? ? '.exe' : '.out' ), + :testpass => '.pass', + :testfail => '.fail', + :dependencies => '.d', + }, + + :unity => { + :defines => [] + }, + + :cmock => { + :defines => [] + }, + + :cexception => { + :defines => [] + }, + + :test_runner => { + :includes => [], + :file_suffix => '_runner', + }, + + # all tools populated while building up config structure + :tools => {}, + + # empty argument lists for default tools + # (these can be overridden in project file to add arguments to tools without totally redefining tools) + :test_compiler => { :arguments => [] }, + :test_linker => { :arguments => [] }, + :test_fixture => { + :arguments => [], + :link_objects => [], # compiled object files to always be linked in (e.g. cmock.o if using mocks) + }, + :test_includes_preprocessor => { :arguments => [] }, + :test_file_preprocessor => { :arguments => [] }, + :test_dependencies_generator => { :arguments => [] }, + :release_compiler => { :arguments => [] }, + :release_linker => { :arguments => [] }, + :release_assembler => { :arguments => [] }, + :release_dependencies_generator => { :arguments => [] }, + + :plugins => { + :load_paths => [], + :enabled => [], + } + } + + +DEFAULT_TESTS_RESULTS_REPORT_TEMPLATE = %q{ +% ignored = hash[:results][:counts][:ignored] +% failed = hash[:results][:counts][:failed] +% stdout_count = hash[:results][:counts][:stdout] +% header_prepend = ((hash[:header].length > 0) ? "#{hash[:header]}: " : '') +% banner_width = 25 + header_prepend.length # widest message + +% if (ignored > 0) +<%=@ceedling[:plugin_reportinator].generate_banner(header_prepend + 'IGNORED UNIT TEST SUMMARY')%> +% hash[:results][:ignores].each do |ignore| +% ignore[:collection].each do |item| +<%=ignore[:source][:path]%><%=File::SEPARATOR%><%=ignore[:source][:file]%>:<%=item[:line]%>:<%=item[:test]%> +% if (item[:message].length > 0) +: "<%=item[:message]%>" +% else +<%="\n"%> +% end +% end +% end + +% end +% if (failed > 0) +<%=@ceedling[:plugin_reportinator].generate_banner(header_prepend + 'FAILED UNIT TEST SUMMARY')%> +% hash[:results][:failures].each do |failure| +% failure[:collection].each do |item| +<%=failure[:source][:path]%><%=File::SEPARATOR%><%=failure[:source][:file]%>:<%=item[:line]%>:<%=item[:test]%> +% if (item[:message].length > 0) +: "<%=item[:message]%>" +% else +<%="\n"%> +% end +% end +% end + +% end +% if (stdout_count > 0) +<%=@ceedling[:plugin_reportinator].generate_banner(header_prepend + 'UNIT TEST OTHER OUTPUT')%> +% hash[:results][:stdout].each do |string| +% string[:collection].each do |item| +<%=string[:source][:path]%><%=File::SEPARATOR%><%=string[:source][:file]%>: "<%=item%>" +% end +% end + +% end +% total_string = hash[:results][:counts][:total].to_s +% format_string = "%#{total_string.length}i" +<%=@ceedling[:plugin_reportinator].generate_banner(header_prepend + 'OVERALL UNIT TEST SUMMARY')%> +% if (hash[:results][:counts][:total] > 0) +TESTED: <%=hash[:results][:counts][:total].to_s%> +PASSED: <%=sprintf(format_string, hash[:results][:counts][:passed])%> +FAILED: <%=sprintf(format_string, failed)%> +IGNORED: <%=sprintf(format_string, ignored)%> +% else + +No tests executed. +% end + +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/dependinator.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/dependinator.rb new file mode 100644 index 0000000..061caee --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/dependinator.rb @@ -0,0 +1,92 @@ + +class Dependinator + + constructor :configurator, :project_config_manager, :test_includes_extractor, :file_path_utils, :rake_wrapper, :file_wrapper + + def touch_force_rebuild_files + @file_wrapper.touch( @configurator.project_test_force_rebuild_filepath ) + @file_wrapper.touch( @configurator.project_release_force_rebuild_filepath ) if (@configurator.project_release_build) + end + + + + def load_release_object_deep_dependencies(dependencies_list) + dependencies_list.each { |dependencies_file| @rake_wrapper.load_dependencies( dependencies_file ) } + end + + + def enhance_release_file_dependencies(files) + files.each do |filepath| + @rake_wrapper[filepath].enhance( [@configurator.project_release_force_rebuild_filepath] ) if (@project_config_manager.release_config_changed) + @rake_wrapper[filepath].enhance( [@configurator.ceedling_build_info_filepath] ) + end + end + + + + def load_test_object_deep_dependencies(files_list) + dependencies_list = @file_path_utils.form_test_dependencies_filelist(files_list) + dependencies_list.each { |dependencies_file| @rake_wrapper.load_dependencies(dependencies_file) } + end + + + def enhance_runner_dependencies(runner_filepath) + @rake_wrapper[runner_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed) + @rake_wrapper[runner_filepath].enhance( [@configurator.ceedling_build_info_filepath] ) + end + + + def enhance_shallow_include_lists_dependencies(include_lists) + include_lists.each do |include_list_filepath| + @rake_wrapper[include_list_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed) + @rake_wrapper[include_list_filepath].enhance( [@configurator.ceedling_build_info_filepath] ) + end + end + + + def enhance_preprocesed_file_dependencies(files) + files.each do |filepath| + @rake_wrapper[filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed) + @rake_wrapper[filepath].enhance( [@configurator.ceedling_build_info_filepath] ) + end + end + + + def enhance_mock_dependencies(mocks_list) + # if input configuration or ceedling changes, make sure these guys get rebuilt + mocks_list.each do |mock_filepath| + @rake_wrapper[mock_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed) + @rake_wrapper[mock_filepath].enhance( [@configurator.cmock_unity_helper] ) if (@configurator.cmock_unity_helper) + @rake_wrapper[mock_filepath].enhance( [@configurator.ceedling_build_info_filepath] ) + @rake_wrapper[mock_filepath].enhance( [@configurator.cmock_build_info_filepath] ) + end + end + + + def enhance_dependencies_dependencies(dependencies) + dependencies.each do |dependencies_filepath| + @rake_wrapper[dependencies_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed) + @rake_wrapper[dependencies_filepath].enhance( [@configurator.ceedling_build_info_filepath] ) + end + end + + + def enhance_test_build_object_dependencies(objects) + objects.each do |object_filepath| + @rake_wrapper[object_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed) + @rake_wrapper[object_filepath].enhance( [@configurator.ceedling_build_info_filepath] ) + end + end + + + def enhance_results_dependencies(result_filepath) + @rake_wrapper[result_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed) + @rake_wrapper[result_filepath].enhance( [@configurator.ceedling_build_info_filepath] ) + end + + + def setup_test_executable_dependencies(test, objects) + @rake_wrapper.create_file_task( @file_path_utils.form_test_executable_filepath(test), objects) + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/file_finder.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/file_finder.rb new file mode 100644 index 0000000..752d6bd --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/file_finder.rb @@ -0,0 +1,132 @@ +require 'rubygems' +require 'rake' # for adding ext() method to string + +class FileFinder + + constructor :configurator, :file_finder_helper, :cacheinator, :file_path_utils, :file_wrapper, :yaml_wrapper + + def prepare_search_sources + @all_test_source_and_header_file_collection = + @configurator.collection_all_tests + + @configurator.collection_all_source + + @configurator.collection_all_headers + end + + + def find_header_file(mock_file) + header = File.basename(mock_file).sub(/#{@configurator.cmock_mock_prefix}/, '').ext(@configurator.extension_header) + + found_path = @file_finder_helper.find_file_in_collection(header, @configurator.collection_all_headers, :error) + + return found_path + end + + + def find_header_input_for_mock_file(mock_file) + found_path = find_header_file(mock_file) + mock_input = found_path + + if (@configurator.project_use_test_preprocessor) + mock_input = @cacheinator.diff_cached_test_file( @file_path_utils.form_preprocessed_file_filepath( found_path ) ) + end + + return mock_input + end + + + def find_source_from_test(test, complain) + test_prefix = @configurator.project_test_file_prefix + source_paths = @configurator.collection_all_source + + source = File.basename(test).sub(/#{test_prefix}/, '') + + # we don't blow up if a test file has no corresponding source file + return @file_finder_helper.find_file_in_collection(source, source_paths, complain) + end + + + def find_test_from_runner_path(runner_path) + extension_source = @configurator.extension_source + + test_file = File.basename(runner_path).sub(/#{@configurator.test_runner_file_suffix}#{'\\'+extension_source}/, extension_source) + + found_path = @file_finder_helper.find_file_in_collection(test_file, @configurator.collection_all_tests, :error) + + return found_path + end + + + def find_test_input_for_runner_file(runner_path) + found_path = find_test_from_runner_path(runner_path) + runner_input = found_path + + if (@configurator.project_use_test_preprocessor) + runner_input = @cacheinator.diff_cached_test_file( @file_path_utils.form_preprocessed_file_filepath( found_path ) ) + end + + return runner_input + end + + + def find_test_from_file_path(file_path) + test_file = File.basename(file_path).ext(@configurator.extension_source) + + found_path = @file_finder_helper.find_file_in_collection(test_file, @configurator.collection_all_tests, :error) + + return found_path + end + + + def find_test_or_source_or_header_file(file_path) + file = File.basename(file_path) + return @file_finder_helper.find_file_in_collection(file, @all_test_source_and_header_file_collection, :error) + end + + + def find_compilation_input_file(file_path) + found_file = '' + + source_file = File.basename(file_path).ext(@configurator.extension_source) + + # We only collect files that already exist when we start up. + # FileLists can produce undesired results for dynamically generated files depending on when they're accessed. + # So collect mocks and runners separately and right now. + if (source_file =~ /#{@configurator.test_runner_file_suffix}/) + found_file = + @file_finder_helper.find_file_in_collection( + source_file, + @file_wrapper.directory_listing( File.join(@configurator.project_test_runners_path, '*') ), + :error) + + elsif (@configurator.project_use_mocks and (source_file =~ /#{@configurator.cmock_mock_prefix}/)) + found_file = + @file_finder_helper.find_file_in_collection( + source_file, + @file_wrapper.directory_listing( File.join(@configurator.cmock_mock_path, '*') ), + :error) + + else + found_file = + @file_finder_helper.find_file_in_collection( + source_file, + @configurator.collection_all_existing_compilation_input, + :error) + end + + return found_file + end + + + def find_source_file(file_path, complain) + source_file = File.basename(file_path).ext(@configurator.extension_source) + return @file_finder_helper.find_file_in_collection(source_file, @configurator.collection_all_source, complain) + end + + + def find_assembly_file(file_path) + assembly_file = File.basename(file_path).ext(@configurator.extension_assembly) + return @file_finder_helper.find_file_in_collection(assembly_file, @configurator.collection_all_assembly, :error) + end + +end + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/file_finder_helper.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/file_finder_helper.rb new file mode 100644 index 0000000..487f0fe --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/file_finder_helper.rb @@ -0,0 +1,54 @@ +require 'fileutils' +require 'constants' # for Verbosity enumeration + +class FileFinderHelper + + constructor :streaminator + + + def find_file_in_collection(file_name, file_list, complain, extra_message="") + file_to_find = nil + + file_list.each do |item| + base_file = File.basename(item) + + # case insensitive comparison + if (base_file.casecmp(file_name) == 0) + # case sensitive check + if (base_file == file_name) + file_to_find = item + break + else + blow_up(file_name, "However, a filename having different capitalization was found: '#{item}'.") + end + end + + end + + case (complain) + when :error then blow_up(file_name, extra_message) if (file_to_find.nil?) + when :warn then gripe(file_name, extra_message) if (file_to_find.nil?) + #when :ignore then + end + + return file_to_find + end + + private + + def blow_up(file_name, extra_message="") + error = "ERROR: Found no file '#{file_name}' in search paths." + error += ' ' if (extra_message.length > 0) + @streaminator.stderr_puts(error + extra_message, Verbosity::ERRORS) + raise + end + + def gripe(file_name, extra_message="") + warning = "WARNING: Found no file '#{file_name}' in search paths." + warning += ' ' if (extra_message.length > 0) + @streaminator.stderr_puts(warning + extra_message, Verbosity::COMPLAIN) + end + +end + + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/file_path_utils.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/file_path_utils.rb new file mode 100644 index 0000000..cb029f9 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/file_path_utils.rb @@ -0,0 +1,177 @@ +require 'rubygems' +require 'rake' # for ext() +require 'fileutils' +require 'system_wrapper' + +# global utility methods (for plugins, project files, etc.) +def ceedling_form_filepath(destination_path, original_filepath, new_extension=nil) + filename = File.basename(original_filepath) + filename.replace(filename.ext(new_extension)) if (!new_extension.nil?) + return File.join( destination_path.gsub(/\\/, '/'), filename ) +end + +class FilePathUtils + + GLOB_MATCHER = /[\*\?\{\}\[\]]/ + + constructor :configurator, :file_wrapper + + + ######### class methods ########## + + # standardize path to use '/' path separator & begin with './' & have no trailing path separator + def self.standardize(path) + path.strip! + path.gsub!(/\\/, '/') + path.gsub!(/^((\+|-):)?\.\//, '') + path.chomp!('/') + return path + end + + def self.os_executable_ext(executable) + return executable.ext('.exe') if SystemWrapper.is_windows? + return executable + end + + # extract directory path from between optional add/subtract aggregation modifiers and up to glob specifiers + # note: slightly different than File.dirname in that /files/foo remains /files/foo and does not become /files + def self.extract_path(path) + path = path.sub(/^(\+|-):/, '') + + # find first occurrence of path separator followed by directory glob specifier: *, ?, {, }, [, ] + find_index = (path =~ GLOB_MATCHER) + + # no changes needed (lop off final path separator) + return path.chomp('/') if (find_index.nil?) + + # extract up to first glob specifier + path = path[0..(find_index-1)] + + # lop off everything up to and including final path separator + find_index = path.rindex('/') + return path[0..(find_index-1)] if (not find_index.nil?) + + # return string up to first glob specifier if no path separator found + return path + end + + # return whether the given path is to be aggregated (no aggregation modifier defaults to same as +:) + def self.add_path?(path) + return (path =~ /^-:/).nil? + end + + # get path (and glob) lopping off optional +: / -: prefixed aggregation modifiers + def self.extract_path_no_aggregation_operators(path) + return path.sub(/^(\+|-):/, '') + end + + # all the globs that may be in a path string work fine with one exception; + # to recurse through all subdirectories, the glob is dir/**/** but our paths use + # convention of only dir/** + def self.reform_glob(path) + return path if (path =~ /\/\*\*$/).nil? + return path + '/**' + end + + def self.form_ceedling_vendor_path(*filepaths) + return File.join( CEEDLING_VENDOR, filepaths ) + end + + ######### instance methods ########## + + def form_temp_path(filepath, prefix='') + return File.join( @configurator.project_temp_path, prefix + File.basename(filepath) ) + end + + ### release ### + def form_release_build_cache_path(filepath) + return File.join( @configurator.project_release_build_cache_path, File.basename(filepath) ) + end + + def form_release_dependencies_filepath(filepath) + return File.join( @configurator.project_release_dependencies_path, File.basename(filepath).ext(@configurator.extension_dependencies) ) + end + + def form_release_build_c_object_filepath(filepath) + return File.join( @configurator.project_release_build_output_c_path, File.basename(filepath).ext(@configurator.extension_object) ) + end + + def form_release_build_asm_object_filepath(filepath) + return File.join( @configurator.project_release_build_output_asm_path, File.basename(filepath).ext(@configurator.extension_object) ) + end + + def form_release_build_c_objects_filelist(files) + return (@file_wrapper.instantiate_file_list(files)).pathmap("#{@configurator.project_release_build_output_c_path}/%n#{@configurator.extension_object}") + end + + def form_release_build_asm_objects_filelist(files) + return (@file_wrapper.instantiate_file_list(files)).pathmap("#{@configurator.project_release_build_output_asm_path}/%n#{@configurator.extension_object}") + end + + def form_release_dependencies_filelist(files) + return (@file_wrapper.instantiate_file_list(files)).pathmap("#{@configurator.project_release_dependencies_path}/%n#{@configurator.extension_dependencies}") + end + + ### tests ### + def form_test_build_cache_path(filepath) + return File.join( @configurator.project_test_build_cache_path, File.basename(filepath) ) + end + + def form_pass_results_filepath(filepath) + return File.join( @configurator.project_test_results_path, File.basename(filepath).ext(@configurator.extension_testpass) ) + end + + def form_fail_results_filepath(filepath) + return File.join( @configurator.project_test_results_path, File.basename(filepath).ext(@configurator.extension_testfail) ) + end + + def form_runner_filepath_from_test(filepath) + return File.join( @configurator.project_test_runners_path, File.basename(filepath, @configurator.extension_source)) + @configurator.test_runner_file_suffix + @configurator.extension_source + end + + def form_test_filepath_from_runner(filepath) + return filepath.sub(/#{TEST_RUNNER_FILE_SUFFIX}/, '') + end + + def form_runner_object_filepath_from_test(filepath) + return (form_test_build_object_filepath(filepath)).sub(/(#{@configurator.extension_object})$/, "#{@configurator.test_runner_file_suffix}\\1") + end + + def form_test_build_object_filepath(filepath) + return File.join( @configurator.project_test_build_output_path, File.basename(filepath).ext(@configurator.extension_object) ) + end + + def form_test_executable_filepath(filepath) + return File.join( @configurator.project_test_build_output_path, File.basename(filepath).ext(@configurator.extension_executable) ) + end + + def form_preprocessed_file_filepath(filepath) + return File.join( @configurator.project_test_preprocess_files_path, File.basename(filepath) ) + end + + def form_preprocessed_includes_list_filepath(filepath) + return File.join( @configurator.project_test_preprocess_includes_path, File.basename(filepath) ) + end + + def form_test_build_objects_filelist(sources) + return (@file_wrapper.instantiate_file_list(sources)).pathmap("#{@configurator.project_test_build_output_path}/%n#{@configurator.extension_object}") + end + + def form_preprocessed_mockable_headers_filelist(mocks) + # pathmapping note: "%{#{@configurator.cmock_mock_prefix},}n" replaces mock_prefix with nothing (signified by absence of anything after comma inside replacement brackets) + return (@file_wrapper.instantiate_file_list(mocks)).pathmap("#{@configurator.project_test_preprocess_files_path}/%{#{@configurator.cmock_mock_prefix},}n#{@configurator.extension_header}") + end + + def form_mocks_source_filelist(mocks) + return (@file_wrapper.instantiate_file_list(mocks)).pathmap("#{@configurator.cmock_mock_path}/%n#{@configurator.extension_source}") + end + + def form_test_dependencies_filelist(files) + return (@file_wrapper.instantiate_file_list(files)).pathmap("#{@configurator.project_test_dependencies_path}/%n#{@configurator.extension_dependencies}") + end + + def form_pass_results_filelist(path, files) + return (@file_wrapper.instantiate_file_list(files)).pathmap("#{path}/%n#{@configurator.extension_testpass}") + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/file_system_utils.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/file_system_utils.rb new file mode 100644 index 0000000..2c286ca --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/file_system_utils.rb @@ -0,0 +1,59 @@ +require 'rubygems' +require 'rake' +require 'set' +require 'fileutils' +require 'file_path_utils.rb' + + +class FileSystemUtils + + constructor :file_wrapper + + # build up path list from input of one or more strings or arrays of (+/-) paths & globs + def collect_paths(*paths) + raw = [] # all paths and globs + plus = Set.new # all paths to expand and add + minus = Set.new # all paths to remove from plus set + + # assemble all globs and simple paths, reforming our glob notation to ruby globs + paths.each do |paths_container| + case (paths_container) + when String then raw << (FilePathUtils::reform_glob(paths_container)) + when Array then paths_container.each {|path| raw << (FilePathUtils::reform_glob(path))} + else raise "Don't know how to handle #{paths_container.class}" + end + end + + # iterate through each path and glob + raw.each do |path| + + dirs = [] # container for only (expanded) paths + + # if a glob, expand it and slurp up all non-file paths + if path.include?('*') + # grab base directory only if globs are snug up to final path separator + if (path =~ /\/\*+$/) + dirs << FilePathUtils.extract_path(path) + end + + # grab expanded sub-directory globs + expanded = @file_wrapper.directory_listing( FilePathUtils.extract_path_no_aggregation_operators(path) ) + expanded.each do |entry| + dirs << entry if @file_wrapper.directory?(entry) + end + + # else just grab simple path + # note: we could just run this through glob expansion but such an + # approach doesn't handle a path not yet on disk) + else + dirs << FilePathUtils.extract_path_no_aggregation_operators(path) + end + + # add dirs to the appropriate set based on path aggregation modifier if present + FilePathUtils.add_path?(path) ? plus.merge(dirs) : minus.merge(dirs) + end + + return (plus - minus).to_a.uniq + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/file_wrapper.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/file_wrapper.rb new file mode 100644 index 0000000..04e1007 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/file_wrapper.rb @@ -0,0 +1,74 @@ +require 'rubygems' +require 'rake' # for FileList +require 'constants' +require 'fileutils' + + +class FileWrapper + + def get_expanded_path(path) + return File.expand_path(path) + end + + def exist?(filepath) + return true if (filepath == NULL_FILE_PATH) + return File.exist?(filepath) + end + + def directory?(path) + return File.directory?(path) + end + + def dirname(path) + return File.dirname(path) + end + + def directory_listing(glob) + return Dir.glob(glob) + end + + def rm_f(filepath, options={}) + FileUtils.rm_f(filepath, options) + end + + def rm_r(filepath, options={}) + FileUtils.rm_r(filepath, options={}) + end + + def cp(source, destination, options={}) + FileUtils.cp(source, destination, options) + end + + def compare(from, to) + return FileUtils.compare_file(from, to) + end + + def open(filepath, flags) + File.open(filepath, flags) do |file| + yield(file) + end + end + + def read(filepath) + return File.read(filepath) + end + + def touch(filepath, options={}) + FileUtils.touch(filepath, options) + end + + def write(filepath, contents, flags='w') + File.open(filepath, flags) do |file| + file.write(contents) + end + end + + def readlines(filepath) + return File.readlines(filepath) + end + + def instantiate_file_list(files=[]) + return FileList.new(files) + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/generator.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/generator.rb new file mode 100644 index 0000000..f620ee4 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/generator.rb @@ -0,0 +1,131 @@ +require 'constants' # for Verbosity constants class + + +class Generator + + constructor :configurator, :preprocessinator, :cmock_builder, :generator_test_runner, :generator_test_results, :test_includes_extractor, :tool_executor, :file_finder, :file_path_utils, :streaminator, :plugin_manager, :file_wrapper + + + def generate_shallow_includes_list(context, file) + @preprocessinator.preprocess_shallow_includes(file) + end + + def generate_preprocessed_file(context, file) + @streaminator.stdout_puts("Preprocessing #{File.basename(file)}...", Verbosity::NORMAL) + @preprocessinator.preprocess_file(file) + end + + def generate_dependencies_file(tool, context, source, object, dependencies) + @streaminator.stdout_puts("Generating dependencies for #{File.basename(source)}...", Verbosity::NORMAL) + + command_line = + @tool_executor.build_command_line( + tool, + source, + dependencies, + object) + + @tool_executor.exec(command_line) + end + + def generate_mock(context, header_filepath) + arg_hash = {:header_file => header_filepath, :context => context} + @plugin_manager.pre_mock_execute(arg_hash) + + @cmock_builder.cmock.setup_mocks( arg_hash[:header_file] ) + + @plugin_manager.post_mock_execute(arg_hash) + end + + # test_filepath may be either preprocessed test file or original test file + def generate_test_runner(context, test_filepath, runner_filepath) + arg_hash = {:context => context, :test_file => test_filepath, :runner_file => runner_filepath} + + @plugin_manager.pre_runner_execute(arg_hash) + + # collect info we need + module_name = File.basename(arg_hash[:test_file]) + test_cases = @generator_test_runner.find_test_cases( @file_finder.find_test_from_runner_path(runner_filepath) ) + mock_list = @test_includes_extractor.lookup_raw_mock_list(arg_hash[:test_file]) + + @streaminator.stdout_puts("Generating runner for #{module_name}...", Verbosity::NORMAL) + + # build runner file + @file_wrapper.open(runner_filepath, 'w') do |output| + @generator_test_runner.create_header(output, mock_list) + @generator_test_runner.create_externs(output, test_cases) + @generator_test_runner.create_mock_management(output, mock_list) + @generator_test_runner.create_runtest(output, mock_list, test_cases) + @generator_test_runner.create_main(output, module_name, test_cases) + end + + @plugin_manager.post_runner_execute(arg_hash) + end + + def generate_object_file(tool, context, source, object) + arg_hash = {:tool => tool, :context => context, :source => source, :object => object} + @plugin_manager.pre_compile_execute(arg_hash) + + @streaminator.stdout_puts("Compiling #{File.basename(arg_hash[:source])}...", Verbosity::NORMAL) + shell_result = @tool_executor.exec( @tool_executor.build_command_line(arg_hash[:tool], arg_hash[:source], arg_hash[:object]) ) + + arg_hash[:shell_result] = shell_result + @plugin_manager.post_compile_execute(arg_hash) + end + + def generate_executable_file(tool, context, objects, executable) + shell_result = {} + arg_hash = {:tool => tool, :context => context, :objects => objects, :executable => executable} + @plugin_manager.pre_link_execute(arg_hash) + + @streaminator.stdout_puts("Linking #{File.basename(arg_hash[:executable])}...", Verbosity::NORMAL) + + begin + shell_result = @tool_executor.exec( @tool_executor.build_command_line(arg_hash[:tool], arg_hash[:objects], arg_hash[:executable]) ) + rescue + notice = "\n" + + "NOTICE: If the linker reports missing symbols, the following may be to blame:\n" + + " 1. Test lacks #include statements corresponding to needed source files.\n" + + " 2. Project search paths do not contain source files corresponding to #include statements in the test.\n" + + if (@configurator.project_use_mocks) + notice += " 3. Test does not #include needed mocks.\n\n" + else + notice += "\n" + end + + @streaminator.stderr_puts(notice, Verbosity::COMPLAIN) + raise + end + + arg_hash[:shell_result] = shell_result + @plugin_manager.post_link_execute(arg_hash) + end + + def generate_test_results(tool, context, executable, result) + arg_hash = {:tool => tool, :context => context, :executable => executable, :result_file => result} + @plugin_manager.pre_test_execute(arg_hash) + + @streaminator.stdout_puts("Running #{File.basename(arg_hash[:executable])}...", Verbosity::NORMAL) + + # Unity's exit code is equivalent to the number of failed tests, so we tell @tool_executor not to fail out if there are failures + # so that we can run all tests and collect all results + shell_result = @tool_executor.exec( @tool_executor.build_command_line(arg_hash[:tool], arg_hash[:executable]), [], {:boom => false} ) + + if (shell_result[:output].nil? or shell_result[:output].strip.empty?) + @streaminator.stderr_puts("ERROR: Test executable \"#{File.basename(executable)}\" did not produce any results.", Verbosity::ERRORS) + raise + end + + processed = @generator_test_results.process_and_write_results( shell_result, + arg_hash[:result_file], + @file_finder.find_test_from_file_path(arg_hash[:executable]) ) + + arg_hash[:result_file] = processed[:result_file] + arg_hash[:results] = processed[:results] + arg_hash[:shell_result] = shell_result # for raw output display if no plugins for formatted display + + @plugin_manager.post_test_execute(arg_hash) + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/generator_test_results.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/generator_test_results.rb new file mode 100644 index 0000000..3ac79e2 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/generator_test_results.rb @@ -0,0 +1,90 @@ +require 'rubygems' +require 'rake' # for .ext() +require 'constants' + + +class GeneratorTestResults + TEST_STATISTICS_REGEX = /-+\s+(\d+)\s+Tests\s+(\d+)\s+Failures\s+(\d+)\s+Ignored\s+(OK|FAIL)\s*/i + + constructor :configurator, :generator_test_results_sanity_checker, :yaml_wrapper + + def process_and_write_results(unity_shell_result, results_file, test_file) + output_file = results_file + + results = get_results_structure + + results[:source][:path] = File.dirname(test_file) + results[:source][:file] = File.basename(test_file) + + # process test statistics + if (unity_shell_result[:output] =~ TEST_STATISTICS_REGEX) + results[:counts][:total] = $1.to_i + results[:counts][:failed] = $2.to_i + results[:counts][:ignored] = $3.to_i + results[:counts][:passed] = (results[:counts][:total] - results[:counts][:failed] - results[:counts][:ignored]) + end + + # remove test statistics lines + unity_shell_result[:output].sub!(TEST_STATISTICS_REGEX, '') + + # bust up the output into individual lines + raw_unity_lines = unity_shell_result[:output].split(/\n|\r\n/) + + raw_unity_lines.each do |line| + # process unity output + case line + when /(:IGNORE)/ + elements = extract_line_elements(line, results[:source][:file]) + results[:ignores] << elements[0] + results[:stdout] << elements[1] if (!elements[1].nil?) + when /(:PASS$)/ + elements = extract_line_elements(line, results[:source][:file]) + results[:successes] << elements[0] + results[:stdout] << elements[1] if (!elements[1].nil?) + when /(:FAIL)/ + elements = extract_line_elements(line, results[:source][:file]) + results[:failures] << elements[0] + results[:stdout] << elements[1] if (!elements[1].nil?) + else # collect up all other + results[:stdout] << line.chomp + end + end + + @generator_test_results_sanity_checker.verify(results, unity_shell_result[:exit_code]) + + output_file = results_file.ext(@configurator.extension_testfail) if (results[:counts][:failed] > 0) + + @yaml_wrapper.dump(output_file, results) + + return { :result_file => output_file, :result => results } + end + + private + + def get_results_structure + return { + :source => {:path => '', :file => ''}, + :successes => [], + :failures => [], + :ignores => [], + :counts => {:total => 0, :passed => 0, :failed => 0, :ignored => 0}, + :stdout => [], + } + end + + def extract_line_elements(line, filename) + # handle anything preceding filename in line as extra output to be collected + stdout = nil + stdout_regex = /(.+)#{Regexp.escape(filename)}.+/i + + if (line =~ stdout_regex) + stdout = $1.clone + line.sub!(/#{Regexp.escape(stdout)}/, '') + end + + # collect up test results minus and extra output + elements = (line.strip.split(':'))[1..-1] + return {:test => elements[1], :line => elements[0].to_i, :message => (elements[3..-1].join(':')).strip}, stdout + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/generator_test_results_sanity_checker.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/generator_test_results_sanity_checker.rb new file mode 100644 index 0000000..9f1b65c --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/generator_test_results_sanity_checker.rb @@ -0,0 +1,62 @@ +require 'constants' +require 'rubygems' +require 'rake' # for ext() method + + +class GeneratorTestResultsSanityChecker + + constructor :configurator, :streaminator + + def verify(results, unity_exit_code) + + # do no sanity checking if it's disabled + return if (@configurator.sanity_checks == TestResultsSanityChecks::NONE) + + ceedling_ignores_count = results[:ignores].size + ceedling_failures_count = results[:failures].size + ceedling_tests_summation = (ceedling_ignores_count + ceedling_failures_count + results[:successes].size) + + # Exit code handling is not a sanity check that can always be performed because + # command line simulators may or may not pass through Unity's exit code + if (@configurator.sanity_checks >= TestResultsSanityChecks::THOROUGH) + # many platforms limit exit codes to a maximum of 255 + if ((ceedling_failures_count != unity_exit_code) and (unity_exit_code < 255)) + sanity_check_warning(results[:source][:file], "Unity's exit code (#{unity_exit_code}) does not match Ceedling's summation of failed test cases (#{ceedling_failures_count}).") + end + + if ((ceedling_failures_count < 255) and (unity_exit_code == 255)) + sanity_check_warning(results[:source][:file], "Ceedling's summation of failed test cases (#{ceedling_failures_count}) is less than Unity's exit code (255 or more).") + end + end + + if (ceedling_ignores_count != results[:counts][:ignored]) + sanity_check_warning(results[:source][:file], "Unity's final ignore count (#{results[:counts][:ignored]}) does not match Ceedling's summation of ignored test cases (#{ceedling_ignores_count}).") + end + + if (ceedling_failures_count != results[:counts][:failed]) + sanity_check_warning(results[:source][:file], "Unity's final fail count (#{results[:counts][:failed]}) does not match Ceedling's summation of failed test cases (#{ceedling_failures_count}).") + end + + if (ceedling_tests_summation != results[:counts][:total]) + sanity_check_warning(results[:source][:file], "Unity's final test count (#{results[:counts][:total]}) does not match Ceedling's summation of all test cases (#{ceedling_tests_summation}).") + end + + end + + private + + def sanity_check_warning(file, message) + notice = "\n" + + "ERROR: Internal sanity check for test fixture '#{file.ext(@configurator.extension_executable)}' finds that #{message}\n" + + " Possible causes:\n" + + " 1. Your test + source dereferenced a null pointer.\n" + + " 2. Your test + source indexed past the end of a buffer.\n" + + " 3. Your test + source committed a memory access violation.\n" + + " 4. Your test fixture produced an exit code of 0 despite execution ending prematurely.\n" + + " Sanity check failures of test results are usually a symptom of interrupted test execution.\n\n" + + @streaminator.stderr_puts( notice ) + raise + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/generator_test_runner.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/generator_test_runner.rb new file mode 100644 index 0000000..361be61 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/generator_test_runner.rb @@ -0,0 +1,206 @@ + +class GeneratorTestRunner + + constructor :configurator, :file_path_utils, :file_wrapper + + + def find_test_cases(test_file) + tests = [] + tests_and_line_numbers = [] + lines = [] + + # if we don't have preprocessor assistance, do some basic preprocessing of our own + if (not @configurator.project_use_test_preprocessor) + source = @file_wrapper.read(test_file) + + # remove line comments + source = source.gsub(/\/\/.*$/, '') + # remove block comments + source = source.gsub(/\/\*.*?\*\//m, '') + + # treat preprocessor directives as a logical line + lines = source.split(/(^\s*\#.*$) | (;|\{|\}) /x) # match ;, {, and } as end of lines + # otherwise, read the preprocessed file raw + else + lines = @file_wrapper.read( @file_path_utils.form_preprocessed_file_filepath(test_file) ).split(/;|\{|\}/) + end + + # step 1. find test functions in (possibly preprocessed) file + # (note that lines are not broken up at end of lines) + lines.each do |line| + if (line =~ /^\s*void\s+((T|t)est.*)\s*\(\s*(void)?\s*\)/m) + tests << ($1.strip) + end + end + + # step 2. associate test functions with line numbers in (non-preprocessed) original file + # (note that this time we must scan file contents broken up by end of lines) + raw_lines = @file_wrapper.read(test_file).split("\n") + raw_index = 0 + + tests.each do |test| + raw_lines[raw_index..-1].each_with_index do |line, index| + # test function might be declared across lines; look for it by its name followed + # by a few tell-tale signs + if (line =~ /#{test}\s*($|\(|\()/) + raw_index += (index + 1) + tests_and_line_numbers << {:test => test, :line_number => raw_index} + break + end + end + end + + return tests_and_line_numbers + end + + + def create_header(output, mock_list) + output << "/* AUTOGENERATED FILE. DO NOT EDIT. */\n" + output << "#include \"unity.h\"\n" + + @configurator.test_runner_includes.each do |include| + output << "#include \"#{include}\"\n" + end + + output << "#include \n" + output << "#include \n" + + if (@configurator.project_use_exceptions == true) + output << "#include \"CException.h\"\n" + end + + unless (mock_list.empty?) + header_extension = @configurator.extension_header + mock_list.each do |mock| + output << "#include \"#{mock}#{header_extension}\"\n" + end + if (@configurator.cmock_enforce_strict_ordering == true) + output << "\n" + output << "int GlobalExpectCount;\n" + output << "int GlobalVerifyOrder;\n" + output << "char* GlobalOrderError;\n" + end + end + + output << "\n" + output << "char MessageBuffer[50];\n" + end + + + def create_externs(output, test_cases) + output << "\n" + output << "extern void setUp(void);\n" + output << "extern void tearDown(void);\n" + output << "\n" if not test_cases.empty? + + test_cases.each do |item| + output << "extern void #{item[:test]}(void);\n" + end + end + + + def create_mock_management(output, mock_list) + + unless (mock_list.empty?) + header_extension = @configurator.extension_header + + output << "\n" + output << "static void CMock_Init(void)\n" + output << "{\n" + + if (@configurator.cmock_enforce_strict_ordering == true) + output << " GlobalExpectCount = 0;\n" + output << " GlobalVerifyOrder = 0;\n" + output << " GlobalOrderError = NULL;\n" + end + + mock_list.each do |mock| + output << " #{mock.sub(/#{'\\'+header_extension}/, '')}_Init();\n" + end + output << "}\n" + output << "\n" + + output << "static void CMock_Verify(void)\n" + output << "{\n" + mock_list.each do |mock| + output << " #{mock.sub(/#{'\\'+header_extension}/, '')}_Verify();\n" + end + output << "}\n" + output << "\n" + + output << "static void CMock_Destroy(void)\n" + output << "{\n" + mock_list.each do |mock| + output << " #{mock.sub(/#{'\\'+header_extension}/, '')}_Destroy();\n" + end + output << "}\n" + output << "\n" + + output << "void CMock_VerifyAndReset(void)\n" + output << "{\n" + output << " CMock_Verify();\n" + output << " CMock_Destroy();\n" + output << " CMock_Init();\n" + output << "}\n" + output << "\n" + end + + end + + + def create_runtest(output, mock_list, test_cases) + + unless(test_cases.empty?) + use_exceptions = @configurator.project_use_exceptions + + tab = ' ' # default spacing + tab = ' ' if (use_exceptions) + + output << "\n" + output << "static void TestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum)\n" + output << "{\n" + output << " Unity.CurrentTestName = FuncName;\n" + output << " Unity.CurrentTestLineNumber = FuncLineNum;\n" + output << " Unity.NumberOfTests++;\n" + output << " if (TEST_PROTECT())\n" + output << " {\n" + output << " CEXCEPTION_T e;\n" if use_exceptions + output << " Try {\n" if use_exceptions + output << "#{tab}CMock_Init();\n" unless (mock_list.empty?) + output << "#{tab}setUp();\n" + output << "#{tab}Func();\n" + output << "#{tab}CMock_Verify();\n" unless (mock_list.empty?) + output << " } Catch(e) { TEST_FAIL_MESSAGE(\"Unhandled Exception!\"); }\n" if use_exceptions + output << " }\n" + output << " CMock_Destroy();\n" unless (mock_list.empty?) + output << " if (TEST_PROTECT() && !(Unity.CurrentTestIgnored))\n" + output << " {\n" + output << " tearDown();\n" + output << " }\n" + output << " UnityConcludeTest();\n" + output << "}\n" + end + + end + + + def create_main(output, module_name, test_cases) + output << "\n" + output << "int main(void)\n" + output << "{\n" + output << " UnityBegin();\n" + output << " Unity.TestFile = \"#{module_name}\";\n" + output << "\n" + + output << " // RUN_TEST calls runTest\n" unless (test_cases.empty?) + test_cases.each do |item| + output << " RUN_TEST(#{item[:test]}, #{item[:line_number]});\n" + end + + output << "\n" + output << " return UnityEnd();\n" + output << "}\n" + output << "\n" + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/loginator.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/loginator.rb new file mode 100644 index 0000000..92276e1 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/loginator.rb @@ -0,0 +1,31 @@ + +class Loginator + + constructor :configurator, :project_file_loader, :project_config_manager, :file_wrapper, :system_wrapper + + + def setup_log_filepath + config_files = [] + config_files << @project_file_loader.main_file + config_files << @project_file_loader.user_file + config_files.concat( @project_config_manager.options_files ) + config_files.compact! + config_files.map! { |file| file.ext('') } + + log_name = config_files.join( '_' ) + + @project_log_filepath = File.join( @configurator.project_log_path, log_name.ext('.log') ) + end + + + def log(string, heading=nil) + return if (not @configurator.project_logging) + + output = "\n[#{@system_wrapper.time_now}]" + output += " :: #{heading}" if (not heading.nil?) + output += "\n#{string.strip}\n" + + @file_wrapper.write(@project_log_filepath, output, 'a') + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/makefile.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/makefile.rb new file mode 100644 index 0000000..a1ff9bd --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/makefile.rb @@ -0,0 +1,44 @@ + +# modified version of Rake's provided make-style dependency loader +# customizations: (1) handles windows drives in paths -- colons don't confuse task demarcation (2) handles spaces in directory paths + +module Rake + + # Makefile loader to be used with the import file loader. + class MakefileLoader + + # Load the makefile dependencies in +fn+. + def load(fn) + open(fn) do |mf| + lines = mf.read + lines.gsub!(/#[^\n]*\n/m, "") # remove comments + lines.gsub!(/\\\n/, ' ') # string together line continuations into single line + lines.split("\n").each do |line| + process_line(line) + end + end + end + + private + + # Process one logical line of makefile data. + def process_line(line) + # split on presence of task demaractor followed by space (i.e don't get confused by a colon in a win path) + file_tasks, args = line.split(/:\s/) + + return if args.nil? + + # split at non-escaped space boundary between files (i.e. escaped spaces in paths are left alone) + dependents = args.split(/\b\s+/) + # replace escaped spaces and clean up any extra whitespace + dependents.map! { |path| path.gsub(/\\ /, ' ').strip } + + file_tasks.strip.split.each do |file_task| + file file_task => dependents + end + end + end + + # Install the handler + Rake.application.add_loader('mf', MakefileLoader.new) +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/objects.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/objects.yml new file mode 100644 index 0000000..95a6d9b --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/objects.yml @@ -0,0 +1,278 @@ + +file_wrapper: + +stream_wrapper: + +rake_wrapper: + +yaml_wrapper: + +system_wrapper: + +cmock_builder: + +reportinator: + +rake_utils: + compose: + - rake_wrapper + +file_path_utils: + compose: + - configurator + - file_wrapper + +file_system_utils: + compose: file_wrapper + +project_file_loader: + compose: + - yaml_wrapper + - stream_wrapper + - system_wrapper + - file_wrapper + +project_config_manager: + compose: + - cacheinator + - yaml_wrapper + +cacheinator: + compose: + - cacheinator_helper + - file_path_utils + - file_wrapper + - yaml_wrapper + +cacheinator_helper: + compose: + - file_wrapper + - yaml_wrapper + +tool_executor: + compose: + - configurator + - tool_executor_helper + - streaminator + - system_wrapper + +tool_executor_helper: + compose: + - streaminator + - system_wrapper + +configurator: + compose: + - configurator_setup + - configurator_plugins + - configurator_builder + - cmock_builder + - yaml_wrapper + - system_wrapper + +configurator_setup: + compose: + - configurator_builder + - configurator_validator + +configurator_plugins: + compose: + - stream_wrapper + - file_wrapper + - system_wrapper + +configurator_validator: + compose: + - file_wrapper + - stream_wrapper + - system_wrapper + +configurator_builder: + compose: + - file_system_utils + - file_wrapper + - system_wrapper + +loginator: + compose: + - configurator + - project_file_loader + - project_config_manager + - file_wrapper + - system_wrapper + +streaminator: + compose: + - streaminator_helper + - verbosinator + - loginator + - stream_wrapper + +streaminator_helper: + +setupinator: + +plugin_manager: + compose: + - configurator + - plugin_manager_helper + - streaminator + - reportinator + - system_wrapper + +plugin_manager_helper: + +plugin_reportinator: + compose: + - plugin_reportinator_helper + - plugin_manager + - reportinator + +plugin_reportinator_helper: + compose: + - configurator + - streaminator + - yaml_wrapper + - file_wrapper + +verbosinator: + compose: configurator + +file_finder: + compose: + - configurator + - file_finder_helper + - cacheinator + - file_path_utils + - file_wrapper + - yaml_wrapper + +file_finder_helper: + compose: streaminator + +test_includes_extractor: + compose: + - configurator + - yaml_wrapper + - file_wrapper + +task_invoker: + compose: + - dependinator + - rake_utils + - rake_wrapper + +generator: + compose: + - configurator + - preprocessinator + - cmock_builder + - generator_test_runner + - generator_test_results + - test_includes_extractor + - tool_executor + - file_finder + - file_path_utils + - streaminator + - plugin_manager + - file_wrapper + +generator_test_results: + compose: + - configurator + - generator_test_results_sanity_checker + - yaml_wrapper + +generator_test_results_sanity_checker: + compose: + - configurator + - streaminator + +generator_test_runner: + compose: + - configurator + - file_path_utils + - file_wrapper + +dependinator: + compose: + - configurator + - project_config_manager + - test_includes_extractor + - file_path_utils + - rake_wrapper + - file_wrapper + +preprocessinator: + compose: + - preprocessinator_helper + - preprocessinator_includes_handler + - preprocessinator_file_handler + - task_invoker + - file_path_utils + - yaml_wrapper + +preprocessinator_helper: + compose: + - configurator + - test_includes_extractor + - task_invoker + - file_finder + - file_path_utils + +preprocessinator_includes_handler: + compose: + - configurator + - tool_executor + - task_invoker + - file_path_utils + - yaml_wrapper + - file_wrapper + +preprocessinator_file_handler: + compose: + - preprocessinator_extractor + - configurator + - tool_executor + - file_path_utils + - file_wrapper + +preprocessinator_extractor: + compose: + - file_wrapper + +test_invoker: + compose: + - configurator + - test_invoker_helper + - streaminator + - preprocessinator + - task_invoker + - dependinator + - project_config_manager + - file_path_utils + +test_invoker_helper: + compose: + - configurator + - task_invoker + - dependinator + - test_includes_extractor + - file_finder + - file_path_utils + - streaminator + - file_wrapper + +release_invoker: + compose: + - release_invoker_helper + - configurator + - dependinator + - task_invoker + - file_path_utils + +release_invoker_helper: + compose: + - configurator + - dependinator + - task_invoker diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/plugin.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/plugin.rb new file mode 100644 index 0000000..a412555 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/plugin.rb @@ -0,0 +1,63 @@ + +class String + def left_margin(margin=0) + non_whitespace_column = 0 + new_lines = [] + + # find first line with non-whitespace and count left columns of whitespace + self.each_line do |line| + if (line =~ /^\s*\S/) + non_whitespace_column = $&.length - 1 + break + end + end + + # iterate through each line, chopping off leftmost whitespace columns and add back the desired whitespace margin + self.each_line do |line| + columns = [] + margin.times{columns << ' '} + # handle special case of line being narrower than width to be lopped off + if (non_whitespace_column < line.length) + new_lines << "#{columns.join}#{line[non_whitespace_column..-1]}" + else + new_lines << "\n" + end + end + + return new_lines.join + end +end + +class Plugin + attr_reader :name + + def initialize(system_objects, name) + @ceedling = system_objects + @name = name + self.setup + end + + def setup; end + + def pre_build; end + + def pre_mock_execute(arg_hash); end + def post_mock_execute(arg_hash); end + + def pre_runner_execute(arg_hash); end + def post_runner_execute(arg_hash); end + + def pre_compile_execute(arg_hash); end + def post_compile_execute(arg_hash); end + + def pre_link_execute(arg_hash); end + def post_link_execute(arg_hash); end + + def pre_test_execute(arg_hash); end + def post_test_execute(arg_hash); end + + def post_build; end + + def summary; end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/plugin_manager.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/plugin_manager.rb new file mode 100644 index 0000000..0ec22ec --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/plugin_manager.rb @@ -0,0 +1,85 @@ +require 'constants' +require 'set' + +class PluginManager + + constructor :configurator, :plugin_manager_helper, :streaminator, :reportinator, :system_wrapper + + def setup + @build_fail_registry = [] + @plugin_objects = [] # so we can preserve order + end + + def load_plugin_scripts(script_plugins, system_objects) + script_plugins.each do |plugin| + # protect against instantiating object multiple times due to processing config multiple times (options, etc) + next if (@plugin_manager_helper.include?(@plugin_objects, plugin)) + @system_wrapper.require_file( "#{plugin}.rb" ) + object = @plugin_manager_helper.instantiate_plugin_script( camelize(plugin), system_objects, plugin ) + @plugin_objects << object + + # add plugins to hash of all system objects + system_objects[plugin.downcase.to_sym] = object + end + end + + def plugins_failed? + return (@build_fail_registry.size > 0) + end + + def print_plugin_failures + if (@build_fail_registry.size > 0) + report = @reportinator.generate_banner('BUILD FAILURE SUMMARY') + + @build_fail_registry.each do |failure| + report += "#{' - ' if (@build_fail_registry.size > 1)}#{failure}\n" + end + + report += "\n" + + @streaminator.stderr_puts(report, Verbosity::ERRORS) + end + end + + def register_build_failure(message) + @build_fail_registry << message if (message and not message.empty?) + end + + #### execute all plugin methods #### + + def pre_build; execute_plugins(:pre_build); end + + def pre_mock_execute(arg_hash); execute_plugins(:pre_mock_execute, arg_hash); end + def post_mock_execute(arg_hash); execute_plugins(:post_mock_execute, arg_hash); end + + def pre_runner_execute(arg_hash); execute_plugins(:pre_runner_execute, arg_hash); end + def post_runner_execute(arg_hash); execute_plugins(:post_runner_execute, arg_hash); end + + def pre_compile_execute(arg_hash); execute_plugins(:pre_compile_execute, arg_hash); end + def post_compile_execute(arg_hash); execute_plugins(:post_compile_execute, arg_hash); end + + def pre_link_execute(arg_hash); execute_plugins(:pre_link_execute, arg_hash); end + def post_link_execute(arg_hash); execute_plugins(:post_link_execute, arg_hash); end + + def pre_test_execute(arg_hash); execute_plugins(:pre_test_execute, arg_hash); end + def post_test_execute(arg_hash) + # special arbitration: raw test results are printed or taken over by plugins handling the job + @streaminator.stdout_puts(arg_hash[:shell_result][:output]) if (@configurator.plugins_display_raw_test_results) + execute_plugins(:post_test_execute, arg_hash) + end + + def post_build; execute_plugins(:post_build); end + + def summary; execute_plugins(:summary); end + + private #################################### + + def camelize(underscored_name) + return underscored_name.gsub(/(_|^)([a-z0-9])/) {$2.upcase} + end + + def execute_plugins(method, *args) + @plugin_objects.each {|plugin| plugin.send(method, *args) } + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/plugin_manager_helper.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/plugin_manager_helper.rb new file mode 100644 index 0000000..b18248a --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/plugin_manager_helper.rb @@ -0,0 +1,19 @@ + +class PluginManagerHelper + + def include?(plugins, name) + include = false + plugins.each do |plugin| + if (plugin.name == name) + include = true + break + end + end + return include + end + + def instantiate_plugin_script(plugin, system_objects, name) + return eval("#{plugin}.new(system_objects, name)") + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/plugin_reportinator.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/plugin_reportinator.rb new file mode 100644 index 0000000..b08801a --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/plugin_reportinator.rb @@ -0,0 +1,75 @@ +require 'constants' +require 'defaults' + +class PluginReportinator + + constructor :plugin_reportinator_helper, :plugin_manager, :reportinator + + def setup + @test_results_template = nil + end + + + def set_system_objects(system_objects) + @plugin_reportinator_helper.ceedling = system_objects + end + + + def fetch_results(results_path, test, options={:boom => false}) + return @plugin_reportinator_helper.fetch_results( File.join(results_path, test), options ) + end + + + def generate_banner(message) + return @reportinator.generate_banner(message) + end + + + def assemble_test_results(results_list, options={:boom => false}) + aggregated_results = get_results_structure + + results_list.each do |result_path| + results = @plugin_reportinator_helper.fetch_results( result_path, options ) + @plugin_reportinator_helper.process_results(aggregated_results, results) + end + + return aggregated_results + end + + + def register_test_results_template(template) + @test_results_template = template if (@test_results_template.nil?) + end + + + def run_test_results_report(hash, verbosity=Verbosity::NORMAL, &block) + run_report( $stdout, + ((@test_results_template.nil?) ? DEFAULT_TESTS_RESULTS_REPORT_TEMPLATE : @test_results_template), + hash, + verbosity, + &block ) + end + + + def run_report(stream, template, hash=nil, verbosity=Verbosity::NORMAL) + failure = nil + failure = yield() if block_given? + + @plugin_manager.register_build_failure( failure ) + + @plugin_reportinator_helper.run_report( stream, template, hash, verbosity ) + end + + private ############################### + + def get_results_structure + return { + :successes => [], + :failures => [], + :ignores => [], + :stdout => [], + :counts => {:total => 0, :passed => 0, :failed => 0, :ignored => 0, :stdout => 0} + } + end + +end \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/plugin_reportinator_helper.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/plugin_reportinator_helper.rb new file mode 100644 index 0000000..c30a833 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/plugin_reportinator_helper.rb @@ -0,0 +1,52 @@ +require 'constants' +require 'erb' +require 'rubygems' +require 'rake' # for ext() + + +class PluginReportinatorHelper + + attr_writer :ceedling + + constructor :configurator, :streaminator, :yaml_wrapper, :file_wrapper + + def fetch_results(results_path, options) + pass_path = File.join(results_path.ext( @configurator.extension_testpass )) + fail_path = File.join(results_path.ext( @configurator.extension_testfail )) + + if (@file_wrapper.exist?(fail_path)) + return @yaml_wrapper.load(fail_path) + elsif (@file_wrapper.exist?(pass_path)) + return @yaml_wrapper.load(pass_path) + else + if (options[:boom]) + @streaminator.stderr_puts("Could find no test results for '#{File.basename(results_path).ext(@configurator.extension_source)}'", Verbosity::ERRORS) + raise + end + end + + return {} + end + + + def process_results(aggregate_results, results) + return if (results.empty?) + + aggregate_results[:successes] << { :source => results[:source].clone, :collection => results[:successes].clone } if (results[:successes].size > 0) + aggregate_results[:failures] << { :source => results[:source].clone, :collection => results[:failures].clone } if (results[:failures].size > 0) + aggregate_results[:ignores] << { :source => results[:source].clone, :collection => results[:ignores].clone } if (results[:ignores].size > 0) + aggregate_results[:stdout] << { :source => results[:source].clone, :collection => results[:stdout].clone } if (results[:stdout].size > 0) + aggregate_results[:counts][:total] += results[:counts][:total] + aggregate_results[:counts][:passed] += results[:counts][:passed] + aggregate_results[:counts][:failed] += results[:counts][:failed] + aggregate_results[:counts][:ignored] += results[:counts][:ignored] + aggregate_results[:counts][:stdout] += results[:stdout].size + end + + + def run_report(stream, template, hash, verbosity) + output = ERB.new(template, 0, "%<>") + @streaminator.stream_puts(stream, output.result(binding()), verbosity) + end + +end \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/preprocessinator.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/preprocessinator.rb new file mode 100644 index 0000000..e5c46c3 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/preprocessinator.rb @@ -0,0 +1,43 @@ + +class Preprocessinator + + attr_reader :preprocess_file_proc + + constructor :preprocessinator_helper, :preprocessinator_includes_handler, :preprocessinator_file_handler, :task_invoker, :file_path_utils, :yaml_wrapper + + + def setup + # fashion ourselves callbacks @preprocessinator_helper can use + @preprocess_includes_proc = Proc.new { |filepath| self.preprocess_shallow_includes(filepath) } + @preprocess_file_proc = Proc.new { |filepath| self.preprocess_file(filepath) } + end + + + def preprocess_test_and_invoke_test_mocks(test) + @preprocessinator_helper.preprocess_includes(test, @preprocess_includes_proc) + + mocks_list = @preprocessinator_helper.assemble_mocks_list(test) + + @preprocessinator_helper.preprocess_mockable_headers(mocks_list, @preprocess_file_proc) + + @task_invoker.invoke_test_mocks(mocks_list) + + @preprocessinator_helper.preprocess_test_file(test, @preprocess_file_proc) + + return mocks_list + end + + def preprocess_shallow_includes(filepath) + dependencies_rule = @preprocessinator_includes_handler.form_shallow_dependencies_rule(filepath) + includes = @preprocessinator_includes_handler.extract_shallow_includes(dependencies_rule) + + @preprocessinator_includes_handler.write_shallow_includes_list( + @file_path_utils.form_preprocessed_includes_list_filepath(filepath), includes) + end + + def preprocess_file(filepath) + @preprocessinator_includes_handler.invoke_shallow_includes_list(filepath) + @preprocessinator_file_handler.preprocess_file( filepath, @yaml_wrapper.load(@file_path_utils.form_preprocessed_includes_list_filepath(filepath)) ) + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/preprocessinator_extractor.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/preprocessinator_extractor.rb new file mode 100644 index 0000000..947d5af --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/preprocessinator_extractor.rb @@ -0,0 +1,27 @@ + + +class PreprocessinatorExtractor + + constructor :file_wrapper + + # extract from cpp-processed file only content of file we care about + def extract_base_file_from_preprocessed_expansion(filepath) + contents = [] + extract = false + + @file_wrapper.readlines(filepath).each do |line| + if (extract) + if (line =~ /^#/) + extract = false + else + contents << line + end + end + # extract = true if (line =~ /^#.*#{Regexp.escape(File.basename(filepath))}/) + extract = true if (line =~ /^#.*(\s|\/|\\|\")#{Regexp.escape(File.basename(filepath))}/) + end + + return contents + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/preprocessinator_file_handler.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/preprocessinator_file_handler.rb new file mode 100644 index 0000000..cc84e7f --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/preprocessinator_file_handler.rb @@ -0,0 +1,21 @@ + + +class PreprocessinatorFileHandler + + constructor :preprocessinator_extractor, :configurator, :tool_executor, :file_path_utils, :file_wrapper + + + def preprocess_file(filepath, includes) + preprocessed_filepath = @file_path_utils.form_preprocessed_file_filepath(filepath) + + command_line = @tool_executor.build_command_line(@configurator.tools_test_file_preprocessor, filepath, preprocessed_filepath) + @tool_executor.exec(command_line) + + contents = @preprocessinator_extractor.extract_base_file_from_preprocessed_expansion(preprocessed_filepath) + + includes.each{|include| contents.unshift("#include \"#{include}\"")} + + @file_wrapper.write(preprocessed_filepath, contents.join("\n")) + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/preprocessinator_helper.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/preprocessinator_helper.rb new file mode 100644 index 0000000..6175637 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/preprocessinator_helper.rb @@ -0,0 +1,46 @@ + + +class PreprocessinatorHelper + + constructor :configurator, :test_includes_extractor, :task_invoker, :file_finder, :file_path_utils + + + def preprocess_includes(test, preprocess_includes_proc) + if (@configurator.project_use_test_preprocessor) + preprocessed_includes_list = @file_path_utils.form_preprocessed_includes_list_filepath(test) + preprocess_includes_proc.call( @file_finder.find_test_from_file_path(preprocessed_includes_list) ) + @test_includes_extractor.parse_includes_list(preprocessed_includes_list) + else + @test_includes_extractor.parse_test_file(test) + end + end + + def assemble_mocks_list(test) + return @file_path_utils.form_mocks_source_filelist( @test_includes_extractor.lookup_raw_mock_list(test) ) + end + + def preprocess_mockable_headers(mock_list, preprocess_file_proc) + if (@configurator.project_use_test_preprocessor) + preprocess_files_smartly( + @file_path_utils.form_preprocessed_mockable_headers_filelist(mock_list), + preprocess_file_proc ) { |file| @file_finder.find_header_file(file) } + end + end + + def preprocess_test_file(test, preprocess_file_proc) + return if (!@configurator.project_use_test_preprocessor) + + preprocess_file_proc.call(test) + end + + private ############################ + + def preprocess_files_smartly(file_list, preprocess_file_proc) + if (@configurator.project_use_auxiliary_dependencies) + @task_invoker.invoke_test_preprocessed_files(file_list) + else + file_list.each { |file| preprocess_file_proc.call( yield(file) ) } + end + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/preprocessinator_includes_handler.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/preprocessinator_includes_handler.rb new file mode 100644 index 0000000..3cca916 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/preprocessinator_includes_handler.rb @@ -0,0 +1,55 @@ + + +class PreprocessinatorIncludesHandler + + constructor :configurator, :tool_executor, :task_invoker, :file_path_utils, :yaml_wrapper, :file_wrapper + + # shallow includes: only those headers a source file explicitly includes + + def invoke_shallow_includes_list(filepath) + @task_invoker.invoke_test_shallow_include_lists( [@file_path_utils.form_preprocessed_includes_list_filepath(filepath)] ) + end + + # ask the preprocessor for a make-style dependency rule of only the headers the source file immediately includes + def form_shallow_dependencies_rule(filepath) + # change filename (prefix of '_') to prevent preprocessor from finding include files in temp directory containing file it's scanning + temp_filepath = @file_path_utils.form_temp_path(filepath, '_') + + # read the file and replace all include statements with a decorated version + # (decorating the names creates file names that don't exist, thus preventing the preprocessor + # from snaking out and discovering the entire include path that winds through the code) + contents = @file_wrapper.read(filepath) + contents.gsub!( /#include\s+\"\s*(\S+)\s*\"/, "#include \"\\1\"\n#include \"@@@@\\1\"" ) + @file_wrapper.write( temp_filepath, contents ) + + # extract the make-style dependency rule telling the preprocessor to + # ignore the fact that it can't find the included files + command_line = @tool_executor.build_command_line(@configurator.tools_test_includes_preprocessor, temp_filepath) + shell_result = @tool_executor.exec(command_line) + + return shell_result[:output] + end + + # headers only; ignore any crazy .c includes + def extract_shallow_includes(make_rule) + list = [] + header_extension = @configurator.extension_header + + headers = make_rule.scan(/(\S+#{'\\'+header_extension})/).flatten # escape slashes before dot file extension + headers.uniq! + headers.map! { |header| header.sub(/(@@@@)|(.+\/)/, '') } + headers.sort! + + headers.each_with_index do |header, index| + break if (headers.size == (index-1)) + list << header if (header == headers[index + 1]) + end + + return list + end + + def write_shallow_includes_list(filepath, list) + @yaml_wrapper.dump(filepath, list) + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/project_config_manager.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/project_config_manager.rb new file mode 100644 index 0000000..3599689 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/project_config_manager.rb @@ -0,0 +1,38 @@ +require 'constants' + + +class ProjectConfigManager + + attr_reader :options_files, :release_config_changed, :test_config_changed + attr_accessor :config_hash + + constructor :cacheinator, :yaml_wrapper + + + def setup + @options_files = [] + @release_config_changed = false + @test_config_changed = false + end + + + def merge_options(config_hash, option_filepath) + @options_files << File.basename( option_filepath ) + config_hash.deep_merge( @yaml_wrapper.load( option_filepath ) ) + return config_hash + end + + + + def process_release_config_change + # has project configuration changed since last release build + @release_config_changed = @cacheinator.diff_cached_release_config?( @config_hash ) + end + + + def process_test_config_change + # has project configuration changed since last test build + @test_config_changed = @cacheinator.diff_cached_test_config?( @config_hash ) + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/project_file_loader.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/project_file_loader.rb new file mode 100644 index 0000000..182d23a --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/project_file_loader.rb @@ -0,0 +1,64 @@ +require 'constants' + + +class ProjectFileLoader + + attr_reader :main_file, :user_file + + constructor :yaml_wrapper, :stream_wrapper, :system_wrapper, :file_wrapper + + def setup + @main_file = nil + @user_file = nil + + @main_project_filepath = '' + @user_project_filepath = '' + end + + + def find_project_files + # first go hunting for optional user project file by looking for environment variable and then default location on disk + user_filepath = @system_wrapper.env_get('CEEDLING_USER_PROJECT_FILE') + + if ( not user_filepath.nil? and @file_wrapper.exist?(user_filepath) ) + @user_project_filepath = user_filepath + elsif (@file_wrapper.exist?(DEFAULT_CEEDLING_USER_PROJECT_FILE)) + @user_project_filepath = DEFAULT_CEEDLING_USER_PROJECT_FILE + end + + # next check for main project file by looking for environment variable and then default location on disk; + # blow up if we don't find this guy -- like, he's so totally important + main_filepath = @system_wrapper.env_get('CEEDLING_MAIN_PROJECT_FILE') + + if ( not main_filepath.nil? and @file_wrapper.exist?(main_filepath) ) + @main_project_filepath = main_filepath + elsif (@file_wrapper.exist?(DEFAULT_CEEDLING_MAIN_PROJECT_FILE)) + @main_project_filepath = DEFAULT_CEEDLING_MAIN_PROJECT_FILE + else + # no verbosity checking since this is lowest level reporting anyhow & + # verbosity checking depends on configurator which in turns needs this class (circular dependency) + @stream_wrapper.stderr_puts('Found no Ceedling project file (*.yml)') + raise + end + + @main_file = File.basename( @main_project_filepath ) + @user_file = File.basename( @user_project_filepath ) if ( not @user_project_filepath.empty? ) + end + + + def load_project_config + config_hash = {} + + # if there's no user project file, then just provide hash from project file + if (@user_project_filepath.empty?) + config_hash = @yaml_wrapper.load(@main_project_filepath) + # if there is a user project file, load it too and merge it on top of the project file, + # superseding anything that's common between them + else + config_hash = (@yaml_wrapper.load(@main_project_filepath)).merge(@yaml_wrapper.load(@user_project_filepath)) + end + + return config_hash + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/rake_utils.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/rake_utils.rb new file mode 100644 index 0000000..3f667c8 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/rake_utils.rb @@ -0,0 +1,17 @@ + +class RakeUtils + + constructor :rake_wrapper + + def task_invoked?(task_regex) + task_invoked = false + @rake_wrapper.task_list.each do |task| + if ((task.already_invoked) and (task.to_s =~ task_regex)) + task_invoked = true + break + end + end + return task_invoked + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/rake_wrapper.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/rake_wrapper.rb new file mode 100644 index 0000000..d4d9e25 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/rake_wrapper.rb @@ -0,0 +1,31 @@ +require 'rubygems' +require 'rake' +require 'makefile' # our replacement for rake's make-style dependency loader + +class Rake::Task + attr_reader :already_invoked +end + +class RakeWrapper + + def initialize + @makefile_loader = Rake::MakefileLoader.new # use our custom replacement noted above + end + + def [](task) + return Rake::Task[task] + end + + def task_list + return Rake::Task.tasks + end + + def create_file_task(file_task, dependencies) + file(file_task => dependencies) + end + + def load_dependencies(dependencies_path) + @makefile_loader.load(dependencies_path) + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/rakefile.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/rakefile.rb new file mode 100644 index 0000000..0c22e33 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/rakefile.rb @@ -0,0 +1,60 @@ +require 'fileutils' + +# get directory containing this here file, back up one directory, and expand to full path +CEEDLING_ROOT = File.expand_path(File.dirname(__FILE__) + '/..') +CEEDLING_LIB = File.join(CEEDLING_ROOT, 'lib') +CEEDLING_VENDOR = File.join(CEEDLING_ROOT, 'vendor') +CEEDLING_RELEASE = File.join(CEEDLING_ROOT, 'release') + +$LOAD_PATH.unshift( CEEDLING_LIB ) +$LOAD_PATH.unshift( File.join(CEEDLING_VENDOR, 'diy/lib') ) +$LOAD_PATH.unshift( File.join(CEEDLING_VENDOR, 'constructor/lib') ) +$LOAD_PATH.unshift( File.join(CEEDLING_VENDOR, 'cmock/lib') ) +$LOAD_PATH.unshift( File.join(CEEDLING_VENDOR, 'deep_merge/lib') ) + +require 'rake' + +require 'diy' +require 'constructor' + +require 'constants' + + +# construct all our objects +@ceedling = DIY::Context.from_yaml( File.read( File.join(CEEDLING_LIB, 'objects.yml') ) ) +@ceedling.build_everything + +# one-stop shopping for all our setup and such after construction +@ceedling[:setupinator].ceedling = @ceedling +@ceedling[:setupinator].do_setup( @ceedling[:setupinator].load_project_files ) + +# tell all our plugins we're about to do something +@ceedling[:plugin_manager].pre_build + +# load rakefile component files (*.rake) +PROJECT_RAKEFILE_COMPONENT_FILES.each { |component| load(component) } + +# tell rake to shut up by default (overridden in verbosity / debug tasks as appropriate) +verbose(false) + + +# end block always executed following rake run +END { + # cache our input configurations to use in comparison upon next execution + @ceedling[:cacheinator].cache_test_config( @ceedling[:setupinator].config_hash ) if (@ceedling[:task_invoker].test_invoked?) + @ceedling[:cacheinator].cache_release_config( @ceedling[:setupinator].config_hash ) if (@ceedling[:task_invoker].release_invoked?) + + # delete all temp files unless we're in debug mode + if (not @ceedling[:configurator].project_debug) + @ceedling[:file_wrapper].rm_f( @ceedling[:file_wrapper].directory_listing( File.join(@ceedling[:configurator].project_temp_path, '*') )) + end + + # only perform these final steps if we got here without runtime exceptions or errors + if (@ceedling[:system_wrapper].ruby_success) + + # tell all our plugins the build is done and process results + @ceedling[:plugin_manager].post_build + @ceedling[:plugin_manager].print_plugin_failures + exit(1) if (@ceedling[:plugin_manager].plugins_failed?) + end +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/release_invoker.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/release_invoker.rb new file mode 100644 index 0000000..2df2e68 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/release_invoker.rb @@ -0,0 +1,29 @@ + + +class ReleaseInvoker + + constructor :configurator, :release_invoker_helper, :dependinator, :task_invoker, :file_path_utils + + + def setup_and_invoke_c_objects(c_files) + objects = ( @file_path_utils.form_release_build_c_objects_filelist( c_files ) ) + + @release_invoker_helper.process_auxiliary_dependencies( @file_path_utils.form_release_dependencies_filelist( c_files ) ) + + @dependinator.enhance_release_file_dependencies( objects ) + @task_invoker.invoke_release_objects( objects ) + + return objects + end + + + def setup_and_invoke_asm_objects(asm_files) + objects = @file_path_utils.form_release_build_asm_objects_filelist( asm_files ) + + @dependinator.enhance_release_file_dependencies( objects ) + @task_invoker.invoke_release_objects( objects ) + + return objects + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/release_invoker_helper.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/release_invoker_helper.rb new file mode 100644 index 0000000..2843f2e --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/release_invoker_helper.rb @@ -0,0 +1,16 @@ + + +class ReleaseInvokerHelper + + constructor :configurator, :dependinator, :task_invoker + + + def process_auxiliary_dependencies(dependencies_list) + return if (not @configurator.project_use_auxiliary_dependencies) + + @dependinator.enhance_release_file_dependencies( dependencies_list ) + @task_invoker.invoke_release_dependencies_files( dependencies_list ) + @dependinator.load_release_object_deep_dependencies( dependencies_list ) + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/reportinator.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/reportinator.rb new file mode 100644 index 0000000..a41e9a0 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/reportinator.rb @@ -0,0 +1,9 @@ + +class Reportinator + + def generate_banner(message, width=nil) + dash_count = ((width.nil?) ? message.strip.length : width) + return "#{'-' * dash_count}\n#{message}\n#{'-' * dash_count}\n" + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/rules_cmock.rake b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/rules_cmock.rake new file mode 100644 index 0000000..ab29e85 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/rules_cmock.rake @@ -0,0 +1,9 @@ + + +rule(/#{CMOCK_MOCK_PREFIX}.+#{'\\'+EXTENSION_SOURCE}$/ => [ + proc do |task_name| + @ceedling[:file_finder].find_header_input_for_mock_file(task_name) + end + ]) do |mock| + @ceedling[:generator].generate_mock(TEST_CONTEXT, mock.source) +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/rules_preprocess.rake b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/rules_preprocess.rake new file mode 100644 index 0000000..fda14dc --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/rules_preprocess.rake @@ -0,0 +1,26 @@ + + +# invocations against this rule should only happen when enhanced dependencies are enabled; +# otherwise, dependency tracking will be too shallow and preprocessed files could intermittently +# fail to be updated when they actually need to be. +rule(/#{PROJECT_TEST_PREPROCESS_FILES_PATH}\/.+/ => [ + proc do |task_name| + @ceedling[:file_finder].find_test_or_source_or_header_file(task_name) + end + ]) do |file| + if (not @ceedling[:configurator].project_use_auxiliary_dependencies) + raise 'ERROR: Ceedling preprocessing rule invoked though neccessary auxiliary dependency support not enabled.' + end + @ceedling[:generator].generate_preprocessed_file(TEST_CONTEXT, file.source) +end + + +# invocations against this rule can always happen as there are no deeper dependencies to consider +rule(/#{PROJECT_TEST_PREPROCESS_INCLUDES_PATH}\/.+/ => [ + proc do |task_name| + @ceedling[:file_finder].find_test_or_source_or_header_file(task_name) + end + ]) do |file| + @ceedling[:generator].generate_shallow_includes_list(TEST_CONTEXT, file.source) +end + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/rules_release.rake b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/rules_release.rake new file mode 100644 index 0000000..f8dc29a --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/rules_release.rake @@ -0,0 +1,24 @@ + +rule(/#{PROJECT_RELEASE_BUILD_OUTPUT_ASM_PATH}\/#{'.+\\'+EXTENSION_OBJECT}$/ => [ + proc do |task_name| + @ceedling[:file_finder].find_assembly_file(task_name) + end + ]) do |object| + @ceedling[:generator].generate_object_file(TOOLS_RELEASE_ASSEMBLER, object.source, object.name) +end + + +rule(/#{PROJECT_RELEASE_BUILD_OUTPUT_C_PATH}\/#{'.+\\'+EXTENSION_OBJECT}$/ => [ + proc do |task_name| + @ceedling[:file_finder].find_compilation_input_file(task_name) + end + ]) do |object| + @ceedling[:generator].generate_object_file(TOOLS_RELEASE_COMPILER, object.source, object.name) +end + + +rule(/#{PROJECT_RELEASE_BUILD_TARGET}/) do |bin_file| + @ceedling[:generator].generate_executable_file(TOOLS_RELEASE_LINKER, bin_file.prerequisites, bin_file.name) +end + + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/rules_release_aux_dependencies.rake b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/rules_release_aux_dependencies.rake new file mode 100644 index 0000000..485973f --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/rules_release_aux_dependencies.rake @@ -0,0 +1,14 @@ + + +rule(/#{PROJECT_RELEASE_DEPENDENCIES_PATH}\/#{'.+\\'+EXTENSION_DEPENDENCIES}$/ => [ + proc do |task_name| + @ceedling[:file_finder].find_compilation_input_file(task_name) + end + ]) do |dep| + @ceedling[:generator].generate_dependencies_file( + TOOLS_RELEASE_DEPENDENCIES_GENERATOR, + dep.source, + @ceedling[:file_path_utils].form_release_build_c_object_filepath(dep.source), + dep.name) +end + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/rules_tests.rake b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/rules_tests.rake new file mode 100644 index 0000000..a3902b7 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/rules_tests.rake @@ -0,0 +1,49 @@ + + +rule(/#{PROJECT_TEST_FILE_PREFIX}#{'.+'+TEST_RUNNER_FILE_SUFFIX}#{'\\'+EXTENSION_SOURCE}$/ => [ + proc do |task_name| + @ceedling[:file_finder].find_test_input_for_runner_file(task_name) + end + ]) do |runner| + @ceedling[:generator].generate_test_runner(TEST_CONTEXT, runner.source, runner.name) +end + + +rule(/#{PROJECT_TEST_BUILD_OUTPUT_PATH}\/#{'.+\\'+EXTENSION_OBJECT}$/ => [ + proc do |task_name| + @ceedling[:file_finder].find_compilation_input_file(task_name) + end + ]) do |object| + @ceedling[:generator].generate_object_file(TOOLS_TEST_COMPILER, TEST_CONTEXT, object.source, object.name) +end + + +rule(/#{PROJECT_TEST_BUILD_OUTPUT_PATH}\/#{'.+\\'+EXTENSION_EXECUTABLE}$/) do |bin_file| + @ceedling[:generator].generate_executable_file(TOOLS_TEST_LINKER, TEST_CONTEXT, bin_file.prerequisites, bin_file.name) +end + + +rule(/#{PROJECT_TEST_RESULTS_PATH}\/#{'.+\\'+EXTENSION_TESTPASS}$/ => [ + proc do |task_name| + @ceedling[:file_path_utils].form_test_executable_filepath(task_name) + end + ]) do |test_result| + @ceedling[:generator].generate_test_results(TOOLS_TEST_FIXTURE, TEST_CONTEXT, test_result.source, test_result.name) +end + + +namespace TEST_CONTEXT do + # use a rule to increase efficiency for large projects + # test tasks by regex + rule(/^#{TEST_TASK_ROOT}\S+$/ => [ + proc do |task_name| + test = task_name.sub(/#{TEST_TASK_ROOT}/, '') + test = "#{PROJECT_TEST_FILE_PREFIX}#{test}" if not (test.start_with?(PROJECT_TEST_FILE_PREFIX)) + @ceedling[:file_finder].find_test_from_file_path(test) + end + ]) do |test| + @ceedling[:rake_wrapper][:directories].invoke + @ceedling[:test_invoker].setup_and_invoke([test.source]) + end +end + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/rules_tests_aux_dependencies.rake b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/rules_tests_aux_dependencies.rake new file mode 100644 index 0000000..db9a92b --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/rules_tests_aux_dependencies.rake @@ -0,0 +1,15 @@ + + +rule(/#{PROJECT_TEST_DEPENDENCIES_PATH}\/#{'.+\\'+EXTENSION_DEPENDENCIES}$/ => [ + proc do |task_name| + @ceedling[:file_finder].find_compilation_input_file(task_name) + end + ]) do |dep| + @ceedling[:generator].generate_dependencies_file( + TOOLS_TEST_DEPENDENCIES_GENERATOR, + TEST_CONTEXT, + dep.source, + @ceedling[:file_path_utils].form_test_build_object_filepath(dep.source), + dep.name) +end + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/setupinator.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/setupinator.rb new file mode 100644 index 0000000..ffe141d --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/setupinator.rb @@ -0,0 +1,45 @@ + +class Setupinator + + attr_reader :config_hash + attr_writer :ceedling + + def setup + @ceedling = {} + @config_hash = {} + end + + def load_project_files + @ceedling[:project_file_loader].find_project_files + return @ceedling[:project_file_loader].load_project_config + end + + def do_setup(config_hash) + @config_hash = config_hash + + # load up all the constants and accessors our rake files, objects, & external scripts will need; + # note: configurator modifies the cmock section of the hash with a couple defaults to tie + # project together - the modified hash is used to build cmock object + @ceedling[:configurator].populate_defaults( config_hash ) + @ceedling[:configurator].populate_unity_defines( config_hash ) + @ceedling[:configurator].populate_cmock_defaults( config_hash ) + @ceedling[:configurator].find_and_merge_plugins( config_hash ) + @ceedling[:configurator].populate_tool_names_and_stderr_redirect( config_hash ) + @ceedling[:configurator].eval_environment_variables( config_hash ) + @ceedling[:configurator].eval_paths( config_hash ) + @ceedling[:configurator].standardize_paths( config_hash ) + @ceedling[:configurator].validate( config_hash ) + @ceedling[:configurator].build( config_hash ) + @ceedling[:configurator].insert_rake_plugins( @ceedling[:configurator].rake_plugins ) + + @ceedling[:plugin_manager].load_plugin_scripts( @ceedling[:configurator].script_plugins, @ceedling ) + @ceedling[:plugin_reportinator].set_system_objects( @ceedling ) + @ceedling[:file_finder].prepare_search_sources + @ceedling[:loginator].setup_log_filepath + @ceedling[:project_config_manager].config_hash = config_hash + end + + def reset_defaults(config_hash) + @ceedling[:configurator].reset_defaults( config_hash ) + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/stream_wrapper.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/stream_wrapper.rb new file mode 100644 index 0000000..33d3c10 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/stream_wrapper.rb @@ -0,0 +1,20 @@ + +class StreamWrapper + + def stdout_puts(string) + $stdout.puts(string) + end + + def stdout_flush + $stdout.flush + end + + def stderr_puts(string) + $stderr.puts(string) + end + + def stderr_flush + $stderr.flush + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/streaminator.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/streaminator.rb new file mode 100644 index 0000000..abbc9b8 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/streaminator.rb @@ -0,0 +1,41 @@ + +class Streaminator + + require 'constants' + + constructor :streaminator_helper, :verbosinator, :loginator, :stream_wrapper + + # for those objects for whom the configurator has already been instantiated, + # Streaminator is a convenience object for handling verbosity and writing to the std streams + + def stdout_puts(string, verbosity=Verbosity::NORMAL) + if (@verbosinator.should_output?(verbosity)) + @stream_wrapper.stdout_puts(string) + @stream_wrapper.stdout_flush + end + + # write to log as though Verbosity::OBNOXIOUS + @loginator.log( string, @streaminator_helper.extract_name($stdout) ) + end + + def stderr_puts(string, verbosity=Verbosity::NORMAL) + if (@verbosinator.should_output?(verbosity)) + @stream_wrapper.stderr_puts(string) + @stream_wrapper.stderr_flush + end + + # write to log as though Verbosity::OBNOXIOUS + @loginator.log( string, @streaminator_helper.extract_name($stderr) ) + end + + def stream_puts(stream, string, verbosity=Verbosity::NORMAL) + if (@verbosinator.should_output?(verbosity)) + stream.puts(string) + stream.flush + end + + # write to log as though Verbosity::OBNOXIOUS + @loginator.log( string, @streaminator_helper.extract_name(stream) ) + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/streaminator_helper.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/streaminator_helper.rb new file mode 100644 index 0000000..9fb5cc0 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/streaminator_helper.rb @@ -0,0 +1,15 @@ + +class StreaminatorHelper + + def extract_name(stream) + name = case (stream.fileno) + when 0 then '#' + when 1 then '#' + when 2 then '#' + else stream.inspect + end + + return name + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/system_wrapper.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/system_wrapper.rb new file mode 100644 index 0000000..631be36 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/system_wrapper.rb @@ -0,0 +1,67 @@ +require 'rbconfig' + +class SystemWrapper + + # static method for use in defaults + def self.is_windows? + return ((Config::CONFIG['host_os'] =~ /mswin|mingw/) ? true : false) + end + + # class method so as to be mockable for tests + def is_windows? + return SystemWrapper.is_windows? + end + + def module_eval(string) + return Object.module_eval("\"" + string + "\"") + end + + def eval(string) + return eval(string) + end + + def search_paths + return ENV['PATH'].split(File::PATH_SEPARATOR) + end + + def cmdline_args + return ARGV + end + + def env_set(name, value) + ENV[name] = value + end + + def env_get(name) + return ENV[name] + end + + def time_now + return Time.now.asctime + end + + def shell_execute(command) + return { + :output => `#{command}`, + :exit_code => ($?.exitstatus) + } + end + + def add_load_path(path) + $LOAD_PATH.unshift(path) + end + + def require_file(path) + require(path) + end + + def ruby_success + return ($!.nil? || $!.is_a?(SystemExit) && $!.success?) + end + + def constants_include?(item) + # forcing to strings provides consistency across Ruby versions + return Object.constants.map{|constant| constant.to_s}.include?(item.to_s) + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/task_invoker.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/task_invoker.rb new file mode 100644 index 0000000..92f3854 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/task_invoker.rb @@ -0,0 +1,85 @@ + +class TaskInvoker + + constructor :dependinator, :rake_utils, :rake_wrapper + + def setup + @test_regexs = [/^#{TEST_ROOT_NAME}:/] + @release_regexs = [/^#{RELEASE_ROOT_NAME}(:|$)/] + end + + def add_test_task_regex(regex) + @test_regexs << regex + end + + def add_release_task_regex(regex) + @release_regexs << regex + end + + def test_invoked? + invoked = false + + @test_regexs.each do |regex| + invoked = true if (@rake_utils.task_invoked?(regex)) + break if invoked + end + + return invoked + end + + def release_invoked? + invoked = false + + @release_regexs.each do |regex| + invoked = true if (@rake_utils.task_invoked?(regex)) + break if invoked + end + + return invoked + end + + def invoked?(regex) + return @rake_utils.task_invoked?(regex) + end + + + def invoke_test_mocks(mocks) + @dependinator.enhance_mock_dependencies( mocks ) + mocks.each { |mock| @rake_wrapper[mock].invoke } + end + + def invoke_test_runner(runner) + @dependinator.enhance_runner_dependencies( runner ) + @rake_wrapper[runner].invoke + end + + def invoke_test_shallow_include_lists(files) + @dependinator.enhance_shallow_include_lists_dependencies( files ) + files.each { |file| @rake_wrapper[file].invoke } + end + + def invoke_test_preprocessed_files(files) + @dependinator.enhance_preprocesed_file_dependencies( files ) + files.each { |file| @rake_wrapper[file].invoke } + end + + def invoke_test_dependencies_files(files) + @dependinator.enhance_dependencies_dependencies( files ) + files.each { |file| @rake_wrapper[file].invoke } + end + + def invoke_test_results(result) + @dependinator.enhance_results_dependencies( result ) + @rake_wrapper[result].invoke + end + + + def invoke_release_dependencies_files(files) + files.each { |file| @rake_wrapper[file].invoke } + end + + def invoke_release_objects(objects) + objects.each { |object| @rake_wrapper[object].invoke } + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/tasks_base.rake b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/tasks_base.rake new file mode 100644 index 0000000..fbe4081 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/tasks_base.rake @@ -0,0 +1,104 @@ +require 'constants' +require 'file_path_utils' + + +desc "Display build environment version info." +task :version do + tools = [ + [' Ceedling', CEEDLING_ROOT], + ['CException', File.join( CEEDLING_VENDOR, CEXCEPTION_ROOT_PATH)], + [' CMock', File.join( CEEDLING_VENDOR, CMOCK_ROOT_PATH)], + [' Unity', File.join( CEEDLING_VENDOR, UNITY_ROOT_PATH)], + ] + + tools.each do |tool| + name = tool[0] + base_path = tool[1] + + version_string = @ceedling[:file_wrapper].read( File.join(base_path, 'release', 'version.info') ).strip + build_string = @ceedling[:file_wrapper].read( File.join(base_path, 'release', 'build.info') ).strip + puts "#{name}:: #{version_string.empty? ? '#.#.' : (version_string + '.')}#{build_string.empty? ? '?' : build_string}" + end +end + + +desc "Set verbose output (silent:[#{Verbosity::SILENT}] - obnoxious:[#{Verbosity::OBNOXIOUS}])." +task :verbosity, :level do |t, args| + verbosity_level = args.level.to_i + + if (PROJECT_USE_MOCKS) + # don't store verbosity level in setupinator's config hash, use a copy; + # otherwise, the input configuration will change and trigger entire project rebuilds + hash = @ceedling[:setupinator].config_hash[:cmock].clone + hash[:verbosity] = verbosity_level + + @ceedling[:cmock_builder].manufacture( hash ) + end + + @ceedling[:configurator].project_verbosity = verbosity_level + + # control rake's verbosity with new setting + verbose( ((verbosity_level >= Verbosity::OBNOXIOUS) ? true : false) ) +end + + +desc "Enable logging" +task :logging do + @ceedling[:configurator].project_logging = true +end + + +# non advertised debug task +task :debug do + Rake::Task[:verbosity].invoke(Verbosity::DEBUG) + Rake.application.options.trace = true + @ceedling[:configurator].project_debug = true +end + + +# non advertised sanity checking task +task :sanity_checks, :level do |t, args| + check_level = args.level.to_i + @ceedling[:configurator].sanity_checks = check_level +end + + +# list expanded environment variables +if (not COLLECTION_ENVIRONMENT.empty?) +desc "List all configured environment variables." +task :environment do + COLLECTION_ENVIRONMENT.each do |env| + env.each_key do |key| + name = key.to_s.upcase + puts " - #{name}: \"#{env[key]}\"" + end + end +end +end + + +namespace :options do + + COLLECTION_PROJECT_OPTIONS.each do |option_path| + option = File.basename(option_path, '.yml') + + desc "Merge #{option} project options." + task option.downcase.to_sym do + @ceedling[:setupinator].reset_defaults( @ceedling[:setupinator].config_hash ) + hash = @ceedling[:project_config_manager].merge_options( @ceedling[:setupinator].config_hash, option_path ) + @ceedling[:setupinator].do_setup( hash ) + end + end + +end + + +# do not present task if there's no plugins +if (not PLUGINS_ENABLED.empty?) +desc "Execute plugin result summaries (no build triggering)." +task :summary do + @ceedling[:plugin_manager].summary + puts "\nNOTE: Summaries may be out of date with project sources.\n\n" +end +end + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/tasks_filesystem.rake b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/tasks_filesystem.rake new file mode 100644 index 0000000..e119d64 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/tasks_filesystem.rake @@ -0,0 +1,89 @@ + +# rather than require 'rake/clean' & try to override, we replicate for finer control +CLEAN = Rake::FileList["**/*~", "**/*.bak"] +CLOBBER = Rake::FileList.new + +CLEAN.clear_exclude.exclude { |fn| fn.pathmap("%f") == 'core' && File.directory?(fn) } + +CLEAN.include(File.join(PROJECT_TEST_BUILD_OUTPUT_PATH, '*')) +CLEAN.include(File.join(PROJECT_TEST_RESULTS_PATH, '*')) +CLEAN.include(File.join(PROJECT_TEST_DEPENDENCIES_PATH, '*')) +CLEAN.include(File.join(PROJECT_RELEASE_BUILD_OUTPUT_PATH, '*')) + +CLOBBER.include(File.join(PROJECT_BUILD_ARTIFACTS_ROOT, '**/*')) +CLOBBER.include(File.join(PROJECT_BUILD_TESTS_ROOT, '**/*')) +CLOBBER.include(File.join(PROJECT_BUILD_RELEASE_ROOT, '**/*')) +CLOBBER.include(File.join(PROJECT_LOG_PATH, '**/*')) +CLOBBER.include(File.join(PROJECT_TEMP_PATH, '**/*')) + +# because of cmock config, mock path can optionally exist apart from standard test build paths +CLOBBER.include(File.join(CMOCK_MOCK_PATH, '*')) + +REMOVE_FILE_PROC = Proc.new { |fn| rm_r fn rescue nil } + +# redefine clean so we can override how it advertises itself +desc "Delete all build artifacts and temporary products." +task(:clean) do + # because :clean is a prerequisite for :clobber, intelligently display the progress message + if (not @ceedling[:task_invoker].invoked?(/^clobber$/)) + @ceedling[:streaminator].stdout_puts("\nCleaning build artifacts...\n(For large projects, this task may take a long time to complete)\n\n") + end + CLEAN.each { |fn| REMOVE_FILE_PROC.call(fn) } +end + +# redefine clobber so we can override how it advertises itself +desc "Delete all generated files (and build artifacts)." +task(:clobber => [:clean]) do + @ceedling[:streaminator].stdout_puts("\nClobbering all generated files...\n(For large projects, this task may take a long time to complete)\n\n") + CLOBBER.each { |fn| REMOVE_FILE_PROC.call(fn) } +end + + +PROJECT_BUILD_PATHS.each { |path| directory(path) } + +# create directories that hold build output and generated files & touching rebuild dependency sources +task(:directories => PROJECT_BUILD_PATHS) { @ceedling[:dependinator].touch_force_rebuild_files } + + +# list paths discovered at load time +namespace :paths do + + paths = @ceedling[:setupinator].config_hash[:paths] + paths.each_key do |section| + name = section.to_s.downcase + path_list = Object.const_get("COLLECTION_PATHS_#{name.upcase}") + + if (path_list.size != 0) + desc "List all collected #{name} paths." + task(name.to_sym) { puts "#{name} paths:"; path_list.sort.each {|path| puts " - #{path}" } } + end + end + +end + + +# list files & file counts discovered at load time +namespace :files do + + categories = [ + ['test', COLLECTION_ALL_TESTS], + ['source', COLLECTION_ALL_SOURCE], + ['header', COLLECTION_ALL_HEADERS] + ] + categories << ['assembly', COLLECTION_ALL_ASSEMBLY] if (RELEASE_BUILD_USE_ASSEMBLY) + + categories.each do |category| + name = category[0] + collection = category[1] + + desc "List all collected #{name} files." + task(name.to_sym) do + puts "#{name} files:" + collection.sort.each { |filepath| puts " - #{filepath}" } + puts "file count: #{collection.size}" + end + end + +end + + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/tasks_release.rake b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/tasks_release.rake new file mode 100644 index 0000000..88aa678 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/tasks_release.rake @@ -0,0 +1,44 @@ +require 'constants' +require 'file_path_utils' + + +desc "Build release target." +task :release => [:directories] do + header = "Release build '#{File.basename(PROJECT_RELEASE_BUILD_TARGET)}'" + @ceedling[:streaminator].stdout_puts("\n\n#{header}\n#{'-' * header.length}") + + core_objects = [] + extra_objects = @ceedling[:file_path_utils].form_release_build_c_objects_filelist( COLLECTION_RELEASE_ARTIFACT_EXTRA_LINK_OBJECTS ) + + @ceedling[:project_config_manager].process_release_config_change + core_objects.concat( @ceedling[:release_invoker].setup_and_invoke_c_objects( COLLECTION_ALL_SOURCE ) ) + core_objects.concat( @ceedling[:release_invoker].setup_and_invoke_asm_objects( COLLECTION_ALL_ASSEMBLY ) ) + + file( PROJECT_RELEASE_BUILD_TARGET => (core_objects + extra_objects) ) + Rake::Task[PROJECT_RELEASE_BUILD_TARGET].invoke +end + + +namespace :release do + + namespace :compile do + COLLECTION_ALL_SOURCE.each do |source| + name = File.basename( source ) + task name.to_sym => [:directories] do + @ceedling[:project_config_manager].process_release_config_change + @ceedling[:release_invoker].setup_and_invoke_c_objects( [source] ) + end + end + end + + namespace :assemble do + COLLECTION_ALL_ASSEMBLY.each do |source| + name = File.basename( source ) + task name.to_sym => [:directories] do + @ceedling[:project_config_manager].process_release_config_change + @ceedling[:release_invoker].setup_and_invoke_asm_objects( [source] ) + end + end + end + +end \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/tasks_tests.rake b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/tasks_tests.rake new file mode 100644 index 0000000..a1845ac --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/tasks_tests.rake @@ -0,0 +1,49 @@ + +namespace TEST_CONTEXT do + + desc "Run all unit tests." + task :all => [:directories] do + @ceedling[:test_invoker].setup_and_invoke(COLLECTION_ALL_TESTS) + end + + desc "Run single test ([*] real test or source file name, no path)." + task :* do + message = "\nOops! '#{TEST_ROOT_NAME}:*' isn't a real task. " + + "Use a real test or source file name (no path) in place of the wildcard.\n" + + "Example: rake #{TEST_ROOT_NAME}:foo.c\n\n" + + @ceedling[:streaminator].stdout_puts( message ) + end + + desc "Run tests for changed files." + task :delta => [:directories] do + @ceedling[:test_invoker].setup_and_invoke(COLLECTION_ALL_TESTS, {:force_run => false}) + end + + desc "Run tests by matching regular expression pattern." + task :pattern, [:regex] => [:directories] do |t, args| + matches = [] + + COLLECTION_ALL_TESTS.each { |test| matches << test if (test =~ /#{args.regex}/) } + + if (matches.size > 0) + @ceedling[:test_invoker].setup_and_invoke(matches, {:force_run => false}) + else + @ceedling[:streaminator].stdout_puts("\nFound no tests matching pattern /#{args.regex}/.") + end + end + + desc "Run tests whose test path contains [dir] or [dir] substring." + task :path, [:dir] => [:directories] do |t, args| + matches = [] + + COLLECTION_ALL_TESTS.each { |test| matches << test if File.dirname(test).include?(args.dir.gsub(/\\/, '/')) } + + if (matches.size > 0) + @ceedling[:test_invoker].setup_and_invoke(matches, {:force_run => false}) + else + @ceedling[:streaminator].stdout_puts("\nFound no tests including the given path or path component.") + end + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/tasks_vendor.rake b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/tasks_vendor.rake new file mode 100644 index 0000000..0d07154 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/tasks_vendor.rake @@ -0,0 +1,36 @@ +require 'constants' +require 'file_path_utils' + +# create file dependencies to ensure C-based components of vendor tools are recompiled when they are updated with new versions +# forming these explicitly rather than depend on auxiliary dependencies so all scenarios are explicitly covered + +file( @ceedling[:file_path_utils].form_test_build_object_filepath( UNITY_C_FILE ) => [ + FilePathUtils.form_ceedling_vendor_path( UNITY_LIB_PATH, UNITY_C_FILE ), + FilePathUtils.form_ceedling_vendor_path( UNITY_LIB_PATH, UNITY_H_FILE ), + FilePathUtils.form_ceedling_vendor_path( UNITY_LIB_PATH, UNITY_INTERNALS_H_FILE ) ] + ) + + +if (PROJECT_USE_MOCKS) +file( @ceedling[:file_path_utils].form_test_build_object_filepath( CMOCK_C_FILE ) => [ + FilePathUtils.form_ceedling_vendor_path( CMOCK_LIB_PATH, CMOCK_C_FILE ), + FilePathUtils.form_ceedling_vendor_path( CMOCK_LIB_PATH, CMOCK_H_FILE ) ] + ) +end + + +if (PROJECT_USE_EXCEPTIONS) +file( @ceedling[:file_path_utils].form_test_build_object_filepath( CEXCEPTION_C_FILE ) => [ + FilePathUtils.form_ceedling_vendor_path( CEXCEPTION_LIB_PATH, CEXCEPTION_C_FILE ), + FilePathUtils.form_ceedling_vendor_path( CEXCEPTION_LIB_PATH, CEXCEPTION_H_FILE ) ] + ) +end + + +if (PROJECT_USE_EXCEPTIONS and PROJECT_RELEASE_BUILD) +file( @ceedling[:file_path_utils].form_release_build_c_object_filepath( CEXCEPTION_C_FILE ) => [ + FilePathUtils.form_ceedling_vendor_path( CEXCEPTION_LIB_PATH, CEXCEPTION_C_FILE ), + FilePathUtils.form_ceedling_vendor_path( CEXCEPTION_LIB_PATH, CEXCEPTION_H_FILE ) ] + ) +end + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/test_includes_extractor.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/test_includes_extractor.rb new file mode 100644 index 0000000..35f7c53 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/test_includes_extractor.rb @@ -0,0 +1,81 @@ + +class TestIncludesExtractor + + constructor :configurator, :yaml_wrapper, :file_wrapper + + + def setup + @includes = {} + @mocks = {} + end + + + # for includes_list file, slurp up array from yaml file and sort & store includes + def parse_includes_list(includes_list) + gather_and_store_includes( includes_list, @yaml_wrapper.load(includes_list) ) + end + + # open, scan for, and sort & store includes of test file + def parse_test_file(test) + gather_and_store_includes( test, extract_from_file(test) ) + end + + # mocks with no file extension + def lookup_raw_mock_list(test) + file_key = form_file_key(test) + return [] if @mocks[file_key].nil? + return @mocks[file_key] + end + + # includes with file extension + def lookup_includes_list(file) + file_key = form_file_key(file) + return [] if (@includes[file_key]).nil? + return @includes[file_key] + end + + private ################################# + + def form_file_key(filepath) + return File.basename(filepath).to_sym + end + + def extract_from_file(file) + includes = [] + header_extension = @configurator.extension_header + + contents = @file_wrapper.read(file) + + # remove line comments + contents = contents.gsub(/\/\/.*$/, '') + # remove block comments + contents = contents.gsub(/\/\*.*?\*\//m, '') + + contents.split("\n").each do |line| + # look for include statement + scan_results = line.scan(/#include\s+\"\s*(.+#{'\\'+header_extension})\s*\"/) + + includes << scan_results[0][0] if (scan_results.size > 0) + end + + return includes.uniq + end + + def gather_and_store_includes(file, includes) + mock_prefix = @configurator.cmock_mock_prefix + header_extension = @configurator.extension_header + file_key = form_file_key(file) + @mocks[file_key] = [] + + # add includes to lookup hash + @includes[file_key] = includes + + includes.each do |include_file| + # check if include is a mock + scan_results = include_file.scan(/(#{mock_prefix}.+)#{'\\'+header_extension}/) + # add mock to lookup hash + @mocks[file_key] << scan_results[0][0] if (scan_results.size > 0) + end + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/test_invoker.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/test_invoker.rb new file mode 100644 index 0000000..b80d91e --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/test_invoker.rb @@ -0,0 +1,72 @@ +require 'rubygems' +require 'rake' # for ext() + + +class TestInvoker + + attr_reader :sources, :tests, :mocks + + constructor :configurator, :test_invoker_helper, :streaminator, :preprocessinator, :task_invoker, :dependinator, :project_config_manager, :file_path_utils + + def setup + @sources = [] + @tests = [] + @mocks = [] + end + + def setup_and_invoke(tests, options={:force_run => true}) + + @tests = tests + + @project_config_manager.process_test_config_change + + @tests.each do |test| + # announce beginning of test run + header = "Test '#{File.basename(test)}'" + @streaminator.stdout_puts("\n\n#{header}\n#{'-' * header.length}") + + begin + # collect up test fixture pieces & parts + runner = @file_path_utils.form_runner_filepath_from_test( test ) + mock_list = @preprocessinator.preprocess_test_and_invoke_test_mocks( test ) + sources = @test_invoker_helper.extract_sources( test ) + extras = @configurator.collection_test_fixture_extra_link_objects + core = [test] + mock_list + sources + objects = @file_path_utils.form_test_build_objects_filelist( [runner] + core + extras ) + results_pass = @file_path_utils.form_pass_results_filepath( test ) + results_fail = @file_path_utils.form_fail_results_filepath( test ) + + # clean results files so we have a missing file with which to kick off rake's dependency rules + @test_invoker_helper.clean_results( {:pass => results_pass, :fail => results_fail}, options ) + + # load up auxiliary dependencies so deep changes cause rebuilding appropriately + @test_invoker_helper.process_auxiliary_dependencies( core ) + + # tell rake to create test runner if needed + @task_invoker.invoke_test_runner( runner ) + + # enhance object file dependencies to capture externalities influencing regeneration + @dependinator.enhance_test_build_object_dependencies( objects ) + + # associate object files with executable + @dependinator.setup_test_executable_dependencies( test, objects ) + + # 3, 2, 1... launch + @task_invoker.invoke_test_results( results_pass ) + rescue => e + @test_invoker_helper.process_exception(e) + end + + # store away what's been processed + @mocks.concat( mock_list ) + @sources.concat( sources ) + end + + # post-process collected mock list + @mocks.uniq! + + # post-process collected sources list + @sources.uniq! + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/test_invoker_helper.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/test_invoker_helper.rb new file mode 100644 index 0000000..f7d848d --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/test_invoker_helper.rb @@ -0,0 +1,41 @@ +require 'rubygems' +require 'rake' # for ext() + + +class TestInvokerHelper + + constructor :configurator, :task_invoker, :dependinator, :test_includes_extractor, :file_finder, :file_path_utils, :streaminator, :file_wrapper + + def clean_results(results, options) + @file_wrapper.rm_f( results[:fail] ) + @file_wrapper.rm_f( results[:pass] ) if (options[:force_run]) + end + + def process_auxiliary_dependencies(files) + return if (not @configurator.project_use_auxiliary_dependencies) + + dependencies_list = @file_path_utils.form_test_dependencies_filelist( files ) + @task_invoker.invoke_test_dependencies_files( dependencies_list ) + @dependinator.load_test_object_deep_dependencies( dependencies_list ) + end + + def extract_sources(test) + sources = [] + includes = @test_includes_extractor.lookup_includes_list(test) + + includes.each { |include| sources << @file_finder.find_source_file(include, :ignore) } + + return sources.compact + end + + def process_exception(exception) + if (exception.message =~ /Don't know how to build task '(.+)'/i) + @streaminator.stderr_puts("ERROR: Rake could not find file referenced in source or test: '#{$1}'.") + @streaminator.stderr_puts("Possible stale dependency due to a file name change, etc. Execute 'clean' task and try again.") if (@configurator.project_use_auxiliary_dependencies) + raise '' + else + raise exception + end + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/tool_executor.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/tool_executor.rb new file mode 100644 index 0000000..fcd4d42 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/tool_executor.rb @@ -0,0 +1,178 @@ +require 'constants' + + +class ToolExecutor + + constructor :configurator, :tool_executor_helper, :streaminator, :system_wrapper + + def setup + @tool_name = '' + @executable = '' + end + + # build up a command line from yaml provided config + def build_command_line(tool_config, *args) + @tool_name = tool_config[:name] + @executable = tool_config[:executable] + + # basic premise is to iterate top to bottom through arguments using '$' as + # a string replacement indicator to expand globals or inline yaml arrays + # into command line arguments via substitution strings + return [ + @tool_executor_helper.osify_path_separators( expandify_element(@executable, *args) ), + build_arguments(tool_config[:arguments], *args), + @tool_executor_helper.stderr_redirect_addendum(tool_config) ].compact.join(' ') + end + + + # shell out, execute command, and return response + def exec(command, args=[], options={:boom => true}) + command_str = "#{command} #{args.join(' ')}".strip + + shell_result = @system_wrapper.shell_execute(command_str) + + @tool_executor_helper.print_happy_results(command_str, shell_result) + @tool_executor_helper.print_error_results(command_str, shell_result) if (options[:boom]) + + raise if ((shell_result[:exit_code] != 0) and options[:boom]) + + return shell_result + end + + + private ############################# + + + def build_arguments(config, *args) + build_string = '' + + return nil if (config.nil?) + + # iterate through each argument + + # the yaml blob array needs to be flattened so that yaml substitution + # is handled correctly, since it creates a nested array when an anchor is + # dereferenced + config.flatten.each do |element| + argument = '' + + case(element) + # if we find a simple string then look for string replacement operators + # and expand with the parameters in this method's argument list + when String then argument = expandify_element(element, *args) + # if we find a hash, then we grab the key as a substitution string and expand the + # hash's value(s) within that substitution string + when Hash then argument = dehashify_argument_elements(element) + end + + build_string.concat("#{argument} ") if (argument.length > 0) + end + + build_string.strip! + return build_string if (build_string.length > 0) + return nil + end + + + # handle simple text string argument & argument array string replacement operators + def expandify_element(element, *args) + match = // + to_process = nil + args_index = 0 + + # handle ${#} input replacement + if (element =~ TOOL_EXECUTOR_ARGUMENT_REPLACEMENT_PATTERN) + args_index = ($2.to_i - 1) + + if (args.nil? or args[args_index].nil?) + @streaminator.stderr_puts("ERROR: Tool '#{@tool_name}' expected valid argument data to accompany replacement operator #{$1}.", Verbosity::ERRORS) + raise + end + + match = /#{Regexp.escape($1)}/ + to_process = args[args_index] + end + + # simple string argument: replace escaped '\$' and strip + element.sub!(/\\\$/, '$') + element.strip! + + # handle inline ruby execution + if (element =~ RUBY_EVAL_REPLACEMENT_PATTERN) + element.replace(eval($1)) + end + + build_string = '' + + # handle array or anything else passed into method to be expanded in place of replacement operators + case (to_process) + when Array then to_process.each {|value| build_string.concat( "#{element.sub(match, value.to_s)} " ) } if (to_process.size > 0) + else build_string.concat( element.sub(match, to_process.to_s) ) + end + + # handle inline ruby string substitution + if (build_string =~ RUBY_STRING_REPLACEMENT_PATTERN) + build_string.replace(@system_wrapper.module_eval(build_string)) + end + + return build_string.strip + end + + + # handle argument hash: keys are substitution strings, values are data to be expanded within substitution strings + def dehashify_argument_elements(hash) + build_string = '' + elements = [] + + # grab the substitution string (hash key) + substitution = hash.keys[0].to_s + # grab the string(s) to squirt into the substitution string (hash value) + expand = hash[hash.keys[0]] + + if (expand.nil?) + @streaminator.stderr_puts("ERROR: Tool '#{@tool_name}' could not expand nil elements for substitution string '#{substitution}'.", Verbosity::ERRORS) + raise + end + + # array-ify expansion input if only a single string + expansion = ((expand.class == String) ? [expand] : expand) + + expansion.each do |item| + # code eval substitution + if (item =~ RUBY_EVAL_REPLACEMENT_PATTERN) + elements << eval($1) + # string eval substitution + elsif (item =~ RUBY_STRING_REPLACEMENT_PATTERN) + elements << @system_wrapper.module_eval(item) + # global constants + elsif (@system_wrapper.constants_include?(item)) + const = Object.const_get(item) + if (const.nil?) + @streaminator.stderr_puts("ERROR: Tool '#{@tool_name}' found constant '#{item}' to be nil.", Verbosity::ERRORS) + raise + else + elements << const + end + elsif (item.class == Array) + elements << item + elsif (item.class == String) + @streaminator.stderr_puts("ERROR: Tool '#{@tool_name}' cannot expand nonexistent value '#{item}' for substitution string '#{substitution}'.", Verbosity::ERRORS) + raise + else + @streaminator.stderr_puts("ERROR: Tool '#{@tool_name}' cannot expand value having type '#{item.class}' for substitution string '#{substitution}'.", Verbosity::ERRORS) + raise + end + end + + # expand elements (whether string or array) into substitution string & replace escaped '\$' + elements.flatten! + elements.each do |element| + build_string.concat( substitution.sub(/([^\\]*)\$/, "\\1#{element}") ) # don't replace escaped '\$' but allow us to replace just a lonesome '$' + build_string.gsub!(/\\\$/, '$') + build_string.concat(' ') + end + + return build_string.strip + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/tool_executor_helper.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/tool_executor_helper.rb new file mode 100644 index 0000000..c9f9ca2 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/tool_executor_helper.rb @@ -0,0 +1,57 @@ +require 'constants' # for Verbosity enumeration & $stderr redirect enumeration + +class ToolExecutorHelper + + constructor :streaminator, :system_wrapper + + def osify_path_separators(executable) + return executable.gsub(/\//, '\\') if (@system_wrapper.is_windows?) + return executable + end + + def stderr_redirect_addendum(tool_config) + return nil if (tool_config[:stderr_redirect].nil?) + + redirect = tool_config[:stderr_redirect] + + case redirect + # we may need more complicated processing after some learning with various environments + when StdErrRedirect::NONE then nil + when StdErrRedirect::AUTO then '2>&1' + when StdErrRedirect::WIN then '2>&1' + when StdErrRedirect::UNIX then '2>&1' + when StdErrRedirect::TCSH then '|&' + else redirect.to_s + end + end + + # if command succeeded and we have verbosity cranked up, spill our guts + def print_happy_results(command_str, shell_result) + if (shell_result[:exit_code] == 0) + output = "> Shell executed command:\n" + output += "#{command_str}\n" + output += "> Produced response:\n" if (not shell_result[:output].empty?) + output += "#{shell_result[:output].strip}\n" if (not shell_result[:output].empty?) + output += "\n" + + @streaminator.stdout_puts(output, Verbosity::OBNOXIOUS) + end + end + + # if command failed and we have verbosity set to minimum error level, spill our guts + def print_error_results(command_str, shell_result) + if (shell_result[:exit_code] != 0) + output = "ERROR: Shell command failed.\n" + output += "> Shell executed command:\n" + output += "'#{command_str}'\n" + output += "> Produced response:\n" if (not shell_result[:output].empty?) + output += "#{shell_result[:output].strip}\n" if (not shell_result[:output].empty?) + output += "> And exited with status: [#{shell_result[:exit_code]}].\n" if (shell_result[:exit_code] != nil) + output += "> And then likely crashed.\n" if (shell_result[:exit_code] == nil) + output += "\n" + + @streaminator.stderr_puts(output, Verbosity::ERRORS) + end + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/verbosinator.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/verbosinator.rb new file mode 100644 index 0000000..e8ed38d --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/verbosinator.rb @@ -0,0 +1,10 @@ + +class Verbosinator + + constructor :configurator + + def should_output?(level) + return (level <= @configurator.project_verbosity) + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/yaml_wrapper.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/yaml_wrapper.rb new file mode 100644 index 0000000..77cef59 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/lib/yaml_wrapper.rb @@ -0,0 +1,16 @@ +require 'yaml' + + +class YamlWrapper + + def load(filepath) + return YAML.load(File.read(filepath)) + end + + def dump(filepath, structure) + File.open(filepath, 'w') do |output| + YAML.dump(structure, output) + end + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/plugins/stdout_ide_tests_report/stdout_ide_tests_report.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/plugins/stdout_ide_tests_report/stdout_ide_tests_report.rb new file mode 100644 index 0000000..f76ec14 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/plugins/stdout_ide_tests_report/stdout_ide_tests_report.rb @@ -0,0 +1,44 @@ +require 'plugin' +require 'defaults' + +class StdoutIdeTestsReport < Plugin + + def setup + @result_list = [] + end + + def post_test_execute(arg_hash) + return if not (arg_hash[:context] == TEST_CONTEXT) + + @result_list << arg_hash[:result_file] + end + + def post_build + return if (not @ceedling[:task_invoker].test_invoked?) + + results = @ceedling[:plugin_reportinator].assemble_test_results(@result_list) + hash = { + :header => '', + :results => results + } + + @ceedling[:plugin_reportinator].run_test_results_report(hash) do + message = '' + message = 'Unit test failures.' if (hash[:results[:counts][:failed] > 0) + message + end + end + + def summary + result_list = @ceedling[:file_path_utils].form_pass_results_filelist( PROJECT_TEST_RESULTS_PATH, COLLECTION_ALL_TESTS ) + + # get test results for only those tests in our configuration and of those only tests with results on disk + hash = { + :header => '', + :results => @ceedling[:plugin_reportinator].assemble_test_results(result_list, {:boom => false}) + } + + @ceedling[:plugin_reportinator].run_test_results_report(hash) + end + +end \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/plugins/stdout_ide_tests_report/stdout_ide_tests_report.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/plugins/stdout_ide_tests_report/stdout_ide_tests_report.yml new file mode 100644 index 0000000..c25acf5 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/plugins/stdout_ide_tests_report/stdout_ide_tests_report.yml @@ -0,0 +1,4 @@ +--- +:plugins: + # tell Ceedling we got results display taken care of + :display_raw_test_results: FALSE diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/plugins/stdout_pretty_tests_report/stdout_pretty_tests_report.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/plugins/stdout_pretty_tests_report/stdout_pretty_tests_report.rb new file mode 100644 index 0000000..1213a19 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/plugins/stdout_pretty_tests_report/stdout_pretty_tests_report.rb @@ -0,0 +1,108 @@ +require 'plugin' +require 'defaults' + +class StdoutPrettyTestsReport < Plugin + + def setup + @result_list = [] + + template = %q{ + % ignored = hash[:results][:counts][:ignored] + % failed = hash[:results][:counts][:failed] + % stdout_count = hash[:results][:counts][:stdout] + % header_prepend = ((hash[:header].length > 0) ? "#{hash[:header]}: " : '') + % banner_width = 25 + header_prepend.length # widest message + + % if (ignored > 0) + <%=@ceedling[:plugin_reportinator].generate_banner(header_prepend + 'IGNORED UNIT TEST SUMMARY')%> + % hash[:results][:ignores].each do |ignore| + [<%=ignore[:source][:file]%>] + % ignore[:collection].each do |item| + Test: <%=item[:test]%> + % if (not item[:message].empty?) + At line (<%=item[:line]%>): "<%=item[:message]%>" + % else + At line (<%=item[:line]%>) + % end + + % end + % end + % end + % if (failed > 0) + <%=@ceedling[:plugin_reportinator].generate_banner(header_prepend + 'FAILED UNIT TEST SUMMARY')%> + % hash[:results][:failures].each do |failure| + [<%=failure[:source][:file]%>] + % failure[:collection].each do |item| + Test: <%=item[:test]%> + % if (not item[:message].empty?) + At line (<%=item[:line]%>): "<%=item[:message]%>" + % else + At line (<%=item[:line]%>) + % end + + % end + % end + % end + % if (stdout_count > 0) + <%=@ceedling[:plugin_reportinator].generate_banner(header_prepend + 'UNIT TEST OTHER OUTPUT')%> + % hash[:results][:stdout].each do |string| + [<%=string[:source][:file]%>] + % string[:collection].each do |item| + - "<%=item%>" + % end + + % end + % end + % total_string = hash[:results][:counts][:total].to_s + % format_string = "%#{total_string.length}i" + <%=@ceedling[:plugin_reportinator].generate_banner(header_prepend + 'OVERALL UNIT TEST SUMMARY')%> + % if (hash[:results][:counts][:total] > 0) + TESTED: <%=hash[:results][:counts][:total].to_s%> + PASSED: <%=sprintf(format_string, hash[:results][:counts][:passed])%> + FAILED: <%=sprintf(format_string, failed)%> + IGNORED: <%=sprintf(format_string, ignored)%> + % else + + No tests executed. + % end + + }.left_margin + + @ceedling[:plugin_reportinator].register_test_results_template( template ) + end + + def post_test_execute(arg_hash) + return if not (arg_hash[:context] == TEST_CONTEXT) + + @result_list << arg_hash[:result_file] + end + + def post_build + return if not (@ceedling[:task_invoker].test_invoked?) + + results = @ceedling[:plugin_reportinator].assemble_test_results(@result_list) + hash = { + :header => '', + :results => results + } + + @ceedling[:plugin_reportinator].run_test_results_report(hash) do + message = '' + message = 'Unit test failures.' if (results[:counts][:failed] > 0) + message + end + end + + def summary + result_list = @ceedling[:file_path_utils].form_pass_results_filelist( PROJECT_TEST_RESULTS_PATH, COLLECTION_ALL_TESTS ) + + # get test results for only those tests in our configuration and of those only tests with results on disk + hash = { + :header => '', + :results => @ceedling[:plugin_reportinator].assemble_test_results(result_list, {:boom => false}) + } + + @ceedling[:plugin_reportinator].run_test_results_report(hash) + end + +end \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/plugins/stdout_pretty_tests_report/stdout_pretty_tests_report.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/plugins/stdout_pretty_tests_report/stdout_pretty_tests_report.yml new file mode 100644 index 0000000..c25acf5 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/plugins/stdout_pretty_tests_report/stdout_pretty_tests_report.yml @@ -0,0 +1,4 @@ +--- +:plugins: + # tell Ceedling we got results display taken care of + :display_raw_test_results: FALSE diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/plugins/xml_tests_report/xml_tests_report.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/plugins/xml_tests_report/xml_tests_report.rb new file mode 100644 index 0000000..4aa4f77 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/plugins/xml_tests_report/xml_tests_report.rb @@ -0,0 +1,106 @@ +require 'plugin' +require 'constants' + +class XmlTestsReport < Plugin + + def setup + @file_path = File.join( PROJECT_TEST_ARTIFACTS_PATH, 'report.xml' ) + @results_list = [] + @test_counter = 1 + end + + def post_test_execute(arg_hash) + return if not (arg_hash[:context] == TEST_TASKS_CONTEXT) + + @results_list << arg_hash[:result_file] + end + + def post_build + return if (not @ceedling[:task_invoker].test_invoked?) + + results = @ceedling[:plugin_reportinator].assemble_test_results(@results_list) + + @ceedling[:file_wrapper].open( @file_path, 'w' ) do |f| + write_results( results, f ) + end + end + + private + + def write_results( results, stream ) + write_header( stream ) + write_failures( results[:failures], stream ) + write_tests( results[:successes], stream, 'SuccessfulTests' ) + write_tests( results[:ignores], stream, 'IgnoredTests' ) + write_statistics( results[:counts], stream ) + write_footer( stream ) + end + + def write_header( stream ) + stream.puts "" + stream.puts "" + end + + def write_failures( results, stream ) + if (results.size == 0) + stream.puts "\t" + return + end + + stream.puts "\t" + + results.each do |result| + result[:collection].each do |item| + filename = File.join( result[:source][:path], result[:source][:file] ) + + stream.puts "\t\t" + stream.puts "\t\t\t#{filename}::#{item[:test]}" + stream.puts "\t\t\tAssertion" + stream.puts "\t\t\t" + stream.puts "\t\t\t\t#{filename}" + stream.puts "\t\t\t\t#{item[:line]}" + stream.puts "\t\t\t" + stream.puts "\t\t\t#{item[:message]}" + stream.puts "\t\t" + @test_counter += 1 + end + end + + stream.puts "\t" + end + + def write_tests( results, stream, tag ) + if (results.size == 0) + stream.puts "\t<#{tag}/>" + return + end + + stream.puts "\t<#{tag}>" + + results.each do |result| + result[:collection].each do |item| + stream.puts "\t\t" + stream.puts "\t\t\t#{File.join( result[:source][:path], result[:source][:file] )}::#{item[:test]}" + stream.puts "\t\t" + @test_counter += 1 + end + end + + stream.puts "\t" + end + + def write_statistics( counts, stream ) + stream.puts "\t" + stream.puts "\t\t#{counts[:total]}" + stream.puts "\t\t#{counts[:ignored]}" + stream.puts "\t\t#{counts[:failed]}" + stream.puts "\t\t0" + stream.puts "\t\t#{counts[:failed]}" + stream.puts "\t" + end + + def write_footer( stream ) + stream.puts "" + end + +end \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/release/build.info b/flex-bison/clcalc/modules/common-includes/tools/ceedling/release/build.info new file mode 100644 index 0000000..fa8f08c --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/release/build.info @@ -0,0 +1 @@ +150 diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/release/version.info b/flex-bison/clcalc/modules/common-includes/tools/ceedling/release/version.info new file mode 100644 index 0000000..9a7d84f --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/release/version.info @@ -0,0 +1 @@ +0.9 \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/behaviors/Manifest.txt b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/behaviors/Manifest.txt new file mode 100644 index 0000000..6c954ec --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/behaviors/Manifest.txt @@ -0,0 +1,9 @@ +Manifest.txt +Rakefile +lib/behaviors.rb +lib/behaviors/reporttask.rb +test/behaviors_tasks_test.rb +test/behaviors_test.rb +test/tasks_test/lib/user.rb +test/tasks_test/Rakefile +test/tasks_test/test/user_test.rb diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/behaviors/Rakefile b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/behaviors/Rakefile new file mode 100644 index 0000000..d4d68b9 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/behaviors/Rakefile @@ -0,0 +1,19 @@ +require 'rake' +require 'rubygems' +require 'hoe' + +Hoe.new('behaviors','1.0.3') do |p| + p.author = "Atomic Object LLC" + p.email = "dev@atomicobject.com" + p.url = "http://behaviors.rubyforge.org" + p.summary = "behavior-driven unit test helper" + p.description = <<-EOS +Behaviors allows for Test::Unit test case methods to be defined as +human-readable descriptions of program behavior. It also provides +Rake tasks to list the behaviors of your project. + EOS + p.test_globs = ['test/*_test.rb'] + + p.changes = <<-EOS + EOS +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/behaviors/lib/behaviors.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/behaviors/lib/behaviors.rb new file mode 100644 index 0000000..d8d70f7 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/behaviors/lib/behaviors.rb @@ -0,0 +1,76 @@ +=begin rdoc += Usage +Behaviors provides a single method: should. + +Instead of naming test methods like: + + def test_something + end + +You declare test methods like: + + should "perform action" do + end + +You may omit the body of a should method to describe unimplemented behavior. + + should "perform other action" + +When you run your unit tests, empty should methods will appear as an 'UNIMPLEMENTED CASE' along with the described behavior. +This is useful for sketching out planned behavior quickly. + +Simply extend Behaviors in your TestCase to start using behaviors. + + require 'test/unit' + require 'behaviors' + require 'user' + + class UserTest < Test::Unit::TestCase + extend Behaviors + ... + end + += Motivation +Test methods typically focus on the name of the method under test instead of its behavior. +Creating test methods with should statements focuses on the behavior of an object. +This helps you to think about the role of the object under test. + +Using a behavior-driven approach prevents the danger in assuming a one-to-one mapping of method names to +test method names. +As always, you get the most value by writing the tests first. + +For a more complete BDD framework, try RSpec http://rspec.rubyforge.org/ + += Rake tasks + +You can define a Behaviors::ReportTask in your Rakefile to generate rake tasks that +summarize the behavior of your project. + +These tasks are named behaviors and behaviors_html. They will output to the +console or an html file in the doc directory with a list all of your should tests. + Behaviors::ReportTask.new do |t| + t.pattern = 'test/**/*_test.rb' + end + +You may also initialize the ReportTask with a custom name to associate with a particular suite of tests. + Behaviors::ReportTask.new(:widget_subsystem) do |t| + t.pattern = 'test/widgets/*_test.rb' + end + +The html report will be placed in the doc directory by default. +You can override this default by setting the html_dir in the ReportTask. + Behaviors::ReportTask.new do |t| + t.pattern = 'test/**/*_test.rb' + t.html_dir = 'behaviors_html_reports' + end +=end +module Behaviors + def should(behave,&block) + mname = "test_should_#{behave}" + if block + define_method mname, &block + else + puts ">>> UNIMPLEMENTED CASE: #{name.sub(/Test$/,'')} should #{behave}" + end + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/behaviors/lib/behaviors/reporttask.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/behaviors/lib/behaviors/reporttask.rb new file mode 100644 index 0000000..51c0eca --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/behaviors/lib/behaviors/reporttask.rb @@ -0,0 +1,158 @@ +require 'rake' +require 'rake/tasklib' + +module Behaviors +include Rake + + class ReportTask < TaskLib + attr_accessor :pattern + attr_accessor :html_dir + + def initialize(name=:behaviors) + @name = name + @html_dir = 'doc' + yield self if block_given? + define + end + + def define + desc "List behavioral definitions for the classes specified (use for= to further limit files included in report)" + task @name do + specifications.each do |spec| + puts "#{spec.name} should:\n" + spec.requirements.each do |req| + puts " - #{req}" + end + end + end + + desc "Generate html report of behavioral definitions for the classes specified (use for= to further limit files included in report)" + task "#{@name}_html" do + require 'erb' + txt =<<-EOS + + + + + +
Specifications
+<% specifications.each do |spec| %> +
+<%= spec.name %> should: +
    +<% spec.requirements.each do |req| %> +
  • <%= req %>
  • +<% end %> +
+
+<% end %> + + + EOS + output_dir = File.expand_path(@html_dir) + mkdir_p output_dir + output_filename = output_dir + "/behaviors.html" + File.open(output_filename,"w") do |f| + f.write ERB.new(txt).result(binding) + end + puts "(Wrote #{output_filename})" + end + end + + private + def test_files + test_list = FileList[@pattern] + if ENV['for'] + test_list = test_list.grep(/#{ENV['for']}/i) + end + test_list + end + + def specifications + test_files.map do |file| + spec = OpenStruct.new + m = %r".*/([^/].*)_test.rb".match(file) + class_name = titleize(m[1]) if m[1] + spec.name = class_name + spec.requirements = [] + File::readlines(file).each do |line| + if line =~ /^\s*should\s+\(?\s*["'](.*)["']/ + spec.requirements << $1 + end + end + spec + end + end + + ############################################################ + # STOLEN FROM inflector.rb + ############################################################ + #-- + # Copyright (c) 2005 David Heinemeier Hansson + # + # Permission is hereby granted, free of charge, to any person obtaining + # a copy of this software and associated documentation files (the + # "Software"), to deal in the Software without restriction, including + # without limitation the rights to use, copy, modify, merge, publish, + # distribute, sublicense, and/or sell copies of the Software, and to + # permit persons to whom the Software is furnished to do so, subject to + # the following conditions: + # + # The above copyright notice and this permission notice shall be + # included in all copies or substantial portions of the Software. + # + # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + #++ + def titleize(word) + humanize(underscore(word)).gsub(/\b([a-z])/) { $1.capitalize } + end + + def underscore(camel_cased_word) camel_cased_word.to_s.gsub(/::/, '/'). + gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').gsub(/([a-z\d])([A-Z])/,'\1_\2').tr("-", "_").downcase + end + + def humanize(lower_case_and_underscored_word) + lower_case_and_underscored_word.to_s.gsub(/_id$/, "").gsub(/_/, " ").capitalize + end + + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/behaviors/test/behaviors_tasks_test.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/behaviors/test/behaviors_tasks_test.rb new file mode 100644 index 0000000..9382e07 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/behaviors/test/behaviors_tasks_test.rb @@ -0,0 +1,73 @@ +require 'test/unit' +require 'fileutils' + +class BehaviorsTasksTest < Test::Unit::TestCase + include FileUtils + + def setup + @here = File.expand_path(File.dirname(__FILE__)) + @base_cmd = RUBY_PLATFORM[/mswin/] ? 'rake.cmd ' : 'rake ' + end + + # + # HELPERS + # + def run_behaviors_task + run_cmd "behaviors" + end + + def run_behaviors_html_task + run_cmd "behaviors_html" + end + + def run_cmd(cmd) + cd "#{@here}/tasks_test" do + @report = %x[ #{@base_cmd} #{cmd} ] + end + end + + def see_html_task_output_message + @html_output_filename = "#{@here}/tasks_test/behaviors_doc/behaviors.html" + assert_match(/Wrote #{@html_output_filename}/, @report) + end + + def see_that_html_report_file_exits + assert File.exists?(@html_output_filename), "html output file should exist" + end + + def html_report_file_should_contain(user_behaviors) + file_contents = File.read(@html_output_filename) + user_behaviors.each do |line| + assert_match(/#{line}/, file_contents) + end + rm_rf File.dirname(@html_output_filename) + end + + # + # TESTS + # + def test_that_behaviors_tasks_should_list_behavioral_definitions_for_the_classes_under_test + run_behaviors_task + user_behaviors = [ + "User should:", + " - be able set user name and age during construction", + " - be able to get user name and age", + " - be able to ask if a user is an adult" + ] + assert_match(/#{user_behaviors.join("\n")}/, @report) + end + + def test_that_behaviors_tasks_should_list_behavioral_definitions_for_the_classes_under_test_in_html_output + run_behaviors_html_task + see_html_task_output_message + see_that_html_report_file_exits + user_behaviors = [ + "User should:", + "be able set user name and age during construction", + "be able to get user name and age", + "be able to ask if a user is an adult" + ] + html_report_file_should_contain user_behaviors + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/behaviors/test/behaviors_test.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/behaviors/test/behaviors_test.rb new file mode 100644 index 0000000..fd0a77f --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/behaviors/test/behaviors_test.rb @@ -0,0 +1,50 @@ +require 'test/unit' +require File.expand_path(File.dirname(__FILE__)) + '/../lib/behaviors' +require 'stringio' + +loading_developer_test_class_stdout = StringIO.new +saved_stdout = $stdout.dup +$stdout = loading_developer_test_class_stdout + +class DeveloperTest + extend Behaviors + attr_accessor :flunk_msg, :tested_code + + should "test their code" do + @tested_code = true + end + should "go to meetings" +end + +$stdout = saved_stdout +loading_developer_test_class_stdout.rewind +$loading_developer_test_class_output = loading_developer_test_class_stdout.read + +class BehaviorsTest < Test::Unit::TestCase + + + def setup + @target = DeveloperTest.new + assert_nil @target.tested_code, "block called too early" + end + + # + # TESTS + # + def test_should_called_with_a_block_defines_a_test + assert @target.methods.include?("test_should_test their code"), "Missing test method" + + @target.send("test_should_test their code") + + assert @target.tested_code, "block not called" + end + + def test_should_called_without_a_block_does_not_create_a_test_method + assert !@target.methods.include?("test_should_go to meetings"), "Should not have method" + end + + def test_should_called_without_a_block_will_give_unimplemented_output_when_class_loads + unimplemented_output = "UNIMPLEMENTED CASE: Developer should go to meetings" + assert_match(/#{unimplemented_output}/, $loading_developer_test_class_output) + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/behaviors/test/tasks_test/Rakefile b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/behaviors/test/tasks_test/Rakefile new file mode 100644 index 0000000..ba71f71 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/behaviors/test/tasks_test/Rakefile @@ -0,0 +1,19 @@ +require 'rake' +require 'rake/testtask' + +here = File.expand_path(File.dirname(__FILE__)) +require "#{here}/../../lib/behaviors/reporttask" + +desc 'Default: run unit tests.' +task :default => :test + +Rake::TestTask.new(:test) do |t| + t.libs << "#{here}/../../lib" + t.pattern = 'test/**/*_test.rb' + t.verbose = true +end + +Behaviors::ReportTask.new(:behaviors) do |t| + t.pattern = 'test/**/*_test.rb' + t.html_dir = 'behaviors_doc' +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/behaviors/test/tasks_test/lib/user.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/behaviors/test/tasks_test/lib/user.rb new file mode 100644 index 0000000..40bc07c --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/behaviors/test/tasks_test/lib/user.rb @@ -0,0 +1,2 @@ +class User +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/behaviors/test/tasks_test/test/user_test.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/behaviors/test/tasks_test/test/user_test.rb new file mode 100644 index 0000000..ad3cd1b --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/behaviors/test/tasks_test/test/user_test.rb @@ -0,0 +1,17 @@ +require 'test/unit' +require 'behaviors' + +require 'user' + +class UserTest < Test::Unit::TestCase + extend Behaviors + + def setup + end + + should "be able set user name and age during construction" + should "be able to get user name and age" + should "be able to ask if a user is an adult" + def test_DELETEME + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/docs/CExceptionSummary.odt b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/docs/CExceptionSummary.odt new file mode 100644 index 0000000..ea852a0 Binary files /dev/null and b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/docs/CExceptionSummary.odt differ diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/docs/CExceptionSummary.pdf b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/docs/CExceptionSummary.pdf new file mode 100644 index 0000000..a838337 Binary files /dev/null and b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/docs/CExceptionSummary.pdf differ diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/docs/license.txt b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/docs/license.txt new file mode 100644 index 0000000..561e5f2 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/docs/license.txt @@ -0,0 +1,30 @@ + Copyright (c) 2007 Mark VanderVoord + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + The end-user documentation included with the redistribution, if + any, must include the following acknowledgment: "This product + includes software developed for the CEXCeption Project, by Mark + VanderVoord and other contributors", in the same place and form + as other third-party acknowledgments. Alternately, this + acknowledgment may appear in the software itself, in the same + form and location as other such third-party acknowledgments. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/docs/readme.txt b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/docs/readme.txt new file mode 100644 index 0000000..92cac38 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/docs/readme.txt @@ -0,0 +1,236 @@ +==================================================================== +CException +==================================================================== + +CException is a basic exception framework for C, suitable for use in +embedded applications. It provides an exception framework similar in +use to C++, but with much less overhead. + +CException uses C standard library functions setjmp and longjmp to +operate. As long as the target system has these two functions defined, +this library should be useable with very little configuration. It +even supports environments where multiple program flows are in use, +such as real-time operating systems. + +There are about a gabillion exception frameworks using a similar +setjmp/longjmp method out there... and there will probably be more +in the future. Unfortunately, when we started our last embedded +project, all those that existed either (a) did not support multiple +tasks (therefore multiple stacks) or (b) were way more complex than +we really wanted. CException was born. + +Why use CException? + +0. It's ANSI C, and it beats passing error codes around. + +1. You want something simple... CException throws a single id. You can + define those ID's to be whatever you like. You might even choose which + type that number is for your project. But that's as far as it goes. + We weren't interested in passing objects or structs or strings... + just simple error codes. + +2. Performance... CException can be configured for single tasking or + multitasking. In single tasking, there is very little overhead past + the setjmp/longjmp calls (which are already fast). In multitasking, + your only additional overhead is the time it takes you to determine + a unique task id 0 - num_tasks. + +For the latest version, go to http://cexception.sourceforge.net + +-------------------------------------------------------------------- +CONTENTS OF THIS DOCUMENT +-------------------------------------------------------------------- + +Usage +Limitations +API +Configuration +Testing +License + +-------------------------------------------------------------------- +Usage +-------------------------------------------------------------------- + +Code that is to be protected are wrapped in Try { } Catch { } blocks. +The code directly following the Try call is "protected", meaning that +if any Throws occur, program control is directly transferred to the +start of the Catch block. + +A numerical exception ID is included with Throw, and is made accessible +from the Catch block. + +Throws can occur from within function calls (nested as deeply as you +like) or directly from within the function itself. + +-------------------------------------------------------------------- +Limitations +-------------------------------------------------------------------- + +This library was made to be as fast as possible, and provide basic +exception handling. It is not a full-blown exception library. Because +of this, there are a few limitations that should be observed in order +to successfully utilize this library: + +1. Do not directly "return" from within a Try block, nor "goto" + into or out of a Try block. + + Why? + + The "Try" macro allocates some local memory and alters a global + pointer. These are cleaned up at the top of the "Catch" macro. + Gotos and returns would bypass some of these steps, resulting in + memory leaks or unpredictable behavior. + +2. If (a) you change local (stack) variables within your Try block, + AND (b) wish to make use of the updated values after an exception + is thrown, those variables should be made volatile. Note that this + is ONLY for locals and ONLY when you need access to them after a + throw. + + Why? + + Compilers optimize. There is no way to guarantee that the actual + memory location was updated and not just a register unless the + variable is marked volatile. + +3. Memory which is malloc'd or new'd is not automatically released + when an error is thrown. This will sometimes be desirable, and + othertimes may not. It will be the responsibility of the Catch + block to perform this kind of cleanup. + + Why? + + There's just no easy way to track malloc'd memory, etc., without + replacing or wrapping malloc calls or something like that. This + is a light framework, so these options were not desirable. + +-------------------------------------------------------------------- +API +-------------------------------------------------------------------- + +Try +--- + +Try is a macro which starts a protected block. It MUST be followed by +a pair of braces or a single protected line (similar to an 'if'), +enclosing the data that is to be protected. It MUST be followed by a +Catch block (don't worry, you'll get compiler errors to let you know if +you mess any of that up). + +Catch(e) +-------- + +Catch is a macro which ends the Try block and starts the error handling +block. The catch block is called if and only if an exception was thrown +while within the Try block. This error was thrown by a Throw call +somewhere within Try (or within a function called within Try, or a function +called by a function called within Try, etc). + +The single parameter 'e' is filled with the error code which was thrown. +This can be used for reporting, conditional cleanup, etc. (or you can just +ignore it if you really want... people ignore return codes all the time, +right?). 'e' should be of type EXCEPTION_T; + +Throw(e) +-------- + +The method of throwing an error. Throws should only occur from within a +protected (Try...Catch) block, though it may easily be nested many function +calls deep without an impact on performance or functionality. Throw takes +a single argument, which is an exception id which will be passed to Catch +as the reason for the error. + +If you wish to Rethrow an error, this can be done by calling Throw(e) with +the error code you just caught. It IS valid to throw from a catch block. + +-------------------------------------------------------------------- +CONFIGURATION +-------------------------------------------------------------------- + +CException is a mostly portable library. It has one universal +dependency, and some macros which are required if working in a +multi-tasking environment. + +1. The standard C library setjmp must be available. Since this is part + of the standard library, chances are good that you'll be fine. + +2. If working in a multitasking environment, methods for obtaining an + index into an array of frames and to get the overall number of + id's are required. If the OS supports a method to retrieve Task + ID's, and those Tasks are number 0, 1, 2... you are in an ideal + situation. Otherwise, a more creative mapping function may be + required. Note that this function is likely to be called twice + for each protected block and once during a throw. This is the + only overhead in the system. + +Exception.h +----------------- +By convention, most projects include Exception.h which defines any +further requirements, then calls CException.h to do the gruntwork. All +of these are optional. You could directly include CException.h if +you wanted and just use the defaults provided. + +EXCEPTION_T - Set this to the type you want your exception id's + to be. Defaults to 'unsigned int'. + +EXCEPTION_NONE - Set this to a number which will never be an + exception id in your system. Defaults to 0x5a5a5a5a. + +EXCEPTION_GET_ID - If in a multi-tasking environment, this should be + set to be a call to the function described in #2 above. + Defaults to just return 0 all the time (good for + single tasking environments) + +EXCEPTION_NUM_ID - If in a multi-tasking environment, this should be set + to the number of ID's required (usually the number of + tasks in the system). Defaults to 1 (for single + tasking environments). + +You may also want to include any header files which will commonly be +needed by the rest of your application where it uses exception handling +here. For example, OS header files or exception codes would be useful. + +-------------------------------------------------------------------- +TESTING +-------------------------------------------------------------------- + +If you want to validate that CException works with your tools or that +it works with your custom configuration, you may want to run the test +suite. + +The test suite included makes use of the Unity Test Framework. It will +require a native C compiler. The example makefile uses MinGW's gcc. +Modify the makefile to include the proper paths to tools, then run 'make' +to compile and run the test application. + +C_COMPILER - The C compiler to use to perform the tests +C_LIBS - The path to the C libraries (including setjmp) +UNITY_DIR - The path to the Unity framework (required to run tests) + (get it at http://embunity.sourceforge.net) + +-------------------------------------------------------------------- +LICENSE +-------------------------------------------------------------------- + +This software is licensed under the MIT License + +Copyright (c) 2007 Mark VanderVoord + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/lib/CException.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/lib/CException.c new file mode 100644 index 0000000..57f5353 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/lib/CException.c @@ -0,0 +1,39 @@ +#include "CException.h" + +volatile CEXCEPTION_FRAME_T CExceptionFrames[CEXCEPTION_NUM_ID]; + +//------------------------------------------------------------------------------------------ +// Throw +//------------------------------------------------------------------------------------------ +void Throw(CEXCEPTION_T ExceptionID) +{ + unsigned int MY_ID = CEXCEPTION_GET_ID; + CExceptionFrames[MY_ID].Exception = ExceptionID; + longjmp(*CExceptionFrames[MY_ID].pFrame, 1); +} + +//------------------------------------------------------------------------------------------ +// Explaination of what it's all for: +//------------------------------------------------------------------------------------------ +/* +#define Try + { <- give us some local scope. most compilers are happy with this + jmp_buf *PrevFrame, NewFrame; <- prev frame points to the last try block's frame. new frame gets created on stack for this Try block + unsigned int MY_ID = CEXCEPTION_GET_ID; <- look up this task's id for use in frame array. always 0 if single-tasking + PrevFrame = CExceptionFrames[CEXCEPTION_GET_ID].pFrame; <- set pointer to point at old frame (which array is currently pointing at) + CExceptionFrames[MY_ID].pFrame = &NewFrame; <- set array to point at my new frame instead, now + CExceptionFrames[MY_ID].Exception = CEXCEPTION_NONE; <- initialize my exception id to be NONE + if (setjmp(NewFrame) == 0) { <- do setjmp. it returns 1 if longjump called, otherwise 0 + if (&PrevFrame) <- this is here to force proper scoping. it requires braces or a single line to be but after Try, otherwise won't compile. This is always true at this point. + +#define Catch(e) + else { } <- this also forces proper scoping. Without this they could stick their own 'else' in and it would get ugly + CExceptionFrames[MY_ID].Exception = CEXCEPTION_NONE; <- no errors happened, so just set the exception id to NONE (in case it was corrupted) + } + else <- an exception occurred + { e = CExceptionFrames[MY_ID].Exception; e=e;} <- assign the caught exception id to the variable passed in. + CExceptionFrames[MY_ID].pFrame = PrevFrame; <- make the pointer in the array point at the previous frame again, as if NewFrame never existed. + } <- finish off that local scope we created to have our own variables + if (CExceptionFrames[CEXCEPTION_GET_ID].Exception != CEXCEPTION_NONE) <- start the actual 'catch' processing if we have an exception id saved away + */ + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/lib/CException.h b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/lib/CException.h new file mode 100644 index 0000000..40c6fc7 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/lib/CException.h @@ -0,0 +1,70 @@ +#ifndef _CEXCEPTION_H +#define _CEXCEPTION_H + +#include + +//To Use CException, you have a number of options: +//1. Just include it and run with the defaults +//2. Define any of the following symbols at the command line to override them +//3. Include a header file before CException.h everywhere which defines any of these +//4. Create an Exception.h in your path, and just define EXCEPTION_USE_CONFIG_FILE first + +#ifdef CEXCEPTION_USE_CONFIG_FILE +#include "CExceptionConfig.h" +#endif + +//This is the value to assign when there isn't an exception +#ifndef CEXCEPTION_NONE +#define CEXCEPTION_NONE (0x5A5A5A5A) +#endif + +//This is number of exception stacks to keep track of (one per task) +#ifndef CEXCEPTION_NUM_ID +#define CEXCEPTION_NUM_ID (1) //there is only the one stack by default +#endif + +//This is the method of getting the current exception stack index (0 if only one stack) +#ifndef CEXCEPTION_GET_ID +#define CEXCEPTION_GET_ID (0) //use the first index always because there is only one anyway +#endif + +//The type to use to store the exception values. +#ifndef CEXCEPTION_T +#define CEXCEPTION_T unsigned int +#endif + +//exception frame structures +typedef struct { + jmp_buf* pFrame; + volatile CEXCEPTION_T Exception; +} CEXCEPTION_FRAME_T; + +//actual root frame storage (only one if single-tasking) +extern volatile CEXCEPTION_FRAME_T CExceptionFrames[]; + +//Try (see C file for explanation) +#define Try \ + { \ + jmp_buf *PrevFrame, NewFrame; \ + unsigned int MY_ID = CEXCEPTION_GET_ID; \ + PrevFrame = CExceptionFrames[CEXCEPTION_GET_ID].pFrame; \ + CExceptionFrames[MY_ID].pFrame = (jmp_buf*)(&NewFrame); \ + CExceptionFrames[MY_ID].Exception = CEXCEPTION_NONE; \ + if (setjmp(NewFrame) == 0) { \ + if (&PrevFrame) + +//Catch (see C file for explanation) +#define Catch(e) \ + else { } \ + CExceptionFrames[MY_ID].Exception = CEXCEPTION_NONE; \ + } \ + else \ + { e = CExceptionFrames[MY_ID].Exception; e=e; } \ + CExceptionFrames[MY_ID].pFrame = PrevFrame; \ + } \ + if (CExceptionFrames[CEXCEPTION_GET_ID].Exception != CEXCEPTION_NONE) + +//Throw an Error +void Throw(CEXCEPTION_T ExceptionID); + +#endif // _CEXCEPTION_H diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/makefile b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/makefile new file mode 100644 index 0000000..c168a41 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/makefile @@ -0,0 +1,24 @@ +#Tool and Lib Locations +C_COMPILER=gcc +C_LIBS=C:/MinGW/lib +UNITY_DIR=vendor/unity/src + +#Test File To Be Created +OUT_FILE=test_cexceptions +ifeq ($(OS),Windows_NT) +OUT_EXTENSION=.exe +else +OUT_EXTENSION=.out +endif + +#Options +SRC_FILES=lib/CException.c test/TestException.c test/TestException_Runner.c $(UNITY_DIR)/unity.c +INC_DIRS=-Ilib -Itest -I$(UNITY_DIR) +LIB_DIRS=-L$(C_LIBS) +SYMBOLS=-DTEST -DEXCEPTION_USE_CONFIG_FILE + +#Default Task: Compile And Run Tests +default: + $(C_COMPILER) $(INC_DIRS) $(LIB_DIRS) $(SYMBOLS) $(SRC_FILES) -o $(OUT_FILE)$(OUT_EXTENSION) + $(OUT_FILE)$(OUT_EXTENSION) + \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/rakefile.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/rakefile.rb new file mode 100644 index 0000000..2458c6f --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/rakefile.rb @@ -0,0 +1,41 @@ +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require HERE+'vendor/unity/auto/colour_reporter.rb' + +#Tool and Lib Locations +C_COMPILER = 'gcc' +C_LIBS = '' +UNITY_DIR = 'vendor/unity/src' + +#Test File To Be Created +OUT_FILE = 'test_cexceptions' +OUT_EXTENSION = '.out' + +#Options +SRC_FILES = "lib/CException.c test/TestException.c test/TestException_Runner.c #{UNITY_DIR}/unity.c" +INC_DIRS = "-Ilib -Itest -I#{UNITY_DIR}" +LIB_DIRS = C_LIBS.empty? ? '' : "-L#{C_LIBS}" +SYMBOLS = '-DTEST -DEXCEPTION_USE_CONFIG_FILE' + +CLEAN.include("#{HERE}*.out") + +task :default => [:clobber, :test] +task :cruise => [:no_color, :default] + +desc "performs a quick set of unit tests to confirm you're ready to go" +task :test do + report "#{C_COMPILER} #{INC_DIRS} #{LIB_DIRS} #{SYMBOLS} #{SRC_FILES} -o #{OUT_FILE}#{OUT_EXTENSION}" + output = `#{C_COMPILER} #{INC_DIRS} #{LIB_DIRS} #{SYMBOLS} #{SRC_FILES} -o #{OUT_FILE}#{OUT_EXTENSION}` + report output + + report "#{HERE}#{OUT_FILE}#{OUT_EXTENSION}" + output = `#{HERE}#{OUT_FILE}#{OUT_EXTENSION}` + report output +end + +task :no_color do + $colour_output = false +end \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/release/build.info b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/release/build.info new file mode 100644 index 0000000..b5794c5 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/release/build.info @@ -0,0 +1,2 @@ +16 + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/release/version.info b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/release/version.info new file mode 100644 index 0000000..cb7e5f6 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/release/version.info @@ -0,0 +1,2 @@ +1.2.0 + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/test/CExceptionConfig.h b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/test/CExceptionConfig.h new file mode 100644 index 0000000..79b085d --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/test/CExceptionConfig.h @@ -0,0 +1,27 @@ +#ifndef _EXCEPTION_H +#define _EXCEPTION_H + +//Optionally define the exception type (something like an int which can be directly assigned) +#define CEXCEPTION_T int + +// Optionally define the reserved value representing NO EXCEPTION +#define CEXCEPTION_NONE (1234) + +// Multi-Tasking environments will need a couple of macros defined to make this library +// properly handle multiple exception stacks. You will need to include and required +// definitions, then define the following macros: +// EXCEPTION_GET_ID - returns the id of the current task indexed 0 to (numtasks - 1) +// EXCEPTION_NUM_ID - returns the number of tasks that might be returned +// +// For example, Quadros might include the following implementation: +#ifndef TEST +#include "OSAPI.h" +#define CEXCEPTION_GET_ID (KS_GetTaskID()) +#define CEXCEPTION_NUM_ID (NTASKS + 1) +#endif + +//This could be a good place to define/include some error ID's: +#define ERROR_ID_EVERYTHING_IS_BROKEN (0x88) +#define ERROR_ID_ONLY_THIS_IS_BROKEN (0x77) + +#endif // _EXCEPTION_H diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/test/TestException.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/test/TestException.c new file mode 100644 index 0000000..704cfdb --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/test/TestException.c @@ -0,0 +1,291 @@ +#include "unity.h" +#include "CException.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void test_BasicTryDoesNothingIfNoThrow(void) +{ + int i; + CEXCEPTION_T e = 0x5a; + + Try + { + i += 1; + } + Catch(e) + { + TEST_FAIL_MESSAGE("Should Not Enter Catch If Not Thrown") + } + + //verify that e was untouched + TEST_ASSERT_EQUAL(0x5a, e); +} + +void test_BasicThrowAndCatch(void) +{ + CEXCEPTION_T e; + + Try + { + Throw(0xBE); + TEST_FAIL_MESSAGE("Should Have Thrown An Error") + } + Catch(e) + { + //verify that e has the right data + TEST_ASSERT_EQUAL(0xBE, e); + } + + //verify that e STILL has the right data + TEST_ASSERT_EQUAL(0xBE, e); +} + +void test_BasicThrowAndCatch_WithMiniSyntax(void) +{ + CEXCEPTION_T e; + + //Mini Throw and Catch + Try + Throw(0xEF); + Catch(e) + TEST_ASSERT_EQUAL(0xEF, e); + TEST_ASSERT_EQUAL(0xEF, e); + + //Mini Passthrough + Try + e = 0; + Catch(e) + TEST_FAIL_MESSAGE("I shouldn't be caught because there was no throw"); + + TEST_ASSERT_EQUAL(0, e); +} + +void test_VerifyVolatilesSurviveThrowAndCatch(void) +{ + volatile unsigned int VolVal = 0; + CEXCEPTION_T e; + + Try + { + VolVal = 2; + Throw(0xBF); + TEST_FAIL_MESSAGE("Should Have Thrown An Error") + } + Catch(e) + { + VolVal += 2; + TEST_ASSERT_EQUAL(0xBF, e); + } + + TEST_ASSERT_EQUAL(4, VolVal); + TEST_ASSERT_EQUAL(0xBF, e); +} + +void HappyExceptionThrower(unsigned int ID) +{ + if (ID != 0) + { + Throw(ID); + } +} + +void test_ThrowFromASubFunctionAndCatchInRootFunc(void) +{ + volatile unsigned int ID = 0; + CEXCEPTION_T e; + + Try + { + + HappyExceptionThrower(0xBA); + TEST_FAIL_MESSAGE("Should Have Thrown An Exception"); + } + Catch(e) + { + ID = e; + } + + //verify that I can pass that value to something else + TEST_ASSERT_EQUAL(0xBA, e); +} + +void HappyExceptionRethrower(unsigned int ID) +{ + CEXCEPTION_T e; + + Try + { + Throw(ID); + } + Catch(e) + { + switch (e) + { + case 0xBD: + Throw(0xBF); + break; + default: + break; + } + } +} + +void test_ThrowAndCatchFromASubFunctionAndRethrowToCatchInRootFunc(void) +{ + volatile unsigned int ID = 0; + CEXCEPTION_T e; + + Try + { + HappyExceptionRethrower(0xBD); + TEST_FAIL_MESSAGE("Should Have Rethrown Exception"); + } + Catch(e) + { + ID = 1; + } + + TEST_ASSERT_EQUAL(0xBF, e); + TEST_ASSERT_EQUAL(1, ID); +} + +void test_ThrowAndCatchFromASubFunctionAndNoRethrowToCatchInRootFunc(void) +{ + CEXCEPTION_T e = 3; + + Try + { + HappyExceptionRethrower(0xBF); + } + Catch(e) + { + TEST_FAIL_MESSAGE("Should Not Have Re-thrown Error (it should have already been caught)"); + } + + //verify that THIS e is still untouched, even though subfunction was touched + TEST_ASSERT_EQUAL(3, e); +} + +void test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThisDoesntCorruptExceptionId(void) +{ + CEXCEPTION_T e; + + Try + { + HappyExceptionThrower(0xBF); + TEST_FAIL_MESSAGE("Should Have Thrown Exception"); + } + Catch(e) + { + TEST_ASSERT_EQUAL(0xBF, e); + HappyExceptionRethrower(0x12); + TEST_ASSERT_EQUAL(0xBF, e); + } + TEST_ASSERT_EQUAL(0xBF, e); +} + +void test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThatEachExceptionIdIndependent(void) +{ + CEXCEPTION_T e1, e2; + + Try + { + HappyExceptionThrower(0xBF); + TEST_FAIL_MESSAGE("Should Have Thrown Exception"); + } + Catch(e1) + { + TEST_ASSERT_EQUAL(0xBF, e1); + Try + { + HappyExceptionThrower(0x12); + } + Catch(e2) + { + TEST_ASSERT_EQUAL(0x12, e2); + } + TEST_ASSERT_EQUAL(0x12, e2); + TEST_ASSERT_EQUAL(0xBF, e1); + } + TEST_ASSERT_EQUAL(0x12, e2); + TEST_ASSERT_EQUAL(0xBF, e1); +} + +void test_CanHaveMultipleTryBlocksInASingleFunction(void) +{ + CEXCEPTION_T e; + + Try + { + HappyExceptionThrower(0x01); + TEST_FAIL_MESSAGE("Should Have Thrown Exception"); + } + Catch(e) + { + TEST_ASSERT_EQUAL(0x01, e); + } + + Try + { + HappyExceptionThrower(0xF0); + TEST_FAIL_MESSAGE("Should Have Thrown Exception"); + } + Catch(e) + { + TEST_ASSERT_EQUAL(0xF0, e); + } +} + +void test_CanHaveNestedTryBlocksInASingleFunction_ThrowInside(void) +{ + int i = 0; + CEXCEPTION_T e; + + Try + { + Try + { + HappyExceptionThrower(0x01); + i = 1; + TEST_FAIL_MESSAGE("Should Have Rethrown Exception"); + } + Catch(e) + { + TEST_ASSERT_EQUAL(0x01, e); + } + } + Catch(e) + { + TEST_FAIL_MESSAGE("Should Have Been Caught By Inside Catch"); + } +} + +void test_CanHaveNestedTryBlocksInASingleFunction_ThrowOutside(void) +{ + int i = 0; + CEXCEPTION_T e; + + Try + { + Try + { + i = 2; + } + Catch(e) + { + TEST_FAIL_MESSAGE("Should NotBe Caught Here"); + } + HappyExceptionThrower(0x01); + TEST_FAIL_MESSAGE("Should Have Rethrown Exception"); + } + Catch(e) + { + TEST_ASSERT_EQUAL(0x01, e); + } +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/test/TestException_Runner.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/test/TestException_Runner.c new file mode 100644 index 0000000..1697a0e --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/test/TestException_Runner.c @@ -0,0 +1,62 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ +#include "unity.h" +#include "CException.h" + +extern void setUp(void); +extern void tearDown(void); + +extern void test_BasicTryDoesNothingIfNoThrow(void); +extern void test_BasicThrowAndCatch(void); +extern void test_BasicThrowAndCatch_WithMiniSyntax(void); +extern void test_VerifyVolatilesSurviveThrowAndCatch(void); +extern void test_ThrowFromASubFunctionAndCatchInRootFunc(void); +extern void test_ThrowAndCatchFromASubFunctionAndRethrowToCatchInRootFunc(void); +extern void test_ThrowAndCatchFromASubFunctionAndNoRethrowToCatchInRootFunc(void); +extern void test_CanHaveMultipleTryBlocksInASingleFunction(void); +extern void test_CanHaveNestedTryBlocksInASingleFunction_ThrowInside(void); +extern void test_CanHaveNestedTryBlocksInASingleFunction_ThrowOutside(void); +extern void test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThisDoesntCorruptExceptionId(void); +extern void test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThatEachExceptionIdIndependent(void); + +static void runTest(UnityTestFunction test) +{ + CEXCEPTION_T e; + if (TEST_PROTECT()) + { + setUp(); + Try + { + test(); + } + Catch(e) + { + TEST_FAIL_MESSAGE("Unexpected exception!") + } + } + tearDown(); +} + + +int main(void) +{ + Unity.TestFile = __FILE__; + UnityBegin(); + + // RUN_TEST calls runTest + RUN_TEST(test_BasicTryDoesNothingIfNoThrow, 12); + RUN_TEST(test_BasicThrowAndCatch, 30); + RUN_TEST(test_BasicThrowAndCatch_WithMiniSyntax, 49); + RUN_TEST(test_VerifyVolatilesSurviveThrowAndCatch, 69); + RUN_TEST(test_ThrowFromASubFunctionAndCatchInRootFunc, 98); + RUN_TEST(test_ThrowAndCatchFromASubFunctionAndRethrowToCatchInRootFunc, 139); + RUN_TEST(test_ThrowAndCatchFromASubFunctionAndNoRethrowToCatchInRootFunc, 158); + RUN_TEST(test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThisDoesntCorruptExceptionId, 175); + RUN_TEST(test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThatEachExceptionIdIndependent, 193); + RUN_TEST(test_CanHaveMultipleTryBlocksInASingleFunction, 220); + RUN_TEST(test_CanHaveNestedTryBlocksInASingleFunction_ThrowInside, 245); + RUN_TEST(test_CanHaveNestedTryBlocksInASingleFunction_ThrowOutside, 269); + + UnityEnd(); + + return 0; +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/auto/colour_prompt.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/auto/colour_prompt.rb new file mode 100644 index 0000000..81003dd --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/auto/colour_prompt.rb @@ -0,0 +1,94 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +if RUBY_PLATFORM =~/(win|w)32$/ + begin + require 'Win32API' + rescue LoadError + puts "ERROR! \"Win32API\" library not found" + puts "\"Win32API\" is required for colour on a windows machine" + puts " try => \"gem install Win32API\" on the command line" + puts + end + # puts + # puts 'Windows Environment Detected...' + # puts 'Win32API Library Found.' + # puts +end + +class ColourCommandLine + def initialize + if RUBY_PLATFORM =~/(win|w)32$/ + get_std_handle = Win32API.new("kernel32", "GetStdHandle", ['L'], 'L') + @set_console_txt_attrb = + Win32API.new("kernel32","SetConsoleTextAttribute",['L','N'], 'I') + @hout = get_std_handle.call(-11) + end + end + + def change_to(new_colour) + if RUBY_PLATFORM =~/(win|w)32$/ + @set_console_txt_attrb.call(@hout,self.win32_colour(new_colour)) + else + "\033[30;#{posix_colour(new_colour)};22m" + end + end + + def win32_colour(colour) + case colour + when :black then 0 + when :dark_blue then 1 + when :dark_green then 2 + when :dark_cyan then 3 + when :dark_red then 4 + when :dark_purple then 5 + when :dark_yellow, :narrative then 6 + when :default_white, :default, :dark_white then 7 + when :silver then 8 + when :blue then 9 + when :green, :success then 10 + when :cyan, :output then 11 + when :red, :failure then 12 + when :purple then 13 + when :yellow then 14 + when :white then 15 + else + 0 + end + end + + def posix_colour(colour) + case colour + when :black then 30 + when :red, :failure then 31 + when :green, :success then 32 + when :yellow then 33 + when :blue, :narrative then 34 + when :purple, :magenta then 35 + when :cyan, :output then 36 + when :white, :default_white, :default then 37 + else + 30 + end + end + + def out_c(mode, colour, str) + case RUBY_PLATFORM + when /(win|w)32$/ + change_to(colour) + $stdout.puts str if mode == :puts + $stdout.print str if mode == :print + change_to(:default_white) + else + $stdout.puts("#{change_to(colour)}#{str}\033[0m") if mode == :puts + $stdout.print("#{change_to(colour)}#{str}\033[0m") if mode == :print + end + end +end # ColourCommandLine + +def colour_puts(role,str) ColourCommandLine.new.out_c(:puts, role, str) end +def colour_print(role,str) ColourCommandLine.new.out_c(:print, role, str) end + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/auto/colour_reporter.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/auto/colour_reporter.rb new file mode 100644 index 0000000..5aa1d27 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/auto/colour_reporter.rb @@ -0,0 +1,39 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require "#{File.expand_path(File.dirname(__FILE__))}/colour_prompt" + +$colour_output = true + +def report(message) + if not $colour_output + $stdout.puts(message) + else + message = message.join('\n') if (message.class == Array) + message.each_line do |line| + line.chomp! + colour = case(line) + when /(?:total\s+)?tests:?\s+(\d+)\s+(?:total\s+)?failures:?\s+\d+\s+Ignored:?/i + ($1.to_i == 0) ? :green : :red + when /PASS/ + :green + when /^OK$/ + :green + when /(?:FAIL|ERROR)/ + :red + when /IGNORE/ + :yellow + when /^(?:Creating|Compiling|Linking)/ + :white + else + :silver + end + colour_puts(colour, line) + end + end + $stdout.flush + $stderr.flush +end \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/auto/generate_config.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/auto/generate_config.yml new file mode 100644 index 0000000..4a5e474 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/auto/generate_config.yml @@ -0,0 +1,36 @@ +#this is a sample configuration file for generate_module +#you would use it by calling generate_module with the -ygenerate_config.yml option +#files like this are useful for customizing generate_module to your environment +:generate_module: + :defaults: + #these defaults are used in place of any missing options at the command line + :path_src: ../src/ + :path_inc: ../src/ + :path_tst: ../test/ + :update_svn: true + :includes: + #use [] for no additional includes, otherwise list the includes on separate lines + :src: + - Defs.h + - Board.h + :inc: [] + :tst: + - Defs.h + - Board.h + - Exception.h + :boilerplates: + #these are inserted at the top of generated files. + #just comment out or remove if not desired. + #use %1$s where you would like the file name to appear (path/extension not included) + :src: | + //------------------------------------------- + // %1$s.c + //------------------------------------------- + :inc: | + //------------------------------------------- + // %1$s.h + //------------------------------------------- + :tst: | + //------------------------------------------- + // Test%1$s.c : Units tests for %1$s.c + //------------------------------------------- diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/auto/generate_module.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/auto/generate_module.rb new file mode 100644 index 0000000..3db1a98 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/auto/generate_module.rb @@ -0,0 +1,202 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +# This script creates all the files with start code necessary for a new module. +# A simple module only requires a source file, header file, and test file. +# Triad modules require a source, header, and test file for each triad type (like model, conductor, and hardware). + +require 'rubygems' +require 'fileutils' + +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +#help text when requested +HELP_TEXT = [ "\nGENERATE MODULE\n-------- ------", + "\nUsage: ruby generate_module [options] module_name", + " -i\"include\" sets the path to output headers to 'include' (DEFAULT ../src)", + " -s\"../src\" sets the path to output source to '../src' (DEFAULT ../src)", + " -t\"C:/test\" sets the path to output source to 'C:/test' (DEFAULT ../test)", + " -p\"MCH\" sets the output pattern to MCH.", + " dh - driver hardware.", + " dih - driver interrupt hardware.", + " mch - model conductor hardware.", + " mvp - model view presenter.", + " src - just a single source module. (DEFAULT)", + " -d destroy module instead of creating it.", + " -u update subversion too (requires subversion command line)", + " -y\"my.yml\" selects a different yaml config file for module generation", + "" ].join("\n") + +#Built in patterns +PATTERNS = { 'src' => {'' => { :inc => [] } }, + 'dh' => {'Driver' => { :inc => ['%1$sHardware.h'] }, + 'Hardware' => { :inc => [] } + }, + 'dih' => {'Driver' => { :inc => ['%1$sHardware.h', '%1$sInterrupt.h'] }, + 'Interrupt'=> { :inc => ['%1$sHardware.h'] }, + 'Hardware' => { :inc => [] } + }, + 'mch' => {'Model' => { :inc => [] }, + 'Conductor'=> { :inc => ['%1$sModel.h', '%1$sHardware.h'] }, + 'Hardware' => { :inc => [] } + }, + 'mvp' => {'Model' => { :inc => [] }, + 'Presenter'=> { :inc => ['%1$sModel.h', '%1$sView.h'] }, + 'View' => { :inc => [] } + } + } + +#TEMPLATE_TST +TEMPLATE_TST = %q[#include "unity.h" +%2$s#include "%1$s.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void test_%1$s_NeedToImplement(void) +{ + TEST_IGNORE(); +} +] + +#TEMPLATE_SRC +TEMPLATE_SRC = %q[%2$s#include "%1$s.h" +] + +#TEMPLATE_INC +TEMPLATE_INC = %q[#ifndef _%3$s_H +#define _%3$s_H%2$s + +#endif // _%3$s_H +] + +# Parse the command line parameters. +ARGV.each do |arg| + case(arg) + when /^-d/ then @destroy = true + when /^-u/ then @update_svn = true + when /^-p(\w+)/ then @pattern = $1 + when /^-s(.+)/ then @path_src = $1 + when /^-i(.+)/ then @path_inc = $1 + when /^-t(.+)/ then @path_tst = $1 + when /^-y(.+)/ then @yaml_config = $1 + when /^(\w+)/ + raise "ERROR: You can't have more than one Module name specified!" unless @module_name.nil? + @module_name = arg + when /^-(h|-help)/ + puts HELP_TEXT + exit + else + raise "ERROR: Unknown option specified '#{arg}'" + end +end +raise "ERROR: You must have a Module name specified! (use option -h for help)" if @module_name.nil? + +#load yaml file if one was requested +if @yaml_config + require 'yaml' + cfg = YAML.load_file(HERE + @yaml_config)[:generate_module] + @path_src = cfg[:defaults][:path_src] if @path_src.nil? + @path_inc = cfg[:defaults][:path_inc] if @path_inc.nil? + @path_tst = cfg[:defaults][:path_tst] if @path_tst.nil? + @update_svn = cfg[:defaults][:update_svn] if @update_svn.nil? + @extra_inc = cfg[:includes] + @boilerplates = cfg[:boilerplates] +else + @boilerplates = {} +end + +# Create default file paths if none were provided +@path_src = HERE + "../src/" if @path_src.nil? +@path_inc = @path_src if @path_inc.nil? +@path_tst = HERE + "../test/" if @path_tst.nil? +@path_src += '/' unless (@path_src[-1] == 47) +@path_inc += '/' unless (@path_inc[-1] == 47) +@path_tst += '/' unless (@path_tst[-1] == 47) +@pattern = 'src' if @pattern.nil? +@includes = { :src => [], :inc => [], :tst => [] } +@includes.merge!(@extra_inc) unless @extra_inc.nil? + +#create triad definition +TRIAD = [ { :ext => '.c', :path => @path_src, :template => TEMPLATE_SRC, :inc => :src, :boilerplate => @boilerplates[:src] }, + { :ext => '.h', :path => @path_inc, :template => TEMPLATE_INC, :inc => :inc, :boilerplate => @boilerplates[:inc] }, + { :ext => '.c', :path => @path_tst+'Test', :template => TEMPLATE_TST, :inc => :tst, :boilerplate => @boilerplates[:tst] }, + ] + +#prepare the pattern for use +@patterns = PATTERNS[@pattern.downcase] +raise "ERROR: The design pattern specified isn't one that I recognize!" if @patterns.nil? + +# Assemble the path/names of the files we need to work with. +files = [] +TRIAD.each do |triad| + @patterns.each_pair do |pattern_file, pattern_traits| + files << { + :path => "#{triad[:path]}#{@module_name}#{pattern_file}#{triad[:ext]}", + :name => "#{@module_name}#{pattern_file}", + :template => triad[:template], + :boilerplate => triad[:boilerplate], + :includes => case(triad[:inc]) + when :src then @includes[:src] | pattern_traits[:inc].map{|f| f % [@module_name]} + when :inc then @includes[:inc] + when :tst then @includes[:tst] | pattern_traits[:inc].map{|f| "Mock#{f}"% [@module_name]} + end + } + end +end + +# destroy files if that was what was requested +if @destroy + files.each do |filespec| + file = filespec[:path] + if File.exist?(file) + if @update_svn + `svn delete \"#{file}\" --force` + puts "File #{file} deleted and removed from source control" + else + FileUtils.remove(file) + puts "File #{file} deleted" + end + else + puts "File #{file} does not exist so cannot be removed." + end + end + puts "Destroy Complete" + exit +end + +#Abort if any module already exists +files.each do |file| + raise "ERROR: File #{file[:name]} already exists. Exiting." if File.exist?(file[:path]) +end + +# Create Source Modules +files.each_with_index do |file, i| + File.open(file[:path], 'w') do |f| + f.write(file[:boilerplate] % [file[:name]]) unless file[:boilerplate].nil? + f.write(file[:template] % [ file[:name], + file[:includes].map{|f| "#include \"#{f}\"\n"}.join, + file[:name].upcase ] + ) + end + if (@update_svn) + `svn add \"#{file[:path]}\"` + if $?.exitstatus == 0 + puts "File #{file[:path]} created and added to source control" + else + puts "File #{file[:path]} created but FAILED adding to source control!" + end + else + puts "File #{file[:path]} created" + end +end + +puts 'Generate Complete' diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb new file mode 100644 index 0000000..aff5053 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb @@ -0,0 +1,303 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +File.expand_path(File.join(File.dirname(__FILE__),'colour_prompt')) + +class UnityTestRunnerGenerator + + def initialize(options = nil) + @options = { :includes => [], :plugins => [], :framework => :unity } + case(options) + when NilClass then @options + when String then @options.merge!(UnityTestRunnerGenerator.grab_config(options)) + when Hash then @options.merge!(options) + else raise "If you specify arguments, it should be a filename or a hash of options" + end + end + + def self.grab_config(config_file) + options = { :includes => [], :plugins => [], :framework => :unity } + unless (config_file.nil? or config_file.empty?) + require 'yaml' + yaml_guts = YAML.load_file(config_file) + options.merge!(yaml_guts[:unity] ? yaml_guts[:unity] : yaml_guts[:cmock]) + raise "No :unity or :cmock section found in #{config_file}" unless options + end + return(options) + end + + def run(input_file, output_file, options=nil) + tests = [] + includes = [] + used_mocks = [] + + @options.merge!(options) unless options.nil? + module_name = File.basename(input_file) + + #pull required data from source file + File.open(input_file, 'r') do |input| + tests = find_tests(input) + includes = find_includes(input) + used_mocks = find_mocks(includes) + end + + #build runner file + File.open(output_file, 'w') do |output| + create_header(output, used_mocks) + create_externs(output, tests, used_mocks) + create_mock_management(output, used_mocks) + create_suite_setup_and_teardown(output) + create_reset(output, used_mocks) + create_main(output, input_file, tests) + end + + all_files_used = [input_file, output_file] + all_files_used += includes.map {|filename| filename + '.c'} unless includes.empty? + all_files_used += @options[:includes] unless @options[:includes].empty? + return all_files_used.uniq + end + + def find_tests(input_file) + tests_raw = [] + tests_args = [] + tests_and_line_numbers = [] + + input_file.rewind + source_raw = input_file.read + source_scrubbed = source_raw.gsub(/\/\/.*$/, '') # remove line comments + source_scrubbed = source_scrubbed.gsub(/\/\*.*?\*\//m, '') # remove block comments + lines = source_scrubbed.split(/(^\s*\#.*$) # Treat preprocessor directives as a logical line + | (;|\{|\}) /x) # Match ;, {, and } as end of lines + + lines.each_with_index do |line, index| + #find tests + if line =~ /^((?:\s*TEST_CASE\s*\(.*?\)\s*)*)\s*void\s+(test.*?)\s*\(\s*(.*)\s*\)/ + arguments = $1 + name = $2 + call = $3 + args = nil + if (@options[:use_param_tests] and !arguments.empty?) + args = [] + arguments.scan(/\s*TEST_CASE\s*\((.*)\)\s*$/) {|a| args << a[0]} + end + tests_and_line_numbers << { :name => name, :args => args, :call => call, :line_number => 0 } + tests_args = [] + end + end + + #determine line numbers and create tests to run + source_lines = source_raw.split("\n") + source_index = 0; + tests_and_line_numbers.size.times do |i| + source_lines[source_index..-1].each_with_index do |line, index| + if (line =~ /#{tests_and_line_numbers[i][:name]}/) + source_index += index + tests_and_line_numbers[i][:line_number] = source_index + 1 + break + end + end + end + + return tests_and_line_numbers + end + + def find_includes(input_file) + input_file.rewind + includes = [] + input_file.readlines.each do |line| + scan_results = line.scan(/^\s*#include\s+\"\s*(.+)\.[hH]\s*\"/) + includes << scan_results[0][0] if (scan_results.size > 0) + end + return includes + end + + def find_mocks(includes) + mock_headers = [] + includes.each do |include_file| + mock_headers << File.basename(include_file) if (include_file =~ /^mock/i) + end + return mock_headers + end + + def create_header(output, mocks) + output.puts('/* AUTOGENERATED FILE. DO NOT EDIT. */') + create_runtest(output, mocks) + output.puts("\n//=======Automagically Detected Files To Include=====") + output.puts("#include \"#{@options[:framework].to_s}.h\"") + output.puts('#include "cmock.h"') unless (mocks.empty?) + @options[:includes].flatten.uniq.compact.each do |inc| + output.puts("#include #{inc.include?('<') ? inc : "\"#{inc.gsub('.h','')}.h\""}") + end + output.puts('#include ') + output.puts('#include ') + output.puts('#include "CException.h"') if @options[:plugins].include?(:cexception) + mocks.each do |mock| + output.puts("#include \"#{mock.gsub('.h','')}.h\"") + end + if @options[:enforce_strict_ordering] + output.puts('') + output.puts('int GlobalExpectCount;') + output.puts('int GlobalVerifyOrder;') + output.puts('char* GlobalOrderError;') + end + end + + def create_externs(output, tests, mocks) + output.puts("\n//=======External Functions This Runner Calls=====") + output.puts("extern void setUp(void);") + output.puts("extern void tearDown(void);") + tests.each do |test| + output.puts("extern void #{test[:name]}(#{test[:call]});") + end + output.puts('') + end + + def create_mock_management(output, mocks) + unless (mocks.empty?) + output.puts("\n//=======Mock Management=====") + output.puts("static void CMock_Init(void)") + output.puts("{") + if @options[:enforce_strict_ordering] + output.puts(" GlobalExpectCount = 0;") + output.puts(" GlobalVerifyOrder = 0;") + output.puts(" GlobalOrderError = NULL;") + end + mocks.each do |mock| + output.puts(" #{mock}_Init();") + end + output.puts("}\n") + + output.puts("static void CMock_Verify(void)") + output.puts("{") + mocks.each do |mock| + output.puts(" #{mock}_Verify();") + end + output.puts("}\n") + + output.puts("static void CMock_Destroy(void)") + output.puts("{") + mocks.each do |mock| + output.puts(" #{mock}_Destroy();") + end + output.puts("}\n") + end + end + + def create_suite_setup_and_teardown(output) + unless (@options[:suite_setup].nil?) + output.puts("\n//=======Suite Setup=====") + output.puts("static int suite_setup(void)") + output.puts("{") + output.puts(@options[:suite_setup]) + output.puts("}") + end + unless (@options[:suite_teardown].nil?) + output.puts("\n//=======Suite Teardown=====") + output.puts("static int suite_teardown(int num_failures)") + output.puts("{") + output.puts(@options[:suite_teardown]) + output.puts("}") + end + end + + def create_runtest(output, used_mocks) + cexception = @options[:plugins].include? :cexception + va_args1 = @options[:use_param_tests] ? ', ...' : '' + va_args2 = @options[:use_param_tests] ? '__VA_ARGS__' : '' + output.puts("\n//=======Test Runner Used To Run Each Test Below=====") + output.puts("#define RUN_TEST_NO_ARGS") if @options[:use_param_tests] + output.puts("#define RUN_TEST(TestFunc, TestLineNum#{va_args1}) \\") + output.puts("{ \\") + output.puts(" Unity.CurrentTestName = #TestFunc#{va_args2.empty? ? '' : " \"(\" ##{va_args2} \")\""}; \\") + output.puts(" Unity.CurrentTestLineNumber = TestLineNum; \\") + output.puts(" Unity.NumberOfTests++; \\") + output.puts(" if (TEST_PROTECT()) \\") + output.puts(" { \\") + output.puts(" CEXCEPTION_T e; \\") if cexception + output.puts(" Try { \\") if cexception + output.puts(" CMock_Init(); \\") unless (used_mocks.empty?) + output.puts(" setUp(); \\") + output.puts(" TestFunc(#{va_args2}); \\") + output.puts(" CMock_Verify(); \\") unless (used_mocks.empty?) + output.puts(" } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, \"Unhandled Exception!\"); } \\") if cexception + output.puts(" } \\") + output.puts(" CMock_Destroy(); \\") unless (used_mocks.empty?) + output.puts(" if (TEST_PROTECT() && !TEST_IS_IGNORED) \\") + output.puts(" { \\") + output.puts(" tearDown(); \\") + output.puts(" } \\") + output.puts(" UnityConcludeTest(); \\") + output.puts("}\n") + end + + def create_reset(output, used_mocks) + output.puts("\n//=======Test Reset Option=====") + output.puts("void resetTest()") + output.puts("{") + output.puts(" CMock_Verify();") unless (used_mocks.empty?) + output.puts(" CMock_Destroy();") unless (used_mocks.empty?) + output.puts(" tearDown();") + output.puts(" CMock_Init();") unless (used_mocks.empty?) + output.puts(" setUp();") + output.puts("}") + end + + def create_main(output, filename, tests) + output.puts("\n\n//=======MAIN=====") + output.puts("int main(void)") + output.puts("{") + output.puts(" suite_setup();") unless @options[:suite_setup].nil? + output.puts(" Unity.TestFile = \"#{filename}\";") + output.puts(" UnityBegin();") + if (@options[:use_param_tests]) + tests.each do |test| + if ((test[:args].nil?) or (test[:args].empty?)) + output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]}, RUN_TEST_NO_ARGS);") + else + test[:args].each {|args| output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]}, #{args});")} + end + end + else + tests.each { |test| output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]});") } + end + output.puts() + output.puts(" return #{@options[:suite_teardown].nil? ? "" : "suite_teardown"}(UnityEnd());") + output.puts("}") + end +end + + +if ($0 == __FILE__) + options = { :includes => [] } + yaml_file = nil + + #parse out all the options first + ARGV.reject! do |arg| + case(arg) + when '-cexception' + options[:plugins] = [:cexception]; true + when /\.*\.yml/ + options = UnityTestRunnerGenerator.grab_config(arg); true + else false + end + end + + #make sure there is at least one parameter left (the input file) + if !ARGV[0] + puts ["usage: ruby #{__FILE__} (yaml) (options) input_test_file output_test_runner (includes)", + " blah.yml - will use config options in the yml file (see docs)", + " -cexception - include cexception support"].join("\n") + exit 1 + end + + #create the default test runner name if not specified + ARGV[1] = ARGV[0].gsub(".c","_Runner.c") if (!ARGV[1]) + + #everything else is an include file + options[:includes] ||= (ARGV.slice(2..-1).flatten.compact) if (ARGV.size > 2) + + UnityTestRunnerGenerator.new(options).run(ARGV[0], ARGV[1]) +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/auto/test_file_filter.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/auto/test_file_filter.rb new file mode 100644 index 0000000..3dbc26a --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/auto/test_file_filter.rb @@ -0,0 +1,23 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require'yaml' + +module RakefileHelpers + class TestFileFilter + def initialize(all_files = false) + @all_files = all_files + if not @all_files == true + if File.exist?('test_file_filter.yml') + filters = YAML.load_file( 'test_file_filter.yml' ) + @all_files, @only_files, @exclude_files = + filters[:all_files], filters[:only_files], filters[:exclude_files] + end + end + end + attr_accessor :all_files, :only_files, :exclude_files + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/auto/unity_test_summary.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/auto/unity_test_summary.rb new file mode 100644 index 0000000..69ec2e8 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/auto/unity_test_summary.rb @@ -0,0 +1,126 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +#!/usr/bin/ruby +# +# unity_test_summary.rb +# +require 'fileutils' +require 'set' + +class UnityTestSummary + include FileUtils::Verbose + + attr_reader :report, :total_tests, :failures, :ignored + + def initialize + @report = '' + @total_tests = 0 + @failures = 0 + @ignored = 0 + end + + def run + # Clean up result file names + results = @targets.map {|target| target.gsub(/\\/,'/')} + + # Dig through each result file, looking for details on pass/fail: + failure_output = [] + ignore_output = [] + + results.each do |result_file| + lines = File.readlines(result_file).map { |line| line.chomp } + if lines.length == 0 + raise "Empty test result file: #{result_file}" + else + output = get_details(result_file, lines) + failure_output << output[:failures] unless output[:failures].empty? + ignore_output << output[:ignores] unless output[:ignores].empty? + tests,failures,ignored = parse_test_summary(lines) + @total_tests += tests + @failures += failures + @ignored += ignored + end + end + + if @ignored > 0 + @report += "\n" + @report += "--------------------------\n" + @report += "UNITY IGNORED TEST SUMMARY\n" + @report += "--------------------------\n" + @report += ignore_output.flatten.join("\n") + end + + if @failures > 0 + @report += "\n" + @report += "--------------------------\n" + @report += "UNITY FAILED TEST SUMMARY\n" + @report += "--------------------------\n" + @report += failure_output.flatten.join("\n") + end + + @report += "\n" + @report += "--------------------------\n" + @report += "OVERALL UNITY TEST SUMMARY\n" + @report += "--------------------------\n" + @report += "#{@total_tests} TOTAL TESTS #{@failures} TOTAL FAILURES #{@ignored} IGNORED\n" + @report += "\n" + end + + def set_targets(target_array) + @targets = target_array + end + + def set_root_path(path) + @root = path + end + + def usage(err_msg=nil) + puts err_msg if err_msg + puts "Usage: unity_test_summary.rb" + exit 1 + end + + protected + + @@targets=nil + @@path=nil + @@root=nil + + def get_details(result_file, lines) + results = { :failures => [], :ignores => [], :successes => [] } + lines.each do |line| + src_file,src_line,test_name,status,msg = line.split(/:/) + line_out = ((@root and (@root != 0)) ? "#{@root}#{line}" : line ).gsub(/\//, "\\") + case(status) + when 'IGNORE' then results[:ignores] << line_out + when 'FAIL' then results[:failures] << line_out + when 'PASS' then results[:successes] << line_out + end + end + return results + end + + def parse_test_summary(summary) + if summary[-3..-1].join("\n") =~ /(\d+) Tests (\d+) Failures (\d+) Ignored/ + [$1.to_i,$2.to_i,$3.to_i] + else + raise "Couldn't parse test results: #{summary}" + end + end + + def here; File.expand_path(File.dirname(__FILE__)); end + +end + +if $0 == __FILE__ + script = UnityTestSummary.new + begin + script.run + rescue Exception => e + script.usage e.message + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/docs/Unity Summary.odt b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/docs/Unity Summary.odt new file mode 100644 index 0000000..f699661 Binary files /dev/null and b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/docs/Unity Summary.odt differ diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/docs/Unity Summary.pdf b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/docs/Unity Summary.pdf new file mode 100644 index 0000000..ad1a956 Binary files /dev/null and b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/docs/Unity Summary.pdf differ diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/docs/Unity Summary.txt b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/docs/Unity Summary.txt new file mode 100644 index 0000000..e0b179d --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/docs/Unity Summary.txt @@ -0,0 +1,217 @@ +============== +Unity Test API +============== + +[Copyright (c) 2007 - Unity Project by Mike Karlesky, Mark VanderVoord, and Greg Williams] + +------------- +Running Tests +------------- + +RUN_TEST(func, linenum) + +Each Test is run within the macro RUN_TEST. This macro performs necessary setup before the test is called and handles cleanup and result tabulation afterwards. + +-------------- +Ignoring Tests +-------------- + +There are times when a test is incomplete or not valid for some reason. At these times, TEST_IGNORE can be called. Control will immediately be returned to the caller of the test, and no failures will be returned. + +TEST_IGNORE() + +Ignore this test and return immediately + +TEST_IGNORE_MESSAGE (message) + +Ignore this test and return immediately. Output a message stating why the test was ignored. + +-------------- +Aborting Tests +-------------- + +There are times when a test will contain an infinite loop on error conditions, or there may be reason to escape from the test early without executing the rest of the test. A pair of macros support this functionality in Unity. The first (TEST_PROTECT) sets up the feature, and handles emergency abort cases. TEST_ABORT can then be used at any time within the tests to return to the last TEST_PROTECT call. + +TEST_PROTECT() + +Setup and Catch macro + +TEST_ABORT() + +Abort Test macro + +Example: + +main() +{ + if (TEST_PROTECT() == 0) + { + MyTest(); + } +} + +If MyTest calls TEST_ABORT, program control will immediately return to TEST_PROTECT with a non-zero return value. + + +======================= +Unity Assertion Summary +======================= + +-------------------- +Basic Validity Tests +-------------------- + +TEST_ASSERT_TRUE(condition) + +Evaluates whatever code is in condition and fails if it evaluates to false + +TEST_ASSERT_FALSE(condition) + +Evaluates whatever code is in condition and fails if it evaluates to true + +TEST_ASSERT(condition) + +Another way of calling TEST_ASSERT_TRUE + +TEST_ASSERT_UNLESS(condition) + +Another way of calling TEST_ASSERT_FALSE + +TEST_FAIL() +TEST_FAIL_MESSAGE(message) + +This test is automatically marked as a failure. The message is output stating why. + +------------------------------ +Numerical Assertions: Integers +------------------------------ + +TEST_ASSERT_EQUAL_INT(expected, actual) +TEST_ASSERT_EQUAL_INT8(expected, actual) +TEST_ASSERT_EQUAL_INT16(expected, actual) +TEST_ASSERT_EQUAL_INT32(expected, actual) +TEST_ASSERT_EQUAL_INT64(expected, actual) + +Compare two integers for equality and display errors as signed integers. A cast will be performed +to your natural integer size so often this can just be used. When you need to specify the exact size, +like when comparing arrays, you can use a specific version: + + + +TEST_ASSERT_EQUAL_UINT(expected, actual) + +Compare two integers for equality and display errors as unsigned integers. Like INT, there are +variants for different sizes also. + + + +TEST_ASSERT_EQUAL_HEX(expected, actual) + +Compares two integers for equality and display errors as hexadecimal. Like the other integer comparisons, +you can specify the size... here the size will also effect how many nibbles are shown (for example, HEX16 +will show 4 nibbles). + +_ARRAY + +You can append _ARRAY to any of these macros to make an array comparison of that type. Here you will +need to care a bit more about the actual size of the value being checked. You will also specify an +additional argument which is the number of elements to compare. For example: + +TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, elements) + + +TEST_ASSERT_EQUAL(expected, actual) + +Another way of calling TEST_ASSERT_EQUAL_INT + + + +TEST_ASSERT_INT_WITHIN(delta, expected, actual) + +Asserts that the actual value is within plus or minus delta of the expected value. This also comes in +size specific variants. + + +----------------------------- +Numerical Assertions: Bitwise +----------------------------- + +TEST_ASSERT_BITS(mask, expected, actual) + +Use an integer mask to specify which bits should be compared between two other integers. High bits in the mask are compared, low bits ignored. + +TEST_ASSERT_BITS_HIGH(mask, actual) + +Use an integer mask to specify which bits should be inspected to determine if they are all set high. High bits in the mask are compared, low bits ignored. + +TEST_ASSERT_BITS_LOW(mask, actual) + +Use an integer mask to specify which bits should be inspected to determine if they are all set low. High bits in the mask are compared, low bits ignored. + +TEST_ASSERT_BIT_HIGH(bit, actual) + +Test a single bit and verify that it is high. The bit is specified 0-31 for a 32-bit integer. + +TEST_ASSERT_BIT_LOW(bit, actual) + +Test a single bit and verify that it is low. The bit is specified 0-31 for a 32-bit integer. + +---------------------------- +Numerical Assertions: Floats +---------------------------- + +TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual) + +Asserts that the actual value is within plus or minus delta of the expected value. + +TEST_ASSERT_EQUAL_FLOAT(expected, actual) + +Asserts that two floating point values are "equal" within a small % delta of the expected value. + +----------------- +String Assertions +----------------- + +TEST_ASSERT_EQUAL_STRING(expected, actual) + +Compare two null-terminate strings. Fail if any character is different or if the lengths are different. + +TEST_ASSERT_EQUAL_STRING_MESSAGE(expected, actual, message) + +Compare two null-terminate strings. Fail if any character is different or if the lengths are different. Output a custom message on failure. + +------------------ +Pointer Assertions +------------------ + +Most pointer operations can be performed by simply using the integer comparisons above. However, a couple of special cases are added for clarity. + +TEST_ASSERT_NULL(pointer) + +Fails if the pointer is not equal to NULL + +TEST_ASSERT_NOT_NULL(pointer) + +Fails if the pointer is equal to NULL + + +----------------- +Memory Assertions +----------------- + +TEST_ASSERT_EQUAL_MEMORY(expected, actual, len) + +Compare two blocks of memory. This is a good generic assertion for types that can't be coerced into acting like +standard types... but since it's a memory compare, you have to be careful that your data types are packed. + +-------- +_MESSAGE +-------- + +you can append _MESSAGE to any of the macros to make them take an additional argument. This argument +is a string that will be printed at the end of the failure strings. This is useful for specifying more +information about the problem. + + + + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/docs/license.txt b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/docs/license.txt new file mode 100644 index 0000000..c42e330 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/docs/license.txt @@ -0,0 +1,31 @@ + Copyright (c) 2007-2010 Mike Karlesky, Mark VanderVoord, Greg Williams + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + The end-user documentation included with the redistribution, if + any, must include the following acknowledgment: "This product + includes software developed for the Unity Project, by Mike Karlesky, + Mark VanderVoord, and Greg Williams and other contributors", in + the same place and form as other third-party acknowledgments. + Alternately, this acknowledgment may appear in the software + itself, in the same form and location as other such third-party + acknowledgments. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.c new file mode 100644 index 0000000..9cf42c6 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.c @@ -0,0 +1,10 @@ +#include "unity.h" +#include "UnityHelper.h" +#include +#include + +void AssertEqualExampleStruct(const EXAMPLE_STRUCT_T expected, const EXAMPLE_STRUCT_T actual, const unsigned short line) +{ + UNITY_TEST_ASSERT_EQUAL_INT(expected.x, actual.x, line, "Example Struct Failed For Field x"); + UNITY_TEST_ASSERT_EQUAL_INT(expected.y, actual.y, line, "Example Struct Failed For Field y"); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.h b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.h new file mode 100644 index 0000000..1516111 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.h @@ -0,0 +1,12 @@ +#ifndef _TESTHELPER_H +#define _TESTHELPER_H + +#include "Types.h" + +void AssertEqualExampleStruct(const EXAMPLE_STRUCT_T expected, const EXAMPLE_STRUCT_T actual, const unsigned short line); + +#define UNITY_TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(expected, actual, line, message) AssertEqualExampleStruct(expected, actual, line); + +#define TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(expected, actual) UNITY_TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(expected, actual, __LINE__, NULL); + +#endif // _TESTHELPER_H diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/examples/makefile b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/examples/makefile new file mode 100644 index 0000000..723d390 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/examples/makefile @@ -0,0 +1,40 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +C_COMPILER=gcc +TARGET_BASE1=test1 +TARGET_BASE2=test2 +ifeq ($(OS),Windows_NT) + TARGET_EXTENSION=.exe +else + TARGET_EXTENSION=.out +endif +TARGET1 = $(TARGET_BASE1)$(TARGET_EXTENSION) +TARGET2 = $(TARGET_BASE2)$(TARGET_EXTENSION) +SRC_FILES1=../src/unity.c src/ProductionCode.c test/TestProductionCode.c test/no_ruby/TestProductionCode_Runner.c +SRC_FILES2=../src/unity.c src/ProductionCode2.c test/TestProductionCode2.c test/no_ruby/TestProductionCode2_Runner.c +INC_DIRS=-Isrc -I../src +SYMBOLS=-DTEST + +ifeq ($(OS),Windows_NT) + CLEANUP = del /F /Q build\* && del /F /Q $(TARGET1) && del /F /Q $(TARGET2) +else + CLEANUP = rm -f build/*.o ; rm -f $(TARGET1) ; rm -f $(TARGET2) +endif + +all: clean default + +default: +# ruby auto/generate_test_runner.rb test/TestProductionCode.c test/no_ruby/TestProductionCode_Runner.c +# ruby auto/generate_test_runner.rb test/TestProductionCode2.c test/no_ruby/TestProductionCode2_Runner.c + $(C_COMPILER) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES1) -o $(TARGET1) + $(C_COMPILER) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES2) -o $(TARGET2) + $(TARGET1) + $(TARGET2) + +clean: + $(CLEANUP) + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/examples/rakefile.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/examples/rakefile.rb new file mode 100644 index 0000000..0905b4b --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/examples/rakefile.rb @@ -0,0 +1,32 @@ +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require HERE+'rakefile_helper' + +include RakefileHelpers + +# Load default configuration, for now +DEFAULT_CONFIG_FILE = 'gcc.yml' +configure_toolchain(DEFAULT_CONFIG_FILE) + +task :unit do + run_tests get_unit_test_files +end + +desc "Generate test summary" +task :summary do + report_summary +end + +desc "Build and test Unity" +task :all => [:clean, :unit, :summary] +task :default => [:clobber, :all] +task :ci => [:default] +task :cruise => [:default] + +desc "Load configuration" +task :config, :config_file do |t, args| + configure_toolchain(args[:config_file]) +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/examples/rakefile_helper.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/examples/rakefile_helper.rb new file mode 100644 index 0000000..0127d69 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/examples/rakefile_helper.rb @@ -0,0 +1,260 @@ +require 'yaml' +require 'fileutils' +require HERE+'../auto/unity_test_summary' +require HERE+'../auto/generate_test_runner' +require HERE+'../auto/colour_reporter' + +module RakefileHelpers + + C_EXTENSION = '.c' + + def load_configuration(config_file) + $cfg_file = "../targets/#{config_file}" + $cfg = YAML.load(File.read($cfg_file)) + end + + def configure_clean + CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil? + end + + def configure_toolchain(config_file=DEFAULT_CONFIG_FILE) + config_file += '.yml' unless config_file =~ /\.yml$/ + load_configuration('../targets/'+config_file) + configure_clean + end + + def get_unit_test_files + path = $cfg['compiler']['unit_tests_path'] + 'Test*' + C_EXTENSION + path.gsub!(/\\/, '/') + FileList.new(path) + end + + def get_local_include_dirs + include_dirs = $cfg['compiler']['includes']['items'].dup + include_dirs.delete_if {|dir| dir.is_a?(Array)} + return include_dirs + end + + def extract_headers(filename) + includes = [] + lines = File.readlines(filename) + lines.each do |line| + m = line.match(/^\s*#include\s+\"\s*(.+\.[hH])\s*\"/) + if not m.nil? + includes << m[1] + end + end + return includes + end + + def find_source_file(header, paths) + paths.each do |dir| + src_file = dir + header.ext(C_EXTENSION) + if (File.exists?(src_file)) + return src_file + end + end + return nil + end + + def tackit(strings) + if strings.is_a?(Array) + result = "\"#{strings.join}\"" + else + result = strings + end + return result + end + + def squash(prefix, items) + result = '' + items.each { |item| result += " #{prefix}#{tackit(item)}" } + return result + end + + def build_compiler_fields + command = tackit($cfg['compiler']['path']) + if $cfg['compiler']['defines']['items'].nil? + defines = '' + else + defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items']) + end + options = squash('', $cfg['compiler']['options']) + includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :defines => defines, :options => options, :includes => includes} + end + + def compile(file, defines=[]) + compiler = build_compiler_fields + cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{file} " + + "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" + + "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" + execute(cmd_str) + end + + def build_linker_fields + command = tackit($cfg['linker']['path']) + if $cfg['linker']['options'].nil? + options = '' + else + options = squash('', $cfg['linker']['options']) + end + if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?) + includes = '' + else + includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) + end + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :options => options, :includes => includes} + end + + def link(exe_name, obj_list) + linker = build_linker_fields + cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + + (obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).join + + $cfg['linker']['bin_files']['prefix'] + ' ' + + $cfg['linker']['bin_files']['destination'] + + exe_name + $cfg['linker']['bin_files']['extension'] + execute(cmd_str) + end + + def build_simulator_fields + return nil if $cfg['simulator'].nil? + if $cfg['simulator']['path'].nil? + command = '' + else + command = (tackit($cfg['simulator']['path']) + ' ') + end + if $cfg['simulator']['pre_support'].nil? + pre_support = '' + else + pre_support = squash('', $cfg['simulator']['pre_support']) + end + if $cfg['simulator']['post_support'].nil? + post_support = '' + else + post_support = squash('', $cfg['simulator']['post_support']) + end + return {:command => command, :pre_support => pre_support, :post_support => post_support} + end + + def execute(command_string, verbose=true, raise_on_fail=true) + report command_string + output = `#{command_string}`.chomp + report(output) if (verbose && !output.nil? && (output.length > 0)) + if (($?.exitstatus != 0) and (raise_on_fail)) + raise "Command failed. (Returned #{$?.exitstatus})" + end + return output + end + + def report_summary + summary = UnityTestSummary.new + summary.set_root_path(HERE) + results_glob = "#{$cfg['compiler']['build_path']}*.test*" + results_glob.gsub!(/\\/, '/') + results = Dir[results_glob] + summary.set_targets(results) + summary.run + fail_out "FAIL: There were failures" if (summary.failures > 0) + end + + def run_tests(test_files) + + report 'Running system tests...' + + # Tack on TEST define for compiling unit tests + load_configuration($cfg_file) + test_defines = ['TEST'] + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + $cfg['compiler']['defines']['items'] << 'TEST' + + include_dirs = get_local_include_dirs + + # Build and execute each unit test + test_files.each do |test| + obj_list = [] + + # Detect dependencies and build required required modules + extract_headers(test).each do |header| + # Compile corresponding source file if it exists + src_file = find_source_file(header, include_dirs) + if !src_file.nil? + compile(src_file, test_defines) + obj_list << header.ext($cfg['compiler']['object_files']['extension']) + end + end + + # Build the test runner (generate if configured to do so) + test_base = File.basename(test, C_EXTENSION) + runner_name = test_base + '_Runner.c' + if $cfg['compiler']['runner_path'].nil? + runner_path = $cfg['compiler']['build_path'] + runner_name + test_gen = UnityTestRunnerGenerator.new($cfg_file) + test_gen.run(test, runner_path) + else + runner_path = $cfg['compiler']['runner_path'] + runner_name + end + + compile(runner_path, test_defines) + obj_list << runner_name.ext($cfg['compiler']['object_files']['extension']) + + # Build the test module + compile(test, test_defines) + obj_list << test_base.ext($cfg['compiler']['object_files']['extension']) + + # Link the test executable + link(test_base, obj_list) + + # Execute unit test and generate results file + simulator = build_simulator_fields + executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] + if simulator.nil? + cmd_str = executable + else + cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" + end + output = execute(cmd_str, true, false) + test_results = $cfg['compiler']['build_path'] + test_base + if output.match(/OK$/m).nil? + test_results += '.testfail' + else + test_results += '.testpass' + end + File.open(test_results, 'w') { |f| f.print output } + end + end + + def build_application(main) + + report "Building application..." + + obj_list = [] + load_configuration($cfg_file) + main_path = $cfg['compiler']['source_path'] + main + C_EXTENSION + + # Detect dependencies and build required required modules + include_dirs = get_local_include_dirs + extract_headers(main_path).each do |header| + src_file = find_source_file(header, include_dirs) + if !src_file.nil? + compile(src_file) + obj_list << header.ext($cfg['compiler']['object_files']['extension']) + end + end + + # Build the main source file + main_base = File.basename(main_path, C_EXTENSION) + compile(main_path) + obj_list << main_base.ext($cfg['compiler']['object_files']['extension']) + + # Create the executable + link(main_base, obj_list) + end + + def fail_out(msg) + puts msg + exit(-1) + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/examples/readme.txt b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/examples/readme.txt new file mode 100644 index 0000000..6c7780e --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/examples/readme.txt @@ -0,0 +1,18 @@ +Example Project + +This example project gives an example of some passing, ignored, and failing tests. +It's simple and meant for you to look over and get an idea for what all of this stuff does. + +You can build and test using the makefile if you have gcc installed (you may need to tweak +the locations of some tools in the makefile). Otherwise, the rake version will let you +test with gcc or a couple versions of IAR. You can tweak the yaml files to get those versions +running. + +Ruby is required if you're using the rake version (obviously). This version shows off most of +Unity's advanced features (automatically creating test runners, fancy summaries, etc.) + +The makefile version doesn't require anything outside of your normal build tools, but won't do the +extras for you. So that you can test right away, we've written the test runners for you and +put them in the test\no_ruby subdirectory. If you make changes to the tests or source, you might +need to update these (like when you add or remove tests). Do that for a while and you'll learn +why you really want to start using the Ruby tools. \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/examples/src/ProductionCode.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/examples/src/ProductionCode.c new file mode 100644 index 0000000..500b44b --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/examples/src/ProductionCode.c @@ -0,0 +1,24 @@ + +#include "ProductionCode.h" + +int Counter = 0; +int NumbersToFind[9] = { 0, 34, 55, 66, 32, 11, 1, 77, 888 }; //some obnoxious array to search that is 1-based indexing instead of 0. + +// This function is supposed to search through NumbersToFind and find a particular number. +// If it finds it, the index is returned. Otherwise 0 is returned which sorta makes sense since +// NumbersToFind is indexed from 1. Unfortunately it's broken +// (and should therefore be caught by our tests) +int FindFunction_WhichIsBroken(int NumberToFind) +{ + int i = 0; + while (i <= 8) //Notice I should have been in braces + i++; + if (NumbersToFind[i] == NumberToFind) //Yikes! I'm getting run after the loop finishes instead of during it! + return i; + return 0; +} + +int FunctionWhichReturnsLocalVariable(void) +{ + return Counter; +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/examples/src/ProductionCode.h b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/examples/src/ProductionCode.h new file mode 100644 index 0000000..250ca0d --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/examples/src/ProductionCode.h @@ -0,0 +1,3 @@ + +int FindFunction_WhichIsBroken(int NumberToFind); +int FunctionWhichReturnsLocalVariable(void); diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/examples/src/ProductionCode2.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/examples/src/ProductionCode2.c new file mode 100644 index 0000000..a8c72e1 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/examples/src/ProductionCode2.c @@ -0,0 +1,9 @@ + +#include "ProductionCode2.h" + +char* ThisFunctionHasNotBeenTested(int Poor, char* LittleFunction) +{ + //Since There Are No Tests Yet, This Function Could Be Empty For All We Know. + // Which isn't terribly useful... but at least we put in a TEST_IGNORE so we won't forget + return (char*)0; +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/examples/src/ProductionCode2.h b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/examples/src/ProductionCode2.h new file mode 100644 index 0000000..34ae980 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/examples/src/ProductionCode2.h @@ -0,0 +1,2 @@ + +char* ThisFunctionHasNotBeenTested(int Poor, char* LittleFunction); diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/examples/test/TestProductionCode.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/examples/test/TestProductionCode.c new file mode 100644 index 0000000..28a5581 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/examples/test/TestProductionCode.c @@ -0,0 +1,62 @@ + +#include "ProductionCode.h" +#include "unity.h" + +//sometimes you may want to get at local data in a module. +//for example: If you plan to pass by reference, this could be useful +//however, it should often be avoided +extern int Counter; + +void setUp(void) +{ + //This is run before EACH TEST + Counter = 0x5a5a; +} + +void tearDown(void) +{ +} + +void test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode(void) +{ + //All of these should pass + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(78)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(1)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(33)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(999)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(-1)); +} + +void test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken(void) +{ + // You should see this line fail in your test summary + TEST_ASSERT_EQUAL(1, FindFunction_WhichIsBroken(34)); + + // Notice the rest of these didn't get a chance to run because the line above failed. + // Unit tests abort each test function on the first sign of trouble. + // Then NEXT test function runs as normal. + TEST_ASSERT_EQUAL(8, FindFunction_WhichIsBroken(8888)); +} + +void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue(void) +{ + //This should be true because setUp set this up for us before this test + TEST_ASSERT_EQUAL_HEX(0x5a5a, FunctionWhichReturnsLocalVariable()); + + //This should be true because we can still change our answer + Counter = 0x1234; + TEST_ASSERT_EQUAL_HEX(0x1234, FunctionWhichReturnsLocalVariable()); +} + +void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain(void) +{ + //This should be true again because setup was rerun before this test (and after we changed it to 0x1234) + TEST_ASSERT_EQUAL_HEX(0x5a5a, FunctionWhichReturnsLocalVariable()); +} + +void test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed(void) +{ + //Sometimes you get the test wrong. When that happens, you get a failure too... and a quick look should tell + // you what actually happened...which in this case was a failure to setup the initial condition. + TEST_ASSERT_EQUAL_HEX(0x1234, FunctionWhichReturnsLocalVariable()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/examples/test/TestProductionCode2.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/examples/test/TestProductionCode2.c new file mode 100644 index 0000000..20c9251 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/examples/test/TestProductionCode2.c @@ -0,0 +1,26 @@ + +#include "ProductionCode2.h" +#include "unity.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void test_IgnoredTest(void) +{ + TEST_IGNORE_MESSAGE("This Test Was Ignored On Purpose"); +} + +void test_AnotherIgnoredTest(void) +{ + TEST_IGNORE_MESSAGE("These Can Be Useful For Leaving Yourself Notes On What You Need To Do Yet"); +} + +void test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented(void) +{ + TEST_IGNORE(); //Like This +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode2_Runner.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode2_Runner.c new file mode 100644 index 0000000..56515ae --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode2_Runner.c @@ -0,0 +1,46 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ +#include "unity.h" +#include +#include + +char MessageBuffer[50]; + +extern void setUp(void); +extern void tearDown(void); + +extern void test_IgnoredTest(void); +extern void test_AnotherIgnoredTest(void); +extern void test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented(void); + +static void runTest(UnityTestFunction test) +{ + if (TEST_PROTECT()) + { + setUp(); + test(); + } + if (TEST_PROTECT() && !TEST_IS_IGNORED) + { + tearDown(); + } +} +void resetTest() +{ + tearDown(); + setUp(); +} + + +int main(void) +{ + Unity.TestFile = "test/TestProductionCode2.c"; + UnityBegin(); + + // RUN_TEST calls runTest + RUN_TEST(test_IgnoredTest, 13); + RUN_TEST(test_AnotherIgnoredTest, 18); + RUN_TEST(test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented, 23); + + UnityEnd(); + return 0; +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode_Runner.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode_Runner.c new file mode 100644 index 0000000..64112f3 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode_Runner.c @@ -0,0 +1,50 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ +#include "unity.h" +#include +#include + +char MessageBuffer[50]; + +extern void setUp(void); +extern void tearDown(void); + +extern void test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode(void); +extern void test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken(void); +extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue(void); +extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain(void); +extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed(void); + +static void runTest(UnityTestFunction test) +{ + if (TEST_PROTECT()) + { + setUp(); + test(); + } + if (TEST_PROTECT() && !TEST_IS_IGNORED) + { + tearDown(); + } +} +void resetTest() +{ + tearDown(); + setUp(); +} + + +int main(void) +{ + Unity.TestFile = "test/TestProductionCode.c"; + UnityBegin(); + + // RUN_TEST calls runTest + RUN_TEST(test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode, 20); + RUN_TEST(test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken, 30); + RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue, 41); + RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain, 51); + RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed, 57); + + UnityEnd(); + return 0; +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/build/MakefileWorker.mk b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/build/MakefileWorker.mk new file mode 100644 index 0000000..9948751 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/build/MakefileWorker.mk @@ -0,0 +1,331 @@ +#--------- +# +# MakefileWorker.mk +# +# Include this helper file in your makefile +# It makes +# A static library holding the application objs +# A test executable +# +# See this example for parameter settings +# examples/Makefile +# +#---------- +# Inputs - these variables describe what to build +# +# INCLUDE_DIRS - Directories used to search for include files. +# This generates a -I for each directory +# SRC_DIRS - Directories containing source file to built into the library +# SRC_FILES - Specific source files to build into library. Helpful when not all code +# in a directory can be built for test (hopefully a temporary situation) +# TEST_SRC_DIRS - Directories containing unit test code build into the unit test runner +# These do not go in a library. They are explicitly included in the test runner +# MOCKS_SRC_DIRS - Directories containing mock source files to build into the test runner +# These do not go in a library. They are explicitly included in the test runner +#---------- +# You can adjust these variables to influence how to build the test target +# and where to put and name outputs +# See below to determine defaults +# COMPONENT_NAME - the name of the thing being built +# UNITY_HOME - where Unity home dir found +# UNITY_BUILD_HOME - place for scripts +# UNITY_OBJS_DIR - a directory where o and d files go +# UNITY_LIB_DIR - a directory where libs go +# UNITY_ENABLE_DEBUG - build for debug +# UNITY_USE_MEM_LEAK_DETECTION - Links with overridden new and delete +# UNITY_USE_STD_CPP_LIB - Set to N to keep the standard C++ library out +# of the test harness +# UNITY_USE_GCOV - Turn on coverage analysis +# Clean then build with this flag set to Y, then 'make gcov' +# UNITY_TEST_RUNNER_FLAGS +# None by default +# UNITY_MAPFILE - generate a map file +# UNITY_WARNINGFLAGS - overly picky by default +# OTHER_MAKEFILE_TO_INCLUDE - a hook to use this makefile to make +# other targets. Like CSlim, which is part of fitnesse +#---------- +# +# Other flags users can initialize to sneak in their settings +# UNITY_CFLAGS - C complier +# UNITY_LDFLAGS - Linker flags +#---------- + + +ifndef COMPONENT_NAME + COMPONENT_NAME = name_this_in_the_makefile +endif + +# Debug on by default +ifndef UNITY_ENABLE_DEBUG + UNITY_ENABLE_DEBUG = Y +endif + +# new and delete for memory leak detection on by default +ifndef UNITY_USE_MEM_LEAK_DETECTION + UNITY_USE_MEM_LEAK_DETECTION = Y +endif + +# Use gcov, off by default +ifndef UNITY_USE_GCOV + UNITY_USE_GCOV = N +endif + +# Default warnings +ifndef UNITY_WARNINGFLAGS + UNITY_WARNINGFLAGS = -Wall -Werror -Wshadow -Wswitch-default +endif + +# Default dir for temporary files (d, o) +ifndef UNITY_OBJS_DIR + UNITY_OBJS_DIR = objs +endif + +# Default dir for the outout library +ifndef UNITY_LIB_DIR + UNITY_LIB_DIR = lib +endif + +# No map by default +ifndef UNITY_MAP_FILE + UNITY_MAP_FILE = N +endif + +#Not verbose by deafult +ifdef VERBOSE + UNITY_TEST_RUNNER_FLAGS += -v +endif + +ifdef GROUP + UNITY_TEST_RUNNER_FLAGS += -g $(GROUP) +endif + +ifdef NAME + UNITY_TEST_RUNNER_FLAGS += -n $(NAME) +endif + +ifdef REPEAT + UNITY_TEST_RUNNER_FLAGS += -r $(REPEAT) +endif + + +# -------------------------------------- +# derived flags in the following area +# -------------------------------------- +ifeq ($(UNITY_USE_MEM_LEAK_DETECTION), N) + UNITY_CFLAGS += -DUNITY_MEM_LEAK_DETECTION_DISABLED +else + UNITY_MEMLEAK_DETECTOR_MALLOC_MACRO_FILE = -include $(UNITY_HOME)/extras/fixture/src/unity_fixture_malloc_overrides.h +endif + +ifeq ($(UNITY_ENABLE_DEBUG), Y) + UNITY_CFLAGS += -g +endif + +ifeq ($(UNITY_USE_GCOV), Y) + UNITY_CFLAGS += -fprofile-arcs -ftest-coverage +endif + +UNITY_CFLAGS += $(UNITY_MEMLEAK_DETECTOR_MALLOC_MACRO_FILE) + +TARGET_MAP = $(COMPONENT_NAME).map.txt +ifeq ($(UNITY_MAP_FILE), Y) + UNITY_LDFLAGS += -Wl,-map,$(TARGET_MAP) +endif + +LD_LIBRARIES += -lgcov + +TARGET_LIB = \ + $(UNITY_LIB_DIR)/lib$(COMPONENT_NAME).a + +TEST_TARGET = \ + $(COMPONENT_NAME)_tests + +#Helper Functions +get_src_from_dir = $(wildcard $1/*.cpp) $(wildcard $1/*.c) +get_dirs_from_dirspec = $(wildcard $1) +get_src_from_dir_list = $(foreach dir, $1, $(call get_src_from_dir,$(dir))) +__src_to = $(subst .c,$1, $(subst .cpp,$1,$2)) +src_to = $(addprefix $(UNITY_OBJS_DIR)/,$(call __src_to,$1,$2)) +src_to_o = $(call src_to,.o,$1) +src_to_d = $(call src_to,.d,$1) +src_to_gcda = $(call src_to,.gcda,$1) +src_to_gcno = $(call src_to,.gcno,$1) +make_dotdot_a_subdir = $(subst ..,_dot_dot, $1) +time = $(shell date +%s) +delta_t = $(eval minus, $1, $2) +debug_print_list = $(foreach word,$1,echo " $(word)";) echo; + +#Derived +STUFF_TO_CLEAN += $(TEST_TARGET) $(TEST_TARGET).exe $(TARGET_LIB) $(TARGET_MAP) + +SRC += $(call get_src_from_dir_list, $(SRC_DIRS)) $(SRC_FILES) +OBJ = $(call src_to_o,$(SRC)) +OBJ2 = $(call make_dotdot_a_subdir. $(OBJ)) + +STUFF_TO_CLEAN += $(OBJ) + +TEST_SRC = $(call get_src_from_dir_list, $(TEST_SRC_DIRS)) +TEST_OBJS = $(call src_to_o,$(TEST_SRC)) +STUFF_TO_CLEAN += $(TEST_OBJS) + + +MOCKS_SRC = $(call get_src_from_dir_list, $(MOCKS_SRC_DIRS)) +MOCKS_OBJS = $(call src_to_o,$(MOCKS_SRC)) +STUFF_TO_CLEAN += $(MOCKS_OBJS) + +ALL_SRC = $(SRC) $(TEST_SRC) $(MOCKS_SRC) + +#Test coverage with gcov +GCOV_OUTPUT = gcov_output.txt +GCOV_REPORT = gcov_report.txt +GCOV_ERROR = gcov_error.txt +GCOV_GCDA_FILES = $(call src_to_gcda, $(ALL_SRC)) +GCOV_GCNO_FILES = $(call src_to_gcno, $(ALL_SRC)) +TEST_OUTPUT = $(TEST_TARGET).txt +STUFF_TO_CLEAN += \ + $(GCOV_OUTPUT)\ + $(GCOV_REPORT)\ + $(GCOV_REPORT).html\ + $(GCOV_ERROR)\ + $(GCOV_GCDA_FILES)\ + $(GCOV_GCNO_FILES)\ + $(TEST_OUTPUT) + + +#The gcda files for gcov need to be deleted before each run +#To avoid annoying messages. +GCOV_CLEAN = $(SILENCE)rm -f $(GCOV_GCDA_FILES) $(GCOV_OUTPUT) $(GCOV_REPORT) $(GCOV_ERROR) +RUN_TEST_TARGET = $(SILENCE) $(GCOV_CLEAN) ; echo "Running $(TEST_TARGET)"; ./$(TEST_TARGET) $(UNITY_TEST_RUNNER_FLAGS) + +INCLUDES_DIRS_EXPANDED = $(call get_dirs_from_dirspec, $(INCLUDE_DIRS)) +INCLUDES += $(foreach dir, $(INCLUDES_DIRS_EXPANDED), -I$(dir)) +MOCK_DIRS_EXPANDED = $(call get_dirs_from_dirspec, $(MOCKS_SRC_DIRS)) +INCLUDES += $(foreach dir, $(MOCK_DIRS_EXPANDED), -I$(dir)) + + +DEP_FILES = $(call src_to_d, $(ALL_SRC)) +STUFF_TO_CLEAN += $(DEP_FILES) $(PRODUCTION_CODE_START) $(PRODUCTION_CODE_END) +STUFF_TO_CLEAN += $(STDLIB_CODE_START) $(MAP_FILE) cpputest_*.xml junit_run_output + +# We'll use the UNITY_CFLAGS etc so that you can override AND add to the CppUTest flags +CFLAGS = $(UNITY_CFLAGS) $(UNITY_ADDITIONAL_CFLAGS) $(INCLUDES) $(UNITY_WARNINGFLAGS) +LDFLAGS = $(UNITY_LDFLAGS) $(UNITY_ADDITIONAL_LDFLAGS) + +# Targets + +.PHONY: all +all: start $(TEST_TARGET) + $(RUN_TEST_TARGET) + +.PHONY: start +start: $(TEST_TARGET) + $(SILENCE)START_TIME=$(call time) + +.PHONY: all_no_tests +all_no_tests: $(TEST_TARGET) + +.PHONY: flags +flags: + @echo + @echo "Compile C source with CFLAGS:" + @$(call debug_print_list,$(CFLAGS)) + @echo "Link with LDFLAGS:" + @$(call debug_print_list,$(LDFLAGS)) + @echo "Link with LD_LIBRARIES:" + @$(call debug_print_list,$(LD_LIBRARIES)) + @echo "Create libraries with ARFLAGS:" + @$(call debug_print_list,$(ARFLAGS)) + @echo "OBJ files:" + @$(call debug_print_list,$(OBJ2)) + + +$(TEST_TARGET): $(TEST_OBJS) $(MOCKS_OBJS) $(PRODUCTION_CODE_START) $(TARGET_LIB) $(USER_LIBS) $(PRODUCTION_CODE_END) $(STDLIB_CODE_START) + $(SILENCE)echo Linking $@ + $(SILENCE)$(LINK.o) -o $@ $^ $(LD_LIBRARIES) + +$(TARGET_LIB): $(OBJ) + $(SILENCE)echo Building archive $@ + $(SILENCE)mkdir -p lib + $(SILENCE)$(AR) $(ARFLAGS) $@ $^ + $(SILENCE)ranlib $@ + +test: $(TEST_TARGET) + $(RUN_TEST_TARGET) | tee $(TEST_OUTPUT) + +vtest: $(TEST_TARGET) + $(RUN_TEST_TARGET) -v | tee $(TEST_OUTPUT) + +$(UNITY_OBJS_DIR)/%.o: %.cpp + @echo compiling $(notdir $<) + $(SILENCE)mkdir -p $(dir $@) + $(SILENCE)$(COMPILE.cpp) -MMD -MP $(OUTPUT_OPTION) $< + +$(UNITY_OBJS_DIR)/%.o: %.c + @echo compiling $(notdir $<) + $(SILENCE)mkdir -p $(dir $@) + $(SILENCE)$(COMPILE.c) -MMD -MP $(OUTPUT_OPTION) $< + +ifneq "$(MAKECMDGOALS)" "clean" +-include $(DEP_FILES) +endif + +.PHONY: clean +clean: + $(SILENCE)echo Making clean + $(SILENCE)$(RM) $(STUFF_TO_CLEAN) + $(SILENCE)rm -rf gcov $(UNITY_OBJS_DIR) + $(SILENCE)find . -name "*.gcno" | xargs rm -f + $(SILENCE)find . -name "*.gcda" | xargs rm -f + +#realclean gets rid of all gcov, o and d files in the directory tree +#not just the ones made by this makefile +.PHONY: realclean +realclean: clean + $(SILENCE)rm -rf gcov + $(SILENCE)find . -name "*.gdcno" | xargs rm -f + $(SILENCE)find . -name "*.[do]" | xargs rm -f + +gcov: test + $(SILENCE)for d in $(SRC_DIRS) ; do \ + gcov --object-directory $(UNITY_OBJS_DIR)/$$d $$d/*.c $$d/*.cpp >> $(GCOV_OUTPUT) 2>>$(GCOV_ERROR) ; \ + done + $(SILENCE)for f in $(SRC_FILES) ; do \ + gcov --object-directory $(UNITY_OBJS_DIR)/$$f $$f >> $(GCOV_OUTPUT) 2>>$(GCOV_ERROR) ; \ + done + $(UNITY_BUILD_HOME)/filterGcov.sh $(GCOV_OUTPUT) $(GCOV_ERROR) $(GCOV_REPORT) $(TEST_OUTPUT) + $(SILENCE)cat $(GCOV_REPORT) + $(SILENCE)mkdir -p gcov + $(SILENCE)mv *.gcov gcov + $(SILENCE)mv gcov_* gcov + $(SILENCE)echo "See gcov directory for details" + +debug: + @echo + @echo "Target Source files:" + @$(call debug_print_list,$(SRC)) + @echo "Target Object files:" + @$(call debug_print_list,$(OBJ)) + @echo "Test Source files:" + @$(call debug_print_list,$(TEST_SRC)) + @echo "Test Object files:" + @$(call debug_print_list,$(TEST_OBJS)) + @echo "Mock Source files:" + @$(call debug_print_list,$(MOCKS_SRC)) + @echo "Mock Object files:" + @$(call debug_print_list,$(MOCKS_OBJS)) + @echo "All Input Dependency files:" + @$(call debug_print_list,$(DEP_FILES)) + @echo Stuff to clean: + @$(call debug_print_list,$(STUFF_TO_CLEAN)) + @echo Includes: + @$(call debug_print_list,$(INCLUDES)) + +ifneq "$(OTHER_MAKEFILE_TO_INCLUDE)" "" +-include $(OTHER_MAKEFILE_TO_INCLUDE) +endif + + + +st,$(TEST_SRC)) + @echo "Test Object files:" + @$(call debug_print \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/build/filterGcov.sh b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/build/filterGcov.sh new file mode 100644 index 0000000..a861cf6 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/build/filterGcov.sh @@ -0,0 +1,61 @@ +#!/bin/bash +INPUT_FILE=$1 +TEMP_FILE1=${INPUT_FILE}1.tmp +TEMP_FILE2=${INPUT_FILE}2.tmp +TEMP_FILE3=${INPUT_FILE}3.tmp +ERROR_FILE=$2 +OUTPUT_FILE=$3 +HTML_OUTPUT_FILE=$3.html +TEST_RESULTS=$4 + +flattenGcovOutput() { +while read line1 +do + read line2 + echo $line2 " " $line1 + read junk + read junk +done < ${INPUT_FILE} +} + +getRidOfCruft() { +sed '-e s/^Lines.*://g' \ + '-e s/^[0-9]\./ &/g' \ + '-e s/^[0-9][0-9]\./ &/g' \ + '-e s/of.*File/ /g' \ + "-e s/'//g" \ + '-e s/^.*\/usr\/.*$//g' \ + '-e s/^.*\.$//g' +} + +getFileNameRootFromErrorFile() { +sed '-e s/gc..:cannot open .* file//g' ${ERROR_FILE} +} + +writeEachNoTestCoverageFile() { +while read line +do + echo " 0.00% " ${line} +done +} + +createHtmlOutput() { + echo "" + echo "" + sed "-e s/.*% /
CoverageFile
&<\/td>/" \ + "-e s/[a-zA-Z0-9_]*\.[ch][a-z]*/&<\/a><\/td><\/tr>/" + echo "
" + sed "-e s/.*/&
/g" < ${TEST_RESULTS} +} + + +flattenGcovOutput | getRidOfCruft > ${TEMP_FILE1} +getFileNameRootFromErrorFile | writeEachNoTestCoverageFile > ${TEMP_FILE2} +cat ${TEMP_FILE1} ${TEMP_FILE2} | sort | uniq > ${OUTPUT_FILE} +createHtmlOutput < ${OUTPUT_FILE} > ${HTML_OUTPUT_FILE} +rm -f ${TEMP_FILE1} ${TEMP_FILE2} +erageFile" + sed "-e s/.*% /&<\/td>/" \ + "-e s/[a-zA-Z0-9_]*\.[ch][a-z]*/&<\/a><\/td><\/tr>/" + echo "" + sed "-e s/.*/&
/g" < ${TEST_RESULTS \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/rakefile.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/rakefile.rb new file mode 100644 index 0000000..6181707 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/rakefile.rb @@ -0,0 +1,37 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require HERE + 'rakefile_helper' + +include RakefileHelpers + +# Load default configuration, for now +DEFAULT_CONFIG_FILE = 'gcc.yml' +configure_toolchain(DEFAULT_CONFIG_FILE) + +task :unit do + run_tests +end + +desc "Build and test Unity Framework" +task :all => [:clean, :unit] +task :default => [:clobber, :all] +task :ci => [:no_color, :default] +task :cruise => [:no_color, :default] + +desc "Load configuration" +task :config, :config_file do |t, args| + configure_toolchain(args[:config_file]) +end + +task :no_color do + $colour_output = false +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/rakefile_helper.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/rakefile_helper.rb new file mode 100644 index 0000000..a7f6a28 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/rakefile_helper.rb @@ -0,0 +1,178 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require 'yaml' +require 'fileutils' +require HERE+'../../auto/unity_test_summary' +require HERE+'../../auto/generate_test_runner' +require HERE+'../../auto/colour_reporter' + +module RakefileHelpers + + C_EXTENSION = '.c' + + def load_configuration(config_file) + unless ($configured) + $cfg_file = HERE+"../../targets/#{config_file}" unless (config_file =~ /[\\|\/]/) + $cfg = YAML.load(File.read($cfg_file)) + $colour_output = false unless $cfg['colour'] + $configured = true if (config_file != DEFAULT_CONFIG_FILE) + end + end + + def configure_clean + CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil? + end + + def configure_toolchain(config_file=DEFAULT_CONFIG_FILE) + config_file += '.yml' unless config_file =~ /\.yml$/ + config_file = config_file unless config_file =~ /[\\|\/]/ + load_configuration(config_file) + configure_clean + end + + def tackit(strings) + if strings.is_a?(Array) + result = "\"#{strings.join}\"" + else + result = strings + end + return result + end + + def squash(prefix, items) + result = '' + items.each { |item| result += " #{prefix}#{tackit(item)}" } + return result + end + + def build_compiler_fields + command = tackit($cfg['compiler']['path']) + if $cfg['compiler']['defines']['items'].nil? + defines = '' + else + defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items'] + ['UNITY_OUTPUT_CHAR=UnityOutputCharSpy_OutputChar']) + end + options = squash('', $cfg['compiler']['options']) + includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :defines => defines, :options => options, :includes => includes} + end + + def compile(file, defines=[]) + compiler = build_compiler_fields + unity_include = $cfg['compiler']['includes']['prefix']+'../../src' + cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{unity_include} #{file} " + + "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" + + "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" + execute(cmd_str) + end + + def build_linker_fields + command = tackit($cfg['linker']['path']) + if $cfg['linker']['options'].nil? + options = '' + else + options = squash('', $cfg['linker']['options']) + end + if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?) + includes = '' + else + includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) + end + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :options => options, :includes => includes} + end + + def link(exe_name, obj_list) + linker = build_linker_fields + cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + + (obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).join + + $cfg['linker']['bin_files']['prefix'] + ' ' + + $cfg['linker']['bin_files']['destination'] + + exe_name + $cfg['linker']['bin_files']['extension'] + execute(cmd_str) + end + + def build_simulator_fields + return nil if $cfg['simulator'].nil? + if $cfg['simulator']['path'].nil? + command = '' + else + command = (tackit($cfg['simulator']['path']) + ' ') + end + if $cfg['simulator']['pre_support'].nil? + pre_support = '' + else + pre_support = squash('', $cfg['simulator']['pre_support']) + end + if $cfg['simulator']['post_support'].nil? + post_support = '' + else + post_support = squash('', $cfg['simulator']['post_support']) + end + return {:command => command, :pre_support => pre_support, :post_support => post_support} + end + + def execute(command_string, verbose=true) + report command_string + output = `#{command_string}`.chomp + report(output) if (verbose && !output.nil? && (output.length > 0)) + if ($?.exitstatus != 0) + raise "Command failed. (Returned #{$?.exitstatus})" + end + return output + end + + def report_summary + summary = UnityTestSummary.new + summary.set_root_path(HERE) + results_glob = "#{$cfg['compiler']['build_path']}*.test*" + results_glob.gsub!(/\\/, '/') + results = Dir[results_glob] + summary.set_targets(results) + summary.run + end + + def run_tests + report 'Running Unity system tests...' + + # Tack on TEST define for compiling unit tests + load_configuration($cfg_file) + test_defines = ['TEST'] + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + + # Get a list of all source files needed + src_files = Dir[HERE+'src/*.c'] + src_files += Dir[HERE+'test/*.c'] + src_files << '../../src/Unity.c' + + # Build object files + src_files.each { |f| compile(f, test_defines) } + obj_list = src_files.map {|f| File.basename(f.ext($cfg['compiler']['object_files']['extension'])) } + + # Link the test executable + test_base = "framework_test" + link(test_base, obj_list) + + # Execute unit test and generate results file + simulator = build_simulator_fields + executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] + if simulator.nil? + cmd_str = executable + " -v -r" + else + cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" + end + output = execute(cmd_str) + test_results = $cfg['compiler']['build_path'] + test_base + if output.match(/OK$/m).nil? + test_results += '.testfail' + else + test_results += '.testpass' + end + File.open(test_results, 'w') { |f| f.print output } + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/readme.txt b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/readme.txt new file mode 100644 index 0000000..6b9a78c --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/readme.txt @@ -0,0 +1,9 @@ +Copyright (c) 2010 James Grenning and Contributed to Unity Project + +Unity Project - A Test Framework for C +Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +[Released under MIT License. Please refer to license.txt for details] + +This Framework is an optional add-on to Unity. By including unity_framework.h in place of unity.h, +you may now work with Unity in a manner similar to CppUTest. This framework adds the concepts of +test groups and gives finer control of your tests over the command line. \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c new file mode 100644 index 0000000..1ba3e9a --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c @@ -0,0 +1,381 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" +#include "unity_internals.h" +#include + +UNITY_FIXTURE_T UnityFixture; + +//If you decide to use the function pointer approach. +int (*outputChar)(int) = putchar; + +int verbose = 0; + +void setUp(void) { /*does nothing*/ } +void tearDown(void) { /*does nothing*/ } + +void announceTestRun(int runNumber) +{ + UnityPrint("Unity test run "); + UnityPrintNumber(runNumber+1); + UnityPrint(" of "); + UnityPrintNumber(UnityFixture.RepeatCount); + UNITY_OUTPUT_CHAR('\n'); +} + +int UnityMain(int argc, char* argv[], void (*runAllTests)()) +{ + int result = UnityGetCommandLineOptions(argc, argv); + int r; + if (result != 0) + return result; + + for (r = 0; r < UnityFixture.RepeatCount; r++) + { + announceTestRun(r); + UnityBegin(); + runAllTests(); + UNITY_OUTPUT_CHAR('\n'); + UnityEnd(); + } + + return UnityFailureCount(); +} + +static int selected(const char * filter, const char * name) +{ + if (filter == 0) + return 1; + return strstr(name, filter) ? 1 : 0; +} + +static int testSelected(const char* test) +{ + return selected(UnityFixture.NameFilter, test); +} + +static int groupSelected(const char* group) +{ + return selected(UnityFixture.GroupFilter, group); +} + +static void runTestCase() +{ + +} + +void UnityTestRunner(unityfunction* setup, + unityfunction* testBody, + unityfunction* teardown, + const char * printableName, + const char * group, + const char * name, + const char * file, int line) +{ + if (testSelected(name) && groupSelected(group)) + { + Unity.CurrentTestFailed = 0; + Unity.TestFile = file; + Unity.CurrentTestName = printableName; + Unity.CurrentTestLineNumber = line; + if (!UnityFixture.Verbose) + UNITY_OUTPUT_CHAR('.'); + else + UnityPrint(printableName); + + Unity.NumberOfTests++; + UnityMalloc_StartTest(); + UnityPointer_Init(); + + runTestCase(); + if (TEST_PROTECT()) + { + setup(); + testBody(); + } + if (TEST_PROTECT()) + { + teardown(); + } + if (TEST_PROTECT()) + { + UnityPointer_UndoAllSets(); + if (!Unity.CurrentTestFailed) + UnityMalloc_EndTest(); + UnityConcludeFixtureTest(); + } + else + { + //aborting - jwg - di i need these for the other TEST_PROTECTS? + } + } +} + +void UnityIgnoreTest() +{ + Unity.NumberOfTests++; + Unity.CurrentTestIgnored = 1; + UNITY_OUTPUT_CHAR('!'); +} + + +//------------------------------------------------- +//Malloc and free stuff +// +#define MALLOC_DONT_FAIL -1 +static int malloc_count; +static int malloc_fail_countdown = MALLOC_DONT_FAIL; + +void UnityMalloc_StartTest() +{ + malloc_count = 0; + malloc_fail_countdown = MALLOC_DONT_FAIL; +} + +void UnityMalloc_EndTest() +{ + malloc_fail_countdown = MALLOC_DONT_FAIL; + if (malloc_count != 0) + { + TEST_FAIL_MESSAGE("This test leaks!"); + } +} + +void UnityMalloc_MakeMallocFailAfterCount(int countdown) +{ + malloc_fail_countdown = countdown; +} + +#ifdef malloc +#undef malloc +#endif + +#ifdef free +#undef free +#endif + +#include +#include + +typedef struct GuardBytes +{ + int size; + char guard[sizeof(int)]; +} Guard; + + +static const char * end = "END"; + +void * unity_malloc(size_t size) +{ + char* mem; + Guard* guard; + + if (malloc_fail_countdown != MALLOC_DONT_FAIL) + { + if (malloc_fail_countdown == 0) + return 0; + malloc_fail_countdown--; + } + + malloc_count++; + + guard = (Guard*)malloc(size + sizeof(Guard) + 4); + guard->size = size; + mem = (char*)&(guard[1]); + memcpy(&mem[size], end, strlen(end) + 1); + + return (void*)mem; +} + +static int isOverrun(void * mem) +{ + Guard* guard = (Guard*)mem; + char* memAsChar = (char*)mem; + guard--; + + return strcmp(&memAsChar[guard->size], end) != 0; +} + +static void release_memory(void * mem) +{ + Guard* guard = (Guard*)mem; + guard--; + + malloc_count--; + free(guard); +} + +void unity_free(void * mem) +{ + int overrun = isOverrun(mem);//strcmp(&memAsChar[guard->size], end) != 0; + release_memory(mem); + if (overrun) + { + TEST_FAIL_MESSAGE("Buffer overrun detected during free()"); + } +} + +void* unity_calloc(size_t num, size_t size) +{ + void* mem = unity_malloc(num * size); + memset(mem, 0, num*size); + return mem; +} + +void* unity_realloc(void * oldMem, size_t size) +{ + Guard* guard = (Guard*)oldMem; +// char* memAsChar = (char*)oldMem; + void* newMem; + + if (oldMem == 0) + return unity_malloc(size); + + guard--; + if (isOverrun(oldMem)) + { + release_memory(oldMem); + TEST_FAIL_MESSAGE("Buffer overrun detected during realloc()"); + } + + if (size == 0) + { + release_memory(oldMem); + return 0; + } + + if (guard->size >= size) + return oldMem; + + newMem = unity_malloc(size); + memcpy(newMem, oldMem, size); + unity_free(oldMem); + return newMem; +} + + +//-------------------------------------------------------- +//Automatic pointer restoration functions +typedef struct _PointerPair +{ + struct _PointerPair * next; + void ** pointer; + void * old_value; +} PointerPair; + +enum {MAX_POINTERS=50}; +static PointerPair pointer_store[MAX_POINTERS]; +static int pointer_index = 0; + +void UnityPointer_Init() +{ + pointer_index = 0; +} + +void UnityPointer_Set(void ** pointer, void * newValue) +{ + if (pointer_index >= MAX_POINTERS) + TEST_FAIL_MESSAGE("Too many pointers set"); + + pointer_store[pointer_index].pointer = pointer; + pointer_store[pointer_index].old_value = *pointer; + *pointer = newValue; + pointer_index++; +} + +void UnityPointer_UndoAllSets() +{ + while (pointer_index > 0) + { + pointer_index--; + *(pointer_store[pointer_index].pointer) = + pointer_store[pointer_index].old_value; + + } +} + +int UnityFailureCount() +{ + return Unity.TestFailures; +} + +int UnityGetCommandLineOptions(int argc, char* argv[]) +{ + int i; + UnityFixture.Verbose = 0; + UnityFixture.GroupFilter = 0; + UnityFixture.NameFilter = 0; + UnityFixture.RepeatCount = 1; + + if (argc == 1) + return 0; + + for (i = 1; i < argc; ) + { + if (strcmp(argv[i], "-v") == 0) + { + UnityFixture.Verbose = 1; + i++; + } + else if (strcmp(argv[i], "-g") == 0) + { + i++; + if (i >= argc) + return 1; + UnityFixture.GroupFilter = argv[i]; + i++; + } + else if (strcmp(argv[i], "-n") == 0) + { + i++; + if (i >= argc) + return 1; + UnityFixture.NameFilter = argv[i]; + i++; + } + else if (strcmp(argv[i], "-r") == 0) + { + UnityFixture.RepeatCount = 2; + i++; + if (i < argc) + { + if (*(argv[i]) >= '0' && *(argv[i]) <= '9') + { + UnityFixture.RepeatCount = atoi(argv[i]); + i++; + } + } + } + } + return 0; +} + +void UnityConcludeFixtureTest() +{ + if (Unity.CurrentTestIgnored) + { + Unity.TestIgnores++; + } + else if (!Unity.CurrentTestFailed) + { + if (UnityFixture.Verbose) + { + UnityPrint(" PASS"); + UNITY_OUTPUT_CHAR('\n'); + } + } + else if (Unity.CurrentTestFailed) + { + Unity.TestFailures++; + } + + Unity.CurrentTestFailed = 0; + Unity.CurrentTestIgnored = 0; +} + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.h b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.h new file mode 100644 index 0000000..da1f871 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.h @@ -0,0 +1,81 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FIXTURE_H_ +#define UNITY_FIXTURE_H_ + +#include "unity.h" +#include "unity_internals.h" +#include "unity_fixture_malloc_overrides.h" +#include "unity_fixture_internals.h" + +int UnityMain(int argc, char* argv[], void (*runAllTests)()); + + +#define TEST_GROUP(group)\ + int TEST_GROUP_##group = 0 + +#define TEST_SETUP(group) void TEST_##group##_SETUP() + +#define TEST_TEAR_DOWN(group) void TEST_##group##_TEAR_DOWN() + + +#define TEST(group, name) \ + void TEST_##group##_##name##_();\ + void TEST_##group##_##name##_run()\ + {\ + UnityTestRunner(TEST_##group##_SETUP,\ + TEST_##group##_##name##_,\ + TEST_##group##_TEAR_DOWN,\ + "TEST(" #group ", " #name ")",\ + #group, #name,\ + __FILE__, __LINE__);\ + }\ + void TEST_##group##_##name##_() + +#define IGNORE_TEST(group, name) \ + void TEST_##group##_##name##_();\ + void TEST_##group##_##name##_run()\ + {\ + UnityIgnoreTest();\ + }\ + void TEST_##group##_##name##_() + +#define DECLARE_TEST_CASE(group, name) \ + void TEST_##group##_##name##_run() + +#define RUN_TEST_CASE(group, name) \ + DECLARE_TEST_CASE(group, name);\ + TEST_##group##_##name##_run(); + +//This goes at the bottom of each test file or in a separate c file +#define TEST_GROUP_RUNNER(group)\ + void TEST_##group##_GROUP_RUNNER_runAll();\ + void TEST_##group##_GROUP_RUNNER()\ + {\ + TEST_##group##_GROUP_RUNNER_runAll();\ + }\ + void TEST_##group##_GROUP_RUNNER_runAll() + +//Call this from main +#define RUN_TEST_GROUP(group)\ + void TEST_##group##_GROUP_RUNNER();\ + TEST_##group##_GROUP_RUNNER(); + +//CppUTest Compatibility Macros +#define UT_PTR_SET(ptr, newPointerValue) UnityPointer_Set((void**)&ptr, (void*)newPointerValue) +#define TEST_ASSERT_POINTERS_EQUAL(expected, actual) TEST_ASSERT_EQUAL_PTR(expected, actual) +#define TEST_ASSERT_BYTES_EQUAL(expected, actual) TEST_ASSERT_EQUAL_HEX8(0xff & (expected), 0xff & (actual)) +#define FAIL(message) TEST_FAIL((message)) +#define CHECK(condition) TEST_ASSERT_TRUE((condition)) +#define LONGS_EQUAL(expected, actual) TEST_ASSERT_EQUAL_INT((expected), (actual)) +#define STRCMP_EQUAL(expected, actual) TEST_ASSERT_EQUAL_STRING((expected), (actual)) +#define DOUBLES_EQUAL(expected, actual, delta) TEST_ASSERT_FLOAT_WITHIN(((expected), (actual), (delta)) + +void UnityMalloc_MakeMallocFailAfterCount(int count); + +#endif /* UNITY_FIXTURE_H_ */ diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h new file mode 100644 index 0000000..db23f67 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h @@ -0,0 +1,44 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FIXTURE_INTERNALS_H_ +#define UNITY_FIXTURE_INTERNALS_H_ + +typedef struct _UNITY_FIXTURE_T +{ + int Verbose; + unsigned int RepeatCount; + const char* NameFilter; + const char* GroupFilter; +} UNITY_FIXTURE_T; + +typedef void unityfunction(); +void UnityTestRunner(unityfunction * setup, + unityfunction * body, + unityfunction * teardown, + const char * printableName, + const char * group, + const char * name, + const char * file, int line); + +void UnityIgnoreTest(); +void UnityMalloc_StartTest(); +void UnityMalloc_EndTest(); +int UnityFailureCount(); +int UnityGetCommandLineOptions(int argc, char* argv[]); +void UnityConcludeFixtureTest(); + +void UnityPointer_Set(void ** ptr, void * newValue); +void UnityPointer_UndoAllSets(); +void UnityPointer_Init(); + +void UnityAssertEqualPointer(const void * expected, + const void * actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +#endif /* UNITY_FIXTURE_INTERNALS_H_ */ diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h new file mode 100644 index 0000000..38f8e34 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h @@ -0,0 +1,16 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FIXTURE_MALLOC_OVERRIDES_H_ +#define UNITY_FIXTURE_MALLOC_OVERRIDES_H_ + +#define malloc unity_malloc +#define calloc unity_calloc +#define realloc unity_realloc +#define free unity_free + +#endif /* UNITY_FIXTURE_MALLOC_OVERRIDES_H_ */ diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/main/AllTests.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/main/AllTests.c new file mode 100644 index 0000000..ccb775b --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/main/AllTests.c @@ -0,0 +1,21 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" + +static void runAllTests() +{ + RUN_TEST_GROUP(UnityFixture); + RUN_TEST_GROUP(UnityCommandOptions); + RUN_TEST_GROUP(LeakDetection) +} + +int main(int argc, char* argv[]) +{ + return UnityMain(argc, argv, runAllTests); +} + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/testunity_fixture.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/testunity_fixture.c new file mode 100644 index 0000000..de0c04c --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/testunity_fixture.c @@ -0,0 +1,39 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" + +static int data = -1; + +TEST_GROUP(mygroup); + +TEST_SETUP(mygroup) +{ + data = 0; +} + +TEST_TEAR_DOWN(mygroup) +{ + data = -1; +} + +TEST(mygroup, test1) +{ + TEST_ASSERT_EQUAL_INT(0, data); +} + +TEST(mygroup, test2) +{ + TEST_ASSERT_EQUAL_INT(0, data); + data = 5; +} + +TEST(mygroup, test3) +{ + data = 7; + TEST_ASSERT_EQUAL_INT(7, data); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c new file mode 100644 index 0000000..b8b4524 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c @@ -0,0 +1,321 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" +#include "unity_output_Spy.h" +#include +#include + +extern UNITY_FIXTURE_T UnityFixture; + +TEST_GROUP(UnityFixture); + +TEST_SETUP(UnityFixture) +{ +} + +TEST_TEAR_DOWN(UnityFixture) +{ +} + +int my_int; +int* pointer1 = 0; +int* pointer2 = (int*)2; +int* pointer3 = (int*)3; +int int1; +int int2; +int int3; +int int4; + +TEST(UnityFixture, PointerSetting) +{ + TEST_ASSERT_POINTERS_EQUAL(pointer1, 0); + UT_PTR_SET(pointer1, &int1); + UT_PTR_SET(pointer2, &int2); + UT_PTR_SET(pointer3, &int3); + TEST_ASSERT_POINTERS_EQUAL(pointer1, &int1); + TEST_ASSERT_POINTERS_EQUAL(pointer2, &int2); + TEST_ASSERT_POINTERS_EQUAL(pointer3, &int3); + UT_PTR_SET(pointer1, &int4); + UnityPointer_UndoAllSets(); + TEST_ASSERT_POINTERS_EQUAL(pointer1, 0); + TEST_ASSERT_POINTERS_EQUAL(pointer2, (int*)2); + TEST_ASSERT_POINTERS_EQUAL(pointer3, (int*)3); +} + +TEST(UnityFixture, ForceMallocFail) +{ + UnityMalloc_MakeMallocFailAfterCount(1); + void* m = malloc(10); + CHECK(m); + void* mfails = malloc(10); + TEST_ASSERT_POINTERS_EQUAL(0, mfails); + free(m); +} + +TEST(UnityFixture, ReallocSmallerIsUnchanged) +{ + void* m1 = malloc(10); + void* m2 = realloc(m1, 5); + TEST_ASSERT_POINTERS_EQUAL(m1, m2); + free(m2); +} + +TEST(UnityFixture, ReallocSameIsUnchanged) +{ + void* m1 = malloc(10); + void* m2 = realloc(m1, 10); + TEST_ASSERT_POINTERS_EQUAL(m1, m2); + free(m2); +} + +TEST(UnityFixture, ReallocLargerNeeded) +{ + void* m1 = malloc(10); + strcpy((char*)m1, "123456789"); + void* m2 = realloc(m1, 15); + CHECK(m1 != m2); + STRCMP_EQUAL("123456789", m2); + free(m2); +} + +TEST(UnityFixture, ReallocNullPointerIsLikeMalloc) +{ + void* m = realloc(0, 15); + CHECK(m != 0); + free(m); +} + +TEST(UnityFixture, ReallocSizeZeroFreesMemAndReturnsNullPointer) +{ + void* m1 = malloc(10); + void* m2 = realloc(m1, 0); + TEST_ASSERT_POINTERS_EQUAL(0, m2); +} + +TEST(UnityFixture, CallocFillsWithZero) +{ + void* m = calloc(3, sizeof(char)); + char* s = (char*)m; + TEST_ASSERT_BYTES_EQUAL(0, s[0]); + TEST_ASSERT_BYTES_EQUAL(0, s[1]); + TEST_ASSERT_BYTES_EQUAL(0, s[2]); + free(m); +} + +char *p1; +char *p2; + +TEST(UnityFixture, PointerSet) +{ + char c1; + char c2; + char newC1; + char newC2; + p1 = &c1; + p2 = &c2; + + UnityPointer_Init(10); + UT_PTR_SET(p1, &newC1); + UT_PTR_SET(p2, &newC2); + TEST_ASSERT_POINTERS_EQUAL(&newC1, p1); + TEST_ASSERT_POINTERS_EQUAL(&newC2, p2); + UnityPointer_UndoAllSets(); + TEST_ASSERT_POINTERS_EQUAL(&c1, p1); + TEST_ASSERT_POINTERS_EQUAL(&c2, p2); +} + +//------------------------------------------------------------ + +TEST_GROUP(UnityCommandOptions); + +int savedVerbose; +int savedRepeat; +const char* savedName; +const char* savedGroup; + +TEST_SETUP(UnityCommandOptions) +{ + savedVerbose = UnityFixture.Verbose; + savedRepeat = UnityFixture.RepeatCount; + savedName = UnityFixture.NameFilter; + savedGroup = UnityFixture.GroupFilter; +} + +TEST_TEAR_DOWN(UnityCommandOptions) +{ + UnityFixture.Verbose = savedVerbose; + UnityFixture.RepeatCount= savedRepeat; + UnityFixture.NameFilter = savedName; + UnityFixture.GroupFilter = savedGroup; +} + + +static char* noOptions[] = { + "testrunner.exe" +}; + +TEST(UnityCommandOptions, DefaultOptions) +{ + UnityGetCommandLineOptions(1, noOptions); + TEST_ASSERT_EQUAL(0, UnityFixture.Verbose); + TEST_ASSERT_POINTERS_EQUAL(0, UnityFixture.GroupFilter); + TEST_ASSERT_POINTERS_EQUAL(0, UnityFixture.NameFilter); + TEST_ASSERT_EQUAL(1, UnityFixture.RepeatCount); +} + +static char* verbose[] = { + "testrunner.exe", + "-v" +}; + +TEST(UnityCommandOptions, OptionVerbose) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(2, verbose)); + TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); +} + +static char* group[] = { + "testrunner.exe", + "-g", "groupname" +}; + +TEST(UnityCommandOptions, OptionSelectTestByGroup) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, group)); + STRCMP_EQUAL("groupname", UnityFixture.GroupFilter); +} + +static char* name[] = { + "testrunner.exe", + "-n", "testname" +}; + +TEST(UnityCommandOptions, OptionSelectTestByName) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, name)); + STRCMP_EQUAL("testname", UnityFixture.NameFilter); +} + +static char* repeat[] = { + "testrunner.exe", + "-r", "99" +}; + +TEST(UnityCommandOptions, OptionSelectRepeatTestsDefaultCount) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(2, repeat)); + TEST_ASSERT_EQUAL(2, UnityFixture.RepeatCount); +} + +TEST(UnityCommandOptions, OptionSelectRepeatTestsSpecificCount) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, repeat)); + TEST_ASSERT_EQUAL(99, UnityFixture.RepeatCount); +} + +static char* multiple[] = { + "testrunner.exe", + "-v", + "-g", "groupname", + "-n", "testname", + "-r", "98" +}; + +TEST(UnityCommandOptions, MultipleOptions) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(8, multiple)); + TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); + STRCMP_EQUAL("groupname", UnityFixture.GroupFilter); + STRCMP_EQUAL("testname", UnityFixture.NameFilter); + TEST_ASSERT_EQUAL(98, UnityFixture.RepeatCount); +} + +static char* dashRNotLast[] = { + "testrunner.exe", + "-v", + "-g", "gggg", + "-r", + "-n", "tttt", +}; + +TEST(UnityCommandOptions, MultipleOptionsDashRNotLastAndNoValueSpecified) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(7, dashRNotLast)); + TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); + STRCMP_EQUAL("gggg", UnityFixture.GroupFilter); + STRCMP_EQUAL("tttt", UnityFixture.NameFilter); + TEST_ASSERT_EQUAL(2, UnityFixture.RepeatCount); +} + + +//------------------------------------------------------------ + +TEST_GROUP(LeakDetection); + +TEST_SETUP(LeakDetection) +{ + UnityOutputCharSpy_Create(1000); +} + +TEST_TEAR_DOWN(LeakDetection) +{ + UnityOutputCharSpy_Destroy(); +} + +#define EXPECT_ABORT_BEGIN \ + { \ + jmp_buf TestAbortFrame; \ + memcpy(TestAbortFrame, Unity.AbortFrame, sizeof(jmp_buf)); \ + if (TEST_PROTECT()) \ + { + +#define EXPECT_ABORT_END \ + } \ + memcpy(Unity.AbortFrame, TestAbortFrame, sizeof(jmp_buf)); \ + } + +TEST(LeakDetection, DetectsLeak) +{ + void* m = malloc(10); + UnityOutputCharSpy_Enable(1); + EXPECT_ABORT_BEGIN + UnityMalloc_EndTest(); + EXPECT_ABORT_END + UnityOutputCharSpy_Enable(0); + CHECK(strstr(UnityOutputCharSpy_Get(), "This test leaks!")); + free(m); + Unity.CurrentTestFailed = 0; +} + +TEST(LeakDetection, BufferOverrunFoundDuringFree) +{ + void* m = malloc(10); + char* s = (char*)m; + s[10] = (char)0xFF; + UnityOutputCharSpy_Enable(1); + EXPECT_ABORT_BEGIN + free(m); + EXPECT_ABORT_END + UnityOutputCharSpy_Enable(0); + CHECK(strstr(UnityOutputCharSpy_Get(), "Buffer overrun detected during free()")); + Unity.CurrentTestFailed = 0; +} + +TEST(LeakDetection, BufferOverrunFoundDuringRealloc) +{ + void* m = malloc(10); + char* s = (char*)m; + s[10] = (char)0xFF; + UnityOutputCharSpy_Enable(1); + EXPECT_ABORT_BEGIN + m = realloc(m, 100); + EXPECT_ABORT_END + UnityOutputCharSpy_Enable(0); + CHECK(strstr(UnityOutputCharSpy_Get(), "Buffer overrun detected during realloc()")); + Unity.CurrentTestFailed = 0; +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c new file mode 100644 index 0000000..80fec09 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c @@ -0,0 +1,40 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" + +TEST_GROUP_RUNNER(UnityFixture) +{ + RUN_TEST_CASE(UnityFixture, PointerSetting); + RUN_TEST_CASE(UnityFixture, ForceMallocFail); + RUN_TEST_CASE(UnityFixture, ReallocSmallerIsUnchanged); + RUN_TEST_CASE(UnityFixture, ReallocSameIsUnchanged); + RUN_TEST_CASE(UnityFixture, ReallocLargerNeeded); + RUN_TEST_CASE(UnityFixture, ReallocNullPointerIsLikeMalloc); + RUN_TEST_CASE(UnityFixture, ReallocSizeZeroFreesMemAndReturnsNullPointer); + RUN_TEST_CASE(UnityFixture, CallocFillsWithZero); + RUN_TEST_CASE(UnityFixture, PointerSet); +} + +TEST_GROUP_RUNNER(UnityCommandOptions) +{ + RUN_TEST_CASE(UnityCommandOptions, DefaultOptions); + RUN_TEST_CASE(UnityCommandOptions, OptionVerbose); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectTestByGroup); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectTestByName); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectRepeatTestsDefaultCount); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectRepeatTestsSpecificCount); + RUN_TEST_CASE(UnityCommandOptions, MultipleOptions); + RUN_TEST_CASE(UnityCommandOptions, MultipleOptionsDashRNotLastAndNoValueSpecified); +} + +TEST_GROUP_RUNNER(LeakDetection) +{ + RUN_TEST_CASE(LeakDetection, DetectsLeak); + RUN_TEST_CASE(LeakDetection, BufferOverrunFoundDuringFree); + RUN_TEST_CASE(LeakDetection, BufferOverrunFoundDuringRealloc); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.c new file mode 100644 index 0000000..16faefa --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.c @@ -0,0 +1,56 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + + +#include "unity_output_Spy.h" +#include +#include +#include + +static int size; +static int count; +static char* buffer; +static int spy_enable; + +void UnityOutputCharSpy_Create(int s) +{ + size = s; + count = 0; + spy_enable = 0; + buffer = malloc(size); + memset(buffer, 0, size); +} + +void UnityOutputCharSpy_Destroy() +{ + size = 0; + free(buffer); +} + +int UnityOutputCharSpy_OutputChar(int c) +{ + if (spy_enable) + { + if (count < (size-1)) + buffer[count++] = c; + } + else + { + putchar(c); + } + return c; +} + +const char * UnityOutputCharSpy_Get() +{ + return buffer; +} + +void UnityOutputCharSpy_Enable(int enable) +{ + spy_enable = enable; +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.h b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.h new file mode 100644 index 0000000..7c1590e --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.h @@ -0,0 +1,17 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef D_unity_output_Spy_H +#define D_unity_output_Spy_H + +void UnityOutputCharSpy_Create(int s); +void UnityOutputCharSpy_Destroy(); +int UnityOutputCharSpy_OutputChar(int c); +const char * UnityOutputCharSpy_Get(); +void UnityOutputCharSpy_Enable(int enable); + +#endif diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/makefile b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/makefile new file mode 100644 index 0000000..8c8444b --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/makefile @@ -0,0 +1,35 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +C_COMPILER=gcc +TARGET_BASE = testunity +ifeq ($(OS),Windows_NT) + TARGET_EXTENSION=.exe +else + TARGET_EXTENSION=.out +endif +TARGET = $(TARGET_BASE)$(TARGET_EXTENSION) +OUT_FILE=-o $(TARGET) +SRC_FILES=src/unity.c test/testunity.c build/testunity_Runner.c +INC_DIRS=-Isrc +SYMBOLS=-DTEST -DUNITY_SUPPORT_64 + +ifeq ($(OS),Windows_NT) + CLEANUP = del /F /Q build\* && del /F /Q $(TARGET) +else + CLEANUP = rm -f build/*.o ; rm -f $(TARGET) +endif + +all: clean default + +default: + ruby auto/generate_test_runner.rb test/testunity.c build/testunity_Runner.c + $(C_COMPILER) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES) $(OUT_FILE) + $(TARGET) + +clean: + $(CLEANUP) + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/rakefile.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/rakefile.rb new file mode 100644 index 0000000..3ec5d5a --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/rakefile.rb @@ -0,0 +1,48 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require HERE + 'rakefile_helper' + +include RakefileHelpers + +# Load default configuration, for now +DEFAULT_CONFIG_FILE = 'gcc.yml' +configure_toolchain(DEFAULT_CONFIG_FILE) + +desc "Test unity with its own unit tests" +task :unit do + run_tests get_unit_test_files +end + +Rake::TestTask.new(:scripts) do |t| + t.pattern = 'test/test_*.rb' + t.verbose = true +end + +desc "Generate test summary" +task :summary do + report_summary +end + +desc "Build and test Unity" +task :all => [:clean, :scripts, :unit, :summary] +task :default => [:clobber, :all] +task :ci => [:no_color, :default] +task :cruise => [:no_color, :default] + +desc "Load configuration" +task :config, :config_file do |t, args| + configure_toolchain(args[:config_file]) +end + +task :no_color do + $colour_output = false +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/rakefile_helper.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/rakefile_helper.rb new file mode 100644 index 0000000..218fcaa --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/rakefile_helper.rb @@ -0,0 +1,243 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require 'yaml' +require 'fileutils' +require HERE+'auto/unity_test_summary' +require HERE+'auto/generate_test_runner' +require HERE+'auto/colour_reporter' + +module RakefileHelpers + + C_EXTENSION = '.c' + + def load_configuration(config_file) + unless ($configured) + $cfg_file = "targets/#{config_file}" unless (config_file =~ /[\\|\/]/) + $cfg = YAML.load(File.read($cfg_file)) + $colour_output = false unless $cfg['colour'] + $configured = true if (config_file != DEFAULT_CONFIG_FILE) + end + end + + def configure_clean + CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil? + end + + def configure_toolchain(config_file=DEFAULT_CONFIG_FILE) + config_file += '.yml' unless config_file =~ /\.yml$/ + config_file = config_file unless config_file =~ /[\\|\/]/ + load_configuration(config_file) + configure_clean + end + + def get_unit_test_files + path = $cfg['compiler']['unit_tests_path'] + 'test*' + C_EXTENSION + path.gsub!(/\\/, '/') + FileList.new(path) + end + + def get_local_include_dirs + include_dirs = $cfg['compiler']['includes']['items'].dup + include_dirs.delete_if {|dir| dir.is_a?(Array)} + return include_dirs + end + + def extract_headers(filename) + includes = [] + lines = File.readlines(filename) + lines.each do |line| + m = line.match(/^\s*#include\s+\"\s*(.+\.[hH])\s*\"/) + if not m.nil? + includes << m[1] + end + end + return includes + end + + def find_source_file(header, paths) + paths.each do |dir| + src_file = dir + header.ext(C_EXTENSION) + if (File.exists?(src_file)) + return src_file + end + end + return nil + end + + def tackit(strings) + if strings.is_a?(Array) + result = "\"#{strings.join}\"" + else + result = strings + end + return result + end + + def squash(prefix, items) + result = '' + items.each { |item| result += " #{prefix}#{tackit(item)}" } + return result + end + + def build_compiler_fields + command = tackit($cfg['compiler']['path']) + if $cfg['compiler']['defines']['items'].nil? + defines = '' + else + defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items']) + end + options = squash('', $cfg['compiler']['options']) + includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :defines => defines, :options => options, :includes => includes} + end + + def compile(file, defines=[]) + compiler = build_compiler_fields + cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{file} " + + "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" + + "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" + execute(cmd_str) + end + + def build_linker_fields + command = tackit($cfg['linker']['path']) + if $cfg['linker']['options'].nil? + options = '' + else + options = squash('', $cfg['linker']['options']) + end + if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?) + includes = '' + else + includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) + end + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :options => options, :includes => includes} + end + + def link(exe_name, obj_list) + linker = build_linker_fields + cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + + (obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).join + + $cfg['linker']['bin_files']['prefix'] + ' ' + + $cfg['linker']['bin_files']['destination'] + + exe_name + $cfg['linker']['bin_files']['extension'] + execute(cmd_str) + end + + def build_simulator_fields + return nil if $cfg['simulator'].nil? + if $cfg['simulator']['path'].nil? + command = '' + else + command = (tackit($cfg['simulator']['path']) + ' ') + end + if $cfg['simulator']['pre_support'].nil? + pre_support = '' + else + pre_support = squash('', $cfg['simulator']['pre_support']) + end + if $cfg['simulator']['post_support'].nil? + post_support = '' + else + post_support = squash('', $cfg['simulator']['post_support']) + end + return {:command => command, :pre_support => pre_support, :post_support => post_support} + end + + def execute(command_string, verbose=true) + report command_string + output = `#{command_string}`.chomp + report(output) if (verbose && !output.nil? && (output.length > 0)) + if $?.exitstatus != 0 + raise "Command failed. (Returned #{$?.exitstatus})" + end + return output + end + + def report_summary + summary = UnityTestSummary.new + summary.set_root_path(HERE) + results_glob = "#{$cfg['compiler']['build_path']}*.test*" + results_glob.gsub!(/\\/, '/') + results = Dir[results_glob] + summary.set_targets(results) + summary.run + end + + def run_tests(test_files) + report 'Running Unity system tests...' + + # Tack on TEST define for compiling unit tests + load_configuration($cfg_file) + test_defines = ['TEST'] + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + $cfg['compiler']['defines']['items'] << 'TEST' + + include_dirs = get_local_include_dirs + + # Build and execute each unit test + test_files.each do |test| + obj_list = [] + + # Detect dependencies and build required modules + extract_headers(test).each do |header| + # Compile corresponding source file if it exists + src_file = find_source_file(header, include_dirs) + if !src_file.nil? + compile(src_file, test_defines) + obj_list << header.ext($cfg['compiler']['object_files']['extension']) + end + end + + # Build the test runner (generate if configured to do so) + test_base = File.basename(test, C_EXTENSION) + + runner_name = test_base + '_Runner.c' + runner_path = '' + + if $cfg['compiler']['runner_path'].nil? + runner_path = $cfg['compiler']['build_path'] + runner_name + else + runner_path = $cfg['compiler']['runner_path'] + runner_name + end + + options = $cfg[:unity] + options[:use_param_tests] = (test =~ /parameterized/) ? true : false + UnityTestRunnerGenerator.new(options).run(test, runner_path) + + compile(runner_path, test_defines) + obj_list << runner_name.ext($cfg['compiler']['object_files']['extension']) + + # Build the test module + compile(test, test_defines) + obj_list << test_base.ext($cfg['compiler']['object_files']['extension']) + + # Link the test executable + link(test_base, obj_list) + + # Execute unit test and generate results file + simulator = build_simulator_fields + executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] + if simulator.nil? + cmd_str = executable + else + cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" + end + output = execute(cmd_str) + test_results = $cfg['compiler']['build_path'] + test_base + if output.match(/OK$/m).nil? + test_results += '.testfail' + else + test_results += '.testpass' + end + File.open(test_results, 'w') { |f| f.print output } + + end + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/release/build.info b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/release/build.info new file mode 100644 index 0000000..7871b21 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/release/build.info @@ -0,0 +1,2 @@ +118 + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/release/version.info b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/release/version.info new file mode 100644 index 0000000..0d71c08 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/release/version.info @@ -0,0 +1,2 @@ +2.0 + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/src/unity.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/src/unity.c new file mode 100644 index 0000000..d85b880 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/src/unity.c @@ -0,0 +1,855 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity.h" +#include +#include + +#define UNITY_FAIL_AND_BAIL { Unity.CurrentTestFailed = 1; UNITY_OUTPUT_CHAR('\n'); longjmp(Unity.AbortFrame, 1); } +#define UNITY_IGNORE_AND_BAIL { Unity.CurrentTestIgnored = 1; UNITY_OUTPUT_CHAR('\n'); longjmp(Unity.AbortFrame, 1); } +/// return prematurely if we are already in failure or ignore state +#define UNITY_SKIP_EXECUTION { if ((Unity.CurrentTestFailed != 0) || (Unity.CurrentTestIgnored != 0)) {return;} } +#define UNITY_PRINT_EOL { UNITY_OUTPUT_CHAR('\n'); } + +struct _Unity Unity = { 0 }; + +const char* UnityStrNull = "NULL"; +const char* UnityStrSpacer = ". "; +const char* UnityStrExpected = " Expected "; +const char* UnityStrWas = " Was "; +const char* UnityStrTo = " To "; +const char* UnityStrElement = " Element "; +const char* UnityStrMemory = " Memory Mismatch"; +const char* UnityStrDelta = " Values Not Within Delta "; +const char* UnityStrPointless= " You Asked Me To Compare Nothing, Which Was Pointless."; +const char* UnityStrNullPointerForExpected= " Expected pointer to be NULL"; +const char* UnityStrNullPointerForActual = " Actual pointer was NULL"; + +const _U_UINT UnitySizeMask[] = +{ + 255, + 65535, + 65535, + 4294967295, + 4294967295, + 4294967295, + 4294967295 +#ifdef UNITY_SUPPORT_64 + ,0xFFFFFFFFFFFFFFFF +#endif +}; + +//----------------------------------------------- +// Pretty Printers & Test Result Output Handlers +//----------------------------------------------- + +void UnityPrint(const char* string) +{ + const char* pch = string; + + if (pch != NULL) + { + while (*pch) + { + // printable characters plus CR & LF are printed + if ((*pch <= 126) && (*pch >= 32)) + { + UNITY_OUTPUT_CHAR(*pch); + } + //write escaped carriage returns + else if (*pch == 13) + { + UNITY_OUTPUT_CHAR('\\'); + UNITY_OUTPUT_CHAR('r'); + } + //write escaped line feeds + else if (*pch == 10) + { + UNITY_OUTPUT_CHAR('\\'); + UNITY_OUTPUT_CHAR('n'); + } + // unprintable characters are shown as codes + else + { + UNITY_OUTPUT_CHAR('\\'); + UnityPrintNumberHex((_U_SINT)*pch, 2); + } + pch++; + } + } +} + +//----------------------------------------------- +void UnityPrintNumberByStyle(const _U_SINT number, const UNITY_DISPLAY_STYLE_T style) +{ + if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT) + { + UnityPrintNumber(number); + } + else if ((style & UNITY_DISPLAY_RANGE_UINT) == UNITY_DISPLAY_RANGE_UINT) + { + UnityPrintNumberUnsigned( (_U_UINT)number & UnitySizeMask[((_U_UINT)style & (_U_UINT)0x0F) - 1] ); + } + else + { + UnityPrintNumberHex((_U_UINT)number, (style & 0x000F) << 1); + } +} + +//----------------------------------------------- +/// basically do an itoa using as little ram as possible +void UnityPrintNumber(const _U_SINT number_to_print) +{ + _U_SINT divisor = 1; + _U_SINT next_divisor; + _U_SINT number = number_to_print; + + if (number < 0) + { + UNITY_OUTPUT_CHAR('-'); + number = -number; + } + + // figure out initial divisor + while (number / divisor > 9) + { + next_divisor = divisor * 10; + if (next_divisor > divisor) + divisor = next_divisor; + else + break; + } + + // now mod and print, then divide divisor + do + { + UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10))); + divisor /= 10; + } + while (divisor > 0); +} + +//----------------------------------------------- +/// basically do an itoa using as little ram as possible +void UnityPrintNumberUnsigned(const _U_UINT number) +{ + _U_UINT divisor = 1; + _U_UINT next_divisor; + + // figure out initial divisor + while (number / divisor > 9) + { + next_divisor = divisor * 10; + if (next_divisor > divisor) + divisor = next_divisor; + else + break; + } + + // now mod and print, then divide divisor + do + { + UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10))); + divisor /= 10; + } + while (divisor > 0); +} + +//----------------------------------------------- +void UnityPrintNumberHex(const _U_UINT number, const char nibbles_to_print) +{ + _U_UINT nibble; + char nibbles = nibbles_to_print; + UNITY_OUTPUT_CHAR('0'); + UNITY_OUTPUT_CHAR('x'); + + while (nibbles > 0) + { + nibble = (number >> (--nibbles << 2)) & 0x0000000F; + if (nibble <= 9) + { + UNITY_OUTPUT_CHAR((char)('0' + nibble)); + } + else + { + UNITY_OUTPUT_CHAR((char)('A' - 10 + nibble)); + } + } +} + +//----------------------------------------------- +void UnityPrintMask(const _U_UINT mask, const _U_UINT number) +{ + _U_UINT current_bit = (_U_UINT)1 << (UNITY_INT_WIDTH - 1); + _US32 i; + + for (i = 0; i < UNITY_INT_WIDTH; i++) + { + if (current_bit & mask) + { + if (current_bit & number) + { + UNITY_OUTPUT_CHAR('1'); + } + else + { + UNITY_OUTPUT_CHAR('0'); + } + } + else + { + UNITY_OUTPUT_CHAR('X'); + } + current_bit = current_bit >> 1; + } +} + +//----------------------------------------------- +#ifdef UNITY_FLOAT_VERBOSE +void UnityPrintFloat(_UF number) +{ + char TempBuffer[32]; + sprintf(TempBuffer, "%.6f", number); + UnityPrint(TempBuffer); +} +#endif + +//----------------------------------------------- +void UnityTestResultsBegin(const char* file, const UNITY_LINE_TYPE line) +{ + UnityPrint(file); + UNITY_OUTPUT_CHAR(':'); + UnityPrintNumber(line); + UNITY_OUTPUT_CHAR(':'); + UnityPrint(Unity.CurrentTestName); + UNITY_OUTPUT_CHAR(':'); +} + +//----------------------------------------------- +void UnityTestResultsFailBegin(const UNITY_LINE_TYPE line) +{ + UnityTestResultsBegin(Unity.TestFile, line); + UnityPrint("FAIL:"); +} + +//----------------------------------------------- +void UnityConcludeTest(void) +{ + if (Unity.CurrentTestIgnored) + { + Unity.TestIgnores++; + } + else if (!Unity.CurrentTestFailed) + { + UnityTestResultsBegin(Unity.TestFile, Unity.CurrentTestLineNumber); + UnityPrint("PASS"); + UNITY_PRINT_EOL; + } + else + { + Unity.TestFailures++; + } + + Unity.CurrentTestFailed = 0; + Unity.CurrentTestIgnored = 0; +} + +//----------------------------------------------- +void UnityAddMsgIfSpecified(const char* msg) +{ + if (msg) + { + UnityPrint(UnityStrSpacer); + UnityPrint(msg); + } +} + +//----------------------------------------------- +void UnityPrintExpectedAndActualStrings(const char* expected, const char* actual) +{ + UnityPrint(UnityStrExpected); + if (expected != NULL) + { + UNITY_OUTPUT_CHAR('\''); + UnityPrint(expected); + UNITY_OUTPUT_CHAR('\''); + } + else + { + UnityPrint(UnityStrNull); + } + UnityPrint(UnityStrWas); + if (actual != NULL) + { + UNITY_OUTPUT_CHAR('\''); + UnityPrint(actual); + UNITY_OUTPUT_CHAR('\''); + } + else + { + UnityPrint(UnityStrNull); + } +} + +//----------------------------------------------- +// Assertion & Control Helpers +//----------------------------------------------- + +int UnityCheckArraysForNull(const void* expected, const void* actual, const UNITY_LINE_TYPE lineNumber, const char* msg) +{ + //return true if they are both NULL + if ((expected == NULL) && (actual == NULL)) + return 1; + + //throw error if just expected is NULL + if (expected == NULL) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrNullPointerForExpected); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + //throw error if just actual is NULL + if (actual == NULL) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrNullPointerForActual); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + //return false if neither is NULL + return 0; +} + +//----------------------------------------------- +// Assertion Functions +//----------------------------------------------- + +void UnityAssertBits(const _U_SINT mask, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + UNITY_SKIP_EXECUTION; + + if ((mask & expected) != (mask & actual)) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrExpected); + UnityPrintMask(mask, expected); + UnityPrint(UnityStrWas); + UnityPrintMask(mask, actual); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualNumber(const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style) +{ + UNITY_SKIP_EXECUTION; + + if (expected != actual) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(expected, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(actual, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualIntArray(const _U_SINT* expected, + const _U_SINT* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style) +{ + _UU32 elements = num_elements; + const _US8* ptr_exp = (_US8*)expected; + const _US8* ptr_act = (_US8*)actual; + + UNITY_SKIP_EXECUTION; + + if (elements == 0) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + switch(style) + { + case UNITY_DISPLAY_STYLE_HEX8: + case UNITY_DISPLAY_STYLE_INT8: + case UNITY_DISPLAY_STYLE_UINT8: + while (elements--) + { + if (*ptr_exp != *ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 1; + ptr_act += 1; + } + break; + case UNITY_DISPLAY_STYLE_HEX16: + case UNITY_DISPLAY_STYLE_INT16: + case UNITY_DISPLAY_STYLE_UINT16: + while (elements--) + { + if (*(_US16*)ptr_exp != *(_US16*)ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*(_US16*)ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*(_US16*)ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 2; + ptr_act += 2; + } + break; +#ifdef UNITY_SUPPORT_64 + case UNITY_DISPLAY_STYLE_HEX64: + case UNITY_DISPLAY_STYLE_INT64: + case UNITY_DISPLAY_STYLE_UINT64: + while (elements--) + { + if (*(_US64*)ptr_exp != *(_US64*)ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*(_US64*)ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*(_US64*)ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 8; + ptr_act += 8; + } + break; +#endif + default: + while (elements--) + { + if (*(_US32*)ptr_exp != *(_US32*)ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*(_US32*)ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*(_US32*)ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 4; + ptr_act += 4; + } + break; + } +} + +//----------------------------------------------- +#ifndef UNITY_EXCLUDE_FLOAT +void UnityAssertEqualFloatArray(const _UF* expected, + const _UF* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UU32 elements = num_elements; + const _UF* ptr_expected = expected; + const _UF* ptr_actual = actual; + _UF diff, tol; + + UNITY_SKIP_EXECUTION; + + if (elements == 0) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + while (elements--) + { + diff = *ptr_expected - *ptr_actual; + if (diff < 0.0) + diff = 0.0 - diff; + tol = UNITY_FLOAT_PRECISION * *ptr_expected; + if (tol < 0.0) + tol = 0.0 - tol; + if (diff > tol) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); +#ifdef UNITY_FLOAT_VERBOSE + UnityPrint(UnityStrExpected); + UnityPrintFloat(*ptr_expected); + UnityPrint(UnityStrWas); + UnityPrintFloat(*ptr_actual); +#else + UnityPrint(UnityStrDelta); +#endif + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_expected++; + ptr_actual++; + } +} + +//----------------------------------------------- +void UnityAssertFloatsWithin(const _UF delta, + const _UF expected, + const _UF actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UF diff = actual - expected; + _UF pos_delta = delta; + + UNITY_SKIP_EXECUTION; + + if (diff < 0) + { + diff = 0.0f - diff; + } + if (pos_delta < 0) + { + pos_delta = 0.0f - pos_delta; + } + + if (pos_delta < diff) + { + UnityTestResultsFailBegin(lineNumber); +#ifdef UNITY_FLOAT_VERBOSE + UnityPrint(UnityStrExpected); + UnityPrintFloat(expected); + UnityPrint(UnityStrWas); + UnityPrintFloat(actual); +#else + UnityPrint(UnityStrDelta); +#endif + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} +#endif + +//----------------------------------------------- +void UnityAssertNumbersWithin( const _U_SINT delta, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style) +{ + UNITY_SKIP_EXECUTION; + + if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT) + { + if (actual > expected) + Unity.CurrentTestFailed = ((actual - expected) > delta); + else + Unity.CurrentTestFailed = ((expected - actual) > delta); + } + else + { + if ((_U_UINT)actual > (_U_UINT)expected) + Unity.CurrentTestFailed = ((_U_UINT)(actual - expected) > (_U_UINT)delta); + else + Unity.CurrentTestFailed = ((_U_UINT)(expected - actual) > (_U_UINT)delta); + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrDelta); + UnityPrintNumberByStyle(delta, style); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(expected, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(actual, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualString(const char* expected, + const char* actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UU32 i; + + UNITY_SKIP_EXECUTION; + + // if both pointers not null compare the strings + if (expected && actual) + { + for (i = 0; expected[i] || actual[i]; i++) + { + if (expected[i] != actual[i]) + { + Unity.CurrentTestFailed = 1; + break; + } + } + } + else + { // handle case of one pointers being null (if both null, test should pass) + if (expected != actual) + { + Unity.CurrentTestFailed = 1; + } + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrintExpectedAndActualStrings(expected, actual); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualStringArray( const char** expected, + const char** actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UU32 i, j = 0; + + UNITY_SKIP_EXECUTION; + + // if no elements, it's an error + if (num_elements == 0) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + do + { + // if both pointers not null compare the strings + if (expected[j] && actual[j]) + { + for (i = 0; expected[j][i] || actual[j][i]; i++) + { + if (expected[j][i] != actual[j][i]) + { + Unity.CurrentTestFailed = 1; + break; + } + } + } + else + { // handle case of one pointers being null (if both null, test should pass) + if (expected[j] != actual[j]) + { + Unity.CurrentTestFailed = 1; + } + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + if (num_elements > 1) + { + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - j - 1), UNITY_DISPLAY_STYLE_UINT); + } + UnityPrintExpectedAndActualStrings((const char*)(expected[j]), (const char*)(actual[j])); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + } while (++j < num_elements); +} + +//----------------------------------------------- +void UnityAssertEqualMemory( const void* expected, + const void* actual, + _UU32 length, + _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + unsigned char* expected_ptr = (unsigned char*)expected; + unsigned char* actual_ptr = (unsigned char*)actual; + _UU32 elements = num_elements; + + UNITY_SKIP_EXECUTION; + + if ((elements == 0) || (length == 0)) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + while (elements--) + { + if (memcmp((const void*)expected_ptr, (const void*)actual_ptr, length) != 0) + { + Unity.CurrentTestFailed = 1; + break; + } + expected_ptr += length; + actual_ptr += length; + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + if (num_elements > 1) + { + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + } + UnityPrint(UnityStrMemory); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +// Control Functions +//----------------------------------------------- + +void UnityFail(const char* msg, const UNITY_LINE_TYPE line) +{ + UNITY_SKIP_EXECUTION; + + UnityTestResultsBegin(Unity.TestFile, line); + UnityPrint("FAIL"); + if (msg != NULL) + { + UNITY_OUTPUT_CHAR(':'); + if (msg[0] != ' ') + { + UNITY_OUTPUT_CHAR(' '); + } + UnityPrint(msg); + } + UNITY_FAIL_AND_BAIL; +} + +//----------------------------------------------- +void UnityIgnore(const char* msg, const UNITY_LINE_TYPE line) +{ + UNITY_SKIP_EXECUTION; + + UnityTestResultsBegin(Unity.TestFile, line); + UnityPrint("IGNORE"); + if (msg != NULL) + { + UNITY_OUTPUT_CHAR(':'); + UNITY_OUTPUT_CHAR(' '); + UnityPrint(msg); + } + UNITY_IGNORE_AND_BAIL; +} + +//----------------------------------------------- +void setUp(void); +void tearDown(void); +void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum) +{ + Unity.CurrentTestName = FuncName; + Unity.CurrentTestLineNumber = FuncLineNum; + Unity.NumberOfTests++; + if (TEST_PROTECT()) + { + setUp(); + Func(); + } + if (TEST_PROTECT() && !(Unity.CurrentTestIgnored)) + { + tearDown(); + } + UnityConcludeTest(); +} + +//----------------------------------------------- +void UnityBegin(void) +{ + Unity.NumberOfTests = 0; +} + +//----------------------------------------------- +int UnityEnd(void) +{ + UnityPrint("-----------------------"); + UNITY_PRINT_EOL; + UnityPrintNumber(Unity.NumberOfTests); + UnityPrint(" Tests "); + UnityPrintNumber(Unity.TestFailures); + UnityPrint(" Failures "); + UnityPrintNumber(Unity.TestIgnores); + UnityPrint(" Ignored"); + UNITY_PRINT_EOL; + if (Unity.TestFailures == 0U) + { + UnityPrint("OK"); + } + else + { + UnityPrint("FAIL"); + } + UNITY_PRINT_EOL; + return Unity.TestFailures; +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/src/unity.h b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/src/unity.h new file mode 100644 index 0000000..0b1b187 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/src/unity.h @@ -0,0 +1,213 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FRAMEWORK_H +#define UNITY_FRAMEWORK_H + +#define UNITY + +#include "unity_internals.h" + +//------------------------------------------------------- +// Configuration Options +//------------------------------------------------------- + +// Integers +// - Unity assumes 32 bit integers by default +// - If your compiler treats ints of a different size, define UNITY_INT_WIDTH + +// Floats +// - define UNITY_EXCLUDE_FLOAT to disallow floating point comparisons +// - define UNITY_FLOAT_PRECISION to specify the precision to use when doing TEST_ASSERT_EQUAL_FLOAT +// - define UNITY_FLOAT_TYPE to specify doubles instead of single precision floats +// - define UNITY_FLOAT_VERBOSE to print floating point values in errors (uses sprintf) + +// Output +// - by default, Unity prints to standard out with putchar. define UNITY_OUTPUT_CHAR(a) with a different function if desired + +// Optimization +// - by default, line numbers are stored in unsigned shorts. Define UNITY_LINE_TYPE with a different type if your files are huge +// - by default, test and failure counters are unsigned shorts. Define UNITY_COUNTER_TYPE with a different type if you want to save space or have more than 65535 Tests. + +// Test Cases +// - define UNITY_SUPPORT_TEST_CASES to include the TEST_CASE macro, though really it's mostly about the runner generator script + +// Parameterized Tests +// - you'll want to create a define of TEST_CASE(...) which basically evaluates to nothing + +//------------------------------------------------------- +// Test Running Macros +//------------------------------------------------------- + +#define TEST_PROTECT() (setjmp(Unity.AbortFrame) == 0) + +#define TEST_ABORT() {longjmp(Unity.AbortFrame, 1);} + +#ifndef RUN_TEST +#define RUN_TEST(func, line_num) UnityDefaultTestRun(func, #func, line_num) +#endif + +#define TEST_LINE_NUM (Unity.CurrentTestLineNumber) +#define TEST_IS_IGNORED (Unity.CurrentTestIgnored) + +//------------------------------------------------------- +// Basic Fail and Ignore +//------------------------------------------------------- + +#define TEST_FAIL_MESSAGE(message) UNITY_TEST_FAIL(__LINE__, message) +#define TEST_FAIL() UNITY_TEST_FAIL(__LINE__, NULL) +#define TEST_IGNORE_MESSAGE(message) UNITY_TEST_IGNORE(__LINE__, message) +#define TEST_IGNORE() UNITY_TEST_IGNORE(__LINE__, NULL) +#define TEST_ONLY() + +//------------------------------------------------------- +// Test Asserts (simple) +//------------------------------------------------------- + +//Boolean +#define TEST_ASSERT(condition) UNITY_TEST_ASSERT( (condition), __LINE__, " Expression Evaluated To FALSE") +#define TEST_ASSERT_TRUE(condition) UNITY_TEST_ASSERT( (condition), __LINE__, " Expected TRUE Was FALSE") +#define TEST_ASSERT_UNLESS(condition) UNITY_TEST_ASSERT( !(condition), __LINE__, " Expression Evaluated To TRUE") +#define TEST_ASSERT_FALSE(condition) UNITY_TEST_ASSERT( !(condition), __LINE__, " Expected FALSE Was TRUE") +#define TEST_ASSERT_NULL(pointer) UNITY_TEST_ASSERT_NULL( (pointer), __LINE__, " Expected NULL") +#define TEST_ASSERT_NOT_NULL(pointer) UNITY_TEST_ASSERT_NOT_NULL((pointer), __LINE__, " Expected Non-NULL") + +//Integers (of all sizes) +#define TEST_ASSERT_EQUAL_INT(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT8(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT8((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT16(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT16((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT32(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT32((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT64(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT64((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_NOT_EQUAL(expected, actual) UNITY_TEST_ASSERT(((expected) != (actual)), __LINE__, " Expected Not-Equal") +#define TEST_ASSERT_EQUAL_UINT(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT8(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT8( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT16(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT16( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT32(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT32( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT64(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT64( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX8(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX8( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX16(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX16((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX32(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX64(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX64((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_BITS(mask, expected, actual) UNITY_TEST_ASSERT_BITS((mask), (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_BITS_HIGH(mask, actual) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(-1), (actual), __LINE__, NULL) +#define TEST_ASSERT_BITS_LOW(mask, actual) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(0), (actual), __LINE__, NULL) +#define TEST_ASSERT_BIT_HIGH(bit, actual) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(-1), (actual), __LINE__, NULL) +#define TEST_ASSERT_BIT_LOW(bit, actual) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(0), (actual), __LINE__, NULL) + +//Integer Ranges (of all sizes) +#define TEST_ASSERT_INT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_UINT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX8_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX16_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX32_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX64_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, __LINE__, NULL) + +//Structs and Strings +#define TEST_ASSERT_EQUAL_PTR(expected, actual) UNITY_TEST_ASSERT_EQUAL_PTR((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_STRING(expected, actual) UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_MEMORY(expected, actual, len) UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, __LINE__, NULL) + +//Arrays +#define TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements) UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, __LINE__, NULL) + +//Floating Point (If Enabled) +#define TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_FLOAT(expected, actual) UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, __LINE__, NULL) + +//------------------------------------------------------- +// Test Asserts (with additional messages) +//------------------------------------------------------- + +//Boolean +#define TEST_ASSERT_MESSAGE(condition, message) UNITY_TEST_ASSERT( (condition), __LINE__, message) +#define TEST_ASSERT_TRUE_MESSAGE(condition, message) UNITY_TEST_ASSERT( (condition), __LINE__, message) +#define TEST_ASSERT_UNLESS_MESSAGE(condition, message) UNITY_TEST_ASSERT( !(condition), __LINE__, message) +#define TEST_ASSERT_FALSE_MESSAGE(condition, message) UNITY_TEST_ASSERT( !(condition), __LINE__, message) +#define TEST_ASSERT_NULL_MESSAGE(pointer, message) UNITY_TEST_ASSERT_NULL( (pointer), __LINE__, message) +#define TEST_ASSERT_NOT_NULL_MESSAGE(pointer, message) UNITY_TEST_ASSERT_NOT_NULL((pointer), __LINE__, message) + +//Integers (of all sizes) +#define TEST_ASSERT_EQUAL_INT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT8((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT16((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT32((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT64((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, message) +#define TEST_ASSERT_NOT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT(((expected) != (actual)), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT8( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT16( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT32( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT64( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX8( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX16((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX64((expected), (actual), __LINE__, message) +#define TEST_ASSERT_BITS_MESSAGE(mask, expected, actual, message) UNITY_TEST_ASSERT_BITS((mask), (expected), (actual), __LINE__, message) +#define TEST_ASSERT_BITS_HIGH_MESSAGE(mask, actual, message) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(-1), (actual), __LINE__, message) +#define TEST_ASSERT_BITS_LOW_MESSAGE(mask, actual, message) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(0), (actual), __LINE__, message) +#define TEST_ASSERT_BIT_HIGH_MESSAGE(bit, actual, message) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(-1), (actual), __LINE__, message) +#define TEST_ASSERT_BIT_LOW_MESSAGE(bit, actual, message) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(0), (actual), __LINE__, message) + +//Integer Ranges (of all sizes) +#define TEST_ASSERT_INT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_UINT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX8_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX16_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX32_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX64_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, __LINE__, message) + +//Structs and Strings +#define TEST_ASSERT_EQUAL_PTR_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_PTR(expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_STRING_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_MEMORY_MESSAGE(expected, actual, len, message) UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, __LINE__, message) + +//Arrays +#define TEST_ASSERT_EQUAL_INT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_STRING_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_MEMORY_ARRAY_MESSAGE(expected, actual, len, num_elements, message) UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, __LINE__, message) + +//Floating Point (If Enabled) +#define TEST_ASSERT_FLOAT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_FLOAT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_FLOAT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, __LINE__, message) +#endif diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/src/unity_internals.h b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/src/unity_internals.h new file mode 100644 index 0000000..29c9d1d --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/src/unity_internals.h @@ -0,0 +1,355 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_INTERNALS_H +#define UNITY_INTERNALS_H + +#include +#include + +//------------------------------------------------------- +// Int Support +//------------------------------------------------------- + +#ifndef UNITY_INT_WIDTH +#define UNITY_INT_WIDTH (32) +#endif + +#ifndef UNITY_LONG_WIDTH +#define UNITY_LONG_WIDTH (32) +#endif + +#if (UNITY_INT_WIDTH == 32) + typedef unsigned char _UU8; + typedef unsigned short _UU16; + typedef unsigned int _UU32; + typedef signed char _US8; + typedef signed short _US16; + typedef signed int _US32; +#elif (UNITY_INT_WIDTH == 16) + typedef unsigned char _UU8; + typedef unsigned int _UU16; + typedef unsigned long _UU32; + typedef signed char _US8; + typedef signed int _US16; + typedef signed long _US32; +#else + #error Invalid UNITY_INT_WIDTH specified! (16 or 32 are supported) +#endif + +//------------------------------------------------------- +// 64-bit Support +//------------------------------------------------------- + +#ifndef UNITY_SUPPORT_64 + +//No 64-bit Support +typedef _UU32 _U_UINT; +typedef _US32 _U_SINT; + +#else + +//64-bit Support +#if (UNITY_LONG_WIDTH == 32) + typedef unsigned long long _UU64; + typedef signed long long _US64; +#elif (UNITY_LONG_WIDTH == 64) + typedef unsigned long _UU64; + typedef signed long _US64; +#else + #error Invalid UNITY_LONG_WIDTH specified! (32 or 64 are supported) +#endif +typedef _UU64 _U_UINT; +typedef _US64 _U_SINT; + +#endif + +//------------------------------------------------------- +// Pointer Support +//------------------------------------------------------- + +#ifndef UNITY_POINTER_WIDTH +#define UNITY_POINTER_WIDTH (32) +#endif + +#if (UNITY_POINTER_WIDTH == 32) + typedef _UU32 _UP; +#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX32 +#elif (UNITY_POINTER_WIDTH == 64) + typedef _UU64 _UP; +#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX64 +#elif (UNITY_POINTER_WIDTH == 16) + typedef _UU16 _UP; +#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX16 +#else + #error Invalid UNITY_POINTER_WIDTH specified! (16, 32 or 64 are supported) +#endif + +//------------------------------------------------------- +// Float Support +//------------------------------------------------------- + +#ifdef UNITY_EXCLUDE_FLOAT + +//No Floating Point Support +#undef UNITY_FLOAT_PRECISION +#undef UNITY_FLOAT_TYPE +#undef UNITY_FLOAT_VERBOSE + +#else + +//Floating Point Support +#ifndef UNITY_FLOAT_PRECISION +#define UNITY_FLOAT_PRECISION (0.00001f) +#endif +#ifndef UNITY_FLOAT_TYPE +#define UNITY_FLOAT_TYPE float +#endif +typedef UNITY_FLOAT_TYPE _UF; + +#endif + +//------------------------------------------------------- +// Output Method +//------------------------------------------------------- + +#ifndef UNITY_OUTPUT_CHAR +//Default to using putchar, which is defined in stdio.h above +#define UNITY_OUTPUT_CHAR(a) putchar(a) +#else +//If defined as something else, make sure we declare it here so it's ready for use +extern int UNITY_OUTPUT_CHAR(int); +#endif + +//------------------------------------------------------- +// Footprint +//------------------------------------------------------- + +#ifndef UNITY_LINE_TYPE +#define UNITY_LINE_TYPE unsigned short +#endif + +#ifndef UNITY_COUNTER_TYPE +#define UNITY_COUNTER_TYPE unsigned short +#endif + +//------------------------------------------------------- +// Internal Structs Needed +//------------------------------------------------------- + +typedef void (*UnityTestFunction)(void); + +#define UNITY_DISPLAY_RANGE_INT (0x10) +#define UNITY_DISPLAY_RANGE_UINT (0x20) +#define UNITY_DISPLAY_RANGE_HEX (0x40) +#define UNITY_DISPLAY_RANGE_AUTO (0x80) + +typedef enum +{ + UNITY_DISPLAY_STYLE_INT = 4 + UNITY_DISPLAY_RANGE_INT + UNITY_DISPLAY_RANGE_AUTO, + UNITY_DISPLAY_STYLE_INT8 = 1 + UNITY_DISPLAY_RANGE_INT, + UNITY_DISPLAY_STYLE_INT16 = 2 + UNITY_DISPLAY_RANGE_INT, + UNITY_DISPLAY_STYLE_INT32 = 4 + UNITY_DISPLAY_RANGE_INT, +#ifdef UNITY_SUPPORT_64 + UNITY_DISPLAY_STYLE_INT64 = 8 + UNITY_DISPLAY_RANGE_INT, +#endif + UNITY_DISPLAY_STYLE_UINT = 4 + UNITY_DISPLAY_RANGE_UINT + UNITY_DISPLAY_RANGE_AUTO, + UNITY_DISPLAY_STYLE_UINT8 = 1 + UNITY_DISPLAY_RANGE_UINT, + UNITY_DISPLAY_STYLE_UINT16 = 2 + UNITY_DISPLAY_RANGE_UINT, + UNITY_DISPLAY_STYLE_UINT32 = 4 + UNITY_DISPLAY_RANGE_UINT, +#ifdef UNITY_SUPPORT_64 + UNITY_DISPLAY_STYLE_UINT64 = 8 + UNITY_DISPLAY_RANGE_UINT, +#endif + UNITY_DISPLAY_STYLE_HEX8 = 1 + UNITY_DISPLAY_RANGE_HEX, + UNITY_DISPLAY_STYLE_HEX16 = 2 + UNITY_DISPLAY_RANGE_HEX, + UNITY_DISPLAY_STYLE_HEX32 = 4 + UNITY_DISPLAY_RANGE_HEX, +#ifdef UNITY_SUPPORT_64 + UNITY_DISPLAY_STYLE_HEX64 = 8 + UNITY_DISPLAY_RANGE_HEX, +#endif +} UNITY_DISPLAY_STYLE_T; + +struct _Unity +{ + const char* TestFile; + const char* CurrentTestName; + _UU32 CurrentTestLineNumber; + UNITY_COUNTER_TYPE NumberOfTests; + UNITY_COUNTER_TYPE TestFailures; + UNITY_COUNTER_TYPE TestIgnores; + UNITY_COUNTER_TYPE CurrentTestFailed; + UNITY_COUNTER_TYPE CurrentTestIgnored; + jmp_buf AbortFrame; +}; + +extern struct _Unity Unity; + +//------------------------------------------------------- +// Test Suite Management +//------------------------------------------------------- + +void UnityBegin(void); +int UnityEnd(void); +void UnityConcludeTest(void); +void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum); + +//------------------------------------------------------- +// Test Output +//------------------------------------------------------- + +void UnityPrint(const char* string); +void UnityPrintMask(const _U_UINT mask, const _U_UINT number); +void UnityPrintNumberByStyle(const _U_SINT number, const UNITY_DISPLAY_STYLE_T style); +void UnityPrintNumber(const _U_SINT number); +void UnityPrintNumberUnsigned(const _U_UINT number); +void UnityPrintNumberHex(const _U_UINT number, const char nibbles); + +#ifdef UNITY_FLOAT_VERBOSE +void UnityPrintFloat(const _UF number); +#endif + +//------------------------------------------------------- +// Test Assertion Fuctions +//------------------------------------------------------- +// Use the macros below this section instead of calling +// these directly. The macros have a consistent naming +// convention and will pull in file and line information +// for you. + +void UnityAssertEqualNumber(const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style); + +void UnityAssertEqualIntArray(const _U_SINT* expected, + const _U_SINT* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style); + +void UnityAssertBits(const _U_SINT mask, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualString(const char* expected, + const char* actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualStringArray( const char** expected, + const char** actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualMemory( const void* expected, + const void* actual, + const _UU32 length, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertNumbersWithin(const _U_SINT delta, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style); + +void UnityFail(const char* message, const UNITY_LINE_TYPE line); + +void UnityIgnore(const char* message, const UNITY_LINE_TYPE line); + +#ifndef UNITY_EXCLUDE_FLOAT +void UnityAssertFloatsWithin(const _UF delta, + const _UF expected, + const _UF actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualFloatArray(const _UF* expected, + const _UF* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber); +#endif + +//------------------------------------------------------- +// Basic Fail and Ignore +//------------------------------------------------------- + +#define UNITY_TEST_FAIL(line, message) UnityFail( (message), (UNITY_LINE_TYPE)line); +#define UNITY_TEST_IGNORE(line, message) UnityIgnore( (message), (UNITY_LINE_TYPE)line); + +//------------------------------------------------------- +// Test Asserts +//------------------------------------------------------- + +#define UNITY_TEST_ASSERT(condition, line, message) if (condition) {} else {UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, message);} +#define UNITY_TEST_ASSERT_NULL(pointer, line, message) UNITY_TEST_ASSERT(((pointer) == NULL), (UNITY_LINE_TYPE)line, message) +#define UNITY_TEST_ASSERT_NOT_NULL(pointer, line, message) UNITY_TEST_ASSERT(((pointer) != NULL), (UNITY_LINE_TYPE)line, message) + +#define UNITY_TEST_ASSERT_EQUAL_INT(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_UINT(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_HEX8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX8) +#define UNITY_TEST_ASSERT_EQUAL_HEX16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX16) +#define UNITY_TEST_ASSERT_EQUAL_HEX32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX32) +#define UNITY_TEST_ASSERT_BITS(mask, expected, actual, line, message) UnityAssertBits((_U_SINT)(mask), (_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line) + +#define UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX8) +#define UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX16) +#define UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX32) +#define UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64) + +#define UNITY_TEST_ASSERT_EQUAL_PTR(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(_UP)(expected), (_U_SINT)(_UP)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_POINTER) +#define UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, line, message) UnityAssertEqualString((const char*)(expected), (const char*)(actual), (message), (UNITY_LINE_TYPE)line) +#define UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, line, message) UnityAssertEqualMemory((void*)(expected), (void*)(actual), (_UU32)(len), 1, (message), (UNITY_LINE_TYPE)line) + +#define UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT8) +#define UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT16) +#define UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT32) +#define UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT8) +#define UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT16) +#define UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT32) +#define UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX8) +#define UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX16) +#define UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX32) +#define UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualStringArray((const char**)(expected), (const char**)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line) +#define UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, line, message) UnityAssertEqualMemory((void*)(expected), (void*)(actual), (_UU32)(len), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line) + +#ifdef UNITY_SUPPORT_64 +#define UNITY_TEST_ASSERT_EQUAL_INT64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT64) +#define UNITY_TEST_ASSERT_EQUAL_UINT64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT64) +#define UNITY_TEST_ASSERT_EQUAL_HEX64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64) +#define UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT64) +#define UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT64) +#define UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64) +#endif + +#ifdef UNITY_EXCLUDE_FLOAT +#define UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled") +#define UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled") +#define UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled") +#else +#define UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, line, message) UnityAssertFloatsWithin((_UF)(delta), (_UF)(expected), (_UF)(actual), (message), (UNITY_LINE_TYPE)line) +#define UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, line, message) UNITY_TEST_ASSERT_FLOAT_WITHIN((_UF)(expected) * (_UF)UNITY_FLOAT_PRECISION, (_UF)expected, (_UF)actual, (UNITY_LINE_TYPE)line, message) +#define UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualFloatArray((_UF*)(expected), (_UF*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line) +#endif + +#endif diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/targets/gcc.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/targets/gcc.yml new file mode 100644 index 0000000..0f18c6c --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/targets/gcc.yml @@ -0,0 +1,42 @@ +compiler: + path: gcc + source_path: 'src/' + unit_tests_path: &unit_tests_path 'test/' + build_path: &build_path 'build/' + options: + - '-c' + - '-Wall' + - '-Wno-address' + - '-std=c99' + - '-pedantic' + includes: + prefix: '-I' + items: + - 'src/' + - '../src/' + - *unit_tests_path + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - UNITY_SUPPORT_TEST_CASES + object_files: + prefix: '-o' + extension: '.o' + destination: *build_path +linker: + path: gcc + options: + - -lm + includes: + prefix: '-I' + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.exe' + destination: *build_path +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/targets/gcc_64.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/targets/gcc_64.yml new file mode 100644 index 0000000..97cb958 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/targets/gcc_64.yml @@ -0,0 +1,43 @@ +compiler: + path: gcc + source_path: 'src/' + unit_tests_path: &unit_tests_path 'test/' + build_path: &build_path 'build/' + options: + - '-c' + - '-Wall' + - '-Wno-address' + - '-std=c99' + - '-pedantic' + includes: + prefix: '-I' + items: + - 'src/' + - '../src/' + - *unit_tests_path + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - UNITY_SUPPORT_TEST_CASES + - 'UNITY_POINTER_WIDTH=64' + object_files: + prefix: '-o' + extension: '.o' + destination: *build_path +linker: + path: gcc + options: + - -lm + includes: + prefix: '-I' + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.exe' + destination: *build_path +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/targets/hitech_picc18.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/targets/hitech_picc18.yml new file mode 100644 index 0000000..210d944 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/targets/hitech_picc18.yml @@ -0,0 +1,101 @@ +# rumor has it that this yaml file works for the standard edition of the +# hitech PICC18 compiler, but not the pro version. +# +compiler: + path: cd build && picc18 + source_path: 'c:\Projects\NexGen\Prototypes\CMockTest\src\' + unit_tests_path: &unit_tests_path 'c:\Projects\NexGen\Prototypes\CMockTest\test\' + build_path: &build_path 'c:\Projects\NexGen\Prototypes\CMockTest\build\' + options: + - --chip=18F87J10 + - --ide=hitide + - --q #quiet please + - --asmlist + - --codeoffset=0 + - --emi=wordwrite # External memory interface protocol + - --warn=0 # allow all normal warning messages + - --errors=10 # Number of errors before aborting compile + - --char=unsigned + - -Bl # Large memory model + - -G # generate symbol file + - --cp=16 # 16-bit pointers + - --double=24 + - -N255 # 255-char symbol names + - --opt=none # Do not use any compiler optimziations + - -c # compile only + - -M + includes: + prefix: '-I' + items: + - 'c:/Projects/NexGen/Prototypes/CMockTest/src/' + - 'c:/Projects/NexGen/Prototypes/CMockTest/mocks/' + - 'c:/CMock/src/' + - 'c:/CMock/examples/src/' + - 'c:/CMock/vendor/unity/src/' + - 'c:/CMock/vendor/unity/examples/helper/' + - *unit_tests_path + defines: + prefix: '-D' + items: + - UNITY_INT_WIDTH=16 + - UNITY_POINTER_WIDTH=16 + - CMOCK_MEM_STATIC + - CMOCK_MEM_SIZE=3000 + - UNITY_SUPPORT_TEST_CASES + - _PICC18 + object_files: + # prefix: '-O' # Hi-Tech doesn't want a prefix. They key off of filename .extensions, instead + extension: '.obj' + destination: *build_path + +linker: + path: cd build && picc18 + options: + - --chip=18F87J10 + - --ide=hitide + - --cp=24 # 24-bit pointers. Is this needed for linker?? + - --double=24 # Is this needed for linker?? + - -Lw # Scan the pic87*w.lib in the lib/ of the compiler installation directory + - --summary=mem,file # info listing + - --summary=+psect + - --summary=+hex + - --output=+intel + - --output=+mcof + - --runtime=+init # Directs startup code to copy idata, ibigdata and ifardata psects from ROM to RAM. + - --runtime=+clear # Directs startup code to clear bss, bigbss, rbss and farbss psects + - --runtime=+clib # link in the c-runtime + - --runtime=+keep # Keep the generated startup src after its obj is linked + - -G # Generate src-level symbol file + - -MIWasTheLastToBuild.map + - --warn=0 # allow all normal warning messages + - -Bl # Large memory model (probably not needed for linking) + includes: + prefix: '-I' + object_files: + path: *build_path + extension: '.obj' + bin_files: + prefix: '-O' + extension: '.hex' + destination: *build_path + +simulator: + path: + pre_support: + - 'java -client -jar ' # note space + - ['C:\Program Files\HI-TECH Software\HI-TIDE\3.15\lib\', 'simpic18.jar'] + - 18F87J10 + post_support: + +:cmock: + :plugins: [] + :includes: + - Types.h + :suite_teardown: | + if (num_failures) + _FAILED_TEST(); + else + _PASSED_TESTS(); + return 0; + +colour: true \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_arm_v4.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_arm_v4.yml new file mode 100644 index 0000000..c2e7f18 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_arm_v4.yml @@ -0,0 +1,89 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 4.0 Kickstart\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\lib\dl4tptinl8n.h'] + - -z3 + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian little + - --cpu ARM7TDMI + - --stack_align 4 + - --interwork + - -e + - --silent + - --warnings_are_errors + - --fpu None + - --diag_suppress Pa050 + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'common\bin\xlink.exe'] + options: + - -rt + - [*tools_root, 'arm\lib\dl4tptinl8n.r79'] + - -D_L_EXTMEM_START=0 + - -D_L_EXTMEM_SIZE=0 + - -D_L_HEAP_SIZE=120 + - -D_L_STACK_SIZE=32 + - -e_small_write=_formatted_write + - -s + - __program_start + - -f + - [*tools_root, '\arm\config\lnkarm.xcl'] + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\config\'] + - [*tools_root, 'arm\lib\'] + object_files: + path: *build_path + extension: '.r79' + bin_files: + prefix: '-o' + extension: '.d79' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\ioat91sam7X256.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_arm_v5.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_arm_v5.yml new file mode 100644 index 0000000..0549d8e --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_arm_v5.yml @@ -0,0 +1,79 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian=little + - --cpu=ARM7TDMI + - --interwork + - --warnings_are_errors + - --fpu=None + - --diag_suppress=Pa050 + - --diag_suppress=Pe111 + - -e + - -On + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\debugger\atmel\ioat91sam7X256.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_arm_v5_3.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_arm_v5_3.yml new file mode 100644 index 0000000..0549d8e --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_arm_v5_3.yml @@ -0,0 +1,79 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian=little + - --cpu=ARM7TDMI + - --interwork + - --warnings_are_errors + - --fpu=None + - --diag_suppress=Pa050 + - --diag_suppress=Pe111 + - -e + - -On + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\debugger\atmel\ioat91sam7X256.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml new file mode 100644 index 0000000..eb0785c --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml @@ -0,0 +1,93 @@ +#Default tool path for IAR 5.4 on Windows XP 64bit +tools_root: &tools_root 'C:\Program Files (x86)\IAR Systems\Embedded Workbench 5.4 Kickstart\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --diag_suppress=Pa050 + #- --diag_suppress=Pe111 + - --debug + - --endian=little + - --cpu=Cortex-M3 + - --no_path_in_file_macros + - -e + - --fpu=None + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + #- --preinclude --preinclude C:\Vss\T2 Working\common\system.h + - --interwork + - --warnings_are_errors +# - Ohz + - -Oh +# - --no_cse +# - --no_unroll +# - --no_inline +# - --no_code_motion +# - --no_tbaa +# - --no_clustering +# - --no_scheduling + + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - ewarm + - PART_LM3S9B92 + - TARGET_IS_TEMPEST_RB1 + - USE_ROM_DRIVERS + - UART_BUFFERED + - UNITY_SUPPORT_64 + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic.icf'] +# - ['C:\Temp\lm3s9b92.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + #- --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim2.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - --endian=little + - --cpu=Cortex-M3 + - --fpu=None + - -p + - [*tools_root, 'arm\config\debugger\TexasInstruments\iolm3sxxxx.ddf'] + - --semihosting + - --device=LM3SxBxx + #- -d + #- sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_cortexm3_v5.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_cortexm3_v5.yml new file mode 100644 index 0000000..cf0d1d0 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_cortexm3_v5.yml @@ -0,0 +1,83 @@ +# unit testing under iar compiler / simulator for STM32 Cortex-M3 + +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.4\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian=little + - --cpu=Cortex-M3 + - --interwork + - --warnings_are_errors + - --fpu=None + - --diag_suppress=Pa050 + - --diag_suppress=Pe111 + - -e + - -On + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - 'IAR' + - 'UNITY_SUPPORT_64' + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic_cortex.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\debugger\ST\iostm32f107xx.ddf'] + - --cpu=Cortex-M3 + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_msp430.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_msp430.yml new file mode 100644 index 0000000..e022647 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_msp430.yml @@ -0,0 +1,94 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3 MSP430\' +core_root: &core_root [*tools_root, '430\'] +core_bin: &core_bin [*core_root, 'bin\'] +core_config: &core_config [*core_root, 'config\'] +core_lib: &core_lib [*core_root, 'lib\'] +core_inc: &core_inc [*core_root, 'inc\'] +core_config: &core_config [*core_root, 'config\'] + +compiler: + path: [*core_bin, 'icc430.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*core_lib, 'dlib\dl430fn.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --debug + - -e + - -Ol + - --multiplier=16 + - --double=32 + - --diag_suppress Pa050 + - --diag_suppress Pe111 + includes: + prefix: '-I' + items: + - *core_inc + - [*core_inc, 'dlib'] + - [*core_lib, 'dlib'] + - 'src\' + - '../src/' + - *unit_tests_path + - 'vendor\unity\src' + defines: + prefix: '-D' + items: + - '__MSP430F149__' + - 'INT_WIDTH=16' + - 'UNITY_EXCLUDE_FLOAT' + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r43' + destination: *build_path +linker: + path: [*core_bin, 'xlink.exe'] + options: + - -rt + - [*core_lib, 'dlib\dl430fn.r43'] + - -e_PrintfTiny=_Printf + - -e_ScanfSmall=_Scanf + - -s __program_start + - -D_STACK_SIZE=50 + - -D_DATA16_HEAP_SIZE=50 + - -D_DATA20_HEAP_SIZE=50 + - -f + - [*core_config, 'lnk430f5438.xcl'] + - -f + - [*core_config, 'multiplier.xcl'] + includes: + prefix: '-I' + items: + - *core_config + - *core_lib + - [*core_lib, 'dlib'] + object_files: + path: *build_path + extension: '.r79' + bin_files: + prefix: '-o' + extension: '.d79' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*core_bin, '430proc.dll'] + - [*core_bin, '430sim.dll'] + post_support: + - --plugin + - [*core_bin, '430bat.dll'] + - --backend -B + - --cpu MSP430F5438 + - -p + - [*core_config, 'MSP430F5438.ddf'] + - -d sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_sh2a_v6.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_sh2a_v6.yml new file mode 100644 index 0000000..ddc5603 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_sh2a_v6.yml @@ -0,0 +1,85 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 6.0\' +compiler: + path: [*tools_root, 'sh\bin\iccsh.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - -e + - --char_is_signed + - -Ol + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_scheduling + - --no_clustering + - --debug + - --dlib_config + - [*tools_root, 'sh\inc\DLib_Product.h'] + - --double=32 + - --code_model=huge + - --data_model=huge + - --core=sh2afpu + - --warnings_affect_exit_code + - --warnings_are_errors + - --mfc + - --use_unix_directory_separators + - --diag_suppress=Pe161 + includes: + prefix: '-I' + items: + - [*tools_root, 'sh\inc\'] + - [*tools_root, 'sh\inc\c'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.o' + destination: *build_path +linker: + path: [*tools_root, 'sh\bin\ilinksh.exe'] + options: + - --redirect __Printf=__PrintfSmall + - --redirect __Scanf=__ScanfSmall + - --config + - [*tools_root, 'sh\config\generic.icf'] + - --config_def _CSTACK_SIZE=0x800 + - --config_def _HEAP_SIZE=0x800 + - --config_def _INT_TABLE=0x10 + - --entry __iar_program_start + - --debug_lib + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'sh\bin\shproc.dll'] + - [*tools_root, 'sh\bin\shsim.dll'] + post_support: + - --plugin + - [*tools_root, 'sh\bin\shbat.dll'] + - --backend + - -B + - --core sh2afpu + - -p + - [*tools_root, 'sh\config\debugger\io7264.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_cmd.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_cmd.c new file mode 100644 index 0000000..42841d8 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_cmd.c @@ -0,0 +1,54 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include +#include "CException.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_def.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_def.c new file mode 100644 index 0000000..8280804 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_def.c @@ -0,0 +1,50 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_cmd.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_cmd.c new file mode 100644 index 0000000..e47b31c --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_cmd.c @@ -0,0 +1,76 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_def.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_def.c new file mode 100644 index 0000000..3ca9dba --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_def.c @@ -0,0 +1,72 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new1.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new1.c new file mode 100644 index 0000000..a7cbcd8 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new1.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + GlobalExpectCount = 0; + GlobalVerifyOrder = 0; + GlobalOrderError = NULL; + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new2.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new2.c new file mode 100644 index 0000000..2c76bf2 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new2.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_param.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_param.c new file mode 100644 index 0000000..23c04f4 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_param.c @@ -0,0 +1,73 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST_NO_ARGS +#define RUN_TEST(TestFunc, TestLineNum, ...) \ +{ \ + Unity.CurrentTestName = #TestFunc "(" #__VA_ARGS__ ")"; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(__VA_ARGS__); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21, RUN_TEST_NO_ARGS); + RUN_TEST(test_TheSecondThingToTest, 43, RUN_TEST_NO_ARGS); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run1.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run1.c new file mode 100644 index 0000000..a7cbcd8 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run1.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + GlobalExpectCount = 0; + GlobalVerifyOrder = 0; + GlobalOrderError = NULL; + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run2.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run2.c new file mode 100644 index 0000000..2c76bf2 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run2.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_yaml.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_yaml.c new file mode 100644 index 0000000..68b545a --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_yaml.c @@ -0,0 +1,86 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include "two.h" +#include "three.h" +#include +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_yaml_setup(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_new1.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_new1.c new file mode 100644 index 0000000..e5bcac2 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_new1.c @@ -0,0 +1,60 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_new2.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_new2.c new file mode 100644 index 0000000..b7c7e5b --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_new2.c @@ -0,0 +1,63 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_param.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_param.c new file mode 100644 index 0000000..4157007 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_param.c @@ -0,0 +1,51 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST_NO_ARGS +#define RUN_TEST(TestFunc, TestLineNum, ...) \ +{ \ + Unity.CurrentTestName = #TestFunc "(" #__VA_ARGS__ ")"; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(__VA_ARGS__); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21, RUN_TEST_NO_ARGS); + RUN_TEST(test_TheSecondThingToTest, 43, RUN_TEST_NO_ARGS); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_run1.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_run1.c new file mode 100644 index 0000000..e5bcac2 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_run1.c @@ -0,0 +1,60 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_run2.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_run2.c new file mode 100644 index 0000000..b7c7e5b --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_run2.c @@ -0,0 +1,63 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_yaml.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_yaml.c new file mode 100644 index 0000000..d109287 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_yaml.c @@ -0,0 +1,64 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "two.h" +#include "three.h" +#include +#include +#include +#include "CException.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_yaml_setup(); +} + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/test_generate_test_runner.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/test_generate_test_runner.rb new file mode 100644 index 0000000..61c8df9 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/test_generate_test_runner.rb @@ -0,0 +1,94 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +ruby_version = RUBY_VERSION.split('.') +if (ruby_version[1].to_i == 9) and (ruby_version[2].to_i > 1) + require 'rubygems' + gem 'test-unit' +end +require 'test/unit' +require './auto/generate_test_runner.rb' + +TEST_FILE = 'test/testdata/testsample.c' +TEST_MOCK = 'test/testdata/mocksample.c' +OUT_FILE = 'build/testsample_' +EXP_FILE = 'test/expectdata/testsample_' + +class TestGenerateTestRunner < Test::Unit::TestCase + def setup + end + + def teardown + end + + def verify_output_equal(subtest) + expected = File.read(EXP_FILE + subtest + '.c').gsub(/\r\n/,"\n") + actual = File.read(OUT_FILE + subtest + '.c').gsub(/\r\n/,"\n") + assert_equal(expected, actual, "Generated File Sub-Test '#{subtest}' Failed") + end + + def test_ShouldGenerateARunnerByCreatingRunnerWithOptions + sets = { 'def' => nil, + 'new1' => { :plugins => [:cexception], :includes => ['one.h', 'two.h'], :enforce_strict_ordering => true }, + 'new2' => { :plugins => [:ignore], :suite_setup => "a_custom_setup();", :suite_teardown => "a_custom_teardown();" } + } + + sets.each_pair do |subtest, options| + UnityTestRunnerGenerator.new(options).run(TEST_FILE, OUT_FILE + subtest + '.c') + verify_output_equal(subtest) + UnityTestRunnerGenerator.new(options).run(TEST_MOCK, OUT_FILE + 'mock_' + subtest + '.c') + verify_output_equal('mock_' + subtest) + end + end + + def test_ShouldGenerateARunnerByRunningRunnerWithOptions + sets = { 'run1' => { :plugins => [:cexception], :includes => ['one.h', 'two.h'], :enforce_strict_ordering => true }, + 'run2' => { :plugins => [:ignore], :suite_setup => "a_custom_setup();", :suite_teardown => "a_custom_teardown();" } + } + + sets.each_pair do |subtest, options| + UnityTestRunnerGenerator.new.run(TEST_FILE, OUT_FILE + subtest + '.c', options) + verify_output_equal(subtest) + UnityTestRunnerGenerator.new.run(TEST_MOCK, OUT_FILE + 'mock_' + subtest + '.c', options) + verify_output_equal('mock_' + subtest) + end + end + + def test_ShouldGenerateARunnerByPullingYamlOptions + subtest = 'yaml' + cmdstr = "ruby auto/generate_test_runner.rb test/testdata/sample.yml \"#{TEST_FILE}\" \"#{OUT_FILE + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal(subtest) + + cmdstr = "ruby auto/generate_test_runner.rb test/testdata/sample.yml \"#{TEST_MOCK}\" \"#{OUT_FILE + 'mock_' + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal('mock_' + subtest) + end + + def test_ShouldGenerateARunnerByPullingCommandlineOptions + subtest = 'cmd' + cmdstr = "ruby auto/generate_test_runner.rb -cexception \"#{TEST_FILE}\" \"#{OUT_FILE + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal(subtest) + + cmdstr = "ruby auto/generate_test_runner.rb -cexception \"#{TEST_MOCK}\" \"#{OUT_FILE + 'mock_' + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal('mock_' + subtest) + end + + def test_ShouldGenerateARunnerThatUsesParameterizedTests + sets = { 'param' => { :plugins => [:ignore], :use_param_tests => true } + } + + sets.each_pair do |subtest, options| + UnityTestRunnerGenerator.new(options).run(TEST_FILE, OUT_FILE + subtest + '.c') + verify_output_equal(subtest) + UnityTestRunnerGenerator.new(options).run(TEST_MOCK, OUT_FILE + 'mock_' + subtest + '.c') + verify_output_equal('mock_' + subtest) + end + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/testdata/mocksample.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/testdata/mocksample.c new file mode 100644 index 0000000..b709438 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/testdata/mocksample.c @@ -0,0 +1,51 @@ +// This is just a sample test file to be used to test the generator script +#ifndef TEST_SAMPLE_H +#define TEST_SAMPLE_H + +#include +#include "unity.h" +#include "funky.h" +#include "Mockstanky.h" + +void setUp(void) +{ + CustomSetupStuff(); +} + +void tearDown(void) +{ + CustomTeardownStuff +} + +//Yup, nice comment +void test_TheFirstThingToTest(void) +{ + TEST_ASSERT(1); + + TEST_ASSERT_TRUE(1); +} + +/* +void test_ShouldBeIgnored(void) +{ + DoesStuff(); +} +*/ + +//void test_ShouldAlsoNotBeTested(void) +//{ +// Call_An_Expect(); +// +// CallAFunction(); +// test_CallAFunctionThatLooksLikeATest(); +//} + +void test_TheSecondThingToTest(void) +{ + Call_An_Expect(); + + CallAFunction(); + test_CallAFunctionThatLooksLikeATest(); +} + +#endif //TEST_SAMPLE_H diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/testdata/sample.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/testdata/sample.yml new file mode 100644 index 0000000..9e5eece --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/testdata/sample.yml @@ -0,0 +1,9 @@ +:unity: + :includes: + - two.h + - three.h + - + :plugins: + - :cexception + :suite_setup: | + a_yaml_setup(); \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/testdata/testsample.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/testdata/testsample.c new file mode 100644 index 0000000..4f30ec7 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/testdata/testsample.c @@ -0,0 +1,51 @@ +// This is just a sample test file to be used to test the generator script +#ifndef TEST_SAMPLE_H +#define TEST_SAMPLE_H + +#include +#include "unity.h" +#include "funky.h" +#include "stanky.h" + +void setUp(void) +{ + CustomSetupStuff(); +} + +void tearDown(void) +{ + CustomTeardownStuff +} + +//Yup, nice comment +void test_TheFirstThingToTest(void) +{ + TEST_ASSERT(1); + + TEST_ASSERT_TRUE(1); +} + +/* +void test_ShouldBeIgnored(void) +{ + DoesStuff(); +} +*/ + +//void test_ShouldAlsoNotBeTested(void) +//{ +// Call_An_Expect(); +// +// CallAFunction(); +// test_CallAFunctionThatLooksLikeATest(); +//} + +void test_TheSecondThingToTest(void) +{ + Call_An_Expect(); + + CallAFunction(); + test_CallAFunctionThatLooksLikeATest(); +} + +#endif //TEST_SAMPLE_H diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/testparameterized.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/testparameterized.c new file mode 100644 index 0000000..037cd21 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/testparameterized.c @@ -0,0 +1,101 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include +#include "unity.h" + +#define TEST_CASE(...) + +#define EXPECT_ABORT_BEGIN \ + if (TEST_PROTECT()) \ + { + +#define VERIFY_FAILS_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestFailed == 1) ? 0 : 1; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Failed But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +#define VERIFY_IGNORES_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestIgnored == 1) ? 0 : 1; \ + Unity.CurrentTestIgnored = 0; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Ignored But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +int SetToOneToFailInTearDown; +int SetToOneMeanWeAlreadyCheckedThisGuy; + +void setUp(void) +{ + SetToOneToFailInTearDown = 0; + SetToOneMeanWeAlreadyCheckedThisGuy = 0; +} + +void tearDown(void) +{ + if (SetToOneToFailInTearDown == 1) + TEST_FAIL_MESSAGE("<= Failed in tearDown"); + if ((SetToOneMeanWeAlreadyCheckedThisGuy == 0) && (Unity.CurrentTestFailed > 0)) + { + UnityPrint("[[[[ Previous Test Should Have Passed But Did Not ]]]]"); + UNITY_OUTPUT_CHAR('\n'); + } +} + +TEST_CASE(0) +TEST_CASE(44) +TEST_CASE((90)+9) +void test_TheseShouldAllPass(int Num) +{ + TEST_ASSERT_TRUE(Num < 100); +} + +TEST_CASE(3) +TEST_CASE(77) +TEST_CASE( (99) + 1 - (1)) +void test_TheseShouldAllFail(int Num) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(Num > 100); + VERIFY_FAILS_END +} + +TEST_CASE(1) +TEST_CASE(44) +TEST_CASE(99) +TEST_CASE(98) +void test_TheseAreEveryOther(int Num) +{ + if (Num & 1) + { + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(Num > 100); + VERIFY_FAILS_END + } + else + { + TEST_ASSERT_TRUE(Num < 100); + } +} + +void test_NormalPassesStillWork(void) +{ + TEST_ASSERT_TRUE(1); +} + +void test_NormalFailsStillWork(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(0); + VERIFY_FAILS_END +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/testunity.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/testunity.c new file mode 100644 index 0000000..9f826dc --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/c_exception/vendor/unity/test/testunity.c @@ -0,0 +1,1510 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include +#include "unity.h" + +#define EXPECT_ABORT_BEGIN \ + if (TEST_PROTECT()) \ + { + +#define VERIFY_FAILS_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestFailed == 1) ? 0 : 1; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Failed But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +#define VERIFY_IGNORES_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestIgnored == 1) ? 0 : 1; \ + Unity.CurrentTestIgnored = 0; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Ignored But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +int SetToOneToFailInTearDown; +int SetToOneMeanWeAlreadyCheckedThisGuy; + +void setUp(void) +{ + SetToOneToFailInTearDown = 0; + SetToOneMeanWeAlreadyCheckedThisGuy = 0; +} + +void tearDown(void) +{ + if (SetToOneToFailInTearDown == 1) + TEST_FAIL_MESSAGE("<= Failed in tearDown"); + if ((SetToOneMeanWeAlreadyCheckedThisGuy == 0) && (Unity.CurrentTestFailed > 0)) + { + UnityPrint("[[[[ Previous Test Should Have Passed But Did Not ]]]]"); + UNITY_OUTPUT_CHAR('\n'); + } +} + +void testTrue(void) +{ + TEST_ASSERT(1); + + TEST_ASSERT_TRUE(1); +} + +void testFalse(void) +{ + TEST_ASSERT_FALSE(0); + + TEST_ASSERT_UNLESS(0); +} + +void testPreviousPass(void) +{ + TEST_ASSERT_EQUAL_INT(0U, Unity.TestFailures); +} + +void testNotVanilla(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT(0); + VERIFY_FAILS_END +} + +void testNotTrue(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(0); + VERIFY_FAILS_END +} + +void testNotFalse(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_FALSE(1); + VERIFY_FAILS_END +} + +void testNotUnless(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UNLESS(1); + VERIFY_FAILS_END +} + +void testNotNotEqual(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_NOT_EQUAL(10, 10); + VERIFY_FAILS_END +} + +void testFail(void) +{ + EXPECT_ABORT_BEGIN + TEST_FAIL_MESSAGE("Expected for testing"); + VERIFY_FAILS_END +} + +void testIsNull(void) +{ + char* ptr1 = NULL; + char* ptr2 = "hello"; + + TEST_ASSERT_NULL(ptr1); + TEST_ASSERT_NOT_NULL(ptr2); +} + +void testIsNullShouldFailIfNot(void) +{ + char* ptr1 = "hello"; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_NULL(ptr1); + VERIFY_FAILS_END +} + +void testNotNullShouldFailIfNULL(void) +{ + char* ptr1 = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_NOT_NULL(ptr1); + VERIFY_FAILS_END +} + +void testIgnore(void) +{ + EXPECT_ABORT_BEGIN + TEST_IGNORE(); + TEST_FAIL_MESSAGE("This should not be reached"); + VERIFY_IGNORES_END +} + +void testIgnoreMessage(void) +{ + EXPECT_ABORT_BEGIN + TEST_IGNORE_MESSAGE("This is an expected TEST_IGNORE_MESSAGE string!"); + TEST_FAIL_MESSAGE("This should not be reached"); + VERIFY_IGNORES_END +} + +void testNotEqualInts(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT(3982, 3983); + VERIFY_FAILS_END +} + +void testNotEqualInt8s(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT8(-127, -126); + VERIFY_FAILS_END +} + +void testNotEqualInt16s(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT16(-16383, -16382); + VERIFY_FAILS_END +} + +void testNotEqualInt32s(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT32(-2147483647, -2147483646); + VERIFY_FAILS_END +} + +void testNotEqualBits(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_BITS(0xFF00, 0x5555, 0x5A55); + VERIFY_FAILS_END +} + +void testNotEqualUInts(void) +{ + _UU16 v0, v1; + + v0 = 9000; + v1 = 9001; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualUInt8s(void) +{ + _UU8 v0, v1; + + v0 = 254; + v1 = 255; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT8(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualUInt16s(void) +{ + _UU16 v0, v1; + + v0 = 65535; + v1 = 65534; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualUInt32s(void) +{ + _UU32 v0, v1; + + v0 = 4294967295; + v1 = 4294967294; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT32(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex8s(void) +{ + _UU8 v0, v1; + + v0 = 0x23; + v1 = 0x22; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex8sIfSigned(void) +{ + _US8 v0, v1; + + v0 = -2; + v1 = 2; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex16s(void) +{ + _UU16 v0, v1; + + v0 = 0x1234; + v1 = 0x1235; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex16sIfSigned(void) +{ + _US16 v0, v1; + + v0 = -1024; + v1 = -1028; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex32s(void) +{ + _UU32 v0, v1; + + v0 = 900000; + v1 = 900001; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex32sIfSigned(void) +{ + _US32 v0, v1; + + v0 = -900000; + v1 = 900001; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32(v0, v1); + VERIFY_FAILS_END +} + +void testEqualInts(void) +{ + int v0, v1; + int *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(1837, 1837); + TEST_ASSERT_EQUAL_INT(-27365, -27365); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(19467, v1); + TEST_ASSERT_EQUAL_INT(v0, 19467); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 19467); +} + +void testEqualUints(void) +{ + unsigned int v0, v1; + unsigned int *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_UINT(1837, 1837); + TEST_ASSERT_EQUAL_UINT(v0, v1); + TEST_ASSERT_EQUAL_UINT(19467, v1); + TEST_ASSERT_EQUAL_UINT(v0, 19467); + TEST_ASSERT_EQUAL_UINT(*p0, v1); + TEST_ASSERT_EQUAL_UINT(*p0, *p1); + TEST_ASSERT_EQUAL_UINT(*p0, 19467); + TEST_ASSERT_EQUAL_UINT(60872u, 60872u); +} + +void testNotEqual(void) +{ + TEST_ASSERT_NOT_EQUAL(0, 1); + TEST_ASSERT_NOT_EQUAL(1, 0); + TEST_ASSERT_NOT_EQUAL(100, 101); + TEST_ASSERT_NOT_EQUAL(0, -1); + TEST_ASSERT_NOT_EQUAL(65535, -65535); + TEST_ASSERT_NOT_EQUAL(75, 900); + TEST_ASSERT_NOT_EQUAL(-100, -101); +} + +void testEqualHex8s(void) +{ + _UU8 v0, v1; + _UU8 *p0, *p1; + + v0 = 0x22; + v1 = 0x22; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX8(0x22, 0x22); + TEST_ASSERT_EQUAL_HEX8(v0, v1); + TEST_ASSERT_EQUAL_HEX8(0x22, v1); + TEST_ASSERT_EQUAL_HEX8(v0, 0x22); + TEST_ASSERT_EQUAL_HEX8(*p0, v1); + TEST_ASSERT_EQUAL_HEX8(*p0, *p1); + TEST_ASSERT_EQUAL_HEX8(*p0, 0x22); +} + +void testEqualHex8sNegatives(void) +{ + _UU8 v0, v1; + _UU8 *p0, *p1; + + v0 = 0xDD; + v1 = 0xDD; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX8(0xDD, 0xDD); + TEST_ASSERT_EQUAL_HEX8(v0, v1); + TEST_ASSERT_EQUAL_HEX8(0xDD, v1); + TEST_ASSERT_EQUAL_HEX8(v0, 0xDD); + TEST_ASSERT_EQUAL_HEX8(*p0, v1); + TEST_ASSERT_EQUAL_HEX8(*p0, *p1); + TEST_ASSERT_EQUAL_HEX8(*p0, 0xDD); +} + +void testEqualHex16s(void) +{ + _UU16 v0, v1; + _UU16 *p0, *p1; + + v0 = 0x9876; + v1 = 0x9876; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX16(0x9876, 0x9876); + TEST_ASSERT_EQUAL_HEX16(v0, v1); + TEST_ASSERT_EQUAL_HEX16(0x9876, v1); + TEST_ASSERT_EQUAL_HEX16(v0, 0x9876); + TEST_ASSERT_EQUAL_HEX16(*p0, v1); + TEST_ASSERT_EQUAL_HEX16(*p0, *p1); + TEST_ASSERT_EQUAL_HEX16(*p0, 0x9876); +} + +void testEqualHex32s(void) +{ + _UU32 v0, v1; + _UU32 *p0, *p1; + + v0 = 0x98765432ul; + v1 = 0x98765432ul; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX32(0x98765432ul, 0x98765432ul); + TEST_ASSERT_EQUAL_HEX32(v0, v1); + TEST_ASSERT_EQUAL_HEX32(0x98765432ul, v1); + TEST_ASSERT_EQUAL_HEX32(v0, 0x98765432ul); + TEST_ASSERT_EQUAL_HEX32(*p0, v1); + TEST_ASSERT_EQUAL_HEX32(*p0, *p1); + TEST_ASSERT_EQUAL_HEX32(*p0, 0x98765432ul); +} + +void testEqualBits(void) +{ + _UU32 v0 = 0xFF55AA00; + _UU32 v1 = 0x55550000; + + TEST_ASSERT_BITS(v1, v0, 0x55550000); + TEST_ASSERT_BITS(v1, v0, 0xFF55CC00); + TEST_ASSERT_BITS(0xFFFFFFFF, v0, 0xFF55AA00); + TEST_ASSERT_BITS(0xFFFFFFFF, v0, v0); + TEST_ASSERT_BITS(0xF0F0F0F0, v0, 0xFC5DAE0F); + TEST_ASSERT_BITS_HIGH(v1, v0); + TEST_ASSERT_BITS_LOW(0x000055FF, v0); + TEST_ASSERT_BIT_HIGH(30, v0); + TEST_ASSERT_BIT_LOW(5, v0); +} + +void testEqualShorts(void) +{ + short v0, v1; + short *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(1837, 1837); + TEST_ASSERT_EQUAL_INT(-2987, -2987); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(19467, v1); + TEST_ASSERT_EQUAL_INT(v0, 19467); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 19467); +} + +void testEqualUShorts(void) +{ + unsigned short v0, v1; + unsigned short *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_UINT(1837, 1837); + TEST_ASSERT_EQUAL_UINT(2987, 2987); + TEST_ASSERT_EQUAL_UINT(v0, v1); + TEST_ASSERT_EQUAL_UINT(19467, v1); + TEST_ASSERT_EQUAL_UINT(v0, 19467); + TEST_ASSERT_EQUAL_UINT(*p0, v1); + TEST_ASSERT_EQUAL_UINT(*p0, *p1); + TEST_ASSERT_EQUAL_UINT(*p0, 19467); +} + +void testEqualChars(void) +{ + signed char v0, v1; + signed char *p0, *p1; + + v0 = 109; + v1 = 109; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(42, 42); + TEST_ASSERT_EQUAL_INT(-116, -116); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(109, v1); + TEST_ASSERT_EQUAL_INT(v0, 109); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 109); +} + +void testEqualUChars(void) +{ + unsigned char v0, v1; + unsigned char *p0, *p1; + + v0 = 251; + v1 = 251; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(42, 42); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(251, v1); + TEST_ASSERT_EQUAL_INT(v0, 251); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 251); +} + +void testEqualPointers(void) +{ + int v0, v1; + int *p0, *p1, *p2; + + v0 = 19467; + v1 = 18271; + p0 = &v0; + p1 = &v1; + p2 = &v1; + + TEST_ASSERT_EQUAL_PTR(p0, &v0); + TEST_ASSERT_EQUAL_PTR(&v1, p1); + TEST_ASSERT_EQUAL_PTR(p2, p1); + TEST_ASSERT_EQUAL_PTR(&v0, &v0); +} + +void testNotEqualPointers(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_PTR(0x12345678, 0x12345677); + VERIFY_FAILS_END +} + +void testIntsWithinDelta(void) +{ + TEST_ASSERT_INT_WITHIN(1, 5000, 5001); + TEST_ASSERT_INT_WITHIN(5, 5000, 4996); + TEST_ASSERT_INT_WITHIN(5, 5000, 5005); + TEST_ASSERT_INT_WITHIN(500, 50, -440); + + TEST_ASSERT_INT_WITHIN(2, -1, -1); + TEST_ASSERT_INT_WITHIN(5, 1, -1); + TEST_ASSERT_INT_WITHIN(5, -1, 1); +} + +void testIntsNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_INT_WITHIN(5, 5000, 5006); + VERIFY_FAILS_END +} + +void testUIntsWithinDelta(void) +{ + TEST_ASSERT_UINT_WITHIN(1, 5000, 5001); + TEST_ASSERT_UINT_WITHIN(5, 5000, 4996); + TEST_ASSERT_UINT_WITHIN(5, 5000, 5005); +} + +void testUIntsNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UINT_WITHIN(1, 2147483647u, 2147483649u); + VERIFY_FAILS_END +} + +void testUIntsNotWithinDeltaEvenThoughASignedIntWouldPassSmallFirst(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UINT_WITHIN(5, 1, -1); + VERIFY_FAILS_END +} + +void testUIntsNotWithinDeltaEvenThoughASignedIntWouldPassBigFirst(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UINT_WITHIN(5, -1, 1); + VERIFY_FAILS_END +} + +void testHEX32sWithinDelta(void) +{ + TEST_ASSERT_HEX32_WITHIN(1, 5000, 5001); + TEST_ASSERT_HEX32_WITHIN(5, 5000, 4996); + TEST_ASSERT_HEX32_WITHIN(5, 5000, 5005); +} + +void testHEX32sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX32_WITHIN(1, 2147483647u, 2147483649u); + VERIFY_FAILS_END +} + +void testHEX32sNotWithinDeltaEvenThoughASignedIntWouldPass(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX32_WITHIN(5, 1, -1); + VERIFY_FAILS_END +} + +void testHEX16sWithinDelta(void) +{ + TEST_ASSERT_HEX16_WITHIN(1, 5000, 5001); + TEST_ASSERT_HEX16_WITHIN(5, 5000, 4996); + TEST_ASSERT_HEX16_WITHIN(5, 5000, 5005); +} + +void testHEX16sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX16_WITHIN(2, 65535, 0); + VERIFY_FAILS_END +} + +void testHEX8sWithinDelta(void) +{ + TEST_ASSERT_HEX8_WITHIN(1, 254, 255); + TEST_ASSERT_HEX8_WITHIN(5, 251, 255); + TEST_ASSERT_HEX8_WITHIN(5, 1, 4); +} + +void testHEX8sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX8_WITHIN(2, 255, 0); + VERIFY_FAILS_END +} + +void testEqualStrings(void) +{ + const char *testString = "foo"; + + TEST_ASSERT_EQUAL_STRING(testString, testString); + TEST_ASSERT_EQUAL_STRING("foo", "foo"); + TEST_ASSERT_EQUAL_STRING("foo", testString); + TEST_ASSERT_EQUAL_STRING(testString, "foo"); + TEST_ASSERT_EQUAL_STRING("", ""); +} + +void testEqualStringsWithCarriageReturnsAndLineFeeds(void) +{ + const char *testString = "foo\r\nbar"; + + TEST_ASSERT_EQUAL_STRING(testString, testString); + TEST_ASSERT_EQUAL_STRING("foo\r\nbar", "foo\r\nbar"); + TEST_ASSERT_EQUAL_STRING("foo\r\nbar", testString); + TEST_ASSERT_EQUAL_STRING(testString, "foo\r\nbar"); + TEST_ASSERT_EQUAL_STRING("", ""); +} + +void testNotEqualString1(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("foo", "bar"); + VERIFY_FAILS_END +} + +void testNotEqualString2(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("foo", ""); + VERIFY_FAILS_END +} + +void testNotEqualString3(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("", "bar"); + VERIFY_FAILS_END +} + +void testNotEqualString4(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("bar\r", "bar\n"); + VERIFY_FAILS_END +} + +void testNotEqualString5(void) +{ + const char str1[] = { 0x41, 0x42, 0x03, 0x00 }; + const char str2[] = { 0x41, 0x42, 0x04, 0x00 }; + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING(str1, str2); + VERIFY_FAILS_END +} + +void testNotEqualString_ExpectedStringIsNull(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING(NULL, "bar"); + VERIFY_FAILS_END +} + +void testNotEqualString_ActualStringIsNull(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("foo", NULL); + VERIFY_FAILS_END +} + +void testEqualStringArrays(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, expStrings, 3); + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 3); + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 2); + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 1); +} + +void testNotEqualStringArray1(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray2(void) +{ + const char *testStrings[] = { "zoo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", "boo", "woo", "moo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray3(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", NULL }; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray4(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", NULL, "woo", "moo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray5(void) +{ + const char **testStrings = NULL; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray6(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "zoo" }; + const char **expStrings = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testEqualStringArrayIfBothNulls(void) +{ + const char **testStrings = NULL; + const char **expStrings = NULL; + + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); +} + +void testEqualMemory(void) +{ + const char *testString = "whatever"; + + TEST_ASSERT_EQUAL_MEMORY(testString, testString, 8); + TEST_ASSERT_EQUAL_MEMORY("whatever", "whatever", 8); + TEST_ASSERT_EQUAL_MEMORY("whatever", testString, 8); + TEST_ASSERT_EQUAL_MEMORY(testString, "whatever", 8); + TEST_ASSERT_EQUAL_MEMORY(testString, "whatever", 2); + TEST_ASSERT_EQUAL_MEMORY(NULL, NULL, 1); +} + +void testNotEqualMemory1(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY("foo", "bar", 3); + VERIFY_FAILS_END +} + +void testNotEqualMemory2(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY("fool", "food", 4); + VERIFY_FAILS_END +} + +void testNotEqualMemory3(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY(NULL, "food", 4); + VERIFY_FAILS_END +} + +void testNotEqualMemory4(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY("fool", NULL, 4); + VERIFY_FAILS_END +} + +void testEqualIntArrays(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, -2}; + int p2[] = {1, 8, 987, 2}; + int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p3, 1); +} + +void testNotEqualIntArraysNullExpected(void) +{ + int* p0 = NULL; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArraysNullActual(void) +{ + int* p1 = NULL; + int p0[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArrays1(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArrays2(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {2, 8, 987, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArrays3(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 986, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualInt8Arrays(void) +{ + _US8 p0[] = {1, 8, 117, -2}; + _US8 p1[] = {1, 8, 117, -2}; + _US8 p2[] = {1, 8, 117, 2}; + _US8 p3[] = {1, 50, 60, 70}; + + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p3, 1); +} + +void testNotEqualInt8Arrays(void) +{ + _US8 p0[] = {1, 8, 127, -2}; + _US8 p1[] = {1, 8, 127, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualUIntArrays(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65132u}; + unsigned int p2[] = {1, 8, 987, 2}; + unsigned int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p3, 1); +} + +void testNotEqualUIntArrays1(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUIntArrays2(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUIntArrays3(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualInt16Arrays(void) +{ + _UU16 p0[] = {1, 8, 117, 3}; + _UU16 p1[] = {1, 8, 117, 3}; + _UU16 p2[] = {1, 8, 117, 2}; + _UU16 p3[] = {1, 50, 60, 70}; + + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p3, 1); +} + +void testNotEqualInt16Arrays(void) +{ + _UU16 p0[] = {1, 8, 127, 3}; + _UU16 p1[] = {1, 8, 127, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualUINT16Arrays(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65132u}; + unsigned short p2[] = {1, 8, 987, 2}; + unsigned short p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p3, 1); +} + +void testNotEqualUINT16Arrays1(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUINT16Arrays2(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUINT16Arrays3(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualHEXArrays(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65132u}; + unsigned int p2[] = {1, 8, 987, 2}; + unsigned int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p3, 1); +} + +void testNotEqualHEXArrays1(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEXArrays2(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEXArrays3(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualHEX16Arrays(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65132u}; + unsigned short p2[] = {1, 8, 987, 2}; + unsigned short p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p3, 1); +} + +void testNotEqualHEX16Arrays1(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX16Arrays2(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX16Arrays3(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualHEX8Arrays(void) +{ + unsigned short p0[] = {1, 8, 254u, 123}; + unsigned short p1[] = {1, 8, 254u, 123}; + unsigned short p2[] = {1, 8, 254u, 2}; + unsigned short p3[] = {1, 23, 25, 26}; + + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p3, 1); +} + +void testNotEqualHEX8Arrays1(void) +{ + unsigned char p0[] = {1, 8, 254u, 253u}; + unsigned char p1[] = {1, 8, 254u, 252u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX8Arrays2(void) +{ + unsigned char p0[] = {1, 8, 254u, 253u}; + unsigned char p1[] = {2, 8, 254u, 253u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX8Arrays3(void) +{ + unsigned char p0[] = {1, 8, 254u, 253u}; + unsigned char p1[] = {1, 8, 255u, 253u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualMemoryArrays(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, -2}; + int p2[] = {1, 8, 987, 2}; + int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p0, 4, 1); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p0, 4, 4); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p2, 4, 3); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p3, 4, 1); +} + +void testNotEqualMemoryArraysExpectedNull(void) +{ + int* p0 = NULL; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArraysActualNull(void) +{ + int p0[] = {1, 8, 987, -2}; + int* p1 = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArrays1(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArrays2(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {2, 8, 987, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArrays3(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 986, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testProtection(void) +{ + volatile int mask = 0; + + if (TEST_PROTECT()) + { + mask |= 1; + TEST_ABORT(); + } + else + { + Unity.CurrentTestFailed = 0; + mask |= 2; + } + + TEST_ASSERT_EQUAL(3, mask); +} + +void testIgnoredAndThenFailInTearDown(void) +{ + SetToOneToFailInTearDown = 1; + TEST_IGNORE(); +} + +// ===================== THESE TEST WILL RUN IF YOUR CONFIG INCLUDES 64 BIT SUPPORT ================== +#ifdef UNITY_SUPPORT_64 + +void testEqualHex64s(void) +{ + _UU64 v0, v1; + _UU64 *p0, *p1; + + v0 = 0x9876543201234567; + v1 = 0x9876543201234567; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX64(0x9876543201234567, 0x9876543201234567); + TEST_ASSERT_EQUAL_HEX64(v0, v1); + TEST_ASSERT_EQUAL_HEX64(0x9876543201234567, v1); + TEST_ASSERT_EQUAL_HEX64(v0, 0x9876543201234567); + TEST_ASSERT_EQUAL_HEX64(*p0, v1); + TEST_ASSERT_EQUAL_HEX64(*p0, *p1); + TEST_ASSERT_EQUAL_HEX64(*p0, 0x9876543201234567); +} + +void testNotEqualHex64s(void) +{ + _UU64 v0, v1; + + v0 = 9000000000; + v1 = 9100000000; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex64sIfSigned(void) +{ + _US64 v0, v1; + + v0 = -9000000000; + v1 = 9000000000; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64(v0, v1); + VERIFY_FAILS_END +} + +void testHEX64sWithinDelta(void) +{ + TEST_ASSERT_HEX64_WITHIN(1, 0x7FFFFFFFFFFFFFFF,0x7FFFFFFFFFFFFFFE); + TEST_ASSERT_HEX64_WITHIN(5, 5000, 4996); + TEST_ASSERT_HEX64_WITHIN(5, 5000, 5005); +} + +void testHEX64sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX64_WITHIN(1, 0x7FFFFFFFFFFFFFFF, 0x7FFFFFFFFFFFFFFC); + VERIFY_FAILS_END +} + +void testHEX64sNotWithinDeltaEvenThoughASignedIntWouldPass(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX64_WITHIN(5, 1, -1); + VERIFY_FAILS_END +} + +void testEqualHEX64Arrays(void) +{ + _UU64 p0[] = {1, 8, 987, 65132u}; + _UU64 p1[] = {1, 8, 987, 65132u}; + _UU64 p2[] = {1, 8, 987, 2}; + _UU64 p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p3, 1); +} + +void testNotEqualHEX64Arrays1(void) +{ + _UU64 p0[] = {1, 8, 987, 65132u}; + _UU64 p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX64Arrays2(void) +{ + _UU64 p0[] = {1, 8, 987, 65132u}; + _UU64 p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +#endif //64-bit SUPPORT + +// ===================== THESE TEST WILL RUN IF YOUR CONFIG INCLUDES FLOAT SUPPORT ================== +#ifndef UNITY_EXCLUDE_FLOAT + +void testFloatsWithinDelta(void) +{ + TEST_ASSERT_FLOAT_WITHIN(0.00003f, 187245.03485f, 187245.03488f); + TEST_ASSERT_FLOAT_WITHIN(1.0f, 187245.0f, 187246.0f); + TEST_ASSERT_FLOAT_WITHIN(0.05f, 9273.2549f, 9273.2049f); + TEST_ASSERT_FLOAT_WITHIN(0.007f, -726.93724f, -726.94424f); +} + +void testFloatsNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_FLOAT_WITHIN(0.05f, 9273.2649f, 9273.2049f); + VERIFY_FAILS_END +} + +void testFloatsEqual(void) +{ + TEST_ASSERT_EQUAL_FLOAT(187245.0f, 187246.0f); + TEST_ASSERT_EQUAL_FLOAT(18724.5f, 18724.6f); + TEST_ASSERT_EQUAL_FLOAT(9273.2549f, 9273.2599f); + TEST_ASSERT_EQUAL_FLOAT(-726.93724f, -726.9374f); +} + +void testFloatsNotEqual(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT(9273.9649f, 9273.0049f); + VERIFY_FAILS_END +} + +void testFloatsNotEqualNegative1(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT(-9273.9649f, -9273.0049f); + VERIFY_FAILS_END +} + +void testFloatsNotEqualNegative2(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT(-9273.0049f, -9273.9649f); + VERIFY_FAILS_END +} + +void testEqualFloatArrays(void) +{ + float p0[] = {1.0, -8.0, 25.4, -0.123}; + float p1[] = {1.0, -8.0, 25.4, -0.123}; + float p2[] = {1.0, -8.0, 25.4, -0.2}; + float p3[] = {1.0, -23.0, 25.0, -0.26}; + + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p3, 1); +} + +void testNotEqualFloatArraysExpectedNull(void) +{ + float* p0 = NULL; + float p1[] = {1.0, 8.0, 25.4, 0.252}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysActualNull(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float* p1 = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArrays1(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float p1[] = {1.0, 8.0, 25.4, 0.252}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArrays2(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float p1[] = {2.0, 8.0, 25.4, 0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArrays3(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float p1[] = {1.0, 8.0, 25.5, 0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysNegative1(void) +{ + float p0[] = {-1.0, -8.0, -25.4, -0.253}; + float p1[] = {-1.0, -8.0, -25.4, -0.252}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysNegative2(void) +{ + float p0[] = {-1.0, -8.0, -25.4, -0.253}; + float p1[] = {-2.0, -8.0, -25.4, -0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysNegative3(void) +{ + float p0[] = {-1.0, -8.0, -25.4, -0.253}; + float p1[] = {-1.0, -8.0, -25.5, -0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +#endif //FLOAT SUPPORT diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/config/production_environment.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/config/production_environment.rb new file mode 100644 index 0000000..915582b --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/config/production_environment.rb @@ -0,0 +1,14 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +# Setup our load path: +[ + 'lib', +].each do |dir| + $LOAD_PATH.unshift( File.join( File.expand_path(File.dirname(__FILE__)) + '/../', dir) ) +end + + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/config/test_environment.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/config/test_environment.rb new file mode 100644 index 0000000..442e110 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/config/test_environment.rb @@ -0,0 +1,16 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +# Setup our load path: +[ + 'lib', + 'vendor/behaviors/lib', + 'vendor/hardmock/lib', + 'vendor/unity/auto/', + 'test/system/' +].each do |dir| + $LOAD_PATH.unshift( File.join( File.expand_path(File.dirname(__FILE__) + "/../"), dir) ) +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/docs/CMock Summary.odt b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/docs/CMock Summary.odt new file mode 100644 index 0000000..6126075 Binary files /dev/null and b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/docs/CMock Summary.odt differ diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/docs/CMock Summary.pdf b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/docs/CMock Summary.pdf new file mode 100644 index 0000000..98f8ea1 Binary files /dev/null and b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/docs/CMock Summary.pdf differ diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/docs/license.txt b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/docs/license.txt new file mode 100644 index 0000000..8eb75ad --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/docs/license.txt @@ -0,0 +1,31 @@ + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + The end-user documentation included with the redistribution, if + any, must include the following acknowledgment: "This product + includes software developed for the CMock Project, by Mike Karlesky, + Mark VanderVoord, and Greg Williams and other contributors", in + the same place and form as other third-party acknowledgments. + Alternately, this acknowledgment may appear in the software + itself, in the same form and location as other such third-party + acknowledgments. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/SAM7_FLASH.mac b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/SAM7_FLASH.mac new file mode 100644 index 0000000..407acb2 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/SAM7_FLASH.mac @@ -0,0 +1,71 @@ +// ---------------------------------------------------------------------------- +// ATMEL Microcontroller Software Support - ROUSSET - +// ---------------------------------------------------------------------------- +// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// ---------------------------------------------------------------------------- +// File Name : SAM7_FLASH.mac +// Object : Generic Macro File for IAR +// 1.0 17/Aug/05 FBr : Creation +// ---------------------------------------------------------------------------- + +/********************************************************************* +* +* _InitRSTC() +* +* Function description +* Initializes the RSTC (Reset controller). +* This makes sense since the default is to not allow user resets, which makes it impossible to +* apply a second RESET via J-Link +*/ +_InitRSTC() { + __writeMemory32(0xA5000001, 0xFFFFFD08,"Memory"); // Allow user reset +} + +/********************************************************************* +* +* _InitPLL() +* Function description +* Initializes the PMC. +* 1. Enable the Main Oscillator +* 2. Configure PLL to 96MHz +* 3. Switch Master Clock (MCK) on PLL/2 = 48MHz +*/ + _InitPLL() { + + __message "Enable Main Oscillator"; + __writeMemory32(0x00000601,0xFFFFFc20,"Memory"); // MOSC + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x1) ); + + __message "Set PLL to 96MHz"; + __writeMemory32(0x10191c05,0xFFFFFc2c,"Memory"); // LOCK + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x4) ); + + __message "Set Master Clock to 48MHz"; + __writeMemory32(0x00000004,0xFFFFFc30,"Memory"); // MCKRDY + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x8) ); + __writeMemory32(0x00000007,0xFFFFFc30,"Memory"); // MCKRDY + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x8) ); +} + +/********************************************************************* +* +* execUserReset() : JTAG set initially to Full Speed +*/ +execUserReset() { + __message "execUserReset()"; + __emulatorSpeed(30000); // Set JTAG speed to 30kHz to make a hardware reset + __hwReset(0); // Hardware Reset: CPU is automatically halted after the reset (JTAG is already configured to 32kHz) + _InitPLL(); // Allow to debug at JTAG Full Speed + _InitRSTC(); // Enable User Reset to allow execUserReset() execution + __emulatorSpeed(0); // Set JTAG speed to full speed +} + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/SAM7_RAM.mac b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/SAM7_RAM.mac new file mode 100644 index 0000000..a2b8a01 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/SAM7_RAM.mac @@ -0,0 +1,94 @@ +// ---------------------------------------------------------------------------- +// ATMEL Microcontroller Software Support - ROUSSET - +// ---------------------------------------------------------------------------- +// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// ---------------------------------------------------------------------------- +// File Name : SAM7_RAM.mac +// Object : Generic Macro File for IAR +// 1.0 17/Aug/05 FBr : Creation +// ---------------------------------------------------------------------------- + +/********************************************************************* +* +* _MapRAMAt0() +* +* Function description +* Maps RAM at 0. +*/ +_MapRAMAt0(){ + __message "Changing mapping: RAM mapped to 0"; + __writeMemory32(0x00000001,0xFFFFFF00,"Memory"); +} + +/********************************************************************* +* +* _InitRSTC() +* +* Function description +* Initializes the RSTC (Reset controller). +* This makes sense since the default is to not allow user resets, which makes it impossible to +* apply a second RESET via J-Link +*/ +_InitRSTC() { + __writeMemory32(0xA5000001, 0xFFFFFD08,"Memory"); // Allow user reset +} + +/********************************************************************* +* +* _InitPLL() +* Function description +* Initializes the PMC. +* 1. Enable the Main Oscillator +* 2. Configure PLL to 96MHz +* 3. Switch Master Clock (MCK) on PLL/2 = 48MHz +*/ + _InitPLL() { + + __message "Set Main Oscillator"; + __writeMemory32(0x00004001,0xFFFFFc20,"Memory"); // MOSC + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x1) ); + + __message "Set PLL to 96MHz"; + __writeMemory32(0x10483f0e,0xFFFFFc2c,"Memory"); // LOCK + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x4) ); + + __message "Set Master Clock to 48MHz"; + __writeMemory32(0x00000004,0xFFFFFc30,"Memory"); // MCKRDY + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x8) ); + __writeMemory32(0x00000007,0xFFFFFc30,"Memory"); // MCKRDY + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x8) ); +} + +/********************************************************************* +* +* execUserReset() : JTAG set initially to Full Speed +*/ +execUserReset() { + __message "execUserReset()"; + __emulatorSpeed(30000); // Set JTAG speed to 30kHz to make a hardware reset + __hwReset(0); // Hardware Reset: CPU is automatically halted after the reset + _InitPLL(); // Allow to debug at JTAG Full Speed + _MapRAMAt0(); // Remap RAM to address 0 + __emulatorSpeed(0); // Set JTAG speed to full speed +} + +/********************************************************************* +* +* execUserPreload() : JTAG set initially to 32kHz +*/ +execUserPreload() { + __message "execUserPreload()"; + __hwReset(0); // Hardware Reset: CPU is automatically halted after the reset (JTAG is already configured to 32kHz) + _InitPLL(); // Allow to load Code at JTAG Full Speed + _MapRAMAt0(); // Remap RAM to address 0 + _InitRSTC(); // Enable User Reset to allow execUserReset() execution +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/SAM7_SIM.mac b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/SAM7_SIM.mac new file mode 100644 index 0000000..418a2c3 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/SAM7_SIM.mac @@ -0,0 +1,67 @@ +//========================================================= +// Simulation setup file for esc07_demo project +//========================================================= + +__var _timer0_interrupt_ID; + +irqBreak() +{ + __var __AIC_SMR; + __var __AIC_IECR; + __var __AIC_IVR; + + // read AIC_IECR instead, since not fully supported by simulator + __AIC_IECR = __readMemory32(0xFFFFF120, "Memory"); + if(__AIC_IECR & 0x1000) + { + __AIC_SMR = __readMemory32(0xFFFFF060, "Memory"); + __AIC_IVR = __readMemory32(0xFFFFF0B0, "Memory"); //AIC_IVR = AIC_SVR[x] + __writeMemory32(__AIC_IVR, 0xFFFFF100, "Memory"); //AIC_IVR + __writeMemory32(0x1000, 0xFFFFF10C, "Memory"); //AIC_IPR + __writeMemory32(0x2, 0xFFFFF114, "Memory"); //AIC_CISR + } + + return 0; +} + +setupProcessorRegisters() +{ + // Write TC0_SR.CPCS with correct status for ISR (Clock enabled; RC Compare Flag = TRUE) + __writeMemory32(0x00010010, 0xfffa0020, "Memory"); + + // Set TX ready flag in USART0 status register + // USART0_BASE->US_CSR = AT91C_US_TXRDY + __writeMemory32(0x00000002, 0xfffc0014, "Memory"); +} + +configureTimer0Interrupt() +{ + __var _master_clock_frequency; + __var _timer0_period_cycles; + + // Calculate timer0 frequency in master clock cycles + _master_clock_frequency = 48054857; + _timer0_period_cycles = _master_clock_frequency / 100; + if((_master_clock_frequency % 100) >= 50) + { + _timer0_period_cycles++; + } + + __cancelAllInterrupts(); + __enableInterrupts(); + + _timer0_interrupt_ID = __orderInterrupt("IRQ", _timer0_period_cycles, _timer0_period_cycles, 0, 0, 0, 100); + + if(-1 == _timer0_interrupt_ID) + { + __message "ERROR: failed to order timer 0 interrupt"; + } + + __setCodeBreak("0x18", 0, "irqBreak()", "TRUE", ""); +} + +execUserReset() +{ + setupProcessorRegisters(); + configureTimer0Interrupt(); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/at91SAM7X256_FLASH.xcl b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/at91SAM7X256_FLASH.xcl new file mode 100644 index 0000000..02eaec7 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/at91SAM7X256_FLASH.xcl @@ -0,0 +1,185 @@ +// ---------------------------------------------------------------------------- +// ATMEL Microcontroller Software Support - ROUSSET - +// ---------------------------------------------------------------------------- +// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// ---------------------------------------------------------------------------- +// File Name : at91SAM7X256_FLASH.xcl +// Object : Generic Linker Command File for IAR +// 1.0 30/Aug/05 FBr : Creation for 4.30A +// ---------------------------------------------------------------------------- + +//************************************************************************* +// XLINK command file template for EWARM/ICCARM +// +// Usage: xlink -f lnkarm +// -s +//************************************************************************* +// +// ------------- +// Code segments - may be placed anywhere in memory. +// ------------- +// +// INTVEC -- Exception vector table. +// SWITAB -- Software interrupt vector table. +// ICODE -- Startup (cstartup) and exception code. +// DIFUNCT -- Dynamic initialization vectors used by C++. +// CODE -- Compiler generated code. +// CODE_I -- Compiler generated code declared __ramfunc (executes in RAM) +// CODE_ID -- Initializer for CODE_I (ROM). +// +// ------------- +// Data segments - may be placed anywhere in memory. +// ------------- +// +// CSTACK -- The stack used by C/C++ programs (system and user mode). +// IRQ_STACK -- The stack used by IRQ service routines. +// SVC_STACK -- The stack used in supervisor mode +// (Define other exception stacks as needed for +// FIQ, ABT, UND). +// HEAP -- The heap used by malloc and free in C and new and +// delete in C++. +// INITTAB -- Table containing addresses and sizes of segments that +// need to be initialized at startup (by cstartup). +// CHECKSUM -- The linker places checksum byte(s) in this segment, +// when the -J linker command line option is used. +// DATA_y -- Data objects. +// +// Where _y can be one of: +// +// _AN -- Holds uninitialized located objects, i.e. objects with +// an absolute location given by the @ operator or the +// #pragma location directive. Since these segments +// contain objects which already have a fixed address, +// they should not be mentioned in this linker command +// file. +// _C -- Constants (ROM). +// _I -- Initialized data (RAM). +// _ID -- The original content of _I (copied to _I by cstartup) (ROM). +// _N -- Uninitialized data (RAM). +// _Z -- Zero initialized data (RAM). +// +// Note: Be sure to use end values for the defined address ranges. +// Otherwise, the linker may allocate space outside the +// intended memory range. +//************************************************************************* + +//************************************************************************* +// Inform the linker about the CPU family used. +// AT91SAM7X256 Memory mapping +// No remap +// ROMSTART +// Start address 0x0000 0000 +// Size 256 Kbo 0x0004 0000 +// RAMSTART +// Start address 0x0020 0000 +// Size 64 Kbo 0x0001 0000 +// Remap done +// RAMSTART +// Start address 0x0000 0000 +// Size 64 Kbo 0x0001 0000 +// ROMSTART +// Start address 0x0010 0000 +// Size 256 Kbo 0x0004 0000 + +//************************************************************************* +-carm + +//************************************************************************* +// Internal Ram segments mapped AFTER REMAP 64 K. +//************************************************************************* +-Z(CONST)INTRAMSTART_REMAP=00200000 +-Z(CONST)INTRAMEND_REMAP=0020FFFF + +//************************************************************************* +// Read-only segments mapped to Flash 256 K. +//************************************************************************* +-DROMSTART=00000000 +-DROMEND=0003FFFF +//************************************************************************* +// Read/write segments mapped to 64 K RAM. +//************************************************************************* +-DRAMSTART=00200000 +-DRAMEND=0020FFFF + +//************************************************************************* +// Address range for reset and exception +// vectors (INTVEC). +// The vector area is 32 bytes, +// an additional 32 bytes is allocated for the +// constant table used by ldr PC in cstartup.s79. +//************************************************************************* +-Z(CODE)INTVEC=00-3F + +//************************************************************************* +// Startup code and exception routines (ICODE). +//************************************************************************* +-Z(CODE)ICODE,DIFUNCT=ROMSTART-ROMEND +-Z(CODE)SWITAB=ROMSTART-ROMEND + +//************************************************************************* +// Code segments may be placed anywhere. +//************************************************************************* +-Z(CODE)CODE=ROMSTART-ROMEND + +//************************************************************************* +// Various constants and initializers. +//************************************************************************* +-Z(CONST)INITTAB,DATA_ID,DATA_C=ROMSTART-ROMEND +-Z(CONST)CHECKSUM=ROMSTART-ROMEND + +//************************************************************************* +// Data segments. +//************************************************************************* +-Z(DATA)DATA_I,DATA_Z,DATA_N=RAMSTART-RAMEND + +//************************************************************************* +// __ramfunc code copied to and executed from RAM. +//************************************************************************* +-Z(DATA)CODE_I=RAMSTART-RAMEND +-Z(CONST)CODE_ID=ROMSTART-ROMEND // Initializer for +-QCODE_I=CODE_ID + +//************************************************************************* +// ICCARM produces code for __ramfunc functions in +// CODE_I segments. The -Q XLINK command line +// option redirects XLINK to emit the code in the +// debug information associated with the CODE_I +// segment, where the code will execute. +//************************************************************************* + +//************************************************************************* +// Stack and heap segments. +//************************************************************************* +-D_CSTACK_SIZE=(100*4) +-D_IRQ_STACK_SIZE=(3*8*4) +-D_HEAP_SIZE=(1024*1) + +-Z(DATA)CSTACK+_CSTACK_SIZE=RAMSTART-RAMEND +-Z(DATA)IRQ_STACK+_IRQ_STACK_SIZE=RAMSTART-RAMEND +-Z(DATA)HEAP+_HEAP_SIZE=RAMSTART-RAMEND + +//************************************************************************* +// ELF/DWARF support. +// +// Uncomment the line "-Felf" below to generate ELF/DWARF output. +// Available format specifiers are: +// +// "-yn": Suppress DWARF debug output +// "-yp": Multiple ELF program sections +// "-yas": Format suitable for debuggers from ARM Ltd (also sets -p flag) +// +// "-Felf" and the format specifiers can also be supplied directly as +// command line options, or selected from the Xlink Output tab in the +// IAR Embedded Workbench. +//************************************************************************* + +// -Felf diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/at91SAM7X256_RAM.xcl b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/at91SAM7X256_RAM.xcl new file mode 100644 index 0000000..adcec10 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/at91SAM7X256_RAM.xcl @@ -0,0 +1,185 @@ +// ---------------------------------------------------------------------------- +// ATMEL Microcontroller Software Support - ROUSSET - +// ---------------------------------------------------------------------------- +// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// ---------------------------------------------------------------------------- +// File Name : at91SAM7X256_RAM.xcl +// Object : Generic Linker Command File for IAR +// 1.0 30/Aug/05 FBr : Creation for 4.30A +// ---------------------------------------------------------------------------- + +//************************************************************************* +// XLINK command file template for EWARM/ICCARM +// +// Usage: xlink -f lnkarm +// -s +//************************************************************************* +// +// ------------- +// Code segments - may be placed anywhere in memory. +// ------------- +// +// INTVEC -- Exception vector table. +// SWITAB -- Software interrupt vector table. +// ICODE -- Startup (cstartup) and exception code. +// DIFUNCT -- Dynamic initialization vectors used by C++. +// CODE -- Compiler generated code. +// CODE_I -- Compiler generated code declared __ramfunc (executes in RAM) +// CODE_ID -- Initializer for CODE_I (ROM). +// +// ------------- +// Data segments - may be placed anywhere in memory. +// ------------- +// +// CSTACK -- The stack used by C/C++ programs (system and user mode). +// IRQ_STACK -- The stack used by IRQ service routines. +// SVC_STACK -- The stack used in supervisor mode +// (Define other exception stacks as needed for +// FIQ, ABT, UND). +// HEAP -- The heap used by malloc and free in C and new and +// delete in C++. +// INITTAB -- Table containing addresses and sizes of segments that +// need to be initialized at startup (by cstartup). +// CHECKSUM -- The linker places checksum byte(s) in this segment, +// when the -J linker command line option is used. +// DATA_y -- Data objects. +// +// Where _y can be one of: +// +// _AN -- Holds uninitialized located objects, i.e. objects with +// an absolute location given by the @ operator or the +// #pragma location directive. Since these segments +// contain objects which already have a fixed address, +// they should not be mentioned in this linker command +// file. +// _C -- Constants (ROM). +// _I -- Initialized data (RAM). +// _ID -- The original content of _I (copied to _I by cstartup) (ROM). +// _N -- Uninitialized data (RAM). +// _Z -- Zero initialized data (RAM). +// +// Note: Be sure to use end values for the defined address ranges. +// Otherwise, the linker may allocate space outside the +// intended memory range. +//************************************************************************* + +//************************************************************************* +// Inform the linker about the CPU family used. +// AT91SAM7X256 Memory mapping +// No remap +// ROMSTART +// Start address 0x0000 0000 +// Size 256 Kbo 0x0004 0000 +// RAMSTART +// Start address 0x0020 0000 +// Size 64 Kbo 0x0001 0000 +// Remap done +// RAMSTART +// Start address 0x0000 0000 +// Size 64 Kbo 0x0001 0000 +// ROMSTART +// Start address 0x0010 0000 +// Size 256 Kbo 0x0004 0000 + +//************************************************************************* +-carm + +//************************************************************************* +// Internal Ram segments mapped AFTER REMAP 64 K. +//************************************************************************* +-Z(CONST)INTRAMSTART_REMAP=00000000 +-Z(CONST)INTRAMEND_REMAP=0000FFFF + +//************************************************************************* +// Read-only segments mapped to Flash 256 K. +//************************************************************************* +-DROMSTART=00000000 +-DROMEND=0003FFFF +//************************************************************************* +// Read/write segments mapped to 64 K RAM. +//************************************************************************* +-DRAMSTART=00000000 +-DRAMEND=0000FFFF + +//************************************************************************* +// Address range for reset and exception +// vectors (INTVEC). +// The vector area is 32 bytes, +// an additional 32 bytes is allocated for the +// constant table used by ldr PC in cstartup.s79. +//************************************************************************* +-Z(CODE)INTVEC=00-3F + +//************************************************************************* +// Startup code and exception routines (ICODE). +//************************************************************************* +-Z(CODE)ICODE,DIFUNCT=ROMSTART-ROMEND +-Z(CODE)SWITAB=ROMSTART-ROMEND + +//************************************************************************* +// Code segments may be placed anywhere. +//************************************************************************* +-Z(CODE)CODE=ROMSTART-ROMEND + +//************************************************************************* +// Various constants and initializers. +//************************************************************************* +-Z(CONST)INITTAB,DATA_ID,DATA_C=ROMSTART-ROMEND +-Z(CONST)CHECKSUM=ROMSTART-ROMEND + +//************************************************************************* +// Data segments. +//************************************************************************* +-Z(DATA)DATA_I,DATA_Z,DATA_N=RAMSTART-RAMEND + +//************************************************************************* +// __ramfunc code copied to and executed from RAM. +//************************************************************************* +-Z(DATA)CODE_I=RAMSTART-RAMEND +-Z(CONST)CODE_ID=ROMSTART-ROMEND // Initializer for +-QCODE_I=CODE_ID + +//************************************************************************* +// ICCARM produces code for __ramfunc functions in +// CODE_I segments. The -Q XLINK command line +// option redirects XLINK to emit the code in the +// debug information associated with the CODE_I +// segment, where the code will execute. +//************************************************************************* + +//************************************************************************* +// Stack and heap segments. +//************************************************************************* +-D_CSTACK_SIZE=(100*4) +-D_IRQ_STACK_SIZE=(3*8*4) +-D_HEAP_SIZE=(1024*2) + +-Z(DATA)CSTACK+_CSTACK_SIZE=RAMSTART-RAMEND +-Z(DATA)IRQ_STACK+_IRQ_STACK_SIZE=RAMSTART-RAMEND +-Z(DATA)HEAP+_HEAP_SIZE=RAMSTART-RAMEND + +//************************************************************************* +// ELF/DWARF support. +// +// Uncomment the line "-Felf" below to generate ELF/DWARF output. +// Available format specifiers are: +// +// "-yn": Suppress DWARF debug output +// "-yp": Multiple ELF program sections +// "-yas": Format suitable for debuggers from ARM Ltd (also sets -p flag) +// +// "-Felf" and the format specifiers can also be supplied directly as +// command line options, or selected from the Xlink Output tab in the +// IAR Embedded Workbench. +//************************************************************************* + +// -Felf diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/ioat91sam7x256.ddf b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/ioat91sam7x256.ddf new file mode 100644 index 0000000..c9fcf32 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/ioat91sam7x256.ddf @@ -0,0 +1,2259 @@ +; ---------------------------------------------------------------------------- +; ATMEL Microcontroller Software Support - ROUSSET - +; ---------------------------------------------------------------------------- +; DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +; DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +; INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +; OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +; LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +; EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +; ---------------------------------------------------------------------------- +; File Name : AT91SAM7X256.ddf +; Object : AT91SAM7X256 definitions +; Generated : AT91 SW Application Group 11/02/2005 (15:17:30) +; +; CVS Reference : /AT91SAM7X256.pl/1.14/Tue Sep 13 15:06:52 2005// +; CVS Reference : /SYS_SAM7X.pl/1.3/Tue Feb 1 17:01:43 2005// +; CVS Reference : /MC_SAM7X.pl/1.2/Fri May 20 14:13:04 2005// +; CVS Reference : /PMC_SAM7X.pl/1.4/Tue Feb 8 13:58:10 2005// +; CVS Reference : /RSTC_SAM7X.pl/1.2/Wed Jul 13 14:57:50 2005// +; CVS Reference : /UDP_SAM7X.pl/1.1/Tue May 10 11:35:35 2005// +; CVS Reference : /PWM_SAM7X.pl/1.1/Tue May 10 11:53:07 2005// +; CVS Reference : /AIC_6075B.pl/1.3/Fri May 20 14:01:30 2005// +; CVS Reference : /PIO_6057A.pl/1.2/Thu Feb 3 10:18:28 2005// +; CVS Reference : /RTTC_6081A.pl/1.2/Tue Nov 9 14:43:58 2004// +; CVS Reference : /PITC_6079A.pl/1.2/Tue Nov 9 14:43:56 2004// +; CVS Reference : /WDTC_6080A.pl/1.3/Tue Nov 9 14:44:00 2004// +; CVS Reference : /VREG_6085B.pl/1.1/Tue Feb 1 16:05:48 2005// +; CVS Reference : /PDC_6074C.pl/1.2/Thu Feb 3 08:48:54 2005// +; CVS Reference : /DBGU_6059D.pl/1.1/Mon Jan 31 13:15:32 2005// +; CVS Reference : /SPI_6088D.pl/1.3/Fri May 20 14:08:59 2005// +; CVS Reference : /US_6089C.pl/1.1/Mon Jul 12 18:23:26 2004// +; CVS Reference : /SSC_6078B.pl/1.1/Wed Jul 13 15:19:19 2005// +; CVS Reference : /TWI_6061A.pl/1.1/Tue Jul 13 07:38:06 2004// +; CVS Reference : /TC_6082A.pl/1.7/Fri Mar 11 12:52:17 2005// +; CVS Reference : /CAN_6019B.pl/1.1/Tue Mar 8 12:42:22 2005// +; CVS Reference : /EMACB_6119A.pl/1.6/Wed Jul 13 15:05:35 2005// +; CVS Reference : /ADC_6051C.pl/1.1/Fri Oct 17 09:12:38 2003// +; ---------------------------------------------------------------------------- + +[Sfr] + +; ========== Register definition for SYS peripheral ========== +; ========== Register definition for AIC peripheral ========== +sfr = "AIC_SMR", "Memory", 0xfffff000, 4, base=16 +sfr = "AIC_SMR.PRIOR", "Memory", 0xfffff000, 4, base=16, bitRange=0-2 +sfr = "AIC_SMR.SRCTYPE", "Memory", 0xfffff000, 4, base=16, bitRange=5-6 +sfr = "AIC_SVR", "Memory", 0xfffff080, 4, base=16 +sfr = "AIC_IVR", "Memory", 0xfffff100, 4, base=16 +sfr = "AIC_FVR", "Memory", 0xfffff104, 4, base=16 +sfr = "AIC_ISR", "Memory", 0xfffff108, 4, base=16 +sfr = "AIC_IPR", "Memory", 0xfffff10c, 4, base=16 +sfr = "AIC_IMR", "Memory", 0xfffff110, 4, base=16 +sfr = "AIC_CISR", "Memory", 0xfffff114, 4, base=16 +sfr = "AIC_CISR.NFIQ", "Memory", 0xfffff114, 4, base=16, bitRange=0 +sfr = "AIC_CISR.NIRQ", "Memory", 0xfffff114, 4, base=16, bitRange=1 +sfr = "AIC_IECR", "Memory", 0xfffff120, 4, base=16 +sfr = "AIC_IDCR", "Memory", 0xfffff124, 4, base=16 +sfr = "AIC_ICCR", "Memory", 0xfffff128, 4, base=16 +sfr = "AIC_ISCR", "Memory", 0xfffff12c, 4, base=16 +sfr = "AIC_EOICR", "Memory", 0xfffff130, 4, base=16 +sfr = "AIC_SPU", "Memory", 0xfffff134, 4, base=16 +sfr = "AIC_DCR", "Memory", 0xfffff138, 4, base=16 +sfr = "AIC_DCR.PROT", "Memory", 0xfffff138, 4, base=16, bitRange=0 +sfr = "AIC_DCR.GMSK", "Memory", 0xfffff138, 4, base=16, bitRange=1 +sfr = "AIC_FFER", "Memory", 0xfffff140, 4, base=16 +sfr = "AIC_FFDR", "Memory", 0xfffff144, 4, base=16 +sfr = "AIC_FFSR", "Memory", 0xfffff148, 4, base=16 +; ========== Register definition for PDC_DBGU peripheral ========== +sfr = "DBGU_RPR", "Memory", 0xfffff300, 4, base=16 +sfr = "DBGU_RCR", "Memory", 0xfffff304, 4, base=16 +sfr = "DBGU_TPR", "Memory", 0xfffff308, 4, base=16 +sfr = "DBGU_TCR", "Memory", 0xfffff30c, 4, base=16 +sfr = "DBGU_RNPR", "Memory", 0xfffff310, 4, base=16 +sfr = "DBGU_RNCR", "Memory", 0xfffff314, 4, base=16 +sfr = "DBGU_TNPR", "Memory", 0xfffff318, 4, base=16 +sfr = "DBGU_TNCR", "Memory", 0xfffff31c, 4, base=16 +sfr = "DBGU_PTCR", "Memory", 0xfffff320, 4, base=16 +sfr = "DBGU_PTCR.RXTEN", "Memory", 0xfffff320, 4, base=16, bitRange=0 +sfr = "DBGU_PTCR.RXTDIS", "Memory", 0xfffff320, 4, base=16, bitRange=1 +sfr = "DBGU_PTCR.TXTEN", "Memory", 0xfffff320, 4, base=16, bitRange=8 +sfr = "DBGU_PTCR.TXTDIS", "Memory", 0xfffff320, 4, base=16, bitRange=9 +sfr = "DBGU_PTSR", "Memory", 0xfffff324, 4, base=16 +sfr = "DBGU_PTSR.RXTEN", "Memory", 0xfffff324, 4, base=16, bitRange=0 +sfr = "DBGU_PTSR.TXTEN", "Memory", 0xfffff324, 4, base=16, bitRange=8 +; ========== Register definition for DBGU peripheral ========== +sfr = "DBGU_CR", "Memory", 0xfffff200, 4, base=16 +sfr = "DBGU_CR.RSTRX", "Memory", 0xfffff200, 4, base=16, bitRange=2 +sfr = "DBGU_CR.RSTTX", "Memory", 0xfffff200, 4, base=16, bitRange=3 +sfr = "DBGU_CR.RXEN", "Memory", 0xfffff200, 4, base=16, bitRange=4 +sfr = "DBGU_CR.RXDIS", "Memory", 0xfffff200, 4, base=16, bitRange=5 +sfr = "DBGU_CR.TXEN", "Memory", 0xfffff200, 4, base=16, bitRange=6 +sfr = "DBGU_CR.TXDIS", "Memory", 0xfffff200, 4, base=16, bitRange=7 +sfr = "DBGU_CR.RSTSTA", "Memory", 0xfffff200, 4, base=16, bitRange=8 +sfr = "DBGU_MR", "Memory", 0xfffff204, 4, base=16 +sfr = "DBGU_MR.PAR", "Memory", 0xfffff204, 4, base=16, bitRange=9-11 +sfr = "DBGU_MR.CHMODE", "Memory", 0xfffff204, 4, base=16, bitRange=14-15 +sfr = "DBGU_IER", "Memory", 0xfffff208, 4, base=16 +sfr = "DBGU_IER.RXRDY", "Memory", 0xfffff208, 4, base=16, bitRange=0 +sfr = "DBGU_IER.TXRDY", "Memory", 0xfffff208, 4, base=16, bitRange=1 +sfr = "DBGU_IER.ENDRX", "Memory", 0xfffff208, 4, base=16, bitRange=3 +sfr = "DBGU_IER.ENDTX", "Memory", 0xfffff208, 4, base=16, bitRange=4 +sfr = "DBGU_IER.OVRE", "Memory", 0xfffff208, 4, base=16, bitRange=5 +sfr = "DBGU_IER.FRAME", "Memory", 0xfffff208, 4, base=16, bitRange=6 +sfr = "DBGU_IER.PARE", "Memory", 0xfffff208, 4, base=16, bitRange=7 +sfr = "DBGU_IER.TXEMPTY", "Memory", 0xfffff208, 4, base=16, bitRange=9 +sfr = "DBGU_IER.TXBUFE", "Memory", 0xfffff208, 4, base=16, bitRange=11 +sfr = "DBGU_IER.RXBUFF", "Memory", 0xfffff208, 4, base=16, bitRange=12 +sfr = "DBGU_IER.TX", "Memory", 0xfffff208, 4, base=16, bitRange=30 +sfr = "DBGU_IER.RX", "Memory", 0xfffff208, 4, base=16, bitRange=31 +sfr = "DBGU_IDR", "Memory", 0xfffff20c, 4, base=16 +sfr = "DBGU_IDR.RXRDY", "Memory", 0xfffff20c, 4, base=16, bitRange=0 +sfr = "DBGU_IDR.TXRDY", "Memory", 0xfffff20c, 4, base=16, bitRange=1 +sfr = "DBGU_IDR.ENDRX", "Memory", 0xfffff20c, 4, base=16, bitRange=3 +sfr = "DBGU_IDR.ENDTX", "Memory", 0xfffff20c, 4, base=16, bitRange=4 +sfr = "DBGU_IDR.OVRE", "Memory", 0xfffff20c, 4, base=16, bitRange=5 +sfr = "DBGU_IDR.FRAME", "Memory", 0xfffff20c, 4, base=16, bitRange=6 +sfr = "DBGU_IDR.PARE", "Memory", 0xfffff20c, 4, base=16, bitRange=7 +sfr = "DBGU_IDR.TXEMPTY", "Memory", 0xfffff20c, 4, base=16, bitRange=9 +sfr = "DBGU_IDR.TXBUFE", "Memory", 0xfffff20c, 4, base=16, bitRange=11 +sfr = "DBGU_IDR.RXBUFF", "Memory", 0xfffff20c, 4, base=16, bitRange=12 +sfr = "DBGU_IDR.TX", "Memory", 0xfffff20c, 4, base=16, bitRange=30 +sfr = "DBGU_IDR.RX", "Memory", 0xfffff20c, 4, base=16, bitRange=31 +sfr = "DBGU_IMR", "Memory", 0xfffff210, 4, base=16 +sfr = "DBGU_IMR.RXRDY", "Memory", 0xfffff210, 4, base=16, bitRange=0 +sfr = "DBGU_IMR.TXRDY", "Memory", 0xfffff210, 4, base=16, bitRange=1 +sfr = "DBGU_IMR.ENDRX", "Memory", 0xfffff210, 4, base=16, bitRange=3 +sfr = "DBGU_IMR.ENDTX", "Memory", 0xfffff210, 4, base=16, bitRange=4 +sfr = "DBGU_IMR.OVRE", "Memory", 0xfffff210, 4, base=16, bitRange=5 +sfr = "DBGU_IMR.FRAME", "Memory", 0xfffff210, 4, base=16, bitRange=6 +sfr = "DBGU_IMR.PARE", "Memory", 0xfffff210, 4, base=16, bitRange=7 +sfr = "DBGU_IMR.TXEMPTY", "Memory", 0xfffff210, 4, base=16, bitRange=9 +sfr = "DBGU_IMR.TXBUFE", "Memory", 0xfffff210, 4, base=16, bitRange=11 +sfr = "DBGU_IMR.RXBUFF", "Memory", 0xfffff210, 4, base=16, bitRange=12 +sfr = "DBGU_IMR.TX", "Memory", 0xfffff210, 4, base=16, bitRange=30 +sfr = "DBGU_IMR.RX", "Memory", 0xfffff210, 4, base=16, bitRange=31 +sfr = "DBGU_CSR", "Memory", 0xfffff214, 4, base=16 +sfr = "DBGU_CSR.RXRDY", "Memory", 0xfffff214, 4, base=16, bitRange=0 +sfr = "DBGU_CSR.TXRDY", "Memory", 0xfffff214, 4, base=16, bitRange=1 +sfr = "DBGU_CSR.ENDRX", "Memory", 0xfffff214, 4, base=16, bitRange=3 +sfr = "DBGU_CSR.ENDTX", "Memory", 0xfffff214, 4, base=16, bitRange=4 +sfr = "DBGU_CSR.OVRE", "Memory", 0xfffff214, 4, base=16, bitRange=5 +sfr = "DBGU_CSR.FRAME", "Memory", 0xfffff214, 4, base=16, bitRange=6 +sfr = "DBGU_CSR.PARE", "Memory", 0xfffff214, 4, base=16, bitRange=7 +sfr = "DBGU_CSR.TXEMPTY", "Memory", 0xfffff214, 4, base=16, bitRange=9 +sfr = "DBGU_CSR.TXBUFE", "Memory", 0xfffff214, 4, base=16, bitRange=11 +sfr = "DBGU_CSR.RXBUFF", "Memory", 0xfffff214, 4, base=16, bitRange=12 +sfr = "DBGU_CSR.TX", "Memory", 0xfffff214, 4, base=16, bitRange=30 +sfr = "DBGU_CSR.RX", "Memory", 0xfffff214, 4, base=16, bitRange=31 +sfr = "DBGU_RHR", "Memory", 0xfffff218, 4, base=16 +sfr = "DBGU_THR", "Memory", 0xfffff21c, 4, base=16 +sfr = "DBGU_BRGR", "Memory", 0xfffff220, 4, base=16 +sfr = "DBGU_CIDR", "Memory", 0xfffff240, 4, base=16 +sfr = "DBGU_EXID", "Memory", 0xfffff244, 4, base=16 +sfr = "DBGU_FNTR", "Memory", 0xfffff248, 4, base=16 +sfr = "DBGU_FNTR.NTRST", "Memory", 0xfffff248, 4, base=16, bitRange=0 +; ========== Register definition for PIOA peripheral ========== +sfr = "PIOA_PER", "Memory", 0xfffff400, 4, base=16 +sfr = "PIOA_PDR", "Memory", 0xfffff404, 4, base=16 +sfr = "PIOA_PSR", "Memory", 0xfffff408, 4, base=16 +sfr = "PIOA_OER", "Memory", 0xfffff410, 4, base=16 +sfr = "PIOA_ODR", "Memory", 0xfffff414, 4, base=16 +sfr = "PIOA_OSR", "Memory", 0xfffff418, 4, base=16 +sfr = "PIOA_IFER", "Memory", 0xfffff420, 4, base=16 +sfr = "PIOA_IFDR", "Memory", 0xfffff424, 4, base=16 +sfr = "PIOA_IFSR", "Memory", 0xfffff428, 4, base=16 +sfr = "PIOA_SODR", "Memory", 0xfffff430, 4, base=16 +sfr = "PIOA_CODR", "Memory", 0xfffff434, 4, base=16 +sfr = "PIOA_ODSR", "Memory", 0xfffff438, 4, base=16 +sfr = "PIOA_PDSR", "Memory", 0xfffff43c, 4, base=16 +sfr = "PIOA_IER", "Memory", 0xfffff440, 4, base=16 +sfr = "PIOA_IDR", "Memory", 0xfffff444, 4, base=16 +sfr = "PIOA_IMR", "Memory", 0xfffff448, 4, base=16 +sfr = "PIOA_ISR", "Memory", 0xfffff44c, 4, base=16 +sfr = "PIOA_MDER", "Memory", 0xfffff450, 4, base=16 +sfr = "PIOA_MDDR", "Memory", 0xfffff454, 4, base=16 +sfr = "PIOA_MDSR", "Memory", 0xfffff458, 4, base=16 +sfr = "PIOA_PPUDR", "Memory", 0xfffff460, 4, base=16 +sfr = "PIOA_PPUER", "Memory", 0xfffff464, 4, base=16 +sfr = "PIOA_PPUSR", "Memory", 0xfffff468, 4, base=16 +sfr = "PIOA_ASR", "Memory", 0xfffff470, 4, base=16 +sfr = "PIOA_BSR", "Memory", 0xfffff474, 4, base=16 +sfr = "PIOA_ABSR", "Memory", 0xfffff478, 4, base=16 +sfr = "PIOA_OWER", "Memory", 0xfffff4a0, 4, base=16 +sfr = "PIOA_OWDR", "Memory", 0xfffff4a4, 4, base=16 +sfr = "PIOA_OWSR", "Memory", 0xfffff4a8, 4, base=16 +; ========== Register definition for PIOB peripheral ========== +sfr = "PIOB_PER", "Memory", 0xfffff600, 4, base=16 +sfr = "PIOB_PDR", "Memory", 0xfffff604, 4, base=16 +sfr = "PIOB_PSR", "Memory", 0xfffff608, 4, base=16 +sfr = "PIOB_OER", "Memory", 0xfffff610, 4, base=16 +sfr = "PIOB_ODR", "Memory", 0xfffff614, 4, base=16 +sfr = "PIOB_OSR", "Memory", 0xfffff618, 4, base=16 +sfr = "PIOB_IFER", "Memory", 0xfffff620, 4, base=16 +sfr = "PIOB_IFDR", "Memory", 0xfffff624, 4, base=16 +sfr = "PIOB_IFSR", "Memory", 0xfffff628, 4, base=16 +sfr = "PIOB_SODR", "Memory", 0xfffff630, 4, base=16 +sfr = "PIOB_CODR", "Memory", 0xfffff634, 4, base=16 +sfr = "PIOB_ODSR", "Memory", 0xfffff638, 4, base=16 +sfr = "PIOB_PDSR", "Memory", 0xfffff63c, 4, base=16 +sfr = "PIOB_IER", "Memory", 0xfffff640, 4, base=16 +sfr = "PIOB_IDR", "Memory", 0xfffff644, 4, base=16 +sfr = "PIOB_IMR", "Memory", 0xfffff648, 4, base=16 +sfr = "PIOB_ISR", "Memory", 0xfffff64c, 4, base=16 +sfr = "PIOB_MDER", "Memory", 0xfffff650, 4, base=16 +sfr = "PIOB_MDDR", "Memory", 0xfffff654, 4, base=16 +sfr = "PIOB_MDSR", "Memory", 0xfffff658, 4, base=16 +sfr = "PIOB_PPUDR", "Memory", 0xfffff660, 4, base=16 +sfr = "PIOB_PPUER", "Memory", 0xfffff664, 4, base=16 +sfr = "PIOB_PPUSR", "Memory", 0xfffff668, 4, base=16 +sfr = "PIOB_ASR", "Memory", 0xfffff670, 4, base=16 +sfr = "PIOB_BSR", "Memory", 0xfffff674, 4, base=16 +sfr = "PIOB_ABSR", "Memory", 0xfffff678, 4, base=16 +sfr = "PIOB_OWER", "Memory", 0xfffff6a0, 4, base=16 +sfr = "PIOB_OWDR", "Memory", 0xfffff6a4, 4, base=16 +sfr = "PIOB_OWSR", "Memory", 0xfffff6a8, 4, base=16 +; ========== Register definition for CKGR peripheral ========== +sfr = "CKGR_MOR", "Memory", 0xfffffc20, 4, base=16 +sfr = "CKGR_MOR.MOSCEN", "Memory", 0xfffffc20, 4, base=16, bitRange=0 +sfr = "CKGR_MOR.OSCBYPASS", "Memory", 0xfffffc20, 4, base=16, bitRange=1 +sfr = "CKGR_MOR.OSCOUNT", "Memory", 0xfffffc20, 4, base=16, bitRange=8-15 +sfr = "CKGR_MCFR", "Memory", 0xfffffc24, 4, base=16 +sfr = "CKGR_MCFR.MAINF", "Memory", 0xfffffc24, 4, base=16, bitRange=0-15 +sfr = "CKGR_MCFR.MAINRDY", "Memory", 0xfffffc24, 4, base=16, bitRange=16 +sfr = "CKGR_PLLR", "Memory", 0xfffffc2c, 4, base=16 +sfr = "CKGR_PLLR.DIV", "Memory", 0xfffffc2c, 4, base=16, bitRange=0-7 +sfr = "CKGR_PLLR.PLLCOUNT", "Memory", 0xfffffc2c, 4, base=16, bitRange=8-13 +sfr = "CKGR_PLLR.OUT", "Memory", 0xfffffc2c, 4, base=16, bitRange=14-15 +sfr = "CKGR_PLLR.MUL", "Memory", 0xfffffc2c, 4, base=16, bitRange=16-26 +sfr = "CKGR_PLLR.USBDIV", "Memory", 0xfffffc2c, 4, base=16, bitRange=28-29 +; ========== Register definition for PMC peripheral ========== +sfr = "PMC_SCER", "Memory", 0xfffffc00, 4, base=16 +sfr = "PMC_SCER.PCK", "Memory", 0xfffffc00, 4, base=16, bitRange=0 +sfr = "PMC_SCER.UDP", "Memory", 0xfffffc00, 4, base=16, bitRange=7 +sfr = "PMC_SCER.PCK0", "Memory", 0xfffffc00, 4, base=16, bitRange=8 +sfr = "PMC_SCER.PCK1", "Memory", 0xfffffc00, 4, base=16, bitRange=9 +sfr = "PMC_SCER.PCK2", "Memory", 0xfffffc00, 4, base=16, bitRange=10 +sfr = "PMC_SCER.PCK3", "Memory", 0xfffffc00, 4, base=16, bitRange=11 +sfr = "PMC_SCDR", "Memory", 0xfffffc04, 4, base=16 +sfr = "PMC_SCDR.PCK", "Memory", 0xfffffc04, 4, base=16, bitRange=0 +sfr = "PMC_SCDR.UDP", "Memory", 0xfffffc04, 4, base=16, bitRange=7 +sfr = "PMC_SCDR.PCK0", "Memory", 0xfffffc04, 4, base=16, bitRange=8 +sfr = "PMC_SCDR.PCK1", "Memory", 0xfffffc04, 4, base=16, bitRange=9 +sfr = "PMC_SCDR.PCK2", "Memory", 0xfffffc04, 4, base=16, bitRange=10 +sfr = "PMC_SCDR.PCK3", "Memory", 0xfffffc04, 4, base=16, bitRange=11 +sfr = "PMC_SCSR", "Memory", 0xfffffc08, 4, base=16 +sfr = "PMC_SCSR.PCK", "Memory", 0xfffffc08, 4, base=16, bitRange=0 +sfr = "PMC_SCSR.UDP", "Memory", 0xfffffc08, 4, base=16, bitRange=7 +sfr = "PMC_SCSR.PCK0", "Memory", 0xfffffc08, 4, base=16, bitRange=8 +sfr = "PMC_SCSR.PCK1", "Memory", 0xfffffc08, 4, base=16, bitRange=9 +sfr = "PMC_SCSR.PCK2", "Memory", 0xfffffc08, 4, base=16, bitRange=10 +sfr = "PMC_SCSR.PCK3", "Memory", 0xfffffc08, 4, base=16, bitRange=11 +sfr = "PMC_PCER", "Memory", 0xfffffc10, 4, base=16 +sfr = "PMC_PCDR", "Memory", 0xfffffc14, 4, base=16 +sfr = "PMC_PCSR", "Memory", 0xfffffc18, 4, base=16 +sfr = "PMC_MOR", "Memory", 0xfffffc20, 4, base=16 +sfr = "PMC_MOR.MOSCEN", "Memory", 0xfffffc20, 4, base=16, bitRange=0 +sfr = "PMC_MOR.OSCBYPASS", "Memory", 0xfffffc20, 4, base=16, bitRange=1 +sfr = "PMC_MOR.OSCOUNT", "Memory", 0xfffffc20, 4, base=16, bitRange=8-15 +sfr = "PMC_MCFR", "Memory", 0xfffffc24, 4, base=16 +sfr = "PMC_MCFR.MAINF", "Memory", 0xfffffc24, 4, base=16, bitRange=0-15 +sfr = "PMC_MCFR.MAINRDY", "Memory", 0xfffffc24, 4, base=16, bitRange=16 +sfr = "PMC_PLLR", "Memory", 0xfffffc2c, 4, base=16 +sfr = "PMC_PLLR.DIV", "Memory", 0xfffffc2c, 4, base=16, bitRange=0-7 +sfr = "PMC_PLLR.PLLCOUNT", "Memory", 0xfffffc2c, 4, base=16, bitRange=8-13 +sfr = "PMC_PLLR.OUT", "Memory", 0xfffffc2c, 4, base=16, bitRange=14-15 +sfr = "PMC_PLLR.MUL", "Memory", 0xfffffc2c, 4, base=16, bitRange=16-26 +sfr = "PMC_PLLR.USBDIV", "Memory", 0xfffffc2c, 4, base=16, bitRange=28-29 +sfr = "PMC_MCKR", "Memory", 0xfffffc30, 4, base=16 +sfr = "PMC_MCKR.CSS", "Memory", 0xfffffc30, 4, base=16, bitRange=0-1 +sfr = "PMC_MCKR.PRES", "Memory", 0xfffffc30, 4, base=16, bitRange=2-4 +sfr = "PMC_PCKR", "Memory", 0xfffffc40, 4, base=16 +sfr = "PMC_PCKR.CSS", "Memory", 0xfffffc40, 4, base=16, bitRange=0-1 +sfr = "PMC_PCKR.PRES", "Memory", 0xfffffc40, 4, base=16, bitRange=2-4 +sfr = "PMC_IER", "Memory", 0xfffffc60, 4, base=16 +sfr = "PMC_IER.MOSCS", "Memory", 0xfffffc60, 4, base=16, bitRange=0 +sfr = "PMC_IER.LOCK", "Memory", 0xfffffc60, 4, base=16, bitRange=2 +sfr = "PMC_IER.MCKRDY", "Memory", 0xfffffc60, 4, base=16, bitRange=3 +sfr = "PMC_IER.PCK0RDY", "Memory", 0xfffffc60, 4, base=16, bitRange=8 +sfr = "PMC_IER.PCK1RDY", "Memory", 0xfffffc60, 4, base=16, bitRange=9 +sfr = "PMC_IER.PCK2RDY", "Memory", 0xfffffc60, 4, base=16, bitRange=10 +sfr = "PMC_IER.PCK3RDY", "Memory", 0xfffffc60, 4, base=16, bitRange=11 +sfr = "PMC_IDR", "Memory", 0xfffffc64, 4, base=16 +sfr = "PMC_IDR.MOSCS", "Memory", 0xfffffc64, 4, base=16, bitRange=0 +sfr = "PMC_IDR.LOCK", "Memory", 0xfffffc64, 4, base=16, bitRange=2 +sfr = "PMC_IDR.MCKRDY", "Memory", 0xfffffc64, 4, base=16, bitRange=3 +sfr = "PMC_IDR.PCK0RDY", "Memory", 0xfffffc64, 4, base=16, bitRange=8 +sfr = "PMC_IDR.PCK1RDY", "Memory", 0xfffffc64, 4, base=16, bitRange=9 +sfr = "PMC_IDR.PCK2RDY", "Memory", 0xfffffc64, 4, base=16, bitRange=10 +sfr = "PMC_IDR.PCK3RDY", "Memory", 0xfffffc64, 4, base=16, bitRange=11 +sfr = "PMC_SR", "Memory", 0xfffffc68, 4, base=16 +sfr = "PMC_SR.MOSCS", "Memory", 0xfffffc68, 4, base=16, bitRange=0 +sfr = "PMC_SR.LOCK", "Memory", 0xfffffc68, 4, base=16, bitRange=2 +sfr = "PMC_SR.MCKRDY", "Memory", 0xfffffc68, 4, base=16, bitRange=3 +sfr = "PMC_SR.PCK0RDY", "Memory", 0xfffffc68, 4, base=16, bitRange=8 +sfr = "PMC_SR.PCK1RDY", "Memory", 0xfffffc68, 4, base=16, bitRange=9 +sfr = "PMC_SR.PCK2RDY", "Memory", 0xfffffc68, 4, base=16, bitRange=10 +sfr = "PMC_SR.PCK3RDY", "Memory", 0xfffffc68, 4, base=16, bitRange=11 +sfr = "PMC_IMR", "Memory", 0xfffffc6c, 4, base=16 +sfr = "PMC_IMR.MOSCS", "Memory", 0xfffffc6c, 4, base=16, bitRange=0 +sfr = "PMC_IMR.LOCK", "Memory", 0xfffffc6c, 4, base=16, bitRange=2 +sfr = "PMC_IMR.MCKRDY", "Memory", 0xfffffc6c, 4, base=16, bitRange=3 +sfr = "PMC_IMR.PCK0RDY", "Memory", 0xfffffc6c, 4, base=16, bitRange=8 +sfr = "PMC_IMR.PCK1RDY", "Memory", 0xfffffc6c, 4, base=16, bitRange=9 +sfr = "PMC_IMR.PCK2RDY", "Memory", 0xfffffc6c, 4, base=16, bitRange=10 +sfr = "PMC_IMR.PCK3RDY", "Memory", 0xfffffc6c, 4, base=16, bitRange=11 +; ========== Register definition for RSTC peripheral ========== +sfr = "RSTC_RCR", "Memory", 0xfffffd00, 4, base=16 +sfr = "RSTC_RCR.PROCRST", "Memory", 0xfffffd00, 4, base=16, bitRange=0 +sfr = "RSTC_RCR.PERRST", "Memory", 0xfffffd00, 4, base=16, bitRange=2 +sfr = "RSTC_RCR.EXTRST", "Memory", 0xfffffd00, 4, base=16, bitRange=3 +sfr = "RSTC_RCR.KEY", "Memory", 0xfffffd00, 4, base=16, bitRange=24-31 +sfr = "RSTC_RSR", "Memory", 0xfffffd04, 4, base=16 +sfr = "RSTC_RSR.URSTS", "Memory", 0xfffffd04, 4, base=16, bitRange=0 +sfr = "RSTC_RSR.BODSTS", "Memory", 0xfffffd04, 4, base=16, bitRange=1 +sfr = "RSTC_RSR.RSTTYP", "Memory", 0xfffffd04, 4, base=16, bitRange=8-10 +sfr = "RSTC_RSR.NRSTL", "Memory", 0xfffffd04, 4, base=16, bitRange=16 +sfr = "RSTC_RSR.SRCMP", "Memory", 0xfffffd04, 4, base=16, bitRange=17 +sfr = "RSTC_RMR", "Memory", 0xfffffd08, 4, base=16 +sfr = "RSTC_RMR.URSTEN", "Memory", 0xfffffd08, 4, base=16, bitRange=0 +sfr = "RSTC_RMR.URSTIEN", "Memory", 0xfffffd08, 4, base=16, bitRange=4 +sfr = "RSTC_RMR.ERSTL", "Memory", 0xfffffd08, 4, base=16, bitRange=8-11 +sfr = "RSTC_RMR.BODIEN", "Memory", 0xfffffd08, 4, base=16, bitRange=16 +sfr = "RSTC_RMR.KEY", "Memory", 0xfffffd08, 4, base=16, bitRange=24-31 +; ========== Register definition for RTTC peripheral ========== +sfr = "RTTC_RTMR", "Memory", 0xfffffd20, 4, base=16 +sfr = "RTTC_RTMR.RTPRES", "Memory", 0xfffffd20, 4, base=16, bitRange=0-15 +sfr = "RTTC_RTMR.ALMIEN", "Memory", 0xfffffd20, 4, base=16, bitRange=16 +sfr = "RTTC_RTMR.RTTINCIEN", "Memory", 0xfffffd20, 4, base=16, bitRange=17 +sfr = "RTTC_RTMR.RTTRST", "Memory", 0xfffffd20, 4, base=16, bitRange=18 +sfr = "RTTC_RTAR", "Memory", 0xfffffd24, 4, base=16 +sfr = "RTTC_RTAR.ALMV", "Memory", 0xfffffd24, 4, base=16, bitRange=0-31 +sfr = "RTTC_RTVR", "Memory", 0xfffffd28, 4, base=16 +sfr = "RTTC_RTVR.CRTV", "Memory", 0xfffffd28, 4, base=16, bitRange=0-31 +sfr = "RTTC_RTSR", "Memory", 0xfffffd2c, 4, base=16 +sfr = "RTTC_RTSR.ALMS", "Memory", 0xfffffd2c, 4, base=16, bitRange=0 +sfr = "RTTC_RTSR.RTTINC", "Memory", 0xfffffd2c, 4, base=16, bitRange=1 +; ========== Register definition for PITC peripheral ========== +sfr = "PITC_PIMR", "Memory", 0xfffffd30, 4, base=16 +sfr = "PITC_PIMR.PIV", "Memory", 0xfffffd30, 4, base=16, bitRange=0-19 +sfr = "PITC_PIMR.PITEN", "Memory", 0xfffffd30, 4, base=16, bitRange=24 +sfr = "PITC_PIMR.PITIEN", "Memory", 0xfffffd30, 4, base=16, bitRange=25 +sfr = "PITC_PISR", "Memory", 0xfffffd34, 4, base=16 +sfr = "PITC_PISR.PITS", "Memory", 0xfffffd34, 4, base=16, bitRange=0 +sfr = "PITC_PIVR", "Memory", 0xfffffd38, 4, base=16 +sfr = "PITC_PIVR.CPIV", "Memory", 0xfffffd38, 4, base=16, bitRange=0-19 +sfr = "PITC_PIVR.PICNT", "Memory", 0xfffffd38, 4, base=16, bitRange=20-31 +sfr = "PITC_PIIR", "Memory", 0xfffffd3c, 4, base=16 +sfr = "PITC_PIIR.CPIV", "Memory", 0xfffffd3c, 4, base=16, bitRange=0-19 +sfr = "PITC_PIIR.PICNT", "Memory", 0xfffffd3c, 4, base=16, bitRange=20-31 +; ========== Register definition for WDTC peripheral ========== +sfr = "WDTC_WDCR", "Memory", 0xfffffd40, 4, base=16 +sfr = "WDTC_WDCR.WDRSTT", "Memory", 0xfffffd40, 4, base=16, bitRange=0 +sfr = "WDTC_WDCR.KEY", "Memory", 0xfffffd40, 4, base=16, bitRange=24-31 +sfr = "WDTC_WDMR", "Memory", 0xfffffd44, 4, base=16 +sfr = "WDTC_WDMR.WDV", "Memory", 0xfffffd44, 4, base=16, bitRange=0-11 +sfr = "WDTC_WDMR.WDFIEN", "Memory", 0xfffffd44, 4, base=16, bitRange=12 +sfr = "WDTC_WDMR.WDRSTEN", "Memory", 0xfffffd44, 4, base=16, bitRange=13 +sfr = "WDTC_WDMR.WDRPROC", "Memory", 0xfffffd44, 4, base=16, bitRange=14 +sfr = "WDTC_WDMR.WDDIS", "Memory", 0xfffffd44, 4, base=16, bitRange=15 +sfr = "WDTC_WDMR.WDD", "Memory", 0xfffffd44, 4, base=16, bitRange=16-27 +sfr = "WDTC_WDMR.WDDBGHLT", "Memory", 0xfffffd44, 4, base=16, bitRange=28 +sfr = "WDTC_WDMR.WDIDLEHLT", "Memory", 0xfffffd44, 4, base=16, bitRange=29 +sfr = "WDTC_WDSR", "Memory", 0xfffffd48, 4, base=16 +sfr = "WDTC_WDSR.WDUNF", "Memory", 0xfffffd48, 4, base=16, bitRange=0 +sfr = "WDTC_WDSR.WDERR", "Memory", 0xfffffd48, 4, base=16, bitRange=1 +; ========== Register definition for VREG peripheral ========== +sfr = "VREG_MR", "Memory", 0xfffffd60, 4, base=16 +sfr = "VREG_MR.PSTDBY", "Memory", 0xfffffd60, 4, base=16, bitRange=0 +; ========== Register definition for MC peripheral ========== +sfr = "MC_RCR", "Memory", 0xffffff00, 4, base=16 +sfr = "MC_RCR.RCB", "Memory", 0xffffff00, 4, base=16, bitRange=0 +sfr = "MC_ASR", "Memory", 0xffffff04, 4, base=16 +sfr = "MC_ASR.UNDADD", "Memory", 0xffffff04, 4, base=16, bitRange=0 +sfr = "MC_ASR.MISADD", "Memory", 0xffffff04, 4, base=16, bitRange=1 +sfr = "MC_ASR.ABTSZ", "Memory", 0xffffff04, 4, base=16, bitRange=8-9 +sfr = "MC_ASR.ABTTYP", "Memory", 0xffffff04, 4, base=16, bitRange=10-11 +sfr = "MC_ASR.MST0", "Memory", 0xffffff04, 4, base=16, bitRange=16 +sfr = "MC_ASR.MST1", "Memory", 0xffffff04, 4, base=16, bitRange=17 +sfr = "MC_ASR.SVMST0", "Memory", 0xffffff04, 4, base=16, bitRange=24 +sfr = "MC_ASR.SVMST1", "Memory", 0xffffff04, 4, base=16, bitRange=25 +sfr = "MC_AASR", "Memory", 0xffffff08, 4, base=16 +sfr = "MC_FMR", "Memory", 0xffffff60, 4, base=16 +sfr = "MC_FMR.FRDY", "Memory", 0xffffff60, 4, base=16, bitRange=0 +sfr = "MC_FMR.LOCKE", "Memory", 0xffffff60, 4, base=16, bitRange=2 +sfr = "MC_FMR.PROGE", "Memory", 0xffffff60, 4, base=16, bitRange=3 +sfr = "MC_FMR.NEBP", "Memory", 0xffffff60, 4, base=16, bitRange=7 +sfr = "MC_FMR.FWS", "Memory", 0xffffff60, 4, base=16, bitRange=8-9 +sfr = "MC_FMR.FMCN", "Memory", 0xffffff60, 4, base=16, bitRange=16-23 +sfr = "MC_FCR", "Memory", 0xffffff64, 4, base=16 +sfr = "MC_FCR.FCMD", "Memory", 0xffffff64, 4, base=16, bitRange=0-3 +sfr = "MC_FCR.PAGEN", "Memory", 0xffffff64, 4, base=16, bitRange=8-17 +sfr = "MC_FCR.KEY", "Memory", 0xffffff64, 4, base=16, bitRange=24-31 +sfr = "MC_FSR", "Memory", 0xffffff68, 4, base=16 +sfr = "MC_FSR.FRDY", "Memory", 0xffffff68, 4, base=16, bitRange=0 +sfr = "MC_FSR.LOCKE", "Memory", 0xffffff68, 4, base=16, bitRange=2 +sfr = "MC_FSR.PROGE", "Memory", 0xffffff68, 4, base=16, bitRange=3 +sfr = "MC_FSR.SECURITY", "Memory", 0xffffff68, 4, base=16, bitRange=4 +sfr = "MC_FSR.GPNVM0", "Memory", 0xffffff68, 4, base=16, bitRange=8 +sfr = "MC_FSR.GPNVM1", "Memory", 0xffffff68, 4, base=16, bitRange=9 +sfr = "MC_FSR.GPNVM2", "Memory", 0xffffff68, 4, base=16, bitRange=10 +sfr = "MC_FSR.GPNVM3", "Memory", 0xffffff68, 4, base=16, bitRange=11 +sfr = "MC_FSR.GPNVM4", "Memory", 0xffffff68, 4, base=16, bitRange=12 +sfr = "MC_FSR.GPNVM5", "Memory", 0xffffff68, 4, base=16, bitRange=13 +sfr = "MC_FSR.GPNVM6", "Memory", 0xffffff68, 4, base=16, bitRange=14 +sfr = "MC_FSR.GPNVM7", "Memory", 0xffffff68, 4, base=16, bitRange=15 +sfr = "MC_FSR.LOCKS0", "Memory", 0xffffff68, 4, base=16, bitRange=16 +sfr = "MC_FSR.LOCKS1", "Memory", 0xffffff68, 4, base=16, bitRange=17 +sfr = "MC_FSR.LOCKS2", "Memory", 0xffffff68, 4, base=16, bitRange=18 +sfr = "MC_FSR.LOCKS3", "Memory", 0xffffff68, 4, base=16, bitRange=19 +sfr = "MC_FSR.LOCKS4", "Memory", 0xffffff68, 4, base=16, bitRange=20 +sfr = "MC_FSR.LOCKS5", "Memory", 0xffffff68, 4, base=16, bitRange=21 +sfr = "MC_FSR.LOCKS6", "Memory", 0xffffff68, 4, base=16, bitRange=22 +sfr = "MC_FSR.LOCKS7", "Memory", 0xffffff68, 4, base=16, bitRange=23 +sfr = "MC_FSR.LOCKS8", "Memory", 0xffffff68, 4, base=16, bitRange=24 +sfr = "MC_FSR.LOCKS9", "Memory", 0xffffff68, 4, base=16, bitRange=25 +sfr = "MC_FSR.LOCKS10", "Memory", 0xffffff68, 4, base=16, bitRange=26 +sfr = "MC_FSR.LOCKS11", "Memory", 0xffffff68, 4, base=16, bitRange=27 +sfr = "MC_FSR.LOCKS12", "Memory", 0xffffff68, 4, base=16, bitRange=28 +sfr = "MC_FSR.LOCKS13", "Memory", 0xffffff68, 4, base=16, bitRange=29 +sfr = "MC_FSR.LOCKS14", "Memory", 0xffffff68, 4, base=16, bitRange=30 +sfr = "MC_FSR.LOCKS15", "Memory", 0xffffff68, 4, base=16, bitRange=31 +; ========== Register definition for PDC_SPI1 peripheral ========== +sfr = "SPI1_RPR", "Memory", 0xfffe4100, 4, base=16 +sfr = "SPI1_RCR", "Memory", 0xfffe4104, 4, base=16 +sfr = "SPI1_TPR", "Memory", 0xfffe4108, 4, base=16 +sfr = "SPI1_TCR", "Memory", 0xfffe410c, 4, base=16 +sfr = "SPI1_RNPR", "Memory", 0xfffe4110, 4, base=16 +sfr = "SPI1_RNCR", "Memory", 0xfffe4114, 4, base=16 +sfr = "SPI1_TNPR", "Memory", 0xfffe4118, 4, base=16 +sfr = "SPI1_TNCR", "Memory", 0xfffe411c, 4, base=16 +sfr = "SPI1_PTCR", "Memory", 0xfffe4120, 4, base=16 +sfr = "SPI1_PTCR.RXTEN", "Memory", 0xfffe4120, 4, base=16, bitRange=0 +sfr = "SPI1_PTCR.RXTDIS", "Memory", 0xfffe4120, 4, base=16, bitRange=1 +sfr = "SPI1_PTCR.TXTEN", "Memory", 0xfffe4120, 4, base=16, bitRange=8 +sfr = "SPI1_PTCR.TXTDIS", "Memory", 0xfffe4120, 4, base=16, bitRange=9 +sfr = "SPI1_PTSR", "Memory", 0xfffe4124, 4, base=16 +sfr = "SPI1_PTSR.RXTEN", "Memory", 0xfffe4124, 4, base=16, bitRange=0 +sfr = "SPI1_PTSR.TXTEN", "Memory", 0xfffe4124, 4, base=16, bitRange=8 +; ========== Register definition for SPI1 peripheral ========== +sfr = "SPI1_CR", "Memory", 0xfffe4000, 4, base=16 +sfr = "SPI1_CR.SPIEN", "Memory", 0xfffe4000, 4, base=16, bitRange=0 +sfr = "SPI1_CR.SPIDIS", "Memory", 0xfffe4000, 4, base=16, bitRange=1 +sfr = "SPI1_CR.SWRST", "Memory", 0xfffe4000, 4, base=16, bitRange=7 +sfr = "SPI1_CR.LASTXFER", "Memory", 0xfffe4000, 4, base=16, bitRange=24 +sfr = "SPI1_MR", "Memory", 0xfffe4004, 4, base=16 +sfr = "SPI1_MR.MSTR", "Memory", 0xfffe4004, 4, base=16, bitRange=0 +sfr = "SPI1_MR.PS", "Memory", 0xfffe4004, 4, base=16, bitRange=1 +sfr = "SPI1_MR.PCSDEC", "Memory", 0xfffe4004, 4, base=16, bitRange=2 +sfr = "SPI1_MR.FDIV", "Memory", 0xfffe4004, 4, base=16, bitRange=3 +sfr = "SPI1_MR.MODFDIS", "Memory", 0xfffe4004, 4, base=16, bitRange=4 +sfr = "SPI1_MR.LLB", "Memory", 0xfffe4004, 4, base=16, bitRange=7 +sfr = "SPI1_MR.PCS", "Memory", 0xfffe4004, 4, base=16, bitRange=16-19 +sfr = "SPI1_MR.DLYBCS", "Memory", 0xfffe4004, 4, base=16, bitRange=24-31 +sfr = "SPI1_RDR", "Memory", 0xfffe4008, 4, base=16 +sfr = "SPI1_RDR.RD", "Memory", 0xfffe4008, 4, base=16, bitRange=0-15 +sfr = "SPI1_RDR.RPCS", "Memory", 0xfffe4008, 4, base=16, bitRange=16-19 +sfr = "SPI1_TDR", "Memory", 0xfffe400c, 4, base=16 +sfr = "SPI1_TDR.TD", "Memory", 0xfffe400c, 4, base=16, bitRange=0-15 +sfr = "SPI1_TDR.TPCS", "Memory", 0xfffe400c, 4, base=16, bitRange=16-19 +sfr = "SPI1_TDR.LASTXFER", "Memory", 0xfffe400c, 4, base=16, bitRange=24 +sfr = "SPI1_SR", "Memory", 0xfffe4010, 4, base=16 +sfr = "SPI1_SR.RDRF", "Memory", 0xfffe4010, 4, base=16, bitRange=0 +sfr = "SPI1_SR.TDRE", "Memory", 0xfffe4010, 4, base=16, bitRange=1 +sfr = "SPI1_SR.MODF", "Memory", 0xfffe4010, 4, base=16, bitRange=2 +sfr = "SPI1_SR.OVRES", "Memory", 0xfffe4010, 4, base=16, bitRange=3 +sfr = "SPI1_SR.ENDRX", "Memory", 0xfffe4010, 4, base=16, bitRange=4 +sfr = "SPI1_SR.ENDTX", "Memory", 0xfffe4010, 4, base=16, bitRange=5 +sfr = "SPI1_SR.RXBUFF", "Memory", 0xfffe4010, 4, base=16, bitRange=6 +sfr = "SPI1_SR.TXBUFE", "Memory", 0xfffe4010, 4, base=16, bitRange=7 +sfr = "SPI1_SR.NSSR", "Memory", 0xfffe4010, 4, base=16, bitRange=8 +sfr = "SPI1_SR.TXEMPTY", "Memory", 0xfffe4010, 4, base=16, bitRange=9 +sfr = "SPI1_SR.SPIENS", "Memory", 0xfffe4010, 4, base=16, bitRange=16 +sfr = "SPI1_IER", "Memory", 0xfffe4014, 4, base=16 +sfr = "SPI1_IER.RDRF", "Memory", 0xfffe4014, 4, base=16, bitRange=0 +sfr = "SPI1_IER.TDRE", "Memory", 0xfffe4014, 4, base=16, bitRange=1 +sfr = "SPI1_IER.MODF", "Memory", 0xfffe4014, 4, base=16, bitRange=2 +sfr = "SPI1_IER.OVRES", "Memory", 0xfffe4014, 4, base=16, bitRange=3 +sfr = "SPI1_IER.ENDRX", "Memory", 0xfffe4014, 4, base=16, bitRange=4 +sfr = "SPI1_IER.ENDTX", "Memory", 0xfffe4014, 4, base=16, bitRange=5 +sfr = "SPI1_IER.RXBUFF", "Memory", 0xfffe4014, 4, base=16, bitRange=6 +sfr = "SPI1_IER.TXBUFE", "Memory", 0xfffe4014, 4, base=16, bitRange=7 +sfr = "SPI1_IER.NSSR", "Memory", 0xfffe4014, 4, base=16, bitRange=8 +sfr = "SPI1_IER.TXEMPTY", "Memory", 0xfffe4014, 4, base=16, bitRange=9 +sfr = "SPI1_IDR", "Memory", 0xfffe4018, 4, base=16 +sfr = "SPI1_IDR.RDRF", "Memory", 0xfffe4018, 4, base=16, bitRange=0 +sfr = "SPI1_IDR.TDRE", "Memory", 0xfffe4018, 4, base=16, bitRange=1 +sfr = "SPI1_IDR.MODF", "Memory", 0xfffe4018, 4, base=16, bitRange=2 +sfr = "SPI1_IDR.OVRES", "Memory", 0xfffe4018, 4, base=16, bitRange=3 +sfr = "SPI1_IDR.ENDRX", "Memory", 0xfffe4018, 4, base=16, bitRange=4 +sfr = "SPI1_IDR.ENDTX", "Memory", 0xfffe4018, 4, base=16, bitRange=5 +sfr = "SPI1_IDR.RXBUFF", "Memory", 0xfffe4018, 4, base=16, bitRange=6 +sfr = "SPI1_IDR.TXBUFE", "Memory", 0xfffe4018, 4, base=16, bitRange=7 +sfr = "SPI1_IDR.NSSR", "Memory", 0xfffe4018, 4, base=16, bitRange=8 +sfr = "SPI1_IDR.TXEMPTY", "Memory", 0xfffe4018, 4, base=16, bitRange=9 +sfr = "SPI1_IMR", "Memory", 0xfffe401c, 4, base=16 +sfr = "SPI1_IMR.RDRF", "Memory", 0xfffe401c, 4, base=16, bitRange=0 +sfr = "SPI1_IMR.TDRE", "Memory", 0xfffe401c, 4, base=16, bitRange=1 +sfr = "SPI1_IMR.MODF", "Memory", 0xfffe401c, 4, base=16, bitRange=2 +sfr = "SPI1_IMR.OVRES", "Memory", 0xfffe401c, 4, base=16, bitRange=3 +sfr = "SPI1_IMR.ENDRX", "Memory", 0xfffe401c, 4, base=16, bitRange=4 +sfr = "SPI1_IMR.ENDTX", "Memory", 0xfffe401c, 4, base=16, bitRange=5 +sfr = "SPI1_IMR.RXBUFF", "Memory", 0xfffe401c, 4, base=16, bitRange=6 +sfr = "SPI1_IMR.TXBUFE", "Memory", 0xfffe401c, 4, base=16, bitRange=7 +sfr = "SPI1_IMR.NSSR", "Memory", 0xfffe401c, 4, base=16, bitRange=8 +sfr = "SPI1_IMR.TXEMPTY", "Memory", 0xfffe401c, 4, base=16, bitRange=9 +sfr = "SPI1_CSR", "Memory", 0xfffe4030, 4, base=16 +sfr = "SPI1_CSR.CPOL", "Memory", 0xfffe4030, 4, base=16, bitRange=0 +sfr = "SPI1_CSR.NCPHA", "Memory", 0xfffe4030, 4, base=16, bitRange=1 +sfr = "SPI1_CSR.CSAAT", "Memory", 0xfffe4030, 4, base=16, bitRange=3 +sfr = "SPI1_CSR.BITS", "Memory", 0xfffe4030, 4, base=16, bitRange=4-7 +sfr = "SPI1_CSR.SCBR", "Memory", 0xfffe4030, 4, base=16, bitRange=8-15 +sfr = "SPI1_CSR.DLYBS", "Memory", 0xfffe4030, 4, base=16, bitRange=16-23 +sfr = "SPI1_CSR.DLYBCT", "Memory", 0xfffe4030, 4, base=16, bitRange=24-31 +; ========== Register definition for PDC_SPI0 peripheral ========== +sfr = "SPI0_RPR", "Memory", 0xfffe0100, 4, base=16 +sfr = "SPI0_RCR", "Memory", 0xfffe0104, 4, base=16 +sfr = "SPI0_TPR", "Memory", 0xfffe0108, 4, base=16 +sfr = "SPI0_TCR", "Memory", 0xfffe010c, 4, base=16 +sfr = "SPI0_RNPR", "Memory", 0xfffe0110, 4, base=16 +sfr = "SPI0_RNCR", "Memory", 0xfffe0114, 4, base=16 +sfr = "SPI0_TNPR", "Memory", 0xfffe0118, 4, base=16 +sfr = "SPI0_TNCR", "Memory", 0xfffe011c, 4, base=16 +sfr = "SPI0_PTCR", "Memory", 0xfffe0120, 4, base=16 +sfr = "SPI0_PTCR.RXTEN", "Memory", 0xfffe0120, 4, base=16, bitRange=0 +sfr = "SPI0_PTCR.RXTDIS", "Memory", 0xfffe0120, 4, base=16, bitRange=1 +sfr = "SPI0_PTCR.TXTEN", "Memory", 0xfffe0120, 4, base=16, bitRange=8 +sfr = "SPI0_PTCR.TXTDIS", "Memory", 0xfffe0120, 4, base=16, bitRange=9 +sfr = "SPI0_PTSR", "Memory", 0xfffe0124, 4, base=16 +sfr = "SPI0_PTSR.RXTEN", "Memory", 0xfffe0124, 4, base=16, bitRange=0 +sfr = "SPI0_PTSR.TXTEN", "Memory", 0xfffe0124, 4, base=16, bitRange=8 +; ========== Register definition for SPI0 peripheral ========== +sfr = "SPI0_CR", "Memory", 0xfffe0000, 4, base=16 +sfr = "SPI0_CR.SPIEN", "Memory", 0xfffe0000, 4, base=16, bitRange=0 +sfr = "SPI0_CR.SPIDIS", "Memory", 0xfffe0000, 4, base=16, bitRange=1 +sfr = "SPI0_CR.SWRST", "Memory", 0xfffe0000, 4, base=16, bitRange=7 +sfr = "SPI0_CR.LASTXFER", "Memory", 0xfffe0000, 4, base=16, bitRange=24 +sfr = "SPI0_MR", "Memory", 0xfffe0004, 4, base=16 +sfr = "SPI0_MR.MSTR", "Memory", 0xfffe0004, 4, base=16, bitRange=0 +sfr = "SPI0_MR.PS", "Memory", 0xfffe0004, 4, base=16, bitRange=1 +sfr = "SPI0_MR.PCSDEC", "Memory", 0xfffe0004, 4, base=16, bitRange=2 +sfr = "SPI0_MR.FDIV", "Memory", 0xfffe0004, 4, base=16, bitRange=3 +sfr = "SPI0_MR.MODFDIS", "Memory", 0xfffe0004, 4, base=16, bitRange=4 +sfr = "SPI0_MR.LLB", "Memory", 0xfffe0004, 4, base=16, bitRange=7 +sfr = "SPI0_MR.PCS", "Memory", 0xfffe0004, 4, base=16, bitRange=16-19 +sfr = "SPI0_MR.DLYBCS", "Memory", 0xfffe0004, 4, base=16, bitRange=24-31 +sfr = "SPI0_RDR", "Memory", 0xfffe0008, 4, base=16 +sfr = "SPI0_RDR.RD", "Memory", 0xfffe0008, 4, base=16, bitRange=0-15 +sfr = "SPI0_RDR.RPCS", "Memory", 0xfffe0008, 4, base=16, bitRange=16-19 +sfr = "SPI0_TDR", "Memory", 0xfffe000c, 4, base=16 +sfr = "SPI0_TDR.TD", "Memory", 0xfffe000c, 4, base=16, bitRange=0-15 +sfr = "SPI0_TDR.TPCS", "Memory", 0xfffe000c, 4, base=16, bitRange=16-19 +sfr = "SPI0_TDR.LASTXFER", "Memory", 0xfffe000c, 4, base=16, bitRange=24 +sfr = "SPI0_SR", "Memory", 0xfffe0010, 4, base=16 +sfr = "SPI0_SR.RDRF", "Memory", 0xfffe0010, 4, base=16, bitRange=0 +sfr = "SPI0_SR.TDRE", "Memory", 0xfffe0010, 4, base=16, bitRange=1 +sfr = "SPI0_SR.MODF", "Memory", 0xfffe0010, 4, base=16, bitRange=2 +sfr = "SPI0_SR.OVRES", "Memory", 0xfffe0010, 4, base=16, bitRange=3 +sfr = "SPI0_SR.ENDRX", "Memory", 0xfffe0010, 4, base=16, bitRange=4 +sfr = "SPI0_SR.ENDTX", "Memory", 0xfffe0010, 4, base=16, bitRange=5 +sfr = "SPI0_SR.RXBUFF", "Memory", 0xfffe0010, 4, base=16, bitRange=6 +sfr = "SPI0_SR.TXBUFE", "Memory", 0xfffe0010, 4, base=16, bitRange=7 +sfr = "SPI0_SR.NSSR", "Memory", 0xfffe0010, 4, base=16, bitRange=8 +sfr = "SPI0_SR.TXEMPTY", "Memory", 0xfffe0010, 4, base=16, bitRange=9 +sfr = "SPI0_SR.SPIENS", "Memory", 0xfffe0010, 4, base=16, bitRange=16 +sfr = "SPI0_IER", "Memory", 0xfffe0014, 4, base=16 +sfr = "SPI0_IER.RDRF", "Memory", 0xfffe0014, 4, base=16, bitRange=0 +sfr = "SPI0_IER.TDRE", "Memory", 0xfffe0014, 4, base=16, bitRange=1 +sfr = "SPI0_IER.MODF", "Memory", 0xfffe0014, 4, base=16, bitRange=2 +sfr = "SPI0_IER.OVRES", "Memory", 0xfffe0014, 4, base=16, bitRange=3 +sfr = "SPI0_IER.ENDRX", "Memory", 0xfffe0014, 4, base=16, bitRange=4 +sfr = "SPI0_IER.ENDTX", "Memory", 0xfffe0014, 4, base=16, bitRange=5 +sfr = "SPI0_IER.RXBUFF", "Memory", 0xfffe0014, 4, base=16, bitRange=6 +sfr = "SPI0_IER.TXBUFE", "Memory", 0xfffe0014, 4, base=16, bitRange=7 +sfr = "SPI0_IER.NSSR", "Memory", 0xfffe0014, 4, base=16, bitRange=8 +sfr = "SPI0_IER.TXEMPTY", "Memory", 0xfffe0014, 4, base=16, bitRange=9 +sfr = "SPI0_IDR", "Memory", 0xfffe0018, 4, base=16 +sfr = "SPI0_IDR.RDRF", "Memory", 0xfffe0018, 4, base=16, bitRange=0 +sfr = "SPI0_IDR.TDRE", "Memory", 0xfffe0018, 4, base=16, bitRange=1 +sfr = "SPI0_IDR.MODF", "Memory", 0xfffe0018, 4, base=16, bitRange=2 +sfr = "SPI0_IDR.OVRES", "Memory", 0xfffe0018, 4, base=16, bitRange=3 +sfr = "SPI0_IDR.ENDRX", "Memory", 0xfffe0018, 4, base=16, bitRange=4 +sfr = "SPI0_IDR.ENDTX", "Memory", 0xfffe0018, 4, base=16, bitRange=5 +sfr = "SPI0_IDR.RXBUFF", "Memory", 0xfffe0018, 4, base=16, bitRange=6 +sfr = "SPI0_IDR.TXBUFE", "Memory", 0xfffe0018, 4, base=16, bitRange=7 +sfr = "SPI0_IDR.NSSR", "Memory", 0xfffe0018, 4, base=16, bitRange=8 +sfr = "SPI0_IDR.TXEMPTY", "Memory", 0xfffe0018, 4, base=16, bitRange=9 +sfr = "SPI0_IMR", "Memory", 0xfffe001c, 4, base=16 +sfr = "SPI0_IMR.RDRF", "Memory", 0xfffe001c, 4, base=16, bitRange=0 +sfr = "SPI0_IMR.TDRE", "Memory", 0xfffe001c, 4, base=16, bitRange=1 +sfr = "SPI0_IMR.MODF", "Memory", 0xfffe001c, 4, base=16, bitRange=2 +sfr = "SPI0_IMR.OVRES", "Memory", 0xfffe001c, 4, base=16, bitRange=3 +sfr = "SPI0_IMR.ENDRX", "Memory", 0xfffe001c, 4, base=16, bitRange=4 +sfr = "SPI0_IMR.ENDTX", "Memory", 0xfffe001c, 4, base=16, bitRange=5 +sfr = "SPI0_IMR.RXBUFF", "Memory", 0xfffe001c, 4, base=16, bitRange=6 +sfr = "SPI0_IMR.TXBUFE", "Memory", 0xfffe001c, 4, base=16, bitRange=7 +sfr = "SPI0_IMR.NSSR", "Memory", 0xfffe001c, 4, base=16, bitRange=8 +sfr = "SPI0_IMR.TXEMPTY", "Memory", 0xfffe001c, 4, base=16, bitRange=9 +sfr = "SPI0_CSR", "Memory", 0xfffe0030, 4, base=16 +sfr = "SPI0_CSR.CPOL", "Memory", 0xfffe0030, 4, base=16, bitRange=0 +sfr = "SPI0_CSR.NCPHA", "Memory", 0xfffe0030, 4, base=16, bitRange=1 +sfr = "SPI0_CSR.CSAAT", "Memory", 0xfffe0030, 4, base=16, bitRange=3 +sfr = "SPI0_CSR.BITS", "Memory", 0xfffe0030, 4, base=16, bitRange=4-7 +sfr = "SPI0_CSR.SCBR", "Memory", 0xfffe0030, 4, base=16, bitRange=8-15 +sfr = "SPI0_CSR.DLYBS", "Memory", 0xfffe0030, 4, base=16, bitRange=16-23 +sfr = "SPI0_CSR.DLYBCT", "Memory", 0xfffe0030, 4, base=16, bitRange=24-31 +; ========== Register definition for PDC_US1 peripheral ========== +sfr = "US1_RPR", "Memory", 0xfffc4100, 4, base=16 +sfr = "US1_RCR", "Memory", 0xfffc4104, 4, base=16 +sfr = "US1_TPR", "Memory", 0xfffc4108, 4, base=16 +sfr = "US1_TCR", "Memory", 0xfffc410c, 4, base=16 +sfr = "US1_RNPR", "Memory", 0xfffc4110, 4, base=16 +sfr = "US1_RNCR", "Memory", 0xfffc4114, 4, base=16 +sfr = "US1_TNPR", "Memory", 0xfffc4118, 4, base=16 +sfr = "US1_TNCR", "Memory", 0xfffc411c, 4, base=16 +sfr = "US1_PTCR", "Memory", 0xfffc4120, 4, base=16 +sfr = "US1_PTCR.RXTEN", "Memory", 0xfffc4120, 4, base=16, bitRange=0 +sfr = "US1_PTCR.RXTDIS", "Memory", 0xfffc4120, 4, base=16, bitRange=1 +sfr = "US1_PTCR.TXTEN", "Memory", 0xfffc4120, 4, base=16, bitRange=8 +sfr = "US1_PTCR.TXTDIS", "Memory", 0xfffc4120, 4, base=16, bitRange=9 +sfr = "US1_PTSR", "Memory", 0xfffc4124, 4, base=16 +sfr = "US1_PTSR.RXTEN", "Memory", 0xfffc4124, 4, base=16, bitRange=0 +sfr = "US1_PTSR.TXTEN", "Memory", 0xfffc4124, 4, base=16, bitRange=8 +; ========== Register definition for US1 peripheral ========== +sfr = "US1_CR", "Memory", 0xfffc4000, 4, base=16 +sfr = "US1_CR.RSTRX", "Memory", 0xfffc4000, 4, base=16, bitRange=2 +sfr = "US1_CR.RSTTX", "Memory", 0xfffc4000, 4, base=16, bitRange=3 +sfr = "US1_CR.RXEN", "Memory", 0xfffc4000, 4, base=16, bitRange=4 +sfr = "US1_CR.RXDIS", "Memory", 0xfffc4000, 4, base=16, bitRange=5 +sfr = "US1_CR.TXEN", "Memory", 0xfffc4000, 4, base=16, bitRange=6 +sfr = "US1_CR.TXDIS", "Memory", 0xfffc4000, 4, base=16, bitRange=7 +sfr = "US1_CR.RSTSTA", "Memory", 0xfffc4000, 4, base=16, bitRange=8 +sfr = "US1_CR.STTBRK", "Memory", 0xfffc4000, 4, base=16, bitRange=9 +sfr = "US1_CR.STPBRK", "Memory", 0xfffc4000, 4, base=16, bitRange=10 +sfr = "US1_CR.STTTO", "Memory", 0xfffc4000, 4, base=16, bitRange=11 +sfr = "US1_CR.SENDA", "Memory", 0xfffc4000, 4, base=16, bitRange=12 +sfr = "US1_CR.RSTIT", "Memory", 0xfffc4000, 4, base=16, bitRange=13 +sfr = "US1_CR.RSTNACK", "Memory", 0xfffc4000, 4, base=16, bitRange=14 +sfr = "US1_CR.RETTO", "Memory", 0xfffc4000, 4, base=16, bitRange=15 +sfr = "US1_CR.DTREN", "Memory", 0xfffc4000, 4, base=16, bitRange=16 +sfr = "US1_CR.DTRDIS", "Memory", 0xfffc4000, 4, base=16, bitRange=17 +sfr = "US1_CR.RTSEN", "Memory", 0xfffc4000, 4, base=16, bitRange=18 +sfr = "US1_CR.RTSDIS", "Memory", 0xfffc4000, 4, base=16, bitRange=19 +sfr = "US1_MR", "Memory", 0xfffc4004, 4, base=16 +sfr = "US1_MR.USMODE", "Memory", 0xfffc4004, 4, base=16, bitRange=0-3 +sfr = "US1_MR.CLKS", "Memory", 0xfffc4004, 4, base=16, bitRange=4-5 +sfr = "US1_MR.CHRL", "Memory", 0xfffc4004, 4, base=16, bitRange=6-7 +sfr = "US1_MR.SYNC", "Memory", 0xfffc4004, 4, base=16, bitRange=8 +sfr = "US1_MR.PAR", "Memory", 0xfffc4004, 4, base=16, bitRange=9-11 +sfr = "US1_MR.NBSTOP", "Memory", 0xfffc4004, 4, base=16, bitRange=12-13 +sfr = "US1_MR.CHMODE", "Memory", 0xfffc4004, 4, base=16, bitRange=14-15 +sfr = "US1_MR.MSBF", "Memory", 0xfffc4004, 4, base=16, bitRange=16 +sfr = "US1_MR.MODE9", "Memory", 0xfffc4004, 4, base=16, bitRange=17 +sfr = "US1_MR.CKLO", "Memory", 0xfffc4004, 4, base=16, bitRange=18 +sfr = "US1_MR.OVER", "Memory", 0xfffc4004, 4, base=16, bitRange=19 +sfr = "US1_MR.INACK", "Memory", 0xfffc4004, 4, base=16, bitRange=20 +sfr = "US1_MR.DSNACK", "Memory", 0xfffc4004, 4, base=16, bitRange=21 +sfr = "US1_MR.ITER", "Memory", 0xfffc4004, 4, base=16, bitRange=24 +sfr = "US1_MR.FILTER", "Memory", 0xfffc4004, 4, base=16, bitRange=28 +sfr = "US1_IER", "Memory", 0xfffc4008, 4, base=16 +sfr = "US1_IER.RXRDY", "Memory", 0xfffc4008, 4, base=16, bitRange=0 +sfr = "US1_IER.TXRDY", "Memory", 0xfffc4008, 4, base=16, bitRange=1 +sfr = "US1_IER.RXBRK", "Memory", 0xfffc4008, 4, base=16, bitRange=2 +sfr = "US1_IER.ENDRX", "Memory", 0xfffc4008, 4, base=16, bitRange=3 +sfr = "US1_IER.ENDTX", "Memory", 0xfffc4008, 4, base=16, bitRange=4 +sfr = "US1_IER.OVRE", "Memory", 0xfffc4008, 4, base=16, bitRange=5 +sfr = "US1_IER.FRAME", "Memory", 0xfffc4008, 4, base=16, bitRange=6 +sfr = "US1_IER.PARE", "Memory", 0xfffc4008, 4, base=16, bitRange=7 +sfr = "US1_IER.TIMEOUT", "Memory", 0xfffc4008, 4, base=16, bitRange=8 +sfr = "US1_IER.TXEMPTY", "Memory", 0xfffc4008, 4, base=16, bitRange=9 +sfr = "US1_IER.ITERATION", "Memory", 0xfffc4008, 4, base=16, bitRange=10 +sfr = "US1_IER.TXBUFE", "Memory", 0xfffc4008, 4, base=16, bitRange=11 +sfr = "US1_IER.RXBUFF", "Memory", 0xfffc4008, 4, base=16, bitRange=12 +sfr = "US1_IER.NACK", "Memory", 0xfffc4008, 4, base=16, bitRange=13 +sfr = "US1_IER.RIIC", "Memory", 0xfffc4008, 4, base=16, bitRange=16 +sfr = "US1_IER.DSRIC", "Memory", 0xfffc4008, 4, base=16, bitRange=17 +sfr = "US1_IER.DCDIC", "Memory", 0xfffc4008, 4, base=16, bitRange=18 +sfr = "US1_IER.CTSIC", "Memory", 0xfffc4008, 4, base=16, bitRange=19 +sfr = "US1_IDR", "Memory", 0xfffc400c, 4, base=16 +sfr = "US1_IDR.RXRDY", "Memory", 0xfffc400c, 4, base=16, bitRange=0 +sfr = "US1_IDR.TXRDY", "Memory", 0xfffc400c, 4, base=16, bitRange=1 +sfr = "US1_IDR.RXBRK", "Memory", 0xfffc400c, 4, base=16, bitRange=2 +sfr = "US1_IDR.ENDRX", "Memory", 0xfffc400c, 4, base=16, bitRange=3 +sfr = "US1_IDR.ENDTX", "Memory", 0xfffc400c, 4, base=16, bitRange=4 +sfr = "US1_IDR.OVRE", "Memory", 0xfffc400c, 4, base=16, bitRange=5 +sfr = "US1_IDR.FRAME", "Memory", 0xfffc400c, 4, base=16, bitRange=6 +sfr = "US1_IDR.PARE", "Memory", 0xfffc400c, 4, base=16, bitRange=7 +sfr = "US1_IDR.TIMEOUT", "Memory", 0xfffc400c, 4, base=16, bitRange=8 +sfr = "US1_IDR.TXEMPTY", "Memory", 0xfffc400c, 4, base=16, bitRange=9 +sfr = "US1_IDR.ITERATION", "Memory", 0xfffc400c, 4, base=16, bitRange=10 +sfr = "US1_IDR.TXBUFE", "Memory", 0xfffc400c, 4, base=16, bitRange=11 +sfr = "US1_IDR.RXBUFF", "Memory", 0xfffc400c, 4, base=16, bitRange=12 +sfr = "US1_IDR.NACK", "Memory", 0xfffc400c, 4, base=16, bitRange=13 +sfr = "US1_IDR.RIIC", "Memory", 0xfffc400c, 4, base=16, bitRange=16 +sfr = "US1_IDR.DSRIC", "Memory", 0xfffc400c, 4, base=16, bitRange=17 +sfr = "US1_IDR.DCDIC", "Memory", 0xfffc400c, 4, base=16, bitRange=18 +sfr = "US1_IDR.CTSIC", "Memory", 0xfffc400c, 4, base=16, bitRange=19 +sfr = "US1_IMR", "Memory", 0xfffc4010, 4, base=16 +sfr = "US1_IMR.RXRDY", "Memory", 0xfffc4010, 4, base=16, bitRange=0 +sfr = "US1_IMR.TXRDY", "Memory", 0xfffc4010, 4, base=16, bitRange=1 +sfr = "US1_IMR.RXBRK", "Memory", 0xfffc4010, 4, base=16, bitRange=2 +sfr = "US1_IMR.ENDRX", "Memory", 0xfffc4010, 4, base=16, bitRange=3 +sfr = "US1_IMR.ENDTX", "Memory", 0xfffc4010, 4, base=16, bitRange=4 +sfr = "US1_IMR.OVRE", "Memory", 0xfffc4010, 4, base=16, bitRange=5 +sfr = "US1_IMR.FRAME", "Memory", 0xfffc4010, 4, base=16, bitRange=6 +sfr = "US1_IMR.PARE", "Memory", 0xfffc4010, 4, base=16, bitRange=7 +sfr = "US1_IMR.TIMEOUT", "Memory", 0xfffc4010, 4, base=16, bitRange=8 +sfr = "US1_IMR.TXEMPTY", "Memory", 0xfffc4010, 4, base=16, bitRange=9 +sfr = "US1_IMR.ITERATION", "Memory", 0xfffc4010, 4, base=16, bitRange=10 +sfr = "US1_IMR.TXBUFE", "Memory", 0xfffc4010, 4, base=16, bitRange=11 +sfr = "US1_IMR.RXBUFF", "Memory", 0xfffc4010, 4, base=16, bitRange=12 +sfr = "US1_IMR.NACK", "Memory", 0xfffc4010, 4, base=16, bitRange=13 +sfr = "US1_IMR.RIIC", "Memory", 0xfffc4010, 4, base=16, bitRange=16 +sfr = "US1_IMR.DSRIC", "Memory", 0xfffc4010, 4, base=16, bitRange=17 +sfr = "US1_IMR.DCDIC", "Memory", 0xfffc4010, 4, base=16, bitRange=18 +sfr = "US1_IMR.CTSIC", "Memory", 0xfffc4010, 4, base=16, bitRange=19 +sfr = "US1_CSR", "Memory", 0xfffc4014, 4, base=16 +sfr = "US1_CSR.RXRDY", "Memory", 0xfffc4014, 4, base=16, bitRange=0 +sfr = "US1_CSR.TXRDY", "Memory", 0xfffc4014, 4, base=16, bitRange=1 +sfr = "US1_CSR.RXBRK", "Memory", 0xfffc4014, 4, base=16, bitRange=2 +sfr = "US1_CSR.ENDRX", "Memory", 0xfffc4014, 4, base=16, bitRange=3 +sfr = "US1_CSR.ENDTX", "Memory", 0xfffc4014, 4, base=16, bitRange=4 +sfr = "US1_CSR.OVRE", "Memory", 0xfffc4014, 4, base=16, bitRange=5 +sfr = "US1_CSR.FRAME", "Memory", 0xfffc4014, 4, base=16, bitRange=6 +sfr = "US1_CSR.PARE", "Memory", 0xfffc4014, 4, base=16, bitRange=7 +sfr = "US1_CSR.TIMEOUT", "Memory", 0xfffc4014, 4, base=16, bitRange=8 +sfr = "US1_CSR.TXEMPTY", "Memory", 0xfffc4014, 4, base=16, bitRange=9 +sfr = "US1_CSR.ITERATION", "Memory", 0xfffc4014, 4, base=16, bitRange=10 +sfr = "US1_CSR.TXBUFE", "Memory", 0xfffc4014, 4, base=16, bitRange=11 +sfr = "US1_CSR.RXBUFF", "Memory", 0xfffc4014, 4, base=16, bitRange=12 +sfr = "US1_CSR.NACK", "Memory", 0xfffc4014, 4, base=16, bitRange=13 +sfr = "US1_CSR.RIIC", "Memory", 0xfffc4014, 4, base=16, bitRange=16 +sfr = "US1_CSR.DSRIC", "Memory", 0xfffc4014, 4, base=16, bitRange=17 +sfr = "US1_CSR.DCDIC", "Memory", 0xfffc4014, 4, base=16, bitRange=18 +sfr = "US1_CSR.CTSIC", "Memory", 0xfffc4014, 4, base=16, bitRange=19 +sfr = "US1_CSR.RI", "Memory", 0xfffc4014, 4, base=16, bitRange=20 +sfr = "US1_CSR.DSR", "Memory", 0xfffc4014, 4, base=16, bitRange=21 +sfr = "US1_CSR.DCD", "Memory", 0xfffc4014, 4, base=16, bitRange=22 +sfr = "US1_CSR.CTS", "Memory", 0xfffc4014, 4, base=16, bitRange=23 +sfr = "US1_RHR", "Memory", 0xfffc4018, 4, base=16 +sfr = "US1_THR", "Memory", 0xfffc401c, 4, base=16 +sfr = "US1_BRGR", "Memory", 0xfffc4020, 4, base=16 +sfr = "US1_RTOR", "Memory", 0xfffc4024, 4, base=16 +sfr = "US1_TTGR", "Memory", 0xfffc4028, 4, base=16 +sfr = "US1_FIDI", "Memory", 0xfffc4040, 4, base=16 +sfr = "US1_NER", "Memory", 0xfffc4044, 4, base=16 +sfr = "US1_IF", "Memory", 0xfffc404c, 4, base=16 +; ========== Register definition for PDC_US0 peripheral ========== +sfr = "US0_RPR", "Memory", 0xfffc0100, 4, base=16 +sfr = "US0_RCR", "Memory", 0xfffc0104, 4, base=16 +sfr = "US0_TPR", "Memory", 0xfffc0108, 4, base=16 +sfr = "US0_TCR", "Memory", 0xfffc010c, 4, base=16 +sfr = "US0_RNPR", "Memory", 0xfffc0110, 4, base=16 +sfr = "US0_RNCR", "Memory", 0xfffc0114, 4, base=16 +sfr = "US0_TNPR", "Memory", 0xfffc0118, 4, base=16 +sfr = "US0_TNCR", "Memory", 0xfffc011c, 4, base=16 +sfr = "US0_PTCR", "Memory", 0xfffc0120, 4, base=16 +sfr = "US0_PTCR.RXTEN", "Memory", 0xfffc0120, 4, base=16, bitRange=0 +sfr = "US0_PTCR.RXTDIS", "Memory", 0xfffc0120, 4, base=16, bitRange=1 +sfr = "US0_PTCR.TXTEN", "Memory", 0xfffc0120, 4, base=16, bitRange=8 +sfr = "US0_PTCR.TXTDIS", "Memory", 0xfffc0120, 4, base=16, bitRange=9 +sfr = "US0_PTSR", "Memory", 0xfffc0124, 4, base=16 +sfr = "US0_PTSR.RXTEN", "Memory", 0xfffc0124, 4, base=16, bitRange=0 +sfr = "US0_PTSR.TXTEN", "Memory", 0xfffc0124, 4, base=16, bitRange=8 +; ========== Register definition for US0 peripheral ========== +sfr = "US0_CR", "Memory", 0xfffc0000, 4, base=16 +sfr = "US0_CR.RSTRX", "Memory", 0xfffc0000, 4, base=16, bitRange=2 +sfr = "US0_CR.RSTTX", "Memory", 0xfffc0000, 4, base=16, bitRange=3 +sfr = "US0_CR.RXEN", "Memory", 0xfffc0000, 4, base=16, bitRange=4 +sfr = "US0_CR.RXDIS", "Memory", 0xfffc0000, 4, base=16, bitRange=5 +sfr = "US0_CR.TXEN", "Memory", 0xfffc0000, 4, base=16, bitRange=6 +sfr = "US0_CR.TXDIS", "Memory", 0xfffc0000, 4, base=16, bitRange=7 +sfr = "US0_CR.RSTSTA", "Memory", 0xfffc0000, 4, base=16, bitRange=8 +sfr = "US0_CR.STTBRK", "Memory", 0xfffc0000, 4, base=16, bitRange=9 +sfr = "US0_CR.STPBRK", "Memory", 0xfffc0000, 4, base=16, bitRange=10 +sfr = "US0_CR.STTTO", "Memory", 0xfffc0000, 4, base=16, bitRange=11 +sfr = "US0_CR.SENDA", "Memory", 0xfffc0000, 4, base=16, bitRange=12 +sfr = "US0_CR.RSTIT", "Memory", 0xfffc0000, 4, base=16, bitRange=13 +sfr = "US0_CR.RSTNACK", "Memory", 0xfffc0000, 4, base=16, bitRange=14 +sfr = "US0_CR.RETTO", "Memory", 0xfffc0000, 4, base=16, bitRange=15 +sfr = "US0_CR.DTREN", "Memory", 0xfffc0000, 4, base=16, bitRange=16 +sfr = "US0_CR.DTRDIS", "Memory", 0xfffc0000, 4, base=16, bitRange=17 +sfr = "US0_CR.RTSEN", "Memory", 0xfffc0000, 4, base=16, bitRange=18 +sfr = "US0_CR.RTSDIS", "Memory", 0xfffc0000, 4, base=16, bitRange=19 +sfr = "US0_MR", "Memory", 0xfffc0004, 4, base=16 +sfr = "US0_MR.USMODE", "Memory", 0xfffc0004, 4, base=16, bitRange=0-3 +sfr = "US0_MR.CLKS", "Memory", 0xfffc0004, 4, base=16, bitRange=4-5 +sfr = "US0_MR.CHRL", "Memory", 0xfffc0004, 4, base=16, bitRange=6-7 +sfr = "US0_MR.SYNC", "Memory", 0xfffc0004, 4, base=16, bitRange=8 +sfr = "US0_MR.PAR", "Memory", 0xfffc0004, 4, base=16, bitRange=9-11 +sfr = "US0_MR.NBSTOP", "Memory", 0xfffc0004, 4, base=16, bitRange=12-13 +sfr = "US0_MR.CHMODE", "Memory", 0xfffc0004, 4, base=16, bitRange=14-15 +sfr = "US0_MR.MSBF", "Memory", 0xfffc0004, 4, base=16, bitRange=16 +sfr = "US0_MR.MODE9", "Memory", 0xfffc0004, 4, base=16, bitRange=17 +sfr = "US0_MR.CKLO", "Memory", 0xfffc0004, 4, base=16, bitRange=18 +sfr = "US0_MR.OVER", "Memory", 0xfffc0004, 4, base=16, bitRange=19 +sfr = "US0_MR.INACK", "Memory", 0xfffc0004, 4, base=16, bitRange=20 +sfr = "US0_MR.DSNACK", "Memory", 0xfffc0004, 4, base=16, bitRange=21 +sfr = "US0_MR.ITER", "Memory", 0xfffc0004, 4, base=16, bitRange=24 +sfr = "US0_MR.FILTER", "Memory", 0xfffc0004, 4, base=16, bitRange=28 +sfr = "US0_IER", "Memory", 0xfffc0008, 4, base=16 +sfr = "US0_IER.RXRDY", "Memory", 0xfffc0008, 4, base=16, bitRange=0 +sfr = "US0_IER.TXRDY", "Memory", 0xfffc0008, 4, base=16, bitRange=1 +sfr = "US0_IER.RXBRK", "Memory", 0xfffc0008, 4, base=16, bitRange=2 +sfr = "US0_IER.ENDRX", "Memory", 0xfffc0008, 4, base=16, bitRange=3 +sfr = "US0_IER.ENDTX", "Memory", 0xfffc0008, 4, base=16, bitRange=4 +sfr = "US0_IER.OVRE", "Memory", 0xfffc0008, 4, base=16, bitRange=5 +sfr = "US0_IER.FRAME", "Memory", 0xfffc0008, 4, base=16, bitRange=6 +sfr = "US0_IER.PARE", "Memory", 0xfffc0008, 4, base=16, bitRange=7 +sfr = "US0_IER.TIMEOUT", "Memory", 0xfffc0008, 4, base=16, bitRange=8 +sfr = "US0_IER.TXEMPTY", "Memory", 0xfffc0008, 4, base=16, bitRange=9 +sfr = "US0_IER.ITERATION", "Memory", 0xfffc0008, 4, base=16, bitRange=10 +sfr = "US0_IER.TXBUFE", "Memory", 0xfffc0008, 4, base=16, bitRange=11 +sfr = "US0_IER.RXBUFF", "Memory", 0xfffc0008, 4, base=16, bitRange=12 +sfr = "US0_IER.NACK", "Memory", 0xfffc0008, 4, base=16, bitRange=13 +sfr = "US0_IER.RIIC", "Memory", 0xfffc0008, 4, base=16, bitRange=16 +sfr = "US0_IER.DSRIC", "Memory", 0xfffc0008, 4, base=16, bitRange=17 +sfr = "US0_IER.DCDIC", "Memory", 0xfffc0008, 4, base=16, bitRange=18 +sfr = "US0_IER.CTSIC", "Memory", 0xfffc0008, 4, base=16, bitRange=19 +sfr = "US0_IDR", "Memory", 0xfffc000c, 4, base=16 +sfr = "US0_IDR.RXRDY", "Memory", 0xfffc000c, 4, base=16, bitRange=0 +sfr = "US0_IDR.TXRDY", "Memory", 0xfffc000c, 4, base=16, bitRange=1 +sfr = "US0_IDR.RXBRK", "Memory", 0xfffc000c, 4, base=16, bitRange=2 +sfr = "US0_IDR.ENDRX", "Memory", 0xfffc000c, 4, base=16, bitRange=3 +sfr = "US0_IDR.ENDTX", "Memory", 0xfffc000c, 4, base=16, bitRange=4 +sfr = "US0_IDR.OVRE", "Memory", 0xfffc000c, 4, base=16, bitRange=5 +sfr = "US0_IDR.FRAME", "Memory", 0xfffc000c, 4, base=16, bitRange=6 +sfr = "US0_IDR.PARE", "Memory", 0xfffc000c, 4, base=16, bitRange=7 +sfr = "US0_IDR.TIMEOUT", "Memory", 0xfffc000c, 4, base=16, bitRange=8 +sfr = "US0_IDR.TXEMPTY", "Memory", 0xfffc000c, 4, base=16, bitRange=9 +sfr = "US0_IDR.ITERATION", "Memory", 0xfffc000c, 4, base=16, bitRange=10 +sfr = "US0_IDR.TXBUFE", "Memory", 0xfffc000c, 4, base=16, bitRange=11 +sfr = "US0_IDR.RXBUFF", "Memory", 0xfffc000c, 4, base=16, bitRange=12 +sfr = "US0_IDR.NACK", "Memory", 0xfffc000c, 4, base=16, bitRange=13 +sfr = "US0_IDR.RIIC", "Memory", 0xfffc000c, 4, base=16, bitRange=16 +sfr = "US0_IDR.DSRIC", "Memory", 0xfffc000c, 4, base=16, bitRange=17 +sfr = "US0_IDR.DCDIC", "Memory", 0xfffc000c, 4, base=16, bitRange=18 +sfr = "US0_IDR.CTSIC", "Memory", 0xfffc000c, 4, base=16, bitRange=19 +sfr = "US0_IMR", "Memory", 0xfffc0010, 4, base=16 +sfr = "US0_IMR.RXRDY", "Memory", 0xfffc0010, 4, base=16, bitRange=0 +sfr = "US0_IMR.TXRDY", "Memory", 0xfffc0010, 4, base=16, bitRange=1 +sfr = "US0_IMR.RXBRK", "Memory", 0xfffc0010, 4, base=16, bitRange=2 +sfr = "US0_IMR.ENDRX", "Memory", 0xfffc0010, 4, base=16, bitRange=3 +sfr = "US0_IMR.ENDTX", "Memory", 0xfffc0010, 4, base=16, bitRange=4 +sfr = "US0_IMR.OVRE", "Memory", 0xfffc0010, 4, base=16, bitRange=5 +sfr = "US0_IMR.FRAME", "Memory", 0xfffc0010, 4, base=16, bitRange=6 +sfr = "US0_IMR.PARE", "Memory", 0xfffc0010, 4, base=16, bitRange=7 +sfr = "US0_IMR.TIMEOUT", "Memory", 0xfffc0010, 4, base=16, bitRange=8 +sfr = "US0_IMR.TXEMPTY", "Memory", 0xfffc0010, 4, base=16, bitRange=9 +sfr = "US0_IMR.ITERATION", "Memory", 0xfffc0010, 4, base=16, bitRange=10 +sfr = "US0_IMR.TXBUFE", "Memory", 0xfffc0010, 4, base=16, bitRange=11 +sfr = "US0_IMR.RXBUFF", "Memory", 0xfffc0010, 4, base=16, bitRange=12 +sfr = "US0_IMR.NACK", "Memory", 0xfffc0010, 4, base=16, bitRange=13 +sfr = "US0_IMR.RIIC", "Memory", 0xfffc0010, 4, base=16, bitRange=16 +sfr = "US0_IMR.DSRIC", "Memory", 0xfffc0010, 4, base=16, bitRange=17 +sfr = "US0_IMR.DCDIC", "Memory", 0xfffc0010, 4, base=16, bitRange=18 +sfr = "US0_IMR.CTSIC", "Memory", 0xfffc0010, 4, base=16, bitRange=19 +sfr = "US0_CSR", "Memory", 0xfffc0014, 4, base=16 +sfr = "US0_CSR.RXRDY", "Memory", 0xfffc0014, 4, base=16, bitRange=0 +sfr = "US0_CSR.TXRDY", "Memory", 0xfffc0014, 4, base=16, bitRange=1 +sfr = "US0_CSR.RXBRK", "Memory", 0xfffc0014, 4, base=16, bitRange=2 +sfr = "US0_CSR.ENDRX", "Memory", 0xfffc0014, 4, base=16, bitRange=3 +sfr = "US0_CSR.ENDTX", "Memory", 0xfffc0014, 4, base=16, bitRange=4 +sfr = "US0_CSR.OVRE", "Memory", 0xfffc0014, 4, base=16, bitRange=5 +sfr = "US0_CSR.FRAME", "Memory", 0xfffc0014, 4, base=16, bitRange=6 +sfr = "US0_CSR.PARE", "Memory", 0xfffc0014, 4, base=16, bitRange=7 +sfr = "US0_CSR.TIMEOUT", "Memory", 0xfffc0014, 4, base=16, bitRange=8 +sfr = "US0_CSR.TXEMPTY", "Memory", 0xfffc0014, 4, base=16, bitRange=9 +sfr = "US0_CSR.ITERATION", "Memory", 0xfffc0014, 4, base=16, bitRange=10 +sfr = "US0_CSR.TXBUFE", "Memory", 0xfffc0014, 4, base=16, bitRange=11 +sfr = "US0_CSR.RXBUFF", "Memory", 0xfffc0014, 4, base=16, bitRange=12 +sfr = "US0_CSR.NACK", "Memory", 0xfffc0014, 4, base=16, bitRange=13 +sfr = "US0_CSR.RIIC", "Memory", 0xfffc0014, 4, base=16, bitRange=16 +sfr = "US0_CSR.DSRIC", "Memory", 0xfffc0014, 4, base=16, bitRange=17 +sfr = "US0_CSR.DCDIC", "Memory", 0xfffc0014, 4, base=16, bitRange=18 +sfr = "US0_CSR.CTSIC", "Memory", 0xfffc0014, 4, base=16, bitRange=19 +sfr = "US0_CSR.RI", "Memory", 0xfffc0014, 4, base=16, bitRange=20 +sfr = "US0_CSR.DSR", "Memory", 0xfffc0014, 4, base=16, bitRange=21 +sfr = "US0_CSR.DCD", "Memory", 0xfffc0014, 4, base=16, bitRange=22 +sfr = "US0_CSR.CTS", "Memory", 0xfffc0014, 4, base=16, bitRange=23 +sfr = "US0_RHR", "Memory", 0xfffc0018, 4, base=16 +sfr = "US0_THR", "Memory", 0xfffc001c, 4, base=16 +sfr = "US0_BRGR", "Memory", 0xfffc0020, 4, base=16 +sfr = "US0_RTOR", "Memory", 0xfffc0024, 4, base=16 +sfr = "US0_TTGR", "Memory", 0xfffc0028, 4, base=16 +sfr = "US0_FIDI", "Memory", 0xfffc0040, 4, base=16 +sfr = "US0_NER", "Memory", 0xfffc0044, 4, base=16 +sfr = "US0_IF", "Memory", 0xfffc004c, 4, base=16 +; ========== Register definition for PDC_SSC peripheral ========== +sfr = "SSC_RPR", "Memory", 0xfffd4100, 4, base=16 +sfr = "SSC_RCR", "Memory", 0xfffd4104, 4, base=16 +sfr = "SSC_TPR", "Memory", 0xfffd4108, 4, base=16 +sfr = "SSC_TCR", "Memory", 0xfffd410c, 4, base=16 +sfr = "SSC_RNPR", "Memory", 0xfffd4110, 4, base=16 +sfr = "SSC_RNCR", "Memory", 0xfffd4114, 4, base=16 +sfr = "SSC_TNPR", "Memory", 0xfffd4118, 4, base=16 +sfr = "SSC_TNCR", "Memory", 0xfffd411c, 4, base=16 +sfr = "SSC_PTCR", "Memory", 0xfffd4120, 4, base=16 +sfr = "SSC_PTCR.RXTEN", "Memory", 0xfffd4120, 4, base=16, bitRange=0 +sfr = "SSC_PTCR.RXTDIS", "Memory", 0xfffd4120, 4, base=16, bitRange=1 +sfr = "SSC_PTCR.TXTEN", "Memory", 0xfffd4120, 4, base=16, bitRange=8 +sfr = "SSC_PTCR.TXTDIS", "Memory", 0xfffd4120, 4, base=16, bitRange=9 +sfr = "SSC_PTSR", "Memory", 0xfffd4124, 4, base=16 +sfr = "SSC_PTSR.RXTEN", "Memory", 0xfffd4124, 4, base=16, bitRange=0 +sfr = "SSC_PTSR.TXTEN", "Memory", 0xfffd4124, 4, base=16, bitRange=8 +; ========== Register definition for SSC peripheral ========== +sfr = "SSC_CR", "Memory", 0xfffd4000, 4, base=16 +sfr = "SSC_CR.RXEN", "Memory", 0xfffd4000, 4, base=16, bitRange=0 +sfr = "SSC_CR.RXDIS", "Memory", 0xfffd4000, 4, base=16, bitRange=1 +sfr = "SSC_CR.TXEN", "Memory", 0xfffd4000, 4, base=16, bitRange=8 +sfr = "SSC_CR.TXDIS", "Memory", 0xfffd4000, 4, base=16, bitRange=9 +sfr = "SSC_CR.SWRST", "Memory", 0xfffd4000, 4, base=16, bitRange=15 +sfr = "SSC_CMR", "Memory", 0xfffd4004, 4, base=16 +sfr = "SSC_RCMR", "Memory", 0xfffd4010, 4, base=16 +sfr = "SSC_RCMR.CKS", "Memory", 0xfffd4010, 4, base=16, bitRange=0-1 +sfr = "SSC_RCMR.CKO", "Memory", 0xfffd4010, 4, base=16, bitRange=2-4 +sfr = "SSC_RCMR.CKI", "Memory", 0xfffd4010, 4, base=16, bitRange=5 +sfr = "SSC_RCMR.CKG", "Memory", 0xfffd4010, 4, base=16, bitRange=6-7 +sfr = "SSC_RCMR.START", "Memory", 0xfffd4010, 4, base=16, bitRange=8-11 +sfr = "SSC_RCMR.STOP", "Memory", 0xfffd4010, 4, base=16, bitRange=12 +sfr = "SSC_RCMR.STTDLY", "Memory", 0xfffd4010, 4, base=16, bitRange=16-23 +sfr = "SSC_RCMR.PERIOD", "Memory", 0xfffd4010, 4, base=16, bitRange=24-31 +sfr = "SSC_RFMR", "Memory", 0xfffd4014, 4, base=16 +sfr = "SSC_RFMR.DATLEN", "Memory", 0xfffd4014, 4, base=16, bitRange=0-4 +sfr = "SSC_RFMR.LOOP", "Memory", 0xfffd4014, 4, base=16, bitRange=5 +sfr = "SSC_RFMR.MSBF", "Memory", 0xfffd4014, 4, base=16, bitRange=7 +sfr = "SSC_RFMR.DATNB", "Memory", 0xfffd4014, 4, base=16, bitRange=8-11 +sfr = "SSC_RFMR.FSLEN", "Memory", 0xfffd4014, 4, base=16, bitRange=16-19 +sfr = "SSC_RFMR.FSOS", "Memory", 0xfffd4014, 4, base=16, bitRange=20-22 +sfr = "SSC_RFMR.FSEDGE", "Memory", 0xfffd4014, 4, base=16, bitRange=24 +sfr = "SSC_TCMR", "Memory", 0xfffd4018, 4, base=16 +sfr = "SSC_TCMR.CKS", "Memory", 0xfffd4018, 4, base=16, bitRange=0-1 +sfr = "SSC_TCMR.CKO", "Memory", 0xfffd4018, 4, base=16, bitRange=2-4 +sfr = "SSC_TCMR.CKI", "Memory", 0xfffd4018, 4, base=16, bitRange=5 +sfr = "SSC_TCMR.CKG", "Memory", 0xfffd4018, 4, base=16, bitRange=6-7 +sfr = "SSC_TCMR.START", "Memory", 0xfffd4018, 4, base=16, bitRange=8-11 +sfr = "SSC_TCMR.STTDLY", "Memory", 0xfffd4018, 4, base=16, bitRange=16-23 +sfr = "SSC_TCMR.PERIOD", "Memory", 0xfffd4018, 4, base=16, bitRange=24-31 +sfr = "SSC_TFMR", "Memory", 0xfffd401c, 4, base=16 +sfr = "SSC_TFMR.DATLEN", "Memory", 0xfffd401c, 4, base=16, bitRange=0-4 +sfr = "SSC_TFMR.DATDEF", "Memory", 0xfffd401c, 4, base=16, bitRange=5 +sfr = "SSC_TFMR.MSBF", "Memory", 0xfffd401c, 4, base=16, bitRange=7 +sfr = "SSC_TFMR.DATNB", "Memory", 0xfffd401c, 4, base=16, bitRange=8-11 +sfr = "SSC_TFMR.FSLEN", "Memory", 0xfffd401c, 4, base=16, bitRange=16-19 +sfr = "SSC_TFMR.FSOS", "Memory", 0xfffd401c, 4, base=16, bitRange=20-22 +sfr = "SSC_TFMR.FSDEN", "Memory", 0xfffd401c, 4, base=16, bitRange=23 +sfr = "SSC_TFMR.FSEDGE", "Memory", 0xfffd401c, 4, base=16, bitRange=24 +sfr = "SSC_RHR", "Memory", 0xfffd4020, 4, base=16 +sfr = "SSC_THR", "Memory", 0xfffd4024, 4, base=16 +sfr = "SSC_RSHR", "Memory", 0xfffd4030, 4, base=16 +sfr = "SSC_TSHR", "Memory", 0xfffd4034, 4, base=16 +sfr = "SSC_SR", "Memory", 0xfffd4040, 4, base=16 +sfr = "SSC_SR.TXRDY", "Memory", 0xfffd4040, 4, base=16, bitRange=0 +sfr = "SSC_SR.TXEMPTY", "Memory", 0xfffd4040, 4, base=16, bitRange=1 +sfr = "SSC_SR.ENDTX", "Memory", 0xfffd4040, 4, base=16, bitRange=2 +sfr = "SSC_SR.TXBUFE", "Memory", 0xfffd4040, 4, base=16, bitRange=3 +sfr = "SSC_SR.RXRDY", "Memory", 0xfffd4040, 4, base=16, bitRange=4 +sfr = "SSC_SR.OVRUN", "Memory", 0xfffd4040, 4, base=16, bitRange=5 +sfr = "SSC_SR.ENDRX", "Memory", 0xfffd4040, 4, base=16, bitRange=6 +sfr = "SSC_SR.RXBUFF", "Memory", 0xfffd4040, 4, base=16, bitRange=7 +sfr = "SSC_SR.CP0", "Memory", 0xfffd4040, 4, base=16, bitRange=8 +sfr = "SSC_SR.CP1", "Memory", 0xfffd4040, 4, base=16, bitRange=9 +sfr = "SSC_SR.TXSYN", "Memory", 0xfffd4040, 4, base=16, bitRange=10 +sfr = "SSC_SR.RXSYN", "Memory", 0xfffd4040, 4, base=16, bitRange=11 +sfr = "SSC_SR.TXENA", "Memory", 0xfffd4040, 4, base=16, bitRange=16 +sfr = "SSC_SR.RXENA", "Memory", 0xfffd4040, 4, base=16, bitRange=17 +sfr = "SSC_IER", "Memory", 0xfffd4044, 4, base=16 +sfr = "SSC_IER.TXRDY", "Memory", 0xfffd4044, 4, base=16, bitRange=0 +sfr = "SSC_IER.TXEMPTY", "Memory", 0xfffd4044, 4, base=16, bitRange=1 +sfr = "SSC_IER.ENDTX", "Memory", 0xfffd4044, 4, base=16, bitRange=2 +sfr = "SSC_IER.TXBUFE", "Memory", 0xfffd4044, 4, base=16, bitRange=3 +sfr = "SSC_IER.RXRDY", "Memory", 0xfffd4044, 4, base=16, bitRange=4 +sfr = "SSC_IER.OVRUN", "Memory", 0xfffd4044, 4, base=16, bitRange=5 +sfr = "SSC_IER.ENDRX", "Memory", 0xfffd4044, 4, base=16, bitRange=6 +sfr = "SSC_IER.RXBUFF", "Memory", 0xfffd4044, 4, base=16, bitRange=7 +sfr = "SSC_IER.CP0", "Memory", 0xfffd4044, 4, base=16, bitRange=8 +sfr = "SSC_IER.CP1", "Memory", 0xfffd4044, 4, base=16, bitRange=9 +sfr = "SSC_IER.TXSYN", "Memory", 0xfffd4044, 4, base=16, bitRange=10 +sfr = "SSC_IER.RXSYN", "Memory", 0xfffd4044, 4, base=16, bitRange=11 +sfr = "SSC_IDR", "Memory", 0xfffd4048, 4, base=16 +sfr = "SSC_IDR.TXRDY", "Memory", 0xfffd4048, 4, base=16, bitRange=0 +sfr = "SSC_IDR.TXEMPTY", "Memory", 0xfffd4048, 4, base=16, bitRange=1 +sfr = "SSC_IDR.ENDTX", "Memory", 0xfffd4048, 4, base=16, bitRange=2 +sfr = "SSC_IDR.TXBUFE", "Memory", 0xfffd4048, 4, base=16, bitRange=3 +sfr = "SSC_IDR.RXRDY", "Memory", 0xfffd4048, 4, base=16, bitRange=4 +sfr = "SSC_IDR.OVRUN", "Memory", 0xfffd4048, 4, base=16, bitRange=5 +sfr = "SSC_IDR.ENDRX", "Memory", 0xfffd4048, 4, base=16, bitRange=6 +sfr = "SSC_IDR.RXBUFF", "Memory", 0xfffd4048, 4, base=16, bitRange=7 +sfr = "SSC_IDR.CP0", "Memory", 0xfffd4048, 4, base=16, bitRange=8 +sfr = "SSC_IDR.CP1", "Memory", 0xfffd4048, 4, base=16, bitRange=9 +sfr = "SSC_IDR.TXSYN", "Memory", 0xfffd4048, 4, base=16, bitRange=10 +sfr = "SSC_IDR.RXSYN", "Memory", 0xfffd4048, 4, base=16, bitRange=11 +sfr = "SSC_IMR", "Memory", 0xfffd404c, 4, base=16 +sfr = "SSC_IMR.TXRDY", "Memory", 0xfffd404c, 4, base=16, bitRange=0 +sfr = "SSC_IMR.TXEMPTY", "Memory", 0xfffd404c, 4, base=16, bitRange=1 +sfr = "SSC_IMR.ENDTX", "Memory", 0xfffd404c, 4, base=16, bitRange=2 +sfr = "SSC_IMR.TXBUFE", "Memory", 0xfffd404c, 4, base=16, bitRange=3 +sfr = "SSC_IMR.RXRDY", "Memory", 0xfffd404c, 4, base=16, bitRange=4 +sfr = "SSC_IMR.OVRUN", "Memory", 0xfffd404c, 4, base=16, bitRange=5 +sfr = "SSC_IMR.ENDRX", "Memory", 0xfffd404c, 4, base=16, bitRange=6 +sfr = "SSC_IMR.RXBUFF", "Memory", 0xfffd404c, 4, base=16, bitRange=7 +sfr = "SSC_IMR.CP0", "Memory", 0xfffd404c, 4, base=16, bitRange=8 +sfr = "SSC_IMR.CP1", "Memory", 0xfffd404c, 4, base=16, bitRange=9 +sfr = "SSC_IMR.TXSYN", "Memory", 0xfffd404c, 4, base=16, bitRange=10 +sfr = "SSC_IMR.RXSYN", "Memory", 0xfffd404c, 4, base=16, bitRange=11 +; ========== Register definition for TWI peripheral ========== +sfr = "TWI_CR", "Memory", 0xfffb8000, 4, base=16 +sfr = "TWI_CR.START", "Memory", 0xfffb8000, 4, base=16, bitRange=0 +sfr = "TWI_CR.STOP", "Memory", 0xfffb8000, 4, base=16, bitRange=1 +sfr = "TWI_CR.MSEN", "Memory", 0xfffb8000, 4, base=16, bitRange=2 +sfr = "TWI_CR.MSDIS", "Memory", 0xfffb8000, 4, base=16, bitRange=3 +sfr = "TWI_CR.SWRST", "Memory", 0xfffb8000, 4, base=16, bitRange=7 +sfr = "TWI_MMR", "Memory", 0xfffb8004, 4, base=16 +sfr = "TWI_MMR.IADRSZ", "Memory", 0xfffb8004, 4, base=16, bitRange=8-9 +sfr = "TWI_MMR.MREAD", "Memory", 0xfffb8004, 4, base=16, bitRange=12 +sfr = "TWI_MMR.DADR", "Memory", 0xfffb8004, 4, base=16, bitRange=16-22 +sfr = "TWI_IADR", "Memory", 0xfffb800c, 4, base=16 +sfr = "TWI_CWGR", "Memory", 0xfffb8010, 4, base=16 +sfr = "TWI_CWGR.CLDIV", "Memory", 0xfffb8010, 4, base=16, bitRange=0-7 +sfr = "TWI_CWGR.CHDIV", "Memory", 0xfffb8010, 4, base=16, bitRange=8-15 +sfr = "TWI_CWGR.CKDIV", "Memory", 0xfffb8010, 4, base=16, bitRange=16-18 +sfr = "TWI_SR", "Memory", 0xfffb8020, 4, base=16 +sfr = "TWI_SR.TXCOMP", "Memory", 0xfffb8020, 4, base=16, bitRange=0 +sfr = "TWI_SR.RXRDY", "Memory", 0xfffb8020, 4, base=16, bitRange=1 +sfr = "TWI_SR.TXRDY", "Memory", 0xfffb8020, 4, base=16, bitRange=2 +sfr = "TWI_SR.OVRE", "Memory", 0xfffb8020, 4, base=16, bitRange=6 +sfr = "TWI_SR.UNRE", "Memory", 0xfffb8020, 4, base=16, bitRange=7 +sfr = "TWI_SR.NACK", "Memory", 0xfffb8020, 4, base=16, bitRange=8 +sfr = "TWI_IER", "Memory", 0xfffb8024, 4, base=16 +sfr = "TWI_IER.TXCOMP", "Memory", 0xfffb8024, 4, base=16, bitRange=0 +sfr = "TWI_IER.RXRDY", "Memory", 0xfffb8024, 4, base=16, bitRange=1 +sfr = "TWI_IER.TXRDY", "Memory", 0xfffb8024, 4, base=16, bitRange=2 +sfr = "TWI_IER.OVRE", "Memory", 0xfffb8024, 4, base=16, bitRange=6 +sfr = "TWI_IER.UNRE", "Memory", 0xfffb8024, 4, base=16, bitRange=7 +sfr = "TWI_IER.NACK", "Memory", 0xfffb8024, 4, base=16, bitRange=8 +sfr = "TWI_IDR", "Memory", 0xfffb8028, 4, base=16 +sfr = "TWI_IDR.TXCOMP", "Memory", 0xfffb8028, 4, base=16, bitRange=0 +sfr = "TWI_IDR.RXRDY", "Memory", 0xfffb8028, 4, base=16, bitRange=1 +sfr = "TWI_IDR.TXRDY", "Memory", 0xfffb8028, 4, base=16, bitRange=2 +sfr = "TWI_IDR.OVRE", "Memory", 0xfffb8028, 4, base=16, bitRange=6 +sfr = "TWI_IDR.UNRE", "Memory", 0xfffb8028, 4, base=16, bitRange=7 +sfr = "TWI_IDR.NACK", "Memory", 0xfffb8028, 4, base=16, bitRange=8 +sfr = "TWI_IMR", "Memory", 0xfffb802c, 4, base=16 +sfr = "TWI_IMR.TXCOMP", "Memory", 0xfffb802c, 4, base=16, bitRange=0 +sfr = "TWI_IMR.RXRDY", "Memory", 0xfffb802c, 4, base=16, bitRange=1 +sfr = "TWI_IMR.TXRDY", "Memory", 0xfffb802c, 4, base=16, bitRange=2 +sfr = "TWI_IMR.OVRE", "Memory", 0xfffb802c, 4, base=16, bitRange=6 +sfr = "TWI_IMR.UNRE", "Memory", 0xfffb802c, 4, base=16, bitRange=7 +sfr = "TWI_IMR.NACK", "Memory", 0xfffb802c, 4, base=16, bitRange=8 +sfr = "TWI_RHR", "Memory", 0xfffb8030, 4, base=16 +sfr = "TWI_THR", "Memory", 0xfffb8034, 4, base=16 +; ========== Register definition for PWMC_CH3 peripheral ========== +sfr = "PWMC_CH3_CMR", "Memory", 0xfffcc260, 4, base=16 +sfr = "PWMC_CH3_CMR.CPRE", "Memory", 0xfffcc260, 4, base=16, bitRange=0-3 +sfr = "PWMC_CH3_CMR.CALG", "Memory", 0xfffcc260, 4, base=16, bitRange=8 +sfr = "PWMC_CH3_CMR.CPOL", "Memory", 0xfffcc260, 4, base=16, bitRange=9 +sfr = "PWMC_CH3_CMR.CPD", "Memory", 0xfffcc260, 4, base=16, bitRange=10 +sfr = "PWMC_CH3_CDTYR", "Memory", 0xfffcc264, 4, base=16 +sfr = "PWMC_CH3_CDTYR.CDTY", "Memory", 0xfffcc264, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH3_CPRDR", "Memory", 0xfffcc268, 4, base=16 +sfr = "PWMC_CH3_CPRDR.CPRD", "Memory", 0xfffcc268, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH3_CCNTR", "Memory", 0xfffcc26c, 4, base=16 +sfr = "PWMC_CH3_CCNTR.CCNT", "Memory", 0xfffcc26c, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH3_CUPDR", "Memory", 0xfffcc270, 4, base=16 +sfr = "PWMC_CH3_CUPDR.CUPD", "Memory", 0xfffcc270, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH3_Reserved", "Memory", 0xfffcc274, 4, base=16 +; ========== Register definition for PWMC_CH2 peripheral ========== +sfr = "PWMC_CH2_CMR", "Memory", 0xfffcc240, 4, base=16 +sfr = "PWMC_CH2_CMR.CPRE", "Memory", 0xfffcc240, 4, base=16, bitRange=0-3 +sfr = "PWMC_CH2_CMR.CALG", "Memory", 0xfffcc240, 4, base=16, bitRange=8 +sfr = "PWMC_CH2_CMR.CPOL", "Memory", 0xfffcc240, 4, base=16, bitRange=9 +sfr = "PWMC_CH2_CMR.CPD", "Memory", 0xfffcc240, 4, base=16, bitRange=10 +sfr = "PWMC_CH2_CDTYR", "Memory", 0xfffcc244, 4, base=16 +sfr = "PWMC_CH2_CDTYR.CDTY", "Memory", 0xfffcc244, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH2_CPRDR", "Memory", 0xfffcc248, 4, base=16 +sfr = "PWMC_CH2_CPRDR.CPRD", "Memory", 0xfffcc248, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH2_CCNTR", "Memory", 0xfffcc24c, 4, base=16 +sfr = "PWMC_CH2_CCNTR.CCNT", "Memory", 0xfffcc24c, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH2_CUPDR", "Memory", 0xfffcc250, 4, base=16 +sfr = "PWMC_CH2_CUPDR.CUPD", "Memory", 0xfffcc250, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH2_Reserved", "Memory", 0xfffcc254, 4, base=16 +; ========== Register definition for PWMC_CH1 peripheral ========== +sfr = "PWMC_CH1_CMR", "Memory", 0xfffcc220, 4, base=16 +sfr = "PWMC_CH1_CMR.CPRE", "Memory", 0xfffcc220, 4, base=16, bitRange=0-3 +sfr = "PWMC_CH1_CMR.CALG", "Memory", 0xfffcc220, 4, base=16, bitRange=8 +sfr = "PWMC_CH1_CMR.CPOL", "Memory", 0xfffcc220, 4, base=16, bitRange=9 +sfr = "PWMC_CH1_CMR.CPD", "Memory", 0xfffcc220, 4, base=16, bitRange=10 +sfr = "PWMC_CH1_CDTYR", "Memory", 0xfffcc224, 4, base=16 +sfr = "PWMC_CH1_CDTYR.CDTY", "Memory", 0xfffcc224, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH1_CPRDR", "Memory", 0xfffcc228, 4, base=16 +sfr = "PWMC_CH1_CPRDR.CPRD", "Memory", 0xfffcc228, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH1_CCNTR", "Memory", 0xfffcc22c, 4, base=16 +sfr = "PWMC_CH1_CCNTR.CCNT", "Memory", 0xfffcc22c, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH1_CUPDR", "Memory", 0xfffcc230, 4, base=16 +sfr = "PWMC_CH1_CUPDR.CUPD", "Memory", 0xfffcc230, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH1_Reserved", "Memory", 0xfffcc234, 4, base=16 +; ========== Register definition for PWMC_CH0 peripheral ========== +sfr = "PWMC_CH0_CMR", "Memory", 0xfffcc200, 4, base=16 +sfr = "PWMC_CH0_CMR.CPRE", "Memory", 0xfffcc200, 4, base=16, bitRange=0-3 +sfr = "PWMC_CH0_CMR.CALG", "Memory", 0xfffcc200, 4, base=16, bitRange=8 +sfr = "PWMC_CH0_CMR.CPOL", "Memory", 0xfffcc200, 4, base=16, bitRange=9 +sfr = "PWMC_CH0_CMR.CPD", "Memory", 0xfffcc200, 4, base=16, bitRange=10 +sfr = "PWMC_CH0_CDTYR", "Memory", 0xfffcc204, 4, base=16 +sfr = "PWMC_CH0_CDTYR.CDTY", "Memory", 0xfffcc204, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH0_CPRDR", "Memory", 0xfffcc208, 4, base=16 +sfr = "PWMC_CH0_CPRDR.CPRD", "Memory", 0xfffcc208, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH0_CCNTR", "Memory", 0xfffcc20c, 4, base=16 +sfr = "PWMC_CH0_CCNTR.CCNT", "Memory", 0xfffcc20c, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH0_CUPDR", "Memory", 0xfffcc210, 4, base=16 +sfr = "PWMC_CH0_CUPDR.CUPD", "Memory", 0xfffcc210, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH0_Reserved", "Memory", 0xfffcc214, 4, base=16 +; ========== Register definition for PWMC peripheral ========== +sfr = "PWMC_MR", "Memory", 0xfffcc000, 4, base=16 +sfr = "PWMC_MR.DIVA", "Memory", 0xfffcc000, 4, base=16, bitRange=0-7 +sfr = "PWMC_MR.PREA", "Memory", 0xfffcc000, 4, base=16, bitRange=8-11 +sfr = "PWMC_MR.DIVB", "Memory", 0xfffcc000, 4, base=16, bitRange=16-23 +sfr = "PWMC_MR.PREB", "Memory", 0xfffcc000, 4, base=16, bitRange=24-27 +sfr = "PWMC_ENA", "Memory", 0xfffcc004, 4, base=16 +sfr = "PWMC_ENA.CHID0", "Memory", 0xfffcc004, 4, base=16, bitRange=0 +sfr = "PWMC_ENA.CHID1", "Memory", 0xfffcc004, 4, base=16, bitRange=1 +sfr = "PWMC_ENA.CHID2", "Memory", 0xfffcc004, 4, base=16, bitRange=2 +sfr = "PWMC_ENA.CHID3", "Memory", 0xfffcc004, 4, base=16, bitRange=3 +sfr = "PWMC_DIS", "Memory", 0xfffcc008, 4, base=16 +sfr = "PWMC_DIS.CHID0", "Memory", 0xfffcc008, 4, base=16, bitRange=0 +sfr = "PWMC_DIS.CHID1", "Memory", 0xfffcc008, 4, base=16, bitRange=1 +sfr = "PWMC_DIS.CHID2", "Memory", 0xfffcc008, 4, base=16, bitRange=2 +sfr = "PWMC_DIS.CHID3", "Memory", 0xfffcc008, 4, base=16, bitRange=3 +sfr = "PWMC_SR", "Memory", 0xfffcc00c, 4, base=16 +sfr = "PWMC_SR.CHID0", "Memory", 0xfffcc00c, 4, base=16, bitRange=0 +sfr = "PWMC_SR.CHID1", "Memory", 0xfffcc00c, 4, base=16, bitRange=1 +sfr = "PWMC_SR.CHID2", "Memory", 0xfffcc00c, 4, base=16, bitRange=2 +sfr = "PWMC_SR.CHID3", "Memory", 0xfffcc00c, 4, base=16, bitRange=3 +sfr = "PWMC_IER", "Memory", 0xfffcc010, 4, base=16 +sfr = "PWMC_IER.CHID0", "Memory", 0xfffcc010, 4, base=16, bitRange=0 +sfr = "PWMC_IER.CHID1", "Memory", 0xfffcc010, 4, base=16, bitRange=1 +sfr = "PWMC_IER.CHID2", "Memory", 0xfffcc010, 4, base=16, bitRange=2 +sfr = "PWMC_IER.CHID3", "Memory", 0xfffcc010, 4, base=16, bitRange=3 +sfr = "PWMC_IDR", "Memory", 0xfffcc014, 4, base=16 +sfr = "PWMC_IDR.CHID0", "Memory", 0xfffcc014, 4, base=16, bitRange=0 +sfr = "PWMC_IDR.CHID1", "Memory", 0xfffcc014, 4, base=16, bitRange=1 +sfr = "PWMC_IDR.CHID2", "Memory", 0xfffcc014, 4, base=16, bitRange=2 +sfr = "PWMC_IDR.CHID3", "Memory", 0xfffcc014, 4, base=16, bitRange=3 +sfr = "PWMC_IMR", "Memory", 0xfffcc018, 4, base=16 +sfr = "PWMC_IMR.CHID0", "Memory", 0xfffcc018, 4, base=16, bitRange=0 +sfr = "PWMC_IMR.CHID1", "Memory", 0xfffcc018, 4, base=16, bitRange=1 +sfr = "PWMC_IMR.CHID2", "Memory", 0xfffcc018, 4, base=16, bitRange=2 +sfr = "PWMC_IMR.CHID3", "Memory", 0xfffcc018, 4, base=16, bitRange=3 +sfr = "PWMC_ISR", "Memory", 0xfffcc01c, 4, base=16 +sfr = "PWMC_ISR.CHID0", "Memory", 0xfffcc01c, 4, base=16, bitRange=0 +sfr = "PWMC_ISR.CHID1", "Memory", 0xfffcc01c, 4, base=16, bitRange=1 +sfr = "PWMC_ISR.CHID2", "Memory", 0xfffcc01c, 4, base=16, bitRange=2 +sfr = "PWMC_ISR.CHID3", "Memory", 0xfffcc01c, 4, base=16, bitRange=3 +sfr = "PWMC_VR", "Memory", 0xfffcc0fc, 4, base=16 +; ========== Register definition for UDP peripheral ========== +sfr = "UDP_NUM", "Memory", 0xfffb0000, 4, base=16 +sfr = "UDP_NUM.NUM", "Memory", 0xfffb0000, 4, base=16, bitRange=0-10 +sfr = "UDP_NUM.ERR", "Memory", 0xfffb0000, 4, base=16, bitRange=16 +sfr = "UDP_NUM.OK", "Memory", 0xfffb0000, 4, base=16, bitRange=17 +sfr = "UDP_GLBSTATE", "Memory", 0xfffb0004, 4, base=16 +sfr = "UDP_GLBSTATE.FADDEN", "Memory", 0xfffb0004, 4, base=16, bitRange=0 +sfr = "UDP_GLBSTATE.CONFG", "Memory", 0xfffb0004, 4, base=16, bitRange=1 +sfr = "UDP_GLBSTATE.ESR", "Memory", 0xfffb0004, 4, base=16, bitRange=2 +sfr = "UDP_GLBSTATE.RSMINPR", "Memory", 0xfffb0004, 4, base=16, bitRange=3 +sfr = "UDP_GLBSTATE.RMWUPE", "Memory", 0xfffb0004, 4, base=16, bitRange=4 +sfr = "UDP_FADDR", "Memory", 0xfffb0008, 4, base=16 +sfr = "UDP_FADDR.FADD", "Memory", 0xfffb0008, 4, base=16, bitRange=0-7 +sfr = "UDP_FADDR.FEN", "Memory", 0xfffb0008, 4, base=16, bitRange=8 +sfr = "UDP_IER", "Memory", 0xfffb0010, 4, base=16 +sfr = "UDP_IER.EPINT0", "Memory", 0xfffb0010, 4, base=16, bitRange=0 +sfr = "UDP_IER.EPINT1", "Memory", 0xfffb0010, 4, base=16, bitRange=1 +sfr = "UDP_IER.EPINT2", "Memory", 0xfffb0010, 4, base=16, bitRange=2 +sfr = "UDP_IER.EPINT3", "Memory", 0xfffb0010, 4, base=16, bitRange=3 +sfr = "UDP_IER.EPINT4", "Memory", 0xfffb0010, 4, base=16, bitRange=4 +sfr = "UDP_IER.EPINT5", "Memory", 0xfffb0010, 4, base=16, bitRange=5 +sfr = "UDP_IER.RXSUSP", "Memory", 0xfffb0010, 4, base=16, bitRange=8 +sfr = "UDP_IER.RXRSM", "Memory", 0xfffb0010, 4, base=16, bitRange=9 +sfr = "UDP_IER.EXTRSM", "Memory", 0xfffb0010, 4, base=16, bitRange=10 +sfr = "UDP_IER.SOFINT", "Memory", 0xfffb0010, 4, base=16, bitRange=11 +sfr = "UDP_IER.WAKEUP", "Memory", 0xfffb0010, 4, base=16, bitRange=13 +sfr = "UDP_IDR", "Memory", 0xfffb0014, 4, base=16 +sfr = "UDP_IDR.EPINT0", "Memory", 0xfffb0014, 4, base=16, bitRange=0 +sfr = "UDP_IDR.EPINT1", "Memory", 0xfffb0014, 4, base=16, bitRange=1 +sfr = "UDP_IDR.EPINT2", "Memory", 0xfffb0014, 4, base=16, bitRange=2 +sfr = "UDP_IDR.EPINT3", "Memory", 0xfffb0014, 4, base=16, bitRange=3 +sfr = "UDP_IDR.EPINT4", "Memory", 0xfffb0014, 4, base=16, bitRange=4 +sfr = "UDP_IDR.EPINT5", "Memory", 0xfffb0014, 4, base=16, bitRange=5 +sfr = "UDP_IDR.RXSUSP", "Memory", 0xfffb0014, 4, base=16, bitRange=8 +sfr = "UDP_IDR.RXRSM", "Memory", 0xfffb0014, 4, base=16, bitRange=9 +sfr = "UDP_IDR.EXTRSM", "Memory", 0xfffb0014, 4, base=16, bitRange=10 +sfr = "UDP_IDR.SOFINT", "Memory", 0xfffb0014, 4, base=16, bitRange=11 +sfr = "UDP_IDR.WAKEUP", "Memory", 0xfffb0014, 4, base=16, bitRange=13 +sfr = "UDP_IMR", "Memory", 0xfffb0018, 4, base=16 +sfr = "UDP_IMR.EPINT0", "Memory", 0xfffb0018, 4, base=16, bitRange=0 +sfr = "UDP_IMR.EPINT1", "Memory", 0xfffb0018, 4, base=16, bitRange=1 +sfr = "UDP_IMR.EPINT2", "Memory", 0xfffb0018, 4, base=16, bitRange=2 +sfr = "UDP_IMR.EPINT3", "Memory", 0xfffb0018, 4, base=16, bitRange=3 +sfr = "UDP_IMR.EPINT4", "Memory", 0xfffb0018, 4, base=16, bitRange=4 +sfr = "UDP_IMR.EPINT5", "Memory", 0xfffb0018, 4, base=16, bitRange=5 +sfr = "UDP_IMR.RXSUSP", "Memory", 0xfffb0018, 4, base=16, bitRange=8 +sfr = "UDP_IMR.RXRSM", "Memory", 0xfffb0018, 4, base=16, bitRange=9 +sfr = "UDP_IMR.EXTRSM", "Memory", 0xfffb0018, 4, base=16, bitRange=10 +sfr = "UDP_IMR.SOFINT", "Memory", 0xfffb0018, 4, base=16, bitRange=11 +sfr = "UDP_IMR.WAKEUP", "Memory", 0xfffb0018, 4, base=16, bitRange=13 +sfr = "UDP_ISR", "Memory", 0xfffb001c, 4, base=16 +sfr = "UDP_ISR.EPINT0", "Memory", 0xfffb001c, 4, base=16, bitRange=0 +sfr = "UDP_ISR.EPINT1", "Memory", 0xfffb001c, 4, base=16, bitRange=1 +sfr = "UDP_ISR.EPINT2", "Memory", 0xfffb001c, 4, base=16, bitRange=2 +sfr = "UDP_ISR.EPINT3", "Memory", 0xfffb001c, 4, base=16, bitRange=3 +sfr = "UDP_ISR.EPINT4", "Memory", 0xfffb001c, 4, base=16, bitRange=4 +sfr = "UDP_ISR.EPINT5", "Memory", 0xfffb001c, 4, base=16, bitRange=5 +sfr = "UDP_ISR.RXSUSP", "Memory", 0xfffb001c, 4, base=16, bitRange=8 +sfr = "UDP_ISR.RXRSM", "Memory", 0xfffb001c, 4, base=16, bitRange=9 +sfr = "UDP_ISR.EXTRSM", "Memory", 0xfffb001c, 4, base=16, bitRange=10 +sfr = "UDP_ISR.SOFINT", "Memory", 0xfffb001c, 4, base=16, bitRange=11 +sfr = "UDP_ISR.ENDBUSRES", "Memory", 0xfffb001c, 4, base=16, bitRange=12 +sfr = "UDP_ISR.WAKEUP", "Memory", 0xfffb001c, 4, base=16, bitRange=13 +sfr = "UDP_ICR", "Memory", 0xfffb0020, 4, base=16 +sfr = "UDP_ICR.EPINT0", "Memory", 0xfffb0020, 4, base=16, bitRange=0 +sfr = "UDP_ICR.EPINT1", "Memory", 0xfffb0020, 4, base=16, bitRange=1 +sfr = "UDP_ICR.EPINT2", "Memory", 0xfffb0020, 4, base=16, bitRange=2 +sfr = "UDP_ICR.EPINT3", "Memory", 0xfffb0020, 4, base=16, bitRange=3 +sfr = "UDP_ICR.EPINT4", "Memory", 0xfffb0020, 4, base=16, bitRange=4 +sfr = "UDP_ICR.EPINT5", "Memory", 0xfffb0020, 4, base=16, bitRange=5 +sfr = "UDP_ICR.RXSUSP", "Memory", 0xfffb0020, 4, base=16, bitRange=8 +sfr = "UDP_ICR.RXRSM", "Memory", 0xfffb0020, 4, base=16, bitRange=9 +sfr = "UDP_ICR.EXTRSM", "Memory", 0xfffb0020, 4, base=16, bitRange=10 +sfr = "UDP_ICR.SOFINT", "Memory", 0xfffb0020, 4, base=16, bitRange=11 +sfr = "UDP_ICR.WAKEUP", "Memory", 0xfffb0020, 4, base=16, bitRange=13 +sfr = "UDP_RSTEP", "Memory", 0xfffb0028, 4, base=16 +sfr = "UDP_RSTEP.EP0", "Memory", 0xfffb0028, 4, base=16, bitRange=0 +sfr = "UDP_RSTEP.EP1", "Memory", 0xfffb0028, 4, base=16, bitRange=1 +sfr = "UDP_RSTEP.EP2", "Memory", 0xfffb0028, 4, base=16, bitRange=2 +sfr = "UDP_RSTEP.EP3", "Memory", 0xfffb0028, 4, base=16, bitRange=3 +sfr = "UDP_RSTEP.EP4", "Memory", 0xfffb0028, 4, base=16, bitRange=4 +sfr = "UDP_RSTEP.EP5", "Memory", 0xfffb0028, 4, base=16, bitRange=5 +sfr = "UDP_CSR", "Memory", 0xfffb0030, 4, base=16 +sfr = "UDP_CSR.TXCOMP", "Memory", 0xfffb0030, 4, base=16, bitRange=0 +sfr = "UDP_CSR.BK0", "Memory", 0xfffb0030, 4, base=16, bitRange=1 +sfr = "UDP_CSR.RXSETUP", "Memory", 0xfffb0030, 4, base=16, bitRange=2 +sfr = "UDP_CSR.ISOERROR", "Memory", 0xfffb0030, 4, base=16, bitRange=3 +sfr = "UDP_CSR.TXPKTRDY", "Memory", 0xfffb0030, 4, base=16, bitRange=4 +sfr = "UDP_CSR.FORCESTALL", "Memory", 0xfffb0030, 4, base=16, bitRange=5 +sfr = "UDP_CSR.BK1", "Memory", 0xfffb0030, 4, base=16, bitRange=6 +sfr = "UDP_CSR.DIR", "Memory", 0xfffb0030, 4, base=16, bitRange=7 +sfr = "UDP_CSR.EPTYPE", "Memory", 0xfffb0030, 4, base=16, bitRange=8-10 +sfr = "UDP_CSR.DTGLE", "Memory", 0xfffb0030, 4, base=16, bitRange=11 +sfr = "UDP_CSR.EPEDS", "Memory", 0xfffb0030, 4, base=16, bitRange=15 +sfr = "UDP_CSR.RXBYTECNT", "Memory", 0xfffb0030, 4, base=16, bitRange=16-26 +sfr = "UDP_FDR", "Memory", 0xfffb0050, 4, base=16 +sfr = "UDP_TXVC", "Memory", 0xfffb0074, 4, base=16 +sfr = "UDP_TXVC.TXVDIS", "Memory", 0xfffb0074, 4, base=16, bitRange=8 +sfr = "UDP_TXVC.PUON", "Memory", 0xfffb0074, 4, base=16, bitRange=9 +; ========== Register definition for TC0 peripheral ========== +sfr = "TC0_CCR", "Memory", 0xfffa0000, 4, base=16 +sfr = "TC0_CCR.CLKEN", "Memory", 0xfffa0000, 4, base=16, bitRange=0 +sfr = "TC0_CCR.CLKDIS", "Memory", 0xfffa0000, 4, base=16, bitRange=1 +sfr = "TC0_CCR.SWTRG", "Memory", 0xfffa0000, 4, base=16, bitRange=2 +sfr = "TC0_CMR", "Memory", 0xfffa0004, 4, base=16 +sfr = "TC0_CMR.CLKS", "Memory", 0xfffa0004, 4, base=16, bitRange=0-2 +sfr = "TC0_CMR.CLKI", "Memory", 0xfffa0004, 4, base=16, bitRange=3 +sfr = "TC0_CMR.BURST", "Memory", 0xfffa0004, 4, base=16, bitRange=4-5 +sfr = "TC0_CMR.CPCSTOP", "Memory", 0xfffa0004, 4, base=16, bitRange=6 +sfr = "TC0_CMR.LDBSTOP", "Memory", 0xfffa0004, 4, base=16, bitRange=6 +sfr = "TC0_CMR.CPCDIS", "Memory", 0xfffa0004, 4, base=16, bitRange=7 +sfr = "TC0_CMR.LDBDIS", "Memory", 0xfffa0004, 4, base=16, bitRange=7 +sfr = "TC0_CMR.ETRGEDG", "Memory", 0xfffa0004, 4, base=16, bitRange=8-9 +sfr = "TC0_CMR.EEVTEDG", "Memory", 0xfffa0004, 4, base=16, bitRange=8-9 +sfr = "TC0_CMR.EEVT", "Memory", 0xfffa0004, 4, base=16, bitRange=10-11 +sfr = "TC0_CMR.ABETRG", "Memory", 0xfffa0004, 4, base=16, bitRange=10 +sfr = "TC0_CMR.ENETRG", "Memory", 0xfffa0004, 4, base=16, bitRange=12 +sfr = "TC0_CMR.WAVESEL", "Memory", 0xfffa0004, 4, base=16, bitRange=13-14 +sfr = "TC0_CMR.CPCTRG", "Memory", 0xfffa0004, 4, base=16, bitRange=14 +sfr = "TC0_CMR.WAVE", "Memory", 0xfffa0004, 4, base=16, bitRange=15 +sfr = "TC0_CMR.ACPA", "Memory", 0xfffa0004, 4, base=16, bitRange=16-17 +sfr = "TC0_CMR.LDRA", "Memory", 0xfffa0004, 4, base=16, bitRange=16-17 +sfr = "TC0_CMR.ACPC", "Memory", 0xfffa0004, 4, base=16, bitRange=18-19 +sfr = "TC0_CMR.LDRB", "Memory", 0xfffa0004, 4, base=16, bitRange=18-19 +sfr = "TC0_CMR.AEEVT", "Memory", 0xfffa0004, 4, base=16, bitRange=20-21 +sfr = "TC0_CMR.ASWTRG", "Memory", 0xfffa0004, 4, base=16, bitRange=22-23 +sfr = "TC0_CMR.BCPB", "Memory", 0xfffa0004, 4, base=16, bitRange=24-25 +sfr = "TC0_CMR.BCPC", "Memory", 0xfffa0004, 4, base=16, bitRange=26-27 +sfr = "TC0_CMR.BEEVT", "Memory", 0xfffa0004, 4, base=16, bitRange=28-29 +sfr = "TC0_CMR.BSWTRG", "Memory", 0xfffa0004, 4, base=16, bitRange=30-31 +sfr = "TC0_CV", "Memory", 0xfffa0010, 4, base=16 +sfr = "TC0_RA", "Memory", 0xfffa0014, 4, base=16 +sfr = "TC0_RB", "Memory", 0xfffa0018, 4, base=16 +sfr = "TC0_RC", "Memory", 0xfffa001c, 4, base=16 +sfr = "TC0_SR", "Memory", 0xfffa0020, 4, base=16 +sfr = "TC0_SR.COVFS", "Memory", 0xfffa0020, 4, base=16, bitRange=0 +sfr = "TC0_SR.LOVRS", "Memory", 0xfffa0020, 4, base=16, bitRange=1 +sfr = "TC0_SR.CPAS", "Memory", 0xfffa0020, 4, base=16, bitRange=2 +sfr = "TC0_SR.CPBS", "Memory", 0xfffa0020, 4, base=16, bitRange=3 +sfr = "TC0_SR.CPCS", "Memory", 0xfffa0020, 4, base=16, bitRange=4 +sfr = "TC0_SR.LDRAS", "Memory", 0xfffa0020, 4, base=16, bitRange=5 +sfr = "TC0_SR.LDRBS", "Memory", 0xfffa0020, 4, base=16, bitRange=6 +sfr = "TC0_SR.ETRGS", "Memory", 0xfffa0020, 4, base=16, bitRange=7 +sfr = "TC0_SR.CLKSTA", "Memory", 0xfffa0020, 4, base=16, bitRange=16 +sfr = "TC0_SR.MTIOA", "Memory", 0xfffa0020, 4, base=16, bitRange=17 +sfr = "TC0_SR.MTIOB", "Memory", 0xfffa0020, 4, base=16, bitRange=18 +sfr = "TC0_IER", "Memory", 0xfffa0024, 4, base=16 +sfr = "TC0_IER.COVFS", "Memory", 0xfffa0024, 4, base=16, bitRange=0 +sfr = "TC0_IER.LOVRS", "Memory", 0xfffa0024, 4, base=16, bitRange=1 +sfr = "TC0_IER.CPAS", "Memory", 0xfffa0024, 4, base=16, bitRange=2 +sfr = "TC0_IER.CPBS", "Memory", 0xfffa0024, 4, base=16, bitRange=3 +sfr = "TC0_IER.CPCS", "Memory", 0xfffa0024, 4, base=16, bitRange=4 +sfr = "TC0_IER.LDRAS", "Memory", 0xfffa0024, 4, base=16, bitRange=5 +sfr = "TC0_IER.LDRBS", "Memory", 0xfffa0024, 4, base=16, bitRange=6 +sfr = "TC0_IER.ETRGS", "Memory", 0xfffa0024, 4, base=16, bitRange=7 +sfr = "TC0_IDR", "Memory", 0xfffa0028, 4, base=16 +sfr = "TC0_IDR.COVFS", "Memory", 0xfffa0028, 4, base=16, bitRange=0 +sfr = "TC0_IDR.LOVRS", "Memory", 0xfffa0028, 4, base=16, bitRange=1 +sfr = "TC0_IDR.CPAS", "Memory", 0xfffa0028, 4, base=16, bitRange=2 +sfr = "TC0_IDR.CPBS", "Memory", 0xfffa0028, 4, base=16, bitRange=3 +sfr = "TC0_IDR.CPCS", "Memory", 0xfffa0028, 4, base=16, bitRange=4 +sfr = "TC0_IDR.LDRAS", "Memory", 0xfffa0028, 4, base=16, bitRange=5 +sfr = "TC0_IDR.LDRBS", "Memory", 0xfffa0028, 4, base=16, bitRange=6 +sfr = "TC0_IDR.ETRGS", "Memory", 0xfffa0028, 4, base=16, bitRange=7 +sfr = "TC0_IMR", "Memory", 0xfffa002c, 4, base=16 +sfr = "TC0_IMR.COVFS", "Memory", 0xfffa002c, 4, base=16, bitRange=0 +sfr = "TC0_IMR.LOVRS", "Memory", 0xfffa002c, 4, base=16, bitRange=1 +sfr = "TC0_IMR.CPAS", "Memory", 0xfffa002c, 4, base=16, bitRange=2 +sfr = "TC0_IMR.CPBS", "Memory", 0xfffa002c, 4, base=16, bitRange=3 +sfr = "TC0_IMR.CPCS", "Memory", 0xfffa002c, 4, base=16, bitRange=4 +sfr = "TC0_IMR.LDRAS", "Memory", 0xfffa002c, 4, base=16, bitRange=5 +sfr = "TC0_IMR.LDRBS", "Memory", 0xfffa002c, 4, base=16, bitRange=6 +sfr = "TC0_IMR.ETRGS", "Memory", 0xfffa002c, 4, base=16, bitRange=7 +; ========== Register definition for TC1 peripheral ========== +sfr = "TC1_CCR", "Memory", 0xfffa0040, 4, base=16 +sfr = "TC1_CCR.CLKEN", "Memory", 0xfffa0040, 4, base=16, bitRange=0 +sfr = "TC1_CCR.CLKDIS", "Memory", 0xfffa0040, 4, base=16, bitRange=1 +sfr = "TC1_CCR.SWTRG", "Memory", 0xfffa0040, 4, base=16, bitRange=2 +sfr = "TC1_CMR", "Memory", 0xfffa0044, 4, base=16 +sfr = "TC1_CMR.CLKS", "Memory", 0xfffa0044, 4, base=16, bitRange=0-2 +sfr = "TC1_CMR.CLKI", "Memory", 0xfffa0044, 4, base=16, bitRange=3 +sfr = "TC1_CMR.BURST", "Memory", 0xfffa0044, 4, base=16, bitRange=4-5 +sfr = "TC1_CMR.CPCSTOP", "Memory", 0xfffa0044, 4, base=16, bitRange=6 +sfr = "TC1_CMR.LDBSTOP", "Memory", 0xfffa0044, 4, base=16, bitRange=6 +sfr = "TC1_CMR.CPCDIS", "Memory", 0xfffa0044, 4, base=16, bitRange=7 +sfr = "TC1_CMR.LDBDIS", "Memory", 0xfffa0044, 4, base=16, bitRange=7 +sfr = "TC1_CMR.ETRGEDG", "Memory", 0xfffa0044, 4, base=16, bitRange=8-9 +sfr = "TC1_CMR.EEVTEDG", "Memory", 0xfffa0044, 4, base=16, bitRange=8-9 +sfr = "TC1_CMR.EEVT", "Memory", 0xfffa0044, 4, base=16, bitRange=10-11 +sfr = "TC1_CMR.ABETRG", "Memory", 0xfffa0044, 4, base=16, bitRange=10 +sfr = "TC1_CMR.ENETRG", "Memory", 0xfffa0044, 4, base=16, bitRange=12 +sfr = "TC1_CMR.WAVESEL", "Memory", 0xfffa0044, 4, base=16, bitRange=13-14 +sfr = "TC1_CMR.CPCTRG", "Memory", 0xfffa0044, 4, base=16, bitRange=14 +sfr = "TC1_CMR.WAVE", "Memory", 0xfffa0044, 4, base=16, bitRange=15 +sfr = "TC1_CMR.ACPA", "Memory", 0xfffa0044, 4, base=16, bitRange=16-17 +sfr = "TC1_CMR.LDRA", "Memory", 0xfffa0044, 4, base=16, bitRange=16-17 +sfr = "TC1_CMR.ACPC", "Memory", 0xfffa0044, 4, base=16, bitRange=18-19 +sfr = "TC1_CMR.LDRB", "Memory", 0xfffa0044, 4, base=16, bitRange=18-19 +sfr = "TC1_CMR.AEEVT", "Memory", 0xfffa0044, 4, base=16, bitRange=20-21 +sfr = "TC1_CMR.ASWTRG", "Memory", 0xfffa0044, 4, base=16, bitRange=22-23 +sfr = "TC1_CMR.BCPB", "Memory", 0xfffa0044, 4, base=16, bitRange=24-25 +sfr = "TC1_CMR.BCPC", "Memory", 0xfffa0044, 4, base=16, bitRange=26-27 +sfr = "TC1_CMR.BEEVT", "Memory", 0xfffa0044, 4, base=16, bitRange=28-29 +sfr = "TC1_CMR.BSWTRG", "Memory", 0xfffa0044, 4, base=16, bitRange=30-31 +sfr = "TC1_CV", "Memory", 0xfffa0050, 4, base=16 +sfr = "TC1_RA", "Memory", 0xfffa0054, 4, base=16 +sfr = "TC1_RB", "Memory", 0xfffa0058, 4, base=16 +sfr = "TC1_RC", "Memory", 0xfffa005c, 4, base=16 +sfr = "TC1_SR", "Memory", 0xfffa0060, 4, base=16 +sfr = "TC1_SR.COVFS", "Memory", 0xfffa0060, 4, base=16, bitRange=0 +sfr = "TC1_SR.LOVRS", "Memory", 0xfffa0060, 4, base=16, bitRange=1 +sfr = "TC1_SR.CPAS", "Memory", 0xfffa0060, 4, base=16, bitRange=2 +sfr = "TC1_SR.CPBS", "Memory", 0xfffa0060, 4, base=16, bitRange=3 +sfr = "TC1_SR.CPCS", "Memory", 0xfffa0060, 4, base=16, bitRange=4 +sfr = "TC1_SR.LDRAS", "Memory", 0xfffa0060, 4, base=16, bitRange=5 +sfr = "TC1_SR.LDRBS", "Memory", 0xfffa0060, 4, base=16, bitRange=6 +sfr = "TC1_SR.ETRGS", "Memory", 0xfffa0060, 4, base=16, bitRange=7 +sfr = "TC1_SR.CLKSTA", "Memory", 0xfffa0060, 4, base=16, bitRange=16 +sfr = "TC1_SR.MTIOA", "Memory", 0xfffa0060, 4, base=16, bitRange=17 +sfr = "TC1_SR.MTIOB", "Memory", 0xfffa0060, 4, base=16, bitRange=18 +sfr = "TC1_IER", "Memory", 0xfffa0064, 4, base=16 +sfr = "TC1_IER.COVFS", "Memory", 0xfffa0064, 4, base=16, bitRange=0 +sfr = "TC1_IER.LOVRS", "Memory", 0xfffa0064, 4, base=16, bitRange=1 +sfr = "TC1_IER.CPAS", "Memory", 0xfffa0064, 4, base=16, bitRange=2 +sfr = "TC1_IER.CPBS", "Memory", 0xfffa0064, 4, base=16, bitRange=3 +sfr = "TC1_IER.CPCS", "Memory", 0xfffa0064, 4, base=16, bitRange=4 +sfr = "TC1_IER.LDRAS", "Memory", 0xfffa0064, 4, base=16, bitRange=5 +sfr = "TC1_IER.LDRBS", "Memory", 0xfffa0064, 4, base=16, bitRange=6 +sfr = "TC1_IER.ETRGS", "Memory", 0xfffa0064, 4, base=16, bitRange=7 +sfr = "TC1_IDR", "Memory", 0xfffa0068, 4, base=16 +sfr = "TC1_IDR.COVFS", "Memory", 0xfffa0068, 4, base=16, bitRange=0 +sfr = "TC1_IDR.LOVRS", "Memory", 0xfffa0068, 4, base=16, bitRange=1 +sfr = "TC1_IDR.CPAS", "Memory", 0xfffa0068, 4, base=16, bitRange=2 +sfr = "TC1_IDR.CPBS", "Memory", 0xfffa0068, 4, base=16, bitRange=3 +sfr = "TC1_IDR.CPCS", "Memory", 0xfffa0068, 4, base=16, bitRange=4 +sfr = "TC1_IDR.LDRAS", "Memory", 0xfffa0068, 4, base=16, bitRange=5 +sfr = "TC1_IDR.LDRBS", "Memory", 0xfffa0068, 4, base=16, bitRange=6 +sfr = "TC1_IDR.ETRGS", "Memory", 0xfffa0068, 4, base=16, bitRange=7 +sfr = "TC1_IMR", "Memory", 0xfffa006c, 4, base=16 +sfr = "TC1_IMR.COVFS", "Memory", 0xfffa006c, 4, base=16, bitRange=0 +sfr = "TC1_IMR.LOVRS", "Memory", 0xfffa006c, 4, base=16, bitRange=1 +sfr = "TC1_IMR.CPAS", "Memory", 0xfffa006c, 4, base=16, bitRange=2 +sfr = "TC1_IMR.CPBS", "Memory", 0xfffa006c, 4, base=16, bitRange=3 +sfr = "TC1_IMR.CPCS", "Memory", 0xfffa006c, 4, base=16, bitRange=4 +sfr = "TC1_IMR.LDRAS", "Memory", 0xfffa006c, 4, base=16, bitRange=5 +sfr = "TC1_IMR.LDRBS", "Memory", 0xfffa006c, 4, base=16, bitRange=6 +sfr = "TC1_IMR.ETRGS", "Memory", 0xfffa006c, 4, base=16, bitRange=7 +; ========== Register definition for TC2 peripheral ========== +sfr = "TC2_CCR", "Memory", 0xfffa0080, 4, base=16 +sfr = "TC2_CCR.CLKEN", "Memory", 0xfffa0080, 4, base=16, bitRange=0 +sfr = "TC2_CCR.CLKDIS", "Memory", 0xfffa0080, 4, base=16, bitRange=1 +sfr = "TC2_CCR.SWTRG", "Memory", 0xfffa0080, 4, base=16, bitRange=2 +sfr = "TC2_CMR", "Memory", 0xfffa0084, 4, base=16 +sfr = "TC2_CMR.CLKS", "Memory", 0xfffa0084, 4, base=16, bitRange=0-2 +sfr = "TC2_CMR.CLKI", "Memory", 0xfffa0084, 4, base=16, bitRange=3 +sfr = "TC2_CMR.BURST", "Memory", 0xfffa0084, 4, base=16, bitRange=4-5 +sfr = "TC2_CMR.CPCSTOP", "Memory", 0xfffa0084, 4, base=16, bitRange=6 +sfr = "TC2_CMR.LDBSTOP", "Memory", 0xfffa0084, 4, base=16, bitRange=6 +sfr = "TC2_CMR.CPCDIS", "Memory", 0xfffa0084, 4, base=16, bitRange=7 +sfr = "TC2_CMR.LDBDIS", "Memory", 0xfffa0084, 4, base=16, bitRange=7 +sfr = "TC2_CMR.ETRGEDG", "Memory", 0xfffa0084, 4, base=16, bitRange=8-9 +sfr = "TC2_CMR.EEVTEDG", "Memory", 0xfffa0084, 4, base=16, bitRange=8-9 +sfr = "TC2_CMR.EEVT", "Memory", 0xfffa0084, 4, base=16, bitRange=10-11 +sfr = "TC2_CMR.ABETRG", "Memory", 0xfffa0084, 4, base=16, bitRange=10 +sfr = "TC2_CMR.ENETRG", "Memory", 0xfffa0084, 4, base=16, bitRange=12 +sfr = "TC2_CMR.WAVESEL", "Memory", 0xfffa0084, 4, base=16, bitRange=13-14 +sfr = "TC2_CMR.CPCTRG", "Memory", 0xfffa0084, 4, base=16, bitRange=14 +sfr = "TC2_CMR.WAVE", "Memory", 0xfffa0084, 4, base=16, bitRange=15 +sfr = "TC2_CMR.ACPA", "Memory", 0xfffa0084, 4, base=16, bitRange=16-17 +sfr = "TC2_CMR.LDRA", "Memory", 0xfffa0084, 4, base=16, bitRange=16-17 +sfr = "TC2_CMR.ACPC", "Memory", 0xfffa0084, 4, base=16, bitRange=18-19 +sfr = "TC2_CMR.LDRB", "Memory", 0xfffa0084, 4, base=16, bitRange=18-19 +sfr = "TC2_CMR.AEEVT", "Memory", 0xfffa0084, 4, base=16, bitRange=20-21 +sfr = "TC2_CMR.ASWTRG", "Memory", 0xfffa0084, 4, base=16, bitRange=22-23 +sfr = "TC2_CMR.BCPB", "Memory", 0xfffa0084, 4, base=16, bitRange=24-25 +sfr = "TC2_CMR.BCPC", "Memory", 0xfffa0084, 4, base=16, bitRange=26-27 +sfr = "TC2_CMR.BEEVT", "Memory", 0xfffa0084, 4, base=16, bitRange=28-29 +sfr = "TC2_CMR.BSWTRG", "Memory", 0xfffa0084, 4, base=16, bitRange=30-31 +sfr = "TC2_CV", "Memory", 0xfffa0090, 4, base=16 +sfr = "TC2_RA", "Memory", 0xfffa0094, 4, base=16 +sfr = "TC2_RB", "Memory", 0xfffa0098, 4, base=16 +sfr = "TC2_RC", "Memory", 0xfffa009c, 4, base=16 +sfr = "TC2_SR", "Memory", 0xfffa00a0, 4, base=16 +sfr = "TC2_SR.COVFS", "Memory", 0xfffa00a0, 4, base=16, bitRange=0 +sfr = "TC2_SR.LOVRS", "Memory", 0xfffa00a0, 4, base=16, bitRange=1 +sfr = "TC2_SR.CPAS", "Memory", 0xfffa00a0, 4, base=16, bitRange=2 +sfr = "TC2_SR.CPBS", "Memory", 0xfffa00a0, 4, base=16, bitRange=3 +sfr = "TC2_SR.CPCS", "Memory", 0xfffa00a0, 4, base=16, bitRange=4 +sfr = "TC2_SR.LDRAS", "Memory", 0xfffa00a0, 4, base=16, bitRange=5 +sfr = "TC2_SR.LDRBS", "Memory", 0xfffa00a0, 4, base=16, bitRange=6 +sfr = "TC2_SR.ETRGS", "Memory", 0xfffa00a0, 4, base=16, bitRange=7 +sfr = "TC2_SR.CLKSTA", "Memory", 0xfffa00a0, 4, base=16, bitRange=16 +sfr = "TC2_SR.MTIOA", "Memory", 0xfffa00a0, 4, base=16, bitRange=17 +sfr = "TC2_SR.MTIOB", "Memory", 0xfffa00a0, 4, base=16, bitRange=18 +sfr = "TC2_IER", "Memory", 0xfffa00a4, 4, base=16 +sfr = "TC2_IER.COVFS", "Memory", 0xfffa00a4, 4, base=16, bitRange=0 +sfr = "TC2_IER.LOVRS", "Memory", 0xfffa00a4, 4, base=16, bitRange=1 +sfr = "TC2_IER.CPAS", "Memory", 0xfffa00a4, 4, base=16, bitRange=2 +sfr = "TC2_IER.CPBS", "Memory", 0xfffa00a4, 4, base=16, bitRange=3 +sfr = "TC2_IER.CPCS", "Memory", 0xfffa00a4, 4, base=16, bitRange=4 +sfr = "TC2_IER.LDRAS", "Memory", 0xfffa00a4, 4, base=16, bitRange=5 +sfr = "TC2_IER.LDRBS", "Memory", 0xfffa00a4, 4, base=16, bitRange=6 +sfr = "TC2_IER.ETRGS", "Memory", 0xfffa00a4, 4, base=16, bitRange=7 +sfr = "TC2_IDR", "Memory", 0xfffa00a8, 4, base=16 +sfr = "TC2_IDR.COVFS", "Memory", 0xfffa00a8, 4, base=16, bitRange=0 +sfr = "TC2_IDR.LOVRS", "Memory", 0xfffa00a8, 4, base=16, bitRange=1 +sfr = "TC2_IDR.CPAS", "Memory", 0xfffa00a8, 4, base=16, bitRange=2 +sfr = "TC2_IDR.CPBS", "Memory", 0xfffa00a8, 4, base=16, bitRange=3 +sfr = "TC2_IDR.CPCS", "Memory", 0xfffa00a8, 4, base=16, bitRange=4 +sfr = "TC2_IDR.LDRAS", "Memory", 0xfffa00a8, 4, base=16, bitRange=5 +sfr = "TC2_IDR.LDRBS", "Memory", 0xfffa00a8, 4, base=16, bitRange=6 +sfr = "TC2_IDR.ETRGS", "Memory", 0xfffa00a8, 4, base=16, bitRange=7 +sfr = "TC2_IMR", "Memory", 0xfffa00ac, 4, base=16 +sfr = "TC2_IMR.COVFS", "Memory", 0xfffa00ac, 4, base=16, bitRange=0 +sfr = "TC2_IMR.LOVRS", "Memory", 0xfffa00ac, 4, base=16, bitRange=1 +sfr = "TC2_IMR.CPAS", "Memory", 0xfffa00ac, 4, base=16, bitRange=2 +sfr = "TC2_IMR.CPBS", "Memory", 0xfffa00ac, 4, base=16, bitRange=3 +sfr = "TC2_IMR.CPCS", "Memory", 0xfffa00ac, 4, base=16, bitRange=4 +sfr = "TC2_IMR.LDRAS", "Memory", 0xfffa00ac, 4, base=16, bitRange=5 +sfr = "TC2_IMR.LDRBS", "Memory", 0xfffa00ac, 4, base=16, bitRange=6 +sfr = "TC2_IMR.ETRGS", "Memory", 0xfffa00ac, 4, base=16, bitRange=7 +; ========== Register definition for TCB peripheral ========== +sfr = "TCB_BCR", "Memory", 0xfffa00c0, 4, base=16 +sfr = "TCB_BCR.SYNC", "Memory", 0xfffa00c0, 4, base=16, bitRange=0 +sfr = "TCB_BMR", "Memory", 0xfffa00c4, 4, base=16 +sfr = "TCB_BMR.TC0XC0S", "Memory", 0xfffa00c4, 4, base=16, bitRange=0-1 +sfr = "TCB_BMR.TC1XC1S", "Memory", 0xfffa00c4, 4, base=16, bitRange=2-3 +sfr = "TCB_BMR.TC2XC2S", "Memory", 0xfffa00c4, 4, base=16, bitRange=4-5 +; ========== Register definition for CAN_MB0 peripheral ========== +sfr = "CAN_MB0_MMR", "Memory", 0xfffd0200, 4, base=16 +sfr = "CAN_MB0_MMR.MTIMEMARK", "Memory", 0xfffd0200, 4, base=16, bitRange=0-15 +sfr = "CAN_MB0_MMR.PRIOR", "Memory", 0xfffd0200, 4, base=16, bitRange=16-19 +sfr = "CAN_MB0_MMR.MOT", "Memory", 0xfffd0200, 4, base=16, bitRange=24-26 +sfr = "CAN_MB0_MAM", "Memory", 0xfffd0204, 4, base=16 +sfr = "CAN_MB0_MAM.MIDvB", "Memory", 0xfffd0204, 4, base=16, bitRange=0-17 +sfr = "CAN_MB0_MAM.MIDvA", "Memory", 0xfffd0204, 4, base=16, bitRange=18-28 +sfr = "CAN_MB0_MAM.MIDE", "Memory", 0xfffd0204, 4, base=16, bitRange=29 +sfr = "CAN_MB0_MID", "Memory", 0xfffd0208, 4, base=16 +sfr = "CAN_MB0_MID.MIDvB", "Memory", 0xfffd0208, 4, base=16, bitRange=0-17 +sfr = "CAN_MB0_MID.MIDvA", "Memory", 0xfffd0208, 4, base=16, bitRange=18-28 +sfr = "CAN_MB0_MID.MIDE", "Memory", 0xfffd0208, 4, base=16, bitRange=29 +sfr = "CAN_MB0_MFID", "Memory", 0xfffd020c, 4, base=16 +sfr = "CAN_MB0_MSR", "Memory", 0xfffd0210, 4, base=16 +sfr = "CAN_MB0_MSR.MTIMESTAMP", "Memory", 0xfffd0210, 4, base=16, bitRange=0-15 +sfr = "CAN_MB0_MSR.MDLC", "Memory", 0xfffd0210, 4, base=16, bitRange=16-19 +sfr = "CAN_MB0_MSR.MRTR", "Memory", 0xfffd0210, 4, base=16, bitRange=20 +sfr = "CAN_MB0_MSR.MABT", "Memory", 0xfffd0210, 4, base=16, bitRange=22 +sfr = "CAN_MB0_MSR.MRDY", "Memory", 0xfffd0210, 4, base=16, bitRange=23 +sfr = "CAN_MB0_MSR.MMI", "Memory", 0xfffd0210, 4, base=16, bitRange=24 +sfr = "CAN_MB0_MDL", "Memory", 0xfffd0214, 4, base=16 +sfr = "CAN_MB0_MDH", "Memory", 0xfffd0218, 4, base=16 +sfr = "CAN_MB0_MCR", "Memory", 0xfffd021c, 4, base=16 +sfr = "CAN_MB0_MCR.MDLC", "Memory", 0xfffd021c, 4, base=16, bitRange=16-19 +sfr = "CAN_MB0_MCR.MRTR", "Memory", 0xfffd021c, 4, base=16, bitRange=20 +sfr = "CAN_MB0_MCR.MACR", "Memory", 0xfffd021c, 4, base=16, bitRange=22 +sfr = "CAN_MB0_MCR.MTCR", "Memory", 0xfffd021c, 4, base=16, bitRange=23 +; ========== Register definition for CAN_MB1 peripheral ========== +sfr = "CAN_MB1_MMR", "Memory", 0xfffd0220, 4, base=16 +sfr = "CAN_MB1_MMR.MTIMEMARK", "Memory", 0xfffd0220, 4, base=16, bitRange=0-15 +sfr = "CAN_MB1_MMR.PRIOR", "Memory", 0xfffd0220, 4, base=16, bitRange=16-19 +sfr = "CAN_MB1_MMR.MOT", "Memory", 0xfffd0220, 4, base=16, bitRange=24-26 +sfr = "CAN_MB1_MAM", "Memory", 0xfffd0224, 4, base=16 +sfr = "CAN_MB1_MAM.MIDvB", "Memory", 0xfffd0224, 4, base=16, bitRange=0-17 +sfr = "CAN_MB1_MAM.MIDvA", "Memory", 0xfffd0224, 4, base=16, bitRange=18-28 +sfr = "CAN_MB1_MAM.MIDE", "Memory", 0xfffd0224, 4, base=16, bitRange=29 +sfr = "CAN_MB1_MID", "Memory", 0xfffd0228, 4, base=16 +sfr = "CAN_MB1_MID.MIDvB", "Memory", 0xfffd0228, 4, base=16, bitRange=0-17 +sfr = "CAN_MB1_MID.MIDvA", "Memory", 0xfffd0228, 4, base=16, bitRange=18-28 +sfr = "CAN_MB1_MID.MIDE", "Memory", 0xfffd0228, 4, base=16, bitRange=29 +sfr = "CAN_MB1_MFID", "Memory", 0xfffd022c, 4, base=16 +sfr = "CAN_MB1_MSR", "Memory", 0xfffd0230, 4, base=16 +sfr = "CAN_MB1_MSR.MTIMESTAMP", "Memory", 0xfffd0230, 4, base=16, bitRange=0-15 +sfr = "CAN_MB1_MSR.MDLC", "Memory", 0xfffd0230, 4, base=16, bitRange=16-19 +sfr = "CAN_MB1_MSR.MRTR", "Memory", 0xfffd0230, 4, base=16, bitRange=20 +sfr = "CAN_MB1_MSR.MABT", "Memory", 0xfffd0230, 4, base=16, bitRange=22 +sfr = "CAN_MB1_MSR.MRDY", "Memory", 0xfffd0230, 4, base=16, bitRange=23 +sfr = "CAN_MB1_MSR.MMI", "Memory", 0xfffd0230, 4, base=16, bitRange=24 +sfr = "CAN_MB1_MDL", "Memory", 0xfffd0234, 4, base=16 +sfr = "CAN_MB1_MDH", "Memory", 0xfffd0238, 4, base=16 +sfr = "CAN_MB1_MCR", "Memory", 0xfffd023c, 4, base=16 +sfr = "CAN_MB1_MCR.MDLC", "Memory", 0xfffd023c, 4, base=16, bitRange=16-19 +sfr = "CAN_MB1_MCR.MRTR", "Memory", 0xfffd023c, 4, base=16, bitRange=20 +sfr = "CAN_MB1_MCR.MACR", "Memory", 0xfffd023c, 4, base=16, bitRange=22 +sfr = "CAN_MB1_MCR.MTCR", "Memory", 0xfffd023c, 4, base=16, bitRange=23 +; ========== Register definition for CAN_MB2 peripheral ========== +sfr = "CAN_MB2_MMR", "Memory", 0xfffd0240, 4, base=16 +sfr = "CAN_MB2_MMR.MTIMEMARK", "Memory", 0xfffd0240, 4, base=16, bitRange=0-15 +sfr = "CAN_MB2_MMR.PRIOR", "Memory", 0xfffd0240, 4, base=16, bitRange=16-19 +sfr = "CAN_MB2_MMR.MOT", "Memory", 0xfffd0240, 4, base=16, bitRange=24-26 +sfr = "CAN_MB2_MAM", "Memory", 0xfffd0244, 4, base=16 +sfr = "CAN_MB2_MAM.MIDvB", "Memory", 0xfffd0244, 4, base=16, bitRange=0-17 +sfr = "CAN_MB2_MAM.MIDvA", "Memory", 0xfffd0244, 4, base=16, bitRange=18-28 +sfr = "CAN_MB2_MAM.MIDE", "Memory", 0xfffd0244, 4, base=16, bitRange=29 +sfr = "CAN_MB2_MID", "Memory", 0xfffd0248, 4, base=16 +sfr = "CAN_MB2_MID.MIDvB", "Memory", 0xfffd0248, 4, base=16, bitRange=0-17 +sfr = "CAN_MB2_MID.MIDvA", "Memory", 0xfffd0248, 4, base=16, bitRange=18-28 +sfr = "CAN_MB2_MID.MIDE", "Memory", 0xfffd0248, 4, base=16, bitRange=29 +sfr = "CAN_MB2_MFID", "Memory", 0xfffd024c, 4, base=16 +sfr = "CAN_MB2_MSR", "Memory", 0xfffd0250, 4, base=16 +sfr = "CAN_MB2_MSR.MTIMESTAMP", "Memory", 0xfffd0250, 4, base=16, bitRange=0-15 +sfr = "CAN_MB2_MSR.MDLC", "Memory", 0xfffd0250, 4, base=16, bitRange=16-19 +sfr = "CAN_MB2_MSR.MRTR", "Memory", 0xfffd0250, 4, base=16, bitRange=20 +sfr = "CAN_MB2_MSR.MABT", "Memory", 0xfffd0250, 4, base=16, bitRange=22 +sfr = "CAN_MB2_MSR.MRDY", "Memory", 0xfffd0250, 4, base=16, bitRange=23 +sfr = "CAN_MB2_MSR.MMI", "Memory", 0xfffd0250, 4, base=16, bitRange=24 +sfr = "CAN_MB2_MDL", "Memory", 0xfffd0254, 4, base=16 +sfr = "CAN_MB2_MDH", "Memory", 0xfffd0258, 4, base=16 +sfr = "CAN_MB2_MCR", "Memory", 0xfffd025c, 4, base=16 +sfr = "CAN_MB2_MCR.MDLC", "Memory", 0xfffd025c, 4, base=16, bitRange=16-19 +sfr = "CAN_MB2_MCR.MRTR", "Memory", 0xfffd025c, 4, base=16, bitRange=20 +sfr = "CAN_MB2_MCR.MACR", "Memory", 0xfffd025c, 4, base=16, bitRange=22 +sfr = "CAN_MB2_MCR.MTCR", "Memory", 0xfffd025c, 4, base=16, bitRange=23 +; ========== Register definition for CAN_MB3 peripheral ========== +sfr = "CAN_MB3_MMR", "Memory", 0xfffd0260, 4, base=16 +sfr = "CAN_MB3_MMR.MTIMEMARK", "Memory", 0xfffd0260, 4, base=16, bitRange=0-15 +sfr = "CAN_MB3_MMR.PRIOR", "Memory", 0xfffd0260, 4, base=16, bitRange=16-19 +sfr = "CAN_MB3_MMR.MOT", "Memory", 0xfffd0260, 4, base=16, bitRange=24-26 +sfr = "CAN_MB3_MAM", "Memory", 0xfffd0264, 4, base=16 +sfr = "CAN_MB3_MAM.MIDvB", "Memory", 0xfffd0264, 4, base=16, bitRange=0-17 +sfr = "CAN_MB3_MAM.MIDvA", "Memory", 0xfffd0264, 4, base=16, bitRange=18-28 +sfr = "CAN_MB3_MAM.MIDE", "Memory", 0xfffd0264, 4, base=16, bitRange=29 +sfr = "CAN_MB3_MID", "Memory", 0xfffd0268, 4, base=16 +sfr = "CAN_MB3_MID.MIDvB", "Memory", 0xfffd0268, 4, base=16, bitRange=0-17 +sfr = "CAN_MB3_MID.MIDvA", "Memory", 0xfffd0268, 4, base=16, bitRange=18-28 +sfr = "CAN_MB3_MID.MIDE", "Memory", 0xfffd0268, 4, base=16, bitRange=29 +sfr = "CAN_MB3_MFID", "Memory", 0xfffd026c, 4, base=16 +sfr = "CAN_MB3_MSR", "Memory", 0xfffd0270, 4, base=16 +sfr = "CAN_MB3_MSR.MTIMESTAMP", "Memory", 0xfffd0270, 4, base=16, bitRange=0-15 +sfr = "CAN_MB3_MSR.MDLC", "Memory", 0xfffd0270, 4, base=16, bitRange=16-19 +sfr = "CAN_MB3_MSR.MRTR", "Memory", 0xfffd0270, 4, base=16, bitRange=20 +sfr = "CAN_MB3_MSR.MABT", "Memory", 0xfffd0270, 4, base=16, bitRange=22 +sfr = "CAN_MB3_MSR.MRDY", "Memory", 0xfffd0270, 4, base=16, bitRange=23 +sfr = "CAN_MB3_MSR.MMI", "Memory", 0xfffd0270, 4, base=16, bitRange=24 +sfr = "CAN_MB3_MDL", "Memory", 0xfffd0274, 4, base=16 +sfr = "CAN_MB3_MDH", "Memory", 0xfffd0278, 4, base=16 +sfr = "CAN_MB3_MCR", "Memory", 0xfffd027c, 4, base=16 +sfr = "CAN_MB3_MCR.MDLC", "Memory", 0xfffd027c, 4, base=16, bitRange=16-19 +sfr = "CAN_MB3_MCR.MRTR", "Memory", 0xfffd027c, 4, base=16, bitRange=20 +sfr = "CAN_MB3_MCR.MACR", "Memory", 0xfffd027c, 4, base=16, bitRange=22 +sfr = "CAN_MB3_MCR.MTCR", "Memory", 0xfffd027c, 4, base=16, bitRange=23 +; ========== Register definition for CAN_MB4 peripheral ========== +sfr = "CAN_MB4_MMR", "Memory", 0xfffd0280, 4, base=16 +sfr = "CAN_MB4_MMR.MTIMEMARK", "Memory", 0xfffd0280, 4, base=16, bitRange=0-15 +sfr = "CAN_MB4_MMR.PRIOR", "Memory", 0xfffd0280, 4, base=16, bitRange=16-19 +sfr = "CAN_MB4_MMR.MOT", "Memory", 0xfffd0280, 4, base=16, bitRange=24-26 +sfr = "CAN_MB4_MAM", "Memory", 0xfffd0284, 4, base=16 +sfr = "CAN_MB4_MAM.MIDvB", "Memory", 0xfffd0284, 4, base=16, bitRange=0-17 +sfr = "CAN_MB4_MAM.MIDvA", "Memory", 0xfffd0284, 4, base=16, bitRange=18-28 +sfr = "CAN_MB4_MAM.MIDE", "Memory", 0xfffd0284, 4, base=16, bitRange=29 +sfr = "CAN_MB4_MID", "Memory", 0xfffd0288, 4, base=16 +sfr = "CAN_MB4_MID.MIDvB", "Memory", 0xfffd0288, 4, base=16, bitRange=0-17 +sfr = "CAN_MB4_MID.MIDvA", "Memory", 0xfffd0288, 4, base=16, bitRange=18-28 +sfr = "CAN_MB4_MID.MIDE", "Memory", 0xfffd0288, 4, base=16, bitRange=29 +sfr = "CAN_MB4_MFID", "Memory", 0xfffd028c, 4, base=16 +sfr = "CAN_MB4_MSR", "Memory", 0xfffd0290, 4, base=16 +sfr = "CAN_MB4_MSR.MTIMESTAMP", "Memory", 0xfffd0290, 4, base=16, bitRange=0-15 +sfr = "CAN_MB4_MSR.MDLC", "Memory", 0xfffd0290, 4, base=16, bitRange=16-19 +sfr = "CAN_MB4_MSR.MRTR", "Memory", 0xfffd0290, 4, base=16, bitRange=20 +sfr = "CAN_MB4_MSR.MABT", "Memory", 0xfffd0290, 4, base=16, bitRange=22 +sfr = "CAN_MB4_MSR.MRDY", "Memory", 0xfffd0290, 4, base=16, bitRange=23 +sfr = "CAN_MB4_MSR.MMI", "Memory", 0xfffd0290, 4, base=16, bitRange=24 +sfr = "CAN_MB4_MDL", "Memory", 0xfffd0294, 4, base=16 +sfr = "CAN_MB4_MDH", "Memory", 0xfffd0298, 4, base=16 +sfr = "CAN_MB4_MCR", "Memory", 0xfffd029c, 4, base=16 +sfr = "CAN_MB4_MCR.MDLC", "Memory", 0xfffd029c, 4, base=16, bitRange=16-19 +sfr = "CAN_MB4_MCR.MRTR", "Memory", 0xfffd029c, 4, base=16, bitRange=20 +sfr = "CAN_MB4_MCR.MACR", "Memory", 0xfffd029c, 4, base=16, bitRange=22 +sfr = "CAN_MB4_MCR.MTCR", "Memory", 0xfffd029c, 4, base=16, bitRange=23 +; ========== Register definition for CAN_MB5 peripheral ========== +sfr = "CAN_MB5_MMR", "Memory", 0xfffd02a0, 4, base=16 +sfr = "CAN_MB5_MMR.MTIMEMARK", "Memory", 0xfffd02a0, 4, base=16, bitRange=0-15 +sfr = "CAN_MB5_MMR.PRIOR", "Memory", 0xfffd02a0, 4, base=16, bitRange=16-19 +sfr = "CAN_MB5_MMR.MOT", "Memory", 0xfffd02a0, 4, base=16, bitRange=24-26 +sfr = "CAN_MB5_MAM", "Memory", 0xfffd02a4, 4, base=16 +sfr = "CAN_MB5_MAM.MIDvB", "Memory", 0xfffd02a4, 4, base=16, bitRange=0-17 +sfr = "CAN_MB5_MAM.MIDvA", "Memory", 0xfffd02a4, 4, base=16, bitRange=18-28 +sfr = "CAN_MB5_MAM.MIDE", "Memory", 0xfffd02a4, 4, base=16, bitRange=29 +sfr = "CAN_MB5_MID", "Memory", 0xfffd02a8, 4, base=16 +sfr = "CAN_MB5_MID.MIDvB", "Memory", 0xfffd02a8, 4, base=16, bitRange=0-17 +sfr = "CAN_MB5_MID.MIDvA", "Memory", 0xfffd02a8, 4, base=16, bitRange=18-28 +sfr = "CAN_MB5_MID.MIDE", "Memory", 0xfffd02a8, 4, base=16, bitRange=29 +sfr = "CAN_MB5_MFID", "Memory", 0xfffd02ac, 4, base=16 +sfr = "CAN_MB5_MSR", "Memory", 0xfffd02b0, 4, base=16 +sfr = "CAN_MB5_MSR.MTIMESTAMP", "Memory", 0xfffd02b0, 4, base=16, bitRange=0-15 +sfr = "CAN_MB5_MSR.MDLC", "Memory", 0xfffd02b0, 4, base=16, bitRange=16-19 +sfr = "CAN_MB5_MSR.MRTR", "Memory", 0xfffd02b0, 4, base=16, bitRange=20 +sfr = "CAN_MB5_MSR.MABT", "Memory", 0xfffd02b0, 4, base=16, bitRange=22 +sfr = "CAN_MB5_MSR.MRDY", "Memory", 0xfffd02b0, 4, base=16, bitRange=23 +sfr = "CAN_MB5_MSR.MMI", "Memory", 0xfffd02b0, 4, base=16, bitRange=24 +sfr = "CAN_MB5_MDL", "Memory", 0xfffd02b4, 4, base=16 +sfr = "CAN_MB5_MDH", "Memory", 0xfffd02b8, 4, base=16 +sfr = "CAN_MB5_MCR", "Memory", 0xfffd02bc, 4, base=16 +sfr = "CAN_MB5_MCR.MDLC", "Memory", 0xfffd02bc, 4, base=16, bitRange=16-19 +sfr = "CAN_MB5_MCR.MRTR", "Memory", 0xfffd02bc, 4, base=16, bitRange=20 +sfr = "CAN_MB5_MCR.MACR", "Memory", 0xfffd02bc, 4, base=16, bitRange=22 +sfr = "CAN_MB5_MCR.MTCR", "Memory", 0xfffd02bc, 4, base=16, bitRange=23 +; ========== Register definition for CAN_MB6 peripheral ========== +sfr = "CAN_MB6_MMR", "Memory", 0xfffd02c0, 4, base=16 +sfr = "CAN_MB6_MMR.MTIMEMARK", "Memory", 0xfffd02c0, 4, base=16, bitRange=0-15 +sfr = "CAN_MB6_MMR.PRIOR", "Memory", 0xfffd02c0, 4, base=16, bitRange=16-19 +sfr = "CAN_MB6_MMR.MOT", "Memory", 0xfffd02c0, 4, base=16, bitRange=24-26 +sfr = "CAN_MB6_MAM", "Memory", 0xfffd02c4, 4, base=16 +sfr = "CAN_MB6_MAM.MIDvB", "Memory", 0xfffd02c4, 4, base=16, bitRange=0-17 +sfr = "CAN_MB6_MAM.MIDvA", "Memory", 0xfffd02c4, 4, base=16, bitRange=18-28 +sfr = "CAN_MB6_MAM.MIDE", "Memory", 0xfffd02c4, 4, base=16, bitRange=29 +sfr = "CAN_MB6_MID", "Memory", 0xfffd02c8, 4, base=16 +sfr = "CAN_MB6_MID.MIDvB", "Memory", 0xfffd02c8, 4, base=16, bitRange=0-17 +sfr = "CAN_MB6_MID.MIDvA", "Memory", 0xfffd02c8, 4, base=16, bitRange=18-28 +sfr = "CAN_MB6_MID.MIDE", "Memory", 0xfffd02c8, 4, base=16, bitRange=29 +sfr = "CAN_MB6_MFID", "Memory", 0xfffd02cc, 4, base=16 +sfr = "CAN_MB6_MSR", "Memory", 0xfffd02d0, 4, base=16 +sfr = "CAN_MB6_MSR.MTIMESTAMP", "Memory", 0xfffd02d0, 4, base=16, bitRange=0-15 +sfr = "CAN_MB6_MSR.MDLC", "Memory", 0xfffd02d0, 4, base=16, bitRange=16-19 +sfr = "CAN_MB6_MSR.MRTR", "Memory", 0xfffd02d0, 4, base=16, bitRange=20 +sfr = "CAN_MB6_MSR.MABT", "Memory", 0xfffd02d0, 4, base=16, bitRange=22 +sfr = "CAN_MB6_MSR.MRDY", "Memory", 0xfffd02d0, 4, base=16, bitRange=23 +sfr = "CAN_MB6_MSR.MMI", "Memory", 0xfffd02d0, 4, base=16, bitRange=24 +sfr = "CAN_MB6_MDL", "Memory", 0xfffd02d4, 4, base=16 +sfr = "CAN_MB6_MDH", "Memory", 0xfffd02d8, 4, base=16 +sfr = "CAN_MB6_MCR", "Memory", 0xfffd02dc, 4, base=16 +sfr = "CAN_MB6_MCR.MDLC", "Memory", 0xfffd02dc, 4, base=16, bitRange=16-19 +sfr = "CAN_MB6_MCR.MRTR", "Memory", 0xfffd02dc, 4, base=16, bitRange=20 +sfr = "CAN_MB6_MCR.MACR", "Memory", 0xfffd02dc, 4, base=16, bitRange=22 +sfr = "CAN_MB6_MCR.MTCR", "Memory", 0xfffd02dc, 4, base=16, bitRange=23 +; ========== Register definition for CAN_MB7 peripheral ========== +sfr = "CAN_MB7_MMR", "Memory", 0xfffd02e0, 4, base=16 +sfr = "CAN_MB7_MMR.MTIMEMARK", "Memory", 0xfffd02e0, 4, base=16, bitRange=0-15 +sfr = "CAN_MB7_MMR.PRIOR", "Memory", 0xfffd02e0, 4, base=16, bitRange=16-19 +sfr = "CAN_MB7_MMR.MOT", "Memory", 0xfffd02e0, 4, base=16, bitRange=24-26 +sfr = "CAN_MB7_MAM", "Memory", 0xfffd02e4, 4, base=16 +sfr = "CAN_MB7_MAM.MIDvB", "Memory", 0xfffd02e4, 4, base=16, bitRange=0-17 +sfr = "CAN_MB7_MAM.MIDvA", "Memory", 0xfffd02e4, 4, base=16, bitRange=18-28 +sfr = "CAN_MB7_MAM.MIDE", "Memory", 0xfffd02e4, 4, base=16, bitRange=29 +sfr = "CAN_MB7_MID", "Memory", 0xfffd02e8, 4, base=16 +sfr = "CAN_MB7_MID.MIDvB", "Memory", 0xfffd02e8, 4, base=16, bitRange=0-17 +sfr = "CAN_MB7_MID.MIDvA", "Memory", 0xfffd02e8, 4, base=16, bitRange=18-28 +sfr = "CAN_MB7_MID.MIDE", "Memory", 0xfffd02e8, 4, base=16, bitRange=29 +sfr = "CAN_MB7_MFID", "Memory", 0xfffd02ec, 4, base=16 +sfr = "CAN_MB7_MSR", "Memory", 0xfffd02f0, 4, base=16 +sfr = "CAN_MB7_MSR.MTIMESTAMP", "Memory", 0xfffd02f0, 4, base=16, bitRange=0-15 +sfr = "CAN_MB7_MSR.MDLC", "Memory", 0xfffd02f0, 4, base=16, bitRange=16-19 +sfr = "CAN_MB7_MSR.MRTR", "Memory", 0xfffd02f0, 4, base=16, bitRange=20 +sfr = "CAN_MB7_MSR.MABT", "Memory", 0xfffd02f0, 4, base=16, bitRange=22 +sfr = "CAN_MB7_MSR.MRDY", "Memory", 0xfffd02f0, 4, base=16, bitRange=23 +sfr = "CAN_MB7_MSR.MMI", "Memory", 0xfffd02f0, 4, base=16, bitRange=24 +sfr = "CAN_MB7_MDL", "Memory", 0xfffd02f4, 4, base=16 +sfr = "CAN_MB7_MDH", "Memory", 0xfffd02f8, 4, base=16 +sfr = "CAN_MB7_MCR", "Memory", 0xfffd02fc, 4, base=16 +sfr = "CAN_MB7_MCR.MDLC", "Memory", 0xfffd02fc, 4, base=16, bitRange=16-19 +sfr = "CAN_MB7_MCR.MRTR", "Memory", 0xfffd02fc, 4, base=16, bitRange=20 +sfr = "CAN_MB7_MCR.MACR", "Memory", 0xfffd02fc, 4, base=16, bitRange=22 +sfr = "CAN_MB7_MCR.MTCR", "Memory", 0xfffd02fc, 4, base=16, bitRange=23 +; ========== Register definition for CAN peripheral ========== +sfr = "CAN_MR", "Memory", 0xfffd0000, 4, base=16 +sfr = "CAN_MR.CANEN", "Memory", 0xfffd0000, 4, base=16, bitRange=0 +sfr = "CAN_MR.LPM", "Memory", 0xfffd0000, 4, base=16, bitRange=1 +sfr = "CAN_MR.ABM", "Memory", 0xfffd0000, 4, base=16, bitRange=2 +sfr = "CAN_MR.OVL", "Memory", 0xfffd0000, 4, base=16, bitRange=3 +sfr = "CAN_MR.TEOF", "Memory", 0xfffd0000, 4, base=16, bitRange=4 +sfr = "CAN_MR.TTM", "Memory", 0xfffd0000, 4, base=16, bitRange=5 +sfr = "CAN_MR.TIMFRZ", "Memory", 0xfffd0000, 4, base=16, bitRange=6 +sfr = "CAN_MR.DRPT", "Memory", 0xfffd0000, 4, base=16, bitRange=7 +sfr = "CAN_IER", "Memory", 0xfffd0004, 4, base=16 +sfr = "CAN_IER.MB0", "Memory", 0xfffd0004, 4, base=16, bitRange=0 +sfr = "CAN_IER.MB1", "Memory", 0xfffd0004, 4, base=16, bitRange=1 +sfr = "CAN_IER.MB2", "Memory", 0xfffd0004, 4, base=16, bitRange=2 +sfr = "CAN_IER.MB3", "Memory", 0xfffd0004, 4, base=16, bitRange=3 +sfr = "CAN_IER.MB4", "Memory", 0xfffd0004, 4, base=16, bitRange=4 +sfr = "CAN_IER.MB5", "Memory", 0xfffd0004, 4, base=16, bitRange=5 +sfr = "CAN_IER.MB6", "Memory", 0xfffd0004, 4, base=16, bitRange=6 +sfr = "CAN_IER.MB7", "Memory", 0xfffd0004, 4, base=16, bitRange=7 +sfr = "CAN_IER.MB8", "Memory", 0xfffd0004, 4, base=16, bitRange=8 +sfr = "CAN_IER.MB9", "Memory", 0xfffd0004, 4, base=16, bitRange=9 +sfr = "CAN_IER.MB10", "Memory", 0xfffd0004, 4, base=16, bitRange=10 +sfr = "CAN_IER.MB11", "Memory", 0xfffd0004, 4, base=16, bitRange=11 +sfr = "CAN_IER.MB12", "Memory", 0xfffd0004, 4, base=16, bitRange=12 +sfr = "CAN_IER.MB13", "Memory", 0xfffd0004, 4, base=16, bitRange=13 +sfr = "CAN_IER.MB14", "Memory", 0xfffd0004, 4, base=16, bitRange=14 +sfr = "CAN_IER.MB15", "Memory", 0xfffd0004, 4, base=16, bitRange=15 +sfr = "CAN_IER.ERRA", "Memory", 0xfffd0004, 4, base=16, bitRange=16 +sfr = "CAN_IER.WARN", "Memory", 0xfffd0004, 4, base=16, bitRange=17 +sfr = "CAN_IER.ERRP", "Memory", 0xfffd0004, 4, base=16, bitRange=18 +sfr = "CAN_IER.BOFF", "Memory", 0xfffd0004, 4, base=16, bitRange=19 +sfr = "CAN_IER.SLEEP", "Memory", 0xfffd0004, 4, base=16, bitRange=20 +sfr = "CAN_IER.WAKEUP", "Memory", 0xfffd0004, 4, base=16, bitRange=21 +sfr = "CAN_IER.TOVF", "Memory", 0xfffd0004, 4, base=16, bitRange=22 +sfr = "CAN_IER.TSTP", "Memory", 0xfffd0004, 4, base=16, bitRange=23 +sfr = "CAN_IER.CERR", "Memory", 0xfffd0004, 4, base=16, bitRange=24 +sfr = "CAN_IER.SERR", "Memory", 0xfffd0004, 4, base=16, bitRange=25 +sfr = "CAN_IER.AERR", "Memory", 0xfffd0004, 4, base=16, bitRange=26 +sfr = "CAN_IER.FERR", "Memory", 0xfffd0004, 4, base=16, bitRange=27 +sfr = "CAN_IER.BERR", "Memory", 0xfffd0004, 4, base=16, bitRange=28 +sfr = "CAN_IDR", "Memory", 0xfffd0008, 4, base=16 +sfr = "CAN_IDR.MB0", "Memory", 0xfffd0008, 4, base=16, bitRange=0 +sfr = "CAN_IDR.MB1", "Memory", 0xfffd0008, 4, base=16, bitRange=1 +sfr = "CAN_IDR.MB2", "Memory", 0xfffd0008, 4, base=16, bitRange=2 +sfr = "CAN_IDR.MB3", "Memory", 0xfffd0008, 4, base=16, bitRange=3 +sfr = "CAN_IDR.MB4", "Memory", 0xfffd0008, 4, base=16, bitRange=4 +sfr = "CAN_IDR.MB5", "Memory", 0xfffd0008, 4, base=16, bitRange=5 +sfr = "CAN_IDR.MB6", "Memory", 0xfffd0008, 4, base=16, bitRange=6 +sfr = "CAN_IDR.MB7", "Memory", 0xfffd0008, 4, base=16, bitRange=7 +sfr = "CAN_IDR.MB8", "Memory", 0xfffd0008, 4, base=16, bitRange=8 +sfr = "CAN_IDR.MB9", "Memory", 0xfffd0008, 4, base=16, bitRange=9 +sfr = "CAN_IDR.MB10", "Memory", 0xfffd0008, 4, base=16, bitRange=10 +sfr = "CAN_IDR.MB11", "Memory", 0xfffd0008, 4, base=16, bitRange=11 +sfr = "CAN_IDR.MB12", "Memory", 0xfffd0008, 4, base=16, bitRange=12 +sfr = "CAN_IDR.MB13", "Memory", 0xfffd0008, 4, base=16, bitRange=13 +sfr = "CAN_IDR.MB14", "Memory", 0xfffd0008, 4, base=16, bitRange=14 +sfr = "CAN_IDR.MB15", "Memory", 0xfffd0008, 4, base=16, bitRange=15 +sfr = "CAN_IDR.ERRA", "Memory", 0xfffd0008, 4, base=16, bitRange=16 +sfr = "CAN_IDR.WARN", "Memory", 0xfffd0008, 4, base=16, bitRange=17 +sfr = "CAN_IDR.ERRP", "Memory", 0xfffd0008, 4, base=16, bitRange=18 +sfr = "CAN_IDR.BOFF", "Memory", 0xfffd0008, 4, base=16, bitRange=19 +sfr = "CAN_IDR.SLEEP", "Memory", 0xfffd0008, 4, base=16, bitRange=20 +sfr = "CAN_IDR.WAKEUP", "Memory", 0xfffd0008, 4, base=16, bitRange=21 +sfr = "CAN_IDR.TOVF", "Memory", 0xfffd0008, 4, base=16, bitRange=22 +sfr = "CAN_IDR.TSTP", "Memory", 0xfffd0008, 4, base=16, bitRange=23 +sfr = "CAN_IDR.CERR", "Memory", 0xfffd0008, 4, base=16, bitRange=24 +sfr = "CAN_IDR.SERR", "Memory", 0xfffd0008, 4, base=16, bitRange=25 +sfr = "CAN_IDR.AERR", "Memory", 0xfffd0008, 4, base=16, bitRange=26 +sfr = "CAN_IDR.FERR", "Memory", 0xfffd0008, 4, base=16, bitRange=27 +sfr = "CAN_IDR.BERR", "Memory", 0xfffd0008, 4, base=16, bitRange=28 +sfr = "CAN_IMR", "Memory", 0xfffd000c, 4, base=16 +sfr = "CAN_IMR.MB0", "Memory", 0xfffd000c, 4, base=16, bitRange=0 +sfr = "CAN_IMR.MB1", "Memory", 0xfffd000c, 4, base=16, bitRange=1 +sfr = "CAN_IMR.MB2", "Memory", 0xfffd000c, 4, base=16, bitRange=2 +sfr = "CAN_IMR.MB3", "Memory", 0xfffd000c, 4, base=16, bitRange=3 +sfr = "CAN_IMR.MB4", "Memory", 0xfffd000c, 4, base=16, bitRange=4 +sfr = "CAN_IMR.MB5", "Memory", 0xfffd000c, 4, base=16, bitRange=5 +sfr = "CAN_IMR.MB6", "Memory", 0xfffd000c, 4, base=16, bitRange=6 +sfr = "CAN_IMR.MB7", "Memory", 0xfffd000c, 4, base=16, bitRange=7 +sfr = "CAN_IMR.MB8", "Memory", 0xfffd000c, 4, base=16, bitRange=8 +sfr = "CAN_IMR.MB9", "Memory", 0xfffd000c, 4, base=16, bitRange=9 +sfr = "CAN_IMR.MB10", "Memory", 0xfffd000c, 4, base=16, bitRange=10 +sfr = "CAN_IMR.MB11", "Memory", 0xfffd000c, 4, base=16, bitRange=11 +sfr = "CAN_IMR.MB12", "Memory", 0xfffd000c, 4, base=16, bitRange=12 +sfr = "CAN_IMR.MB13", "Memory", 0xfffd000c, 4, base=16, bitRange=13 +sfr = "CAN_IMR.MB14", "Memory", 0xfffd000c, 4, base=16, bitRange=14 +sfr = "CAN_IMR.MB15", "Memory", 0xfffd000c, 4, base=16, bitRange=15 +sfr = "CAN_IMR.ERRA", "Memory", 0xfffd000c, 4, base=16, bitRange=16 +sfr = "CAN_IMR.WARN", "Memory", 0xfffd000c, 4, base=16, bitRange=17 +sfr = "CAN_IMR.ERRP", "Memory", 0xfffd000c, 4, base=16, bitRange=18 +sfr = "CAN_IMR.BOFF", "Memory", 0xfffd000c, 4, base=16, bitRange=19 +sfr = "CAN_IMR.SLEEP", "Memory", 0xfffd000c, 4, base=16, bitRange=20 +sfr = "CAN_IMR.WAKEUP", "Memory", 0xfffd000c, 4, base=16, bitRange=21 +sfr = "CAN_IMR.TOVF", "Memory", 0xfffd000c, 4, base=16, bitRange=22 +sfr = "CAN_IMR.TSTP", "Memory", 0xfffd000c, 4, base=16, bitRange=23 +sfr = "CAN_IMR.CERR", "Memory", 0xfffd000c, 4, base=16, bitRange=24 +sfr = "CAN_IMR.SERR", "Memory", 0xfffd000c, 4, base=16, bitRange=25 +sfr = "CAN_IMR.AERR", "Memory", 0xfffd000c, 4, base=16, bitRange=26 +sfr = "CAN_IMR.FERR", "Memory", 0xfffd000c, 4, base=16, bitRange=27 +sfr = "CAN_IMR.BERR", "Memory", 0xfffd000c, 4, base=16, bitRange=28 +sfr = "CAN_SR", "Memory", 0xfffd0010, 4, base=16 +sfr = "CAN_SR.MB0", "Memory", 0xfffd0010, 4, base=16, bitRange=0 +sfr = "CAN_SR.MB1", "Memory", 0xfffd0010, 4, base=16, bitRange=1 +sfr = "CAN_SR.MB2", "Memory", 0xfffd0010, 4, base=16, bitRange=2 +sfr = "CAN_SR.MB3", "Memory", 0xfffd0010, 4, base=16, bitRange=3 +sfr = "CAN_SR.MB4", "Memory", 0xfffd0010, 4, base=16, bitRange=4 +sfr = "CAN_SR.MB5", "Memory", 0xfffd0010, 4, base=16, bitRange=5 +sfr = "CAN_SR.MB6", "Memory", 0xfffd0010, 4, base=16, bitRange=6 +sfr = "CAN_SR.MB7", "Memory", 0xfffd0010, 4, base=16, bitRange=7 +sfr = "CAN_SR.MB8", "Memory", 0xfffd0010, 4, base=16, bitRange=8 +sfr = "CAN_SR.MB9", "Memory", 0xfffd0010, 4, base=16, bitRange=9 +sfr = "CAN_SR.MB10", "Memory", 0xfffd0010, 4, base=16, bitRange=10 +sfr = "CAN_SR.MB11", "Memory", 0xfffd0010, 4, base=16, bitRange=11 +sfr = "CAN_SR.MB12", "Memory", 0xfffd0010, 4, base=16, bitRange=12 +sfr = "CAN_SR.MB13", "Memory", 0xfffd0010, 4, base=16, bitRange=13 +sfr = "CAN_SR.MB14", "Memory", 0xfffd0010, 4, base=16, bitRange=14 +sfr = "CAN_SR.MB15", "Memory", 0xfffd0010, 4, base=16, bitRange=15 +sfr = "CAN_SR.ERRA", "Memory", 0xfffd0010, 4, base=16, bitRange=16 +sfr = "CAN_SR.WARN", "Memory", 0xfffd0010, 4, base=16, bitRange=17 +sfr = "CAN_SR.ERRP", "Memory", 0xfffd0010, 4, base=16, bitRange=18 +sfr = "CAN_SR.BOFF", "Memory", 0xfffd0010, 4, base=16, bitRange=19 +sfr = "CAN_SR.SLEEP", "Memory", 0xfffd0010, 4, base=16, bitRange=20 +sfr = "CAN_SR.WAKEUP", "Memory", 0xfffd0010, 4, base=16, bitRange=21 +sfr = "CAN_SR.TOVF", "Memory", 0xfffd0010, 4, base=16, bitRange=22 +sfr = "CAN_SR.TSTP", "Memory", 0xfffd0010, 4, base=16, bitRange=23 +sfr = "CAN_SR.CERR", "Memory", 0xfffd0010, 4, base=16, bitRange=24 +sfr = "CAN_SR.SERR", "Memory", 0xfffd0010, 4, base=16, bitRange=25 +sfr = "CAN_SR.AERR", "Memory", 0xfffd0010, 4, base=16, bitRange=26 +sfr = "CAN_SR.FERR", "Memory", 0xfffd0010, 4, base=16, bitRange=27 +sfr = "CAN_SR.BERR", "Memory", 0xfffd0010, 4, base=16, bitRange=28 +sfr = "CAN_SR.RBSY", "Memory", 0xfffd0010, 4, base=16, bitRange=29 +sfr = "CAN_SR.TBSY", "Memory", 0xfffd0010, 4, base=16, bitRange=30 +sfr = "CAN_SR.OVLY", "Memory", 0xfffd0010, 4, base=16, bitRange=31 +sfr = "CAN_BR", "Memory", 0xfffd0014, 4, base=16 +sfr = "CAN_BR.PHASE2", "Memory", 0xfffd0014, 4, base=16, bitRange=0-2 +sfr = "CAN_BR.PHASE1", "Memory", 0xfffd0014, 4, base=16, bitRange=4-6 +sfr = "CAN_BR.PROPAG", "Memory", 0xfffd0014, 4, base=16, bitRange=8-10 +sfr = "CAN_BR.SYNC", "Memory", 0xfffd0014, 4, base=16, bitRange=12-13 +sfr = "CAN_BR.BRP", "Memory", 0xfffd0014, 4, base=16, bitRange=16-22 +sfr = "CAN_BR.SMP", "Memory", 0xfffd0014, 4, base=16, bitRange=24 +sfr = "CAN_TIM", "Memory", 0xfffd0018, 4, base=16 +sfr = "CAN_TIM.TIMER", "Memory", 0xfffd0018, 4, base=16, bitRange=0-15 +sfr = "CAN_TIMESTP", "Memory", 0xfffd001c, 4, base=16 +sfr = "CAN_TIMESTP.MTIMESTAMP", "Memory", 0xfffd001c, 4, base=16, bitRange=0-15 +sfr = "CAN_ECR", "Memory", 0xfffd0020, 4, base=16 +sfr = "CAN_ECR.REC", "Memory", 0xfffd0020, 4, base=16, bitRange=0-7 +sfr = "CAN_ECR.TEC", "Memory", 0xfffd0020, 4, base=16, bitRange=16-23 +sfr = "CAN_TCR", "Memory", 0xfffd0024, 4, base=16 +sfr = "CAN_TCR.MB0", "Memory", 0xfffd0024, 4, base=16, bitRange=0 +sfr = "CAN_TCR.MB1", "Memory", 0xfffd0024, 4, base=16, bitRange=1 +sfr = "CAN_TCR.MB2", "Memory", 0xfffd0024, 4, base=16, bitRange=2 +sfr = "CAN_TCR.MB3", "Memory", 0xfffd0024, 4, base=16, bitRange=3 +sfr = "CAN_TCR.MB4", "Memory", 0xfffd0024, 4, base=16, bitRange=4 +sfr = "CAN_TCR.MB5", "Memory", 0xfffd0024, 4, base=16, bitRange=5 +sfr = "CAN_TCR.MB6", "Memory", 0xfffd0024, 4, base=16, bitRange=6 +sfr = "CAN_TCR.MB7", "Memory", 0xfffd0024, 4, base=16, bitRange=7 +sfr = "CAN_TCR.MB8", "Memory", 0xfffd0024, 4, base=16, bitRange=8 +sfr = "CAN_TCR.MB9", "Memory", 0xfffd0024, 4, base=16, bitRange=9 +sfr = "CAN_TCR.MB10", "Memory", 0xfffd0024, 4, base=16, bitRange=10 +sfr = "CAN_TCR.MB11", "Memory", 0xfffd0024, 4, base=16, bitRange=11 +sfr = "CAN_TCR.MB12", "Memory", 0xfffd0024, 4, base=16, bitRange=12 +sfr = "CAN_TCR.MB13", "Memory", 0xfffd0024, 4, base=16, bitRange=13 +sfr = "CAN_TCR.MB14", "Memory", 0xfffd0024, 4, base=16, bitRange=14 +sfr = "CAN_TCR.MB15", "Memory", 0xfffd0024, 4, base=16, bitRange=15 +sfr = "CAN_TCR.TIMRST", "Memory", 0xfffd0024, 4, base=16, bitRange=31 +sfr = "CAN_ACR", "Memory", 0xfffd0028, 4, base=16 +sfr = "CAN_ACR.MB0", "Memory", 0xfffd0028, 4, base=16, bitRange=0 +sfr = "CAN_ACR.MB1", "Memory", 0xfffd0028, 4, base=16, bitRange=1 +sfr = "CAN_ACR.MB2", "Memory", 0xfffd0028, 4, base=16, bitRange=2 +sfr = "CAN_ACR.MB3", "Memory", 0xfffd0028, 4, base=16, bitRange=3 +sfr = "CAN_ACR.MB4", "Memory", 0xfffd0028, 4, base=16, bitRange=4 +sfr = "CAN_ACR.MB5", "Memory", 0xfffd0028, 4, base=16, bitRange=5 +sfr = "CAN_ACR.MB6", "Memory", 0xfffd0028, 4, base=16, bitRange=6 +sfr = "CAN_ACR.MB7", "Memory", 0xfffd0028, 4, base=16, bitRange=7 +sfr = "CAN_ACR.MB8", "Memory", 0xfffd0028, 4, base=16, bitRange=8 +sfr = "CAN_ACR.MB9", "Memory", 0xfffd0028, 4, base=16, bitRange=9 +sfr = "CAN_ACR.MB10", "Memory", 0xfffd0028, 4, base=16, bitRange=10 +sfr = "CAN_ACR.MB11", "Memory", 0xfffd0028, 4, base=16, bitRange=11 +sfr = "CAN_ACR.MB12", "Memory", 0xfffd0028, 4, base=16, bitRange=12 +sfr = "CAN_ACR.MB13", "Memory", 0xfffd0028, 4, base=16, bitRange=13 +sfr = "CAN_ACR.MB14", "Memory", 0xfffd0028, 4, base=16, bitRange=14 +sfr = "CAN_ACR.MB15", "Memory", 0xfffd0028, 4, base=16, bitRange=15 +sfr = "CAN_VR", "Memory", 0xfffd00fc, 4, base=16 +; ========== Register definition for EMAC peripheral ========== +sfr = "EMAC_NCR", "Memory", 0xfffdc000, 4, base=16 +sfr = "EMAC_NCR.LB", "Memory", 0xfffdc000, 4, base=16, bitRange=0 +sfr = "EMAC_NCR.LLB", "Memory", 0xfffdc000, 4, base=16, bitRange=1 +sfr = "EMAC_NCR.RE", "Memory", 0xfffdc000, 4, base=16, bitRange=2 +sfr = "EMAC_NCR.TE", "Memory", 0xfffdc000, 4, base=16, bitRange=3 +sfr = "EMAC_NCR.MPE", "Memory", 0xfffdc000, 4, base=16, bitRange=4 +sfr = "EMAC_NCR.CLRSTAT", "Memory", 0xfffdc000, 4, base=16, bitRange=5 +sfr = "EMAC_NCR.INCSTAT", "Memory", 0xfffdc000, 4, base=16, bitRange=6 +sfr = "EMAC_NCR.WESTAT", "Memory", 0xfffdc000, 4, base=16, bitRange=7 +sfr = "EMAC_NCR.BP", "Memory", 0xfffdc000, 4, base=16, bitRange=8 +sfr = "EMAC_NCR.TSTART", "Memory", 0xfffdc000, 4, base=16, bitRange=9 +sfr = "EMAC_NCR.THALT", "Memory", 0xfffdc000, 4, base=16, bitRange=10 +sfr = "EMAC_NCR.TPFR", "Memory", 0xfffdc000, 4, base=16, bitRange=11 +sfr = "EMAC_NCR.TZQ", "Memory", 0xfffdc000, 4, base=16, bitRange=12 +sfr = "EMAC_NCFGR", "Memory", 0xfffdc004, 4, base=16 +sfr = "EMAC_NCFGR.SPD", "Memory", 0xfffdc004, 4, base=16, bitRange=0 +sfr = "EMAC_NCFGR.FD", "Memory", 0xfffdc004, 4, base=16, bitRange=1 +sfr = "EMAC_NCFGR.JFRAME", "Memory", 0xfffdc004, 4, base=16, bitRange=3 +sfr = "EMAC_NCFGR.CAF", "Memory", 0xfffdc004, 4, base=16, bitRange=4 +sfr = "EMAC_NCFGR.NBC", "Memory", 0xfffdc004, 4, base=16, bitRange=5 +sfr = "EMAC_NCFGR.MTI", "Memory", 0xfffdc004, 4, base=16, bitRange=6 +sfr = "EMAC_NCFGR.UNI", "Memory", 0xfffdc004, 4, base=16, bitRange=7 +sfr = "EMAC_NCFGR.BIG", "Memory", 0xfffdc004, 4, base=16, bitRange=8 +sfr = "EMAC_NCFGR.EAE", "Memory", 0xfffdc004, 4, base=16, bitRange=9 +sfr = "EMAC_NCFGR.CLK", "Memory", 0xfffdc004, 4, base=16, bitRange=10-11 +sfr = "EMAC_NCFGR.RTY", "Memory", 0xfffdc004, 4, base=16, bitRange=12 +sfr = "EMAC_NCFGR.PAE", "Memory", 0xfffdc004, 4, base=16, bitRange=13 +sfr = "EMAC_NCFGR.RBOF", "Memory", 0xfffdc004, 4, base=16, bitRange=14-15 +sfr = "EMAC_NCFGR.RLCE", "Memory", 0xfffdc004, 4, base=16, bitRange=16 +sfr = "EMAC_NCFGR.DRFCS", "Memory", 0xfffdc004, 4, base=16, bitRange=17 +sfr = "EMAC_NCFGR.EFRHD", "Memory", 0xfffdc004, 4, base=16, bitRange=18 +sfr = "EMAC_NCFGR.IRXFCS", "Memory", 0xfffdc004, 4, base=16, bitRange=19 +sfr = "EMAC_NSR", "Memory", 0xfffdc008, 4, base=16 +sfr = "EMAC_NSR.LINKR", "Memory", 0xfffdc008, 4, base=16, bitRange=0 +sfr = "EMAC_NSR.MDIO", "Memory", 0xfffdc008, 4, base=16, bitRange=1 +sfr = "EMAC_NSR.IDLE", "Memory", 0xfffdc008, 4, base=16, bitRange=2 +sfr = "EMAC_TSR", "Memory", 0xfffdc014, 4, base=16 +sfr = "EMAC_TSR.UBR", "Memory", 0xfffdc014, 4, base=16, bitRange=0 +sfr = "EMAC_TSR.COL", "Memory", 0xfffdc014, 4, base=16, bitRange=1 +sfr = "EMAC_TSR.RLES", "Memory", 0xfffdc014, 4, base=16, bitRange=2 +sfr = "EMAC_TSR.TGO", "Memory", 0xfffdc014, 4, base=16, bitRange=3 +sfr = "EMAC_TSR.BEX", "Memory", 0xfffdc014, 4, base=16, bitRange=4 +sfr = "EMAC_TSR.COMP", "Memory", 0xfffdc014, 4, base=16, bitRange=5 +sfr = "EMAC_TSR.UND", "Memory", 0xfffdc014, 4, base=16, bitRange=6 +sfr = "EMAC_RBQP", "Memory", 0xfffdc018, 4, base=16 +sfr = "EMAC_TBQP", "Memory", 0xfffdc01c, 4, base=16 +sfr = "EMAC_RSR", "Memory", 0xfffdc020, 4, base=16 +sfr = "EMAC_RSR.BNA", "Memory", 0xfffdc020, 4, base=16, bitRange=0 +sfr = "EMAC_RSR.REC", "Memory", 0xfffdc020, 4, base=16, bitRange=1 +sfr = "EMAC_RSR.OVR", "Memory", 0xfffdc020, 4, base=16, bitRange=2 +sfr = "EMAC_ISR", "Memory", 0xfffdc024, 4, base=16 +sfr = "EMAC_ISR.MFD", "Memory", 0xfffdc024, 4, base=16, bitRange=0 +sfr = "EMAC_ISR.RCOMP", "Memory", 0xfffdc024, 4, base=16, bitRange=1 +sfr = "EMAC_ISR.RXUBR", "Memory", 0xfffdc024, 4, base=16, bitRange=2 +sfr = "EMAC_ISR.TXUBR", "Memory", 0xfffdc024, 4, base=16, bitRange=3 +sfr = "EMAC_ISR.TUNDR", "Memory", 0xfffdc024, 4, base=16, bitRange=4 +sfr = "EMAC_ISR.RLEX", "Memory", 0xfffdc024, 4, base=16, bitRange=5 +sfr = "EMAC_ISR.TXERR", "Memory", 0xfffdc024, 4, base=16, bitRange=6 +sfr = "EMAC_ISR.TCOMP", "Memory", 0xfffdc024, 4, base=16, bitRange=7 +sfr = "EMAC_ISR.LINK", "Memory", 0xfffdc024, 4, base=16, bitRange=9 +sfr = "EMAC_ISR.ROVR", "Memory", 0xfffdc024, 4, base=16, bitRange=10 +sfr = "EMAC_ISR.HRESP", "Memory", 0xfffdc024, 4, base=16, bitRange=11 +sfr = "EMAC_ISR.PFRE", "Memory", 0xfffdc024, 4, base=16, bitRange=12 +sfr = "EMAC_ISR.PTZ", "Memory", 0xfffdc024, 4, base=16, bitRange=13 +sfr = "EMAC_IER", "Memory", 0xfffdc028, 4, base=16 +sfr = "EMAC_IER.MFD", "Memory", 0xfffdc028, 4, base=16, bitRange=0 +sfr = "EMAC_IER.RCOMP", "Memory", 0xfffdc028, 4, base=16, bitRange=1 +sfr = "EMAC_IER.RXUBR", "Memory", 0xfffdc028, 4, base=16, bitRange=2 +sfr = "EMAC_IER.TXUBR", "Memory", 0xfffdc028, 4, base=16, bitRange=3 +sfr = "EMAC_IER.TUNDR", "Memory", 0xfffdc028, 4, base=16, bitRange=4 +sfr = "EMAC_IER.RLEX", "Memory", 0xfffdc028, 4, base=16, bitRange=5 +sfr = "EMAC_IER.TXERR", "Memory", 0xfffdc028, 4, base=16, bitRange=6 +sfr = "EMAC_IER.TCOMP", "Memory", 0xfffdc028, 4, base=16, bitRange=7 +sfr = "EMAC_IER.LINK", "Memory", 0xfffdc028, 4, base=16, bitRange=9 +sfr = "EMAC_IER.ROVR", "Memory", 0xfffdc028, 4, base=16, bitRange=10 +sfr = "EMAC_IER.HRESP", "Memory", 0xfffdc028, 4, base=16, bitRange=11 +sfr = "EMAC_IER.PFRE", "Memory", 0xfffdc028, 4, base=16, bitRange=12 +sfr = "EMAC_IER.PTZ", "Memory", 0xfffdc028, 4, base=16, bitRange=13 +sfr = "EMAC_IDR", "Memory", 0xfffdc02c, 4, base=16 +sfr = "EMAC_IDR.MFD", "Memory", 0xfffdc02c, 4, base=16, bitRange=0 +sfr = "EMAC_IDR.RCOMP", "Memory", 0xfffdc02c, 4, base=16, bitRange=1 +sfr = "EMAC_IDR.RXUBR", "Memory", 0xfffdc02c, 4, base=16, bitRange=2 +sfr = "EMAC_IDR.TXUBR", "Memory", 0xfffdc02c, 4, base=16, bitRange=3 +sfr = "EMAC_IDR.TUNDR", "Memory", 0xfffdc02c, 4, base=16, bitRange=4 +sfr = "EMAC_IDR.RLEX", "Memory", 0xfffdc02c, 4, base=16, bitRange=5 +sfr = "EMAC_IDR.TXERR", "Memory", 0xfffdc02c, 4, base=16, bitRange=6 +sfr = "EMAC_IDR.TCOMP", "Memory", 0xfffdc02c, 4, base=16, bitRange=7 +sfr = "EMAC_IDR.LINK", "Memory", 0xfffdc02c, 4, base=16, bitRange=9 +sfr = "EMAC_IDR.ROVR", "Memory", 0xfffdc02c, 4, base=16, bitRange=10 +sfr = "EMAC_IDR.HRESP", "Memory", 0xfffdc02c, 4, base=16, bitRange=11 +sfr = "EMAC_IDR.PFRE", "Memory", 0xfffdc02c, 4, base=16, bitRange=12 +sfr = "EMAC_IDR.PTZ", "Memory", 0xfffdc02c, 4, base=16, bitRange=13 +sfr = "EMAC_IMR", "Memory", 0xfffdc030, 4, base=16 +sfr = "EMAC_IMR.MFD", "Memory", 0xfffdc030, 4, base=16, bitRange=0 +sfr = "EMAC_IMR.RCOMP", "Memory", 0xfffdc030, 4, base=16, bitRange=1 +sfr = "EMAC_IMR.RXUBR", "Memory", 0xfffdc030, 4, base=16, bitRange=2 +sfr = "EMAC_IMR.TXUBR", "Memory", 0xfffdc030, 4, base=16, bitRange=3 +sfr = "EMAC_IMR.TUNDR", "Memory", 0xfffdc030, 4, base=16, bitRange=4 +sfr = "EMAC_IMR.RLEX", "Memory", 0xfffdc030, 4, base=16, bitRange=5 +sfr = "EMAC_IMR.TXERR", "Memory", 0xfffdc030, 4, base=16, bitRange=6 +sfr = "EMAC_IMR.TCOMP", "Memory", 0xfffdc030, 4, base=16, bitRange=7 +sfr = "EMAC_IMR.LINK", "Memory", 0xfffdc030, 4, base=16, bitRange=9 +sfr = "EMAC_IMR.ROVR", "Memory", 0xfffdc030, 4, base=16, bitRange=10 +sfr = "EMAC_IMR.HRESP", "Memory", 0xfffdc030, 4, base=16, bitRange=11 +sfr = "EMAC_IMR.PFRE", "Memory", 0xfffdc030, 4, base=16, bitRange=12 +sfr = "EMAC_IMR.PTZ", "Memory", 0xfffdc030, 4, base=16, bitRange=13 +sfr = "EMAC_MAN", "Memory", 0xfffdc034, 4, base=16 +sfr = "EMAC_MAN.DATA", "Memory", 0xfffdc034, 4, base=16, bitRange=0-15 +sfr = "EMAC_MAN.CODE", "Memory", 0xfffdc034, 4, base=16, bitRange=16-17 +sfr = "EMAC_MAN.REGA", "Memory", 0xfffdc034, 4, base=16, bitRange=18-22 +sfr = "EMAC_MAN.PHYA", "Memory", 0xfffdc034, 4, base=16, bitRange=23-27 +sfr = "EMAC_MAN.RW", "Memory", 0xfffdc034, 4, base=16, bitRange=28-29 +sfr = "EMAC_MAN.SOF", "Memory", 0xfffdc034, 4, base=16, bitRange=30-31 +sfr = "EMAC_PTR", "Memory", 0xfffdc038, 4, base=16 +sfr = "EMAC_PFR", "Memory", 0xfffdc03c, 4, base=16 +sfr = "EMAC_FTO", "Memory", 0xfffdc040, 4, base=16 +sfr = "EMAC_SCF", "Memory", 0xfffdc044, 4, base=16 +sfr = "EMAC_MCF", "Memory", 0xfffdc048, 4, base=16 +sfr = "EMAC_FRO", "Memory", 0xfffdc04c, 4, base=16 +sfr = "EMAC_FCSE", "Memory", 0xfffdc050, 4, base=16 +sfr = "EMAC_ALE", "Memory", 0xfffdc054, 4, base=16 +sfr = "EMAC_DTF", "Memory", 0xfffdc058, 4, base=16 +sfr = "EMAC_LCOL", "Memory", 0xfffdc05c, 4, base=16 +sfr = "EMAC_ECOL", "Memory", 0xfffdc060, 4, base=16 +sfr = "EMAC_TUND", "Memory", 0xfffdc064, 4, base=16 +sfr = "EMAC_CSE", "Memory", 0xfffdc068, 4, base=16 +sfr = "EMAC_RRE", "Memory", 0xfffdc06c, 4, base=16 +sfr = "EMAC_ROV", "Memory", 0xfffdc070, 4, base=16 +sfr = "EMAC_RSE", "Memory", 0xfffdc074, 4, base=16 +sfr = "EMAC_ELE", "Memory", 0xfffdc078, 4, base=16 +sfr = "EMAC_RJA", "Memory", 0xfffdc07c, 4, base=16 +sfr = "EMAC_USF", "Memory", 0xfffdc080, 4, base=16 +sfr = "EMAC_STE", "Memory", 0xfffdc084, 4, base=16 +sfr = "EMAC_RLE", "Memory", 0xfffdc088, 4, base=16 +sfr = "EMAC_TPF", "Memory", 0xfffdc08c, 4, base=16 +sfr = "EMAC_HRB", "Memory", 0xfffdc090, 4, base=16 +sfr = "EMAC_HRT", "Memory", 0xfffdc094, 4, base=16 +sfr = "EMAC_SA1L", "Memory", 0xfffdc098, 4, base=16 +sfr = "EMAC_SA1H", "Memory", 0xfffdc09c, 4, base=16 +sfr = "EMAC_SA2L", "Memory", 0xfffdc0a0, 4, base=16 +sfr = "EMAC_SA2H", "Memory", 0xfffdc0a4, 4, base=16 +sfr = "EMAC_SA3L", "Memory", 0xfffdc0a8, 4, base=16 +sfr = "EMAC_SA3H", "Memory", 0xfffdc0ac, 4, base=16 +sfr = "EMAC_SA4L", "Memory", 0xfffdc0b0, 4, base=16 +sfr = "EMAC_SA4H", "Memory", 0xfffdc0b4, 4, base=16 +sfr = "EMAC_TID", "Memory", 0xfffdc0b8, 4, base=16 +sfr = "EMAC_TPQ", "Memory", 0xfffdc0bc, 4, base=16 +sfr = "EMAC_USRIO", "Memory", 0xfffdc0c0, 4, base=16 +sfr = "EMAC_USRIO.RMII", "Memory", 0xfffdc0c0, 4, base=16, bitRange=0 +sfr = "EMAC_USRIO.CLKEN", "Memory", 0xfffdc0c0, 4, base=16, bitRange=1 +sfr = "EMAC_WOL", "Memory", 0xfffdc0c4, 4, base=16 +sfr = "EMAC_WOL.IP", "Memory", 0xfffdc0c4, 4, base=16, bitRange=0-15 +sfr = "EMAC_WOL.MAG", "Memory", 0xfffdc0c4, 4, base=16, bitRange=16 +sfr = "EMAC_WOL.ARP", "Memory", 0xfffdc0c4, 4, base=16, bitRange=17 +sfr = "EMAC_WOL.SA1", "Memory", 0xfffdc0c4, 4, base=16, bitRange=18 +sfr = "EMAC_WOL.MTI", "Memory", 0xfffdc0c4, 4, base=16, bitRange=19 +sfr = "EMAC_REV", "Memory", 0xfffdc0fc, 4, base=16 +sfr = "EMAC_REV.REVREF", "Memory", 0xfffdc0fc, 4, base=16, bitRange=0-15 +sfr = "EMAC_REV.PARTREF", "Memory", 0xfffdc0fc, 4, base=16, bitRange=16-31 +; ========== Register definition for PDC_ADC peripheral ========== +sfr = "ADC_RPR", "Memory", 0xfffd8100, 4, base=16 +sfr = "ADC_RCR", "Memory", 0xfffd8104, 4, base=16 +sfr = "ADC_TPR", "Memory", 0xfffd8108, 4, base=16 +sfr = "ADC_TCR", "Memory", 0xfffd810c, 4, base=16 +sfr = "ADC_RNPR", "Memory", 0xfffd8110, 4, base=16 +sfr = "ADC_RNCR", "Memory", 0xfffd8114, 4, base=16 +sfr = "ADC_TNPR", "Memory", 0xfffd8118, 4, base=16 +sfr = "ADC_TNCR", "Memory", 0xfffd811c, 4, base=16 +sfr = "ADC_PTCR", "Memory", 0xfffd8120, 4, base=16 +sfr = "ADC_PTCR.RXTEN", "Memory", 0xfffd8120, 4, base=16, bitRange=0 +sfr = "ADC_PTCR.RXTDIS", "Memory", 0xfffd8120, 4, base=16, bitRange=1 +sfr = "ADC_PTCR.TXTEN", "Memory", 0xfffd8120, 4, base=16, bitRange=8 +sfr = "ADC_PTCR.TXTDIS", "Memory", 0xfffd8120, 4, base=16, bitRange=9 +sfr = "ADC_PTSR", "Memory", 0xfffd8124, 4, base=16 +sfr = "ADC_PTSR.RXTEN", "Memory", 0xfffd8124, 4, base=16, bitRange=0 +sfr = "ADC_PTSR.TXTEN", "Memory", 0xfffd8124, 4, base=16, bitRange=8 +; ========== Register definition for ADC peripheral ========== +sfr = "ADC_CR", "Memory", 0xfffd8000, 4, base=16 +sfr = "ADC_CR.SWRST", "Memory", 0xfffd8000, 4, base=16, bitRange=0 +sfr = "ADC_CR.START", "Memory", 0xfffd8000, 4, base=16, bitRange=1 +sfr = "ADC_MR", "Memory", 0xfffd8004, 4, base=16 +sfr = "ADC_MR.TRGEN", "Memory", 0xfffd8004, 4, base=16, bitRange=0 +sfr = "ADC_MR.TRGSEL", "Memory", 0xfffd8004, 4, base=16, bitRange=1-3 +sfr = "ADC_MR.LOWRES", "Memory", 0xfffd8004, 4, base=16, bitRange=4 +sfr = "ADC_MR.SLEEP", "Memory", 0xfffd8004, 4, base=16, bitRange=5 +sfr = "ADC_MR.PRESCAL", "Memory", 0xfffd8004, 4, base=16, bitRange=8-13 +sfr = "ADC_MR.STARTUP", "Memory", 0xfffd8004, 4, base=16, bitRange=16-20 +sfr = "ADC_MR.SHTIM", "Memory", 0xfffd8004, 4, base=16, bitRange=24-27 +sfr = "ADC_CHER", "Memory", 0xfffd8010, 4, base=16 +sfr = "ADC_CHER.CH0", "Memory", 0xfffd8010, 4, base=16, bitRange=0 +sfr = "ADC_CHER.CH1", "Memory", 0xfffd8010, 4, base=16, bitRange=1 +sfr = "ADC_CHER.CH2", "Memory", 0xfffd8010, 4, base=16, bitRange=2 +sfr = "ADC_CHER.CH3", "Memory", 0xfffd8010, 4, base=16, bitRange=3 +sfr = "ADC_CHER.CH4", "Memory", 0xfffd8010, 4, base=16, bitRange=4 +sfr = "ADC_CHER.CH5", "Memory", 0xfffd8010, 4, base=16, bitRange=5 +sfr = "ADC_CHER.CH6", "Memory", 0xfffd8010, 4, base=16, bitRange=6 +sfr = "ADC_CHER.CH7", "Memory", 0xfffd8010, 4, base=16, bitRange=7 +sfr = "ADC_CHDR", "Memory", 0xfffd8014, 4, base=16 +sfr = "ADC_CHDR.CH0", "Memory", 0xfffd8014, 4, base=16, bitRange=0 +sfr = "ADC_CHDR.CH1", "Memory", 0xfffd8014, 4, base=16, bitRange=1 +sfr = "ADC_CHDR.CH2", "Memory", 0xfffd8014, 4, base=16, bitRange=2 +sfr = "ADC_CHDR.CH3", "Memory", 0xfffd8014, 4, base=16, bitRange=3 +sfr = "ADC_CHDR.CH4", "Memory", 0xfffd8014, 4, base=16, bitRange=4 +sfr = "ADC_CHDR.CH5", "Memory", 0xfffd8014, 4, base=16, bitRange=5 +sfr = "ADC_CHDR.CH6", "Memory", 0xfffd8014, 4, base=16, bitRange=6 +sfr = "ADC_CHDR.CH7", "Memory", 0xfffd8014, 4, base=16, bitRange=7 +sfr = "ADC_CHSR", "Memory", 0xfffd8018, 4, base=16 +sfr = "ADC_CHSR.CH0", "Memory", 0xfffd8018, 4, base=16, bitRange=0 +sfr = "ADC_CHSR.CH1", "Memory", 0xfffd8018, 4, base=16, bitRange=1 +sfr = "ADC_CHSR.CH2", "Memory", 0xfffd8018, 4, base=16, bitRange=2 +sfr = "ADC_CHSR.CH3", "Memory", 0xfffd8018, 4, base=16, bitRange=3 +sfr = "ADC_CHSR.CH4", "Memory", 0xfffd8018, 4, base=16, bitRange=4 +sfr = "ADC_CHSR.CH5", "Memory", 0xfffd8018, 4, base=16, bitRange=5 +sfr = "ADC_CHSR.CH6", "Memory", 0xfffd8018, 4, base=16, bitRange=6 +sfr = "ADC_CHSR.CH7", "Memory", 0xfffd8018, 4, base=16, bitRange=7 +sfr = "ADC_SR", "Memory", 0xfffd801c, 4, base=16 +sfr = "ADC_SR.EOC0", "Memory", 0xfffd801c, 4, base=16, bitRange=0 +sfr = "ADC_SR.EOC1", "Memory", 0xfffd801c, 4, base=16, bitRange=1 +sfr = "ADC_SR.EOC2", "Memory", 0xfffd801c, 4, base=16, bitRange=2 +sfr = "ADC_SR.EOC3", "Memory", 0xfffd801c, 4, base=16, bitRange=3 +sfr = "ADC_SR.EOC4", "Memory", 0xfffd801c, 4, base=16, bitRange=4 +sfr = "ADC_SR.EOC5", "Memory", 0xfffd801c, 4, base=16, bitRange=5 +sfr = "ADC_SR.EOC6", "Memory", 0xfffd801c, 4, base=16, bitRange=6 +sfr = "ADC_SR.EOC7", "Memory", 0xfffd801c, 4, base=16, bitRange=7 +sfr = "ADC_SR.OVRE0", "Memory", 0xfffd801c, 4, base=16, bitRange=8 +sfr = "ADC_SR.OVRE1", "Memory", 0xfffd801c, 4, base=16, bitRange=9 +sfr = "ADC_SR.OVRE2", "Memory", 0xfffd801c, 4, base=16, bitRange=10 +sfr = "ADC_SR.OVRE3", "Memory", 0xfffd801c, 4, base=16, bitRange=11 +sfr = "ADC_SR.OVRE4", "Memory", 0xfffd801c, 4, base=16, bitRange=12 +sfr = "ADC_SR.OVRE5", "Memory", 0xfffd801c, 4, base=16, bitRange=13 +sfr = "ADC_SR.OVRE6", "Memory", 0xfffd801c, 4, base=16, bitRange=14 +sfr = "ADC_SR.OVRE7", "Memory", 0xfffd801c, 4, base=16, bitRange=15 +sfr = "ADC_SR.DRDY", "Memory", 0xfffd801c, 4, base=16, bitRange=16 +sfr = "ADC_SR.GOVRE", "Memory", 0xfffd801c, 4, base=16, bitRange=17 +sfr = "ADC_SR.ENDRX", "Memory", 0xfffd801c, 4, base=16, bitRange=18 +sfr = "ADC_SR.RXBUFF", "Memory", 0xfffd801c, 4, base=16, bitRange=19 +sfr = "ADC_LCDR", "Memory", 0xfffd8020, 4, base=16 +sfr = "ADC_LCDR.LDATA", "Memory", 0xfffd8020, 4, base=16, bitRange=0-9 +sfr = "ADC_IER", "Memory", 0xfffd8024, 4, base=16 +sfr = "ADC_IER.EOC0", "Memory", 0xfffd8024, 4, base=16, bitRange=0 +sfr = "ADC_IER.EOC1", "Memory", 0xfffd8024, 4, base=16, bitRange=1 +sfr = "ADC_IER.EOC2", "Memory", 0xfffd8024, 4, base=16, bitRange=2 +sfr = "ADC_IER.EOC3", "Memory", 0xfffd8024, 4, base=16, bitRange=3 +sfr = "ADC_IER.EOC4", "Memory", 0xfffd8024, 4, base=16, bitRange=4 +sfr = "ADC_IER.EOC5", "Memory", 0xfffd8024, 4, base=16, bitRange=5 +sfr = "ADC_IER.EOC6", "Memory", 0xfffd8024, 4, base=16, bitRange=6 +sfr = "ADC_IER.EOC7", "Memory", 0xfffd8024, 4, base=16, bitRange=7 +sfr = "ADC_IER.OVRE0", "Memory", 0xfffd8024, 4, base=16, bitRange=8 +sfr = "ADC_IER.OVRE1", "Memory", 0xfffd8024, 4, base=16, bitRange=9 +sfr = "ADC_IER.OVRE2", "Memory", 0xfffd8024, 4, base=16, bitRange=10 +sfr = "ADC_IER.OVRE3", "Memory", 0xfffd8024, 4, base=16, bitRange=11 +sfr = "ADC_IER.OVRE4", "Memory", 0xfffd8024, 4, base=16, bitRange=12 +sfr = "ADC_IER.OVRE5", "Memory", 0xfffd8024, 4, base=16, bitRange=13 +sfr = "ADC_IER.OVRE6", "Memory", 0xfffd8024, 4, base=16, bitRange=14 +sfr = "ADC_IER.OVRE7", "Memory", 0xfffd8024, 4, base=16, bitRange=15 +sfr = "ADC_IER.DRDY", "Memory", 0xfffd8024, 4, base=16, bitRange=16 +sfr = "ADC_IER.GOVRE", "Memory", 0xfffd8024, 4, base=16, bitRange=17 +sfr = "ADC_IER.ENDRX", "Memory", 0xfffd8024, 4, base=16, bitRange=18 +sfr = "ADC_IER.RXBUFF", "Memory", 0xfffd8024, 4, base=16, bitRange=19 +sfr = "ADC_IDR", "Memory", 0xfffd8028, 4, base=16 +sfr = "ADC_IDR.EOC0", "Memory", 0xfffd8028, 4, base=16, bitRange=0 +sfr = "ADC_IDR.EOC1", "Memory", 0xfffd8028, 4, base=16, bitRange=1 +sfr = "ADC_IDR.EOC2", "Memory", 0xfffd8028, 4, base=16, bitRange=2 +sfr = "ADC_IDR.EOC3", "Memory", 0xfffd8028, 4, base=16, bitRange=3 +sfr = "ADC_IDR.EOC4", "Memory", 0xfffd8028, 4, base=16, bitRange=4 +sfr = "ADC_IDR.EOC5", "Memory", 0xfffd8028, 4, base=16, bitRange=5 +sfr = "ADC_IDR.EOC6", "Memory", 0xfffd8028, 4, base=16, bitRange=6 +sfr = "ADC_IDR.EOC7", "Memory", 0xfffd8028, 4, base=16, bitRange=7 +sfr = "ADC_IDR.OVRE0", "Memory", 0xfffd8028, 4, base=16, bitRange=8 +sfr = "ADC_IDR.OVRE1", "Memory", 0xfffd8028, 4, base=16, bitRange=9 +sfr = "ADC_IDR.OVRE2", "Memory", 0xfffd8028, 4, base=16, bitRange=10 +sfr = "ADC_IDR.OVRE3", "Memory", 0xfffd8028, 4, base=16, bitRange=11 +sfr = "ADC_IDR.OVRE4", "Memory", 0xfffd8028, 4, base=16, bitRange=12 +sfr = "ADC_IDR.OVRE5", "Memory", 0xfffd8028, 4, base=16, bitRange=13 +sfr = "ADC_IDR.OVRE6", "Memory", 0xfffd8028, 4, base=16, bitRange=14 +sfr = "ADC_IDR.OVRE7", "Memory", 0xfffd8028, 4, base=16, bitRange=15 +sfr = "ADC_IDR.DRDY", "Memory", 0xfffd8028, 4, base=16, bitRange=16 +sfr = "ADC_IDR.GOVRE", "Memory", 0xfffd8028, 4, base=16, bitRange=17 +sfr = "ADC_IDR.ENDRX", "Memory", 0xfffd8028, 4, base=16, bitRange=18 +sfr = "ADC_IDR.RXBUFF", "Memory", 0xfffd8028, 4, base=16, bitRange=19 +sfr = "ADC_IMR", "Memory", 0xfffd802c, 4, base=16 +sfr = "ADC_IMR.EOC0", "Memory", 0xfffd802c, 4, base=16, bitRange=0 +sfr = "ADC_IMR.EOC1", "Memory", 0xfffd802c, 4, base=16, bitRange=1 +sfr = "ADC_IMR.EOC2", "Memory", 0xfffd802c, 4, base=16, bitRange=2 +sfr = "ADC_IMR.EOC3", "Memory", 0xfffd802c, 4, base=16, bitRange=3 +sfr = "ADC_IMR.EOC4", "Memory", 0xfffd802c, 4, base=16, bitRange=4 +sfr = "ADC_IMR.EOC5", "Memory", 0xfffd802c, 4, base=16, bitRange=5 +sfr = "ADC_IMR.EOC6", "Memory", 0xfffd802c, 4, base=16, bitRange=6 +sfr = "ADC_IMR.EOC7", "Memory", 0xfffd802c, 4, base=16, bitRange=7 +sfr = "ADC_IMR.OVRE0", "Memory", 0xfffd802c, 4, base=16, bitRange=8 +sfr = "ADC_IMR.OVRE1", "Memory", 0xfffd802c, 4, base=16, bitRange=9 +sfr = "ADC_IMR.OVRE2", "Memory", 0xfffd802c, 4, base=16, bitRange=10 +sfr = "ADC_IMR.OVRE3", "Memory", 0xfffd802c, 4, base=16, bitRange=11 +sfr = "ADC_IMR.OVRE4", "Memory", 0xfffd802c, 4, base=16, bitRange=12 +sfr = "ADC_IMR.OVRE5", "Memory", 0xfffd802c, 4, base=16, bitRange=13 +sfr = "ADC_IMR.OVRE6", "Memory", 0xfffd802c, 4, base=16, bitRange=14 +sfr = "ADC_IMR.OVRE7", "Memory", 0xfffd802c, 4, base=16, bitRange=15 +sfr = "ADC_IMR.DRDY", "Memory", 0xfffd802c, 4, base=16, bitRange=16 +sfr = "ADC_IMR.GOVRE", "Memory", 0xfffd802c, 4, base=16, bitRange=17 +sfr = "ADC_IMR.ENDRX", "Memory", 0xfffd802c, 4, base=16, bitRange=18 +sfr = "ADC_IMR.RXBUFF", "Memory", 0xfffd802c, 4, base=16, bitRange=19 +sfr = "ADC_CDR0", "Memory", 0xfffd8030, 4, base=16 +sfr = "ADC_CDR0.DATA", "Memory", 0xfffd8030, 4, base=16, bitRange=0-9 +sfr = "ADC_CDR1", "Memory", 0xfffd8034, 4, base=16 +sfr = "ADC_CDR1.DATA", "Memory", 0xfffd8034, 4, base=16, bitRange=0-9 +sfr = "ADC_CDR2", "Memory", 0xfffd8038, 4, base=16 +sfr = "ADC_CDR2.DATA", "Memory", 0xfffd8038, 4, base=16, bitRange=0-9 +sfr = "ADC_CDR3", "Memory", 0xfffd803c, 4, base=16 +sfr = "ADC_CDR3.DATA", "Memory", 0xfffd803c, 4, base=16, bitRange=0-9 +sfr = "ADC_CDR4", "Memory", 0xfffd8040, 4, base=16 +sfr = "ADC_CDR4.DATA", "Memory", 0xfffd8040, 4, base=16, bitRange=0-9 +sfr = "ADC_CDR5", "Memory", 0xfffd8044, 4, base=16 +sfr = "ADC_CDR5.DATA", "Memory", 0xfffd8044, 4, base=16, bitRange=0-9 +sfr = "ADC_CDR6", "Memory", 0xfffd8048, 4, base=16 +sfr = "ADC_CDR6.DATA", "Memory", 0xfffd8048, 4, base=16, bitRange=0-9 +sfr = "ADC_CDR7", "Memory", 0xfffd804c, 4, base=16 +sfr = "ADC_CDR7.DATA", "Memory", 0xfffd804c, 4, base=16, bitRange=0-9 + + +[SfrGroupInfo] +group = "TC0", "TC0_CCR", "TC0_CMR", "TC0_CV", "TC0_RA", "TC0_RB", "TC0_RC", "TC0_SR", "TC0_IER", "TC0_IDR", "TC0_IMR" +group = "TCB", "TCB_BCR", "TCB_BMR" +group = "TC1", "TC1_CCR", "TC1_CMR", "TC1_CV", "TC1_RA", "TC1_RB", "TC1_RC", "TC1_SR", "TC1_IER", "TC1_IDR", "TC1_IMR" +group = "TC2", "TC2_CCR", "TC2_CMR", "TC2_CV", "TC2_RA", "TC2_RB", "TC2_RC", "TC2_SR", "TC2_IER", "TC2_IDR", "TC2_IMR" +group = "UDP", "UDP_NUM", "UDP_GLBSTATE", "UDP_FADDR", "UDP_IER", "UDP_IDR", "UDP_IMR", "UDP_ISR", "UDP_ICR", "UDP_RSTEP", "UDP_CSR", "UDP_FDR", "UDP_TXVC" +group = "TWI", "TWI_CR", "TWI_MMR", "TWI_IADR", "TWI_CWGR", "TWI_SR", "TWI_IER", "TWI_IDR", "TWI_IMR", "TWI_RHR", "TWI_THR" +group = "US0", "US0_CR", "US0_MR", "US0_IER", "US0_IDR", "US0_IMR", "US0_CSR", "US0_RHR", "US0_THR", "US0_BRGR", "US0_RTOR", "US0_TTGR", "US0_FIDI", "US0_NER", "US0_IF" +group = "PDC_US0", "US0_RPR", "US0_RCR", "US0_TPR", "US0_TCR", "US0_RNPR", "US0_RNCR", "US0_TNPR", "US0_TNCR", "US0_PTCR", "US0_PTSR" +group = "US1", "US1_CR", "US1_MR", "US1_IER", "US1_IDR", "US1_IMR", "US1_CSR", "US1_RHR", "US1_THR", "US1_BRGR", "US1_RTOR", "US1_TTGR", "US1_FIDI", "US1_NER", "US1_IF" +group = "PDC_US1", "US1_RPR", "US1_RCR", "US1_TPR", "US1_TCR", "US1_RNPR", "US1_RNCR", "US1_TNPR", "US1_TNCR", "US1_PTCR", "US1_PTSR" +group = "PWMC", "PWMC_MR", "PWMC_ENA", "PWMC_DIS", "PWMC_SR", "PWMC_IER", "PWMC_IDR", "PWMC_IMR", "PWMC_ISR", "PWMC_VR" +group = "PWMC_CH0", "PWMC_CH0_CMR", "PWMC_CH0_CDTYR", "PWMC_CH0_CPRDR", "PWMC_CH0_CCNTR", "PWMC_CH0_CUPDR", "PWMC_CH0_Reserved" +group = "PWMC_CH1", "PWMC_CH1_CMR", "PWMC_CH1_CDTYR", "PWMC_CH1_CPRDR", "PWMC_CH1_CCNTR", "PWMC_CH1_CUPDR", "PWMC_CH1_Reserved" +group = "PWMC_CH2", "PWMC_CH2_CMR", "PWMC_CH2_CDTYR", "PWMC_CH2_CPRDR", "PWMC_CH2_CCNTR", "PWMC_CH2_CUPDR", "PWMC_CH2_Reserved" +group = "PWMC_CH3", "PWMC_CH3_CMR", "PWMC_CH3_CDTYR", "PWMC_CH3_CPRDR", "PWMC_CH3_CCNTR", "PWMC_CH3_CUPDR", "PWMC_CH3_Reserved" +group = "CAN", "CAN_MR", "CAN_IER", "CAN_IDR", "CAN_IMR", "CAN_SR", "CAN_BR", "CAN_TIM", "CAN_TIMESTP", "CAN_ECR", "CAN_TCR", "CAN_ACR", "CAN_VR" +group = "CAN_MB0", "CAN_MB0_MMR", "CAN_MB0_MAM", "CAN_MB0_MID", "CAN_MB0_MFID", "CAN_MB0_MSR", "CAN_MB0_MDL", "CAN_MB0_MDH", "CAN_MB0_MCR" +group = "CAN_MB1", "CAN_MB1_MMR", "CAN_MB1_MAM", "CAN_MB1_MID", "CAN_MB1_MFID", "CAN_MB1_MSR", "CAN_MB1_MDL", "CAN_MB1_MDH", "CAN_MB1_MCR" +group = "CAN_MB2", "CAN_MB2_MMR", "CAN_MB2_MAM", "CAN_MB2_MID", "CAN_MB2_MFID", "CAN_MB2_MSR", "CAN_MB2_MDL", "CAN_MB2_MDH", "CAN_MB2_MCR" +group = "CAN_MB3", "CAN_MB3_MMR", "CAN_MB3_MAM", "CAN_MB3_MID", "CAN_MB3_MFID", "CAN_MB3_MSR", "CAN_MB3_MDL", "CAN_MB3_MDH", "CAN_MB3_MCR" +group = "CAN_MB4", "CAN_MB4_MMR", "CAN_MB4_MAM", "CAN_MB4_MID", "CAN_MB4_MFID", "CAN_MB4_MSR", "CAN_MB4_MDL", "CAN_MB4_MDH", "CAN_MB4_MCR" +group = "CAN_MB5", "CAN_MB5_MMR", "CAN_MB5_MAM", "CAN_MB5_MID", "CAN_MB5_MFID", "CAN_MB5_MSR", "CAN_MB5_MDL", "CAN_MB5_MDH", "CAN_MB5_MCR" +group = "CAN_MB6", "CAN_MB6_MMR", "CAN_MB6_MAM", "CAN_MB6_MID", "CAN_MB6_MFID", "CAN_MB6_MSR", "CAN_MB6_MDL", "CAN_MB6_MDH", "CAN_MB6_MCR" +group = "CAN_MB7", "CAN_MB7_MMR", "CAN_MB7_MAM", "CAN_MB7_MID", "CAN_MB7_MFID", "CAN_MB7_MSR", "CAN_MB7_MDL", "CAN_MB7_MDH", "CAN_MB7_MCR" +group = "SSC", "SSC_CR", "SSC_CMR", "SSC_RCMR", "SSC_RFMR", "SSC_TCMR", "SSC_TFMR", "SSC_RHR", "SSC_THR", "SSC_RSHR", "SSC_TSHR", "SSC_SR", "SSC_IER", "SSC_IDR", "SSC_IMR" +group = "PDC_SSC", "SSC_RPR", "SSC_RCR", "SSC_TPR", "SSC_TCR", "SSC_RNPR", "SSC_RNCR", "SSC_TNPR", "SSC_TNCR", "SSC_PTCR", "SSC_PTSR" +group = "ADC", "ADC_CR", "ADC_MR", "ADC_CHER", "ADC_CHDR", "ADC_CHSR", "ADC_SR", "ADC_LCDR", "ADC_IER", "ADC_IDR", "ADC_IMR", "ADC_CDR0", "ADC_CDR1", "ADC_CDR2", "ADC_CDR3", "ADC_CDR4", "ADC_CDR5", "ADC_CDR6", "ADC_CDR7" +group = "PDC_ADC", "ADC_RPR", "ADC_RCR", "ADC_TPR", "ADC_TCR", "ADC_RNPR", "ADC_RNCR", "ADC_TNPR", "ADC_TNCR", "ADC_PTCR", "ADC_PTSR" +group = "EMAC", "EMAC_NCR", "EMAC_NCFGR", "EMAC_NSR", "EMAC_TSR", "EMAC_RBQP", "EMAC_TBQP", "EMAC_RSR", "EMAC_ISR", "EMAC_IER", "EMAC_IDR", "EMAC_IMR", "EMAC_MAN", "EMAC_PTR", "EMAC_PFR", "EMAC_FTO", "EMAC_SCF", "EMAC_MCF", "EMAC_FRO", "EMAC_FCSE", "EMAC_ALE", "EMAC_DTF", "EMAC_LCOL", "EMAC_ECOL", "EMAC_TUND", "EMAC_CSE", "EMAC_RRE", "EMAC_ROV", "EMAC_RSE", "EMAC_ELE", "EMAC_RJA", "EMAC_USF", "EMAC_STE", "EMAC_RLE", "EMAC_TPF", "EMAC_HRB", "EMAC_HRT", "EMAC_SA1L", "EMAC_SA1H", "EMAC_SA2L", "EMAC_SA2H", "EMAC_SA3L", "EMAC_SA3H", "EMAC_SA4L", "EMAC_SA4H", "EMAC_TID", "EMAC_TPQ", "EMAC_USRIO", "EMAC_WOL", "EMAC_REV" +group = "SPI0", "SPI0_CR", "SPI0_MR", "SPI0_RDR", "SPI0_TDR", "SPI0_SR", "SPI0_IER", "SPI0_IDR", "SPI0_IMR", "SPI0_CSR" +group = "PDC_SPI0", "SPI0_RPR", "SPI0_RCR", "SPI0_TPR", "SPI0_TCR", "SPI0_RNPR", "SPI0_RNCR", "SPI0_TNPR", "SPI0_TNCR", "SPI0_PTCR", "SPI0_PTSR" +group = "SPI1", "SPI1_CR", "SPI1_MR", "SPI1_RDR", "SPI1_TDR", "SPI1_SR", "SPI1_IER", "SPI1_IDR", "SPI1_IMR", "SPI1_CSR" +group = "PDC_SPI1", "SPI1_RPR", "SPI1_RCR", "SPI1_TPR", "SPI1_TCR", "SPI1_RNPR", "SPI1_RNCR", "SPI1_TNPR", "SPI1_TNCR", "SPI1_PTCR", "SPI1_PTSR" +group = "SYS" +group = "AIC", "AIC_SMR", "AIC_SVR", "AIC_IVR", "AIC_FVR", "AIC_ISR", "AIC_IPR", "AIC_IMR", "AIC_CISR", "AIC_IECR", "AIC_IDCR", "AIC_ICCR", "AIC_ISCR", "AIC_EOICR", "AIC_SPU", "AIC_DCR", "AIC_FFER", "AIC_FFDR", "AIC_FFSR" +group = "DBGU", "DBGU_CR", "DBGU_MR", "DBGU_IER", "DBGU_IDR", "DBGU_IMR", "DBGU_CSR", "DBGU_RHR", "DBGU_THR", "DBGU_BRGR", "DBGU_CIDR", "DBGU_EXID", "DBGU_FNTR" +group = "PDC_DBGU", "DBGU_RPR", "DBGU_RCR", "DBGU_TPR", "DBGU_TCR", "DBGU_RNPR", "DBGU_RNCR", "DBGU_TNPR", "DBGU_TNCR", "DBGU_PTCR", "DBGU_PTSR" +group = "PIOA", "PIOA_PER", "PIOA_PDR", "PIOA_PSR", "PIOA_OER", "PIOA_ODR", "PIOA_OSR", "PIOA_IFER", "PIOA_IFDR", "PIOA_IFSR", "PIOA_SODR", "PIOA_CODR", "PIOA_ODSR", "PIOA_PDSR", "PIOA_IER", "PIOA_IDR", "PIOA_IMR", "PIOA_ISR", "PIOA_MDER", "PIOA_MDDR", "PIOA_MDSR", "PIOA_PPUDR", "PIOA_PPUER", "PIOA_PPUSR", "PIOA_ASR", "PIOA_BSR", "PIOA_ABSR", "PIOA_OWER", "PIOA_OWDR", "PIOA_OWSR" +group = "PIOB", "PIOB_PER", "PIOB_PDR", "PIOB_PSR", "PIOB_OER", "PIOB_ODR", "PIOB_OSR", "PIOB_IFER", "PIOB_IFDR", "PIOB_IFSR", "PIOB_SODR", "PIOB_CODR", "PIOB_ODSR", "PIOB_PDSR", "PIOB_IER", "PIOB_IDR", "PIOB_IMR", "PIOB_ISR", "PIOB_MDER", "PIOB_MDDR", "PIOB_MDSR", "PIOB_PPUDR", "PIOB_PPUER", "PIOB_PPUSR", "PIOB_ASR", "PIOB_BSR", "PIOB_ABSR", "PIOB_OWER", "PIOB_OWDR", "PIOB_OWSR" +group = "PMC", "PMC_SCER", "PMC_SCDR", "PMC_SCSR", "PMC_PCER", "PMC_PCDR", "PMC_PCSR", "PMC_MOR", "PMC_MCFR", "PMC_PLLR", "PMC_MCKR", "PMC_PCKR", "PMC_IER", "PMC_IDR", "PMC_SR", "PMC_IMR" +group = "CKGR", "CKGR_MOR", "CKGR_MCFR", "CKGR_PLLR" +group = "RSTC", "RSTC_RCR", "RSTC_RSR", "RSTC_RMR" +group = "RTTC", "RTTC_RTMR", "RTTC_RTAR", "RTTC_RTVR", "RTTC_RTSR" +group = "PITC", "PITC_PIMR", "PITC_PISR", "PITC_PIVR", "PITC_PIIR" +group = "WDTC", "WDTC_WDCR", "WDTC_WDMR", "WDTC_WDSR" +group = "VREG", "VREG_MR" +group = "MC", "MC_RCR", "MC_ASR", "MC_AASR", "MC_FMR", "MC_FCR", "MC_FSR" diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/cmock_demo.dep b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/cmock_demo.dep new file mode 100644 index 0000000..ed68769 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/cmock_demo.dep @@ -0,0 +1,3691 @@ + + + + 2 + + Debug + + $PROJ_DIR$\Debug\Obj\Main.r79 + $PROJ_DIR$\Debug\Obj\IntrinsicsWrapper.r79 + $PROJ_DIR$\Debug\Obj\cmock_demo.pbd + $PROJ_DIR$\Debug\Obj\TimerInterruptConfigurator.r79 + $PROJ_DIR$\Debug\Obj\AdcConductor.r79 + $PROJ_DIR$\Debug\Obj\AdcModel.pbi + $PROJ_DIR$\Debug\Obj\Model.pbi + $PROJ_DIR$\Debug\Obj\AdcModel.r79 + $PROJ_DIR$\Debug\Obj\UsartModel.r79 + $PROJ_DIR$\Debug\Obj\TemperatureFilter.pbi + $PROJ_DIR$\Debug\List\AdcHardwareConfigurator.lst + $PROJ_DIR$\Debug\Obj\UsartConductor.pbi + $PROJ_DIR$\..\..\examples\src\Types.h + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.h + $TOOLKIT_DIR$\inc\DLib_Defaults.h + $PROJ_DIR$\..\..\examples\src\AT91SAM7X256.h + $PROJ_DIR$\..\..\examples\src\AdcConductor.h + $PROJ_DIR$\Debug\List\TimerInterruptHandler.lst + $PROJ_DIR$\..\..\examples\src\TaskScheduler.h + $PROJ_DIR$\..\..\examples\src\UsartConductor.h + $PROJ_DIR$\..\..\examples\src\Model.h + $TOOLKIT_DIR$\inc\intrinsics.h + $PROJ_DIR$\Debug\Obj\UsartHardware.pbi + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.h + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.h + $PROJ_DIR$\Debug\Exe\cmock_demo.d79 + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.h + $PROJ_DIR$\..\..\examples\src\AdcHardware.h + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.h + $PROJ_DIR$\..\..\examples\src\TimerConductor.h + $PROJ_DIR$\..\..\examples\src\UsartPutChar.h + $PROJ_DIR$\Debug\Obj\Executor.pbi + $PROJ_DIR$\..\..\examples\src\UsartModel.h + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.h + $PROJ_DIR$\Debug\List\UsartBaudRateRegisterCalculator.lst + $PROJ_DIR$\..\..\examples\src\UsartHardware.h + $PROJ_DIR$\Debug\List\UsartModel.lst + $PROJ_DIR$\Debug\List\Executor.lst + $PROJ_DIR$\Debug\List\UsartTransmitBufferStatus.lst + $PROJ_DIR$\Debug\Exe\cmock_demo.sim + $PROJ_DIR$\Debug\List\TimerModel.lst + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.h + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.h + $PROJ_DIR$\Debug\List\TimerHardware.lst + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.h + $PROJ_DIR$\Debug\Obj\UsartTransmitBufferStatus.r79 + $PROJ_DIR$\..\..\examples\src\TimerModel.h + $PROJ_DIR$\Debug\List\IntrinsicsWrapper.lst + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.h + $PROJ_DIR$\..\..\examples\src\TimerHardware.h + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.h + $PROJ_DIR$\Debug\List\Cstartup_SAM7.lst + $TOOLKIT_DIR$\inc\DLib_Product.h + $PROJ_DIR$\Debug\Obj\UsartModel.pbi + $TOOLKIT_DIR$\inc\math.h + $PROJ_DIR$\Debug\Obj\AdcHardware.r79 + $PROJ_DIR$\Debug\Obj\TimerModel.r79 + $TOOLKIT_DIR$\inc\stdio.h + $PROJ_DIR$\Debug\Obj\UsartConfigurator.pbi + $PROJ_DIR$\Debug\List\AdcModel.lst + $PROJ_DIR$\Debug\List\AdcConductor.lst + $PROJ_DIR$\Debug\List\UsartConductor.lst + $PROJ_DIR$\Debug\List\Model.lst + $PROJ_DIR$\Debug\List\TaskScheduler.lst + $PROJ_DIR$\Debug\List\UsartHardware.lst + $PROJ_DIR$\Debug\List\AdcHardware.lst + $PROJ_DIR$\Debug\List\Main.lst + $PROJ_DIR$\Debug\Obj\UsartBaudRateRegisterCalculator.r79 + $PROJ_DIR$\Debug\Obj\AdcConductor.pbi + $PROJ_DIR$\Debug\Obj\TaskScheduler.pbi + $PROJ_DIR$\Debug\List\UsartConfigurator.lst + $PROJ_DIR$\Debug\Obj\TaskScheduler.r79 + $TOOLKIT_DIR$\inc\ymath.h + $PROJ_DIR$\Debug\Obj\TemperatureFilter.r79 + $TOOLKIT_DIR$\inc\ysizet.h + $PROJ_DIR$\Debug\Obj\TimerHardware.pbi + $PROJ_DIR$\Debug\Obj\TemperatureCalculator.r79 + $PROJ_DIR$\Debug\Obj\AdcTemperatureSensor.pbi + $PROJ_DIR$\Debug\List\TemperatureCalculator.lst + $PROJ_DIR$\Debug\List\AdcTemperatureSensor.lst + $TOOLKIT_DIR$\lib\dl4tptinl8n.h + $PROJ_DIR$\Debug\Obj\AdcHardware.pbi + $PROJ_DIR$\Debug\Obj\UsartConfigurator.r79 + $TOOLKIT_DIR$\inc\xencoding_limits.h + $PROJ_DIR$\Debug\Obj\TimerConfigurator.r79 + $PROJ_DIR$\Debug\Obj\AdcTemperatureSensor.r79 + $PROJ_DIR$\Debug\Obj\Main.pbi + $TOOLKIT_DIR$\lib\dl4tptinl8n.r79 + $PROJ_DIR$\Debug\Obj\TimerInterruptHandler.r79 + $PROJ_DIR$\Debug\Obj\UsartHardware.r79 + $PROJ_DIR$\Debug\Obj\UsartPutChar.pbi + $PROJ_DIR$\Debug\Obj\TimerInterruptConfigurator.pbi + $TOOLKIT_DIR$\inc\yvals.h + $PROJ_DIR$\Debug\Obj\UsartTransmitBufferStatus.pbi + $PROJ_DIR$\Debug\Obj\IntrinsicsWrapper.pbi + $PROJ_DIR$\Debug\Obj\AdcHardwareConfigurator.r79 + $PROJ_DIR$\incIAR\AT91SAM7X256_inc.h + $TOOLKIT_DIR$\inc\DLib_Threads.h + $PROJ_DIR$\Debug\Obj\TimerConfigurator.pbi + $PROJ_DIR$\Debug\Obj\TimerConductor.pbi + $PROJ_DIR$\Debug\Obj\TimerInterruptHandler.pbi + $PROJ_DIR$\Debug\Obj\UsartPutChar.r79 + $PROJ_DIR$\Debug\Obj\UsartConductor.r79 + $PROJ_DIR$\Debug\Obj\TimerHardware.r79 + $PROJ_DIR$\Debug\Obj\Cstartup_SAM7.r79 + $PROJ_DIR$\Debug\List\cmock_demo.map + $PROJ_DIR$\Debug\List\TimerInterruptConfigurator.lst + $PROJ_DIR$\Debug\Obj\TimerConductor.r79 + $PROJ_DIR$\Debug\Obj\Model.r79 + $PROJ_DIR$\Debug\Obj\UsartBaudRateRegisterCalculator.pbi + $PROJ_DIR$\Debug\Obj\AdcHardwareConfigurator.pbi + $PROJ_DIR$\Debug\Obj\TemperatureCalculator.pbi + $PROJ_DIR$\Debug\Obj\Cstartup_SAM7.pbi + $PROJ_DIR$\Resource\at91SAM7X256_FLASH.xcl + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + $PROJ_DIR$\..\..\examples\src\TimerModel.c + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + $PROJ_DIR$\..\..\examples\src\UsartModel.c + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + $PROJ_DIR$\Cstartup.s79 + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + $PROJ_DIR$\Cstartup_SAM7.c + $PROJ_DIR$\..\..\examples\src\AdcModel.c + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + $PROJ_DIR$\..\..\examples\src\Executor.c + $PROJ_DIR$\..\..\examples\src\Main.c + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + $PROJ_DIR$\..\..\examples\src\Model.c + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + $PROJ_DIR$\Debug\Obj\Cstartup.r79 + $PROJ_DIR$\Debug\List\TimerConfigurator.lst + $PROJ_DIR$\..\..\examples\src\Executor.h + $PROJ_DIR$\Debug\List\TimerConductor.lst + $PROJ_DIR$\..\..\examples\src\AdcModel.h + $PROJ_DIR$\..\..\examples\src\ModelConfig.h + $PROJ_DIR$\Debug\Obj\Executor.r79 + $PROJ_DIR$\Debug\List\UsartPutChar.lst + $PROJ_DIR$\Debug\List\TemperatureFilter.lst + $PROJ_DIR$\Debug\Obj\TimerModel.pbi + $PROJ_DIR$\srcIAR\Cstartup.s79 + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + + + [ROOT_NODE] + + + XLINK + 25 105 39 + + + + + $PROJ_DIR$\Debug\Obj\cmock_demo.pbd + + + BILINK + 68 81 110 5 77 112 31 94 86 6 69 111 9 99 98 75 91 100 150 109 11 58 22 53 90 93 + + + + + $PROJ_DIR$\Debug\Exe\cmock_demo.d79 + + + XLINK + 105 39 + + + + + XLINK + 113 4 55 95 7 85 141 104 147 1 0 108 71 76 73 107 84 103 3 88 56 67 102 82 89 8 101 45 87 + + + + + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + + + ICCARM + 107 144 + + + BICOMP + 99 + + + + + ICCARM + 12 15 29 46 49 44 + + + BICOMP + 12 15 29 46 49 44 + + + + + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + + + ICCARM + 84 142 + + + BICOMP + 98 + + + + + ICCARM + 12 15 48 42 + + + BICOMP + 12 15 48 42 + + + + + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + + + ICCARM + 103 43 + + + BICOMP + 75 + + + + + ICCARM + 12 15 49 48 + + + BICOMP + 12 15 49 48 + + + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + + + ICCARM + 3 106 + + + BICOMP + 91 + + + + + ICCARM + 12 15 42 44 + + + BICOMP + 12 15 42 44 + + + + + $PROJ_DIR$\..\..\examples\src\TimerModel.c + + + ICCARM + 56 40 + + + BICOMP + 150 + + + + + ICCARM + 12 15 46 18 + + + BICOMP + 12 15 46 18 + + + + + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + + + ICCARM + 67 34 + + + BICOMP + 109 + + + + + ICCARM + 12 15 50 + + + BICOMP + 12 15 50 + + + + + $PROJ_DIR$\..\..\examples\src\UsartModel.c + + + ICCARM + 8 36 + + + BICOMP + 53 + + + + + ICCARM + 12 15 32 146 50 28 57 92 14 80 52 83 97 74 54 72 + + + BICOMP + 12 15 32 146 50 28 57 92 14 52 83 97 74 54 72 + + + + + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + + + ICCARM + 102 61 + + + BICOMP + 11 + + + + + ICCARM + 12 15 19 35 32 18 + + + BICOMP + 12 15 19 35 32 18 + + + + + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + + + ICCARM + 82 70 + + + BICOMP + 58 + + + + + ICCARM + 12 15 26 + + + BICOMP + 12 15 26 + + + + + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + + + ICCARM + 89 64 + + + BICOMP + 22 + + + + + ICCARM + 12 15 35 26 30 + + + BICOMP + 12 15 35 26 30 + + + + + $PROJ_DIR$\Cstartup.s79 + + + AARM + 141 + + + + + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + + + ICCARM + 101 148 + + + BICOMP + 90 + + + + + ICCARM + 12 15 30 41 + + + BICOMP + 12 15 30 41 + + + + + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + + + ICCARM + 45 38 + + + BICOMP + 93 + + + + + ICCARM + 12 15 41 + + + BICOMP + 12 15 41 + + + + + $PROJ_DIR$\Cstartup_SAM7.c + + + ICCARM + 104 51 + + + BICOMP + 112 + + + + + ICCARM + 15 + + + + + $PROJ_DIR$\..\..\examples\src\AdcModel.c + + + ICCARM + 7 59 + + + BICOMP + 5 + + + + + ICCARM + 12 15 145 18 23 28 + + + BICOMP + 12 15 145 18 23 28 + + + + + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + + + ICCARM + 85 79 + + + BICOMP + 77 + + + + + ICCARM + 12 15 24 + + + BICOMP + 12 15 24 + + + + + $PROJ_DIR$\..\..\examples\src\Executor.c + + + ICCARM + 147 37 + + + BICOMP + 31 + + + + + ICCARM + 12 15 143 20 19 29 16 33 + + + BICOMP + 12 15 143 20 19 29 16 33 + + + + + $PROJ_DIR$\..\..\examples\src\Main.c + + + ICCARM + 0 66 + + + BICOMP + 86 + + + + + ICCARM + 12 15 33 143 20 18 23 28 19 35 26 30 32 50 41 29 49 48 42 44 46 16 27 13 24 145 + + + BICOMP + 12 15 33 143 20 18 23 28 19 35 26 30 32 50 41 29 49 48 42 44 46 16 27 13 24 145 + + + + + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + + + ICCARM + 1 47 + + + BICOMP + 94 + + + + + ICCARM + 33 21 + + + BICOMP + 33 21 + + + + + $PROJ_DIR$\..\..\examples\src\Model.c + + + ICCARM + 108 62 + + + BICOMP + 6 + + + + + ICCARM + 20 12 15 18 28 + + + BICOMP + 20 12 15 18 28 + + + + + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + + + ICCARM + 76 78 + + + BICOMP + 111 + + + + + ICCARM + 12 15 23 54 72 92 14 80 52 83 97 + + + BICOMP + 12 15 23 54 72 92 14 52 83 97 + + + + + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + + + ICCARM + 71 63 + + + BICOMP + 69 + + + + + ICCARM + 12 15 18 + + + BICOMP + 12 15 18 + + + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + + + ICCARM + 88 17 + + + BICOMP + 100 + + + + + ICCARM + 12 15 44 42 + + + BICOMP + 12 15 44 42 + + + + + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + + + ICCARM + 73 149 + + + BICOMP + 9 + + + + + ICCARM + 12 15 28 54 72 92 14 80 52 83 97 + + + BICOMP + 12 15 28 54 72 92 14 52 83 97 + + + + + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + + + ICCARM + 95 10 + + + BICOMP + 110 + + + + + ICCARM + 12 15 13 146 + + + BICOMP + 12 15 13 146 + + + + + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + + + ICCARM + 4 60 + + + BICOMP + 68 + + + + + ICCARM + 12 15 16 145 27 + + + BICOMP + 12 15 16 145 27 + + + + + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + + + ICCARM + 55 65 + + + BICOMP + 81 + + + + + ICCARM + 12 15 27 13 24 + + + BICOMP + 12 15 27 13 24 + + + + + $PROJ_DIR$\srcIAR\Cstartup.s79 + + + AARM + 141 + + + + + AARM + 96 + + + + + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + + + ICCARM + 104 51 + + + BICOMP + 112 + + + + + ICCARM + 15 + + + + + + Release + + $PROJ_DIR$\..\test\system\src\TemperatureCalculator.h + $PROJ_DIR$\..\..\examples\src\Types.h + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.h + $TOOLKIT_DIR$\inc\DLib_Defaults.h + $PROJ_DIR$\..\..\examples\src\AT91SAM7X256.h + $PROJ_DIR$\..\..\examples\src\AdcConductor.h + $PROJ_DIR$\..\..\examples\src\TaskScheduler.h + $PROJ_DIR$\..\..\examples\src\UsartConductor.h + $PROJ_DIR$\..\..\examples\src\Model.h + $TOOLKIT_DIR$\inc\intrinsics.h + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.h + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.h + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.h + $PROJ_DIR$\..\..\examples\src\AdcHardware.h + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.h + $PROJ_DIR$\..\..\examples\src\TimerConductor.h + $PROJ_DIR$\..\..\examples\src\UsartPutChar.h + $PROJ_DIR$\..\..\examples\src\UsartModel.h + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.h + $PROJ_DIR$\..\..\examples\src\UsartHardware.h + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.h + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.h + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.h + $PROJ_DIR$\..\..\examples\src\TimerModel.h + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.h + $PROJ_DIR$\..\..\examples\src\TimerHardware.h + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.h + $TOOLKIT_DIR$\inc\DLib_Product.h + $TOOLKIT_DIR$\inc\math.h + $TOOLKIT_DIR$\inc\stdio.h + $TOOLKIT_DIR$\inc\ymath.h + $TOOLKIT_DIR$\inc\ysizet.h + $TOOLKIT_DIR$\lib\dl4tptinl8n.h + $PROJ_DIR$\..\test\system\src\UsartPutChar.h + $PROJ_DIR$\..\test\system\src\AdcTemperatureSensor.h + $PROJ_DIR$\..\test\system\src\TaskScheduler.h + $PROJ_DIR$\..\test\system\src\UsartTransmitBufferStatus.h + $PROJ_DIR$\..\test\system\src\UsartConfigurator.h + $PROJ_DIR$\..\test\system\src\TimerConfigurator.h + $PROJ_DIR$\..\test\system\src\AT91SAM7X256.h + $PROJ_DIR$\..\test\system\src\UsartBaudRateRegisterCalculator.h + $PROJ_DIR$\..\test\system\src\Executor.h + $PROJ_DIR$\..\test\system\src\ModelConfig.h + $PROJ_DIR$\..\test\system\src\TimerModel.h + $PROJ_DIR$\..\test\system\src\TimerInterruptHandler.h + $PROJ_DIR$\..\test\system\src\Main.c + $PROJ_DIR$\..\test\system\src\Model.c + $PROJ_DIR$\..\test\system\src\AdcHardwareConfigurator.c + $PROJ_DIR$\..\test\system\src\TimerModel.c + $PROJ_DIR$\..\test\system\src\UsartModel.c + $PROJ_DIR$\..\test\system\src\UsartHardware.c + $PROJ_DIR$\..\test\system\src\UsartTransmitBufferStatus.c + $PROJ_DIR$\..\test\system\src\UsartPutChar.c + $PROJ_DIR$\..\test\system\src\TimerInterruptConfigurator.c + $PROJ_DIR$\..\test\system\src\UsartBaudRateRegisterCalculator.c + $PROJ_DIR$\..\test\system\src\TaskScheduler.c + $PROJ_DIR$\..\test\system\src\AdcConductor.h + $PROJ_DIR$\..\test\system\src\TimerInterruptConfigurator.h + $PROJ_DIR$\..\test\system\src\Model.h + $PROJ_DIR$\..\test\system\src\TemperatureFilter.h + $PROJ_DIR$\..\test\system\src\AdcModel.c + $PROJ_DIR$\..\test\system\src\TimerHardware.h + $PROJ_DIR$\..\test\system\src\AdcTemperatureSensor.c + $PROJ_DIR$\..\test\system\src\AdcConductor.c + $PROJ_DIR$\..\test\system\src\AdcHardware.c + $PROJ_DIR$\..\test\system\src\AdcHardware.h + $PROJ_DIR$\..\test\system\src\Executor.c + $TOOLKIT_DIR$\inc\xencoding_limits.h + $TOOLKIT_DIR$\lib\dl4tptinl8n.r79 + $PROJ_DIR$\..\test\system\src\TemperatureCalculator.c + $PROJ_DIR$\..\test\system\src\Types.h + $PROJ_DIR$\..\test\system\src\TemperatureFilter.c + $PROJ_DIR$\..\test\system\src\TimerConductor.c + $PROJ_DIR$\..\test\system\src\TimerConfigurator.c + $PROJ_DIR$\..\test\system\src\TimerHardware.c + $PROJ_DIR$\..\test\system\src\TimerInterruptHandler.c + $PROJ_DIR$\..\test\system\src\UsartConductor.c + $PROJ_DIR$\..\test\system\src\UsartConfigurator.c + $PROJ_DIR$\..\test\system\src\UsartHardware.h + $PROJ_DIR$\..\test\system\src\TimerConductor.h + $PROJ_DIR$\..\test\system\src\AdcModel.h + $PROJ_DIR$\..\test\system\src\AdcHardwareConfigurator.h + $PROJ_DIR$\..\test\system\src\UsartConductor.h + $PROJ_DIR$\Release\Obj\Executor.pbi + $PROJ_DIR$\..\test\system\src\UsartModel.h + $PROJ_DIR$\Release\Obj\Model.pbi + $PROJ_DIR$\Release\Obj\Cstartup_SAM7.pbi + $PROJ_DIR$\Release\Obj\UsartConductor.pbi + $PROJ_DIR$\Release\Obj\AdcConductor.r79 + $PROJ_DIR$\Release\Obj\AdcHardware.r79 + $PROJ_DIR$\Release\Obj\TimerModel.pbi + $PROJ_DIR$\Release\Obj\AdcTemperatureSensor.pbi + $PROJ_DIR$\Release\Obj\UsartHardware.r79 + $PROJ_DIR$\Release\Obj\TemperatureFilter.pbi + $PROJ_DIR$\Release\Obj\UsartPutChar.pbi + $PROJ_DIR$\Release\Obj\TemperatureCalculator.r79 + $PROJ_DIR$\Release\Obj\AdcHardwareConfigurator.r79 + $PROJ_DIR$\Release\Obj\cmock_demo.pbd + $PROJ_DIR$\Release\Obj\UsartModel.r79 + $PROJ_DIR$\Release\Obj\UsartBaudRateRegisterCalculator.r79 + $PROJ_DIR$\Release\Obj\Model.r79 + $PROJ_DIR$\Release\Obj\AdcModel.r79 + $PROJ_DIR$\Release\Obj\AdcHardware.pbi + $PROJ_DIR$\Release\Obj\TimerModel.r79 + $PROJ_DIR$\Release\Obj\TimerHardware.r79 + $PROJ_DIR$\Release\Obj\UsartPutChar.r79 + $PROJ_DIR$\Release\Obj\AdcHardwareConfigurator.pbi + $PROJ_DIR$\Release\Obj\TimerInterruptConfigurator.r79 + $PROJ_DIR$\Release\Obj\TaskScheduler.pbi + $PROJ_DIR$\Release\List\cmock_demo.map + $PROJ_DIR$\Release\Obj\UsartTransmitBufferStatus.pbi + $PROJ_DIR$\Release\Exe\cmock_demo.d79 + $PROJ_DIR$\Release\Obj\AdcTemperatureSensor.r79 + $PROJ_DIR$\Release\Obj\TimerConductor.r79 + $PROJ_DIR$\Release\Obj\TimerConfigurator.r79 + $PROJ_DIR$\Release\Obj\Main.pbi + $PROJ_DIR$\Release\Obj\TimerInterruptConfigurator.pbi + $PROJ_DIR$\Release\Obj\UsartTransmitBufferStatus.r79 + $PROJ_DIR$\Release\Obj\AdcModel.pbi + $PROJ_DIR$\Release\Obj\TemperatureFilter.r79 + $PROJ_DIR$\Release\Obj\UsartHardware.pbi + $PROJ_DIR$\Release\Obj\Cstartup.r79 + $PROJ_DIR$\Release\Obj\UsartConductor.r79 + $PROJ_DIR$\Release\Obj\TimerInterruptHandler.pbi + $PROJ_DIR$\Release\Obj\TimerConductor.pbi + $PROJ_DIR$\Release\Obj\Main.r79 + $PROJ_DIR$\Release\Obj\UsartConfigurator.pbi + $PROJ_DIR$\Release\Obj\Executor.r79 + $PROJ_DIR$\Release\Obj\Cstartup_SAM7.r79 + $PROJ_DIR$\Release\Obj\TemperatureCalculator.pbi + $PROJ_DIR$\Release\Obj\TimerHardware.pbi + $PROJ_DIR$\Release\Exe\cmock_demo.sim + $PROJ_DIR$\Release\Obj\TimerConfigurator.pbi + $PROJ_DIR$\Release\Obj\UsartModel.pbi + $PROJ_DIR$\Release\Obj\TaskScheduler.r79 + $PROJ_DIR$\Release\Obj\UsartBaudRateRegisterCalculator.pbi + $PROJ_DIR$\Release\Obj\AdcConductor.pbi + $PROJ_DIR$\Release\Obj\TimerInterruptHandler.r79 + $PROJ_DIR$\Release\Obj\UsartConfigurator.r79 + $PROJ_DIR$\Release\Obj\IntrinsicsWrapper.pbi + $PROJ_DIR$\Release\Obj\IntrinsicsWrapper.r79 + $TOOLKIT_DIR$\inc\yvals.h + $PROJ_DIR$\incIAR\AT91SAM7X256_inc.h + $TOOLKIT_DIR$\inc\DLib_Threads.h + $PROJ_DIR$\Resource\at91SAM7X256_FLASH.xcl + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + $PROJ_DIR$\..\..\examples\src\TimerModel.c + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + $PROJ_DIR$\..\..\examples\src\UsartModel.c + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + $PROJ_DIR$\Cstartup.s79 + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + $PROJ_DIR$\Cstartup_SAM7.c + $PROJ_DIR$\..\..\examples\src\AdcModel.c + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + $PROJ_DIR$\..\..\examples\src\Executor.c + $PROJ_DIR$\..\..\examples\src\Main.c + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + $PROJ_DIR$\..\..\examples\src\Model.c + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + $PROJ_DIR$\..\..\examples\src\Executor.h + $PROJ_DIR$\..\..\examples\src\AdcModel.h + $PROJ_DIR$\..\..\examples\src\ModelConfig.h + $PROJ_DIR$\srcIAR\Cstartup.s79 + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + + + [ROOT_NODE] + + + XLINK + 111 109 131 + + + + + $PROJ_DIR$\..\test\system\src\Main.c + + + ICCARM + 125 + + + BICOMP + 115 + + + + + ICCARM + 70 39 41 58 35 0 59 82 78 37 33 84 40 36 79 61 38 57 44 43 56 65 81 34 80 + + + + + $PROJ_DIR$\..\test\system\src\Model.c + + + ICCARM + 100 + + + BICOMP + 85 + + + + + ICCARM + 58 70 39 35 59 + + + + + $PROJ_DIR$\..\test\system\src\AdcHardwareConfigurator.c + + + ICCARM + 96 + + + BICOMP + 106 + + + + + ICCARM + 70 39 81 42 + + + + + $PROJ_DIR$\..\test\system\src\TimerModel.c + + + ICCARM + 103 + + + BICOMP + 90 + + + + + ICCARM + 70 39 43 35 + + + + + $PROJ_DIR$\..\test\system\src\UsartModel.c + + + ICCARM + 98 + + + BICOMP + 133 + + + + + ICCARM + 70 39 84 42 40 59 29 141 3 32 27 67 143 31 28 30 + + + + + $PROJ_DIR$\..\test\system\src\UsartHardware.c + + + ICCARM + 92 + + + BICOMP + 120 + + + + + ICCARM + 70 39 78 37 33 + + + + + $PROJ_DIR$\..\test\system\src\UsartTransmitBufferStatus.c + + + ICCARM + 117 + + + BICOMP + 110 + + + + + ICCARM + 70 39 36 + + + + + $PROJ_DIR$\..\test\system\src\UsartPutChar.c + + + ICCARM + 105 + + + BICOMP + 94 + + + + + ICCARM + 70 39 33 36 + + + + + $PROJ_DIR$\..\test\system\src\TimerInterruptConfigurator.c + + + ICCARM + 107 + + + BICOMP + 116 + + + + + ICCARM + 70 39 57 44 + + + + + $PROJ_DIR$\..\test\system\src\UsartBaudRateRegisterCalculator.c + + + ICCARM + 99 + + + BICOMP + 135 + + + + + ICCARM + 70 39 40 + + + + + $PROJ_DIR$\..\test\system\src\TaskScheduler.c + + + ICCARM + 134 + + + BICOMP + 108 + + + + + ICCARM + 70 39 35 + + + + + $PROJ_DIR$\..\test\system\src\AdcModel.c + + + ICCARM + 101 + + + BICOMP + 118 + + + + + ICCARM + 70 39 80 35 0 59 + + + + + $PROJ_DIR$\..\test\system\src\AdcTemperatureSensor.c + + + ICCARM + 112 + + + BICOMP + 91 + + + + + ICCARM + 70 39 34 + + + + + $PROJ_DIR$\..\test\system\src\AdcConductor.c + + + ICCARM + 88 + + + BICOMP + 136 + + + + + $PROJ_DIR$\..\test\system\src\AdcHardware.c + + + ICCARM + 89 + + + BICOMP + 102 + + + + + ICCARM + 70 39 65 81 34 + + + + + $PROJ_DIR$\..\test\system\src\Executor.c + + + ICCARM + 127 + + + BICOMP + 83 + + + + + ICCARM + 70 39 41 58 82 79 56 + + + + + $PROJ_DIR$\..\test\system\src\TemperatureCalculator.c + + + ICCARM + 95 + + + BICOMP + 129 + + + + + ICCARM + 70 39 0 28 30 141 3 32 27 67 143 + + + + + $PROJ_DIR$\..\test\system\src\TemperatureFilter.c + + + ICCARM + 119 + + + BICOMP + 93 + + + + + ICCARM + 70 39 59 28 30 141 3 32 27 67 143 + + + + + $PROJ_DIR$\..\test\system\src\TimerConductor.c + + + ICCARM + 113 + + + BICOMP + 124 + + + + + ICCARM + 70 39 79 43 61 44 + + + + + $PROJ_DIR$\..\test\system\src\TimerConfigurator.c + + + ICCARM + 114 + + + BICOMP + 132 + + + + + ICCARM + 70 39 38 57 + + + + + $PROJ_DIR$\..\test\system\src\TimerHardware.c + + + ICCARM + 104 + + + BICOMP + 130 + + + + + ICCARM + 70 39 61 38 + + + + + $PROJ_DIR$\..\test\system\src\TimerInterruptHandler.c + + + ICCARM + 137 + + + BICOMP + 123 + + + + + ICCARM + 70 39 44 57 + + + + + $PROJ_DIR$\..\test\system\src\UsartConductor.c + + + ICCARM + 122 + + + BICOMP + 87 + + + + + ICCARM + 70 39 82 78 84 35 + + + + + $PROJ_DIR$\..\test\system\src\UsartConfigurator.c + + + ICCARM + 138 + + + BICOMP + 126 + + + + + ICCARM + 70 39 37 + + + + + $PROJ_DIR$\Release\Obj\cmock_demo.pbd + + + BILINK + 136 102 106 118 91 86 83 139 115 85 108 129 93 124 132 130 116 123 90 135 87 126 120 133 94 110 + + + + + $PROJ_DIR$\Release\Exe\cmock_demo.d79 + + + XLINK + 109 131 + + + + + XLINK + 144 88 89 96 101 112 121 128 127 140 125 100 134 95 119 113 114 104 107 137 103 99 122 138 92 98 105 117 68 + + + + + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + + + ICCARM + 113 + + + BICOMP + 124 + + + + + ICCARM + 1 4 15 23 25 22 + + + BICOMP + 1 4 15 23 25 22 + + + + + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + + + ICCARM + 114 + + + BICOMP + 132 + + + + + ICCARM + 1 4 24 21 + + + BICOMP + 1 4 24 21 + + + + + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + + + ICCARM + 104 + + + BICOMP + 130 + + + + + ICCARM + 1 4 25 24 + + + BICOMP + 1 4 25 24 + + + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + + + ICCARM + 107 + + + BICOMP + 116 + + + + + ICCARM + 1 4 21 22 + + + BICOMP + 1 4 21 22 + + + + + $PROJ_DIR$\..\..\examples\src\TimerModel.c + + + ICCARM + 103 + + + BICOMP + 90 + + + + + ICCARM + 1 4 23 6 + + + BICOMP + 1 4 23 6 + + + + + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + + + ICCARM + 99 + + + BICOMP + 135 + + + + + ICCARM + 1 4 26 + + + BICOMP + 1 4 26 + + + + + $PROJ_DIR$\..\..\examples\src\UsartModel.c + + + ICCARM + 98 + + + BICOMP + 133 + + + + + ICCARM + 1 4 17 174 26 14 29 141 3 32 27 67 143 31 28 30 + + + BICOMP + 1 4 17 174 26 14 29 141 3 27 67 143 31 28 30 + + + + + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + + + ICCARM + 122 + + + BICOMP + 87 + + + + + ICCARM + 1 4 7 19 17 6 + + + BICOMP + 1 4 7 19 17 6 + + + + + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + + + ICCARM + 138 + + + BICOMP + 126 + + + + + ICCARM + 1 4 12 + + + BICOMP + 1 4 12 + + + + + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + + + ICCARM + 92 + + + BICOMP + 120 + + + + + ICCARM + 1 4 19 12 16 + + + BICOMP + 1 4 19 12 16 + + + + + $PROJ_DIR$\Cstartup.s79 + + + AARM + 121 + + + + + AARM + 142 + + + + + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + + + ICCARM + 105 + + + BICOMP + 94 + + + + + ICCARM + 1 4 16 20 + + + BICOMP + 1 4 16 20 + + + + + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + + + ICCARM + 117 + + + BICOMP + 110 + + + + + ICCARM + 1 4 20 + + + BICOMP + 1 4 20 + + + + + $PROJ_DIR$\Cstartup_SAM7.c + + + ICCARM + 128 + + + BICOMP + 86 + + + + + ICCARM + 4 + + + BICOMP + 4 + + + + + $PROJ_DIR$\..\..\examples\src\AdcModel.c + + + ICCARM + 101 + + + BICOMP + 118 + + + + + ICCARM + 1 4 173 6 10 14 + + + BICOMP + 1 4 173 6 10 14 + + + + + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + + + ICCARM + 112 + + + BICOMP + 91 + + + + + ICCARM + 1 4 11 + + + BICOMP + 1 4 11 + + + + + $PROJ_DIR$\..\..\examples\src\Executor.c + + + ICCARM + 127 + + + BICOMP + 83 + + + + + ICCARM + 1 4 172 8 7 15 5 18 + + + BICOMP + 1 4 172 8 7 15 5 18 + + + + + $PROJ_DIR$\..\..\examples\src\Main.c + + + ICCARM + 125 + + + BICOMP + 115 + + + + + ICCARM + 1 4 18 172 8 6 10 14 7 19 12 16 17 26 20 15 25 24 21 22 23 5 13 2 11 173 + + + BICOMP + 1 4 18 172 8 6 10 14 7 19 12 16 17 26 20 15 25 24 21 22 23 5 13 2 11 173 + + + + + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + + + ICCARM + 140 + + + BICOMP + 139 + + + + + ICCARM + 18 9 + + + BICOMP + 18 9 + + + + + $PROJ_DIR$\..\..\examples\src\Model.c + + + ICCARM + 100 + + + BICOMP + 85 + + + + + ICCARM + 8 1 4 6 14 + + + BICOMP + 8 1 4 6 14 + + + + + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + + + ICCARM + 95 + + + BICOMP + 129 + + + + + ICCARM + 1 4 10 28 30 141 3 32 27 67 143 + + + BICOMP + 1 4 10 28 30 141 3 27 67 143 + + + + + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + + + ICCARM + 134 + + + BICOMP + 108 + + + + + ICCARM + 1 4 6 + + + BICOMP + 1 4 6 + + + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + + + ICCARM + 137 + + + BICOMP + 123 + + + + + ICCARM + 1 4 22 21 + + + BICOMP + 1 4 22 21 + + + + + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + + + ICCARM + 119 + + + BICOMP + 93 + + + + + ICCARM + 1 4 14 28 30 141 3 32 27 67 143 + + + BICOMP + 1 4 14 28 30 141 3 27 67 143 + + + + + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + + + ICCARM + 96 + + + BICOMP + 106 + + + + + ICCARM + 1 4 2 174 + + + BICOMP + 1 4 2 174 + + + + + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + + + ICCARM + 88 + + + BICOMP + 136 + + + + + ICCARM + 1 4 5 173 13 + + + BICOMP + 1 4 5 173 13 + + + + + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + + + ICCARM + 89 + + + BICOMP + 102 + + + + + ICCARM + 1 4 13 2 11 + + + BICOMP + 1 4 13 2 11 + + + + + $PROJ_DIR$\srcIAR\Cstartup.s79 + + + AARM + 121 + + + + + AARM + 142 + + + + + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + + + ICCARM + 128 + + + BICOMP + 86 + + + + + ICCARM + 4 + + + BICOMP + 4 + + + + + $PROJ_DIR$\..\test\system\src\Main.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\Model.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\AdcHardwareConfigurator.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\TimerModel.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\UsartModel.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\UsartHardware.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\UsartTransmitBufferStatus.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\UsartPutChar.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\TimerInterruptConfigurator.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\UsartBaudRateRegisterCalculator.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\TaskScheduler.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\AdcModel.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\AdcTemperatureSensor.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\AdcConductor.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\AdcHardware.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\Executor.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\TemperatureCalculator.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\TemperatureFilter.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\TimerConductor.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\TimerConfigurator.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\TimerHardware.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\TimerInterruptHandler.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\UsartConductor.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\UsartConfigurator.c + ICCARM + + + + Simulate + + $PROJ_DIR$\..\test\system\src\TemperatureCalculator.h + $PROJ_DIR$\..\..\examples\src\Types.h + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.h + $TOOLKIT_DIR$\inc\DLib_Defaults.h + $PROJ_DIR$\..\..\examples\src\AT91SAM7X256.h + $PROJ_DIR$\..\..\examples\src\AdcConductor.h + $PROJ_DIR$\..\..\examples\src\TaskScheduler.h + $PROJ_DIR$\..\..\examples\src\UsartConductor.h + $PROJ_DIR$\..\..\examples\src\Model.h + $TOOLKIT_DIR$\inc\intrinsics.h + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.h + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.h + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.h + $PROJ_DIR$\..\..\examples\src\AdcHardware.h + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.h + $PROJ_DIR$\..\..\examples\src\TimerConductor.h + $PROJ_DIR$\..\..\examples\src\UsartPutChar.h + $PROJ_DIR$\..\..\examples\src\UsartModel.h + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.h + $PROJ_DIR$\..\..\examples\src\UsartHardware.h + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.h + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.h + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.h + $PROJ_DIR$\..\..\examples\src\TimerModel.h + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.h + $PROJ_DIR$\..\..\examples\src\TimerHardware.h + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.h + $TOOLKIT_DIR$\inc\DLib_Product.h + $TOOLKIT_DIR$\inc\math.h + $TOOLKIT_DIR$\inc\stdio.h + $TOOLKIT_DIR$\inc\ymath.h + $TOOLKIT_DIR$\inc\ysizet.h + $TOOLKIT_DIR$\lib\dl4tptinl8n.h + $PROJ_DIR$\..\test\system\src\UsartPutChar.h + $PROJ_DIR$\..\test\system\src\AdcTemperatureSensor.h + $PROJ_DIR$\Simulate\Obj\cmock_demo.pbd + $PROJ_DIR$\..\test\system\src\TaskScheduler.h + $PROJ_DIR$\..\test\system\src\UsartTransmitBufferStatus.h + $PROJ_DIR$\..\test\system\src\UsartConfigurator.h + $PROJ_DIR$\..\test\system\src\TimerConfigurator.h + $PROJ_DIR$\..\test\system\src\AT91SAM7X256.h + $PROJ_DIR$\..\test\system\src\UsartBaudRateRegisterCalculator.h + $PROJ_DIR$\..\test\system\src\Executor.h + $PROJ_DIR$\..\test\system\src\ModelConfig.h + $PROJ_DIR$\..\test\system\src\TimerModel.h + $PROJ_DIR$\..\test\system\src\TimerInterruptHandler.h + $PROJ_DIR$\..\test\system\src\Main.c + $PROJ_DIR$\..\test\system\src\Model.c + $PROJ_DIR$\..\test\system\src\AdcHardwareConfigurator.c + $PROJ_DIR$\..\test\system\src\TimerModel.c + $PROJ_DIR$\..\test\system\src\UsartModel.c + $PROJ_DIR$\..\test\system\src\UsartHardware.c + $PROJ_DIR$\..\test\system\src\UsartTransmitBufferStatus.c + $PROJ_DIR$\..\test\system\src\UsartPutChar.c + $PROJ_DIR$\..\test\system\src\TimerInterruptConfigurator.c + $PROJ_DIR$\..\test\system\src\UsartBaudRateRegisterCalculator.c + $PROJ_DIR$\..\test\system\src\TaskScheduler.c + $PROJ_DIR$\..\test\system\src\AdcConductor.h + $PROJ_DIR$\..\test\system\src\TimerInterruptConfigurator.h + $PROJ_DIR$\..\test\system\src\Model.h + $PROJ_DIR$\..\test\system\src\TemperatureFilter.h + $PROJ_DIR$\..\test\system\src\AdcModel.c + $PROJ_DIR$\..\test\system\src\TimerHardware.h + $PROJ_DIR$\..\test\system\src\AdcTemperatureSensor.c + $PROJ_DIR$\..\test\system\src\AdcConductor.c + $PROJ_DIR$\..\test\system\src\AdcHardware.c + $PROJ_DIR$\..\test\system\src\AdcHardware.h + $PROJ_DIR$\..\test\system\src\Executor.c + $TOOLKIT_DIR$\inc\xencoding_limits.h + $TOOLKIT_DIR$\lib\dl4tptinl8n.r79 + $PROJ_DIR$\..\test\system\src\TemperatureCalculator.c + $PROJ_DIR$\..\test\system\src\Types.h + $PROJ_DIR$\..\test\system\src\TemperatureFilter.c + $PROJ_DIR$\..\test\system\src\TimerConductor.c + $PROJ_DIR$\..\test\system\src\TimerConfigurator.c + $PROJ_DIR$\..\test\system\src\TimerHardware.c + $PROJ_DIR$\..\test\system\src\TimerInterruptHandler.c + $PROJ_DIR$\..\test\system\src\UsartConductor.c + $PROJ_DIR$\..\test\system\src\UsartConfigurator.c + $PROJ_DIR$\..\test\system\src\UsartHardware.h + $PROJ_DIR$\..\test\system\src\TimerConductor.h + $PROJ_DIR$\..\test\system\src\AdcModel.h + $PROJ_DIR$\..\test\system\src\AdcHardwareConfigurator.h + $PROJ_DIR$\..\test\system\src\UsartConductor.h + $PROJ_DIR$\..\test\system\src\UsartModel.h + $PROJ_DIR$\Simulate\Obj\AdcConductor.r79 + $PROJ_DIR$\Simulate\Obj\Cstartup_SAM7.pbi + $PROJ_DIR$\Simulate\Obj\UsartHardware.r79 + $TOOLKIT_DIR$\inc\yvals.h + $PROJ_DIR$\incIAR\AT91SAM7X256_inc.h + $PROJ_DIR$\Simulate\List\TimerModel.lst + $PROJ_DIR$\Simulate\Obj\Executor.r79 + $PROJ_DIR$\Simulate\Obj\TimerHardware.pbi + $PROJ_DIR$\Simulate\Obj\UsartModel.pbi + $PROJ_DIR$\Simulate\Obj\IntrinsicsWrapper.r79 + $PROJ_DIR$\Simulate\Obj\TimerConductor.pbi + $PROJ_DIR$\Simulate\List\UsartConductor.lst + $PROJ_DIR$\Simulate\Obj\Main.pbi + $TOOLKIT_DIR$\inc\DLib_Threads.h + $PROJ_DIR$\Simulate\Obj\AdcHardwareConfigurator.pbi + $PROJ_DIR$\Simulate\Obj\TimerConfigurator.pbi + $PROJ_DIR$\Simulate\Exe\cmock_demo.sim + $PROJ_DIR$\Simulate\Obj\UsartTransmitBufferStatus.pbi + $PROJ_DIR$\Simulate\Obj\AdcHardware.r79 + $PROJ_DIR$\Simulate\Obj\Main.r79 + $PROJ_DIR$\Simulate\Obj\AdcTemperatureSensor.pbi + $PROJ_DIR$\Simulate\Obj\UsartPutChar.r79 + $PROJ_DIR$\Simulate\Obj\AdcHardwareConfigurator.r79 + $PROJ_DIR$\Simulate\Obj\UsartConductor.r79 + $PROJ_DIR$\Simulate\Obj\TimerHardware.r79 + $PROJ_DIR$\Simulate\Obj\TemperatureFilter.r79 + $PROJ_DIR$\Simulate\Obj\TemperatureCalculator.pbi + $PROJ_DIR$\Simulate\Obj\TimerInterruptConfigurator.r79 + $PROJ_DIR$\Simulate\Obj\UsartTransmitBufferStatus.r79 + $PROJ_DIR$\Simulate\Obj\TimerConductor.r79 + $PROJ_DIR$\Simulate\Obj\Executor.pbi + $PROJ_DIR$\Simulate\Obj\UsartConductor.pbi + $PROJ_DIR$\Simulate\Obj\TimerModel.pbi + $PROJ_DIR$\Simulate\Obj\AdcModel.pbi + $PROJ_DIR$\Simulate\List\TaskScheduler.lst + $PROJ_DIR$\Simulate\Obj\TimerModel.r79 + $PROJ_DIR$\Simulate\Obj\TemperatureFilter.pbi + $PROJ_DIR$\Simulate\Obj\UsartBaudRateRegisterCalculator.pbi + $PROJ_DIR$\Simulate\Obj\UsartHardware.pbi + $PROJ_DIR$\Simulate\Obj\TaskScheduler.pbi + $PROJ_DIR$\Simulate\Obj\AdcConductor.pbi + $PROJ_DIR$\Simulate\Obj\TimerConfigurator.r79 + $PROJ_DIR$\Simulate\Obj\Cstartup.r79 + $PROJ_DIR$\Simulate\Obj\TimerInterruptHandler.pbi + $PROJ_DIR$\Simulate\Obj\AdcModel.r79 + $PROJ_DIR$\Simulate\Obj\IntrinsicsWrapper.pbi + $PROJ_DIR$\Simulate\List\cmock_demo.map + $PROJ_DIR$\Simulate\Obj\TimerInterruptConfigurator.pbi + $PROJ_DIR$\Simulate\Exe\cmock_demo.d79 + $PROJ_DIR$\Simulate\Obj\TaskScheduler.r79 + $PROJ_DIR$\Simulate\Obj\Model.r79 + $PROJ_DIR$\Simulate\Obj\UsartConfigurator.pbi + $PROJ_DIR$\Simulate\Obj\UsartModel.r79 + $PROJ_DIR$\Simulate\Obj\Cstartup_SAM7.r79 + $PROJ_DIR$\Simulate\Obj\TemperatureCalculator.r79 + $PROJ_DIR$\Simulate\Obj\UsartPutChar.pbi + $PROJ_DIR$\Simulate\Obj\UsartConfigurator.r79 + $PROJ_DIR$\Simulate\Obj\AdcHardware.pbi + $PROJ_DIR$\Simulate\Obj\AdcTemperatureSensor.r79 + $PROJ_DIR$\Simulate\Obj\Model.pbi + $PROJ_DIR$\Simulate\Obj\UsartBaudRateRegisterCalculator.r79 + $PROJ_DIR$\Simulate\List\UsartBaudRateRegisterCalculator.lst + $PROJ_DIR$\Simulate\List\UsartTransmitBufferStatus.lst + $PROJ_DIR$\Simulate\List\AdcHardware.lst + $PROJ_DIR$\Simulate\List\TimerInterruptConfigurator.lst + $PROJ_DIR$\Simulate\List\Model.lst + $PROJ_DIR$\Simulate\Obj\TimerInterruptHandler.r79 + $PROJ_DIR$\Simulate\List\UsartPutChar.lst + $PROJ_DIR$\Simulate\List\UsartHardware.lst + $PROJ_DIR$\Simulate\List\Executor.lst + $PROJ_DIR$\Simulate\List\TimerConfigurator.lst + $PROJ_DIR$\Simulate\List\AdcTemperatureSensor.lst + $PROJ_DIR$\Simulate\List\Cstartup_SAM7.lst + $PROJ_DIR$\Simulate\List\AdcHardwareConfigurator.lst + $PROJ_DIR$\Simulate\List\AdcModel.lst + $PROJ_DIR$\Simulate\List\TemperatureFilter.lst + $PROJ_DIR$\Simulate\List\AdcConductor.lst + $PROJ_DIR$\Simulate\List\UsartConfigurator.lst + $PROJ_DIR$\Simulate\List\IntrinsicsWrapper.lst + $PROJ_DIR$\Simulate\List\TimerHardware.lst + $PROJ_DIR$\Simulate\List\TemperatureCalculator.lst + $PROJ_DIR$\Simulate\List\TimerInterruptHandler.lst + $PROJ_DIR$\Simulate\List\UsartModel.lst + $PROJ_DIR$\Simulate\List\Main.lst + $PROJ_DIR$\Simulate\List\TimerConductor.lst + $PROJ_DIR$\Resource\at91SAM7X256_FLASH.xcl + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + $PROJ_DIR$\..\..\examples\src\TimerModel.c + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + $PROJ_DIR$\..\..\examples\src\UsartModel.c + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + $PROJ_DIR$\Cstartup.s79 + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + $PROJ_DIR$\Cstartup_SAM7.c + $PROJ_DIR$\..\..\examples\src\AdcModel.c + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + $PROJ_DIR$\..\..\examples\src\Executor.c + $PROJ_DIR$\..\..\examples\src\Main.c + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + $PROJ_DIR$\..\..\examples\src\Model.c + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + $PROJ_DIR$\..\..\examples\src\Executor.h + $PROJ_DIR$\..\..\examples\src\AdcModel.h + $PROJ_DIR$\..\..\examples\src\ModelConfig.h + $PROJ_DIR$\srcIAR\Cstartup.s79 + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + + + [ROOT_NODE] + + + XLINK + 133 131 101 + + + + + $PROJ_DIR$\Simulate\Obj\cmock_demo.pbd + + + BILINK + 125 142 99 118 105 86 115 130 97 144 124 111 121 95 100 92 132 128 117 122 116 136 123 93 140 102 + + + + + $PROJ_DIR$\..\test\system\src\Main.c + + + ICCARM + 104 + + + BICOMP + 97 + + + + + ICCARM + 71 40 42 59 36 0 60 83 79 38 33 84 41 37 80 62 39 58 45 44 57 66 82 34 81 + + + BICOMP + 71 40 42 59 36 0 60 83 79 38 33 84 41 37 80 62 39 58 45 44 57 66 82 34 81 + + + + + $PROJ_DIR$\..\test\system\src\Model.c + + + ICCARM + 135 + + + BICOMP + 144 + + + + + ICCARM + 59 71 40 36 60 + + + BICOMP + 59 71 40 36 60 + + + + + $PROJ_DIR$\..\test\system\src\AdcHardwareConfigurator.c + + + ICCARM + 107 + + + BICOMP + 99 + + + + + ICCARM + 71 40 82 43 + + + BICOMP + 71 40 82 43 + + + + + $PROJ_DIR$\..\test\system\src\TimerModel.c + + + ICCARM + 120 + + + BICOMP + 117 + + + + + ICCARM + 71 40 44 36 + + + BICOMP + 71 40 44 36 + + + + + $PROJ_DIR$\..\test\system\src\UsartModel.c + + + ICCARM + 137 + + + BICOMP + 93 + + + + + ICCARM + 71 40 84 43 41 60 29 88 3 32 27 68 98 31 28 30 + + + BICOMP + 71 40 84 43 41 60 29 88 3 27 68 98 31 28 30 + + + + + $PROJ_DIR$\..\test\system\src\UsartHardware.c + + + ICCARM + 87 + + + BICOMP + 123 + + + + + ICCARM + 71 40 79 38 33 + + + BICOMP + 71 40 79 38 33 + + + + + $PROJ_DIR$\..\test\system\src\UsartTransmitBufferStatus.c + + + ICCARM + 113 + + + BICOMP + 102 + + + + + ICCARM + 71 40 37 + + + BICOMP + 71 40 37 + + + + + $PROJ_DIR$\..\test\system\src\UsartPutChar.c + + + ICCARM + 106 + + + BICOMP + 140 + + + + + ICCARM + 71 40 33 37 29 88 3 32 27 68 98 31 + + + BICOMP + 71 40 33 37 29 88 3 27 68 98 31 + + + + + $PROJ_DIR$\..\test\system\src\TimerInterruptConfigurator.c + + + ICCARM + 112 + + + BICOMP + 132 + + + + + ICCARM + 71 40 58 45 + + + BICOMP + 71 40 58 45 + + + + + $PROJ_DIR$\..\test\system\src\UsartBaudRateRegisterCalculator.c + + + ICCARM + 145 + + + BICOMP + 122 + + + + + ICCARM + 71 40 41 + + + BICOMP + 71 40 41 + + + + + $PROJ_DIR$\..\test\system\src\TaskScheduler.c + + + ICCARM + 134 + + + BICOMP + 124 + + + + + ICCARM + 71 40 36 + + + BICOMP + 71 40 36 + + + + + $PROJ_DIR$\..\test\system\src\AdcModel.c + + + ICCARM + 129 + + + BICOMP + 118 + + + + + ICCARM + 71 40 81 36 0 60 + + + BICOMP + 71 40 81 36 0 60 + + + + + $PROJ_DIR$\..\test\system\src\AdcTemperatureSensor.c + + + ICCARM + 143 + + + BICOMP + 105 + + + + + ICCARM + 71 40 34 + + + BICOMP + 71 40 34 + + + + + $PROJ_DIR$\..\test\system\src\AdcConductor.c + + + ICCARM + 85 + + + BICOMP + 125 + + + + + ICCARM + 71 40 57 81 66 + + + BICOMP + 71 40 57 81 66 + + + + + $PROJ_DIR$\..\test\system\src\AdcHardware.c + + + ICCARM + 103 + + + BICOMP + 142 + + + + + ICCARM + 71 40 66 82 34 + + + BICOMP + 71 40 66 82 34 + + + + + $PROJ_DIR$\..\test\system\src\Executor.c + + + ICCARM + 91 + + + BICOMP + 115 + + + + + ICCARM + 71 40 42 59 83 80 57 + + + BICOMP + 71 40 42 59 83 80 57 + + + + + $PROJ_DIR$\..\test\system\src\TemperatureCalculator.c + + + ICCARM + 139 + + + BICOMP + 111 + + + + + ICCARM + 71 40 0 28 30 88 3 32 27 68 98 + + + BICOMP + 71 40 0 28 30 88 3 27 68 98 + + + + + $PROJ_DIR$\..\test\system\src\TemperatureFilter.c + + + ICCARM + 110 + + + BICOMP + 121 + + + + + ICCARM + 71 40 60 28 30 88 3 32 27 68 98 + + + BICOMP + 71 40 60 28 30 88 3 27 68 98 + + + + + $PROJ_DIR$\..\test\system\src\TimerConductor.c + + + ICCARM + 114 + + + BICOMP + 95 + + + + + ICCARM + 71 40 80 44 62 45 + + + BICOMP + 71 40 80 44 62 45 + + + + + $PROJ_DIR$\..\test\system\src\TimerConfigurator.c + + + ICCARM + 126 + + + BICOMP + 100 + + + + + ICCARM + 71 40 39 58 + + + BICOMP + 71 40 39 58 + + + + + $PROJ_DIR$\..\test\system\src\TimerHardware.c + + + ICCARM + 109 + + + BICOMP + 92 + + + + + ICCARM + 71 40 62 39 + + + BICOMP + 71 40 62 39 + + + + + $PROJ_DIR$\..\test\system\src\TimerInterruptHandler.c + + + ICCARM + 151 + + + BICOMP + 128 + + + + + ICCARM + 71 40 45 58 + + + BICOMP + 71 40 45 58 + + + + + $PROJ_DIR$\..\test\system\src\UsartConductor.c + + + ICCARM + 108 + + + BICOMP + 116 + + + + + ICCARM + 71 40 83 79 84 36 + + + BICOMP + 71 40 83 79 84 36 + + + + + $PROJ_DIR$\..\test\system\src\UsartConfigurator.c + + + ICCARM + 141 + + + BICOMP + 136 + + + + + ICCARM + 71 40 38 + + + BICOMP + 71 40 38 + + + + + $PROJ_DIR$\Simulate\Exe\cmock_demo.d79 + + + XLINK + 131 101 + + + + + XLINK + 170 85 103 107 129 143 127 138 91 94 104 135 134 139 110 114 126 109 112 151 120 145 108 141 87 137 106 113 69 + + + + + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + + + ICCARM + 114 169 + + + BICOMP + 95 + + + + + ICCARM + 1 4 15 23 25 22 + + + BICOMP + 1 4 15 23 25 22 + + + + + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + + + ICCARM + 126 155 + + + BICOMP + 100 + + + + + ICCARM + 1 4 24 21 + + + BICOMP + 1 4 24 21 + + + + + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + + + ICCARM + 109 164 + + + BICOMP + 92 + + + + + ICCARM + 1 4 25 24 + + + BICOMP + 1 4 25 24 + + + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + + + ICCARM + 112 149 + + + BICOMP + 132 + + + + + ICCARM + 1 4 21 22 + + + BICOMP + 1 4 21 22 + + + + + $PROJ_DIR$\..\..\examples\src\TimerModel.c + + + ICCARM + 120 90 + + + BICOMP + 117 + + + + + ICCARM + 1 4 23 6 + + + BICOMP + 1 4 23 6 + + + + + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + + + ICCARM + 145 146 + + + BICOMP + 122 + + + + + ICCARM + 1 4 26 + + + BICOMP + 1 4 26 + + + + + $PROJ_DIR$\..\..\examples\src\UsartModel.c + + + ICCARM + 137 167 + + + BICOMP + 93 + + + + + ICCARM + 1 4 17 200 26 14 29 88 3 32 27 68 98 31 28 30 + + + BICOMP + 1 4 17 200 26 14 29 88 3 27 68 98 31 28 30 + + + + + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + + + ICCARM + 108 96 + + + BICOMP + 116 + + + + + ICCARM + 1 4 7 19 17 6 + + + BICOMP + 1 4 7 19 17 6 + + + + + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + + + ICCARM + 141 162 + + + BICOMP + 136 + + + + + ICCARM + 1 4 12 + + + BICOMP + 1 4 12 + + + + + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + + + ICCARM + 87 153 + + + BICOMP + 123 + + + + + ICCARM + 1 4 19 12 16 + + + BICOMP + 1 4 19 12 16 + + + + + $PROJ_DIR$\Cstartup.s79 + + + AARM + 127 + + + + + AARM + 89 + + + + + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + + + ICCARM + 106 152 + + + BICOMP + 140 + + + + + ICCARM + 1 4 16 20 29 88 3 32 27 68 98 31 + + + BICOMP + 1 4 16 20 29 88 3 27 68 98 31 + + + + + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + + + ICCARM + 113 147 + + + BICOMP + 102 + + + + + ICCARM + 1 4 20 + + + BICOMP + 1 4 20 + + + + + $PROJ_DIR$\Cstartup_SAM7.c + + + ICCARM + 138 157 + + + BICOMP + 86 + + + + + ICCARM + 4 + + + BICOMP + 4 + + + + + $PROJ_DIR$\..\..\examples\src\AdcModel.c + + + ICCARM + 129 159 + + + BICOMP + 118 + + + + + ICCARM + 1 4 199 6 10 14 + + + BICOMP + 1 4 199 6 10 14 + + + + + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + + + ICCARM + 143 156 + + + BICOMP + 105 + + + + + ICCARM + 1 4 11 + + + BICOMP + 1 4 11 + + + + + $PROJ_DIR$\..\..\examples\src\Executor.c + + + ICCARM + 91 154 + + + BICOMP + 115 + + + + + ICCARM + 1 4 198 8 7 15 5 18 + + + BICOMP + 1 4 198 8 7 15 5 18 + + + + + $PROJ_DIR$\..\..\examples\src\Main.c + + + ICCARM + 104 168 + + + BICOMP + 97 + + + + + ICCARM + 1 4 18 198 8 6 10 14 7 19 12 16 17 26 20 15 25 24 21 22 23 5 13 2 11 199 + + + BICOMP + 1 4 18 198 8 6 10 14 7 19 12 16 17 26 20 15 25 24 21 22 23 5 13 2 11 199 + + + + + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + + + ICCARM + 94 163 + + + BICOMP + 130 + + + + + ICCARM + 18 9 + + + BICOMP + 18 9 + + + + + $PROJ_DIR$\..\..\examples\src\Model.c + + + ICCARM + 135 150 + + + BICOMP + 144 + + + + + ICCARM + 8 1 4 6 14 + + + BICOMP + 8 1 4 6 14 + + + + + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + + + ICCARM + 139 165 + + + BICOMP + 111 + + + + + ICCARM + 1 4 10 28 30 88 3 32 27 68 98 + + + BICOMP + 1 4 10 28 30 88 3 27 68 98 + + + + + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + + + ICCARM + 134 119 + + + BICOMP + 124 + + + + + ICCARM + 1 4 6 + + + BICOMP + 1 4 6 + + + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + + + ICCARM + 151 166 + + + BICOMP + 128 + + + + + ICCARM + 1 4 22 21 + + + BICOMP + 1 4 22 21 + + + + + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + + + ICCARM + 110 160 + + + BICOMP + 121 + + + + + ICCARM + 1 4 14 28 30 88 3 32 27 68 98 + + + BICOMP + 1 4 14 28 30 88 3 27 68 98 + + + + + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + + + ICCARM + 107 158 + + + BICOMP + 99 + + + + + ICCARM + 1 4 2 200 + + + BICOMP + 1 4 2 200 + + + + + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + + + ICCARM + 85 161 + + + BICOMP + 125 + + + + + ICCARM + 1 4 5 199 13 + + + BICOMP + 1 4 5 199 13 + + + + + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + + + ICCARM + 103 148 + + + BICOMP + 142 + + + + + ICCARM + 1 4 13 2 11 + + + BICOMP + 1 4 13 2 11 + + + + + $PROJ_DIR$\srcIAR\Cstartup.s79 + + + AARM + 127 + + + + + AARM + 89 + + + + + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + + + ICCARM + 138 157 + + + BICOMP + 86 + + + + + ICCARM + 4 + + + BICOMP + 4 + + + + + + + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/cmock_demo.ewd b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/cmock_demo.ewd new file mode 100644 index 0000000..37a724d --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/cmock_demo.ewd @@ -0,0 +1,1696 @@ + + + + 1 + + Debug + + ARM + + 1 + + C-SPY + 2 + + 13 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 0 + 1 + 1 + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + JLINK_ID + 2 + + 6 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + MACRAIGOR_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ewplugin + 1 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CMXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CMXTinyArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + + + Simulate + + ARM + + 1 + + C-SPY + 2 + + 13 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 0 + 1 + 1 + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + JLINK_ID + 2 + + 6 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + MACRAIGOR_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ewplugin + 1 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CMXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CMXTinyArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + + + Release + + ARM + + 0 + + C-SPY + 2 + + 13 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 0 + 1 + 0 + + + + + ANGEL_ID + 2 + + 0 + 1 + 0 + + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 0 + + + + + + + + + + JLINK_ID + 2 + + 6 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 0 + 1 + 0 + + + + + + + + + + + + MACRAIGOR_ID + 2 + + 2 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 0 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 0 + + + + + + + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ewplugin + 1 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CMXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CMXTinyArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + + + + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/cmock_demo.ewp b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/cmock_demo.ewp new file mode 100644 index 0000000..ec55fbe --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/cmock_demo.ewp @@ -0,0 +1,2581 @@ + + + + 1 + + Debug + + ARM + + 1 + + General + 2 + + 9 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 14 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + XLINK + 2 + + 18 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + XAR + 2 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + Simulate + + ARM + + 1 + + General + 2 + + 9 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 14 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + XLINK + 2 + + 18 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + XAR + 2 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + Release + + ARM + + 0 + + General + 2 + + 9 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 14 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + XLINK + 2 + + 18 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + XAR + 2 + + 0 + 1 + 0 + + + + + + + BILINK + 0 + + + + + Resource + + $PROJ_DIR$\Resource\at91SAM7X256_FLASH.xcl + + + $PROJ_DIR$\Resource\at91SAM7X256_RAM.xcl + + + $PROJ_DIR$\Resource\SAM7_FLASH.mac + + + $PROJ_DIR$\Resource\SAM7_RAM.mac + + + $PROJ_DIR$\Resource\SAM7_SIM.mac + + + + Source + + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + + + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + + + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + + + $PROJ_DIR$\..\..\examples\src\AdcModel.c + + + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + + + $PROJ_DIR$\..\..\examples\src\Executor.c + + + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + + + $PROJ_DIR$\..\..\examples\src\Main.c + + + $PROJ_DIR$\..\..\examples\src\Model.c + + + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + + + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + + + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + + + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + + + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + + + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + + + $PROJ_DIR$\..\..\examples\src\TimerModel.c + + + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + + + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + + + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + + + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + + + $PROJ_DIR$\..\..\examples\src\UsartModel.c + + + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + + + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + + + + Startup + + $PROJ_DIR$\srcIAR\Cstartup.s79 + + + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + + + + + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/cmock_demo.eww b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/cmock_demo.eww new file mode 100644 index 0000000..5f78f6e --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/cmock_demo.eww @@ -0,0 +1,10 @@ + + + + + $WS_DIR$\cmock_demo.ewp + + + + + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X-EK.h b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X-EK.h new file mode 100644 index 0000000..9834675 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X-EK.h @@ -0,0 +1,61 @@ +// ---------------------------------------------------------------------------- +// ATMEL Microcontroller Software Support - ROUSSET - +// ---------------------------------------------------------------------------- +// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// ---------------------------------------------------------------------------- +// File Name : AT91SAM7X-EK.h +// Object : AT91SAM7X-EK Evaluation Board Features Definition File +// +// ---------------------------------------------------------------------------- + +#ifndef AT91SAM7X_EK_H +#define AT91SAM7X_EK_H + +/*-----------------*/ +/* LEDs Definition */ +/*-----------------*/ +#define AT91B_LED1 (1<<19) // AT91C_PIO_PB19 AT91C_PB19_PWM0 AT91C_PB19_TCLK1 +#define AT91B_LED2 (1<<20) // AT91C_PIO_PB20 AT91C_PB20_PWM1 AT91C_PB20_PWM1 +#define AT91B_LED3 (AT91C_PIO_PB21) // AT91C_PIO_PB21 AT91C_PB21_PWM2 AT91C_PB21_PCK1 +#define AT91B_LED4 (AT91C_PIO_PB22) // AT91C_PIO_PB22 AT91C_PB22_PWM3 AT91C_PB22_PCK2 +#define AT91B_NB_LEB 4 +#define AT91B_LED_MASK (AT91B_LED1|AT91B_LED2|AT91B_LED3|AT91B_LED4) +#define AT91D_BASE_PIO_LED (AT91C_BASE_PIOB) + +#define AT91B_POWERLED (1<<25) // PB25 + + +/*-------------------------------*/ +/* JOYSTICK Position Definition */ +/*-------------------------------*/ +#define AT91B_SW1 (1<<21) // PA21 Up Button AT91C_PA21_TF AT91C_PA21_NPCS10 +#define AT91B_SW2 (1<<22) // PA22 Down Button AT91C_PA22_TK AT91C_PA22_SPCK1 +#define AT91B_SW3 (1<<23) // PA23 Left Button AT91C_PA23_TD AT91C_PA23_MOSI1 +#define AT91B_SW4 (1<<24) // PA24 Right Button AT91C_PA24_RD AT91C_PA24_MISO1 +#define AT91B_SW5 (1<<25) // PA25 Push Button AT91C_PA25_RK AT91C_PA25_NPCS11 +#define AT91B_SW_MASK (AT91B_SW1|AT91B_SW2|AT91B_SW3|AT91B_SW4|AT91B_SW5) + + +#define AT91D_BASE_PIO_SW (AT91C_BASE_PIOA) + +/*------------------*/ +/* CAN Definition */ +/*------------------*/ +#define AT91B_CAN_TRANSCEIVER_RS (1<<2) // PA2 + +/*--------------*/ +/* Clocks */ +/*--------------*/ +#define AT91B_MAIN_OSC 18432000 // Main Oscillator MAINCK +#define AT91B_MCK ((18432000*73/14)/2) // Output PLL Clock + +#endif /* AT91SAM7X-EK_H */ diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.inc b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.inc new file mode 100644 index 0000000..da33985 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.inc @@ -0,0 +1,2314 @@ +;- ---------------------------------------------------------------------------- +;- ATMEL Microcontroller Software Support - ROUSSET - +;- ---------------------------------------------------------------------------- +;- DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +;- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +;- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +;- DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +;- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +;- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +;- OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +;- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +;- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +;- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +;- ---------------------------------------------------------------------------- +;- File Name : AT91SAM7X256.h +;- Object : AT91SAM7X256 definitions +;- Generated : AT91 SW Application Group 11/02/2005 (15:17:24) +;- +;- CVS Reference : /AT91SAM7X256.pl/1.14/Tue Sep 13 15:06:52 2005// +;- CVS Reference : /SYS_SAM7X.pl/1.3/Tue Feb 1 17:01:43 2005// +;- CVS Reference : /MC_SAM7X.pl/1.2/Fri May 20 14:13:04 2005// +;- CVS Reference : /PMC_SAM7X.pl/1.4/Tue Feb 8 13:58:10 2005// +;- CVS Reference : /RSTC_SAM7X.pl/1.2/Wed Jul 13 14:57:50 2005// +;- CVS Reference : /UDP_SAM7X.pl/1.1/Tue May 10 11:35:35 2005// +;- CVS Reference : /PWM_SAM7X.pl/1.1/Tue May 10 11:53:07 2005// +;- CVS Reference : /AIC_6075B.pl/1.3/Fri May 20 14:01:30 2005// +;- CVS Reference : /PIO_6057A.pl/1.2/Thu Feb 3 10:18:28 2005// +;- CVS Reference : /RTTC_6081A.pl/1.2/Tue Nov 9 14:43:58 2004// +;- CVS Reference : /PITC_6079A.pl/1.2/Tue Nov 9 14:43:56 2004// +;- CVS Reference : /WDTC_6080A.pl/1.3/Tue Nov 9 14:44:00 2004// +;- CVS Reference : /VREG_6085B.pl/1.1/Tue Feb 1 16:05:48 2005// +;- CVS Reference : /PDC_6074C.pl/1.2/Thu Feb 3 08:48:54 2005// +;- CVS Reference : /DBGU_6059D.pl/1.1/Mon Jan 31 13:15:32 2005// +;- CVS Reference : /SPI_6088D.pl/1.3/Fri May 20 14:08:59 2005// +;- CVS Reference : /US_6089C.pl/1.1/Mon Jul 12 18:23:26 2004// +;- CVS Reference : /SSC_6078B.pl/1.1/Wed Jul 13 15:19:19 2005// +;- CVS Reference : /TWI_6061A.pl/1.1/Tue Jul 13 07:38:06 2004// +;- CVS Reference : /TC_6082A.pl/1.7/Fri Mar 11 12:52:17 2005// +;- CVS Reference : /CAN_6019B.pl/1.1/Tue Mar 8 12:42:22 2005// +;- CVS Reference : /EMACB_6119A.pl/1.6/Wed Jul 13 15:05:35 2005// +;- CVS Reference : /ADC_6051C.pl/1.1/Fri Oct 17 09:12:38 2003// +;- ---------------------------------------------------------------------------- + +;- Hardware register definition + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR System Peripherals +;- ***************************************************************************** + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Advanced Interrupt Controller +;- ***************************************************************************** + ^ 0 ;- AT91S_AIC +AIC_SMR # 128 ;- Source Mode Register +AIC_SVR # 128 ;- Source Vector Register +AIC_IVR # 4 ;- IRQ Vector Register +AIC_FVR # 4 ;- FIQ Vector Register +AIC_ISR # 4 ;- Interrupt Status Register +AIC_IPR # 4 ;- Interrupt Pending Register +AIC_IMR # 4 ;- Interrupt Mask Register +AIC_CISR # 4 ;- Core Interrupt Status Register + # 8 ;- Reserved +AIC_IECR # 4 ;- Interrupt Enable Command Register +AIC_IDCR # 4 ;- Interrupt Disable Command Register +AIC_ICCR # 4 ;- Interrupt Clear Command Register +AIC_ISCR # 4 ;- Interrupt Set Command Register +AIC_EOICR # 4 ;- End of Interrupt Command Register +AIC_SPU # 4 ;- Spurious Vector Register +AIC_DCR # 4 ;- Debug Control Register (Protect) + # 4 ;- Reserved +AIC_FFER # 4 ;- Fast Forcing Enable Register +AIC_FFDR # 4 ;- Fast Forcing Disable Register +AIC_FFSR # 4 ;- Fast Forcing Status Register +;- -------- AIC_SMR : (AIC Offset: 0x0) Control Register -------- +AT91C_AIC_PRIOR EQU (0x7:SHL:0) ;- (AIC) Priority Level +AT91C_AIC_PRIOR_LOWEST EQU (0x0) ;- (AIC) Lowest priority level +AT91C_AIC_PRIOR_HIGHEST EQU (0x7) ;- (AIC) Highest priority level +AT91C_AIC_SRCTYPE EQU (0x3:SHL:5) ;- (AIC) Interrupt Source Type +AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL EQU (0x0:SHL:5) ;- (AIC) Internal Sources Code Label High-level Sensitive +AT91C_AIC_SRCTYPE_EXT_LOW_LEVEL EQU (0x0:SHL:5) ;- (AIC) External Sources Code Label Low-level Sensitive +AT91C_AIC_SRCTYPE_INT_POSITIVE_EDGE EQU (0x1:SHL:5) ;- (AIC) Internal Sources Code Label Positive Edge triggered +AT91C_AIC_SRCTYPE_EXT_NEGATIVE_EDGE EQU (0x1:SHL:5) ;- (AIC) External Sources Code Label Negative Edge triggered +AT91C_AIC_SRCTYPE_HIGH_LEVEL EQU (0x2:SHL:5) ;- (AIC) Internal Or External Sources Code Label High-level Sensitive +AT91C_AIC_SRCTYPE_POSITIVE_EDGE EQU (0x3:SHL:5) ;- (AIC) Internal Or External Sources Code Label Positive Edge triggered +;- -------- AIC_CISR : (AIC Offset: 0x114) AIC Core Interrupt Status Register -------- +AT91C_AIC_NFIQ EQU (0x1:SHL:0) ;- (AIC) NFIQ Status +AT91C_AIC_NIRQ EQU (0x1:SHL:1) ;- (AIC) NIRQ Status +;- -------- AIC_DCR : (AIC Offset: 0x138) AIC Debug Control Register (Protect) -------- +AT91C_AIC_DCR_PROT EQU (0x1:SHL:0) ;- (AIC) Protection Mode +AT91C_AIC_DCR_GMSK EQU (0x1:SHL:1) ;- (AIC) General Mask + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Peripheral DMA Controller +;- ***************************************************************************** + ^ 0 ;- AT91S_PDC +PDC_RPR # 4 ;- Receive Pointer Register +PDC_RCR # 4 ;- Receive Counter Register +PDC_TPR # 4 ;- Transmit Pointer Register +PDC_TCR # 4 ;- Transmit Counter Register +PDC_RNPR # 4 ;- Receive Next Pointer Register +PDC_RNCR # 4 ;- Receive Next Counter Register +PDC_TNPR # 4 ;- Transmit Next Pointer Register +PDC_TNCR # 4 ;- Transmit Next Counter Register +PDC_PTCR # 4 ;- PDC Transfer Control Register +PDC_PTSR # 4 ;- PDC Transfer Status Register +;- -------- PDC_PTCR : (PDC Offset: 0x20) PDC Transfer Control Register -------- +AT91C_PDC_RXTEN EQU (0x1:SHL:0) ;- (PDC) Receiver Transfer Enable +AT91C_PDC_RXTDIS EQU (0x1:SHL:1) ;- (PDC) Receiver Transfer Disable +AT91C_PDC_TXTEN EQU (0x1:SHL:8) ;- (PDC) Transmitter Transfer Enable +AT91C_PDC_TXTDIS EQU (0x1:SHL:9) ;- (PDC) Transmitter Transfer Disable +;- -------- PDC_PTSR : (PDC Offset: 0x24) PDC Transfer Status Register -------- + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Debug Unit +;- ***************************************************************************** + ^ 0 ;- AT91S_DBGU +DBGU_CR # 4 ;- Control Register +DBGU_MR # 4 ;- Mode Register +DBGU_IER # 4 ;- Interrupt Enable Register +DBGU_IDR # 4 ;- Interrupt Disable Register +DBGU_IMR # 4 ;- Interrupt Mask Register +DBGU_CSR # 4 ;- Channel Status Register +DBGU_RHR # 4 ;- Receiver Holding Register +DBGU_THR # 4 ;- Transmitter Holding Register +DBGU_BRGR # 4 ;- Baud Rate Generator Register + # 28 ;- Reserved +DBGU_CIDR # 4 ;- Chip ID Register +DBGU_EXID # 4 ;- Chip ID Extension Register +DBGU_FNTR # 4 ;- Force NTRST Register + # 180 ;- Reserved +DBGU_RPR # 4 ;- Receive Pointer Register +DBGU_RCR # 4 ;- Receive Counter Register +DBGU_TPR # 4 ;- Transmit Pointer Register +DBGU_TCR # 4 ;- Transmit Counter Register +DBGU_RNPR # 4 ;- Receive Next Pointer Register +DBGU_RNCR # 4 ;- Receive Next Counter Register +DBGU_TNPR # 4 ;- Transmit Next Pointer Register +DBGU_TNCR # 4 ;- Transmit Next Counter Register +DBGU_PTCR # 4 ;- PDC Transfer Control Register +DBGU_PTSR # 4 ;- PDC Transfer Status Register +;- -------- DBGU_CR : (DBGU Offset: 0x0) Debug Unit Control Register -------- +AT91C_US_RSTRX EQU (0x1:SHL:2) ;- (DBGU) Reset Receiver +AT91C_US_RSTTX EQU (0x1:SHL:3) ;- (DBGU) Reset Transmitter +AT91C_US_RXEN EQU (0x1:SHL:4) ;- (DBGU) Receiver Enable +AT91C_US_RXDIS EQU (0x1:SHL:5) ;- (DBGU) Receiver Disable +AT91C_US_TXEN EQU (0x1:SHL:6) ;- (DBGU) Transmitter Enable +AT91C_US_TXDIS EQU (0x1:SHL:7) ;- (DBGU) Transmitter Disable +AT91C_US_RSTSTA EQU (0x1:SHL:8) ;- (DBGU) Reset Status Bits +;- -------- DBGU_MR : (DBGU Offset: 0x4) Debug Unit Mode Register -------- +AT91C_US_PAR EQU (0x7:SHL:9) ;- (DBGU) Parity type +AT91C_US_PAR_EVEN EQU (0x0:SHL:9) ;- (DBGU) Even Parity +AT91C_US_PAR_ODD EQU (0x1:SHL:9) ;- (DBGU) Odd Parity +AT91C_US_PAR_SPACE EQU (0x2:SHL:9) ;- (DBGU) Parity forced to 0 (Space) +AT91C_US_PAR_MARK EQU (0x3:SHL:9) ;- (DBGU) Parity forced to 1 (Mark) +AT91C_US_PAR_NONE EQU (0x4:SHL:9) ;- (DBGU) No Parity +AT91C_US_PAR_MULTI_DROP EQU (0x6:SHL:9) ;- (DBGU) Multi-drop mode +AT91C_US_CHMODE EQU (0x3:SHL:14) ;- (DBGU) Channel Mode +AT91C_US_CHMODE_NORMAL EQU (0x0:SHL:14) ;- (DBGU) Normal Mode: The USART channel operates as an RX/TX USART. +AT91C_US_CHMODE_AUTO EQU (0x1:SHL:14) ;- (DBGU) Automatic Echo: Receiver Data Input is connected to the TXD pin. +AT91C_US_CHMODE_LOCAL EQU (0x2:SHL:14) ;- (DBGU) Local Loopback: Transmitter Output Signal is connected to Receiver Input Signal. +AT91C_US_CHMODE_REMOTE EQU (0x3:SHL:14) ;- (DBGU) Remote Loopback: RXD pin is internally connected to TXD pin. +;- -------- DBGU_IER : (DBGU Offset: 0x8) Debug Unit Interrupt Enable Register -------- +AT91C_US_RXRDY EQU (0x1:SHL:0) ;- (DBGU) RXRDY Interrupt +AT91C_US_TXRDY EQU (0x1:SHL:1) ;- (DBGU) TXRDY Interrupt +AT91C_US_ENDRX EQU (0x1:SHL:3) ;- (DBGU) End of Receive Transfer Interrupt +AT91C_US_ENDTX EQU (0x1:SHL:4) ;- (DBGU) End of Transmit Interrupt +AT91C_US_OVRE EQU (0x1:SHL:5) ;- (DBGU) Overrun Interrupt +AT91C_US_FRAME EQU (0x1:SHL:6) ;- (DBGU) Framing Error Interrupt +AT91C_US_PARE EQU (0x1:SHL:7) ;- (DBGU) Parity Error Interrupt +AT91C_US_TXEMPTY EQU (0x1:SHL:9) ;- (DBGU) TXEMPTY Interrupt +AT91C_US_TXBUFE EQU (0x1:SHL:11) ;- (DBGU) TXBUFE Interrupt +AT91C_US_RXBUFF EQU (0x1:SHL:12) ;- (DBGU) RXBUFF Interrupt +AT91C_US_COMM_TX EQU (0x1:SHL:30) ;- (DBGU) COMM_TX Interrupt +AT91C_US_COMM_RX EQU (0x1:SHL:31) ;- (DBGU) COMM_RX Interrupt +;- -------- DBGU_IDR : (DBGU Offset: 0xc) Debug Unit Interrupt Disable Register -------- +;- -------- DBGU_IMR : (DBGU Offset: 0x10) Debug Unit Interrupt Mask Register -------- +;- -------- DBGU_CSR : (DBGU Offset: 0x14) Debug Unit Channel Status Register -------- +;- -------- DBGU_FNTR : (DBGU Offset: 0x48) Debug Unit FORCE_NTRST Register -------- +AT91C_US_FORCE_NTRST EQU (0x1:SHL:0) ;- (DBGU) Force NTRST in JTAG + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Parallel Input Output Controler +;- ***************************************************************************** + ^ 0 ;- AT91S_PIO +PIO_PER # 4 ;- PIO Enable Register +PIO_PDR # 4 ;- PIO Disable Register +PIO_PSR # 4 ;- PIO Status Register + # 4 ;- Reserved +PIO_OER # 4 ;- Output Enable Register +PIO_ODR # 4 ;- Output Disable Registerr +PIO_OSR # 4 ;- Output Status Register + # 4 ;- Reserved +PIO_IFER # 4 ;- Input Filter Enable Register +PIO_IFDR # 4 ;- Input Filter Disable Register +PIO_IFSR # 4 ;- Input Filter Status Register + # 4 ;- Reserved +PIO_SODR # 4 ;- Set Output Data Register +PIO_CODR # 4 ;- Clear Output Data Register +PIO_ODSR # 4 ;- Output Data Status Register +PIO_PDSR # 4 ;- Pin Data Status Register +PIO_IER # 4 ;- Interrupt Enable Register +PIO_IDR # 4 ;- Interrupt Disable Register +PIO_IMR # 4 ;- Interrupt Mask Register +PIO_ISR # 4 ;- Interrupt Status Register +PIO_MDER # 4 ;- Multi-driver Enable Register +PIO_MDDR # 4 ;- Multi-driver Disable Register +PIO_MDSR # 4 ;- Multi-driver Status Register + # 4 ;- Reserved +PIO_PPUDR # 4 ;- Pull-up Disable Register +PIO_PPUER # 4 ;- Pull-up Enable Register +PIO_PPUSR # 4 ;- Pull-up Status Register + # 4 ;- Reserved +PIO_ASR # 4 ;- Select A Register +PIO_BSR # 4 ;- Select B Register +PIO_ABSR # 4 ;- AB Select Status Register + # 36 ;- Reserved +PIO_OWER # 4 ;- Output Write Enable Register +PIO_OWDR # 4 ;- Output Write Disable Register +PIO_OWSR # 4 ;- Output Write Status Register + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Clock Generator Controler +;- ***************************************************************************** + ^ 0 ;- AT91S_CKGR +CKGR_MOR # 4 ;- Main Oscillator Register +CKGR_MCFR # 4 ;- Main Clock Frequency Register + # 4 ;- Reserved +CKGR_PLLR # 4 ;- PLL Register +;- -------- CKGR_MOR : (CKGR Offset: 0x0) Main Oscillator Register -------- +AT91C_CKGR_MOSCEN EQU (0x1:SHL:0) ;- (CKGR) Main Oscillator Enable +AT91C_CKGR_OSCBYPASS EQU (0x1:SHL:1) ;- (CKGR) Main Oscillator Bypass +AT91C_CKGR_OSCOUNT EQU (0xFF:SHL:8) ;- (CKGR) Main Oscillator Start-up Time +;- -------- CKGR_MCFR : (CKGR Offset: 0x4) Main Clock Frequency Register -------- +AT91C_CKGR_MAINF EQU (0xFFFF:SHL:0) ;- (CKGR) Main Clock Frequency +AT91C_CKGR_MAINRDY EQU (0x1:SHL:16) ;- (CKGR) Main Clock Ready +;- -------- CKGR_PLLR : (CKGR Offset: 0xc) PLL B Register -------- +AT91C_CKGR_DIV EQU (0xFF:SHL:0) ;- (CKGR) Divider Selected +AT91C_CKGR_DIV_0 EQU (0x0) ;- (CKGR) Divider output is 0 +AT91C_CKGR_DIV_BYPASS EQU (0x1) ;- (CKGR) Divider is bypassed +AT91C_CKGR_PLLCOUNT EQU (0x3F:SHL:8) ;- (CKGR) PLL Counter +AT91C_CKGR_OUT EQU (0x3:SHL:14) ;- (CKGR) PLL Output Frequency Range +AT91C_CKGR_OUT_0 EQU (0x0:SHL:14) ;- (CKGR) Please refer to the PLL datasheet +AT91C_CKGR_OUT_1 EQU (0x1:SHL:14) ;- (CKGR) Please refer to the PLL datasheet +AT91C_CKGR_OUT_2 EQU (0x2:SHL:14) ;- (CKGR) Please refer to the PLL datasheet +AT91C_CKGR_OUT_3 EQU (0x3:SHL:14) ;- (CKGR) Please refer to the PLL datasheet +AT91C_CKGR_MUL EQU (0x7FF:SHL:16) ;- (CKGR) PLL Multiplier +AT91C_CKGR_USBDIV EQU (0x3:SHL:28) ;- (CKGR) Divider for USB Clocks +AT91C_CKGR_USBDIV_0 EQU (0x0:SHL:28) ;- (CKGR) Divider output is PLL clock output +AT91C_CKGR_USBDIV_1 EQU (0x1:SHL:28) ;- (CKGR) Divider output is PLL clock output divided by 2 +AT91C_CKGR_USBDIV_2 EQU (0x2:SHL:28) ;- (CKGR) Divider output is PLL clock output divided by 4 + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Power Management Controler +;- ***************************************************************************** + ^ 0 ;- AT91S_PMC +PMC_SCER # 4 ;- System Clock Enable Register +PMC_SCDR # 4 ;- System Clock Disable Register +PMC_SCSR # 4 ;- System Clock Status Register + # 4 ;- Reserved +PMC_PCER # 4 ;- Peripheral Clock Enable Register +PMC_PCDR # 4 ;- Peripheral Clock Disable Register +PMC_PCSR # 4 ;- Peripheral Clock Status Register + # 4 ;- Reserved +PMC_MOR # 4 ;- Main Oscillator Register +PMC_MCFR # 4 ;- Main Clock Frequency Register + # 4 ;- Reserved +PMC_PLLR # 4 ;- PLL Register +PMC_MCKR # 4 ;- Master Clock Register + # 12 ;- Reserved +PMC_PCKR # 16 ;- Programmable Clock Register + # 16 ;- Reserved +PMC_IER # 4 ;- Interrupt Enable Register +PMC_IDR # 4 ;- Interrupt Disable Register +PMC_SR # 4 ;- Status Register +PMC_IMR # 4 ;- Interrupt Mask Register +;- -------- PMC_SCER : (PMC Offset: 0x0) System Clock Enable Register -------- +AT91C_PMC_PCK EQU (0x1:SHL:0) ;- (PMC) Processor Clock +AT91C_PMC_UDP EQU (0x1:SHL:7) ;- (PMC) USB Device Port Clock +AT91C_PMC_PCK0 EQU (0x1:SHL:8) ;- (PMC) Programmable Clock Output +AT91C_PMC_PCK1 EQU (0x1:SHL:9) ;- (PMC) Programmable Clock Output +AT91C_PMC_PCK2 EQU (0x1:SHL:10) ;- (PMC) Programmable Clock Output +AT91C_PMC_PCK3 EQU (0x1:SHL:11) ;- (PMC) Programmable Clock Output +;- -------- PMC_SCDR : (PMC Offset: 0x4) System Clock Disable Register -------- +;- -------- PMC_SCSR : (PMC Offset: 0x8) System Clock Status Register -------- +;- -------- CKGR_MOR : (PMC Offset: 0x20) Main Oscillator Register -------- +;- -------- CKGR_MCFR : (PMC Offset: 0x24) Main Clock Frequency Register -------- +;- -------- CKGR_PLLR : (PMC Offset: 0x2c) PLL B Register -------- +;- -------- PMC_MCKR : (PMC Offset: 0x30) Master Clock Register -------- +AT91C_PMC_CSS EQU (0x3:SHL:0) ;- (PMC) Programmable Clock Selection +AT91C_PMC_CSS_SLOW_CLK EQU (0x0) ;- (PMC) Slow Clock is selected +AT91C_PMC_CSS_MAIN_CLK EQU (0x1) ;- (PMC) Main Clock is selected +AT91C_PMC_CSS_PLL_CLK EQU (0x3) ;- (PMC) Clock from PLL is selected +AT91C_PMC_PRES EQU (0x7:SHL:2) ;- (PMC) Programmable Clock Prescaler +AT91C_PMC_PRES_CLK EQU (0x0:SHL:2) ;- (PMC) Selected clock +AT91C_PMC_PRES_CLK_2 EQU (0x1:SHL:2) ;- (PMC) Selected clock divided by 2 +AT91C_PMC_PRES_CLK_4 EQU (0x2:SHL:2) ;- (PMC) Selected clock divided by 4 +AT91C_PMC_PRES_CLK_8 EQU (0x3:SHL:2) ;- (PMC) Selected clock divided by 8 +AT91C_PMC_PRES_CLK_16 EQU (0x4:SHL:2) ;- (PMC) Selected clock divided by 16 +AT91C_PMC_PRES_CLK_32 EQU (0x5:SHL:2) ;- (PMC) Selected clock divided by 32 +AT91C_PMC_PRES_CLK_64 EQU (0x6:SHL:2) ;- (PMC) Selected clock divided by 64 +;- -------- PMC_PCKR : (PMC Offset: 0x40) Programmable Clock Register -------- +;- -------- PMC_IER : (PMC Offset: 0x60) PMC Interrupt Enable Register -------- +AT91C_PMC_MOSCS EQU (0x1:SHL:0) ;- (PMC) MOSC Status/Enable/Disable/Mask +AT91C_PMC_LOCK EQU (0x1:SHL:2) ;- (PMC) PLL Status/Enable/Disable/Mask +AT91C_PMC_MCKRDY EQU (0x1:SHL:3) ;- (PMC) MCK_RDY Status/Enable/Disable/Mask +AT91C_PMC_PCK0RDY EQU (0x1:SHL:8) ;- (PMC) PCK0_RDY Status/Enable/Disable/Mask +AT91C_PMC_PCK1RDY EQU (0x1:SHL:9) ;- (PMC) PCK1_RDY Status/Enable/Disable/Mask +AT91C_PMC_PCK2RDY EQU (0x1:SHL:10) ;- (PMC) PCK2_RDY Status/Enable/Disable/Mask +AT91C_PMC_PCK3RDY EQU (0x1:SHL:11) ;- (PMC) PCK3_RDY Status/Enable/Disable/Mask +;- -------- PMC_IDR : (PMC Offset: 0x64) PMC Interrupt Disable Register -------- +;- -------- PMC_SR : (PMC Offset: 0x68) PMC Status Register -------- +;- -------- PMC_IMR : (PMC Offset: 0x6c) PMC Interrupt Mask Register -------- + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Reset Controller Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_RSTC +RSTC_RCR # 4 ;- Reset Control Register +RSTC_RSR # 4 ;- Reset Status Register +RSTC_RMR # 4 ;- Reset Mode Register +;- -------- RSTC_RCR : (RSTC Offset: 0x0) Reset Control Register -------- +AT91C_RSTC_PROCRST EQU (0x1:SHL:0) ;- (RSTC) Processor Reset +AT91C_RSTC_PERRST EQU (0x1:SHL:2) ;- (RSTC) Peripheral Reset +AT91C_RSTC_EXTRST EQU (0x1:SHL:3) ;- (RSTC) External Reset +AT91C_RSTC_KEY EQU (0xFF:SHL:24) ;- (RSTC) Password +;- -------- RSTC_RSR : (RSTC Offset: 0x4) Reset Status Register -------- +AT91C_RSTC_URSTS EQU (0x1:SHL:0) ;- (RSTC) User Reset Status +AT91C_RSTC_BODSTS EQU (0x1:SHL:1) ;- (RSTC) Brownout Detection Status +AT91C_RSTC_RSTTYP EQU (0x7:SHL:8) ;- (RSTC) Reset Type +AT91C_RSTC_RSTTYP_POWERUP EQU (0x0:SHL:8) ;- (RSTC) Power-up Reset. VDDCORE rising. +AT91C_RSTC_RSTTYP_WAKEUP EQU (0x1:SHL:8) ;- (RSTC) WakeUp Reset. VDDCORE rising. +AT91C_RSTC_RSTTYP_WATCHDOG EQU (0x2:SHL:8) ;- (RSTC) Watchdog Reset. Watchdog overflow occured. +AT91C_RSTC_RSTTYP_SOFTWARE EQU (0x3:SHL:8) ;- (RSTC) Software Reset. Processor reset required by the software. +AT91C_RSTC_RSTTYP_USER EQU (0x4:SHL:8) ;- (RSTC) User Reset. NRST pin detected low. +AT91C_RSTC_RSTTYP_BROWNOUT EQU (0x5:SHL:8) ;- (RSTC) Brownout Reset occured. +AT91C_RSTC_NRSTL EQU (0x1:SHL:16) ;- (RSTC) NRST pin level +AT91C_RSTC_SRCMP EQU (0x1:SHL:17) ;- (RSTC) Software Reset Command in Progress. +;- -------- RSTC_RMR : (RSTC Offset: 0x8) Reset Mode Register -------- +AT91C_RSTC_URSTEN EQU (0x1:SHL:0) ;- (RSTC) User Reset Enable +AT91C_RSTC_URSTIEN EQU (0x1:SHL:4) ;- (RSTC) User Reset Interrupt Enable +AT91C_RSTC_ERSTL EQU (0xF:SHL:8) ;- (RSTC) User Reset Length +AT91C_RSTC_BODIEN EQU (0x1:SHL:16) ;- (RSTC) Brownout Detection Interrupt Enable + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Real Time Timer Controller Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_RTTC +RTTC_RTMR # 4 ;- Real-time Mode Register +RTTC_RTAR # 4 ;- Real-time Alarm Register +RTTC_RTVR # 4 ;- Real-time Value Register +RTTC_RTSR # 4 ;- Real-time Status Register +;- -------- RTTC_RTMR : (RTTC Offset: 0x0) Real-time Mode Register -------- +AT91C_RTTC_RTPRES EQU (0xFFFF:SHL:0) ;- (RTTC) Real-time Timer Prescaler Value +AT91C_RTTC_ALMIEN EQU (0x1:SHL:16) ;- (RTTC) Alarm Interrupt Enable +AT91C_RTTC_RTTINCIEN EQU (0x1:SHL:17) ;- (RTTC) Real Time Timer Increment Interrupt Enable +AT91C_RTTC_RTTRST EQU (0x1:SHL:18) ;- (RTTC) Real Time Timer Restart +;- -------- RTTC_RTAR : (RTTC Offset: 0x4) Real-time Alarm Register -------- +AT91C_RTTC_ALMV EQU (0x0:SHL:0) ;- (RTTC) Alarm Value +;- -------- RTTC_RTVR : (RTTC Offset: 0x8) Current Real-time Value Register -------- +AT91C_RTTC_CRTV EQU (0x0:SHL:0) ;- (RTTC) Current Real-time Value +;- -------- RTTC_RTSR : (RTTC Offset: 0xc) Real-time Status Register -------- +AT91C_RTTC_ALMS EQU (0x1:SHL:0) ;- (RTTC) Real-time Alarm Status +AT91C_RTTC_RTTINC EQU (0x1:SHL:1) ;- (RTTC) Real-time Timer Increment + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Periodic Interval Timer Controller Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_PITC +PITC_PIMR # 4 ;- Period Interval Mode Register +PITC_PISR # 4 ;- Period Interval Status Register +PITC_PIVR # 4 ;- Period Interval Value Register +PITC_PIIR # 4 ;- Period Interval Image Register +;- -------- PITC_PIMR : (PITC Offset: 0x0) Periodic Interval Mode Register -------- +AT91C_PITC_PIV EQU (0xFFFFF:SHL:0) ;- (PITC) Periodic Interval Value +AT91C_PITC_PITEN EQU (0x1:SHL:24) ;- (PITC) Periodic Interval Timer Enabled +AT91C_PITC_PITIEN EQU (0x1:SHL:25) ;- (PITC) Periodic Interval Timer Interrupt Enable +;- -------- PITC_PISR : (PITC Offset: 0x4) Periodic Interval Status Register -------- +AT91C_PITC_PITS EQU (0x1:SHL:0) ;- (PITC) Periodic Interval Timer Status +;- -------- PITC_PIVR : (PITC Offset: 0x8) Periodic Interval Value Register -------- +AT91C_PITC_CPIV EQU (0xFFFFF:SHL:0) ;- (PITC) Current Periodic Interval Value +AT91C_PITC_PICNT EQU (0xFFF:SHL:20) ;- (PITC) Periodic Interval Counter +;- -------- PITC_PIIR : (PITC Offset: 0xc) Periodic Interval Image Register -------- + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Watchdog Timer Controller Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_WDTC +WDTC_WDCR # 4 ;- Watchdog Control Register +WDTC_WDMR # 4 ;- Watchdog Mode Register +WDTC_WDSR # 4 ;- Watchdog Status Register +;- -------- WDTC_WDCR : (WDTC Offset: 0x0) Periodic Interval Image Register -------- +AT91C_WDTC_WDRSTT EQU (0x1:SHL:0) ;- (WDTC) Watchdog Restart +AT91C_WDTC_KEY EQU (0xFF:SHL:24) ;- (WDTC) Watchdog KEY Password +;- -------- WDTC_WDMR : (WDTC Offset: 0x4) Watchdog Mode Register -------- +AT91C_WDTC_WDV EQU (0xFFF:SHL:0) ;- (WDTC) Watchdog Timer Restart +AT91C_WDTC_WDFIEN EQU (0x1:SHL:12) ;- (WDTC) Watchdog Fault Interrupt Enable +AT91C_WDTC_WDRSTEN EQU (0x1:SHL:13) ;- (WDTC) Watchdog Reset Enable +AT91C_WDTC_WDRPROC EQU (0x1:SHL:14) ;- (WDTC) Watchdog Timer Restart +AT91C_WDTC_WDDIS EQU (0x1:SHL:15) ;- (WDTC) Watchdog Disable +AT91C_WDTC_WDD EQU (0xFFF:SHL:16) ;- (WDTC) Watchdog Delta Value +AT91C_WDTC_WDDBGHLT EQU (0x1:SHL:28) ;- (WDTC) Watchdog Debug Halt +AT91C_WDTC_WDIDLEHLT EQU (0x1:SHL:29) ;- (WDTC) Watchdog Idle Halt +;- -------- WDTC_WDSR : (WDTC Offset: 0x8) Watchdog Status Register -------- +AT91C_WDTC_WDUNF EQU (0x1:SHL:0) ;- (WDTC) Watchdog Underflow +AT91C_WDTC_WDERR EQU (0x1:SHL:1) ;- (WDTC) Watchdog Error + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Voltage Regulator Mode Controller Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_VREG +VREG_MR # 4 ;- Voltage Regulator Mode Register +;- -------- VREG_MR : (VREG Offset: 0x0) Voltage Regulator Mode Register -------- +AT91C_VREG_PSTDBY EQU (0x1:SHL:0) ;- (VREG) Voltage Regulator Power Standby Mode + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Memory Controller Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_MC +MC_RCR # 4 ;- MC Remap Control Register +MC_ASR # 4 ;- MC Abort Status Register +MC_AASR # 4 ;- MC Abort Address Status Register + # 84 ;- Reserved +MC_FMR # 4 ;- MC Flash Mode Register +MC_FCR # 4 ;- MC Flash Command Register +MC_FSR # 4 ;- MC Flash Status Register +;- -------- MC_RCR : (MC Offset: 0x0) MC Remap Control Register -------- +AT91C_MC_RCB EQU (0x1:SHL:0) ;- (MC) Remap Command Bit +;- -------- MC_ASR : (MC Offset: 0x4) MC Abort Status Register -------- +AT91C_MC_UNDADD EQU (0x1:SHL:0) ;- (MC) Undefined Addess Abort Status +AT91C_MC_MISADD EQU (0x1:SHL:1) ;- (MC) Misaligned Addess Abort Status +AT91C_MC_ABTSZ EQU (0x3:SHL:8) ;- (MC) Abort Size Status +AT91C_MC_ABTSZ_BYTE EQU (0x0:SHL:8) ;- (MC) Byte +AT91C_MC_ABTSZ_HWORD EQU (0x1:SHL:8) ;- (MC) Half-word +AT91C_MC_ABTSZ_WORD EQU (0x2:SHL:8) ;- (MC) Word +AT91C_MC_ABTTYP EQU (0x3:SHL:10) ;- (MC) Abort Type Status +AT91C_MC_ABTTYP_DATAR EQU (0x0:SHL:10) ;- (MC) Data Read +AT91C_MC_ABTTYP_DATAW EQU (0x1:SHL:10) ;- (MC) Data Write +AT91C_MC_ABTTYP_FETCH EQU (0x2:SHL:10) ;- (MC) Code Fetch +AT91C_MC_MST0 EQU (0x1:SHL:16) ;- (MC) Master 0 Abort Source +AT91C_MC_MST1 EQU (0x1:SHL:17) ;- (MC) Master 1 Abort Source +AT91C_MC_SVMST0 EQU (0x1:SHL:24) ;- (MC) Saved Master 0 Abort Source +AT91C_MC_SVMST1 EQU (0x1:SHL:25) ;- (MC) Saved Master 1 Abort Source +;- -------- MC_FMR : (MC Offset: 0x60) MC Flash Mode Register -------- +AT91C_MC_FRDY EQU (0x1:SHL:0) ;- (MC) Flash Ready +AT91C_MC_LOCKE EQU (0x1:SHL:2) ;- (MC) Lock Error +AT91C_MC_PROGE EQU (0x1:SHL:3) ;- (MC) Programming Error +AT91C_MC_NEBP EQU (0x1:SHL:7) ;- (MC) No Erase Before Programming +AT91C_MC_FWS EQU (0x3:SHL:8) ;- (MC) Flash Wait State +AT91C_MC_FWS_0FWS EQU (0x0:SHL:8) ;- (MC) 1 cycle for Read, 2 for Write operations +AT91C_MC_FWS_1FWS EQU (0x1:SHL:8) ;- (MC) 2 cycles for Read, 3 for Write operations +AT91C_MC_FWS_2FWS EQU (0x2:SHL:8) ;- (MC) 3 cycles for Read, 4 for Write operations +AT91C_MC_FWS_3FWS EQU (0x3:SHL:8) ;- (MC) 4 cycles for Read, 4 for Write operations +AT91C_MC_FMCN EQU (0xFF:SHL:16) ;- (MC) Flash Microsecond Cycle Number +;- -------- MC_FCR : (MC Offset: 0x64) MC Flash Command Register -------- +AT91C_MC_FCMD EQU (0xF:SHL:0) ;- (MC) Flash Command +AT91C_MC_FCMD_START_PROG EQU (0x1) ;- (MC) Starts the programming of th epage specified by PAGEN. +AT91C_MC_FCMD_LOCK EQU (0x2) ;- (MC) Starts a lock sequence of the sector defined by the bits 4 to 7 of the field PAGEN. +AT91C_MC_FCMD_PROG_AND_LOCK EQU (0x3) ;- (MC) The lock sequence automatically happens after the programming sequence is completed. +AT91C_MC_FCMD_UNLOCK EQU (0x4) ;- (MC) Starts an unlock sequence of the sector defined by the bits 4 to 7 of the field PAGEN. +AT91C_MC_FCMD_ERASE_ALL EQU (0x8) ;- (MC) Starts the erase of the entire flash.If at least a page is locked, the command is cancelled. +AT91C_MC_FCMD_SET_GP_NVM EQU (0xB) ;- (MC) Set General Purpose NVM bits. +AT91C_MC_FCMD_CLR_GP_NVM EQU (0xD) ;- (MC) Clear General Purpose NVM bits. +AT91C_MC_FCMD_SET_SECURITY EQU (0xF) ;- (MC) Set Security Bit. +AT91C_MC_PAGEN EQU (0x3FF:SHL:8) ;- (MC) Page Number +AT91C_MC_KEY EQU (0xFF:SHL:24) ;- (MC) Writing Protect Key +;- -------- MC_FSR : (MC Offset: 0x68) MC Flash Command Register -------- +AT91C_MC_SECURITY EQU (0x1:SHL:4) ;- (MC) Security Bit Status +AT91C_MC_GPNVM0 EQU (0x1:SHL:8) ;- (MC) Sector 0 Lock Status +AT91C_MC_GPNVM1 EQU (0x1:SHL:9) ;- (MC) Sector 1 Lock Status +AT91C_MC_GPNVM2 EQU (0x1:SHL:10) ;- (MC) Sector 2 Lock Status +AT91C_MC_GPNVM3 EQU (0x1:SHL:11) ;- (MC) Sector 3 Lock Status +AT91C_MC_GPNVM4 EQU (0x1:SHL:12) ;- (MC) Sector 4 Lock Status +AT91C_MC_GPNVM5 EQU (0x1:SHL:13) ;- (MC) Sector 5 Lock Status +AT91C_MC_GPNVM6 EQU (0x1:SHL:14) ;- (MC) Sector 6 Lock Status +AT91C_MC_GPNVM7 EQU (0x1:SHL:15) ;- (MC) Sector 7 Lock Status +AT91C_MC_LOCKS0 EQU (0x1:SHL:16) ;- (MC) Sector 0 Lock Status +AT91C_MC_LOCKS1 EQU (0x1:SHL:17) ;- (MC) Sector 1 Lock Status +AT91C_MC_LOCKS2 EQU (0x1:SHL:18) ;- (MC) Sector 2 Lock Status +AT91C_MC_LOCKS3 EQU (0x1:SHL:19) ;- (MC) Sector 3 Lock Status +AT91C_MC_LOCKS4 EQU (0x1:SHL:20) ;- (MC) Sector 4 Lock Status +AT91C_MC_LOCKS5 EQU (0x1:SHL:21) ;- (MC) Sector 5 Lock Status +AT91C_MC_LOCKS6 EQU (0x1:SHL:22) ;- (MC) Sector 6 Lock Status +AT91C_MC_LOCKS7 EQU (0x1:SHL:23) ;- (MC) Sector 7 Lock Status +AT91C_MC_LOCKS8 EQU (0x1:SHL:24) ;- (MC) Sector 8 Lock Status +AT91C_MC_LOCKS9 EQU (0x1:SHL:25) ;- (MC) Sector 9 Lock Status +AT91C_MC_LOCKS10 EQU (0x1:SHL:26) ;- (MC) Sector 10 Lock Status +AT91C_MC_LOCKS11 EQU (0x1:SHL:27) ;- (MC) Sector 11 Lock Status +AT91C_MC_LOCKS12 EQU (0x1:SHL:28) ;- (MC) Sector 12 Lock Status +AT91C_MC_LOCKS13 EQU (0x1:SHL:29) ;- (MC) Sector 13 Lock Status +AT91C_MC_LOCKS14 EQU (0x1:SHL:30) ;- (MC) Sector 14 Lock Status +AT91C_MC_LOCKS15 EQU (0x1:SHL:31) ;- (MC) Sector 15 Lock Status + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Serial Parallel Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_SPI +SPI_CR # 4 ;- Control Register +SPI_MR # 4 ;- Mode Register +SPI_RDR # 4 ;- Receive Data Register +SPI_TDR # 4 ;- Transmit Data Register +SPI_SR # 4 ;- Status Register +SPI_IER # 4 ;- Interrupt Enable Register +SPI_IDR # 4 ;- Interrupt Disable Register +SPI_IMR # 4 ;- Interrupt Mask Register + # 16 ;- Reserved +SPI_CSR # 16 ;- Chip Select Register + # 192 ;- Reserved +SPI_RPR # 4 ;- Receive Pointer Register +SPI_RCR # 4 ;- Receive Counter Register +SPI_TPR # 4 ;- Transmit Pointer Register +SPI_TCR # 4 ;- Transmit Counter Register +SPI_RNPR # 4 ;- Receive Next Pointer Register +SPI_RNCR # 4 ;- Receive Next Counter Register +SPI_TNPR # 4 ;- Transmit Next Pointer Register +SPI_TNCR # 4 ;- Transmit Next Counter Register +SPI_PTCR # 4 ;- PDC Transfer Control Register +SPI_PTSR # 4 ;- PDC Transfer Status Register +;- -------- SPI_CR : (SPI Offset: 0x0) SPI Control Register -------- +AT91C_SPI_SPIEN EQU (0x1:SHL:0) ;- (SPI) SPI Enable +AT91C_SPI_SPIDIS EQU (0x1:SHL:1) ;- (SPI) SPI Disable +AT91C_SPI_SWRST EQU (0x1:SHL:7) ;- (SPI) SPI Software reset +AT91C_SPI_LASTXFER EQU (0x1:SHL:24) ;- (SPI) SPI Last Transfer +;- -------- SPI_MR : (SPI Offset: 0x4) SPI Mode Register -------- +AT91C_SPI_MSTR EQU (0x1:SHL:0) ;- (SPI) Master/Slave Mode +AT91C_SPI_PS EQU (0x1:SHL:1) ;- (SPI) Peripheral Select +AT91C_SPI_PS_FIXED EQU (0x0:SHL:1) ;- (SPI) Fixed Peripheral Select +AT91C_SPI_PS_VARIABLE EQU (0x1:SHL:1) ;- (SPI) Variable Peripheral Select +AT91C_SPI_PCSDEC EQU (0x1:SHL:2) ;- (SPI) Chip Select Decode +AT91C_SPI_FDIV EQU (0x1:SHL:3) ;- (SPI) Clock Selection +AT91C_SPI_MODFDIS EQU (0x1:SHL:4) ;- (SPI) Mode Fault Detection +AT91C_SPI_LLB EQU (0x1:SHL:7) ;- (SPI) Clock Selection +AT91C_SPI_PCS EQU (0xF:SHL:16) ;- (SPI) Peripheral Chip Select +AT91C_SPI_DLYBCS EQU (0xFF:SHL:24) ;- (SPI) Delay Between Chip Selects +;- -------- SPI_RDR : (SPI Offset: 0x8) Receive Data Register -------- +AT91C_SPI_RD EQU (0xFFFF:SHL:0) ;- (SPI) Receive Data +AT91C_SPI_RPCS EQU (0xF:SHL:16) ;- (SPI) Peripheral Chip Select Status +;- -------- SPI_TDR : (SPI Offset: 0xc) Transmit Data Register -------- +AT91C_SPI_TD EQU (0xFFFF:SHL:0) ;- (SPI) Transmit Data +AT91C_SPI_TPCS EQU (0xF:SHL:16) ;- (SPI) Peripheral Chip Select Status +;- -------- SPI_SR : (SPI Offset: 0x10) Status Register -------- +AT91C_SPI_RDRF EQU (0x1:SHL:0) ;- (SPI) Receive Data Register Full +AT91C_SPI_TDRE EQU (0x1:SHL:1) ;- (SPI) Transmit Data Register Empty +AT91C_SPI_MODF EQU (0x1:SHL:2) ;- (SPI) Mode Fault Error +AT91C_SPI_OVRES EQU (0x1:SHL:3) ;- (SPI) Overrun Error Status +AT91C_SPI_ENDRX EQU (0x1:SHL:4) ;- (SPI) End of Receiver Transfer +AT91C_SPI_ENDTX EQU (0x1:SHL:5) ;- (SPI) End of Receiver Transfer +AT91C_SPI_RXBUFF EQU (0x1:SHL:6) ;- (SPI) RXBUFF Interrupt +AT91C_SPI_TXBUFE EQU (0x1:SHL:7) ;- (SPI) TXBUFE Interrupt +AT91C_SPI_NSSR EQU (0x1:SHL:8) ;- (SPI) NSSR Interrupt +AT91C_SPI_TXEMPTY EQU (0x1:SHL:9) ;- (SPI) TXEMPTY Interrupt +AT91C_SPI_SPIENS EQU (0x1:SHL:16) ;- (SPI) Enable Status +;- -------- SPI_IER : (SPI Offset: 0x14) Interrupt Enable Register -------- +;- -------- SPI_IDR : (SPI Offset: 0x18) Interrupt Disable Register -------- +;- -------- SPI_IMR : (SPI Offset: 0x1c) Interrupt Mask Register -------- +;- -------- SPI_CSR : (SPI Offset: 0x30) Chip Select Register -------- +AT91C_SPI_CPOL EQU (0x1:SHL:0) ;- (SPI) Clock Polarity +AT91C_SPI_NCPHA EQU (0x1:SHL:1) ;- (SPI) Clock Phase +AT91C_SPI_CSAAT EQU (0x1:SHL:3) ;- (SPI) Chip Select Active After Transfer +AT91C_SPI_BITS EQU (0xF:SHL:4) ;- (SPI) Bits Per Transfer +AT91C_SPI_BITS_8 EQU (0x0:SHL:4) ;- (SPI) 8 Bits Per transfer +AT91C_SPI_BITS_9 EQU (0x1:SHL:4) ;- (SPI) 9 Bits Per transfer +AT91C_SPI_BITS_10 EQU (0x2:SHL:4) ;- (SPI) 10 Bits Per transfer +AT91C_SPI_BITS_11 EQU (0x3:SHL:4) ;- (SPI) 11 Bits Per transfer +AT91C_SPI_BITS_12 EQU (0x4:SHL:4) ;- (SPI) 12 Bits Per transfer +AT91C_SPI_BITS_13 EQU (0x5:SHL:4) ;- (SPI) 13 Bits Per transfer +AT91C_SPI_BITS_14 EQU (0x6:SHL:4) ;- (SPI) 14 Bits Per transfer +AT91C_SPI_BITS_15 EQU (0x7:SHL:4) ;- (SPI) 15 Bits Per transfer +AT91C_SPI_BITS_16 EQU (0x8:SHL:4) ;- (SPI) 16 Bits Per transfer +AT91C_SPI_SCBR EQU (0xFF:SHL:8) ;- (SPI) Serial Clock Baud Rate +AT91C_SPI_DLYBS EQU (0xFF:SHL:16) ;- (SPI) Delay Before SPCK +AT91C_SPI_DLYBCT EQU (0xFF:SHL:24) ;- (SPI) Delay Between Consecutive Transfers + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Usart +;- ***************************************************************************** + ^ 0 ;- AT91S_USART +US_CR # 4 ;- Control Register +US_MR # 4 ;- Mode Register +US_IER # 4 ;- Interrupt Enable Register +US_IDR # 4 ;- Interrupt Disable Register +US_IMR # 4 ;- Interrupt Mask Register +US_CSR # 4 ;- Channel Status Register +US_RHR # 4 ;- Receiver Holding Register +US_THR # 4 ;- Transmitter Holding Register +US_BRGR # 4 ;- Baud Rate Generator Register +US_RTOR # 4 ;- Receiver Time-out Register +US_TTGR # 4 ;- Transmitter Time-guard Register + # 20 ;- Reserved +US_FIDI # 4 ;- FI_DI_Ratio Register +US_NER # 4 ;- Nb Errors Register + # 4 ;- Reserved +US_IF # 4 ;- IRDA_FILTER Register + # 176 ;- Reserved +US_RPR # 4 ;- Receive Pointer Register +US_RCR # 4 ;- Receive Counter Register +US_TPR # 4 ;- Transmit Pointer Register +US_TCR # 4 ;- Transmit Counter Register +US_RNPR # 4 ;- Receive Next Pointer Register +US_RNCR # 4 ;- Receive Next Counter Register +US_TNPR # 4 ;- Transmit Next Pointer Register +US_TNCR # 4 ;- Transmit Next Counter Register +US_PTCR # 4 ;- PDC Transfer Control Register +US_PTSR # 4 ;- PDC Transfer Status Register +;- -------- US_CR : (USART Offset: 0x0) Debug Unit Control Register -------- +AT91C_US_STTBRK EQU (0x1:SHL:9) ;- (USART) Start Break +AT91C_US_STPBRK EQU (0x1:SHL:10) ;- (USART) Stop Break +AT91C_US_STTTO EQU (0x1:SHL:11) ;- (USART) Start Time-out +AT91C_US_SENDA EQU (0x1:SHL:12) ;- (USART) Send Address +AT91C_US_RSTIT EQU (0x1:SHL:13) ;- (USART) Reset Iterations +AT91C_US_RSTNACK EQU (0x1:SHL:14) ;- (USART) Reset Non Acknowledge +AT91C_US_RETTO EQU (0x1:SHL:15) ;- (USART) Rearm Time-out +AT91C_US_DTREN EQU (0x1:SHL:16) ;- (USART) Data Terminal ready Enable +AT91C_US_DTRDIS EQU (0x1:SHL:17) ;- (USART) Data Terminal ready Disable +AT91C_US_RTSEN EQU (0x1:SHL:18) ;- (USART) Request to Send enable +AT91C_US_RTSDIS EQU (0x1:SHL:19) ;- (USART) Request to Send Disable +;- -------- US_MR : (USART Offset: 0x4) Debug Unit Mode Register -------- +AT91C_US_USMODE EQU (0xF:SHL:0) ;- (USART) Usart mode +AT91C_US_USMODE_NORMAL EQU (0x0) ;- (USART) Normal +AT91C_US_USMODE_RS485 EQU (0x1) ;- (USART) RS485 +AT91C_US_USMODE_HWHSH EQU (0x2) ;- (USART) Hardware Handshaking +AT91C_US_USMODE_MODEM EQU (0x3) ;- (USART) Modem +AT91C_US_USMODE_ISO7816_0 EQU (0x4) ;- (USART) ISO7816 protocol: T = 0 +AT91C_US_USMODE_ISO7816_1 EQU (0x6) ;- (USART) ISO7816 protocol: T = 1 +AT91C_US_USMODE_IRDA EQU (0x8) ;- (USART) IrDA +AT91C_US_USMODE_SWHSH EQU (0xC) ;- (USART) Software Handshaking +AT91C_US_CLKS EQU (0x3:SHL:4) ;- (USART) Clock Selection (Baud Rate generator Input Clock +AT91C_US_CLKS_CLOCK EQU (0x0:SHL:4) ;- (USART) Clock +AT91C_US_CLKS_FDIV1 EQU (0x1:SHL:4) ;- (USART) fdiv1 +AT91C_US_CLKS_SLOW EQU (0x2:SHL:4) ;- (USART) slow_clock (ARM) +AT91C_US_CLKS_EXT EQU (0x3:SHL:4) ;- (USART) External (SCK) +AT91C_US_CHRL EQU (0x3:SHL:6) ;- (USART) Clock Selection (Baud Rate generator Input Clock +AT91C_US_CHRL_5_BITS EQU (0x0:SHL:6) ;- (USART) Character Length: 5 bits +AT91C_US_CHRL_6_BITS EQU (0x1:SHL:6) ;- (USART) Character Length: 6 bits +AT91C_US_CHRL_7_BITS EQU (0x2:SHL:6) ;- (USART) Character Length: 7 bits +AT91C_US_CHRL_8_BITS EQU (0x3:SHL:6) ;- (USART) Character Length: 8 bits +AT91C_US_SYNC EQU (0x1:SHL:8) ;- (USART) Synchronous Mode Select +AT91C_US_NBSTOP EQU (0x3:SHL:12) ;- (USART) Number of Stop bits +AT91C_US_NBSTOP_1_BIT EQU (0x0:SHL:12) ;- (USART) 1 stop bit +AT91C_US_NBSTOP_15_BIT EQU (0x1:SHL:12) ;- (USART) Asynchronous (SYNC=0) 2 stop bits Synchronous (SYNC=1) 2 stop bits +AT91C_US_NBSTOP_2_BIT EQU (0x2:SHL:12) ;- (USART) 2 stop bits +AT91C_US_MSBF EQU (0x1:SHL:16) ;- (USART) Bit Order +AT91C_US_MODE9 EQU (0x1:SHL:17) ;- (USART) 9-bit Character length +AT91C_US_CKLO EQU (0x1:SHL:18) ;- (USART) Clock Output Select +AT91C_US_OVER EQU (0x1:SHL:19) ;- (USART) Over Sampling Mode +AT91C_US_INACK EQU (0x1:SHL:20) ;- (USART) Inhibit Non Acknowledge +AT91C_US_DSNACK EQU (0x1:SHL:21) ;- (USART) Disable Successive NACK +AT91C_US_MAX_ITER EQU (0x1:SHL:24) ;- (USART) Number of Repetitions +AT91C_US_FILTER EQU (0x1:SHL:28) ;- (USART) Receive Line Filter +;- -------- US_IER : (USART Offset: 0x8) Debug Unit Interrupt Enable Register -------- +AT91C_US_RXBRK EQU (0x1:SHL:2) ;- (USART) Break Received/End of Break +AT91C_US_TIMEOUT EQU (0x1:SHL:8) ;- (USART) Receiver Time-out +AT91C_US_ITERATION EQU (0x1:SHL:10) ;- (USART) Max number of Repetitions Reached +AT91C_US_NACK EQU (0x1:SHL:13) ;- (USART) Non Acknowledge +AT91C_US_RIIC EQU (0x1:SHL:16) ;- (USART) Ring INdicator Input Change Flag +AT91C_US_DSRIC EQU (0x1:SHL:17) ;- (USART) Data Set Ready Input Change Flag +AT91C_US_DCDIC EQU (0x1:SHL:18) ;- (USART) Data Carrier Flag +AT91C_US_CTSIC EQU (0x1:SHL:19) ;- (USART) Clear To Send Input Change Flag +;- -------- US_IDR : (USART Offset: 0xc) Debug Unit Interrupt Disable Register -------- +;- -------- US_IMR : (USART Offset: 0x10) Debug Unit Interrupt Mask Register -------- +;- -------- US_CSR : (USART Offset: 0x14) Debug Unit Channel Status Register -------- +AT91C_US_RI EQU (0x1:SHL:20) ;- (USART) Image of RI Input +AT91C_US_DSR EQU (0x1:SHL:21) ;- (USART) Image of DSR Input +AT91C_US_DCD EQU (0x1:SHL:22) ;- (USART) Image of DCD Input +AT91C_US_CTS EQU (0x1:SHL:23) ;- (USART) Image of CTS Input + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Synchronous Serial Controller Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_SSC +SSC_CR # 4 ;- Control Register +SSC_CMR # 4 ;- Clock Mode Register + # 8 ;- Reserved +SSC_RCMR # 4 ;- Receive Clock ModeRegister +SSC_RFMR # 4 ;- Receive Frame Mode Register +SSC_TCMR # 4 ;- Transmit Clock Mode Register +SSC_TFMR # 4 ;- Transmit Frame Mode Register +SSC_RHR # 4 ;- Receive Holding Register +SSC_THR # 4 ;- Transmit Holding Register + # 8 ;- Reserved +SSC_RSHR # 4 ;- Receive Sync Holding Register +SSC_TSHR # 4 ;- Transmit Sync Holding Register + # 8 ;- Reserved +SSC_SR # 4 ;- Status Register +SSC_IER # 4 ;- Interrupt Enable Register +SSC_IDR # 4 ;- Interrupt Disable Register +SSC_IMR # 4 ;- Interrupt Mask Register + # 176 ;- Reserved +SSC_RPR # 4 ;- Receive Pointer Register +SSC_RCR # 4 ;- Receive Counter Register +SSC_TPR # 4 ;- Transmit Pointer Register +SSC_TCR # 4 ;- Transmit Counter Register +SSC_RNPR # 4 ;- Receive Next Pointer Register +SSC_RNCR # 4 ;- Receive Next Counter Register +SSC_TNPR # 4 ;- Transmit Next Pointer Register +SSC_TNCR # 4 ;- Transmit Next Counter Register +SSC_PTCR # 4 ;- PDC Transfer Control Register +SSC_PTSR # 4 ;- PDC Transfer Status Register +;- -------- SSC_CR : (SSC Offset: 0x0) SSC Control Register -------- +AT91C_SSC_RXEN EQU (0x1:SHL:0) ;- (SSC) Receive Enable +AT91C_SSC_RXDIS EQU (0x1:SHL:1) ;- (SSC) Receive Disable +AT91C_SSC_TXEN EQU (0x1:SHL:8) ;- (SSC) Transmit Enable +AT91C_SSC_TXDIS EQU (0x1:SHL:9) ;- (SSC) Transmit Disable +AT91C_SSC_SWRST EQU (0x1:SHL:15) ;- (SSC) Software Reset +;- -------- SSC_RCMR : (SSC Offset: 0x10) SSC Receive Clock Mode Register -------- +AT91C_SSC_CKS EQU (0x3:SHL:0) ;- (SSC) Receive/Transmit Clock Selection +AT91C_SSC_CKS_DIV EQU (0x0) ;- (SSC) Divided Clock +AT91C_SSC_CKS_TK EQU (0x1) ;- (SSC) TK Clock signal +AT91C_SSC_CKS_RK EQU (0x2) ;- (SSC) RK pin +AT91C_SSC_CKO EQU (0x7:SHL:2) ;- (SSC) Receive/Transmit Clock Output Mode Selection +AT91C_SSC_CKO_NONE EQU (0x0:SHL:2) ;- (SSC) Receive/Transmit Clock Output Mode: None RK pin: Input-only +AT91C_SSC_CKO_CONTINOUS EQU (0x1:SHL:2) ;- (SSC) Continuous Receive/Transmit Clock RK pin: Output +AT91C_SSC_CKO_DATA_TX EQU (0x2:SHL:2) ;- (SSC) Receive/Transmit Clock only during data transfers RK pin: Output +AT91C_SSC_CKI EQU (0x1:SHL:5) ;- (SSC) Receive/Transmit Clock Inversion +AT91C_SSC_CKG EQU (0x3:SHL:6) ;- (SSC) Receive/Transmit Clock Gating Selection +AT91C_SSC_CKG_NONE EQU (0x0:SHL:6) ;- (SSC) Receive/Transmit Clock Gating: None, continuous clock +AT91C_SSC_CKG_LOW EQU (0x1:SHL:6) ;- (SSC) Receive/Transmit Clock enabled only if RF Low +AT91C_SSC_CKG_HIGH EQU (0x2:SHL:6) ;- (SSC) Receive/Transmit Clock enabled only if RF High +AT91C_SSC_START EQU (0xF:SHL:8) ;- (SSC) Receive/Transmit Start Selection +AT91C_SSC_START_CONTINOUS EQU (0x0:SHL:8) ;- (SSC) Continuous, as soon as the receiver is enabled, and immediately after the end of transfer of the previous data. +AT91C_SSC_START_TX EQU (0x1:SHL:8) ;- (SSC) Transmit/Receive start +AT91C_SSC_START_LOW_RF EQU (0x2:SHL:8) ;- (SSC) Detection of a low level on RF input +AT91C_SSC_START_HIGH_RF EQU (0x3:SHL:8) ;- (SSC) Detection of a high level on RF input +AT91C_SSC_START_FALL_RF EQU (0x4:SHL:8) ;- (SSC) Detection of a falling edge on RF input +AT91C_SSC_START_RISE_RF EQU (0x5:SHL:8) ;- (SSC) Detection of a rising edge on RF input +AT91C_SSC_START_LEVEL_RF EQU (0x6:SHL:8) ;- (SSC) Detection of any level change on RF input +AT91C_SSC_START_EDGE_RF EQU (0x7:SHL:8) ;- (SSC) Detection of any edge on RF input +AT91C_SSC_START_0 EQU (0x8:SHL:8) ;- (SSC) Compare 0 +AT91C_SSC_STOP EQU (0x1:SHL:12) ;- (SSC) Receive Stop Selection +AT91C_SSC_STTDLY EQU (0xFF:SHL:16) ;- (SSC) Receive/Transmit Start Delay +AT91C_SSC_PERIOD EQU (0xFF:SHL:24) ;- (SSC) Receive/Transmit Period Divider Selection +;- -------- SSC_RFMR : (SSC Offset: 0x14) SSC Receive Frame Mode Register -------- +AT91C_SSC_DATLEN EQU (0x1F:SHL:0) ;- (SSC) Data Length +AT91C_SSC_LOOP EQU (0x1:SHL:5) ;- (SSC) Loop Mode +AT91C_SSC_MSBF EQU (0x1:SHL:7) ;- (SSC) Most Significant Bit First +AT91C_SSC_DATNB EQU (0xF:SHL:8) ;- (SSC) Data Number per Frame +AT91C_SSC_FSLEN EQU (0xF:SHL:16) ;- (SSC) Receive/Transmit Frame Sync length +AT91C_SSC_FSOS EQU (0x7:SHL:20) ;- (SSC) Receive/Transmit Frame Sync Output Selection +AT91C_SSC_FSOS_NONE EQU (0x0:SHL:20) ;- (SSC) Selected Receive/Transmit Frame Sync Signal: None RK pin Input-only +AT91C_SSC_FSOS_NEGATIVE EQU (0x1:SHL:20) ;- (SSC) Selected Receive/Transmit Frame Sync Signal: Negative Pulse +AT91C_SSC_FSOS_POSITIVE EQU (0x2:SHL:20) ;- (SSC) Selected Receive/Transmit Frame Sync Signal: Positive Pulse +AT91C_SSC_FSOS_LOW EQU (0x3:SHL:20) ;- (SSC) Selected Receive/Transmit Frame Sync Signal: Driver Low during data transfer +AT91C_SSC_FSOS_HIGH EQU (0x4:SHL:20) ;- (SSC) Selected Receive/Transmit Frame Sync Signal: Driver High during data transfer +AT91C_SSC_FSOS_TOGGLE EQU (0x5:SHL:20) ;- (SSC) Selected Receive/Transmit Frame Sync Signal: Toggling at each start of data transfer +AT91C_SSC_FSEDGE EQU (0x1:SHL:24) ;- (SSC) Frame Sync Edge Detection +;- -------- SSC_TCMR : (SSC Offset: 0x18) SSC Transmit Clock Mode Register -------- +;- -------- SSC_TFMR : (SSC Offset: 0x1c) SSC Transmit Frame Mode Register -------- +AT91C_SSC_DATDEF EQU (0x1:SHL:5) ;- (SSC) Data Default Value +AT91C_SSC_FSDEN EQU (0x1:SHL:23) ;- (SSC) Frame Sync Data Enable +;- -------- SSC_SR : (SSC Offset: 0x40) SSC Status Register -------- +AT91C_SSC_TXRDY EQU (0x1:SHL:0) ;- (SSC) Transmit Ready +AT91C_SSC_TXEMPTY EQU (0x1:SHL:1) ;- (SSC) Transmit Empty +AT91C_SSC_ENDTX EQU (0x1:SHL:2) ;- (SSC) End Of Transmission +AT91C_SSC_TXBUFE EQU (0x1:SHL:3) ;- (SSC) Transmit Buffer Empty +AT91C_SSC_RXRDY EQU (0x1:SHL:4) ;- (SSC) Receive Ready +AT91C_SSC_OVRUN EQU (0x1:SHL:5) ;- (SSC) Receive Overrun +AT91C_SSC_ENDRX EQU (0x1:SHL:6) ;- (SSC) End of Reception +AT91C_SSC_RXBUFF EQU (0x1:SHL:7) ;- (SSC) Receive Buffer Full +AT91C_SSC_CP0 EQU (0x1:SHL:8) ;- (SSC) Compare 0 +AT91C_SSC_CP1 EQU (0x1:SHL:9) ;- (SSC) Compare 1 +AT91C_SSC_TXSYN EQU (0x1:SHL:10) ;- (SSC) Transmit Sync +AT91C_SSC_RXSYN EQU (0x1:SHL:11) ;- (SSC) Receive Sync +AT91C_SSC_TXENA EQU (0x1:SHL:16) ;- (SSC) Transmit Enable +AT91C_SSC_RXENA EQU (0x1:SHL:17) ;- (SSC) Receive Enable +;- -------- SSC_IER : (SSC Offset: 0x44) SSC Interrupt Enable Register -------- +;- -------- SSC_IDR : (SSC Offset: 0x48) SSC Interrupt Disable Register -------- +;- -------- SSC_IMR : (SSC Offset: 0x4c) SSC Interrupt Mask Register -------- + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Two-wire Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_TWI +TWI_CR # 4 ;- Control Register +TWI_MMR # 4 ;- Master Mode Register + # 4 ;- Reserved +TWI_IADR # 4 ;- Internal Address Register +TWI_CWGR # 4 ;- Clock Waveform Generator Register + # 12 ;- Reserved +TWI_SR # 4 ;- Status Register +TWI_IER # 4 ;- Interrupt Enable Register +TWI_IDR # 4 ;- Interrupt Disable Register +TWI_IMR # 4 ;- Interrupt Mask Register +TWI_RHR # 4 ;- Receive Holding Register +TWI_THR # 4 ;- Transmit Holding Register +;- -------- TWI_CR : (TWI Offset: 0x0) TWI Control Register -------- +AT91C_TWI_START EQU (0x1:SHL:0) ;- (TWI) Send a START Condition +AT91C_TWI_STOP EQU (0x1:SHL:1) ;- (TWI) Send a STOP Condition +AT91C_TWI_MSEN EQU (0x1:SHL:2) ;- (TWI) TWI Master Transfer Enabled +AT91C_TWI_MSDIS EQU (0x1:SHL:3) ;- (TWI) TWI Master Transfer Disabled +AT91C_TWI_SWRST EQU (0x1:SHL:7) ;- (TWI) Software Reset +;- -------- TWI_MMR : (TWI Offset: 0x4) TWI Master Mode Register -------- +AT91C_TWI_IADRSZ EQU (0x3:SHL:8) ;- (TWI) Internal Device Address Size +AT91C_TWI_IADRSZ_NO EQU (0x0:SHL:8) ;- (TWI) No internal device address +AT91C_TWI_IADRSZ_1_BYTE EQU (0x1:SHL:8) ;- (TWI) One-byte internal device address +AT91C_TWI_IADRSZ_2_BYTE EQU (0x2:SHL:8) ;- (TWI) Two-byte internal device address +AT91C_TWI_IADRSZ_3_BYTE EQU (0x3:SHL:8) ;- (TWI) Three-byte internal device address +AT91C_TWI_MREAD EQU (0x1:SHL:12) ;- (TWI) Master Read Direction +AT91C_TWI_DADR EQU (0x7F:SHL:16) ;- (TWI) Device Address +;- -------- TWI_CWGR : (TWI Offset: 0x10) TWI Clock Waveform Generator Register -------- +AT91C_TWI_CLDIV EQU (0xFF:SHL:0) ;- (TWI) Clock Low Divider +AT91C_TWI_CHDIV EQU (0xFF:SHL:8) ;- (TWI) Clock High Divider +AT91C_TWI_CKDIV EQU (0x7:SHL:16) ;- (TWI) Clock Divider +;- -------- TWI_SR : (TWI Offset: 0x20) TWI Status Register -------- +AT91C_TWI_TXCOMP EQU (0x1:SHL:0) ;- (TWI) Transmission Completed +AT91C_TWI_RXRDY EQU (0x1:SHL:1) ;- (TWI) Receive holding register ReaDY +AT91C_TWI_TXRDY EQU (0x1:SHL:2) ;- (TWI) Transmit holding register ReaDY +AT91C_TWI_OVRE EQU (0x1:SHL:6) ;- (TWI) Overrun Error +AT91C_TWI_UNRE EQU (0x1:SHL:7) ;- (TWI) Underrun Error +AT91C_TWI_NACK EQU (0x1:SHL:8) ;- (TWI) Not Acknowledged +;- -------- TWI_IER : (TWI Offset: 0x24) TWI Interrupt Enable Register -------- +;- -------- TWI_IDR : (TWI Offset: 0x28) TWI Interrupt Disable Register -------- +;- -------- TWI_IMR : (TWI Offset: 0x2c) TWI Interrupt Mask Register -------- + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR PWMC Channel Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_PWMC_CH +PWMC_CMR # 4 ;- Channel Mode Register +PWMC_CDTYR # 4 ;- Channel Duty Cycle Register +PWMC_CPRDR # 4 ;- Channel Period Register +PWMC_CCNTR # 4 ;- Channel Counter Register +PWMC_CUPDR # 4 ;- Channel Update Register +PWMC_Reserved # 12 ;- Reserved +;- -------- PWMC_CMR : (PWMC_CH Offset: 0x0) PWMC Channel Mode Register -------- +AT91C_PWMC_CPRE EQU (0xF:SHL:0) ;- (PWMC_CH) Channel Pre-scaler : PWMC_CLKx +AT91C_PWMC_CPRE_MCK EQU (0x0) ;- (PWMC_CH) +AT91C_PWMC_CPRE_MCKA EQU (0xB) ;- (PWMC_CH) +AT91C_PWMC_CPRE_MCKB EQU (0xC) ;- (PWMC_CH) +AT91C_PWMC_CALG EQU (0x1:SHL:8) ;- (PWMC_CH) Channel Alignment +AT91C_PWMC_CPOL EQU (0x1:SHL:9) ;- (PWMC_CH) Channel Polarity +AT91C_PWMC_CPD EQU (0x1:SHL:10) ;- (PWMC_CH) Channel Update Period +;- -------- PWMC_CDTYR : (PWMC_CH Offset: 0x4) PWMC Channel Duty Cycle Register -------- +AT91C_PWMC_CDTY EQU (0x0:SHL:0) ;- (PWMC_CH) Channel Duty Cycle +;- -------- PWMC_CPRDR : (PWMC_CH Offset: 0x8) PWMC Channel Period Register -------- +AT91C_PWMC_CPRD EQU (0x0:SHL:0) ;- (PWMC_CH) Channel Period +;- -------- PWMC_CCNTR : (PWMC_CH Offset: 0xc) PWMC Channel Counter Register -------- +AT91C_PWMC_CCNT EQU (0x0:SHL:0) ;- (PWMC_CH) Channel Counter +;- -------- PWMC_CUPDR : (PWMC_CH Offset: 0x10) PWMC Channel Update Register -------- +AT91C_PWMC_CUPD EQU (0x0:SHL:0) ;- (PWMC_CH) Channel Update + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Pulse Width Modulation Controller Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_PWMC +PWMC_MR # 4 ;- PWMC Mode Register +PWMC_ENA # 4 ;- PWMC Enable Register +PWMC_DIS # 4 ;- PWMC Disable Register +PWMC_SR # 4 ;- PWMC Status Register +PWMC_IER # 4 ;- PWMC Interrupt Enable Register +PWMC_IDR # 4 ;- PWMC Interrupt Disable Register +PWMC_IMR # 4 ;- PWMC Interrupt Mask Register +PWMC_ISR # 4 ;- PWMC Interrupt Status Register + # 220 ;- Reserved +PWMC_VR # 4 ;- PWMC Version Register + # 256 ;- Reserved +PWMC_CH # 96 ;- PWMC Channel +;- -------- PWMC_MR : (PWMC Offset: 0x0) PWMC Mode Register -------- +AT91C_PWMC_DIVA EQU (0xFF:SHL:0) ;- (PWMC) CLKA divide factor. +AT91C_PWMC_PREA EQU (0xF:SHL:8) ;- (PWMC) Divider Input Clock Prescaler A +AT91C_PWMC_PREA_MCK EQU (0x0:SHL:8) ;- (PWMC) +AT91C_PWMC_DIVB EQU (0xFF:SHL:16) ;- (PWMC) CLKB divide factor. +AT91C_PWMC_PREB EQU (0xF:SHL:24) ;- (PWMC) Divider Input Clock Prescaler B +AT91C_PWMC_PREB_MCK EQU (0x0:SHL:24) ;- (PWMC) +;- -------- PWMC_ENA : (PWMC Offset: 0x4) PWMC Enable Register -------- +AT91C_PWMC_CHID0 EQU (0x1:SHL:0) ;- (PWMC) Channel ID 0 +AT91C_PWMC_CHID1 EQU (0x1:SHL:1) ;- (PWMC) Channel ID 1 +AT91C_PWMC_CHID2 EQU (0x1:SHL:2) ;- (PWMC) Channel ID 2 +AT91C_PWMC_CHID3 EQU (0x1:SHL:3) ;- (PWMC) Channel ID 3 +;- -------- PWMC_DIS : (PWMC Offset: 0x8) PWMC Disable Register -------- +;- -------- PWMC_SR : (PWMC Offset: 0xc) PWMC Status Register -------- +;- -------- PWMC_IER : (PWMC Offset: 0x10) PWMC Interrupt Enable Register -------- +;- -------- PWMC_IDR : (PWMC Offset: 0x14) PWMC Interrupt Disable Register -------- +;- -------- PWMC_IMR : (PWMC Offset: 0x18) PWMC Interrupt Mask Register -------- +;- -------- PWMC_ISR : (PWMC Offset: 0x1c) PWMC Interrupt Status Register -------- + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR USB Device Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_UDP +UDP_NUM # 4 ;- Frame Number Register +UDP_GLBSTATE # 4 ;- Global State Register +UDP_FADDR # 4 ;- Function Address Register + # 4 ;- Reserved +UDP_IER # 4 ;- Interrupt Enable Register +UDP_IDR # 4 ;- Interrupt Disable Register +UDP_IMR # 4 ;- Interrupt Mask Register +UDP_ISR # 4 ;- Interrupt Status Register +UDP_ICR # 4 ;- Interrupt Clear Register + # 4 ;- Reserved +UDP_RSTEP # 4 ;- Reset Endpoint Register + # 4 ;- Reserved +UDP_CSR # 24 ;- Endpoint Control and Status Register + # 8 ;- Reserved +UDP_FDR # 24 ;- Endpoint FIFO Data Register + # 12 ;- Reserved +UDP_TXVC # 4 ;- Transceiver Control Register +;- -------- UDP_FRM_NUM : (UDP Offset: 0x0) USB Frame Number Register -------- +AT91C_UDP_FRM_NUM EQU (0x7FF:SHL:0) ;- (UDP) Frame Number as Defined in the Packet Field Formats +AT91C_UDP_FRM_ERR EQU (0x1:SHL:16) ;- (UDP) Frame Error +AT91C_UDP_FRM_OK EQU (0x1:SHL:17) ;- (UDP) Frame OK +;- -------- UDP_GLB_STATE : (UDP Offset: 0x4) USB Global State Register -------- +AT91C_UDP_FADDEN EQU (0x1:SHL:0) ;- (UDP) Function Address Enable +AT91C_UDP_CONFG EQU (0x1:SHL:1) ;- (UDP) Configured +AT91C_UDP_ESR EQU (0x1:SHL:2) ;- (UDP) Enable Send Resume +AT91C_UDP_RSMINPR EQU (0x1:SHL:3) ;- (UDP) A Resume Has Been Sent to the Host +AT91C_UDP_RMWUPE EQU (0x1:SHL:4) ;- (UDP) Remote Wake Up Enable +;- -------- UDP_FADDR : (UDP Offset: 0x8) USB Function Address Register -------- +AT91C_UDP_FADD EQU (0xFF:SHL:0) ;- (UDP) Function Address Value +AT91C_UDP_FEN EQU (0x1:SHL:8) ;- (UDP) Function Enable +;- -------- UDP_IER : (UDP Offset: 0x10) USB Interrupt Enable Register -------- +AT91C_UDP_EPINT0 EQU (0x1:SHL:0) ;- (UDP) Endpoint 0 Interrupt +AT91C_UDP_EPINT1 EQU (0x1:SHL:1) ;- (UDP) Endpoint 0 Interrupt +AT91C_UDP_EPINT2 EQU (0x1:SHL:2) ;- (UDP) Endpoint 2 Interrupt +AT91C_UDP_EPINT3 EQU (0x1:SHL:3) ;- (UDP) Endpoint 3 Interrupt +AT91C_UDP_EPINT4 EQU (0x1:SHL:4) ;- (UDP) Endpoint 4 Interrupt +AT91C_UDP_EPINT5 EQU (0x1:SHL:5) ;- (UDP) Endpoint 5 Interrupt +AT91C_UDP_RXSUSP EQU (0x1:SHL:8) ;- (UDP) USB Suspend Interrupt +AT91C_UDP_RXRSM EQU (0x1:SHL:9) ;- (UDP) USB Resume Interrupt +AT91C_UDP_EXTRSM EQU (0x1:SHL:10) ;- (UDP) USB External Resume Interrupt +AT91C_UDP_SOFINT EQU (0x1:SHL:11) ;- (UDP) USB Start Of frame Interrupt +AT91C_UDP_WAKEUP EQU (0x1:SHL:13) ;- (UDP) USB Resume Interrupt +;- -------- UDP_IDR : (UDP Offset: 0x14) USB Interrupt Disable Register -------- +;- -------- UDP_IMR : (UDP Offset: 0x18) USB Interrupt Mask Register -------- +;- -------- UDP_ISR : (UDP Offset: 0x1c) USB Interrupt Status Register -------- +AT91C_UDP_ENDBUSRES EQU (0x1:SHL:12) ;- (UDP) USB End Of Bus Reset Interrupt +;- -------- UDP_ICR : (UDP Offset: 0x20) USB Interrupt Clear Register -------- +;- -------- UDP_RST_EP : (UDP Offset: 0x28) USB Reset Endpoint Register -------- +AT91C_UDP_EP0 EQU (0x1:SHL:0) ;- (UDP) Reset Endpoint 0 +AT91C_UDP_EP1 EQU (0x1:SHL:1) ;- (UDP) Reset Endpoint 1 +AT91C_UDP_EP2 EQU (0x1:SHL:2) ;- (UDP) Reset Endpoint 2 +AT91C_UDP_EP3 EQU (0x1:SHL:3) ;- (UDP) Reset Endpoint 3 +AT91C_UDP_EP4 EQU (0x1:SHL:4) ;- (UDP) Reset Endpoint 4 +AT91C_UDP_EP5 EQU (0x1:SHL:5) ;- (UDP) Reset Endpoint 5 +;- -------- UDP_CSR : (UDP Offset: 0x30) USB Endpoint Control and Status Register -------- +AT91C_UDP_TXCOMP EQU (0x1:SHL:0) ;- (UDP) Generates an IN packet with data previously written in the DPR +AT91C_UDP_RX_DATA_BK0 EQU (0x1:SHL:1) ;- (UDP) Receive Data Bank 0 +AT91C_UDP_RXSETUP EQU (0x1:SHL:2) ;- (UDP) Sends STALL to the Host (Control endpoints) +AT91C_UDP_ISOERROR EQU (0x1:SHL:3) ;- (UDP) Isochronous error (Isochronous endpoints) +AT91C_UDP_TXPKTRDY EQU (0x1:SHL:4) ;- (UDP) Transmit Packet Ready +AT91C_UDP_FORCESTALL EQU (0x1:SHL:5) ;- (UDP) Force Stall (used by Control, Bulk and Isochronous endpoints). +AT91C_UDP_RX_DATA_BK1 EQU (0x1:SHL:6) ;- (UDP) Receive Data Bank 1 (only used by endpoints with ping-pong attributes). +AT91C_UDP_DIR EQU (0x1:SHL:7) ;- (UDP) Transfer Direction +AT91C_UDP_EPTYPE EQU (0x7:SHL:8) ;- (UDP) Endpoint type +AT91C_UDP_EPTYPE_CTRL EQU (0x0:SHL:8) ;- (UDP) Control +AT91C_UDP_EPTYPE_ISO_OUT EQU (0x1:SHL:8) ;- (UDP) Isochronous OUT +AT91C_UDP_EPTYPE_BULK_OUT EQU (0x2:SHL:8) ;- (UDP) Bulk OUT +AT91C_UDP_EPTYPE_INT_OUT EQU (0x3:SHL:8) ;- (UDP) Interrupt OUT +AT91C_UDP_EPTYPE_ISO_IN EQU (0x5:SHL:8) ;- (UDP) Isochronous IN +AT91C_UDP_EPTYPE_BULK_IN EQU (0x6:SHL:8) ;- (UDP) Bulk IN +AT91C_UDP_EPTYPE_INT_IN EQU (0x7:SHL:8) ;- (UDP) Interrupt IN +AT91C_UDP_DTGLE EQU (0x1:SHL:11) ;- (UDP) Data Toggle +AT91C_UDP_EPEDS EQU (0x1:SHL:15) ;- (UDP) Endpoint Enable Disable +AT91C_UDP_RXBYTECNT EQU (0x7FF:SHL:16) ;- (UDP) Number Of Bytes Available in the FIFO +;- -------- UDP_TXVC : (UDP Offset: 0x74) Transceiver Control Register -------- +AT91C_UDP_TXVDIS EQU (0x1:SHL:8) ;- (UDP) +AT91C_UDP_PUON EQU (0x1:SHL:9) ;- (UDP) Pull-up ON + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Timer Counter Channel Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_TC +TC_CCR # 4 ;- Channel Control Register +TC_CMR # 4 ;- Channel Mode Register (Capture Mode / Waveform Mode) + # 8 ;- Reserved +TC_CV # 4 ;- Counter Value +TC_RA # 4 ;- Register A +TC_RB # 4 ;- Register B +TC_RC # 4 ;- Register C +TC_SR # 4 ;- Status Register +TC_IER # 4 ;- Interrupt Enable Register +TC_IDR # 4 ;- Interrupt Disable Register +TC_IMR # 4 ;- Interrupt Mask Register +;- -------- TC_CCR : (TC Offset: 0x0) TC Channel Control Register -------- +AT91C_TC_CLKEN EQU (0x1:SHL:0) ;- (TC) Counter Clock Enable Command +AT91C_TC_CLKDIS EQU (0x1:SHL:1) ;- (TC) Counter Clock Disable Command +AT91C_TC_SWTRG EQU (0x1:SHL:2) ;- (TC) Software Trigger Command +;- -------- TC_CMR : (TC Offset: 0x4) TC Channel Mode Register: Capture Mode / Waveform Mode -------- +AT91C_TC_CLKS EQU (0x7:SHL:0) ;- (TC) Clock Selection +AT91C_TC_CLKS_TIMER_DIV1_CLOCK EQU (0x0) ;- (TC) Clock selected: TIMER_DIV1_CLOCK +AT91C_TC_CLKS_TIMER_DIV2_CLOCK EQU (0x1) ;- (TC) Clock selected: TIMER_DIV2_CLOCK +AT91C_TC_CLKS_TIMER_DIV3_CLOCK EQU (0x2) ;- (TC) Clock selected: TIMER_DIV3_CLOCK +AT91C_TC_CLKS_TIMER_DIV4_CLOCK EQU (0x3) ;- (TC) Clock selected: TIMER_DIV4_CLOCK +AT91C_TC_CLKS_TIMER_DIV5_CLOCK EQU (0x4) ;- (TC) Clock selected: TIMER_DIV5_CLOCK +AT91C_TC_CLKS_XC0 EQU (0x5) ;- (TC) Clock selected: XC0 +AT91C_TC_CLKS_XC1 EQU (0x6) ;- (TC) Clock selected: XC1 +AT91C_TC_CLKS_XC2 EQU (0x7) ;- (TC) Clock selected: XC2 +AT91C_TC_CLKI EQU (0x1:SHL:3) ;- (TC) Clock Invert +AT91C_TC_BURST EQU (0x3:SHL:4) ;- (TC) Burst Signal Selection +AT91C_TC_BURST_NONE EQU (0x0:SHL:4) ;- (TC) The clock is not gated by an external signal +AT91C_TC_BURST_XC0 EQU (0x1:SHL:4) ;- (TC) XC0 is ANDed with the selected clock +AT91C_TC_BURST_XC1 EQU (0x2:SHL:4) ;- (TC) XC1 is ANDed with the selected clock +AT91C_TC_BURST_XC2 EQU (0x3:SHL:4) ;- (TC) XC2 is ANDed with the selected clock +AT91C_TC_CPCSTOP EQU (0x1:SHL:6) ;- (TC) Counter Clock Stopped with RC Compare +AT91C_TC_LDBSTOP EQU (0x1:SHL:6) ;- (TC) Counter Clock Stopped with RB Loading +AT91C_TC_CPCDIS EQU (0x1:SHL:7) ;- (TC) Counter Clock Disable with RC Compare +AT91C_TC_LDBDIS EQU (0x1:SHL:7) ;- (TC) Counter Clock Disabled with RB Loading +AT91C_TC_ETRGEDG EQU (0x3:SHL:8) ;- (TC) External Trigger Edge Selection +AT91C_TC_ETRGEDG_NONE EQU (0x0:SHL:8) ;- (TC) Edge: None +AT91C_TC_ETRGEDG_RISING EQU (0x1:SHL:8) ;- (TC) Edge: rising edge +AT91C_TC_ETRGEDG_FALLING EQU (0x2:SHL:8) ;- (TC) Edge: falling edge +AT91C_TC_ETRGEDG_BOTH EQU (0x3:SHL:8) ;- (TC) Edge: each edge +AT91C_TC_EEVTEDG EQU (0x3:SHL:8) ;- (TC) External Event Edge Selection +AT91C_TC_EEVTEDG_NONE EQU (0x0:SHL:8) ;- (TC) Edge: None +AT91C_TC_EEVTEDG_RISING EQU (0x1:SHL:8) ;- (TC) Edge: rising edge +AT91C_TC_EEVTEDG_FALLING EQU (0x2:SHL:8) ;- (TC) Edge: falling edge +AT91C_TC_EEVTEDG_BOTH EQU (0x3:SHL:8) ;- (TC) Edge: each edge +AT91C_TC_EEVT EQU (0x3:SHL:10) ;- (TC) External Event Selection +AT91C_TC_EEVT_TIOB EQU (0x0:SHL:10) ;- (TC) Signal selected as external event: TIOB TIOB direction: input +AT91C_TC_EEVT_XC0 EQU (0x1:SHL:10) ;- (TC) Signal selected as external event: XC0 TIOB direction: output +AT91C_TC_EEVT_XC1 EQU (0x2:SHL:10) ;- (TC) Signal selected as external event: XC1 TIOB direction: output +AT91C_TC_EEVT_XC2 EQU (0x3:SHL:10) ;- (TC) Signal selected as external event: XC2 TIOB direction: output +AT91C_TC_ABETRG EQU (0x1:SHL:10) ;- (TC) TIOA or TIOB External Trigger Selection +AT91C_TC_ENETRG EQU (0x1:SHL:12) ;- (TC) External Event Trigger enable +AT91C_TC_WAVESEL EQU (0x3:SHL:13) ;- (TC) Waveform Selection +AT91C_TC_WAVESEL_UP EQU (0x0:SHL:13) ;- (TC) UP mode without atomatic trigger on RC Compare +AT91C_TC_WAVESEL_UPDOWN EQU (0x1:SHL:13) ;- (TC) UPDOWN mode without automatic trigger on RC Compare +AT91C_TC_WAVESEL_UP_AUTO EQU (0x2:SHL:13) ;- (TC) UP mode with automatic trigger on RC Compare +AT91C_TC_WAVESEL_UPDOWN_AUTO EQU (0x3:SHL:13) ;- (TC) UPDOWN mode with automatic trigger on RC Compare +AT91C_TC_CPCTRG EQU (0x1:SHL:14) ;- (TC) RC Compare Trigger Enable +AT91C_TC_WAVE EQU (0x1:SHL:15) ;- (TC) +AT91C_TC_ACPA EQU (0x3:SHL:16) ;- (TC) RA Compare Effect on TIOA +AT91C_TC_ACPA_NONE EQU (0x0:SHL:16) ;- (TC) Effect: none +AT91C_TC_ACPA_SET EQU (0x1:SHL:16) ;- (TC) Effect: set +AT91C_TC_ACPA_CLEAR EQU (0x2:SHL:16) ;- (TC) Effect: clear +AT91C_TC_ACPA_TOGGLE EQU (0x3:SHL:16) ;- (TC) Effect: toggle +AT91C_TC_LDRA EQU (0x3:SHL:16) ;- (TC) RA Loading Selection +AT91C_TC_LDRA_NONE EQU (0x0:SHL:16) ;- (TC) Edge: None +AT91C_TC_LDRA_RISING EQU (0x1:SHL:16) ;- (TC) Edge: rising edge of TIOA +AT91C_TC_LDRA_FALLING EQU (0x2:SHL:16) ;- (TC) Edge: falling edge of TIOA +AT91C_TC_LDRA_BOTH EQU (0x3:SHL:16) ;- (TC) Edge: each edge of TIOA +AT91C_TC_ACPC EQU (0x3:SHL:18) ;- (TC) RC Compare Effect on TIOA +AT91C_TC_ACPC_NONE EQU (0x0:SHL:18) ;- (TC) Effect: none +AT91C_TC_ACPC_SET EQU (0x1:SHL:18) ;- (TC) Effect: set +AT91C_TC_ACPC_CLEAR EQU (0x2:SHL:18) ;- (TC) Effect: clear +AT91C_TC_ACPC_TOGGLE EQU (0x3:SHL:18) ;- (TC) Effect: toggle +AT91C_TC_LDRB EQU (0x3:SHL:18) ;- (TC) RB Loading Selection +AT91C_TC_LDRB_NONE EQU (0x0:SHL:18) ;- (TC) Edge: None +AT91C_TC_LDRB_RISING EQU (0x1:SHL:18) ;- (TC) Edge: rising edge of TIOA +AT91C_TC_LDRB_FALLING EQU (0x2:SHL:18) ;- (TC) Edge: falling edge of TIOA +AT91C_TC_LDRB_BOTH EQU (0x3:SHL:18) ;- (TC) Edge: each edge of TIOA +AT91C_TC_AEEVT EQU (0x3:SHL:20) ;- (TC) External Event Effect on TIOA +AT91C_TC_AEEVT_NONE EQU (0x0:SHL:20) ;- (TC) Effect: none +AT91C_TC_AEEVT_SET EQU (0x1:SHL:20) ;- (TC) Effect: set +AT91C_TC_AEEVT_CLEAR EQU (0x2:SHL:20) ;- (TC) Effect: clear +AT91C_TC_AEEVT_TOGGLE EQU (0x3:SHL:20) ;- (TC) Effect: toggle +AT91C_TC_ASWTRG EQU (0x3:SHL:22) ;- (TC) Software Trigger Effect on TIOA +AT91C_TC_ASWTRG_NONE EQU (0x0:SHL:22) ;- (TC) Effect: none +AT91C_TC_ASWTRG_SET EQU (0x1:SHL:22) ;- (TC) Effect: set +AT91C_TC_ASWTRG_CLEAR EQU (0x2:SHL:22) ;- (TC) Effect: clear +AT91C_TC_ASWTRG_TOGGLE EQU (0x3:SHL:22) ;- (TC) Effect: toggle +AT91C_TC_BCPB EQU (0x3:SHL:24) ;- (TC) RB Compare Effect on TIOB +AT91C_TC_BCPB_NONE EQU (0x0:SHL:24) ;- (TC) Effect: none +AT91C_TC_BCPB_SET EQU (0x1:SHL:24) ;- (TC) Effect: set +AT91C_TC_BCPB_CLEAR EQU (0x2:SHL:24) ;- (TC) Effect: clear +AT91C_TC_BCPB_TOGGLE EQU (0x3:SHL:24) ;- (TC) Effect: toggle +AT91C_TC_BCPC EQU (0x3:SHL:26) ;- (TC) RC Compare Effect on TIOB +AT91C_TC_BCPC_NONE EQU (0x0:SHL:26) ;- (TC) Effect: none +AT91C_TC_BCPC_SET EQU (0x1:SHL:26) ;- (TC) Effect: set +AT91C_TC_BCPC_CLEAR EQU (0x2:SHL:26) ;- (TC) Effect: clear +AT91C_TC_BCPC_TOGGLE EQU (0x3:SHL:26) ;- (TC) Effect: toggle +AT91C_TC_BEEVT EQU (0x3:SHL:28) ;- (TC) External Event Effect on TIOB +AT91C_TC_BEEVT_NONE EQU (0x0:SHL:28) ;- (TC) Effect: none +AT91C_TC_BEEVT_SET EQU (0x1:SHL:28) ;- (TC) Effect: set +AT91C_TC_BEEVT_CLEAR EQU (0x2:SHL:28) ;- (TC) Effect: clear +AT91C_TC_BEEVT_TOGGLE EQU (0x3:SHL:28) ;- (TC) Effect: toggle +AT91C_TC_BSWTRG EQU (0x3:SHL:30) ;- (TC) Software Trigger Effect on TIOB +AT91C_TC_BSWTRG_NONE EQU (0x0:SHL:30) ;- (TC) Effect: none +AT91C_TC_BSWTRG_SET EQU (0x1:SHL:30) ;- (TC) Effect: set +AT91C_TC_BSWTRG_CLEAR EQU (0x2:SHL:30) ;- (TC) Effect: clear +AT91C_TC_BSWTRG_TOGGLE EQU (0x3:SHL:30) ;- (TC) Effect: toggle +;- -------- TC_SR : (TC Offset: 0x20) TC Channel Status Register -------- +AT91C_TC_COVFS EQU (0x1:SHL:0) ;- (TC) Counter Overflow +AT91C_TC_LOVRS EQU (0x1:SHL:1) ;- (TC) Load Overrun +AT91C_TC_CPAS EQU (0x1:SHL:2) ;- (TC) RA Compare +AT91C_TC_CPBS EQU (0x1:SHL:3) ;- (TC) RB Compare +AT91C_TC_CPCS EQU (0x1:SHL:4) ;- (TC) RC Compare +AT91C_TC_LDRAS EQU (0x1:SHL:5) ;- (TC) RA Loading +AT91C_TC_LDRBS EQU (0x1:SHL:6) ;- (TC) RB Loading +AT91C_TC_ETRGS EQU (0x1:SHL:7) ;- (TC) External Trigger +AT91C_TC_CLKSTA EQU (0x1:SHL:16) ;- (TC) Clock Enabling +AT91C_TC_MTIOA EQU (0x1:SHL:17) ;- (TC) TIOA Mirror +AT91C_TC_MTIOB EQU (0x1:SHL:18) ;- (TC) TIOA Mirror +;- -------- TC_IER : (TC Offset: 0x24) TC Channel Interrupt Enable Register -------- +;- -------- TC_IDR : (TC Offset: 0x28) TC Channel Interrupt Disable Register -------- +;- -------- TC_IMR : (TC Offset: 0x2c) TC Channel Interrupt Mask Register -------- + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Timer Counter Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_TCB +TCB_TC0 # 48 ;- TC Channel 0 + # 16 ;- Reserved +TCB_TC1 # 48 ;- TC Channel 1 + # 16 ;- Reserved +TCB_TC2 # 48 ;- TC Channel 2 + # 16 ;- Reserved +TCB_BCR # 4 ;- TC Block Control Register +TCB_BMR # 4 ;- TC Block Mode Register +;- -------- TCB_BCR : (TCB Offset: 0xc0) TC Block Control Register -------- +AT91C_TCB_SYNC EQU (0x1:SHL:0) ;- (TCB) Synchro Command +;- -------- TCB_BMR : (TCB Offset: 0xc4) TC Block Mode Register -------- +AT91C_TCB_TC0XC0S EQU (0x3:SHL:0) ;- (TCB) External Clock Signal 0 Selection +AT91C_TCB_TC0XC0S_TCLK0 EQU (0x0) ;- (TCB) TCLK0 connected to XC0 +AT91C_TCB_TC0XC0S_NONE EQU (0x1) ;- (TCB) None signal connected to XC0 +AT91C_TCB_TC0XC0S_TIOA1 EQU (0x2) ;- (TCB) TIOA1 connected to XC0 +AT91C_TCB_TC0XC0S_TIOA2 EQU (0x3) ;- (TCB) TIOA2 connected to XC0 +AT91C_TCB_TC1XC1S EQU (0x3:SHL:2) ;- (TCB) External Clock Signal 1 Selection +AT91C_TCB_TC1XC1S_TCLK1 EQU (0x0:SHL:2) ;- (TCB) TCLK1 connected to XC1 +AT91C_TCB_TC1XC1S_NONE EQU (0x1:SHL:2) ;- (TCB) None signal connected to XC1 +AT91C_TCB_TC1XC1S_TIOA0 EQU (0x2:SHL:2) ;- (TCB) TIOA0 connected to XC1 +AT91C_TCB_TC1XC1S_TIOA2 EQU (0x3:SHL:2) ;- (TCB) TIOA2 connected to XC1 +AT91C_TCB_TC2XC2S EQU (0x3:SHL:4) ;- (TCB) External Clock Signal 2 Selection +AT91C_TCB_TC2XC2S_TCLK2 EQU (0x0:SHL:4) ;- (TCB) TCLK2 connected to XC2 +AT91C_TCB_TC2XC2S_NONE EQU (0x1:SHL:4) ;- (TCB) None signal connected to XC2 +AT91C_TCB_TC2XC2S_TIOA0 EQU (0x2:SHL:4) ;- (TCB) TIOA0 connected to XC2 +AT91C_TCB_TC2XC2S_TIOA1 EQU (0x3:SHL:4) ;- (TCB) TIOA2 connected to XC2 + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Control Area Network MailBox Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_CAN_MB +CAN_MB_MMR # 4 ;- MailBox Mode Register +CAN_MB_MAM # 4 ;- MailBox Acceptance Mask Register +CAN_MB_MID # 4 ;- MailBox ID Register +CAN_MB_MFID # 4 ;- MailBox Family ID Register +CAN_MB_MSR # 4 ;- MailBox Status Register +CAN_MB_MDL # 4 ;- MailBox Data Low Register +CAN_MB_MDH # 4 ;- MailBox Data High Register +CAN_MB_MCR # 4 ;- MailBox Control Register +;- -------- CAN_MMR : (CAN_MB Offset: 0x0) CAN Message Mode Register -------- +AT91C_CAN_MTIMEMARK EQU (0xFFFF:SHL:0) ;- (CAN_MB) Mailbox Timemark +AT91C_CAN_PRIOR EQU (0xF:SHL:16) ;- (CAN_MB) Mailbox Priority +AT91C_CAN_MOT EQU (0x7:SHL:24) ;- (CAN_MB) Mailbox Object Type +AT91C_CAN_MOT_DIS EQU (0x0:SHL:24) ;- (CAN_MB) +AT91C_CAN_MOT_RX EQU (0x1:SHL:24) ;- (CAN_MB) +AT91C_CAN_MOT_RXOVERWRITE EQU (0x2:SHL:24) ;- (CAN_MB) +AT91C_CAN_MOT_TX EQU (0x3:SHL:24) ;- (CAN_MB) +AT91C_CAN_MOT_CONSUMER EQU (0x4:SHL:24) ;- (CAN_MB) +AT91C_CAN_MOT_PRODUCER EQU (0x5:SHL:24) ;- (CAN_MB) +;- -------- CAN_MAM : (CAN_MB Offset: 0x4) CAN Message Acceptance Mask Register -------- +AT91C_CAN_MIDvB EQU (0x3FFFF:SHL:0) ;- (CAN_MB) Complementary bits for identifier in extended mode +AT91C_CAN_MIDvA EQU (0x7FF:SHL:18) ;- (CAN_MB) Identifier for standard frame mode +AT91C_CAN_MIDE EQU (0x1:SHL:29) ;- (CAN_MB) Identifier Version +;- -------- CAN_MID : (CAN_MB Offset: 0x8) CAN Message ID Register -------- +;- -------- CAN_MFID : (CAN_MB Offset: 0xc) CAN Message Family ID Register -------- +;- -------- CAN_MSR : (CAN_MB Offset: 0x10) CAN Message Status Register -------- +AT91C_CAN_MTIMESTAMP EQU (0xFFFF:SHL:0) ;- (CAN_MB) Timer Value +AT91C_CAN_MDLC EQU (0xF:SHL:16) ;- (CAN_MB) Mailbox Data Length Code +AT91C_CAN_MRTR EQU (0x1:SHL:20) ;- (CAN_MB) Mailbox Remote Transmission Request +AT91C_CAN_MABT EQU (0x1:SHL:22) ;- (CAN_MB) Mailbox Message Abort +AT91C_CAN_MRDY EQU (0x1:SHL:23) ;- (CAN_MB) Mailbox Ready +AT91C_CAN_MMI EQU (0x1:SHL:24) ;- (CAN_MB) Mailbox Message Ignored +;- -------- CAN_MDL : (CAN_MB Offset: 0x14) CAN Message Data Low Register -------- +;- -------- CAN_MDH : (CAN_MB Offset: 0x18) CAN Message Data High Register -------- +;- -------- CAN_MCR : (CAN_MB Offset: 0x1c) CAN Message Control Register -------- +AT91C_CAN_MACR EQU (0x1:SHL:22) ;- (CAN_MB) Abort Request for Mailbox +AT91C_CAN_MTCR EQU (0x1:SHL:23) ;- (CAN_MB) Mailbox Transfer Command + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Control Area Network Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_CAN +CAN_MR # 4 ;- Mode Register +CAN_IER # 4 ;- Interrupt Enable Register +CAN_IDR # 4 ;- Interrupt Disable Register +CAN_IMR # 4 ;- Interrupt Mask Register +CAN_SR # 4 ;- Status Register +CAN_BR # 4 ;- Baudrate Register +CAN_TIM # 4 ;- Timer Register +CAN_TIMESTP # 4 ;- Time Stamp Register +CAN_ECR # 4 ;- Error Counter Register +CAN_TCR # 4 ;- Transfer Command Register +CAN_ACR # 4 ;- Abort Command Register + # 208 ;- Reserved +CAN_VR # 4 ;- Version Register + # 256 ;- Reserved +CAN_MB0 # 32 ;- CAN Mailbox 0 +CAN_MB1 # 32 ;- CAN Mailbox 1 +CAN_MB2 # 32 ;- CAN Mailbox 2 +CAN_MB3 # 32 ;- CAN Mailbox 3 +CAN_MB4 # 32 ;- CAN Mailbox 4 +CAN_MB5 # 32 ;- CAN Mailbox 5 +CAN_MB6 # 32 ;- CAN Mailbox 6 +CAN_MB7 # 32 ;- CAN Mailbox 7 +CAN_MB8 # 32 ;- CAN Mailbox 8 +CAN_MB9 # 32 ;- CAN Mailbox 9 +CAN_MB10 # 32 ;- CAN Mailbox 10 +CAN_MB11 # 32 ;- CAN Mailbox 11 +CAN_MB12 # 32 ;- CAN Mailbox 12 +CAN_MB13 # 32 ;- CAN Mailbox 13 +CAN_MB14 # 32 ;- CAN Mailbox 14 +CAN_MB15 # 32 ;- CAN Mailbox 15 +;- -------- CAN_MR : (CAN Offset: 0x0) CAN Mode Register -------- +AT91C_CAN_CANEN EQU (0x1:SHL:0) ;- (CAN) CAN Controller Enable +AT91C_CAN_LPM EQU (0x1:SHL:1) ;- (CAN) Disable/Enable Low Power Mode +AT91C_CAN_ABM EQU (0x1:SHL:2) ;- (CAN) Disable/Enable Autobaud/Listen Mode +AT91C_CAN_OVL EQU (0x1:SHL:3) ;- (CAN) Disable/Enable Overload Frame +AT91C_CAN_TEOF EQU (0x1:SHL:4) ;- (CAN) Time Stamp messages at each end of Frame +AT91C_CAN_TTM EQU (0x1:SHL:5) ;- (CAN) Disable/Enable Time Trigger Mode +AT91C_CAN_TIMFRZ EQU (0x1:SHL:6) ;- (CAN) Enable Timer Freeze +AT91C_CAN_DRPT EQU (0x1:SHL:7) ;- (CAN) Disable Repeat +;- -------- CAN_IER : (CAN Offset: 0x4) CAN Interrupt Enable Register -------- +AT91C_CAN_MB0 EQU (0x1:SHL:0) ;- (CAN) Mailbox 0 Flag +AT91C_CAN_MB1 EQU (0x1:SHL:1) ;- (CAN) Mailbox 1 Flag +AT91C_CAN_MB2 EQU (0x1:SHL:2) ;- (CAN) Mailbox 2 Flag +AT91C_CAN_MB3 EQU (0x1:SHL:3) ;- (CAN) Mailbox 3 Flag +AT91C_CAN_MB4 EQU (0x1:SHL:4) ;- (CAN) Mailbox 4 Flag +AT91C_CAN_MB5 EQU (0x1:SHL:5) ;- (CAN) Mailbox 5 Flag +AT91C_CAN_MB6 EQU (0x1:SHL:6) ;- (CAN) Mailbox 6 Flag +AT91C_CAN_MB7 EQU (0x1:SHL:7) ;- (CAN) Mailbox 7 Flag +AT91C_CAN_MB8 EQU (0x1:SHL:8) ;- (CAN) Mailbox 8 Flag +AT91C_CAN_MB9 EQU (0x1:SHL:9) ;- (CAN) Mailbox 9 Flag +AT91C_CAN_MB10 EQU (0x1:SHL:10) ;- (CAN) Mailbox 10 Flag +AT91C_CAN_MB11 EQU (0x1:SHL:11) ;- (CAN) Mailbox 11 Flag +AT91C_CAN_MB12 EQU (0x1:SHL:12) ;- (CAN) Mailbox 12 Flag +AT91C_CAN_MB13 EQU (0x1:SHL:13) ;- (CAN) Mailbox 13 Flag +AT91C_CAN_MB14 EQU (0x1:SHL:14) ;- (CAN) Mailbox 14 Flag +AT91C_CAN_MB15 EQU (0x1:SHL:15) ;- (CAN) Mailbox 15 Flag +AT91C_CAN_ERRA EQU (0x1:SHL:16) ;- (CAN) Error Active Mode Flag +AT91C_CAN_WARN EQU (0x1:SHL:17) ;- (CAN) Warning Limit Flag +AT91C_CAN_ERRP EQU (0x1:SHL:18) ;- (CAN) Error Passive Mode Flag +AT91C_CAN_BOFF EQU (0x1:SHL:19) ;- (CAN) Bus Off Mode Flag +AT91C_CAN_SLEEP EQU (0x1:SHL:20) ;- (CAN) Sleep Flag +AT91C_CAN_WAKEUP EQU (0x1:SHL:21) ;- (CAN) Wakeup Flag +AT91C_CAN_TOVF EQU (0x1:SHL:22) ;- (CAN) Timer Overflow Flag +AT91C_CAN_TSTP EQU (0x1:SHL:23) ;- (CAN) Timestamp Flag +AT91C_CAN_CERR EQU (0x1:SHL:24) ;- (CAN) CRC Error +AT91C_CAN_SERR EQU (0x1:SHL:25) ;- (CAN) Stuffing Error +AT91C_CAN_AERR EQU (0x1:SHL:26) ;- (CAN) Acknowledgment Error +AT91C_CAN_FERR EQU (0x1:SHL:27) ;- (CAN) Form Error +AT91C_CAN_BERR EQU (0x1:SHL:28) ;- (CAN) Bit Error +;- -------- CAN_IDR : (CAN Offset: 0x8) CAN Interrupt Disable Register -------- +;- -------- CAN_IMR : (CAN Offset: 0xc) CAN Interrupt Mask Register -------- +;- -------- CAN_SR : (CAN Offset: 0x10) CAN Status Register -------- +AT91C_CAN_RBSY EQU (0x1:SHL:29) ;- (CAN) Receiver Busy +AT91C_CAN_TBSY EQU (0x1:SHL:30) ;- (CAN) Transmitter Busy +AT91C_CAN_OVLY EQU (0x1:SHL:31) ;- (CAN) Overload Busy +;- -------- CAN_BR : (CAN Offset: 0x14) CAN Baudrate Register -------- +AT91C_CAN_PHASE2 EQU (0x7:SHL:0) ;- (CAN) Phase 2 segment +AT91C_CAN_PHASE1 EQU (0x7:SHL:4) ;- (CAN) Phase 1 segment +AT91C_CAN_PROPAG EQU (0x7:SHL:8) ;- (CAN) Programmation time segment +AT91C_CAN_SYNC EQU (0x3:SHL:12) ;- (CAN) Re-synchronization jump width segment +AT91C_CAN_BRP EQU (0x7F:SHL:16) ;- (CAN) Baudrate Prescaler +AT91C_CAN_SMP EQU (0x1:SHL:24) ;- (CAN) Sampling mode +;- -------- CAN_TIM : (CAN Offset: 0x18) CAN Timer Register -------- +AT91C_CAN_TIMER EQU (0xFFFF:SHL:0) ;- (CAN) Timer field +;- -------- CAN_TIMESTP : (CAN Offset: 0x1c) CAN Timestamp Register -------- +;- -------- CAN_ECR : (CAN Offset: 0x20) CAN Error Counter Register -------- +AT91C_CAN_REC EQU (0xFF:SHL:0) ;- (CAN) Receive Error Counter +AT91C_CAN_TEC EQU (0xFF:SHL:16) ;- (CAN) Transmit Error Counter +;- -------- CAN_TCR : (CAN Offset: 0x24) CAN Transfer Command Register -------- +AT91C_CAN_TIMRST EQU (0x1:SHL:31) ;- (CAN) Timer Reset Field +;- -------- CAN_ACR : (CAN Offset: 0x28) CAN Abort Command Register -------- + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Ethernet MAC 10/100 +;- ***************************************************************************** + ^ 0 ;- AT91S_EMAC +EMAC_NCR # 4 ;- Network Control Register +EMAC_NCFGR # 4 ;- Network Configuration Register +EMAC_NSR # 4 ;- Network Status Register + # 8 ;- Reserved +EMAC_TSR # 4 ;- Transmit Status Register +EMAC_RBQP # 4 ;- Receive Buffer Queue Pointer +EMAC_TBQP # 4 ;- Transmit Buffer Queue Pointer +EMAC_RSR # 4 ;- Receive Status Register +EMAC_ISR # 4 ;- Interrupt Status Register +EMAC_IER # 4 ;- Interrupt Enable Register +EMAC_IDR # 4 ;- Interrupt Disable Register +EMAC_IMR # 4 ;- Interrupt Mask Register +EMAC_MAN # 4 ;- PHY Maintenance Register +EMAC_PTR # 4 ;- Pause Time Register +EMAC_PFR # 4 ;- Pause Frames received Register +EMAC_FTO # 4 ;- Frames Transmitted OK Register +EMAC_SCF # 4 ;- Single Collision Frame Register +EMAC_MCF # 4 ;- Multiple Collision Frame Register +EMAC_FRO # 4 ;- Frames Received OK Register +EMAC_FCSE # 4 ;- Frame Check Sequence Error Register +EMAC_ALE # 4 ;- Alignment Error Register +EMAC_DTF # 4 ;- Deferred Transmission Frame Register +EMAC_LCOL # 4 ;- Late Collision Register +EMAC_ECOL # 4 ;- Excessive Collision Register +EMAC_TUND # 4 ;- Transmit Underrun Error Register +EMAC_CSE # 4 ;- Carrier Sense Error Register +EMAC_RRE # 4 ;- Receive Ressource Error Register +EMAC_ROV # 4 ;- Receive Overrun Errors Register +EMAC_RSE # 4 ;- Receive Symbol Errors Register +EMAC_ELE # 4 ;- Excessive Length Errors Register +EMAC_RJA # 4 ;- Receive Jabbers Register +EMAC_USF # 4 ;- Undersize Frames Register +EMAC_STE # 4 ;- SQE Test Error Register +EMAC_RLE # 4 ;- Receive Length Field Mismatch Register +EMAC_TPF # 4 ;- Transmitted Pause Frames Register +EMAC_HRB # 4 ;- Hash Address Bottom[31:0] +EMAC_HRT # 4 ;- Hash Address Top[63:32] +EMAC_SA1L # 4 ;- Specific Address 1 Bottom, First 4 bytes +EMAC_SA1H # 4 ;- Specific Address 1 Top, Last 2 bytes +EMAC_SA2L # 4 ;- Specific Address 2 Bottom, First 4 bytes +EMAC_SA2H # 4 ;- Specific Address 2 Top, Last 2 bytes +EMAC_SA3L # 4 ;- Specific Address 3 Bottom, First 4 bytes +EMAC_SA3H # 4 ;- Specific Address 3 Top, Last 2 bytes +EMAC_SA4L # 4 ;- Specific Address 4 Bottom, First 4 bytes +EMAC_SA4H # 4 ;- Specific Address 4 Top, Last 2 bytes +EMAC_TID # 4 ;- Type ID Checking Register +EMAC_TPQ # 4 ;- Transmit Pause Quantum Register +EMAC_USRIO # 4 ;- USER Input/Output Register +EMAC_WOL # 4 ;- Wake On LAN Register + # 52 ;- Reserved +EMAC_REV # 4 ;- Revision Register +;- -------- EMAC_NCR : (EMAC Offset: 0x0) -------- +AT91C_EMAC_LB EQU (0x1:SHL:0) ;- (EMAC) Loopback. Optional. When set, loopback signal is at high level. +AT91C_EMAC_LLB EQU (0x1:SHL:1) ;- (EMAC) Loopback local. +AT91C_EMAC_RE EQU (0x1:SHL:2) ;- (EMAC) Receive enable. +AT91C_EMAC_TE EQU (0x1:SHL:3) ;- (EMAC) Transmit enable. +AT91C_EMAC_MPE EQU (0x1:SHL:4) ;- (EMAC) Management port enable. +AT91C_EMAC_CLRSTAT EQU (0x1:SHL:5) ;- (EMAC) Clear statistics registers. +AT91C_EMAC_INCSTAT EQU (0x1:SHL:6) ;- (EMAC) Increment statistics registers. +AT91C_EMAC_WESTAT EQU (0x1:SHL:7) ;- (EMAC) Write enable for statistics registers. +AT91C_EMAC_BP EQU (0x1:SHL:8) ;- (EMAC) Back pressure. +AT91C_EMAC_TSTART EQU (0x1:SHL:9) ;- (EMAC) Start Transmission. +AT91C_EMAC_THALT EQU (0x1:SHL:10) ;- (EMAC) Transmission Halt. +AT91C_EMAC_TPFR EQU (0x1:SHL:11) ;- (EMAC) Transmit pause frame +AT91C_EMAC_TZQ EQU (0x1:SHL:12) ;- (EMAC) Transmit zero quantum pause frame +;- -------- EMAC_NCFGR : (EMAC Offset: 0x4) Network Configuration Register -------- +AT91C_EMAC_SPD EQU (0x1:SHL:0) ;- (EMAC) Speed. +AT91C_EMAC_FD EQU (0x1:SHL:1) ;- (EMAC) Full duplex. +AT91C_EMAC_JFRAME EQU (0x1:SHL:3) ;- (EMAC) Jumbo Frames. +AT91C_EMAC_CAF EQU (0x1:SHL:4) ;- (EMAC) Copy all frames. +AT91C_EMAC_NBC EQU (0x1:SHL:5) ;- (EMAC) No broadcast. +AT91C_EMAC_MTI EQU (0x1:SHL:6) ;- (EMAC) Multicast hash event enable +AT91C_EMAC_UNI EQU (0x1:SHL:7) ;- (EMAC) Unicast hash enable. +AT91C_EMAC_BIG EQU (0x1:SHL:8) ;- (EMAC) Receive 1522 bytes. +AT91C_EMAC_EAE EQU (0x1:SHL:9) ;- (EMAC) External address match enable. +AT91C_EMAC_CLK EQU (0x3:SHL:10) ;- (EMAC) +AT91C_EMAC_CLK_HCLK_8 EQU (0x0:SHL:10) ;- (EMAC) HCLK divided by 8 +AT91C_EMAC_CLK_HCLK_16 EQU (0x1:SHL:10) ;- (EMAC) HCLK divided by 16 +AT91C_EMAC_CLK_HCLK_32 EQU (0x2:SHL:10) ;- (EMAC) HCLK divided by 32 +AT91C_EMAC_CLK_HCLK_64 EQU (0x3:SHL:10) ;- (EMAC) HCLK divided by 64 +AT91C_EMAC_RTY EQU (0x1:SHL:12) ;- (EMAC) +AT91C_EMAC_PAE EQU (0x1:SHL:13) ;- (EMAC) +AT91C_EMAC_RBOF EQU (0x3:SHL:14) ;- (EMAC) +AT91C_EMAC_RBOF_OFFSET_0 EQU (0x0:SHL:14) ;- (EMAC) no offset from start of receive buffer +AT91C_EMAC_RBOF_OFFSET_1 EQU (0x1:SHL:14) ;- (EMAC) one byte offset from start of receive buffer +AT91C_EMAC_RBOF_OFFSET_2 EQU (0x2:SHL:14) ;- (EMAC) two bytes offset from start of receive buffer +AT91C_EMAC_RBOF_OFFSET_3 EQU (0x3:SHL:14) ;- (EMAC) three bytes offset from start of receive buffer +AT91C_EMAC_RLCE EQU (0x1:SHL:16) ;- (EMAC) Receive Length field Checking Enable +AT91C_EMAC_DRFCS EQU (0x1:SHL:17) ;- (EMAC) Discard Receive FCS +AT91C_EMAC_EFRHD EQU (0x1:SHL:18) ;- (EMAC) +AT91C_EMAC_IRXFCS EQU (0x1:SHL:19) ;- (EMAC) Ignore RX FCS +;- -------- EMAC_NSR : (EMAC Offset: 0x8) Network Status Register -------- +AT91C_EMAC_LINKR EQU (0x1:SHL:0) ;- (EMAC) +AT91C_EMAC_MDIO EQU (0x1:SHL:1) ;- (EMAC) +AT91C_EMAC_IDLE EQU (0x1:SHL:2) ;- (EMAC) +;- -------- EMAC_TSR : (EMAC Offset: 0x14) Transmit Status Register -------- +AT91C_EMAC_UBR EQU (0x1:SHL:0) ;- (EMAC) +AT91C_EMAC_COL EQU (0x1:SHL:1) ;- (EMAC) +AT91C_EMAC_RLES EQU (0x1:SHL:2) ;- (EMAC) +AT91C_EMAC_TGO EQU (0x1:SHL:3) ;- (EMAC) Transmit Go +AT91C_EMAC_BEX EQU (0x1:SHL:4) ;- (EMAC) Buffers exhausted mid frame +AT91C_EMAC_COMP EQU (0x1:SHL:5) ;- (EMAC) +AT91C_EMAC_UND EQU (0x1:SHL:6) ;- (EMAC) +;- -------- EMAC_RSR : (EMAC Offset: 0x20) Receive Status Register -------- +AT91C_EMAC_BNA EQU (0x1:SHL:0) ;- (EMAC) +AT91C_EMAC_REC EQU (0x1:SHL:1) ;- (EMAC) +AT91C_EMAC_OVR EQU (0x1:SHL:2) ;- (EMAC) +;- -------- EMAC_ISR : (EMAC Offset: 0x24) Interrupt Status Register -------- +AT91C_EMAC_MFD EQU (0x1:SHL:0) ;- (EMAC) +AT91C_EMAC_RCOMP EQU (0x1:SHL:1) ;- (EMAC) +AT91C_EMAC_RXUBR EQU (0x1:SHL:2) ;- (EMAC) +AT91C_EMAC_TXUBR EQU (0x1:SHL:3) ;- (EMAC) +AT91C_EMAC_TUNDR EQU (0x1:SHL:4) ;- (EMAC) +AT91C_EMAC_RLEX EQU (0x1:SHL:5) ;- (EMAC) +AT91C_EMAC_TXERR EQU (0x1:SHL:6) ;- (EMAC) +AT91C_EMAC_TCOMP EQU (0x1:SHL:7) ;- (EMAC) +AT91C_EMAC_LINK EQU (0x1:SHL:9) ;- (EMAC) +AT91C_EMAC_ROVR EQU (0x1:SHL:10) ;- (EMAC) +AT91C_EMAC_HRESP EQU (0x1:SHL:11) ;- (EMAC) +AT91C_EMAC_PFRE EQU (0x1:SHL:12) ;- (EMAC) +AT91C_EMAC_PTZ EQU (0x1:SHL:13) ;- (EMAC) +;- -------- EMAC_IER : (EMAC Offset: 0x28) Interrupt Enable Register -------- +;- -------- EMAC_IDR : (EMAC Offset: 0x2c) Interrupt Disable Register -------- +;- -------- EMAC_IMR : (EMAC Offset: 0x30) Interrupt Mask Register -------- +;- -------- EMAC_MAN : (EMAC Offset: 0x34) PHY Maintenance Register -------- +AT91C_EMAC_DATA EQU (0xFFFF:SHL:0) ;- (EMAC) +AT91C_EMAC_CODE EQU (0x3:SHL:16) ;- (EMAC) +AT91C_EMAC_REGA EQU (0x1F:SHL:18) ;- (EMAC) +AT91C_EMAC_PHYA EQU (0x1F:SHL:23) ;- (EMAC) +AT91C_EMAC_RW EQU (0x3:SHL:28) ;- (EMAC) +AT91C_EMAC_SOF EQU (0x3:SHL:30) ;- (EMAC) +;- -------- EMAC_USRIO : (EMAC Offset: 0xc0) USER Input Output Register -------- +AT91C_EMAC_RMII EQU (0x1:SHL:0) ;- (EMAC) Reduce MII +AT91C_EMAC_CLKEN EQU (0x1:SHL:1) ;- (EMAC) Clock Enable +;- -------- EMAC_WOL : (EMAC Offset: 0xc4) Wake On LAN Register -------- +AT91C_EMAC_IP EQU (0xFFFF:SHL:0) ;- (EMAC) ARP request IP address +AT91C_EMAC_MAG EQU (0x1:SHL:16) ;- (EMAC) Magic packet event enable +AT91C_EMAC_ARP EQU (0x1:SHL:17) ;- (EMAC) ARP request event enable +AT91C_EMAC_SA1 EQU (0x1:SHL:18) ;- (EMAC) Specific address register 1 event enable +;- -------- EMAC_REV : (EMAC Offset: 0xfc) Revision Register -------- +AT91C_EMAC_REVREF EQU (0xFFFF:SHL:0) ;- (EMAC) +AT91C_EMAC_PARTREF EQU (0xFFFF:SHL:16) ;- (EMAC) + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Analog to Digital Convertor +;- ***************************************************************************** + ^ 0 ;- AT91S_ADC +ADC_CR # 4 ;- ADC Control Register +ADC_MR # 4 ;- ADC Mode Register + # 8 ;- Reserved +ADC_CHER # 4 ;- ADC Channel Enable Register +ADC_CHDR # 4 ;- ADC Channel Disable Register +ADC_CHSR # 4 ;- ADC Channel Status Register +ADC_SR # 4 ;- ADC Status Register +ADC_LCDR # 4 ;- ADC Last Converted Data Register +ADC_IER # 4 ;- ADC Interrupt Enable Register +ADC_IDR # 4 ;- ADC Interrupt Disable Register +ADC_IMR # 4 ;- ADC Interrupt Mask Register +ADC_CDR0 # 4 ;- ADC Channel Data Register 0 +ADC_CDR1 # 4 ;- ADC Channel Data Register 1 +ADC_CDR2 # 4 ;- ADC Channel Data Register 2 +ADC_CDR3 # 4 ;- ADC Channel Data Register 3 +ADC_CDR4 # 4 ;- ADC Channel Data Register 4 +ADC_CDR5 # 4 ;- ADC Channel Data Register 5 +ADC_CDR6 # 4 ;- ADC Channel Data Register 6 +ADC_CDR7 # 4 ;- ADC Channel Data Register 7 + # 176 ;- Reserved +ADC_RPR # 4 ;- Receive Pointer Register +ADC_RCR # 4 ;- Receive Counter Register +ADC_TPR # 4 ;- Transmit Pointer Register +ADC_TCR # 4 ;- Transmit Counter Register +ADC_RNPR # 4 ;- Receive Next Pointer Register +ADC_RNCR # 4 ;- Receive Next Counter Register +ADC_TNPR # 4 ;- Transmit Next Pointer Register +ADC_TNCR # 4 ;- Transmit Next Counter Register +ADC_PTCR # 4 ;- PDC Transfer Control Register +ADC_PTSR # 4 ;- PDC Transfer Status Register +;- -------- ADC_CR : (ADC Offset: 0x0) ADC Control Register -------- +AT91C_ADC_SWRST EQU (0x1:SHL:0) ;- (ADC) Software Reset +AT91C_ADC_START EQU (0x1:SHL:1) ;- (ADC) Start Conversion +;- -------- ADC_MR : (ADC Offset: 0x4) ADC Mode Register -------- +AT91C_ADC_TRGEN EQU (0x1:SHL:0) ;- (ADC) Trigger Enable +AT91C_ADC_TRGEN_DIS EQU (0x0) ;- (ADC) Hradware triggers are disabled. Starting a conversion is only possible by software +AT91C_ADC_TRGEN_EN EQU (0x1) ;- (ADC) Hardware trigger selected by TRGSEL field is enabled. +AT91C_ADC_TRGSEL EQU (0x7:SHL:1) ;- (ADC) Trigger Selection +AT91C_ADC_TRGSEL_TIOA0 EQU (0x0:SHL:1) ;- (ADC) Selected TRGSEL = TIAO0 +AT91C_ADC_TRGSEL_TIOA1 EQU (0x1:SHL:1) ;- (ADC) Selected TRGSEL = TIAO1 +AT91C_ADC_TRGSEL_TIOA2 EQU (0x2:SHL:1) ;- (ADC) Selected TRGSEL = TIAO2 +AT91C_ADC_TRGSEL_TIOA3 EQU (0x3:SHL:1) ;- (ADC) Selected TRGSEL = TIAO3 +AT91C_ADC_TRGSEL_TIOA4 EQU (0x4:SHL:1) ;- (ADC) Selected TRGSEL = TIAO4 +AT91C_ADC_TRGSEL_TIOA5 EQU (0x5:SHL:1) ;- (ADC) Selected TRGSEL = TIAO5 +AT91C_ADC_TRGSEL_EXT EQU (0x6:SHL:1) ;- (ADC) Selected TRGSEL = External Trigger +AT91C_ADC_LOWRES EQU (0x1:SHL:4) ;- (ADC) Resolution. +AT91C_ADC_LOWRES_10_BIT EQU (0x0:SHL:4) ;- (ADC) 10-bit resolution +AT91C_ADC_LOWRES_8_BIT EQU (0x1:SHL:4) ;- (ADC) 8-bit resolution +AT91C_ADC_SLEEP EQU (0x1:SHL:5) ;- (ADC) Sleep Mode +AT91C_ADC_SLEEP_NORMAL_MODE EQU (0x0:SHL:5) ;- (ADC) Normal Mode +AT91C_ADC_SLEEP_MODE EQU (0x1:SHL:5) ;- (ADC) Sleep Mode +AT91C_ADC_PRESCAL EQU (0x3F:SHL:8) ;- (ADC) Prescaler rate selection +AT91C_ADC_STARTUP EQU (0x1F:SHL:16) ;- (ADC) Startup Time +AT91C_ADC_SHTIM EQU (0xF:SHL:24) ;- (ADC) Sample & Hold Time +;- -------- ADC_CHER : (ADC Offset: 0x10) ADC Channel Enable Register -------- +AT91C_ADC_CH0 EQU (0x1:SHL:0) ;- (ADC) Channel 0 +AT91C_ADC_CH1 EQU (0x1:SHL:1) ;- (ADC) Channel 1 +AT91C_ADC_CH2 EQU (0x1:SHL:2) ;- (ADC) Channel 2 +AT91C_ADC_CH3 EQU (0x1:SHL:3) ;- (ADC) Channel 3 +AT91C_ADC_CH4 EQU (0x1:SHL:4) ;- (ADC) Channel 4 +AT91C_ADC_CH5 EQU (0x1:SHL:5) ;- (ADC) Channel 5 +AT91C_ADC_CH6 EQU (0x1:SHL:6) ;- (ADC) Channel 6 +AT91C_ADC_CH7 EQU (0x1:SHL:7) ;- (ADC) Channel 7 +;- -------- ADC_CHDR : (ADC Offset: 0x14) ADC Channel Disable Register -------- +;- -------- ADC_CHSR : (ADC Offset: 0x18) ADC Channel Status Register -------- +;- -------- ADC_SR : (ADC Offset: 0x1c) ADC Status Register -------- +AT91C_ADC_EOC0 EQU (0x1:SHL:0) ;- (ADC) End of Conversion +AT91C_ADC_EOC1 EQU (0x1:SHL:1) ;- (ADC) End of Conversion +AT91C_ADC_EOC2 EQU (0x1:SHL:2) ;- (ADC) End of Conversion +AT91C_ADC_EOC3 EQU (0x1:SHL:3) ;- (ADC) End of Conversion +AT91C_ADC_EOC4 EQU (0x1:SHL:4) ;- (ADC) End of Conversion +AT91C_ADC_EOC5 EQU (0x1:SHL:5) ;- (ADC) End of Conversion +AT91C_ADC_EOC6 EQU (0x1:SHL:6) ;- (ADC) End of Conversion +AT91C_ADC_EOC7 EQU (0x1:SHL:7) ;- (ADC) End of Conversion +AT91C_ADC_OVRE0 EQU (0x1:SHL:8) ;- (ADC) Overrun Error +AT91C_ADC_OVRE1 EQU (0x1:SHL:9) ;- (ADC) Overrun Error +AT91C_ADC_OVRE2 EQU (0x1:SHL:10) ;- (ADC) Overrun Error +AT91C_ADC_OVRE3 EQU (0x1:SHL:11) ;- (ADC) Overrun Error +AT91C_ADC_OVRE4 EQU (0x1:SHL:12) ;- (ADC) Overrun Error +AT91C_ADC_OVRE5 EQU (0x1:SHL:13) ;- (ADC) Overrun Error +AT91C_ADC_OVRE6 EQU (0x1:SHL:14) ;- (ADC) Overrun Error +AT91C_ADC_OVRE7 EQU (0x1:SHL:15) ;- (ADC) Overrun Error +AT91C_ADC_DRDY EQU (0x1:SHL:16) ;- (ADC) Data Ready +AT91C_ADC_GOVRE EQU (0x1:SHL:17) ;- (ADC) General Overrun +AT91C_ADC_ENDRX EQU (0x1:SHL:18) ;- (ADC) End of Receiver Transfer +AT91C_ADC_RXBUFF EQU (0x1:SHL:19) ;- (ADC) RXBUFF Interrupt +;- -------- ADC_LCDR : (ADC Offset: 0x20) ADC Last Converted Data Register -------- +AT91C_ADC_LDATA EQU (0x3FF:SHL:0) ;- (ADC) Last Data Converted +;- -------- ADC_IER : (ADC Offset: 0x24) ADC Interrupt Enable Register -------- +;- -------- ADC_IDR : (ADC Offset: 0x28) ADC Interrupt Disable Register -------- +;- -------- ADC_IMR : (ADC Offset: 0x2c) ADC Interrupt Mask Register -------- +;- -------- ADC_CDR0 : (ADC Offset: 0x30) ADC Channel Data Register 0 -------- +AT91C_ADC_DATA EQU (0x3FF:SHL:0) ;- (ADC) Converted Data +;- -------- ADC_CDR1 : (ADC Offset: 0x34) ADC Channel Data Register 1 -------- +;- -------- ADC_CDR2 : (ADC Offset: 0x38) ADC Channel Data Register 2 -------- +;- -------- ADC_CDR3 : (ADC Offset: 0x3c) ADC Channel Data Register 3 -------- +;- -------- ADC_CDR4 : (ADC Offset: 0x40) ADC Channel Data Register 4 -------- +;- -------- ADC_CDR5 : (ADC Offset: 0x44) ADC Channel Data Register 5 -------- +;- -------- ADC_CDR6 : (ADC Offset: 0x48) ADC Channel Data Register 6 -------- +;- -------- ADC_CDR7 : (ADC Offset: 0x4c) ADC Channel Data Register 7 -------- + +;- ***************************************************************************** +;- REGISTER ADDRESS DEFINITION FOR AT91SAM7X256 +;- ***************************************************************************** +;- ========== Register definition for SYS peripheral ========== +;- ========== Register definition for AIC peripheral ========== +AT91C_AIC_IVR EQU (0xFFFFF100) ;- (AIC) IRQ Vector Register +AT91C_AIC_SMR EQU (0xFFFFF000) ;- (AIC) Source Mode Register +AT91C_AIC_FVR EQU (0xFFFFF104) ;- (AIC) FIQ Vector Register +AT91C_AIC_DCR EQU (0xFFFFF138) ;- (AIC) Debug Control Register (Protect) +AT91C_AIC_EOICR EQU (0xFFFFF130) ;- (AIC) End of Interrupt Command Register +AT91C_AIC_SVR EQU (0xFFFFF080) ;- (AIC) Source Vector Register +AT91C_AIC_FFSR EQU (0xFFFFF148) ;- (AIC) Fast Forcing Status Register +AT91C_AIC_ICCR EQU (0xFFFFF128) ;- (AIC) Interrupt Clear Command Register +AT91C_AIC_ISR EQU (0xFFFFF108) ;- (AIC) Interrupt Status Register +AT91C_AIC_IMR EQU (0xFFFFF110) ;- (AIC) Interrupt Mask Register +AT91C_AIC_IPR EQU (0xFFFFF10C) ;- (AIC) Interrupt Pending Register +AT91C_AIC_FFER EQU (0xFFFFF140) ;- (AIC) Fast Forcing Enable Register +AT91C_AIC_IECR EQU (0xFFFFF120) ;- (AIC) Interrupt Enable Command Register +AT91C_AIC_ISCR EQU (0xFFFFF12C) ;- (AIC) Interrupt Set Command Register +AT91C_AIC_FFDR EQU (0xFFFFF144) ;- (AIC) Fast Forcing Disable Register +AT91C_AIC_CISR EQU (0xFFFFF114) ;- (AIC) Core Interrupt Status Register +AT91C_AIC_IDCR EQU (0xFFFFF124) ;- (AIC) Interrupt Disable Command Register +AT91C_AIC_SPU EQU (0xFFFFF134) ;- (AIC) Spurious Vector Register +;- ========== Register definition for PDC_DBGU peripheral ========== +AT91C_DBGU_TCR EQU (0xFFFFF30C) ;- (PDC_DBGU) Transmit Counter Register +AT91C_DBGU_RNPR EQU (0xFFFFF310) ;- (PDC_DBGU) Receive Next Pointer Register +AT91C_DBGU_TNPR EQU (0xFFFFF318) ;- (PDC_DBGU) Transmit Next Pointer Register +AT91C_DBGU_TPR EQU (0xFFFFF308) ;- (PDC_DBGU) Transmit Pointer Register +AT91C_DBGU_RPR EQU (0xFFFFF300) ;- (PDC_DBGU) Receive Pointer Register +AT91C_DBGU_RCR EQU (0xFFFFF304) ;- (PDC_DBGU) Receive Counter Register +AT91C_DBGU_RNCR EQU (0xFFFFF314) ;- (PDC_DBGU) Receive Next Counter Register +AT91C_DBGU_PTCR EQU (0xFFFFF320) ;- (PDC_DBGU) PDC Transfer Control Register +AT91C_DBGU_PTSR EQU (0xFFFFF324) ;- (PDC_DBGU) PDC Transfer Status Register +AT91C_DBGU_TNCR EQU (0xFFFFF31C) ;- (PDC_DBGU) Transmit Next Counter Register +;- ========== Register definition for DBGU peripheral ========== +AT91C_DBGU_EXID EQU (0xFFFFF244) ;- (DBGU) Chip ID Extension Register +AT91C_DBGU_BRGR EQU (0xFFFFF220) ;- (DBGU) Baud Rate Generator Register +AT91C_DBGU_IDR EQU (0xFFFFF20C) ;- (DBGU) Interrupt Disable Register +AT91C_DBGU_CSR EQU (0xFFFFF214) ;- (DBGU) Channel Status Register +AT91C_DBGU_CIDR EQU (0xFFFFF240) ;- (DBGU) Chip ID Register +AT91C_DBGU_MR EQU (0xFFFFF204) ;- (DBGU) Mode Register +AT91C_DBGU_IMR EQU (0xFFFFF210) ;- (DBGU) Interrupt Mask Register +AT91C_DBGU_CR EQU (0xFFFFF200) ;- (DBGU) Control Register +AT91C_DBGU_FNTR EQU (0xFFFFF248) ;- (DBGU) Force NTRST Register +AT91C_DBGU_THR EQU (0xFFFFF21C) ;- (DBGU) Transmitter Holding Register +AT91C_DBGU_RHR EQU (0xFFFFF218) ;- (DBGU) Receiver Holding Register +AT91C_DBGU_IER EQU (0xFFFFF208) ;- (DBGU) Interrupt Enable Register +;- ========== Register definition for PIOA peripheral ========== +AT91C_PIOA_ODR EQU (0xFFFFF414) ;- (PIOA) Output Disable Registerr +AT91C_PIOA_SODR EQU (0xFFFFF430) ;- (PIOA) Set Output Data Register +AT91C_PIOA_ISR EQU (0xFFFFF44C) ;- (PIOA) Interrupt Status Register +AT91C_PIOA_ABSR EQU (0xFFFFF478) ;- (PIOA) AB Select Status Register +AT91C_PIOA_IER EQU (0xFFFFF440) ;- (PIOA) Interrupt Enable Register +AT91C_PIOA_PPUDR EQU (0xFFFFF460) ;- (PIOA) Pull-up Disable Register +AT91C_PIOA_IMR EQU (0xFFFFF448) ;- (PIOA) Interrupt Mask Register +AT91C_PIOA_PER EQU (0xFFFFF400) ;- (PIOA) PIO Enable Register +AT91C_PIOA_IFDR EQU (0xFFFFF424) ;- (PIOA) Input Filter Disable Register +AT91C_PIOA_OWDR EQU (0xFFFFF4A4) ;- (PIOA) Output Write Disable Register +AT91C_PIOA_MDSR EQU (0xFFFFF458) ;- (PIOA) Multi-driver Status Register +AT91C_PIOA_IDR EQU (0xFFFFF444) ;- (PIOA) Interrupt Disable Register +AT91C_PIOA_ODSR EQU (0xFFFFF438) ;- (PIOA) Output Data Status Register +AT91C_PIOA_PPUSR EQU (0xFFFFF468) ;- (PIOA) Pull-up Status Register +AT91C_PIOA_OWSR EQU (0xFFFFF4A8) ;- (PIOA) Output Write Status Register +AT91C_PIOA_BSR EQU (0xFFFFF474) ;- (PIOA) Select B Register +AT91C_PIOA_OWER EQU (0xFFFFF4A0) ;- (PIOA) Output Write Enable Register +AT91C_PIOA_IFER EQU (0xFFFFF420) ;- (PIOA) Input Filter Enable Register +AT91C_PIOA_PDSR EQU (0xFFFFF43C) ;- (PIOA) Pin Data Status Register +AT91C_PIOA_PPUER EQU (0xFFFFF464) ;- (PIOA) Pull-up Enable Register +AT91C_PIOA_OSR EQU (0xFFFFF418) ;- (PIOA) Output Status Register +AT91C_PIOA_ASR EQU (0xFFFFF470) ;- (PIOA) Select A Register +AT91C_PIOA_MDDR EQU (0xFFFFF454) ;- (PIOA) Multi-driver Disable Register +AT91C_PIOA_CODR EQU (0xFFFFF434) ;- (PIOA) Clear Output Data Register +AT91C_PIOA_MDER EQU (0xFFFFF450) ;- (PIOA) Multi-driver Enable Register +AT91C_PIOA_PDR EQU (0xFFFFF404) ;- (PIOA) PIO Disable Register +AT91C_PIOA_IFSR EQU (0xFFFFF428) ;- (PIOA) Input Filter Status Register +AT91C_PIOA_OER EQU (0xFFFFF410) ;- (PIOA) Output Enable Register +AT91C_PIOA_PSR EQU (0xFFFFF408) ;- (PIOA) PIO Status Register +;- ========== Register definition for PIOB peripheral ========== +AT91C_PIOB_OWDR EQU (0xFFFFF6A4) ;- (PIOB) Output Write Disable Register +AT91C_PIOB_MDER EQU (0xFFFFF650) ;- (PIOB) Multi-driver Enable Register +AT91C_PIOB_PPUSR EQU (0xFFFFF668) ;- (PIOB) Pull-up Status Register +AT91C_PIOB_IMR EQU (0xFFFFF648) ;- (PIOB) Interrupt Mask Register +AT91C_PIOB_ASR EQU (0xFFFFF670) ;- (PIOB) Select A Register +AT91C_PIOB_PPUDR EQU (0xFFFFF660) ;- (PIOB) Pull-up Disable Register +AT91C_PIOB_PSR EQU (0xFFFFF608) ;- (PIOB) PIO Status Register +AT91C_PIOB_IER EQU (0xFFFFF640) ;- (PIOB) Interrupt Enable Register +AT91C_PIOB_CODR EQU (0xFFFFF634) ;- (PIOB) Clear Output Data Register +AT91C_PIOB_OWER EQU (0xFFFFF6A0) ;- (PIOB) Output Write Enable Register +AT91C_PIOB_ABSR EQU (0xFFFFF678) ;- (PIOB) AB Select Status Register +AT91C_PIOB_IFDR EQU (0xFFFFF624) ;- (PIOB) Input Filter Disable Register +AT91C_PIOB_PDSR EQU (0xFFFFF63C) ;- (PIOB) Pin Data Status Register +AT91C_PIOB_IDR EQU (0xFFFFF644) ;- (PIOB) Interrupt Disable Register +AT91C_PIOB_OWSR EQU (0xFFFFF6A8) ;- (PIOB) Output Write Status Register +AT91C_PIOB_PDR EQU (0xFFFFF604) ;- (PIOB) PIO Disable Register +AT91C_PIOB_ODR EQU (0xFFFFF614) ;- (PIOB) Output Disable Registerr +AT91C_PIOB_IFSR EQU (0xFFFFF628) ;- (PIOB) Input Filter Status Register +AT91C_PIOB_PPUER EQU (0xFFFFF664) ;- (PIOB) Pull-up Enable Register +AT91C_PIOB_SODR EQU (0xFFFFF630) ;- (PIOB) Set Output Data Register +AT91C_PIOB_ISR EQU (0xFFFFF64C) ;- (PIOB) Interrupt Status Register +AT91C_PIOB_ODSR EQU (0xFFFFF638) ;- (PIOB) Output Data Status Register +AT91C_PIOB_OSR EQU (0xFFFFF618) ;- (PIOB) Output Status Register +AT91C_PIOB_MDSR EQU (0xFFFFF658) ;- (PIOB) Multi-driver Status Register +AT91C_PIOB_IFER EQU (0xFFFFF620) ;- (PIOB) Input Filter Enable Register +AT91C_PIOB_BSR EQU (0xFFFFF674) ;- (PIOB) Select B Register +AT91C_PIOB_MDDR EQU (0xFFFFF654) ;- (PIOB) Multi-driver Disable Register +AT91C_PIOB_OER EQU (0xFFFFF610) ;- (PIOB) Output Enable Register +AT91C_PIOB_PER EQU (0xFFFFF600) ;- (PIOB) PIO Enable Register +;- ========== Register definition for CKGR peripheral ========== +AT91C_CKGR_MOR EQU (0xFFFFFC20) ;- (CKGR) Main Oscillator Register +AT91C_CKGR_PLLR EQU (0xFFFFFC2C) ;- (CKGR) PLL Register +AT91C_CKGR_MCFR EQU (0xFFFFFC24) ;- (CKGR) Main Clock Frequency Register +;- ========== Register definition for PMC peripheral ========== +AT91C_PMC_IDR EQU (0xFFFFFC64) ;- (PMC) Interrupt Disable Register +AT91C_PMC_MOR EQU (0xFFFFFC20) ;- (PMC) Main Oscillator Register +AT91C_PMC_PLLR EQU (0xFFFFFC2C) ;- (PMC) PLL Register +AT91C_PMC_PCER EQU (0xFFFFFC10) ;- (PMC) Peripheral Clock Enable Register +AT91C_PMC_PCKR EQU (0xFFFFFC40) ;- (PMC) Programmable Clock Register +AT91C_PMC_MCKR EQU (0xFFFFFC30) ;- (PMC) Master Clock Register +AT91C_PMC_SCDR EQU (0xFFFFFC04) ;- (PMC) System Clock Disable Register +AT91C_PMC_PCDR EQU (0xFFFFFC14) ;- (PMC) Peripheral Clock Disable Register +AT91C_PMC_SCSR EQU (0xFFFFFC08) ;- (PMC) System Clock Status Register +AT91C_PMC_PCSR EQU (0xFFFFFC18) ;- (PMC) Peripheral Clock Status Register +AT91C_PMC_MCFR EQU (0xFFFFFC24) ;- (PMC) Main Clock Frequency Register +AT91C_PMC_SCER EQU (0xFFFFFC00) ;- (PMC) System Clock Enable Register +AT91C_PMC_IMR EQU (0xFFFFFC6C) ;- (PMC) Interrupt Mask Register +AT91C_PMC_IER EQU (0xFFFFFC60) ;- (PMC) Interrupt Enable Register +AT91C_PMC_SR EQU (0xFFFFFC68) ;- (PMC) Status Register +;- ========== Register definition for RSTC peripheral ========== +AT91C_RSTC_RCR EQU (0xFFFFFD00) ;- (RSTC) Reset Control Register +AT91C_RSTC_RMR EQU (0xFFFFFD08) ;- (RSTC) Reset Mode Register +AT91C_RSTC_RSR EQU (0xFFFFFD04) ;- (RSTC) Reset Status Register +;- ========== Register definition for RTTC peripheral ========== +AT91C_RTTC_RTSR EQU (0xFFFFFD2C) ;- (RTTC) Real-time Status Register +AT91C_RTTC_RTMR EQU (0xFFFFFD20) ;- (RTTC) Real-time Mode Register +AT91C_RTTC_RTVR EQU (0xFFFFFD28) ;- (RTTC) Real-time Value Register +AT91C_RTTC_RTAR EQU (0xFFFFFD24) ;- (RTTC) Real-time Alarm Register +;- ========== Register definition for PITC peripheral ========== +AT91C_PITC_PIVR EQU (0xFFFFFD38) ;- (PITC) Period Interval Value Register +AT91C_PITC_PISR EQU (0xFFFFFD34) ;- (PITC) Period Interval Status Register +AT91C_PITC_PIIR EQU (0xFFFFFD3C) ;- (PITC) Period Interval Image Register +AT91C_PITC_PIMR EQU (0xFFFFFD30) ;- (PITC) Period Interval Mode Register +;- ========== Register definition for WDTC peripheral ========== +AT91C_WDTC_WDCR EQU (0xFFFFFD40) ;- (WDTC) Watchdog Control Register +AT91C_WDTC_WDSR EQU (0xFFFFFD48) ;- (WDTC) Watchdog Status Register +AT91C_WDTC_WDMR EQU (0xFFFFFD44) ;- (WDTC) Watchdog Mode Register +;- ========== Register definition for VREG peripheral ========== +AT91C_VREG_MR EQU (0xFFFFFD60) ;- (VREG) Voltage Regulator Mode Register +;- ========== Register definition for MC peripheral ========== +AT91C_MC_ASR EQU (0xFFFFFF04) ;- (MC) MC Abort Status Register +AT91C_MC_RCR EQU (0xFFFFFF00) ;- (MC) MC Remap Control Register +AT91C_MC_FCR EQU (0xFFFFFF64) ;- (MC) MC Flash Command Register +AT91C_MC_AASR EQU (0xFFFFFF08) ;- (MC) MC Abort Address Status Register +AT91C_MC_FSR EQU (0xFFFFFF68) ;- (MC) MC Flash Status Register +AT91C_MC_FMR EQU (0xFFFFFF60) ;- (MC) MC Flash Mode Register +;- ========== Register definition for PDC_SPI1 peripheral ========== +AT91C_SPI1_PTCR EQU (0xFFFE4120) ;- (PDC_SPI1) PDC Transfer Control Register +AT91C_SPI1_RPR EQU (0xFFFE4100) ;- (PDC_SPI1) Receive Pointer Register +AT91C_SPI1_TNCR EQU (0xFFFE411C) ;- (PDC_SPI1) Transmit Next Counter Register +AT91C_SPI1_TPR EQU (0xFFFE4108) ;- (PDC_SPI1) Transmit Pointer Register +AT91C_SPI1_TNPR EQU (0xFFFE4118) ;- (PDC_SPI1) Transmit Next Pointer Register +AT91C_SPI1_TCR EQU (0xFFFE410C) ;- (PDC_SPI1) Transmit Counter Register +AT91C_SPI1_RCR EQU (0xFFFE4104) ;- (PDC_SPI1) Receive Counter Register +AT91C_SPI1_RNPR EQU (0xFFFE4110) ;- (PDC_SPI1) Receive Next Pointer Register +AT91C_SPI1_RNCR EQU (0xFFFE4114) ;- (PDC_SPI1) Receive Next Counter Register +AT91C_SPI1_PTSR EQU (0xFFFE4124) ;- (PDC_SPI1) PDC Transfer Status Register +;- ========== Register definition for SPI1 peripheral ========== +AT91C_SPI1_IMR EQU (0xFFFE401C) ;- (SPI1) Interrupt Mask Register +AT91C_SPI1_IER EQU (0xFFFE4014) ;- (SPI1) Interrupt Enable Register +AT91C_SPI1_MR EQU (0xFFFE4004) ;- (SPI1) Mode Register +AT91C_SPI1_RDR EQU (0xFFFE4008) ;- (SPI1) Receive Data Register +AT91C_SPI1_IDR EQU (0xFFFE4018) ;- (SPI1) Interrupt Disable Register +AT91C_SPI1_SR EQU (0xFFFE4010) ;- (SPI1) Status Register +AT91C_SPI1_TDR EQU (0xFFFE400C) ;- (SPI1) Transmit Data Register +AT91C_SPI1_CR EQU (0xFFFE4000) ;- (SPI1) Control Register +AT91C_SPI1_CSR EQU (0xFFFE4030) ;- (SPI1) Chip Select Register +;- ========== Register definition for PDC_SPI0 peripheral ========== +AT91C_SPI0_PTCR EQU (0xFFFE0120) ;- (PDC_SPI0) PDC Transfer Control Register +AT91C_SPI0_TPR EQU (0xFFFE0108) ;- (PDC_SPI0) Transmit Pointer Register +AT91C_SPI0_TCR EQU (0xFFFE010C) ;- (PDC_SPI0) Transmit Counter Register +AT91C_SPI0_RCR EQU (0xFFFE0104) ;- (PDC_SPI0) Receive Counter Register +AT91C_SPI0_PTSR EQU (0xFFFE0124) ;- (PDC_SPI0) PDC Transfer Status Register +AT91C_SPI0_RNPR EQU (0xFFFE0110) ;- (PDC_SPI0) Receive Next Pointer Register +AT91C_SPI0_RPR EQU (0xFFFE0100) ;- (PDC_SPI0) Receive Pointer Register +AT91C_SPI0_TNCR EQU (0xFFFE011C) ;- (PDC_SPI0) Transmit Next Counter Register +AT91C_SPI0_RNCR EQU (0xFFFE0114) ;- (PDC_SPI0) Receive Next Counter Register +AT91C_SPI0_TNPR EQU (0xFFFE0118) ;- (PDC_SPI0) Transmit Next Pointer Register +;- ========== Register definition for SPI0 peripheral ========== +AT91C_SPI0_IER EQU (0xFFFE0014) ;- (SPI0) Interrupt Enable Register +AT91C_SPI0_SR EQU (0xFFFE0010) ;- (SPI0) Status Register +AT91C_SPI0_IDR EQU (0xFFFE0018) ;- (SPI0) Interrupt Disable Register +AT91C_SPI0_CR EQU (0xFFFE0000) ;- (SPI0) Control Register +AT91C_SPI0_MR EQU (0xFFFE0004) ;- (SPI0) Mode Register +AT91C_SPI0_IMR EQU (0xFFFE001C) ;- (SPI0) Interrupt Mask Register +AT91C_SPI0_TDR EQU (0xFFFE000C) ;- (SPI0) Transmit Data Register +AT91C_SPI0_RDR EQU (0xFFFE0008) ;- (SPI0) Receive Data Register +AT91C_SPI0_CSR EQU (0xFFFE0030) ;- (SPI0) Chip Select Register +;- ========== Register definition for PDC_US1 peripheral ========== +AT91C_US1_RNCR EQU (0xFFFC4114) ;- (PDC_US1) Receive Next Counter Register +AT91C_US1_PTCR EQU (0xFFFC4120) ;- (PDC_US1) PDC Transfer Control Register +AT91C_US1_TCR EQU (0xFFFC410C) ;- (PDC_US1) Transmit Counter Register +AT91C_US1_PTSR EQU (0xFFFC4124) ;- (PDC_US1) PDC Transfer Status Register +AT91C_US1_TNPR EQU (0xFFFC4118) ;- (PDC_US1) Transmit Next Pointer Register +AT91C_US1_RCR EQU (0xFFFC4104) ;- (PDC_US1) Receive Counter Register +AT91C_US1_RNPR EQU (0xFFFC4110) ;- (PDC_US1) Receive Next Pointer Register +AT91C_US1_RPR EQU (0xFFFC4100) ;- (PDC_US1) Receive Pointer Register +AT91C_US1_TNCR EQU (0xFFFC411C) ;- (PDC_US1) Transmit Next Counter Register +AT91C_US1_TPR EQU (0xFFFC4108) ;- (PDC_US1) Transmit Pointer Register +;- ========== Register definition for US1 peripheral ========== +AT91C_US1_IF EQU (0xFFFC404C) ;- (US1) IRDA_FILTER Register +AT91C_US1_NER EQU (0xFFFC4044) ;- (US1) Nb Errors Register +AT91C_US1_RTOR EQU (0xFFFC4024) ;- (US1) Receiver Time-out Register +AT91C_US1_CSR EQU (0xFFFC4014) ;- (US1) Channel Status Register +AT91C_US1_IDR EQU (0xFFFC400C) ;- (US1) Interrupt Disable Register +AT91C_US1_IER EQU (0xFFFC4008) ;- (US1) Interrupt Enable Register +AT91C_US1_THR EQU (0xFFFC401C) ;- (US1) Transmitter Holding Register +AT91C_US1_TTGR EQU (0xFFFC4028) ;- (US1) Transmitter Time-guard Register +AT91C_US1_RHR EQU (0xFFFC4018) ;- (US1) Receiver Holding Register +AT91C_US1_BRGR EQU (0xFFFC4020) ;- (US1) Baud Rate Generator Register +AT91C_US1_IMR EQU (0xFFFC4010) ;- (US1) Interrupt Mask Register +AT91C_US1_FIDI EQU (0xFFFC4040) ;- (US1) FI_DI_Ratio Register +AT91C_US1_CR EQU (0xFFFC4000) ;- (US1) Control Register +AT91C_US1_MR EQU (0xFFFC4004) ;- (US1) Mode Register +;- ========== Register definition for PDC_US0 peripheral ========== +AT91C_US0_TNPR EQU (0xFFFC0118) ;- (PDC_US0) Transmit Next Pointer Register +AT91C_US0_RNPR EQU (0xFFFC0110) ;- (PDC_US0) Receive Next Pointer Register +AT91C_US0_TCR EQU (0xFFFC010C) ;- (PDC_US0) Transmit Counter Register +AT91C_US0_PTCR EQU (0xFFFC0120) ;- (PDC_US0) PDC Transfer Control Register +AT91C_US0_PTSR EQU (0xFFFC0124) ;- (PDC_US0) PDC Transfer Status Register +AT91C_US0_TNCR EQU (0xFFFC011C) ;- (PDC_US0) Transmit Next Counter Register +AT91C_US0_TPR EQU (0xFFFC0108) ;- (PDC_US0) Transmit Pointer Register +AT91C_US0_RCR EQU (0xFFFC0104) ;- (PDC_US0) Receive Counter Register +AT91C_US0_RPR EQU (0xFFFC0100) ;- (PDC_US0) Receive Pointer Register +AT91C_US0_RNCR EQU (0xFFFC0114) ;- (PDC_US0) Receive Next Counter Register +;- ========== Register definition for US0 peripheral ========== +AT91C_US0_BRGR EQU (0xFFFC0020) ;- (US0) Baud Rate Generator Register +AT91C_US0_NER EQU (0xFFFC0044) ;- (US0) Nb Errors Register +AT91C_US0_CR EQU (0xFFFC0000) ;- (US0) Control Register +AT91C_US0_IMR EQU (0xFFFC0010) ;- (US0) Interrupt Mask Register +AT91C_US0_FIDI EQU (0xFFFC0040) ;- (US0) FI_DI_Ratio Register +AT91C_US0_TTGR EQU (0xFFFC0028) ;- (US0) Transmitter Time-guard Register +AT91C_US0_MR EQU (0xFFFC0004) ;- (US0) Mode Register +AT91C_US0_RTOR EQU (0xFFFC0024) ;- (US0) Receiver Time-out Register +AT91C_US0_CSR EQU (0xFFFC0014) ;- (US0) Channel Status Register +AT91C_US0_RHR EQU (0xFFFC0018) ;- (US0) Receiver Holding Register +AT91C_US0_IDR EQU (0xFFFC000C) ;- (US0) Interrupt Disable Register +AT91C_US0_THR EQU (0xFFFC001C) ;- (US0) Transmitter Holding Register +AT91C_US0_IF EQU (0xFFFC004C) ;- (US0) IRDA_FILTER Register +AT91C_US0_IER EQU (0xFFFC0008) ;- (US0) Interrupt Enable Register +;- ========== Register definition for PDC_SSC peripheral ========== +AT91C_SSC_TNCR EQU (0xFFFD411C) ;- (PDC_SSC) Transmit Next Counter Register +AT91C_SSC_RPR EQU (0xFFFD4100) ;- (PDC_SSC) Receive Pointer Register +AT91C_SSC_RNCR EQU (0xFFFD4114) ;- (PDC_SSC) Receive Next Counter Register +AT91C_SSC_TPR EQU (0xFFFD4108) ;- (PDC_SSC) Transmit Pointer Register +AT91C_SSC_PTCR EQU (0xFFFD4120) ;- (PDC_SSC) PDC Transfer Control Register +AT91C_SSC_TCR EQU (0xFFFD410C) ;- (PDC_SSC) Transmit Counter Register +AT91C_SSC_RCR EQU (0xFFFD4104) ;- (PDC_SSC) Receive Counter Register +AT91C_SSC_RNPR EQU (0xFFFD4110) ;- (PDC_SSC) Receive Next Pointer Register +AT91C_SSC_TNPR EQU (0xFFFD4118) ;- (PDC_SSC) Transmit Next Pointer Register +AT91C_SSC_PTSR EQU (0xFFFD4124) ;- (PDC_SSC) PDC Transfer Status Register +;- ========== Register definition for SSC peripheral ========== +AT91C_SSC_RHR EQU (0xFFFD4020) ;- (SSC) Receive Holding Register +AT91C_SSC_RSHR EQU (0xFFFD4030) ;- (SSC) Receive Sync Holding Register +AT91C_SSC_TFMR EQU (0xFFFD401C) ;- (SSC) Transmit Frame Mode Register +AT91C_SSC_IDR EQU (0xFFFD4048) ;- (SSC) Interrupt Disable Register +AT91C_SSC_THR EQU (0xFFFD4024) ;- (SSC) Transmit Holding Register +AT91C_SSC_RCMR EQU (0xFFFD4010) ;- (SSC) Receive Clock ModeRegister +AT91C_SSC_IER EQU (0xFFFD4044) ;- (SSC) Interrupt Enable Register +AT91C_SSC_TSHR EQU (0xFFFD4034) ;- (SSC) Transmit Sync Holding Register +AT91C_SSC_SR EQU (0xFFFD4040) ;- (SSC) Status Register +AT91C_SSC_CMR EQU (0xFFFD4004) ;- (SSC) Clock Mode Register +AT91C_SSC_TCMR EQU (0xFFFD4018) ;- (SSC) Transmit Clock Mode Register +AT91C_SSC_CR EQU (0xFFFD4000) ;- (SSC) Control Register +AT91C_SSC_IMR EQU (0xFFFD404C) ;- (SSC) Interrupt Mask Register +AT91C_SSC_RFMR EQU (0xFFFD4014) ;- (SSC) Receive Frame Mode Register +;- ========== Register definition for TWI peripheral ========== +AT91C_TWI_IER EQU (0xFFFB8024) ;- (TWI) Interrupt Enable Register +AT91C_TWI_CR EQU (0xFFFB8000) ;- (TWI) Control Register +AT91C_TWI_SR EQU (0xFFFB8020) ;- (TWI) Status Register +AT91C_TWI_IMR EQU (0xFFFB802C) ;- (TWI) Interrupt Mask Register +AT91C_TWI_THR EQU (0xFFFB8034) ;- (TWI) Transmit Holding Register +AT91C_TWI_IDR EQU (0xFFFB8028) ;- (TWI) Interrupt Disable Register +AT91C_TWI_IADR EQU (0xFFFB800C) ;- (TWI) Internal Address Register +AT91C_TWI_MMR EQU (0xFFFB8004) ;- (TWI) Master Mode Register +AT91C_TWI_CWGR EQU (0xFFFB8010) ;- (TWI) Clock Waveform Generator Register +AT91C_TWI_RHR EQU (0xFFFB8030) ;- (TWI) Receive Holding Register +;- ========== Register definition for PWMC_CH3 peripheral ========== +AT91C_PWMC_CH3_CUPDR EQU (0xFFFCC270) ;- (PWMC_CH3) Channel Update Register +AT91C_PWMC_CH3_Reserved EQU (0xFFFCC274) ;- (PWMC_CH3) Reserved +AT91C_PWMC_CH3_CPRDR EQU (0xFFFCC268) ;- (PWMC_CH3) Channel Period Register +AT91C_PWMC_CH3_CDTYR EQU (0xFFFCC264) ;- (PWMC_CH3) Channel Duty Cycle Register +AT91C_PWMC_CH3_CCNTR EQU (0xFFFCC26C) ;- (PWMC_CH3) Channel Counter Register +AT91C_PWMC_CH3_CMR EQU (0xFFFCC260) ;- (PWMC_CH3) Channel Mode Register +;- ========== Register definition for PWMC_CH2 peripheral ========== +AT91C_PWMC_CH2_Reserved EQU (0xFFFCC254) ;- (PWMC_CH2) Reserved +AT91C_PWMC_CH2_CMR EQU (0xFFFCC240) ;- (PWMC_CH2) Channel Mode Register +AT91C_PWMC_CH2_CCNTR EQU (0xFFFCC24C) ;- (PWMC_CH2) Channel Counter Register +AT91C_PWMC_CH2_CPRDR EQU (0xFFFCC248) ;- (PWMC_CH2) Channel Period Register +AT91C_PWMC_CH2_CUPDR EQU (0xFFFCC250) ;- (PWMC_CH2) Channel Update Register +AT91C_PWMC_CH2_CDTYR EQU (0xFFFCC244) ;- (PWMC_CH2) Channel Duty Cycle Register +;- ========== Register definition for PWMC_CH1 peripheral ========== +AT91C_PWMC_CH1_Reserved EQU (0xFFFCC234) ;- (PWMC_CH1) Reserved +AT91C_PWMC_CH1_CUPDR EQU (0xFFFCC230) ;- (PWMC_CH1) Channel Update Register +AT91C_PWMC_CH1_CPRDR EQU (0xFFFCC228) ;- (PWMC_CH1) Channel Period Register +AT91C_PWMC_CH1_CCNTR EQU (0xFFFCC22C) ;- (PWMC_CH1) Channel Counter Register +AT91C_PWMC_CH1_CDTYR EQU (0xFFFCC224) ;- (PWMC_CH1) Channel Duty Cycle Register +AT91C_PWMC_CH1_CMR EQU (0xFFFCC220) ;- (PWMC_CH1) Channel Mode Register +;- ========== Register definition for PWMC_CH0 peripheral ========== +AT91C_PWMC_CH0_Reserved EQU (0xFFFCC214) ;- (PWMC_CH0) Reserved +AT91C_PWMC_CH0_CPRDR EQU (0xFFFCC208) ;- (PWMC_CH0) Channel Period Register +AT91C_PWMC_CH0_CDTYR EQU (0xFFFCC204) ;- (PWMC_CH0) Channel Duty Cycle Register +AT91C_PWMC_CH0_CMR EQU (0xFFFCC200) ;- (PWMC_CH0) Channel Mode Register +AT91C_PWMC_CH0_CUPDR EQU (0xFFFCC210) ;- (PWMC_CH0) Channel Update Register +AT91C_PWMC_CH0_CCNTR EQU (0xFFFCC20C) ;- (PWMC_CH0) Channel Counter Register +;- ========== Register definition for PWMC peripheral ========== +AT91C_PWMC_IDR EQU (0xFFFCC014) ;- (PWMC) PWMC Interrupt Disable Register +AT91C_PWMC_DIS EQU (0xFFFCC008) ;- (PWMC) PWMC Disable Register +AT91C_PWMC_IER EQU (0xFFFCC010) ;- (PWMC) PWMC Interrupt Enable Register +AT91C_PWMC_VR EQU (0xFFFCC0FC) ;- (PWMC) PWMC Version Register +AT91C_PWMC_ISR EQU (0xFFFCC01C) ;- (PWMC) PWMC Interrupt Status Register +AT91C_PWMC_SR EQU (0xFFFCC00C) ;- (PWMC) PWMC Status Register +AT91C_PWMC_IMR EQU (0xFFFCC018) ;- (PWMC) PWMC Interrupt Mask Register +AT91C_PWMC_MR EQU (0xFFFCC000) ;- (PWMC) PWMC Mode Register +AT91C_PWMC_ENA EQU (0xFFFCC004) ;- (PWMC) PWMC Enable Register +;- ========== Register definition for UDP peripheral ========== +AT91C_UDP_IMR EQU (0xFFFB0018) ;- (UDP) Interrupt Mask Register +AT91C_UDP_FADDR EQU (0xFFFB0008) ;- (UDP) Function Address Register +AT91C_UDP_NUM EQU (0xFFFB0000) ;- (UDP) Frame Number Register +AT91C_UDP_FDR EQU (0xFFFB0050) ;- (UDP) Endpoint FIFO Data Register +AT91C_UDP_ISR EQU (0xFFFB001C) ;- (UDP) Interrupt Status Register +AT91C_UDP_CSR EQU (0xFFFB0030) ;- (UDP) Endpoint Control and Status Register +AT91C_UDP_IDR EQU (0xFFFB0014) ;- (UDP) Interrupt Disable Register +AT91C_UDP_ICR EQU (0xFFFB0020) ;- (UDP) Interrupt Clear Register +AT91C_UDP_RSTEP EQU (0xFFFB0028) ;- (UDP) Reset Endpoint Register +AT91C_UDP_TXVC EQU (0xFFFB0074) ;- (UDP) Transceiver Control Register +AT91C_UDP_GLBSTATE EQU (0xFFFB0004) ;- (UDP) Global State Register +AT91C_UDP_IER EQU (0xFFFB0010) ;- (UDP) Interrupt Enable Register +;- ========== Register definition for TC0 peripheral ========== +AT91C_TC0_SR EQU (0xFFFA0020) ;- (TC0) Status Register +AT91C_TC0_RC EQU (0xFFFA001C) ;- (TC0) Register C +AT91C_TC0_RB EQU (0xFFFA0018) ;- (TC0) Register B +AT91C_TC0_CCR EQU (0xFFFA0000) ;- (TC0) Channel Control Register +AT91C_TC0_CMR EQU (0xFFFA0004) ;- (TC0) Channel Mode Register (Capture Mode / Waveform Mode) +AT91C_TC0_IER EQU (0xFFFA0024) ;- (TC0) Interrupt Enable Register +AT91C_TC0_RA EQU (0xFFFA0014) ;- (TC0) Register A +AT91C_TC0_IDR EQU (0xFFFA0028) ;- (TC0) Interrupt Disable Register +AT91C_TC0_CV EQU (0xFFFA0010) ;- (TC0) Counter Value +AT91C_TC0_IMR EQU (0xFFFA002C) ;- (TC0) Interrupt Mask Register +;- ========== Register definition for TC1 peripheral ========== +AT91C_TC1_RB EQU (0xFFFA0058) ;- (TC1) Register B +AT91C_TC1_CCR EQU (0xFFFA0040) ;- (TC1) Channel Control Register +AT91C_TC1_IER EQU (0xFFFA0064) ;- (TC1) Interrupt Enable Register +AT91C_TC1_IDR EQU (0xFFFA0068) ;- (TC1) Interrupt Disable Register +AT91C_TC1_SR EQU (0xFFFA0060) ;- (TC1) Status Register +AT91C_TC1_CMR EQU (0xFFFA0044) ;- (TC1) Channel Mode Register (Capture Mode / Waveform Mode) +AT91C_TC1_RA EQU (0xFFFA0054) ;- (TC1) Register A +AT91C_TC1_RC EQU (0xFFFA005C) ;- (TC1) Register C +AT91C_TC1_IMR EQU (0xFFFA006C) ;- (TC1) Interrupt Mask Register +AT91C_TC1_CV EQU (0xFFFA0050) ;- (TC1) Counter Value +;- ========== Register definition for TC2 peripheral ========== +AT91C_TC2_CMR EQU (0xFFFA0084) ;- (TC2) Channel Mode Register (Capture Mode / Waveform Mode) +AT91C_TC2_CCR EQU (0xFFFA0080) ;- (TC2) Channel Control Register +AT91C_TC2_CV EQU (0xFFFA0090) ;- (TC2) Counter Value +AT91C_TC2_RA EQU (0xFFFA0094) ;- (TC2) Register A +AT91C_TC2_RB EQU (0xFFFA0098) ;- (TC2) Register B +AT91C_TC2_IDR EQU (0xFFFA00A8) ;- (TC2) Interrupt Disable Register +AT91C_TC2_IMR EQU (0xFFFA00AC) ;- (TC2) Interrupt Mask Register +AT91C_TC2_RC EQU (0xFFFA009C) ;- (TC2) Register C +AT91C_TC2_IER EQU (0xFFFA00A4) ;- (TC2) Interrupt Enable Register +AT91C_TC2_SR EQU (0xFFFA00A0) ;- (TC2) Status Register +;- ========== Register definition for TCB peripheral ========== +AT91C_TCB_BMR EQU (0xFFFA00C4) ;- (TCB) TC Block Mode Register +AT91C_TCB_BCR EQU (0xFFFA00C0) ;- (TCB) TC Block Control Register +;- ========== Register definition for CAN_MB0 peripheral ========== +AT91C_CAN_MB0_MDL EQU (0xFFFD0214) ;- (CAN_MB0) MailBox Data Low Register +AT91C_CAN_MB0_MAM EQU (0xFFFD0204) ;- (CAN_MB0) MailBox Acceptance Mask Register +AT91C_CAN_MB0_MCR EQU (0xFFFD021C) ;- (CAN_MB0) MailBox Control Register +AT91C_CAN_MB0_MID EQU (0xFFFD0208) ;- (CAN_MB0) MailBox ID Register +AT91C_CAN_MB0_MSR EQU (0xFFFD0210) ;- (CAN_MB0) MailBox Status Register +AT91C_CAN_MB0_MFID EQU (0xFFFD020C) ;- (CAN_MB0) MailBox Family ID Register +AT91C_CAN_MB0_MDH EQU (0xFFFD0218) ;- (CAN_MB0) MailBox Data High Register +AT91C_CAN_MB0_MMR EQU (0xFFFD0200) ;- (CAN_MB0) MailBox Mode Register +;- ========== Register definition for CAN_MB1 peripheral ========== +AT91C_CAN_MB1_MDL EQU (0xFFFD0234) ;- (CAN_MB1) MailBox Data Low Register +AT91C_CAN_MB1_MID EQU (0xFFFD0228) ;- (CAN_MB1) MailBox ID Register +AT91C_CAN_MB1_MMR EQU (0xFFFD0220) ;- (CAN_MB1) MailBox Mode Register +AT91C_CAN_MB1_MSR EQU (0xFFFD0230) ;- (CAN_MB1) MailBox Status Register +AT91C_CAN_MB1_MAM EQU (0xFFFD0224) ;- (CAN_MB1) MailBox Acceptance Mask Register +AT91C_CAN_MB1_MDH EQU (0xFFFD0238) ;- (CAN_MB1) MailBox Data High Register +AT91C_CAN_MB1_MCR EQU (0xFFFD023C) ;- (CAN_MB1) MailBox Control Register +AT91C_CAN_MB1_MFID EQU (0xFFFD022C) ;- (CAN_MB1) MailBox Family ID Register +;- ========== Register definition for CAN_MB2 peripheral ========== +AT91C_CAN_MB2_MCR EQU (0xFFFD025C) ;- (CAN_MB2) MailBox Control Register +AT91C_CAN_MB2_MDH EQU (0xFFFD0258) ;- (CAN_MB2) MailBox Data High Register +AT91C_CAN_MB2_MID EQU (0xFFFD0248) ;- (CAN_MB2) MailBox ID Register +AT91C_CAN_MB2_MDL EQU (0xFFFD0254) ;- (CAN_MB2) MailBox Data Low Register +AT91C_CAN_MB2_MMR EQU (0xFFFD0240) ;- (CAN_MB2) MailBox Mode Register +AT91C_CAN_MB2_MAM EQU (0xFFFD0244) ;- (CAN_MB2) MailBox Acceptance Mask Register +AT91C_CAN_MB2_MFID EQU (0xFFFD024C) ;- (CAN_MB2) MailBox Family ID Register +AT91C_CAN_MB2_MSR EQU (0xFFFD0250) ;- (CAN_MB2) MailBox Status Register +;- ========== Register definition for CAN_MB3 peripheral ========== +AT91C_CAN_MB3_MFID EQU (0xFFFD026C) ;- (CAN_MB3) MailBox Family ID Register +AT91C_CAN_MB3_MAM EQU (0xFFFD0264) ;- (CAN_MB3) MailBox Acceptance Mask Register +AT91C_CAN_MB3_MID EQU (0xFFFD0268) ;- (CAN_MB3) MailBox ID Register +AT91C_CAN_MB3_MCR EQU (0xFFFD027C) ;- (CAN_MB3) MailBox Control Register +AT91C_CAN_MB3_MMR EQU (0xFFFD0260) ;- (CAN_MB3) MailBox Mode Register +AT91C_CAN_MB3_MSR EQU (0xFFFD0270) ;- (CAN_MB3) MailBox Status Register +AT91C_CAN_MB3_MDL EQU (0xFFFD0274) ;- (CAN_MB3) MailBox Data Low Register +AT91C_CAN_MB3_MDH EQU (0xFFFD0278) ;- (CAN_MB3) MailBox Data High Register +;- ========== Register definition for CAN_MB4 peripheral ========== +AT91C_CAN_MB4_MID EQU (0xFFFD0288) ;- (CAN_MB4) MailBox ID Register +AT91C_CAN_MB4_MMR EQU (0xFFFD0280) ;- (CAN_MB4) MailBox Mode Register +AT91C_CAN_MB4_MDH EQU (0xFFFD0298) ;- (CAN_MB4) MailBox Data High Register +AT91C_CAN_MB4_MFID EQU (0xFFFD028C) ;- (CAN_MB4) MailBox Family ID Register +AT91C_CAN_MB4_MSR EQU (0xFFFD0290) ;- (CAN_MB4) MailBox Status Register +AT91C_CAN_MB4_MCR EQU (0xFFFD029C) ;- (CAN_MB4) MailBox Control Register +AT91C_CAN_MB4_MDL EQU (0xFFFD0294) ;- (CAN_MB4) MailBox Data Low Register +AT91C_CAN_MB4_MAM EQU (0xFFFD0284) ;- (CAN_MB4) MailBox Acceptance Mask Register +;- ========== Register definition for CAN_MB5 peripheral ========== +AT91C_CAN_MB5_MSR EQU (0xFFFD02B0) ;- (CAN_MB5) MailBox Status Register +AT91C_CAN_MB5_MCR EQU (0xFFFD02BC) ;- (CAN_MB5) MailBox Control Register +AT91C_CAN_MB5_MFID EQU (0xFFFD02AC) ;- (CAN_MB5) MailBox Family ID Register +AT91C_CAN_MB5_MDH EQU (0xFFFD02B8) ;- (CAN_MB5) MailBox Data High Register +AT91C_CAN_MB5_MID EQU (0xFFFD02A8) ;- (CAN_MB5) MailBox ID Register +AT91C_CAN_MB5_MMR EQU (0xFFFD02A0) ;- (CAN_MB5) MailBox Mode Register +AT91C_CAN_MB5_MDL EQU (0xFFFD02B4) ;- (CAN_MB5) MailBox Data Low Register +AT91C_CAN_MB5_MAM EQU (0xFFFD02A4) ;- (CAN_MB5) MailBox Acceptance Mask Register +;- ========== Register definition for CAN_MB6 peripheral ========== +AT91C_CAN_MB6_MFID EQU (0xFFFD02CC) ;- (CAN_MB6) MailBox Family ID Register +AT91C_CAN_MB6_MID EQU (0xFFFD02C8) ;- (CAN_MB6) MailBox ID Register +AT91C_CAN_MB6_MAM EQU (0xFFFD02C4) ;- (CAN_MB6) MailBox Acceptance Mask Register +AT91C_CAN_MB6_MSR EQU (0xFFFD02D0) ;- (CAN_MB6) MailBox Status Register +AT91C_CAN_MB6_MDL EQU (0xFFFD02D4) ;- (CAN_MB6) MailBox Data Low Register +AT91C_CAN_MB6_MCR EQU (0xFFFD02DC) ;- (CAN_MB6) MailBox Control Register +AT91C_CAN_MB6_MDH EQU (0xFFFD02D8) ;- (CAN_MB6) MailBox Data High Register +AT91C_CAN_MB6_MMR EQU (0xFFFD02C0) ;- (CAN_MB6) MailBox Mode Register +;- ========== Register definition for CAN_MB7 peripheral ========== +AT91C_CAN_MB7_MCR EQU (0xFFFD02FC) ;- (CAN_MB7) MailBox Control Register +AT91C_CAN_MB7_MDH EQU (0xFFFD02F8) ;- (CAN_MB7) MailBox Data High Register +AT91C_CAN_MB7_MFID EQU (0xFFFD02EC) ;- (CAN_MB7) MailBox Family ID Register +AT91C_CAN_MB7_MDL EQU (0xFFFD02F4) ;- (CAN_MB7) MailBox Data Low Register +AT91C_CAN_MB7_MID EQU (0xFFFD02E8) ;- (CAN_MB7) MailBox ID Register +AT91C_CAN_MB7_MMR EQU (0xFFFD02E0) ;- (CAN_MB7) MailBox Mode Register +AT91C_CAN_MB7_MAM EQU (0xFFFD02E4) ;- (CAN_MB7) MailBox Acceptance Mask Register +AT91C_CAN_MB7_MSR EQU (0xFFFD02F0) ;- (CAN_MB7) MailBox Status Register +;- ========== Register definition for CAN peripheral ========== +AT91C_CAN_TCR EQU (0xFFFD0024) ;- (CAN) Transfer Command Register +AT91C_CAN_IMR EQU (0xFFFD000C) ;- (CAN) Interrupt Mask Register +AT91C_CAN_IER EQU (0xFFFD0004) ;- (CAN) Interrupt Enable Register +AT91C_CAN_ECR EQU (0xFFFD0020) ;- (CAN) Error Counter Register +AT91C_CAN_TIMESTP EQU (0xFFFD001C) ;- (CAN) Time Stamp Register +AT91C_CAN_MR EQU (0xFFFD0000) ;- (CAN) Mode Register +AT91C_CAN_IDR EQU (0xFFFD0008) ;- (CAN) Interrupt Disable Register +AT91C_CAN_ACR EQU (0xFFFD0028) ;- (CAN) Abort Command Register +AT91C_CAN_TIM EQU (0xFFFD0018) ;- (CAN) Timer Register +AT91C_CAN_SR EQU (0xFFFD0010) ;- (CAN) Status Register +AT91C_CAN_BR EQU (0xFFFD0014) ;- (CAN) Baudrate Register +AT91C_CAN_VR EQU (0xFFFD00FC) ;- (CAN) Version Register +;- ========== Register definition for EMAC peripheral ========== +AT91C_EMAC_ISR EQU (0xFFFDC024) ;- (EMAC) Interrupt Status Register +AT91C_EMAC_SA4H EQU (0xFFFDC0B4) ;- (EMAC) Specific Address 4 Top, Last 2 bytes +AT91C_EMAC_SA1L EQU (0xFFFDC098) ;- (EMAC) Specific Address 1 Bottom, First 4 bytes +AT91C_EMAC_ELE EQU (0xFFFDC078) ;- (EMAC) Excessive Length Errors Register +AT91C_EMAC_LCOL EQU (0xFFFDC05C) ;- (EMAC) Late Collision Register +AT91C_EMAC_RLE EQU (0xFFFDC088) ;- (EMAC) Receive Length Field Mismatch Register +AT91C_EMAC_WOL EQU (0xFFFDC0C4) ;- (EMAC) Wake On LAN Register +AT91C_EMAC_DTF EQU (0xFFFDC058) ;- (EMAC) Deferred Transmission Frame Register +AT91C_EMAC_TUND EQU (0xFFFDC064) ;- (EMAC) Transmit Underrun Error Register +AT91C_EMAC_NCR EQU (0xFFFDC000) ;- (EMAC) Network Control Register +AT91C_EMAC_SA4L EQU (0xFFFDC0B0) ;- (EMAC) Specific Address 4 Bottom, First 4 bytes +AT91C_EMAC_RSR EQU (0xFFFDC020) ;- (EMAC) Receive Status Register +AT91C_EMAC_SA3L EQU (0xFFFDC0A8) ;- (EMAC) Specific Address 3 Bottom, First 4 bytes +AT91C_EMAC_TSR EQU (0xFFFDC014) ;- (EMAC) Transmit Status Register +AT91C_EMAC_IDR EQU (0xFFFDC02C) ;- (EMAC) Interrupt Disable Register +AT91C_EMAC_RSE EQU (0xFFFDC074) ;- (EMAC) Receive Symbol Errors Register +AT91C_EMAC_ECOL EQU (0xFFFDC060) ;- (EMAC) Excessive Collision Register +AT91C_EMAC_TID EQU (0xFFFDC0B8) ;- (EMAC) Type ID Checking Register +AT91C_EMAC_HRB EQU (0xFFFDC090) ;- (EMAC) Hash Address Bottom[31:0] +AT91C_EMAC_TBQP EQU (0xFFFDC01C) ;- (EMAC) Transmit Buffer Queue Pointer +AT91C_EMAC_USRIO EQU (0xFFFDC0C0) ;- (EMAC) USER Input/Output Register +AT91C_EMAC_PTR EQU (0xFFFDC038) ;- (EMAC) Pause Time Register +AT91C_EMAC_SA2H EQU (0xFFFDC0A4) ;- (EMAC) Specific Address 2 Top, Last 2 bytes +AT91C_EMAC_ROV EQU (0xFFFDC070) ;- (EMAC) Receive Overrun Errors Register +AT91C_EMAC_ALE EQU (0xFFFDC054) ;- (EMAC) Alignment Error Register +AT91C_EMAC_RJA EQU (0xFFFDC07C) ;- (EMAC) Receive Jabbers Register +AT91C_EMAC_RBQP EQU (0xFFFDC018) ;- (EMAC) Receive Buffer Queue Pointer +AT91C_EMAC_TPF EQU (0xFFFDC08C) ;- (EMAC) Transmitted Pause Frames Register +AT91C_EMAC_NCFGR EQU (0xFFFDC004) ;- (EMAC) Network Configuration Register +AT91C_EMAC_HRT EQU (0xFFFDC094) ;- (EMAC) Hash Address Top[63:32] +AT91C_EMAC_USF EQU (0xFFFDC080) ;- (EMAC) Undersize Frames Register +AT91C_EMAC_FCSE EQU (0xFFFDC050) ;- (EMAC) Frame Check Sequence Error Register +AT91C_EMAC_TPQ EQU (0xFFFDC0BC) ;- (EMAC) Transmit Pause Quantum Register +AT91C_EMAC_MAN EQU (0xFFFDC034) ;- (EMAC) PHY Maintenance Register +AT91C_EMAC_FTO EQU (0xFFFDC040) ;- (EMAC) Frames Transmitted OK Register +AT91C_EMAC_REV EQU (0xFFFDC0FC) ;- (EMAC) Revision Register +AT91C_EMAC_IMR EQU (0xFFFDC030) ;- (EMAC) Interrupt Mask Register +AT91C_EMAC_SCF EQU (0xFFFDC044) ;- (EMAC) Single Collision Frame Register +AT91C_EMAC_PFR EQU (0xFFFDC03C) ;- (EMAC) Pause Frames received Register +AT91C_EMAC_MCF EQU (0xFFFDC048) ;- (EMAC) Multiple Collision Frame Register +AT91C_EMAC_NSR EQU (0xFFFDC008) ;- (EMAC) Network Status Register +AT91C_EMAC_SA2L EQU (0xFFFDC0A0) ;- (EMAC) Specific Address 2 Bottom, First 4 bytes +AT91C_EMAC_FRO EQU (0xFFFDC04C) ;- (EMAC) Frames Received OK Register +AT91C_EMAC_IER EQU (0xFFFDC028) ;- (EMAC) Interrupt Enable Register +AT91C_EMAC_SA1H EQU (0xFFFDC09C) ;- (EMAC) Specific Address 1 Top, Last 2 bytes +AT91C_EMAC_CSE EQU (0xFFFDC068) ;- (EMAC) Carrier Sense Error Register +AT91C_EMAC_SA3H EQU (0xFFFDC0AC) ;- (EMAC) Specific Address 3 Top, Last 2 bytes +AT91C_EMAC_RRE EQU (0xFFFDC06C) ;- (EMAC) Receive Ressource Error Register +AT91C_EMAC_STE EQU (0xFFFDC084) ;- (EMAC) SQE Test Error Register +;- ========== Register definition for PDC_ADC peripheral ========== +AT91C_ADC_PTSR EQU (0xFFFD8124) ;- (PDC_ADC) PDC Transfer Status Register +AT91C_ADC_PTCR EQU (0xFFFD8120) ;- (PDC_ADC) PDC Transfer Control Register +AT91C_ADC_TNPR EQU (0xFFFD8118) ;- (PDC_ADC) Transmit Next Pointer Register +AT91C_ADC_TNCR EQU (0xFFFD811C) ;- (PDC_ADC) Transmit Next Counter Register +AT91C_ADC_RNPR EQU (0xFFFD8110) ;- (PDC_ADC) Receive Next Pointer Register +AT91C_ADC_RNCR EQU (0xFFFD8114) ;- (PDC_ADC) Receive Next Counter Register +AT91C_ADC_RPR EQU (0xFFFD8100) ;- (PDC_ADC) Receive Pointer Register +AT91C_ADC_TCR EQU (0xFFFD810C) ;- (PDC_ADC) Transmit Counter Register +AT91C_ADC_TPR EQU (0xFFFD8108) ;- (PDC_ADC) Transmit Pointer Register +AT91C_ADC_RCR EQU (0xFFFD8104) ;- (PDC_ADC) Receive Counter Register +;- ========== Register definition for ADC peripheral ========== +AT91C_ADC_CDR2 EQU (0xFFFD8038) ;- (ADC) ADC Channel Data Register 2 +AT91C_ADC_CDR3 EQU (0xFFFD803C) ;- (ADC) ADC Channel Data Register 3 +AT91C_ADC_CDR0 EQU (0xFFFD8030) ;- (ADC) ADC Channel Data Register 0 +AT91C_ADC_CDR5 EQU (0xFFFD8044) ;- (ADC) ADC Channel Data Register 5 +AT91C_ADC_CHDR EQU (0xFFFD8014) ;- (ADC) ADC Channel Disable Register +AT91C_ADC_SR EQU (0xFFFD801C) ;- (ADC) ADC Status Register +AT91C_ADC_CDR4 EQU (0xFFFD8040) ;- (ADC) ADC Channel Data Register 4 +AT91C_ADC_CDR1 EQU (0xFFFD8034) ;- (ADC) ADC Channel Data Register 1 +AT91C_ADC_LCDR EQU (0xFFFD8020) ;- (ADC) ADC Last Converted Data Register +AT91C_ADC_IDR EQU (0xFFFD8028) ;- (ADC) ADC Interrupt Disable Register +AT91C_ADC_CR EQU (0xFFFD8000) ;- (ADC) ADC Control Register +AT91C_ADC_CDR7 EQU (0xFFFD804C) ;- (ADC) ADC Channel Data Register 7 +AT91C_ADC_CDR6 EQU (0xFFFD8048) ;- (ADC) ADC Channel Data Register 6 +AT91C_ADC_IER EQU (0xFFFD8024) ;- (ADC) ADC Interrupt Enable Register +AT91C_ADC_CHER EQU (0xFFFD8010) ;- (ADC) ADC Channel Enable Register +AT91C_ADC_CHSR EQU (0xFFFD8018) ;- (ADC) ADC Channel Status Register +AT91C_ADC_MR EQU (0xFFFD8004) ;- (ADC) ADC Mode Register +AT91C_ADC_IMR EQU (0xFFFD802C) ;- (ADC) ADC Interrupt Mask Register + +;- ***************************************************************************** +;- PIO DEFINITIONS FOR AT91SAM7X256 +;- ***************************************************************************** +AT91C_PIO_PA0 EQU (1:SHL:0) ;- Pin Controlled by PA0 +AT91C_PA0_RXD0 EQU (AT91C_PIO_PA0) ;- USART 0 Receive Data +AT91C_PIO_PA1 EQU (1:SHL:1) ;- Pin Controlled by PA1 +AT91C_PA1_TXD0 EQU (AT91C_PIO_PA1) ;- USART 0 Transmit Data +AT91C_PIO_PA10 EQU (1:SHL:10) ;- Pin Controlled by PA10 +AT91C_PA10_TWD EQU (AT91C_PIO_PA10) ;- TWI Two-wire Serial Data +AT91C_PIO_PA11 EQU (1:SHL:11) ;- Pin Controlled by PA11 +AT91C_PA11_TWCK EQU (AT91C_PIO_PA11) ;- TWI Two-wire Serial Clock +AT91C_PIO_PA12 EQU (1:SHL:12) ;- Pin Controlled by PA12 +AT91C_PA12_SPI0_NPCS0 EQU (AT91C_PIO_PA12) ;- SPI 0 Peripheral Chip Select 0 +AT91C_PIO_PA13 EQU (1:SHL:13) ;- Pin Controlled by PA13 +AT91C_PA13_SPI0_NPCS1 EQU (AT91C_PIO_PA13) ;- SPI 0 Peripheral Chip Select 1 +AT91C_PA13_PCK1 EQU (AT91C_PIO_PA13) ;- PMC Programmable Clock Output 1 +AT91C_PIO_PA14 EQU (1:SHL:14) ;- Pin Controlled by PA14 +AT91C_PA14_SPI0_NPCS2 EQU (AT91C_PIO_PA14) ;- SPI 0 Peripheral Chip Select 2 +AT91C_PA14_IRQ1 EQU (AT91C_PIO_PA14) ;- External Interrupt 1 +AT91C_PIO_PA15 EQU (1:SHL:15) ;- Pin Controlled by PA15 +AT91C_PA15_SPI0_NPCS3 EQU (AT91C_PIO_PA15) ;- SPI 0 Peripheral Chip Select 3 +AT91C_PA15_TCLK2 EQU (AT91C_PIO_PA15) ;- Timer Counter 2 external clock input +AT91C_PIO_PA16 EQU (1:SHL:16) ;- Pin Controlled by PA16 +AT91C_PA16_SPI0_MISO EQU (AT91C_PIO_PA16) ;- SPI 0 Master In Slave +AT91C_PIO_PA17 EQU (1:SHL:17) ;- Pin Controlled by PA17 +AT91C_PA17_SPI0_MOSI EQU (AT91C_PIO_PA17) ;- SPI 0 Master Out Slave +AT91C_PIO_PA18 EQU (1:SHL:18) ;- Pin Controlled by PA18 +AT91C_PA18_SPI0_SPCK EQU (AT91C_PIO_PA18) ;- SPI 0 Serial Clock +AT91C_PIO_PA19 EQU (1:SHL:19) ;- Pin Controlled by PA19 +AT91C_PA19_CANRX EQU (AT91C_PIO_PA19) ;- CAN Receive +AT91C_PIO_PA2 EQU (1:SHL:2) ;- Pin Controlled by PA2 +AT91C_PA2_SCK0 EQU (AT91C_PIO_PA2) ;- USART 0 Serial Clock +AT91C_PA2_SPI1_NPCS1 EQU (AT91C_PIO_PA2) ;- SPI 1 Peripheral Chip Select 1 +AT91C_PIO_PA20 EQU (1:SHL:20) ;- Pin Controlled by PA20 +AT91C_PA20_CANTX EQU (AT91C_PIO_PA20) ;- CAN Transmit +AT91C_PIO_PA21 EQU (1:SHL:21) ;- Pin Controlled by PA21 +AT91C_PA21_TF EQU (AT91C_PIO_PA21) ;- SSC Transmit Frame Sync +AT91C_PA21_SPI1_NPCS0 EQU (AT91C_PIO_PA21) ;- SPI 1 Peripheral Chip Select 0 +AT91C_PIO_PA22 EQU (1:SHL:22) ;- Pin Controlled by PA22 +AT91C_PA22_TK EQU (AT91C_PIO_PA22) ;- SSC Transmit Clock +AT91C_PA22_SPI1_SPCK EQU (AT91C_PIO_PA22) ;- SPI 1 Serial Clock +AT91C_PIO_PA23 EQU (1:SHL:23) ;- Pin Controlled by PA23 +AT91C_PA23_TD EQU (AT91C_PIO_PA23) ;- SSC Transmit data +AT91C_PA23_SPI1_MOSI EQU (AT91C_PIO_PA23) ;- SPI 1 Master Out Slave +AT91C_PIO_PA24 EQU (1:SHL:24) ;- Pin Controlled by PA24 +AT91C_PA24_RD EQU (AT91C_PIO_PA24) ;- SSC Receive Data +AT91C_PA24_SPI1_MISO EQU (AT91C_PIO_PA24) ;- SPI 1 Master In Slave +AT91C_PIO_PA25 EQU (1:SHL:25) ;- Pin Controlled by PA25 +AT91C_PA25_RK EQU (AT91C_PIO_PA25) ;- SSC Receive Clock +AT91C_PA25_SPI1_NPCS1 EQU (AT91C_PIO_PA25) ;- SPI 1 Peripheral Chip Select 1 +AT91C_PIO_PA26 EQU (1:SHL:26) ;- Pin Controlled by PA26 +AT91C_PA26_RF EQU (AT91C_PIO_PA26) ;- SSC Receive Frame Sync +AT91C_PA26_SPI1_NPCS2 EQU (AT91C_PIO_PA26) ;- SPI 1 Peripheral Chip Select 2 +AT91C_PIO_PA27 EQU (1:SHL:27) ;- Pin Controlled by PA27 +AT91C_PA27_DRXD EQU (AT91C_PIO_PA27) ;- DBGU Debug Receive Data +AT91C_PA27_PCK3 EQU (AT91C_PIO_PA27) ;- PMC Programmable Clock Output 3 +AT91C_PIO_PA28 EQU (1:SHL:28) ;- Pin Controlled by PA28 +AT91C_PA28_DTXD EQU (AT91C_PIO_PA28) ;- DBGU Debug Transmit Data +AT91C_PIO_PA29 EQU (1:SHL:29) ;- Pin Controlled by PA29 +AT91C_PA29_FIQ EQU (AT91C_PIO_PA29) ;- AIC Fast Interrupt Input +AT91C_PA29_SPI1_NPCS3 EQU (AT91C_PIO_PA29) ;- SPI 1 Peripheral Chip Select 3 +AT91C_PIO_PA3 EQU (1:SHL:3) ;- Pin Controlled by PA3 +AT91C_PA3_RTS0 EQU (AT91C_PIO_PA3) ;- USART 0 Ready To Send +AT91C_PA3_SPI1_NPCS2 EQU (AT91C_PIO_PA3) ;- SPI 1 Peripheral Chip Select 2 +AT91C_PIO_PA30 EQU (1:SHL:30) ;- Pin Controlled by PA30 +AT91C_PA30_IRQ0 EQU (AT91C_PIO_PA30) ;- External Interrupt 0 +AT91C_PA30_PCK2 EQU (AT91C_PIO_PA30) ;- PMC Programmable Clock Output 2 +AT91C_PIO_PA4 EQU (1:SHL:4) ;- Pin Controlled by PA4 +AT91C_PA4_CTS0 EQU (AT91C_PIO_PA4) ;- USART 0 Clear To Send +AT91C_PA4_SPI1_NPCS3 EQU (AT91C_PIO_PA4) ;- SPI 1 Peripheral Chip Select 3 +AT91C_PIO_PA5 EQU (1:SHL:5) ;- Pin Controlled by PA5 +AT91C_PA5_RXD1 EQU (AT91C_PIO_PA5) ;- USART 1 Receive Data +AT91C_PIO_PA6 EQU (1:SHL:6) ;- Pin Controlled by PA6 +AT91C_PA6_TXD1 EQU (AT91C_PIO_PA6) ;- USART 1 Transmit Data +AT91C_PIO_PA7 EQU (1:SHL:7) ;- Pin Controlled by PA7 +AT91C_PA7_SCK1 EQU (AT91C_PIO_PA7) ;- USART 1 Serial Clock +AT91C_PA7_SPI0_NPCS1 EQU (AT91C_PIO_PA7) ;- SPI 0 Peripheral Chip Select 1 +AT91C_PIO_PA8 EQU (1:SHL:8) ;- Pin Controlled by PA8 +AT91C_PA8_RTS1 EQU (AT91C_PIO_PA8) ;- USART 1 Ready To Send +AT91C_PA8_SPI0_NPCS2 EQU (AT91C_PIO_PA8) ;- SPI 0 Peripheral Chip Select 2 +AT91C_PIO_PA9 EQU (1:SHL:9) ;- Pin Controlled by PA9 +AT91C_PA9_CTS1 EQU (AT91C_PIO_PA9) ;- USART 1 Clear To Send +AT91C_PA9_SPI0_NPCS3 EQU (AT91C_PIO_PA9) ;- SPI 0 Peripheral Chip Select 3 +AT91C_PIO_PB0 EQU (1:SHL:0) ;- Pin Controlled by PB0 +AT91C_PB0_ETXCK_EREFCK EQU (AT91C_PIO_PB0) ;- Ethernet MAC Transmit Clock/Reference Clock +AT91C_PB0_PCK0 EQU (AT91C_PIO_PB0) ;- PMC Programmable Clock Output 0 +AT91C_PIO_PB1 EQU (1:SHL:1) ;- Pin Controlled by PB1 +AT91C_PB1_ETXEN EQU (AT91C_PIO_PB1) ;- Ethernet MAC Transmit Enable +AT91C_PIO_PB10 EQU (1:SHL:10) ;- Pin Controlled by PB10 +AT91C_PB10_ETX2 EQU (AT91C_PIO_PB10) ;- Ethernet MAC Transmit Data 2 +AT91C_PB10_SPI1_NPCS1 EQU (AT91C_PIO_PB10) ;- SPI 1 Peripheral Chip Select 1 +AT91C_PIO_PB11 EQU (1:SHL:11) ;- Pin Controlled by PB11 +AT91C_PB11_ETX3 EQU (AT91C_PIO_PB11) ;- Ethernet MAC Transmit Data 3 +AT91C_PB11_SPI1_NPCS2 EQU (AT91C_PIO_PB11) ;- SPI 1 Peripheral Chip Select 2 +AT91C_PIO_PB12 EQU (1:SHL:12) ;- Pin Controlled by PB12 +AT91C_PB12_ETXER EQU (AT91C_PIO_PB12) ;- Ethernet MAC Transmikt Coding Error +AT91C_PB12_TCLK0 EQU (AT91C_PIO_PB12) ;- Timer Counter 0 external clock input +AT91C_PIO_PB13 EQU (1:SHL:13) ;- Pin Controlled by PB13 +AT91C_PB13_ERX2 EQU (AT91C_PIO_PB13) ;- Ethernet MAC Receive Data 2 +AT91C_PB13_SPI0_NPCS1 EQU (AT91C_PIO_PB13) ;- SPI 0 Peripheral Chip Select 1 +AT91C_PIO_PB14 EQU (1:SHL:14) ;- Pin Controlled by PB14 +AT91C_PB14_ERX3 EQU (AT91C_PIO_PB14) ;- Ethernet MAC Receive Data 3 +AT91C_PB14_SPI0_NPCS2 EQU (AT91C_PIO_PB14) ;- SPI 0 Peripheral Chip Select 2 +AT91C_PIO_PB15 EQU (1:SHL:15) ;- Pin Controlled by PB15 +AT91C_PB15_ERXDV_ECRSDV EQU (AT91C_PIO_PB15) ;- Ethernet MAC Receive Data Valid +AT91C_PIO_PB16 EQU (1:SHL:16) ;- Pin Controlled by PB16 +AT91C_PB16_ECOL EQU (AT91C_PIO_PB16) ;- Ethernet MAC Collision Detected +AT91C_PB16_SPI1_NPCS3 EQU (AT91C_PIO_PB16) ;- SPI 1 Peripheral Chip Select 3 +AT91C_PIO_PB17 EQU (1:SHL:17) ;- Pin Controlled by PB17 +AT91C_PB17_ERXCK EQU (AT91C_PIO_PB17) ;- Ethernet MAC Receive Clock +AT91C_PB17_SPI0_NPCS3 EQU (AT91C_PIO_PB17) ;- SPI 0 Peripheral Chip Select 3 +AT91C_PIO_PB18 EQU (1:SHL:18) ;- Pin Controlled by PB18 +AT91C_PB18_EF100 EQU (AT91C_PIO_PB18) ;- Ethernet MAC Force 100 Mbits/sec +AT91C_PB18_ADTRG EQU (AT91C_PIO_PB18) ;- ADC External Trigger +AT91C_PIO_PB19 EQU (1:SHL:19) ;- Pin Controlled by PB19 +AT91C_PB19_PWM0 EQU (AT91C_PIO_PB19) ;- PWM Channel 0 +AT91C_PB19_TCLK1 EQU (AT91C_PIO_PB19) ;- Timer Counter 1 external clock input +AT91C_PIO_PB2 EQU (1:SHL:2) ;- Pin Controlled by PB2 +AT91C_PB2_ETX0 EQU (AT91C_PIO_PB2) ;- Ethernet MAC Transmit Data 0 +AT91C_PIO_PB20 EQU (1:SHL:20) ;- Pin Controlled by PB20 +AT91C_PB20_PWM1 EQU (AT91C_PIO_PB20) ;- PWM Channel 1 +AT91C_PB20_PCK0 EQU (AT91C_PIO_PB20) ;- PMC Programmable Clock Output 0 +AT91C_PIO_PB21 EQU (1:SHL:21) ;- Pin Controlled by PB21 +AT91C_PB21_PWM2 EQU (AT91C_PIO_PB21) ;- PWM Channel 2 +AT91C_PB21_PCK1 EQU (AT91C_PIO_PB21) ;- PMC Programmable Clock Output 1 +AT91C_PIO_PB22 EQU (1:SHL:22) ;- Pin Controlled by PB22 +AT91C_PB22_PWM3 EQU (AT91C_PIO_PB22) ;- PWM Channel 3 +AT91C_PB22_PCK2 EQU (AT91C_PIO_PB22) ;- PMC Programmable Clock Output 2 +AT91C_PIO_PB23 EQU (1:SHL:23) ;- Pin Controlled by PB23 +AT91C_PB23_TIOA0 EQU (AT91C_PIO_PB23) ;- Timer Counter 0 Multipurpose Timer I/O Pin A +AT91C_PB23_DCD1 EQU (AT91C_PIO_PB23) ;- USART 1 Data Carrier Detect +AT91C_PIO_PB24 EQU (1:SHL:24) ;- Pin Controlled by PB24 +AT91C_PB24_TIOB0 EQU (AT91C_PIO_PB24) ;- Timer Counter 0 Multipurpose Timer I/O Pin B +AT91C_PB24_DSR1 EQU (AT91C_PIO_PB24) ;- USART 1 Data Set ready +AT91C_PIO_PB25 EQU (1:SHL:25) ;- Pin Controlled by PB25 +AT91C_PB25_TIOA1 EQU (AT91C_PIO_PB25) ;- Timer Counter 1 Multipurpose Timer I/O Pin A +AT91C_PB25_DTR1 EQU (AT91C_PIO_PB25) ;- USART 1 Data Terminal ready +AT91C_PIO_PB26 EQU (1:SHL:26) ;- Pin Controlled by PB26 +AT91C_PB26_TIOB1 EQU (AT91C_PIO_PB26) ;- Timer Counter 1 Multipurpose Timer I/O Pin B +AT91C_PB26_RI1 EQU (AT91C_PIO_PB26) ;- USART 1 Ring Indicator +AT91C_PIO_PB27 EQU (1:SHL:27) ;- Pin Controlled by PB27 +AT91C_PB27_TIOA2 EQU (AT91C_PIO_PB27) ;- Timer Counter 2 Multipurpose Timer I/O Pin A +AT91C_PB27_PWM0 EQU (AT91C_PIO_PB27) ;- PWM Channel 0 +AT91C_PIO_PB28 EQU (1:SHL:28) ;- Pin Controlled by PB28 +AT91C_PB28_TIOB2 EQU (AT91C_PIO_PB28) ;- Timer Counter 2 Multipurpose Timer I/O Pin B +AT91C_PB28_PWM1 EQU (AT91C_PIO_PB28) ;- PWM Channel 1 +AT91C_PIO_PB29 EQU (1:SHL:29) ;- Pin Controlled by PB29 +AT91C_PB29_PCK1 EQU (AT91C_PIO_PB29) ;- PMC Programmable Clock Output 1 +AT91C_PB29_PWM2 EQU (AT91C_PIO_PB29) ;- PWM Channel 2 +AT91C_PIO_PB3 EQU (1:SHL:3) ;- Pin Controlled by PB3 +AT91C_PB3_ETX1 EQU (AT91C_PIO_PB3) ;- Ethernet MAC Transmit Data 1 +AT91C_PIO_PB30 EQU (1:SHL:30) ;- Pin Controlled by PB30 +AT91C_PB30_PCK2 EQU (AT91C_PIO_PB30) ;- PMC Programmable Clock Output 2 +AT91C_PB30_PWM3 EQU (AT91C_PIO_PB30) ;- PWM Channel 3 +AT91C_PIO_PB4 EQU (1:SHL:4) ;- Pin Controlled by PB4 +AT91C_PB4_ECRS EQU (AT91C_PIO_PB4) ;- Ethernet MAC Carrier Sense/Carrier Sense and Data Valid +AT91C_PIO_PB5 EQU (1:SHL:5) ;- Pin Controlled by PB5 +AT91C_PB5_ERX0 EQU (AT91C_PIO_PB5) ;- Ethernet MAC Receive Data 0 +AT91C_PIO_PB6 EQU (1:SHL:6) ;- Pin Controlled by PB6 +AT91C_PB6_ERX1 EQU (AT91C_PIO_PB6) ;- Ethernet MAC Receive Data 1 +AT91C_PIO_PB7 EQU (1:SHL:7) ;- Pin Controlled by PB7 +AT91C_PB7_ERXER EQU (AT91C_PIO_PB7) ;- Ethernet MAC Receive Error +AT91C_PIO_PB8 EQU (1:SHL:8) ;- Pin Controlled by PB8 +AT91C_PB8_EMDC EQU (AT91C_PIO_PB8) ;- Ethernet MAC Management Data Clock +AT91C_PIO_PB9 EQU (1:SHL:9) ;- Pin Controlled by PB9 +AT91C_PB9_EMDIO EQU (AT91C_PIO_PB9) ;- Ethernet MAC Management Data Input/Output + +;- ***************************************************************************** +;- PERIPHERAL ID DEFINITIONS FOR AT91SAM7X256 +;- ***************************************************************************** +AT91C_ID_FIQ EQU ( 0) ;- Advanced Interrupt Controller (FIQ) +AT91C_ID_SYS EQU ( 1) ;- System Peripheral +AT91C_ID_PIOA EQU ( 2) ;- Parallel IO Controller A +AT91C_ID_PIOB EQU ( 3) ;- Parallel IO Controller B +AT91C_ID_SPI0 EQU ( 4) ;- Serial Peripheral Interface 0 +AT91C_ID_SPI1 EQU ( 5) ;- Serial Peripheral Interface 1 +AT91C_ID_US0 EQU ( 6) ;- USART 0 +AT91C_ID_US1 EQU ( 7) ;- USART 1 +AT91C_ID_SSC EQU ( 8) ;- Serial Synchronous Controller +AT91C_ID_TWI EQU ( 9) ;- Two-Wire Interface +AT91C_ID_PWMC EQU (10) ;- PWM Controller +AT91C_ID_UDP EQU (11) ;- USB Device Port +AT91C_ID_TC0 EQU (12) ;- Timer Counter 0 +AT91C_ID_TC1 EQU (13) ;- Timer Counter 1 +AT91C_ID_TC2 EQU (14) ;- Timer Counter 2 +AT91C_ID_CAN EQU (15) ;- Control Area Network Controller +AT91C_ID_EMAC EQU (16) ;- Ethernet MAC +AT91C_ID_ADC EQU (17) ;- Analog-to-Digital Converter +AT91C_ID_18_Reserved EQU (18) ;- Reserved +AT91C_ID_19_Reserved EQU (19) ;- Reserved +AT91C_ID_20_Reserved EQU (20) ;- Reserved +AT91C_ID_21_Reserved EQU (21) ;- Reserved +AT91C_ID_22_Reserved EQU (22) ;- Reserved +AT91C_ID_23_Reserved EQU (23) ;- Reserved +AT91C_ID_24_Reserved EQU (24) ;- Reserved +AT91C_ID_25_Reserved EQU (25) ;- Reserved +AT91C_ID_26_Reserved EQU (26) ;- Reserved +AT91C_ID_27_Reserved EQU (27) ;- Reserved +AT91C_ID_28_Reserved EQU (28) ;- Reserved +AT91C_ID_29_Reserved EQU (29) ;- Reserved +AT91C_ID_IRQ0 EQU (30) ;- Advanced Interrupt Controller (IRQ0) +AT91C_ID_IRQ1 EQU (31) ;- Advanced Interrupt Controller (IRQ1) +AT91C_ALL_INT EQU (0xC003FFFF) ;- ALL VALID INTERRUPTS + +;- ***************************************************************************** +;- BASE ADDRESS DEFINITIONS FOR AT91SAM7X256 +;- ***************************************************************************** +AT91C_BASE_SYS EQU (0xFFFFF000) ;- (SYS) Base Address +AT91C_BASE_AIC EQU (0xFFFFF000) ;- (AIC) Base Address +AT91C_BASE_PDC_DBGU EQU (0xFFFFF300) ;- (PDC_DBGU) Base Address +AT91C_BASE_DBGU EQU (0xFFFFF200) ;- (DBGU) Base Address +AT91C_BASE_PIOA EQU (0xFFFFF400) ;- (PIOA) Base Address +AT91C_BASE_PIOB EQU (0xFFFFF600) ;- (PIOB) Base Address +AT91C_BASE_CKGR EQU (0xFFFFFC20) ;- (CKGR) Base Address +AT91C_BASE_PMC EQU (0xFFFFFC00) ;- (PMC) Base Address +AT91C_BASE_RSTC EQU (0xFFFFFD00) ;- (RSTC) Base Address +AT91C_BASE_RTTC EQU (0xFFFFFD20) ;- (RTTC) Base Address +AT91C_BASE_PITC EQU (0xFFFFFD30) ;- (PITC) Base Address +AT91C_BASE_WDTC EQU (0xFFFFFD40) ;- (WDTC) Base Address +AT91C_BASE_VREG EQU (0xFFFFFD60) ;- (VREG) Base Address +AT91C_BASE_MC EQU (0xFFFFFF00) ;- (MC) Base Address +AT91C_BASE_PDC_SPI1 EQU (0xFFFE4100) ;- (PDC_SPI1) Base Address +AT91C_BASE_SPI1 EQU (0xFFFE4000) ;- (SPI1) Base Address +AT91C_BASE_PDC_SPI0 EQU (0xFFFE0100) ;- (PDC_SPI0) Base Address +AT91C_BASE_SPI0 EQU (0xFFFE0000) ;- (SPI0) Base Address +AT91C_BASE_PDC_US1 EQU (0xFFFC4100) ;- (PDC_US1) Base Address +AT91C_BASE_US1 EQU (0xFFFC4000) ;- (US1) Base Address +AT91C_BASE_PDC_US0 EQU (0xFFFC0100) ;- (PDC_US0) Base Address +AT91C_BASE_US0 EQU (0xFFFC0000) ;- (US0) Base Address +AT91C_BASE_PDC_SSC EQU (0xFFFD4100) ;- (PDC_SSC) Base Address +AT91C_BASE_SSC EQU (0xFFFD4000) ;- (SSC) Base Address +AT91C_BASE_TWI EQU (0xFFFB8000) ;- (TWI) Base Address +AT91C_BASE_PWMC_CH3 EQU (0xFFFCC260) ;- (PWMC_CH3) Base Address +AT91C_BASE_PWMC_CH2 EQU (0xFFFCC240) ;- (PWMC_CH2) Base Address +AT91C_BASE_PWMC_CH1 EQU (0xFFFCC220) ;- (PWMC_CH1) Base Address +AT91C_BASE_PWMC_CH0 EQU (0xFFFCC200) ;- (PWMC_CH0) Base Address +AT91C_BASE_PWMC EQU (0xFFFCC000) ;- (PWMC) Base Address +AT91C_BASE_UDP EQU (0xFFFB0000) ;- (UDP) Base Address +AT91C_BASE_TC0 EQU (0xFFFA0000) ;- (TC0) Base Address +AT91C_BASE_TC1 EQU (0xFFFA0040) ;- (TC1) Base Address +AT91C_BASE_TC2 EQU (0xFFFA0080) ;- (TC2) Base Address +AT91C_BASE_TCB EQU (0xFFFA0000) ;- (TCB) Base Address +AT91C_BASE_CAN_MB0 EQU (0xFFFD0200) ;- (CAN_MB0) Base Address +AT91C_BASE_CAN_MB1 EQU (0xFFFD0220) ;- (CAN_MB1) Base Address +AT91C_BASE_CAN_MB2 EQU (0xFFFD0240) ;- (CAN_MB2) Base Address +AT91C_BASE_CAN_MB3 EQU (0xFFFD0260) ;- (CAN_MB3) Base Address +AT91C_BASE_CAN_MB4 EQU (0xFFFD0280) ;- (CAN_MB4) Base Address +AT91C_BASE_CAN_MB5 EQU (0xFFFD02A0) ;- (CAN_MB5) Base Address +AT91C_BASE_CAN_MB6 EQU (0xFFFD02C0) ;- (CAN_MB6) Base Address +AT91C_BASE_CAN_MB7 EQU (0xFFFD02E0) ;- (CAN_MB7) Base Address +AT91C_BASE_CAN EQU (0xFFFD0000) ;- (CAN) Base Address +AT91C_BASE_EMAC EQU (0xFFFDC000) ;- (EMAC) Base Address +AT91C_BASE_PDC_ADC EQU (0xFFFD8100) ;- (PDC_ADC) Base Address +AT91C_BASE_ADC EQU (0xFFFD8000) ;- (ADC) Base Address + +;- ***************************************************************************** +;- MEMORY MAPPING DEFINITIONS FOR AT91SAM7X256 +;- ***************************************************************************** +;- ISRAM +AT91C_ISRAM EQU (0x00200000) ;- Internal SRAM base address +AT91C_ISRAM_SIZE EQU (0x00010000) ;- Internal SRAM size in byte (64 Kbytes) +;- IFLASH +AT91C_IFLASH EQU (0x00100000) ;- Internal FLASH base address +AT91C_IFLASH_SIZE EQU (0x00040000) ;- Internal FLASH size in byte (256 Kbytes) +AT91C_IFLASH_PAGE_SIZE EQU (256) ;- Internal FLASH Page Size: 256 bytes +AT91C_IFLASH_LOCK_REGION_SIZE EQU (16384) ;- Internal FLASH Lock Region Size: 16 Kbytes +AT91C_IFLASH_NB_OF_PAGES EQU (1024) ;- Internal FLASH Number of Pages: 1024 bytes +AT91C_IFLASH_NB_OF_LOCK_BITS EQU (16) ;- Internal FLASH Number of Lock Bits: 16 bytes + + + END diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.rdf b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.rdf new file mode 100644 index 0000000..7668f5b --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.rdf @@ -0,0 +1,4704 @@ +# ---------------------------------------------------------------------------- +# ATMEL Microcontroller Software Support - ROUSSET - +# ---------------------------------------------------------------------------- +# DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +# DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ---------------------------------------------------------------------------- +# File Name : AT91SAM7X256.h +# Object : AT91SAM7X256 definitions +# Generated : AT91 SW Application Group 11/02/2005 (15:17:24) +# +# CVS Reference : /AT91SAM7X256.pl/1.14/Tue Sep 13 15:06:52 2005// +# CVS Reference : /SYS_SAM7X.pl/1.3/Tue Feb 1 17:01:43 2005// +# CVS Reference : /MC_SAM7X.pl/1.2/Fri May 20 14:13:04 2005// +# CVS Reference : /PMC_SAM7X.pl/1.4/Tue Feb 8 13:58:10 2005// +# CVS Reference : /RSTC_SAM7X.pl/1.2/Wed Jul 13 14:57:50 2005// +# CVS Reference : /UDP_SAM7X.pl/1.1/Tue May 10 11:35:35 2005// +# CVS Reference : /PWM_SAM7X.pl/1.1/Tue May 10 11:53:07 2005// +# CVS Reference : /AIC_6075B.pl/1.3/Fri May 20 14:01:30 2005// +# CVS Reference : /PIO_6057A.pl/1.2/Thu Feb 3 10:18:28 2005// +# CVS Reference : /RTTC_6081A.pl/1.2/Tue Nov 9 14:43:58 2004// +# CVS Reference : /PITC_6079A.pl/1.2/Tue Nov 9 14:43:56 2004// +# CVS Reference : /WDTC_6080A.pl/1.3/Tue Nov 9 14:44:00 2004// +# CVS Reference : /VREG_6085B.pl/1.1/Tue Feb 1 16:05:48 2005// +# CVS Reference : /PDC_6074C.pl/1.2/Thu Feb 3 08:48:54 2005// +# CVS Reference : /DBGU_6059D.pl/1.1/Mon Jan 31 13:15:32 2005// +# CVS Reference : /SPI_6088D.pl/1.3/Fri May 20 14:08:59 2005// +# CVS Reference : /US_6089C.pl/1.1/Mon Jul 12 18:23:26 2004// +# CVS Reference : /SSC_6078B.pl/1.1/Wed Jul 13 15:19:19 2005// +# CVS Reference : /TWI_6061A.pl/1.1/Tue Jul 13 07:38:06 2004// +# CVS Reference : /TC_6082A.pl/1.7/Fri Mar 11 12:52:17 2005// +# CVS Reference : /CAN_6019B.pl/1.1/Tue Mar 8 12:42:22 2005// +# CVS Reference : /EMACB_6119A.pl/1.6/Wed Jul 13 15:05:35 2005// +# CVS Reference : /ADC_6051C.pl/1.1/Fri Oct 17 09:12:38 2003// +# ---------------------------------------------------------------------------- + +rdf.version=1 + +~sysinclude=arm_default.rdf +~sysinclude=arm_status.rdf +# ========== Register definition for SYS peripheral ========== +# ========== Register definition for AIC peripheral ========== +AT91C_AIC_IVR.name="AT91C_AIC_IVR" +AT91C_AIC_IVR.description="IRQ Vector Register" +AT91C_AIC_IVR.helpkey="IRQ Vector Register" +AT91C_AIC_IVR.access=memorymapped +AT91C_AIC_IVR.address=0xFFFFF100 +AT91C_AIC_IVR.width=32 +AT91C_AIC_IVR.byteEndian=little +AT91C_AIC_IVR.permission.write=none +AT91C_AIC_SMR.name="AT91C_AIC_SMR" +AT91C_AIC_SMR.description="Source Mode Register" +AT91C_AIC_SMR.helpkey="Source Mode Register" +AT91C_AIC_SMR.access=memorymapped +AT91C_AIC_SMR.address=0xFFFFF000 +AT91C_AIC_SMR.width=32 +AT91C_AIC_SMR.byteEndian=little +AT91C_AIC_FVR.name="AT91C_AIC_FVR" +AT91C_AIC_FVR.description="FIQ Vector Register" +AT91C_AIC_FVR.helpkey="FIQ Vector Register" +AT91C_AIC_FVR.access=memorymapped +AT91C_AIC_FVR.address=0xFFFFF104 +AT91C_AIC_FVR.width=32 +AT91C_AIC_FVR.byteEndian=little +AT91C_AIC_FVR.permission.write=none +AT91C_AIC_DCR.name="AT91C_AIC_DCR" +AT91C_AIC_DCR.description="Debug Control Register (Protect)" +AT91C_AIC_DCR.helpkey="Debug Control Register (Protect)" +AT91C_AIC_DCR.access=memorymapped +AT91C_AIC_DCR.address=0xFFFFF138 +AT91C_AIC_DCR.width=32 +AT91C_AIC_DCR.byteEndian=little +AT91C_AIC_EOICR.name="AT91C_AIC_EOICR" +AT91C_AIC_EOICR.description="End of Interrupt Command Register" +AT91C_AIC_EOICR.helpkey="End of Interrupt Command Register" +AT91C_AIC_EOICR.access=memorymapped +AT91C_AIC_EOICR.address=0xFFFFF130 +AT91C_AIC_EOICR.width=32 +AT91C_AIC_EOICR.byteEndian=little +AT91C_AIC_EOICR.type=enum +AT91C_AIC_EOICR.enum.0.name=*** Write only *** +AT91C_AIC_EOICR.enum.1.name=Error +AT91C_AIC_SVR.name="AT91C_AIC_SVR" +AT91C_AIC_SVR.description="Source Vector Register" +AT91C_AIC_SVR.helpkey="Source Vector Register" +AT91C_AIC_SVR.access=memorymapped +AT91C_AIC_SVR.address=0xFFFFF080 +AT91C_AIC_SVR.width=32 +AT91C_AIC_SVR.byteEndian=little +AT91C_AIC_FFSR.name="AT91C_AIC_FFSR" +AT91C_AIC_FFSR.description="Fast Forcing Status Register" +AT91C_AIC_FFSR.helpkey="Fast Forcing Status Register" +AT91C_AIC_FFSR.access=memorymapped +AT91C_AIC_FFSR.address=0xFFFFF148 +AT91C_AIC_FFSR.width=32 +AT91C_AIC_FFSR.byteEndian=little +AT91C_AIC_FFSR.permission.write=none +AT91C_AIC_ICCR.name="AT91C_AIC_ICCR" +AT91C_AIC_ICCR.description="Interrupt Clear Command Register" +AT91C_AIC_ICCR.helpkey="Interrupt Clear Command Register" +AT91C_AIC_ICCR.access=memorymapped +AT91C_AIC_ICCR.address=0xFFFFF128 +AT91C_AIC_ICCR.width=32 +AT91C_AIC_ICCR.byteEndian=little +AT91C_AIC_ICCR.type=enum +AT91C_AIC_ICCR.enum.0.name=*** Write only *** +AT91C_AIC_ICCR.enum.1.name=Error +AT91C_AIC_ISR.name="AT91C_AIC_ISR" +AT91C_AIC_ISR.description="Interrupt Status Register" +AT91C_AIC_ISR.helpkey="Interrupt Status Register" +AT91C_AIC_ISR.access=memorymapped +AT91C_AIC_ISR.address=0xFFFFF108 +AT91C_AIC_ISR.width=32 +AT91C_AIC_ISR.byteEndian=little +AT91C_AIC_ISR.permission.write=none +AT91C_AIC_IMR.name="AT91C_AIC_IMR" +AT91C_AIC_IMR.description="Interrupt Mask Register" +AT91C_AIC_IMR.helpkey="Interrupt Mask Register" +AT91C_AIC_IMR.access=memorymapped +AT91C_AIC_IMR.address=0xFFFFF110 +AT91C_AIC_IMR.width=32 +AT91C_AIC_IMR.byteEndian=little +AT91C_AIC_IMR.permission.write=none +AT91C_AIC_IPR.name="AT91C_AIC_IPR" +AT91C_AIC_IPR.description="Interrupt Pending Register" +AT91C_AIC_IPR.helpkey="Interrupt Pending Register" +AT91C_AIC_IPR.access=memorymapped +AT91C_AIC_IPR.address=0xFFFFF10C +AT91C_AIC_IPR.width=32 +AT91C_AIC_IPR.byteEndian=little +AT91C_AIC_IPR.permission.write=none +AT91C_AIC_FFER.name="AT91C_AIC_FFER" +AT91C_AIC_FFER.description="Fast Forcing Enable Register" +AT91C_AIC_FFER.helpkey="Fast Forcing Enable Register" +AT91C_AIC_FFER.access=memorymapped +AT91C_AIC_FFER.address=0xFFFFF140 +AT91C_AIC_FFER.width=32 +AT91C_AIC_FFER.byteEndian=little +AT91C_AIC_FFER.type=enum +AT91C_AIC_FFER.enum.0.name=*** Write only *** +AT91C_AIC_FFER.enum.1.name=Error +AT91C_AIC_IECR.name="AT91C_AIC_IECR" +AT91C_AIC_IECR.description="Interrupt Enable Command Register" +AT91C_AIC_IECR.helpkey="Interrupt Enable Command Register" +AT91C_AIC_IECR.access=memorymapped +AT91C_AIC_IECR.address=0xFFFFF120 +AT91C_AIC_IECR.width=32 +AT91C_AIC_IECR.byteEndian=little +AT91C_AIC_IECR.type=enum +AT91C_AIC_IECR.enum.0.name=*** Write only *** +AT91C_AIC_IECR.enum.1.name=Error +AT91C_AIC_ISCR.name="AT91C_AIC_ISCR" +AT91C_AIC_ISCR.description="Interrupt Set Command Register" +AT91C_AIC_ISCR.helpkey="Interrupt Set Command Register" +AT91C_AIC_ISCR.access=memorymapped +AT91C_AIC_ISCR.address=0xFFFFF12C +AT91C_AIC_ISCR.width=32 +AT91C_AIC_ISCR.byteEndian=little +AT91C_AIC_ISCR.type=enum +AT91C_AIC_ISCR.enum.0.name=*** Write only *** +AT91C_AIC_ISCR.enum.1.name=Error +AT91C_AIC_FFDR.name="AT91C_AIC_FFDR" +AT91C_AIC_FFDR.description="Fast Forcing Disable Register" +AT91C_AIC_FFDR.helpkey="Fast Forcing Disable Register" +AT91C_AIC_FFDR.access=memorymapped +AT91C_AIC_FFDR.address=0xFFFFF144 +AT91C_AIC_FFDR.width=32 +AT91C_AIC_FFDR.byteEndian=little +AT91C_AIC_FFDR.type=enum +AT91C_AIC_FFDR.enum.0.name=*** Write only *** +AT91C_AIC_FFDR.enum.1.name=Error +AT91C_AIC_CISR.name="AT91C_AIC_CISR" +AT91C_AIC_CISR.description="Core Interrupt Status Register" +AT91C_AIC_CISR.helpkey="Core Interrupt Status Register" +AT91C_AIC_CISR.access=memorymapped +AT91C_AIC_CISR.address=0xFFFFF114 +AT91C_AIC_CISR.width=32 +AT91C_AIC_CISR.byteEndian=little +AT91C_AIC_CISR.permission.write=none +AT91C_AIC_IDCR.name="AT91C_AIC_IDCR" +AT91C_AIC_IDCR.description="Interrupt Disable Command Register" +AT91C_AIC_IDCR.helpkey="Interrupt Disable Command Register" +AT91C_AIC_IDCR.access=memorymapped +AT91C_AIC_IDCR.address=0xFFFFF124 +AT91C_AIC_IDCR.width=32 +AT91C_AIC_IDCR.byteEndian=little +AT91C_AIC_IDCR.type=enum +AT91C_AIC_IDCR.enum.0.name=*** Write only *** +AT91C_AIC_IDCR.enum.1.name=Error +AT91C_AIC_SPU.name="AT91C_AIC_SPU" +AT91C_AIC_SPU.description="Spurious Vector Register" +AT91C_AIC_SPU.helpkey="Spurious Vector Register" +AT91C_AIC_SPU.access=memorymapped +AT91C_AIC_SPU.address=0xFFFFF134 +AT91C_AIC_SPU.width=32 +AT91C_AIC_SPU.byteEndian=little +# ========== Register definition for PDC_DBGU peripheral ========== +AT91C_DBGU_TCR.name="AT91C_DBGU_TCR" +AT91C_DBGU_TCR.description="Transmit Counter Register" +AT91C_DBGU_TCR.helpkey="Transmit Counter Register" +AT91C_DBGU_TCR.access=memorymapped +AT91C_DBGU_TCR.address=0xFFFFF30C +AT91C_DBGU_TCR.width=32 +AT91C_DBGU_TCR.byteEndian=little +AT91C_DBGU_RNPR.name="AT91C_DBGU_RNPR" +AT91C_DBGU_RNPR.description="Receive Next Pointer Register" +AT91C_DBGU_RNPR.helpkey="Receive Next Pointer Register" +AT91C_DBGU_RNPR.access=memorymapped +AT91C_DBGU_RNPR.address=0xFFFFF310 +AT91C_DBGU_RNPR.width=32 +AT91C_DBGU_RNPR.byteEndian=little +AT91C_DBGU_TNPR.name="AT91C_DBGU_TNPR" +AT91C_DBGU_TNPR.description="Transmit Next Pointer Register" +AT91C_DBGU_TNPR.helpkey="Transmit Next Pointer Register" +AT91C_DBGU_TNPR.access=memorymapped +AT91C_DBGU_TNPR.address=0xFFFFF318 +AT91C_DBGU_TNPR.width=32 +AT91C_DBGU_TNPR.byteEndian=little +AT91C_DBGU_TPR.name="AT91C_DBGU_TPR" +AT91C_DBGU_TPR.description="Transmit Pointer Register" +AT91C_DBGU_TPR.helpkey="Transmit Pointer Register" +AT91C_DBGU_TPR.access=memorymapped +AT91C_DBGU_TPR.address=0xFFFFF308 +AT91C_DBGU_TPR.width=32 +AT91C_DBGU_TPR.byteEndian=little +AT91C_DBGU_RPR.name="AT91C_DBGU_RPR" +AT91C_DBGU_RPR.description="Receive Pointer Register" +AT91C_DBGU_RPR.helpkey="Receive Pointer Register" +AT91C_DBGU_RPR.access=memorymapped +AT91C_DBGU_RPR.address=0xFFFFF300 +AT91C_DBGU_RPR.width=32 +AT91C_DBGU_RPR.byteEndian=little +AT91C_DBGU_RCR.name="AT91C_DBGU_RCR" +AT91C_DBGU_RCR.description="Receive Counter Register" +AT91C_DBGU_RCR.helpkey="Receive Counter Register" +AT91C_DBGU_RCR.access=memorymapped +AT91C_DBGU_RCR.address=0xFFFFF304 +AT91C_DBGU_RCR.width=32 +AT91C_DBGU_RCR.byteEndian=little +AT91C_DBGU_RNCR.name="AT91C_DBGU_RNCR" +AT91C_DBGU_RNCR.description="Receive Next Counter Register" +AT91C_DBGU_RNCR.helpkey="Receive Next Counter Register" +AT91C_DBGU_RNCR.access=memorymapped +AT91C_DBGU_RNCR.address=0xFFFFF314 +AT91C_DBGU_RNCR.width=32 +AT91C_DBGU_RNCR.byteEndian=little +AT91C_DBGU_PTCR.name="AT91C_DBGU_PTCR" +AT91C_DBGU_PTCR.description="PDC Transfer Control Register" +AT91C_DBGU_PTCR.helpkey="PDC Transfer Control Register" +AT91C_DBGU_PTCR.access=memorymapped +AT91C_DBGU_PTCR.address=0xFFFFF320 +AT91C_DBGU_PTCR.width=32 +AT91C_DBGU_PTCR.byteEndian=little +AT91C_DBGU_PTCR.type=enum +AT91C_DBGU_PTCR.enum.0.name=*** Write only *** +AT91C_DBGU_PTCR.enum.1.name=Error +AT91C_DBGU_PTSR.name="AT91C_DBGU_PTSR" +AT91C_DBGU_PTSR.description="PDC Transfer Status Register" +AT91C_DBGU_PTSR.helpkey="PDC Transfer Status Register" +AT91C_DBGU_PTSR.access=memorymapped +AT91C_DBGU_PTSR.address=0xFFFFF324 +AT91C_DBGU_PTSR.width=32 +AT91C_DBGU_PTSR.byteEndian=little +AT91C_DBGU_PTSR.permission.write=none +AT91C_DBGU_TNCR.name="AT91C_DBGU_TNCR" +AT91C_DBGU_TNCR.description="Transmit Next Counter Register" +AT91C_DBGU_TNCR.helpkey="Transmit Next Counter Register" +AT91C_DBGU_TNCR.access=memorymapped +AT91C_DBGU_TNCR.address=0xFFFFF31C +AT91C_DBGU_TNCR.width=32 +AT91C_DBGU_TNCR.byteEndian=little +# ========== Register definition for DBGU peripheral ========== +AT91C_DBGU_EXID.name="AT91C_DBGU_EXID" +AT91C_DBGU_EXID.description="Chip ID Extension Register" +AT91C_DBGU_EXID.helpkey="Chip ID Extension Register" +AT91C_DBGU_EXID.access=memorymapped +AT91C_DBGU_EXID.address=0xFFFFF244 +AT91C_DBGU_EXID.width=32 +AT91C_DBGU_EXID.byteEndian=little +AT91C_DBGU_EXID.permission.write=none +AT91C_DBGU_BRGR.name="AT91C_DBGU_BRGR" +AT91C_DBGU_BRGR.description="Baud Rate Generator Register" +AT91C_DBGU_BRGR.helpkey="Baud Rate Generator Register" +AT91C_DBGU_BRGR.access=memorymapped +AT91C_DBGU_BRGR.address=0xFFFFF220 +AT91C_DBGU_BRGR.width=32 +AT91C_DBGU_BRGR.byteEndian=little +AT91C_DBGU_IDR.name="AT91C_DBGU_IDR" +AT91C_DBGU_IDR.description="Interrupt Disable Register" +AT91C_DBGU_IDR.helpkey="Interrupt Disable Register" +AT91C_DBGU_IDR.access=memorymapped +AT91C_DBGU_IDR.address=0xFFFFF20C +AT91C_DBGU_IDR.width=32 +AT91C_DBGU_IDR.byteEndian=little +AT91C_DBGU_IDR.type=enum +AT91C_DBGU_IDR.enum.0.name=*** Write only *** +AT91C_DBGU_IDR.enum.1.name=Error +AT91C_DBGU_CSR.name="AT91C_DBGU_CSR" +AT91C_DBGU_CSR.description="Channel Status Register" +AT91C_DBGU_CSR.helpkey="Channel Status Register" +AT91C_DBGU_CSR.access=memorymapped +AT91C_DBGU_CSR.address=0xFFFFF214 +AT91C_DBGU_CSR.width=32 +AT91C_DBGU_CSR.byteEndian=little +AT91C_DBGU_CSR.permission.write=none +AT91C_DBGU_CIDR.name="AT91C_DBGU_CIDR" +AT91C_DBGU_CIDR.description="Chip ID Register" +AT91C_DBGU_CIDR.helpkey="Chip ID Register" +AT91C_DBGU_CIDR.access=memorymapped +AT91C_DBGU_CIDR.address=0xFFFFF240 +AT91C_DBGU_CIDR.width=32 +AT91C_DBGU_CIDR.byteEndian=little +AT91C_DBGU_CIDR.permission.write=none +AT91C_DBGU_MR.name="AT91C_DBGU_MR" +AT91C_DBGU_MR.description="Mode Register" +AT91C_DBGU_MR.helpkey="Mode Register" +AT91C_DBGU_MR.access=memorymapped +AT91C_DBGU_MR.address=0xFFFFF204 +AT91C_DBGU_MR.width=32 +AT91C_DBGU_MR.byteEndian=little +AT91C_DBGU_IMR.name="AT91C_DBGU_IMR" +AT91C_DBGU_IMR.description="Interrupt Mask Register" +AT91C_DBGU_IMR.helpkey="Interrupt Mask Register" +AT91C_DBGU_IMR.access=memorymapped +AT91C_DBGU_IMR.address=0xFFFFF210 +AT91C_DBGU_IMR.width=32 +AT91C_DBGU_IMR.byteEndian=little +AT91C_DBGU_IMR.permission.write=none +AT91C_DBGU_CR.name="AT91C_DBGU_CR" +AT91C_DBGU_CR.description="Control Register" +AT91C_DBGU_CR.helpkey="Control Register" +AT91C_DBGU_CR.access=memorymapped +AT91C_DBGU_CR.address=0xFFFFF200 +AT91C_DBGU_CR.width=32 +AT91C_DBGU_CR.byteEndian=little +AT91C_DBGU_CR.type=enum +AT91C_DBGU_CR.enum.0.name=*** Write only *** +AT91C_DBGU_CR.enum.1.name=Error +AT91C_DBGU_FNTR.name="AT91C_DBGU_FNTR" +AT91C_DBGU_FNTR.description="Force NTRST Register" +AT91C_DBGU_FNTR.helpkey="Force NTRST Register" +AT91C_DBGU_FNTR.access=memorymapped +AT91C_DBGU_FNTR.address=0xFFFFF248 +AT91C_DBGU_FNTR.width=32 +AT91C_DBGU_FNTR.byteEndian=little +AT91C_DBGU_THR.name="AT91C_DBGU_THR" +AT91C_DBGU_THR.description="Transmitter Holding Register" +AT91C_DBGU_THR.helpkey="Transmitter Holding Register" +AT91C_DBGU_THR.access=memorymapped +AT91C_DBGU_THR.address=0xFFFFF21C +AT91C_DBGU_THR.width=32 +AT91C_DBGU_THR.byteEndian=little +AT91C_DBGU_THR.type=enum +AT91C_DBGU_THR.enum.0.name=*** Write only *** +AT91C_DBGU_THR.enum.1.name=Error +AT91C_DBGU_RHR.name="AT91C_DBGU_RHR" +AT91C_DBGU_RHR.description="Receiver Holding Register" +AT91C_DBGU_RHR.helpkey="Receiver Holding Register" +AT91C_DBGU_RHR.access=memorymapped +AT91C_DBGU_RHR.address=0xFFFFF218 +AT91C_DBGU_RHR.width=32 +AT91C_DBGU_RHR.byteEndian=little +AT91C_DBGU_RHR.permission.write=none +AT91C_DBGU_IER.name="AT91C_DBGU_IER" +AT91C_DBGU_IER.description="Interrupt Enable Register" +AT91C_DBGU_IER.helpkey="Interrupt Enable Register" +AT91C_DBGU_IER.access=memorymapped +AT91C_DBGU_IER.address=0xFFFFF208 +AT91C_DBGU_IER.width=32 +AT91C_DBGU_IER.byteEndian=little +AT91C_DBGU_IER.type=enum +AT91C_DBGU_IER.enum.0.name=*** Write only *** +AT91C_DBGU_IER.enum.1.name=Error +# ========== Register definition for PIOA peripheral ========== +AT91C_PIOA_ODR.name="AT91C_PIOA_ODR" +AT91C_PIOA_ODR.description="Output Disable Registerr" +AT91C_PIOA_ODR.helpkey="Output Disable Registerr" +AT91C_PIOA_ODR.access=memorymapped +AT91C_PIOA_ODR.address=0xFFFFF414 +AT91C_PIOA_ODR.width=32 +AT91C_PIOA_ODR.byteEndian=little +AT91C_PIOA_ODR.type=enum +AT91C_PIOA_ODR.enum.0.name=*** Write only *** +AT91C_PIOA_ODR.enum.1.name=Error +AT91C_PIOA_SODR.name="AT91C_PIOA_SODR" +AT91C_PIOA_SODR.description="Set Output Data Register" +AT91C_PIOA_SODR.helpkey="Set Output Data Register" +AT91C_PIOA_SODR.access=memorymapped +AT91C_PIOA_SODR.address=0xFFFFF430 +AT91C_PIOA_SODR.width=32 +AT91C_PIOA_SODR.byteEndian=little +AT91C_PIOA_SODR.type=enum +AT91C_PIOA_SODR.enum.0.name=*** Write only *** +AT91C_PIOA_SODR.enum.1.name=Error +AT91C_PIOA_ISR.name="AT91C_PIOA_ISR" +AT91C_PIOA_ISR.description="Interrupt Status Register" +AT91C_PIOA_ISR.helpkey="Interrupt Status Register" +AT91C_PIOA_ISR.access=memorymapped +AT91C_PIOA_ISR.address=0xFFFFF44C +AT91C_PIOA_ISR.width=32 +AT91C_PIOA_ISR.byteEndian=little +AT91C_PIOA_ISR.permission.write=none +AT91C_PIOA_ABSR.name="AT91C_PIOA_ABSR" +AT91C_PIOA_ABSR.description="AB Select Status Register" +AT91C_PIOA_ABSR.helpkey="AB Select Status Register" +AT91C_PIOA_ABSR.access=memorymapped +AT91C_PIOA_ABSR.address=0xFFFFF478 +AT91C_PIOA_ABSR.width=32 +AT91C_PIOA_ABSR.byteEndian=little +AT91C_PIOA_ABSR.permission.write=none +AT91C_PIOA_IER.name="AT91C_PIOA_IER" +AT91C_PIOA_IER.description="Interrupt Enable Register" +AT91C_PIOA_IER.helpkey="Interrupt Enable Register" +AT91C_PIOA_IER.access=memorymapped +AT91C_PIOA_IER.address=0xFFFFF440 +AT91C_PIOA_IER.width=32 +AT91C_PIOA_IER.byteEndian=little +AT91C_PIOA_IER.type=enum +AT91C_PIOA_IER.enum.0.name=*** Write only *** +AT91C_PIOA_IER.enum.1.name=Error +AT91C_PIOA_PPUDR.name="AT91C_PIOA_PPUDR" +AT91C_PIOA_PPUDR.description="Pull-up Disable Register" +AT91C_PIOA_PPUDR.helpkey="Pull-up Disable Register" +AT91C_PIOA_PPUDR.access=memorymapped +AT91C_PIOA_PPUDR.address=0xFFFFF460 +AT91C_PIOA_PPUDR.width=32 +AT91C_PIOA_PPUDR.byteEndian=little +AT91C_PIOA_PPUDR.type=enum +AT91C_PIOA_PPUDR.enum.0.name=*** Write only *** +AT91C_PIOA_PPUDR.enum.1.name=Error +AT91C_PIOA_IMR.name="AT91C_PIOA_IMR" +AT91C_PIOA_IMR.description="Interrupt Mask Register" +AT91C_PIOA_IMR.helpkey="Interrupt Mask Register" +AT91C_PIOA_IMR.access=memorymapped +AT91C_PIOA_IMR.address=0xFFFFF448 +AT91C_PIOA_IMR.width=32 +AT91C_PIOA_IMR.byteEndian=little +AT91C_PIOA_IMR.permission.write=none +AT91C_PIOA_PER.name="AT91C_PIOA_PER" +AT91C_PIOA_PER.description="PIO Enable Register" +AT91C_PIOA_PER.helpkey="PIO Enable Register" +AT91C_PIOA_PER.access=memorymapped +AT91C_PIOA_PER.address=0xFFFFF400 +AT91C_PIOA_PER.width=32 +AT91C_PIOA_PER.byteEndian=little +AT91C_PIOA_PER.type=enum +AT91C_PIOA_PER.enum.0.name=*** Write only *** +AT91C_PIOA_PER.enum.1.name=Error +AT91C_PIOA_IFDR.name="AT91C_PIOA_IFDR" +AT91C_PIOA_IFDR.description="Input Filter Disable Register" +AT91C_PIOA_IFDR.helpkey="Input Filter Disable Register" +AT91C_PIOA_IFDR.access=memorymapped +AT91C_PIOA_IFDR.address=0xFFFFF424 +AT91C_PIOA_IFDR.width=32 +AT91C_PIOA_IFDR.byteEndian=little +AT91C_PIOA_IFDR.type=enum +AT91C_PIOA_IFDR.enum.0.name=*** Write only *** +AT91C_PIOA_IFDR.enum.1.name=Error +AT91C_PIOA_OWDR.name="AT91C_PIOA_OWDR" +AT91C_PIOA_OWDR.description="Output Write Disable Register" +AT91C_PIOA_OWDR.helpkey="Output Write Disable Register" +AT91C_PIOA_OWDR.access=memorymapped +AT91C_PIOA_OWDR.address=0xFFFFF4A4 +AT91C_PIOA_OWDR.width=32 +AT91C_PIOA_OWDR.byteEndian=little +AT91C_PIOA_OWDR.type=enum +AT91C_PIOA_OWDR.enum.0.name=*** Write only *** +AT91C_PIOA_OWDR.enum.1.name=Error +AT91C_PIOA_MDSR.name="AT91C_PIOA_MDSR" +AT91C_PIOA_MDSR.description="Multi-driver Status Register" +AT91C_PIOA_MDSR.helpkey="Multi-driver Status Register" +AT91C_PIOA_MDSR.access=memorymapped +AT91C_PIOA_MDSR.address=0xFFFFF458 +AT91C_PIOA_MDSR.width=32 +AT91C_PIOA_MDSR.byteEndian=little +AT91C_PIOA_MDSR.permission.write=none +AT91C_PIOA_IDR.name="AT91C_PIOA_IDR" +AT91C_PIOA_IDR.description="Interrupt Disable Register" +AT91C_PIOA_IDR.helpkey="Interrupt Disable Register" +AT91C_PIOA_IDR.access=memorymapped +AT91C_PIOA_IDR.address=0xFFFFF444 +AT91C_PIOA_IDR.width=32 +AT91C_PIOA_IDR.byteEndian=little +AT91C_PIOA_IDR.type=enum +AT91C_PIOA_IDR.enum.0.name=*** Write only *** +AT91C_PIOA_IDR.enum.1.name=Error +AT91C_PIOA_ODSR.name="AT91C_PIOA_ODSR" +AT91C_PIOA_ODSR.description="Output Data Status Register" +AT91C_PIOA_ODSR.helpkey="Output Data Status Register" +AT91C_PIOA_ODSR.access=memorymapped +AT91C_PIOA_ODSR.address=0xFFFFF438 +AT91C_PIOA_ODSR.width=32 +AT91C_PIOA_ODSR.byteEndian=little +AT91C_PIOA_ODSR.permission.write=none +AT91C_PIOA_PPUSR.name="AT91C_PIOA_PPUSR" +AT91C_PIOA_PPUSR.description="Pull-up Status Register" +AT91C_PIOA_PPUSR.helpkey="Pull-up Status Register" +AT91C_PIOA_PPUSR.access=memorymapped +AT91C_PIOA_PPUSR.address=0xFFFFF468 +AT91C_PIOA_PPUSR.width=32 +AT91C_PIOA_PPUSR.byteEndian=little +AT91C_PIOA_PPUSR.permission.write=none +AT91C_PIOA_OWSR.name="AT91C_PIOA_OWSR" +AT91C_PIOA_OWSR.description="Output Write Status Register" +AT91C_PIOA_OWSR.helpkey="Output Write Status Register" +AT91C_PIOA_OWSR.access=memorymapped +AT91C_PIOA_OWSR.address=0xFFFFF4A8 +AT91C_PIOA_OWSR.width=32 +AT91C_PIOA_OWSR.byteEndian=little +AT91C_PIOA_OWSR.permission.write=none +AT91C_PIOA_BSR.name="AT91C_PIOA_BSR" +AT91C_PIOA_BSR.description="Select B Register" +AT91C_PIOA_BSR.helpkey="Select B Register" +AT91C_PIOA_BSR.access=memorymapped +AT91C_PIOA_BSR.address=0xFFFFF474 +AT91C_PIOA_BSR.width=32 +AT91C_PIOA_BSR.byteEndian=little +AT91C_PIOA_BSR.type=enum +AT91C_PIOA_BSR.enum.0.name=*** Write only *** +AT91C_PIOA_BSR.enum.1.name=Error +AT91C_PIOA_OWER.name="AT91C_PIOA_OWER" +AT91C_PIOA_OWER.description="Output Write Enable Register" +AT91C_PIOA_OWER.helpkey="Output Write Enable Register" +AT91C_PIOA_OWER.access=memorymapped +AT91C_PIOA_OWER.address=0xFFFFF4A0 +AT91C_PIOA_OWER.width=32 +AT91C_PIOA_OWER.byteEndian=little +AT91C_PIOA_OWER.type=enum +AT91C_PIOA_OWER.enum.0.name=*** Write only *** +AT91C_PIOA_OWER.enum.1.name=Error +AT91C_PIOA_IFER.name="AT91C_PIOA_IFER" +AT91C_PIOA_IFER.description="Input Filter Enable Register" +AT91C_PIOA_IFER.helpkey="Input Filter Enable Register" +AT91C_PIOA_IFER.access=memorymapped +AT91C_PIOA_IFER.address=0xFFFFF420 +AT91C_PIOA_IFER.width=32 +AT91C_PIOA_IFER.byteEndian=little +AT91C_PIOA_IFER.type=enum +AT91C_PIOA_IFER.enum.0.name=*** Write only *** +AT91C_PIOA_IFER.enum.1.name=Error +AT91C_PIOA_PDSR.name="AT91C_PIOA_PDSR" +AT91C_PIOA_PDSR.description="Pin Data Status Register" +AT91C_PIOA_PDSR.helpkey="Pin Data Status Register" +AT91C_PIOA_PDSR.access=memorymapped +AT91C_PIOA_PDSR.address=0xFFFFF43C +AT91C_PIOA_PDSR.width=32 +AT91C_PIOA_PDSR.byteEndian=little +AT91C_PIOA_PDSR.permission.write=none +AT91C_PIOA_PPUER.name="AT91C_PIOA_PPUER" +AT91C_PIOA_PPUER.description="Pull-up Enable Register" +AT91C_PIOA_PPUER.helpkey="Pull-up Enable Register" +AT91C_PIOA_PPUER.access=memorymapped +AT91C_PIOA_PPUER.address=0xFFFFF464 +AT91C_PIOA_PPUER.width=32 +AT91C_PIOA_PPUER.byteEndian=little +AT91C_PIOA_PPUER.type=enum +AT91C_PIOA_PPUER.enum.0.name=*** Write only *** +AT91C_PIOA_PPUER.enum.1.name=Error +AT91C_PIOA_OSR.name="AT91C_PIOA_OSR" +AT91C_PIOA_OSR.description="Output Status Register" +AT91C_PIOA_OSR.helpkey="Output Status Register" +AT91C_PIOA_OSR.access=memorymapped +AT91C_PIOA_OSR.address=0xFFFFF418 +AT91C_PIOA_OSR.width=32 +AT91C_PIOA_OSR.byteEndian=little +AT91C_PIOA_OSR.permission.write=none +AT91C_PIOA_ASR.name="AT91C_PIOA_ASR" +AT91C_PIOA_ASR.description="Select A Register" +AT91C_PIOA_ASR.helpkey="Select A Register" +AT91C_PIOA_ASR.access=memorymapped +AT91C_PIOA_ASR.address=0xFFFFF470 +AT91C_PIOA_ASR.width=32 +AT91C_PIOA_ASR.byteEndian=little +AT91C_PIOA_ASR.type=enum +AT91C_PIOA_ASR.enum.0.name=*** Write only *** +AT91C_PIOA_ASR.enum.1.name=Error +AT91C_PIOA_MDDR.name="AT91C_PIOA_MDDR" +AT91C_PIOA_MDDR.description="Multi-driver Disable Register" +AT91C_PIOA_MDDR.helpkey="Multi-driver Disable Register" +AT91C_PIOA_MDDR.access=memorymapped +AT91C_PIOA_MDDR.address=0xFFFFF454 +AT91C_PIOA_MDDR.width=32 +AT91C_PIOA_MDDR.byteEndian=little +AT91C_PIOA_MDDR.type=enum +AT91C_PIOA_MDDR.enum.0.name=*** Write only *** +AT91C_PIOA_MDDR.enum.1.name=Error +AT91C_PIOA_CODR.name="AT91C_PIOA_CODR" +AT91C_PIOA_CODR.description="Clear Output Data Register" +AT91C_PIOA_CODR.helpkey="Clear Output Data Register" +AT91C_PIOA_CODR.access=memorymapped +AT91C_PIOA_CODR.address=0xFFFFF434 +AT91C_PIOA_CODR.width=32 +AT91C_PIOA_CODR.byteEndian=little +AT91C_PIOA_CODR.type=enum +AT91C_PIOA_CODR.enum.0.name=*** Write only *** +AT91C_PIOA_CODR.enum.1.name=Error +AT91C_PIOA_MDER.name="AT91C_PIOA_MDER" +AT91C_PIOA_MDER.description="Multi-driver Enable Register" +AT91C_PIOA_MDER.helpkey="Multi-driver Enable Register" +AT91C_PIOA_MDER.access=memorymapped +AT91C_PIOA_MDER.address=0xFFFFF450 +AT91C_PIOA_MDER.width=32 +AT91C_PIOA_MDER.byteEndian=little +AT91C_PIOA_MDER.type=enum +AT91C_PIOA_MDER.enum.0.name=*** Write only *** +AT91C_PIOA_MDER.enum.1.name=Error +AT91C_PIOA_PDR.name="AT91C_PIOA_PDR" +AT91C_PIOA_PDR.description="PIO Disable Register" +AT91C_PIOA_PDR.helpkey="PIO Disable Register" +AT91C_PIOA_PDR.access=memorymapped +AT91C_PIOA_PDR.address=0xFFFFF404 +AT91C_PIOA_PDR.width=32 +AT91C_PIOA_PDR.byteEndian=little +AT91C_PIOA_PDR.type=enum +AT91C_PIOA_PDR.enum.0.name=*** Write only *** +AT91C_PIOA_PDR.enum.1.name=Error +AT91C_PIOA_IFSR.name="AT91C_PIOA_IFSR" +AT91C_PIOA_IFSR.description="Input Filter Status Register" +AT91C_PIOA_IFSR.helpkey="Input Filter Status Register" +AT91C_PIOA_IFSR.access=memorymapped +AT91C_PIOA_IFSR.address=0xFFFFF428 +AT91C_PIOA_IFSR.width=32 +AT91C_PIOA_IFSR.byteEndian=little +AT91C_PIOA_IFSR.permission.write=none +AT91C_PIOA_OER.name="AT91C_PIOA_OER" +AT91C_PIOA_OER.description="Output Enable Register" +AT91C_PIOA_OER.helpkey="Output Enable Register" +AT91C_PIOA_OER.access=memorymapped +AT91C_PIOA_OER.address=0xFFFFF410 +AT91C_PIOA_OER.width=32 +AT91C_PIOA_OER.byteEndian=little +AT91C_PIOA_OER.type=enum +AT91C_PIOA_OER.enum.0.name=*** Write only *** +AT91C_PIOA_OER.enum.1.name=Error +AT91C_PIOA_PSR.name="AT91C_PIOA_PSR" +AT91C_PIOA_PSR.description="PIO Status Register" +AT91C_PIOA_PSR.helpkey="PIO Status Register" +AT91C_PIOA_PSR.access=memorymapped +AT91C_PIOA_PSR.address=0xFFFFF408 +AT91C_PIOA_PSR.width=32 +AT91C_PIOA_PSR.byteEndian=little +AT91C_PIOA_PSR.permission.write=none +# ========== Register definition for PIOB peripheral ========== +AT91C_PIOB_OWDR.name="AT91C_PIOB_OWDR" +AT91C_PIOB_OWDR.description="Output Write Disable Register" +AT91C_PIOB_OWDR.helpkey="Output Write Disable Register" +AT91C_PIOB_OWDR.access=memorymapped +AT91C_PIOB_OWDR.address=0xFFFFF6A4 +AT91C_PIOB_OWDR.width=32 +AT91C_PIOB_OWDR.byteEndian=little +AT91C_PIOB_OWDR.type=enum +AT91C_PIOB_OWDR.enum.0.name=*** Write only *** +AT91C_PIOB_OWDR.enum.1.name=Error +AT91C_PIOB_MDER.name="AT91C_PIOB_MDER" +AT91C_PIOB_MDER.description="Multi-driver Enable Register" +AT91C_PIOB_MDER.helpkey="Multi-driver Enable Register" +AT91C_PIOB_MDER.access=memorymapped +AT91C_PIOB_MDER.address=0xFFFFF650 +AT91C_PIOB_MDER.width=32 +AT91C_PIOB_MDER.byteEndian=little +AT91C_PIOB_MDER.type=enum +AT91C_PIOB_MDER.enum.0.name=*** Write only *** +AT91C_PIOB_MDER.enum.1.name=Error +AT91C_PIOB_PPUSR.name="AT91C_PIOB_PPUSR" +AT91C_PIOB_PPUSR.description="Pull-up Status Register" +AT91C_PIOB_PPUSR.helpkey="Pull-up Status Register" +AT91C_PIOB_PPUSR.access=memorymapped +AT91C_PIOB_PPUSR.address=0xFFFFF668 +AT91C_PIOB_PPUSR.width=32 +AT91C_PIOB_PPUSR.byteEndian=little +AT91C_PIOB_PPUSR.permission.write=none +AT91C_PIOB_IMR.name="AT91C_PIOB_IMR" +AT91C_PIOB_IMR.description="Interrupt Mask Register" +AT91C_PIOB_IMR.helpkey="Interrupt Mask Register" +AT91C_PIOB_IMR.access=memorymapped +AT91C_PIOB_IMR.address=0xFFFFF648 +AT91C_PIOB_IMR.width=32 +AT91C_PIOB_IMR.byteEndian=little +AT91C_PIOB_IMR.permission.write=none +AT91C_PIOB_ASR.name="AT91C_PIOB_ASR" +AT91C_PIOB_ASR.description="Select A Register" +AT91C_PIOB_ASR.helpkey="Select A Register" +AT91C_PIOB_ASR.access=memorymapped +AT91C_PIOB_ASR.address=0xFFFFF670 +AT91C_PIOB_ASR.width=32 +AT91C_PIOB_ASR.byteEndian=little +AT91C_PIOB_ASR.type=enum +AT91C_PIOB_ASR.enum.0.name=*** Write only *** +AT91C_PIOB_ASR.enum.1.name=Error +AT91C_PIOB_PPUDR.name="AT91C_PIOB_PPUDR" +AT91C_PIOB_PPUDR.description="Pull-up Disable Register" +AT91C_PIOB_PPUDR.helpkey="Pull-up Disable Register" +AT91C_PIOB_PPUDR.access=memorymapped +AT91C_PIOB_PPUDR.address=0xFFFFF660 +AT91C_PIOB_PPUDR.width=32 +AT91C_PIOB_PPUDR.byteEndian=little +AT91C_PIOB_PPUDR.type=enum +AT91C_PIOB_PPUDR.enum.0.name=*** Write only *** +AT91C_PIOB_PPUDR.enum.1.name=Error +AT91C_PIOB_PSR.name="AT91C_PIOB_PSR" +AT91C_PIOB_PSR.description="PIO Status Register" +AT91C_PIOB_PSR.helpkey="PIO Status Register" +AT91C_PIOB_PSR.access=memorymapped +AT91C_PIOB_PSR.address=0xFFFFF608 +AT91C_PIOB_PSR.width=32 +AT91C_PIOB_PSR.byteEndian=little +AT91C_PIOB_PSR.permission.write=none +AT91C_PIOB_IER.name="AT91C_PIOB_IER" +AT91C_PIOB_IER.description="Interrupt Enable Register" +AT91C_PIOB_IER.helpkey="Interrupt Enable Register" +AT91C_PIOB_IER.access=memorymapped +AT91C_PIOB_IER.address=0xFFFFF640 +AT91C_PIOB_IER.width=32 +AT91C_PIOB_IER.byteEndian=little +AT91C_PIOB_IER.type=enum +AT91C_PIOB_IER.enum.0.name=*** Write only *** +AT91C_PIOB_IER.enum.1.name=Error +AT91C_PIOB_CODR.name="AT91C_PIOB_CODR" +AT91C_PIOB_CODR.description="Clear Output Data Register" +AT91C_PIOB_CODR.helpkey="Clear Output Data Register" +AT91C_PIOB_CODR.access=memorymapped +AT91C_PIOB_CODR.address=0xFFFFF634 +AT91C_PIOB_CODR.width=32 +AT91C_PIOB_CODR.byteEndian=little +AT91C_PIOB_CODR.type=enum +AT91C_PIOB_CODR.enum.0.name=*** Write only *** +AT91C_PIOB_CODR.enum.1.name=Error +AT91C_PIOB_OWER.name="AT91C_PIOB_OWER" +AT91C_PIOB_OWER.description="Output Write Enable Register" +AT91C_PIOB_OWER.helpkey="Output Write Enable Register" +AT91C_PIOB_OWER.access=memorymapped +AT91C_PIOB_OWER.address=0xFFFFF6A0 +AT91C_PIOB_OWER.width=32 +AT91C_PIOB_OWER.byteEndian=little +AT91C_PIOB_OWER.type=enum +AT91C_PIOB_OWER.enum.0.name=*** Write only *** +AT91C_PIOB_OWER.enum.1.name=Error +AT91C_PIOB_ABSR.name="AT91C_PIOB_ABSR" +AT91C_PIOB_ABSR.description="AB Select Status Register" +AT91C_PIOB_ABSR.helpkey="AB Select Status Register" +AT91C_PIOB_ABSR.access=memorymapped +AT91C_PIOB_ABSR.address=0xFFFFF678 +AT91C_PIOB_ABSR.width=32 +AT91C_PIOB_ABSR.byteEndian=little +AT91C_PIOB_ABSR.permission.write=none +AT91C_PIOB_IFDR.name="AT91C_PIOB_IFDR" +AT91C_PIOB_IFDR.description="Input Filter Disable Register" +AT91C_PIOB_IFDR.helpkey="Input Filter Disable Register" +AT91C_PIOB_IFDR.access=memorymapped +AT91C_PIOB_IFDR.address=0xFFFFF624 +AT91C_PIOB_IFDR.width=32 +AT91C_PIOB_IFDR.byteEndian=little +AT91C_PIOB_IFDR.type=enum +AT91C_PIOB_IFDR.enum.0.name=*** Write only *** +AT91C_PIOB_IFDR.enum.1.name=Error +AT91C_PIOB_PDSR.name="AT91C_PIOB_PDSR" +AT91C_PIOB_PDSR.description="Pin Data Status Register" +AT91C_PIOB_PDSR.helpkey="Pin Data Status Register" +AT91C_PIOB_PDSR.access=memorymapped +AT91C_PIOB_PDSR.address=0xFFFFF63C +AT91C_PIOB_PDSR.width=32 +AT91C_PIOB_PDSR.byteEndian=little +AT91C_PIOB_PDSR.permission.write=none +AT91C_PIOB_IDR.name="AT91C_PIOB_IDR" +AT91C_PIOB_IDR.description="Interrupt Disable Register" +AT91C_PIOB_IDR.helpkey="Interrupt Disable Register" +AT91C_PIOB_IDR.access=memorymapped +AT91C_PIOB_IDR.address=0xFFFFF644 +AT91C_PIOB_IDR.width=32 +AT91C_PIOB_IDR.byteEndian=little +AT91C_PIOB_IDR.type=enum +AT91C_PIOB_IDR.enum.0.name=*** Write only *** +AT91C_PIOB_IDR.enum.1.name=Error +AT91C_PIOB_OWSR.name="AT91C_PIOB_OWSR" +AT91C_PIOB_OWSR.description="Output Write Status Register" +AT91C_PIOB_OWSR.helpkey="Output Write Status Register" +AT91C_PIOB_OWSR.access=memorymapped +AT91C_PIOB_OWSR.address=0xFFFFF6A8 +AT91C_PIOB_OWSR.width=32 +AT91C_PIOB_OWSR.byteEndian=little +AT91C_PIOB_OWSR.permission.write=none +AT91C_PIOB_PDR.name="AT91C_PIOB_PDR" +AT91C_PIOB_PDR.description="PIO Disable Register" +AT91C_PIOB_PDR.helpkey="PIO Disable Register" +AT91C_PIOB_PDR.access=memorymapped +AT91C_PIOB_PDR.address=0xFFFFF604 +AT91C_PIOB_PDR.width=32 +AT91C_PIOB_PDR.byteEndian=little +AT91C_PIOB_PDR.type=enum +AT91C_PIOB_PDR.enum.0.name=*** Write only *** +AT91C_PIOB_PDR.enum.1.name=Error +AT91C_PIOB_ODR.name="AT91C_PIOB_ODR" +AT91C_PIOB_ODR.description="Output Disable Registerr" +AT91C_PIOB_ODR.helpkey="Output Disable Registerr" +AT91C_PIOB_ODR.access=memorymapped +AT91C_PIOB_ODR.address=0xFFFFF614 +AT91C_PIOB_ODR.width=32 +AT91C_PIOB_ODR.byteEndian=little +AT91C_PIOB_ODR.type=enum +AT91C_PIOB_ODR.enum.0.name=*** Write only *** +AT91C_PIOB_ODR.enum.1.name=Error +AT91C_PIOB_IFSR.name="AT91C_PIOB_IFSR" +AT91C_PIOB_IFSR.description="Input Filter Status Register" +AT91C_PIOB_IFSR.helpkey="Input Filter Status Register" +AT91C_PIOB_IFSR.access=memorymapped +AT91C_PIOB_IFSR.address=0xFFFFF628 +AT91C_PIOB_IFSR.width=32 +AT91C_PIOB_IFSR.byteEndian=little +AT91C_PIOB_IFSR.permission.write=none +AT91C_PIOB_PPUER.name="AT91C_PIOB_PPUER" +AT91C_PIOB_PPUER.description="Pull-up Enable Register" +AT91C_PIOB_PPUER.helpkey="Pull-up Enable Register" +AT91C_PIOB_PPUER.access=memorymapped +AT91C_PIOB_PPUER.address=0xFFFFF664 +AT91C_PIOB_PPUER.width=32 +AT91C_PIOB_PPUER.byteEndian=little +AT91C_PIOB_PPUER.type=enum +AT91C_PIOB_PPUER.enum.0.name=*** Write only *** +AT91C_PIOB_PPUER.enum.1.name=Error +AT91C_PIOB_SODR.name="AT91C_PIOB_SODR" +AT91C_PIOB_SODR.description="Set Output Data Register" +AT91C_PIOB_SODR.helpkey="Set Output Data Register" +AT91C_PIOB_SODR.access=memorymapped +AT91C_PIOB_SODR.address=0xFFFFF630 +AT91C_PIOB_SODR.width=32 +AT91C_PIOB_SODR.byteEndian=little +AT91C_PIOB_SODR.type=enum +AT91C_PIOB_SODR.enum.0.name=*** Write only *** +AT91C_PIOB_SODR.enum.1.name=Error +AT91C_PIOB_ISR.name="AT91C_PIOB_ISR" +AT91C_PIOB_ISR.description="Interrupt Status Register" +AT91C_PIOB_ISR.helpkey="Interrupt Status Register" +AT91C_PIOB_ISR.access=memorymapped +AT91C_PIOB_ISR.address=0xFFFFF64C +AT91C_PIOB_ISR.width=32 +AT91C_PIOB_ISR.byteEndian=little +AT91C_PIOB_ISR.permission.write=none +AT91C_PIOB_ODSR.name="AT91C_PIOB_ODSR" +AT91C_PIOB_ODSR.description="Output Data Status Register" +AT91C_PIOB_ODSR.helpkey="Output Data Status Register" +AT91C_PIOB_ODSR.access=memorymapped +AT91C_PIOB_ODSR.address=0xFFFFF638 +AT91C_PIOB_ODSR.width=32 +AT91C_PIOB_ODSR.byteEndian=little +AT91C_PIOB_ODSR.permission.write=none +AT91C_PIOB_OSR.name="AT91C_PIOB_OSR" +AT91C_PIOB_OSR.description="Output Status Register" +AT91C_PIOB_OSR.helpkey="Output Status Register" +AT91C_PIOB_OSR.access=memorymapped +AT91C_PIOB_OSR.address=0xFFFFF618 +AT91C_PIOB_OSR.width=32 +AT91C_PIOB_OSR.byteEndian=little +AT91C_PIOB_OSR.permission.write=none +AT91C_PIOB_MDSR.name="AT91C_PIOB_MDSR" +AT91C_PIOB_MDSR.description="Multi-driver Status Register" +AT91C_PIOB_MDSR.helpkey="Multi-driver Status Register" +AT91C_PIOB_MDSR.access=memorymapped +AT91C_PIOB_MDSR.address=0xFFFFF658 +AT91C_PIOB_MDSR.width=32 +AT91C_PIOB_MDSR.byteEndian=little +AT91C_PIOB_MDSR.permission.write=none +AT91C_PIOB_IFER.name="AT91C_PIOB_IFER" +AT91C_PIOB_IFER.description="Input Filter Enable Register" +AT91C_PIOB_IFER.helpkey="Input Filter Enable Register" +AT91C_PIOB_IFER.access=memorymapped +AT91C_PIOB_IFER.address=0xFFFFF620 +AT91C_PIOB_IFER.width=32 +AT91C_PIOB_IFER.byteEndian=little +AT91C_PIOB_IFER.type=enum +AT91C_PIOB_IFER.enum.0.name=*** Write only *** +AT91C_PIOB_IFER.enum.1.name=Error +AT91C_PIOB_BSR.name="AT91C_PIOB_BSR" +AT91C_PIOB_BSR.description="Select B Register" +AT91C_PIOB_BSR.helpkey="Select B Register" +AT91C_PIOB_BSR.access=memorymapped +AT91C_PIOB_BSR.address=0xFFFFF674 +AT91C_PIOB_BSR.width=32 +AT91C_PIOB_BSR.byteEndian=little +AT91C_PIOB_BSR.type=enum +AT91C_PIOB_BSR.enum.0.name=*** Write only *** +AT91C_PIOB_BSR.enum.1.name=Error +AT91C_PIOB_MDDR.name="AT91C_PIOB_MDDR" +AT91C_PIOB_MDDR.description="Multi-driver Disable Register" +AT91C_PIOB_MDDR.helpkey="Multi-driver Disable Register" +AT91C_PIOB_MDDR.access=memorymapped +AT91C_PIOB_MDDR.address=0xFFFFF654 +AT91C_PIOB_MDDR.width=32 +AT91C_PIOB_MDDR.byteEndian=little +AT91C_PIOB_MDDR.type=enum +AT91C_PIOB_MDDR.enum.0.name=*** Write only *** +AT91C_PIOB_MDDR.enum.1.name=Error +AT91C_PIOB_OER.name="AT91C_PIOB_OER" +AT91C_PIOB_OER.description="Output Enable Register" +AT91C_PIOB_OER.helpkey="Output Enable Register" +AT91C_PIOB_OER.access=memorymapped +AT91C_PIOB_OER.address=0xFFFFF610 +AT91C_PIOB_OER.width=32 +AT91C_PIOB_OER.byteEndian=little +AT91C_PIOB_OER.type=enum +AT91C_PIOB_OER.enum.0.name=*** Write only *** +AT91C_PIOB_OER.enum.1.name=Error +AT91C_PIOB_PER.name="AT91C_PIOB_PER" +AT91C_PIOB_PER.description="PIO Enable Register" +AT91C_PIOB_PER.helpkey="PIO Enable Register" +AT91C_PIOB_PER.access=memorymapped +AT91C_PIOB_PER.address=0xFFFFF600 +AT91C_PIOB_PER.width=32 +AT91C_PIOB_PER.byteEndian=little +AT91C_PIOB_PER.type=enum +AT91C_PIOB_PER.enum.0.name=*** Write only *** +AT91C_PIOB_PER.enum.1.name=Error +# ========== Register definition for CKGR peripheral ========== +AT91C_CKGR_MOR.name="AT91C_CKGR_MOR" +AT91C_CKGR_MOR.description="Main Oscillator Register" +AT91C_CKGR_MOR.helpkey="Main Oscillator Register" +AT91C_CKGR_MOR.access=memorymapped +AT91C_CKGR_MOR.address=0xFFFFFC20 +AT91C_CKGR_MOR.width=32 +AT91C_CKGR_MOR.byteEndian=little +AT91C_CKGR_PLLR.name="AT91C_CKGR_PLLR" +AT91C_CKGR_PLLR.description="PLL Register" +AT91C_CKGR_PLLR.helpkey="PLL Register" +AT91C_CKGR_PLLR.access=memorymapped +AT91C_CKGR_PLLR.address=0xFFFFFC2C +AT91C_CKGR_PLLR.width=32 +AT91C_CKGR_PLLR.byteEndian=little +AT91C_CKGR_MCFR.name="AT91C_CKGR_MCFR" +AT91C_CKGR_MCFR.description="Main Clock Frequency Register" +AT91C_CKGR_MCFR.helpkey="Main Clock Frequency Register" +AT91C_CKGR_MCFR.access=memorymapped +AT91C_CKGR_MCFR.address=0xFFFFFC24 +AT91C_CKGR_MCFR.width=32 +AT91C_CKGR_MCFR.byteEndian=little +AT91C_CKGR_MCFR.permission.write=none +# ========== Register definition for PMC peripheral ========== +AT91C_PMC_IDR.name="AT91C_PMC_IDR" +AT91C_PMC_IDR.description="Interrupt Disable Register" +AT91C_PMC_IDR.helpkey="Interrupt Disable Register" +AT91C_PMC_IDR.access=memorymapped +AT91C_PMC_IDR.address=0xFFFFFC64 +AT91C_PMC_IDR.width=32 +AT91C_PMC_IDR.byteEndian=little +AT91C_PMC_IDR.type=enum +AT91C_PMC_IDR.enum.0.name=*** Write only *** +AT91C_PMC_IDR.enum.1.name=Error +AT91C_PMC_MOR.name="AT91C_PMC_MOR" +AT91C_PMC_MOR.description="Main Oscillator Register" +AT91C_PMC_MOR.helpkey="Main Oscillator Register" +AT91C_PMC_MOR.access=memorymapped +AT91C_PMC_MOR.address=0xFFFFFC20 +AT91C_PMC_MOR.width=32 +AT91C_PMC_MOR.byteEndian=little +AT91C_PMC_PLLR.name="AT91C_PMC_PLLR" +AT91C_PMC_PLLR.description="PLL Register" +AT91C_PMC_PLLR.helpkey="PLL Register" +AT91C_PMC_PLLR.access=memorymapped +AT91C_PMC_PLLR.address=0xFFFFFC2C +AT91C_PMC_PLLR.width=32 +AT91C_PMC_PLLR.byteEndian=little +AT91C_PMC_PCER.name="AT91C_PMC_PCER" +AT91C_PMC_PCER.description="Peripheral Clock Enable Register" +AT91C_PMC_PCER.helpkey="Peripheral Clock Enable Register" +AT91C_PMC_PCER.access=memorymapped +AT91C_PMC_PCER.address=0xFFFFFC10 +AT91C_PMC_PCER.width=32 +AT91C_PMC_PCER.byteEndian=little +AT91C_PMC_PCER.type=enum +AT91C_PMC_PCER.enum.0.name=*** Write only *** +AT91C_PMC_PCER.enum.1.name=Error +AT91C_PMC_PCKR.name="AT91C_PMC_PCKR" +AT91C_PMC_PCKR.description="Programmable Clock Register" +AT91C_PMC_PCKR.helpkey="Programmable Clock Register" +AT91C_PMC_PCKR.access=memorymapped +AT91C_PMC_PCKR.address=0xFFFFFC40 +AT91C_PMC_PCKR.width=32 +AT91C_PMC_PCKR.byteEndian=little +AT91C_PMC_MCKR.name="AT91C_PMC_MCKR" +AT91C_PMC_MCKR.description="Master Clock Register" +AT91C_PMC_MCKR.helpkey="Master Clock Register" +AT91C_PMC_MCKR.access=memorymapped +AT91C_PMC_MCKR.address=0xFFFFFC30 +AT91C_PMC_MCKR.width=32 +AT91C_PMC_MCKR.byteEndian=little +AT91C_PMC_SCDR.name="AT91C_PMC_SCDR" +AT91C_PMC_SCDR.description="System Clock Disable Register" +AT91C_PMC_SCDR.helpkey="System Clock Disable Register" +AT91C_PMC_SCDR.access=memorymapped +AT91C_PMC_SCDR.address=0xFFFFFC04 +AT91C_PMC_SCDR.width=32 +AT91C_PMC_SCDR.byteEndian=little +AT91C_PMC_SCDR.type=enum +AT91C_PMC_SCDR.enum.0.name=*** Write only *** +AT91C_PMC_SCDR.enum.1.name=Error +AT91C_PMC_PCDR.name="AT91C_PMC_PCDR" +AT91C_PMC_PCDR.description="Peripheral Clock Disable Register" +AT91C_PMC_PCDR.helpkey="Peripheral Clock Disable Register" +AT91C_PMC_PCDR.access=memorymapped +AT91C_PMC_PCDR.address=0xFFFFFC14 +AT91C_PMC_PCDR.width=32 +AT91C_PMC_PCDR.byteEndian=little +AT91C_PMC_PCDR.type=enum +AT91C_PMC_PCDR.enum.0.name=*** Write only *** +AT91C_PMC_PCDR.enum.1.name=Error +AT91C_PMC_SCSR.name="AT91C_PMC_SCSR" +AT91C_PMC_SCSR.description="System Clock Status Register" +AT91C_PMC_SCSR.helpkey="System Clock Status Register" +AT91C_PMC_SCSR.access=memorymapped +AT91C_PMC_SCSR.address=0xFFFFFC08 +AT91C_PMC_SCSR.width=32 +AT91C_PMC_SCSR.byteEndian=little +AT91C_PMC_SCSR.permission.write=none +AT91C_PMC_PCSR.name="AT91C_PMC_PCSR" +AT91C_PMC_PCSR.description="Peripheral Clock Status Register" +AT91C_PMC_PCSR.helpkey="Peripheral Clock Status Register" +AT91C_PMC_PCSR.access=memorymapped +AT91C_PMC_PCSR.address=0xFFFFFC18 +AT91C_PMC_PCSR.width=32 +AT91C_PMC_PCSR.byteEndian=little +AT91C_PMC_PCSR.permission.write=none +AT91C_PMC_MCFR.name="AT91C_PMC_MCFR" +AT91C_PMC_MCFR.description="Main Clock Frequency Register" +AT91C_PMC_MCFR.helpkey="Main Clock Frequency Register" +AT91C_PMC_MCFR.access=memorymapped +AT91C_PMC_MCFR.address=0xFFFFFC24 +AT91C_PMC_MCFR.width=32 +AT91C_PMC_MCFR.byteEndian=little +AT91C_PMC_MCFR.permission.write=none +AT91C_PMC_SCER.name="AT91C_PMC_SCER" +AT91C_PMC_SCER.description="System Clock Enable Register" +AT91C_PMC_SCER.helpkey="System Clock Enable Register" +AT91C_PMC_SCER.access=memorymapped +AT91C_PMC_SCER.address=0xFFFFFC00 +AT91C_PMC_SCER.width=32 +AT91C_PMC_SCER.byteEndian=little +AT91C_PMC_SCER.type=enum +AT91C_PMC_SCER.enum.0.name=*** Write only *** +AT91C_PMC_SCER.enum.1.name=Error +AT91C_PMC_IMR.name="AT91C_PMC_IMR" +AT91C_PMC_IMR.description="Interrupt Mask Register" +AT91C_PMC_IMR.helpkey="Interrupt Mask Register" +AT91C_PMC_IMR.access=memorymapped +AT91C_PMC_IMR.address=0xFFFFFC6C +AT91C_PMC_IMR.width=32 +AT91C_PMC_IMR.byteEndian=little +AT91C_PMC_IMR.permission.write=none +AT91C_PMC_IER.name="AT91C_PMC_IER" +AT91C_PMC_IER.description="Interrupt Enable Register" +AT91C_PMC_IER.helpkey="Interrupt Enable Register" +AT91C_PMC_IER.access=memorymapped +AT91C_PMC_IER.address=0xFFFFFC60 +AT91C_PMC_IER.width=32 +AT91C_PMC_IER.byteEndian=little +AT91C_PMC_IER.type=enum +AT91C_PMC_IER.enum.0.name=*** Write only *** +AT91C_PMC_IER.enum.1.name=Error +AT91C_PMC_SR.name="AT91C_PMC_SR" +AT91C_PMC_SR.description="Status Register" +AT91C_PMC_SR.helpkey="Status Register" +AT91C_PMC_SR.access=memorymapped +AT91C_PMC_SR.address=0xFFFFFC68 +AT91C_PMC_SR.width=32 +AT91C_PMC_SR.byteEndian=little +AT91C_PMC_SR.permission.write=none +# ========== Register definition for RSTC peripheral ========== +AT91C_RSTC_RCR.name="AT91C_RSTC_RCR" +AT91C_RSTC_RCR.description="Reset Control Register" +AT91C_RSTC_RCR.helpkey="Reset Control Register" +AT91C_RSTC_RCR.access=memorymapped +AT91C_RSTC_RCR.address=0xFFFFFD00 +AT91C_RSTC_RCR.width=32 +AT91C_RSTC_RCR.byteEndian=little +AT91C_RSTC_RCR.type=enum +AT91C_RSTC_RCR.enum.0.name=*** Write only *** +AT91C_RSTC_RCR.enum.1.name=Error +AT91C_RSTC_RMR.name="AT91C_RSTC_RMR" +AT91C_RSTC_RMR.description="Reset Mode Register" +AT91C_RSTC_RMR.helpkey="Reset Mode Register" +AT91C_RSTC_RMR.access=memorymapped +AT91C_RSTC_RMR.address=0xFFFFFD08 +AT91C_RSTC_RMR.width=32 +AT91C_RSTC_RMR.byteEndian=little +AT91C_RSTC_RSR.name="AT91C_RSTC_RSR" +AT91C_RSTC_RSR.description="Reset Status Register" +AT91C_RSTC_RSR.helpkey="Reset Status Register" +AT91C_RSTC_RSR.access=memorymapped +AT91C_RSTC_RSR.address=0xFFFFFD04 +AT91C_RSTC_RSR.width=32 +AT91C_RSTC_RSR.byteEndian=little +AT91C_RSTC_RSR.permission.write=none +# ========== Register definition for RTTC peripheral ========== +AT91C_RTTC_RTSR.name="AT91C_RTTC_RTSR" +AT91C_RTTC_RTSR.description="Real-time Status Register" +AT91C_RTTC_RTSR.helpkey="Real-time Status Register" +AT91C_RTTC_RTSR.access=memorymapped +AT91C_RTTC_RTSR.address=0xFFFFFD2C +AT91C_RTTC_RTSR.width=32 +AT91C_RTTC_RTSR.byteEndian=little +AT91C_RTTC_RTSR.permission.write=none +AT91C_RTTC_RTMR.name="AT91C_RTTC_RTMR" +AT91C_RTTC_RTMR.description="Real-time Mode Register" +AT91C_RTTC_RTMR.helpkey="Real-time Mode Register" +AT91C_RTTC_RTMR.access=memorymapped +AT91C_RTTC_RTMR.address=0xFFFFFD20 +AT91C_RTTC_RTMR.width=32 +AT91C_RTTC_RTMR.byteEndian=little +AT91C_RTTC_RTVR.name="AT91C_RTTC_RTVR" +AT91C_RTTC_RTVR.description="Real-time Value Register" +AT91C_RTTC_RTVR.helpkey="Real-time Value Register" +AT91C_RTTC_RTVR.access=memorymapped +AT91C_RTTC_RTVR.address=0xFFFFFD28 +AT91C_RTTC_RTVR.width=32 +AT91C_RTTC_RTVR.byteEndian=little +AT91C_RTTC_RTVR.permission.write=none +AT91C_RTTC_RTAR.name="AT91C_RTTC_RTAR" +AT91C_RTTC_RTAR.description="Real-time Alarm Register" +AT91C_RTTC_RTAR.helpkey="Real-time Alarm Register" +AT91C_RTTC_RTAR.access=memorymapped +AT91C_RTTC_RTAR.address=0xFFFFFD24 +AT91C_RTTC_RTAR.width=32 +AT91C_RTTC_RTAR.byteEndian=little +# ========== Register definition for PITC peripheral ========== +AT91C_PITC_PIVR.name="AT91C_PITC_PIVR" +AT91C_PITC_PIVR.description="Period Interval Value Register" +AT91C_PITC_PIVR.helpkey="Period Interval Value Register" +AT91C_PITC_PIVR.access=memorymapped +AT91C_PITC_PIVR.address=0xFFFFFD38 +AT91C_PITC_PIVR.width=32 +AT91C_PITC_PIVR.byteEndian=little +AT91C_PITC_PIVR.permission.write=none +AT91C_PITC_PISR.name="AT91C_PITC_PISR" +AT91C_PITC_PISR.description="Period Interval Status Register" +AT91C_PITC_PISR.helpkey="Period Interval Status Register" +AT91C_PITC_PISR.access=memorymapped +AT91C_PITC_PISR.address=0xFFFFFD34 +AT91C_PITC_PISR.width=32 +AT91C_PITC_PISR.byteEndian=little +AT91C_PITC_PISR.permission.write=none +AT91C_PITC_PIIR.name="AT91C_PITC_PIIR" +AT91C_PITC_PIIR.description="Period Interval Image Register" +AT91C_PITC_PIIR.helpkey="Period Interval Image Register" +AT91C_PITC_PIIR.access=memorymapped +AT91C_PITC_PIIR.address=0xFFFFFD3C +AT91C_PITC_PIIR.width=32 +AT91C_PITC_PIIR.byteEndian=little +AT91C_PITC_PIIR.permission.write=none +AT91C_PITC_PIMR.name="AT91C_PITC_PIMR" +AT91C_PITC_PIMR.description="Period Interval Mode Register" +AT91C_PITC_PIMR.helpkey="Period Interval Mode Register" +AT91C_PITC_PIMR.access=memorymapped +AT91C_PITC_PIMR.address=0xFFFFFD30 +AT91C_PITC_PIMR.width=32 +AT91C_PITC_PIMR.byteEndian=little +# ========== Register definition for WDTC peripheral ========== +AT91C_WDTC_WDCR.name="AT91C_WDTC_WDCR" +AT91C_WDTC_WDCR.description="Watchdog Control Register" +AT91C_WDTC_WDCR.helpkey="Watchdog Control Register" +AT91C_WDTC_WDCR.access=memorymapped +AT91C_WDTC_WDCR.address=0xFFFFFD40 +AT91C_WDTC_WDCR.width=32 +AT91C_WDTC_WDCR.byteEndian=little +AT91C_WDTC_WDCR.type=enum +AT91C_WDTC_WDCR.enum.0.name=*** Write only *** +AT91C_WDTC_WDCR.enum.1.name=Error +AT91C_WDTC_WDSR.name="AT91C_WDTC_WDSR" +AT91C_WDTC_WDSR.description="Watchdog Status Register" +AT91C_WDTC_WDSR.helpkey="Watchdog Status Register" +AT91C_WDTC_WDSR.access=memorymapped +AT91C_WDTC_WDSR.address=0xFFFFFD48 +AT91C_WDTC_WDSR.width=32 +AT91C_WDTC_WDSR.byteEndian=little +AT91C_WDTC_WDSR.permission.write=none +AT91C_WDTC_WDMR.name="AT91C_WDTC_WDMR" +AT91C_WDTC_WDMR.description="Watchdog Mode Register" +AT91C_WDTC_WDMR.helpkey="Watchdog Mode Register" +AT91C_WDTC_WDMR.access=memorymapped +AT91C_WDTC_WDMR.address=0xFFFFFD44 +AT91C_WDTC_WDMR.width=32 +AT91C_WDTC_WDMR.byteEndian=little +# ========== Register definition for VREG peripheral ========== +AT91C_VREG_MR.name="AT91C_VREG_MR" +AT91C_VREG_MR.description="Voltage Regulator Mode Register" +AT91C_VREG_MR.helpkey="Voltage Regulator Mode Register" +AT91C_VREG_MR.access=memorymapped +AT91C_VREG_MR.address=0xFFFFFD60 +AT91C_VREG_MR.width=32 +AT91C_VREG_MR.byteEndian=little +# ========== Register definition for MC peripheral ========== +AT91C_MC_ASR.name="AT91C_MC_ASR" +AT91C_MC_ASR.description="MC Abort Status Register" +AT91C_MC_ASR.helpkey="MC Abort Status Register" +AT91C_MC_ASR.access=memorymapped +AT91C_MC_ASR.address=0xFFFFFF04 +AT91C_MC_ASR.width=32 +AT91C_MC_ASR.byteEndian=little +AT91C_MC_ASR.permission.write=none +AT91C_MC_RCR.name="AT91C_MC_RCR" +AT91C_MC_RCR.description="MC Remap Control Register" +AT91C_MC_RCR.helpkey="MC Remap Control Register" +AT91C_MC_RCR.access=memorymapped +AT91C_MC_RCR.address=0xFFFFFF00 +AT91C_MC_RCR.width=32 +AT91C_MC_RCR.byteEndian=little +AT91C_MC_RCR.type=enum +AT91C_MC_RCR.enum.0.name=*** Write only *** +AT91C_MC_RCR.enum.1.name=Error +AT91C_MC_FCR.name="AT91C_MC_FCR" +AT91C_MC_FCR.description="MC Flash Command Register" +AT91C_MC_FCR.helpkey="MC Flash Command Register" +AT91C_MC_FCR.access=memorymapped +AT91C_MC_FCR.address=0xFFFFFF64 +AT91C_MC_FCR.width=32 +AT91C_MC_FCR.byteEndian=little +AT91C_MC_FCR.type=enum +AT91C_MC_FCR.enum.0.name=*** Write only *** +AT91C_MC_FCR.enum.1.name=Error +AT91C_MC_AASR.name="AT91C_MC_AASR" +AT91C_MC_AASR.description="MC Abort Address Status Register" +AT91C_MC_AASR.helpkey="MC Abort Address Status Register" +AT91C_MC_AASR.access=memorymapped +AT91C_MC_AASR.address=0xFFFFFF08 +AT91C_MC_AASR.width=32 +AT91C_MC_AASR.byteEndian=little +AT91C_MC_AASR.permission.write=none +AT91C_MC_FSR.name="AT91C_MC_FSR" +AT91C_MC_FSR.description="MC Flash Status Register" +AT91C_MC_FSR.helpkey="MC Flash Status Register" +AT91C_MC_FSR.access=memorymapped +AT91C_MC_FSR.address=0xFFFFFF68 +AT91C_MC_FSR.width=32 +AT91C_MC_FSR.byteEndian=little +AT91C_MC_FSR.permission.write=none +AT91C_MC_FMR.name="AT91C_MC_FMR" +AT91C_MC_FMR.description="MC Flash Mode Register" +AT91C_MC_FMR.helpkey="MC Flash Mode Register" +AT91C_MC_FMR.access=memorymapped +AT91C_MC_FMR.address=0xFFFFFF60 +AT91C_MC_FMR.width=32 +AT91C_MC_FMR.byteEndian=little +# ========== Register definition for PDC_SPI1 peripheral ========== +AT91C_SPI1_PTCR.name="AT91C_SPI1_PTCR" +AT91C_SPI1_PTCR.description="PDC Transfer Control Register" +AT91C_SPI1_PTCR.helpkey="PDC Transfer Control Register" +AT91C_SPI1_PTCR.access=memorymapped +AT91C_SPI1_PTCR.address=0xFFFE4120 +AT91C_SPI1_PTCR.width=32 +AT91C_SPI1_PTCR.byteEndian=little +AT91C_SPI1_PTCR.type=enum +AT91C_SPI1_PTCR.enum.0.name=*** Write only *** +AT91C_SPI1_PTCR.enum.1.name=Error +AT91C_SPI1_RPR.name="AT91C_SPI1_RPR" +AT91C_SPI1_RPR.description="Receive Pointer Register" +AT91C_SPI1_RPR.helpkey="Receive Pointer Register" +AT91C_SPI1_RPR.access=memorymapped +AT91C_SPI1_RPR.address=0xFFFE4100 +AT91C_SPI1_RPR.width=32 +AT91C_SPI1_RPR.byteEndian=little +AT91C_SPI1_TNCR.name="AT91C_SPI1_TNCR" +AT91C_SPI1_TNCR.description="Transmit Next Counter Register" +AT91C_SPI1_TNCR.helpkey="Transmit Next Counter Register" +AT91C_SPI1_TNCR.access=memorymapped +AT91C_SPI1_TNCR.address=0xFFFE411C +AT91C_SPI1_TNCR.width=32 +AT91C_SPI1_TNCR.byteEndian=little +AT91C_SPI1_TPR.name="AT91C_SPI1_TPR" +AT91C_SPI1_TPR.description="Transmit Pointer Register" +AT91C_SPI1_TPR.helpkey="Transmit Pointer Register" +AT91C_SPI1_TPR.access=memorymapped +AT91C_SPI1_TPR.address=0xFFFE4108 +AT91C_SPI1_TPR.width=32 +AT91C_SPI1_TPR.byteEndian=little +AT91C_SPI1_TNPR.name="AT91C_SPI1_TNPR" +AT91C_SPI1_TNPR.description="Transmit Next Pointer Register" +AT91C_SPI1_TNPR.helpkey="Transmit Next Pointer Register" +AT91C_SPI1_TNPR.access=memorymapped +AT91C_SPI1_TNPR.address=0xFFFE4118 +AT91C_SPI1_TNPR.width=32 +AT91C_SPI1_TNPR.byteEndian=little +AT91C_SPI1_TCR.name="AT91C_SPI1_TCR" +AT91C_SPI1_TCR.description="Transmit Counter Register" +AT91C_SPI1_TCR.helpkey="Transmit Counter Register" +AT91C_SPI1_TCR.access=memorymapped +AT91C_SPI1_TCR.address=0xFFFE410C +AT91C_SPI1_TCR.width=32 +AT91C_SPI1_TCR.byteEndian=little +AT91C_SPI1_RCR.name="AT91C_SPI1_RCR" +AT91C_SPI1_RCR.description="Receive Counter Register" +AT91C_SPI1_RCR.helpkey="Receive Counter Register" +AT91C_SPI1_RCR.access=memorymapped +AT91C_SPI1_RCR.address=0xFFFE4104 +AT91C_SPI1_RCR.width=32 +AT91C_SPI1_RCR.byteEndian=little +AT91C_SPI1_RNPR.name="AT91C_SPI1_RNPR" +AT91C_SPI1_RNPR.description="Receive Next Pointer Register" +AT91C_SPI1_RNPR.helpkey="Receive Next Pointer Register" +AT91C_SPI1_RNPR.access=memorymapped +AT91C_SPI1_RNPR.address=0xFFFE4110 +AT91C_SPI1_RNPR.width=32 +AT91C_SPI1_RNPR.byteEndian=little +AT91C_SPI1_RNCR.name="AT91C_SPI1_RNCR" +AT91C_SPI1_RNCR.description="Receive Next Counter Register" +AT91C_SPI1_RNCR.helpkey="Receive Next Counter Register" +AT91C_SPI1_RNCR.access=memorymapped +AT91C_SPI1_RNCR.address=0xFFFE4114 +AT91C_SPI1_RNCR.width=32 +AT91C_SPI1_RNCR.byteEndian=little +AT91C_SPI1_PTSR.name="AT91C_SPI1_PTSR" +AT91C_SPI1_PTSR.description="PDC Transfer Status Register" +AT91C_SPI1_PTSR.helpkey="PDC Transfer Status Register" +AT91C_SPI1_PTSR.access=memorymapped +AT91C_SPI1_PTSR.address=0xFFFE4124 +AT91C_SPI1_PTSR.width=32 +AT91C_SPI1_PTSR.byteEndian=little +AT91C_SPI1_PTSR.permission.write=none +# ========== Register definition for SPI1 peripheral ========== +AT91C_SPI1_IMR.name="AT91C_SPI1_IMR" +AT91C_SPI1_IMR.description="Interrupt Mask Register" +AT91C_SPI1_IMR.helpkey="Interrupt Mask Register" +AT91C_SPI1_IMR.access=memorymapped +AT91C_SPI1_IMR.address=0xFFFE401C +AT91C_SPI1_IMR.width=32 +AT91C_SPI1_IMR.byteEndian=little +AT91C_SPI1_IMR.permission.write=none +AT91C_SPI1_IER.name="AT91C_SPI1_IER" +AT91C_SPI1_IER.description="Interrupt Enable Register" +AT91C_SPI1_IER.helpkey="Interrupt Enable Register" +AT91C_SPI1_IER.access=memorymapped +AT91C_SPI1_IER.address=0xFFFE4014 +AT91C_SPI1_IER.width=32 +AT91C_SPI1_IER.byteEndian=little +AT91C_SPI1_IER.type=enum +AT91C_SPI1_IER.enum.0.name=*** Write only *** +AT91C_SPI1_IER.enum.1.name=Error +AT91C_SPI1_MR.name="AT91C_SPI1_MR" +AT91C_SPI1_MR.description="Mode Register" +AT91C_SPI1_MR.helpkey="Mode Register" +AT91C_SPI1_MR.access=memorymapped +AT91C_SPI1_MR.address=0xFFFE4004 +AT91C_SPI1_MR.width=32 +AT91C_SPI1_MR.byteEndian=little +AT91C_SPI1_RDR.name="AT91C_SPI1_RDR" +AT91C_SPI1_RDR.description="Receive Data Register" +AT91C_SPI1_RDR.helpkey="Receive Data Register" +AT91C_SPI1_RDR.access=memorymapped +AT91C_SPI1_RDR.address=0xFFFE4008 +AT91C_SPI1_RDR.width=32 +AT91C_SPI1_RDR.byteEndian=little +AT91C_SPI1_RDR.permission.write=none +AT91C_SPI1_IDR.name="AT91C_SPI1_IDR" +AT91C_SPI1_IDR.description="Interrupt Disable Register" +AT91C_SPI1_IDR.helpkey="Interrupt Disable Register" +AT91C_SPI1_IDR.access=memorymapped +AT91C_SPI1_IDR.address=0xFFFE4018 +AT91C_SPI1_IDR.width=32 +AT91C_SPI1_IDR.byteEndian=little +AT91C_SPI1_IDR.type=enum +AT91C_SPI1_IDR.enum.0.name=*** Write only *** +AT91C_SPI1_IDR.enum.1.name=Error +AT91C_SPI1_SR.name="AT91C_SPI1_SR" +AT91C_SPI1_SR.description="Status Register" +AT91C_SPI1_SR.helpkey="Status Register" +AT91C_SPI1_SR.access=memorymapped +AT91C_SPI1_SR.address=0xFFFE4010 +AT91C_SPI1_SR.width=32 +AT91C_SPI1_SR.byteEndian=little +AT91C_SPI1_SR.permission.write=none +AT91C_SPI1_TDR.name="AT91C_SPI1_TDR" +AT91C_SPI1_TDR.description="Transmit Data Register" +AT91C_SPI1_TDR.helpkey="Transmit Data Register" +AT91C_SPI1_TDR.access=memorymapped +AT91C_SPI1_TDR.address=0xFFFE400C +AT91C_SPI1_TDR.width=32 +AT91C_SPI1_TDR.byteEndian=little +AT91C_SPI1_TDR.type=enum +AT91C_SPI1_TDR.enum.0.name=*** Write only *** +AT91C_SPI1_TDR.enum.1.name=Error +AT91C_SPI1_CR.name="AT91C_SPI1_CR" +AT91C_SPI1_CR.description="Control Register" +AT91C_SPI1_CR.helpkey="Control Register" +AT91C_SPI1_CR.access=memorymapped +AT91C_SPI1_CR.address=0xFFFE4000 +AT91C_SPI1_CR.width=32 +AT91C_SPI1_CR.byteEndian=little +AT91C_SPI1_CR.permission.write=none +AT91C_SPI1_CSR.name="AT91C_SPI1_CSR" +AT91C_SPI1_CSR.description="Chip Select Register" +AT91C_SPI1_CSR.helpkey="Chip Select Register" +AT91C_SPI1_CSR.access=memorymapped +AT91C_SPI1_CSR.address=0xFFFE4030 +AT91C_SPI1_CSR.width=32 +AT91C_SPI1_CSR.byteEndian=little +# ========== Register definition for PDC_SPI0 peripheral ========== +AT91C_SPI0_PTCR.name="AT91C_SPI0_PTCR" +AT91C_SPI0_PTCR.description="PDC Transfer Control Register" +AT91C_SPI0_PTCR.helpkey="PDC Transfer Control Register" +AT91C_SPI0_PTCR.access=memorymapped +AT91C_SPI0_PTCR.address=0xFFFE0120 +AT91C_SPI0_PTCR.width=32 +AT91C_SPI0_PTCR.byteEndian=little +AT91C_SPI0_PTCR.type=enum +AT91C_SPI0_PTCR.enum.0.name=*** Write only *** +AT91C_SPI0_PTCR.enum.1.name=Error +AT91C_SPI0_TPR.name="AT91C_SPI0_TPR" +AT91C_SPI0_TPR.description="Transmit Pointer Register" +AT91C_SPI0_TPR.helpkey="Transmit Pointer Register" +AT91C_SPI0_TPR.access=memorymapped +AT91C_SPI0_TPR.address=0xFFFE0108 +AT91C_SPI0_TPR.width=32 +AT91C_SPI0_TPR.byteEndian=little +AT91C_SPI0_TCR.name="AT91C_SPI0_TCR" +AT91C_SPI0_TCR.description="Transmit Counter Register" +AT91C_SPI0_TCR.helpkey="Transmit Counter Register" +AT91C_SPI0_TCR.access=memorymapped +AT91C_SPI0_TCR.address=0xFFFE010C +AT91C_SPI0_TCR.width=32 +AT91C_SPI0_TCR.byteEndian=little +AT91C_SPI0_RCR.name="AT91C_SPI0_RCR" +AT91C_SPI0_RCR.description="Receive Counter Register" +AT91C_SPI0_RCR.helpkey="Receive Counter Register" +AT91C_SPI0_RCR.access=memorymapped +AT91C_SPI0_RCR.address=0xFFFE0104 +AT91C_SPI0_RCR.width=32 +AT91C_SPI0_RCR.byteEndian=little +AT91C_SPI0_PTSR.name="AT91C_SPI0_PTSR" +AT91C_SPI0_PTSR.description="PDC Transfer Status Register" +AT91C_SPI0_PTSR.helpkey="PDC Transfer Status Register" +AT91C_SPI0_PTSR.access=memorymapped +AT91C_SPI0_PTSR.address=0xFFFE0124 +AT91C_SPI0_PTSR.width=32 +AT91C_SPI0_PTSR.byteEndian=little +AT91C_SPI0_PTSR.permission.write=none +AT91C_SPI0_RNPR.name="AT91C_SPI0_RNPR" +AT91C_SPI0_RNPR.description="Receive Next Pointer Register" +AT91C_SPI0_RNPR.helpkey="Receive Next Pointer Register" +AT91C_SPI0_RNPR.access=memorymapped +AT91C_SPI0_RNPR.address=0xFFFE0110 +AT91C_SPI0_RNPR.width=32 +AT91C_SPI0_RNPR.byteEndian=little +AT91C_SPI0_RPR.name="AT91C_SPI0_RPR" +AT91C_SPI0_RPR.description="Receive Pointer Register" +AT91C_SPI0_RPR.helpkey="Receive Pointer Register" +AT91C_SPI0_RPR.access=memorymapped +AT91C_SPI0_RPR.address=0xFFFE0100 +AT91C_SPI0_RPR.width=32 +AT91C_SPI0_RPR.byteEndian=little +AT91C_SPI0_TNCR.name="AT91C_SPI0_TNCR" +AT91C_SPI0_TNCR.description="Transmit Next Counter Register" +AT91C_SPI0_TNCR.helpkey="Transmit Next Counter Register" +AT91C_SPI0_TNCR.access=memorymapped +AT91C_SPI0_TNCR.address=0xFFFE011C +AT91C_SPI0_TNCR.width=32 +AT91C_SPI0_TNCR.byteEndian=little +AT91C_SPI0_RNCR.name="AT91C_SPI0_RNCR" +AT91C_SPI0_RNCR.description="Receive Next Counter Register" +AT91C_SPI0_RNCR.helpkey="Receive Next Counter Register" +AT91C_SPI0_RNCR.access=memorymapped +AT91C_SPI0_RNCR.address=0xFFFE0114 +AT91C_SPI0_RNCR.width=32 +AT91C_SPI0_RNCR.byteEndian=little +AT91C_SPI0_TNPR.name="AT91C_SPI0_TNPR" +AT91C_SPI0_TNPR.description="Transmit Next Pointer Register" +AT91C_SPI0_TNPR.helpkey="Transmit Next Pointer Register" +AT91C_SPI0_TNPR.access=memorymapped +AT91C_SPI0_TNPR.address=0xFFFE0118 +AT91C_SPI0_TNPR.width=32 +AT91C_SPI0_TNPR.byteEndian=little +# ========== Register definition for SPI0 peripheral ========== +AT91C_SPI0_IER.name="AT91C_SPI0_IER" +AT91C_SPI0_IER.description="Interrupt Enable Register" +AT91C_SPI0_IER.helpkey="Interrupt Enable Register" +AT91C_SPI0_IER.access=memorymapped +AT91C_SPI0_IER.address=0xFFFE0014 +AT91C_SPI0_IER.width=32 +AT91C_SPI0_IER.byteEndian=little +AT91C_SPI0_IER.type=enum +AT91C_SPI0_IER.enum.0.name=*** Write only *** +AT91C_SPI0_IER.enum.1.name=Error +AT91C_SPI0_SR.name="AT91C_SPI0_SR" +AT91C_SPI0_SR.description="Status Register" +AT91C_SPI0_SR.helpkey="Status Register" +AT91C_SPI0_SR.access=memorymapped +AT91C_SPI0_SR.address=0xFFFE0010 +AT91C_SPI0_SR.width=32 +AT91C_SPI0_SR.byteEndian=little +AT91C_SPI0_SR.permission.write=none +AT91C_SPI0_IDR.name="AT91C_SPI0_IDR" +AT91C_SPI0_IDR.description="Interrupt Disable Register" +AT91C_SPI0_IDR.helpkey="Interrupt Disable Register" +AT91C_SPI0_IDR.access=memorymapped +AT91C_SPI0_IDR.address=0xFFFE0018 +AT91C_SPI0_IDR.width=32 +AT91C_SPI0_IDR.byteEndian=little +AT91C_SPI0_IDR.type=enum +AT91C_SPI0_IDR.enum.0.name=*** Write only *** +AT91C_SPI0_IDR.enum.1.name=Error +AT91C_SPI0_CR.name="AT91C_SPI0_CR" +AT91C_SPI0_CR.description="Control Register" +AT91C_SPI0_CR.helpkey="Control Register" +AT91C_SPI0_CR.access=memorymapped +AT91C_SPI0_CR.address=0xFFFE0000 +AT91C_SPI0_CR.width=32 +AT91C_SPI0_CR.byteEndian=little +AT91C_SPI0_CR.permission.write=none +AT91C_SPI0_MR.name="AT91C_SPI0_MR" +AT91C_SPI0_MR.description="Mode Register" +AT91C_SPI0_MR.helpkey="Mode Register" +AT91C_SPI0_MR.access=memorymapped +AT91C_SPI0_MR.address=0xFFFE0004 +AT91C_SPI0_MR.width=32 +AT91C_SPI0_MR.byteEndian=little +AT91C_SPI0_IMR.name="AT91C_SPI0_IMR" +AT91C_SPI0_IMR.description="Interrupt Mask Register" +AT91C_SPI0_IMR.helpkey="Interrupt Mask Register" +AT91C_SPI0_IMR.access=memorymapped +AT91C_SPI0_IMR.address=0xFFFE001C +AT91C_SPI0_IMR.width=32 +AT91C_SPI0_IMR.byteEndian=little +AT91C_SPI0_IMR.permission.write=none +AT91C_SPI0_TDR.name="AT91C_SPI0_TDR" +AT91C_SPI0_TDR.description="Transmit Data Register" +AT91C_SPI0_TDR.helpkey="Transmit Data Register" +AT91C_SPI0_TDR.access=memorymapped +AT91C_SPI0_TDR.address=0xFFFE000C +AT91C_SPI0_TDR.width=32 +AT91C_SPI0_TDR.byteEndian=little +AT91C_SPI0_TDR.type=enum +AT91C_SPI0_TDR.enum.0.name=*** Write only *** +AT91C_SPI0_TDR.enum.1.name=Error +AT91C_SPI0_RDR.name="AT91C_SPI0_RDR" +AT91C_SPI0_RDR.description="Receive Data Register" +AT91C_SPI0_RDR.helpkey="Receive Data Register" +AT91C_SPI0_RDR.access=memorymapped +AT91C_SPI0_RDR.address=0xFFFE0008 +AT91C_SPI0_RDR.width=32 +AT91C_SPI0_RDR.byteEndian=little +AT91C_SPI0_RDR.permission.write=none +AT91C_SPI0_CSR.name="AT91C_SPI0_CSR" +AT91C_SPI0_CSR.description="Chip Select Register" +AT91C_SPI0_CSR.helpkey="Chip Select Register" +AT91C_SPI0_CSR.access=memorymapped +AT91C_SPI0_CSR.address=0xFFFE0030 +AT91C_SPI0_CSR.width=32 +AT91C_SPI0_CSR.byteEndian=little +# ========== Register definition for PDC_US1 peripheral ========== +AT91C_US1_RNCR.name="AT91C_US1_RNCR" +AT91C_US1_RNCR.description="Receive Next Counter Register" +AT91C_US1_RNCR.helpkey="Receive Next Counter Register" +AT91C_US1_RNCR.access=memorymapped +AT91C_US1_RNCR.address=0xFFFC4114 +AT91C_US1_RNCR.width=32 +AT91C_US1_RNCR.byteEndian=little +AT91C_US1_PTCR.name="AT91C_US1_PTCR" +AT91C_US1_PTCR.description="PDC Transfer Control Register" +AT91C_US1_PTCR.helpkey="PDC Transfer Control Register" +AT91C_US1_PTCR.access=memorymapped +AT91C_US1_PTCR.address=0xFFFC4120 +AT91C_US1_PTCR.width=32 +AT91C_US1_PTCR.byteEndian=little +AT91C_US1_PTCR.type=enum +AT91C_US1_PTCR.enum.0.name=*** Write only *** +AT91C_US1_PTCR.enum.1.name=Error +AT91C_US1_TCR.name="AT91C_US1_TCR" +AT91C_US1_TCR.description="Transmit Counter Register" +AT91C_US1_TCR.helpkey="Transmit Counter Register" +AT91C_US1_TCR.access=memorymapped +AT91C_US1_TCR.address=0xFFFC410C +AT91C_US1_TCR.width=32 +AT91C_US1_TCR.byteEndian=little +AT91C_US1_PTSR.name="AT91C_US1_PTSR" +AT91C_US1_PTSR.description="PDC Transfer Status Register" +AT91C_US1_PTSR.helpkey="PDC Transfer Status Register" +AT91C_US1_PTSR.access=memorymapped +AT91C_US1_PTSR.address=0xFFFC4124 +AT91C_US1_PTSR.width=32 +AT91C_US1_PTSR.byteEndian=little +AT91C_US1_PTSR.permission.write=none +AT91C_US1_TNPR.name="AT91C_US1_TNPR" +AT91C_US1_TNPR.description="Transmit Next Pointer Register" +AT91C_US1_TNPR.helpkey="Transmit Next Pointer Register" +AT91C_US1_TNPR.access=memorymapped +AT91C_US1_TNPR.address=0xFFFC4118 +AT91C_US1_TNPR.width=32 +AT91C_US1_TNPR.byteEndian=little +AT91C_US1_RCR.name="AT91C_US1_RCR" +AT91C_US1_RCR.description="Receive Counter Register" +AT91C_US1_RCR.helpkey="Receive Counter Register" +AT91C_US1_RCR.access=memorymapped +AT91C_US1_RCR.address=0xFFFC4104 +AT91C_US1_RCR.width=32 +AT91C_US1_RCR.byteEndian=little +AT91C_US1_RNPR.name="AT91C_US1_RNPR" +AT91C_US1_RNPR.description="Receive Next Pointer Register" +AT91C_US1_RNPR.helpkey="Receive Next Pointer Register" +AT91C_US1_RNPR.access=memorymapped +AT91C_US1_RNPR.address=0xFFFC4110 +AT91C_US1_RNPR.width=32 +AT91C_US1_RNPR.byteEndian=little +AT91C_US1_RPR.name="AT91C_US1_RPR" +AT91C_US1_RPR.description="Receive Pointer Register" +AT91C_US1_RPR.helpkey="Receive Pointer Register" +AT91C_US1_RPR.access=memorymapped +AT91C_US1_RPR.address=0xFFFC4100 +AT91C_US1_RPR.width=32 +AT91C_US1_RPR.byteEndian=little +AT91C_US1_TNCR.name="AT91C_US1_TNCR" +AT91C_US1_TNCR.description="Transmit Next Counter Register" +AT91C_US1_TNCR.helpkey="Transmit Next Counter Register" +AT91C_US1_TNCR.access=memorymapped +AT91C_US1_TNCR.address=0xFFFC411C +AT91C_US1_TNCR.width=32 +AT91C_US1_TNCR.byteEndian=little +AT91C_US1_TPR.name="AT91C_US1_TPR" +AT91C_US1_TPR.description="Transmit Pointer Register" +AT91C_US1_TPR.helpkey="Transmit Pointer Register" +AT91C_US1_TPR.access=memorymapped +AT91C_US1_TPR.address=0xFFFC4108 +AT91C_US1_TPR.width=32 +AT91C_US1_TPR.byteEndian=little +# ========== Register definition for US1 peripheral ========== +AT91C_US1_IF.name="AT91C_US1_IF" +AT91C_US1_IF.description="IRDA_FILTER Register" +AT91C_US1_IF.helpkey="IRDA_FILTER Register" +AT91C_US1_IF.access=memorymapped +AT91C_US1_IF.address=0xFFFC404C +AT91C_US1_IF.width=32 +AT91C_US1_IF.byteEndian=little +AT91C_US1_NER.name="AT91C_US1_NER" +AT91C_US1_NER.description="Nb Errors Register" +AT91C_US1_NER.helpkey="Nb Errors Register" +AT91C_US1_NER.access=memorymapped +AT91C_US1_NER.address=0xFFFC4044 +AT91C_US1_NER.width=32 +AT91C_US1_NER.byteEndian=little +AT91C_US1_NER.permission.write=none +AT91C_US1_RTOR.name="AT91C_US1_RTOR" +AT91C_US1_RTOR.description="Receiver Time-out Register" +AT91C_US1_RTOR.helpkey="Receiver Time-out Register" +AT91C_US1_RTOR.access=memorymapped +AT91C_US1_RTOR.address=0xFFFC4024 +AT91C_US1_RTOR.width=32 +AT91C_US1_RTOR.byteEndian=little +AT91C_US1_CSR.name="AT91C_US1_CSR" +AT91C_US1_CSR.description="Channel Status Register" +AT91C_US1_CSR.helpkey="Channel Status Register" +AT91C_US1_CSR.access=memorymapped +AT91C_US1_CSR.address=0xFFFC4014 +AT91C_US1_CSR.width=32 +AT91C_US1_CSR.byteEndian=little +AT91C_US1_CSR.permission.write=none +AT91C_US1_IDR.name="AT91C_US1_IDR" +AT91C_US1_IDR.description="Interrupt Disable Register" +AT91C_US1_IDR.helpkey="Interrupt Disable Register" +AT91C_US1_IDR.access=memorymapped +AT91C_US1_IDR.address=0xFFFC400C +AT91C_US1_IDR.width=32 +AT91C_US1_IDR.byteEndian=little +AT91C_US1_IDR.type=enum +AT91C_US1_IDR.enum.0.name=*** Write only *** +AT91C_US1_IDR.enum.1.name=Error +AT91C_US1_IER.name="AT91C_US1_IER" +AT91C_US1_IER.description="Interrupt Enable Register" +AT91C_US1_IER.helpkey="Interrupt Enable Register" +AT91C_US1_IER.access=memorymapped +AT91C_US1_IER.address=0xFFFC4008 +AT91C_US1_IER.width=32 +AT91C_US1_IER.byteEndian=little +AT91C_US1_IER.type=enum +AT91C_US1_IER.enum.0.name=*** Write only *** +AT91C_US1_IER.enum.1.name=Error +AT91C_US1_THR.name="AT91C_US1_THR" +AT91C_US1_THR.description="Transmitter Holding Register" +AT91C_US1_THR.helpkey="Transmitter Holding Register" +AT91C_US1_THR.access=memorymapped +AT91C_US1_THR.address=0xFFFC401C +AT91C_US1_THR.width=32 +AT91C_US1_THR.byteEndian=little +AT91C_US1_THR.type=enum +AT91C_US1_THR.enum.0.name=*** Write only *** +AT91C_US1_THR.enum.1.name=Error +AT91C_US1_TTGR.name="AT91C_US1_TTGR" +AT91C_US1_TTGR.description="Transmitter Time-guard Register" +AT91C_US1_TTGR.helpkey="Transmitter Time-guard Register" +AT91C_US1_TTGR.access=memorymapped +AT91C_US1_TTGR.address=0xFFFC4028 +AT91C_US1_TTGR.width=32 +AT91C_US1_TTGR.byteEndian=little +AT91C_US1_RHR.name="AT91C_US1_RHR" +AT91C_US1_RHR.description="Receiver Holding Register" +AT91C_US1_RHR.helpkey="Receiver Holding Register" +AT91C_US1_RHR.access=memorymapped +AT91C_US1_RHR.address=0xFFFC4018 +AT91C_US1_RHR.width=32 +AT91C_US1_RHR.byteEndian=little +AT91C_US1_RHR.permission.write=none +AT91C_US1_BRGR.name="AT91C_US1_BRGR" +AT91C_US1_BRGR.description="Baud Rate Generator Register" +AT91C_US1_BRGR.helpkey="Baud Rate Generator Register" +AT91C_US1_BRGR.access=memorymapped +AT91C_US1_BRGR.address=0xFFFC4020 +AT91C_US1_BRGR.width=32 +AT91C_US1_BRGR.byteEndian=little +AT91C_US1_IMR.name="AT91C_US1_IMR" +AT91C_US1_IMR.description="Interrupt Mask Register" +AT91C_US1_IMR.helpkey="Interrupt Mask Register" +AT91C_US1_IMR.access=memorymapped +AT91C_US1_IMR.address=0xFFFC4010 +AT91C_US1_IMR.width=32 +AT91C_US1_IMR.byteEndian=little +AT91C_US1_IMR.permission.write=none +AT91C_US1_FIDI.name="AT91C_US1_FIDI" +AT91C_US1_FIDI.description="FI_DI_Ratio Register" +AT91C_US1_FIDI.helpkey="FI_DI_Ratio Register" +AT91C_US1_FIDI.access=memorymapped +AT91C_US1_FIDI.address=0xFFFC4040 +AT91C_US1_FIDI.width=32 +AT91C_US1_FIDI.byteEndian=little +AT91C_US1_CR.name="AT91C_US1_CR" +AT91C_US1_CR.description="Control Register" +AT91C_US1_CR.helpkey="Control Register" +AT91C_US1_CR.access=memorymapped +AT91C_US1_CR.address=0xFFFC4000 +AT91C_US1_CR.width=32 +AT91C_US1_CR.byteEndian=little +AT91C_US1_CR.type=enum +AT91C_US1_CR.enum.0.name=*** Write only *** +AT91C_US1_CR.enum.1.name=Error +AT91C_US1_MR.name="AT91C_US1_MR" +AT91C_US1_MR.description="Mode Register" +AT91C_US1_MR.helpkey="Mode Register" +AT91C_US1_MR.access=memorymapped +AT91C_US1_MR.address=0xFFFC4004 +AT91C_US1_MR.width=32 +AT91C_US1_MR.byteEndian=little +# ========== Register definition for PDC_US0 peripheral ========== +AT91C_US0_TNPR.name="AT91C_US0_TNPR" +AT91C_US0_TNPR.description="Transmit Next Pointer Register" +AT91C_US0_TNPR.helpkey="Transmit Next Pointer Register" +AT91C_US0_TNPR.access=memorymapped +AT91C_US0_TNPR.address=0xFFFC0118 +AT91C_US0_TNPR.width=32 +AT91C_US0_TNPR.byteEndian=little +AT91C_US0_RNPR.name="AT91C_US0_RNPR" +AT91C_US0_RNPR.description="Receive Next Pointer Register" +AT91C_US0_RNPR.helpkey="Receive Next Pointer Register" +AT91C_US0_RNPR.access=memorymapped +AT91C_US0_RNPR.address=0xFFFC0110 +AT91C_US0_RNPR.width=32 +AT91C_US0_RNPR.byteEndian=little +AT91C_US0_TCR.name="AT91C_US0_TCR" +AT91C_US0_TCR.description="Transmit Counter Register" +AT91C_US0_TCR.helpkey="Transmit Counter Register" +AT91C_US0_TCR.access=memorymapped +AT91C_US0_TCR.address=0xFFFC010C +AT91C_US0_TCR.width=32 +AT91C_US0_TCR.byteEndian=little +AT91C_US0_PTCR.name="AT91C_US0_PTCR" +AT91C_US0_PTCR.description="PDC Transfer Control Register" +AT91C_US0_PTCR.helpkey="PDC Transfer Control Register" +AT91C_US0_PTCR.access=memorymapped +AT91C_US0_PTCR.address=0xFFFC0120 +AT91C_US0_PTCR.width=32 +AT91C_US0_PTCR.byteEndian=little +AT91C_US0_PTCR.type=enum +AT91C_US0_PTCR.enum.0.name=*** Write only *** +AT91C_US0_PTCR.enum.1.name=Error +AT91C_US0_PTSR.name="AT91C_US0_PTSR" +AT91C_US0_PTSR.description="PDC Transfer Status Register" +AT91C_US0_PTSR.helpkey="PDC Transfer Status Register" +AT91C_US0_PTSR.access=memorymapped +AT91C_US0_PTSR.address=0xFFFC0124 +AT91C_US0_PTSR.width=32 +AT91C_US0_PTSR.byteEndian=little +AT91C_US0_PTSR.permission.write=none +AT91C_US0_TNCR.name="AT91C_US0_TNCR" +AT91C_US0_TNCR.description="Transmit Next Counter Register" +AT91C_US0_TNCR.helpkey="Transmit Next Counter Register" +AT91C_US0_TNCR.access=memorymapped +AT91C_US0_TNCR.address=0xFFFC011C +AT91C_US0_TNCR.width=32 +AT91C_US0_TNCR.byteEndian=little +AT91C_US0_TPR.name="AT91C_US0_TPR" +AT91C_US0_TPR.description="Transmit Pointer Register" +AT91C_US0_TPR.helpkey="Transmit Pointer Register" +AT91C_US0_TPR.access=memorymapped +AT91C_US0_TPR.address=0xFFFC0108 +AT91C_US0_TPR.width=32 +AT91C_US0_TPR.byteEndian=little +AT91C_US0_RCR.name="AT91C_US0_RCR" +AT91C_US0_RCR.description="Receive Counter Register" +AT91C_US0_RCR.helpkey="Receive Counter Register" +AT91C_US0_RCR.access=memorymapped +AT91C_US0_RCR.address=0xFFFC0104 +AT91C_US0_RCR.width=32 +AT91C_US0_RCR.byteEndian=little +AT91C_US0_RPR.name="AT91C_US0_RPR" +AT91C_US0_RPR.description="Receive Pointer Register" +AT91C_US0_RPR.helpkey="Receive Pointer Register" +AT91C_US0_RPR.access=memorymapped +AT91C_US0_RPR.address=0xFFFC0100 +AT91C_US0_RPR.width=32 +AT91C_US0_RPR.byteEndian=little +AT91C_US0_RNCR.name="AT91C_US0_RNCR" +AT91C_US0_RNCR.description="Receive Next Counter Register" +AT91C_US0_RNCR.helpkey="Receive Next Counter Register" +AT91C_US0_RNCR.access=memorymapped +AT91C_US0_RNCR.address=0xFFFC0114 +AT91C_US0_RNCR.width=32 +AT91C_US0_RNCR.byteEndian=little +# ========== Register definition for US0 peripheral ========== +AT91C_US0_BRGR.name="AT91C_US0_BRGR" +AT91C_US0_BRGR.description="Baud Rate Generator Register" +AT91C_US0_BRGR.helpkey="Baud Rate Generator Register" +AT91C_US0_BRGR.access=memorymapped +AT91C_US0_BRGR.address=0xFFFC0020 +AT91C_US0_BRGR.width=32 +AT91C_US0_BRGR.byteEndian=little +AT91C_US0_NER.name="AT91C_US0_NER" +AT91C_US0_NER.description="Nb Errors Register" +AT91C_US0_NER.helpkey="Nb Errors Register" +AT91C_US0_NER.access=memorymapped +AT91C_US0_NER.address=0xFFFC0044 +AT91C_US0_NER.width=32 +AT91C_US0_NER.byteEndian=little +AT91C_US0_NER.permission.write=none +AT91C_US0_CR.name="AT91C_US0_CR" +AT91C_US0_CR.description="Control Register" +AT91C_US0_CR.helpkey="Control Register" +AT91C_US0_CR.access=memorymapped +AT91C_US0_CR.address=0xFFFC0000 +AT91C_US0_CR.width=32 +AT91C_US0_CR.byteEndian=little +AT91C_US0_CR.type=enum +AT91C_US0_CR.enum.0.name=*** Write only *** +AT91C_US0_CR.enum.1.name=Error +AT91C_US0_IMR.name="AT91C_US0_IMR" +AT91C_US0_IMR.description="Interrupt Mask Register" +AT91C_US0_IMR.helpkey="Interrupt Mask Register" +AT91C_US0_IMR.access=memorymapped +AT91C_US0_IMR.address=0xFFFC0010 +AT91C_US0_IMR.width=32 +AT91C_US0_IMR.byteEndian=little +AT91C_US0_IMR.permission.write=none +AT91C_US0_FIDI.name="AT91C_US0_FIDI" +AT91C_US0_FIDI.description="FI_DI_Ratio Register" +AT91C_US0_FIDI.helpkey="FI_DI_Ratio Register" +AT91C_US0_FIDI.access=memorymapped +AT91C_US0_FIDI.address=0xFFFC0040 +AT91C_US0_FIDI.width=32 +AT91C_US0_FIDI.byteEndian=little +AT91C_US0_TTGR.name="AT91C_US0_TTGR" +AT91C_US0_TTGR.description="Transmitter Time-guard Register" +AT91C_US0_TTGR.helpkey="Transmitter Time-guard Register" +AT91C_US0_TTGR.access=memorymapped +AT91C_US0_TTGR.address=0xFFFC0028 +AT91C_US0_TTGR.width=32 +AT91C_US0_TTGR.byteEndian=little +AT91C_US0_MR.name="AT91C_US0_MR" +AT91C_US0_MR.description="Mode Register" +AT91C_US0_MR.helpkey="Mode Register" +AT91C_US0_MR.access=memorymapped +AT91C_US0_MR.address=0xFFFC0004 +AT91C_US0_MR.width=32 +AT91C_US0_MR.byteEndian=little +AT91C_US0_RTOR.name="AT91C_US0_RTOR" +AT91C_US0_RTOR.description="Receiver Time-out Register" +AT91C_US0_RTOR.helpkey="Receiver Time-out Register" +AT91C_US0_RTOR.access=memorymapped +AT91C_US0_RTOR.address=0xFFFC0024 +AT91C_US0_RTOR.width=32 +AT91C_US0_RTOR.byteEndian=little +AT91C_US0_CSR.name="AT91C_US0_CSR" +AT91C_US0_CSR.description="Channel Status Register" +AT91C_US0_CSR.helpkey="Channel Status Register" +AT91C_US0_CSR.access=memorymapped +AT91C_US0_CSR.address=0xFFFC0014 +AT91C_US0_CSR.width=32 +AT91C_US0_CSR.byteEndian=little +AT91C_US0_CSR.permission.write=none +AT91C_US0_RHR.name="AT91C_US0_RHR" +AT91C_US0_RHR.description="Receiver Holding Register" +AT91C_US0_RHR.helpkey="Receiver Holding Register" +AT91C_US0_RHR.access=memorymapped +AT91C_US0_RHR.address=0xFFFC0018 +AT91C_US0_RHR.width=32 +AT91C_US0_RHR.byteEndian=little +AT91C_US0_RHR.permission.write=none +AT91C_US0_IDR.name="AT91C_US0_IDR" +AT91C_US0_IDR.description="Interrupt Disable Register" +AT91C_US0_IDR.helpkey="Interrupt Disable Register" +AT91C_US0_IDR.access=memorymapped +AT91C_US0_IDR.address=0xFFFC000C +AT91C_US0_IDR.width=32 +AT91C_US0_IDR.byteEndian=little +AT91C_US0_IDR.type=enum +AT91C_US0_IDR.enum.0.name=*** Write only *** +AT91C_US0_IDR.enum.1.name=Error +AT91C_US0_THR.name="AT91C_US0_THR" +AT91C_US0_THR.description="Transmitter Holding Register" +AT91C_US0_THR.helpkey="Transmitter Holding Register" +AT91C_US0_THR.access=memorymapped +AT91C_US0_THR.address=0xFFFC001C +AT91C_US0_THR.width=32 +AT91C_US0_THR.byteEndian=little +AT91C_US0_THR.type=enum +AT91C_US0_THR.enum.0.name=*** Write only *** +AT91C_US0_THR.enum.1.name=Error +AT91C_US0_IF.name="AT91C_US0_IF" +AT91C_US0_IF.description="IRDA_FILTER Register" +AT91C_US0_IF.helpkey="IRDA_FILTER Register" +AT91C_US0_IF.access=memorymapped +AT91C_US0_IF.address=0xFFFC004C +AT91C_US0_IF.width=32 +AT91C_US0_IF.byteEndian=little +AT91C_US0_IER.name="AT91C_US0_IER" +AT91C_US0_IER.description="Interrupt Enable Register" +AT91C_US0_IER.helpkey="Interrupt Enable Register" +AT91C_US0_IER.access=memorymapped +AT91C_US0_IER.address=0xFFFC0008 +AT91C_US0_IER.width=32 +AT91C_US0_IER.byteEndian=little +AT91C_US0_IER.type=enum +AT91C_US0_IER.enum.0.name=*** Write only *** +AT91C_US0_IER.enum.1.name=Error +# ========== Register definition for PDC_SSC peripheral ========== +AT91C_SSC_TNCR.name="AT91C_SSC_TNCR" +AT91C_SSC_TNCR.description="Transmit Next Counter Register" +AT91C_SSC_TNCR.helpkey="Transmit Next Counter Register" +AT91C_SSC_TNCR.access=memorymapped +AT91C_SSC_TNCR.address=0xFFFD411C +AT91C_SSC_TNCR.width=32 +AT91C_SSC_TNCR.byteEndian=little +AT91C_SSC_RPR.name="AT91C_SSC_RPR" +AT91C_SSC_RPR.description="Receive Pointer Register" +AT91C_SSC_RPR.helpkey="Receive Pointer Register" +AT91C_SSC_RPR.access=memorymapped +AT91C_SSC_RPR.address=0xFFFD4100 +AT91C_SSC_RPR.width=32 +AT91C_SSC_RPR.byteEndian=little +AT91C_SSC_RNCR.name="AT91C_SSC_RNCR" +AT91C_SSC_RNCR.description="Receive Next Counter Register" +AT91C_SSC_RNCR.helpkey="Receive Next Counter Register" +AT91C_SSC_RNCR.access=memorymapped +AT91C_SSC_RNCR.address=0xFFFD4114 +AT91C_SSC_RNCR.width=32 +AT91C_SSC_RNCR.byteEndian=little +AT91C_SSC_TPR.name="AT91C_SSC_TPR" +AT91C_SSC_TPR.description="Transmit Pointer Register" +AT91C_SSC_TPR.helpkey="Transmit Pointer Register" +AT91C_SSC_TPR.access=memorymapped +AT91C_SSC_TPR.address=0xFFFD4108 +AT91C_SSC_TPR.width=32 +AT91C_SSC_TPR.byteEndian=little +AT91C_SSC_PTCR.name="AT91C_SSC_PTCR" +AT91C_SSC_PTCR.description="PDC Transfer Control Register" +AT91C_SSC_PTCR.helpkey="PDC Transfer Control Register" +AT91C_SSC_PTCR.access=memorymapped +AT91C_SSC_PTCR.address=0xFFFD4120 +AT91C_SSC_PTCR.width=32 +AT91C_SSC_PTCR.byteEndian=little +AT91C_SSC_PTCR.type=enum +AT91C_SSC_PTCR.enum.0.name=*** Write only *** +AT91C_SSC_PTCR.enum.1.name=Error +AT91C_SSC_TCR.name="AT91C_SSC_TCR" +AT91C_SSC_TCR.description="Transmit Counter Register" +AT91C_SSC_TCR.helpkey="Transmit Counter Register" +AT91C_SSC_TCR.access=memorymapped +AT91C_SSC_TCR.address=0xFFFD410C +AT91C_SSC_TCR.width=32 +AT91C_SSC_TCR.byteEndian=little +AT91C_SSC_RCR.name="AT91C_SSC_RCR" +AT91C_SSC_RCR.description="Receive Counter Register" +AT91C_SSC_RCR.helpkey="Receive Counter Register" +AT91C_SSC_RCR.access=memorymapped +AT91C_SSC_RCR.address=0xFFFD4104 +AT91C_SSC_RCR.width=32 +AT91C_SSC_RCR.byteEndian=little +AT91C_SSC_RNPR.name="AT91C_SSC_RNPR" +AT91C_SSC_RNPR.description="Receive Next Pointer Register" +AT91C_SSC_RNPR.helpkey="Receive Next Pointer Register" +AT91C_SSC_RNPR.access=memorymapped +AT91C_SSC_RNPR.address=0xFFFD4110 +AT91C_SSC_RNPR.width=32 +AT91C_SSC_RNPR.byteEndian=little +AT91C_SSC_TNPR.name="AT91C_SSC_TNPR" +AT91C_SSC_TNPR.description="Transmit Next Pointer Register" +AT91C_SSC_TNPR.helpkey="Transmit Next Pointer Register" +AT91C_SSC_TNPR.access=memorymapped +AT91C_SSC_TNPR.address=0xFFFD4118 +AT91C_SSC_TNPR.width=32 +AT91C_SSC_TNPR.byteEndian=little +AT91C_SSC_PTSR.name="AT91C_SSC_PTSR" +AT91C_SSC_PTSR.description="PDC Transfer Status Register" +AT91C_SSC_PTSR.helpkey="PDC Transfer Status Register" +AT91C_SSC_PTSR.access=memorymapped +AT91C_SSC_PTSR.address=0xFFFD4124 +AT91C_SSC_PTSR.width=32 +AT91C_SSC_PTSR.byteEndian=little +AT91C_SSC_PTSR.permission.write=none +# ========== Register definition for SSC peripheral ========== +AT91C_SSC_RHR.name="AT91C_SSC_RHR" +AT91C_SSC_RHR.description="Receive Holding Register" +AT91C_SSC_RHR.helpkey="Receive Holding Register" +AT91C_SSC_RHR.access=memorymapped +AT91C_SSC_RHR.address=0xFFFD4020 +AT91C_SSC_RHR.width=32 +AT91C_SSC_RHR.byteEndian=little +AT91C_SSC_RHR.permission.write=none +AT91C_SSC_RSHR.name="AT91C_SSC_RSHR" +AT91C_SSC_RSHR.description="Receive Sync Holding Register" +AT91C_SSC_RSHR.helpkey="Receive Sync Holding Register" +AT91C_SSC_RSHR.access=memorymapped +AT91C_SSC_RSHR.address=0xFFFD4030 +AT91C_SSC_RSHR.width=32 +AT91C_SSC_RSHR.byteEndian=little +AT91C_SSC_RSHR.permission.write=none +AT91C_SSC_TFMR.name="AT91C_SSC_TFMR" +AT91C_SSC_TFMR.description="Transmit Frame Mode Register" +AT91C_SSC_TFMR.helpkey="Transmit Frame Mode Register" +AT91C_SSC_TFMR.access=memorymapped +AT91C_SSC_TFMR.address=0xFFFD401C +AT91C_SSC_TFMR.width=32 +AT91C_SSC_TFMR.byteEndian=little +AT91C_SSC_IDR.name="AT91C_SSC_IDR" +AT91C_SSC_IDR.description="Interrupt Disable Register" +AT91C_SSC_IDR.helpkey="Interrupt Disable Register" +AT91C_SSC_IDR.access=memorymapped +AT91C_SSC_IDR.address=0xFFFD4048 +AT91C_SSC_IDR.width=32 +AT91C_SSC_IDR.byteEndian=little +AT91C_SSC_IDR.type=enum +AT91C_SSC_IDR.enum.0.name=*** Write only *** +AT91C_SSC_IDR.enum.1.name=Error +AT91C_SSC_THR.name="AT91C_SSC_THR" +AT91C_SSC_THR.description="Transmit Holding Register" +AT91C_SSC_THR.helpkey="Transmit Holding Register" +AT91C_SSC_THR.access=memorymapped +AT91C_SSC_THR.address=0xFFFD4024 +AT91C_SSC_THR.width=32 +AT91C_SSC_THR.byteEndian=little +AT91C_SSC_THR.type=enum +AT91C_SSC_THR.enum.0.name=*** Write only *** +AT91C_SSC_THR.enum.1.name=Error +AT91C_SSC_RCMR.name="AT91C_SSC_RCMR" +AT91C_SSC_RCMR.description="Receive Clock ModeRegister" +AT91C_SSC_RCMR.helpkey="Receive Clock ModeRegister" +AT91C_SSC_RCMR.access=memorymapped +AT91C_SSC_RCMR.address=0xFFFD4010 +AT91C_SSC_RCMR.width=32 +AT91C_SSC_RCMR.byteEndian=little +AT91C_SSC_IER.name="AT91C_SSC_IER" +AT91C_SSC_IER.description="Interrupt Enable Register" +AT91C_SSC_IER.helpkey="Interrupt Enable Register" +AT91C_SSC_IER.access=memorymapped +AT91C_SSC_IER.address=0xFFFD4044 +AT91C_SSC_IER.width=32 +AT91C_SSC_IER.byteEndian=little +AT91C_SSC_IER.type=enum +AT91C_SSC_IER.enum.0.name=*** Write only *** +AT91C_SSC_IER.enum.1.name=Error +AT91C_SSC_TSHR.name="AT91C_SSC_TSHR" +AT91C_SSC_TSHR.description="Transmit Sync Holding Register" +AT91C_SSC_TSHR.helpkey="Transmit Sync Holding Register" +AT91C_SSC_TSHR.access=memorymapped +AT91C_SSC_TSHR.address=0xFFFD4034 +AT91C_SSC_TSHR.width=32 +AT91C_SSC_TSHR.byteEndian=little +AT91C_SSC_SR.name="AT91C_SSC_SR" +AT91C_SSC_SR.description="Status Register" +AT91C_SSC_SR.helpkey="Status Register" +AT91C_SSC_SR.access=memorymapped +AT91C_SSC_SR.address=0xFFFD4040 +AT91C_SSC_SR.width=32 +AT91C_SSC_SR.byteEndian=little +AT91C_SSC_SR.permission.write=none +AT91C_SSC_CMR.name="AT91C_SSC_CMR" +AT91C_SSC_CMR.description="Clock Mode Register" +AT91C_SSC_CMR.helpkey="Clock Mode Register" +AT91C_SSC_CMR.access=memorymapped +AT91C_SSC_CMR.address=0xFFFD4004 +AT91C_SSC_CMR.width=32 +AT91C_SSC_CMR.byteEndian=little +AT91C_SSC_TCMR.name="AT91C_SSC_TCMR" +AT91C_SSC_TCMR.description="Transmit Clock Mode Register" +AT91C_SSC_TCMR.helpkey="Transmit Clock Mode Register" +AT91C_SSC_TCMR.access=memorymapped +AT91C_SSC_TCMR.address=0xFFFD4018 +AT91C_SSC_TCMR.width=32 +AT91C_SSC_TCMR.byteEndian=little +AT91C_SSC_CR.name="AT91C_SSC_CR" +AT91C_SSC_CR.description="Control Register" +AT91C_SSC_CR.helpkey="Control Register" +AT91C_SSC_CR.access=memorymapped +AT91C_SSC_CR.address=0xFFFD4000 +AT91C_SSC_CR.width=32 +AT91C_SSC_CR.byteEndian=little +AT91C_SSC_CR.type=enum +AT91C_SSC_CR.enum.0.name=*** Write only *** +AT91C_SSC_CR.enum.1.name=Error +AT91C_SSC_IMR.name="AT91C_SSC_IMR" +AT91C_SSC_IMR.description="Interrupt Mask Register" +AT91C_SSC_IMR.helpkey="Interrupt Mask Register" +AT91C_SSC_IMR.access=memorymapped +AT91C_SSC_IMR.address=0xFFFD404C +AT91C_SSC_IMR.width=32 +AT91C_SSC_IMR.byteEndian=little +AT91C_SSC_IMR.permission.write=none +AT91C_SSC_RFMR.name="AT91C_SSC_RFMR" +AT91C_SSC_RFMR.description="Receive Frame Mode Register" +AT91C_SSC_RFMR.helpkey="Receive Frame Mode Register" +AT91C_SSC_RFMR.access=memorymapped +AT91C_SSC_RFMR.address=0xFFFD4014 +AT91C_SSC_RFMR.width=32 +AT91C_SSC_RFMR.byteEndian=little +# ========== Register definition for TWI peripheral ========== +AT91C_TWI_IER.name="AT91C_TWI_IER" +AT91C_TWI_IER.description="Interrupt Enable Register" +AT91C_TWI_IER.helpkey="Interrupt Enable Register" +AT91C_TWI_IER.access=memorymapped +AT91C_TWI_IER.address=0xFFFB8024 +AT91C_TWI_IER.width=32 +AT91C_TWI_IER.byteEndian=little +AT91C_TWI_IER.type=enum +AT91C_TWI_IER.enum.0.name=*** Write only *** +AT91C_TWI_IER.enum.1.name=Error +AT91C_TWI_CR.name="AT91C_TWI_CR" +AT91C_TWI_CR.description="Control Register" +AT91C_TWI_CR.helpkey="Control Register" +AT91C_TWI_CR.access=memorymapped +AT91C_TWI_CR.address=0xFFFB8000 +AT91C_TWI_CR.width=32 +AT91C_TWI_CR.byteEndian=little +AT91C_TWI_CR.type=enum +AT91C_TWI_CR.enum.0.name=*** Write only *** +AT91C_TWI_CR.enum.1.name=Error +AT91C_TWI_SR.name="AT91C_TWI_SR" +AT91C_TWI_SR.description="Status Register" +AT91C_TWI_SR.helpkey="Status Register" +AT91C_TWI_SR.access=memorymapped +AT91C_TWI_SR.address=0xFFFB8020 +AT91C_TWI_SR.width=32 +AT91C_TWI_SR.byteEndian=little +AT91C_TWI_SR.permission.write=none +AT91C_TWI_IMR.name="AT91C_TWI_IMR" +AT91C_TWI_IMR.description="Interrupt Mask Register" +AT91C_TWI_IMR.helpkey="Interrupt Mask Register" +AT91C_TWI_IMR.access=memorymapped +AT91C_TWI_IMR.address=0xFFFB802C +AT91C_TWI_IMR.width=32 +AT91C_TWI_IMR.byteEndian=little +AT91C_TWI_IMR.permission.write=none +AT91C_TWI_THR.name="AT91C_TWI_THR" +AT91C_TWI_THR.description="Transmit Holding Register" +AT91C_TWI_THR.helpkey="Transmit Holding Register" +AT91C_TWI_THR.access=memorymapped +AT91C_TWI_THR.address=0xFFFB8034 +AT91C_TWI_THR.width=32 +AT91C_TWI_THR.byteEndian=little +AT91C_TWI_THR.type=enum +AT91C_TWI_THR.enum.0.name=*** Write only *** +AT91C_TWI_THR.enum.1.name=Error +AT91C_TWI_IDR.name="AT91C_TWI_IDR" +AT91C_TWI_IDR.description="Interrupt Disable Register" +AT91C_TWI_IDR.helpkey="Interrupt Disable Register" +AT91C_TWI_IDR.access=memorymapped +AT91C_TWI_IDR.address=0xFFFB8028 +AT91C_TWI_IDR.width=32 +AT91C_TWI_IDR.byteEndian=little +AT91C_TWI_IDR.type=enum +AT91C_TWI_IDR.enum.0.name=*** Write only *** +AT91C_TWI_IDR.enum.1.name=Error +AT91C_TWI_IADR.name="AT91C_TWI_IADR" +AT91C_TWI_IADR.description="Internal Address Register" +AT91C_TWI_IADR.helpkey="Internal Address Register" +AT91C_TWI_IADR.access=memorymapped +AT91C_TWI_IADR.address=0xFFFB800C +AT91C_TWI_IADR.width=32 +AT91C_TWI_IADR.byteEndian=little +AT91C_TWI_MMR.name="AT91C_TWI_MMR" +AT91C_TWI_MMR.description="Master Mode Register" +AT91C_TWI_MMR.helpkey="Master Mode Register" +AT91C_TWI_MMR.access=memorymapped +AT91C_TWI_MMR.address=0xFFFB8004 +AT91C_TWI_MMR.width=32 +AT91C_TWI_MMR.byteEndian=little +AT91C_TWI_CWGR.name="AT91C_TWI_CWGR" +AT91C_TWI_CWGR.description="Clock Waveform Generator Register" +AT91C_TWI_CWGR.helpkey="Clock Waveform Generator Register" +AT91C_TWI_CWGR.access=memorymapped +AT91C_TWI_CWGR.address=0xFFFB8010 +AT91C_TWI_CWGR.width=32 +AT91C_TWI_CWGR.byteEndian=little +AT91C_TWI_RHR.name="AT91C_TWI_RHR" +AT91C_TWI_RHR.description="Receive Holding Register" +AT91C_TWI_RHR.helpkey="Receive Holding Register" +AT91C_TWI_RHR.access=memorymapped +AT91C_TWI_RHR.address=0xFFFB8030 +AT91C_TWI_RHR.width=32 +AT91C_TWI_RHR.byteEndian=little +AT91C_TWI_RHR.permission.write=none +# ========== Register definition for PWMC_CH3 peripheral ========== +AT91C_PWMC_CH3_CUPDR.name="AT91C_PWMC_CH3_CUPDR" +AT91C_PWMC_CH3_CUPDR.description="Channel Update Register" +AT91C_PWMC_CH3_CUPDR.helpkey="Channel Update Register" +AT91C_PWMC_CH3_CUPDR.access=memorymapped +AT91C_PWMC_CH3_CUPDR.address=0xFFFCC270 +AT91C_PWMC_CH3_CUPDR.width=32 +AT91C_PWMC_CH3_CUPDR.byteEndian=little +AT91C_PWMC_CH3_CUPDR.type=enum +AT91C_PWMC_CH3_CUPDR.enum.0.name=*** Write only *** +AT91C_PWMC_CH3_CUPDR.enum.1.name=Error +AT91C_PWMC_CH3_Reserved.name="AT91C_PWMC_CH3_Reserved" +AT91C_PWMC_CH3_Reserved.description="Reserved" +AT91C_PWMC_CH3_Reserved.helpkey="Reserved" +AT91C_PWMC_CH3_Reserved.access=memorymapped +AT91C_PWMC_CH3_Reserved.address=0xFFFCC274 +AT91C_PWMC_CH3_Reserved.width=32 +AT91C_PWMC_CH3_Reserved.byteEndian=little +AT91C_PWMC_CH3_Reserved.type=enum +AT91C_PWMC_CH3_Reserved.enum.0.name=*** Write only *** +AT91C_PWMC_CH3_Reserved.enum.1.name=Error +AT91C_PWMC_CH3_CPRDR.name="AT91C_PWMC_CH3_CPRDR" +AT91C_PWMC_CH3_CPRDR.description="Channel Period Register" +AT91C_PWMC_CH3_CPRDR.helpkey="Channel Period Register" +AT91C_PWMC_CH3_CPRDR.access=memorymapped +AT91C_PWMC_CH3_CPRDR.address=0xFFFCC268 +AT91C_PWMC_CH3_CPRDR.width=32 +AT91C_PWMC_CH3_CPRDR.byteEndian=little +AT91C_PWMC_CH3_CDTYR.name="AT91C_PWMC_CH3_CDTYR" +AT91C_PWMC_CH3_CDTYR.description="Channel Duty Cycle Register" +AT91C_PWMC_CH3_CDTYR.helpkey="Channel Duty Cycle Register" +AT91C_PWMC_CH3_CDTYR.access=memorymapped +AT91C_PWMC_CH3_CDTYR.address=0xFFFCC264 +AT91C_PWMC_CH3_CDTYR.width=32 +AT91C_PWMC_CH3_CDTYR.byteEndian=little +AT91C_PWMC_CH3_CCNTR.name="AT91C_PWMC_CH3_CCNTR" +AT91C_PWMC_CH3_CCNTR.description="Channel Counter Register" +AT91C_PWMC_CH3_CCNTR.helpkey="Channel Counter Register" +AT91C_PWMC_CH3_CCNTR.access=memorymapped +AT91C_PWMC_CH3_CCNTR.address=0xFFFCC26C +AT91C_PWMC_CH3_CCNTR.width=32 +AT91C_PWMC_CH3_CCNTR.byteEndian=little +AT91C_PWMC_CH3_CCNTR.permission.write=none +AT91C_PWMC_CH3_CMR.name="AT91C_PWMC_CH3_CMR" +AT91C_PWMC_CH3_CMR.description="Channel Mode Register" +AT91C_PWMC_CH3_CMR.helpkey="Channel Mode Register" +AT91C_PWMC_CH3_CMR.access=memorymapped +AT91C_PWMC_CH3_CMR.address=0xFFFCC260 +AT91C_PWMC_CH3_CMR.width=32 +AT91C_PWMC_CH3_CMR.byteEndian=little +# ========== Register definition for PWMC_CH2 peripheral ========== +AT91C_PWMC_CH2_Reserved.name="AT91C_PWMC_CH2_Reserved" +AT91C_PWMC_CH2_Reserved.description="Reserved" +AT91C_PWMC_CH2_Reserved.helpkey="Reserved" +AT91C_PWMC_CH2_Reserved.access=memorymapped +AT91C_PWMC_CH2_Reserved.address=0xFFFCC254 +AT91C_PWMC_CH2_Reserved.width=32 +AT91C_PWMC_CH2_Reserved.byteEndian=little +AT91C_PWMC_CH2_Reserved.type=enum +AT91C_PWMC_CH2_Reserved.enum.0.name=*** Write only *** +AT91C_PWMC_CH2_Reserved.enum.1.name=Error +AT91C_PWMC_CH2_CMR.name="AT91C_PWMC_CH2_CMR" +AT91C_PWMC_CH2_CMR.description="Channel Mode Register" +AT91C_PWMC_CH2_CMR.helpkey="Channel Mode Register" +AT91C_PWMC_CH2_CMR.access=memorymapped +AT91C_PWMC_CH2_CMR.address=0xFFFCC240 +AT91C_PWMC_CH2_CMR.width=32 +AT91C_PWMC_CH2_CMR.byteEndian=little +AT91C_PWMC_CH2_CCNTR.name="AT91C_PWMC_CH2_CCNTR" +AT91C_PWMC_CH2_CCNTR.description="Channel Counter Register" +AT91C_PWMC_CH2_CCNTR.helpkey="Channel Counter Register" +AT91C_PWMC_CH2_CCNTR.access=memorymapped +AT91C_PWMC_CH2_CCNTR.address=0xFFFCC24C +AT91C_PWMC_CH2_CCNTR.width=32 +AT91C_PWMC_CH2_CCNTR.byteEndian=little +AT91C_PWMC_CH2_CCNTR.permission.write=none +AT91C_PWMC_CH2_CPRDR.name="AT91C_PWMC_CH2_CPRDR" +AT91C_PWMC_CH2_CPRDR.description="Channel Period Register" +AT91C_PWMC_CH2_CPRDR.helpkey="Channel Period Register" +AT91C_PWMC_CH2_CPRDR.access=memorymapped +AT91C_PWMC_CH2_CPRDR.address=0xFFFCC248 +AT91C_PWMC_CH2_CPRDR.width=32 +AT91C_PWMC_CH2_CPRDR.byteEndian=little +AT91C_PWMC_CH2_CUPDR.name="AT91C_PWMC_CH2_CUPDR" +AT91C_PWMC_CH2_CUPDR.description="Channel Update Register" +AT91C_PWMC_CH2_CUPDR.helpkey="Channel Update Register" +AT91C_PWMC_CH2_CUPDR.access=memorymapped +AT91C_PWMC_CH2_CUPDR.address=0xFFFCC250 +AT91C_PWMC_CH2_CUPDR.width=32 +AT91C_PWMC_CH2_CUPDR.byteEndian=little +AT91C_PWMC_CH2_CUPDR.type=enum +AT91C_PWMC_CH2_CUPDR.enum.0.name=*** Write only *** +AT91C_PWMC_CH2_CUPDR.enum.1.name=Error +AT91C_PWMC_CH2_CDTYR.name="AT91C_PWMC_CH2_CDTYR" +AT91C_PWMC_CH2_CDTYR.description="Channel Duty Cycle Register" +AT91C_PWMC_CH2_CDTYR.helpkey="Channel Duty Cycle Register" +AT91C_PWMC_CH2_CDTYR.access=memorymapped +AT91C_PWMC_CH2_CDTYR.address=0xFFFCC244 +AT91C_PWMC_CH2_CDTYR.width=32 +AT91C_PWMC_CH2_CDTYR.byteEndian=little +# ========== Register definition for PWMC_CH1 peripheral ========== +AT91C_PWMC_CH1_Reserved.name="AT91C_PWMC_CH1_Reserved" +AT91C_PWMC_CH1_Reserved.description="Reserved" +AT91C_PWMC_CH1_Reserved.helpkey="Reserved" +AT91C_PWMC_CH1_Reserved.access=memorymapped +AT91C_PWMC_CH1_Reserved.address=0xFFFCC234 +AT91C_PWMC_CH1_Reserved.width=32 +AT91C_PWMC_CH1_Reserved.byteEndian=little +AT91C_PWMC_CH1_Reserved.type=enum +AT91C_PWMC_CH1_Reserved.enum.0.name=*** Write only *** +AT91C_PWMC_CH1_Reserved.enum.1.name=Error +AT91C_PWMC_CH1_CUPDR.name="AT91C_PWMC_CH1_CUPDR" +AT91C_PWMC_CH1_CUPDR.description="Channel Update Register" +AT91C_PWMC_CH1_CUPDR.helpkey="Channel Update Register" +AT91C_PWMC_CH1_CUPDR.access=memorymapped +AT91C_PWMC_CH1_CUPDR.address=0xFFFCC230 +AT91C_PWMC_CH1_CUPDR.width=32 +AT91C_PWMC_CH1_CUPDR.byteEndian=little +AT91C_PWMC_CH1_CUPDR.type=enum +AT91C_PWMC_CH1_CUPDR.enum.0.name=*** Write only *** +AT91C_PWMC_CH1_CUPDR.enum.1.name=Error +AT91C_PWMC_CH1_CPRDR.name="AT91C_PWMC_CH1_CPRDR" +AT91C_PWMC_CH1_CPRDR.description="Channel Period Register" +AT91C_PWMC_CH1_CPRDR.helpkey="Channel Period Register" +AT91C_PWMC_CH1_CPRDR.access=memorymapped +AT91C_PWMC_CH1_CPRDR.address=0xFFFCC228 +AT91C_PWMC_CH1_CPRDR.width=32 +AT91C_PWMC_CH1_CPRDR.byteEndian=little +AT91C_PWMC_CH1_CCNTR.name="AT91C_PWMC_CH1_CCNTR" +AT91C_PWMC_CH1_CCNTR.description="Channel Counter Register" +AT91C_PWMC_CH1_CCNTR.helpkey="Channel Counter Register" +AT91C_PWMC_CH1_CCNTR.access=memorymapped +AT91C_PWMC_CH1_CCNTR.address=0xFFFCC22C +AT91C_PWMC_CH1_CCNTR.width=32 +AT91C_PWMC_CH1_CCNTR.byteEndian=little +AT91C_PWMC_CH1_CCNTR.permission.write=none +AT91C_PWMC_CH1_CDTYR.name="AT91C_PWMC_CH1_CDTYR" +AT91C_PWMC_CH1_CDTYR.description="Channel Duty Cycle Register" +AT91C_PWMC_CH1_CDTYR.helpkey="Channel Duty Cycle Register" +AT91C_PWMC_CH1_CDTYR.access=memorymapped +AT91C_PWMC_CH1_CDTYR.address=0xFFFCC224 +AT91C_PWMC_CH1_CDTYR.width=32 +AT91C_PWMC_CH1_CDTYR.byteEndian=little +AT91C_PWMC_CH1_CMR.name="AT91C_PWMC_CH1_CMR" +AT91C_PWMC_CH1_CMR.description="Channel Mode Register" +AT91C_PWMC_CH1_CMR.helpkey="Channel Mode Register" +AT91C_PWMC_CH1_CMR.access=memorymapped +AT91C_PWMC_CH1_CMR.address=0xFFFCC220 +AT91C_PWMC_CH1_CMR.width=32 +AT91C_PWMC_CH1_CMR.byteEndian=little +# ========== Register definition for PWMC_CH0 peripheral ========== +AT91C_PWMC_CH0_Reserved.name="AT91C_PWMC_CH0_Reserved" +AT91C_PWMC_CH0_Reserved.description="Reserved" +AT91C_PWMC_CH0_Reserved.helpkey="Reserved" +AT91C_PWMC_CH0_Reserved.access=memorymapped +AT91C_PWMC_CH0_Reserved.address=0xFFFCC214 +AT91C_PWMC_CH0_Reserved.width=32 +AT91C_PWMC_CH0_Reserved.byteEndian=little +AT91C_PWMC_CH0_Reserved.type=enum +AT91C_PWMC_CH0_Reserved.enum.0.name=*** Write only *** +AT91C_PWMC_CH0_Reserved.enum.1.name=Error +AT91C_PWMC_CH0_CPRDR.name="AT91C_PWMC_CH0_CPRDR" +AT91C_PWMC_CH0_CPRDR.description="Channel Period Register" +AT91C_PWMC_CH0_CPRDR.helpkey="Channel Period Register" +AT91C_PWMC_CH0_CPRDR.access=memorymapped +AT91C_PWMC_CH0_CPRDR.address=0xFFFCC208 +AT91C_PWMC_CH0_CPRDR.width=32 +AT91C_PWMC_CH0_CPRDR.byteEndian=little +AT91C_PWMC_CH0_CDTYR.name="AT91C_PWMC_CH0_CDTYR" +AT91C_PWMC_CH0_CDTYR.description="Channel Duty Cycle Register" +AT91C_PWMC_CH0_CDTYR.helpkey="Channel Duty Cycle Register" +AT91C_PWMC_CH0_CDTYR.access=memorymapped +AT91C_PWMC_CH0_CDTYR.address=0xFFFCC204 +AT91C_PWMC_CH0_CDTYR.width=32 +AT91C_PWMC_CH0_CDTYR.byteEndian=little +AT91C_PWMC_CH0_CMR.name="AT91C_PWMC_CH0_CMR" +AT91C_PWMC_CH0_CMR.description="Channel Mode Register" +AT91C_PWMC_CH0_CMR.helpkey="Channel Mode Register" +AT91C_PWMC_CH0_CMR.access=memorymapped +AT91C_PWMC_CH0_CMR.address=0xFFFCC200 +AT91C_PWMC_CH0_CMR.width=32 +AT91C_PWMC_CH0_CMR.byteEndian=little +AT91C_PWMC_CH0_CUPDR.name="AT91C_PWMC_CH0_CUPDR" +AT91C_PWMC_CH0_CUPDR.description="Channel Update Register" +AT91C_PWMC_CH0_CUPDR.helpkey="Channel Update Register" +AT91C_PWMC_CH0_CUPDR.access=memorymapped +AT91C_PWMC_CH0_CUPDR.address=0xFFFCC210 +AT91C_PWMC_CH0_CUPDR.width=32 +AT91C_PWMC_CH0_CUPDR.byteEndian=little +AT91C_PWMC_CH0_CUPDR.type=enum +AT91C_PWMC_CH0_CUPDR.enum.0.name=*** Write only *** +AT91C_PWMC_CH0_CUPDR.enum.1.name=Error +AT91C_PWMC_CH0_CCNTR.name="AT91C_PWMC_CH0_CCNTR" +AT91C_PWMC_CH0_CCNTR.description="Channel Counter Register" +AT91C_PWMC_CH0_CCNTR.helpkey="Channel Counter Register" +AT91C_PWMC_CH0_CCNTR.access=memorymapped +AT91C_PWMC_CH0_CCNTR.address=0xFFFCC20C +AT91C_PWMC_CH0_CCNTR.width=32 +AT91C_PWMC_CH0_CCNTR.byteEndian=little +AT91C_PWMC_CH0_CCNTR.permission.write=none +# ========== Register definition for PWMC peripheral ========== +AT91C_PWMC_IDR.name="AT91C_PWMC_IDR" +AT91C_PWMC_IDR.description="PWMC Interrupt Disable Register" +AT91C_PWMC_IDR.helpkey="PWMC Interrupt Disable Register" +AT91C_PWMC_IDR.access=memorymapped +AT91C_PWMC_IDR.address=0xFFFCC014 +AT91C_PWMC_IDR.width=32 +AT91C_PWMC_IDR.byteEndian=little +AT91C_PWMC_IDR.type=enum +AT91C_PWMC_IDR.enum.0.name=*** Write only *** +AT91C_PWMC_IDR.enum.1.name=Error +AT91C_PWMC_DIS.name="AT91C_PWMC_DIS" +AT91C_PWMC_DIS.description="PWMC Disable Register" +AT91C_PWMC_DIS.helpkey="PWMC Disable Register" +AT91C_PWMC_DIS.access=memorymapped +AT91C_PWMC_DIS.address=0xFFFCC008 +AT91C_PWMC_DIS.width=32 +AT91C_PWMC_DIS.byteEndian=little +AT91C_PWMC_DIS.type=enum +AT91C_PWMC_DIS.enum.0.name=*** Write only *** +AT91C_PWMC_DIS.enum.1.name=Error +AT91C_PWMC_IER.name="AT91C_PWMC_IER" +AT91C_PWMC_IER.description="PWMC Interrupt Enable Register" +AT91C_PWMC_IER.helpkey="PWMC Interrupt Enable Register" +AT91C_PWMC_IER.access=memorymapped +AT91C_PWMC_IER.address=0xFFFCC010 +AT91C_PWMC_IER.width=32 +AT91C_PWMC_IER.byteEndian=little +AT91C_PWMC_IER.type=enum +AT91C_PWMC_IER.enum.0.name=*** Write only *** +AT91C_PWMC_IER.enum.1.name=Error +AT91C_PWMC_VR.name="AT91C_PWMC_VR" +AT91C_PWMC_VR.description="PWMC Version Register" +AT91C_PWMC_VR.helpkey="PWMC Version Register" +AT91C_PWMC_VR.access=memorymapped +AT91C_PWMC_VR.address=0xFFFCC0FC +AT91C_PWMC_VR.width=32 +AT91C_PWMC_VR.byteEndian=little +AT91C_PWMC_VR.permission.write=none +AT91C_PWMC_ISR.name="AT91C_PWMC_ISR" +AT91C_PWMC_ISR.description="PWMC Interrupt Status Register" +AT91C_PWMC_ISR.helpkey="PWMC Interrupt Status Register" +AT91C_PWMC_ISR.access=memorymapped +AT91C_PWMC_ISR.address=0xFFFCC01C +AT91C_PWMC_ISR.width=32 +AT91C_PWMC_ISR.byteEndian=little +AT91C_PWMC_ISR.permission.write=none +AT91C_PWMC_SR.name="AT91C_PWMC_SR" +AT91C_PWMC_SR.description="PWMC Status Register" +AT91C_PWMC_SR.helpkey="PWMC Status Register" +AT91C_PWMC_SR.access=memorymapped +AT91C_PWMC_SR.address=0xFFFCC00C +AT91C_PWMC_SR.width=32 +AT91C_PWMC_SR.byteEndian=little +AT91C_PWMC_SR.permission.write=none +AT91C_PWMC_IMR.name="AT91C_PWMC_IMR" +AT91C_PWMC_IMR.description="PWMC Interrupt Mask Register" +AT91C_PWMC_IMR.helpkey="PWMC Interrupt Mask Register" +AT91C_PWMC_IMR.access=memorymapped +AT91C_PWMC_IMR.address=0xFFFCC018 +AT91C_PWMC_IMR.width=32 +AT91C_PWMC_IMR.byteEndian=little +AT91C_PWMC_IMR.permission.write=none +AT91C_PWMC_MR.name="AT91C_PWMC_MR" +AT91C_PWMC_MR.description="PWMC Mode Register" +AT91C_PWMC_MR.helpkey="PWMC Mode Register" +AT91C_PWMC_MR.access=memorymapped +AT91C_PWMC_MR.address=0xFFFCC000 +AT91C_PWMC_MR.width=32 +AT91C_PWMC_MR.byteEndian=little +AT91C_PWMC_ENA.name="AT91C_PWMC_ENA" +AT91C_PWMC_ENA.description="PWMC Enable Register" +AT91C_PWMC_ENA.helpkey="PWMC Enable Register" +AT91C_PWMC_ENA.access=memorymapped +AT91C_PWMC_ENA.address=0xFFFCC004 +AT91C_PWMC_ENA.width=32 +AT91C_PWMC_ENA.byteEndian=little +AT91C_PWMC_ENA.type=enum +AT91C_PWMC_ENA.enum.0.name=*** Write only *** +AT91C_PWMC_ENA.enum.1.name=Error +# ========== Register definition for UDP peripheral ========== +AT91C_UDP_IMR.name="AT91C_UDP_IMR" +AT91C_UDP_IMR.description="Interrupt Mask Register" +AT91C_UDP_IMR.helpkey="Interrupt Mask Register" +AT91C_UDP_IMR.access=memorymapped +AT91C_UDP_IMR.address=0xFFFB0018 +AT91C_UDP_IMR.width=32 +AT91C_UDP_IMR.byteEndian=little +AT91C_UDP_IMR.permission.write=none +AT91C_UDP_FADDR.name="AT91C_UDP_FADDR" +AT91C_UDP_FADDR.description="Function Address Register" +AT91C_UDP_FADDR.helpkey="Function Address Register" +AT91C_UDP_FADDR.access=memorymapped +AT91C_UDP_FADDR.address=0xFFFB0008 +AT91C_UDP_FADDR.width=32 +AT91C_UDP_FADDR.byteEndian=little +AT91C_UDP_NUM.name="AT91C_UDP_NUM" +AT91C_UDP_NUM.description="Frame Number Register" +AT91C_UDP_NUM.helpkey="Frame Number Register" +AT91C_UDP_NUM.access=memorymapped +AT91C_UDP_NUM.address=0xFFFB0000 +AT91C_UDP_NUM.width=32 +AT91C_UDP_NUM.byteEndian=little +AT91C_UDP_NUM.permission.write=none +AT91C_UDP_FDR.name="AT91C_UDP_FDR" +AT91C_UDP_FDR.description="Endpoint FIFO Data Register" +AT91C_UDP_FDR.helpkey="Endpoint FIFO Data Register" +AT91C_UDP_FDR.access=memorymapped +AT91C_UDP_FDR.address=0xFFFB0050 +AT91C_UDP_FDR.width=32 +AT91C_UDP_FDR.byteEndian=little +AT91C_UDP_ISR.name="AT91C_UDP_ISR" +AT91C_UDP_ISR.description="Interrupt Status Register" +AT91C_UDP_ISR.helpkey="Interrupt Status Register" +AT91C_UDP_ISR.access=memorymapped +AT91C_UDP_ISR.address=0xFFFB001C +AT91C_UDP_ISR.width=32 +AT91C_UDP_ISR.byteEndian=little +AT91C_UDP_ISR.permission.write=none +AT91C_UDP_CSR.name="AT91C_UDP_CSR" +AT91C_UDP_CSR.description="Endpoint Control and Status Register" +AT91C_UDP_CSR.helpkey="Endpoint Control and Status Register" +AT91C_UDP_CSR.access=memorymapped +AT91C_UDP_CSR.address=0xFFFB0030 +AT91C_UDP_CSR.width=32 +AT91C_UDP_CSR.byteEndian=little +AT91C_UDP_IDR.name="AT91C_UDP_IDR" +AT91C_UDP_IDR.description="Interrupt Disable Register" +AT91C_UDP_IDR.helpkey="Interrupt Disable Register" +AT91C_UDP_IDR.access=memorymapped +AT91C_UDP_IDR.address=0xFFFB0014 +AT91C_UDP_IDR.width=32 +AT91C_UDP_IDR.byteEndian=little +AT91C_UDP_IDR.type=enum +AT91C_UDP_IDR.enum.0.name=*** Write only *** +AT91C_UDP_IDR.enum.1.name=Error +AT91C_UDP_ICR.name="AT91C_UDP_ICR" +AT91C_UDP_ICR.description="Interrupt Clear Register" +AT91C_UDP_ICR.helpkey="Interrupt Clear Register" +AT91C_UDP_ICR.access=memorymapped +AT91C_UDP_ICR.address=0xFFFB0020 +AT91C_UDP_ICR.width=32 +AT91C_UDP_ICR.byteEndian=little +AT91C_UDP_ICR.permission.write=none +AT91C_UDP_RSTEP.name="AT91C_UDP_RSTEP" +AT91C_UDP_RSTEP.description="Reset Endpoint Register" +AT91C_UDP_RSTEP.helpkey="Reset Endpoint Register" +AT91C_UDP_RSTEP.access=memorymapped +AT91C_UDP_RSTEP.address=0xFFFB0028 +AT91C_UDP_RSTEP.width=32 +AT91C_UDP_RSTEP.byteEndian=little +AT91C_UDP_RSTEP.permission.write=none +AT91C_UDP_TXVC.name="AT91C_UDP_TXVC" +AT91C_UDP_TXVC.description="Transceiver Control Register" +AT91C_UDP_TXVC.helpkey="Transceiver Control Register" +AT91C_UDP_TXVC.access=memorymapped +AT91C_UDP_TXVC.address=0xFFFB0074 +AT91C_UDP_TXVC.width=32 +AT91C_UDP_TXVC.byteEndian=little +AT91C_UDP_GLBSTATE.name="AT91C_UDP_GLBSTATE" +AT91C_UDP_GLBSTATE.description="Global State Register" +AT91C_UDP_GLBSTATE.helpkey="Global State Register" +AT91C_UDP_GLBSTATE.access=memorymapped +AT91C_UDP_GLBSTATE.address=0xFFFB0004 +AT91C_UDP_GLBSTATE.width=32 +AT91C_UDP_GLBSTATE.byteEndian=little +AT91C_UDP_IER.name="AT91C_UDP_IER" +AT91C_UDP_IER.description="Interrupt Enable Register" +AT91C_UDP_IER.helpkey="Interrupt Enable Register" +AT91C_UDP_IER.access=memorymapped +AT91C_UDP_IER.address=0xFFFB0010 +AT91C_UDP_IER.width=32 +AT91C_UDP_IER.byteEndian=little +AT91C_UDP_IER.type=enum +AT91C_UDP_IER.enum.0.name=*** Write only *** +AT91C_UDP_IER.enum.1.name=Error +# ========== Register definition for TC0 peripheral ========== +AT91C_TC0_SR.name="AT91C_TC0_SR" +AT91C_TC0_SR.description="Status Register" +AT91C_TC0_SR.helpkey="Status Register" +AT91C_TC0_SR.access=memorymapped +AT91C_TC0_SR.address=0xFFFA0020 +AT91C_TC0_SR.width=32 +AT91C_TC0_SR.byteEndian=little +AT91C_TC0_SR.permission.write=none +AT91C_TC0_RC.name="AT91C_TC0_RC" +AT91C_TC0_RC.description="Register C" +AT91C_TC0_RC.helpkey="Register C" +AT91C_TC0_RC.access=memorymapped +AT91C_TC0_RC.address=0xFFFA001C +AT91C_TC0_RC.width=32 +AT91C_TC0_RC.byteEndian=little +AT91C_TC0_RB.name="AT91C_TC0_RB" +AT91C_TC0_RB.description="Register B" +AT91C_TC0_RB.helpkey="Register B" +AT91C_TC0_RB.access=memorymapped +AT91C_TC0_RB.address=0xFFFA0018 +AT91C_TC0_RB.width=32 +AT91C_TC0_RB.byteEndian=little +AT91C_TC0_CCR.name="AT91C_TC0_CCR" +AT91C_TC0_CCR.description="Channel Control Register" +AT91C_TC0_CCR.helpkey="Channel Control Register" +AT91C_TC0_CCR.access=memorymapped +AT91C_TC0_CCR.address=0xFFFA0000 +AT91C_TC0_CCR.width=32 +AT91C_TC0_CCR.byteEndian=little +AT91C_TC0_CCR.type=enum +AT91C_TC0_CCR.enum.0.name=*** Write only *** +AT91C_TC0_CCR.enum.1.name=Error +AT91C_TC0_CMR.name="AT91C_TC0_CMR" +AT91C_TC0_CMR.description="Channel Mode Register (Capture Mode / Waveform Mode)" +AT91C_TC0_CMR.helpkey="Channel Mode Register (Capture Mode / Waveform Mode)" +AT91C_TC0_CMR.access=memorymapped +AT91C_TC0_CMR.address=0xFFFA0004 +AT91C_TC0_CMR.width=32 +AT91C_TC0_CMR.byteEndian=little +AT91C_TC0_IER.name="AT91C_TC0_IER" +AT91C_TC0_IER.description="Interrupt Enable Register" +AT91C_TC0_IER.helpkey="Interrupt Enable Register" +AT91C_TC0_IER.access=memorymapped +AT91C_TC0_IER.address=0xFFFA0024 +AT91C_TC0_IER.width=32 +AT91C_TC0_IER.byteEndian=little +AT91C_TC0_IER.type=enum +AT91C_TC0_IER.enum.0.name=*** Write only *** +AT91C_TC0_IER.enum.1.name=Error +AT91C_TC0_RA.name="AT91C_TC0_RA" +AT91C_TC0_RA.description="Register A" +AT91C_TC0_RA.helpkey="Register A" +AT91C_TC0_RA.access=memorymapped +AT91C_TC0_RA.address=0xFFFA0014 +AT91C_TC0_RA.width=32 +AT91C_TC0_RA.byteEndian=little +AT91C_TC0_IDR.name="AT91C_TC0_IDR" +AT91C_TC0_IDR.description="Interrupt Disable Register" +AT91C_TC0_IDR.helpkey="Interrupt Disable Register" +AT91C_TC0_IDR.access=memorymapped +AT91C_TC0_IDR.address=0xFFFA0028 +AT91C_TC0_IDR.width=32 +AT91C_TC0_IDR.byteEndian=little +AT91C_TC0_IDR.type=enum +AT91C_TC0_IDR.enum.0.name=*** Write only *** +AT91C_TC0_IDR.enum.1.name=Error +AT91C_TC0_CV.name="AT91C_TC0_CV" +AT91C_TC0_CV.description="Counter Value" +AT91C_TC0_CV.helpkey="Counter Value" +AT91C_TC0_CV.access=memorymapped +AT91C_TC0_CV.address=0xFFFA0010 +AT91C_TC0_CV.width=32 +AT91C_TC0_CV.byteEndian=little +AT91C_TC0_IMR.name="AT91C_TC0_IMR" +AT91C_TC0_IMR.description="Interrupt Mask Register" +AT91C_TC0_IMR.helpkey="Interrupt Mask Register" +AT91C_TC0_IMR.access=memorymapped +AT91C_TC0_IMR.address=0xFFFA002C +AT91C_TC0_IMR.width=32 +AT91C_TC0_IMR.byteEndian=little +AT91C_TC0_IMR.permission.write=none +# ========== Register definition for TC1 peripheral ========== +AT91C_TC1_RB.name="AT91C_TC1_RB" +AT91C_TC1_RB.description="Register B" +AT91C_TC1_RB.helpkey="Register B" +AT91C_TC1_RB.access=memorymapped +AT91C_TC1_RB.address=0xFFFA0058 +AT91C_TC1_RB.width=32 +AT91C_TC1_RB.byteEndian=little +AT91C_TC1_CCR.name="AT91C_TC1_CCR" +AT91C_TC1_CCR.description="Channel Control Register" +AT91C_TC1_CCR.helpkey="Channel Control Register" +AT91C_TC1_CCR.access=memorymapped +AT91C_TC1_CCR.address=0xFFFA0040 +AT91C_TC1_CCR.width=32 +AT91C_TC1_CCR.byteEndian=little +AT91C_TC1_CCR.type=enum +AT91C_TC1_CCR.enum.0.name=*** Write only *** +AT91C_TC1_CCR.enum.1.name=Error +AT91C_TC1_IER.name="AT91C_TC1_IER" +AT91C_TC1_IER.description="Interrupt Enable Register" +AT91C_TC1_IER.helpkey="Interrupt Enable Register" +AT91C_TC1_IER.access=memorymapped +AT91C_TC1_IER.address=0xFFFA0064 +AT91C_TC1_IER.width=32 +AT91C_TC1_IER.byteEndian=little +AT91C_TC1_IER.type=enum +AT91C_TC1_IER.enum.0.name=*** Write only *** +AT91C_TC1_IER.enum.1.name=Error +AT91C_TC1_IDR.name="AT91C_TC1_IDR" +AT91C_TC1_IDR.description="Interrupt Disable Register" +AT91C_TC1_IDR.helpkey="Interrupt Disable Register" +AT91C_TC1_IDR.access=memorymapped +AT91C_TC1_IDR.address=0xFFFA0068 +AT91C_TC1_IDR.width=32 +AT91C_TC1_IDR.byteEndian=little +AT91C_TC1_IDR.type=enum +AT91C_TC1_IDR.enum.0.name=*** Write only *** +AT91C_TC1_IDR.enum.1.name=Error +AT91C_TC1_SR.name="AT91C_TC1_SR" +AT91C_TC1_SR.description="Status Register" +AT91C_TC1_SR.helpkey="Status Register" +AT91C_TC1_SR.access=memorymapped +AT91C_TC1_SR.address=0xFFFA0060 +AT91C_TC1_SR.width=32 +AT91C_TC1_SR.byteEndian=little +AT91C_TC1_SR.permission.write=none +AT91C_TC1_CMR.name="AT91C_TC1_CMR" +AT91C_TC1_CMR.description="Channel Mode Register (Capture Mode / Waveform Mode)" +AT91C_TC1_CMR.helpkey="Channel Mode Register (Capture Mode / Waveform Mode)" +AT91C_TC1_CMR.access=memorymapped +AT91C_TC1_CMR.address=0xFFFA0044 +AT91C_TC1_CMR.width=32 +AT91C_TC1_CMR.byteEndian=little +AT91C_TC1_RA.name="AT91C_TC1_RA" +AT91C_TC1_RA.description="Register A" +AT91C_TC1_RA.helpkey="Register A" +AT91C_TC1_RA.access=memorymapped +AT91C_TC1_RA.address=0xFFFA0054 +AT91C_TC1_RA.width=32 +AT91C_TC1_RA.byteEndian=little +AT91C_TC1_RC.name="AT91C_TC1_RC" +AT91C_TC1_RC.description="Register C" +AT91C_TC1_RC.helpkey="Register C" +AT91C_TC1_RC.access=memorymapped +AT91C_TC1_RC.address=0xFFFA005C +AT91C_TC1_RC.width=32 +AT91C_TC1_RC.byteEndian=little +AT91C_TC1_IMR.name="AT91C_TC1_IMR" +AT91C_TC1_IMR.description="Interrupt Mask Register" +AT91C_TC1_IMR.helpkey="Interrupt Mask Register" +AT91C_TC1_IMR.access=memorymapped +AT91C_TC1_IMR.address=0xFFFA006C +AT91C_TC1_IMR.width=32 +AT91C_TC1_IMR.byteEndian=little +AT91C_TC1_IMR.permission.write=none +AT91C_TC1_CV.name="AT91C_TC1_CV" +AT91C_TC1_CV.description="Counter Value" +AT91C_TC1_CV.helpkey="Counter Value" +AT91C_TC1_CV.access=memorymapped +AT91C_TC1_CV.address=0xFFFA0050 +AT91C_TC1_CV.width=32 +AT91C_TC1_CV.byteEndian=little +# ========== Register definition for TC2 peripheral ========== +AT91C_TC2_CMR.name="AT91C_TC2_CMR" +AT91C_TC2_CMR.description="Channel Mode Register (Capture Mode / Waveform Mode)" +AT91C_TC2_CMR.helpkey="Channel Mode Register (Capture Mode / Waveform Mode)" +AT91C_TC2_CMR.access=memorymapped +AT91C_TC2_CMR.address=0xFFFA0084 +AT91C_TC2_CMR.width=32 +AT91C_TC2_CMR.byteEndian=little +AT91C_TC2_CCR.name="AT91C_TC2_CCR" +AT91C_TC2_CCR.description="Channel Control Register" +AT91C_TC2_CCR.helpkey="Channel Control Register" +AT91C_TC2_CCR.access=memorymapped +AT91C_TC2_CCR.address=0xFFFA0080 +AT91C_TC2_CCR.width=32 +AT91C_TC2_CCR.byteEndian=little +AT91C_TC2_CCR.type=enum +AT91C_TC2_CCR.enum.0.name=*** Write only *** +AT91C_TC2_CCR.enum.1.name=Error +AT91C_TC2_CV.name="AT91C_TC2_CV" +AT91C_TC2_CV.description="Counter Value" +AT91C_TC2_CV.helpkey="Counter Value" +AT91C_TC2_CV.access=memorymapped +AT91C_TC2_CV.address=0xFFFA0090 +AT91C_TC2_CV.width=32 +AT91C_TC2_CV.byteEndian=little +AT91C_TC2_RA.name="AT91C_TC2_RA" +AT91C_TC2_RA.description="Register A" +AT91C_TC2_RA.helpkey="Register A" +AT91C_TC2_RA.access=memorymapped +AT91C_TC2_RA.address=0xFFFA0094 +AT91C_TC2_RA.width=32 +AT91C_TC2_RA.byteEndian=little +AT91C_TC2_RB.name="AT91C_TC2_RB" +AT91C_TC2_RB.description="Register B" +AT91C_TC2_RB.helpkey="Register B" +AT91C_TC2_RB.access=memorymapped +AT91C_TC2_RB.address=0xFFFA0098 +AT91C_TC2_RB.width=32 +AT91C_TC2_RB.byteEndian=little +AT91C_TC2_IDR.name="AT91C_TC2_IDR" +AT91C_TC2_IDR.description="Interrupt Disable Register" +AT91C_TC2_IDR.helpkey="Interrupt Disable Register" +AT91C_TC2_IDR.access=memorymapped +AT91C_TC2_IDR.address=0xFFFA00A8 +AT91C_TC2_IDR.width=32 +AT91C_TC2_IDR.byteEndian=little +AT91C_TC2_IDR.type=enum +AT91C_TC2_IDR.enum.0.name=*** Write only *** +AT91C_TC2_IDR.enum.1.name=Error +AT91C_TC2_IMR.name="AT91C_TC2_IMR" +AT91C_TC2_IMR.description="Interrupt Mask Register" +AT91C_TC2_IMR.helpkey="Interrupt Mask Register" +AT91C_TC2_IMR.access=memorymapped +AT91C_TC2_IMR.address=0xFFFA00AC +AT91C_TC2_IMR.width=32 +AT91C_TC2_IMR.byteEndian=little +AT91C_TC2_IMR.permission.write=none +AT91C_TC2_RC.name="AT91C_TC2_RC" +AT91C_TC2_RC.description="Register C" +AT91C_TC2_RC.helpkey="Register C" +AT91C_TC2_RC.access=memorymapped +AT91C_TC2_RC.address=0xFFFA009C +AT91C_TC2_RC.width=32 +AT91C_TC2_RC.byteEndian=little +AT91C_TC2_IER.name="AT91C_TC2_IER" +AT91C_TC2_IER.description="Interrupt Enable Register" +AT91C_TC2_IER.helpkey="Interrupt Enable Register" +AT91C_TC2_IER.access=memorymapped +AT91C_TC2_IER.address=0xFFFA00A4 +AT91C_TC2_IER.width=32 +AT91C_TC2_IER.byteEndian=little +AT91C_TC2_IER.type=enum +AT91C_TC2_IER.enum.0.name=*** Write only *** +AT91C_TC2_IER.enum.1.name=Error +AT91C_TC2_SR.name="AT91C_TC2_SR" +AT91C_TC2_SR.description="Status Register" +AT91C_TC2_SR.helpkey="Status Register" +AT91C_TC2_SR.access=memorymapped +AT91C_TC2_SR.address=0xFFFA00A0 +AT91C_TC2_SR.width=32 +AT91C_TC2_SR.byteEndian=little +AT91C_TC2_SR.permission.write=none +# ========== Register definition for TCB peripheral ========== +AT91C_TCB_BMR.name="AT91C_TCB_BMR" +AT91C_TCB_BMR.description="TC Block Mode Register" +AT91C_TCB_BMR.helpkey="TC Block Mode Register" +AT91C_TCB_BMR.access=memorymapped +AT91C_TCB_BMR.address=0xFFFA00C4 +AT91C_TCB_BMR.width=32 +AT91C_TCB_BMR.byteEndian=little +AT91C_TCB_BCR.name="AT91C_TCB_BCR" +AT91C_TCB_BCR.description="TC Block Control Register" +AT91C_TCB_BCR.helpkey="TC Block Control Register" +AT91C_TCB_BCR.access=memorymapped +AT91C_TCB_BCR.address=0xFFFA00C0 +AT91C_TCB_BCR.width=32 +AT91C_TCB_BCR.byteEndian=little +AT91C_TCB_BCR.type=enum +AT91C_TCB_BCR.enum.0.name=*** Write only *** +AT91C_TCB_BCR.enum.1.name=Error +# ========== Register definition for CAN_MB0 peripheral ========== +AT91C_CAN_MB0_MDL.name="AT91C_CAN_MB0_MDL" +AT91C_CAN_MB0_MDL.description="MailBox Data Low Register" +AT91C_CAN_MB0_MDL.helpkey="MailBox Data Low Register" +AT91C_CAN_MB0_MDL.access=memorymapped +AT91C_CAN_MB0_MDL.address=0xFFFD0214 +AT91C_CAN_MB0_MDL.width=32 +AT91C_CAN_MB0_MDL.byteEndian=little +AT91C_CAN_MB0_MAM.name="AT91C_CAN_MB0_MAM" +AT91C_CAN_MB0_MAM.description="MailBox Acceptance Mask Register" +AT91C_CAN_MB0_MAM.helpkey="MailBox Acceptance Mask Register" +AT91C_CAN_MB0_MAM.access=memorymapped +AT91C_CAN_MB0_MAM.address=0xFFFD0204 +AT91C_CAN_MB0_MAM.width=32 +AT91C_CAN_MB0_MAM.byteEndian=little +AT91C_CAN_MB0_MCR.name="AT91C_CAN_MB0_MCR" +AT91C_CAN_MB0_MCR.description="MailBox Control Register" +AT91C_CAN_MB0_MCR.helpkey="MailBox Control Register" +AT91C_CAN_MB0_MCR.access=memorymapped +AT91C_CAN_MB0_MCR.address=0xFFFD021C +AT91C_CAN_MB0_MCR.width=32 +AT91C_CAN_MB0_MCR.byteEndian=little +AT91C_CAN_MB0_MCR.type=enum +AT91C_CAN_MB0_MCR.enum.0.name=*** Write only *** +AT91C_CAN_MB0_MCR.enum.1.name=Error +AT91C_CAN_MB0_MID.name="AT91C_CAN_MB0_MID" +AT91C_CAN_MB0_MID.description="MailBox ID Register" +AT91C_CAN_MB0_MID.helpkey="MailBox ID Register" +AT91C_CAN_MB0_MID.access=memorymapped +AT91C_CAN_MB0_MID.address=0xFFFD0208 +AT91C_CAN_MB0_MID.width=32 +AT91C_CAN_MB0_MID.byteEndian=little +AT91C_CAN_MB0_MSR.name="AT91C_CAN_MB0_MSR" +AT91C_CAN_MB0_MSR.description="MailBox Status Register" +AT91C_CAN_MB0_MSR.helpkey="MailBox Status Register" +AT91C_CAN_MB0_MSR.access=memorymapped +AT91C_CAN_MB0_MSR.address=0xFFFD0210 +AT91C_CAN_MB0_MSR.width=32 +AT91C_CAN_MB0_MSR.byteEndian=little +AT91C_CAN_MB0_MSR.permission.write=none +AT91C_CAN_MB0_MFID.name="AT91C_CAN_MB0_MFID" +AT91C_CAN_MB0_MFID.description="MailBox Family ID Register" +AT91C_CAN_MB0_MFID.helpkey="MailBox Family ID Register" +AT91C_CAN_MB0_MFID.access=memorymapped +AT91C_CAN_MB0_MFID.address=0xFFFD020C +AT91C_CAN_MB0_MFID.width=32 +AT91C_CAN_MB0_MFID.byteEndian=little +AT91C_CAN_MB0_MFID.permission.write=none +AT91C_CAN_MB0_MDH.name="AT91C_CAN_MB0_MDH" +AT91C_CAN_MB0_MDH.description="MailBox Data High Register" +AT91C_CAN_MB0_MDH.helpkey="MailBox Data High Register" +AT91C_CAN_MB0_MDH.access=memorymapped +AT91C_CAN_MB0_MDH.address=0xFFFD0218 +AT91C_CAN_MB0_MDH.width=32 +AT91C_CAN_MB0_MDH.byteEndian=little +AT91C_CAN_MB0_MMR.name="AT91C_CAN_MB0_MMR" +AT91C_CAN_MB0_MMR.description="MailBox Mode Register" +AT91C_CAN_MB0_MMR.helpkey="MailBox Mode Register" +AT91C_CAN_MB0_MMR.access=memorymapped +AT91C_CAN_MB0_MMR.address=0xFFFD0200 +AT91C_CAN_MB0_MMR.width=32 +AT91C_CAN_MB0_MMR.byteEndian=little +# ========== Register definition for CAN_MB1 peripheral ========== +AT91C_CAN_MB1_MDL.name="AT91C_CAN_MB1_MDL" +AT91C_CAN_MB1_MDL.description="MailBox Data Low Register" +AT91C_CAN_MB1_MDL.helpkey="MailBox Data Low Register" +AT91C_CAN_MB1_MDL.access=memorymapped +AT91C_CAN_MB1_MDL.address=0xFFFD0234 +AT91C_CAN_MB1_MDL.width=32 +AT91C_CAN_MB1_MDL.byteEndian=little +AT91C_CAN_MB1_MID.name="AT91C_CAN_MB1_MID" +AT91C_CAN_MB1_MID.description="MailBox ID Register" +AT91C_CAN_MB1_MID.helpkey="MailBox ID Register" +AT91C_CAN_MB1_MID.access=memorymapped +AT91C_CAN_MB1_MID.address=0xFFFD0228 +AT91C_CAN_MB1_MID.width=32 +AT91C_CAN_MB1_MID.byteEndian=little +AT91C_CAN_MB1_MMR.name="AT91C_CAN_MB1_MMR" +AT91C_CAN_MB1_MMR.description="MailBox Mode Register" +AT91C_CAN_MB1_MMR.helpkey="MailBox Mode Register" +AT91C_CAN_MB1_MMR.access=memorymapped +AT91C_CAN_MB1_MMR.address=0xFFFD0220 +AT91C_CAN_MB1_MMR.width=32 +AT91C_CAN_MB1_MMR.byteEndian=little +AT91C_CAN_MB1_MSR.name="AT91C_CAN_MB1_MSR" +AT91C_CAN_MB1_MSR.description="MailBox Status Register" +AT91C_CAN_MB1_MSR.helpkey="MailBox Status Register" +AT91C_CAN_MB1_MSR.access=memorymapped +AT91C_CAN_MB1_MSR.address=0xFFFD0230 +AT91C_CAN_MB1_MSR.width=32 +AT91C_CAN_MB1_MSR.byteEndian=little +AT91C_CAN_MB1_MSR.permission.write=none +AT91C_CAN_MB1_MAM.name="AT91C_CAN_MB1_MAM" +AT91C_CAN_MB1_MAM.description="MailBox Acceptance Mask Register" +AT91C_CAN_MB1_MAM.helpkey="MailBox Acceptance Mask Register" +AT91C_CAN_MB1_MAM.access=memorymapped +AT91C_CAN_MB1_MAM.address=0xFFFD0224 +AT91C_CAN_MB1_MAM.width=32 +AT91C_CAN_MB1_MAM.byteEndian=little +AT91C_CAN_MB1_MDH.name="AT91C_CAN_MB1_MDH" +AT91C_CAN_MB1_MDH.description="MailBox Data High Register" +AT91C_CAN_MB1_MDH.helpkey="MailBox Data High Register" +AT91C_CAN_MB1_MDH.access=memorymapped +AT91C_CAN_MB1_MDH.address=0xFFFD0238 +AT91C_CAN_MB1_MDH.width=32 +AT91C_CAN_MB1_MDH.byteEndian=little +AT91C_CAN_MB1_MCR.name="AT91C_CAN_MB1_MCR" +AT91C_CAN_MB1_MCR.description="MailBox Control Register" +AT91C_CAN_MB1_MCR.helpkey="MailBox Control Register" +AT91C_CAN_MB1_MCR.access=memorymapped +AT91C_CAN_MB1_MCR.address=0xFFFD023C +AT91C_CAN_MB1_MCR.width=32 +AT91C_CAN_MB1_MCR.byteEndian=little +AT91C_CAN_MB1_MCR.type=enum +AT91C_CAN_MB1_MCR.enum.0.name=*** Write only *** +AT91C_CAN_MB1_MCR.enum.1.name=Error +AT91C_CAN_MB1_MFID.name="AT91C_CAN_MB1_MFID" +AT91C_CAN_MB1_MFID.description="MailBox Family ID Register" +AT91C_CAN_MB1_MFID.helpkey="MailBox Family ID Register" +AT91C_CAN_MB1_MFID.access=memorymapped +AT91C_CAN_MB1_MFID.address=0xFFFD022C +AT91C_CAN_MB1_MFID.width=32 +AT91C_CAN_MB1_MFID.byteEndian=little +AT91C_CAN_MB1_MFID.permission.write=none +# ========== Register definition for CAN_MB2 peripheral ========== +AT91C_CAN_MB2_MCR.name="AT91C_CAN_MB2_MCR" +AT91C_CAN_MB2_MCR.description="MailBox Control Register" +AT91C_CAN_MB2_MCR.helpkey="MailBox Control Register" +AT91C_CAN_MB2_MCR.access=memorymapped +AT91C_CAN_MB2_MCR.address=0xFFFD025C +AT91C_CAN_MB2_MCR.width=32 +AT91C_CAN_MB2_MCR.byteEndian=little +AT91C_CAN_MB2_MCR.type=enum +AT91C_CAN_MB2_MCR.enum.0.name=*** Write only *** +AT91C_CAN_MB2_MCR.enum.1.name=Error +AT91C_CAN_MB2_MDH.name="AT91C_CAN_MB2_MDH" +AT91C_CAN_MB2_MDH.description="MailBox Data High Register" +AT91C_CAN_MB2_MDH.helpkey="MailBox Data High Register" +AT91C_CAN_MB2_MDH.access=memorymapped +AT91C_CAN_MB2_MDH.address=0xFFFD0258 +AT91C_CAN_MB2_MDH.width=32 +AT91C_CAN_MB2_MDH.byteEndian=little +AT91C_CAN_MB2_MID.name="AT91C_CAN_MB2_MID" +AT91C_CAN_MB2_MID.description="MailBox ID Register" +AT91C_CAN_MB2_MID.helpkey="MailBox ID Register" +AT91C_CAN_MB2_MID.access=memorymapped +AT91C_CAN_MB2_MID.address=0xFFFD0248 +AT91C_CAN_MB2_MID.width=32 +AT91C_CAN_MB2_MID.byteEndian=little +AT91C_CAN_MB2_MDL.name="AT91C_CAN_MB2_MDL" +AT91C_CAN_MB2_MDL.description="MailBox Data Low Register" +AT91C_CAN_MB2_MDL.helpkey="MailBox Data Low Register" +AT91C_CAN_MB2_MDL.access=memorymapped +AT91C_CAN_MB2_MDL.address=0xFFFD0254 +AT91C_CAN_MB2_MDL.width=32 +AT91C_CAN_MB2_MDL.byteEndian=little +AT91C_CAN_MB2_MMR.name="AT91C_CAN_MB2_MMR" +AT91C_CAN_MB2_MMR.description="MailBox Mode Register" +AT91C_CAN_MB2_MMR.helpkey="MailBox Mode Register" +AT91C_CAN_MB2_MMR.access=memorymapped +AT91C_CAN_MB2_MMR.address=0xFFFD0240 +AT91C_CAN_MB2_MMR.width=32 +AT91C_CAN_MB2_MMR.byteEndian=little +AT91C_CAN_MB2_MAM.name="AT91C_CAN_MB2_MAM" +AT91C_CAN_MB2_MAM.description="MailBox Acceptance Mask Register" +AT91C_CAN_MB2_MAM.helpkey="MailBox Acceptance Mask Register" +AT91C_CAN_MB2_MAM.access=memorymapped +AT91C_CAN_MB2_MAM.address=0xFFFD0244 +AT91C_CAN_MB2_MAM.width=32 +AT91C_CAN_MB2_MAM.byteEndian=little +AT91C_CAN_MB2_MFID.name="AT91C_CAN_MB2_MFID" +AT91C_CAN_MB2_MFID.description="MailBox Family ID Register" +AT91C_CAN_MB2_MFID.helpkey="MailBox Family ID Register" +AT91C_CAN_MB2_MFID.access=memorymapped +AT91C_CAN_MB2_MFID.address=0xFFFD024C +AT91C_CAN_MB2_MFID.width=32 +AT91C_CAN_MB2_MFID.byteEndian=little +AT91C_CAN_MB2_MFID.permission.write=none +AT91C_CAN_MB2_MSR.name="AT91C_CAN_MB2_MSR" +AT91C_CAN_MB2_MSR.description="MailBox Status Register" +AT91C_CAN_MB2_MSR.helpkey="MailBox Status Register" +AT91C_CAN_MB2_MSR.access=memorymapped +AT91C_CAN_MB2_MSR.address=0xFFFD0250 +AT91C_CAN_MB2_MSR.width=32 +AT91C_CAN_MB2_MSR.byteEndian=little +AT91C_CAN_MB2_MSR.permission.write=none +# ========== Register definition for CAN_MB3 peripheral ========== +AT91C_CAN_MB3_MFID.name="AT91C_CAN_MB3_MFID" +AT91C_CAN_MB3_MFID.description="MailBox Family ID Register" +AT91C_CAN_MB3_MFID.helpkey="MailBox Family ID Register" +AT91C_CAN_MB3_MFID.access=memorymapped +AT91C_CAN_MB3_MFID.address=0xFFFD026C +AT91C_CAN_MB3_MFID.width=32 +AT91C_CAN_MB3_MFID.byteEndian=little +AT91C_CAN_MB3_MFID.permission.write=none +AT91C_CAN_MB3_MAM.name="AT91C_CAN_MB3_MAM" +AT91C_CAN_MB3_MAM.description="MailBox Acceptance Mask Register" +AT91C_CAN_MB3_MAM.helpkey="MailBox Acceptance Mask Register" +AT91C_CAN_MB3_MAM.access=memorymapped +AT91C_CAN_MB3_MAM.address=0xFFFD0264 +AT91C_CAN_MB3_MAM.width=32 +AT91C_CAN_MB3_MAM.byteEndian=little +AT91C_CAN_MB3_MID.name="AT91C_CAN_MB3_MID" +AT91C_CAN_MB3_MID.description="MailBox ID Register" +AT91C_CAN_MB3_MID.helpkey="MailBox ID Register" +AT91C_CAN_MB3_MID.access=memorymapped +AT91C_CAN_MB3_MID.address=0xFFFD0268 +AT91C_CAN_MB3_MID.width=32 +AT91C_CAN_MB3_MID.byteEndian=little +AT91C_CAN_MB3_MCR.name="AT91C_CAN_MB3_MCR" +AT91C_CAN_MB3_MCR.description="MailBox Control Register" +AT91C_CAN_MB3_MCR.helpkey="MailBox Control Register" +AT91C_CAN_MB3_MCR.access=memorymapped +AT91C_CAN_MB3_MCR.address=0xFFFD027C +AT91C_CAN_MB3_MCR.width=32 +AT91C_CAN_MB3_MCR.byteEndian=little +AT91C_CAN_MB3_MCR.type=enum +AT91C_CAN_MB3_MCR.enum.0.name=*** Write only *** +AT91C_CAN_MB3_MCR.enum.1.name=Error +AT91C_CAN_MB3_MMR.name="AT91C_CAN_MB3_MMR" +AT91C_CAN_MB3_MMR.description="MailBox Mode Register" +AT91C_CAN_MB3_MMR.helpkey="MailBox Mode Register" +AT91C_CAN_MB3_MMR.access=memorymapped +AT91C_CAN_MB3_MMR.address=0xFFFD0260 +AT91C_CAN_MB3_MMR.width=32 +AT91C_CAN_MB3_MMR.byteEndian=little +AT91C_CAN_MB3_MSR.name="AT91C_CAN_MB3_MSR" +AT91C_CAN_MB3_MSR.description="MailBox Status Register" +AT91C_CAN_MB3_MSR.helpkey="MailBox Status Register" +AT91C_CAN_MB3_MSR.access=memorymapped +AT91C_CAN_MB3_MSR.address=0xFFFD0270 +AT91C_CAN_MB3_MSR.width=32 +AT91C_CAN_MB3_MSR.byteEndian=little +AT91C_CAN_MB3_MSR.permission.write=none +AT91C_CAN_MB3_MDL.name="AT91C_CAN_MB3_MDL" +AT91C_CAN_MB3_MDL.description="MailBox Data Low Register" +AT91C_CAN_MB3_MDL.helpkey="MailBox Data Low Register" +AT91C_CAN_MB3_MDL.access=memorymapped +AT91C_CAN_MB3_MDL.address=0xFFFD0274 +AT91C_CAN_MB3_MDL.width=32 +AT91C_CAN_MB3_MDL.byteEndian=little +AT91C_CAN_MB3_MDH.name="AT91C_CAN_MB3_MDH" +AT91C_CAN_MB3_MDH.description="MailBox Data High Register" +AT91C_CAN_MB3_MDH.helpkey="MailBox Data High Register" +AT91C_CAN_MB3_MDH.access=memorymapped +AT91C_CAN_MB3_MDH.address=0xFFFD0278 +AT91C_CAN_MB3_MDH.width=32 +AT91C_CAN_MB3_MDH.byteEndian=little +# ========== Register definition for CAN_MB4 peripheral ========== +AT91C_CAN_MB4_MID.name="AT91C_CAN_MB4_MID" +AT91C_CAN_MB4_MID.description="MailBox ID Register" +AT91C_CAN_MB4_MID.helpkey="MailBox ID Register" +AT91C_CAN_MB4_MID.access=memorymapped +AT91C_CAN_MB4_MID.address=0xFFFD0288 +AT91C_CAN_MB4_MID.width=32 +AT91C_CAN_MB4_MID.byteEndian=little +AT91C_CAN_MB4_MMR.name="AT91C_CAN_MB4_MMR" +AT91C_CAN_MB4_MMR.description="MailBox Mode Register" +AT91C_CAN_MB4_MMR.helpkey="MailBox Mode Register" +AT91C_CAN_MB4_MMR.access=memorymapped +AT91C_CAN_MB4_MMR.address=0xFFFD0280 +AT91C_CAN_MB4_MMR.width=32 +AT91C_CAN_MB4_MMR.byteEndian=little +AT91C_CAN_MB4_MDH.name="AT91C_CAN_MB4_MDH" +AT91C_CAN_MB4_MDH.description="MailBox Data High Register" +AT91C_CAN_MB4_MDH.helpkey="MailBox Data High Register" +AT91C_CAN_MB4_MDH.access=memorymapped +AT91C_CAN_MB4_MDH.address=0xFFFD0298 +AT91C_CAN_MB4_MDH.width=32 +AT91C_CAN_MB4_MDH.byteEndian=little +AT91C_CAN_MB4_MFID.name="AT91C_CAN_MB4_MFID" +AT91C_CAN_MB4_MFID.description="MailBox Family ID Register" +AT91C_CAN_MB4_MFID.helpkey="MailBox Family ID Register" +AT91C_CAN_MB4_MFID.access=memorymapped +AT91C_CAN_MB4_MFID.address=0xFFFD028C +AT91C_CAN_MB4_MFID.width=32 +AT91C_CAN_MB4_MFID.byteEndian=little +AT91C_CAN_MB4_MFID.permission.write=none +AT91C_CAN_MB4_MSR.name="AT91C_CAN_MB4_MSR" +AT91C_CAN_MB4_MSR.description="MailBox Status Register" +AT91C_CAN_MB4_MSR.helpkey="MailBox Status Register" +AT91C_CAN_MB4_MSR.access=memorymapped +AT91C_CAN_MB4_MSR.address=0xFFFD0290 +AT91C_CAN_MB4_MSR.width=32 +AT91C_CAN_MB4_MSR.byteEndian=little +AT91C_CAN_MB4_MSR.permission.write=none +AT91C_CAN_MB4_MCR.name="AT91C_CAN_MB4_MCR" +AT91C_CAN_MB4_MCR.description="MailBox Control Register" +AT91C_CAN_MB4_MCR.helpkey="MailBox Control Register" +AT91C_CAN_MB4_MCR.access=memorymapped +AT91C_CAN_MB4_MCR.address=0xFFFD029C +AT91C_CAN_MB4_MCR.width=32 +AT91C_CAN_MB4_MCR.byteEndian=little +AT91C_CAN_MB4_MCR.type=enum +AT91C_CAN_MB4_MCR.enum.0.name=*** Write only *** +AT91C_CAN_MB4_MCR.enum.1.name=Error +AT91C_CAN_MB4_MDL.name="AT91C_CAN_MB4_MDL" +AT91C_CAN_MB4_MDL.description="MailBox Data Low Register" +AT91C_CAN_MB4_MDL.helpkey="MailBox Data Low Register" +AT91C_CAN_MB4_MDL.access=memorymapped +AT91C_CAN_MB4_MDL.address=0xFFFD0294 +AT91C_CAN_MB4_MDL.width=32 +AT91C_CAN_MB4_MDL.byteEndian=little +AT91C_CAN_MB4_MAM.name="AT91C_CAN_MB4_MAM" +AT91C_CAN_MB4_MAM.description="MailBox Acceptance Mask Register" +AT91C_CAN_MB4_MAM.helpkey="MailBox Acceptance Mask Register" +AT91C_CAN_MB4_MAM.access=memorymapped +AT91C_CAN_MB4_MAM.address=0xFFFD0284 +AT91C_CAN_MB4_MAM.width=32 +AT91C_CAN_MB4_MAM.byteEndian=little +# ========== Register definition for CAN_MB5 peripheral ========== +AT91C_CAN_MB5_MSR.name="AT91C_CAN_MB5_MSR" +AT91C_CAN_MB5_MSR.description="MailBox Status Register" +AT91C_CAN_MB5_MSR.helpkey="MailBox Status Register" +AT91C_CAN_MB5_MSR.access=memorymapped +AT91C_CAN_MB5_MSR.address=0xFFFD02B0 +AT91C_CAN_MB5_MSR.width=32 +AT91C_CAN_MB5_MSR.byteEndian=little +AT91C_CAN_MB5_MSR.permission.write=none +AT91C_CAN_MB5_MCR.name="AT91C_CAN_MB5_MCR" +AT91C_CAN_MB5_MCR.description="MailBox Control Register" +AT91C_CAN_MB5_MCR.helpkey="MailBox Control Register" +AT91C_CAN_MB5_MCR.access=memorymapped +AT91C_CAN_MB5_MCR.address=0xFFFD02BC +AT91C_CAN_MB5_MCR.width=32 +AT91C_CAN_MB5_MCR.byteEndian=little +AT91C_CAN_MB5_MCR.type=enum +AT91C_CAN_MB5_MCR.enum.0.name=*** Write only *** +AT91C_CAN_MB5_MCR.enum.1.name=Error +AT91C_CAN_MB5_MFID.name="AT91C_CAN_MB5_MFID" +AT91C_CAN_MB5_MFID.description="MailBox Family ID Register" +AT91C_CAN_MB5_MFID.helpkey="MailBox Family ID Register" +AT91C_CAN_MB5_MFID.access=memorymapped +AT91C_CAN_MB5_MFID.address=0xFFFD02AC +AT91C_CAN_MB5_MFID.width=32 +AT91C_CAN_MB5_MFID.byteEndian=little +AT91C_CAN_MB5_MFID.permission.write=none +AT91C_CAN_MB5_MDH.name="AT91C_CAN_MB5_MDH" +AT91C_CAN_MB5_MDH.description="MailBox Data High Register" +AT91C_CAN_MB5_MDH.helpkey="MailBox Data High Register" +AT91C_CAN_MB5_MDH.access=memorymapped +AT91C_CAN_MB5_MDH.address=0xFFFD02B8 +AT91C_CAN_MB5_MDH.width=32 +AT91C_CAN_MB5_MDH.byteEndian=little +AT91C_CAN_MB5_MID.name="AT91C_CAN_MB5_MID" +AT91C_CAN_MB5_MID.description="MailBox ID Register" +AT91C_CAN_MB5_MID.helpkey="MailBox ID Register" +AT91C_CAN_MB5_MID.access=memorymapped +AT91C_CAN_MB5_MID.address=0xFFFD02A8 +AT91C_CAN_MB5_MID.width=32 +AT91C_CAN_MB5_MID.byteEndian=little +AT91C_CAN_MB5_MMR.name="AT91C_CAN_MB5_MMR" +AT91C_CAN_MB5_MMR.description="MailBox Mode Register" +AT91C_CAN_MB5_MMR.helpkey="MailBox Mode Register" +AT91C_CAN_MB5_MMR.access=memorymapped +AT91C_CAN_MB5_MMR.address=0xFFFD02A0 +AT91C_CAN_MB5_MMR.width=32 +AT91C_CAN_MB5_MMR.byteEndian=little +AT91C_CAN_MB5_MDL.name="AT91C_CAN_MB5_MDL" +AT91C_CAN_MB5_MDL.description="MailBox Data Low Register" +AT91C_CAN_MB5_MDL.helpkey="MailBox Data Low Register" +AT91C_CAN_MB5_MDL.access=memorymapped +AT91C_CAN_MB5_MDL.address=0xFFFD02B4 +AT91C_CAN_MB5_MDL.width=32 +AT91C_CAN_MB5_MDL.byteEndian=little +AT91C_CAN_MB5_MAM.name="AT91C_CAN_MB5_MAM" +AT91C_CAN_MB5_MAM.description="MailBox Acceptance Mask Register" +AT91C_CAN_MB5_MAM.helpkey="MailBox Acceptance Mask Register" +AT91C_CAN_MB5_MAM.access=memorymapped +AT91C_CAN_MB5_MAM.address=0xFFFD02A4 +AT91C_CAN_MB5_MAM.width=32 +AT91C_CAN_MB5_MAM.byteEndian=little +# ========== Register definition for CAN_MB6 peripheral ========== +AT91C_CAN_MB6_MFID.name="AT91C_CAN_MB6_MFID" +AT91C_CAN_MB6_MFID.description="MailBox Family ID Register" +AT91C_CAN_MB6_MFID.helpkey="MailBox Family ID Register" +AT91C_CAN_MB6_MFID.access=memorymapped +AT91C_CAN_MB6_MFID.address=0xFFFD02CC +AT91C_CAN_MB6_MFID.width=32 +AT91C_CAN_MB6_MFID.byteEndian=little +AT91C_CAN_MB6_MFID.permission.write=none +AT91C_CAN_MB6_MID.name="AT91C_CAN_MB6_MID" +AT91C_CAN_MB6_MID.description="MailBox ID Register" +AT91C_CAN_MB6_MID.helpkey="MailBox ID Register" +AT91C_CAN_MB6_MID.access=memorymapped +AT91C_CAN_MB6_MID.address=0xFFFD02C8 +AT91C_CAN_MB6_MID.width=32 +AT91C_CAN_MB6_MID.byteEndian=little +AT91C_CAN_MB6_MAM.name="AT91C_CAN_MB6_MAM" +AT91C_CAN_MB6_MAM.description="MailBox Acceptance Mask Register" +AT91C_CAN_MB6_MAM.helpkey="MailBox Acceptance Mask Register" +AT91C_CAN_MB6_MAM.access=memorymapped +AT91C_CAN_MB6_MAM.address=0xFFFD02C4 +AT91C_CAN_MB6_MAM.width=32 +AT91C_CAN_MB6_MAM.byteEndian=little +AT91C_CAN_MB6_MSR.name="AT91C_CAN_MB6_MSR" +AT91C_CAN_MB6_MSR.description="MailBox Status Register" +AT91C_CAN_MB6_MSR.helpkey="MailBox Status Register" +AT91C_CAN_MB6_MSR.access=memorymapped +AT91C_CAN_MB6_MSR.address=0xFFFD02D0 +AT91C_CAN_MB6_MSR.width=32 +AT91C_CAN_MB6_MSR.byteEndian=little +AT91C_CAN_MB6_MSR.permission.write=none +AT91C_CAN_MB6_MDL.name="AT91C_CAN_MB6_MDL" +AT91C_CAN_MB6_MDL.description="MailBox Data Low Register" +AT91C_CAN_MB6_MDL.helpkey="MailBox Data Low Register" +AT91C_CAN_MB6_MDL.access=memorymapped +AT91C_CAN_MB6_MDL.address=0xFFFD02D4 +AT91C_CAN_MB6_MDL.width=32 +AT91C_CAN_MB6_MDL.byteEndian=little +AT91C_CAN_MB6_MCR.name="AT91C_CAN_MB6_MCR" +AT91C_CAN_MB6_MCR.description="MailBox Control Register" +AT91C_CAN_MB6_MCR.helpkey="MailBox Control Register" +AT91C_CAN_MB6_MCR.access=memorymapped +AT91C_CAN_MB6_MCR.address=0xFFFD02DC +AT91C_CAN_MB6_MCR.width=32 +AT91C_CAN_MB6_MCR.byteEndian=little +AT91C_CAN_MB6_MCR.type=enum +AT91C_CAN_MB6_MCR.enum.0.name=*** Write only *** +AT91C_CAN_MB6_MCR.enum.1.name=Error +AT91C_CAN_MB6_MDH.name="AT91C_CAN_MB6_MDH" +AT91C_CAN_MB6_MDH.description="MailBox Data High Register" +AT91C_CAN_MB6_MDH.helpkey="MailBox Data High Register" +AT91C_CAN_MB6_MDH.access=memorymapped +AT91C_CAN_MB6_MDH.address=0xFFFD02D8 +AT91C_CAN_MB6_MDH.width=32 +AT91C_CAN_MB6_MDH.byteEndian=little +AT91C_CAN_MB6_MMR.name="AT91C_CAN_MB6_MMR" +AT91C_CAN_MB6_MMR.description="MailBox Mode Register" +AT91C_CAN_MB6_MMR.helpkey="MailBox Mode Register" +AT91C_CAN_MB6_MMR.access=memorymapped +AT91C_CAN_MB6_MMR.address=0xFFFD02C0 +AT91C_CAN_MB6_MMR.width=32 +AT91C_CAN_MB6_MMR.byteEndian=little +# ========== Register definition for CAN_MB7 peripheral ========== +AT91C_CAN_MB7_MCR.name="AT91C_CAN_MB7_MCR" +AT91C_CAN_MB7_MCR.description="MailBox Control Register" +AT91C_CAN_MB7_MCR.helpkey="MailBox Control Register" +AT91C_CAN_MB7_MCR.access=memorymapped +AT91C_CAN_MB7_MCR.address=0xFFFD02FC +AT91C_CAN_MB7_MCR.width=32 +AT91C_CAN_MB7_MCR.byteEndian=little +AT91C_CAN_MB7_MCR.type=enum +AT91C_CAN_MB7_MCR.enum.0.name=*** Write only *** +AT91C_CAN_MB7_MCR.enum.1.name=Error +AT91C_CAN_MB7_MDH.name="AT91C_CAN_MB7_MDH" +AT91C_CAN_MB7_MDH.description="MailBox Data High Register" +AT91C_CAN_MB7_MDH.helpkey="MailBox Data High Register" +AT91C_CAN_MB7_MDH.access=memorymapped +AT91C_CAN_MB7_MDH.address=0xFFFD02F8 +AT91C_CAN_MB7_MDH.width=32 +AT91C_CAN_MB7_MDH.byteEndian=little +AT91C_CAN_MB7_MFID.name="AT91C_CAN_MB7_MFID" +AT91C_CAN_MB7_MFID.description="MailBox Family ID Register" +AT91C_CAN_MB7_MFID.helpkey="MailBox Family ID Register" +AT91C_CAN_MB7_MFID.access=memorymapped +AT91C_CAN_MB7_MFID.address=0xFFFD02EC +AT91C_CAN_MB7_MFID.width=32 +AT91C_CAN_MB7_MFID.byteEndian=little +AT91C_CAN_MB7_MFID.permission.write=none +AT91C_CAN_MB7_MDL.name="AT91C_CAN_MB7_MDL" +AT91C_CAN_MB7_MDL.description="MailBox Data Low Register" +AT91C_CAN_MB7_MDL.helpkey="MailBox Data Low Register" +AT91C_CAN_MB7_MDL.access=memorymapped +AT91C_CAN_MB7_MDL.address=0xFFFD02F4 +AT91C_CAN_MB7_MDL.width=32 +AT91C_CAN_MB7_MDL.byteEndian=little +AT91C_CAN_MB7_MID.name="AT91C_CAN_MB7_MID" +AT91C_CAN_MB7_MID.description="MailBox ID Register" +AT91C_CAN_MB7_MID.helpkey="MailBox ID Register" +AT91C_CAN_MB7_MID.access=memorymapped +AT91C_CAN_MB7_MID.address=0xFFFD02E8 +AT91C_CAN_MB7_MID.width=32 +AT91C_CAN_MB7_MID.byteEndian=little +AT91C_CAN_MB7_MMR.name="AT91C_CAN_MB7_MMR" +AT91C_CAN_MB7_MMR.description="MailBox Mode Register" +AT91C_CAN_MB7_MMR.helpkey="MailBox Mode Register" +AT91C_CAN_MB7_MMR.access=memorymapped +AT91C_CAN_MB7_MMR.address=0xFFFD02E0 +AT91C_CAN_MB7_MMR.width=32 +AT91C_CAN_MB7_MMR.byteEndian=little +AT91C_CAN_MB7_MAM.name="AT91C_CAN_MB7_MAM" +AT91C_CAN_MB7_MAM.description="MailBox Acceptance Mask Register" +AT91C_CAN_MB7_MAM.helpkey="MailBox Acceptance Mask Register" +AT91C_CAN_MB7_MAM.access=memorymapped +AT91C_CAN_MB7_MAM.address=0xFFFD02E4 +AT91C_CAN_MB7_MAM.width=32 +AT91C_CAN_MB7_MAM.byteEndian=little +AT91C_CAN_MB7_MSR.name="AT91C_CAN_MB7_MSR" +AT91C_CAN_MB7_MSR.description="MailBox Status Register" +AT91C_CAN_MB7_MSR.helpkey="MailBox Status Register" +AT91C_CAN_MB7_MSR.access=memorymapped +AT91C_CAN_MB7_MSR.address=0xFFFD02F0 +AT91C_CAN_MB7_MSR.width=32 +AT91C_CAN_MB7_MSR.byteEndian=little +AT91C_CAN_MB7_MSR.permission.write=none +# ========== Register definition for CAN peripheral ========== +AT91C_CAN_TCR.name="AT91C_CAN_TCR" +AT91C_CAN_TCR.description="Transfer Command Register" +AT91C_CAN_TCR.helpkey="Transfer Command Register" +AT91C_CAN_TCR.access=memorymapped +AT91C_CAN_TCR.address=0xFFFD0024 +AT91C_CAN_TCR.width=32 +AT91C_CAN_TCR.byteEndian=little +AT91C_CAN_TCR.type=enum +AT91C_CAN_TCR.enum.0.name=*** Write only *** +AT91C_CAN_TCR.enum.1.name=Error +AT91C_CAN_IMR.name="AT91C_CAN_IMR" +AT91C_CAN_IMR.description="Interrupt Mask Register" +AT91C_CAN_IMR.helpkey="Interrupt Mask Register" +AT91C_CAN_IMR.access=memorymapped +AT91C_CAN_IMR.address=0xFFFD000C +AT91C_CAN_IMR.width=32 +AT91C_CAN_IMR.byteEndian=little +AT91C_CAN_IMR.permission.write=none +AT91C_CAN_IER.name="AT91C_CAN_IER" +AT91C_CAN_IER.description="Interrupt Enable Register" +AT91C_CAN_IER.helpkey="Interrupt Enable Register" +AT91C_CAN_IER.access=memorymapped +AT91C_CAN_IER.address=0xFFFD0004 +AT91C_CAN_IER.width=32 +AT91C_CAN_IER.byteEndian=little +AT91C_CAN_IER.type=enum +AT91C_CAN_IER.enum.0.name=*** Write only *** +AT91C_CAN_IER.enum.1.name=Error +AT91C_CAN_ECR.name="AT91C_CAN_ECR" +AT91C_CAN_ECR.description="Error Counter Register" +AT91C_CAN_ECR.helpkey="Error Counter Register" +AT91C_CAN_ECR.access=memorymapped +AT91C_CAN_ECR.address=0xFFFD0020 +AT91C_CAN_ECR.width=32 +AT91C_CAN_ECR.byteEndian=little +AT91C_CAN_ECR.permission.write=none +AT91C_CAN_TIMESTP.name="AT91C_CAN_TIMESTP" +AT91C_CAN_TIMESTP.description="Time Stamp Register" +AT91C_CAN_TIMESTP.helpkey="Time Stamp Register" +AT91C_CAN_TIMESTP.access=memorymapped +AT91C_CAN_TIMESTP.address=0xFFFD001C +AT91C_CAN_TIMESTP.width=32 +AT91C_CAN_TIMESTP.byteEndian=little +AT91C_CAN_TIMESTP.permission.write=none +AT91C_CAN_MR.name="AT91C_CAN_MR" +AT91C_CAN_MR.description="Mode Register" +AT91C_CAN_MR.helpkey="Mode Register" +AT91C_CAN_MR.access=memorymapped +AT91C_CAN_MR.address=0xFFFD0000 +AT91C_CAN_MR.width=32 +AT91C_CAN_MR.byteEndian=little +AT91C_CAN_IDR.name="AT91C_CAN_IDR" +AT91C_CAN_IDR.description="Interrupt Disable Register" +AT91C_CAN_IDR.helpkey="Interrupt Disable Register" +AT91C_CAN_IDR.access=memorymapped +AT91C_CAN_IDR.address=0xFFFD0008 +AT91C_CAN_IDR.width=32 +AT91C_CAN_IDR.byteEndian=little +AT91C_CAN_IDR.type=enum +AT91C_CAN_IDR.enum.0.name=*** Write only *** +AT91C_CAN_IDR.enum.1.name=Error +AT91C_CAN_ACR.name="AT91C_CAN_ACR" +AT91C_CAN_ACR.description="Abort Command Register" +AT91C_CAN_ACR.helpkey="Abort Command Register" +AT91C_CAN_ACR.access=memorymapped +AT91C_CAN_ACR.address=0xFFFD0028 +AT91C_CAN_ACR.width=32 +AT91C_CAN_ACR.byteEndian=little +AT91C_CAN_ACR.type=enum +AT91C_CAN_ACR.enum.0.name=*** Write only *** +AT91C_CAN_ACR.enum.1.name=Error +AT91C_CAN_TIM.name="AT91C_CAN_TIM" +AT91C_CAN_TIM.description="Timer Register" +AT91C_CAN_TIM.helpkey="Timer Register" +AT91C_CAN_TIM.access=memorymapped +AT91C_CAN_TIM.address=0xFFFD0018 +AT91C_CAN_TIM.width=32 +AT91C_CAN_TIM.byteEndian=little +AT91C_CAN_TIM.permission.write=none +AT91C_CAN_SR.name="AT91C_CAN_SR" +AT91C_CAN_SR.description="Status Register" +AT91C_CAN_SR.helpkey="Status Register" +AT91C_CAN_SR.access=memorymapped +AT91C_CAN_SR.address=0xFFFD0010 +AT91C_CAN_SR.width=32 +AT91C_CAN_SR.byteEndian=little +AT91C_CAN_SR.permission.write=none +AT91C_CAN_BR.name="AT91C_CAN_BR" +AT91C_CAN_BR.description="Baudrate Register" +AT91C_CAN_BR.helpkey="Baudrate Register" +AT91C_CAN_BR.access=memorymapped +AT91C_CAN_BR.address=0xFFFD0014 +AT91C_CAN_BR.width=32 +AT91C_CAN_BR.byteEndian=little +AT91C_CAN_VR.name="AT91C_CAN_VR" +AT91C_CAN_VR.description="Version Register" +AT91C_CAN_VR.helpkey="Version Register" +AT91C_CAN_VR.access=memorymapped +AT91C_CAN_VR.address=0xFFFD00FC +AT91C_CAN_VR.width=32 +AT91C_CAN_VR.byteEndian=little +AT91C_CAN_VR.permission.write=none +# ========== Register definition for EMAC peripheral ========== +AT91C_EMAC_ISR.name="AT91C_EMAC_ISR" +AT91C_EMAC_ISR.description="Interrupt Status Register" +AT91C_EMAC_ISR.helpkey="Interrupt Status Register" +AT91C_EMAC_ISR.access=memorymapped +AT91C_EMAC_ISR.address=0xFFFDC024 +AT91C_EMAC_ISR.width=32 +AT91C_EMAC_ISR.byteEndian=little +AT91C_EMAC_SA4H.name="AT91C_EMAC_SA4H" +AT91C_EMAC_SA4H.description="Specific Address 4 Top, Last 2 bytes" +AT91C_EMAC_SA4H.helpkey="Specific Address 4 Top, Last 2 bytes" +AT91C_EMAC_SA4H.access=memorymapped +AT91C_EMAC_SA4H.address=0xFFFDC0B4 +AT91C_EMAC_SA4H.width=32 +AT91C_EMAC_SA4H.byteEndian=little +AT91C_EMAC_SA1L.name="AT91C_EMAC_SA1L" +AT91C_EMAC_SA1L.description="Specific Address 1 Bottom, First 4 bytes" +AT91C_EMAC_SA1L.helpkey="Specific Address 1 Bottom, First 4 bytes" +AT91C_EMAC_SA1L.access=memorymapped +AT91C_EMAC_SA1L.address=0xFFFDC098 +AT91C_EMAC_SA1L.width=32 +AT91C_EMAC_SA1L.byteEndian=little +AT91C_EMAC_ELE.name="AT91C_EMAC_ELE" +AT91C_EMAC_ELE.description="Excessive Length Errors Register" +AT91C_EMAC_ELE.helpkey="Excessive Length Errors Register" +AT91C_EMAC_ELE.access=memorymapped +AT91C_EMAC_ELE.address=0xFFFDC078 +AT91C_EMAC_ELE.width=32 +AT91C_EMAC_ELE.byteEndian=little +AT91C_EMAC_LCOL.name="AT91C_EMAC_LCOL" +AT91C_EMAC_LCOL.description="Late Collision Register" +AT91C_EMAC_LCOL.helpkey="Late Collision Register" +AT91C_EMAC_LCOL.access=memorymapped +AT91C_EMAC_LCOL.address=0xFFFDC05C +AT91C_EMAC_LCOL.width=32 +AT91C_EMAC_LCOL.byteEndian=little +AT91C_EMAC_RLE.name="AT91C_EMAC_RLE" +AT91C_EMAC_RLE.description="Receive Length Field Mismatch Register" +AT91C_EMAC_RLE.helpkey="Receive Length Field Mismatch Register" +AT91C_EMAC_RLE.access=memorymapped +AT91C_EMAC_RLE.address=0xFFFDC088 +AT91C_EMAC_RLE.width=32 +AT91C_EMAC_RLE.byteEndian=little +AT91C_EMAC_WOL.name="AT91C_EMAC_WOL" +AT91C_EMAC_WOL.description="Wake On LAN Register" +AT91C_EMAC_WOL.helpkey="Wake On LAN Register" +AT91C_EMAC_WOL.access=memorymapped +AT91C_EMAC_WOL.address=0xFFFDC0C4 +AT91C_EMAC_WOL.width=32 +AT91C_EMAC_WOL.byteEndian=little +AT91C_EMAC_DTF.name="AT91C_EMAC_DTF" +AT91C_EMAC_DTF.description="Deferred Transmission Frame Register" +AT91C_EMAC_DTF.helpkey="Deferred Transmission Frame Register" +AT91C_EMAC_DTF.access=memorymapped +AT91C_EMAC_DTF.address=0xFFFDC058 +AT91C_EMAC_DTF.width=32 +AT91C_EMAC_DTF.byteEndian=little +AT91C_EMAC_TUND.name="AT91C_EMAC_TUND" +AT91C_EMAC_TUND.description="Transmit Underrun Error Register" +AT91C_EMAC_TUND.helpkey="Transmit Underrun Error Register" +AT91C_EMAC_TUND.access=memorymapped +AT91C_EMAC_TUND.address=0xFFFDC064 +AT91C_EMAC_TUND.width=32 +AT91C_EMAC_TUND.byteEndian=little +AT91C_EMAC_NCR.name="AT91C_EMAC_NCR" +AT91C_EMAC_NCR.description="Network Control Register" +AT91C_EMAC_NCR.helpkey="Network Control Register" +AT91C_EMAC_NCR.access=memorymapped +AT91C_EMAC_NCR.address=0xFFFDC000 +AT91C_EMAC_NCR.width=32 +AT91C_EMAC_NCR.byteEndian=little +AT91C_EMAC_SA4L.name="AT91C_EMAC_SA4L" +AT91C_EMAC_SA4L.description="Specific Address 4 Bottom, First 4 bytes" +AT91C_EMAC_SA4L.helpkey="Specific Address 4 Bottom, First 4 bytes" +AT91C_EMAC_SA4L.access=memorymapped +AT91C_EMAC_SA4L.address=0xFFFDC0B0 +AT91C_EMAC_SA4L.width=32 +AT91C_EMAC_SA4L.byteEndian=little +AT91C_EMAC_RSR.name="AT91C_EMAC_RSR" +AT91C_EMAC_RSR.description="Receive Status Register" +AT91C_EMAC_RSR.helpkey="Receive Status Register" +AT91C_EMAC_RSR.access=memorymapped +AT91C_EMAC_RSR.address=0xFFFDC020 +AT91C_EMAC_RSR.width=32 +AT91C_EMAC_RSR.byteEndian=little +AT91C_EMAC_SA3L.name="AT91C_EMAC_SA3L" +AT91C_EMAC_SA3L.description="Specific Address 3 Bottom, First 4 bytes" +AT91C_EMAC_SA3L.helpkey="Specific Address 3 Bottom, First 4 bytes" +AT91C_EMAC_SA3L.access=memorymapped +AT91C_EMAC_SA3L.address=0xFFFDC0A8 +AT91C_EMAC_SA3L.width=32 +AT91C_EMAC_SA3L.byteEndian=little +AT91C_EMAC_TSR.name="AT91C_EMAC_TSR" +AT91C_EMAC_TSR.description="Transmit Status Register" +AT91C_EMAC_TSR.helpkey="Transmit Status Register" +AT91C_EMAC_TSR.access=memorymapped +AT91C_EMAC_TSR.address=0xFFFDC014 +AT91C_EMAC_TSR.width=32 +AT91C_EMAC_TSR.byteEndian=little +AT91C_EMAC_IDR.name="AT91C_EMAC_IDR" +AT91C_EMAC_IDR.description="Interrupt Disable Register" +AT91C_EMAC_IDR.helpkey="Interrupt Disable Register" +AT91C_EMAC_IDR.access=memorymapped +AT91C_EMAC_IDR.address=0xFFFDC02C +AT91C_EMAC_IDR.width=32 +AT91C_EMAC_IDR.byteEndian=little +AT91C_EMAC_IDR.type=enum +AT91C_EMAC_IDR.enum.0.name=*** Write only *** +AT91C_EMAC_IDR.enum.1.name=Error +AT91C_EMAC_RSE.name="AT91C_EMAC_RSE" +AT91C_EMAC_RSE.description="Receive Symbol Errors Register" +AT91C_EMAC_RSE.helpkey="Receive Symbol Errors Register" +AT91C_EMAC_RSE.access=memorymapped +AT91C_EMAC_RSE.address=0xFFFDC074 +AT91C_EMAC_RSE.width=32 +AT91C_EMAC_RSE.byteEndian=little +AT91C_EMAC_ECOL.name="AT91C_EMAC_ECOL" +AT91C_EMAC_ECOL.description="Excessive Collision Register" +AT91C_EMAC_ECOL.helpkey="Excessive Collision Register" +AT91C_EMAC_ECOL.access=memorymapped +AT91C_EMAC_ECOL.address=0xFFFDC060 +AT91C_EMAC_ECOL.width=32 +AT91C_EMAC_ECOL.byteEndian=little +AT91C_EMAC_TID.name="AT91C_EMAC_TID" +AT91C_EMAC_TID.description="Type ID Checking Register" +AT91C_EMAC_TID.helpkey="Type ID Checking Register" +AT91C_EMAC_TID.access=memorymapped +AT91C_EMAC_TID.address=0xFFFDC0B8 +AT91C_EMAC_TID.width=32 +AT91C_EMAC_TID.byteEndian=little +AT91C_EMAC_HRB.name="AT91C_EMAC_HRB" +AT91C_EMAC_HRB.description="Hash Address Bottom[31:0]" +AT91C_EMAC_HRB.helpkey="Hash Address Bottom[31:0]" +AT91C_EMAC_HRB.access=memorymapped +AT91C_EMAC_HRB.address=0xFFFDC090 +AT91C_EMAC_HRB.width=32 +AT91C_EMAC_HRB.byteEndian=little +AT91C_EMAC_TBQP.name="AT91C_EMAC_TBQP" +AT91C_EMAC_TBQP.description="Transmit Buffer Queue Pointer" +AT91C_EMAC_TBQP.helpkey="Transmit Buffer Queue Pointer" +AT91C_EMAC_TBQP.access=memorymapped +AT91C_EMAC_TBQP.address=0xFFFDC01C +AT91C_EMAC_TBQP.width=32 +AT91C_EMAC_TBQP.byteEndian=little +AT91C_EMAC_USRIO.name="AT91C_EMAC_USRIO" +AT91C_EMAC_USRIO.description="USER Input/Output Register" +AT91C_EMAC_USRIO.helpkey="USER Input/Output Register" +AT91C_EMAC_USRIO.access=memorymapped +AT91C_EMAC_USRIO.address=0xFFFDC0C0 +AT91C_EMAC_USRIO.width=32 +AT91C_EMAC_USRIO.byteEndian=little +AT91C_EMAC_PTR.name="AT91C_EMAC_PTR" +AT91C_EMAC_PTR.description="Pause Time Register" +AT91C_EMAC_PTR.helpkey="Pause Time Register" +AT91C_EMAC_PTR.access=memorymapped +AT91C_EMAC_PTR.address=0xFFFDC038 +AT91C_EMAC_PTR.width=32 +AT91C_EMAC_PTR.byteEndian=little +AT91C_EMAC_SA2H.name="AT91C_EMAC_SA2H" +AT91C_EMAC_SA2H.description="Specific Address 2 Top, Last 2 bytes" +AT91C_EMAC_SA2H.helpkey="Specific Address 2 Top, Last 2 bytes" +AT91C_EMAC_SA2H.access=memorymapped +AT91C_EMAC_SA2H.address=0xFFFDC0A4 +AT91C_EMAC_SA2H.width=32 +AT91C_EMAC_SA2H.byteEndian=little +AT91C_EMAC_ROV.name="AT91C_EMAC_ROV" +AT91C_EMAC_ROV.description="Receive Overrun Errors Register" +AT91C_EMAC_ROV.helpkey="Receive Overrun Errors Register" +AT91C_EMAC_ROV.access=memorymapped +AT91C_EMAC_ROV.address=0xFFFDC070 +AT91C_EMAC_ROV.width=32 +AT91C_EMAC_ROV.byteEndian=little +AT91C_EMAC_ALE.name="AT91C_EMAC_ALE" +AT91C_EMAC_ALE.description="Alignment Error Register" +AT91C_EMAC_ALE.helpkey="Alignment Error Register" +AT91C_EMAC_ALE.access=memorymapped +AT91C_EMAC_ALE.address=0xFFFDC054 +AT91C_EMAC_ALE.width=32 +AT91C_EMAC_ALE.byteEndian=little +AT91C_EMAC_RJA.name="AT91C_EMAC_RJA" +AT91C_EMAC_RJA.description="Receive Jabbers Register" +AT91C_EMAC_RJA.helpkey="Receive Jabbers Register" +AT91C_EMAC_RJA.access=memorymapped +AT91C_EMAC_RJA.address=0xFFFDC07C +AT91C_EMAC_RJA.width=32 +AT91C_EMAC_RJA.byteEndian=little +AT91C_EMAC_RBQP.name="AT91C_EMAC_RBQP" +AT91C_EMAC_RBQP.description="Receive Buffer Queue Pointer" +AT91C_EMAC_RBQP.helpkey="Receive Buffer Queue Pointer" +AT91C_EMAC_RBQP.access=memorymapped +AT91C_EMAC_RBQP.address=0xFFFDC018 +AT91C_EMAC_RBQP.width=32 +AT91C_EMAC_RBQP.byteEndian=little +AT91C_EMAC_TPF.name="AT91C_EMAC_TPF" +AT91C_EMAC_TPF.description="Transmitted Pause Frames Register" +AT91C_EMAC_TPF.helpkey="Transmitted Pause Frames Register" +AT91C_EMAC_TPF.access=memorymapped +AT91C_EMAC_TPF.address=0xFFFDC08C +AT91C_EMAC_TPF.width=32 +AT91C_EMAC_TPF.byteEndian=little +AT91C_EMAC_NCFGR.name="AT91C_EMAC_NCFGR" +AT91C_EMAC_NCFGR.description="Network Configuration Register" +AT91C_EMAC_NCFGR.helpkey="Network Configuration Register" +AT91C_EMAC_NCFGR.access=memorymapped +AT91C_EMAC_NCFGR.address=0xFFFDC004 +AT91C_EMAC_NCFGR.width=32 +AT91C_EMAC_NCFGR.byteEndian=little +AT91C_EMAC_HRT.name="AT91C_EMAC_HRT" +AT91C_EMAC_HRT.description="Hash Address Top[63:32]" +AT91C_EMAC_HRT.helpkey="Hash Address Top[63:32]" +AT91C_EMAC_HRT.access=memorymapped +AT91C_EMAC_HRT.address=0xFFFDC094 +AT91C_EMAC_HRT.width=32 +AT91C_EMAC_HRT.byteEndian=little +AT91C_EMAC_USF.name="AT91C_EMAC_USF" +AT91C_EMAC_USF.description="Undersize Frames Register" +AT91C_EMAC_USF.helpkey="Undersize Frames Register" +AT91C_EMAC_USF.access=memorymapped +AT91C_EMAC_USF.address=0xFFFDC080 +AT91C_EMAC_USF.width=32 +AT91C_EMAC_USF.byteEndian=little +AT91C_EMAC_FCSE.name="AT91C_EMAC_FCSE" +AT91C_EMAC_FCSE.description="Frame Check Sequence Error Register" +AT91C_EMAC_FCSE.helpkey="Frame Check Sequence Error Register" +AT91C_EMAC_FCSE.access=memorymapped +AT91C_EMAC_FCSE.address=0xFFFDC050 +AT91C_EMAC_FCSE.width=32 +AT91C_EMAC_FCSE.byteEndian=little +AT91C_EMAC_TPQ.name="AT91C_EMAC_TPQ" +AT91C_EMAC_TPQ.description="Transmit Pause Quantum Register" +AT91C_EMAC_TPQ.helpkey="Transmit Pause Quantum Register" +AT91C_EMAC_TPQ.access=memorymapped +AT91C_EMAC_TPQ.address=0xFFFDC0BC +AT91C_EMAC_TPQ.width=32 +AT91C_EMAC_TPQ.byteEndian=little +AT91C_EMAC_MAN.name="AT91C_EMAC_MAN" +AT91C_EMAC_MAN.description="PHY Maintenance Register" +AT91C_EMAC_MAN.helpkey="PHY Maintenance Register" +AT91C_EMAC_MAN.access=memorymapped +AT91C_EMAC_MAN.address=0xFFFDC034 +AT91C_EMAC_MAN.width=32 +AT91C_EMAC_MAN.byteEndian=little +AT91C_EMAC_FTO.name="AT91C_EMAC_FTO" +AT91C_EMAC_FTO.description="Frames Transmitted OK Register" +AT91C_EMAC_FTO.helpkey="Frames Transmitted OK Register" +AT91C_EMAC_FTO.access=memorymapped +AT91C_EMAC_FTO.address=0xFFFDC040 +AT91C_EMAC_FTO.width=32 +AT91C_EMAC_FTO.byteEndian=little +AT91C_EMAC_REV.name="AT91C_EMAC_REV" +AT91C_EMAC_REV.description="Revision Register" +AT91C_EMAC_REV.helpkey="Revision Register" +AT91C_EMAC_REV.access=memorymapped +AT91C_EMAC_REV.address=0xFFFDC0FC +AT91C_EMAC_REV.width=32 +AT91C_EMAC_REV.byteEndian=little +AT91C_EMAC_REV.permission.write=none +AT91C_EMAC_IMR.name="AT91C_EMAC_IMR" +AT91C_EMAC_IMR.description="Interrupt Mask Register" +AT91C_EMAC_IMR.helpkey="Interrupt Mask Register" +AT91C_EMAC_IMR.access=memorymapped +AT91C_EMAC_IMR.address=0xFFFDC030 +AT91C_EMAC_IMR.width=32 +AT91C_EMAC_IMR.byteEndian=little +AT91C_EMAC_IMR.permission.write=none +AT91C_EMAC_SCF.name="AT91C_EMAC_SCF" +AT91C_EMAC_SCF.description="Single Collision Frame Register" +AT91C_EMAC_SCF.helpkey="Single Collision Frame Register" +AT91C_EMAC_SCF.access=memorymapped +AT91C_EMAC_SCF.address=0xFFFDC044 +AT91C_EMAC_SCF.width=32 +AT91C_EMAC_SCF.byteEndian=little +AT91C_EMAC_PFR.name="AT91C_EMAC_PFR" +AT91C_EMAC_PFR.description="Pause Frames received Register" +AT91C_EMAC_PFR.helpkey="Pause Frames received Register" +AT91C_EMAC_PFR.access=memorymapped +AT91C_EMAC_PFR.address=0xFFFDC03C +AT91C_EMAC_PFR.width=32 +AT91C_EMAC_PFR.byteEndian=little +AT91C_EMAC_MCF.name="AT91C_EMAC_MCF" +AT91C_EMAC_MCF.description="Multiple Collision Frame Register" +AT91C_EMAC_MCF.helpkey="Multiple Collision Frame Register" +AT91C_EMAC_MCF.access=memorymapped +AT91C_EMAC_MCF.address=0xFFFDC048 +AT91C_EMAC_MCF.width=32 +AT91C_EMAC_MCF.byteEndian=little +AT91C_EMAC_NSR.name="AT91C_EMAC_NSR" +AT91C_EMAC_NSR.description="Network Status Register" +AT91C_EMAC_NSR.helpkey="Network Status Register" +AT91C_EMAC_NSR.access=memorymapped +AT91C_EMAC_NSR.address=0xFFFDC008 +AT91C_EMAC_NSR.width=32 +AT91C_EMAC_NSR.byteEndian=little +AT91C_EMAC_NSR.permission.write=none +AT91C_EMAC_SA2L.name="AT91C_EMAC_SA2L" +AT91C_EMAC_SA2L.description="Specific Address 2 Bottom, First 4 bytes" +AT91C_EMAC_SA2L.helpkey="Specific Address 2 Bottom, First 4 bytes" +AT91C_EMAC_SA2L.access=memorymapped +AT91C_EMAC_SA2L.address=0xFFFDC0A0 +AT91C_EMAC_SA2L.width=32 +AT91C_EMAC_SA2L.byteEndian=little +AT91C_EMAC_FRO.name="AT91C_EMAC_FRO" +AT91C_EMAC_FRO.description="Frames Received OK Register" +AT91C_EMAC_FRO.helpkey="Frames Received OK Register" +AT91C_EMAC_FRO.access=memorymapped +AT91C_EMAC_FRO.address=0xFFFDC04C +AT91C_EMAC_FRO.width=32 +AT91C_EMAC_FRO.byteEndian=little +AT91C_EMAC_IER.name="AT91C_EMAC_IER" +AT91C_EMAC_IER.description="Interrupt Enable Register" +AT91C_EMAC_IER.helpkey="Interrupt Enable Register" +AT91C_EMAC_IER.access=memorymapped +AT91C_EMAC_IER.address=0xFFFDC028 +AT91C_EMAC_IER.width=32 +AT91C_EMAC_IER.byteEndian=little +AT91C_EMAC_IER.type=enum +AT91C_EMAC_IER.enum.0.name=*** Write only *** +AT91C_EMAC_IER.enum.1.name=Error +AT91C_EMAC_SA1H.name="AT91C_EMAC_SA1H" +AT91C_EMAC_SA1H.description="Specific Address 1 Top, Last 2 bytes" +AT91C_EMAC_SA1H.helpkey="Specific Address 1 Top, Last 2 bytes" +AT91C_EMAC_SA1H.access=memorymapped +AT91C_EMAC_SA1H.address=0xFFFDC09C +AT91C_EMAC_SA1H.width=32 +AT91C_EMAC_SA1H.byteEndian=little +AT91C_EMAC_CSE.name="AT91C_EMAC_CSE" +AT91C_EMAC_CSE.description="Carrier Sense Error Register" +AT91C_EMAC_CSE.helpkey="Carrier Sense Error Register" +AT91C_EMAC_CSE.access=memorymapped +AT91C_EMAC_CSE.address=0xFFFDC068 +AT91C_EMAC_CSE.width=32 +AT91C_EMAC_CSE.byteEndian=little +AT91C_EMAC_SA3H.name="AT91C_EMAC_SA3H" +AT91C_EMAC_SA3H.description="Specific Address 3 Top, Last 2 bytes" +AT91C_EMAC_SA3H.helpkey="Specific Address 3 Top, Last 2 bytes" +AT91C_EMAC_SA3H.access=memorymapped +AT91C_EMAC_SA3H.address=0xFFFDC0AC +AT91C_EMAC_SA3H.width=32 +AT91C_EMAC_SA3H.byteEndian=little +AT91C_EMAC_RRE.name="AT91C_EMAC_RRE" +AT91C_EMAC_RRE.description="Receive Ressource Error Register" +AT91C_EMAC_RRE.helpkey="Receive Ressource Error Register" +AT91C_EMAC_RRE.access=memorymapped +AT91C_EMAC_RRE.address=0xFFFDC06C +AT91C_EMAC_RRE.width=32 +AT91C_EMAC_RRE.byteEndian=little +AT91C_EMAC_STE.name="AT91C_EMAC_STE" +AT91C_EMAC_STE.description="SQE Test Error Register" +AT91C_EMAC_STE.helpkey="SQE Test Error Register" +AT91C_EMAC_STE.access=memorymapped +AT91C_EMAC_STE.address=0xFFFDC084 +AT91C_EMAC_STE.width=32 +AT91C_EMAC_STE.byteEndian=little +# ========== Register definition for PDC_ADC peripheral ========== +AT91C_ADC_PTSR.name="AT91C_ADC_PTSR" +AT91C_ADC_PTSR.description="PDC Transfer Status Register" +AT91C_ADC_PTSR.helpkey="PDC Transfer Status Register" +AT91C_ADC_PTSR.access=memorymapped +AT91C_ADC_PTSR.address=0xFFFD8124 +AT91C_ADC_PTSR.width=32 +AT91C_ADC_PTSR.byteEndian=little +AT91C_ADC_PTSR.permission.write=none +AT91C_ADC_PTCR.name="AT91C_ADC_PTCR" +AT91C_ADC_PTCR.description="PDC Transfer Control Register" +AT91C_ADC_PTCR.helpkey="PDC Transfer Control Register" +AT91C_ADC_PTCR.access=memorymapped +AT91C_ADC_PTCR.address=0xFFFD8120 +AT91C_ADC_PTCR.width=32 +AT91C_ADC_PTCR.byteEndian=little +AT91C_ADC_PTCR.type=enum +AT91C_ADC_PTCR.enum.0.name=*** Write only *** +AT91C_ADC_PTCR.enum.1.name=Error +AT91C_ADC_TNPR.name="AT91C_ADC_TNPR" +AT91C_ADC_TNPR.description="Transmit Next Pointer Register" +AT91C_ADC_TNPR.helpkey="Transmit Next Pointer Register" +AT91C_ADC_TNPR.access=memorymapped +AT91C_ADC_TNPR.address=0xFFFD8118 +AT91C_ADC_TNPR.width=32 +AT91C_ADC_TNPR.byteEndian=little +AT91C_ADC_TNCR.name="AT91C_ADC_TNCR" +AT91C_ADC_TNCR.description="Transmit Next Counter Register" +AT91C_ADC_TNCR.helpkey="Transmit Next Counter Register" +AT91C_ADC_TNCR.access=memorymapped +AT91C_ADC_TNCR.address=0xFFFD811C +AT91C_ADC_TNCR.width=32 +AT91C_ADC_TNCR.byteEndian=little +AT91C_ADC_RNPR.name="AT91C_ADC_RNPR" +AT91C_ADC_RNPR.description="Receive Next Pointer Register" +AT91C_ADC_RNPR.helpkey="Receive Next Pointer Register" +AT91C_ADC_RNPR.access=memorymapped +AT91C_ADC_RNPR.address=0xFFFD8110 +AT91C_ADC_RNPR.width=32 +AT91C_ADC_RNPR.byteEndian=little +AT91C_ADC_RNCR.name="AT91C_ADC_RNCR" +AT91C_ADC_RNCR.description="Receive Next Counter Register" +AT91C_ADC_RNCR.helpkey="Receive Next Counter Register" +AT91C_ADC_RNCR.access=memorymapped +AT91C_ADC_RNCR.address=0xFFFD8114 +AT91C_ADC_RNCR.width=32 +AT91C_ADC_RNCR.byteEndian=little +AT91C_ADC_RPR.name="AT91C_ADC_RPR" +AT91C_ADC_RPR.description="Receive Pointer Register" +AT91C_ADC_RPR.helpkey="Receive Pointer Register" +AT91C_ADC_RPR.access=memorymapped +AT91C_ADC_RPR.address=0xFFFD8100 +AT91C_ADC_RPR.width=32 +AT91C_ADC_RPR.byteEndian=little +AT91C_ADC_TCR.name="AT91C_ADC_TCR" +AT91C_ADC_TCR.description="Transmit Counter Register" +AT91C_ADC_TCR.helpkey="Transmit Counter Register" +AT91C_ADC_TCR.access=memorymapped +AT91C_ADC_TCR.address=0xFFFD810C +AT91C_ADC_TCR.width=32 +AT91C_ADC_TCR.byteEndian=little +AT91C_ADC_TPR.name="AT91C_ADC_TPR" +AT91C_ADC_TPR.description="Transmit Pointer Register" +AT91C_ADC_TPR.helpkey="Transmit Pointer Register" +AT91C_ADC_TPR.access=memorymapped +AT91C_ADC_TPR.address=0xFFFD8108 +AT91C_ADC_TPR.width=32 +AT91C_ADC_TPR.byteEndian=little +AT91C_ADC_RCR.name="AT91C_ADC_RCR" +AT91C_ADC_RCR.description="Receive Counter Register" +AT91C_ADC_RCR.helpkey="Receive Counter Register" +AT91C_ADC_RCR.access=memorymapped +AT91C_ADC_RCR.address=0xFFFD8104 +AT91C_ADC_RCR.width=32 +AT91C_ADC_RCR.byteEndian=little +# ========== Register definition for ADC peripheral ========== +AT91C_ADC_CDR2.name="AT91C_ADC_CDR2" +AT91C_ADC_CDR2.description="ADC Channel Data Register 2" +AT91C_ADC_CDR2.helpkey="ADC Channel Data Register 2" +AT91C_ADC_CDR2.access=memorymapped +AT91C_ADC_CDR2.address=0xFFFD8038 +AT91C_ADC_CDR2.width=32 +AT91C_ADC_CDR2.byteEndian=little +AT91C_ADC_CDR2.permission.write=none +AT91C_ADC_CDR3.name="AT91C_ADC_CDR3" +AT91C_ADC_CDR3.description="ADC Channel Data Register 3" +AT91C_ADC_CDR3.helpkey="ADC Channel Data Register 3" +AT91C_ADC_CDR3.access=memorymapped +AT91C_ADC_CDR3.address=0xFFFD803C +AT91C_ADC_CDR3.width=32 +AT91C_ADC_CDR3.byteEndian=little +AT91C_ADC_CDR3.permission.write=none +AT91C_ADC_CDR0.name="AT91C_ADC_CDR0" +AT91C_ADC_CDR0.description="ADC Channel Data Register 0" +AT91C_ADC_CDR0.helpkey="ADC Channel Data Register 0" +AT91C_ADC_CDR0.access=memorymapped +AT91C_ADC_CDR0.address=0xFFFD8030 +AT91C_ADC_CDR0.width=32 +AT91C_ADC_CDR0.byteEndian=little +AT91C_ADC_CDR0.permission.write=none +AT91C_ADC_CDR5.name="AT91C_ADC_CDR5" +AT91C_ADC_CDR5.description="ADC Channel Data Register 5" +AT91C_ADC_CDR5.helpkey="ADC Channel Data Register 5" +AT91C_ADC_CDR5.access=memorymapped +AT91C_ADC_CDR5.address=0xFFFD8044 +AT91C_ADC_CDR5.width=32 +AT91C_ADC_CDR5.byteEndian=little +AT91C_ADC_CDR5.permission.write=none +AT91C_ADC_CHDR.name="AT91C_ADC_CHDR" +AT91C_ADC_CHDR.description="ADC Channel Disable Register" +AT91C_ADC_CHDR.helpkey="ADC Channel Disable Register" +AT91C_ADC_CHDR.access=memorymapped +AT91C_ADC_CHDR.address=0xFFFD8014 +AT91C_ADC_CHDR.width=32 +AT91C_ADC_CHDR.byteEndian=little +AT91C_ADC_CHDR.type=enum +AT91C_ADC_CHDR.enum.0.name=*** Write only *** +AT91C_ADC_CHDR.enum.1.name=Error +AT91C_ADC_SR.name="AT91C_ADC_SR" +AT91C_ADC_SR.description="ADC Status Register" +AT91C_ADC_SR.helpkey="ADC Status Register" +AT91C_ADC_SR.access=memorymapped +AT91C_ADC_SR.address=0xFFFD801C +AT91C_ADC_SR.width=32 +AT91C_ADC_SR.byteEndian=little +AT91C_ADC_SR.permission.write=none +AT91C_ADC_CDR4.name="AT91C_ADC_CDR4" +AT91C_ADC_CDR4.description="ADC Channel Data Register 4" +AT91C_ADC_CDR4.helpkey="ADC Channel Data Register 4" +AT91C_ADC_CDR4.access=memorymapped +AT91C_ADC_CDR4.address=0xFFFD8040 +AT91C_ADC_CDR4.width=32 +AT91C_ADC_CDR4.byteEndian=little +AT91C_ADC_CDR4.permission.write=none +AT91C_ADC_CDR1.name="AT91C_ADC_CDR1" +AT91C_ADC_CDR1.description="ADC Channel Data Register 1" +AT91C_ADC_CDR1.helpkey="ADC Channel Data Register 1" +AT91C_ADC_CDR1.access=memorymapped +AT91C_ADC_CDR1.address=0xFFFD8034 +AT91C_ADC_CDR1.width=32 +AT91C_ADC_CDR1.byteEndian=little +AT91C_ADC_CDR1.permission.write=none +AT91C_ADC_LCDR.name="AT91C_ADC_LCDR" +AT91C_ADC_LCDR.description="ADC Last Converted Data Register" +AT91C_ADC_LCDR.helpkey="ADC Last Converted Data Register" +AT91C_ADC_LCDR.access=memorymapped +AT91C_ADC_LCDR.address=0xFFFD8020 +AT91C_ADC_LCDR.width=32 +AT91C_ADC_LCDR.byteEndian=little +AT91C_ADC_LCDR.permission.write=none +AT91C_ADC_IDR.name="AT91C_ADC_IDR" +AT91C_ADC_IDR.description="ADC Interrupt Disable Register" +AT91C_ADC_IDR.helpkey="ADC Interrupt Disable Register" +AT91C_ADC_IDR.access=memorymapped +AT91C_ADC_IDR.address=0xFFFD8028 +AT91C_ADC_IDR.width=32 +AT91C_ADC_IDR.byteEndian=little +AT91C_ADC_IDR.type=enum +AT91C_ADC_IDR.enum.0.name=*** Write only *** +AT91C_ADC_IDR.enum.1.name=Error +AT91C_ADC_CR.name="AT91C_ADC_CR" +AT91C_ADC_CR.description="ADC Control Register" +AT91C_ADC_CR.helpkey="ADC Control Register" +AT91C_ADC_CR.access=memorymapped +AT91C_ADC_CR.address=0xFFFD8000 +AT91C_ADC_CR.width=32 +AT91C_ADC_CR.byteEndian=little +AT91C_ADC_CR.type=enum +AT91C_ADC_CR.enum.0.name=*** Write only *** +AT91C_ADC_CR.enum.1.name=Error +AT91C_ADC_CDR7.name="AT91C_ADC_CDR7" +AT91C_ADC_CDR7.description="ADC Channel Data Register 7" +AT91C_ADC_CDR7.helpkey="ADC Channel Data Register 7" +AT91C_ADC_CDR7.access=memorymapped +AT91C_ADC_CDR7.address=0xFFFD804C +AT91C_ADC_CDR7.width=32 +AT91C_ADC_CDR7.byteEndian=little +AT91C_ADC_CDR7.permission.write=none +AT91C_ADC_CDR6.name="AT91C_ADC_CDR6" +AT91C_ADC_CDR6.description="ADC Channel Data Register 6" +AT91C_ADC_CDR6.helpkey="ADC Channel Data Register 6" +AT91C_ADC_CDR6.access=memorymapped +AT91C_ADC_CDR6.address=0xFFFD8048 +AT91C_ADC_CDR6.width=32 +AT91C_ADC_CDR6.byteEndian=little +AT91C_ADC_CDR6.permission.write=none +AT91C_ADC_IER.name="AT91C_ADC_IER" +AT91C_ADC_IER.description="ADC Interrupt Enable Register" +AT91C_ADC_IER.helpkey="ADC Interrupt Enable Register" +AT91C_ADC_IER.access=memorymapped +AT91C_ADC_IER.address=0xFFFD8024 +AT91C_ADC_IER.width=32 +AT91C_ADC_IER.byteEndian=little +AT91C_ADC_IER.type=enum +AT91C_ADC_IER.enum.0.name=*** Write only *** +AT91C_ADC_IER.enum.1.name=Error +AT91C_ADC_CHER.name="AT91C_ADC_CHER" +AT91C_ADC_CHER.description="ADC Channel Enable Register" +AT91C_ADC_CHER.helpkey="ADC Channel Enable Register" +AT91C_ADC_CHER.access=memorymapped +AT91C_ADC_CHER.address=0xFFFD8010 +AT91C_ADC_CHER.width=32 +AT91C_ADC_CHER.byteEndian=little +AT91C_ADC_CHER.type=enum +AT91C_ADC_CHER.enum.0.name=*** Write only *** +AT91C_ADC_CHER.enum.1.name=Error +AT91C_ADC_CHSR.name="AT91C_ADC_CHSR" +AT91C_ADC_CHSR.description="ADC Channel Status Register" +AT91C_ADC_CHSR.helpkey="ADC Channel Status Register" +AT91C_ADC_CHSR.access=memorymapped +AT91C_ADC_CHSR.address=0xFFFD8018 +AT91C_ADC_CHSR.width=32 +AT91C_ADC_CHSR.byteEndian=little +AT91C_ADC_CHSR.permission.write=none +AT91C_ADC_MR.name="AT91C_ADC_MR" +AT91C_ADC_MR.description="ADC Mode Register" +AT91C_ADC_MR.helpkey="ADC Mode Register" +AT91C_ADC_MR.access=memorymapped +AT91C_ADC_MR.address=0xFFFD8004 +AT91C_ADC_MR.width=32 +AT91C_ADC_MR.byteEndian=little +AT91C_ADC_IMR.name="AT91C_ADC_IMR" +AT91C_ADC_IMR.description="ADC Interrupt Mask Register" +AT91C_ADC_IMR.helpkey="ADC Interrupt Mask Register" +AT91C_ADC_IMR.access=memorymapped +AT91C_ADC_IMR.address=0xFFFD802C +AT91C_ADC_IMR.width=32 +AT91C_ADC_IMR.byteEndian=little +AT91C_ADC_IMR.permission.write=none +# ========== Group definition for SYS peripheral ========== +group.SYS.description="ATMEL SYS Registers" +group.SYS.helpkey="ATMEL SYS Registers" +# ========== Group definition for AIC peripheral ========== +group.AIC.description="ATMEL AIC Registers" +group.AIC.helpkey="ATMEL AIC Registers" +group.AIC.register.0=AT91C_AIC_IVR +group.AIC.register.1=AT91C_AIC_SMR +group.AIC.register.2=AT91C_AIC_FVR +group.AIC.register.3=AT91C_AIC_DCR +group.AIC.register.4=AT91C_AIC_EOICR +group.AIC.register.5=AT91C_AIC_SVR +group.AIC.register.6=AT91C_AIC_FFSR +group.AIC.register.7=AT91C_AIC_ICCR +group.AIC.register.8=AT91C_AIC_ISR +group.AIC.register.9=AT91C_AIC_IMR +group.AIC.register.10=AT91C_AIC_IPR +group.AIC.register.11=AT91C_AIC_FFER +group.AIC.register.12=AT91C_AIC_IECR +group.AIC.register.13=AT91C_AIC_ISCR +group.AIC.register.14=AT91C_AIC_FFDR +group.AIC.register.15=AT91C_AIC_CISR +group.AIC.register.16=AT91C_AIC_IDCR +group.AIC.register.17=AT91C_AIC_SPU +# ========== Group definition for PDC_DBGU peripheral ========== +group.PDC_DBGU.description="ATMEL PDC_DBGU Registers" +group.PDC_DBGU.helpkey="ATMEL PDC_DBGU Registers" +group.PDC_DBGU.register.0=AT91C_DBGU_TCR +group.PDC_DBGU.register.1=AT91C_DBGU_RNPR +group.PDC_DBGU.register.2=AT91C_DBGU_TNPR +group.PDC_DBGU.register.3=AT91C_DBGU_TPR +group.PDC_DBGU.register.4=AT91C_DBGU_RPR +group.PDC_DBGU.register.5=AT91C_DBGU_RCR +group.PDC_DBGU.register.6=AT91C_DBGU_RNCR +group.PDC_DBGU.register.7=AT91C_DBGU_PTCR +group.PDC_DBGU.register.8=AT91C_DBGU_PTSR +group.PDC_DBGU.register.9=AT91C_DBGU_TNCR +# ========== Group definition for DBGU peripheral ========== +group.DBGU.description="ATMEL DBGU Registers" +group.DBGU.helpkey="ATMEL DBGU Registers" +group.DBGU.register.0=AT91C_DBGU_EXID +group.DBGU.register.1=AT91C_DBGU_BRGR +group.DBGU.register.2=AT91C_DBGU_IDR +group.DBGU.register.3=AT91C_DBGU_CSR +group.DBGU.register.4=AT91C_DBGU_CIDR +group.DBGU.register.5=AT91C_DBGU_MR +group.DBGU.register.6=AT91C_DBGU_IMR +group.DBGU.register.7=AT91C_DBGU_CR +group.DBGU.register.8=AT91C_DBGU_FNTR +group.DBGU.register.9=AT91C_DBGU_THR +group.DBGU.register.10=AT91C_DBGU_RHR +group.DBGU.register.11=AT91C_DBGU_IER +# ========== Group definition for PIOA peripheral ========== +group.PIOA.description="ATMEL PIOA Registers" +group.PIOA.helpkey="ATMEL PIOA Registers" +group.PIOA.register.0=AT91C_PIOA_ODR +group.PIOA.register.1=AT91C_PIOA_SODR +group.PIOA.register.2=AT91C_PIOA_ISR +group.PIOA.register.3=AT91C_PIOA_ABSR +group.PIOA.register.4=AT91C_PIOA_IER +group.PIOA.register.5=AT91C_PIOA_PPUDR +group.PIOA.register.6=AT91C_PIOA_IMR +group.PIOA.register.7=AT91C_PIOA_PER +group.PIOA.register.8=AT91C_PIOA_IFDR +group.PIOA.register.9=AT91C_PIOA_OWDR +group.PIOA.register.10=AT91C_PIOA_MDSR +group.PIOA.register.11=AT91C_PIOA_IDR +group.PIOA.register.12=AT91C_PIOA_ODSR +group.PIOA.register.13=AT91C_PIOA_PPUSR +group.PIOA.register.14=AT91C_PIOA_OWSR +group.PIOA.register.15=AT91C_PIOA_BSR +group.PIOA.register.16=AT91C_PIOA_OWER +group.PIOA.register.17=AT91C_PIOA_IFER +group.PIOA.register.18=AT91C_PIOA_PDSR +group.PIOA.register.19=AT91C_PIOA_PPUER +group.PIOA.register.20=AT91C_PIOA_OSR +group.PIOA.register.21=AT91C_PIOA_ASR +group.PIOA.register.22=AT91C_PIOA_MDDR +group.PIOA.register.23=AT91C_PIOA_CODR +group.PIOA.register.24=AT91C_PIOA_MDER +group.PIOA.register.25=AT91C_PIOA_PDR +group.PIOA.register.26=AT91C_PIOA_IFSR +group.PIOA.register.27=AT91C_PIOA_OER +group.PIOA.register.28=AT91C_PIOA_PSR +# ========== Group definition for PIOB peripheral ========== +group.PIOB.description="ATMEL PIOB Registers" +group.PIOB.helpkey="ATMEL PIOB Registers" +group.PIOB.register.0=AT91C_PIOB_OWDR +group.PIOB.register.1=AT91C_PIOB_MDER +group.PIOB.register.2=AT91C_PIOB_PPUSR +group.PIOB.register.3=AT91C_PIOB_IMR +group.PIOB.register.4=AT91C_PIOB_ASR +group.PIOB.register.5=AT91C_PIOB_PPUDR +group.PIOB.register.6=AT91C_PIOB_PSR +group.PIOB.register.7=AT91C_PIOB_IER +group.PIOB.register.8=AT91C_PIOB_CODR +group.PIOB.register.9=AT91C_PIOB_OWER +group.PIOB.register.10=AT91C_PIOB_ABSR +group.PIOB.register.11=AT91C_PIOB_IFDR +group.PIOB.register.12=AT91C_PIOB_PDSR +group.PIOB.register.13=AT91C_PIOB_IDR +group.PIOB.register.14=AT91C_PIOB_OWSR +group.PIOB.register.15=AT91C_PIOB_PDR +group.PIOB.register.16=AT91C_PIOB_ODR +group.PIOB.register.17=AT91C_PIOB_IFSR +group.PIOB.register.18=AT91C_PIOB_PPUER +group.PIOB.register.19=AT91C_PIOB_SODR +group.PIOB.register.20=AT91C_PIOB_ISR +group.PIOB.register.21=AT91C_PIOB_ODSR +group.PIOB.register.22=AT91C_PIOB_OSR +group.PIOB.register.23=AT91C_PIOB_MDSR +group.PIOB.register.24=AT91C_PIOB_IFER +group.PIOB.register.25=AT91C_PIOB_BSR +group.PIOB.register.26=AT91C_PIOB_MDDR +group.PIOB.register.27=AT91C_PIOB_OER +group.PIOB.register.28=AT91C_PIOB_PER +# ========== Group definition for CKGR peripheral ========== +group.CKGR.description="ATMEL CKGR Registers" +group.CKGR.helpkey="ATMEL CKGR Registers" +group.CKGR.register.0=AT91C_CKGR_MOR +group.CKGR.register.1=AT91C_CKGR_PLLR +group.CKGR.register.2=AT91C_CKGR_MCFR +# ========== Group definition for PMC peripheral ========== +group.PMC.description="ATMEL PMC Registers" +group.PMC.helpkey="ATMEL PMC Registers" +group.PMC.register.0=AT91C_PMC_IDR +group.PMC.register.1=AT91C_PMC_MOR +group.PMC.register.2=AT91C_PMC_PLLR +group.PMC.register.3=AT91C_PMC_PCER +group.PMC.register.4=AT91C_PMC_PCKR +group.PMC.register.5=AT91C_PMC_MCKR +group.PMC.register.6=AT91C_PMC_SCDR +group.PMC.register.7=AT91C_PMC_PCDR +group.PMC.register.8=AT91C_PMC_SCSR +group.PMC.register.9=AT91C_PMC_PCSR +group.PMC.register.10=AT91C_PMC_MCFR +group.PMC.register.11=AT91C_PMC_SCER +group.PMC.register.12=AT91C_PMC_IMR +group.PMC.register.13=AT91C_PMC_IER +group.PMC.register.14=AT91C_PMC_SR +# ========== Group definition for RSTC peripheral ========== +group.RSTC.description="ATMEL RSTC Registers" +group.RSTC.helpkey="ATMEL RSTC Registers" +group.RSTC.register.0=AT91C_RSTC_RCR +group.RSTC.register.1=AT91C_RSTC_RMR +group.RSTC.register.2=AT91C_RSTC_RSR +# ========== Group definition for RTTC peripheral ========== +group.RTTC.description="ATMEL RTTC Registers" +group.RTTC.helpkey="ATMEL RTTC Registers" +group.RTTC.register.0=AT91C_RTTC_RTSR +group.RTTC.register.1=AT91C_RTTC_RTMR +group.RTTC.register.2=AT91C_RTTC_RTVR +group.RTTC.register.3=AT91C_RTTC_RTAR +# ========== Group definition for PITC peripheral ========== +group.PITC.description="ATMEL PITC Registers" +group.PITC.helpkey="ATMEL PITC Registers" +group.PITC.register.0=AT91C_PITC_PIVR +group.PITC.register.1=AT91C_PITC_PISR +group.PITC.register.2=AT91C_PITC_PIIR +group.PITC.register.3=AT91C_PITC_PIMR +# ========== Group definition for WDTC peripheral ========== +group.WDTC.description="ATMEL WDTC Registers" +group.WDTC.helpkey="ATMEL WDTC Registers" +group.WDTC.register.0=AT91C_WDTC_WDCR +group.WDTC.register.1=AT91C_WDTC_WDSR +group.WDTC.register.2=AT91C_WDTC_WDMR +# ========== Group definition for VREG peripheral ========== +group.VREG.description="ATMEL VREG Registers" +group.VREG.helpkey="ATMEL VREG Registers" +group.VREG.register.0=AT91C_VREG_MR +# ========== Group definition for MC peripheral ========== +group.MC.description="ATMEL MC Registers" +group.MC.helpkey="ATMEL MC Registers" +group.MC.register.0=AT91C_MC_ASR +group.MC.register.1=AT91C_MC_RCR +group.MC.register.2=AT91C_MC_FCR +group.MC.register.3=AT91C_MC_AASR +group.MC.register.4=AT91C_MC_FSR +group.MC.register.5=AT91C_MC_FMR +# ========== Group definition for PDC_SPI1 peripheral ========== +group.PDC_SPI1.description="ATMEL PDC_SPI1 Registers" +group.PDC_SPI1.helpkey="ATMEL PDC_SPI1 Registers" +group.PDC_SPI1.register.0=AT91C_SPI1_PTCR +group.PDC_SPI1.register.1=AT91C_SPI1_RPR +group.PDC_SPI1.register.2=AT91C_SPI1_TNCR +group.PDC_SPI1.register.3=AT91C_SPI1_TPR +group.PDC_SPI1.register.4=AT91C_SPI1_TNPR +group.PDC_SPI1.register.5=AT91C_SPI1_TCR +group.PDC_SPI1.register.6=AT91C_SPI1_RCR +group.PDC_SPI1.register.7=AT91C_SPI1_RNPR +group.PDC_SPI1.register.8=AT91C_SPI1_RNCR +group.PDC_SPI1.register.9=AT91C_SPI1_PTSR +# ========== Group definition for SPI1 peripheral ========== +group.SPI1.description="ATMEL SPI1 Registers" +group.SPI1.helpkey="ATMEL SPI1 Registers" +group.SPI1.register.0=AT91C_SPI1_IMR +group.SPI1.register.1=AT91C_SPI1_IER +group.SPI1.register.2=AT91C_SPI1_MR +group.SPI1.register.3=AT91C_SPI1_RDR +group.SPI1.register.4=AT91C_SPI1_IDR +group.SPI1.register.5=AT91C_SPI1_SR +group.SPI1.register.6=AT91C_SPI1_TDR +group.SPI1.register.7=AT91C_SPI1_CR +group.SPI1.register.8=AT91C_SPI1_CSR +# ========== Group definition for PDC_SPI0 peripheral ========== +group.PDC_SPI0.description="ATMEL PDC_SPI0 Registers" +group.PDC_SPI0.helpkey="ATMEL PDC_SPI0 Registers" +group.PDC_SPI0.register.0=AT91C_SPI0_PTCR +group.PDC_SPI0.register.1=AT91C_SPI0_TPR +group.PDC_SPI0.register.2=AT91C_SPI0_TCR +group.PDC_SPI0.register.3=AT91C_SPI0_RCR +group.PDC_SPI0.register.4=AT91C_SPI0_PTSR +group.PDC_SPI0.register.5=AT91C_SPI0_RNPR +group.PDC_SPI0.register.6=AT91C_SPI0_RPR +group.PDC_SPI0.register.7=AT91C_SPI0_TNCR +group.PDC_SPI0.register.8=AT91C_SPI0_RNCR +group.PDC_SPI0.register.9=AT91C_SPI0_TNPR +# ========== Group definition for SPI0 peripheral ========== +group.SPI0.description="ATMEL SPI0 Registers" +group.SPI0.helpkey="ATMEL SPI0 Registers" +group.SPI0.register.0=AT91C_SPI0_IER +group.SPI0.register.1=AT91C_SPI0_SR +group.SPI0.register.2=AT91C_SPI0_IDR +group.SPI0.register.3=AT91C_SPI0_CR +group.SPI0.register.4=AT91C_SPI0_MR +group.SPI0.register.5=AT91C_SPI0_IMR +group.SPI0.register.6=AT91C_SPI0_TDR +group.SPI0.register.7=AT91C_SPI0_RDR +group.SPI0.register.8=AT91C_SPI0_CSR +# ========== Group definition for PDC_US1 peripheral ========== +group.PDC_US1.description="ATMEL PDC_US1 Registers" +group.PDC_US1.helpkey="ATMEL PDC_US1 Registers" +group.PDC_US1.register.0=AT91C_US1_RNCR +group.PDC_US1.register.1=AT91C_US1_PTCR +group.PDC_US1.register.2=AT91C_US1_TCR +group.PDC_US1.register.3=AT91C_US1_PTSR +group.PDC_US1.register.4=AT91C_US1_TNPR +group.PDC_US1.register.5=AT91C_US1_RCR +group.PDC_US1.register.6=AT91C_US1_RNPR +group.PDC_US1.register.7=AT91C_US1_RPR +group.PDC_US1.register.8=AT91C_US1_TNCR +group.PDC_US1.register.9=AT91C_US1_TPR +# ========== Group definition for US1 peripheral ========== +group.US1.description="ATMEL US1 Registers" +group.US1.helpkey="ATMEL US1 Registers" +group.US1.register.0=AT91C_US1_IF +group.US1.register.1=AT91C_US1_NER +group.US1.register.2=AT91C_US1_RTOR +group.US1.register.3=AT91C_US1_CSR +group.US1.register.4=AT91C_US1_IDR +group.US1.register.5=AT91C_US1_IER +group.US1.register.6=AT91C_US1_THR +group.US1.register.7=AT91C_US1_TTGR +group.US1.register.8=AT91C_US1_RHR +group.US1.register.9=AT91C_US1_BRGR +group.US1.register.10=AT91C_US1_IMR +group.US1.register.11=AT91C_US1_FIDI +group.US1.register.12=AT91C_US1_CR +group.US1.register.13=AT91C_US1_MR +# ========== Group definition for PDC_US0 peripheral ========== +group.PDC_US0.description="ATMEL PDC_US0 Registers" +group.PDC_US0.helpkey="ATMEL PDC_US0 Registers" +group.PDC_US0.register.0=AT91C_US0_TNPR +group.PDC_US0.register.1=AT91C_US0_RNPR +group.PDC_US0.register.2=AT91C_US0_TCR +group.PDC_US0.register.3=AT91C_US0_PTCR +group.PDC_US0.register.4=AT91C_US0_PTSR +group.PDC_US0.register.5=AT91C_US0_TNCR +group.PDC_US0.register.6=AT91C_US0_TPR +group.PDC_US0.register.7=AT91C_US0_RCR +group.PDC_US0.register.8=AT91C_US0_RPR +group.PDC_US0.register.9=AT91C_US0_RNCR +# ========== Group definition for US0 peripheral ========== +group.US0.description="ATMEL US0 Registers" +group.US0.helpkey="ATMEL US0 Registers" +group.US0.register.0=AT91C_US0_BRGR +group.US0.register.1=AT91C_US0_NER +group.US0.register.2=AT91C_US0_CR +group.US0.register.3=AT91C_US0_IMR +group.US0.register.4=AT91C_US0_FIDI +group.US0.register.5=AT91C_US0_TTGR +group.US0.register.6=AT91C_US0_MR +group.US0.register.7=AT91C_US0_RTOR +group.US0.register.8=AT91C_US0_CSR +group.US0.register.9=AT91C_US0_RHR +group.US0.register.10=AT91C_US0_IDR +group.US0.register.11=AT91C_US0_THR +group.US0.register.12=AT91C_US0_IF +group.US0.register.13=AT91C_US0_IER +# ========== Group definition for PDC_SSC peripheral ========== +group.PDC_SSC.description="ATMEL PDC_SSC Registers" +group.PDC_SSC.helpkey="ATMEL PDC_SSC Registers" +group.PDC_SSC.register.0=AT91C_SSC_TNCR +group.PDC_SSC.register.1=AT91C_SSC_RPR +group.PDC_SSC.register.2=AT91C_SSC_RNCR +group.PDC_SSC.register.3=AT91C_SSC_TPR +group.PDC_SSC.register.4=AT91C_SSC_PTCR +group.PDC_SSC.register.5=AT91C_SSC_TCR +group.PDC_SSC.register.6=AT91C_SSC_RCR +group.PDC_SSC.register.7=AT91C_SSC_RNPR +group.PDC_SSC.register.8=AT91C_SSC_TNPR +group.PDC_SSC.register.9=AT91C_SSC_PTSR +# ========== Group definition for SSC peripheral ========== +group.SSC.description="ATMEL SSC Registers" +group.SSC.helpkey="ATMEL SSC Registers" +group.SSC.register.0=AT91C_SSC_RHR +group.SSC.register.1=AT91C_SSC_RSHR +group.SSC.register.2=AT91C_SSC_TFMR +group.SSC.register.3=AT91C_SSC_IDR +group.SSC.register.4=AT91C_SSC_THR +group.SSC.register.5=AT91C_SSC_RCMR +group.SSC.register.6=AT91C_SSC_IER +group.SSC.register.7=AT91C_SSC_TSHR +group.SSC.register.8=AT91C_SSC_SR +group.SSC.register.9=AT91C_SSC_CMR +group.SSC.register.10=AT91C_SSC_TCMR +group.SSC.register.11=AT91C_SSC_CR +group.SSC.register.12=AT91C_SSC_IMR +group.SSC.register.13=AT91C_SSC_RFMR +# ========== Group definition for TWI peripheral ========== +group.TWI.description="ATMEL TWI Registers" +group.TWI.helpkey="ATMEL TWI Registers" +group.TWI.register.0=AT91C_TWI_IER +group.TWI.register.1=AT91C_TWI_CR +group.TWI.register.2=AT91C_TWI_SR +group.TWI.register.3=AT91C_TWI_IMR +group.TWI.register.4=AT91C_TWI_THR +group.TWI.register.5=AT91C_TWI_IDR +group.TWI.register.6=AT91C_TWI_IADR +group.TWI.register.7=AT91C_TWI_MMR +group.TWI.register.8=AT91C_TWI_CWGR +group.TWI.register.9=AT91C_TWI_RHR +# ========== Group definition for PWMC_CH3 peripheral ========== +group.PWMC_CH3.description="ATMEL PWMC_CH3 Registers" +group.PWMC_CH3.helpkey="ATMEL PWMC_CH3 Registers" +group.PWMC_CH3.register.0=AT91C_PWMC_CH3_CUPDR +group.PWMC_CH3.register.1=AT91C_PWMC_CH3_Reserved +group.PWMC_CH3.register.2=AT91C_PWMC_CH3_CPRDR +group.PWMC_CH3.register.3=AT91C_PWMC_CH3_CDTYR +group.PWMC_CH3.register.4=AT91C_PWMC_CH3_CCNTR +group.PWMC_CH3.register.5=AT91C_PWMC_CH3_CMR +# ========== Group definition for PWMC_CH2 peripheral ========== +group.PWMC_CH2.description="ATMEL PWMC_CH2 Registers" +group.PWMC_CH2.helpkey="ATMEL PWMC_CH2 Registers" +group.PWMC_CH2.register.0=AT91C_PWMC_CH2_Reserved +group.PWMC_CH2.register.1=AT91C_PWMC_CH2_CMR +group.PWMC_CH2.register.2=AT91C_PWMC_CH2_CCNTR +group.PWMC_CH2.register.3=AT91C_PWMC_CH2_CPRDR +group.PWMC_CH2.register.4=AT91C_PWMC_CH2_CUPDR +group.PWMC_CH2.register.5=AT91C_PWMC_CH2_CDTYR +# ========== Group definition for PWMC_CH1 peripheral ========== +group.PWMC_CH1.description="ATMEL PWMC_CH1 Registers" +group.PWMC_CH1.helpkey="ATMEL PWMC_CH1 Registers" +group.PWMC_CH1.register.0=AT91C_PWMC_CH1_Reserved +group.PWMC_CH1.register.1=AT91C_PWMC_CH1_CUPDR +group.PWMC_CH1.register.2=AT91C_PWMC_CH1_CPRDR +group.PWMC_CH1.register.3=AT91C_PWMC_CH1_CCNTR +group.PWMC_CH1.register.4=AT91C_PWMC_CH1_CDTYR +group.PWMC_CH1.register.5=AT91C_PWMC_CH1_CMR +# ========== Group definition for PWMC_CH0 peripheral ========== +group.PWMC_CH0.description="ATMEL PWMC_CH0 Registers" +group.PWMC_CH0.helpkey="ATMEL PWMC_CH0 Registers" +group.PWMC_CH0.register.0=AT91C_PWMC_CH0_Reserved +group.PWMC_CH0.register.1=AT91C_PWMC_CH0_CPRDR +group.PWMC_CH0.register.2=AT91C_PWMC_CH0_CDTYR +group.PWMC_CH0.register.3=AT91C_PWMC_CH0_CMR +group.PWMC_CH0.register.4=AT91C_PWMC_CH0_CUPDR +group.PWMC_CH0.register.5=AT91C_PWMC_CH0_CCNTR +# ========== Group definition for PWMC peripheral ========== +group.PWMC.description="ATMEL PWMC Registers" +group.PWMC.helpkey="ATMEL PWMC Registers" +group.PWMC.register.0=AT91C_PWMC_IDR +group.PWMC.register.1=AT91C_PWMC_DIS +group.PWMC.register.2=AT91C_PWMC_IER +group.PWMC.register.3=AT91C_PWMC_VR +group.PWMC.register.4=AT91C_PWMC_ISR +group.PWMC.register.5=AT91C_PWMC_SR +group.PWMC.register.6=AT91C_PWMC_IMR +group.PWMC.register.7=AT91C_PWMC_MR +group.PWMC.register.8=AT91C_PWMC_ENA +# ========== Group definition for UDP peripheral ========== +group.UDP.description="ATMEL UDP Registers" +group.UDP.helpkey="ATMEL UDP Registers" +group.UDP.register.0=AT91C_UDP_IMR +group.UDP.register.1=AT91C_UDP_FADDR +group.UDP.register.2=AT91C_UDP_NUM +group.UDP.register.3=AT91C_UDP_FDR +group.UDP.register.4=AT91C_UDP_ISR +group.UDP.register.5=AT91C_UDP_CSR +group.UDP.register.6=AT91C_UDP_IDR +group.UDP.register.7=AT91C_UDP_ICR +group.UDP.register.8=AT91C_UDP_RSTEP +group.UDP.register.9=AT91C_UDP_TXVC +group.UDP.register.10=AT91C_UDP_GLBSTATE +group.UDP.register.11=AT91C_UDP_IER +# ========== Group definition for TC0 peripheral ========== +group.TC0.description="ATMEL TC0 Registers" +group.TC0.helpkey="ATMEL TC0 Registers" +group.TC0.register.0=AT91C_TC0_SR +group.TC0.register.1=AT91C_TC0_RC +group.TC0.register.2=AT91C_TC0_RB +group.TC0.register.3=AT91C_TC0_CCR +group.TC0.register.4=AT91C_TC0_CMR +group.TC0.register.5=AT91C_TC0_IER +group.TC0.register.6=AT91C_TC0_RA +group.TC0.register.7=AT91C_TC0_IDR +group.TC0.register.8=AT91C_TC0_CV +group.TC0.register.9=AT91C_TC0_IMR +# ========== Group definition for TC1 peripheral ========== +group.TC1.description="ATMEL TC1 Registers" +group.TC1.helpkey="ATMEL TC1 Registers" +group.TC1.register.0=AT91C_TC1_RB +group.TC1.register.1=AT91C_TC1_CCR +group.TC1.register.2=AT91C_TC1_IER +group.TC1.register.3=AT91C_TC1_IDR +group.TC1.register.4=AT91C_TC1_SR +group.TC1.register.5=AT91C_TC1_CMR +group.TC1.register.6=AT91C_TC1_RA +group.TC1.register.7=AT91C_TC1_RC +group.TC1.register.8=AT91C_TC1_IMR +group.TC1.register.9=AT91C_TC1_CV +# ========== Group definition for TC2 peripheral ========== +group.TC2.description="ATMEL TC2 Registers" +group.TC2.helpkey="ATMEL TC2 Registers" +group.TC2.register.0=AT91C_TC2_CMR +group.TC2.register.1=AT91C_TC2_CCR +group.TC2.register.2=AT91C_TC2_CV +group.TC2.register.3=AT91C_TC2_RA +group.TC2.register.4=AT91C_TC2_RB +group.TC2.register.5=AT91C_TC2_IDR +group.TC2.register.6=AT91C_TC2_IMR +group.TC2.register.7=AT91C_TC2_RC +group.TC2.register.8=AT91C_TC2_IER +group.TC2.register.9=AT91C_TC2_SR +# ========== Group definition for TCB peripheral ========== +group.TCB.description="ATMEL TCB Registers" +group.TCB.helpkey="ATMEL TCB Registers" +group.TCB.register.0=AT91C_TCB_BMR +group.TCB.register.1=AT91C_TCB_BCR +# ========== Group definition for CAN_MB0 peripheral ========== +group.CAN_MB0.description="ATMEL CAN_MB0 Registers" +group.CAN_MB0.helpkey="ATMEL CAN_MB0 Registers" +group.CAN_MB0.register.0=AT91C_CAN_MB0_MDL +group.CAN_MB0.register.1=AT91C_CAN_MB0_MAM +group.CAN_MB0.register.2=AT91C_CAN_MB0_MCR +group.CAN_MB0.register.3=AT91C_CAN_MB0_MID +group.CAN_MB0.register.4=AT91C_CAN_MB0_MSR +group.CAN_MB0.register.5=AT91C_CAN_MB0_MFID +group.CAN_MB0.register.6=AT91C_CAN_MB0_MDH +group.CAN_MB0.register.7=AT91C_CAN_MB0_MMR +# ========== Group definition for CAN_MB1 peripheral ========== +group.CAN_MB1.description="ATMEL CAN_MB1 Registers" +group.CAN_MB1.helpkey="ATMEL CAN_MB1 Registers" +group.CAN_MB1.register.0=AT91C_CAN_MB1_MDL +group.CAN_MB1.register.1=AT91C_CAN_MB1_MID +group.CAN_MB1.register.2=AT91C_CAN_MB1_MMR +group.CAN_MB1.register.3=AT91C_CAN_MB1_MSR +group.CAN_MB1.register.4=AT91C_CAN_MB1_MAM +group.CAN_MB1.register.5=AT91C_CAN_MB1_MDH +group.CAN_MB1.register.6=AT91C_CAN_MB1_MCR +group.CAN_MB1.register.7=AT91C_CAN_MB1_MFID +# ========== Group definition for CAN_MB2 peripheral ========== +group.CAN_MB2.description="ATMEL CAN_MB2 Registers" +group.CAN_MB2.helpkey="ATMEL CAN_MB2 Registers" +group.CAN_MB2.register.0=AT91C_CAN_MB2_MCR +group.CAN_MB2.register.1=AT91C_CAN_MB2_MDH +group.CAN_MB2.register.2=AT91C_CAN_MB2_MID +group.CAN_MB2.register.3=AT91C_CAN_MB2_MDL +group.CAN_MB2.register.4=AT91C_CAN_MB2_MMR +group.CAN_MB2.register.5=AT91C_CAN_MB2_MAM +group.CAN_MB2.register.6=AT91C_CAN_MB2_MFID +group.CAN_MB2.register.7=AT91C_CAN_MB2_MSR +# ========== Group definition for CAN_MB3 peripheral ========== +group.CAN_MB3.description="ATMEL CAN_MB3 Registers" +group.CAN_MB3.helpkey="ATMEL CAN_MB3 Registers" +group.CAN_MB3.register.0=AT91C_CAN_MB3_MFID +group.CAN_MB3.register.1=AT91C_CAN_MB3_MAM +group.CAN_MB3.register.2=AT91C_CAN_MB3_MID +group.CAN_MB3.register.3=AT91C_CAN_MB3_MCR +group.CAN_MB3.register.4=AT91C_CAN_MB3_MMR +group.CAN_MB3.register.5=AT91C_CAN_MB3_MSR +group.CAN_MB3.register.6=AT91C_CAN_MB3_MDL +group.CAN_MB3.register.7=AT91C_CAN_MB3_MDH +# ========== Group definition for CAN_MB4 peripheral ========== +group.CAN_MB4.description="ATMEL CAN_MB4 Registers" +group.CAN_MB4.helpkey="ATMEL CAN_MB4 Registers" +group.CAN_MB4.register.0=AT91C_CAN_MB4_MID +group.CAN_MB4.register.1=AT91C_CAN_MB4_MMR +group.CAN_MB4.register.2=AT91C_CAN_MB4_MDH +group.CAN_MB4.register.3=AT91C_CAN_MB4_MFID +group.CAN_MB4.register.4=AT91C_CAN_MB4_MSR +group.CAN_MB4.register.5=AT91C_CAN_MB4_MCR +group.CAN_MB4.register.6=AT91C_CAN_MB4_MDL +group.CAN_MB4.register.7=AT91C_CAN_MB4_MAM +# ========== Group definition for CAN_MB5 peripheral ========== +group.CAN_MB5.description="ATMEL CAN_MB5 Registers" +group.CAN_MB5.helpkey="ATMEL CAN_MB5 Registers" +group.CAN_MB5.register.0=AT91C_CAN_MB5_MSR +group.CAN_MB5.register.1=AT91C_CAN_MB5_MCR +group.CAN_MB5.register.2=AT91C_CAN_MB5_MFID +group.CAN_MB5.register.3=AT91C_CAN_MB5_MDH +group.CAN_MB5.register.4=AT91C_CAN_MB5_MID +group.CAN_MB5.register.5=AT91C_CAN_MB5_MMR +group.CAN_MB5.register.6=AT91C_CAN_MB5_MDL +group.CAN_MB5.register.7=AT91C_CAN_MB5_MAM +# ========== Group definition for CAN_MB6 peripheral ========== +group.CAN_MB6.description="ATMEL CAN_MB6 Registers" +group.CAN_MB6.helpkey="ATMEL CAN_MB6 Registers" +group.CAN_MB6.register.0=AT91C_CAN_MB6_MFID +group.CAN_MB6.register.1=AT91C_CAN_MB6_MID +group.CAN_MB6.register.2=AT91C_CAN_MB6_MAM +group.CAN_MB6.register.3=AT91C_CAN_MB6_MSR +group.CAN_MB6.register.4=AT91C_CAN_MB6_MDL +group.CAN_MB6.register.5=AT91C_CAN_MB6_MCR +group.CAN_MB6.register.6=AT91C_CAN_MB6_MDH +group.CAN_MB6.register.7=AT91C_CAN_MB6_MMR +# ========== Group definition for CAN_MB7 peripheral ========== +group.CAN_MB7.description="ATMEL CAN_MB7 Registers" +group.CAN_MB7.helpkey="ATMEL CAN_MB7 Registers" +group.CAN_MB7.register.0=AT91C_CAN_MB7_MCR +group.CAN_MB7.register.1=AT91C_CAN_MB7_MDH +group.CAN_MB7.register.2=AT91C_CAN_MB7_MFID +group.CAN_MB7.register.3=AT91C_CAN_MB7_MDL +group.CAN_MB7.register.4=AT91C_CAN_MB7_MID +group.CAN_MB7.register.5=AT91C_CAN_MB7_MMR +group.CAN_MB7.register.6=AT91C_CAN_MB7_MAM +group.CAN_MB7.register.7=AT91C_CAN_MB7_MSR +# ========== Group definition for CAN peripheral ========== +group.CAN.description="ATMEL CAN Registers" +group.CAN.helpkey="ATMEL CAN Registers" +group.CAN.register.0=AT91C_CAN_TCR +group.CAN.register.1=AT91C_CAN_IMR +group.CAN.register.2=AT91C_CAN_IER +group.CAN.register.3=AT91C_CAN_ECR +group.CAN.register.4=AT91C_CAN_TIMESTP +group.CAN.register.5=AT91C_CAN_MR +group.CAN.register.6=AT91C_CAN_IDR +group.CAN.register.7=AT91C_CAN_ACR +group.CAN.register.8=AT91C_CAN_TIM +group.CAN.register.9=AT91C_CAN_SR +group.CAN.register.10=AT91C_CAN_BR +group.CAN.register.11=AT91C_CAN_VR +# ========== Group definition for EMAC peripheral ========== +group.EMAC.description="ATMEL EMAC Registers" +group.EMAC.helpkey="ATMEL EMAC Registers" +group.EMAC.register.0=AT91C_EMAC_ISR +group.EMAC.register.1=AT91C_EMAC_SA4H +group.EMAC.register.2=AT91C_EMAC_SA1L +group.EMAC.register.3=AT91C_EMAC_ELE +group.EMAC.register.4=AT91C_EMAC_LCOL +group.EMAC.register.5=AT91C_EMAC_RLE +group.EMAC.register.6=AT91C_EMAC_WOL +group.EMAC.register.7=AT91C_EMAC_DTF +group.EMAC.register.8=AT91C_EMAC_TUND +group.EMAC.register.9=AT91C_EMAC_NCR +group.EMAC.register.10=AT91C_EMAC_SA4L +group.EMAC.register.11=AT91C_EMAC_RSR +group.EMAC.register.12=AT91C_EMAC_SA3L +group.EMAC.register.13=AT91C_EMAC_TSR +group.EMAC.register.14=AT91C_EMAC_IDR +group.EMAC.register.15=AT91C_EMAC_RSE +group.EMAC.register.16=AT91C_EMAC_ECOL +group.EMAC.register.17=AT91C_EMAC_TID +group.EMAC.register.18=AT91C_EMAC_HRB +group.EMAC.register.19=AT91C_EMAC_TBQP +group.EMAC.register.20=AT91C_EMAC_USRIO +group.EMAC.register.21=AT91C_EMAC_PTR +group.EMAC.register.22=AT91C_EMAC_SA2H +group.EMAC.register.23=AT91C_EMAC_ROV +group.EMAC.register.24=AT91C_EMAC_ALE +group.EMAC.register.25=AT91C_EMAC_RJA +group.EMAC.register.26=AT91C_EMAC_RBQP +group.EMAC.register.27=AT91C_EMAC_TPF +group.EMAC.register.28=AT91C_EMAC_NCFGR +group.EMAC.register.29=AT91C_EMAC_HRT +group.EMAC.register.30=AT91C_EMAC_USF +group.EMAC.register.31=AT91C_EMAC_FCSE +group.EMAC.register.32=AT91C_EMAC_TPQ +group.EMAC.register.33=AT91C_EMAC_MAN +group.EMAC.register.34=AT91C_EMAC_FTO +group.EMAC.register.35=AT91C_EMAC_REV +group.EMAC.register.36=AT91C_EMAC_IMR +group.EMAC.register.37=AT91C_EMAC_SCF +group.EMAC.register.38=AT91C_EMAC_PFR +group.EMAC.register.39=AT91C_EMAC_MCF +group.EMAC.register.40=AT91C_EMAC_NSR +group.EMAC.register.41=AT91C_EMAC_SA2L +group.EMAC.register.42=AT91C_EMAC_FRO +group.EMAC.register.43=AT91C_EMAC_IER +group.EMAC.register.44=AT91C_EMAC_SA1H +group.EMAC.register.45=AT91C_EMAC_CSE +group.EMAC.register.46=AT91C_EMAC_SA3H +group.EMAC.register.47=AT91C_EMAC_RRE +group.EMAC.register.48=AT91C_EMAC_STE +# ========== Group definition for PDC_ADC peripheral ========== +group.PDC_ADC.description="ATMEL PDC_ADC Registers" +group.PDC_ADC.helpkey="ATMEL PDC_ADC Registers" +group.PDC_ADC.register.0=AT91C_ADC_PTSR +group.PDC_ADC.register.1=AT91C_ADC_PTCR +group.PDC_ADC.register.2=AT91C_ADC_TNPR +group.PDC_ADC.register.3=AT91C_ADC_TNCR +group.PDC_ADC.register.4=AT91C_ADC_RNPR +group.PDC_ADC.register.5=AT91C_ADC_RNCR +group.PDC_ADC.register.6=AT91C_ADC_RPR +group.PDC_ADC.register.7=AT91C_ADC_TCR +group.PDC_ADC.register.8=AT91C_ADC_TPR +group.PDC_ADC.register.9=AT91C_ADC_RCR +# ========== Group definition for ADC peripheral ========== +group.ADC.description="ATMEL ADC Registers" +group.ADC.helpkey="ATMEL ADC Registers" +group.ADC.register.0=AT91C_ADC_CDR2 +group.ADC.register.1=AT91C_ADC_CDR3 +group.ADC.register.2=AT91C_ADC_CDR0 +group.ADC.register.3=AT91C_ADC_CDR5 +group.ADC.register.4=AT91C_ADC_CHDR +group.ADC.register.5=AT91C_ADC_SR +group.ADC.register.6=AT91C_ADC_CDR4 +group.ADC.register.7=AT91C_ADC_CDR1 +group.ADC.register.8=AT91C_ADC_LCDR +group.ADC.register.9=AT91C_ADC_IDR +group.ADC.register.10=AT91C_ADC_CR +group.ADC.register.11=AT91C_ADC_CDR7 +group.ADC.register.12=AT91C_ADC_CDR6 +group.ADC.register.13=AT91C_ADC_IER +group.ADC.register.14=AT91C_ADC_CHER +group.ADC.register.15=AT91C_ADC_CHSR +group.ADC.register.16=AT91C_ADC_MR +group.ADC.register.17=AT91C_ADC_IMR +group.AT91SAM7X256.description="ATMEL AT91SAM7X256 Registers" +group.AT91SAM7X256.helpkey="ATMEL AT91SAM7X256 Registers" +group.AT91SAM7X256.topLevelIndex=100 +group.AT91SAM7X256.group.0=SYS +group.AT91SAM7X256.group.1=AIC +group.AT91SAM7X256.group.2=PDC_DBGU +group.AT91SAM7X256.group.3=DBGU +group.AT91SAM7X256.group.4=PIOA +group.AT91SAM7X256.group.5=PIOB +group.AT91SAM7X256.group.6=CKGR +group.AT91SAM7X256.group.7=PMC +group.AT91SAM7X256.group.8=RSTC +group.AT91SAM7X256.group.9=RTTC +group.AT91SAM7X256.group.10=PITC +group.AT91SAM7X256.group.11=WDTC +group.AT91SAM7X256.group.12=VREG +group.AT91SAM7X256.group.13=MC +group.AT91SAM7X256.group.14=PDC_SPI1 +group.AT91SAM7X256.group.15=SPI1 +group.AT91SAM7X256.group.16=PDC_SPI0 +group.AT91SAM7X256.group.17=SPI0 +group.AT91SAM7X256.group.18=PDC_US1 +group.AT91SAM7X256.group.19=US1 +group.AT91SAM7X256.group.20=PDC_US0 +group.AT91SAM7X256.group.21=US0 +group.AT91SAM7X256.group.22=PDC_SSC +group.AT91SAM7X256.group.23=SSC +group.AT91SAM7X256.group.24=TWI +group.AT91SAM7X256.group.25=PWMC_CH3 +group.AT91SAM7X256.group.26=PWMC_CH2 +group.AT91SAM7X256.group.27=PWMC_CH1 +group.AT91SAM7X256.group.28=PWMC_CH0 +group.AT91SAM7X256.group.29=PWMC +group.AT91SAM7X256.group.30=UDP +group.AT91SAM7X256.group.31=TC0 +group.AT91SAM7X256.group.32=TC1 +group.AT91SAM7X256.group.33=TC2 +group.AT91SAM7X256.group.34=TCB +group.AT91SAM7X256.group.35=CAN_MB0 +group.AT91SAM7X256.group.36=CAN_MB1 +group.AT91SAM7X256.group.37=CAN_MB2 +group.AT91SAM7X256.group.38=CAN_MB3 +group.AT91SAM7X256.group.39=CAN_MB4 +group.AT91SAM7X256.group.40=CAN_MB5 +group.AT91SAM7X256.group.41=CAN_MB6 +group.AT91SAM7X256.group.42=CAN_MB7 +group.AT91SAM7X256.group.43=CAN +group.AT91SAM7X256.group.44=EMAC +group.AT91SAM7X256.group.45=PDC_ADC +group.AT91SAM7X256.group.46=ADC diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.tcl b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.tcl new file mode 100644 index 0000000..5d3a662 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.tcl @@ -0,0 +1,3407 @@ +# ---------------------------------------------------------------------------- +# ATMEL Microcontroller Software Support - ROUSSET - +# ---------------------------------------------------------------------------- +# DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +# DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ---------------------------------------------------------------------------- +# File Name : AT91SAM7X256.tcl +# Object : AT91SAM7X256 definitions +# Generated : AT91 SW Application Group 11/02/2005 (15:17:30) +# +# CVS Reference : /AT91SAM7X256.pl/1.14/Tue Sep 13 15:06:52 2005// +# CVS Reference : /SYS_SAM7X.pl/1.3/Tue Feb 1 17:01:43 2005// +# CVS Reference : /MC_SAM7X.pl/1.2/Fri May 20 14:13:04 2005// +# CVS Reference : /PMC_SAM7X.pl/1.4/Tue Feb 8 13:58:10 2005// +# CVS Reference : /RSTC_SAM7X.pl/1.2/Wed Jul 13 14:57:50 2005// +# CVS Reference : /UDP_SAM7X.pl/1.1/Tue May 10 11:35:35 2005// +# CVS Reference : /PWM_SAM7X.pl/1.1/Tue May 10 11:53:07 2005// +# CVS Reference : /AIC_6075B.pl/1.3/Fri May 20 14:01:30 2005// +# CVS Reference : /PIO_6057A.pl/1.2/Thu Feb 3 10:18:28 2005// +# CVS Reference : /RTTC_6081A.pl/1.2/Tue Nov 9 14:43:58 2004// +# CVS Reference : /PITC_6079A.pl/1.2/Tue Nov 9 14:43:56 2004// +# CVS Reference : /WDTC_6080A.pl/1.3/Tue Nov 9 14:44:00 2004// +# CVS Reference : /VREG_6085B.pl/1.1/Tue Feb 1 16:05:48 2005// +# CVS Reference : /PDC_6074C.pl/1.2/Thu Feb 3 08:48:54 2005// +# CVS Reference : /DBGU_6059D.pl/1.1/Mon Jan 31 13:15:32 2005// +# CVS Reference : /SPI_6088D.pl/1.3/Fri May 20 14:08:59 2005// +# CVS Reference : /US_6089C.pl/1.1/Mon Jul 12 18:23:26 2004// +# CVS Reference : /SSC_6078B.pl/1.1/Wed Jul 13 15:19:19 2005// +# CVS Reference : /TWI_6061A.pl/1.1/Tue Jul 13 07:38:06 2004// +# CVS Reference : /TC_6082A.pl/1.7/Fri Mar 11 12:52:17 2005// +# CVS Reference : /CAN_6019B.pl/1.1/Tue Mar 8 12:42:22 2005// +# CVS Reference : /EMACB_6119A.pl/1.6/Wed Jul 13 15:05:35 2005// +# CVS Reference : /ADC_6051C.pl/1.1/Fri Oct 17 09:12:38 2003// +# ---------------------------------------------------------------------------- + + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR System Peripherals +# ***************************************************************************** + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Advanced Interrupt Controller +# ***************************************************************************** +# -------- AIC_SMR : (AIC Offset: 0x0) Control Register -------- +set AT91C_AIC_PRIOR [expr 0x7 << 0 ] +set AT91C_AIC_PRIOR_LOWEST 0x0 +set AT91C_AIC_PRIOR_HIGHEST 0x7 +set AT91C_AIC_SRCTYPE [expr 0x3 << 5 ] +set AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL [expr 0x0 << 5 ] +set AT91C_AIC_SRCTYPE_EXT_LOW_LEVEL [expr 0x0 << 5 ] +set AT91C_AIC_SRCTYPE_INT_POSITIVE_EDGE [expr 0x1 << 5 ] +set AT91C_AIC_SRCTYPE_EXT_NEGATIVE_EDGE [expr 0x1 << 5 ] +set AT91C_AIC_SRCTYPE_HIGH_LEVEL [expr 0x2 << 5 ] +set AT91C_AIC_SRCTYPE_POSITIVE_EDGE [expr 0x3 << 5 ] +# -------- AIC_CISR : (AIC Offset: 0x114) AIC Core Interrupt Status Register -------- +set AT91C_AIC_NFIQ [expr 0x1 << 0 ] +set AT91C_AIC_NIRQ [expr 0x1 << 1 ] +# -------- AIC_DCR : (AIC Offset: 0x138) AIC Debug Control Register (Protect) -------- +set AT91C_AIC_DCR_PROT [expr 0x1 << 0 ] +set AT91C_AIC_DCR_GMSK [expr 0x1 << 1 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Peripheral DMA Controller +# ***************************************************************************** +# -------- PDC_PTCR : (PDC Offset: 0x20) PDC Transfer Control Register -------- +set AT91C_PDC_RXTEN [expr 0x1 << 0 ] +set AT91C_PDC_RXTDIS [expr 0x1 << 1 ] +set AT91C_PDC_TXTEN [expr 0x1 << 8 ] +set AT91C_PDC_TXTDIS [expr 0x1 << 9 ] +# -------- PDC_PTSR : (PDC Offset: 0x24) PDC Transfer Status Register -------- +set AT91C_PDC_RXTEN [expr 0x1 << 0 ] +set AT91C_PDC_TXTEN [expr 0x1 << 8 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Debug Unit +# ***************************************************************************** +# -------- DBGU_CR : (DBGU Offset: 0x0) Debug Unit Control Register -------- +set AT91C_US_RSTRX [expr 0x1 << 2 ] +set AT91C_US_RSTTX [expr 0x1 << 3 ] +set AT91C_US_RXEN [expr 0x1 << 4 ] +set AT91C_US_RXDIS [expr 0x1 << 5 ] +set AT91C_US_TXEN [expr 0x1 << 6 ] +set AT91C_US_TXDIS [expr 0x1 << 7 ] +set AT91C_US_RSTSTA [expr 0x1 << 8 ] +# -------- DBGU_MR : (DBGU Offset: 0x4) Debug Unit Mode Register -------- +set AT91C_US_PAR [expr 0x7 << 9 ] +set AT91C_US_PAR_EVEN [expr 0x0 << 9 ] +set AT91C_US_PAR_ODD [expr 0x1 << 9 ] +set AT91C_US_PAR_SPACE [expr 0x2 << 9 ] +set AT91C_US_PAR_MARK [expr 0x3 << 9 ] +set AT91C_US_PAR_NONE [expr 0x4 << 9 ] +set AT91C_US_PAR_MULTI_DROP [expr 0x6 << 9 ] +set AT91C_US_CHMODE [expr 0x3 << 14 ] +set AT91C_US_CHMODE_NORMAL [expr 0x0 << 14 ] +set AT91C_US_CHMODE_AUTO [expr 0x1 << 14 ] +set AT91C_US_CHMODE_LOCAL [expr 0x2 << 14 ] +set AT91C_US_CHMODE_REMOTE [expr 0x3 << 14 ] +# -------- DBGU_IER : (DBGU Offset: 0x8) Debug Unit Interrupt Enable Register -------- +set AT91C_US_RXRDY [expr 0x1 << 0 ] +set AT91C_US_TXRDY [expr 0x1 << 1 ] +set AT91C_US_ENDRX [expr 0x1 << 3 ] +set AT91C_US_ENDTX [expr 0x1 << 4 ] +set AT91C_US_OVRE [expr 0x1 << 5 ] +set AT91C_US_FRAME [expr 0x1 << 6 ] +set AT91C_US_PARE [expr 0x1 << 7 ] +set AT91C_US_TXEMPTY [expr 0x1 << 9 ] +set AT91C_US_TXBUFE [expr 0x1 << 11 ] +set AT91C_US_RXBUFF [expr 0x1 << 12 ] +set AT91C_US_COMM_TX [expr 0x1 << 30 ] +set AT91C_US_COMM_RX [expr 0x1 << 31 ] +# -------- DBGU_IDR : (DBGU Offset: 0xc) Debug Unit Interrupt Disable Register -------- +set AT91C_US_RXRDY [expr 0x1 << 0 ] +set AT91C_US_TXRDY [expr 0x1 << 1 ] +set AT91C_US_ENDRX [expr 0x1 << 3 ] +set AT91C_US_ENDTX [expr 0x1 << 4 ] +set AT91C_US_OVRE [expr 0x1 << 5 ] +set AT91C_US_FRAME [expr 0x1 << 6 ] +set AT91C_US_PARE [expr 0x1 << 7 ] +set AT91C_US_TXEMPTY [expr 0x1 << 9 ] +set AT91C_US_TXBUFE [expr 0x1 << 11 ] +set AT91C_US_RXBUFF [expr 0x1 << 12 ] +set AT91C_US_COMM_TX [expr 0x1 << 30 ] +set AT91C_US_COMM_RX [expr 0x1 << 31 ] +# -------- DBGU_IMR : (DBGU Offset: 0x10) Debug Unit Interrupt Mask Register -------- +set AT91C_US_RXRDY [expr 0x1 << 0 ] +set AT91C_US_TXRDY [expr 0x1 << 1 ] +set AT91C_US_ENDRX [expr 0x1 << 3 ] +set AT91C_US_ENDTX [expr 0x1 << 4 ] +set AT91C_US_OVRE [expr 0x1 << 5 ] +set AT91C_US_FRAME [expr 0x1 << 6 ] +set AT91C_US_PARE [expr 0x1 << 7 ] +set AT91C_US_TXEMPTY [expr 0x1 << 9 ] +set AT91C_US_TXBUFE [expr 0x1 << 11 ] +set AT91C_US_RXBUFF [expr 0x1 << 12 ] +set AT91C_US_COMM_TX [expr 0x1 << 30 ] +set AT91C_US_COMM_RX [expr 0x1 << 31 ] +# -------- DBGU_CSR : (DBGU Offset: 0x14) Debug Unit Channel Status Register -------- +set AT91C_US_RXRDY [expr 0x1 << 0 ] +set AT91C_US_TXRDY [expr 0x1 << 1 ] +set AT91C_US_ENDRX [expr 0x1 << 3 ] +set AT91C_US_ENDTX [expr 0x1 << 4 ] +set AT91C_US_OVRE [expr 0x1 << 5 ] +set AT91C_US_FRAME [expr 0x1 << 6 ] +set AT91C_US_PARE [expr 0x1 << 7 ] +set AT91C_US_TXEMPTY [expr 0x1 << 9 ] +set AT91C_US_TXBUFE [expr 0x1 << 11 ] +set AT91C_US_RXBUFF [expr 0x1 << 12 ] +set AT91C_US_COMM_TX [expr 0x1 << 30 ] +set AT91C_US_COMM_RX [expr 0x1 << 31 ] +# -------- DBGU_FNTR : (DBGU Offset: 0x48) Debug Unit FORCE_NTRST Register -------- +set AT91C_US_FORCE_NTRST [expr 0x1 << 0 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Parallel Input Output Controler +# ***************************************************************************** + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Clock Generator Controler +# ***************************************************************************** +# -------- CKGR_MOR : (CKGR Offset: 0x0) Main Oscillator Register -------- +set AT91C_CKGR_MOSCEN [expr 0x1 << 0 ] +set AT91C_CKGR_OSCBYPASS [expr 0x1 << 1 ] +set AT91C_CKGR_OSCOUNT [expr 0xFF << 8 ] +# -------- CKGR_MCFR : (CKGR Offset: 0x4) Main Clock Frequency Register -------- +set AT91C_CKGR_MAINF [expr 0xFFFF << 0 ] +set AT91C_CKGR_MAINRDY [expr 0x1 << 16 ] +# -------- CKGR_PLLR : (CKGR Offset: 0xc) PLL B Register -------- +set AT91C_CKGR_DIV [expr 0xFF << 0 ] +set AT91C_CKGR_DIV_0 0x0 +set AT91C_CKGR_DIV_BYPASS 0x1 +set AT91C_CKGR_PLLCOUNT [expr 0x3F << 8 ] +set AT91C_CKGR_OUT [expr 0x3 << 14 ] +set AT91C_CKGR_OUT_0 [expr 0x0 << 14 ] +set AT91C_CKGR_OUT_1 [expr 0x1 << 14 ] +set AT91C_CKGR_OUT_2 [expr 0x2 << 14 ] +set AT91C_CKGR_OUT_3 [expr 0x3 << 14 ] +set AT91C_CKGR_MUL [expr 0x7FF << 16 ] +set AT91C_CKGR_USBDIV [expr 0x3 << 28 ] +set AT91C_CKGR_USBDIV_0 [expr 0x0 << 28 ] +set AT91C_CKGR_USBDIV_1 [expr 0x1 << 28 ] +set AT91C_CKGR_USBDIV_2 [expr 0x2 << 28 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Power Management Controler +# ***************************************************************************** +# -------- PMC_SCER : (PMC Offset: 0x0) System Clock Enable Register -------- +set AT91C_PMC_PCK [expr 0x1 << 0 ] +set AT91C_PMC_UDP [expr 0x1 << 7 ] +set AT91C_PMC_PCK0 [expr 0x1 << 8 ] +set AT91C_PMC_PCK1 [expr 0x1 << 9 ] +set AT91C_PMC_PCK2 [expr 0x1 << 10 ] +set AT91C_PMC_PCK3 [expr 0x1 << 11 ] +# -------- PMC_SCDR : (PMC Offset: 0x4) System Clock Disable Register -------- +set AT91C_PMC_PCK [expr 0x1 << 0 ] +set AT91C_PMC_UDP [expr 0x1 << 7 ] +set AT91C_PMC_PCK0 [expr 0x1 << 8 ] +set AT91C_PMC_PCK1 [expr 0x1 << 9 ] +set AT91C_PMC_PCK2 [expr 0x1 << 10 ] +set AT91C_PMC_PCK3 [expr 0x1 << 11 ] +# -------- PMC_SCSR : (PMC Offset: 0x8) System Clock Status Register -------- +set AT91C_PMC_PCK [expr 0x1 << 0 ] +set AT91C_PMC_UDP [expr 0x1 << 7 ] +set AT91C_PMC_PCK0 [expr 0x1 << 8 ] +set AT91C_PMC_PCK1 [expr 0x1 << 9 ] +set AT91C_PMC_PCK2 [expr 0x1 << 10 ] +set AT91C_PMC_PCK3 [expr 0x1 << 11 ] +# -------- CKGR_MOR : (PMC Offset: 0x20) Main Oscillator Register -------- +set AT91C_CKGR_MOSCEN [expr 0x1 << 0 ] +set AT91C_CKGR_OSCBYPASS [expr 0x1 << 1 ] +set AT91C_CKGR_OSCOUNT [expr 0xFF << 8 ] +# -------- CKGR_MCFR : (PMC Offset: 0x24) Main Clock Frequency Register -------- +set AT91C_CKGR_MAINF [expr 0xFFFF << 0 ] +set AT91C_CKGR_MAINRDY [expr 0x1 << 16 ] +# -------- CKGR_PLLR : (PMC Offset: 0x2c) PLL B Register -------- +set AT91C_CKGR_DIV [expr 0xFF << 0 ] +set AT91C_CKGR_DIV_0 0x0 +set AT91C_CKGR_DIV_BYPASS 0x1 +set AT91C_CKGR_PLLCOUNT [expr 0x3F << 8 ] +set AT91C_CKGR_OUT [expr 0x3 << 14 ] +set AT91C_CKGR_OUT_0 [expr 0x0 << 14 ] +set AT91C_CKGR_OUT_1 [expr 0x1 << 14 ] +set AT91C_CKGR_OUT_2 [expr 0x2 << 14 ] +set AT91C_CKGR_OUT_3 [expr 0x3 << 14 ] +set AT91C_CKGR_MUL [expr 0x7FF << 16 ] +set AT91C_CKGR_USBDIV [expr 0x3 << 28 ] +set AT91C_CKGR_USBDIV_0 [expr 0x0 << 28 ] +set AT91C_CKGR_USBDIV_1 [expr 0x1 << 28 ] +set AT91C_CKGR_USBDIV_2 [expr 0x2 << 28 ] +# -------- PMC_MCKR : (PMC Offset: 0x30) Master Clock Register -------- +set AT91C_PMC_CSS [expr 0x3 << 0 ] +set AT91C_PMC_CSS_SLOW_CLK 0x0 +set AT91C_PMC_CSS_MAIN_CLK 0x1 +set AT91C_PMC_CSS_PLL_CLK 0x3 +set AT91C_PMC_PRES [expr 0x7 << 2 ] +set AT91C_PMC_PRES_CLK [expr 0x0 << 2 ] +set AT91C_PMC_PRES_CLK_2 [expr 0x1 << 2 ] +set AT91C_PMC_PRES_CLK_4 [expr 0x2 << 2 ] +set AT91C_PMC_PRES_CLK_8 [expr 0x3 << 2 ] +set AT91C_PMC_PRES_CLK_16 [expr 0x4 << 2 ] +set AT91C_PMC_PRES_CLK_32 [expr 0x5 << 2 ] +set AT91C_PMC_PRES_CLK_64 [expr 0x6 << 2 ] +# -------- PMC_PCKR : (PMC Offset: 0x40) Programmable Clock Register -------- +set AT91C_PMC_CSS [expr 0x3 << 0 ] +set AT91C_PMC_CSS_SLOW_CLK 0x0 +set AT91C_PMC_CSS_MAIN_CLK 0x1 +set AT91C_PMC_CSS_PLL_CLK 0x3 +set AT91C_PMC_PRES [expr 0x7 << 2 ] +set AT91C_PMC_PRES_CLK [expr 0x0 << 2 ] +set AT91C_PMC_PRES_CLK_2 [expr 0x1 << 2 ] +set AT91C_PMC_PRES_CLK_4 [expr 0x2 << 2 ] +set AT91C_PMC_PRES_CLK_8 [expr 0x3 << 2 ] +set AT91C_PMC_PRES_CLK_16 [expr 0x4 << 2 ] +set AT91C_PMC_PRES_CLK_32 [expr 0x5 << 2 ] +set AT91C_PMC_PRES_CLK_64 [expr 0x6 << 2 ] +# -------- PMC_IER : (PMC Offset: 0x60) PMC Interrupt Enable Register -------- +set AT91C_PMC_MOSCS [expr 0x1 << 0 ] +set AT91C_PMC_LOCK [expr 0x1 << 2 ] +set AT91C_PMC_MCKRDY [expr 0x1 << 3 ] +set AT91C_PMC_PCK0RDY [expr 0x1 << 8 ] +set AT91C_PMC_PCK1RDY [expr 0x1 << 9 ] +set AT91C_PMC_PCK2RDY [expr 0x1 << 10 ] +set AT91C_PMC_PCK3RDY [expr 0x1 << 11 ] +# -------- PMC_IDR : (PMC Offset: 0x64) PMC Interrupt Disable Register -------- +set AT91C_PMC_MOSCS [expr 0x1 << 0 ] +set AT91C_PMC_LOCK [expr 0x1 << 2 ] +set AT91C_PMC_MCKRDY [expr 0x1 << 3 ] +set AT91C_PMC_PCK0RDY [expr 0x1 << 8 ] +set AT91C_PMC_PCK1RDY [expr 0x1 << 9 ] +set AT91C_PMC_PCK2RDY [expr 0x1 << 10 ] +set AT91C_PMC_PCK3RDY [expr 0x1 << 11 ] +# -------- PMC_SR : (PMC Offset: 0x68) PMC Status Register -------- +set AT91C_PMC_MOSCS [expr 0x1 << 0 ] +set AT91C_PMC_LOCK [expr 0x1 << 2 ] +set AT91C_PMC_MCKRDY [expr 0x1 << 3 ] +set AT91C_PMC_PCK0RDY [expr 0x1 << 8 ] +set AT91C_PMC_PCK1RDY [expr 0x1 << 9 ] +set AT91C_PMC_PCK2RDY [expr 0x1 << 10 ] +set AT91C_PMC_PCK3RDY [expr 0x1 << 11 ] +# -------- PMC_IMR : (PMC Offset: 0x6c) PMC Interrupt Mask Register -------- +set AT91C_PMC_MOSCS [expr 0x1 << 0 ] +set AT91C_PMC_LOCK [expr 0x1 << 2 ] +set AT91C_PMC_MCKRDY [expr 0x1 << 3 ] +set AT91C_PMC_PCK0RDY [expr 0x1 << 8 ] +set AT91C_PMC_PCK1RDY [expr 0x1 << 9 ] +set AT91C_PMC_PCK2RDY [expr 0x1 << 10 ] +set AT91C_PMC_PCK3RDY [expr 0x1 << 11 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Reset Controller Interface +# ***************************************************************************** +# -------- RSTC_RCR : (RSTC Offset: 0x0) Reset Control Register -------- +set AT91C_RSTC_PROCRST [expr 0x1 << 0 ] +set AT91C_RSTC_PERRST [expr 0x1 << 2 ] +set AT91C_RSTC_EXTRST [expr 0x1 << 3 ] +set AT91C_RSTC_KEY [expr 0xFF << 24 ] +# -------- RSTC_RSR : (RSTC Offset: 0x4) Reset Status Register -------- +set AT91C_RSTC_URSTS [expr 0x1 << 0 ] +set AT91C_RSTC_BODSTS [expr 0x1 << 1 ] +set AT91C_RSTC_RSTTYP [expr 0x7 << 8 ] +set AT91C_RSTC_RSTTYP_POWERUP [expr 0x0 << 8 ] +set AT91C_RSTC_RSTTYP_WAKEUP [expr 0x1 << 8 ] +set AT91C_RSTC_RSTTYP_WATCHDOG [expr 0x2 << 8 ] +set AT91C_RSTC_RSTTYP_SOFTWARE [expr 0x3 << 8 ] +set AT91C_RSTC_RSTTYP_USER [expr 0x4 << 8 ] +set AT91C_RSTC_RSTTYP_BROWNOUT [expr 0x5 << 8 ] +set AT91C_RSTC_NRSTL [expr 0x1 << 16 ] +set AT91C_RSTC_SRCMP [expr 0x1 << 17 ] +# -------- RSTC_RMR : (RSTC Offset: 0x8) Reset Mode Register -------- +set AT91C_RSTC_URSTEN [expr 0x1 << 0 ] +set AT91C_RSTC_URSTIEN [expr 0x1 << 4 ] +set AT91C_RSTC_ERSTL [expr 0xF << 8 ] +set AT91C_RSTC_BODIEN [expr 0x1 << 16 ] +set AT91C_RSTC_KEY [expr 0xFF << 24 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Real Time Timer Controller Interface +# ***************************************************************************** +# -------- RTTC_RTMR : (RTTC Offset: 0x0) Real-time Mode Register -------- +set AT91C_RTTC_RTPRES [expr 0xFFFF << 0 ] +set AT91C_RTTC_ALMIEN [expr 0x1 << 16 ] +set AT91C_RTTC_RTTINCIEN [expr 0x1 << 17 ] +set AT91C_RTTC_RTTRST [expr 0x1 << 18 ] +# -------- RTTC_RTAR : (RTTC Offset: 0x4) Real-time Alarm Register -------- +set AT91C_RTTC_ALMV [expr 0x0 << 0 ] +# -------- RTTC_RTVR : (RTTC Offset: 0x8) Current Real-time Value Register -------- +set AT91C_RTTC_CRTV [expr 0x0 << 0 ] +# -------- RTTC_RTSR : (RTTC Offset: 0xc) Real-time Status Register -------- +set AT91C_RTTC_ALMS [expr 0x1 << 0 ] +set AT91C_RTTC_RTTINC [expr 0x1 << 1 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Periodic Interval Timer Controller Interface +# ***************************************************************************** +# -------- PITC_PIMR : (PITC Offset: 0x0) Periodic Interval Mode Register -------- +set AT91C_PITC_PIV [expr 0xFFFFF << 0 ] +set AT91C_PITC_PITEN [expr 0x1 << 24 ] +set AT91C_PITC_PITIEN [expr 0x1 << 25 ] +# -------- PITC_PISR : (PITC Offset: 0x4) Periodic Interval Status Register -------- +set AT91C_PITC_PITS [expr 0x1 << 0 ] +# -------- PITC_PIVR : (PITC Offset: 0x8) Periodic Interval Value Register -------- +set AT91C_PITC_CPIV [expr 0xFFFFF << 0 ] +set AT91C_PITC_PICNT [expr 0xFFF << 20 ] +# -------- PITC_PIIR : (PITC Offset: 0xc) Periodic Interval Image Register -------- +set AT91C_PITC_CPIV [expr 0xFFFFF << 0 ] +set AT91C_PITC_PICNT [expr 0xFFF << 20 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Watchdog Timer Controller Interface +# ***************************************************************************** +# -------- WDTC_WDCR : (WDTC Offset: 0x0) Periodic Interval Image Register -------- +set AT91C_WDTC_WDRSTT [expr 0x1 << 0 ] +set AT91C_WDTC_KEY [expr 0xFF << 24 ] +# -------- WDTC_WDMR : (WDTC Offset: 0x4) Watchdog Mode Register -------- +set AT91C_WDTC_WDV [expr 0xFFF << 0 ] +set AT91C_WDTC_WDFIEN [expr 0x1 << 12 ] +set AT91C_WDTC_WDRSTEN [expr 0x1 << 13 ] +set AT91C_WDTC_WDRPROC [expr 0x1 << 14 ] +set AT91C_WDTC_WDDIS [expr 0x1 << 15 ] +set AT91C_WDTC_WDD [expr 0xFFF << 16 ] +set AT91C_WDTC_WDDBGHLT [expr 0x1 << 28 ] +set AT91C_WDTC_WDIDLEHLT [expr 0x1 << 29 ] +# -------- WDTC_WDSR : (WDTC Offset: 0x8) Watchdog Status Register -------- +set AT91C_WDTC_WDUNF [expr 0x1 << 0 ] +set AT91C_WDTC_WDERR [expr 0x1 << 1 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Voltage Regulator Mode Controller Interface +# ***************************************************************************** +# -------- VREG_MR : (VREG Offset: 0x0) Voltage Regulator Mode Register -------- +set AT91C_VREG_PSTDBY [expr 0x1 << 0 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Memory Controller Interface +# ***************************************************************************** +# -------- MC_RCR : (MC Offset: 0x0) MC Remap Control Register -------- +set AT91C_MC_RCB [expr 0x1 << 0 ] +# -------- MC_ASR : (MC Offset: 0x4) MC Abort Status Register -------- +set AT91C_MC_UNDADD [expr 0x1 << 0 ] +set AT91C_MC_MISADD [expr 0x1 << 1 ] +set AT91C_MC_ABTSZ [expr 0x3 << 8 ] +set AT91C_MC_ABTSZ_BYTE [expr 0x0 << 8 ] +set AT91C_MC_ABTSZ_HWORD [expr 0x1 << 8 ] +set AT91C_MC_ABTSZ_WORD [expr 0x2 << 8 ] +set AT91C_MC_ABTTYP [expr 0x3 << 10 ] +set AT91C_MC_ABTTYP_DATAR [expr 0x0 << 10 ] +set AT91C_MC_ABTTYP_DATAW [expr 0x1 << 10 ] +set AT91C_MC_ABTTYP_FETCH [expr 0x2 << 10 ] +set AT91C_MC_MST0 [expr 0x1 << 16 ] +set AT91C_MC_MST1 [expr 0x1 << 17 ] +set AT91C_MC_SVMST0 [expr 0x1 << 24 ] +set AT91C_MC_SVMST1 [expr 0x1 << 25 ] +# -------- MC_FMR : (MC Offset: 0x60) MC Flash Mode Register -------- +set AT91C_MC_FRDY [expr 0x1 << 0 ] +set AT91C_MC_LOCKE [expr 0x1 << 2 ] +set AT91C_MC_PROGE [expr 0x1 << 3 ] +set AT91C_MC_NEBP [expr 0x1 << 7 ] +set AT91C_MC_FWS [expr 0x3 << 8 ] +set AT91C_MC_FWS_0FWS [expr 0x0 << 8 ] +set AT91C_MC_FWS_1FWS [expr 0x1 << 8 ] +set AT91C_MC_FWS_2FWS [expr 0x2 << 8 ] +set AT91C_MC_FWS_3FWS [expr 0x3 << 8 ] +set AT91C_MC_FMCN [expr 0xFF << 16 ] +# -------- MC_FCR : (MC Offset: 0x64) MC Flash Command Register -------- +set AT91C_MC_FCMD [expr 0xF << 0 ] +set AT91C_MC_FCMD_START_PROG 0x1 +set AT91C_MC_FCMD_LOCK 0x2 +set AT91C_MC_FCMD_PROG_AND_LOCK 0x3 +set AT91C_MC_FCMD_UNLOCK 0x4 +set AT91C_MC_FCMD_ERASE_ALL 0x8 +set AT91C_MC_FCMD_SET_GP_NVM 0xB +set AT91C_MC_FCMD_CLR_GP_NVM 0xD +set AT91C_MC_FCMD_SET_SECURITY 0xF +set AT91C_MC_PAGEN [expr 0x3FF << 8 ] +set AT91C_MC_KEY [expr 0xFF << 24 ] +# -------- MC_FSR : (MC Offset: 0x68) MC Flash Command Register -------- +set AT91C_MC_FRDY [expr 0x1 << 0 ] +set AT91C_MC_LOCKE [expr 0x1 << 2 ] +set AT91C_MC_PROGE [expr 0x1 << 3 ] +set AT91C_MC_SECURITY [expr 0x1 << 4 ] +set AT91C_MC_GPNVM0 [expr 0x1 << 8 ] +set AT91C_MC_GPNVM1 [expr 0x1 << 9 ] +set AT91C_MC_GPNVM2 [expr 0x1 << 10 ] +set AT91C_MC_GPNVM3 [expr 0x1 << 11 ] +set AT91C_MC_GPNVM4 [expr 0x1 << 12 ] +set AT91C_MC_GPNVM5 [expr 0x1 << 13 ] +set AT91C_MC_GPNVM6 [expr 0x1 << 14 ] +set AT91C_MC_GPNVM7 [expr 0x1 << 15 ] +set AT91C_MC_LOCKS0 [expr 0x1 << 16 ] +set AT91C_MC_LOCKS1 [expr 0x1 << 17 ] +set AT91C_MC_LOCKS2 [expr 0x1 << 18 ] +set AT91C_MC_LOCKS3 [expr 0x1 << 19 ] +set AT91C_MC_LOCKS4 [expr 0x1 << 20 ] +set AT91C_MC_LOCKS5 [expr 0x1 << 21 ] +set AT91C_MC_LOCKS6 [expr 0x1 << 22 ] +set AT91C_MC_LOCKS7 [expr 0x1 << 23 ] +set AT91C_MC_LOCKS8 [expr 0x1 << 24 ] +set AT91C_MC_LOCKS9 [expr 0x1 << 25 ] +set AT91C_MC_LOCKS10 [expr 0x1 << 26 ] +set AT91C_MC_LOCKS11 [expr 0x1 << 27 ] +set AT91C_MC_LOCKS12 [expr 0x1 << 28 ] +set AT91C_MC_LOCKS13 [expr 0x1 << 29 ] +set AT91C_MC_LOCKS14 [expr 0x1 << 30 ] +set AT91C_MC_LOCKS15 [expr 0x1 << 31 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Serial Parallel Interface +# ***************************************************************************** +# -------- SPI_CR : (SPI Offset: 0x0) SPI Control Register -------- +set AT91C_SPI_SPIEN [expr 0x1 << 0 ] +set AT91C_SPI_SPIDIS [expr 0x1 << 1 ] +set AT91C_SPI_SWRST [expr 0x1 << 7 ] +set AT91C_SPI_LASTXFER [expr 0x1 << 24 ] +# -------- SPI_MR : (SPI Offset: 0x4) SPI Mode Register -------- +set AT91C_SPI_MSTR [expr 0x1 << 0 ] +set AT91C_SPI_PS [expr 0x1 << 1 ] +set AT91C_SPI_PS_FIXED [expr 0x0 << 1 ] +set AT91C_SPI_PS_VARIABLE [expr 0x1 << 1 ] +set AT91C_SPI_PCSDEC [expr 0x1 << 2 ] +set AT91C_SPI_FDIV [expr 0x1 << 3 ] +set AT91C_SPI_MODFDIS [expr 0x1 << 4 ] +set AT91C_SPI_LLB [expr 0x1 << 7 ] +set AT91C_SPI_PCS [expr 0xF << 16 ] +set AT91C_SPI_DLYBCS [expr 0xFF << 24 ] +# -------- SPI_RDR : (SPI Offset: 0x8) Receive Data Register -------- +set AT91C_SPI_RD [expr 0xFFFF << 0 ] +set AT91C_SPI_RPCS [expr 0xF << 16 ] +# -------- SPI_TDR : (SPI Offset: 0xc) Transmit Data Register -------- +set AT91C_SPI_TD [expr 0xFFFF << 0 ] +set AT91C_SPI_TPCS [expr 0xF << 16 ] +set AT91C_SPI_LASTXFER [expr 0x1 << 24 ] +# -------- SPI_SR : (SPI Offset: 0x10) Status Register -------- +set AT91C_SPI_RDRF [expr 0x1 << 0 ] +set AT91C_SPI_TDRE [expr 0x1 << 1 ] +set AT91C_SPI_MODF [expr 0x1 << 2 ] +set AT91C_SPI_OVRES [expr 0x1 << 3 ] +set AT91C_SPI_ENDRX [expr 0x1 << 4 ] +set AT91C_SPI_ENDTX [expr 0x1 << 5 ] +set AT91C_SPI_RXBUFF [expr 0x1 << 6 ] +set AT91C_SPI_TXBUFE [expr 0x1 << 7 ] +set AT91C_SPI_NSSR [expr 0x1 << 8 ] +set AT91C_SPI_TXEMPTY [expr 0x1 << 9 ] +set AT91C_SPI_SPIENS [expr 0x1 << 16 ] +# -------- SPI_IER : (SPI Offset: 0x14) Interrupt Enable Register -------- +set AT91C_SPI_RDRF [expr 0x1 << 0 ] +set AT91C_SPI_TDRE [expr 0x1 << 1 ] +set AT91C_SPI_MODF [expr 0x1 << 2 ] +set AT91C_SPI_OVRES [expr 0x1 << 3 ] +set AT91C_SPI_ENDRX [expr 0x1 << 4 ] +set AT91C_SPI_ENDTX [expr 0x1 << 5 ] +set AT91C_SPI_RXBUFF [expr 0x1 << 6 ] +set AT91C_SPI_TXBUFE [expr 0x1 << 7 ] +set AT91C_SPI_NSSR [expr 0x1 << 8 ] +set AT91C_SPI_TXEMPTY [expr 0x1 << 9 ] +# -------- SPI_IDR : (SPI Offset: 0x18) Interrupt Disable Register -------- +set AT91C_SPI_RDRF [expr 0x1 << 0 ] +set AT91C_SPI_TDRE [expr 0x1 << 1 ] +set AT91C_SPI_MODF [expr 0x1 << 2 ] +set AT91C_SPI_OVRES [expr 0x1 << 3 ] +set AT91C_SPI_ENDRX [expr 0x1 << 4 ] +set AT91C_SPI_ENDTX [expr 0x1 << 5 ] +set AT91C_SPI_RXBUFF [expr 0x1 << 6 ] +set AT91C_SPI_TXBUFE [expr 0x1 << 7 ] +set AT91C_SPI_NSSR [expr 0x1 << 8 ] +set AT91C_SPI_TXEMPTY [expr 0x1 << 9 ] +# -------- SPI_IMR : (SPI Offset: 0x1c) Interrupt Mask Register -------- +set AT91C_SPI_RDRF [expr 0x1 << 0 ] +set AT91C_SPI_TDRE [expr 0x1 << 1 ] +set AT91C_SPI_MODF [expr 0x1 << 2 ] +set AT91C_SPI_OVRES [expr 0x1 << 3 ] +set AT91C_SPI_ENDRX [expr 0x1 << 4 ] +set AT91C_SPI_ENDTX [expr 0x1 << 5 ] +set AT91C_SPI_RXBUFF [expr 0x1 << 6 ] +set AT91C_SPI_TXBUFE [expr 0x1 << 7 ] +set AT91C_SPI_NSSR [expr 0x1 << 8 ] +set AT91C_SPI_TXEMPTY [expr 0x1 << 9 ] +# -------- SPI_CSR : (SPI Offset: 0x30) Chip Select Register -------- +set AT91C_SPI_CPOL [expr 0x1 << 0 ] +set AT91C_SPI_NCPHA [expr 0x1 << 1 ] +set AT91C_SPI_CSAAT [expr 0x1 << 3 ] +set AT91C_SPI_BITS [expr 0xF << 4 ] +set AT91C_SPI_BITS_8 [expr 0x0 << 4 ] +set AT91C_SPI_BITS_9 [expr 0x1 << 4 ] +set AT91C_SPI_BITS_10 [expr 0x2 << 4 ] +set AT91C_SPI_BITS_11 [expr 0x3 << 4 ] +set AT91C_SPI_BITS_12 [expr 0x4 << 4 ] +set AT91C_SPI_BITS_13 [expr 0x5 << 4 ] +set AT91C_SPI_BITS_14 [expr 0x6 << 4 ] +set AT91C_SPI_BITS_15 [expr 0x7 << 4 ] +set AT91C_SPI_BITS_16 [expr 0x8 << 4 ] +set AT91C_SPI_SCBR [expr 0xFF << 8 ] +set AT91C_SPI_DLYBS [expr 0xFF << 16 ] +set AT91C_SPI_DLYBCT [expr 0xFF << 24 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Usart +# ***************************************************************************** +# -------- US_CR : (USART Offset: 0x0) Debug Unit Control Register -------- +set AT91C_US_RSTRX [expr 0x1 << 2 ] +set AT91C_US_RSTTX [expr 0x1 << 3 ] +set AT91C_US_RXEN [expr 0x1 << 4 ] +set AT91C_US_RXDIS [expr 0x1 << 5 ] +set AT91C_US_TXEN [expr 0x1 << 6 ] +set AT91C_US_TXDIS [expr 0x1 << 7 ] +set AT91C_US_RSTSTA [expr 0x1 << 8 ] +set AT91C_US_STTBRK [expr 0x1 << 9 ] +set AT91C_US_STPBRK [expr 0x1 << 10 ] +set AT91C_US_STTTO [expr 0x1 << 11 ] +set AT91C_US_SENDA [expr 0x1 << 12 ] +set AT91C_US_RSTIT [expr 0x1 << 13 ] +set AT91C_US_RSTNACK [expr 0x1 << 14 ] +set AT91C_US_RETTO [expr 0x1 << 15 ] +set AT91C_US_DTREN [expr 0x1 << 16 ] +set AT91C_US_DTRDIS [expr 0x1 << 17 ] +set AT91C_US_RTSEN [expr 0x1 << 18 ] +set AT91C_US_RTSDIS [expr 0x1 << 19 ] +# -------- US_MR : (USART Offset: 0x4) Debug Unit Mode Register -------- +set AT91C_US_USMODE [expr 0xF << 0 ] +set AT91C_US_USMODE_NORMAL 0x0 +set AT91C_US_USMODE_RS485 0x1 +set AT91C_US_USMODE_HWHSH 0x2 +set AT91C_US_USMODE_MODEM 0x3 +set AT91C_US_USMODE_ISO7816_0 0x4 +set AT91C_US_USMODE_ISO7816_1 0x6 +set AT91C_US_USMODE_IRDA 0x8 +set AT91C_US_USMODE_SWHSH 0xC +set AT91C_US_CLKS [expr 0x3 << 4 ] +set AT91C_US_CLKS_CLOCK [expr 0x0 << 4 ] +set AT91C_US_CLKS_FDIV1 [expr 0x1 << 4 ] +set AT91C_US_CLKS_SLOW [expr 0x2 << 4 ] +set AT91C_US_CLKS_EXT [expr 0x3 << 4 ] +set AT91C_US_CHRL [expr 0x3 << 6 ] +set AT91C_US_CHRL_5_BITS [expr 0x0 << 6 ] +set AT91C_US_CHRL_6_BITS [expr 0x1 << 6 ] +set AT91C_US_CHRL_7_BITS [expr 0x2 << 6 ] +set AT91C_US_CHRL_8_BITS [expr 0x3 << 6 ] +set AT91C_US_SYNC [expr 0x1 << 8 ] +set AT91C_US_PAR [expr 0x7 << 9 ] +set AT91C_US_PAR_EVEN [expr 0x0 << 9 ] +set AT91C_US_PAR_ODD [expr 0x1 << 9 ] +set AT91C_US_PAR_SPACE [expr 0x2 << 9 ] +set AT91C_US_PAR_MARK [expr 0x3 << 9 ] +set AT91C_US_PAR_NONE [expr 0x4 << 9 ] +set AT91C_US_PAR_MULTI_DROP [expr 0x6 << 9 ] +set AT91C_US_NBSTOP [expr 0x3 << 12 ] +set AT91C_US_NBSTOP_1_BIT [expr 0x0 << 12 ] +set AT91C_US_NBSTOP_15_BIT [expr 0x1 << 12 ] +set AT91C_US_NBSTOP_2_BIT [expr 0x2 << 12 ] +set AT91C_US_CHMODE [expr 0x3 << 14 ] +set AT91C_US_CHMODE_NORMAL [expr 0x0 << 14 ] +set AT91C_US_CHMODE_AUTO [expr 0x1 << 14 ] +set AT91C_US_CHMODE_LOCAL [expr 0x2 << 14 ] +set AT91C_US_CHMODE_REMOTE [expr 0x3 << 14 ] +set AT91C_US_MSBF [expr 0x1 << 16 ] +set AT91C_US_MODE9 [expr 0x1 << 17 ] +set AT91C_US_CKLO [expr 0x1 << 18 ] +set AT91C_US_OVER [expr 0x1 << 19 ] +set AT91C_US_INACK [expr 0x1 << 20 ] +set AT91C_US_DSNACK [expr 0x1 << 21 ] +set AT91C_US_MAX_ITER [expr 0x1 << 24 ] +set AT91C_US_FILTER [expr 0x1 << 28 ] +# -------- US_IER : (USART Offset: 0x8) Debug Unit Interrupt Enable Register -------- +set AT91C_US_RXRDY [expr 0x1 << 0 ] +set AT91C_US_TXRDY [expr 0x1 << 1 ] +set AT91C_US_RXBRK [expr 0x1 << 2 ] +set AT91C_US_ENDRX [expr 0x1 << 3 ] +set AT91C_US_ENDTX [expr 0x1 << 4 ] +set AT91C_US_OVRE [expr 0x1 << 5 ] +set AT91C_US_FRAME [expr 0x1 << 6 ] +set AT91C_US_PARE [expr 0x1 << 7 ] +set AT91C_US_TIMEOUT [expr 0x1 << 8 ] +set AT91C_US_TXEMPTY [expr 0x1 << 9 ] +set AT91C_US_ITERATION [expr 0x1 << 10 ] +set AT91C_US_TXBUFE [expr 0x1 << 11 ] +set AT91C_US_RXBUFF [expr 0x1 << 12 ] +set AT91C_US_NACK [expr 0x1 << 13 ] +set AT91C_US_RIIC [expr 0x1 << 16 ] +set AT91C_US_DSRIC [expr 0x1 << 17 ] +set AT91C_US_DCDIC [expr 0x1 << 18 ] +set AT91C_US_CTSIC [expr 0x1 << 19 ] +# -------- US_IDR : (USART Offset: 0xc) Debug Unit Interrupt Disable Register -------- +set AT91C_US_RXRDY [expr 0x1 << 0 ] +set AT91C_US_TXRDY [expr 0x1 << 1 ] +set AT91C_US_RXBRK [expr 0x1 << 2 ] +set AT91C_US_ENDRX [expr 0x1 << 3 ] +set AT91C_US_ENDTX [expr 0x1 << 4 ] +set AT91C_US_OVRE [expr 0x1 << 5 ] +set AT91C_US_FRAME [expr 0x1 << 6 ] +set AT91C_US_PARE [expr 0x1 << 7 ] +set AT91C_US_TIMEOUT [expr 0x1 << 8 ] +set AT91C_US_TXEMPTY [expr 0x1 << 9 ] +set AT91C_US_ITERATION [expr 0x1 << 10 ] +set AT91C_US_TXBUFE [expr 0x1 << 11 ] +set AT91C_US_RXBUFF [expr 0x1 << 12 ] +set AT91C_US_NACK [expr 0x1 << 13 ] +set AT91C_US_RIIC [expr 0x1 << 16 ] +set AT91C_US_DSRIC [expr 0x1 << 17 ] +set AT91C_US_DCDIC [expr 0x1 << 18 ] +set AT91C_US_CTSIC [expr 0x1 << 19 ] +# -------- US_IMR : (USART Offset: 0x10) Debug Unit Interrupt Mask Register -------- +set AT91C_US_RXRDY [expr 0x1 << 0 ] +set AT91C_US_TXRDY [expr 0x1 << 1 ] +set AT91C_US_RXBRK [expr 0x1 << 2 ] +set AT91C_US_ENDRX [expr 0x1 << 3 ] +set AT91C_US_ENDTX [expr 0x1 << 4 ] +set AT91C_US_OVRE [expr 0x1 << 5 ] +set AT91C_US_FRAME [expr 0x1 << 6 ] +set AT91C_US_PARE [expr 0x1 << 7 ] +set AT91C_US_TIMEOUT [expr 0x1 << 8 ] +set AT91C_US_TXEMPTY [expr 0x1 << 9 ] +set AT91C_US_ITERATION [expr 0x1 << 10 ] +set AT91C_US_TXBUFE [expr 0x1 << 11 ] +set AT91C_US_RXBUFF [expr 0x1 << 12 ] +set AT91C_US_NACK [expr 0x1 << 13 ] +set AT91C_US_RIIC [expr 0x1 << 16 ] +set AT91C_US_DSRIC [expr 0x1 << 17 ] +set AT91C_US_DCDIC [expr 0x1 << 18 ] +set AT91C_US_CTSIC [expr 0x1 << 19 ] +# -------- US_CSR : (USART Offset: 0x14) Debug Unit Channel Status Register -------- +set AT91C_US_RXRDY [expr 0x1 << 0 ] +set AT91C_US_TXRDY [expr 0x1 << 1 ] +set AT91C_US_RXBRK [expr 0x1 << 2 ] +set AT91C_US_ENDRX [expr 0x1 << 3 ] +set AT91C_US_ENDTX [expr 0x1 << 4 ] +set AT91C_US_OVRE [expr 0x1 << 5 ] +set AT91C_US_FRAME [expr 0x1 << 6 ] +set AT91C_US_PARE [expr 0x1 << 7 ] +set AT91C_US_TIMEOUT [expr 0x1 << 8 ] +set AT91C_US_TXEMPTY [expr 0x1 << 9 ] +set AT91C_US_ITERATION [expr 0x1 << 10 ] +set AT91C_US_TXBUFE [expr 0x1 << 11 ] +set AT91C_US_RXBUFF [expr 0x1 << 12 ] +set AT91C_US_NACK [expr 0x1 << 13 ] +set AT91C_US_RIIC [expr 0x1 << 16 ] +set AT91C_US_DSRIC [expr 0x1 << 17 ] +set AT91C_US_DCDIC [expr 0x1 << 18 ] +set AT91C_US_CTSIC [expr 0x1 << 19 ] +set AT91C_US_RI [expr 0x1 << 20 ] +set AT91C_US_DSR [expr 0x1 << 21 ] +set AT91C_US_DCD [expr 0x1 << 22 ] +set AT91C_US_CTS [expr 0x1 << 23 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Synchronous Serial Controller Interface +# ***************************************************************************** +# -------- SSC_CR : (SSC Offset: 0x0) SSC Control Register -------- +set AT91C_SSC_RXEN [expr 0x1 << 0 ] +set AT91C_SSC_RXDIS [expr 0x1 << 1 ] +set AT91C_SSC_TXEN [expr 0x1 << 8 ] +set AT91C_SSC_TXDIS [expr 0x1 << 9 ] +set AT91C_SSC_SWRST [expr 0x1 << 15 ] +# -------- SSC_RCMR : (SSC Offset: 0x10) SSC Receive Clock Mode Register -------- +set AT91C_SSC_CKS [expr 0x3 << 0 ] +set AT91C_SSC_CKS_DIV 0x0 +set AT91C_SSC_CKS_TK 0x1 +set AT91C_SSC_CKS_RK 0x2 +set AT91C_SSC_CKO [expr 0x7 << 2 ] +set AT91C_SSC_CKO_NONE [expr 0x0 << 2 ] +set AT91C_SSC_CKO_CONTINOUS [expr 0x1 << 2 ] +set AT91C_SSC_CKO_DATA_TX [expr 0x2 << 2 ] +set AT91C_SSC_CKI [expr 0x1 << 5 ] +set AT91C_SSC_CKG [expr 0x3 << 6 ] +set AT91C_SSC_CKG_NONE [expr 0x0 << 6 ] +set AT91C_SSC_CKG_LOW [expr 0x1 << 6 ] +set AT91C_SSC_CKG_HIGH [expr 0x2 << 6 ] +set AT91C_SSC_START [expr 0xF << 8 ] +set AT91C_SSC_START_CONTINOUS [expr 0x0 << 8 ] +set AT91C_SSC_START_TX [expr 0x1 << 8 ] +set AT91C_SSC_START_LOW_RF [expr 0x2 << 8 ] +set AT91C_SSC_START_HIGH_RF [expr 0x3 << 8 ] +set AT91C_SSC_START_FALL_RF [expr 0x4 << 8 ] +set AT91C_SSC_START_RISE_RF [expr 0x5 << 8 ] +set AT91C_SSC_START_LEVEL_RF [expr 0x6 << 8 ] +set AT91C_SSC_START_EDGE_RF [expr 0x7 << 8 ] +set AT91C_SSC_START_0 [expr 0x8 << 8 ] +set AT91C_SSC_STOP [expr 0x1 << 12 ] +set AT91C_SSC_STTDLY [expr 0xFF << 16 ] +set AT91C_SSC_PERIOD [expr 0xFF << 24 ] +# -------- SSC_RFMR : (SSC Offset: 0x14) SSC Receive Frame Mode Register -------- +set AT91C_SSC_DATLEN [expr 0x1F << 0 ] +set AT91C_SSC_LOOP [expr 0x1 << 5 ] +set AT91C_SSC_MSBF [expr 0x1 << 7 ] +set AT91C_SSC_DATNB [expr 0xF << 8 ] +set AT91C_SSC_FSLEN [expr 0xF << 16 ] +set AT91C_SSC_FSOS [expr 0x7 << 20 ] +set AT91C_SSC_FSOS_NONE [expr 0x0 << 20 ] +set AT91C_SSC_FSOS_NEGATIVE [expr 0x1 << 20 ] +set AT91C_SSC_FSOS_POSITIVE [expr 0x2 << 20 ] +set AT91C_SSC_FSOS_LOW [expr 0x3 << 20 ] +set AT91C_SSC_FSOS_HIGH [expr 0x4 << 20 ] +set AT91C_SSC_FSOS_TOGGLE [expr 0x5 << 20 ] +set AT91C_SSC_FSEDGE [expr 0x1 << 24 ] +# -------- SSC_TCMR : (SSC Offset: 0x18) SSC Transmit Clock Mode Register -------- +set AT91C_SSC_CKS [expr 0x3 << 0 ] +set AT91C_SSC_CKS_DIV 0x0 +set AT91C_SSC_CKS_TK 0x1 +set AT91C_SSC_CKS_RK 0x2 +set AT91C_SSC_CKO [expr 0x7 << 2 ] +set AT91C_SSC_CKO_NONE [expr 0x0 << 2 ] +set AT91C_SSC_CKO_CONTINOUS [expr 0x1 << 2 ] +set AT91C_SSC_CKO_DATA_TX [expr 0x2 << 2 ] +set AT91C_SSC_CKI [expr 0x1 << 5 ] +set AT91C_SSC_CKG [expr 0x3 << 6 ] +set AT91C_SSC_CKG_NONE [expr 0x0 << 6 ] +set AT91C_SSC_CKG_LOW [expr 0x1 << 6 ] +set AT91C_SSC_CKG_HIGH [expr 0x2 << 6 ] +set AT91C_SSC_START [expr 0xF << 8 ] +set AT91C_SSC_START_CONTINOUS [expr 0x0 << 8 ] +set AT91C_SSC_START_TX [expr 0x1 << 8 ] +set AT91C_SSC_START_LOW_RF [expr 0x2 << 8 ] +set AT91C_SSC_START_HIGH_RF [expr 0x3 << 8 ] +set AT91C_SSC_START_FALL_RF [expr 0x4 << 8 ] +set AT91C_SSC_START_RISE_RF [expr 0x5 << 8 ] +set AT91C_SSC_START_LEVEL_RF [expr 0x6 << 8 ] +set AT91C_SSC_START_EDGE_RF [expr 0x7 << 8 ] +set AT91C_SSC_START_0 [expr 0x8 << 8 ] +set AT91C_SSC_STTDLY [expr 0xFF << 16 ] +set AT91C_SSC_PERIOD [expr 0xFF << 24 ] +# -------- SSC_TFMR : (SSC Offset: 0x1c) SSC Transmit Frame Mode Register -------- +set AT91C_SSC_DATLEN [expr 0x1F << 0 ] +set AT91C_SSC_DATDEF [expr 0x1 << 5 ] +set AT91C_SSC_MSBF [expr 0x1 << 7 ] +set AT91C_SSC_DATNB [expr 0xF << 8 ] +set AT91C_SSC_FSLEN [expr 0xF << 16 ] +set AT91C_SSC_FSOS [expr 0x7 << 20 ] +set AT91C_SSC_FSOS_NONE [expr 0x0 << 20 ] +set AT91C_SSC_FSOS_NEGATIVE [expr 0x1 << 20 ] +set AT91C_SSC_FSOS_POSITIVE [expr 0x2 << 20 ] +set AT91C_SSC_FSOS_LOW [expr 0x3 << 20 ] +set AT91C_SSC_FSOS_HIGH [expr 0x4 << 20 ] +set AT91C_SSC_FSOS_TOGGLE [expr 0x5 << 20 ] +set AT91C_SSC_FSDEN [expr 0x1 << 23 ] +set AT91C_SSC_FSEDGE [expr 0x1 << 24 ] +# -------- SSC_SR : (SSC Offset: 0x40) SSC Status Register -------- +set AT91C_SSC_TXRDY [expr 0x1 << 0 ] +set AT91C_SSC_TXEMPTY [expr 0x1 << 1 ] +set AT91C_SSC_ENDTX [expr 0x1 << 2 ] +set AT91C_SSC_TXBUFE [expr 0x1 << 3 ] +set AT91C_SSC_RXRDY [expr 0x1 << 4 ] +set AT91C_SSC_OVRUN [expr 0x1 << 5 ] +set AT91C_SSC_ENDRX [expr 0x1 << 6 ] +set AT91C_SSC_RXBUFF [expr 0x1 << 7 ] +set AT91C_SSC_CP0 [expr 0x1 << 8 ] +set AT91C_SSC_CP1 [expr 0x1 << 9 ] +set AT91C_SSC_TXSYN [expr 0x1 << 10 ] +set AT91C_SSC_RXSYN [expr 0x1 << 11 ] +set AT91C_SSC_TXENA [expr 0x1 << 16 ] +set AT91C_SSC_RXENA [expr 0x1 << 17 ] +# -------- SSC_IER : (SSC Offset: 0x44) SSC Interrupt Enable Register -------- +set AT91C_SSC_TXRDY [expr 0x1 << 0 ] +set AT91C_SSC_TXEMPTY [expr 0x1 << 1 ] +set AT91C_SSC_ENDTX [expr 0x1 << 2 ] +set AT91C_SSC_TXBUFE [expr 0x1 << 3 ] +set AT91C_SSC_RXRDY [expr 0x1 << 4 ] +set AT91C_SSC_OVRUN [expr 0x1 << 5 ] +set AT91C_SSC_ENDRX [expr 0x1 << 6 ] +set AT91C_SSC_RXBUFF [expr 0x1 << 7 ] +set AT91C_SSC_CP0 [expr 0x1 << 8 ] +set AT91C_SSC_CP1 [expr 0x1 << 9 ] +set AT91C_SSC_TXSYN [expr 0x1 << 10 ] +set AT91C_SSC_RXSYN [expr 0x1 << 11 ] +# -------- SSC_IDR : (SSC Offset: 0x48) SSC Interrupt Disable Register -------- +set AT91C_SSC_TXRDY [expr 0x1 << 0 ] +set AT91C_SSC_TXEMPTY [expr 0x1 << 1 ] +set AT91C_SSC_ENDTX [expr 0x1 << 2 ] +set AT91C_SSC_TXBUFE [expr 0x1 << 3 ] +set AT91C_SSC_RXRDY [expr 0x1 << 4 ] +set AT91C_SSC_OVRUN [expr 0x1 << 5 ] +set AT91C_SSC_ENDRX [expr 0x1 << 6 ] +set AT91C_SSC_RXBUFF [expr 0x1 << 7 ] +set AT91C_SSC_CP0 [expr 0x1 << 8 ] +set AT91C_SSC_CP1 [expr 0x1 << 9 ] +set AT91C_SSC_TXSYN [expr 0x1 << 10 ] +set AT91C_SSC_RXSYN [expr 0x1 << 11 ] +# -------- SSC_IMR : (SSC Offset: 0x4c) SSC Interrupt Mask Register -------- +set AT91C_SSC_TXRDY [expr 0x1 << 0 ] +set AT91C_SSC_TXEMPTY [expr 0x1 << 1 ] +set AT91C_SSC_ENDTX [expr 0x1 << 2 ] +set AT91C_SSC_TXBUFE [expr 0x1 << 3 ] +set AT91C_SSC_RXRDY [expr 0x1 << 4 ] +set AT91C_SSC_OVRUN [expr 0x1 << 5 ] +set AT91C_SSC_ENDRX [expr 0x1 << 6 ] +set AT91C_SSC_RXBUFF [expr 0x1 << 7 ] +set AT91C_SSC_CP0 [expr 0x1 << 8 ] +set AT91C_SSC_CP1 [expr 0x1 << 9 ] +set AT91C_SSC_TXSYN [expr 0x1 << 10 ] +set AT91C_SSC_RXSYN [expr 0x1 << 11 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Two-wire Interface +# ***************************************************************************** +# -------- TWI_CR : (TWI Offset: 0x0) TWI Control Register -------- +set AT91C_TWI_START [expr 0x1 << 0 ] +set AT91C_TWI_STOP [expr 0x1 << 1 ] +set AT91C_TWI_MSEN [expr 0x1 << 2 ] +set AT91C_TWI_MSDIS [expr 0x1 << 3 ] +set AT91C_TWI_SWRST [expr 0x1 << 7 ] +# -------- TWI_MMR : (TWI Offset: 0x4) TWI Master Mode Register -------- +set AT91C_TWI_IADRSZ [expr 0x3 << 8 ] +set AT91C_TWI_IADRSZ_NO [expr 0x0 << 8 ] +set AT91C_TWI_IADRSZ_1_BYTE [expr 0x1 << 8 ] +set AT91C_TWI_IADRSZ_2_BYTE [expr 0x2 << 8 ] +set AT91C_TWI_IADRSZ_3_BYTE [expr 0x3 << 8 ] +set AT91C_TWI_MREAD [expr 0x1 << 12 ] +set AT91C_TWI_DADR [expr 0x7F << 16 ] +# -------- TWI_CWGR : (TWI Offset: 0x10) TWI Clock Waveform Generator Register -------- +set AT91C_TWI_CLDIV [expr 0xFF << 0 ] +set AT91C_TWI_CHDIV [expr 0xFF << 8 ] +set AT91C_TWI_CKDIV [expr 0x7 << 16 ] +# -------- TWI_SR : (TWI Offset: 0x20) TWI Status Register -------- +set AT91C_TWI_TXCOMP [expr 0x1 << 0 ] +set AT91C_TWI_RXRDY [expr 0x1 << 1 ] +set AT91C_TWI_TXRDY [expr 0x1 << 2 ] +set AT91C_TWI_OVRE [expr 0x1 << 6 ] +set AT91C_TWI_UNRE [expr 0x1 << 7 ] +set AT91C_TWI_NACK [expr 0x1 << 8 ] +# -------- TWI_IER : (TWI Offset: 0x24) TWI Interrupt Enable Register -------- +set AT91C_TWI_TXCOMP [expr 0x1 << 0 ] +set AT91C_TWI_RXRDY [expr 0x1 << 1 ] +set AT91C_TWI_TXRDY [expr 0x1 << 2 ] +set AT91C_TWI_OVRE [expr 0x1 << 6 ] +set AT91C_TWI_UNRE [expr 0x1 << 7 ] +set AT91C_TWI_NACK [expr 0x1 << 8 ] +# -------- TWI_IDR : (TWI Offset: 0x28) TWI Interrupt Disable Register -------- +set AT91C_TWI_TXCOMP [expr 0x1 << 0 ] +set AT91C_TWI_RXRDY [expr 0x1 << 1 ] +set AT91C_TWI_TXRDY [expr 0x1 << 2 ] +set AT91C_TWI_OVRE [expr 0x1 << 6 ] +set AT91C_TWI_UNRE [expr 0x1 << 7 ] +set AT91C_TWI_NACK [expr 0x1 << 8 ] +# -------- TWI_IMR : (TWI Offset: 0x2c) TWI Interrupt Mask Register -------- +set AT91C_TWI_TXCOMP [expr 0x1 << 0 ] +set AT91C_TWI_RXRDY [expr 0x1 << 1 ] +set AT91C_TWI_TXRDY [expr 0x1 << 2 ] +set AT91C_TWI_OVRE [expr 0x1 << 6 ] +set AT91C_TWI_UNRE [expr 0x1 << 7 ] +set AT91C_TWI_NACK [expr 0x1 << 8 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR PWMC Channel Interface +# ***************************************************************************** +# -------- PWMC_CMR : (PWMC_CH Offset: 0x0) PWMC Channel Mode Register -------- +set AT91C_PWMC_CPRE [expr 0xF << 0 ] +set AT91C_PWMC_CPRE_MCK 0x0 +set AT91C_PWMC_CPRE_MCK/2 0x1 +set AT91C_PWMC_CPRE_MCK/4 0x2 +set AT91C_PWMC_CPRE_MCK/8 0x3 +set AT91C_PWMC_CPRE_MCK/16 0x4 +set AT91C_PWMC_CPRE_MCK/32 0x5 +set AT91C_PWMC_CPRE_MCK/64 0x6 +set AT91C_PWMC_CPRE_MCK/128 0x7 +set AT91C_PWMC_CPRE_MCK/256 0x8 +set AT91C_PWMC_CPRE_MCK/512 0x9 +set AT91C_PWMC_CPRE_MCK/1024 0xA +set AT91C_PWMC_CPRE_MCKA 0xB +set AT91C_PWMC_CPRE_MCKB 0xC +set AT91C_PWMC_CALG [expr 0x1 << 8 ] +set AT91C_PWMC_CPOL [expr 0x1 << 9 ] +set AT91C_PWMC_CPD [expr 0x1 << 10 ] +# -------- PWMC_CDTYR : (PWMC_CH Offset: 0x4) PWMC Channel Duty Cycle Register -------- +set AT91C_PWMC_CDTY [expr 0x0 << 0 ] +# -------- PWMC_CPRDR : (PWMC_CH Offset: 0x8) PWMC Channel Period Register -------- +set AT91C_PWMC_CPRD [expr 0x0 << 0 ] +# -------- PWMC_CCNTR : (PWMC_CH Offset: 0xc) PWMC Channel Counter Register -------- +set AT91C_PWMC_CCNT [expr 0x0 << 0 ] +# -------- PWMC_CUPDR : (PWMC_CH Offset: 0x10) PWMC Channel Update Register -------- +set AT91C_PWMC_CUPD [expr 0x0 << 0 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Pulse Width Modulation Controller Interface +# ***************************************************************************** +# -------- PWMC_MR : (PWMC Offset: 0x0) PWMC Mode Register -------- +set AT91C_PWMC_DIVA [expr 0xFF << 0 ] +set AT91C_PWMC_PREA [expr 0xF << 8 ] +set AT91C_PWMC_PREA_MCK [expr 0x0 << 8 ] +set AT91C_PWMC_PREA_MCK/2 [expr 0x1 << 8 ] +set AT91C_PWMC_PREA_MCK/4 [expr 0x2 << 8 ] +set AT91C_PWMC_PREA_MCK/8 [expr 0x3 << 8 ] +set AT91C_PWMC_PREA_MCK/16 [expr 0x4 << 8 ] +set AT91C_PWMC_PREA_MCK/32 [expr 0x5 << 8 ] +set AT91C_PWMC_PREA_MCK/64 [expr 0x6 << 8 ] +set AT91C_PWMC_PREA_MCK/128 [expr 0x7 << 8 ] +set AT91C_PWMC_PREA_MCK/256 [expr 0x8 << 8 ] +set AT91C_PWMC_DIVB [expr 0xFF << 16 ] +set AT91C_PWMC_PREB [expr 0xF << 24 ] +set AT91C_PWMC_PREB_MCK [expr 0x0 << 24 ] +set AT91C_PWMC_PREB_MCK/2 [expr 0x1 << 24 ] +set AT91C_PWMC_PREB_MCK/4 [expr 0x2 << 24 ] +set AT91C_PWMC_PREB_MCK/8 [expr 0x3 << 24 ] +set AT91C_PWMC_PREB_MCK/16 [expr 0x4 << 24 ] +set AT91C_PWMC_PREB_MCK/32 [expr 0x5 << 24 ] +set AT91C_PWMC_PREB_MCK/64 [expr 0x6 << 24 ] +set AT91C_PWMC_PREB_MCK/128 [expr 0x7 << 24 ] +set AT91C_PWMC_PREB_MCK/256 [expr 0x8 << 24 ] +# -------- PWMC_ENA : (PWMC Offset: 0x4) PWMC Enable Register -------- +set AT91C_PWMC_CHID0 [expr 0x1 << 0 ] +set AT91C_PWMC_CHID1 [expr 0x1 << 1 ] +set AT91C_PWMC_CHID2 [expr 0x1 << 2 ] +set AT91C_PWMC_CHID3 [expr 0x1 << 3 ] +# -------- PWMC_DIS : (PWMC Offset: 0x8) PWMC Disable Register -------- +set AT91C_PWMC_CHID0 [expr 0x1 << 0 ] +set AT91C_PWMC_CHID1 [expr 0x1 << 1 ] +set AT91C_PWMC_CHID2 [expr 0x1 << 2 ] +set AT91C_PWMC_CHID3 [expr 0x1 << 3 ] +# -------- PWMC_SR : (PWMC Offset: 0xc) PWMC Status Register -------- +set AT91C_PWMC_CHID0 [expr 0x1 << 0 ] +set AT91C_PWMC_CHID1 [expr 0x1 << 1 ] +set AT91C_PWMC_CHID2 [expr 0x1 << 2 ] +set AT91C_PWMC_CHID3 [expr 0x1 << 3 ] +# -------- PWMC_IER : (PWMC Offset: 0x10) PWMC Interrupt Enable Register -------- +set AT91C_PWMC_CHID0 [expr 0x1 << 0 ] +set AT91C_PWMC_CHID1 [expr 0x1 << 1 ] +set AT91C_PWMC_CHID2 [expr 0x1 << 2 ] +set AT91C_PWMC_CHID3 [expr 0x1 << 3 ] +# -------- PWMC_IDR : (PWMC Offset: 0x14) PWMC Interrupt Disable Register -------- +set AT91C_PWMC_CHID0 [expr 0x1 << 0 ] +set AT91C_PWMC_CHID1 [expr 0x1 << 1 ] +set AT91C_PWMC_CHID2 [expr 0x1 << 2 ] +set AT91C_PWMC_CHID3 [expr 0x1 << 3 ] +# -------- PWMC_IMR : (PWMC Offset: 0x18) PWMC Interrupt Mask Register -------- +set AT91C_PWMC_CHID0 [expr 0x1 << 0 ] +set AT91C_PWMC_CHID1 [expr 0x1 << 1 ] +set AT91C_PWMC_CHID2 [expr 0x1 << 2 ] +set AT91C_PWMC_CHID3 [expr 0x1 << 3 ] +# -------- PWMC_ISR : (PWMC Offset: 0x1c) PWMC Interrupt Status Register -------- +set AT91C_PWMC_CHID0 [expr 0x1 << 0 ] +set AT91C_PWMC_CHID1 [expr 0x1 << 1 ] +set AT91C_PWMC_CHID2 [expr 0x1 << 2 ] +set AT91C_PWMC_CHID3 [expr 0x1 << 3 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR USB Device Interface +# ***************************************************************************** +# -------- UDP_FRM_NUM : (UDP Offset: 0x0) USB Frame Number Register -------- +set AT91C_UDP_FRM_NUM [expr 0x7FF << 0 ] +set AT91C_UDP_FRM_ERR [expr 0x1 << 16 ] +set AT91C_UDP_FRM_OK [expr 0x1 << 17 ] +# -------- UDP_GLB_STATE : (UDP Offset: 0x4) USB Global State Register -------- +set AT91C_UDP_FADDEN [expr 0x1 << 0 ] +set AT91C_UDP_CONFG [expr 0x1 << 1 ] +set AT91C_UDP_ESR [expr 0x1 << 2 ] +set AT91C_UDP_RSMINPR [expr 0x1 << 3 ] +set AT91C_UDP_RMWUPE [expr 0x1 << 4 ] +# -------- UDP_FADDR : (UDP Offset: 0x8) USB Function Address Register -------- +set AT91C_UDP_FADD [expr 0xFF << 0 ] +set AT91C_UDP_FEN [expr 0x1 << 8 ] +# -------- UDP_IER : (UDP Offset: 0x10) USB Interrupt Enable Register -------- +set AT91C_UDP_EPINT0 [expr 0x1 << 0 ] +set AT91C_UDP_EPINT1 [expr 0x1 << 1 ] +set AT91C_UDP_EPINT2 [expr 0x1 << 2 ] +set AT91C_UDP_EPINT3 [expr 0x1 << 3 ] +set AT91C_UDP_EPINT4 [expr 0x1 << 4 ] +set AT91C_UDP_EPINT5 [expr 0x1 << 5 ] +set AT91C_UDP_RXSUSP [expr 0x1 << 8 ] +set AT91C_UDP_RXRSM [expr 0x1 << 9 ] +set AT91C_UDP_EXTRSM [expr 0x1 << 10 ] +set AT91C_UDP_SOFINT [expr 0x1 << 11 ] +set AT91C_UDP_WAKEUP [expr 0x1 << 13 ] +# -------- UDP_IDR : (UDP Offset: 0x14) USB Interrupt Disable Register -------- +set AT91C_UDP_EPINT0 [expr 0x1 << 0 ] +set AT91C_UDP_EPINT1 [expr 0x1 << 1 ] +set AT91C_UDP_EPINT2 [expr 0x1 << 2 ] +set AT91C_UDP_EPINT3 [expr 0x1 << 3 ] +set AT91C_UDP_EPINT4 [expr 0x1 << 4 ] +set AT91C_UDP_EPINT5 [expr 0x1 << 5 ] +set AT91C_UDP_RXSUSP [expr 0x1 << 8 ] +set AT91C_UDP_RXRSM [expr 0x1 << 9 ] +set AT91C_UDP_EXTRSM [expr 0x1 << 10 ] +set AT91C_UDP_SOFINT [expr 0x1 << 11 ] +set AT91C_UDP_WAKEUP [expr 0x1 << 13 ] +# -------- UDP_IMR : (UDP Offset: 0x18) USB Interrupt Mask Register -------- +set AT91C_UDP_EPINT0 [expr 0x1 << 0 ] +set AT91C_UDP_EPINT1 [expr 0x1 << 1 ] +set AT91C_UDP_EPINT2 [expr 0x1 << 2 ] +set AT91C_UDP_EPINT3 [expr 0x1 << 3 ] +set AT91C_UDP_EPINT4 [expr 0x1 << 4 ] +set AT91C_UDP_EPINT5 [expr 0x1 << 5 ] +set AT91C_UDP_RXSUSP [expr 0x1 << 8 ] +set AT91C_UDP_RXRSM [expr 0x1 << 9 ] +set AT91C_UDP_EXTRSM [expr 0x1 << 10 ] +set AT91C_UDP_SOFINT [expr 0x1 << 11 ] +set AT91C_UDP_WAKEUP [expr 0x1 << 13 ] +# -------- UDP_ISR : (UDP Offset: 0x1c) USB Interrupt Status Register -------- +set AT91C_UDP_EPINT0 [expr 0x1 << 0 ] +set AT91C_UDP_EPINT1 [expr 0x1 << 1 ] +set AT91C_UDP_EPINT2 [expr 0x1 << 2 ] +set AT91C_UDP_EPINT3 [expr 0x1 << 3 ] +set AT91C_UDP_EPINT4 [expr 0x1 << 4 ] +set AT91C_UDP_EPINT5 [expr 0x1 << 5 ] +set AT91C_UDP_RXSUSP [expr 0x1 << 8 ] +set AT91C_UDP_RXRSM [expr 0x1 << 9 ] +set AT91C_UDP_EXTRSM [expr 0x1 << 10 ] +set AT91C_UDP_SOFINT [expr 0x1 << 11 ] +set AT91C_UDP_ENDBUSRES [expr 0x1 << 12 ] +set AT91C_UDP_WAKEUP [expr 0x1 << 13 ] +# -------- UDP_ICR : (UDP Offset: 0x20) USB Interrupt Clear Register -------- +set AT91C_UDP_EPINT0 [expr 0x1 << 0 ] +set AT91C_UDP_EPINT1 [expr 0x1 << 1 ] +set AT91C_UDP_EPINT2 [expr 0x1 << 2 ] +set AT91C_UDP_EPINT3 [expr 0x1 << 3 ] +set AT91C_UDP_EPINT4 [expr 0x1 << 4 ] +set AT91C_UDP_EPINT5 [expr 0x1 << 5 ] +set AT91C_UDP_RXSUSP [expr 0x1 << 8 ] +set AT91C_UDP_RXRSM [expr 0x1 << 9 ] +set AT91C_UDP_EXTRSM [expr 0x1 << 10 ] +set AT91C_UDP_SOFINT [expr 0x1 << 11 ] +set AT91C_UDP_WAKEUP [expr 0x1 << 13 ] +# -------- UDP_RST_EP : (UDP Offset: 0x28) USB Reset Endpoint Register -------- +set AT91C_UDP_EP0 [expr 0x1 << 0 ] +set AT91C_UDP_EP1 [expr 0x1 << 1 ] +set AT91C_UDP_EP2 [expr 0x1 << 2 ] +set AT91C_UDP_EP3 [expr 0x1 << 3 ] +set AT91C_UDP_EP4 [expr 0x1 << 4 ] +set AT91C_UDP_EP5 [expr 0x1 << 5 ] +# -------- UDP_CSR : (UDP Offset: 0x30) USB Endpoint Control and Status Register -------- +set AT91C_UDP_TXCOMP [expr 0x1 << 0 ] +set AT91C_UDP_RX_DATA_BK0 [expr 0x1 << 1 ] +set AT91C_UDP_RXSETUP [expr 0x1 << 2 ] +set AT91C_UDP_ISOERROR [expr 0x1 << 3 ] +set AT91C_UDP_TXPKTRDY [expr 0x1 << 4 ] +set AT91C_UDP_FORCESTALL [expr 0x1 << 5 ] +set AT91C_UDP_RX_DATA_BK1 [expr 0x1 << 6 ] +set AT91C_UDP_DIR [expr 0x1 << 7 ] +set AT91C_UDP_EPTYPE [expr 0x7 << 8 ] +set AT91C_UDP_EPTYPE_CTRL [expr 0x0 << 8 ] +set AT91C_UDP_EPTYPE_ISO_OUT [expr 0x1 << 8 ] +set AT91C_UDP_EPTYPE_BULK_OUT [expr 0x2 << 8 ] +set AT91C_UDP_EPTYPE_INT_OUT [expr 0x3 << 8 ] +set AT91C_UDP_EPTYPE_ISO_IN [expr 0x5 << 8 ] +set AT91C_UDP_EPTYPE_BULK_IN [expr 0x6 << 8 ] +set AT91C_UDP_EPTYPE_INT_IN [expr 0x7 << 8 ] +set AT91C_UDP_DTGLE [expr 0x1 << 11 ] +set AT91C_UDP_EPEDS [expr 0x1 << 15 ] +set AT91C_UDP_RXBYTECNT [expr 0x7FF << 16 ] +# -------- UDP_TXVC : (UDP Offset: 0x74) Transceiver Control Register -------- +set AT91C_UDP_TXVDIS [expr 0x1 << 8 ] +set AT91C_UDP_PUON [expr 0x1 << 9 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Timer Counter Channel Interface +# ***************************************************************************** +# -------- TC_CCR : (TC Offset: 0x0) TC Channel Control Register -------- +set AT91C_TC_CLKEN [expr 0x1 << 0 ] +set AT91C_TC_CLKDIS [expr 0x1 << 1 ] +set AT91C_TC_SWTRG [expr 0x1 << 2 ] +# -------- TC_CMR : (TC Offset: 0x4) TC Channel Mode Register: Capture Mode / Waveform Mode -------- +set AT91C_TC_CLKS [expr 0x7 << 0 ] +set AT91C_TC_CLKS_TIMER_DIV1_CLOCK 0x0 +set AT91C_TC_CLKS_TIMER_DIV2_CLOCK 0x1 +set AT91C_TC_CLKS_TIMER_DIV3_CLOCK 0x2 +set AT91C_TC_CLKS_TIMER_DIV4_CLOCK 0x3 +set AT91C_TC_CLKS_TIMER_DIV5_CLOCK 0x4 +set AT91C_TC_CLKS_XC0 0x5 +set AT91C_TC_CLKS_XC1 0x6 +set AT91C_TC_CLKS_XC2 0x7 +set AT91C_TC_CLKS [expr 0x7 << 0 ] +set AT91C_TC_CLKS_TIMER_DIV1_CLOCK 0x0 +set AT91C_TC_CLKS_TIMER_DIV2_CLOCK 0x1 +set AT91C_TC_CLKS_TIMER_DIV3_CLOCK 0x2 +set AT91C_TC_CLKS_TIMER_DIV4_CLOCK 0x3 +set AT91C_TC_CLKS_TIMER_DIV5_CLOCK 0x4 +set AT91C_TC_CLKS_XC0 0x5 +set AT91C_TC_CLKS_XC1 0x6 +set AT91C_TC_CLKS_XC2 0x7 +set AT91C_TC_CLKI [expr 0x1 << 3 ] +set AT91C_TC_CLKI [expr 0x1 << 3 ] +set AT91C_TC_BURST [expr 0x3 << 4 ] +set AT91C_TC_BURST_NONE [expr 0x0 << 4 ] +set AT91C_TC_BURST_XC0 [expr 0x1 << 4 ] +set AT91C_TC_BURST_XC1 [expr 0x2 << 4 ] +set AT91C_TC_BURST_XC2 [expr 0x3 << 4 ] +set AT91C_TC_BURST [expr 0x3 << 4 ] +set AT91C_TC_BURST_NONE [expr 0x0 << 4 ] +set AT91C_TC_BURST_XC0 [expr 0x1 << 4 ] +set AT91C_TC_BURST_XC1 [expr 0x2 << 4 ] +set AT91C_TC_BURST_XC2 [expr 0x3 << 4 ] +set AT91C_TC_CPCSTOP [expr 0x1 << 6 ] +set AT91C_TC_LDBSTOP [expr 0x1 << 6 ] +set AT91C_TC_CPCDIS [expr 0x1 << 7 ] +set AT91C_TC_LDBDIS [expr 0x1 << 7 ] +set AT91C_TC_ETRGEDG [expr 0x3 << 8 ] +set AT91C_TC_ETRGEDG_NONE [expr 0x0 << 8 ] +set AT91C_TC_ETRGEDG_RISING [expr 0x1 << 8 ] +set AT91C_TC_ETRGEDG_FALLING [expr 0x2 << 8 ] +set AT91C_TC_ETRGEDG_BOTH [expr 0x3 << 8 ] +set AT91C_TC_EEVTEDG [expr 0x3 << 8 ] +set AT91C_TC_EEVTEDG_NONE [expr 0x0 << 8 ] +set AT91C_TC_EEVTEDG_RISING [expr 0x1 << 8 ] +set AT91C_TC_EEVTEDG_FALLING [expr 0x2 << 8 ] +set AT91C_TC_EEVTEDG_BOTH [expr 0x3 << 8 ] +set AT91C_TC_EEVT [expr 0x3 << 10 ] +set AT91C_TC_EEVT_TIOB [expr 0x0 << 10 ] +set AT91C_TC_EEVT_XC0 [expr 0x1 << 10 ] +set AT91C_TC_EEVT_XC1 [expr 0x2 << 10 ] +set AT91C_TC_EEVT_XC2 [expr 0x3 << 10 ] +set AT91C_TC_ABETRG [expr 0x1 << 10 ] +set AT91C_TC_ENETRG [expr 0x1 << 12 ] +set AT91C_TC_WAVESEL [expr 0x3 << 13 ] +set AT91C_TC_WAVESEL_UP [expr 0x0 << 13 ] +set AT91C_TC_WAVESEL_UPDOWN [expr 0x1 << 13 ] +set AT91C_TC_WAVESEL_UP_AUTO [expr 0x2 << 13 ] +set AT91C_TC_WAVESEL_UPDOWN_AUTO [expr 0x3 << 13 ] +set AT91C_TC_CPCTRG [expr 0x1 << 14 ] +set AT91C_TC_WAVE [expr 0x1 << 15 ] +set AT91C_TC_WAVE [expr 0x1 << 15 ] +set AT91C_TC_ACPA [expr 0x3 << 16 ] +set AT91C_TC_ACPA_NONE [expr 0x0 << 16 ] +set AT91C_TC_ACPA_SET [expr 0x1 << 16 ] +set AT91C_TC_ACPA_CLEAR [expr 0x2 << 16 ] +set AT91C_TC_ACPA_TOGGLE [expr 0x3 << 16 ] +set AT91C_TC_LDRA [expr 0x3 << 16 ] +set AT91C_TC_LDRA_NONE [expr 0x0 << 16 ] +set AT91C_TC_LDRA_RISING [expr 0x1 << 16 ] +set AT91C_TC_LDRA_FALLING [expr 0x2 << 16 ] +set AT91C_TC_LDRA_BOTH [expr 0x3 << 16 ] +set AT91C_TC_ACPC [expr 0x3 << 18 ] +set AT91C_TC_ACPC_NONE [expr 0x0 << 18 ] +set AT91C_TC_ACPC_SET [expr 0x1 << 18 ] +set AT91C_TC_ACPC_CLEAR [expr 0x2 << 18 ] +set AT91C_TC_ACPC_TOGGLE [expr 0x3 << 18 ] +set AT91C_TC_LDRB [expr 0x3 << 18 ] +set AT91C_TC_LDRB_NONE [expr 0x0 << 18 ] +set AT91C_TC_LDRB_RISING [expr 0x1 << 18 ] +set AT91C_TC_LDRB_FALLING [expr 0x2 << 18 ] +set AT91C_TC_LDRB_BOTH [expr 0x3 << 18 ] +set AT91C_TC_AEEVT [expr 0x3 << 20 ] +set AT91C_TC_AEEVT_NONE [expr 0x0 << 20 ] +set AT91C_TC_AEEVT_SET [expr 0x1 << 20 ] +set AT91C_TC_AEEVT_CLEAR [expr 0x2 << 20 ] +set AT91C_TC_AEEVT_TOGGLE [expr 0x3 << 20 ] +set AT91C_TC_ASWTRG [expr 0x3 << 22 ] +set AT91C_TC_ASWTRG_NONE [expr 0x0 << 22 ] +set AT91C_TC_ASWTRG_SET [expr 0x1 << 22 ] +set AT91C_TC_ASWTRG_CLEAR [expr 0x2 << 22 ] +set AT91C_TC_ASWTRG_TOGGLE [expr 0x3 << 22 ] +set AT91C_TC_BCPB [expr 0x3 << 24 ] +set AT91C_TC_BCPB_NONE [expr 0x0 << 24 ] +set AT91C_TC_BCPB_SET [expr 0x1 << 24 ] +set AT91C_TC_BCPB_CLEAR [expr 0x2 << 24 ] +set AT91C_TC_BCPB_TOGGLE [expr 0x3 << 24 ] +set AT91C_TC_BCPC [expr 0x3 << 26 ] +set AT91C_TC_BCPC_NONE [expr 0x0 << 26 ] +set AT91C_TC_BCPC_SET [expr 0x1 << 26 ] +set AT91C_TC_BCPC_CLEAR [expr 0x2 << 26 ] +set AT91C_TC_BCPC_TOGGLE [expr 0x3 << 26 ] +set AT91C_TC_BEEVT [expr 0x3 << 28 ] +set AT91C_TC_BEEVT_NONE [expr 0x0 << 28 ] +set AT91C_TC_BEEVT_SET [expr 0x1 << 28 ] +set AT91C_TC_BEEVT_CLEAR [expr 0x2 << 28 ] +set AT91C_TC_BEEVT_TOGGLE [expr 0x3 << 28 ] +set AT91C_TC_BSWTRG [expr 0x3 << 30 ] +set AT91C_TC_BSWTRG_NONE [expr 0x0 << 30 ] +set AT91C_TC_BSWTRG_SET [expr 0x1 << 30 ] +set AT91C_TC_BSWTRG_CLEAR [expr 0x2 << 30 ] +set AT91C_TC_BSWTRG_TOGGLE [expr 0x3 << 30 ] +# -------- TC_SR : (TC Offset: 0x20) TC Channel Status Register -------- +set AT91C_TC_COVFS [expr 0x1 << 0 ] +set AT91C_TC_LOVRS [expr 0x1 << 1 ] +set AT91C_TC_CPAS [expr 0x1 << 2 ] +set AT91C_TC_CPBS [expr 0x1 << 3 ] +set AT91C_TC_CPCS [expr 0x1 << 4 ] +set AT91C_TC_LDRAS [expr 0x1 << 5 ] +set AT91C_TC_LDRBS [expr 0x1 << 6 ] +set AT91C_TC_ETRGS [expr 0x1 << 7 ] +set AT91C_TC_CLKSTA [expr 0x1 << 16 ] +set AT91C_TC_MTIOA [expr 0x1 << 17 ] +set AT91C_TC_MTIOB [expr 0x1 << 18 ] +# -------- TC_IER : (TC Offset: 0x24) TC Channel Interrupt Enable Register -------- +set AT91C_TC_COVFS [expr 0x1 << 0 ] +set AT91C_TC_LOVRS [expr 0x1 << 1 ] +set AT91C_TC_CPAS [expr 0x1 << 2 ] +set AT91C_TC_CPBS [expr 0x1 << 3 ] +set AT91C_TC_CPCS [expr 0x1 << 4 ] +set AT91C_TC_LDRAS [expr 0x1 << 5 ] +set AT91C_TC_LDRBS [expr 0x1 << 6 ] +set AT91C_TC_ETRGS [expr 0x1 << 7 ] +# -------- TC_IDR : (TC Offset: 0x28) TC Channel Interrupt Disable Register -------- +set AT91C_TC_COVFS [expr 0x1 << 0 ] +set AT91C_TC_LOVRS [expr 0x1 << 1 ] +set AT91C_TC_CPAS [expr 0x1 << 2 ] +set AT91C_TC_CPBS [expr 0x1 << 3 ] +set AT91C_TC_CPCS [expr 0x1 << 4 ] +set AT91C_TC_LDRAS [expr 0x1 << 5 ] +set AT91C_TC_LDRBS [expr 0x1 << 6 ] +set AT91C_TC_ETRGS [expr 0x1 << 7 ] +# -------- TC_IMR : (TC Offset: 0x2c) TC Channel Interrupt Mask Register -------- +set AT91C_TC_COVFS [expr 0x1 << 0 ] +set AT91C_TC_LOVRS [expr 0x1 << 1 ] +set AT91C_TC_CPAS [expr 0x1 << 2 ] +set AT91C_TC_CPBS [expr 0x1 << 3 ] +set AT91C_TC_CPCS [expr 0x1 << 4 ] +set AT91C_TC_LDRAS [expr 0x1 << 5 ] +set AT91C_TC_LDRBS [expr 0x1 << 6 ] +set AT91C_TC_ETRGS [expr 0x1 << 7 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Timer Counter Interface +# ***************************************************************************** +# -------- TCB_BCR : (TCB Offset: 0xc0) TC Block Control Register -------- +set AT91C_TCB_SYNC [expr 0x1 << 0 ] +# -------- TCB_BMR : (TCB Offset: 0xc4) TC Block Mode Register -------- +set AT91C_TCB_TC0XC0S [expr 0x3 << 0 ] +set AT91C_TCB_TC0XC0S_TCLK0 0x0 +set AT91C_TCB_TC0XC0S_NONE 0x1 +set AT91C_TCB_TC0XC0S_TIOA1 0x2 +set AT91C_TCB_TC0XC0S_TIOA2 0x3 +set AT91C_TCB_TC1XC1S [expr 0x3 << 2 ] +set AT91C_TCB_TC1XC1S_TCLK1 [expr 0x0 << 2 ] +set AT91C_TCB_TC1XC1S_NONE [expr 0x1 << 2 ] +set AT91C_TCB_TC1XC1S_TIOA0 [expr 0x2 << 2 ] +set AT91C_TCB_TC1XC1S_TIOA2 [expr 0x3 << 2 ] +set AT91C_TCB_TC2XC2S [expr 0x3 << 4 ] +set AT91C_TCB_TC2XC2S_TCLK2 [expr 0x0 << 4 ] +set AT91C_TCB_TC2XC2S_NONE [expr 0x1 << 4 ] +set AT91C_TCB_TC2XC2S_TIOA0 [expr 0x2 << 4 ] +set AT91C_TCB_TC2XC2S_TIOA1 [expr 0x3 << 4 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Control Area Network MailBox Interface +# ***************************************************************************** +# -------- CAN_MMR : (CAN_MB Offset: 0x0) CAN Message Mode Register -------- +set AT91C_CAN_MTIMEMARK [expr 0xFFFF << 0 ] +set AT91C_CAN_PRIOR [expr 0xF << 16 ] +set AT91C_CAN_MOT [expr 0x7 << 24 ] +set AT91C_CAN_MOT_DIS [expr 0x0 << 24 ] +set AT91C_CAN_MOT_RX [expr 0x1 << 24 ] +set AT91C_CAN_MOT_RXOVERWRITE [expr 0x2 << 24 ] +set AT91C_CAN_MOT_TX [expr 0x3 << 24 ] +set AT91C_CAN_MOT_CONSUMER [expr 0x4 << 24 ] +set AT91C_CAN_MOT_PRODUCER [expr 0x5 << 24 ] +# -------- CAN_MAM : (CAN_MB Offset: 0x4) CAN Message Acceptance Mask Register -------- +set AT91C_CAN_MIDvB [expr 0x3FFFF << 0 ] +set AT91C_CAN_MIDvA [expr 0x7FF << 18 ] +set AT91C_CAN_MIDE [expr 0x1 << 29 ] +# -------- CAN_MID : (CAN_MB Offset: 0x8) CAN Message ID Register -------- +set AT91C_CAN_MIDvB [expr 0x3FFFF << 0 ] +set AT91C_CAN_MIDvA [expr 0x7FF << 18 ] +set AT91C_CAN_MIDE [expr 0x1 << 29 ] +# -------- CAN_MFID : (CAN_MB Offset: 0xc) CAN Message Family ID Register -------- +# -------- CAN_MSR : (CAN_MB Offset: 0x10) CAN Message Status Register -------- +set AT91C_CAN_MTIMESTAMP [expr 0xFFFF << 0 ] +set AT91C_CAN_MDLC [expr 0xF << 16 ] +set AT91C_CAN_MRTR [expr 0x1 << 20 ] +set AT91C_CAN_MABT [expr 0x1 << 22 ] +set AT91C_CAN_MRDY [expr 0x1 << 23 ] +set AT91C_CAN_MMI [expr 0x1 << 24 ] +# -------- CAN_MDL : (CAN_MB Offset: 0x14) CAN Message Data Low Register -------- +# -------- CAN_MDH : (CAN_MB Offset: 0x18) CAN Message Data High Register -------- +# -------- CAN_MCR : (CAN_MB Offset: 0x1c) CAN Message Control Register -------- +set AT91C_CAN_MDLC [expr 0xF << 16 ] +set AT91C_CAN_MRTR [expr 0x1 << 20 ] +set AT91C_CAN_MACR [expr 0x1 << 22 ] +set AT91C_CAN_MTCR [expr 0x1 << 23 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Control Area Network Interface +# ***************************************************************************** +# -------- CAN_MR : (CAN Offset: 0x0) CAN Mode Register -------- +set AT91C_CAN_CANEN [expr 0x1 << 0 ] +set AT91C_CAN_LPM [expr 0x1 << 1 ] +set AT91C_CAN_ABM [expr 0x1 << 2 ] +set AT91C_CAN_OVL [expr 0x1 << 3 ] +set AT91C_CAN_TEOF [expr 0x1 << 4 ] +set AT91C_CAN_TTM [expr 0x1 << 5 ] +set AT91C_CAN_TIMFRZ [expr 0x1 << 6 ] +set AT91C_CAN_DRPT [expr 0x1 << 7 ] +# -------- CAN_IER : (CAN Offset: 0x4) CAN Interrupt Enable Register -------- +set AT91C_CAN_MB0 [expr 0x1 << 0 ] +set AT91C_CAN_MB1 [expr 0x1 << 1 ] +set AT91C_CAN_MB2 [expr 0x1 << 2 ] +set AT91C_CAN_MB3 [expr 0x1 << 3 ] +set AT91C_CAN_MB4 [expr 0x1 << 4 ] +set AT91C_CAN_MB5 [expr 0x1 << 5 ] +set AT91C_CAN_MB6 [expr 0x1 << 6 ] +set AT91C_CAN_MB7 [expr 0x1 << 7 ] +set AT91C_CAN_MB8 [expr 0x1 << 8 ] +set AT91C_CAN_MB9 [expr 0x1 << 9 ] +set AT91C_CAN_MB10 [expr 0x1 << 10 ] +set AT91C_CAN_MB11 [expr 0x1 << 11 ] +set AT91C_CAN_MB12 [expr 0x1 << 12 ] +set AT91C_CAN_MB13 [expr 0x1 << 13 ] +set AT91C_CAN_MB14 [expr 0x1 << 14 ] +set AT91C_CAN_MB15 [expr 0x1 << 15 ] +set AT91C_CAN_ERRA [expr 0x1 << 16 ] +set AT91C_CAN_WARN [expr 0x1 << 17 ] +set AT91C_CAN_ERRP [expr 0x1 << 18 ] +set AT91C_CAN_BOFF [expr 0x1 << 19 ] +set AT91C_CAN_SLEEP [expr 0x1 << 20 ] +set AT91C_CAN_WAKEUP [expr 0x1 << 21 ] +set AT91C_CAN_TOVF [expr 0x1 << 22 ] +set AT91C_CAN_TSTP [expr 0x1 << 23 ] +set AT91C_CAN_CERR [expr 0x1 << 24 ] +set AT91C_CAN_SERR [expr 0x1 << 25 ] +set AT91C_CAN_AERR [expr 0x1 << 26 ] +set AT91C_CAN_FERR [expr 0x1 << 27 ] +set AT91C_CAN_BERR [expr 0x1 << 28 ] +# -------- CAN_IDR : (CAN Offset: 0x8) CAN Interrupt Disable Register -------- +set AT91C_CAN_MB0 [expr 0x1 << 0 ] +set AT91C_CAN_MB1 [expr 0x1 << 1 ] +set AT91C_CAN_MB2 [expr 0x1 << 2 ] +set AT91C_CAN_MB3 [expr 0x1 << 3 ] +set AT91C_CAN_MB4 [expr 0x1 << 4 ] +set AT91C_CAN_MB5 [expr 0x1 << 5 ] +set AT91C_CAN_MB6 [expr 0x1 << 6 ] +set AT91C_CAN_MB7 [expr 0x1 << 7 ] +set AT91C_CAN_MB8 [expr 0x1 << 8 ] +set AT91C_CAN_MB9 [expr 0x1 << 9 ] +set AT91C_CAN_MB10 [expr 0x1 << 10 ] +set AT91C_CAN_MB11 [expr 0x1 << 11 ] +set AT91C_CAN_MB12 [expr 0x1 << 12 ] +set AT91C_CAN_MB13 [expr 0x1 << 13 ] +set AT91C_CAN_MB14 [expr 0x1 << 14 ] +set AT91C_CAN_MB15 [expr 0x1 << 15 ] +set AT91C_CAN_ERRA [expr 0x1 << 16 ] +set AT91C_CAN_WARN [expr 0x1 << 17 ] +set AT91C_CAN_ERRP [expr 0x1 << 18 ] +set AT91C_CAN_BOFF [expr 0x1 << 19 ] +set AT91C_CAN_SLEEP [expr 0x1 << 20 ] +set AT91C_CAN_WAKEUP [expr 0x1 << 21 ] +set AT91C_CAN_TOVF [expr 0x1 << 22 ] +set AT91C_CAN_TSTP [expr 0x1 << 23 ] +set AT91C_CAN_CERR [expr 0x1 << 24 ] +set AT91C_CAN_SERR [expr 0x1 << 25 ] +set AT91C_CAN_AERR [expr 0x1 << 26 ] +set AT91C_CAN_FERR [expr 0x1 << 27 ] +set AT91C_CAN_BERR [expr 0x1 << 28 ] +# -------- CAN_IMR : (CAN Offset: 0xc) CAN Interrupt Mask Register -------- +set AT91C_CAN_MB0 [expr 0x1 << 0 ] +set AT91C_CAN_MB1 [expr 0x1 << 1 ] +set AT91C_CAN_MB2 [expr 0x1 << 2 ] +set AT91C_CAN_MB3 [expr 0x1 << 3 ] +set AT91C_CAN_MB4 [expr 0x1 << 4 ] +set AT91C_CAN_MB5 [expr 0x1 << 5 ] +set AT91C_CAN_MB6 [expr 0x1 << 6 ] +set AT91C_CAN_MB7 [expr 0x1 << 7 ] +set AT91C_CAN_MB8 [expr 0x1 << 8 ] +set AT91C_CAN_MB9 [expr 0x1 << 9 ] +set AT91C_CAN_MB10 [expr 0x1 << 10 ] +set AT91C_CAN_MB11 [expr 0x1 << 11 ] +set AT91C_CAN_MB12 [expr 0x1 << 12 ] +set AT91C_CAN_MB13 [expr 0x1 << 13 ] +set AT91C_CAN_MB14 [expr 0x1 << 14 ] +set AT91C_CAN_MB15 [expr 0x1 << 15 ] +set AT91C_CAN_ERRA [expr 0x1 << 16 ] +set AT91C_CAN_WARN [expr 0x1 << 17 ] +set AT91C_CAN_ERRP [expr 0x1 << 18 ] +set AT91C_CAN_BOFF [expr 0x1 << 19 ] +set AT91C_CAN_SLEEP [expr 0x1 << 20 ] +set AT91C_CAN_WAKEUP [expr 0x1 << 21 ] +set AT91C_CAN_TOVF [expr 0x1 << 22 ] +set AT91C_CAN_TSTP [expr 0x1 << 23 ] +set AT91C_CAN_CERR [expr 0x1 << 24 ] +set AT91C_CAN_SERR [expr 0x1 << 25 ] +set AT91C_CAN_AERR [expr 0x1 << 26 ] +set AT91C_CAN_FERR [expr 0x1 << 27 ] +set AT91C_CAN_BERR [expr 0x1 << 28 ] +# -------- CAN_SR : (CAN Offset: 0x10) CAN Status Register -------- +set AT91C_CAN_MB0 [expr 0x1 << 0 ] +set AT91C_CAN_MB1 [expr 0x1 << 1 ] +set AT91C_CAN_MB2 [expr 0x1 << 2 ] +set AT91C_CAN_MB3 [expr 0x1 << 3 ] +set AT91C_CAN_MB4 [expr 0x1 << 4 ] +set AT91C_CAN_MB5 [expr 0x1 << 5 ] +set AT91C_CAN_MB6 [expr 0x1 << 6 ] +set AT91C_CAN_MB7 [expr 0x1 << 7 ] +set AT91C_CAN_MB8 [expr 0x1 << 8 ] +set AT91C_CAN_MB9 [expr 0x1 << 9 ] +set AT91C_CAN_MB10 [expr 0x1 << 10 ] +set AT91C_CAN_MB11 [expr 0x1 << 11 ] +set AT91C_CAN_MB12 [expr 0x1 << 12 ] +set AT91C_CAN_MB13 [expr 0x1 << 13 ] +set AT91C_CAN_MB14 [expr 0x1 << 14 ] +set AT91C_CAN_MB15 [expr 0x1 << 15 ] +set AT91C_CAN_ERRA [expr 0x1 << 16 ] +set AT91C_CAN_WARN [expr 0x1 << 17 ] +set AT91C_CAN_ERRP [expr 0x1 << 18 ] +set AT91C_CAN_BOFF [expr 0x1 << 19 ] +set AT91C_CAN_SLEEP [expr 0x1 << 20 ] +set AT91C_CAN_WAKEUP [expr 0x1 << 21 ] +set AT91C_CAN_TOVF [expr 0x1 << 22 ] +set AT91C_CAN_TSTP [expr 0x1 << 23 ] +set AT91C_CAN_CERR [expr 0x1 << 24 ] +set AT91C_CAN_SERR [expr 0x1 << 25 ] +set AT91C_CAN_AERR [expr 0x1 << 26 ] +set AT91C_CAN_FERR [expr 0x1 << 27 ] +set AT91C_CAN_BERR [expr 0x1 << 28 ] +set AT91C_CAN_RBSY [expr 0x1 << 29 ] +set AT91C_CAN_TBSY [expr 0x1 << 30 ] +set AT91C_CAN_OVLY [expr 0x1 << 31 ] +# -------- CAN_BR : (CAN Offset: 0x14) CAN Baudrate Register -------- +set AT91C_CAN_PHASE2 [expr 0x7 << 0 ] +set AT91C_CAN_PHASE1 [expr 0x7 << 4 ] +set AT91C_CAN_PROPAG [expr 0x7 << 8 ] +set AT91C_CAN_SYNC [expr 0x3 << 12 ] +set AT91C_CAN_BRP [expr 0x7F << 16 ] +set AT91C_CAN_SMP [expr 0x1 << 24 ] +# -------- CAN_TIM : (CAN Offset: 0x18) CAN Timer Register -------- +set AT91C_CAN_TIMER [expr 0xFFFF << 0 ] +# -------- CAN_TIMESTP : (CAN Offset: 0x1c) CAN Timestamp Register -------- +set AT91C_CAN_MTIMESTAMP [expr 0xFFFF << 0 ] +# -------- CAN_ECR : (CAN Offset: 0x20) CAN Error Counter Register -------- +set AT91C_CAN_REC [expr 0xFF << 0 ] +set AT91C_CAN_TEC [expr 0xFF << 16 ] +# -------- CAN_TCR : (CAN Offset: 0x24) CAN Transfer Command Register -------- +set AT91C_CAN_MB0 [expr 0x1 << 0 ] +set AT91C_CAN_MB1 [expr 0x1 << 1 ] +set AT91C_CAN_MB2 [expr 0x1 << 2 ] +set AT91C_CAN_MB3 [expr 0x1 << 3 ] +set AT91C_CAN_MB4 [expr 0x1 << 4 ] +set AT91C_CAN_MB5 [expr 0x1 << 5 ] +set AT91C_CAN_MB6 [expr 0x1 << 6 ] +set AT91C_CAN_MB7 [expr 0x1 << 7 ] +set AT91C_CAN_MB8 [expr 0x1 << 8 ] +set AT91C_CAN_MB9 [expr 0x1 << 9 ] +set AT91C_CAN_MB10 [expr 0x1 << 10 ] +set AT91C_CAN_MB11 [expr 0x1 << 11 ] +set AT91C_CAN_MB12 [expr 0x1 << 12 ] +set AT91C_CAN_MB13 [expr 0x1 << 13 ] +set AT91C_CAN_MB14 [expr 0x1 << 14 ] +set AT91C_CAN_MB15 [expr 0x1 << 15 ] +set AT91C_CAN_TIMRST [expr 0x1 << 31 ] +# -------- CAN_ACR : (CAN Offset: 0x28) CAN Abort Command Register -------- +set AT91C_CAN_MB0 [expr 0x1 << 0 ] +set AT91C_CAN_MB1 [expr 0x1 << 1 ] +set AT91C_CAN_MB2 [expr 0x1 << 2 ] +set AT91C_CAN_MB3 [expr 0x1 << 3 ] +set AT91C_CAN_MB4 [expr 0x1 << 4 ] +set AT91C_CAN_MB5 [expr 0x1 << 5 ] +set AT91C_CAN_MB6 [expr 0x1 << 6 ] +set AT91C_CAN_MB7 [expr 0x1 << 7 ] +set AT91C_CAN_MB8 [expr 0x1 << 8 ] +set AT91C_CAN_MB9 [expr 0x1 << 9 ] +set AT91C_CAN_MB10 [expr 0x1 << 10 ] +set AT91C_CAN_MB11 [expr 0x1 << 11 ] +set AT91C_CAN_MB12 [expr 0x1 << 12 ] +set AT91C_CAN_MB13 [expr 0x1 << 13 ] +set AT91C_CAN_MB14 [expr 0x1 << 14 ] +set AT91C_CAN_MB15 [expr 0x1 << 15 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Ethernet MAC 10/100 +# ***************************************************************************** +# -------- EMAC_NCR : (EMAC Offset: 0x0) -------- +set AT91C_EMAC_LB [expr 0x1 << 0 ] +set AT91C_EMAC_LLB [expr 0x1 << 1 ] +set AT91C_EMAC_RE [expr 0x1 << 2 ] +set AT91C_EMAC_TE [expr 0x1 << 3 ] +set AT91C_EMAC_MPE [expr 0x1 << 4 ] +set AT91C_EMAC_CLRSTAT [expr 0x1 << 5 ] +set AT91C_EMAC_INCSTAT [expr 0x1 << 6 ] +set AT91C_EMAC_WESTAT [expr 0x1 << 7 ] +set AT91C_EMAC_BP [expr 0x1 << 8 ] +set AT91C_EMAC_TSTART [expr 0x1 << 9 ] +set AT91C_EMAC_THALT [expr 0x1 << 10 ] +set AT91C_EMAC_TPFR [expr 0x1 << 11 ] +set AT91C_EMAC_TZQ [expr 0x1 << 12 ] +# -------- EMAC_NCFGR : (EMAC Offset: 0x4) Network Configuration Register -------- +set AT91C_EMAC_SPD [expr 0x1 << 0 ] +set AT91C_EMAC_FD [expr 0x1 << 1 ] +set AT91C_EMAC_JFRAME [expr 0x1 << 3 ] +set AT91C_EMAC_CAF [expr 0x1 << 4 ] +set AT91C_EMAC_NBC [expr 0x1 << 5 ] +set AT91C_EMAC_MTI [expr 0x1 << 6 ] +set AT91C_EMAC_UNI [expr 0x1 << 7 ] +set AT91C_EMAC_BIG [expr 0x1 << 8 ] +set AT91C_EMAC_EAE [expr 0x1 << 9 ] +set AT91C_EMAC_CLK [expr 0x3 << 10 ] +set AT91C_EMAC_CLK_HCLK_8 [expr 0x0 << 10 ] +set AT91C_EMAC_CLK_HCLK_16 [expr 0x1 << 10 ] +set AT91C_EMAC_CLK_HCLK_32 [expr 0x2 << 10 ] +set AT91C_EMAC_CLK_HCLK_64 [expr 0x3 << 10 ] +set AT91C_EMAC_RTY [expr 0x1 << 12 ] +set AT91C_EMAC_PAE [expr 0x1 << 13 ] +set AT91C_EMAC_RBOF [expr 0x3 << 14 ] +set AT91C_EMAC_RBOF_OFFSET_0 [expr 0x0 << 14 ] +set AT91C_EMAC_RBOF_OFFSET_1 [expr 0x1 << 14 ] +set AT91C_EMAC_RBOF_OFFSET_2 [expr 0x2 << 14 ] +set AT91C_EMAC_RBOF_OFFSET_3 [expr 0x3 << 14 ] +set AT91C_EMAC_RLCE [expr 0x1 << 16 ] +set AT91C_EMAC_DRFCS [expr 0x1 << 17 ] +set AT91C_EMAC_EFRHD [expr 0x1 << 18 ] +set AT91C_EMAC_IRXFCS [expr 0x1 << 19 ] +# -------- EMAC_NSR : (EMAC Offset: 0x8) Network Status Register -------- +set AT91C_EMAC_LINKR [expr 0x1 << 0 ] +set AT91C_EMAC_MDIO [expr 0x1 << 1 ] +set AT91C_EMAC_IDLE [expr 0x1 << 2 ] +# -------- EMAC_TSR : (EMAC Offset: 0x14) Transmit Status Register -------- +set AT91C_EMAC_UBR [expr 0x1 << 0 ] +set AT91C_EMAC_COL [expr 0x1 << 1 ] +set AT91C_EMAC_RLES [expr 0x1 << 2 ] +set AT91C_EMAC_TGO [expr 0x1 << 3 ] +set AT91C_EMAC_BEX [expr 0x1 << 4 ] +set AT91C_EMAC_COMP [expr 0x1 << 5 ] +set AT91C_EMAC_UND [expr 0x1 << 6 ] +# -------- EMAC_RSR : (EMAC Offset: 0x20) Receive Status Register -------- +set AT91C_EMAC_BNA [expr 0x1 << 0 ] +set AT91C_EMAC_REC [expr 0x1 << 1 ] +set AT91C_EMAC_OVR [expr 0x1 << 2 ] +# -------- EMAC_ISR : (EMAC Offset: 0x24) Interrupt Status Register -------- +set AT91C_EMAC_MFD [expr 0x1 << 0 ] +set AT91C_EMAC_RCOMP [expr 0x1 << 1 ] +set AT91C_EMAC_RXUBR [expr 0x1 << 2 ] +set AT91C_EMAC_TXUBR [expr 0x1 << 3 ] +set AT91C_EMAC_TUNDR [expr 0x1 << 4 ] +set AT91C_EMAC_RLEX [expr 0x1 << 5 ] +set AT91C_EMAC_TXERR [expr 0x1 << 6 ] +set AT91C_EMAC_TCOMP [expr 0x1 << 7 ] +set AT91C_EMAC_LINK [expr 0x1 << 9 ] +set AT91C_EMAC_ROVR [expr 0x1 << 10 ] +set AT91C_EMAC_HRESP [expr 0x1 << 11 ] +set AT91C_EMAC_PFRE [expr 0x1 << 12 ] +set AT91C_EMAC_PTZ [expr 0x1 << 13 ] +# -------- EMAC_IER : (EMAC Offset: 0x28) Interrupt Enable Register -------- +set AT91C_EMAC_MFD [expr 0x1 << 0 ] +set AT91C_EMAC_RCOMP [expr 0x1 << 1 ] +set AT91C_EMAC_RXUBR [expr 0x1 << 2 ] +set AT91C_EMAC_TXUBR [expr 0x1 << 3 ] +set AT91C_EMAC_TUNDR [expr 0x1 << 4 ] +set AT91C_EMAC_RLEX [expr 0x1 << 5 ] +set AT91C_EMAC_TXERR [expr 0x1 << 6 ] +set AT91C_EMAC_TCOMP [expr 0x1 << 7 ] +set AT91C_EMAC_LINK [expr 0x1 << 9 ] +set AT91C_EMAC_ROVR [expr 0x1 << 10 ] +set AT91C_EMAC_HRESP [expr 0x1 << 11 ] +set AT91C_EMAC_PFRE [expr 0x1 << 12 ] +set AT91C_EMAC_PTZ [expr 0x1 << 13 ] +# -------- EMAC_IDR : (EMAC Offset: 0x2c) Interrupt Disable Register -------- +set AT91C_EMAC_MFD [expr 0x1 << 0 ] +set AT91C_EMAC_RCOMP [expr 0x1 << 1 ] +set AT91C_EMAC_RXUBR [expr 0x1 << 2 ] +set AT91C_EMAC_TXUBR [expr 0x1 << 3 ] +set AT91C_EMAC_TUNDR [expr 0x1 << 4 ] +set AT91C_EMAC_RLEX [expr 0x1 << 5 ] +set AT91C_EMAC_TXERR [expr 0x1 << 6 ] +set AT91C_EMAC_TCOMP [expr 0x1 << 7 ] +set AT91C_EMAC_LINK [expr 0x1 << 9 ] +set AT91C_EMAC_ROVR [expr 0x1 << 10 ] +set AT91C_EMAC_HRESP [expr 0x1 << 11 ] +set AT91C_EMAC_PFRE [expr 0x1 << 12 ] +set AT91C_EMAC_PTZ [expr 0x1 << 13 ] +# -------- EMAC_IMR : (EMAC Offset: 0x30) Interrupt Mask Register -------- +set AT91C_EMAC_MFD [expr 0x1 << 0 ] +set AT91C_EMAC_RCOMP [expr 0x1 << 1 ] +set AT91C_EMAC_RXUBR [expr 0x1 << 2 ] +set AT91C_EMAC_TXUBR [expr 0x1 << 3 ] +set AT91C_EMAC_TUNDR [expr 0x1 << 4 ] +set AT91C_EMAC_RLEX [expr 0x1 << 5 ] +set AT91C_EMAC_TXERR [expr 0x1 << 6 ] +set AT91C_EMAC_TCOMP [expr 0x1 << 7 ] +set AT91C_EMAC_LINK [expr 0x1 << 9 ] +set AT91C_EMAC_ROVR [expr 0x1 << 10 ] +set AT91C_EMAC_HRESP [expr 0x1 << 11 ] +set AT91C_EMAC_PFRE [expr 0x1 << 12 ] +set AT91C_EMAC_PTZ [expr 0x1 << 13 ] +# -------- EMAC_MAN : (EMAC Offset: 0x34) PHY Maintenance Register -------- +set AT91C_EMAC_DATA [expr 0xFFFF << 0 ] +set AT91C_EMAC_CODE [expr 0x3 << 16 ] +set AT91C_EMAC_REGA [expr 0x1F << 18 ] +set AT91C_EMAC_PHYA [expr 0x1F << 23 ] +set AT91C_EMAC_RW [expr 0x3 << 28 ] +set AT91C_EMAC_SOF [expr 0x3 << 30 ] +# -------- EMAC_USRIO : (EMAC Offset: 0xc0) USER Input Output Register -------- +set AT91C_EMAC_RMII [expr 0x1 << 0 ] +set AT91C_EMAC_CLKEN [expr 0x1 << 1 ] +# -------- EMAC_WOL : (EMAC Offset: 0xc4) Wake On LAN Register -------- +set AT91C_EMAC_IP [expr 0xFFFF << 0 ] +set AT91C_EMAC_MAG [expr 0x1 << 16 ] +set AT91C_EMAC_ARP [expr 0x1 << 17 ] +set AT91C_EMAC_SA1 [expr 0x1 << 18 ] +set AT91C_EMAC_MTI [expr 0x1 << 19 ] +# -------- EMAC_REV : (EMAC Offset: 0xfc) Revision Register -------- +set AT91C_EMAC_REVREF [expr 0xFFFF << 0 ] +set AT91C_EMAC_PARTREF [expr 0xFFFF << 16 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Analog to Digital Convertor +# ***************************************************************************** +# -------- ADC_CR : (ADC Offset: 0x0) ADC Control Register -------- +set AT91C_ADC_SWRST [expr 0x1 << 0 ] +set AT91C_ADC_START [expr 0x1 << 1 ] +# -------- ADC_MR : (ADC Offset: 0x4) ADC Mode Register -------- +set AT91C_ADC_TRGEN [expr 0x1 << 0 ] +set AT91C_ADC_TRGEN_DIS 0x0 +set AT91C_ADC_TRGEN_EN 0x1 +set AT91C_ADC_TRGSEL [expr 0x7 << 1 ] +set AT91C_ADC_TRGSEL_TIOA0 [expr 0x0 << 1 ] +set AT91C_ADC_TRGSEL_TIOA1 [expr 0x1 << 1 ] +set AT91C_ADC_TRGSEL_TIOA2 [expr 0x2 << 1 ] +set AT91C_ADC_TRGSEL_TIOA3 [expr 0x3 << 1 ] +set AT91C_ADC_TRGSEL_TIOA4 [expr 0x4 << 1 ] +set AT91C_ADC_TRGSEL_TIOA5 [expr 0x5 << 1 ] +set AT91C_ADC_TRGSEL_EXT [expr 0x6 << 1 ] +set AT91C_ADC_LOWRES [expr 0x1 << 4 ] +set AT91C_ADC_LOWRES_10_BIT [expr 0x0 << 4 ] +set AT91C_ADC_LOWRES_8_BIT [expr 0x1 << 4 ] +set AT91C_ADC_SLEEP [expr 0x1 << 5 ] +set AT91C_ADC_SLEEP_NORMAL_MODE [expr 0x0 << 5 ] +set AT91C_ADC_SLEEP_MODE [expr 0x1 << 5 ] +set AT91C_ADC_PRESCAL [expr 0x3F << 8 ] +set AT91C_ADC_STARTUP [expr 0x1F << 16 ] +set AT91C_ADC_SHTIM [expr 0xF << 24 ] +# -------- ADC_CHER : (ADC Offset: 0x10) ADC Channel Enable Register -------- +set AT91C_ADC_CH0 [expr 0x1 << 0 ] +set AT91C_ADC_CH1 [expr 0x1 << 1 ] +set AT91C_ADC_CH2 [expr 0x1 << 2 ] +set AT91C_ADC_CH3 [expr 0x1 << 3 ] +set AT91C_ADC_CH4 [expr 0x1 << 4 ] +set AT91C_ADC_CH5 [expr 0x1 << 5 ] +set AT91C_ADC_CH6 [expr 0x1 << 6 ] +set AT91C_ADC_CH7 [expr 0x1 << 7 ] +# -------- ADC_CHDR : (ADC Offset: 0x14) ADC Channel Disable Register -------- +set AT91C_ADC_CH0 [expr 0x1 << 0 ] +set AT91C_ADC_CH1 [expr 0x1 << 1 ] +set AT91C_ADC_CH2 [expr 0x1 << 2 ] +set AT91C_ADC_CH3 [expr 0x1 << 3 ] +set AT91C_ADC_CH4 [expr 0x1 << 4 ] +set AT91C_ADC_CH5 [expr 0x1 << 5 ] +set AT91C_ADC_CH6 [expr 0x1 << 6 ] +set AT91C_ADC_CH7 [expr 0x1 << 7 ] +# -------- ADC_CHSR : (ADC Offset: 0x18) ADC Channel Status Register -------- +set AT91C_ADC_CH0 [expr 0x1 << 0 ] +set AT91C_ADC_CH1 [expr 0x1 << 1 ] +set AT91C_ADC_CH2 [expr 0x1 << 2 ] +set AT91C_ADC_CH3 [expr 0x1 << 3 ] +set AT91C_ADC_CH4 [expr 0x1 << 4 ] +set AT91C_ADC_CH5 [expr 0x1 << 5 ] +set AT91C_ADC_CH6 [expr 0x1 << 6 ] +set AT91C_ADC_CH7 [expr 0x1 << 7 ] +# -------- ADC_SR : (ADC Offset: 0x1c) ADC Status Register -------- +set AT91C_ADC_EOC0 [expr 0x1 << 0 ] +set AT91C_ADC_EOC1 [expr 0x1 << 1 ] +set AT91C_ADC_EOC2 [expr 0x1 << 2 ] +set AT91C_ADC_EOC3 [expr 0x1 << 3 ] +set AT91C_ADC_EOC4 [expr 0x1 << 4 ] +set AT91C_ADC_EOC5 [expr 0x1 << 5 ] +set AT91C_ADC_EOC6 [expr 0x1 << 6 ] +set AT91C_ADC_EOC7 [expr 0x1 << 7 ] +set AT91C_ADC_OVRE0 [expr 0x1 << 8 ] +set AT91C_ADC_OVRE1 [expr 0x1 << 9 ] +set AT91C_ADC_OVRE2 [expr 0x1 << 10 ] +set AT91C_ADC_OVRE3 [expr 0x1 << 11 ] +set AT91C_ADC_OVRE4 [expr 0x1 << 12 ] +set AT91C_ADC_OVRE5 [expr 0x1 << 13 ] +set AT91C_ADC_OVRE6 [expr 0x1 << 14 ] +set AT91C_ADC_OVRE7 [expr 0x1 << 15 ] +set AT91C_ADC_DRDY [expr 0x1 << 16 ] +set AT91C_ADC_GOVRE [expr 0x1 << 17 ] +set AT91C_ADC_ENDRX [expr 0x1 << 18 ] +set AT91C_ADC_RXBUFF [expr 0x1 << 19 ] +# -------- ADC_LCDR : (ADC Offset: 0x20) ADC Last Converted Data Register -------- +set AT91C_ADC_LDATA [expr 0x3FF << 0 ] +# -------- ADC_IER : (ADC Offset: 0x24) ADC Interrupt Enable Register -------- +set AT91C_ADC_EOC0 [expr 0x1 << 0 ] +set AT91C_ADC_EOC1 [expr 0x1 << 1 ] +set AT91C_ADC_EOC2 [expr 0x1 << 2 ] +set AT91C_ADC_EOC3 [expr 0x1 << 3 ] +set AT91C_ADC_EOC4 [expr 0x1 << 4 ] +set AT91C_ADC_EOC5 [expr 0x1 << 5 ] +set AT91C_ADC_EOC6 [expr 0x1 << 6 ] +set AT91C_ADC_EOC7 [expr 0x1 << 7 ] +set AT91C_ADC_OVRE0 [expr 0x1 << 8 ] +set AT91C_ADC_OVRE1 [expr 0x1 << 9 ] +set AT91C_ADC_OVRE2 [expr 0x1 << 10 ] +set AT91C_ADC_OVRE3 [expr 0x1 << 11 ] +set AT91C_ADC_OVRE4 [expr 0x1 << 12 ] +set AT91C_ADC_OVRE5 [expr 0x1 << 13 ] +set AT91C_ADC_OVRE6 [expr 0x1 << 14 ] +set AT91C_ADC_OVRE7 [expr 0x1 << 15 ] +set AT91C_ADC_DRDY [expr 0x1 << 16 ] +set AT91C_ADC_GOVRE [expr 0x1 << 17 ] +set AT91C_ADC_ENDRX [expr 0x1 << 18 ] +set AT91C_ADC_RXBUFF [expr 0x1 << 19 ] +# -------- ADC_IDR : (ADC Offset: 0x28) ADC Interrupt Disable Register -------- +set AT91C_ADC_EOC0 [expr 0x1 << 0 ] +set AT91C_ADC_EOC1 [expr 0x1 << 1 ] +set AT91C_ADC_EOC2 [expr 0x1 << 2 ] +set AT91C_ADC_EOC3 [expr 0x1 << 3 ] +set AT91C_ADC_EOC4 [expr 0x1 << 4 ] +set AT91C_ADC_EOC5 [expr 0x1 << 5 ] +set AT91C_ADC_EOC6 [expr 0x1 << 6 ] +set AT91C_ADC_EOC7 [expr 0x1 << 7 ] +set AT91C_ADC_OVRE0 [expr 0x1 << 8 ] +set AT91C_ADC_OVRE1 [expr 0x1 << 9 ] +set AT91C_ADC_OVRE2 [expr 0x1 << 10 ] +set AT91C_ADC_OVRE3 [expr 0x1 << 11 ] +set AT91C_ADC_OVRE4 [expr 0x1 << 12 ] +set AT91C_ADC_OVRE5 [expr 0x1 << 13 ] +set AT91C_ADC_OVRE6 [expr 0x1 << 14 ] +set AT91C_ADC_OVRE7 [expr 0x1 << 15 ] +set AT91C_ADC_DRDY [expr 0x1 << 16 ] +set AT91C_ADC_GOVRE [expr 0x1 << 17 ] +set AT91C_ADC_ENDRX [expr 0x1 << 18 ] +set AT91C_ADC_RXBUFF [expr 0x1 << 19 ] +# -------- ADC_IMR : (ADC Offset: 0x2c) ADC Interrupt Mask Register -------- +set AT91C_ADC_EOC0 [expr 0x1 << 0 ] +set AT91C_ADC_EOC1 [expr 0x1 << 1 ] +set AT91C_ADC_EOC2 [expr 0x1 << 2 ] +set AT91C_ADC_EOC3 [expr 0x1 << 3 ] +set AT91C_ADC_EOC4 [expr 0x1 << 4 ] +set AT91C_ADC_EOC5 [expr 0x1 << 5 ] +set AT91C_ADC_EOC6 [expr 0x1 << 6 ] +set AT91C_ADC_EOC7 [expr 0x1 << 7 ] +set AT91C_ADC_OVRE0 [expr 0x1 << 8 ] +set AT91C_ADC_OVRE1 [expr 0x1 << 9 ] +set AT91C_ADC_OVRE2 [expr 0x1 << 10 ] +set AT91C_ADC_OVRE3 [expr 0x1 << 11 ] +set AT91C_ADC_OVRE4 [expr 0x1 << 12 ] +set AT91C_ADC_OVRE5 [expr 0x1 << 13 ] +set AT91C_ADC_OVRE6 [expr 0x1 << 14 ] +set AT91C_ADC_OVRE7 [expr 0x1 << 15 ] +set AT91C_ADC_DRDY [expr 0x1 << 16 ] +set AT91C_ADC_GOVRE [expr 0x1 << 17 ] +set AT91C_ADC_ENDRX [expr 0x1 << 18 ] +set AT91C_ADC_RXBUFF [expr 0x1 << 19 ] +# -------- ADC_CDR0 : (ADC Offset: 0x30) ADC Channel Data Register 0 -------- +set AT91C_ADC_DATA [expr 0x3FF << 0 ] +# -------- ADC_CDR1 : (ADC Offset: 0x34) ADC Channel Data Register 1 -------- +set AT91C_ADC_DATA [expr 0x3FF << 0 ] +# -------- ADC_CDR2 : (ADC Offset: 0x38) ADC Channel Data Register 2 -------- +set AT91C_ADC_DATA [expr 0x3FF << 0 ] +# -------- ADC_CDR3 : (ADC Offset: 0x3c) ADC Channel Data Register 3 -------- +set AT91C_ADC_DATA [expr 0x3FF << 0 ] +# -------- ADC_CDR4 : (ADC Offset: 0x40) ADC Channel Data Register 4 -------- +set AT91C_ADC_DATA [expr 0x3FF << 0 ] +# -------- ADC_CDR5 : (ADC Offset: 0x44) ADC Channel Data Register 5 -------- +set AT91C_ADC_DATA [expr 0x3FF << 0 ] +# -------- ADC_CDR6 : (ADC Offset: 0x48) ADC Channel Data Register 6 -------- +set AT91C_ADC_DATA [expr 0x3FF << 0 ] +# -------- ADC_CDR7 : (ADC Offset: 0x4c) ADC Channel Data Register 7 -------- +set AT91C_ADC_DATA [expr 0x3FF << 0 ] + +# ***************************************************************************** +# REGISTER ADDRESS DEFINITION FOR AT91SAM7X256 +# ***************************************************************************** +# ========== Register definition for SYS peripheral ========== +# ========== Register definition for AIC peripheral ========== +set AT91C_AIC_IVR 0xFFFFF100 +set AT91C_AIC_SMR 0xFFFFF000 +set AT91C_AIC_FVR 0xFFFFF104 +set AT91C_AIC_DCR 0xFFFFF138 +set AT91C_AIC_EOICR 0xFFFFF130 +set AT91C_AIC_SVR 0xFFFFF080 +set AT91C_AIC_FFSR 0xFFFFF148 +set AT91C_AIC_ICCR 0xFFFFF128 +set AT91C_AIC_ISR 0xFFFFF108 +set AT91C_AIC_IMR 0xFFFFF110 +set AT91C_AIC_IPR 0xFFFFF10C +set AT91C_AIC_FFER 0xFFFFF140 +set AT91C_AIC_IECR 0xFFFFF120 +set AT91C_AIC_ISCR 0xFFFFF12C +set AT91C_AIC_FFDR 0xFFFFF144 +set AT91C_AIC_CISR 0xFFFFF114 +set AT91C_AIC_IDCR 0xFFFFF124 +set AT91C_AIC_SPU 0xFFFFF134 +# ========== Register definition for PDC_DBGU peripheral ========== +set AT91C_DBGU_TCR 0xFFFFF30C +set AT91C_DBGU_RNPR 0xFFFFF310 +set AT91C_DBGU_TNPR 0xFFFFF318 +set AT91C_DBGU_TPR 0xFFFFF308 +set AT91C_DBGU_RPR 0xFFFFF300 +set AT91C_DBGU_RCR 0xFFFFF304 +set AT91C_DBGU_RNCR 0xFFFFF314 +set AT91C_DBGU_PTCR 0xFFFFF320 +set AT91C_DBGU_PTSR 0xFFFFF324 +set AT91C_DBGU_TNCR 0xFFFFF31C +# ========== Register definition for DBGU peripheral ========== +set AT91C_DBGU_EXID 0xFFFFF244 +set AT91C_DBGU_BRGR 0xFFFFF220 +set AT91C_DBGU_IDR 0xFFFFF20C +set AT91C_DBGU_CSR 0xFFFFF214 +set AT91C_DBGU_CIDR 0xFFFFF240 +set AT91C_DBGU_MR 0xFFFFF204 +set AT91C_DBGU_IMR 0xFFFFF210 +set AT91C_DBGU_CR 0xFFFFF200 +set AT91C_DBGU_FNTR 0xFFFFF248 +set AT91C_DBGU_THR 0xFFFFF21C +set AT91C_DBGU_RHR 0xFFFFF218 +set AT91C_DBGU_IER 0xFFFFF208 +# ========== Register definition for PIOA peripheral ========== +set AT91C_PIOA_ODR 0xFFFFF414 +set AT91C_PIOA_SODR 0xFFFFF430 +set AT91C_PIOA_ISR 0xFFFFF44C +set AT91C_PIOA_ABSR 0xFFFFF478 +set AT91C_PIOA_IER 0xFFFFF440 +set AT91C_PIOA_PPUDR 0xFFFFF460 +set AT91C_PIOA_IMR 0xFFFFF448 +set AT91C_PIOA_PER 0xFFFFF400 +set AT91C_PIOA_IFDR 0xFFFFF424 +set AT91C_PIOA_OWDR 0xFFFFF4A4 +set AT91C_PIOA_MDSR 0xFFFFF458 +set AT91C_PIOA_IDR 0xFFFFF444 +set AT91C_PIOA_ODSR 0xFFFFF438 +set AT91C_PIOA_PPUSR 0xFFFFF468 +set AT91C_PIOA_OWSR 0xFFFFF4A8 +set AT91C_PIOA_BSR 0xFFFFF474 +set AT91C_PIOA_OWER 0xFFFFF4A0 +set AT91C_PIOA_IFER 0xFFFFF420 +set AT91C_PIOA_PDSR 0xFFFFF43C +set AT91C_PIOA_PPUER 0xFFFFF464 +set AT91C_PIOA_OSR 0xFFFFF418 +set AT91C_PIOA_ASR 0xFFFFF470 +set AT91C_PIOA_MDDR 0xFFFFF454 +set AT91C_PIOA_CODR 0xFFFFF434 +set AT91C_PIOA_MDER 0xFFFFF450 +set AT91C_PIOA_PDR 0xFFFFF404 +set AT91C_PIOA_IFSR 0xFFFFF428 +set AT91C_PIOA_OER 0xFFFFF410 +set AT91C_PIOA_PSR 0xFFFFF408 +# ========== Register definition for PIOB peripheral ========== +set AT91C_PIOB_OWDR 0xFFFFF6A4 +set AT91C_PIOB_MDER 0xFFFFF650 +set AT91C_PIOB_PPUSR 0xFFFFF668 +set AT91C_PIOB_IMR 0xFFFFF648 +set AT91C_PIOB_ASR 0xFFFFF670 +set AT91C_PIOB_PPUDR 0xFFFFF660 +set AT91C_PIOB_PSR 0xFFFFF608 +set AT91C_PIOB_IER 0xFFFFF640 +set AT91C_PIOB_CODR 0xFFFFF634 +set AT91C_PIOB_OWER 0xFFFFF6A0 +set AT91C_PIOB_ABSR 0xFFFFF678 +set AT91C_PIOB_IFDR 0xFFFFF624 +set AT91C_PIOB_PDSR 0xFFFFF63C +set AT91C_PIOB_IDR 0xFFFFF644 +set AT91C_PIOB_OWSR 0xFFFFF6A8 +set AT91C_PIOB_PDR 0xFFFFF604 +set AT91C_PIOB_ODR 0xFFFFF614 +set AT91C_PIOB_IFSR 0xFFFFF628 +set AT91C_PIOB_PPUER 0xFFFFF664 +set AT91C_PIOB_SODR 0xFFFFF630 +set AT91C_PIOB_ISR 0xFFFFF64C +set AT91C_PIOB_ODSR 0xFFFFF638 +set AT91C_PIOB_OSR 0xFFFFF618 +set AT91C_PIOB_MDSR 0xFFFFF658 +set AT91C_PIOB_IFER 0xFFFFF620 +set AT91C_PIOB_BSR 0xFFFFF674 +set AT91C_PIOB_MDDR 0xFFFFF654 +set AT91C_PIOB_OER 0xFFFFF610 +set AT91C_PIOB_PER 0xFFFFF600 +# ========== Register definition for CKGR peripheral ========== +set AT91C_CKGR_MOR 0xFFFFFC20 +set AT91C_CKGR_PLLR 0xFFFFFC2C +set AT91C_CKGR_MCFR 0xFFFFFC24 +# ========== Register definition for PMC peripheral ========== +set AT91C_PMC_IDR 0xFFFFFC64 +set AT91C_PMC_MOR 0xFFFFFC20 +set AT91C_PMC_PLLR 0xFFFFFC2C +set AT91C_PMC_PCER 0xFFFFFC10 +set AT91C_PMC_PCKR 0xFFFFFC40 +set AT91C_PMC_MCKR 0xFFFFFC30 +set AT91C_PMC_SCDR 0xFFFFFC04 +set AT91C_PMC_PCDR 0xFFFFFC14 +set AT91C_PMC_SCSR 0xFFFFFC08 +set AT91C_PMC_PCSR 0xFFFFFC18 +set AT91C_PMC_MCFR 0xFFFFFC24 +set AT91C_PMC_SCER 0xFFFFFC00 +set AT91C_PMC_IMR 0xFFFFFC6C +set AT91C_PMC_IER 0xFFFFFC60 +set AT91C_PMC_SR 0xFFFFFC68 +# ========== Register definition for RSTC peripheral ========== +set AT91C_RSTC_RCR 0xFFFFFD00 +set AT91C_RSTC_RMR 0xFFFFFD08 +set AT91C_RSTC_RSR 0xFFFFFD04 +# ========== Register definition for RTTC peripheral ========== +set AT91C_RTTC_RTSR 0xFFFFFD2C +set AT91C_RTTC_RTMR 0xFFFFFD20 +set AT91C_RTTC_RTVR 0xFFFFFD28 +set AT91C_RTTC_RTAR 0xFFFFFD24 +# ========== Register definition for PITC peripheral ========== +set AT91C_PITC_PIVR 0xFFFFFD38 +set AT91C_PITC_PISR 0xFFFFFD34 +set AT91C_PITC_PIIR 0xFFFFFD3C +set AT91C_PITC_PIMR 0xFFFFFD30 +# ========== Register definition for WDTC peripheral ========== +set AT91C_WDTC_WDCR 0xFFFFFD40 +set AT91C_WDTC_WDSR 0xFFFFFD48 +set AT91C_WDTC_WDMR 0xFFFFFD44 +# ========== Register definition for VREG peripheral ========== +set AT91C_VREG_MR 0xFFFFFD60 +# ========== Register definition for MC peripheral ========== +set AT91C_MC_ASR 0xFFFFFF04 +set AT91C_MC_RCR 0xFFFFFF00 +set AT91C_MC_FCR 0xFFFFFF64 +set AT91C_MC_AASR 0xFFFFFF08 +set AT91C_MC_FSR 0xFFFFFF68 +set AT91C_MC_FMR 0xFFFFFF60 +# ========== Register definition for PDC_SPI1 peripheral ========== +set AT91C_SPI1_PTCR 0xFFFE4120 +set AT91C_SPI1_RPR 0xFFFE4100 +set AT91C_SPI1_TNCR 0xFFFE411C +set AT91C_SPI1_TPR 0xFFFE4108 +set AT91C_SPI1_TNPR 0xFFFE4118 +set AT91C_SPI1_TCR 0xFFFE410C +set AT91C_SPI1_RCR 0xFFFE4104 +set AT91C_SPI1_RNPR 0xFFFE4110 +set AT91C_SPI1_RNCR 0xFFFE4114 +set AT91C_SPI1_PTSR 0xFFFE4124 +# ========== Register definition for SPI1 peripheral ========== +set AT91C_SPI1_IMR 0xFFFE401C +set AT91C_SPI1_IER 0xFFFE4014 +set AT91C_SPI1_MR 0xFFFE4004 +set AT91C_SPI1_RDR 0xFFFE4008 +set AT91C_SPI1_IDR 0xFFFE4018 +set AT91C_SPI1_SR 0xFFFE4010 +set AT91C_SPI1_TDR 0xFFFE400C +set AT91C_SPI1_CR 0xFFFE4000 +set AT91C_SPI1_CSR 0xFFFE4030 +# ========== Register definition for PDC_SPI0 peripheral ========== +set AT91C_SPI0_PTCR 0xFFFE0120 +set AT91C_SPI0_TPR 0xFFFE0108 +set AT91C_SPI0_TCR 0xFFFE010C +set AT91C_SPI0_RCR 0xFFFE0104 +set AT91C_SPI0_PTSR 0xFFFE0124 +set AT91C_SPI0_RNPR 0xFFFE0110 +set AT91C_SPI0_RPR 0xFFFE0100 +set AT91C_SPI0_TNCR 0xFFFE011C +set AT91C_SPI0_RNCR 0xFFFE0114 +set AT91C_SPI0_TNPR 0xFFFE0118 +# ========== Register definition for SPI0 peripheral ========== +set AT91C_SPI0_IER 0xFFFE0014 +set AT91C_SPI0_SR 0xFFFE0010 +set AT91C_SPI0_IDR 0xFFFE0018 +set AT91C_SPI0_CR 0xFFFE0000 +set AT91C_SPI0_MR 0xFFFE0004 +set AT91C_SPI0_IMR 0xFFFE001C +set AT91C_SPI0_TDR 0xFFFE000C +set AT91C_SPI0_RDR 0xFFFE0008 +set AT91C_SPI0_CSR 0xFFFE0030 +# ========== Register definition for PDC_US1 peripheral ========== +set AT91C_US1_RNCR 0xFFFC4114 +set AT91C_US1_PTCR 0xFFFC4120 +set AT91C_US1_TCR 0xFFFC410C +set AT91C_US1_PTSR 0xFFFC4124 +set AT91C_US1_TNPR 0xFFFC4118 +set AT91C_US1_RCR 0xFFFC4104 +set AT91C_US1_RNPR 0xFFFC4110 +set AT91C_US1_RPR 0xFFFC4100 +set AT91C_US1_TNCR 0xFFFC411C +set AT91C_US1_TPR 0xFFFC4108 +# ========== Register definition for US1 peripheral ========== +set AT91C_US1_IF 0xFFFC404C +set AT91C_US1_NER 0xFFFC4044 +set AT91C_US1_RTOR 0xFFFC4024 +set AT91C_US1_CSR 0xFFFC4014 +set AT91C_US1_IDR 0xFFFC400C +set AT91C_US1_IER 0xFFFC4008 +set AT91C_US1_THR 0xFFFC401C +set AT91C_US1_TTGR 0xFFFC4028 +set AT91C_US1_RHR 0xFFFC4018 +set AT91C_US1_BRGR 0xFFFC4020 +set AT91C_US1_IMR 0xFFFC4010 +set AT91C_US1_FIDI 0xFFFC4040 +set AT91C_US1_CR 0xFFFC4000 +set AT91C_US1_MR 0xFFFC4004 +# ========== Register definition for PDC_US0 peripheral ========== +set AT91C_US0_TNPR 0xFFFC0118 +set AT91C_US0_RNPR 0xFFFC0110 +set AT91C_US0_TCR 0xFFFC010C +set AT91C_US0_PTCR 0xFFFC0120 +set AT91C_US0_PTSR 0xFFFC0124 +set AT91C_US0_TNCR 0xFFFC011C +set AT91C_US0_TPR 0xFFFC0108 +set AT91C_US0_RCR 0xFFFC0104 +set AT91C_US0_RPR 0xFFFC0100 +set AT91C_US0_RNCR 0xFFFC0114 +# ========== Register definition for US0 peripheral ========== +set AT91C_US0_BRGR 0xFFFC0020 +set AT91C_US0_NER 0xFFFC0044 +set AT91C_US0_CR 0xFFFC0000 +set AT91C_US0_IMR 0xFFFC0010 +set AT91C_US0_FIDI 0xFFFC0040 +set AT91C_US0_TTGR 0xFFFC0028 +set AT91C_US0_MR 0xFFFC0004 +set AT91C_US0_RTOR 0xFFFC0024 +set AT91C_US0_CSR 0xFFFC0014 +set AT91C_US0_RHR 0xFFFC0018 +set AT91C_US0_IDR 0xFFFC000C +set AT91C_US0_THR 0xFFFC001C +set AT91C_US0_IF 0xFFFC004C +set AT91C_US0_IER 0xFFFC0008 +# ========== Register definition for PDC_SSC peripheral ========== +set AT91C_SSC_TNCR 0xFFFD411C +set AT91C_SSC_RPR 0xFFFD4100 +set AT91C_SSC_RNCR 0xFFFD4114 +set AT91C_SSC_TPR 0xFFFD4108 +set AT91C_SSC_PTCR 0xFFFD4120 +set AT91C_SSC_TCR 0xFFFD410C +set AT91C_SSC_RCR 0xFFFD4104 +set AT91C_SSC_RNPR 0xFFFD4110 +set AT91C_SSC_TNPR 0xFFFD4118 +set AT91C_SSC_PTSR 0xFFFD4124 +# ========== Register definition for SSC peripheral ========== +set AT91C_SSC_RHR 0xFFFD4020 +set AT91C_SSC_RSHR 0xFFFD4030 +set AT91C_SSC_TFMR 0xFFFD401C +set AT91C_SSC_IDR 0xFFFD4048 +set AT91C_SSC_THR 0xFFFD4024 +set AT91C_SSC_RCMR 0xFFFD4010 +set AT91C_SSC_IER 0xFFFD4044 +set AT91C_SSC_TSHR 0xFFFD4034 +set AT91C_SSC_SR 0xFFFD4040 +set AT91C_SSC_CMR 0xFFFD4004 +set AT91C_SSC_TCMR 0xFFFD4018 +set AT91C_SSC_CR 0xFFFD4000 +set AT91C_SSC_IMR 0xFFFD404C +set AT91C_SSC_RFMR 0xFFFD4014 +# ========== Register definition for TWI peripheral ========== +set AT91C_TWI_IER 0xFFFB8024 +set AT91C_TWI_CR 0xFFFB8000 +set AT91C_TWI_SR 0xFFFB8020 +set AT91C_TWI_IMR 0xFFFB802C +set AT91C_TWI_THR 0xFFFB8034 +set AT91C_TWI_IDR 0xFFFB8028 +set AT91C_TWI_IADR 0xFFFB800C +set AT91C_TWI_MMR 0xFFFB8004 +set AT91C_TWI_CWGR 0xFFFB8010 +set AT91C_TWI_RHR 0xFFFB8030 +# ========== Register definition for PWMC_CH3 peripheral ========== +set AT91C_PWMC_CH3_CUPDR 0xFFFCC270 +set AT91C_PWMC_CH3_Reserved 0xFFFCC274 +set AT91C_PWMC_CH3_CPRDR 0xFFFCC268 +set AT91C_PWMC_CH3_CDTYR 0xFFFCC264 +set AT91C_PWMC_CH3_CCNTR 0xFFFCC26C +set AT91C_PWMC_CH3_CMR 0xFFFCC260 +# ========== Register definition for PWMC_CH2 peripheral ========== +set AT91C_PWMC_CH2_Reserved 0xFFFCC254 +set AT91C_PWMC_CH2_CMR 0xFFFCC240 +set AT91C_PWMC_CH2_CCNTR 0xFFFCC24C +set AT91C_PWMC_CH2_CPRDR 0xFFFCC248 +set AT91C_PWMC_CH2_CUPDR 0xFFFCC250 +set AT91C_PWMC_CH2_CDTYR 0xFFFCC244 +# ========== Register definition for PWMC_CH1 peripheral ========== +set AT91C_PWMC_CH1_Reserved 0xFFFCC234 +set AT91C_PWMC_CH1_CUPDR 0xFFFCC230 +set AT91C_PWMC_CH1_CPRDR 0xFFFCC228 +set AT91C_PWMC_CH1_CCNTR 0xFFFCC22C +set AT91C_PWMC_CH1_CDTYR 0xFFFCC224 +set AT91C_PWMC_CH1_CMR 0xFFFCC220 +# ========== Register definition for PWMC_CH0 peripheral ========== +set AT91C_PWMC_CH0_Reserved 0xFFFCC214 +set AT91C_PWMC_CH0_CPRDR 0xFFFCC208 +set AT91C_PWMC_CH0_CDTYR 0xFFFCC204 +set AT91C_PWMC_CH0_CMR 0xFFFCC200 +set AT91C_PWMC_CH0_CUPDR 0xFFFCC210 +set AT91C_PWMC_CH0_CCNTR 0xFFFCC20C +# ========== Register definition for PWMC peripheral ========== +set AT91C_PWMC_IDR 0xFFFCC014 +set AT91C_PWMC_DIS 0xFFFCC008 +set AT91C_PWMC_IER 0xFFFCC010 +set AT91C_PWMC_VR 0xFFFCC0FC +set AT91C_PWMC_ISR 0xFFFCC01C +set AT91C_PWMC_SR 0xFFFCC00C +set AT91C_PWMC_IMR 0xFFFCC018 +set AT91C_PWMC_MR 0xFFFCC000 +set AT91C_PWMC_ENA 0xFFFCC004 +# ========== Register definition for UDP peripheral ========== +set AT91C_UDP_IMR 0xFFFB0018 +set AT91C_UDP_FADDR 0xFFFB0008 +set AT91C_UDP_NUM 0xFFFB0000 +set AT91C_UDP_FDR 0xFFFB0050 +set AT91C_UDP_ISR 0xFFFB001C +set AT91C_UDP_CSR 0xFFFB0030 +set AT91C_UDP_IDR 0xFFFB0014 +set AT91C_UDP_ICR 0xFFFB0020 +set AT91C_UDP_RSTEP 0xFFFB0028 +set AT91C_UDP_TXVC 0xFFFB0074 +set AT91C_UDP_GLBSTATE 0xFFFB0004 +set AT91C_UDP_IER 0xFFFB0010 +# ========== Register definition for TC0 peripheral ========== +set AT91C_TC0_SR 0xFFFA0020 +set AT91C_TC0_RC 0xFFFA001C +set AT91C_TC0_RB 0xFFFA0018 +set AT91C_TC0_CCR 0xFFFA0000 +set AT91C_TC0_CMR 0xFFFA0004 +set AT91C_TC0_IER 0xFFFA0024 +set AT91C_TC0_RA 0xFFFA0014 +set AT91C_TC0_IDR 0xFFFA0028 +set AT91C_TC0_CV 0xFFFA0010 +set AT91C_TC0_IMR 0xFFFA002C +# ========== Register definition for TC1 peripheral ========== +set AT91C_TC1_RB 0xFFFA0058 +set AT91C_TC1_CCR 0xFFFA0040 +set AT91C_TC1_IER 0xFFFA0064 +set AT91C_TC1_IDR 0xFFFA0068 +set AT91C_TC1_SR 0xFFFA0060 +set AT91C_TC1_CMR 0xFFFA0044 +set AT91C_TC1_RA 0xFFFA0054 +set AT91C_TC1_RC 0xFFFA005C +set AT91C_TC1_IMR 0xFFFA006C +set AT91C_TC1_CV 0xFFFA0050 +# ========== Register definition for TC2 peripheral ========== +set AT91C_TC2_CMR 0xFFFA0084 +set AT91C_TC2_CCR 0xFFFA0080 +set AT91C_TC2_CV 0xFFFA0090 +set AT91C_TC2_RA 0xFFFA0094 +set AT91C_TC2_RB 0xFFFA0098 +set AT91C_TC2_IDR 0xFFFA00A8 +set AT91C_TC2_IMR 0xFFFA00AC +set AT91C_TC2_RC 0xFFFA009C +set AT91C_TC2_IER 0xFFFA00A4 +set AT91C_TC2_SR 0xFFFA00A0 +# ========== Register definition for TCB peripheral ========== +set AT91C_TCB_BMR 0xFFFA00C4 +set AT91C_TCB_BCR 0xFFFA00C0 +# ========== Register definition for CAN_MB0 peripheral ========== +set AT91C_CAN_MB0_MDL 0xFFFD0214 +set AT91C_CAN_MB0_MAM 0xFFFD0204 +set AT91C_CAN_MB0_MCR 0xFFFD021C +set AT91C_CAN_MB0_MID 0xFFFD0208 +set AT91C_CAN_MB0_MSR 0xFFFD0210 +set AT91C_CAN_MB0_MFID 0xFFFD020C +set AT91C_CAN_MB0_MDH 0xFFFD0218 +set AT91C_CAN_MB0_MMR 0xFFFD0200 +# ========== Register definition for CAN_MB1 peripheral ========== +set AT91C_CAN_MB1_MDL 0xFFFD0234 +set AT91C_CAN_MB1_MID 0xFFFD0228 +set AT91C_CAN_MB1_MMR 0xFFFD0220 +set AT91C_CAN_MB1_MSR 0xFFFD0230 +set AT91C_CAN_MB1_MAM 0xFFFD0224 +set AT91C_CAN_MB1_MDH 0xFFFD0238 +set AT91C_CAN_MB1_MCR 0xFFFD023C +set AT91C_CAN_MB1_MFID 0xFFFD022C +# ========== Register definition for CAN_MB2 peripheral ========== +set AT91C_CAN_MB2_MCR 0xFFFD025C +set AT91C_CAN_MB2_MDH 0xFFFD0258 +set AT91C_CAN_MB2_MID 0xFFFD0248 +set AT91C_CAN_MB2_MDL 0xFFFD0254 +set AT91C_CAN_MB2_MMR 0xFFFD0240 +set AT91C_CAN_MB2_MAM 0xFFFD0244 +set AT91C_CAN_MB2_MFID 0xFFFD024C +set AT91C_CAN_MB2_MSR 0xFFFD0250 +# ========== Register definition for CAN_MB3 peripheral ========== +set AT91C_CAN_MB3_MFID 0xFFFD026C +set AT91C_CAN_MB3_MAM 0xFFFD0264 +set AT91C_CAN_MB3_MID 0xFFFD0268 +set AT91C_CAN_MB3_MCR 0xFFFD027C +set AT91C_CAN_MB3_MMR 0xFFFD0260 +set AT91C_CAN_MB3_MSR 0xFFFD0270 +set AT91C_CAN_MB3_MDL 0xFFFD0274 +set AT91C_CAN_MB3_MDH 0xFFFD0278 +# ========== Register definition for CAN_MB4 peripheral ========== +set AT91C_CAN_MB4_MID 0xFFFD0288 +set AT91C_CAN_MB4_MMR 0xFFFD0280 +set AT91C_CAN_MB4_MDH 0xFFFD0298 +set AT91C_CAN_MB4_MFID 0xFFFD028C +set AT91C_CAN_MB4_MSR 0xFFFD0290 +set AT91C_CAN_MB4_MCR 0xFFFD029C +set AT91C_CAN_MB4_MDL 0xFFFD0294 +set AT91C_CAN_MB4_MAM 0xFFFD0284 +# ========== Register definition for CAN_MB5 peripheral ========== +set AT91C_CAN_MB5_MSR 0xFFFD02B0 +set AT91C_CAN_MB5_MCR 0xFFFD02BC +set AT91C_CAN_MB5_MFID 0xFFFD02AC +set AT91C_CAN_MB5_MDH 0xFFFD02B8 +set AT91C_CAN_MB5_MID 0xFFFD02A8 +set AT91C_CAN_MB5_MMR 0xFFFD02A0 +set AT91C_CAN_MB5_MDL 0xFFFD02B4 +set AT91C_CAN_MB5_MAM 0xFFFD02A4 +# ========== Register definition for CAN_MB6 peripheral ========== +set AT91C_CAN_MB6_MFID 0xFFFD02CC +set AT91C_CAN_MB6_MID 0xFFFD02C8 +set AT91C_CAN_MB6_MAM 0xFFFD02C4 +set AT91C_CAN_MB6_MSR 0xFFFD02D0 +set AT91C_CAN_MB6_MDL 0xFFFD02D4 +set AT91C_CAN_MB6_MCR 0xFFFD02DC +set AT91C_CAN_MB6_MDH 0xFFFD02D8 +set AT91C_CAN_MB6_MMR 0xFFFD02C0 +# ========== Register definition for CAN_MB7 peripheral ========== +set AT91C_CAN_MB7_MCR 0xFFFD02FC +set AT91C_CAN_MB7_MDH 0xFFFD02F8 +set AT91C_CAN_MB7_MFID 0xFFFD02EC +set AT91C_CAN_MB7_MDL 0xFFFD02F4 +set AT91C_CAN_MB7_MID 0xFFFD02E8 +set AT91C_CAN_MB7_MMR 0xFFFD02E0 +set AT91C_CAN_MB7_MAM 0xFFFD02E4 +set AT91C_CAN_MB7_MSR 0xFFFD02F0 +# ========== Register definition for CAN peripheral ========== +set AT91C_CAN_TCR 0xFFFD0024 +set AT91C_CAN_IMR 0xFFFD000C +set AT91C_CAN_IER 0xFFFD0004 +set AT91C_CAN_ECR 0xFFFD0020 +set AT91C_CAN_TIMESTP 0xFFFD001C +set AT91C_CAN_MR 0xFFFD0000 +set AT91C_CAN_IDR 0xFFFD0008 +set AT91C_CAN_ACR 0xFFFD0028 +set AT91C_CAN_TIM 0xFFFD0018 +set AT91C_CAN_SR 0xFFFD0010 +set AT91C_CAN_BR 0xFFFD0014 +set AT91C_CAN_VR 0xFFFD00FC +# ========== Register definition for EMAC peripheral ========== +set AT91C_EMAC_ISR 0xFFFDC024 +set AT91C_EMAC_SA4H 0xFFFDC0B4 +set AT91C_EMAC_SA1L 0xFFFDC098 +set AT91C_EMAC_ELE 0xFFFDC078 +set AT91C_EMAC_LCOL 0xFFFDC05C +set AT91C_EMAC_RLE 0xFFFDC088 +set AT91C_EMAC_WOL 0xFFFDC0C4 +set AT91C_EMAC_DTF 0xFFFDC058 +set AT91C_EMAC_TUND 0xFFFDC064 +set AT91C_EMAC_NCR 0xFFFDC000 +set AT91C_EMAC_SA4L 0xFFFDC0B0 +set AT91C_EMAC_RSR 0xFFFDC020 +set AT91C_EMAC_SA3L 0xFFFDC0A8 +set AT91C_EMAC_TSR 0xFFFDC014 +set AT91C_EMAC_IDR 0xFFFDC02C +set AT91C_EMAC_RSE 0xFFFDC074 +set AT91C_EMAC_ECOL 0xFFFDC060 +set AT91C_EMAC_TID 0xFFFDC0B8 +set AT91C_EMAC_HRB 0xFFFDC090 +set AT91C_EMAC_TBQP 0xFFFDC01C +set AT91C_EMAC_USRIO 0xFFFDC0C0 +set AT91C_EMAC_PTR 0xFFFDC038 +set AT91C_EMAC_SA2H 0xFFFDC0A4 +set AT91C_EMAC_ROV 0xFFFDC070 +set AT91C_EMAC_ALE 0xFFFDC054 +set AT91C_EMAC_RJA 0xFFFDC07C +set AT91C_EMAC_RBQP 0xFFFDC018 +set AT91C_EMAC_TPF 0xFFFDC08C +set AT91C_EMAC_NCFGR 0xFFFDC004 +set AT91C_EMAC_HRT 0xFFFDC094 +set AT91C_EMAC_USF 0xFFFDC080 +set AT91C_EMAC_FCSE 0xFFFDC050 +set AT91C_EMAC_TPQ 0xFFFDC0BC +set AT91C_EMAC_MAN 0xFFFDC034 +set AT91C_EMAC_FTO 0xFFFDC040 +set AT91C_EMAC_REV 0xFFFDC0FC +set AT91C_EMAC_IMR 0xFFFDC030 +set AT91C_EMAC_SCF 0xFFFDC044 +set AT91C_EMAC_PFR 0xFFFDC03C +set AT91C_EMAC_MCF 0xFFFDC048 +set AT91C_EMAC_NSR 0xFFFDC008 +set AT91C_EMAC_SA2L 0xFFFDC0A0 +set AT91C_EMAC_FRO 0xFFFDC04C +set AT91C_EMAC_IER 0xFFFDC028 +set AT91C_EMAC_SA1H 0xFFFDC09C +set AT91C_EMAC_CSE 0xFFFDC068 +set AT91C_EMAC_SA3H 0xFFFDC0AC +set AT91C_EMAC_RRE 0xFFFDC06C +set AT91C_EMAC_STE 0xFFFDC084 +# ========== Register definition for PDC_ADC peripheral ========== +set AT91C_ADC_PTSR 0xFFFD8124 +set AT91C_ADC_PTCR 0xFFFD8120 +set AT91C_ADC_TNPR 0xFFFD8118 +set AT91C_ADC_TNCR 0xFFFD811C +set AT91C_ADC_RNPR 0xFFFD8110 +set AT91C_ADC_RNCR 0xFFFD8114 +set AT91C_ADC_RPR 0xFFFD8100 +set AT91C_ADC_TCR 0xFFFD810C +set AT91C_ADC_TPR 0xFFFD8108 +set AT91C_ADC_RCR 0xFFFD8104 +# ========== Register definition for ADC peripheral ========== +set AT91C_ADC_CDR2 0xFFFD8038 +set AT91C_ADC_CDR3 0xFFFD803C +set AT91C_ADC_CDR0 0xFFFD8030 +set AT91C_ADC_CDR5 0xFFFD8044 +set AT91C_ADC_CHDR 0xFFFD8014 +set AT91C_ADC_SR 0xFFFD801C +set AT91C_ADC_CDR4 0xFFFD8040 +set AT91C_ADC_CDR1 0xFFFD8034 +set AT91C_ADC_LCDR 0xFFFD8020 +set AT91C_ADC_IDR 0xFFFD8028 +set AT91C_ADC_CR 0xFFFD8000 +set AT91C_ADC_CDR7 0xFFFD804C +set AT91C_ADC_CDR6 0xFFFD8048 +set AT91C_ADC_IER 0xFFFD8024 +set AT91C_ADC_CHER 0xFFFD8010 +set AT91C_ADC_CHSR 0xFFFD8018 +set AT91C_ADC_MR 0xFFFD8004 +set AT91C_ADC_IMR 0xFFFD802C + +# ***************************************************************************** +# BASE ADDRESS DEFINITIONS FOR AT91SAM7X256 +# ***************************************************************************** +set AT91C_BASE_SYS 0xFFFFF000 +set AT91C_BASE_AIC 0xFFFFF000 +set AT91C_BASE_PDC_DBGU 0xFFFFF300 +set AT91C_BASE_DBGU 0xFFFFF200 +set AT91C_BASE_PIOA 0xFFFFF400 +set AT91C_BASE_PIOB 0xFFFFF600 +set AT91C_BASE_CKGR 0xFFFFFC20 +set AT91C_BASE_PMC 0xFFFFFC00 +set AT91C_BASE_RSTC 0xFFFFFD00 +set AT91C_BASE_RTTC 0xFFFFFD20 +set AT91C_BASE_PITC 0xFFFFFD30 +set AT91C_BASE_WDTC 0xFFFFFD40 +set AT91C_BASE_VREG 0xFFFFFD60 +set AT91C_BASE_MC 0xFFFFFF00 +set AT91C_BASE_PDC_SPI1 0xFFFE4100 +set AT91C_BASE_SPI1 0xFFFE4000 +set AT91C_BASE_PDC_SPI0 0xFFFE0100 +set AT91C_BASE_SPI0 0xFFFE0000 +set AT91C_BASE_PDC_US1 0xFFFC4100 +set AT91C_BASE_US1 0xFFFC4000 +set AT91C_BASE_PDC_US0 0xFFFC0100 +set AT91C_BASE_US0 0xFFFC0000 +set AT91C_BASE_PDC_SSC 0xFFFD4100 +set AT91C_BASE_SSC 0xFFFD4000 +set AT91C_BASE_TWI 0xFFFB8000 +set AT91C_BASE_PWMC_CH3 0xFFFCC260 +set AT91C_BASE_PWMC_CH2 0xFFFCC240 +set AT91C_BASE_PWMC_CH1 0xFFFCC220 +set AT91C_BASE_PWMC_CH0 0xFFFCC200 +set AT91C_BASE_PWMC 0xFFFCC000 +set AT91C_BASE_UDP 0xFFFB0000 +set AT91C_BASE_TC0 0xFFFA0000 +set AT91C_BASE_TC1 0xFFFA0040 +set AT91C_BASE_TC2 0xFFFA0080 +set AT91C_BASE_TCB 0xFFFA0000 +set AT91C_BASE_CAN_MB0 0xFFFD0200 +set AT91C_BASE_CAN_MB1 0xFFFD0220 +set AT91C_BASE_CAN_MB2 0xFFFD0240 +set AT91C_BASE_CAN_MB3 0xFFFD0260 +set AT91C_BASE_CAN_MB4 0xFFFD0280 +set AT91C_BASE_CAN_MB5 0xFFFD02A0 +set AT91C_BASE_CAN_MB6 0xFFFD02C0 +set AT91C_BASE_CAN_MB7 0xFFFD02E0 +set AT91C_BASE_CAN 0xFFFD0000 +set AT91C_BASE_EMAC 0xFFFDC000 +set AT91C_BASE_PDC_ADC 0xFFFD8100 +set AT91C_BASE_ADC 0xFFFD8000 + +# ***************************************************************************** +# PERIPHERAL ID DEFINITIONS FOR AT91SAM7X256 +# ***************************************************************************** +set AT91C_ID_FIQ 0 +set AT91C_ID_SYS 1 +set AT91C_ID_PIOA 2 +set AT91C_ID_PIOB 3 +set AT91C_ID_SPI0 4 +set AT91C_ID_SPI1 5 +set AT91C_ID_US0 6 +set AT91C_ID_US1 7 +set AT91C_ID_SSC 8 +set AT91C_ID_TWI 9 +set AT91C_ID_PWMC 10 +set AT91C_ID_UDP 11 +set AT91C_ID_TC0 12 +set AT91C_ID_TC1 13 +set AT91C_ID_TC2 14 +set AT91C_ID_CAN 15 +set AT91C_ID_EMAC 16 +set AT91C_ID_ADC 17 +set AT91C_ID_18_Reserved 18 +set AT91C_ID_19_Reserved 19 +set AT91C_ID_20_Reserved 20 +set AT91C_ID_21_Reserved 21 +set AT91C_ID_22_Reserved 22 +set AT91C_ID_23_Reserved 23 +set AT91C_ID_24_Reserved 24 +set AT91C_ID_25_Reserved 25 +set AT91C_ID_26_Reserved 26 +set AT91C_ID_27_Reserved 27 +set AT91C_ID_28_Reserved 28 +set AT91C_ID_29_Reserved 29 +set AT91C_ID_IRQ0 30 +set AT91C_ID_IRQ1 31 + +# ***************************************************************************** +# PIO DEFINITIONS FOR AT91SAM7X256 +# ***************************************************************************** +set AT91C_PIO_PA0 [expr 1 << 0 ] +set AT91C_PA0_RXD0 $AT91C_PIO_PA0 +set AT91C_PIO_PA1 [expr 1 << 1 ] +set AT91C_PA1_TXD0 $AT91C_PIO_PA1 +set AT91C_PIO_PA10 [expr 1 << 10 ] +set AT91C_PA10_TWD $AT91C_PIO_PA10 +set AT91C_PIO_PA11 [expr 1 << 11 ] +set AT91C_PA11_TWCK $AT91C_PIO_PA11 +set AT91C_PIO_PA12 [expr 1 << 12 ] +set AT91C_PA12_SPI0_NPCS0 $AT91C_PIO_PA12 +set AT91C_PIO_PA13 [expr 1 << 13 ] +set AT91C_PA13_SPI0_NPCS1 $AT91C_PIO_PA13 +set AT91C_PA13_PCK1 $AT91C_PIO_PA13 +set AT91C_PIO_PA14 [expr 1 << 14 ] +set AT91C_PA14_SPI0_NPCS2 $AT91C_PIO_PA14 +set AT91C_PA14_IRQ1 $AT91C_PIO_PA14 +set AT91C_PIO_PA15 [expr 1 << 15 ] +set AT91C_PA15_SPI0_NPCS3 $AT91C_PIO_PA15 +set AT91C_PA15_TCLK2 $AT91C_PIO_PA15 +set AT91C_PIO_PA16 [expr 1 << 16 ] +set AT91C_PA16_SPI0_MISO $AT91C_PIO_PA16 +set AT91C_PIO_PA17 [expr 1 << 17 ] +set AT91C_PA17_SPI0_MOSI $AT91C_PIO_PA17 +set AT91C_PIO_PA18 [expr 1 << 18 ] +set AT91C_PA18_SPI0_SPCK $AT91C_PIO_PA18 +set AT91C_PIO_PA19 [expr 1 << 19 ] +set AT91C_PA19_CANRX $AT91C_PIO_PA19 +set AT91C_PIO_PA2 [expr 1 << 2 ] +set AT91C_PA2_SCK0 $AT91C_PIO_PA2 +set AT91C_PA2_SPI1_NPCS1 $AT91C_PIO_PA2 +set AT91C_PIO_PA20 [expr 1 << 20 ] +set AT91C_PA20_CANTX $AT91C_PIO_PA20 +set AT91C_PIO_PA21 [expr 1 << 21 ] +set AT91C_PA21_TF $AT91C_PIO_PA21 +set AT91C_PA21_SPI1_NPCS0 $AT91C_PIO_PA21 +set AT91C_PIO_PA22 [expr 1 << 22 ] +set AT91C_PA22_TK $AT91C_PIO_PA22 +set AT91C_PA22_SPI1_SPCK $AT91C_PIO_PA22 +set AT91C_PIO_PA23 [expr 1 << 23 ] +set AT91C_PA23_TD $AT91C_PIO_PA23 +set AT91C_PA23_SPI1_MOSI $AT91C_PIO_PA23 +set AT91C_PIO_PA24 [expr 1 << 24 ] +set AT91C_PA24_RD $AT91C_PIO_PA24 +set AT91C_PA24_SPI1_MISO $AT91C_PIO_PA24 +set AT91C_PIO_PA25 [expr 1 << 25 ] +set AT91C_PA25_RK $AT91C_PIO_PA25 +set AT91C_PA25_SPI1_NPCS1 $AT91C_PIO_PA25 +set AT91C_PIO_PA26 [expr 1 << 26 ] +set AT91C_PA26_RF $AT91C_PIO_PA26 +set AT91C_PA26_SPI1_NPCS2 $AT91C_PIO_PA26 +set AT91C_PIO_PA27 [expr 1 << 27 ] +set AT91C_PA27_DRXD $AT91C_PIO_PA27 +set AT91C_PA27_PCK3 $AT91C_PIO_PA27 +set AT91C_PIO_PA28 [expr 1 << 28 ] +set AT91C_PA28_DTXD $AT91C_PIO_PA28 +set AT91C_PIO_PA29 [expr 1 << 29 ] +set AT91C_PA29_FIQ $AT91C_PIO_PA29 +set AT91C_PA29_SPI1_NPCS3 $AT91C_PIO_PA29 +set AT91C_PIO_PA3 [expr 1 << 3 ] +set AT91C_PA3_RTS0 $AT91C_PIO_PA3 +set AT91C_PA3_SPI1_NPCS2 $AT91C_PIO_PA3 +set AT91C_PIO_PA30 [expr 1 << 30 ] +set AT91C_PA30_IRQ0 $AT91C_PIO_PA30 +set AT91C_PA30_PCK2 $AT91C_PIO_PA30 +set AT91C_PIO_PA4 [expr 1 << 4 ] +set AT91C_PA4_CTS0 $AT91C_PIO_PA4 +set AT91C_PA4_SPI1_NPCS3 $AT91C_PIO_PA4 +set AT91C_PIO_PA5 [expr 1 << 5 ] +set AT91C_PA5_RXD1 $AT91C_PIO_PA5 +set AT91C_PIO_PA6 [expr 1 << 6 ] +set AT91C_PA6_TXD1 $AT91C_PIO_PA6 +set AT91C_PIO_PA7 [expr 1 << 7 ] +set AT91C_PA7_SCK1 $AT91C_PIO_PA7 +set AT91C_PA7_SPI0_NPCS1 $AT91C_PIO_PA7 +set AT91C_PIO_PA8 [expr 1 << 8 ] +set AT91C_PA8_RTS1 $AT91C_PIO_PA8 +set AT91C_PA8_SPI0_NPCS2 $AT91C_PIO_PA8 +set AT91C_PIO_PA9 [expr 1 << 9 ] +set AT91C_PA9_CTS1 $AT91C_PIO_PA9 +set AT91C_PA9_SPI0_NPCS3 $AT91C_PIO_PA9 +set AT91C_PIO_PB0 [expr 1 << 0 ] +set AT91C_PB0_ETXCK_EREFCK $AT91C_PIO_PB0 +set AT91C_PB0_PCK0 $AT91C_PIO_PB0 +set AT91C_PIO_PB1 [expr 1 << 1 ] +set AT91C_PB1_ETXEN $AT91C_PIO_PB1 +set AT91C_PIO_PB10 [expr 1 << 10 ] +set AT91C_PB10_ETX2 $AT91C_PIO_PB10 +set AT91C_PB10_SPI1_NPCS1 $AT91C_PIO_PB10 +set AT91C_PIO_PB11 [expr 1 << 11 ] +set AT91C_PB11_ETX3 $AT91C_PIO_PB11 +set AT91C_PB11_SPI1_NPCS2 $AT91C_PIO_PB11 +set AT91C_PIO_PB12 [expr 1 << 12 ] +set AT91C_PB12_ETXER $AT91C_PIO_PB12 +set AT91C_PB12_TCLK0 $AT91C_PIO_PB12 +set AT91C_PIO_PB13 [expr 1 << 13 ] +set AT91C_PB13_ERX2 $AT91C_PIO_PB13 +set AT91C_PB13_SPI0_NPCS1 $AT91C_PIO_PB13 +set AT91C_PIO_PB14 [expr 1 << 14 ] +set AT91C_PB14_ERX3 $AT91C_PIO_PB14 +set AT91C_PB14_SPI0_NPCS2 $AT91C_PIO_PB14 +set AT91C_PIO_PB15 [expr 1 << 15 ] +set AT91C_PB15_ERXDV_ECRSDV $AT91C_PIO_PB15 +set AT91C_PIO_PB16 [expr 1 << 16 ] +set AT91C_PB16_ECOL $AT91C_PIO_PB16 +set AT91C_PB16_SPI1_NPCS3 $AT91C_PIO_PB16 +set AT91C_PIO_PB17 [expr 1 << 17 ] +set AT91C_PB17_ERXCK $AT91C_PIO_PB17 +set AT91C_PB17_SPI0_NPCS3 $AT91C_PIO_PB17 +set AT91C_PIO_PB18 [expr 1 << 18 ] +set AT91C_PB18_EF100 $AT91C_PIO_PB18 +set AT91C_PB18_ADTRG $AT91C_PIO_PB18 +set AT91C_PIO_PB19 [expr 1 << 19 ] +set AT91C_PB19_PWM0 $AT91C_PIO_PB19 +set AT91C_PB19_TCLK1 $AT91C_PIO_PB19 +set AT91C_PIO_PB2 [expr 1 << 2 ] +set AT91C_PB2_ETX0 $AT91C_PIO_PB2 +set AT91C_PIO_PB20 [expr 1 << 20 ] +set AT91C_PB20_PWM1 $AT91C_PIO_PB20 +set AT91C_PB20_PCK0 $AT91C_PIO_PB20 +set AT91C_PIO_PB21 [expr 1 << 21 ] +set AT91C_PB21_PWM2 $AT91C_PIO_PB21 +set AT91C_PB21_PCK1 $AT91C_PIO_PB21 +set AT91C_PIO_PB22 [expr 1 << 22 ] +set AT91C_PB22_PWM3 $AT91C_PIO_PB22 +set AT91C_PB22_PCK2 $AT91C_PIO_PB22 +set AT91C_PIO_PB23 [expr 1 << 23 ] +set AT91C_PB23_TIOA0 $AT91C_PIO_PB23 +set AT91C_PB23_DCD1 $AT91C_PIO_PB23 +set AT91C_PIO_PB24 [expr 1 << 24 ] +set AT91C_PB24_TIOB0 $AT91C_PIO_PB24 +set AT91C_PB24_DSR1 $AT91C_PIO_PB24 +set AT91C_PIO_PB25 [expr 1 << 25 ] +set AT91C_PB25_TIOA1 $AT91C_PIO_PB25 +set AT91C_PB25_DTR1 $AT91C_PIO_PB25 +set AT91C_PIO_PB26 [expr 1 << 26 ] +set AT91C_PB26_TIOB1 $AT91C_PIO_PB26 +set AT91C_PB26_RI1 $AT91C_PIO_PB26 +set AT91C_PIO_PB27 [expr 1 << 27 ] +set AT91C_PB27_TIOA2 $AT91C_PIO_PB27 +set AT91C_PB27_PWM0 $AT91C_PIO_PB27 +set AT91C_PIO_PB28 [expr 1 << 28 ] +set AT91C_PB28_TIOB2 $AT91C_PIO_PB28 +set AT91C_PB28_PWM1 $AT91C_PIO_PB28 +set AT91C_PIO_PB29 [expr 1 << 29 ] +set AT91C_PB29_PCK1 $AT91C_PIO_PB29 +set AT91C_PB29_PWM2 $AT91C_PIO_PB29 +set AT91C_PIO_PB3 [expr 1 << 3 ] +set AT91C_PB3_ETX1 $AT91C_PIO_PB3 +set AT91C_PIO_PB30 [expr 1 << 30 ] +set AT91C_PB30_PCK2 $AT91C_PIO_PB30 +set AT91C_PB30_PWM3 $AT91C_PIO_PB30 +set AT91C_PIO_PB4 [expr 1 << 4 ] +set AT91C_PB4_ECRS $AT91C_PIO_PB4 +set AT91C_PIO_PB5 [expr 1 << 5 ] +set AT91C_PB5_ERX0 $AT91C_PIO_PB5 +set AT91C_PIO_PB6 [expr 1 << 6 ] +set AT91C_PB6_ERX1 $AT91C_PIO_PB6 +set AT91C_PIO_PB7 [expr 1 << 7 ] +set AT91C_PB7_ERXER $AT91C_PIO_PB7 +set AT91C_PIO_PB8 [expr 1 << 8 ] +set AT91C_PB8_EMDC $AT91C_PIO_PB8 +set AT91C_PIO_PB9 [expr 1 << 9 ] +set AT91C_PB9_EMDIO $AT91C_PIO_PB9 + +# ***************************************************************************** +# MEMORY MAPPING DEFINITIONS FOR AT91SAM7X256 +# ***************************************************************************** +set AT91C_ISRAM 0x00200000 +set AT91C_ISRAM_SIZE 0x00010000 +set AT91C_IFLASH 0x00100000 +set AT91C_IFLASH_SIZE 0x00040000 + + +# ***************************************************************************** +# ATTRIBUTES DEFINITIONS FOR AT91SAM7X256 +# ***************************************************************************** +array set AT91SAM7X256_att { + DBGU { LP DBGU_att } + PMC { LP PMC_att } + VREG { LP VREG_att } + RSTC { LP RSTC_att } + SSC { LP SSC_att } + WDTC { LP WDTC_att } + USART { LP US1_att US0_att } + SPI { LP SPI1_att SPI0_att } + PITC { LP PITC_att } + TCB { LP TCB_att } + CKGR { LP CKGR_att } + AIC { LP AIC_att } + TWI { LP TWI_att } + ADC { LP ADC_att } + PWMC_CH { LP PWMC_CH3_att PWMC_CH2_att PWMC_CH1_att PWMC_CH0_att } + RTTC { LP RTTC_att } + UDP { LP UDP_att } + EMAC { LP EMAC_att } + CAN_MB { LP CAN_MB0_att CAN_MB1_att CAN_MB2_att CAN_MB3_att CAN_MB4_att CAN_MB5_att CAN_MB6_att CAN_MB7_att } + TC { LP TC0_att TC1_att TC2_att } + SYS { LP SYS_att } + MC { LP MC_att } + PIO { LP PIOA_att PIOB_att } + CAN { LP CAN_att } + PWMC { LP PWMC_att } + PDC { LP PDC_DBGU_att PDC_SPI1_att PDC_SPI0_att PDC_US1_att PDC_US0_att PDC_SSC_att PDC_ADC_att } + +} +# ========== Peripheral attributes for DBGU peripheral ========== +array set DBGU_att { + EXID { R AT91C_DBGU_EXID RO } + BRGR { R AT91C_DBGU_BRGR RW } + IDR { R AT91C_DBGU_IDR WO } + CSR { R AT91C_DBGU_CSR RO } + CIDR { R AT91C_DBGU_CIDR RO } + MR { R AT91C_DBGU_MR RW } + IMR { R AT91C_DBGU_IMR RO } + CR { R AT91C_DBGU_CR WO } + FNTR { R AT91C_DBGU_FNTR RW } + THR { R AT91C_DBGU_THR WO } + RHR { R AT91C_DBGU_RHR RO } + IER { R AT91C_DBGU_IER WO } + listeReg { EXID BRGR IDR CSR CIDR MR IMR CR FNTR THR RHR IER } + +} + +# ========== Peripheral attributes for PMC peripheral ========== +array set PMC_att { + IDR { R AT91C_PMC_IDR WO } + MOR { R AT91C_PMC_MOR RW } + PLLR { R AT91C_PMC_PLLR RW } + PCER { R AT91C_PMC_PCER WO } + PCKR { R AT91C_PMC_PCKR RW } + MCKR { R AT91C_PMC_MCKR RW } + SCDR { R AT91C_PMC_SCDR WO } + PCDR { R AT91C_PMC_PCDR WO } + SCSR { R AT91C_PMC_SCSR RO } + PCSR { R AT91C_PMC_PCSR RO } + MCFR { R AT91C_PMC_MCFR RO } + SCER { R AT91C_PMC_SCER WO } + IMR { R AT91C_PMC_IMR RO } + IER { R AT91C_PMC_IER WO } + SR { R AT91C_PMC_SR RO } + listeReg { IDR MOR PLLR PCER PCKR MCKR SCDR PCDR SCSR PCSR MCFR SCER IMR IER SR } + +} + +# ========== Peripheral attributes for VREG peripheral ========== +array set VREG_att { + MR { R AT91C_VREG_MR RW } + listeReg { MR } + +} + +# ========== Peripheral attributes for RSTC peripheral ========== +array set RSTC_att { + RCR { R AT91C_RSTC_RCR WO } + RMR { R AT91C_RSTC_RMR RW } + RSR { R AT91C_RSTC_RSR RO } + listeReg { RCR RMR RSR } + +} + +# ========== Peripheral attributes for SSC peripheral ========== +array set SSC_att { + RHR { R AT91C_SSC_RHR RO } + RSHR { R AT91C_SSC_RSHR RO } + TFMR { R AT91C_SSC_TFMR RW } + IDR { R AT91C_SSC_IDR WO } + THR { R AT91C_SSC_THR WO } + RCMR { R AT91C_SSC_RCMR RW } + IER { R AT91C_SSC_IER WO } + TSHR { R AT91C_SSC_TSHR RW } + SR { R AT91C_SSC_SR RO } + CMR { R AT91C_SSC_CMR RW } + TCMR { R AT91C_SSC_TCMR RW } + CR { R AT91C_SSC_CR WO } + IMR { R AT91C_SSC_IMR RO } + RFMR { R AT91C_SSC_RFMR RW } + listeReg { RHR RSHR TFMR IDR THR RCMR IER TSHR SR CMR TCMR CR IMR RFMR } + +} + +# ========== Peripheral attributes for WDTC peripheral ========== +array set WDTC_att { + WDCR { R AT91C_WDTC_WDCR WO } + WDSR { R AT91C_WDTC_WDSR RO } + WDMR { R AT91C_WDTC_WDMR RW } + listeReg { WDCR WDSR WDMR } + +} + +# ========== Peripheral attributes for USART peripheral ========== +array set US1_att { + IF { R AT91C_US1_IF RW } + NER { R AT91C_US1_NER RO } + RTOR { R AT91C_US1_RTOR RW } + CSR { R AT91C_US1_CSR RO } + IDR { R AT91C_US1_IDR WO } + IER { R AT91C_US1_IER WO } + THR { R AT91C_US1_THR WO } + TTGR { R AT91C_US1_TTGR RW } + RHR { R AT91C_US1_RHR RO } + BRGR { R AT91C_US1_BRGR RW } + IMR { R AT91C_US1_IMR RO } + FIDI { R AT91C_US1_FIDI RW } + CR { R AT91C_US1_CR WO } + MR { R AT91C_US1_MR RW } + listeReg { IF NER RTOR CSR IDR IER THR TTGR RHR BRGR IMR FIDI CR MR } + +} +array set US0_att { + BRGR { R AT91C_US0_BRGR RW } + NER { R AT91C_US0_NER RO } + CR { R AT91C_US0_CR WO } + IMR { R AT91C_US0_IMR RO } + FIDI { R AT91C_US0_FIDI RW } + TTGR { R AT91C_US0_TTGR RW } + MR { R AT91C_US0_MR RW } + RTOR { R AT91C_US0_RTOR RW } + CSR { R AT91C_US0_CSR RO } + RHR { R AT91C_US0_RHR RO } + IDR { R AT91C_US0_IDR WO } + THR { R AT91C_US0_THR WO } + IF { R AT91C_US0_IF RW } + IER { R AT91C_US0_IER WO } + listeReg { BRGR NER CR IMR FIDI TTGR MR RTOR CSR RHR IDR THR IF IER } + +} + +# ========== Peripheral attributes for SPI peripheral ========== +array set SPI1_att { + IMR { R AT91C_SPI1_IMR RO } + IER { R AT91C_SPI1_IER WO } + MR { R AT91C_SPI1_MR RW } + RDR { R AT91C_SPI1_RDR RO } + IDR { R AT91C_SPI1_IDR WO } + SR { R AT91C_SPI1_SR RO } + TDR { R AT91C_SPI1_TDR WO } + CR { R AT91C_SPI1_CR RO } + CSR { R AT91C_SPI1_CSR RW } + listeReg { IMR IER MR RDR IDR SR TDR CR CSR } + +} +array set SPI0_att { + IER { R AT91C_SPI0_IER WO } + SR { R AT91C_SPI0_SR RO } + IDR { R AT91C_SPI0_IDR WO } + CR { R AT91C_SPI0_CR RO } + MR { R AT91C_SPI0_MR RW } + IMR { R AT91C_SPI0_IMR RO } + TDR { R AT91C_SPI0_TDR WO } + RDR { R AT91C_SPI0_RDR RO } + CSR { R AT91C_SPI0_CSR RW } + listeReg { IER SR IDR CR MR IMR TDR RDR CSR } + +} + +# ========== Peripheral attributes for PITC peripheral ========== +array set PITC_att { + PIVR { R AT91C_PITC_PIVR RO } + PISR { R AT91C_PITC_PISR RO } + PIIR { R AT91C_PITC_PIIR RO } + PIMR { R AT91C_PITC_PIMR RW } + listeReg { PIVR PISR PIIR PIMR } + +} + +# ========== Peripheral attributes for TCB peripheral ========== +array set TCB_att { + BMR { R AT91C_TCB_BMR RW } + BCR { R AT91C_TCB_BCR WO } + listeReg { BMR BCR } + +} + +# ========== Peripheral attributes for CKGR peripheral ========== +array set CKGR_att { + MOR { R AT91C_CKGR_MOR RW } + PLLR { R AT91C_CKGR_PLLR RW } + MCFR { R AT91C_CKGR_MCFR RO } + listeReg { MOR PLLR MCFR } + +} + +# ========== Peripheral attributes for AIC peripheral ========== +array set AIC_att { + IVR { R AT91C_AIC_IVR RO } + SMR { R AT91C_AIC_SMR RW } + FVR { R AT91C_AIC_FVR RO } + DCR { R AT91C_AIC_DCR RW } + EOICR { R AT91C_AIC_EOICR WO } + SVR { R AT91C_AIC_SVR RW } + FFSR { R AT91C_AIC_FFSR RO } + ICCR { R AT91C_AIC_ICCR WO } + ISR { R AT91C_AIC_ISR RO } + IMR { R AT91C_AIC_IMR RO } + IPR { R AT91C_AIC_IPR RO } + FFER { R AT91C_AIC_FFER WO } + IECR { R AT91C_AIC_IECR WO } + ISCR { R AT91C_AIC_ISCR WO } + FFDR { R AT91C_AIC_FFDR WO } + CISR { R AT91C_AIC_CISR RO } + IDCR { R AT91C_AIC_IDCR WO } + SPU { R AT91C_AIC_SPU RW } + listeReg { IVR SMR FVR DCR EOICR SVR FFSR ICCR ISR IMR IPR FFER IECR ISCR FFDR CISR IDCR SPU } + +} + +# ========== Peripheral attributes for TWI peripheral ========== +array set TWI_att { + IER { R AT91C_TWI_IER WO } + CR { R AT91C_TWI_CR WO } + SR { R AT91C_TWI_SR RO } + IMR { R AT91C_TWI_IMR RO } + THR { R AT91C_TWI_THR WO } + IDR { R AT91C_TWI_IDR WO } + IADR { R AT91C_TWI_IADR RW } + MMR { R AT91C_TWI_MMR RW } + CWGR { R AT91C_TWI_CWGR RW } + RHR { R AT91C_TWI_RHR RO } + listeReg { IER CR SR IMR THR IDR IADR MMR CWGR RHR } + +} + +# ========== Peripheral attributes for ADC peripheral ========== +array set ADC_att { + CDR2 { R AT91C_ADC_CDR2 RO } + CDR3 { R AT91C_ADC_CDR3 RO } + CDR0 { R AT91C_ADC_CDR0 RO } + CDR5 { R AT91C_ADC_CDR5 RO } + CHDR { R AT91C_ADC_CHDR WO } + SR { R AT91C_ADC_SR RO } + CDR4 { R AT91C_ADC_CDR4 RO } + CDR1 { R AT91C_ADC_CDR1 RO } + LCDR { R AT91C_ADC_LCDR RO } + IDR { R AT91C_ADC_IDR WO } + CR { R AT91C_ADC_CR WO } + CDR7 { R AT91C_ADC_CDR7 RO } + CDR6 { R AT91C_ADC_CDR6 RO } + IER { R AT91C_ADC_IER WO } + CHER { R AT91C_ADC_CHER WO } + CHSR { R AT91C_ADC_CHSR RO } + MR { R AT91C_ADC_MR RW } + IMR { R AT91C_ADC_IMR RO } + listeReg { CDR2 CDR3 CDR0 CDR5 CHDR SR CDR4 CDR1 LCDR IDR CR CDR7 CDR6 IER CHER CHSR MR IMR } + +} + +# ========== Peripheral attributes for PWMC_CH peripheral ========== +array set PWMC_CH3_att { + CUPDR { R AT91C_PWMC_CH3_CUPDR WO } + Reserved { R AT91C_PWMC_CH3_Reserved WO } + CPRDR { R AT91C_PWMC_CH3_CPRDR RW } + CDTYR { R AT91C_PWMC_CH3_CDTYR RW } + CCNTR { R AT91C_PWMC_CH3_CCNTR RO } + CMR { R AT91C_PWMC_CH3_CMR RW } + listeReg { CUPDR Reserved CPRDR CDTYR CCNTR CMR } + +} +array set PWMC_CH2_att { + Reserved { R AT91C_PWMC_CH2_Reserved WO } + CMR { R AT91C_PWMC_CH2_CMR RW } + CCNTR { R AT91C_PWMC_CH2_CCNTR RO } + CPRDR { R AT91C_PWMC_CH2_CPRDR RW } + CUPDR { R AT91C_PWMC_CH2_CUPDR WO } + CDTYR { R AT91C_PWMC_CH2_CDTYR RW } + listeReg { Reserved CMR CCNTR CPRDR CUPDR CDTYR } + +} +array set PWMC_CH1_att { + Reserved { R AT91C_PWMC_CH1_Reserved WO } + CUPDR { R AT91C_PWMC_CH1_CUPDR WO } + CPRDR { R AT91C_PWMC_CH1_CPRDR RW } + CCNTR { R AT91C_PWMC_CH1_CCNTR RO } + CDTYR { R AT91C_PWMC_CH1_CDTYR RW } + CMR { R AT91C_PWMC_CH1_CMR RW } + listeReg { Reserved CUPDR CPRDR CCNTR CDTYR CMR } + +} +array set PWMC_CH0_att { + Reserved { R AT91C_PWMC_CH0_Reserved WO } + CPRDR { R AT91C_PWMC_CH0_CPRDR RW } + CDTYR { R AT91C_PWMC_CH0_CDTYR RW } + CMR { R AT91C_PWMC_CH0_CMR RW } + CUPDR { R AT91C_PWMC_CH0_CUPDR WO } + CCNTR { R AT91C_PWMC_CH0_CCNTR RO } + listeReg { Reserved CPRDR CDTYR CMR CUPDR CCNTR } + +} + +# ========== Peripheral attributes for RTTC peripheral ========== +array set RTTC_att { + RTSR { R AT91C_RTTC_RTSR RO } + RTMR { R AT91C_RTTC_RTMR RW } + RTVR { R AT91C_RTTC_RTVR RO } + RTAR { R AT91C_RTTC_RTAR RW } + listeReg { RTSR RTMR RTVR RTAR } + +} + +# ========== Peripheral attributes for UDP peripheral ========== +array set UDP_att { + IMR { R AT91C_UDP_IMR RO } + FADDR { R AT91C_UDP_FADDR RW } + NUM { R AT91C_UDP_NUM RO } + FDR { R AT91C_UDP_FDR RW } + ISR { R AT91C_UDP_ISR RO } + CSR { R AT91C_UDP_CSR RW } + IDR { R AT91C_UDP_IDR WO } + ICR { R AT91C_UDP_ICR RO } + RSTEP { R AT91C_UDP_RSTEP RO } + TXVC { R AT91C_UDP_TXVC RW } + GLBSTATE { R AT91C_UDP_GLBSTATE RW } + IER { R AT91C_UDP_IER WO } + listeReg { IMR FADDR NUM FDR ISR CSR IDR ICR RSTEP TXVC GLBSTATE IER } + +} + +# ========== Peripheral attributes for EMAC peripheral ========== +array set EMAC_att { + ISR { R AT91C_EMAC_ISR RW } + SA4H { R AT91C_EMAC_SA4H RW } + SA1L { R AT91C_EMAC_SA1L RW } + ELE { R AT91C_EMAC_ELE RW } + LCOL { R AT91C_EMAC_LCOL RW } + RLE { R AT91C_EMAC_RLE RW } + WOL { R AT91C_EMAC_WOL RW } + DTF { R AT91C_EMAC_DTF RW } + TUND { R AT91C_EMAC_TUND RW } + NCR { R AT91C_EMAC_NCR RW } + SA4L { R AT91C_EMAC_SA4L RW } + RSR { R AT91C_EMAC_RSR RW } + SA3L { R AT91C_EMAC_SA3L RW } + TSR { R AT91C_EMAC_TSR RW } + IDR { R AT91C_EMAC_IDR WO } + RSE { R AT91C_EMAC_RSE RW } + ECOL { R AT91C_EMAC_ECOL RW } + TID { R AT91C_EMAC_TID RW } + HRB { R AT91C_EMAC_HRB RW } + TBQP { R AT91C_EMAC_TBQP RW } + USRIO { R AT91C_EMAC_USRIO RW } + PTR { R AT91C_EMAC_PTR RW } + SA2H { R AT91C_EMAC_SA2H RW } + ROV { R AT91C_EMAC_ROV RW } + ALE { R AT91C_EMAC_ALE RW } + RJA { R AT91C_EMAC_RJA RW } + RBQP { R AT91C_EMAC_RBQP RW } + TPF { R AT91C_EMAC_TPF RW } + NCFGR { R AT91C_EMAC_NCFGR RW } + HRT { R AT91C_EMAC_HRT RW } + USF { R AT91C_EMAC_USF RW } + FCSE { R AT91C_EMAC_FCSE RW } + TPQ { R AT91C_EMAC_TPQ RW } + MAN { R AT91C_EMAC_MAN RW } + FTO { R AT91C_EMAC_FTO RW } + REV { R AT91C_EMAC_REV RO } + IMR { R AT91C_EMAC_IMR RO } + SCF { R AT91C_EMAC_SCF RW } + PFR { R AT91C_EMAC_PFR RW } + MCF { R AT91C_EMAC_MCF RW } + NSR { R AT91C_EMAC_NSR RO } + SA2L { R AT91C_EMAC_SA2L RW } + FRO { R AT91C_EMAC_FRO RW } + IER { R AT91C_EMAC_IER WO } + SA1H { R AT91C_EMAC_SA1H RW } + CSE { R AT91C_EMAC_CSE RW } + SA3H { R AT91C_EMAC_SA3H RW } + RRE { R AT91C_EMAC_RRE RW } + STE { R AT91C_EMAC_STE RW } + listeReg { ISR SA4H SA1L ELE LCOL RLE WOL DTF TUND NCR SA4L RSR SA3L TSR IDR RSE ECOL TID HRB TBQP USRIO PTR SA2H ROV ALE RJA RBQP TPF NCFGR HRT USF FCSE TPQ MAN FTO REV IMR SCF PFR MCF NSR SA2L FRO IER SA1H CSE SA3H RRE STE } + +} + +# ========== Peripheral attributes for CAN_MB peripheral ========== +array set CAN_MB0_att { + MDL { R AT91C_CAN_MB0_MDL RW } + MAM { R AT91C_CAN_MB0_MAM RW } + MCR { R AT91C_CAN_MB0_MCR WO } + MID { R AT91C_CAN_MB0_MID RW } + MSR { R AT91C_CAN_MB0_MSR RO } + MFID { R AT91C_CAN_MB0_MFID RO } + MDH { R AT91C_CAN_MB0_MDH RW } + MMR { R AT91C_CAN_MB0_MMR RW } + listeReg { MDL MAM MCR MID MSR MFID MDH MMR } + +} +array set CAN_MB1_att { + MDL { R AT91C_CAN_MB1_MDL RW } + MID { R AT91C_CAN_MB1_MID RW } + MMR { R AT91C_CAN_MB1_MMR RW } + MSR { R AT91C_CAN_MB1_MSR RO } + MAM { R AT91C_CAN_MB1_MAM RW } + MDH { R AT91C_CAN_MB1_MDH RW } + MCR { R AT91C_CAN_MB1_MCR WO } + MFID { R AT91C_CAN_MB1_MFID RO } + listeReg { MDL MID MMR MSR MAM MDH MCR MFID } + +} +array set CAN_MB2_att { + MCR { R AT91C_CAN_MB2_MCR WO } + MDH { R AT91C_CAN_MB2_MDH RW } + MID { R AT91C_CAN_MB2_MID RW } + MDL { R AT91C_CAN_MB2_MDL RW } + MMR { R AT91C_CAN_MB2_MMR RW } + MAM { R AT91C_CAN_MB2_MAM RW } + MFID { R AT91C_CAN_MB2_MFID RO } + MSR { R AT91C_CAN_MB2_MSR RO } + listeReg { MCR MDH MID MDL MMR MAM MFID MSR } + +} +array set CAN_MB3_att { + MFID { R AT91C_CAN_MB3_MFID RO } + MAM { R AT91C_CAN_MB3_MAM RW } + MID { R AT91C_CAN_MB3_MID RW } + MCR { R AT91C_CAN_MB3_MCR WO } + MMR { R AT91C_CAN_MB3_MMR RW } + MSR { R AT91C_CAN_MB3_MSR RO } + MDL { R AT91C_CAN_MB3_MDL RW } + MDH { R AT91C_CAN_MB3_MDH RW } + listeReg { MFID MAM MID MCR MMR MSR MDL MDH } + +} +array set CAN_MB4_att { + MID { R AT91C_CAN_MB4_MID RW } + MMR { R AT91C_CAN_MB4_MMR RW } + MDH { R AT91C_CAN_MB4_MDH RW } + MFID { R AT91C_CAN_MB4_MFID RO } + MSR { R AT91C_CAN_MB4_MSR RO } + MCR { R AT91C_CAN_MB4_MCR WO } + MDL { R AT91C_CAN_MB4_MDL RW } + MAM { R AT91C_CAN_MB4_MAM RW } + listeReg { MID MMR MDH MFID MSR MCR MDL MAM } + +} +array set CAN_MB5_att { + MSR { R AT91C_CAN_MB5_MSR RO } + MCR { R AT91C_CAN_MB5_MCR WO } + MFID { R AT91C_CAN_MB5_MFID RO } + MDH { R AT91C_CAN_MB5_MDH RW } + MID { R AT91C_CAN_MB5_MID RW } + MMR { R AT91C_CAN_MB5_MMR RW } + MDL { R AT91C_CAN_MB5_MDL RW } + MAM { R AT91C_CAN_MB5_MAM RW } + listeReg { MSR MCR MFID MDH MID MMR MDL MAM } + +} +array set CAN_MB6_att { + MFID { R AT91C_CAN_MB6_MFID RO } + MID { R AT91C_CAN_MB6_MID RW } + MAM { R AT91C_CAN_MB6_MAM RW } + MSR { R AT91C_CAN_MB6_MSR RO } + MDL { R AT91C_CAN_MB6_MDL RW } + MCR { R AT91C_CAN_MB6_MCR WO } + MDH { R AT91C_CAN_MB6_MDH RW } + MMR { R AT91C_CAN_MB6_MMR RW } + listeReg { MFID MID MAM MSR MDL MCR MDH MMR } + +} +array set CAN_MB7_att { + MCR { R AT91C_CAN_MB7_MCR WO } + MDH { R AT91C_CAN_MB7_MDH RW } + MFID { R AT91C_CAN_MB7_MFID RO } + MDL { R AT91C_CAN_MB7_MDL RW } + MID { R AT91C_CAN_MB7_MID RW } + MMR { R AT91C_CAN_MB7_MMR RW } + MAM { R AT91C_CAN_MB7_MAM RW } + MSR { R AT91C_CAN_MB7_MSR RO } + listeReg { MCR MDH MFID MDL MID MMR MAM MSR } + +} + +# ========== Peripheral attributes for TC peripheral ========== +array set TC0_att { + SR { R AT91C_TC0_SR RO } + RC { R AT91C_TC0_RC RW } + RB { R AT91C_TC0_RB RW } + CCR { R AT91C_TC0_CCR WO } + CMR { R AT91C_TC0_CMR RW } + IER { R AT91C_TC0_IER WO } + RA { R AT91C_TC0_RA RW } + IDR { R AT91C_TC0_IDR WO } + CV { R AT91C_TC0_CV RW } + IMR { R AT91C_TC0_IMR RO } + listeReg { SR RC RB CCR CMR IER RA IDR CV IMR } + +} +array set TC1_att { + RB { R AT91C_TC1_RB RW } + CCR { R AT91C_TC1_CCR WO } + IER { R AT91C_TC1_IER WO } + IDR { R AT91C_TC1_IDR WO } + SR { R AT91C_TC1_SR RO } + CMR { R AT91C_TC1_CMR RW } + RA { R AT91C_TC1_RA RW } + RC { R AT91C_TC1_RC RW } + IMR { R AT91C_TC1_IMR RO } + CV { R AT91C_TC1_CV RW } + listeReg { RB CCR IER IDR SR CMR RA RC IMR CV } + +} +array set TC2_att { + CMR { R AT91C_TC2_CMR RW } + CCR { R AT91C_TC2_CCR WO } + CV { R AT91C_TC2_CV RW } + RA { R AT91C_TC2_RA RW } + RB { R AT91C_TC2_RB RW } + IDR { R AT91C_TC2_IDR WO } + IMR { R AT91C_TC2_IMR RO } + RC { R AT91C_TC2_RC RW } + IER { R AT91C_TC2_IER WO } + SR { R AT91C_TC2_SR RO } + listeReg { CMR CCR CV RA RB IDR IMR RC IER SR } + +} + +# ========== Peripheral attributes for SYS peripheral ========== +array set SYS_att { + listeReg { } + +} + +# ========== Peripheral attributes for MC peripheral ========== +array set MC_att { + ASR { R AT91C_MC_ASR RO } + RCR { R AT91C_MC_RCR WO } + FCR { R AT91C_MC_FCR WO } + AASR { R AT91C_MC_AASR RO } + FSR { R AT91C_MC_FSR RO } + FMR { R AT91C_MC_FMR RW } + listeReg { ASR RCR FCR AASR FSR FMR } + +} + +# ========== Peripheral attributes for PIO peripheral ========== +array set PIOA_att { + ODR { R AT91C_PIOA_ODR WO } + SODR { R AT91C_PIOA_SODR WO } + ISR { R AT91C_PIOA_ISR RO } + ABSR { R AT91C_PIOA_ABSR RO } + IER { R AT91C_PIOA_IER WO } + PPUDR { R AT91C_PIOA_PPUDR WO } + IMR { R AT91C_PIOA_IMR RO } + PER { R AT91C_PIOA_PER WO } + IFDR { R AT91C_PIOA_IFDR WO } + OWDR { R AT91C_PIOA_OWDR WO } + MDSR { R AT91C_PIOA_MDSR RO } + IDR { R AT91C_PIOA_IDR WO } + ODSR { R AT91C_PIOA_ODSR RO } + PPUSR { R AT91C_PIOA_PPUSR RO } + OWSR { R AT91C_PIOA_OWSR RO } + BSR { R AT91C_PIOA_BSR WO } + OWER { R AT91C_PIOA_OWER WO } + IFER { R AT91C_PIOA_IFER WO } + PDSR { R AT91C_PIOA_PDSR RO } + PPUER { R AT91C_PIOA_PPUER WO } + OSR { R AT91C_PIOA_OSR RO } + ASR { R AT91C_PIOA_ASR WO } + MDDR { R AT91C_PIOA_MDDR WO } + CODR { R AT91C_PIOA_CODR WO } + MDER { R AT91C_PIOA_MDER WO } + PDR { R AT91C_PIOA_PDR WO } + IFSR { R AT91C_PIOA_IFSR RO } + OER { R AT91C_PIOA_OER WO } + PSR { R AT91C_PIOA_PSR RO } + listeReg { ODR SODR ISR ABSR IER PPUDR IMR PER IFDR OWDR MDSR IDR ODSR PPUSR OWSR BSR OWER IFER PDSR PPUER OSR ASR MDDR CODR MDER PDR IFSR OER PSR } + +} +array set PIOB_att { + OWDR { R AT91C_PIOB_OWDR WO } + MDER { R AT91C_PIOB_MDER WO } + PPUSR { R AT91C_PIOB_PPUSR RO } + IMR { R AT91C_PIOB_IMR RO } + ASR { R AT91C_PIOB_ASR WO } + PPUDR { R AT91C_PIOB_PPUDR WO } + PSR { R AT91C_PIOB_PSR RO } + IER { R AT91C_PIOB_IER WO } + CODR { R AT91C_PIOB_CODR WO } + OWER { R AT91C_PIOB_OWER WO } + ABSR { R AT91C_PIOB_ABSR RO } + IFDR { R AT91C_PIOB_IFDR WO } + PDSR { R AT91C_PIOB_PDSR RO } + IDR { R AT91C_PIOB_IDR WO } + OWSR { R AT91C_PIOB_OWSR RO } + PDR { R AT91C_PIOB_PDR WO } + ODR { R AT91C_PIOB_ODR WO } + IFSR { R AT91C_PIOB_IFSR RO } + PPUER { R AT91C_PIOB_PPUER WO } + SODR { R AT91C_PIOB_SODR WO } + ISR { R AT91C_PIOB_ISR RO } + ODSR { R AT91C_PIOB_ODSR RO } + OSR { R AT91C_PIOB_OSR RO } + MDSR { R AT91C_PIOB_MDSR RO } + IFER { R AT91C_PIOB_IFER WO } + BSR { R AT91C_PIOB_BSR WO } + MDDR { R AT91C_PIOB_MDDR WO } + OER { R AT91C_PIOB_OER WO } + PER { R AT91C_PIOB_PER WO } + listeReg { OWDR MDER PPUSR IMR ASR PPUDR PSR IER CODR OWER ABSR IFDR PDSR IDR OWSR PDR ODR IFSR PPUER SODR ISR ODSR OSR MDSR IFER BSR MDDR OER PER } + +} + +# ========== Peripheral attributes for CAN peripheral ========== +array set CAN_att { + TCR { R AT91C_CAN_TCR WO } + IMR { R AT91C_CAN_IMR RO } + IER { R AT91C_CAN_IER WO } + ECR { R AT91C_CAN_ECR RO } + TIMESTP { R AT91C_CAN_TIMESTP RO } + MR { R AT91C_CAN_MR RW } + IDR { R AT91C_CAN_IDR WO } + ACR { R AT91C_CAN_ACR WO } + TIM { R AT91C_CAN_TIM RO } + SR { R AT91C_CAN_SR RO } + BR { R AT91C_CAN_BR RW } + VR { R AT91C_CAN_VR RO } + listeReg { TCR IMR IER ECR TIMESTP MR IDR ACR TIM SR BR VR } + +} + +# ========== Peripheral attributes for PWMC peripheral ========== +array set PWMC_att { + IDR { R AT91C_PWMC_IDR WO } + DIS { R AT91C_PWMC_DIS WO } + IER { R AT91C_PWMC_IER WO } + VR { R AT91C_PWMC_VR RO } + ISR { R AT91C_PWMC_ISR RO } + SR { R AT91C_PWMC_SR RO } + IMR { R AT91C_PWMC_IMR RO } + MR { R AT91C_PWMC_MR RW } + ENA { R AT91C_PWMC_ENA WO } + listeReg { IDR DIS IER VR ISR SR IMR MR ENA } + +} + +# ========== Peripheral attributes for PDC peripheral ========== +array set PDC_DBGU_att { + TCR { R AT91C_DBGU_TCR RW } + RNPR { R AT91C_DBGU_RNPR RW } + TNPR { R AT91C_DBGU_TNPR RW } + TPR { R AT91C_DBGU_TPR RW } + RPR { R AT91C_DBGU_RPR RW } + RCR { R AT91C_DBGU_RCR RW } + RNCR { R AT91C_DBGU_RNCR RW } + PTCR { R AT91C_DBGU_PTCR WO } + PTSR { R AT91C_DBGU_PTSR RO } + TNCR { R AT91C_DBGU_TNCR RW } + listeReg { TCR RNPR TNPR TPR RPR RCR RNCR PTCR PTSR TNCR } + +} +array set PDC_SPI1_att { + PTCR { R AT91C_SPI1_PTCR WO } + RPR { R AT91C_SPI1_RPR RW } + TNCR { R AT91C_SPI1_TNCR RW } + TPR { R AT91C_SPI1_TPR RW } + TNPR { R AT91C_SPI1_TNPR RW } + TCR { R AT91C_SPI1_TCR RW } + RCR { R AT91C_SPI1_RCR RW } + RNPR { R AT91C_SPI1_RNPR RW } + RNCR { R AT91C_SPI1_RNCR RW } + PTSR { R AT91C_SPI1_PTSR RO } + listeReg { PTCR RPR TNCR TPR TNPR TCR RCR RNPR RNCR PTSR } + +} +array set PDC_SPI0_att { + PTCR { R AT91C_SPI0_PTCR WO } + TPR { R AT91C_SPI0_TPR RW } + TCR { R AT91C_SPI0_TCR RW } + RCR { R AT91C_SPI0_RCR RW } + PTSR { R AT91C_SPI0_PTSR RO } + RNPR { R AT91C_SPI0_RNPR RW } + RPR { R AT91C_SPI0_RPR RW } + TNCR { R AT91C_SPI0_TNCR RW } + RNCR { R AT91C_SPI0_RNCR RW } + TNPR { R AT91C_SPI0_TNPR RW } + listeReg { PTCR TPR TCR RCR PTSR RNPR RPR TNCR RNCR TNPR } + +} +array set PDC_US1_att { + RNCR { R AT91C_US1_RNCR RW } + PTCR { R AT91C_US1_PTCR WO } + TCR { R AT91C_US1_TCR RW } + PTSR { R AT91C_US1_PTSR RO } + TNPR { R AT91C_US1_TNPR RW } + RCR { R AT91C_US1_RCR RW } + RNPR { R AT91C_US1_RNPR RW } + RPR { R AT91C_US1_RPR RW } + TNCR { R AT91C_US1_TNCR RW } + TPR { R AT91C_US1_TPR RW } + listeReg { RNCR PTCR TCR PTSR TNPR RCR RNPR RPR TNCR TPR } + +} +array set PDC_US0_att { + TNPR { R AT91C_US0_TNPR RW } + RNPR { R AT91C_US0_RNPR RW } + TCR { R AT91C_US0_TCR RW } + PTCR { R AT91C_US0_PTCR WO } + PTSR { R AT91C_US0_PTSR RO } + TNCR { R AT91C_US0_TNCR RW } + TPR { R AT91C_US0_TPR RW } + RCR { R AT91C_US0_RCR RW } + RPR { R AT91C_US0_RPR RW } + RNCR { R AT91C_US0_RNCR RW } + listeReg { TNPR RNPR TCR PTCR PTSR TNCR TPR RCR RPR RNCR } + +} +array set PDC_SSC_att { + TNCR { R AT91C_SSC_TNCR RW } + RPR { R AT91C_SSC_RPR RW } + RNCR { R AT91C_SSC_RNCR RW } + TPR { R AT91C_SSC_TPR RW } + PTCR { R AT91C_SSC_PTCR WO } + TCR { R AT91C_SSC_TCR RW } + RCR { R AT91C_SSC_RCR RW } + RNPR { R AT91C_SSC_RNPR RW } + TNPR { R AT91C_SSC_TNPR RW } + PTSR { R AT91C_SSC_PTSR RO } + listeReg { TNCR RPR RNCR TPR PTCR TCR RCR RNPR TNPR PTSR } + +} +array set PDC_ADC_att { + PTSR { R AT91C_ADC_PTSR RO } + PTCR { R AT91C_ADC_PTCR WO } + TNPR { R AT91C_ADC_TNPR RW } + TNCR { R AT91C_ADC_TNCR RW } + RNPR { R AT91C_ADC_RNPR RW } + RNCR { R AT91C_ADC_RNCR RW } + RPR { R AT91C_ADC_RPR RW } + TCR { R AT91C_ADC_TCR RW } + TPR { R AT91C_ADC_TPR RW } + RCR { R AT91C_ADC_RCR RW } + listeReg { PTSR PTCR TNPR TNCR RNPR RNCR RPR TCR TPR RCR } + +} + +# ========== PIO information ========== + +array set def_PIOA_att { + PA0 { RXD0 } + PA1 { TXD0 } + PA10 { TWD } + PA11 { TWCK } + PA12 { SPI0_NPCS0 } + PA13 { SPI0_NPCS1 PCK1 } + PA14 { SPI0_NPCS2 IRQ1 } + PA15 { SPI0_NPCS3 TCLK2 } + PA16 { SPI0_MISO } + PA17 { SPI0_MOSI } + PA18 { SPI0_SPCK } + PA19 { CANRX } + PA2 { SCK0 SPI1_NPCS1 } + PA20 { CANTX } + PA21 { TF SPI1_NPCS0 } + PA22 { TK SPI1_SPCK } + PA23 { TD SPI1_MOSI } + PA24 { RD SPI1_MISO } + PA25 { RK SPI1_NPCS1 } + PA26 { RF SPI1_NPCS2 } + PA27 { DRXD PCK3 } + PA28 { DTXD } + PA29 { FIQ SPI1_NPCS3 } + PA3 { RTS0 SPI1_NPCS2 } + PA30 { IRQ0 PCK2 } + PA4 { CTS0 SPI1_NPCS3 } + PA5 { RXD1 } + PA6 { TXD1 } + PA7 { SCK1 SPI0_NPCS1 } + PA8 { RTS1 SPI0_NPCS2 } + PA9 { CTS1 SPI0_NPCS3 } + } + +array set def_PIOB_att { + PB0 { ETXCK_EREFCK PCK0 } + PB1 { ETXEN } + PB10 { ETX2 SPI1_NPCS1 } + PB11 { ETX3 SPI1_NPCS2 } + PB12 { ETXER TCLK0 } + PB13 { ERX2 SPI0_NPCS1 } + PB14 { ERX3 SPI0_NPCS2 } + PB15 { ERXDV_ECRSDV } + PB16 { ECOL SPI1_NPCS3 } + PB17 { ERXCK SPI0_NPCS3 } + PB18 { EF100 ADTRG } + PB19 { PWM0 TCLK1 } + PB2 { ETX0 } + PB20 { PWM1 PCK0 } + PB21 { PWM2 PCK1 } + PB22 { PWM3 PCK2 } + PB23 { TIOA0 DCD1 } + PB24 { TIOB0 DSR1 } + PB25 { TIOA1 DTR1 } + PB26 { TIOB1 RI1 } + PB27 { TIOA2 PWM0 } + PB28 { TIOB2 PWM1 } + PB29 { PCK1 PWM2 } + PB3 { ETX1 } + PB30 { PCK2 PWM3 } + PB4 { ECRS } + PB5 { ERX0 } + PB6 { ERX1 } + PB7 { ERXER } + PB8 { EMDC } + PB9 { EMDIO } + } diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256_inc.h b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256_inc.h new file mode 100644 index 0000000..b393d05 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256_inc.h @@ -0,0 +1,2268 @@ +// ---------------------------------------------------------------------------- +// ATMEL Microcontroller Software Support - ROUSSET - +// ---------------------------------------------------------------------------- +// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// ---------------------------------------------------------------------------- +// File Name : AT91SAM7X256.h +// Object : AT91SAM7X256 definitions +// Generated : AT91 SW Application Group 11/02/2005 (15:17:24) +// +// CVS Reference : /AT91SAM7X256.pl/1.14/Tue Sep 13 15:06:52 2005// +// CVS Reference : /SYS_SAM7X.pl/1.3/Tue Feb 1 17:01:43 2005// +// CVS Reference : /MC_SAM7X.pl/1.2/Fri May 20 14:13:04 2005// +// CVS Reference : /PMC_SAM7X.pl/1.4/Tue Feb 8 13:58:10 2005// +// CVS Reference : /RSTC_SAM7X.pl/1.2/Wed Jul 13 14:57:50 2005// +// CVS Reference : /UDP_SAM7X.pl/1.1/Tue May 10 11:35:35 2005// +// CVS Reference : /PWM_SAM7X.pl/1.1/Tue May 10 11:53:07 2005// +// CVS Reference : /AIC_6075B.pl/1.3/Fri May 20 14:01:30 2005// +// CVS Reference : /PIO_6057A.pl/1.2/Thu Feb 3 10:18:28 2005// +// CVS Reference : /RTTC_6081A.pl/1.2/Tue Nov 9 14:43:58 2004// +// CVS Reference : /PITC_6079A.pl/1.2/Tue Nov 9 14:43:56 2004// +// CVS Reference : /WDTC_6080A.pl/1.3/Tue Nov 9 14:44:00 2004// +// CVS Reference : /VREG_6085B.pl/1.1/Tue Feb 1 16:05:48 2005// +// CVS Reference : /PDC_6074C.pl/1.2/Thu Feb 3 08:48:54 2005// +// CVS Reference : /DBGU_6059D.pl/1.1/Mon Jan 31 13:15:32 2005// +// CVS Reference : /SPI_6088D.pl/1.3/Fri May 20 14:08:59 2005// +// CVS Reference : /US_6089C.pl/1.1/Mon Jul 12 18:23:26 2004// +// CVS Reference : /SSC_6078B.pl/1.1/Wed Jul 13 15:19:19 2005// +// CVS Reference : /TWI_6061A.pl/1.1/Tue Jul 13 07:38:06 2004// +// CVS Reference : /TC_6082A.pl/1.7/Fri Mar 11 12:52:17 2005// +// CVS Reference : /CAN_6019B.pl/1.1/Tue Mar 8 12:42:22 2005// +// CVS Reference : /EMACB_6119A.pl/1.6/Wed Jul 13 15:05:35 2005// +// CVS Reference : /ADC_6051C.pl/1.1/Fri Oct 17 09:12:38 2003// +// ---------------------------------------------------------------------------- + +// Hardware register definition + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR System Peripherals +// ***************************************************************************** + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Advanced Interrupt Controller +// ***************************************************************************** +// *** Register offset in AT91S_AIC structure *** +#define AIC_SMR ( 0) // Source Mode Register +#define AIC_SVR (128) // Source Vector Register +#define AIC_IVR (256) // IRQ Vector Register +#define AIC_FVR (260) // FIQ Vector Register +#define AIC_ISR (264) // Interrupt Status Register +#define AIC_IPR (268) // Interrupt Pending Register +#define AIC_IMR (272) // Interrupt Mask Register +#define AIC_CISR (276) // Core Interrupt Status Register +#define AIC_IECR (288) // Interrupt Enable Command Register +#define AIC_IDCR (292) // Interrupt Disable Command Register +#define AIC_ICCR (296) // Interrupt Clear Command Register +#define AIC_ISCR (300) // Interrupt Set Command Register +#define AIC_EOICR (304) // End of Interrupt Command Register +#define AIC_SPU (308) // Spurious Vector Register +#define AIC_DCR (312) // Debug Control Register (Protect) +#define AIC_FFER (320) // Fast Forcing Enable Register +#define AIC_FFDR (324) // Fast Forcing Disable Register +#define AIC_FFSR (328) // Fast Forcing Status Register +// -------- AIC_SMR : (AIC Offset: 0x0) Control Register -------- +#define AT91C_AIC_PRIOR (0x7 << 0) // (AIC) Priority Level +#define AT91C_AIC_PRIOR_LOWEST (0x0) // (AIC) Lowest priority level +#define AT91C_AIC_PRIOR_HIGHEST (0x7) // (AIC) Highest priority level +#define AT91C_AIC_SRCTYPE (0x3 << 5) // (AIC) Interrupt Source Type +#define AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL (0x0 << 5) // (AIC) Internal Sources Code Label High-level Sensitive +#define AT91C_AIC_SRCTYPE_EXT_LOW_LEVEL (0x0 << 5) // (AIC) External Sources Code Label Low-level Sensitive +#define AT91C_AIC_SRCTYPE_INT_POSITIVE_EDGE (0x1 << 5) // (AIC) Internal Sources Code Label Positive Edge triggered +#define AT91C_AIC_SRCTYPE_EXT_NEGATIVE_EDGE (0x1 << 5) // (AIC) External Sources Code Label Negative Edge triggered +#define AT91C_AIC_SRCTYPE_HIGH_LEVEL (0x2 << 5) // (AIC) Internal Or External Sources Code Label High-level Sensitive +#define AT91C_AIC_SRCTYPE_POSITIVE_EDGE (0x3 << 5) // (AIC) Internal Or External Sources Code Label Positive Edge triggered +// -------- AIC_CISR : (AIC Offset: 0x114) AIC Core Interrupt Status Register -------- +#define AT91C_AIC_NFIQ (0x1 << 0) // (AIC) NFIQ Status +#define AT91C_AIC_NIRQ (0x1 << 1) // (AIC) NIRQ Status +// -------- AIC_DCR : (AIC Offset: 0x138) AIC Debug Control Register (Protect) -------- +#define AT91C_AIC_DCR_PROT (0x1 << 0) // (AIC) Protection Mode +#define AT91C_AIC_DCR_GMSK (0x1 << 1) // (AIC) General Mask + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Peripheral DMA Controller +// ***************************************************************************** +// *** Register offset in AT91S_PDC structure *** +#define PDC_RPR ( 0) // Receive Pointer Register +#define PDC_RCR ( 4) // Receive Counter Register +#define PDC_TPR ( 8) // Transmit Pointer Register +#define PDC_TCR (12) // Transmit Counter Register +#define PDC_RNPR (16) // Receive Next Pointer Register +#define PDC_RNCR (20) // Receive Next Counter Register +#define PDC_TNPR (24) // Transmit Next Pointer Register +#define PDC_TNCR (28) // Transmit Next Counter Register +#define PDC_PTCR (32) // PDC Transfer Control Register +#define PDC_PTSR (36) // PDC Transfer Status Register +// -------- PDC_PTCR : (PDC Offset: 0x20) PDC Transfer Control Register -------- +#define AT91C_PDC_RXTEN (0x1 << 0) // (PDC) Receiver Transfer Enable +#define AT91C_PDC_RXTDIS (0x1 << 1) // (PDC) Receiver Transfer Disable +#define AT91C_PDC_TXTEN (0x1 << 8) // (PDC) Transmitter Transfer Enable +#define AT91C_PDC_TXTDIS (0x1 << 9) // (PDC) Transmitter Transfer Disable +// -------- PDC_PTSR : (PDC Offset: 0x24) PDC Transfer Status Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Debug Unit +// ***************************************************************************** +// *** Register offset in AT91S_DBGU structure *** +#define DBGU_CR ( 0) // Control Register +#define DBGU_MR ( 4) // Mode Register +#define DBGU_IER ( 8) // Interrupt Enable Register +#define DBGU_IDR (12) // Interrupt Disable Register +#define DBGU_IMR (16) // Interrupt Mask Register +#define DBGU_CSR (20) // Channel Status Register +#define DBGU_RHR (24) // Receiver Holding Register +#define DBGU_THR (28) // Transmitter Holding Register +#define DBGU_BRGR (32) // Baud Rate Generator Register +#define DBGU_CIDR (64) // Chip ID Register +#define DBGU_EXID (68) // Chip ID Extension Register +#define DBGU_FNTR (72) // Force NTRST Register +#define DBGU_RPR (256) // Receive Pointer Register +#define DBGU_RCR (260) // Receive Counter Register +#define DBGU_TPR (264) // Transmit Pointer Register +#define DBGU_TCR (268) // Transmit Counter Register +#define DBGU_RNPR (272) // Receive Next Pointer Register +#define DBGU_RNCR (276) // Receive Next Counter Register +#define DBGU_TNPR (280) // Transmit Next Pointer Register +#define DBGU_TNCR (284) // Transmit Next Counter Register +#define DBGU_PTCR (288) // PDC Transfer Control Register +#define DBGU_PTSR (292) // PDC Transfer Status Register +// -------- DBGU_CR : (DBGU Offset: 0x0) Debug Unit Control Register -------- +#define AT91C_US_RSTRX (0x1 << 2) // (DBGU) Reset Receiver +#define AT91C_US_RSTTX (0x1 << 3) // (DBGU) Reset Transmitter +#define AT91C_US_RXEN (0x1 << 4) // (DBGU) Receiver Enable +#define AT91C_US_RXDIS (0x1 << 5) // (DBGU) Receiver Disable +#define AT91C_US_TXEN (0x1 << 6) // (DBGU) Transmitter Enable +#define AT91C_US_TXDIS (0x1 << 7) // (DBGU) Transmitter Disable +#define AT91C_US_RSTSTA (0x1 << 8) // (DBGU) Reset Status Bits +// -------- DBGU_MR : (DBGU Offset: 0x4) Debug Unit Mode Register -------- +#define AT91C_US_PAR (0x7 << 9) // (DBGU) Parity type +#define AT91C_US_PAR_EVEN (0x0 << 9) // (DBGU) Even Parity +#define AT91C_US_PAR_ODD (0x1 << 9) // (DBGU) Odd Parity +#define AT91C_US_PAR_SPACE (0x2 << 9) // (DBGU) Parity forced to 0 (Space) +#define AT91C_US_PAR_MARK (0x3 << 9) // (DBGU) Parity forced to 1 (Mark) +#define AT91C_US_PAR_NONE (0x4 << 9) // (DBGU) No Parity +#define AT91C_US_PAR_MULTI_DROP (0x6 << 9) // (DBGU) Multi-drop mode +#define AT91C_US_CHMODE (0x3 << 14) // (DBGU) Channel Mode +#define AT91C_US_CHMODE_NORMAL (0x0 << 14) // (DBGU) Normal Mode: The USART channel operates as an RX/TX USART. +#define AT91C_US_CHMODE_AUTO (0x1 << 14) // (DBGU) Automatic Echo: Receiver Data Input is connected to the TXD pin. +#define AT91C_US_CHMODE_LOCAL (0x2 << 14) // (DBGU) Local Loopback: Transmitter Output Signal is connected to Receiver Input Signal. +#define AT91C_US_CHMODE_REMOTE (0x3 << 14) // (DBGU) Remote Loopback: RXD pin is internally connected to TXD pin. +// -------- DBGU_IER : (DBGU Offset: 0x8) Debug Unit Interrupt Enable Register -------- +#define AT91C_US_RXRDY (0x1 << 0) // (DBGU) RXRDY Interrupt +#define AT91C_US_TXRDY (0x1 << 1) // (DBGU) TXRDY Interrupt +#define AT91C_US_ENDRX (0x1 << 3) // (DBGU) End of Receive Transfer Interrupt +#define AT91C_US_ENDTX (0x1 << 4) // (DBGU) End of Transmit Interrupt +#define AT91C_US_OVRE (0x1 << 5) // (DBGU) Overrun Interrupt +#define AT91C_US_FRAME (0x1 << 6) // (DBGU) Framing Error Interrupt +#define AT91C_US_PARE (0x1 << 7) // (DBGU) Parity Error Interrupt +#define AT91C_US_TXEMPTY (0x1 << 9) // (DBGU) TXEMPTY Interrupt +#define AT91C_US_TXBUFE (0x1 << 11) // (DBGU) TXBUFE Interrupt +#define AT91C_US_RXBUFF (0x1 << 12) // (DBGU) RXBUFF Interrupt +#define AT91C_US_COMM_TX (0x1 << 30) // (DBGU) COMM_TX Interrupt +#define AT91C_US_COMM_RX (0x1 << 31) // (DBGU) COMM_RX Interrupt +// -------- DBGU_IDR : (DBGU Offset: 0xc) Debug Unit Interrupt Disable Register -------- +// -------- DBGU_IMR : (DBGU Offset: 0x10) Debug Unit Interrupt Mask Register -------- +// -------- DBGU_CSR : (DBGU Offset: 0x14) Debug Unit Channel Status Register -------- +// -------- DBGU_FNTR : (DBGU Offset: 0x48) Debug Unit FORCE_NTRST Register -------- +#define AT91C_US_FORCE_NTRST (0x1 << 0) // (DBGU) Force NTRST in JTAG + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Parallel Input Output Controler +// ***************************************************************************** +// *** Register offset in AT91S_PIO structure *** +#define PIO_PER ( 0) // PIO Enable Register +#define PIO_PDR ( 4) // PIO Disable Register +#define PIO_PSR ( 8) // PIO Status Register +#define PIO_OER (16) // Output Enable Register +#define PIO_ODR (20) // Output Disable Registerr +#define PIO_OSR (24) // Output Status Register +#define PIO_IFER (32) // Input Filter Enable Register +#define PIO_IFDR (36) // Input Filter Disable Register +#define PIO_IFSR (40) // Input Filter Status Register +#define PIO_SODR (48) // Set Output Data Register +#define PIO_CODR (52) // Clear Output Data Register +#define PIO_ODSR (56) // Output Data Status Register +#define PIO_PDSR (60) // Pin Data Status Register +#define PIO_IER (64) // Interrupt Enable Register +#define PIO_IDR (68) // Interrupt Disable Register +#define PIO_IMR (72) // Interrupt Mask Register +#define PIO_ISR (76) // Interrupt Status Register +#define PIO_MDER (80) // Multi-driver Enable Register +#define PIO_MDDR (84) // Multi-driver Disable Register +#define PIO_MDSR (88) // Multi-driver Status Register +#define PIO_PPUDR (96) // Pull-up Disable Register +#define PIO_PPUER (100) // Pull-up Enable Register +#define PIO_PPUSR (104) // Pull-up Status Register +#define PIO_ASR (112) // Select A Register +#define PIO_BSR (116) // Select B Register +#define PIO_ABSR (120) // AB Select Status Register +#define PIO_OWER (160) // Output Write Enable Register +#define PIO_OWDR (164) // Output Write Disable Register +#define PIO_OWSR (168) // Output Write Status Register + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Clock Generator Controler +// ***************************************************************************** +// *** Register offset in AT91S_CKGR structure *** +#define CKGR_MOR ( 0) // Main Oscillator Register +#define CKGR_MCFR ( 4) // Main Clock Frequency Register +#define CKGR_PLLR (12) // PLL Register +// -------- CKGR_MOR : (CKGR Offset: 0x0) Main Oscillator Register -------- +#define AT91C_CKGR_MOSCEN (0x1 << 0) // (CKGR) Main Oscillator Enable +#define AT91C_CKGR_OSCBYPASS (0x1 << 1) // (CKGR) Main Oscillator Bypass +#define AT91C_CKGR_OSCOUNT (0xFF << 8) // (CKGR) Main Oscillator Start-up Time +// -------- CKGR_MCFR : (CKGR Offset: 0x4) Main Clock Frequency Register -------- +#define AT91C_CKGR_MAINF (0xFFFF << 0) // (CKGR) Main Clock Frequency +#define AT91C_CKGR_MAINRDY (0x1 << 16) // (CKGR) Main Clock Ready +// -------- CKGR_PLLR : (CKGR Offset: 0xc) PLL B Register -------- +#define AT91C_CKGR_DIV (0xFF << 0) // (CKGR) Divider Selected +#define AT91C_CKGR_DIV_0 (0x0) // (CKGR) Divider output is 0 +#define AT91C_CKGR_DIV_BYPASS (0x1) // (CKGR) Divider is bypassed +#define AT91C_CKGR_PLLCOUNT (0x3F << 8) // (CKGR) PLL Counter +#define AT91C_CKGR_OUT (0x3 << 14) // (CKGR) PLL Output Frequency Range +#define AT91C_CKGR_OUT_0 (0x0 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_OUT_1 (0x1 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_OUT_2 (0x2 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_OUT_3 (0x3 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_MUL (0x7FF << 16) // (CKGR) PLL Multiplier +#define AT91C_CKGR_USBDIV (0x3 << 28) // (CKGR) Divider for USB Clocks +#define AT91C_CKGR_USBDIV_0 (0x0 << 28) // (CKGR) Divider output is PLL clock output +#define AT91C_CKGR_USBDIV_1 (0x1 << 28) // (CKGR) Divider output is PLL clock output divided by 2 +#define AT91C_CKGR_USBDIV_2 (0x2 << 28) // (CKGR) Divider output is PLL clock output divided by 4 + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Power Management Controler +// ***************************************************************************** +// *** Register offset in AT91S_PMC structure *** +#define PMC_SCER ( 0) // System Clock Enable Register +#define PMC_SCDR ( 4) // System Clock Disable Register +#define PMC_SCSR ( 8) // System Clock Status Register +#define PMC_PCER (16) // Peripheral Clock Enable Register +#define PMC_PCDR (20) // Peripheral Clock Disable Register +#define PMC_PCSR (24) // Peripheral Clock Status Register +#define PMC_MOR (32) // Main Oscillator Register +#define PMC_MCFR (36) // Main Clock Frequency Register +#define PMC_PLLR (44) // PLL Register +#define PMC_MCKR (48) // Master Clock Register +#define PMC_PCKR (64) // Programmable Clock Register +#define PMC_IER (96) // Interrupt Enable Register +#define PMC_IDR (100) // Interrupt Disable Register +#define PMC_SR (104) // Status Register +#define PMC_IMR (108) // Interrupt Mask Register +// -------- PMC_SCER : (PMC Offset: 0x0) System Clock Enable Register -------- +#define AT91C_PMC_PCK (0x1 << 0) // (PMC) Processor Clock +#define AT91C_PMC_UDP (0x1 << 7) // (PMC) USB Device Port Clock +#define AT91C_PMC_PCK0 (0x1 << 8) // (PMC) Programmable Clock Output +#define AT91C_PMC_PCK1 (0x1 << 9) // (PMC) Programmable Clock Output +#define AT91C_PMC_PCK2 (0x1 << 10) // (PMC) Programmable Clock Output +#define AT91C_PMC_PCK3 (0x1 << 11) // (PMC) Programmable Clock Output +// -------- PMC_SCDR : (PMC Offset: 0x4) System Clock Disable Register -------- +// -------- PMC_SCSR : (PMC Offset: 0x8) System Clock Status Register -------- +// -------- CKGR_MOR : (PMC Offset: 0x20) Main Oscillator Register -------- +// -------- CKGR_MCFR : (PMC Offset: 0x24) Main Clock Frequency Register -------- +// -------- CKGR_PLLR : (PMC Offset: 0x2c) PLL B Register -------- +// -------- PMC_MCKR : (PMC Offset: 0x30) Master Clock Register -------- +#define AT91C_PMC_CSS (0x3 << 0) // (PMC) Programmable Clock Selection +#define AT91C_PMC_CSS_SLOW_CLK (0x0) // (PMC) Slow Clock is selected +#define AT91C_PMC_CSS_MAIN_CLK (0x1) // (PMC) Main Clock is selected +#define AT91C_PMC_CSS_PLL_CLK (0x3) // (PMC) Clock from PLL is selected +#define AT91C_PMC_PRES (0x7 << 2) // (PMC) Programmable Clock Prescaler +#define AT91C_PMC_PRES_CLK (0x0 << 2) // (PMC) Selected clock +#define AT91C_PMC_PRES_CLK_2 (0x1 << 2) // (PMC) Selected clock divided by 2 +#define AT91C_PMC_PRES_CLK_4 (0x2 << 2) // (PMC) Selected clock divided by 4 +#define AT91C_PMC_PRES_CLK_8 (0x3 << 2) // (PMC) Selected clock divided by 8 +#define AT91C_PMC_PRES_CLK_16 (0x4 << 2) // (PMC) Selected clock divided by 16 +#define AT91C_PMC_PRES_CLK_32 (0x5 << 2) // (PMC) Selected clock divided by 32 +#define AT91C_PMC_PRES_CLK_64 (0x6 << 2) // (PMC) Selected clock divided by 64 +// -------- PMC_PCKR : (PMC Offset: 0x40) Programmable Clock Register -------- +// -------- PMC_IER : (PMC Offset: 0x60) PMC Interrupt Enable Register -------- +#define AT91C_PMC_MOSCS (0x1 << 0) // (PMC) MOSC Status/Enable/Disable/Mask +#define AT91C_PMC_LOCK (0x1 << 2) // (PMC) PLL Status/Enable/Disable/Mask +#define AT91C_PMC_MCKRDY (0x1 << 3) // (PMC) MCK_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK0RDY (0x1 << 8) // (PMC) PCK0_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK1RDY (0x1 << 9) // (PMC) PCK1_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK2RDY (0x1 << 10) // (PMC) PCK2_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK3RDY (0x1 << 11) // (PMC) PCK3_RDY Status/Enable/Disable/Mask +// -------- PMC_IDR : (PMC Offset: 0x64) PMC Interrupt Disable Register -------- +// -------- PMC_SR : (PMC Offset: 0x68) PMC Status Register -------- +// -------- PMC_IMR : (PMC Offset: 0x6c) PMC Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Reset Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_RSTC structure *** +#define RSTC_RCR ( 0) // Reset Control Register +#define RSTC_RSR ( 4) // Reset Status Register +#define RSTC_RMR ( 8) // Reset Mode Register +// -------- RSTC_RCR : (RSTC Offset: 0x0) Reset Control Register -------- +#define AT91C_RSTC_PROCRST (0x1 << 0) // (RSTC) Processor Reset +#define AT91C_RSTC_PERRST (0x1 << 2) // (RSTC) Peripheral Reset +#define AT91C_RSTC_EXTRST (0x1 << 3) // (RSTC) External Reset +#define AT91C_RSTC_KEY (0xFF << 24) // (RSTC) Password +// -------- RSTC_RSR : (RSTC Offset: 0x4) Reset Status Register -------- +#define AT91C_RSTC_URSTS (0x1 << 0) // (RSTC) User Reset Status +#define AT91C_RSTC_BODSTS (0x1 << 1) // (RSTC) Brownout Detection Status +#define AT91C_RSTC_RSTTYP (0x7 << 8) // (RSTC) Reset Type +#define AT91C_RSTC_RSTTYP_POWERUP (0x0 << 8) // (RSTC) Power-up Reset. VDDCORE rising. +#define AT91C_RSTC_RSTTYP_WAKEUP (0x1 << 8) // (RSTC) WakeUp Reset. VDDCORE rising. +#define AT91C_RSTC_RSTTYP_WATCHDOG (0x2 << 8) // (RSTC) Watchdog Reset. Watchdog overflow occured. +#define AT91C_RSTC_RSTTYP_SOFTWARE (0x3 << 8) // (RSTC) Software Reset. Processor reset required by the software. +#define AT91C_RSTC_RSTTYP_USER (0x4 << 8) // (RSTC) User Reset. NRST pin detected low. +#define AT91C_RSTC_RSTTYP_BROWNOUT (0x5 << 8) // (RSTC) Brownout Reset occured. +#define AT91C_RSTC_NRSTL (0x1 << 16) // (RSTC) NRST pin level +#define AT91C_RSTC_SRCMP (0x1 << 17) // (RSTC) Software Reset Command in Progress. +// -------- RSTC_RMR : (RSTC Offset: 0x8) Reset Mode Register -------- +#define AT91C_RSTC_URSTEN (0x1 << 0) // (RSTC) User Reset Enable +#define AT91C_RSTC_URSTIEN (0x1 << 4) // (RSTC) User Reset Interrupt Enable +#define AT91C_RSTC_ERSTL (0xF << 8) // (RSTC) User Reset Length +#define AT91C_RSTC_BODIEN (0x1 << 16) // (RSTC) Brownout Detection Interrupt Enable + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Real Time Timer Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_RTTC structure *** +#define RTTC_RTMR ( 0) // Real-time Mode Register +#define RTTC_RTAR ( 4) // Real-time Alarm Register +#define RTTC_RTVR ( 8) // Real-time Value Register +#define RTTC_RTSR (12) // Real-time Status Register +// -------- RTTC_RTMR : (RTTC Offset: 0x0) Real-time Mode Register -------- +#define AT91C_RTTC_RTPRES (0xFFFF << 0) // (RTTC) Real-time Timer Prescaler Value +#define AT91C_RTTC_ALMIEN (0x1 << 16) // (RTTC) Alarm Interrupt Enable +#define AT91C_RTTC_RTTINCIEN (0x1 << 17) // (RTTC) Real Time Timer Increment Interrupt Enable +#define AT91C_RTTC_RTTRST (0x1 << 18) // (RTTC) Real Time Timer Restart +// -------- RTTC_RTAR : (RTTC Offset: 0x4) Real-time Alarm Register -------- +#define AT91C_RTTC_ALMV (0x0 << 0) // (RTTC) Alarm Value +// -------- RTTC_RTVR : (RTTC Offset: 0x8) Current Real-time Value Register -------- +#define AT91C_RTTC_CRTV (0x0 << 0) // (RTTC) Current Real-time Value +// -------- RTTC_RTSR : (RTTC Offset: 0xc) Real-time Status Register -------- +#define AT91C_RTTC_ALMS (0x1 << 0) // (RTTC) Real-time Alarm Status +#define AT91C_RTTC_RTTINC (0x1 << 1) // (RTTC) Real-time Timer Increment + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Periodic Interval Timer Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_PITC structure *** +#define PITC_PIMR ( 0) // Period Interval Mode Register +#define PITC_PISR ( 4) // Period Interval Status Register +#define PITC_PIVR ( 8) // Period Interval Value Register +#define PITC_PIIR (12) // Period Interval Image Register +// -------- PITC_PIMR : (PITC Offset: 0x0) Periodic Interval Mode Register -------- +#define AT91C_PITC_PIV (0xFFFFF << 0) // (PITC) Periodic Interval Value +#define AT91C_PITC_PITEN (0x1 << 24) // (PITC) Periodic Interval Timer Enabled +#define AT91C_PITC_PITIEN (0x1 << 25) // (PITC) Periodic Interval Timer Interrupt Enable +// -------- PITC_PISR : (PITC Offset: 0x4) Periodic Interval Status Register -------- +#define AT91C_PITC_PITS (0x1 << 0) // (PITC) Periodic Interval Timer Status +// -------- PITC_PIVR : (PITC Offset: 0x8) Periodic Interval Value Register -------- +#define AT91C_PITC_CPIV (0xFFFFF << 0) // (PITC) Current Periodic Interval Value +#define AT91C_PITC_PICNT (0xFFF << 20) // (PITC) Periodic Interval Counter +// -------- PITC_PIIR : (PITC Offset: 0xc) Periodic Interval Image Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Watchdog Timer Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_WDTC structure *** +#define WDTC_WDCR ( 0) // Watchdog Control Register +#define WDTC_WDMR ( 4) // Watchdog Mode Register +#define WDTC_WDSR ( 8) // Watchdog Status Register +// -------- WDTC_WDCR : (WDTC Offset: 0x0) Periodic Interval Image Register -------- +#define AT91C_WDTC_WDRSTT (0x1 << 0) // (WDTC) Watchdog Restart +#define AT91C_WDTC_KEY (0xFF << 24) // (WDTC) Watchdog KEY Password +// -------- WDTC_WDMR : (WDTC Offset: 0x4) Watchdog Mode Register -------- +#define AT91C_WDTC_WDV (0xFFF << 0) // (WDTC) Watchdog Timer Restart +#define AT91C_WDTC_WDFIEN (0x1 << 12) // (WDTC) Watchdog Fault Interrupt Enable +#define AT91C_WDTC_WDRSTEN (0x1 << 13) // (WDTC) Watchdog Reset Enable +#define AT91C_WDTC_WDRPROC (0x1 << 14) // (WDTC) Watchdog Timer Restart +#define AT91C_WDTC_WDDIS (0x1 << 15) // (WDTC) Watchdog Disable +#define AT91C_WDTC_WDD (0xFFF << 16) // (WDTC) Watchdog Delta Value +#define AT91C_WDTC_WDDBGHLT (0x1 << 28) // (WDTC) Watchdog Debug Halt +#define AT91C_WDTC_WDIDLEHLT (0x1 << 29) // (WDTC) Watchdog Idle Halt +// -------- WDTC_WDSR : (WDTC Offset: 0x8) Watchdog Status Register -------- +#define AT91C_WDTC_WDUNF (0x1 << 0) // (WDTC) Watchdog Underflow +#define AT91C_WDTC_WDERR (0x1 << 1) // (WDTC) Watchdog Error + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Voltage Regulator Mode Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_VREG structure *** +#define VREG_MR ( 0) // Voltage Regulator Mode Register +// -------- VREG_MR : (VREG Offset: 0x0) Voltage Regulator Mode Register -------- +#define AT91C_VREG_PSTDBY (0x1 << 0) // (VREG) Voltage Regulator Power Standby Mode + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Memory Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_MC structure *** +#define MC_RCR ( 0) // MC Remap Control Register +#define MC_ASR ( 4) // MC Abort Status Register +#define MC_AASR ( 8) // MC Abort Address Status Register +#define MC_FMR (96) // MC Flash Mode Register +#define MC_FCR (100) // MC Flash Command Register +#define MC_FSR (104) // MC Flash Status Register +// -------- MC_RCR : (MC Offset: 0x0) MC Remap Control Register -------- +#define AT91C_MC_RCB (0x1 << 0) // (MC) Remap Command Bit +// -------- MC_ASR : (MC Offset: 0x4) MC Abort Status Register -------- +#define AT91C_MC_UNDADD (0x1 << 0) // (MC) Undefined Addess Abort Status +#define AT91C_MC_MISADD (0x1 << 1) // (MC) Misaligned Addess Abort Status +#define AT91C_MC_ABTSZ (0x3 << 8) // (MC) Abort Size Status +#define AT91C_MC_ABTSZ_BYTE (0x0 << 8) // (MC) Byte +#define AT91C_MC_ABTSZ_HWORD (0x1 << 8) // (MC) Half-word +#define AT91C_MC_ABTSZ_WORD (0x2 << 8) // (MC) Word +#define AT91C_MC_ABTTYP (0x3 << 10) // (MC) Abort Type Status +#define AT91C_MC_ABTTYP_DATAR (0x0 << 10) // (MC) Data Read +#define AT91C_MC_ABTTYP_DATAW (0x1 << 10) // (MC) Data Write +#define AT91C_MC_ABTTYP_FETCH (0x2 << 10) // (MC) Code Fetch +#define AT91C_MC_MST0 (0x1 << 16) // (MC) Master 0 Abort Source +#define AT91C_MC_MST1 (0x1 << 17) // (MC) Master 1 Abort Source +#define AT91C_MC_SVMST0 (0x1 << 24) // (MC) Saved Master 0 Abort Source +#define AT91C_MC_SVMST1 (0x1 << 25) // (MC) Saved Master 1 Abort Source +// -------- MC_FMR : (MC Offset: 0x60) MC Flash Mode Register -------- +#define AT91C_MC_FRDY (0x1 << 0) // (MC) Flash Ready +#define AT91C_MC_LOCKE (0x1 << 2) // (MC) Lock Error +#define AT91C_MC_PROGE (0x1 << 3) // (MC) Programming Error +#define AT91C_MC_NEBP (0x1 << 7) // (MC) No Erase Before Programming +#define AT91C_MC_FWS (0x3 << 8) // (MC) Flash Wait State +#define AT91C_MC_FWS_0FWS (0x0 << 8) // (MC) 1 cycle for Read, 2 for Write operations +#define AT91C_MC_FWS_1FWS (0x1 << 8) // (MC) 2 cycles for Read, 3 for Write operations +#define AT91C_MC_FWS_2FWS (0x2 << 8) // (MC) 3 cycles for Read, 4 for Write operations +#define AT91C_MC_FWS_3FWS (0x3 << 8) // (MC) 4 cycles for Read, 4 for Write operations +#define AT91C_MC_FMCN (0xFF << 16) // (MC) Flash Microsecond Cycle Number +// -------- MC_FCR : (MC Offset: 0x64) MC Flash Command Register -------- +#define AT91C_MC_FCMD (0xF << 0) // (MC) Flash Command +#define AT91C_MC_FCMD_START_PROG (0x1) // (MC) Starts the programming of th epage specified by PAGEN. +#define AT91C_MC_FCMD_LOCK (0x2) // (MC) Starts a lock sequence of the sector defined by the bits 4 to 7 of the field PAGEN. +#define AT91C_MC_FCMD_PROG_AND_LOCK (0x3) // (MC) The lock sequence automatically happens after the programming sequence is completed. +#define AT91C_MC_FCMD_UNLOCK (0x4) // (MC) Starts an unlock sequence of the sector defined by the bits 4 to 7 of the field PAGEN. +#define AT91C_MC_FCMD_ERASE_ALL (0x8) // (MC) Starts the erase of the entire flash.If at least a page is locked, the command is cancelled. +#define AT91C_MC_FCMD_SET_GP_NVM (0xB) // (MC) Set General Purpose NVM bits. +#define AT91C_MC_FCMD_CLR_GP_NVM (0xD) // (MC) Clear General Purpose NVM bits. +#define AT91C_MC_FCMD_SET_SECURITY (0xF) // (MC) Set Security Bit. +#define AT91C_MC_PAGEN (0x3FF << 8) // (MC) Page Number +#define AT91C_MC_KEY (0xFF << 24) // (MC) Writing Protect Key +// -------- MC_FSR : (MC Offset: 0x68) MC Flash Command Register -------- +#define AT91C_MC_SECURITY (0x1 << 4) // (MC) Security Bit Status +#define AT91C_MC_GPNVM0 (0x1 << 8) // (MC) Sector 0 Lock Status +#define AT91C_MC_GPNVM1 (0x1 << 9) // (MC) Sector 1 Lock Status +#define AT91C_MC_GPNVM2 (0x1 << 10) // (MC) Sector 2 Lock Status +#define AT91C_MC_GPNVM3 (0x1 << 11) // (MC) Sector 3 Lock Status +#define AT91C_MC_GPNVM4 (0x1 << 12) // (MC) Sector 4 Lock Status +#define AT91C_MC_GPNVM5 (0x1 << 13) // (MC) Sector 5 Lock Status +#define AT91C_MC_GPNVM6 (0x1 << 14) // (MC) Sector 6 Lock Status +#define AT91C_MC_GPNVM7 (0x1 << 15) // (MC) Sector 7 Lock Status +#define AT91C_MC_LOCKS0 (0x1 << 16) // (MC) Sector 0 Lock Status +#define AT91C_MC_LOCKS1 (0x1 << 17) // (MC) Sector 1 Lock Status +#define AT91C_MC_LOCKS2 (0x1 << 18) // (MC) Sector 2 Lock Status +#define AT91C_MC_LOCKS3 (0x1 << 19) // (MC) Sector 3 Lock Status +#define AT91C_MC_LOCKS4 (0x1 << 20) // (MC) Sector 4 Lock Status +#define AT91C_MC_LOCKS5 (0x1 << 21) // (MC) Sector 5 Lock Status +#define AT91C_MC_LOCKS6 (0x1 << 22) // (MC) Sector 6 Lock Status +#define AT91C_MC_LOCKS7 (0x1 << 23) // (MC) Sector 7 Lock Status +#define AT91C_MC_LOCKS8 (0x1 << 24) // (MC) Sector 8 Lock Status +#define AT91C_MC_LOCKS9 (0x1 << 25) // (MC) Sector 9 Lock Status +#define AT91C_MC_LOCKS10 (0x1 << 26) // (MC) Sector 10 Lock Status +#define AT91C_MC_LOCKS11 (0x1 << 27) // (MC) Sector 11 Lock Status +#define AT91C_MC_LOCKS12 (0x1 << 28) // (MC) Sector 12 Lock Status +#define AT91C_MC_LOCKS13 (0x1 << 29) // (MC) Sector 13 Lock Status +#define AT91C_MC_LOCKS14 (0x1 << 30) // (MC) Sector 14 Lock Status +#define AT91C_MC_LOCKS15 (0x1 << 31) // (MC) Sector 15 Lock Status + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Serial Parallel Interface +// ***************************************************************************** +// *** Register offset in AT91S_SPI structure *** +#define SPI_CR ( 0) // Control Register +#define SPI_MR ( 4) // Mode Register +#define SPI_RDR ( 8) // Receive Data Register +#define SPI_TDR (12) // Transmit Data Register +#define SPI_SR (16) // Status Register +#define SPI_IER (20) // Interrupt Enable Register +#define SPI_IDR (24) // Interrupt Disable Register +#define SPI_IMR (28) // Interrupt Mask Register +#define SPI_CSR (48) // Chip Select Register +#define SPI_RPR (256) // Receive Pointer Register +#define SPI_RCR (260) // Receive Counter Register +#define SPI_TPR (264) // Transmit Pointer Register +#define SPI_TCR (268) // Transmit Counter Register +#define SPI_RNPR (272) // Receive Next Pointer Register +#define SPI_RNCR (276) // Receive Next Counter Register +#define SPI_TNPR (280) // Transmit Next Pointer Register +#define SPI_TNCR (284) // Transmit Next Counter Register +#define SPI_PTCR (288) // PDC Transfer Control Register +#define SPI_PTSR (292) // PDC Transfer Status Register +// -------- SPI_CR : (SPI Offset: 0x0) SPI Control Register -------- +#define AT91C_SPI_SPIEN (0x1 << 0) // (SPI) SPI Enable +#define AT91C_SPI_SPIDIS (0x1 << 1) // (SPI) SPI Disable +#define AT91C_SPI_SWRST (0x1 << 7) // (SPI) SPI Software reset +#define AT91C_SPI_LASTXFER (0x1 << 24) // (SPI) SPI Last Transfer +// -------- SPI_MR : (SPI Offset: 0x4) SPI Mode Register -------- +#define AT91C_SPI_MSTR (0x1 << 0) // (SPI) Master/Slave Mode +#define AT91C_SPI_PS (0x1 << 1) // (SPI) Peripheral Select +#define AT91C_SPI_PS_FIXED (0x0 << 1) // (SPI) Fixed Peripheral Select +#define AT91C_SPI_PS_VARIABLE (0x1 << 1) // (SPI) Variable Peripheral Select +#define AT91C_SPI_PCSDEC (0x1 << 2) // (SPI) Chip Select Decode +#define AT91C_SPI_FDIV (0x1 << 3) // (SPI) Clock Selection +#define AT91C_SPI_MODFDIS (0x1 << 4) // (SPI) Mode Fault Detection +#define AT91C_SPI_LLB (0x1 << 7) // (SPI) Clock Selection +#define AT91C_SPI_PCS (0xF << 16) // (SPI) Peripheral Chip Select +#define AT91C_SPI_DLYBCS (0xFF << 24) // (SPI) Delay Between Chip Selects +// -------- SPI_RDR : (SPI Offset: 0x8) Receive Data Register -------- +#define AT91C_SPI_RD (0xFFFF << 0) // (SPI) Receive Data +#define AT91C_SPI_RPCS (0xF << 16) // (SPI) Peripheral Chip Select Status +// -------- SPI_TDR : (SPI Offset: 0xc) Transmit Data Register -------- +#define AT91C_SPI_TD (0xFFFF << 0) // (SPI) Transmit Data +#define AT91C_SPI_TPCS (0xF << 16) // (SPI) Peripheral Chip Select Status +// -------- SPI_SR : (SPI Offset: 0x10) Status Register -------- +#define AT91C_SPI_RDRF (0x1 << 0) // (SPI) Receive Data Register Full +#define AT91C_SPI_TDRE (0x1 << 1) // (SPI) Transmit Data Register Empty +#define AT91C_SPI_MODF (0x1 << 2) // (SPI) Mode Fault Error +#define AT91C_SPI_OVRES (0x1 << 3) // (SPI) Overrun Error Status +#define AT91C_SPI_ENDRX (0x1 << 4) // (SPI) End of Receiver Transfer +#define AT91C_SPI_ENDTX (0x1 << 5) // (SPI) End of Receiver Transfer +#define AT91C_SPI_RXBUFF (0x1 << 6) // (SPI) RXBUFF Interrupt +#define AT91C_SPI_TXBUFE (0x1 << 7) // (SPI) TXBUFE Interrupt +#define AT91C_SPI_NSSR (0x1 << 8) // (SPI) NSSR Interrupt +#define AT91C_SPI_TXEMPTY (0x1 << 9) // (SPI) TXEMPTY Interrupt +#define AT91C_SPI_SPIENS (0x1 << 16) // (SPI) Enable Status +// -------- SPI_IER : (SPI Offset: 0x14) Interrupt Enable Register -------- +// -------- SPI_IDR : (SPI Offset: 0x18) Interrupt Disable Register -------- +// -------- SPI_IMR : (SPI Offset: 0x1c) Interrupt Mask Register -------- +// -------- SPI_CSR : (SPI Offset: 0x30) Chip Select Register -------- +#define AT91C_SPI_CPOL (0x1 << 0) // (SPI) Clock Polarity +#define AT91C_SPI_NCPHA (0x1 << 1) // (SPI) Clock Phase +#define AT91C_SPI_CSAAT (0x1 << 3) // (SPI) Chip Select Active After Transfer +#define AT91C_SPI_BITS (0xF << 4) // (SPI) Bits Per Transfer +#define AT91C_SPI_BITS_8 (0x0 << 4) // (SPI) 8 Bits Per transfer +#define AT91C_SPI_BITS_9 (0x1 << 4) // (SPI) 9 Bits Per transfer +#define AT91C_SPI_BITS_10 (0x2 << 4) // (SPI) 10 Bits Per transfer +#define AT91C_SPI_BITS_11 (0x3 << 4) // (SPI) 11 Bits Per transfer +#define AT91C_SPI_BITS_12 (0x4 << 4) // (SPI) 12 Bits Per transfer +#define AT91C_SPI_BITS_13 (0x5 << 4) // (SPI) 13 Bits Per transfer +#define AT91C_SPI_BITS_14 (0x6 << 4) // (SPI) 14 Bits Per transfer +#define AT91C_SPI_BITS_15 (0x7 << 4) // (SPI) 15 Bits Per transfer +#define AT91C_SPI_BITS_16 (0x8 << 4) // (SPI) 16 Bits Per transfer +#define AT91C_SPI_SCBR (0xFF << 8) // (SPI) Serial Clock Baud Rate +#define AT91C_SPI_DLYBS (0xFF << 16) // (SPI) Delay Before SPCK +#define AT91C_SPI_DLYBCT (0xFF << 24) // (SPI) Delay Between Consecutive Transfers + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Usart +// ***************************************************************************** +// *** Register offset in AT91S_USART structure *** +#define US_CR ( 0) // Control Register +#define US_MR ( 4) // Mode Register +#define US_IER ( 8) // Interrupt Enable Register +#define US_IDR (12) // Interrupt Disable Register +#define US_IMR (16) // Interrupt Mask Register +#define US_CSR (20) // Channel Status Register +#define US_RHR (24) // Receiver Holding Register +#define US_THR (28) // Transmitter Holding Register +#define US_BRGR (32) // Baud Rate Generator Register +#define US_RTOR (36) // Receiver Time-out Register +#define US_TTGR (40) // Transmitter Time-guard Register +#define US_FIDI (64) // FI_DI_Ratio Register +#define US_NER (68) // Nb Errors Register +#define US_IF (76) // IRDA_FILTER Register +#define US_RPR (256) // Receive Pointer Register +#define US_RCR (260) // Receive Counter Register +#define US_TPR (264) // Transmit Pointer Register +#define US_TCR (268) // Transmit Counter Register +#define US_RNPR (272) // Receive Next Pointer Register +#define US_RNCR (276) // Receive Next Counter Register +#define US_TNPR (280) // Transmit Next Pointer Register +#define US_TNCR (284) // Transmit Next Counter Register +#define US_PTCR (288) // PDC Transfer Control Register +#define US_PTSR (292) // PDC Transfer Status Register +// -------- US_CR : (USART Offset: 0x0) Debug Unit Control Register -------- +#define AT91C_US_STTBRK (0x1 << 9) // (USART) Start Break +#define AT91C_US_STPBRK (0x1 << 10) // (USART) Stop Break +#define AT91C_US_STTTO (0x1 << 11) // (USART) Start Time-out +#define AT91C_US_SENDA (0x1 << 12) // (USART) Send Address +#define AT91C_US_RSTIT (0x1 << 13) // (USART) Reset Iterations +#define AT91C_US_RSTNACK (0x1 << 14) // (USART) Reset Non Acknowledge +#define AT91C_US_RETTO (0x1 << 15) // (USART) Rearm Time-out +#define AT91C_US_DTREN (0x1 << 16) // (USART) Data Terminal ready Enable +#define AT91C_US_DTRDIS (0x1 << 17) // (USART) Data Terminal ready Disable +#define AT91C_US_RTSEN (0x1 << 18) // (USART) Request to Send enable +#define AT91C_US_RTSDIS (0x1 << 19) // (USART) Request to Send Disable +// -------- US_MR : (USART Offset: 0x4) Debug Unit Mode Register -------- +#define AT91C_US_USMODE (0xF << 0) // (USART) Usart mode +#define AT91C_US_USMODE_NORMAL (0x0) // (USART) Normal +#define AT91C_US_USMODE_RS485 (0x1) // (USART) RS485 +#define AT91C_US_USMODE_HWHSH (0x2) // (USART) Hardware Handshaking +#define AT91C_US_USMODE_MODEM (0x3) // (USART) Modem +#define AT91C_US_USMODE_ISO7816_0 (0x4) // (USART) ISO7816 protocol: T = 0 +#define AT91C_US_USMODE_ISO7816_1 (0x6) // (USART) ISO7816 protocol: T = 1 +#define AT91C_US_USMODE_IRDA (0x8) // (USART) IrDA +#define AT91C_US_USMODE_SWHSH (0xC) // (USART) Software Handshaking +#define AT91C_US_CLKS (0x3 << 4) // (USART) Clock Selection (Baud Rate generator Input Clock +#define AT91C_US_CLKS_CLOCK (0x0 << 4) // (USART) Clock +#define AT91C_US_CLKS_FDIV1 (0x1 << 4) // (USART) fdiv1 +#define AT91C_US_CLKS_SLOW (0x2 << 4) // (USART) slow_clock (ARM) +#define AT91C_US_CLKS_EXT (0x3 << 4) // (USART) External (SCK) +#define AT91C_US_CHRL (0x3 << 6) // (USART) Clock Selection (Baud Rate generator Input Clock +#define AT91C_US_CHRL_5_BITS (0x0 << 6) // (USART) Character Length: 5 bits +#define AT91C_US_CHRL_6_BITS (0x1 << 6) // (USART) Character Length: 6 bits +#define AT91C_US_CHRL_7_BITS (0x2 << 6) // (USART) Character Length: 7 bits +#define AT91C_US_CHRL_8_BITS (0x3 << 6) // (USART) Character Length: 8 bits +#define AT91C_US_SYNC (0x1 << 8) // (USART) Synchronous Mode Select +#define AT91C_US_NBSTOP (0x3 << 12) // (USART) Number of Stop bits +#define AT91C_US_NBSTOP_1_BIT (0x0 << 12) // (USART) 1 stop bit +#define AT91C_US_NBSTOP_15_BIT (0x1 << 12) // (USART) Asynchronous (SYNC=0) 2 stop bits Synchronous (SYNC=1) 2 stop bits +#define AT91C_US_NBSTOP_2_BIT (0x2 << 12) // (USART) 2 stop bits +#define AT91C_US_MSBF (0x1 << 16) // (USART) Bit Order +#define AT91C_US_MODE9 (0x1 << 17) // (USART) 9-bit Character length +#define AT91C_US_CKLO (0x1 << 18) // (USART) Clock Output Select +#define AT91C_US_OVER (0x1 << 19) // (USART) Over Sampling Mode +#define AT91C_US_INACK (0x1 << 20) // (USART) Inhibit Non Acknowledge +#define AT91C_US_DSNACK (0x1 << 21) // (USART) Disable Successive NACK +#define AT91C_US_MAX_ITER (0x1 << 24) // (USART) Number of Repetitions +#define AT91C_US_FILTER (0x1 << 28) // (USART) Receive Line Filter +// -------- US_IER : (USART Offset: 0x8) Debug Unit Interrupt Enable Register -------- +#define AT91C_US_RXBRK (0x1 << 2) // (USART) Break Received/End of Break +#define AT91C_US_TIMEOUT (0x1 << 8) // (USART) Receiver Time-out +#define AT91C_US_ITERATION (0x1 << 10) // (USART) Max number of Repetitions Reached +#define AT91C_US_NACK (0x1 << 13) // (USART) Non Acknowledge +#define AT91C_US_RIIC (0x1 << 16) // (USART) Ring INdicator Input Change Flag +#define AT91C_US_DSRIC (0x1 << 17) // (USART) Data Set Ready Input Change Flag +#define AT91C_US_DCDIC (0x1 << 18) // (USART) Data Carrier Flag +#define AT91C_US_CTSIC (0x1 << 19) // (USART) Clear To Send Input Change Flag +// -------- US_IDR : (USART Offset: 0xc) Debug Unit Interrupt Disable Register -------- +// -------- US_IMR : (USART Offset: 0x10) Debug Unit Interrupt Mask Register -------- +// -------- US_CSR : (USART Offset: 0x14) Debug Unit Channel Status Register -------- +#define AT91C_US_RI (0x1 << 20) // (USART) Image of RI Input +#define AT91C_US_DSR (0x1 << 21) // (USART) Image of DSR Input +#define AT91C_US_DCD (0x1 << 22) // (USART) Image of DCD Input +#define AT91C_US_CTS (0x1 << 23) // (USART) Image of CTS Input + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Synchronous Serial Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_SSC structure *** +#define SSC_CR ( 0) // Control Register +#define SSC_CMR ( 4) // Clock Mode Register +#define SSC_RCMR (16) // Receive Clock ModeRegister +#define SSC_RFMR (20) // Receive Frame Mode Register +#define SSC_TCMR (24) // Transmit Clock Mode Register +#define SSC_TFMR (28) // Transmit Frame Mode Register +#define SSC_RHR (32) // Receive Holding Register +#define SSC_THR (36) // Transmit Holding Register +#define SSC_RSHR (48) // Receive Sync Holding Register +#define SSC_TSHR (52) // Transmit Sync Holding Register +#define SSC_SR (64) // Status Register +#define SSC_IER (68) // Interrupt Enable Register +#define SSC_IDR (72) // Interrupt Disable Register +#define SSC_IMR (76) // Interrupt Mask Register +#define SSC_RPR (256) // Receive Pointer Register +#define SSC_RCR (260) // Receive Counter Register +#define SSC_TPR (264) // Transmit Pointer Register +#define SSC_TCR (268) // Transmit Counter Register +#define SSC_RNPR (272) // Receive Next Pointer Register +#define SSC_RNCR (276) // Receive Next Counter Register +#define SSC_TNPR (280) // Transmit Next Pointer Register +#define SSC_TNCR (284) // Transmit Next Counter Register +#define SSC_PTCR (288) // PDC Transfer Control Register +#define SSC_PTSR (292) // PDC Transfer Status Register +// -------- SSC_CR : (SSC Offset: 0x0) SSC Control Register -------- +#define AT91C_SSC_RXEN (0x1 << 0) // (SSC) Receive Enable +#define AT91C_SSC_RXDIS (0x1 << 1) // (SSC) Receive Disable +#define AT91C_SSC_TXEN (0x1 << 8) // (SSC) Transmit Enable +#define AT91C_SSC_TXDIS (0x1 << 9) // (SSC) Transmit Disable +#define AT91C_SSC_SWRST (0x1 << 15) // (SSC) Software Reset +// -------- SSC_RCMR : (SSC Offset: 0x10) SSC Receive Clock Mode Register -------- +#define AT91C_SSC_CKS (0x3 << 0) // (SSC) Receive/Transmit Clock Selection +#define AT91C_SSC_CKS_DIV (0x0) // (SSC) Divided Clock +#define AT91C_SSC_CKS_TK (0x1) // (SSC) TK Clock signal +#define AT91C_SSC_CKS_RK (0x2) // (SSC) RK pin +#define AT91C_SSC_CKO (0x7 << 2) // (SSC) Receive/Transmit Clock Output Mode Selection +#define AT91C_SSC_CKO_NONE (0x0 << 2) // (SSC) Receive/Transmit Clock Output Mode: None RK pin: Input-only +#define AT91C_SSC_CKO_CONTINOUS (0x1 << 2) // (SSC) Continuous Receive/Transmit Clock RK pin: Output +#define AT91C_SSC_CKO_DATA_TX (0x2 << 2) // (SSC) Receive/Transmit Clock only during data transfers RK pin: Output +#define AT91C_SSC_CKI (0x1 << 5) // (SSC) Receive/Transmit Clock Inversion +#define AT91C_SSC_CKG (0x3 << 6) // (SSC) Receive/Transmit Clock Gating Selection +#define AT91C_SSC_CKG_NONE (0x0 << 6) // (SSC) Receive/Transmit Clock Gating: None, continuous clock +#define AT91C_SSC_CKG_LOW (0x1 << 6) // (SSC) Receive/Transmit Clock enabled only if RF Low +#define AT91C_SSC_CKG_HIGH (0x2 << 6) // (SSC) Receive/Transmit Clock enabled only if RF High +#define AT91C_SSC_START (0xF << 8) // (SSC) Receive/Transmit Start Selection +#define AT91C_SSC_START_CONTINOUS (0x0 << 8) // (SSC) Continuous, as soon as the receiver is enabled, and immediately after the end of transfer of the previous data. +#define AT91C_SSC_START_TX (0x1 << 8) // (SSC) Transmit/Receive start +#define AT91C_SSC_START_LOW_RF (0x2 << 8) // (SSC) Detection of a low level on RF input +#define AT91C_SSC_START_HIGH_RF (0x3 << 8) // (SSC) Detection of a high level on RF input +#define AT91C_SSC_START_FALL_RF (0x4 << 8) // (SSC) Detection of a falling edge on RF input +#define AT91C_SSC_START_RISE_RF (0x5 << 8) // (SSC) Detection of a rising edge on RF input +#define AT91C_SSC_START_LEVEL_RF (0x6 << 8) // (SSC) Detection of any level change on RF input +#define AT91C_SSC_START_EDGE_RF (0x7 << 8) // (SSC) Detection of any edge on RF input +#define AT91C_SSC_START_0 (0x8 << 8) // (SSC) Compare 0 +#define AT91C_SSC_STOP (0x1 << 12) // (SSC) Receive Stop Selection +#define AT91C_SSC_STTDLY (0xFF << 16) // (SSC) Receive/Transmit Start Delay +#define AT91C_SSC_PERIOD (0xFF << 24) // (SSC) Receive/Transmit Period Divider Selection +// -------- SSC_RFMR : (SSC Offset: 0x14) SSC Receive Frame Mode Register -------- +#define AT91C_SSC_DATLEN (0x1F << 0) // (SSC) Data Length +#define AT91C_SSC_LOOP (0x1 << 5) // (SSC) Loop Mode +#define AT91C_SSC_MSBF (0x1 << 7) // (SSC) Most Significant Bit First +#define AT91C_SSC_DATNB (0xF << 8) // (SSC) Data Number per Frame +#define AT91C_SSC_FSLEN (0xF << 16) // (SSC) Receive/Transmit Frame Sync length +#define AT91C_SSC_FSOS (0x7 << 20) // (SSC) Receive/Transmit Frame Sync Output Selection +#define AT91C_SSC_FSOS_NONE (0x0 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: None RK pin Input-only +#define AT91C_SSC_FSOS_NEGATIVE (0x1 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Negative Pulse +#define AT91C_SSC_FSOS_POSITIVE (0x2 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Positive Pulse +#define AT91C_SSC_FSOS_LOW (0x3 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Driver Low during data transfer +#define AT91C_SSC_FSOS_HIGH (0x4 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Driver High during data transfer +#define AT91C_SSC_FSOS_TOGGLE (0x5 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Toggling at each start of data transfer +#define AT91C_SSC_FSEDGE (0x1 << 24) // (SSC) Frame Sync Edge Detection +// -------- SSC_TCMR : (SSC Offset: 0x18) SSC Transmit Clock Mode Register -------- +// -------- SSC_TFMR : (SSC Offset: 0x1c) SSC Transmit Frame Mode Register -------- +#define AT91C_SSC_DATDEF (0x1 << 5) // (SSC) Data Default Value +#define AT91C_SSC_FSDEN (0x1 << 23) // (SSC) Frame Sync Data Enable +// -------- SSC_SR : (SSC Offset: 0x40) SSC Status Register -------- +#define AT91C_SSC_TXRDY (0x1 << 0) // (SSC) Transmit Ready +#define AT91C_SSC_TXEMPTY (0x1 << 1) // (SSC) Transmit Empty +#define AT91C_SSC_ENDTX (0x1 << 2) // (SSC) End Of Transmission +#define AT91C_SSC_TXBUFE (0x1 << 3) // (SSC) Transmit Buffer Empty +#define AT91C_SSC_RXRDY (0x1 << 4) // (SSC) Receive Ready +#define AT91C_SSC_OVRUN (0x1 << 5) // (SSC) Receive Overrun +#define AT91C_SSC_ENDRX (0x1 << 6) // (SSC) End of Reception +#define AT91C_SSC_RXBUFF (0x1 << 7) // (SSC) Receive Buffer Full +#define AT91C_SSC_CP0 (0x1 << 8) // (SSC) Compare 0 +#define AT91C_SSC_CP1 (0x1 << 9) // (SSC) Compare 1 +#define AT91C_SSC_TXSYN (0x1 << 10) // (SSC) Transmit Sync +#define AT91C_SSC_RXSYN (0x1 << 11) // (SSC) Receive Sync +#define AT91C_SSC_TXENA (0x1 << 16) // (SSC) Transmit Enable +#define AT91C_SSC_RXENA (0x1 << 17) // (SSC) Receive Enable +// -------- SSC_IER : (SSC Offset: 0x44) SSC Interrupt Enable Register -------- +// -------- SSC_IDR : (SSC Offset: 0x48) SSC Interrupt Disable Register -------- +// -------- SSC_IMR : (SSC Offset: 0x4c) SSC Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Two-wire Interface +// ***************************************************************************** +// *** Register offset in AT91S_TWI structure *** +#define TWI_CR ( 0) // Control Register +#define TWI_MMR ( 4) // Master Mode Register +#define TWI_IADR (12) // Internal Address Register +#define TWI_CWGR (16) // Clock Waveform Generator Register +#define TWI_SR (32) // Status Register +#define TWI_IER (36) // Interrupt Enable Register +#define TWI_IDR (40) // Interrupt Disable Register +#define TWI_IMR (44) // Interrupt Mask Register +#define TWI_RHR (48) // Receive Holding Register +#define TWI_THR (52) // Transmit Holding Register +// -------- TWI_CR : (TWI Offset: 0x0) TWI Control Register -------- +#define AT91C_TWI_START (0x1 << 0) // (TWI) Send a START Condition +#define AT91C_TWI_STOP (0x1 << 1) // (TWI) Send a STOP Condition +#define AT91C_TWI_MSEN (0x1 << 2) // (TWI) TWI Master Transfer Enabled +#define AT91C_TWI_MSDIS (0x1 << 3) // (TWI) TWI Master Transfer Disabled +#define AT91C_TWI_SWRST (0x1 << 7) // (TWI) Software Reset +// -------- TWI_MMR : (TWI Offset: 0x4) TWI Master Mode Register -------- +#define AT91C_TWI_IADRSZ (0x3 << 8) // (TWI) Internal Device Address Size +#define AT91C_TWI_IADRSZ_NO (0x0 << 8) // (TWI) No internal device address +#define AT91C_TWI_IADRSZ_1_BYTE (0x1 << 8) // (TWI) One-byte internal device address +#define AT91C_TWI_IADRSZ_2_BYTE (0x2 << 8) // (TWI) Two-byte internal device address +#define AT91C_TWI_IADRSZ_3_BYTE (0x3 << 8) // (TWI) Three-byte internal device address +#define AT91C_TWI_MREAD (0x1 << 12) // (TWI) Master Read Direction +#define AT91C_TWI_DADR (0x7F << 16) // (TWI) Device Address +// -------- TWI_CWGR : (TWI Offset: 0x10) TWI Clock Waveform Generator Register -------- +#define AT91C_TWI_CLDIV (0xFF << 0) // (TWI) Clock Low Divider +#define AT91C_TWI_CHDIV (0xFF << 8) // (TWI) Clock High Divider +#define AT91C_TWI_CKDIV (0x7 << 16) // (TWI) Clock Divider +// -------- TWI_SR : (TWI Offset: 0x20) TWI Status Register -------- +#define AT91C_TWI_TXCOMP (0x1 << 0) // (TWI) Transmission Completed +#define AT91C_TWI_RXRDY (0x1 << 1) // (TWI) Receive holding register ReaDY +#define AT91C_TWI_TXRDY (0x1 << 2) // (TWI) Transmit holding register ReaDY +#define AT91C_TWI_OVRE (0x1 << 6) // (TWI) Overrun Error +#define AT91C_TWI_UNRE (0x1 << 7) // (TWI) Underrun Error +#define AT91C_TWI_NACK (0x1 << 8) // (TWI) Not Acknowledged +// -------- TWI_IER : (TWI Offset: 0x24) TWI Interrupt Enable Register -------- +// -------- TWI_IDR : (TWI Offset: 0x28) TWI Interrupt Disable Register -------- +// -------- TWI_IMR : (TWI Offset: 0x2c) TWI Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR PWMC Channel Interface +// ***************************************************************************** +// *** Register offset in AT91S_PWMC_CH structure *** +#define PWMC_CMR ( 0) // Channel Mode Register +#define PWMC_CDTYR ( 4) // Channel Duty Cycle Register +#define PWMC_CPRDR ( 8) // Channel Period Register +#define PWMC_CCNTR (12) // Channel Counter Register +#define PWMC_CUPDR (16) // Channel Update Register +#define PWMC_Reserved (20) // Reserved +// -------- PWMC_CMR : (PWMC_CH Offset: 0x0) PWMC Channel Mode Register -------- +#define AT91C_PWMC_CPRE (0xF << 0) // (PWMC_CH) Channel Pre-scaler : PWMC_CLKx +#define AT91C_PWMC_CPRE_MCK (0x0) // (PWMC_CH) +#define AT91C_PWMC_CPRE_MCKA (0xB) // (PWMC_CH) +#define AT91C_PWMC_CPRE_MCKB (0xC) // (PWMC_CH) +#define AT91C_PWMC_CALG (0x1 << 8) // (PWMC_CH) Channel Alignment +#define AT91C_PWMC_CPOL (0x1 << 9) // (PWMC_CH) Channel Polarity +#define AT91C_PWMC_CPD (0x1 << 10) // (PWMC_CH) Channel Update Period +// -------- PWMC_CDTYR : (PWMC_CH Offset: 0x4) PWMC Channel Duty Cycle Register -------- +#define AT91C_PWMC_CDTY (0x0 << 0) // (PWMC_CH) Channel Duty Cycle +// -------- PWMC_CPRDR : (PWMC_CH Offset: 0x8) PWMC Channel Period Register -------- +#define AT91C_PWMC_CPRD (0x0 << 0) // (PWMC_CH) Channel Period +// -------- PWMC_CCNTR : (PWMC_CH Offset: 0xc) PWMC Channel Counter Register -------- +#define AT91C_PWMC_CCNT (0x0 << 0) // (PWMC_CH) Channel Counter +// -------- PWMC_CUPDR : (PWMC_CH Offset: 0x10) PWMC Channel Update Register -------- +#define AT91C_PWMC_CUPD (0x0 << 0) // (PWMC_CH) Channel Update + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Pulse Width Modulation Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_PWMC structure *** +#define PWMC_MR ( 0) // PWMC Mode Register +#define PWMC_ENA ( 4) // PWMC Enable Register +#define PWMC_DIS ( 8) // PWMC Disable Register +#define PWMC_SR (12) // PWMC Status Register +#define PWMC_IER (16) // PWMC Interrupt Enable Register +#define PWMC_IDR (20) // PWMC Interrupt Disable Register +#define PWMC_IMR (24) // PWMC Interrupt Mask Register +#define PWMC_ISR (28) // PWMC Interrupt Status Register +#define PWMC_VR (252) // PWMC Version Register +#define PWMC_CH (512) // PWMC Channel +// -------- PWMC_MR : (PWMC Offset: 0x0) PWMC Mode Register -------- +#define AT91C_PWMC_DIVA (0xFF << 0) // (PWMC) CLKA divide factor. +#define AT91C_PWMC_PREA (0xF << 8) // (PWMC) Divider Input Clock Prescaler A +#define AT91C_PWMC_PREA_MCK (0x0 << 8) // (PWMC) +#define AT91C_PWMC_DIVB (0xFF << 16) // (PWMC) CLKB divide factor. +#define AT91C_PWMC_PREB (0xF << 24) // (PWMC) Divider Input Clock Prescaler B +#define AT91C_PWMC_PREB_MCK (0x0 << 24) // (PWMC) +// -------- PWMC_ENA : (PWMC Offset: 0x4) PWMC Enable Register -------- +#define AT91C_PWMC_CHID0 (0x1 << 0) // (PWMC) Channel ID 0 +#define AT91C_PWMC_CHID1 (0x1 << 1) // (PWMC) Channel ID 1 +#define AT91C_PWMC_CHID2 (0x1 << 2) // (PWMC) Channel ID 2 +#define AT91C_PWMC_CHID3 (0x1 << 3) // (PWMC) Channel ID 3 +// -------- PWMC_DIS : (PWMC Offset: 0x8) PWMC Disable Register -------- +// -------- PWMC_SR : (PWMC Offset: 0xc) PWMC Status Register -------- +// -------- PWMC_IER : (PWMC Offset: 0x10) PWMC Interrupt Enable Register -------- +// -------- PWMC_IDR : (PWMC Offset: 0x14) PWMC Interrupt Disable Register -------- +// -------- PWMC_IMR : (PWMC Offset: 0x18) PWMC Interrupt Mask Register -------- +// -------- PWMC_ISR : (PWMC Offset: 0x1c) PWMC Interrupt Status Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR USB Device Interface +// ***************************************************************************** +// *** Register offset in AT91S_UDP structure *** +#define UDP_NUM ( 0) // Frame Number Register +#define UDP_GLBSTATE ( 4) // Global State Register +#define UDP_FADDR ( 8) // Function Address Register +#define UDP_IER (16) // Interrupt Enable Register +#define UDP_IDR (20) // Interrupt Disable Register +#define UDP_IMR (24) // Interrupt Mask Register +#define UDP_ISR (28) // Interrupt Status Register +#define UDP_ICR (32) // Interrupt Clear Register +#define UDP_RSTEP (40) // Reset Endpoint Register +#define UDP_CSR (48) // Endpoint Control and Status Register +#define UDP_FDR (80) // Endpoint FIFO Data Register +#define UDP_TXVC (116) // Transceiver Control Register +// -------- UDP_FRM_NUM : (UDP Offset: 0x0) USB Frame Number Register -------- +#define AT91C_UDP_FRM_NUM (0x7FF << 0) // (UDP) Frame Number as Defined in the Packet Field Formats +#define AT91C_UDP_FRM_ERR (0x1 << 16) // (UDP) Frame Error +#define AT91C_UDP_FRM_OK (0x1 << 17) // (UDP) Frame OK +// -------- UDP_GLB_STATE : (UDP Offset: 0x4) USB Global State Register -------- +#define AT91C_UDP_FADDEN (0x1 << 0) // (UDP) Function Address Enable +#define AT91C_UDP_CONFG (0x1 << 1) // (UDP) Configured +#define AT91C_UDP_ESR (0x1 << 2) // (UDP) Enable Send Resume +#define AT91C_UDP_RSMINPR (0x1 << 3) // (UDP) A Resume Has Been Sent to the Host +#define AT91C_UDP_RMWUPE (0x1 << 4) // (UDP) Remote Wake Up Enable +// -------- UDP_FADDR : (UDP Offset: 0x8) USB Function Address Register -------- +#define AT91C_UDP_FADD (0xFF << 0) // (UDP) Function Address Value +#define AT91C_UDP_FEN (0x1 << 8) // (UDP) Function Enable +// -------- UDP_IER : (UDP Offset: 0x10) USB Interrupt Enable Register -------- +#define AT91C_UDP_EPINT0 (0x1 << 0) // (UDP) Endpoint 0 Interrupt +#define AT91C_UDP_EPINT1 (0x1 << 1) // (UDP) Endpoint 0 Interrupt +#define AT91C_UDP_EPINT2 (0x1 << 2) // (UDP) Endpoint 2 Interrupt +#define AT91C_UDP_EPINT3 (0x1 << 3) // (UDP) Endpoint 3 Interrupt +#define AT91C_UDP_EPINT4 (0x1 << 4) // (UDP) Endpoint 4 Interrupt +#define AT91C_UDP_EPINT5 (0x1 << 5) // (UDP) Endpoint 5 Interrupt +#define AT91C_UDP_RXSUSP (0x1 << 8) // (UDP) USB Suspend Interrupt +#define AT91C_UDP_RXRSM (0x1 << 9) // (UDP) USB Resume Interrupt +#define AT91C_UDP_EXTRSM (0x1 << 10) // (UDP) USB External Resume Interrupt +#define AT91C_UDP_SOFINT (0x1 << 11) // (UDP) USB Start Of frame Interrupt +#define AT91C_UDP_WAKEUP (0x1 << 13) // (UDP) USB Resume Interrupt +// -------- UDP_IDR : (UDP Offset: 0x14) USB Interrupt Disable Register -------- +// -------- UDP_IMR : (UDP Offset: 0x18) USB Interrupt Mask Register -------- +// -------- UDP_ISR : (UDP Offset: 0x1c) USB Interrupt Status Register -------- +#define AT91C_UDP_ENDBUSRES (0x1 << 12) // (UDP) USB End Of Bus Reset Interrupt +// -------- UDP_ICR : (UDP Offset: 0x20) USB Interrupt Clear Register -------- +// -------- UDP_RST_EP : (UDP Offset: 0x28) USB Reset Endpoint Register -------- +#define AT91C_UDP_EP0 (0x1 << 0) // (UDP) Reset Endpoint 0 +#define AT91C_UDP_EP1 (0x1 << 1) // (UDP) Reset Endpoint 1 +#define AT91C_UDP_EP2 (0x1 << 2) // (UDP) Reset Endpoint 2 +#define AT91C_UDP_EP3 (0x1 << 3) // (UDP) Reset Endpoint 3 +#define AT91C_UDP_EP4 (0x1 << 4) // (UDP) Reset Endpoint 4 +#define AT91C_UDP_EP5 (0x1 << 5) // (UDP) Reset Endpoint 5 +// -------- UDP_CSR : (UDP Offset: 0x30) USB Endpoint Control and Status Register -------- +#define AT91C_UDP_TXCOMP (0x1 << 0) // (UDP) Generates an IN packet with data previously written in the DPR +#define AT91C_UDP_RX_DATA_BK0 (0x1 << 1) // (UDP) Receive Data Bank 0 +#define AT91C_UDP_RXSETUP (0x1 << 2) // (UDP) Sends STALL to the Host (Control endpoints) +#define AT91C_UDP_ISOERROR (0x1 << 3) // (UDP) Isochronous error (Isochronous endpoints) +#define AT91C_UDP_TXPKTRDY (0x1 << 4) // (UDP) Transmit Packet Ready +#define AT91C_UDP_FORCESTALL (0x1 << 5) // (UDP) Force Stall (used by Control, Bulk and Isochronous endpoints). +#define AT91C_UDP_RX_DATA_BK1 (0x1 << 6) // (UDP) Receive Data Bank 1 (only used by endpoints with ping-pong attributes). +#define AT91C_UDP_DIR (0x1 << 7) // (UDP) Transfer Direction +#define AT91C_UDP_EPTYPE (0x7 << 8) // (UDP) Endpoint type +#define AT91C_UDP_EPTYPE_CTRL (0x0 << 8) // (UDP) Control +#define AT91C_UDP_EPTYPE_ISO_OUT (0x1 << 8) // (UDP) Isochronous OUT +#define AT91C_UDP_EPTYPE_BULK_OUT (0x2 << 8) // (UDP) Bulk OUT +#define AT91C_UDP_EPTYPE_INT_OUT (0x3 << 8) // (UDP) Interrupt OUT +#define AT91C_UDP_EPTYPE_ISO_IN (0x5 << 8) // (UDP) Isochronous IN +#define AT91C_UDP_EPTYPE_BULK_IN (0x6 << 8) // (UDP) Bulk IN +#define AT91C_UDP_EPTYPE_INT_IN (0x7 << 8) // (UDP) Interrupt IN +#define AT91C_UDP_DTGLE (0x1 << 11) // (UDP) Data Toggle +#define AT91C_UDP_EPEDS (0x1 << 15) // (UDP) Endpoint Enable Disable +#define AT91C_UDP_RXBYTECNT (0x7FF << 16) // (UDP) Number Of Bytes Available in the FIFO +// -------- UDP_TXVC : (UDP Offset: 0x74) Transceiver Control Register -------- +#define AT91C_UDP_TXVDIS (0x1 << 8) // (UDP) +#define AT91C_UDP_PUON (0x1 << 9) // (UDP) Pull-up ON + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Timer Counter Channel Interface +// ***************************************************************************** +// *** Register offset in AT91S_TC structure *** +#define TC_CCR ( 0) // Channel Control Register +#define TC_CMR ( 4) // Channel Mode Register (Capture Mode / Waveform Mode) +#define TC_CV (16) // Counter Value +#define TC_RA (20) // Register A +#define TC_RB (24) // Register B +#define TC_RC (28) // Register C +#define TC_SR (32) // Status Register +#define TC_IER (36) // Interrupt Enable Register +#define TC_IDR (40) // Interrupt Disable Register +#define TC_IMR (44) // Interrupt Mask Register +// -------- TC_CCR : (TC Offset: 0x0) TC Channel Control Register -------- +#define AT91C_TC_CLKEN (0x1 << 0) // (TC) Counter Clock Enable Command +#define AT91C_TC_CLKDIS (0x1 << 1) // (TC) Counter Clock Disable Command +#define AT91C_TC_SWTRG (0x1 << 2) // (TC) Software Trigger Command +// -------- TC_CMR : (TC Offset: 0x4) TC Channel Mode Register: Capture Mode / Waveform Mode -------- +#define AT91C_TC_CLKS (0x7 << 0) // (TC) Clock Selection +#define AT91C_TC_CLKS_TIMER_DIV1_CLOCK (0x0) // (TC) Clock selected: TIMER_DIV1_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV2_CLOCK (0x1) // (TC) Clock selected: TIMER_DIV2_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV3_CLOCK (0x2) // (TC) Clock selected: TIMER_DIV3_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV4_CLOCK (0x3) // (TC) Clock selected: TIMER_DIV4_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV5_CLOCK (0x4) // (TC) Clock selected: TIMER_DIV5_CLOCK +#define AT91C_TC_CLKS_XC0 (0x5) // (TC) Clock selected: XC0 +#define AT91C_TC_CLKS_XC1 (0x6) // (TC) Clock selected: XC1 +#define AT91C_TC_CLKS_XC2 (0x7) // (TC) Clock selected: XC2 +#define AT91C_TC_CLKI (0x1 << 3) // (TC) Clock Invert +#define AT91C_TC_BURST (0x3 << 4) // (TC) Burst Signal Selection +#define AT91C_TC_BURST_NONE (0x0 << 4) // (TC) The clock is not gated by an external signal +#define AT91C_TC_BURST_XC0 (0x1 << 4) // (TC) XC0 is ANDed with the selected clock +#define AT91C_TC_BURST_XC1 (0x2 << 4) // (TC) XC1 is ANDed with the selected clock +#define AT91C_TC_BURST_XC2 (0x3 << 4) // (TC) XC2 is ANDed with the selected clock +#define AT91C_TC_CPCSTOP (0x1 << 6) // (TC) Counter Clock Stopped with RC Compare +#define AT91C_TC_LDBSTOP (0x1 << 6) // (TC) Counter Clock Stopped with RB Loading +#define AT91C_TC_CPCDIS (0x1 << 7) // (TC) Counter Clock Disable with RC Compare +#define AT91C_TC_LDBDIS (0x1 << 7) // (TC) Counter Clock Disabled with RB Loading +#define AT91C_TC_ETRGEDG (0x3 << 8) // (TC) External Trigger Edge Selection +#define AT91C_TC_ETRGEDG_NONE (0x0 << 8) // (TC) Edge: None +#define AT91C_TC_ETRGEDG_RISING (0x1 << 8) // (TC) Edge: rising edge +#define AT91C_TC_ETRGEDG_FALLING (0x2 << 8) // (TC) Edge: falling edge +#define AT91C_TC_ETRGEDG_BOTH (0x3 << 8) // (TC) Edge: each edge +#define AT91C_TC_EEVTEDG (0x3 << 8) // (TC) External Event Edge Selection +#define AT91C_TC_EEVTEDG_NONE (0x0 << 8) // (TC) Edge: None +#define AT91C_TC_EEVTEDG_RISING (0x1 << 8) // (TC) Edge: rising edge +#define AT91C_TC_EEVTEDG_FALLING (0x2 << 8) // (TC) Edge: falling edge +#define AT91C_TC_EEVTEDG_BOTH (0x3 << 8) // (TC) Edge: each edge +#define AT91C_TC_EEVT (0x3 << 10) // (TC) External Event Selection +#define AT91C_TC_EEVT_TIOB (0x0 << 10) // (TC) Signal selected as external event: TIOB TIOB direction: input +#define AT91C_TC_EEVT_XC0 (0x1 << 10) // (TC) Signal selected as external event: XC0 TIOB direction: output +#define AT91C_TC_EEVT_XC1 (0x2 << 10) // (TC) Signal selected as external event: XC1 TIOB direction: output +#define AT91C_TC_EEVT_XC2 (0x3 << 10) // (TC) Signal selected as external event: XC2 TIOB direction: output +#define AT91C_TC_ABETRG (0x1 << 10) // (TC) TIOA or TIOB External Trigger Selection +#define AT91C_TC_ENETRG (0x1 << 12) // (TC) External Event Trigger enable +#define AT91C_TC_WAVESEL (0x3 << 13) // (TC) Waveform Selection +#define AT91C_TC_WAVESEL_UP (0x0 << 13) // (TC) UP mode without atomatic trigger on RC Compare +#define AT91C_TC_WAVESEL_UPDOWN (0x1 << 13) // (TC) UPDOWN mode without automatic trigger on RC Compare +#define AT91C_TC_WAVESEL_UP_AUTO (0x2 << 13) // (TC) UP mode with automatic trigger on RC Compare +#define AT91C_TC_WAVESEL_UPDOWN_AUTO (0x3 << 13) // (TC) UPDOWN mode with automatic trigger on RC Compare +#define AT91C_TC_CPCTRG (0x1 << 14) // (TC) RC Compare Trigger Enable +#define AT91C_TC_WAVE (0x1 << 15) // (TC) +#define AT91C_TC_ACPA (0x3 << 16) // (TC) RA Compare Effect on TIOA +#define AT91C_TC_ACPA_NONE (0x0 << 16) // (TC) Effect: none +#define AT91C_TC_ACPA_SET (0x1 << 16) // (TC) Effect: set +#define AT91C_TC_ACPA_CLEAR (0x2 << 16) // (TC) Effect: clear +#define AT91C_TC_ACPA_TOGGLE (0x3 << 16) // (TC) Effect: toggle +#define AT91C_TC_LDRA (0x3 << 16) // (TC) RA Loading Selection +#define AT91C_TC_LDRA_NONE (0x0 << 16) // (TC) Edge: None +#define AT91C_TC_LDRA_RISING (0x1 << 16) // (TC) Edge: rising edge of TIOA +#define AT91C_TC_LDRA_FALLING (0x2 << 16) // (TC) Edge: falling edge of TIOA +#define AT91C_TC_LDRA_BOTH (0x3 << 16) // (TC) Edge: each edge of TIOA +#define AT91C_TC_ACPC (0x3 << 18) // (TC) RC Compare Effect on TIOA +#define AT91C_TC_ACPC_NONE (0x0 << 18) // (TC) Effect: none +#define AT91C_TC_ACPC_SET (0x1 << 18) // (TC) Effect: set +#define AT91C_TC_ACPC_CLEAR (0x2 << 18) // (TC) Effect: clear +#define AT91C_TC_ACPC_TOGGLE (0x3 << 18) // (TC) Effect: toggle +#define AT91C_TC_LDRB (0x3 << 18) // (TC) RB Loading Selection +#define AT91C_TC_LDRB_NONE (0x0 << 18) // (TC) Edge: None +#define AT91C_TC_LDRB_RISING (0x1 << 18) // (TC) Edge: rising edge of TIOA +#define AT91C_TC_LDRB_FALLING (0x2 << 18) // (TC) Edge: falling edge of TIOA +#define AT91C_TC_LDRB_BOTH (0x3 << 18) // (TC) Edge: each edge of TIOA +#define AT91C_TC_AEEVT (0x3 << 20) // (TC) External Event Effect on TIOA +#define AT91C_TC_AEEVT_NONE (0x0 << 20) // (TC) Effect: none +#define AT91C_TC_AEEVT_SET (0x1 << 20) // (TC) Effect: set +#define AT91C_TC_AEEVT_CLEAR (0x2 << 20) // (TC) Effect: clear +#define AT91C_TC_AEEVT_TOGGLE (0x3 << 20) // (TC) Effect: toggle +#define AT91C_TC_ASWTRG (0x3 << 22) // (TC) Software Trigger Effect on TIOA +#define AT91C_TC_ASWTRG_NONE (0x0 << 22) // (TC) Effect: none +#define AT91C_TC_ASWTRG_SET (0x1 << 22) // (TC) Effect: set +#define AT91C_TC_ASWTRG_CLEAR (0x2 << 22) // (TC) Effect: clear +#define AT91C_TC_ASWTRG_TOGGLE (0x3 << 22) // (TC) Effect: toggle +#define AT91C_TC_BCPB (0x3 << 24) // (TC) RB Compare Effect on TIOB +#define AT91C_TC_BCPB_NONE (0x0 << 24) // (TC) Effect: none +#define AT91C_TC_BCPB_SET (0x1 << 24) // (TC) Effect: set +#define AT91C_TC_BCPB_CLEAR (0x2 << 24) // (TC) Effect: clear +#define AT91C_TC_BCPB_TOGGLE (0x3 << 24) // (TC) Effect: toggle +#define AT91C_TC_BCPC (0x3 << 26) // (TC) RC Compare Effect on TIOB +#define AT91C_TC_BCPC_NONE (0x0 << 26) // (TC) Effect: none +#define AT91C_TC_BCPC_SET (0x1 << 26) // (TC) Effect: set +#define AT91C_TC_BCPC_CLEAR (0x2 << 26) // (TC) Effect: clear +#define AT91C_TC_BCPC_TOGGLE (0x3 << 26) // (TC) Effect: toggle +#define AT91C_TC_BEEVT (0x3 << 28) // (TC) External Event Effect on TIOB +#define AT91C_TC_BEEVT_NONE (0x0 << 28) // (TC) Effect: none +#define AT91C_TC_BEEVT_SET (0x1 << 28) // (TC) Effect: set +#define AT91C_TC_BEEVT_CLEAR (0x2 << 28) // (TC) Effect: clear +#define AT91C_TC_BEEVT_TOGGLE (0x3 << 28) // (TC) Effect: toggle +#define AT91C_TC_BSWTRG (0x3 << 30) // (TC) Software Trigger Effect on TIOB +#define AT91C_TC_BSWTRG_NONE (0x0 << 30) // (TC) Effect: none +#define AT91C_TC_BSWTRG_SET (0x1 << 30) // (TC) Effect: set +#define AT91C_TC_BSWTRG_CLEAR (0x2 << 30) // (TC) Effect: clear +#define AT91C_TC_BSWTRG_TOGGLE (0x3 << 30) // (TC) Effect: toggle +// -------- TC_SR : (TC Offset: 0x20) TC Channel Status Register -------- +#define AT91C_TC_COVFS (0x1 << 0) // (TC) Counter Overflow +#define AT91C_TC_LOVRS (0x1 << 1) // (TC) Load Overrun +#define AT91C_TC_CPAS (0x1 << 2) // (TC) RA Compare +#define AT91C_TC_CPBS (0x1 << 3) // (TC) RB Compare +#define AT91C_TC_CPCS (0x1 << 4) // (TC) RC Compare +#define AT91C_TC_LDRAS (0x1 << 5) // (TC) RA Loading +#define AT91C_TC_LDRBS (0x1 << 6) // (TC) RB Loading +#define AT91C_TC_ETRGS (0x1 << 7) // (TC) External Trigger +#define AT91C_TC_CLKSTA (0x1 << 16) // (TC) Clock Enabling +#define AT91C_TC_MTIOA (0x1 << 17) // (TC) TIOA Mirror +#define AT91C_TC_MTIOB (0x1 << 18) // (TC) TIOA Mirror +// -------- TC_IER : (TC Offset: 0x24) TC Channel Interrupt Enable Register -------- +// -------- TC_IDR : (TC Offset: 0x28) TC Channel Interrupt Disable Register -------- +// -------- TC_IMR : (TC Offset: 0x2c) TC Channel Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Timer Counter Interface +// ***************************************************************************** +// *** Register offset in AT91S_TCB structure *** +#define TCB_TC0 ( 0) // TC Channel 0 +#define TCB_TC1 (64) // TC Channel 1 +#define TCB_TC2 (128) // TC Channel 2 +#define TCB_BCR (192) // TC Block Control Register +#define TCB_BMR (196) // TC Block Mode Register +// -------- TCB_BCR : (TCB Offset: 0xc0) TC Block Control Register -------- +#define AT91C_TCB_SYNC (0x1 << 0) // (TCB) Synchro Command +// -------- TCB_BMR : (TCB Offset: 0xc4) TC Block Mode Register -------- +#define AT91C_TCB_TC0XC0S (0x3 << 0) // (TCB) External Clock Signal 0 Selection +#define AT91C_TCB_TC0XC0S_TCLK0 (0x0) // (TCB) TCLK0 connected to XC0 +#define AT91C_TCB_TC0XC0S_NONE (0x1) // (TCB) None signal connected to XC0 +#define AT91C_TCB_TC0XC0S_TIOA1 (0x2) // (TCB) TIOA1 connected to XC0 +#define AT91C_TCB_TC0XC0S_TIOA2 (0x3) // (TCB) TIOA2 connected to XC0 +#define AT91C_TCB_TC1XC1S (0x3 << 2) // (TCB) External Clock Signal 1 Selection +#define AT91C_TCB_TC1XC1S_TCLK1 (0x0 << 2) // (TCB) TCLK1 connected to XC1 +#define AT91C_TCB_TC1XC1S_NONE (0x1 << 2) // (TCB) None signal connected to XC1 +#define AT91C_TCB_TC1XC1S_TIOA0 (0x2 << 2) // (TCB) TIOA0 connected to XC1 +#define AT91C_TCB_TC1XC1S_TIOA2 (0x3 << 2) // (TCB) TIOA2 connected to XC1 +#define AT91C_TCB_TC2XC2S (0x3 << 4) // (TCB) External Clock Signal 2 Selection +#define AT91C_TCB_TC2XC2S_TCLK2 (0x0 << 4) // (TCB) TCLK2 connected to XC2 +#define AT91C_TCB_TC2XC2S_NONE (0x1 << 4) // (TCB) None signal connected to XC2 +#define AT91C_TCB_TC2XC2S_TIOA0 (0x2 << 4) // (TCB) TIOA0 connected to XC2 +#define AT91C_TCB_TC2XC2S_TIOA1 (0x3 << 4) // (TCB) TIOA2 connected to XC2 + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Control Area Network MailBox Interface +// ***************************************************************************** +// *** Register offset in AT91S_CAN_MB structure *** +#define CAN_MB_MMR ( 0) // MailBox Mode Register +#define CAN_MB_MAM ( 4) // MailBox Acceptance Mask Register +#define CAN_MB_MID ( 8) // MailBox ID Register +#define CAN_MB_MFID (12) // MailBox Family ID Register +#define CAN_MB_MSR (16) // MailBox Status Register +#define CAN_MB_MDL (20) // MailBox Data Low Register +#define CAN_MB_MDH (24) // MailBox Data High Register +#define CAN_MB_MCR (28) // MailBox Control Register +// -------- CAN_MMR : (CAN_MB Offset: 0x0) CAN Message Mode Register -------- +#define AT91C_CAN_MTIMEMARK (0xFFFF << 0) // (CAN_MB) Mailbox Timemark +#define AT91C_CAN_PRIOR (0xF << 16) // (CAN_MB) Mailbox Priority +#define AT91C_CAN_MOT (0x7 << 24) // (CAN_MB) Mailbox Object Type +#define AT91C_CAN_MOT_DIS (0x0 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_RX (0x1 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_RXOVERWRITE (0x2 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_TX (0x3 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_CONSUMER (0x4 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_PRODUCER (0x5 << 24) // (CAN_MB) +// -------- CAN_MAM : (CAN_MB Offset: 0x4) CAN Message Acceptance Mask Register -------- +#define AT91C_CAN_MIDvB (0x3FFFF << 0) // (CAN_MB) Complementary bits for identifier in extended mode +#define AT91C_CAN_MIDvA (0x7FF << 18) // (CAN_MB) Identifier for standard frame mode +#define AT91C_CAN_MIDE (0x1 << 29) // (CAN_MB) Identifier Version +// -------- CAN_MID : (CAN_MB Offset: 0x8) CAN Message ID Register -------- +// -------- CAN_MFID : (CAN_MB Offset: 0xc) CAN Message Family ID Register -------- +// -------- CAN_MSR : (CAN_MB Offset: 0x10) CAN Message Status Register -------- +#define AT91C_CAN_MTIMESTAMP (0xFFFF << 0) // (CAN_MB) Timer Value +#define AT91C_CAN_MDLC (0xF << 16) // (CAN_MB) Mailbox Data Length Code +#define AT91C_CAN_MRTR (0x1 << 20) // (CAN_MB) Mailbox Remote Transmission Request +#define AT91C_CAN_MABT (0x1 << 22) // (CAN_MB) Mailbox Message Abort +#define AT91C_CAN_MRDY (0x1 << 23) // (CAN_MB) Mailbox Ready +#define AT91C_CAN_MMI (0x1 << 24) // (CAN_MB) Mailbox Message Ignored +// -------- CAN_MDL : (CAN_MB Offset: 0x14) CAN Message Data Low Register -------- +// -------- CAN_MDH : (CAN_MB Offset: 0x18) CAN Message Data High Register -------- +// -------- CAN_MCR : (CAN_MB Offset: 0x1c) CAN Message Control Register -------- +#define AT91C_CAN_MACR (0x1 << 22) // (CAN_MB) Abort Request for Mailbox +#define AT91C_CAN_MTCR (0x1 << 23) // (CAN_MB) Mailbox Transfer Command + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Control Area Network Interface +// ***************************************************************************** +// *** Register offset in AT91S_CAN structure *** +#define CAN_MR ( 0) // Mode Register +#define CAN_IER ( 4) // Interrupt Enable Register +#define CAN_IDR ( 8) // Interrupt Disable Register +#define CAN_IMR (12) // Interrupt Mask Register +#define CAN_SR (16) // Status Register +#define CAN_BR (20) // Baudrate Register +#define CAN_TIM (24) // Timer Register +#define CAN_TIMESTP (28) // Time Stamp Register +#define CAN_ECR (32) // Error Counter Register +#define CAN_TCR (36) // Transfer Command Register +#define CAN_ACR (40) // Abort Command Register +#define CAN_VR (252) // Version Register +#define CAN_MB0 (512) // CAN Mailbox 0 +#define CAN_MB1 (544) // CAN Mailbox 1 +#define CAN_MB2 (576) // CAN Mailbox 2 +#define CAN_MB3 (608) // CAN Mailbox 3 +#define CAN_MB4 (640) // CAN Mailbox 4 +#define CAN_MB5 (672) // CAN Mailbox 5 +#define CAN_MB6 (704) // CAN Mailbox 6 +#define CAN_MB7 (736) // CAN Mailbox 7 +#define CAN_MB8 (768) // CAN Mailbox 8 +#define CAN_MB9 (800) // CAN Mailbox 9 +#define CAN_MB10 (832) // CAN Mailbox 10 +#define CAN_MB11 (864) // CAN Mailbox 11 +#define CAN_MB12 (896) // CAN Mailbox 12 +#define CAN_MB13 (928) // CAN Mailbox 13 +#define CAN_MB14 (960) // CAN Mailbox 14 +#define CAN_MB15 (992) // CAN Mailbox 15 +// -------- CAN_MR : (CAN Offset: 0x0) CAN Mode Register -------- +#define AT91C_CAN_CANEN (0x1 << 0) // (CAN) CAN Controller Enable +#define AT91C_CAN_LPM (0x1 << 1) // (CAN) Disable/Enable Low Power Mode +#define AT91C_CAN_ABM (0x1 << 2) // (CAN) Disable/Enable Autobaud/Listen Mode +#define AT91C_CAN_OVL (0x1 << 3) // (CAN) Disable/Enable Overload Frame +#define AT91C_CAN_TEOF (0x1 << 4) // (CAN) Time Stamp messages at each end of Frame +#define AT91C_CAN_TTM (0x1 << 5) // (CAN) Disable/Enable Time Trigger Mode +#define AT91C_CAN_TIMFRZ (0x1 << 6) // (CAN) Enable Timer Freeze +#define AT91C_CAN_DRPT (0x1 << 7) // (CAN) Disable Repeat +// -------- CAN_IER : (CAN Offset: 0x4) CAN Interrupt Enable Register -------- +#define AT91C_CAN_MB0 (0x1 << 0) // (CAN) Mailbox 0 Flag +#define AT91C_CAN_MB1 (0x1 << 1) // (CAN) Mailbox 1 Flag +#define AT91C_CAN_MB2 (0x1 << 2) // (CAN) Mailbox 2 Flag +#define AT91C_CAN_MB3 (0x1 << 3) // (CAN) Mailbox 3 Flag +#define AT91C_CAN_MB4 (0x1 << 4) // (CAN) Mailbox 4 Flag +#define AT91C_CAN_MB5 (0x1 << 5) // (CAN) Mailbox 5 Flag +#define AT91C_CAN_MB6 (0x1 << 6) // (CAN) Mailbox 6 Flag +#define AT91C_CAN_MB7 (0x1 << 7) // (CAN) Mailbox 7 Flag +#define AT91C_CAN_MB8 (0x1 << 8) // (CAN) Mailbox 8 Flag +#define AT91C_CAN_MB9 (0x1 << 9) // (CAN) Mailbox 9 Flag +#define AT91C_CAN_MB10 (0x1 << 10) // (CAN) Mailbox 10 Flag +#define AT91C_CAN_MB11 (0x1 << 11) // (CAN) Mailbox 11 Flag +#define AT91C_CAN_MB12 (0x1 << 12) // (CAN) Mailbox 12 Flag +#define AT91C_CAN_MB13 (0x1 << 13) // (CAN) Mailbox 13 Flag +#define AT91C_CAN_MB14 (0x1 << 14) // (CAN) Mailbox 14 Flag +#define AT91C_CAN_MB15 (0x1 << 15) // (CAN) Mailbox 15 Flag +#define AT91C_CAN_ERRA (0x1 << 16) // (CAN) Error Active Mode Flag +#define AT91C_CAN_WARN (0x1 << 17) // (CAN) Warning Limit Flag +#define AT91C_CAN_ERRP (0x1 << 18) // (CAN) Error Passive Mode Flag +#define AT91C_CAN_BOFF (0x1 << 19) // (CAN) Bus Off Mode Flag +#define AT91C_CAN_SLEEP (0x1 << 20) // (CAN) Sleep Flag +#define AT91C_CAN_WAKEUP (0x1 << 21) // (CAN) Wakeup Flag +#define AT91C_CAN_TOVF (0x1 << 22) // (CAN) Timer Overflow Flag +#define AT91C_CAN_TSTP (0x1 << 23) // (CAN) Timestamp Flag +#define AT91C_CAN_CERR (0x1 << 24) // (CAN) CRC Error +#define AT91C_CAN_SERR (0x1 << 25) // (CAN) Stuffing Error +#define AT91C_CAN_AERR (0x1 << 26) // (CAN) Acknowledgment Error +#define AT91C_CAN_FERR (0x1 << 27) // (CAN) Form Error +#define AT91C_CAN_BERR (0x1 << 28) // (CAN) Bit Error +// -------- CAN_IDR : (CAN Offset: 0x8) CAN Interrupt Disable Register -------- +// -------- CAN_IMR : (CAN Offset: 0xc) CAN Interrupt Mask Register -------- +// -------- CAN_SR : (CAN Offset: 0x10) CAN Status Register -------- +#define AT91C_CAN_RBSY (0x1 << 29) // (CAN) Receiver Busy +#define AT91C_CAN_TBSY (0x1 << 30) // (CAN) Transmitter Busy +#define AT91C_CAN_OVLY (0x1 << 31) // (CAN) Overload Busy +// -------- CAN_BR : (CAN Offset: 0x14) CAN Baudrate Register -------- +#define AT91C_CAN_PHASE2 (0x7 << 0) // (CAN) Phase 2 segment +#define AT91C_CAN_PHASE1 (0x7 << 4) // (CAN) Phase 1 segment +#define AT91C_CAN_PROPAG (0x7 << 8) // (CAN) Programmation time segment +#define AT91C_CAN_SYNC (0x3 << 12) // (CAN) Re-synchronization jump width segment +#define AT91C_CAN_BRP (0x7F << 16) // (CAN) Baudrate Prescaler +#define AT91C_CAN_SMP (0x1 << 24) // (CAN) Sampling mode +// -------- CAN_TIM : (CAN Offset: 0x18) CAN Timer Register -------- +#define AT91C_CAN_TIMER (0xFFFF << 0) // (CAN) Timer field +// -------- CAN_TIMESTP : (CAN Offset: 0x1c) CAN Timestamp Register -------- +// -------- CAN_ECR : (CAN Offset: 0x20) CAN Error Counter Register -------- +#define AT91C_CAN_REC (0xFF << 0) // (CAN) Receive Error Counter +#define AT91C_CAN_TEC (0xFF << 16) // (CAN) Transmit Error Counter +// -------- CAN_TCR : (CAN Offset: 0x24) CAN Transfer Command Register -------- +#define AT91C_CAN_TIMRST (0x1 << 31) // (CAN) Timer Reset Field +// -------- CAN_ACR : (CAN Offset: 0x28) CAN Abort Command Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Ethernet MAC 10/100 +// ***************************************************************************** +// *** Register offset in AT91S_EMAC structure *** +#define EMAC_NCR ( 0) // Network Control Register +#define EMAC_NCFGR ( 4) // Network Configuration Register +#define EMAC_NSR ( 8) // Network Status Register +#define EMAC_TSR (20) // Transmit Status Register +#define EMAC_RBQP (24) // Receive Buffer Queue Pointer +#define EMAC_TBQP (28) // Transmit Buffer Queue Pointer +#define EMAC_RSR (32) // Receive Status Register +#define EMAC_ISR (36) // Interrupt Status Register +#define EMAC_IER (40) // Interrupt Enable Register +#define EMAC_IDR (44) // Interrupt Disable Register +#define EMAC_IMR (48) // Interrupt Mask Register +#define EMAC_MAN (52) // PHY Maintenance Register +#define EMAC_PTR (56) // Pause Time Register +#define EMAC_PFR (60) // Pause Frames received Register +#define EMAC_FTO (64) // Frames Transmitted OK Register +#define EMAC_SCF (68) // Single Collision Frame Register +#define EMAC_MCF (72) // Multiple Collision Frame Register +#define EMAC_FRO (76) // Frames Received OK Register +#define EMAC_FCSE (80) // Frame Check Sequence Error Register +#define EMAC_ALE (84) // Alignment Error Register +#define EMAC_DTF (88) // Deferred Transmission Frame Register +#define EMAC_LCOL (92) // Late Collision Register +#define EMAC_ECOL (96) // Excessive Collision Register +#define EMAC_TUND (100) // Transmit Underrun Error Register +#define EMAC_CSE (104) // Carrier Sense Error Register +#define EMAC_RRE (108) // Receive Ressource Error Register +#define EMAC_ROV (112) // Receive Overrun Errors Register +#define EMAC_RSE (116) // Receive Symbol Errors Register +#define EMAC_ELE (120) // Excessive Length Errors Register +#define EMAC_RJA (124) // Receive Jabbers Register +#define EMAC_USF (128) // Undersize Frames Register +#define EMAC_STE (132) // SQE Test Error Register +#define EMAC_RLE (136) // Receive Length Field Mismatch Register +#define EMAC_TPF (140) // Transmitted Pause Frames Register +#define EMAC_HRB (144) // Hash Address Bottom[31:0] +#define EMAC_HRT (148) // Hash Address Top[63:32] +#define EMAC_SA1L (152) // Specific Address 1 Bottom, First 4 bytes +#define EMAC_SA1H (156) // Specific Address 1 Top, Last 2 bytes +#define EMAC_SA2L (160) // Specific Address 2 Bottom, First 4 bytes +#define EMAC_SA2H (164) // Specific Address 2 Top, Last 2 bytes +#define EMAC_SA3L (168) // Specific Address 3 Bottom, First 4 bytes +#define EMAC_SA3H (172) // Specific Address 3 Top, Last 2 bytes +#define EMAC_SA4L (176) // Specific Address 4 Bottom, First 4 bytes +#define EMAC_SA4H (180) // Specific Address 4 Top, Last 2 bytes +#define EMAC_TID (184) // Type ID Checking Register +#define EMAC_TPQ (188) // Transmit Pause Quantum Register +#define EMAC_USRIO (192) // USER Input/Output Register +#define EMAC_WOL (196) // Wake On LAN Register +#define EMAC_REV (252) // Revision Register +// -------- EMAC_NCR : (EMAC Offset: 0x0) -------- +#define AT91C_EMAC_LB (0x1 << 0) // (EMAC) Loopback. Optional. When set, loopback signal is at high level. +#define AT91C_EMAC_LLB (0x1 << 1) // (EMAC) Loopback local. +#define AT91C_EMAC_RE (0x1 << 2) // (EMAC) Receive enable. +#define AT91C_EMAC_TE (0x1 << 3) // (EMAC) Transmit enable. +#define AT91C_EMAC_MPE (0x1 << 4) // (EMAC) Management port enable. +#define AT91C_EMAC_CLRSTAT (0x1 << 5) // (EMAC) Clear statistics registers. +#define AT91C_EMAC_INCSTAT (0x1 << 6) // (EMAC) Increment statistics registers. +#define AT91C_EMAC_WESTAT (0x1 << 7) // (EMAC) Write enable for statistics registers. +#define AT91C_EMAC_BP (0x1 << 8) // (EMAC) Back pressure. +#define AT91C_EMAC_TSTART (0x1 << 9) // (EMAC) Start Transmission. +#define AT91C_EMAC_THALT (0x1 << 10) // (EMAC) Transmission Halt. +#define AT91C_EMAC_TPFR (0x1 << 11) // (EMAC) Transmit pause frame +#define AT91C_EMAC_TZQ (0x1 << 12) // (EMAC) Transmit zero quantum pause frame +// -------- EMAC_NCFGR : (EMAC Offset: 0x4) Network Configuration Register -------- +#define AT91C_EMAC_SPD (0x1 << 0) // (EMAC) Speed. +#define AT91C_EMAC_FD (0x1 << 1) // (EMAC) Full duplex. +#define AT91C_EMAC_JFRAME (0x1 << 3) // (EMAC) Jumbo Frames. +#define AT91C_EMAC_CAF (0x1 << 4) // (EMAC) Copy all frames. +#define AT91C_EMAC_NBC (0x1 << 5) // (EMAC) No broadcast. +#define AT91C_EMAC_MTI (0x1 << 6) // (EMAC) Multicast hash event enable +#define AT91C_EMAC_UNI (0x1 << 7) // (EMAC) Unicast hash enable. +#define AT91C_EMAC_BIG (0x1 << 8) // (EMAC) Receive 1522 bytes. +#define AT91C_EMAC_EAE (0x1 << 9) // (EMAC) External address match enable. +#define AT91C_EMAC_CLK (0x3 << 10) // (EMAC) +#define AT91C_EMAC_CLK_HCLK_8 (0x0 << 10) // (EMAC) HCLK divided by 8 +#define AT91C_EMAC_CLK_HCLK_16 (0x1 << 10) // (EMAC) HCLK divided by 16 +#define AT91C_EMAC_CLK_HCLK_32 (0x2 << 10) // (EMAC) HCLK divided by 32 +#define AT91C_EMAC_CLK_HCLK_64 (0x3 << 10) // (EMAC) HCLK divided by 64 +#define AT91C_EMAC_RTY (0x1 << 12) // (EMAC) +#define AT91C_EMAC_PAE (0x1 << 13) // (EMAC) +#define AT91C_EMAC_RBOF (0x3 << 14) // (EMAC) +#define AT91C_EMAC_RBOF_OFFSET_0 (0x0 << 14) // (EMAC) no offset from start of receive buffer +#define AT91C_EMAC_RBOF_OFFSET_1 (0x1 << 14) // (EMAC) one byte offset from start of receive buffer +#define AT91C_EMAC_RBOF_OFFSET_2 (0x2 << 14) // (EMAC) two bytes offset from start of receive buffer +#define AT91C_EMAC_RBOF_OFFSET_3 (0x3 << 14) // (EMAC) three bytes offset from start of receive buffer +#define AT91C_EMAC_RLCE (0x1 << 16) // (EMAC) Receive Length field Checking Enable +#define AT91C_EMAC_DRFCS (0x1 << 17) // (EMAC) Discard Receive FCS +#define AT91C_EMAC_EFRHD (0x1 << 18) // (EMAC) +#define AT91C_EMAC_IRXFCS (0x1 << 19) // (EMAC) Ignore RX FCS +// -------- EMAC_NSR : (EMAC Offset: 0x8) Network Status Register -------- +#define AT91C_EMAC_LINKR (0x1 << 0) // (EMAC) +#define AT91C_EMAC_MDIO (0x1 << 1) // (EMAC) +#define AT91C_EMAC_IDLE (0x1 << 2) // (EMAC) +// -------- EMAC_TSR : (EMAC Offset: 0x14) Transmit Status Register -------- +#define AT91C_EMAC_UBR (0x1 << 0) // (EMAC) +#define AT91C_EMAC_COL (0x1 << 1) // (EMAC) +#define AT91C_EMAC_RLES (0x1 << 2) // (EMAC) +#define AT91C_EMAC_TGO (0x1 << 3) // (EMAC) Transmit Go +#define AT91C_EMAC_BEX (0x1 << 4) // (EMAC) Buffers exhausted mid frame +#define AT91C_EMAC_COMP (0x1 << 5) // (EMAC) +#define AT91C_EMAC_UND (0x1 << 6) // (EMAC) +// -------- EMAC_RSR : (EMAC Offset: 0x20) Receive Status Register -------- +#define AT91C_EMAC_BNA (0x1 << 0) // (EMAC) +#define AT91C_EMAC_REC (0x1 << 1) // (EMAC) +#define AT91C_EMAC_OVR (0x1 << 2) // (EMAC) +// -------- EMAC_ISR : (EMAC Offset: 0x24) Interrupt Status Register -------- +#define AT91C_EMAC_MFD (0x1 << 0) // (EMAC) +#define AT91C_EMAC_RCOMP (0x1 << 1) // (EMAC) +#define AT91C_EMAC_RXUBR (0x1 << 2) // (EMAC) +#define AT91C_EMAC_TXUBR (0x1 << 3) // (EMAC) +#define AT91C_EMAC_TUNDR (0x1 << 4) // (EMAC) +#define AT91C_EMAC_RLEX (0x1 << 5) // (EMAC) +#define AT91C_EMAC_TXERR (0x1 << 6) // (EMAC) +#define AT91C_EMAC_TCOMP (0x1 << 7) // (EMAC) +#define AT91C_EMAC_LINK (0x1 << 9) // (EMAC) +#define AT91C_EMAC_ROVR (0x1 << 10) // (EMAC) +#define AT91C_EMAC_HRESP (0x1 << 11) // (EMAC) +#define AT91C_EMAC_PFRE (0x1 << 12) // (EMAC) +#define AT91C_EMAC_PTZ (0x1 << 13) // (EMAC) +// -------- EMAC_IER : (EMAC Offset: 0x28) Interrupt Enable Register -------- +// -------- EMAC_IDR : (EMAC Offset: 0x2c) Interrupt Disable Register -------- +// -------- EMAC_IMR : (EMAC Offset: 0x30) Interrupt Mask Register -------- +// -------- EMAC_MAN : (EMAC Offset: 0x34) PHY Maintenance Register -------- +#define AT91C_EMAC_DATA (0xFFFF << 0) // (EMAC) +#define AT91C_EMAC_CODE (0x3 << 16) // (EMAC) +#define AT91C_EMAC_REGA (0x1F << 18) // (EMAC) +#define AT91C_EMAC_PHYA (0x1F << 23) // (EMAC) +#define AT91C_EMAC_RW (0x3 << 28) // (EMAC) +#define AT91C_EMAC_SOF (0x3 << 30) // (EMAC) +// -------- EMAC_USRIO : (EMAC Offset: 0xc0) USER Input Output Register -------- +#define AT91C_EMAC_RMII (0x1 << 0) // (EMAC) Reduce MII +#define AT91C_EMAC_CLKEN (0x1 << 1) // (EMAC) Clock Enable +// -------- EMAC_WOL : (EMAC Offset: 0xc4) Wake On LAN Register -------- +#define AT91C_EMAC_IP (0xFFFF << 0) // (EMAC) ARP request IP address +#define AT91C_EMAC_MAG (0x1 << 16) // (EMAC) Magic packet event enable +#define AT91C_EMAC_ARP (0x1 << 17) // (EMAC) ARP request event enable +#define AT91C_EMAC_SA1 (0x1 << 18) // (EMAC) Specific address register 1 event enable +// -------- EMAC_REV : (EMAC Offset: 0xfc) Revision Register -------- +#define AT91C_EMAC_REVREF (0xFFFF << 0) // (EMAC) +#define AT91C_EMAC_PARTREF (0xFFFF << 16) // (EMAC) + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Analog to Digital Convertor +// ***************************************************************************** +// *** Register offset in AT91S_ADC structure *** +#define ADC_CR ( 0) // ADC Control Register +#define ADC_MR ( 4) // ADC Mode Register +#define ADC_CHER (16) // ADC Channel Enable Register +#define ADC_CHDR (20) // ADC Channel Disable Register +#define ADC_CHSR (24) // ADC Channel Status Register +#define ADC_SR (28) // ADC Status Register +#define ADC_LCDR (32) // ADC Last Converted Data Register +#define ADC_IER (36) // ADC Interrupt Enable Register +#define ADC_IDR (40) // ADC Interrupt Disable Register +#define ADC_IMR (44) // ADC Interrupt Mask Register +#define ADC_CDR0 (48) // ADC Channel Data Register 0 +#define ADC_CDR1 (52) // ADC Channel Data Register 1 +#define ADC_CDR2 (56) // ADC Channel Data Register 2 +#define ADC_CDR3 (60) // ADC Channel Data Register 3 +#define ADC_CDR4 (64) // ADC Channel Data Register 4 +#define ADC_CDR5 (68) // ADC Channel Data Register 5 +#define ADC_CDR6 (72) // ADC Channel Data Register 6 +#define ADC_CDR7 (76) // ADC Channel Data Register 7 +#define ADC_RPR (256) // Receive Pointer Register +#define ADC_RCR (260) // Receive Counter Register +#define ADC_TPR (264) // Transmit Pointer Register +#define ADC_TCR (268) // Transmit Counter Register +#define ADC_RNPR (272) // Receive Next Pointer Register +#define ADC_RNCR (276) // Receive Next Counter Register +#define ADC_TNPR (280) // Transmit Next Pointer Register +#define ADC_TNCR (284) // Transmit Next Counter Register +#define ADC_PTCR (288) // PDC Transfer Control Register +#define ADC_PTSR (292) // PDC Transfer Status Register +// -------- ADC_CR : (ADC Offset: 0x0) ADC Control Register -------- +#define AT91C_ADC_SWRST (0x1 << 0) // (ADC) Software Reset +#define AT91C_ADC_START (0x1 << 1) // (ADC) Start Conversion +// -------- ADC_MR : (ADC Offset: 0x4) ADC Mode Register -------- +#define AT91C_ADC_TRGEN (0x1 << 0) // (ADC) Trigger Enable +#define AT91C_ADC_TRGEN_DIS (0x0) // (ADC) Hradware triggers are disabled. Starting a conversion is only possible by software +#define AT91C_ADC_TRGEN_EN (0x1) // (ADC) Hardware trigger selected by TRGSEL field is enabled. +#define AT91C_ADC_TRGSEL (0x7 << 1) // (ADC) Trigger Selection +#define AT91C_ADC_TRGSEL_TIOA0 (0x0 << 1) // (ADC) Selected TRGSEL = TIAO0 +#define AT91C_ADC_TRGSEL_TIOA1 (0x1 << 1) // (ADC) Selected TRGSEL = TIAO1 +#define AT91C_ADC_TRGSEL_TIOA2 (0x2 << 1) // (ADC) Selected TRGSEL = TIAO2 +#define AT91C_ADC_TRGSEL_TIOA3 (0x3 << 1) // (ADC) Selected TRGSEL = TIAO3 +#define AT91C_ADC_TRGSEL_TIOA4 (0x4 << 1) // (ADC) Selected TRGSEL = TIAO4 +#define AT91C_ADC_TRGSEL_TIOA5 (0x5 << 1) // (ADC) Selected TRGSEL = TIAO5 +#define AT91C_ADC_TRGSEL_EXT (0x6 << 1) // (ADC) Selected TRGSEL = External Trigger +#define AT91C_ADC_LOWRES (0x1 << 4) // (ADC) Resolution. +#define AT91C_ADC_LOWRES_10_BIT (0x0 << 4) // (ADC) 10-bit resolution +#define AT91C_ADC_LOWRES_8_BIT (0x1 << 4) // (ADC) 8-bit resolution +#define AT91C_ADC_SLEEP (0x1 << 5) // (ADC) Sleep Mode +#define AT91C_ADC_SLEEP_NORMAL_MODE (0x0 << 5) // (ADC) Normal Mode +#define AT91C_ADC_SLEEP_MODE (0x1 << 5) // (ADC) Sleep Mode +#define AT91C_ADC_PRESCAL (0x3F << 8) // (ADC) Prescaler rate selection +#define AT91C_ADC_STARTUP (0x1F << 16) // (ADC) Startup Time +#define AT91C_ADC_SHTIM (0xF << 24) // (ADC) Sample & Hold Time +// -------- ADC_CHER : (ADC Offset: 0x10) ADC Channel Enable Register -------- +#define AT91C_ADC_CH0 (0x1 << 0) // (ADC) Channel 0 +#define AT91C_ADC_CH1 (0x1 << 1) // (ADC) Channel 1 +#define AT91C_ADC_CH2 (0x1 << 2) // (ADC) Channel 2 +#define AT91C_ADC_CH3 (0x1 << 3) // (ADC) Channel 3 +#define AT91C_ADC_CH4 (0x1 << 4) // (ADC) Channel 4 +#define AT91C_ADC_CH5 (0x1 << 5) // (ADC) Channel 5 +#define AT91C_ADC_CH6 (0x1 << 6) // (ADC) Channel 6 +#define AT91C_ADC_CH7 (0x1 << 7) // (ADC) Channel 7 +// -------- ADC_CHDR : (ADC Offset: 0x14) ADC Channel Disable Register -------- +// -------- ADC_CHSR : (ADC Offset: 0x18) ADC Channel Status Register -------- +// -------- ADC_SR : (ADC Offset: 0x1c) ADC Status Register -------- +#define AT91C_ADC_EOC0 (0x1 << 0) // (ADC) End of Conversion +#define AT91C_ADC_EOC1 (0x1 << 1) // (ADC) End of Conversion +#define AT91C_ADC_EOC2 (0x1 << 2) // (ADC) End of Conversion +#define AT91C_ADC_EOC3 (0x1 << 3) // (ADC) End of Conversion +#define AT91C_ADC_EOC4 (0x1 << 4) // (ADC) End of Conversion +#define AT91C_ADC_EOC5 (0x1 << 5) // (ADC) End of Conversion +#define AT91C_ADC_EOC6 (0x1 << 6) // (ADC) End of Conversion +#define AT91C_ADC_EOC7 (0x1 << 7) // (ADC) End of Conversion +#define AT91C_ADC_OVRE0 (0x1 << 8) // (ADC) Overrun Error +#define AT91C_ADC_OVRE1 (0x1 << 9) // (ADC) Overrun Error +#define AT91C_ADC_OVRE2 (0x1 << 10) // (ADC) Overrun Error +#define AT91C_ADC_OVRE3 (0x1 << 11) // (ADC) Overrun Error +#define AT91C_ADC_OVRE4 (0x1 << 12) // (ADC) Overrun Error +#define AT91C_ADC_OVRE5 (0x1 << 13) // (ADC) Overrun Error +#define AT91C_ADC_OVRE6 (0x1 << 14) // (ADC) Overrun Error +#define AT91C_ADC_OVRE7 (0x1 << 15) // (ADC) Overrun Error +#define AT91C_ADC_DRDY (0x1 << 16) // (ADC) Data Ready +#define AT91C_ADC_GOVRE (0x1 << 17) // (ADC) General Overrun +#define AT91C_ADC_ENDRX (0x1 << 18) // (ADC) End of Receiver Transfer +#define AT91C_ADC_RXBUFF (0x1 << 19) // (ADC) RXBUFF Interrupt +// -------- ADC_LCDR : (ADC Offset: 0x20) ADC Last Converted Data Register -------- +#define AT91C_ADC_LDATA (0x3FF << 0) // (ADC) Last Data Converted +// -------- ADC_IER : (ADC Offset: 0x24) ADC Interrupt Enable Register -------- +// -------- ADC_IDR : (ADC Offset: 0x28) ADC Interrupt Disable Register -------- +// -------- ADC_IMR : (ADC Offset: 0x2c) ADC Interrupt Mask Register -------- +// -------- ADC_CDR0 : (ADC Offset: 0x30) ADC Channel Data Register 0 -------- +#define AT91C_ADC_DATA (0x3FF << 0) // (ADC) Converted Data +// -------- ADC_CDR1 : (ADC Offset: 0x34) ADC Channel Data Register 1 -------- +// -------- ADC_CDR2 : (ADC Offset: 0x38) ADC Channel Data Register 2 -------- +// -------- ADC_CDR3 : (ADC Offset: 0x3c) ADC Channel Data Register 3 -------- +// -------- ADC_CDR4 : (ADC Offset: 0x40) ADC Channel Data Register 4 -------- +// -------- ADC_CDR5 : (ADC Offset: 0x44) ADC Channel Data Register 5 -------- +// -------- ADC_CDR6 : (ADC Offset: 0x48) ADC Channel Data Register 6 -------- +// -------- ADC_CDR7 : (ADC Offset: 0x4c) ADC Channel Data Register 7 -------- + +// ***************************************************************************** +// REGISTER ADDRESS DEFINITION FOR AT91SAM7X256 +// ***************************************************************************** +// ========== Register definition for SYS peripheral ========== +// ========== Register definition for AIC peripheral ========== +#define AT91C_AIC_IVR (0xFFFFF100) // (AIC) IRQ Vector Register +#define AT91C_AIC_SMR (0xFFFFF000) // (AIC) Source Mode Register +#define AT91C_AIC_FVR (0xFFFFF104) // (AIC) FIQ Vector Register +#define AT91C_AIC_DCR (0xFFFFF138) // (AIC) Debug Control Register (Protect) +#define AT91C_AIC_EOICR (0xFFFFF130) // (AIC) End of Interrupt Command Register +#define AT91C_AIC_SVR (0xFFFFF080) // (AIC) Source Vector Register +#define AT91C_AIC_FFSR (0xFFFFF148) // (AIC) Fast Forcing Status Register +#define AT91C_AIC_ICCR (0xFFFFF128) // (AIC) Interrupt Clear Command Register +#define AT91C_AIC_ISR (0xFFFFF108) // (AIC) Interrupt Status Register +#define AT91C_AIC_IMR (0xFFFFF110) // (AIC) Interrupt Mask Register +#define AT91C_AIC_IPR (0xFFFFF10C) // (AIC) Interrupt Pending Register +#define AT91C_AIC_FFER (0xFFFFF140) // (AIC) Fast Forcing Enable Register +#define AT91C_AIC_IECR (0xFFFFF120) // (AIC) Interrupt Enable Command Register +#define AT91C_AIC_ISCR (0xFFFFF12C) // (AIC) Interrupt Set Command Register +#define AT91C_AIC_FFDR (0xFFFFF144) // (AIC) Fast Forcing Disable Register +#define AT91C_AIC_CISR (0xFFFFF114) // (AIC) Core Interrupt Status Register +#define AT91C_AIC_IDCR (0xFFFFF124) // (AIC) Interrupt Disable Command Register +#define AT91C_AIC_SPU (0xFFFFF134) // (AIC) Spurious Vector Register +// ========== Register definition for PDC_DBGU peripheral ========== +#define AT91C_DBGU_TCR (0xFFFFF30C) // (PDC_DBGU) Transmit Counter Register +#define AT91C_DBGU_RNPR (0xFFFFF310) // (PDC_DBGU) Receive Next Pointer Register +#define AT91C_DBGU_TNPR (0xFFFFF318) // (PDC_DBGU) Transmit Next Pointer Register +#define AT91C_DBGU_TPR (0xFFFFF308) // (PDC_DBGU) Transmit Pointer Register +#define AT91C_DBGU_RPR (0xFFFFF300) // (PDC_DBGU) Receive Pointer Register +#define AT91C_DBGU_RCR (0xFFFFF304) // (PDC_DBGU) Receive Counter Register +#define AT91C_DBGU_RNCR (0xFFFFF314) // (PDC_DBGU) Receive Next Counter Register +#define AT91C_DBGU_PTCR (0xFFFFF320) // (PDC_DBGU) PDC Transfer Control Register +#define AT91C_DBGU_PTSR (0xFFFFF324) // (PDC_DBGU) PDC Transfer Status Register +#define AT91C_DBGU_TNCR (0xFFFFF31C) // (PDC_DBGU) Transmit Next Counter Register +// ========== Register definition for DBGU peripheral ========== +#define AT91C_DBGU_EXID (0xFFFFF244) // (DBGU) Chip ID Extension Register +#define AT91C_DBGU_BRGR (0xFFFFF220) // (DBGU) Baud Rate Generator Register +#define AT91C_DBGU_IDR (0xFFFFF20C) // (DBGU) Interrupt Disable Register +#define AT91C_DBGU_CSR (0xFFFFF214) // (DBGU) Channel Status Register +#define AT91C_DBGU_CIDR (0xFFFFF240) // (DBGU) Chip ID Register +#define AT91C_DBGU_MR (0xFFFFF204) // (DBGU) Mode Register +#define AT91C_DBGU_IMR (0xFFFFF210) // (DBGU) Interrupt Mask Register +#define AT91C_DBGU_CR (0xFFFFF200) // (DBGU) Control Register +#define AT91C_DBGU_FNTR (0xFFFFF248) // (DBGU) Force NTRST Register +#define AT91C_DBGU_THR (0xFFFFF21C) // (DBGU) Transmitter Holding Register +#define AT91C_DBGU_RHR (0xFFFFF218) // (DBGU) Receiver Holding Register +#define AT91C_DBGU_IER (0xFFFFF208) // (DBGU) Interrupt Enable Register +// ========== Register definition for PIOA peripheral ========== +#define AT91C_PIOA_ODR (0xFFFFF414) // (PIOA) Output Disable Registerr +#define AT91C_PIOA_SODR (0xFFFFF430) // (PIOA) Set Output Data Register +#define AT91C_PIOA_ISR (0xFFFFF44C) // (PIOA) Interrupt Status Register +#define AT91C_PIOA_ABSR (0xFFFFF478) // (PIOA) AB Select Status Register +#define AT91C_PIOA_IER (0xFFFFF440) // (PIOA) Interrupt Enable Register +#define AT91C_PIOA_PPUDR (0xFFFFF460) // (PIOA) Pull-up Disable Register +#define AT91C_PIOA_IMR (0xFFFFF448) // (PIOA) Interrupt Mask Register +#define AT91C_PIOA_PER (0xFFFFF400) // (PIOA) PIO Enable Register +#define AT91C_PIOA_IFDR (0xFFFFF424) // (PIOA) Input Filter Disable Register +#define AT91C_PIOA_OWDR (0xFFFFF4A4) // (PIOA) Output Write Disable Register +#define AT91C_PIOA_MDSR (0xFFFFF458) // (PIOA) Multi-driver Status Register +#define AT91C_PIOA_IDR (0xFFFFF444) // (PIOA) Interrupt Disable Register +#define AT91C_PIOA_ODSR (0xFFFFF438) // (PIOA) Output Data Status Register +#define AT91C_PIOA_PPUSR (0xFFFFF468) // (PIOA) Pull-up Status Register +#define AT91C_PIOA_OWSR (0xFFFFF4A8) // (PIOA) Output Write Status Register +#define AT91C_PIOA_BSR (0xFFFFF474) // (PIOA) Select B Register +#define AT91C_PIOA_OWER (0xFFFFF4A0) // (PIOA) Output Write Enable Register +#define AT91C_PIOA_IFER (0xFFFFF420) // (PIOA) Input Filter Enable Register +#define AT91C_PIOA_PDSR (0xFFFFF43C) // (PIOA) Pin Data Status Register +#define AT91C_PIOA_PPUER (0xFFFFF464) // (PIOA) Pull-up Enable Register +#define AT91C_PIOA_OSR (0xFFFFF418) // (PIOA) Output Status Register +#define AT91C_PIOA_ASR (0xFFFFF470) // (PIOA) Select A Register +#define AT91C_PIOA_MDDR (0xFFFFF454) // (PIOA) Multi-driver Disable Register +#define AT91C_PIOA_CODR (0xFFFFF434) // (PIOA) Clear Output Data Register +#define AT91C_PIOA_MDER (0xFFFFF450) // (PIOA) Multi-driver Enable Register +#define AT91C_PIOA_PDR (0xFFFFF404) // (PIOA) PIO Disable Register +#define AT91C_PIOA_IFSR (0xFFFFF428) // (PIOA) Input Filter Status Register +#define AT91C_PIOA_OER (0xFFFFF410) // (PIOA) Output Enable Register +#define AT91C_PIOA_PSR (0xFFFFF408) // (PIOA) PIO Status Register +// ========== Register definition for PIOB peripheral ========== +#define AT91C_PIOB_OWDR (0xFFFFF6A4) // (PIOB) Output Write Disable Register +#define AT91C_PIOB_MDER (0xFFFFF650) // (PIOB) Multi-driver Enable Register +#define AT91C_PIOB_PPUSR (0xFFFFF668) // (PIOB) Pull-up Status Register +#define AT91C_PIOB_IMR (0xFFFFF648) // (PIOB) Interrupt Mask Register +#define AT91C_PIOB_ASR (0xFFFFF670) // (PIOB) Select A Register +#define AT91C_PIOB_PPUDR (0xFFFFF660) // (PIOB) Pull-up Disable Register +#define AT91C_PIOB_PSR (0xFFFFF608) // (PIOB) PIO Status Register +#define AT91C_PIOB_IER (0xFFFFF640) // (PIOB) Interrupt Enable Register +#define AT91C_PIOB_CODR (0xFFFFF634) // (PIOB) Clear Output Data Register +#define AT91C_PIOB_OWER (0xFFFFF6A0) // (PIOB) Output Write Enable Register +#define AT91C_PIOB_ABSR (0xFFFFF678) // (PIOB) AB Select Status Register +#define AT91C_PIOB_IFDR (0xFFFFF624) // (PIOB) Input Filter Disable Register +#define AT91C_PIOB_PDSR (0xFFFFF63C) // (PIOB) Pin Data Status Register +#define AT91C_PIOB_IDR (0xFFFFF644) // (PIOB) Interrupt Disable Register +#define AT91C_PIOB_OWSR (0xFFFFF6A8) // (PIOB) Output Write Status Register +#define AT91C_PIOB_PDR (0xFFFFF604) // (PIOB) PIO Disable Register +#define AT91C_PIOB_ODR (0xFFFFF614) // (PIOB) Output Disable Registerr +#define AT91C_PIOB_IFSR (0xFFFFF628) // (PIOB) Input Filter Status Register +#define AT91C_PIOB_PPUER (0xFFFFF664) // (PIOB) Pull-up Enable Register +#define AT91C_PIOB_SODR (0xFFFFF630) // (PIOB) Set Output Data Register +#define AT91C_PIOB_ISR (0xFFFFF64C) // (PIOB) Interrupt Status Register +#define AT91C_PIOB_ODSR (0xFFFFF638) // (PIOB) Output Data Status Register +#define AT91C_PIOB_OSR (0xFFFFF618) // (PIOB) Output Status Register +#define AT91C_PIOB_MDSR (0xFFFFF658) // (PIOB) Multi-driver Status Register +#define AT91C_PIOB_IFER (0xFFFFF620) // (PIOB) Input Filter Enable Register +#define AT91C_PIOB_BSR (0xFFFFF674) // (PIOB) Select B Register +#define AT91C_PIOB_MDDR (0xFFFFF654) // (PIOB) Multi-driver Disable Register +#define AT91C_PIOB_OER (0xFFFFF610) // (PIOB) Output Enable Register +#define AT91C_PIOB_PER (0xFFFFF600) // (PIOB) PIO Enable Register +// ========== Register definition for CKGR peripheral ========== +#define AT91C_CKGR_MOR (0xFFFFFC20) // (CKGR) Main Oscillator Register +#define AT91C_CKGR_PLLR (0xFFFFFC2C) // (CKGR) PLL Register +#define AT91C_CKGR_MCFR (0xFFFFFC24) // (CKGR) Main Clock Frequency Register +// ========== Register definition for PMC peripheral ========== +#define AT91C_PMC_IDR (0xFFFFFC64) // (PMC) Interrupt Disable Register +#define AT91C_PMC_MOR (0xFFFFFC20) // (PMC) Main Oscillator Register +#define AT91C_PMC_PLLR (0xFFFFFC2C) // (PMC) PLL Register +#define AT91C_PMC_PCER (0xFFFFFC10) // (PMC) Peripheral Clock Enable Register +#define AT91C_PMC_PCKR (0xFFFFFC40) // (PMC) Programmable Clock Register +#define AT91C_PMC_MCKR (0xFFFFFC30) // (PMC) Master Clock Register +#define AT91C_PMC_SCDR (0xFFFFFC04) // (PMC) System Clock Disable Register +#define AT91C_PMC_PCDR (0xFFFFFC14) // (PMC) Peripheral Clock Disable Register +#define AT91C_PMC_SCSR (0xFFFFFC08) // (PMC) System Clock Status Register +#define AT91C_PMC_PCSR (0xFFFFFC18) // (PMC) Peripheral Clock Status Register +#define AT91C_PMC_MCFR (0xFFFFFC24) // (PMC) Main Clock Frequency Register +#define AT91C_PMC_SCER (0xFFFFFC00) // (PMC) System Clock Enable Register +#define AT91C_PMC_IMR (0xFFFFFC6C) // (PMC) Interrupt Mask Register +#define AT91C_PMC_IER (0xFFFFFC60) // (PMC) Interrupt Enable Register +#define AT91C_PMC_SR (0xFFFFFC68) // (PMC) Status Register +// ========== Register definition for RSTC peripheral ========== +#define AT91C_RSTC_RCR (0xFFFFFD00) // (RSTC) Reset Control Register +#define AT91C_RSTC_RMR (0xFFFFFD08) // (RSTC) Reset Mode Register +#define AT91C_RSTC_RSR (0xFFFFFD04) // (RSTC) Reset Status Register +// ========== Register definition for RTTC peripheral ========== +#define AT91C_RTTC_RTSR (0xFFFFFD2C) // (RTTC) Real-time Status Register +#define AT91C_RTTC_RTMR (0xFFFFFD20) // (RTTC) Real-time Mode Register +#define AT91C_RTTC_RTVR (0xFFFFFD28) // (RTTC) Real-time Value Register +#define AT91C_RTTC_RTAR (0xFFFFFD24) // (RTTC) Real-time Alarm Register +// ========== Register definition for PITC peripheral ========== +#define AT91C_PITC_PIVR (0xFFFFFD38) // (PITC) Period Interval Value Register +#define AT91C_PITC_PISR (0xFFFFFD34) // (PITC) Period Interval Status Register +#define AT91C_PITC_PIIR (0xFFFFFD3C) // (PITC) Period Interval Image Register +#define AT91C_PITC_PIMR (0xFFFFFD30) // (PITC) Period Interval Mode Register +// ========== Register definition for WDTC peripheral ========== +#define AT91C_WDTC_WDCR (0xFFFFFD40) // (WDTC) Watchdog Control Register +#define AT91C_WDTC_WDSR (0xFFFFFD48) // (WDTC) Watchdog Status Register +#define AT91C_WDTC_WDMR (0xFFFFFD44) // (WDTC) Watchdog Mode Register +// ========== Register definition for VREG peripheral ========== +#define AT91C_VREG_MR (0xFFFFFD60) // (VREG) Voltage Regulator Mode Register +// ========== Register definition for MC peripheral ========== +#define AT91C_MC_ASR (0xFFFFFF04) // (MC) MC Abort Status Register +#define AT91C_MC_RCR (0xFFFFFF00) // (MC) MC Remap Control Register +#define AT91C_MC_FCR (0xFFFFFF64) // (MC) MC Flash Command Register +#define AT91C_MC_AASR (0xFFFFFF08) // (MC) MC Abort Address Status Register +#define AT91C_MC_FSR (0xFFFFFF68) // (MC) MC Flash Status Register +#define AT91C_MC_FMR (0xFFFFFF60) // (MC) MC Flash Mode Register +// ========== Register definition for PDC_SPI1 peripheral ========== +#define AT91C_SPI1_PTCR (0xFFFE4120) // (PDC_SPI1) PDC Transfer Control Register +#define AT91C_SPI1_RPR (0xFFFE4100) // (PDC_SPI1) Receive Pointer Register +#define AT91C_SPI1_TNCR (0xFFFE411C) // (PDC_SPI1) Transmit Next Counter Register +#define AT91C_SPI1_TPR (0xFFFE4108) // (PDC_SPI1) Transmit Pointer Register +#define AT91C_SPI1_TNPR (0xFFFE4118) // (PDC_SPI1) Transmit Next Pointer Register +#define AT91C_SPI1_TCR (0xFFFE410C) // (PDC_SPI1) Transmit Counter Register +#define AT91C_SPI1_RCR (0xFFFE4104) // (PDC_SPI1) Receive Counter Register +#define AT91C_SPI1_RNPR (0xFFFE4110) // (PDC_SPI1) Receive Next Pointer Register +#define AT91C_SPI1_RNCR (0xFFFE4114) // (PDC_SPI1) Receive Next Counter Register +#define AT91C_SPI1_PTSR (0xFFFE4124) // (PDC_SPI1) PDC Transfer Status Register +// ========== Register definition for SPI1 peripheral ========== +#define AT91C_SPI1_IMR (0xFFFE401C) // (SPI1) Interrupt Mask Register +#define AT91C_SPI1_IER (0xFFFE4014) // (SPI1) Interrupt Enable Register +#define AT91C_SPI1_MR (0xFFFE4004) // (SPI1) Mode Register +#define AT91C_SPI1_RDR (0xFFFE4008) // (SPI1) Receive Data Register +#define AT91C_SPI1_IDR (0xFFFE4018) // (SPI1) Interrupt Disable Register +#define AT91C_SPI1_SR (0xFFFE4010) // (SPI1) Status Register +#define AT91C_SPI1_TDR (0xFFFE400C) // (SPI1) Transmit Data Register +#define AT91C_SPI1_CR (0xFFFE4000) // (SPI1) Control Register +#define AT91C_SPI1_CSR (0xFFFE4030) // (SPI1) Chip Select Register +// ========== Register definition for PDC_SPI0 peripheral ========== +#define AT91C_SPI0_PTCR (0xFFFE0120) // (PDC_SPI0) PDC Transfer Control Register +#define AT91C_SPI0_TPR (0xFFFE0108) // (PDC_SPI0) Transmit Pointer Register +#define AT91C_SPI0_TCR (0xFFFE010C) // (PDC_SPI0) Transmit Counter Register +#define AT91C_SPI0_RCR (0xFFFE0104) // (PDC_SPI0) Receive Counter Register +#define AT91C_SPI0_PTSR (0xFFFE0124) // (PDC_SPI0) PDC Transfer Status Register +#define AT91C_SPI0_RNPR (0xFFFE0110) // (PDC_SPI0) Receive Next Pointer Register +#define AT91C_SPI0_RPR (0xFFFE0100) // (PDC_SPI0) Receive Pointer Register +#define AT91C_SPI0_TNCR (0xFFFE011C) // (PDC_SPI0) Transmit Next Counter Register +#define AT91C_SPI0_RNCR (0xFFFE0114) // (PDC_SPI0) Receive Next Counter Register +#define AT91C_SPI0_TNPR (0xFFFE0118) // (PDC_SPI0) Transmit Next Pointer Register +// ========== Register definition for SPI0 peripheral ========== +#define AT91C_SPI0_IER (0xFFFE0014) // (SPI0) Interrupt Enable Register +#define AT91C_SPI0_SR (0xFFFE0010) // (SPI0) Status Register +#define AT91C_SPI0_IDR (0xFFFE0018) // (SPI0) Interrupt Disable Register +#define AT91C_SPI0_CR (0xFFFE0000) // (SPI0) Control Register +#define AT91C_SPI0_MR (0xFFFE0004) // (SPI0) Mode Register +#define AT91C_SPI0_IMR (0xFFFE001C) // (SPI0) Interrupt Mask Register +#define AT91C_SPI0_TDR (0xFFFE000C) // (SPI0) Transmit Data Register +#define AT91C_SPI0_RDR (0xFFFE0008) // (SPI0) Receive Data Register +#define AT91C_SPI0_CSR (0xFFFE0030) // (SPI0) Chip Select Register +// ========== Register definition for PDC_US1 peripheral ========== +#define AT91C_US1_RNCR (0xFFFC4114) // (PDC_US1) Receive Next Counter Register +#define AT91C_US1_PTCR (0xFFFC4120) // (PDC_US1) PDC Transfer Control Register +#define AT91C_US1_TCR (0xFFFC410C) // (PDC_US1) Transmit Counter Register +#define AT91C_US1_PTSR (0xFFFC4124) // (PDC_US1) PDC Transfer Status Register +#define AT91C_US1_TNPR (0xFFFC4118) // (PDC_US1) Transmit Next Pointer Register +#define AT91C_US1_RCR (0xFFFC4104) // (PDC_US1) Receive Counter Register +#define AT91C_US1_RNPR (0xFFFC4110) // (PDC_US1) Receive Next Pointer Register +#define AT91C_US1_RPR (0xFFFC4100) // (PDC_US1) Receive Pointer Register +#define AT91C_US1_TNCR (0xFFFC411C) // (PDC_US1) Transmit Next Counter Register +#define AT91C_US1_TPR (0xFFFC4108) // (PDC_US1) Transmit Pointer Register +// ========== Register definition for US1 peripheral ========== +#define AT91C_US1_IF (0xFFFC404C) // (US1) IRDA_FILTER Register +#define AT91C_US1_NER (0xFFFC4044) // (US1) Nb Errors Register +#define AT91C_US1_RTOR (0xFFFC4024) // (US1) Receiver Time-out Register +#define AT91C_US1_CSR (0xFFFC4014) // (US1) Channel Status Register +#define AT91C_US1_IDR (0xFFFC400C) // (US1) Interrupt Disable Register +#define AT91C_US1_IER (0xFFFC4008) // (US1) Interrupt Enable Register +#define AT91C_US1_THR (0xFFFC401C) // (US1) Transmitter Holding Register +#define AT91C_US1_TTGR (0xFFFC4028) // (US1) Transmitter Time-guard Register +#define AT91C_US1_RHR (0xFFFC4018) // (US1) Receiver Holding Register +#define AT91C_US1_BRGR (0xFFFC4020) // (US1) Baud Rate Generator Register +#define AT91C_US1_IMR (0xFFFC4010) // (US1) Interrupt Mask Register +#define AT91C_US1_FIDI (0xFFFC4040) // (US1) FI_DI_Ratio Register +#define AT91C_US1_CR (0xFFFC4000) // (US1) Control Register +#define AT91C_US1_MR (0xFFFC4004) // (US1) Mode Register +// ========== Register definition for PDC_US0 peripheral ========== +#define AT91C_US0_TNPR (0xFFFC0118) // (PDC_US0) Transmit Next Pointer Register +#define AT91C_US0_RNPR (0xFFFC0110) // (PDC_US0) Receive Next Pointer Register +#define AT91C_US0_TCR (0xFFFC010C) // (PDC_US0) Transmit Counter Register +#define AT91C_US0_PTCR (0xFFFC0120) // (PDC_US0) PDC Transfer Control Register +#define AT91C_US0_PTSR (0xFFFC0124) // (PDC_US0) PDC Transfer Status Register +#define AT91C_US0_TNCR (0xFFFC011C) // (PDC_US0) Transmit Next Counter Register +#define AT91C_US0_TPR (0xFFFC0108) // (PDC_US0) Transmit Pointer Register +#define AT91C_US0_RCR (0xFFFC0104) // (PDC_US0) Receive Counter Register +#define AT91C_US0_RPR (0xFFFC0100) // (PDC_US0) Receive Pointer Register +#define AT91C_US0_RNCR (0xFFFC0114) // (PDC_US0) Receive Next Counter Register +// ========== Register definition for US0 peripheral ========== +#define AT91C_US0_BRGR (0xFFFC0020) // (US0) Baud Rate Generator Register +#define AT91C_US0_NER (0xFFFC0044) // (US0) Nb Errors Register +#define AT91C_US0_CR (0xFFFC0000) // (US0) Control Register +#define AT91C_US0_IMR (0xFFFC0010) // (US0) Interrupt Mask Register +#define AT91C_US0_FIDI (0xFFFC0040) // (US0) FI_DI_Ratio Register +#define AT91C_US0_TTGR (0xFFFC0028) // (US0) Transmitter Time-guard Register +#define AT91C_US0_MR (0xFFFC0004) // (US0) Mode Register +#define AT91C_US0_RTOR (0xFFFC0024) // (US0) Receiver Time-out Register +#define AT91C_US0_CSR (0xFFFC0014) // (US0) Channel Status Register +#define AT91C_US0_RHR (0xFFFC0018) // (US0) Receiver Holding Register +#define AT91C_US0_IDR (0xFFFC000C) // (US0) Interrupt Disable Register +#define AT91C_US0_THR (0xFFFC001C) // (US0) Transmitter Holding Register +#define AT91C_US0_IF (0xFFFC004C) // (US0) IRDA_FILTER Register +#define AT91C_US0_IER (0xFFFC0008) // (US0) Interrupt Enable Register +// ========== Register definition for PDC_SSC peripheral ========== +#define AT91C_SSC_TNCR (0xFFFD411C) // (PDC_SSC) Transmit Next Counter Register +#define AT91C_SSC_RPR (0xFFFD4100) // (PDC_SSC) Receive Pointer Register +#define AT91C_SSC_RNCR (0xFFFD4114) // (PDC_SSC) Receive Next Counter Register +#define AT91C_SSC_TPR (0xFFFD4108) // (PDC_SSC) Transmit Pointer Register +#define AT91C_SSC_PTCR (0xFFFD4120) // (PDC_SSC) PDC Transfer Control Register +#define AT91C_SSC_TCR (0xFFFD410C) // (PDC_SSC) Transmit Counter Register +#define AT91C_SSC_RCR (0xFFFD4104) // (PDC_SSC) Receive Counter Register +#define AT91C_SSC_RNPR (0xFFFD4110) // (PDC_SSC) Receive Next Pointer Register +#define AT91C_SSC_TNPR (0xFFFD4118) // (PDC_SSC) Transmit Next Pointer Register +#define AT91C_SSC_PTSR (0xFFFD4124) // (PDC_SSC) PDC Transfer Status Register +// ========== Register definition for SSC peripheral ========== +#define AT91C_SSC_RHR (0xFFFD4020) // (SSC) Receive Holding Register +#define AT91C_SSC_RSHR (0xFFFD4030) // (SSC) Receive Sync Holding Register +#define AT91C_SSC_TFMR (0xFFFD401C) // (SSC) Transmit Frame Mode Register +#define AT91C_SSC_IDR (0xFFFD4048) // (SSC) Interrupt Disable Register +#define AT91C_SSC_THR (0xFFFD4024) // (SSC) Transmit Holding Register +#define AT91C_SSC_RCMR (0xFFFD4010) // (SSC) Receive Clock ModeRegister +#define AT91C_SSC_IER (0xFFFD4044) // (SSC) Interrupt Enable Register +#define AT91C_SSC_TSHR (0xFFFD4034) // (SSC) Transmit Sync Holding Register +#define AT91C_SSC_SR (0xFFFD4040) // (SSC) Status Register +#define AT91C_SSC_CMR (0xFFFD4004) // (SSC) Clock Mode Register +#define AT91C_SSC_TCMR (0xFFFD4018) // (SSC) Transmit Clock Mode Register +#define AT91C_SSC_CR (0xFFFD4000) // (SSC) Control Register +#define AT91C_SSC_IMR (0xFFFD404C) // (SSC) Interrupt Mask Register +#define AT91C_SSC_RFMR (0xFFFD4014) // (SSC) Receive Frame Mode Register +// ========== Register definition for TWI peripheral ========== +#define AT91C_TWI_IER (0xFFFB8024) // (TWI) Interrupt Enable Register +#define AT91C_TWI_CR (0xFFFB8000) // (TWI) Control Register +#define AT91C_TWI_SR (0xFFFB8020) // (TWI) Status Register +#define AT91C_TWI_IMR (0xFFFB802C) // (TWI) Interrupt Mask Register +#define AT91C_TWI_THR (0xFFFB8034) // (TWI) Transmit Holding Register +#define AT91C_TWI_IDR (0xFFFB8028) // (TWI) Interrupt Disable Register +#define AT91C_TWI_IADR (0xFFFB800C) // (TWI) Internal Address Register +#define AT91C_TWI_MMR (0xFFFB8004) // (TWI) Master Mode Register +#define AT91C_TWI_CWGR (0xFFFB8010) // (TWI) Clock Waveform Generator Register +#define AT91C_TWI_RHR (0xFFFB8030) // (TWI) Receive Holding Register +// ========== Register definition for PWMC_CH3 peripheral ========== +#define AT91C_PWMC_CH3_CUPDR (0xFFFCC270) // (PWMC_CH3) Channel Update Register +#define AT91C_PWMC_CH3_Reserved (0xFFFCC274) // (PWMC_CH3) Reserved +#define AT91C_PWMC_CH3_CPRDR (0xFFFCC268) // (PWMC_CH3) Channel Period Register +#define AT91C_PWMC_CH3_CDTYR (0xFFFCC264) // (PWMC_CH3) Channel Duty Cycle Register +#define AT91C_PWMC_CH3_CCNTR (0xFFFCC26C) // (PWMC_CH3) Channel Counter Register +#define AT91C_PWMC_CH3_CMR (0xFFFCC260) // (PWMC_CH3) Channel Mode Register +// ========== Register definition for PWMC_CH2 peripheral ========== +#define AT91C_PWMC_CH2_Reserved (0xFFFCC254) // (PWMC_CH2) Reserved +#define AT91C_PWMC_CH2_CMR (0xFFFCC240) // (PWMC_CH2) Channel Mode Register +#define AT91C_PWMC_CH2_CCNTR (0xFFFCC24C) // (PWMC_CH2) Channel Counter Register +#define AT91C_PWMC_CH2_CPRDR (0xFFFCC248) // (PWMC_CH2) Channel Period Register +#define AT91C_PWMC_CH2_CUPDR (0xFFFCC250) // (PWMC_CH2) Channel Update Register +#define AT91C_PWMC_CH2_CDTYR (0xFFFCC244) // (PWMC_CH2) Channel Duty Cycle Register +// ========== Register definition for PWMC_CH1 peripheral ========== +#define AT91C_PWMC_CH1_Reserved (0xFFFCC234) // (PWMC_CH1) Reserved +#define AT91C_PWMC_CH1_CUPDR (0xFFFCC230) // (PWMC_CH1) Channel Update Register +#define AT91C_PWMC_CH1_CPRDR (0xFFFCC228) // (PWMC_CH1) Channel Period Register +#define AT91C_PWMC_CH1_CCNTR (0xFFFCC22C) // (PWMC_CH1) Channel Counter Register +#define AT91C_PWMC_CH1_CDTYR (0xFFFCC224) // (PWMC_CH1) Channel Duty Cycle Register +#define AT91C_PWMC_CH1_CMR (0xFFFCC220) // (PWMC_CH1) Channel Mode Register +// ========== Register definition for PWMC_CH0 peripheral ========== +#define AT91C_PWMC_CH0_Reserved (0xFFFCC214) // (PWMC_CH0) Reserved +#define AT91C_PWMC_CH0_CPRDR (0xFFFCC208) // (PWMC_CH0) Channel Period Register +#define AT91C_PWMC_CH0_CDTYR (0xFFFCC204) // (PWMC_CH0) Channel Duty Cycle Register +#define AT91C_PWMC_CH0_CMR (0xFFFCC200) // (PWMC_CH0) Channel Mode Register +#define AT91C_PWMC_CH0_CUPDR (0xFFFCC210) // (PWMC_CH0) Channel Update Register +#define AT91C_PWMC_CH0_CCNTR (0xFFFCC20C) // (PWMC_CH0) Channel Counter Register +// ========== Register definition for PWMC peripheral ========== +#define AT91C_PWMC_IDR (0xFFFCC014) // (PWMC) PWMC Interrupt Disable Register +#define AT91C_PWMC_DIS (0xFFFCC008) // (PWMC) PWMC Disable Register +#define AT91C_PWMC_IER (0xFFFCC010) // (PWMC) PWMC Interrupt Enable Register +#define AT91C_PWMC_VR (0xFFFCC0FC) // (PWMC) PWMC Version Register +#define AT91C_PWMC_ISR (0xFFFCC01C) // (PWMC) PWMC Interrupt Status Register +#define AT91C_PWMC_SR (0xFFFCC00C) // (PWMC) PWMC Status Register +#define AT91C_PWMC_IMR (0xFFFCC018) // (PWMC) PWMC Interrupt Mask Register +#define AT91C_PWMC_MR (0xFFFCC000) // (PWMC) PWMC Mode Register +#define AT91C_PWMC_ENA (0xFFFCC004) // (PWMC) PWMC Enable Register +// ========== Register definition for UDP peripheral ========== +#define AT91C_UDP_IMR (0xFFFB0018) // (UDP) Interrupt Mask Register +#define AT91C_UDP_FADDR (0xFFFB0008) // (UDP) Function Address Register +#define AT91C_UDP_NUM (0xFFFB0000) // (UDP) Frame Number Register +#define AT91C_UDP_FDR (0xFFFB0050) // (UDP) Endpoint FIFO Data Register +#define AT91C_UDP_ISR (0xFFFB001C) // (UDP) Interrupt Status Register +#define AT91C_UDP_CSR (0xFFFB0030) // (UDP) Endpoint Control and Status Register +#define AT91C_UDP_IDR (0xFFFB0014) // (UDP) Interrupt Disable Register +#define AT91C_UDP_ICR (0xFFFB0020) // (UDP) Interrupt Clear Register +#define AT91C_UDP_RSTEP (0xFFFB0028) // (UDP) Reset Endpoint Register +#define AT91C_UDP_TXVC (0xFFFB0074) // (UDP) Transceiver Control Register +#define AT91C_UDP_GLBSTATE (0xFFFB0004) // (UDP) Global State Register +#define AT91C_UDP_IER (0xFFFB0010) // (UDP) Interrupt Enable Register +// ========== Register definition for TC0 peripheral ========== +#define AT91C_TC0_SR (0xFFFA0020) // (TC0) Status Register +#define AT91C_TC0_RC (0xFFFA001C) // (TC0) Register C +#define AT91C_TC0_RB (0xFFFA0018) // (TC0) Register B +#define AT91C_TC0_CCR (0xFFFA0000) // (TC0) Channel Control Register +#define AT91C_TC0_CMR (0xFFFA0004) // (TC0) Channel Mode Register (Capture Mode / Waveform Mode) +#define AT91C_TC0_IER (0xFFFA0024) // (TC0) Interrupt Enable Register +#define AT91C_TC0_RA (0xFFFA0014) // (TC0) Register A +#define AT91C_TC0_IDR (0xFFFA0028) // (TC0) Interrupt Disable Register +#define AT91C_TC0_CV (0xFFFA0010) // (TC0) Counter Value +#define AT91C_TC0_IMR (0xFFFA002C) // (TC0) Interrupt Mask Register +// ========== Register definition for TC1 peripheral ========== +#define AT91C_TC1_RB (0xFFFA0058) // (TC1) Register B +#define AT91C_TC1_CCR (0xFFFA0040) // (TC1) Channel Control Register +#define AT91C_TC1_IER (0xFFFA0064) // (TC1) Interrupt Enable Register +#define AT91C_TC1_IDR (0xFFFA0068) // (TC1) Interrupt Disable Register +#define AT91C_TC1_SR (0xFFFA0060) // (TC1) Status Register +#define AT91C_TC1_CMR (0xFFFA0044) // (TC1) Channel Mode Register (Capture Mode / Waveform Mode) +#define AT91C_TC1_RA (0xFFFA0054) // (TC1) Register A +#define AT91C_TC1_RC (0xFFFA005C) // (TC1) Register C +#define AT91C_TC1_IMR (0xFFFA006C) // (TC1) Interrupt Mask Register +#define AT91C_TC1_CV (0xFFFA0050) // (TC1) Counter Value +// ========== Register definition for TC2 peripheral ========== +#define AT91C_TC2_CMR (0xFFFA0084) // (TC2) Channel Mode Register (Capture Mode / Waveform Mode) +#define AT91C_TC2_CCR (0xFFFA0080) // (TC2) Channel Control Register +#define AT91C_TC2_CV (0xFFFA0090) // (TC2) Counter Value +#define AT91C_TC2_RA (0xFFFA0094) // (TC2) Register A +#define AT91C_TC2_RB (0xFFFA0098) // (TC2) Register B +#define AT91C_TC2_IDR (0xFFFA00A8) // (TC2) Interrupt Disable Register +#define AT91C_TC2_IMR (0xFFFA00AC) // (TC2) Interrupt Mask Register +#define AT91C_TC2_RC (0xFFFA009C) // (TC2) Register C +#define AT91C_TC2_IER (0xFFFA00A4) // (TC2) Interrupt Enable Register +#define AT91C_TC2_SR (0xFFFA00A0) // (TC2) Status Register +// ========== Register definition for TCB peripheral ========== +#define AT91C_TCB_BMR (0xFFFA00C4) // (TCB) TC Block Mode Register +#define AT91C_TCB_BCR (0xFFFA00C0) // (TCB) TC Block Control Register +// ========== Register definition for CAN_MB0 peripheral ========== +#define AT91C_CAN_MB0_MDL (0xFFFD0214) // (CAN_MB0) MailBox Data Low Register +#define AT91C_CAN_MB0_MAM (0xFFFD0204) // (CAN_MB0) MailBox Acceptance Mask Register +#define AT91C_CAN_MB0_MCR (0xFFFD021C) // (CAN_MB0) MailBox Control Register +#define AT91C_CAN_MB0_MID (0xFFFD0208) // (CAN_MB0) MailBox ID Register +#define AT91C_CAN_MB0_MSR (0xFFFD0210) // (CAN_MB0) MailBox Status Register +#define AT91C_CAN_MB0_MFID (0xFFFD020C) // (CAN_MB0) MailBox Family ID Register +#define AT91C_CAN_MB0_MDH (0xFFFD0218) // (CAN_MB0) MailBox Data High Register +#define AT91C_CAN_MB0_MMR (0xFFFD0200) // (CAN_MB0) MailBox Mode Register +// ========== Register definition for CAN_MB1 peripheral ========== +#define AT91C_CAN_MB1_MDL (0xFFFD0234) // (CAN_MB1) MailBox Data Low Register +#define AT91C_CAN_MB1_MID (0xFFFD0228) // (CAN_MB1) MailBox ID Register +#define AT91C_CAN_MB1_MMR (0xFFFD0220) // (CAN_MB1) MailBox Mode Register +#define AT91C_CAN_MB1_MSR (0xFFFD0230) // (CAN_MB1) MailBox Status Register +#define AT91C_CAN_MB1_MAM (0xFFFD0224) // (CAN_MB1) MailBox Acceptance Mask Register +#define AT91C_CAN_MB1_MDH (0xFFFD0238) // (CAN_MB1) MailBox Data High Register +#define AT91C_CAN_MB1_MCR (0xFFFD023C) // (CAN_MB1) MailBox Control Register +#define AT91C_CAN_MB1_MFID (0xFFFD022C) // (CAN_MB1) MailBox Family ID Register +// ========== Register definition for CAN_MB2 peripheral ========== +#define AT91C_CAN_MB2_MCR (0xFFFD025C) // (CAN_MB2) MailBox Control Register +#define AT91C_CAN_MB2_MDH (0xFFFD0258) // (CAN_MB2) MailBox Data High Register +#define AT91C_CAN_MB2_MID (0xFFFD0248) // (CAN_MB2) MailBox ID Register +#define AT91C_CAN_MB2_MDL (0xFFFD0254) // (CAN_MB2) MailBox Data Low Register +#define AT91C_CAN_MB2_MMR (0xFFFD0240) // (CAN_MB2) MailBox Mode Register +#define AT91C_CAN_MB2_MAM (0xFFFD0244) // (CAN_MB2) MailBox Acceptance Mask Register +#define AT91C_CAN_MB2_MFID (0xFFFD024C) // (CAN_MB2) MailBox Family ID Register +#define AT91C_CAN_MB2_MSR (0xFFFD0250) // (CAN_MB2) MailBox Status Register +// ========== Register definition for CAN_MB3 peripheral ========== +#define AT91C_CAN_MB3_MFID (0xFFFD026C) // (CAN_MB3) MailBox Family ID Register +#define AT91C_CAN_MB3_MAM (0xFFFD0264) // (CAN_MB3) MailBox Acceptance Mask Register +#define AT91C_CAN_MB3_MID (0xFFFD0268) // (CAN_MB3) MailBox ID Register +#define AT91C_CAN_MB3_MCR (0xFFFD027C) // (CAN_MB3) MailBox Control Register +#define AT91C_CAN_MB3_MMR (0xFFFD0260) // (CAN_MB3) MailBox Mode Register +#define AT91C_CAN_MB3_MSR (0xFFFD0270) // (CAN_MB3) MailBox Status Register +#define AT91C_CAN_MB3_MDL (0xFFFD0274) // (CAN_MB3) MailBox Data Low Register +#define AT91C_CAN_MB3_MDH (0xFFFD0278) // (CAN_MB3) MailBox Data High Register +// ========== Register definition for CAN_MB4 peripheral ========== +#define AT91C_CAN_MB4_MID (0xFFFD0288) // (CAN_MB4) MailBox ID Register +#define AT91C_CAN_MB4_MMR (0xFFFD0280) // (CAN_MB4) MailBox Mode Register +#define AT91C_CAN_MB4_MDH (0xFFFD0298) // (CAN_MB4) MailBox Data High Register +#define AT91C_CAN_MB4_MFID (0xFFFD028C) // (CAN_MB4) MailBox Family ID Register +#define AT91C_CAN_MB4_MSR (0xFFFD0290) // (CAN_MB4) MailBox Status Register +#define AT91C_CAN_MB4_MCR (0xFFFD029C) // (CAN_MB4) MailBox Control Register +#define AT91C_CAN_MB4_MDL (0xFFFD0294) // (CAN_MB4) MailBox Data Low Register +#define AT91C_CAN_MB4_MAM (0xFFFD0284) // (CAN_MB4) MailBox Acceptance Mask Register +// ========== Register definition for CAN_MB5 peripheral ========== +#define AT91C_CAN_MB5_MSR (0xFFFD02B0) // (CAN_MB5) MailBox Status Register +#define AT91C_CAN_MB5_MCR (0xFFFD02BC) // (CAN_MB5) MailBox Control Register +#define AT91C_CAN_MB5_MFID (0xFFFD02AC) // (CAN_MB5) MailBox Family ID Register +#define AT91C_CAN_MB5_MDH (0xFFFD02B8) // (CAN_MB5) MailBox Data High Register +#define AT91C_CAN_MB5_MID (0xFFFD02A8) // (CAN_MB5) MailBox ID Register +#define AT91C_CAN_MB5_MMR (0xFFFD02A0) // (CAN_MB5) MailBox Mode Register +#define AT91C_CAN_MB5_MDL (0xFFFD02B4) // (CAN_MB5) MailBox Data Low Register +#define AT91C_CAN_MB5_MAM (0xFFFD02A4) // (CAN_MB5) MailBox Acceptance Mask Register +// ========== Register definition for CAN_MB6 peripheral ========== +#define AT91C_CAN_MB6_MFID (0xFFFD02CC) // (CAN_MB6) MailBox Family ID Register +#define AT91C_CAN_MB6_MID (0xFFFD02C8) // (CAN_MB6) MailBox ID Register +#define AT91C_CAN_MB6_MAM (0xFFFD02C4) // (CAN_MB6) MailBox Acceptance Mask Register +#define AT91C_CAN_MB6_MSR (0xFFFD02D0) // (CAN_MB6) MailBox Status Register +#define AT91C_CAN_MB6_MDL (0xFFFD02D4) // (CAN_MB6) MailBox Data Low Register +#define AT91C_CAN_MB6_MCR (0xFFFD02DC) // (CAN_MB6) MailBox Control Register +#define AT91C_CAN_MB6_MDH (0xFFFD02D8) // (CAN_MB6) MailBox Data High Register +#define AT91C_CAN_MB6_MMR (0xFFFD02C0) // (CAN_MB6) MailBox Mode Register +// ========== Register definition for CAN_MB7 peripheral ========== +#define AT91C_CAN_MB7_MCR (0xFFFD02FC) // (CAN_MB7) MailBox Control Register +#define AT91C_CAN_MB7_MDH (0xFFFD02F8) // (CAN_MB7) MailBox Data High Register +#define AT91C_CAN_MB7_MFID (0xFFFD02EC) // (CAN_MB7) MailBox Family ID Register +#define AT91C_CAN_MB7_MDL (0xFFFD02F4) // (CAN_MB7) MailBox Data Low Register +#define AT91C_CAN_MB7_MID (0xFFFD02E8) // (CAN_MB7) MailBox ID Register +#define AT91C_CAN_MB7_MMR (0xFFFD02E0) // (CAN_MB7) MailBox Mode Register +#define AT91C_CAN_MB7_MAM (0xFFFD02E4) // (CAN_MB7) MailBox Acceptance Mask Register +#define AT91C_CAN_MB7_MSR (0xFFFD02F0) // (CAN_MB7) MailBox Status Register +// ========== Register definition for CAN peripheral ========== +#define AT91C_CAN_TCR (0xFFFD0024) // (CAN) Transfer Command Register +#define AT91C_CAN_IMR (0xFFFD000C) // (CAN) Interrupt Mask Register +#define AT91C_CAN_IER (0xFFFD0004) // (CAN) Interrupt Enable Register +#define AT91C_CAN_ECR (0xFFFD0020) // (CAN) Error Counter Register +#define AT91C_CAN_TIMESTP (0xFFFD001C) // (CAN) Time Stamp Register +#define AT91C_CAN_MR (0xFFFD0000) // (CAN) Mode Register +#define AT91C_CAN_IDR (0xFFFD0008) // (CAN) Interrupt Disable Register +#define AT91C_CAN_ACR (0xFFFD0028) // (CAN) Abort Command Register +#define AT91C_CAN_TIM (0xFFFD0018) // (CAN) Timer Register +#define AT91C_CAN_SR (0xFFFD0010) // (CAN) Status Register +#define AT91C_CAN_BR (0xFFFD0014) // (CAN) Baudrate Register +#define AT91C_CAN_VR (0xFFFD00FC) // (CAN) Version Register +// ========== Register definition for EMAC peripheral ========== +#define AT91C_EMAC_ISR (0xFFFDC024) // (EMAC) Interrupt Status Register +#define AT91C_EMAC_SA4H (0xFFFDC0B4) // (EMAC) Specific Address 4 Top, Last 2 bytes +#define AT91C_EMAC_SA1L (0xFFFDC098) // (EMAC) Specific Address 1 Bottom, First 4 bytes +#define AT91C_EMAC_ELE (0xFFFDC078) // (EMAC) Excessive Length Errors Register +#define AT91C_EMAC_LCOL (0xFFFDC05C) // (EMAC) Late Collision Register +#define AT91C_EMAC_RLE (0xFFFDC088) // (EMAC) Receive Length Field Mismatch Register +#define AT91C_EMAC_WOL (0xFFFDC0C4) // (EMAC) Wake On LAN Register +#define AT91C_EMAC_DTF (0xFFFDC058) // (EMAC) Deferred Transmission Frame Register +#define AT91C_EMAC_TUND (0xFFFDC064) // (EMAC) Transmit Underrun Error Register +#define AT91C_EMAC_NCR (0xFFFDC000) // (EMAC) Network Control Register +#define AT91C_EMAC_SA4L (0xFFFDC0B0) // (EMAC) Specific Address 4 Bottom, First 4 bytes +#define AT91C_EMAC_RSR (0xFFFDC020) // (EMAC) Receive Status Register +#define AT91C_EMAC_SA3L (0xFFFDC0A8) // (EMAC) Specific Address 3 Bottom, First 4 bytes +#define AT91C_EMAC_TSR (0xFFFDC014) // (EMAC) Transmit Status Register +#define AT91C_EMAC_IDR (0xFFFDC02C) // (EMAC) Interrupt Disable Register +#define AT91C_EMAC_RSE (0xFFFDC074) // (EMAC) Receive Symbol Errors Register +#define AT91C_EMAC_ECOL (0xFFFDC060) // (EMAC) Excessive Collision Register +#define AT91C_EMAC_TID (0xFFFDC0B8) // (EMAC) Type ID Checking Register +#define AT91C_EMAC_HRB (0xFFFDC090) // (EMAC) Hash Address Bottom[31:0] +#define AT91C_EMAC_TBQP (0xFFFDC01C) // (EMAC) Transmit Buffer Queue Pointer +#define AT91C_EMAC_USRIO (0xFFFDC0C0) // (EMAC) USER Input/Output Register +#define AT91C_EMAC_PTR (0xFFFDC038) // (EMAC) Pause Time Register +#define AT91C_EMAC_SA2H (0xFFFDC0A4) // (EMAC) Specific Address 2 Top, Last 2 bytes +#define AT91C_EMAC_ROV (0xFFFDC070) // (EMAC) Receive Overrun Errors Register +#define AT91C_EMAC_ALE (0xFFFDC054) // (EMAC) Alignment Error Register +#define AT91C_EMAC_RJA (0xFFFDC07C) // (EMAC) Receive Jabbers Register +#define AT91C_EMAC_RBQP (0xFFFDC018) // (EMAC) Receive Buffer Queue Pointer +#define AT91C_EMAC_TPF (0xFFFDC08C) // (EMAC) Transmitted Pause Frames Register +#define AT91C_EMAC_NCFGR (0xFFFDC004) // (EMAC) Network Configuration Register +#define AT91C_EMAC_HRT (0xFFFDC094) // (EMAC) Hash Address Top[63:32] +#define AT91C_EMAC_USF (0xFFFDC080) // (EMAC) Undersize Frames Register +#define AT91C_EMAC_FCSE (0xFFFDC050) // (EMAC) Frame Check Sequence Error Register +#define AT91C_EMAC_TPQ (0xFFFDC0BC) // (EMAC) Transmit Pause Quantum Register +#define AT91C_EMAC_MAN (0xFFFDC034) // (EMAC) PHY Maintenance Register +#define AT91C_EMAC_FTO (0xFFFDC040) // (EMAC) Frames Transmitted OK Register +#define AT91C_EMAC_REV (0xFFFDC0FC) // (EMAC) Revision Register +#define AT91C_EMAC_IMR (0xFFFDC030) // (EMAC) Interrupt Mask Register +#define AT91C_EMAC_SCF (0xFFFDC044) // (EMAC) Single Collision Frame Register +#define AT91C_EMAC_PFR (0xFFFDC03C) // (EMAC) Pause Frames received Register +#define AT91C_EMAC_MCF (0xFFFDC048) // (EMAC) Multiple Collision Frame Register +#define AT91C_EMAC_NSR (0xFFFDC008) // (EMAC) Network Status Register +#define AT91C_EMAC_SA2L (0xFFFDC0A0) // (EMAC) Specific Address 2 Bottom, First 4 bytes +#define AT91C_EMAC_FRO (0xFFFDC04C) // (EMAC) Frames Received OK Register +#define AT91C_EMAC_IER (0xFFFDC028) // (EMAC) Interrupt Enable Register +#define AT91C_EMAC_SA1H (0xFFFDC09C) // (EMAC) Specific Address 1 Top, Last 2 bytes +#define AT91C_EMAC_CSE (0xFFFDC068) // (EMAC) Carrier Sense Error Register +#define AT91C_EMAC_SA3H (0xFFFDC0AC) // (EMAC) Specific Address 3 Top, Last 2 bytes +#define AT91C_EMAC_RRE (0xFFFDC06C) // (EMAC) Receive Ressource Error Register +#define AT91C_EMAC_STE (0xFFFDC084) // (EMAC) SQE Test Error Register +// ========== Register definition for PDC_ADC peripheral ========== +#define AT91C_ADC_PTSR (0xFFFD8124) // (PDC_ADC) PDC Transfer Status Register +#define AT91C_ADC_PTCR (0xFFFD8120) // (PDC_ADC) PDC Transfer Control Register +#define AT91C_ADC_TNPR (0xFFFD8118) // (PDC_ADC) Transmit Next Pointer Register +#define AT91C_ADC_TNCR (0xFFFD811C) // (PDC_ADC) Transmit Next Counter Register +#define AT91C_ADC_RNPR (0xFFFD8110) // (PDC_ADC) Receive Next Pointer Register +#define AT91C_ADC_RNCR (0xFFFD8114) // (PDC_ADC) Receive Next Counter Register +#define AT91C_ADC_RPR (0xFFFD8100) // (PDC_ADC) Receive Pointer Register +#define AT91C_ADC_TCR (0xFFFD810C) // (PDC_ADC) Transmit Counter Register +#define AT91C_ADC_TPR (0xFFFD8108) // (PDC_ADC) Transmit Pointer Register +#define AT91C_ADC_RCR (0xFFFD8104) // (PDC_ADC) Receive Counter Register +// ========== Register definition for ADC peripheral ========== +#define AT91C_ADC_CDR2 (0xFFFD8038) // (ADC) ADC Channel Data Register 2 +#define AT91C_ADC_CDR3 (0xFFFD803C) // (ADC) ADC Channel Data Register 3 +#define AT91C_ADC_CDR0 (0xFFFD8030) // (ADC) ADC Channel Data Register 0 +#define AT91C_ADC_CDR5 (0xFFFD8044) // (ADC) ADC Channel Data Register 5 +#define AT91C_ADC_CHDR (0xFFFD8014) // (ADC) ADC Channel Disable Register +#define AT91C_ADC_SR (0xFFFD801C) // (ADC) ADC Status Register +#define AT91C_ADC_CDR4 (0xFFFD8040) // (ADC) ADC Channel Data Register 4 +#define AT91C_ADC_CDR1 (0xFFFD8034) // (ADC) ADC Channel Data Register 1 +#define AT91C_ADC_LCDR (0xFFFD8020) // (ADC) ADC Last Converted Data Register +#define AT91C_ADC_IDR (0xFFFD8028) // (ADC) ADC Interrupt Disable Register +#define AT91C_ADC_CR (0xFFFD8000) // (ADC) ADC Control Register +#define AT91C_ADC_CDR7 (0xFFFD804C) // (ADC) ADC Channel Data Register 7 +#define AT91C_ADC_CDR6 (0xFFFD8048) // (ADC) ADC Channel Data Register 6 +#define AT91C_ADC_IER (0xFFFD8024) // (ADC) ADC Interrupt Enable Register +#define AT91C_ADC_CHER (0xFFFD8010) // (ADC) ADC Channel Enable Register +#define AT91C_ADC_CHSR (0xFFFD8018) // (ADC) ADC Channel Status Register +#define AT91C_ADC_MR (0xFFFD8004) // (ADC) ADC Mode Register +#define AT91C_ADC_IMR (0xFFFD802C) // (ADC) ADC Interrupt Mask Register + +// ***************************************************************************** +// PIO DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** +#define AT91C_PIO_PA0 (1 << 0) // Pin Controlled by PA0 +#define AT91C_PA0_RXD0 (AT91C_PIO_PA0) // USART 0 Receive Data +#define AT91C_PIO_PA1 (1 << 1) // Pin Controlled by PA1 +#define AT91C_PA1_TXD0 (AT91C_PIO_PA1) // USART 0 Transmit Data +#define AT91C_PIO_PA10 (1 << 10) // Pin Controlled by PA10 +#define AT91C_PA10_TWD (AT91C_PIO_PA10) // TWI Two-wire Serial Data +#define AT91C_PIO_PA11 (1 << 11) // Pin Controlled by PA11 +#define AT91C_PA11_TWCK (AT91C_PIO_PA11) // TWI Two-wire Serial Clock +#define AT91C_PIO_PA12 (1 << 12) // Pin Controlled by PA12 +#define AT91C_PA12_SPI0_NPCS0 (AT91C_PIO_PA12) // SPI 0 Peripheral Chip Select 0 +#define AT91C_PIO_PA13 (1 << 13) // Pin Controlled by PA13 +#define AT91C_PA13_SPI0_NPCS1 (AT91C_PIO_PA13) // SPI 0 Peripheral Chip Select 1 +#define AT91C_PA13_PCK1 (AT91C_PIO_PA13) // PMC Programmable Clock Output 1 +#define AT91C_PIO_PA14 (1 << 14) // Pin Controlled by PA14 +#define AT91C_PA14_SPI0_NPCS2 (AT91C_PIO_PA14) // SPI 0 Peripheral Chip Select 2 +#define AT91C_PA14_IRQ1 (AT91C_PIO_PA14) // External Interrupt 1 +#define AT91C_PIO_PA15 (1 << 15) // Pin Controlled by PA15 +#define AT91C_PA15_SPI0_NPCS3 (AT91C_PIO_PA15) // SPI 0 Peripheral Chip Select 3 +#define AT91C_PA15_TCLK2 (AT91C_PIO_PA15) // Timer Counter 2 external clock input +#define AT91C_PIO_PA16 (1 << 16) // Pin Controlled by PA16 +#define AT91C_PA16_SPI0_MISO (AT91C_PIO_PA16) // SPI 0 Master In Slave +#define AT91C_PIO_PA17 (1 << 17) // Pin Controlled by PA17 +#define AT91C_PA17_SPI0_MOSI (AT91C_PIO_PA17) // SPI 0 Master Out Slave +#define AT91C_PIO_PA18 (1 << 18) // Pin Controlled by PA18 +#define AT91C_PA18_SPI0_SPCK (AT91C_PIO_PA18) // SPI 0 Serial Clock +#define AT91C_PIO_PA19 (1 << 19) // Pin Controlled by PA19 +#define AT91C_PA19_CANRX (AT91C_PIO_PA19) // CAN Receive +#define AT91C_PIO_PA2 (1 << 2) // Pin Controlled by PA2 +#define AT91C_PA2_SCK0 (AT91C_PIO_PA2) // USART 0 Serial Clock +#define AT91C_PA2_SPI1_NPCS1 (AT91C_PIO_PA2) // SPI 1 Peripheral Chip Select 1 +#define AT91C_PIO_PA20 (1 << 20) // Pin Controlled by PA20 +#define AT91C_PA20_CANTX (AT91C_PIO_PA20) // CAN Transmit +#define AT91C_PIO_PA21 (1 << 21) // Pin Controlled by PA21 +#define AT91C_PA21_TF (AT91C_PIO_PA21) // SSC Transmit Frame Sync +#define AT91C_PA21_SPI1_NPCS0 (AT91C_PIO_PA21) // SPI 1 Peripheral Chip Select 0 +#define AT91C_PIO_PA22 (1 << 22) // Pin Controlled by PA22 +#define AT91C_PA22_TK (AT91C_PIO_PA22) // SSC Transmit Clock +#define AT91C_PA22_SPI1_SPCK (AT91C_PIO_PA22) // SPI 1 Serial Clock +#define AT91C_PIO_PA23 (1 << 23) // Pin Controlled by PA23 +#define AT91C_PA23_TD (AT91C_PIO_PA23) // SSC Transmit data +#define AT91C_PA23_SPI1_MOSI (AT91C_PIO_PA23) // SPI 1 Master Out Slave +#define AT91C_PIO_PA24 (1 << 24) // Pin Controlled by PA24 +#define AT91C_PA24_RD (AT91C_PIO_PA24) // SSC Receive Data +#define AT91C_PA24_SPI1_MISO (AT91C_PIO_PA24) // SPI 1 Master In Slave +#define AT91C_PIO_PA25 (1 << 25) // Pin Controlled by PA25 +#define AT91C_PA25_RK (AT91C_PIO_PA25) // SSC Receive Clock +#define AT91C_PA25_SPI1_NPCS1 (AT91C_PIO_PA25) // SPI 1 Peripheral Chip Select 1 +#define AT91C_PIO_PA26 (1 << 26) // Pin Controlled by PA26 +#define AT91C_PA26_RF (AT91C_PIO_PA26) // SSC Receive Frame Sync +#define AT91C_PA26_SPI1_NPCS2 (AT91C_PIO_PA26) // SPI 1 Peripheral Chip Select 2 +#define AT91C_PIO_PA27 (1 << 27) // Pin Controlled by PA27 +#define AT91C_PA27_DRXD (AT91C_PIO_PA27) // DBGU Debug Receive Data +#define AT91C_PA27_PCK3 (AT91C_PIO_PA27) // PMC Programmable Clock Output 3 +#define AT91C_PIO_PA28 (1 << 28) // Pin Controlled by PA28 +#define AT91C_PA28_DTXD (AT91C_PIO_PA28) // DBGU Debug Transmit Data +#define AT91C_PIO_PA29 (1 << 29) // Pin Controlled by PA29 +#define AT91C_PA29_FIQ (AT91C_PIO_PA29) // AIC Fast Interrupt Input +#define AT91C_PA29_SPI1_NPCS3 (AT91C_PIO_PA29) // SPI 1 Peripheral Chip Select 3 +#define AT91C_PIO_PA3 (1 << 3) // Pin Controlled by PA3 +#define AT91C_PA3_RTS0 (AT91C_PIO_PA3) // USART 0 Ready To Send +#define AT91C_PA3_SPI1_NPCS2 (AT91C_PIO_PA3) // SPI 1 Peripheral Chip Select 2 +#define AT91C_PIO_PA30 (1 << 30) // Pin Controlled by PA30 +#define AT91C_PA30_IRQ0 (AT91C_PIO_PA30) // External Interrupt 0 +#define AT91C_PA30_PCK2 (AT91C_PIO_PA30) // PMC Programmable Clock Output 2 +#define AT91C_PIO_PA4 (1 << 4) // Pin Controlled by PA4 +#define AT91C_PA4_CTS0 (AT91C_PIO_PA4) // USART 0 Clear To Send +#define AT91C_PA4_SPI1_NPCS3 (AT91C_PIO_PA4) // SPI 1 Peripheral Chip Select 3 +#define AT91C_PIO_PA5 (1 << 5) // Pin Controlled by PA5 +#define AT91C_PA5_RXD1 (AT91C_PIO_PA5) // USART 1 Receive Data +#define AT91C_PIO_PA6 (1 << 6) // Pin Controlled by PA6 +#define AT91C_PA6_TXD1 (AT91C_PIO_PA6) // USART 1 Transmit Data +#define AT91C_PIO_PA7 (1 << 7) // Pin Controlled by PA7 +#define AT91C_PA7_SCK1 (AT91C_PIO_PA7) // USART 1 Serial Clock +#define AT91C_PA7_SPI0_NPCS1 (AT91C_PIO_PA7) // SPI 0 Peripheral Chip Select 1 +#define AT91C_PIO_PA8 (1 << 8) // Pin Controlled by PA8 +#define AT91C_PA8_RTS1 (AT91C_PIO_PA8) // USART 1 Ready To Send +#define AT91C_PA8_SPI0_NPCS2 (AT91C_PIO_PA8) // SPI 0 Peripheral Chip Select 2 +#define AT91C_PIO_PA9 (1 << 9) // Pin Controlled by PA9 +#define AT91C_PA9_CTS1 (AT91C_PIO_PA9) // USART 1 Clear To Send +#define AT91C_PA9_SPI0_NPCS3 (AT91C_PIO_PA9) // SPI 0 Peripheral Chip Select 3 +#define AT91C_PIO_PB0 (1 << 0) // Pin Controlled by PB0 +#define AT91C_PB0_ETXCK_EREFCK (AT91C_PIO_PB0) // Ethernet MAC Transmit Clock/Reference Clock +#define AT91C_PB0_PCK0 (AT91C_PIO_PB0) // PMC Programmable Clock Output 0 +#define AT91C_PIO_PB1 (1 << 1) // Pin Controlled by PB1 +#define AT91C_PB1_ETXEN (AT91C_PIO_PB1) // Ethernet MAC Transmit Enable +#define AT91C_PIO_PB10 (1 << 10) // Pin Controlled by PB10 +#define AT91C_PB10_ETX2 (AT91C_PIO_PB10) // Ethernet MAC Transmit Data 2 +#define AT91C_PB10_SPI1_NPCS1 (AT91C_PIO_PB10) // SPI 1 Peripheral Chip Select 1 +#define AT91C_PIO_PB11 (1 << 11) // Pin Controlled by PB11 +#define AT91C_PB11_ETX3 (AT91C_PIO_PB11) // Ethernet MAC Transmit Data 3 +#define AT91C_PB11_SPI1_NPCS2 (AT91C_PIO_PB11) // SPI 1 Peripheral Chip Select 2 +#define AT91C_PIO_PB12 (1 << 12) // Pin Controlled by PB12 +#define AT91C_PB12_ETXER (AT91C_PIO_PB12) // Ethernet MAC Transmikt Coding Error +#define AT91C_PB12_TCLK0 (AT91C_PIO_PB12) // Timer Counter 0 external clock input +#define AT91C_PIO_PB13 (1 << 13) // Pin Controlled by PB13 +#define AT91C_PB13_ERX2 (AT91C_PIO_PB13) // Ethernet MAC Receive Data 2 +#define AT91C_PB13_SPI0_NPCS1 (AT91C_PIO_PB13) // SPI 0 Peripheral Chip Select 1 +#define AT91C_PIO_PB14 (1 << 14) // Pin Controlled by PB14 +#define AT91C_PB14_ERX3 (AT91C_PIO_PB14) // Ethernet MAC Receive Data 3 +#define AT91C_PB14_SPI0_NPCS2 (AT91C_PIO_PB14) // SPI 0 Peripheral Chip Select 2 +#define AT91C_PIO_PB15 (1 << 15) // Pin Controlled by PB15 +#define AT91C_PB15_ERXDV_ECRSDV (AT91C_PIO_PB15) // Ethernet MAC Receive Data Valid +#define AT91C_PIO_PB16 (1 << 16) // Pin Controlled by PB16 +#define AT91C_PB16_ECOL (AT91C_PIO_PB16) // Ethernet MAC Collision Detected +#define AT91C_PB16_SPI1_NPCS3 (AT91C_PIO_PB16) // SPI 1 Peripheral Chip Select 3 +#define AT91C_PIO_PB17 (1 << 17) // Pin Controlled by PB17 +#define AT91C_PB17_ERXCK (AT91C_PIO_PB17) // Ethernet MAC Receive Clock +#define AT91C_PB17_SPI0_NPCS3 (AT91C_PIO_PB17) // SPI 0 Peripheral Chip Select 3 +#define AT91C_PIO_PB18 (1 << 18) // Pin Controlled by PB18 +#define AT91C_PB18_EF100 (AT91C_PIO_PB18) // Ethernet MAC Force 100 Mbits/sec +#define AT91C_PB18_ADTRG (AT91C_PIO_PB18) // ADC External Trigger +#define AT91C_PIO_PB19 (1 << 19) // Pin Controlled by PB19 +#define AT91C_PB19_PWM0 (AT91C_PIO_PB19) // PWM Channel 0 +#define AT91C_PB19_TCLK1 (AT91C_PIO_PB19) // Timer Counter 1 external clock input +#define AT91C_PIO_PB2 (1 << 2) // Pin Controlled by PB2 +#define AT91C_PB2_ETX0 (AT91C_PIO_PB2) // Ethernet MAC Transmit Data 0 +#define AT91C_PIO_PB20 (1 << 20) // Pin Controlled by PB20 +#define AT91C_PB20_PWM1 (AT91C_PIO_PB20) // PWM Channel 1 +#define AT91C_PB20_PCK0 (AT91C_PIO_PB20) // PMC Programmable Clock Output 0 +#define AT91C_PIO_PB21 (1 << 21) // Pin Controlled by PB21 +#define AT91C_PB21_PWM2 (AT91C_PIO_PB21) // PWM Channel 2 +#define AT91C_PB21_PCK1 (AT91C_PIO_PB21) // PMC Programmable Clock Output 1 +#define AT91C_PIO_PB22 (1 << 22) // Pin Controlled by PB22 +#define AT91C_PB22_PWM3 (AT91C_PIO_PB22) // PWM Channel 3 +#define AT91C_PB22_PCK2 (AT91C_PIO_PB22) // PMC Programmable Clock Output 2 +#define AT91C_PIO_PB23 (1 << 23) // Pin Controlled by PB23 +#define AT91C_PB23_TIOA0 (AT91C_PIO_PB23) // Timer Counter 0 Multipurpose Timer I/O Pin A +#define AT91C_PB23_DCD1 (AT91C_PIO_PB23) // USART 1 Data Carrier Detect +#define AT91C_PIO_PB24 (1 << 24) // Pin Controlled by PB24 +#define AT91C_PB24_TIOB0 (AT91C_PIO_PB24) // Timer Counter 0 Multipurpose Timer I/O Pin B +#define AT91C_PB24_DSR1 (AT91C_PIO_PB24) // USART 1 Data Set ready +#define AT91C_PIO_PB25 (1 << 25) // Pin Controlled by PB25 +#define AT91C_PB25_TIOA1 (AT91C_PIO_PB25) // Timer Counter 1 Multipurpose Timer I/O Pin A +#define AT91C_PB25_DTR1 (AT91C_PIO_PB25) // USART 1 Data Terminal ready +#define AT91C_PIO_PB26 (1 << 26) // Pin Controlled by PB26 +#define AT91C_PB26_TIOB1 (AT91C_PIO_PB26) // Timer Counter 1 Multipurpose Timer I/O Pin B +#define AT91C_PB26_RI1 (AT91C_PIO_PB26) // USART 1 Ring Indicator +#define AT91C_PIO_PB27 (1 << 27) // Pin Controlled by PB27 +#define AT91C_PB27_TIOA2 (AT91C_PIO_PB27) // Timer Counter 2 Multipurpose Timer I/O Pin A +#define AT91C_PB27_PWM0 (AT91C_PIO_PB27) // PWM Channel 0 +#define AT91C_PIO_PB28 (1 << 28) // Pin Controlled by PB28 +#define AT91C_PB28_TIOB2 (AT91C_PIO_PB28) // Timer Counter 2 Multipurpose Timer I/O Pin B +#define AT91C_PB28_PWM1 (AT91C_PIO_PB28) // PWM Channel 1 +#define AT91C_PIO_PB29 (1 << 29) // Pin Controlled by PB29 +#define AT91C_PB29_PCK1 (AT91C_PIO_PB29) // PMC Programmable Clock Output 1 +#define AT91C_PB29_PWM2 (AT91C_PIO_PB29) // PWM Channel 2 +#define AT91C_PIO_PB3 (1 << 3) // Pin Controlled by PB3 +#define AT91C_PB3_ETX1 (AT91C_PIO_PB3) // Ethernet MAC Transmit Data 1 +#define AT91C_PIO_PB30 (1 << 30) // Pin Controlled by PB30 +#define AT91C_PB30_PCK2 (AT91C_PIO_PB30) // PMC Programmable Clock Output 2 +#define AT91C_PB30_PWM3 (AT91C_PIO_PB30) // PWM Channel 3 +#define AT91C_PIO_PB4 (1 << 4) // Pin Controlled by PB4 +#define AT91C_PB4_ECRS (AT91C_PIO_PB4) // Ethernet MAC Carrier Sense/Carrier Sense and Data Valid +#define AT91C_PIO_PB5 (1 << 5) // Pin Controlled by PB5 +#define AT91C_PB5_ERX0 (AT91C_PIO_PB5) // Ethernet MAC Receive Data 0 +#define AT91C_PIO_PB6 (1 << 6) // Pin Controlled by PB6 +#define AT91C_PB6_ERX1 (AT91C_PIO_PB6) // Ethernet MAC Receive Data 1 +#define AT91C_PIO_PB7 (1 << 7) // Pin Controlled by PB7 +#define AT91C_PB7_ERXER (AT91C_PIO_PB7) // Ethernet MAC Receive Error +#define AT91C_PIO_PB8 (1 << 8) // Pin Controlled by PB8 +#define AT91C_PB8_EMDC (AT91C_PIO_PB8) // Ethernet MAC Management Data Clock +#define AT91C_PIO_PB9 (1 << 9) // Pin Controlled by PB9 +#define AT91C_PB9_EMDIO (AT91C_PIO_PB9) // Ethernet MAC Management Data Input/Output + +// ***************************************************************************** +// PERIPHERAL ID DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** +#define AT91C_ID_FIQ ( 0) // Advanced Interrupt Controller (FIQ) +#define AT91C_ID_SYS ( 1) // System Peripheral +#define AT91C_ID_PIOA ( 2) // Parallel IO Controller A +#define AT91C_ID_PIOB ( 3) // Parallel IO Controller B +#define AT91C_ID_SPI0 ( 4) // Serial Peripheral Interface 0 +#define AT91C_ID_SPI1 ( 5) // Serial Peripheral Interface 1 +#define AT91C_ID_US0 ( 6) // USART 0 +#define AT91C_ID_US1 ( 7) // USART 1 +#define AT91C_ID_SSC ( 8) // Serial Synchronous Controller +#define AT91C_ID_TWI ( 9) // Two-Wire Interface +#define AT91C_ID_PWMC (10) // PWM Controller +#define AT91C_ID_UDP (11) // USB Device Port +#define AT91C_ID_TC0 (12) // Timer Counter 0 +#define AT91C_ID_TC1 (13) // Timer Counter 1 +#define AT91C_ID_TC2 (14) // Timer Counter 2 +#define AT91C_ID_CAN (15) // Control Area Network Controller +#define AT91C_ID_EMAC (16) // Ethernet MAC +#define AT91C_ID_ADC (17) // Analog-to-Digital Converter +#define AT91C_ID_18_Reserved (18) // Reserved +#define AT91C_ID_19_Reserved (19) // Reserved +#define AT91C_ID_20_Reserved (20) // Reserved +#define AT91C_ID_21_Reserved (21) // Reserved +#define AT91C_ID_22_Reserved (22) // Reserved +#define AT91C_ID_23_Reserved (23) // Reserved +#define AT91C_ID_24_Reserved (24) // Reserved +#define AT91C_ID_25_Reserved (25) // Reserved +#define AT91C_ID_26_Reserved (26) // Reserved +#define AT91C_ID_27_Reserved (27) // Reserved +#define AT91C_ID_28_Reserved (28) // Reserved +#define AT91C_ID_29_Reserved (29) // Reserved +#define AT91C_ID_IRQ0 (30) // Advanced Interrupt Controller (IRQ0) +#define AT91C_ID_IRQ1 (31) // Advanced Interrupt Controller (IRQ1) +#define AT91C_ALL_INT (0xC003FFFF) // ALL VALID INTERRUPTS + +// ***************************************************************************** +// BASE ADDRESS DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** +#define AT91C_BASE_SYS (0xFFFFF000) // (SYS) Base Address +#define AT91C_BASE_AIC (0xFFFFF000) // (AIC) Base Address +#define AT91C_BASE_PDC_DBGU (0xFFFFF300) // (PDC_DBGU) Base Address +#define AT91C_BASE_DBGU (0xFFFFF200) // (DBGU) Base Address +#define AT91C_BASE_PIOA (0xFFFFF400) // (PIOA) Base Address +#define AT91C_BASE_PIOB (0xFFFFF600) // (PIOB) Base Address +#define AT91C_BASE_CKGR (0xFFFFFC20) // (CKGR) Base Address +#define AT91C_BASE_PMC (0xFFFFFC00) // (PMC) Base Address +#define AT91C_BASE_RSTC (0xFFFFFD00) // (RSTC) Base Address +#define AT91C_BASE_RTTC (0xFFFFFD20) // (RTTC) Base Address +#define AT91C_BASE_PITC (0xFFFFFD30) // (PITC) Base Address +#define AT91C_BASE_WDTC (0xFFFFFD40) // (WDTC) Base Address +#define AT91C_BASE_VREG (0xFFFFFD60) // (VREG) Base Address +#define AT91C_BASE_MC (0xFFFFFF00) // (MC) Base Address +#define AT91C_BASE_PDC_SPI1 (0xFFFE4100) // (PDC_SPI1) Base Address +#define AT91C_BASE_SPI1 (0xFFFE4000) // (SPI1) Base Address +#define AT91C_BASE_PDC_SPI0 (0xFFFE0100) // (PDC_SPI0) Base Address +#define AT91C_BASE_SPI0 (0xFFFE0000) // (SPI0) Base Address +#define AT91C_BASE_PDC_US1 (0xFFFC4100) // (PDC_US1) Base Address +#define AT91C_BASE_US1 (0xFFFC4000) // (US1) Base Address +#define AT91C_BASE_PDC_US0 (0xFFFC0100) // (PDC_US0) Base Address +#define AT91C_BASE_US0 (0xFFFC0000) // (US0) Base Address +#define AT91C_BASE_PDC_SSC (0xFFFD4100) // (PDC_SSC) Base Address +#define AT91C_BASE_SSC (0xFFFD4000) // (SSC) Base Address +#define AT91C_BASE_TWI (0xFFFB8000) // (TWI) Base Address +#define AT91C_BASE_PWMC_CH3 (0xFFFCC260) // (PWMC_CH3) Base Address +#define AT91C_BASE_PWMC_CH2 (0xFFFCC240) // (PWMC_CH2) Base Address +#define AT91C_BASE_PWMC_CH1 (0xFFFCC220) // (PWMC_CH1) Base Address +#define AT91C_BASE_PWMC_CH0 (0xFFFCC200) // (PWMC_CH0) Base Address +#define AT91C_BASE_PWMC (0xFFFCC000) // (PWMC) Base Address +#define AT91C_BASE_UDP (0xFFFB0000) // (UDP) Base Address +#define AT91C_BASE_TC0 (0xFFFA0000) // (TC0) Base Address +#define AT91C_BASE_TC1 (0xFFFA0040) // (TC1) Base Address +#define AT91C_BASE_TC2 (0xFFFA0080) // (TC2) Base Address +#define AT91C_BASE_TCB (0xFFFA0000) // (TCB) Base Address +#define AT91C_BASE_CAN_MB0 (0xFFFD0200) // (CAN_MB0) Base Address +#define AT91C_BASE_CAN_MB1 (0xFFFD0220) // (CAN_MB1) Base Address +#define AT91C_BASE_CAN_MB2 (0xFFFD0240) // (CAN_MB2) Base Address +#define AT91C_BASE_CAN_MB3 (0xFFFD0260) // (CAN_MB3) Base Address +#define AT91C_BASE_CAN_MB4 (0xFFFD0280) // (CAN_MB4) Base Address +#define AT91C_BASE_CAN_MB5 (0xFFFD02A0) // (CAN_MB5) Base Address +#define AT91C_BASE_CAN_MB6 (0xFFFD02C0) // (CAN_MB6) Base Address +#define AT91C_BASE_CAN_MB7 (0xFFFD02E0) // (CAN_MB7) Base Address +#define AT91C_BASE_CAN (0xFFFD0000) // (CAN) Base Address +#define AT91C_BASE_EMAC (0xFFFDC000) // (EMAC) Base Address +#define AT91C_BASE_PDC_ADC (0xFFFD8100) // (PDC_ADC) Base Address +#define AT91C_BASE_ADC (0xFFFD8000) // (ADC) Base Address + +// ***************************************************************************** +// MEMORY MAPPING DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** +// ISRAM +#define AT91C_ISRAM (0x00200000) // Internal SRAM base address +#define AT91C_ISRAM_SIZE (0x00010000) // Internal SRAM size in byte (64 Kbytes) +// IFLASH +#define AT91C_IFLASH (0x00100000) // Internal FLASH base address +#define AT91C_IFLASH_SIZE (0x00040000) // Internal FLASH size in byte (256 Kbytes) +#define AT91C_IFLASH_PAGE_SIZE (256) // Internal FLASH Page Size: 256 bytes +#define AT91C_IFLASH_LOCK_REGION_SIZE (16384) // Internal FLASH Lock Region Size: 16 Kbytes +#define AT91C_IFLASH_NB_OF_PAGES (1024) // Internal FLASH Number of Pages: 1024 bytes +#define AT91C_IFLASH_NB_OF_LOCK_BITS (16) // Internal FLASH Number of Lock Bits: 16 bytes + + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/ioat91sam7x256.h b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/ioat91sam7x256.h new file mode 100644 index 0000000..ab71b93 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/ioat91sam7x256.h @@ -0,0 +1,4380 @@ +// - ---------------------------------------------------------------------------- +// - ATMEL Microcontroller Software Support - ROUSSET - +// - ---------------------------------------------------------------------------- +// - DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// - DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// - OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// - EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// - ---------------------------------------------------------------------------- +// - File Name : AT91SAM7X256.h +// - Object : AT91SAM7X256 definitions +// - Generated : AT91 SW Application Group 11/02/2005 (15:17:24) +// - +// - CVS Reference : /AT91SAM7X256.pl/1.14/Tue Sep 13 15:06:52 2005// +// - CVS Reference : /SYS_SAM7X.pl/1.3/Tue Feb 1 17:01:43 2005// +// - CVS Reference : /MC_SAM7X.pl/1.2/Fri May 20 14:13:04 2005// +// - CVS Reference : /PMC_SAM7X.pl/1.4/Tue Feb 8 13:58:10 2005// +// - CVS Reference : /RSTC_SAM7X.pl/1.2/Wed Jul 13 14:57:50 2005// +// - CVS Reference : /UDP_SAM7X.pl/1.1/Tue May 10 11:35:35 2005// +// - CVS Reference : /PWM_SAM7X.pl/1.1/Tue May 10 11:53:07 2005// +// - CVS Reference : /AIC_6075B.pl/1.3/Fri May 20 14:01:30 2005// +// - CVS Reference : /PIO_6057A.pl/1.2/Thu Feb 3 10:18:28 2005// +// - CVS Reference : /RTTC_6081A.pl/1.2/Tue Nov 9 14:43:58 2004// +// - CVS Reference : /PITC_6079A.pl/1.2/Tue Nov 9 14:43:56 2004// +// - CVS Reference : /WDTC_6080A.pl/1.3/Tue Nov 9 14:44:00 2004// +// - CVS Reference : /VREG_6085B.pl/1.1/Tue Feb 1 16:05:48 2005// +// - CVS Reference : /PDC_6074C.pl/1.2/Thu Feb 3 08:48:54 2005// +// - CVS Reference : /DBGU_6059D.pl/1.1/Mon Jan 31 13:15:32 2005// +// - CVS Reference : /SPI_6088D.pl/1.3/Fri May 20 14:08:59 2005// +// - CVS Reference : /US_6089C.pl/1.1/Mon Jul 12 18:23:26 2004// +// - CVS Reference : /SSC_6078B.pl/1.1/Wed Jul 13 15:19:19 2005// +// - CVS Reference : /TWI_6061A.pl/1.1/Tue Jul 13 07:38:06 2004// +// - CVS Reference : /TC_6082A.pl/1.7/Fri Mar 11 12:52:17 2005// +// - CVS Reference : /CAN_6019B.pl/1.1/Tue Mar 8 12:42:22 2005// +// - CVS Reference : /EMACB_6119A.pl/1.6/Wed Jul 13 15:05:35 2005// +// - CVS Reference : /ADC_6051C.pl/1.1/Fri Oct 17 09:12:38 2003// +// - ---------------------------------------------------------------------------- + +#ifndef AT91SAM7X256_H +#define AT91SAM7X256_H + +#ifdef __IAR_SYSTEMS_ICC__ + +typedef volatile unsigned int AT91_REG;// Hardware register definition + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR System Peripherals +// ***************************************************************************** +typedef struct _AT91S_SYS { + AT91_REG AIC_SMR[32]; // Source Mode Register + AT91_REG AIC_SVR[32]; // Source Vector Register + AT91_REG AIC_IVR; // IRQ Vector Register + AT91_REG AIC_FVR; // FIQ Vector Register + AT91_REG AIC_ISR; // Interrupt Status Register + AT91_REG AIC_IPR; // Interrupt Pending Register + AT91_REG AIC_IMR; // Interrupt Mask Register + AT91_REG AIC_CISR; // Core Interrupt Status Register + AT91_REG Reserved0[2]; // + AT91_REG AIC_IECR; // Interrupt Enable Command Register + AT91_REG AIC_IDCR; // Interrupt Disable Command Register + AT91_REG AIC_ICCR; // Interrupt Clear Command Register + AT91_REG AIC_ISCR; // Interrupt Set Command Register + AT91_REG AIC_EOICR; // End of Interrupt Command Register + AT91_REG AIC_SPU; // Spurious Vector Register + AT91_REG AIC_DCR; // Debug Control Register (Protect) + AT91_REG Reserved1[1]; // + AT91_REG AIC_FFER; // Fast Forcing Enable Register + AT91_REG AIC_FFDR; // Fast Forcing Disable Register + AT91_REG AIC_FFSR; // Fast Forcing Status Register + AT91_REG Reserved2[45]; // + AT91_REG DBGU_CR; // Control Register + AT91_REG DBGU_MR; // Mode Register + AT91_REG DBGU_IER; // Interrupt Enable Register + AT91_REG DBGU_IDR; // Interrupt Disable Register + AT91_REG DBGU_IMR; // Interrupt Mask Register + AT91_REG DBGU_CSR; // Channel Status Register + AT91_REG DBGU_RHR; // Receiver Holding Register + AT91_REG DBGU_THR; // Transmitter Holding Register + AT91_REG DBGU_BRGR; // Baud Rate Generator Register + AT91_REG Reserved3[7]; // + AT91_REG DBGU_CIDR; // Chip ID Register + AT91_REG DBGU_EXID; // Chip ID Extension Register + AT91_REG DBGU_FNTR; // Force NTRST Register + AT91_REG Reserved4[45]; // + AT91_REG DBGU_RPR; // Receive Pointer Register + AT91_REG DBGU_RCR; // Receive Counter Register + AT91_REG DBGU_TPR; // Transmit Pointer Register + AT91_REG DBGU_TCR; // Transmit Counter Register + AT91_REG DBGU_RNPR; // Receive Next Pointer Register + AT91_REG DBGU_RNCR; // Receive Next Counter Register + AT91_REG DBGU_TNPR; // Transmit Next Pointer Register + AT91_REG DBGU_TNCR; // Transmit Next Counter Register + AT91_REG DBGU_PTCR; // PDC Transfer Control Register + AT91_REG DBGU_PTSR; // PDC Transfer Status Register + AT91_REG Reserved5[54]; // + AT91_REG PIOA_PER; // PIO Enable Register + AT91_REG PIOA_PDR; // PIO Disable Register + AT91_REG PIOA_PSR; // PIO Status Register + AT91_REG Reserved6[1]; // + AT91_REG PIOA_OER; // Output Enable Register + AT91_REG PIOA_ODR; // Output Disable Registerr + AT91_REG PIOA_OSR; // Output Status Register + AT91_REG Reserved7[1]; // + AT91_REG PIOA_IFER; // Input Filter Enable Register + AT91_REG PIOA_IFDR; // Input Filter Disable Register + AT91_REG PIOA_IFSR; // Input Filter Status Register + AT91_REG Reserved8[1]; // + AT91_REG PIOA_SODR; // Set Output Data Register + AT91_REG PIOA_CODR; // Clear Output Data Register + AT91_REG PIOA_ODSR; // Output Data Status Register + AT91_REG PIOA_PDSR; // Pin Data Status Register + AT91_REG PIOA_IER; // Interrupt Enable Register + AT91_REG PIOA_IDR; // Interrupt Disable Register + AT91_REG PIOA_IMR; // Interrupt Mask Register + AT91_REG PIOA_ISR; // Interrupt Status Register + AT91_REG PIOA_MDER; // Multi-driver Enable Register + AT91_REG PIOA_MDDR; // Multi-driver Disable Register + AT91_REG PIOA_MDSR; // Multi-driver Status Register + AT91_REG Reserved9[1]; // + AT91_REG PIOA_PPUDR; // Pull-up Disable Register + AT91_REG PIOA_PPUER; // Pull-up Enable Register + AT91_REG PIOA_PPUSR; // Pull-up Status Register + AT91_REG Reserved10[1]; // + AT91_REG PIOA_ASR; // Select A Register + AT91_REG PIOA_BSR; // Select B Register + AT91_REG PIOA_ABSR; // AB Select Status Register + AT91_REG Reserved11[9]; // + AT91_REG PIOA_OWER; // Output Write Enable Register + AT91_REG PIOA_OWDR; // Output Write Disable Register + AT91_REG PIOA_OWSR; // Output Write Status Register + AT91_REG Reserved12[85]; // + AT91_REG PIOB_PER; // PIO Enable Register + AT91_REG PIOB_PDR; // PIO Disable Register + AT91_REG PIOB_PSR; // PIO Status Register + AT91_REG Reserved13[1]; // + AT91_REG PIOB_OER; // Output Enable Register + AT91_REG PIOB_ODR; // Output Disable Registerr + AT91_REG PIOB_OSR; // Output Status Register + AT91_REG Reserved14[1]; // + AT91_REG PIOB_IFER; // Input Filter Enable Register + AT91_REG PIOB_IFDR; // Input Filter Disable Register + AT91_REG PIOB_IFSR; // Input Filter Status Register + AT91_REG Reserved15[1]; // + AT91_REG PIOB_SODR; // Set Output Data Register + AT91_REG PIOB_CODR; // Clear Output Data Register + AT91_REG PIOB_ODSR; // Output Data Status Register + AT91_REG PIOB_PDSR; // Pin Data Status Register + AT91_REG PIOB_IER; // Interrupt Enable Register + AT91_REG PIOB_IDR; // Interrupt Disable Register + AT91_REG PIOB_IMR; // Interrupt Mask Register + AT91_REG PIOB_ISR; // Interrupt Status Register + AT91_REG PIOB_MDER; // Multi-driver Enable Register + AT91_REG PIOB_MDDR; // Multi-driver Disable Register + AT91_REG PIOB_MDSR; // Multi-driver Status Register + AT91_REG Reserved16[1]; // + AT91_REG PIOB_PPUDR; // Pull-up Disable Register + AT91_REG PIOB_PPUER; // Pull-up Enable Register + AT91_REG PIOB_PPUSR; // Pull-up Status Register + AT91_REG Reserved17[1]; // + AT91_REG PIOB_ASR; // Select A Register + AT91_REG PIOB_BSR; // Select B Register + AT91_REG PIOB_ABSR; // AB Select Status Register + AT91_REG Reserved18[9]; // + AT91_REG PIOB_OWER; // Output Write Enable Register + AT91_REG PIOB_OWDR; // Output Write Disable Register + AT91_REG PIOB_OWSR; // Output Write Status Register + AT91_REG Reserved19[341]; // + AT91_REG PMC_SCER; // System Clock Enable Register + AT91_REG PMC_SCDR; // System Clock Disable Register + AT91_REG PMC_SCSR; // System Clock Status Register + AT91_REG Reserved20[1]; // + AT91_REG PMC_PCER; // Peripheral Clock Enable Register + AT91_REG PMC_PCDR; // Peripheral Clock Disable Register + AT91_REG PMC_PCSR; // Peripheral Clock Status Register + AT91_REG Reserved21[1]; // + AT91_REG PMC_MOR; // Main Oscillator Register + AT91_REG PMC_MCFR; // Main Clock Frequency Register + AT91_REG Reserved22[1]; // + AT91_REG PMC_PLLR; // PLL Register + AT91_REG PMC_MCKR; // Master Clock Register + AT91_REG Reserved23[3]; // + AT91_REG PMC_PCKR[4]; // Programmable Clock Register + AT91_REG Reserved24[4]; // + AT91_REG PMC_IER; // Interrupt Enable Register + AT91_REG PMC_IDR; // Interrupt Disable Register + AT91_REG PMC_SR; // Status Register + AT91_REG PMC_IMR; // Interrupt Mask Register + AT91_REG Reserved25[36]; // + AT91_REG RSTC_RCR; // Reset Control Register + AT91_REG RSTC_RSR; // Reset Status Register + AT91_REG RSTC_RMR; // Reset Mode Register + AT91_REG Reserved26[5]; // + AT91_REG RTTC_RTMR; // Real-time Mode Register + AT91_REG RTTC_RTAR; // Real-time Alarm Register + AT91_REG RTTC_RTVR; // Real-time Value Register + AT91_REG RTTC_RTSR; // Real-time Status Register + AT91_REG PITC_PIMR; // Period Interval Mode Register + AT91_REG PITC_PISR; // Period Interval Status Register + AT91_REG PITC_PIVR; // Period Interval Value Register + AT91_REG PITC_PIIR; // Period Interval Image Register + AT91_REG WDTC_WDCR; // Watchdog Control Register + AT91_REG WDTC_WDMR; // Watchdog Mode Register + AT91_REG WDTC_WDSR; // Watchdog Status Register + AT91_REG Reserved27[5]; // + AT91_REG VREG_MR; // Voltage Regulator Mode Register +} AT91S_SYS, *AT91PS_SYS; + + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Advanced Interrupt Controller +// ***************************************************************************** +typedef struct _AT91S_AIC { + AT91_REG AIC_SMR[32]; // Source Mode Register + AT91_REG AIC_SVR[32]; // Source Vector Register + AT91_REG AIC_IVR; // IRQ Vector Register + AT91_REG AIC_FVR; // FIQ Vector Register + AT91_REG AIC_ISR; // Interrupt Status Register + AT91_REG AIC_IPR; // Interrupt Pending Register + AT91_REG AIC_IMR; // Interrupt Mask Register + AT91_REG AIC_CISR; // Core Interrupt Status Register + AT91_REG Reserved0[2]; // + AT91_REG AIC_IECR; // Interrupt Enable Command Register + AT91_REG AIC_IDCR; // Interrupt Disable Command Register + AT91_REG AIC_ICCR; // Interrupt Clear Command Register + AT91_REG AIC_ISCR; // Interrupt Set Command Register + AT91_REG AIC_EOICR; // End of Interrupt Command Register + AT91_REG AIC_SPU; // Spurious Vector Register + AT91_REG AIC_DCR; // Debug Control Register (Protect) + AT91_REG Reserved1[1]; // + AT91_REG AIC_FFER; // Fast Forcing Enable Register + AT91_REG AIC_FFDR; // Fast Forcing Disable Register + AT91_REG AIC_FFSR; // Fast Forcing Status Register +} AT91S_AIC, *AT91PS_AIC; + +// -------- AIC_SMR : (AIC Offset: 0x0) Control Register -------- +#define AT91C_AIC_PRIOR ((unsigned int) 0x7 << 0) // (AIC) Priority Level +#define AT91C_AIC_PRIOR_LOWEST ((unsigned int) 0x0) // (AIC) Lowest priority level +#define AT91C_AIC_PRIOR_HIGHEST ((unsigned int) 0x7) // (AIC) Highest priority level +#define AT91C_AIC_SRCTYPE ((unsigned int) 0x3 << 5) // (AIC) Interrupt Source Type +#define AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL ((unsigned int) 0x0 << 5) // (AIC) Internal Sources Code Label High-level Sensitive +#define AT91C_AIC_SRCTYPE_EXT_LOW_LEVEL ((unsigned int) 0x0 << 5) // (AIC) External Sources Code Label Low-level Sensitive +#define AT91C_AIC_SRCTYPE_INT_POSITIVE_EDGE ((unsigned int) 0x1 << 5) // (AIC) Internal Sources Code Label Positive Edge triggered +#define AT91C_AIC_SRCTYPE_EXT_NEGATIVE_EDGE ((unsigned int) 0x1 << 5) // (AIC) External Sources Code Label Negative Edge triggered +#define AT91C_AIC_SRCTYPE_HIGH_LEVEL ((unsigned int) 0x2 << 5) // (AIC) Internal Or External Sources Code Label High-level Sensitive +#define AT91C_AIC_SRCTYPE_POSITIVE_EDGE ((unsigned int) 0x3 << 5) // (AIC) Internal Or External Sources Code Label Positive Edge triggered +// -------- AIC_CISR : (AIC Offset: 0x114) AIC Core Interrupt Status Register -------- +#define AT91C_AIC_NFIQ ((unsigned int) 0x1 << 0) // (AIC) NFIQ Status +#define AT91C_AIC_NIRQ ((unsigned int) 0x1 << 1) // (AIC) NIRQ Status +// -------- AIC_DCR : (AIC Offset: 0x138) AIC Debug Control Register (Protect) -------- +#define AT91C_AIC_DCR_PROT ((unsigned int) 0x1 << 0) // (AIC) Protection Mode +#define AT91C_AIC_DCR_GMSK ((unsigned int) 0x1 << 1) // (AIC) General Mask + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Peripheral DMA Controller +// ***************************************************************************** +typedef struct _AT91S_PDC { + AT91_REG PDC_RPR; // Receive Pointer Register + AT91_REG PDC_RCR; // Receive Counter Register + AT91_REG PDC_TPR; // Transmit Pointer Register + AT91_REG PDC_TCR; // Transmit Counter Register + AT91_REG PDC_RNPR; // Receive Next Pointer Register + AT91_REG PDC_RNCR; // Receive Next Counter Register + AT91_REG PDC_TNPR; // Transmit Next Pointer Register + AT91_REG PDC_TNCR; // Transmit Next Counter Register + AT91_REG PDC_PTCR; // PDC Transfer Control Register + AT91_REG PDC_PTSR; // PDC Transfer Status Register +} AT91S_PDC, *AT91PS_PDC; + +// -------- PDC_PTCR : (PDC Offset: 0x20) PDC Transfer Control Register -------- +#define AT91C_PDC_RXTEN ((unsigned int) 0x1 << 0) // (PDC) Receiver Transfer Enable +#define AT91C_PDC_RXTDIS ((unsigned int) 0x1 << 1) // (PDC) Receiver Transfer Disable +#define AT91C_PDC_TXTEN ((unsigned int) 0x1 << 8) // (PDC) Transmitter Transfer Enable +#define AT91C_PDC_TXTDIS ((unsigned int) 0x1 << 9) // (PDC) Transmitter Transfer Disable +// -------- PDC_PTSR : (PDC Offset: 0x24) PDC Transfer Status Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Debug Unit +// ***************************************************************************** +typedef struct _AT91S_DBGU { + AT91_REG DBGU_CR; // Control Register + AT91_REG DBGU_MR; // Mode Register + AT91_REG DBGU_IER; // Interrupt Enable Register + AT91_REG DBGU_IDR; // Interrupt Disable Register + AT91_REG DBGU_IMR; // Interrupt Mask Register + AT91_REG DBGU_CSR; // Channel Status Register + AT91_REG DBGU_RHR; // Receiver Holding Register + AT91_REG DBGU_THR; // Transmitter Holding Register + AT91_REG DBGU_BRGR; // Baud Rate Generator Register + AT91_REG Reserved0[7]; // + AT91_REG DBGU_CIDR; // Chip ID Register + AT91_REG DBGU_EXID; // Chip ID Extension Register + AT91_REG DBGU_FNTR; // Force NTRST Register + AT91_REG Reserved1[45]; // + AT91_REG DBGU_RPR; // Receive Pointer Register + AT91_REG DBGU_RCR; // Receive Counter Register + AT91_REG DBGU_TPR; // Transmit Pointer Register + AT91_REG DBGU_TCR; // Transmit Counter Register + AT91_REG DBGU_RNPR; // Receive Next Pointer Register + AT91_REG DBGU_RNCR; // Receive Next Counter Register + AT91_REG DBGU_TNPR; // Transmit Next Pointer Register + AT91_REG DBGU_TNCR; // Transmit Next Counter Register + AT91_REG DBGU_PTCR; // PDC Transfer Control Register + AT91_REG DBGU_PTSR; // PDC Transfer Status Register +} AT91S_DBGU, *AT91PS_DBGU; + +// -------- DBGU_CR : (DBGU Offset: 0x0) Debug Unit Control Register -------- +#define AT91C_US_RSTRX ((unsigned int) 0x1 << 2) // (DBGU) Reset Receiver +#define AT91C_US_RSTTX ((unsigned int) 0x1 << 3) // (DBGU) Reset Transmitter +#define AT91C_US_RXEN ((unsigned int) 0x1 << 4) // (DBGU) Receiver Enable +#define AT91C_US_RXDIS ((unsigned int) 0x1 << 5) // (DBGU) Receiver Disable +#define AT91C_US_TXEN ((unsigned int) 0x1 << 6) // (DBGU) Transmitter Enable +#define AT91C_US_TXDIS ((unsigned int) 0x1 << 7) // (DBGU) Transmitter Disable +#define AT91C_US_RSTSTA ((unsigned int) 0x1 << 8) // (DBGU) Reset Status Bits +// -------- DBGU_MR : (DBGU Offset: 0x4) Debug Unit Mode Register -------- +#define AT91C_US_PAR ((unsigned int) 0x7 << 9) // (DBGU) Parity type +#define AT91C_US_PAR_EVEN ((unsigned int) 0x0 << 9) // (DBGU) Even Parity +#define AT91C_US_PAR_ODD ((unsigned int) 0x1 << 9) // (DBGU) Odd Parity +#define AT91C_US_PAR_SPACE ((unsigned int) 0x2 << 9) // (DBGU) Parity forced to 0 (Space) +#define AT91C_US_PAR_MARK ((unsigned int) 0x3 << 9) // (DBGU) Parity forced to 1 (Mark) +#define AT91C_US_PAR_NONE ((unsigned int) 0x4 << 9) // (DBGU) No Parity +#define AT91C_US_PAR_MULTI_DROP ((unsigned int) 0x6 << 9) // (DBGU) Multi-drop mode +#define AT91C_US_CHMODE ((unsigned int) 0x3 << 14) // (DBGU) Channel Mode +#define AT91C_US_CHMODE_NORMAL ((unsigned int) 0x0 << 14) // (DBGU) Normal Mode: The USART channel operates as an RX/TX USART. +#define AT91C_US_CHMODE_AUTO ((unsigned int) 0x1 << 14) // (DBGU) Automatic Echo: Receiver Data Input is connected to the TXD pin. +#define AT91C_US_CHMODE_LOCAL ((unsigned int) 0x2 << 14) // (DBGU) Local Loopback: Transmitter Output Signal is connected to Receiver Input Signal. +#define AT91C_US_CHMODE_REMOTE ((unsigned int) 0x3 << 14) // (DBGU) Remote Loopback: RXD pin is internally connected to TXD pin. +// -------- DBGU_IER : (DBGU Offset: 0x8) Debug Unit Interrupt Enable Register -------- +#define AT91C_US_RXRDY ((unsigned int) 0x1 << 0) // (DBGU) RXRDY Interrupt +#define AT91C_US_TXRDY ((unsigned int) 0x1 << 1) // (DBGU) TXRDY Interrupt +#define AT91C_US_ENDRX ((unsigned int) 0x1 << 3) // (DBGU) End of Receive Transfer Interrupt +#define AT91C_US_ENDTX ((unsigned int) 0x1 << 4) // (DBGU) End of Transmit Interrupt +#define AT91C_US_OVRE ((unsigned int) 0x1 << 5) // (DBGU) Overrun Interrupt +#define AT91C_US_FRAME ((unsigned int) 0x1 << 6) // (DBGU) Framing Error Interrupt +#define AT91C_US_PARE ((unsigned int) 0x1 << 7) // (DBGU) Parity Error Interrupt +#define AT91C_US_TXEMPTY ((unsigned int) 0x1 << 9) // (DBGU) TXEMPTY Interrupt +#define AT91C_US_TXBUFE ((unsigned int) 0x1 << 11) // (DBGU) TXBUFE Interrupt +#define AT91C_US_RXBUFF ((unsigned int) 0x1 << 12) // (DBGU) RXBUFF Interrupt +#define AT91C_US_COMM_TX ((unsigned int) 0x1 << 30) // (DBGU) COMM_TX Interrupt +#define AT91C_US_COMM_RX ((unsigned int) 0x1 << 31) // (DBGU) COMM_RX Interrupt +// -------- DBGU_IDR : (DBGU Offset: 0xc) Debug Unit Interrupt Disable Register -------- +// -------- DBGU_IMR : (DBGU Offset: 0x10) Debug Unit Interrupt Mask Register -------- +// -------- DBGU_CSR : (DBGU Offset: 0x14) Debug Unit Channel Status Register -------- +// -------- DBGU_FNTR : (DBGU Offset: 0x48) Debug Unit FORCE_NTRST Register -------- +#define AT91C_US_FORCE_NTRST ((unsigned int) 0x1 << 0) // (DBGU) Force NTRST in JTAG + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Parallel Input Output Controler +// ***************************************************************************** +typedef struct _AT91S_PIO { + AT91_REG PIO_PER; // PIO Enable Register + AT91_REG PIO_PDR; // PIO Disable Register + AT91_REG PIO_PSR; // PIO Status Register + AT91_REG Reserved0[1]; // + AT91_REG PIO_OER; // Output Enable Register + AT91_REG PIO_ODR; // Output Disable Registerr + AT91_REG PIO_OSR; // Output Status Register + AT91_REG Reserved1[1]; // + AT91_REG PIO_IFER; // Input Filter Enable Register + AT91_REG PIO_IFDR; // Input Filter Disable Register + AT91_REG PIO_IFSR; // Input Filter Status Register + AT91_REG Reserved2[1]; // + AT91_REG PIO_SODR; // Set Output Data Register + AT91_REG PIO_CODR; // Clear Output Data Register + AT91_REG PIO_ODSR; // Output Data Status Register + AT91_REG PIO_PDSR; // Pin Data Status Register + AT91_REG PIO_IER; // Interrupt Enable Register + AT91_REG PIO_IDR; // Interrupt Disable Register + AT91_REG PIO_IMR; // Interrupt Mask Register + AT91_REG PIO_ISR; // Interrupt Status Register + AT91_REG PIO_MDER; // Multi-driver Enable Register + AT91_REG PIO_MDDR; // Multi-driver Disable Register + AT91_REG PIO_MDSR; // Multi-driver Status Register + AT91_REG Reserved3[1]; // + AT91_REG PIO_PPUDR; // Pull-up Disable Register + AT91_REG PIO_PPUER; // Pull-up Enable Register + AT91_REG PIO_PPUSR; // Pull-up Status Register + AT91_REG Reserved4[1]; // + AT91_REG PIO_ASR; // Select A Register + AT91_REG PIO_BSR; // Select B Register + AT91_REG PIO_ABSR; // AB Select Status Register + AT91_REG Reserved5[9]; // + AT91_REG PIO_OWER; // Output Write Enable Register + AT91_REG PIO_OWDR; // Output Write Disable Register + AT91_REG PIO_OWSR; // Output Write Status Register +} AT91S_PIO, *AT91PS_PIO; + + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Clock Generator Controler +// ***************************************************************************** +typedef struct _AT91S_CKGR { + AT91_REG CKGR_MOR; // Main Oscillator Register + AT91_REG CKGR_MCFR; // Main Clock Frequency Register + AT91_REG Reserved0[1]; // + AT91_REG CKGR_PLLR; // PLL Register +} AT91S_CKGR, *AT91PS_CKGR; + +// -------- CKGR_MOR : (CKGR Offset: 0x0) Main Oscillator Register -------- +#define AT91C_CKGR_MOSCEN ((unsigned int) 0x1 << 0) // (CKGR) Main Oscillator Enable +#define AT91C_CKGR_OSCBYPASS ((unsigned int) 0x1 << 1) // (CKGR) Main Oscillator Bypass +#define AT91C_CKGR_OSCOUNT ((unsigned int) 0xFF << 8) // (CKGR) Main Oscillator Start-up Time +// -------- CKGR_MCFR : (CKGR Offset: 0x4) Main Clock Frequency Register -------- +#define AT91C_CKGR_MAINF ((unsigned int) 0xFFFF << 0) // (CKGR) Main Clock Frequency +#define AT91C_CKGR_MAINRDY ((unsigned int) 0x1 << 16) // (CKGR) Main Clock Ready +// -------- CKGR_PLLR : (CKGR Offset: 0xc) PLL B Register -------- +#define AT91C_CKGR_DIV ((unsigned int) 0xFF << 0) // (CKGR) Divider Selected +#define AT91C_CKGR_DIV_0 ((unsigned int) 0x0) // (CKGR) Divider output is 0 +#define AT91C_CKGR_DIV_BYPASS ((unsigned int) 0x1) // (CKGR) Divider is bypassed +#define AT91C_CKGR_PLLCOUNT ((unsigned int) 0x3F << 8) // (CKGR) PLL Counter +#define AT91C_CKGR_OUT ((unsigned int) 0x3 << 14) // (CKGR) PLL Output Frequency Range +#define AT91C_CKGR_OUT_0 ((unsigned int) 0x0 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_OUT_1 ((unsigned int) 0x1 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_OUT_2 ((unsigned int) 0x2 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_OUT_3 ((unsigned int) 0x3 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_MUL ((unsigned int) 0x7FF << 16) // (CKGR) PLL Multiplier +#define AT91C_CKGR_USBDIV ((unsigned int) 0x3 << 28) // (CKGR) Divider for USB Clocks +#define AT91C_CKGR_USBDIV_0 ((unsigned int) 0x0 << 28) // (CKGR) Divider output is PLL clock output +#define AT91C_CKGR_USBDIV_1 ((unsigned int) 0x1 << 28) // (CKGR) Divider output is PLL clock output divided by 2 +#define AT91C_CKGR_USBDIV_2 ((unsigned int) 0x2 << 28) // (CKGR) Divider output is PLL clock output divided by 4 + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Power Management Controler +// ***************************************************************************** +typedef struct _AT91S_PMC { + AT91_REG PMC_SCER; // System Clock Enable Register + AT91_REG PMC_SCDR; // System Clock Disable Register + AT91_REG PMC_SCSR; // System Clock Status Register + AT91_REG Reserved0[1]; // + AT91_REG PMC_PCER; // Peripheral Clock Enable Register + AT91_REG PMC_PCDR; // Peripheral Clock Disable Register + AT91_REG PMC_PCSR; // Peripheral Clock Status Register + AT91_REG Reserved1[1]; // + AT91_REG PMC_MOR; // Main Oscillator Register + AT91_REG PMC_MCFR; // Main Clock Frequency Register + AT91_REG Reserved2[1]; // + AT91_REG PMC_PLLR; // PLL Register + AT91_REG PMC_MCKR; // Master Clock Register + AT91_REG Reserved3[3]; // + AT91_REG PMC_PCKR[4]; // Programmable Clock Register + AT91_REG Reserved4[4]; // + AT91_REG PMC_IER; // Interrupt Enable Register + AT91_REG PMC_IDR; // Interrupt Disable Register + AT91_REG PMC_SR; // Status Register + AT91_REG PMC_IMR; // Interrupt Mask Register +} AT91S_PMC, *AT91PS_PMC; + +// -------- PMC_SCER : (PMC Offset: 0x0) System Clock Enable Register -------- +#define AT91C_PMC_PCK ((unsigned int) 0x1 << 0) // (PMC) Processor Clock +#define AT91C_PMC_UDP ((unsigned int) 0x1 << 7) // (PMC) USB Device Port Clock +#define AT91C_PMC_PCK0 ((unsigned int) 0x1 << 8) // (PMC) Programmable Clock Output +#define AT91C_PMC_PCK1 ((unsigned int) 0x1 << 9) // (PMC) Programmable Clock Output +#define AT91C_PMC_PCK2 ((unsigned int) 0x1 << 10) // (PMC) Programmable Clock Output +#define AT91C_PMC_PCK3 ((unsigned int) 0x1 << 11) // (PMC) Programmable Clock Output +// -------- PMC_SCDR : (PMC Offset: 0x4) System Clock Disable Register -------- +// -------- PMC_SCSR : (PMC Offset: 0x8) System Clock Status Register -------- +// -------- CKGR_MOR : (PMC Offset: 0x20) Main Oscillator Register -------- +// -------- CKGR_MCFR : (PMC Offset: 0x24) Main Clock Frequency Register -------- +// -------- CKGR_PLLR : (PMC Offset: 0x2c) PLL B Register -------- +// -------- PMC_MCKR : (PMC Offset: 0x30) Master Clock Register -------- +#define AT91C_PMC_CSS ((unsigned int) 0x3 << 0) // (PMC) Programmable Clock Selection +#define AT91C_PMC_CSS_SLOW_CLK ((unsigned int) 0x0) // (PMC) Slow Clock is selected +#define AT91C_PMC_CSS_MAIN_CLK ((unsigned int) 0x1) // (PMC) Main Clock is selected +#define AT91C_PMC_CSS_PLL_CLK ((unsigned int) 0x3) // (PMC) Clock from PLL is selected +#define AT91C_PMC_PRES ((unsigned int) 0x7 << 2) // (PMC) Programmable Clock Prescaler +#define AT91C_PMC_PRES_CLK ((unsigned int) 0x0 << 2) // (PMC) Selected clock +#define AT91C_PMC_PRES_CLK_2 ((unsigned int) 0x1 << 2) // (PMC) Selected clock divided by 2 +#define AT91C_PMC_PRES_CLK_4 ((unsigned int) 0x2 << 2) // (PMC) Selected clock divided by 4 +#define AT91C_PMC_PRES_CLK_8 ((unsigned int) 0x3 << 2) // (PMC) Selected clock divided by 8 +#define AT91C_PMC_PRES_CLK_16 ((unsigned int) 0x4 << 2) // (PMC) Selected clock divided by 16 +#define AT91C_PMC_PRES_CLK_32 ((unsigned int) 0x5 << 2) // (PMC) Selected clock divided by 32 +#define AT91C_PMC_PRES_CLK_64 ((unsigned int) 0x6 << 2) // (PMC) Selected clock divided by 64 +// -------- PMC_PCKR : (PMC Offset: 0x40) Programmable Clock Register -------- +// -------- PMC_IER : (PMC Offset: 0x60) PMC Interrupt Enable Register -------- +#define AT91C_PMC_MOSCS ((unsigned int) 0x1 << 0) // (PMC) MOSC Status/Enable/Disable/Mask +#define AT91C_PMC_LOCK ((unsigned int) 0x1 << 2) // (PMC) PLL Status/Enable/Disable/Mask +#define AT91C_PMC_MCKRDY ((unsigned int) 0x1 << 3) // (PMC) MCK_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK0RDY ((unsigned int) 0x1 << 8) // (PMC) PCK0_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK1RDY ((unsigned int) 0x1 << 9) // (PMC) PCK1_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK2RDY ((unsigned int) 0x1 << 10) // (PMC) PCK2_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK3RDY ((unsigned int) 0x1 << 11) // (PMC) PCK3_RDY Status/Enable/Disable/Mask +// -------- PMC_IDR : (PMC Offset: 0x64) PMC Interrupt Disable Register -------- +// -------- PMC_SR : (PMC Offset: 0x68) PMC Status Register -------- +// -------- PMC_IMR : (PMC Offset: 0x6c) PMC Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Reset Controller Interface +// ***************************************************************************** +typedef struct _AT91S_RSTC { + AT91_REG RSTC_RCR; // Reset Control Register + AT91_REG RSTC_RSR; // Reset Status Register + AT91_REG RSTC_RMR; // Reset Mode Register +} AT91S_RSTC, *AT91PS_RSTC; + +// -------- RSTC_RCR : (RSTC Offset: 0x0) Reset Control Register -------- +#define AT91C_RSTC_PROCRST ((unsigned int) 0x1 << 0) // (RSTC) Processor Reset +#define AT91C_RSTC_PERRST ((unsigned int) 0x1 << 2) // (RSTC) Peripheral Reset +#define AT91C_RSTC_EXTRST ((unsigned int) 0x1 << 3) // (RSTC) External Reset +#define AT91C_RSTC_KEY ((unsigned int) 0xFF << 24) // (RSTC) Password +// -------- RSTC_RSR : (RSTC Offset: 0x4) Reset Status Register -------- +#define AT91C_RSTC_URSTS ((unsigned int) 0x1 << 0) // (RSTC) User Reset Status +#define AT91C_RSTC_BODSTS ((unsigned int) 0x1 << 1) // (RSTC) Brownout Detection Status +#define AT91C_RSTC_RSTTYP ((unsigned int) 0x7 << 8) // (RSTC) Reset Type +#define AT91C_RSTC_RSTTYP_POWERUP ((unsigned int) 0x0 << 8) // (RSTC) Power-up Reset. VDDCORE rising. +#define AT91C_RSTC_RSTTYP_WAKEUP ((unsigned int) 0x1 << 8) // (RSTC) WakeUp Reset. VDDCORE rising. +#define AT91C_RSTC_RSTTYP_WATCHDOG ((unsigned int) 0x2 << 8) // (RSTC) Watchdog Reset. Watchdog overflow occured. +#define AT91C_RSTC_RSTTYP_SOFTWARE ((unsigned int) 0x3 << 8) // (RSTC) Software Reset. Processor reset required by the software. +#define AT91C_RSTC_RSTTYP_USER ((unsigned int) 0x4 << 8) // (RSTC) User Reset. NRST pin detected low. +#define AT91C_RSTC_RSTTYP_BROWNOUT ((unsigned int) 0x5 << 8) // (RSTC) Brownout Reset occured. +#define AT91C_RSTC_NRSTL ((unsigned int) 0x1 << 16) // (RSTC) NRST pin level +#define AT91C_RSTC_SRCMP ((unsigned int) 0x1 << 17) // (RSTC) Software Reset Command in Progress. +// -------- RSTC_RMR : (RSTC Offset: 0x8) Reset Mode Register -------- +#define AT91C_RSTC_URSTEN ((unsigned int) 0x1 << 0) // (RSTC) User Reset Enable +#define AT91C_RSTC_URSTIEN ((unsigned int) 0x1 << 4) // (RSTC) User Reset Interrupt Enable +#define AT91C_RSTC_ERSTL ((unsigned int) 0xF << 8) // (RSTC) User Reset Length +#define AT91C_RSTC_BODIEN ((unsigned int) 0x1 << 16) // (RSTC) Brownout Detection Interrupt Enable + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Real Time Timer Controller Interface +// ***************************************************************************** +typedef struct _AT91S_RTTC { + AT91_REG RTTC_RTMR; // Real-time Mode Register + AT91_REG RTTC_RTAR; // Real-time Alarm Register + AT91_REG RTTC_RTVR; // Real-time Value Register + AT91_REG RTTC_RTSR; // Real-time Status Register +} AT91S_RTTC, *AT91PS_RTTC; + +// -------- RTTC_RTMR : (RTTC Offset: 0x0) Real-time Mode Register -------- +#define AT91C_RTTC_RTPRES ((unsigned int) 0xFFFF << 0) // (RTTC) Real-time Timer Prescaler Value +#define AT91C_RTTC_ALMIEN ((unsigned int) 0x1 << 16) // (RTTC) Alarm Interrupt Enable +#define AT91C_RTTC_RTTINCIEN ((unsigned int) 0x1 << 17) // (RTTC) Real Time Timer Increment Interrupt Enable +#define AT91C_RTTC_RTTRST ((unsigned int) 0x1 << 18) // (RTTC) Real Time Timer Restart +// -------- RTTC_RTAR : (RTTC Offset: 0x4) Real-time Alarm Register -------- +#define AT91C_RTTC_ALMV ((unsigned int) 0x0 << 0) // (RTTC) Alarm Value +// -------- RTTC_RTVR : (RTTC Offset: 0x8) Current Real-time Value Register -------- +#define AT91C_RTTC_CRTV ((unsigned int) 0x0 << 0) // (RTTC) Current Real-time Value +// -------- RTTC_RTSR : (RTTC Offset: 0xc) Real-time Status Register -------- +#define AT91C_RTTC_ALMS ((unsigned int) 0x1 << 0) // (RTTC) Real-time Alarm Status +#define AT91C_RTTC_RTTINC ((unsigned int) 0x1 << 1) // (RTTC) Real-time Timer Increment + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Periodic Interval Timer Controller Interface +// ***************************************************************************** +typedef struct _AT91S_PITC { + AT91_REG PITC_PIMR; // Period Interval Mode Register + AT91_REG PITC_PISR; // Period Interval Status Register + AT91_REG PITC_PIVR; // Period Interval Value Register + AT91_REG PITC_PIIR; // Period Interval Image Register +} AT91S_PITC, *AT91PS_PITC; + +// -------- PITC_PIMR : (PITC Offset: 0x0) Periodic Interval Mode Register -------- +#define AT91C_PITC_PIV ((unsigned int) 0xFFFFF << 0) // (PITC) Periodic Interval Value +#define AT91C_PITC_PITEN ((unsigned int) 0x1 << 24) // (PITC) Periodic Interval Timer Enabled +#define AT91C_PITC_PITIEN ((unsigned int) 0x1 << 25) // (PITC) Periodic Interval Timer Interrupt Enable +// -------- PITC_PISR : (PITC Offset: 0x4) Periodic Interval Status Register -------- +#define AT91C_PITC_PITS ((unsigned int) 0x1 << 0) // (PITC) Periodic Interval Timer Status +// -------- PITC_PIVR : (PITC Offset: 0x8) Periodic Interval Value Register -------- +#define AT91C_PITC_CPIV ((unsigned int) 0xFFFFF << 0) // (PITC) Current Periodic Interval Value +#define AT91C_PITC_PICNT ((unsigned int) 0xFFF << 20) // (PITC) Periodic Interval Counter +// -------- PITC_PIIR : (PITC Offset: 0xc) Periodic Interval Image Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Watchdog Timer Controller Interface +// ***************************************************************************** +typedef struct _AT91S_WDTC { + AT91_REG WDTC_WDCR; // Watchdog Control Register + AT91_REG WDTC_WDMR; // Watchdog Mode Register + AT91_REG WDTC_WDSR; // Watchdog Status Register +} AT91S_WDTC, *AT91PS_WDTC; + +// -------- WDTC_WDCR : (WDTC Offset: 0x0) Periodic Interval Image Register -------- +#define AT91C_WDTC_WDRSTT ((unsigned int) 0x1 << 0) // (WDTC) Watchdog Restart +#define AT91C_WDTC_KEY ((unsigned int) 0xFF << 24) // (WDTC) Watchdog KEY Password +// -------- WDTC_WDMR : (WDTC Offset: 0x4) Watchdog Mode Register -------- +#define AT91C_WDTC_WDV ((unsigned int) 0xFFF << 0) // (WDTC) Watchdog Timer Restart +#define AT91C_WDTC_WDFIEN ((unsigned int) 0x1 << 12) // (WDTC) Watchdog Fault Interrupt Enable +#define AT91C_WDTC_WDRSTEN ((unsigned int) 0x1 << 13) // (WDTC) Watchdog Reset Enable +#define AT91C_WDTC_WDRPROC ((unsigned int) 0x1 << 14) // (WDTC) Watchdog Timer Restart +#define AT91C_WDTC_WDDIS ((unsigned int) 0x1 << 15) // (WDTC) Watchdog Disable +#define AT91C_WDTC_WDD ((unsigned int) 0xFFF << 16) // (WDTC) Watchdog Delta Value +#define AT91C_WDTC_WDDBGHLT ((unsigned int) 0x1 << 28) // (WDTC) Watchdog Debug Halt +#define AT91C_WDTC_WDIDLEHLT ((unsigned int) 0x1 << 29) // (WDTC) Watchdog Idle Halt +// -------- WDTC_WDSR : (WDTC Offset: 0x8) Watchdog Status Register -------- +#define AT91C_WDTC_WDUNF ((unsigned int) 0x1 << 0) // (WDTC) Watchdog Underflow +#define AT91C_WDTC_WDERR ((unsigned int) 0x1 << 1) // (WDTC) Watchdog Error + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Voltage Regulator Mode Controller Interface +// ***************************************************************************** +typedef struct _AT91S_VREG { + AT91_REG VREG_MR; // Voltage Regulator Mode Register +} AT91S_VREG, *AT91PS_VREG; + +// -------- VREG_MR : (VREG Offset: 0x0) Voltage Regulator Mode Register -------- +#define AT91C_VREG_PSTDBY ((unsigned int) 0x1 << 0) // (VREG) Voltage Regulator Power Standby Mode + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Memory Controller Interface +// ***************************************************************************** +typedef struct _AT91S_MC { + AT91_REG MC_RCR; // MC Remap Control Register + AT91_REG MC_ASR; // MC Abort Status Register + AT91_REG MC_AASR; // MC Abort Address Status Register + AT91_REG Reserved0[21]; // + AT91_REG MC_FMR; // MC Flash Mode Register + AT91_REG MC_FCR; // MC Flash Command Register + AT91_REG MC_FSR; // MC Flash Status Register +} AT91S_MC, *AT91PS_MC; + +// -------- MC_RCR : (MC Offset: 0x0) MC Remap Control Register -------- +#define AT91C_MC_RCB ((unsigned int) 0x1 << 0) // (MC) Remap Command Bit +// -------- MC_ASR : (MC Offset: 0x4) MC Abort Status Register -------- +#define AT91C_MC_UNDADD ((unsigned int) 0x1 << 0) // (MC) Undefined Addess Abort Status +#define AT91C_MC_MISADD ((unsigned int) 0x1 << 1) // (MC) Misaligned Addess Abort Status +#define AT91C_MC_ABTSZ ((unsigned int) 0x3 << 8) // (MC) Abort Size Status +#define AT91C_MC_ABTSZ_BYTE ((unsigned int) 0x0 << 8) // (MC) Byte +#define AT91C_MC_ABTSZ_HWORD ((unsigned int) 0x1 << 8) // (MC) Half-word +#define AT91C_MC_ABTSZ_WORD ((unsigned int) 0x2 << 8) // (MC) Word +#define AT91C_MC_ABTTYP ((unsigned int) 0x3 << 10) // (MC) Abort Type Status +#define AT91C_MC_ABTTYP_DATAR ((unsigned int) 0x0 << 10) // (MC) Data Read +#define AT91C_MC_ABTTYP_DATAW ((unsigned int) 0x1 << 10) // (MC) Data Write +#define AT91C_MC_ABTTYP_FETCH ((unsigned int) 0x2 << 10) // (MC) Code Fetch +#define AT91C_MC_MST0 ((unsigned int) 0x1 << 16) // (MC) Master 0 Abort Source +#define AT91C_MC_MST1 ((unsigned int) 0x1 << 17) // (MC) Master 1 Abort Source +#define AT91C_MC_SVMST0 ((unsigned int) 0x1 << 24) // (MC) Saved Master 0 Abort Source +#define AT91C_MC_SVMST1 ((unsigned int) 0x1 << 25) // (MC) Saved Master 1 Abort Source +// -------- MC_FMR : (MC Offset: 0x60) MC Flash Mode Register -------- +#define AT91C_MC_FRDY ((unsigned int) 0x1 << 0) // (MC) Flash Ready +#define AT91C_MC_LOCKE ((unsigned int) 0x1 << 2) // (MC) Lock Error +#define AT91C_MC_PROGE ((unsigned int) 0x1 << 3) // (MC) Programming Error +#define AT91C_MC_NEBP ((unsigned int) 0x1 << 7) // (MC) No Erase Before Programming +#define AT91C_MC_FWS ((unsigned int) 0x3 << 8) // (MC) Flash Wait State +#define AT91C_MC_FWS_0FWS ((unsigned int) 0x0 << 8) // (MC) 1 cycle for Read, 2 for Write operations +#define AT91C_MC_FWS_1FWS ((unsigned int) 0x1 << 8) // (MC) 2 cycles for Read, 3 for Write operations +#define AT91C_MC_FWS_2FWS ((unsigned int) 0x2 << 8) // (MC) 3 cycles for Read, 4 for Write operations +#define AT91C_MC_FWS_3FWS ((unsigned int) 0x3 << 8) // (MC) 4 cycles for Read, 4 for Write operations +#define AT91C_MC_FMCN ((unsigned int) 0xFF << 16) // (MC) Flash Microsecond Cycle Number +// -------- MC_FCR : (MC Offset: 0x64) MC Flash Command Register -------- +#define AT91C_MC_FCMD ((unsigned int) 0xF << 0) // (MC) Flash Command +#define AT91C_MC_FCMD_START_PROG ((unsigned int) 0x1) // (MC) Starts the programming of th epage specified by PAGEN. +#define AT91C_MC_FCMD_LOCK ((unsigned int) 0x2) // (MC) Starts a lock sequence of the sector defined by the bits 4 to 7 of the field PAGEN. +#define AT91C_MC_FCMD_PROG_AND_LOCK ((unsigned int) 0x3) // (MC) The lock sequence automatically happens after the programming sequence is completed. +#define AT91C_MC_FCMD_UNLOCK ((unsigned int) 0x4) // (MC) Starts an unlock sequence of the sector defined by the bits 4 to 7 of the field PAGEN. +#define AT91C_MC_FCMD_ERASE_ALL ((unsigned int) 0x8) // (MC) Starts the erase of the entire flash.If at least a page is locked, the command is cancelled. +#define AT91C_MC_FCMD_SET_GP_NVM ((unsigned int) 0xB) // (MC) Set General Purpose NVM bits. +#define AT91C_MC_FCMD_CLR_GP_NVM ((unsigned int) 0xD) // (MC) Clear General Purpose NVM bits. +#define AT91C_MC_FCMD_SET_SECURITY ((unsigned int) 0xF) // (MC) Set Security Bit. +#define AT91C_MC_PAGEN ((unsigned int) 0x3FF << 8) // (MC) Page Number +#define AT91C_MC_KEY ((unsigned int) 0xFF << 24) // (MC) Writing Protect Key +// -------- MC_FSR : (MC Offset: 0x68) MC Flash Command Register -------- +#define AT91C_MC_SECURITY ((unsigned int) 0x1 << 4) // (MC) Security Bit Status +#define AT91C_MC_GPNVM0 ((unsigned int) 0x1 << 8) // (MC) Sector 0 Lock Status +#define AT91C_MC_GPNVM1 ((unsigned int) 0x1 << 9) // (MC) Sector 1 Lock Status +#define AT91C_MC_GPNVM2 ((unsigned int) 0x1 << 10) // (MC) Sector 2 Lock Status +#define AT91C_MC_GPNVM3 ((unsigned int) 0x1 << 11) // (MC) Sector 3 Lock Status +#define AT91C_MC_GPNVM4 ((unsigned int) 0x1 << 12) // (MC) Sector 4 Lock Status +#define AT91C_MC_GPNVM5 ((unsigned int) 0x1 << 13) // (MC) Sector 5 Lock Status +#define AT91C_MC_GPNVM6 ((unsigned int) 0x1 << 14) // (MC) Sector 6 Lock Status +#define AT91C_MC_GPNVM7 ((unsigned int) 0x1 << 15) // (MC) Sector 7 Lock Status +#define AT91C_MC_LOCKS0 ((unsigned int) 0x1 << 16) // (MC) Sector 0 Lock Status +#define AT91C_MC_LOCKS1 ((unsigned int) 0x1 << 17) // (MC) Sector 1 Lock Status +#define AT91C_MC_LOCKS2 ((unsigned int) 0x1 << 18) // (MC) Sector 2 Lock Status +#define AT91C_MC_LOCKS3 ((unsigned int) 0x1 << 19) // (MC) Sector 3 Lock Status +#define AT91C_MC_LOCKS4 ((unsigned int) 0x1 << 20) // (MC) Sector 4 Lock Status +#define AT91C_MC_LOCKS5 ((unsigned int) 0x1 << 21) // (MC) Sector 5 Lock Status +#define AT91C_MC_LOCKS6 ((unsigned int) 0x1 << 22) // (MC) Sector 6 Lock Status +#define AT91C_MC_LOCKS7 ((unsigned int) 0x1 << 23) // (MC) Sector 7 Lock Status +#define AT91C_MC_LOCKS8 ((unsigned int) 0x1 << 24) // (MC) Sector 8 Lock Status +#define AT91C_MC_LOCKS9 ((unsigned int) 0x1 << 25) // (MC) Sector 9 Lock Status +#define AT91C_MC_LOCKS10 ((unsigned int) 0x1 << 26) // (MC) Sector 10 Lock Status +#define AT91C_MC_LOCKS11 ((unsigned int) 0x1 << 27) // (MC) Sector 11 Lock Status +#define AT91C_MC_LOCKS12 ((unsigned int) 0x1 << 28) // (MC) Sector 12 Lock Status +#define AT91C_MC_LOCKS13 ((unsigned int) 0x1 << 29) // (MC) Sector 13 Lock Status +#define AT91C_MC_LOCKS14 ((unsigned int) 0x1 << 30) // (MC) Sector 14 Lock Status +#define AT91C_MC_LOCKS15 ((unsigned int) 0x1 << 31) // (MC) Sector 15 Lock Status + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Serial Parallel Interface +// ***************************************************************************** +typedef struct _AT91S_SPI { + AT91_REG SPI_CR; // Control Register + AT91_REG SPI_MR; // Mode Register + AT91_REG SPI_RDR; // Receive Data Register + AT91_REG SPI_TDR; // Transmit Data Register + AT91_REG SPI_SR; // Status Register + AT91_REG SPI_IER; // Interrupt Enable Register + AT91_REG SPI_IDR; // Interrupt Disable Register + AT91_REG SPI_IMR; // Interrupt Mask Register + AT91_REG Reserved0[4]; // + AT91_REG SPI_CSR[4]; // Chip Select Register + AT91_REG Reserved1[48]; // + AT91_REG SPI_RPR; // Receive Pointer Register + AT91_REG SPI_RCR; // Receive Counter Register + AT91_REG SPI_TPR; // Transmit Pointer Register + AT91_REG SPI_TCR; // Transmit Counter Register + AT91_REG SPI_RNPR; // Receive Next Pointer Register + AT91_REG SPI_RNCR; // Receive Next Counter Register + AT91_REG SPI_TNPR; // Transmit Next Pointer Register + AT91_REG SPI_TNCR; // Transmit Next Counter Register + AT91_REG SPI_PTCR; // PDC Transfer Control Register + AT91_REG SPI_PTSR; // PDC Transfer Status Register +} AT91S_SPI, *AT91PS_SPI; + +// -------- SPI_CR : (SPI Offset: 0x0) SPI Control Register -------- +#define AT91C_SPI_SPIEN ((unsigned int) 0x1 << 0) // (SPI) SPI Enable +#define AT91C_SPI_SPIDIS ((unsigned int) 0x1 << 1) // (SPI) SPI Disable +#define AT91C_SPI_SWRST ((unsigned int) 0x1 << 7) // (SPI) SPI Software reset +#define AT91C_SPI_LASTXFER ((unsigned int) 0x1 << 24) // (SPI) SPI Last Transfer +// -------- SPI_MR : (SPI Offset: 0x4) SPI Mode Register -------- +#define AT91C_SPI_MSTR ((unsigned int) 0x1 << 0) // (SPI) Master/Slave Mode +#define AT91C_SPI_PS ((unsigned int) 0x1 << 1) // (SPI) Peripheral Select +#define AT91C_SPI_PS_FIXED ((unsigned int) 0x0 << 1) // (SPI) Fixed Peripheral Select +#define AT91C_SPI_PS_VARIABLE ((unsigned int) 0x1 << 1) // (SPI) Variable Peripheral Select +#define AT91C_SPI_PCSDEC ((unsigned int) 0x1 << 2) // (SPI) Chip Select Decode +#define AT91C_SPI_FDIV ((unsigned int) 0x1 << 3) // (SPI) Clock Selection +#define AT91C_SPI_MODFDIS ((unsigned int) 0x1 << 4) // (SPI) Mode Fault Detection +#define AT91C_SPI_LLB ((unsigned int) 0x1 << 7) // (SPI) Clock Selection +#define AT91C_SPI_PCS ((unsigned int) 0xF << 16) // (SPI) Peripheral Chip Select +#define AT91C_SPI_DLYBCS ((unsigned int) 0xFF << 24) // (SPI) Delay Between Chip Selects +// -------- SPI_RDR : (SPI Offset: 0x8) Receive Data Register -------- +#define AT91C_SPI_RD ((unsigned int) 0xFFFF << 0) // (SPI) Receive Data +#define AT91C_SPI_RPCS ((unsigned int) 0xF << 16) // (SPI) Peripheral Chip Select Status +// -------- SPI_TDR : (SPI Offset: 0xc) Transmit Data Register -------- +#define AT91C_SPI_TD ((unsigned int) 0xFFFF << 0) // (SPI) Transmit Data +#define AT91C_SPI_TPCS ((unsigned int) 0xF << 16) // (SPI) Peripheral Chip Select Status +// -------- SPI_SR : (SPI Offset: 0x10) Status Register -------- +#define AT91C_SPI_RDRF ((unsigned int) 0x1 << 0) // (SPI) Receive Data Register Full +#define AT91C_SPI_TDRE ((unsigned int) 0x1 << 1) // (SPI) Transmit Data Register Empty +#define AT91C_SPI_MODF ((unsigned int) 0x1 << 2) // (SPI) Mode Fault Error +#define AT91C_SPI_OVRES ((unsigned int) 0x1 << 3) // (SPI) Overrun Error Status +#define AT91C_SPI_ENDRX ((unsigned int) 0x1 << 4) // (SPI) End of Receiver Transfer +#define AT91C_SPI_ENDTX ((unsigned int) 0x1 << 5) // (SPI) End of Receiver Transfer +#define AT91C_SPI_RXBUFF ((unsigned int) 0x1 << 6) // (SPI) RXBUFF Interrupt +#define AT91C_SPI_TXBUFE ((unsigned int) 0x1 << 7) // (SPI) TXBUFE Interrupt +#define AT91C_SPI_NSSR ((unsigned int) 0x1 << 8) // (SPI) NSSR Interrupt +#define AT91C_SPI_TXEMPTY ((unsigned int) 0x1 << 9) // (SPI) TXEMPTY Interrupt +#define AT91C_SPI_SPIENS ((unsigned int) 0x1 << 16) // (SPI) Enable Status +// -------- SPI_IER : (SPI Offset: 0x14) Interrupt Enable Register -------- +// -------- SPI_IDR : (SPI Offset: 0x18) Interrupt Disable Register -------- +// -------- SPI_IMR : (SPI Offset: 0x1c) Interrupt Mask Register -------- +// -------- SPI_CSR : (SPI Offset: 0x30) Chip Select Register -------- +#define AT91C_SPI_CPOL ((unsigned int) 0x1 << 0) // (SPI) Clock Polarity +#define AT91C_SPI_NCPHA ((unsigned int) 0x1 << 1) // (SPI) Clock Phase +#define AT91C_SPI_CSAAT ((unsigned int) 0x1 << 3) // (SPI) Chip Select Active After Transfer +#define AT91C_SPI_BITS ((unsigned int) 0xF << 4) // (SPI) Bits Per Transfer +#define AT91C_SPI_BITS_8 ((unsigned int) 0x0 << 4) // (SPI) 8 Bits Per transfer +#define AT91C_SPI_BITS_9 ((unsigned int) 0x1 << 4) // (SPI) 9 Bits Per transfer +#define AT91C_SPI_BITS_10 ((unsigned int) 0x2 << 4) // (SPI) 10 Bits Per transfer +#define AT91C_SPI_BITS_11 ((unsigned int) 0x3 << 4) // (SPI) 11 Bits Per transfer +#define AT91C_SPI_BITS_12 ((unsigned int) 0x4 << 4) // (SPI) 12 Bits Per transfer +#define AT91C_SPI_BITS_13 ((unsigned int) 0x5 << 4) // (SPI) 13 Bits Per transfer +#define AT91C_SPI_BITS_14 ((unsigned int) 0x6 << 4) // (SPI) 14 Bits Per transfer +#define AT91C_SPI_BITS_15 ((unsigned int) 0x7 << 4) // (SPI) 15 Bits Per transfer +#define AT91C_SPI_BITS_16 ((unsigned int) 0x8 << 4) // (SPI) 16 Bits Per transfer +#define AT91C_SPI_SCBR ((unsigned int) 0xFF << 8) // (SPI) Serial Clock Baud Rate +#define AT91C_SPI_DLYBS ((unsigned int) 0xFF << 16) // (SPI) Delay Before SPCK +#define AT91C_SPI_DLYBCT ((unsigned int) 0xFF << 24) // (SPI) Delay Between Consecutive Transfers + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Usart +// ***************************************************************************** +typedef struct _AT91S_USART { + AT91_REG US_CR; // Control Register + AT91_REG US_MR; // Mode Register + AT91_REG US_IER; // Interrupt Enable Register + AT91_REG US_IDR; // Interrupt Disable Register + AT91_REG US_IMR; // Interrupt Mask Register + AT91_REG US_CSR; // Channel Status Register + AT91_REG US_RHR; // Receiver Holding Register + AT91_REG US_THR; // Transmitter Holding Register + AT91_REG US_BRGR; // Baud Rate Generator Register + AT91_REG US_RTOR; // Receiver Time-out Register + AT91_REG US_TTGR; // Transmitter Time-guard Register + AT91_REG Reserved0[5]; // + AT91_REG US_FIDI; // FI_DI_Ratio Register + AT91_REG US_NER; // Nb Errors Register + AT91_REG Reserved1[1]; // + AT91_REG US_IF; // IRDA_FILTER Register + AT91_REG Reserved2[44]; // + AT91_REG US_RPR; // Receive Pointer Register + AT91_REG US_RCR; // Receive Counter Register + AT91_REG US_TPR; // Transmit Pointer Register + AT91_REG US_TCR; // Transmit Counter Register + AT91_REG US_RNPR; // Receive Next Pointer Register + AT91_REG US_RNCR; // Receive Next Counter Register + AT91_REG US_TNPR; // Transmit Next Pointer Register + AT91_REG US_TNCR; // Transmit Next Counter Register + AT91_REG US_PTCR; // PDC Transfer Control Register + AT91_REG US_PTSR; // PDC Transfer Status Register +} AT91S_USART, *AT91PS_USART; + +// -------- US_CR : (USART Offset: 0x0) Debug Unit Control Register -------- +#define AT91C_US_STTBRK ((unsigned int) 0x1 << 9) // (USART) Start Break +#define AT91C_US_STPBRK ((unsigned int) 0x1 << 10) // (USART) Stop Break +#define AT91C_US_STTTO ((unsigned int) 0x1 << 11) // (USART) Start Time-out +#define AT91C_US_SENDA ((unsigned int) 0x1 << 12) // (USART) Send Address +#define AT91C_US_RSTIT ((unsigned int) 0x1 << 13) // (USART) Reset Iterations +#define AT91C_US_RSTNACK ((unsigned int) 0x1 << 14) // (USART) Reset Non Acknowledge +#define AT91C_US_RETTO ((unsigned int) 0x1 << 15) // (USART) Rearm Time-out +#define AT91C_US_DTREN ((unsigned int) 0x1 << 16) // (USART) Data Terminal ready Enable +#define AT91C_US_DTRDIS ((unsigned int) 0x1 << 17) // (USART) Data Terminal ready Disable +#define AT91C_US_RTSEN ((unsigned int) 0x1 << 18) // (USART) Request to Send enable +#define AT91C_US_RTSDIS ((unsigned int) 0x1 << 19) // (USART) Request to Send Disable +// -------- US_MR : (USART Offset: 0x4) Debug Unit Mode Register -------- +#define AT91C_US_USMODE ((unsigned int) 0xF << 0) // (USART) Usart mode +#define AT91C_US_USMODE_NORMAL ((unsigned int) 0x0) // (USART) Normal +#define AT91C_US_USMODE_RS485 ((unsigned int) 0x1) // (USART) RS485 +#define AT91C_US_USMODE_HWHSH ((unsigned int) 0x2) // (USART) Hardware Handshaking +#define AT91C_US_USMODE_MODEM ((unsigned int) 0x3) // (USART) Modem +#define AT91C_US_USMODE_ISO7816_0 ((unsigned int) 0x4) // (USART) ISO7816 protocol: T = 0 +#define AT91C_US_USMODE_ISO7816_1 ((unsigned int) 0x6) // (USART) ISO7816 protocol: T = 1 +#define AT91C_US_USMODE_IRDA ((unsigned int) 0x8) // (USART) IrDA +#define AT91C_US_USMODE_SWHSH ((unsigned int) 0xC) // (USART) Software Handshaking +#define AT91C_US_CLKS ((unsigned int) 0x3 << 4) // (USART) Clock Selection (Baud Rate generator Input Clock +#define AT91C_US_CLKS_CLOCK ((unsigned int) 0x0 << 4) // (USART) Clock +#define AT91C_US_CLKS_FDIV1 ((unsigned int) 0x1 << 4) // (USART) fdiv1 +#define AT91C_US_CLKS_SLOW ((unsigned int) 0x2 << 4) // (USART) slow_clock (ARM) +#define AT91C_US_CLKS_EXT ((unsigned int) 0x3 << 4) // (USART) External (SCK) +#define AT91C_US_CHRL ((unsigned int) 0x3 << 6) // (USART) Clock Selection (Baud Rate generator Input Clock +#define AT91C_US_CHRL_5_BITS ((unsigned int) 0x0 << 6) // (USART) Character Length: 5 bits +#define AT91C_US_CHRL_6_BITS ((unsigned int) 0x1 << 6) // (USART) Character Length: 6 bits +#define AT91C_US_CHRL_7_BITS ((unsigned int) 0x2 << 6) // (USART) Character Length: 7 bits +#define AT91C_US_CHRL_8_BITS ((unsigned int) 0x3 << 6) // (USART) Character Length: 8 bits +#define AT91C_US_SYNC ((unsigned int) 0x1 << 8) // (USART) Synchronous Mode Select +#define AT91C_US_NBSTOP ((unsigned int) 0x3 << 12) // (USART) Number of Stop bits +#define AT91C_US_NBSTOP_1_BIT ((unsigned int) 0x0 << 12) // (USART) 1 stop bit +#define AT91C_US_NBSTOP_15_BIT ((unsigned int) 0x1 << 12) // (USART) Asynchronous (SYNC=0) 2 stop bits Synchronous (SYNC=1) 2 stop bits +#define AT91C_US_NBSTOP_2_BIT ((unsigned int) 0x2 << 12) // (USART) 2 stop bits +#define AT91C_US_MSBF ((unsigned int) 0x1 << 16) // (USART) Bit Order +#define AT91C_US_MODE9 ((unsigned int) 0x1 << 17) // (USART) 9-bit Character length +#define AT91C_US_CKLO ((unsigned int) 0x1 << 18) // (USART) Clock Output Select +#define AT91C_US_OVER ((unsigned int) 0x1 << 19) // (USART) Over Sampling Mode +#define AT91C_US_INACK ((unsigned int) 0x1 << 20) // (USART) Inhibit Non Acknowledge +#define AT91C_US_DSNACK ((unsigned int) 0x1 << 21) // (USART) Disable Successive NACK +#define AT91C_US_MAX_ITER ((unsigned int) 0x1 << 24) // (USART) Number of Repetitions +#define AT91C_US_FILTER ((unsigned int) 0x1 << 28) // (USART) Receive Line Filter +// -------- US_IER : (USART Offset: 0x8) Debug Unit Interrupt Enable Register -------- +#define AT91C_US_RXBRK ((unsigned int) 0x1 << 2) // (USART) Break Received/End of Break +#define AT91C_US_TIMEOUT ((unsigned int) 0x1 << 8) // (USART) Receiver Time-out +#define AT91C_US_ITERATION ((unsigned int) 0x1 << 10) // (USART) Max number of Repetitions Reached +#define AT91C_US_NACK ((unsigned int) 0x1 << 13) // (USART) Non Acknowledge +#define AT91C_US_RIIC ((unsigned int) 0x1 << 16) // (USART) Ring INdicator Input Change Flag +#define AT91C_US_DSRIC ((unsigned int) 0x1 << 17) // (USART) Data Set Ready Input Change Flag +#define AT91C_US_DCDIC ((unsigned int) 0x1 << 18) // (USART) Data Carrier Flag +#define AT91C_US_CTSIC ((unsigned int) 0x1 << 19) // (USART) Clear To Send Input Change Flag +// -------- US_IDR : (USART Offset: 0xc) Debug Unit Interrupt Disable Register -------- +// -------- US_IMR : (USART Offset: 0x10) Debug Unit Interrupt Mask Register -------- +// -------- US_CSR : (USART Offset: 0x14) Debug Unit Channel Status Register -------- +#define AT91C_US_RI ((unsigned int) 0x1 << 20) // (USART) Image of RI Input +#define AT91C_US_DSR ((unsigned int) 0x1 << 21) // (USART) Image of DSR Input +#define AT91C_US_DCD ((unsigned int) 0x1 << 22) // (USART) Image of DCD Input +#define AT91C_US_CTS ((unsigned int) 0x1 << 23) // (USART) Image of CTS Input + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Synchronous Serial Controller Interface +// ***************************************************************************** +typedef struct _AT91S_SSC { + AT91_REG SSC_CR; // Control Register + AT91_REG SSC_CMR; // Clock Mode Register + AT91_REG Reserved0[2]; // + AT91_REG SSC_RCMR; // Receive Clock ModeRegister + AT91_REG SSC_RFMR; // Receive Frame Mode Register + AT91_REG SSC_TCMR; // Transmit Clock Mode Register + AT91_REG SSC_TFMR; // Transmit Frame Mode Register + AT91_REG SSC_RHR; // Receive Holding Register + AT91_REG SSC_THR; // Transmit Holding Register + AT91_REG Reserved1[2]; // + AT91_REG SSC_RSHR; // Receive Sync Holding Register + AT91_REG SSC_TSHR; // Transmit Sync Holding Register + AT91_REG Reserved2[2]; // + AT91_REG SSC_SR; // Status Register + AT91_REG SSC_IER; // Interrupt Enable Register + AT91_REG SSC_IDR; // Interrupt Disable Register + AT91_REG SSC_IMR; // Interrupt Mask Register + AT91_REG Reserved3[44]; // + AT91_REG SSC_RPR; // Receive Pointer Register + AT91_REG SSC_RCR; // Receive Counter Register + AT91_REG SSC_TPR; // Transmit Pointer Register + AT91_REG SSC_TCR; // Transmit Counter Register + AT91_REG SSC_RNPR; // Receive Next Pointer Register + AT91_REG SSC_RNCR; // Receive Next Counter Register + AT91_REG SSC_TNPR; // Transmit Next Pointer Register + AT91_REG SSC_TNCR; // Transmit Next Counter Register + AT91_REG SSC_PTCR; // PDC Transfer Control Register + AT91_REG SSC_PTSR; // PDC Transfer Status Register +} AT91S_SSC, *AT91PS_SSC; + +// -------- SSC_CR : (SSC Offset: 0x0) SSC Control Register -------- +#define AT91C_SSC_RXEN ((unsigned int) 0x1 << 0) // (SSC) Receive Enable +#define AT91C_SSC_RXDIS ((unsigned int) 0x1 << 1) // (SSC) Receive Disable +#define AT91C_SSC_TXEN ((unsigned int) 0x1 << 8) // (SSC) Transmit Enable +#define AT91C_SSC_TXDIS ((unsigned int) 0x1 << 9) // (SSC) Transmit Disable +#define AT91C_SSC_SWRST ((unsigned int) 0x1 << 15) // (SSC) Software Reset +// -------- SSC_RCMR : (SSC Offset: 0x10) SSC Receive Clock Mode Register -------- +#define AT91C_SSC_CKS ((unsigned int) 0x3 << 0) // (SSC) Receive/Transmit Clock Selection +#define AT91C_SSC_CKS_DIV ((unsigned int) 0x0) // (SSC) Divided Clock +#define AT91C_SSC_CKS_TK ((unsigned int) 0x1) // (SSC) TK Clock signal +#define AT91C_SSC_CKS_RK ((unsigned int) 0x2) // (SSC) RK pin +#define AT91C_SSC_CKO ((unsigned int) 0x7 << 2) // (SSC) Receive/Transmit Clock Output Mode Selection +#define AT91C_SSC_CKO_NONE ((unsigned int) 0x0 << 2) // (SSC) Receive/Transmit Clock Output Mode: None RK pin: Input-only +#define AT91C_SSC_CKO_CONTINOUS ((unsigned int) 0x1 << 2) // (SSC) Continuous Receive/Transmit Clock RK pin: Output +#define AT91C_SSC_CKO_DATA_TX ((unsigned int) 0x2 << 2) // (SSC) Receive/Transmit Clock only during data transfers RK pin: Output +#define AT91C_SSC_CKI ((unsigned int) 0x1 << 5) // (SSC) Receive/Transmit Clock Inversion +#define AT91C_SSC_CKG ((unsigned int) 0x3 << 6) // (SSC) Receive/Transmit Clock Gating Selection +#define AT91C_SSC_CKG_NONE ((unsigned int) 0x0 << 6) // (SSC) Receive/Transmit Clock Gating: None, continuous clock +#define AT91C_SSC_CKG_LOW ((unsigned int) 0x1 << 6) // (SSC) Receive/Transmit Clock enabled only if RF Low +#define AT91C_SSC_CKG_HIGH ((unsigned int) 0x2 << 6) // (SSC) Receive/Transmit Clock enabled only if RF High +#define AT91C_SSC_START ((unsigned int) 0xF << 8) // (SSC) Receive/Transmit Start Selection +#define AT91C_SSC_START_CONTINOUS ((unsigned int) 0x0 << 8) // (SSC) Continuous, as soon as the receiver is enabled, and immediately after the end of transfer of the previous data. +#define AT91C_SSC_START_TX ((unsigned int) 0x1 << 8) // (SSC) Transmit/Receive start +#define AT91C_SSC_START_LOW_RF ((unsigned int) 0x2 << 8) // (SSC) Detection of a low level on RF input +#define AT91C_SSC_START_HIGH_RF ((unsigned int) 0x3 << 8) // (SSC) Detection of a high level on RF input +#define AT91C_SSC_START_FALL_RF ((unsigned int) 0x4 << 8) // (SSC) Detection of a falling edge on RF input +#define AT91C_SSC_START_RISE_RF ((unsigned int) 0x5 << 8) // (SSC) Detection of a rising edge on RF input +#define AT91C_SSC_START_LEVEL_RF ((unsigned int) 0x6 << 8) // (SSC) Detection of any level change on RF input +#define AT91C_SSC_START_EDGE_RF ((unsigned int) 0x7 << 8) // (SSC) Detection of any edge on RF input +#define AT91C_SSC_START_0 ((unsigned int) 0x8 << 8) // (SSC) Compare 0 +#define AT91C_SSC_STOP ((unsigned int) 0x1 << 12) // (SSC) Receive Stop Selection +#define AT91C_SSC_STTDLY ((unsigned int) 0xFF << 16) // (SSC) Receive/Transmit Start Delay +#define AT91C_SSC_PERIOD ((unsigned int) 0xFF << 24) // (SSC) Receive/Transmit Period Divider Selection +// -------- SSC_RFMR : (SSC Offset: 0x14) SSC Receive Frame Mode Register -------- +#define AT91C_SSC_DATLEN ((unsigned int) 0x1F << 0) // (SSC) Data Length +#define AT91C_SSC_LOOP ((unsigned int) 0x1 << 5) // (SSC) Loop Mode +#define AT91C_SSC_MSBF ((unsigned int) 0x1 << 7) // (SSC) Most Significant Bit First +#define AT91C_SSC_DATNB ((unsigned int) 0xF << 8) // (SSC) Data Number per Frame +#define AT91C_SSC_FSLEN ((unsigned int) 0xF << 16) // (SSC) Receive/Transmit Frame Sync length +#define AT91C_SSC_FSOS ((unsigned int) 0x7 << 20) // (SSC) Receive/Transmit Frame Sync Output Selection +#define AT91C_SSC_FSOS_NONE ((unsigned int) 0x0 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: None RK pin Input-only +#define AT91C_SSC_FSOS_NEGATIVE ((unsigned int) 0x1 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Negative Pulse +#define AT91C_SSC_FSOS_POSITIVE ((unsigned int) 0x2 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Positive Pulse +#define AT91C_SSC_FSOS_LOW ((unsigned int) 0x3 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Driver Low during data transfer +#define AT91C_SSC_FSOS_HIGH ((unsigned int) 0x4 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Driver High during data transfer +#define AT91C_SSC_FSOS_TOGGLE ((unsigned int) 0x5 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Toggling at each start of data transfer +#define AT91C_SSC_FSEDGE ((unsigned int) 0x1 << 24) // (SSC) Frame Sync Edge Detection +// -------- SSC_TCMR : (SSC Offset: 0x18) SSC Transmit Clock Mode Register -------- +// -------- SSC_TFMR : (SSC Offset: 0x1c) SSC Transmit Frame Mode Register -------- +#define AT91C_SSC_DATDEF ((unsigned int) 0x1 << 5) // (SSC) Data Default Value +#define AT91C_SSC_FSDEN ((unsigned int) 0x1 << 23) // (SSC) Frame Sync Data Enable +// -------- SSC_SR : (SSC Offset: 0x40) SSC Status Register -------- +#define AT91C_SSC_TXRDY ((unsigned int) 0x1 << 0) // (SSC) Transmit Ready +#define AT91C_SSC_TXEMPTY ((unsigned int) 0x1 << 1) // (SSC) Transmit Empty +#define AT91C_SSC_ENDTX ((unsigned int) 0x1 << 2) // (SSC) End Of Transmission +#define AT91C_SSC_TXBUFE ((unsigned int) 0x1 << 3) // (SSC) Transmit Buffer Empty +#define AT91C_SSC_RXRDY ((unsigned int) 0x1 << 4) // (SSC) Receive Ready +#define AT91C_SSC_OVRUN ((unsigned int) 0x1 << 5) // (SSC) Receive Overrun +#define AT91C_SSC_ENDRX ((unsigned int) 0x1 << 6) // (SSC) End of Reception +#define AT91C_SSC_RXBUFF ((unsigned int) 0x1 << 7) // (SSC) Receive Buffer Full +#define AT91C_SSC_CP0 ((unsigned int) 0x1 << 8) // (SSC) Compare 0 +#define AT91C_SSC_CP1 ((unsigned int) 0x1 << 9) // (SSC) Compare 1 +#define AT91C_SSC_TXSYN ((unsigned int) 0x1 << 10) // (SSC) Transmit Sync +#define AT91C_SSC_RXSYN ((unsigned int) 0x1 << 11) // (SSC) Receive Sync +#define AT91C_SSC_TXENA ((unsigned int) 0x1 << 16) // (SSC) Transmit Enable +#define AT91C_SSC_RXENA ((unsigned int) 0x1 << 17) // (SSC) Receive Enable +// -------- SSC_IER : (SSC Offset: 0x44) SSC Interrupt Enable Register -------- +// -------- SSC_IDR : (SSC Offset: 0x48) SSC Interrupt Disable Register -------- +// -------- SSC_IMR : (SSC Offset: 0x4c) SSC Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Two-wire Interface +// ***************************************************************************** +typedef struct _AT91S_TWI { + AT91_REG TWI_CR; // Control Register + AT91_REG TWI_MMR; // Master Mode Register + AT91_REG Reserved0[1]; // + AT91_REG TWI_IADR; // Internal Address Register + AT91_REG TWI_CWGR; // Clock Waveform Generator Register + AT91_REG Reserved1[3]; // + AT91_REG TWI_SR; // Status Register + AT91_REG TWI_IER; // Interrupt Enable Register + AT91_REG TWI_IDR; // Interrupt Disable Register + AT91_REG TWI_IMR; // Interrupt Mask Register + AT91_REG TWI_RHR; // Receive Holding Register + AT91_REG TWI_THR; // Transmit Holding Register +} AT91S_TWI, *AT91PS_TWI; + +// -------- TWI_CR : (TWI Offset: 0x0) TWI Control Register -------- +#define AT91C_TWI_START ((unsigned int) 0x1 << 0) // (TWI) Send a START Condition +#define AT91C_TWI_STOP ((unsigned int) 0x1 << 1) // (TWI) Send a STOP Condition +#define AT91C_TWI_MSEN ((unsigned int) 0x1 << 2) // (TWI) TWI Master Transfer Enabled +#define AT91C_TWI_MSDIS ((unsigned int) 0x1 << 3) // (TWI) TWI Master Transfer Disabled +#define AT91C_TWI_SWRST ((unsigned int) 0x1 << 7) // (TWI) Software Reset +// -------- TWI_MMR : (TWI Offset: 0x4) TWI Master Mode Register -------- +#define AT91C_TWI_IADRSZ ((unsigned int) 0x3 << 8) // (TWI) Internal Device Address Size +#define AT91C_TWI_IADRSZ_NO ((unsigned int) 0x0 << 8) // (TWI) No internal device address +#define AT91C_TWI_IADRSZ_1_BYTE ((unsigned int) 0x1 << 8) // (TWI) One-byte internal device address +#define AT91C_TWI_IADRSZ_2_BYTE ((unsigned int) 0x2 << 8) // (TWI) Two-byte internal device address +#define AT91C_TWI_IADRSZ_3_BYTE ((unsigned int) 0x3 << 8) // (TWI) Three-byte internal device address +#define AT91C_TWI_MREAD ((unsigned int) 0x1 << 12) // (TWI) Master Read Direction +#define AT91C_TWI_DADR ((unsigned int) 0x7F << 16) // (TWI) Device Address +// -------- TWI_CWGR : (TWI Offset: 0x10) TWI Clock Waveform Generator Register -------- +#define AT91C_TWI_CLDIV ((unsigned int) 0xFF << 0) // (TWI) Clock Low Divider +#define AT91C_TWI_CHDIV ((unsigned int) 0xFF << 8) // (TWI) Clock High Divider +#define AT91C_TWI_CKDIV ((unsigned int) 0x7 << 16) // (TWI) Clock Divider +// -------- TWI_SR : (TWI Offset: 0x20) TWI Status Register -------- +#define AT91C_TWI_TXCOMP ((unsigned int) 0x1 << 0) // (TWI) Transmission Completed +#define AT91C_TWI_RXRDY ((unsigned int) 0x1 << 1) // (TWI) Receive holding register ReaDY +#define AT91C_TWI_TXRDY ((unsigned int) 0x1 << 2) // (TWI) Transmit holding register ReaDY +#define AT91C_TWI_OVRE ((unsigned int) 0x1 << 6) // (TWI) Overrun Error +#define AT91C_TWI_UNRE ((unsigned int) 0x1 << 7) // (TWI) Underrun Error +#define AT91C_TWI_NACK ((unsigned int) 0x1 << 8) // (TWI) Not Acknowledged +// -------- TWI_IER : (TWI Offset: 0x24) TWI Interrupt Enable Register -------- +// -------- TWI_IDR : (TWI Offset: 0x28) TWI Interrupt Disable Register -------- +// -------- TWI_IMR : (TWI Offset: 0x2c) TWI Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR PWMC Channel Interface +// ***************************************************************************** +typedef struct _AT91S_PWMC_CH { + AT91_REG PWMC_CMR; // Channel Mode Register + AT91_REG PWMC_CDTYR; // Channel Duty Cycle Register + AT91_REG PWMC_CPRDR; // Channel Period Register + AT91_REG PWMC_CCNTR; // Channel Counter Register + AT91_REG PWMC_CUPDR; // Channel Update Register + AT91_REG PWMC_Reserved[3]; // Reserved +} AT91S_PWMC_CH, *AT91PS_PWMC_CH; + +// -------- PWMC_CMR : (PWMC_CH Offset: 0x0) PWMC Channel Mode Register -------- +#define AT91C_PWMC_CPRE ((unsigned int) 0xF << 0) // (PWMC_CH) Channel Pre-scaler : PWMC_CLKx +#define AT91C_PWMC_CPRE_MCK ((unsigned int) 0x0) // (PWMC_CH) +#define AT91C_PWMC_CPRE_MCKA ((unsigned int) 0xB) // (PWMC_CH) +#define AT91C_PWMC_CPRE_MCKB ((unsigned int) 0xC) // (PWMC_CH) +#define AT91C_PWMC_CALG ((unsigned int) 0x1 << 8) // (PWMC_CH) Channel Alignment +#define AT91C_PWMC_CPOL ((unsigned int) 0x1 << 9) // (PWMC_CH) Channel Polarity +#define AT91C_PWMC_CPD ((unsigned int) 0x1 << 10) // (PWMC_CH) Channel Update Period +// -------- PWMC_CDTYR : (PWMC_CH Offset: 0x4) PWMC Channel Duty Cycle Register -------- +#define AT91C_PWMC_CDTY ((unsigned int) 0x0 << 0) // (PWMC_CH) Channel Duty Cycle +// -------- PWMC_CPRDR : (PWMC_CH Offset: 0x8) PWMC Channel Period Register -------- +#define AT91C_PWMC_CPRD ((unsigned int) 0x0 << 0) // (PWMC_CH) Channel Period +// -------- PWMC_CCNTR : (PWMC_CH Offset: 0xc) PWMC Channel Counter Register -------- +#define AT91C_PWMC_CCNT ((unsigned int) 0x0 << 0) // (PWMC_CH) Channel Counter +// -------- PWMC_CUPDR : (PWMC_CH Offset: 0x10) PWMC Channel Update Register -------- +#define AT91C_PWMC_CUPD ((unsigned int) 0x0 << 0) // (PWMC_CH) Channel Update + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Pulse Width Modulation Controller Interface +// ***************************************************************************** +typedef struct _AT91S_PWMC { + AT91_REG PWMC_MR; // PWMC Mode Register + AT91_REG PWMC_ENA; // PWMC Enable Register + AT91_REG PWMC_DIS; // PWMC Disable Register + AT91_REG PWMC_SR; // PWMC Status Register + AT91_REG PWMC_IER; // PWMC Interrupt Enable Register + AT91_REG PWMC_IDR; // PWMC Interrupt Disable Register + AT91_REG PWMC_IMR; // PWMC Interrupt Mask Register + AT91_REG PWMC_ISR; // PWMC Interrupt Status Register + AT91_REG Reserved0[55]; // + AT91_REG PWMC_VR; // PWMC Version Register + AT91_REG Reserved1[64]; // + AT91S_PWMC_CH PWMC_CH[4]; // PWMC Channel +} AT91S_PWMC, *AT91PS_PWMC; + +// -------- PWMC_MR : (PWMC Offset: 0x0) PWMC Mode Register -------- +#define AT91C_PWMC_DIVA ((unsigned int) 0xFF << 0) // (PWMC) CLKA divide factor. +#define AT91C_PWMC_PREA ((unsigned int) 0xF << 8) // (PWMC) Divider Input Clock Prescaler A +#define AT91C_PWMC_PREA_MCK ((unsigned int) 0x0 << 8) // (PWMC) +#define AT91C_PWMC_DIVB ((unsigned int) 0xFF << 16) // (PWMC) CLKB divide factor. +#define AT91C_PWMC_PREB ((unsigned int) 0xF << 24) // (PWMC) Divider Input Clock Prescaler B +#define AT91C_PWMC_PREB_MCK ((unsigned int) 0x0 << 24) // (PWMC) +// -------- PWMC_ENA : (PWMC Offset: 0x4) PWMC Enable Register -------- +#define AT91C_PWMC_CHID0 ((unsigned int) 0x1 << 0) // (PWMC) Channel ID 0 +#define AT91C_PWMC_CHID1 ((unsigned int) 0x1 << 1) // (PWMC) Channel ID 1 +#define AT91C_PWMC_CHID2 ((unsigned int) 0x1 << 2) // (PWMC) Channel ID 2 +#define AT91C_PWMC_CHID3 ((unsigned int) 0x1 << 3) // (PWMC) Channel ID 3 +// -------- PWMC_DIS : (PWMC Offset: 0x8) PWMC Disable Register -------- +// -------- PWMC_SR : (PWMC Offset: 0xc) PWMC Status Register -------- +// -------- PWMC_IER : (PWMC Offset: 0x10) PWMC Interrupt Enable Register -------- +// -------- PWMC_IDR : (PWMC Offset: 0x14) PWMC Interrupt Disable Register -------- +// -------- PWMC_IMR : (PWMC Offset: 0x18) PWMC Interrupt Mask Register -------- +// -------- PWMC_ISR : (PWMC Offset: 0x1c) PWMC Interrupt Status Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR USB Device Interface +// ***************************************************************************** +typedef struct _AT91S_UDP { + AT91_REG UDP_NUM; // Frame Number Register + AT91_REG UDP_GLBSTATE; // Global State Register + AT91_REG UDP_FADDR; // Function Address Register + AT91_REG Reserved0[1]; // + AT91_REG UDP_IER; // Interrupt Enable Register + AT91_REG UDP_IDR; // Interrupt Disable Register + AT91_REG UDP_IMR; // Interrupt Mask Register + AT91_REG UDP_ISR; // Interrupt Status Register + AT91_REG UDP_ICR; // Interrupt Clear Register + AT91_REG Reserved1[1]; // + AT91_REG UDP_RSTEP; // Reset Endpoint Register + AT91_REG Reserved2[1]; // + AT91_REG UDP_CSR[6]; // Endpoint Control and Status Register + AT91_REG Reserved3[2]; // + AT91_REG UDP_FDR[6]; // Endpoint FIFO Data Register + AT91_REG Reserved4[3]; // + AT91_REG UDP_TXVC; // Transceiver Control Register +} AT91S_UDP, *AT91PS_UDP; + +// -------- UDP_FRM_NUM : (UDP Offset: 0x0) USB Frame Number Register -------- +#define AT91C_UDP_FRM_NUM ((unsigned int) 0x7FF << 0) // (UDP) Frame Number as Defined in the Packet Field Formats +#define AT91C_UDP_FRM_ERR ((unsigned int) 0x1 << 16) // (UDP) Frame Error +#define AT91C_UDP_FRM_OK ((unsigned int) 0x1 << 17) // (UDP) Frame OK +// -------- UDP_GLB_STATE : (UDP Offset: 0x4) USB Global State Register -------- +#define AT91C_UDP_FADDEN ((unsigned int) 0x1 << 0) // (UDP) Function Address Enable +#define AT91C_UDP_CONFG ((unsigned int) 0x1 << 1) // (UDP) Configured +#define AT91C_UDP_ESR ((unsigned int) 0x1 << 2) // (UDP) Enable Send Resume +#define AT91C_UDP_RSMINPR ((unsigned int) 0x1 << 3) // (UDP) A Resume Has Been Sent to the Host +#define AT91C_UDP_RMWUPE ((unsigned int) 0x1 << 4) // (UDP) Remote Wake Up Enable +// -------- UDP_FADDR : (UDP Offset: 0x8) USB Function Address Register -------- +#define AT91C_UDP_FADD ((unsigned int) 0xFF << 0) // (UDP) Function Address Value +#define AT91C_UDP_FEN ((unsigned int) 0x1 << 8) // (UDP) Function Enable +// -------- UDP_IER : (UDP Offset: 0x10) USB Interrupt Enable Register -------- +#define AT91C_UDP_EPINT0 ((unsigned int) 0x1 << 0) // (UDP) Endpoint 0 Interrupt +#define AT91C_UDP_EPINT1 ((unsigned int) 0x1 << 1) // (UDP) Endpoint 0 Interrupt +#define AT91C_UDP_EPINT2 ((unsigned int) 0x1 << 2) // (UDP) Endpoint 2 Interrupt +#define AT91C_UDP_EPINT3 ((unsigned int) 0x1 << 3) // (UDP) Endpoint 3 Interrupt +#define AT91C_UDP_EPINT4 ((unsigned int) 0x1 << 4) // (UDP) Endpoint 4 Interrupt +#define AT91C_UDP_EPINT5 ((unsigned int) 0x1 << 5) // (UDP) Endpoint 5 Interrupt +#define AT91C_UDP_RXSUSP ((unsigned int) 0x1 << 8) // (UDP) USB Suspend Interrupt +#define AT91C_UDP_RXRSM ((unsigned int) 0x1 << 9) // (UDP) USB Resume Interrupt +#define AT91C_UDP_EXTRSM ((unsigned int) 0x1 << 10) // (UDP) USB External Resume Interrupt +#define AT91C_UDP_SOFINT ((unsigned int) 0x1 << 11) // (UDP) USB Start Of frame Interrupt +#define AT91C_UDP_WAKEUP ((unsigned int) 0x1 << 13) // (UDP) USB Resume Interrupt +// -------- UDP_IDR : (UDP Offset: 0x14) USB Interrupt Disable Register -------- +// -------- UDP_IMR : (UDP Offset: 0x18) USB Interrupt Mask Register -------- +// -------- UDP_ISR : (UDP Offset: 0x1c) USB Interrupt Status Register -------- +#define AT91C_UDP_ENDBUSRES ((unsigned int) 0x1 << 12) // (UDP) USB End Of Bus Reset Interrupt +// -------- UDP_ICR : (UDP Offset: 0x20) USB Interrupt Clear Register -------- +// -------- UDP_RST_EP : (UDP Offset: 0x28) USB Reset Endpoint Register -------- +#define AT91C_UDP_EP0 ((unsigned int) 0x1 << 0) // (UDP) Reset Endpoint 0 +#define AT91C_UDP_EP1 ((unsigned int) 0x1 << 1) // (UDP) Reset Endpoint 1 +#define AT91C_UDP_EP2 ((unsigned int) 0x1 << 2) // (UDP) Reset Endpoint 2 +#define AT91C_UDP_EP3 ((unsigned int) 0x1 << 3) // (UDP) Reset Endpoint 3 +#define AT91C_UDP_EP4 ((unsigned int) 0x1 << 4) // (UDP) Reset Endpoint 4 +#define AT91C_UDP_EP5 ((unsigned int) 0x1 << 5) // (UDP) Reset Endpoint 5 +// -------- UDP_CSR : (UDP Offset: 0x30) USB Endpoint Control and Status Register -------- +#define AT91C_UDP_TXCOMP ((unsigned int) 0x1 << 0) // (UDP) Generates an IN packet with data previously written in the DPR +#define AT91C_UDP_RX_DATA_BK0 ((unsigned int) 0x1 << 1) // (UDP) Receive Data Bank 0 +#define AT91C_UDP_RXSETUP ((unsigned int) 0x1 << 2) // (UDP) Sends STALL to the Host (Control endpoints) +#define AT91C_UDP_ISOERROR ((unsigned int) 0x1 << 3) // (UDP) Isochronous error (Isochronous endpoints) +#define AT91C_UDP_TXPKTRDY ((unsigned int) 0x1 << 4) // (UDP) Transmit Packet Ready +#define AT91C_UDP_FORCESTALL ((unsigned int) 0x1 << 5) // (UDP) Force Stall (used by Control, Bulk and Isochronous endpoints). +#define AT91C_UDP_RX_DATA_BK1 ((unsigned int) 0x1 << 6) // (UDP) Receive Data Bank 1 (only used by endpoints with ping-pong attributes). +#define AT91C_UDP_DIR ((unsigned int) 0x1 << 7) // (UDP) Transfer Direction +#define AT91C_UDP_EPTYPE ((unsigned int) 0x7 << 8) // (UDP) Endpoint type +#define AT91C_UDP_EPTYPE_CTRL ((unsigned int) 0x0 << 8) // (UDP) Control +#define AT91C_UDP_EPTYPE_ISO_OUT ((unsigned int) 0x1 << 8) // (UDP) Isochronous OUT +#define AT91C_UDP_EPTYPE_BULK_OUT ((unsigned int) 0x2 << 8) // (UDP) Bulk OUT +#define AT91C_UDP_EPTYPE_INT_OUT ((unsigned int) 0x3 << 8) // (UDP) Interrupt OUT +#define AT91C_UDP_EPTYPE_ISO_IN ((unsigned int) 0x5 << 8) // (UDP) Isochronous IN +#define AT91C_UDP_EPTYPE_BULK_IN ((unsigned int) 0x6 << 8) // (UDP) Bulk IN +#define AT91C_UDP_EPTYPE_INT_IN ((unsigned int) 0x7 << 8) // (UDP) Interrupt IN +#define AT91C_UDP_DTGLE ((unsigned int) 0x1 << 11) // (UDP) Data Toggle +#define AT91C_UDP_EPEDS ((unsigned int) 0x1 << 15) // (UDP) Endpoint Enable Disable +#define AT91C_UDP_RXBYTECNT ((unsigned int) 0x7FF << 16) // (UDP) Number Of Bytes Available in the FIFO +// -------- UDP_TXVC : (UDP Offset: 0x74) Transceiver Control Register -------- +#define AT91C_UDP_TXVDIS ((unsigned int) 0x1 << 8) // (UDP) +#define AT91C_UDP_PUON ((unsigned int) 0x1 << 9) // (UDP) Pull-up ON + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Timer Counter Channel Interface +// ***************************************************************************** +typedef struct _AT91S_TC { + AT91_REG TC_CCR; // Channel Control Register + AT91_REG TC_CMR; // Channel Mode Register (Capture Mode / Waveform Mode) + AT91_REG Reserved0[2]; // + AT91_REG TC_CV; // Counter Value + AT91_REG TC_RA; // Register A + AT91_REG TC_RB; // Register B + AT91_REG TC_RC; // Register C + AT91_REG TC_SR; // Status Register + AT91_REG TC_IER; // Interrupt Enable Register + AT91_REG TC_IDR; // Interrupt Disable Register + AT91_REG TC_IMR; // Interrupt Mask Register +} AT91S_TC, *AT91PS_TC; + +// -------- TC_CCR : (TC Offset: 0x0) TC Channel Control Register -------- +#define AT91C_TC_CLKEN ((unsigned int) 0x1 << 0) // (TC) Counter Clock Enable Command +#define AT91C_TC_CLKDIS ((unsigned int) 0x1 << 1) // (TC) Counter Clock Disable Command +#define AT91C_TC_SWTRG ((unsigned int) 0x1 << 2) // (TC) Software Trigger Command +// -------- TC_CMR : (TC Offset: 0x4) TC Channel Mode Register: Capture Mode / Waveform Mode -------- +#define AT91C_TC_CLKS ((unsigned int) 0x7 << 0) // (TC) Clock Selection +#define AT91C_TC_CLKS_TIMER_DIV1_CLOCK ((unsigned int) 0x0) // (TC) Clock selected: TIMER_DIV1_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV2_CLOCK ((unsigned int) 0x1) // (TC) Clock selected: TIMER_DIV2_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV3_CLOCK ((unsigned int) 0x2) // (TC) Clock selected: TIMER_DIV3_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV4_CLOCK ((unsigned int) 0x3) // (TC) Clock selected: TIMER_DIV4_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV5_CLOCK ((unsigned int) 0x4) // (TC) Clock selected: TIMER_DIV5_CLOCK +#define AT91C_TC_CLKS_XC0 ((unsigned int) 0x5) // (TC) Clock selected: XC0 +#define AT91C_TC_CLKS_XC1 ((unsigned int) 0x6) // (TC) Clock selected: XC1 +#define AT91C_TC_CLKS_XC2 ((unsigned int) 0x7) // (TC) Clock selected: XC2 +#define AT91C_TC_CLKI ((unsigned int) 0x1 << 3) // (TC) Clock Invert +#define AT91C_TC_BURST ((unsigned int) 0x3 << 4) // (TC) Burst Signal Selection +#define AT91C_TC_BURST_NONE ((unsigned int) 0x0 << 4) // (TC) The clock is not gated by an external signal +#define AT91C_TC_BURST_XC0 ((unsigned int) 0x1 << 4) // (TC) XC0 is ANDed with the selected clock +#define AT91C_TC_BURST_XC1 ((unsigned int) 0x2 << 4) // (TC) XC1 is ANDed with the selected clock +#define AT91C_TC_BURST_XC2 ((unsigned int) 0x3 << 4) // (TC) XC2 is ANDed with the selected clock +#define AT91C_TC_CPCSTOP ((unsigned int) 0x1 << 6) // (TC) Counter Clock Stopped with RC Compare +#define AT91C_TC_LDBSTOP ((unsigned int) 0x1 << 6) // (TC) Counter Clock Stopped with RB Loading +#define AT91C_TC_CPCDIS ((unsigned int) 0x1 << 7) // (TC) Counter Clock Disable with RC Compare +#define AT91C_TC_LDBDIS ((unsigned int) 0x1 << 7) // (TC) Counter Clock Disabled with RB Loading +#define AT91C_TC_ETRGEDG ((unsigned int) 0x3 << 8) // (TC) External Trigger Edge Selection +#define AT91C_TC_ETRGEDG_NONE ((unsigned int) 0x0 << 8) // (TC) Edge: None +#define AT91C_TC_ETRGEDG_RISING ((unsigned int) 0x1 << 8) // (TC) Edge: rising edge +#define AT91C_TC_ETRGEDG_FALLING ((unsigned int) 0x2 << 8) // (TC) Edge: falling edge +#define AT91C_TC_ETRGEDG_BOTH ((unsigned int) 0x3 << 8) // (TC) Edge: each edge +#define AT91C_TC_EEVTEDG ((unsigned int) 0x3 << 8) // (TC) External Event Edge Selection +#define AT91C_TC_EEVTEDG_NONE ((unsigned int) 0x0 << 8) // (TC) Edge: None +#define AT91C_TC_EEVTEDG_RISING ((unsigned int) 0x1 << 8) // (TC) Edge: rising edge +#define AT91C_TC_EEVTEDG_FALLING ((unsigned int) 0x2 << 8) // (TC) Edge: falling edge +#define AT91C_TC_EEVTEDG_BOTH ((unsigned int) 0x3 << 8) // (TC) Edge: each edge +#define AT91C_TC_EEVT ((unsigned int) 0x3 << 10) // (TC) External Event Selection +#define AT91C_TC_EEVT_TIOB ((unsigned int) 0x0 << 10) // (TC) Signal selected as external event: TIOB TIOB direction: input +#define AT91C_TC_EEVT_XC0 ((unsigned int) 0x1 << 10) // (TC) Signal selected as external event: XC0 TIOB direction: output +#define AT91C_TC_EEVT_XC1 ((unsigned int) 0x2 << 10) // (TC) Signal selected as external event: XC1 TIOB direction: output +#define AT91C_TC_EEVT_XC2 ((unsigned int) 0x3 << 10) // (TC) Signal selected as external event: XC2 TIOB direction: output +#define AT91C_TC_ABETRG ((unsigned int) 0x1 << 10) // (TC) TIOA or TIOB External Trigger Selection +#define AT91C_TC_ENETRG ((unsigned int) 0x1 << 12) // (TC) External Event Trigger enable +#define AT91C_TC_WAVESEL ((unsigned int) 0x3 << 13) // (TC) Waveform Selection +#define AT91C_TC_WAVESEL_UP ((unsigned int) 0x0 << 13) // (TC) UP mode without atomatic trigger on RC Compare +#define AT91C_TC_WAVESEL_UPDOWN ((unsigned int) 0x1 << 13) // (TC) UPDOWN mode without automatic trigger on RC Compare +#define AT91C_TC_WAVESEL_UP_AUTO ((unsigned int) 0x2 << 13) // (TC) UP mode with automatic trigger on RC Compare +#define AT91C_TC_WAVESEL_UPDOWN_AUTO ((unsigned int) 0x3 << 13) // (TC) UPDOWN mode with automatic trigger on RC Compare +#define AT91C_TC_CPCTRG ((unsigned int) 0x1 << 14) // (TC) RC Compare Trigger Enable +#define AT91C_TC_WAVE ((unsigned int) 0x1 << 15) // (TC) +#define AT91C_TC_ACPA ((unsigned int) 0x3 << 16) // (TC) RA Compare Effect on TIOA +#define AT91C_TC_ACPA_NONE ((unsigned int) 0x0 << 16) // (TC) Effect: none +#define AT91C_TC_ACPA_SET ((unsigned int) 0x1 << 16) // (TC) Effect: set +#define AT91C_TC_ACPA_CLEAR ((unsigned int) 0x2 << 16) // (TC) Effect: clear +#define AT91C_TC_ACPA_TOGGLE ((unsigned int) 0x3 << 16) // (TC) Effect: toggle +#define AT91C_TC_LDRA ((unsigned int) 0x3 << 16) // (TC) RA Loading Selection +#define AT91C_TC_LDRA_NONE ((unsigned int) 0x0 << 16) // (TC) Edge: None +#define AT91C_TC_LDRA_RISING ((unsigned int) 0x1 << 16) // (TC) Edge: rising edge of TIOA +#define AT91C_TC_LDRA_FALLING ((unsigned int) 0x2 << 16) // (TC) Edge: falling edge of TIOA +#define AT91C_TC_LDRA_BOTH ((unsigned int) 0x3 << 16) // (TC) Edge: each edge of TIOA +#define AT91C_TC_ACPC ((unsigned int) 0x3 << 18) // (TC) RC Compare Effect on TIOA +#define AT91C_TC_ACPC_NONE ((unsigned int) 0x0 << 18) // (TC) Effect: none +#define AT91C_TC_ACPC_SET ((unsigned int) 0x1 << 18) // (TC) Effect: set +#define AT91C_TC_ACPC_CLEAR ((unsigned int) 0x2 << 18) // (TC) Effect: clear +#define AT91C_TC_ACPC_TOGGLE ((unsigned int) 0x3 << 18) // (TC) Effect: toggle +#define AT91C_TC_LDRB ((unsigned int) 0x3 << 18) // (TC) RB Loading Selection +#define AT91C_TC_LDRB_NONE ((unsigned int) 0x0 << 18) // (TC) Edge: None +#define AT91C_TC_LDRB_RISING ((unsigned int) 0x1 << 18) // (TC) Edge: rising edge of TIOA +#define AT91C_TC_LDRB_FALLING ((unsigned int) 0x2 << 18) // (TC) Edge: falling edge of TIOA +#define AT91C_TC_LDRB_BOTH ((unsigned int) 0x3 << 18) // (TC) Edge: each edge of TIOA +#define AT91C_TC_AEEVT ((unsigned int) 0x3 << 20) // (TC) External Event Effect on TIOA +#define AT91C_TC_AEEVT_NONE ((unsigned int) 0x0 << 20) // (TC) Effect: none +#define AT91C_TC_AEEVT_SET ((unsigned int) 0x1 << 20) // (TC) Effect: set +#define AT91C_TC_AEEVT_CLEAR ((unsigned int) 0x2 << 20) // (TC) Effect: clear +#define AT91C_TC_AEEVT_TOGGLE ((unsigned int) 0x3 << 20) // (TC) Effect: toggle +#define AT91C_TC_ASWTRG ((unsigned int) 0x3 << 22) // (TC) Software Trigger Effect on TIOA +#define AT91C_TC_ASWTRG_NONE ((unsigned int) 0x0 << 22) // (TC) Effect: none +#define AT91C_TC_ASWTRG_SET ((unsigned int) 0x1 << 22) // (TC) Effect: set +#define AT91C_TC_ASWTRG_CLEAR ((unsigned int) 0x2 << 22) // (TC) Effect: clear +#define AT91C_TC_ASWTRG_TOGGLE ((unsigned int) 0x3 << 22) // (TC) Effect: toggle +#define AT91C_TC_BCPB ((unsigned int) 0x3 << 24) // (TC) RB Compare Effect on TIOB +#define AT91C_TC_BCPB_NONE ((unsigned int) 0x0 << 24) // (TC) Effect: none +#define AT91C_TC_BCPB_SET ((unsigned int) 0x1 << 24) // (TC) Effect: set +#define AT91C_TC_BCPB_CLEAR ((unsigned int) 0x2 << 24) // (TC) Effect: clear +#define AT91C_TC_BCPB_TOGGLE ((unsigned int) 0x3 << 24) // (TC) Effect: toggle +#define AT91C_TC_BCPC ((unsigned int) 0x3 << 26) // (TC) RC Compare Effect on TIOB +#define AT91C_TC_BCPC_NONE ((unsigned int) 0x0 << 26) // (TC) Effect: none +#define AT91C_TC_BCPC_SET ((unsigned int) 0x1 << 26) // (TC) Effect: set +#define AT91C_TC_BCPC_CLEAR ((unsigned int) 0x2 << 26) // (TC) Effect: clear +#define AT91C_TC_BCPC_TOGGLE ((unsigned int) 0x3 << 26) // (TC) Effect: toggle +#define AT91C_TC_BEEVT ((unsigned int) 0x3 << 28) // (TC) External Event Effect on TIOB +#define AT91C_TC_BEEVT_NONE ((unsigned int) 0x0 << 28) // (TC) Effect: none +#define AT91C_TC_BEEVT_SET ((unsigned int) 0x1 << 28) // (TC) Effect: set +#define AT91C_TC_BEEVT_CLEAR ((unsigned int) 0x2 << 28) // (TC) Effect: clear +#define AT91C_TC_BEEVT_TOGGLE ((unsigned int) 0x3 << 28) // (TC) Effect: toggle +#define AT91C_TC_BSWTRG ((unsigned int) 0x3 << 30) // (TC) Software Trigger Effect on TIOB +#define AT91C_TC_BSWTRG_NONE ((unsigned int) 0x0 << 30) // (TC) Effect: none +#define AT91C_TC_BSWTRG_SET ((unsigned int) 0x1 << 30) // (TC) Effect: set +#define AT91C_TC_BSWTRG_CLEAR ((unsigned int) 0x2 << 30) // (TC) Effect: clear +#define AT91C_TC_BSWTRG_TOGGLE ((unsigned int) 0x3 << 30) // (TC) Effect: toggle +// -------- TC_SR : (TC Offset: 0x20) TC Channel Status Register -------- +#define AT91C_TC_COVFS ((unsigned int) 0x1 << 0) // (TC) Counter Overflow +#define AT91C_TC_LOVRS ((unsigned int) 0x1 << 1) // (TC) Load Overrun +#define AT91C_TC_CPAS ((unsigned int) 0x1 << 2) // (TC) RA Compare +#define AT91C_TC_CPBS ((unsigned int) 0x1 << 3) // (TC) RB Compare +#define AT91C_TC_CPCS ((unsigned int) 0x1 << 4) // (TC) RC Compare +#define AT91C_TC_LDRAS ((unsigned int) 0x1 << 5) // (TC) RA Loading +#define AT91C_TC_LDRBS ((unsigned int) 0x1 << 6) // (TC) RB Loading +#define AT91C_TC_ETRGS ((unsigned int) 0x1 << 7) // (TC) External Trigger +#define AT91C_TC_CLKSTA ((unsigned int) 0x1 << 16) // (TC) Clock Enabling +#define AT91C_TC_MTIOA ((unsigned int) 0x1 << 17) // (TC) TIOA Mirror +#define AT91C_TC_MTIOB ((unsigned int) 0x1 << 18) // (TC) TIOA Mirror +// -------- TC_IER : (TC Offset: 0x24) TC Channel Interrupt Enable Register -------- +// -------- TC_IDR : (TC Offset: 0x28) TC Channel Interrupt Disable Register -------- +// -------- TC_IMR : (TC Offset: 0x2c) TC Channel Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Timer Counter Interface +// ***************************************************************************** +typedef struct _AT91S_TCB { + AT91S_TC TCB_TC0; // TC Channel 0 + AT91_REG Reserved0[4]; // + AT91S_TC TCB_TC1; // TC Channel 1 + AT91_REG Reserved1[4]; // + AT91S_TC TCB_TC2; // TC Channel 2 + AT91_REG Reserved2[4]; // + AT91_REG TCB_BCR; // TC Block Control Register + AT91_REG TCB_BMR; // TC Block Mode Register +} AT91S_TCB, *AT91PS_TCB; + +// -------- TCB_BCR : (TCB Offset: 0xc0) TC Block Control Register -------- +#define AT91C_TCB_SYNC ((unsigned int) 0x1 << 0) // (TCB) Synchro Command +// -------- TCB_BMR : (TCB Offset: 0xc4) TC Block Mode Register -------- +#define AT91C_TCB_TC0XC0S ((unsigned int) 0x3 << 0) // (TCB) External Clock Signal 0 Selection +#define AT91C_TCB_TC0XC0S_TCLK0 ((unsigned int) 0x0) // (TCB) TCLK0 connected to XC0 +#define AT91C_TCB_TC0XC0S_NONE ((unsigned int) 0x1) // (TCB) None signal connected to XC0 +#define AT91C_TCB_TC0XC0S_TIOA1 ((unsigned int) 0x2) // (TCB) TIOA1 connected to XC0 +#define AT91C_TCB_TC0XC0S_TIOA2 ((unsigned int) 0x3) // (TCB) TIOA2 connected to XC0 +#define AT91C_TCB_TC1XC1S ((unsigned int) 0x3 << 2) // (TCB) External Clock Signal 1 Selection +#define AT91C_TCB_TC1XC1S_TCLK1 ((unsigned int) 0x0 << 2) // (TCB) TCLK1 connected to XC1 +#define AT91C_TCB_TC1XC1S_NONE ((unsigned int) 0x1 << 2) // (TCB) None signal connected to XC1 +#define AT91C_TCB_TC1XC1S_TIOA0 ((unsigned int) 0x2 << 2) // (TCB) TIOA0 connected to XC1 +#define AT91C_TCB_TC1XC1S_TIOA2 ((unsigned int) 0x3 << 2) // (TCB) TIOA2 connected to XC1 +#define AT91C_TCB_TC2XC2S ((unsigned int) 0x3 << 4) // (TCB) External Clock Signal 2 Selection +#define AT91C_TCB_TC2XC2S_TCLK2 ((unsigned int) 0x0 << 4) // (TCB) TCLK2 connected to XC2 +#define AT91C_TCB_TC2XC2S_NONE ((unsigned int) 0x1 << 4) // (TCB) None signal connected to XC2 +#define AT91C_TCB_TC2XC2S_TIOA0 ((unsigned int) 0x2 << 4) // (TCB) TIOA0 connected to XC2 +#define AT91C_TCB_TC2XC2S_TIOA1 ((unsigned int) 0x3 << 4) // (TCB) TIOA2 connected to XC2 + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Control Area Network MailBox Interface +// ***************************************************************************** +typedef struct _AT91S_CAN_MB { + AT91_REG CAN_MB_MMR; // MailBox Mode Register + AT91_REG CAN_MB_MAM; // MailBox Acceptance Mask Register + AT91_REG CAN_MB_MID; // MailBox ID Register + AT91_REG CAN_MB_MFID; // MailBox Family ID Register + AT91_REG CAN_MB_MSR; // MailBox Status Register + AT91_REG CAN_MB_MDL; // MailBox Data Low Register + AT91_REG CAN_MB_MDH; // MailBox Data High Register + AT91_REG CAN_MB_MCR; // MailBox Control Register +} AT91S_CAN_MB, *AT91PS_CAN_MB; + +// -------- CAN_MMR : (CAN_MB Offset: 0x0) CAN Message Mode Register -------- +#define AT91C_CAN_MTIMEMARK ((unsigned int) 0xFFFF << 0) // (CAN_MB) Mailbox Timemark +#define AT91C_CAN_PRIOR ((unsigned int) 0xF << 16) // (CAN_MB) Mailbox Priority +#define AT91C_CAN_MOT ((unsigned int) 0x7 << 24) // (CAN_MB) Mailbox Object Type +#define AT91C_CAN_MOT_DIS ((unsigned int) 0x0 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_RX ((unsigned int) 0x1 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_RXOVERWRITE ((unsigned int) 0x2 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_TX ((unsigned int) 0x3 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_CONSUMER ((unsigned int) 0x4 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_PRODUCER ((unsigned int) 0x5 << 24) // (CAN_MB) +// -------- CAN_MAM : (CAN_MB Offset: 0x4) CAN Message Acceptance Mask Register -------- +#define AT91C_CAN_MIDvB ((unsigned int) 0x3FFFF << 0) // (CAN_MB) Complementary bits for identifier in extended mode +#define AT91C_CAN_MIDvA ((unsigned int) 0x7FF << 18) // (CAN_MB) Identifier for standard frame mode +#define AT91C_CAN_MIDE ((unsigned int) 0x1 << 29) // (CAN_MB) Identifier Version +// -------- CAN_MID : (CAN_MB Offset: 0x8) CAN Message ID Register -------- +// -------- CAN_MFID : (CAN_MB Offset: 0xc) CAN Message Family ID Register -------- +// -------- CAN_MSR : (CAN_MB Offset: 0x10) CAN Message Status Register -------- +#define AT91C_CAN_MTIMESTAMP ((unsigned int) 0xFFFF << 0) // (CAN_MB) Timer Value +#define AT91C_CAN_MDLC ((unsigned int) 0xF << 16) // (CAN_MB) Mailbox Data Length Code +#define AT91C_CAN_MRTR ((unsigned int) 0x1 << 20) // (CAN_MB) Mailbox Remote Transmission Request +#define AT91C_CAN_MABT ((unsigned int) 0x1 << 22) // (CAN_MB) Mailbox Message Abort +#define AT91C_CAN_MRDY ((unsigned int) 0x1 << 23) // (CAN_MB) Mailbox Ready +#define AT91C_CAN_MMI ((unsigned int) 0x1 << 24) // (CAN_MB) Mailbox Message Ignored +// -------- CAN_MDL : (CAN_MB Offset: 0x14) CAN Message Data Low Register -------- +// -------- CAN_MDH : (CAN_MB Offset: 0x18) CAN Message Data High Register -------- +// -------- CAN_MCR : (CAN_MB Offset: 0x1c) CAN Message Control Register -------- +#define AT91C_CAN_MACR ((unsigned int) 0x1 << 22) // (CAN_MB) Abort Request for Mailbox +#define AT91C_CAN_MTCR ((unsigned int) 0x1 << 23) // (CAN_MB) Mailbox Transfer Command + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Control Area Network Interface +// ***************************************************************************** +typedef struct _AT91S_CAN { + AT91_REG CAN_MR; // Mode Register + AT91_REG CAN_IER; // Interrupt Enable Register + AT91_REG CAN_IDR; // Interrupt Disable Register + AT91_REG CAN_IMR; // Interrupt Mask Register + AT91_REG CAN_SR; // Status Register + AT91_REG CAN_BR; // Baudrate Register + AT91_REG CAN_TIM; // Timer Register + AT91_REG CAN_TIMESTP; // Time Stamp Register + AT91_REG CAN_ECR; // Error Counter Register + AT91_REG CAN_TCR; // Transfer Command Register + AT91_REG CAN_ACR; // Abort Command Register + AT91_REG Reserved0[52]; // + AT91_REG CAN_VR; // Version Register + AT91_REG Reserved1[64]; // + AT91S_CAN_MB CAN_MB0; // CAN Mailbox 0 + AT91S_CAN_MB CAN_MB1; // CAN Mailbox 1 + AT91S_CAN_MB CAN_MB2; // CAN Mailbox 2 + AT91S_CAN_MB CAN_MB3; // CAN Mailbox 3 + AT91S_CAN_MB CAN_MB4; // CAN Mailbox 4 + AT91S_CAN_MB CAN_MB5; // CAN Mailbox 5 + AT91S_CAN_MB CAN_MB6; // CAN Mailbox 6 + AT91S_CAN_MB CAN_MB7; // CAN Mailbox 7 + AT91S_CAN_MB CAN_MB8; // CAN Mailbox 8 + AT91S_CAN_MB CAN_MB9; // CAN Mailbox 9 + AT91S_CAN_MB CAN_MB10; // CAN Mailbox 10 + AT91S_CAN_MB CAN_MB11; // CAN Mailbox 11 + AT91S_CAN_MB CAN_MB12; // CAN Mailbox 12 + AT91S_CAN_MB CAN_MB13; // CAN Mailbox 13 + AT91S_CAN_MB CAN_MB14; // CAN Mailbox 14 + AT91S_CAN_MB CAN_MB15; // CAN Mailbox 15 +} AT91S_CAN, *AT91PS_CAN; + +// -------- CAN_MR : (CAN Offset: 0x0) CAN Mode Register -------- +#define AT91C_CAN_CANEN ((unsigned int) 0x1 << 0) // (CAN) CAN Controller Enable +#define AT91C_CAN_LPM ((unsigned int) 0x1 << 1) // (CAN) Disable/Enable Low Power Mode +#define AT91C_CAN_ABM ((unsigned int) 0x1 << 2) // (CAN) Disable/Enable Autobaud/Listen Mode +#define AT91C_CAN_OVL ((unsigned int) 0x1 << 3) // (CAN) Disable/Enable Overload Frame +#define AT91C_CAN_TEOF ((unsigned int) 0x1 << 4) // (CAN) Time Stamp messages at each end of Frame +#define AT91C_CAN_TTM ((unsigned int) 0x1 << 5) // (CAN) Disable/Enable Time Trigger Mode +#define AT91C_CAN_TIMFRZ ((unsigned int) 0x1 << 6) // (CAN) Enable Timer Freeze +#define AT91C_CAN_DRPT ((unsigned int) 0x1 << 7) // (CAN) Disable Repeat +// -------- CAN_IER : (CAN Offset: 0x4) CAN Interrupt Enable Register -------- +#define AT91C_CAN_MB0 ((unsigned int) 0x1 << 0) // (CAN) Mailbox 0 Flag +#define AT91C_CAN_MB1 ((unsigned int) 0x1 << 1) // (CAN) Mailbox 1 Flag +#define AT91C_CAN_MB2 ((unsigned int) 0x1 << 2) // (CAN) Mailbox 2 Flag +#define AT91C_CAN_MB3 ((unsigned int) 0x1 << 3) // (CAN) Mailbox 3 Flag +#define AT91C_CAN_MB4 ((unsigned int) 0x1 << 4) // (CAN) Mailbox 4 Flag +#define AT91C_CAN_MB5 ((unsigned int) 0x1 << 5) // (CAN) Mailbox 5 Flag +#define AT91C_CAN_MB6 ((unsigned int) 0x1 << 6) // (CAN) Mailbox 6 Flag +#define AT91C_CAN_MB7 ((unsigned int) 0x1 << 7) // (CAN) Mailbox 7 Flag +#define AT91C_CAN_MB8 ((unsigned int) 0x1 << 8) // (CAN) Mailbox 8 Flag +#define AT91C_CAN_MB9 ((unsigned int) 0x1 << 9) // (CAN) Mailbox 9 Flag +#define AT91C_CAN_MB10 ((unsigned int) 0x1 << 10) // (CAN) Mailbox 10 Flag +#define AT91C_CAN_MB11 ((unsigned int) 0x1 << 11) // (CAN) Mailbox 11 Flag +#define AT91C_CAN_MB12 ((unsigned int) 0x1 << 12) // (CAN) Mailbox 12 Flag +#define AT91C_CAN_MB13 ((unsigned int) 0x1 << 13) // (CAN) Mailbox 13 Flag +#define AT91C_CAN_MB14 ((unsigned int) 0x1 << 14) // (CAN) Mailbox 14 Flag +#define AT91C_CAN_MB15 ((unsigned int) 0x1 << 15) // (CAN) Mailbox 15 Flag +#define AT91C_CAN_ERRA ((unsigned int) 0x1 << 16) // (CAN) Error Active Mode Flag +#define AT91C_CAN_WARN ((unsigned int) 0x1 << 17) // (CAN) Warning Limit Flag +#define AT91C_CAN_ERRP ((unsigned int) 0x1 << 18) // (CAN) Error Passive Mode Flag +#define AT91C_CAN_BOFF ((unsigned int) 0x1 << 19) // (CAN) Bus Off Mode Flag +#define AT91C_CAN_SLEEP ((unsigned int) 0x1 << 20) // (CAN) Sleep Flag +#define AT91C_CAN_WAKEUP ((unsigned int) 0x1 << 21) // (CAN) Wakeup Flag +#define AT91C_CAN_TOVF ((unsigned int) 0x1 << 22) // (CAN) Timer Overflow Flag +#define AT91C_CAN_TSTP ((unsigned int) 0x1 << 23) // (CAN) Timestamp Flag +#define AT91C_CAN_CERR ((unsigned int) 0x1 << 24) // (CAN) CRC Error +#define AT91C_CAN_SERR ((unsigned int) 0x1 << 25) // (CAN) Stuffing Error +#define AT91C_CAN_AERR ((unsigned int) 0x1 << 26) // (CAN) Acknowledgment Error +#define AT91C_CAN_FERR ((unsigned int) 0x1 << 27) // (CAN) Form Error +#define AT91C_CAN_BERR ((unsigned int) 0x1 << 28) // (CAN) Bit Error +// -------- CAN_IDR : (CAN Offset: 0x8) CAN Interrupt Disable Register -------- +// -------- CAN_IMR : (CAN Offset: 0xc) CAN Interrupt Mask Register -------- +// -------- CAN_SR : (CAN Offset: 0x10) CAN Status Register -------- +#define AT91C_CAN_RBSY ((unsigned int) 0x1 << 29) // (CAN) Receiver Busy +#define AT91C_CAN_TBSY ((unsigned int) 0x1 << 30) // (CAN) Transmitter Busy +#define AT91C_CAN_OVLY ((unsigned int) 0x1 << 31) // (CAN) Overload Busy +// -------- CAN_BR : (CAN Offset: 0x14) CAN Baudrate Register -------- +#define AT91C_CAN_PHASE2 ((unsigned int) 0x7 << 0) // (CAN) Phase 2 segment +#define AT91C_CAN_PHASE1 ((unsigned int) 0x7 << 4) // (CAN) Phase 1 segment +#define AT91C_CAN_PROPAG ((unsigned int) 0x7 << 8) // (CAN) Programmation time segment +#define AT91C_CAN_SYNC ((unsigned int) 0x3 << 12) // (CAN) Re-synchronization jump width segment +#define AT91C_CAN_BRP ((unsigned int) 0x7F << 16) // (CAN) Baudrate Prescaler +#define AT91C_CAN_SMP ((unsigned int) 0x1 << 24) // (CAN) Sampling mode +// -------- CAN_TIM : (CAN Offset: 0x18) CAN Timer Register -------- +#define AT91C_CAN_TIMER ((unsigned int) 0xFFFF << 0) // (CAN) Timer field +// -------- CAN_TIMESTP : (CAN Offset: 0x1c) CAN Timestamp Register -------- +// -------- CAN_ECR : (CAN Offset: 0x20) CAN Error Counter Register -------- +#define AT91C_CAN_REC ((unsigned int) 0xFF << 0) // (CAN) Receive Error Counter +#define AT91C_CAN_TEC ((unsigned int) 0xFF << 16) // (CAN) Transmit Error Counter +// -------- CAN_TCR : (CAN Offset: 0x24) CAN Transfer Command Register -------- +#define AT91C_CAN_TIMRST ((unsigned int) 0x1 << 31) // (CAN) Timer Reset Field +// -------- CAN_ACR : (CAN Offset: 0x28) CAN Abort Command Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Ethernet MAC 10/100 +// ***************************************************************************** +typedef struct _AT91S_EMAC { + AT91_REG EMAC_NCR; // Network Control Register + AT91_REG EMAC_NCFGR; // Network Configuration Register + AT91_REG EMAC_NSR; // Network Status Register + AT91_REG Reserved0[2]; // + AT91_REG EMAC_TSR; // Transmit Status Register + AT91_REG EMAC_RBQP; // Receive Buffer Queue Pointer + AT91_REG EMAC_TBQP; // Transmit Buffer Queue Pointer + AT91_REG EMAC_RSR; // Receive Status Register + AT91_REG EMAC_ISR; // Interrupt Status Register + AT91_REG EMAC_IER; // Interrupt Enable Register + AT91_REG EMAC_IDR; // Interrupt Disable Register + AT91_REG EMAC_IMR; // Interrupt Mask Register + AT91_REG EMAC_MAN; // PHY Maintenance Register + AT91_REG EMAC_PTR; // Pause Time Register + AT91_REG EMAC_PFR; // Pause Frames received Register + AT91_REG EMAC_FTO; // Frames Transmitted OK Register + AT91_REG EMAC_SCF; // Single Collision Frame Register + AT91_REG EMAC_MCF; // Multiple Collision Frame Register + AT91_REG EMAC_FRO; // Frames Received OK Register + AT91_REG EMAC_FCSE; // Frame Check Sequence Error Register + AT91_REG EMAC_ALE; // Alignment Error Register + AT91_REG EMAC_DTF; // Deferred Transmission Frame Register + AT91_REG EMAC_LCOL; // Late Collision Register + AT91_REG EMAC_ECOL; // Excessive Collision Register + AT91_REG EMAC_TUND; // Transmit Underrun Error Register + AT91_REG EMAC_CSE; // Carrier Sense Error Register + AT91_REG EMAC_RRE; // Receive Ressource Error Register + AT91_REG EMAC_ROV; // Receive Overrun Errors Register + AT91_REG EMAC_RSE; // Receive Symbol Errors Register + AT91_REG EMAC_ELE; // Excessive Length Errors Register + AT91_REG EMAC_RJA; // Receive Jabbers Register + AT91_REG EMAC_USF; // Undersize Frames Register + AT91_REG EMAC_STE; // SQE Test Error Register + AT91_REG EMAC_RLE; // Receive Length Field Mismatch Register + AT91_REG EMAC_TPF; // Transmitted Pause Frames Register + AT91_REG EMAC_HRB; // Hash Address Bottom[31:0] + AT91_REG EMAC_HRT; // Hash Address Top[63:32] + AT91_REG EMAC_SA1L; // Specific Address 1 Bottom, First 4 bytes + AT91_REG EMAC_SA1H; // Specific Address 1 Top, Last 2 bytes + AT91_REG EMAC_SA2L; // Specific Address 2 Bottom, First 4 bytes + AT91_REG EMAC_SA2H; // Specific Address 2 Top, Last 2 bytes + AT91_REG EMAC_SA3L; // Specific Address 3 Bottom, First 4 bytes + AT91_REG EMAC_SA3H; // Specific Address 3 Top, Last 2 bytes + AT91_REG EMAC_SA4L; // Specific Address 4 Bottom, First 4 bytes + AT91_REG EMAC_SA4H; // Specific Address 4 Top, Last 2 bytes + AT91_REG EMAC_TID; // Type ID Checking Register + AT91_REG EMAC_TPQ; // Transmit Pause Quantum Register + AT91_REG EMAC_USRIO; // USER Input/Output Register + AT91_REG EMAC_WOL; // Wake On LAN Register + AT91_REG Reserved1[13]; // + AT91_REG EMAC_REV; // Revision Register +} AT91S_EMAC, *AT91PS_EMAC; + +// -------- EMAC_NCR : (EMAC Offset: 0x0) -------- +#define AT91C_EMAC_LB ((unsigned int) 0x1 << 0) // (EMAC) Loopback. Optional. When set, loopback signal is at high level. +#define AT91C_EMAC_LLB ((unsigned int) 0x1 << 1) // (EMAC) Loopback local. +#define AT91C_EMAC_RE ((unsigned int) 0x1 << 2) // (EMAC) Receive enable. +#define AT91C_EMAC_TE ((unsigned int) 0x1 << 3) // (EMAC) Transmit enable. +#define AT91C_EMAC_MPE ((unsigned int) 0x1 << 4) // (EMAC) Management port enable. +#define AT91C_EMAC_CLRSTAT ((unsigned int) 0x1 << 5) // (EMAC) Clear statistics registers. +#define AT91C_EMAC_INCSTAT ((unsigned int) 0x1 << 6) // (EMAC) Increment statistics registers. +#define AT91C_EMAC_WESTAT ((unsigned int) 0x1 << 7) // (EMAC) Write enable for statistics registers. +#define AT91C_EMAC_BP ((unsigned int) 0x1 << 8) // (EMAC) Back pressure. +#define AT91C_EMAC_TSTART ((unsigned int) 0x1 << 9) // (EMAC) Start Transmission. +#define AT91C_EMAC_THALT ((unsigned int) 0x1 << 10) // (EMAC) Transmission Halt. +#define AT91C_EMAC_TPFR ((unsigned int) 0x1 << 11) // (EMAC) Transmit pause frame +#define AT91C_EMAC_TZQ ((unsigned int) 0x1 << 12) // (EMAC) Transmit zero quantum pause frame +// -------- EMAC_NCFGR : (EMAC Offset: 0x4) Network Configuration Register -------- +#define AT91C_EMAC_SPD ((unsigned int) 0x1 << 0) // (EMAC) Speed. +#define AT91C_EMAC_FD ((unsigned int) 0x1 << 1) // (EMAC) Full duplex. +#define AT91C_EMAC_JFRAME ((unsigned int) 0x1 << 3) // (EMAC) Jumbo Frames. +#define AT91C_EMAC_CAF ((unsigned int) 0x1 << 4) // (EMAC) Copy all frames. +#define AT91C_EMAC_NBC ((unsigned int) 0x1 << 5) // (EMAC) No broadcast. +#define AT91C_EMAC_MTI ((unsigned int) 0x1 << 6) // (EMAC) Multicast hash event enable +#define AT91C_EMAC_UNI ((unsigned int) 0x1 << 7) // (EMAC) Unicast hash enable. +#define AT91C_EMAC_BIG ((unsigned int) 0x1 << 8) // (EMAC) Receive 1522 bytes. +#define AT91C_EMAC_EAE ((unsigned int) 0x1 << 9) // (EMAC) External address match enable. +#define AT91C_EMAC_CLK ((unsigned int) 0x3 << 10) // (EMAC) +#define AT91C_EMAC_CLK_HCLK_8 ((unsigned int) 0x0 << 10) // (EMAC) HCLK divided by 8 +#define AT91C_EMAC_CLK_HCLK_16 ((unsigned int) 0x1 << 10) // (EMAC) HCLK divided by 16 +#define AT91C_EMAC_CLK_HCLK_32 ((unsigned int) 0x2 << 10) // (EMAC) HCLK divided by 32 +#define AT91C_EMAC_CLK_HCLK_64 ((unsigned int) 0x3 << 10) // (EMAC) HCLK divided by 64 +#define AT91C_EMAC_RTY ((unsigned int) 0x1 << 12) // (EMAC) +#define AT91C_EMAC_PAE ((unsigned int) 0x1 << 13) // (EMAC) +#define AT91C_EMAC_RBOF ((unsigned int) 0x3 << 14) // (EMAC) +#define AT91C_EMAC_RBOF_OFFSET_0 ((unsigned int) 0x0 << 14) // (EMAC) no offset from start of receive buffer +#define AT91C_EMAC_RBOF_OFFSET_1 ((unsigned int) 0x1 << 14) // (EMAC) one byte offset from start of receive buffer +#define AT91C_EMAC_RBOF_OFFSET_2 ((unsigned int) 0x2 << 14) // (EMAC) two bytes offset from start of receive buffer +#define AT91C_EMAC_RBOF_OFFSET_3 ((unsigned int) 0x3 << 14) // (EMAC) three bytes offset from start of receive buffer +#define AT91C_EMAC_RLCE ((unsigned int) 0x1 << 16) // (EMAC) Receive Length field Checking Enable +#define AT91C_EMAC_DRFCS ((unsigned int) 0x1 << 17) // (EMAC) Discard Receive FCS +#define AT91C_EMAC_EFRHD ((unsigned int) 0x1 << 18) // (EMAC) +#define AT91C_EMAC_IRXFCS ((unsigned int) 0x1 << 19) // (EMAC) Ignore RX FCS +// -------- EMAC_NSR : (EMAC Offset: 0x8) Network Status Register -------- +#define AT91C_EMAC_LINKR ((unsigned int) 0x1 << 0) // (EMAC) +#define AT91C_EMAC_MDIO ((unsigned int) 0x1 << 1) // (EMAC) +#define AT91C_EMAC_IDLE ((unsigned int) 0x1 << 2) // (EMAC) +// -------- EMAC_TSR : (EMAC Offset: 0x14) Transmit Status Register -------- +#define AT91C_EMAC_UBR ((unsigned int) 0x1 << 0) // (EMAC) +#define AT91C_EMAC_COL ((unsigned int) 0x1 << 1) // (EMAC) +#define AT91C_EMAC_RLES ((unsigned int) 0x1 << 2) // (EMAC) +#define AT91C_EMAC_TGO ((unsigned int) 0x1 << 3) // (EMAC) Transmit Go +#define AT91C_EMAC_BEX ((unsigned int) 0x1 << 4) // (EMAC) Buffers exhausted mid frame +#define AT91C_EMAC_COMP ((unsigned int) 0x1 << 5) // (EMAC) +#define AT91C_EMAC_UND ((unsigned int) 0x1 << 6) // (EMAC) +// -------- EMAC_RSR : (EMAC Offset: 0x20) Receive Status Register -------- +#define AT91C_EMAC_BNA ((unsigned int) 0x1 << 0) // (EMAC) +#define AT91C_EMAC_REC ((unsigned int) 0x1 << 1) // (EMAC) +#define AT91C_EMAC_OVR ((unsigned int) 0x1 << 2) // (EMAC) +// -------- EMAC_ISR : (EMAC Offset: 0x24) Interrupt Status Register -------- +#define AT91C_EMAC_MFD ((unsigned int) 0x1 << 0) // (EMAC) +#define AT91C_EMAC_RCOMP ((unsigned int) 0x1 << 1) // (EMAC) +#define AT91C_EMAC_RXUBR ((unsigned int) 0x1 << 2) // (EMAC) +#define AT91C_EMAC_TXUBR ((unsigned int) 0x1 << 3) // (EMAC) +#define AT91C_EMAC_TUNDR ((unsigned int) 0x1 << 4) // (EMAC) +#define AT91C_EMAC_RLEX ((unsigned int) 0x1 << 5) // (EMAC) +#define AT91C_EMAC_TXERR ((unsigned int) 0x1 << 6) // (EMAC) +#define AT91C_EMAC_TCOMP ((unsigned int) 0x1 << 7) // (EMAC) +#define AT91C_EMAC_LINK ((unsigned int) 0x1 << 9) // (EMAC) +#define AT91C_EMAC_ROVR ((unsigned int) 0x1 << 10) // (EMAC) +#define AT91C_EMAC_HRESP ((unsigned int) 0x1 << 11) // (EMAC) +#define AT91C_EMAC_PFRE ((unsigned int) 0x1 << 12) // (EMAC) +#define AT91C_EMAC_PTZ ((unsigned int) 0x1 << 13) // (EMAC) +// -------- EMAC_IER : (EMAC Offset: 0x28) Interrupt Enable Register -------- +// -------- EMAC_IDR : (EMAC Offset: 0x2c) Interrupt Disable Register -------- +// -------- EMAC_IMR : (EMAC Offset: 0x30) Interrupt Mask Register -------- +// -------- EMAC_MAN : (EMAC Offset: 0x34) PHY Maintenance Register -------- +#define AT91C_EMAC_DATA ((unsigned int) 0xFFFF << 0) // (EMAC) +#define AT91C_EMAC_CODE ((unsigned int) 0x3 << 16) // (EMAC) +#define AT91C_EMAC_REGA ((unsigned int) 0x1F << 18) // (EMAC) +#define AT91C_EMAC_PHYA ((unsigned int) 0x1F << 23) // (EMAC) +#define AT91C_EMAC_RW ((unsigned int) 0x3 << 28) // (EMAC) +#define AT91C_EMAC_SOF ((unsigned int) 0x3 << 30) // (EMAC) +// -------- EMAC_USRIO : (EMAC Offset: 0xc0) USER Input Output Register -------- +#define AT91C_EMAC_RMII ((unsigned int) 0x1 << 0) // (EMAC) Reduce MII +#define AT91C_EMAC_CLKEN ((unsigned int) 0x1 << 1) // (EMAC) Clock Enable +// -------- EMAC_WOL : (EMAC Offset: 0xc4) Wake On LAN Register -------- +#define AT91C_EMAC_IP ((unsigned int) 0xFFFF << 0) // (EMAC) ARP request IP address +#define AT91C_EMAC_MAG ((unsigned int) 0x1 << 16) // (EMAC) Magic packet event enable +#define AT91C_EMAC_ARP ((unsigned int) 0x1 << 17) // (EMAC) ARP request event enable +#define AT91C_EMAC_SA1 ((unsigned int) 0x1 << 18) // (EMAC) Specific address register 1 event enable +// -------- EMAC_REV : (EMAC Offset: 0xfc) Revision Register -------- +#define AT91C_EMAC_REVREF ((unsigned int) 0xFFFF << 0) // (EMAC) +#define AT91C_EMAC_PARTREF ((unsigned int) 0xFFFF << 16) // (EMAC) + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Analog to Digital Convertor +// ***************************************************************************** +typedef struct _AT91S_ADC { + AT91_REG ADC_CR; // ADC Control Register + AT91_REG ADC_MR; // ADC Mode Register + AT91_REG Reserved0[2]; // + AT91_REG ADC_CHER; // ADC Channel Enable Register + AT91_REG ADC_CHDR; // ADC Channel Disable Register + AT91_REG ADC_CHSR; // ADC Channel Status Register + AT91_REG ADC_SR; // ADC Status Register + AT91_REG ADC_LCDR; // ADC Last Converted Data Register + AT91_REG ADC_IER; // ADC Interrupt Enable Register + AT91_REG ADC_IDR; // ADC Interrupt Disable Register + AT91_REG ADC_IMR; // ADC Interrupt Mask Register + AT91_REG ADC_CDR0; // ADC Channel Data Register 0 + AT91_REG ADC_CDR1; // ADC Channel Data Register 1 + AT91_REG ADC_CDR2; // ADC Channel Data Register 2 + AT91_REG ADC_CDR3; // ADC Channel Data Register 3 + AT91_REG ADC_CDR4; // ADC Channel Data Register 4 + AT91_REG ADC_CDR5; // ADC Channel Data Register 5 + AT91_REG ADC_CDR6; // ADC Channel Data Register 6 + AT91_REG ADC_CDR7; // ADC Channel Data Register 7 + AT91_REG Reserved1[44]; // + AT91_REG ADC_RPR; // Receive Pointer Register + AT91_REG ADC_RCR; // Receive Counter Register + AT91_REG ADC_TPR; // Transmit Pointer Register + AT91_REG ADC_TCR; // Transmit Counter Register + AT91_REG ADC_RNPR; // Receive Next Pointer Register + AT91_REG ADC_RNCR; // Receive Next Counter Register + AT91_REG ADC_TNPR; // Transmit Next Pointer Register + AT91_REG ADC_TNCR; // Transmit Next Counter Register + AT91_REG ADC_PTCR; // PDC Transfer Control Register + AT91_REG ADC_PTSR; // PDC Transfer Status Register +} AT91S_ADC, *AT91PS_ADC; + +// -------- ADC_CR : (ADC Offset: 0x0) ADC Control Register -------- +#define AT91C_ADC_SWRST ((unsigned int) 0x1 << 0) // (ADC) Software Reset +#define AT91C_ADC_START ((unsigned int) 0x1 << 1) // (ADC) Start Conversion +// -------- ADC_MR : (ADC Offset: 0x4) ADC Mode Register -------- +#define AT91C_ADC_TRGEN ((unsigned int) 0x1 << 0) // (ADC) Trigger Enable +#define AT91C_ADC_TRGEN_DIS ((unsigned int) 0x0) // (ADC) Hradware triggers are disabled. Starting a conversion is only possible by software +#define AT91C_ADC_TRGEN_EN ((unsigned int) 0x1) // (ADC) Hardware trigger selected by TRGSEL field is enabled. +#define AT91C_ADC_TRGSEL ((unsigned int) 0x7 << 1) // (ADC) Trigger Selection +#define AT91C_ADC_TRGSEL_TIOA0 ((unsigned int) 0x0 << 1) // (ADC) Selected TRGSEL = TIAO0 +#define AT91C_ADC_TRGSEL_TIOA1 ((unsigned int) 0x1 << 1) // (ADC) Selected TRGSEL = TIAO1 +#define AT91C_ADC_TRGSEL_TIOA2 ((unsigned int) 0x2 << 1) // (ADC) Selected TRGSEL = TIAO2 +#define AT91C_ADC_TRGSEL_TIOA3 ((unsigned int) 0x3 << 1) // (ADC) Selected TRGSEL = TIAO3 +#define AT91C_ADC_TRGSEL_TIOA4 ((unsigned int) 0x4 << 1) // (ADC) Selected TRGSEL = TIAO4 +#define AT91C_ADC_TRGSEL_TIOA5 ((unsigned int) 0x5 << 1) // (ADC) Selected TRGSEL = TIAO5 +#define AT91C_ADC_TRGSEL_EXT ((unsigned int) 0x6 << 1) // (ADC) Selected TRGSEL = External Trigger +#define AT91C_ADC_LOWRES ((unsigned int) 0x1 << 4) // (ADC) Resolution. +#define AT91C_ADC_LOWRES_10_BIT ((unsigned int) 0x0 << 4) // (ADC) 10-bit resolution +#define AT91C_ADC_LOWRES_8_BIT ((unsigned int) 0x1 << 4) // (ADC) 8-bit resolution +#define AT91C_ADC_SLEEP ((unsigned int) 0x1 << 5) // (ADC) Sleep Mode +#define AT91C_ADC_SLEEP_NORMAL_MODE ((unsigned int) 0x0 << 5) // (ADC) Normal Mode +#define AT91C_ADC_SLEEP_MODE ((unsigned int) 0x1 << 5) // (ADC) Sleep Mode +#define AT91C_ADC_PRESCAL ((unsigned int) 0x3F << 8) // (ADC) Prescaler rate selection +#define AT91C_ADC_STARTUP ((unsigned int) 0x1F << 16) // (ADC) Startup Time +#define AT91C_ADC_SHTIM ((unsigned int) 0xF << 24) // (ADC) Sample & Hold Time +// -------- ADC_CHER : (ADC Offset: 0x10) ADC Channel Enable Register -------- +#define AT91C_ADC_CH0 ((unsigned int) 0x1 << 0) // (ADC) Channel 0 +#define AT91C_ADC_CH1 ((unsigned int) 0x1 << 1) // (ADC) Channel 1 +#define AT91C_ADC_CH2 ((unsigned int) 0x1 << 2) // (ADC) Channel 2 +#define AT91C_ADC_CH3 ((unsigned int) 0x1 << 3) // (ADC) Channel 3 +#define AT91C_ADC_CH4 ((unsigned int) 0x1 << 4) // (ADC) Channel 4 +#define AT91C_ADC_CH5 ((unsigned int) 0x1 << 5) // (ADC) Channel 5 +#define AT91C_ADC_CH6 ((unsigned int) 0x1 << 6) // (ADC) Channel 6 +#define AT91C_ADC_CH7 ((unsigned int) 0x1 << 7) // (ADC) Channel 7 +// -------- ADC_CHDR : (ADC Offset: 0x14) ADC Channel Disable Register -------- +// -------- ADC_CHSR : (ADC Offset: 0x18) ADC Channel Status Register -------- +// -------- ADC_SR : (ADC Offset: 0x1c) ADC Status Register -------- +#define AT91C_ADC_EOC0 ((unsigned int) 0x1 << 0) // (ADC) End of Conversion +#define AT91C_ADC_EOC1 ((unsigned int) 0x1 << 1) // (ADC) End of Conversion +#define AT91C_ADC_EOC2 ((unsigned int) 0x1 << 2) // (ADC) End of Conversion +#define AT91C_ADC_EOC3 ((unsigned int) 0x1 << 3) // (ADC) End of Conversion +#define AT91C_ADC_EOC4 ((unsigned int) 0x1 << 4) // (ADC) End of Conversion +#define AT91C_ADC_EOC5 ((unsigned int) 0x1 << 5) // (ADC) End of Conversion +#define AT91C_ADC_EOC6 ((unsigned int) 0x1 << 6) // (ADC) End of Conversion +#define AT91C_ADC_EOC7 ((unsigned int) 0x1 << 7) // (ADC) End of Conversion +#define AT91C_ADC_OVRE0 ((unsigned int) 0x1 << 8) // (ADC) Overrun Error +#define AT91C_ADC_OVRE1 ((unsigned int) 0x1 << 9) // (ADC) Overrun Error +#define AT91C_ADC_OVRE2 ((unsigned int) 0x1 << 10) // (ADC) Overrun Error +#define AT91C_ADC_OVRE3 ((unsigned int) 0x1 << 11) // (ADC) Overrun Error +#define AT91C_ADC_OVRE4 ((unsigned int) 0x1 << 12) // (ADC) Overrun Error +#define AT91C_ADC_OVRE5 ((unsigned int) 0x1 << 13) // (ADC) Overrun Error +#define AT91C_ADC_OVRE6 ((unsigned int) 0x1 << 14) // (ADC) Overrun Error +#define AT91C_ADC_OVRE7 ((unsigned int) 0x1 << 15) // (ADC) Overrun Error +#define AT91C_ADC_DRDY ((unsigned int) 0x1 << 16) // (ADC) Data Ready +#define AT91C_ADC_GOVRE ((unsigned int) 0x1 << 17) // (ADC) General Overrun +#define AT91C_ADC_ENDRX ((unsigned int) 0x1 << 18) // (ADC) End of Receiver Transfer +#define AT91C_ADC_RXBUFF ((unsigned int) 0x1 << 19) // (ADC) RXBUFF Interrupt +// -------- ADC_LCDR : (ADC Offset: 0x20) ADC Last Converted Data Register -------- +#define AT91C_ADC_LDATA ((unsigned int) 0x3FF << 0) // (ADC) Last Data Converted +// -------- ADC_IER : (ADC Offset: 0x24) ADC Interrupt Enable Register -------- +// -------- ADC_IDR : (ADC Offset: 0x28) ADC Interrupt Disable Register -------- +// -------- ADC_IMR : (ADC Offset: 0x2c) ADC Interrupt Mask Register -------- +// -------- ADC_CDR0 : (ADC Offset: 0x30) ADC Channel Data Register 0 -------- +#define AT91C_ADC_DATA ((unsigned int) 0x3FF << 0) // (ADC) Converted Data +// -------- ADC_CDR1 : (ADC Offset: 0x34) ADC Channel Data Register 1 -------- +// -------- ADC_CDR2 : (ADC Offset: 0x38) ADC Channel Data Register 2 -------- +// -------- ADC_CDR3 : (ADC Offset: 0x3c) ADC Channel Data Register 3 -------- +// -------- ADC_CDR4 : (ADC Offset: 0x40) ADC Channel Data Register 4 -------- +// -------- ADC_CDR5 : (ADC Offset: 0x44) ADC Channel Data Register 5 -------- +// -------- ADC_CDR6 : (ADC Offset: 0x48) ADC Channel Data Register 6 -------- +// -------- ADC_CDR7 : (ADC Offset: 0x4c) ADC Channel Data Register 7 -------- + +// ***************************************************************************** +// REGISTER ADDRESS DEFINITION FOR AT91SAM7X256 +// ***************************************************************************** +// ========== Register definition for SYS peripheral ========== +// ========== Register definition for AIC peripheral ========== +#define AT91C_AIC_IVR ((AT91_REG *) 0xFFFFF100) // (AIC) IRQ Vector Register +#define AT91C_AIC_SMR ((AT91_REG *) 0xFFFFF000) // (AIC) Source Mode Register +#define AT91C_AIC_FVR ((AT91_REG *) 0xFFFFF104) // (AIC) FIQ Vector Register +#define AT91C_AIC_DCR ((AT91_REG *) 0xFFFFF138) // (AIC) Debug Control Register (Protect) +#define AT91C_AIC_EOICR ((AT91_REG *) 0xFFFFF130) // (AIC) End of Interrupt Command Register +#define AT91C_AIC_SVR ((AT91_REG *) 0xFFFFF080) // (AIC) Source Vector Register +#define AT91C_AIC_FFSR ((AT91_REG *) 0xFFFFF148) // (AIC) Fast Forcing Status Register +#define AT91C_AIC_ICCR ((AT91_REG *) 0xFFFFF128) // (AIC) Interrupt Clear Command Register +#define AT91C_AIC_ISR ((AT91_REG *) 0xFFFFF108) // (AIC) Interrupt Status Register +#define AT91C_AIC_IMR ((AT91_REG *) 0xFFFFF110) // (AIC) Interrupt Mask Register +#define AT91C_AIC_IPR ((AT91_REG *) 0xFFFFF10C) // (AIC) Interrupt Pending Register +#define AT91C_AIC_FFER ((AT91_REG *) 0xFFFFF140) // (AIC) Fast Forcing Enable Register +#define AT91C_AIC_IECR ((AT91_REG *) 0xFFFFF120) // (AIC) Interrupt Enable Command Register +#define AT91C_AIC_ISCR ((AT91_REG *) 0xFFFFF12C) // (AIC) Interrupt Set Command Register +#define AT91C_AIC_FFDR ((AT91_REG *) 0xFFFFF144) // (AIC) Fast Forcing Disable Register +#define AT91C_AIC_CISR ((AT91_REG *) 0xFFFFF114) // (AIC) Core Interrupt Status Register +#define AT91C_AIC_IDCR ((AT91_REG *) 0xFFFFF124) // (AIC) Interrupt Disable Command Register +#define AT91C_AIC_SPU ((AT91_REG *) 0xFFFFF134) // (AIC) Spurious Vector Register +// ========== Register definition for PDC_DBGU peripheral ========== +#define AT91C_DBGU_TCR ((AT91_REG *) 0xFFFFF30C) // (PDC_DBGU) Transmit Counter Register +#define AT91C_DBGU_RNPR ((AT91_REG *) 0xFFFFF310) // (PDC_DBGU) Receive Next Pointer Register +#define AT91C_DBGU_TNPR ((AT91_REG *) 0xFFFFF318) // (PDC_DBGU) Transmit Next Pointer Register +#define AT91C_DBGU_TPR ((AT91_REG *) 0xFFFFF308) // (PDC_DBGU) Transmit Pointer Register +#define AT91C_DBGU_RPR ((AT91_REG *) 0xFFFFF300) // (PDC_DBGU) Receive Pointer Register +#define AT91C_DBGU_RCR ((AT91_REG *) 0xFFFFF304) // (PDC_DBGU) Receive Counter Register +#define AT91C_DBGU_RNCR ((AT91_REG *) 0xFFFFF314) // (PDC_DBGU) Receive Next Counter Register +#define AT91C_DBGU_PTCR ((AT91_REG *) 0xFFFFF320) // (PDC_DBGU) PDC Transfer Control Register +#define AT91C_DBGU_PTSR ((AT91_REG *) 0xFFFFF324) // (PDC_DBGU) PDC Transfer Status Register +#define AT91C_DBGU_TNCR ((AT91_REG *) 0xFFFFF31C) // (PDC_DBGU) Transmit Next Counter Register +// ========== Register definition for DBGU peripheral ========== +#define AT91C_DBGU_EXID ((AT91_REG *) 0xFFFFF244) // (DBGU) Chip ID Extension Register +#define AT91C_DBGU_BRGR ((AT91_REG *) 0xFFFFF220) // (DBGU) Baud Rate Generator Register +#define AT91C_DBGU_IDR ((AT91_REG *) 0xFFFFF20C) // (DBGU) Interrupt Disable Register +#define AT91C_DBGU_CSR ((AT91_REG *) 0xFFFFF214) // (DBGU) Channel Status Register +#define AT91C_DBGU_CIDR ((AT91_REG *) 0xFFFFF240) // (DBGU) Chip ID Register +#define AT91C_DBGU_MR ((AT91_REG *) 0xFFFFF204) // (DBGU) Mode Register +#define AT91C_DBGU_IMR ((AT91_REG *) 0xFFFFF210) // (DBGU) Interrupt Mask Register +#define AT91C_DBGU_CR ((AT91_REG *) 0xFFFFF200) // (DBGU) Control Register +#define AT91C_DBGU_FNTR ((AT91_REG *) 0xFFFFF248) // (DBGU) Force NTRST Register +#define AT91C_DBGU_THR ((AT91_REG *) 0xFFFFF21C) // (DBGU) Transmitter Holding Register +#define AT91C_DBGU_RHR ((AT91_REG *) 0xFFFFF218) // (DBGU) Receiver Holding Register +#define AT91C_DBGU_IER ((AT91_REG *) 0xFFFFF208) // (DBGU) Interrupt Enable Register +// ========== Register definition for PIOA peripheral ========== +#define AT91C_PIOA_ODR ((AT91_REG *) 0xFFFFF414) // (PIOA) Output Disable Registerr +#define AT91C_PIOA_SODR ((AT91_REG *) 0xFFFFF430) // (PIOA) Set Output Data Register +#define AT91C_PIOA_ISR ((AT91_REG *) 0xFFFFF44C) // (PIOA) Interrupt Status Register +#define AT91C_PIOA_ABSR ((AT91_REG *) 0xFFFFF478) // (PIOA) AB Select Status Register +#define AT91C_PIOA_IER ((AT91_REG *) 0xFFFFF440) // (PIOA) Interrupt Enable Register +#define AT91C_PIOA_PPUDR ((AT91_REG *) 0xFFFFF460) // (PIOA) Pull-up Disable Register +#define AT91C_PIOA_IMR ((AT91_REG *) 0xFFFFF448) // (PIOA) Interrupt Mask Register +#define AT91C_PIOA_PER ((AT91_REG *) 0xFFFFF400) // (PIOA) PIO Enable Register +#define AT91C_PIOA_IFDR ((AT91_REG *) 0xFFFFF424) // (PIOA) Input Filter Disable Register +#define AT91C_PIOA_OWDR ((AT91_REG *) 0xFFFFF4A4) // (PIOA) Output Write Disable Register +#define AT91C_PIOA_MDSR ((AT91_REG *) 0xFFFFF458) // (PIOA) Multi-driver Status Register +#define AT91C_PIOA_IDR ((AT91_REG *) 0xFFFFF444) // (PIOA) Interrupt Disable Register +#define AT91C_PIOA_ODSR ((AT91_REG *) 0xFFFFF438) // (PIOA) Output Data Status Register +#define AT91C_PIOA_PPUSR ((AT91_REG *) 0xFFFFF468) // (PIOA) Pull-up Status Register +#define AT91C_PIOA_OWSR ((AT91_REG *) 0xFFFFF4A8) // (PIOA) Output Write Status Register +#define AT91C_PIOA_BSR ((AT91_REG *) 0xFFFFF474) // (PIOA) Select B Register +#define AT91C_PIOA_OWER ((AT91_REG *) 0xFFFFF4A0) // (PIOA) Output Write Enable Register +#define AT91C_PIOA_IFER ((AT91_REG *) 0xFFFFF420) // (PIOA) Input Filter Enable Register +#define AT91C_PIOA_PDSR ((AT91_REG *) 0xFFFFF43C) // (PIOA) Pin Data Status Register +#define AT91C_PIOA_PPUER ((AT91_REG *) 0xFFFFF464) // (PIOA) Pull-up Enable Register +#define AT91C_PIOA_OSR ((AT91_REG *) 0xFFFFF418) // (PIOA) Output Status Register +#define AT91C_PIOA_ASR ((AT91_REG *) 0xFFFFF470) // (PIOA) Select A Register +#define AT91C_PIOA_MDDR ((AT91_REG *) 0xFFFFF454) // (PIOA) Multi-driver Disable Register +#define AT91C_PIOA_CODR ((AT91_REG *) 0xFFFFF434) // (PIOA) Clear Output Data Register +#define AT91C_PIOA_MDER ((AT91_REG *) 0xFFFFF450) // (PIOA) Multi-driver Enable Register +#define AT91C_PIOA_PDR ((AT91_REG *) 0xFFFFF404) // (PIOA) PIO Disable Register +#define AT91C_PIOA_IFSR ((AT91_REG *) 0xFFFFF428) // (PIOA) Input Filter Status Register +#define AT91C_PIOA_OER ((AT91_REG *) 0xFFFFF410) // (PIOA) Output Enable Register +#define AT91C_PIOA_PSR ((AT91_REG *) 0xFFFFF408) // (PIOA) PIO Status Register +// ========== Register definition for PIOB peripheral ========== +#define AT91C_PIOB_OWDR ((AT91_REG *) 0xFFFFF6A4) // (PIOB) Output Write Disable Register +#define AT91C_PIOB_MDER ((AT91_REG *) 0xFFFFF650) // (PIOB) Multi-driver Enable Register +#define AT91C_PIOB_PPUSR ((AT91_REG *) 0xFFFFF668) // (PIOB) Pull-up Status Register +#define AT91C_PIOB_IMR ((AT91_REG *) 0xFFFFF648) // (PIOB) Interrupt Mask Register +#define AT91C_PIOB_ASR ((AT91_REG *) 0xFFFFF670) // (PIOB) Select A Register +#define AT91C_PIOB_PPUDR ((AT91_REG *) 0xFFFFF660) // (PIOB) Pull-up Disable Register +#define AT91C_PIOB_PSR ((AT91_REG *) 0xFFFFF608) // (PIOB) PIO Status Register +#define AT91C_PIOB_IER ((AT91_REG *) 0xFFFFF640) // (PIOB) Interrupt Enable Register +#define AT91C_PIOB_CODR ((AT91_REG *) 0xFFFFF634) // (PIOB) Clear Output Data Register +#define AT91C_PIOB_OWER ((AT91_REG *) 0xFFFFF6A0) // (PIOB) Output Write Enable Register +#define AT91C_PIOB_ABSR ((AT91_REG *) 0xFFFFF678) // (PIOB) AB Select Status Register +#define AT91C_PIOB_IFDR ((AT91_REG *) 0xFFFFF624) // (PIOB) Input Filter Disable Register +#define AT91C_PIOB_PDSR ((AT91_REG *) 0xFFFFF63C) // (PIOB) Pin Data Status Register +#define AT91C_PIOB_IDR ((AT91_REG *) 0xFFFFF644) // (PIOB) Interrupt Disable Register +#define AT91C_PIOB_OWSR ((AT91_REG *) 0xFFFFF6A8) // (PIOB) Output Write Status Register +#define AT91C_PIOB_PDR ((AT91_REG *) 0xFFFFF604) // (PIOB) PIO Disable Register +#define AT91C_PIOB_ODR ((AT91_REG *) 0xFFFFF614) // (PIOB) Output Disable Registerr +#define AT91C_PIOB_IFSR ((AT91_REG *) 0xFFFFF628) // (PIOB) Input Filter Status Register +#define AT91C_PIOB_PPUER ((AT91_REG *) 0xFFFFF664) // (PIOB) Pull-up Enable Register +#define AT91C_PIOB_SODR ((AT91_REG *) 0xFFFFF630) // (PIOB) Set Output Data Register +#define AT91C_PIOB_ISR ((AT91_REG *) 0xFFFFF64C) // (PIOB) Interrupt Status Register +#define AT91C_PIOB_ODSR ((AT91_REG *) 0xFFFFF638) // (PIOB) Output Data Status Register +#define AT91C_PIOB_OSR ((AT91_REG *) 0xFFFFF618) // (PIOB) Output Status Register +#define AT91C_PIOB_MDSR ((AT91_REG *) 0xFFFFF658) // (PIOB) Multi-driver Status Register +#define AT91C_PIOB_IFER ((AT91_REG *) 0xFFFFF620) // (PIOB) Input Filter Enable Register +#define AT91C_PIOB_BSR ((AT91_REG *) 0xFFFFF674) // (PIOB) Select B Register +#define AT91C_PIOB_MDDR ((AT91_REG *) 0xFFFFF654) // (PIOB) Multi-driver Disable Register +#define AT91C_PIOB_OER ((AT91_REG *) 0xFFFFF610) // (PIOB) Output Enable Register +#define AT91C_PIOB_PER ((AT91_REG *) 0xFFFFF600) // (PIOB) PIO Enable Register +// ========== Register definition for CKGR peripheral ========== +#define AT91C_CKGR_MOR ((AT91_REG *) 0xFFFFFC20) // (CKGR) Main Oscillator Register +#define AT91C_CKGR_PLLR ((AT91_REG *) 0xFFFFFC2C) // (CKGR) PLL Register +#define AT91C_CKGR_MCFR ((AT91_REG *) 0xFFFFFC24) // (CKGR) Main Clock Frequency Register +// ========== Register definition for PMC peripheral ========== +#define AT91C_PMC_IDR ((AT91_REG *) 0xFFFFFC64) // (PMC) Interrupt Disable Register +#define AT91C_PMC_MOR ((AT91_REG *) 0xFFFFFC20) // (PMC) Main Oscillator Register +#define AT91C_PMC_PLLR ((AT91_REG *) 0xFFFFFC2C) // (PMC) PLL Register +#define AT91C_PMC_PCER ((AT91_REG *) 0xFFFFFC10) // (PMC) Peripheral Clock Enable Register +#define AT91C_PMC_PCKR ((AT91_REG *) 0xFFFFFC40) // (PMC) Programmable Clock Register +#define AT91C_PMC_MCKR ((AT91_REG *) 0xFFFFFC30) // (PMC) Master Clock Register +#define AT91C_PMC_SCDR ((AT91_REG *) 0xFFFFFC04) // (PMC) System Clock Disable Register +#define AT91C_PMC_PCDR ((AT91_REG *) 0xFFFFFC14) // (PMC) Peripheral Clock Disable Register +#define AT91C_PMC_SCSR ((AT91_REG *) 0xFFFFFC08) // (PMC) System Clock Status Register +#define AT91C_PMC_PCSR ((AT91_REG *) 0xFFFFFC18) // (PMC) Peripheral Clock Status Register +#define AT91C_PMC_MCFR ((AT91_REG *) 0xFFFFFC24) // (PMC) Main Clock Frequency Register +#define AT91C_PMC_SCER ((AT91_REG *) 0xFFFFFC00) // (PMC) System Clock Enable Register +#define AT91C_PMC_IMR ((AT91_REG *) 0xFFFFFC6C) // (PMC) Interrupt Mask Register +#define AT91C_PMC_IER ((AT91_REG *) 0xFFFFFC60) // (PMC) Interrupt Enable Register +#define AT91C_PMC_SR ((AT91_REG *) 0xFFFFFC68) // (PMC) Status Register +// ========== Register definition for RSTC peripheral ========== +#define AT91C_RSTC_RCR ((AT91_REG *) 0xFFFFFD00) // (RSTC) Reset Control Register +#define AT91C_RSTC_RMR ((AT91_REG *) 0xFFFFFD08) // (RSTC) Reset Mode Register +#define AT91C_RSTC_RSR ((AT91_REG *) 0xFFFFFD04) // (RSTC) Reset Status Register +// ========== Register definition for RTTC peripheral ========== +#define AT91C_RTTC_RTSR ((AT91_REG *) 0xFFFFFD2C) // (RTTC) Real-time Status Register +#define AT91C_RTTC_RTMR ((AT91_REG *) 0xFFFFFD20) // (RTTC) Real-time Mode Register +#define AT91C_RTTC_RTVR ((AT91_REG *) 0xFFFFFD28) // (RTTC) Real-time Value Register +#define AT91C_RTTC_RTAR ((AT91_REG *) 0xFFFFFD24) // (RTTC) Real-time Alarm Register +// ========== Register definition for PITC peripheral ========== +#define AT91C_PITC_PIVR ((AT91_REG *) 0xFFFFFD38) // (PITC) Period Interval Value Register +#define AT91C_PITC_PISR ((AT91_REG *) 0xFFFFFD34) // (PITC) Period Interval Status Register +#define AT91C_PITC_PIIR ((AT91_REG *) 0xFFFFFD3C) // (PITC) Period Interval Image Register +#define AT91C_PITC_PIMR ((AT91_REG *) 0xFFFFFD30) // (PITC) Period Interval Mode Register +// ========== Register definition for WDTC peripheral ========== +#define AT91C_WDTC_WDCR ((AT91_REG *) 0xFFFFFD40) // (WDTC) Watchdog Control Register +#define AT91C_WDTC_WDSR ((AT91_REG *) 0xFFFFFD48) // (WDTC) Watchdog Status Register +#define AT91C_WDTC_WDMR ((AT91_REG *) 0xFFFFFD44) // (WDTC) Watchdog Mode Register +// ========== Register definition for VREG peripheral ========== +#define AT91C_VREG_MR ((AT91_REG *) 0xFFFFFD60) // (VREG) Voltage Regulator Mode Register +// ========== Register definition for MC peripheral ========== +#define AT91C_MC_ASR ((AT91_REG *) 0xFFFFFF04) // (MC) MC Abort Status Register +#define AT91C_MC_RCR ((AT91_REG *) 0xFFFFFF00) // (MC) MC Remap Control Register +#define AT91C_MC_FCR ((AT91_REG *) 0xFFFFFF64) // (MC) MC Flash Command Register +#define AT91C_MC_AASR ((AT91_REG *) 0xFFFFFF08) // (MC) MC Abort Address Status Register +#define AT91C_MC_FSR ((AT91_REG *) 0xFFFFFF68) // (MC) MC Flash Status Register +#define AT91C_MC_FMR ((AT91_REG *) 0xFFFFFF60) // (MC) MC Flash Mode Register +// ========== Register definition for PDC_SPI1 peripheral ========== +#define AT91C_SPI1_PTCR ((AT91_REG *) 0xFFFE4120) // (PDC_SPI1) PDC Transfer Control Register +#define AT91C_SPI1_RPR ((AT91_REG *) 0xFFFE4100) // (PDC_SPI1) Receive Pointer Register +#define AT91C_SPI1_TNCR ((AT91_REG *) 0xFFFE411C) // (PDC_SPI1) Transmit Next Counter Register +#define AT91C_SPI1_TPR ((AT91_REG *) 0xFFFE4108) // (PDC_SPI1) Transmit Pointer Register +#define AT91C_SPI1_TNPR ((AT91_REG *) 0xFFFE4118) // (PDC_SPI1) Transmit Next Pointer Register +#define AT91C_SPI1_TCR ((AT91_REG *) 0xFFFE410C) // (PDC_SPI1) Transmit Counter Register +#define AT91C_SPI1_RCR ((AT91_REG *) 0xFFFE4104) // (PDC_SPI1) Receive Counter Register +#define AT91C_SPI1_RNPR ((AT91_REG *) 0xFFFE4110) // (PDC_SPI1) Receive Next Pointer Register +#define AT91C_SPI1_RNCR ((AT91_REG *) 0xFFFE4114) // (PDC_SPI1) Receive Next Counter Register +#define AT91C_SPI1_PTSR ((AT91_REG *) 0xFFFE4124) // (PDC_SPI1) PDC Transfer Status Register +// ========== Register definition for SPI1 peripheral ========== +#define AT91C_SPI1_IMR ((AT91_REG *) 0xFFFE401C) // (SPI1) Interrupt Mask Register +#define AT91C_SPI1_IER ((AT91_REG *) 0xFFFE4014) // (SPI1) Interrupt Enable Register +#define AT91C_SPI1_MR ((AT91_REG *) 0xFFFE4004) // (SPI1) Mode Register +#define AT91C_SPI1_RDR ((AT91_REG *) 0xFFFE4008) // (SPI1) Receive Data Register +#define AT91C_SPI1_IDR ((AT91_REG *) 0xFFFE4018) // (SPI1) Interrupt Disable Register +#define AT91C_SPI1_SR ((AT91_REG *) 0xFFFE4010) // (SPI1) Status Register +#define AT91C_SPI1_TDR ((AT91_REG *) 0xFFFE400C) // (SPI1) Transmit Data Register +#define AT91C_SPI1_CR ((AT91_REG *) 0xFFFE4000) // (SPI1) Control Register +#define AT91C_SPI1_CSR ((AT91_REG *) 0xFFFE4030) // (SPI1) Chip Select Register +// ========== Register definition for PDC_SPI0 peripheral ========== +#define AT91C_SPI0_PTCR ((AT91_REG *) 0xFFFE0120) // (PDC_SPI0) PDC Transfer Control Register +#define AT91C_SPI0_TPR ((AT91_REG *) 0xFFFE0108) // (PDC_SPI0) Transmit Pointer Register +#define AT91C_SPI0_TCR ((AT91_REG *) 0xFFFE010C) // (PDC_SPI0) Transmit Counter Register +#define AT91C_SPI0_RCR ((AT91_REG *) 0xFFFE0104) // (PDC_SPI0) Receive Counter Register +#define AT91C_SPI0_PTSR ((AT91_REG *) 0xFFFE0124) // (PDC_SPI0) PDC Transfer Status Register +#define AT91C_SPI0_RNPR ((AT91_REG *) 0xFFFE0110) // (PDC_SPI0) Receive Next Pointer Register +#define AT91C_SPI0_RPR ((AT91_REG *) 0xFFFE0100) // (PDC_SPI0) Receive Pointer Register +#define AT91C_SPI0_TNCR ((AT91_REG *) 0xFFFE011C) // (PDC_SPI0) Transmit Next Counter Register +#define AT91C_SPI0_RNCR ((AT91_REG *) 0xFFFE0114) // (PDC_SPI0) Receive Next Counter Register +#define AT91C_SPI0_TNPR ((AT91_REG *) 0xFFFE0118) // (PDC_SPI0) Transmit Next Pointer Register +// ========== Register definition for SPI0 peripheral ========== +#define AT91C_SPI0_IER ((AT91_REG *) 0xFFFE0014) // (SPI0) Interrupt Enable Register +#define AT91C_SPI0_SR ((AT91_REG *) 0xFFFE0010) // (SPI0) Status Register +#define AT91C_SPI0_IDR ((AT91_REG *) 0xFFFE0018) // (SPI0) Interrupt Disable Register +#define AT91C_SPI0_CR ((AT91_REG *) 0xFFFE0000) // (SPI0) Control Register +#define AT91C_SPI0_MR ((AT91_REG *) 0xFFFE0004) // (SPI0) Mode Register +#define AT91C_SPI0_IMR ((AT91_REG *) 0xFFFE001C) // (SPI0) Interrupt Mask Register +#define AT91C_SPI0_TDR ((AT91_REG *) 0xFFFE000C) // (SPI0) Transmit Data Register +#define AT91C_SPI0_RDR ((AT91_REG *) 0xFFFE0008) // (SPI0) Receive Data Register +#define AT91C_SPI0_CSR ((AT91_REG *) 0xFFFE0030) // (SPI0) Chip Select Register +// ========== Register definition for PDC_US1 peripheral ========== +#define AT91C_US1_RNCR ((AT91_REG *) 0xFFFC4114) // (PDC_US1) Receive Next Counter Register +#define AT91C_US1_PTCR ((AT91_REG *) 0xFFFC4120) // (PDC_US1) PDC Transfer Control Register +#define AT91C_US1_TCR ((AT91_REG *) 0xFFFC410C) // (PDC_US1) Transmit Counter Register +#define AT91C_US1_PTSR ((AT91_REG *) 0xFFFC4124) // (PDC_US1) PDC Transfer Status Register +#define AT91C_US1_TNPR ((AT91_REG *) 0xFFFC4118) // (PDC_US1) Transmit Next Pointer Register +#define AT91C_US1_RCR ((AT91_REG *) 0xFFFC4104) // (PDC_US1) Receive Counter Register +#define AT91C_US1_RNPR ((AT91_REG *) 0xFFFC4110) // (PDC_US1) Receive Next Pointer Register +#define AT91C_US1_RPR ((AT91_REG *) 0xFFFC4100) // (PDC_US1) Receive Pointer Register +#define AT91C_US1_TNCR ((AT91_REG *) 0xFFFC411C) // (PDC_US1) Transmit Next Counter Register +#define AT91C_US1_TPR ((AT91_REG *) 0xFFFC4108) // (PDC_US1) Transmit Pointer Register +// ========== Register definition for US1 peripheral ========== +#define AT91C_US1_IF ((AT91_REG *) 0xFFFC404C) // (US1) IRDA_FILTER Register +#define AT91C_US1_NER ((AT91_REG *) 0xFFFC4044) // (US1) Nb Errors Register +#define AT91C_US1_RTOR ((AT91_REG *) 0xFFFC4024) // (US1) Receiver Time-out Register +#define AT91C_US1_CSR ((AT91_REG *) 0xFFFC4014) // (US1) Channel Status Register +#define AT91C_US1_IDR ((AT91_REG *) 0xFFFC400C) // (US1) Interrupt Disable Register +#define AT91C_US1_IER ((AT91_REG *) 0xFFFC4008) // (US1) Interrupt Enable Register +#define AT91C_US1_THR ((AT91_REG *) 0xFFFC401C) // (US1) Transmitter Holding Register +#define AT91C_US1_TTGR ((AT91_REG *) 0xFFFC4028) // (US1) Transmitter Time-guard Register +#define AT91C_US1_RHR ((AT91_REG *) 0xFFFC4018) // (US1) Receiver Holding Register +#define AT91C_US1_BRGR ((AT91_REG *) 0xFFFC4020) // (US1) Baud Rate Generator Register +#define AT91C_US1_IMR ((AT91_REG *) 0xFFFC4010) // (US1) Interrupt Mask Register +#define AT91C_US1_FIDI ((AT91_REG *) 0xFFFC4040) // (US1) FI_DI_Ratio Register +#define AT91C_US1_CR ((AT91_REG *) 0xFFFC4000) // (US1) Control Register +#define AT91C_US1_MR ((AT91_REG *) 0xFFFC4004) // (US1) Mode Register +// ========== Register definition for PDC_US0 peripheral ========== +#define AT91C_US0_TNPR ((AT91_REG *) 0xFFFC0118) // (PDC_US0) Transmit Next Pointer Register +#define AT91C_US0_RNPR ((AT91_REG *) 0xFFFC0110) // (PDC_US0) Receive Next Pointer Register +#define AT91C_US0_TCR ((AT91_REG *) 0xFFFC010C) // (PDC_US0) Transmit Counter Register +#define AT91C_US0_PTCR ((AT91_REG *) 0xFFFC0120) // (PDC_US0) PDC Transfer Control Register +#define AT91C_US0_PTSR ((AT91_REG *) 0xFFFC0124) // (PDC_US0) PDC Transfer Status Register +#define AT91C_US0_TNCR ((AT91_REG *) 0xFFFC011C) // (PDC_US0) Transmit Next Counter Register +#define AT91C_US0_TPR ((AT91_REG *) 0xFFFC0108) // (PDC_US0) Transmit Pointer Register +#define AT91C_US0_RCR ((AT91_REG *) 0xFFFC0104) // (PDC_US0) Receive Counter Register +#define AT91C_US0_RPR ((AT91_REG *) 0xFFFC0100) // (PDC_US0) Receive Pointer Register +#define AT91C_US0_RNCR ((AT91_REG *) 0xFFFC0114) // (PDC_US0) Receive Next Counter Register +// ========== Register definition for US0 peripheral ========== +#define AT91C_US0_BRGR ((AT91_REG *) 0xFFFC0020) // (US0) Baud Rate Generator Register +#define AT91C_US0_NER ((AT91_REG *) 0xFFFC0044) // (US0) Nb Errors Register +#define AT91C_US0_CR ((AT91_REG *) 0xFFFC0000) // (US0) Control Register +#define AT91C_US0_IMR ((AT91_REG *) 0xFFFC0010) // (US0) Interrupt Mask Register +#define AT91C_US0_FIDI ((AT91_REG *) 0xFFFC0040) // (US0) FI_DI_Ratio Register +#define AT91C_US0_TTGR ((AT91_REG *) 0xFFFC0028) // (US0) Transmitter Time-guard Register +#define AT91C_US0_MR ((AT91_REG *) 0xFFFC0004) // (US0) Mode Register +#define AT91C_US0_RTOR ((AT91_REG *) 0xFFFC0024) // (US0) Receiver Time-out Register +#define AT91C_US0_CSR ((AT91_REG *) 0xFFFC0014) // (US0) Channel Status Register +#define AT91C_US0_RHR ((AT91_REG *) 0xFFFC0018) // (US0) Receiver Holding Register +#define AT91C_US0_IDR ((AT91_REG *) 0xFFFC000C) // (US0) Interrupt Disable Register +#define AT91C_US0_THR ((AT91_REG *) 0xFFFC001C) // (US0) Transmitter Holding Register +#define AT91C_US0_IF ((AT91_REG *) 0xFFFC004C) // (US0) IRDA_FILTER Register +#define AT91C_US0_IER ((AT91_REG *) 0xFFFC0008) // (US0) Interrupt Enable Register +// ========== Register definition for PDC_SSC peripheral ========== +#define AT91C_SSC_TNCR ((AT91_REG *) 0xFFFD411C) // (PDC_SSC) Transmit Next Counter Register +#define AT91C_SSC_RPR ((AT91_REG *) 0xFFFD4100) // (PDC_SSC) Receive Pointer Register +#define AT91C_SSC_RNCR ((AT91_REG *) 0xFFFD4114) // (PDC_SSC) Receive Next Counter Register +#define AT91C_SSC_TPR ((AT91_REG *) 0xFFFD4108) // (PDC_SSC) Transmit Pointer Register +#define AT91C_SSC_PTCR ((AT91_REG *) 0xFFFD4120) // (PDC_SSC) PDC Transfer Control Register +#define AT91C_SSC_TCR ((AT91_REG *) 0xFFFD410C) // (PDC_SSC) Transmit Counter Register +#define AT91C_SSC_RCR ((AT91_REG *) 0xFFFD4104) // (PDC_SSC) Receive Counter Register +#define AT91C_SSC_RNPR ((AT91_REG *) 0xFFFD4110) // (PDC_SSC) Receive Next Pointer Register +#define AT91C_SSC_TNPR ((AT91_REG *) 0xFFFD4118) // (PDC_SSC) Transmit Next Pointer Register +#define AT91C_SSC_PTSR ((AT91_REG *) 0xFFFD4124) // (PDC_SSC) PDC Transfer Status Register +// ========== Register definition for SSC peripheral ========== +#define AT91C_SSC_RHR ((AT91_REG *) 0xFFFD4020) // (SSC) Receive Holding Register +#define AT91C_SSC_RSHR ((AT91_REG *) 0xFFFD4030) // (SSC) Receive Sync Holding Register +#define AT91C_SSC_TFMR ((AT91_REG *) 0xFFFD401C) // (SSC) Transmit Frame Mode Register +#define AT91C_SSC_IDR ((AT91_REG *) 0xFFFD4048) // (SSC) Interrupt Disable Register +#define AT91C_SSC_THR ((AT91_REG *) 0xFFFD4024) // (SSC) Transmit Holding Register +#define AT91C_SSC_RCMR ((AT91_REG *) 0xFFFD4010) // (SSC) Receive Clock ModeRegister +#define AT91C_SSC_IER ((AT91_REG *) 0xFFFD4044) // (SSC) Interrupt Enable Register +#define AT91C_SSC_TSHR ((AT91_REG *) 0xFFFD4034) // (SSC) Transmit Sync Holding Register +#define AT91C_SSC_SR ((AT91_REG *) 0xFFFD4040) // (SSC) Status Register +#define AT91C_SSC_CMR ((AT91_REG *) 0xFFFD4004) // (SSC) Clock Mode Register +#define AT91C_SSC_TCMR ((AT91_REG *) 0xFFFD4018) // (SSC) Transmit Clock Mode Register +#define AT91C_SSC_CR ((AT91_REG *) 0xFFFD4000) // (SSC) Control Register +#define AT91C_SSC_IMR ((AT91_REG *) 0xFFFD404C) // (SSC) Interrupt Mask Register +#define AT91C_SSC_RFMR ((AT91_REG *) 0xFFFD4014) // (SSC) Receive Frame Mode Register +// ========== Register definition for TWI peripheral ========== +#define AT91C_TWI_IER ((AT91_REG *) 0xFFFB8024) // (TWI) Interrupt Enable Register +#define AT91C_TWI_CR ((AT91_REG *) 0xFFFB8000) // (TWI) Control Register +#define AT91C_TWI_SR ((AT91_REG *) 0xFFFB8020) // (TWI) Status Register +#define AT91C_TWI_IMR ((AT91_REG *) 0xFFFB802C) // (TWI) Interrupt Mask Register +#define AT91C_TWI_THR ((AT91_REG *) 0xFFFB8034) // (TWI) Transmit Holding Register +#define AT91C_TWI_IDR ((AT91_REG *) 0xFFFB8028) // (TWI) Interrupt Disable Register +#define AT91C_TWI_IADR ((AT91_REG *) 0xFFFB800C) // (TWI) Internal Address Register +#define AT91C_TWI_MMR ((AT91_REG *) 0xFFFB8004) // (TWI) Master Mode Register +#define AT91C_TWI_CWGR ((AT91_REG *) 0xFFFB8010) // (TWI) Clock Waveform Generator Register +#define AT91C_TWI_RHR ((AT91_REG *) 0xFFFB8030) // (TWI) Receive Holding Register +// ========== Register definition for PWMC_CH3 peripheral ========== +#define AT91C_PWMC_CH3_CUPDR ((AT91_REG *) 0xFFFCC270) // (PWMC_CH3) Channel Update Register +#define AT91C_PWMC_CH3_Reserved ((AT91_REG *) 0xFFFCC274) // (PWMC_CH3) Reserved +#define AT91C_PWMC_CH3_CPRDR ((AT91_REG *) 0xFFFCC268) // (PWMC_CH3) Channel Period Register +#define AT91C_PWMC_CH3_CDTYR ((AT91_REG *) 0xFFFCC264) // (PWMC_CH3) Channel Duty Cycle Register +#define AT91C_PWMC_CH3_CCNTR ((AT91_REG *) 0xFFFCC26C) // (PWMC_CH3) Channel Counter Register +#define AT91C_PWMC_CH3_CMR ((AT91_REG *) 0xFFFCC260) // (PWMC_CH3) Channel Mode Register +// ========== Register definition for PWMC_CH2 peripheral ========== +#define AT91C_PWMC_CH2_Reserved ((AT91_REG *) 0xFFFCC254) // (PWMC_CH2) Reserved +#define AT91C_PWMC_CH2_CMR ((AT91_REG *) 0xFFFCC240) // (PWMC_CH2) Channel Mode Register +#define AT91C_PWMC_CH2_CCNTR ((AT91_REG *) 0xFFFCC24C) // (PWMC_CH2) Channel Counter Register +#define AT91C_PWMC_CH2_CPRDR ((AT91_REG *) 0xFFFCC248) // (PWMC_CH2) Channel Period Register +#define AT91C_PWMC_CH2_CUPDR ((AT91_REG *) 0xFFFCC250) // (PWMC_CH2) Channel Update Register +#define AT91C_PWMC_CH2_CDTYR ((AT91_REG *) 0xFFFCC244) // (PWMC_CH2) Channel Duty Cycle Register +// ========== Register definition for PWMC_CH1 peripheral ========== +#define AT91C_PWMC_CH1_Reserved ((AT91_REG *) 0xFFFCC234) // (PWMC_CH1) Reserved +#define AT91C_PWMC_CH1_CUPDR ((AT91_REG *) 0xFFFCC230) // (PWMC_CH1) Channel Update Register +#define AT91C_PWMC_CH1_CPRDR ((AT91_REG *) 0xFFFCC228) // (PWMC_CH1) Channel Period Register +#define AT91C_PWMC_CH1_CCNTR ((AT91_REG *) 0xFFFCC22C) // (PWMC_CH1) Channel Counter Register +#define AT91C_PWMC_CH1_CDTYR ((AT91_REG *) 0xFFFCC224) // (PWMC_CH1) Channel Duty Cycle Register +#define AT91C_PWMC_CH1_CMR ((AT91_REG *) 0xFFFCC220) // (PWMC_CH1) Channel Mode Register +// ========== Register definition for PWMC_CH0 peripheral ========== +#define AT91C_PWMC_CH0_Reserved ((AT91_REG *) 0xFFFCC214) // (PWMC_CH0) Reserved +#define AT91C_PWMC_CH0_CPRDR ((AT91_REG *) 0xFFFCC208) // (PWMC_CH0) Channel Period Register +#define AT91C_PWMC_CH0_CDTYR ((AT91_REG *) 0xFFFCC204) // (PWMC_CH0) Channel Duty Cycle Register +#define AT91C_PWMC_CH0_CMR ((AT91_REG *) 0xFFFCC200) // (PWMC_CH0) Channel Mode Register +#define AT91C_PWMC_CH0_CUPDR ((AT91_REG *) 0xFFFCC210) // (PWMC_CH0) Channel Update Register +#define AT91C_PWMC_CH0_CCNTR ((AT91_REG *) 0xFFFCC20C) // (PWMC_CH0) Channel Counter Register +// ========== Register definition for PWMC peripheral ========== +#define AT91C_PWMC_IDR ((AT91_REG *) 0xFFFCC014) // (PWMC) PWMC Interrupt Disable Register +#define AT91C_PWMC_DIS ((AT91_REG *) 0xFFFCC008) // (PWMC) PWMC Disable Register +#define AT91C_PWMC_IER ((AT91_REG *) 0xFFFCC010) // (PWMC) PWMC Interrupt Enable Register +#define AT91C_PWMC_VR ((AT91_REG *) 0xFFFCC0FC) // (PWMC) PWMC Version Register +#define AT91C_PWMC_ISR ((AT91_REG *) 0xFFFCC01C) // (PWMC) PWMC Interrupt Status Register +#define AT91C_PWMC_SR ((AT91_REG *) 0xFFFCC00C) // (PWMC) PWMC Status Register +#define AT91C_PWMC_IMR ((AT91_REG *) 0xFFFCC018) // (PWMC) PWMC Interrupt Mask Register +#define AT91C_PWMC_MR ((AT91_REG *) 0xFFFCC000) // (PWMC) PWMC Mode Register +#define AT91C_PWMC_ENA ((AT91_REG *) 0xFFFCC004) // (PWMC) PWMC Enable Register +// ========== Register definition for UDP peripheral ========== +#define AT91C_UDP_IMR ((AT91_REG *) 0xFFFB0018) // (UDP) Interrupt Mask Register +#define AT91C_UDP_FADDR ((AT91_REG *) 0xFFFB0008) // (UDP) Function Address Register +#define AT91C_UDP_NUM ((AT91_REG *) 0xFFFB0000) // (UDP) Frame Number Register +#define AT91C_UDP_FDR ((AT91_REG *) 0xFFFB0050) // (UDP) Endpoint FIFO Data Register +#define AT91C_UDP_ISR ((AT91_REG *) 0xFFFB001C) // (UDP) Interrupt Status Register +#define AT91C_UDP_CSR ((AT91_REG *) 0xFFFB0030) // (UDP) Endpoint Control and Status Register +#define AT91C_UDP_IDR ((AT91_REG *) 0xFFFB0014) // (UDP) Interrupt Disable Register +#define AT91C_UDP_ICR ((AT91_REG *) 0xFFFB0020) // (UDP) Interrupt Clear Register +#define AT91C_UDP_RSTEP ((AT91_REG *) 0xFFFB0028) // (UDP) Reset Endpoint Register +#define AT91C_UDP_TXVC ((AT91_REG *) 0xFFFB0074) // (UDP) Transceiver Control Register +#define AT91C_UDP_GLBSTATE ((AT91_REG *) 0xFFFB0004) // (UDP) Global State Register +#define AT91C_UDP_IER ((AT91_REG *) 0xFFFB0010) // (UDP) Interrupt Enable Register +// ========== Register definition for TC0 peripheral ========== +#define AT91C_TC0_SR ((AT91_REG *) 0xFFFA0020) // (TC0) Status Register +#define AT91C_TC0_RC ((AT91_REG *) 0xFFFA001C) // (TC0) Register C +#define AT91C_TC0_RB ((AT91_REG *) 0xFFFA0018) // (TC0) Register B +#define AT91C_TC0_CCR ((AT91_REG *) 0xFFFA0000) // (TC0) Channel Control Register +#define AT91C_TC0_CMR ((AT91_REG *) 0xFFFA0004) // (TC0) Channel Mode Register (Capture Mode / Waveform Mode) +#define AT91C_TC0_IER ((AT91_REG *) 0xFFFA0024) // (TC0) Interrupt Enable Register +#define AT91C_TC0_RA ((AT91_REG *) 0xFFFA0014) // (TC0) Register A +#define AT91C_TC0_IDR ((AT91_REG *) 0xFFFA0028) // (TC0) Interrupt Disable Register +#define AT91C_TC0_CV ((AT91_REG *) 0xFFFA0010) // (TC0) Counter Value +#define AT91C_TC0_IMR ((AT91_REG *) 0xFFFA002C) // (TC0) Interrupt Mask Register +// ========== Register definition for TC1 peripheral ========== +#define AT91C_TC1_RB ((AT91_REG *) 0xFFFA0058) // (TC1) Register B +#define AT91C_TC1_CCR ((AT91_REG *) 0xFFFA0040) // (TC1) Channel Control Register +#define AT91C_TC1_IER ((AT91_REG *) 0xFFFA0064) // (TC1) Interrupt Enable Register +#define AT91C_TC1_IDR ((AT91_REG *) 0xFFFA0068) // (TC1) Interrupt Disable Register +#define AT91C_TC1_SR ((AT91_REG *) 0xFFFA0060) // (TC1) Status Register +#define AT91C_TC1_CMR ((AT91_REG *) 0xFFFA0044) // (TC1) Channel Mode Register (Capture Mode / Waveform Mode) +#define AT91C_TC1_RA ((AT91_REG *) 0xFFFA0054) // (TC1) Register A +#define AT91C_TC1_RC ((AT91_REG *) 0xFFFA005C) // (TC1) Register C +#define AT91C_TC1_IMR ((AT91_REG *) 0xFFFA006C) // (TC1) Interrupt Mask Register +#define AT91C_TC1_CV ((AT91_REG *) 0xFFFA0050) // (TC1) Counter Value +// ========== Register definition for TC2 peripheral ========== +#define AT91C_TC2_CMR ((AT91_REG *) 0xFFFA0084) // (TC2) Channel Mode Register (Capture Mode / Waveform Mode) +#define AT91C_TC2_CCR ((AT91_REG *) 0xFFFA0080) // (TC2) Channel Control Register +#define AT91C_TC2_CV ((AT91_REG *) 0xFFFA0090) // (TC2) Counter Value +#define AT91C_TC2_RA ((AT91_REG *) 0xFFFA0094) // (TC2) Register A +#define AT91C_TC2_RB ((AT91_REG *) 0xFFFA0098) // (TC2) Register B +#define AT91C_TC2_IDR ((AT91_REG *) 0xFFFA00A8) // (TC2) Interrupt Disable Register +#define AT91C_TC2_IMR ((AT91_REG *) 0xFFFA00AC) // (TC2) Interrupt Mask Register +#define AT91C_TC2_RC ((AT91_REG *) 0xFFFA009C) // (TC2) Register C +#define AT91C_TC2_IER ((AT91_REG *) 0xFFFA00A4) // (TC2) Interrupt Enable Register +#define AT91C_TC2_SR ((AT91_REG *) 0xFFFA00A0) // (TC2) Status Register +// ========== Register definition for TCB peripheral ========== +#define AT91C_TCB_BMR ((AT91_REG *) 0xFFFA00C4) // (TCB) TC Block Mode Register +#define AT91C_TCB_BCR ((AT91_REG *) 0xFFFA00C0) // (TCB) TC Block Control Register +// ========== Register definition for CAN_MB0 peripheral ========== +#define AT91C_CAN_MB0_MDL ((AT91_REG *) 0xFFFD0214) // (CAN_MB0) MailBox Data Low Register +#define AT91C_CAN_MB0_MAM ((AT91_REG *) 0xFFFD0204) // (CAN_MB0) MailBox Acceptance Mask Register +#define AT91C_CAN_MB0_MCR ((AT91_REG *) 0xFFFD021C) // (CAN_MB0) MailBox Control Register +#define AT91C_CAN_MB0_MID ((AT91_REG *) 0xFFFD0208) // (CAN_MB0) MailBox ID Register +#define AT91C_CAN_MB0_MSR ((AT91_REG *) 0xFFFD0210) // (CAN_MB0) MailBox Status Register +#define AT91C_CAN_MB0_MFID ((AT91_REG *) 0xFFFD020C) // (CAN_MB0) MailBox Family ID Register +#define AT91C_CAN_MB0_MDH ((AT91_REG *) 0xFFFD0218) // (CAN_MB0) MailBox Data High Register +#define AT91C_CAN_MB0_MMR ((AT91_REG *) 0xFFFD0200) // (CAN_MB0) MailBox Mode Register +// ========== Register definition for CAN_MB1 peripheral ========== +#define AT91C_CAN_MB1_MDL ((AT91_REG *) 0xFFFD0234) // (CAN_MB1) MailBox Data Low Register +#define AT91C_CAN_MB1_MID ((AT91_REG *) 0xFFFD0228) // (CAN_MB1) MailBox ID Register +#define AT91C_CAN_MB1_MMR ((AT91_REG *) 0xFFFD0220) // (CAN_MB1) MailBox Mode Register +#define AT91C_CAN_MB1_MSR ((AT91_REG *) 0xFFFD0230) // (CAN_MB1) MailBox Status Register +#define AT91C_CAN_MB1_MAM ((AT91_REG *) 0xFFFD0224) // (CAN_MB1) MailBox Acceptance Mask Register +#define AT91C_CAN_MB1_MDH ((AT91_REG *) 0xFFFD0238) // (CAN_MB1) MailBox Data High Register +#define AT91C_CAN_MB1_MCR ((AT91_REG *) 0xFFFD023C) // (CAN_MB1) MailBox Control Register +#define AT91C_CAN_MB1_MFID ((AT91_REG *) 0xFFFD022C) // (CAN_MB1) MailBox Family ID Register +// ========== Register definition for CAN_MB2 peripheral ========== +#define AT91C_CAN_MB2_MCR ((AT91_REG *) 0xFFFD025C) // (CAN_MB2) MailBox Control Register +#define AT91C_CAN_MB2_MDH ((AT91_REG *) 0xFFFD0258) // (CAN_MB2) MailBox Data High Register +#define AT91C_CAN_MB2_MID ((AT91_REG *) 0xFFFD0248) // (CAN_MB2) MailBox ID Register +#define AT91C_CAN_MB2_MDL ((AT91_REG *) 0xFFFD0254) // (CAN_MB2) MailBox Data Low Register +#define AT91C_CAN_MB2_MMR ((AT91_REG *) 0xFFFD0240) // (CAN_MB2) MailBox Mode Register +#define AT91C_CAN_MB2_MAM ((AT91_REG *) 0xFFFD0244) // (CAN_MB2) MailBox Acceptance Mask Register +#define AT91C_CAN_MB2_MFID ((AT91_REG *) 0xFFFD024C) // (CAN_MB2) MailBox Family ID Register +#define AT91C_CAN_MB2_MSR ((AT91_REG *) 0xFFFD0250) // (CAN_MB2) MailBox Status Register +// ========== Register definition for CAN_MB3 peripheral ========== +#define AT91C_CAN_MB3_MFID ((AT91_REG *) 0xFFFD026C) // (CAN_MB3) MailBox Family ID Register +#define AT91C_CAN_MB3_MAM ((AT91_REG *) 0xFFFD0264) // (CAN_MB3) MailBox Acceptance Mask Register +#define AT91C_CAN_MB3_MID ((AT91_REG *) 0xFFFD0268) // (CAN_MB3) MailBox ID Register +#define AT91C_CAN_MB3_MCR ((AT91_REG *) 0xFFFD027C) // (CAN_MB3) MailBox Control Register +#define AT91C_CAN_MB3_MMR ((AT91_REG *) 0xFFFD0260) // (CAN_MB3) MailBox Mode Register +#define AT91C_CAN_MB3_MSR ((AT91_REG *) 0xFFFD0270) // (CAN_MB3) MailBox Status Register +#define AT91C_CAN_MB3_MDL ((AT91_REG *) 0xFFFD0274) // (CAN_MB3) MailBox Data Low Register +#define AT91C_CAN_MB3_MDH ((AT91_REG *) 0xFFFD0278) // (CAN_MB3) MailBox Data High Register +// ========== Register definition for CAN_MB4 peripheral ========== +#define AT91C_CAN_MB4_MID ((AT91_REG *) 0xFFFD0288) // (CAN_MB4) MailBox ID Register +#define AT91C_CAN_MB4_MMR ((AT91_REG *) 0xFFFD0280) // (CAN_MB4) MailBox Mode Register +#define AT91C_CAN_MB4_MDH ((AT91_REG *) 0xFFFD0298) // (CAN_MB4) MailBox Data High Register +#define AT91C_CAN_MB4_MFID ((AT91_REG *) 0xFFFD028C) // (CAN_MB4) MailBox Family ID Register +#define AT91C_CAN_MB4_MSR ((AT91_REG *) 0xFFFD0290) // (CAN_MB4) MailBox Status Register +#define AT91C_CAN_MB4_MCR ((AT91_REG *) 0xFFFD029C) // (CAN_MB4) MailBox Control Register +#define AT91C_CAN_MB4_MDL ((AT91_REG *) 0xFFFD0294) // (CAN_MB4) MailBox Data Low Register +#define AT91C_CAN_MB4_MAM ((AT91_REG *) 0xFFFD0284) // (CAN_MB4) MailBox Acceptance Mask Register +// ========== Register definition for CAN_MB5 peripheral ========== +#define AT91C_CAN_MB5_MSR ((AT91_REG *) 0xFFFD02B0) // (CAN_MB5) MailBox Status Register +#define AT91C_CAN_MB5_MCR ((AT91_REG *) 0xFFFD02BC) // (CAN_MB5) MailBox Control Register +#define AT91C_CAN_MB5_MFID ((AT91_REG *) 0xFFFD02AC) // (CAN_MB5) MailBox Family ID Register +#define AT91C_CAN_MB5_MDH ((AT91_REG *) 0xFFFD02B8) // (CAN_MB5) MailBox Data High Register +#define AT91C_CAN_MB5_MID ((AT91_REG *) 0xFFFD02A8) // (CAN_MB5) MailBox ID Register +#define AT91C_CAN_MB5_MMR ((AT91_REG *) 0xFFFD02A0) // (CAN_MB5) MailBox Mode Register +#define AT91C_CAN_MB5_MDL ((AT91_REG *) 0xFFFD02B4) // (CAN_MB5) MailBox Data Low Register +#define AT91C_CAN_MB5_MAM ((AT91_REG *) 0xFFFD02A4) // (CAN_MB5) MailBox Acceptance Mask Register +// ========== Register definition for CAN_MB6 peripheral ========== +#define AT91C_CAN_MB6_MFID ((AT91_REG *) 0xFFFD02CC) // (CAN_MB6) MailBox Family ID Register +#define AT91C_CAN_MB6_MID ((AT91_REG *) 0xFFFD02C8) // (CAN_MB6) MailBox ID Register +#define AT91C_CAN_MB6_MAM ((AT91_REG *) 0xFFFD02C4) // (CAN_MB6) MailBox Acceptance Mask Register +#define AT91C_CAN_MB6_MSR ((AT91_REG *) 0xFFFD02D0) // (CAN_MB6) MailBox Status Register +#define AT91C_CAN_MB6_MDL ((AT91_REG *) 0xFFFD02D4) // (CAN_MB6) MailBox Data Low Register +#define AT91C_CAN_MB6_MCR ((AT91_REG *) 0xFFFD02DC) // (CAN_MB6) MailBox Control Register +#define AT91C_CAN_MB6_MDH ((AT91_REG *) 0xFFFD02D8) // (CAN_MB6) MailBox Data High Register +#define AT91C_CAN_MB6_MMR ((AT91_REG *) 0xFFFD02C0) // (CAN_MB6) MailBox Mode Register +// ========== Register definition for CAN_MB7 peripheral ========== +#define AT91C_CAN_MB7_MCR ((AT91_REG *) 0xFFFD02FC) // (CAN_MB7) MailBox Control Register +#define AT91C_CAN_MB7_MDH ((AT91_REG *) 0xFFFD02F8) // (CAN_MB7) MailBox Data High Register +#define AT91C_CAN_MB7_MFID ((AT91_REG *) 0xFFFD02EC) // (CAN_MB7) MailBox Family ID Register +#define AT91C_CAN_MB7_MDL ((AT91_REG *) 0xFFFD02F4) // (CAN_MB7) MailBox Data Low Register +#define AT91C_CAN_MB7_MID ((AT91_REG *) 0xFFFD02E8) // (CAN_MB7) MailBox ID Register +#define AT91C_CAN_MB7_MMR ((AT91_REG *) 0xFFFD02E0) // (CAN_MB7) MailBox Mode Register +#define AT91C_CAN_MB7_MAM ((AT91_REG *) 0xFFFD02E4) // (CAN_MB7) MailBox Acceptance Mask Register +#define AT91C_CAN_MB7_MSR ((AT91_REG *) 0xFFFD02F0) // (CAN_MB7) MailBox Status Register +// ========== Register definition for CAN peripheral ========== +#define AT91C_CAN_TCR ((AT91_REG *) 0xFFFD0024) // (CAN) Transfer Command Register +#define AT91C_CAN_IMR ((AT91_REG *) 0xFFFD000C) // (CAN) Interrupt Mask Register +#define AT91C_CAN_IER ((AT91_REG *) 0xFFFD0004) // (CAN) Interrupt Enable Register +#define AT91C_CAN_ECR ((AT91_REG *) 0xFFFD0020) // (CAN) Error Counter Register +#define AT91C_CAN_TIMESTP ((AT91_REG *) 0xFFFD001C) // (CAN) Time Stamp Register +#define AT91C_CAN_MR ((AT91_REG *) 0xFFFD0000) // (CAN) Mode Register +#define AT91C_CAN_IDR ((AT91_REG *) 0xFFFD0008) // (CAN) Interrupt Disable Register +#define AT91C_CAN_ACR ((AT91_REG *) 0xFFFD0028) // (CAN) Abort Command Register +#define AT91C_CAN_TIM ((AT91_REG *) 0xFFFD0018) // (CAN) Timer Register +#define AT91C_CAN_SR ((AT91_REG *) 0xFFFD0010) // (CAN) Status Register +#define AT91C_CAN_BR ((AT91_REG *) 0xFFFD0014) // (CAN) Baudrate Register +#define AT91C_CAN_VR ((AT91_REG *) 0xFFFD00FC) // (CAN) Version Register +// ========== Register definition for EMAC peripheral ========== +#define AT91C_EMAC_ISR ((AT91_REG *) 0xFFFDC024) // (EMAC) Interrupt Status Register +#define AT91C_EMAC_SA4H ((AT91_REG *) 0xFFFDC0B4) // (EMAC) Specific Address 4 Top, Last 2 bytes +#define AT91C_EMAC_SA1L ((AT91_REG *) 0xFFFDC098) // (EMAC) Specific Address 1 Bottom, First 4 bytes +#define AT91C_EMAC_ELE ((AT91_REG *) 0xFFFDC078) // (EMAC) Excessive Length Errors Register +#define AT91C_EMAC_LCOL ((AT91_REG *) 0xFFFDC05C) // (EMAC) Late Collision Register +#define AT91C_EMAC_RLE ((AT91_REG *) 0xFFFDC088) // (EMAC) Receive Length Field Mismatch Register +#define AT91C_EMAC_WOL ((AT91_REG *) 0xFFFDC0C4) // (EMAC) Wake On LAN Register +#define AT91C_EMAC_DTF ((AT91_REG *) 0xFFFDC058) // (EMAC) Deferred Transmission Frame Register +#define AT91C_EMAC_TUND ((AT91_REG *) 0xFFFDC064) // (EMAC) Transmit Underrun Error Register +#define AT91C_EMAC_NCR ((AT91_REG *) 0xFFFDC000) // (EMAC) Network Control Register +#define AT91C_EMAC_SA4L ((AT91_REG *) 0xFFFDC0B0) // (EMAC) Specific Address 4 Bottom, First 4 bytes +#define AT91C_EMAC_RSR ((AT91_REG *) 0xFFFDC020) // (EMAC) Receive Status Register +#define AT91C_EMAC_SA3L ((AT91_REG *) 0xFFFDC0A8) // (EMAC) Specific Address 3 Bottom, First 4 bytes +#define AT91C_EMAC_TSR ((AT91_REG *) 0xFFFDC014) // (EMAC) Transmit Status Register +#define AT91C_EMAC_IDR ((AT91_REG *) 0xFFFDC02C) // (EMAC) Interrupt Disable Register +#define AT91C_EMAC_RSE ((AT91_REG *) 0xFFFDC074) // (EMAC) Receive Symbol Errors Register +#define AT91C_EMAC_ECOL ((AT91_REG *) 0xFFFDC060) // (EMAC) Excessive Collision Register +#define AT91C_EMAC_TID ((AT91_REG *) 0xFFFDC0B8) // (EMAC) Type ID Checking Register +#define AT91C_EMAC_HRB ((AT91_REG *) 0xFFFDC090) // (EMAC) Hash Address Bottom[31:0] +#define AT91C_EMAC_TBQP ((AT91_REG *) 0xFFFDC01C) // (EMAC) Transmit Buffer Queue Pointer +#define AT91C_EMAC_USRIO ((AT91_REG *) 0xFFFDC0C0) // (EMAC) USER Input/Output Register +#define AT91C_EMAC_PTR ((AT91_REG *) 0xFFFDC038) // (EMAC) Pause Time Register +#define AT91C_EMAC_SA2H ((AT91_REG *) 0xFFFDC0A4) // (EMAC) Specific Address 2 Top, Last 2 bytes +#define AT91C_EMAC_ROV ((AT91_REG *) 0xFFFDC070) // (EMAC) Receive Overrun Errors Register +#define AT91C_EMAC_ALE ((AT91_REG *) 0xFFFDC054) // (EMAC) Alignment Error Register +#define AT91C_EMAC_RJA ((AT91_REG *) 0xFFFDC07C) // (EMAC) Receive Jabbers Register +#define AT91C_EMAC_RBQP ((AT91_REG *) 0xFFFDC018) // (EMAC) Receive Buffer Queue Pointer +#define AT91C_EMAC_TPF ((AT91_REG *) 0xFFFDC08C) // (EMAC) Transmitted Pause Frames Register +#define AT91C_EMAC_NCFGR ((AT91_REG *) 0xFFFDC004) // (EMAC) Network Configuration Register +#define AT91C_EMAC_HRT ((AT91_REG *) 0xFFFDC094) // (EMAC) Hash Address Top[63:32] +#define AT91C_EMAC_USF ((AT91_REG *) 0xFFFDC080) // (EMAC) Undersize Frames Register +#define AT91C_EMAC_FCSE ((AT91_REG *) 0xFFFDC050) // (EMAC) Frame Check Sequence Error Register +#define AT91C_EMAC_TPQ ((AT91_REG *) 0xFFFDC0BC) // (EMAC) Transmit Pause Quantum Register +#define AT91C_EMAC_MAN ((AT91_REG *) 0xFFFDC034) // (EMAC) PHY Maintenance Register +#define AT91C_EMAC_FTO ((AT91_REG *) 0xFFFDC040) // (EMAC) Frames Transmitted OK Register +#define AT91C_EMAC_REV ((AT91_REG *) 0xFFFDC0FC) // (EMAC) Revision Register +#define AT91C_EMAC_IMR ((AT91_REG *) 0xFFFDC030) // (EMAC) Interrupt Mask Register +#define AT91C_EMAC_SCF ((AT91_REG *) 0xFFFDC044) // (EMAC) Single Collision Frame Register +#define AT91C_EMAC_PFR ((AT91_REG *) 0xFFFDC03C) // (EMAC) Pause Frames received Register +#define AT91C_EMAC_MCF ((AT91_REG *) 0xFFFDC048) // (EMAC) Multiple Collision Frame Register +#define AT91C_EMAC_NSR ((AT91_REG *) 0xFFFDC008) // (EMAC) Network Status Register +#define AT91C_EMAC_SA2L ((AT91_REG *) 0xFFFDC0A0) // (EMAC) Specific Address 2 Bottom, First 4 bytes +#define AT91C_EMAC_FRO ((AT91_REG *) 0xFFFDC04C) // (EMAC) Frames Received OK Register +#define AT91C_EMAC_IER ((AT91_REG *) 0xFFFDC028) // (EMAC) Interrupt Enable Register +#define AT91C_EMAC_SA1H ((AT91_REG *) 0xFFFDC09C) // (EMAC) Specific Address 1 Top, Last 2 bytes +#define AT91C_EMAC_CSE ((AT91_REG *) 0xFFFDC068) // (EMAC) Carrier Sense Error Register +#define AT91C_EMAC_SA3H ((AT91_REG *) 0xFFFDC0AC) // (EMAC) Specific Address 3 Top, Last 2 bytes +#define AT91C_EMAC_RRE ((AT91_REG *) 0xFFFDC06C) // (EMAC) Receive Ressource Error Register +#define AT91C_EMAC_STE ((AT91_REG *) 0xFFFDC084) // (EMAC) SQE Test Error Register +// ========== Register definition for PDC_ADC peripheral ========== +#define AT91C_ADC_PTSR ((AT91_REG *) 0xFFFD8124) // (PDC_ADC) PDC Transfer Status Register +#define AT91C_ADC_PTCR ((AT91_REG *) 0xFFFD8120) // (PDC_ADC) PDC Transfer Control Register +#define AT91C_ADC_TNPR ((AT91_REG *) 0xFFFD8118) // (PDC_ADC) Transmit Next Pointer Register +#define AT91C_ADC_TNCR ((AT91_REG *) 0xFFFD811C) // (PDC_ADC) Transmit Next Counter Register +#define AT91C_ADC_RNPR ((AT91_REG *) 0xFFFD8110) // (PDC_ADC) Receive Next Pointer Register +#define AT91C_ADC_RNCR ((AT91_REG *) 0xFFFD8114) // (PDC_ADC) Receive Next Counter Register +#define AT91C_ADC_RPR ((AT91_REG *) 0xFFFD8100) // (PDC_ADC) Receive Pointer Register +#define AT91C_ADC_TCR ((AT91_REG *) 0xFFFD810C) // (PDC_ADC) Transmit Counter Register +#define AT91C_ADC_TPR ((AT91_REG *) 0xFFFD8108) // (PDC_ADC) Transmit Pointer Register +#define AT91C_ADC_RCR ((AT91_REG *) 0xFFFD8104) // (PDC_ADC) Receive Counter Register +// ========== Register definition for ADC peripheral ========== +#define AT91C_ADC_CDR2 ((AT91_REG *) 0xFFFD8038) // (ADC) ADC Channel Data Register 2 +#define AT91C_ADC_CDR3 ((AT91_REG *) 0xFFFD803C) // (ADC) ADC Channel Data Register 3 +#define AT91C_ADC_CDR0 ((AT91_REG *) 0xFFFD8030) // (ADC) ADC Channel Data Register 0 +#define AT91C_ADC_CDR5 ((AT91_REG *) 0xFFFD8044) // (ADC) ADC Channel Data Register 5 +#define AT91C_ADC_CHDR ((AT91_REG *) 0xFFFD8014) // (ADC) ADC Channel Disable Register +#define AT91C_ADC_SR ((AT91_REG *) 0xFFFD801C) // (ADC) ADC Status Register +#define AT91C_ADC_CDR4 ((AT91_REG *) 0xFFFD8040) // (ADC) ADC Channel Data Register 4 +#define AT91C_ADC_CDR1 ((AT91_REG *) 0xFFFD8034) // (ADC) ADC Channel Data Register 1 +#define AT91C_ADC_LCDR ((AT91_REG *) 0xFFFD8020) // (ADC) ADC Last Converted Data Register +#define AT91C_ADC_IDR ((AT91_REG *) 0xFFFD8028) // (ADC) ADC Interrupt Disable Register +#define AT91C_ADC_CR ((AT91_REG *) 0xFFFD8000) // (ADC) ADC Control Register +#define AT91C_ADC_CDR7 ((AT91_REG *) 0xFFFD804C) // (ADC) ADC Channel Data Register 7 +#define AT91C_ADC_CDR6 ((AT91_REG *) 0xFFFD8048) // (ADC) ADC Channel Data Register 6 +#define AT91C_ADC_IER ((AT91_REG *) 0xFFFD8024) // (ADC) ADC Interrupt Enable Register +#define AT91C_ADC_CHER ((AT91_REG *) 0xFFFD8010) // (ADC) ADC Channel Enable Register +#define AT91C_ADC_CHSR ((AT91_REG *) 0xFFFD8018) // (ADC) ADC Channel Status Register +#define AT91C_ADC_MR ((AT91_REG *) 0xFFFD8004) // (ADC) ADC Mode Register +#define AT91C_ADC_IMR ((AT91_REG *) 0xFFFD802C) // (ADC) ADC Interrupt Mask Register + +// ***************************************************************************** +// PIO DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** +#define AT91C_PIO_PA0 ((unsigned int) 1 << 0) // Pin Controlled by PA0 +#define AT91C_PA0_RXD0 ((unsigned int) AT91C_PIO_PA0) // USART 0 Receive Data +#define AT91C_PIO_PA1 ((unsigned int) 1 << 1) // Pin Controlled by PA1 +#define AT91C_PA1_TXD0 ((unsigned int) AT91C_PIO_PA1) // USART 0 Transmit Data +#define AT91C_PIO_PA10 ((unsigned int) 1 << 10) // Pin Controlled by PA10 +#define AT91C_PA10_TWD ((unsigned int) AT91C_PIO_PA10) // TWI Two-wire Serial Data +#define AT91C_PIO_PA11 ((unsigned int) 1 << 11) // Pin Controlled by PA11 +#define AT91C_PA11_TWCK ((unsigned int) AT91C_PIO_PA11) // TWI Two-wire Serial Clock +#define AT91C_PIO_PA12 ((unsigned int) 1 << 12) // Pin Controlled by PA12 +#define AT91C_PA12_SPI0_NPCS0 ((unsigned int) AT91C_PIO_PA12) // SPI 0 Peripheral Chip Select 0 +#define AT91C_PIO_PA13 ((unsigned int) 1 << 13) // Pin Controlled by PA13 +#define AT91C_PA13_SPI0_NPCS1 ((unsigned int) AT91C_PIO_PA13) // SPI 0 Peripheral Chip Select 1 +#define AT91C_PA13_PCK1 ((unsigned int) AT91C_PIO_PA13) // PMC Programmable Clock Output 1 +#define AT91C_PIO_PA14 ((unsigned int) 1 << 14) // Pin Controlled by PA14 +#define AT91C_PA14_SPI0_NPCS2 ((unsigned int) AT91C_PIO_PA14) // SPI 0 Peripheral Chip Select 2 +#define AT91C_PA14_IRQ1 ((unsigned int) AT91C_PIO_PA14) // External Interrupt 1 +#define AT91C_PIO_PA15 ((unsigned int) 1 << 15) // Pin Controlled by PA15 +#define AT91C_PA15_SPI0_NPCS3 ((unsigned int) AT91C_PIO_PA15) // SPI 0 Peripheral Chip Select 3 +#define AT91C_PA15_TCLK2 ((unsigned int) AT91C_PIO_PA15) // Timer Counter 2 external clock input +#define AT91C_PIO_PA16 ((unsigned int) 1 << 16) // Pin Controlled by PA16 +#define AT91C_PA16_SPI0_MISO ((unsigned int) AT91C_PIO_PA16) // SPI 0 Master In Slave +#define AT91C_PIO_PA17 ((unsigned int) 1 << 17) // Pin Controlled by PA17 +#define AT91C_PA17_SPI0_MOSI ((unsigned int) AT91C_PIO_PA17) // SPI 0 Master Out Slave +#define AT91C_PIO_PA18 ((unsigned int) 1 << 18) // Pin Controlled by PA18 +#define AT91C_PA18_SPI0_SPCK ((unsigned int) AT91C_PIO_PA18) // SPI 0 Serial Clock +#define AT91C_PIO_PA19 ((unsigned int) 1 << 19) // Pin Controlled by PA19 +#define AT91C_PA19_CANRX ((unsigned int) AT91C_PIO_PA19) // CAN Receive +#define AT91C_PIO_PA2 ((unsigned int) 1 << 2) // Pin Controlled by PA2 +#define AT91C_PA2_SCK0 ((unsigned int) AT91C_PIO_PA2) // USART 0 Serial Clock +#define AT91C_PA2_SPI1_NPCS1 ((unsigned int) AT91C_PIO_PA2) // SPI 1 Peripheral Chip Select 1 +#define AT91C_PIO_PA20 ((unsigned int) 1 << 20) // Pin Controlled by PA20 +#define AT91C_PA20_CANTX ((unsigned int) AT91C_PIO_PA20) // CAN Transmit +#define AT91C_PIO_PA21 ((unsigned int) 1 << 21) // Pin Controlled by PA21 +#define AT91C_PA21_TF ((unsigned int) AT91C_PIO_PA21) // SSC Transmit Frame Sync +#define AT91C_PA21_SPI1_NPCS0 ((unsigned int) AT91C_PIO_PA21) // SPI 1 Peripheral Chip Select 0 +#define AT91C_PIO_PA22 ((unsigned int) 1 << 22) // Pin Controlled by PA22 +#define AT91C_PA22_TK ((unsigned int) AT91C_PIO_PA22) // SSC Transmit Clock +#define AT91C_PA22_SPI1_SPCK ((unsigned int) AT91C_PIO_PA22) // SPI 1 Serial Clock +#define AT91C_PIO_PA23 ((unsigned int) 1 << 23) // Pin Controlled by PA23 +#define AT91C_PA23_TD ((unsigned int) AT91C_PIO_PA23) // SSC Transmit data +#define AT91C_PA23_SPI1_MOSI ((unsigned int) AT91C_PIO_PA23) // SPI 1 Master Out Slave +#define AT91C_PIO_PA24 ((unsigned int) 1 << 24) // Pin Controlled by PA24 +#define AT91C_PA24_RD ((unsigned int) AT91C_PIO_PA24) // SSC Receive Data +#define AT91C_PA24_SPI1_MISO ((unsigned int) AT91C_PIO_PA24) // SPI 1 Master In Slave +#define AT91C_PIO_PA25 ((unsigned int) 1 << 25) // Pin Controlled by PA25 +#define AT91C_PA25_RK ((unsigned int) AT91C_PIO_PA25) // SSC Receive Clock +#define AT91C_PA25_SPI1_NPCS1 ((unsigned int) AT91C_PIO_PA25) // SPI 1 Peripheral Chip Select 1 +#define AT91C_PIO_PA26 ((unsigned int) 1 << 26) // Pin Controlled by PA26 +#define AT91C_PA26_RF ((unsigned int) AT91C_PIO_PA26) // SSC Receive Frame Sync +#define AT91C_PA26_SPI1_NPCS2 ((unsigned int) AT91C_PIO_PA26) // SPI 1 Peripheral Chip Select 2 +#define AT91C_PIO_PA27 ((unsigned int) 1 << 27) // Pin Controlled by PA27 +#define AT91C_PA27_DRXD ((unsigned int) AT91C_PIO_PA27) // DBGU Debug Receive Data +#define AT91C_PA27_PCK3 ((unsigned int) AT91C_PIO_PA27) // PMC Programmable Clock Output 3 +#define AT91C_PIO_PA28 ((unsigned int) 1 << 28) // Pin Controlled by PA28 +#define AT91C_PA28_DTXD ((unsigned int) AT91C_PIO_PA28) // DBGU Debug Transmit Data +#define AT91C_PIO_PA29 ((unsigned int) 1 << 29) // Pin Controlled by PA29 +#define AT91C_PA29_FIQ ((unsigned int) AT91C_PIO_PA29) // AIC Fast Interrupt Input +#define AT91C_PA29_SPI1_NPCS3 ((unsigned int) AT91C_PIO_PA29) // SPI 1 Peripheral Chip Select 3 +#define AT91C_PIO_PA3 ((unsigned int) 1 << 3) // Pin Controlled by PA3 +#define AT91C_PA3_RTS0 ((unsigned int) AT91C_PIO_PA3) // USART 0 Ready To Send +#define AT91C_PA3_SPI1_NPCS2 ((unsigned int) AT91C_PIO_PA3) // SPI 1 Peripheral Chip Select 2 +#define AT91C_PIO_PA30 ((unsigned int) 1 << 30) // Pin Controlled by PA30 +#define AT91C_PA30_IRQ0 ((unsigned int) AT91C_PIO_PA30) // External Interrupt 0 +#define AT91C_PA30_PCK2 ((unsigned int) AT91C_PIO_PA30) // PMC Programmable Clock Output 2 +#define AT91C_PIO_PA4 ((unsigned int) 1 << 4) // Pin Controlled by PA4 +#define AT91C_PA4_CTS0 ((unsigned int) AT91C_PIO_PA4) // USART 0 Clear To Send +#define AT91C_PA4_SPI1_NPCS3 ((unsigned int) AT91C_PIO_PA4) // SPI 1 Peripheral Chip Select 3 +#define AT91C_PIO_PA5 ((unsigned int) 1 << 5) // Pin Controlled by PA5 +#define AT91C_PA5_RXD1 ((unsigned int) AT91C_PIO_PA5) // USART 1 Receive Data +#define AT91C_PIO_PA6 ((unsigned int) 1 << 6) // Pin Controlled by PA6 +#define AT91C_PA6_TXD1 ((unsigned int) AT91C_PIO_PA6) // USART 1 Transmit Data +#define AT91C_PIO_PA7 ((unsigned int) 1 << 7) // Pin Controlled by PA7 +#define AT91C_PA7_SCK1 ((unsigned int) AT91C_PIO_PA7) // USART 1 Serial Clock +#define AT91C_PA7_SPI0_NPCS1 ((unsigned int) AT91C_PIO_PA7) // SPI 0 Peripheral Chip Select 1 +#define AT91C_PIO_PA8 ((unsigned int) 1 << 8) // Pin Controlled by PA8 +#define AT91C_PA8_RTS1 ((unsigned int) AT91C_PIO_PA8) // USART 1 Ready To Send +#define AT91C_PA8_SPI0_NPCS2 ((unsigned int) AT91C_PIO_PA8) // SPI 0 Peripheral Chip Select 2 +#define AT91C_PIO_PA9 ((unsigned int) 1 << 9) // Pin Controlled by PA9 +#define AT91C_PA9_CTS1 ((unsigned int) AT91C_PIO_PA9) // USART 1 Clear To Send +#define AT91C_PA9_SPI0_NPCS3 ((unsigned int) AT91C_PIO_PA9) // SPI 0 Peripheral Chip Select 3 +#define AT91C_PIO_PB0 ((unsigned int) 1 << 0) // Pin Controlled by PB0 +#define AT91C_PB0_ETXCK_EREFCK ((unsigned int) AT91C_PIO_PB0) // Ethernet MAC Transmit Clock/Reference Clock +#define AT91C_PB0_PCK0 ((unsigned int) AT91C_PIO_PB0) // PMC Programmable Clock Output 0 +#define AT91C_PIO_PB1 ((unsigned int) 1 << 1) // Pin Controlled by PB1 +#define AT91C_PB1_ETXEN ((unsigned int) AT91C_PIO_PB1) // Ethernet MAC Transmit Enable +#define AT91C_PIO_PB10 ((unsigned int) 1 << 10) // Pin Controlled by PB10 +#define AT91C_PB10_ETX2 ((unsigned int) AT91C_PIO_PB10) // Ethernet MAC Transmit Data 2 +#define AT91C_PB10_SPI1_NPCS1 ((unsigned int) AT91C_PIO_PB10) // SPI 1 Peripheral Chip Select 1 +#define AT91C_PIO_PB11 ((unsigned int) 1 << 11) // Pin Controlled by PB11 +#define AT91C_PB11_ETX3 ((unsigned int) AT91C_PIO_PB11) // Ethernet MAC Transmit Data 3 +#define AT91C_PB11_SPI1_NPCS2 ((unsigned int) AT91C_PIO_PB11) // SPI 1 Peripheral Chip Select 2 +#define AT91C_PIO_PB12 ((unsigned int) 1 << 12) // Pin Controlled by PB12 +#define AT91C_PB12_ETXER ((unsigned int) AT91C_PIO_PB12) // Ethernet MAC Transmikt Coding Error +#define AT91C_PB12_TCLK0 ((unsigned int) AT91C_PIO_PB12) // Timer Counter 0 external clock input +#define AT91C_PIO_PB13 ((unsigned int) 1 << 13) // Pin Controlled by PB13 +#define AT91C_PB13_ERX2 ((unsigned int) AT91C_PIO_PB13) // Ethernet MAC Receive Data 2 +#define AT91C_PB13_SPI0_NPCS1 ((unsigned int) AT91C_PIO_PB13) // SPI 0 Peripheral Chip Select 1 +#define AT91C_PIO_PB14 ((unsigned int) 1 << 14) // Pin Controlled by PB14 +#define AT91C_PB14_ERX3 ((unsigned int) AT91C_PIO_PB14) // Ethernet MAC Receive Data 3 +#define AT91C_PB14_SPI0_NPCS2 ((unsigned int) AT91C_PIO_PB14) // SPI 0 Peripheral Chip Select 2 +#define AT91C_PIO_PB15 ((unsigned int) 1 << 15) // Pin Controlled by PB15 +#define AT91C_PB15_ERXDV_ECRSDV ((unsigned int) AT91C_PIO_PB15) // Ethernet MAC Receive Data Valid +#define AT91C_PIO_PB16 ((unsigned int) 1 << 16) // Pin Controlled by PB16 +#define AT91C_PB16_ECOL ((unsigned int) AT91C_PIO_PB16) // Ethernet MAC Collision Detected +#define AT91C_PB16_SPI1_NPCS3 ((unsigned int) AT91C_PIO_PB16) // SPI 1 Peripheral Chip Select 3 +#define AT91C_PIO_PB17 ((unsigned int) 1 << 17) // Pin Controlled by PB17 +#define AT91C_PB17_ERXCK ((unsigned int) AT91C_PIO_PB17) // Ethernet MAC Receive Clock +#define AT91C_PB17_SPI0_NPCS3 ((unsigned int) AT91C_PIO_PB17) // SPI 0 Peripheral Chip Select 3 +#define AT91C_PIO_PB18 ((unsigned int) 1 << 18) // Pin Controlled by PB18 +#define AT91C_PB18_EF100 ((unsigned int) AT91C_PIO_PB18) // Ethernet MAC Force 100 Mbits/sec +#define AT91C_PB18_ADTRG ((unsigned int) AT91C_PIO_PB18) // ADC External Trigger +#define AT91C_PIO_PB19 ((unsigned int) 1 << 19) // Pin Controlled by PB19 +#define AT91C_PB19_PWM0 ((unsigned int) AT91C_PIO_PB19) // PWM Channel 0 +#define AT91C_PB19_TCLK1 ((unsigned int) AT91C_PIO_PB19) // Timer Counter 1 external clock input +#define AT91C_PIO_PB2 ((unsigned int) 1 << 2) // Pin Controlled by PB2 +#define AT91C_PB2_ETX0 ((unsigned int) AT91C_PIO_PB2) // Ethernet MAC Transmit Data 0 +#define AT91C_PIO_PB20 ((unsigned int) 1 << 20) // Pin Controlled by PB20 +#define AT91C_PB20_PWM1 ((unsigned int) AT91C_PIO_PB20) // PWM Channel 1 +#define AT91C_PB20_PCK0 ((unsigned int) AT91C_PIO_PB20) // PMC Programmable Clock Output 0 +#define AT91C_PIO_PB21 ((unsigned int) 1 << 21) // Pin Controlled by PB21 +#define AT91C_PB21_PWM2 ((unsigned int) AT91C_PIO_PB21) // PWM Channel 2 +#define AT91C_PB21_PCK1 ((unsigned int) AT91C_PIO_PB21) // PMC Programmable Clock Output 1 +#define AT91C_PIO_PB22 ((unsigned int) 1 << 22) // Pin Controlled by PB22 +#define AT91C_PB22_PWM3 ((unsigned int) AT91C_PIO_PB22) // PWM Channel 3 +#define AT91C_PB22_PCK2 ((unsigned int) AT91C_PIO_PB22) // PMC Programmable Clock Output 2 +#define AT91C_PIO_PB23 ((unsigned int) 1 << 23) // Pin Controlled by PB23 +#define AT91C_PB23_TIOA0 ((unsigned int) AT91C_PIO_PB23) // Timer Counter 0 Multipurpose Timer I/O Pin A +#define AT91C_PB23_DCD1 ((unsigned int) AT91C_PIO_PB23) // USART 1 Data Carrier Detect +#define AT91C_PIO_PB24 ((unsigned int) 1 << 24) // Pin Controlled by PB24 +#define AT91C_PB24_TIOB0 ((unsigned int) AT91C_PIO_PB24) // Timer Counter 0 Multipurpose Timer I/O Pin B +#define AT91C_PB24_DSR1 ((unsigned int) AT91C_PIO_PB24) // USART 1 Data Set ready +#define AT91C_PIO_PB25 ((unsigned int) 1 << 25) // Pin Controlled by PB25 +#define AT91C_PB25_TIOA1 ((unsigned int) AT91C_PIO_PB25) // Timer Counter 1 Multipurpose Timer I/O Pin A +#define AT91C_PB25_DTR1 ((unsigned int) AT91C_PIO_PB25) // USART 1 Data Terminal ready +#define AT91C_PIO_PB26 ((unsigned int) 1 << 26) // Pin Controlled by PB26 +#define AT91C_PB26_TIOB1 ((unsigned int) AT91C_PIO_PB26) // Timer Counter 1 Multipurpose Timer I/O Pin B +#define AT91C_PB26_RI1 ((unsigned int) AT91C_PIO_PB26) // USART 1 Ring Indicator +#define AT91C_PIO_PB27 ((unsigned int) 1 << 27) // Pin Controlled by PB27 +#define AT91C_PB27_TIOA2 ((unsigned int) AT91C_PIO_PB27) // Timer Counter 2 Multipurpose Timer I/O Pin A +#define AT91C_PB27_PWM0 ((unsigned int) AT91C_PIO_PB27) // PWM Channel 0 +#define AT91C_PIO_PB28 ((unsigned int) 1 << 28) // Pin Controlled by PB28 +#define AT91C_PB28_TIOB2 ((unsigned int) AT91C_PIO_PB28) // Timer Counter 2 Multipurpose Timer I/O Pin B +#define AT91C_PB28_PWM1 ((unsigned int) AT91C_PIO_PB28) // PWM Channel 1 +#define AT91C_PIO_PB29 ((unsigned int) 1 << 29) // Pin Controlled by PB29 +#define AT91C_PB29_PCK1 ((unsigned int) AT91C_PIO_PB29) // PMC Programmable Clock Output 1 +#define AT91C_PB29_PWM2 ((unsigned int) AT91C_PIO_PB29) // PWM Channel 2 +#define AT91C_PIO_PB3 ((unsigned int) 1 << 3) // Pin Controlled by PB3 +#define AT91C_PB3_ETX1 ((unsigned int) AT91C_PIO_PB3) // Ethernet MAC Transmit Data 1 +#define AT91C_PIO_PB30 ((unsigned int) 1 << 30) // Pin Controlled by PB30 +#define AT91C_PB30_PCK2 ((unsigned int) AT91C_PIO_PB30) // PMC Programmable Clock Output 2 +#define AT91C_PB30_PWM3 ((unsigned int) AT91C_PIO_PB30) // PWM Channel 3 +#define AT91C_PIO_PB4 ((unsigned int) 1 << 4) // Pin Controlled by PB4 +#define AT91C_PB4_ECRS ((unsigned int) AT91C_PIO_PB4) // Ethernet MAC Carrier Sense/Carrier Sense and Data Valid +#define AT91C_PIO_PB5 ((unsigned int) 1 << 5) // Pin Controlled by PB5 +#define AT91C_PB5_ERX0 ((unsigned int) AT91C_PIO_PB5) // Ethernet MAC Receive Data 0 +#define AT91C_PIO_PB6 ((unsigned int) 1 << 6) // Pin Controlled by PB6 +#define AT91C_PB6_ERX1 ((unsigned int) AT91C_PIO_PB6) // Ethernet MAC Receive Data 1 +#define AT91C_PIO_PB7 ((unsigned int) 1 << 7) // Pin Controlled by PB7 +#define AT91C_PB7_ERXER ((unsigned int) AT91C_PIO_PB7) // Ethernet MAC Receive Error +#define AT91C_PIO_PB8 ((unsigned int) 1 << 8) // Pin Controlled by PB8 +#define AT91C_PB8_EMDC ((unsigned int) AT91C_PIO_PB8) // Ethernet MAC Management Data Clock +#define AT91C_PIO_PB9 ((unsigned int) 1 << 9) // Pin Controlled by PB9 +#define AT91C_PB9_EMDIO ((unsigned int) AT91C_PIO_PB9) // Ethernet MAC Management Data Input/Output + +// ***************************************************************************** +// PERIPHERAL ID DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** +#define AT91C_ID_FIQ ((unsigned int) 0) // Advanced Interrupt Controller (FIQ) +#define AT91C_ID_SYS ((unsigned int) 1) // System Peripheral +#define AT91C_ID_PIOA ((unsigned int) 2) // Parallel IO Controller A +#define AT91C_ID_PIOB ((unsigned int) 3) // Parallel IO Controller B +#define AT91C_ID_SPI0 ((unsigned int) 4) // Serial Peripheral Interface 0 +#define AT91C_ID_SPI1 ((unsigned int) 5) // Serial Peripheral Interface 1 +#define AT91C_ID_US0 ((unsigned int) 6) // USART 0 +#define AT91C_ID_US1 ((unsigned int) 7) // USART 1 +#define AT91C_ID_SSC ((unsigned int) 8) // Serial Synchronous Controller +#define AT91C_ID_TWI ((unsigned int) 9) // Two-Wire Interface +#define AT91C_ID_PWMC ((unsigned int) 10) // PWM Controller +#define AT91C_ID_UDP ((unsigned int) 11) // USB Device Port +#define AT91C_ID_TC0 ((unsigned int) 12) // Timer Counter 0 +#define AT91C_ID_TC1 ((unsigned int) 13) // Timer Counter 1 +#define AT91C_ID_TC2 ((unsigned int) 14) // Timer Counter 2 +#define AT91C_ID_CAN ((unsigned int) 15) // Control Area Network Controller +#define AT91C_ID_EMAC ((unsigned int) 16) // Ethernet MAC +#define AT91C_ID_ADC ((unsigned int) 17) // Analog-to-Digital Converter +#define AT91C_ID_18_Reserved ((unsigned int) 18) // Reserved +#define AT91C_ID_19_Reserved ((unsigned int) 19) // Reserved +#define AT91C_ID_20_Reserved ((unsigned int) 20) // Reserved +#define AT91C_ID_21_Reserved ((unsigned int) 21) // Reserved +#define AT91C_ID_22_Reserved ((unsigned int) 22) // Reserved +#define AT91C_ID_23_Reserved ((unsigned int) 23) // Reserved +#define AT91C_ID_24_Reserved ((unsigned int) 24) // Reserved +#define AT91C_ID_25_Reserved ((unsigned int) 25) // Reserved +#define AT91C_ID_26_Reserved ((unsigned int) 26) // Reserved +#define AT91C_ID_27_Reserved ((unsigned int) 27) // Reserved +#define AT91C_ID_28_Reserved ((unsigned int) 28) // Reserved +#define AT91C_ID_29_Reserved ((unsigned int) 29) // Reserved +#define AT91C_ID_IRQ0 ((unsigned int) 30) // Advanced Interrupt Controller (IRQ0) +#define AT91C_ID_IRQ1 ((unsigned int) 31) // Advanced Interrupt Controller (IRQ1) +#define AT91C_ALL_INT ((unsigned int) 0xC003FFFF) // ALL VALID INTERRUPTS + +// ***************************************************************************** +// BASE ADDRESS DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** +#define AT91C_BASE_SYS ((AT91PS_SYS) 0xFFFFF000) // (SYS) Base Address +#define AT91C_BASE_AIC ((AT91PS_AIC) 0xFFFFF000) // (AIC) Base Address +#define AT91C_BASE_PDC_DBGU ((AT91PS_PDC) 0xFFFFF300) // (PDC_DBGU) Base Address +#define AT91C_BASE_DBGU ((AT91PS_DBGU) 0xFFFFF200) // (DBGU) Base Address +#define AT91C_BASE_PIOA ((AT91PS_PIO) 0xFFFFF400) // (PIOA) Base Address +#define AT91C_BASE_PIOB ((AT91PS_PIO) 0xFFFFF600) // (PIOB) Base Address +#define AT91C_BASE_CKGR ((AT91PS_CKGR) 0xFFFFFC20) // (CKGR) Base Address +#define AT91C_BASE_PMC ((AT91PS_PMC) 0xFFFFFC00) // (PMC) Base Address +#define AT91C_BASE_RSTC ((AT91PS_RSTC) 0xFFFFFD00) // (RSTC) Base Address +#define AT91C_BASE_RTTC ((AT91PS_RTTC) 0xFFFFFD20) // (RTTC) Base Address +#define AT91C_BASE_PITC ((AT91PS_PITC) 0xFFFFFD30) // (PITC) Base Address +#define AT91C_BASE_WDTC ((AT91PS_WDTC) 0xFFFFFD40) // (WDTC) Base Address +#define AT91C_BASE_VREG ((AT91PS_VREG) 0xFFFFFD60) // (VREG) Base Address +#define AT91C_BASE_MC ((AT91PS_MC) 0xFFFFFF00) // (MC) Base Address +#define AT91C_BASE_PDC_SPI1 ((AT91PS_PDC) 0xFFFE4100) // (PDC_SPI1) Base Address +#define AT91C_BASE_SPI1 ((AT91PS_SPI) 0xFFFE4000) // (SPI1) Base Address +#define AT91C_BASE_PDC_SPI0 ((AT91PS_PDC) 0xFFFE0100) // (PDC_SPI0) Base Address +#define AT91C_BASE_SPI0 ((AT91PS_SPI) 0xFFFE0000) // (SPI0) Base Address +#define AT91C_BASE_PDC_US1 ((AT91PS_PDC) 0xFFFC4100) // (PDC_US1) Base Address +#define AT91C_BASE_US1 ((AT91PS_USART) 0xFFFC4000) // (US1) Base Address +#define AT91C_BASE_PDC_US0 ((AT91PS_PDC) 0xFFFC0100) // (PDC_US0) Base Address +#define AT91C_BASE_US0 ((AT91PS_USART) 0xFFFC0000) // (US0) Base Address +#define AT91C_BASE_PDC_SSC ((AT91PS_PDC) 0xFFFD4100) // (PDC_SSC) Base Address +#define AT91C_BASE_SSC ((AT91PS_SSC) 0xFFFD4000) // (SSC) Base Address +#define AT91C_BASE_TWI ((AT91PS_TWI) 0xFFFB8000) // (TWI) Base Address +#define AT91C_BASE_PWMC_CH3 ((AT91PS_PWMC_CH) 0xFFFCC260) // (PWMC_CH3) Base Address +#define AT91C_BASE_PWMC_CH2 ((AT91PS_PWMC_CH) 0xFFFCC240) // (PWMC_CH2) Base Address +#define AT91C_BASE_PWMC_CH1 ((AT91PS_PWMC_CH) 0xFFFCC220) // (PWMC_CH1) Base Address +#define AT91C_BASE_PWMC_CH0 ((AT91PS_PWMC_CH) 0xFFFCC200) // (PWMC_CH0) Base Address +#define AT91C_BASE_PWMC ((AT91PS_PWMC) 0xFFFCC000) // (PWMC) Base Address +#define AT91C_BASE_UDP ((AT91PS_UDP) 0xFFFB0000) // (UDP) Base Address +#define AT91C_BASE_TC0 ((AT91PS_TC) 0xFFFA0000) // (TC0) Base Address +#define AT91C_BASE_TC1 ((AT91PS_TC) 0xFFFA0040) // (TC1) Base Address +#define AT91C_BASE_TC2 ((AT91PS_TC) 0xFFFA0080) // (TC2) Base Address +#define AT91C_BASE_TCB ((AT91PS_TCB) 0xFFFA0000) // (TCB) Base Address +#define AT91C_BASE_CAN_MB0 ((AT91PS_CAN_MB) 0xFFFD0200) // (CAN_MB0) Base Address +#define AT91C_BASE_CAN_MB1 ((AT91PS_CAN_MB) 0xFFFD0220) // (CAN_MB1) Base Address +#define AT91C_BASE_CAN_MB2 ((AT91PS_CAN_MB) 0xFFFD0240) // (CAN_MB2) Base Address +#define AT91C_BASE_CAN_MB3 ((AT91PS_CAN_MB) 0xFFFD0260) // (CAN_MB3) Base Address +#define AT91C_BASE_CAN_MB4 ((AT91PS_CAN_MB) 0xFFFD0280) // (CAN_MB4) Base Address +#define AT91C_BASE_CAN_MB5 ((AT91PS_CAN_MB) 0xFFFD02A0) // (CAN_MB5) Base Address +#define AT91C_BASE_CAN_MB6 ((AT91PS_CAN_MB) 0xFFFD02C0) // (CAN_MB6) Base Address +#define AT91C_BASE_CAN_MB7 ((AT91PS_CAN_MB) 0xFFFD02E0) // (CAN_MB7) Base Address +#define AT91C_BASE_CAN ((AT91PS_CAN) 0xFFFD0000) // (CAN) Base Address +#define AT91C_BASE_EMAC ((AT91PS_EMAC) 0xFFFDC000) // (EMAC) Base Address +#define AT91C_BASE_PDC_ADC ((AT91PS_PDC) 0xFFFD8100) // (PDC_ADC) Base Address +#define AT91C_BASE_ADC ((AT91PS_ADC) 0xFFFD8000) // (ADC) Base Address + +// ***************************************************************************** +// MEMORY MAPPING DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** +// ISRAM +#define AT91C_ISRAM ((char *) 0x00200000) // Internal SRAM base address +#define AT91C_ISRAM_SIZE ((unsigned int) 0x00010000) // Internal SRAM size in byte (64 Kbytes) +// IFLASH +#define AT91C_IFLASH ((char *) 0x00100000) // Internal FLASH base address +#define AT91C_IFLASH_SIZE ((unsigned int) 0x00040000) // Internal FLASH size in byte (256 Kbytes) +#define AT91C_IFLASH_PAGE_SIZE ((unsigned int) 256) // Internal FLASH Page Size: 256 bytes +#define AT91C_IFLASH_LOCK_REGION_SIZE ((unsigned int) 16384) // Internal FLASH Lock Region Size: 16 Kbytes +#define AT91C_IFLASH_NB_OF_PAGES ((unsigned int) 1024) // Internal FLASH Number of Pages: 1024 bytes +#define AT91C_IFLASH_NB_OF_LOCK_BITS ((unsigned int) 16) // Internal FLASH Number of Lock Bits: 16 bytes +#endif /* __IAR_SYSTEMS_ICC__ */ + +#ifdef __IAR_SYSTEMS_ASM__ + +// - Hardware register definition + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR System Peripherals +// - ***************************************************************************** + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Advanced Interrupt Controller +// - ***************************************************************************** +// - -------- AIC_SMR : (AIC Offset: 0x0) Control Register -------- +AT91C_AIC_PRIOR EQU (0x7 << 0) ;- (AIC) Priority Level +AT91C_AIC_PRIOR_LOWEST EQU (0x0) ;- (AIC) Lowest priority level +AT91C_AIC_PRIOR_HIGHEST EQU (0x7) ;- (AIC) Highest priority level +AT91C_AIC_SRCTYPE EQU (0x3 << 5) ;- (AIC) Interrupt Source Type +AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL EQU (0x0 << 5) ;- (AIC) Internal Sources Code Label High-level Sensitive +AT91C_AIC_SRCTYPE_EXT_LOW_LEVEL EQU (0x0 << 5) ;- (AIC) External Sources Code Label Low-level Sensitive +AT91C_AIC_SRCTYPE_INT_POSITIVE_EDGE EQU (0x1 << 5) ;- (AIC) Internal Sources Code Label Positive Edge triggered +AT91C_AIC_SRCTYPE_EXT_NEGATIVE_EDGE EQU (0x1 << 5) ;- (AIC) External Sources Code Label Negative Edge triggered +AT91C_AIC_SRCTYPE_HIGH_LEVEL EQU (0x2 << 5) ;- (AIC) Internal Or External Sources Code Label High-level Sensitive +AT91C_AIC_SRCTYPE_POSITIVE_EDGE EQU (0x3 << 5) ;- (AIC) Internal Or External Sources Code Label Positive Edge triggered +// - -------- AIC_CISR : (AIC Offset: 0x114) AIC Core Interrupt Status Register -------- +AT91C_AIC_NFIQ EQU (0x1 << 0) ;- (AIC) NFIQ Status +AT91C_AIC_NIRQ EQU (0x1 << 1) ;- (AIC) NIRQ Status +// - -------- AIC_DCR : (AIC Offset: 0x138) AIC Debug Control Register (Protect) -------- +AT91C_AIC_DCR_PROT EQU (0x1 << 0) ;- (AIC) Protection Mode +AT91C_AIC_DCR_GMSK EQU (0x1 << 1) ;- (AIC) General Mask + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Peripheral DMA Controller +// - ***************************************************************************** +// - -------- PDC_PTCR : (PDC Offset: 0x20) PDC Transfer Control Register -------- +AT91C_PDC_RXTEN EQU (0x1 << 0) ;- (PDC) Receiver Transfer Enable +AT91C_PDC_RXTDIS EQU (0x1 << 1) ;- (PDC) Receiver Transfer Disable +AT91C_PDC_TXTEN EQU (0x1 << 8) ;- (PDC) Transmitter Transfer Enable +AT91C_PDC_TXTDIS EQU (0x1 << 9) ;- (PDC) Transmitter Transfer Disable +// - -------- PDC_PTSR : (PDC Offset: 0x24) PDC Transfer Status Register -------- + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Debug Unit +// - ***************************************************************************** +// - -------- DBGU_CR : (DBGU Offset: 0x0) Debug Unit Control Register -------- +AT91C_US_RSTRX EQU (0x1 << 2) ;- (DBGU) Reset Receiver +AT91C_US_RSTTX EQU (0x1 << 3) ;- (DBGU) Reset Transmitter +AT91C_US_RXEN EQU (0x1 << 4) ;- (DBGU) Receiver Enable +AT91C_US_RXDIS EQU (0x1 << 5) ;- (DBGU) Receiver Disable +AT91C_US_TXEN EQU (0x1 << 6) ;- (DBGU) Transmitter Enable +AT91C_US_TXDIS EQU (0x1 << 7) ;- (DBGU) Transmitter Disable +AT91C_US_RSTSTA EQU (0x1 << 8) ;- (DBGU) Reset Status Bits +// - -------- DBGU_MR : (DBGU Offset: 0x4) Debug Unit Mode Register -------- +AT91C_US_PAR EQU (0x7 << 9) ;- (DBGU) Parity type +AT91C_US_PAR_EVEN EQU (0x0 << 9) ;- (DBGU) Even Parity +AT91C_US_PAR_ODD EQU (0x1 << 9) ;- (DBGU) Odd Parity +AT91C_US_PAR_SPACE EQU (0x2 << 9) ;- (DBGU) Parity forced to 0 (Space) +AT91C_US_PAR_MARK EQU (0x3 << 9) ;- (DBGU) Parity forced to 1 (Mark) +AT91C_US_PAR_NONE EQU (0x4 << 9) ;- (DBGU) No Parity +AT91C_US_PAR_MULTI_DROP EQU (0x6 << 9) ;- (DBGU) Multi-drop mode +AT91C_US_CHMODE EQU (0x3 << 14) ;- (DBGU) Channel Mode +AT91C_US_CHMODE_NORMAL EQU (0x0 << 14) ;- (DBGU) Normal Mode: The USART channel operates as an RX/TX USART. +AT91C_US_CHMODE_AUTO EQU (0x1 << 14) ;- (DBGU) Automatic Echo: Receiver Data Input is connected to the TXD pin. +AT91C_US_CHMODE_LOCAL EQU (0x2 << 14) ;- (DBGU) Local Loopback: Transmitter Output Signal is connected to Receiver Input Signal. +AT91C_US_CHMODE_REMOTE EQU (0x3 << 14) ;- (DBGU) Remote Loopback: RXD pin is internally connected to TXD pin. +// - -------- DBGU_IER : (DBGU Offset: 0x8) Debug Unit Interrupt Enable Register -------- +AT91C_US_RXRDY EQU (0x1 << 0) ;- (DBGU) RXRDY Interrupt +AT91C_US_TXRDY EQU (0x1 << 1) ;- (DBGU) TXRDY Interrupt +AT91C_US_ENDRX EQU (0x1 << 3) ;- (DBGU) End of Receive Transfer Interrupt +AT91C_US_ENDTX EQU (0x1 << 4) ;- (DBGU) End of Transmit Interrupt +AT91C_US_OVRE EQU (0x1 << 5) ;- (DBGU) Overrun Interrupt +AT91C_US_FRAME EQU (0x1 << 6) ;- (DBGU) Framing Error Interrupt +AT91C_US_PARE EQU (0x1 << 7) ;- (DBGU) Parity Error Interrupt +AT91C_US_TXEMPTY EQU (0x1 << 9) ;- (DBGU) TXEMPTY Interrupt +AT91C_US_TXBUFE EQU (0x1 << 11) ;- (DBGU) TXBUFE Interrupt +AT91C_US_RXBUFF EQU (0x1 << 12) ;- (DBGU) RXBUFF Interrupt +AT91C_US_COMM_TX EQU (0x1 << 30) ;- (DBGU) COMM_TX Interrupt +AT91C_US_COMM_RX EQU (0x1 << 31) ;- (DBGU) COMM_RX Interrupt +// - -------- DBGU_IDR : (DBGU Offset: 0xc) Debug Unit Interrupt Disable Register -------- +// - -------- DBGU_IMR : (DBGU Offset: 0x10) Debug Unit Interrupt Mask Register -------- +// - -------- DBGU_CSR : (DBGU Offset: 0x14) Debug Unit Channel Status Register -------- +// - -------- DBGU_FNTR : (DBGU Offset: 0x48) Debug Unit FORCE_NTRST Register -------- +AT91C_US_FORCE_NTRST EQU (0x1 << 0) ;- (DBGU) Force NTRST in JTAG + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Parallel Input Output Controler +// - ***************************************************************************** + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Clock Generator Controler +// - ***************************************************************************** +// - -------- CKGR_MOR : (CKGR Offset: 0x0) Main Oscillator Register -------- +AT91C_CKGR_MOSCEN EQU (0x1 << 0) ;- (CKGR) Main Oscillator Enable +AT91C_CKGR_OSCBYPASS EQU (0x1 << 1) ;- (CKGR) Main Oscillator Bypass +AT91C_CKGR_OSCOUNT EQU (0xFF << 8) ;- (CKGR) Main Oscillator Start-up Time +// - -------- CKGR_MCFR : (CKGR Offset: 0x4) Main Clock Frequency Register -------- +AT91C_CKGR_MAINF EQU (0xFFFF << 0) ;- (CKGR) Main Clock Frequency +AT91C_CKGR_MAINRDY EQU (0x1 << 16) ;- (CKGR) Main Clock Ready +// - -------- CKGR_PLLR : (CKGR Offset: 0xc) PLL B Register -------- +AT91C_CKGR_DIV EQU (0xFF << 0) ;- (CKGR) Divider Selected +AT91C_CKGR_DIV_0 EQU (0x0) ;- (CKGR) Divider output is 0 +AT91C_CKGR_DIV_BYPASS EQU (0x1) ;- (CKGR) Divider is bypassed +AT91C_CKGR_PLLCOUNT EQU (0x3F << 8) ;- (CKGR) PLL Counter +AT91C_CKGR_OUT EQU (0x3 << 14) ;- (CKGR) PLL Output Frequency Range +AT91C_CKGR_OUT_0 EQU (0x0 << 14) ;- (CKGR) Please refer to the PLL datasheet +AT91C_CKGR_OUT_1 EQU (0x1 << 14) ;- (CKGR) Please refer to the PLL datasheet +AT91C_CKGR_OUT_2 EQU (0x2 << 14) ;- (CKGR) Please refer to the PLL datasheet +AT91C_CKGR_OUT_3 EQU (0x3 << 14) ;- (CKGR) Please refer to the PLL datasheet +AT91C_CKGR_MUL EQU (0x7FF << 16) ;- (CKGR) PLL Multiplier +AT91C_CKGR_USBDIV EQU (0x3 << 28) ;- (CKGR) Divider for USB Clocks +AT91C_CKGR_USBDIV_0 EQU (0x0 << 28) ;- (CKGR) Divider output is PLL clock output +AT91C_CKGR_USBDIV_1 EQU (0x1 << 28) ;- (CKGR) Divider output is PLL clock output divided by 2 +AT91C_CKGR_USBDIV_2 EQU (0x2 << 28) ;- (CKGR) Divider output is PLL clock output divided by 4 + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Power Management Controler +// - ***************************************************************************** +// - -------- PMC_SCER : (PMC Offset: 0x0) System Clock Enable Register -------- +AT91C_PMC_PCK EQU (0x1 << 0) ;- (PMC) Processor Clock +AT91C_PMC_UDP EQU (0x1 << 7) ;- (PMC) USB Device Port Clock +AT91C_PMC_PCK0 EQU (0x1 << 8) ;- (PMC) Programmable Clock Output +AT91C_PMC_PCK1 EQU (0x1 << 9) ;- (PMC) Programmable Clock Output +AT91C_PMC_PCK2 EQU (0x1 << 10) ;- (PMC) Programmable Clock Output +AT91C_PMC_PCK3 EQU (0x1 << 11) ;- (PMC) Programmable Clock Output +// - -------- PMC_SCDR : (PMC Offset: 0x4) System Clock Disable Register -------- +// - -------- PMC_SCSR : (PMC Offset: 0x8) System Clock Status Register -------- +// - -------- CKGR_MOR : (PMC Offset: 0x20) Main Oscillator Register -------- +// - -------- CKGR_MCFR : (PMC Offset: 0x24) Main Clock Frequency Register -------- +// - -------- CKGR_PLLR : (PMC Offset: 0x2c) PLL B Register -------- +// - -------- PMC_MCKR : (PMC Offset: 0x30) Master Clock Register -------- +AT91C_PMC_CSS EQU (0x3 << 0) ;- (PMC) Programmable Clock Selection +AT91C_PMC_CSS_SLOW_CLK EQU (0x0) ;- (PMC) Slow Clock is selected +AT91C_PMC_CSS_MAIN_CLK EQU (0x1) ;- (PMC) Main Clock is selected +AT91C_PMC_CSS_PLL_CLK EQU (0x3) ;- (PMC) Clock from PLL is selected +AT91C_PMC_PRES EQU (0x7 << 2) ;- (PMC) Programmable Clock Prescaler +AT91C_PMC_PRES_CLK EQU (0x0 << 2) ;- (PMC) Selected clock +AT91C_PMC_PRES_CLK_2 EQU (0x1 << 2) ;- (PMC) Selected clock divided by 2 +AT91C_PMC_PRES_CLK_4 EQU (0x2 << 2) ;- (PMC) Selected clock divided by 4 +AT91C_PMC_PRES_CLK_8 EQU (0x3 << 2) ;- (PMC) Selected clock divided by 8 +AT91C_PMC_PRES_CLK_16 EQU (0x4 << 2) ;- (PMC) Selected clock divided by 16 +AT91C_PMC_PRES_CLK_32 EQU (0x5 << 2) ;- (PMC) Selected clock divided by 32 +AT91C_PMC_PRES_CLK_64 EQU (0x6 << 2) ;- (PMC) Selected clock divided by 64 +// - -------- PMC_PCKR : (PMC Offset: 0x40) Programmable Clock Register -------- +// - -------- PMC_IER : (PMC Offset: 0x60) PMC Interrupt Enable Register -------- +AT91C_PMC_MOSCS EQU (0x1 << 0) ;- (PMC) MOSC Status/Enable/Disable/Mask +AT91C_PMC_LOCK EQU (0x1 << 2) ;- (PMC) PLL Status/Enable/Disable/Mask +AT91C_PMC_MCKRDY EQU (0x1 << 3) ;- (PMC) MCK_RDY Status/Enable/Disable/Mask +AT91C_PMC_PCK0RDY EQU (0x1 << 8) ;- (PMC) PCK0_RDY Status/Enable/Disable/Mask +AT91C_PMC_PCK1RDY EQU (0x1 << 9) ;- (PMC) PCK1_RDY Status/Enable/Disable/Mask +AT91C_PMC_PCK2RDY EQU (0x1 << 10) ;- (PMC) PCK2_RDY Status/Enable/Disable/Mask +AT91C_PMC_PCK3RDY EQU (0x1 << 11) ;- (PMC) PCK3_RDY Status/Enable/Disable/Mask +// - -------- PMC_IDR : (PMC Offset: 0x64) PMC Interrupt Disable Register -------- +// - -------- PMC_SR : (PMC Offset: 0x68) PMC Status Register -------- +// - -------- PMC_IMR : (PMC Offset: 0x6c) PMC Interrupt Mask Register -------- + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Reset Controller Interface +// - ***************************************************************************** +// - -------- RSTC_RCR : (RSTC Offset: 0x0) Reset Control Register -------- +AT91C_RSTC_PROCRST EQU (0x1 << 0) ;- (RSTC) Processor Reset +AT91C_RSTC_PERRST EQU (0x1 << 2) ;- (RSTC) Peripheral Reset +AT91C_RSTC_EXTRST EQU (0x1 << 3) ;- (RSTC) External Reset +AT91C_RSTC_KEY EQU (0xFF << 24) ;- (RSTC) Password +// - -------- RSTC_RSR : (RSTC Offset: 0x4) Reset Status Register -------- +AT91C_RSTC_URSTS EQU (0x1 << 0) ;- (RSTC) User Reset Status +AT91C_RSTC_BODSTS EQU (0x1 << 1) ;- (RSTC) Brownout Detection Status +AT91C_RSTC_RSTTYP EQU (0x7 << 8) ;- (RSTC) Reset Type +AT91C_RSTC_RSTTYP_POWERUP EQU (0x0 << 8) ;- (RSTC) Power-up Reset. VDDCORE rising. +AT91C_RSTC_RSTTYP_WAKEUP EQU (0x1 << 8) ;- (RSTC) WakeUp Reset. VDDCORE rising. +AT91C_RSTC_RSTTYP_WATCHDOG EQU (0x2 << 8) ;- (RSTC) Watchdog Reset. Watchdog overflow occured. +AT91C_RSTC_RSTTYP_SOFTWARE EQU (0x3 << 8) ;- (RSTC) Software Reset. Processor reset required by the software. +AT91C_RSTC_RSTTYP_USER EQU (0x4 << 8) ;- (RSTC) User Reset. NRST pin detected low. +AT91C_RSTC_RSTTYP_BROWNOUT EQU (0x5 << 8) ;- (RSTC) Brownout Reset occured. +AT91C_RSTC_NRSTL EQU (0x1 << 16) ;- (RSTC) NRST pin level +AT91C_RSTC_SRCMP EQU (0x1 << 17) ;- (RSTC) Software Reset Command in Progress. +// - -------- RSTC_RMR : (RSTC Offset: 0x8) Reset Mode Register -------- +AT91C_RSTC_URSTEN EQU (0x1 << 0) ;- (RSTC) User Reset Enable +AT91C_RSTC_URSTIEN EQU (0x1 << 4) ;- (RSTC) User Reset Interrupt Enable +AT91C_RSTC_ERSTL EQU (0xF << 8) ;- (RSTC) User Reset Length +AT91C_RSTC_BODIEN EQU (0x1 << 16) ;- (RSTC) Brownout Detection Interrupt Enable + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Real Time Timer Controller Interface +// - ***************************************************************************** +// - -------- RTTC_RTMR : (RTTC Offset: 0x0) Real-time Mode Register -------- +AT91C_RTTC_RTPRES EQU (0xFFFF << 0) ;- (RTTC) Real-time Timer Prescaler Value +AT91C_RTTC_ALMIEN EQU (0x1 << 16) ;- (RTTC) Alarm Interrupt Enable +AT91C_RTTC_RTTINCIEN EQU (0x1 << 17) ;- (RTTC) Real Time Timer Increment Interrupt Enable +AT91C_RTTC_RTTRST EQU (0x1 << 18) ;- (RTTC) Real Time Timer Restart +// - -------- RTTC_RTAR : (RTTC Offset: 0x4) Real-time Alarm Register -------- +AT91C_RTTC_ALMV EQU (0x0 << 0) ;- (RTTC) Alarm Value +// - -------- RTTC_RTVR : (RTTC Offset: 0x8) Current Real-time Value Register -------- +AT91C_RTTC_CRTV EQU (0x0 << 0) ;- (RTTC) Current Real-time Value +// - -------- RTTC_RTSR : (RTTC Offset: 0xc) Real-time Status Register -------- +AT91C_RTTC_ALMS EQU (0x1 << 0) ;- (RTTC) Real-time Alarm Status +AT91C_RTTC_RTTINC EQU (0x1 << 1) ;- (RTTC) Real-time Timer Increment + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Periodic Interval Timer Controller Interface +// - ***************************************************************************** +// - -------- PITC_PIMR : (PITC Offset: 0x0) Periodic Interval Mode Register -------- +AT91C_PITC_PIV EQU (0xFFFFF << 0) ;- (PITC) Periodic Interval Value +AT91C_PITC_PITEN EQU (0x1 << 24) ;- (PITC) Periodic Interval Timer Enabled +AT91C_PITC_PITIEN EQU (0x1 << 25) ;- (PITC) Periodic Interval Timer Interrupt Enable +// - -------- PITC_PISR : (PITC Offset: 0x4) Periodic Interval Status Register -------- +AT91C_PITC_PITS EQU (0x1 << 0) ;- (PITC) Periodic Interval Timer Status +// - -------- PITC_PIVR : (PITC Offset: 0x8) Periodic Interval Value Register -------- +AT91C_PITC_CPIV EQU (0xFFFFF << 0) ;- (PITC) Current Periodic Interval Value +AT91C_PITC_PICNT EQU (0xFFF << 20) ;- (PITC) Periodic Interval Counter +// - -------- PITC_PIIR : (PITC Offset: 0xc) Periodic Interval Image Register -------- + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Watchdog Timer Controller Interface +// - ***************************************************************************** +// - -------- WDTC_WDCR : (WDTC Offset: 0x0) Periodic Interval Image Register -------- +AT91C_WDTC_WDRSTT EQU (0x1 << 0) ;- (WDTC) Watchdog Restart +AT91C_WDTC_KEY EQU (0xFF << 24) ;- (WDTC) Watchdog KEY Password +// - -------- WDTC_WDMR : (WDTC Offset: 0x4) Watchdog Mode Register -------- +AT91C_WDTC_WDV EQU (0xFFF << 0) ;- (WDTC) Watchdog Timer Restart +AT91C_WDTC_WDFIEN EQU (0x1 << 12) ;- (WDTC) Watchdog Fault Interrupt Enable +AT91C_WDTC_WDRSTEN EQU (0x1 << 13) ;- (WDTC) Watchdog Reset Enable +AT91C_WDTC_WDRPROC EQU (0x1 << 14) ;- (WDTC) Watchdog Timer Restart +AT91C_WDTC_WDDIS EQU (0x1 << 15) ;- (WDTC) Watchdog Disable +AT91C_WDTC_WDD EQU (0xFFF << 16) ;- (WDTC) Watchdog Delta Value +AT91C_WDTC_WDDBGHLT EQU (0x1 << 28) ;- (WDTC) Watchdog Debug Halt +AT91C_WDTC_WDIDLEHLT EQU (0x1 << 29) ;- (WDTC) Watchdog Idle Halt +// - -------- WDTC_WDSR : (WDTC Offset: 0x8) Watchdog Status Register -------- +AT91C_WDTC_WDUNF EQU (0x1 << 0) ;- (WDTC) Watchdog Underflow +AT91C_WDTC_WDERR EQU (0x1 << 1) ;- (WDTC) Watchdog Error + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Voltage Regulator Mode Controller Interface +// - ***************************************************************************** +// - -------- VREG_MR : (VREG Offset: 0x0) Voltage Regulator Mode Register -------- +AT91C_VREG_PSTDBY EQU (0x1 << 0) ;- (VREG) Voltage Regulator Power Standby Mode + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Memory Controller Interface +// - ***************************************************************************** +// - -------- MC_RCR : (MC Offset: 0x0) MC Remap Control Register -------- +AT91C_MC_RCB EQU (0x1 << 0) ;- (MC) Remap Command Bit +// - -------- MC_ASR : (MC Offset: 0x4) MC Abort Status Register -------- +AT91C_MC_UNDADD EQU (0x1 << 0) ;- (MC) Undefined Addess Abort Status +AT91C_MC_MISADD EQU (0x1 << 1) ;- (MC) Misaligned Addess Abort Status +AT91C_MC_ABTSZ EQU (0x3 << 8) ;- (MC) Abort Size Status +AT91C_MC_ABTSZ_BYTE EQU (0x0 << 8) ;- (MC) Byte +AT91C_MC_ABTSZ_HWORD EQU (0x1 << 8) ;- (MC) Half-word +AT91C_MC_ABTSZ_WORD EQU (0x2 << 8) ;- (MC) Word +AT91C_MC_ABTTYP EQU (0x3 << 10) ;- (MC) Abort Type Status +AT91C_MC_ABTTYP_DATAR EQU (0x0 << 10) ;- (MC) Data Read +AT91C_MC_ABTTYP_DATAW EQU (0x1 << 10) ;- (MC) Data Write +AT91C_MC_ABTTYP_FETCH EQU (0x2 << 10) ;- (MC) Code Fetch +AT91C_MC_MST0 EQU (0x1 << 16) ;- (MC) Master 0 Abort Source +AT91C_MC_MST1 EQU (0x1 << 17) ;- (MC) Master 1 Abort Source +AT91C_MC_SVMST0 EQU (0x1 << 24) ;- (MC) Saved Master 0 Abort Source +AT91C_MC_SVMST1 EQU (0x1 << 25) ;- (MC) Saved Master 1 Abort Source +// - -------- MC_FMR : (MC Offset: 0x60) MC Flash Mode Register -------- +AT91C_MC_FRDY EQU (0x1 << 0) ;- (MC) Flash Ready +AT91C_MC_LOCKE EQU (0x1 << 2) ;- (MC) Lock Error +AT91C_MC_PROGE EQU (0x1 << 3) ;- (MC) Programming Error +AT91C_MC_NEBP EQU (0x1 << 7) ;- (MC) No Erase Before Programming +AT91C_MC_FWS EQU (0x3 << 8) ;- (MC) Flash Wait State +AT91C_MC_FWS_0FWS EQU (0x0 << 8) ;- (MC) 1 cycle for Read, 2 for Write operations +AT91C_MC_FWS_1FWS EQU (0x1 << 8) ;- (MC) 2 cycles for Read, 3 for Write operations +AT91C_MC_FWS_2FWS EQU (0x2 << 8) ;- (MC) 3 cycles for Read, 4 for Write operations +AT91C_MC_FWS_3FWS EQU (0x3 << 8) ;- (MC) 4 cycles for Read, 4 for Write operations +AT91C_MC_FMCN EQU (0xFF << 16) ;- (MC) Flash Microsecond Cycle Number +// - -------- MC_FCR : (MC Offset: 0x64) MC Flash Command Register -------- +AT91C_MC_FCMD EQU (0xF << 0) ;- (MC) Flash Command +AT91C_MC_FCMD_START_PROG EQU (0x1) ;- (MC) Starts the programming of th epage specified by PAGEN. +AT91C_MC_FCMD_LOCK EQU (0x2) ;- (MC) Starts a lock sequence of the sector defined by the bits 4 to 7 of the field PAGEN. +AT91C_MC_FCMD_PROG_AND_LOCK EQU (0x3) ;- (MC) The lock sequence automatically happens after the programming sequence is completed. +AT91C_MC_FCMD_UNLOCK EQU (0x4) ;- (MC) Starts an unlock sequence of the sector defined by the bits 4 to 7 of the field PAGEN. +AT91C_MC_FCMD_ERASE_ALL EQU (0x8) ;- (MC) Starts the erase of the entire flash.If at least a page is locked, the command is cancelled. +AT91C_MC_FCMD_SET_GP_NVM EQU (0xB) ;- (MC) Set General Purpose NVM bits. +AT91C_MC_FCMD_CLR_GP_NVM EQU (0xD) ;- (MC) Clear General Purpose NVM bits. +AT91C_MC_FCMD_SET_SECURITY EQU (0xF) ;- (MC) Set Security Bit. +AT91C_MC_PAGEN EQU (0x3FF << 8) ;- (MC) Page Number +AT91C_MC_KEY EQU (0xFF << 24) ;- (MC) Writing Protect Key +// - -------- MC_FSR : (MC Offset: 0x68) MC Flash Command Register -------- +AT91C_MC_SECURITY EQU (0x1 << 4) ;- (MC) Security Bit Status +AT91C_MC_GPNVM0 EQU (0x1 << 8) ;- (MC) Sector 0 Lock Status +AT91C_MC_GPNVM1 EQU (0x1 << 9) ;- (MC) Sector 1 Lock Status +AT91C_MC_GPNVM2 EQU (0x1 << 10) ;- (MC) Sector 2 Lock Status +AT91C_MC_GPNVM3 EQU (0x1 << 11) ;- (MC) Sector 3 Lock Status +AT91C_MC_GPNVM4 EQU (0x1 << 12) ;- (MC) Sector 4 Lock Status +AT91C_MC_GPNVM5 EQU (0x1 << 13) ;- (MC) Sector 5 Lock Status +AT91C_MC_GPNVM6 EQU (0x1 << 14) ;- (MC) Sector 6 Lock Status +AT91C_MC_GPNVM7 EQU (0x1 << 15) ;- (MC) Sector 7 Lock Status +AT91C_MC_LOCKS0 EQU (0x1 << 16) ;- (MC) Sector 0 Lock Status +AT91C_MC_LOCKS1 EQU (0x1 << 17) ;- (MC) Sector 1 Lock Status +AT91C_MC_LOCKS2 EQU (0x1 << 18) ;- (MC) Sector 2 Lock Status +AT91C_MC_LOCKS3 EQU (0x1 << 19) ;- (MC) Sector 3 Lock Status +AT91C_MC_LOCKS4 EQU (0x1 << 20) ;- (MC) Sector 4 Lock Status +AT91C_MC_LOCKS5 EQU (0x1 << 21) ;- (MC) Sector 5 Lock Status +AT91C_MC_LOCKS6 EQU (0x1 << 22) ;- (MC) Sector 6 Lock Status +AT91C_MC_LOCKS7 EQU (0x1 << 23) ;- (MC) Sector 7 Lock Status +AT91C_MC_LOCKS8 EQU (0x1 << 24) ;- (MC) Sector 8 Lock Status +AT91C_MC_LOCKS9 EQU (0x1 << 25) ;- (MC) Sector 9 Lock Status +AT91C_MC_LOCKS10 EQU (0x1 << 26) ;- (MC) Sector 10 Lock Status +AT91C_MC_LOCKS11 EQU (0x1 << 27) ;- (MC) Sector 11 Lock Status +AT91C_MC_LOCKS12 EQU (0x1 << 28) ;- (MC) Sector 12 Lock Status +AT91C_MC_LOCKS13 EQU (0x1 << 29) ;- (MC) Sector 13 Lock Status +AT91C_MC_LOCKS14 EQU (0x1 << 30) ;- (MC) Sector 14 Lock Status +AT91C_MC_LOCKS15 EQU (0x1 << 31) ;- (MC) Sector 15 Lock Status + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Serial Parallel Interface +// - ***************************************************************************** +// - -------- SPI_CR : (SPI Offset: 0x0) SPI Control Register -------- +AT91C_SPI_SPIEN EQU (0x1 << 0) ;- (SPI) SPI Enable +AT91C_SPI_SPIDIS EQU (0x1 << 1) ;- (SPI) SPI Disable +AT91C_SPI_SWRST EQU (0x1 << 7) ;- (SPI) SPI Software reset +AT91C_SPI_LASTXFER EQU (0x1 << 24) ;- (SPI) SPI Last Transfer +// - -------- SPI_MR : (SPI Offset: 0x4) SPI Mode Register -------- +AT91C_SPI_MSTR EQU (0x1 << 0) ;- (SPI) Master/Slave Mode +AT91C_SPI_PS EQU (0x1 << 1) ;- (SPI) Peripheral Select +AT91C_SPI_PS_FIXED EQU (0x0 << 1) ;- (SPI) Fixed Peripheral Select +AT91C_SPI_PS_VARIABLE EQU (0x1 << 1) ;- (SPI) Variable Peripheral Select +AT91C_SPI_PCSDEC EQU (0x1 << 2) ;- (SPI) Chip Select Decode +AT91C_SPI_FDIV EQU (0x1 << 3) ;- (SPI) Clock Selection +AT91C_SPI_MODFDIS EQU (0x1 << 4) ;- (SPI) Mode Fault Detection +AT91C_SPI_LLB EQU (0x1 << 7) ;- (SPI) Clock Selection +AT91C_SPI_PCS EQU (0xF << 16) ;- (SPI) Peripheral Chip Select +AT91C_SPI_DLYBCS EQU (0xFF << 24) ;- (SPI) Delay Between Chip Selects +// - -------- SPI_RDR : (SPI Offset: 0x8) Receive Data Register -------- +AT91C_SPI_RD EQU (0xFFFF << 0) ;- (SPI) Receive Data +AT91C_SPI_RPCS EQU (0xF << 16) ;- (SPI) Peripheral Chip Select Status +// - -------- SPI_TDR : (SPI Offset: 0xc) Transmit Data Register -------- +AT91C_SPI_TD EQU (0xFFFF << 0) ;- (SPI) Transmit Data +AT91C_SPI_TPCS EQU (0xF << 16) ;- (SPI) Peripheral Chip Select Status +// - -------- SPI_SR : (SPI Offset: 0x10) Status Register -------- +AT91C_SPI_RDRF EQU (0x1 << 0) ;- (SPI) Receive Data Register Full +AT91C_SPI_TDRE EQU (0x1 << 1) ;- (SPI) Transmit Data Register Empty +AT91C_SPI_MODF EQU (0x1 << 2) ;- (SPI) Mode Fault Error +AT91C_SPI_OVRES EQU (0x1 << 3) ;- (SPI) Overrun Error Status +AT91C_SPI_ENDRX EQU (0x1 << 4) ;- (SPI) End of Receiver Transfer +AT91C_SPI_ENDTX EQU (0x1 << 5) ;- (SPI) End of Receiver Transfer +AT91C_SPI_RXBUFF EQU (0x1 << 6) ;- (SPI) RXBUFF Interrupt +AT91C_SPI_TXBUFE EQU (0x1 << 7) ;- (SPI) TXBUFE Interrupt +AT91C_SPI_NSSR EQU (0x1 << 8) ;- (SPI) NSSR Interrupt +AT91C_SPI_TXEMPTY EQU (0x1 << 9) ;- (SPI) TXEMPTY Interrupt +AT91C_SPI_SPIENS EQU (0x1 << 16) ;- (SPI) Enable Status +// - -------- SPI_IER : (SPI Offset: 0x14) Interrupt Enable Register -------- +// - -------- SPI_IDR : (SPI Offset: 0x18) Interrupt Disable Register -------- +// - -------- SPI_IMR : (SPI Offset: 0x1c) Interrupt Mask Register -------- +// - -------- SPI_CSR : (SPI Offset: 0x30) Chip Select Register -------- +AT91C_SPI_CPOL EQU (0x1 << 0) ;- (SPI) Clock Polarity +AT91C_SPI_NCPHA EQU (0x1 << 1) ;- (SPI) Clock Phase +AT91C_SPI_CSAAT EQU (0x1 << 3) ;- (SPI) Chip Select Active After Transfer +AT91C_SPI_BITS EQU (0xF << 4) ;- (SPI) Bits Per Transfer +AT91C_SPI_BITS_8 EQU (0x0 << 4) ;- (SPI) 8 Bits Per transfer +AT91C_SPI_BITS_9 EQU (0x1 << 4) ;- (SPI) 9 Bits Per transfer +AT91C_SPI_BITS_10 EQU (0x2 << 4) ;- (SPI) 10 Bits Per transfer +AT91C_SPI_BITS_11 EQU (0x3 << 4) ;- (SPI) 11 Bits Per transfer +AT91C_SPI_BITS_12 EQU (0x4 << 4) ;- (SPI) 12 Bits Per transfer +AT91C_SPI_BITS_13 EQU (0x5 << 4) ;- (SPI) 13 Bits Per transfer +AT91C_SPI_BITS_14 EQU (0x6 << 4) ;- (SPI) 14 Bits Per transfer +AT91C_SPI_BITS_15 EQU (0x7 << 4) ;- (SPI) 15 Bits Per transfer +AT91C_SPI_BITS_16 EQU (0x8 << 4) ;- (SPI) 16 Bits Per transfer +AT91C_SPI_SCBR EQU (0xFF << 8) ;- (SPI) Serial Clock Baud Rate +AT91C_SPI_DLYBS EQU (0xFF << 16) ;- (SPI) Delay Before SPCK +AT91C_SPI_DLYBCT EQU (0xFF << 24) ;- (SPI) Delay Between Consecutive Transfers + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Usart +// - ***************************************************************************** +// - -------- US_CR : (USART Offset: 0x0) Debug Unit Control Register -------- +AT91C_US_STTBRK EQU (0x1 << 9) ;- (USART) Start Break +AT91C_US_STPBRK EQU (0x1 << 10) ;- (USART) Stop Break +AT91C_US_STTTO EQU (0x1 << 11) ;- (USART) Start Time-out +AT91C_US_SENDA EQU (0x1 << 12) ;- (USART) Send Address +AT91C_US_RSTIT EQU (0x1 << 13) ;- (USART) Reset Iterations +AT91C_US_RSTNACK EQU (0x1 << 14) ;- (USART) Reset Non Acknowledge +AT91C_US_RETTO EQU (0x1 << 15) ;- (USART) Rearm Time-out +AT91C_US_DTREN EQU (0x1 << 16) ;- (USART) Data Terminal ready Enable +AT91C_US_DTRDIS EQU (0x1 << 17) ;- (USART) Data Terminal ready Disable +AT91C_US_RTSEN EQU (0x1 << 18) ;- (USART) Request to Send enable +AT91C_US_RTSDIS EQU (0x1 << 19) ;- (USART) Request to Send Disable +// - -------- US_MR : (USART Offset: 0x4) Debug Unit Mode Register -------- +AT91C_US_USMODE EQU (0xF << 0) ;- (USART) Usart mode +AT91C_US_USMODE_NORMAL EQU (0x0) ;- (USART) Normal +AT91C_US_USMODE_RS485 EQU (0x1) ;- (USART) RS485 +AT91C_US_USMODE_HWHSH EQU (0x2) ;- (USART) Hardware Handshaking +AT91C_US_USMODE_MODEM EQU (0x3) ;- (USART) Modem +AT91C_US_USMODE_ISO7816_0 EQU (0x4) ;- (USART) ISO7816 protocol: T = 0 +AT91C_US_USMODE_ISO7816_1 EQU (0x6) ;- (USART) ISO7816 protocol: T = 1 +AT91C_US_USMODE_IRDA EQU (0x8) ;- (USART) IrDA +AT91C_US_USMODE_SWHSH EQU (0xC) ;- (USART) Software Handshaking +AT91C_US_CLKS EQU (0x3 << 4) ;- (USART) Clock Selection (Baud Rate generator Input Clock +AT91C_US_CLKS_CLOCK EQU (0x0 << 4) ;- (USART) Clock +AT91C_US_CLKS_FDIV1 EQU (0x1 << 4) ;- (USART) fdiv1 +AT91C_US_CLKS_SLOW EQU (0x2 << 4) ;- (USART) slow_clock (ARM) +AT91C_US_CLKS_EXT EQU (0x3 << 4) ;- (USART) External (SCK) +AT91C_US_CHRL EQU (0x3 << 6) ;- (USART) Clock Selection (Baud Rate generator Input Clock +AT91C_US_CHRL_5_BITS EQU (0x0 << 6) ;- (USART) Character Length: 5 bits +AT91C_US_CHRL_6_BITS EQU (0x1 << 6) ;- (USART) Character Length: 6 bits +AT91C_US_CHRL_7_BITS EQU (0x2 << 6) ;- (USART) Character Length: 7 bits +AT91C_US_CHRL_8_BITS EQU (0x3 << 6) ;- (USART) Character Length: 8 bits +AT91C_US_SYNC EQU (0x1 << 8) ;- (USART) Synchronous Mode Select +AT91C_US_NBSTOP EQU (0x3 << 12) ;- (USART) Number of Stop bits +AT91C_US_NBSTOP_1_BIT EQU (0x0 << 12) ;- (USART) 1 stop bit +AT91C_US_NBSTOP_15_BIT EQU (0x1 << 12) ;- (USART) Asynchronous (SYNC=0) 2 stop bits Synchronous (SYNC=1) 2 stop bits +AT91C_US_NBSTOP_2_BIT EQU (0x2 << 12) ;- (USART) 2 stop bits +AT91C_US_MSBF EQU (0x1 << 16) ;- (USART) Bit Order +AT91C_US_MODE9 EQU (0x1 << 17) ;- (USART) 9-bit Character length +AT91C_US_CKLO EQU (0x1 << 18) ;- (USART) Clock Output Select +AT91C_US_OVER EQU (0x1 << 19) ;- (USART) Over Sampling Mode +AT91C_US_INACK EQU (0x1 << 20) ;- (USART) Inhibit Non Acknowledge +AT91C_US_DSNACK EQU (0x1 << 21) ;- (USART) Disable Successive NACK +AT91C_US_MAX_ITER EQU (0x1 << 24) ;- (USART) Number of Repetitions +AT91C_US_FILTER EQU (0x1 << 28) ;- (USART) Receive Line Filter +// - -------- US_IER : (USART Offset: 0x8) Debug Unit Interrupt Enable Register -------- +AT91C_US_RXBRK EQU (0x1 << 2) ;- (USART) Break Received/End of Break +AT91C_US_TIMEOUT EQU (0x1 << 8) ;- (USART) Receiver Time-out +AT91C_US_ITERATION EQU (0x1 << 10) ;- (USART) Max number of Repetitions Reached +AT91C_US_NACK EQU (0x1 << 13) ;- (USART) Non Acknowledge +AT91C_US_RIIC EQU (0x1 << 16) ;- (USART) Ring INdicator Input Change Flag +AT91C_US_DSRIC EQU (0x1 << 17) ;- (USART) Data Set Ready Input Change Flag +AT91C_US_DCDIC EQU (0x1 << 18) ;- (USART) Data Carrier Flag +AT91C_US_CTSIC EQU (0x1 << 19) ;- (USART) Clear To Send Input Change Flag +// - -------- US_IDR : (USART Offset: 0xc) Debug Unit Interrupt Disable Register -------- +// - -------- US_IMR : (USART Offset: 0x10) Debug Unit Interrupt Mask Register -------- +// - -------- US_CSR : (USART Offset: 0x14) Debug Unit Channel Status Register -------- +AT91C_US_RI EQU (0x1 << 20) ;- (USART) Image of RI Input +AT91C_US_DSR EQU (0x1 << 21) ;- (USART) Image of DSR Input +AT91C_US_DCD EQU (0x1 << 22) ;- (USART) Image of DCD Input +AT91C_US_CTS EQU (0x1 << 23) ;- (USART) Image of CTS Input + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Synchronous Serial Controller Interface +// - ***************************************************************************** +// - -------- SSC_CR : (SSC Offset: 0x0) SSC Control Register -------- +AT91C_SSC_RXEN EQU (0x1 << 0) ;- (SSC) Receive Enable +AT91C_SSC_RXDIS EQU (0x1 << 1) ;- (SSC) Receive Disable +AT91C_SSC_TXEN EQU (0x1 << 8) ;- (SSC) Transmit Enable +AT91C_SSC_TXDIS EQU (0x1 << 9) ;- (SSC) Transmit Disable +AT91C_SSC_SWRST EQU (0x1 << 15) ;- (SSC) Software Reset +// - -------- SSC_RCMR : (SSC Offset: 0x10) SSC Receive Clock Mode Register -------- +AT91C_SSC_CKS EQU (0x3 << 0) ;- (SSC) Receive/Transmit Clock Selection +AT91C_SSC_CKS_DIV EQU (0x0) ;- (SSC) Divided Clock +AT91C_SSC_CKS_TK EQU (0x1) ;- (SSC) TK Clock signal +AT91C_SSC_CKS_RK EQU (0x2) ;- (SSC) RK pin +AT91C_SSC_CKO EQU (0x7 << 2) ;- (SSC) Receive/Transmit Clock Output Mode Selection +AT91C_SSC_CKO_NONE EQU (0x0 << 2) ;- (SSC) Receive/Transmit Clock Output Mode: None RK pin: Input-only +AT91C_SSC_CKO_CONTINOUS EQU (0x1 << 2) ;- (SSC) Continuous Receive/Transmit Clock RK pin: Output +AT91C_SSC_CKO_DATA_TX EQU (0x2 << 2) ;- (SSC) Receive/Transmit Clock only during data transfers RK pin: Output +AT91C_SSC_CKI EQU (0x1 << 5) ;- (SSC) Receive/Transmit Clock Inversion +AT91C_SSC_CKG EQU (0x3 << 6) ;- (SSC) Receive/Transmit Clock Gating Selection +AT91C_SSC_CKG_NONE EQU (0x0 << 6) ;- (SSC) Receive/Transmit Clock Gating: None, continuous clock +AT91C_SSC_CKG_LOW EQU (0x1 << 6) ;- (SSC) Receive/Transmit Clock enabled only if RF Low +AT91C_SSC_CKG_HIGH EQU (0x2 << 6) ;- (SSC) Receive/Transmit Clock enabled only if RF High +AT91C_SSC_START EQU (0xF << 8) ;- (SSC) Receive/Transmit Start Selection +AT91C_SSC_START_CONTINOUS EQU (0x0 << 8) ;- (SSC) Continuous, as soon as the receiver is enabled, and immediately after the end of transfer of the previous data. +AT91C_SSC_START_TX EQU (0x1 << 8) ;- (SSC) Transmit/Receive start +AT91C_SSC_START_LOW_RF EQU (0x2 << 8) ;- (SSC) Detection of a low level on RF input +AT91C_SSC_START_HIGH_RF EQU (0x3 << 8) ;- (SSC) Detection of a high level on RF input +AT91C_SSC_START_FALL_RF EQU (0x4 << 8) ;- (SSC) Detection of a falling edge on RF input +AT91C_SSC_START_RISE_RF EQU (0x5 << 8) ;- (SSC) Detection of a rising edge on RF input +AT91C_SSC_START_LEVEL_RF EQU (0x6 << 8) ;- (SSC) Detection of any level change on RF input +AT91C_SSC_START_EDGE_RF EQU (0x7 << 8) ;- (SSC) Detection of any edge on RF input +AT91C_SSC_START_0 EQU (0x8 << 8) ;- (SSC) Compare 0 +AT91C_SSC_STOP EQU (0x1 << 12) ;- (SSC) Receive Stop Selection +AT91C_SSC_STTDLY EQU (0xFF << 16) ;- (SSC) Receive/Transmit Start Delay +AT91C_SSC_PERIOD EQU (0xFF << 24) ;- (SSC) Receive/Transmit Period Divider Selection +// - -------- SSC_RFMR : (SSC Offset: 0x14) SSC Receive Frame Mode Register -------- +AT91C_SSC_DATLEN EQU (0x1F << 0) ;- (SSC) Data Length +AT91C_SSC_LOOP EQU (0x1 << 5) ;- (SSC) Loop Mode +AT91C_SSC_MSBF EQU (0x1 << 7) ;- (SSC) Most Significant Bit First +AT91C_SSC_DATNB EQU (0xF << 8) ;- (SSC) Data Number per Frame +AT91C_SSC_FSLEN EQU (0xF << 16) ;- (SSC) Receive/Transmit Frame Sync length +AT91C_SSC_FSOS EQU (0x7 << 20) ;- (SSC) Receive/Transmit Frame Sync Output Selection +AT91C_SSC_FSOS_NONE EQU (0x0 << 20) ;- (SSC) Selected Receive/Transmit Frame Sync Signal: None RK pin Input-only +AT91C_SSC_FSOS_NEGATIVE EQU (0x1 << 20) ;- (SSC) Selected Receive/Transmit Frame Sync Signal: Negative Pulse +AT91C_SSC_FSOS_POSITIVE EQU (0x2 << 20) ;- (SSC) Selected Receive/Transmit Frame Sync Signal: Positive Pulse +AT91C_SSC_FSOS_LOW EQU (0x3 << 20) ;- (SSC) Selected Receive/Transmit Frame Sync Signal: Driver Low during data transfer +AT91C_SSC_FSOS_HIGH EQU (0x4 << 20) ;- (SSC) Selected Receive/Transmit Frame Sync Signal: Driver High during data transfer +AT91C_SSC_FSOS_TOGGLE EQU (0x5 << 20) ;- (SSC) Selected Receive/Transmit Frame Sync Signal: Toggling at each start of data transfer +AT91C_SSC_FSEDGE EQU (0x1 << 24) ;- (SSC) Frame Sync Edge Detection +// - -------- SSC_TCMR : (SSC Offset: 0x18) SSC Transmit Clock Mode Register -------- +// - -------- SSC_TFMR : (SSC Offset: 0x1c) SSC Transmit Frame Mode Register -------- +AT91C_SSC_DATDEF EQU (0x1 << 5) ;- (SSC) Data Default Value +AT91C_SSC_FSDEN EQU (0x1 << 23) ;- (SSC) Frame Sync Data Enable +// - -------- SSC_SR : (SSC Offset: 0x40) SSC Status Register -------- +AT91C_SSC_TXRDY EQU (0x1 << 0) ;- (SSC) Transmit Ready +AT91C_SSC_TXEMPTY EQU (0x1 << 1) ;- (SSC) Transmit Empty +AT91C_SSC_ENDTX EQU (0x1 << 2) ;- (SSC) End Of Transmission +AT91C_SSC_TXBUFE EQU (0x1 << 3) ;- (SSC) Transmit Buffer Empty +AT91C_SSC_RXRDY EQU (0x1 << 4) ;- (SSC) Receive Ready +AT91C_SSC_OVRUN EQU (0x1 << 5) ;- (SSC) Receive Overrun +AT91C_SSC_ENDRX EQU (0x1 << 6) ;- (SSC) End of Reception +AT91C_SSC_RXBUFF EQU (0x1 << 7) ;- (SSC) Receive Buffer Full +AT91C_SSC_CP0 EQU (0x1 << 8) ;- (SSC) Compare 0 +AT91C_SSC_CP1 EQU (0x1 << 9) ;- (SSC) Compare 1 +AT91C_SSC_TXSYN EQU (0x1 << 10) ;- (SSC) Transmit Sync +AT91C_SSC_RXSYN EQU (0x1 << 11) ;- (SSC) Receive Sync +AT91C_SSC_TXENA EQU (0x1 << 16) ;- (SSC) Transmit Enable +AT91C_SSC_RXENA EQU (0x1 << 17) ;- (SSC) Receive Enable +// - -------- SSC_IER : (SSC Offset: 0x44) SSC Interrupt Enable Register -------- +// - -------- SSC_IDR : (SSC Offset: 0x48) SSC Interrupt Disable Register -------- +// - -------- SSC_IMR : (SSC Offset: 0x4c) SSC Interrupt Mask Register -------- + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Two-wire Interface +// - ***************************************************************************** +// - -------- TWI_CR : (TWI Offset: 0x0) TWI Control Register -------- +AT91C_TWI_START EQU (0x1 << 0) ;- (TWI) Send a START Condition +AT91C_TWI_STOP EQU (0x1 << 1) ;- (TWI) Send a STOP Condition +AT91C_TWI_MSEN EQU (0x1 << 2) ;- (TWI) TWI Master Transfer Enabled +AT91C_TWI_MSDIS EQU (0x1 << 3) ;- (TWI) TWI Master Transfer Disabled +AT91C_TWI_SWRST EQU (0x1 << 7) ;- (TWI) Software Reset +// - -------- TWI_MMR : (TWI Offset: 0x4) TWI Master Mode Register -------- +AT91C_TWI_IADRSZ EQU (0x3 << 8) ;- (TWI) Internal Device Address Size +AT91C_TWI_IADRSZ_NO EQU (0x0 << 8) ;- (TWI) No internal device address +AT91C_TWI_IADRSZ_1_BYTE EQU (0x1 << 8) ;- (TWI) One-byte internal device address +AT91C_TWI_IADRSZ_2_BYTE EQU (0x2 << 8) ;- (TWI) Two-byte internal device address +AT91C_TWI_IADRSZ_3_BYTE EQU (0x3 << 8) ;- (TWI) Three-byte internal device address +AT91C_TWI_MREAD EQU (0x1 << 12) ;- (TWI) Master Read Direction +AT91C_TWI_DADR EQU (0x7F << 16) ;- (TWI) Device Address +// - -------- TWI_CWGR : (TWI Offset: 0x10) TWI Clock Waveform Generator Register -------- +AT91C_TWI_CLDIV EQU (0xFF << 0) ;- (TWI) Clock Low Divider +AT91C_TWI_CHDIV EQU (0xFF << 8) ;- (TWI) Clock High Divider +AT91C_TWI_CKDIV EQU (0x7 << 16) ;- (TWI) Clock Divider +// - -------- TWI_SR : (TWI Offset: 0x20) TWI Status Register -------- +AT91C_TWI_TXCOMP EQU (0x1 << 0) ;- (TWI) Transmission Completed +AT91C_TWI_RXRDY EQU (0x1 << 1) ;- (TWI) Receive holding register ReaDY +AT91C_TWI_TXRDY EQU (0x1 << 2) ;- (TWI) Transmit holding register ReaDY +AT91C_TWI_OVRE EQU (0x1 << 6) ;- (TWI) Overrun Error +AT91C_TWI_UNRE EQU (0x1 << 7) ;- (TWI) Underrun Error +AT91C_TWI_NACK EQU (0x1 << 8) ;- (TWI) Not Acknowledged +// - -------- TWI_IER : (TWI Offset: 0x24) TWI Interrupt Enable Register -------- +// - -------- TWI_IDR : (TWI Offset: 0x28) TWI Interrupt Disable Register -------- +// - -------- TWI_IMR : (TWI Offset: 0x2c) TWI Interrupt Mask Register -------- + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR PWMC Channel Interface +// - ***************************************************************************** +// - -------- PWMC_CMR : (PWMC_CH Offset: 0x0) PWMC Channel Mode Register -------- +AT91C_PWMC_CPRE EQU (0xF << 0) ;- (PWMC_CH) Channel Pre-scaler : PWMC_CLKx +AT91C_PWMC_CPRE_MCK EQU (0x0) ;- (PWMC_CH) +AT91C_PWMC_CPRE_MCKA EQU (0xB) ;- (PWMC_CH) +AT91C_PWMC_CPRE_MCKB EQU (0xC) ;- (PWMC_CH) +AT91C_PWMC_CALG EQU (0x1 << 8) ;- (PWMC_CH) Channel Alignment +AT91C_PWMC_CPOL EQU (0x1 << 9) ;- (PWMC_CH) Channel Polarity +AT91C_PWMC_CPD EQU (0x1 << 10) ;- (PWMC_CH) Channel Update Period +// - -------- PWMC_CDTYR : (PWMC_CH Offset: 0x4) PWMC Channel Duty Cycle Register -------- +AT91C_PWMC_CDTY EQU (0x0 << 0) ;- (PWMC_CH) Channel Duty Cycle +// - -------- PWMC_CPRDR : (PWMC_CH Offset: 0x8) PWMC Channel Period Register -------- +AT91C_PWMC_CPRD EQU (0x0 << 0) ;- (PWMC_CH) Channel Period +// - -------- PWMC_CCNTR : (PWMC_CH Offset: 0xc) PWMC Channel Counter Register -------- +AT91C_PWMC_CCNT EQU (0x0 << 0) ;- (PWMC_CH) Channel Counter +// - -------- PWMC_CUPDR : (PWMC_CH Offset: 0x10) PWMC Channel Update Register -------- +AT91C_PWMC_CUPD EQU (0x0 << 0) ;- (PWMC_CH) Channel Update + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Pulse Width Modulation Controller Interface +// - ***************************************************************************** +// - -------- PWMC_MR : (PWMC Offset: 0x0) PWMC Mode Register -------- +AT91C_PWMC_DIVA EQU (0xFF << 0) ;- (PWMC) CLKA divide factor. +AT91C_PWMC_PREA EQU (0xF << 8) ;- (PWMC) Divider Input Clock Prescaler A +AT91C_PWMC_PREA_MCK EQU (0x0 << 8) ;- (PWMC) +AT91C_PWMC_DIVB EQU (0xFF << 16) ;- (PWMC) CLKB divide factor. +AT91C_PWMC_PREB EQU (0xF << 24) ;- (PWMC) Divider Input Clock Prescaler B +AT91C_PWMC_PREB_MCK EQU (0x0 << 24) ;- (PWMC) +// - -------- PWMC_ENA : (PWMC Offset: 0x4) PWMC Enable Register -------- +AT91C_PWMC_CHID0 EQU (0x1 << 0) ;- (PWMC) Channel ID 0 +AT91C_PWMC_CHID1 EQU (0x1 << 1) ;- (PWMC) Channel ID 1 +AT91C_PWMC_CHID2 EQU (0x1 << 2) ;- (PWMC) Channel ID 2 +AT91C_PWMC_CHID3 EQU (0x1 << 3) ;- (PWMC) Channel ID 3 +// - -------- PWMC_DIS : (PWMC Offset: 0x8) PWMC Disable Register -------- +// - -------- PWMC_SR : (PWMC Offset: 0xc) PWMC Status Register -------- +// - -------- PWMC_IER : (PWMC Offset: 0x10) PWMC Interrupt Enable Register -------- +// - -------- PWMC_IDR : (PWMC Offset: 0x14) PWMC Interrupt Disable Register -------- +// - -------- PWMC_IMR : (PWMC Offset: 0x18) PWMC Interrupt Mask Register -------- +// - -------- PWMC_ISR : (PWMC Offset: 0x1c) PWMC Interrupt Status Register -------- + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR USB Device Interface +// - ***************************************************************************** +// - -------- UDP_FRM_NUM : (UDP Offset: 0x0) USB Frame Number Register -------- +AT91C_UDP_FRM_NUM EQU (0x7FF << 0) ;- (UDP) Frame Number as Defined in the Packet Field Formats +AT91C_UDP_FRM_ERR EQU (0x1 << 16) ;- (UDP) Frame Error +AT91C_UDP_FRM_OK EQU (0x1 << 17) ;- (UDP) Frame OK +// - -------- UDP_GLB_STATE : (UDP Offset: 0x4) USB Global State Register -------- +AT91C_UDP_FADDEN EQU (0x1 << 0) ;- (UDP) Function Address Enable +AT91C_UDP_CONFG EQU (0x1 << 1) ;- (UDP) Configured +AT91C_UDP_ESR EQU (0x1 << 2) ;- (UDP) Enable Send Resume +AT91C_UDP_RSMINPR EQU (0x1 << 3) ;- (UDP) A Resume Has Been Sent to the Host +AT91C_UDP_RMWUPE EQU (0x1 << 4) ;- (UDP) Remote Wake Up Enable +// - -------- UDP_FADDR : (UDP Offset: 0x8) USB Function Address Register -------- +AT91C_UDP_FADD EQU (0xFF << 0) ;- (UDP) Function Address Value +AT91C_UDP_FEN EQU (0x1 << 8) ;- (UDP) Function Enable +// - -------- UDP_IER : (UDP Offset: 0x10) USB Interrupt Enable Register -------- +AT91C_UDP_EPINT0 EQU (0x1 << 0) ;- (UDP) Endpoint 0 Interrupt +AT91C_UDP_EPINT1 EQU (0x1 << 1) ;- (UDP) Endpoint 0 Interrupt +AT91C_UDP_EPINT2 EQU (0x1 << 2) ;- (UDP) Endpoint 2 Interrupt +AT91C_UDP_EPINT3 EQU (0x1 << 3) ;- (UDP) Endpoint 3 Interrupt +AT91C_UDP_EPINT4 EQU (0x1 << 4) ;- (UDP) Endpoint 4 Interrupt +AT91C_UDP_EPINT5 EQU (0x1 << 5) ;- (UDP) Endpoint 5 Interrupt +AT91C_UDP_RXSUSP EQU (0x1 << 8) ;- (UDP) USB Suspend Interrupt +AT91C_UDP_RXRSM EQU (0x1 << 9) ;- (UDP) USB Resume Interrupt +AT91C_UDP_EXTRSM EQU (0x1 << 10) ;- (UDP) USB External Resume Interrupt +AT91C_UDP_SOFINT EQU (0x1 << 11) ;- (UDP) USB Start Of frame Interrupt +AT91C_UDP_WAKEUP EQU (0x1 << 13) ;- (UDP) USB Resume Interrupt +// - -------- UDP_IDR : (UDP Offset: 0x14) USB Interrupt Disable Register -------- +// - -------- UDP_IMR : (UDP Offset: 0x18) USB Interrupt Mask Register -------- +// - -------- UDP_ISR : (UDP Offset: 0x1c) USB Interrupt Status Register -------- +AT91C_UDP_ENDBUSRES EQU (0x1 << 12) ;- (UDP) USB End Of Bus Reset Interrupt +// - -------- UDP_ICR : (UDP Offset: 0x20) USB Interrupt Clear Register -------- +// - -------- UDP_RST_EP : (UDP Offset: 0x28) USB Reset Endpoint Register -------- +AT91C_UDP_EP0 EQU (0x1 << 0) ;- (UDP) Reset Endpoint 0 +AT91C_UDP_EP1 EQU (0x1 << 1) ;- (UDP) Reset Endpoint 1 +AT91C_UDP_EP2 EQU (0x1 << 2) ;- (UDP) Reset Endpoint 2 +AT91C_UDP_EP3 EQU (0x1 << 3) ;- (UDP) Reset Endpoint 3 +AT91C_UDP_EP4 EQU (0x1 << 4) ;- (UDP) Reset Endpoint 4 +AT91C_UDP_EP5 EQU (0x1 << 5) ;- (UDP) Reset Endpoint 5 +// - -------- UDP_CSR : (UDP Offset: 0x30) USB Endpoint Control and Status Register -------- +AT91C_UDP_TXCOMP EQU (0x1 << 0) ;- (UDP) Generates an IN packet with data previously written in the DPR +AT91C_UDP_RX_DATA_BK0 EQU (0x1 << 1) ;- (UDP) Receive Data Bank 0 +AT91C_UDP_RXSETUP EQU (0x1 << 2) ;- (UDP) Sends STALL to the Host (Control endpoints) +AT91C_UDP_ISOERROR EQU (0x1 << 3) ;- (UDP) Isochronous error (Isochronous endpoints) +AT91C_UDP_TXPKTRDY EQU (0x1 << 4) ;- (UDP) Transmit Packet Ready +AT91C_UDP_FORCESTALL EQU (0x1 << 5) ;- (UDP) Force Stall (used by Control, Bulk and Isochronous endpoints). +AT91C_UDP_RX_DATA_BK1 EQU (0x1 << 6) ;- (UDP) Receive Data Bank 1 (only used by endpoints with ping-pong attributes). +AT91C_UDP_DIR EQU (0x1 << 7) ;- (UDP) Transfer Direction +AT91C_UDP_EPTYPE EQU (0x7 << 8) ;- (UDP) Endpoint type +AT91C_UDP_EPTYPE_CTRL EQU (0x0 << 8) ;- (UDP) Control +AT91C_UDP_EPTYPE_ISO_OUT EQU (0x1 << 8) ;- (UDP) Isochronous OUT +AT91C_UDP_EPTYPE_BULK_OUT EQU (0x2 << 8) ;- (UDP) Bulk OUT +AT91C_UDP_EPTYPE_INT_OUT EQU (0x3 << 8) ;- (UDP) Interrupt OUT +AT91C_UDP_EPTYPE_ISO_IN EQU (0x5 << 8) ;- (UDP) Isochronous IN +AT91C_UDP_EPTYPE_BULK_IN EQU (0x6 << 8) ;- (UDP) Bulk IN +AT91C_UDP_EPTYPE_INT_IN EQU (0x7 << 8) ;- (UDP) Interrupt IN +AT91C_UDP_DTGLE EQU (0x1 << 11) ;- (UDP) Data Toggle +AT91C_UDP_EPEDS EQU (0x1 << 15) ;- (UDP) Endpoint Enable Disable +AT91C_UDP_RXBYTECNT EQU (0x7FF << 16) ;- (UDP) Number Of Bytes Available in the FIFO +// - -------- UDP_TXVC : (UDP Offset: 0x74) Transceiver Control Register -------- +AT91C_UDP_TXVDIS EQU (0x1 << 8) ;- (UDP) +AT91C_UDP_PUON EQU (0x1 << 9) ;- (UDP) Pull-up ON + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Timer Counter Channel Interface +// - ***************************************************************************** +// - -------- TC_CCR : (TC Offset: 0x0) TC Channel Control Register -------- +AT91C_TC_CLKEN EQU (0x1 << 0) ;- (TC) Counter Clock Enable Command +AT91C_TC_CLKDIS EQU (0x1 << 1) ;- (TC) Counter Clock Disable Command +AT91C_TC_SWTRG EQU (0x1 << 2) ;- (TC) Software Trigger Command +// - -------- TC_CMR : (TC Offset: 0x4) TC Channel Mode Register: Capture Mode / Waveform Mode -------- +AT91C_TC_CLKS EQU (0x7 << 0) ;- (TC) Clock Selection +AT91C_TC_CLKS_TIMER_DIV1_CLOCK EQU (0x0) ;- (TC) Clock selected: TIMER_DIV1_CLOCK +AT91C_TC_CLKS_TIMER_DIV2_CLOCK EQU (0x1) ;- (TC) Clock selected: TIMER_DIV2_CLOCK +AT91C_TC_CLKS_TIMER_DIV3_CLOCK EQU (0x2) ;- (TC) Clock selected: TIMER_DIV3_CLOCK +AT91C_TC_CLKS_TIMER_DIV4_CLOCK EQU (0x3) ;- (TC) Clock selected: TIMER_DIV4_CLOCK +AT91C_TC_CLKS_TIMER_DIV5_CLOCK EQU (0x4) ;- (TC) Clock selected: TIMER_DIV5_CLOCK +AT91C_TC_CLKS_XC0 EQU (0x5) ;- (TC) Clock selected: XC0 +AT91C_TC_CLKS_XC1 EQU (0x6) ;- (TC) Clock selected: XC1 +AT91C_TC_CLKS_XC2 EQU (0x7) ;- (TC) Clock selected: XC2 +AT91C_TC_CLKI EQU (0x1 << 3) ;- (TC) Clock Invert +AT91C_TC_BURST EQU (0x3 << 4) ;- (TC) Burst Signal Selection +AT91C_TC_BURST_NONE EQU (0x0 << 4) ;- (TC) The clock is not gated by an external signal +AT91C_TC_BURST_XC0 EQU (0x1 << 4) ;- (TC) XC0 is ANDed with the selected clock +AT91C_TC_BURST_XC1 EQU (0x2 << 4) ;- (TC) XC1 is ANDed with the selected clock +AT91C_TC_BURST_XC2 EQU (0x3 << 4) ;- (TC) XC2 is ANDed with the selected clock +AT91C_TC_CPCSTOP EQU (0x1 << 6) ;- (TC) Counter Clock Stopped with RC Compare +AT91C_TC_LDBSTOP EQU (0x1 << 6) ;- (TC) Counter Clock Stopped with RB Loading +AT91C_TC_CPCDIS EQU (0x1 << 7) ;- (TC) Counter Clock Disable with RC Compare +AT91C_TC_LDBDIS EQU (0x1 << 7) ;- (TC) Counter Clock Disabled with RB Loading +AT91C_TC_ETRGEDG EQU (0x3 << 8) ;- (TC) External Trigger Edge Selection +AT91C_TC_ETRGEDG_NONE EQU (0x0 << 8) ;- (TC) Edge: None +AT91C_TC_ETRGEDG_RISING EQU (0x1 << 8) ;- (TC) Edge: rising edge +AT91C_TC_ETRGEDG_FALLING EQU (0x2 << 8) ;- (TC) Edge: falling edge +AT91C_TC_ETRGEDG_BOTH EQU (0x3 << 8) ;- (TC) Edge: each edge +AT91C_TC_EEVTEDG EQU (0x3 << 8) ;- (TC) External Event Edge Selection +AT91C_TC_EEVTEDG_NONE EQU (0x0 << 8) ;- (TC) Edge: None +AT91C_TC_EEVTEDG_RISING EQU (0x1 << 8) ;- (TC) Edge: rising edge +AT91C_TC_EEVTEDG_FALLING EQU (0x2 << 8) ;- (TC) Edge: falling edge +AT91C_TC_EEVTEDG_BOTH EQU (0x3 << 8) ;- (TC) Edge: each edge +AT91C_TC_EEVT EQU (0x3 << 10) ;- (TC) External Event Selection +AT91C_TC_EEVT_TIOB EQU (0x0 << 10) ;- (TC) Signal selected as external event: TIOB TIOB direction: input +AT91C_TC_EEVT_XC0 EQU (0x1 << 10) ;- (TC) Signal selected as external event: XC0 TIOB direction: output +AT91C_TC_EEVT_XC1 EQU (0x2 << 10) ;- (TC) Signal selected as external event: XC1 TIOB direction: output +AT91C_TC_EEVT_XC2 EQU (0x3 << 10) ;- (TC) Signal selected as external event: XC2 TIOB direction: output +AT91C_TC_ABETRG EQU (0x1 << 10) ;- (TC) TIOA or TIOB External Trigger Selection +AT91C_TC_ENETRG EQU (0x1 << 12) ;- (TC) External Event Trigger enable +AT91C_TC_WAVESEL EQU (0x3 << 13) ;- (TC) Waveform Selection +AT91C_TC_WAVESEL_UP EQU (0x0 << 13) ;- (TC) UP mode without atomatic trigger on RC Compare +AT91C_TC_WAVESEL_UPDOWN EQU (0x1 << 13) ;- (TC) UPDOWN mode without automatic trigger on RC Compare +AT91C_TC_WAVESEL_UP_AUTO EQU (0x2 << 13) ;- (TC) UP mode with automatic trigger on RC Compare +AT91C_TC_WAVESEL_UPDOWN_AUTO EQU (0x3 << 13) ;- (TC) UPDOWN mode with automatic trigger on RC Compare +AT91C_TC_CPCTRG EQU (0x1 << 14) ;- (TC) RC Compare Trigger Enable +AT91C_TC_WAVE EQU (0x1 << 15) ;- (TC) +AT91C_TC_ACPA EQU (0x3 << 16) ;- (TC) RA Compare Effect on TIOA +AT91C_TC_ACPA_NONE EQU (0x0 << 16) ;- (TC) Effect: none +AT91C_TC_ACPA_SET EQU (0x1 << 16) ;- (TC) Effect: set +AT91C_TC_ACPA_CLEAR EQU (0x2 << 16) ;- (TC) Effect: clear +AT91C_TC_ACPA_TOGGLE EQU (0x3 << 16) ;- (TC) Effect: toggle +AT91C_TC_LDRA EQU (0x3 << 16) ;- (TC) RA Loading Selection +AT91C_TC_LDRA_NONE EQU (0x0 << 16) ;- (TC) Edge: None +AT91C_TC_LDRA_RISING EQU (0x1 << 16) ;- (TC) Edge: rising edge of TIOA +AT91C_TC_LDRA_FALLING EQU (0x2 << 16) ;- (TC) Edge: falling edge of TIOA +AT91C_TC_LDRA_BOTH EQU (0x3 << 16) ;- (TC) Edge: each edge of TIOA +AT91C_TC_ACPC EQU (0x3 << 18) ;- (TC) RC Compare Effect on TIOA +AT91C_TC_ACPC_NONE EQU (0x0 << 18) ;- (TC) Effect: none +AT91C_TC_ACPC_SET EQU (0x1 << 18) ;- (TC) Effect: set +AT91C_TC_ACPC_CLEAR EQU (0x2 << 18) ;- (TC) Effect: clear +AT91C_TC_ACPC_TOGGLE EQU (0x3 << 18) ;- (TC) Effect: toggle +AT91C_TC_LDRB EQU (0x3 << 18) ;- (TC) RB Loading Selection +AT91C_TC_LDRB_NONE EQU (0x0 << 18) ;- (TC) Edge: None +AT91C_TC_LDRB_RISING EQU (0x1 << 18) ;- (TC) Edge: rising edge of TIOA +AT91C_TC_LDRB_FALLING EQU (0x2 << 18) ;- (TC) Edge: falling edge of TIOA +AT91C_TC_LDRB_BOTH EQU (0x3 << 18) ;- (TC) Edge: each edge of TIOA +AT91C_TC_AEEVT EQU (0x3 << 20) ;- (TC) External Event Effect on TIOA +AT91C_TC_AEEVT_NONE EQU (0x0 << 20) ;- (TC) Effect: none +AT91C_TC_AEEVT_SET EQU (0x1 << 20) ;- (TC) Effect: set +AT91C_TC_AEEVT_CLEAR EQU (0x2 << 20) ;- (TC) Effect: clear +AT91C_TC_AEEVT_TOGGLE EQU (0x3 << 20) ;- (TC) Effect: toggle +AT91C_TC_ASWTRG EQU (0x3 << 22) ;- (TC) Software Trigger Effect on TIOA +AT91C_TC_ASWTRG_NONE EQU (0x0 << 22) ;- (TC) Effect: none +AT91C_TC_ASWTRG_SET EQU (0x1 << 22) ;- (TC) Effect: set +AT91C_TC_ASWTRG_CLEAR EQU (0x2 << 22) ;- (TC) Effect: clear +AT91C_TC_ASWTRG_TOGGLE EQU (0x3 << 22) ;- (TC) Effect: toggle +AT91C_TC_BCPB EQU (0x3 << 24) ;- (TC) RB Compare Effect on TIOB +AT91C_TC_BCPB_NONE EQU (0x0 << 24) ;- (TC) Effect: none +AT91C_TC_BCPB_SET EQU (0x1 << 24) ;- (TC) Effect: set +AT91C_TC_BCPB_CLEAR EQU (0x2 << 24) ;- (TC) Effect: clear +AT91C_TC_BCPB_TOGGLE EQU (0x3 << 24) ;- (TC) Effect: toggle +AT91C_TC_BCPC EQU (0x3 << 26) ;- (TC) RC Compare Effect on TIOB +AT91C_TC_BCPC_NONE EQU (0x0 << 26) ;- (TC) Effect: none +AT91C_TC_BCPC_SET EQU (0x1 << 26) ;- (TC) Effect: set +AT91C_TC_BCPC_CLEAR EQU (0x2 << 26) ;- (TC) Effect: clear +AT91C_TC_BCPC_TOGGLE EQU (0x3 << 26) ;- (TC) Effect: toggle +AT91C_TC_BEEVT EQU (0x3 << 28) ;- (TC) External Event Effect on TIOB +AT91C_TC_BEEVT_NONE EQU (0x0 << 28) ;- (TC) Effect: none +AT91C_TC_BEEVT_SET EQU (0x1 << 28) ;- (TC) Effect: set +AT91C_TC_BEEVT_CLEAR EQU (0x2 << 28) ;- (TC) Effect: clear +AT91C_TC_BEEVT_TOGGLE EQU (0x3 << 28) ;- (TC) Effect: toggle +AT91C_TC_BSWTRG EQU (0x3 << 30) ;- (TC) Software Trigger Effect on TIOB +AT91C_TC_BSWTRG_NONE EQU (0x0 << 30) ;- (TC) Effect: none +AT91C_TC_BSWTRG_SET EQU (0x1 << 30) ;- (TC) Effect: set +AT91C_TC_BSWTRG_CLEAR EQU (0x2 << 30) ;- (TC) Effect: clear +AT91C_TC_BSWTRG_TOGGLE EQU (0x3 << 30) ;- (TC) Effect: toggle +// - -------- TC_SR : (TC Offset: 0x20) TC Channel Status Register -------- +AT91C_TC_COVFS EQU (0x1 << 0) ;- (TC) Counter Overflow +AT91C_TC_LOVRS EQU (0x1 << 1) ;- (TC) Load Overrun +AT91C_TC_CPAS EQU (0x1 << 2) ;- (TC) RA Compare +AT91C_TC_CPBS EQU (0x1 << 3) ;- (TC) RB Compare +AT91C_TC_CPCS EQU (0x1 << 4) ;- (TC) RC Compare +AT91C_TC_LDRAS EQU (0x1 << 5) ;- (TC) RA Loading +AT91C_TC_LDRBS EQU (0x1 << 6) ;- (TC) RB Loading +AT91C_TC_ETRGS EQU (0x1 << 7) ;- (TC) External Trigger +AT91C_TC_CLKSTA EQU (0x1 << 16) ;- (TC) Clock Enabling +AT91C_TC_MTIOA EQU (0x1 << 17) ;- (TC) TIOA Mirror +AT91C_TC_MTIOB EQU (0x1 << 18) ;- (TC) TIOA Mirror +// - -------- TC_IER : (TC Offset: 0x24) TC Channel Interrupt Enable Register -------- +// - -------- TC_IDR : (TC Offset: 0x28) TC Channel Interrupt Disable Register -------- +// - -------- TC_IMR : (TC Offset: 0x2c) TC Channel Interrupt Mask Register -------- + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Timer Counter Interface +// - ***************************************************************************** +// - -------- TCB_BCR : (TCB Offset: 0xc0) TC Block Control Register -------- +AT91C_TCB_SYNC EQU (0x1 << 0) ;- (TCB) Synchro Command +// - -------- TCB_BMR : (TCB Offset: 0xc4) TC Block Mode Register -------- +AT91C_TCB_TC0XC0S EQU (0x3 << 0) ;- (TCB) External Clock Signal 0 Selection +AT91C_TCB_TC0XC0S_TCLK0 EQU (0x0) ;- (TCB) TCLK0 connected to XC0 +AT91C_TCB_TC0XC0S_NONE EQU (0x1) ;- (TCB) None signal connected to XC0 +AT91C_TCB_TC0XC0S_TIOA1 EQU (0x2) ;- (TCB) TIOA1 connected to XC0 +AT91C_TCB_TC0XC0S_TIOA2 EQU (0x3) ;- (TCB) TIOA2 connected to XC0 +AT91C_TCB_TC1XC1S EQU (0x3 << 2) ;- (TCB) External Clock Signal 1 Selection +AT91C_TCB_TC1XC1S_TCLK1 EQU (0x0 << 2) ;- (TCB) TCLK1 connected to XC1 +AT91C_TCB_TC1XC1S_NONE EQU (0x1 << 2) ;- (TCB) None signal connected to XC1 +AT91C_TCB_TC1XC1S_TIOA0 EQU (0x2 << 2) ;- (TCB) TIOA0 connected to XC1 +AT91C_TCB_TC1XC1S_TIOA2 EQU (0x3 << 2) ;- (TCB) TIOA2 connected to XC1 +AT91C_TCB_TC2XC2S EQU (0x3 << 4) ;- (TCB) External Clock Signal 2 Selection +AT91C_TCB_TC2XC2S_TCLK2 EQU (0x0 << 4) ;- (TCB) TCLK2 connected to XC2 +AT91C_TCB_TC2XC2S_NONE EQU (0x1 << 4) ;- (TCB) None signal connected to XC2 +AT91C_TCB_TC2XC2S_TIOA0 EQU (0x2 << 4) ;- (TCB) TIOA0 connected to XC2 +AT91C_TCB_TC2XC2S_TIOA1 EQU (0x3 << 4) ;- (TCB) TIOA2 connected to XC2 + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Control Area Network MailBox Interface +// - ***************************************************************************** +// - -------- CAN_MMR : (CAN_MB Offset: 0x0) CAN Message Mode Register -------- +AT91C_CAN_MTIMEMARK EQU (0xFFFF << 0) ;- (CAN_MB) Mailbox Timemark +AT91C_CAN_PRIOR EQU (0xF << 16) ;- (CAN_MB) Mailbox Priority +AT91C_CAN_MOT EQU (0x7 << 24) ;- (CAN_MB) Mailbox Object Type +AT91C_CAN_MOT_DIS EQU (0x0 << 24) ;- (CAN_MB) +AT91C_CAN_MOT_RX EQU (0x1 << 24) ;- (CAN_MB) +AT91C_CAN_MOT_RXOVERWRITE EQU (0x2 << 24) ;- (CAN_MB) +AT91C_CAN_MOT_TX EQU (0x3 << 24) ;- (CAN_MB) +AT91C_CAN_MOT_CONSUMER EQU (0x4 << 24) ;- (CAN_MB) +AT91C_CAN_MOT_PRODUCER EQU (0x5 << 24) ;- (CAN_MB) +// - -------- CAN_MAM : (CAN_MB Offset: 0x4) CAN Message Acceptance Mask Register -------- +AT91C_CAN_MIDvB EQU (0x3FFFF << 0) ;- (CAN_MB) Complementary bits for identifier in extended mode +AT91C_CAN_MIDvA EQU (0x7FF << 18) ;- (CAN_MB) Identifier for standard frame mode +AT91C_CAN_MIDE EQU (0x1 << 29) ;- (CAN_MB) Identifier Version +// - -------- CAN_MID : (CAN_MB Offset: 0x8) CAN Message ID Register -------- +// - -------- CAN_MFID : (CAN_MB Offset: 0xc) CAN Message Family ID Register -------- +// - -------- CAN_MSR : (CAN_MB Offset: 0x10) CAN Message Status Register -------- +AT91C_CAN_MTIMESTAMP EQU (0xFFFF << 0) ;- (CAN_MB) Timer Value +AT91C_CAN_MDLC EQU (0xF << 16) ;- (CAN_MB) Mailbox Data Length Code +AT91C_CAN_MRTR EQU (0x1 << 20) ;- (CAN_MB) Mailbox Remote Transmission Request +AT91C_CAN_MABT EQU (0x1 << 22) ;- (CAN_MB) Mailbox Message Abort +AT91C_CAN_MRDY EQU (0x1 << 23) ;- (CAN_MB) Mailbox Ready +AT91C_CAN_MMI EQU (0x1 << 24) ;- (CAN_MB) Mailbox Message Ignored +// - -------- CAN_MDL : (CAN_MB Offset: 0x14) CAN Message Data Low Register -------- +// - -------- CAN_MDH : (CAN_MB Offset: 0x18) CAN Message Data High Register -------- +// - -------- CAN_MCR : (CAN_MB Offset: 0x1c) CAN Message Control Register -------- +AT91C_CAN_MACR EQU (0x1 << 22) ;- (CAN_MB) Abort Request for Mailbox +AT91C_CAN_MTCR EQU (0x1 << 23) ;- (CAN_MB) Mailbox Transfer Command + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Control Area Network Interface +// - ***************************************************************************** +// - -------- CAN_MR : (CAN Offset: 0x0) CAN Mode Register -------- +AT91C_CAN_CANEN EQU (0x1 << 0) ;- (CAN) CAN Controller Enable +AT91C_CAN_LPM EQU (0x1 << 1) ;- (CAN) Disable/Enable Low Power Mode +AT91C_CAN_ABM EQU (0x1 << 2) ;- (CAN) Disable/Enable Autobaud/Listen Mode +AT91C_CAN_OVL EQU (0x1 << 3) ;- (CAN) Disable/Enable Overload Frame +AT91C_CAN_TEOF EQU (0x1 << 4) ;- (CAN) Time Stamp messages at each end of Frame +AT91C_CAN_TTM EQU (0x1 << 5) ;- (CAN) Disable/Enable Time Trigger Mode +AT91C_CAN_TIMFRZ EQU (0x1 << 6) ;- (CAN) Enable Timer Freeze +AT91C_CAN_DRPT EQU (0x1 << 7) ;- (CAN) Disable Repeat +// - -------- CAN_IER : (CAN Offset: 0x4) CAN Interrupt Enable Register -------- +AT91C_CAN_MB0 EQU (0x1 << 0) ;- (CAN) Mailbox 0 Flag +AT91C_CAN_MB1 EQU (0x1 << 1) ;- (CAN) Mailbox 1 Flag +AT91C_CAN_MB2 EQU (0x1 << 2) ;- (CAN) Mailbox 2 Flag +AT91C_CAN_MB3 EQU (0x1 << 3) ;- (CAN) Mailbox 3 Flag +AT91C_CAN_MB4 EQU (0x1 << 4) ;- (CAN) Mailbox 4 Flag +AT91C_CAN_MB5 EQU (0x1 << 5) ;- (CAN) Mailbox 5 Flag +AT91C_CAN_MB6 EQU (0x1 << 6) ;- (CAN) Mailbox 6 Flag +AT91C_CAN_MB7 EQU (0x1 << 7) ;- (CAN) Mailbox 7 Flag +AT91C_CAN_MB8 EQU (0x1 << 8) ;- (CAN) Mailbox 8 Flag +AT91C_CAN_MB9 EQU (0x1 << 9) ;- (CAN) Mailbox 9 Flag +AT91C_CAN_MB10 EQU (0x1 << 10) ;- (CAN) Mailbox 10 Flag +AT91C_CAN_MB11 EQU (0x1 << 11) ;- (CAN) Mailbox 11 Flag +AT91C_CAN_MB12 EQU (0x1 << 12) ;- (CAN) Mailbox 12 Flag +AT91C_CAN_MB13 EQU (0x1 << 13) ;- (CAN) Mailbox 13 Flag +AT91C_CAN_MB14 EQU (0x1 << 14) ;- (CAN) Mailbox 14 Flag +AT91C_CAN_MB15 EQU (0x1 << 15) ;- (CAN) Mailbox 15 Flag +AT91C_CAN_ERRA EQU (0x1 << 16) ;- (CAN) Error Active Mode Flag +AT91C_CAN_WARN EQU (0x1 << 17) ;- (CAN) Warning Limit Flag +AT91C_CAN_ERRP EQU (0x1 << 18) ;- (CAN) Error Passive Mode Flag +AT91C_CAN_BOFF EQU (0x1 << 19) ;- (CAN) Bus Off Mode Flag +AT91C_CAN_SLEEP EQU (0x1 << 20) ;- (CAN) Sleep Flag +AT91C_CAN_WAKEUP EQU (0x1 << 21) ;- (CAN) Wakeup Flag +AT91C_CAN_TOVF EQU (0x1 << 22) ;- (CAN) Timer Overflow Flag +AT91C_CAN_TSTP EQU (0x1 << 23) ;- (CAN) Timestamp Flag +AT91C_CAN_CERR EQU (0x1 << 24) ;- (CAN) CRC Error +AT91C_CAN_SERR EQU (0x1 << 25) ;- (CAN) Stuffing Error +AT91C_CAN_AERR EQU (0x1 << 26) ;- (CAN) Acknowledgment Error +AT91C_CAN_FERR EQU (0x1 << 27) ;- (CAN) Form Error +AT91C_CAN_BERR EQU (0x1 << 28) ;- (CAN) Bit Error +// - -------- CAN_IDR : (CAN Offset: 0x8) CAN Interrupt Disable Register -------- +// - -------- CAN_IMR : (CAN Offset: 0xc) CAN Interrupt Mask Register -------- +// - -------- CAN_SR : (CAN Offset: 0x10) CAN Status Register -------- +AT91C_CAN_RBSY EQU (0x1 << 29) ;- (CAN) Receiver Busy +AT91C_CAN_TBSY EQU (0x1 << 30) ;- (CAN) Transmitter Busy +AT91C_CAN_OVLY EQU (0x1 << 31) ;- (CAN) Overload Busy +// - -------- CAN_BR : (CAN Offset: 0x14) CAN Baudrate Register -------- +AT91C_CAN_PHASE2 EQU (0x7 << 0) ;- (CAN) Phase 2 segment +AT91C_CAN_PHASE1 EQU (0x7 << 4) ;- (CAN) Phase 1 segment +AT91C_CAN_PROPAG EQU (0x7 << 8) ;- (CAN) Programmation time segment +AT91C_CAN_SYNC EQU (0x3 << 12) ;- (CAN) Re-synchronization jump width segment +AT91C_CAN_BRP EQU (0x7F << 16) ;- (CAN) Baudrate Prescaler +AT91C_CAN_SMP EQU (0x1 << 24) ;- (CAN) Sampling mode +// - -------- CAN_TIM : (CAN Offset: 0x18) CAN Timer Register -------- +AT91C_CAN_TIMER EQU (0xFFFF << 0) ;- (CAN) Timer field +// - -------- CAN_TIMESTP : (CAN Offset: 0x1c) CAN Timestamp Register -------- +// - -------- CAN_ECR : (CAN Offset: 0x20) CAN Error Counter Register -------- +AT91C_CAN_REC EQU (0xFF << 0) ;- (CAN) Receive Error Counter +AT91C_CAN_TEC EQU (0xFF << 16) ;- (CAN) Transmit Error Counter +// - -------- CAN_TCR : (CAN Offset: 0x24) CAN Transfer Command Register -------- +AT91C_CAN_TIMRST EQU (0x1 << 31) ;- (CAN) Timer Reset Field +// - -------- CAN_ACR : (CAN Offset: 0x28) CAN Abort Command Register -------- + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Ethernet MAC 10/100 +// - ***************************************************************************** +// - -------- EMAC_NCR : (EMAC Offset: 0x0) -------- +AT91C_EMAC_LB EQU (0x1 << 0) ;- (EMAC) Loopback. Optional. When set, loopback signal is at high level. +AT91C_EMAC_LLB EQU (0x1 << 1) ;- (EMAC) Loopback local. +AT91C_EMAC_RE EQU (0x1 << 2) ;- (EMAC) Receive enable. +AT91C_EMAC_TE EQU (0x1 << 3) ;- (EMAC) Transmit enable. +AT91C_EMAC_MPE EQU (0x1 << 4) ;- (EMAC) Management port enable. +AT91C_EMAC_CLRSTAT EQU (0x1 << 5) ;- (EMAC) Clear statistics registers. +AT91C_EMAC_INCSTAT EQU (0x1 << 6) ;- (EMAC) Increment statistics registers. +AT91C_EMAC_WESTAT EQU (0x1 << 7) ;- (EMAC) Write enable for statistics registers. +AT91C_EMAC_BP EQU (0x1 << 8) ;- (EMAC) Back pressure. +AT91C_EMAC_TSTART EQU (0x1 << 9) ;- (EMAC) Start Transmission. +AT91C_EMAC_THALT EQU (0x1 << 10) ;- (EMAC) Transmission Halt. +AT91C_EMAC_TPFR EQU (0x1 << 11) ;- (EMAC) Transmit pause frame +AT91C_EMAC_TZQ EQU (0x1 << 12) ;- (EMAC) Transmit zero quantum pause frame +// - -------- EMAC_NCFGR : (EMAC Offset: 0x4) Network Configuration Register -------- +AT91C_EMAC_SPD EQU (0x1 << 0) ;- (EMAC) Speed. +AT91C_EMAC_FD EQU (0x1 << 1) ;- (EMAC) Full duplex. +AT91C_EMAC_JFRAME EQU (0x1 << 3) ;- (EMAC) Jumbo Frames. +AT91C_EMAC_CAF EQU (0x1 << 4) ;- (EMAC) Copy all frames. +AT91C_EMAC_NBC EQU (0x1 << 5) ;- (EMAC) No broadcast. +AT91C_EMAC_MTI EQU (0x1 << 6) ;- (EMAC) Multicast hash event enable +AT91C_EMAC_UNI EQU (0x1 << 7) ;- (EMAC) Unicast hash enable. +AT91C_EMAC_BIG EQU (0x1 << 8) ;- (EMAC) Receive 1522 bytes. +AT91C_EMAC_EAE EQU (0x1 << 9) ;- (EMAC) External address match enable. +AT91C_EMAC_CLK EQU (0x3 << 10) ;- (EMAC) +AT91C_EMAC_CLK_HCLK_8 EQU (0x0 << 10) ;- (EMAC) HCLK divided by 8 +AT91C_EMAC_CLK_HCLK_16 EQU (0x1 << 10) ;- (EMAC) HCLK divided by 16 +AT91C_EMAC_CLK_HCLK_32 EQU (0x2 << 10) ;- (EMAC) HCLK divided by 32 +AT91C_EMAC_CLK_HCLK_64 EQU (0x3 << 10) ;- (EMAC) HCLK divided by 64 +AT91C_EMAC_RTY EQU (0x1 << 12) ;- (EMAC) +AT91C_EMAC_PAE EQU (0x1 << 13) ;- (EMAC) +AT91C_EMAC_RBOF EQU (0x3 << 14) ;- (EMAC) +AT91C_EMAC_RBOF_OFFSET_0 EQU (0x0 << 14) ;- (EMAC) no offset from start of receive buffer +AT91C_EMAC_RBOF_OFFSET_1 EQU (0x1 << 14) ;- (EMAC) one byte offset from start of receive buffer +AT91C_EMAC_RBOF_OFFSET_2 EQU (0x2 << 14) ;- (EMAC) two bytes offset from start of receive buffer +AT91C_EMAC_RBOF_OFFSET_3 EQU (0x3 << 14) ;- (EMAC) three bytes offset from start of receive buffer +AT91C_EMAC_RLCE EQU (0x1 << 16) ;- (EMAC) Receive Length field Checking Enable +AT91C_EMAC_DRFCS EQU (0x1 << 17) ;- (EMAC) Discard Receive FCS +AT91C_EMAC_EFRHD EQU (0x1 << 18) ;- (EMAC) +AT91C_EMAC_IRXFCS EQU (0x1 << 19) ;- (EMAC) Ignore RX FCS +// - -------- EMAC_NSR : (EMAC Offset: 0x8) Network Status Register -------- +AT91C_EMAC_LINKR EQU (0x1 << 0) ;- (EMAC) +AT91C_EMAC_MDIO EQU (0x1 << 1) ;- (EMAC) +AT91C_EMAC_IDLE EQU (0x1 << 2) ;- (EMAC) +// - -------- EMAC_TSR : (EMAC Offset: 0x14) Transmit Status Register -------- +AT91C_EMAC_UBR EQU (0x1 << 0) ;- (EMAC) +AT91C_EMAC_COL EQU (0x1 << 1) ;- (EMAC) +AT91C_EMAC_RLES EQU (0x1 << 2) ;- (EMAC) +AT91C_EMAC_TGO EQU (0x1 << 3) ;- (EMAC) Transmit Go +AT91C_EMAC_BEX EQU (0x1 << 4) ;- (EMAC) Buffers exhausted mid frame +AT91C_EMAC_COMP EQU (0x1 << 5) ;- (EMAC) +AT91C_EMAC_UND EQU (0x1 << 6) ;- (EMAC) +// - -------- EMAC_RSR : (EMAC Offset: 0x20) Receive Status Register -------- +AT91C_EMAC_BNA EQU (0x1 << 0) ;- (EMAC) +AT91C_EMAC_REC EQU (0x1 << 1) ;- (EMAC) +AT91C_EMAC_OVR EQU (0x1 << 2) ;- (EMAC) +// - -------- EMAC_ISR : (EMAC Offset: 0x24) Interrupt Status Register -------- +AT91C_EMAC_MFD EQU (0x1 << 0) ;- (EMAC) +AT91C_EMAC_RCOMP EQU (0x1 << 1) ;- (EMAC) +AT91C_EMAC_RXUBR EQU (0x1 << 2) ;- (EMAC) +AT91C_EMAC_TXUBR EQU (0x1 << 3) ;- (EMAC) +AT91C_EMAC_TUNDR EQU (0x1 << 4) ;- (EMAC) +AT91C_EMAC_RLEX EQU (0x1 << 5) ;- (EMAC) +AT91C_EMAC_TXERR EQU (0x1 << 6) ;- (EMAC) +AT91C_EMAC_TCOMP EQU (0x1 << 7) ;- (EMAC) +AT91C_EMAC_LINK EQU (0x1 << 9) ;- (EMAC) +AT91C_EMAC_ROVR EQU (0x1 << 10) ;- (EMAC) +AT91C_EMAC_HRESP EQU (0x1 << 11) ;- (EMAC) +AT91C_EMAC_PFRE EQU (0x1 << 12) ;- (EMAC) +AT91C_EMAC_PTZ EQU (0x1 << 13) ;- (EMAC) +// - -------- EMAC_IER : (EMAC Offset: 0x28) Interrupt Enable Register -------- +// - -------- EMAC_IDR : (EMAC Offset: 0x2c) Interrupt Disable Register -------- +// - -------- EMAC_IMR : (EMAC Offset: 0x30) Interrupt Mask Register -------- +// - -------- EMAC_MAN : (EMAC Offset: 0x34) PHY Maintenance Register -------- +AT91C_EMAC_DATA EQU (0xFFFF << 0) ;- (EMAC) +AT91C_EMAC_CODE EQU (0x3 << 16) ;- (EMAC) +AT91C_EMAC_REGA EQU (0x1F << 18) ;- (EMAC) +AT91C_EMAC_PHYA EQU (0x1F << 23) ;- (EMAC) +AT91C_EMAC_RW EQU (0x3 << 28) ;- (EMAC) +AT91C_EMAC_SOF EQU (0x3 << 30) ;- (EMAC) +// - -------- EMAC_USRIO : (EMAC Offset: 0xc0) USER Input Output Register -------- +AT91C_EMAC_RMII EQU (0x1 << 0) ;- (EMAC) Reduce MII +AT91C_EMAC_CLKEN EQU (0x1 << 1) ;- (EMAC) Clock Enable +// - -------- EMAC_WOL : (EMAC Offset: 0xc4) Wake On LAN Register -------- +AT91C_EMAC_IP EQU (0xFFFF << 0) ;- (EMAC) ARP request IP address +AT91C_EMAC_MAG EQU (0x1 << 16) ;- (EMAC) Magic packet event enable +AT91C_EMAC_ARP EQU (0x1 << 17) ;- (EMAC) ARP request event enable +AT91C_EMAC_SA1 EQU (0x1 << 18) ;- (EMAC) Specific address register 1 event enable +// - -------- EMAC_REV : (EMAC Offset: 0xfc) Revision Register -------- +AT91C_EMAC_REVREF EQU (0xFFFF << 0) ;- (EMAC) +AT91C_EMAC_PARTREF EQU (0xFFFF << 16) ;- (EMAC) + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Analog to Digital Convertor +// - ***************************************************************************** +// - -------- ADC_CR : (ADC Offset: 0x0) ADC Control Register -------- +AT91C_ADC_SWRST EQU (0x1 << 0) ;- (ADC) Software Reset +AT91C_ADC_START EQU (0x1 << 1) ;- (ADC) Start Conversion +// - -------- ADC_MR : (ADC Offset: 0x4) ADC Mode Register -------- +AT91C_ADC_TRGEN EQU (0x1 << 0) ;- (ADC) Trigger Enable +AT91C_ADC_TRGEN_DIS EQU (0x0) ;- (ADC) Hradware triggers are disabled. Starting a conversion is only possible by software +AT91C_ADC_TRGEN_EN EQU (0x1) ;- (ADC) Hardware trigger selected by TRGSEL field is enabled. +AT91C_ADC_TRGSEL EQU (0x7 << 1) ;- (ADC) Trigger Selection +AT91C_ADC_TRGSEL_TIOA0 EQU (0x0 << 1) ;- (ADC) Selected TRGSEL = TIAO0 +AT91C_ADC_TRGSEL_TIOA1 EQU (0x1 << 1) ;- (ADC) Selected TRGSEL = TIAO1 +AT91C_ADC_TRGSEL_TIOA2 EQU (0x2 << 1) ;- (ADC) Selected TRGSEL = TIAO2 +AT91C_ADC_TRGSEL_TIOA3 EQU (0x3 << 1) ;- (ADC) Selected TRGSEL = TIAO3 +AT91C_ADC_TRGSEL_TIOA4 EQU (0x4 << 1) ;- (ADC) Selected TRGSEL = TIAO4 +AT91C_ADC_TRGSEL_TIOA5 EQU (0x5 << 1) ;- (ADC) Selected TRGSEL = TIAO5 +AT91C_ADC_TRGSEL_EXT EQU (0x6 << 1) ;- (ADC) Selected TRGSEL = External Trigger +AT91C_ADC_LOWRES EQU (0x1 << 4) ;- (ADC) Resolution. +AT91C_ADC_LOWRES_10_BIT EQU (0x0 << 4) ;- (ADC) 10-bit resolution +AT91C_ADC_LOWRES_8_BIT EQU (0x1 << 4) ;- (ADC) 8-bit resolution +AT91C_ADC_SLEEP EQU (0x1 << 5) ;- (ADC) Sleep Mode +AT91C_ADC_SLEEP_NORMAL_MODE EQU (0x0 << 5) ;- (ADC) Normal Mode +AT91C_ADC_SLEEP_MODE EQU (0x1 << 5) ;- (ADC) Sleep Mode +AT91C_ADC_PRESCAL EQU (0x3F << 8) ;- (ADC) Prescaler rate selection +AT91C_ADC_STARTUP EQU (0x1F << 16) ;- (ADC) Startup Time +AT91C_ADC_SHTIM EQU (0xF << 24) ;- (ADC) Sample & Hold Time +// - -------- ADC_CHER : (ADC Offset: 0x10) ADC Channel Enable Register -------- +AT91C_ADC_CH0 EQU (0x1 << 0) ;- (ADC) Channel 0 +AT91C_ADC_CH1 EQU (0x1 << 1) ;- (ADC) Channel 1 +AT91C_ADC_CH2 EQU (0x1 << 2) ;- (ADC) Channel 2 +AT91C_ADC_CH3 EQU (0x1 << 3) ;- (ADC) Channel 3 +AT91C_ADC_CH4 EQU (0x1 << 4) ;- (ADC) Channel 4 +AT91C_ADC_CH5 EQU (0x1 << 5) ;- (ADC) Channel 5 +AT91C_ADC_CH6 EQU (0x1 << 6) ;- (ADC) Channel 6 +AT91C_ADC_CH7 EQU (0x1 << 7) ;- (ADC) Channel 7 +// - -------- ADC_CHDR : (ADC Offset: 0x14) ADC Channel Disable Register -------- +// - -------- ADC_CHSR : (ADC Offset: 0x18) ADC Channel Status Register -------- +// - -------- ADC_SR : (ADC Offset: 0x1c) ADC Status Register -------- +AT91C_ADC_EOC0 EQU (0x1 << 0) ;- (ADC) End of Conversion +AT91C_ADC_EOC1 EQU (0x1 << 1) ;- (ADC) End of Conversion +AT91C_ADC_EOC2 EQU (0x1 << 2) ;- (ADC) End of Conversion +AT91C_ADC_EOC3 EQU (0x1 << 3) ;- (ADC) End of Conversion +AT91C_ADC_EOC4 EQU (0x1 << 4) ;- (ADC) End of Conversion +AT91C_ADC_EOC5 EQU (0x1 << 5) ;- (ADC) End of Conversion +AT91C_ADC_EOC6 EQU (0x1 << 6) ;- (ADC) End of Conversion +AT91C_ADC_EOC7 EQU (0x1 << 7) ;- (ADC) End of Conversion +AT91C_ADC_OVRE0 EQU (0x1 << 8) ;- (ADC) Overrun Error +AT91C_ADC_OVRE1 EQU (0x1 << 9) ;- (ADC) Overrun Error +AT91C_ADC_OVRE2 EQU (0x1 << 10) ;- (ADC) Overrun Error +AT91C_ADC_OVRE3 EQU (0x1 << 11) ;- (ADC) Overrun Error +AT91C_ADC_OVRE4 EQU (0x1 << 12) ;- (ADC) Overrun Error +AT91C_ADC_OVRE5 EQU (0x1 << 13) ;- (ADC) Overrun Error +AT91C_ADC_OVRE6 EQU (0x1 << 14) ;- (ADC) Overrun Error +AT91C_ADC_OVRE7 EQU (0x1 << 15) ;- (ADC) Overrun Error +AT91C_ADC_DRDY EQU (0x1 << 16) ;- (ADC) Data Ready +AT91C_ADC_GOVRE EQU (0x1 << 17) ;- (ADC) General Overrun +AT91C_ADC_ENDRX EQU (0x1 << 18) ;- (ADC) End of Receiver Transfer +AT91C_ADC_RXBUFF EQU (0x1 << 19) ;- (ADC) RXBUFF Interrupt +// - -------- ADC_LCDR : (ADC Offset: 0x20) ADC Last Converted Data Register -------- +AT91C_ADC_LDATA EQU (0x3FF << 0) ;- (ADC) Last Data Converted +// - -------- ADC_IER : (ADC Offset: 0x24) ADC Interrupt Enable Register -------- +// - -------- ADC_IDR : (ADC Offset: 0x28) ADC Interrupt Disable Register -------- +// - -------- ADC_IMR : (ADC Offset: 0x2c) ADC Interrupt Mask Register -------- +// - -------- ADC_CDR0 : (ADC Offset: 0x30) ADC Channel Data Register 0 -------- +AT91C_ADC_DATA EQU (0x3FF << 0) ;- (ADC) Converted Data +// - -------- ADC_CDR1 : (ADC Offset: 0x34) ADC Channel Data Register 1 -------- +// - -------- ADC_CDR2 : (ADC Offset: 0x38) ADC Channel Data Register 2 -------- +// - -------- ADC_CDR3 : (ADC Offset: 0x3c) ADC Channel Data Register 3 -------- +// - -------- ADC_CDR4 : (ADC Offset: 0x40) ADC Channel Data Register 4 -------- +// - -------- ADC_CDR5 : (ADC Offset: 0x44) ADC Channel Data Register 5 -------- +// - -------- ADC_CDR6 : (ADC Offset: 0x48) ADC Channel Data Register 6 -------- +// - -------- ADC_CDR7 : (ADC Offset: 0x4c) ADC Channel Data Register 7 -------- + +// - ***************************************************************************** +// - REGISTER ADDRESS DEFINITION FOR AT91SAM7X256 +// - ***************************************************************************** +// - ========== Register definition for SYS peripheral ========== +// - ========== Register definition for AIC peripheral ========== +AT91C_AIC_IVR EQU (0xFFFFF100) ;- (AIC) IRQ Vector Register +AT91C_AIC_SMR EQU (0xFFFFF000) ;- (AIC) Source Mode Register +AT91C_AIC_FVR EQU (0xFFFFF104) ;- (AIC) FIQ Vector Register +AT91C_AIC_DCR EQU (0xFFFFF138) ;- (AIC) Debug Control Register (Protect) +AT91C_AIC_EOICR EQU (0xFFFFF130) ;- (AIC) End of Interrupt Command Register +AT91C_AIC_SVR EQU (0xFFFFF080) ;- (AIC) Source Vector Register +AT91C_AIC_FFSR EQU (0xFFFFF148) ;- (AIC) Fast Forcing Status Register +AT91C_AIC_ICCR EQU (0xFFFFF128) ;- (AIC) Interrupt Clear Command Register +AT91C_AIC_ISR EQU (0xFFFFF108) ;- (AIC) Interrupt Status Register +AT91C_AIC_IMR EQU (0xFFFFF110) ;- (AIC) Interrupt Mask Register +AT91C_AIC_IPR EQU (0xFFFFF10C) ;- (AIC) Interrupt Pending Register +AT91C_AIC_FFER EQU (0xFFFFF140) ;- (AIC) Fast Forcing Enable Register +AT91C_AIC_IECR EQU (0xFFFFF120) ;- (AIC) Interrupt Enable Command Register +AT91C_AIC_ISCR EQU (0xFFFFF12C) ;- (AIC) Interrupt Set Command Register +AT91C_AIC_FFDR EQU (0xFFFFF144) ;- (AIC) Fast Forcing Disable Register +AT91C_AIC_CISR EQU (0xFFFFF114) ;- (AIC) Core Interrupt Status Register +AT91C_AIC_IDCR EQU (0xFFFFF124) ;- (AIC) Interrupt Disable Command Register +AT91C_AIC_SPU EQU (0xFFFFF134) ;- (AIC) Spurious Vector Register +// - ========== Register definition for PDC_DBGU peripheral ========== +AT91C_DBGU_TCR EQU (0xFFFFF30C) ;- (PDC_DBGU) Transmit Counter Register +AT91C_DBGU_RNPR EQU (0xFFFFF310) ;- (PDC_DBGU) Receive Next Pointer Register +AT91C_DBGU_TNPR EQU (0xFFFFF318) ;- (PDC_DBGU) Transmit Next Pointer Register +AT91C_DBGU_TPR EQU (0xFFFFF308) ;- (PDC_DBGU) Transmit Pointer Register +AT91C_DBGU_RPR EQU (0xFFFFF300) ;- (PDC_DBGU) Receive Pointer Register +AT91C_DBGU_RCR EQU (0xFFFFF304) ;- (PDC_DBGU) Receive Counter Register +AT91C_DBGU_RNCR EQU (0xFFFFF314) ;- (PDC_DBGU) Receive Next Counter Register +AT91C_DBGU_PTCR EQU (0xFFFFF320) ;- (PDC_DBGU) PDC Transfer Control Register +AT91C_DBGU_PTSR EQU (0xFFFFF324) ;- (PDC_DBGU) PDC Transfer Status Register +AT91C_DBGU_TNCR EQU (0xFFFFF31C) ;- (PDC_DBGU) Transmit Next Counter Register +// - ========== Register definition for DBGU peripheral ========== +AT91C_DBGU_EXID EQU (0xFFFFF244) ;- (DBGU) Chip ID Extension Register +AT91C_DBGU_BRGR EQU (0xFFFFF220) ;- (DBGU) Baud Rate Generator Register +AT91C_DBGU_IDR EQU (0xFFFFF20C) ;- (DBGU) Interrupt Disable Register +AT91C_DBGU_CSR EQU (0xFFFFF214) ;- (DBGU) Channel Status Register +AT91C_DBGU_CIDR EQU (0xFFFFF240) ;- (DBGU) Chip ID Register +AT91C_DBGU_MR EQU (0xFFFFF204) ;- (DBGU) Mode Register +AT91C_DBGU_IMR EQU (0xFFFFF210) ;- (DBGU) Interrupt Mask Register +AT91C_DBGU_CR EQU (0xFFFFF200) ;- (DBGU) Control Register +AT91C_DBGU_FNTR EQU (0xFFFFF248) ;- (DBGU) Force NTRST Register +AT91C_DBGU_THR EQU (0xFFFFF21C) ;- (DBGU) Transmitter Holding Register +AT91C_DBGU_RHR EQU (0xFFFFF218) ;- (DBGU) Receiver Holding Register +AT91C_DBGU_IER EQU (0xFFFFF208) ;- (DBGU) Interrupt Enable Register +// - ========== Register definition for PIOA peripheral ========== +AT91C_PIOA_ODR EQU (0xFFFFF414) ;- (PIOA) Output Disable Registerr +AT91C_PIOA_SODR EQU (0xFFFFF430) ;- (PIOA) Set Output Data Register +AT91C_PIOA_ISR EQU (0xFFFFF44C) ;- (PIOA) Interrupt Status Register +AT91C_PIOA_ABSR EQU (0xFFFFF478) ;- (PIOA) AB Select Status Register +AT91C_PIOA_IER EQU (0xFFFFF440) ;- (PIOA) Interrupt Enable Register +AT91C_PIOA_PPUDR EQU (0xFFFFF460) ;- (PIOA) Pull-up Disable Register +AT91C_PIOA_IMR EQU (0xFFFFF448) ;- (PIOA) Interrupt Mask Register +AT91C_PIOA_PER EQU (0xFFFFF400) ;- (PIOA) PIO Enable Register +AT91C_PIOA_IFDR EQU (0xFFFFF424) ;- (PIOA) Input Filter Disable Register +AT91C_PIOA_OWDR EQU (0xFFFFF4A4) ;- (PIOA) Output Write Disable Register +AT91C_PIOA_MDSR EQU (0xFFFFF458) ;- (PIOA) Multi-driver Status Register +AT91C_PIOA_IDR EQU (0xFFFFF444) ;- (PIOA) Interrupt Disable Register +AT91C_PIOA_ODSR EQU (0xFFFFF438) ;- (PIOA) Output Data Status Register +AT91C_PIOA_PPUSR EQU (0xFFFFF468) ;- (PIOA) Pull-up Status Register +AT91C_PIOA_OWSR EQU (0xFFFFF4A8) ;- (PIOA) Output Write Status Register +AT91C_PIOA_BSR EQU (0xFFFFF474) ;- (PIOA) Select B Register +AT91C_PIOA_OWER EQU (0xFFFFF4A0) ;- (PIOA) Output Write Enable Register +AT91C_PIOA_IFER EQU (0xFFFFF420) ;- (PIOA) Input Filter Enable Register +AT91C_PIOA_PDSR EQU (0xFFFFF43C) ;- (PIOA) Pin Data Status Register +AT91C_PIOA_PPUER EQU (0xFFFFF464) ;- (PIOA) Pull-up Enable Register +AT91C_PIOA_OSR EQU (0xFFFFF418) ;- (PIOA) Output Status Register +AT91C_PIOA_ASR EQU (0xFFFFF470) ;- (PIOA) Select A Register +AT91C_PIOA_MDDR EQU (0xFFFFF454) ;- (PIOA) Multi-driver Disable Register +AT91C_PIOA_CODR EQU (0xFFFFF434) ;- (PIOA) Clear Output Data Register +AT91C_PIOA_MDER EQU (0xFFFFF450) ;- (PIOA) Multi-driver Enable Register +AT91C_PIOA_PDR EQU (0xFFFFF404) ;- (PIOA) PIO Disable Register +AT91C_PIOA_IFSR EQU (0xFFFFF428) ;- (PIOA) Input Filter Status Register +AT91C_PIOA_OER EQU (0xFFFFF410) ;- (PIOA) Output Enable Register +AT91C_PIOA_PSR EQU (0xFFFFF408) ;- (PIOA) PIO Status Register +// - ========== Register definition for PIOB peripheral ========== +AT91C_PIOB_OWDR EQU (0xFFFFF6A4) ;- (PIOB) Output Write Disable Register +AT91C_PIOB_MDER EQU (0xFFFFF650) ;- (PIOB) Multi-driver Enable Register +AT91C_PIOB_PPUSR EQU (0xFFFFF668) ;- (PIOB) Pull-up Status Register +AT91C_PIOB_IMR EQU (0xFFFFF648) ;- (PIOB) Interrupt Mask Register +AT91C_PIOB_ASR EQU (0xFFFFF670) ;- (PIOB) Select A Register +AT91C_PIOB_PPUDR EQU (0xFFFFF660) ;- (PIOB) Pull-up Disable Register +AT91C_PIOB_PSR EQU (0xFFFFF608) ;- (PIOB) PIO Status Register +AT91C_PIOB_IER EQU (0xFFFFF640) ;- (PIOB) Interrupt Enable Register +AT91C_PIOB_CODR EQU (0xFFFFF634) ;- (PIOB) Clear Output Data Register +AT91C_PIOB_OWER EQU (0xFFFFF6A0) ;- (PIOB) Output Write Enable Register +AT91C_PIOB_ABSR EQU (0xFFFFF678) ;- (PIOB) AB Select Status Register +AT91C_PIOB_IFDR EQU (0xFFFFF624) ;- (PIOB) Input Filter Disable Register +AT91C_PIOB_PDSR EQU (0xFFFFF63C) ;- (PIOB) Pin Data Status Register +AT91C_PIOB_IDR EQU (0xFFFFF644) ;- (PIOB) Interrupt Disable Register +AT91C_PIOB_OWSR EQU (0xFFFFF6A8) ;- (PIOB) Output Write Status Register +AT91C_PIOB_PDR EQU (0xFFFFF604) ;- (PIOB) PIO Disable Register +AT91C_PIOB_ODR EQU (0xFFFFF614) ;- (PIOB) Output Disable Registerr +AT91C_PIOB_IFSR EQU (0xFFFFF628) ;- (PIOB) Input Filter Status Register +AT91C_PIOB_PPUER EQU (0xFFFFF664) ;- (PIOB) Pull-up Enable Register +AT91C_PIOB_SODR EQU (0xFFFFF630) ;- (PIOB) Set Output Data Register +AT91C_PIOB_ISR EQU (0xFFFFF64C) ;- (PIOB) Interrupt Status Register +AT91C_PIOB_ODSR EQU (0xFFFFF638) ;- (PIOB) Output Data Status Register +AT91C_PIOB_OSR EQU (0xFFFFF618) ;- (PIOB) Output Status Register +AT91C_PIOB_MDSR EQU (0xFFFFF658) ;- (PIOB) Multi-driver Status Register +AT91C_PIOB_IFER EQU (0xFFFFF620) ;- (PIOB) Input Filter Enable Register +AT91C_PIOB_BSR EQU (0xFFFFF674) ;- (PIOB) Select B Register +AT91C_PIOB_MDDR EQU (0xFFFFF654) ;- (PIOB) Multi-driver Disable Register +AT91C_PIOB_OER EQU (0xFFFFF610) ;- (PIOB) Output Enable Register +AT91C_PIOB_PER EQU (0xFFFFF600) ;- (PIOB) PIO Enable Register +// - ========== Register definition for CKGR peripheral ========== +AT91C_CKGR_MOR EQU (0xFFFFFC20) ;- (CKGR) Main Oscillator Register +AT91C_CKGR_PLLR EQU (0xFFFFFC2C) ;- (CKGR) PLL Register +AT91C_CKGR_MCFR EQU (0xFFFFFC24) ;- (CKGR) Main Clock Frequency Register +// - ========== Register definition for PMC peripheral ========== +AT91C_PMC_IDR EQU (0xFFFFFC64) ;- (PMC) Interrupt Disable Register +AT91C_PMC_MOR EQU (0xFFFFFC20) ;- (PMC) Main Oscillator Register +AT91C_PMC_PLLR EQU (0xFFFFFC2C) ;- (PMC) PLL Register +AT91C_PMC_PCER EQU (0xFFFFFC10) ;- (PMC) Peripheral Clock Enable Register +AT91C_PMC_PCKR EQU (0xFFFFFC40) ;- (PMC) Programmable Clock Register +AT91C_PMC_MCKR EQU (0xFFFFFC30) ;- (PMC) Master Clock Register +AT91C_PMC_SCDR EQU (0xFFFFFC04) ;- (PMC) System Clock Disable Register +AT91C_PMC_PCDR EQU (0xFFFFFC14) ;- (PMC) Peripheral Clock Disable Register +AT91C_PMC_SCSR EQU (0xFFFFFC08) ;- (PMC) System Clock Status Register +AT91C_PMC_PCSR EQU (0xFFFFFC18) ;- (PMC) Peripheral Clock Status Register +AT91C_PMC_MCFR EQU (0xFFFFFC24) ;- (PMC) Main Clock Frequency Register +AT91C_PMC_SCER EQU (0xFFFFFC00) ;- (PMC) System Clock Enable Register +AT91C_PMC_IMR EQU (0xFFFFFC6C) ;- (PMC) Interrupt Mask Register +AT91C_PMC_IER EQU (0xFFFFFC60) ;- (PMC) Interrupt Enable Register +AT91C_PMC_SR EQU (0xFFFFFC68) ;- (PMC) Status Register +// - ========== Register definition for RSTC peripheral ========== +AT91C_RSTC_RCR EQU (0xFFFFFD00) ;- (RSTC) Reset Control Register +AT91C_RSTC_RMR EQU (0xFFFFFD08) ;- (RSTC) Reset Mode Register +AT91C_RSTC_RSR EQU (0xFFFFFD04) ;- (RSTC) Reset Status Register +// - ========== Register definition for RTTC peripheral ========== +AT91C_RTTC_RTSR EQU (0xFFFFFD2C) ;- (RTTC) Real-time Status Register +AT91C_RTTC_RTMR EQU (0xFFFFFD20) ;- (RTTC) Real-time Mode Register +AT91C_RTTC_RTVR EQU (0xFFFFFD28) ;- (RTTC) Real-time Value Register +AT91C_RTTC_RTAR EQU (0xFFFFFD24) ;- (RTTC) Real-time Alarm Register +// - ========== Register definition for PITC peripheral ========== +AT91C_PITC_PIVR EQU (0xFFFFFD38) ;- (PITC) Period Interval Value Register +AT91C_PITC_PISR EQU (0xFFFFFD34) ;- (PITC) Period Interval Status Register +AT91C_PITC_PIIR EQU (0xFFFFFD3C) ;- (PITC) Period Interval Image Register +AT91C_PITC_PIMR EQU (0xFFFFFD30) ;- (PITC) Period Interval Mode Register +// - ========== Register definition for WDTC peripheral ========== +AT91C_WDTC_WDCR EQU (0xFFFFFD40) ;- (WDTC) Watchdog Control Register +AT91C_WDTC_WDSR EQU (0xFFFFFD48) ;- (WDTC) Watchdog Status Register +AT91C_WDTC_WDMR EQU (0xFFFFFD44) ;- (WDTC) Watchdog Mode Register +// - ========== Register definition for VREG peripheral ========== +AT91C_VREG_MR EQU (0xFFFFFD60) ;- (VREG) Voltage Regulator Mode Register +// - ========== Register definition for MC peripheral ========== +AT91C_MC_ASR EQU (0xFFFFFF04) ;- (MC) MC Abort Status Register +AT91C_MC_RCR EQU (0xFFFFFF00) ;- (MC) MC Remap Control Register +AT91C_MC_FCR EQU (0xFFFFFF64) ;- (MC) MC Flash Command Register +AT91C_MC_AASR EQU (0xFFFFFF08) ;- (MC) MC Abort Address Status Register +AT91C_MC_FSR EQU (0xFFFFFF68) ;- (MC) MC Flash Status Register +AT91C_MC_FMR EQU (0xFFFFFF60) ;- (MC) MC Flash Mode Register +// - ========== Register definition for PDC_SPI1 peripheral ========== +AT91C_SPI1_PTCR EQU (0xFFFE4120) ;- (PDC_SPI1) PDC Transfer Control Register +AT91C_SPI1_RPR EQU (0xFFFE4100) ;- (PDC_SPI1) Receive Pointer Register +AT91C_SPI1_TNCR EQU (0xFFFE411C) ;- (PDC_SPI1) Transmit Next Counter Register +AT91C_SPI1_TPR EQU (0xFFFE4108) ;- (PDC_SPI1) Transmit Pointer Register +AT91C_SPI1_TNPR EQU (0xFFFE4118) ;- (PDC_SPI1) Transmit Next Pointer Register +AT91C_SPI1_TCR EQU (0xFFFE410C) ;- (PDC_SPI1) Transmit Counter Register +AT91C_SPI1_RCR EQU (0xFFFE4104) ;- (PDC_SPI1) Receive Counter Register +AT91C_SPI1_RNPR EQU (0xFFFE4110) ;- (PDC_SPI1) Receive Next Pointer Register +AT91C_SPI1_RNCR EQU (0xFFFE4114) ;- (PDC_SPI1) Receive Next Counter Register +AT91C_SPI1_PTSR EQU (0xFFFE4124) ;- (PDC_SPI1) PDC Transfer Status Register +// - ========== Register definition for SPI1 peripheral ========== +AT91C_SPI1_IMR EQU (0xFFFE401C) ;- (SPI1) Interrupt Mask Register +AT91C_SPI1_IER EQU (0xFFFE4014) ;- (SPI1) Interrupt Enable Register +AT91C_SPI1_MR EQU (0xFFFE4004) ;- (SPI1) Mode Register +AT91C_SPI1_RDR EQU (0xFFFE4008) ;- (SPI1) Receive Data Register +AT91C_SPI1_IDR EQU (0xFFFE4018) ;- (SPI1) Interrupt Disable Register +AT91C_SPI1_SR EQU (0xFFFE4010) ;- (SPI1) Status Register +AT91C_SPI1_TDR EQU (0xFFFE400C) ;- (SPI1) Transmit Data Register +AT91C_SPI1_CR EQU (0xFFFE4000) ;- (SPI1) Control Register +AT91C_SPI1_CSR EQU (0xFFFE4030) ;- (SPI1) Chip Select Register +// - ========== Register definition for PDC_SPI0 peripheral ========== +AT91C_SPI0_PTCR EQU (0xFFFE0120) ;- (PDC_SPI0) PDC Transfer Control Register +AT91C_SPI0_TPR EQU (0xFFFE0108) ;- (PDC_SPI0) Transmit Pointer Register +AT91C_SPI0_TCR EQU (0xFFFE010C) ;- (PDC_SPI0) Transmit Counter Register +AT91C_SPI0_RCR EQU (0xFFFE0104) ;- (PDC_SPI0) Receive Counter Register +AT91C_SPI0_PTSR EQU (0xFFFE0124) ;- (PDC_SPI0) PDC Transfer Status Register +AT91C_SPI0_RNPR EQU (0xFFFE0110) ;- (PDC_SPI0) Receive Next Pointer Register +AT91C_SPI0_RPR EQU (0xFFFE0100) ;- (PDC_SPI0) Receive Pointer Register +AT91C_SPI0_TNCR EQU (0xFFFE011C) ;- (PDC_SPI0) Transmit Next Counter Register +AT91C_SPI0_RNCR EQU (0xFFFE0114) ;- (PDC_SPI0) Receive Next Counter Register +AT91C_SPI0_TNPR EQU (0xFFFE0118) ;- (PDC_SPI0) Transmit Next Pointer Register +// - ========== Register definition for SPI0 peripheral ========== +AT91C_SPI0_IER EQU (0xFFFE0014) ;- (SPI0) Interrupt Enable Register +AT91C_SPI0_SR EQU (0xFFFE0010) ;- (SPI0) Status Register +AT91C_SPI0_IDR EQU (0xFFFE0018) ;- (SPI0) Interrupt Disable Register +AT91C_SPI0_CR EQU (0xFFFE0000) ;- (SPI0) Control Register +AT91C_SPI0_MR EQU (0xFFFE0004) ;- (SPI0) Mode Register +AT91C_SPI0_IMR EQU (0xFFFE001C) ;- (SPI0) Interrupt Mask Register +AT91C_SPI0_TDR EQU (0xFFFE000C) ;- (SPI0) Transmit Data Register +AT91C_SPI0_RDR EQU (0xFFFE0008) ;- (SPI0) Receive Data Register +AT91C_SPI0_CSR EQU (0xFFFE0030) ;- (SPI0) Chip Select Register +// - ========== Register definition for PDC_US1 peripheral ========== +AT91C_US1_RNCR EQU (0xFFFC4114) ;- (PDC_US1) Receive Next Counter Register +AT91C_US1_PTCR EQU (0xFFFC4120) ;- (PDC_US1) PDC Transfer Control Register +AT91C_US1_TCR EQU (0xFFFC410C) ;- (PDC_US1) Transmit Counter Register +AT91C_US1_PTSR EQU (0xFFFC4124) ;- (PDC_US1) PDC Transfer Status Register +AT91C_US1_TNPR EQU (0xFFFC4118) ;- (PDC_US1) Transmit Next Pointer Register +AT91C_US1_RCR EQU (0xFFFC4104) ;- (PDC_US1) Receive Counter Register +AT91C_US1_RNPR EQU (0xFFFC4110) ;- (PDC_US1) Receive Next Pointer Register +AT91C_US1_RPR EQU (0xFFFC4100) ;- (PDC_US1) Receive Pointer Register +AT91C_US1_TNCR EQU (0xFFFC411C) ;- (PDC_US1) Transmit Next Counter Register +AT91C_US1_TPR EQU (0xFFFC4108) ;- (PDC_US1) Transmit Pointer Register +// - ========== Register definition for US1 peripheral ========== +AT91C_US1_IF EQU (0xFFFC404C) ;- (US1) IRDA_FILTER Register +AT91C_US1_NER EQU (0xFFFC4044) ;- (US1) Nb Errors Register +AT91C_US1_RTOR EQU (0xFFFC4024) ;- (US1) Receiver Time-out Register +AT91C_US1_CSR EQU (0xFFFC4014) ;- (US1) Channel Status Register +AT91C_US1_IDR EQU (0xFFFC400C) ;- (US1) Interrupt Disable Register +AT91C_US1_IER EQU (0xFFFC4008) ;- (US1) Interrupt Enable Register +AT91C_US1_THR EQU (0xFFFC401C) ;- (US1) Transmitter Holding Register +AT91C_US1_TTGR EQU (0xFFFC4028) ;- (US1) Transmitter Time-guard Register +AT91C_US1_RHR EQU (0xFFFC4018) ;- (US1) Receiver Holding Register +AT91C_US1_BRGR EQU (0xFFFC4020) ;- (US1) Baud Rate Generator Register +AT91C_US1_IMR EQU (0xFFFC4010) ;- (US1) Interrupt Mask Register +AT91C_US1_FIDI EQU (0xFFFC4040) ;- (US1) FI_DI_Ratio Register +AT91C_US1_CR EQU (0xFFFC4000) ;- (US1) Control Register +AT91C_US1_MR EQU (0xFFFC4004) ;- (US1) Mode Register +// - ========== Register definition for PDC_US0 peripheral ========== +AT91C_US0_TNPR EQU (0xFFFC0118) ;- (PDC_US0) Transmit Next Pointer Register +AT91C_US0_RNPR EQU (0xFFFC0110) ;- (PDC_US0) Receive Next Pointer Register +AT91C_US0_TCR EQU (0xFFFC010C) ;- (PDC_US0) Transmit Counter Register +AT91C_US0_PTCR EQU (0xFFFC0120) ;- (PDC_US0) PDC Transfer Control Register +AT91C_US0_PTSR EQU (0xFFFC0124) ;- (PDC_US0) PDC Transfer Status Register +AT91C_US0_TNCR EQU (0xFFFC011C) ;- (PDC_US0) Transmit Next Counter Register +AT91C_US0_TPR EQU (0xFFFC0108) ;- (PDC_US0) Transmit Pointer Register +AT91C_US0_RCR EQU (0xFFFC0104) ;- (PDC_US0) Receive Counter Register +AT91C_US0_RPR EQU (0xFFFC0100) ;- (PDC_US0) Receive Pointer Register +AT91C_US0_RNCR EQU (0xFFFC0114) ;- (PDC_US0) Receive Next Counter Register +// - ========== Register definition for US0 peripheral ========== +AT91C_US0_BRGR EQU (0xFFFC0020) ;- (US0) Baud Rate Generator Register +AT91C_US0_NER EQU (0xFFFC0044) ;- (US0) Nb Errors Register +AT91C_US0_CR EQU (0xFFFC0000) ;- (US0) Control Register +AT91C_US0_IMR EQU (0xFFFC0010) ;- (US0) Interrupt Mask Register +AT91C_US0_FIDI EQU (0xFFFC0040) ;- (US0) FI_DI_Ratio Register +AT91C_US0_TTGR EQU (0xFFFC0028) ;- (US0) Transmitter Time-guard Register +AT91C_US0_MR EQU (0xFFFC0004) ;- (US0) Mode Register +AT91C_US0_RTOR EQU (0xFFFC0024) ;- (US0) Receiver Time-out Register +AT91C_US0_CSR EQU (0xFFFC0014) ;- (US0) Channel Status Register +AT91C_US0_RHR EQU (0xFFFC0018) ;- (US0) Receiver Holding Register +AT91C_US0_IDR EQU (0xFFFC000C) ;- (US0) Interrupt Disable Register +AT91C_US0_THR EQU (0xFFFC001C) ;- (US0) Transmitter Holding Register +AT91C_US0_IF EQU (0xFFFC004C) ;- (US0) IRDA_FILTER Register +AT91C_US0_IER EQU (0xFFFC0008) ;- (US0) Interrupt Enable Register +// - ========== Register definition for PDC_SSC peripheral ========== +AT91C_SSC_TNCR EQU (0xFFFD411C) ;- (PDC_SSC) Transmit Next Counter Register +AT91C_SSC_RPR EQU (0xFFFD4100) ;- (PDC_SSC) Receive Pointer Register +AT91C_SSC_RNCR EQU (0xFFFD4114) ;- (PDC_SSC) Receive Next Counter Register +AT91C_SSC_TPR EQU (0xFFFD4108) ;- (PDC_SSC) Transmit Pointer Register +AT91C_SSC_PTCR EQU (0xFFFD4120) ;- (PDC_SSC) PDC Transfer Control Register +AT91C_SSC_TCR EQU (0xFFFD410C) ;- (PDC_SSC) Transmit Counter Register +AT91C_SSC_RCR EQU (0xFFFD4104) ;- (PDC_SSC) Receive Counter Register +AT91C_SSC_RNPR EQU (0xFFFD4110) ;- (PDC_SSC) Receive Next Pointer Register +AT91C_SSC_TNPR EQU (0xFFFD4118) ;- (PDC_SSC) Transmit Next Pointer Register +AT91C_SSC_PTSR EQU (0xFFFD4124) ;- (PDC_SSC) PDC Transfer Status Register +// - ========== Register definition for SSC peripheral ========== +AT91C_SSC_RHR EQU (0xFFFD4020) ;- (SSC) Receive Holding Register +AT91C_SSC_RSHR EQU (0xFFFD4030) ;- (SSC) Receive Sync Holding Register +AT91C_SSC_TFMR EQU (0xFFFD401C) ;- (SSC) Transmit Frame Mode Register +AT91C_SSC_IDR EQU (0xFFFD4048) ;- (SSC) Interrupt Disable Register +AT91C_SSC_THR EQU (0xFFFD4024) ;- (SSC) Transmit Holding Register +AT91C_SSC_RCMR EQU (0xFFFD4010) ;- (SSC) Receive Clock ModeRegister +AT91C_SSC_IER EQU (0xFFFD4044) ;- (SSC) Interrupt Enable Register +AT91C_SSC_TSHR EQU (0xFFFD4034) ;- (SSC) Transmit Sync Holding Register +AT91C_SSC_SR EQU (0xFFFD4040) ;- (SSC) Status Register +AT91C_SSC_CMR EQU (0xFFFD4004) ;- (SSC) Clock Mode Register +AT91C_SSC_TCMR EQU (0xFFFD4018) ;- (SSC) Transmit Clock Mode Register +AT91C_SSC_CR EQU (0xFFFD4000) ;- (SSC) Control Register +AT91C_SSC_IMR EQU (0xFFFD404C) ;- (SSC) Interrupt Mask Register +AT91C_SSC_RFMR EQU (0xFFFD4014) ;- (SSC) Receive Frame Mode Register +// - ========== Register definition for TWI peripheral ========== +AT91C_TWI_IER EQU (0xFFFB8024) ;- (TWI) Interrupt Enable Register +AT91C_TWI_CR EQU (0xFFFB8000) ;- (TWI) Control Register +AT91C_TWI_SR EQU (0xFFFB8020) ;- (TWI) Status Register +AT91C_TWI_IMR EQU (0xFFFB802C) ;- (TWI) Interrupt Mask Register +AT91C_TWI_THR EQU (0xFFFB8034) ;- (TWI) Transmit Holding Register +AT91C_TWI_IDR EQU (0xFFFB8028) ;- (TWI) Interrupt Disable Register +AT91C_TWI_IADR EQU (0xFFFB800C) ;- (TWI) Internal Address Register +AT91C_TWI_MMR EQU (0xFFFB8004) ;- (TWI) Master Mode Register +AT91C_TWI_CWGR EQU (0xFFFB8010) ;- (TWI) Clock Waveform Generator Register +AT91C_TWI_RHR EQU (0xFFFB8030) ;- (TWI) Receive Holding Register +// - ========== Register definition for PWMC_CH3 peripheral ========== +AT91C_PWMC_CH3_CUPDR EQU (0xFFFCC270) ;- (PWMC_CH3) Channel Update Register +AT91C_PWMC_CH3_Reserved EQU (0xFFFCC274) ;- (PWMC_CH3) Reserved +AT91C_PWMC_CH3_CPRDR EQU (0xFFFCC268) ;- (PWMC_CH3) Channel Period Register +AT91C_PWMC_CH3_CDTYR EQU (0xFFFCC264) ;- (PWMC_CH3) Channel Duty Cycle Register +AT91C_PWMC_CH3_CCNTR EQU (0xFFFCC26C) ;- (PWMC_CH3) Channel Counter Register +AT91C_PWMC_CH3_CMR EQU (0xFFFCC260) ;- (PWMC_CH3) Channel Mode Register +// - ========== Register definition for PWMC_CH2 peripheral ========== +AT91C_PWMC_CH2_Reserved EQU (0xFFFCC254) ;- (PWMC_CH2) Reserved +AT91C_PWMC_CH2_CMR EQU (0xFFFCC240) ;- (PWMC_CH2) Channel Mode Register +AT91C_PWMC_CH2_CCNTR EQU (0xFFFCC24C) ;- (PWMC_CH2) Channel Counter Register +AT91C_PWMC_CH2_CPRDR EQU (0xFFFCC248) ;- (PWMC_CH2) Channel Period Register +AT91C_PWMC_CH2_CUPDR EQU (0xFFFCC250) ;- (PWMC_CH2) Channel Update Register +AT91C_PWMC_CH2_CDTYR EQU (0xFFFCC244) ;- (PWMC_CH2) Channel Duty Cycle Register +// - ========== Register definition for PWMC_CH1 peripheral ========== +AT91C_PWMC_CH1_Reserved EQU (0xFFFCC234) ;- (PWMC_CH1) Reserved +AT91C_PWMC_CH1_CUPDR EQU (0xFFFCC230) ;- (PWMC_CH1) Channel Update Register +AT91C_PWMC_CH1_CPRDR EQU (0xFFFCC228) ;- (PWMC_CH1) Channel Period Register +AT91C_PWMC_CH1_CCNTR EQU (0xFFFCC22C) ;- (PWMC_CH1) Channel Counter Register +AT91C_PWMC_CH1_CDTYR EQU (0xFFFCC224) ;- (PWMC_CH1) Channel Duty Cycle Register +AT91C_PWMC_CH1_CMR EQU (0xFFFCC220) ;- (PWMC_CH1) Channel Mode Register +// - ========== Register definition for PWMC_CH0 peripheral ========== +AT91C_PWMC_CH0_Reserved EQU (0xFFFCC214) ;- (PWMC_CH0) Reserved +AT91C_PWMC_CH0_CPRDR EQU (0xFFFCC208) ;- (PWMC_CH0) Channel Period Register +AT91C_PWMC_CH0_CDTYR EQU (0xFFFCC204) ;- (PWMC_CH0) Channel Duty Cycle Register +AT91C_PWMC_CH0_CMR EQU (0xFFFCC200) ;- (PWMC_CH0) Channel Mode Register +AT91C_PWMC_CH0_CUPDR EQU (0xFFFCC210) ;- (PWMC_CH0) Channel Update Register +AT91C_PWMC_CH0_CCNTR EQU (0xFFFCC20C) ;- (PWMC_CH0) Channel Counter Register +// - ========== Register definition for PWMC peripheral ========== +AT91C_PWMC_IDR EQU (0xFFFCC014) ;- (PWMC) PWMC Interrupt Disable Register +AT91C_PWMC_DIS EQU (0xFFFCC008) ;- (PWMC) PWMC Disable Register +AT91C_PWMC_IER EQU (0xFFFCC010) ;- (PWMC) PWMC Interrupt Enable Register +AT91C_PWMC_VR EQU (0xFFFCC0FC) ;- (PWMC) PWMC Version Register +AT91C_PWMC_ISR EQU (0xFFFCC01C) ;- (PWMC) PWMC Interrupt Status Register +AT91C_PWMC_SR EQU (0xFFFCC00C) ;- (PWMC) PWMC Status Register +AT91C_PWMC_IMR EQU (0xFFFCC018) ;- (PWMC) PWMC Interrupt Mask Register +AT91C_PWMC_MR EQU (0xFFFCC000) ;- (PWMC) PWMC Mode Register +AT91C_PWMC_ENA EQU (0xFFFCC004) ;- (PWMC) PWMC Enable Register +// - ========== Register definition for UDP peripheral ========== +AT91C_UDP_IMR EQU (0xFFFB0018) ;- (UDP) Interrupt Mask Register +AT91C_UDP_FADDR EQU (0xFFFB0008) ;- (UDP) Function Address Register +AT91C_UDP_NUM EQU (0xFFFB0000) ;- (UDP) Frame Number Register +AT91C_UDP_FDR EQU (0xFFFB0050) ;- (UDP) Endpoint FIFO Data Register +AT91C_UDP_ISR EQU (0xFFFB001C) ;- (UDP) Interrupt Status Register +AT91C_UDP_CSR EQU (0xFFFB0030) ;- (UDP) Endpoint Control and Status Register +AT91C_UDP_IDR EQU (0xFFFB0014) ;- (UDP) Interrupt Disable Register +AT91C_UDP_ICR EQU (0xFFFB0020) ;- (UDP) Interrupt Clear Register +AT91C_UDP_RSTEP EQU (0xFFFB0028) ;- (UDP) Reset Endpoint Register +AT91C_UDP_TXVC EQU (0xFFFB0074) ;- (UDP) Transceiver Control Register +AT91C_UDP_GLBSTATE EQU (0xFFFB0004) ;- (UDP) Global State Register +AT91C_UDP_IER EQU (0xFFFB0010) ;- (UDP) Interrupt Enable Register +// - ========== Register definition for TC0 peripheral ========== +AT91C_TC0_SR EQU (0xFFFA0020) ;- (TC0) Status Register +AT91C_TC0_RC EQU (0xFFFA001C) ;- (TC0) Register C +AT91C_TC0_RB EQU (0xFFFA0018) ;- (TC0) Register B +AT91C_TC0_CCR EQU (0xFFFA0000) ;- (TC0) Channel Control Register +AT91C_TC0_CMR EQU (0xFFFA0004) ;- (TC0) Channel Mode Register (Capture Mode / Waveform Mode) +AT91C_TC0_IER EQU (0xFFFA0024) ;- (TC0) Interrupt Enable Register +AT91C_TC0_RA EQU (0xFFFA0014) ;- (TC0) Register A +AT91C_TC0_IDR EQU (0xFFFA0028) ;- (TC0) Interrupt Disable Register +AT91C_TC0_CV EQU (0xFFFA0010) ;- (TC0) Counter Value +AT91C_TC0_IMR EQU (0xFFFA002C) ;- (TC0) Interrupt Mask Register +// - ========== Register definition for TC1 peripheral ========== +AT91C_TC1_RB EQU (0xFFFA0058) ;- (TC1) Register B +AT91C_TC1_CCR EQU (0xFFFA0040) ;- (TC1) Channel Control Register +AT91C_TC1_IER EQU (0xFFFA0064) ;- (TC1) Interrupt Enable Register +AT91C_TC1_IDR EQU (0xFFFA0068) ;- (TC1) Interrupt Disable Register +AT91C_TC1_SR EQU (0xFFFA0060) ;- (TC1) Status Register +AT91C_TC1_CMR EQU (0xFFFA0044) ;- (TC1) Channel Mode Register (Capture Mode / Waveform Mode) +AT91C_TC1_RA EQU (0xFFFA0054) ;- (TC1) Register A +AT91C_TC1_RC EQU (0xFFFA005C) ;- (TC1) Register C +AT91C_TC1_IMR EQU (0xFFFA006C) ;- (TC1) Interrupt Mask Register +AT91C_TC1_CV EQU (0xFFFA0050) ;- (TC1) Counter Value +// - ========== Register definition for TC2 peripheral ========== +AT91C_TC2_CMR EQU (0xFFFA0084) ;- (TC2) Channel Mode Register (Capture Mode / Waveform Mode) +AT91C_TC2_CCR EQU (0xFFFA0080) ;- (TC2) Channel Control Register +AT91C_TC2_CV EQU (0xFFFA0090) ;- (TC2) Counter Value +AT91C_TC2_RA EQU (0xFFFA0094) ;- (TC2) Register A +AT91C_TC2_RB EQU (0xFFFA0098) ;- (TC2) Register B +AT91C_TC2_IDR EQU (0xFFFA00A8) ;- (TC2) Interrupt Disable Register +AT91C_TC2_IMR EQU (0xFFFA00AC) ;- (TC2) Interrupt Mask Register +AT91C_TC2_RC EQU (0xFFFA009C) ;- (TC2) Register C +AT91C_TC2_IER EQU (0xFFFA00A4) ;- (TC2) Interrupt Enable Register +AT91C_TC2_SR EQU (0xFFFA00A0) ;- (TC2) Status Register +// - ========== Register definition for TCB peripheral ========== +AT91C_TCB_BMR EQU (0xFFFA00C4) ;- (TCB) TC Block Mode Register +AT91C_TCB_BCR EQU (0xFFFA00C0) ;- (TCB) TC Block Control Register +// - ========== Register definition for CAN_MB0 peripheral ========== +AT91C_CAN_MB0_MDL EQU (0xFFFD0214) ;- (CAN_MB0) MailBox Data Low Register +AT91C_CAN_MB0_MAM EQU (0xFFFD0204) ;- (CAN_MB0) MailBox Acceptance Mask Register +AT91C_CAN_MB0_MCR EQU (0xFFFD021C) ;- (CAN_MB0) MailBox Control Register +AT91C_CAN_MB0_MID EQU (0xFFFD0208) ;- (CAN_MB0) MailBox ID Register +AT91C_CAN_MB0_MSR EQU (0xFFFD0210) ;- (CAN_MB0) MailBox Status Register +AT91C_CAN_MB0_MFID EQU (0xFFFD020C) ;- (CAN_MB0) MailBox Family ID Register +AT91C_CAN_MB0_MDH EQU (0xFFFD0218) ;- (CAN_MB0) MailBox Data High Register +AT91C_CAN_MB0_MMR EQU (0xFFFD0200) ;- (CAN_MB0) MailBox Mode Register +// - ========== Register definition for CAN_MB1 peripheral ========== +AT91C_CAN_MB1_MDL EQU (0xFFFD0234) ;- (CAN_MB1) MailBox Data Low Register +AT91C_CAN_MB1_MID EQU (0xFFFD0228) ;- (CAN_MB1) MailBox ID Register +AT91C_CAN_MB1_MMR EQU (0xFFFD0220) ;- (CAN_MB1) MailBox Mode Register +AT91C_CAN_MB1_MSR EQU (0xFFFD0230) ;- (CAN_MB1) MailBox Status Register +AT91C_CAN_MB1_MAM EQU (0xFFFD0224) ;- (CAN_MB1) MailBox Acceptance Mask Register +AT91C_CAN_MB1_MDH EQU (0xFFFD0238) ;- (CAN_MB1) MailBox Data High Register +AT91C_CAN_MB1_MCR EQU (0xFFFD023C) ;- (CAN_MB1) MailBox Control Register +AT91C_CAN_MB1_MFID EQU (0xFFFD022C) ;- (CAN_MB1) MailBox Family ID Register +// - ========== Register definition for CAN_MB2 peripheral ========== +AT91C_CAN_MB2_MCR EQU (0xFFFD025C) ;- (CAN_MB2) MailBox Control Register +AT91C_CAN_MB2_MDH EQU (0xFFFD0258) ;- (CAN_MB2) MailBox Data High Register +AT91C_CAN_MB2_MID EQU (0xFFFD0248) ;- (CAN_MB2) MailBox ID Register +AT91C_CAN_MB2_MDL EQU (0xFFFD0254) ;- (CAN_MB2) MailBox Data Low Register +AT91C_CAN_MB2_MMR EQU (0xFFFD0240) ;- (CAN_MB2) MailBox Mode Register +AT91C_CAN_MB2_MAM EQU (0xFFFD0244) ;- (CAN_MB2) MailBox Acceptance Mask Register +AT91C_CAN_MB2_MFID EQU (0xFFFD024C) ;- (CAN_MB2) MailBox Family ID Register +AT91C_CAN_MB2_MSR EQU (0xFFFD0250) ;- (CAN_MB2) MailBox Status Register +// - ========== Register definition for CAN_MB3 peripheral ========== +AT91C_CAN_MB3_MFID EQU (0xFFFD026C) ;- (CAN_MB3) MailBox Family ID Register +AT91C_CAN_MB3_MAM EQU (0xFFFD0264) ;- (CAN_MB3) MailBox Acceptance Mask Register +AT91C_CAN_MB3_MID EQU (0xFFFD0268) ;- (CAN_MB3) MailBox ID Register +AT91C_CAN_MB3_MCR EQU (0xFFFD027C) ;- (CAN_MB3) MailBox Control Register +AT91C_CAN_MB3_MMR EQU (0xFFFD0260) ;- (CAN_MB3) MailBox Mode Register +AT91C_CAN_MB3_MSR EQU (0xFFFD0270) ;- (CAN_MB3) MailBox Status Register +AT91C_CAN_MB3_MDL EQU (0xFFFD0274) ;- (CAN_MB3) MailBox Data Low Register +AT91C_CAN_MB3_MDH EQU (0xFFFD0278) ;- (CAN_MB3) MailBox Data High Register +// - ========== Register definition for CAN_MB4 peripheral ========== +AT91C_CAN_MB4_MID EQU (0xFFFD0288) ;- (CAN_MB4) MailBox ID Register +AT91C_CAN_MB4_MMR EQU (0xFFFD0280) ;- (CAN_MB4) MailBox Mode Register +AT91C_CAN_MB4_MDH EQU (0xFFFD0298) ;- (CAN_MB4) MailBox Data High Register +AT91C_CAN_MB4_MFID EQU (0xFFFD028C) ;- (CAN_MB4) MailBox Family ID Register +AT91C_CAN_MB4_MSR EQU (0xFFFD0290) ;- (CAN_MB4) MailBox Status Register +AT91C_CAN_MB4_MCR EQU (0xFFFD029C) ;- (CAN_MB4) MailBox Control Register +AT91C_CAN_MB4_MDL EQU (0xFFFD0294) ;- (CAN_MB4) MailBox Data Low Register +AT91C_CAN_MB4_MAM EQU (0xFFFD0284) ;- (CAN_MB4) MailBox Acceptance Mask Register +// - ========== Register definition for CAN_MB5 peripheral ========== +AT91C_CAN_MB5_MSR EQU (0xFFFD02B0) ;- (CAN_MB5) MailBox Status Register +AT91C_CAN_MB5_MCR EQU (0xFFFD02BC) ;- (CAN_MB5) MailBox Control Register +AT91C_CAN_MB5_MFID EQU (0xFFFD02AC) ;- (CAN_MB5) MailBox Family ID Register +AT91C_CAN_MB5_MDH EQU (0xFFFD02B8) ;- (CAN_MB5) MailBox Data High Register +AT91C_CAN_MB5_MID EQU (0xFFFD02A8) ;- (CAN_MB5) MailBox ID Register +AT91C_CAN_MB5_MMR EQU (0xFFFD02A0) ;- (CAN_MB5) MailBox Mode Register +AT91C_CAN_MB5_MDL EQU (0xFFFD02B4) ;- (CAN_MB5) MailBox Data Low Register +AT91C_CAN_MB5_MAM EQU (0xFFFD02A4) ;- (CAN_MB5) MailBox Acceptance Mask Register +// - ========== Register definition for CAN_MB6 peripheral ========== +AT91C_CAN_MB6_MFID EQU (0xFFFD02CC) ;- (CAN_MB6) MailBox Family ID Register +AT91C_CAN_MB6_MID EQU (0xFFFD02C8) ;- (CAN_MB6) MailBox ID Register +AT91C_CAN_MB6_MAM EQU (0xFFFD02C4) ;- (CAN_MB6) MailBox Acceptance Mask Register +AT91C_CAN_MB6_MSR EQU (0xFFFD02D0) ;- (CAN_MB6) MailBox Status Register +AT91C_CAN_MB6_MDL EQU (0xFFFD02D4) ;- (CAN_MB6) MailBox Data Low Register +AT91C_CAN_MB6_MCR EQU (0xFFFD02DC) ;- (CAN_MB6) MailBox Control Register +AT91C_CAN_MB6_MDH EQU (0xFFFD02D8) ;- (CAN_MB6) MailBox Data High Register +AT91C_CAN_MB6_MMR EQU (0xFFFD02C0) ;- (CAN_MB6) MailBox Mode Register +// - ========== Register definition for CAN_MB7 peripheral ========== +AT91C_CAN_MB7_MCR EQU (0xFFFD02FC) ;- (CAN_MB7) MailBox Control Register +AT91C_CAN_MB7_MDH EQU (0xFFFD02F8) ;- (CAN_MB7) MailBox Data High Register +AT91C_CAN_MB7_MFID EQU (0xFFFD02EC) ;- (CAN_MB7) MailBox Family ID Register +AT91C_CAN_MB7_MDL EQU (0xFFFD02F4) ;- (CAN_MB7) MailBox Data Low Register +AT91C_CAN_MB7_MID EQU (0xFFFD02E8) ;- (CAN_MB7) MailBox ID Register +AT91C_CAN_MB7_MMR EQU (0xFFFD02E0) ;- (CAN_MB7) MailBox Mode Register +AT91C_CAN_MB7_MAM EQU (0xFFFD02E4) ;- (CAN_MB7) MailBox Acceptance Mask Register +AT91C_CAN_MB7_MSR EQU (0xFFFD02F0) ;- (CAN_MB7) MailBox Status Register +// - ========== Register definition for CAN peripheral ========== +AT91C_CAN_TCR EQU (0xFFFD0024) ;- (CAN) Transfer Command Register +AT91C_CAN_IMR EQU (0xFFFD000C) ;- (CAN) Interrupt Mask Register +AT91C_CAN_IER EQU (0xFFFD0004) ;- (CAN) Interrupt Enable Register +AT91C_CAN_ECR EQU (0xFFFD0020) ;- (CAN) Error Counter Register +AT91C_CAN_TIMESTP EQU (0xFFFD001C) ;- (CAN) Time Stamp Register +AT91C_CAN_MR EQU (0xFFFD0000) ;- (CAN) Mode Register +AT91C_CAN_IDR EQU (0xFFFD0008) ;- (CAN) Interrupt Disable Register +AT91C_CAN_ACR EQU (0xFFFD0028) ;- (CAN) Abort Command Register +AT91C_CAN_TIM EQU (0xFFFD0018) ;- (CAN) Timer Register +AT91C_CAN_SR EQU (0xFFFD0010) ;- (CAN) Status Register +AT91C_CAN_BR EQU (0xFFFD0014) ;- (CAN) Baudrate Register +AT91C_CAN_VR EQU (0xFFFD00FC) ;- (CAN) Version Register +// - ========== Register definition for EMAC peripheral ========== +AT91C_EMAC_ISR EQU (0xFFFDC024) ;- (EMAC) Interrupt Status Register +AT91C_EMAC_SA4H EQU (0xFFFDC0B4) ;- (EMAC) Specific Address 4 Top, Last 2 bytes +AT91C_EMAC_SA1L EQU (0xFFFDC098) ;- (EMAC) Specific Address 1 Bottom, First 4 bytes +AT91C_EMAC_ELE EQU (0xFFFDC078) ;- (EMAC) Excessive Length Errors Register +AT91C_EMAC_LCOL EQU (0xFFFDC05C) ;- (EMAC) Late Collision Register +AT91C_EMAC_RLE EQU (0xFFFDC088) ;- (EMAC) Receive Length Field Mismatch Register +AT91C_EMAC_WOL EQU (0xFFFDC0C4) ;- (EMAC) Wake On LAN Register +AT91C_EMAC_DTF EQU (0xFFFDC058) ;- (EMAC) Deferred Transmission Frame Register +AT91C_EMAC_TUND EQU (0xFFFDC064) ;- (EMAC) Transmit Underrun Error Register +AT91C_EMAC_NCR EQU (0xFFFDC000) ;- (EMAC) Network Control Register +AT91C_EMAC_SA4L EQU (0xFFFDC0B0) ;- (EMAC) Specific Address 4 Bottom, First 4 bytes +AT91C_EMAC_RSR EQU (0xFFFDC020) ;- (EMAC) Receive Status Register +AT91C_EMAC_SA3L EQU (0xFFFDC0A8) ;- (EMAC) Specific Address 3 Bottom, First 4 bytes +AT91C_EMAC_TSR EQU (0xFFFDC014) ;- (EMAC) Transmit Status Register +AT91C_EMAC_IDR EQU (0xFFFDC02C) ;- (EMAC) Interrupt Disable Register +AT91C_EMAC_RSE EQU (0xFFFDC074) ;- (EMAC) Receive Symbol Errors Register +AT91C_EMAC_ECOL EQU (0xFFFDC060) ;- (EMAC) Excessive Collision Register +AT91C_EMAC_TID EQU (0xFFFDC0B8) ;- (EMAC) Type ID Checking Register +AT91C_EMAC_HRB EQU (0xFFFDC090) ;- (EMAC) Hash Address Bottom[31:0] +AT91C_EMAC_TBQP EQU (0xFFFDC01C) ;- (EMAC) Transmit Buffer Queue Pointer +AT91C_EMAC_USRIO EQU (0xFFFDC0C0) ;- (EMAC) USER Input/Output Register +AT91C_EMAC_PTR EQU (0xFFFDC038) ;- (EMAC) Pause Time Register +AT91C_EMAC_SA2H EQU (0xFFFDC0A4) ;- (EMAC) Specific Address 2 Top, Last 2 bytes +AT91C_EMAC_ROV EQU (0xFFFDC070) ;- (EMAC) Receive Overrun Errors Register +AT91C_EMAC_ALE EQU (0xFFFDC054) ;- (EMAC) Alignment Error Register +AT91C_EMAC_RJA EQU (0xFFFDC07C) ;- (EMAC) Receive Jabbers Register +AT91C_EMAC_RBQP EQU (0xFFFDC018) ;- (EMAC) Receive Buffer Queue Pointer +AT91C_EMAC_TPF EQU (0xFFFDC08C) ;- (EMAC) Transmitted Pause Frames Register +AT91C_EMAC_NCFGR EQU (0xFFFDC004) ;- (EMAC) Network Configuration Register +AT91C_EMAC_HRT EQU (0xFFFDC094) ;- (EMAC) Hash Address Top[63:32] +AT91C_EMAC_USF EQU (0xFFFDC080) ;- (EMAC) Undersize Frames Register +AT91C_EMAC_FCSE EQU (0xFFFDC050) ;- (EMAC) Frame Check Sequence Error Register +AT91C_EMAC_TPQ EQU (0xFFFDC0BC) ;- (EMAC) Transmit Pause Quantum Register +AT91C_EMAC_MAN EQU (0xFFFDC034) ;- (EMAC) PHY Maintenance Register +AT91C_EMAC_FTO EQU (0xFFFDC040) ;- (EMAC) Frames Transmitted OK Register +AT91C_EMAC_REV EQU (0xFFFDC0FC) ;- (EMAC) Revision Register +AT91C_EMAC_IMR EQU (0xFFFDC030) ;- (EMAC) Interrupt Mask Register +AT91C_EMAC_SCF EQU (0xFFFDC044) ;- (EMAC) Single Collision Frame Register +AT91C_EMAC_PFR EQU (0xFFFDC03C) ;- (EMAC) Pause Frames received Register +AT91C_EMAC_MCF EQU (0xFFFDC048) ;- (EMAC) Multiple Collision Frame Register +AT91C_EMAC_NSR EQU (0xFFFDC008) ;- (EMAC) Network Status Register +AT91C_EMAC_SA2L EQU (0xFFFDC0A0) ;- (EMAC) Specific Address 2 Bottom, First 4 bytes +AT91C_EMAC_FRO EQU (0xFFFDC04C) ;- (EMAC) Frames Received OK Register +AT91C_EMAC_IER EQU (0xFFFDC028) ;- (EMAC) Interrupt Enable Register +AT91C_EMAC_SA1H EQU (0xFFFDC09C) ;- (EMAC) Specific Address 1 Top, Last 2 bytes +AT91C_EMAC_CSE EQU (0xFFFDC068) ;- (EMAC) Carrier Sense Error Register +AT91C_EMAC_SA3H EQU (0xFFFDC0AC) ;- (EMAC) Specific Address 3 Top, Last 2 bytes +AT91C_EMAC_RRE EQU (0xFFFDC06C) ;- (EMAC) Receive Ressource Error Register +AT91C_EMAC_STE EQU (0xFFFDC084) ;- (EMAC) SQE Test Error Register +// - ========== Register definition for PDC_ADC peripheral ========== +AT91C_ADC_PTSR EQU (0xFFFD8124) ;- (PDC_ADC) PDC Transfer Status Register +AT91C_ADC_PTCR EQU (0xFFFD8120) ;- (PDC_ADC) PDC Transfer Control Register +AT91C_ADC_TNPR EQU (0xFFFD8118) ;- (PDC_ADC) Transmit Next Pointer Register +AT91C_ADC_TNCR EQU (0xFFFD811C) ;- (PDC_ADC) Transmit Next Counter Register +AT91C_ADC_RNPR EQU (0xFFFD8110) ;- (PDC_ADC) Receive Next Pointer Register +AT91C_ADC_RNCR EQU (0xFFFD8114) ;- (PDC_ADC) Receive Next Counter Register +AT91C_ADC_RPR EQU (0xFFFD8100) ;- (PDC_ADC) Receive Pointer Register +AT91C_ADC_TCR EQU (0xFFFD810C) ;- (PDC_ADC) Transmit Counter Register +AT91C_ADC_TPR EQU (0xFFFD8108) ;- (PDC_ADC) Transmit Pointer Register +AT91C_ADC_RCR EQU (0xFFFD8104) ;- (PDC_ADC) Receive Counter Register +// - ========== Register definition for ADC peripheral ========== +AT91C_ADC_CDR2 EQU (0xFFFD8038) ;- (ADC) ADC Channel Data Register 2 +AT91C_ADC_CDR3 EQU (0xFFFD803C) ;- (ADC) ADC Channel Data Register 3 +AT91C_ADC_CDR0 EQU (0xFFFD8030) ;- (ADC) ADC Channel Data Register 0 +AT91C_ADC_CDR5 EQU (0xFFFD8044) ;- (ADC) ADC Channel Data Register 5 +AT91C_ADC_CHDR EQU (0xFFFD8014) ;- (ADC) ADC Channel Disable Register +AT91C_ADC_SR EQU (0xFFFD801C) ;- (ADC) ADC Status Register +AT91C_ADC_CDR4 EQU (0xFFFD8040) ;- (ADC) ADC Channel Data Register 4 +AT91C_ADC_CDR1 EQU (0xFFFD8034) ;- (ADC) ADC Channel Data Register 1 +AT91C_ADC_LCDR EQU (0xFFFD8020) ;- (ADC) ADC Last Converted Data Register +AT91C_ADC_IDR EQU (0xFFFD8028) ;- (ADC) ADC Interrupt Disable Register +AT91C_ADC_CR EQU (0xFFFD8000) ;- (ADC) ADC Control Register +AT91C_ADC_CDR7 EQU (0xFFFD804C) ;- (ADC) ADC Channel Data Register 7 +AT91C_ADC_CDR6 EQU (0xFFFD8048) ;- (ADC) ADC Channel Data Register 6 +AT91C_ADC_IER EQU (0xFFFD8024) ;- (ADC) ADC Interrupt Enable Register +AT91C_ADC_CHER EQU (0xFFFD8010) ;- (ADC) ADC Channel Enable Register +AT91C_ADC_CHSR EQU (0xFFFD8018) ;- (ADC) ADC Channel Status Register +AT91C_ADC_MR EQU (0xFFFD8004) ;- (ADC) ADC Mode Register +AT91C_ADC_IMR EQU (0xFFFD802C) ;- (ADC) ADC Interrupt Mask Register + +// - ***************************************************************************** +// - PIO DEFINITIONS FOR AT91SAM7X256 +// - ***************************************************************************** +AT91C_PIO_PA0 EQU (1 << 0) ;- Pin Controlled by PA0 +AT91C_PA0_RXD0 EQU (AT91C_PIO_PA0) ;- USART 0 Receive Data +AT91C_PIO_PA1 EQU (1 << 1) ;- Pin Controlled by PA1 +AT91C_PA1_TXD0 EQU (AT91C_PIO_PA1) ;- USART 0 Transmit Data +AT91C_PIO_PA10 EQU (1 << 10) ;- Pin Controlled by PA10 +AT91C_PA10_TWD EQU (AT91C_PIO_PA10) ;- TWI Two-wire Serial Data +AT91C_PIO_PA11 EQU (1 << 11) ;- Pin Controlled by PA11 +AT91C_PA11_TWCK EQU (AT91C_PIO_PA11) ;- TWI Two-wire Serial Clock +AT91C_PIO_PA12 EQU (1 << 12) ;- Pin Controlled by PA12 +AT91C_PA12_SPI0_NPCS0 EQU (AT91C_PIO_PA12) ;- SPI 0 Peripheral Chip Select 0 +AT91C_PIO_PA13 EQU (1 << 13) ;- Pin Controlled by PA13 +AT91C_PA13_SPI0_NPCS1 EQU (AT91C_PIO_PA13) ;- SPI 0 Peripheral Chip Select 1 +AT91C_PA13_PCK1 EQU (AT91C_PIO_PA13) ;- PMC Programmable Clock Output 1 +AT91C_PIO_PA14 EQU (1 << 14) ;- Pin Controlled by PA14 +AT91C_PA14_SPI0_NPCS2 EQU (AT91C_PIO_PA14) ;- SPI 0 Peripheral Chip Select 2 +AT91C_PA14_IRQ1 EQU (AT91C_PIO_PA14) ;- External Interrupt 1 +AT91C_PIO_PA15 EQU (1 << 15) ;- Pin Controlled by PA15 +AT91C_PA15_SPI0_NPCS3 EQU (AT91C_PIO_PA15) ;- SPI 0 Peripheral Chip Select 3 +AT91C_PA15_TCLK2 EQU (AT91C_PIO_PA15) ;- Timer Counter 2 external clock input +AT91C_PIO_PA16 EQU (1 << 16) ;- Pin Controlled by PA16 +AT91C_PA16_SPI0_MISO EQU (AT91C_PIO_PA16) ;- SPI 0 Master In Slave +AT91C_PIO_PA17 EQU (1 << 17) ;- Pin Controlled by PA17 +AT91C_PA17_SPI0_MOSI EQU (AT91C_PIO_PA17) ;- SPI 0 Master Out Slave +AT91C_PIO_PA18 EQU (1 << 18) ;- Pin Controlled by PA18 +AT91C_PA18_SPI0_SPCK EQU (AT91C_PIO_PA18) ;- SPI 0 Serial Clock +AT91C_PIO_PA19 EQU (1 << 19) ;- Pin Controlled by PA19 +AT91C_PA19_CANRX EQU (AT91C_PIO_PA19) ;- CAN Receive +AT91C_PIO_PA2 EQU (1 << 2) ;- Pin Controlled by PA2 +AT91C_PA2_SCK0 EQU (AT91C_PIO_PA2) ;- USART 0 Serial Clock +AT91C_PA2_SPI1_NPCS1 EQU (AT91C_PIO_PA2) ;- SPI 1 Peripheral Chip Select 1 +AT91C_PIO_PA20 EQU (1 << 20) ;- Pin Controlled by PA20 +AT91C_PA20_CANTX EQU (AT91C_PIO_PA20) ;- CAN Transmit +AT91C_PIO_PA21 EQU (1 << 21) ;- Pin Controlled by PA21 +AT91C_PA21_TF EQU (AT91C_PIO_PA21) ;- SSC Transmit Frame Sync +AT91C_PA21_SPI1_NPCS0 EQU (AT91C_PIO_PA21) ;- SPI 1 Peripheral Chip Select 0 +AT91C_PIO_PA22 EQU (1 << 22) ;- Pin Controlled by PA22 +AT91C_PA22_TK EQU (AT91C_PIO_PA22) ;- SSC Transmit Clock +AT91C_PA22_SPI1_SPCK EQU (AT91C_PIO_PA22) ;- SPI 1 Serial Clock +AT91C_PIO_PA23 EQU (1 << 23) ;- Pin Controlled by PA23 +AT91C_PA23_TD EQU (AT91C_PIO_PA23) ;- SSC Transmit data +AT91C_PA23_SPI1_MOSI EQU (AT91C_PIO_PA23) ;- SPI 1 Master Out Slave +AT91C_PIO_PA24 EQU (1 << 24) ;- Pin Controlled by PA24 +AT91C_PA24_RD EQU (AT91C_PIO_PA24) ;- SSC Receive Data +AT91C_PA24_SPI1_MISO EQU (AT91C_PIO_PA24) ;- SPI 1 Master In Slave +AT91C_PIO_PA25 EQU (1 << 25) ;- Pin Controlled by PA25 +AT91C_PA25_RK EQU (AT91C_PIO_PA25) ;- SSC Receive Clock +AT91C_PA25_SPI1_NPCS1 EQU (AT91C_PIO_PA25) ;- SPI 1 Peripheral Chip Select 1 +AT91C_PIO_PA26 EQU (1 << 26) ;- Pin Controlled by PA26 +AT91C_PA26_RF EQU (AT91C_PIO_PA26) ;- SSC Receive Frame Sync +AT91C_PA26_SPI1_NPCS2 EQU (AT91C_PIO_PA26) ;- SPI 1 Peripheral Chip Select 2 +AT91C_PIO_PA27 EQU (1 << 27) ;- Pin Controlled by PA27 +AT91C_PA27_DRXD EQU (AT91C_PIO_PA27) ;- DBGU Debug Receive Data +AT91C_PA27_PCK3 EQU (AT91C_PIO_PA27) ;- PMC Programmable Clock Output 3 +AT91C_PIO_PA28 EQU (1 << 28) ;- Pin Controlled by PA28 +AT91C_PA28_DTXD EQU (AT91C_PIO_PA28) ;- DBGU Debug Transmit Data +AT91C_PIO_PA29 EQU (1 << 29) ;- Pin Controlled by PA29 +AT91C_PA29_FIQ EQU (AT91C_PIO_PA29) ;- AIC Fast Interrupt Input +AT91C_PA29_SPI1_NPCS3 EQU (AT91C_PIO_PA29) ;- SPI 1 Peripheral Chip Select 3 +AT91C_PIO_PA3 EQU (1 << 3) ;- Pin Controlled by PA3 +AT91C_PA3_RTS0 EQU (AT91C_PIO_PA3) ;- USART 0 Ready To Send +AT91C_PA3_SPI1_NPCS2 EQU (AT91C_PIO_PA3) ;- SPI 1 Peripheral Chip Select 2 +AT91C_PIO_PA30 EQU (1 << 30) ;- Pin Controlled by PA30 +AT91C_PA30_IRQ0 EQU (AT91C_PIO_PA30) ;- External Interrupt 0 +AT91C_PA30_PCK2 EQU (AT91C_PIO_PA30) ;- PMC Programmable Clock Output 2 +AT91C_PIO_PA4 EQU (1 << 4) ;- Pin Controlled by PA4 +AT91C_PA4_CTS0 EQU (AT91C_PIO_PA4) ;- USART 0 Clear To Send +AT91C_PA4_SPI1_NPCS3 EQU (AT91C_PIO_PA4) ;- SPI 1 Peripheral Chip Select 3 +AT91C_PIO_PA5 EQU (1 << 5) ;- Pin Controlled by PA5 +AT91C_PA5_RXD1 EQU (AT91C_PIO_PA5) ;- USART 1 Receive Data +AT91C_PIO_PA6 EQU (1 << 6) ;- Pin Controlled by PA6 +AT91C_PA6_TXD1 EQU (AT91C_PIO_PA6) ;- USART 1 Transmit Data +AT91C_PIO_PA7 EQU (1 << 7) ;- Pin Controlled by PA7 +AT91C_PA7_SCK1 EQU (AT91C_PIO_PA7) ;- USART 1 Serial Clock +AT91C_PA7_SPI0_NPCS1 EQU (AT91C_PIO_PA7) ;- SPI 0 Peripheral Chip Select 1 +AT91C_PIO_PA8 EQU (1 << 8) ;- Pin Controlled by PA8 +AT91C_PA8_RTS1 EQU (AT91C_PIO_PA8) ;- USART 1 Ready To Send +AT91C_PA8_SPI0_NPCS2 EQU (AT91C_PIO_PA8) ;- SPI 0 Peripheral Chip Select 2 +AT91C_PIO_PA9 EQU (1 << 9) ;- Pin Controlled by PA9 +AT91C_PA9_CTS1 EQU (AT91C_PIO_PA9) ;- USART 1 Clear To Send +AT91C_PA9_SPI0_NPCS3 EQU (AT91C_PIO_PA9) ;- SPI 0 Peripheral Chip Select 3 +AT91C_PIO_PB0 EQU (1 << 0) ;- Pin Controlled by PB0 +AT91C_PB0_ETXCK_EREFCK EQU (AT91C_PIO_PB0) ;- Ethernet MAC Transmit Clock/Reference Clock +AT91C_PB0_PCK0 EQU (AT91C_PIO_PB0) ;- PMC Programmable Clock Output 0 +AT91C_PIO_PB1 EQU (1 << 1) ;- Pin Controlled by PB1 +AT91C_PB1_ETXEN EQU (AT91C_PIO_PB1) ;- Ethernet MAC Transmit Enable +AT91C_PIO_PB10 EQU (1 << 10) ;- Pin Controlled by PB10 +AT91C_PB10_ETX2 EQU (AT91C_PIO_PB10) ;- Ethernet MAC Transmit Data 2 +AT91C_PB10_SPI1_NPCS1 EQU (AT91C_PIO_PB10) ;- SPI 1 Peripheral Chip Select 1 +AT91C_PIO_PB11 EQU (1 << 11) ;- Pin Controlled by PB11 +AT91C_PB11_ETX3 EQU (AT91C_PIO_PB11) ;- Ethernet MAC Transmit Data 3 +AT91C_PB11_SPI1_NPCS2 EQU (AT91C_PIO_PB11) ;- SPI 1 Peripheral Chip Select 2 +AT91C_PIO_PB12 EQU (1 << 12) ;- Pin Controlled by PB12 +AT91C_PB12_ETXER EQU (AT91C_PIO_PB12) ;- Ethernet MAC Transmikt Coding Error +AT91C_PB12_TCLK0 EQU (AT91C_PIO_PB12) ;- Timer Counter 0 external clock input +AT91C_PIO_PB13 EQU (1 << 13) ;- Pin Controlled by PB13 +AT91C_PB13_ERX2 EQU (AT91C_PIO_PB13) ;- Ethernet MAC Receive Data 2 +AT91C_PB13_SPI0_NPCS1 EQU (AT91C_PIO_PB13) ;- SPI 0 Peripheral Chip Select 1 +AT91C_PIO_PB14 EQU (1 << 14) ;- Pin Controlled by PB14 +AT91C_PB14_ERX3 EQU (AT91C_PIO_PB14) ;- Ethernet MAC Receive Data 3 +AT91C_PB14_SPI0_NPCS2 EQU (AT91C_PIO_PB14) ;- SPI 0 Peripheral Chip Select 2 +AT91C_PIO_PB15 EQU (1 << 15) ;- Pin Controlled by PB15 +AT91C_PB15_ERXDV_ECRSDV EQU (AT91C_PIO_PB15) ;- Ethernet MAC Receive Data Valid +AT91C_PIO_PB16 EQU (1 << 16) ;- Pin Controlled by PB16 +AT91C_PB16_ECOL EQU (AT91C_PIO_PB16) ;- Ethernet MAC Collision Detected +AT91C_PB16_SPI1_NPCS3 EQU (AT91C_PIO_PB16) ;- SPI 1 Peripheral Chip Select 3 +AT91C_PIO_PB17 EQU (1 << 17) ;- Pin Controlled by PB17 +AT91C_PB17_ERXCK EQU (AT91C_PIO_PB17) ;- Ethernet MAC Receive Clock +AT91C_PB17_SPI0_NPCS3 EQU (AT91C_PIO_PB17) ;- SPI 0 Peripheral Chip Select 3 +AT91C_PIO_PB18 EQU (1 << 18) ;- Pin Controlled by PB18 +AT91C_PB18_EF100 EQU (AT91C_PIO_PB18) ;- Ethernet MAC Force 100 Mbits/sec +AT91C_PB18_ADTRG EQU (AT91C_PIO_PB18) ;- ADC External Trigger +AT91C_PIO_PB19 EQU (1 << 19) ;- Pin Controlled by PB19 +AT91C_PB19_PWM0 EQU (AT91C_PIO_PB19) ;- PWM Channel 0 +AT91C_PB19_TCLK1 EQU (AT91C_PIO_PB19) ;- Timer Counter 1 external clock input +AT91C_PIO_PB2 EQU (1 << 2) ;- Pin Controlled by PB2 +AT91C_PB2_ETX0 EQU (AT91C_PIO_PB2) ;- Ethernet MAC Transmit Data 0 +AT91C_PIO_PB20 EQU (1 << 20) ;- Pin Controlled by PB20 +AT91C_PB20_PWM1 EQU (AT91C_PIO_PB20) ;- PWM Channel 1 +AT91C_PB20_PCK0 EQU (AT91C_PIO_PB20) ;- PMC Programmable Clock Output 0 +AT91C_PIO_PB21 EQU (1 << 21) ;- Pin Controlled by PB21 +AT91C_PB21_PWM2 EQU (AT91C_PIO_PB21) ;- PWM Channel 2 +AT91C_PB21_PCK1 EQU (AT91C_PIO_PB21) ;- PMC Programmable Clock Output 1 +AT91C_PIO_PB22 EQU (1 << 22) ;- Pin Controlled by PB22 +AT91C_PB22_PWM3 EQU (AT91C_PIO_PB22) ;- PWM Channel 3 +AT91C_PB22_PCK2 EQU (AT91C_PIO_PB22) ;- PMC Programmable Clock Output 2 +AT91C_PIO_PB23 EQU (1 << 23) ;- Pin Controlled by PB23 +AT91C_PB23_TIOA0 EQU (AT91C_PIO_PB23) ;- Timer Counter 0 Multipurpose Timer I/O Pin A +AT91C_PB23_DCD1 EQU (AT91C_PIO_PB23) ;- USART 1 Data Carrier Detect +AT91C_PIO_PB24 EQU (1 << 24) ;- Pin Controlled by PB24 +AT91C_PB24_TIOB0 EQU (AT91C_PIO_PB24) ;- Timer Counter 0 Multipurpose Timer I/O Pin B +AT91C_PB24_DSR1 EQU (AT91C_PIO_PB24) ;- USART 1 Data Set ready +AT91C_PIO_PB25 EQU (1 << 25) ;- Pin Controlled by PB25 +AT91C_PB25_TIOA1 EQU (AT91C_PIO_PB25) ;- Timer Counter 1 Multipurpose Timer I/O Pin A +AT91C_PB25_DTR1 EQU (AT91C_PIO_PB25) ;- USART 1 Data Terminal ready +AT91C_PIO_PB26 EQU (1 << 26) ;- Pin Controlled by PB26 +AT91C_PB26_TIOB1 EQU (AT91C_PIO_PB26) ;- Timer Counter 1 Multipurpose Timer I/O Pin B +AT91C_PB26_RI1 EQU (AT91C_PIO_PB26) ;- USART 1 Ring Indicator +AT91C_PIO_PB27 EQU (1 << 27) ;- Pin Controlled by PB27 +AT91C_PB27_TIOA2 EQU (AT91C_PIO_PB27) ;- Timer Counter 2 Multipurpose Timer I/O Pin A +AT91C_PB27_PWM0 EQU (AT91C_PIO_PB27) ;- PWM Channel 0 +AT91C_PIO_PB28 EQU (1 << 28) ;- Pin Controlled by PB28 +AT91C_PB28_TIOB2 EQU (AT91C_PIO_PB28) ;- Timer Counter 2 Multipurpose Timer I/O Pin B +AT91C_PB28_PWM1 EQU (AT91C_PIO_PB28) ;- PWM Channel 1 +AT91C_PIO_PB29 EQU (1 << 29) ;- Pin Controlled by PB29 +AT91C_PB29_PCK1 EQU (AT91C_PIO_PB29) ;- PMC Programmable Clock Output 1 +AT91C_PB29_PWM2 EQU (AT91C_PIO_PB29) ;- PWM Channel 2 +AT91C_PIO_PB3 EQU (1 << 3) ;- Pin Controlled by PB3 +AT91C_PB3_ETX1 EQU (AT91C_PIO_PB3) ;- Ethernet MAC Transmit Data 1 +AT91C_PIO_PB30 EQU (1 << 30) ;- Pin Controlled by PB30 +AT91C_PB30_PCK2 EQU (AT91C_PIO_PB30) ;- PMC Programmable Clock Output 2 +AT91C_PB30_PWM3 EQU (AT91C_PIO_PB30) ;- PWM Channel 3 +AT91C_PIO_PB4 EQU (1 << 4) ;- Pin Controlled by PB4 +AT91C_PB4_ECRS EQU (AT91C_PIO_PB4) ;- Ethernet MAC Carrier Sense/Carrier Sense and Data Valid +AT91C_PIO_PB5 EQU (1 << 5) ;- Pin Controlled by PB5 +AT91C_PB5_ERX0 EQU (AT91C_PIO_PB5) ;- Ethernet MAC Receive Data 0 +AT91C_PIO_PB6 EQU (1 << 6) ;- Pin Controlled by PB6 +AT91C_PB6_ERX1 EQU (AT91C_PIO_PB6) ;- Ethernet MAC Receive Data 1 +AT91C_PIO_PB7 EQU (1 << 7) ;- Pin Controlled by PB7 +AT91C_PB7_ERXER EQU (AT91C_PIO_PB7) ;- Ethernet MAC Receive Error +AT91C_PIO_PB8 EQU (1 << 8) ;- Pin Controlled by PB8 +AT91C_PB8_EMDC EQU (AT91C_PIO_PB8) ;- Ethernet MAC Management Data Clock +AT91C_PIO_PB9 EQU (1 << 9) ;- Pin Controlled by PB9 +AT91C_PB9_EMDIO EQU (AT91C_PIO_PB9) ;- Ethernet MAC Management Data Input/Output + +// - ***************************************************************************** +// - PERIPHERAL ID DEFINITIONS FOR AT91SAM7X256 +// - ***************************************************************************** +AT91C_ID_FIQ EQU ( 0) ;- Advanced Interrupt Controller (FIQ) +AT91C_ID_SYS EQU ( 1) ;- System Peripheral +AT91C_ID_PIOA EQU ( 2) ;- Parallel IO Controller A +AT91C_ID_PIOB EQU ( 3) ;- Parallel IO Controller B +AT91C_ID_SPI0 EQU ( 4) ;- Serial Peripheral Interface 0 +AT91C_ID_SPI1 EQU ( 5) ;- Serial Peripheral Interface 1 +AT91C_ID_US0 EQU ( 6) ;- USART 0 +AT91C_ID_US1 EQU ( 7) ;- USART 1 +AT91C_ID_SSC EQU ( 8) ;- Serial Synchronous Controller +AT91C_ID_TWI EQU ( 9) ;- Two-Wire Interface +AT91C_ID_PWMC EQU (10) ;- PWM Controller +AT91C_ID_UDP EQU (11) ;- USB Device Port +AT91C_ID_TC0 EQU (12) ;- Timer Counter 0 +AT91C_ID_TC1 EQU (13) ;- Timer Counter 1 +AT91C_ID_TC2 EQU (14) ;- Timer Counter 2 +AT91C_ID_CAN EQU (15) ;- Control Area Network Controller +AT91C_ID_EMAC EQU (16) ;- Ethernet MAC +AT91C_ID_ADC EQU (17) ;- Analog-to-Digital Converter +AT91C_ID_18_Reserved EQU (18) ;- Reserved +AT91C_ID_19_Reserved EQU (19) ;- Reserved +AT91C_ID_20_Reserved EQU (20) ;- Reserved +AT91C_ID_21_Reserved EQU (21) ;- Reserved +AT91C_ID_22_Reserved EQU (22) ;- Reserved +AT91C_ID_23_Reserved EQU (23) ;- Reserved +AT91C_ID_24_Reserved EQU (24) ;- Reserved +AT91C_ID_25_Reserved EQU (25) ;- Reserved +AT91C_ID_26_Reserved EQU (26) ;- Reserved +AT91C_ID_27_Reserved EQU (27) ;- Reserved +AT91C_ID_28_Reserved EQU (28) ;- Reserved +AT91C_ID_29_Reserved EQU (29) ;- Reserved +AT91C_ID_IRQ0 EQU (30) ;- Advanced Interrupt Controller (IRQ0) +AT91C_ID_IRQ1 EQU (31) ;- Advanced Interrupt Controller (IRQ1) +AT91C_ALL_INT EQU (0xC003FFFF) ;- ALL VALID INTERRUPTS + +// - ***************************************************************************** +// - BASE ADDRESS DEFINITIONS FOR AT91SAM7X256 +// - ***************************************************************************** +AT91C_BASE_SYS EQU (0xFFFFF000) ;- (SYS) Base Address +AT91C_BASE_AIC EQU (0xFFFFF000) ;- (AIC) Base Address +AT91C_BASE_PDC_DBGU EQU (0xFFFFF300) ;- (PDC_DBGU) Base Address +AT91C_BASE_DBGU EQU (0xFFFFF200) ;- (DBGU) Base Address +AT91C_BASE_PIOA EQU (0xFFFFF400) ;- (PIOA) Base Address +AT91C_BASE_PIOB EQU (0xFFFFF600) ;- (PIOB) Base Address +AT91C_BASE_CKGR EQU (0xFFFFFC20) ;- (CKGR) Base Address +AT91C_BASE_PMC EQU (0xFFFFFC00) ;- (PMC) Base Address +AT91C_BASE_RSTC EQU (0xFFFFFD00) ;- (RSTC) Base Address +AT91C_BASE_RTTC EQU (0xFFFFFD20) ;- (RTTC) Base Address +AT91C_BASE_PITC EQU (0xFFFFFD30) ;- (PITC) Base Address +AT91C_BASE_WDTC EQU (0xFFFFFD40) ;- (WDTC) Base Address +AT91C_BASE_VREG EQU (0xFFFFFD60) ;- (VREG) Base Address +AT91C_BASE_MC EQU (0xFFFFFF00) ;- (MC) Base Address +AT91C_BASE_PDC_SPI1 EQU (0xFFFE4100) ;- (PDC_SPI1) Base Address +AT91C_BASE_SPI1 EQU (0xFFFE4000) ;- (SPI1) Base Address +AT91C_BASE_PDC_SPI0 EQU (0xFFFE0100) ;- (PDC_SPI0) Base Address +AT91C_BASE_SPI0 EQU (0xFFFE0000) ;- (SPI0) Base Address +AT91C_BASE_PDC_US1 EQU (0xFFFC4100) ;- (PDC_US1) Base Address +AT91C_BASE_US1 EQU (0xFFFC4000) ;- (US1) Base Address +AT91C_BASE_PDC_US0 EQU (0xFFFC0100) ;- (PDC_US0) Base Address +AT91C_BASE_US0 EQU (0xFFFC0000) ;- (US0) Base Address +AT91C_BASE_PDC_SSC EQU (0xFFFD4100) ;- (PDC_SSC) Base Address +AT91C_BASE_SSC EQU (0xFFFD4000) ;- (SSC) Base Address +AT91C_BASE_TWI EQU (0xFFFB8000) ;- (TWI) Base Address +AT91C_BASE_PWMC_CH3 EQU (0xFFFCC260) ;- (PWMC_CH3) Base Address +AT91C_BASE_PWMC_CH2 EQU (0xFFFCC240) ;- (PWMC_CH2) Base Address +AT91C_BASE_PWMC_CH1 EQU (0xFFFCC220) ;- (PWMC_CH1) Base Address +AT91C_BASE_PWMC_CH0 EQU (0xFFFCC200) ;- (PWMC_CH0) Base Address +AT91C_BASE_PWMC EQU (0xFFFCC000) ;- (PWMC) Base Address +AT91C_BASE_UDP EQU (0xFFFB0000) ;- (UDP) Base Address +AT91C_BASE_TC0 EQU (0xFFFA0000) ;- (TC0) Base Address +AT91C_BASE_TC1 EQU (0xFFFA0040) ;- (TC1) Base Address +AT91C_BASE_TC2 EQU (0xFFFA0080) ;- (TC2) Base Address +AT91C_BASE_TCB EQU (0xFFFA0000) ;- (TCB) Base Address +AT91C_BASE_CAN_MB0 EQU (0xFFFD0200) ;- (CAN_MB0) Base Address +AT91C_BASE_CAN_MB1 EQU (0xFFFD0220) ;- (CAN_MB1) Base Address +AT91C_BASE_CAN_MB2 EQU (0xFFFD0240) ;- (CAN_MB2) Base Address +AT91C_BASE_CAN_MB3 EQU (0xFFFD0260) ;- (CAN_MB3) Base Address +AT91C_BASE_CAN_MB4 EQU (0xFFFD0280) ;- (CAN_MB4) Base Address +AT91C_BASE_CAN_MB5 EQU (0xFFFD02A0) ;- (CAN_MB5) Base Address +AT91C_BASE_CAN_MB6 EQU (0xFFFD02C0) ;- (CAN_MB6) Base Address +AT91C_BASE_CAN_MB7 EQU (0xFFFD02E0) ;- (CAN_MB7) Base Address +AT91C_BASE_CAN EQU (0xFFFD0000) ;- (CAN) Base Address +AT91C_BASE_EMAC EQU (0xFFFDC000) ;- (EMAC) Base Address +AT91C_BASE_PDC_ADC EQU (0xFFFD8100) ;- (PDC_ADC) Base Address +AT91C_BASE_ADC EQU (0xFFFD8000) ;- (ADC) Base Address + +// - ***************************************************************************** +// - MEMORY MAPPING DEFINITIONS FOR AT91SAM7X256 +// - ***************************************************************************** +// - ISRAM +AT91C_ISRAM EQU (0x00200000) ;- Internal SRAM base address +AT91C_ISRAM_SIZE EQU (0x00010000) ;- Internal SRAM size in byte (64 Kbytes) +// - IFLASH +AT91C_IFLASH EQU (0x00100000) ;- Internal FLASH base address +AT91C_IFLASH_SIZE EQU (0x00040000) ;- Internal FLASH size in byte (256 Kbytes) +AT91C_IFLASH_PAGE_SIZE EQU (256) ;- Internal FLASH Page Size: 256 bytes +AT91C_IFLASH_LOCK_REGION_SIZE EQU (16384) ;- Internal FLASH Lock Region Size: 16 Kbytes +AT91C_IFLASH_NB_OF_PAGES EQU (1024) ;- Internal FLASH Number of Pages: 1024 bytes +AT91C_IFLASH_NB_OF_LOCK_BITS EQU (16) ;- Internal FLASH Number of Lock Bits: 16 bytes +#endif /* __IAR_SYSTEMS_ASM__ */ + + +#endif /* AT91SAM7X256_H */ diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/lib_AT91SAM7X256.h b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/lib_AT91SAM7X256.h new file mode 100644 index 0000000..95492d0 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/lib_AT91SAM7X256.h @@ -0,0 +1,4211 @@ +//* ---------------------------------------------------------------------------- +//* ATMEL Microcontroller Software Support - ROUSSET - +//* ---------------------------------------------------------------------------- +//* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +//* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +//* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +//* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +//* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +//* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +//* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +//* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +//* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +//* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +//* ---------------------------------------------------------------------------- +//* File Name : lib_AT91SAM7X256.h +//* Object : AT91SAM7X256 inlined functions +//* Generated : AT91 SW Application Group 11/02/2005 (15:17:24) +//* +//* CVS Reference : /lib_dbgu.h/1.1/Thu Aug 25 12:56:22 2005// +//* CVS Reference : /lib_pmc_SAM7X.h/1.4/Tue Aug 30 13:00:36 2005// +//* CVS Reference : /lib_VREG_6085B.h/1.1/Tue Feb 1 16:20:47 2005// +//* CVS Reference : /lib_rstc_6098A.h/1.1/Wed Oct 6 10:39:20 2004// +//* CVS Reference : /lib_ssc.h/1.4/Fri Jan 31 12:19:20 2003// +//* CVS Reference : /lib_wdtc_6080A.h/1.1/Wed Oct 6 10:38:30 2004// +//* CVS Reference : /lib_usart.h/1.5/Thu Nov 21 16:01:54 2002// +//* CVS Reference : /lib_spi2.h/1.2/Tue Aug 23 15:37:28 2005// +//* CVS Reference : /lib_pitc_6079A.h/1.2/Tue Nov 9 14:43:56 2004// +//* CVS Reference : /lib_aic_6075b.h/1.2/Thu Jul 7 07:48:22 2005// +//* CVS Reference : /lib_twi.h/1.3/Mon Jul 19 14:27:58 2004// +//* CVS Reference : /lib_adc.h/1.6/Fri Oct 17 09:12:38 2003// +//* CVS Reference : /lib_rttc_6081A.h/1.1/Wed Oct 6 10:39:38 2004// +//* CVS Reference : /lib_udp.h/1.5/Tue Aug 30 12:13:47 2005// +//* CVS Reference : /lib_tc_1753b.h/1.1/Fri Jan 31 12:20:02 2003// +//* CVS Reference : /lib_MC_SAM7X.h/1.1/Thu Mar 25 15:19:14 2004// +//* CVS Reference : /lib_pio.h/1.3/Fri Jan 31 12:18:56 2003// +//* CVS Reference : /lib_can_AT91.h/1.5/Tue Aug 23 15:37:07 2005// +//* CVS Reference : /lib_PWM_SAM.h/1.3/Thu Jan 22 10:10:50 2004// +//* CVS Reference : /lib_pdc.h/1.2/Tue Jul 2 13:29:40 2002// +//* ---------------------------------------------------------------------------- + +#ifndef lib_AT91SAM7X256_H +#define lib_AT91SAM7X256_H + +/* ***************************************************************************** + SOFTWARE API FOR AIC + ***************************************************************************** */ +#define AT91C_AIC_BRANCH_OPCODE ((void (*) ()) 0xE51FFF20) // ldr, pc, [pc, #-&F20] + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_ConfigureIt +//* \brief Interrupt Handler Initialization +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_AIC_ConfigureIt ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id, // \arg interrupt number to initialize + unsigned int priority, // \arg priority to give to the interrupt + unsigned int src_type, // \arg activation and sense of activation + void (*newHandler) () ) // \arg address of the interrupt handler +{ + unsigned int oldHandler; + unsigned int mask ; + + oldHandler = pAic->AIC_SVR[irq_id]; + + mask = 0x1 << irq_id ; + //* Disable the interrupt on the interrupt controller + pAic->AIC_IDCR = mask ; + //* Save the interrupt handler routine pointer and the interrupt priority + pAic->AIC_SVR[irq_id] = (unsigned int) newHandler ; + //* Store the Source Mode Register + pAic->AIC_SMR[irq_id] = src_type | priority ; + //* Clear the interrupt on the interrupt controller + pAic->AIC_ICCR = mask ; + + return oldHandler; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_EnableIt +//* \brief Enable corresponding IT number +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_EnableIt ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id ) // \arg interrupt number to initialize +{ + //* Enable the interrupt on the interrupt controller + pAic->AIC_IECR = 0x1 << irq_id ; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_DisableIt +//* \brief Disable corresponding IT number +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_DisableIt ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id ) // \arg interrupt number to initialize +{ + unsigned int mask = 0x1 << irq_id; + //* Disable the interrupt on the interrupt controller + pAic->AIC_IDCR = mask ; + //* Clear the interrupt on the Interrupt Controller ( if one is pending ) + pAic->AIC_ICCR = mask ; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_ClearIt +//* \brief Clear corresponding IT number +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_ClearIt ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id) // \arg interrupt number to initialize +{ + //* Clear the interrupt on the Interrupt Controller ( if one is pending ) + pAic->AIC_ICCR = (0x1 << irq_id); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_AcknowledgeIt +//* \brief Acknowledge corresponding IT number +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_AcknowledgeIt ( + AT91PS_AIC pAic) // \arg pointer to the AIC registers +{ + pAic->AIC_EOICR = pAic->AIC_EOICR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_SetExceptionVector +//* \brief Configure vector handler +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_AIC_SetExceptionVector ( + unsigned int *pVector, // \arg pointer to the AIC registers + void (*Handler) () ) // \arg Interrupt Handler +{ + unsigned int oldVector = *pVector; + + if ((unsigned int) Handler == (unsigned int) AT91C_AIC_BRANCH_OPCODE) + *pVector = (unsigned int) AT91C_AIC_BRANCH_OPCODE; + else + *pVector = (((((unsigned int) Handler) - ((unsigned int) pVector) - 0x8) >> 2) & 0x00FFFFFF) | 0xEA000000; + + return oldVector; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_Trig +//* \brief Trig an IT +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_Trig ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id) // \arg interrupt number +{ + pAic->AIC_ISCR = (0x1 << irq_id) ; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_IsActive +//* \brief Test if an IT is active +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_AIC_IsActive ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id) // \arg Interrupt Number +{ + return (pAic->AIC_ISR & (0x1 << irq_id)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_IsPending +//* \brief Test if an IT is pending +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_AIC_IsPending ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id) // \arg Interrupt Number +{ + return (pAic->AIC_IPR & (0x1 << irq_id)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_Open +//* \brief Set exception vectors and AIC registers to default values +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_Open( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + void (*IrqHandler) (), // \arg Default IRQ vector exception + void (*FiqHandler) (), // \arg Default FIQ vector exception + void (*DefaultHandler) (), // \arg Default Handler set in ISR + void (*SpuriousHandler) (), // \arg Default Spurious Handler + unsigned int protectMode) // \arg Debug Control Register +{ + int i; + + // Disable all interrupts and set IVR to the default handler + for (i = 0; i < 32; ++i) { + AT91F_AIC_DisableIt(pAic, i); + AT91F_AIC_ConfigureIt(pAic, i, AT91C_AIC_PRIOR_LOWEST, AT91C_AIC_SRCTYPE_HIGH_LEVEL, DefaultHandler); + } + + // Set the IRQ exception vector + AT91F_AIC_SetExceptionVector((unsigned int *) 0x18, IrqHandler); + // Set the Fast Interrupt exception vector + AT91F_AIC_SetExceptionVector((unsigned int *) 0x1C, FiqHandler); + + pAic->AIC_SPU = (unsigned int) SpuriousHandler; + pAic->AIC_DCR = protectMode; +} +/* ***************************************************************************** + SOFTWARE API FOR PDC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_SetNextRx +//* \brief Set the next receive transfer descriptor +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_SetNextRx ( + AT91PS_PDC pPDC, // \arg pointer to a PDC controller + char *address, // \arg address to the next bloc to be received + unsigned int bytes) // \arg number of bytes to be received +{ + pPDC->PDC_RNPR = (unsigned int) address; + pPDC->PDC_RNCR = bytes; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_SetNextTx +//* \brief Set the next transmit transfer descriptor +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_SetNextTx ( + AT91PS_PDC pPDC, // \arg pointer to a PDC controller + char *address, // \arg address to the next bloc to be transmitted + unsigned int bytes) // \arg number of bytes to be transmitted +{ + pPDC->PDC_TNPR = (unsigned int) address; + pPDC->PDC_TNCR = bytes; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_SetRx +//* \brief Set the receive transfer descriptor +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_SetRx ( + AT91PS_PDC pPDC, // \arg pointer to a PDC controller + char *address, // \arg address to the next bloc to be received + unsigned int bytes) // \arg number of bytes to be received +{ + pPDC->PDC_RPR = (unsigned int) address; + pPDC->PDC_RCR = bytes; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_SetTx +//* \brief Set the transmit transfer descriptor +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_SetTx ( + AT91PS_PDC pPDC, // \arg pointer to a PDC controller + char *address, // \arg address to the next bloc to be transmitted + unsigned int bytes) // \arg number of bytes to be transmitted +{ + pPDC->PDC_TPR = (unsigned int) address; + pPDC->PDC_TCR = bytes; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_EnableTx +//* \brief Enable transmit +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_EnableTx ( + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + pPDC->PDC_PTCR = AT91C_PDC_TXTEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_EnableRx +//* \brief Enable receive +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_EnableRx ( + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + pPDC->PDC_PTCR = AT91C_PDC_RXTEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_DisableTx +//* \brief Disable transmit +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_DisableTx ( + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + pPDC->PDC_PTCR = AT91C_PDC_TXTDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_DisableRx +//* \brief Disable receive +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_DisableRx ( + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + pPDC->PDC_PTCR = AT91C_PDC_RXTDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_IsTxEmpty +//* \brief Test if the current transfer descriptor has been sent +//*---------------------------------------------------------------------------- +__inline int AT91F_PDC_IsTxEmpty ( // \return return 1 if transfer is complete + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + return !(pPDC->PDC_TCR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_IsNextTxEmpty +//* \brief Test if the next transfer descriptor has been moved to the current td +//*---------------------------------------------------------------------------- +__inline int AT91F_PDC_IsNextTxEmpty ( // \return return 1 if transfer is complete + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + return !(pPDC->PDC_TNCR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_IsRxEmpty +//* \brief Test if the current transfer descriptor has been filled +//*---------------------------------------------------------------------------- +__inline int AT91F_PDC_IsRxEmpty ( // \return return 1 if transfer is complete + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + return !(pPDC->PDC_RCR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_IsNextRxEmpty +//* \brief Test if the next transfer descriptor has been moved to the current td +//*---------------------------------------------------------------------------- +__inline int AT91F_PDC_IsNextRxEmpty ( // \return return 1 if transfer is complete + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + return !(pPDC->PDC_RNCR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_Open +//* \brief Open PDC: disable TX and RX reset transfer descriptors, re-enable RX and TX +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_Open ( + AT91PS_PDC pPDC) // \arg pointer to a PDC controller +{ + //* Disable the RX and TX PDC transfer requests + AT91F_PDC_DisableRx(pPDC); + AT91F_PDC_DisableTx(pPDC); + + //* Reset all Counter register Next buffer first + AT91F_PDC_SetNextTx(pPDC, (char *) 0, 0); + AT91F_PDC_SetNextRx(pPDC, (char *) 0, 0); + AT91F_PDC_SetTx(pPDC, (char *) 0, 0); + AT91F_PDC_SetRx(pPDC, (char *) 0, 0); + + //* Enable the RX and TX PDC transfer requests + AT91F_PDC_EnableRx(pPDC); + AT91F_PDC_EnableTx(pPDC); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_Close +//* \brief Close PDC: disable TX and RX reset transfer descriptors +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_Close ( + AT91PS_PDC pPDC) // \arg pointer to a PDC controller +{ + //* Disable the RX and TX PDC transfer requests + AT91F_PDC_DisableRx(pPDC); + AT91F_PDC_DisableTx(pPDC); + + //* Reset all Counter register Next buffer first + AT91F_PDC_SetNextTx(pPDC, (char *) 0, 0); + AT91F_PDC_SetNextRx(pPDC, (char *) 0, 0); + AT91F_PDC_SetTx(pPDC, (char *) 0, 0); + AT91F_PDC_SetRx(pPDC, (char *) 0, 0); + +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_SendFrame +//* \brief Close PDC: disable TX and RX reset transfer descriptors +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PDC_SendFrame( + AT91PS_PDC pPDC, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + if (AT91F_PDC_IsTxEmpty(pPDC)) { + //* Buffer and next buffer can be initialized + AT91F_PDC_SetTx(pPDC, pBuffer, szBuffer); + AT91F_PDC_SetNextTx(pPDC, pNextBuffer, szNextBuffer); + return 2; + } + else if (AT91F_PDC_IsNextTxEmpty(pPDC)) { + //* Only one buffer can be initialized + AT91F_PDC_SetNextTx(pPDC, pBuffer, szBuffer); + return 1; + } + else { + //* All buffer are in use... + return 0; + } +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_ReceiveFrame +//* \brief Close PDC: disable TX and RX reset transfer descriptors +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PDC_ReceiveFrame ( + AT91PS_PDC pPDC, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + if (AT91F_PDC_IsRxEmpty(pPDC)) { + //* Buffer and next buffer can be initialized + AT91F_PDC_SetRx(pPDC, pBuffer, szBuffer); + AT91F_PDC_SetNextRx(pPDC, pNextBuffer, szNextBuffer); + return 2; + } + else if (AT91F_PDC_IsNextRxEmpty(pPDC)) { + //* Only one buffer can be initialized + AT91F_PDC_SetNextRx(pPDC, pBuffer, szBuffer); + return 1; + } + else { + //* All buffer are in use... + return 0; + } +} +/* ***************************************************************************** + SOFTWARE API FOR DBGU + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_DBGU_InterruptEnable +//* \brief Enable DBGU Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_DBGU_InterruptEnable( + AT91PS_DBGU pDbgu, // \arg pointer to a DBGU controller + unsigned int flag) // \arg dbgu interrupt to be enabled +{ + pDbgu->DBGU_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_DBGU_InterruptDisable +//* \brief Disable DBGU Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_DBGU_InterruptDisable( + AT91PS_DBGU pDbgu, // \arg pointer to a DBGU controller + unsigned int flag) // \arg dbgu interrupt to be disabled +{ + pDbgu->DBGU_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_DBGU_GetInterruptMaskStatus +//* \brief Return DBGU Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_DBGU_GetInterruptMaskStatus( // \return DBGU Interrupt Mask Status + AT91PS_DBGU pDbgu) // \arg pointer to a DBGU controller +{ + return pDbgu->DBGU_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_DBGU_IsInterruptMasked +//* \brief Test if DBGU Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_DBGU_IsInterruptMasked( + AT91PS_DBGU pDbgu, // \arg pointer to a DBGU controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_DBGU_GetInterruptMaskStatus(pDbgu) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR PIO + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgPeriph +//* \brief Enable pins to be drived by peripheral +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgPeriph( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int periphAEnable, // \arg PERIPH A to enable + unsigned int periphBEnable) // \arg PERIPH B to enable + +{ + pPio->PIO_ASR = periphAEnable; + pPio->PIO_BSR = periphBEnable; + pPio->PIO_PDR = (periphAEnable | periphBEnable); // Set in Periph mode +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgOutput +//* \brief Enable PIO in output mode +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgOutput( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int pioEnable) // \arg PIO to be enabled +{ + pPio->PIO_PER = pioEnable; // Set in PIO mode + pPio->PIO_OER = pioEnable; // Configure in Output +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgInput +//* \brief Enable PIO in input mode +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgInput( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int inputEnable) // \arg PIO to be enabled +{ + // Disable output + pPio->PIO_ODR = inputEnable; + pPio->PIO_PER = inputEnable; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgOpendrain +//* \brief Configure PIO in open drain +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgOpendrain( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int multiDrvEnable) // \arg pio to be configured in open drain +{ + // Configure the multi-drive option + pPio->PIO_MDDR = ~multiDrvEnable; + pPio->PIO_MDER = multiDrvEnable; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgPullup +//* \brief Enable pullup on PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgPullup( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int pullupEnable) // \arg enable pullup on PIO +{ + // Connect or not Pullup + pPio->PIO_PPUDR = ~pullupEnable; + pPio->PIO_PPUER = pullupEnable; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgDirectDrive +//* \brief Enable direct drive on PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgDirectDrive( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int directDrive) // \arg PIO to be configured with direct drive + +{ + // Configure the Direct Drive + pPio->PIO_OWDR = ~directDrive; + pPio->PIO_OWER = directDrive; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgInputFilter +//* \brief Enable input filter on input PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgInputFilter( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int inputFilter) // \arg PIO to be configured with input filter + +{ + // Configure the Direct Drive + pPio->PIO_IFDR = ~inputFilter; + pPio->PIO_IFER = inputFilter; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetInput +//* \brief Return PIO input value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetInput( // \return PIO input + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_PDSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsInputSet +//* \brief Test if PIO is input flag is active +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsInputSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetInput(pPio) & flag); +} + + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_SetOutput +//* \brief Set to 1 output PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_SetOutput( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg output to be set +{ + pPio->PIO_SODR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_ClearOutput +//* \brief Set to 0 output PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_ClearOutput( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg output to be cleared +{ + pPio->PIO_CODR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_ForceOutput +//* \brief Force output when Direct drive option is enabled +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_ForceOutput( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg output to be forced +{ + pPio->PIO_ODSR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_Enable +//* \brief Enable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_Enable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio to be enabled +{ + pPio->PIO_PER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_Disable +//* \brief Disable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_Disable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio to be disabled +{ + pPio->PIO_PDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetStatus +//* \brief Return PIO Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetStatus( // \return PIO Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_PSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsSet +//* \brief Test if PIO is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_OutputEnable +//* \brief Output Enable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_OutputEnable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio output to be enabled +{ + pPio->PIO_OER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_OutputDisable +//* \brief Output Enable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_OutputDisable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio output to be disabled +{ + pPio->PIO_ODR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetOutputStatus +//* \brief Return PIO Output Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetOutputStatus( // \return PIO Output Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_OSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsOuputSet +//* \brief Test if PIO Output is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsOutputSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetOutputStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_InputFilterEnable +//* \brief Input Filter Enable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_InputFilterEnable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio input filter to be enabled +{ + pPio->PIO_IFER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_InputFilterDisable +//* \brief Input Filter Disable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_InputFilterDisable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio input filter to be disabled +{ + pPio->PIO_IFDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetInputFilterStatus +//* \brief Return PIO Input Filter Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetInputFilterStatus( // \return PIO Input Filter Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_IFSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsInputFilterSet +//* \brief Test if PIO Input filter is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsInputFilterSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetInputFilterStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetOutputDataStatus +//* \brief Return PIO Output Data Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetOutputDataStatus( // \return PIO Output Data Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_ODSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_InterruptEnable +//* \brief Enable PIO Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_InterruptEnable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio interrupt to be enabled +{ + pPio->PIO_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_InterruptDisable +//* \brief Disable PIO Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_InterruptDisable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio interrupt to be disabled +{ + pPio->PIO_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetInterruptMaskStatus +//* \brief Return PIO Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetInterruptMaskStatus( // \return PIO Interrupt Mask Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetInterruptStatus +//* \brief Return PIO Interrupt Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetInterruptStatus( // \return PIO Interrupt Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_ISR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsInterruptMasked +//* \brief Test if PIO Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsInterruptMasked( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetInterruptMaskStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsInterruptSet +//* \brief Test if PIO Interrupt is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsInterruptSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetInterruptStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_MultiDriverEnable +//* \brief Multi Driver Enable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_MultiDriverEnable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio to be enabled +{ + pPio->PIO_MDER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_MultiDriverDisable +//* \brief Multi Driver Disable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_MultiDriverDisable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio to be disabled +{ + pPio->PIO_MDDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetMultiDriverStatus +//* \brief Return PIO Multi Driver Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetMultiDriverStatus( // \return PIO Multi Driver Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_MDSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsMultiDriverSet +//* \brief Test if PIO MultiDriver is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsMultiDriverSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetMultiDriverStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_A_RegisterSelection +//* \brief PIO A Register Selection +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_A_RegisterSelection( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio A register selection +{ + pPio->PIO_ASR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_B_RegisterSelection +//* \brief PIO B Register Selection +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_B_RegisterSelection( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio B register selection +{ + pPio->PIO_BSR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_Get_AB_RegisterStatus +//* \brief Return PIO Interrupt Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_Get_AB_RegisterStatus( // \return PIO AB Register Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_ABSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsAB_RegisterSet +//* \brief Test if PIO AB Register is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsAB_RegisterSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_Get_AB_RegisterStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_OutputWriteEnable +//* \brief Output Write Enable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_OutputWriteEnable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio output write to be enabled +{ + pPio->PIO_OWER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_OutputWriteDisable +//* \brief Output Write Disable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_OutputWriteDisable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio output write to be disabled +{ + pPio->PIO_OWDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetOutputWriteStatus +//* \brief Return PIO Output Write Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetOutputWriteStatus( // \return PIO Output Write Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_OWSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsOutputWriteSet +//* \brief Test if PIO OutputWrite is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsOutputWriteSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetOutputWriteStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetCfgPullup +//* \brief Return PIO Configuration Pullup +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetCfgPullup( // \return PIO Configuration Pullup + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_PPUSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsOutputDataStatusSet +//* \brief Test if PIO Output Data Status is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsOutputDataStatusSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetOutputDataStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsCfgPullupStatusSet +//* \brief Test if PIO Configuration Pullup Status is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsCfgPullupStatusSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (~AT91F_PIO_GetCfgPullup(pPio) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR PMC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_CfgSysClkEnableReg +//* \brief Configure the System Clock Enable Register of the PMC controller +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_CfgSysClkEnableReg ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int mode) +{ + //* Write to the SCER register + pPMC->PMC_SCER = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_CfgSysClkDisableReg +//* \brief Configure the System Clock Disable Register of the PMC controller +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_CfgSysClkDisableReg ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int mode) +{ + //* Write to the SCDR register + pPMC->PMC_SCDR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_GetSysClkStatusReg +//* \brief Return the System Clock Status Register of the PMC controller +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_GetSysClkStatusReg ( + AT91PS_PMC pPMC // pointer to a CAN controller + ) +{ + return pPMC->PMC_SCSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_EnablePeriphClock +//* \brief Enable peripheral clock +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_EnablePeriphClock ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int periphIds) // \arg IDs of peripherals to enable +{ + pPMC->PMC_PCER = periphIds; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_DisablePeriphClock +//* \brief Disable peripheral clock +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_DisablePeriphClock ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int periphIds) // \arg IDs of peripherals to enable +{ + pPMC->PMC_PCDR = periphIds; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_GetPeriphClock +//* \brief Get peripheral clock status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_GetPeriphClock ( + AT91PS_PMC pPMC) // \arg pointer to PMC controller +{ + return pPMC->PMC_PCSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_CfgMainOscillatorReg +//* \brief Cfg the main oscillator +//*---------------------------------------------------------------------------- +__inline void AT91F_CKGR_CfgMainOscillatorReg ( + AT91PS_CKGR pCKGR, // \arg pointer to CKGR controller + unsigned int mode) +{ + pCKGR->CKGR_MOR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_GetMainOscillatorReg +//* \brief Cfg the main oscillator +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CKGR_GetMainOscillatorReg ( + AT91PS_CKGR pCKGR) // \arg pointer to CKGR controller +{ + return pCKGR->CKGR_MOR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_EnableMainOscillator +//* \brief Enable the main oscillator +//*---------------------------------------------------------------------------- +__inline void AT91F_CKGR_EnableMainOscillator( + AT91PS_CKGR pCKGR) // \arg pointer to CKGR controller +{ + pCKGR->CKGR_MOR |= AT91C_CKGR_MOSCEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_DisableMainOscillator +//* \brief Disable the main oscillator +//*---------------------------------------------------------------------------- +__inline void AT91F_CKGR_DisableMainOscillator ( + AT91PS_CKGR pCKGR) // \arg pointer to CKGR controller +{ + pCKGR->CKGR_MOR &= ~AT91C_CKGR_MOSCEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_CfgMainOscStartUpTime +//* \brief Cfg MOR Register according to the main osc startup time +//*---------------------------------------------------------------------------- +__inline void AT91F_CKGR_CfgMainOscStartUpTime ( + AT91PS_CKGR pCKGR, // \arg pointer to CKGR controller + unsigned int startup_time, // \arg main osc startup time in microsecond (us) + unsigned int slowClock) // \arg slowClock in Hz +{ + pCKGR->CKGR_MOR &= ~AT91C_CKGR_OSCOUNT; + pCKGR->CKGR_MOR |= ((slowClock * startup_time)/(8*1000000)) << 8; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_GetMainClockFreqReg +//* \brief Cfg the main oscillator +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CKGR_GetMainClockFreqReg ( + AT91PS_CKGR pCKGR) // \arg pointer to CKGR controller +{ + return pCKGR->CKGR_MCFR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_GetMainClock +//* \brief Return Main clock in Hz +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CKGR_GetMainClock ( + AT91PS_CKGR pCKGR, // \arg pointer to CKGR controller + unsigned int slowClock) // \arg slowClock in Hz +{ + return ((pCKGR->CKGR_MCFR & AT91C_CKGR_MAINF) * slowClock) >> 4; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_CfgMCKReg +//* \brief Cfg Master Clock Register +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_CfgMCKReg ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int mode) +{ + pPMC->PMC_MCKR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_GetMCKReg +//* \brief Return Master Clock Register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_GetMCKReg( + AT91PS_PMC pPMC) // \arg pointer to PMC controller +{ + return pPMC->PMC_MCKR; +} + +//*------------------------------------------------------------------------------ +//* \fn AT91F_PMC_GetMasterClock +//* \brief Return master clock in Hz which correponds to processor clock for ARM7 +//*------------------------------------------------------------------------------ +__inline unsigned int AT91F_PMC_GetMasterClock ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + AT91PS_CKGR pCKGR, // \arg pointer to CKGR controller + unsigned int slowClock) // \arg slowClock in Hz +{ + unsigned int reg = pPMC->PMC_MCKR; + unsigned int prescaler = (1 << ((reg & AT91C_PMC_PRES) >> 2)); + unsigned int pllDivider, pllMultiplier; + + switch (reg & AT91C_PMC_CSS) { + case AT91C_PMC_CSS_SLOW_CLK: // Slow clock selected + return slowClock / prescaler; + case AT91C_PMC_CSS_MAIN_CLK: // Main clock is selected + return AT91F_CKGR_GetMainClock(pCKGR, slowClock) / prescaler; + case AT91C_PMC_CSS_PLL_CLK: // PLLB clock is selected + reg = pCKGR->CKGR_PLLR; + pllDivider = (reg & AT91C_CKGR_DIV); + pllMultiplier = ((reg & AT91C_CKGR_MUL) >> 16) + 1; + return AT91F_CKGR_GetMainClock(pCKGR, slowClock) / pllDivider * pllMultiplier / prescaler; + } + return 0; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_EnablePCK +//* \brief Enable peripheral clock +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_EnablePCK ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int pck, // \arg Peripheral clock identifier 0 .. 7 + unsigned int mode) +{ + pPMC->PMC_PCKR[pck] = mode; + pPMC->PMC_SCER = (1 << pck) << 8; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_DisablePCK +//* \brief Enable peripheral clock +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_DisablePCK ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int pck) // \arg Peripheral clock identifier 0 .. 7 +{ + pPMC->PMC_SCDR = (1 << pck) << 8; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_EnableIt +//* \brief Enable PMC interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_EnableIt ( + AT91PS_PMC pPMC, // pointer to a PMC controller + unsigned int flag) // IT to be enabled +{ + //* Write to the IER register + pPMC->PMC_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_DisableIt +//* \brief Disable PMC interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_DisableIt ( + AT91PS_PMC pPMC, // pointer to a PMC controller + unsigned int flag) // IT to be disabled +{ + //* Write to the IDR register + pPMC->PMC_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_GetStatus +//* \brief Return PMC Interrupt Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_GetStatus( // \return PMC Interrupt Status + AT91PS_PMC pPMC) // pointer to a PMC controller +{ + return pPMC->PMC_SR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_GetInterruptMaskStatus +//* \brief Return PMC Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_GetInterruptMaskStatus( // \return PMC Interrupt Mask Status + AT91PS_PMC pPMC) // pointer to a PMC controller +{ + return pPMC->PMC_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_IsInterruptMasked +//* \brief Test if PMC Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_IsInterruptMasked( + AT91PS_PMC pPMC, // \arg pointer to a PMC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PMC_GetInterruptMaskStatus(pPMC) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_IsStatusSet +//* \brief Test if PMC Status is Set +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_IsStatusSet( + AT91PS_PMC pPMC, // \arg pointer to a PMC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PMC_GetStatus(pPMC) & flag); +} + +// ---------------------------------------------------------------------------- +// \fn AT91F_CKGR_CfgPLLReg +// \brief Cfg the PLL Register +// ---------------------------------------------------------------------------- +__inline void AT91F_CKGR_CfgPLLReg ( + AT91PS_CKGR pCKGR, // \arg pointer to CKGR controller + unsigned int mode) +{ + pCKGR->CKGR_PLLR = mode; +} + +// ---------------------------------------------------------------------------- +// \fn AT91F_CKGR_GetPLLReg +// \brief Get the PLL Register +// ---------------------------------------------------------------------------- +__inline unsigned int AT91F_CKGR_GetPLLReg ( + AT91PS_CKGR pCKGR) // \arg pointer to CKGR controller +{ + return pCKGR->CKGR_PLLR; +} + + +/* ***************************************************************************** + SOFTWARE API FOR RSTC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_RSTSoftReset +//* \brief Start Software Reset +//*---------------------------------------------------------------------------- +__inline void AT91F_RSTSoftReset( + AT91PS_RSTC pRSTC, + unsigned int reset) +{ + pRSTC->RSTC_RCR = (0xA5000000 | reset); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_RSTSetMode +//* \brief Set Reset Mode +//*---------------------------------------------------------------------------- +__inline void AT91F_RSTSetMode( + AT91PS_RSTC pRSTC, + unsigned int mode) +{ + pRSTC->RSTC_RMR = (0xA5000000 | mode); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_RSTGetMode +//* \brief Get Reset Mode +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_RSTGetMode( + AT91PS_RSTC pRSTC) +{ + return (pRSTC->RSTC_RMR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_RSTGetStatus +//* \brief Get Reset Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_RSTGetStatus( + AT91PS_RSTC pRSTC) +{ + return (pRSTC->RSTC_RSR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_RSTIsSoftRstActive +//* \brief Return !=0 if software reset is still not completed +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_RSTIsSoftRstActive( + AT91PS_RSTC pRSTC) +{ + return ((pRSTC->RSTC_RSR) & AT91C_RSTC_SRCMP); +} +/* ***************************************************************************** + SOFTWARE API FOR RTTC + ***************************************************************************** */ +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_SetRTT_TimeBase() +//* \brief Set the RTT prescaler according to the TimeBase in ms +//*-------------------------------------------------------------------------------------- +__inline unsigned int AT91F_RTTSetTimeBase( + AT91PS_RTTC pRTTC, + unsigned int ms) +{ + if (ms > 2000) + return 1; // AT91C_TIME_OUT_OF_RANGE + pRTTC->RTTC_RTMR &= ~0xFFFF; + pRTTC->RTTC_RTMR |= (((ms << 15) /1000) & 0xFFFF); + return 0; +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTTSetPrescaler() +//* \brief Set the new prescaler value +//*-------------------------------------------------------------------------------------- +__inline unsigned int AT91F_RTTSetPrescaler( + AT91PS_RTTC pRTTC, + unsigned int rtpres) +{ + pRTTC->RTTC_RTMR &= ~0xFFFF; + pRTTC->RTTC_RTMR |= (rtpres & 0xFFFF); + return (pRTTC->RTTC_RTMR); +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTTRestart() +//* \brief Restart the RTT prescaler +//*-------------------------------------------------------------------------------------- +__inline void AT91F_RTTRestart( + AT91PS_RTTC pRTTC) +{ + pRTTC->RTTC_RTMR |= AT91C_RTTC_RTTRST; +} + + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_SetAlarmINT() +//* \brief Enable RTT Alarm Interrupt +//*-------------------------------------------------------------------------------------- +__inline void AT91F_RTTSetAlarmINT( + AT91PS_RTTC pRTTC) +{ + pRTTC->RTTC_RTMR |= AT91C_RTTC_ALMIEN; +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_ClearAlarmINT() +//* \brief Disable RTT Alarm Interrupt +//*-------------------------------------------------------------------------------------- +__inline void AT91F_RTTClearAlarmINT( + AT91PS_RTTC pRTTC) +{ + pRTTC->RTTC_RTMR &= ~AT91C_RTTC_ALMIEN; +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_SetRttIncINT() +//* \brief Enable RTT INC Interrupt +//*-------------------------------------------------------------------------------------- +__inline void AT91F_RTTSetRttIncINT( + AT91PS_RTTC pRTTC) +{ + pRTTC->RTTC_RTMR |= AT91C_RTTC_RTTINCIEN; +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_ClearRttIncINT() +//* \brief Disable RTT INC Interrupt +//*-------------------------------------------------------------------------------------- +__inline void AT91F_RTTClearRttIncINT( + AT91PS_RTTC pRTTC) +{ + pRTTC->RTTC_RTMR &= ~AT91C_RTTC_RTTINCIEN; +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_SetAlarmValue() +//* \brief Set RTT Alarm Value +//*-------------------------------------------------------------------------------------- +__inline void AT91F_RTTSetAlarmValue( + AT91PS_RTTC pRTTC, unsigned int alarm) +{ + pRTTC->RTTC_RTAR = alarm; +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_GetAlarmValue() +//* \brief Get RTT Alarm Value +//*-------------------------------------------------------------------------------------- +__inline unsigned int AT91F_RTTGetAlarmValue( + AT91PS_RTTC pRTTC) +{ + return(pRTTC->RTTC_RTAR); +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTTGetStatus() +//* \brief Read the RTT status +//*-------------------------------------------------------------------------------------- +__inline unsigned int AT91F_RTTGetStatus( + AT91PS_RTTC pRTTC) +{ + return(pRTTC->RTTC_RTSR); +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_ReadValue() +//* \brief Read the RTT value +//*-------------------------------------------------------------------------------------- +__inline unsigned int AT91F_RTTReadValue( + AT91PS_RTTC pRTTC) +{ + register volatile unsigned int val1,val2; + do + { + val1 = pRTTC->RTTC_RTVR; + val2 = pRTTC->RTTC_RTVR; + } + while(val1 != val2); + return(val1); +} +/* ***************************************************************************** + SOFTWARE API FOR PITC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITInit +//* \brief System timer init : period in µsecond, system clock freq in MHz +//*---------------------------------------------------------------------------- +__inline void AT91F_PITInit( + AT91PS_PITC pPITC, + unsigned int period, + unsigned int pit_frequency) +{ + pPITC->PITC_PIMR = period? (period * pit_frequency + 8) >> 4 : 0; // +8 to avoid %10 and /10 + pPITC->PITC_PIMR |= AT91C_PITC_PITEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITSetPIV +//* \brief Set the PIT Periodic Interval Value +//*---------------------------------------------------------------------------- +__inline void AT91F_PITSetPIV( + AT91PS_PITC pPITC, + unsigned int piv) +{ + pPITC->PITC_PIMR = piv | (pPITC->PITC_PIMR & (AT91C_PITC_PITEN | AT91C_PITC_PITIEN)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITEnableInt +//* \brief Enable PIT periodic interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PITEnableInt( + AT91PS_PITC pPITC) +{ + pPITC->PITC_PIMR |= AT91C_PITC_PITIEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITDisableInt +//* \brief Disable PIT periodic interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PITDisableInt( + AT91PS_PITC pPITC) +{ + pPITC->PITC_PIMR &= ~AT91C_PITC_PITIEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITGetMode +//* \brief Read PIT mode register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PITGetMode( + AT91PS_PITC pPITC) +{ + return(pPITC->PITC_PIMR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITGetStatus +//* \brief Read PIT status register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PITGetStatus( + AT91PS_PITC pPITC) +{ + return(pPITC->PITC_PISR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITGetPIIR +//* \brief Read PIT CPIV and PICNT without ressetting the counters +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PITGetPIIR( + AT91PS_PITC pPITC) +{ + return(pPITC->PITC_PIIR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITGetPIVR +//* \brief Read System timer CPIV and PICNT without ressetting the counters +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PITGetPIVR( + AT91PS_PITC pPITC) +{ + return(pPITC->PITC_PIVR); +} +/* ***************************************************************************** + SOFTWARE API FOR WDTC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_WDTSetMode +//* \brief Set Watchdog Mode Register +//*---------------------------------------------------------------------------- +__inline void AT91F_WDTSetMode( + AT91PS_WDTC pWDTC, + unsigned int Mode) +{ + pWDTC->WDTC_WDMR = Mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_WDTRestart +//* \brief Restart Watchdog +//*---------------------------------------------------------------------------- +__inline void AT91F_WDTRestart( + AT91PS_WDTC pWDTC) +{ + pWDTC->WDTC_WDCR = 0xA5000001; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_WDTSGettatus +//* \brief Get Watchdog Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_WDTSGettatus( + AT91PS_WDTC pWDTC) +{ + return(pWDTC->WDTC_WDSR & 0x3); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_WDTGetPeriod +//* \brief Translate ms into Watchdog Compatible value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_WDTGetPeriod(unsigned int ms) +{ + if ((ms < 4) || (ms > 16000)) + return 0; + return((ms << 8) / 1000); +} +/* ***************************************************************************** + SOFTWARE API FOR VREG + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_VREG_Enable_LowPowerMode +//* \brief Enable VREG Low Power Mode +//*---------------------------------------------------------------------------- +__inline void AT91F_VREG_Enable_LowPowerMode( + AT91PS_VREG pVREG) +{ + pVREG->VREG_MR |= AT91C_VREG_PSTDBY; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_VREG_Disable_LowPowerMode +//* \brief Disable VREG Low Power Mode +//*---------------------------------------------------------------------------- +__inline void AT91F_VREG_Disable_LowPowerMode( + AT91PS_VREG pVREG) +{ + pVREG->VREG_MR &= ~AT91C_VREG_PSTDBY; +}/* ***************************************************************************** + SOFTWARE API FOR MC + ***************************************************************************** */ + +#define AT91C_MC_CORRECT_KEY ((unsigned int) 0x5A << 24) // (MC) Correct Protect Key + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_Remap +//* \brief Make Remap +//*---------------------------------------------------------------------------- +__inline void AT91F_MC_Remap (void) // +{ + AT91PS_MC pMC = (AT91PS_MC) AT91C_BASE_MC; + + pMC->MC_RCR = AT91C_MC_RCB; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_CfgModeReg +//* \brief Configure the EFC Mode Register of the MC controller +//*---------------------------------------------------------------------------- +__inline void AT91F_MC_EFC_CfgModeReg ( + AT91PS_MC pMC, // pointer to a MC controller + unsigned int mode) // mode register +{ + // Write to the FMR register + pMC->MC_FMR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_GetModeReg +//* \brief Return MC EFC Mode Regsiter +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_MC_EFC_GetModeReg( + AT91PS_MC pMC) // pointer to a MC controller +{ + return pMC->MC_FMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_ComputeFMCN +//* \brief Return MC EFC Mode Regsiter +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_MC_EFC_ComputeFMCN( + int master_clock) // master clock in Hz +{ + return (master_clock/1000000 +2); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_PerformCmd +//* \brief Perform EFC Command +//*---------------------------------------------------------------------------- +__inline void AT91F_MC_EFC_PerformCmd ( + AT91PS_MC pMC, // pointer to a MC controller + unsigned int transfer_cmd) +{ + pMC->MC_FCR = transfer_cmd; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_GetStatus +//* \brief Return MC EFC Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_MC_EFC_GetStatus( + AT91PS_MC pMC) // pointer to a MC controller +{ + return pMC->MC_FSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_IsInterruptMasked +//* \brief Test if EFC MC Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_MC_EFC_IsInterruptMasked( + AT91PS_MC pMC, // \arg pointer to a MC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_MC_EFC_GetModeReg(pMC) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_IsInterruptSet +//* \brief Test if EFC MC Interrupt is Set +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_MC_EFC_IsInterruptSet( + AT91PS_MC pMC, // \arg pointer to a MC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_MC_EFC_GetStatus(pMC) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR SPI + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_CfgCs +//* \brief Configure SPI chip select register +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_CfgCs ( + AT91PS_SPI pSPI, // pointer to a SPI controller + int cs, // SPI cs number (0 to 3) + int val) // chip select register +{ + //* Write to the CSR register + *(pSPI->SPI_CSR + cs) = val; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_EnableIt +//* \brief Enable SPI interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_EnableIt ( + AT91PS_SPI pSPI, // pointer to a SPI controller + unsigned int flag) // IT to be enabled +{ + //* Write to the IER register + pSPI->SPI_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_DisableIt +//* \brief Disable SPI interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_DisableIt ( + AT91PS_SPI pSPI, // pointer to a SPI controller + unsigned int flag) // IT to be disabled +{ + //* Write to the IDR register + pSPI->SPI_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_Reset +//* \brief Reset the SPI controller +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_Reset ( + AT91PS_SPI pSPI // pointer to a SPI controller + ) +{ + //* Write to the CR register + pSPI->SPI_CR = AT91C_SPI_SWRST; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_Enable +//* \brief Enable the SPI controller +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_Enable ( + AT91PS_SPI pSPI // pointer to a SPI controller + ) +{ + //* Write to the CR register + pSPI->SPI_CR = AT91C_SPI_SPIEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_Disable +//* \brief Disable the SPI controller +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_Disable ( + AT91PS_SPI pSPI // pointer to a SPI controller + ) +{ + //* Write to the CR register + pSPI->SPI_CR = AT91C_SPI_SPIDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_CfgMode +//* \brief Enable the SPI controller +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_CfgMode ( + AT91PS_SPI pSPI, // pointer to a SPI controller + int mode) // mode register +{ + //* Write to the MR register + pSPI->SPI_MR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_CfgPCS +//* \brief Switch to the correct PCS of SPI Mode Register : Fixed Peripheral Selected +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_CfgPCS ( + AT91PS_SPI pSPI, // pointer to a SPI controller + char PCS_Device) // PCS of the Device +{ + //* Write to the MR register + pSPI->SPI_MR &= 0xFFF0FFFF; + pSPI->SPI_MR |= ( (PCS_Device<<16) & AT91C_SPI_PCS ); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_ReceiveFrame +//* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initializaed with Next Buffer, 0 if PDC is busy +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_SPI_ReceiveFrame ( + AT91PS_SPI pSPI, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + return AT91F_PDC_ReceiveFrame( + (AT91PS_PDC) &(pSPI->SPI_RPR), + pBuffer, + szBuffer, + pNextBuffer, + szNextBuffer); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_SendFrame +//* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initializaed with Next Buffer, 0 if PDC is bSPIy +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_SPI_SendFrame( + AT91PS_SPI pSPI, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + return AT91F_PDC_SendFrame( + (AT91PS_PDC) &(pSPI->SPI_RPR), + pBuffer, + szBuffer, + pNextBuffer, + szNextBuffer); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_Close +//* \brief Close SPI: disable IT disable transfert, close PDC +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_Close ( + AT91PS_SPI pSPI) // \arg pointer to a SPI controller +{ + //* Reset all the Chip Select register + pSPI->SPI_CSR[0] = 0 ; + pSPI->SPI_CSR[1] = 0 ; + pSPI->SPI_CSR[2] = 0 ; + pSPI->SPI_CSR[3] = 0 ; + + //* Reset the SPI mode + pSPI->SPI_MR = 0 ; + + //* Disable all interrupts + pSPI->SPI_IDR = 0xFFFFFFFF ; + + //* Abort the Peripheral Data Transfers + AT91F_PDC_Close((AT91PS_PDC) &(pSPI->SPI_RPR)); + + //* Disable receiver and transmitter and stop any activity immediately + pSPI->SPI_CR = AT91C_SPI_SPIDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_PutChar +//* \brief Send a character,does not check if ready to send +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_PutChar ( + AT91PS_SPI pSPI, + unsigned int character, + unsigned int cs_number ) +{ + unsigned int value_for_cs; + value_for_cs = (~(1 << cs_number)) & 0xF; //Place a zero among a 4 ONEs number + pSPI->SPI_TDR = (character & 0xFFFF) | (value_for_cs << 16); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_GetChar +//* \brief Receive a character,does not check if a character is available +//*---------------------------------------------------------------------------- +__inline int AT91F_SPI_GetChar ( + const AT91PS_SPI pSPI) +{ + return((pSPI->SPI_RDR) & 0xFFFF); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_GetInterruptMaskStatus +//* \brief Return SPI Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_SPI_GetInterruptMaskStatus( // \return SPI Interrupt Mask Status + AT91PS_SPI pSpi) // \arg pointer to a SPI controller +{ + return pSpi->SPI_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_IsInterruptMasked +//* \brief Test if SPI Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_SPI_IsInterruptMasked( + AT91PS_SPI pSpi, // \arg pointer to a SPI controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_SPI_GetInterruptMaskStatus(pSpi) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR USART + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_Baudrate +//* \brief Calculate the baudrate +//* Standard Asynchronous Mode : 8 bits , 1 stop , no parity +#define AT91C_US_ASYNC_MODE ( AT91C_US_USMODE_NORMAL + \ + AT91C_US_NBSTOP_1_BIT + \ + AT91C_US_PAR_NONE + \ + AT91C_US_CHRL_8_BITS + \ + AT91C_US_CLKS_CLOCK ) + +//* Standard External Asynchronous Mode : 8 bits , 1 stop , no parity +#define AT91C_US_ASYNC_SCK_MODE ( AT91C_US_USMODE_NORMAL + \ + AT91C_US_NBSTOP_1_BIT + \ + AT91C_US_PAR_NONE + \ + AT91C_US_CHRL_8_BITS + \ + AT91C_US_CLKS_EXT ) + +//* Standard Synchronous Mode : 8 bits , 1 stop , no parity +#define AT91C_US_SYNC_MODE ( AT91C_US_SYNC + \ + AT91C_US_USMODE_NORMAL + \ + AT91C_US_NBSTOP_1_BIT + \ + AT91C_US_PAR_NONE + \ + AT91C_US_CHRL_8_BITS + \ + AT91C_US_CLKS_CLOCK ) + +//* SCK used Label +#define AT91C_US_SCK_USED (AT91C_US_CKLO | AT91C_US_CLKS_EXT) + +//* Standard ISO T=0 Mode : 8 bits , 1 stop , parity +#define AT91C_US_ISO_READER_MODE ( AT91C_US_USMODE_ISO7816_0 + \ + AT91C_US_CLKS_CLOCK +\ + AT91C_US_NBSTOP_1_BIT + \ + AT91C_US_PAR_EVEN + \ + AT91C_US_CHRL_8_BITS + \ + AT91C_US_CKLO +\ + AT91C_US_OVER) + +//* Standard IRDA mode +#define AT91C_US_ASYNC_IRDA_MODE ( AT91C_US_USMODE_IRDA + \ + AT91C_US_NBSTOP_1_BIT + \ + AT91C_US_PAR_NONE + \ + AT91C_US_CHRL_8_BITS + \ + AT91C_US_CLKS_CLOCK ) + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_Baudrate +//* \brief Caluculate baud_value according to the main clock and the baud rate +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_US_Baudrate ( + const unsigned int main_clock, // \arg peripheral clock + const unsigned int baud_rate) // \arg UART baudrate +{ + unsigned int baud_value = ((main_clock*10)/(baud_rate * 16)); + if ((baud_value % 10) >= 5) + baud_value = (baud_value / 10) + 1; + else + baud_value /= 10; + return baud_value; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_SetBaudrate +//* \brief Set the baudrate according to the CPU clock +//*---------------------------------------------------------------------------- +__inline void AT91F_US_SetBaudrate ( + AT91PS_USART pUSART, // \arg pointer to a USART controller + unsigned int mainClock, // \arg peripheral clock + unsigned int speed) // \arg UART baudrate +{ + //* Define the baud rate divisor register + pUSART->US_BRGR = AT91F_US_Baudrate(mainClock, speed); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_SetTimeguard +//* \brief Set USART timeguard +//*---------------------------------------------------------------------------- +__inline void AT91F_US_SetTimeguard ( + AT91PS_USART pUSART, // \arg pointer to a USART controller + unsigned int timeguard) // \arg timeguard value +{ + //* Write the Timeguard Register + pUSART->US_TTGR = timeguard ; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_EnableIt +//* \brief Enable USART IT +//*---------------------------------------------------------------------------- +__inline void AT91F_US_EnableIt ( + AT91PS_USART pUSART, // \arg pointer to a USART controller + unsigned int flag) // \arg IT to be enabled +{ + //* Write to the IER register + pUSART->US_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_DisableIt +//* \brief Disable USART IT +//*---------------------------------------------------------------------------- +__inline void AT91F_US_DisableIt ( + AT91PS_USART pUSART, // \arg pointer to a USART controller + unsigned int flag) // \arg IT to be disabled +{ + //* Write to the IER register + pUSART->US_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_Configure +//* \brief Configure USART +//*---------------------------------------------------------------------------- +__inline void AT91F_US_Configure ( + AT91PS_USART pUSART, // \arg pointer to a USART controller + unsigned int mainClock, // \arg peripheral clock + unsigned int mode , // \arg mode Register to be programmed + unsigned int baudRate , // \arg baudrate to be programmed + unsigned int timeguard ) // \arg timeguard to be programmed +{ + //* Disable interrupts + pUSART->US_IDR = (unsigned int) -1; + + //* Reset receiver and transmitter + pUSART->US_CR = AT91C_US_RSTRX | AT91C_US_RSTTX | AT91C_US_RXDIS | AT91C_US_TXDIS ; + + //* Define the baud rate divisor register + AT91F_US_SetBaudrate(pUSART, mainClock, baudRate); + + //* Write the Timeguard Register + AT91F_US_SetTimeguard(pUSART, timeguard); + + //* Clear Transmit and Receive Counters + AT91F_PDC_Open((AT91PS_PDC) &(pUSART->US_RPR)); + + //* Define the USART mode + pUSART->US_MR = mode ; + +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_EnableRx +//* \brief Enable receiving characters +//*---------------------------------------------------------------------------- +__inline void AT91F_US_EnableRx ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Enable receiver + pUSART->US_CR = AT91C_US_RXEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_EnableTx +//* \brief Enable sending characters +//*---------------------------------------------------------------------------- +__inline void AT91F_US_EnableTx ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Enable transmitter + pUSART->US_CR = AT91C_US_TXEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_ResetRx +//* \brief Reset Receiver and re-enable it +//*---------------------------------------------------------------------------- +__inline void AT91F_US_ResetRx ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Reset receiver + pUSART->US_CR = AT91C_US_RSTRX; + //* Re-Enable receiver + pUSART->US_CR = AT91C_US_RXEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_ResetTx +//* \brief Reset Transmitter and re-enable it +//*---------------------------------------------------------------------------- +__inline void AT91F_US_ResetTx ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Reset transmitter + pUSART->US_CR = AT91C_US_RSTTX; + //* Enable transmitter + pUSART->US_CR = AT91C_US_TXEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_DisableRx +//* \brief Disable Receiver +//*---------------------------------------------------------------------------- +__inline void AT91F_US_DisableRx ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Disable receiver + pUSART->US_CR = AT91C_US_RXDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_DisableTx +//* \brief Disable Transmitter +//*---------------------------------------------------------------------------- +__inline void AT91F_US_DisableTx ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Disable transmitter + pUSART->US_CR = AT91C_US_TXDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_Close +//* \brief Close USART: disable IT disable receiver and transmitter, close PDC +//*---------------------------------------------------------------------------- +__inline void AT91F_US_Close ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Reset the baud rate divisor register + pUSART->US_BRGR = 0 ; + + //* Reset the USART mode + pUSART->US_MR = 0 ; + + //* Reset the Timeguard Register + pUSART->US_TTGR = 0; + + //* Disable all interrupts + pUSART->US_IDR = 0xFFFFFFFF ; + + //* Abort the Peripheral Data Transfers + AT91F_PDC_Close((AT91PS_PDC) &(pUSART->US_RPR)); + + //* Disable receiver and transmitter and stop any activity immediately + pUSART->US_CR = AT91C_US_TXDIS | AT91C_US_RXDIS | AT91C_US_RSTTX | AT91C_US_RSTRX ; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_TxReady +//* \brief Return 1 if a character can be written in US_THR +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_US_TxReady ( + AT91PS_USART pUSART ) // \arg pointer to a USART controller +{ + return (pUSART->US_CSR & AT91C_US_TXRDY); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_RxReady +//* \brief Return 1 if a character can be read in US_RHR +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_US_RxReady ( + AT91PS_USART pUSART ) // \arg pointer to a USART controller +{ + return (pUSART->US_CSR & AT91C_US_RXRDY); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_Error +//* \brief Return the error flag +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_US_Error ( + AT91PS_USART pUSART ) // \arg pointer to a USART controller +{ + return (pUSART->US_CSR & + (AT91C_US_OVRE | // Overrun error + AT91C_US_FRAME | // Framing error + AT91C_US_PARE)); // Parity error +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_PutChar +//* \brief Send a character,does not check if ready to send +//*---------------------------------------------------------------------------- +__inline void AT91F_US_PutChar ( + AT91PS_USART pUSART, + int character ) +{ + pUSART->US_THR = (character & 0x1FF); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_GetChar +//* \brief Receive a character,does not check if a character is available +//*---------------------------------------------------------------------------- +__inline int AT91F_US_GetChar ( + const AT91PS_USART pUSART) +{ + return((pUSART->US_RHR) & 0x1FF); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_SendFrame +//* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initializaed with Next Buffer, 0 if PDC is busy +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_US_SendFrame( + AT91PS_USART pUSART, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + return AT91F_PDC_SendFrame( + (AT91PS_PDC) &(pUSART->US_RPR), + pBuffer, + szBuffer, + pNextBuffer, + szNextBuffer); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_ReceiveFrame +//* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initializaed with Next Buffer, 0 if PDC is busy +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_US_ReceiveFrame ( + AT91PS_USART pUSART, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + return AT91F_PDC_ReceiveFrame( + (AT91PS_PDC) &(pUSART->US_RPR), + pBuffer, + szBuffer, + pNextBuffer, + szNextBuffer); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_SetIrdaFilter +//* \brief Set the value of IrDa filter tregister +//*---------------------------------------------------------------------------- +__inline void AT91F_US_SetIrdaFilter ( + AT91PS_USART pUSART, + unsigned char value +) +{ + pUSART->US_IF = value; +} + +/* ***************************************************************************** + SOFTWARE API FOR SSC + ***************************************************************************** */ +//* Define the standard I2S mode configuration + +//* Configuration to set in the SSC Transmit Clock Mode Register +//* Parameters : nb_bit_by_slot : 8, 16 or 32 bits +//* nb_slot_by_frame : number of channels +#define AT91C_I2S_ASY_MASTER_TX_SETTING(nb_bit_by_slot, nb_slot_by_frame)( +\ + AT91C_SSC_CKS_DIV +\ + AT91C_SSC_CKO_CONTINOUS +\ + AT91C_SSC_CKG_NONE +\ + AT91C_SSC_START_FALL_RF +\ + AT91C_SSC_STTOUT +\ + ((1<<16) & AT91C_SSC_STTDLY) +\ + ((((nb_bit_by_slot*nb_slot_by_frame)/2)-1) <<24)) + + +//* Configuration to set in the SSC Transmit Frame Mode Register +//* Parameters : nb_bit_by_slot : 8, 16 or 32 bits +//* nb_slot_by_frame : number of channels +#define AT91C_I2S_ASY_TX_FRAME_SETTING(nb_bit_by_slot, nb_slot_by_frame)( +\ + (nb_bit_by_slot-1) +\ + AT91C_SSC_MSBF +\ + (((nb_slot_by_frame-1)<<8) & AT91C_SSC_DATNB) +\ + (((nb_bit_by_slot-1)<<16) & AT91C_SSC_FSLEN) +\ + AT91C_SSC_FSOS_NEGATIVE) + + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_SetBaudrate +//* \brief Set the baudrate according to the CPU clock +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_SetBaudrate ( + AT91PS_SSC pSSC, // \arg pointer to a SSC controller + unsigned int mainClock, // \arg peripheral clock + unsigned int speed) // \arg SSC baudrate +{ + unsigned int baud_value; + //* Define the baud rate divisor register + if (speed == 0) + baud_value = 0; + else + { + baud_value = (unsigned int) (mainClock * 10)/(2*speed); + if ((baud_value % 10) >= 5) + baud_value = (baud_value / 10) + 1; + else + baud_value /= 10; + } + + pSSC->SSC_CMR = baud_value; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_Configure +//* \brief Configure SSC +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_Configure ( + AT91PS_SSC pSSC, // \arg pointer to a SSC controller + unsigned int syst_clock, // \arg System Clock Frequency + unsigned int baud_rate, // \arg Expected Baud Rate Frequency + unsigned int clock_rx, // \arg Receiver Clock Parameters + unsigned int mode_rx, // \arg mode Register to be programmed + unsigned int clock_tx, // \arg Transmitter Clock Parameters + unsigned int mode_tx) // \arg mode Register to be programmed +{ + //* Disable interrupts + pSSC->SSC_IDR = (unsigned int) -1; + + //* Reset receiver and transmitter + pSSC->SSC_CR = AT91C_SSC_SWRST | AT91C_SSC_RXDIS | AT91C_SSC_TXDIS ; + + //* Define the Clock Mode Register + AT91F_SSC_SetBaudrate(pSSC, syst_clock, baud_rate); + + //* Write the Receive Clock Mode Register + pSSC->SSC_RCMR = clock_rx; + + //* Write the Transmit Clock Mode Register + pSSC->SSC_TCMR = clock_tx; + + //* Write the Receive Frame Mode Register + pSSC->SSC_RFMR = mode_rx; + + //* Write the Transmit Frame Mode Register + pSSC->SSC_TFMR = mode_tx; + + //* Clear Transmit and Receive Counters + AT91F_PDC_Open((AT91PS_PDC) &(pSSC->SSC_RPR)); + + +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_EnableRx +//* \brief Enable receiving datas +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_EnableRx ( + AT91PS_SSC pSSC) // \arg pointer to a SSC controller +{ + //* Enable receiver + pSSC->SSC_CR = AT91C_SSC_RXEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_DisableRx +//* \brief Disable receiving datas +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_DisableRx ( + AT91PS_SSC pSSC) // \arg pointer to a SSC controller +{ + //* Disable receiver + pSSC->SSC_CR = AT91C_SSC_RXDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_EnableTx +//* \brief Enable sending datas +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_EnableTx ( + AT91PS_SSC pSSC) // \arg pointer to a SSC controller +{ + //* Enable transmitter + pSSC->SSC_CR = AT91C_SSC_TXEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_DisableTx +//* \brief Disable sending datas +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_DisableTx ( + AT91PS_SSC pSSC) // \arg pointer to a SSC controller +{ + //* Disable transmitter + pSSC->SSC_CR = AT91C_SSC_TXDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_EnableIt +//* \brief Enable SSC IT +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_EnableIt ( + AT91PS_SSC pSSC, // \arg pointer to a SSC controller + unsigned int flag) // \arg IT to be enabled +{ + //* Write to the IER register + pSSC->SSC_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_DisableIt +//* \brief Disable SSC IT +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_DisableIt ( + AT91PS_SSC pSSC, // \arg pointer to a SSC controller + unsigned int flag) // \arg IT to be disabled +{ + //* Write to the IDR register + pSSC->SSC_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_ReceiveFrame +//* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initialized with Next Buffer, 0 if PDC is busy +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_SSC_ReceiveFrame ( + AT91PS_SSC pSSC, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + return AT91F_PDC_ReceiveFrame( + (AT91PS_PDC) &(pSSC->SSC_RPR), + pBuffer, + szBuffer, + pNextBuffer, + szNextBuffer); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_SendFrame +//* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initialized with Next Buffer, 0 if PDC is busy +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_SSC_SendFrame( + AT91PS_SSC pSSC, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + return AT91F_PDC_SendFrame( + (AT91PS_PDC) &(pSSC->SSC_RPR), + pBuffer, + szBuffer, + pNextBuffer, + szNextBuffer); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_GetInterruptMaskStatus +//* \brief Return SSC Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_SSC_GetInterruptMaskStatus( // \return SSC Interrupt Mask Status + AT91PS_SSC pSsc) // \arg pointer to a SSC controller +{ + return pSsc->SSC_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_IsInterruptMasked +//* \brief Test if SSC Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_SSC_IsInterruptMasked( + AT91PS_SSC pSsc, // \arg pointer to a SSC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_SSC_GetInterruptMaskStatus(pSsc) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR TWI + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_EnableIt +//* \brief Enable TWI IT +//*---------------------------------------------------------------------------- +__inline void AT91F_TWI_EnableIt ( + AT91PS_TWI pTWI, // \arg pointer to a TWI controller + unsigned int flag) // \arg IT to be enabled +{ + //* Write to the IER register + pTWI->TWI_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_DisableIt +//* \brief Disable TWI IT +//*---------------------------------------------------------------------------- +__inline void AT91F_TWI_DisableIt ( + AT91PS_TWI pTWI, // \arg pointer to a TWI controller + unsigned int flag) // \arg IT to be disabled +{ + //* Write to the IDR register + pTWI->TWI_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_Configure +//* \brief Configure TWI in master mode +//*---------------------------------------------------------------------------- +__inline void AT91F_TWI_Configure ( AT91PS_TWI pTWI ) // \arg pointer to a TWI controller +{ + //* Disable interrupts + pTWI->TWI_IDR = (unsigned int) -1; + + //* Reset peripheral + pTWI->TWI_CR = AT91C_TWI_SWRST; + + //* Set Master mode + pTWI->TWI_CR = AT91C_TWI_MSEN; + +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_GetInterruptMaskStatus +//* \brief Return TWI Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_TWI_GetInterruptMaskStatus( // \return TWI Interrupt Mask Status + AT91PS_TWI pTwi) // \arg pointer to a TWI controller +{ + return pTwi->TWI_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_IsInterruptMasked +//* \brief Test if TWI Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_TWI_IsInterruptMasked( + AT91PS_TWI pTwi, // \arg pointer to a TWI controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_TWI_GetInterruptMaskStatus(pTwi) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR PWMC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_GetStatus +//* \brief Return PWM Interrupt Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PWMC_GetStatus( // \return PWM Interrupt Status + AT91PS_PWMC pPWM) // pointer to a PWM controller +{ + return pPWM->PWMC_SR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_InterruptEnable +//* \brief Enable PWM Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_InterruptEnable( + AT91PS_PWMC pPwm, // \arg pointer to a PWM controller + unsigned int flag) // \arg PWM interrupt to be enabled +{ + pPwm->PWMC_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_InterruptDisable +//* \brief Disable PWM Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_InterruptDisable( + AT91PS_PWMC pPwm, // \arg pointer to a PWM controller + unsigned int flag) // \arg PWM interrupt to be disabled +{ + pPwm->PWMC_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_GetInterruptMaskStatus +//* \brief Return PWM Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PWMC_GetInterruptMaskStatus( // \return PWM Interrupt Mask Status + AT91PS_PWMC pPwm) // \arg pointer to a PWM controller +{ + return pPwm->PWMC_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_IsInterruptMasked +//* \brief Test if PWM Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PWMC_IsInterruptMasked( + AT91PS_PWMC pPWM, // \arg pointer to a PWM controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PWMC_GetInterruptMaskStatus(pPWM) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_IsStatusSet +//* \brief Test if PWM Interrupt is Set +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PWMC_IsStatusSet( + AT91PS_PWMC pPWM, // \arg pointer to a PWM controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PWMC_GetStatus(pPWM) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_CfgChannel +//* \brief Test if PWM Interrupt is Set +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_CfgChannel( + AT91PS_PWMC pPWM, // \arg pointer to a PWM controller + unsigned int channelId, // \arg PWM channel ID + unsigned int mode, // \arg PWM mode + unsigned int period, // \arg PWM period + unsigned int duty) // \arg PWM duty cycle +{ + pPWM->PWMC_CH[channelId].PWMC_CMR = mode; + pPWM->PWMC_CH[channelId].PWMC_CDTYR = duty; + pPWM->PWMC_CH[channelId].PWMC_CPRDR = period; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_StartChannel +//* \brief Enable channel +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_StartChannel( + AT91PS_PWMC pPWM, // \arg pointer to a PWM controller + unsigned int flag) // \arg Channels IDs to be enabled +{ + pPWM->PWMC_ENA = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_StopChannel +//* \brief Disable channel +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_StopChannel( + AT91PS_PWMC pPWM, // \arg pointer to a PWM controller + unsigned int flag) // \arg Channels IDs to be enabled +{ + pPWM->PWMC_DIS = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_UpdateChannel +//* \brief Update Period or Duty Cycle +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_UpdateChannel( + AT91PS_PWMC pPWM, // \arg pointer to a PWM controller + unsigned int channelId, // \arg PWM channel ID + unsigned int update) // \arg Channels IDs to be enabled +{ + pPWM->PWMC_CH[channelId].PWMC_CUPDR = update; +} + +/* ***************************************************************************** + SOFTWARE API FOR UDP + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EnableIt +//* \brief Enable UDP IT +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EnableIt ( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned int flag) // \arg IT to be enabled +{ + //* Write to the IER register + pUDP->UDP_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_DisableIt +//* \brief Disable UDP IT +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_DisableIt ( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned int flag) // \arg IT to be disabled +{ + //* Write to the IDR register + pUDP->UDP_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_SetAddress +//* \brief Set UDP functional address +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_SetAddress ( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char address) // \arg new UDP address +{ + pUDP->UDP_FADDR = (AT91C_UDP_FEN | address); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EnableEp +//* \brief Enable Endpoint +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EnableEp ( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint) // \arg endpoint number +{ + pUDP->UDP_CSR[endpoint] |= AT91C_UDP_EPEDS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_DisableEp +//* \brief Enable Endpoint +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_DisableEp ( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint) // \arg endpoint number +{ + pUDP->UDP_CSR[endpoint] &= ~AT91C_UDP_EPEDS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_SetState +//* \brief Set UDP Device state +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_SetState ( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned int flag) // \arg new UDP address +{ + pUDP->UDP_GLBSTATE &= ~(AT91C_UDP_FADDEN | AT91C_UDP_CONFG); + pUDP->UDP_GLBSTATE |= flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_GetState +//* \brief return UDP Device state +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_UDP_GetState ( // \return the UDP device state + AT91PS_UDP pUDP) // \arg pointer to a UDP controller +{ + return (pUDP->UDP_GLBSTATE & (AT91C_UDP_FADDEN | AT91C_UDP_CONFG)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_ResetEp +//* \brief Reset UDP endpoint +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_ResetEp ( // \return the UDP device state + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned int flag) // \arg Endpoints to be reset +{ + pUDP->UDP_RSTEP = flag; + pUDP->UDP_RSTEP = 0; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpStall +//* \brief Endpoint will STALL requests +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EpStall( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint) // \arg endpoint number +{ + pUDP->UDP_CSR[endpoint] |= AT91C_UDP_FORCESTALL; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpWrite +//* \brief Write value in the DPR +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EpWrite( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint, // \arg endpoint number + unsigned char value) // \arg value to be written in the DPR +{ + pUDP->UDP_FDR[endpoint] = value; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpRead +//* \brief Return value from the DPR +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_UDP_EpRead( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint) // \arg endpoint number +{ + return pUDP->UDP_FDR[endpoint]; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpEndOfWr +//* \brief Notify the UDP that values in DPR are ready to be sent +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EpEndOfWr( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint) // \arg endpoint number +{ + pUDP->UDP_CSR[endpoint] |= AT91C_UDP_TXPKTRDY; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpClear +//* \brief Clear flag in the endpoint CSR register +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EpClear( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint, // \arg endpoint number + unsigned int flag) // \arg flag to be cleared +{ + pUDP->UDP_CSR[endpoint] &= ~(flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpSet +//* \brief Set flag in the endpoint CSR register +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EpSet( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint, // \arg endpoint number + unsigned int flag) // \arg flag to be cleared +{ + pUDP->UDP_CSR[endpoint] |= flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpStatus +//* \brief Return the endpoint CSR register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_UDP_EpStatus( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint) // \arg endpoint number +{ + return pUDP->UDP_CSR[endpoint]; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_GetInterruptMaskStatus +//* \brief Return UDP Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_UDP_GetInterruptMaskStatus( + AT91PS_UDP pUdp) // \arg pointer to a UDP controller +{ + return pUdp->UDP_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_IsInterruptMasked +//* \brief Test if UDP Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_UDP_IsInterruptMasked( + AT91PS_UDP pUdp, // \arg pointer to a UDP controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_UDP_GetInterruptMaskStatus(pUdp) & flag); +} + +// ---------------------------------------------------------------------------- +// \fn AT91F_UDP_InterruptStatusRegister +// \brief Return the Interrupt Status Register +// ---------------------------------------------------------------------------- +__inline unsigned int AT91F_UDP_InterruptStatusRegister( + AT91PS_UDP pUDP ) // \arg pointer to a UDP controller +{ + return pUDP->UDP_ISR; +} + +// ---------------------------------------------------------------------------- +// \fn AT91F_UDP_InterruptClearRegister +// \brief Clear Interrupt Register +// ---------------------------------------------------------------------------- +__inline void AT91F_UDP_InterruptClearRegister ( + AT91PS_UDP pUDP, // \arg pointer to UDP controller + unsigned int flag) // \arg IT to be cleat +{ + pUDP->UDP_ICR = flag; +} + +// ---------------------------------------------------------------------------- +// \fn AT91F_UDP_EnableTransceiver +// \brief Enable transceiver +// ---------------------------------------------------------------------------- +__inline void AT91F_UDP_EnableTransceiver( + AT91PS_UDP pUDP ) // \arg pointer to a UDP controller +{ + pUDP->UDP_TXVC &= ~AT91C_UDP_TXVDIS; +} + +// ---------------------------------------------------------------------------- +// \fn AT91F_UDP_DisableTransceiver +// \brief Disable transceiver +// ---------------------------------------------------------------------------- +__inline void AT91F_UDP_DisableTransceiver( + AT91PS_UDP pUDP ) // \arg pointer to a UDP controller +{ + pUDP->UDP_TXVC = AT91C_UDP_TXVDIS; +} + +/* ***************************************************************************** + SOFTWARE API FOR TC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC_InterruptEnable +//* \brief Enable TC Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_TC_InterruptEnable( + AT91PS_TC pTc, // \arg pointer to a TC controller + unsigned int flag) // \arg TC interrupt to be enabled +{ + pTc->TC_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC_InterruptDisable +//* \brief Disable TC Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_TC_InterruptDisable( + AT91PS_TC pTc, // \arg pointer to a TC controller + unsigned int flag) // \arg TC interrupt to be disabled +{ + pTc->TC_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC_GetInterruptMaskStatus +//* \brief Return TC Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_TC_GetInterruptMaskStatus( // \return TC Interrupt Mask Status + AT91PS_TC pTc) // \arg pointer to a TC controller +{ + return pTc->TC_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC_IsInterruptMasked +//* \brief Test if TC Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_TC_IsInterruptMasked( + AT91PS_TC pTc, // \arg pointer to a TC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_TC_GetInterruptMaskStatus(pTc) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR CAN + ***************************************************************************** */ +#define STANDARD_FORMAT 0 +#define EXTENDED_FORMAT 1 + +//*---------------------------------------------------------------------------- +//* \fn AT91F_InitMailboxRegisters() +//* \brief Configure the corresponding mailbox +//*---------------------------------------------------------------------------- +__inline void AT91F_InitMailboxRegisters(AT91PS_CAN_MB CAN_Mailbox, + int mode_reg, + int acceptance_mask_reg, + int id_reg, + int data_low_reg, + int data_high_reg, + int control_reg) +{ + CAN_Mailbox->CAN_MB_MCR = 0x0; + CAN_Mailbox->CAN_MB_MMR = mode_reg; + CAN_Mailbox->CAN_MB_MAM = acceptance_mask_reg; + CAN_Mailbox->CAN_MB_MID = id_reg; + CAN_Mailbox->CAN_MB_MDL = data_low_reg; + CAN_Mailbox->CAN_MB_MDH = data_high_reg; + CAN_Mailbox->CAN_MB_MCR = control_reg; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_EnableCAN() +//* \brief +//*---------------------------------------------------------------------------- +__inline void AT91F_EnableCAN( + AT91PS_CAN pCAN) // pointer to a CAN controller +{ + pCAN->CAN_MR |= AT91C_CAN_CANEN; + + // Wait for WAKEUP flag raising <=> 11-recessive-bit were scanned by the transceiver + while( (pCAN->CAN_SR & AT91C_CAN_WAKEUP) != AT91C_CAN_WAKEUP ); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_DisableCAN() +//* \brief +//*---------------------------------------------------------------------------- +__inline void AT91F_DisableCAN( + AT91PS_CAN pCAN) // pointer to a CAN controller +{ + pCAN->CAN_MR &= ~AT91C_CAN_CANEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_EnableIt +//* \brief Enable CAN interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_EnableIt ( + AT91PS_CAN pCAN, // pointer to a CAN controller + unsigned int flag) // IT to be enabled +{ + //* Write to the IER register + pCAN->CAN_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_DisableIt +//* \brief Disable CAN interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_DisableIt ( + AT91PS_CAN pCAN, // pointer to a CAN controller + unsigned int flag) // IT to be disabled +{ + //* Write to the IDR register + pCAN->CAN_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetStatus +//* \brief Return CAN Interrupt Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetStatus( // \return CAN Interrupt Status + AT91PS_CAN pCAN) // pointer to a CAN controller +{ + return pCAN->CAN_SR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetInterruptMaskStatus +//* \brief Return CAN Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetInterruptMaskStatus( // \return CAN Interrupt Mask Status + AT91PS_CAN pCAN) // pointer to a CAN controller +{ + return pCAN->CAN_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_IsInterruptMasked +//* \brief Test if CAN Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_IsInterruptMasked( + AT91PS_CAN pCAN, // \arg pointer to a CAN controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_CAN_GetInterruptMaskStatus(pCAN) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_IsStatusSet +//* \brief Test if CAN Interrupt is Set +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_IsStatusSet( + AT91PS_CAN pCAN, // \arg pointer to a CAN controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_CAN_GetStatus(pCAN) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgModeReg +//* \brief Configure the Mode Register of the CAN controller +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgModeReg ( + AT91PS_CAN pCAN, // pointer to a CAN controller + unsigned int mode) // mode register +{ + //* Write to the MR register + pCAN->CAN_MR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetModeReg +//* \brief Return the Mode Register of the CAN controller value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetModeReg ( + AT91PS_CAN pCAN // pointer to a CAN controller + ) +{ + return pCAN->CAN_MR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgBaudrateReg +//* \brief Configure the Baudrate of the CAN controller for the network +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgBaudrateReg ( + AT91PS_CAN pCAN, // pointer to a CAN controller + unsigned int baudrate_cfg) +{ + //* Write to the BR register + pCAN->CAN_BR = baudrate_cfg; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetBaudrate +//* \brief Return the Baudrate of the CAN controller for the network value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetBaudrate ( + AT91PS_CAN pCAN // pointer to a CAN controller + ) +{ + return pCAN->CAN_BR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetInternalCounter +//* \brief Return CAN Timer Regsiter Value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetInternalCounter ( + AT91PS_CAN pCAN // pointer to a CAN controller + ) +{ + return pCAN->CAN_TIM; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetTimestamp +//* \brief Return CAN Timestamp Register Value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetTimestamp ( + AT91PS_CAN pCAN // pointer to a CAN controller + ) +{ + return pCAN->CAN_TIMESTP; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetErrorCounter +//* \brief Return CAN Error Counter Register Value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetErrorCounter ( + AT91PS_CAN pCAN // pointer to a CAN controller + ) +{ + return pCAN->CAN_ECR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_InitTransferRequest +//* \brief Request for a transfer on the corresponding mailboxes +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_InitTransferRequest ( + AT91PS_CAN pCAN, // pointer to a CAN controller + unsigned int transfer_cmd) +{ + pCAN->CAN_TCR = transfer_cmd; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_InitAbortRequest +//* \brief Abort the corresponding mailboxes +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_InitAbortRequest ( + AT91PS_CAN pCAN, // pointer to a CAN controller + unsigned int abort_cmd) +{ + pCAN->CAN_ACR = abort_cmd; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgMessageModeReg +//* \brief Program the Message Mode Register +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgMessageModeReg ( + AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox + unsigned int mode) +{ + CAN_Mailbox->CAN_MB_MMR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetMessageModeReg +//* \brief Return the Message Mode Register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetMessageModeReg ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgMessageIDReg +//* \brief Program the Message ID Register +//* \brief Version == 0 for Standard messsage, Version == 1 for Extended +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgMessageIDReg ( + AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox + unsigned int id, + unsigned char version) +{ + if(version==0) // IDvA Standard Format + CAN_Mailbox->CAN_MB_MID = id<<18; + else // IDvB Extended Format + CAN_Mailbox->CAN_MB_MID = id | (1<<29); // set MIDE bit +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetMessageIDReg +//* \brief Return the Message ID Register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetMessageIDReg ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MID; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgMessageAcceptanceMaskReg +//* \brief Program the Message Acceptance Mask Register +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgMessageAcceptanceMaskReg ( + AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox + unsigned int mask) +{ + CAN_Mailbox->CAN_MB_MAM = mask; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetMessageAcceptanceMaskReg +//* \brief Return the Message Acceptance Mask Register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetMessageAcceptanceMaskReg ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MAM; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetFamilyID +//* \brief Return the Message ID Register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetFamilyID ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MFID; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgMessageCtrl +//* \brief Request and config for a transfer on the corresponding mailbox +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgMessageCtrlReg ( + AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox + unsigned int message_ctrl_cmd) +{ + CAN_Mailbox->CAN_MB_MCR = message_ctrl_cmd; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetMessageStatus +//* \brief Return CAN Mailbox Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetMessageStatus ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgMessageDataLow +//* \brief Program data low value +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgMessageDataLow ( + AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox + unsigned int data) +{ + CAN_Mailbox->CAN_MB_MDL = data; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetMessageDataLow +//* \brief Return data low value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetMessageDataLow ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MDL; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgMessageDataHigh +//* \brief Program data high value +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgMessageDataHigh ( + AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox + unsigned int data) +{ + CAN_Mailbox->CAN_MB_MDH = data; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetMessageDataHigh +//* \brief Return data high value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetMessageDataHigh ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MDH; +} + +/* ***************************************************************************** + SOFTWARE API FOR ADC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_EnableIt +//* \brief Enable ADC interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_EnableIt ( + AT91PS_ADC pADC, // pointer to a ADC controller + unsigned int flag) // IT to be enabled +{ + //* Write to the IER register + pADC->ADC_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_DisableIt +//* \brief Disable ADC interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_DisableIt ( + AT91PS_ADC pADC, // pointer to a ADC controller + unsigned int flag) // IT to be disabled +{ + //* Write to the IDR register + pADC->ADC_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetStatus +//* \brief Return ADC Interrupt Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetStatus( // \return ADC Interrupt Status + AT91PS_ADC pADC) // pointer to a ADC controller +{ + return pADC->ADC_SR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetInterruptMaskStatus +//* \brief Return ADC Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetInterruptMaskStatus( // \return ADC Interrupt Mask Status + AT91PS_ADC pADC) // pointer to a ADC controller +{ + return pADC->ADC_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_IsInterruptMasked +//* \brief Test if ADC Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_IsInterruptMasked( + AT91PS_ADC pADC, // \arg pointer to a ADC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_ADC_GetInterruptMaskStatus(pADC) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_IsStatusSet +//* \brief Test if ADC Status is Set +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_IsStatusSet( + AT91PS_ADC pADC, // \arg pointer to a ADC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_ADC_GetStatus(pADC) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_CfgModeReg +//* \brief Configure the Mode Register of the ADC controller +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_CfgModeReg ( + AT91PS_ADC pADC, // pointer to a ADC controller + unsigned int mode) // mode register +{ + //* Write to the MR register + pADC->ADC_MR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetModeReg +//* \brief Return the Mode Register of the ADC controller value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetModeReg ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_MR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_CfgTimings +//* \brief Configure the different necessary timings of the ADC controller +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_CfgTimings ( + AT91PS_ADC pADC, // pointer to a ADC controller + unsigned int mck_clock, // in MHz + unsigned int adc_clock, // in MHz + unsigned int startup_time, // in us + unsigned int sample_and_hold_time) // in ns +{ + unsigned int prescal,startup,shtim; + + prescal = mck_clock/(2*adc_clock) - 1; + startup = adc_clock*startup_time/8 - 1; + shtim = adc_clock*sample_and_hold_time/1000 - 1; + + //* Write to the MR register + pADC->ADC_MR = ( (prescal<<8) & AT91C_ADC_PRESCAL) | ( (startup<<16) & AT91C_ADC_STARTUP) | ( (shtim<<24) & AT91C_ADC_SHTIM); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_EnableChannel +//* \brief Return ADC Timer Register Value +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_EnableChannel ( + AT91PS_ADC pADC, // pointer to a ADC controller + unsigned int channel) // mode register +{ + //* Write to the CHER register + pADC->ADC_CHER = channel; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_DisableChannel +//* \brief Return ADC Timer Register Value +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_DisableChannel ( + AT91PS_ADC pADC, // pointer to a ADC controller + unsigned int channel) // mode register +{ + //* Write to the CHDR register + pADC->ADC_CHDR = channel; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetChannelStatus +//* \brief Return ADC Timer Register Value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetChannelStatus ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CHSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_StartConversion +//* \brief Software request for a analog to digital conversion +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_StartConversion ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + pADC->ADC_CR = AT91C_ADC_START; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_SoftReset +//* \brief Software reset +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_SoftReset ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + pADC->ADC_CR = AT91C_ADC_SWRST; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetLastConvertedData +//* \brief Return the Last Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetLastConvertedData ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_LCDR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH0 +//* \brief Return the Channel 0 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH0 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR0; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH1 +//* \brief Return the Channel 1 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH1 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR1; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH2 +//* \brief Return the Channel 2 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH2 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR2; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH3 +//* \brief Return the Channel 3 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH3 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR3; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH4 +//* \brief Return the Channel 4 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH4 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR4; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH5 +//* \brief Return the Channel 5 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH5 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR5; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH6 +//* \brief Return the Channel 6 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH6 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR6; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH7 +//* \brief Return the Channel 7 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH7 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR7; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_DBGU_CfgPMC +//* \brief Enable Peripheral clock in PMC for DBGU +//*---------------------------------------------------------------------------- +__inline void AT91F_DBGU_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_DBGU_CfgPIO +//* \brief Configure PIO controllers to drive DBGU signals +//*---------------------------------------------------------------------------- +__inline void AT91F_DBGU_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA27_DRXD ) | + ((unsigned int) AT91C_PA28_DTXD ), // Peripheral A + 0); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_CfgPMC +//* \brief Enable Peripheral clock in PMC for PMC +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_CfgPIO +//* \brief Configure PIO controllers to drive PMC signals +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB30_PCK2 ) | + ((unsigned int) AT91C_PB29_PCK1 ), // Peripheral A + ((unsigned int) AT91C_PB20_PCK0 ) | + ((unsigned int) AT91C_PB0_PCK0 ) | + ((unsigned int) AT91C_PB22_PCK2 ) | + ((unsigned int) AT91C_PB21_PCK1 )); // Peripheral B + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PA30_PCK2 ) | + ((unsigned int) AT91C_PA13_PCK1 ) | + ((unsigned int) AT91C_PA27_PCK3 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_VREG_CfgPMC +//* \brief Enable Peripheral clock in PMC for VREG +//*---------------------------------------------------------------------------- +__inline void AT91F_VREG_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_RSTC_CfgPMC +//* \brief Enable Peripheral clock in PMC for RSTC +//*---------------------------------------------------------------------------- +__inline void AT91F_RSTC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_CfgPMC +//* \brief Enable Peripheral clock in PMC for SSC +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SSC)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_CfgPIO +//* \brief Configure PIO controllers to drive SSC signals +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA25_RK ) | + ((unsigned int) AT91C_PA22_TK ) | + ((unsigned int) AT91C_PA21_TF ) | + ((unsigned int) AT91C_PA24_RD ) | + ((unsigned int) AT91C_PA26_RF ) | + ((unsigned int) AT91C_PA23_TD ), // Peripheral A + 0); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_WDTC_CfgPMC +//* \brief Enable Peripheral clock in PMC for WDTC +//*---------------------------------------------------------------------------- +__inline void AT91F_WDTC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US1_CfgPMC +//* \brief Enable Peripheral clock in PMC for US1 +//*---------------------------------------------------------------------------- +__inline void AT91F_US1_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_US1)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US1_CfgPIO +//* \brief Configure PIO controllers to drive US1 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_US1_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PB26_RI1 ) | + ((unsigned int) AT91C_PB24_DSR1 ) | + ((unsigned int) AT91C_PB23_DCD1 ) | + ((unsigned int) AT91C_PB25_DTR1 )); // Peripheral B + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA7_SCK1 ) | + ((unsigned int) AT91C_PA8_RTS1 ) | + ((unsigned int) AT91C_PA6_TXD1 ) | + ((unsigned int) AT91C_PA5_RXD1 ) | + ((unsigned int) AT91C_PA9_CTS1 ), // Peripheral A + 0); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US0_CfgPMC +//* \brief Enable Peripheral clock in PMC for US0 +//*---------------------------------------------------------------------------- +__inline void AT91F_US0_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_US0)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US0_CfgPIO +//* \brief Configure PIO controllers to drive US0 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_US0_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA0_RXD0 ) | + ((unsigned int) AT91C_PA4_CTS0 ) | + ((unsigned int) AT91C_PA3_RTS0 ) | + ((unsigned int) AT91C_PA2_SCK0 ) | + ((unsigned int) AT91C_PA1_TXD0 ), // Peripheral A + 0); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI1_CfgPMC +//* \brief Enable Peripheral clock in PMC for SPI1 +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI1_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SPI1)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI1_CfgPIO +//* \brief Configure PIO controllers to drive SPI1 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI1_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PB11_SPI1_NPCS2) | + ((unsigned int) AT91C_PB10_SPI1_NPCS1) | + ((unsigned int) AT91C_PB16_SPI1_NPCS3)); // Peripheral B + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PA22_SPI1_SPCK) | + ((unsigned int) AT91C_PA3_SPI1_NPCS2) | + ((unsigned int) AT91C_PA26_SPI1_NPCS2) | + ((unsigned int) AT91C_PA25_SPI1_NPCS1) | + ((unsigned int) AT91C_PA2_SPI1_NPCS1) | + ((unsigned int) AT91C_PA24_SPI1_MISO) | + ((unsigned int) AT91C_PA4_SPI1_NPCS3) | + ((unsigned int) AT91C_PA29_SPI1_NPCS3) | + ((unsigned int) AT91C_PA21_SPI1_NPCS0) | + ((unsigned int) AT91C_PA23_SPI1_MOSI)); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI0_CfgPMC +//* \brief Enable Peripheral clock in PMC for SPI0 +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI0_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SPI0)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI0_CfgPIO +//* \brief Configure PIO controllers to drive SPI0 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI0_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PB13_SPI0_NPCS1) | + ((unsigned int) AT91C_PB14_SPI0_NPCS2) | + ((unsigned int) AT91C_PB17_SPI0_NPCS3)); // Peripheral B + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA16_SPI0_MISO) | + ((unsigned int) AT91C_PA13_SPI0_NPCS1) | + ((unsigned int) AT91C_PA14_SPI0_NPCS2) | + ((unsigned int) AT91C_PA12_SPI0_NPCS0) | + ((unsigned int) AT91C_PA17_SPI0_MOSI) | + ((unsigned int) AT91C_PA15_SPI0_NPCS3) | + ((unsigned int) AT91C_PA18_SPI0_SPCK), // Peripheral A + ((unsigned int) AT91C_PA7_SPI0_NPCS1) | + ((unsigned int) AT91C_PA8_SPI0_NPCS2) | + ((unsigned int) AT91C_PA9_SPI0_NPCS3)); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITC_CfgPMC +//* \brief Enable Peripheral clock in PMC for PITC +//*---------------------------------------------------------------------------- +__inline void AT91F_PITC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_CfgPMC +//* \brief Enable Peripheral clock in PMC for AIC +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_FIQ) | + ((unsigned int) 1 << AT91C_ID_IRQ0) | + ((unsigned int) 1 << AT91C_ID_IRQ1)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_CfgPIO +//* \brief Configure PIO controllers to drive AIC signals +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA30_IRQ0 ) | + ((unsigned int) AT91C_PA29_FIQ ), // Peripheral A + ((unsigned int) AT91C_PA14_IRQ1 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_CfgPMC +//* \brief Enable Peripheral clock in PMC for TWI +//*---------------------------------------------------------------------------- +__inline void AT91F_TWI_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_TWI)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_CfgPIO +//* \brief Configure PIO controllers to drive TWI signals +//*---------------------------------------------------------------------------- +__inline void AT91F_TWI_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA11_TWCK ) | + ((unsigned int) AT91C_PA10_TWD ), // Peripheral A + 0); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_CfgPMC +//* \brief Enable Peripheral clock in PMC for ADC +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_ADC)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_CfgPIO +//* \brief Configure PIO controllers to drive ADC signals +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PB18_ADTRG )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWMC_CH3_CfgPIO +//* \brief Configure PIO controllers to drive PWMC_CH3 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_CH3_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB22_PWM3 ), // Peripheral A + ((unsigned int) AT91C_PB30_PWM3 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWMC_CH2_CfgPIO +//* \brief Configure PIO controllers to drive PWMC_CH2 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_CH2_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB21_PWM2 ), // Peripheral A + ((unsigned int) AT91C_PB29_PWM2 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWMC_CH1_CfgPIO +//* \brief Configure PIO controllers to drive PWMC_CH1 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_CH1_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB20_PWM1 ), // Peripheral A + ((unsigned int) AT91C_PB28_PWM1 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWMC_CH0_CfgPIO +//* \brief Configure PIO controllers to drive PWMC_CH0 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_CH0_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB19_PWM0 ), // Peripheral A + ((unsigned int) AT91C_PB27_PWM0 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_RTTC_CfgPMC +//* \brief Enable Peripheral clock in PMC for RTTC +//*---------------------------------------------------------------------------- +__inline void AT91F_RTTC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_CfgPMC +//* \brief Enable Peripheral clock in PMC for UDP +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_UDP)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_EMAC_CfgPMC +//* \brief Enable Peripheral clock in PMC for EMAC +//*---------------------------------------------------------------------------- +__inline void AT91F_EMAC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_EMAC)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_EMAC_CfgPIO +//* \brief Configure PIO controllers to drive EMAC signals +//*---------------------------------------------------------------------------- +__inline void AT91F_EMAC_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB2_ETX0 ) | + ((unsigned int) AT91C_PB12_ETXER ) | + ((unsigned int) AT91C_PB16_ECOL ) | + ((unsigned int) AT91C_PB15_ERXDV_ECRSDV) | + ((unsigned int) AT91C_PB11_ETX3 ) | + ((unsigned int) AT91C_PB6_ERX1 ) | + ((unsigned int) AT91C_PB13_ERX2 ) | + ((unsigned int) AT91C_PB3_ETX1 ) | + ((unsigned int) AT91C_PB4_ECRS ) | + ((unsigned int) AT91C_PB8_EMDC ) | + ((unsigned int) AT91C_PB5_ERX0 ) | + ((unsigned int) AT91C_PB18_EF100 ) | + ((unsigned int) AT91C_PB14_ERX3 ) | + ((unsigned int) AT91C_PB1_ETXEN ) | + ((unsigned int) AT91C_PB10_ETX2 ) | + ((unsigned int) AT91C_PB0_ETXCK_EREFCK) | + ((unsigned int) AT91C_PB9_EMDIO ) | + ((unsigned int) AT91C_PB7_ERXER ) | + ((unsigned int) AT91C_PB17_ERXCK ), // Peripheral A + 0); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC0_CfgPMC +//* \brief Enable Peripheral clock in PMC for TC0 +//*---------------------------------------------------------------------------- +__inline void AT91F_TC0_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_TC0)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC0_CfgPIO +//* \brief Configure PIO controllers to drive TC0 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_TC0_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB23_TIOA0 ) | + ((unsigned int) AT91C_PB24_TIOB0 ), // Peripheral A + ((unsigned int) AT91C_PB12_TCLK0 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC1_CfgPMC +//* \brief Enable Peripheral clock in PMC for TC1 +//*---------------------------------------------------------------------------- +__inline void AT91F_TC1_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_TC1)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC1_CfgPIO +//* \brief Configure PIO controllers to drive TC1 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_TC1_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB25_TIOA1 ) | + ((unsigned int) AT91C_PB26_TIOB1 ), // Peripheral A + ((unsigned int) AT91C_PB19_TCLK1 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC2_CfgPMC +//* \brief Enable Peripheral clock in PMC for TC2 +//*---------------------------------------------------------------------------- +__inline void AT91F_TC2_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_TC2)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC2_CfgPIO +//* \brief Configure PIO controllers to drive TC2 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_TC2_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB28_TIOB2 ) | + ((unsigned int) AT91C_PB27_TIOA2 ), // Peripheral A + 0); // Peripheral B + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PA15_TCLK2 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_CfgPMC +//* \brief Enable Peripheral clock in PMC for MC +//*---------------------------------------------------------------------------- +__inline void AT91F_MC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIOA_CfgPMC +//* \brief Enable Peripheral clock in PMC for PIOA +//*---------------------------------------------------------------------------- +__inline void AT91F_PIOA_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_PIOA)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIOB_CfgPMC +//* \brief Enable Peripheral clock in PMC for PIOB +//*---------------------------------------------------------------------------- +__inline void AT91F_PIOB_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_PIOB)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgPMC +//* \brief Enable Peripheral clock in PMC for CAN +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_CAN)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgPIO +//* \brief Configure PIO controllers to drive CAN signals +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA20_CANTX ) | + ((unsigned int) AT91C_PA19_CANRX ), // Peripheral A + 0); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWMC_CfgPMC +//* \brief Enable Peripheral clock in PMC for PWMC +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_PWMC)); +} + +#endif // lib_AT91SAM7X256_H diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/settings/cmock_demo.cspy.bat b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/settings/cmock_demo.cspy.bat new file mode 100644 index 0000000..46433e0 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/settings/cmock_demo.cspy.bat @@ -0,0 +1,32 @@ +@REM This bat file has been generated by the IAR Embeddded Workbench +@REM C-SPY interactive debugger,as an aid to preparing a command +@REM line for running the cspybat command line utility with the +@REM appropriate settings. +@REM +@REM After making some adjustments to this file, you can launch cspybat +@REM by typing the name of this file followed by the name of the debug +@REM file (usually an ubrof file). Note that this file is generated +@REM every time a new debug session is initialized, so you may want to +@REM move or rename the file before making changes. +@REM +@REM Note: some command line arguments cannot be properly generated +@REM by this process. Specifically, the plugin which is responsible +@REM for the Terminal I/O window (and other C runtime functionality) +@REM comes in a special version for cspybat, and the name of that +@REM plugin dll is not known when generating this file. It resides in +@REM the $TOOLKIT_DIR$\bin folder and is usually called XXXbat.dll or +@REM XXXlibsupportbat.dll, where XXX is the name of the corresponding +@REM tool chain. Replace the '' parameter +@REM below with the appropriate file name. Other plugins loaded by +@REM C-SPY are usually not needed by, or will not work in, cspybat +@REM but they are listed at the end of this file for reference. + + +"C:\Program Files\IAR Systems\Embedded Workbench 4.0\common\bin\cspybat" "C:\Program Files\IAR Systems\Embedded Workbench 4.0\ARM\bin\armproc.dll" "C:\Program Files\IAR Systems\Embedded Workbench 4.0\ARM\bin\armjlink.dll" %1 --plugin "C:\Program Files\IAR Systems\Embedded Workbench 4.0\ARM\bin\" --macro "C:\svn\cmock\iar\iar_v4\Resource\SAM7_FLASH.mac" --backend -B "--endian" "little" "--cpu" "ARM7TDMI" "--fpu" "None" "--proc_device_desc_file" "C:\Program Files\IAR Systems\Embedded Workbench 4.0\ARM\CONFIG\ioAT91SAM7X256.ddf" "--drv_verify_download" "all" "--proc_driver" "jlink" "--jlink_connection" "USB:0" "--jlink_initial_speed" "32" + + +@REM loaded plugins: +@REM armlibsupport.dll +@REM C:\Program Files\IAR Systems\Embedded Workbench 4.0\common\plugins\CodeCoverage\CodeCoverage.dll +@REM C:\Program Files\IAR Systems\Embedded Workbench 4.0\common\plugins\Profiling\Profiling.dll +@REM C:\Program Files\IAR Systems\Embedded Workbench 4.0\common\plugins\stack\stack.dll diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/settings/cmock_demo.dbgdt b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/settings/cmock_demo.dbgdt new file mode 100644 index 0000000..5e79c26 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/settings/cmock_demo.dbgdt @@ -0,0 +1,86 @@ + + + + + + + + + + + + + 185272727 + + + + + + 100 + + 20 + 1115 + 297 + 74 + + 110$PROJ_DIR$\TermIOInput.txt10 + + + + + + + + TabID-23656-3537 + Debug Log + Debug-Log + + + + TabID-22088-3567 + Build + Build + + + TabID-16970-5692Terminal I/OTerminalIO + + 0 + + + TabID-1637-3541 + Workspace + Workspace + + + cmock_democmock_demo/source + + + + 0 + + + TabID-12385-3544 + Disassembly + Disassembly + + + + + 0 + + + + + + TextEditorC:\svn\cmock\examples\src\Main.c02780680600100000010000001 + + + + + + + iaridepm1debuggergui1-2-2509276-2-2179148129149173302200577598361-2-2509177-2-2179148129149173302129149598361-2-22771388-2-213902791002886326698129149173302 + + + + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/settings/cmock_demo.dni b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/settings/cmock_demo.dni new file mode 100644 index 0000000..b187569 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/settings/cmock_demo.dni @@ -0,0 +1,42 @@ +[JLinkDriver] +WatchCond=_ 0 +Watch0=_ 0 "" 0 "" 0 "" 0 "" 0 0 0 0 +Watch1=_ 0 "" 0 "" 0 "" 0 "" 0 0 0 0 +[DisAssemblyWindow] +NumStates=_ 1 +State 1=_ 1 +[StackPlugin] +Enabled=1 +OverflowWarningsEnabled=1 +WarningThreshold=90 +SpWarningsEnabled=1 +WarnHow=0 +UseTrigger=1 +TriggerName=main +LimitSize=0 +ByteLimit=50 +[Log file] +LoggingEnabled=_ 0 +LogFile=_ "" +Category=_ 0 +[TermIOLog] +LoggingEnabled=_ 0 +LogFile=_ "" +[Interrupts] +Enabled=1 +Irq0=_ 0 480549 0 480549 0 0 0 100 0 1 "IRQ 1 0x18 CPSR.I" +Count=1 +[MemoryMap] +Enabled=0 +Base=0 +UseAuto=0 +TypeViolation=1 +UnspecRange=1 +ActionState=1 +[Disassemble mode] +mode=0 +[Breakpoints] +Count=0 +[TraceHelper] +Enabled=0 +ShowSource=1 diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/settings/cmock_demo.wsdt b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/settings/cmock_demo.wsdt new file mode 100644 index 0000000..33a5635 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/settings/cmock_demo.wsdt @@ -0,0 +1,76 @@ + + + + + + cmock_demo/Debug + + + + + + + + + 237272727 + + + + + + + 20111529774 + + + + + 100 + + + + + + + TabID-20770-112 + Workspace + Workspace + + + cmock_democmock_demo/Sourcecmock_demo/source + + + + 0 + + + TabID-10733-1323 + Build + Build + + + + TabID-27316-3469 + Debug Log + Debug-Log + + + + + 0 + + + + + + TextEditorC:\svn\cmock\examples\src\Main.c0056856800100000010000001 + + + + + + + iaridepm1-2-2554328-2-2179148129149173302238095651054-2-22561388-2-213902581002886302108129149173302 + + + + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/srcIAR/Cstartup.s79 b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/srcIAR/Cstartup.s79 new file mode 100644 index 0000000..73a53fc --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/srcIAR/Cstartup.s79 @@ -0,0 +1,266 @@ +;- ---------------------------------------------------------------------------- +;- ATMEL Microcontroller Software Support - ROUSSET - +;- ---------------------------------------------------------------------------- +;- DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +;- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +;- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +;- DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +;- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +;- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +;- OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +;- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +;- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +;- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +;- ---------------------------------------------------------------------------- +;- File source : Cstartup.s79 +;- Object : Generic CStartup +;- 1.0 01/Sep/05 FBr : Creation +;- 1.1 09/Sep/05 JPP : Change Interrupt management +;------------------------------------------------------------------------------ + +;------------------------------------------------------------------------------ +; Include your AT91 Library files +;------------------------------------------------------------------------------ +#include "AT91SAM7X256_inc.h" +;------------------------------------------------------------------------------ + +;------------------------------------------------------------------------------ +; ?RESET +; Reset Vector. +; Normally, segment INTVEC is linked at address 0. +; For debugging purposes, INTVEC may be placed at other addresses. +; A debugger that honors the entry point will start the +; program in a normal way even if INTVEC is not at address 0. +;------------------------------------------------------------------------------ + + PROGRAM ?RESET ;- Begins a program module + RSEG INTRAMEND_REMAP ;- Begins a relocatable segment + RSEG ICODE:CODE (2) ;- Begins a relocatable segment : corresponding address is 32-bit aligned + CODE32 ;- Always ARM mode after reset + ORG 0 ;- Sets the location counter: corresponds to the RESET vector address + +;------------------------------------------------------------------------------ +;- Exception vectors +;------------------------------------------------------------------------------ +;- These vectors can be read at address 0 or at RAM address +;- They ABSOLUTELY requires to be in relative addresssing mode in order to +;- guarantee a valid jump. For the moment, all are just looping. +;- If an exception occurs before remap, this would result in an infinite loop. +;- To ensure if a exeption occurs before start application to infinite loop. +;------------------------------------------------------------------------------ + +reset + B InitReset ; 0x00 Reset handler +undefvec: + B undefvec ; 0x04 Undefined Instruction +swivec: + B swivec ; 0x08 Software Interrupt +pabtvec: + B pabtvec ; 0x0C Prefetch Abort +dabtvec: + B dabtvec ; 0x10 Data Abort +rsvdvec: + B rsvdvec ; 0x14 reserved +irqvec: + B IRQ_Handler_Entry ; 0x18 IRQ + +fiqvec: ; 0x1c FIQ +;------------------------------------------------------------------------------ +;- Function : FIQ_Handler_Entry +;- Treatments : FIQ Controller Interrupt Handler. +;- Called Functions : AIC_FVR[interrupt] +;------------------------------------------------------------------------------ + +FIQ_Handler_Entry: + +;- Switch in SVC/User Mode to allow User Stack access for C code +; because the FIQ is not yet acknowledged + +;- Save and r0 in FIQ_Register + mov r9,r0 + ldr r0 , [r8, #AIC_FVR] + msr CPSR_c,#I_BIT | F_BIT | ARM_MODE_SVC +;- Save scratch/used registers and LR in User Stack + stmfd sp!, { r1-r3, r12, lr} + +;- Branch to the routine pointed by the AIC_FVR + mov r14, pc + bx r0 + +;- Restore scratch/used registers and LR from User Stack + ldmia sp!, { r1-r3, r12, lr} + +;- Leave Interrupts disabled and switch back in FIQ mode + msr CPSR_c, #I_BIT | F_BIT | ARM_MODE_FIQ + +;- Restore the R0 ARM_MODE_SVC register + mov r0,r9 + +;- Restore the Program Counter using the LR_fiq directly in the PC + subs pc,lr,#4 + +;------------------------------------------------------------------------------ +;- Manage exception: The exception must be ensure in ARM mode +;------------------------------------------------------------------------------ +;------------------------------------------------------------------------------ +;- Function : IRQ_Handler_Entry +;- Treatments : IRQ Controller Interrupt Handler. +;- Called Functions : AIC_IVR[interrupt] +;------------------------------------------------------------------------------ +IRQ_Handler_Entry: + +;------------------------- +;- Manage Exception Entry +;------------------------- +;- Adjust and save LR_irq in IRQ stack + sub lr, lr, #4 + stmfd sp!, {lr} + +;- Save r0 and SPSR (need to be saved for nested interrupt) + mrs r14, SPSR + stmfd sp!, {r0,r14} + +;- Write in the IVR to support Protect Mode +;- No effect in Normal Mode +;- De-assert the NIRQ and clear the source in Protect Mode + ldr r14, =AT91C_BASE_AIC + ldr r0 , [r14, #AIC_IVR] + str r14, [r14, #AIC_IVR] + +;- Enable Interrupt and Switch in Supervisor Mode + msr CPSR_c, #ARM_MODE_SVC + +;- Save scratch/used registers and LR in User Stack + stmfd sp!, { r1-r3, r12, r14} + +;---------------------------------------------- +;- Branch to the routine pointed by the AIC_IVR +;---------------------------------------------- + mov r14, pc + bx r0 + +;---------------------------------------------- +;- Manage Exception Exit +;---------------------------------------------- +;- Restore scratch/used registers and LR from User Stack + ldmia sp!, { r1-r3, r12, r14} + +;- Disable Interrupt and switch back in IRQ mode + msr CPSR_c, #I_BIT | ARM_MODE_IRQ + +;- Mark the End of Interrupt on the AIC + ldr r14, =AT91C_BASE_AIC + str r14, [r14, #AIC_EOICR] + +;- Restore SPSR_irq and r0 from IRQ stack + ldmia sp!, {r0,r14} + msr SPSR_cxsf, r14 + +;- Restore adjusted LR_irq from IRQ stack directly in the PC + ldmia sp!, {pc}^ + + + +InitReset: + +;------------------------------------------------------------------------------ +;- Low level Init is performed in a C function: AT91F_LowLevelInit +;- Init Stack Pointer to a valid memory area before calling AT91F_LowLevelInit +;------------------------------------------------------------------------------ + +;- Retrieve end of RAM address +__iramend EQU SFB(INTRAMEND_REMAP) ;- Segment begin + + EXTERN AT91F_LowLevelInit + ldr r13,=__iramend ;- Temporary stack in internal RAM for Low Level Init execution + ldr r0,=AT91F_LowLevelInit + mov lr, pc + bx r0 ;- Branch on C function (with interworking) + +;------------------------------------------------------------------------------ +;- Top of Stack Definition +;------------------------------------------------------------------------------ +;- Interrupt and Supervisor Stack are located at the top of internal memory in +;- order to speed the exception handling context saving and restoring. +;- ARM_MODE_SVC (Application, C) Stack is located at the top of the external memory. +;------------------------------------------------------------------------------ + +IRQ_STACK_SIZE EQU (3*8*4) ; 3 words to be saved per interrupt priority level +ARM_MODE_FIQ EQU 0x11 +ARM_MODE_IRQ EQU 0x12 +ARM_MODE_SVC EQU 0x13 +I_BIT EQU 0x80 +F_BIT EQU 0x40 + +;------------------------------------------------------------------------------ +;- Setup the stack for each mode +;------------------------------------------------------------------------------ + ldr r0, =__iramend + +;- Set up Fast Interrupt Mode and set FIQ Mode Stack + msr CPSR_c, #ARM_MODE_FIQ | I_BIT | F_BIT +;- Init the FIQ register + ldr r8, =AT91C_BASE_AIC + +;- Set up Interrupt Mode and set IRQ Mode Stack + msr CPSR_c, #ARM_MODE_IRQ | I_BIT | F_BIT + mov r13, r0 ; Init stack IRQ + sub r0, r0, #IRQ_STACK_SIZE + +;- Enable interrupt & Set up Supervisor Mode and set Supervisor Mode Stack + msr CPSR_c, #ARM_MODE_SVC + mov r13, r0 + +;------------------------------------------------------------------------------ +; Initialize segments. +;------------------------------------------------------------------------------ +; __segment_init is assumed to use +; instruction set and to be reachable by BL from the ICODE segment +; (it is safest to link them in segment ICODE). +;------------------------------------------------------------------------------ + EXTERN __segment_init + ldr r0,=__segment_init + mov lr, pc + bx r0 + +;------------------------------------------------------------------------------ +;- Branch on C code Main function (with interworking) +;------------------------------------------------------------------------------ + EXTERN main + PUBLIC __main +?jump_to_main: + ldr lr,=?call_exit + ldr r0,=main +__main: + bx r0 + +;------------------------------------------------------------------------------ +;- Loop for ever +;------------------------------------------------------------------------------ +;- End of application. Normally, never occur. +;- Could jump on Software Reset ( B 0x0 ). +;------------------------------------------------------------------------------ +?call_exit: +End + b End + +;------------------------------------------------------------------------------ +;- Exception Vectors +;------------------------------------------------------------------------------ + PUBLIC AT91F_Default_FIQ_handler + PUBLIC AT91F_Default_IRQ_handler + PUBLIC AT91F_Spurious_handler + + CODE32 ; Always ARM mode after exeption + +AT91F_Default_FIQ_handler + b AT91F_Default_FIQ_handler + +AT91F_Default_IRQ_handler + b AT91F_Default_IRQ_handler + +AT91F_Spurious_handler + b AT91F_Spurious_handler + + ENDMOD ;- Terminates the assembly of the current module + END ;- Terminates the assembly of the last module in a file \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/srcIAR/Cstartup_SAM7.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/srcIAR/Cstartup_SAM7.c new file mode 100644 index 0000000..0913da3 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v4/srcIAR/Cstartup_SAM7.c @@ -0,0 +1,98 @@ +// ---------------------------------------------------------------------------- +// ATMEL Microcontroller Software Support - ROUSSET - +// ---------------------------------------------------------------------------- +// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// ---------------------------------------------------------------------------- +// File Name : Cstartup_SAM7.c +// Object : Low level initialisations written in C for IAR Tools +// Creation : FBr 01-Sep-2005 +// 1.0 08-Sep-2005 JPP : Suppress Reset +// ---------------------------------------------------------------------------- + +#include "AT91SAM7X256.h" + +// The following functions must be write in ARM mode this function called directly by exception vector +extern void AT91F_Spurious_handler(void); +extern void AT91F_Default_IRQ_handler(void); +extern void AT91F_Default_FIQ_handler(void); + +//*---------------------------------------------------------------------------- +//* \fn AT91F_LowLevelInit +//* \brief This function performs very low level HW initialization +//* this function can use a Stack, depending the compilation +//* optimization mode +//*---------------------------------------------------------------------------- +void AT91F_LowLevelInit(void) +{ + unsigned char i; + ///////////////////////////////////////////////////////////////////////////////////////////////////// + // EFC Init + ///////////////////////////////////////////////////////////////////////////////////////////////////// + AT91C_BASE_MC->MC_FMR = AT91C_MC_FWS_1FWS; // 1 Wait State necessary to work at 48MHz + + ///////////////////////////////////////////////////////////////////////////////////////////////////// + // Init PMC Step 1. Enable Main Oscillator + // Main Oscillator startup time is board specific: + // Main Oscillator Startup Time worst case (3MHz) corresponds to 15ms (0x40 for AT91C_CKGR_OSCOUNT field) + ///////////////////////////////////////////////////////////////////////////////////////////////////// + AT91C_BASE_PMC->PMC_MOR = (( AT91C_CKGR_OSCOUNT & (0x40 <<8) | AT91C_CKGR_MOSCEN )); +#ifndef SIMULATE + // Wait Main Oscillator stabilization + while(!(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MOSCS)); +#endif + + ///////////////////////////////////////////////////////////////////////////////////////////////////// + // Init PMC Step 2. + // Set PLL to 96MHz (96,109MHz) and UDP Clock to 48MHz + // PLL Startup time depends on PLL RC filter: worst case is choosen + // UDP Clock (48,058MHz) is compliant with the Universal Serial Bus Specification (+/- 0.25% for full speed) + ///////////////////////////////////////////////////////////////////////////////////////////////////// + AT91C_BASE_PMC->PMC_PLLR = AT91C_CKGR_USBDIV_1 | AT91C_CKGR_OUT_0 | AT91C_CKGR_PLLCOUNT | + (AT91C_CKGR_MUL & (72 << 16)) | (AT91C_CKGR_DIV & 14); +#ifndef SIMULATE + // Wait for PLL stabilization + while( !(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_LOCK) ); + // Wait until the master clock is established for the case we already turn on the PLL + while( !(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MCKRDY) ); +#endif + + ///////////////////////////////////////////////////////////////////////////////////////////////////// + // Init PMC Step 3. + // Selection of Master Clock MCK (equal to Processor Clock PCK) equal to PLL/2 = 48MHz + // The PMC_MCKR register must not be programmed in a single write operation (see. Product Errata Sheet) + ///////////////////////////////////////////////////////////////////////////////////////////////////// + AT91C_BASE_PMC->PMC_MCKR = AT91C_PMC_PRES_CLK_2; +#ifndef SIMULATE + // Wait until the master clock is established + while( !(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MCKRDY) ); +#endif + + AT91C_BASE_PMC->PMC_MCKR |= AT91C_PMC_CSS_PLL_CLK; +#ifndef SIMULATE + // Wait until the master clock is established + while( !(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MCKRDY) ); +#endif + + ///////////////////////////////////////////////////////////////////////////////////////////////////// + // Disable Watchdog (write once register) + ///////////////////////////////////////////////////////////////////////////////////////////////////// + AT91C_BASE_WDTC->WDTC_WDMR = AT91C_WDTC_WDDIS; + + //////////////////////////////////////////////////////////////////////////////////////////////////// + // Init AIC: assign corresponding handler for each interrupt source + ///////////////////////////////////////////////////////////////////////////////////////////////////// + AT91C_BASE_AIC->AIC_SVR[0] = (int) AT91F_Default_FIQ_handler ; + for (i = 1; i < 31; i++) { + AT91C_BASE_AIC->AIC_SVR[i] = (int) AT91F_Default_IRQ_handler ; + } + AT91C_BASE_AIC->AIC_SPU = (unsigned int) AT91F_Spurious_handler; +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/SAM7_FLASH.mac b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/SAM7_FLASH.mac new file mode 100644 index 0000000..407acb2 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/SAM7_FLASH.mac @@ -0,0 +1,71 @@ +// ---------------------------------------------------------------------------- +// ATMEL Microcontroller Software Support - ROUSSET - +// ---------------------------------------------------------------------------- +// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// ---------------------------------------------------------------------------- +// File Name : SAM7_FLASH.mac +// Object : Generic Macro File for IAR +// 1.0 17/Aug/05 FBr : Creation +// ---------------------------------------------------------------------------- + +/********************************************************************* +* +* _InitRSTC() +* +* Function description +* Initializes the RSTC (Reset controller). +* This makes sense since the default is to not allow user resets, which makes it impossible to +* apply a second RESET via J-Link +*/ +_InitRSTC() { + __writeMemory32(0xA5000001, 0xFFFFFD08,"Memory"); // Allow user reset +} + +/********************************************************************* +* +* _InitPLL() +* Function description +* Initializes the PMC. +* 1. Enable the Main Oscillator +* 2. Configure PLL to 96MHz +* 3. Switch Master Clock (MCK) on PLL/2 = 48MHz +*/ + _InitPLL() { + + __message "Enable Main Oscillator"; + __writeMemory32(0x00000601,0xFFFFFc20,"Memory"); // MOSC + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x1) ); + + __message "Set PLL to 96MHz"; + __writeMemory32(0x10191c05,0xFFFFFc2c,"Memory"); // LOCK + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x4) ); + + __message "Set Master Clock to 48MHz"; + __writeMemory32(0x00000004,0xFFFFFc30,"Memory"); // MCKRDY + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x8) ); + __writeMemory32(0x00000007,0xFFFFFc30,"Memory"); // MCKRDY + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x8) ); +} + +/********************************************************************* +* +* execUserReset() : JTAG set initially to Full Speed +*/ +execUserReset() { + __message "execUserReset()"; + __emulatorSpeed(30000); // Set JTAG speed to 30kHz to make a hardware reset + __hwReset(0); // Hardware Reset: CPU is automatically halted after the reset (JTAG is already configured to 32kHz) + _InitPLL(); // Allow to debug at JTAG Full Speed + _InitRSTC(); // Enable User Reset to allow execUserReset() execution + __emulatorSpeed(0); // Set JTAG speed to full speed +} + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/SAM7_RAM.mac b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/SAM7_RAM.mac new file mode 100644 index 0000000..a2b8a01 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/SAM7_RAM.mac @@ -0,0 +1,94 @@ +// ---------------------------------------------------------------------------- +// ATMEL Microcontroller Software Support - ROUSSET - +// ---------------------------------------------------------------------------- +// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// ---------------------------------------------------------------------------- +// File Name : SAM7_RAM.mac +// Object : Generic Macro File for IAR +// 1.0 17/Aug/05 FBr : Creation +// ---------------------------------------------------------------------------- + +/********************************************************************* +* +* _MapRAMAt0() +* +* Function description +* Maps RAM at 0. +*/ +_MapRAMAt0(){ + __message "Changing mapping: RAM mapped to 0"; + __writeMemory32(0x00000001,0xFFFFFF00,"Memory"); +} + +/********************************************************************* +* +* _InitRSTC() +* +* Function description +* Initializes the RSTC (Reset controller). +* This makes sense since the default is to not allow user resets, which makes it impossible to +* apply a second RESET via J-Link +*/ +_InitRSTC() { + __writeMemory32(0xA5000001, 0xFFFFFD08,"Memory"); // Allow user reset +} + +/********************************************************************* +* +* _InitPLL() +* Function description +* Initializes the PMC. +* 1. Enable the Main Oscillator +* 2. Configure PLL to 96MHz +* 3. Switch Master Clock (MCK) on PLL/2 = 48MHz +*/ + _InitPLL() { + + __message "Set Main Oscillator"; + __writeMemory32(0x00004001,0xFFFFFc20,"Memory"); // MOSC + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x1) ); + + __message "Set PLL to 96MHz"; + __writeMemory32(0x10483f0e,0xFFFFFc2c,"Memory"); // LOCK + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x4) ); + + __message "Set Master Clock to 48MHz"; + __writeMemory32(0x00000004,0xFFFFFc30,"Memory"); // MCKRDY + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x8) ); + __writeMemory32(0x00000007,0xFFFFFc30,"Memory"); // MCKRDY + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x8) ); +} + +/********************************************************************* +* +* execUserReset() : JTAG set initially to Full Speed +*/ +execUserReset() { + __message "execUserReset()"; + __emulatorSpeed(30000); // Set JTAG speed to 30kHz to make a hardware reset + __hwReset(0); // Hardware Reset: CPU is automatically halted after the reset + _InitPLL(); // Allow to debug at JTAG Full Speed + _MapRAMAt0(); // Remap RAM to address 0 + __emulatorSpeed(0); // Set JTAG speed to full speed +} + +/********************************************************************* +* +* execUserPreload() : JTAG set initially to 32kHz +*/ +execUserPreload() { + __message "execUserPreload()"; + __hwReset(0); // Hardware Reset: CPU is automatically halted after the reset (JTAG is already configured to 32kHz) + _InitPLL(); // Allow to load Code at JTAG Full Speed + _MapRAMAt0(); // Remap RAM to address 0 + _InitRSTC(); // Enable User Reset to allow execUserReset() execution +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/SAM7_SIM.mac b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/SAM7_SIM.mac new file mode 100644 index 0000000..418a2c3 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/SAM7_SIM.mac @@ -0,0 +1,67 @@ +//========================================================= +// Simulation setup file for esc07_demo project +//========================================================= + +__var _timer0_interrupt_ID; + +irqBreak() +{ + __var __AIC_SMR; + __var __AIC_IECR; + __var __AIC_IVR; + + // read AIC_IECR instead, since not fully supported by simulator + __AIC_IECR = __readMemory32(0xFFFFF120, "Memory"); + if(__AIC_IECR & 0x1000) + { + __AIC_SMR = __readMemory32(0xFFFFF060, "Memory"); + __AIC_IVR = __readMemory32(0xFFFFF0B0, "Memory"); //AIC_IVR = AIC_SVR[x] + __writeMemory32(__AIC_IVR, 0xFFFFF100, "Memory"); //AIC_IVR + __writeMemory32(0x1000, 0xFFFFF10C, "Memory"); //AIC_IPR + __writeMemory32(0x2, 0xFFFFF114, "Memory"); //AIC_CISR + } + + return 0; +} + +setupProcessorRegisters() +{ + // Write TC0_SR.CPCS with correct status for ISR (Clock enabled; RC Compare Flag = TRUE) + __writeMemory32(0x00010010, 0xfffa0020, "Memory"); + + // Set TX ready flag in USART0 status register + // USART0_BASE->US_CSR = AT91C_US_TXRDY + __writeMemory32(0x00000002, 0xfffc0014, "Memory"); +} + +configureTimer0Interrupt() +{ + __var _master_clock_frequency; + __var _timer0_period_cycles; + + // Calculate timer0 frequency in master clock cycles + _master_clock_frequency = 48054857; + _timer0_period_cycles = _master_clock_frequency / 100; + if((_master_clock_frequency % 100) >= 50) + { + _timer0_period_cycles++; + } + + __cancelAllInterrupts(); + __enableInterrupts(); + + _timer0_interrupt_ID = __orderInterrupt("IRQ", _timer0_period_cycles, _timer0_period_cycles, 0, 0, 0, 100); + + if(-1 == _timer0_interrupt_ID) + { + __message "ERROR: failed to order timer 0 interrupt"; + } + + __setCodeBreak("0x18", 0, "irqBreak()", "TRUE", ""); +} + +execUserReset() +{ + setupProcessorRegisters(); + configureTimer0Interrupt(); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/at91SAM7X256_FLASH.icf b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/at91SAM7X256_FLASH.icf new file mode 100644 index 0000000..ab842a2 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/at91SAM7X256_FLASH.icf @@ -0,0 +1,43 @@ +/*###ICF### Section handled by ICF editor, don't touch! ****/ +/*-Editor annotation file-*/ +/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\a_v1_0.xml" */ +/*-Specials-*/ +define symbol __ICFEDIT_intvec_start__ = 0x00000000; +/*-Memory Regions-*/ +define symbol __ICFEDIT_region_ROM_start__ = 0x00000100; +define symbol __ICFEDIT_region_ROM_end__ = 0x0003FFFF; +define symbol __ICFEDIT_region_RAM_start__ = 0x00200000; +define symbol __ICFEDIT_region_RAM_end__ = 0x0020FFFF; +/*-Sizes-*/ +define symbol __ICFEDIT_size_cstack__ = 0x400; +define symbol __ICFEDIT_size_svcstack__ = 0x100; +define symbol __ICFEDIT_size_irqstack__ = 0x100; +define symbol __ICFEDIT_size_fiqstack__ = 0x40; +define symbol __ICFEDIT_size_undstack__ = 0x40; +define symbol __ICFEDIT_size_abtstack__ = 0x40; +define symbol __ICFEDIT_size_heap__ = 0x400; +/**** End of ICF editor section. ###ICF###*/ + + +define memory mem with size = 4G; +define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__]; +define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; + +define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; +define block SVC_STACK with alignment = 8, size = __ICFEDIT_size_svcstack__ { }; +define block IRQ_STACK with alignment = 8, size = __ICFEDIT_size_irqstack__ { }; +define block FIQ_STACK with alignment = 8, size = __ICFEDIT_size_fiqstack__ { }; +define block UND_STACK with alignment = 8, size = __ICFEDIT_size_undstack__ { }; +define block ABT_STACK with alignment = 8, size = __ICFEDIT_size_abtstack__ { }; +define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; + +initialize by copy { readwrite }; +do not initialize { section .noinit }; + +place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; + +place in ROM_region { readonly }; +place in RAM_region { readwrite, + block CSTACK, block SVC_STACK, block IRQ_STACK, block FIQ_STACK, + block UND_STACK, block ABT_STACK, block HEAP }; + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/at91SAM7X256_RAM.icf b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/at91SAM7X256_RAM.icf new file mode 100644 index 0000000..cc79cda --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/at91SAM7X256_RAM.icf @@ -0,0 +1,42 @@ +/*###ICF### Section handled by ICF editor, don't touch! ****/ +/*-Editor annotation file-*/ +/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\a_v1_0.xml" */ +/*-Specials-*/ +define symbol __ICFEDIT_intvec_start__ = 0x00000000; +/*-Memory Regions-*/ +define symbol __ICFEDIT_region_ROM_start__ = 0x00; +define symbol __ICFEDIT_region_ROM_end__ = 0x00; +define symbol __ICFEDIT_region_RAM_start__ = 0x00000100; +define symbol __ICFEDIT_region_RAM_end__ = 0x0000FFFF; +/*-Sizes-*/ +define symbol __ICFEDIT_size_cstack__ = 0x400; +define symbol __ICFEDIT_size_svcstack__ = 0x100; +define symbol __ICFEDIT_size_irqstack__ = 0x100; +define symbol __ICFEDIT_size_fiqstack__ = 0x40; +define symbol __ICFEDIT_size_undstack__ = 0x40; +define symbol __ICFEDIT_size_abtstack__ = 0x40; +define symbol __ICFEDIT_size_heap__ = 0x800; +/**** End of ICF editor section. ###ICF###*/ + + +define memory mem with size = 4G; +define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; + +define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; +define block SVC_STACK with alignment = 8, size = __ICFEDIT_size_svcstack__ { }; +define block IRQ_STACK with alignment = 8, size = __ICFEDIT_size_irqstack__ { }; +define block FIQ_STACK with alignment = 8, size = __ICFEDIT_size_fiqstack__ { }; +define block UND_STACK with alignment = 8, size = __ICFEDIT_size_undstack__ { }; +define block ABT_STACK with alignment = 8, size = __ICFEDIT_size_abtstack__ { }; +define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; + +initialize by copy { readwrite }; +do not initialize { section .noinit }; + +place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; + +place in RAM_region { readonly }; +place in RAM_region { readwrite, + block CSTACK, block SVC_STACK, block IRQ_STACK, block FIQ_STACK, + block UND_STACK, block ABT_STACK, block HEAP }; + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/cmock_demo.dep b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/cmock_demo.dep new file mode 100644 index 0000000..456f4db --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/cmock_demo.dep @@ -0,0 +1,4204 @@ + + + + 2 + 3270150602 + + Binary + + $PROJ_DIR$\Binary\Obj\TimerConductor.o + $TOOLKIT_DIR$\inc\DLib_Defaults.h + $TOOLKIT_DIR$\inc\DLib_Threads.h + $PROJ_DIR$\Binary\Obj\TimerConductor.pbi + $PROJ_DIR$\Binary\List\TimerInterruptConfigurator.lst + $PROJ_DIR$\Binary\Obj\AdcTemperatureSensor.o + $PROJ_DIR$\..\..\test\system\src\TimerInterruptConfigurator.h + $PROJ_DIR$\..\..\test\system\src\TimerModel.h + $TOOLKIT_DIR$\inc\ymath.h + $PROJ_DIR$\Binary\Obj\Cstartup_SAM7.o + $TOOLKIT_DIR$\inc\DLib_Product.h + $TOOLKIT_DIR$\inc\math.h + $PROJ_DIR$\Binary\Exe\cmock_demo.hex + $PROJ_DIR$\Binary\Obj\UsartPutChar.pbi + $PROJ_DIR$\..\..\test\system\src\TimerInterruptHandler.h + $PROJ_DIR$\Binary\Obj\AdcConductor.pbi + $PROJ_DIR$\Binary\List\TimerConfigurator.lst + $PROJ_DIR$\Binary\List\TaskScheduler.lst + $PROJ_DIR$\Binary\List\TemperatureCalculator.lst + $PROJ_DIR$\Binary\List\UsartConductor.lst + $PROJ_DIR$\Binary\Obj\UsartConductor.o + $PROJ_DIR$\Binary\Obj\TimerModel.o + $PROJ_DIR$\Binary\Obj\UsartConfigurator.pbi + $PROJ_DIR$\Binary\Obj\TimerInterruptConfigurator.o + $PROJ_DIR$\Binary\List\Cstartup.lst + $PROJ_DIR$\..\..\test\system\src\Executor.h + $PROJ_DIR$\incIAR\project.h + $PROJ_DIR$\Binary\Obj\Executor.pbi + $PROJ_DIR$\Binary\List\TimerConductor.lst + $PROJ_DIR$\Binary\Obj\TimerModel.pbi + $TOOLKIT_DIR$\inc\intrinsics.h + $PROJ_DIR$\Binary\Obj\Model.pbi + $PROJ_DIR$\Binary\Obj\UsartBaudRateRegisterCalculator.o + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.h + $PROJ_DIR$\..\..\examples\src\UsartModel.h + $PROJ_DIR$\Binary\Obj\TaskScheduler.pbi + $PROJ_DIR$\Binary\Obj\Executor.o + $PROJ_DIR$\Binary\Obj\TemperatureCalculator.o + $PROJ_DIR$\Binary\Obj\Cstartup_SAM7.pbi + $PROJ_DIR$\..\..\test\system\src\AT91SAM7X256.h + $PROJ_DIR$\Binary\Obj\IntrinsicsWrapper.pbi + $PROJ_DIR$\..\..\examples\src\UsartHardware.h + $PROJ_DIR$\Binary\List\Main.lst + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.h + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.h + $PROJ_DIR$\Binary\List\TimerHardware.lst + $PROJ_DIR$\..\..\test\system\src\UsartBaudRateRegisterCalculator.h + $PROJ_DIR$\..\..\test\system\src\TemperatureCalculator.h + $PROJ_DIR$\..\..\test\system\src\UsartPutChar.h + $PROJ_DIR$\..\..\test\system\src\TaskScheduler.h + $PROJ_DIR$\Binary\List\UsartTransmitBufferStatus.lst + $PROJ_DIR$\Binary\Obj\AdcTemperatureSensor.pbi + $PROJ_DIR$\Binary\Obj\Main.pbi + $PROJ_DIR$\Binary\List\UsartModel.lst + $PROJ_DIR$\Binary\Obj\TemperatureFilter.pbi + $PROJ_DIR$\Binary\List\AdcHardware.lst + $PROJ_DIR$\Binary\List\AdcTemperatureSensor.lst + $PROJ_DIR$\Binary\Obj\UsartTransmitBufferStatus.pbi + $PROJ_DIR$\Binary\Obj\AdcHardware.pbi + $PROJ_DIR$\Binary\Obj\TemperatureCalculator.pbi + $TOOLKIT_DIR$\lib\dl4t_tl_in.a + $TOOLKIT_DIR$\inc\ycheck.h + $PROJ_DIR$\..\..\test\system\src\ModelConfig.h + $PROJ_DIR$\Binary\List\AdcConductor.lst + $PROJ_DIR$\Binary\List\AdcHardwareConfigurator.lst + $PROJ_DIR$\Binary\Obj\TimerHardware.o + $PROJ_DIR$\Binary\Obj\TimerInterruptHandler.o + $TOOLKIT_DIR$\inc\stdio.h + $PROJ_DIR$\Binary\Obj\UsartHardware.o + $PROJ_DIR$\Binary\Obj\TimerInterruptHandler.pbi + $PROJ_DIR$\Binary\Obj\UsartModel.o + $TOOLKIT_DIR$\inc\DLib_Config_Normal.h + $PROJ_DIR$\Binary\List\TemperatureFilter.lst + $PROJ_DIR$\Binary\List\UsartPutChar.lst + $PROJ_DIR$\Binary\Obj\UsartConfigurator.o + $PROJ_DIR$\..\..\test\system\src\UsartConductor.h + $PROJ_DIR$\Binary\List\AdcModel.lst + $PROJ_DIR$\..\..\test\system\src\TemperatureFilter.h + $PROJ_DIR$\..\..\test\system\src\Types.h + $PROJ_DIR$\..\..\test\system\src\TimerConfigurator.h + $TOOLKIT_DIR$\inc\yvals.h + $PROJ_DIR$\..\..\test\system\src\UsartModel.h + $PROJ_DIR$\Binary\Obj\UsartTransmitBufferStatus.o + $TOOLKIT_DIR$\lib\rt4t_al.a + $PROJ_DIR$\Binary\List\UsartHardware.lst + $TOOLKIT_DIR$\inc\ysizet.h + $PROJ_DIR$\Binary\Obj\AdcModel.o + $PROJ_DIR$\Binary\Obj\AdcConductor.o + $PROJ_DIR$\Binary\Exe\cmock_demo.out + $PROJ_DIR$\..\..\test\system\src\AdcConductor.h + $PROJ_DIR$\..\..\test\system\src\AdcTemperatureSensor.h + $PROJ_DIR$\Binary\Obj\UsartModel.pbi + $PROJ_DIR$\..\..\test\system\src\TimerHardware.h + $PROJ_DIR$\..\..\test\system\src\AdcModel.h + $PROJ_DIR$\..\..\test\system\src\AdcHardware.h + $PROJ_DIR$\Binary\List\UsartBaudRateRegisterCalculator.lst + $PROJ_DIR$\..\..\test\system\src\Model.h + $TOOLKIT_DIR$\lib\shs_l.a + $PROJ_DIR$\..\..\test\system\src\UsartConfigurator.h + $PROJ_DIR$\Binary\Obj\TimerInterruptConfigurator.pbi + $PROJ_DIR$\Binary\List\UsartConfigurator.lst + $PROJ_DIR$\Binary\List\TimerModel.lst + $PROJ_DIR$\..\..\examples\src\Executor.h + $PROJ_DIR$\Binary\Obj\IntrinsicsWrapper.o + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.h + $PROJ_DIR$\..\..\examples\src\UsartConductor.h + $PROJ_DIR$\..\..\test\system\src\AdcTemperatureSensor.c + $PROJ_DIR$\..\..\examples\src\TimerConductor.h + $PROJ_DIR$\Binary\Obj\AdcHardwareConfigurator.o + $TOOLKIT_DIR$\inc\xencoding_limits.h + $PROJ_DIR$\..\..\test\system\src\Main.c + $PROJ_DIR$\..\..\test\system\src\AdcHardwareConfigurator.c + $PROJ_DIR$\..\..\test\system\src\AdcConductor.c + $PROJ_DIR$\..\..\test\system\src\AdcHardware.c + $PROJ_DIR$\..\..\examples\src\TimerModel.h + $PROJ_DIR$\..\..\test\system\src\AdcModel.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.h + $PROJ_DIR$\..\..\test\system\src\Executor.c + $PROJ_DIR$\..\..\examples\src\Model.h + $PROJ_DIR$\..\..\test\system\src\Model.c + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.h + $PROJ_DIR$\..\..\examples\src\UsartPutChar.h + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.h + $PROJ_DIR$\..\..\test\system\src\TemperatureFilter.c + $PROJ_DIR$\..\..\test\system\src\TimerConfigurator.c + $PROJ_DIR$\..\..\test\system\src\TemperatureCalculator.c + $PROJ_DIR$\..\..\test\system\src\TaskScheduler.c + $PROJ_DIR$\..\..\test\system\src\TimerInterruptConfigurator.c + $PROJ_DIR$\Binary\Obj\AdcModel.pbi + $PROJ_DIR$\..\..\test\system\src\TimerConductor.c + $PROJ_DIR$\..\..\test\system\src\TimerInterruptHandler.c + $PROJ_DIR$\Binary\Obj\AdcHardware.o + $PROJ_DIR$\..\..\test\system\src\UsartConfigurator.c + $PROJ_DIR$\..\..\test\system\src\TimerHardware.c + $PROJ_DIR$\..\..\test\system\src\UsartTransmitBufferStatus.c + $PROJ_DIR$\..\..\examples\src\AdcModel.h + $PROJ_DIR$\..\..\test\system\src\TimerModel.c + $PROJ_DIR$\..\..\test\system\src\UsartBaudRateRegisterCalculator.c + $PROJ_DIR$\..\..\test\system\src\UsartConductor.c + $PROJ_DIR$\..\..\examples\src\AdcHardware.h + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.h + $PROJ_DIR$\..\..\test\system\src\UsartHardware.c + $PROJ_DIR$\..\..\test\system\src\UsartModel.c + $PROJ_DIR$\..\..\test\system\src\UsartPutChar.c + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.h + $PROJ_DIR$\..\..\examples\src\ModelConfig.h + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.h + $PROJ_DIR$\..\..\examples\src\Types.h + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.h + $PROJ_DIR$\..\..\examples\src\AdcConductor.h + $PROJ_DIR$\..\..\examples\src\AT91SAM7X256.h + $PROJ_DIR$\..\..\examples\src\TaskScheduler.h + $PROJ_DIR$\..\..\examples\src\TimerHardware.h + $PROJ_DIR$\Binary\Obj\TimerHardware.pbi + $PROJ_DIR$\Binary\Obj\TimerConfigurator.o + $PROJ_DIR$\Binary\List\Model.lst + $PROJ_DIR$\Binary\Obj\Cstartup.o + $PROJ_DIR$\Binary\Obj\TaskScheduler.o + $PROJ_DIR$\Binary\Obj\TemperatureFilter.o + $PROJ_DIR$\..\..\test\system\src\TimerConductor.h + $PROJ_DIR$\Binary\Obj\Model.o + $PROJ_DIR$\..\..\test\system\src\UsartTransmitBufferStatus.h + $PROJ_DIR$\Binary\Obj\UsartHardware.pbi + $PROJ_DIR$\Binary\List\TimerInterruptHandler.lst + $PROJ_DIR$\Binary\Obj\cmock_demo.pbd + $PROJ_DIR$\..\..\test\system\src\UsartHardware.h + $PROJ_DIR$\..\..\test\system\src\AdcHardwareConfigurator.h + $PROJ_DIR$\Binary\Obj\UsartConductor.pbi + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + $PROJ_DIR$\..\..\examples\src\AdcModel.c + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + $PROJ_DIR$\..\..\examples\src\Executor.c + $PROJ_DIR$\..\..\examples\src\Main.c + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + $PROJ_DIR$\..\..\examples\src\Model.c + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + $PROJ_DIR$\Resource\at91SAM7X256_FLASH.icf + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + $PROJ_DIR$\..\..\examples\src\TimerModel.c + $PROJ_DIR$\..\..\examples\src\UsartModel.c + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + $PROJ_DIR$\srcIAR\Cstartup.s + $PROJ_DIR$\Binary\Obj\UsartPutChar.o + $PROJ_DIR$\Binary\Obj\TimerConfigurator.pbi + $PROJ_DIR$\Binary\Obj\Main.o + $PROJ_DIR$\Binary\List\Executor.lst + $PROJ_DIR$\incIAR\AT91SAM7X-EK.h + $PROJ_DIR$\incIAR\lib_AT91SAM7X256.h + $PROJ_DIR$\incIAR\AT91SAM7X256_inc.h + $PROJ_DIR$\Binary\Obj\AdcHardwareConfigurator.pbi + $PROJ_DIR$\Binary\Obj\UsartBaudRateRegisterCalculator.pbi + + + [ROOT_NODE] + + + ILINK + 88 + + + + + $PROJ_DIR$\Binary\Exe\cmock_demo.out + + + OBJCOPY + 12 + + + + + ILINK + 179 87 131 108 86 5 156 9 36 103 198 160 157 37 158 0 154 65 23 66 21 32 20 74 68 70 196 82 97 83 60 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcTemperatureSensor.c + + + BICOMP + 51 + + + ICCARM + 56 5 + + + + + BICOMP + 78 39 90 + + + ICCARM + 78 39 90 + + + + + $PROJ_DIR$\..\..\test\system\src\Main.c + + + BICOMP + 52 + + + ICCARM + 42 198 + + + + + BICOMP + 78 39 25 96 49 47 77 75 165 98 48 81 46 161 159 92 79 6 14 7 89 94 166 90 93 + + + ICCARM + 78 39 25 96 49 47 77 75 165 98 48 81 46 161 159 92 79 6 14 7 89 94 166 90 93 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcHardwareConfigurator.c + + + BICOMP + 203 + + + ICCARM + 64 108 + + + + + BICOMP + 78 39 166 62 + + + ICCARM + 78 39 166 62 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcConductor.c + + + BICOMP + 15 + + + ICCARM + 63 87 + + + + + BICOMP + 78 39 89 93 94 + + + ICCARM + 78 39 89 93 94 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcHardware.c + + + BICOMP + 58 + + + ICCARM + 55 131 + + + + + BICOMP + 78 39 94 166 90 + + + ICCARM + 78 39 94 166 90 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcModel.c + + + BICOMP + 128 + + + ICCARM + 76 86 + + + + + BICOMP + 78 39 93 49 47 77 + + + ICCARM + 78 39 93 49 47 77 + + + + + $PROJ_DIR$\..\..\test\system\src\Executor.c + + + BICOMP + 27 + + + ICCARM + 199 36 + + + + + BICOMP + 78 39 25 96 75 159 89 30 61 + + + ICCARM + 78 39 25 96 75 159 89 30 61 + + + + + $PROJ_DIR$\..\..\test\system\src\Model.c + + + BICOMP + 31 + + + ICCARM + 155 160 + + + + + BICOMP + 96 78 39 49 77 + + + ICCARM + 96 78 39 49 77 + + + + + $PROJ_DIR$\..\..\test\system\src\TemperatureFilter.c + + + BICOMP + 54 + + + ICCARM + 72 158 + + + + + BICOMP + 78 39 77 11 61 8 80 1 10 109 2 + + + ICCARM + 78 39 77 11 61 8 80 1 71 10 109 2 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerConfigurator.c + + + BICOMP + 197 + + + ICCARM + 16 154 + + + + + BICOMP + 78 39 79 6 + + + ICCARM + 78 39 79 6 + + + + + $PROJ_DIR$\..\..\test\system\src\TemperatureCalculator.c + + + BICOMP + 59 + + + ICCARM + 18 37 + + + + + BICOMP + 78 39 47 11 61 8 80 1 10 109 2 + + + ICCARM + 78 39 47 11 61 8 80 1 71 10 109 2 + + + + + $PROJ_DIR$\..\..\test\system\src\TaskScheduler.c + + + BICOMP + 35 + + + ICCARM + 17 157 + + + + + BICOMP + 78 39 49 + + + ICCARM + 78 39 49 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerInterruptConfigurator.c + + + BICOMP + 99 + + + ICCARM + 4 23 + + + + + BICOMP + 78 39 6 14 + + + ICCARM + 78 39 6 14 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerConductor.c + + + BICOMP + 3 + + + ICCARM + 28 0 + + + + + BICOMP + 78 39 159 7 92 14 + + + ICCARM + 78 39 159 7 92 14 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerInterruptHandler.c + + + BICOMP + 69 + + + ICCARM + 163 66 + + + + + BICOMP + 78 39 14 6 + + + ICCARM + 78 39 14 6 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartConfigurator.c + + + BICOMP + 22 + + + ICCARM + 100 74 + + + + + BICOMP + 78 39 98 + + + ICCARM + 78 39 98 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerHardware.c + + + BICOMP + 153 + + + ICCARM + 45 65 + + + + + BICOMP + 78 39 92 79 + + + ICCARM + 78 39 92 79 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartTransmitBufferStatus.c + + + BICOMP + 57 + + + ICCARM + 50 82 + + + + + BICOMP + 78 39 161 + + + ICCARM + 78 39 161 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerModel.c + + + BICOMP + 29 + + + ICCARM + 101 21 + + + + + BICOMP + 78 39 7 49 + + + ICCARM + 78 39 7 49 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartBaudRateRegisterCalculator.c + + + BICOMP + 204 + + + ICCARM + 95 32 + + + + + BICOMP + 78 39 46 + + + ICCARM + 78 39 46 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartConductor.c + + + BICOMP + 167 + + + ICCARM + 19 20 + + + + + BICOMP + 78 39 75 165 81 49 + + + ICCARM + 78 39 75 165 81 49 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartHardware.c + + + BICOMP + 162 + + + ICCARM + 84 68 + + + + + BICOMP + 78 39 165 98 48 + + + ICCARM + 78 39 165 98 48 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartModel.c + + + BICOMP + 91 + + + ICCARM + 53 70 + + + + + BICOMP + 78 39 81 62 46 77 67 61 80 1 10 109 2 85 11 8 + + + ICCARM + 78 39 81 62 46 77 67 61 80 1 71 10 109 2 85 11 8 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartPutChar.c + + + BICOMP + 13 + + + ICCARM + 73 196 + + + + + BICOMP + 78 39 48 161 + + + ICCARM + 78 39 48 161 + + + + + $PROJ_DIR$\Binary\Obj\cmock_demo.pbd + + + BILINK + 15 58 203 128 51 38 27 40 52 31 35 59 54 3 197 153 99 69 29 204 167 22 162 91 13 57 + + + + + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + + + BICOMP + 38 + + + + + BICOMP + 26 30 61 200 150 201 + + + + + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + + + BICOMP + 203 + + + + + BICOMP + 147 150 146 145 + + + + + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + + + BICOMP + 15 + + + ICCARM + 63 87 131 108 86 5 36 103 198 160 157 37 158 0 154 65 23 66 21 32 20 74 68 70 196 82 9 + + + + + BICOMP + 147 150 149 135 139 + + + ICCARM + 147 150 149 135 139 146 144 145 151 148 140 102 118 105 107 120 30 61 41 43 121 34 33 44 152 104 122 116 114 11 8 80 1 71 10 109 2 67 85 26 200 201 + + + + + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + + + BICOMP + 58 + + + + + BICOMP + 147 150 139 146 144 + + + + + $PROJ_DIR$\..\..\examples\src\AdcModel.c + + + BICOMP + 128 + + + + + BICOMP + 147 150 135 151 148 140 + + + + + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + + + BICOMP + 51 + + + + + BICOMP + 147 150 144 + + + + + $PROJ_DIR$\..\..\examples\src\Executor.c + + + BICOMP + 27 + + + + + BICOMP + 147 150 102 118 105 107 149 120 + + + + + $PROJ_DIR$\..\..\examples\src\Main.c + + + BICOMP + 52 + + + + + BICOMP + 147 150 120 102 118 151 148 140 105 41 43 121 34 33 44 107 152 104 122 116 114 149 139 146 144 135 + + + + + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + + + BICOMP + 40 + + + + + BICOMP + 120 30 61 + + + + + $PROJ_DIR$\..\..\examples\src\Model.c + + + BICOMP + 31 + + + + + BICOMP + 118 147 150 151 140 + + + + + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + + + BICOMP + 59 + + + + + BICOMP + 147 150 148 11 61 8 80 1 10 109 2 + + + + + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + + + BICOMP + 35 + + + + + BICOMP + 147 150 151 + + + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + + + BICOMP + 99 + + + + + BICOMP + 147 150 122 116 + + + + + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + + + BICOMP + 54 + + + + + BICOMP + 147 150 140 11 61 8 80 1 10 109 2 + + + + + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + + + BICOMP + 3 + + + + + BICOMP + 147 150 107 114 152 116 + + + + + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + + + BICOMP + 197 + + + + + BICOMP + 147 150 104 122 + + + + + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + + + BICOMP + 153 + + + + + BICOMP + 147 150 152 104 + + + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + + + BICOMP + 69 + + + + + BICOMP + 147 150 116 122 + + + + + $PROJ_DIR$\..\..\examples\src\TimerModel.c + + + BICOMP + 29 + + + + + BICOMP + 147 150 114 151 + + + + + $PROJ_DIR$\..\..\examples\src\UsartModel.c + + + BICOMP + 91 + + + + + BICOMP + 147 150 34 145 33 140 67 61 80 1 10 109 2 85 11 8 + + + + + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + + + BICOMP + 204 + + + + + BICOMP + 147 150 33 + + + + + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + + + BICOMP + 167 + + + + + BICOMP + 147 150 105 41 34 151 + + + + + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + + + BICOMP + 22 + + + + + BICOMP + 147 150 43 + + + + + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + + + BICOMP + 162 + + + + + BICOMP + 147 150 41 43 121 + + + + + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + + + BICOMP + 57 + + + + + BICOMP + 147 150 44 + + + + + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + + + BICOMP + 13 + + + + + BICOMP + 147 150 121 44 + + + + + $PROJ_DIR$\srcIAR\Cstartup.s + + + AARM + 156 24 + + + + + AARM + 202 + + + + + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\AdcModel.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\Executor.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\Main.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\Model.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\TimerModel.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\UsartModel.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + ICCARM + + + + FLASH_Debug + + $TOOLKIT_DIR$\inc\DLib_Defaults.h + $TOOLKIT_DIR$\inc\DLib_Threads.h + $PROJ_DIR$\..\..\test\system\src\TimerInterruptConfigurator.h + $PROJ_DIR$\..\..\test\system\src\TimerModel.h + $TOOLKIT_DIR$\inc\ymath.h + $TOOLKIT_DIR$\inc\DLib_Product.h + $TOOLKIT_DIR$\inc\math.h + $PROJ_DIR$\..\..\test\system\src\TimerInterruptHandler.h + $PROJ_DIR$\..\..\test\system\src\Executor.h + $PROJ_DIR$\incIAR\project.h + $TOOLKIT_DIR$\inc\intrinsics.h + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.h + $PROJ_DIR$\..\..\examples\src\UsartModel.h + $PROJ_DIR$\..\..\test\system\src\AT91SAM7X256.h + $PROJ_DIR$\..\..\examples\src\UsartHardware.h + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.h + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.h + $PROJ_DIR$\..\..\test\system\src\UsartBaudRateRegisterCalculator.h + $PROJ_DIR$\..\..\test\system\src\TemperatureCalculator.h + $PROJ_DIR$\..\..\test\system\src\UsartPutChar.h + $PROJ_DIR$\..\..\test\system\src\TaskScheduler.h + $TOOLKIT_DIR$\lib\dl4t_tl_in.a + $TOOLKIT_DIR$\inc\ycheck.h + $PROJ_DIR$\..\..\test\system\src\ModelConfig.h + $TOOLKIT_DIR$\inc\stdio.h + $TOOLKIT_DIR$\inc\DLib_Config_Normal.h + $PROJ_DIR$\..\..\test\system\src\UsartConductor.h + $PROJ_DIR$\..\..\test\system\src\TemperatureFilter.h + $PROJ_DIR$\..\..\test\system\src\Types.h + $PROJ_DIR$\..\..\test\system\src\TimerConfigurator.h + $TOOLKIT_DIR$\inc\yvals.h + $PROJ_DIR$\..\..\test\system\src\UsartModel.h + $TOOLKIT_DIR$\lib\rt4t_al.a + $TOOLKIT_DIR$\inc\ysizet.h + $PROJ_DIR$\..\..\test\system\src\AdcConductor.h + $PROJ_DIR$\..\..\test\system\src\AdcTemperatureSensor.h + $PROJ_DIR$\..\..\test\system\src\TimerHardware.h + $PROJ_DIR$\..\..\test\system\src\AdcModel.h + $PROJ_DIR$\..\..\test\system\src\AdcHardware.h + $PROJ_DIR$\..\..\test\system\src\Model.h + $TOOLKIT_DIR$\lib\shs_l.a + $PROJ_DIR$\..\..\test\system\src\UsartConfigurator.h + $PROJ_DIR$\..\..\examples\src\Executor.h + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.h + $PROJ_DIR$\..\..\examples\src\UsartConductor.h + $PROJ_DIR$\..\..\test\system\src\AdcTemperatureSensor.c + $PROJ_DIR$\..\..\examples\src\TimerConductor.h + $TOOLKIT_DIR$\inc\xencoding_limits.h + $PROJ_DIR$\FLASH_Debug\Obj\cmock_demo.pbd + $PROJ_DIR$\..\..\test\system\src\Main.c + $PROJ_DIR$\..\..\test\system\src\AdcHardwareConfigurator.c + $PROJ_DIR$\..\..\test\system\src\AdcConductor.c + $PROJ_DIR$\..\..\test\system\src\AdcHardware.c + $PROJ_DIR$\..\..\examples\src\TimerModel.h + $PROJ_DIR$\..\..\test\system\src\AdcModel.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.h + $PROJ_DIR$\..\..\test\system\src\Executor.c + $PROJ_DIR$\..\..\examples\src\Model.h + $PROJ_DIR$\..\..\test\system\src\Model.c + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.h + $PROJ_DIR$\..\..\examples\src\UsartPutChar.h + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.h + $PROJ_DIR$\..\..\test\system\src\TemperatureFilter.c + $PROJ_DIR$\..\..\test\system\src\TimerConfigurator.c + $PROJ_DIR$\..\..\test\system\src\TemperatureCalculator.c + $PROJ_DIR$\..\..\test\system\src\TaskScheduler.c + $PROJ_DIR$\..\..\test\system\src\TimerInterruptConfigurator.c + $PROJ_DIR$\..\..\test\system\src\TimerConductor.c + $PROJ_DIR$\..\..\test\system\src\TimerInterruptHandler.c + $PROJ_DIR$\..\..\test\system\src\UsartConfigurator.c + $PROJ_DIR$\..\..\test\system\src\TimerHardware.c + $PROJ_DIR$\..\..\test\system\src\UsartTransmitBufferStatus.c + $PROJ_DIR$\..\..\examples\src\AdcModel.h + $PROJ_DIR$\..\..\test\system\src\TimerModel.c + $PROJ_DIR$\..\..\test\system\src\UsartBaudRateRegisterCalculator.c + $PROJ_DIR$\..\..\test\system\src\UsartConductor.c + $PROJ_DIR$\..\..\examples\src\AdcHardware.h + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.h + $PROJ_DIR$\..\..\test\system\src\UsartHardware.c + $PROJ_DIR$\..\..\test\system\src\UsartModel.c + $PROJ_DIR$\..\..\test\system\src\UsartPutChar.c + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.h + $PROJ_DIR$\..\..\examples\src\ModelConfig.h + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.h + $PROJ_DIR$\..\..\examples\src\Types.h + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.h + $PROJ_DIR$\..\..\examples\src\AdcConductor.h + $PROJ_DIR$\..\..\examples\src\AT91SAM7X256.h + $PROJ_DIR$\..\..\examples\src\TaskScheduler.h + $PROJ_DIR$\..\..\examples\src\TimerHardware.h + $PROJ_DIR$\..\..\test\system\src\TimerConductor.h + $PROJ_DIR$\..\..\test\system\src\UsartTransmitBufferStatus.h + $PROJ_DIR$\..\..\test\system\src\UsartHardware.h + $PROJ_DIR$\FLASH_Debug\Obj\Main.o + $PROJ_DIR$\..\..\test\system\src\AdcHardwareConfigurator.h + $PROJ_DIR$\FLASH_Debug\List\TimerHardware.lst + $PROJ_DIR$\FLASH_Debug\List\ext_irq.lst + $PROJ_DIR$\FLASH_Debug\Obj\Cstartup.o + $PROJ_DIR$\FLASH_Debug\Obj\TimerConfigurator.pbi + $PROJ_DIR$\FLASH_Debug\List\UsartHardware.lst + $PROJ_DIR$\..\src\ext_irq.c + $PROJ_DIR$\FLASH_Debug\Obj\interrupt_Usart.o + $PROJ_DIR$\FLASH_Debug\Obj\interrupt_Usart.pbi + $PROJ_DIR$\FLASH_Debug\Obj\TimerModel.o + $PROJ_DIR$\FLASH_Debug\Obj\main.pbi + $PROJ_DIR$\FLASH_Debug\List\Model.lst + $PROJ_DIR$\FLASH_Debug\Obj\AdcModel.o + $PROJ_DIR$\FLASH_Debug\Obj\UsartHardware.o + $PROJ_DIR$\FLASH_Debug\Obj\UsartPutChar.o + $PROJ_DIR$\FLASH_Debug\Obj\TemperatureCalculator.pbi + $PROJ_DIR$\FLASH_Debug\List\AdcConductor.lst + $PROJ_DIR$\FLASH_Debug\Obj\UsartTransmitBufferStatus.pbi + $PROJ_DIR$\FLASH_Debug\Obj\AdcConductor.pbi + $PROJ_DIR$\FLASH_Debug\Obj\Model.pbi + $PROJ_DIR$\FLASH_Debug\Obj\Cstartup_SAM7.o + $PROJ_DIR$\FLASH_Debug\Obj\IntrinsicsWrapper.o + $PROJ_DIR$\FLASH_Debug\Obj\IntrinsicsWrapper.pbi + $PROJ_DIR$\FLASH_Debug\Obj\AdcHardware.o + $PROJ_DIR$\FLASH_Debug\Obj\UsartPutChar.pbi + $PROJ_DIR$\FLASH_Debug\Obj\UsartBaudRateRegisterCalculator.pbi + $PROJ_DIR$\FLASH_Debug\List\interrupt_timer.lst + $PROJ_DIR$\FLASH_Debug\List\Cstartup_SAM7.lst + $PROJ_DIR$\FLASH_Debug\Obj\AdcHardwareConfigurator.o + $PROJ_DIR$\FLASH_Debug\List\AdcHardwareConfigurator.lst + $PROJ_DIR$\FLASH_Debug\Obj\TemperatureFilter.pbi + $PROJ_DIR$\FLASH_Debug\Obj\TimerConductor.pbi + $PROJ_DIR$\..\..\include\lib_AT91SAM7X256.h + $PROJ_DIR$\FLASH_Debug\Obj\TaskScheduler.o + $PROJ_DIR$\FLASH_Debug\Obj\TemperatureFilter.o + $PROJ_DIR$\FLASH_Debug\Obj\ext_irq.pbi + $PROJ_DIR$\..\..\include\AT91SAM7X256.h + $PROJ_DIR$\FLASH_Debug\Obj\AdcModel.pbi + $PROJ_DIR$\FLASH_Debug\Obj\TimerInterruptConfigurator.o + $PROJ_DIR$\FLASH_Debug\List\AdcModel.lst + $PROJ_DIR$\FLASH_Debug\List\interrupt_Usart.lst + $PROJ_DIR$\FLASH_Debug\List\Cstartup.lst + $PROJ_DIR$\FLASH_Debug\Obj\UsartHardware.pbi + $PROJ_DIR$\FLASH_Debug\List\TimerModel.lst + $PROJ_DIR$\FLASH_Debug\Obj\UsartConductor.o + $PROJ_DIR$\FLASH_Debug\Obj\UsartConfigurator.o + $PROJ_DIR$\FLASH_Debug\List\UsartPutChar.lst + $PROJ_DIR$\FLASH_Debug\List\TemperatureFilter.lst + $PROJ_DIR$\FLASH_Debug\Obj\TimerInterruptHandler.pbi + $PROJ_DIR$\FLASH_Debug\List\TemperatureCalculator.lst + $PROJ_DIR$\FLASH_Debug\List\UsartTransmitBufferStatus.lst + $PROJ_DIR$\FLASH_Debug\Obj\UsartModel.pbi + $PROJ_DIR$\FLASH_Debug\List\UsartConductor.lst + $PROJ_DIR$\FLASH_Debug\List\TimerConfigurator.lst + $PROJ_DIR$\FLASH_Debug\Obj\Model.o + $PROJ_DIR$\FLASH_Debug\List\Executor.lst + $PROJ_DIR$\FLASH_Debug\List\UsartModel.lst + $PROJ_DIR$\FLASH_Debug\List\TimerInterruptHandler.lst + $PROJ_DIR$\FLASH_Debug\List\Main.lst + $PROJ_DIR$\FLASH_Debug\List\TimerInterruptConfigurator.lst + $PROJ_DIR$\FLASH_Debug\Exe\cmock_demo.out + $PROJ_DIR$\FLASH_Debug\Obj\TimerHardware.pbi + $PROJ_DIR$\FLASH_Debug\Obj\TaskScheduler.pbi + $PROJ_DIR$\FLASH_Debug\Obj\TimerModel.pbi + $PROJ_DIR$\FLASH_Debug\Obj\AdcConductor.o + $PROJ_DIR$\FLASH_Debug\Obj\AdcTemperatureSensor.o + $PROJ_DIR$\..\src\AT91SAM7X-EK.h + $PROJ_DIR$\FLASH_Debug\Obj\UsartTransmitBufferStatus.o + $PROJ_DIR$\FLASH_Debug\Obj\AdcHardware.pbi + $PROJ_DIR$\FLASH_Debug\Obj\UsartBaudRateRegisterCalculator.o + $PROJ_DIR$\FLASH_Debug\Obj\ext_irq.o + $PROJ_DIR$\FLASH_Debug\Obj\AdcTemperatureSensor.pbi + $PROJ_DIR$\FLASH_Debug\Obj\TemperatureCalculator.o + $PROJ_DIR$\FLASH_Debug\Obj\TimerHardware.o + $PROJ_DIR$\FLASH_Debug\Obj\UsartModel.o + $PROJ_DIR$\FLASH_Debug\List\UsartConfigurator.lst + $PROJ_DIR$\FLASH_Debug\Obj\TimerConductor.o + $PROJ_DIR$\srcIAR\project.h + $PROJ_DIR$\FLASH_Debug\List\UsartBaudRateRegisterCalculator.lst + $PROJ_DIR$\FLASH_Debug\Obj\AdcHardwareConfigurator.pbi + $PROJ_DIR$\FLASH_Debug\Obj\TimerInterruptHandler.o + $PROJ_DIR$\FLASH_Debug\List\TimerConductor.lst + $PROJ_DIR$\FLASH_Debug\Obj\Cstartup_SAM7.pbi + $PROJ_DIR$\FLASH_Debug\Obj\UsartConductor.pbi + $PROJ_DIR$\FLASH_Debug\Obj\UsartConfigurator.pbi + $PROJ_DIR$\FLASH_Debug\Obj\Executor.o + $PROJ_DIR$\FLASH_Debug\List\AdcHardware.lst + $PROJ_DIR$\FLASH_Debug\Obj\Executor.pbi + $PROJ_DIR$\..\src\interrupt_timer.c + $PROJ_DIR$\..\src\interrupt_Usart.c + $PROJ_DIR$\FLASH_Debug\Obj\TimerInterruptConfigurator.pbi + $PROJ_DIR$\..\src\main.c + $PROJ_DIR$\FLASH_Debug\Obj\TimerConfigurator.o + $PROJ_DIR$\FLASH_Debug\List\AdcTemperatureSensor.lst + $PROJ_DIR$\FLASH_Debug\List\TaskScheduler.lst + $PROJ_DIR$\FLASH_Debug\Obj\interrupt_timer.o + $PROJ_DIR$\FLASH_Debug\List\IntrinsicsWrapper.lst + $PROJ_DIR$\FLASH_Debug\Obj\interrupt_timer.pbi + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + $PROJ_DIR$\..\..\examples\src\AdcModel.c + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + $PROJ_DIR$\..\..\examples\src\Executor.c + $PROJ_DIR$\..\..\examples\src\Main.c + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + $PROJ_DIR$\..\..\examples\src\Model.c + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + $PROJ_DIR$\Resource\at91SAM7X256_FLASH.icf + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + $PROJ_DIR$\..\..\examples\src\TimerModel.c + $PROJ_DIR$\..\..\examples\src\UsartModel.c + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + $PROJ_DIR$\srcIAR\Cstartup.s + $PROJ_DIR$\incIAR\AT91SAM7X-EK.h + $PROJ_DIR$\incIAR\lib_AT91SAM7X256.h + $PROJ_DIR$\incIAR\AT91SAM7X256_inc.h + + + [ROOT_NODE] + + + ILINK + 154 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcTemperatureSensor.c + + + BICOMP + 165 + + + ICCARM + 187 159 + + + + + ICCARM + 28 13 35 + + + + + $PROJ_DIR$\FLASH_Debug\Obj\cmock_demo.pbd + + + BILINK + 112 162 173 131 165 176 181 116 113 156 109 124 125 98 155 184 142 157 119 177 178 136 145 118 111 104 + + + + + $PROJ_DIR$\..\..\test\system\src\Main.c + + + BICOMP + 104 + + + ICCARM + 152 93 + + + + + ICCARM + 28 13 8 39 20 18 27 26 92 41 19 31 17 91 90 36 29 2 7 3 34 38 94 35 37 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcHardwareConfigurator.c + + + BICOMP + 173 + + + ICCARM + 123 122 + + + + + ICCARM + 28 13 94 23 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcConductor.c + + + BICOMP + 112 + + + ICCARM + 110 158 + + + + + ICCARM + 28 13 34 37 38 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcHardware.c + + + BICOMP + 162 + + + ICCARM + 180 117 + + + + + ICCARM + 28 13 38 94 35 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcModel.c + + + BICOMP + 131 + + + ICCARM + 133 106 + + + + + ICCARM + 28 13 37 20 18 27 + + + + + $PROJ_DIR$\..\..\test\system\src\Executor.c + + + BICOMP + 181 + + + ICCARM + 149 179 + + + + + ICCARM + 28 13 8 39 26 90 34 10 22 + + + + + $PROJ_DIR$\..\..\test\system\src\Model.c + + + BICOMP + 113 + + + ICCARM + 105 148 + + + + + ICCARM + 39 28 13 20 27 + + + + + $PROJ_DIR$\..\..\test\system\src\TemperatureFilter.c + + + BICOMP + 124 + + + ICCARM + 141 128 + + + + + ICCARM + 28 13 27 6 22 4 30 0 25 5 47 1 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerConfigurator.c + + + BICOMP + 98 + + + ICCARM + 147 186 + + + + + ICCARM + 28 13 29 2 + + + + + $PROJ_DIR$\..\..\test\system\src\TemperatureCalculator.c + + + BICOMP + 109 + + + ICCARM + 143 166 + + + + + ICCARM + 28 13 18 6 22 4 30 0 25 5 47 1 + + + + + $PROJ_DIR$\..\..\test\system\src\TaskScheduler.c + + + BICOMP + 156 + + + ICCARM + 188 127 + + + + + ICCARM + 28 13 20 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerInterruptConfigurator.c + + + BICOMP + 184 + + + ICCARM + 153 132 + + + + + ICCARM + 28 13 2 7 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerConductor.c + + + BICOMP + 125 + + + ICCARM + 175 170 + + + + + ICCARM + 28 13 90 3 36 7 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerInterruptHandler.c + + + BICOMP + 142 + + + ICCARM + 151 174 + + + + + ICCARM + 28 13 7 2 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartConfigurator.c + + + BICOMP + 178 + + + ICCARM + 169 139 + + + + + ICCARM + 28 13 41 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerHardware.c + + + BICOMP + 155 + + + ICCARM + 95 167 + + + + + ICCARM + 28 13 36 29 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartTransmitBufferStatus.c + + + BICOMP + 111 + + + ICCARM + 144 161 + + + + + ICCARM + 28 13 91 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerModel.c + + + BICOMP + 157 + + + ICCARM + 137 103 + + + + + ICCARM + 28 13 3 20 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartBaudRateRegisterCalculator.c + + + BICOMP + 119 + + + ICCARM + 172 163 + + + + + ICCARM + 28 13 17 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartConductor.c + + + BICOMP + 177 + + + ICCARM + 146 138 + + + + + ICCARM + 28 13 26 92 31 20 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartHardware.c + + + BICOMP + 136 + + + ICCARM + 99 107 + + + + + ICCARM + 28 13 92 41 19 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartModel.c + + + BICOMP + 145 + + + ICCARM + 150 168 + + + + + ICCARM + 28 13 31 23 17 27 24 22 30 0 25 5 47 1 33 6 4 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartPutChar.c + + + BICOMP + 118 + + + ICCARM + 140 108 + + + + + ICCARM + 28 13 19 91 + + + + + $PROJ_DIR$\..\src\ext_irq.c + + + BICOMP + 129 + + + ICCARM + 96 164 + + + + + BICOMP + 171 10 22 160 130 126 + + + ICCARM + 171 10 22 160 130 126 + + + + + $PROJ_DIR$\FLASH_Debug\Exe\cmock_demo.out + + + ILINK + 203 158 117 122 106 159 97 114 179 115 93 148 127 166 128 170 186 167 132 174 103 163 138 139 107 168 108 161 40 32 21 + + + + + $PROJ_DIR$\..\src\interrupt_timer.c + + + BICOMP + 191 + + + ICCARM + 120 189 + + + + + BICOMP + 171 10 22 160 130 126 + + + ICCARM + 171 10 22 160 130 126 + + + + + $PROJ_DIR$\..\src\interrupt_Usart.c + + + BICOMP + 102 + + + ICCARM + 134 101 + + + + + BICOMP + 171 10 22 160 130 126 + + + ICCARM + 171 10 22 160 130 126 + + + + + $PROJ_DIR$\..\src\main.c + + + BICOMP + 104 + + + ICCARM + 152 93 + + + + + BICOMP + 171 10 22 160 130 126 + + + ICCARM + 171 10 22 160 130 126 + + + + + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + + + BICOMP + 176 + + + ICCARM + 121 114 + + + + + BICOMP + 9 10 22 220 221 + + + ICCARM + 9 10 22 220 87 221 + + + + + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + + + BICOMP + 173 + + + ICCARM + 123 122 + + + + + BICOMP + 84 87 83 82 + + + ICCARM + 84 87 83 82 + + + + + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + + + BICOMP + 112 + + + ICCARM + 110 158 + + + + + BICOMP + 84 87 86 72 76 + + + ICCARM + 84 87 86 72 76 + + + + + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + + + BICOMP + 162 + + + ICCARM + 180 117 + + + + + BICOMP + 84 87 76 83 81 + + + ICCARM + 84 87 76 83 81 + + + + + $PROJ_DIR$\..\..\examples\src\AdcModel.c + + + BICOMP + 131 + + + ICCARM + 133 106 + + + + + BICOMP + 84 87 72 88 85 77 + + + ICCARM + 84 87 72 88 85 77 + + + + + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + + + BICOMP + 165 + + + ICCARM + 187 159 + + + + + BICOMP + 84 87 81 + + + ICCARM + 84 87 81 + + + + + $PROJ_DIR$\..\..\examples\src\Executor.c + + + BICOMP + 181 + + + ICCARM + 149 179 + + + + + BICOMP + 84 87 42 57 44 46 86 59 + + + ICCARM + 84 87 42 57 44 46 86 59 + + + + + $PROJ_DIR$\..\..\examples\src\Main.c + + + BICOMP + 104 + + + ICCARM + 152 93 + + + + + BICOMP + 84 87 59 42 57 88 85 77 44 14 15 60 12 11 16 46 89 43 61 55 53 86 76 83 81 72 + + + ICCARM + 84 87 59 42 57 88 85 77 44 14 15 60 12 11 16 46 89 43 61 55 53 86 76 83 81 72 + + + + + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + + + BICOMP + 116 + + + ICCARM + 190 115 + + + + + BICOMP + 59 10 22 + + + ICCARM + 59 10 22 + + + + + $PROJ_DIR$\..\..\examples\src\Model.c + + + BICOMP + 113 + + + ICCARM + 105 148 + + + + + BICOMP + 57 84 87 88 77 + + + ICCARM + 57 84 87 88 77 + + + + + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + + + BICOMP + 109 + + + ICCARM + 143 166 + + + + + BICOMP + 84 87 85 6 22 4 30 0 5 47 1 + + + ICCARM + 84 87 85 6 22 4 30 0 25 5 47 1 + + + + + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + + + BICOMP + 156 + + + ICCARM + 188 127 + + + + + BICOMP + 84 87 88 + + + ICCARM + 84 87 88 + + + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + + + BICOMP + 184 + + + ICCARM + 153 132 + + + + + BICOMP + 84 87 61 55 + + + ICCARM + 84 87 61 55 + + + + + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + + + BICOMP + 124 + + + ICCARM + 141 128 + + + + + BICOMP + 84 87 77 6 22 4 30 0 5 47 1 + + + ICCARM + 84 87 77 6 22 4 30 0 25 5 47 1 + + + + + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + + + BICOMP + 125 + + + ICCARM + 175 170 + + + + + BICOMP + 84 87 46 53 89 55 + + + ICCARM + 84 87 46 53 89 55 + + + + + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + + + BICOMP + 98 + + + ICCARM + 147 186 + + + + + BICOMP + 84 87 43 61 + + + ICCARM + 84 87 43 61 + + + + + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + + + BICOMP + 155 + + + ICCARM + 95 167 + + + + + BICOMP + 84 87 89 43 + + + ICCARM + 84 87 89 43 + + + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + + + BICOMP + 142 + + + ICCARM + 151 174 + + + + + BICOMP + 84 87 55 61 + + + ICCARM + 84 87 55 61 + + + + + $PROJ_DIR$\..\..\examples\src\TimerModel.c + + + BICOMP + 157 + + + ICCARM + 137 103 + + + + + BICOMP + 84 87 53 88 + + + ICCARM + 84 87 53 88 + + + + + $PROJ_DIR$\..\..\examples\src\UsartModel.c + + + BICOMP + 145 + + + ICCARM + 150 168 + + + + + ICCARM + 84 87 12 82 11 77 24 22 30 0 25 5 47 1 33 6 4 + + + + + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + + + BICOMP + 119 + + + ICCARM + 172 163 + + + + + BICOMP + 84 87 11 + + + ICCARM + 84 87 11 + + + + + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + + + BICOMP + 177 + + + ICCARM + 146 138 + + + + + BICOMP + 84 87 44 14 12 88 + + + ICCARM + 84 87 44 14 12 88 + + + + + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + + + BICOMP + 178 + + + ICCARM + 169 139 + + + + + BICOMP + 84 87 15 + + + ICCARM + 84 87 15 + + + + + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + + + BICOMP + 136 + + + ICCARM + 99 107 + + + + + BICOMP + 84 87 14 15 60 + + + ICCARM + 84 87 14 15 60 + + + + + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + + + BICOMP + 111 + + + ICCARM + 144 161 + + + + + ICCARM + 84 87 16 + + + + + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + + + BICOMP + 118 + + + ICCARM + 140 108 + + + + + ICCARM + 84 87 60 16 + + + + + $PROJ_DIR$\srcIAR\Cstartup.s + + + AARM + 97 135 + + + + + AARM + 222 + + + + + + RAM_Debug + + $PROJ_DIR$\Resource\SAM7_FLASH.mac + $TOOLKIT_DIR$\inc\DLib_Defaults.h + $TOOLKIT_DIR$\inc\DLib_Threads.h + $PROJ_DIR$\..\..\test\system\src\TimerInterruptConfigurator.h + $PROJ_DIR$\..\..\test\system\src\TimerModel.h + $TOOLKIT_DIR$\inc\ymath.h + $TOOLKIT_DIR$\inc\DLib_Product.h + $TOOLKIT_DIR$\inc\math.h + $PROJ_DIR$\..\..\test\system\src\TimerInterruptHandler.h + $PROJ_DIR$\..\..\test\system\src\Executor.h + $PROJ_DIR$\incIAR\project.h + $TOOLKIT_DIR$\inc\intrinsics.h + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.h + $PROJ_DIR$\..\..\examples\src\UsartModel.h + $PROJ_DIR$\..\..\test\system\src\AT91SAM7X256.h + $PROJ_DIR$\..\..\examples\src\UsartHardware.h + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.h + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.h + $PROJ_DIR$\..\..\test\system\src\UsartBaudRateRegisterCalculator.h + $PROJ_DIR$\..\..\test\system\src\TemperatureCalculator.h + $PROJ_DIR$\..\..\test\system\src\UsartPutChar.h + $PROJ_DIR$\..\..\test\system\src\TaskScheduler.h + $TOOLKIT_DIR$\lib\dl4t_tl_in.a + $TOOLKIT_DIR$\inc\ycheck.h + $PROJ_DIR$\..\..\test\system\src\ModelConfig.h + $TOOLKIT_DIR$\inc\stdio.h + $TOOLKIT_DIR$\inc\DLib_Config_Normal.h + $PROJ_DIR$\..\..\test\system\src\UsartConductor.h + $PROJ_DIR$\..\..\test\system\src\TemperatureFilter.h + $PROJ_DIR$\..\..\test\system\src\Types.h + $PROJ_DIR$\..\..\test\system\src\TimerConfigurator.h + $TOOLKIT_DIR$\inc\yvals.h + $PROJ_DIR$\..\..\test\system\src\UsartModel.h + $TOOLKIT_DIR$\lib\rt4t_al.a + $TOOLKIT_DIR$\inc\ysizet.h + $PROJ_DIR$\..\..\test\system\src\AdcConductor.h + $PROJ_DIR$\..\..\test\system\src\AdcTemperatureSensor.h + $PROJ_DIR$\..\..\test\system\src\TimerHardware.h + $PROJ_DIR$\..\..\test\system\src\AdcModel.h + $PROJ_DIR$\..\..\test\system\src\AdcHardware.h + $PROJ_DIR$\..\..\test\system\src\Model.h + $TOOLKIT_DIR$\lib\shs_l.a + $PROJ_DIR$\..\..\test\system\src\UsartConfigurator.h + $PROJ_DIR$\..\..\examples\src\Executor.h + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.h + $PROJ_DIR$\..\..\examples\src\UsartConductor.h + $PROJ_DIR$\..\..\test\system\src\AdcTemperatureSensor.c + $PROJ_DIR$\..\..\examples\src\TimerConductor.h + $TOOLKIT_DIR$\inc\xencoding_limits.h + $PROJ_DIR$\..\..\test\system\src\Main.c + $PROJ_DIR$\..\..\test\system\src\AdcHardwareConfigurator.c + $PROJ_DIR$\..\..\test\system\src\AdcConductor.c + $PROJ_DIR$\..\..\test\system\src\AdcHardware.c + $PROJ_DIR$\..\..\examples\src\TimerModel.h + $PROJ_DIR$\..\..\test\system\src\AdcModel.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.h + $PROJ_DIR$\..\..\test\system\src\Executor.c + $PROJ_DIR$\..\..\examples\src\Model.h + $PROJ_DIR$\..\..\test\system\src\Model.c + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.h + $PROJ_DIR$\..\..\examples\src\UsartPutChar.h + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.h + $PROJ_DIR$\..\..\test\system\src\TemperatureFilter.c + $PROJ_DIR$\..\..\test\system\src\TimerConfigurator.c + $PROJ_DIR$\..\..\test\system\src\TemperatureCalculator.c + $PROJ_DIR$\..\..\test\system\src\TaskScheduler.c + $PROJ_DIR$\..\..\test\system\src\TimerInterruptConfigurator.c + $PROJ_DIR$\..\..\test\system\src\TimerConductor.c + $PROJ_DIR$\..\..\test\system\src\TimerInterruptHandler.c + $PROJ_DIR$\..\..\test\system\src\UsartConfigurator.c + $PROJ_DIR$\..\..\test\system\src\TimerHardware.c + $PROJ_DIR$\..\..\test\system\src\UsartTransmitBufferStatus.c + $PROJ_DIR$\..\..\examples\src\AdcModel.h + $PROJ_DIR$\..\..\test\system\src\TimerModel.c + $PROJ_DIR$\..\..\test\system\src\UsartBaudRateRegisterCalculator.c + $PROJ_DIR$\..\..\test\system\src\UsartConductor.c + $PROJ_DIR$\..\..\examples\src\AdcHardware.h + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.h + $PROJ_DIR$\..\..\test\system\src\UsartHardware.c + $PROJ_DIR$\..\..\test\system\src\UsartModel.c + $PROJ_DIR$\..\..\test\system\src\UsartPutChar.c + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.h + $PROJ_DIR$\..\..\examples\src\ModelConfig.h + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.h + $PROJ_DIR$\..\..\examples\src\Types.h + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.h + $PROJ_DIR$\..\..\examples\src\AdcConductor.h + $PROJ_DIR$\..\..\examples\src\AT91SAM7X256.h + $PROJ_DIR$\..\..\examples\src\TaskScheduler.h + $PROJ_DIR$\..\..\examples\src\TimerHardware.h + $PROJ_DIR$\..\..\test\system\src\TimerConductor.h + $PROJ_DIR$\..\..\test\system\src\UsartTransmitBufferStatus.h + $PROJ_DIR$\..\..\test\system\src\UsartHardware.h + $PROJ_DIR$\..\..\test\system\src\AdcHardwareConfigurator.h + $PROJ_DIR$\..\src\ext_irq.c + $PROJ_DIR$\..\src\interrupt_timer.c + $PROJ_DIR$\..\src\interrupt_Usart.c + $PROJ_DIR$\..\src\main.c + $PROJ_DIR$\RAM_Debug\Obj\UsartConductor.o + $PROJ_DIR$\RAM_Debug\List\AdcConductor.lst + $PROJ_DIR$\RAM_Debug\List\TimerInterruptHandler.lst + $PROJ_DIR$\RAM_Debug\List\AdcHardwareConfigurator.lst + $PROJ_DIR$\RAM_Debug\Obj\TimerHardware.pbi + $PROJ_DIR$\RAM_Debug\Obj\UsartHardware.pbi + $PROJ_DIR$\RAM_Debug\Obj\UsartConductor.pbi + $PROJ_DIR$\RAM_Debug\List\TimerConfigurator.lst + $PROJ_DIR$\RAM_Debug\List\UsartPutChar.lst + $PROJ_DIR$\RAM_Debug\Obj\TimerConductor.o + $PROJ_DIR$\RAM_Debug\Obj\TimerConfigurator.o + $PROJ_DIR$\RAM_Debug\Obj\UsartBaudRateRegisterCalculator.pbi + $PROJ_DIR$\RAM_Debug\Obj\AdcHardwareConfigurator.o + $PROJ_DIR$\RAM_Debug\List\AdcModel.lst + $PROJ_DIR$\RAM_Debug\List\TimerConductor.lst + $PROJ_DIR$\RAM_Debug\List\TimerHardware.lst + $PROJ_DIR$\RAM_Debug\Obj\AdcHardware.o + $PROJ_DIR$\RAM_Debug\List\TemperatureFilter.lst + $PROJ_DIR$\RAM_Debug\Obj\AdcModel.pbi + $PROJ_DIR$\RAM_Debug\List\IntrinsicsWrapper.lst + $PROJ_DIR$\RAM_Debug\Obj\Cstartup.o + $PROJ_DIR$\RAM_Debug\Obj\interrupt_Usart.o + $PROJ_DIR$\RAM_Debug\Obj\AdcHardwareConfigurator.pbi + $PROJ_DIR$\RAM_Debug\Obj\main.pbi + $PROJ_DIR$\RAM_Debug\List\AdcTemperatureSensor.lst + $PROJ_DIR$\RAM_Debug\Obj\TimerInterruptHandler.pbi + $PROJ_DIR$\RAM_Debug\List\Model.lst + $PROJ_DIR$\RAM_Debug\Obj\Model.pbi + $PROJ_DIR$\RAM_Debug\Obj\AdcHardware.pbi + $PROJ_DIR$\RAM_Debug\List\UsartBaudRateRegisterCalculator.lst + $PROJ_DIR$\RAM_Debug\Obj\ext_irq.o + $PROJ_DIR$\RAM_Debug\Obj\TimerInterruptHandler.o + $PROJ_DIR$\RAM_Debug\List\Cstartup.lst + $PROJ_DIR$\RAM_Debug\Obj\TimerConfigurator.pbi + $PROJ_DIR$\RAM_Debug\Obj\Cstartup_SAM7.o + $PROJ_DIR$\RAM_Debug\Obj\AdcTemperatureSensor.pbi + $PROJ_DIR$\RAM_Debug\List\UsartConfigurator.lst + $PROJ_DIR$\RAM_Debug\List\UsartTransmitBufferStatus.lst + $PROJ_DIR$\RAM_Debug\Obj\UsartPutChar.pbi + $PROJ_DIR$\RAM_Debug\List\TaskScheduler.lst + $PROJ_DIR$\RAM_Debug\Obj\interrupt_timer.pbi + $PROJ_DIR$\RAM_Debug\List\UsartHardware.lst + $PROJ_DIR$\RAM_Debug\Obj\TaskScheduler.pbi + $PROJ_DIR$\RAM_Debug\Obj\Cstartup_SAM7.pbi + $PROJ_DIR$\RAM_Debug\List\Cstartup_SAM7.lst + $PROJ_DIR$\RAM_Debug\Obj\UsartTransmitBufferStatus.o + $PROJ_DIR$\RAM_Debug\Obj\TimerModel.pbi + $PROJ_DIR$\RAM_Debug\List\UsartConductor.lst + $PROJ_DIR$\RAM_Debug\Obj\UsartPutChar.o + $PROJ_DIR$\RAM_Debug\Obj\TimerInterruptConfigurator.pbi + $PROJ_DIR$\RAM_Debug\Obj\TimerHardware.o + $PROJ_DIR$\RAM_Debug\Obj\AdcTemperatureSensor.o + $PROJ_DIR$\RAM_Debug\Obj\AdcModel.o + $PROJ_DIR$\RAM_Debug\Obj\Executor.pbi + $PROJ_DIR$\RAM_Debug\Obj\TemperatureFilter.o + $PROJ_DIR$\RAM_Debug\Obj\AdcConductor.pbi + $PROJ_DIR$\RAM_Debug\List\TimerInterruptConfigurator.lst + $PROJ_DIR$\RAM_Debug\List\UsartModel.lst + $PROJ_DIR$\RAM_Debug\Obj\UsartConfigurator.o + $PROJ_DIR$\RAM_Debug\Obj\cmock_demo.pbd + $PROJ_DIR$\RAM_Debug\Exe\cmock_demo.out + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + $PROJ_DIR$\RAM_Debug\List\TemperatureCalculator.lst + $PROJ_DIR$\RAM_Debug\List\AdcHardware.lst + $PROJ_DIR$\RAM_Debug\List\Executor.lst + $PROJ_DIR$\RAM_Debug\Obj\UsartModel.pbi + $PROJ_DIR$\RAM_Debug\Obj\TimerConductor.pbi + $PROJ_DIR$\RAM_Debug\Obj\UsartConfigurator.pbi + $PROJ_DIR$\RAM_Debug\Obj\UsartHardware.o + $PROJ_DIR$\RAM_Debug\Obj\TemperatureCalculator.o + $PROJ_DIR$\RAM_Debug\Obj\AdcConductor.o + $PROJ_DIR$\RAM_Debug\Obj\IntrinsicsWrapper.o + $PROJ_DIR$\RAM_Debug\Obj\Model.o + $PROJ_DIR$\RAM_Debug\Obj\UsartTransmitBufferStatus.pbi + $PROJ_DIR$\RAM_Debug\Obj\TimerModel.o + $PROJ_DIR$\RAM_Debug\Obj\Executor.o + $PROJ_DIR$\RAM_Debug\Obj\TemperatureCalculator.pbi + $PROJ_DIR$\RAM_Debug\Obj\UsartBaudRateRegisterCalculator.o + $PROJ_DIR$\RAM_Debug\Obj\TimerInterruptConfigurator.o + $PROJ_DIR$\RAM_Debug\Obj\interrupt_Usart.pbi + $PROJ_DIR$\RAM_Debug\Obj\TaskScheduler.o + $PROJ_DIR$\RAM_Debug\Obj\Main.o + $PROJ_DIR$\RAM_Debug\Obj\ext_irq.pbi + $PROJ_DIR$\RAM_Debug\List\Main.lst + $PROJ_DIR$\RAM_Debug\List\TimerModel.lst + $PROJ_DIR$\RAM_Debug\Obj\interrupt_timer.o + $PROJ_DIR$\RAM_Debug\Obj\UsartModel.o + $PROJ_DIR$\RAM_Debug\Obj\TemperatureFilter.pbi + $PROJ_DIR$\RAM_Debug\Obj\IntrinsicsWrapper.pbi + $PROJ_DIR$\Resource\at91SAM7X256_RAM.icf + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + $PROJ_DIR$\..\..\examples\src\AdcModel.c + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + $PROJ_DIR$\..\..\examples\src\Executor.c + $PROJ_DIR$\..\..\examples\src\Main.c + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + $PROJ_DIR$\..\..\examples\src\Model.c + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + $PROJ_DIR$\Resource\SAM7_RAM.mac + $PROJ_DIR$\Resource\at91SAM7X256_FLASH.icf + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + $PROJ_DIR$\..\..\examples\src\TimerModel.c + $PROJ_DIR$\..\..\examples\src\UsartModel.c + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + $PROJ_DIR$\srcIAR\Cstartup.s + $PROJ_DIR$\incIAR\AT91SAM7X-EK.h + $PROJ_DIR$\incIAR\lib_AT91SAM7X256.h + $PROJ_DIR$\incIAR\AT91SAM7X256_inc.h + + + [ROOT_NODE] + + + ILINK + 158 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcTemperatureSensor.c + + + BICOMP + 133 + + + ICCARM + 122 149 + + + + + BICOMP + 29 14 36 + + + ICCARM + 29 14 36 + + + + + $PROJ_DIR$\..\..\test\system\src\Main.c + + + BICOMP + 121 + + + ICCARM + 181 179 + + + + + BICOMP + 29 14 9 40 21 19 28 27 92 42 20 32 18 91 90 37 30 3 8 4 35 39 93 36 38 + + + ICCARM + 29 14 9 40 21 19 28 27 92 42 20 32 18 91 90 37 30 3 8 4 35 39 93 36 38 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcHardwareConfigurator.c + + + BICOMP + 120 + + + ICCARM + 101 110 + + + + + BICOMP + 29 14 93 24 + + + ICCARM + 29 14 93 24 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcConductor.c + + + BICOMP + 153 + + + ICCARM + 99 168 + + + + + BICOMP + 29 14 35 38 39 + + + ICCARM + 29 14 35 38 39 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcHardware.c + + + BICOMP + 126 + + + ICCARM + 161 114 + + + + + BICOMP + 29 14 39 93 36 + + + ICCARM + 29 14 39 93 36 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcModel.c + + + BICOMP + 116 + + + ICCARM + 111 150 + + + + + BICOMP + 29 14 38 21 19 28 + + + ICCARM + 29 14 38 21 19 28 + + + + + $PROJ_DIR$\..\..\test\system\src\Executor.c + + + BICOMP + 151 + + + ICCARM + 162 173 + + + + + BICOMP + 29 14 9 40 27 90 35 11 23 + + + ICCARM + 29 14 9 40 27 90 35 11 23 + + + + + $PROJ_DIR$\..\..\test\system\src\Model.c + + + BICOMP + 125 + + + ICCARM + 124 170 + + + + + BICOMP + 40 29 14 21 28 + + + ICCARM + 40 29 14 21 28 + + + + + $PROJ_DIR$\..\..\test\system\src\TemperatureFilter.c + + + BICOMP + 185 + + + ICCARM + 115 152 + + + + + BICOMP + 29 14 28 7 23 5 31 1 6 48 2 + + + ICCARM + 29 14 28 7 23 5 31 1 26 6 48 2 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerConfigurator.c + + + BICOMP + 131 + + + ICCARM + 105 108 + + + + + BICOMP + 29 14 30 3 + + + ICCARM + 29 14 30 3 + + + + + $PROJ_DIR$\..\..\test\system\src\TemperatureCalculator.c + + + BICOMP + 174 + + + ICCARM + 160 167 + + + + + BICOMP + 29 14 19 7 23 5 31 1 6 48 2 + + + ICCARM + 29 14 19 7 23 5 31 1 26 6 48 2 + + + + + $PROJ_DIR$\..\..\test\system\src\TaskScheduler.c + + + BICOMP + 140 + + + ICCARM + 137 178 + + + + + BICOMP + 29 14 21 + + + ICCARM + 29 14 21 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerInterruptConfigurator.c + + + BICOMP + 147 + + + ICCARM + 154 176 + + + + + BICOMP + 29 14 3 8 + + + ICCARM + 29 14 3 8 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerConductor.c + + + BICOMP + 164 + + + ICCARM + 112 107 + + + + + BICOMP + 29 14 90 4 37 8 + + + ICCARM + 29 14 90 4 37 8 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerInterruptHandler.c + + + BICOMP + 123 + + + ICCARM + 100 129 + + + + + BICOMP + 29 14 8 3 + + + ICCARM + 29 14 8 3 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartConfigurator.c + + + BICOMP + 165 + + + ICCARM + 134 156 + + + + + BICOMP + 29 14 42 + + + ICCARM + 29 14 42 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerHardware.c + + + BICOMP + 102 + + + ICCARM + 113 148 + + + + + BICOMP + 29 14 37 30 + + + ICCARM + 29 14 37 30 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartTransmitBufferStatus.c + + + BICOMP + 171 + + + ICCARM + 135 143 + + + + + BICOMP + 29 14 91 + + + ICCARM + 29 14 91 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerModel.c + + + BICOMP + 144 + + + ICCARM + 182 172 + + + + + BICOMP + 29 14 4 21 + + + ICCARM + 29 14 4 21 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartBaudRateRegisterCalculator.c + + + BICOMP + 109 + + + ICCARM + 127 175 + + + + + BICOMP + 29 14 18 + + + ICCARM + 29 14 18 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartConductor.c + + + BICOMP + 104 + + + ICCARM + 145 98 + + + + + BICOMP + 29 14 27 92 32 21 + + + ICCARM + 29 14 27 92 32 21 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartHardware.c + + + BICOMP + 103 + + + ICCARM + 139 166 + + + + + BICOMP + 29 14 92 42 20 + + + ICCARM + 29 14 92 42 20 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartModel.c + + + BICOMP + 163 + + + ICCARM + 155 184 + + + + + BICOMP + 29 14 32 24 18 28 25 23 31 1 6 48 2 34 7 5 + + + ICCARM + 29 14 32 24 18 28 25 23 31 1 26 6 48 2 34 7 5 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartPutChar.c + + + BICOMP + 136 + + + ICCARM + 106 146 + + + + + BICOMP + 29 14 20 91 + + + ICCARM + 29 14 20 91 + + + + + $PROJ_DIR$\..\src\ext_irq.c + + + BICOMP + 180 + + + ICCARM + 128 + + + + + $PROJ_DIR$\..\src\interrupt_timer.c + + + BICOMP + 138 + + + ICCARM + 183 + + + + + $PROJ_DIR$\..\src\interrupt_Usart.c + + + BICOMP + 177 + + + ICCARM + 119 + + + + + $PROJ_DIR$\..\src\main.c + + + BICOMP + 121 + + + ICCARM + 179 + + + + + $PROJ_DIR$\RAM_Debug\Obj\cmock_demo.pbd + + + BILINK + 153 126 120 116 133 141 151 186 125 140 174 185 164 131 102 147 123 144 109 104 165 103 163 136 171 121 + + + + + $PROJ_DIR$\RAM_Debug\Exe\cmock_demo.out + + + ILINK + 187 168 114 110 150 149 118 132 173 169 179 170 178 167 152 107 108 148 176 129 172 175 98 156 166 184 146 143 41 33 22 + + + + + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + + + BICOMP + 141 + + + ICCARM + 142 132 + + + + + BICOMP + 10 11 23 216 87 217 + + + ICCARM + 10 11 23 216 87 217 + + + + + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + + + BICOMP + 120 + + + ICCARM + 101 110 + + + + + BICOMP + 84 87 83 82 + + + ICCARM + 84 87 83 82 + + + + + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + + + BICOMP + 153 + + + ICCARM + 99 168 + + + + + BICOMP + 84 87 86 72 76 + + + ICCARM + 84 87 86 72 76 + + + + + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + + + BICOMP + 126 + + + ICCARM + 161 114 + + + + + BICOMP + 84 87 76 83 81 + + + ICCARM + 84 87 76 83 81 + + + + + $PROJ_DIR$\..\..\examples\src\AdcModel.c + + + BICOMP + 116 + + + ICCARM + 111 150 + + + + + BICOMP + 84 87 72 88 85 77 + + + ICCARM + 84 87 72 88 85 77 + + + + + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + + + BICOMP + 133 + + + ICCARM + 122 149 + + + + + BICOMP + 84 87 81 + + + ICCARM + 84 87 81 + + + + + $PROJ_DIR$\..\..\examples\src\Executor.c + + + BICOMP + 151 + + + ICCARM + 162 173 + + + + + BICOMP + 84 87 43 57 45 47 86 59 + + + ICCARM + 84 87 43 57 45 47 86 59 + + + + + $PROJ_DIR$\..\..\examples\src\Main.c + + + BICOMP + 121 + + + ICCARM + 181 179 + + + + + BICOMP + 84 87 59 43 57 88 85 77 45 15 16 60 13 12 17 47 89 44 61 55 53 86 76 83 81 72 + + + ICCARM + 84 87 59 43 57 88 85 77 45 15 16 60 13 12 17 47 89 44 61 55 53 86 76 83 81 72 + + + + + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + + + BICOMP + 186 + + + ICCARM + 117 169 + + + + + BICOMP + 59 11 23 + + + ICCARM + 59 11 23 + + + + + $PROJ_DIR$\..\..\examples\src\Model.c + + + BICOMP + 125 + + + ICCARM + 124 170 + + + + + BICOMP + 57 84 87 88 77 + + + ICCARM + 57 84 87 88 77 + + + + + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + + + BICOMP + 174 + + + ICCARM + 160 167 + + + + + BICOMP + 84 87 85 7 23 5 31 1 6 48 2 + + + ICCARM + 84 87 85 7 23 5 31 1 26 6 48 2 + + + + + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + + + BICOMP + 140 + + + ICCARM + 137 178 + + + + + BICOMP + 84 87 88 + + + ICCARM + 84 87 88 + + + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + + + BICOMP + 147 + + + ICCARM + 154 176 + + + + + BICOMP + 84 87 61 55 + + + ICCARM + 84 87 61 55 + + + + + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + + + BICOMP + 185 + + + ICCARM + 115 152 + + + + + BICOMP + 84 87 77 7 23 5 31 1 6 48 2 + + + ICCARM + 84 87 77 7 23 5 31 1 26 6 48 2 + + + + + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + + + BICOMP + 164 + + + ICCARM + 112 107 + + + + + BICOMP + 84 87 47 53 89 55 + + + ICCARM + 84 87 47 53 89 55 + + + + + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + + + BICOMP + 131 + + + ICCARM + 105 108 + + + + + BICOMP + 84 87 44 61 + + + ICCARM + 84 87 44 61 + + + + + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + + + BICOMP + 102 + + + ICCARM + 113 148 + + + + + BICOMP + 84 87 89 44 + + + ICCARM + 84 87 89 44 + + + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + + + BICOMP + 123 + + + ICCARM + 100 129 + + + + + BICOMP + 84 87 55 61 + + + ICCARM + 84 87 55 61 + + + + + $PROJ_DIR$\..\..\examples\src\TimerModel.c + + + BICOMP + 144 + + + ICCARM + 182 172 + + + + + BICOMP + 84 87 53 88 + + + ICCARM + 84 87 53 88 + + + + + $PROJ_DIR$\..\..\examples\src\UsartModel.c + + + BICOMP + 163 + + + ICCARM + 155 184 + + + + + BICOMP + 84 87 13 82 12 77 25 23 31 1 6 48 2 34 7 5 + + + ICCARM + 84 87 13 82 12 77 25 23 31 1 26 6 48 2 34 7 5 + + + + + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + + + BICOMP + 109 + + + ICCARM + 127 175 + + + + + BICOMP + 84 87 12 + + + ICCARM + 84 87 12 + + + + + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + + + BICOMP + 104 + + + ICCARM + 145 98 + + + + + BICOMP + 84 87 45 15 13 88 + + + ICCARM + 84 87 45 15 13 88 + + + + + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + + + BICOMP + 165 + + + ICCARM + 134 156 + + + + + BICOMP + 84 87 16 + + + ICCARM + 84 87 16 + + + + + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + + + BICOMP + 103 + + + ICCARM + 139 166 + + + + + BICOMP + 84 87 15 16 60 + + + ICCARM + 84 87 15 16 60 + + + + + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + + + BICOMP + 171 + + + ICCARM + 135 143 + + + + + BICOMP + 84 87 17 + + + ICCARM + 84 87 17 + + + + + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + + + BICOMP + 136 + + + ICCARM + 106 146 + + + + + BICOMP + 84 87 60 17 + + + ICCARM + 84 87 60 17 + + + + + $PROJ_DIR$\srcIAR\Cstartup.s + + + AARM + 118 130 + + + + + AARM + 218 + + + + + $PROJ_DIR$\..\src\ext_irq.c + ICCARM + + + $PROJ_DIR$\..\src\interrupt_timer.c + ICCARM + + + $PROJ_DIR$\..\src\interrupt_Usart.c + ICCARM + + + $PROJ_DIR$\..\src\main.c + ICCARM + + + + + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/cmock_demo.ewd b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/cmock_demo.ewd new file mode 100644 index 0000000..27cc8e9 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/cmock_demo.ewd @@ -0,0 +1,1906 @@ + + + + 2 + + RAM_Debug + + ARM + + 1 + + C-SPY + 2 + + 18 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 1 + + + + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + JLINK_ID + 2 + + 10 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + MACRAIGOR_ID + 2 + + 3 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin + 1 + + + + + FLASH_Debug + + ARM + + 1 + + C-SPY + 2 + + 18 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 1 + + + + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + JLINK_ID + 2 + + 10 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + MACRAIGOR_ID + 2 + + 3 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin + 1 + + + + + Binary + + ARM + + 1 + + C-SPY + 2 + + 18 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 1 + + + + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + JLINK_ID + 2 + + 10 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + MACRAIGOR_ID + 2 + + 3 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin + 1 + + + + + + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/cmock_demo.ewp b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/cmock_demo.ewp new file mode 100644 index 0000000..4524d91 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/cmock_demo.ewp @@ -0,0 +1,2426 @@ + + + + 2 + + RAM_Debug + + ARM + + 1 + + General + 3 + + 16 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 20 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + ILINK + 0 + + 6 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + FLASH_Debug + + ARM + + 1 + + General + 3 + + 16 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 20 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + ILINK + 0 + + 6 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + Binary + + ARM + + 1 + + General + 3 + + 16 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 20 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + ILINK + 0 + + 6 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + Binary + + + Resource + + $PROJ_DIR$\Resource\at91SAM7X256_FLASH.icf + + + $PROJ_DIR$\Resource\at91SAM7X256_RAM.icf + + + $PROJ_DIR$\Resource\SAM7_FLASH.mac + + + $PROJ_DIR$\Resource\SAM7_RAM.mac + + + + Source + + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + + + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + + + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + + + $PROJ_DIR$\..\..\examples\src\AdcModel.c + + + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + + + $PROJ_DIR$\..\..\examples\src\Executor.c + + + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + + + $PROJ_DIR$\..\..\examples\src\Main.c + + + $PROJ_DIR$\..\..\examples\src\Model.c + + + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + + + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + + + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + + + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + + + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + + + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + + + $PROJ_DIR$\..\..\examples\src\TimerModel.c + + + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + + + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + + + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + + + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + + + $PROJ_DIR$\..\..\examples\src\UsartModel.c + + + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + + + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + + + + Startup + + $PROJ_DIR$\srcIAR\Cstartup.s + + + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + + + + + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/cmock_demo.eww b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/cmock_demo.eww new file mode 100644 index 0000000..a299a5d --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/cmock_demo.eww @@ -0,0 +1,26 @@ + + + + + $WS_DIR$\cmock_demo.ewp + + + + All + + cmock_demo + Binary + + + cmock_demo + FLASH_Debug + + + cmock_demo + RAM_Debug + + + + + + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/incIAR/AT91SAM7X-EK.h b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/incIAR/AT91SAM7X-EK.h new file mode 100644 index 0000000..9834675 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/incIAR/AT91SAM7X-EK.h @@ -0,0 +1,61 @@ +// ---------------------------------------------------------------------------- +// ATMEL Microcontroller Software Support - ROUSSET - +// ---------------------------------------------------------------------------- +// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// ---------------------------------------------------------------------------- +// File Name : AT91SAM7X-EK.h +// Object : AT91SAM7X-EK Evaluation Board Features Definition File +// +// ---------------------------------------------------------------------------- + +#ifndef AT91SAM7X_EK_H +#define AT91SAM7X_EK_H + +/*-----------------*/ +/* LEDs Definition */ +/*-----------------*/ +#define AT91B_LED1 (1<<19) // AT91C_PIO_PB19 AT91C_PB19_PWM0 AT91C_PB19_TCLK1 +#define AT91B_LED2 (1<<20) // AT91C_PIO_PB20 AT91C_PB20_PWM1 AT91C_PB20_PWM1 +#define AT91B_LED3 (AT91C_PIO_PB21) // AT91C_PIO_PB21 AT91C_PB21_PWM2 AT91C_PB21_PCK1 +#define AT91B_LED4 (AT91C_PIO_PB22) // AT91C_PIO_PB22 AT91C_PB22_PWM3 AT91C_PB22_PCK2 +#define AT91B_NB_LEB 4 +#define AT91B_LED_MASK (AT91B_LED1|AT91B_LED2|AT91B_LED3|AT91B_LED4) +#define AT91D_BASE_PIO_LED (AT91C_BASE_PIOB) + +#define AT91B_POWERLED (1<<25) // PB25 + + +/*-------------------------------*/ +/* JOYSTICK Position Definition */ +/*-------------------------------*/ +#define AT91B_SW1 (1<<21) // PA21 Up Button AT91C_PA21_TF AT91C_PA21_NPCS10 +#define AT91B_SW2 (1<<22) // PA22 Down Button AT91C_PA22_TK AT91C_PA22_SPCK1 +#define AT91B_SW3 (1<<23) // PA23 Left Button AT91C_PA23_TD AT91C_PA23_MOSI1 +#define AT91B_SW4 (1<<24) // PA24 Right Button AT91C_PA24_RD AT91C_PA24_MISO1 +#define AT91B_SW5 (1<<25) // PA25 Push Button AT91C_PA25_RK AT91C_PA25_NPCS11 +#define AT91B_SW_MASK (AT91B_SW1|AT91B_SW2|AT91B_SW3|AT91B_SW4|AT91B_SW5) + + +#define AT91D_BASE_PIO_SW (AT91C_BASE_PIOA) + +/*------------------*/ +/* CAN Definition */ +/*------------------*/ +#define AT91B_CAN_TRANSCEIVER_RS (1<<2) // PA2 + +/*--------------*/ +/* Clocks */ +/*--------------*/ +#define AT91B_MAIN_OSC 18432000 // Main Oscillator MAINCK +#define AT91B_MCK ((18432000*73/14)/2) // Output PLL Clock + +#endif /* AT91SAM7X-EK_H */ diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/incIAR/AT91SAM7X256_inc.h b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/incIAR/AT91SAM7X256_inc.h new file mode 100644 index 0000000..18e58d4 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/incIAR/AT91SAM7X256_inc.h @@ -0,0 +1,2268 @@ +// ---------------------------------------------------------------------------- +// ATMEL Microcontroller Software Support - ROUSSET - +// ---------------------------------------------------------------------------- +// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// ---------------------------------------------------------------------------- +// File Name : AT91SAM7X256.h +// Object : AT91SAM7X256 definitions +// Generated : AT91 SW Application Group 01/16/2006 (16:36:22) +// +// CVS Reference : /AT91SAM7X256.pl/1.15/Wed Nov 2 13:56:49 2005// +// CVS Reference : /SYS_SAM7X.pl/1.3/Tue Feb 1 17:01:43 2005// +// CVS Reference : /MC_SAM7X.pl/1.2/Fri May 20 14:13:04 2005// +// CVS Reference : /PMC_SAM7X.pl/1.4/Tue Feb 8 13:58:10 2005// +// CVS Reference : /RSTC_SAM7X.pl/1.2/Wed Jul 13 14:57:50 2005// +// CVS Reference : /UDP_SAM7X.pl/1.1/Tue May 10 11:35:35 2005// +// CVS Reference : /PWM_SAM7X.pl/1.1/Tue May 10 11:53:07 2005// +// CVS Reference : /AIC_6075B.pl/1.3/Fri May 20 14:01:30 2005// +// CVS Reference : /PIO_6057A.pl/1.2/Thu Feb 3 10:18:28 2005// +// CVS Reference : /RTTC_6081A.pl/1.2/Tue Nov 9 14:43:58 2004// +// CVS Reference : /PITC_6079A.pl/1.2/Tue Nov 9 14:43:56 2004// +// CVS Reference : /WDTC_6080A.pl/1.3/Tue Nov 9 14:44:00 2004// +// CVS Reference : /VREG_6085B.pl/1.1/Tue Feb 1 16:05:48 2005// +// CVS Reference : /PDC_6074C.pl/1.2/Thu Feb 3 08:48:54 2005// +// CVS Reference : /DBGU_6059D.pl/1.1/Mon Jan 31 13:15:32 2005// +// CVS Reference : /SPI_6088D.pl/1.3/Fri May 20 14:08:59 2005// +// CVS Reference : /US_6089C.pl/1.1/Mon Jul 12 18:23:26 2004// +// CVS Reference : /SSC_6078B.pl/1.1/Wed Jul 13 15:19:19 2005// +// CVS Reference : /TWI_6061A.pl/1.1/Tue Jul 13 07:38:06 2004// +// CVS Reference : /TC_6082A.pl/1.7/Fri Mar 11 12:52:17 2005// +// CVS Reference : /CAN_6019B.pl/1.1/Tue Mar 8 12:42:22 2005// +// CVS Reference : /EMACB_6119A.pl/1.6/Wed Jul 13 15:05:35 2005// +// CVS Reference : /ADC_6051C.pl/1.1/Fri Oct 17 09:12:38 2003// +// ---------------------------------------------------------------------------- + +// Hardware register definition + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR System Peripherals +// ***************************************************************************** + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Advanced Interrupt Controller +// ***************************************************************************** +// *** Register offset in AT91S_AIC structure *** +#define AIC_SMR ( 0) // Source Mode Register +#define AIC_SVR (128) // Source Vector Register +#define AIC_IVR (256) // IRQ Vector Register +#define AIC_FVR (260) // FIQ Vector Register +#define AIC_ISR (264) // Interrupt Status Register +#define AIC_IPR (268) // Interrupt Pending Register +#define AIC_IMR (272) // Interrupt Mask Register +#define AIC_CISR (276) // Core Interrupt Status Register +#define AIC_IECR (288) // Interrupt Enable Command Register +#define AIC_IDCR (292) // Interrupt Disable Command Register +#define AIC_ICCR (296) // Interrupt Clear Command Register +#define AIC_ISCR (300) // Interrupt Set Command Register +#define AIC_EOICR (304) // End of Interrupt Command Register +#define AIC_SPU (308) // Spurious Vector Register +#define AIC_DCR (312) // Debug Control Register (Protect) +#define AIC_FFER (320) // Fast Forcing Enable Register +#define AIC_FFDR (324) // Fast Forcing Disable Register +#define AIC_FFSR (328) // Fast Forcing Status Register +// -------- AIC_SMR : (AIC Offset: 0x0) Control Register -------- +#define AT91C_AIC_PRIOR (0x7 << 0) // (AIC) Priority Level +#define AT91C_AIC_PRIOR_LOWEST (0x0) // (AIC) Lowest priority level +#define AT91C_AIC_PRIOR_HIGHEST (0x7) // (AIC) Highest priority level +#define AT91C_AIC_SRCTYPE (0x3 << 5) // (AIC) Interrupt Source Type +#define AT91C_AIC_SRCTYPE_EXT_LOW_LEVEL (0x0 << 5) // (AIC) External Sources Code Label Low-level Sensitive +#define AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL (0x0 << 5) // (AIC) Internal Sources Code Label High-level Sensitive +#define AT91C_AIC_SRCTYPE_INT_POSITIVE_EDGE (0x1 << 5) // (AIC) Internal Sources Code Label Positive Edge triggered +#define AT91C_AIC_SRCTYPE_EXT_NEGATIVE_EDGE (0x1 << 5) // (AIC) External Sources Code Label Negative Edge triggered +#define AT91C_AIC_SRCTYPE_HIGH_LEVEL (0x2 << 5) // (AIC) Internal Or External Sources Code Label High-level Sensitive +#define AT91C_AIC_SRCTYPE_POSITIVE_EDGE (0x3 << 5) // (AIC) Internal Or External Sources Code Label Positive Edge triggered +// -------- AIC_CISR : (AIC Offset: 0x114) AIC Core Interrupt Status Register -------- +#define AT91C_AIC_NFIQ (0x1 << 0) // (AIC) NFIQ Status +#define AT91C_AIC_NIRQ (0x1 << 1) // (AIC) NIRQ Status +// -------- AIC_DCR : (AIC Offset: 0x138) AIC Debug Control Register (Protect) -------- +#define AT91C_AIC_DCR_PROT (0x1 << 0) // (AIC) Protection Mode +#define AT91C_AIC_DCR_GMSK (0x1 << 1) // (AIC) General Mask + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Peripheral DMA Controller +// ***************************************************************************** +// *** Register offset in AT91S_PDC structure *** +#define PDC_RPR ( 0) // Receive Pointer Register +#define PDC_RCR ( 4) // Receive Counter Register +#define PDC_TPR ( 8) // Transmit Pointer Register +#define PDC_TCR (12) // Transmit Counter Register +#define PDC_RNPR (16) // Receive Next Pointer Register +#define PDC_RNCR (20) // Receive Next Counter Register +#define PDC_TNPR (24) // Transmit Next Pointer Register +#define PDC_TNCR (28) // Transmit Next Counter Register +#define PDC_PTCR (32) // PDC Transfer Control Register +#define PDC_PTSR (36) // PDC Transfer Status Register +// -------- PDC_PTCR : (PDC Offset: 0x20) PDC Transfer Control Register -------- +#define AT91C_PDC_RXTEN (0x1 << 0) // (PDC) Receiver Transfer Enable +#define AT91C_PDC_RXTDIS (0x1 << 1) // (PDC) Receiver Transfer Disable +#define AT91C_PDC_TXTEN (0x1 << 8) // (PDC) Transmitter Transfer Enable +#define AT91C_PDC_TXTDIS (0x1 << 9) // (PDC) Transmitter Transfer Disable +// -------- PDC_PTSR : (PDC Offset: 0x24) PDC Transfer Status Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Debug Unit +// ***************************************************************************** +// *** Register offset in AT91S_DBGU structure *** +#define DBGU_CR ( 0) // Control Register +#define DBGU_MR ( 4) // Mode Register +#define DBGU_IER ( 8) // Interrupt Enable Register +#define DBGU_IDR (12) // Interrupt Disable Register +#define DBGU_IMR (16) // Interrupt Mask Register +#define DBGU_CSR (20) // Channel Status Register +#define DBGU_RHR (24) // Receiver Holding Register +#define DBGU_THR (28) // Transmitter Holding Register +#define DBGU_BRGR (32) // Baud Rate Generator Register +#define DBGU_CIDR (64) // Chip ID Register +#define DBGU_EXID (68) // Chip ID Extension Register +#define DBGU_FNTR (72) // Force NTRST Register +#define DBGU_RPR (256) // Receive Pointer Register +#define DBGU_RCR (260) // Receive Counter Register +#define DBGU_TPR (264) // Transmit Pointer Register +#define DBGU_TCR (268) // Transmit Counter Register +#define DBGU_RNPR (272) // Receive Next Pointer Register +#define DBGU_RNCR (276) // Receive Next Counter Register +#define DBGU_TNPR (280) // Transmit Next Pointer Register +#define DBGU_TNCR (284) // Transmit Next Counter Register +#define DBGU_PTCR (288) // PDC Transfer Control Register +#define DBGU_PTSR (292) // PDC Transfer Status Register +// -------- DBGU_CR : (DBGU Offset: 0x0) Debug Unit Control Register -------- +#define AT91C_US_RSTRX (0x1 << 2) // (DBGU) Reset Receiver +#define AT91C_US_RSTTX (0x1 << 3) // (DBGU) Reset Transmitter +#define AT91C_US_RXEN (0x1 << 4) // (DBGU) Receiver Enable +#define AT91C_US_RXDIS (0x1 << 5) // (DBGU) Receiver Disable +#define AT91C_US_TXEN (0x1 << 6) // (DBGU) Transmitter Enable +#define AT91C_US_TXDIS (0x1 << 7) // (DBGU) Transmitter Disable +#define AT91C_US_RSTSTA (0x1 << 8) // (DBGU) Reset Status Bits +// -------- DBGU_MR : (DBGU Offset: 0x4) Debug Unit Mode Register -------- +#define AT91C_US_PAR (0x7 << 9) // (DBGU) Parity type +#define AT91C_US_PAR_EVEN (0x0 << 9) // (DBGU) Even Parity +#define AT91C_US_PAR_ODD (0x1 << 9) // (DBGU) Odd Parity +#define AT91C_US_PAR_SPACE (0x2 << 9) // (DBGU) Parity forced to 0 (Space) +#define AT91C_US_PAR_MARK (0x3 << 9) // (DBGU) Parity forced to 1 (Mark) +#define AT91C_US_PAR_NONE (0x4 << 9) // (DBGU) No Parity +#define AT91C_US_PAR_MULTI_DROP (0x6 << 9) // (DBGU) Multi-drop mode +#define AT91C_US_CHMODE (0x3 << 14) // (DBGU) Channel Mode +#define AT91C_US_CHMODE_NORMAL (0x0 << 14) // (DBGU) Normal Mode: The USART channel operates as an RX/TX USART. +#define AT91C_US_CHMODE_AUTO (0x1 << 14) // (DBGU) Automatic Echo: Receiver Data Input is connected to the TXD pin. +#define AT91C_US_CHMODE_LOCAL (0x2 << 14) // (DBGU) Local Loopback: Transmitter Output Signal is connected to Receiver Input Signal. +#define AT91C_US_CHMODE_REMOTE (0x3 << 14) // (DBGU) Remote Loopback: RXD pin is internally connected to TXD pin. +// -------- DBGU_IER : (DBGU Offset: 0x8) Debug Unit Interrupt Enable Register -------- +#define AT91C_US_RXRDY (0x1 << 0) // (DBGU) RXRDY Interrupt +#define AT91C_US_TXRDY (0x1 << 1) // (DBGU) TXRDY Interrupt +#define AT91C_US_ENDRX (0x1 << 3) // (DBGU) End of Receive Transfer Interrupt +#define AT91C_US_ENDTX (0x1 << 4) // (DBGU) End of Transmit Interrupt +#define AT91C_US_OVRE (0x1 << 5) // (DBGU) Overrun Interrupt +#define AT91C_US_FRAME (0x1 << 6) // (DBGU) Framing Error Interrupt +#define AT91C_US_PARE (0x1 << 7) // (DBGU) Parity Error Interrupt +#define AT91C_US_TXEMPTY (0x1 << 9) // (DBGU) TXEMPTY Interrupt +#define AT91C_US_TXBUFE (0x1 << 11) // (DBGU) TXBUFE Interrupt +#define AT91C_US_RXBUFF (0x1 << 12) // (DBGU) RXBUFF Interrupt +#define AT91C_US_COMM_TX (0x1 << 30) // (DBGU) COMM_TX Interrupt +#define AT91C_US_COMM_RX (0x1 << 31) // (DBGU) COMM_RX Interrupt +// -------- DBGU_IDR : (DBGU Offset: 0xc) Debug Unit Interrupt Disable Register -------- +// -------- DBGU_IMR : (DBGU Offset: 0x10) Debug Unit Interrupt Mask Register -------- +// -------- DBGU_CSR : (DBGU Offset: 0x14) Debug Unit Channel Status Register -------- +// -------- DBGU_FNTR : (DBGU Offset: 0x48) Debug Unit FORCE_NTRST Register -------- +#define AT91C_US_FORCE_NTRST (0x1 << 0) // (DBGU) Force NTRST in JTAG + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Parallel Input Output Controler +// ***************************************************************************** +// *** Register offset in AT91S_PIO structure *** +#define PIO_PER ( 0) // PIO Enable Register +#define PIO_PDR ( 4) // PIO Disable Register +#define PIO_PSR ( 8) // PIO Status Register +#define PIO_OER (16) // Output Enable Register +#define PIO_ODR (20) // Output Disable Registerr +#define PIO_OSR (24) // Output Status Register +#define PIO_IFER (32) // Input Filter Enable Register +#define PIO_IFDR (36) // Input Filter Disable Register +#define PIO_IFSR (40) // Input Filter Status Register +#define PIO_SODR (48) // Set Output Data Register +#define PIO_CODR (52) // Clear Output Data Register +#define PIO_ODSR (56) // Output Data Status Register +#define PIO_PDSR (60) // Pin Data Status Register +#define PIO_IER (64) // Interrupt Enable Register +#define PIO_IDR (68) // Interrupt Disable Register +#define PIO_IMR (72) // Interrupt Mask Register +#define PIO_ISR (76) // Interrupt Status Register +#define PIO_MDER (80) // Multi-driver Enable Register +#define PIO_MDDR (84) // Multi-driver Disable Register +#define PIO_MDSR (88) // Multi-driver Status Register +#define PIO_PPUDR (96) // Pull-up Disable Register +#define PIO_PPUER (100) // Pull-up Enable Register +#define PIO_PPUSR (104) // Pull-up Status Register +#define PIO_ASR (112) // Select A Register +#define PIO_BSR (116) // Select B Register +#define PIO_ABSR (120) // AB Select Status Register +#define PIO_OWER (160) // Output Write Enable Register +#define PIO_OWDR (164) // Output Write Disable Register +#define PIO_OWSR (168) // Output Write Status Register + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Clock Generator Controler +// ***************************************************************************** +// *** Register offset in AT91S_CKGR structure *** +#define CKGR_MOR ( 0) // Main Oscillator Register +#define CKGR_MCFR ( 4) // Main Clock Frequency Register +#define CKGR_PLLR (12) // PLL Register +// -------- CKGR_MOR : (CKGR Offset: 0x0) Main Oscillator Register -------- +#define AT91C_CKGR_MOSCEN (0x1 << 0) // (CKGR) Main Oscillator Enable +#define AT91C_CKGR_OSCBYPASS (0x1 << 1) // (CKGR) Main Oscillator Bypass +#define AT91C_CKGR_OSCOUNT (0xFF << 8) // (CKGR) Main Oscillator Start-up Time +// -------- CKGR_MCFR : (CKGR Offset: 0x4) Main Clock Frequency Register -------- +#define AT91C_CKGR_MAINF (0xFFFF << 0) // (CKGR) Main Clock Frequency +#define AT91C_CKGR_MAINRDY (0x1 << 16) // (CKGR) Main Clock Ready +// -------- CKGR_PLLR : (CKGR Offset: 0xc) PLL B Register -------- +#define AT91C_CKGR_DIV (0xFF << 0) // (CKGR) Divider Selected +#define AT91C_CKGR_DIV_0 (0x0) // (CKGR) Divider output is 0 +#define AT91C_CKGR_DIV_BYPASS (0x1) // (CKGR) Divider is bypassed +#define AT91C_CKGR_PLLCOUNT (0x3F << 8) // (CKGR) PLL Counter +#define AT91C_CKGR_OUT (0x3 << 14) // (CKGR) PLL Output Frequency Range +#define AT91C_CKGR_OUT_0 (0x0 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_OUT_1 (0x1 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_OUT_2 (0x2 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_OUT_3 (0x3 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_MUL (0x7FF << 16) // (CKGR) PLL Multiplier +#define AT91C_CKGR_USBDIV (0x3 << 28) // (CKGR) Divider for USB Clocks +#define AT91C_CKGR_USBDIV_0 (0x0 << 28) // (CKGR) Divider output is PLL clock output +#define AT91C_CKGR_USBDIV_1 (0x1 << 28) // (CKGR) Divider output is PLL clock output divided by 2 +#define AT91C_CKGR_USBDIV_2 (0x2 << 28) // (CKGR) Divider output is PLL clock output divided by 4 + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Power Management Controler +// ***************************************************************************** +// *** Register offset in AT91S_PMC structure *** +#define PMC_SCER ( 0) // System Clock Enable Register +#define PMC_SCDR ( 4) // System Clock Disable Register +#define PMC_SCSR ( 8) // System Clock Status Register +#define PMC_PCER (16) // Peripheral Clock Enable Register +#define PMC_PCDR (20) // Peripheral Clock Disable Register +#define PMC_PCSR (24) // Peripheral Clock Status Register +#define PMC_MOR (32) // Main Oscillator Register +#define PMC_MCFR (36) // Main Clock Frequency Register +#define PMC_PLLR (44) // PLL Register +#define PMC_MCKR (48) // Master Clock Register +#define PMC_PCKR (64) // Programmable Clock Register +#define PMC_IER (96) // Interrupt Enable Register +#define PMC_IDR (100) // Interrupt Disable Register +#define PMC_SR (104) // Status Register +#define PMC_IMR (108) // Interrupt Mask Register +// -------- PMC_SCER : (PMC Offset: 0x0) System Clock Enable Register -------- +#define AT91C_PMC_PCK (0x1 << 0) // (PMC) Processor Clock +#define AT91C_PMC_UDP (0x1 << 7) // (PMC) USB Device Port Clock +#define AT91C_PMC_PCK0 (0x1 << 8) // (PMC) Programmable Clock Output +#define AT91C_PMC_PCK1 (0x1 << 9) // (PMC) Programmable Clock Output +#define AT91C_PMC_PCK2 (0x1 << 10) // (PMC) Programmable Clock Output +#define AT91C_PMC_PCK3 (0x1 << 11) // (PMC) Programmable Clock Output +// -------- PMC_SCDR : (PMC Offset: 0x4) System Clock Disable Register -------- +// -------- PMC_SCSR : (PMC Offset: 0x8) System Clock Status Register -------- +// -------- CKGR_MOR : (PMC Offset: 0x20) Main Oscillator Register -------- +// -------- CKGR_MCFR : (PMC Offset: 0x24) Main Clock Frequency Register -------- +// -------- CKGR_PLLR : (PMC Offset: 0x2c) PLL B Register -------- +// -------- PMC_MCKR : (PMC Offset: 0x30) Master Clock Register -------- +#define AT91C_PMC_CSS (0x3 << 0) // (PMC) Programmable Clock Selection +#define AT91C_PMC_CSS_SLOW_CLK (0x0) // (PMC) Slow Clock is selected +#define AT91C_PMC_CSS_MAIN_CLK (0x1) // (PMC) Main Clock is selected +#define AT91C_PMC_CSS_PLL_CLK (0x3) // (PMC) Clock from PLL is selected +#define AT91C_PMC_PRES (0x7 << 2) // (PMC) Programmable Clock Prescaler +#define AT91C_PMC_PRES_CLK (0x0 << 2) // (PMC) Selected clock +#define AT91C_PMC_PRES_CLK_2 (0x1 << 2) // (PMC) Selected clock divided by 2 +#define AT91C_PMC_PRES_CLK_4 (0x2 << 2) // (PMC) Selected clock divided by 4 +#define AT91C_PMC_PRES_CLK_8 (0x3 << 2) // (PMC) Selected clock divided by 8 +#define AT91C_PMC_PRES_CLK_16 (0x4 << 2) // (PMC) Selected clock divided by 16 +#define AT91C_PMC_PRES_CLK_32 (0x5 << 2) // (PMC) Selected clock divided by 32 +#define AT91C_PMC_PRES_CLK_64 (0x6 << 2) // (PMC) Selected clock divided by 64 +// -------- PMC_PCKR : (PMC Offset: 0x40) Programmable Clock Register -------- +// -------- PMC_IER : (PMC Offset: 0x60) PMC Interrupt Enable Register -------- +#define AT91C_PMC_MOSCS (0x1 << 0) // (PMC) MOSC Status/Enable/Disable/Mask +#define AT91C_PMC_LOCK (0x1 << 2) // (PMC) PLL Status/Enable/Disable/Mask +#define AT91C_PMC_MCKRDY (0x1 << 3) // (PMC) MCK_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK0RDY (0x1 << 8) // (PMC) PCK0_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK1RDY (0x1 << 9) // (PMC) PCK1_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK2RDY (0x1 << 10) // (PMC) PCK2_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK3RDY (0x1 << 11) // (PMC) PCK3_RDY Status/Enable/Disable/Mask +// -------- PMC_IDR : (PMC Offset: 0x64) PMC Interrupt Disable Register -------- +// -------- PMC_SR : (PMC Offset: 0x68) PMC Status Register -------- +// -------- PMC_IMR : (PMC Offset: 0x6c) PMC Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Reset Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_RSTC structure *** +#define RSTC_RCR ( 0) // Reset Control Register +#define RSTC_RSR ( 4) // Reset Status Register +#define RSTC_RMR ( 8) // Reset Mode Register +// -------- RSTC_RCR : (RSTC Offset: 0x0) Reset Control Register -------- +#define AT91C_RSTC_PROCRST (0x1 << 0) // (RSTC) Processor Reset +#define AT91C_RSTC_PERRST (0x1 << 2) // (RSTC) Peripheral Reset +#define AT91C_RSTC_EXTRST (0x1 << 3) // (RSTC) External Reset +#define AT91C_RSTC_KEY (0xFF << 24) // (RSTC) Password +// -------- RSTC_RSR : (RSTC Offset: 0x4) Reset Status Register -------- +#define AT91C_RSTC_URSTS (0x1 << 0) // (RSTC) User Reset Status +#define AT91C_RSTC_BODSTS (0x1 << 1) // (RSTC) Brownout Detection Status +#define AT91C_RSTC_RSTTYP (0x7 << 8) // (RSTC) Reset Type +#define AT91C_RSTC_RSTTYP_POWERUP (0x0 << 8) // (RSTC) Power-up Reset. VDDCORE rising. +#define AT91C_RSTC_RSTTYP_WAKEUP (0x1 << 8) // (RSTC) WakeUp Reset. VDDCORE rising. +#define AT91C_RSTC_RSTTYP_WATCHDOG (0x2 << 8) // (RSTC) Watchdog Reset. Watchdog overflow occured. +#define AT91C_RSTC_RSTTYP_SOFTWARE (0x3 << 8) // (RSTC) Software Reset. Processor reset required by the software. +#define AT91C_RSTC_RSTTYP_USER (0x4 << 8) // (RSTC) User Reset. NRST pin detected low. +#define AT91C_RSTC_RSTTYP_BROWNOUT (0x5 << 8) // (RSTC) Brownout Reset occured. +#define AT91C_RSTC_NRSTL (0x1 << 16) // (RSTC) NRST pin level +#define AT91C_RSTC_SRCMP (0x1 << 17) // (RSTC) Software Reset Command in Progress. +// -------- RSTC_RMR : (RSTC Offset: 0x8) Reset Mode Register -------- +#define AT91C_RSTC_URSTEN (0x1 << 0) // (RSTC) User Reset Enable +#define AT91C_RSTC_URSTIEN (0x1 << 4) // (RSTC) User Reset Interrupt Enable +#define AT91C_RSTC_ERSTL (0xF << 8) // (RSTC) User Reset Length +#define AT91C_RSTC_BODIEN (0x1 << 16) // (RSTC) Brownout Detection Interrupt Enable + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Real Time Timer Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_RTTC structure *** +#define RTTC_RTMR ( 0) // Real-time Mode Register +#define RTTC_RTAR ( 4) // Real-time Alarm Register +#define RTTC_RTVR ( 8) // Real-time Value Register +#define RTTC_RTSR (12) // Real-time Status Register +// -------- RTTC_RTMR : (RTTC Offset: 0x0) Real-time Mode Register -------- +#define AT91C_RTTC_RTPRES (0xFFFF << 0) // (RTTC) Real-time Timer Prescaler Value +#define AT91C_RTTC_ALMIEN (0x1 << 16) // (RTTC) Alarm Interrupt Enable +#define AT91C_RTTC_RTTINCIEN (0x1 << 17) // (RTTC) Real Time Timer Increment Interrupt Enable +#define AT91C_RTTC_RTTRST (0x1 << 18) // (RTTC) Real Time Timer Restart +// -------- RTTC_RTAR : (RTTC Offset: 0x4) Real-time Alarm Register -------- +#define AT91C_RTTC_ALMV (0x0 << 0) // (RTTC) Alarm Value +// -------- RTTC_RTVR : (RTTC Offset: 0x8) Current Real-time Value Register -------- +#define AT91C_RTTC_CRTV (0x0 << 0) // (RTTC) Current Real-time Value +// -------- RTTC_RTSR : (RTTC Offset: 0xc) Real-time Status Register -------- +#define AT91C_RTTC_ALMS (0x1 << 0) // (RTTC) Real-time Alarm Status +#define AT91C_RTTC_RTTINC (0x1 << 1) // (RTTC) Real-time Timer Increment + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Periodic Interval Timer Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_PITC structure *** +#define PITC_PIMR ( 0) // Period Interval Mode Register +#define PITC_PISR ( 4) // Period Interval Status Register +#define PITC_PIVR ( 8) // Period Interval Value Register +#define PITC_PIIR (12) // Period Interval Image Register +// -------- PITC_PIMR : (PITC Offset: 0x0) Periodic Interval Mode Register -------- +#define AT91C_PITC_PIV (0xFFFFF << 0) // (PITC) Periodic Interval Value +#define AT91C_PITC_PITEN (0x1 << 24) // (PITC) Periodic Interval Timer Enabled +#define AT91C_PITC_PITIEN (0x1 << 25) // (PITC) Periodic Interval Timer Interrupt Enable +// -------- PITC_PISR : (PITC Offset: 0x4) Periodic Interval Status Register -------- +#define AT91C_PITC_PITS (0x1 << 0) // (PITC) Periodic Interval Timer Status +// -------- PITC_PIVR : (PITC Offset: 0x8) Periodic Interval Value Register -------- +#define AT91C_PITC_CPIV (0xFFFFF << 0) // (PITC) Current Periodic Interval Value +#define AT91C_PITC_PICNT (0xFFF << 20) // (PITC) Periodic Interval Counter +// -------- PITC_PIIR : (PITC Offset: 0xc) Periodic Interval Image Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Watchdog Timer Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_WDTC structure *** +#define WDTC_WDCR ( 0) // Watchdog Control Register +#define WDTC_WDMR ( 4) // Watchdog Mode Register +#define WDTC_WDSR ( 8) // Watchdog Status Register +// -------- WDTC_WDCR : (WDTC Offset: 0x0) Periodic Interval Image Register -------- +#define AT91C_WDTC_WDRSTT (0x1 << 0) // (WDTC) Watchdog Restart +#define AT91C_WDTC_KEY (0xFF << 24) // (WDTC) Watchdog KEY Password +// -------- WDTC_WDMR : (WDTC Offset: 0x4) Watchdog Mode Register -------- +#define AT91C_WDTC_WDV (0xFFF << 0) // (WDTC) Watchdog Timer Restart +#define AT91C_WDTC_WDFIEN (0x1 << 12) // (WDTC) Watchdog Fault Interrupt Enable +#define AT91C_WDTC_WDRSTEN (0x1 << 13) // (WDTC) Watchdog Reset Enable +#define AT91C_WDTC_WDRPROC (0x1 << 14) // (WDTC) Watchdog Timer Restart +#define AT91C_WDTC_WDDIS (0x1 << 15) // (WDTC) Watchdog Disable +#define AT91C_WDTC_WDD (0xFFF << 16) // (WDTC) Watchdog Delta Value +#define AT91C_WDTC_WDDBGHLT (0x1 << 28) // (WDTC) Watchdog Debug Halt +#define AT91C_WDTC_WDIDLEHLT (0x1 << 29) // (WDTC) Watchdog Idle Halt +// -------- WDTC_WDSR : (WDTC Offset: 0x8) Watchdog Status Register -------- +#define AT91C_WDTC_WDUNF (0x1 << 0) // (WDTC) Watchdog Underflow +#define AT91C_WDTC_WDERR (0x1 << 1) // (WDTC) Watchdog Error + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Voltage Regulator Mode Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_VREG structure *** +#define VREG_MR ( 0) // Voltage Regulator Mode Register +// -------- VREG_MR : (VREG Offset: 0x0) Voltage Regulator Mode Register -------- +#define AT91C_VREG_PSTDBY (0x1 << 0) // (VREG) Voltage Regulator Power Standby Mode + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Memory Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_MC structure *** +#define MC_RCR ( 0) // MC Remap Control Register +#define MC_ASR ( 4) // MC Abort Status Register +#define MC_AASR ( 8) // MC Abort Address Status Register +#define MC_FMR (96) // MC Flash Mode Register +#define MC_FCR (100) // MC Flash Command Register +#define MC_FSR (104) // MC Flash Status Register +// -------- MC_RCR : (MC Offset: 0x0) MC Remap Control Register -------- +#define AT91C_MC_RCB (0x1 << 0) // (MC) Remap Command Bit +// -------- MC_ASR : (MC Offset: 0x4) MC Abort Status Register -------- +#define AT91C_MC_UNDADD (0x1 << 0) // (MC) Undefined Addess Abort Status +#define AT91C_MC_MISADD (0x1 << 1) // (MC) Misaligned Addess Abort Status +#define AT91C_MC_ABTSZ (0x3 << 8) // (MC) Abort Size Status +#define AT91C_MC_ABTSZ_BYTE (0x0 << 8) // (MC) Byte +#define AT91C_MC_ABTSZ_HWORD (0x1 << 8) // (MC) Half-word +#define AT91C_MC_ABTSZ_WORD (0x2 << 8) // (MC) Word +#define AT91C_MC_ABTTYP (0x3 << 10) // (MC) Abort Type Status +#define AT91C_MC_ABTTYP_DATAR (0x0 << 10) // (MC) Data Read +#define AT91C_MC_ABTTYP_DATAW (0x1 << 10) // (MC) Data Write +#define AT91C_MC_ABTTYP_FETCH (0x2 << 10) // (MC) Code Fetch +#define AT91C_MC_MST0 (0x1 << 16) // (MC) Master 0 Abort Source +#define AT91C_MC_MST1 (0x1 << 17) // (MC) Master 1 Abort Source +#define AT91C_MC_SVMST0 (0x1 << 24) // (MC) Saved Master 0 Abort Source +#define AT91C_MC_SVMST1 (0x1 << 25) // (MC) Saved Master 1 Abort Source +// -------- MC_FMR : (MC Offset: 0x60) MC Flash Mode Register -------- +#define AT91C_MC_FRDY (0x1 << 0) // (MC) Flash Ready +#define AT91C_MC_LOCKE (0x1 << 2) // (MC) Lock Error +#define AT91C_MC_PROGE (0x1 << 3) // (MC) Programming Error +#define AT91C_MC_NEBP (0x1 << 7) // (MC) No Erase Before Programming +#define AT91C_MC_FWS (0x3 << 8) // (MC) Flash Wait State +#define AT91C_MC_FWS_0FWS (0x0 << 8) // (MC) 1 cycle for Read, 2 for Write operations +#define AT91C_MC_FWS_1FWS (0x1 << 8) // (MC) 2 cycles for Read, 3 for Write operations +#define AT91C_MC_FWS_2FWS (0x2 << 8) // (MC) 3 cycles for Read, 4 for Write operations +#define AT91C_MC_FWS_3FWS (0x3 << 8) // (MC) 4 cycles for Read, 4 for Write operations +#define AT91C_MC_FMCN (0xFF << 16) // (MC) Flash Microsecond Cycle Number +// -------- MC_FCR : (MC Offset: 0x64) MC Flash Command Register -------- +#define AT91C_MC_FCMD (0xF << 0) // (MC) Flash Command +#define AT91C_MC_FCMD_START_PROG (0x1) // (MC) Starts the programming of th epage specified by PAGEN. +#define AT91C_MC_FCMD_LOCK (0x2) // (MC) Starts a lock sequence of the sector defined by the bits 4 to 7 of the field PAGEN. +#define AT91C_MC_FCMD_PROG_AND_LOCK (0x3) // (MC) The lock sequence automatically happens after the programming sequence is completed. +#define AT91C_MC_FCMD_UNLOCK (0x4) // (MC) Starts an unlock sequence of the sector defined by the bits 4 to 7 of the field PAGEN. +#define AT91C_MC_FCMD_ERASE_ALL (0x8) // (MC) Starts the erase of the entire flash.If at least a page is locked, the command is cancelled. +#define AT91C_MC_FCMD_SET_GP_NVM (0xB) // (MC) Set General Purpose NVM bits. +#define AT91C_MC_FCMD_CLR_GP_NVM (0xD) // (MC) Clear General Purpose NVM bits. +#define AT91C_MC_FCMD_SET_SECURITY (0xF) // (MC) Set Security Bit. +#define AT91C_MC_PAGEN (0x3FF << 8) // (MC) Page Number +#define AT91C_MC_KEY (0xFF << 24) // (MC) Writing Protect Key +// -------- MC_FSR : (MC Offset: 0x68) MC Flash Command Register -------- +#define AT91C_MC_SECURITY (0x1 << 4) // (MC) Security Bit Status +#define AT91C_MC_GPNVM0 (0x1 << 8) // (MC) Sector 0 Lock Status +#define AT91C_MC_GPNVM1 (0x1 << 9) // (MC) Sector 1 Lock Status +#define AT91C_MC_GPNVM2 (0x1 << 10) // (MC) Sector 2 Lock Status +#define AT91C_MC_GPNVM3 (0x1 << 11) // (MC) Sector 3 Lock Status +#define AT91C_MC_GPNVM4 (0x1 << 12) // (MC) Sector 4 Lock Status +#define AT91C_MC_GPNVM5 (0x1 << 13) // (MC) Sector 5 Lock Status +#define AT91C_MC_GPNVM6 (0x1 << 14) // (MC) Sector 6 Lock Status +#define AT91C_MC_GPNVM7 (0x1 << 15) // (MC) Sector 7 Lock Status +#define AT91C_MC_LOCKS0 (0x1 << 16) // (MC) Sector 0 Lock Status +#define AT91C_MC_LOCKS1 (0x1 << 17) // (MC) Sector 1 Lock Status +#define AT91C_MC_LOCKS2 (0x1 << 18) // (MC) Sector 2 Lock Status +#define AT91C_MC_LOCKS3 (0x1 << 19) // (MC) Sector 3 Lock Status +#define AT91C_MC_LOCKS4 (0x1 << 20) // (MC) Sector 4 Lock Status +#define AT91C_MC_LOCKS5 (0x1 << 21) // (MC) Sector 5 Lock Status +#define AT91C_MC_LOCKS6 (0x1 << 22) // (MC) Sector 6 Lock Status +#define AT91C_MC_LOCKS7 (0x1 << 23) // (MC) Sector 7 Lock Status +#define AT91C_MC_LOCKS8 (0x1 << 24) // (MC) Sector 8 Lock Status +#define AT91C_MC_LOCKS9 (0x1 << 25) // (MC) Sector 9 Lock Status +#define AT91C_MC_LOCKS10 (0x1 << 26) // (MC) Sector 10 Lock Status +#define AT91C_MC_LOCKS11 (0x1 << 27) // (MC) Sector 11 Lock Status +#define AT91C_MC_LOCKS12 (0x1 << 28) // (MC) Sector 12 Lock Status +#define AT91C_MC_LOCKS13 (0x1 << 29) // (MC) Sector 13 Lock Status +#define AT91C_MC_LOCKS14 (0x1 << 30) // (MC) Sector 14 Lock Status +#define AT91C_MC_LOCKS15 (0x1 << 31) // (MC) Sector 15 Lock Status + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Serial Parallel Interface +// ***************************************************************************** +// *** Register offset in AT91S_SPI structure *** +#define SPI_CR ( 0) // Control Register +#define SPI_MR ( 4) // Mode Register +#define SPI_RDR ( 8) // Receive Data Register +#define SPI_TDR (12) // Transmit Data Register +#define SPI_SR (16) // Status Register +#define SPI_IER (20) // Interrupt Enable Register +#define SPI_IDR (24) // Interrupt Disable Register +#define SPI_IMR (28) // Interrupt Mask Register +#define SPI_CSR (48) // Chip Select Register +#define SPI_RPR (256) // Receive Pointer Register +#define SPI_RCR (260) // Receive Counter Register +#define SPI_TPR (264) // Transmit Pointer Register +#define SPI_TCR (268) // Transmit Counter Register +#define SPI_RNPR (272) // Receive Next Pointer Register +#define SPI_RNCR (276) // Receive Next Counter Register +#define SPI_TNPR (280) // Transmit Next Pointer Register +#define SPI_TNCR (284) // Transmit Next Counter Register +#define SPI_PTCR (288) // PDC Transfer Control Register +#define SPI_PTSR (292) // PDC Transfer Status Register +// -------- SPI_CR : (SPI Offset: 0x0) SPI Control Register -------- +#define AT91C_SPI_SPIEN (0x1 << 0) // (SPI) SPI Enable +#define AT91C_SPI_SPIDIS (0x1 << 1) // (SPI) SPI Disable +#define AT91C_SPI_SWRST (0x1 << 7) // (SPI) SPI Software reset +#define AT91C_SPI_LASTXFER (0x1 << 24) // (SPI) SPI Last Transfer +// -------- SPI_MR : (SPI Offset: 0x4) SPI Mode Register -------- +#define AT91C_SPI_MSTR (0x1 << 0) // (SPI) Master/Slave Mode +#define AT91C_SPI_PS (0x1 << 1) // (SPI) Peripheral Select +#define AT91C_SPI_PS_FIXED (0x0 << 1) // (SPI) Fixed Peripheral Select +#define AT91C_SPI_PS_VARIABLE (0x1 << 1) // (SPI) Variable Peripheral Select +#define AT91C_SPI_PCSDEC (0x1 << 2) // (SPI) Chip Select Decode +#define AT91C_SPI_FDIV (0x1 << 3) // (SPI) Clock Selection +#define AT91C_SPI_MODFDIS (0x1 << 4) // (SPI) Mode Fault Detection +#define AT91C_SPI_LLB (0x1 << 7) // (SPI) Clock Selection +#define AT91C_SPI_PCS (0xF << 16) // (SPI) Peripheral Chip Select +#define AT91C_SPI_DLYBCS (0xFF << 24) // (SPI) Delay Between Chip Selects +// -------- SPI_RDR : (SPI Offset: 0x8) Receive Data Register -------- +#define AT91C_SPI_RD (0xFFFF << 0) // (SPI) Receive Data +#define AT91C_SPI_RPCS (0xF << 16) // (SPI) Peripheral Chip Select Status +// -------- SPI_TDR : (SPI Offset: 0xc) Transmit Data Register -------- +#define AT91C_SPI_TD (0xFFFF << 0) // (SPI) Transmit Data +#define AT91C_SPI_TPCS (0xF << 16) // (SPI) Peripheral Chip Select Status +// -------- SPI_SR : (SPI Offset: 0x10) Status Register -------- +#define AT91C_SPI_RDRF (0x1 << 0) // (SPI) Receive Data Register Full +#define AT91C_SPI_TDRE (0x1 << 1) // (SPI) Transmit Data Register Empty +#define AT91C_SPI_MODF (0x1 << 2) // (SPI) Mode Fault Error +#define AT91C_SPI_OVRES (0x1 << 3) // (SPI) Overrun Error Status +#define AT91C_SPI_ENDRX (0x1 << 4) // (SPI) End of Receiver Transfer +#define AT91C_SPI_ENDTX (0x1 << 5) // (SPI) End of Receiver Transfer +#define AT91C_SPI_RXBUFF (0x1 << 6) // (SPI) RXBUFF Interrupt +#define AT91C_SPI_TXBUFE (0x1 << 7) // (SPI) TXBUFE Interrupt +#define AT91C_SPI_NSSR (0x1 << 8) // (SPI) NSSR Interrupt +#define AT91C_SPI_TXEMPTY (0x1 << 9) // (SPI) TXEMPTY Interrupt +#define AT91C_SPI_SPIENS (0x1 << 16) // (SPI) Enable Status +// -------- SPI_IER : (SPI Offset: 0x14) Interrupt Enable Register -------- +// -------- SPI_IDR : (SPI Offset: 0x18) Interrupt Disable Register -------- +// -------- SPI_IMR : (SPI Offset: 0x1c) Interrupt Mask Register -------- +// -------- SPI_CSR : (SPI Offset: 0x30) Chip Select Register -------- +#define AT91C_SPI_CPOL (0x1 << 0) // (SPI) Clock Polarity +#define AT91C_SPI_NCPHA (0x1 << 1) // (SPI) Clock Phase +#define AT91C_SPI_CSAAT (0x1 << 3) // (SPI) Chip Select Active After Transfer +#define AT91C_SPI_BITS (0xF << 4) // (SPI) Bits Per Transfer +#define AT91C_SPI_BITS_8 (0x0 << 4) // (SPI) 8 Bits Per transfer +#define AT91C_SPI_BITS_9 (0x1 << 4) // (SPI) 9 Bits Per transfer +#define AT91C_SPI_BITS_10 (0x2 << 4) // (SPI) 10 Bits Per transfer +#define AT91C_SPI_BITS_11 (0x3 << 4) // (SPI) 11 Bits Per transfer +#define AT91C_SPI_BITS_12 (0x4 << 4) // (SPI) 12 Bits Per transfer +#define AT91C_SPI_BITS_13 (0x5 << 4) // (SPI) 13 Bits Per transfer +#define AT91C_SPI_BITS_14 (0x6 << 4) // (SPI) 14 Bits Per transfer +#define AT91C_SPI_BITS_15 (0x7 << 4) // (SPI) 15 Bits Per transfer +#define AT91C_SPI_BITS_16 (0x8 << 4) // (SPI) 16 Bits Per transfer +#define AT91C_SPI_SCBR (0xFF << 8) // (SPI) Serial Clock Baud Rate +#define AT91C_SPI_DLYBS (0xFF << 16) // (SPI) Delay Before SPCK +#define AT91C_SPI_DLYBCT (0xFF << 24) // (SPI) Delay Between Consecutive Transfers + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Usart +// ***************************************************************************** +// *** Register offset in AT91S_USART structure *** +#define US_CR ( 0) // Control Register +#define US_MR ( 4) // Mode Register +#define US_IER ( 8) // Interrupt Enable Register +#define US_IDR (12) // Interrupt Disable Register +#define US_IMR (16) // Interrupt Mask Register +#define US_CSR (20) // Channel Status Register +#define US_RHR (24) // Receiver Holding Register +#define US_THR (28) // Transmitter Holding Register +#define US_BRGR (32) // Baud Rate Generator Register +#define US_RTOR (36) // Receiver Time-out Register +#define US_TTGR (40) // Transmitter Time-guard Register +#define US_FIDI (64) // FI_DI_Ratio Register +#define US_NER (68) // Nb Errors Register +#define US_IF (76) // IRDA_FILTER Register +#define US_RPR (256) // Receive Pointer Register +#define US_RCR (260) // Receive Counter Register +#define US_TPR (264) // Transmit Pointer Register +#define US_TCR (268) // Transmit Counter Register +#define US_RNPR (272) // Receive Next Pointer Register +#define US_RNCR (276) // Receive Next Counter Register +#define US_TNPR (280) // Transmit Next Pointer Register +#define US_TNCR (284) // Transmit Next Counter Register +#define US_PTCR (288) // PDC Transfer Control Register +#define US_PTSR (292) // PDC Transfer Status Register +// -------- US_CR : (USART Offset: 0x0) Debug Unit Control Register -------- +#define AT91C_US_STTBRK (0x1 << 9) // (USART) Start Break +#define AT91C_US_STPBRK (0x1 << 10) // (USART) Stop Break +#define AT91C_US_STTTO (0x1 << 11) // (USART) Start Time-out +#define AT91C_US_SENDA (0x1 << 12) // (USART) Send Address +#define AT91C_US_RSTIT (0x1 << 13) // (USART) Reset Iterations +#define AT91C_US_RSTNACK (0x1 << 14) // (USART) Reset Non Acknowledge +#define AT91C_US_RETTO (0x1 << 15) // (USART) Rearm Time-out +#define AT91C_US_DTREN (0x1 << 16) // (USART) Data Terminal ready Enable +#define AT91C_US_DTRDIS (0x1 << 17) // (USART) Data Terminal ready Disable +#define AT91C_US_RTSEN (0x1 << 18) // (USART) Request to Send enable +#define AT91C_US_RTSDIS (0x1 << 19) // (USART) Request to Send Disable +// -------- US_MR : (USART Offset: 0x4) Debug Unit Mode Register -------- +#define AT91C_US_USMODE (0xF << 0) // (USART) Usart mode +#define AT91C_US_USMODE_NORMAL (0x0) // (USART) Normal +#define AT91C_US_USMODE_RS485 (0x1) // (USART) RS485 +#define AT91C_US_USMODE_HWHSH (0x2) // (USART) Hardware Handshaking +#define AT91C_US_USMODE_MODEM (0x3) // (USART) Modem +#define AT91C_US_USMODE_ISO7816_0 (0x4) // (USART) ISO7816 protocol: T = 0 +#define AT91C_US_USMODE_ISO7816_1 (0x6) // (USART) ISO7816 protocol: T = 1 +#define AT91C_US_USMODE_IRDA (0x8) // (USART) IrDA +#define AT91C_US_USMODE_SWHSH (0xC) // (USART) Software Handshaking +#define AT91C_US_CLKS (0x3 << 4) // (USART) Clock Selection (Baud Rate generator Input Clock +#define AT91C_US_CLKS_CLOCK (0x0 << 4) // (USART) Clock +#define AT91C_US_CLKS_FDIV1 (0x1 << 4) // (USART) fdiv1 +#define AT91C_US_CLKS_SLOW (0x2 << 4) // (USART) slow_clock (ARM) +#define AT91C_US_CLKS_EXT (0x3 << 4) // (USART) External (SCK) +#define AT91C_US_CHRL (0x3 << 6) // (USART) Clock Selection (Baud Rate generator Input Clock +#define AT91C_US_CHRL_5_BITS (0x0 << 6) // (USART) Character Length: 5 bits +#define AT91C_US_CHRL_6_BITS (0x1 << 6) // (USART) Character Length: 6 bits +#define AT91C_US_CHRL_7_BITS (0x2 << 6) // (USART) Character Length: 7 bits +#define AT91C_US_CHRL_8_BITS (0x3 << 6) // (USART) Character Length: 8 bits +#define AT91C_US_SYNC (0x1 << 8) // (USART) Synchronous Mode Select +#define AT91C_US_NBSTOP (0x3 << 12) // (USART) Number of Stop bits +#define AT91C_US_NBSTOP_1_BIT (0x0 << 12) // (USART) 1 stop bit +#define AT91C_US_NBSTOP_15_BIT (0x1 << 12) // (USART) Asynchronous (SYNC=0) 2 stop bits Synchronous (SYNC=1) 2 stop bits +#define AT91C_US_NBSTOP_2_BIT (0x2 << 12) // (USART) 2 stop bits +#define AT91C_US_MSBF (0x1 << 16) // (USART) Bit Order +#define AT91C_US_MODE9 (0x1 << 17) // (USART) 9-bit Character length +#define AT91C_US_CKLO (0x1 << 18) // (USART) Clock Output Select +#define AT91C_US_OVER (0x1 << 19) // (USART) Over Sampling Mode +#define AT91C_US_INACK (0x1 << 20) // (USART) Inhibit Non Acknowledge +#define AT91C_US_DSNACK (0x1 << 21) // (USART) Disable Successive NACK +#define AT91C_US_MAX_ITER (0x1 << 24) // (USART) Number of Repetitions +#define AT91C_US_FILTER (0x1 << 28) // (USART) Receive Line Filter +// -------- US_IER : (USART Offset: 0x8) Debug Unit Interrupt Enable Register -------- +#define AT91C_US_RXBRK (0x1 << 2) // (USART) Break Received/End of Break +#define AT91C_US_TIMEOUT (0x1 << 8) // (USART) Receiver Time-out +#define AT91C_US_ITERATION (0x1 << 10) // (USART) Max number of Repetitions Reached +#define AT91C_US_NACK (0x1 << 13) // (USART) Non Acknowledge +#define AT91C_US_RIIC (0x1 << 16) // (USART) Ring INdicator Input Change Flag +#define AT91C_US_DSRIC (0x1 << 17) // (USART) Data Set Ready Input Change Flag +#define AT91C_US_DCDIC (0x1 << 18) // (USART) Data Carrier Flag +#define AT91C_US_CTSIC (0x1 << 19) // (USART) Clear To Send Input Change Flag +// -------- US_IDR : (USART Offset: 0xc) Debug Unit Interrupt Disable Register -------- +// -------- US_IMR : (USART Offset: 0x10) Debug Unit Interrupt Mask Register -------- +// -------- US_CSR : (USART Offset: 0x14) Debug Unit Channel Status Register -------- +#define AT91C_US_RI (0x1 << 20) // (USART) Image of RI Input +#define AT91C_US_DSR (0x1 << 21) // (USART) Image of DSR Input +#define AT91C_US_DCD (0x1 << 22) // (USART) Image of DCD Input +#define AT91C_US_CTS (0x1 << 23) // (USART) Image of CTS Input + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Synchronous Serial Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_SSC structure *** +#define SSC_CR ( 0) // Control Register +#define SSC_CMR ( 4) // Clock Mode Register +#define SSC_RCMR (16) // Receive Clock ModeRegister +#define SSC_RFMR (20) // Receive Frame Mode Register +#define SSC_TCMR (24) // Transmit Clock Mode Register +#define SSC_TFMR (28) // Transmit Frame Mode Register +#define SSC_RHR (32) // Receive Holding Register +#define SSC_THR (36) // Transmit Holding Register +#define SSC_RSHR (48) // Receive Sync Holding Register +#define SSC_TSHR (52) // Transmit Sync Holding Register +#define SSC_SR (64) // Status Register +#define SSC_IER (68) // Interrupt Enable Register +#define SSC_IDR (72) // Interrupt Disable Register +#define SSC_IMR (76) // Interrupt Mask Register +#define SSC_RPR (256) // Receive Pointer Register +#define SSC_RCR (260) // Receive Counter Register +#define SSC_TPR (264) // Transmit Pointer Register +#define SSC_TCR (268) // Transmit Counter Register +#define SSC_RNPR (272) // Receive Next Pointer Register +#define SSC_RNCR (276) // Receive Next Counter Register +#define SSC_TNPR (280) // Transmit Next Pointer Register +#define SSC_TNCR (284) // Transmit Next Counter Register +#define SSC_PTCR (288) // PDC Transfer Control Register +#define SSC_PTSR (292) // PDC Transfer Status Register +// -------- SSC_CR : (SSC Offset: 0x0) SSC Control Register -------- +#define AT91C_SSC_RXEN (0x1 << 0) // (SSC) Receive Enable +#define AT91C_SSC_RXDIS (0x1 << 1) // (SSC) Receive Disable +#define AT91C_SSC_TXEN (0x1 << 8) // (SSC) Transmit Enable +#define AT91C_SSC_TXDIS (0x1 << 9) // (SSC) Transmit Disable +#define AT91C_SSC_SWRST (0x1 << 15) // (SSC) Software Reset +// -------- SSC_RCMR : (SSC Offset: 0x10) SSC Receive Clock Mode Register -------- +#define AT91C_SSC_CKS (0x3 << 0) // (SSC) Receive/Transmit Clock Selection +#define AT91C_SSC_CKS_DIV (0x0) // (SSC) Divided Clock +#define AT91C_SSC_CKS_TK (0x1) // (SSC) TK Clock signal +#define AT91C_SSC_CKS_RK (0x2) // (SSC) RK pin +#define AT91C_SSC_CKO (0x7 << 2) // (SSC) Receive/Transmit Clock Output Mode Selection +#define AT91C_SSC_CKO_NONE (0x0 << 2) // (SSC) Receive/Transmit Clock Output Mode: None RK pin: Input-only +#define AT91C_SSC_CKO_CONTINOUS (0x1 << 2) // (SSC) Continuous Receive/Transmit Clock RK pin: Output +#define AT91C_SSC_CKO_DATA_TX (0x2 << 2) // (SSC) Receive/Transmit Clock only during data transfers RK pin: Output +#define AT91C_SSC_CKI (0x1 << 5) // (SSC) Receive/Transmit Clock Inversion +#define AT91C_SSC_CKG (0x3 << 6) // (SSC) Receive/Transmit Clock Gating Selection +#define AT91C_SSC_CKG_NONE (0x0 << 6) // (SSC) Receive/Transmit Clock Gating: None, continuous clock +#define AT91C_SSC_CKG_LOW (0x1 << 6) // (SSC) Receive/Transmit Clock enabled only if RF Low +#define AT91C_SSC_CKG_HIGH (0x2 << 6) // (SSC) Receive/Transmit Clock enabled only if RF High +#define AT91C_SSC_START (0xF << 8) // (SSC) Receive/Transmit Start Selection +#define AT91C_SSC_START_CONTINOUS (0x0 << 8) // (SSC) Continuous, as soon as the receiver is enabled, and immediately after the end of transfer of the previous data. +#define AT91C_SSC_START_TX (0x1 << 8) // (SSC) Transmit/Receive start +#define AT91C_SSC_START_LOW_RF (0x2 << 8) // (SSC) Detection of a low level on RF input +#define AT91C_SSC_START_HIGH_RF (0x3 << 8) // (SSC) Detection of a high level on RF input +#define AT91C_SSC_START_FALL_RF (0x4 << 8) // (SSC) Detection of a falling edge on RF input +#define AT91C_SSC_START_RISE_RF (0x5 << 8) // (SSC) Detection of a rising edge on RF input +#define AT91C_SSC_START_LEVEL_RF (0x6 << 8) // (SSC) Detection of any level change on RF input +#define AT91C_SSC_START_EDGE_RF (0x7 << 8) // (SSC) Detection of any edge on RF input +#define AT91C_SSC_START_0 (0x8 << 8) // (SSC) Compare 0 +#define AT91C_SSC_STOP (0x1 << 12) // (SSC) Receive Stop Selection +#define AT91C_SSC_STTDLY (0xFF << 16) // (SSC) Receive/Transmit Start Delay +#define AT91C_SSC_PERIOD (0xFF << 24) // (SSC) Receive/Transmit Period Divider Selection +// -------- SSC_RFMR : (SSC Offset: 0x14) SSC Receive Frame Mode Register -------- +#define AT91C_SSC_DATLEN (0x1F << 0) // (SSC) Data Length +#define AT91C_SSC_LOOP (0x1 << 5) // (SSC) Loop Mode +#define AT91C_SSC_MSBF (0x1 << 7) // (SSC) Most Significant Bit First +#define AT91C_SSC_DATNB (0xF << 8) // (SSC) Data Number per Frame +#define AT91C_SSC_FSLEN (0xF << 16) // (SSC) Receive/Transmit Frame Sync length +#define AT91C_SSC_FSOS (0x7 << 20) // (SSC) Receive/Transmit Frame Sync Output Selection +#define AT91C_SSC_FSOS_NONE (0x0 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: None RK pin Input-only +#define AT91C_SSC_FSOS_NEGATIVE (0x1 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Negative Pulse +#define AT91C_SSC_FSOS_POSITIVE (0x2 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Positive Pulse +#define AT91C_SSC_FSOS_LOW (0x3 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Driver Low during data transfer +#define AT91C_SSC_FSOS_HIGH (0x4 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Driver High during data transfer +#define AT91C_SSC_FSOS_TOGGLE (0x5 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Toggling at each start of data transfer +#define AT91C_SSC_FSEDGE (0x1 << 24) // (SSC) Frame Sync Edge Detection +// -------- SSC_TCMR : (SSC Offset: 0x18) SSC Transmit Clock Mode Register -------- +// -------- SSC_TFMR : (SSC Offset: 0x1c) SSC Transmit Frame Mode Register -------- +#define AT91C_SSC_DATDEF (0x1 << 5) // (SSC) Data Default Value +#define AT91C_SSC_FSDEN (0x1 << 23) // (SSC) Frame Sync Data Enable +// -------- SSC_SR : (SSC Offset: 0x40) SSC Status Register -------- +#define AT91C_SSC_TXRDY (0x1 << 0) // (SSC) Transmit Ready +#define AT91C_SSC_TXEMPTY (0x1 << 1) // (SSC) Transmit Empty +#define AT91C_SSC_ENDTX (0x1 << 2) // (SSC) End Of Transmission +#define AT91C_SSC_TXBUFE (0x1 << 3) // (SSC) Transmit Buffer Empty +#define AT91C_SSC_RXRDY (0x1 << 4) // (SSC) Receive Ready +#define AT91C_SSC_OVRUN (0x1 << 5) // (SSC) Receive Overrun +#define AT91C_SSC_ENDRX (0x1 << 6) // (SSC) End of Reception +#define AT91C_SSC_RXBUFF (0x1 << 7) // (SSC) Receive Buffer Full +#define AT91C_SSC_CP0 (0x1 << 8) // (SSC) Compare 0 +#define AT91C_SSC_CP1 (0x1 << 9) // (SSC) Compare 1 +#define AT91C_SSC_TXSYN (0x1 << 10) // (SSC) Transmit Sync +#define AT91C_SSC_RXSYN (0x1 << 11) // (SSC) Receive Sync +#define AT91C_SSC_TXENA (0x1 << 16) // (SSC) Transmit Enable +#define AT91C_SSC_RXENA (0x1 << 17) // (SSC) Receive Enable +// -------- SSC_IER : (SSC Offset: 0x44) SSC Interrupt Enable Register -------- +// -------- SSC_IDR : (SSC Offset: 0x48) SSC Interrupt Disable Register -------- +// -------- SSC_IMR : (SSC Offset: 0x4c) SSC Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Two-wire Interface +// ***************************************************************************** +// *** Register offset in AT91S_TWI structure *** +#define TWI_CR ( 0) // Control Register +#define TWI_MMR ( 4) // Master Mode Register +#define TWI_IADR (12) // Internal Address Register +#define TWI_CWGR (16) // Clock Waveform Generator Register +#define TWI_SR (32) // Status Register +#define TWI_IER (36) // Interrupt Enable Register +#define TWI_IDR (40) // Interrupt Disable Register +#define TWI_IMR (44) // Interrupt Mask Register +#define TWI_RHR (48) // Receive Holding Register +#define TWI_THR (52) // Transmit Holding Register +// -------- TWI_CR : (TWI Offset: 0x0) TWI Control Register -------- +#define AT91C_TWI_START (0x1 << 0) // (TWI) Send a START Condition +#define AT91C_TWI_STOP (0x1 << 1) // (TWI) Send a STOP Condition +#define AT91C_TWI_MSEN (0x1 << 2) // (TWI) TWI Master Transfer Enabled +#define AT91C_TWI_MSDIS (0x1 << 3) // (TWI) TWI Master Transfer Disabled +#define AT91C_TWI_SWRST (0x1 << 7) // (TWI) Software Reset +// -------- TWI_MMR : (TWI Offset: 0x4) TWI Master Mode Register -------- +#define AT91C_TWI_IADRSZ (0x3 << 8) // (TWI) Internal Device Address Size +#define AT91C_TWI_IADRSZ_NO (0x0 << 8) // (TWI) No internal device address +#define AT91C_TWI_IADRSZ_1_BYTE (0x1 << 8) // (TWI) One-byte internal device address +#define AT91C_TWI_IADRSZ_2_BYTE (0x2 << 8) // (TWI) Two-byte internal device address +#define AT91C_TWI_IADRSZ_3_BYTE (0x3 << 8) // (TWI) Three-byte internal device address +#define AT91C_TWI_MREAD (0x1 << 12) // (TWI) Master Read Direction +#define AT91C_TWI_DADR (0x7F << 16) // (TWI) Device Address +// -------- TWI_CWGR : (TWI Offset: 0x10) TWI Clock Waveform Generator Register -------- +#define AT91C_TWI_CLDIV (0xFF << 0) // (TWI) Clock Low Divider +#define AT91C_TWI_CHDIV (0xFF << 8) // (TWI) Clock High Divider +#define AT91C_TWI_CKDIV (0x7 << 16) // (TWI) Clock Divider +// -------- TWI_SR : (TWI Offset: 0x20) TWI Status Register -------- +#define AT91C_TWI_TXCOMP (0x1 << 0) // (TWI) Transmission Completed +#define AT91C_TWI_RXRDY (0x1 << 1) // (TWI) Receive holding register ReaDY +#define AT91C_TWI_TXRDY (0x1 << 2) // (TWI) Transmit holding register ReaDY +#define AT91C_TWI_OVRE (0x1 << 6) // (TWI) Overrun Error +#define AT91C_TWI_UNRE (0x1 << 7) // (TWI) Underrun Error +#define AT91C_TWI_NACK (0x1 << 8) // (TWI) Not Acknowledged +// -------- TWI_IER : (TWI Offset: 0x24) TWI Interrupt Enable Register -------- +// -------- TWI_IDR : (TWI Offset: 0x28) TWI Interrupt Disable Register -------- +// -------- TWI_IMR : (TWI Offset: 0x2c) TWI Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR PWMC Channel Interface +// ***************************************************************************** +// *** Register offset in AT91S_PWMC_CH structure *** +#define PWMC_CMR ( 0) // Channel Mode Register +#define PWMC_CDTYR ( 4) // Channel Duty Cycle Register +#define PWMC_CPRDR ( 8) // Channel Period Register +#define PWMC_CCNTR (12) // Channel Counter Register +#define PWMC_CUPDR (16) // Channel Update Register +#define PWMC_Reserved (20) // Reserved +// -------- PWMC_CMR : (PWMC_CH Offset: 0x0) PWMC Channel Mode Register -------- +#define AT91C_PWMC_CPRE (0xF << 0) // (PWMC_CH) Channel Pre-scaler : PWMC_CLKx +#define AT91C_PWMC_CPRE_MCK (0x0) // (PWMC_CH) +#define AT91C_PWMC_CPRE_MCKA (0xB) // (PWMC_CH) +#define AT91C_PWMC_CPRE_MCKB (0xC) // (PWMC_CH) +#define AT91C_PWMC_CALG (0x1 << 8) // (PWMC_CH) Channel Alignment +#define AT91C_PWMC_CPOL (0x1 << 9) // (PWMC_CH) Channel Polarity +#define AT91C_PWMC_CPD (0x1 << 10) // (PWMC_CH) Channel Update Period +// -------- PWMC_CDTYR : (PWMC_CH Offset: 0x4) PWMC Channel Duty Cycle Register -------- +#define AT91C_PWMC_CDTY (0x0 << 0) // (PWMC_CH) Channel Duty Cycle +// -------- PWMC_CPRDR : (PWMC_CH Offset: 0x8) PWMC Channel Period Register -------- +#define AT91C_PWMC_CPRD (0x0 << 0) // (PWMC_CH) Channel Period +// -------- PWMC_CCNTR : (PWMC_CH Offset: 0xc) PWMC Channel Counter Register -------- +#define AT91C_PWMC_CCNT (0x0 << 0) // (PWMC_CH) Channel Counter +// -------- PWMC_CUPDR : (PWMC_CH Offset: 0x10) PWMC Channel Update Register -------- +#define AT91C_PWMC_CUPD (0x0 << 0) // (PWMC_CH) Channel Update + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Pulse Width Modulation Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_PWMC structure *** +#define PWMC_MR ( 0) // PWMC Mode Register +#define PWMC_ENA ( 4) // PWMC Enable Register +#define PWMC_DIS ( 8) // PWMC Disable Register +#define PWMC_SR (12) // PWMC Status Register +#define PWMC_IER (16) // PWMC Interrupt Enable Register +#define PWMC_IDR (20) // PWMC Interrupt Disable Register +#define PWMC_IMR (24) // PWMC Interrupt Mask Register +#define PWMC_ISR (28) // PWMC Interrupt Status Register +#define PWMC_VR (252) // PWMC Version Register +#define PWMC_CH (512) // PWMC Channel +// -------- PWMC_MR : (PWMC Offset: 0x0) PWMC Mode Register -------- +#define AT91C_PWMC_DIVA (0xFF << 0) // (PWMC) CLKA divide factor. +#define AT91C_PWMC_PREA (0xF << 8) // (PWMC) Divider Input Clock Prescaler A +#define AT91C_PWMC_PREA_MCK (0x0 << 8) // (PWMC) +#define AT91C_PWMC_DIVB (0xFF << 16) // (PWMC) CLKB divide factor. +#define AT91C_PWMC_PREB (0xF << 24) // (PWMC) Divider Input Clock Prescaler B +#define AT91C_PWMC_PREB_MCK (0x0 << 24) // (PWMC) +// -------- PWMC_ENA : (PWMC Offset: 0x4) PWMC Enable Register -------- +#define AT91C_PWMC_CHID0 (0x1 << 0) // (PWMC) Channel ID 0 +#define AT91C_PWMC_CHID1 (0x1 << 1) // (PWMC) Channel ID 1 +#define AT91C_PWMC_CHID2 (0x1 << 2) // (PWMC) Channel ID 2 +#define AT91C_PWMC_CHID3 (0x1 << 3) // (PWMC) Channel ID 3 +// -------- PWMC_DIS : (PWMC Offset: 0x8) PWMC Disable Register -------- +// -------- PWMC_SR : (PWMC Offset: 0xc) PWMC Status Register -------- +// -------- PWMC_IER : (PWMC Offset: 0x10) PWMC Interrupt Enable Register -------- +// -------- PWMC_IDR : (PWMC Offset: 0x14) PWMC Interrupt Disable Register -------- +// -------- PWMC_IMR : (PWMC Offset: 0x18) PWMC Interrupt Mask Register -------- +// -------- PWMC_ISR : (PWMC Offset: 0x1c) PWMC Interrupt Status Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR USB Device Interface +// ***************************************************************************** +// *** Register offset in AT91S_UDP structure *** +#define UDP_NUM ( 0) // Frame Number Register +#define UDP_GLBSTATE ( 4) // Global State Register +#define UDP_FADDR ( 8) // Function Address Register +#define UDP_IER (16) // Interrupt Enable Register +#define UDP_IDR (20) // Interrupt Disable Register +#define UDP_IMR (24) // Interrupt Mask Register +#define UDP_ISR (28) // Interrupt Status Register +#define UDP_ICR (32) // Interrupt Clear Register +#define UDP_RSTEP (40) // Reset Endpoint Register +#define UDP_CSR (48) // Endpoint Control and Status Register +#define UDP_FDR (80) // Endpoint FIFO Data Register +#define UDP_TXVC (116) // Transceiver Control Register +// -------- UDP_FRM_NUM : (UDP Offset: 0x0) USB Frame Number Register -------- +#define AT91C_UDP_FRM_NUM (0x7FF << 0) // (UDP) Frame Number as Defined in the Packet Field Formats +#define AT91C_UDP_FRM_ERR (0x1 << 16) // (UDP) Frame Error +#define AT91C_UDP_FRM_OK (0x1 << 17) // (UDP) Frame OK +// -------- UDP_GLB_STATE : (UDP Offset: 0x4) USB Global State Register -------- +#define AT91C_UDP_FADDEN (0x1 << 0) // (UDP) Function Address Enable +#define AT91C_UDP_CONFG (0x1 << 1) // (UDP) Configured +#define AT91C_UDP_ESR (0x1 << 2) // (UDP) Enable Send Resume +#define AT91C_UDP_RSMINPR (0x1 << 3) // (UDP) A Resume Has Been Sent to the Host +#define AT91C_UDP_RMWUPE (0x1 << 4) // (UDP) Remote Wake Up Enable +// -------- UDP_FADDR : (UDP Offset: 0x8) USB Function Address Register -------- +#define AT91C_UDP_FADD (0xFF << 0) // (UDP) Function Address Value +#define AT91C_UDP_FEN (0x1 << 8) // (UDP) Function Enable +// -------- UDP_IER : (UDP Offset: 0x10) USB Interrupt Enable Register -------- +#define AT91C_UDP_EPINT0 (0x1 << 0) // (UDP) Endpoint 0 Interrupt +#define AT91C_UDP_EPINT1 (0x1 << 1) // (UDP) Endpoint 0 Interrupt +#define AT91C_UDP_EPINT2 (0x1 << 2) // (UDP) Endpoint 2 Interrupt +#define AT91C_UDP_EPINT3 (0x1 << 3) // (UDP) Endpoint 3 Interrupt +#define AT91C_UDP_EPINT4 (0x1 << 4) // (UDP) Endpoint 4 Interrupt +#define AT91C_UDP_EPINT5 (0x1 << 5) // (UDP) Endpoint 5 Interrupt +#define AT91C_UDP_RXSUSP (0x1 << 8) // (UDP) USB Suspend Interrupt +#define AT91C_UDP_RXRSM (0x1 << 9) // (UDP) USB Resume Interrupt +#define AT91C_UDP_EXTRSM (0x1 << 10) // (UDP) USB External Resume Interrupt +#define AT91C_UDP_SOFINT (0x1 << 11) // (UDP) USB Start Of frame Interrupt +#define AT91C_UDP_WAKEUP (0x1 << 13) // (UDP) USB Resume Interrupt +// -------- UDP_IDR : (UDP Offset: 0x14) USB Interrupt Disable Register -------- +// -------- UDP_IMR : (UDP Offset: 0x18) USB Interrupt Mask Register -------- +// -------- UDP_ISR : (UDP Offset: 0x1c) USB Interrupt Status Register -------- +#define AT91C_UDP_ENDBUSRES (0x1 << 12) // (UDP) USB End Of Bus Reset Interrupt +// -------- UDP_ICR : (UDP Offset: 0x20) USB Interrupt Clear Register -------- +// -------- UDP_RST_EP : (UDP Offset: 0x28) USB Reset Endpoint Register -------- +#define AT91C_UDP_EP0 (0x1 << 0) // (UDP) Reset Endpoint 0 +#define AT91C_UDP_EP1 (0x1 << 1) // (UDP) Reset Endpoint 1 +#define AT91C_UDP_EP2 (0x1 << 2) // (UDP) Reset Endpoint 2 +#define AT91C_UDP_EP3 (0x1 << 3) // (UDP) Reset Endpoint 3 +#define AT91C_UDP_EP4 (0x1 << 4) // (UDP) Reset Endpoint 4 +#define AT91C_UDP_EP5 (0x1 << 5) // (UDP) Reset Endpoint 5 +// -------- UDP_CSR : (UDP Offset: 0x30) USB Endpoint Control and Status Register -------- +#define AT91C_UDP_TXCOMP (0x1 << 0) // (UDP) Generates an IN packet with data previously written in the DPR +#define AT91C_UDP_RX_DATA_BK0 (0x1 << 1) // (UDP) Receive Data Bank 0 +#define AT91C_UDP_RXSETUP (0x1 << 2) // (UDP) Sends STALL to the Host (Control endpoints) +#define AT91C_UDP_ISOERROR (0x1 << 3) // (UDP) Isochronous error (Isochronous endpoints) +#define AT91C_UDP_TXPKTRDY (0x1 << 4) // (UDP) Transmit Packet Ready +#define AT91C_UDP_FORCESTALL (0x1 << 5) // (UDP) Force Stall (used by Control, Bulk and Isochronous endpoints). +#define AT91C_UDP_RX_DATA_BK1 (0x1 << 6) // (UDP) Receive Data Bank 1 (only used by endpoints with ping-pong attributes). +#define AT91C_UDP_DIR (0x1 << 7) // (UDP) Transfer Direction +#define AT91C_UDP_EPTYPE (0x7 << 8) // (UDP) Endpoint type +#define AT91C_UDP_EPTYPE_CTRL (0x0 << 8) // (UDP) Control +#define AT91C_UDP_EPTYPE_ISO_OUT (0x1 << 8) // (UDP) Isochronous OUT +#define AT91C_UDP_EPTYPE_BULK_OUT (0x2 << 8) // (UDP) Bulk OUT +#define AT91C_UDP_EPTYPE_INT_OUT (0x3 << 8) // (UDP) Interrupt OUT +#define AT91C_UDP_EPTYPE_ISO_IN (0x5 << 8) // (UDP) Isochronous IN +#define AT91C_UDP_EPTYPE_BULK_IN (0x6 << 8) // (UDP) Bulk IN +#define AT91C_UDP_EPTYPE_INT_IN (0x7 << 8) // (UDP) Interrupt IN +#define AT91C_UDP_DTGLE (0x1 << 11) // (UDP) Data Toggle +#define AT91C_UDP_EPEDS (0x1 << 15) // (UDP) Endpoint Enable Disable +#define AT91C_UDP_RXBYTECNT (0x7FF << 16) // (UDP) Number Of Bytes Available in the FIFO +// -------- UDP_TXVC : (UDP Offset: 0x74) Transceiver Control Register -------- +#define AT91C_UDP_TXVDIS (0x1 << 8) // (UDP) +#define AT91C_UDP_PUON (0x1 << 9) // (UDP) Pull-up ON + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Timer Counter Channel Interface +// ***************************************************************************** +// *** Register offset in AT91S_TC structure *** +#define TC_CCR ( 0) // Channel Control Register +#define TC_CMR ( 4) // Channel Mode Register (Capture Mode / Waveform Mode) +#define TC_CV (16) // Counter Value +#define TC_RA (20) // Register A +#define TC_RB (24) // Register B +#define TC_RC (28) // Register C +#define TC_SR (32) // Status Register +#define TC_IER (36) // Interrupt Enable Register +#define TC_IDR (40) // Interrupt Disable Register +#define TC_IMR (44) // Interrupt Mask Register +// -------- TC_CCR : (TC Offset: 0x0) TC Channel Control Register -------- +#define AT91C_TC_CLKEN (0x1 << 0) // (TC) Counter Clock Enable Command +#define AT91C_TC_CLKDIS (0x1 << 1) // (TC) Counter Clock Disable Command +#define AT91C_TC_SWTRG (0x1 << 2) // (TC) Software Trigger Command +// -------- TC_CMR : (TC Offset: 0x4) TC Channel Mode Register: Capture Mode / Waveform Mode -------- +#define AT91C_TC_CLKS (0x7 << 0) // (TC) Clock Selection +#define AT91C_TC_CLKS_TIMER_DIV1_CLOCK (0x0) // (TC) Clock selected: TIMER_DIV1_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV2_CLOCK (0x1) // (TC) Clock selected: TIMER_DIV2_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV3_CLOCK (0x2) // (TC) Clock selected: TIMER_DIV3_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV4_CLOCK (0x3) // (TC) Clock selected: TIMER_DIV4_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV5_CLOCK (0x4) // (TC) Clock selected: TIMER_DIV5_CLOCK +#define AT91C_TC_CLKS_XC0 (0x5) // (TC) Clock selected: XC0 +#define AT91C_TC_CLKS_XC1 (0x6) // (TC) Clock selected: XC1 +#define AT91C_TC_CLKS_XC2 (0x7) // (TC) Clock selected: XC2 +#define AT91C_TC_CLKI (0x1 << 3) // (TC) Clock Invert +#define AT91C_TC_BURST (0x3 << 4) // (TC) Burst Signal Selection +#define AT91C_TC_BURST_NONE (0x0 << 4) // (TC) The clock is not gated by an external signal +#define AT91C_TC_BURST_XC0 (0x1 << 4) // (TC) XC0 is ANDed with the selected clock +#define AT91C_TC_BURST_XC1 (0x2 << 4) // (TC) XC1 is ANDed with the selected clock +#define AT91C_TC_BURST_XC2 (0x3 << 4) // (TC) XC2 is ANDed with the selected clock +#define AT91C_TC_CPCSTOP (0x1 << 6) // (TC) Counter Clock Stopped with RC Compare +#define AT91C_TC_LDBSTOP (0x1 << 6) // (TC) Counter Clock Stopped with RB Loading +#define AT91C_TC_LDBDIS (0x1 << 7) // (TC) Counter Clock Disabled with RB Loading +#define AT91C_TC_CPCDIS (0x1 << 7) // (TC) Counter Clock Disable with RC Compare +#define AT91C_TC_ETRGEDG (0x3 << 8) // (TC) External Trigger Edge Selection +#define AT91C_TC_ETRGEDG_NONE (0x0 << 8) // (TC) Edge: None +#define AT91C_TC_ETRGEDG_RISING (0x1 << 8) // (TC) Edge: rising edge +#define AT91C_TC_ETRGEDG_FALLING (0x2 << 8) // (TC) Edge: falling edge +#define AT91C_TC_ETRGEDG_BOTH (0x3 << 8) // (TC) Edge: each edge +#define AT91C_TC_EEVTEDG (0x3 << 8) // (TC) External Event Edge Selection +#define AT91C_TC_EEVTEDG_NONE (0x0 << 8) // (TC) Edge: None +#define AT91C_TC_EEVTEDG_RISING (0x1 << 8) // (TC) Edge: rising edge +#define AT91C_TC_EEVTEDG_FALLING (0x2 << 8) // (TC) Edge: falling edge +#define AT91C_TC_EEVTEDG_BOTH (0x3 << 8) // (TC) Edge: each edge +#define AT91C_TC_ABETRG (0x1 << 10) // (TC) TIOA or TIOB External Trigger Selection +#define AT91C_TC_EEVT (0x3 << 10) // (TC) External Event Selection +#define AT91C_TC_EEVT_TIOB (0x0 << 10) // (TC) Signal selected as external event: TIOB TIOB direction: input +#define AT91C_TC_EEVT_XC0 (0x1 << 10) // (TC) Signal selected as external event: XC0 TIOB direction: output +#define AT91C_TC_EEVT_XC1 (0x2 << 10) // (TC) Signal selected as external event: XC1 TIOB direction: output +#define AT91C_TC_EEVT_XC2 (0x3 << 10) // (TC) Signal selected as external event: XC2 TIOB direction: output +#define AT91C_TC_ENETRG (0x1 << 12) // (TC) External Event Trigger enable +#define AT91C_TC_WAVESEL (0x3 << 13) // (TC) Waveform Selection +#define AT91C_TC_WAVESEL_UP (0x0 << 13) // (TC) UP mode without atomatic trigger on RC Compare +#define AT91C_TC_WAVESEL_UPDOWN (0x1 << 13) // (TC) UPDOWN mode without automatic trigger on RC Compare +#define AT91C_TC_WAVESEL_UP_AUTO (0x2 << 13) // (TC) UP mode with automatic trigger on RC Compare +#define AT91C_TC_WAVESEL_UPDOWN_AUTO (0x3 << 13) // (TC) UPDOWN mode with automatic trigger on RC Compare +#define AT91C_TC_CPCTRG (0x1 << 14) // (TC) RC Compare Trigger Enable +#define AT91C_TC_WAVE (0x1 << 15) // (TC) +#define AT91C_TC_LDRA (0x3 << 16) // (TC) RA Loading Selection +#define AT91C_TC_LDRA_NONE (0x0 << 16) // (TC) Edge: None +#define AT91C_TC_LDRA_RISING (0x1 << 16) // (TC) Edge: rising edge of TIOA +#define AT91C_TC_LDRA_FALLING (0x2 << 16) // (TC) Edge: falling edge of TIOA +#define AT91C_TC_LDRA_BOTH (0x3 << 16) // (TC) Edge: each edge of TIOA +#define AT91C_TC_ACPA (0x3 << 16) // (TC) RA Compare Effect on TIOA +#define AT91C_TC_ACPA_NONE (0x0 << 16) // (TC) Effect: none +#define AT91C_TC_ACPA_SET (0x1 << 16) // (TC) Effect: set +#define AT91C_TC_ACPA_CLEAR (0x2 << 16) // (TC) Effect: clear +#define AT91C_TC_ACPA_TOGGLE (0x3 << 16) // (TC) Effect: toggle +#define AT91C_TC_LDRB (0x3 << 18) // (TC) RB Loading Selection +#define AT91C_TC_LDRB_NONE (0x0 << 18) // (TC) Edge: None +#define AT91C_TC_LDRB_RISING (0x1 << 18) // (TC) Edge: rising edge of TIOA +#define AT91C_TC_LDRB_FALLING (0x2 << 18) // (TC) Edge: falling edge of TIOA +#define AT91C_TC_LDRB_BOTH (0x3 << 18) // (TC) Edge: each edge of TIOA +#define AT91C_TC_ACPC (0x3 << 18) // (TC) RC Compare Effect on TIOA +#define AT91C_TC_ACPC_NONE (0x0 << 18) // (TC) Effect: none +#define AT91C_TC_ACPC_SET (0x1 << 18) // (TC) Effect: set +#define AT91C_TC_ACPC_CLEAR (0x2 << 18) // (TC) Effect: clear +#define AT91C_TC_ACPC_TOGGLE (0x3 << 18) // (TC) Effect: toggle +#define AT91C_TC_AEEVT (0x3 << 20) // (TC) External Event Effect on TIOA +#define AT91C_TC_AEEVT_NONE (0x0 << 20) // (TC) Effect: none +#define AT91C_TC_AEEVT_SET (0x1 << 20) // (TC) Effect: set +#define AT91C_TC_AEEVT_CLEAR (0x2 << 20) // (TC) Effect: clear +#define AT91C_TC_AEEVT_TOGGLE (0x3 << 20) // (TC) Effect: toggle +#define AT91C_TC_ASWTRG (0x3 << 22) // (TC) Software Trigger Effect on TIOA +#define AT91C_TC_ASWTRG_NONE (0x0 << 22) // (TC) Effect: none +#define AT91C_TC_ASWTRG_SET (0x1 << 22) // (TC) Effect: set +#define AT91C_TC_ASWTRG_CLEAR (0x2 << 22) // (TC) Effect: clear +#define AT91C_TC_ASWTRG_TOGGLE (0x3 << 22) // (TC) Effect: toggle +#define AT91C_TC_BCPB (0x3 << 24) // (TC) RB Compare Effect on TIOB +#define AT91C_TC_BCPB_NONE (0x0 << 24) // (TC) Effect: none +#define AT91C_TC_BCPB_SET (0x1 << 24) // (TC) Effect: set +#define AT91C_TC_BCPB_CLEAR (0x2 << 24) // (TC) Effect: clear +#define AT91C_TC_BCPB_TOGGLE (0x3 << 24) // (TC) Effect: toggle +#define AT91C_TC_BCPC (0x3 << 26) // (TC) RC Compare Effect on TIOB +#define AT91C_TC_BCPC_NONE (0x0 << 26) // (TC) Effect: none +#define AT91C_TC_BCPC_SET (0x1 << 26) // (TC) Effect: set +#define AT91C_TC_BCPC_CLEAR (0x2 << 26) // (TC) Effect: clear +#define AT91C_TC_BCPC_TOGGLE (0x3 << 26) // (TC) Effect: toggle +#define AT91C_TC_BEEVT (0x3 << 28) // (TC) External Event Effect on TIOB +#define AT91C_TC_BEEVT_NONE (0x0 << 28) // (TC) Effect: none +#define AT91C_TC_BEEVT_SET (0x1 << 28) // (TC) Effect: set +#define AT91C_TC_BEEVT_CLEAR (0x2 << 28) // (TC) Effect: clear +#define AT91C_TC_BEEVT_TOGGLE (0x3 << 28) // (TC) Effect: toggle +#define AT91C_TC_BSWTRG (0x3 << 30) // (TC) Software Trigger Effect on TIOB +#define AT91C_TC_BSWTRG_NONE (0x0 << 30) // (TC) Effect: none +#define AT91C_TC_BSWTRG_SET (0x1 << 30) // (TC) Effect: set +#define AT91C_TC_BSWTRG_CLEAR (0x2 << 30) // (TC) Effect: clear +#define AT91C_TC_BSWTRG_TOGGLE (0x3 << 30) // (TC) Effect: toggle +// -------- TC_SR : (TC Offset: 0x20) TC Channel Status Register -------- +#define AT91C_TC_COVFS (0x1 << 0) // (TC) Counter Overflow +#define AT91C_TC_LOVRS (0x1 << 1) // (TC) Load Overrun +#define AT91C_TC_CPAS (0x1 << 2) // (TC) RA Compare +#define AT91C_TC_CPBS (0x1 << 3) // (TC) RB Compare +#define AT91C_TC_CPCS (0x1 << 4) // (TC) RC Compare +#define AT91C_TC_LDRAS (0x1 << 5) // (TC) RA Loading +#define AT91C_TC_LDRBS (0x1 << 6) // (TC) RB Loading +#define AT91C_TC_ETRGS (0x1 << 7) // (TC) External Trigger +#define AT91C_TC_CLKSTA (0x1 << 16) // (TC) Clock Enabling +#define AT91C_TC_MTIOA (0x1 << 17) // (TC) TIOA Mirror +#define AT91C_TC_MTIOB (0x1 << 18) // (TC) TIOA Mirror +// -------- TC_IER : (TC Offset: 0x24) TC Channel Interrupt Enable Register -------- +// -------- TC_IDR : (TC Offset: 0x28) TC Channel Interrupt Disable Register -------- +// -------- TC_IMR : (TC Offset: 0x2c) TC Channel Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Timer Counter Interface +// ***************************************************************************** +// *** Register offset in AT91S_TCB structure *** +#define TCB_TC0 ( 0) // TC Channel 0 +#define TCB_TC1 (64) // TC Channel 1 +#define TCB_TC2 (128) // TC Channel 2 +#define TCB_BCR (192) // TC Block Control Register +#define TCB_BMR (196) // TC Block Mode Register +// -------- TCB_BCR : (TCB Offset: 0xc0) TC Block Control Register -------- +#define AT91C_TCB_SYNC (0x1 << 0) // (TCB) Synchro Command +// -------- TCB_BMR : (TCB Offset: 0xc4) TC Block Mode Register -------- +#define AT91C_TCB_TC0XC0S (0x3 << 0) // (TCB) External Clock Signal 0 Selection +#define AT91C_TCB_TC0XC0S_TCLK0 (0x0) // (TCB) TCLK0 connected to XC0 +#define AT91C_TCB_TC0XC0S_NONE (0x1) // (TCB) None signal connected to XC0 +#define AT91C_TCB_TC0XC0S_TIOA1 (0x2) // (TCB) TIOA1 connected to XC0 +#define AT91C_TCB_TC0XC0S_TIOA2 (0x3) // (TCB) TIOA2 connected to XC0 +#define AT91C_TCB_TC1XC1S (0x3 << 2) // (TCB) External Clock Signal 1 Selection +#define AT91C_TCB_TC1XC1S_TCLK1 (0x0 << 2) // (TCB) TCLK1 connected to XC1 +#define AT91C_TCB_TC1XC1S_NONE (0x1 << 2) // (TCB) None signal connected to XC1 +#define AT91C_TCB_TC1XC1S_TIOA0 (0x2 << 2) // (TCB) TIOA0 connected to XC1 +#define AT91C_TCB_TC1XC1S_TIOA2 (0x3 << 2) // (TCB) TIOA2 connected to XC1 +#define AT91C_TCB_TC2XC2S (0x3 << 4) // (TCB) External Clock Signal 2 Selection +#define AT91C_TCB_TC2XC2S_TCLK2 (0x0 << 4) // (TCB) TCLK2 connected to XC2 +#define AT91C_TCB_TC2XC2S_NONE (0x1 << 4) // (TCB) None signal connected to XC2 +#define AT91C_TCB_TC2XC2S_TIOA0 (0x2 << 4) // (TCB) TIOA0 connected to XC2 +#define AT91C_TCB_TC2XC2S_TIOA1 (0x3 << 4) // (TCB) TIOA2 connected to XC2 + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Control Area Network MailBox Interface +// ***************************************************************************** +// *** Register offset in AT91S_CAN_MB structure *** +#define CAN_MB_MMR ( 0) // MailBox Mode Register +#define CAN_MB_MAM ( 4) // MailBox Acceptance Mask Register +#define CAN_MB_MID ( 8) // MailBox ID Register +#define CAN_MB_MFID (12) // MailBox Family ID Register +#define CAN_MB_MSR (16) // MailBox Status Register +#define CAN_MB_MDL (20) // MailBox Data Low Register +#define CAN_MB_MDH (24) // MailBox Data High Register +#define CAN_MB_MCR (28) // MailBox Control Register +// -------- CAN_MMR : (CAN_MB Offset: 0x0) CAN Message Mode Register -------- +#define AT91C_CAN_MTIMEMARK (0xFFFF << 0) // (CAN_MB) Mailbox Timemark +#define AT91C_CAN_PRIOR (0xF << 16) // (CAN_MB) Mailbox Priority +#define AT91C_CAN_MOT (0x7 << 24) // (CAN_MB) Mailbox Object Type +#define AT91C_CAN_MOT_DIS (0x0 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_RX (0x1 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_RXOVERWRITE (0x2 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_TX (0x3 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_CONSUMER (0x4 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_PRODUCER (0x5 << 24) // (CAN_MB) +// -------- CAN_MAM : (CAN_MB Offset: 0x4) CAN Message Acceptance Mask Register -------- +#define AT91C_CAN_MIDvB (0x3FFFF << 0) // (CAN_MB) Complementary bits for identifier in extended mode +#define AT91C_CAN_MIDvA (0x7FF << 18) // (CAN_MB) Identifier for standard frame mode +#define AT91C_CAN_MIDE (0x1 << 29) // (CAN_MB) Identifier Version +// -------- CAN_MID : (CAN_MB Offset: 0x8) CAN Message ID Register -------- +// -------- CAN_MFID : (CAN_MB Offset: 0xc) CAN Message Family ID Register -------- +// -------- CAN_MSR : (CAN_MB Offset: 0x10) CAN Message Status Register -------- +#define AT91C_CAN_MTIMESTAMP (0xFFFF << 0) // (CAN_MB) Timer Value +#define AT91C_CAN_MDLC (0xF << 16) // (CAN_MB) Mailbox Data Length Code +#define AT91C_CAN_MRTR (0x1 << 20) // (CAN_MB) Mailbox Remote Transmission Request +#define AT91C_CAN_MABT (0x1 << 22) // (CAN_MB) Mailbox Message Abort +#define AT91C_CAN_MRDY (0x1 << 23) // (CAN_MB) Mailbox Ready +#define AT91C_CAN_MMI (0x1 << 24) // (CAN_MB) Mailbox Message Ignored +// -------- CAN_MDL : (CAN_MB Offset: 0x14) CAN Message Data Low Register -------- +// -------- CAN_MDH : (CAN_MB Offset: 0x18) CAN Message Data High Register -------- +// -------- CAN_MCR : (CAN_MB Offset: 0x1c) CAN Message Control Register -------- +#define AT91C_CAN_MACR (0x1 << 22) // (CAN_MB) Abort Request for Mailbox +#define AT91C_CAN_MTCR (0x1 << 23) // (CAN_MB) Mailbox Transfer Command + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Control Area Network Interface +// ***************************************************************************** +// *** Register offset in AT91S_CAN structure *** +#define CAN_MR ( 0) // Mode Register +#define CAN_IER ( 4) // Interrupt Enable Register +#define CAN_IDR ( 8) // Interrupt Disable Register +#define CAN_IMR (12) // Interrupt Mask Register +#define CAN_SR (16) // Status Register +#define CAN_BR (20) // Baudrate Register +#define CAN_TIM (24) // Timer Register +#define CAN_TIMESTP (28) // Time Stamp Register +#define CAN_ECR (32) // Error Counter Register +#define CAN_TCR (36) // Transfer Command Register +#define CAN_ACR (40) // Abort Command Register +#define CAN_VR (252) // Version Register +#define CAN_MB0 (512) // CAN Mailbox 0 +#define CAN_MB1 (544) // CAN Mailbox 1 +#define CAN_MB2 (576) // CAN Mailbox 2 +#define CAN_MB3 (608) // CAN Mailbox 3 +#define CAN_MB4 (640) // CAN Mailbox 4 +#define CAN_MB5 (672) // CAN Mailbox 5 +#define CAN_MB6 (704) // CAN Mailbox 6 +#define CAN_MB7 (736) // CAN Mailbox 7 +#define CAN_MB8 (768) // CAN Mailbox 8 +#define CAN_MB9 (800) // CAN Mailbox 9 +#define CAN_MB10 (832) // CAN Mailbox 10 +#define CAN_MB11 (864) // CAN Mailbox 11 +#define CAN_MB12 (896) // CAN Mailbox 12 +#define CAN_MB13 (928) // CAN Mailbox 13 +#define CAN_MB14 (960) // CAN Mailbox 14 +#define CAN_MB15 (992) // CAN Mailbox 15 +// -------- CAN_MR : (CAN Offset: 0x0) CAN Mode Register -------- +#define AT91C_CAN_CANEN (0x1 << 0) // (CAN) CAN Controller Enable +#define AT91C_CAN_LPM (0x1 << 1) // (CAN) Disable/Enable Low Power Mode +#define AT91C_CAN_ABM (0x1 << 2) // (CAN) Disable/Enable Autobaud/Listen Mode +#define AT91C_CAN_OVL (0x1 << 3) // (CAN) Disable/Enable Overload Frame +#define AT91C_CAN_TEOF (0x1 << 4) // (CAN) Time Stamp messages at each end of Frame +#define AT91C_CAN_TTM (0x1 << 5) // (CAN) Disable/Enable Time Trigger Mode +#define AT91C_CAN_TIMFRZ (0x1 << 6) // (CAN) Enable Timer Freeze +#define AT91C_CAN_DRPT (0x1 << 7) // (CAN) Disable Repeat +// -------- CAN_IER : (CAN Offset: 0x4) CAN Interrupt Enable Register -------- +#define AT91C_CAN_MB0 (0x1 << 0) // (CAN) Mailbox 0 Flag +#define AT91C_CAN_MB1 (0x1 << 1) // (CAN) Mailbox 1 Flag +#define AT91C_CAN_MB2 (0x1 << 2) // (CAN) Mailbox 2 Flag +#define AT91C_CAN_MB3 (0x1 << 3) // (CAN) Mailbox 3 Flag +#define AT91C_CAN_MB4 (0x1 << 4) // (CAN) Mailbox 4 Flag +#define AT91C_CAN_MB5 (0x1 << 5) // (CAN) Mailbox 5 Flag +#define AT91C_CAN_MB6 (0x1 << 6) // (CAN) Mailbox 6 Flag +#define AT91C_CAN_MB7 (0x1 << 7) // (CAN) Mailbox 7 Flag +#define AT91C_CAN_MB8 (0x1 << 8) // (CAN) Mailbox 8 Flag +#define AT91C_CAN_MB9 (0x1 << 9) // (CAN) Mailbox 9 Flag +#define AT91C_CAN_MB10 (0x1 << 10) // (CAN) Mailbox 10 Flag +#define AT91C_CAN_MB11 (0x1 << 11) // (CAN) Mailbox 11 Flag +#define AT91C_CAN_MB12 (0x1 << 12) // (CAN) Mailbox 12 Flag +#define AT91C_CAN_MB13 (0x1 << 13) // (CAN) Mailbox 13 Flag +#define AT91C_CAN_MB14 (0x1 << 14) // (CAN) Mailbox 14 Flag +#define AT91C_CAN_MB15 (0x1 << 15) // (CAN) Mailbox 15 Flag +#define AT91C_CAN_ERRA (0x1 << 16) // (CAN) Error Active Mode Flag +#define AT91C_CAN_WARN (0x1 << 17) // (CAN) Warning Limit Flag +#define AT91C_CAN_ERRP (0x1 << 18) // (CAN) Error Passive Mode Flag +#define AT91C_CAN_BOFF (0x1 << 19) // (CAN) Bus Off Mode Flag +#define AT91C_CAN_SLEEP (0x1 << 20) // (CAN) Sleep Flag +#define AT91C_CAN_WAKEUP (0x1 << 21) // (CAN) Wakeup Flag +#define AT91C_CAN_TOVF (0x1 << 22) // (CAN) Timer Overflow Flag +#define AT91C_CAN_TSTP (0x1 << 23) // (CAN) Timestamp Flag +#define AT91C_CAN_CERR (0x1 << 24) // (CAN) CRC Error +#define AT91C_CAN_SERR (0x1 << 25) // (CAN) Stuffing Error +#define AT91C_CAN_AERR (0x1 << 26) // (CAN) Acknowledgment Error +#define AT91C_CAN_FERR (0x1 << 27) // (CAN) Form Error +#define AT91C_CAN_BERR (0x1 << 28) // (CAN) Bit Error +// -------- CAN_IDR : (CAN Offset: 0x8) CAN Interrupt Disable Register -------- +// -------- CAN_IMR : (CAN Offset: 0xc) CAN Interrupt Mask Register -------- +// -------- CAN_SR : (CAN Offset: 0x10) CAN Status Register -------- +#define AT91C_CAN_RBSY (0x1 << 29) // (CAN) Receiver Busy +#define AT91C_CAN_TBSY (0x1 << 30) // (CAN) Transmitter Busy +#define AT91C_CAN_OVLY (0x1 << 31) // (CAN) Overload Busy +// -------- CAN_BR : (CAN Offset: 0x14) CAN Baudrate Register -------- +#define AT91C_CAN_PHASE2 (0x7 << 0) // (CAN) Phase 2 segment +#define AT91C_CAN_PHASE1 (0x7 << 4) // (CAN) Phase 1 segment +#define AT91C_CAN_PROPAG (0x7 << 8) // (CAN) Programmation time segment +#define AT91C_CAN_SYNC (0x3 << 12) // (CAN) Re-synchronization jump width segment +#define AT91C_CAN_BRP (0x7F << 16) // (CAN) Baudrate Prescaler +#define AT91C_CAN_SMP (0x1 << 24) // (CAN) Sampling mode +// -------- CAN_TIM : (CAN Offset: 0x18) CAN Timer Register -------- +#define AT91C_CAN_TIMER (0xFFFF << 0) // (CAN) Timer field +// -------- CAN_TIMESTP : (CAN Offset: 0x1c) CAN Timestamp Register -------- +// -------- CAN_ECR : (CAN Offset: 0x20) CAN Error Counter Register -------- +#define AT91C_CAN_REC (0xFF << 0) // (CAN) Receive Error Counter +#define AT91C_CAN_TEC (0xFF << 16) // (CAN) Transmit Error Counter +// -------- CAN_TCR : (CAN Offset: 0x24) CAN Transfer Command Register -------- +#define AT91C_CAN_TIMRST (0x1 << 31) // (CAN) Timer Reset Field +// -------- CAN_ACR : (CAN Offset: 0x28) CAN Abort Command Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Ethernet MAC 10/100 +// ***************************************************************************** +// *** Register offset in AT91S_EMAC structure *** +#define EMAC_NCR ( 0) // Network Control Register +#define EMAC_NCFGR ( 4) // Network Configuration Register +#define EMAC_NSR ( 8) // Network Status Register +#define EMAC_TSR (20) // Transmit Status Register +#define EMAC_RBQP (24) // Receive Buffer Queue Pointer +#define EMAC_TBQP (28) // Transmit Buffer Queue Pointer +#define EMAC_RSR (32) // Receive Status Register +#define EMAC_ISR (36) // Interrupt Status Register +#define EMAC_IER (40) // Interrupt Enable Register +#define EMAC_IDR (44) // Interrupt Disable Register +#define EMAC_IMR (48) // Interrupt Mask Register +#define EMAC_MAN (52) // PHY Maintenance Register +#define EMAC_PTR (56) // Pause Time Register +#define EMAC_PFR (60) // Pause Frames received Register +#define EMAC_FTO (64) // Frames Transmitted OK Register +#define EMAC_SCF (68) // Single Collision Frame Register +#define EMAC_MCF (72) // Multiple Collision Frame Register +#define EMAC_FRO (76) // Frames Received OK Register +#define EMAC_FCSE (80) // Frame Check Sequence Error Register +#define EMAC_ALE (84) // Alignment Error Register +#define EMAC_DTF (88) // Deferred Transmission Frame Register +#define EMAC_LCOL (92) // Late Collision Register +#define EMAC_ECOL (96) // Excessive Collision Register +#define EMAC_TUND (100) // Transmit Underrun Error Register +#define EMAC_CSE (104) // Carrier Sense Error Register +#define EMAC_RRE (108) // Receive Ressource Error Register +#define EMAC_ROV (112) // Receive Overrun Errors Register +#define EMAC_RSE (116) // Receive Symbol Errors Register +#define EMAC_ELE (120) // Excessive Length Errors Register +#define EMAC_RJA (124) // Receive Jabbers Register +#define EMAC_USF (128) // Undersize Frames Register +#define EMAC_STE (132) // SQE Test Error Register +#define EMAC_RLE (136) // Receive Length Field Mismatch Register +#define EMAC_TPF (140) // Transmitted Pause Frames Register +#define EMAC_HRB (144) // Hash Address Bottom[31:0] +#define EMAC_HRT (148) // Hash Address Top[63:32] +#define EMAC_SA1L (152) // Specific Address 1 Bottom, First 4 bytes +#define EMAC_SA1H (156) // Specific Address 1 Top, Last 2 bytes +#define EMAC_SA2L (160) // Specific Address 2 Bottom, First 4 bytes +#define EMAC_SA2H (164) // Specific Address 2 Top, Last 2 bytes +#define EMAC_SA3L (168) // Specific Address 3 Bottom, First 4 bytes +#define EMAC_SA3H (172) // Specific Address 3 Top, Last 2 bytes +#define EMAC_SA4L (176) // Specific Address 4 Bottom, First 4 bytes +#define EMAC_SA4H (180) // Specific Address 4 Top, Last 2 bytes +#define EMAC_TID (184) // Type ID Checking Register +#define EMAC_TPQ (188) // Transmit Pause Quantum Register +#define EMAC_USRIO (192) // USER Input/Output Register +#define EMAC_WOL (196) // Wake On LAN Register +#define EMAC_REV (252) // Revision Register +// -------- EMAC_NCR : (EMAC Offset: 0x0) -------- +#define AT91C_EMAC_LB (0x1 << 0) // (EMAC) Loopback. Optional. When set, loopback signal is at high level. +#define AT91C_EMAC_LLB (0x1 << 1) // (EMAC) Loopback local. +#define AT91C_EMAC_RE (0x1 << 2) // (EMAC) Receive enable. +#define AT91C_EMAC_TE (0x1 << 3) // (EMAC) Transmit enable. +#define AT91C_EMAC_MPE (0x1 << 4) // (EMAC) Management port enable. +#define AT91C_EMAC_CLRSTAT (0x1 << 5) // (EMAC) Clear statistics registers. +#define AT91C_EMAC_INCSTAT (0x1 << 6) // (EMAC) Increment statistics registers. +#define AT91C_EMAC_WESTAT (0x1 << 7) // (EMAC) Write enable for statistics registers. +#define AT91C_EMAC_BP (0x1 << 8) // (EMAC) Back pressure. +#define AT91C_EMAC_TSTART (0x1 << 9) // (EMAC) Start Transmission. +#define AT91C_EMAC_THALT (0x1 << 10) // (EMAC) Transmission Halt. +#define AT91C_EMAC_TPFR (0x1 << 11) // (EMAC) Transmit pause frame +#define AT91C_EMAC_TZQ (0x1 << 12) // (EMAC) Transmit zero quantum pause frame +// -------- EMAC_NCFGR : (EMAC Offset: 0x4) Network Configuration Register -------- +#define AT91C_EMAC_SPD (0x1 << 0) // (EMAC) Speed. +#define AT91C_EMAC_FD (0x1 << 1) // (EMAC) Full duplex. +#define AT91C_EMAC_JFRAME (0x1 << 3) // (EMAC) Jumbo Frames. +#define AT91C_EMAC_CAF (0x1 << 4) // (EMAC) Copy all frames. +#define AT91C_EMAC_NBC (0x1 << 5) // (EMAC) No broadcast. +#define AT91C_EMAC_MTI (0x1 << 6) // (EMAC) Multicast hash event enable +#define AT91C_EMAC_UNI (0x1 << 7) // (EMAC) Unicast hash enable. +#define AT91C_EMAC_BIG (0x1 << 8) // (EMAC) Receive 1522 bytes. +#define AT91C_EMAC_EAE (0x1 << 9) // (EMAC) External address match enable. +#define AT91C_EMAC_CLK (0x3 << 10) // (EMAC) +#define AT91C_EMAC_CLK_HCLK_8 (0x0 << 10) // (EMAC) HCLK divided by 8 +#define AT91C_EMAC_CLK_HCLK_16 (0x1 << 10) // (EMAC) HCLK divided by 16 +#define AT91C_EMAC_CLK_HCLK_32 (0x2 << 10) // (EMAC) HCLK divided by 32 +#define AT91C_EMAC_CLK_HCLK_64 (0x3 << 10) // (EMAC) HCLK divided by 64 +#define AT91C_EMAC_RTY (0x1 << 12) // (EMAC) +#define AT91C_EMAC_PAE (0x1 << 13) // (EMAC) +#define AT91C_EMAC_RBOF (0x3 << 14) // (EMAC) +#define AT91C_EMAC_RBOF_OFFSET_0 (0x0 << 14) // (EMAC) no offset from start of receive buffer +#define AT91C_EMAC_RBOF_OFFSET_1 (0x1 << 14) // (EMAC) one byte offset from start of receive buffer +#define AT91C_EMAC_RBOF_OFFSET_2 (0x2 << 14) // (EMAC) two bytes offset from start of receive buffer +#define AT91C_EMAC_RBOF_OFFSET_3 (0x3 << 14) // (EMAC) three bytes offset from start of receive buffer +#define AT91C_EMAC_RLCE (0x1 << 16) // (EMAC) Receive Length field Checking Enable +#define AT91C_EMAC_DRFCS (0x1 << 17) // (EMAC) Discard Receive FCS +#define AT91C_EMAC_EFRHD (0x1 << 18) // (EMAC) +#define AT91C_EMAC_IRXFCS (0x1 << 19) // (EMAC) Ignore RX FCS +// -------- EMAC_NSR : (EMAC Offset: 0x8) Network Status Register -------- +#define AT91C_EMAC_LINKR (0x1 << 0) // (EMAC) +#define AT91C_EMAC_MDIO (0x1 << 1) // (EMAC) +#define AT91C_EMAC_IDLE (0x1 << 2) // (EMAC) +// -------- EMAC_TSR : (EMAC Offset: 0x14) Transmit Status Register -------- +#define AT91C_EMAC_UBR (0x1 << 0) // (EMAC) +#define AT91C_EMAC_COL (0x1 << 1) // (EMAC) +#define AT91C_EMAC_RLES (0x1 << 2) // (EMAC) +#define AT91C_EMAC_TGO (0x1 << 3) // (EMAC) Transmit Go +#define AT91C_EMAC_BEX (0x1 << 4) // (EMAC) Buffers exhausted mid frame +#define AT91C_EMAC_COMP (0x1 << 5) // (EMAC) +#define AT91C_EMAC_UND (0x1 << 6) // (EMAC) +// -------- EMAC_RSR : (EMAC Offset: 0x20) Receive Status Register -------- +#define AT91C_EMAC_BNA (0x1 << 0) // (EMAC) +#define AT91C_EMAC_REC (0x1 << 1) // (EMAC) +#define AT91C_EMAC_OVR (0x1 << 2) // (EMAC) +// -------- EMAC_ISR : (EMAC Offset: 0x24) Interrupt Status Register -------- +#define AT91C_EMAC_MFD (0x1 << 0) // (EMAC) +#define AT91C_EMAC_RCOMP (0x1 << 1) // (EMAC) +#define AT91C_EMAC_RXUBR (0x1 << 2) // (EMAC) +#define AT91C_EMAC_TXUBR (0x1 << 3) // (EMAC) +#define AT91C_EMAC_TUNDR (0x1 << 4) // (EMAC) +#define AT91C_EMAC_RLEX (0x1 << 5) // (EMAC) +#define AT91C_EMAC_TXERR (0x1 << 6) // (EMAC) +#define AT91C_EMAC_TCOMP (0x1 << 7) // (EMAC) +#define AT91C_EMAC_LINK (0x1 << 9) // (EMAC) +#define AT91C_EMAC_ROVR (0x1 << 10) // (EMAC) +#define AT91C_EMAC_HRESP (0x1 << 11) // (EMAC) +#define AT91C_EMAC_PFRE (0x1 << 12) // (EMAC) +#define AT91C_EMAC_PTZ (0x1 << 13) // (EMAC) +// -------- EMAC_IER : (EMAC Offset: 0x28) Interrupt Enable Register -------- +// -------- EMAC_IDR : (EMAC Offset: 0x2c) Interrupt Disable Register -------- +// -------- EMAC_IMR : (EMAC Offset: 0x30) Interrupt Mask Register -------- +// -------- EMAC_MAN : (EMAC Offset: 0x34) PHY Maintenance Register -------- +#define AT91C_EMAC_DATA (0xFFFF << 0) // (EMAC) +#define AT91C_EMAC_CODE (0x3 << 16) // (EMAC) +#define AT91C_EMAC_REGA (0x1F << 18) // (EMAC) +#define AT91C_EMAC_PHYA (0x1F << 23) // (EMAC) +#define AT91C_EMAC_RW (0x3 << 28) // (EMAC) +#define AT91C_EMAC_SOF (0x3 << 30) // (EMAC) +// -------- EMAC_USRIO : (EMAC Offset: 0xc0) USER Input Output Register -------- +#define AT91C_EMAC_RMII (0x1 << 0) // (EMAC) Reduce MII +#define AT91C_EMAC_CLKEN (0x1 << 1) // (EMAC) Clock Enable +// -------- EMAC_WOL : (EMAC Offset: 0xc4) Wake On LAN Register -------- +#define AT91C_EMAC_IP (0xFFFF << 0) // (EMAC) ARP request IP address +#define AT91C_EMAC_MAG (0x1 << 16) // (EMAC) Magic packet event enable +#define AT91C_EMAC_ARP (0x1 << 17) // (EMAC) ARP request event enable +#define AT91C_EMAC_SA1 (0x1 << 18) // (EMAC) Specific address register 1 event enable +// -------- EMAC_REV : (EMAC Offset: 0xfc) Revision Register -------- +#define AT91C_EMAC_REVREF (0xFFFF << 0) // (EMAC) +#define AT91C_EMAC_PARTREF (0xFFFF << 16) // (EMAC) + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Analog to Digital Convertor +// ***************************************************************************** +// *** Register offset in AT91S_ADC structure *** +#define ADC_CR ( 0) // ADC Control Register +#define ADC_MR ( 4) // ADC Mode Register +#define ADC_CHER (16) // ADC Channel Enable Register +#define ADC_CHDR (20) // ADC Channel Disable Register +#define ADC_CHSR (24) // ADC Channel Status Register +#define ADC_SR (28) // ADC Status Register +#define ADC_LCDR (32) // ADC Last Converted Data Register +#define ADC_IER (36) // ADC Interrupt Enable Register +#define ADC_IDR (40) // ADC Interrupt Disable Register +#define ADC_IMR (44) // ADC Interrupt Mask Register +#define ADC_CDR0 (48) // ADC Channel Data Register 0 +#define ADC_CDR1 (52) // ADC Channel Data Register 1 +#define ADC_CDR2 (56) // ADC Channel Data Register 2 +#define ADC_CDR3 (60) // ADC Channel Data Register 3 +#define ADC_CDR4 (64) // ADC Channel Data Register 4 +#define ADC_CDR5 (68) // ADC Channel Data Register 5 +#define ADC_CDR6 (72) // ADC Channel Data Register 6 +#define ADC_CDR7 (76) // ADC Channel Data Register 7 +#define ADC_RPR (256) // Receive Pointer Register +#define ADC_RCR (260) // Receive Counter Register +#define ADC_TPR (264) // Transmit Pointer Register +#define ADC_TCR (268) // Transmit Counter Register +#define ADC_RNPR (272) // Receive Next Pointer Register +#define ADC_RNCR (276) // Receive Next Counter Register +#define ADC_TNPR (280) // Transmit Next Pointer Register +#define ADC_TNCR (284) // Transmit Next Counter Register +#define ADC_PTCR (288) // PDC Transfer Control Register +#define ADC_PTSR (292) // PDC Transfer Status Register +// -------- ADC_CR : (ADC Offset: 0x0) ADC Control Register -------- +#define AT91C_ADC_SWRST (0x1 << 0) // (ADC) Software Reset +#define AT91C_ADC_START (0x1 << 1) // (ADC) Start Conversion +// -------- ADC_MR : (ADC Offset: 0x4) ADC Mode Register -------- +#define AT91C_ADC_TRGEN (0x1 << 0) // (ADC) Trigger Enable +#define AT91C_ADC_TRGEN_DIS (0x0) // (ADC) Hradware triggers are disabled. Starting a conversion is only possible by software +#define AT91C_ADC_TRGEN_EN (0x1) // (ADC) Hardware trigger selected by TRGSEL field is enabled. +#define AT91C_ADC_TRGSEL (0x7 << 1) // (ADC) Trigger Selection +#define AT91C_ADC_TRGSEL_TIOA0 (0x0 << 1) // (ADC) Selected TRGSEL = TIAO0 +#define AT91C_ADC_TRGSEL_TIOA1 (0x1 << 1) // (ADC) Selected TRGSEL = TIAO1 +#define AT91C_ADC_TRGSEL_TIOA2 (0x2 << 1) // (ADC) Selected TRGSEL = TIAO2 +#define AT91C_ADC_TRGSEL_TIOA3 (0x3 << 1) // (ADC) Selected TRGSEL = TIAO3 +#define AT91C_ADC_TRGSEL_TIOA4 (0x4 << 1) // (ADC) Selected TRGSEL = TIAO4 +#define AT91C_ADC_TRGSEL_TIOA5 (0x5 << 1) // (ADC) Selected TRGSEL = TIAO5 +#define AT91C_ADC_TRGSEL_EXT (0x6 << 1) // (ADC) Selected TRGSEL = External Trigger +#define AT91C_ADC_LOWRES (0x1 << 4) // (ADC) Resolution. +#define AT91C_ADC_LOWRES_10_BIT (0x0 << 4) // (ADC) 10-bit resolution +#define AT91C_ADC_LOWRES_8_BIT (0x1 << 4) // (ADC) 8-bit resolution +#define AT91C_ADC_SLEEP (0x1 << 5) // (ADC) Sleep Mode +#define AT91C_ADC_SLEEP_NORMAL_MODE (0x0 << 5) // (ADC) Normal Mode +#define AT91C_ADC_SLEEP_MODE (0x1 << 5) // (ADC) Sleep Mode +#define AT91C_ADC_PRESCAL (0x3F << 8) // (ADC) Prescaler rate selection +#define AT91C_ADC_STARTUP (0x1F << 16) // (ADC) Startup Time +#define AT91C_ADC_SHTIM (0xF << 24) // (ADC) Sample & Hold Time +// -------- ADC_CHER : (ADC Offset: 0x10) ADC Channel Enable Register -------- +#define AT91C_ADC_CH0 (0x1 << 0) // (ADC) Channel 0 +#define AT91C_ADC_CH1 (0x1 << 1) // (ADC) Channel 1 +#define AT91C_ADC_CH2 (0x1 << 2) // (ADC) Channel 2 +#define AT91C_ADC_CH3 (0x1 << 3) // (ADC) Channel 3 +#define AT91C_ADC_CH4 (0x1 << 4) // (ADC) Channel 4 +#define AT91C_ADC_CH5 (0x1 << 5) // (ADC) Channel 5 +#define AT91C_ADC_CH6 (0x1 << 6) // (ADC) Channel 6 +#define AT91C_ADC_CH7 (0x1 << 7) // (ADC) Channel 7 +// -------- ADC_CHDR : (ADC Offset: 0x14) ADC Channel Disable Register -------- +// -------- ADC_CHSR : (ADC Offset: 0x18) ADC Channel Status Register -------- +// -------- ADC_SR : (ADC Offset: 0x1c) ADC Status Register -------- +#define AT91C_ADC_EOC0 (0x1 << 0) // (ADC) End of Conversion +#define AT91C_ADC_EOC1 (0x1 << 1) // (ADC) End of Conversion +#define AT91C_ADC_EOC2 (0x1 << 2) // (ADC) End of Conversion +#define AT91C_ADC_EOC3 (0x1 << 3) // (ADC) End of Conversion +#define AT91C_ADC_EOC4 (0x1 << 4) // (ADC) End of Conversion +#define AT91C_ADC_EOC5 (0x1 << 5) // (ADC) End of Conversion +#define AT91C_ADC_EOC6 (0x1 << 6) // (ADC) End of Conversion +#define AT91C_ADC_EOC7 (0x1 << 7) // (ADC) End of Conversion +#define AT91C_ADC_OVRE0 (0x1 << 8) // (ADC) Overrun Error +#define AT91C_ADC_OVRE1 (0x1 << 9) // (ADC) Overrun Error +#define AT91C_ADC_OVRE2 (0x1 << 10) // (ADC) Overrun Error +#define AT91C_ADC_OVRE3 (0x1 << 11) // (ADC) Overrun Error +#define AT91C_ADC_OVRE4 (0x1 << 12) // (ADC) Overrun Error +#define AT91C_ADC_OVRE5 (0x1 << 13) // (ADC) Overrun Error +#define AT91C_ADC_OVRE6 (0x1 << 14) // (ADC) Overrun Error +#define AT91C_ADC_OVRE7 (0x1 << 15) // (ADC) Overrun Error +#define AT91C_ADC_DRDY (0x1 << 16) // (ADC) Data Ready +#define AT91C_ADC_GOVRE (0x1 << 17) // (ADC) General Overrun +#define AT91C_ADC_ENDRX (0x1 << 18) // (ADC) End of Receiver Transfer +#define AT91C_ADC_RXBUFF (0x1 << 19) // (ADC) RXBUFF Interrupt +// -------- ADC_LCDR : (ADC Offset: 0x20) ADC Last Converted Data Register -------- +#define AT91C_ADC_LDATA (0x3FF << 0) // (ADC) Last Data Converted +// -------- ADC_IER : (ADC Offset: 0x24) ADC Interrupt Enable Register -------- +// -------- ADC_IDR : (ADC Offset: 0x28) ADC Interrupt Disable Register -------- +// -------- ADC_IMR : (ADC Offset: 0x2c) ADC Interrupt Mask Register -------- +// -------- ADC_CDR0 : (ADC Offset: 0x30) ADC Channel Data Register 0 -------- +#define AT91C_ADC_DATA (0x3FF << 0) // (ADC) Converted Data +// -------- ADC_CDR1 : (ADC Offset: 0x34) ADC Channel Data Register 1 -------- +// -------- ADC_CDR2 : (ADC Offset: 0x38) ADC Channel Data Register 2 -------- +// -------- ADC_CDR3 : (ADC Offset: 0x3c) ADC Channel Data Register 3 -------- +// -------- ADC_CDR4 : (ADC Offset: 0x40) ADC Channel Data Register 4 -------- +// -------- ADC_CDR5 : (ADC Offset: 0x44) ADC Channel Data Register 5 -------- +// -------- ADC_CDR6 : (ADC Offset: 0x48) ADC Channel Data Register 6 -------- +// -------- ADC_CDR7 : (ADC Offset: 0x4c) ADC Channel Data Register 7 -------- + +// ***************************************************************************** +// REGISTER ADDRESS DEFINITION FOR AT91SAM7X256 +// ***************************************************************************** +// ========== Register definition for SYS peripheral ========== +// ========== Register definition for AIC peripheral ========== +#define AT91C_AIC_ICCR (0xFFFFF128) // (AIC) Interrupt Clear Command Register +#define AT91C_AIC_IECR (0xFFFFF120) // (AIC) Interrupt Enable Command Register +#define AT91C_AIC_SMR (0xFFFFF000) // (AIC) Source Mode Register +#define AT91C_AIC_ISCR (0xFFFFF12C) // (AIC) Interrupt Set Command Register +#define AT91C_AIC_EOICR (0xFFFFF130) // (AIC) End of Interrupt Command Register +#define AT91C_AIC_DCR (0xFFFFF138) // (AIC) Debug Control Register (Protect) +#define AT91C_AIC_FFER (0xFFFFF140) // (AIC) Fast Forcing Enable Register +#define AT91C_AIC_SVR (0xFFFFF080) // (AIC) Source Vector Register +#define AT91C_AIC_SPU (0xFFFFF134) // (AIC) Spurious Vector Register +#define AT91C_AIC_FFDR (0xFFFFF144) // (AIC) Fast Forcing Disable Register +#define AT91C_AIC_FVR (0xFFFFF104) // (AIC) FIQ Vector Register +#define AT91C_AIC_FFSR (0xFFFFF148) // (AIC) Fast Forcing Status Register +#define AT91C_AIC_IMR (0xFFFFF110) // (AIC) Interrupt Mask Register +#define AT91C_AIC_ISR (0xFFFFF108) // (AIC) Interrupt Status Register +#define AT91C_AIC_IVR (0xFFFFF100) // (AIC) IRQ Vector Register +#define AT91C_AIC_IDCR (0xFFFFF124) // (AIC) Interrupt Disable Command Register +#define AT91C_AIC_CISR (0xFFFFF114) // (AIC) Core Interrupt Status Register +#define AT91C_AIC_IPR (0xFFFFF10C) // (AIC) Interrupt Pending Register +// ========== Register definition for PDC_DBGU peripheral ========== +#define AT91C_DBGU_TNCR (0xFFFFF31C) // (PDC_DBGU) Transmit Next Counter Register +#define AT91C_DBGU_RNCR (0xFFFFF314) // (PDC_DBGU) Receive Next Counter Register +#define AT91C_DBGU_PTCR (0xFFFFF320) // (PDC_DBGU) PDC Transfer Control Register +#define AT91C_DBGU_PTSR (0xFFFFF324) // (PDC_DBGU) PDC Transfer Status Register +#define AT91C_DBGU_RCR (0xFFFFF304) // (PDC_DBGU) Receive Counter Register +#define AT91C_DBGU_TCR (0xFFFFF30C) // (PDC_DBGU) Transmit Counter Register +#define AT91C_DBGU_RPR (0xFFFFF300) // (PDC_DBGU) Receive Pointer Register +#define AT91C_DBGU_TPR (0xFFFFF308) // (PDC_DBGU) Transmit Pointer Register +#define AT91C_DBGU_RNPR (0xFFFFF310) // (PDC_DBGU) Receive Next Pointer Register +#define AT91C_DBGU_TNPR (0xFFFFF318) // (PDC_DBGU) Transmit Next Pointer Register +// ========== Register definition for DBGU peripheral ========== +#define AT91C_DBGU_EXID (0xFFFFF244) // (DBGU) Chip ID Extension Register +#define AT91C_DBGU_THR (0xFFFFF21C) // (DBGU) Transmitter Holding Register +#define AT91C_DBGU_CSR (0xFFFFF214) // (DBGU) Channel Status Register +#define AT91C_DBGU_IDR (0xFFFFF20C) // (DBGU) Interrupt Disable Register +#define AT91C_DBGU_MR (0xFFFFF204) // (DBGU) Mode Register +#define AT91C_DBGU_FNTR (0xFFFFF248) // (DBGU) Force NTRST Register +#define AT91C_DBGU_CIDR (0xFFFFF240) // (DBGU) Chip ID Register +#define AT91C_DBGU_BRGR (0xFFFFF220) // (DBGU) Baud Rate Generator Register +#define AT91C_DBGU_RHR (0xFFFFF218) // (DBGU) Receiver Holding Register +#define AT91C_DBGU_IMR (0xFFFFF210) // (DBGU) Interrupt Mask Register +#define AT91C_DBGU_IER (0xFFFFF208) // (DBGU) Interrupt Enable Register +#define AT91C_DBGU_CR (0xFFFFF200) // (DBGU) Control Register +// ========== Register definition for PIOA peripheral ========== +#define AT91C_PIOA_IMR (0xFFFFF448) // (PIOA) Interrupt Mask Register +#define AT91C_PIOA_IER (0xFFFFF440) // (PIOA) Interrupt Enable Register +#define AT91C_PIOA_OWDR (0xFFFFF4A4) // (PIOA) Output Write Disable Register +#define AT91C_PIOA_ISR (0xFFFFF44C) // (PIOA) Interrupt Status Register +#define AT91C_PIOA_PPUDR (0xFFFFF460) // (PIOA) Pull-up Disable Register +#define AT91C_PIOA_MDSR (0xFFFFF458) // (PIOA) Multi-driver Status Register +#define AT91C_PIOA_MDER (0xFFFFF450) // (PIOA) Multi-driver Enable Register +#define AT91C_PIOA_PER (0xFFFFF400) // (PIOA) PIO Enable Register +#define AT91C_PIOA_PSR (0xFFFFF408) // (PIOA) PIO Status Register +#define AT91C_PIOA_OER (0xFFFFF410) // (PIOA) Output Enable Register +#define AT91C_PIOA_BSR (0xFFFFF474) // (PIOA) Select B Register +#define AT91C_PIOA_PPUER (0xFFFFF464) // (PIOA) Pull-up Enable Register +#define AT91C_PIOA_MDDR (0xFFFFF454) // (PIOA) Multi-driver Disable Register +#define AT91C_PIOA_PDR (0xFFFFF404) // (PIOA) PIO Disable Register +#define AT91C_PIOA_ODR (0xFFFFF414) // (PIOA) Output Disable Registerr +#define AT91C_PIOA_IFDR (0xFFFFF424) // (PIOA) Input Filter Disable Register +#define AT91C_PIOA_ABSR (0xFFFFF478) // (PIOA) AB Select Status Register +#define AT91C_PIOA_ASR (0xFFFFF470) // (PIOA) Select A Register +#define AT91C_PIOA_PPUSR (0xFFFFF468) // (PIOA) Pull-up Status Register +#define AT91C_PIOA_ODSR (0xFFFFF438) // (PIOA) Output Data Status Register +#define AT91C_PIOA_SODR (0xFFFFF430) // (PIOA) Set Output Data Register +#define AT91C_PIOA_IFSR (0xFFFFF428) // (PIOA) Input Filter Status Register +#define AT91C_PIOA_IFER (0xFFFFF420) // (PIOA) Input Filter Enable Register +#define AT91C_PIOA_OSR (0xFFFFF418) // (PIOA) Output Status Register +#define AT91C_PIOA_IDR (0xFFFFF444) // (PIOA) Interrupt Disable Register +#define AT91C_PIOA_PDSR (0xFFFFF43C) // (PIOA) Pin Data Status Register +#define AT91C_PIOA_CODR (0xFFFFF434) // (PIOA) Clear Output Data Register +#define AT91C_PIOA_OWSR (0xFFFFF4A8) // (PIOA) Output Write Status Register +#define AT91C_PIOA_OWER (0xFFFFF4A0) // (PIOA) Output Write Enable Register +// ========== Register definition for PIOB peripheral ========== +#define AT91C_PIOB_OWSR (0xFFFFF6A8) // (PIOB) Output Write Status Register +#define AT91C_PIOB_PPUSR (0xFFFFF668) // (PIOB) Pull-up Status Register +#define AT91C_PIOB_PPUDR (0xFFFFF660) // (PIOB) Pull-up Disable Register +#define AT91C_PIOB_MDSR (0xFFFFF658) // (PIOB) Multi-driver Status Register +#define AT91C_PIOB_MDER (0xFFFFF650) // (PIOB) Multi-driver Enable Register +#define AT91C_PIOB_IMR (0xFFFFF648) // (PIOB) Interrupt Mask Register +#define AT91C_PIOB_OSR (0xFFFFF618) // (PIOB) Output Status Register +#define AT91C_PIOB_OER (0xFFFFF610) // (PIOB) Output Enable Register +#define AT91C_PIOB_PSR (0xFFFFF608) // (PIOB) PIO Status Register +#define AT91C_PIOB_PER (0xFFFFF600) // (PIOB) PIO Enable Register +#define AT91C_PIOB_BSR (0xFFFFF674) // (PIOB) Select B Register +#define AT91C_PIOB_PPUER (0xFFFFF664) // (PIOB) Pull-up Enable Register +#define AT91C_PIOB_IFDR (0xFFFFF624) // (PIOB) Input Filter Disable Register +#define AT91C_PIOB_ODR (0xFFFFF614) // (PIOB) Output Disable Registerr +#define AT91C_PIOB_ABSR (0xFFFFF678) // (PIOB) AB Select Status Register +#define AT91C_PIOB_ASR (0xFFFFF670) // (PIOB) Select A Register +#define AT91C_PIOB_IFER (0xFFFFF620) // (PIOB) Input Filter Enable Register +#define AT91C_PIOB_IFSR (0xFFFFF628) // (PIOB) Input Filter Status Register +#define AT91C_PIOB_SODR (0xFFFFF630) // (PIOB) Set Output Data Register +#define AT91C_PIOB_ODSR (0xFFFFF638) // (PIOB) Output Data Status Register +#define AT91C_PIOB_CODR (0xFFFFF634) // (PIOB) Clear Output Data Register +#define AT91C_PIOB_PDSR (0xFFFFF63C) // (PIOB) Pin Data Status Register +#define AT91C_PIOB_OWER (0xFFFFF6A0) // (PIOB) Output Write Enable Register +#define AT91C_PIOB_IER (0xFFFFF640) // (PIOB) Interrupt Enable Register +#define AT91C_PIOB_OWDR (0xFFFFF6A4) // (PIOB) Output Write Disable Register +#define AT91C_PIOB_MDDR (0xFFFFF654) // (PIOB) Multi-driver Disable Register +#define AT91C_PIOB_ISR (0xFFFFF64C) // (PIOB) Interrupt Status Register +#define AT91C_PIOB_IDR (0xFFFFF644) // (PIOB) Interrupt Disable Register +#define AT91C_PIOB_PDR (0xFFFFF604) // (PIOB) PIO Disable Register +// ========== Register definition for CKGR peripheral ========== +#define AT91C_CKGR_PLLR (0xFFFFFC2C) // (CKGR) PLL Register +#define AT91C_CKGR_MCFR (0xFFFFFC24) // (CKGR) Main Clock Frequency Register +#define AT91C_CKGR_MOR (0xFFFFFC20) // (CKGR) Main Oscillator Register +// ========== Register definition for PMC peripheral ========== +#define AT91C_PMC_SCSR (0xFFFFFC08) // (PMC) System Clock Status Register +#define AT91C_PMC_SCER (0xFFFFFC00) // (PMC) System Clock Enable Register +#define AT91C_PMC_IMR (0xFFFFFC6C) // (PMC) Interrupt Mask Register +#define AT91C_PMC_IDR (0xFFFFFC64) // (PMC) Interrupt Disable Register +#define AT91C_PMC_PCDR (0xFFFFFC14) // (PMC) Peripheral Clock Disable Register +#define AT91C_PMC_SCDR (0xFFFFFC04) // (PMC) System Clock Disable Register +#define AT91C_PMC_SR (0xFFFFFC68) // (PMC) Status Register +#define AT91C_PMC_IER (0xFFFFFC60) // (PMC) Interrupt Enable Register +#define AT91C_PMC_MCKR (0xFFFFFC30) // (PMC) Master Clock Register +#define AT91C_PMC_MOR (0xFFFFFC20) // (PMC) Main Oscillator Register +#define AT91C_PMC_PCER (0xFFFFFC10) // (PMC) Peripheral Clock Enable Register +#define AT91C_PMC_PCSR (0xFFFFFC18) // (PMC) Peripheral Clock Status Register +#define AT91C_PMC_PLLR (0xFFFFFC2C) // (PMC) PLL Register +#define AT91C_PMC_MCFR (0xFFFFFC24) // (PMC) Main Clock Frequency Register +#define AT91C_PMC_PCKR (0xFFFFFC40) // (PMC) Programmable Clock Register +// ========== Register definition for RSTC peripheral ========== +#define AT91C_RSTC_RSR (0xFFFFFD04) // (RSTC) Reset Status Register +#define AT91C_RSTC_RMR (0xFFFFFD08) // (RSTC) Reset Mode Register +#define AT91C_RSTC_RCR (0xFFFFFD00) // (RSTC) Reset Control Register +// ========== Register definition for RTTC peripheral ========== +#define AT91C_RTTC_RTSR (0xFFFFFD2C) // (RTTC) Real-time Status Register +#define AT91C_RTTC_RTAR (0xFFFFFD24) // (RTTC) Real-time Alarm Register +#define AT91C_RTTC_RTVR (0xFFFFFD28) // (RTTC) Real-time Value Register +#define AT91C_RTTC_RTMR (0xFFFFFD20) // (RTTC) Real-time Mode Register +// ========== Register definition for PITC peripheral ========== +#define AT91C_PITC_PIIR (0xFFFFFD3C) // (PITC) Period Interval Image Register +#define AT91C_PITC_PISR (0xFFFFFD34) // (PITC) Period Interval Status Register +#define AT91C_PITC_PIVR (0xFFFFFD38) // (PITC) Period Interval Value Register +#define AT91C_PITC_PIMR (0xFFFFFD30) // (PITC) Period Interval Mode Register +// ========== Register definition for WDTC peripheral ========== +#define AT91C_WDTC_WDMR (0xFFFFFD44) // (WDTC) Watchdog Mode Register +#define AT91C_WDTC_WDSR (0xFFFFFD48) // (WDTC) Watchdog Status Register +#define AT91C_WDTC_WDCR (0xFFFFFD40) // (WDTC) Watchdog Control Register +// ========== Register definition for VREG peripheral ========== +#define AT91C_VREG_MR (0xFFFFFD60) // (VREG) Voltage Regulator Mode Register +// ========== Register definition for MC peripheral ========== +#define AT91C_MC_FCR (0xFFFFFF64) // (MC) MC Flash Command Register +#define AT91C_MC_ASR (0xFFFFFF04) // (MC) MC Abort Status Register +#define AT91C_MC_FSR (0xFFFFFF68) // (MC) MC Flash Status Register +#define AT91C_MC_FMR (0xFFFFFF60) // (MC) MC Flash Mode Register +#define AT91C_MC_AASR (0xFFFFFF08) // (MC) MC Abort Address Status Register +#define AT91C_MC_RCR (0xFFFFFF00) // (MC) MC Remap Control Register +// ========== Register definition for PDC_SPI1 peripheral ========== +#define AT91C_SPI1_RNPR (0xFFFE4110) // (PDC_SPI1) Receive Next Pointer Register +#define AT91C_SPI1_TPR (0xFFFE4108) // (PDC_SPI1) Transmit Pointer Register +#define AT91C_SPI1_RPR (0xFFFE4100) // (PDC_SPI1) Receive Pointer Register +#define AT91C_SPI1_PTSR (0xFFFE4124) // (PDC_SPI1) PDC Transfer Status Register +#define AT91C_SPI1_RCR (0xFFFE4104) // (PDC_SPI1) Receive Counter Register +#define AT91C_SPI1_TCR (0xFFFE410C) // (PDC_SPI1) Transmit Counter Register +#define AT91C_SPI1_RNCR (0xFFFE4114) // (PDC_SPI1) Receive Next Counter Register +#define AT91C_SPI1_TNCR (0xFFFE411C) // (PDC_SPI1) Transmit Next Counter Register +#define AT91C_SPI1_TNPR (0xFFFE4118) // (PDC_SPI1) Transmit Next Pointer Register +#define AT91C_SPI1_PTCR (0xFFFE4120) // (PDC_SPI1) PDC Transfer Control Register +// ========== Register definition for SPI1 peripheral ========== +#define AT91C_SPI1_CSR (0xFFFE4030) // (SPI1) Chip Select Register +#define AT91C_SPI1_IDR (0xFFFE4018) // (SPI1) Interrupt Disable Register +#define AT91C_SPI1_SR (0xFFFE4010) // (SPI1) Status Register +#define AT91C_SPI1_RDR (0xFFFE4008) // (SPI1) Receive Data Register +#define AT91C_SPI1_CR (0xFFFE4000) // (SPI1) Control Register +#define AT91C_SPI1_IMR (0xFFFE401C) // (SPI1) Interrupt Mask Register +#define AT91C_SPI1_IER (0xFFFE4014) // (SPI1) Interrupt Enable Register +#define AT91C_SPI1_TDR (0xFFFE400C) // (SPI1) Transmit Data Register +#define AT91C_SPI1_MR (0xFFFE4004) // (SPI1) Mode Register +// ========== Register definition for PDC_SPI0 peripheral ========== +#define AT91C_SPI0_PTCR (0xFFFE0120) // (PDC_SPI0) PDC Transfer Control Register +#define AT91C_SPI0_TNPR (0xFFFE0118) // (PDC_SPI0) Transmit Next Pointer Register +#define AT91C_SPI0_RNPR (0xFFFE0110) // (PDC_SPI0) Receive Next Pointer Register +#define AT91C_SPI0_TPR (0xFFFE0108) // (PDC_SPI0) Transmit Pointer Register +#define AT91C_SPI0_RPR (0xFFFE0100) // (PDC_SPI0) Receive Pointer Register +#define AT91C_SPI0_PTSR (0xFFFE0124) // (PDC_SPI0) PDC Transfer Status Register +#define AT91C_SPI0_TNCR (0xFFFE011C) // (PDC_SPI0) Transmit Next Counter Register +#define AT91C_SPI0_RNCR (0xFFFE0114) // (PDC_SPI0) Receive Next Counter Register +#define AT91C_SPI0_TCR (0xFFFE010C) // (PDC_SPI0) Transmit Counter Register +#define AT91C_SPI0_RCR (0xFFFE0104) // (PDC_SPI0) Receive Counter Register +// ========== Register definition for SPI0 peripheral ========== +#define AT91C_SPI0_CSR (0xFFFE0030) // (SPI0) Chip Select Register +#define AT91C_SPI0_IDR (0xFFFE0018) // (SPI0) Interrupt Disable Register +#define AT91C_SPI0_SR (0xFFFE0010) // (SPI0) Status Register +#define AT91C_SPI0_RDR (0xFFFE0008) // (SPI0) Receive Data Register +#define AT91C_SPI0_CR (0xFFFE0000) // (SPI0) Control Register +#define AT91C_SPI0_IMR (0xFFFE001C) // (SPI0) Interrupt Mask Register +#define AT91C_SPI0_IER (0xFFFE0014) // (SPI0) Interrupt Enable Register +#define AT91C_SPI0_TDR (0xFFFE000C) // (SPI0) Transmit Data Register +#define AT91C_SPI0_MR (0xFFFE0004) // (SPI0) Mode Register +// ========== Register definition for PDC_US1 peripheral ========== +#define AT91C_US1_PTSR (0xFFFC4124) // (PDC_US1) PDC Transfer Status Register +#define AT91C_US1_TNCR (0xFFFC411C) // (PDC_US1) Transmit Next Counter Register +#define AT91C_US1_RNCR (0xFFFC4114) // (PDC_US1) Receive Next Counter Register +#define AT91C_US1_TCR (0xFFFC410C) // (PDC_US1) Transmit Counter Register +#define AT91C_US1_RCR (0xFFFC4104) // (PDC_US1) Receive Counter Register +#define AT91C_US1_PTCR (0xFFFC4120) // (PDC_US1) PDC Transfer Control Register +#define AT91C_US1_TNPR (0xFFFC4118) // (PDC_US1) Transmit Next Pointer Register +#define AT91C_US1_RNPR (0xFFFC4110) // (PDC_US1) Receive Next Pointer Register +#define AT91C_US1_TPR (0xFFFC4108) // (PDC_US1) Transmit Pointer Register +#define AT91C_US1_RPR (0xFFFC4100) // (PDC_US1) Receive Pointer Register +// ========== Register definition for US1 peripheral ========== +#define AT91C_US1_RHR (0xFFFC4018) // (US1) Receiver Holding Register +#define AT91C_US1_IMR (0xFFFC4010) // (US1) Interrupt Mask Register +#define AT91C_US1_IER (0xFFFC4008) // (US1) Interrupt Enable Register +#define AT91C_US1_CR (0xFFFC4000) // (US1) Control Register +#define AT91C_US1_RTOR (0xFFFC4024) // (US1) Receiver Time-out Register +#define AT91C_US1_THR (0xFFFC401C) // (US1) Transmitter Holding Register +#define AT91C_US1_CSR (0xFFFC4014) // (US1) Channel Status Register +#define AT91C_US1_IDR (0xFFFC400C) // (US1) Interrupt Disable Register +#define AT91C_US1_FIDI (0xFFFC4040) // (US1) FI_DI_Ratio Register +#define AT91C_US1_BRGR (0xFFFC4020) // (US1) Baud Rate Generator Register +#define AT91C_US1_TTGR (0xFFFC4028) // (US1) Transmitter Time-guard Register +#define AT91C_US1_IF (0xFFFC404C) // (US1) IRDA_FILTER Register +#define AT91C_US1_NER (0xFFFC4044) // (US1) Nb Errors Register +#define AT91C_US1_MR (0xFFFC4004) // (US1) Mode Register +// ========== Register definition for PDC_US0 peripheral ========== +#define AT91C_US0_PTCR (0xFFFC0120) // (PDC_US0) PDC Transfer Control Register +#define AT91C_US0_TNPR (0xFFFC0118) // (PDC_US0) Transmit Next Pointer Register +#define AT91C_US0_RNPR (0xFFFC0110) // (PDC_US0) Receive Next Pointer Register +#define AT91C_US0_TPR (0xFFFC0108) // (PDC_US0) Transmit Pointer Register +#define AT91C_US0_RPR (0xFFFC0100) // (PDC_US0) Receive Pointer Register +#define AT91C_US0_PTSR (0xFFFC0124) // (PDC_US0) PDC Transfer Status Register +#define AT91C_US0_TNCR (0xFFFC011C) // (PDC_US0) Transmit Next Counter Register +#define AT91C_US0_RNCR (0xFFFC0114) // (PDC_US0) Receive Next Counter Register +#define AT91C_US0_TCR (0xFFFC010C) // (PDC_US0) Transmit Counter Register +#define AT91C_US0_RCR (0xFFFC0104) // (PDC_US0) Receive Counter Register +// ========== Register definition for US0 peripheral ========== +#define AT91C_US0_TTGR (0xFFFC0028) // (US0) Transmitter Time-guard Register +#define AT91C_US0_BRGR (0xFFFC0020) // (US0) Baud Rate Generator Register +#define AT91C_US0_RHR (0xFFFC0018) // (US0) Receiver Holding Register +#define AT91C_US0_IMR (0xFFFC0010) // (US0) Interrupt Mask Register +#define AT91C_US0_NER (0xFFFC0044) // (US0) Nb Errors Register +#define AT91C_US0_RTOR (0xFFFC0024) // (US0) Receiver Time-out Register +#define AT91C_US0_FIDI (0xFFFC0040) // (US0) FI_DI_Ratio Register +#define AT91C_US0_CR (0xFFFC0000) // (US0) Control Register +#define AT91C_US0_IER (0xFFFC0008) // (US0) Interrupt Enable Register +#define AT91C_US0_IF (0xFFFC004C) // (US0) IRDA_FILTER Register +#define AT91C_US0_MR (0xFFFC0004) // (US0) Mode Register +#define AT91C_US0_IDR (0xFFFC000C) // (US0) Interrupt Disable Register +#define AT91C_US0_CSR (0xFFFC0014) // (US0) Channel Status Register +#define AT91C_US0_THR (0xFFFC001C) // (US0) Transmitter Holding Register +// ========== Register definition for PDC_SSC peripheral ========== +#define AT91C_SSC_PTCR (0xFFFD4120) // (PDC_SSC) PDC Transfer Control Register +#define AT91C_SSC_TNPR (0xFFFD4118) // (PDC_SSC) Transmit Next Pointer Register +#define AT91C_SSC_RNPR (0xFFFD4110) // (PDC_SSC) Receive Next Pointer Register +#define AT91C_SSC_TPR (0xFFFD4108) // (PDC_SSC) Transmit Pointer Register +#define AT91C_SSC_RPR (0xFFFD4100) // (PDC_SSC) Receive Pointer Register +#define AT91C_SSC_PTSR (0xFFFD4124) // (PDC_SSC) PDC Transfer Status Register +#define AT91C_SSC_TNCR (0xFFFD411C) // (PDC_SSC) Transmit Next Counter Register +#define AT91C_SSC_RNCR (0xFFFD4114) // (PDC_SSC) Receive Next Counter Register +#define AT91C_SSC_TCR (0xFFFD410C) // (PDC_SSC) Transmit Counter Register +#define AT91C_SSC_RCR (0xFFFD4104) // (PDC_SSC) Receive Counter Register +// ========== Register definition for SSC peripheral ========== +#define AT91C_SSC_RFMR (0xFFFD4014) // (SSC) Receive Frame Mode Register +#define AT91C_SSC_CMR (0xFFFD4004) // (SSC) Clock Mode Register +#define AT91C_SSC_IDR (0xFFFD4048) // (SSC) Interrupt Disable Register +#define AT91C_SSC_SR (0xFFFD4040) // (SSC) Status Register +#define AT91C_SSC_RSHR (0xFFFD4030) // (SSC) Receive Sync Holding Register +#define AT91C_SSC_RHR (0xFFFD4020) // (SSC) Receive Holding Register +#define AT91C_SSC_TCMR (0xFFFD4018) // (SSC) Transmit Clock Mode Register +#define AT91C_SSC_RCMR (0xFFFD4010) // (SSC) Receive Clock ModeRegister +#define AT91C_SSC_CR (0xFFFD4000) // (SSC) Control Register +#define AT91C_SSC_IMR (0xFFFD404C) // (SSC) Interrupt Mask Register +#define AT91C_SSC_IER (0xFFFD4044) // (SSC) Interrupt Enable Register +#define AT91C_SSC_TSHR (0xFFFD4034) // (SSC) Transmit Sync Holding Register +#define AT91C_SSC_THR (0xFFFD4024) // (SSC) Transmit Holding Register +#define AT91C_SSC_TFMR (0xFFFD401C) // (SSC) Transmit Frame Mode Register +// ========== Register definition for TWI peripheral ========== +#define AT91C_TWI_RHR (0xFFFB8030) // (TWI) Receive Holding Register +#define AT91C_TWI_IDR (0xFFFB8028) // (TWI) Interrupt Disable Register +#define AT91C_TWI_SR (0xFFFB8020) // (TWI) Status Register +#define AT91C_TWI_CWGR (0xFFFB8010) // (TWI) Clock Waveform Generator Register +#define AT91C_TWI_CR (0xFFFB8000) // (TWI) Control Register +#define AT91C_TWI_THR (0xFFFB8034) // (TWI) Transmit Holding Register +#define AT91C_TWI_IMR (0xFFFB802C) // (TWI) Interrupt Mask Register +#define AT91C_TWI_IER (0xFFFB8024) // (TWI) Interrupt Enable Register +#define AT91C_TWI_IADR (0xFFFB800C) // (TWI) Internal Address Register +#define AT91C_TWI_MMR (0xFFFB8004) // (TWI) Master Mode Register +// ========== Register definition for PWMC_CH3 peripheral ========== +#define AT91C_PWMC_CH3_CUPDR (0xFFFCC270) // (PWMC_CH3) Channel Update Register +#define AT91C_PWMC_CH3_CPRDR (0xFFFCC268) // (PWMC_CH3) Channel Period Register +#define AT91C_PWMC_CH3_CMR (0xFFFCC260) // (PWMC_CH3) Channel Mode Register +#define AT91C_PWMC_CH3_Reserved (0xFFFCC274) // (PWMC_CH3) Reserved +#define AT91C_PWMC_CH3_CCNTR (0xFFFCC26C) // (PWMC_CH3) Channel Counter Register +#define AT91C_PWMC_CH3_CDTYR (0xFFFCC264) // (PWMC_CH3) Channel Duty Cycle Register +// ========== Register definition for PWMC_CH2 peripheral ========== +#define AT91C_PWMC_CH2_CUPDR (0xFFFCC250) // (PWMC_CH2) Channel Update Register +#define AT91C_PWMC_CH2_CPRDR (0xFFFCC248) // (PWMC_CH2) Channel Period Register +#define AT91C_PWMC_CH2_CMR (0xFFFCC240) // (PWMC_CH2) Channel Mode Register +#define AT91C_PWMC_CH2_Reserved (0xFFFCC254) // (PWMC_CH2) Reserved +#define AT91C_PWMC_CH2_CCNTR (0xFFFCC24C) // (PWMC_CH2) Channel Counter Register +#define AT91C_PWMC_CH2_CDTYR (0xFFFCC244) // (PWMC_CH2) Channel Duty Cycle Register +// ========== Register definition for PWMC_CH1 peripheral ========== +#define AT91C_PWMC_CH1_CUPDR (0xFFFCC230) // (PWMC_CH1) Channel Update Register +#define AT91C_PWMC_CH1_CPRDR (0xFFFCC228) // (PWMC_CH1) Channel Period Register +#define AT91C_PWMC_CH1_CMR (0xFFFCC220) // (PWMC_CH1) Channel Mode Register +#define AT91C_PWMC_CH1_Reserved (0xFFFCC234) // (PWMC_CH1) Reserved +#define AT91C_PWMC_CH1_CCNTR (0xFFFCC22C) // (PWMC_CH1) Channel Counter Register +#define AT91C_PWMC_CH1_CDTYR (0xFFFCC224) // (PWMC_CH1) Channel Duty Cycle Register +// ========== Register definition for PWMC_CH0 peripheral ========== +#define AT91C_PWMC_CH0_CUPDR (0xFFFCC210) // (PWMC_CH0) Channel Update Register +#define AT91C_PWMC_CH0_CPRDR (0xFFFCC208) // (PWMC_CH0) Channel Period Register +#define AT91C_PWMC_CH0_CMR (0xFFFCC200) // (PWMC_CH0) Channel Mode Register +#define AT91C_PWMC_CH0_Reserved (0xFFFCC214) // (PWMC_CH0) Reserved +#define AT91C_PWMC_CH0_CCNTR (0xFFFCC20C) // (PWMC_CH0) Channel Counter Register +#define AT91C_PWMC_CH0_CDTYR (0xFFFCC204) // (PWMC_CH0) Channel Duty Cycle Register +// ========== Register definition for PWMC peripheral ========== +#define AT91C_PWMC_VR (0xFFFCC0FC) // (PWMC) PWMC Version Register +#define AT91C_PWMC_ISR (0xFFFCC01C) // (PWMC) PWMC Interrupt Status Register +#define AT91C_PWMC_IDR (0xFFFCC014) // (PWMC) PWMC Interrupt Disable Register +#define AT91C_PWMC_SR (0xFFFCC00C) // (PWMC) PWMC Status Register +#define AT91C_PWMC_ENA (0xFFFCC004) // (PWMC) PWMC Enable Register +#define AT91C_PWMC_IMR (0xFFFCC018) // (PWMC) PWMC Interrupt Mask Register +#define AT91C_PWMC_MR (0xFFFCC000) // (PWMC) PWMC Mode Register +#define AT91C_PWMC_DIS (0xFFFCC008) // (PWMC) PWMC Disable Register +#define AT91C_PWMC_IER (0xFFFCC010) // (PWMC) PWMC Interrupt Enable Register +// ========== Register definition for UDP peripheral ========== +#define AT91C_UDP_TXVC (0xFFFB0074) // (UDP) Transceiver Control Register +#define AT91C_UDP_ISR (0xFFFB001C) // (UDP) Interrupt Status Register +#define AT91C_UDP_IDR (0xFFFB0014) // (UDP) Interrupt Disable Register +#define AT91C_UDP_CSR (0xFFFB0030) // (UDP) Endpoint Control and Status Register +#define AT91C_UDP_RSTEP (0xFFFB0028) // (UDP) Reset Endpoint Register +#define AT91C_UDP_ICR (0xFFFB0020) // (UDP) Interrupt Clear Register +#define AT91C_UDP_GLBSTATE (0xFFFB0004) // (UDP) Global State Register +#define AT91C_UDP_NUM (0xFFFB0000) // (UDP) Frame Number Register +#define AT91C_UDP_FADDR (0xFFFB0008) // (UDP) Function Address Register +#define AT91C_UDP_IER (0xFFFB0010) // (UDP) Interrupt Enable Register +#define AT91C_UDP_IMR (0xFFFB0018) // (UDP) Interrupt Mask Register +#define AT91C_UDP_FDR (0xFFFB0050) // (UDP) Endpoint FIFO Data Register +// ========== Register definition for TC0 peripheral ========== +#define AT91C_TC0_IMR (0xFFFA002C) // (TC0) Interrupt Mask Register +#define AT91C_TC0_IER (0xFFFA0024) // (TC0) Interrupt Enable Register +#define AT91C_TC0_RC (0xFFFA001C) // (TC0) Register C +#define AT91C_TC0_RA (0xFFFA0014) // (TC0) Register A +#define AT91C_TC0_CMR (0xFFFA0004) // (TC0) Channel Mode Register (Capture Mode / Waveform Mode) +#define AT91C_TC0_IDR (0xFFFA0028) // (TC0) Interrupt Disable Register +#define AT91C_TC0_SR (0xFFFA0020) // (TC0) Status Register +#define AT91C_TC0_RB (0xFFFA0018) // (TC0) Register B +#define AT91C_TC0_CV (0xFFFA0010) // (TC0) Counter Value +#define AT91C_TC0_CCR (0xFFFA0000) // (TC0) Channel Control Register +// ========== Register definition for TC1 peripheral ========== +#define AT91C_TC1_IMR (0xFFFA006C) // (TC1) Interrupt Mask Register +#define AT91C_TC1_IER (0xFFFA0064) // (TC1) Interrupt Enable Register +#define AT91C_TC1_RC (0xFFFA005C) // (TC1) Register C +#define AT91C_TC1_RA (0xFFFA0054) // (TC1) Register A +#define AT91C_TC1_CMR (0xFFFA0044) // (TC1) Channel Mode Register (Capture Mode / Waveform Mode) +#define AT91C_TC1_IDR (0xFFFA0068) // (TC1) Interrupt Disable Register +#define AT91C_TC1_SR (0xFFFA0060) // (TC1) Status Register +#define AT91C_TC1_RB (0xFFFA0058) // (TC1) Register B +#define AT91C_TC1_CV (0xFFFA0050) // (TC1) Counter Value +#define AT91C_TC1_CCR (0xFFFA0040) // (TC1) Channel Control Register +// ========== Register definition for TC2 peripheral ========== +#define AT91C_TC2_IMR (0xFFFA00AC) // (TC2) Interrupt Mask Register +#define AT91C_TC2_IER (0xFFFA00A4) // (TC2) Interrupt Enable Register +#define AT91C_TC2_RC (0xFFFA009C) // (TC2) Register C +#define AT91C_TC2_RA (0xFFFA0094) // (TC2) Register A +#define AT91C_TC2_CMR (0xFFFA0084) // (TC2) Channel Mode Register (Capture Mode / Waveform Mode) +#define AT91C_TC2_IDR (0xFFFA00A8) // (TC2) Interrupt Disable Register +#define AT91C_TC2_SR (0xFFFA00A0) // (TC2) Status Register +#define AT91C_TC2_RB (0xFFFA0098) // (TC2) Register B +#define AT91C_TC2_CV (0xFFFA0090) // (TC2) Counter Value +#define AT91C_TC2_CCR (0xFFFA0080) // (TC2) Channel Control Register +// ========== Register definition for TCB peripheral ========== +#define AT91C_TCB_BMR (0xFFFA00C4) // (TCB) TC Block Mode Register +#define AT91C_TCB_BCR (0xFFFA00C0) // (TCB) TC Block Control Register +// ========== Register definition for CAN_MB0 peripheral ========== +#define AT91C_CAN_MB0_MCR (0xFFFD021C) // (CAN_MB0) MailBox Control Register +#define AT91C_CAN_MB0_MDL (0xFFFD0214) // (CAN_MB0) MailBox Data Low Register +#define AT91C_CAN_MB0_MFID (0xFFFD020C) // (CAN_MB0) MailBox Family ID Register +#define AT91C_CAN_MB0_MAM (0xFFFD0204) // (CAN_MB0) MailBox Acceptance Mask Register +#define AT91C_CAN_MB0_MDH (0xFFFD0218) // (CAN_MB0) MailBox Data High Register +#define AT91C_CAN_MB0_MSR (0xFFFD0210) // (CAN_MB0) MailBox Status Register +#define AT91C_CAN_MB0_MID (0xFFFD0208) // (CAN_MB0) MailBox ID Register +#define AT91C_CAN_MB0_MMR (0xFFFD0200) // (CAN_MB0) MailBox Mode Register +// ========== Register definition for CAN_MB1 peripheral ========== +#define AT91C_CAN_MB1_MCR (0xFFFD023C) // (CAN_MB1) MailBox Control Register +#define AT91C_CAN_MB1_MDL (0xFFFD0234) // (CAN_MB1) MailBox Data Low Register +#define AT91C_CAN_MB1_MFID (0xFFFD022C) // (CAN_MB1) MailBox Family ID Register +#define AT91C_CAN_MB1_MAM (0xFFFD0224) // (CAN_MB1) MailBox Acceptance Mask Register +#define AT91C_CAN_MB1_MDH (0xFFFD0238) // (CAN_MB1) MailBox Data High Register +#define AT91C_CAN_MB1_MSR (0xFFFD0230) // (CAN_MB1) MailBox Status Register +#define AT91C_CAN_MB1_MID (0xFFFD0228) // (CAN_MB1) MailBox ID Register +#define AT91C_CAN_MB1_MMR (0xFFFD0220) // (CAN_MB1) MailBox Mode Register +// ========== Register definition for CAN_MB2 peripheral ========== +#define AT91C_CAN_MB2_MCR (0xFFFD025C) // (CAN_MB2) MailBox Control Register +#define AT91C_CAN_MB2_MDL (0xFFFD0254) // (CAN_MB2) MailBox Data Low Register +#define AT91C_CAN_MB2_MFID (0xFFFD024C) // (CAN_MB2) MailBox Family ID Register +#define AT91C_CAN_MB2_MAM (0xFFFD0244) // (CAN_MB2) MailBox Acceptance Mask Register +#define AT91C_CAN_MB2_MDH (0xFFFD0258) // (CAN_MB2) MailBox Data High Register +#define AT91C_CAN_MB2_MSR (0xFFFD0250) // (CAN_MB2) MailBox Status Register +#define AT91C_CAN_MB2_MID (0xFFFD0248) // (CAN_MB2) MailBox ID Register +#define AT91C_CAN_MB2_MMR (0xFFFD0240) // (CAN_MB2) MailBox Mode Register +// ========== Register definition for CAN_MB3 peripheral ========== +#define AT91C_CAN_MB3_MCR (0xFFFD027C) // (CAN_MB3) MailBox Control Register +#define AT91C_CAN_MB3_MDL (0xFFFD0274) // (CAN_MB3) MailBox Data Low Register +#define AT91C_CAN_MB3_MFID (0xFFFD026C) // (CAN_MB3) MailBox Family ID Register +#define AT91C_CAN_MB3_MAM (0xFFFD0264) // (CAN_MB3) MailBox Acceptance Mask Register +#define AT91C_CAN_MB3_MDH (0xFFFD0278) // (CAN_MB3) MailBox Data High Register +#define AT91C_CAN_MB3_MSR (0xFFFD0270) // (CAN_MB3) MailBox Status Register +#define AT91C_CAN_MB3_MID (0xFFFD0268) // (CAN_MB3) MailBox ID Register +#define AT91C_CAN_MB3_MMR (0xFFFD0260) // (CAN_MB3) MailBox Mode Register +// ========== Register definition for CAN_MB4 peripheral ========== +#define AT91C_CAN_MB4_MCR (0xFFFD029C) // (CAN_MB4) MailBox Control Register +#define AT91C_CAN_MB4_MDL (0xFFFD0294) // (CAN_MB4) MailBox Data Low Register +#define AT91C_CAN_MB4_MFID (0xFFFD028C) // (CAN_MB4) MailBox Family ID Register +#define AT91C_CAN_MB4_MAM (0xFFFD0284) // (CAN_MB4) MailBox Acceptance Mask Register +#define AT91C_CAN_MB4_MDH (0xFFFD0298) // (CAN_MB4) MailBox Data High Register +#define AT91C_CAN_MB4_MSR (0xFFFD0290) // (CAN_MB4) MailBox Status Register +#define AT91C_CAN_MB4_MID (0xFFFD0288) // (CAN_MB4) MailBox ID Register +#define AT91C_CAN_MB4_MMR (0xFFFD0280) // (CAN_MB4) MailBox Mode Register +// ========== Register definition for CAN_MB5 peripheral ========== +#define AT91C_CAN_MB5_MCR (0xFFFD02BC) // (CAN_MB5) MailBox Control Register +#define AT91C_CAN_MB5_MDL (0xFFFD02B4) // (CAN_MB5) MailBox Data Low Register +#define AT91C_CAN_MB5_MFID (0xFFFD02AC) // (CAN_MB5) MailBox Family ID Register +#define AT91C_CAN_MB5_MAM (0xFFFD02A4) // (CAN_MB5) MailBox Acceptance Mask Register +#define AT91C_CAN_MB5_MDH (0xFFFD02B8) // (CAN_MB5) MailBox Data High Register +#define AT91C_CAN_MB5_MSR (0xFFFD02B0) // (CAN_MB5) MailBox Status Register +#define AT91C_CAN_MB5_MID (0xFFFD02A8) // (CAN_MB5) MailBox ID Register +#define AT91C_CAN_MB5_MMR (0xFFFD02A0) // (CAN_MB5) MailBox Mode Register +// ========== Register definition for CAN_MB6 peripheral ========== +#define AT91C_CAN_MB6_MAM (0xFFFD02C4) // (CAN_MB6) MailBox Acceptance Mask Register +#define AT91C_CAN_MB6_MDH (0xFFFD02D8) // (CAN_MB6) MailBox Data High Register +#define AT91C_CAN_MB6_MSR (0xFFFD02D0) // (CAN_MB6) MailBox Status Register +#define AT91C_CAN_MB6_MID (0xFFFD02C8) // (CAN_MB6) MailBox ID Register +#define AT91C_CAN_MB6_MMR (0xFFFD02C0) // (CAN_MB6) MailBox Mode Register +#define AT91C_CAN_MB6_MCR (0xFFFD02DC) // (CAN_MB6) MailBox Control Register +#define AT91C_CAN_MB6_MDL (0xFFFD02D4) // (CAN_MB6) MailBox Data Low Register +#define AT91C_CAN_MB6_MFID (0xFFFD02CC) // (CAN_MB6) MailBox Family ID Register +// ========== Register definition for CAN_MB7 peripheral ========== +#define AT91C_CAN_MB7_MDH (0xFFFD02F8) // (CAN_MB7) MailBox Data High Register +#define AT91C_CAN_MB7_MSR (0xFFFD02F0) // (CAN_MB7) MailBox Status Register +#define AT91C_CAN_MB7_MID (0xFFFD02E8) // (CAN_MB7) MailBox ID Register +#define AT91C_CAN_MB7_MMR (0xFFFD02E0) // (CAN_MB7) MailBox Mode Register +#define AT91C_CAN_MB7_MCR (0xFFFD02FC) // (CAN_MB7) MailBox Control Register +#define AT91C_CAN_MB7_MDL (0xFFFD02F4) // (CAN_MB7) MailBox Data Low Register +#define AT91C_CAN_MB7_MFID (0xFFFD02EC) // (CAN_MB7) MailBox Family ID Register +#define AT91C_CAN_MB7_MAM (0xFFFD02E4) // (CAN_MB7) MailBox Acceptance Mask Register +// ========== Register definition for CAN peripheral ========== +#define AT91C_CAN_IMR (0xFFFD000C) // (CAN) Interrupt Mask Register +#define AT91C_CAN_IER (0xFFFD0004) // (CAN) Interrupt Enable Register +#define AT91C_CAN_ECR (0xFFFD0020) // (CAN) Error Counter Register +#define AT91C_CAN_TIM (0xFFFD0018) // (CAN) Timer Register +#define AT91C_CAN_SR (0xFFFD0010) // (CAN) Status Register +#define AT91C_CAN_IDR (0xFFFD0008) // (CAN) Interrupt Disable Register +#define AT91C_CAN_MR (0xFFFD0000) // (CAN) Mode Register +#define AT91C_CAN_BR (0xFFFD0014) // (CAN) Baudrate Register +#define AT91C_CAN_TIMESTP (0xFFFD001C) // (CAN) Time Stamp Register +#define AT91C_CAN_TCR (0xFFFD0024) // (CAN) Transfer Command Register +#define AT91C_CAN_ACR (0xFFFD0028) // (CAN) Abort Command Register +#define AT91C_CAN_VR (0xFFFD00FC) // (CAN) Version Register +// ========== Register definition for EMAC peripheral ========== +#define AT91C_EMAC_TID (0xFFFDC0B8) // (EMAC) Type ID Checking Register +#define AT91C_EMAC_SA3L (0xFFFDC0A8) // (EMAC) Specific Address 3 Bottom, First 4 bytes +#define AT91C_EMAC_STE (0xFFFDC084) // (EMAC) SQE Test Error Register +#define AT91C_EMAC_RSE (0xFFFDC074) // (EMAC) Receive Symbol Errors Register +#define AT91C_EMAC_IDR (0xFFFDC02C) // (EMAC) Interrupt Disable Register +#define AT91C_EMAC_TBQP (0xFFFDC01C) // (EMAC) Transmit Buffer Queue Pointer +#define AT91C_EMAC_TPQ (0xFFFDC0BC) // (EMAC) Transmit Pause Quantum Register +#define AT91C_EMAC_SA1L (0xFFFDC098) // (EMAC) Specific Address 1 Bottom, First 4 bytes +#define AT91C_EMAC_RLE (0xFFFDC088) // (EMAC) Receive Length Field Mismatch Register +#define AT91C_EMAC_IMR (0xFFFDC030) // (EMAC) Interrupt Mask Register +#define AT91C_EMAC_SA1H (0xFFFDC09C) // (EMAC) Specific Address 1 Top, Last 2 bytes +#define AT91C_EMAC_PFR (0xFFFDC03C) // (EMAC) Pause Frames received Register +#define AT91C_EMAC_FCSE (0xFFFDC050) // (EMAC) Frame Check Sequence Error Register +#define AT91C_EMAC_FTO (0xFFFDC040) // (EMAC) Frames Transmitted OK Register +#define AT91C_EMAC_TUND (0xFFFDC064) // (EMAC) Transmit Underrun Error Register +#define AT91C_EMAC_ALE (0xFFFDC054) // (EMAC) Alignment Error Register +#define AT91C_EMAC_SCF (0xFFFDC044) // (EMAC) Single Collision Frame Register +#define AT91C_EMAC_SA3H (0xFFFDC0AC) // (EMAC) Specific Address 3 Top, Last 2 bytes +#define AT91C_EMAC_ELE (0xFFFDC078) // (EMAC) Excessive Length Errors Register +#define AT91C_EMAC_CSE (0xFFFDC068) // (EMAC) Carrier Sense Error Register +#define AT91C_EMAC_DTF (0xFFFDC058) // (EMAC) Deferred Transmission Frame Register +#define AT91C_EMAC_RSR (0xFFFDC020) // (EMAC) Receive Status Register +#define AT91C_EMAC_USRIO (0xFFFDC0C0) // (EMAC) USER Input/Output Register +#define AT91C_EMAC_SA4L (0xFFFDC0B0) // (EMAC) Specific Address 4 Bottom, First 4 bytes +#define AT91C_EMAC_RRE (0xFFFDC06C) // (EMAC) Receive Ressource Error Register +#define AT91C_EMAC_RJA (0xFFFDC07C) // (EMAC) Receive Jabbers Register +#define AT91C_EMAC_TPF (0xFFFDC08C) // (EMAC) Transmitted Pause Frames Register +#define AT91C_EMAC_ISR (0xFFFDC024) // (EMAC) Interrupt Status Register +#define AT91C_EMAC_MAN (0xFFFDC034) // (EMAC) PHY Maintenance Register +#define AT91C_EMAC_WOL (0xFFFDC0C4) // (EMAC) Wake On LAN Register +#define AT91C_EMAC_USF (0xFFFDC080) // (EMAC) Undersize Frames Register +#define AT91C_EMAC_HRB (0xFFFDC090) // (EMAC) Hash Address Bottom[31:0] +#define AT91C_EMAC_PTR (0xFFFDC038) // (EMAC) Pause Time Register +#define AT91C_EMAC_HRT (0xFFFDC094) // (EMAC) Hash Address Top[63:32] +#define AT91C_EMAC_REV (0xFFFDC0FC) // (EMAC) Revision Register +#define AT91C_EMAC_MCF (0xFFFDC048) // (EMAC) Multiple Collision Frame Register +#define AT91C_EMAC_SA2L (0xFFFDC0A0) // (EMAC) Specific Address 2 Bottom, First 4 bytes +#define AT91C_EMAC_NCR (0xFFFDC000) // (EMAC) Network Control Register +#define AT91C_EMAC_FRO (0xFFFDC04C) // (EMAC) Frames Received OK Register +#define AT91C_EMAC_LCOL (0xFFFDC05C) // (EMAC) Late Collision Register +#define AT91C_EMAC_SA4H (0xFFFDC0B4) // (EMAC) Specific Address 4 Top, Last 2 bytes +#define AT91C_EMAC_NCFGR (0xFFFDC004) // (EMAC) Network Configuration Register +#define AT91C_EMAC_TSR (0xFFFDC014) // (EMAC) Transmit Status Register +#define AT91C_EMAC_SA2H (0xFFFDC0A4) // (EMAC) Specific Address 2 Top, Last 2 bytes +#define AT91C_EMAC_ECOL (0xFFFDC060) // (EMAC) Excessive Collision Register +#define AT91C_EMAC_ROV (0xFFFDC070) // (EMAC) Receive Overrun Errors Register +#define AT91C_EMAC_NSR (0xFFFDC008) // (EMAC) Network Status Register +#define AT91C_EMAC_RBQP (0xFFFDC018) // (EMAC) Receive Buffer Queue Pointer +#define AT91C_EMAC_IER (0xFFFDC028) // (EMAC) Interrupt Enable Register +// ========== Register definition for PDC_ADC peripheral ========== +#define AT91C_ADC_PTCR (0xFFFD8120) // (PDC_ADC) PDC Transfer Control Register +#define AT91C_ADC_TNPR (0xFFFD8118) // (PDC_ADC) Transmit Next Pointer Register +#define AT91C_ADC_RNPR (0xFFFD8110) // (PDC_ADC) Receive Next Pointer Register +#define AT91C_ADC_TPR (0xFFFD8108) // (PDC_ADC) Transmit Pointer Register +#define AT91C_ADC_RPR (0xFFFD8100) // (PDC_ADC) Receive Pointer Register +#define AT91C_ADC_PTSR (0xFFFD8124) // (PDC_ADC) PDC Transfer Status Register +#define AT91C_ADC_TNCR (0xFFFD811C) // (PDC_ADC) Transmit Next Counter Register +#define AT91C_ADC_RNCR (0xFFFD8114) // (PDC_ADC) Receive Next Counter Register +#define AT91C_ADC_TCR (0xFFFD810C) // (PDC_ADC) Transmit Counter Register +#define AT91C_ADC_RCR (0xFFFD8104) // (PDC_ADC) Receive Counter Register +// ========== Register definition for ADC peripheral ========== +#define AT91C_ADC_IMR (0xFFFD802C) // (ADC) ADC Interrupt Mask Register +#define AT91C_ADC_CDR4 (0xFFFD8040) // (ADC) ADC Channel Data Register 4 +#define AT91C_ADC_CDR2 (0xFFFD8038) // (ADC) ADC Channel Data Register 2 +#define AT91C_ADC_CDR0 (0xFFFD8030) // (ADC) ADC Channel Data Register 0 +#define AT91C_ADC_CDR7 (0xFFFD804C) // (ADC) ADC Channel Data Register 7 +#define AT91C_ADC_CDR1 (0xFFFD8034) // (ADC) ADC Channel Data Register 1 +#define AT91C_ADC_CDR3 (0xFFFD803C) // (ADC) ADC Channel Data Register 3 +#define AT91C_ADC_CDR5 (0xFFFD8044) // (ADC) ADC Channel Data Register 5 +#define AT91C_ADC_MR (0xFFFD8004) // (ADC) ADC Mode Register +#define AT91C_ADC_CDR6 (0xFFFD8048) // (ADC) ADC Channel Data Register 6 +#define AT91C_ADC_CR (0xFFFD8000) // (ADC) ADC Control Register +#define AT91C_ADC_CHER (0xFFFD8010) // (ADC) ADC Channel Enable Register +#define AT91C_ADC_CHSR (0xFFFD8018) // (ADC) ADC Channel Status Register +#define AT91C_ADC_IER (0xFFFD8024) // (ADC) ADC Interrupt Enable Register +#define AT91C_ADC_SR (0xFFFD801C) // (ADC) ADC Status Register +#define AT91C_ADC_CHDR (0xFFFD8014) // (ADC) ADC Channel Disable Register +#define AT91C_ADC_IDR (0xFFFD8028) // (ADC) ADC Interrupt Disable Register +#define AT91C_ADC_LCDR (0xFFFD8020) // (ADC) ADC Last Converted Data Register + +// ***************************************************************************** +// PIO DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** +#define AT91C_PIO_PA0 (1 << 0) // Pin Controlled by PA0 +#define AT91C_PA0_RXD0 (AT91C_PIO_PA0) // USART 0 Receive Data +#define AT91C_PIO_PA1 (1 << 1) // Pin Controlled by PA1 +#define AT91C_PA1_TXD0 (AT91C_PIO_PA1) // USART 0 Transmit Data +#define AT91C_PIO_PA10 (1 << 10) // Pin Controlled by PA10 +#define AT91C_PA10_TWD (AT91C_PIO_PA10) // TWI Two-wire Serial Data +#define AT91C_PIO_PA11 (1 << 11) // Pin Controlled by PA11 +#define AT91C_PA11_TWCK (AT91C_PIO_PA11) // TWI Two-wire Serial Clock +#define AT91C_PIO_PA12 (1 << 12) // Pin Controlled by PA12 +#define AT91C_PA12_SPI0_NPCS0 (AT91C_PIO_PA12) // SPI 0 Peripheral Chip Select 0 +#define AT91C_PIO_PA13 (1 << 13) // Pin Controlled by PA13 +#define AT91C_PA13_SPI0_NPCS1 (AT91C_PIO_PA13) // SPI 0 Peripheral Chip Select 1 +#define AT91C_PA13_PCK1 (AT91C_PIO_PA13) // PMC Programmable Clock Output 1 +#define AT91C_PIO_PA14 (1 << 14) // Pin Controlled by PA14 +#define AT91C_PA14_SPI0_NPCS2 (AT91C_PIO_PA14) // SPI 0 Peripheral Chip Select 2 +#define AT91C_PA14_IRQ1 (AT91C_PIO_PA14) // External Interrupt 1 +#define AT91C_PIO_PA15 (1 << 15) // Pin Controlled by PA15 +#define AT91C_PA15_SPI0_NPCS3 (AT91C_PIO_PA15) // SPI 0 Peripheral Chip Select 3 +#define AT91C_PA15_TCLK2 (AT91C_PIO_PA15) // Timer Counter 2 external clock input +#define AT91C_PIO_PA16 (1 << 16) // Pin Controlled by PA16 +#define AT91C_PA16_SPI0_MISO (AT91C_PIO_PA16) // SPI 0 Master In Slave +#define AT91C_PIO_PA17 (1 << 17) // Pin Controlled by PA17 +#define AT91C_PA17_SPI0_MOSI (AT91C_PIO_PA17) // SPI 0 Master Out Slave +#define AT91C_PIO_PA18 (1 << 18) // Pin Controlled by PA18 +#define AT91C_PA18_SPI0_SPCK (AT91C_PIO_PA18) // SPI 0 Serial Clock +#define AT91C_PIO_PA19 (1 << 19) // Pin Controlled by PA19 +#define AT91C_PA19_CANRX (AT91C_PIO_PA19) // CAN Receive +#define AT91C_PIO_PA2 (1 << 2) // Pin Controlled by PA2 +#define AT91C_PA2_SCK0 (AT91C_PIO_PA2) // USART 0 Serial Clock +#define AT91C_PA2_SPI1_NPCS1 (AT91C_PIO_PA2) // SPI 1 Peripheral Chip Select 1 +#define AT91C_PIO_PA20 (1 << 20) // Pin Controlled by PA20 +#define AT91C_PA20_CANTX (AT91C_PIO_PA20) // CAN Transmit +#define AT91C_PIO_PA21 (1 << 21) // Pin Controlled by PA21 +#define AT91C_PA21_TF (AT91C_PIO_PA21) // SSC Transmit Frame Sync +#define AT91C_PA21_SPI1_NPCS0 (AT91C_PIO_PA21) // SPI 1 Peripheral Chip Select 0 +#define AT91C_PIO_PA22 (1 << 22) // Pin Controlled by PA22 +#define AT91C_PA22_TK (AT91C_PIO_PA22) // SSC Transmit Clock +#define AT91C_PA22_SPI1_SPCK (AT91C_PIO_PA22) // SPI 1 Serial Clock +#define AT91C_PIO_PA23 (1 << 23) // Pin Controlled by PA23 +#define AT91C_PA23_TD (AT91C_PIO_PA23) // SSC Transmit data +#define AT91C_PA23_SPI1_MOSI (AT91C_PIO_PA23) // SPI 1 Master Out Slave +#define AT91C_PIO_PA24 (1 << 24) // Pin Controlled by PA24 +#define AT91C_PA24_RD (AT91C_PIO_PA24) // SSC Receive Data +#define AT91C_PA24_SPI1_MISO (AT91C_PIO_PA24) // SPI 1 Master In Slave +#define AT91C_PIO_PA25 (1 << 25) // Pin Controlled by PA25 +#define AT91C_PA25_RK (AT91C_PIO_PA25) // SSC Receive Clock +#define AT91C_PA25_SPI1_NPCS1 (AT91C_PIO_PA25) // SPI 1 Peripheral Chip Select 1 +#define AT91C_PIO_PA26 (1 << 26) // Pin Controlled by PA26 +#define AT91C_PA26_RF (AT91C_PIO_PA26) // SSC Receive Frame Sync +#define AT91C_PA26_SPI1_NPCS2 (AT91C_PIO_PA26) // SPI 1 Peripheral Chip Select 2 +#define AT91C_PIO_PA27 (1 << 27) // Pin Controlled by PA27 +#define AT91C_PA27_DRXD (AT91C_PIO_PA27) // DBGU Debug Receive Data +#define AT91C_PA27_PCK3 (AT91C_PIO_PA27) // PMC Programmable Clock Output 3 +#define AT91C_PIO_PA28 (1 << 28) // Pin Controlled by PA28 +#define AT91C_PA28_DTXD (AT91C_PIO_PA28) // DBGU Debug Transmit Data +#define AT91C_PIO_PA29 (1 << 29) // Pin Controlled by PA29 +#define AT91C_PA29_FIQ (AT91C_PIO_PA29) // AIC Fast Interrupt Input +#define AT91C_PA29_SPI1_NPCS3 (AT91C_PIO_PA29) // SPI 1 Peripheral Chip Select 3 +#define AT91C_PIO_PA3 (1 << 3) // Pin Controlled by PA3 +#define AT91C_PA3_RTS0 (AT91C_PIO_PA3) // USART 0 Ready To Send +#define AT91C_PA3_SPI1_NPCS2 (AT91C_PIO_PA3) // SPI 1 Peripheral Chip Select 2 +#define AT91C_PIO_PA30 (1 << 30) // Pin Controlled by PA30 +#define AT91C_PA30_IRQ0 (AT91C_PIO_PA30) // External Interrupt 0 +#define AT91C_PA30_PCK2 (AT91C_PIO_PA30) // PMC Programmable Clock Output 2 +#define AT91C_PIO_PA4 (1 << 4) // Pin Controlled by PA4 +#define AT91C_PA4_CTS0 (AT91C_PIO_PA4) // USART 0 Clear To Send +#define AT91C_PA4_SPI1_NPCS3 (AT91C_PIO_PA4) // SPI 1 Peripheral Chip Select 3 +#define AT91C_PIO_PA5 (1 << 5) // Pin Controlled by PA5 +#define AT91C_PA5_RXD1 (AT91C_PIO_PA5) // USART 1 Receive Data +#define AT91C_PIO_PA6 (1 << 6) // Pin Controlled by PA6 +#define AT91C_PA6_TXD1 (AT91C_PIO_PA6) // USART 1 Transmit Data +#define AT91C_PIO_PA7 (1 << 7) // Pin Controlled by PA7 +#define AT91C_PA7_SCK1 (AT91C_PIO_PA7) // USART 1 Serial Clock +#define AT91C_PA7_SPI0_NPCS1 (AT91C_PIO_PA7) // SPI 0 Peripheral Chip Select 1 +#define AT91C_PIO_PA8 (1 << 8) // Pin Controlled by PA8 +#define AT91C_PA8_RTS1 (AT91C_PIO_PA8) // USART 1 Ready To Send +#define AT91C_PA8_SPI0_NPCS2 (AT91C_PIO_PA8) // SPI 0 Peripheral Chip Select 2 +#define AT91C_PIO_PA9 (1 << 9) // Pin Controlled by PA9 +#define AT91C_PA9_CTS1 (AT91C_PIO_PA9) // USART 1 Clear To Send +#define AT91C_PA9_SPI0_NPCS3 (AT91C_PIO_PA9) // SPI 0 Peripheral Chip Select 3 +#define AT91C_PIO_PB0 (1 << 0) // Pin Controlled by PB0 +#define AT91C_PB0_ETXCK_EREFCK (AT91C_PIO_PB0) // Ethernet MAC Transmit Clock/Reference Clock +#define AT91C_PB0_PCK0 (AT91C_PIO_PB0) // PMC Programmable Clock Output 0 +#define AT91C_PIO_PB1 (1 << 1) // Pin Controlled by PB1 +#define AT91C_PB1_ETXEN (AT91C_PIO_PB1) // Ethernet MAC Transmit Enable +#define AT91C_PIO_PB10 (1 << 10) // Pin Controlled by PB10 +#define AT91C_PB10_ETX2 (AT91C_PIO_PB10) // Ethernet MAC Transmit Data 2 +#define AT91C_PB10_SPI1_NPCS1 (AT91C_PIO_PB10) // SPI 1 Peripheral Chip Select 1 +#define AT91C_PIO_PB11 (1 << 11) // Pin Controlled by PB11 +#define AT91C_PB11_ETX3 (AT91C_PIO_PB11) // Ethernet MAC Transmit Data 3 +#define AT91C_PB11_SPI1_NPCS2 (AT91C_PIO_PB11) // SPI 1 Peripheral Chip Select 2 +#define AT91C_PIO_PB12 (1 << 12) // Pin Controlled by PB12 +#define AT91C_PB12_ETXER (AT91C_PIO_PB12) // Ethernet MAC Transmikt Coding Error +#define AT91C_PB12_TCLK0 (AT91C_PIO_PB12) // Timer Counter 0 external clock input +#define AT91C_PIO_PB13 (1 << 13) // Pin Controlled by PB13 +#define AT91C_PB13_ERX2 (AT91C_PIO_PB13) // Ethernet MAC Receive Data 2 +#define AT91C_PB13_SPI0_NPCS1 (AT91C_PIO_PB13) // SPI 0 Peripheral Chip Select 1 +#define AT91C_PIO_PB14 (1 << 14) // Pin Controlled by PB14 +#define AT91C_PB14_ERX3 (AT91C_PIO_PB14) // Ethernet MAC Receive Data 3 +#define AT91C_PB14_SPI0_NPCS2 (AT91C_PIO_PB14) // SPI 0 Peripheral Chip Select 2 +#define AT91C_PIO_PB15 (1 << 15) // Pin Controlled by PB15 +#define AT91C_PB15_ERXDV_ECRSDV (AT91C_PIO_PB15) // Ethernet MAC Receive Data Valid +#define AT91C_PIO_PB16 (1 << 16) // Pin Controlled by PB16 +#define AT91C_PB16_ECOL (AT91C_PIO_PB16) // Ethernet MAC Collision Detected +#define AT91C_PB16_SPI1_NPCS3 (AT91C_PIO_PB16) // SPI 1 Peripheral Chip Select 3 +#define AT91C_PIO_PB17 (1 << 17) // Pin Controlled by PB17 +#define AT91C_PB17_ERXCK (AT91C_PIO_PB17) // Ethernet MAC Receive Clock +#define AT91C_PB17_SPI0_NPCS3 (AT91C_PIO_PB17) // SPI 0 Peripheral Chip Select 3 +#define AT91C_PIO_PB18 (1 << 18) // Pin Controlled by PB18 +#define AT91C_PB18_EF100 (AT91C_PIO_PB18) // Ethernet MAC Force 100 Mbits/sec +#define AT91C_PB18_ADTRG (AT91C_PIO_PB18) // ADC External Trigger +#define AT91C_PIO_PB19 (1 << 19) // Pin Controlled by PB19 +#define AT91C_PB19_PWM0 (AT91C_PIO_PB19) // PWM Channel 0 +#define AT91C_PB19_TCLK1 (AT91C_PIO_PB19) // Timer Counter 1 external clock input +#define AT91C_PIO_PB2 (1 << 2) // Pin Controlled by PB2 +#define AT91C_PB2_ETX0 (AT91C_PIO_PB2) // Ethernet MAC Transmit Data 0 +#define AT91C_PIO_PB20 (1 << 20) // Pin Controlled by PB20 +#define AT91C_PB20_PWM1 (AT91C_PIO_PB20) // PWM Channel 1 +#define AT91C_PB20_PCK0 (AT91C_PIO_PB20) // PMC Programmable Clock Output 0 +#define AT91C_PIO_PB21 (1 << 21) // Pin Controlled by PB21 +#define AT91C_PB21_PWM2 (AT91C_PIO_PB21) // PWM Channel 2 +#define AT91C_PB21_PCK1 (AT91C_PIO_PB21) // PMC Programmable Clock Output 1 +#define AT91C_PIO_PB22 (1 << 22) // Pin Controlled by PB22 +#define AT91C_PB22_PWM3 (AT91C_PIO_PB22) // PWM Channel 3 +#define AT91C_PB22_PCK2 (AT91C_PIO_PB22) // PMC Programmable Clock Output 2 +#define AT91C_PIO_PB23 (1 << 23) // Pin Controlled by PB23 +#define AT91C_PB23_TIOA0 (AT91C_PIO_PB23) // Timer Counter 0 Multipurpose Timer I/O Pin A +#define AT91C_PB23_DCD1 (AT91C_PIO_PB23) // USART 1 Data Carrier Detect +#define AT91C_PIO_PB24 (1 << 24) // Pin Controlled by PB24 +#define AT91C_PB24_TIOB0 (AT91C_PIO_PB24) // Timer Counter 0 Multipurpose Timer I/O Pin B +#define AT91C_PB24_DSR1 (AT91C_PIO_PB24) // USART 1 Data Set ready +#define AT91C_PIO_PB25 (1 << 25) // Pin Controlled by PB25 +#define AT91C_PB25_TIOA1 (AT91C_PIO_PB25) // Timer Counter 1 Multipurpose Timer I/O Pin A +#define AT91C_PB25_DTR1 (AT91C_PIO_PB25) // USART 1 Data Terminal ready +#define AT91C_PIO_PB26 (1 << 26) // Pin Controlled by PB26 +#define AT91C_PB26_TIOB1 (AT91C_PIO_PB26) // Timer Counter 1 Multipurpose Timer I/O Pin B +#define AT91C_PB26_RI1 (AT91C_PIO_PB26) // USART 1 Ring Indicator +#define AT91C_PIO_PB27 (1 << 27) // Pin Controlled by PB27 +#define AT91C_PB27_TIOA2 (AT91C_PIO_PB27) // Timer Counter 2 Multipurpose Timer I/O Pin A +#define AT91C_PB27_PWM0 (AT91C_PIO_PB27) // PWM Channel 0 +#define AT91C_PIO_PB28 (1 << 28) // Pin Controlled by PB28 +#define AT91C_PB28_TIOB2 (AT91C_PIO_PB28) // Timer Counter 2 Multipurpose Timer I/O Pin B +#define AT91C_PB28_PWM1 (AT91C_PIO_PB28) // PWM Channel 1 +#define AT91C_PIO_PB29 (1 << 29) // Pin Controlled by PB29 +#define AT91C_PB29_PCK1 (AT91C_PIO_PB29) // PMC Programmable Clock Output 1 +#define AT91C_PB29_PWM2 (AT91C_PIO_PB29) // PWM Channel 2 +#define AT91C_PIO_PB3 (1 << 3) // Pin Controlled by PB3 +#define AT91C_PB3_ETX1 (AT91C_PIO_PB3) // Ethernet MAC Transmit Data 1 +#define AT91C_PIO_PB30 (1 << 30) // Pin Controlled by PB30 +#define AT91C_PB30_PCK2 (AT91C_PIO_PB30) // PMC Programmable Clock Output 2 +#define AT91C_PB30_PWM3 (AT91C_PIO_PB30) // PWM Channel 3 +#define AT91C_PIO_PB4 (1 << 4) // Pin Controlled by PB4 +#define AT91C_PB4_ECRS (AT91C_PIO_PB4) // Ethernet MAC Carrier Sense/Carrier Sense and Data Valid +#define AT91C_PIO_PB5 (1 << 5) // Pin Controlled by PB5 +#define AT91C_PB5_ERX0 (AT91C_PIO_PB5) // Ethernet MAC Receive Data 0 +#define AT91C_PIO_PB6 (1 << 6) // Pin Controlled by PB6 +#define AT91C_PB6_ERX1 (AT91C_PIO_PB6) // Ethernet MAC Receive Data 1 +#define AT91C_PIO_PB7 (1 << 7) // Pin Controlled by PB7 +#define AT91C_PB7_ERXER (AT91C_PIO_PB7) // Ethernet MAC Receive Error +#define AT91C_PIO_PB8 (1 << 8) // Pin Controlled by PB8 +#define AT91C_PB8_EMDC (AT91C_PIO_PB8) // Ethernet MAC Management Data Clock +#define AT91C_PIO_PB9 (1 << 9) // Pin Controlled by PB9 +#define AT91C_PB9_EMDIO (AT91C_PIO_PB9) // Ethernet MAC Management Data Input/Output + +// ***************************************************************************** +// PERIPHERAL ID DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** +#define AT91C_ID_FIQ ( 0) // Advanced Interrupt Controller (FIQ) +#define AT91C_ID_SYS ( 1) // System Peripheral +#define AT91C_ID_PIOA ( 2) // Parallel IO Controller A +#define AT91C_ID_PIOB ( 3) // Parallel IO Controller B +#define AT91C_ID_SPI0 ( 4) // Serial Peripheral Interface 0 +#define AT91C_ID_SPI1 ( 5) // Serial Peripheral Interface 1 +#define AT91C_ID_US0 ( 6) // USART 0 +#define AT91C_ID_US1 ( 7) // USART 1 +#define AT91C_ID_SSC ( 8) // Serial Synchronous Controller +#define AT91C_ID_TWI ( 9) // Two-Wire Interface +#define AT91C_ID_PWMC (10) // PWM Controller +#define AT91C_ID_UDP (11) // USB Device Port +#define AT91C_ID_TC0 (12) // Timer Counter 0 +#define AT91C_ID_TC1 (13) // Timer Counter 1 +#define AT91C_ID_TC2 (14) // Timer Counter 2 +#define AT91C_ID_CAN (15) // Control Area Network Controller +#define AT91C_ID_EMAC (16) // Ethernet MAC +#define AT91C_ID_ADC (17) // Analog-to-Digital Converter +#define AT91C_ID_18_Reserved (18) // Reserved +#define AT91C_ID_19_Reserved (19) // Reserved +#define AT91C_ID_20_Reserved (20) // Reserved +#define AT91C_ID_21_Reserved (21) // Reserved +#define AT91C_ID_22_Reserved (22) // Reserved +#define AT91C_ID_23_Reserved (23) // Reserved +#define AT91C_ID_24_Reserved (24) // Reserved +#define AT91C_ID_25_Reserved (25) // Reserved +#define AT91C_ID_26_Reserved (26) // Reserved +#define AT91C_ID_27_Reserved (27) // Reserved +#define AT91C_ID_28_Reserved (28) // Reserved +#define AT91C_ID_29_Reserved (29) // Reserved +#define AT91C_ID_IRQ0 (30) // Advanced Interrupt Controller (IRQ0) +#define AT91C_ID_IRQ1 (31) // Advanced Interrupt Controller (IRQ1) +#define AT91C_ALL_INT (0xC003FFFF) // ALL VALID INTERRUPTS + +// ***************************************************************************** +// BASE ADDRESS DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** +#define AT91C_BASE_SYS (0xFFFFF000) // (SYS) Base Address +#define AT91C_BASE_AIC (0xFFFFF000) // (AIC) Base Address +#define AT91C_BASE_PDC_DBGU (0xFFFFF300) // (PDC_DBGU) Base Address +#define AT91C_BASE_DBGU (0xFFFFF200) // (DBGU) Base Address +#define AT91C_BASE_PIOA (0xFFFFF400) // (PIOA) Base Address +#define AT91C_BASE_PIOB (0xFFFFF600) // (PIOB) Base Address +#define AT91C_BASE_CKGR (0xFFFFFC20) // (CKGR) Base Address +#define AT91C_BASE_PMC (0xFFFFFC00) // (PMC) Base Address +#define AT91C_BASE_RSTC (0xFFFFFD00) // (RSTC) Base Address +#define AT91C_BASE_RTTC (0xFFFFFD20) // (RTTC) Base Address +#define AT91C_BASE_PITC (0xFFFFFD30) // (PITC) Base Address +#define AT91C_BASE_WDTC (0xFFFFFD40) // (WDTC) Base Address +#define AT91C_BASE_VREG (0xFFFFFD60) // (VREG) Base Address +#define AT91C_BASE_MC (0xFFFFFF00) // (MC) Base Address +#define AT91C_BASE_PDC_SPI1 (0xFFFE4100) // (PDC_SPI1) Base Address +#define AT91C_BASE_SPI1 (0xFFFE4000) // (SPI1) Base Address +#define AT91C_BASE_PDC_SPI0 (0xFFFE0100) // (PDC_SPI0) Base Address +#define AT91C_BASE_SPI0 (0xFFFE0000) // (SPI0) Base Address +#define AT91C_BASE_PDC_US1 (0xFFFC4100) // (PDC_US1) Base Address +#define AT91C_BASE_US1 (0xFFFC4000) // (US1) Base Address +#define AT91C_BASE_PDC_US0 (0xFFFC0100) // (PDC_US0) Base Address +#define AT91C_BASE_US0 (0xFFFC0000) // (US0) Base Address +#define AT91C_BASE_PDC_SSC (0xFFFD4100) // (PDC_SSC) Base Address +#define AT91C_BASE_SSC (0xFFFD4000) // (SSC) Base Address +#define AT91C_BASE_TWI (0xFFFB8000) // (TWI) Base Address +#define AT91C_BASE_PWMC_CH3 (0xFFFCC260) // (PWMC_CH3) Base Address +#define AT91C_BASE_PWMC_CH2 (0xFFFCC240) // (PWMC_CH2) Base Address +#define AT91C_BASE_PWMC_CH1 (0xFFFCC220) // (PWMC_CH1) Base Address +#define AT91C_BASE_PWMC_CH0 (0xFFFCC200) // (PWMC_CH0) Base Address +#define AT91C_BASE_PWMC (0xFFFCC000) // (PWMC) Base Address +#define AT91C_BASE_UDP (0xFFFB0000) // (UDP) Base Address +#define AT91C_BASE_TC0 (0xFFFA0000) // (TC0) Base Address +#define AT91C_BASE_TC1 (0xFFFA0040) // (TC1) Base Address +#define AT91C_BASE_TC2 (0xFFFA0080) // (TC2) Base Address +#define AT91C_BASE_TCB (0xFFFA0000) // (TCB) Base Address +#define AT91C_BASE_CAN_MB0 (0xFFFD0200) // (CAN_MB0) Base Address +#define AT91C_BASE_CAN_MB1 (0xFFFD0220) // (CAN_MB1) Base Address +#define AT91C_BASE_CAN_MB2 (0xFFFD0240) // (CAN_MB2) Base Address +#define AT91C_BASE_CAN_MB3 (0xFFFD0260) // (CAN_MB3) Base Address +#define AT91C_BASE_CAN_MB4 (0xFFFD0280) // (CAN_MB4) Base Address +#define AT91C_BASE_CAN_MB5 (0xFFFD02A0) // (CAN_MB5) Base Address +#define AT91C_BASE_CAN_MB6 (0xFFFD02C0) // (CAN_MB6) Base Address +#define AT91C_BASE_CAN_MB7 (0xFFFD02E0) // (CAN_MB7) Base Address +#define AT91C_BASE_CAN (0xFFFD0000) // (CAN) Base Address +#define AT91C_BASE_EMAC (0xFFFDC000) // (EMAC) Base Address +#define AT91C_BASE_PDC_ADC (0xFFFD8100) // (PDC_ADC) Base Address +#define AT91C_BASE_ADC (0xFFFD8000) // (ADC) Base Address + +// ***************************************************************************** +// MEMORY MAPPING DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** +// ISRAM +#define AT91C_ISRAM (0x00200000) // Internal SRAM base address +#define AT91C_ISRAM_SIZE (0x00010000) // Internal SRAM size in byte (64 Kbytes) +// IFLASH +#define AT91C_IFLASH (0x00100000) // Internal FLASH base address +#define AT91C_IFLASH_SIZE (0x00040000) // Internal FLASH size in byte (256 Kbytes) +#define AT91C_IFLASH_PAGE_SIZE (256) // Internal FLASH Page Size: 256 bytes +#define AT91C_IFLASH_LOCK_REGION_SIZE (16384) // Internal FLASH Lock Region Size: 16 Kbytes +#define AT91C_IFLASH_NB_OF_PAGES (1024) // Internal FLASH Number of Pages: 1024 bytes +#define AT91C_IFLASH_NB_OF_LOCK_BITS (16) // Internal FLASH Number of Lock Bits: 16 bytes + + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/incIAR/lib_AT91SAM7X256.h b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/incIAR/lib_AT91SAM7X256.h new file mode 100644 index 0000000..8bd8f04 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/incIAR/lib_AT91SAM7X256.h @@ -0,0 +1,4211 @@ +//* ---------------------------------------------------------------------------- +//* ATMEL Microcontroller Software Support - ROUSSET - +//* ---------------------------------------------------------------------------- +//* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +//* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +//* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +//* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +//* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +//* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +//* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +//* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +//* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +//* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +//* ---------------------------------------------------------------------------- +//* File Name : lib_AT91SAM7X256.h +//* Object : AT91SAM7X256 inlined functions +//* Generated : AT91 SW Application Group 01/16/2006 (16:36:21) +//* +//* CVS Reference : /lib_MC_SAM7X.h/1.1/Thu Mar 25 15:19:14 2004// +//* CVS Reference : /lib_pdc.h/1.2/Tue Jul 2 13:29:40 2002// +//* CVS Reference : /lib_dbgu.h/1.1/Thu Aug 25 12:56:22 2005// +//* CVS Reference : /lib_VREG_6085B.h/1.1/Tue Feb 1 16:20:47 2005// +//* CVS Reference : /lib_ssc.h/1.4/Fri Jan 31 12:19:20 2003// +//* CVS Reference : /lib_spi2.h/1.2/Tue Aug 23 15:37:28 2005// +//* CVS Reference : /lib_PWM_SAM.h/1.3/Thu Jan 22 10:10:50 2004// +//* CVS Reference : /lib_tc_1753b.h/1.1/Fri Jan 31 12:20:02 2003// +//* CVS Reference : /lib_pitc_6079A.h/1.2/Tue Nov 9 14:43:56 2004// +//* CVS Reference : /lib_adc.h/1.6/Fri Oct 17 09:12:38 2003// +//* CVS Reference : /lib_pmc_SAM7X.h/1.5/Fri Nov 4 09:41:32 2005// +//* CVS Reference : /lib_rstc_6098A.h/1.1/Wed Oct 6 10:39:20 2004// +//* CVS Reference : /lib_rttc_6081A.h/1.1/Wed Oct 6 10:39:38 2004// +//* CVS Reference : /lib_pio.h/1.3/Fri Jan 31 12:18:56 2003// +//* CVS Reference : /lib_twi.h/1.3/Mon Jul 19 14:27:58 2004// +//* CVS Reference : /lib_wdtc_6080A.h/1.1/Wed Oct 6 10:38:30 2004// +//* CVS Reference : /lib_usart.h/1.5/Thu Nov 21 16:01:54 2002// +//* CVS Reference : /lib_udp.h/1.5/Tue Aug 30 12:13:47 2005// +//* CVS Reference : /lib_aic_6075b.h/1.2/Thu Jul 7 07:48:22 2005// +//* CVS Reference : /lib_can_AT91.h/1.5/Tue Aug 23 15:37:07 2005// +//* ---------------------------------------------------------------------------- + +#ifndef lib_AT91SAM7X256_H +#define lib_AT91SAM7X256_H + +/* ***************************************************************************** + SOFTWARE API FOR AIC + ***************************************************************************** */ +#define AT91C_AIC_BRANCH_OPCODE ((void (*) ()) 0xE51FFF20) // ldr, pc, [pc, #-&F20] + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_ConfigureIt +//* \brief Interrupt Handler Initialization +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_AIC_ConfigureIt ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id, // \arg interrupt number to initialize + unsigned int priority, // \arg priority to give to the interrupt + unsigned int src_type, // \arg activation and sense of activation + void (*newHandler) () ) // \arg address of the interrupt handler +{ + unsigned int oldHandler; + unsigned int mask ; + + oldHandler = pAic->AIC_SVR[irq_id]; + + mask = 0x1 << irq_id ; + //* Disable the interrupt on the interrupt controller + pAic->AIC_IDCR = mask ; + //* Save the interrupt handler routine pointer and the interrupt priority + pAic->AIC_SVR[irq_id] = (unsigned int) newHandler ; + //* Store the Source Mode Register + pAic->AIC_SMR[irq_id] = src_type | priority ; + //* Clear the interrupt on the interrupt controller + pAic->AIC_ICCR = mask ; + + return oldHandler; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_EnableIt +//* \brief Enable corresponding IT number +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_EnableIt ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id ) // \arg interrupt number to initialize +{ + //* Enable the interrupt on the interrupt controller + pAic->AIC_IECR = 0x1 << irq_id ; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_DisableIt +//* \brief Disable corresponding IT number +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_DisableIt ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id ) // \arg interrupt number to initialize +{ + unsigned int mask = 0x1 << irq_id; + //* Disable the interrupt on the interrupt controller + pAic->AIC_IDCR = mask ; + //* Clear the interrupt on the Interrupt Controller ( if one is pending ) + pAic->AIC_ICCR = mask ; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_ClearIt +//* \brief Clear corresponding IT number +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_ClearIt ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id) // \arg interrupt number to initialize +{ + //* Clear the interrupt on the Interrupt Controller ( if one is pending ) + pAic->AIC_ICCR = (0x1 << irq_id); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_AcknowledgeIt +//* \brief Acknowledge corresponding IT number +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_AcknowledgeIt ( + AT91PS_AIC pAic) // \arg pointer to the AIC registers +{ + pAic->AIC_EOICR = pAic->AIC_EOICR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_SetExceptionVector +//* \brief Configure vector handler +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_AIC_SetExceptionVector ( + unsigned int *pVector, // \arg pointer to the AIC registers + void (*Handler) () ) // \arg Interrupt Handler +{ + unsigned int oldVector = *pVector; + + if ((unsigned int) Handler == (unsigned int) AT91C_AIC_BRANCH_OPCODE) + *pVector = (unsigned int) AT91C_AIC_BRANCH_OPCODE; + else + *pVector = (((((unsigned int) Handler) - ((unsigned int) pVector) - 0x8) >> 2) & 0x00FFFFFF) | 0xEA000000; + + return oldVector; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_Trig +//* \brief Trig an IT +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_Trig ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id) // \arg interrupt number +{ + pAic->AIC_ISCR = (0x1 << irq_id) ; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_IsActive +//* \brief Test if an IT is active +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_AIC_IsActive ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id) // \arg Interrupt Number +{ + return (pAic->AIC_ISR & (0x1 << irq_id)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_IsPending +//* \brief Test if an IT is pending +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_AIC_IsPending ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id) // \arg Interrupt Number +{ + return (pAic->AIC_IPR & (0x1 << irq_id)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_Open +//* \brief Set exception vectors and AIC registers to default values +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_Open( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + void (*IrqHandler) (), // \arg Default IRQ vector exception + void (*FiqHandler) (), // \arg Default FIQ vector exception + void (*DefaultHandler) (), // \arg Default Handler set in ISR + void (*SpuriousHandler) (), // \arg Default Spurious Handler + unsigned int protectMode) // \arg Debug Control Register +{ + int i; + + // Disable all interrupts and set IVR to the default handler + for (i = 0; i < 32; ++i) { + AT91F_AIC_DisableIt(pAic, i); + AT91F_AIC_ConfigureIt(pAic, i, AT91C_AIC_PRIOR_LOWEST, AT91C_AIC_SRCTYPE_HIGH_LEVEL, DefaultHandler); + } + + // Set the IRQ exception vector + AT91F_AIC_SetExceptionVector((unsigned int *) 0x18, IrqHandler); + // Set the Fast Interrupt exception vector + AT91F_AIC_SetExceptionVector((unsigned int *) 0x1C, FiqHandler); + + pAic->AIC_SPU = (unsigned int) SpuriousHandler; + pAic->AIC_DCR = protectMode; +} +/* ***************************************************************************** + SOFTWARE API FOR PDC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_SetNextRx +//* \brief Set the next receive transfer descriptor +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_SetNextRx ( + AT91PS_PDC pPDC, // \arg pointer to a PDC controller + char *address, // \arg address to the next bloc to be received + unsigned int bytes) // \arg number of bytes to be received +{ + pPDC->PDC_RNPR = (unsigned int) address; + pPDC->PDC_RNCR = bytes; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_SetNextTx +//* \brief Set the next transmit transfer descriptor +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_SetNextTx ( + AT91PS_PDC pPDC, // \arg pointer to a PDC controller + char *address, // \arg address to the next bloc to be transmitted + unsigned int bytes) // \arg number of bytes to be transmitted +{ + pPDC->PDC_TNPR = (unsigned int) address; + pPDC->PDC_TNCR = bytes; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_SetRx +//* \brief Set the receive transfer descriptor +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_SetRx ( + AT91PS_PDC pPDC, // \arg pointer to a PDC controller + char *address, // \arg address to the next bloc to be received + unsigned int bytes) // \arg number of bytes to be received +{ + pPDC->PDC_RPR = (unsigned int) address; + pPDC->PDC_RCR = bytes; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_SetTx +//* \brief Set the transmit transfer descriptor +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_SetTx ( + AT91PS_PDC pPDC, // \arg pointer to a PDC controller + char *address, // \arg address to the next bloc to be transmitted + unsigned int bytes) // \arg number of bytes to be transmitted +{ + pPDC->PDC_TPR = (unsigned int) address; + pPDC->PDC_TCR = bytes; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_EnableTx +//* \brief Enable transmit +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_EnableTx ( + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + pPDC->PDC_PTCR = AT91C_PDC_TXTEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_EnableRx +//* \brief Enable receive +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_EnableRx ( + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + pPDC->PDC_PTCR = AT91C_PDC_RXTEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_DisableTx +//* \brief Disable transmit +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_DisableTx ( + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + pPDC->PDC_PTCR = AT91C_PDC_TXTDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_DisableRx +//* \brief Disable receive +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_DisableRx ( + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + pPDC->PDC_PTCR = AT91C_PDC_RXTDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_IsTxEmpty +//* \brief Test if the current transfer descriptor has been sent +//*---------------------------------------------------------------------------- +__inline int AT91F_PDC_IsTxEmpty ( // \return return 1 if transfer is complete + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + return !(pPDC->PDC_TCR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_IsNextTxEmpty +//* \brief Test if the next transfer descriptor has been moved to the current td +//*---------------------------------------------------------------------------- +__inline int AT91F_PDC_IsNextTxEmpty ( // \return return 1 if transfer is complete + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + return !(pPDC->PDC_TNCR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_IsRxEmpty +//* \brief Test if the current transfer descriptor has been filled +//*---------------------------------------------------------------------------- +__inline int AT91F_PDC_IsRxEmpty ( // \return return 1 if transfer is complete + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + return !(pPDC->PDC_RCR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_IsNextRxEmpty +//* \brief Test if the next transfer descriptor has been moved to the current td +//*---------------------------------------------------------------------------- +__inline int AT91F_PDC_IsNextRxEmpty ( // \return return 1 if transfer is complete + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + return !(pPDC->PDC_RNCR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_Open +//* \brief Open PDC: disable TX and RX reset transfer descriptors, re-enable RX and TX +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_Open ( + AT91PS_PDC pPDC) // \arg pointer to a PDC controller +{ + //* Disable the RX and TX PDC transfer requests + AT91F_PDC_DisableRx(pPDC); + AT91F_PDC_DisableTx(pPDC); + + //* Reset all Counter register Next buffer first + AT91F_PDC_SetNextTx(pPDC, (char *) 0, 0); + AT91F_PDC_SetNextRx(pPDC, (char *) 0, 0); + AT91F_PDC_SetTx(pPDC, (char *) 0, 0); + AT91F_PDC_SetRx(pPDC, (char *) 0, 0); + + //* Enable the RX and TX PDC transfer requests + AT91F_PDC_EnableRx(pPDC); + AT91F_PDC_EnableTx(pPDC); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_Close +//* \brief Close PDC: disable TX and RX reset transfer descriptors +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_Close ( + AT91PS_PDC pPDC) // \arg pointer to a PDC controller +{ + //* Disable the RX and TX PDC transfer requests + AT91F_PDC_DisableRx(pPDC); + AT91F_PDC_DisableTx(pPDC); + + //* Reset all Counter register Next buffer first + AT91F_PDC_SetNextTx(pPDC, (char *) 0, 0); + AT91F_PDC_SetNextRx(pPDC, (char *) 0, 0); + AT91F_PDC_SetTx(pPDC, (char *) 0, 0); + AT91F_PDC_SetRx(pPDC, (char *) 0, 0); + +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_SendFrame +//* \brief Close PDC: disable TX and RX reset transfer descriptors +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PDC_SendFrame( + AT91PS_PDC pPDC, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + if (AT91F_PDC_IsTxEmpty(pPDC)) { + //* Buffer and next buffer can be initialized + AT91F_PDC_SetTx(pPDC, pBuffer, szBuffer); + AT91F_PDC_SetNextTx(pPDC, pNextBuffer, szNextBuffer); + return 2; + } + else if (AT91F_PDC_IsNextTxEmpty(pPDC)) { + //* Only one buffer can be initialized + AT91F_PDC_SetNextTx(pPDC, pBuffer, szBuffer); + return 1; + } + else { + //* All buffer are in use... + return 0; + } +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_ReceiveFrame +//* \brief Close PDC: disable TX and RX reset transfer descriptors +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PDC_ReceiveFrame ( + AT91PS_PDC pPDC, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + if (AT91F_PDC_IsRxEmpty(pPDC)) { + //* Buffer and next buffer can be initialized + AT91F_PDC_SetRx(pPDC, pBuffer, szBuffer); + AT91F_PDC_SetNextRx(pPDC, pNextBuffer, szNextBuffer); + return 2; + } + else if (AT91F_PDC_IsNextRxEmpty(pPDC)) { + //* Only one buffer can be initialized + AT91F_PDC_SetNextRx(pPDC, pBuffer, szBuffer); + return 1; + } + else { + //* All buffer are in use... + return 0; + } +} +/* ***************************************************************************** + SOFTWARE API FOR DBGU + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_DBGU_InterruptEnable +//* \brief Enable DBGU Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_DBGU_InterruptEnable( + AT91PS_DBGU pDbgu, // \arg pointer to a DBGU controller + unsigned int flag) // \arg dbgu interrupt to be enabled +{ + pDbgu->DBGU_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_DBGU_InterruptDisable +//* \brief Disable DBGU Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_DBGU_InterruptDisable( + AT91PS_DBGU pDbgu, // \arg pointer to a DBGU controller + unsigned int flag) // \arg dbgu interrupt to be disabled +{ + pDbgu->DBGU_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_DBGU_GetInterruptMaskStatus +//* \brief Return DBGU Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_DBGU_GetInterruptMaskStatus( // \return DBGU Interrupt Mask Status + AT91PS_DBGU pDbgu) // \arg pointer to a DBGU controller +{ + return pDbgu->DBGU_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_DBGU_IsInterruptMasked +//* \brief Test if DBGU Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_DBGU_IsInterruptMasked( + AT91PS_DBGU pDbgu, // \arg pointer to a DBGU controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_DBGU_GetInterruptMaskStatus(pDbgu) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR PIO + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgPeriph +//* \brief Enable pins to be drived by peripheral +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgPeriph( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int periphAEnable, // \arg PERIPH A to enable + unsigned int periphBEnable) // \arg PERIPH B to enable + +{ + pPio->PIO_ASR = periphAEnable; + pPio->PIO_BSR = periphBEnable; + pPio->PIO_PDR = (periphAEnable | periphBEnable); // Set in Periph mode +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgOutput +//* \brief Enable PIO in output mode +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgOutput( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int pioEnable) // \arg PIO to be enabled +{ + pPio->PIO_PER = pioEnable; // Set in PIO mode + pPio->PIO_OER = pioEnable; // Configure in Output +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgInput +//* \brief Enable PIO in input mode +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgInput( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int inputEnable) // \arg PIO to be enabled +{ + // Disable output + pPio->PIO_ODR = inputEnable; + pPio->PIO_PER = inputEnable; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgOpendrain +//* \brief Configure PIO in open drain +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgOpendrain( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int multiDrvEnable) // \arg pio to be configured in open drain +{ + // Configure the multi-drive option + pPio->PIO_MDDR = ~multiDrvEnable; + pPio->PIO_MDER = multiDrvEnable; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgPullup +//* \brief Enable pullup on PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgPullup( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int pullupEnable) // \arg enable pullup on PIO +{ + // Connect or not Pullup + pPio->PIO_PPUDR = ~pullupEnable; + pPio->PIO_PPUER = pullupEnable; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgDirectDrive +//* \brief Enable direct drive on PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgDirectDrive( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int directDrive) // \arg PIO to be configured with direct drive + +{ + // Configure the Direct Drive + pPio->PIO_OWDR = ~directDrive; + pPio->PIO_OWER = directDrive; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgInputFilter +//* \brief Enable input filter on input PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgInputFilter( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int inputFilter) // \arg PIO to be configured with input filter + +{ + // Configure the Direct Drive + pPio->PIO_IFDR = ~inputFilter; + pPio->PIO_IFER = inputFilter; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetInput +//* \brief Return PIO input value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetInput( // \return PIO input + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_PDSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsInputSet +//* \brief Test if PIO is input flag is active +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsInputSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetInput(pPio) & flag); +} + + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_SetOutput +//* \brief Set to 1 output PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_SetOutput( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg output to be set +{ + pPio->PIO_SODR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_ClearOutput +//* \brief Set to 0 output PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_ClearOutput( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg output to be cleared +{ + pPio->PIO_CODR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_ForceOutput +//* \brief Force output when Direct drive option is enabled +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_ForceOutput( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg output to be forced +{ + pPio->PIO_ODSR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_Enable +//* \brief Enable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_Enable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio to be enabled +{ + pPio->PIO_PER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_Disable +//* \brief Disable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_Disable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio to be disabled +{ + pPio->PIO_PDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetStatus +//* \brief Return PIO Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetStatus( // \return PIO Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_PSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsSet +//* \brief Test if PIO is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_OutputEnable +//* \brief Output Enable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_OutputEnable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio output to be enabled +{ + pPio->PIO_OER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_OutputDisable +//* \brief Output Enable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_OutputDisable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio output to be disabled +{ + pPio->PIO_ODR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetOutputStatus +//* \brief Return PIO Output Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetOutputStatus( // \return PIO Output Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_OSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsOuputSet +//* \brief Test if PIO Output is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsOutputSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetOutputStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_InputFilterEnable +//* \brief Input Filter Enable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_InputFilterEnable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio input filter to be enabled +{ + pPio->PIO_IFER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_InputFilterDisable +//* \brief Input Filter Disable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_InputFilterDisable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio input filter to be disabled +{ + pPio->PIO_IFDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetInputFilterStatus +//* \brief Return PIO Input Filter Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetInputFilterStatus( // \return PIO Input Filter Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_IFSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsInputFilterSet +//* \brief Test if PIO Input filter is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsInputFilterSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetInputFilterStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetOutputDataStatus +//* \brief Return PIO Output Data Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetOutputDataStatus( // \return PIO Output Data Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_ODSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_InterruptEnable +//* \brief Enable PIO Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_InterruptEnable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio interrupt to be enabled +{ + pPio->PIO_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_InterruptDisable +//* \brief Disable PIO Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_InterruptDisable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio interrupt to be disabled +{ + pPio->PIO_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetInterruptMaskStatus +//* \brief Return PIO Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetInterruptMaskStatus( // \return PIO Interrupt Mask Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetInterruptStatus +//* \brief Return PIO Interrupt Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetInterruptStatus( // \return PIO Interrupt Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_ISR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsInterruptMasked +//* \brief Test if PIO Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsInterruptMasked( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetInterruptMaskStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsInterruptSet +//* \brief Test if PIO Interrupt is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsInterruptSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetInterruptStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_MultiDriverEnable +//* \brief Multi Driver Enable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_MultiDriverEnable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio to be enabled +{ + pPio->PIO_MDER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_MultiDriverDisable +//* \brief Multi Driver Disable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_MultiDriverDisable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio to be disabled +{ + pPio->PIO_MDDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetMultiDriverStatus +//* \brief Return PIO Multi Driver Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetMultiDriverStatus( // \return PIO Multi Driver Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_MDSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsMultiDriverSet +//* \brief Test if PIO MultiDriver is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsMultiDriverSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetMultiDriverStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_A_RegisterSelection +//* \brief PIO A Register Selection +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_A_RegisterSelection( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio A register selection +{ + pPio->PIO_ASR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_B_RegisterSelection +//* \brief PIO B Register Selection +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_B_RegisterSelection( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio B register selection +{ + pPio->PIO_BSR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_Get_AB_RegisterStatus +//* \brief Return PIO Interrupt Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_Get_AB_RegisterStatus( // \return PIO AB Register Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_ABSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsAB_RegisterSet +//* \brief Test if PIO AB Register is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsAB_RegisterSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_Get_AB_RegisterStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_OutputWriteEnable +//* \brief Output Write Enable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_OutputWriteEnable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio output write to be enabled +{ + pPio->PIO_OWER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_OutputWriteDisable +//* \brief Output Write Disable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_OutputWriteDisable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio output write to be disabled +{ + pPio->PIO_OWDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetOutputWriteStatus +//* \brief Return PIO Output Write Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetOutputWriteStatus( // \return PIO Output Write Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_OWSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsOutputWriteSet +//* \brief Test if PIO OutputWrite is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsOutputWriteSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetOutputWriteStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetCfgPullup +//* \brief Return PIO Configuration Pullup +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetCfgPullup( // \return PIO Configuration Pullup + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_PPUSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsOutputDataStatusSet +//* \brief Test if PIO Output Data Status is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsOutputDataStatusSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetOutputDataStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsCfgPullupStatusSet +//* \brief Test if PIO Configuration Pullup Status is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsCfgPullupStatusSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (~AT91F_PIO_GetCfgPullup(pPio) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR PMC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_CfgSysClkEnableReg +//* \brief Configure the System Clock Enable Register of the PMC controller +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_CfgSysClkEnableReg ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int mode) +{ + //* Write to the SCER register + pPMC->PMC_SCER = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_CfgSysClkDisableReg +//* \brief Configure the System Clock Disable Register of the PMC controller +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_CfgSysClkDisableReg ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int mode) +{ + //* Write to the SCDR register + pPMC->PMC_SCDR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_GetSysClkStatusReg +//* \brief Return the System Clock Status Register of the PMC controller +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_GetSysClkStatusReg ( + AT91PS_PMC pPMC // pointer to a CAN controller + ) +{ + return pPMC->PMC_SCSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_EnablePeriphClock +//* \brief Enable peripheral clock +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_EnablePeriphClock ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int periphIds) // \arg IDs of peripherals +{ + pPMC->PMC_PCER = periphIds; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_DisablePeriphClock +//* \brief Disable peripheral clock +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_DisablePeriphClock ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int periphIds) // \arg IDs of peripherals +{ + pPMC->PMC_PCDR = periphIds; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_GetPeriphClock +//* \brief Get peripheral clock status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_GetPeriphClock ( + AT91PS_PMC pPMC) // \arg pointer to PMC controller +{ + return pPMC->PMC_PCSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_CfgMainOscillatorReg +//* \brief Cfg the main oscillator +//*---------------------------------------------------------------------------- +__inline void AT91F_CKGR_CfgMainOscillatorReg ( + AT91PS_CKGR pCKGR, // \arg pointer to CKGR controller + unsigned int mode) +{ + pCKGR->CKGR_MOR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_GetMainOscillatorReg +//* \brief Cfg the main oscillator +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CKGR_GetMainOscillatorReg ( + AT91PS_CKGR pCKGR) // \arg pointer to CKGR controller +{ + return pCKGR->CKGR_MOR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_EnableMainOscillator +//* \brief Enable the main oscillator +//*---------------------------------------------------------------------------- +__inline void AT91F_CKGR_EnableMainOscillator( + AT91PS_CKGR pCKGR) // \arg pointer to CKGR controller +{ + pCKGR->CKGR_MOR |= AT91C_CKGR_MOSCEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_DisableMainOscillator +//* \brief Disable the main oscillator +//*---------------------------------------------------------------------------- +__inline void AT91F_CKGR_DisableMainOscillator ( + AT91PS_CKGR pCKGR) // \arg pointer to CKGR controller +{ + pCKGR->CKGR_MOR &= ~AT91C_CKGR_MOSCEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_CfgMainOscStartUpTime +//* \brief Cfg MOR Register according to the main osc startup time +//*---------------------------------------------------------------------------- +__inline void AT91F_CKGR_CfgMainOscStartUpTime ( + AT91PS_CKGR pCKGR, // \arg pointer to CKGR controller + unsigned int startup_time, // \arg main osc startup time in microsecond (us) + unsigned int slowClock) // \arg slowClock in Hz +{ + pCKGR->CKGR_MOR &= ~AT91C_CKGR_OSCOUNT; + pCKGR->CKGR_MOR |= ((slowClock * startup_time)/(8*1000000)) << 8; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_GetMainClockFreqReg +//* \brief Cfg the main oscillator +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CKGR_GetMainClockFreqReg ( + AT91PS_CKGR pCKGR) // \arg pointer to CKGR controller +{ + return pCKGR->CKGR_MCFR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_GetMainClock +//* \brief Return Main clock in Hz +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CKGR_GetMainClock ( + AT91PS_CKGR pCKGR, // \arg pointer to CKGR controller + unsigned int slowClock) // \arg slowClock in Hz +{ + return ((pCKGR->CKGR_MCFR & AT91C_CKGR_MAINF) * slowClock) >> 4; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_CfgMCKReg +//* \brief Cfg Master Clock Register +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_CfgMCKReg ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int mode) +{ + pPMC->PMC_MCKR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_GetMCKReg +//* \brief Return Master Clock Register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_GetMCKReg( + AT91PS_PMC pPMC) // \arg pointer to PMC controller +{ + return pPMC->PMC_MCKR; +} + +//*------------------------------------------------------------------------------ +//* \fn AT91F_PMC_GetMasterClock +//* \brief Return master clock in Hz which correponds to processor clock for ARM7 +//*------------------------------------------------------------------------------ +__inline unsigned int AT91F_PMC_GetMasterClock ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + AT91PS_CKGR pCKGR, // \arg pointer to CKGR controller + unsigned int slowClock) // \arg slowClock in Hz +{ + unsigned int reg = pPMC->PMC_MCKR; + unsigned int prescaler = (1 << ((reg & AT91C_PMC_PRES) >> 2)); + unsigned int pllDivider, pllMultiplier; + + switch (reg & AT91C_PMC_CSS) { + case AT91C_PMC_CSS_SLOW_CLK: // Slow clock selected + return slowClock / prescaler; + case AT91C_PMC_CSS_MAIN_CLK: // Main clock is selected + return AT91F_CKGR_GetMainClock(pCKGR, slowClock) / prescaler; + case AT91C_PMC_CSS_PLL_CLK: // PLLB clock is selected + reg = pCKGR->CKGR_PLLR; + pllDivider = (reg & AT91C_CKGR_DIV); + pllMultiplier = ((reg & AT91C_CKGR_MUL) >> 16) + 1; + return AT91F_CKGR_GetMainClock(pCKGR, slowClock) / pllDivider * pllMultiplier / prescaler; + } + return 0; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_EnablePCK +//* \brief Enable Programmable Clock x Output +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_EnablePCK ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int pck, // \arg Programmable Clock x Output + unsigned int mode) +{ + pPMC->PMC_PCKR[pck] = mode; + pPMC->PMC_SCER = (1 << pck) << 8; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_DisablePCK +//* \brief Disable Programmable Clock x Output +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_DisablePCK ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int pck) // \arg Programmable Clock x Output +{ + pPMC->PMC_SCDR = (1 << pck) << 8; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_EnableIt +//* \brief Enable PMC interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_EnableIt ( + AT91PS_PMC pPMC, // pointer to a PMC controller + unsigned int flag) // IT to be enabled +{ + //* Write to the IER register + pPMC->PMC_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_DisableIt +//* \brief Disable PMC interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_DisableIt ( + AT91PS_PMC pPMC, // pointer to a PMC controller + unsigned int flag) // IT to be disabled +{ + //* Write to the IDR register + pPMC->PMC_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_GetStatus +//* \brief Return PMC Interrupt Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_GetStatus( // \return PMC Interrupt Status + AT91PS_PMC pPMC) // pointer to a PMC controller +{ + return pPMC->PMC_SR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_GetInterruptMaskStatus +//* \brief Return PMC Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_GetInterruptMaskStatus( // \return PMC Interrupt Mask Status + AT91PS_PMC pPMC) // pointer to a PMC controller +{ + return pPMC->PMC_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_IsInterruptMasked +//* \brief Test if PMC Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_IsInterruptMasked( + AT91PS_PMC pPMC, // \arg pointer to a PMC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PMC_GetInterruptMaskStatus(pPMC) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_IsStatusSet +//* \brief Test if PMC Status is Set +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_IsStatusSet( + AT91PS_PMC pPMC, // \arg pointer to a PMC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PMC_GetStatus(pPMC) & flag); +} + +// ---------------------------------------------------------------------------- +// \fn AT91F_CKGR_CfgPLLReg +// \brief Cfg the PLL Register +// ---------------------------------------------------------------------------- +__inline void AT91F_CKGR_CfgPLLReg ( + AT91PS_CKGR pCKGR, // \arg pointer to CKGR controller + unsigned int mode) +{ + pCKGR->CKGR_PLLR = mode; +} + +// ---------------------------------------------------------------------------- +// \fn AT91F_CKGR_GetPLLReg +// \brief Get the PLL Register +// ---------------------------------------------------------------------------- +__inline unsigned int AT91F_CKGR_GetPLLReg ( + AT91PS_CKGR pCKGR) // \arg pointer to CKGR controller +{ + return pCKGR->CKGR_PLLR; +} + + +/* ***************************************************************************** + SOFTWARE API FOR RSTC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_RSTSoftReset +//* \brief Start Software Reset +//*---------------------------------------------------------------------------- +__inline void AT91F_RSTSoftReset( + AT91PS_RSTC pRSTC, + unsigned int reset) +{ + pRSTC->RSTC_RCR = (0xA5000000 | reset); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_RSTSetMode +//* \brief Set Reset Mode +//*---------------------------------------------------------------------------- +__inline void AT91F_RSTSetMode( + AT91PS_RSTC pRSTC, + unsigned int mode) +{ + pRSTC->RSTC_RMR = (0xA5000000 | mode); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_RSTGetMode +//* \brief Get Reset Mode +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_RSTGetMode( + AT91PS_RSTC pRSTC) +{ + return (pRSTC->RSTC_RMR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_RSTGetStatus +//* \brief Get Reset Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_RSTGetStatus( + AT91PS_RSTC pRSTC) +{ + return (pRSTC->RSTC_RSR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_RSTIsSoftRstActive +//* \brief Return !=0 if software reset is still not completed +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_RSTIsSoftRstActive( + AT91PS_RSTC pRSTC) +{ + return ((pRSTC->RSTC_RSR) & AT91C_RSTC_SRCMP); +} +/* ***************************************************************************** + SOFTWARE API FOR RTTC + ***************************************************************************** */ +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_SetRTT_TimeBase() +//* \brief Set the RTT prescaler according to the TimeBase in ms +//*-------------------------------------------------------------------------------------- +__inline unsigned int AT91F_RTTSetTimeBase( + AT91PS_RTTC pRTTC, + unsigned int ms) +{ + if (ms > 2000) + return 1; // AT91C_TIME_OUT_OF_RANGE + pRTTC->RTTC_RTMR &= ~0xFFFF; + pRTTC->RTTC_RTMR |= (((ms << 15) /1000) & 0xFFFF); + return 0; +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTTSetPrescaler() +//* \brief Set the new prescaler value +//*-------------------------------------------------------------------------------------- +__inline unsigned int AT91F_RTTSetPrescaler( + AT91PS_RTTC pRTTC, + unsigned int rtpres) +{ + pRTTC->RTTC_RTMR &= ~0xFFFF; + pRTTC->RTTC_RTMR |= (rtpres & 0xFFFF); + return (pRTTC->RTTC_RTMR); +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTTRestart() +//* \brief Restart the RTT prescaler +//*-------------------------------------------------------------------------------------- +__inline void AT91F_RTTRestart( + AT91PS_RTTC pRTTC) +{ + pRTTC->RTTC_RTMR |= AT91C_RTTC_RTTRST; +} + + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_SetAlarmINT() +//* \brief Enable RTT Alarm Interrupt +//*-------------------------------------------------------------------------------------- +__inline void AT91F_RTTSetAlarmINT( + AT91PS_RTTC pRTTC) +{ + pRTTC->RTTC_RTMR |= AT91C_RTTC_ALMIEN; +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_ClearAlarmINT() +//* \brief Disable RTT Alarm Interrupt +//*-------------------------------------------------------------------------------------- +__inline void AT91F_RTTClearAlarmINT( + AT91PS_RTTC pRTTC) +{ + pRTTC->RTTC_RTMR &= ~AT91C_RTTC_ALMIEN; +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_SetRttIncINT() +//* \brief Enable RTT INC Interrupt +//*-------------------------------------------------------------------------------------- +__inline void AT91F_RTTSetRttIncINT( + AT91PS_RTTC pRTTC) +{ + pRTTC->RTTC_RTMR |= AT91C_RTTC_RTTINCIEN; +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_ClearRttIncINT() +//* \brief Disable RTT INC Interrupt +//*-------------------------------------------------------------------------------------- +__inline void AT91F_RTTClearRttIncINT( + AT91PS_RTTC pRTTC) +{ + pRTTC->RTTC_RTMR &= ~AT91C_RTTC_RTTINCIEN; +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_SetAlarmValue() +//* \brief Set RTT Alarm Value +//*-------------------------------------------------------------------------------------- +__inline void AT91F_RTTSetAlarmValue( + AT91PS_RTTC pRTTC, unsigned int alarm) +{ + pRTTC->RTTC_RTAR = alarm; +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_GetAlarmValue() +//* \brief Get RTT Alarm Value +//*-------------------------------------------------------------------------------------- +__inline unsigned int AT91F_RTTGetAlarmValue( + AT91PS_RTTC pRTTC) +{ + return(pRTTC->RTTC_RTAR); +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTTGetStatus() +//* \brief Read the RTT status +//*-------------------------------------------------------------------------------------- +__inline unsigned int AT91F_RTTGetStatus( + AT91PS_RTTC pRTTC) +{ + return(pRTTC->RTTC_RTSR); +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_ReadValue() +//* \brief Read the RTT value +//*-------------------------------------------------------------------------------------- +__inline unsigned int AT91F_RTTReadValue( + AT91PS_RTTC pRTTC) +{ + register volatile unsigned int val1,val2; + do + { + val1 = pRTTC->RTTC_RTVR; + val2 = pRTTC->RTTC_RTVR; + } + while(val1 != val2); + return(val1); +} +/* ***************************************************************************** + SOFTWARE API FOR PITC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITInit +//* \brief System timer init : period in µsecond, system clock freq in MHz +//*---------------------------------------------------------------------------- +__inline void AT91F_PITInit( + AT91PS_PITC pPITC, + unsigned int period, + unsigned int pit_frequency) +{ + pPITC->PITC_PIMR = period? (period * pit_frequency + 8) >> 4 : 0; // +8 to avoid %10 and /10 + pPITC->PITC_PIMR |= AT91C_PITC_PITEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITSetPIV +//* \brief Set the PIT Periodic Interval Value +//*---------------------------------------------------------------------------- +__inline void AT91F_PITSetPIV( + AT91PS_PITC pPITC, + unsigned int piv) +{ + pPITC->PITC_PIMR = piv | (pPITC->PITC_PIMR & (AT91C_PITC_PITEN | AT91C_PITC_PITIEN)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITEnableInt +//* \brief Enable PIT periodic interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PITEnableInt( + AT91PS_PITC pPITC) +{ + pPITC->PITC_PIMR |= AT91C_PITC_PITIEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITDisableInt +//* \brief Disable PIT periodic interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PITDisableInt( + AT91PS_PITC pPITC) +{ + pPITC->PITC_PIMR &= ~AT91C_PITC_PITIEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITGetMode +//* \brief Read PIT mode register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PITGetMode( + AT91PS_PITC pPITC) +{ + return(pPITC->PITC_PIMR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITGetStatus +//* \brief Read PIT status register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PITGetStatus( + AT91PS_PITC pPITC) +{ + return(pPITC->PITC_PISR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITGetPIIR +//* \brief Read PIT CPIV and PICNT without ressetting the counters +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PITGetPIIR( + AT91PS_PITC pPITC) +{ + return(pPITC->PITC_PIIR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITGetPIVR +//* \brief Read System timer CPIV and PICNT without ressetting the counters +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PITGetPIVR( + AT91PS_PITC pPITC) +{ + return(pPITC->PITC_PIVR); +} +/* ***************************************************************************** + SOFTWARE API FOR WDTC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_WDTSetMode +//* \brief Set Watchdog Mode Register +//*---------------------------------------------------------------------------- +__inline void AT91F_WDTSetMode( + AT91PS_WDTC pWDTC, + unsigned int Mode) +{ + pWDTC->WDTC_WDMR = Mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_WDTRestart +//* \brief Restart Watchdog +//*---------------------------------------------------------------------------- +__inline void AT91F_WDTRestart( + AT91PS_WDTC pWDTC) +{ + pWDTC->WDTC_WDCR = 0xA5000001; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_WDTSGettatus +//* \brief Get Watchdog Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_WDTSGettatus( + AT91PS_WDTC pWDTC) +{ + return(pWDTC->WDTC_WDSR & 0x3); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_WDTGetPeriod +//* \brief Translate ms into Watchdog Compatible value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_WDTGetPeriod(unsigned int ms) +{ + if ((ms < 4) || (ms > 16000)) + return 0; + return((ms << 8) / 1000); +} +/* ***************************************************************************** + SOFTWARE API FOR VREG + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_VREG_Enable_LowPowerMode +//* \brief Enable VREG Low Power Mode +//*---------------------------------------------------------------------------- +__inline void AT91F_VREG_Enable_LowPowerMode( + AT91PS_VREG pVREG) +{ + pVREG->VREG_MR |= AT91C_VREG_PSTDBY; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_VREG_Disable_LowPowerMode +//* \brief Disable VREG Low Power Mode +//*---------------------------------------------------------------------------- +__inline void AT91F_VREG_Disable_LowPowerMode( + AT91PS_VREG pVREG) +{ + pVREG->VREG_MR &= ~AT91C_VREG_PSTDBY; +}/* ***************************************************************************** + SOFTWARE API FOR MC + ***************************************************************************** */ + +#define AT91C_MC_CORRECT_KEY ((unsigned int) 0x5A << 24) // (MC) Correct Protect Key + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_Remap +//* \brief Make Remap +//*---------------------------------------------------------------------------- +__inline void AT91F_MC_Remap (void) // +{ + AT91PS_MC pMC = (AT91PS_MC) AT91C_BASE_MC; + + pMC->MC_RCR = AT91C_MC_RCB; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_CfgModeReg +//* \brief Configure the EFC Mode Register of the MC controller +//*---------------------------------------------------------------------------- +__inline void AT91F_MC_EFC_CfgModeReg ( + AT91PS_MC pMC, // pointer to a MC controller + unsigned int mode) // mode register +{ + // Write to the FMR register + pMC->MC_FMR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_GetModeReg +//* \brief Return MC EFC Mode Regsiter +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_MC_EFC_GetModeReg( + AT91PS_MC pMC) // pointer to a MC controller +{ + return pMC->MC_FMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_ComputeFMCN +//* \brief Return MC EFC Mode Regsiter +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_MC_EFC_ComputeFMCN( + int master_clock) // master clock in Hz +{ + return (master_clock/1000000 +2); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_PerformCmd +//* \brief Perform EFC Command +//*---------------------------------------------------------------------------- +__inline void AT91F_MC_EFC_PerformCmd ( + AT91PS_MC pMC, // pointer to a MC controller + unsigned int transfer_cmd) +{ + pMC->MC_FCR = transfer_cmd; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_GetStatus +//* \brief Return MC EFC Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_MC_EFC_GetStatus( + AT91PS_MC pMC) // pointer to a MC controller +{ + return pMC->MC_FSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_IsInterruptMasked +//* \brief Test if EFC MC Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_MC_EFC_IsInterruptMasked( + AT91PS_MC pMC, // \arg pointer to a MC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_MC_EFC_GetModeReg(pMC) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_IsInterruptSet +//* \brief Test if EFC MC Interrupt is Set +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_MC_EFC_IsInterruptSet( + AT91PS_MC pMC, // \arg pointer to a MC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_MC_EFC_GetStatus(pMC) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR SPI + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_CfgCs +//* \brief Configure SPI chip select register +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_CfgCs ( + AT91PS_SPI pSPI, // pointer to a SPI controller + int cs, // SPI cs number (0 to 3) + int val) // chip select register +{ + //* Write to the CSR register + *(pSPI->SPI_CSR + cs) = val; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_EnableIt +//* \brief Enable SPI interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_EnableIt ( + AT91PS_SPI pSPI, // pointer to a SPI controller + unsigned int flag) // IT to be enabled +{ + //* Write to the IER register + pSPI->SPI_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_DisableIt +//* \brief Disable SPI interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_DisableIt ( + AT91PS_SPI pSPI, // pointer to a SPI controller + unsigned int flag) // IT to be disabled +{ + //* Write to the IDR register + pSPI->SPI_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_Reset +//* \brief Reset the SPI controller +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_Reset ( + AT91PS_SPI pSPI // pointer to a SPI controller + ) +{ + //* Write to the CR register + pSPI->SPI_CR = AT91C_SPI_SWRST; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_Enable +//* \brief Enable the SPI controller +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_Enable ( + AT91PS_SPI pSPI // pointer to a SPI controller + ) +{ + //* Write to the CR register + pSPI->SPI_CR = AT91C_SPI_SPIEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_Disable +//* \brief Disable the SPI controller +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_Disable ( + AT91PS_SPI pSPI // pointer to a SPI controller + ) +{ + //* Write to the CR register + pSPI->SPI_CR = AT91C_SPI_SPIDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_CfgMode +//* \brief Enable the SPI controller +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_CfgMode ( + AT91PS_SPI pSPI, // pointer to a SPI controller + int mode) // mode register +{ + //* Write to the MR register + pSPI->SPI_MR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_CfgPCS +//* \brief Switch to the correct PCS of SPI Mode Register : Fixed Peripheral Selected +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_CfgPCS ( + AT91PS_SPI pSPI, // pointer to a SPI controller + char PCS_Device) // PCS of the Device +{ + //* Write to the MR register + pSPI->SPI_MR &= 0xFFF0FFFF; + pSPI->SPI_MR |= ( (PCS_Device<<16) & AT91C_SPI_PCS ); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_ReceiveFrame +//* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initializaed with Next Buffer, 0 if PDC is busy +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_SPI_ReceiveFrame ( + AT91PS_SPI pSPI, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + return AT91F_PDC_ReceiveFrame( + (AT91PS_PDC) &(pSPI->SPI_RPR), + pBuffer, + szBuffer, + pNextBuffer, + szNextBuffer); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_SendFrame +//* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initializaed with Next Buffer, 0 if PDC is bSPIy +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_SPI_SendFrame( + AT91PS_SPI pSPI, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + return AT91F_PDC_SendFrame( + (AT91PS_PDC) &(pSPI->SPI_RPR), + pBuffer, + szBuffer, + pNextBuffer, + szNextBuffer); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_Close +//* \brief Close SPI: disable IT disable transfert, close PDC +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_Close ( + AT91PS_SPI pSPI) // \arg pointer to a SPI controller +{ + //* Reset all the Chip Select register + pSPI->SPI_CSR[0] = 0 ; + pSPI->SPI_CSR[1] = 0 ; + pSPI->SPI_CSR[2] = 0 ; + pSPI->SPI_CSR[3] = 0 ; + + //* Reset the SPI mode + pSPI->SPI_MR = 0 ; + + //* Disable all interrupts + pSPI->SPI_IDR = 0xFFFFFFFF ; + + //* Abort the Peripheral Data Transfers + AT91F_PDC_Close((AT91PS_PDC) &(pSPI->SPI_RPR)); + + //* Disable receiver and transmitter and stop any activity immediately + pSPI->SPI_CR = AT91C_SPI_SPIDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_PutChar +//* \brief Send a character,does not check if ready to send +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_PutChar ( + AT91PS_SPI pSPI, + unsigned int character, + unsigned int cs_number ) +{ + unsigned int value_for_cs; + value_for_cs = (~(1 << cs_number)) & 0xF; //Place a zero among a 4 ONEs number + pSPI->SPI_TDR = (character & 0xFFFF) | (value_for_cs << 16); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_GetChar +//* \brief Receive a character,does not check if a character is available +//*---------------------------------------------------------------------------- +__inline int AT91F_SPI_GetChar ( + const AT91PS_SPI pSPI) +{ + return((pSPI->SPI_RDR) & 0xFFFF); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_GetInterruptMaskStatus +//* \brief Return SPI Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_SPI_GetInterruptMaskStatus( // \return SPI Interrupt Mask Status + AT91PS_SPI pSpi) // \arg pointer to a SPI controller +{ + return pSpi->SPI_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_IsInterruptMasked +//* \brief Test if SPI Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_SPI_IsInterruptMasked( + AT91PS_SPI pSpi, // \arg pointer to a SPI controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_SPI_GetInterruptMaskStatus(pSpi) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR USART + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_Baudrate +//* \brief Calculate the baudrate +//* Standard Asynchronous Mode : 8 bits , 1 stop , no parity +#define AT91C_US_ASYNC_MODE ( AT91C_US_USMODE_NORMAL + \ + AT91C_US_NBSTOP_1_BIT + \ + AT91C_US_PAR_NONE + \ + AT91C_US_CHRL_8_BITS + \ + AT91C_US_CLKS_CLOCK ) + +//* Standard External Asynchronous Mode : 8 bits , 1 stop , no parity +#define AT91C_US_ASYNC_SCK_MODE ( AT91C_US_USMODE_NORMAL + \ + AT91C_US_NBSTOP_1_BIT + \ + AT91C_US_PAR_NONE + \ + AT91C_US_CHRL_8_BITS + \ + AT91C_US_CLKS_EXT ) + +//* Standard Synchronous Mode : 8 bits , 1 stop , no parity +#define AT91C_US_SYNC_MODE ( AT91C_US_SYNC + \ + AT91C_US_USMODE_NORMAL + \ + AT91C_US_NBSTOP_1_BIT + \ + AT91C_US_PAR_NONE + \ + AT91C_US_CHRL_8_BITS + \ + AT91C_US_CLKS_CLOCK ) + +//* SCK used Label +#define AT91C_US_SCK_USED (AT91C_US_CKLO | AT91C_US_CLKS_EXT) + +//* Standard ISO T=0 Mode : 8 bits , 1 stop , parity +#define AT91C_US_ISO_READER_MODE ( AT91C_US_USMODE_ISO7816_0 + \ + AT91C_US_CLKS_CLOCK +\ + AT91C_US_NBSTOP_1_BIT + \ + AT91C_US_PAR_EVEN + \ + AT91C_US_CHRL_8_BITS + \ + AT91C_US_CKLO +\ + AT91C_US_OVER) + +//* Standard IRDA mode +#define AT91C_US_ASYNC_IRDA_MODE ( AT91C_US_USMODE_IRDA + \ + AT91C_US_NBSTOP_1_BIT + \ + AT91C_US_PAR_NONE + \ + AT91C_US_CHRL_8_BITS + \ + AT91C_US_CLKS_CLOCK ) + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_Baudrate +//* \brief Caluculate baud_value according to the main clock and the baud rate +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_US_Baudrate ( + const unsigned int main_clock, // \arg peripheral clock + const unsigned int baud_rate) // \arg UART baudrate +{ + unsigned int baud_value = ((main_clock*10)/(baud_rate * 16)); + if ((baud_value % 10) >= 5) + baud_value = (baud_value / 10) + 1; + else + baud_value /= 10; + return baud_value; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_SetBaudrate +//* \brief Set the baudrate according to the CPU clock +//*---------------------------------------------------------------------------- +__inline void AT91F_US_SetBaudrate ( + AT91PS_USART pUSART, // \arg pointer to a USART controller + unsigned int mainClock, // \arg peripheral clock + unsigned int speed) // \arg UART baudrate +{ + //* Define the baud rate divisor register + pUSART->US_BRGR = AT91F_US_Baudrate(mainClock, speed); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_SetTimeguard +//* \brief Set USART timeguard +//*---------------------------------------------------------------------------- +__inline void AT91F_US_SetTimeguard ( + AT91PS_USART pUSART, // \arg pointer to a USART controller + unsigned int timeguard) // \arg timeguard value +{ + //* Write the Timeguard Register + pUSART->US_TTGR = timeguard ; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_EnableIt +//* \brief Enable USART IT +//*---------------------------------------------------------------------------- +__inline void AT91F_US_EnableIt ( + AT91PS_USART pUSART, // \arg pointer to a USART controller + unsigned int flag) // \arg IT to be enabled +{ + //* Write to the IER register + pUSART->US_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_DisableIt +//* \brief Disable USART IT +//*---------------------------------------------------------------------------- +__inline void AT91F_US_DisableIt ( + AT91PS_USART pUSART, // \arg pointer to a USART controller + unsigned int flag) // \arg IT to be disabled +{ + //* Write to the IER register + pUSART->US_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_Configure +//* \brief Configure USART +//*---------------------------------------------------------------------------- +__inline void AT91F_US_Configure ( + AT91PS_USART pUSART, // \arg pointer to a USART controller + unsigned int mainClock, // \arg peripheral clock + unsigned int mode , // \arg mode Register to be programmed + unsigned int baudRate , // \arg baudrate to be programmed + unsigned int timeguard ) // \arg timeguard to be programmed +{ + //* Disable interrupts + pUSART->US_IDR = (unsigned int) -1; + + //* Reset receiver and transmitter + pUSART->US_CR = AT91C_US_RSTRX | AT91C_US_RSTTX | AT91C_US_RXDIS | AT91C_US_TXDIS ; + + //* Define the baud rate divisor register + AT91F_US_SetBaudrate(pUSART, mainClock, baudRate); + + //* Write the Timeguard Register + AT91F_US_SetTimeguard(pUSART, timeguard); + + //* Clear Transmit and Receive Counters + AT91F_PDC_Open((AT91PS_PDC) &(pUSART->US_RPR)); + + //* Define the USART mode + pUSART->US_MR = mode ; + +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_EnableRx +//* \brief Enable receiving characters +//*---------------------------------------------------------------------------- +__inline void AT91F_US_EnableRx ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Enable receiver + pUSART->US_CR = AT91C_US_RXEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_EnableTx +//* \brief Enable sending characters +//*---------------------------------------------------------------------------- +__inline void AT91F_US_EnableTx ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Enable transmitter + pUSART->US_CR = AT91C_US_TXEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_ResetRx +//* \brief Reset Receiver and re-enable it +//*---------------------------------------------------------------------------- +__inline void AT91F_US_ResetRx ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Reset receiver + pUSART->US_CR = AT91C_US_RSTRX; + //* Re-Enable receiver + pUSART->US_CR = AT91C_US_RXEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_ResetTx +//* \brief Reset Transmitter and re-enable it +//*---------------------------------------------------------------------------- +__inline void AT91F_US_ResetTx ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Reset transmitter + pUSART->US_CR = AT91C_US_RSTTX; + //* Enable transmitter + pUSART->US_CR = AT91C_US_TXEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_DisableRx +//* \brief Disable Receiver +//*---------------------------------------------------------------------------- +__inline void AT91F_US_DisableRx ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Disable receiver + pUSART->US_CR = AT91C_US_RXDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_DisableTx +//* \brief Disable Transmitter +//*---------------------------------------------------------------------------- +__inline void AT91F_US_DisableTx ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Disable transmitter + pUSART->US_CR = AT91C_US_TXDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_Close +//* \brief Close USART: disable IT disable receiver and transmitter, close PDC +//*---------------------------------------------------------------------------- +__inline void AT91F_US_Close ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Reset the baud rate divisor register + pUSART->US_BRGR = 0 ; + + //* Reset the USART mode + pUSART->US_MR = 0 ; + + //* Reset the Timeguard Register + pUSART->US_TTGR = 0; + + //* Disable all interrupts + pUSART->US_IDR = 0xFFFFFFFF ; + + //* Abort the Peripheral Data Transfers + AT91F_PDC_Close((AT91PS_PDC) &(pUSART->US_RPR)); + + //* Disable receiver and transmitter and stop any activity immediately + pUSART->US_CR = AT91C_US_TXDIS | AT91C_US_RXDIS | AT91C_US_RSTTX | AT91C_US_RSTRX ; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_TxReady +//* \brief Return 1 if a character can be written in US_THR +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_US_TxReady ( + AT91PS_USART pUSART ) // \arg pointer to a USART controller +{ + return (pUSART->US_CSR & AT91C_US_TXRDY); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_RxReady +//* \brief Return 1 if a character can be read in US_RHR +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_US_RxReady ( + AT91PS_USART pUSART ) // \arg pointer to a USART controller +{ + return (pUSART->US_CSR & AT91C_US_RXRDY); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_Error +//* \brief Return the error flag +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_US_Error ( + AT91PS_USART pUSART ) // \arg pointer to a USART controller +{ + return (pUSART->US_CSR & + (AT91C_US_OVRE | // Overrun error + AT91C_US_FRAME | // Framing error + AT91C_US_PARE)); // Parity error +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_PutChar +//* \brief Send a character,does not check if ready to send +//*---------------------------------------------------------------------------- +__inline void AT91F_US_PutChar ( + AT91PS_USART pUSART, + int character ) +{ + pUSART->US_THR = (character & 0x1FF); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_GetChar +//* \brief Receive a character,does not check if a character is available +//*---------------------------------------------------------------------------- +__inline int AT91F_US_GetChar ( + const AT91PS_USART pUSART) +{ + return((pUSART->US_RHR) & 0x1FF); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_SendFrame +//* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initializaed with Next Buffer, 0 if PDC is busy +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_US_SendFrame( + AT91PS_USART pUSART, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + return AT91F_PDC_SendFrame( + (AT91PS_PDC) &(pUSART->US_RPR), + pBuffer, + szBuffer, + pNextBuffer, + szNextBuffer); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_ReceiveFrame +//* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initializaed with Next Buffer, 0 if PDC is busy +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_US_ReceiveFrame ( + AT91PS_USART pUSART, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + return AT91F_PDC_ReceiveFrame( + (AT91PS_PDC) &(pUSART->US_RPR), + pBuffer, + szBuffer, + pNextBuffer, + szNextBuffer); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_SetIrdaFilter +//* \brief Set the value of IrDa filter tregister +//*---------------------------------------------------------------------------- +__inline void AT91F_US_SetIrdaFilter ( + AT91PS_USART pUSART, + unsigned char value +) +{ + pUSART->US_IF = value; +} + +/* ***************************************************************************** + SOFTWARE API FOR SSC + ***************************************************************************** */ +//* Define the standard I2S mode configuration + +//* Configuration to set in the SSC Transmit Clock Mode Register +//* Parameters : nb_bit_by_slot : 8, 16 or 32 bits +//* nb_slot_by_frame : number of channels +#define AT91C_I2S_ASY_MASTER_TX_SETTING(nb_bit_by_slot, nb_slot_by_frame)( +\ + AT91C_SSC_CKS_DIV +\ + AT91C_SSC_CKO_CONTINOUS +\ + AT91C_SSC_CKG_NONE +\ + AT91C_SSC_START_FALL_RF +\ + AT91C_SSC_STTOUT +\ + ((1<<16) & AT91C_SSC_STTDLY) +\ + ((((nb_bit_by_slot*nb_slot_by_frame)/2)-1) <<24)) + + +//* Configuration to set in the SSC Transmit Frame Mode Register +//* Parameters : nb_bit_by_slot : 8, 16 or 32 bits +//* nb_slot_by_frame : number of channels +#define AT91C_I2S_ASY_TX_FRAME_SETTING(nb_bit_by_slot, nb_slot_by_frame)( +\ + (nb_bit_by_slot-1) +\ + AT91C_SSC_MSBF +\ + (((nb_slot_by_frame-1)<<8) & AT91C_SSC_DATNB) +\ + (((nb_bit_by_slot-1)<<16) & AT91C_SSC_FSLEN) +\ + AT91C_SSC_FSOS_NEGATIVE) + + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_SetBaudrate +//* \brief Set the baudrate according to the CPU clock +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_SetBaudrate ( + AT91PS_SSC pSSC, // \arg pointer to a SSC controller + unsigned int mainClock, // \arg peripheral clock + unsigned int speed) // \arg SSC baudrate +{ + unsigned int baud_value; + //* Define the baud rate divisor register + if (speed == 0) + baud_value = 0; + else + { + baud_value = (unsigned int) (mainClock * 10)/(2*speed); + if ((baud_value % 10) >= 5) + baud_value = (baud_value / 10) + 1; + else + baud_value /= 10; + } + + pSSC->SSC_CMR = baud_value; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_Configure +//* \brief Configure SSC +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_Configure ( + AT91PS_SSC pSSC, // \arg pointer to a SSC controller + unsigned int syst_clock, // \arg System Clock Frequency + unsigned int baud_rate, // \arg Expected Baud Rate Frequency + unsigned int clock_rx, // \arg Receiver Clock Parameters + unsigned int mode_rx, // \arg mode Register to be programmed + unsigned int clock_tx, // \arg Transmitter Clock Parameters + unsigned int mode_tx) // \arg mode Register to be programmed +{ + //* Disable interrupts + pSSC->SSC_IDR = (unsigned int) -1; + + //* Reset receiver and transmitter + pSSC->SSC_CR = AT91C_SSC_SWRST | AT91C_SSC_RXDIS | AT91C_SSC_TXDIS ; + + //* Define the Clock Mode Register + AT91F_SSC_SetBaudrate(pSSC, syst_clock, baud_rate); + + //* Write the Receive Clock Mode Register + pSSC->SSC_RCMR = clock_rx; + + //* Write the Transmit Clock Mode Register + pSSC->SSC_TCMR = clock_tx; + + //* Write the Receive Frame Mode Register + pSSC->SSC_RFMR = mode_rx; + + //* Write the Transmit Frame Mode Register + pSSC->SSC_TFMR = mode_tx; + + //* Clear Transmit and Receive Counters + AT91F_PDC_Open((AT91PS_PDC) &(pSSC->SSC_RPR)); + + +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_EnableRx +//* \brief Enable receiving datas +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_EnableRx ( + AT91PS_SSC pSSC) // \arg pointer to a SSC controller +{ + //* Enable receiver + pSSC->SSC_CR = AT91C_SSC_RXEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_DisableRx +//* \brief Disable receiving datas +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_DisableRx ( + AT91PS_SSC pSSC) // \arg pointer to a SSC controller +{ + //* Disable receiver + pSSC->SSC_CR = AT91C_SSC_RXDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_EnableTx +//* \brief Enable sending datas +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_EnableTx ( + AT91PS_SSC pSSC) // \arg pointer to a SSC controller +{ + //* Enable transmitter + pSSC->SSC_CR = AT91C_SSC_TXEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_DisableTx +//* \brief Disable sending datas +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_DisableTx ( + AT91PS_SSC pSSC) // \arg pointer to a SSC controller +{ + //* Disable transmitter + pSSC->SSC_CR = AT91C_SSC_TXDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_EnableIt +//* \brief Enable SSC IT +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_EnableIt ( + AT91PS_SSC pSSC, // \arg pointer to a SSC controller + unsigned int flag) // \arg IT to be enabled +{ + //* Write to the IER register + pSSC->SSC_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_DisableIt +//* \brief Disable SSC IT +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_DisableIt ( + AT91PS_SSC pSSC, // \arg pointer to a SSC controller + unsigned int flag) // \arg IT to be disabled +{ + //* Write to the IDR register + pSSC->SSC_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_ReceiveFrame +//* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initialized with Next Buffer, 0 if PDC is busy +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_SSC_ReceiveFrame ( + AT91PS_SSC pSSC, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + return AT91F_PDC_ReceiveFrame( + (AT91PS_PDC) &(pSSC->SSC_RPR), + pBuffer, + szBuffer, + pNextBuffer, + szNextBuffer); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_SendFrame +//* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initialized with Next Buffer, 0 if PDC is busy +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_SSC_SendFrame( + AT91PS_SSC pSSC, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + return AT91F_PDC_SendFrame( + (AT91PS_PDC) &(pSSC->SSC_RPR), + pBuffer, + szBuffer, + pNextBuffer, + szNextBuffer); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_GetInterruptMaskStatus +//* \brief Return SSC Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_SSC_GetInterruptMaskStatus( // \return SSC Interrupt Mask Status + AT91PS_SSC pSsc) // \arg pointer to a SSC controller +{ + return pSsc->SSC_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_IsInterruptMasked +//* \brief Test if SSC Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_SSC_IsInterruptMasked( + AT91PS_SSC pSsc, // \arg pointer to a SSC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_SSC_GetInterruptMaskStatus(pSsc) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR TWI + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_EnableIt +//* \brief Enable TWI IT +//*---------------------------------------------------------------------------- +__inline void AT91F_TWI_EnableIt ( + AT91PS_TWI pTWI, // \arg pointer to a TWI controller + unsigned int flag) // \arg IT to be enabled +{ + //* Write to the IER register + pTWI->TWI_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_DisableIt +//* \brief Disable TWI IT +//*---------------------------------------------------------------------------- +__inline void AT91F_TWI_DisableIt ( + AT91PS_TWI pTWI, // \arg pointer to a TWI controller + unsigned int flag) // \arg IT to be disabled +{ + //* Write to the IDR register + pTWI->TWI_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_Configure +//* \brief Configure TWI in master mode +//*---------------------------------------------------------------------------- +__inline void AT91F_TWI_Configure ( AT91PS_TWI pTWI ) // \arg pointer to a TWI controller +{ + //* Disable interrupts + pTWI->TWI_IDR = (unsigned int) -1; + + //* Reset peripheral + pTWI->TWI_CR = AT91C_TWI_SWRST; + + //* Set Master mode + pTWI->TWI_CR = AT91C_TWI_MSEN; + +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_GetInterruptMaskStatus +//* \brief Return TWI Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_TWI_GetInterruptMaskStatus( // \return TWI Interrupt Mask Status + AT91PS_TWI pTwi) // \arg pointer to a TWI controller +{ + return pTwi->TWI_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_IsInterruptMasked +//* \brief Test if TWI Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_TWI_IsInterruptMasked( + AT91PS_TWI pTwi, // \arg pointer to a TWI controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_TWI_GetInterruptMaskStatus(pTwi) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR PWMC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_GetStatus +//* \brief Return PWM Interrupt Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PWMC_GetStatus( // \return PWM Interrupt Status + AT91PS_PWMC pPWM) // pointer to a PWM controller +{ + return pPWM->PWMC_SR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_InterruptEnable +//* \brief Enable PWM Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_InterruptEnable( + AT91PS_PWMC pPwm, // \arg pointer to a PWM controller + unsigned int flag) // \arg PWM interrupt to be enabled +{ + pPwm->PWMC_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_InterruptDisable +//* \brief Disable PWM Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_InterruptDisable( + AT91PS_PWMC pPwm, // \arg pointer to a PWM controller + unsigned int flag) // \arg PWM interrupt to be disabled +{ + pPwm->PWMC_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_GetInterruptMaskStatus +//* \brief Return PWM Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PWMC_GetInterruptMaskStatus( // \return PWM Interrupt Mask Status + AT91PS_PWMC pPwm) // \arg pointer to a PWM controller +{ + return pPwm->PWMC_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_IsInterruptMasked +//* \brief Test if PWM Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PWMC_IsInterruptMasked( + AT91PS_PWMC pPWM, // \arg pointer to a PWM controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PWMC_GetInterruptMaskStatus(pPWM) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_IsStatusSet +//* \brief Test if PWM Interrupt is Set +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PWMC_IsStatusSet( + AT91PS_PWMC pPWM, // \arg pointer to a PWM controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PWMC_GetStatus(pPWM) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_CfgChannel +//* \brief Test if PWM Interrupt is Set +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_CfgChannel( + AT91PS_PWMC pPWM, // \arg pointer to a PWM controller + unsigned int channelId, // \arg PWM channel ID + unsigned int mode, // \arg PWM mode + unsigned int period, // \arg PWM period + unsigned int duty) // \arg PWM duty cycle +{ + pPWM->PWMC_CH[channelId].PWMC_CMR = mode; + pPWM->PWMC_CH[channelId].PWMC_CDTYR = duty; + pPWM->PWMC_CH[channelId].PWMC_CPRDR = period; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_StartChannel +//* \brief Enable channel +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_StartChannel( + AT91PS_PWMC pPWM, // \arg pointer to a PWM controller + unsigned int flag) // \arg Channels IDs to be enabled +{ + pPWM->PWMC_ENA = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_StopChannel +//* \brief Disable channel +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_StopChannel( + AT91PS_PWMC pPWM, // \arg pointer to a PWM controller + unsigned int flag) // \arg Channels IDs to be enabled +{ + pPWM->PWMC_DIS = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_UpdateChannel +//* \brief Update Period or Duty Cycle +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_UpdateChannel( + AT91PS_PWMC pPWM, // \arg pointer to a PWM controller + unsigned int channelId, // \arg PWM channel ID + unsigned int update) // \arg Channels IDs to be enabled +{ + pPWM->PWMC_CH[channelId].PWMC_CUPDR = update; +} + +/* ***************************************************************************** + SOFTWARE API FOR UDP + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EnableIt +//* \brief Enable UDP IT +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EnableIt ( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned int flag) // \arg IT to be enabled +{ + //* Write to the IER register + pUDP->UDP_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_DisableIt +//* \brief Disable UDP IT +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_DisableIt ( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned int flag) // \arg IT to be disabled +{ + //* Write to the IDR register + pUDP->UDP_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_SetAddress +//* \brief Set UDP functional address +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_SetAddress ( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char address) // \arg new UDP address +{ + pUDP->UDP_FADDR = (AT91C_UDP_FEN | address); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EnableEp +//* \brief Enable Endpoint +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EnableEp ( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint) // \arg endpoint number +{ + pUDP->UDP_CSR[endpoint] |= AT91C_UDP_EPEDS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_DisableEp +//* \brief Enable Endpoint +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_DisableEp ( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint) // \arg endpoint number +{ + pUDP->UDP_CSR[endpoint] &= ~AT91C_UDP_EPEDS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_SetState +//* \brief Set UDP Device state +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_SetState ( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned int flag) // \arg new UDP address +{ + pUDP->UDP_GLBSTATE &= ~(AT91C_UDP_FADDEN | AT91C_UDP_CONFG); + pUDP->UDP_GLBSTATE |= flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_GetState +//* \brief return UDP Device state +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_UDP_GetState ( // \return the UDP device state + AT91PS_UDP pUDP) // \arg pointer to a UDP controller +{ + return (pUDP->UDP_GLBSTATE & (AT91C_UDP_FADDEN | AT91C_UDP_CONFG)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_ResetEp +//* \brief Reset UDP endpoint +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_ResetEp ( // \return the UDP device state + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned int flag) // \arg Endpoints to be reset +{ + pUDP->UDP_RSTEP = flag; + pUDP->UDP_RSTEP = 0; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpStall +//* \brief Endpoint will STALL requests +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EpStall( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint) // \arg endpoint number +{ + pUDP->UDP_CSR[endpoint] |= AT91C_UDP_FORCESTALL; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpWrite +//* \brief Write value in the DPR +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EpWrite( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint, // \arg endpoint number + unsigned char value) // \arg value to be written in the DPR +{ + pUDP->UDP_FDR[endpoint] = value; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpRead +//* \brief Return value from the DPR +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_UDP_EpRead( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint) // \arg endpoint number +{ + return pUDP->UDP_FDR[endpoint]; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpEndOfWr +//* \brief Notify the UDP that values in DPR are ready to be sent +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EpEndOfWr( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint) // \arg endpoint number +{ + pUDP->UDP_CSR[endpoint] |= AT91C_UDP_TXPKTRDY; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpClear +//* \brief Clear flag in the endpoint CSR register +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EpClear( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint, // \arg endpoint number + unsigned int flag) // \arg flag to be cleared +{ + pUDP->UDP_CSR[endpoint] &= ~(flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpSet +//* \brief Set flag in the endpoint CSR register +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EpSet( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint, // \arg endpoint number + unsigned int flag) // \arg flag to be cleared +{ + pUDP->UDP_CSR[endpoint] |= flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpStatus +//* \brief Return the endpoint CSR register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_UDP_EpStatus( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint) // \arg endpoint number +{ + return pUDP->UDP_CSR[endpoint]; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_GetInterruptMaskStatus +//* \brief Return UDP Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_UDP_GetInterruptMaskStatus( + AT91PS_UDP pUdp) // \arg pointer to a UDP controller +{ + return pUdp->UDP_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_IsInterruptMasked +//* \brief Test if UDP Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_UDP_IsInterruptMasked( + AT91PS_UDP pUdp, // \arg pointer to a UDP controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_UDP_GetInterruptMaskStatus(pUdp) & flag); +} + +// ---------------------------------------------------------------------------- +// \fn AT91F_UDP_InterruptStatusRegister +// \brief Return the Interrupt Status Register +// ---------------------------------------------------------------------------- +__inline unsigned int AT91F_UDP_InterruptStatusRegister( + AT91PS_UDP pUDP ) // \arg pointer to a UDP controller +{ + return pUDP->UDP_ISR; +} + +// ---------------------------------------------------------------------------- +// \fn AT91F_UDP_InterruptClearRegister +// \brief Clear Interrupt Register +// ---------------------------------------------------------------------------- +__inline void AT91F_UDP_InterruptClearRegister ( + AT91PS_UDP pUDP, // \arg pointer to UDP controller + unsigned int flag) // \arg IT to be cleat +{ + pUDP->UDP_ICR = flag; +} + +// ---------------------------------------------------------------------------- +// \fn AT91F_UDP_EnableTransceiver +// \brief Enable transceiver +// ---------------------------------------------------------------------------- +__inline void AT91F_UDP_EnableTransceiver( + AT91PS_UDP pUDP ) // \arg pointer to a UDP controller +{ + pUDP->UDP_TXVC &= ~AT91C_UDP_TXVDIS; +} + +// ---------------------------------------------------------------------------- +// \fn AT91F_UDP_DisableTransceiver +// \brief Disable transceiver +// ---------------------------------------------------------------------------- +__inline void AT91F_UDP_DisableTransceiver( + AT91PS_UDP pUDP ) // \arg pointer to a UDP controller +{ + pUDP->UDP_TXVC = AT91C_UDP_TXVDIS; +} + +/* ***************************************************************************** + SOFTWARE API FOR TC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC_InterruptEnable +//* \brief Enable TC Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_TC_InterruptEnable( + AT91PS_TC pTc, // \arg pointer to a TC controller + unsigned int flag) // \arg TC interrupt to be enabled +{ + pTc->TC_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC_InterruptDisable +//* \brief Disable TC Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_TC_InterruptDisable( + AT91PS_TC pTc, // \arg pointer to a TC controller + unsigned int flag) // \arg TC interrupt to be disabled +{ + pTc->TC_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC_GetInterruptMaskStatus +//* \brief Return TC Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_TC_GetInterruptMaskStatus( // \return TC Interrupt Mask Status + AT91PS_TC pTc) // \arg pointer to a TC controller +{ + return pTc->TC_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC_IsInterruptMasked +//* \brief Test if TC Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_TC_IsInterruptMasked( + AT91PS_TC pTc, // \arg pointer to a TC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_TC_GetInterruptMaskStatus(pTc) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR CAN + ***************************************************************************** */ +#define STANDARD_FORMAT 0 +#define EXTENDED_FORMAT 1 + +//*---------------------------------------------------------------------------- +//* \fn AT91F_InitMailboxRegisters() +//* \brief Configure the corresponding mailbox +//*---------------------------------------------------------------------------- +__inline void AT91F_InitMailboxRegisters(AT91PS_CAN_MB CAN_Mailbox, + int mode_reg, + int acceptance_mask_reg, + int id_reg, + int data_low_reg, + int data_high_reg, + int control_reg) +{ + CAN_Mailbox->CAN_MB_MCR = 0x0; + CAN_Mailbox->CAN_MB_MMR = mode_reg; + CAN_Mailbox->CAN_MB_MAM = acceptance_mask_reg; + CAN_Mailbox->CAN_MB_MID = id_reg; + CAN_Mailbox->CAN_MB_MDL = data_low_reg; + CAN_Mailbox->CAN_MB_MDH = data_high_reg; + CAN_Mailbox->CAN_MB_MCR = control_reg; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_EnableCAN() +//* \brief +//*---------------------------------------------------------------------------- +__inline void AT91F_EnableCAN( + AT91PS_CAN pCAN) // pointer to a CAN controller +{ + pCAN->CAN_MR |= AT91C_CAN_CANEN; + + // Wait for WAKEUP flag raising <=> 11-recessive-bit were scanned by the transceiver + while( (pCAN->CAN_SR & AT91C_CAN_WAKEUP) != AT91C_CAN_WAKEUP ); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_DisableCAN() +//* \brief +//*---------------------------------------------------------------------------- +__inline void AT91F_DisableCAN( + AT91PS_CAN pCAN) // pointer to a CAN controller +{ + pCAN->CAN_MR &= ~AT91C_CAN_CANEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_EnableIt +//* \brief Enable CAN interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_EnableIt ( + AT91PS_CAN pCAN, // pointer to a CAN controller + unsigned int flag) // IT to be enabled +{ + //* Write to the IER register + pCAN->CAN_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_DisableIt +//* \brief Disable CAN interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_DisableIt ( + AT91PS_CAN pCAN, // pointer to a CAN controller + unsigned int flag) // IT to be disabled +{ + //* Write to the IDR register + pCAN->CAN_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetStatus +//* \brief Return CAN Interrupt Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetStatus( // \return CAN Interrupt Status + AT91PS_CAN pCAN) // pointer to a CAN controller +{ + return pCAN->CAN_SR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetInterruptMaskStatus +//* \brief Return CAN Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetInterruptMaskStatus( // \return CAN Interrupt Mask Status + AT91PS_CAN pCAN) // pointer to a CAN controller +{ + return pCAN->CAN_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_IsInterruptMasked +//* \brief Test if CAN Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_IsInterruptMasked( + AT91PS_CAN pCAN, // \arg pointer to a CAN controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_CAN_GetInterruptMaskStatus(pCAN) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_IsStatusSet +//* \brief Test if CAN Interrupt is Set +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_IsStatusSet( + AT91PS_CAN pCAN, // \arg pointer to a CAN controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_CAN_GetStatus(pCAN) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgModeReg +//* \brief Configure the Mode Register of the CAN controller +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgModeReg ( + AT91PS_CAN pCAN, // pointer to a CAN controller + unsigned int mode) // mode register +{ + //* Write to the MR register + pCAN->CAN_MR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetModeReg +//* \brief Return the Mode Register of the CAN controller value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetModeReg ( + AT91PS_CAN pCAN // pointer to a CAN controller + ) +{ + return pCAN->CAN_MR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgBaudrateReg +//* \brief Configure the Baudrate of the CAN controller for the network +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgBaudrateReg ( + AT91PS_CAN pCAN, // pointer to a CAN controller + unsigned int baudrate_cfg) +{ + //* Write to the BR register + pCAN->CAN_BR = baudrate_cfg; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetBaudrate +//* \brief Return the Baudrate of the CAN controller for the network value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetBaudrate ( + AT91PS_CAN pCAN // pointer to a CAN controller + ) +{ + return pCAN->CAN_BR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetInternalCounter +//* \brief Return CAN Timer Regsiter Value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetInternalCounter ( + AT91PS_CAN pCAN // pointer to a CAN controller + ) +{ + return pCAN->CAN_TIM; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetTimestamp +//* \brief Return CAN Timestamp Register Value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetTimestamp ( + AT91PS_CAN pCAN // pointer to a CAN controller + ) +{ + return pCAN->CAN_TIMESTP; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetErrorCounter +//* \brief Return CAN Error Counter Register Value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetErrorCounter ( + AT91PS_CAN pCAN // pointer to a CAN controller + ) +{ + return pCAN->CAN_ECR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_InitTransferRequest +//* \brief Request for a transfer on the corresponding mailboxes +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_InitTransferRequest ( + AT91PS_CAN pCAN, // pointer to a CAN controller + unsigned int transfer_cmd) +{ + pCAN->CAN_TCR = transfer_cmd; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_InitAbortRequest +//* \brief Abort the corresponding mailboxes +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_InitAbortRequest ( + AT91PS_CAN pCAN, // pointer to a CAN controller + unsigned int abort_cmd) +{ + pCAN->CAN_ACR = abort_cmd; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgMessageModeReg +//* \brief Program the Message Mode Register +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgMessageModeReg ( + AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox + unsigned int mode) +{ + CAN_Mailbox->CAN_MB_MMR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetMessageModeReg +//* \brief Return the Message Mode Register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetMessageModeReg ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgMessageIDReg +//* \brief Program the Message ID Register +//* \brief Version == 0 for Standard messsage, Version == 1 for Extended +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgMessageIDReg ( + AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox + unsigned int id, + unsigned char version) +{ + if(version==0) // IDvA Standard Format + CAN_Mailbox->CAN_MB_MID = id<<18; + else // IDvB Extended Format + CAN_Mailbox->CAN_MB_MID = id | (1<<29); // set MIDE bit +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetMessageIDReg +//* \brief Return the Message ID Register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetMessageIDReg ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MID; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgMessageAcceptanceMaskReg +//* \brief Program the Message Acceptance Mask Register +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgMessageAcceptanceMaskReg ( + AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox + unsigned int mask) +{ + CAN_Mailbox->CAN_MB_MAM = mask; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetMessageAcceptanceMaskReg +//* \brief Return the Message Acceptance Mask Register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetMessageAcceptanceMaskReg ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MAM; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetFamilyID +//* \brief Return the Message ID Register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetFamilyID ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MFID; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgMessageCtrl +//* \brief Request and config for a transfer on the corresponding mailbox +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgMessageCtrlReg ( + AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox + unsigned int message_ctrl_cmd) +{ + CAN_Mailbox->CAN_MB_MCR = message_ctrl_cmd; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetMessageStatus +//* \brief Return CAN Mailbox Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetMessageStatus ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgMessageDataLow +//* \brief Program data low value +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgMessageDataLow ( + AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox + unsigned int data) +{ + CAN_Mailbox->CAN_MB_MDL = data; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetMessageDataLow +//* \brief Return data low value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetMessageDataLow ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MDL; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgMessageDataHigh +//* \brief Program data high value +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgMessageDataHigh ( + AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox + unsigned int data) +{ + CAN_Mailbox->CAN_MB_MDH = data; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetMessageDataHigh +//* \brief Return data high value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetMessageDataHigh ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MDH; +} + +/* ***************************************************************************** + SOFTWARE API FOR ADC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_EnableIt +//* \brief Enable ADC interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_EnableIt ( + AT91PS_ADC pADC, // pointer to a ADC controller + unsigned int flag) // IT to be enabled +{ + //* Write to the IER register + pADC->ADC_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_DisableIt +//* \brief Disable ADC interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_DisableIt ( + AT91PS_ADC pADC, // pointer to a ADC controller + unsigned int flag) // IT to be disabled +{ + //* Write to the IDR register + pADC->ADC_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetStatus +//* \brief Return ADC Interrupt Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetStatus( // \return ADC Interrupt Status + AT91PS_ADC pADC) // pointer to a ADC controller +{ + return pADC->ADC_SR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetInterruptMaskStatus +//* \brief Return ADC Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetInterruptMaskStatus( // \return ADC Interrupt Mask Status + AT91PS_ADC pADC) // pointer to a ADC controller +{ + return pADC->ADC_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_IsInterruptMasked +//* \brief Test if ADC Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_IsInterruptMasked( + AT91PS_ADC pADC, // \arg pointer to a ADC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_ADC_GetInterruptMaskStatus(pADC) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_IsStatusSet +//* \brief Test if ADC Status is Set +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_IsStatusSet( + AT91PS_ADC pADC, // \arg pointer to a ADC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_ADC_GetStatus(pADC) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_CfgModeReg +//* \brief Configure the Mode Register of the ADC controller +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_CfgModeReg ( + AT91PS_ADC pADC, // pointer to a ADC controller + unsigned int mode) // mode register +{ + //* Write to the MR register + pADC->ADC_MR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetModeReg +//* \brief Return the Mode Register of the ADC controller value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetModeReg ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_MR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_CfgTimings +//* \brief Configure the different necessary timings of the ADC controller +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_CfgTimings ( + AT91PS_ADC pADC, // pointer to a ADC controller + unsigned int mck_clock, // in MHz + unsigned int adc_clock, // in MHz + unsigned int startup_time, // in us + unsigned int sample_and_hold_time) // in ns +{ + unsigned int prescal,startup,shtim; + + prescal = mck_clock/(2*adc_clock) - 1; + startup = adc_clock*startup_time/8 - 1; + shtim = adc_clock*sample_and_hold_time/1000 - 1; + + //* Write to the MR register + pADC->ADC_MR = ( (prescal<<8) & AT91C_ADC_PRESCAL) | ( (startup<<16) & AT91C_ADC_STARTUP) | ( (shtim<<24) & AT91C_ADC_SHTIM); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_EnableChannel +//* \brief Return ADC Timer Register Value +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_EnableChannel ( + AT91PS_ADC pADC, // pointer to a ADC controller + unsigned int channel) // mode register +{ + //* Write to the CHER register + pADC->ADC_CHER = channel; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_DisableChannel +//* \brief Return ADC Timer Register Value +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_DisableChannel ( + AT91PS_ADC pADC, // pointer to a ADC controller + unsigned int channel) // mode register +{ + //* Write to the CHDR register + pADC->ADC_CHDR = channel; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetChannelStatus +//* \brief Return ADC Timer Register Value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetChannelStatus ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CHSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_StartConversion +//* \brief Software request for a analog to digital conversion +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_StartConversion ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + pADC->ADC_CR = AT91C_ADC_START; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_SoftReset +//* \brief Software reset +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_SoftReset ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + pADC->ADC_CR = AT91C_ADC_SWRST; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetLastConvertedData +//* \brief Return the Last Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetLastConvertedData ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_LCDR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH0 +//* \brief Return the Channel 0 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH0 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR0; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH1 +//* \brief Return the Channel 1 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH1 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR1; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH2 +//* \brief Return the Channel 2 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH2 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR2; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH3 +//* \brief Return the Channel 3 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH3 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR3; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH4 +//* \brief Return the Channel 4 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH4 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR4; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH5 +//* \brief Return the Channel 5 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH5 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR5; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH6 +//* \brief Return the Channel 6 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH6 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR6; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH7 +//* \brief Return the Channel 7 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH7 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR7; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_CfgPMC +//* \brief Enable Peripheral clock in PMC for MC +//*---------------------------------------------------------------------------- +__inline void AT91F_MC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_DBGU_CfgPMC +//* \brief Enable Peripheral clock in PMC for DBGU +//*---------------------------------------------------------------------------- +__inline void AT91F_DBGU_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_DBGU_CfgPIO +//* \brief Configure PIO controllers to drive DBGU signals +//*---------------------------------------------------------------------------- +__inline void AT91F_DBGU_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA28_DTXD ) | + ((unsigned int) AT91C_PA27_DRXD ), // Peripheral A + 0); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWMC_CH3_CfgPIO +//* \brief Configure PIO controllers to drive PWMC_CH3 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_CH3_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB22_PWM3 ), // Peripheral A + ((unsigned int) AT91C_PB30_PWM3 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWMC_CH2_CfgPIO +//* \brief Configure PIO controllers to drive PWMC_CH2 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_CH2_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB21_PWM2 ), // Peripheral A + ((unsigned int) AT91C_PB29_PWM2 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWMC_CH1_CfgPIO +//* \brief Configure PIO controllers to drive PWMC_CH1 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_CH1_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB20_PWM1 ), // Peripheral A + ((unsigned int) AT91C_PB28_PWM1 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWMC_CH0_CfgPIO +//* \brief Configure PIO controllers to drive PWMC_CH0 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_CH0_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB19_PWM0 ), // Peripheral A + ((unsigned int) AT91C_PB27_PWM0 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_EMAC_CfgPMC +//* \brief Enable Peripheral clock in PMC for EMAC +//*---------------------------------------------------------------------------- +__inline void AT91F_EMAC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_EMAC)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_EMAC_CfgPIO +//* \brief Configure PIO controllers to drive EMAC signals +//*---------------------------------------------------------------------------- +__inline void AT91F_EMAC_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB9_EMDIO ) | + ((unsigned int) AT91C_PB17_ERXCK ) | + ((unsigned int) AT91C_PB15_ERXDV_ECRSDV) | + ((unsigned int) AT91C_PB8_EMDC ) | + ((unsigned int) AT91C_PB16_ECOL ) | + ((unsigned int) AT91C_PB7_ERXER ) | + ((unsigned int) AT91C_PB5_ERX0 ) | + ((unsigned int) AT91C_PB6_ERX1 ) | + ((unsigned int) AT91C_PB13_ERX2 ) | + ((unsigned int) AT91C_PB1_ETXEN ) | + ((unsigned int) AT91C_PB14_ERX3 ) | + ((unsigned int) AT91C_PB12_ETXER ) | + ((unsigned int) AT91C_PB2_ETX0 ) | + ((unsigned int) AT91C_PB3_ETX1 ) | + ((unsigned int) AT91C_PB10_ETX2 ) | + ((unsigned int) AT91C_PB18_EF100 ) | + ((unsigned int) AT91C_PB11_ETX3 ) | + ((unsigned int) AT91C_PB4_ECRS ) | + ((unsigned int) AT91C_PB0_ETXCK_EREFCK), // Peripheral A + 0); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_VREG_CfgPMC +//* \brief Enable Peripheral clock in PMC for VREG +//*---------------------------------------------------------------------------- +__inline void AT91F_VREG_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_CfgPMC +//* \brief Enable Peripheral clock in PMC for SSC +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SSC)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_CfgPIO +//* \brief Configure PIO controllers to drive SSC signals +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA23_TD ) | + ((unsigned int) AT91C_PA21_TF ) | + ((unsigned int) AT91C_PA25_RK ) | + ((unsigned int) AT91C_PA24_RD ) | + ((unsigned int) AT91C_PA26_RF ) | + ((unsigned int) AT91C_PA22_TK ), // Peripheral A + 0); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI1_CfgPMC +//* \brief Enable Peripheral clock in PMC for SPI1 +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI1_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SPI1)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI1_CfgPIO +//* \brief Configure PIO controllers to drive SPI1 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI1_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PA23_SPI1_MOSI) | + ((unsigned int) AT91C_PA21_SPI1_NPCS0) | + ((unsigned int) AT91C_PA25_SPI1_NPCS1) | + ((unsigned int) AT91C_PA2_SPI1_NPCS1) | + ((unsigned int) AT91C_PA24_SPI1_MISO) | + ((unsigned int) AT91C_PA22_SPI1_SPCK) | + ((unsigned int) AT91C_PA26_SPI1_NPCS2) | + ((unsigned int) AT91C_PA3_SPI1_NPCS2) | + ((unsigned int) AT91C_PA29_SPI1_NPCS3) | + ((unsigned int) AT91C_PA4_SPI1_NPCS3)); // Peripheral B + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PB10_SPI1_NPCS1) | + ((unsigned int) AT91C_PB11_SPI1_NPCS2) | + ((unsigned int) AT91C_PB16_SPI1_NPCS3)); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI0_CfgPMC +//* \brief Enable Peripheral clock in PMC for SPI0 +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI0_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SPI0)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI0_CfgPIO +//* \brief Configure PIO controllers to drive SPI0 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI0_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA17_SPI0_MOSI) | + ((unsigned int) AT91C_PA12_SPI0_NPCS0) | + ((unsigned int) AT91C_PA13_SPI0_NPCS1) | + ((unsigned int) AT91C_PA16_SPI0_MISO) | + ((unsigned int) AT91C_PA14_SPI0_NPCS2) | + ((unsigned int) AT91C_PA18_SPI0_SPCK) | + ((unsigned int) AT91C_PA15_SPI0_NPCS3), // Peripheral A + ((unsigned int) AT91C_PA7_SPI0_NPCS1) | + ((unsigned int) AT91C_PA8_SPI0_NPCS2) | + ((unsigned int) AT91C_PA9_SPI0_NPCS3)); // Peripheral B + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PB13_SPI0_NPCS1) | + ((unsigned int) AT91C_PB14_SPI0_NPCS2) | + ((unsigned int) AT91C_PB17_SPI0_NPCS3)); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWMC_CfgPMC +//* \brief Enable Peripheral clock in PMC for PWMC +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_PWMC)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC0_CfgPMC +//* \brief Enable Peripheral clock in PMC for TC0 +//*---------------------------------------------------------------------------- +__inline void AT91F_TC0_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_TC0)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC0_CfgPIO +//* \brief Configure PIO controllers to drive TC0 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_TC0_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB23_TIOA0 ) | + ((unsigned int) AT91C_PB24_TIOB0 ), // Peripheral A + ((unsigned int) AT91C_PB12_TCLK0 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC1_CfgPMC +//* \brief Enable Peripheral clock in PMC for TC1 +//*---------------------------------------------------------------------------- +__inline void AT91F_TC1_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_TC1)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC1_CfgPIO +//* \brief Configure PIO controllers to drive TC1 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_TC1_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB25_TIOA1 ) | + ((unsigned int) AT91C_PB26_TIOB1 ), // Peripheral A + ((unsigned int) AT91C_PB19_TCLK1 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC2_CfgPMC +//* \brief Enable Peripheral clock in PMC for TC2 +//*---------------------------------------------------------------------------- +__inline void AT91F_TC2_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_TC2)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC2_CfgPIO +//* \brief Configure PIO controllers to drive TC2 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_TC2_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PA15_TCLK2 )); // Peripheral B + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB27_TIOA2 ) | + ((unsigned int) AT91C_PB28_TIOB2 ), // Peripheral A + 0); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITC_CfgPMC +//* \brief Enable Peripheral clock in PMC for PITC +//*---------------------------------------------------------------------------- +__inline void AT91F_PITC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_CfgPMC +//* \brief Enable Peripheral clock in PMC for ADC +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_ADC)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_CfgPIO +//* \brief Configure PIO controllers to drive ADC signals +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PB18_ADTRG )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_CfgPMC +//* \brief Enable Peripheral clock in PMC for PMC +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_CfgPIO +//* \brief Configure PIO controllers to drive PMC signals +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PA13_PCK1 ) | + ((unsigned int) AT91C_PA30_PCK2 ) | + ((unsigned int) AT91C_PA27_PCK3 )); // Peripheral B + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB29_PCK1 ) | + ((unsigned int) AT91C_PB30_PCK2 ), // Peripheral A + ((unsigned int) AT91C_PB21_PCK1 ) | + ((unsigned int) AT91C_PB22_PCK2 ) | + ((unsigned int) AT91C_PB20_PCK0 ) | + ((unsigned int) AT91C_PB0_PCK0 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_RSTC_CfgPMC +//* \brief Enable Peripheral clock in PMC for RSTC +//*---------------------------------------------------------------------------- +__inline void AT91F_RSTC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_RTTC_CfgPMC +//* \brief Enable Peripheral clock in PMC for RTTC +//*---------------------------------------------------------------------------- +__inline void AT91F_RTTC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIOA_CfgPMC +//* \brief Enable Peripheral clock in PMC for PIOA +//*---------------------------------------------------------------------------- +__inline void AT91F_PIOA_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_PIOA)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIOB_CfgPMC +//* \brief Enable Peripheral clock in PMC for PIOB +//*---------------------------------------------------------------------------- +__inline void AT91F_PIOB_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_PIOB)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_CfgPMC +//* \brief Enable Peripheral clock in PMC for TWI +//*---------------------------------------------------------------------------- +__inline void AT91F_TWI_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_TWI)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_CfgPIO +//* \brief Configure PIO controllers to drive TWI signals +//*---------------------------------------------------------------------------- +__inline void AT91F_TWI_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA10_TWD ) | + ((unsigned int) AT91C_PA11_TWCK ), // Peripheral A + 0); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_WDTC_CfgPMC +//* \brief Enable Peripheral clock in PMC for WDTC +//*---------------------------------------------------------------------------- +__inline void AT91F_WDTC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US1_CfgPMC +//* \brief Enable Peripheral clock in PMC for US1 +//*---------------------------------------------------------------------------- +__inline void AT91F_US1_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_US1)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US1_CfgPIO +//* \brief Configure PIO controllers to drive US1 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_US1_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA5_RXD1 ) | + ((unsigned int) AT91C_PA6_TXD1 ) | + ((unsigned int) AT91C_PA8_RTS1 ) | + ((unsigned int) AT91C_PA7_SCK1 ) | + ((unsigned int) AT91C_PA9_CTS1 ), // Peripheral A + 0); // Peripheral B + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PB25_DTR1 ) | + ((unsigned int) AT91C_PB23_DCD1 ) | + ((unsigned int) AT91C_PB24_DSR1 ) | + ((unsigned int) AT91C_PB26_RI1 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US0_CfgPMC +//* \brief Enable Peripheral clock in PMC for US0 +//*---------------------------------------------------------------------------- +__inline void AT91F_US0_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_US0)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US0_CfgPIO +//* \brief Configure PIO controllers to drive US0 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_US0_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA0_RXD0 ) | + ((unsigned int) AT91C_PA1_TXD0 ) | + ((unsigned int) AT91C_PA3_RTS0 ) | + ((unsigned int) AT91C_PA2_SCK0 ) | + ((unsigned int) AT91C_PA4_CTS0 ), // Peripheral A + 0); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_CfgPMC +//* \brief Enable Peripheral clock in PMC for UDP +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_UDP)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_CfgPMC +//* \brief Enable Peripheral clock in PMC for AIC +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_IRQ0) | + ((unsigned int) 1 << AT91C_ID_FIQ) | + ((unsigned int) 1 << AT91C_ID_IRQ1)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_CfgPIO +//* \brief Configure PIO controllers to drive AIC signals +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA30_IRQ0 ) | + ((unsigned int) AT91C_PA29_FIQ ), // Peripheral A + ((unsigned int) AT91C_PA14_IRQ1 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgPMC +//* \brief Enable Peripheral clock in PMC for CAN +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_CAN)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgPIO +//* \brief Configure PIO controllers to drive CAN signals +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA20_CANTX ) | + ((unsigned int) AT91C_PA19_CANRX ), // Peripheral A + 0); // Peripheral B +} + +#endif // lib_AT91SAM7X256_H diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/incIAR/project.h b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/incIAR/project.h new file mode 100644 index 0000000..24fb698 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/incIAR/project.h @@ -0,0 +1,30 @@ +//----------------------------------------------------------------------------- +// ATMEL Microcontroller Software Support - ROUSSET - +//----------------------------------------------------------------------------- +// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +//----------------------------------------------------------------------------- +// File Name : project.h +// Object : project specific include file to AT91SAM7X256 +// Creation : JPP 14-Sep-2006 +//----------------------------------------------------------------------------- +#ifndef _PROJECT_H +#define _PROJECT_H + +/// Include your AT91 Library files and specific compiler definitions + +#include +#include "AT91SAM7X-EK.h" +#include "AT91SAM7X256.h" +#define __inline inline +#include "lib_AT91SAM7X256.h" + +#endif // _PROJECT_H diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.cspy.bat b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.cspy.bat new file mode 100644 index 0000000..aa07e50 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.cspy.bat @@ -0,0 +1,33 @@ +@REM This bat file has been generated by the IAR Embeddded Workbench +@REM C-SPY interactive debugger,as an aid to preparing a command +@REM line for running the cspybat command line utility with the +@REM appropriate settings. +@REM +@REM After making some adjustments to this file, you can launch cspybat +@REM by typing the name of this file followed by the name of the debug +@REM file (usually an ubrof file). Note that this file is generated +@REM every time a new debug session is initialized, so you may want to +@REM move or rename the file before making changes. +@REM +@REM Note: some command line arguments cannot be properly generated +@REM by this process. Specifically, the plugin which is responsible +@REM for the Terminal I/O window (and other C runtime functionality) +@REM comes in a special version for cspybat, and the name of that +@REM plugin dll is not known when generating this file. It resides in +@REM the $TOOLKIT_DIR$\bin folder and is usually called XXXbat.dll or +@REM XXXlibsupportbat.dll, where XXX is the name of the corresponding +@REM tool chain. Replace the '' parameter +@REM below with the appropriate file name. Other plugins loaded by +@REM C-SPY are usually not needed by, or will not work in, cspybat +@REM but they are listed at the end of this file for reference. + + +"C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\bin\cspybat" "C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\bin\armproc.dll" "C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\bin\armjlink.dll" %1 --plugin "C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\bin\" --macro "C:\Documents and Settings\Greg\Desktop\SAM7X256\AT91SAM7X-Interrupt_SAM7X\Compil\resource\SAM7_FLASH.mac" --backend -B "--endian=little" "--cpu=ARM7TDMI" "--fpu=None" "-p" "C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\CONFIG\debugger\Atmel\ioAT91SAM7X256.ddf" "--drv_verify_download" "--semihosting" "--device=AT91SAM7X256" "-d" "jlink" "--drv_communication=USB0" "--jlink_speed=adaptive" + + +@REM Loaded plugins: +@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\bin\armlibsupport.dll +@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\plugins\CodeCoverage\CodeCoverage.dll +@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\plugins\Profiling\Profiling.dll +@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\plugins\stack\stack.dll +@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\plugins\SymList\SymList.dll diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.dbgdt b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.dbgdt new file mode 100644 index 0000000..e068f91 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.dbgdt @@ -0,0 +1,5 @@ + + + + + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.dni b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.dni new file mode 100644 index 0000000..a4e49ac --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.dni @@ -0,0 +1,18 @@ +[JLinkDriver] +WatchCond=_ 0 +Watch0=_ 0 "" 0 "" 0 "" 0 "" 0 0 0 0 +Watch1=_ 0 "" 0 "" 0 "" 0 "" 0 0 0 0 +[TermIOLog] +LoggingEnabled=_ 0 +LogFile=_ "" +[Log file] +LoggingEnabled=_ 0 +LogFile=_ "" +Category=_ 0 +[Disassemble mode] +mode=0 +[Breakpoints] +Count=0 +[TraceHelper] +Enabled=0 +ShowSource=1 diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.wsdt b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.wsdt new file mode 100644 index 0000000..f9f15e9 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.wsdt @@ -0,0 +1,74 @@ + + + + + + BasicInterrupt_SAM7X/FLASH_Debug + + + + + + + + + 271272727 + + + 20 + 995 + 265 + 66 + + + + + + + + + + + TabID-26686-579 + Workspace + Workspace + + + BasicInterrupt_SAM7X + + + + 0 + + + TabID-13847-615 + Build + Build + + + + TabID-20936-687 + Debug Log + Debug-Log + + + + + 1 + + + + + + 0100000010000001 + + + + + + + iaridepm.enu1-2-2612345-2-2200200144300234192250361718970-2-21981388-2-213902001002886234192144300234192 + + + + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X_FLASH_Debug.jlink b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X_FLASH_Debug.jlink new file mode 100644 index 0000000..ecbb0a8 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X_FLASH_Debug.jlink @@ -0,0 +1,12 @@ +[FLASH] +SkipProgOnCRCMatch = 1 +VerifyDownload = 1 +AllowCaching = 1 +EnableFlashDL = 2 +Override = 0 +Device="ADUC7020X62" +[BREAKPOINTS] +ShowInfoWin = 1 +EnableFlashBP = 2 +[CPU] +AllowSimulation = 1 diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo.cspy.bat b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo.cspy.bat new file mode 100644 index 0000000..0e4d177 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo.cspy.bat @@ -0,0 +1,33 @@ +@REM This bat file has been generated by the IAR Embeddded Workbench +@REM C-SPY interactive debugger,as an aid to preparing a command +@REM line for running the cspybat command line utility with the +@REM appropriate settings. +@REM +@REM After making some adjustments to this file, you can launch cspybat +@REM by typing the name of this file followed by the name of the debug +@REM file (usually an ubrof file). Note that this file is generated +@REM every time a new debug session is initialized, so you may want to +@REM move or rename the file before making changes. +@REM +@REM Note: some command line arguments cannot be properly generated +@REM by this process. Specifically, the plugin which is responsible +@REM for the Terminal I/O window (and other C runtime functionality) +@REM comes in a special version for cspybat, and the name of that +@REM plugin dll is not known when generating this file. It resides in +@REM the $TOOLKIT_DIR$\bin folder and is usually called XXXbat.dll or +@REM XXXlibsupportbat.dll, where XXX is the name of the corresponding +@REM tool chain. Replace the '' parameter +@REM below with the appropriate file name. Other plugins loaded by +@REM C-SPY are usually not needed by, or will not work in, cspybat +@REM but they are listed at the end of this file for reference. + + +"C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\bin\cspybat" "C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\bin\armproc.dll" "C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\bin\armjlink.dll" %1 --plugin "C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\bin\" --macro "C:\svn\cmock\iar\iar_v5\Resource\SAM7_RAM.mac" --backend -B "--endian=little" "--cpu=ARM7TDMI" "--fpu=None" "-p" "C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\CONFIG\debugger\Atmel\ioAT91SAM7X256.ddf" "--drv_verify_download" "--semihosting" "--device=AT91SAM7X256" "-d" "jlink" "--drv_communication=USB0" "--jlink_speed=adaptive" + + +@REM Loaded plugins: +@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\bin\armlibsupport.dll +@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\plugins\CodeCoverage\CodeCoverage.dll +@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\plugins\Profiling\Profiling.dll +@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\plugins\stack\stack.dll +@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\plugins\SymList\SymList.dll diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo.dbgdt b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo.dbgdt new file mode 100644 index 0000000..b521f67 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo.dbgdt @@ -0,0 +1,85 @@ + + + + + + + + 20 + 995 + 265 + 66 + + + + + + + + 124272727 + + + + + 10 + + + + + + + + + TabID-27249-27051 + Debug Log + Debug-Log + + + + TabID-4707-27064 + Build + Build + + + + + 0 + + + TabID-5230-27054 + Workspace + Workspace + + + cmock_demo + + + + 0 + + + TabID-15978-27058 + Disassembly + Disassembly + + + + + 0 + + + + + + TextEditorC:\svn\cmock\examples\src\Main.c0258358350TextEditorC:\svn\cmock\examples\src\TaskScheduler.c0439819810100000010000001 + + + + + + + iaridepm.enu1debuggergui.enu1-2-2588198-2-2200200144300234192144300690867-2-2588198-2-2200200144300234192144300690867-2-21981388-2-213902001002886234192144300234192 + + + + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo.dni b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo.dni new file mode 100644 index 0000000..84237e1 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo.dni @@ -0,0 +1,44 @@ +[JLinkDriver] +WatchCond=_ 0 +Watch0=_ 0 "" 0 "" 0 "" 0 "" 0 0 0 0 +Watch1=_ 0 "" 0 "" 0 "" 0 "" 0 0 0 0 +[DisAssemblyWindow] +NumStates=_ 1 +State 1=_ 1 +[CodeCoverage] +Enabled=_ 0 +[Profiling] +Enabled=0 +[StackPlugin] +Enabled=1 +OverflowWarningsEnabled=1 +WarningThreshold=90 +SpWarningsEnabled=1 +WarnHow=0 +UseTrigger=1 +TriggerName=main +LimitSize=0 +ByteLimit=50 +[Interrupts] +Enabled=1 +[MemoryMap] +Enabled=0 +Base=0 +UseAuto=0 +TypeViolation=1 +UnspecRange=1 +ActionState=1 +[Log file] +LoggingEnabled=_ 0 +LogFile=_ "" +Category=_ 0 +[TermIOLog] +LoggingEnabled=_ 0 +LogFile=_ "" +[Disassemble mode] +mode=0 +[Breakpoints] +Count=0 +[TraceHelper] +Enabled=0 +ShowSource=1 diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo.wsdt b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo.wsdt new file mode 100644 index 0000000..c1a7704 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo.wsdt @@ -0,0 +1,73 @@ + + + + + + cmock_demo/RAM_Debug + + + + + + + + 2099526566 + + + + + + + 216272727 + + + + + + + + + + TabID-7530-24964 + Build + Build + + + + TabID-25388-26881 + Debug Log + Debug-Log + + + + + 0 + + + TabID-18278-24968 + Workspace + Workspace + + + cmock_democmock_demo/Sourcecmock_demo/srccmock_demo/srcIAR + + + + 0 + + + + + + TextEditorC:\svn\cmock\examples\src\Main.c02582082000100000010000001 + + + + + + + iaridepm.enu1-2-2513307-2-2200200144300234192222944603044-2-22971388-2-213902991002886350117144300234192 + + + + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo_Binary.jlink b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo_Binary.jlink new file mode 100644 index 0000000..ecbb0a8 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo_Binary.jlink @@ -0,0 +1,12 @@ +[FLASH] +SkipProgOnCRCMatch = 1 +VerifyDownload = 1 +AllowCaching = 1 +EnableFlashDL = 2 +Override = 0 +Device="ADUC7020X62" +[BREAKPOINTS] +ShowInfoWin = 1 +EnableFlashBP = 2 +[CPU] +AllowSimulation = 1 diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo_FLASH_Debug.jlink b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo_FLASH_Debug.jlink new file mode 100644 index 0000000..ecbb0a8 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo_FLASH_Debug.jlink @@ -0,0 +1,12 @@ +[FLASH] +SkipProgOnCRCMatch = 1 +VerifyDownload = 1 +AllowCaching = 1 +EnableFlashDL = 2 +Override = 0 +Device="ADUC7020X62" +[BREAKPOINTS] +ShowInfoWin = 1 +EnableFlashBP = 2 +[CPU] +AllowSimulation = 1 diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo_RAM_Debug.jlink b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo_RAM_Debug.jlink new file mode 100644 index 0000000..ecbb0a8 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo_RAM_Debug.jlink @@ -0,0 +1,12 @@ +[FLASH] +SkipProgOnCRCMatch = 1 +VerifyDownload = 1 +AllowCaching = 1 +EnableFlashDL = 2 +Override = 0 +Device="ADUC7020X62" +[BREAKPOINTS] +ShowInfoWin = 1 +EnableFlashBP = 2 +[CPU] +AllowSimulation = 1 diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/srcIAR/Cstartup.s b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/srcIAR/Cstartup.s new file mode 100644 index 0000000..7113c80 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/srcIAR/Cstartup.s @@ -0,0 +1,299 @@ +;* ---------------------------------------------------------------------------- +;* ATMEL Microcontroller Software Support - ROUSSET - +;* ---------------------------------------------------------------------------- +;* Copyright (c) 2006, Atmel Corporation +; +;* All rights reserved. +;* +;* Redistribution and use in source and binary forms, with or without +;* modification, are permitted provided that the following conditions are met: +;* +;* - Redistributions of source code must retain the above copyright notice, +;* this list of conditions and the disclaimer below. +;* +;* - Redistributions in binary form must reproduce the above copyright notice, +;* this list of conditions and the disclaimer below in the documentation and/or +;* other materials provided with the distribution. +;* +;* Atmel's name may not be used to endorse or promote products derived from +;* this software without specific prior written permission. +;* +;* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +;* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +;* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +;* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +;* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +;* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +;* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +;* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +;* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +;* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +;* ---------------------------------------------------------------------------- + +;------------------------------------------------------------------------------ +; Include your AT91 Library files +;------------------------------------------------------------------------------ +#include "AT91SAM7X256_inc.h" +;------------------------------------------------------------------------------ + +#define TOP_OF_MEMORY (AT91C_ISRAM + AT91C_ISRAM_SIZE) +#define IRQ_STACK_SIZE (3*8*4) + ; 3 words to be saved per interrupt priority level + +; Mode, correspords to bits 0-5 in CPSR +MODE_BITS DEFINE 0x1F ; Bit mask for mode bits in CPSR +USR_MODE DEFINE 0x10 ; User mode +FIQ_MODE DEFINE 0x11 ; Fast Interrupt Request mode +IRQ_MODE DEFINE 0x12 ; Interrupt Request mode +SVC_MODE DEFINE 0x13 ; Supervisor mode +ABT_MODE DEFINE 0x17 ; Abort mode +UND_MODE DEFINE 0x1B ; Undefined Instruction mode +SYS_MODE DEFINE 0x1F ; System mode + +I_BIT DEFINE 0x80 +F_BIT DEFINE 0x40 + +;------------------------------------------------------------------------------ +; ?RESET +; Reset Vector. +; Normally, segment INTVEC is linked at address 0. +; For debugging purposes, INTVEC may be placed at other addresses. +; A debugger that honors the entry point will start the +; program in a normal way even if INTVEC is not at address 0. +;------------------------------------------------------------------------------ + SECTION .intvec:CODE:NOROOT(2) + PUBLIC __vector + PUBLIC __iar_program_start + + ARM +__vector: + ldr pc,[pc,#+24] ;; Reset +__und_handler: + ldr pc,[pc,#+24] ;; Undefined instructions +__swi_handler: + ldr pc,[pc,#+24] ;; Software interrupt (SWI/SVC) +__prefetch_handler: + ldr pc,[pc,#+24] ;; Prefetch abort +__data_handler: + ldr pc,[pc,#+24] ;; Data abort + DC32 0xFFFFFFFF ;; RESERVED +__irq_handler: + ldr pc,[pc,#+24] ;; IRQ +__fiq_handler: + ldr pc,[pc,#+24] ;; FIQ + + DC32 __iar_program_start + DC32 __und_handler + DC32 __swi_handler + DC32 __prefetch_handler + DC32 __data_handler + B . + DC32 IRQ_Handler_Entry + DC32 FIQ_Handler_Entry + +;------------------------------------------------------------------------------ +;- Manage exception: The exception must be ensure in ARM mode +;------------------------------------------------------------------------------ + SECTION text:CODE:NOROOT(2) + ARM +;------------------------------------------------------------------------------ +;- Function : FIQ_Handler_Entry +;- Treatments : FIQ Controller Interrupt Handler. +;- R8 is initialize in Cstartup +;- Called Functions : None only by FIQ +;------------------------------------------------------------------------------ +FIQ_Handler_Entry: + +;- Switch in SVC/User Mode to allow User Stack access for C code +; because the FIQ is not yet acknowledged + +;- Save and r0 in FIQ_Register + mov r9,r0 + ldr r0 , [r8, #AIC_FVR] + msr CPSR_c,#I_BIT | F_BIT | SVC_MODE +;- Save scratch/used registers and LR in User Stack + stmfd sp!, { r1-r3, r12, lr} + +;- Branch to the routine pointed by the AIC_FVR + mov r14, pc + bx r0 + +;- Restore scratch/used registers and LR from User Stack + ldmia sp!, { r1-r3, r12, lr} + +;- Leave Interrupts disabled and switch back in FIQ mode + msr CPSR_c, #I_BIT | F_BIT | FIQ_MODE + +;- Restore the R0 ARM_MODE_SVC register + mov r0,r9 + +;- Restore the Program Counter using the LR_fiq directly in the PC + subs pc,lr,#4 +;------------------------------------------------------------------------------ +;- Function : IRQ_Handler_Entry +;- Treatments : IRQ Controller Interrupt Handler. +;- Called Functions : AIC_IVR[interrupt] +;------------------------------------------------------------------------------ +IRQ_Handler_Entry: +;------------------------- +;- Manage Exception Entry +;------------------------- +;- Adjust and save LR_irq in IRQ stack + sub lr, lr, #4 + stmfd sp!, {lr} + +;- Save r0 and SPSR (need to be saved for nested interrupt) + mrs r14, SPSR + stmfd sp!, {r0,r14} + +;- Write in the IVR to support Protect Mode +;- No effect in Normal Mode +;- De-assert the NIRQ and clear the source in Protect Mode + ldr r14, =AT91C_BASE_AIC + ldr r0 , [r14, #AIC_IVR] + str r14, [r14, #AIC_IVR] + +;- Enable Interrupt and Switch in Supervisor Mode + msr CPSR_c, #SVC_MODE + +;- Save scratch/used registers and LR in User Stack + stmfd sp!, { r1-r3, r12, r14} + +;---------------------------------------------- +;- Branch to the routine pointed by the AIC_IVR +;---------------------------------------------- + mov r14, pc + bx r0 + +;---------------------------------------------- +;- Manage Exception Exit +;---------------------------------------------- +;- Restore scratch/used registers and LR from User Stack + ldmia sp!, { r1-r3, r12, r14} + +;- Disable Interrupt and switch back in IRQ mode + msr CPSR_c, #I_BIT | IRQ_MODE + +;- Mark the End of Interrupt on the AIC + ldr r14, =AT91C_BASE_AIC + str r14, [r14, #AIC_EOICR] + +;- Restore SPSR_irq and r0 from IRQ stack + ldmia sp!, {r0,r14} + msr SPSR_cxsf, r14 + +;- Restore adjusted LR_irq from IRQ stack directly in the PC + ldmia sp!, {pc}^ + +;------------------------------------------------------------------------------ +;- Exception Vectors +;------------------------------------------------------------------------------ + PUBLIC AT91F_Default_FIQ_handler + PUBLIC AT91F_Default_IRQ_handler + PUBLIC AT91F_Spurious_handler + + ARM ; Always ARM mode after exeption + +AT91F_Default_FIQ_handler + b AT91F_Default_FIQ_handler + +AT91F_Default_IRQ_handler + b AT91F_Default_IRQ_handler + +AT91F_Spurious_handler + b AT91F_Spurious_handler + + +;------------------------------------------------------------------------------ +; ?INIT +; Program entry. +;------------------------------------------------------------------------------ + + SECTION FIQ_STACK:DATA:NOROOT(3) + SECTION IRQ_STACK:DATA:NOROOT(3) + SECTION SVC_STACK:DATA:NOROOT(3) + SECTION ABT_STACK:DATA:NOROOT(3) + SECTION UND_STACK:DATA:NOROOT(3) + SECTION CSTACK:DATA:NOROOT(3) + SECTION text:CODE:NOROOT(2) + REQUIRE __vector + EXTERN ?main + PUBLIC __iar_program_start + EXTERN AT91F_LowLevelInit + + +__iar_program_start: + +;------------------------------------------------------------------------------ +;- Low level Init is performed in a C function: AT91F_LowLevelInit +;- Init Stack Pointer to a valid memory area before calling AT91F_LowLevelInit +;------------------------------------------------------------------------------ + +;- Retrieve end of RAM address + + ldr r13,=TOP_OF_MEMORY ;- Temporary stack in internal RAM for Low Level Init execution + ldr r0,=AT91F_LowLevelInit + mov lr, pc + bx r0 ;- Branch on C function (with interworking) + +; Initialize the stack pointers. +; The pattern below can be used for any of the exception stacks: +; FIQ, IRQ, SVC, ABT, UND, SYS. +; The USR mode uses the same stack as SYS. +; The stack segments must be defined in the linker command file, +; and be declared above. + + mrs r0,cpsr ; Original PSR value + bic r0,r0,#MODE_BITS ; Clear the mode bits + orr r0,r0,#SVC_MODE ; Set SVC mode bits + msr cpsr_c,r0 ; Change the mode + ldr sp,=SFE(SVC_STACK) ; End of SVC_STACK + + bic r0,r0,#MODE_BITS ; Clear the mode bits + orr r0,r0,#UND_MODE ; Set UND mode bits + msr cpsr_c,r0 ; Change the mode + ldr sp,=SFE(UND_STACK) ; End of UND_STACK + + bic r0,r0,#MODE_BITS ; Clear the mode bits + orr r0,r0,#ABT_MODE ; Set ABT mode bits + msr cpsr_c,r0 ; Change the mode + ldr sp,=SFE(ABT_STACK) ; End of ABT_STACK + + bic r0,r0,#MODE_BITS ; Clear the mode bits + orr r0,r0,#FIQ_MODE ; Set FIQ mode bits + msr cpsr_c,r0 ; Change the mode + ldr sp,=SFE(FIQ_STACK) ; End of FIQ_STACK + ;- Init the FIQ register + ldr r8, =AT91C_BASE_AIC + + bic r0,r0,#MODE_BITS ; Clear the mode bits + orr r0,r0,#IRQ_MODE ; Set IRQ mode bits + msr cpsr_c,r0 ; Change the mode + ldr sp,=SFE(IRQ_STACK) ; End of IRQ_STACK + + bic r0,r0,#MODE_BITS ; Clear the mode bits + orr r0,r0,#SYS_MODE ; Set System mode bits + msr cpsr_c,r0 ; Change the mode + ldr sp,=SFE(CSTACK) ; End of CSTACK + +#ifdef __ARMVFP__ +; Enable the VFP coprocessor. + mov r0, #0x40000000 ; Set EN bit in VFP + fmxr fpexc, r0 ; FPEXC, clear others. + +; Disable underflow exceptions by setting flush to zero mode. +; For full IEEE 754 underflow compliance this code should be removed +; and the appropriate exception handler installed. + mov r0, #0x01000000 ; Set FZ bit in VFP + fmxr fpscr, r0 ; FPSCR, clear others. +#endif + +; Add more initialization here + + +; Continue to ?main for more IAR specific system startup + + ldr r0,=?main + bx r0 + + END ;- Terminates the assembly of the last module in a file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/srcIAR/Cstartup_SAM7.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/srcIAR/Cstartup_SAM7.c new file mode 100644 index 0000000..a7c72b9 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/iar/iar_v5/srcIAR/Cstartup_SAM7.c @@ -0,0 +1,98 @@ +//----------------------------------------------------------------------------- +// ATMEL Microcontroller Software Support - ROUSSET - +//----------------------------------------------------------------------------- +// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +//----------------------------------------------------------------------------- +// File Name : Cstartup_SAM7.c +// Object : Low level initialisations written in C for Tools +// For AT91SAM7X256 with 2 flash plane +// Creation : JPP 14-Sep-2006 +//----------------------------------------------------------------------------- + +#include "project.h" + + +// The following functions must be write in ARM mode this function called +// directly by exception vector +extern void AT91F_Spurious_handler(void); +extern void AT91F_Default_IRQ_handler(void); +extern void AT91F_Default_FIQ_handler(void); + +//*---------------------------------------------------------------------------- +//* \fn AT91F_LowLevelInit +//* \brief This function performs very low level HW initialization +//* this function can use a Stack, depending the compilation +//* optimization mode +//*---------------------------------------------------------------------------- +void AT91F_LowLevelInit(void) @ "ICODE" +{ + unsigned char i; + /////////////////////////////////////////////////////////////////////////// + // EFC Init + /////////////////////////////////////////////////////////////////////////// + AT91C_BASE_MC->MC_FMR = AT91C_MC_FWS_1FWS ; + + /////////////////////////////////////////////////////////////////////////// + // Init PMC Step 1. Enable Main Oscillator + // Main Oscillator startup time is board specific: + // Main Oscillator Startup Time worst case (3MHz) corresponds to 15ms + // (0x40 for AT91C_CKGR_OSCOUNT field) + /////////////////////////////////////////////////////////////////////////// + AT91C_BASE_PMC->PMC_MOR = (( AT91C_CKGR_OSCOUNT & (0x40 <<8) | AT91C_CKGR_MOSCEN )); + // Wait Main Oscillator stabilization + while(!(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MOSCS)); + + /////////////////////////////////////////////////////////////////////////// + // Init PMC Step 2. + // Set PLL to 96MHz (96,109MHz) and UDP Clock to 48MHz + // PLL Startup time depends on PLL RC filter: worst case is choosen + // UDP Clock (48,058MHz) is compliant with the Universal Serial Bus + // Specification (+/- 0.25% for full speed) + /////////////////////////////////////////////////////////////////////////// + AT91C_BASE_PMC->PMC_PLLR = AT91C_CKGR_USBDIV_1 | + (16 << 8) | + (AT91C_CKGR_MUL & (72 << 16)) | + (AT91C_CKGR_DIV & 14); + // Wait for PLL stabilization + while( !(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_LOCK) ); + // Wait until the master clock is established for the case we already + // turn on the PLL + while( !(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MCKRDY) ); + + /////////////////////////////////////////////////////////////////////////// + // Init PMC Step 3. + // Selection of Master Clock MCK equal to (Processor Clock PCK) PLL/2=48MHz + // The PMC_MCKR register must not be programmed in a single write operation + // (see. Product Errata Sheet) + /////////////////////////////////////////////////////////////////////////// + AT91C_BASE_PMC->PMC_MCKR = AT91C_PMC_PRES_CLK_2; + // Wait until the master clock is established + while( !(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MCKRDY) ); + + AT91C_BASE_PMC->PMC_MCKR |= AT91C_PMC_CSS_PLL_CLK; + // Wait until the master clock is established + while( !(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MCKRDY) ); + + /////////////////////////////////////////////////////////////////////////// + // Disable Watchdog (write once register) + /////////////////////////////////////////////////////////////////////////// + AT91C_BASE_WDTC->WDTC_WDMR = AT91C_WDTC_WDDIS; + + /////////////////////////////////////////////////////////////////////////// + // Init AIC: assign corresponding handler for each interrupt source + /////////////////////////////////////////////////////////////////////////// + AT91C_BASE_AIC->AIC_SVR[0] = (int) AT91F_Default_FIQ_handler ; + for (i = 1; i < 31; i++) { + AT91C_BASE_AIC->AIC_SVR[i] = (int) AT91F_Default_IRQ_handler ; + } + AT91C_BASE_AIC->AIC_SPU = (unsigned int) AT91F_Spurious_handler; +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/lib/cmock.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/lib/cmock.rb new file mode 100644 index 0000000..e332351 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/lib/cmock.rb @@ -0,0 +1,65 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +[ "../config/production_environment", + "cmock_header_parser", + "cmock_generator", + "cmock_file_writer", + "cmock_config", + "cmock_plugin_manager", + "cmock_generator_utils", + "cmock_unityhelper_parser"].each {|req| require "#{File.expand_path(File.dirname(__FILE__))}/#{req}"} + +class CMock + + def initialize(options=nil) + cm_config = CMockConfig.new(options) + cm_unityhelper = CMockUnityHelperParser.new(cm_config) + cm_writer = CMockFileWriter.new(cm_config) + cm_gen_utils = CMockGeneratorUtils.new(cm_config, {:unity_helper => cm_unityhelper}) + cm_gen_plugins = CMockPluginManager.new(cm_config, cm_gen_utils) + @cm_parser = CMockHeaderParser.new(cm_config) + @cm_generator = CMockGenerator.new(cm_config, cm_writer, cm_gen_utils, cm_gen_plugins) + @silent = (cm_config.verbosity < 2) + end + + def setup_mocks(files) + [files].flatten.each do |src| + generate_mock src + end + end + + private ############################### + + def generate_mock(src) + name = File.basename(src, '.h') + puts "Creating mock for #{name}..." unless @silent + @cm_generator.create_mock(name, @cm_parser.parse(name, File.read(src))) + end +end + + # Command Line Support ############################### + +if ($0 == __FILE__) + usage = "usage: ruby #{__FILE__} (-oOptionsFile) File(s)ToMock" + + if (!ARGV[0]) + puts usage + exit 1 + end + + options = nil + filelist = [] + ARGV.each do |arg| + if (arg =~ /^-o(\w*)/) + options = arg.gsub(/^-o/,'') + else + filelist << arg + end + end + + CMock.new(options).setup_mocks(filelist) +end \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/lib/cmock_config.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/lib/cmock_config.rb new file mode 100644 index 0000000..d574a70 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/lib/cmock_config.rb @@ -0,0 +1,123 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +class CMockConfig + + CMockDefaultOptions = + { + :framework => :unity, + :mock_path => 'mocks', + :mock_prefix => 'Mock', + :plugins => [], + :strippables => ['(?:__attribute__\s*\(+.*?\)+)'], + :attributes => ['__ramfunc', '__irq', '__fiq', 'register', 'extern'], + :enforce_strict_ordering => false, + :unity_helper => false, + :treat_as => {}, + :treat_as_void => [], + :memcmp_if_unknown => true, + :when_no_prototypes => :warn, #the options being :ignore, :warn, or :error + :when_ptr => :compare_data, #the options being :compare_ptr, :compare_data, or :smart + :verbosity => 2, #the options being 0 errors only, 1 warnings and errors, 2 normal info, 3 verbose + :treat_externs => :exclude, #the options being :include or :exclude + :ignore => :args_and_calls, #the options being :args_and_calls or :args_only + :callback_include_count => true, + :callback_after_arg_check => false, + :includes => nil, + :includes_h_pre_orig_header => nil, + :includes_h_post_orig_header => nil, + :includes_c_pre_header => nil, + :includes_c_post_header => nil, + } + + def initialize(options=nil) + case(options) + when NilClass then options = CMockDefaultOptions.clone + when String then options = CMockDefaultOptions.clone.merge(load_config_file_from_yaml(options)) + when Hash then options = CMockDefaultOptions.clone.merge(options) + else raise "If you specify arguments, it should be a filename or a hash of options" + end + + #do some quick type verification + [:plugins, :attributes, :treat_as_void].each do |opt| + unless (options[opt].class == Array) + options[opt] = [] + puts "WARNING: :#{opt.to_s} should be an array." unless (options[:verbosity] < 1) + end + end + [:includes, :includes_h_pre_orig_header, :includes_h_post_orig_header, :includes_c_pre_header, :includes_c_post_header].each do |opt| + unless (options[opt].nil? or (options[opt].class == Array)) + options[opt] = [] + puts "WARNING: :#{opt.to_s} should be an array." unless (options[:verbosity] < 1) + end + end + options[:plugins].compact! + options[:plugins].map! {|p| p.to_sym} + @options = options + @options[:treat_as].merge!(standard_treat_as_map) + @options.each_key { |key| eval("def #{key.to_s}() return @options[:#{key.to_s}] end") } + end + + def load_config_file_from_yaml yaml_filename + require 'yaml' + require 'fileutils' + YAML.load_file(yaml_filename)[:cmock] + end + + def set_path(path) + @src_path = path + end + + def load_unity_helper + return File.new(@options[:unity_helper]).read if (@options[:unity_helper]) + return nil + end + + def standard_treat_as_map + { + 'int' => 'INT', + 'char' => 'INT8', + 'short' => 'INT16', + 'long' => 'INT', + 'int8' => 'INT8', + 'int16' => 'INT16', + 'int32' => 'INT', + 'int8_t' => 'INT8', + 'int16_t' => 'INT16', + 'int32_t' => 'INT', + 'INT8_T' => 'INT8', + 'INT16_T' => 'INT16', + 'INT32_T' => 'INT', + 'bool' => 'INT', + 'bool_t' => 'INT', + 'BOOL' => 'INT', + 'BOOL_T' => 'INT', + 'unsigned int' => 'HEX32', + 'unsigned long' => 'HEX32', + 'uint32' => 'HEX32', + 'uint32_t' => 'HEX32', + 'UINT32' => 'HEX32', + 'UINT32_T' => 'HEX32', + 'void*' => 'PTR', + 'unsigned short' => 'HEX16', + 'uint16' => 'HEX16', + 'uint16_t' => 'HEX16', + 'UINT16' => 'HEX16', + 'UINT16_T' => 'HEX16', + 'unsigned char' => 'HEX8', + 'uint8' => 'HEX8', + 'uint8_t' => 'HEX8', + 'UINT8' => 'HEX8', + 'UINT8_T' => 'HEX8', + 'char*' => 'STRING', + 'pCHAR' => 'STRING', + 'cstring' => 'STRING', + 'CSTRING' => 'STRING', + 'float' => 'FLOAT', + 'double' => 'FLOAT', + } + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/lib/cmock_file_writer.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/lib/cmock_file_writer.rb new file mode 100644 index 0000000..63faee5 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/lib/cmock_file_writer.rb @@ -0,0 +1,33 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +class CMockFileWriter + + attr_reader :config + + def initialize(config) + @config = config + end + + def create_file(filename) + raise "Where's the block of data to create?" unless block_given? + full_file_name_temp = "#{@config.mock_path}/#{filename}.new" + full_file_name_done = "#{@config.mock_path}/#{filename}" + File.open(full_file_name_temp, 'w') do |file| + yield(file, filename) + end + update_file(full_file_name_done, full_file_name_temp) + end + + private ################################### + + def update_file(dest, src) + require 'fileutils' + FileUtils.rm(dest) if (File.exist?(dest)) + FileUtils.cp(src, dest) + FileUtils.rm(src) + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/lib/cmock_generator.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/lib/cmock_generator.rb new file mode 100644 index 0000000..5f483ba --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/lib/cmock_generator.rb @@ -0,0 +1,196 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +$here = File.dirname __FILE__ + +class CMockGenerator + + attr_accessor :config, :file_writer, :module_name, :mock_name, :utils, :plugins, :ordered + + def initialize(config, file_writer, utils, plugins) + @file_writer = file_writer + @utils = utils + @plugins = plugins + @config = config + @prefix = @config.mock_prefix + @ordered = @config.enforce_strict_ordering + @framework = @config.framework.to_s + + @includes_h_pre_orig_header = (@config.includes || @config.includes_h_pre_orig_header || []).map{|h| h =~ /\n" + file << "#include \n" + file << "#include \n" + file << "#include \"#{@framework}.h\"\n" + file << "#include \"cmock.h\"\n" + @includes_c_pre_header.each {|inc| file << "#include #{inc}\n"} + file << "#include \"#{header_file}\"\n" + @includes_c_post_header.each {|inc| file << "#include #{inc}\n"} + file << "\n" + end + + def create_instance_structure(file, functions) + functions.each do |function| + file << "typedef struct _CMOCK_#{function[:name]}_CALL_INSTANCE\n{\n" + file << " UNITY_LINE_TYPE LineNumber;\n" + file << @plugins.run(:instance_typedefs, function) + file << "\n} CMOCK_#{function[:name]}_CALL_INSTANCE;\n\n" + end + file << "static struct #{@mock_name}Instance\n{\n" + if (functions.size == 0) + file << " unsigned char placeHolder;\n" + end + functions.each do |function| + file << @plugins.run(:instance_structure, function) + file << " CMOCK_MEM_INDEX_TYPE #{function[:name]}_CallInstance;\n" + end + file << "} Mock;\n\n" + end + + def create_extern_declarations(file) + file << "extern jmp_buf AbortFrame;\n" + if (@ordered) + file << "extern int GlobalExpectCount;\n" + file << "extern int GlobalVerifyOrder;\n" + end + file << "\n" + end + + def create_mock_verify_function(file, functions) + file << "void #{@mock_name}_Verify(void)\n{\n" + verifications = functions.collect {|function| @plugins.run(:mock_verify, function)}.join + file << " UNITY_LINE_TYPE cmock_line = TEST_LINE_NUM;\n" unless verifications.empty? + file << verifications + file << "}\n\n" + end + + def create_mock_init_function(file) + file << "void #{@mock_name}_Init(void)\n{\n" + file << " #{@mock_name}_Destroy();\n" + file << "}\n\n" + end + + def create_mock_destroy_function(file, functions) + file << "void #{@mock_name}_Destroy(void)\n{\n" + file << " CMock_Guts_MemFreeAll();\n" + file << " memset(&Mock, 0, sizeof(Mock));\n" + file << functions.collect {|function| @plugins.run(:mock_destroy, function)}.join + if (@ordered) + file << " GlobalExpectCount = 0;\n" + file << " GlobalVerifyOrder = 0;\n" + end + file << "}\n\n" + end + + def create_mock_implementation(file, function) + # prepare return value and arguments + if (function[:modifier].empty?) + function_mod_and_rettype = function[:return][:type] + else + function_mod_and_rettype = function[:modifier] + ' ' + function[:return][:type] + end + args_string = function[:args_string] + args_string += (", " + function[:var_arg]) unless (function[:var_arg].nil?) + + # Create mock function + file << "#{function_mod_and_rettype} #{function[:name]}(#{args_string})\n" + file << "{\n" + file << " UNITY_LINE_TYPE cmock_line = TEST_LINE_NUM;\n" + file << " CMOCK_#{function[:name]}_CALL_INSTANCE* cmock_call_instance = (CMOCK_#{function[:name]}_CALL_INSTANCE*)CMock_Guts_GetAddressFor(Mock.#{function[:name]}_CallInstance);\n" + file << " Mock.#{function[:name]}_CallInstance = CMock_Guts_MemNext(Mock.#{function[:name]}_CallInstance);\n" + file << @plugins.run(:mock_implementation_precheck, function) + file << " UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, \"Function '#{function[:name]}' called more times than expected.\");\n" + file << " cmock_line = cmock_call_instance->LineNumber;\n" + if (@ordered) + file << " if (cmock_call_instance->CallOrder > ++GlobalVerifyOrder)\n" + file << " UNITY_TEST_FAIL(cmock_line, \"Function '#{function[:name]}' called earlier than expected.\");" + file << " if (cmock_call_instance->CallOrder < GlobalVerifyOrder)\n" + file << " UNITY_TEST_FAIL(cmock_line, \"Function '#{function[:name]}' called later than expected.\");" + # file << " UNITY_TEST_ASSERT((cmock_call_instance->CallOrder == ++GlobalVerifyOrder), cmock_line, \"Out of order function calls. Function '#{function[:name]}'\");\n" + end + file << @plugins.run(:mock_implementation, function) + file << " return cmock_call_instance->ReturnVal;\n" unless (function[:return][:void?]) + file << "}\n\n" + end + + def create_mock_interfaces(file, function) + file << @utils.code_add_argument_loader(function) + file << @plugins.run(:mock_interfaces, function) + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_array.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_array.rb new file mode 100644 index 0000000..25045a2 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_array.rb @@ -0,0 +1,57 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +class CMockGeneratorPluginArray + + attr_reader :priority + attr_accessor :config, :utils, :unity_helper, :ordered + def initialize(config, utils) + @config = config + @ptr_handling = @config.when_ptr + @ordered = @config.enforce_strict_ordering + @utils = utils + @unity_helper = @utils.helpers[:unity_helper] + @priority = 8 + end + + def instance_typedefs(function) + function[:args].inject("") do |all, arg| + (arg[:ptr?]) ? all + " int Expected_#{arg[:name]}_Depth;\n" : all + end + end + + def mock_function_declarations(function) + return nil unless function[:contains_ptr?] + args_call = function[:args].map{|m| m[:ptr?] ? "#{m[:name]}, #{m[:name]}_Depth" : "#{m[:name]}"}.join(', ') + args_string = function[:args].map{|m| m[:ptr?] ? "#{m[:type]} #{m[:name]}, int #{m[:name]}_Depth" : "#{m[:type]} #{m[:name]}"}.join(', ') + if (function[:return][:void?]) + return "#define #{function[:name]}_ExpectWithArray(#{args_call}) #{function[:name]}_CMockExpectWithArray(__LINE__, #{args_call})\n" + + "void #{function[:name]}_CMockExpectWithArray(UNITY_LINE_TYPE cmock_line, #{args_string});\n" + else + return "#define #{function[:name]}_ExpectWithArrayAndReturn(#{args_call}, cmock_retval) #{function[:name]}_CMockExpectWithArrayAndReturn(__LINE__, #{args_call}, cmock_retval)\n" + + "void #{function[:name]}_CMockExpectWithArrayAndReturn(UNITY_LINE_TYPE cmock_line, #{args_string}, #{function[:return][:str]});\n" + end + end + + def mock_interfaces(function) + return nil unless function[:contains_ptr?] + lines = [] + func_name = function[:name] + args_string = function[:args].map{|m| m[:ptr?] ? "#{m[:type]} #{m[:name]}, int #{m[:name]}_Depth" : "#{m[:type]} #{m[:name]}"}.join(', ') + call_string = function[:args].map{|m| m[:ptr?] ? "#{m[:name]}, #{m[:name]}_Depth" : m[:name]}.join(', ') + if (function[:return][:void?]) + lines << "void #{func_name}_CMockExpectWithArray(UNITY_LINE_TYPE cmock_line, #{args_string})\n" + else + lines << "void #{func_name}_CMockExpectWithArrayAndReturn(UNITY_LINE_TYPE cmock_line, #{args_string}, #{function[:return][:str]})\n" + end + lines << "{\n" + lines << @utils.code_add_base_expectation(func_name) + lines << " CMockExpectParameters_#{func_name}(cmock_call_instance, #{call_string});\n" + lines << " cmock_call_instance->ReturnVal = cmock_to_return;\n" unless (function[:return][:void?]) + lines << "}\n\n" + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_callback.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_callback.rb new file mode 100644 index 0000000..0db9b36 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_callback.rb @@ -0,0 +1,78 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +class CMockGeneratorPluginCallback + + attr_accessor :include_count + attr_reader :priority + attr_reader :config, :utils + + def initialize(config, utils) + @config = config + @utils = utils + @priority = 6 + + @include_count = @config.callback_include_count + if (@config.callback_after_arg_check) + alias :mock_implementation :mock_implementation_for_callbacks + alias :mock_implementation_precheck :nothing + else + alias :mock_implementation_precheck :mock_implementation_for_callbacks + alias :mock_implementation :nothing + end + end + + def instance_structure(function) + func_name = function[:name] + " CMOCK_#{func_name}_CALLBACK #{func_name}_CallbackFunctionPointer;\n" + + " int #{func_name}_CallbackCalls;\n" + end + + def mock_function_declarations(function) + func_name = function[:name] + return_type = function[:return][:const?] ? "const #{function[:return][:type]}" : function[:return][:type] + style = (@include_count ? 1 : 0) | (function[:args].empty? ? 0 : 2) + styles = [ "void", "int cmock_num_calls", function[:args_string], "#{function[:args_string]}, int cmock_num_calls" ] + "typedef #{return_type} (* CMOCK_#{func_name}_CALLBACK)(#{styles[style]});\nvoid #{func_name}_StubWithCallback(CMOCK_#{func_name}_CALLBACK Callback);\n" + end + + def mock_implementation_for_callbacks(function) + func_name = function[:name] + style = (@include_count ? 1 : 0) | (function[:args].empty? ? 0 : 2) | (function[:return][:void?] ? 0 : 4) + " if (Mock.#{func_name}_CallbackFunctionPointer != NULL)\n {\n" + + case(style) + when 0 then " Mock.#{func_name}_CallbackFunctionPointer();\n return;\n }\n" + when 1 then " Mock.#{func_name}_CallbackFunctionPointer(Mock.#{func_name}_CallbackCalls++);\n return;\n }\n" + when 2 then " Mock.#{func_name}_CallbackFunctionPointer(#{function[:args].map{|m| m[:name]}.join(', ')});\n return;\n }\n" + when 3 then " Mock.#{func_name}_CallbackFunctionPointer(#{function[:args].map{|m| m[:name]}.join(', ')}, Mock.#{func_name}_CallbackCalls++);\n return;\n }\n" + when 4 then " return Mock.#{func_name}_CallbackFunctionPointer(void);\n }\n" + when 5 then " return Mock.#{func_name}_CallbackFunctionPointer(Mock.#{func_name}_CallbackCalls++);\n }\n" + when 6 then " return Mock.#{func_name}_CallbackFunctionPointer(#{function[:args].map{|m| m[:name]}.join(', ')});\n }\n" + when 7 then " return Mock.#{func_name}_CallbackFunctionPointer(#{function[:args].map{|m| m[:name]}.join(', ')}, Mock.#{func_name}_CallbackCalls++);\n }\n" + end + end + + def nothing(function) + return "" + end + + def mock_interfaces(function) + func_name = function[:name] + "void #{func_name}_StubWithCallback(CMOCK_#{func_name}_CALLBACK Callback)\n{\n" + + " Mock.#{func_name}_CallbackFunctionPointer = Callback;\n}\n\n" + end + + def mock_destroy(function) + " Mock.#{function[:name]}_CallbackFunctionPointer = NULL;\n" + + " Mock.#{function[:name]}_CallbackCalls = 0;\n" + end + + def mock_verify(function) + func_name = function[:name] + " if (Mock.#{func_name}_CallbackFunctionPointer != NULL)\n Mock.#{func_name}_CallInstance = CMOCK_GUTS_NONE;\n" + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_cexception.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_cexception.rb new file mode 100644 index 0000000..fdf31db --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_cexception.rb @@ -0,0 +1,51 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +class CMockGeneratorPluginCexception + + attr_reader :priority + attr_reader :config, :utils + + def initialize(config, utils) + @config = config + @utils = utils + @priority = 7 + end + + def include_files + return "#include \"CException.h\"\n" + end + + def instance_typedefs(function) + " CEXCEPTION_T ExceptionToThrow;\n" + end + + def mock_function_declarations(function) + if (function[:args_string] == "void") + return "#define #{function[:name]}_ExpectAndThrow(cmock_to_throw) #{function[:name]}_CMockExpectAndThrow(__LINE__, cmock_to_throw)\n" + + "void #{function[:name]}_CMockExpectAndThrow(UNITY_LINE_TYPE cmock_line, CEXCEPTION_T cmock_to_throw);\n" + else + return "#define #{function[:name]}_ExpectAndThrow(#{function[:args_call]}, cmock_to_throw) #{function[:name]}_CMockExpectAndThrow(__LINE__, #{function[:args_call]}, cmock_to_throw)\n" + + "void #{function[:name]}_CMockExpectAndThrow(UNITY_LINE_TYPE cmock_line, #{function[:args_string]}, CEXCEPTION_T cmock_to_throw);\n" + end + end + + def mock_implementation(function) + " if (cmock_call_instance->ExceptionToThrow != CEXCEPTION_NONE)\n {\n" + + " Throw(cmock_call_instance->ExceptionToThrow);\n }\n" + end + + def mock_interfaces(function) + arg_insert = (function[:args_string] == "void") ? "" : "#{function[:args_string]}, " + call_string = function[:args].map{|m| m[:name]}.join(', ') + [ "void #{function[:name]}_CMockExpectAndThrow(UNITY_LINE_TYPE cmock_line, #{arg_insert}CEXCEPTION_T cmock_to_throw)\n{\n", + @utils.code_add_base_expectation(function[:name]), + @utils.code_call_argument_loader(function), + " cmock_call_instance->ExceptionToThrow = cmock_to_throw;\n", + "}\n\n" ].join + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_expect.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_expect.rb new file mode 100644 index 0000000..5651cd9 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_expect.rb @@ -0,0 +1,86 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +class CMockGeneratorPluginExpect + + attr_reader :priority + attr_accessor :config, :utils, :unity_helper, :ordered + + def initialize(config, utils) + @config = config + @ptr_handling = @config.when_ptr + @ordered = @config.enforce_strict_ordering + @utils = utils + @unity_helper = @utils.helpers[:unity_helper] + @priority = 5 + end + + def instance_typedefs(function) + lines = "" + lines << " #{function[:return][:type]} ReturnVal;\n" unless (function[:return][:void?]) + lines << " int CallOrder;\n" if (@ordered) + function[:args].each do |arg| + lines << " #{arg[:type]} Expected_#{arg[:name]};\n" + end + lines + end + + def mock_function_declarations(function) + if (function[:args].empty?) + if (function[:return][:void?]) + return "#define #{function[:name]}_Expect() #{function[:name]}_CMockExpect(__LINE__)\n" + + "void #{function[:name]}_CMockExpect(UNITY_LINE_TYPE cmock_line);\n" + else + return "#define #{function[:name]}_ExpectAndReturn(cmock_retval) #{function[:name]}_CMockExpectAndReturn(__LINE__, cmock_retval)\n" + + "void #{function[:name]}_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, #{function[:return][:str]});\n" + end + else + if (function[:return][:void?]) + return "#define #{function[:name]}_Expect(#{function[:args_call]}) #{function[:name]}_CMockExpect(__LINE__, #{function[:args_call]})\n" + + "void #{function[:name]}_CMockExpect(UNITY_LINE_TYPE cmock_line, #{function[:args_string]});\n" + else + return "#define #{function[:name]}_ExpectAndReturn(#{function[:args_call]}, cmock_retval) #{function[:name]}_CMockExpectAndReturn(__LINE__, #{function[:args_call]}, cmock_retval)\n" + + "void #{function[:name]}_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, #{function[:args_string]}, #{function[:return][:str]});\n" + end + end + end + + def mock_implementation(function) + lines = "" + function[:args].each do |arg| + lines << @utils.code_verify_an_arg_expectation(function, arg) + end + lines + end + + def mock_interfaces(function) + lines = "" + func_name = function[:name] + if (function[:return][:void?]) + if (function[:args_string] == "void") + lines << "void #{func_name}_CMockExpect(UNITY_LINE_TYPE cmock_line)\n{\n" + else + lines << "void #{func_name}_CMockExpect(UNITY_LINE_TYPE cmock_line, #{function[:args_string]})\n{\n" + end + else + if (function[:args_string] == "void") + lines << "void #{func_name}_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, #{function[:return][:str]})\n{\n" + else + lines << "void #{func_name}_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, #{function[:args_string]}, #{function[:return][:str]})\n{\n" + end + end + lines << @utils.code_add_base_expectation(func_name) + lines << @utils.code_call_argument_loader(function) + lines << @utils.code_assign_argument_quickly("cmock_call_instance->ReturnVal", function[:return]) unless (function[:return][:void?]) + lines << "}\n\n" + end + + def mock_verify(function) + func_name = function[:name] + " UNITY_TEST_ASSERT(CMOCK_GUTS_NONE == Mock.#{func_name}_CallInstance, cmock_line, \"Function '#{func_name}' called less times than expected.\");\n" + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_ignore.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_ignore.rb new file mode 100644 index 0000000..a81933d --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_ignore.rb @@ -0,0 +1,85 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +class CMockGeneratorPluginIgnore + + attr_reader :priority + attr_reader :config, :utils + + def initialize(config, utils) + @config = config + if (@config.ignore == :args_and_calls) + alias :mock_implementation_precheck :mock_implementation_for_ignores + alias :mock_implementation :nothing + alias :mock_verify :mock_conditionally_verify_counts + else + alias :mock_implementation :mock_implementation_for_ignores + alias :mock_implementation_precheck :nothing + alias :mock_verify :nothing + end + @utils = utils + @priority = 2 + end + + def instance_structure(function) + if (function[:return][:void?]) + " int #{function[:name]}_IgnoreBool;\n" + else + " int #{function[:name]}_IgnoreBool;\n #{function[:return][:type]} #{function[:name]}_FinalReturn;\n" + end + end + + def mock_function_declarations(function) + if (function[:return][:void?]) + return "#define #{function[:name]}_Ignore() #{function[:name]}_CMockIgnore(__LINE__)\n" + + "void #{function[:name]}_CMockIgnore(UNITY_LINE_TYPE cmock_line);\n" + else + return "#define #{function[:name]}_IgnoreAndReturn(cmock_retval) #{function[:name]}_CMockIgnoreAndReturn(__LINE__, cmock_retval)\n" + + "void #{function[:name]}_CMockIgnoreAndReturn(UNITY_LINE_TYPE cmock_line, #{function[:return][:str]});\n" + end + end + + def mock_implementation_for_ignores(function) + lines = " if (Mock.#{function[:name]}_IgnoreBool)\n {\n" + if (function[:return][:void?]) + lines << " return;\n }\n" + else + retval = function[:return].merge( { :name => "cmock_call_instance->ReturnVal"} ) + lines << " if (cmock_call_instance == NULL)\n return Mock.#{function[:name]}_FinalReturn;\n" + lines << " " + @utils.code_assign_argument_quickly("Mock.#{function[:name]}_FinalReturn", retval) unless (retval[:void?]) + lines << " return cmock_call_instance->ReturnVal;\n }\n" + end + lines + end + + def mock_interfaces(function) + lines = "" + if (function[:return][:void?]) + lines << "void #{function[:name]}_CMockIgnore(UNITY_LINE_TYPE cmock_line)\n{\n" + else + lines << "void #{function[:name]}_CMockIgnoreAndReturn(UNITY_LINE_TYPE cmock_line, #{function[:return][:str]})\n{\n" + end + if (@config.ignore == :args_only) + lines << @utils.code_add_base_expectation(function[:name], true) + elsif (!function[:return][:void?]) + lines << @utils.code_add_base_expectation(function[:name], false) + end + unless (function[:return][:void?]) + lines << " cmock_call_instance->ReturnVal = cmock_to_return;\n" + end + lines << " Mock.#{function[:name]}_IgnoreBool = (int)1;\n" + lines << "}\n\n" + end + + def mock_conditionally_verify_counts(function) + func_name = function[:name] + " if (Mock.#{func_name}_IgnoreBool)\n Mock.#{func_name}_CallInstance = CMOCK_GUTS_NONE;\n" + end + + def nothing(function) + return "" + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/lib/cmock_generator_utils.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/lib/cmock_generator_utils.rb new file mode 100644 index 0000000..4444979 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/lib/cmock_generator_utils.rb @@ -0,0 +1,177 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +class CMockGeneratorUtils + + attr_accessor :config, :helpers, :ordered, :ptr_handling, :arrays, :cexception + + def initialize(config, helpers={}) + @config = config + @ptr_handling = @config.when_ptr + @ordered = @config.enforce_strict_ordering + @arrays = @config.plugins.include? :array + @cexception = @config.plugins.include? :cexception + @treat_as = @config.treat_as + @helpers = helpers + + if (@arrays) + case(@ptr_handling) + when :smart then alias :code_verify_an_arg_expectation :code_verify_an_arg_expectation_with_smart_arrays + when :compare_data then alias :code_verify_an_arg_expectation :code_verify_an_arg_expectation_with_normal_arrays + when :compare_ptr then raise "ERROR: the array plugin doesn't enjoy working with :compare_ptr only. Disable one option." + end + else + alias :code_verify_an_arg_expectation :code_verify_an_arg_expectation_with_no_arrays + end + end + + def code_add_base_expectation(func_name, global_ordering_supported=true) + lines = " CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_#{func_name}_CALL_INSTANCE));\n" + lines << " CMOCK_#{func_name}_CALL_INSTANCE* cmock_call_instance = (CMOCK_#{func_name}_CALL_INSTANCE*)CMock_Guts_GetAddressFor(cmock_guts_index);\n" + lines << " UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, \"CMock has run out of memory. Please allocate more.\");\n" + lines << " Mock.#{func_name}_CallInstance = CMock_Guts_MemChain(Mock.#{func_name}_CallInstance, cmock_guts_index);\n" + lines << " cmock_call_instance->LineNumber = cmock_line;\n" + lines << " cmock_call_instance->CallOrder = ++GlobalExpectCount;\n" if (@ordered and global_ordering_supported) + lines << " cmock_call_instance->ExceptionToThrow = CEXCEPTION_NONE;\n" if (@cexception) + lines + end + + def code_add_an_arg_expectation(arg, depth=1) + lines = code_assign_argument_quickly("cmock_call_instance->Expected_#{arg[:name]}", arg) + lines << " cmock_call_instance->Expected_#{arg[:name]}_Depth = #{arg[:name]}_Depth;\n" if (@arrays and (depth.class == String)) + lines + end + + def code_assign_argument_quickly(dest, arg) + if (arg[:ptr?] or @treat_as.include?(arg[:type])) + " #{dest} = #{arg[:const?] ? "(#{arg[:type]})" : ''}#{arg[:name]};\n" + else + " memcpy(&#{dest}, &#{arg[:name]}, sizeof(#{arg[:type]}));\n" + end + end + + def code_add_argument_loader(function) + if (function[:args_string] != "void") + if (@arrays) + args_string = function[:args].map do |m| + const_str = m[ :const? ] ? 'const ' : '' + m[:ptr?] ? "#{const_str}#{m[:type]} #{m[:name]}, int #{m[:name]}_Depth" : "#{const_str}#{m[:type]} #{m[:name]}" + end.join(', ') + "void CMockExpectParameters_#{function[:name]}(CMOCK_#{function[:name]}_CALL_INSTANCE* cmock_call_instance, #{args_string})\n{\n" + + function[:args].inject("") { |all, arg| all + code_add_an_arg_expectation(arg, (arg[:ptr?] ? "#{arg[:name]}_Depth" : 1) ) } + + "}\n\n" + else + "void CMockExpectParameters_#{function[:name]}(CMOCK_#{function[:name]}_CALL_INSTANCE* cmock_call_instance, #{function[:args_string]})\n{\n" + + function[:args].inject("") { |all, arg| all + code_add_an_arg_expectation(arg) } + + "}\n\n" + end + else + "" + end + end + + def code_call_argument_loader(function) + if (function[:args_string] != "void") + args = function[:args].map do |m| + (@arrays and m[:ptr?]) ? "#{m[:name]}, 1" : m[:name] + end + " CMockExpectParameters_#{function[:name]}(cmock_call_instance, #{args.join(', ')});\n" + else + "" + end + end + + #private ###################### + + def lookup_expect_type(function, arg) + c_type = arg[:type] + arg_name = arg[:name] + expected = "cmock_call_instance->Expected_#{arg_name}" + unity_func = if ((arg[:ptr?]) and ((c_type =~ /\*\*/) or (@ptr_handling == :compare_ptr))) + ['UNITY_TEST_ASSERT_EQUAL_PTR', ''] + else + (@helpers.nil? or @helpers[:unity_helper].nil?) ? ["UNITY_TEST_ASSERT_EQUAL",''] : @helpers[:unity_helper].get_helper(c_type) + end + unity_msg = "Function '#{function[:name]}' called with unexpected value for argument '#{arg_name}'." + return c_type, arg_name, expected, unity_func[0], unity_func[1], unity_msg + end + + def code_verify_an_arg_expectation_with_no_arrays(function, arg) + c_type, arg_name, expected, unity_func, pre, unity_msg = lookup_expect_type(function, arg) + case(unity_func) + when "UNITY_TEST_ASSERT_EQUAL_MEMORY" + c_type_local = c_type.gsub(/\*$/,'') + return " UNITY_TEST_ASSERT_EQUAL_MEMORY((void*)(#{pre}#{expected}), (void*)(#{pre}#{arg_name}), sizeof(#{c_type_local}), cmock_line, \"#{unity_msg}\");\n" + when "UNITY_TEST_ASSERT_EQUAL_MEMORY" + [ " if (#{pre}#{expected} == NULL)", + " { UNITY_TEST_ASSERT_NULL(#{pre}#{arg_name}, cmock_line, \"Expected NULL. #{unity_msg}\"); }", + " else", + " { UNITY_TEST_ASSERT_EQUAL_MEMORY((void*)(#{pre}#{expected}), (void*)(#{pre}#{arg_name}), sizeof(#{c_type.sub('*','')}), cmock_line, \"#{unity_msg}\"); }\n"].join("\n") + when /_ARRAY/ + [ " if (#{pre}#{expected} == NULL)", + " { UNITY_TEST_ASSERT_NULL(#{pre}#{arg_name}, cmock_line, \"Expected NULL. #{unity_msg}\"); }", + " else", + " { #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, 1, cmock_line, \"#{unity_msg}\"); }\n"].join("\n") + else + return " #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, cmock_line, \"#{unity_msg}\");\n" + end + end + + def code_verify_an_arg_expectation_with_normal_arrays(function, arg) + c_type, arg_name, expected, unity_func, pre, unity_msg = lookup_expect_type(function, arg) + depth_name = (arg[:ptr?]) ? "cmock_call_instance->Expected_#{arg_name}_Depth" : 1 + case(unity_func) + when "UNITY_TEST_ASSERT_EQUAL_MEMORY" + c_type_local = c_type.gsub(/\*$/,'') + return " UNITY_TEST_ASSERT_EQUAL_MEMORY((void*)(#{pre}#{expected}), (void*)(#{pre}#{arg_name}), sizeof(#{c_type_local}), cmock_line, \"#{unity_msg}\");\n" + when "UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY" + [ " if (#{pre}#{expected} == NULL)", + " { UNITY_TEST_ASSERT_NULL(#{pre}#{arg_name}, cmock_line, \"Expected NULL. #{unity_msg}\"); }", + " else", + " { UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY((void*)(#{pre}#{expected}), (void*)(#{pre}#{arg_name}), sizeof(#{c_type.sub('*','')}), #{depth_name}, cmock_line, \"#{unity_msg}\"); }\n"].compact.join("\n") + when /_ARRAY/ + if (pre == '&') + " #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, #{depth_name}, cmock_line, \"#{unity_msg}\");\n" + else + [ " if (#{pre}#{expected} == NULL)", + " { UNITY_TEST_ASSERT_NULL(#{pre}#{arg_name}, cmock_line, \"Expected NULL. #{unity_msg}\"); }", + " else", + " { #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, #{depth_name}, cmock_line, \"#{unity_msg}\"); }\n"].compact.join("\n") + end + else + return " #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, cmock_line, \"#{unity_msg}\");\n" + end + end + + def code_verify_an_arg_expectation_with_smart_arrays(function, arg) + c_type, arg_name, expected, unity_func, pre, unity_msg = lookup_expect_type(function, arg) + depth_name = (arg[:ptr?]) ? "cmock_call_instance->Expected_#{arg_name}_Depth" : 1 + case(unity_func) + when "UNITY_TEST_ASSERT_EQUAL_MEMORY" + c_type_local = c_type.gsub(/\*$/,'') + return " UNITY_TEST_ASSERT_EQUAL_MEMORY((void*)(#{pre}#{expected}), (void*)(#{pre}#{arg_name}), sizeof(#{c_type_local}), cmock_line, \"#{unity_msg}\");\n" + when "UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY" + [ " if (#{pre}#{expected} == NULL)", + " { UNITY_TEST_ASSERT_NULL(#{arg_name}, cmock_line, \"Expected NULL. #{unity_msg}\"); }", + ((depth_name != 1) ? " else if (#{depth_name} == 0)\n { UNITY_TEST_ASSERT_EQUAL_PTR(#{pre}#{expected}, #{pre}#{arg_name}, cmock_line, \"#{unity_msg}\"); }" : nil), + " else", + " { UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY((void*)(#{pre}#{expected}), (void*)(#{pre}#{arg_name}), sizeof(#{c_type.sub('*','')}), #{depth_name}, cmock_line, \"#{unity_msg}\"); }\n"].compact.join("\n") + when /_ARRAY/ + if (pre == '&') + " #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, #{depth_name}, cmock_line, \"#{unity_msg}\");\n" + else + [ " if (#{pre}#{expected} == NULL)", + " { UNITY_TEST_ASSERT_NULL(#{pre}#{arg_name}, cmock_line, \"Expected NULL. #{unity_msg}\"); }", + ((depth_name != 1) ? " else if (#{depth_name} == 0)\n { UNITY_TEST_ASSERT_EQUAL_PTR(#{pre}#{expected}, #{pre}#{arg_name}, cmock_line, \"#{unity_msg}\"); }" : nil), + " else", + " { #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, #{depth_name}, cmock_line, \"#{unity_msg}\"); }\n"].compact.join("\n") + end + else + return " #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, cmock_line, \"#{unity_msg}\");\n" + end + end + +end \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/lib/cmock_header_parser.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/lib/cmock_header_parser.rb new file mode 100644 index 0000000..4ea9966 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/lib/cmock_header_parser.rb @@ -0,0 +1,270 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +class CMockHeaderParser + + attr_accessor :funcs, :c_attributes, :treat_as_void, :treat_externs + + def initialize(cfg) + @funcs = [] + @c_strippables = cfg.strippables + @c_attributes = (['const'] + cfg.attributes).uniq + @treat_as_void = (['void'] + cfg.treat_as_void).uniq + @declaration_parse_matcher = /([\d\w\s\*\(\),\[\]]+??)\(([\d\w\s\*\(\),\.\[\]+-]*)\)$/m + @standards = (['int','short','char','long','unsigned','signed'] + cfg.treat_as.keys).uniq + @when_no_prototypes = cfg.when_no_prototypes + @local_as_void = @treat_as_void + @verbosity = cfg.verbosity + @treat_externs = cfg.treat_externs + @c_strippables += ['extern'] if (@treat_externs == :include) #we'll need to remove the attribute if we're allowing externs + end + + def parse(name, source) + @module_name = name + @typedefs = [] + @funcs = [] + function_names = [] + + parse_functions( import_source(source) ).map do |decl| + func = parse_declaration(decl) + unless (function_names.include? func[:name]) + @funcs << func + function_names << func[:name] + end + end + + { :includes => nil, + :functions => @funcs, + :typedefs => @typedefs + } + end + + private if $ThisIsOnlyATest.nil? ################ + + def import_source(source) + + # void must be void for cmock _ExpectAndReturn calls to process properly, not some weird typedef which equates to void + # to a certain extent, this action assumes we're chewing on pre-processed header files, otherwise we'll most likely just get stuff from @treat_as_void + @local_as_void = @treat_as_void + void_types = source.scan(/typedef\s+(?:\(\s*)?void(?:\s*\))?\s+([\w\d]+)\s*;/) + if void_types + @local_as_void += void_types.flatten.uniq.compact + end + + # smush multiline macros into single line (checking for continuation character at end of line '\') + source.gsub!(/\s*\\\s*/m, ' ') + + #remove comments (block and line, in three steps to ensure correct precedence) + source.gsub!(/\/\/(?:.+\/\*|\*(?:$|[^\/])).*$/, '') # remove line comments that comment out the start of blocks + source.gsub!(/\/\*.*?\*\//m, '') # remove block comments + source.gsub!(/\/\/.*$/, '') # remove line comments (all that remain) + + # remove assembler pragma sections + source.gsub!(/^\s*#\s*pragma\s+asm\s+.*?#\s*pragma\s+endasm/m, '') + + # remove preprocessor statements and extern "C" + source.gsub!(/^\s*#.*/, '') + source.gsub!(/extern\s+\"C\"\s+\{/, '') + + # enums, unions, structs, and typedefs can all contain things (e.g. function pointers) that parse like function prototypes, so yank them + # forward declared structs are removed before struct definitions so they don't mess up real thing later. we leave structs keywords in function prototypes + source.gsub!(/^[\w\s]*struct[^;\{\}\(\)]+;/m, '') # remove forward declared structs + source.gsub!(/^[\w\s]*(enum|union|struct|typepdef)[\w\s]*\{[^\}]+\}[\w\s\*\,]*;/m, '') # remove struct, union, and enum definitions and typedefs with braces + source.gsub!(/(\W)(?:register|auto|static|restrict)(\W)/, '\1\2') # remove problem keywords + source.gsub!(/\s*=\s*['"a-zA-Z0-9_\.]+\s*/, '') # remove default value statements from argument lists + source.gsub!(/^(?:[\w\s]*\W)?typedef\W.*/, '') # remove typedef statements + source.gsub!(/(^|\W+)(?:#{@c_strippables.join('|')})(?=$|\W+)/,'\1') unless @c_strippables.empty? # remove known attributes slated to be stripped + + #scan for functions which return function pointers, because they are a pain + source.gsub!(/([\w\s\*]+)\(*\(\s*\*([\w\s\*]+)\s*\(([\w\s\*,]*)\)\)\s*\(([\w\s\*,]*)\)\)*/) do |m| + functype = "cmock_#{@module_name}_func_ptr#{@typedefs.size + 1}" + @typedefs << "typedef #{$1.strip}(*#{functype})(#{$4});" + "#{functype} #{$2.strip}(#{$3});" + end + + #drop extra white space to make the rest go faster + source.gsub!(/^\s+/, '') # remove extra white space from beginning of line + source.gsub!(/\s+$/, '') # remove extra white space from end of line + source.gsub!(/\s*\(\s*/, '(') # remove extra white space from before left parens + source.gsub!(/\s*\)\s*/, ')') # remove extra white space from before right parens + source.gsub!(/\s+/, ' ') # remove remaining extra white space + + #split lines on semicolons and remove things that are obviously not what we are looking for + src_lines = source.split(/\s*;\s*/) + src_lines.delete_if {|line| line.strip.length == 0} # remove blank lines + src_lines.delete_if {|line| !(line =~ /\(\s*\*(?:.*\[\d*\])??\s*\)/).nil?} #remove function pointer arrays + if (@treat_externs == :include) + src_lines.delete_if {|line| !(line =~ /(?:^|\s+)(?:inline)\s+/).nil?} #remove inline functions + else + src_lines.delete_if {|line| !(line =~ /(?:^|\s+)(?:extern|inline)\s+/).nil?} #remove inline and extern functions + end + end + + def parse_functions(source) + funcs = [] + source.each {|line| funcs << line.strip.gsub(/\s+/, ' ') if (line =~ @declaration_parse_matcher)} + if funcs.empty? + case @when_no_prototypes + when :error + raise "ERROR: No function prototypes found!" + when :warn + puts "WARNING: No function prototypes found!" unless (@verbosity < 1) + end + end + return funcs + end + + def parse_args(arg_list) + args = [] + arg_list.split(',').each do |arg| + arg.strip! + return args if (arg =~ /^\s*((\.\.\.)|(void))\s*$/) # we're done if we reach void by itself or ... + arg_array = arg.split + arg_elements = arg_array - @c_attributes # split up words and remove known attributes + args << { :type => (arg_type =arg_elements[0..-2].join(' ')), + :name => arg_elements[-1], + :ptr? => divine_ptr(arg_type), + :const? => arg_array.include?('const') + } + end + return args + end + + def divine_ptr(arg_type) + return false unless arg_type.include? '*' + return false if arg_type.gsub(/(const|char|\*|\s)+/,'').empty? + return true + end + + def clean_args(arg_list) + if ((@local_as_void.include?(arg_list.strip)) or (arg_list.empty?)) + return 'void' + else + c=0 + arg_list.gsub!(/(\w+)(?:\s*\[[\s\d\w+-]*\])+/,'*\1') # magically turn brackets into asterisks + arg_list.gsub!(/\s+\*/,'*') # remove space to place asterisks with type (where they belong) + arg_list.gsub!(/\*(\w)/,'* \1') # pull asterisks away from arg to place asterisks with type (where they belong) + + #scan argument list for function pointers and replace them with custom types + arg_list.gsub!(/([\w\s]+)\(*\(\s*\*([\w\s\*]+)\)\s*\(([\w\s\*,]*)\)\)*/) do |m| + functype = "cmock_#{@module_name}_func_ptr#{@typedefs.size + 1}" + funcret = $1.strip + funcname = $2.strip + funcargs = $3.strip + funconst = '' + if (funcname.include? 'const') + funcname.gsub!('const','').strip! + funconst = 'const ' + end + @typedefs << "typedef #{funcret}(*#{functype})(#{funcargs});" + funcname = "cmock_arg#{c+=1}" if (funcname.empty?) + "#{functype} #{funconst}#{funcname}" + end + + #automatically name unnamed arguments (those that only had a type) + arg_list.split(/\s*,\s*/).map { |arg| + parts = (arg.split - ['struct', 'union', 'enum', 'const', 'const*']) + if ((parts.size < 2) or (parts[-1][-1].chr == '*') or (@standards.include?(parts[-1]))) + "#{arg} cmock_arg#{c+=1}" + else + arg + end + }.join(', ') + end + end + + def parse_declaration(declaration) + decl = {} + + regex_match = @declaration_parse_matcher.match(declaration) + raise "Failed parsing function declaration: '#{declaration}'" if regex_match.nil? + + #grab argument list + args = regex_match[2].strip + + #process function attributes, return type, and name + descriptors = regex_match[1] + descriptors.gsub!(/\s+\*/,'*') #remove space to place asterisks with return type (where they belong) + descriptors.gsub!(/\*(\w)/,'* \1') #pull asterisks away from function name to place asterisks with return type (where they belong) + descriptors = descriptors.split #array of all descriptor strings + + #grab name + decl[:name] = descriptors[-1] #snag name as last array item + + #build attribute and return type strings + decl[:modifier] = [] + rettype = [] + descriptors[0..-2].each do |word| + if @c_attributes.include?(word) + decl[:modifier] << word + else + rettype << word + end + end + decl[:modifier] = decl[:modifier].join(' ') + rettype = rettype.join(' ') + rettype = 'void' if (@local_as_void.include?(rettype.strip)) + decl[:return] = { :type => rettype, + :name => 'cmock_to_return', + :ptr? => divine_ptr(rettype), + :const? => rettype.split(/\s/).include?('const'), + :str => "#{rettype} cmock_to_return", + :void? => (rettype == 'void') + } + + #remove default argument statements from mock definitions + args.gsub!(/=\s*[a-zA-Z0-9_\.]+\s*/, ' ') + + #check for var args + if (args =~ /\.\.\./) + decl[:var_arg] = args.match( /[\w\s]*\.\.\./ ).to_s.strip + if (args =~ /\,[\w\s]*\.\.\./) + args = args.gsub!(/\,[\w\s]*\.\.\./,'') + else + args = 'void' + end + else + decl[:var_arg] = nil + end + args = clean_args(args) + decl[:args_string] = args + decl[:args] = parse_args(args) + decl[:args_call] = decl[:args].map{|a| a[:name]}.join(', ') + decl[:contains_ptr?] = decl[:args].inject(false) {|ptr, arg| arg[:ptr?] ? true : ptr } + + if (decl[:return][:type].nil? or decl[:name].nil? or decl[:args].nil? or + decl[:return][:type].empty? or decl[:name].empty?) + raise "Failed Parsing Declaration Prototype!\n" + + " declaration: '#{declaration}'\n" + + " modifier: '#{decl[:modifier]}'\n" + + " return: #{prototype_inspect_hash(decl[:return])}\n" + + " function: '#{decl[:name]}'\n" + + " args: #{prototype_inspect_array_of_hashes(decl[:args])}\n" + end + + return decl + end + + def prototype_inspect_hash(hash) + pairs = [] + hash.each_pair { |name, value| pairs << ":#{name} => #{"'" if (value.class == String)}#{value}#{"'" if (value.class == String)}" } + return "{#{pairs.join(', ')}}" + end + + def prototype_inspect_array_of_hashes(array) + hashes = [] + array.each { |hash| hashes << prototype_inspect_hash(hash) } + case (array.size) + when 0 + return "[]" + when 1 + return "[#{hashes[0]}]" + else + return "[\n #{hashes.join("\n ")}\n ]\n" + end + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/lib/cmock_plugin_manager.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/lib/cmock_plugin_manager.rb new file mode 100644 index 0000000..eb8f9e8 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/lib/cmock_plugin_manager.rb @@ -0,0 +1,40 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +class CMockPluginManager + + attr_accessor :plugins + + def initialize(config, utils) + @plugins = [] + plugins_to_load = [:expect, config.plugins].flatten.uniq.compact + plugins_to_load.each do |plugin| + plugin_name = plugin.to_s + object_name = "CMockGeneratorPlugin" + camelize(plugin_name) + begin + unless (Object.const_defined? object_name) + require "#{File.expand_path(File.dirname(__FILE__))}/cmock_generator_plugin_#{plugin_name.downcase}.rb" + end + @plugins << eval("#{object_name}.new(config, utils)") + rescue + raise "ERROR: CMock unable to load plugin '#{plugin_name}'" + end + end + @plugins.sort! {|a,b| a.priority <=> b.priority } + end + + def run(method, args=nil) + if args.nil? + return @plugins.collect{ |plugin| plugin.send(method) if plugin.respond_to?(method) }.flatten.join + else + return @plugins.collect{ |plugin| plugin.send(method, args) if plugin.respond_to?(method) }.flatten.join + end + end + + def camelize(lower_case_and_underscored_word) + lower_case_and_underscored_word.gsub(/\/(.?)/) { "::" + $1.upcase }.gsub(/(^|_)(.)/) { $2.upcase } + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/lib/cmock_unityhelper_parser.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/lib/cmock_unityhelper_parser.rb new file mode 100644 index 0000000..3ddffb3 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/lib/cmock_unityhelper_parser.rb @@ -0,0 +1,74 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +class CMockUnityHelperParser + + attr_accessor :c_types + + def initialize(config) + @config = config + @fallback = @config.plugins.include?(:array) ? 'UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY' : 'UNITY_TEST_ASSERT_EQUAL_MEMORY' + @c_types = map_C_types.merge(import_source) + end + + def get_helper(ctype) + lookup = ctype.gsub(/(?:^|(\S?)(\s*)|(\W))const(?:$|(\s*)(\S)|(\W))/,'\1\3\5\6').strip.gsub(/\s+/,'_') + return [@c_types[lookup], ''] if (@c_types[lookup]) + if (lookup =~ /\*$/) + lookup = lookup.gsub(/\*$/,'') + return [@c_types[lookup], '*'] if (@c_types[lookup]) + else + lookup = lookup + '*' + return [@c_types[lookup], '&'] if (@c_types[lookup]) + end + return ['UNITY_TEST_ASSERT_EQUAL_PTR', ''] if (ctype =~ /cmock_\w+_ptr\d+/) + raise("Don't know how to test #{ctype} and memory tests are disabled!") unless @config.memcmp_if_unknown + return (lookup =~ /\*$/) ? [@fallback, '&'] : [@fallback, ''] + end + + private ########################### + + def map_C_types + c_types = {} + @config.treat_as.each_pair do |ctype, expecttype| + if (expecttype =~ /\*/) + c_types[ctype.gsub(/\s+/,'_')] = "UNITY_TEST_ASSERT_EQUAL_#{expecttype.gsub(/\*/,'')}_ARRAY" + else + c_types[ctype.gsub(/\s+/,'_')] = "UNITY_TEST_ASSERT_EQUAL_#{expecttype}" + c_types[ctype.gsub(/\s+/,'_')+'*'] = "UNITY_TEST_ASSERT_EQUAL_#{expecttype}_ARRAY" + end + end + c_types + end + + def import_source + source = @config.load_unity_helper + return {} if source.nil? + c_types = {} + source = source.gsub(/\/\/.*$/, '') #remove line comments + source = source.gsub(/\/\*.*?\*\//m, '') #remove block comments + + #scan for comparison helpers + match_regex = Regexp.new('^\s*#define\s+(UNITY_TEST_ASSERT_EQUAL_(\w+))\s*\(' + Array.new(4,'\s*\w+\s*').join(',') + '\)') + pairs = source.scan(match_regex).flatten.compact + (pairs.size/2).times do |i| + expect = pairs[i*2] + ctype = pairs[(i*2)+1] + c_types[ctype] = expect unless expect.include?("_ARRAY") + end + + #scan for array variants of those helpers + match_regex = Regexp.new('^\s*#define\s+(UNITY_TEST_ASSERT_EQUAL_(\w+_ARRAY))\s*\(' + Array.new(5,'\s*\w+\s*').join(',') + '\)') + pairs = source.scan(match_regex).flatten.compact + (pairs.size/2).times do |i| + expect = pairs[i*2] + ctype = pairs[(i*2)+1] + c_types[ctype.gsub('_ARRAY','*')] = expect + end + + c_types + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/rakefile.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/rakefile.rb new file mode 100644 index 0000000..1ea3ef2 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/rakefile.rb @@ -0,0 +1,89 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require './config/test_environment' +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require './rakefile_helper' + +include RakefileHelpers + +DEFAULT_CONFIG_FILE = 'gcc.yml' + +configure_clean +configure_toolchain(DEFAULT_CONFIG_FILE) + +task :default => ['test:all'] +task :cruise => [:no_color, :default] + +desc "Load configuration" +task :config, :config_file do |t, args| + args = {:config_file => DEFAULT_CONFIG_FILE} if args[:config_file].nil? + args = {:config_file => args[:config_file] + '.yml'} unless args[:config_file] =~ /\.yml$/i + configure_toolchain(args[:config_file]) +end + +namespace :test do + desc "Run all unit and system tests" + task :all => [:clobber, 'test:units', 'test:c', 'test:system'] + + desc "Run Unit Tests" + Rake::TestTask.new('units') do |t| + t.pattern = 'test/unit/*_test.rb' + t.verbose = true + end + + #individual unit tests + FileList['test/unit/*_test.rb'].each do |test| + Rake::TestTask.new(File.basename(test,'.*')) do |t| + t.pattern = test + t.verbose = true + end + end + + desc "Run C Unit Tests" + task :c do + build_and_test_c_files + end + + desc "Run System Tests" + task :system => [:clobber] do + #get a list of all system tests, removing unsupported tests for this compiler + sys_unsupported = $cfg['unsupported'].map {|a| 'test/system/test_interactions/'+a+'.yml'} + sys_tests_to_run = FileList['test/system/test_interactions/*.yml'] - sys_unsupported + compile_unsupported = $cfg['unsupported'].map {|a| SYSTEST_COMPILE_MOCKABLES_PATH+a+'.h'} + compile_tests_to_run = FileList[SYSTEST_COMPILE_MOCKABLES_PATH + '*.h'] - compile_unsupported + unless (sys_unsupported.empty? and compile_unsupported.empty?) + report "\nIgnoring these system tests..." + sys_unsupported.each {|a| report a} + compile_unsupported.each {|a| report a} + end + report "\nRunning system tests..." + tests_failed = run_system_test_interactions(sys_tests_to_run) + raise "System tests failed." if (tests_failed > 0) + + run_system_test_compilations(compile_tests_to_run) + end + + #individual system tests + FileList['test/system/test_interactions/*.yml'].each do |test| + desc "Run system test #{File.basename(test,'.*')}" + task "test:#{File.basename(test,'.*')}" do + run_system_test_interactions([test]) + end + end + + desc "Profile Mock Generation" + task :profile => [:clobber] do + run_system_test_profiles(FileList[SYSTEST_COMPILE_MOCKABLES_PATH + '*.h']) + end +end + +task :no_color do + $colour_output = false +end + \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/rakefile_helper.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/rakefile_helper.rb new file mode 100644 index 0000000..c7103b7 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/rakefile_helper.rb @@ -0,0 +1,383 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require 'yaml' +require 'fileutils' +require './vendor/unity/auto/generate_test_runner' +require './vendor/unity/auto/unity_test_summary' +require './test/system/systest_generator' +require './vendor/unity/auto/colour_reporter.rb' + +module RakefileHelpers + + SYSTEST_GENERATED_FILES_PATH = 'test/system/generated/' + SYSTEST_BUILD_FILES_PATH = 'test/system/build/' + SYSTEST_COMPILE_MOCKABLES_PATH = 'test/system/test_compilation/' + C_EXTENSION = '.c' + RESULT_EXTENSION = '.result' + + def load_configuration(config_file) + $cfg_file = config_file + $cfg = YAML.load(File.read('./targets/' + $cfg_file)) + $colour_output = false unless $cfg['colour'] + end + + def configure_clean + CLEAN.include(SYSTEST_GENERATED_FILES_PATH + '*.*') + CLEAN.include(SYSTEST_BUILD_FILES_PATH + '*.*') + end + + def configure_toolchain(config_file) + load_configuration(config_file) + configure_clean + end + + def get_local_include_dirs + include_dirs = $cfg['compiler']['includes']['items'].dup + include_dirs.delete_if {|dir| dir.is_a?(Array)} + return include_dirs + end + + def extract_headers(filename) + includes = [] + lines = File.readlines(filename) + lines.each do |line| + m = line.match(/^\s*#include\s+\"\s*(.+\.[hH])\s*\"/) + if not m.nil? + includes << m[1] + end + end + return includes + end + + def find_source_file(header, paths) + paths.each do |dir| + src_file = dir + header.ext(C_EXTENSION) + if (File.exists?(src_file)) + return src_file + end + end + return nil + end + + def squash(prefix, items) + result = '' + items.each { |item| result += " #{prefix}#{tackit(item)}" } + return result + end + + def build_compiler_fields + command = tackit($cfg['compiler']['path']) + if $cfg['compiler']['defines']['items'].nil? + defines = '' + else + defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items']) + end + options = squash('', $cfg['compiler']['options']) + includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :defines => defines, :options => options, :includes => includes} + end + + def compile(file, defines=[]) + compiler = build_compiler_fields + cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{defines.inject(''){|all, a| ' -D'+a+all }}#{compiler[:options]}#{compiler[:includes]} #{file} " + + "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" + + "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" + execute(cmd_str) + end + + def build_linker_fields + command = tackit($cfg['linker']['path']) + if $cfg['linker']['options'].nil? + options = '' + else + options = squash('', $cfg['linker']['options']) + end + if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?) + includes = '' + else + includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) + end + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :options => options, :includes => includes} + end + + def link(exe_name, obj_list) + linker = build_linker_fields + cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + + (obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).uniq.join + + $cfg['linker']['bin_files']['prefix'] + ' ' + + $cfg['linker']['bin_files']['destination'] + + exe_name + $cfg['linker']['bin_files']['extension'] + execute(cmd_str) + end + + def build_simulator_fields + return nil if $cfg['simulator'].nil? + if $cfg['simulator']['path'].nil? + command = '' + else + command = (tackit($cfg['simulator']['path']) + ' ') + end + if $cfg['simulator']['pre_support'].nil? + pre_support = '' + else + pre_support = squash('', $cfg['simulator']['pre_support']) + end + if $cfg['simulator']['post_support'].nil? + post_support = '' + else + post_support = squash('', $cfg['simulator']['post_support']) + end + return {:command => command, :pre_support => pre_support, :post_support => post_support} + end + + def execute(command_string, verbose=true, raise_on_failure=true) + #report command_string + output = `#{command_string}`.chomp + report(output) if (verbose && !output.nil? && (output.length > 0)) + if ($?.exitstatus != 0) and (raise_on_failure) + raise "#{command_string} failed. (Returned #{$?.exitstatus})" + end + return output + end + + def tackit(strings) + case(strings) + when Array + "\"#{strings.join}\"" + when /^-/ + strings + when /\s/ + "\"#{strings}\"" + else + strings + end + end + + def report_summary + summary = UnityTestSummary.new + summary.set_root_path(File.expand_path(File.dirname(__FILE__)) + '/') + results_glob = "#{$cfg['compiler']['build_path']}*.test*" + results_glob.gsub!(/\\/, '/') + results = Dir[results_glob] + summary.set_targets(results) + summary.run + fail_out "FAIL: There were failures" if (summary.failures > 0) + end + + def run_system_test_interactions(test_case_files) + load './lib/cmock.rb' + + SystemTestGenerator.new.generate_files(test_case_files) + test_files = FileList.new(SYSTEST_GENERATED_FILES_PATH + 'test*.c') + + load_configuration($cfg_file) + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + + include_dirs = get_local_include_dirs + + # Build and execute each unit test + test_files.each do |test| + + obj_list = [] + + test_base = File.basename(test, C_EXTENSION) + cmock_config = test_base.gsub(/test_/, '') + '_cmock.yml' + + report "Executing system tests in #{File.basename(test)}..." + + # Detect dependencies and build required required modules + extract_headers(test).each do |header| + + # Generate any needed mocks + if header =~ /^mock_(.*)\.h/i + module_name = $1 + cmock = CMock.new(SYSTEST_GENERATED_FILES_PATH + cmock_config) + cmock.setup_mocks("#{$cfg['compiler']['source_path']}#{module_name}.h") + end + # Compile corresponding source file if it exists + src_file = find_source_file(header, include_dirs) + if !src_file.nil? + compile(src_file) + obj_list << header.ext($cfg['compiler']['object_files']['extension']) + end + end + + # Generate and build the test suite runner + runner_name = test_base + '_runner.c' + runner_path = $cfg['compiler']['source_path'] + runner_name + UnityTestRunnerGenerator.new(SYSTEST_GENERATED_FILES_PATH + cmock_config).run(test, runner_path) + compile(runner_path) + obj_list << runner_name.ext($cfg['compiler']['object_files']['extension']) + + # Build the test module + compile(test) + obj_list << test_base.ext($cfg['compiler']['object_files']['extension']) + + # Link the test executable + link(test_base, obj_list) + + # Execute unit test and generate results file + simulator = build_simulator_fields + executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] + if simulator.nil? + cmd_str = executable + else + cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" + end + output = execute(cmd_str, false, false) + test_results = $cfg['compiler']['build_path'] + test_base + RESULT_EXTENSION + File.open(test_results, 'w') { |f| f.print output } + end + + # Parse and report test results + total_tests = 0 + total_failures = 0 + failure_messages = [] + + test_case_files.each do |test_case| + tests = (YAML.load_file(test_case))[:systest][:tests][:units] + total_tests += tests.size + + test_file = 'test_' + File.basename(test_case).ext(C_EXTENSION) + result_file = test_file.ext(RESULT_EXTENSION) + test_results = File.readlines(SYSTEST_BUILD_FILES_PATH + result_file) + tests.each_with_index do |test, index| + # compare test's intended pass/fail state with pass/fail state in actual results; + # if they don't match, the system test has failed + this_failed = case(test[:pass]) + when :ignore + (test_results[index] =~ /:IGNORE/).nil? + when true + (test_results[index] =~ /:PASS/).nil? + when false + (test_results[index] =~ /:FAIL/).nil? + end + if (this_failed) + total_failures += 1 + test_results[index] =~ /test#{index+1}:(.+)/ + failure_messages << "#{test_file}:test#{index+1}:should #{test[:should]}:#{$1}" + end + # some tests have additional requirements to check for (checking the actual output message) + if (test[:verify_error]) and not (test_results[index] =~ /test#{index+1}:.*#{test[:verify_error]}/) + total_failures += 1 + failure_messages << "#{test_file}:test#{index+1}:should #{test[:should]}:should have output matching '#{test[:verify_error]}'" + end + end + end + + report "\n" + report "------------------------------------\n" + report "SYSTEM TEST MOCK INTERACTION SUMMARY\n" + report "------------------------------------\n" + report "#{total_tests} Tests #{total_failures} Failures 0 Ignored\n" + report "\n" + + if (failure_messages.size > 0) + report 'System test failures:' + failure_messages.each do |failure| + report failure + end + end + + report '' + + return total_failures + end + + def profile_this(filename) + profile = true + begin + require 'ruby-prof' + RubyProf.start + rescue + profile = false + end + + yield + + if (profile) + profile_result = RubyProf.stop + File.open("Profile_#{filename}.html", 'w') do |f| + RubyProf::GraphHtmlPrinter.new(profile_result).print(f) + end + end + end + + def run_system_test_compilations(mockables) + load './lib/cmock.rb' + + load_configuration($cfg_file) + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + + report "\n" + report "------------------------------------\n" + report "SYSTEM TEST MOCK COMPILATION SUMMARY\n" + report "------------------------------------\n" + mockables.each do |header| + mock_filename = 'mock_' + File.basename(header).ext('.c') + CMock.new(SYSTEST_COMPILE_MOCKABLES_PATH + 'config.yml').setup_mocks(header) + report "Compiling #{mock_filename}..." + compile(SYSTEST_GENERATED_FILES_PATH + mock_filename) + end + end + + def run_system_test_profiles(mockables) + load './lib/cmock.rb' + + load_configuration($cfg_file) + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + + report "\n" + report "--------------------------\n" + report "SYSTEM TEST MOCK PROFILING\n" + report "--------------------------\n" + mockables.each do |header| + mock_filename = 'mock_' + File.basename(header).ext('.c') + profile_this(mock_filename.gsub('.c','')) do + 10.times do + CMock.new(SYSTEST_COMPILE_MOCKABLES_PATH + 'config.yml').setup_mocks(header) + end + end + report "Compiling #{mock_filename}..." + compile(SYSTEST_GENERATED_FILES_PATH + mock_filename) + end + end + + def build_and_test_c_files + report "\n" + report "----------------\n" + report "UNIT TEST C CODE\n" + report "----------------\n" + errors = false + FileList.new("test/c/*.yml").each do |yaml_file| + test = YAML.load(File.read(yaml_file)) + report "\nTesting #{yaml_file.sub('.yml','')}" + report "(#{test[:options].join(', ')})" + test[:files].each { |f| compile(f, test[:options]) } + obj_files = test[:files].map { |f| f.gsub!(/.*\//,'').gsub!(C_EXTENSION, $cfg['compiler']['object_files']['extension']) } + link('TestCMockC', obj_files) + if $cfg['simulator'].nil? + execute($cfg['linker']['bin_files']['destination'] + 'TestCMockC' + $cfg['linker']['bin_files']['extension']) + else + execute(tackit($cfg['simulator']['path'].join) + ' ' + + $cfg['simulator']['pre_support'].map{|o| tackit(o)}.join(' ') + ' ' + + $cfg['linker']['bin_files']['destination'] + + 'TestCMockC' + + $cfg['linker']['bin_files']['extension'] + ' ' + + $cfg['simulator']['post_support'].map{|o| tackit(o)}.join(' ') ) + end + end + end + + def fail_out(msg) + puts msg + exit(-1) + end +end + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/release/build.info b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/release/build.info new file mode 100644 index 0000000..360b9e4 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/release/build.info @@ -0,0 +1,2 @@ +209 + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/release/version.info b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/release/version.info new file mode 100644 index 0000000..0d71c08 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/release/version.info @@ -0,0 +1,2 @@ +2.0 + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/src/cmock.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/src/cmock.c new file mode 100644 index 0000000..558e19a --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/src/cmock.c @@ -0,0 +1,186 @@ +/* ========================================== + CMock Project - Automatic Mock Generation for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity.h" +#include "cmock.h" + +//define CMOCK_MEM_DYNAMIC to grab memory as needed with malloc +//when you do that, CMOCK_MEM_SIZE is used for incremental size instead of total +#ifdef CMOCK_MEM_STATIC +#undef CMOCK_MEM_DYNAMIC +#endif + +#ifdef CMOCK_MEM_DYNAMIC +#include +#endif + +//this is used internally during pointer arithmetic. make sure this type is the same size as the target's pointer type +#ifndef CMOCK_MEM_PTR_AS_INT +#define CMOCK_MEM_PTR_AS_INT unsigned long +#endif + +//0 for no alignment, 1 for 16-bit, 2 for 32-bit, 3 for 64-bit +#ifndef CMOCK_MEM_ALIGN +#define CMOCK_MEM_ALIGN (2) +#endif + +//amount of memory to allow cmock to use in its internal heap +#ifndef CMOCK_MEM_SIZE +#define CMOCK_MEM_SIZE (32768) +#endif + +//automatically calculated defs for easier reading +#define CMOCK_MEM_ALIGN_SIZE (1u << CMOCK_MEM_ALIGN) +#define CMOCK_MEM_ALIGN_MASK (CMOCK_MEM_ALIGN_SIZE - 1) +#define CMOCK_MEM_INDEX_SIZE ((sizeof(CMOCK_MEM_INDEX_TYPE) > CMOCK_MEM_ALIGN_SIZE) ? sizeof(CMOCK_MEM_INDEX_TYPE) : CMOCK_MEM_ALIGN_SIZE) + +//private variables +#ifdef CMOCK_MEM_DYNAMIC +static unsigned char* CMock_Guts_Buffer = NULL; +static CMOCK_MEM_INDEX_TYPE CMock_Guts_BufferSize = CMOCK_MEM_ALIGN_SIZE; +static CMOCK_MEM_INDEX_TYPE CMock_Guts_FreePtr; +#else +static unsigned char CMock_Guts_Buffer[CMOCK_MEM_SIZE + CMOCK_MEM_ALIGN_SIZE]; +static CMOCK_MEM_INDEX_TYPE CMock_Guts_BufferSize = CMOCK_MEM_SIZE + CMOCK_MEM_ALIGN_SIZE; +static CMOCK_MEM_INDEX_TYPE CMock_Guts_FreePtr; +#endif +//------------------------------------------------------- +// CMock_Guts_MemNew +//------------------------------------------------------- +CMOCK_MEM_INDEX_TYPE CMock_Guts_MemNew(CMOCK_MEM_INDEX_TYPE size) +{ + CMOCK_MEM_INDEX_TYPE index; + + //verify arguments valid (we must be allocating space for at least 1 byte, and the existing chain must be in memory somewhere) + if (size < 1) + return CMOCK_GUTS_NONE; + + //verify we have enough room + size = size + CMOCK_MEM_INDEX_SIZE; + if (size & CMOCK_MEM_ALIGN_MASK) + size = (size + CMOCK_MEM_ALIGN_MASK) & ~CMOCK_MEM_ALIGN_MASK; + if ((CMock_Guts_BufferSize - CMock_Guts_FreePtr) < size) + { +#ifdef CMOCK_MEM_DYNAMIC + CMock_Guts_BufferSize += CMOCK_MEM_SIZE + size; + CMock_Guts_Buffer = realloc(CMock_Guts_Buffer, CMock_Guts_BufferSize); + if (CMock_Guts_Buffer == NULL) +#endif //yes that if will continue to the return below if TRUE + return CMOCK_GUTS_NONE; + } + + //determine where we're putting this new block, and init its pointer to be the end of the line + index = CMock_Guts_FreePtr + CMOCK_MEM_INDEX_SIZE; + *(CMOCK_MEM_INDEX_TYPE*)(&CMock_Guts_Buffer[CMock_Guts_FreePtr]) = CMOCK_GUTS_NONE; + CMock_Guts_FreePtr += size; + + return index; +} + +//------------------------------------------------------- +// CMock_Guts_MemChain +//------------------------------------------------------- +CMOCK_MEM_INDEX_TYPE CMock_Guts_MemChain(CMOCK_MEM_INDEX_TYPE root_index, CMOCK_MEM_INDEX_TYPE obj_index) +{ + CMOCK_MEM_INDEX_TYPE index; + void* root; + void* obj; + void* next; + + if (root_index == CMOCK_GUTS_NONE) + { + //if there is no root currently, we return this object as the root of the chain + return obj_index; + } + else + { + //reject illegal nodes + if ((root_index < CMOCK_MEM_ALIGN_SIZE) || (root_index >= CMock_Guts_FreePtr)) + { + return CMOCK_GUTS_NONE; + } + if ((obj_index < CMOCK_MEM_ALIGN_SIZE) || (obj_index >= CMock_Guts_FreePtr)) + { + return CMOCK_GUTS_NONE; + } + + root = (void*)(&CMock_Guts_Buffer[root_index]); + obj = (void*)(&CMock_Guts_Buffer[obj_index]); + + //find the end of the existing chain and add us + next = root; + do { + index = *(CMOCK_MEM_INDEX_TYPE*)((CMOCK_MEM_PTR_AS_INT)next - CMOCK_MEM_INDEX_SIZE); + if (index >= CMock_Guts_FreePtr) + return CMOCK_GUTS_NONE; + if (index > 0) + next = (void*)(&CMock_Guts_Buffer[index]); + } while (index > 0); + *(CMOCK_MEM_INDEX_TYPE*)((CMOCK_MEM_PTR_AS_INT)next - CMOCK_MEM_INDEX_SIZE) = ((CMOCK_MEM_PTR_AS_INT)obj - (CMOCK_MEM_PTR_AS_INT)CMock_Guts_Buffer); + return root_index; + } +} + +//------------------------------------------------------- +// CMock_Guts_MemNext +//------------------------------------------------------- +CMOCK_MEM_INDEX_TYPE CMock_Guts_MemNext(CMOCK_MEM_INDEX_TYPE previous_item_index) +{ + CMOCK_MEM_INDEX_TYPE index; + void* previous_item; + + //There is nothing "next" if the pointer isn't from our buffer + if ((previous_item_index < CMOCK_MEM_ALIGN_SIZE) || (previous_item_index >= CMock_Guts_FreePtr)) + return CMOCK_GUTS_NONE; + previous_item = (void*)(&CMock_Guts_Buffer[previous_item_index]); + + //if the pointer is good, then use it to look up the next index + //(we know the first element always goes in zero, so NEXT must always be > 1) + index = *(CMOCK_MEM_INDEX_TYPE*)((CMOCK_MEM_PTR_AS_INT)previous_item - CMOCK_MEM_INDEX_SIZE); + if ((index > 1) && (index < CMock_Guts_FreePtr)) + return index; + else + return CMOCK_GUTS_NONE; +} + +//------------------------------------------------------- +// CMock_GetAddressFor +//------------------------------------------------------- +void* CMock_Guts_GetAddressFor(CMOCK_MEM_INDEX_TYPE index) +{ + if ((index >= CMOCK_MEM_ALIGN_SIZE) && (index < CMock_Guts_FreePtr)) + { + return (void*)(&CMock_Guts_Buffer[index]); + } + else + { + return NULL; + } +} + +//------------------------------------------------------- +// CMock_Guts_MemBytesFree +//------------------------------------------------------- +CMOCK_MEM_INDEX_TYPE CMock_Guts_MemBytesFree(void) +{ + return CMock_Guts_BufferSize - CMock_Guts_FreePtr; +} + +//------------------------------------------------------- +// CMock_Guts_MemBytesUsed +//------------------------------------------------------- +CMOCK_MEM_INDEX_TYPE CMock_Guts_MemBytesUsed(void) +{ + return CMock_Guts_FreePtr - CMOCK_MEM_ALIGN_SIZE; +} + +//------------------------------------------------------- +// CMock_Guts_MemFreeAll +//------------------------------------------------------- +void CMock_Guts_MemFreeAll(void) +{ + CMock_Guts_FreePtr = CMOCK_MEM_ALIGN_SIZE; //skip the very beginning +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/src/cmock.h b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/src/cmock.h new file mode 100644 index 0000000..a43e9e0 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/src/cmock.h @@ -0,0 +1,30 @@ +/* ========================================== + CMock Project - Automatic Mock Generation for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef CMOCK_FRAMEWORK_H +#define CMOCK_FRAMEWORK_H + +//should be big enough to index full range of CMOCK_MEM_MAX +#ifndef CMOCK_MEM_INDEX_TYPE +#define CMOCK_MEM_INDEX_TYPE unsigned int +#endif + +#define CMOCK_GUTS_NONE (0) + +//------------------------------------------------------- +// Memory API +//------------------------------------------------------- +CMOCK_MEM_INDEX_TYPE CMock_Guts_MemNew(CMOCK_MEM_INDEX_TYPE size); +CMOCK_MEM_INDEX_TYPE CMock_Guts_MemChain(CMOCK_MEM_INDEX_TYPE root_index, CMOCK_MEM_INDEX_TYPE obj_index); +CMOCK_MEM_INDEX_TYPE CMock_Guts_MemNext(CMOCK_MEM_INDEX_TYPE previous_item_index); + +void* CMock_Guts_GetAddressFor(CMOCK_MEM_INDEX_TYPE index); + +CMOCK_MEM_INDEX_TYPE CMock_Guts_MemBytesFree(void); +CMOCK_MEM_INDEX_TYPE CMock_Guts_MemBytesUsed(void); +void CMock_Guts_MemFreeAll(void); + +#endif //CMOCK_FRAMEWORK diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/targets/gcc.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/targets/gcc.yml new file mode 100644 index 0000000..e46aec5 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/targets/gcc.yml @@ -0,0 +1,50 @@ +--- +compiler: + path: gcc + source_path: &systest_generated_path 'test/system/generated/' + unit_tests_path: &unit_tests_path 'examples/test/' + mocks_path: &systest_mocks_path 'test/system/generated/' + build_path: &systest_build_path 'test/system/build/' + options: + - '-c' + - '-Wall' + - '-Wno-address' + - '-std=c99' + - '-pedantic' + includes: + prefix: '-I' + items: + - *systest_generated_path + - *unit_tests_path + - *systest_mocks_path + - 'src/' + - 'vendor/unity/src/' + - 'vendor/c_exception/lib/' + - 'test/system/test_compilation/' + - 'test/' + defines: + prefix: '-D' + items: + object_files: + prefix: '-o' + extension: '.o' + destination: *systest_build_path + +linker: + path: gcc + options: + - -lm + includes: + prefix: '-I' + object_files: + path: *systest_build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.exe' + destination: *systest_build_path + +unsupported: + - unity_64bit_support + +colour: true diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/targets/gcc_32_with_64_support.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/targets/gcc_32_with_64_support.yml new file mode 100644 index 0000000..2decb69 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/targets/gcc_32_with_64_support.yml @@ -0,0 +1,52 @@ +--- +compiler: + path: gcc + source_path: &systest_generated_path 'test/system/generated/' + unit_tests_path: &unit_tests_path 'examples/test/' + mocks_path: &systest_mocks_path 'test/system/generated/' + build_path: &systest_build_path 'test/system/build/' + options: + - '-c' + - '-Wall' + - '-Wno-address' + - '-std=c99' + - '-pedantic' + includes: + prefix: '-I' + items: + - *systest_generated_path + - *unit_tests_path + - *systest_mocks_path + - 'src/' + - 'vendor/unity/src/' + - 'vendor/c_exception/lib/' + - 'test/system/test_compilation/' + - 'test/' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - UNITY_LONG_WIDTH=32 + - 'CMOCK_MEM_PTR_AS_INT=long' + object_files: + prefix: '-o' + extension: '.o' + destination: *systest_build_path + +linker: + path: gcc + options: + - -lm + includes: + prefix: '-I' + object_files: + path: *systest_build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.exe' + destination: *systest_build_path + +unsupported: [] + +colour: true diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/targets/gcc_64.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/targets/gcc_64.yml new file mode 100644 index 0000000..2296537 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/targets/gcc_64.yml @@ -0,0 +1,53 @@ +--- +compiler: + path: gcc + source_path: &systest_generated_path 'test/system/generated/' + unit_tests_path: &unit_tests_path 'examples/test/' + mocks_path: &systest_mocks_path 'test/system/generated/' + build_path: &systest_build_path 'test/system/build/' + options: + - '-c' + - '-Wall' + - '-std=c99' + - '-Wno-address' + - '-pedantic-errors' + includes: + prefix: '-I' + items: + - *systest_generated_path + - *unit_tests_path + - *systest_mocks_path + - 'src/' + - 'vendor/unity/src/' + - 'vendor/c_exception/lib/' + - 'test/system/test_compilation/' + - 'test/' + defines: + prefix: '-D' + items: + - 'UNITY_SUPPORT_64' + - 'UNITY_LONG_WIDTH=64' + - 'UNITY_POINTER_WIDTH=64' + - 'CMOCK_MEM_PTR_AS_INT=long' + object_files: + prefix: '-o' + extension: '.o' + destination: *systest_build_path + +linker: + path: gcc + options: + - -lm + includes: + prefix: '-I' + object_files: + path: *systest_build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.exe' + destination: *systest_build_path + +unsupported: [] + +colour: true diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/targets/iar_arm_v4.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/targets/iar_arm_v4.yml new file mode 100644 index 0000000..574814b --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/targets/iar_arm_v4.yml @@ -0,0 +1,107 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 4.0\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: &systest_generated_path 'test/system/generated/' + unit_tests_path: &unit_tests_path 'examples/test/' + mocks_path: &systest_mocks_path 'test/system/generated/' + build_path: &systest_build_path 'test/system/build/' + options: + - --dlib_config + - [*tools_root, 'arm\lib\dl4tptinl8n.h'] + - -z3 + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian little + - --cpu ARM7TDMI + - --stack_align 4 + - --interwork + - -e + - --silent + - --warnings_are_errors + - --fpu None + #We are supressing some warnings here because we test CMock against some questionable code to make sure it still works + - --diag_suppress Pa050 + - --diag_suppress Pe191 + - --diag_suppress=Pe494 + - --diag_suppress=Pe083 + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - *systest_generated_path + - *unit_tests_path + - *systest_mocks_path + - 'src/' + - 'vendor/unity/src/' + - 'vendor/c_exception/lib/' + - 'test/system/test_compilation/' + - 'test\' + defines: + prefix: '-D' + items: + object_files: + prefix: '-o' + extension: '.r79' + destination: *systest_build_path + +linker: + path: [*tools_root, 'common\bin\xlink.exe'] + options: + - -rt + - [*tools_root, 'arm\lib\dl4tptinl8n.r79'] + - -D_L_EXTMEM_START=0 + - -D_L_EXTMEM_SIZE=0 + - -D_L_HEAP_SIZE=120 + - -D_L_STACK_SIZE=32 + - -e_small_write=_formatted_write + - -s + - __program_start + - '-f iar\iar_v4\Resource\at91SAM7X256_FLASH.xcl' + includes: + prefix: '-I' + items: + - *systest_generated_path + - *unit_tests_path + - *systest_mocks_path + - 'vendor/unity/src/' + - [*tools_root, 'arm\config\'] + - [*tools_root, 'arm\lib\'] + object_files: + path: *systest_build_path + extension: '.r79' + bin_files: + prefix: '-o' + extension: '.d79' + destination: *systest_build_path + +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --macro + - 'iar\iar_v4\Resource\SAM7_SIM.mac' + - --backend + - -B + - -p + - [*tools_root, 'arm\config\ioat91sam7X256.ddf'] + - -d + - sim + +unsupported: + - nonstandard_parsed_stuff_1 + - const + - unity_64bit_support + +colour: true diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/targets/iar_arm_v5.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/targets/iar_arm_v5.yml new file mode 100644 index 0000000..fc4e4c4 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/targets/iar_arm_v5.yml @@ -0,0 +1,92 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: &systest_generated_path 'test/system/generated/' + unit_tests_path: &unit_tests_path 'examples/test/' + mocks_path: &systest_mocks_path 'test/system/generated/' + build_path: &systest_build_path 'test/system/build/' + options: + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian=little + - --cpu=ARM7TDMI + - --interwork + - --warnings_are_errors + - --fpu=None + - -e + - -On + #We are supressing some warnings here because we test CMock against some questionable code to make sure it still works + - --diag_suppress=Pa050 + - --diag_suppress=Pe191 + - --diag_suppress=Pe494 + - --diag_suppress=Pe083 + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - *systest_generated_path + - *unit_tests_path + - *systest_mocks_path + - 'src/' + - 'vendor/unity/src/' + - 'vendor/c_exception/lib/' + - 'iar\iar_v5\incIAR\' + - 'test\system\test_compilation\' + - 'test\' + defines: + prefix: '-D' + items: + object_files: + prefix: '-o' + extension: '.r79' + destination: *systest_build_path + +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config iar\iar_v5\Resource\at91SAM7X256_RAM.icf + object_files: + path: *systest_build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *systest_build_path + +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --macro + - 'iar\iar_v5\Resource\SAM7_SIM.mac' + - --backend + - -B + - -p + - [*tools_root, 'arm\config\debugger\Atmel\ioat91sam7X256.ddf'] + - -d + - sim + +unsupported: + - nonstandard_parsed_stuff_1 + - const + - unity_64bit_support + +colour: true diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/c/TestCMockC.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/c/TestCMockC.c new file mode 100644 index 0000000..9a61b39 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/c/TestCMockC.c @@ -0,0 +1,280 @@ +/* ========================================== + CMock Project - Automatic Mock Generation for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity.h" +#include "cmock.h" + +#define TEST_MEM_INDEX_SIZE (sizeof(CMOCK_MEM_INDEX_TYPE)) + +void setUp(void) +{ + CMock_Guts_MemFreeAll(); +} + +void tearDown(void) +{ +} + +void test_MemNewWillReturnNullIfGivenIllegalSizes(void) +{ + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemNew(0) ); + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemNew(CMOCK_MEM_SIZE - TEST_MEM_INDEX_SIZE + 1) ); + TEST_ASSERT_NULL( CMock_Guts_GetAddressFor(CMOCK_GUTS_NONE) ); + + //verify we're cleared still + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE, CMock_Guts_MemBytesFree()); +} + +void test_MemChainWillReturnNullAndDoNothingIfGivenIllegalInformation(void) +{ + CMOCK_MEM_INDEX_TYPE next = CMock_Guts_MemNew(4); + TEST_ASSERT_EQUAL(4 + TEST_MEM_INDEX_SIZE, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - 4 - TEST_MEM_INDEX_SIZE, CMock_Guts_MemBytesFree()); + + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemChain(next + CMOCK_MEM_SIZE, next) ); + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemChain(next, next + CMOCK_MEM_SIZE) ); + + //verify we're still the same + TEST_ASSERT_EQUAL(4 + TEST_MEM_INDEX_SIZE, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - 4 - TEST_MEM_INDEX_SIZE, CMock_Guts_MemBytesFree()); +} + +void test_MemNextWillReturnNullIfGivenABadRoot(void) +{ + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemNext(0) ); + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemNext(2) ); + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemNext(CMOCK_MEM_SIZE - 4) ); + + //verify we're cleared still + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE, CMock_Guts_MemBytesFree()); +} + +void test_ThatWeCanClaimAndChainAFewElementsTogether(void) +{ + unsigned int i; + CMOCK_MEM_INDEX_TYPE next; + CMOCK_MEM_INDEX_TYPE first = CMOCK_GUTS_NONE; + CMOCK_MEM_INDEX_TYPE element[4]; + + //verify we're cleared first + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE, CMock_Guts_MemBytesFree()); + + //first element + element[0] = CMock_Guts_MemNew(sizeof(unsigned int)); + TEST_ASSERT_MESSAGE(element[0] != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + first = CMock_Guts_MemChain(first, element[0]); + TEST_ASSERT_EQUAL(element[0], first); + *((unsigned int*)CMock_Guts_GetAddressFor(element[0])) = 0; + + //verify we're using the right amount of memory + TEST_ASSERT_EQUAL(1 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - 1 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesFree()); + + //second element + element[1] = CMock_Guts_MemNew(sizeof(unsigned int)); + TEST_ASSERT_MESSAGE(element[1] != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + TEST_ASSERT_NOT_EQUAL(element[0], element[1]); + TEST_ASSERT_EQUAL(first, CMock_Guts_MemChain(first, element[1])); + *((unsigned int*)CMock_Guts_GetAddressFor(element[1])) = 1; + + //verify we're using the right amount of memory + TEST_ASSERT_EQUAL(2 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - 2 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesFree()); + + //third element + element[2] = CMock_Guts_MemNew(sizeof(unsigned int)); + TEST_ASSERT_MESSAGE(element[2] != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + TEST_ASSERT_NOT_EQUAL(element[0], element[2]); + TEST_ASSERT_NOT_EQUAL(element[1], element[2]); + TEST_ASSERT_EQUAL(first, CMock_Guts_MemChain(first, element[2])); + *((unsigned int*)CMock_Guts_GetAddressFor(element[2])) = 2; + + //verify we're using the right amount of memory + TEST_ASSERT_EQUAL(3 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - 3 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesFree()); + + //fourth element + element[3] = CMock_Guts_MemNew(sizeof(unsigned int)); + TEST_ASSERT_MESSAGE(element[3] != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + TEST_ASSERT_NOT_EQUAL(element[0], element[3]); + TEST_ASSERT_NOT_EQUAL(element[1], element[3]); + TEST_ASSERT_NOT_EQUAL(element[2], element[3]); + TEST_ASSERT_EQUAL(first, CMock_Guts_MemChain(first, element[3])); + *((unsigned int*)CMock_Guts_GetAddressFor(element[3])) = 3; + + //verify we're using the right amount of memory + TEST_ASSERT_EQUAL(4 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - 4 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesFree()); + + //traverse list + next = first; + for (i = 0; i < 4; i++) + { + TEST_ASSERT_EQUAL(element[i], next); + TEST_ASSERT_EQUAL(i, *((unsigned int*)CMock_Guts_GetAddressFor(element[i]))); + next = CMock_Guts_MemNext(next); + } + + //verify we get a null at the end of the list + TEST_ASSERT_EQUAL_HEX(CMOCK_GUTS_NONE, next); + + //verify we're using the right amount of memory + TEST_ASSERT_EQUAL(4 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - 4 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesFree()); + + //Free it all + CMock_Guts_MemFreeAll(); + + //verify we're cleared + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE, CMock_Guts_MemBytesFree()); +} + +void test_ThatCMockStopsReturningMoreDataWhenItRunsOutOfMemory(void) +{ + unsigned int i; + CMOCK_MEM_INDEX_TYPE first = CMOCK_GUTS_NONE; + CMOCK_MEM_INDEX_TYPE next; + + //even though we are asking for one byte, we've told it to align to closest 4 bytes, therefore it will waste a byte each time + //so each call will use 8 bytes (4 for the index, 1 for the data, and 3 wasted). + //therefore we can safely allocated total/8 times. + for (i = 0; i < (CMOCK_MEM_SIZE / 8); i++) + { + TEST_ASSERT_EQUAL(i*8, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - i*8, CMock_Guts_MemBytesFree()); + + next = CMock_Guts_MemNew(1); + TEST_ASSERT_MESSAGE(next != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + + first = CMock_Guts_MemChain(first, next); + TEST_ASSERT_MESSAGE(first != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + } + + //verify we're at top of memory + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesFree()); + + //The very next call will return a NULL, and any after that + TEST_ASSERT_EQUAL_HEX(CMOCK_GUTS_NONE, CMock_Guts_MemNew(1)); + TEST_ASSERT_EQUAL_HEX(CMOCK_GUTS_NONE, CMock_Guts_MemNew(1)); + TEST_ASSERT_EQUAL_HEX(CMOCK_GUTS_NONE, CMock_Guts_MemNew(1)); + + //verify nothing has changed + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesFree()); + + //verify we can still walk through the elements allocated + next = first; + for (i = 0; i < (CMOCK_MEM_SIZE / 8); i++) + { + TEST_ASSERT_MESSAGE(next != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + next = CMock_Guts_MemNext(next); + } + + //there aren't any after that + TEST_ASSERT_EQUAL_HEX(CMOCK_GUTS_NONE, next); +} + +void test_ThatCMockStopsReturningMoreDataWhenAskForMoreThanItHasLeftEvenIfNotAtExactEnd(void) +{ + unsigned int i; + CMOCK_MEM_INDEX_TYPE first = CMOCK_GUTS_NONE; + CMOCK_MEM_INDEX_TYPE next; + + //we're asking for 12 bytes each time now (4 for index, 8 for data). + //10 requests will give us 120 bytes used, which isn't enough for another 12 bytes if total memory is 128 + for (i = 0; i < 10; i++) + { + TEST_ASSERT_EQUAL(i*12, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - i*12, CMock_Guts_MemBytesFree()); + + next = CMock_Guts_MemNew(8); + TEST_ASSERT_MESSAGE(next != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + + first = CMock_Guts_MemChain(first, next); + TEST_ASSERT_MESSAGE(first != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + + //verify writing data won't screw us up + *((unsigned int*)CMock_Guts_GetAddressFor(next)) = i; + } + + //verify we're at top of memory + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - 8, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(8, CMock_Guts_MemBytesFree()); + + //The very next call will return a NONE, and any after that + TEST_ASSERT_EQUAL_HEX(CMOCK_GUTS_NONE, CMock_Guts_MemNew(8)); + TEST_ASSERT_EQUAL_HEX(CMOCK_GUTS_NONE, CMock_Guts_MemNew(5)); + + //verify nothing has changed + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - 8, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(8, CMock_Guts_MemBytesFree()); + + //verify we can still walk through the elements allocated + next = first; + for (i = 0; i < 10; i++) + { + TEST_ASSERT_MESSAGE(next != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + TEST_ASSERT_EQUAL(i, *((unsigned int*)CMock_Guts_GetAddressFor(next))); + next = CMock_Guts_MemNext(next); + } + + //there aren't any after that + TEST_ASSERT_EQUAL_HEX(CMOCK_GUTS_NONE, next); +} + +void test_ThatWeCanAskForAllSortsOfSizes(void) +{ + unsigned int i; + CMOCK_MEM_INDEX_TYPE first = CMOCK_GUTS_NONE; + CMOCK_MEM_INDEX_TYPE next; + unsigned int sizes[5] = {3, 1, 80, 5, 4}; + unsigned int sizes_buffered[5] = {4, 4, 80, 8, 4}; + unsigned int sum = 0; + + for (i = 0; i < 5; i++) + { + next = CMock_Guts_MemNew(sizes[i]); + TEST_ASSERT_MESSAGE(next != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + + first = CMock_Guts_MemChain(first, next); + TEST_ASSERT_MESSAGE(first != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + + sum += sizes_buffered[i] + 4; + TEST_ASSERT_EQUAL(sum, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - sum, CMock_Guts_MemBytesFree()); + } + + //show that we can't ask for too much memory + TEST_ASSERT_EQUAL_HEX(CMOCK_GUTS_NONE, CMock_Guts_MemNew(12)); + TEST_ASSERT_EQUAL_HEX(CMOCK_GUTS_NONE, CMock_Guts_MemNew(5)); + + //but we CAN ask for something that will still fit + next = CMock_Guts_MemNew(4); + TEST_ASSERT_MESSAGE(next != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + + first = CMock_Guts_MemChain(first, next); + TEST_ASSERT_MESSAGE(first != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + + //verify we're used up now + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesFree()); + + //verify we can still walk through the elements allocated + next = first; + for (i = 0; i < 6; i++) + { + TEST_ASSERT_MESSAGE(next != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + next = CMock_Guts_MemNext(next); + } + + //there aren't any after that + TEST_ASSERT_EQUAL_HEX(CMOCK_GUTS_NONE, next); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/c/TestCMockC.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/c/TestCMockC.yml new file mode 100644 index 0000000..cd76154 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/c/TestCMockC.yml @@ -0,0 +1,12 @@ +--- +:files: + - 'src/cmock.c' + - 'test/c/TestCMockC.c' + - 'test/c/TestCMockC_Runner.c' + - 'vendor/unity/src/unity.c' +:options: + - 'TEST' + - 'CMOCK_MEM_SIZE=128' + - 'CMOCK_MEM_ALIGN=2' + - 'CMOCK_MEM_INDEX_TYPE=int' + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/c/TestCMockCDynamic.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/c/TestCMockCDynamic.c new file mode 100644 index 0000000..bd699a8 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/c/TestCMockCDynamic.c @@ -0,0 +1,186 @@ +/* ========================================== + CMock Project - Automatic Mock Generation for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity.h" +#include "cmock.h" + +#define TEST_MEM_INDEX_SIZE (sizeof(CMOCK_MEM_INDEX_TYPE)) +#define TEST_MEM_INDEX_PAD ((sizeof(CMOCK_MEM_INDEX_TYPE) + 7) & ~7) //round up to nearest 4 byte boundary + +unsigned int StartingSize; + +void setUp(void) +{ + CMock_Guts_MemFreeAll(); + StartingSize = CMock_Guts_MemBytesFree(); + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesUsed()); +} + +void tearDown(void) +{ +} + +void test_MemNewWillReturnNullIfGivenIllegalSizes(void) +{ + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemNew(0) ); + + //verify we're cleared still + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesFree()); +} + +void test_MemNewWillNowSupportSizesGreaterThanTheDefinesCMockSize(void) +{ + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesFree()); + + TEST_ASSERT_MESSAGE(CMock_Guts_MemNew(CMOCK_MEM_SIZE - TEST_MEM_INDEX_SIZE + 1) != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE + TEST_MEM_INDEX_PAD, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE, CMock_Guts_MemBytesFree()); +} + +void test_MemChainWillReturnNullAndDoNothingIfGivenIllegalInformation(void) +{ + CMOCK_MEM_INDEX_TYPE next = CMock_Guts_MemNew(8); + TEST_ASSERT_EQUAL(8 + TEST_MEM_INDEX_PAD, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(StartingSize - 8 - TEST_MEM_INDEX_PAD, CMock_Guts_MemBytesFree()); + + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemChain(next + CMOCK_MEM_SIZE, next) ); + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemChain(next, next + CMOCK_MEM_SIZE) ); + + //verify we're still the same + TEST_ASSERT_EQUAL(8 + TEST_MEM_INDEX_PAD, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(StartingSize - 8 - TEST_MEM_INDEX_PAD, CMock_Guts_MemBytesFree()); +} + +void test_MemNextWillReturnNullIfGivenABadRoot(void) +{ + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemNext(0) ); + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemNext(2) ); + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemNext( CMOCK_MEM_SIZE - 4 ) ); + + //verify we're cleared still + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(StartingSize, CMock_Guts_MemBytesFree()); +} + +void test_ThatWeCanClaimAndChainAFewElementsTogether(void) +{ + unsigned int i; + CMOCK_MEM_INDEX_TYPE first = CMOCK_GUTS_NONE; + CMOCK_MEM_INDEX_TYPE next; + CMOCK_MEM_INDEX_TYPE element[4]; + + //verify we're cleared first + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(StartingSize, CMock_Guts_MemBytesFree()); + + //first element + element[0] = CMock_Guts_MemNew(sizeof(unsigned int)); + TEST_ASSERT_MESSAGE(element[0] != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + first = CMock_Guts_MemChain(first, element[0]); + TEST_ASSERT_EQUAL(element[0], first); + *((unsigned int*)CMock_Guts_GetAddressFor(element[0])) = 0; + + //verify we're using the right amount of memory + TEST_ASSERT_EQUAL(1 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(StartingSize - 1 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesFree()); + + //second element + element[1] = CMock_Guts_MemNew(sizeof(unsigned int)); + TEST_ASSERT_MESSAGE(element[1] != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + TEST_ASSERT_NOT_EQUAL(element[0], element[1]); + TEST_ASSERT_EQUAL(first, CMock_Guts_MemChain(first, element[1])); + *((unsigned int*)CMock_Guts_GetAddressFor(element[1])) = 1; + + //verify we're using the right amount of memory + TEST_ASSERT_EQUAL(2 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(StartingSize - 2 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesFree()); + + //third element + element[2] = CMock_Guts_MemNew(sizeof(unsigned int)); + TEST_ASSERT_MESSAGE(element[2] != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + TEST_ASSERT_NOT_EQUAL(element[0], element[2]); + TEST_ASSERT_NOT_EQUAL(element[1], element[2]); + TEST_ASSERT_EQUAL(first, CMock_Guts_MemChain(first, element[2])); + *((unsigned int*)CMock_Guts_GetAddressFor(element[2])) = 2; + + //verify we're using the right amount of memory + TEST_ASSERT_EQUAL(3 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(StartingSize - 3 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesFree()); + + //fourth element + element[3] = CMock_Guts_MemNew(sizeof(unsigned int)); + TEST_ASSERT_MESSAGE(element[3] != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + TEST_ASSERT_NOT_EQUAL(element[0], element[3]); + TEST_ASSERT_NOT_EQUAL(element[1], element[3]); + TEST_ASSERT_NOT_EQUAL(element[2], element[3]); + TEST_ASSERT_EQUAL(first, CMock_Guts_MemChain(first, element[3])); + *((unsigned int*)CMock_Guts_GetAddressFor(element[3])) = 3; + + //verify we're using the right amount of memory + TEST_ASSERT_EQUAL(4 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(StartingSize - 4 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesFree()); + + //traverse list + next = first; + for (i = 0; i < 4; i++) + { + TEST_ASSERT_EQUAL(element[i], next); + TEST_ASSERT_EQUAL(i, *((unsigned int*)CMock_Guts_GetAddressFor(element[i]))); + next = CMock_Guts_MemNext(next); + } + + //verify we get a null at the end of the list + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, next); + + //verify we're using the right amount of memory + TEST_ASSERT_EQUAL(4 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(StartingSize - 4 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesFree()); + + //Free it all + CMock_Guts_MemFreeAll(); + + //verify we're cleared + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(StartingSize, CMock_Guts_MemBytesFree()); +} + +void test_ThatWeCanAskForAllSortsOfSizes(void) +{ + unsigned int i; + CMOCK_MEM_INDEX_TYPE first = CMOCK_GUTS_NONE; + CMOCK_MEM_INDEX_TYPE next; + unsigned int sizes[10] = {3, 1, 80, 5, 8, 31, 7, 911, 2, 80}; + unsigned int sizes_buffered[10] = {16, 16, 88, 16, 16, 40, 16, 920, 16, 88}; //includes counter + unsigned int sum = 0; + unsigned int cap; + + for (i = 0; i < 10; i++) + { + next = CMock_Guts_MemNew(sizes[i]); + TEST_ASSERT_MESSAGE(next != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + + first = CMock_Guts_MemChain(first, next); + TEST_ASSERT_MESSAGE(first != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + + sum += sizes_buffered[i]; + cap = (StartingSize > (sum + CMOCK_MEM_SIZE)) ? StartingSize : (sum + CMOCK_MEM_SIZE); + TEST_ASSERT_EQUAL(sum, CMock_Guts_MemBytesUsed()); + TEST_ASSERT(cap >= CMock_Guts_MemBytesFree()); + } + + //verify we can still walk through the elements allocated + next = first; + for (i = 0; i < 10; i++) + { + TEST_ASSERT_MESSAGE(next != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + next = CMock_Guts_MemNext(next); + } + + //there aren't any after that + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, next); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/c/TestCMockCDynamic.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/c/TestCMockCDynamic.yml new file mode 100644 index 0000000..7776c89 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/c/TestCMockCDynamic.yml @@ -0,0 +1,12 @@ +--- +:files: + - 'src/cmock.c' + - 'test/c/TestCMockCDynamic.c' + - 'test/c/TestCMockCDynamic_Runner.c' + - 'vendor/unity/src/unity.c' +:options: + - 'TEST' + - 'CMOCK_MEM_DYNAMIC' + - 'CMOCK_MEM_SIZE=64' + - 'CMOCK_MEM_ALIGN=3' + - 'CMOCK_MEM_INDEX_TYPE=short' diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/c/TestCMockCDynamic_Runner.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/c/TestCMockCDynamic_Runner.c new file mode 100644 index 0000000..e161625 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/c/TestCMockCDynamic_Runner.c @@ -0,0 +1,35 @@ +/* ========================================== + CMock Project - Automatic Mock Generation for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity.h" +#include +#include + +extern void setUp(void); +extern void tearDown(void); + +extern void test_MemNewWillReturnNullIfGivenIllegalSizes(void); +extern void test_MemNewWillNowSupportSizesGreaterThanTheDefinesCMockSize(void); +extern void test_MemChainWillReturnNullAndDoNothingIfGivenIllegalInformation(void); +extern void test_MemNextWillReturnNullIfGivenABadRoot(void); +extern void test_ThatWeCanClaimAndChainAFewElementsTogether(void); +extern void test_ThatWeCanAskForAllSortsOfSizes(void); + +int main(void) +{ + Unity.TestFile = "TestCMockDynamic.c"; + UnityBegin(); + + RUN_TEST(test_MemNewWillReturnNullIfGivenIllegalSizes, 26); + RUN_TEST(test_MemNewWillNowSupportSizesGreaterThanTheDefinesCMockSize, 35); + RUN_TEST(test_MemChainWillReturnNullAndDoNothingIfGivenIllegalInformation, 45); + RUN_TEST(test_MemNextWillReturnNullIfGivenABadRoot, 59); + RUN_TEST(test_ThatWeCanClaimAndChainAFewElementsTogether, 70); + RUN_TEST(test_ThatWeCanAskForAllSortsOfSizes, 152); + + UnityEnd(); + return 0; +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/c/TestCMockC_Runner.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/c/TestCMockC_Runner.c new file mode 100644 index 0000000..93d8e1f --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/c/TestCMockC_Runner.c @@ -0,0 +1,37 @@ +/* ========================================== + CMock Project - Automatic Mock Generation for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity.h" +#include +#include + +extern void setUp(void); +extern void tearDown(void); + +extern void test_MemNewWillReturnNullIfGivenIllegalSizes(void); +extern void test_MemChainWillReturnNullAndDoNothingIfGivenIllegalInformation(void); +extern void test_MemNextWillReturnNullIfGivenABadRoot(void); +extern void test_ThatWeCanClaimAndChainAFewElementsTogether(void); +extern void test_ThatCMockStopsReturningMoreDataWhenItRunsOutOfMemory(void); +extern void test_ThatCMockStopsReturningMoreDataWhenAskForMoreThanItHasLeftEvenIfNotAtExactEnd(void); +extern void test_ThatWeCanAskForAllSortsOfSizes(void); + +int main(void) +{ + Unity.TestFile = "TestCMock.c"; + UnityBegin(); + + RUN_TEST(test_MemNewWillReturnNullIfGivenIllegalSizes, 21); + RUN_TEST(test_MemChainWillReturnNullAndDoNothingIfGivenIllegalInformation, 32); + RUN_TEST(test_MemNextWillReturnNullIfGivenABadRoot, 46); + RUN_TEST(test_ThatWeCanClaimAndChainAFewElementsTogether, 57); + RUN_TEST(test_ThatCMockStopsReturningMoreDataWhenItRunsOutOfMemory, 139); + RUN_TEST(test_ThatCMockStopsReturningMoreDataWhenAskForMoreThanItHasLeftEvenIfNotAtExactEnd, 185); + RUN_TEST(test_ThatWeCanAskForAllSortsOfSizes, 233); + + UnityEnd(); + return 0; +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/systest_generator.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/systest_generator.rb new file mode 100644 index 0000000..368b039 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/systest_generator.rb @@ -0,0 +1,178 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require 'yaml' + +SYS_TEST_GEN_ROOT = File.expand_path( File.dirname( __FILE__ ) ) + '/' +GENERATED_PATH = SYS_TEST_GEN_ROOT + 'generated/' +BUILD_PATH = SYS_TEST_GEN_ROOT + 'build/' +CASES_PATH = SYS_TEST_GEN_ROOT + 'cases/' + +TYPES_H = 'types.h' +UNITY_H = 'unity.h' +CMOCK_H = 'cmock.h' +UNITY_HELPER_H = 'unity_helper.h' +UNITY_HELPER_C = 'unity_helper.c' +MOCKABLE_H = 'mockable.h' + +YAML_EXTENSION = '.yml' +TEST_PREFIX = 'test_' +MOCK_PREFIX = 'mock_' +H_EXTENSION = '.h' +C_EXTENSION = '.c' + + +class SystemTestGenerator + + def generate_files(test_cases) + test_cases.each do |filename| + yaml_hash = YAML.load_file(filename) + + name = File.basename(filename, YAML_EXTENSION) + namix = "#{name}_" + + generate_cmock_config(yaml_hash, namix) + generate_code(yaml_hash, namix, name) + end + end + + private + + def generate_cmock_config(yaml_hash, namix) + cmock_yaml = yaml_hash.clone + cmock_yaml.delete(:systest) + cmock = cmock_yaml[:cmock] + + cmock[:mock_path] = GENERATED_PATH + cmock[:includes] = (cmock[:includes] || []) + [namix + TYPES_H] + cmock[:mock_prefix] = MOCK_PREFIX + if not yaml_hash[:systest][:unity_helper].nil? + cmock[:includes] << namix + UNITY_HELPER_H + cmock[:unity_helper] = GENERATED_PATH + namix + UNITY_HELPER_H + end + + File.open(GENERATED_PATH + namix + 'cmock' + YAML_EXTENSION, 'w') do |out| + YAML.dump(cmock_yaml, out) + end + end + + def generate_code(yaml_hash, namix, name) + generate_types_file(yaml_hash, namix) + generate_mockable_file(yaml_hash, namix) + generate_unity_helper_files(yaml_hash, namix) + + generate_test_file(yaml_hash, namix, name) + generate_source_file(yaml_hash, namix, name) + end + + def generate_types_file(yaml_hash, namix) + types = yaml_hash[:systest][:types] + return if types.nil? + + write_header_file(GENERATED_PATH + namix + TYPES_H, namix.upcase + 'TYPES_H') do |out| + out.puts(types) + end + end + + def generate_mockable_file(yaml_hash, namix) + mockable = yaml_hash[:systest][:mockable] + return if mockable.nil? + + write_header_file(GENERATED_PATH + namix + MOCKABLE_H, namix.upcase + 'MOCKABLE_H', [namix + TYPES_H]) do |out| + out.puts(mockable) + end + end + + def generate_unity_helper_files(yaml_hash, namix) + unity_helper = yaml_hash[:systest][:unity_helper] + return if unity_helper.nil? + + write_header_file(GENERATED_PATH + namix + UNITY_HELPER_H, namix.upcase + 'UNITY_HELPER_H', [namix + TYPES_H]) do |out| + out.puts(unity_helper[:header]) + end + + write_source_file(GENERATED_PATH + namix + UNITY_HELPER_C, ["unity.h", namix + UNITY_HELPER_H]) do |out| + out.puts(unity_helper[:code]) + end + end + + def generate_test_file(yaml_hash, namix, name) + tests = yaml_hash[:systest][:tests] + return if tests.nil? + + includes = [UNITY_H, CMOCK_H] + includes << (namix + UNITY_HELPER_H) if not yaml_hash[:systest][:unity_helper].nil? + includes << [MOCK_PREFIX + namix + MOCKABLE_H] + includes << [name + H_EXTENSION] + + write_source_file(GENERATED_PATH + TEST_PREFIX + name + C_EXTENSION, includes.flatten) do |out| + out.puts(tests[:common]) + out.puts('') + + tests[:units].each_with_index do |test, index| + out.puts('// should ' + test[:should]) + out.puts(test[:code].gsub!(/test\(\)/, "void test#{index+1}(void)")) + out.puts('') + end + end + end + + def generate_source_file(yaml_hash, namix, name) + source = yaml_hash[:systest][:source] + return if source.nil? + + header_file = name + H_EXTENSION + + includes = yaml_hash[:systest][:types].nil? ? [] : [(namix + TYPES_H)] + + write_header_file(GENERATED_PATH + header_file, name.upcase, includes) do |out| + out.puts(source[:header]) + end + + includes = [] + includes << (namix + TYPES_H) if not yaml_hash[:systest][:types].nil? + includes << (namix + MOCKABLE_H) if not yaml_hash[:systest][:mockable].nil? + includes << header_file + + write_source_file(GENERATED_PATH + name + C_EXTENSION, includes.flatten) do |out| + out.puts(source[:code]) + end + end + + def write_header_file(filename, upcase_name, include_list=[]) + File.open(filename, 'w') do |out| + out.puts("#ifndef _#{upcase_name}") + out.puts("#define _#{upcase_name}") + out.puts('') + include_list.each do |include| + out.puts("#include \"#{include}\"") + end + out.puts('') + yield(out) + out.puts('') + out.puts("#endif // _#{upcase_name}") + out.puts('') + end + end + + def write_source_file(filename, include_list=[]) + File.open(filename, 'w') do |out| + include_list.each do |include| + out.puts("#include \"#{include}\"") + end + out.puts('') + yield(out) + out.puts('') + end + end + +end + + +if ($0 == __FILE__) + SystemTestGenerator.new.generate_files(Dir[CASES_PATH + "*#{YAML_EXTENSION}"]) +end + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_compilation/config.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_compilation/config.yml new file mode 100644 index 0000000..7726699 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_compilation/config.yml @@ -0,0 +1,9 @@ +--- +:cmock: + :plugins: [] + :includes: [] + :mock_path: test/system/generated/ + :mock_prefix: mock_ + :treat_as_void: + - OSEK_TASK + - VOID_TYPE_CRAZINESS diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_compilation/const.h b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_compilation/const.h new file mode 100644 index 0000000..e17c465 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_compilation/const.h @@ -0,0 +1,15 @@ +/* ========================================== + CMock Project - Automatic Mock Generation for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +struct _DUMMY_T { unsigned int a; float b; }; + +void const_variants1( const char* a, int const, unsigned short const * c ); + +void const_variants2( + struct _DUMMY_T const * const param1, + const unsigned long int const * const param2, + const struct _DUMMY_T const * param3 ); + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_compilation/osek.h b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_compilation/osek.h new file mode 100644 index 0000000..f3abe7b --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_compilation/osek.h @@ -0,0 +1,275 @@ +/* ========================================== + CMock Project - Automatic Mock Generation for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +typedef unsigned char OSServiceIdType; +typedef void (*OSEKOS_VOIDFUNCPTR)(void); + +typedef unsigned char StatusType; +typedef unsigned char OSEK_U8; +typedef unsigned short OSEK_U16; +typedef unsigned long OSEK_U32; + +void OSEKOSDisableAll(void); +void OSEKOSEnableAll(void); + +typedef unsigned long * OSEKOSSaveType; +typedef void OSEK_TASK; +typedef OSEK_U8 OSEKOSPrioType; + +enum { +Task_DbgCAN +, +Task_ALS +, +CalibrateMagTask +, +Task_IAQ +, +SmartBeam +, +Task_QbertTestImage +, +Task_TestQbertMem +, +Task_Cyclic1000 +, +ProcessMagForCompass +, +ReadMag +, +Task_Cyclic10 +, +Task_Wdm +, +BackgroundTask +, +Task_Cyclic20 +, +Task_Cyclic2 +}; + +OSEK_TASK OSEKOS_T_Task_DbgCAN(void); +OSEK_TASK OSEKOS_T_Task_ALS(void); +OSEK_TASK OSEKOS_T_CalibrateMagTask(void); +OSEK_TASK OSEKOS_T_Task_IAQ(void); +OSEK_TASK OSEKOS_T_SmartBeam(void); +OSEK_TASK OSEKOS_T_Task_QbertTestImage(void); +OSEK_TASK OSEKOS_T_Task_TestQbertMem(void); +OSEK_TASK OSEKOS_T_Task_Cyclic1000(void); +OSEK_TASK OSEKOS_T_ProcessMagForCompass(void); +OSEK_TASK OSEKOS_T_ReadMag(void); +OSEK_TASK OSEKOS_T_Task_Cyclic10(void); +OSEK_TASK OSEKOS_T_Task_Wdm(void); +OSEK_TASK OSEKOS_T_BackgroundTask(void); +OSEK_TASK OSEKOS_T_Task_Cyclic20(void); +OSEK_TASK OSEKOS_T_Task_Cyclic2(void); +OSEK_TASK OSEKOS_Twrap_Task_DbgCAN(void); +OSEK_TASK OSEKOS_Twrap_Task_ALS(void); +OSEK_TASK OSEKOS_Twrap_CalibrateMagTask(void); +OSEK_TASK OSEKOS_Twrap_Task_IAQ(void); +OSEK_TASK OSEKOS_Twrap_SmartBeam(void); +OSEK_TASK OSEKOS_Twrap_Task_QbertTestImage(void); +OSEK_TASK OSEKOS_Twrap_Task_TestQbertMem(void); +OSEK_TASK OSEKOS_Twrap_Task_Cyclic1000(void); +OSEK_TASK OSEKOS_Twrap_ProcessMagForCompass(void); +OSEK_TASK OSEKOS_Twrap_ReadMag(void); +OSEK_TASK OSEKOS_Twrap_Task_Cyclic10(void); +OSEK_TASK OSEKOS_Twrap_Task_Wdm(void); +OSEK_TASK OSEKOS_Twrap_BackgroundTask(void); +OSEK_TASK OSEKOS_Twrap_Task_Cyclic20(void); +OSEK_TASK OSEKOS_Twrap_Task_Cyclic2(void); + +typedef OSEK_U8 TaskType; +typedef OSEK_U8 TaskStateType; +typedef OSEK_U16 EventMaskType; +typedef OSEK_U8 ResourceType; + +void OSEKOSEnableSystemTimers(void); + +typedef OSEK_U8 CounterType; +typedef OSEK_U32 TickType; +typedef OSEK_U8 AlarmType; + +void OSEKOS_ISR_CanTxInterrupt(void); +void OSEKOS_ISR_CanRxInterrupt(void); +void OSEKOS_ISR_CanErrInterrupt(void); +void OSEKOS_ISR_SCIRxInterrupt(void); +void OSEKOS_ISR_SCITxInterrupt(void); +void OSEKOS_ISR_UP_DMA_Interrupt_0(void); +void OSEKOS_ISR_UP_DMA_Interrupt_1(void); +void OSEKOS_ISR_UP_DMA_Interrupt_2(void); +void OSEKOS_ISR_UP_DMA_Interrupt_3(void); +void OSEKOS_ISR_CompFreqHandler(void); +void OSEKOS_ISR_AmbientReturnInt(void); +void OSEKOS_ISR_GlareReturnInt(void); +void OSEKOS_ISR_ALSTimeoutInt(void); +void OSEKOS_ISR_LINTimerInt(void); +void OSEKOS_ISR_LINDelayInt(void); +void OSEKOS_ISR_TimerMExpire(void); +void OSEKOS_ISR_LINRxTx_SCI1(void); +void OSEKOS_ISR_CanRxInterrupt_1(void); +void OSEKOS_ISR_LINError_SCI1(void); +void OSEKOS_ISR_SysCounter(void); + + +// defined multiple times (slightly different forms) These should be ignored because they are externed +extern void OSEKOS_ISR_CanTxInterrupt( void ); +extern void OSEKOS_ISR_CanRxInterrupt( void ); + + +unsigned long OSEKOSrtcGetSeconds ( void ); +void OSEKOSrtcIncrement ( unsigned long nsec ); + +enum +{ + E_OS_ACCESS = 1, + E_OS_CALLEVEL = 2, + E_OS_ID = 3, + E_OS_LIMIT = 4, + E_OS_NOFUNC = 5, + E_OS_RESOURCE = 6, + E_OS_STATE = 7, + E_OS_VALUE = 8, + E_OS_SYS_StackOverflow = 20, + E_OS_SYS_StackUnderflow = 21, + E_OS_SYS_INIT = 22, + E_OS_SYS_CONFIG = 23, + E_OS_SYS_CODE = 24, + E_OS_SYS_TOOL = 25, + E_OS_SYS_TimerRange = 26 +}; + +enum +{ + SUSPENDED = 0x00, + READY = 0x01, + RUNNING = 0x02, + WAITING = 0x03, + INTSTART = 0x08, + SETSTART = 0x10, + NPRTASK = 0x20, + USEFP = 0x40 +}; + +typedef struct +{ + TickType maxallowedvalue; + TickType ticksperbase; +} AlarmBaseType; + +typedef TaskType *TaskRefType; +typedef TaskStateType *TaskStateRefType; +typedef EventMaskType *EventMaskRefType; +typedef TickType *TickRefType; +typedef AlarmBaseType *AlarmBaseRefType; +typedef OSEK_U8 AppModeType; +typedef OSEK_U8 OSEKOSTaskActCntType; + +TaskType OSEKOStidact; +OSEKOSPrioType OSEKOSrunprio; + +StatusType OSEKOSError ( register StatusType ); +void ErrorHook ( StatusType ); +void StartupHook ( void ); +void ShutdownHook ( StatusType ); + +int getUsedTaskStack ( TaskType ); +int getUnusedTaskStack ( TaskType ); +int getUsedIsrStack ( void ); +int getUnusedIsrStack ( void ); +void OSEKOStaskStackCheckInit ( void ); +signed char OSEKOStaskStackCheck ( OSEK_U8 * ); +signed char OSEKOSisrStackCheck ( OSEK_U8 * ); +void OSEKOStaskStackCheckFatal ( OSEK_U8 * ); +void OSEKOSisrStackCheckFatal ( OSEK_U8 * ); +OSEK_U8 * OSEKOSgetStackPointer ( void ); +void OSEKOSTaskSwitch ( void ); +StatusType OSEKOSReturn ( StatusType ); +StatusType OSEKOSActivateTask ( register TaskType ); +void OSEKOSTerminateTask ( TaskType, TaskType ); + + extern void OSEKOSGetResource ( ResourceType ); + extern void OSEKOSReleaseResource ( ResourceType ); + +int OSEKOSSetEvent ( TaskType, EventMaskType ); +int OSEKOSWaitEvent ( EventMaskType ); +TickType OSEKOSGetAlarm(register AlarmType); +void OSEKOSSetAlarm ( AlarmType, TickType, TickType ); +StatusType OSEKOSSetAbsAlarm ( AlarmType a, TickType b, TickType c ); + +StatusType OSEKOSCancelAlarm ( register AlarmType ); +void OSEKOSAdvCntr ( void ); +AppModeType GetActiveApplicationMode ( void ); + +void StartOS ( AppModeType ); + +void OSEKOSShutdownOS ( StatusType ); + +StatusType ActivateTask ( TaskType A ); +StatusType TerminateTask ( void ); +StatusType ChainTask ( TaskType A ); +StatusType GetTaskState ( TaskType A, TaskStateRefType B ); +StatusType GetTaskID ( TaskRefType A ); +StatusType Schedule ( void ); +StatusType GetResource ( ResourceType A ); +StatusType ReleaseResource ( ResourceType A ); +StatusType SetEvent ( TaskType A, EventMaskType B ); +StatusType ClearEvent ( EventMaskType A ); +StatusType WaitEvent ( EventMaskType A ); +StatusType GetEvent ( TaskType A, EventMaskRefType B ); +StatusType GetAlarm ( AlarmType A, TickRefType B ); +StatusType GetAlarmBase ( AlarmType A, AlarmBaseRefType B ); +StatusType SetRelAlarm ( AlarmType A, TickType B, TickType C ); +StatusType SetAbsAlarm ( AlarmType A, TickType B, TickType C ); +StatusType CancelAlarm ( AlarmType A ); +StatusType AdvCntr ( CounterType A ); +StatusType IAdvCntr ( CounterType A ); +void SuspendOSInterrupts ( void ); +void ResumeOSInterrupts ( void ); +void SuspendAllInterrupts ( void ); +void ResumeAllInterrupts ( void ); +void DisableAllInterrupts ( void ); +void EnableAllInterrupts ( void ); + +void OSEKOSDisable(void); +void OSEKOSEnable(void); +void OSEKOSAsmIDispatch(unsigned long *); +void OSEKOSAsmDispatch(OSEKOSPrioType p); +void OSEKOSStartupEnable(void); +void OSEKOSNop(void); +unsigned int OSEKOSV850CheckIsrSwitch(void); +void OSEKOSV850InitInterrupts(void); +void OSEKOSV850SetupInterrupts(); +void OSEKOSV850SyncContextLoad(OSEKOSSaveType); +void OSEKOSV850SyncContextLoadFromIRQ(OSEKOSSaveType); +void OSEKOSV850ASyncContextLoad(OSEKOSSaveType); +void OSEKOSV850ASyncContextLoadFromIRQ(OSEKOSSaveType); + +// arrays of function pointers - they look like function prototypes +void ( ( * const OSEKOStaskStartAddress [10] ) ( void ) ); +StatusType (* OSEKOStaskStatuses [10][5]) ( void ); + +void OSEKOSV850StartContext +( + OSEK_TASK (( * const ) ( void )), + OSEK_U8 * const +); +void OSEKOSV850StartContextFromIRQ +( + OSEK_TASK (( * const ) ( void )), + OSEK_U8 * const +); + +void OSEKOSSuspendOSInterrupts(void); +void OSEKOSResumeOSInterrupts(void); +void OSEKOSSuspendAllInterrupts(void); +void OSEKOSResumeAllInterrupts(void); +void OSEKOScheckSuspendResumeNesting(void); + + +void OSEKOSgetSR(void); +void OSEKOSEnableInterrupt_intern(int nr); +void OSEKOSDisableInterrupt_intern(int nr); diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_compilation/parsing.h b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_compilation/parsing.h new file mode 100644 index 0000000..e1bcb8b --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_compilation/parsing.h @@ -0,0 +1,47 @@ +/* ========================================== + CMock Project - Automatic Mock Generation for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +typedef unsigned short U16; +typedef signed int int32_t; + +typedef struct _POINT_T +{ + int x; + int y; +} POINT_T; + +// typedef edge case; +// not ANSI C but it has been done and will break cmock if not handled +typedef void VOID_TYPE_CRAZINESS; + +/* fun parsing & mock generation cases */ + +void var_args1(int a, ...); +void var_args2(int a, int b, ...); + +VOID_TYPE_CRAZINESS void_type_craziness1(int, float, double, char, short, long, long int, long long, void*); +int void_type_craziness2( VOID_TYPE_CRAZINESS ); + + void crazy_whitespace ( int lint, double shot , short stack ) ; + +char + crazy_multiline +( + int a, + unsigned int b); + +U16 *ptr_return1(int a); +U16* ptr_return2(int a); +U16 * ptr_return3(int a); + +unsigned int** ptr_ptr_return1(unsigned int** a); +unsigned int* *ptr_ptr_return2(unsigned int* *a); +unsigned int **ptr_ptr_return3(unsigned int **a); +unsigned int ** ptr_ptr_return4(unsigned int ** a); + +extern unsigned long int incredible_descriptors(register const unsigned short a); + +int32_t example_c99_type(int32_t param1); diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/all_plugins_but_other_limits.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/all_plugins_but_other_limits.yml new file mode 100644 index 0000000..052f883 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/all_plugins_but_other_limits.yml @@ -0,0 +1,340 @@ +--- +#this test is different than all_plugins_coexist primarily because of these options +:cmock: + :enforce_strict_ordering: 1 + :treat_externs: :include + :ignore: :args_only + :plugins: + - :array + - :cexception + - :ignore + - :callback + +:systest: + :types: | + typedef struct _POINT_T { + int x; + int y; + } POINT_T; + + :mockable: | + #include "CException.h" + void foo(POINT_T* a); + POINT_T* bar(void); + void fooa(POINT_T a[]); + void foos(const char * a); + extern const char * bars(void); + void no_pointers(int a, char* b); + int mixed(int a, int* b, int c); + + :source: + :header: | + #include "CException.h" + void function_a(void); + void function_b(void); + void function_c(void); + int function_d(void); + void function_e(void); + + :code: | + void function_a(void) + { + foo(bar()); + } + + void function_b(void) { + fooa(bar()); + } + + void function_c(void) { + CEXCEPTION_T e; + Try { + foos(bars()); + } Catch(e) { foos("err"); } + } + + int function_d(void) { + int test_list[] = { 1, 2, 3, 4, 5 }; + no_pointers(1, "silly"); + return mixed(6, test_list, 7); + } + + void function_e(void) { + foos("Hello"); + foos("Tuna"); + foos("Oranges"); + } + + :tests: + :common: | + #include "CException.h" + void setUp(void) {} + void tearDown(void) {} + + :units: + - :pass: TRUE + :should: 'handle the situation where we pass nulls to pointers' + :code: | + test() + { + bar_ExpectAndReturn(NULL); + foo_Expect(NULL); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we expected nulls to pointers but did not get that' + :code: | + test() + { + POINT_T pt = {1, 2}; + bar_ExpectAndReturn(&pt); + foo_Expect(NULL); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we did not expect nulls to pointers but got null' + :code: | + test() + { + POINT_T ex = {1, 2}; + bar_ExpectAndReturn(NULL); + foo_Expect(&ex); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass single object with expect and it is wrong' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 3}; + bar_ExpectAndReturn(&pt); + foo_Expect(&ex); + + function_a(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass single object with expect and use array handler' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 2}; + bar_ExpectAndReturn(&pt); + foo_ExpectWithArray(&ex, 1); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass single object with expect and use array handler and it is wrong' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 3}; + bar_ExpectAndReturn(&pt); + foo_ExpectWithArray(&ex, 1); + + function_a(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass multiple objects with expect and use array handler' + :code: | + test() + { + POINT_T pt[] = {{1, 2}, {3, 4}, {5, 6}}; + POINT_T ex[] = {{1, 2}, {3, 4}, {5, 6}}; + bar_ExpectAndReturn(pt); + foo_ExpectWithArray(ex, 3); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass multiple objects with expect and use array handler and it is wrong at end' + :code: | + test() + { + POINT_T pt[] = {{1, 2}, {3, 4}, {5, 6}}; + POINT_T ex[] = {{1, 2}, {3, 4}, {5, 9}}; + bar_ExpectAndReturn(pt); + foo_ExpectWithArray(ex, 3); + + function_a(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass single array element with expect' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 2}; + bar_ExpectAndReturn(&pt); + fooa_Expect(&ex); + + function_b(); + } + + - :pass: TRUE + :should: 'handle standard c string as null terminated on not do crappy memory compares of a byte, passing' + :code: | + test() + { + bars_ExpectAndReturn("This is a\0 silly string"); + foos_Expect("This is a\0 wacky string"); + + function_c(); + } + + - :pass: FALSE + :should: 'handle standard c string as null terminated on not do crappy memory compares of a byte, finding failures' + :code: | + test() + { + bars_ExpectAndReturn("This is a silly string"); + foos_Expect("This is a wacky string"); + + function_c(); + } + + - :pass: TRUE + :should: 'handle creating array expects when we have mixed arguments for single object' + :code: | + test() + { + int expect_list[] = { 1, 9 }; + no_pointers_Expect(1, "silly"); + mixed_ExpectAndReturn(6, expect_list, 7, 13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: FALSE + :should: 'handle creating array expects when we have mixed arguments and handle failures for single object' + :code: | + test() + { + int expect_list[] = { 9, 1 }; + no_pointers_Expect(1, "silly"); + mixed_ExpectAndReturn(6, expect_list, 7, 13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: TRUE + :should: 'handle creating array expects when we have mixed arguments for multiple objects' + :code: | + test() + { + int expect_list[] = { 1, 2, 3, 4, 6 }; + no_pointers_Expect(1, "silly"); + mixed_ExpectWithArrayAndReturn(6, expect_list, 4, 7, 13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: FALSE + :should: 'handle creating array expects when we have mixed arguments and handle failures for multiple objects' + :code: | + test() + { + int expect_list[] = { 1, 2, 3, 4, 6 }; + no_pointers_Expect(1, "silly"); + mixed_ExpectWithArrayAndReturn(6, expect_list, 5, 7, 13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: TRUE + :should: 'handle an exception being caught' + :code: | + test() + { + bars_ExpectAndReturn("This is a\0 silly string"); + foos_ExpectAndThrow("This is a\0 wacky string", 55); + foos_Expect("err"); + + function_c(); + } + + - :pass: FALSE + :should: 'handle an exception being caught but still catch following errors' + :code: | + test() + { + bars_ExpectAndReturn("This is a\0 silly string"); + foos_ExpectAndThrow("This is a\0 wacky string", 55); + foos_Expect("wrong error"); + + function_c(); + } + + - :pass: FALSE + :should: 'fail strict ordering problems even though we would otherwise have passed' + :code: | + test() + { + int expect_list[] = { 1, 2, 3, 4, 6 }; + mixed_ExpectWithArrayAndReturn(6, expect_list, 4, 7, 13); + no_pointers_Expect(1, "silly"); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: TRUE + :should: 'properly ignore first function but the other will work properly' + :code: | + test() + { + int expect_list[] = { 1, 2, 3, 4, 6 }; + no_pointers_Ignore(); + mixed_ExpectWithArrayAndReturn(6, expect_list, 4, 7, 13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: TRUE + :should: 'properly ignore last function but the other will work properly' + :code: | + test() + { + no_pointers_Expect(1, "silly"); + mixed_IgnoreAndReturn(13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: TRUE + :should: 'be ok if we ignore a call each because we are counting calls' + :code: | + test() + { + foos_Ignore(); + foos_Ignore(); + foos_Ignore(); + + function_e(); + } + + - :pass: FALSE + :should: 'fail if we do not ignore a call once because we are counting calls' + :code: | + test() + { + foos_Ignore(); + foos_Ignore(); + + function_e(); + } + +... diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/all_plugins_coexist.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/all_plugins_coexist.yml new file mode 100644 index 0000000..b76859f --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/all_plugins_coexist.yml @@ -0,0 +1,381 @@ +--- +:cmock: + :enforce_strict_ordering: 1 + :plugins: + - :array + - :cexception + - :ignore + - :callback + :callback_after_arg_check: true + #:callback_include_count: false + :treat_externs: :include + +:systest: + :types: | + typedef struct _POINT_T { + int x; + int y; + } POINT_T; + + :mockable: | + #include "CException.h" + extern void foo(POINT_T* a); + POINT_T* bar(void); + void fooa(POINT_T a[]); + void foos(const char * a); + const char * bars(void); + void no_pointers(int a, char* b); + int mixed(int a, int* b, int c); + + :source: + :header: | + #include "CException.h" + void function_a(void); + void function_b(void); + void function_c(void); + int function_d(void); + void function_e(void); + + :code: | + void function_a(void) + { + foo(bar()); + } + + void function_b(void) { + fooa(bar()); + } + + void function_c(void) { + CEXCEPTION_T e; + Try { + foos(bars()); + } Catch(e) { foos("err"); } + } + + int function_d(void) { + int test_list[] = { 1, 2, 3, 4, 5 }; + no_pointers(1, "silly"); + return mixed(6, test_list, 7); + } + + void function_e(void) { + foos("Hello"); + foos("Tuna"); + foos("Oranges"); + } + + :tests: + :common: | + #include "CException.h" + void setUp(void) {} + void tearDown(void) {} + void my_foo_callback(POINT_T* a) { TEST_ASSERT_EQUAL_INT(2, a->x); } + + :units: + - :pass: TRUE + :should: 'handle the situation where we pass nulls to pointers' + :code: | + test() + { + bar_ExpectAndReturn(NULL); + foo_Expect(NULL); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we expected nulls to pointers but did not get that' + :code: | + test() + { + POINT_T pt = {1, 2}; + bar_ExpectAndReturn(&pt); + foo_Expect(NULL); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we did not expect nulls to pointers but got null' + :code: | + test() + { + POINT_T ex = {1, 2}; + bar_ExpectAndReturn(NULL); + foo_Expect(&ex); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass single object with expect and it is wrong' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 3}; + bar_ExpectAndReturn(&pt); + foo_Expect(&ex); + + function_a(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass single object with expect and use array handler' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 2}; + bar_ExpectAndReturn(&pt); + foo_ExpectWithArray(&ex, 1); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass single object with expect and use array handler and it is wrong' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 3}; + bar_ExpectAndReturn(&pt); + foo_ExpectWithArray(&ex, 1); + + function_a(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass multiple objects with expect and use array handler' + :code: | + test() + { + POINT_T pt[] = {{1, 2}, {3, 4}, {5, 6}}; + POINT_T ex[] = {{1, 2}, {3, 4}, {5, 6}}; + bar_ExpectAndReturn(pt); + foo_ExpectWithArray(ex, 3); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass multiple objects with expect and use array handler and it is wrong at end' + :code: | + test() + { + POINT_T pt[] = {{1, 2}, {3, 4}, {5, 6}}; + POINT_T ex[] = {{1, 2}, {3, 4}, {5, 9}}; + bar_ExpectAndReturn(pt); + foo_ExpectWithArray(ex, 3); + + function_a(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass single array element with expect' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 2}; + bar_ExpectAndReturn(&pt); + fooa_Expect(&ex); + + function_b(); + } + + - :pass: TRUE + :should: 'handle standard c string as null terminated on not do crappy memory compares of a byte, passing' + :code: | + test() + { + bars_ExpectAndReturn("This is a\0 silly string"); + foos_Expect("This is a\0 wacky string"); + + function_c(); + } + + - :pass: FALSE + :should: 'handle standard c string as null terminated on not do crappy memory compares of a byte, finding failures' + :code: | + test() + { + bars_ExpectAndReturn("This is a silly string"); + foos_Expect("This is a wacky string"); + + function_c(); + } + + - :pass: TRUE + :should: 'handle creating array expects when we have mixed arguments for single object' + :code: | + test() + { + int expect_list[] = { 1, 9 }; + no_pointers_Expect(1, "silly"); + mixed_ExpectAndReturn(6, expect_list, 7, 13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: FALSE + :should: 'handle creating array expects when we have mixed arguments and handle failures for single object' + :code: | + test() + { + int expect_list[] = { 9, 1 }; + no_pointers_Expect(1, "silly"); + mixed_ExpectAndReturn(6, expect_list, 7, 13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: TRUE + :should: 'handle creating array expects when we have mixed arguments for multiple objects' + :code: | + test() + { + int expect_list[] = { 1, 2, 3, 4, 6 }; + no_pointers_Expect(1, "silly"); + mixed_ExpectWithArrayAndReturn(6, expect_list, 4, 7, 13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: FALSE + :should: 'handle creating array expects when we have mixed arguments and handle failures for multiple objects' + :code: | + test() + { + int expect_list[] = { 1, 2, 3, 4, 6 }; + no_pointers_Expect(1, "silly"); + mixed_ExpectWithArrayAndReturn(6, expect_list, 5, 7, 13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: TRUE + :should: 'handle an exception being caught' + :code: | + test() + { + bars_ExpectAndReturn("This is a\0 silly string"); + foos_ExpectAndThrow("This is a\0 wacky string", 55); + foos_Expect("err"); + + function_c(); + } + + - :pass: FALSE + :should: 'handle an exception being caught but still catch following errors' + :code: | + test() + { + bars_ExpectAndReturn("This is a\0 silly string"); + foos_ExpectAndThrow("This is a\0 wacky string", 55); + foos_Expect("wrong error"); + + function_c(); + } + + - :pass: FALSE + :should: 'fail strict ordering problems even though we would otherwise have passed' + :code: | + test() + { + int expect_list[] = { 1, 2, 3, 4, 6 }; + mixed_ExpectWithArrayAndReturn(6, expect_list, 4, 7, 13); + no_pointers_Expect(1, "silly"); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: TRUE + :should: 'that we can properly ignore last function but the other will work properly' + :code: | + test() + { + int expect_list[] = { 1, 2, 3, 4, 6 }; + mixed_ExpectWithArrayAndReturn(6, expect_list, 4, 7, 13); + no_pointers_Ignore(); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: TRUE + :should: 'that we can properly ignore first function but the other will work properly' + :code: | + test() + { + mixed_IgnoreAndReturn(13); + no_pointers_Expect(1, "silly"); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: TRUE + :should: 'that we just have to ignore a call once because we are not counting calls' + :code: | + test() + { + foos_Ignore(); + + function_e(); + } + + - :pass: TRUE + :should: 'that we can use a callback and an expect' + :code: | + test() + { + POINT_T pt1 = {2, 3}; + POINT_T pt2 = {2, 3}; + bar_ExpectAndReturn(&pt1); + foo_Expect(&pt2); + foo_StubWithCallback((CMOCK_foo_CALLBACK)my_foo_callback); + + function_a(); + } + + - :pass: FALSE + :should: 'that we can fail even when using a callback if we want to expect call but did not and we are checking that' + :code: | + test() + { + POINT_T pt = {2, 3}; + bar_ExpectAndReturn(&pt); + foo_StubWithCallback((CMOCK_foo_CALLBACK)my_foo_callback); + + function_a(); + } + + - :pass: FALSE + :should: 'that we can fail even when using a callback if args are wrong and we are checking those' + :code: | + test() + { + POINT_T pt1 = {2, 3}; + POINT_T pt2 = {1, 3}; + bar_ExpectAndReturn(&pt1); + foo_Expect(&pt2); + foo_StubWithCallback((CMOCK_foo_CALLBACK)my_foo_callback); + + function_a(); + } + + - :pass: FALSE + :should: 'that we can fail from the callback itself' + :code: | + test() + { + POINT_T pt = {3, 3}; + bar_ExpectAndReturn(&pt); + foo_Expect(&pt); + foo_StubWithCallback((CMOCK_foo_CALLBACK)my_foo_callback); + + function_a(); + } + +... diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/array_and_pointer_handling.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/array_and_pointer_handling.yml new file mode 100644 index 0000000..dfa7d10 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/array_and_pointer_handling.yml @@ -0,0 +1,382 @@ +--- +:cmock: + :when_ptr: :smart + :plugins: + - :array + +:systest: + :types: | + typedef struct _POINT_T { + int x; + int y; + } POINT_T; + #define ARRAY_A_SIZE (5) + + :mockable: | + void foo(POINT_T* a); + POINT_T* bar(void); + void fooa(POINT_T a[ARRAY_A_SIZE+1-1]); + void foos(const char * a); + const char * bars(void); + void no_pointers(int a, char* b); + int mixed(int a, int* b, int c); + void potential_packing_problem(short *a); + + :source: + :header: | + void function_a(void); + void function_b(void); + void function_c(void); + int function_d(void); + void function_e(void); + + :code: | + void function_a(void) + { + foo(bar()); + } + + void function_b(void) { + fooa(bar()); + } + + void function_c(void) { + foos(bars()); + } + + int function_d(void) { + int test_list[] = { 1, 2, 3, 4, 5 }; + no_pointers(1, "silly"); + return mixed(6, test_list, 7); + } + + void function_e(void) { + short test_list[] = {-1, -2, -3, -4}; + potential_packing_problem(&test_list[1]); + } + + :tests: + :common: | + void setUp(void) {} + void tearDown(void) {} + + :units: + - :pass: TRUE + :should: 'handle the situation where we pass nulls to pointers' + :code: | + test() + { + bar_ExpectAndReturn(NULL); + foo_Expect(NULL); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we expected nulls to pointers but did not get that' + :code: | + test() + { + POINT_T pt = {1, 2}; + bar_ExpectAndReturn(&pt); + foo_Expect(NULL); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we did not expect nulls to pointers but got null' + :code: | + test() + { + POINT_T ex = {1, 2}; + bar_ExpectAndReturn(NULL); + foo_Expect(&ex); + + function_a(); + } + + - :pass: TRUE + :should: 'handle the situation where it falls back to pointers because you asked it to compare 0 elements' + :code: | + test() + { + POINT_T ex = {1, 2}; + bar_ExpectAndReturn(&ex); + foo_ExpectWithArray(&ex, 0); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where it fails because you asked it to compare zero elements and the pointers do not match' + :code: | + test() + { + POINT_T ex = {1, 2}; + POINT_T pt = {1, 2}; + bar_ExpectAndReturn(&pt); + foo_ExpectWithArray(&ex, 0); + + function_a(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass single object with expect' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 2}; + bar_ExpectAndReturn(&pt); + foo_Expect(&ex); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass single object with expect and it is wrong' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 3}; + bar_ExpectAndReturn(&pt); + foo_Expect(&ex); + + function_a(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass single object with expect and use array handler' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 2}; + bar_ExpectAndReturn(&pt); + foo_ExpectWithArray(&ex, 1); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass single object with expect and use array handler and it is wrong' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 3}; + bar_ExpectAndReturn(&pt); + foo_ExpectWithArray(&ex, 1); + + function_a(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass multiple objects with expect and use array handler' + :code: | + test() + { + POINT_T pt[] = {{1, 2}, {3, 4}, {5, 6}}; + POINT_T ex[] = {{1, 2}, {3, 4}, {5, 6}}; + bar_ExpectAndReturn(pt); + foo_ExpectWithArray(ex, 3); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass multiple objects with expect and use array handler and it is wrong at start' + :code: | + test() + { + POINT_T pt[] = {{1, 2}, {3, 4}, {5, 6}}; + POINT_T ex[] = {{9, 2}, {3, 4}, {5, 6}}; + bar_ExpectAndReturn(pt); + foo_ExpectWithArray(ex, 3); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass multiple objects with expect and use array handler and it is wrong at end' + :code: | + test() + { + POINT_T pt[] = {{1, 2}, {3, 4}, {5, 6}}; + POINT_T ex[] = {{1, 2}, {3, 4}, {5, 9}}; + bar_ExpectAndReturn(pt); + foo_ExpectWithArray(ex, 3); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass multiple objects with expect and use array handler and it is wrong in middle' + :code: | + test() + { + POINT_T pt[] = {{1, 2}, {3, 4}, {5, 6}}; + POINT_T ex[] = {{1, 2}, {3, 9}, {5, 6}}; + bar_ExpectAndReturn(pt); + foo_ExpectWithArray(ex, 3); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass nulls to pointers and fail' + :code: | + test() + { + POINT_T pt = {1, 2}; + bar_ExpectAndReturn(&pt); + foo_Expect(NULL); + + function_a(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass nulls to arrays' + :code: | + test() + { + bar_ExpectAndReturn(NULL); + fooa_Expect(NULL); + + function_b(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass single array element with expect' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 2}; + bar_ExpectAndReturn(&pt); + fooa_Expect(&ex); + + function_b(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass single array element with expect and it is wrong' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 3}; + bar_ExpectAndReturn(&pt); + fooa_Expect(&ex); + + function_b(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass nulls to arrays and fail' + :code: | + test() + { + POINT_T pt = {1, 2}; + bar_ExpectAndReturn(&pt); + fooa_Expect(NULL); + + function_b(); + } + + - :pass: TRUE + :should: 'handle standard c string as null terminated on not do crappy memory compares of a byte, passing' + :code: | + test() + { + bars_ExpectAndReturn("This is a\0 silly string"); + foos_Expect("This is a\0 wacky string"); + + function_c(); + } + + - :pass: FALSE + :should: 'handle standard c string as null terminated on not do crappy memory compares of a byte, finding failures' + :code: | + test() + { + bars_ExpectAndReturn("This is a silly string"); + foos_Expect("This is a wacky string"); + + function_c(); + } + + - :pass: TRUE + :should: 'handle creating array expects when we have mixed arguments for single object' + :code: | + test() + { + int expect_list[] = { 1, 9 }; + no_pointers_Expect(1, "silly"); + mixed_ExpectAndReturn(6, expect_list, 7, 13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: FALSE + :should: 'handle creating array expects when we have mixed arguments and handle failures for single object' + :code: | + test() + { + int expect_list[] = { 9, 1 }; + no_pointers_Expect(1, "silly"); + mixed_ExpectAndReturn(6, expect_list, 7, 13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: TRUE + :should: 'handle creating array expects when we have mixed arguments for multiple objects' + :code: | + test() + { + int expect_list[] = { 1, 2, 3, 4, 6 }; + no_pointers_Expect(1, "silly"); + mixed_ExpectWithArrayAndReturn(6, expect_list, 4, 7, 13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: FALSE + :should: 'handle creating array expects when we have mixed arguments and handle failures for multiple objects' + :code: | + test() + { + int expect_list[] = { 1, 2, 3, 4, 6 }; + no_pointers_Expect(1, "silly"); + mixed_ExpectWithArrayAndReturn(6, expect_list, 5, 7, 13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: TRUE + :should: 'handle a passing version of a potential packing problem (particularly try with ARM simulators)' + :code: | + test() + { + short expect_list[] = { -2, -3, -4 }; + potential_packing_problem_ExpectWithArray(expect_list, 3); + + function_e(); + } + + - :pass: FALSE + :should: 'handle a failing version of a potential packing problem (particularly try with ARM simulators)' + :code: | + test() + { + short expect_list[] = { -2, -3, 4 }; + potential_packing_problem_ExpectWithArray(expect_list, 3); + + function_e(); + } + + +... diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/basic_expect_and_return.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/basic_expect_and_return.yml new file mode 100644 index 0000000..ecd6b2c --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/basic_expect_and_return.yml @@ -0,0 +1,123 @@ +--- +:cmock: + :plugins: + - # none + +:systest: + :types: | + #define UINT32 unsigned int + + typedef signed int custom_type; + + :mockable: | + UINT32 foo(custom_type a); + UINT32 bar(custom_type b); + UINT32 foo_varargs(custom_type a, ...); + char* foo_char_strings(char a[], char* b); + + :source: + :header: | + UINT32 function_a(int a, int b); + void function_b(void); + UINT32 function_c(int a); + char* function_d(char a[], char* b); + + :code: | + UINT32 function_a(int a, int b) + { + return foo((custom_type)a) + bar((custom_type)b); + } + + void function_b(void) { } + + UINT32 function_c(int a) + { + return foo_varargs((custom_type)a, "ignored", 5); + } + + char* function_d(char a[], char* b) + { + return foo_char_strings(a, b); + } + + :tests: + :common: | + void setUp(void) {} + void tearDown(void) {} + + :units: + - :pass: TRUE + :should: 'successfully exercise two simple ExpectAndReturn mock calls' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + bar_ExpectAndReturn((custom_type)2, 20); + TEST_ASSERT_EQUAL(30, function_a(1, 2)); + } + + - :pass: FALSE + :should: 'fail because bar() is not called but is expected' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + TEST_ASSERT_EQUAL(30, function_a(1, 2)); + } + + - :pass: FALSE + :should: 'fail because bar() is called but is not expected' + :code: | + test() + { + bar_ExpectAndReturn((custom_type)1, 10); + function_b(); + } + + - :pass: TRUE + :should: 'consume var args passed to mocked function' + :code: | + test() + { + foo_varargs_ExpectAndReturn((custom_type)3, 10); + TEST_ASSERT_EQUAL(10, function_c(3)); + } + + - :pass: TRUE + :should: 'handle char strings' + :code: | + test() + { + foo_char_strings_ExpectAndReturn("larry", "curly", "moe"); + TEST_ASSERT_EQUAL_STRING("moe", function_d("larry", "curly")); + } + + - :pass: TRUE + :should: 'successfully exercise multiple cycles of expecting and mocking and pass' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + bar_ExpectAndReturn((custom_type)2, 20); + TEST_ASSERT_EQUAL(30, function_a(1, 2)); + + foo_ExpectAndReturn((custom_type)3, 30); + bar_ExpectAndReturn((custom_type)4, 40); + TEST_ASSERT_EQUAL(70, function_a(3, 4)); + } + + - :pass: FALSE + :should: 'successfully exercise multiple cycles of expecting and mocking and fail' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + bar_ExpectAndReturn((custom_type)2, 20); + TEST_ASSERT_EQUAL(30, function_a(1, 2)); + + foo_ExpectAndReturn((custom_type)3, 30); + bar_ExpectAndReturn((custom_type)4, 40); + TEST_ASSERT_EQUAL(70, function_a(3, 5)); + } + +... diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/const_primitives_handling.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/const_primitives_handling.yml new file mode 100644 index 0000000..2fc1b21 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/const_primitives_handling.yml @@ -0,0 +1,87 @@ +--- +:cmock: + :plugins: + - # none + +:systest: + :types: | + + :mockable: | + // no argument names + void foo(char const*, char* const, const char*); + + // argument names + void bar(char const* param1, char* const param2, const char* param3); + + :source: + :header: | + void exercise_const1(char const* param1, char* const param2, const char* param3); + void exercise_const2(char const* param1, char* const param2, const char* param3); + + :code: | + char value1 = '1'; + char value2 = '2'; + + const char* A = &value1; + char* const B = &value2; + const char* C = "C"; + const char* D = "D"; + + void exercise_const1(char const* param1, char* const param2, const char* param3) + { + foo(param1, param2, param3); + } + + void exercise_const2(char const* param1, char* const param2, const char* param3) + { + bar(param1, param2, param3); + } + + :tests: + :common: | + extern const char* A; + extern char* const B; + extern const char* C; + extern const char* D; + + void setUp(void) {} + void tearDown(void) {} + :units: + - :pass: TRUE + :should: 'successfully pass several const parameters' + :code: | + test() + { + foo_Expect( A, B, C ); + exercise_const1( A, B, C ); + } + + - :pass: FALSE + :should: 'should fail upon wrong const arguments passed' + :code: | + test() + { + foo_Expect( A, B, C ); + exercise_const1( (const char*)B, (char * const)A, C ); + } + + - :pass: FALSE + :should: 'should fail upon wrong const arguments passed' + :code: | + test() + { + foo_Expect( A, B, C ); + exercise_const1( A, B, D ); + } + + - :pass: FALSE + :should: 'should fail upon wrong const arguments passed' + :code: | + test() + { + bar_Expect( A, B, C ); + exercise_const2( A, (char * const)C, (const char *)B ); + } + + +... diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/enforce_strict_ordering.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/enforce_strict_ordering.yml new file mode 100644 index 0000000..61e2999 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/enforce_strict_ordering.yml @@ -0,0 +1,247 @@ +--- +:cmock: + :enforce_strict_ordering: 1 + :plugins: + - :ignore + - :cexception + +:systest: + :types: | + #define UINT32 unsigned int + + typedef signed int custom_type; + + :mockable: | + #include "CException.h" + UINT32 foo(custom_type a); + UINT32 bar(custom_type b); + void baz(custom_type c); + + :source: + :header: | + #include "CException.h" + UINT32 function_a(int a, int b); + void function_b(void); + void function_c(void); + void function_d(void); + + :code: | + UINT32 function_a(int a, int b) + { + return foo((custom_type)a) + bar((custom_type)b); + } + + void function_b(void) + { + baz((custom_type)1); + foo((custom_type)2); + bar((custom_type)3); + baz((custom_type)4); + foo((custom_type)5); + bar((custom_type)6); + baz((custom_type)7); + } + + void function_c(void) + { + foo((custom_type)1); + foo((custom_type)2); + bar((custom_type)3); + bar((custom_type)4); + foo((custom_type)5); + } + + void function_d(void) + { + CEXCEPTION_T e; + Try + { + foo((custom_type)1); + } + Catch(e) {} + Try + { + bar((custom_type)2); + } + Catch(e) {} + Try + { + foo((custom_type)3); + } + Catch(e) {} + } + + :tests: + :common: | + #include "CException.h" + void setUp(void) {} + void tearDown(void) {} + + :units: + - :pass: TRUE + :should: 'successfully exercise two simple ExpectAndReturn mock calls' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + bar_ExpectAndReturn((custom_type)2, 20); + TEST_ASSERT_EQUAL(30, function_a(1, 2)); + } + + - :pass: FALSE + :should: 'fail because bar() is called but is not expected' + :verify_error: 'called more times than expected' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + TEST_ASSERT_EQUAL(30, function_a(1, 2)); + } + + - :pass: FALSE + :should: 'fail because bar() is called twice but is expected once' + :verify_error: 'called less times than expected' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + bar_ExpectAndReturn((custom_type)2, 20); + bar_ExpectAndReturn((custom_type)3, 30); + TEST_ASSERT_EQUAL(30, function_a(1, 2)); + } + + - :pass: FALSE + :should: 'fail because bar and foo called in reverse order' + :verify_error: 'called earlier than expected' + :code: | + test() + { + bar_ExpectAndReturn((custom_type)2, 20); + foo_ExpectAndReturn((custom_type)1, 10); + TEST_ASSERT_EQUAL(30, function_a(1, 2)); + } + + - :pass: TRUE + :should: 'pass because bar and foo called in order with multiple params' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + foo_ExpectAndReturn((custom_type)2, 10); + bar_ExpectAndReturn((custom_type)3, 20); + bar_ExpectAndReturn((custom_type)4, 10); + foo_ExpectAndReturn((custom_type)5, 10); + function_c(); + } + + - :pass: FALSE + :should: 'fail because bar and foo called out of order at end' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + foo_ExpectAndReturn((custom_type)2, 10); + bar_ExpectAndReturn((custom_type)3, 20); + foo_ExpectAndReturn((custom_type)5, 10); + bar_ExpectAndReturn((custom_type)4, 10); + function_c(); + } + + - :pass: FALSE + :should: 'fail because bar and foo called out of order at start' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)2, 10); + foo_ExpectAndReturn((custom_type)1, 10); + bar_ExpectAndReturn((custom_type)3, 20); + bar_ExpectAndReturn((custom_type)4, 10); + foo_ExpectAndReturn((custom_type)5, 10); + function_c(); + } + + - :pass: TRUE + :should: 'pass because we are properly ignoring baz' + :code: | + test() + { + baz_Ignore(); + foo_ExpectAndReturn((custom_type)2, 10); + bar_ExpectAndReturn((custom_type)3, 20); + foo_ExpectAndReturn((custom_type)5, 10); + bar_ExpectAndReturn((custom_type)6, 10); + function_b(); + } + + - :pass: FALSE + :should: 'fail because bar and foo out of order, even though baz is ignored' + :code: | + test() + { + baz_Ignore(); + foo_ExpectAndReturn((custom_type)2, 10); + foo_ExpectAndReturn((custom_type)5, 10); + bar_ExpectAndReturn((custom_type)3, 20); + bar_ExpectAndReturn((custom_type)6, 10); + function_b(); + } + + - :pass: TRUE + :should: 'pass when using cexception, as long as the order is right' + :code: | + test() + { + foo_ExpectAndThrow((custom_type)1, 10); + bar_ExpectAndReturn((custom_type)2, 20); + foo_ExpectAndReturn((custom_type)3, 10); + function_d(); + } + + - :pass: FALSE + :should: 'fail when an throw call is made out of order' + :code: | + test() + { + bar_ExpectAndReturn((custom_type)2, 20); + foo_ExpectAndThrow((custom_type)1, 10); + foo_ExpectAndReturn((custom_type)3, 10); + function_d(); + } + + - :pass: TRUE + :should: 'successfully handle back to back ExpectAndReturn setup and mock calls' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + bar_ExpectAndReturn((custom_type)2, 20); + TEST_ASSERT_EQUAL(30, function_a(1, 2)); + + foo_ExpectAndReturn((custom_type)3, 30); + bar_ExpectAndReturn((custom_type)4, 40); + TEST_ASSERT_EQUAL(70, function_a(3, 4)); + + foo_ExpectAndReturn((custom_type)1, 50); + bar_ExpectAndReturn((custom_type)9, 60); + TEST_ASSERT_EQUAL(110, function_a(1, 9)); + } + + - :pass: FALSE + :should: 'successfully catch errors during back to back ExpectAndReturn setup and mock calls' + :verify_error: 'called earlier than expected' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + bar_ExpectAndReturn((custom_type)2, 20); + TEST_ASSERT_EQUAL(30, function_a(1, 2)); + + foo_ExpectAndReturn((custom_type)3, 30); + bar_ExpectAndReturn((custom_type)4, 40); + TEST_ASSERT_EQUAL(70, function_a(3, 4)); + + bar_ExpectAndReturn((custom_type)9, 60); + foo_ExpectAndReturn((custom_type)1, 50); + TEST_ASSERT_EQUAL(110, function_a(1, 9)); + } +... diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/expect_and_return_custom_types.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/expect_and_return_custom_types.yml new file mode 100644 index 0000000..f5b13a3 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/expect_and_return_custom_types.yml @@ -0,0 +1,108 @@ +--- +:cmock: + :plugins: + - # none + :memcmp_if_unknown: false + +:systest: + :types: | + typedef struct _EXAMPLE_STRUCT_T { int x; int y; } EXAMPLE_STRUCT_T; + + :mockable: | + EXAMPLE_STRUCT_T foo(EXAMPLE_STRUCT_T a); + + :source: + :header: | + EXAMPLE_STRUCT_T function_a(EXAMPLE_STRUCT_T a, EXAMPLE_STRUCT_T b); + EXAMPLE_STRUCT_T function_b(EXAMPLE_STRUCT_T a, EXAMPLE_STRUCT_T b); + + :code: | + EXAMPLE_STRUCT_T function_a(EXAMPLE_STRUCT_T a, EXAMPLE_STRUCT_T b) + { + EXAMPLE_STRUCT_T retval = foo(a); + retval.x += b.x; + retval.y += b.y; + return retval; + } + + EXAMPLE_STRUCT_T function_b(EXAMPLE_STRUCT_T a, EXAMPLE_STRUCT_T b) + { + EXAMPLE_STRUCT_T retval = foo(b); + retval.x *= a.x; + retval.y *= a.y; + return retval; + } + + :tests: + :common: | + #include "expect_and_return_custom_types_unity_helper.h" + void setUp(void) {} + void tearDown(void) {} + + :units: + - :pass: TRUE + :should: 'successfully exercise simple ExpectAndReturn mock calls' + :code: | + test() + { + EXAMPLE_STRUCT_T c = {1,2}; + EXAMPLE_STRUCT_T d = {3,4}; + EXAMPLE_STRUCT_T e = {2,4}; + EXAMPLE_STRUCT_T f = {5,8}; + foo_ExpectAndReturn(c, e); + TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(f, function_a(c,d)); + } + + - :pass: FALSE + :should: 'fail because it is expecting to call foo with c not d' + :code: | + test() + { + EXAMPLE_STRUCT_T c = {1,2}; + EXAMPLE_STRUCT_T d = {3,4}; + EXAMPLE_STRUCT_T e = {2,4}; + EXAMPLE_STRUCT_T f = {5,8}; + foo_ExpectAndReturn(d, e); + TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(f, function_a(c,d)); + } + + - :pass: TRUE + :should: 'successfully exercise simple ExpectAndReturn mock calls on other function' + :code: | + test() + { + EXAMPLE_STRUCT_T c = {1,2}; + EXAMPLE_STRUCT_T d = {3,4}; + EXAMPLE_STRUCT_T e = {2,4}; + EXAMPLE_STRUCT_T f = {2,8}; + foo_ExpectAndReturn(d, e); + TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(f, function_b(c,d)); + } + + - :pass: FALSE + :should: 'fail because it is expecting to call foo with d not c' + :code: | + test() + { + EXAMPLE_STRUCT_T c = {1,2}; + EXAMPLE_STRUCT_T d = {3,4}; + EXAMPLE_STRUCT_T e = {2,4}; + EXAMPLE_STRUCT_T f = {2,8}; + foo_ExpectAndReturn(c, e); + TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(f, function_b(c,d)); + } + + :unity_helper: + :header: | + void AssertEqualExampleStruct(EXAMPLE_STRUCT_T expected, EXAMPLE_STRUCT_T actual, unsigned short line); + #define UNITY_TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(expected, actual, line, message) {AssertEqualExampleStruct(expected, actual, line);} + #define TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(expected, actual) UNITY_TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(expected, actual, __LINE__, NULL); + + :code: | + void AssertEqualExampleStruct(EXAMPLE_STRUCT_T expected, EXAMPLE_STRUCT_T actual, unsigned short line) + { + UNITY_TEST_ASSERT_EQUAL_INT(expected.x, actual.x, line, "Example Struct Failed For Field x"); + UNITY_TEST_ASSERT_EQUAL_INT(expected.y, actual.y, line, "Example Struct Failed For Field y"); + } + +... diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/expect_and_return_treat_as.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/expect_and_return_treat_as.yml new file mode 100644 index 0000000..2a73273 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/expect_and_return_treat_as.yml @@ -0,0 +1,173 @@ +--- +:cmock: + :plugins: + - # none + :treat_as: + MY_STRING: STRING + MY_INT: INT + PTR_INT: INT* + MY_HEX: HEX32 + +:systest: + :types: | + typedef char* MY_STRING; + typedef int MY_INT; + typedef unsigned int MY_HEX; + typedef int* PTR_INT; + + :mockable: | + MY_INT foo(MY_HEX a); + MY_INT bar(MY_HEX b); + MY_STRING foo_char_strings(MY_STRING a, MY_STRING b); + float float_adder(float a, float b); + MY_INT* pointer_foo(MY_HEX* a); + void pointer_bar(PTR_INT a); + + :source: + :header: | + MY_INT function_a(MY_INT a, MY_INT b); + MY_STRING function_b(MY_STRING a, MY_STRING b); + float function_c(float a, float b); + MY_INT function_d(MY_HEX a); + void function_e(PTR_INT a); + + :code: | + MY_INT function_a(MY_INT a, MY_INT b) + { + return foo((MY_HEX)a) + bar((MY_HEX)b); + } + + MY_STRING function_b(MY_STRING a, MY_STRING b) + { + return foo_char_strings(a, b); + } + + float function_c(float a, float b) + { + return float_adder(b, a); + } + + MY_INT function_d(MY_HEX a) + { + MY_HEX b = a; + MY_INT* c = pointer_foo(&b); + return *c; + } + + void function_e(PTR_INT a) + { + pointer_bar(a); + } + + :tests: + :common: | + void setUp(void) {} + void tearDown(void) {} + + :units: + - :pass: TRUE + :should: 'successfully exercise two simple ExpectAndReturn mock calls' + :code: | + test() + { + foo_ExpectAndReturn((MY_HEX)1, 10); + bar_ExpectAndReturn((MY_HEX)2, 20); + TEST_ASSERT_EQUAL(30, function_a(1, 2)); + } + + - :pass: FALSE + :should: 'fail because bar() is expected but not called' + :code: | + test() + { + foo_ExpectAndReturn((MY_HEX)1, 10); + TEST_ASSERT_EQUAL(30, function_a(1, 2)); + } + + - :pass: FALSE + :should: 'fail because foo_char_strings() is called but is not expected' + :code: | + test() + { + foo_char_strings_ExpectAndReturn((MY_STRING)"jello", (MY_STRING)"jiggle", (MY_STRING)"boing!"); + function_a(1,2); + } + + - :pass: TRUE + :should: 'handle char strings' + :code: | + test() + { + foo_char_strings_ExpectAndReturn((MY_STRING)"jello", (MY_STRING)"jiggle", (MY_STRING)"boing!"); + TEST_ASSERT_EQUAL_STRING("boing!", function_b((MY_STRING)"jello", (MY_STRING)"jiggle")); + } + + - :pass: TRUE + :should: 'handle floating point numbers with Unity support: pass' + :code: | + test() + { + float_adder_ExpectAndReturn(1.2345, 6.7890, 8.0235); + TEST_ASSERT_EQUAL_FLOAT(8.0235, function_c(6.7890, 1.2345)); + } + + - :pass: FALSE + :should: 'handle floating point numbers with Unity support: fail' + :code: | + test() + { + float_adder_ExpectAndReturn(1.2345, 6.7892, 8.0235); + TEST_ASSERT_EQUAL_FLOAT(8.0235, function_c(6.7890, 1.2345)); + } + + - :pass: TRUE + :should: 'handle pointers to treat_as values just as cleanly as the treat_as itself for passes' + :code: | + test() + { + MY_HEX TestHex = (MY_HEX)45; + MY_INT TestInt = (MY_INT)33; + pointer_foo_ExpectAndReturn(&TestHex, &TestInt); + TEST_ASSERT_EQUAL_INT(33, function_d(45)); + } + + - :pass: FALSE + :should: 'handle pointers to treat_as values just as cleanly as the treat_as itself for failures' + :verify_error: 'Element 0 Expected 0x0000002D Was 0x0000002B' + :code: | + test() + { + MY_HEX TestHex = (MY_HEX)45; + MY_INT TestInt = (MY_INT)33; + pointer_foo_ExpectAndReturn(&TestHex, &TestInt); + TEST_ASSERT_EQUAL_INT(33, function_d(43)); + } + + - :pass: TRUE + :should: 'handle treat_as values containing pointers for passes' + :code: | + test() + { + MY_INT ExpInt = (MY_INT)33; + PTR_INT ExpPtr = (PTR_INT)(&ExpInt); + MY_INT ActInt = (MY_INT)33; + PTR_INT ActPtr = (PTR_INT)(&ActInt); + pointer_bar_Expect(ExpPtr); + function_e(ActPtr); + } + + - :pass: FALSE + :should: 'handle treat_as values containing pointers for failures' + :verify_error: 'Element 0 Expected 33 Was 45' + :code: | + test() + { + MY_INT ExpInt = (MY_INT)33; + PTR_INT ExpPtr = (PTR_INT)(&ExpInt); + MY_INT ActInt = (MY_INT)45; + PTR_INT ActPtr = (PTR_INT)(&ActInt); + pointer_bar_Expect(ExpPtr); + function_e(ActPtr); + } + +... diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/expect_and_throw.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/expect_and_throw.yml new file mode 100644 index 0000000..c22524c --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/expect_and_throw.yml @@ -0,0 +1,170 @@ +--- +:cmock: + :plugins: + - :cexception + +:systest: + :types: | + #define UINT32 unsigned int + typedef signed int custom_type; + + :mockable: | + #include "CException.h" + UINT32 foo(custom_type a); + UINT32 bar(custom_type b); + UINT32 foo_varargs(custom_type a, ...); + + :source: + :header: | + #include "CException.h" + UINT32 function_a(int a); + void function_b(char a); + + :code: | + UINT32 function_a(int a) + { + UINT32 r = 0; + CEXCEPTION_T e; + + Try + { + r = (UINT32)foo((custom_type)a); + } + Catch(e) + { + r = (UINT32)e*2; + } + return r; + } + + void function_b(char a) + { + if (a) + { + Throw((CEXCEPTION_T)a); + } + } + + :tests: + :common: | + #include "CException.h" + void setUp(void) {} + void tearDown(void) {} + + :units: + - :pass: TRUE + :should: 'successfully exercise a simple ExpectAndReturn mock calls' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + TEST_ASSERT_EQUAL(10, function_a(1)); + } + + - :pass: TRUE + :should: 'successfully throw an error on first call' + :code: | + test() + { + foo_ExpectAndThrow((custom_type)1, 55); + TEST_ASSERT_EQUAL(110, function_a(1)); + } + + - :pass: TRUE + :should: 'successfully throw an error on later calls' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + foo_ExpectAndReturn((custom_type)2, 20); + foo_ExpectAndThrow((custom_type)3, 15); + foo_ExpectAndReturn((custom_type)4, 40); + TEST_ASSERT_EQUAL(10, function_a(1)); + TEST_ASSERT_EQUAL(20, function_a(2)); + TEST_ASSERT_EQUAL(30, function_a(3)); + TEST_ASSERT_EQUAL(40, function_a(4)); + } + + - :pass: TRUE + :should: 'pass because we nothing happens' + :code: | + test() + { + function_b(0); + } + + - :pass: FALSE + :should: 'fail because we did not expect function B to throw' + :code: | + test() + { + function_b(1); + } + + - :pass: TRUE + :should: 'fail because we expect function B to throw' + :code: | + test() + { + CEXCEPTION_T e; + Try + { + function_b(3); + TEST_FAIL_MESSAGE("Should Have Thrown"); + } + Catch(e) + { + TEST_ASSERT_EQUAL(3, e); + } + } + + - :pass: TRUE + :should: 'successfully throw an error on consecutive calls' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + foo_ExpectAndReturn((custom_type)1, 20); + foo_ExpectAndThrow((custom_type)1, 15); + foo_ExpectAndThrow((custom_type)3, 40); + TEST_ASSERT_EQUAL(10, function_a(1)); + TEST_ASSERT_EQUAL(20, function_a(1)); + TEST_ASSERT_EQUAL(30, function_a(1)); + TEST_ASSERT_EQUAL(80, function_a(3)); + } + + - :pass: TRUE + :should: 'successfully throw an error on later calls and after a previous mock call' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + foo_ExpectAndReturn((custom_type)1, 20); + foo_ExpectAndThrow((custom_type)1, 15); + TEST_ASSERT_EQUAL(10, function_a(1)); + TEST_ASSERT_EQUAL(20, function_a(1)); + TEST_ASSERT_EQUAL(30, function_a(1)); + + foo_ExpectAndReturn((custom_type)2, 20); + foo_ExpectAndThrow((custom_type)3, 40); + TEST_ASSERT_EQUAL(20, function_a(2)); + TEST_ASSERT_EQUAL(80, function_a(3)); + } + + - :pass: TRUE + :should: 'successfully throw an error if expects and mocks called before it' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + foo_ExpectAndReturn((custom_type)1, 20); + TEST_ASSERT_EQUAL(10, function_a(1)); + TEST_ASSERT_EQUAL(20, function_a(1)); + + foo_ExpectAndReturn((custom_type)2, 20); + foo_ExpectAndThrow((custom_type)3, 40); + TEST_ASSERT_EQUAL(20, function_a(2)); + TEST_ASSERT_EQUAL(80, function_a(3)); + } + +... diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/fancy_pointer_handling.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/fancy_pointer_handling.yml new file mode 100644 index 0000000..e6e75e5 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/fancy_pointer_handling.yml @@ -0,0 +1,208 @@ +--- +:cmock: + :plugins: + - # none + :treat_as: + INT_PTR: INT* + +:systest: + :types: | + typedef struct _POINT_T { + int x; + int y; + } POINT_T; + typedef int* INT_PTR; + + :mockable: | + void foo(POINT_T* a); + POINT_T* bar(void); + void fooa(POINT_T a[]); + void foos(const char *a); + const char* bars(void); + INT_PTR zoink(INT_PTR a); + + :source: + :header: | + void function_a(void); + void function_b(void); + void function_c(void); + int function_d(void); + + :code: | + void function_a(void) + { + foo(bar()); + } + + void function_b(void) { + fooa(bar()); + } + + void function_c(void) { + foos(bars()); + } + + int function_d(void) { + int i = 456; + INT_PTR ptr = (INT_PTR)(&i); + return (int)(*(zoink(ptr))); + } + + :tests: + :common: | + void setUp(void) {} + void tearDown(void) {} + + :units: + - :pass: TRUE + :should: 'handle the situation where we pass nulls to pointers' + :code: | + test() + { + bar_ExpectAndReturn(NULL); + foo_Expect(NULL); + + function_a(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass single object with expect' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 2}; + bar_ExpectAndReturn(&pt); + foo_Expect(&ex); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass single object with expect and it is wrong' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 3}; + bar_ExpectAndReturn(&pt); + foo_Expect(&ex); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass nulls to pointers and fail' + :code: | + test() + { + POINT_T pt = {1, 2}; + bar_ExpectAndReturn(&pt); + foo_Expect(NULL); + + function_a(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass nulls to arrays' + :code: | + test() + { + bar_ExpectAndReturn(NULL); + fooa_Expect(NULL); + + function_b(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass single array element with expect' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 2}; + bar_ExpectAndReturn(&pt); + fooa_Expect(&ex); + + function_b(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass single array element with expect and it is wrong' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 3}; + bar_ExpectAndReturn(&pt); + fooa_Expect(&ex); + + function_b(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass nulls to arrays and fail' + :code: | + test() + { + POINT_T pt = {1, 2}; + bar_ExpectAndReturn(&pt); + fooa_Expect(NULL); + + function_b(); + } + + - :pass: TRUE + :should: 'handle standard c string as null terminated on not do crappy memory compares of a byte, passing' + :code: | + test() + { + bars_ExpectAndReturn("This is a\0 silly string"); + foos_Expect("This is a\0 wacky string"); + + function_c(); + } + + - :pass: FALSE + :should: 'handle standard c string as null terminated on not do crappy memory compares of a byte, finding failures' + :code: | + test() + { + bars_ExpectAndReturn("This is a silly string"); + foos_Expect("This is a wacky string"); + + function_c(); + } + + - :pass: TRUE + :should: 'handle handle typedefs that ARE pointers by using treat_as' + :code: | + test() + { + int e = 456; + int r = 789; + INT_PTR ptr_e = (INT_PTR)(&e); + INT_PTR ptr_r = (INT_PTR)(&r); + + zoink_ExpectAndReturn(ptr_e, ptr_r); + + TEST_ASSERT_EQUAL(r, function_d()); + } + + - :pass: FALSE + :should: 'handle handle typedefs that ARE pointers by using treat_as and catch failures' + :code: | + test() + { + int e = 457; + int r = 789; + INT_PTR ptr_e = (INT_PTR)(&e); + INT_PTR ptr_r = (INT_PTR)(&r); + + zoink_ExpectAndReturn(ptr_e, ptr_r); + + TEST_ASSERT_EQUAL(r, function_d()); + } + + +... diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/function_pointer_handling.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/function_pointer_handling.yml new file mode 100644 index 0000000..9462bdd --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/function_pointer_handling.yml @@ -0,0 +1,82 @@ +--- +:cmock: + :plugins: + - # none + :treat_as: + FUNCTION_T: PTR + +:systest: + :types: | + typedef void (*FUNCTION_T)(void); + + :mockable: | + void takes_function_type( FUNCTION_T myfunc ); + void takes_function_ptr( unsigned int (*func_ptr)(int, char) ); + void takes_const_function_ptr( unsigned int (* const)(int, char) ); + unsigned short (*returns_function_ptr( const char op_code ))( int, long int ); + + :source: + :header: | + void exercise_function_pointer_param(void); + unsigned short (*exercise_function_pointer_return( const char op_code ))( int, long int ); + + // functions for function pointer tests + unsigned int dummy_function1(int a, char b); + unsigned short dummy_function2(int a, long int b); + + :code: | + /* + * functions used in tests + */ + + unsigned int dummy_function1(int a, char b) + { + // prevent compiler warnings by using everything + return (unsigned int)a + (unsigned int)b; + } + + unsigned short dummy_function2(int a, long int b) + { + // prevent compiler warnings by using everything + return (unsigned short)a + (unsigned short)b; + } + + /* + * functions executed by tests + */ + + void exercise_function_pointer_param(void) + { + takes_function_ptr(dummy_function1); + } + + unsigned short (*exercise_function_pointer_return( const char op_code ))( int, long int ) + { + return returns_function_ptr(op_code); + } + + :tests: + :common: | + void setUp(void) {} + void tearDown(void) {} + :units: + - :pass: TRUE + :should: 'expect a function pointer param' + :code: | + test() + { + takes_function_ptr_Expect(dummy_function1); + exercise_function_pointer_param(); + } + + - :pass: TRUE + :should: 'return a function pointer' + :code: | + test() + { + returns_function_ptr_ExpectAndReturn('z', dummy_function2); + TEST_ASSERT_EQUAL_PTR(dummy_function2, exercise_function_pointer_return('z')); + } + + +... diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/ignore_and_return.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/ignore_and_return.yml new file mode 100644 index 0000000..281efd0 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/ignore_and_return.yml @@ -0,0 +1,153 @@ +--- +:cmock: + :plugins: + - 'ignore' + +:systest: + :types: | + + :mockable: | + int foo(int a); + void bar(int b); + + :source: + :header: | + int function(int a, int b, int c); + :code: | + int function(int a, int b, int c) + { + bar(b); + return foo(a) + foo(b) + foo(c); + } + + :tests: + :common: | + void setUp(void) {} + void tearDown(void) {} + :units: + - :pass: TRUE + :should: 'successfully exercise simple ExpectAndReturn mock calls' + :code: | + test() + { + bar_Expect(2); + foo_ExpectAndReturn(1, 10); + foo_ExpectAndReturn(2, 20); + foo_ExpectAndReturn(3, 30); + TEST_ASSERT_EQUAL(60, function(1, 2, 3)); + } + + - :pass: TRUE + :should: 'ignore foo() calls' + :code: | + test() + { + bar_Expect(4); + foo_IgnoreAndReturn(10); + foo_IgnoreAndReturn(40); + foo_IgnoreAndReturn(80); + TEST_ASSERT_EQUAL(130, function(3, 4, 3)); + } + + - :pass: TRUE + :should: 'ignore foo() calls and always return last item if we run out' + :code: | + test() + { + bar_Expect(4); + foo_IgnoreAndReturn(20); + foo_IgnoreAndReturn(30); + TEST_ASSERT_EQUAL(80, function(3, 4, 9)); + } + + - :pass: TRUE + :should: 'ignore foo() calls and always return only item if only one specified' + :code: | + test() + { + bar_Expect(4); + foo_IgnoreAndReturn(20); + TEST_ASSERT_EQUAL(60, function(3, 4, 9)); + } + + - :pass: TRUE + :should: 'ignore bar() and foo() calls' + :code: | + test() + { + bar_Ignore(); + foo_IgnoreAndReturn(50); + TEST_ASSERT_EQUAL(150, function(0, 0, 0)); + } + + - :pass: TRUE + :should: 'ignore foo() calls over multiple mock calls' + :code: | + test() + { + bar_Ignore(); + foo_IgnoreAndReturn(50); + foo_IgnoreAndReturn(60); + foo_IgnoreAndReturn(70); + TEST_ASSERT_EQUAL(180, function(0, 0, 0)); + + bar_Ignore(); + foo_IgnoreAndReturn(30); + foo_IgnoreAndReturn(80); + foo_IgnoreAndReturn(10); + TEST_ASSERT_EQUAL(120, function(0, 0, 0)); + + foo_IgnoreAndReturn(70); + foo_IgnoreAndReturn(20); + TEST_ASSERT_EQUAL(110, function(0, 0, 0)); + } + + - :pass: TRUE + :should: 'multiple cycles of expects still pass when ignores enabled' + :code: | + test() + { + bar_Expect(2); + foo_ExpectAndReturn(1, 50); + foo_ExpectAndReturn(2, 60); + foo_ExpectAndReturn(3, 70); + TEST_ASSERT_EQUAL(180, function(1, 2, 3)); + + bar_Expect(5); + foo_ExpectAndReturn(4, 30); + foo_ExpectAndReturn(5, 80); + foo_ExpectAndReturn(6, 10); + TEST_ASSERT_EQUAL(120, function(4, 5, 6)); + + bar_Expect(8); + foo_ExpectAndReturn(7, 70); + foo_ExpectAndReturn(8, 20); + foo_ExpectAndReturn(9, 20); + TEST_ASSERT_EQUAL(110, function(7, 8, 9)); + } + + - :pass: FALSE + :should: 'multiple cycles of expects still fail when ignores enabled' + :code: | + test() + { + bar_Expect(2); + foo_ExpectAndReturn(1, 50); + foo_ExpectAndReturn(2, 60); + foo_ExpectAndReturn(3, 70); + TEST_ASSERT_EQUAL(180, function(1, 2, 3)); + + bar_Expect(5); + foo_ExpectAndReturn(4, 30); + foo_ExpectAndReturn(5, 80); + foo_ExpectAndReturn(6, 10); + TEST_ASSERT_EQUAL(120, function(4, 5, 6)); + + bar_Expect(8); + foo_ExpectAndReturn(7, 70); + foo_ExpectAndReturn(8, 20); + foo_ExpectAndReturn(9, 20); + TEST_ASSERT_EQUAL(110, function(0, 8, 9)); + } + +... diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/newer_standards_stuff1.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/newer_standards_stuff1.yml new file mode 100644 index 0000000..6843eae --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/newer_standards_stuff1.yml @@ -0,0 +1,52 @@ +--- +#The purpose of this test is to pull in some standard library stuff from C99 +:cmock: + :includes: + - "" + - "" + +:systest: + :types: | + #include + #include + + + :mockable: | + int32_t foo(int32_t a); + + :source: + :header: | + int8_t function_a(void); + + :code: | + int8_t function_a(void) { + return (int8_t)(INT_MIN == foo(INT_MAX)); + } + + :tests: + :common: | + void setUp(void) {} + void tearDown(void) {} + + :units: + - :pass: TRUE + :should: 'handle handle a simple comparison of C99 types which pass' + :code: | + test() + { + foo_ExpectAndReturn(INT_MAX, INT_MIN); + + TEST_ASSERT_TRUE(function_a()); + } + + - :pass: FALSE + :should: 'handle handle a simple comparison of C99 types which fail' + :code: | + test() + { + foo_ExpectAndReturn(INT_MIN, INT_MIN); + + TEST_ASSERT_TRUE(function_a()); + } + +... diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/nonstandard_parsed_stuff_1.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/nonstandard_parsed_stuff_1.yml new file mode 100644 index 0000000..01538ea --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/nonstandard_parsed_stuff_1.yml @@ -0,0 +1,91 @@ +--- +#The purpose of this test is to play with things like "const char const *" which isn't supported by some compilers +:cmock: + :enforce_strict_ordering: 1 + :plugins: + - :array + - :cexception + - :ignore + +:systest: + :types: | + typedef struct _POINT_T { + int x; + int y; + } POINT_T; + + :mockable: | + #include "CException.h" + void foos(const char const * a); + const char const * bars(void); + + :source: + :header: | + #include "CException.h" + void function_a(void); + void function_b(void); + void function_c(void); + int function_d(void); + + :code: | + void function_c(void) { + CEXCEPTION_T e; + Try { + foos(bars()); + } Catch(e) { foos("err"); } + } + + :tests: + :common: | + #include "CException.h" + void setUp(void) {} + void tearDown(void) {} + + :units: + - :pass: TRUE + :should: 'handle standard c string as null terminated on not do crappy memory compares of a byte, passing' + :code: | + test() + { + bars_ExpectAndReturn("This is a\0 silly string"); + foos_Expect("This is a\0 wacky string"); + + function_c(); + } + + - :pass: FALSE + :should: 'handle standard c string as null terminated on not do crappy memory compares of a byte, finding failures' + :code: | + test() + { + bars_ExpectAndReturn("This is a silly string"); + foos_Expect("This is a wacky string"); + + function_c(); + } + + - :pass: TRUE + :should: 'handle an exception being caught' + :code: | + test() + { + bars_ExpectAndReturn("This is a\0 silly string"); + foos_ExpectAndThrow("This is a\0 wacky string", 55); + foos_Expect("err"); + + function_c(); + } + + - :pass: FALSE + :should: 'handle an exception being caught but still catch following errors' + :code: | + test() + { + bars_ExpectAndReturn("This is a\0 silly string"); + foos_ExpectAndThrow("This is a\0 wacky string", 55); + foos_Expect("wrong error"); + + function_c(); + } + +... diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/nonstandard_parsed_stuff_2.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/nonstandard_parsed_stuff_2.yml new file mode 100644 index 0000000..f9c9538 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/nonstandard_parsed_stuff_2.yml @@ -0,0 +1,59 @@ +--- +#The purpose of this test is to play with our really rough multidimensional array support, which involves an implicit cast not supported everywhere +:cmock: + :plugins: + - :array + +:systest: + :types: | + + + :mockable: | + void foo(unsigned char** a); + unsigned char** bar(void); + + :source: + :header: | + void function_a(void); + + :code: | + void function_a(void) { + foo(bar()); + } + + :tests: + :common: | + void setUp(void) {} + void tearDown(void) {} + + :units: + - :pass: TRUE + :should: 'handle two dimensional array of unsigned characters just like we would handle a single dimensional array in expect (where we really only care about first element)' + :code: | + test() + { + unsigned char a[] = { 1, 2, 3, 4, 5, 6 }; + unsigned char** pa = (unsigned char**)(&a); + + bar_ExpectAndReturn(pa); + foo_Expect(pa); + + function_a(); + } + + - :pass: FALSE + :should: 'handle two dimensional array of unsigned characters just like we would handle a single dimensional array in expect as failures (where we really only care about first element)' + :code: | + test() + { + unsigned char a[] = { 1, 2, 3, 4, 5, 6 }; + unsigned char b[] = { 5, 6, 7, 8, 9, 0 }; + unsigned char** pa = (unsigned char**)(&a); + unsigned char** pb = (unsigned char**)(&b); + + bar_ExpectAndReturn(pa); + foo_Expect(pb); + + function_a(); + } +... diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/parsing_challenges.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/parsing_challenges.yml new file mode 100644 index 0000000..835e1fa --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/parsing_challenges.yml @@ -0,0 +1,222 @@ +--- +:cmock: + :plugins: + - # no plugins + :treat_as_void: + - VOID_TYPE_CRAZINESS_CFG + :treat_as: + TypeDefInt: HEX8 + +:systest: + :types: | + typedef unsigned short U16; + typedef struct _POINT_T + { + int x; + int y; + } POINT_T; + typedef void VOID_TYPE_CRAZINESS_CFG; + typedef int TypeDefInt; + + :mockable: | + /* Make sure we ignore the following + #include "NonExistantFile.h + */ + //#include "AndIgnoreThisToo.h" + #ifdef __cplusplus + extern "C" { + #endif + #define SHOULD_IGNORE_NEXT_FUNC_DEF_AS_PART_OF_MACRO \ + void IgnoredFunction(NotAValidType ToMakeItFailIfWeActuallyMockedThis); + + // typedef edge case; must be in mockable.h for test to compile + // not ANSI C but it has been done and will break cmock if not handled + typedef void VOID_TYPE_CRAZINESS_LCL; + + VOID_TYPE_CRAZINESS_LCL void_type_craziness1(int * a, int *b, int* c); + void void_type_craziness2(VOID_TYPE_CRAZINESS_CFG); + + // pointer parsing exercise + U16 *ptr_return1(int a); + U16* ptr_return2(int a); + U16 * ptr_return3(int a); + + unsigned int** ptr_ptr_return1(unsigned int** a); + unsigned int* *ptr_ptr_return2(unsigned int* *a); + unsigned int **ptr_ptr_return3(unsigned int **a); + unsigned int ** ptr_ptr_return4(unsigned int ** a); + + // variable argument lists + void var_args1(int a, ...); + void var_args2(int a, int b, ...); + + // parsing "stress tests" + char + crazy_multiline( + int a, + unsigned int b); + + unsigned long int incredible_descriptors(register const unsigned short a); + + TypeDefInt uses_typedef_like_names(TypeDefInt typedefvar); + + void oh_brackets1(int fudge[5]); + void oh_brackets2(int caramel[]); + #ifdef __cplusplus + } + #endif + + :source: + :header: | + U16* exercise_return_pointers(int a); + void exercise_var_args(int a, int b); + void exercise_arglist_pointers(void); + char exercise_multiline_declarations(int a, unsigned int b); + void exercise_double_pointers(unsigned int** a); + int exercise_many_descriptors(int a); + TypeDefInt exercise_typedef_like_names(TypeDefInt a); + + :code: | + int A, B, C; + unsigned int *pA, *pB, *pC; + + U16* exercise_return_pointers(int a) + { + ptr_return1(a); + ptr_return2(a); + return ptr_return3(a); + } + + void exercise_var_args(int a, int b) + { + var_args1(a, 3); + var_args2(a, b, 'c'); + } + + void exercise_arglist_pointers(void) + { + void_type_craziness1(&A, &B, &C); + void_type_craziness2(); + } + + char exercise_multiline_declarations(int a, unsigned int b) + { + return crazy_multiline(a, b); + } + + void exercise_double_pointers(unsigned int** a) + { + ptr_ptr_return1((unsigned int**)a); + ptr_ptr_return2((unsigned int**)a); + ptr_ptr_return3((unsigned int**)a); + ptr_ptr_return4((unsigned int**)a); + } + + int exercise_many_descriptors(int a) + { + return (int)incredible_descriptors((unsigned short)a); + } + + TypeDefInt exercise_typedef_like_names(TypeDefInt a) + { + return uses_typedef_like_names(a); + } + + :tests: + :common: | + extern int A, B, C; + extern unsigned int *pA, *pB, *pC; + + void setUp(void) + { + A = 100; + B = 200; + C = 300; + pA = (unsigned int*)(&A); + pB = (unsigned int*)(&B); + pC = (unsigned int*)(&C); + } + void tearDown(void) {} + :units: + - :pass: TRUE + :should: 'execute simple pointer return value check' + :code: | + test() + { + U16 retval; + ptr_return1_ExpectAndReturn(2, NULL); + ptr_return2_ExpectAndReturn(2, NULL); + ptr_return3_ExpectAndReturn(2, &retval); + TEST_ASSERT_EQUAL_PTR(&retval, exercise_return_pointers(2)); + } + + - :pass: TRUE + :should: 'ignore var args in expect prototype generation' + :code: | + test() + { + var_args1_Expect(2); + var_args2_Expect(2, 3); + exercise_var_args(2, 3); + } + + - :pass: TRUE + :should: "not process a typedef'd void as anything other than void" + :code: | + test() + { + void_type_craziness1_Expect(&A, &B, &C); + void_type_craziness2_Expect(); + exercise_arglist_pointers(); + } + + - :pass: TRUE + :should: 'successfully mock crazy multline function prototypes' + :code: | + test() + { + crazy_multiline_ExpectAndReturn(-10, 11, 'z'); + TEST_ASSERT_EQUAL('z', exercise_multiline_declarations(-10, 11)); + } + + - :pass: TRUE + :should: 'mock double pointers just fine' + :code: | + test() + { + ptr_ptr_return1_ExpectAndReturn(&pA, &pB); + ptr_ptr_return2_ExpectAndReturn(&pA, &pB); + ptr_ptr_return3_ExpectAndReturn(&pA, &pB); + ptr_ptr_return4_ExpectAndReturn(&pA, &pB); + exercise_double_pointers((unsigned int**)(&pA)); + } + + - :pass: TRUE + :should: 'mock prototypes with long lists of return and parameter type descriptors' + :code: | + test() + { + incredible_descriptors_ExpectAndReturn(888, 777); + TEST_ASSERT_EQUAL(777, exercise_many_descriptors(888)); + } + + - :pass: TRUE + :should: 'handle words like typdef as PART of a variable or type' + :code: | + test() + { + uses_typedef_like_names_ExpectAndReturn((TypeDefInt)54, (TypeDefInt)53); + TEST_ASSERT_EQUAL(53, exercise_typedef_like_names((TypeDefInt)54)); + } + + - :pass: FALSE + :should: 'handle words like typdef as PART of a variable or type during failing tests' + :code: | + test() + { + uses_typedef_like_names_ExpectAndReturn((TypeDefInt)52, (TypeDefInt)53); + TEST_ASSERT_EQUAL(53, exercise_typedef_like_names((TypeDefInt)54)); + } + + +... diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/struct_union_enum_expect_and_return.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/struct_union_enum_expect_and_return.yml new file mode 100644 index 0000000..d4cf6af --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/struct_union_enum_expect_and_return.yml @@ -0,0 +1,277 @@ +--- +:cmock: + :plugins: + - # none + +:systest: + :types: | + struct THING { int a; int b; }; + + union STARS_AND_STRIPES { int a; char b; }; + + enum HOKEY_POKEY { IN, OUT, SHAKE_IT_ALL_ABOUT }; + + :mockable: | + void foo_struct(struct THING*, struct THING); + struct THING foobar_struct(void); + + void foo_union(union STARS_AND_STRIPES*, union STARS_AND_STRIPES); + union STARS_AND_STRIPES foobar_union(void); + + void foo_enum(enum HOKEY_POKEY a, enum HOKEY_POKEY * b); + enum HOKEY_POKEY foobar_enum(void); + + :source: + :header: | + void exercise_struct(struct THING* a, struct THING b); + struct THING return_struct(void); + + void exercise_union(union STARS_AND_STRIPES* a, union STARS_AND_STRIPES b); + union STARS_AND_STRIPES return_union(void); + + void exercise_enum(enum HOKEY_POKEY a, enum HOKEY_POKEY * b); + enum HOKEY_POKEY return_enum(void); + + :code: | + void exercise_struct(struct THING* a, struct THING b) + { + foo_struct(a, b); + } + + struct THING return_struct(void) + { + return foobar_struct(); + } + + void exercise_union(union STARS_AND_STRIPES* a, union STARS_AND_STRIPES b) + { + foo_union(a, b); + } + + union STARS_AND_STRIPES return_union(void) + { + return foobar_union(); + } + + void exercise_enum(enum HOKEY_POKEY a, enum HOKEY_POKEY * b) + { + foo_enum(a, b); + } + + enum HOKEY_POKEY return_enum(void) + { + return foobar_enum(); + } + + + :tests: + :common: | + struct THING struct1; + struct THING struct2; + struct THING struct3; + struct THING struct4; + struct THING struct5; + struct THING struct6; + + union STARS_AND_STRIPES union1; + union STARS_AND_STRIPES union2; + union STARS_AND_STRIPES union3; + union STARS_AND_STRIPES union4; + union STARS_AND_STRIPES union5; + union STARS_AND_STRIPES union6; + + enum HOKEY_POKEY enum1; + enum HOKEY_POKEY enum2; + + void setUp(void) + { + struct1.a = 1; + struct1.b = 2; + + struct2.a = 3; + struct2.b = 4; + + struct3.a = 5; + struct3.b = 6; + + struct4.a = 7; + struct4.b = 8; + + struct5.a = 9; + struct5.b = 10; + + struct6.a = 9; + struct6.b = 10; + + union1.a = 1; + union2.a = 2; + union3.a = 3; + union4.a = 4; + union5.a = 5; + union6.a = 5; + + enum1 = OUT; + enum2 = IN; + } + + void tearDown(void) {} + + :units: + - :pass: TRUE + :should: 'successfully compare structs' + :code: | + test() + { + foo_struct_Expect(&struct1, struct2); + exercise_struct(&struct1, struct2); + } + + - :pass: FALSE + :should: 'blow up on bad struct pointer comparison' + :code: | + test() + { + foo_struct_Expect(&struct1, struct2); + exercise_struct(&struct3, struct2); + } + + - :pass: FALSE + :should: 'blow up on bad structure comparison' + :code: | + test() + { + foo_struct_Expect(&struct1, struct2); + exercise_struct(&struct1, struct4); + } + + - :pass: TRUE + :should: 'compare returned structs as equal' + :code: | + test() + { + foobar_struct_ExpectAndReturn(struct5); + TEST_ASSERT_EQUAL_THING(struct6, return_struct()); + } + + - :pass: FALSE + :should: 'compare returned structs as unequal' + :code: | + test() + { + foobar_struct_ExpectAndReturn(struct4); + TEST_ASSERT_EQUAL_THING(struct5, return_struct()); + } + + - :pass: TRUE + :should: 'successfully compare unions' + :code: | + test() + { + foo_union_Expect(&union1, union2); + exercise_union(&union1, union2); + } + + - :pass: FALSE + :should: 'blow up on bad union pointer comparison' + :code: | + test() + { + foo_union_Expect(&union1, union2); + exercise_union(&union3, union2); + } + + - :pass: FALSE + :should: 'blow up on bad union comparison' + :code: | + test() + { + foo_union_Expect(&union1, union2); + exercise_union(&union1, union4); + } + + - :pass: TRUE + :should: 'compare returned unions as equal' + :code: | + test() + { + foobar_union_ExpectAndReturn(union5); + TEST_ASSERT_EQUAL_STARS_AND_STRIPES(union6, return_union()); + } + + - :pass: FALSE + :should: 'compare returned unions as unequal' + :code: | + test() + { + foobar_union_ExpectAndReturn(union4); + TEST_ASSERT_EQUAL_STARS_AND_STRIPES(union5, return_union()); + } + + - :pass: TRUE + :should: 'successfully pass enum values' + :code: | + test() + { + foo_enum_Expect(OUT, &enum1); + exercise_enum(OUT, &enum1); + } + + - :pass: FALSE + :should: 'blow up on bad enum pointer comparison' + :code: | + test() + { + foo_enum_Expect(IN, &enum1); + exercise_enum(IN, &enum2); + } + + - :pass: FALSE + :should: 'blow up on bad enum comparison' + :code: | + test() + { + foo_enum_Expect(IN, &enum1); + exercise_enum(SHAKE_IT_ALL_ABOUT, &enum1); + } + + - :pass: TRUE + :should: 'compare returned enums as equal' + :code: | + test() + { + foobar_enum_ExpectAndReturn(OUT); + TEST_ASSERT_EQUAL(OUT, return_enum()); + } + + - :pass: FALSE + :should: 'compare returned unions as unequal' + :code: | + test() + { + foobar_enum_ExpectAndReturn(OUT); + TEST_ASSERT_EQUAL(IN, return_enum()); + } + + + :unity_helper: + :header: | + void AssertEqualTHINGStruct(struct THING expected, struct THING actual); + void AssertEqualSTARS_AND_STRIPESUnion(union STARS_AND_STRIPES expected, union STARS_AND_STRIPES actual); + + #define TEST_ASSERT_EQUAL_THING(expected, actual) {AssertEqualTHINGStruct(expected, actual);} + #define TEST_ASSERT_EQUAL_STARS_AND_STRIPES(expected, actual) {AssertEqualSTARS_AND_STRIPESUnion(expected, actual);} + + :code: | + void AssertEqualTHINGStruct(struct THING expected, struct THING actual) + { + TEST_ASSERT_EQUAL_INT_MESSAGE(expected.a, actual.a, "actual struct member \"a\" does not equal expected"); + TEST_ASSERT_EQUAL_INT_MESSAGE(expected.b, actual.b, "actual struct member \"b\" does not equal expected"); + } + + void AssertEqualSTARS_AND_STRIPESUnion(union STARS_AND_STRIPES expected, union STARS_AND_STRIPES actual) + { + TEST_ASSERT_EQUAL_INT_MESSAGE(expected.a, actual.a, "actual union member \"a\" does not equal expected"); + TEST_ASSERT_EQUAL_MESSAGE(expected.b, actual.b, "actual union member \"b\" does not equal expected"); + } + +... diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/stubs_with_callbacks.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/stubs_with_callbacks.yml new file mode 100644 index 0000000..fcae12c --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/stubs_with_callbacks.yml @@ -0,0 +1,221 @@ +--- +:cmock: + :plugins: + - :callback + :treat_as: + custom_type: INT + +:systest: + :types: | + #define UINT32 unsigned int + + typedef signed int custom_type; + + :mockable: | + UINT32 foo(custom_type* a); + UINT32 bar(custom_type* b); + int baz(void); + void fuz(int* args, int num); + + :source: + :header: | + void function_a(int a, int b); + UINT32 function_b(void); + int function_c(void); + + :code: | + void function_a(int a, int b) + { + int args[6] = {0, 1, 2, 3, 5, 5}; + args[0] = a; + fuz(args, b); + } + + UINT32 function_b(void) + { + UINT32 sum = 0; + custom_type a = 0; + custom_type b = 0; + sum = foo(&a) + bar(&b); + return sum + a + b; + } + + int function_c(void) + { + return (baz() + baz() + baz()); + } + + :tests: + :common: | + void setUp(void) {} + void tearDown(void) {} + + UINT32 FooAndBarHelper(custom_type* data, int num) + { + num++; + *data = (custom_type)(num * 2); + return (*data * 2); + } + + int BazCallbackPointless(int num) + { + return num; + } + + int BazCallbackComplainsIfCalledMoreThanTwice(int num) + { + TEST_ASSERT_MESSAGE(num < 2, "Do Not Call Baz More Than Twice"); + return num; + } + + void FuzVerifier(int* args, int num_args, int num_calls) + { + int i; + TEST_ASSERT_MESSAGE(num_args < 5, "No More Than 5 Args Allowed"); + for (i = 0; i < num_args; i++) + { + TEST_ASSERT_EQUAL(num_calls + i, args[i]); + } + } + + :units: + - :pass: TRUE + :should: 'successfully exercise two simple ExpectAndReturn mock calls the normal way' + :code: | + test() + { + custom_type exp = 0; + foo_ExpectAndReturn(&exp, 10); + bar_ExpectAndReturn(&exp, 20); + TEST_ASSERT_EQUAL(30, function_b()); + } + + - :pass: FALSE + :should: 'successfully exercise two simple ExpectAndReturn mock calls and catch failure the normal way' + :code: | + test() + { + custom_type exp = 1; + foo_ExpectAndReturn(&exp, 10); + bar_ExpectAndReturn(&exp, 20); + TEST_ASSERT_EQUAL(30, function_b()); + } + + - :pass: TRUE + :should: 'successfully exercise using some basic callbacks' + :code: | + test() + { + foo_StubWithCallback((CMOCK_foo_CALLBACK)FooAndBarHelper); + bar_StubWithCallback((CMOCK_bar_CALLBACK)FooAndBarHelper); + TEST_ASSERT_EQUAL(12, function_b()); + } + + - :pass: TRUE + :should: 'successfully exercise using some basic callbacks even if there were expects' + :code: | + test() + { + custom_type exp = 500; + foo_ExpectAndReturn(&exp, 10); + foo_StubWithCallback((CMOCK_foo_CALLBACK)FooAndBarHelper); + bar_StubWithCallback((CMOCK_bar_CALLBACK)FooAndBarHelper); + TEST_ASSERT_EQUAL(12, function_b()); + } + + - :pass: FALSE + :should: 'successfully exercise using some basic callbacks and notice failures' + :code: | + test() + { + foo_StubWithCallback((CMOCK_foo_CALLBACK)FooAndBarHelper); + bar_StubWithCallback((CMOCK_bar_CALLBACK)FooAndBarHelper); + TEST_ASSERT_EQUAL(10, function_b()); + } + + - :pass: TRUE + :should: 'successfully exercise a callback with no arguments' + :code: | + test() + { + baz_StubWithCallback((CMOCK_baz_CALLBACK)BazCallbackPointless); + TEST_ASSERT_EQUAL(3, function_c()); + } + + - :pass: FALSE + :should: 'successfully throw a failure from within a callback function' + :code: | + test() + { + baz_StubWithCallback((CMOCK_baz_CALLBACK)BazCallbackComplainsIfCalledMoreThanTwice); + function_c(); + } + + - :pass: TRUE + :should: 'be usable for things like dynamically sized memory checking for passing conditions' + :code: | + test() + { + fuz_StubWithCallback((CMOCK_fuz_CALLBACK)FuzVerifier); + function_a(0, 4); + } + + - :pass: FALSE + :should: 'be usable for things like dynamically sized memory checking for failing conditions' + :code: | + test() + { + fuz_StubWithCallback((CMOCK_fuz_CALLBACK)FuzVerifier); + function_a(0, 5); + } + + - :pass: FALSE + :should: 'be usable for things like dynamically sized memory checking for failing conditions 2' + :code: | + test() + { + fuz_StubWithCallback((CMOCK_fuz_CALLBACK)FuzVerifier); + function_a(1, 4); + } + + - :pass: TRUE + :should: 'run them interlaced' + :code: | + test() + { + custom_type exp = 0; + foo_ExpectAndReturn(&exp, 10); + foo_ExpectAndReturn(&exp, 15); + bar_ExpectAndReturn(&exp, 20); + bar_ExpectAndReturn(&exp, 40); + fuz_StubWithCallback((CMOCK_fuz_CALLBACK)FuzVerifier); + baz_StubWithCallback((CMOCK_baz_CALLBACK)BazCallbackPointless); + + TEST_ASSERT_EQUAL(30, function_b()); + TEST_ASSERT_EQUAL(55, function_b()); + function_a(0, 4); + TEST_ASSERT_EQUAL(3, function_c()); + } + + - :pass: TRUE + :should: 'run them back to back' + :code: | + test() + { + custom_type exp = 0; + foo_ExpectAndReturn(&exp, 10); + bar_ExpectAndReturn(&exp, 20); + TEST_ASSERT_EQUAL(30, function_b()); + + foo_ExpectAndReturn(&exp, 15); + bar_ExpectAndReturn(&exp, 40); + TEST_ASSERT_EQUAL(55, function_b()); + + fuz_StubWithCallback((CMOCK_fuz_CALLBACK)FuzVerifier); + function_a(0, 4); + + baz_StubWithCallback((CMOCK_baz_CALLBACK)BazCallbackPointless); + TEST_ASSERT_EQUAL(3, function_c()); + } + +... diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/unity_64bit_support.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/unity_64bit_support.yml new file mode 100644 index 0000000..c34bb1c --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/unity_64bit_support.yml @@ -0,0 +1,82 @@ +--- +#The purpose of this test is to play with things 64-bit integers, which aren't supported by all compilers +:cmock: + :plugins: + - :array + - :ignore + +:systest: + :types: | + #if (UNITY_LONG_WIDTH == 32) + typedef unsigned long long TEST64; + #elif (UNITY_LONG_WIDTH == 64) + typedef unsigned long TEST64; + #else + #error This Test Should Not Be Run Unless You Have 64 Bit Support Enabled + #endif + + :mockable: | + TEST64 foo(TEST64 a); + TEST64* bar(TEST64* b); + + :source: + :header: | + TEST64 function_a(void); + + :code: | + TEST64 function_a(void) { + TEST64 a = 0x1234567890123456; + TEST64 b; + TEST64* c; + + b = foo(a); + c = bar(&b); + return *c; + } + + :tests: + :common: | + void setUp(void) {} + void tearDown(void) {} + + :units: + - :pass: TRUE + :should: 'handle a straightforward 64-bit series of calls' + :code: | + test() + { + TEST64 a = 0x0987654321543210; + TEST64 b = 0x5a5a5a5a5a5a5a5a; + foo_ExpectAndReturn(0x1234567890123456, 0x0987654321543210); + bar_ExpectAndReturn(&a, &b); + + TEST_ASSERT_EQUAL_HEX64(b, function_a()); + } + + - :pass: FALSE + :should: 'handle a straightforward 64-bit series of calls with a failure' + :code: | + test() + { + TEST64 a = 0x0987654321543210; + TEST64 b = 0x5a5a5a5a5a5a5a5a; + foo_ExpectAndReturn(0x1234567890123456, 0x0987654321543211); + bar_ExpectAndReturn(&a, &b); + + TEST_ASSERT_EQUAL_HEX64(b, function_a()); + } + + - :pass: FALSE + :should: 'handle a straightforward 64-bit series of calls returning a failure' + :code: | + test() + { + TEST64 a = 0x0987654321543210; + TEST64 b = 0x5a5a5a5a5a5a5a5a; + foo_ExpectAndReturn(0x1234567890123456, 0x0987654321543210); + bar_ExpectAndReturn(&a, &b); + + TEST_ASSERT_EQUAL_HEX64(b+1, function_a()); + } + +... diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/unity_ignores.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/unity_ignores.yml new file mode 100644 index 0000000..c6f8574 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/system/test_interactions/unity_ignores.yml @@ -0,0 +1,139 @@ +--- +:cmock: + :plugins: + - # none + +:systest: + :types: | + #define UINT32 unsigned int + + :mockable: | + UINT32 foo(UINT32 a); + void bar(void); + + :source: + :header: | + UINT32 function_a(int a); + void function_b(void); + + :code: | + UINT32 function_a(int a) + { + bar(); + return foo((UINT32)a); + } + + void function_b(void) + { + bar(); + } + + :tests: + :common: | + void setUp(void) {} + void tearDown(void) {} + + :units: + - :pass: :ignore + :should: 'ignore incorrect expects after the TEST_IGNORE call' + :code: | + test() + { + TEST_IGNORE(); + bar_Expect(); + foo_ExpectAndReturn(10, 20); + TEST_ASSERT_EQUAL(40, function_a(30)); + } + + - :pass: :ignore + :should: 'ignore missing expects after the TEST_IGNORE call' + :code: | + test() + { + TEST_IGNORE(); + foo_ExpectAndReturn(10, 20); + TEST_ASSERT_EQUAL(20, function_a(10)); + } + + - :pass: :ignore + :should: 'ignore extra expects after the TEST_IGNORE call' + :code: | + test() + { + TEST_IGNORE(); + bar_Expect(); + bar_Expect(); + foo_ExpectAndReturn(10, 20); + foo_ExpectAndReturn(10, 20); + foo_ExpectAndReturn(10, 20); + TEST_ASSERT_EQUAL(20, function_a(10)); + } + + - :pass: :ignore + :should: 'ignore no expects after the TEST_IGNORE call' + :code: | + test() + { + TEST_IGNORE(); + TEST_ASSERT_EQUAL(20, function_a(10)); + } + + - :pass: :ignore + :should: 'ignore extra expects after the TEST_IGNORE call even if it happens later' + :code: | + test() + { + bar_Expect(); + foo_ExpectAndReturn(10, 20); + function_a(10); + + TEST_IGNORE(); + bar_Expect(); + foo_ExpectAndReturn(10, 20); + TEST_ASSERT_EQUAL(40, function_a(30)); + } + + - :pass: false + :should: 'still fail if there are expect problems before the TEST_IGNORE' + :code: | + test() + { + bar_Expect(); + foo_ExpectAndReturn(10, 20); + function_a(30); + + TEST_IGNORE(); + bar_Expect(); + foo_ExpectAndReturn(10, 20); + TEST_ASSERT_EQUAL(40, function_a(30)); + } + + - :pass: false + :should: 'still fail if there are missing expect problems before the TEST_IGNORE' + :code: | + test() + { + bar_Expect(); + function_a(10); + + TEST_IGNORE(); + bar_Expect(); + foo_ExpectAndReturn(10, 20); + TEST_ASSERT_EQUAL(40, function_a(30)); + } + + - :pass: :ignore + :should: 'ignore if extra expects before the TEST_IGNORE because it ignored the rest of the test that might have made calls to it' + :code: | + test() + { + bar_Expect(); + bar_Expect(); + foo_ExpectAndReturn(10, 20); + function_a(10); + + TEST_IGNORE(); + foo_ExpectAndReturn(10, 20); + TEST_ASSERT_EQUAL(40, function_a(30)); + } +... diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/test_helper.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/test_helper.rb new file mode 100644 index 0000000..7dd33fb --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/test_helper.rb @@ -0,0 +1,44 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== +[ "/../config/test_environment", + "/../vendor/behaviors/lib/behaviors" +].each do |req| + require File.expand_path(File.dirname(__FILE__)) + req +end + +#gem install test-unit -v 1.2.3 +ruby_version = RUBY_VERSION.split('.') +if (ruby_version[1].to_i == 9) and (ruby_version[2].to_i > 1) + require 'rubygems' + gem 'test-unit' +end +require 'test/unit' +require 'hardmock' + +class Test::Unit::TestCase + extend Behaviors + + #these are helpful test structures which can be used during tests + + def test_return + { + :int => {:type => "int", :name => 'cmock_to_return', :ptr? => false, :const? => false, :void? => false, :str => 'int cmock_to_return'}, + :int_ptr => {:type => "int*", :name => 'cmock_to_return', :ptr? => true, :const? => false, :void? => false, :str => 'int* cmock_to_return'}, + :void => {:type => "void", :name => 'cmock_to_return', :ptr? => false, :const? => false, :void? => true, :str => 'void cmock_to_return'}, + :string => {:type => "char*", :name => 'cmock_to_return', :ptr? => false, :const? => true, :void? => false, :str => 'const char* cmock_to_return'}, + } + end + + def test_arg + { + :int => {:type => "int", :name => 'MyInt', :ptr? => false, :const? => false}, + :int_ptr => {:type => "int*", :name => 'MyIntPtr', :ptr? => true, :const? => false}, + :mytype => {:type => "MY_TYPE", :name => 'MyMyType', :ptr? => false, :const? => true}, + :mytype_ptr => {:type => "MY_TYPE*", :name => 'MyMyTypePtr', :ptr? => true, :const? => false}, + :string => {:type => "char*", :name => 'MyStr', :ptr? => false, :const? => true}, + } + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/unit/cmock_config_test.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/unit/cmock_config_test.rb new file mode 100644 index 0000000..cfdfc41 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/unit/cmock_config_test.rb @@ -0,0 +1,45 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require File.expand_path(File.dirname(__FILE__)) + "/../test_helper" +require 'cmock_config' + +class CMockConfigTest < Test::Unit::TestCase + def setup + end + + def teardown + end + + should "use default settings when no parameters are specified" do + config = CMockConfig.new + assert_equal(CMockConfig::CMockDefaultOptions[:mock_path], config.mock_path) + assert_equal(CMockConfig::CMockDefaultOptions[:includes], config.includes) + assert_equal(CMockConfig::CMockDefaultOptions[:attributes], config.attributes) + assert_equal(CMockConfig::CMockDefaultOptions[:plugins], config.plugins) + assert_equal(CMockConfig::CMockDefaultOptions[:treat_externs], config.treat_externs) + end + + should "replace only options specified in a hash" do + test_includes = ['hello'] + test_attributes = ['blah', 'bleh'] + config = CMockConfig.new(:includes => test_includes, :attributes => test_attributes) + assert_equal(CMockConfig::CMockDefaultOptions[:mock_path], config.mock_path) + assert_equal(test_includes, config.includes) + assert_equal(test_attributes, config.attributes) + assert_equal(CMockConfig::CMockDefaultOptions[:plugins], config.plugins) + assert_equal(CMockConfig::CMockDefaultOptions[:treat_externs], config.treat_externs) + end + + should "replace only options specified in a yaml file" do + test_plugins = [:soda, :pizza] + config = CMockConfig.new("#{File.expand_path(File.dirname(__FILE__))}/cmock_config_test.yml") + assert_equal(CMockConfig::CMockDefaultOptions[:mock_path], config.mock_path) + assert_equal(CMockConfig::CMockDefaultOptions[:includes], config.includes) + assert_equal(test_plugins, config.plugins) + assert_equal(:include, config.treat_externs) + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/unit/cmock_config_test.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/unit/cmock_config_test.yml new file mode 100644 index 0000000..b2444f8 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/unit/cmock_config_test.yml @@ -0,0 +1,5 @@ +:cmock: + :plugins: + - 'soda' + - 'pizza' + :treat_externs: :include diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/unit/cmock_file_writer_test.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/unit/cmock_file_writer_test.rb new file mode 100644 index 0000000..13c2631 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/unit/cmock_file_writer_test.rb @@ -0,0 +1,30 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require File.expand_path(File.dirname(__FILE__)) + "/../test_helper" +require 'cmock_file_writer' + +class CMockFileWriterTest < Test::Unit::TestCase + def setup + create_mocks :config + @cmock_file_writer = CMockFileWriter.new(@config) + end + + def teardown + end + + should "have set up internal accessors correctly on init" do + assert_equal(@config, @cmock_file_writer.config) + end + + should "complain if a block was not specified when calling create" do + begin + @cmock_file_writer.create_file("test.txt") + assert false, "Should Have Thrown An Error When Calling Without A Block" + rescue + end + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/unit/cmock_generator_main_test.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/unit/cmock_generator_main_test.rb new file mode 100644 index 0000000..f743d84 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/unit/cmock_generator_main_test.rb @@ -0,0 +1,412 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +$ThisIsOnlyATest = true + +require File.expand_path(File.dirname(__FILE__)) + "/../test_helper" +require 'cmock_generator' + +class MockedPluginHelper + def initialize return_this + @return_this = return_this + end + + def include_files + return @return_this + end + + def instance_structure( name, args, rettype ) + return " #{@return_this}_#{name}(#{args}, #{rettype})" + end + + def mock_verify( name ) + return " #{@return_this}_#{name}" + end + + def mock_destroy( name, args, rettype ) + return " #{@return_this}_#{name}(#{args}, #{rettype})" + end + + def mock_implementation(name, args) + return " Mock#{name}#{@return_this}(#{args.join(", ")})" + end +end + +class CMockGeneratorTest < Test::Unit::TestCase + def setup + create_mocks :config, :file_writer, :utils, :plugins + @module_name = "PoutPoutFish" + + #no strict handling + @config.expect.mock_prefix.returns("Mock") + @config.expect.enforce_strict_ordering.returns(nil) + @config.expect.framework.returns(:unity) + @config.expect.includes.returns(["ConfigRequiredHeader1.h","ConfigRequiredHeader2.h"]) + #@config.expect.includes_h_pre_orig_header.returns(nil) #not called because includes called + @config.expect.includes_h_post_orig_header.returns(nil) + @config.expect.includes_c_pre_header.returns(nil) + @config.expect.includes_c_post_header.returns(nil) + @cmock_generator = CMockGenerator.new(@config, @file_writer, @utils, @plugins) + @cmock_generator.module_name = @module_name + @cmock_generator.mock_name = "Mock#{@module_name}" + + #strict handling + @config.expect.mock_prefix.returns("Mock") + @config.expect.enforce_strict_ordering.returns(true) + @config.expect.framework.returns(:unity) + @config.expect.includes.returns(nil) + @config.expect.includes_h_pre_orig_header.returns(nil) + @config.expect.includes_h_post_orig_header.returns(nil) + @config.expect.includes_c_pre_header.returns(nil) + @config.expect.includes_c_post_header.returns(nil) + @cmock_generator_strict = CMockGenerator.new(@config, @file_writer, @utils, @plugins) + @cmock_generator_strict.module_name = @module_name + @cmock_generator_strict.mock_name = "Mock#{@module_name}" + end + + def teardown + end + + should "have set up internal accessors correctly on init" do + assert_equal(@config, @cmock_generator.config) + assert_equal(@file_writer, @cmock_generator.file_writer) + assert_equal(@utils, @cmock_generator.utils) + assert_equal(@plugins, @cmock_generator.plugins) + end + + should "create the top of a header file with optional include files from config and include file from plugin" do + @config.expect.mock_prefix.returns("Mock") + orig_filename = "PoutPoutFish.h" + define_name = "MOCKPOUTPOUTFISH_H" + mock_name = "MockPoutPoutFish" + output = [] + expected = [ "/* AUTOGENERATED FILE. DO NOT EDIT. */\n", + "#ifndef _#{define_name}\n", + "#define _#{define_name}\n\n", + "#include \"ConfigRequiredHeader1.h\"\n", + "#include \"ConfigRequiredHeader2.h\"\n", + "#include \"#{orig_filename}\"\n", + "#include \"PluginRequiredHeader.h\"\n", + "\n" + ] + + @plugins.expect.run(:include_files).returns("#include \"PluginRequiredHeader.h\"\n") + + @cmock_generator.create_mock_header_header(output, "MockPoutPoutFish.h") + + assert_equal(expected, output) + end + + should "create the top of a header file with optional include files from config" do + @config.expect.mock_prefix.returns("Mock") + orig_filename = "PoutPoutFish.h" + define_name = "MOCKPOUTPOUTFISH_H" + mock_name = "MockPoutPoutFish" + output = [] + expected = [ "/* AUTOGENERATED FILE. DO NOT EDIT. */\n", + "#ifndef _#{define_name}\n", + "#define _#{define_name}\n\n", + "#include \"ConfigRequiredHeader1.h\"\n", + "#include \"ConfigRequiredHeader2.h\"\n", + "#include \"#{orig_filename}\"\n", + "\n" + ] + + @plugins.expect.run(:include_files).returns('') + + @cmock_generator.create_mock_header_header(output, "MockPoutPoutFish.h") + + assert_equal(expected, output) + end + + should "create the top of a header file with include file from plugin" do + @config.expect.mock_prefix.returns("Mock") + orig_filename = "PoutPoutFish.h" + define_name = "MOCKPOUTPOUTFISH_H" + mock_name = "MockPoutPoutFish" + output = [] + expected = [ "/* AUTOGENERATED FILE. DO NOT EDIT. */\n", + "#ifndef _#{define_name}\n", + "#define _#{define_name}\n\n", + "#include \"ConfigRequiredHeader1.h\"\n", + "#include \"ConfigRequiredHeader2.h\"\n", + "#include \"#{orig_filename}\"\n", + "#include \"PluginRequiredHeader.h\"\n", + "\n" + ] + + @plugins.expect.run(:include_files).returns("#include \"PluginRequiredHeader.h\"\n") + + @cmock_generator.create_mock_header_header(output, "MockPoutPoutFish.h") + + assert_equal(expected, output) + end + + should "write typedefs" do + typedefs = [ 'typedef unsigned char U8;', + 'typedef char S8;', + 'typedef unsigned long U32;' + ] + output = [] + expected = [ "\n", + "typedef unsigned char U8;\n", + "typedef char S8;\n", + "typedef unsigned long U32;\n", + "\n\n" + ] + + @cmock_generator.create_typedefs(output, typedefs) + + assert_equal(expected, output.flatten) + end + + should "create the header file service call declarations" do + mock_name = "MockPoutPoutFish" + + output = [] + expected = [ "void #{mock_name}_Init(void);\n", + "void #{mock_name}_Destroy(void);\n", + "void #{mock_name}_Verify(void);\n\n" + ] + + @cmock_generator.create_mock_header_service_call_declarations(output) + + assert_equal(expected, output) + end + + should "append the proper footer to the header file" do + output = [] + expected = ["\n#endif\n"] + + @cmock_generator.create_mock_header_footer(output) + + assert_equal(expected, output) + end + + should "create a proper heading for a source file" do + output = [] + expected = [ "/* AUTOGENERATED FILE. DO NOT EDIT. */\n", + "#include \n", + "#include \n", + "#include \n", + "#include \"unity.h\"\n", + "#include \"cmock.h\"\n", + "#include \"MockPoutPoutFish.h\"\n", + "\n" + ] + + @cmock_generator.create_source_header_section(output, "MockPoutPoutFish.c") + + assert_equal(expected, output) + end + + should "create the instance structure where it is needed when no functions" do + output = [] + functions = [] + expected = [ "static struct MockPoutPoutFishInstance\n", + "{\n", + " unsigned char placeHolder;\n", + "} Mock;\n\n" + ].join + + @cmock_generator.create_instance_structure(output, functions) + + assert_equal(expected, output.join) + end + + should "create the instance structure where it is needed when functions required" do + output = [] + functions = [ { :name => "First", :args => "int Candy", :return => test_return[:int] }, + { :name => "Second", :args => "bool Smarty", :return => test_return[:string] } + ] + expected = [ "typedef struct _CMOCK_First_CALL_INSTANCE\n{\n", + " UNITY_LINE_TYPE LineNumber;\n", + " b1 b2", + "\n} CMOCK_First_CALL_INSTANCE;\n\n", + "typedef struct _CMOCK_Second_CALL_INSTANCE\n{\n", + " UNITY_LINE_TYPE LineNumber;\n", + "\n} CMOCK_Second_CALL_INSTANCE;\n\n", + "static struct MockPoutPoutFishInstance\n{\n", + " d1", + " CMOCK_MEM_INDEX_TYPE First_CallInstance;\n", + " e1 e2 e3", + " CMOCK_MEM_INDEX_TYPE Second_CallInstance;\n", + "} Mock;\n\n" + ].join + @plugins.expect.run(:instance_typedefs, functions[0]).returns([" b1"," b2"]) + @plugins.expect.run(:instance_typedefs, functions[1]).returns([]) + + @plugins.expect.run(:instance_structure, functions[0]).returns([" d1"]) + @plugins.expect.run(:instance_structure, functions[1]).returns([" e1"," e2"," e3"]) + + @cmock_generator.create_instance_structure(output, functions) + + assert_equal(expected, output.join) + end + + should "create extern declarations for source file" do + output = [] + expected = [ "extern jmp_buf AbortFrame;\n", + "\n" ] + + @cmock_generator.create_extern_declarations(output) + + assert_equal(expected, output.flatten) + end + + should "create extern declarations for source file when using strict ordering" do + output = [] + expected = [ "extern jmp_buf AbortFrame;\n", + "extern int GlobalExpectCount;\n", + "extern int GlobalVerifyOrder;\n", + "\n" ] + + @cmock_generator_strict.create_extern_declarations(output) + + assert_equal(expected, output.flatten) + end + + should "create mock verify functions in source file when no functions specified" do + functions = [] + output = [] + expected = "void MockPoutPoutFish_Verify(void)\n{\n}\n\n" + + @cmock_generator.create_mock_verify_function(output, functions) + + assert_equal(expected, output.join) + end + + should "create mock verify functions in source file when extra functions specified" do + functions = [ { :name => "First", :args => "int Candy", :return => test_return[:int] }, + { :name => "Second", :args => "bool Smarty", :return => test_return[:string] } + ] + output = [] + expected = [ "void MockPoutPoutFish_Verify(void)\n{\n", + " UNITY_LINE_TYPE cmock_line = TEST_LINE_NUM;\n", + " Uno_First" + + " Dos_First" + + " Uno_Second" + + " Dos_Second", + "}\n\n" + ] + @plugins.expect.run(:mock_verify, functions[0]).returns([" Uno_First"," Dos_First"]) + @plugins.expect.run(:mock_verify, functions[1]).returns([" Uno_Second"," Dos_Second"]) + + @cmock_generator.ordered = true + @cmock_generator.create_mock_verify_function(output, functions) + + assert_equal(expected, output.flatten) + end + + should "create mock init functions in source file" do + output = [] + expected = [ "void MockPoutPoutFish_Init(void)\n{\n", + " MockPoutPoutFish_Destroy();\n", + "}\n\n" + ] + + @cmock_generator.create_mock_init_function(output) + + assert_equal(expected.join, output.join) + end + + should "create mock destroy functions in source file" do + functions = [] + output = [] + expected = [ "void MockPoutPoutFish_Destroy(void)\n{\n", + " CMock_Guts_MemFreeAll();\n", + " memset(&Mock, 0, sizeof(Mock));\n", + "}\n\n" + ] + + @cmock_generator.create_mock_destroy_function(output, functions) + + assert_equal(expected.join, output.join) + end + + should "create mock destroy functions in source file when specified with strict ordering" do + functions = [ { :name => "First", :args => "int Candy", :return => test_return[:int] }, + { :name => "Second", :args => "bool Smarty", :return => test_return[:string] } + ] + output = [] + expected = [ "void MockPoutPoutFish_Destroy(void)\n{\n", + " CMock_Guts_MemFreeAll();\n", + " memset(&Mock, 0, sizeof(Mock));\n", + " uno", + " GlobalExpectCount = 0;\n", + " GlobalVerifyOrder = 0;\n", + "}\n\n" + ] + @plugins.expect.run(:mock_destroy, functions[0]).returns([]) + @plugins.expect.run(:mock_destroy, functions[1]).returns([" uno"]) + + @cmock_generator_strict.create_mock_destroy_function(output, functions) + + assert_equal(expected.join, output.join) + end + + should "create mock implementation functions in source file" do + function = { :modifier => "static", + :return => test_return[:int], + :args_string => "uint32 sandwiches, const char* named", + :args => ["uint32 sandwiches", "const char* named"], + :var_arg => nil, + :name => "SupaFunction", + :attributes => "__inline" + } + output = [] + expected = [ "static int SupaFunction(uint32 sandwiches, const char* named)\n", + "{\n", + " UNITY_LINE_TYPE cmock_line = TEST_LINE_NUM;\n", + " CMOCK_SupaFunction_CALL_INSTANCE* cmock_call_instance = (CMOCK_SupaFunction_CALL_INSTANCE*)CMock_Guts_GetAddressFor(Mock.SupaFunction_CallInstance);\n", + " Mock.SupaFunction_CallInstance = CMock_Guts_MemNext(Mock.SupaFunction_CallInstance);\n", + " uno", + " UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, \"Function 'SupaFunction' called more times than expected.\");\n", + " cmock_line = cmock_call_instance->LineNumber;\n", + " dos", + " tres", + " return cmock_call_instance->ReturnVal;\n", + "}\n\n" + ] + @plugins.expect.run(:mock_implementation_precheck, function).returns([" uno"]) + @plugins.expect.run(:mock_implementation, function).returns([" dos"," tres"]) + + @cmock_generator.create_mock_implementation(output, function) + + assert_equal(expected.join, output.join) + end + + should "create mock implementation functions in source file with different options" do + function = { :modifier => "", + :return => test_return[:int], + :args_string => "uint32 sandwiches", + :args => ["uint32 sandwiches"], + :var_arg => "corn ...", + :name => "SupaFunction", + :attributes => nil + } + output = [] + expected = [ "int SupaFunction(uint32 sandwiches, corn ...)\n", + "{\n", + " UNITY_LINE_TYPE cmock_line = TEST_LINE_NUM;\n", + " CMOCK_SupaFunction_CALL_INSTANCE* cmock_call_instance = (CMOCK_SupaFunction_CALL_INSTANCE*)CMock_Guts_GetAddressFor(Mock.SupaFunction_CallInstance);\n", + " Mock.SupaFunction_CallInstance = CMock_Guts_MemNext(Mock.SupaFunction_CallInstance);\n", + " uno", + " UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, \"Function 'SupaFunction' called more times than expected.\");\n", + " cmock_line = cmock_call_instance->LineNumber;\n", + " dos", + " tres", + " return cmock_call_instance->ReturnVal;\n", + "}\n\n" + ] + @plugins.expect.run(:mock_implementation_precheck, function).returns([" uno"]) + @plugins.expect.run(:mock_implementation, function).returns([" dos"," tres"]) + + @cmock_generator.create_mock_implementation(output, function) + + assert_equal(expected.join, output.join) + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_array_test.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_array_test.rb new file mode 100644 index 0000000..959a8e0 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_array_test.rb @@ -0,0 +1,114 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require File.expand_path(File.dirname(__FILE__)) + "/../test_helper" +require 'cmock_generator_plugin_array' + +class CMockGeneratorPluginArrayTest < Test::Unit::TestCase + def setup + create_mocks :config, :utils + + #no strict ordering + @config.expect.when_ptr.returns(:compare_data) + @config.expect.enforce_strict_ordering.returns(false) + @config.stubs!(:respond_to?).returns(true) + @utils.expect.helpers.returns({}) + @cmock_generator_plugin_array = CMockGeneratorPluginArray.new(@config, @utils) + end + + def teardown + end + + should "have set up internal accessors correctly on init" do + assert_equal(@config, @cmock_generator_plugin_array.config) + assert_equal(@utils, @cmock_generator_plugin_array.utils) + assert_equal(nil, @cmock_generator_plugin_array.unity_helper) + assert_equal(8, @cmock_generator_plugin_array.priority) + end + + should "not include any additional include files" do + assert(!@cmock_generator_plugin_array.respond_to?(:include_files)) + end + + should "not add to typedef structure for functions of style 'int* func(void)'" do + function = {:name => "Oak", :args => [], :return => test_return[:int_ptr]} + returned = @cmock_generator_plugin_array.instance_typedefs(function) + assert_equal("", returned) + end + + should "add to tyepdef structure mock needs of functions of style 'void func(int chicken, int* pork)'" do + function = {:name => "Cedar", :args => [{ :name => "chicken", :type => "int", :ptr? => false}, { :name => "pork", :type => "int*", :ptr? => true}], :return => test_return[:void]} + expected = " int Expected_pork_Depth;\n" + returned = @cmock_generator_plugin_array.instance_typedefs(function) + assert_equal(expected, returned) + end + + should "not add an additional mock interface for functions not containing pointers" do + function = {:name => "Maple", :args_string => "int blah", :return => test_return[:string], :contains_ptr? => false} + returned = @cmock_generator_plugin_array.mock_function_declarations(function) + assert_nil(returned) + end + + should "add another mock function declaration for functions of style 'void func(int* tofu)'" do + function = {:name => "Pine", + :args => [{ :type => "int*", + :name => "tofu", + :ptr? => true, + }], + :return => test_return[:void], + :contains_ptr? => true } + + expected = "#define #{function[:name]}_ExpectWithArray(tofu, tofu_Depth) #{function[:name]}_CMockExpectWithArray(__LINE__, tofu, tofu_Depth)\n" + + "void #{function[:name]}_CMockExpectWithArray(UNITY_LINE_TYPE cmock_line, int* tofu, int tofu_Depth);\n" + returned = @cmock_generator_plugin_array.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "add another mock function declaration for functions of style 'const char* func(int* tofu)'" do + function = {:name => "Pine", + :args => [{ :type => "int*", + :name => "tofu", + :ptr? => true, + }], + :return => test_return[:string], + :contains_ptr? => true } + + expected = "#define #{function[:name]}_ExpectWithArrayAndReturn(tofu, tofu_Depth, cmock_retval) #{function[:name]}_CMockExpectWithArrayAndReturn(__LINE__, tofu, tofu_Depth, cmock_retval)\n" + + "void #{function[:name]}_CMockExpectWithArrayAndReturn(UNITY_LINE_TYPE cmock_line, int* tofu, int tofu_Depth, const char* cmock_to_return);\n" + returned = @cmock_generator_plugin_array.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "not have a mock function implementation" do + assert(!@cmock_generator_plugin_array.respond_to?(:mock_implementation)) + end + + should "not have a mock interfaces for functions of style 'int* func(void)'" do + function = {:name => "Pear", :args => [], :args_string => "void", :return => test_return[:int_ptr]} + returned = @cmock_generator_plugin_array.mock_interfaces(function) + assert_nil(returned) + end + + should "add mock interfaces for functions of style 'int* func(int* pescado, int pes)'" do + function = {:name => "Lemon", + :args => [{ :type => "int*", :name => "pescado", :ptr? => true}, { :type => "int", :name => "pes", :ptr? => false}], + :args_string => "int* pescado, int pes", + :return => test_return[:int_ptr], + :contains_ptr? => true } + @utils.expect.code_add_base_expectation("Lemon").returns("mock_retval_0") + + expected = ["void Lemon_CMockExpectWithArrayAndReturn(UNITY_LINE_TYPE cmock_line, int* pescado, int pescado_Depth, int pes, int* cmock_to_return)\n", + "{\n", + "mock_retval_0", + " CMockExpectParameters_Lemon(cmock_call_instance, pescado, pescado_Depth, pes);\n", + " cmock_call_instance->ReturnVal = cmock_to_return;\n", + "}\n\n" + ].join + returned = @cmock_generator_plugin_array.mock_interfaces(function).join + assert_equal(expected, returned) + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_callback_test.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_callback_test.rb new file mode 100644 index 0000000..8542fc6 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_callback_test.rb @@ -0,0 +1,190 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require File.expand_path(File.dirname(__FILE__)) + "/../test_helper" +require 'cmock_generator_plugin_callback' + +class CMockGeneratorPluginCallbackTest < Test::Unit::TestCase + def setup + create_mocks :config, :utils + + @config.expect.callback_include_count.returns(true) + @config.expect.callback_after_arg_check.returns(false) + + @cmock_generator_plugin_callback = CMockGeneratorPluginCallback.new(@config, @utils) + end + + def teardown + end + + should "have set up internal accessors correctly on init" do + assert_equal(@config, @cmock_generator_plugin_callback.config) + assert_equal(@utils, @cmock_generator_plugin_callback.utils) + assert_equal(6, @cmock_generator_plugin_callback.priority) + end + + should "not include any additional include files" do + assert(!@cmock_generator_plugin_callback.respond_to?(:include_files)) + end + + should "add to instance structure" do + function = {:name => "Oak", :args => [:type => "int*", :name => "blah", :ptr? => true], :return => test_return[:int_ptr]} + expected = " CMOCK_Oak_CALLBACK Oak_CallbackFunctionPointer;\n" + + " int Oak_CallbackCalls;\n" + returned = @cmock_generator_plugin_callback.instance_structure(function) + assert_equal(expected, returned) + end + + should "add mock function declaration for function without arguments" do + function = {:name => "Maple", :args_string => "void", :args => [], :return => test_return[:void]} + expected = [ "typedef void (* CMOCK_Maple_CALLBACK)(int cmock_num_calls);\n", + "void Maple_StubWithCallback(CMOCK_Maple_CALLBACK Callback);\n" ].join + returned = @cmock_generator_plugin_callback.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "add mock function declaration for function without arguments when count is also turned off" do + function = {:name => "Maple", :args_string => "void", :args => [], :return => test_return[:void]} + expected = [ "typedef void (* CMOCK_Maple_CALLBACK)(void);\n", + "void Maple_StubWithCallback(CMOCK_Maple_CALLBACK Callback);\n" ].join + @cmock_generator_plugin_callback.include_count = false + returned = @cmock_generator_plugin_callback.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "add mock function declaration for function with arguments" do + function = {:name => "Maple", :args_string => "int* tofu", :args => [1], :return => test_return[:void]} + expected = [ "typedef void (* CMOCK_Maple_CALLBACK)(int* tofu, int cmock_num_calls);\n", + "void Maple_StubWithCallback(CMOCK_Maple_CALLBACK Callback);\n" ].join + returned = @cmock_generator_plugin_callback.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "add mock function declaration for function with return values" do + function = {:name => "Maple", :args_string => "int* tofu", :args => [1], :return => test_return[:string]} + expected = [ "typedef const char* (* CMOCK_Maple_CALLBACK)(int* tofu, int cmock_num_calls);\n", + "void Maple_StubWithCallback(CMOCK_Maple_CALLBACK Callback);\n" ].join + returned = @cmock_generator_plugin_callback.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "add mock function declaration for function with return values and count is turned off" do + function = {:name => "Maple", :args_string => "int* tofu", :args => [1], :return => test_return[:string]} + expected = [ "typedef const char* (* CMOCK_Maple_CALLBACK)(int* tofu);\n", + "void Maple_StubWithCallback(CMOCK_Maple_CALLBACK Callback);\n" ].join + @cmock_generator_plugin_callback.include_count = false + returned = @cmock_generator_plugin_callback.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "add mock function implementation for functions of style 'void func(void)'" do + function = {:name => "Apple", :args => [], :args_string => "void", :return => test_return[:void]} + expected = [" if (Mock.Apple_CallbackFunctionPointer != NULL)\n", + " {\n", + " Mock.Apple_CallbackFunctionPointer(Mock.Apple_CallbackCalls++);\n", + " return;\n", + " }\n" + ].join + returned = @cmock_generator_plugin_callback.mock_implementation_precheck(function) + assert_equal(expected, returned) + end + + should "add mock function implementation for functions of style 'void func(void)' when count turned off" do + function = {:name => "Apple", :args => [], :args_string => "void", :return => test_return[:void]} + expected = [" if (Mock.Apple_CallbackFunctionPointer != NULL)\n", + " {\n", + " Mock.Apple_CallbackFunctionPointer();\n", + " return;\n", + " }\n" + ].join + @cmock_generator_plugin_callback.include_count = false + returned = @cmock_generator_plugin_callback.mock_implementation_precheck(function) + assert_equal(expected, returned) + end + + should "add mock function implementation for functions of style 'int func(void)'" do + function = {:name => "Apple", :args => [], :args_string => "void", :return => test_return[:int]} + expected = [" if (Mock.Apple_CallbackFunctionPointer != NULL)\n", + " {\n", + " return Mock.Apple_CallbackFunctionPointer(Mock.Apple_CallbackCalls++);\n", + " }\n" + ].join + returned = @cmock_generator_plugin_callback.mock_implementation_precheck(function) + assert_equal(expected, returned) + end + + should "add mock function implementation for functions of style 'void func(int* steak, uint8_t flag)'" do + function = {:name => "Apple", + :args => [ { :type => 'int*', :name => 'steak', :ptr? => true}, + { :type => 'uint8_t', :name => 'flag', :ptr? => false} ], + :args_string => "int* steak, uint8_t flag", + :return=> test_return[:void]} + expected = [" if (Mock.Apple_CallbackFunctionPointer != NULL)\n", + " {\n", + " Mock.Apple_CallbackFunctionPointer(steak, flag, Mock.Apple_CallbackCalls++);\n", + " return;\n", + " }\n" + ].join + returned = @cmock_generator_plugin_callback.mock_implementation_precheck(function) + assert_equal(expected, returned) + end + + should "add mock function implementation for functions of style 'void func(int* steak, uint8_t flag)' when count turned off" do + function = {:name => "Apple", + :args => [ { :type => 'int*', :name => 'steak', :ptr? => true}, + { :type => 'uint8_t', :name => 'flag', :ptr? => false} ], + :args_string => "int* steak, uint8_t flag", + :return=> test_return[:void]} + expected = [" if (Mock.Apple_CallbackFunctionPointer != NULL)\n", + " {\n", + " Mock.Apple_CallbackFunctionPointer(steak, flag);\n", + " return;\n", + " }\n" + ].join + @cmock_generator_plugin_callback.include_count = false + returned = @cmock_generator_plugin_callback.mock_implementation_precheck(function) + assert_equal(expected, returned) + end + + should "add mock function implementation for functions of style 'int16_t func(int* steak, uint8_t flag)'" do + function = {:name => "Apple", + :args => [ { :type => 'int*', :name => 'steak', :ptr? => true}, + { :type => 'uint8_t', :name => 'flag', :ptr? => false} ], + :args_string => "int* steak, uint8_t flag", + :return => test_return[:int]} + expected = [" if (Mock.Apple_CallbackFunctionPointer != NULL)\n", + " {\n", + " return Mock.Apple_CallbackFunctionPointer(steak, flag, Mock.Apple_CallbackCalls++);\n", + " }\n" + ].join + returned = @cmock_generator_plugin_callback.mock_implementation_precheck(function) + assert_equal(expected, returned) + end + + should "add mock interfaces for functions " do + function = {:name => "Lemon", + :args => [{ :type => "char*", :name => "pescado"}], + :args_string => "char* pescado", + :return => test_return[:int] + } + + expected = ["void Lemon_StubWithCallback(CMOCK_Lemon_CALLBACK Callback)\n", + "{\n", + " Mock.Lemon_CallbackFunctionPointer = Callback;\n", + "}\n\n" + ].join + returned = @cmock_generator_plugin_callback.mock_interfaces(function) + assert_equal(expected, returned) + end + + should "add mock destroy for functions" do + function = {:name => "Peach", :args => [], :return => test_return[:void] } + expected = " Mock.Peach_CallbackFunctionPointer = NULL;\n" + + " Mock.Peach_CallbackCalls = 0;\n" + returned = @cmock_generator_plugin_callback.mock_destroy(function) + assert_equal(expected, returned) + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_cexception_test.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_cexception_test.rb new file mode 100644 index 0000000..ac64f30 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_cexception_test.rb @@ -0,0 +1,94 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require File.expand_path(File.dirname(__FILE__)) + "/../test_helper" +require 'cmock_generator_plugin_cexception' + +class CMockGeneratorPluginCexceptionTest < Test::Unit::TestCase + def setup + create_mocks :config, :utils + @cmock_generator_plugin_cexception = CMockGeneratorPluginCexception.new(@config, @utils) + end + + def teardown + end + + should "have set up internal accessors correctly on init" do + assert_equal(@config, @cmock_generator_plugin_cexception.config) + assert_equal(@utils, @cmock_generator_plugin_cexception.utils) + assert_equal(7, @cmock_generator_plugin_cexception.priority) + end + + should "include the cexception library" do + expected = "#include \"CException.h\"\n" + returned = @cmock_generator_plugin_cexception.include_files + assert_equal(expected, returned) + end + + should "add to typedef structure mock needs" do + function = { :name => "Oak", :args => [], :return => test_return[:void] } + expected = " CEXCEPTION_T ExceptionToThrow;\n" + returned = @cmock_generator_plugin_cexception.instance_typedefs(function) + assert_equal(expected, returned) + end + + should "add mock function declarations for functions without arguments" do + function = { :name => "Spruce", :args_string => "void", :return => test_return[:void] } + expected = "#define Spruce_ExpectAndThrow(cmock_to_throw) Spruce_CMockExpectAndThrow(__LINE__, cmock_to_throw)\n"+ + "void Spruce_CMockExpectAndThrow(UNITY_LINE_TYPE cmock_line, CEXCEPTION_T cmock_to_throw);\n" + returned = @cmock_generator_plugin_cexception.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "add mock function declarations for functions with arguments" do + function = { :name => "Spruce", :args_string => "const char* Petunia, uint32_t Lily", :args_call => "Petunia, Lily", :return => test_return[:void] } + expected = "#define Spruce_ExpectAndThrow(Petunia, Lily, cmock_to_throw) Spruce_CMockExpectAndThrow(__LINE__, Petunia, Lily, cmock_to_throw)\n" + + "void Spruce_CMockExpectAndThrow(UNITY_LINE_TYPE cmock_line, const char* Petunia, uint32_t Lily, CEXCEPTION_T cmock_to_throw);\n" + returned = @cmock_generator_plugin_cexception.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "add a mock implementation" do + function = {:name => "Cherry", :args => [], :return => test_return[:void]} + expected = " if (cmock_call_instance->ExceptionToThrow != CEXCEPTION_NONE)\n {\n" + + " Throw(cmock_call_instance->ExceptionToThrow);\n }\n" + returned = @cmock_generator_plugin_cexception.mock_implementation(function) + assert_equal(expected, returned) + end + + should "add mock interfaces for functions without arguments" do + function = {:name => "Pear", :args_string => "void", :args => [], :return => test_return[:void]} + @utils.expect.code_add_base_expectation("Pear").returns("mock_retval_0") + @utils.expect.code_call_argument_loader(function).returns("") + + expected = ["void Pear_CMockExpectAndThrow(UNITY_LINE_TYPE cmock_line, CEXCEPTION_T cmock_to_throw)\n", + "{\n", + "mock_retval_0", + "", + " cmock_call_instance->ExceptionToThrow = cmock_to_throw;\n", + "}\n\n" + ].join + returned = @cmock_generator_plugin_cexception.mock_interfaces(function) + assert_equal(expected, returned) + end + + should "add a mock interfaces for functions with arguments" do + function = {:name => "Pear", :args_string => "int blah", :args => [{ :type => "int", :name => "blah" }], :return => test_return[:void]} + @utils.expect.code_add_base_expectation("Pear").returns("mock_retval_0") + @utils.expect.code_call_argument_loader(function).returns("mock_return_1") + + expected = ["void Pear_CMockExpectAndThrow(UNITY_LINE_TYPE cmock_line, int blah, CEXCEPTION_T cmock_to_throw)\n", + "{\n", + "mock_retval_0", + "mock_return_1", + " cmock_call_instance->ExceptionToThrow = cmock_to_throw;\n", + "}\n\n" + ].join + returned = @cmock_generator_plugin_cexception.mock_interfaces(function) + assert_equal(expected, returned) + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_expect_test.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_expect_test.rb new file mode 100644 index 0000000..fa85936 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_expect_test.rb @@ -0,0 +1,206 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require File.expand_path(File.dirname(__FILE__)) + "/../test_helper" +require 'cmock_generator_plugin_expect' + +class CMockGeneratorPluginExpectTest < Test::Unit::TestCase + def setup + create_mocks :config, :utils + + #no strict ordering and args_and_calls + @config.expect.when_ptr.returns(:compare_data) + @config.expect.enforce_strict_ordering.returns(false) + @config.stubs!(:respond_to?).returns(true) + # @config.expect.ignore.returns(:args_and_calls) + @utils.expect.helpers.returns({}) + @cmock_generator_plugin_expect = CMockGeneratorPluginExpect.new(@config, @utils) + + #strict ordering and args_only + @config.expect.when_ptr.returns(:compare_data) + @config.expect.enforce_strict_ordering.returns(true) + @config.stubs!(:respond_to?).returns(true) + # @config.expect.ignore.returns(:args_only) + @utils.expect.helpers.returns({}) + @cmock_generator_plugin_expect_strict = CMockGeneratorPluginExpect.new(@config, @utils) + end + + def teardown + end + + should "have set up internal accessors correctly on init" do + assert_equal(@config, @cmock_generator_plugin_expect.config) + assert_equal(@utils, @cmock_generator_plugin_expect.utils) + assert_equal(nil, @cmock_generator_plugin_expect.unity_helper) + assert_equal(5, @cmock_generator_plugin_expect.priority) + end + + should "not include any additional include files" do + assert(!@cmock_generator_plugin_expect.respond_to?(:include_files)) + end + + should "add to typedef structure mock needs of functions of style 'void func(void)'" do + function = {:name => "Oak", :args => [], :return => test_return[:void]} + expected = "" + returned = @cmock_generator_plugin_expect.instance_typedefs(function) + assert_equal(expected, returned) + end + + should "add to typedef structure mock needs of functions of style 'int func(void)'" do + function = {:name => "Elm", :args => [], :return => test_return[:int]} + expected = " int ReturnVal;\n" + returned = @cmock_generator_plugin_expect.instance_typedefs(function) + assert_equal(expected, returned) + end + + should "add to typedef structure mock needs of functions of style 'void func(int chicken, char* pork)'" do + function = {:name => "Cedar", :args => [{ :name => "chicken", :type => "int"}, { :name => "pork", :type => "char*"}], :return => test_return[:void]} + expected = " int Expected_chicken;\n char* Expected_pork;\n" + returned = @cmock_generator_plugin_expect.instance_typedefs(function) + assert_equal(expected, returned) + end + + should "add to typedef structure mock needs of functions of style 'int func(float beef)'" do + function = {:name => "Birch", :args => [{ :name => "beef", :type => "float"}], :return => test_return[:int]} + expected = " int ReturnVal;\n float Expected_beef;\n" + returned = @cmock_generator_plugin_expect.instance_typedefs(function) + assert_equal(expected, returned) + end + + should "add to typedef structure mock needs of functions of style 'void func(void)' and global ordering" do + function = {:name => "Oak", :args => [], :return => test_return[:void]} + expected = " int CallOrder;\n" + returned = @cmock_generator_plugin_expect_strict.instance_typedefs(function) + assert_equal(expected, returned) + end + + should "add mock function declaration for functions of style 'void func(void)'" do + function = {:name => "Maple", :args => [], :return => test_return[:void]} + expected = "#define Maple_Expect() Maple_CMockExpect(__LINE__)\n" + + "void Maple_CMockExpect(UNITY_LINE_TYPE cmock_line);\n" + returned = @cmock_generator_plugin_expect.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "add mock function declaration for functions of style 'int func(void)'" do + function = {:name => "Spruce", :args => [], :return => test_return[:int]} + expected = "#define Spruce_ExpectAndReturn(cmock_retval) Spruce_CMockExpectAndReturn(__LINE__, cmock_retval)\n" + + "void Spruce_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, int cmock_to_return);\n" + returned = @cmock_generator_plugin_expect.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "add mock function declaration for functions of style 'const char* func(int tofu)'" do + function = {:name => "Pine", :args => ["int tofu"], :args_string => "int tofu", :args_call => 'tofu', :return => test_return[:string]} + expected = "#define Pine_ExpectAndReturn(tofu, cmock_retval) Pine_CMockExpectAndReturn(__LINE__, tofu, cmock_retval)\n" + + "void Pine_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, int tofu, const char* cmock_to_return);\n" + returned = @cmock_generator_plugin_expect.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "add mock function implementation for functions of style 'void func(void)'" do + function = {:name => "Apple", :args => [], :return => test_return[:void]} + expected = "" + returned = @cmock_generator_plugin_expect.mock_implementation(function) + assert_equal(expected, returned) + end + + should "add mock function implementation for functions of style 'int func(int veal, unsigned int sushi)'" do + function = {:name => "Cherry", :args => [ { :type => "int", :name => "veal" }, { :type => "unsigned int", :name => "sushi" } ], :return => test_return[:int]} + + @utils.expect.code_verify_an_arg_expectation(function, function[:args][0]).returns(" mocked_retval_1") + @utils.expect.code_verify_an_arg_expectation(function, function[:args][1]).returns(" mocked_retval_2") + expected = " mocked_retval_1 mocked_retval_2" + returned = @cmock_generator_plugin_expect.mock_implementation(function) + assert_equal(expected, returned) + end + + should "add mock function implementation using ordering if needed" do + function = {:name => "Apple", :args => [], :return => test_return[:void]} + expected = "" + @cmock_generator_plugin_expect.ordered = true + returned = @cmock_generator_plugin_expect.mock_implementation(function) + assert_equal(expected, returned) + end + + should "add mock function implementation for functions of style 'void func(int worm)' and strict ordering" do + function = {:name => "Apple", :args => [{ :type => "int", :name => "worm" }], :return => test_return[:void]} + @utils.expect.code_verify_an_arg_expectation(function, function[:args][0]).returns("mocked_retval_0") + expected = "mocked_retval_0" + @cmock_generator_plugin_expect.ordered = true + returned = @cmock_generator_plugin_expect_strict.mock_implementation(function) + assert_equal(expected, returned) + end + + should "add mock interfaces for functions of style 'void func(void)'" do + function = {:name => "Pear", :args => [], :args_string => "void", :return => test_return[:void]} + @utils.expect.code_add_base_expectation("Pear").returns("mock_retval_0 ") + @utils.expect.code_call_argument_loader(function).returns("mock_retval_1 ") + expected = ["void Pear_CMockExpect(UNITY_LINE_TYPE cmock_line)\n", + "{\n", + "mock_retval_0 ", + "mock_retval_1 ", + "}\n\n" + ].join + returned = @cmock_generator_plugin_expect.mock_interfaces(function) + assert_equal(expected, returned) + end + + should "add mock interfaces for functions of style 'int func(void)'" do + function = {:name => "Orange", :args => [], :args_string => "void", :return => test_return[:int]} + @utils.expect.code_add_base_expectation("Orange").returns("mock_retval_0 ") + @utils.expect.code_call_argument_loader(function).returns("mock_retval_1 ") + @utils.expect.code_assign_argument_quickly("cmock_call_instance->ReturnVal", function[:return]).returns("mock_retval_2") + expected = ["void Orange_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, int cmock_to_return)\n", + "{\n", + "mock_retval_0 ", + "mock_retval_1 ", + "mock_retval_2", + "}\n\n" + ].join + returned = @cmock_generator_plugin_expect.mock_interfaces(function) + assert_equal(expected, returned) + end + + should "add mock interfaces for functions of style 'int func(char* pescado)'" do + function = {:name => "Lemon", :args => [{ :type => "char*", :name => "pescado"}], :args_string => "char* pescado", :return => test_return[:int]} + @utils.expect.code_add_base_expectation("Lemon").returns("mock_retval_0 ") + @utils.expect.code_call_argument_loader(function).returns("mock_retval_1 ") + @utils.expect.code_assign_argument_quickly("cmock_call_instance->ReturnVal", function[:return]).returns("mock_retval_2") + expected = ["void Lemon_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, char* pescado, int cmock_to_return)\n", + "{\n", + "mock_retval_0 ", + "mock_retval_1 ", + "mock_retval_2", + "}\n\n" + ].join + returned = @cmock_generator_plugin_expect.mock_interfaces(function) + assert_equal(expected, returned) + end + + should "add mock interfaces for functions when using ordering" do + function = {:name => "Pear", :args => [], :args_string => "void", :return => test_return[:void]} + @utils.expect.code_add_base_expectation("Pear").returns("mock_retval_0 ") + @utils.expect.code_call_argument_loader(function).returns("mock_retval_1 ") + expected = ["void Pear_CMockExpect(UNITY_LINE_TYPE cmock_line)\n", + "{\n", + "mock_retval_0 ", + "mock_retval_1 ", + "}\n\n" + ].join + @cmock_generator_plugin_expect.ordered = true + returned = @cmock_generator_plugin_expect.mock_interfaces(function) + assert_equal(expected, returned) + end + + should "add mock verify lines" do + function = {:name => "Banana" } + expected = " UNITY_TEST_ASSERT(CMOCK_GUTS_NONE == Mock.Banana_CallInstance, cmock_line, \"Function 'Banana' called less times than expected.\");\n" + returned = @cmock_generator_plugin_expect.mock_verify(function) + assert_equal(expected, returned) + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_ignore_test.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_ignore_test.rb new file mode 100644 index 0000000..15f72cc --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_ignore_test.rb @@ -0,0 +1,159 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require File.expand_path(File.dirname(__FILE__)) + "/../test_helper" +require 'cmock_generator_plugin_ignore' + +class CMockGeneratorPluginIgnoreTest < Test::Unit::TestCase + def setup + create_mocks :config, :utils + @config.expect.ignore.returns(:args_and_calls) + @config.stubs!(:respond_to?).returns(true) + @cmock_generator_plugin_ignore = CMockGeneratorPluginIgnore.new(@config, @utils) + + @config.expect.ignore.returns(:args_only) + @cmock_generator_plugin_ignore_just_args = CMockGeneratorPluginIgnore.new(@config, @utils) + end + + def teardown + end + + should "have set up internal accessors correctly on init" do + assert_equal(@config, @cmock_generator_plugin_ignore.config) + assert_equal(@utils, @cmock_generator_plugin_ignore.utils) + assert_equal(2, @cmock_generator_plugin_ignore.priority) + end + + should "not have any additional include file requirements" do + assert(!@cmock_generator_plugin_ignore.respond_to?(:include_files)) + end + + should "add a required variable to the instance structure" do + function = {:name => "Grass", :args => [], :return => test_return[:void]} + expected = " int Grass_IgnoreBool;\n" + returned = @cmock_generator_plugin_ignore.instance_structure(function) + assert_equal(expected, returned) + end + + should "handle function declarations for functions without return values" do + function = {:name => "Mold", :args_string => "void", :return => test_return[:void]} + expected = "#define Mold_Ignore() Mold_CMockIgnore(__LINE__)\nvoid Mold_CMockIgnore(UNITY_LINE_TYPE cmock_line);\n" + returned = @cmock_generator_plugin_ignore.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "handle function declarations for functions that returns something" do + function = {:name => "Fungus", :args_string => "void", :return => test_return[:string]} + expected = "#define Fungus_IgnoreAndReturn(cmock_retval) Fungus_CMockIgnoreAndReturn(__LINE__, cmock_retval)\n"+ + "void Fungus_CMockIgnoreAndReturn(UNITY_LINE_TYPE cmock_line, const char* cmock_to_return);\n" + returned = @cmock_generator_plugin_ignore.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "add required code to implementation precheck with void function (when :args_and_calls)" do + function = {:name => "Mold", :args_string => "void", :return => test_return[:void]} + expected = [" if (Mock.Mold_IgnoreBool)\n", + " {\n", + " return;\n", + " }\n" + ].join + returned = @cmock_generator_plugin_ignore.mock_implementation_for_ignores(function) + assert_equal(expected, returned) + end + + should "add required code to implementation precheck with return functions (when :args_and_calls)" do + function = {:name => "Fungus", :args_string => "void", :return => test_return[:int]} + retval = test_return[:int].merge({ :name => "cmock_call_instance->ReturnVal"}) + @utils.expect.code_assign_argument_quickly("Mock.Fungus_FinalReturn", retval).returns(' mock_retval_0') + expected = [" if (Mock.Fungus_IgnoreBool)\n", + " {\n", + " if (cmock_call_instance == NULL)\n", + " return Mock.Fungus_FinalReturn;\n", + " mock_retval_0", + " return cmock_call_instance->ReturnVal;\n", + " }\n" + ].join + returned = @cmock_generator_plugin_ignore.mock_implementation_for_ignores(function) + assert_equal(expected, returned) + end + + should "not add code to implementation prefix (when :args_only)" do + function = {:name => "Fungus", :args_string => "void", :return => test_return[:int]} + retval = test_return[:int].merge({ :name => "cmock_call_instance->ReturnVal"}) + expected = "" + returned = @cmock_generator_plugin_ignore.mock_implementation_precheck(function) + assert_equal(expected, returned) + end + + should "add required code to implementation with void function (when :args_only)" do + function = {:name => "Mold", :args_string => "void", :return => test_return[:void]} + expected = [" if (Mock.Mold_IgnoreBool)\n", + " {\n", + " return;\n", + " }\n" + ].join + returned = @cmock_generator_plugin_ignore_just_args.mock_implementation(function) + assert_equal(expected, returned) + end + + should "add required code to implementation with return functions (when :args_only)" do + function = {:name => "Fungus", :args_string => "void", :return => test_return[:int]} + retval = test_return[:int].merge({ :name => "cmock_call_instance->ReturnVal"}) + @utils.expect.code_assign_argument_quickly("Mock.Fungus_FinalReturn", retval).returns(' mock_retval_0') + expected = [" if (Mock.Fungus_IgnoreBool)\n", + " {\n", + " if (cmock_call_instance == NULL)\n", + " return Mock.Fungus_FinalReturn;\n", + " mock_retval_0", + " return cmock_call_instance->ReturnVal;\n", + " }\n" + ].join + returned = @cmock_generator_plugin_ignore_just_args.mock_implementation(function) + assert_equal(expected, returned) + end + + should "add a new mock interface for ignoring when function had no return value" do + function = {:name => "Slime", :args => [], :args_string => "void", :return => test_return[:void]} + expected = ["void Slime_CMockIgnore(UNITY_LINE_TYPE cmock_line)\n", + "{\n", + " Mock.Slime_IgnoreBool = (int)1;\n", + "}\n\n" + ].join + @config.expect.ignore.returns(:args_and_calls) + returned = @cmock_generator_plugin_ignore.mock_interfaces(function) + assert_equal(expected, returned) + end + + should "add a new mock interface for ignoring when function had no return value and we are checking args only" do + function = {:name => "Slime", :args => [], :args_string => "void", :return => test_return[:void]} + expected = ["void Slime_CMockIgnore(UNITY_LINE_TYPE cmock_line)\n", + "{\n", + "mock_return_1", + " Mock.Slime_IgnoreBool = (int)1;\n", + "}\n\n" + ].join + @config.expect.ignore.returns(:args_only) + @utils.expect.code_add_base_expectation("Slime", true).returns("mock_return_1") + returned = @cmock_generator_plugin_ignore.mock_interfaces(function) + assert_equal(expected, returned) + end + + should "add a new mock interface for ignoring when function has return value" do + function = {:name => "Slime", :args => [], :args_string => "void", :return => test_return[:int]} + @config.expect.ignore.returns(:args_and_calls) + @utils.expect.code_add_base_expectation("Slime", false).returns("mock_return_1") + expected = ["void Slime_CMockIgnoreAndReturn(UNITY_LINE_TYPE cmock_line, int cmock_to_return)\n", + "{\n", + "mock_return_1", + " cmock_call_instance->ReturnVal = cmock_to_return;\n", + " Mock.Slime_IgnoreBool = (int)1;\n", + "}\n\n" + ].join + returned = @cmock_generator_plugin_ignore.mock_interfaces(function) + assert_equal(expected, returned) + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/unit/cmock_generator_utils_test.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/unit/cmock_generator_utils_test.rb new file mode 100644 index 0000000..7b24fe3 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/unit/cmock_generator_utils_test.rb @@ -0,0 +1,291 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require File.expand_path(File.dirname(__FILE__)) + "/../test_helper" +require 'cmock_generator_utils' + +class CMockGeneratorUtilsTest < Test::Unit::TestCase + def setup + create_mocks :config, :unity_helper, :unity_helper + + @config.expect.when_ptr.returns(:compare_ptr) + @config.expect.enforce_strict_ordering.returns(false) + @config.expect.plugins.returns([]) + @config.expect.plugins.returns([]) + @config.expect.treat_as.returns(['int','short','long','char','char*']) + @cmock_generator_utils_simple = CMockGeneratorUtils.new(@config, {:unity_helper => @unity_helper}) + + @config.expect.when_ptr.returns(:smart) + @config.expect.enforce_strict_ordering.returns(true) + @config.expect.plugins.returns([:array, :cexception]) + @config.expect.plugins.returns([:array, :cexception]) + @config.expect.treat_as.returns(['int','short','long','char','uint32_t','char*']) + @cmock_generator_utils_complex = CMockGeneratorUtils.new(@config, {:unity_helper => @unity_helper, :A=>1, :B=>2}) + end + + def teardown + end + + should "have set up internal accessors correctly on init" do + assert_equal(@config, @cmock_generator_utils_simple.config) + assert_equal({:unity_helper => @unity_helper}, @cmock_generator_utils_simple.helpers) + assert_equal(false, @cmock_generator_utils_simple.arrays) + assert_equal(false, @cmock_generator_utils_simple.cexception) + end + + should "have set up internal accessors correctly on init, complete with passed helpers" do + assert_equal(@config, @cmock_generator_utils_complex.config) + assert_equal({:unity_helper => @unity_helper, :A=>1, :B=>2},@cmock_generator_utils_complex.helpers) + assert_equal(true, @cmock_generator_utils_complex.arrays) + assert_equal(true, @cmock_generator_utils_complex.cexception) + end + + should "add code for a base expectation with no plugins" do + expected = + " CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_Apple_CALL_INSTANCE));\n" + + " CMOCK_Apple_CALL_INSTANCE* cmock_call_instance = (CMOCK_Apple_CALL_INSTANCE*)CMock_Guts_GetAddressFor(cmock_guts_index);\n" + + " UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, \"CMock has run out of memory. Please allocate more.\");\n" + + " Mock.Apple_CallInstance = CMock_Guts_MemChain(Mock.Apple_CallInstance, cmock_guts_index);\n" + + " cmock_call_instance->LineNumber = cmock_line;\n" + output = @cmock_generator_utils_simple.code_add_base_expectation("Apple") + assert_equal(expected, output) + end + + should "add code for a base expectation with all plugins" do + expected = + " CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_Apple_CALL_INSTANCE));\n" + + " CMOCK_Apple_CALL_INSTANCE* cmock_call_instance = (CMOCK_Apple_CALL_INSTANCE*)CMock_Guts_GetAddressFor(cmock_guts_index);\n" + + " UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, \"CMock has run out of memory. Please allocate more.\");\n" + + " Mock.Apple_CallInstance = CMock_Guts_MemChain(Mock.Apple_CallInstance, cmock_guts_index);\n" + + " cmock_call_instance->LineNumber = cmock_line;\n" + + " cmock_call_instance->CallOrder = ++GlobalExpectCount;\n" + + " cmock_call_instance->ExceptionToThrow = CEXCEPTION_NONE;\n" + output = @cmock_generator_utils_complex.code_add_base_expectation("Apple", true) + assert_equal(expected, output) + end + + should "add code for a base expectation with all plugins and ordering not supported" do + expected = + " CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_Apple_CALL_INSTANCE));\n" + + " CMOCK_Apple_CALL_INSTANCE* cmock_call_instance = (CMOCK_Apple_CALL_INSTANCE*)CMock_Guts_GetAddressFor(cmock_guts_index);\n" + + " UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, \"CMock has run out of memory. Please allocate more.\");\n" + + " Mock.Apple_CallInstance = CMock_Guts_MemChain(Mock.Apple_CallInstance, cmock_guts_index);\n" + + " cmock_call_instance->LineNumber = cmock_line;\n" + + " cmock_call_instance->ExceptionToThrow = CEXCEPTION_NONE;\n" + output = @cmock_generator_utils_complex.code_add_base_expectation("Apple", false) + assert_equal(expected, output) + end + + should "add argument expectations for values when no array plugin" do + arg1 = { :name => "Orange", :const? => false, :type => 'int', :ptr? => false } + expected1 = " cmock_call_instance->Expected_Orange = Orange;\n" + + arg2 = { :name => "Lemon", :const? => true, :type => 'const char*', :ptr? => true } + expected2 = " cmock_call_instance->Expected_Lemon = (const char*)Lemon;\n" + + arg3 = { :name => "Kiwi", :const? => false, :type => 'KIWI_T*', :ptr? => true } + expected3 = " cmock_call_instance->Expected_Kiwi = Kiwi;\n" + + arg4 = { :name => "Lime", :const? => false, :type => 'LIME_T', :ptr? => false } + expected4 = " memcpy(&cmock_call_instance->Expected_Lime, &Lime, sizeof(LIME_T));\n" + + assert_equal(expected1, @cmock_generator_utils_simple.code_add_an_arg_expectation(arg1)) + assert_equal(expected2, @cmock_generator_utils_simple.code_add_an_arg_expectation(arg2)) + assert_equal(expected3, @cmock_generator_utils_simple.code_add_an_arg_expectation(arg3)) + assert_equal(expected4, @cmock_generator_utils_simple.code_add_an_arg_expectation(arg4)) + end + + should "add argument expectations for values when array plugin enabled" do + arg1 = { :name => "Orange", :const? => false, :type => 'int', :ptr? => false } + expected1 = " cmock_call_instance->Expected_Orange = Orange;\n" + + arg2 = { :name => "Lemon", :const? => true, :type => 'const char*', :ptr? => true } + expected2 = " cmock_call_instance->Expected_Lemon = (const char*)Lemon;\n" + + " cmock_call_instance->Expected_Lemon_Depth = Lemon_Depth;\n" + + arg3 = { :name => "Kiwi", :const? => false, :type => 'KIWI_T*', :ptr? => true } + expected3 = " cmock_call_instance->Expected_Kiwi = Kiwi;\n" + + " cmock_call_instance->Expected_Kiwi_Depth = Kiwi_Depth;\n" + + arg4 = { :name => "Lime", :const? => false, :type => 'LIME_T', :ptr? => false } + expected4 = " memcpy(&cmock_call_instance->Expected_Lime, &Lime, sizeof(LIME_T));\n" + + assert_equal(expected1, @cmock_generator_utils_complex.code_add_an_arg_expectation(arg1)) + assert_equal(expected2, @cmock_generator_utils_complex.code_add_an_arg_expectation(arg2, 'Lemon_Depth')) + assert_equal(expected3, @cmock_generator_utils_complex.code_add_an_arg_expectation(arg3, 'Lemon_Depth')) + assert_equal(expected4, @cmock_generator_utils_complex.code_add_an_arg_expectation(arg4)) + end + + should 'not have an argument loader when the function has no arguments' do + function = { :name => "Melon", :args_string => "void" } + + assert_equal("", @cmock_generator_utils_complex.code_add_argument_loader(function)) + end + + should 'create an argument loader when the function has arguments' do + function = { :name => "Melon", + :args_string => "stuff", + :args => [test_arg[:int_ptr], test_arg[:mytype], test_arg[:string]] + } + expected = "void CMockExpectParameters_Melon(CMOCK_Melon_CALL_INSTANCE* cmock_call_instance, stuff)\n{\n" + + " cmock_call_instance->Expected_MyIntPtr = MyIntPtr;\n" + + " memcpy(&cmock_call_instance->Expected_MyMyType, &MyMyType, sizeof(MY_TYPE));\n" + + " cmock_call_instance->Expected_MyStr = (char*)MyStr;\n" + + "}\n\n" + assert_equal(expected, @cmock_generator_utils_simple.code_add_argument_loader(function)) + end + + should 'create an argument loader when the function has arguments supporting arrays' do + function = { :name => "Melon", + :args_string => "stuff", + :args => [test_arg[:int_ptr], test_arg[:mytype], test_arg[:string]] + } + expected = "void CMockExpectParameters_Melon(CMOCK_Melon_CALL_INSTANCE* cmock_call_instance, int* MyIntPtr, int MyIntPtr_Depth, const MY_TYPE MyMyType, const char* MyStr)\n{\n" + + " cmock_call_instance->Expected_MyIntPtr = MyIntPtr;\n" + + " cmock_call_instance->Expected_MyIntPtr_Depth = MyIntPtr_Depth;\n" + + " memcpy(&cmock_call_instance->Expected_MyMyType, &MyMyType, sizeof(MY_TYPE));\n" + + " cmock_call_instance->Expected_MyStr = (char*)MyStr;\n" + + "}\n\n" + assert_equal(expected, @cmock_generator_utils_complex.code_add_argument_loader(function)) + end + + should "not call argument loader if there are no arguments to actually use for this function" do + function = { :name => "Pineapple", :args_string => "void" } + + assert_equal("", @cmock_generator_utils_complex.code_call_argument_loader(function)) + end + + should 'call an argument loader when the function has arguments' do + function = { :name => "Pineapple", + :args_string => "stuff", + :args => [test_arg[:int_ptr], test_arg[:mytype], test_arg[:string]] + } + expected = " CMockExpectParameters_Pineapple(cmock_call_instance, MyIntPtr, MyMyType, MyStr);\n" + assert_equal(expected, @cmock_generator_utils_simple.code_call_argument_loader(function)) + end + + should 'call an argument loader when the function has arguments with arrays' do + function = { :name => "Pineapple", + :args_string => "stuff", + :args => [test_arg[:int_ptr], test_arg[:mytype], test_arg[:string]] + } + expected = " CMockExpectParameters_Pineapple(cmock_call_instance, MyIntPtr, 1, MyMyType, MyStr);\n" + assert_equal(expected, @cmock_generator_utils_complex.code_call_argument_loader(function)) + end + + should 'handle a simple assert when requested' do + function = { :name => 'Pear' } + arg = test_arg[:int] + expected = " UNITY_TEST_ASSERT_EQUAL_INT(cmock_call_instance->Expected_MyInt, MyInt, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyInt'.\");\n" + @unity_helper.expect.get_helper('int').returns(['UNITY_TEST_ASSERT_EQUAL_INT','']) + assert_equal(expected, @cmock_generator_utils_simple.code_verify_an_arg_expectation(function, arg)) + end + + should 'handle a pointer comparison when configured to do so' do + function = { :name => 'Pear' } + arg = test_arg[:int_ptr] + expected = " UNITY_TEST_ASSERT_EQUAL_PTR(cmock_call_instance->Expected_MyIntPtr, MyIntPtr, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyIntPtr'.\");\n" + assert_equal(expected, @cmock_generator_utils_simple.code_verify_an_arg_expectation(function, arg)) + end + + should 'handle const char as string compares ' do + function = { :name => 'Pear' } + arg = test_arg[:string] + expected = " UNITY_TEST_ASSERT_EQUAL_STRING(cmock_call_instance->Expected_MyStr, MyStr, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyStr'.\");\n" + @unity_helper.expect.get_helper('char*').returns(['UNITY_TEST_ASSERT_EQUAL_STRING','']) + assert_equal(expected, @cmock_generator_utils_simple.code_verify_an_arg_expectation(function, arg)) + end + + should 'handle custom types as memory compares when we have no better way to do it' do + function = { :name => 'Pear' } + arg = test_arg[:mytype] + expected = " UNITY_TEST_ASSERT_EQUAL_MEMORY((void*)(&cmock_call_instance->Expected_MyMyType), (void*)(&MyMyType), sizeof(MY_TYPE), cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyMyType'.\");\n" + @unity_helper.expect.get_helper('MY_TYPE').returns(['UNITY_TEST_ASSERT_EQUAL_MEMORY','&']) + assert_equal(expected, @cmock_generator_utils_simple.code_verify_an_arg_expectation(function, arg)) + end + + should 'handle custom types with custom handlers when available, even if they do not support the extra message' do + function = { :name => 'Pear' } + arg = test_arg[:mytype] + expected = " UNITY_TEST_ASSERT_EQUAL_MY_TYPE(cmock_call_instance->Expected_MyMyType, MyMyType, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyMyType'.\");\n" + @unity_helper.expect.get_helper('MY_TYPE').returns(['UNITY_TEST_ASSERT_EQUAL_MY_TYPE','']) + assert_equal(expected, @cmock_generator_utils_simple.code_verify_an_arg_expectation(function, arg)) + end + + should 'handle pointers to custom types with array handlers, even if the array extension is turned off' do + function = { :name => 'Pear' } + arg = test_arg[:mytype] + expected = " UNITY_TEST_ASSERT_EQUAL_MY_TYPE_ARRAY(&cmock_call_instance->Expected_MyMyType, &MyMyType, 1, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyMyType'.\");\n" + @unity_helper.expect.get_helper('MY_TYPE').returns(['UNITY_TEST_ASSERT_EQUAL_MY_TYPE_ARRAY','&']) + assert_equal(expected, @cmock_generator_utils_simple.code_verify_an_arg_expectation(function, arg)) + end + + should 'handle a simple assert when requested with array plugin enabled' do + function = { :name => 'Pear' } + arg = test_arg[:int] + expected = " UNITY_TEST_ASSERT_EQUAL_INT(cmock_call_instance->Expected_MyInt, MyInt, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyInt'.\");\n" + @unity_helper.expect.get_helper('int').returns(['UNITY_TEST_ASSERT_EQUAL_INT','']) + assert_equal(expected, @cmock_generator_utils_complex.code_verify_an_arg_expectation(function, arg)) + end + + should 'handle an array comparison with array plugin enabled' do + function = { :name => 'Pear' } + arg = test_arg[:int_ptr] + expected = " if (cmock_call_instance->Expected_MyIntPtr == NULL)\n" + + " { UNITY_TEST_ASSERT_NULL(MyIntPtr, cmock_line, \"Expected NULL. Function 'Pear' called with unexpected value for argument 'MyIntPtr'.\"); }\n" + + " else if (cmock_call_instance->Expected_MyIntPtr_Depth == 0)\n" + + " { UNITY_TEST_ASSERT_EQUAL_PTR(cmock_call_instance->Expected_MyIntPtr, MyIntPtr, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyIntPtr'.\"); }\n" + + " else\n" + + " { UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(cmock_call_instance->Expected_MyIntPtr, MyIntPtr, cmock_call_instance->Expected_MyIntPtr_Depth, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyIntPtr'.\"); }\n" + @unity_helper.expect.get_helper('int*').returns(['UNITY_TEST_ASSERT_EQUAL_INT_ARRAY','']) + assert_equal(expected, @cmock_generator_utils_complex.code_verify_an_arg_expectation(function, arg)) + end + + should 'handle const char as string compares with array plugin enabled' do + function = { :name => 'Pear' } + arg = test_arg[:string] + expected = " UNITY_TEST_ASSERT_EQUAL_STRING(cmock_call_instance->Expected_MyStr, MyStr, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyStr'.\");\n" + @unity_helper.expect.get_helper('char*').returns(['UNITY_TEST_ASSERT_EQUAL_STRING','']) + assert_equal(expected, @cmock_generator_utils_complex.code_verify_an_arg_expectation(function, arg)) + end + + should 'handle custom types as memory compares when we have no better way to do it with array plugin enabled' do + function = { :name => 'Pear' } + arg = test_arg[:mytype] + expected = " UNITY_TEST_ASSERT_EQUAL_MEMORY((void*)(&cmock_call_instance->Expected_MyMyType), (void*)(&MyMyType), sizeof(MY_TYPE), cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyMyType'.\");\n" + @unity_helper.expect.get_helper('MY_TYPE').returns(['UNITY_TEST_ASSERT_EQUAL_MEMORY','&']) + assert_equal(expected, @cmock_generator_utils_complex.code_verify_an_arg_expectation(function, arg)) + end + + should 'handle custom types with custom handlers when available, even if they do not support the extra message with array plugin enabled' do + function = { :name => 'Pear' } + arg = test_arg[:mytype] + expected = " UNITY_TEST_ASSERT_EQUAL_MY_TYPE(cmock_call_instance->Expected_MyMyType, MyMyType, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyMyType'.\");\n" + @unity_helper.expect.get_helper('MY_TYPE').returns(['UNITY_TEST_ASSERT_EQUAL_MY_TYPE','']) + assert_equal(expected, @cmock_generator_utils_complex.code_verify_an_arg_expectation(function, arg)) + end + + should 'handle custom types with array handlers when array plugin is enabled' do + function = { :name => 'Pear' } + arg = test_arg[:mytype_ptr] + expected = " if (cmock_call_instance->Expected_MyMyTypePtr == NULL)\n" + + " { UNITY_TEST_ASSERT_NULL(MyMyTypePtr, cmock_line, \"Expected NULL. Function 'Pear' called with unexpected value for argument 'MyMyTypePtr'.\"); }\n" + + " else if (cmock_call_instance->Expected_MyMyTypePtr_Depth == 0)\n" + + " { UNITY_TEST_ASSERT_EQUAL_PTR(cmock_call_instance->Expected_MyMyTypePtr, MyMyTypePtr, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyMyTypePtr'.\"); }\n" + + " else\n" + + " { UNITY_TEST_ASSERT_EQUAL_MY_TYPE_ARRAY(cmock_call_instance->Expected_MyMyTypePtr, MyMyTypePtr, cmock_call_instance->Expected_MyMyTypePtr_Depth, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyMyTypePtr'.\"); }\n" + @unity_helper.expect.get_helper('MY_TYPE*').returns(['UNITY_TEST_ASSERT_EQUAL_MY_TYPE_ARRAY','']) + assert_equal(expected, @cmock_generator_utils_complex.code_verify_an_arg_expectation(function, arg)) + end + + should 'handle custom types with array handlers when array plugin is enabled for non-array types' do + function = { :name => 'Pear' } + arg = test_arg[:mytype] + expected = " UNITY_TEST_ASSERT_EQUAL_MY_TYPE_ARRAY(&cmock_call_instance->Expected_MyMyType, &MyMyType, 1, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyMyType'.\");\n" + @unity_helper.expect.get_helper('MY_TYPE').returns(['UNITY_TEST_ASSERT_EQUAL_MY_TYPE_ARRAY','&']) + assert_equal(expected, @cmock_generator_utils_complex.code_verify_an_arg_expectation(function, arg)) + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/unit/cmock_header_parser_test.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/unit/cmock_header_parser_test.rb new file mode 100644 index 0000000..6517abd --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/unit/cmock_header_parser_test.rb @@ -0,0 +1,1170 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +$ThisIsOnlyATest = true + +require File.expand_path(File.dirname(__FILE__)) + "/../test_helper" +require 'cmock_header_parser' + +class CMockHeaderParserTest < Test::Unit::TestCase + + def setup + create_mocks :config + @test_name = 'test_file.h' + @config.expect.strippables.returns(['(?:__attribute__\s*\(+.*?\)+)']) + @config.expect.attributes.returns(['__ramfunc', 'funky_attrib']) + @config.expect.treat_as_void.returns(['MY_FUNKY_VOID']) + @config.expect.treat_as.returns({ "BANJOS" => "INT", "TUBAS" => "HEX16"} ) + @config.expect.when_no_prototypes.returns(:error) + @config.expect.verbosity.returns(1) + @config.expect.treat_externs.returns(:exclude) + + @parser = CMockHeaderParser.new(@config) + end + + def teardown + end + + should "create and initialize variables to defaults appropriately" do + assert_equal([], @parser.funcs) + assert_equal(['const', '__ramfunc', 'funky_attrib'], @parser.c_attributes) + assert_equal(['void','MY_FUNKY_VOID'], @parser.treat_as_void) + end + + should "strip out line comments" do + source = + " abcd;\n" + + "// hello;\n" + + "who // is you\n" + + expected = + [ + "abcd", + "who" + ] + + assert_equal(expected, @parser.import_source(source).map!{|s|s.strip}) + end + + + should "remove block comments" do + source = + " no_comments;\n" + + "// basic_line_comment;\n" + + "/* basic_block_comment;*/\n" + + "pre_block; /* start_of_block_comment;\n" + + "// embedded_line_comment_in_block_comment; */\n" + + "// /* commented_out_block_comment_line\n" + + "shown_because_block_comment_invalid_from_line_comment;\n" + + "// */\n" + + "//* shorter_commented_out_block_comment_line; \n" + + "shown_because_block_comment_invalid_from_shorter_line_comment;\n" + + "/*/\n" + + "not_shown_because_line_above_started_comment;\n" + + "//*/\n" + + "/* \n" + + "not_shown_because_block_comment_started_this_time;\n" + + "/*/\n" + + "shown_because_line_above_ended_comment_this_time;\n" + + "//*/\n" + + expected = + [ + "no_comments", + "pre_block", + "shown_because_block_comment_invalid_from_line_comment", + "shown_because_block_comment_invalid_from_shorter_line_comment", + "shown_because_line_above_ended_comment_this_time" + ] + + assert_equal(expected, @parser.import_source(source).map!{|s|s.strip}) + end + + + should "remove preprocessor directives" do + source = + "#when stuff_happens\n" + + "#ifdef _TEST\n" + + "#pragma stack_switch" + + expected = [] + + assert_equal(expected, @parser.import_source(source)) + end + + + should "remove assembler pragma sections" do + source = + " #pragma\tasm\n" + + " .foo\n" + + " lda %m\n" + + " nop\n" + + "# pragma endasm \n" + + "foo" + + expected = ["foo"] + + assert_equal(expected, @parser.import_source(source)) + end + + + should "smush lines together that contain continuation characters" do + source = + "hoo hah \\\n" + + "when \\ \n" + + expected = + [ + "hoo hah when" + ] + + assert_equal(expected, @parser.import_source(source).map!{|s|s.strip}) + end + + + should "remove C macro definitions" do + source = + "#define this is the first line\\\n" + + "and the second\\\n" + + "and the third that should be removed\n" + + "but I'm here\n" + + expected = ["but I'm here"] + + assert_equal(expected, @parser.import_source(source)) + end + + + should "remove typedef statements" do + source = + "typedef uint32 (unsigned int);\n" + + "const typedef int INT;\n" + + "int notatypedef;\n" + + "int typedef_isnt_me;\n" + + " typedef who cares what really comes here \\\n" + # exercise multiline typedef + " continuation;\n" + + "this should remain!;\n" + + "typedef blah bleh;\n" + + "typedef struct shell_command_struct {\n" + + " char_ptr COMMAND;\n" + + " int_32 (*SHELL_FUNC)(int_32 argc);\n" + + "} SHELL_COMMAND_STRUCT, * SHELL_COMMAND_PTR;\n" + + "typedef struct shell_command_struct {\n" + + " char_ptr COMMAND;\n" + + " int_32 (*SHELL_FUNC)(int_32 argc, char_ptr argv[]);\n" + + "} SHELL_COMMAND_STRUCT, * SHELL_COMMAND_PTR;\n" + + "typedef struct shell_command_struct {\n" + + " char_ptr COMMAND;\n" + + " int_32 (*SHELL_FUNC)(int_32 argc);\n" + + "};\n" + + expected = + [ + "int notatypedef", + "int typedef_isnt_me", + "this should remain!" + ] + + assert_equal(expected, @parser.import_source(source).map!{|s|s.strip}) + end + + + should "remove enum statements" do + source = + "enum _NamedEnum {\n" + + " THING1 = (0x0001),\n" + + " THING2 = (0x0001 << 5),\n" + + "}ListOValues;\n\n" + + "don't delete me!!\n" + + " modifier_str enum _NamedEnum {THING1 = (0x0001), THING2 = (0x0001 << 5)} ListOValues;\n\n" + + "typedef enum {\n" + + " THING1,\n" + + " THING2,\n" + + "} Thinger;\n" + + "or me!!\n" + + assert_equal(["don't delete me!! or me!!"], @parser.import_source(source).map!{|s|s.strip}) + end + + + should "remove union statements" do + source = + "union _NamedDoohicky {\n" + + " unsigned int a;\n" + + " char b;\n" + + "} Doohicky;\n\n" + + "I want to live!!\n" + + "some_modifier union { unsigned int a; char b;} Whatever;\n" + + "typedef union {\n" + + " unsigned int a;\n" + + " char b;\n" + + "} Whatever;\n" + + "me too!!\n" + + assert_equal(["I want to live!! me too!!"], @parser.import_source(source).map!{|s|s.strip}) + end + + + should "remove struct statements" do + source = + "struct _NamedStruct1 {\n" + + " unsigned int a;\n" + + " signed long int b;\n" + + "} Thing ;\n\n" + + "extern struct ForwardDeclared_t TestDataType1;\n" + + "void foo(void);\n" + + "struct\n"+ + " MultilineForwardDeclared_t\n" + + " TestDataType2;\n" + + "struct THINGER foo(void);\n" + + "typedef struct {\n" + + " unsigned int a;\n" + + " signed char b;\n" + + "}Thinger;\n" + + "I want to live!!\n" + + assert_equal(["void foo(void)", "struct THINGER foo(void)", "I want to live!!"], + @parser.import_source(source).map!{|s|s.strip}) + end + + should "remove externed and inline functions" do + source = + " extern uint32 foobar(unsigned int);\n" + + "uint32 extern_name_func(unsigned int);\n" + + "uint32 funcinline(unsigned int);\n" + + "extern void bar(unsigned int);\n" + + "inline void bar(unsigned int);\n" + + "extern\n" + + "void kinda_ugly_on_the_next_line(unsigned int);\n" + + expected = + [ + "uint32 extern_name_func(unsigned int)", + "uint32 funcinline(unsigned int)" + ] + + assert_equal(expected, @parser.import_source(source).map!{|s|s.strip}) + end + + should "remove a fully defined inline function" do + source = + "inline void foo(unsigned int a) { oranges = a; }\n" + + "inline void bar(unsigned int a) { apples = a; };\n" + + "inline void bar(unsigned int a)\n" + + "{" + + " bananas = a;\n" + + "}" + + # ensure it's expected type of exception + assert_raise RuntimeError do + @parser.parse("module", source) + end + + assert_equal([], @parser.funcs) + + # verify exception message + begin + @parser.parse("module", source) + rescue RuntimeError => e + assert_equal("ERROR: No function prototypes found!", e.message) + end + end + + should "remove just inline functions if externs to be included" do + source = + " extern uint32 foobar(unsigned int);\n" + + "uint32 extern_name_func(unsigned int);\n" + + "uint32 funcinline(unsigned int);\n" + + "extern void bar(unsigned int);\n" + + "inline void bar(unsigned int);\n" + + "extern\n" + + "void kinda_ugly_on_the_next_line(unsigned int);\n" + + expected = + [ "extern uint32 foobar(unsigned int)", + "uint32 extern_name_func(unsigned int)", + "uint32 funcinline(unsigned int)", + "extern void bar(unsigned int)", + "extern void kinda_ugly_on_the_next_line(unsigned int)" + ] + + @parser.treat_externs = :include + assert_equal(expected, @parser.import_source(source).map!{|s|s.strip}) + end + + + should "remove defines" do + source = + "#define whatever you feel like defining\n" + + "void hello(void);\n" + + "#DEFINE I JUST DON'T CARE\n" + + "#deFINE\n" + + "#define get_foo() \\\n ((Thing)foo.bar)" # exercise multiline define + + expected = + [ + "void hello(void)", + ] + + assert_equal(expected, @parser.import_source(source).map!{|s|s.strip}) + end + + + should "remove keywords that would keep things from going smoothly in the future" do + source = + "const int TheMatrix(register int Trinity, unsigned int *restrict Neo)" + + expected = + [ + "const int TheMatrix(int Trinity, unsigned int * Neo)", + ] + + assert_equal(expected, @parser.import_source(source).map!{|s|s.strip}) + end + + + # some code actually typedef's void even though it's not ANSI C and is, frankly, weird + # since cmock treats void specially, we can't let void be obfuscated + should "handle odd case of typedef'd void returned" do + source = "MY_FUNKY_VOID FunkyVoidReturned(int a)" + expected = { :var_arg=>nil, + :name=>"FunkyVoidReturned", + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :modifier=>"", + :contains_ptr? => false, + :args=>[{:type=>"int", :name=>"a", :ptr? => false, :const? => false}], + :args_string=>"int a", + :args_call=>"a"} + assert_equal(expected, @parser.parse_declaration(source)) + end + + should "handle odd case of typedef'd void as arg" do + source = "int FunkyVoidAsArg(MY_FUNKY_VOID)" + expected = { :var_arg=>nil, + :name=>"FunkyVoidAsArg", + :return=>{ :type => "int", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "int cmock_to_return", + :void? => false + }, + :modifier=>"", + :contains_ptr? => false, + :args=>[], + :args_string=>"void", + :args_call=>"" } + assert_equal(expected, @parser.parse_declaration(source)) + end + + should "handle odd case of typedef'd void as arg pointer" do + source = "char FunkyVoidPointer(MY_FUNKY_VOID* bluh)" + expected = { :var_arg=>nil, + :name=>"FunkyVoidPointer", + :return=>{ :type => "char", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "char cmock_to_return", + :void? => false + }, + :modifier=>"", + :contains_ptr? => true, + :args=>[{:type=>"MY_FUNKY_VOID*", :name=>"bluh", :ptr? => true, :const? => false}], + :args_string=>"MY_FUNKY_VOID* bluh", + :args_call=>"bluh" } + assert_equal(expected, @parser.parse_declaration(source)) + end + + + should "strip default values from function parameter lists" do + source = + "void Foo(int a = 57, float b=37.52, char c= 'd', char* e=\"junk\");\n" + + expected = + [ + "void Foo(int a, float b, char c, char* e)" + ] + + assert_equal(expected, @parser.import_source(source).map!{|s|s.strip}) + end + + + should "raise upon empty file" do + source = '' + + # ensure it's expected type of exception + assert_raise RuntimeError do + @parser.parse("module", "") + end + + assert_equal([], @parser.funcs) + + # verify exception message + begin + @parser.parse("module", "") + rescue RuntimeError => e + assert_equal("ERROR: No function prototypes found!", e.message) + end + end + + + should "raise upon no function prototypes found in file" do + source = + "typedef void SILLY_VOID_TYPE1;\n" + + "typedef (void) SILLY_VOID_TYPE2 ;\n" + + "typedef ( void ) (*FUNCPTR)(void);\n\n" + + "#define get_foo() \\\n ((Thing)foo.bar)" + + # ensure it's expected type of exception + assert_raise(RuntimeError) do + @parser.parse("module", source) + end + + assert_equal([], @parser.funcs) + + # verify exception message + begin + @parser.parse("module", source) + rescue RuntimeError => e + assert_equal("ERROR: No function prototypes found!", e.message) + end + end + + + should "raise upon prototype parsing failure" do + source = "void (int, )" + + # ensure it's expected type of exception + assert_raise(RuntimeError) do + @parser.parse("module", source) + end + + # verify exception message + begin + @parser.parse("module", source) + rescue RuntimeError => e + assert(e.message.include?("Failed Parsing Declaration Prototype!")) + end + end + + should "extract and return function declarations with retval and args" do + + source = "int Foo(int a, unsigned int b)" + expected = { :var_arg=>nil, + :name=>"Foo", + :return=>{ :type => "int", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "int cmock_to_return", + :void? => false + }, + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"int", :name=>"a", :ptr? => false, :const? => false}, + {:type=>"unsigned int", :name=>"b", :ptr? => false, :const? => false} + ], + :args_string=>"int a, unsigned int b", + :args_call=>"a, b" } + assert_equal(expected, @parser.parse_declaration(source)) + end + + should "extract and return function declarations with no retval" do + + source = "void FunkyChicken( uint la, int de, bool da)" + expected = { :var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"FunkyChicken", + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"uint", :name=>"la", :ptr? => false, :const? => false}, + {:type=>"int", :name=>"de", :ptr? => false, :const? => false}, + {:type=>"bool", :name=>"da", :ptr? => false, :const? => false} + ], + :args_string=>"uint la, int de, bool da", + :args_call=>"la, de, da" } + assert_equal(expected, @parser.parse_declaration(source)) + end + + should "extract and return function declarations with implied voids" do + + source = "void tat()" + expected = { :var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"tat", + :modifier=>"", + :contains_ptr? => false, + :args=>[ ], + :args_string=>"void", + :args_call=>"" } + assert_equal(expected, @parser.parse_declaration(source)) + end + + should "extract modifiers properly" do + + source = "const int TheMatrix(int Trinity, unsigned int * Neo)" + expected = { :var_arg=>nil, + :return=>{ :type => "int", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "int cmock_to_return", + :void? => false + }, + :name=>"TheMatrix", + :modifier=>"const", + :contains_ptr? => true, + :args=>[ {:type=>"int", :name=>"Trinity", :ptr? => false, :const? => false}, + {:type=>"unsigned int*", :name=>"Neo", :ptr? => true, :const? => false} + ], + :args_string=>"int Trinity, unsigned int* Neo", + :args_call=>"Trinity, Neo" } + assert_equal(expected, @parser.parse_declaration(source)) + end + + should "fully parse multiple prototypes" do + + source = "const int TheMatrix(int Trinity, unsigned int * Neo);\n" + + "int Morpheus(int, unsigned int*);\n" + + expected = [{ :var_arg=>nil, + :return=> { :type => "int", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "int cmock_to_return", + :void? => false + }, + :name=>"TheMatrix", + :modifier=>"const", + :contains_ptr? => true, + :args=>[ {:type=>"int", :name=>"Trinity", :ptr? => false, :const? => false}, + {:type=>"unsigned int*", :name=>"Neo", :ptr? => true, :const? => false} + ], + :args_string=>"int Trinity, unsigned int* Neo", + :args_call=>"Trinity, Neo" }, + { :var_arg=>nil, + :return=> { :type => "int", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "int cmock_to_return", + :void? => false + }, + :name=>"Morpheus", + :modifier=>"", + :contains_ptr? => true, + :args=>[ {:type=>"int", :name=>"cmock_arg1", :ptr? => false, :const? => false}, + {:type=>"unsigned int*", :name=>"cmock_arg2", :ptr? => true, :const? => false} + ], + :args_string=>"int cmock_arg1, unsigned int* cmock_arg2", + :args_call=>"cmock_arg1, cmock_arg2" + }] + assert_equal(expected, @parser.parse("module", source)[:functions]) + end + + should "not extract for mocking multiply defined prototypes" do + + source = "const int TheMatrix(int Trinity, unsigned int * Neo);\n" + + "const int TheMatrix(int, unsigned int*);\n" + + expected = [{ :var_arg=>nil, + :name=>"TheMatrix", + :return=> { :type => "int", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "int cmock_to_return", + :void? => false + }, + :modifier=>"const", + :contains_ptr? => true, + :args=>[ {:type=>"int", :name=>"Trinity", :ptr? => false, :const? => false}, + {:type=>"unsigned int*", :name=>"Neo", :ptr? => true, :const? => false} + ], + :args_string=>"int Trinity, unsigned int* Neo", + :args_call=>"Trinity, Neo" + }] + assert_equal(expected, @parser.parse("module", source)[:functions]) + end + + should "properly detect typedef'd variants of void and use those" do + + source = "typedef (void) FUNKY_VOID_T;\n" + + "typedef void CHUNKY_VOID_T;\n" + + "FUNKY_VOID_T DrHorrible(int SingAlong);\n" + + "int CaptainHammer(CHUNKY_VOID_T);\n" + + expected = [{ :var_arg=>nil, + :name=>"DrHorrible", + :return => { :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"int", :name=>"SingAlong", :ptr? => false, :const? => false} ], + :args_string=>"int SingAlong", + :args_call=>"SingAlong" + }, + { :var_arg=>nil, + :return=> { :type => "int", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "int cmock_to_return", + :void? => false + }, + :name=>"CaptainHammer", + :modifier=>"", + :contains_ptr? => false, + :args=>[ ], + :args_string=>"void", + :args_call=>"" + }] + assert_equal(expected, @parser.parse("module", source)[:functions]) + end + + should "be ok with structs inside of function declarations" do + + source = "int DrHorrible(struct SingAlong Blog);\n" + + "void Penny(struct const _KeepYourHeadUp_ * const BillyBuddy);\n" + + "struct TheseArentTheHammer CaptainHammer(void);\n" + + expected = [{ :var_arg=>nil, + :return =>{ :type => "int", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "int cmock_to_return", + :void? => false + }, + :name=>"DrHorrible", + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"struct SingAlong", :name=>"Blog", :ptr? => false, :const? => false} ], + :args_string=>"struct SingAlong Blog", + :args_call=>"Blog" + }, + { :var_arg=>nil, + :return=> { :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"Penny", + :modifier=>"", + :contains_ptr? => true, + :args=>[ {:type=>"struct _KeepYourHeadUp_*", :name=>"BillyBuddy", :ptr? => true, :const? => true} ], + :args_string=>"struct const _KeepYourHeadUp_* const BillyBuddy", + :args_call=>"BillyBuddy" + }, + { :var_arg=>nil, + :return=> { :type => "struct TheseArentTheHammer", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "struct TheseArentTheHammer cmock_to_return", + :void? => false + }, + :name=>"CaptainHammer", + :modifier=>"", + :contains_ptr? => false, + :args=>[ ], + :args_string=>"void", + :args_call=>"" + }] + assert_equal(expected, @parser.parse("module", source)[:functions]) + end + + should "extract functions containing unions with union specifier" do + source = "void OrangePeel(union STARS_AND_STRIPES * a, union AFL_CIO b)" + expected = [{ :var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"OrangePeel", + :modifier=>"", + :contains_ptr? => true, + :args=>[ {:type=>"union STARS_AND_STRIPES*", :name=>"a", :ptr? => true, :const? => false}, + {:type=>"union AFL_CIO", :name=>"b", :ptr? => false, :const? => false} + ], + :args_string=>"union STARS_AND_STRIPES* a, union AFL_CIO b", + :args_call=>"a, b" }] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + end + + should "not be thwarted by variables named with primitive types as part of the name" do + source = "void ApplePeel(const unsigned int const_param, int int_param, int integer, char character, int* const constant)" + expected = [{ :var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"ApplePeel", + :modifier=>"", + :contains_ptr? => true, + :args=>[ {:type=> "unsigned int", :name=>"const_param", :ptr? => false, :const? => true}, + {:type=>"int", :name=>"int_param", :ptr? => false, :const? => false}, + {:type=>"int", :name=>"integer", :ptr? => false, :const? => false}, + {:type=>"char", :name=>"character", :ptr? => false, :const? => false}, + {:type=>"int*", :name=>"constant", :ptr? => true, :const? => true} + ], + :args_string=>"const unsigned int const_param, int int_param, int integer, char character, int* const constant", + :args_call=>"const_param, int_param, integer, character, constant" }] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + end + + should "not be thwarted by custom types named similarly to primitive types" do + source = "void LemonPeel(integer param, character thing, longint * junk, constant value, int32_t const number)" + expected = [{:var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"LemonPeel", + :modifier=>"", + :contains_ptr? => true, + :args=>[ {:type=>"integer", :name=>"param", :ptr? => false, :const? => false}, + {:type=>"character", :name=>"thing", :ptr? => false, :const? => false}, + {:type=>"longint*", :name=>"junk", :ptr? => true, :const? => false}, + {:type=>"constant", :name=>"value", :ptr? => false, :const? => false}, + {:type=>"int32_t", :name=>"number", :ptr? => false, :const? => true} + ], + :args_string=>"integer param, character thing, longint* junk, constant value, int32_t const number", + :args_call=>"param, thing, junk, value, number" }] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + end + + should "handle some of those chains of C name specifiers naturally" do + source = "void CoinOperated(signed char abc, const unsigned long int xyz_123, unsigned int const abc_123, long long arm_of_the_law)" + expected = [{:var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"CoinOperated", + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"signed char", :name=>"abc", :ptr? => false, :const? => false}, + {:type=>"unsigned long int", :name=>"xyz_123", :ptr? => false, :const? => true}, + {:type=>"unsigned int", :name=>"abc_123", :ptr? => false, :const? => true}, + {:type=>"long long", :name=>"arm_of_the_law", :ptr? => false, :const? => false} + ], + :args_string=>"signed char abc, const unsigned long int xyz_123, unsigned int const abc_123, long long arm_of_the_law", + :args_call=>"abc, xyz_123, abc_123, arm_of_the_law" }] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + end + + should "handle custom types of various formats" do + source = "void CardOperated(CUSTOM_TYPE abc, CUSTOM_TYPE* xyz_123, CUSTOM_TYPE const abcxyz, struct CUSTOM_TYPE const * const abc123)" + expected = [{:var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"CardOperated", + :modifier=>"", + :contains_ptr? => true, + :args=>[ {:type=>"CUSTOM_TYPE", :name=>"abc", :ptr? => false, :const? => false}, + {:type=>"CUSTOM_TYPE*", :name=>"xyz_123", :ptr? => true, :const? => false}, + {:type=>"CUSTOM_TYPE", :name=>"abcxyz", :ptr? => false, :const? => true}, + {:type=>"struct CUSTOM_TYPE const*", :name=>"abc123", :ptr? => true, :const? => true} + ], + :args_string=>"CUSTOM_TYPE abc, CUSTOM_TYPE* xyz_123, CUSTOM_TYPE const abcxyz, struct CUSTOM_TYPE const* const abc123", + :args_call=>"abc, xyz_123, abcxyz, abc123" }] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + end + + should "handle arrays and treat them as pointers" do + source = "void KeyOperated(CUSTOM_TYPE thing1[], int thing2 [ ], char thing3 [][2 ][ 3], int* thing4[4])" + expected = [{:var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"KeyOperated", + :modifier=>"", + :contains_ptr? => true, + :args=>[ {:type=>"CUSTOM_TYPE*", :name=>"thing1", :ptr? => true, :const? => false}, + {:type=>"int*", :name=>"thing2", :ptr? => true, :const? => false}, + {:type=>"char*", :name=>"thing3", :ptr? => false, :const? => false}, #THIS one will likely change in the future when we improve multidimensional array support + {:type=>"int**", :name=>"thing4", :ptr? => true, :const? => false} #THIS one will likely change in the future when we improve multidimensional array support + ], + :args_string=>"CUSTOM_TYPE* thing1, int* thing2, char* thing3, int** thing4", + :args_call=>"thing1, thing2, thing3, thing4" }] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + end + + should "give a reasonable guess when dealing with weird combinations of custom types and modifiers" do + source = "void Cheese(unsigned CUSTOM_TYPE abc, unsigned xyz, CUSTOM_TYPE1 CUSTOM_TYPE2 pdq)" + expected = [{:var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"Cheese", + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"unsigned CUSTOM_TYPE", :name=>"abc", :ptr? => false, :const? => false}, + {:type=>"unsigned", :name=>"xyz", :ptr? => false, :const? => false}, + {:type=>"CUSTOM_TYPE1 CUSTOM_TYPE2", :name=>"pdq", :ptr? => false, :const? => false} + ], + :args_string=>"unsigned CUSTOM_TYPE abc, unsigned xyz, CUSTOM_TYPE1 CUSTOM_TYPE2 pdq", + :args_call=>"abc, xyz, pdq" }] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + end + + should "extract functions containing a function pointer" do + source = "void FunkyTurkey(unsigned int (*func_ptr)(int, char))" + expected = [{ :var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"FunkyTurkey", + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"cmock_module_func_ptr1", :name=>"func_ptr", :ptr? => false, :const? => false} + ], + :args_string=>"cmock_module_func_ptr1 func_ptr", + :args_call=>"func_ptr" }] + typedefs = ["typedef unsigned int(*cmock_module_func_ptr1)(int, char);"] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + assert_equal(typedefs, result[:typedefs]) + end + + should "extract functions containing a function pointer with an implied void" do + source = "void FunkyTurkey(unsigned int (*func_ptr)())" + expected = [{ :var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"FunkyTurkey", + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"cmock_module_func_ptr1", :name=>"func_ptr", :ptr? => false, :const? => false} + ], + :args_string=>"cmock_module_func_ptr1 func_ptr", + :args_call=>"func_ptr" }] + typedefs = ["typedef unsigned int(*cmock_module_func_ptr1)();"] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + assert_equal(typedefs, result[:typedefs]) + end + + should "extract functions containing a constant function pointer and a pointer in the nested arg list" do + source = "void FunkyChicken(unsigned int (* const func_ptr)(unsigned long int * , char))" + expected = [{ :var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"FunkyChicken", + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"cmock_module_func_ptr1", :name=>"func_ptr", :ptr? => false, :const? => true} + ], + :args_string=>"cmock_module_func_ptr1 const func_ptr", + :args_call=>"func_ptr" }] + typedefs = ["typedef unsigned int(*cmock_module_func_ptr1)(unsigned long int* , char);"] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + assert_equal(typedefs, result[:typedefs]) + end + + # should "extract functions containing a function pointer taking a vararg" do + # source = "void FunkyParrot(unsigned int (*func_ptr)(int, char, ...))" + # expected = [{ :var_arg=>nil, + # :return=>{ :type => "void", + # :name => 'cmock_to_return', + # :ptr? => false, + # :const? => false, + # :str => "void cmock_to_return", + # :void? => true + # }, + # :name=>"FunkyParrot", + # :modifier=>"", + # :contains_ptr? => false, + # :args=>[ {:type=>"cmock_module_func_ptr1", :name=>"func_ptr", :ptr? => false, :const? => false} + # ], + # :args_string=>"cmock_module_func_ptr1 func_ptr", + # :args_call=>"func_ptr" }] + # typedefs = ["typedef unsigned int(*cmock_module_func_ptr1)(int, char, ...);"] + # result = @parser.parse("module", source) + # assert_equal(expected, result[:functions]) + # assert_equal(typedefs, result[:typedefs]) + # end + + should "extract functions containing a function pointer with extra parenthesis and two sets" do + source = "void FunkyBudgie(int (((* func_ptr1)(int, char))), void (*func_ptr2)(void))" + expected = [{ :var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"FunkyBudgie", + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"cmock_module_func_ptr1", :name=>"func_ptr1", :ptr? => false, :const? => false}, + {:type=>"cmock_module_func_ptr2", :name=>"func_ptr2", :ptr? => false, :const? => false} + ], + :args_string=>"cmock_module_func_ptr1 func_ptr1, cmock_module_func_ptr2 func_ptr2", + :args_call=>"func_ptr1, func_ptr2" }] + typedefs = ["typedef int(*cmock_module_func_ptr1)(int, char);", "typedef void(*cmock_module_func_ptr2)(void);"] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + assert_equal(typedefs, result[:typedefs]) + end + + should "extract functions containing an anonymous function pointer" do + source = "void FunkyFowl(unsigned int (* const)(int, char))" + expected = [{ :var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"FunkyFowl", + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"cmock_module_func_ptr1", :name=>"cmock_arg1", :ptr? => false, :const? => true} + ], + :args_string=>"cmock_module_func_ptr1 const cmock_arg1", + :args_call=>"cmock_arg1" }] + typedefs = ["typedef unsigned int(*cmock_module_func_ptr1)(int, char);"] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + assert_equal(typedefs, result[:typedefs]) + end + + should "extract functions returning a function pointer" do + source = "unsigned short (*FunkyPidgeon( const char op_code ))( int, long int )" + expected = [{ :var_arg=>nil, + :return=>{ :type => "cmock_module_func_ptr1", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "cmock_module_func_ptr1 cmock_to_return", + :void? => false + }, + :name=>"FunkyPidgeon", + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"char", :name=>"op_code", :ptr? => false, :const? => true} + ], + :args_string=>"const char op_code", + :args_call=>"op_code" }] + typedefs = ["typedef unsigned short(*cmock_module_func_ptr1)( int, long int );"] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + assert_equal(typedefs, result[:typedefs]) + end + + should "extract functions returning a function pointer with implied void" do + source = "unsigned short (*FunkyTweetie())()" + expected = [{ :var_arg=>nil, + :return=>{ :type => "cmock_module_func_ptr1", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "cmock_module_func_ptr1 cmock_to_return", + :void? => false + }, + :name=>"FunkyTweetie", + :modifier=>"", + :contains_ptr? => false, + :args=>[], + :args_string=>"void", + :args_call=>"" }] + typedefs = ["typedef unsigned short(*cmock_module_func_ptr1)();"] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + assert_equal(typedefs, result[:typedefs]) + end + + should "extract functions returning a function pointer where everything is a void" do + source = "void (* FunkySeaGull(void))(void)" + expected = [{ :var_arg=>nil, + :return=>{ :type => "cmock_module_func_ptr1", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "cmock_module_func_ptr1 cmock_to_return", + :void? => false + }, + :name=>"FunkySeaGull", + :modifier=>"", + :contains_ptr? => false, + :args=>[], + :args_string=>"void", + :args_call=>"" }] + typedefs = ["typedef void(*cmock_module_func_ptr1)(void);"] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + assert_equal(typedefs, result[:typedefs]) + end + + should "extract functions returning a function pointer with some pointer nonsense" do + source = "unsigned int * (* FunkyMacaw(double* foo, THING *bar))(unsigned int)" + expected = [{ :var_arg=>nil, + :return=>{ :type => "cmock_module_func_ptr1", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "cmock_module_func_ptr1 cmock_to_return", + :void? => false + }, + :name=>"FunkyMacaw", + :modifier=>"", + :contains_ptr? => true, + :args=>[ {:type=>"double*", :name=>"foo", :ptr? => true, :const? => false}, + {:type=>"THING*", :name=>"bar", :ptr? => true, :const? => false} + ], + :args_string=>"double* foo, THING* bar", + :args_call=>"foo, bar" }] + typedefs = ["typedef unsigned int *(*cmock_module_func_ptr1)(unsigned int);"] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + assert_equal(typedefs, result[:typedefs]) + end + + should "extract functions with varargs" do + source = "int XFiles(int Scully, int Mulder, ...);\n" + expected = [{ :var_arg=>"...", + :return=> { :type => "int", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "int cmock_to_return", + :void? => false + }, + :name=>"XFiles", + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"int", :name=>"Scully", :ptr? => false, :const? => false}, + {:type=>"int", :name=>"Mulder", :ptr? => false, :const? => false} + ], + :args_string=>"int Scully, int Mulder", + :args_call=>"Scully, Mulder" + }] + assert_equal(expected, @parser.parse("module", source)[:functions]) + end + + should "extract functions with strippable confusing junk like gcc attributes" do + source = "int LaverneAndShirley(int Lenny, int Squiggy) __attribute__((weak)) __attribute__ ((deprecated));\n" + expected = [{ :var_arg=>nil, + :return=> { :type => "int", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "int cmock_to_return", + :void? => false + }, + :name=>"LaverneAndShirley", + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"int", :name=>"Lenny", :ptr? => false, :const? => false}, + {:type=>"int", :name=>"Squiggy", :ptr? => false, :const? => false} + ], + :args_string=>"int Lenny, int Squiggy", + :args_call=>"Lenny, Squiggy" + }] + assert_equal(expected, @parser.parse("module", source)[:functions]) + end + + should "extract functions with strippable confusing junk like gcc attributes with parenthesis" do + source = "int TheCosbyShow(int Cliff, int Claire) __attribute__((weak, alias (\"__f\"));\n" + expected = [{ :var_arg=>nil, + :return=> { :type => "int", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "int cmock_to_return", + :void? => false + }, + :name=>"TheCosbyShow", + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"int", :name=>"Cliff", :ptr? => false, :const? => false}, + {:type=>"int", :name=>"Claire", :ptr? => false, :const? => false} + ], + :args_string=>"int Cliff, int Claire", + :args_call=>"Cliff, Claire" + }] + assert_equal(expected, @parser.parse("module", source)[:functions]) + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/unit/cmock_plugin_manager_test.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/unit/cmock_plugin_manager_test.rb new file mode 100644 index 0000000..88b4e6b --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/unit/cmock_plugin_manager_test.rb @@ -0,0 +1,85 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require File.expand_path(File.dirname(__FILE__)) + "/../test_helper" +require 'cmock_plugin_manager' + +class CMockPluginManagerTest < Test::Unit::TestCase + def setup + create_mocks :config, :utils, :pluginA, :pluginB + @config.stubs!(:respond_to?).returns(true) + @config.stubs!(:when_ptr).returns(:compare_data) + @config.stubs!(:enforce_strict_ordering).returns(false) + @config.stubs!(:ignore).returns(:args_and_calls) + end + + def teardown + end + + should "return all plugins by default" do + @config.expect.plugins.returns(['cexception','ignore']) + @utils.expect.helpers.returns({}) + + @cmock_plugins = CMockPluginManager.new(@config, @utils) + + test_plugins = @cmock_plugins.plugins + contained = { :expect => false, :ignore => false, :cexception => false } + test_plugins.each do |plugin| + contained[:expect] = true if plugin.instance_of?(CMockGeneratorPluginExpect) + contained[:ignore] = true if plugin.instance_of?(CMockGeneratorPluginIgnore) + contained[:cexception] = true if plugin.instance_of?(CMockGeneratorPluginCexception) + end + assert_equal(true, contained[:expect]) + assert_equal(true, contained[:ignore]) + assert_equal(true, contained[:cexception]) + end + + should "return restricted plugins based on config" do + @config.expect.plugins.returns([]) + @utils.expect.helpers.returns({}) + + @cmock_plugins = CMockPluginManager.new(@config, @utils) + + test_plugins = @cmock_plugins.plugins + contained = { :expect => false, :ignore => false, :cexception => false } + test_plugins.each do |plugin| + contained[:expect] = true if plugin.instance_of?(CMockGeneratorPluginExpect) + contained[:ignore] = true if plugin.instance_of?(CMockGeneratorPluginIgnore) + contained[:cexception] = true if plugin.instance_of?(CMockGeneratorPluginCexception) + end + assert_equal(true, contained[:expect]) + assert_equal(false,contained[:ignore]) + assert_equal(false,contained[:cexception]) + end + + should "run a desired method over each plugin requested and return the results" do + @config.expect.plugins.returns([]) + @utils.expect.helpers.returns({}) + @cmock_plugins = CMockPluginManager.new(@config, @utils) + + @cmock_plugins.plugins = [@pluginA, @pluginB] + @pluginA.stubs!(:test_method).returns(["This Is An Awesome Test-"]) + @pluginB.stubs!(:test_method).returns(["And This is Part 2-","Of An Awesome Test"]) + + expected = "This Is An Awesome Test-And This is Part 2-Of An Awesome Test" + output = @cmock_plugins.run(:test_method) + assert_equal(expected, output) + end + + should "run a desired method and arg list over each plugin requested and return the results" do + @config.expect.plugins.returns([]) + @utils.expect.helpers.returns({}) + @cmock_plugins = CMockPluginManager.new(@config, @utils) + + @cmock_plugins.plugins = [@pluginA, @pluginB] + @pluginA.stubs!(:test_method).returns(["This Is An Awesome Test-"]) + @pluginB.stubs!(:test_method).returns(["And This is Part 2-","Of An Awesome Test"]) + + expected = "This Is An Awesome Test-And This is Part 2-Of An Awesome Test" + output = @cmock_plugins.run(:test_method, "chickenpotpie") + assert_equal(expected, output) + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/unit/cmock_unityhelper_parser_test.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/unit/cmock_unityhelper_parser_test.rb new file mode 100644 index 0000000..3af5762 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/test/unit/cmock_unityhelper_parser_test.rb @@ -0,0 +1,223 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require File.expand_path(File.dirname(__FILE__)) + "/../test_helper" +require 'cmock_unityhelper_parser' + +class CMockUnityHelperParserTest < Test::Unit::TestCase + + def setup + create_mocks :config + end + + def teardown + end + + should "ignore lines that are commented out" do + source = + " abcd;\n" + + "// #define UNITY_TEST_ASSERT_EQUAL_CHICKENS(a,b,line,msg) {...};\n" + + "or maybe // #define UNITY_TEST_ASSERT_EQUAL_CHICKENS(a,b,line,msg) {...};\n\n" + @config.expects.plugins.returns([]) #not :array + @config.expects.treat_as.returns({}) + @config.expects.load_unity_helper.returns(source) + @parser = CMockUnityHelperParser.new(@config) + expected = {} + + assert_equal(expected, @parser.c_types) + end + + should "ignore stuff in block comments" do + source = + " abcd; /*\n" + + "#define UNITY_TEST_ASSERT_EQUAL_CHICKENS(a,b,line,msg) {...};\n" + + "#define UNITY_TEST_ASSERT_EQUAL_CHICKENS(a,b,line,msg) {...};\n */\n" + @config.expects.plugins.returns([]) #not :array + @config.expects.treat_as.returns({}) + @config.expect.load_unity_helper.returns(source) + @parser = CMockUnityHelperParser.new(@config) + expected = {} + + assert_equal(expected, @parser.c_types) + end + + should "notice equal helpers in the proper form and ignore others" do + source = + "abcd;\n" + + "#define UNITY_TEST_ASSERT_EQUAL_TURKEYS_T(a,b,line,msg) {...};\n" + + "abcd;\n" + + "#define UNITY_TEST_ASSERT_EQUAL_WRONG_NUM_ARGS(a,b,c,d,e) {...};\n" + + "#define UNITY_TEST_ASSERT_WRONG_NAME_EQUAL(a,b,c,d) {...};\n" + + "#define UNITY_TEST_ASSERT_EQUAL_unsigned_funky_rabbits(a,b,c,d) {...};\n" + + "abcd;\n" + @config.expects.plugins.returns([]) #not :array + @config.expects.treat_as.returns({}) + @config.expect.load_unity_helper.returns(source) + @parser = CMockUnityHelperParser.new(@config) + expected = { + 'TURKEYS_T' => "UNITY_TEST_ASSERT_EQUAL_TURKEYS_T", + 'unsigned_funky_rabbits' => "UNITY_TEST_ASSERT_EQUAL_unsigned_funky_rabbits" + } + + assert_equal(expected, @parser.c_types) + end + + should "notice equal helpers that contain arrays" do + source = + "abcd;\n" + + "#define UNITY_TEST_ASSERT_EQUAL_TURKEYS_ARRAY(a,b,c,d,e) {...};\n" + + "abcd;\n" + + "#define UNITY_TEST_ASSERT_EQUAL_WRONG_NUM_ARGS_ARRAY(a,b,c,d,e,f) {...};\n" + + "#define UNITY_TEST_ASSERT_WRONG_NAME_EQUAL_ARRAY(a,b,c,d,e) {...};\n" + + "#define UNITY_TEST_ASSERT_EQUAL_unsigned_funky_rabbits_ARRAY(a,b,c,d,e) {...};\n" + + "abcd;\n" + @config.expects.plugins.returns([]) #not :array + @config.expects.treat_as.returns({}) + @config.expect.load_unity_helper.returns(source) + @parser = CMockUnityHelperParser.new(@config) + expected = { + 'TURKEYS*' => "UNITY_TEST_ASSERT_EQUAL_TURKEYS_ARRAY", + 'unsigned_funky_rabbits*' => "UNITY_TEST_ASSERT_EQUAL_unsigned_funky_rabbits_ARRAY" + } + + assert_equal(expected, @parser.c_types) + end + + should "pull in the standard set of helpers and add them to my list" do + pairs = { + "UINT" => "HEX32", + "unsigned long" => "HEX64", + } + expected = { + "UINT" => "UNITY_TEST_ASSERT_EQUAL_HEX32", + "unsigned_long" => "UNITY_TEST_ASSERT_EQUAL_HEX64", + "UINT*" => "UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY", + "unsigned_long*"=> "UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY", + } + @config.expects.plugins.returns([]) #not :array + @config.expects.treat_as.returns(pairs) + @config.expect.load_unity_helper.returns(nil) + @parser = CMockUnityHelperParser.new(@config) + + assert_equal(expected, @parser.c_types) + end + + should "pull in the user specified set of helpers and add them to my list" do + pairs = { + "char*" => "STRING", + "unsigned int" => "HEX32", + } + expected = { + "char*" => "UNITY_TEST_ASSERT_EQUAL_STRING", + "unsigned_int" => "UNITY_TEST_ASSERT_EQUAL_HEX32", + "char**" => "UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY", + "unsigned_int*" => "UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY", + } + @config.expects.plugins.returns([]) #not :array + @config.expects.treat_as.returns(pairs) + @config.expect.load_unity_helper.returns(nil) + @parser = CMockUnityHelperParser.new(@config) + + assert_equal(expected, @parser.c_types) + end + + should "be able to fetch helpers on my list" do + @config.expects.plugins.returns([]) #not :array + @config.expects.treat_as.returns({}) + @config.expect.load_unity_helper.returns("") + @parser = CMockUnityHelperParser.new(@config) + @parser.c_types = { + 'UINT8' => "UNITY_TEST_ASSERT_EQUAL_UINT8", + 'UINT16*' => "UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY", + 'SPINACH' => "UNITY_TEST_ASSERT_EQUAL_SPINACH", + 'LONG_LONG' => "UNITY_TEST_ASSERT_EQUAL_LONG_LONG" + } + + [["UINT8","UINT8"], + ["UINT16*","UINT16_ARRAY"], + ["const SPINACH","SPINACH"], + ["LONG LONG","LONG_LONG"] ].each do |ctype, exptype| + assert_equal(["UNITY_TEST_ASSERT_EQUAL_#{exptype}",''], @parser.get_helper(ctype)) + end + end + + should "return memory comparison when asked to fetch helper of types not on my list" do + @config.expects.plugins.returns([]) #not :array + @config.expects.treat_as.returns({}) + @config.expects.load_unity_helper.returns("") + @parser = CMockUnityHelperParser.new(@config) + @parser.c_types = { + 'UINT8' => "UNITY_TEST_ASSERT_EQUAL_UINT8", + 'UINT16*' => "UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY", + 'SPINACH' => "UNITY_TEST_ASSERT_EQUAL_SPINACH", + } + + ["UINT32","SPINACH_T","SALAD","PINEAPPLE"].each do |ctype| + @config.expect.memcmp_if_unknown.returns(true) + assert_equal(["UNITY_TEST_ASSERT_EQUAL_MEMORY",'&'], @parser.get_helper(ctype)) + end + end + + should "return memory array comparison when asked to fetch helper of types not on my list" do + @config.expects.plugins.returns([:array]) + @config.expects.treat_as.returns({}) + @config.expects.load_unity_helper.returns("") + @parser = CMockUnityHelperParser.new(@config) + @parser.c_types = { + 'UINT8' => "UNITY_TEST_ASSERT_EQUAL_UINT8", + 'UINT16*' => "UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY", + 'SPINACH' => "UNITY_TEST_ASSERT_EQUAL_SPINACH", + } + + ["UINT32*","SPINACH_T*"].each do |ctype| + @config.expect.memcmp_if_unknown.returns(true) + assert_equal(["UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY",''], @parser.get_helper(ctype)) + end + end + + should "return the array handler if we cannot find the normal handler" do + @config.expects.plugins.returns([]) #not :array + @config.expects.treat_as.returns({}) + @config.expect.load_unity_helper.returns("") + @parser = CMockUnityHelperParser.new(@config) + @parser.c_types = { + 'UINT8' => "UNITY_TEST_ASSERT_EQUAL_UINT8", + 'UINT16*' => "UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY", + 'SPINACH' => "UNITY_TEST_ASSERT_EQUAL_SPINACH", + } + + assert_equal(["UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY",'&'], @parser.get_helper("UINT16")) + end + + should "return the normal handler if we cannot find the array handler" do + @config.expects.plugins.returns([]) #not :array + @config.expects.treat_as.returns({}) + @config.expect.load_unity_helper.returns("") + @parser = CMockUnityHelperParser.new(@config) + @parser.c_types = { + 'UINT8' => "UNITY_TEST_ASSERT_EQUAL_UINT8", + 'UINT16' => "UNITY_TEST_ASSERT_EQUAL_UINT16", + 'SPINACH' => "UNITY_TEST_ASSERT_EQUAL_SPINACH", + } + + assert_equal(["UNITY_TEST_ASSERT_EQUAL_UINT8",'*'], @parser.get_helper("UINT8*")) + end + + should "raise error when asked to fetch helper of type not on my list and not allowed to mem check" do + @config.expects.plugins.returns([]) #not :array + @config.expects.treat_as.returns({}) + @config.expect.load_unity_helper.returns("") + @config.expect.memcmp_if_unknown.returns(false) + @parser = CMockUnityHelperParser.new(@config) + @parser.c_types = { + 'UINT8' => "UNITY_TEST_ASSERT_EQUAL_UINT8", + 'UINT32*' => "UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY", + 'SPINACH' => "UNITY_TEST_ASSERT_EQUAL_SPINACH", + } + + assert_raise(RuntimeError) { @parser.get_helper("UINT16") } + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/behaviors/Manifest.txt b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/behaviors/Manifest.txt new file mode 100644 index 0000000..6c954ec --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/behaviors/Manifest.txt @@ -0,0 +1,9 @@ +Manifest.txt +Rakefile +lib/behaviors.rb +lib/behaviors/reporttask.rb +test/behaviors_tasks_test.rb +test/behaviors_test.rb +test/tasks_test/lib/user.rb +test/tasks_test/Rakefile +test/tasks_test/test/user_test.rb diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/behaviors/Rakefile b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/behaviors/Rakefile new file mode 100644 index 0000000..d4d68b9 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/behaviors/Rakefile @@ -0,0 +1,19 @@ +require 'rake' +require 'rubygems' +require 'hoe' + +Hoe.new('behaviors','1.0.3') do |p| + p.author = "Atomic Object LLC" + p.email = "dev@atomicobject.com" + p.url = "http://behaviors.rubyforge.org" + p.summary = "behavior-driven unit test helper" + p.description = <<-EOS +Behaviors allows for Test::Unit test case methods to be defined as +human-readable descriptions of program behavior. It also provides +Rake tasks to list the behaviors of your project. + EOS + p.test_globs = ['test/*_test.rb'] + + p.changes = <<-EOS + EOS +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/behaviors/lib/behaviors.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/behaviors/lib/behaviors.rb new file mode 100644 index 0000000..d8d70f7 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/behaviors/lib/behaviors.rb @@ -0,0 +1,76 @@ +=begin rdoc += Usage +Behaviors provides a single method: should. + +Instead of naming test methods like: + + def test_something + end + +You declare test methods like: + + should "perform action" do + end + +You may omit the body of a should method to describe unimplemented behavior. + + should "perform other action" + +When you run your unit tests, empty should methods will appear as an 'UNIMPLEMENTED CASE' along with the described behavior. +This is useful for sketching out planned behavior quickly. + +Simply extend Behaviors in your TestCase to start using behaviors. + + require 'test/unit' + require 'behaviors' + require 'user' + + class UserTest < Test::Unit::TestCase + extend Behaviors + ... + end + += Motivation +Test methods typically focus on the name of the method under test instead of its behavior. +Creating test methods with should statements focuses on the behavior of an object. +This helps you to think about the role of the object under test. + +Using a behavior-driven approach prevents the danger in assuming a one-to-one mapping of method names to +test method names. +As always, you get the most value by writing the tests first. + +For a more complete BDD framework, try RSpec http://rspec.rubyforge.org/ + += Rake tasks + +You can define a Behaviors::ReportTask in your Rakefile to generate rake tasks that +summarize the behavior of your project. + +These tasks are named behaviors and behaviors_html. They will output to the +console or an html file in the doc directory with a list all of your should tests. + Behaviors::ReportTask.new do |t| + t.pattern = 'test/**/*_test.rb' + end + +You may also initialize the ReportTask with a custom name to associate with a particular suite of tests. + Behaviors::ReportTask.new(:widget_subsystem) do |t| + t.pattern = 'test/widgets/*_test.rb' + end + +The html report will be placed in the doc directory by default. +You can override this default by setting the html_dir in the ReportTask. + Behaviors::ReportTask.new do |t| + t.pattern = 'test/**/*_test.rb' + t.html_dir = 'behaviors_html_reports' + end +=end +module Behaviors + def should(behave,&block) + mname = "test_should_#{behave}" + if block + define_method mname, &block + else + puts ">>> UNIMPLEMENTED CASE: #{name.sub(/Test$/,'')} should #{behave}" + end + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/behaviors/lib/behaviors/reporttask.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/behaviors/lib/behaviors/reporttask.rb new file mode 100644 index 0000000..51c0eca --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/behaviors/lib/behaviors/reporttask.rb @@ -0,0 +1,158 @@ +require 'rake' +require 'rake/tasklib' + +module Behaviors +include Rake + + class ReportTask < TaskLib + attr_accessor :pattern + attr_accessor :html_dir + + def initialize(name=:behaviors) + @name = name + @html_dir = 'doc' + yield self if block_given? + define + end + + def define + desc "List behavioral definitions for the classes specified (use for= to further limit files included in report)" + task @name do + specifications.each do |spec| + puts "#{spec.name} should:\n" + spec.requirements.each do |req| + puts " - #{req}" + end + end + end + + desc "Generate html report of behavioral definitions for the classes specified (use for= to further limit files included in report)" + task "#{@name}_html" do + require 'erb' + txt =<<-EOS + + + + + +
Specifications
+<% specifications.each do |spec| %> +
+<%= spec.name %> should: +
    +<% spec.requirements.each do |req| %> +
  • <%= req %>
  • +<% end %> +
+
+<% end %> + + + EOS + output_dir = File.expand_path(@html_dir) + mkdir_p output_dir + output_filename = output_dir + "/behaviors.html" + File.open(output_filename,"w") do |f| + f.write ERB.new(txt).result(binding) + end + puts "(Wrote #{output_filename})" + end + end + + private + def test_files + test_list = FileList[@pattern] + if ENV['for'] + test_list = test_list.grep(/#{ENV['for']}/i) + end + test_list + end + + def specifications + test_files.map do |file| + spec = OpenStruct.new + m = %r".*/([^/].*)_test.rb".match(file) + class_name = titleize(m[1]) if m[1] + spec.name = class_name + spec.requirements = [] + File::readlines(file).each do |line| + if line =~ /^\s*should\s+\(?\s*["'](.*)["']/ + spec.requirements << $1 + end + end + spec + end + end + + ############################################################ + # STOLEN FROM inflector.rb + ############################################################ + #-- + # Copyright (c) 2005 David Heinemeier Hansson + # + # Permission is hereby granted, free of charge, to any person obtaining + # a copy of this software and associated documentation files (the + # "Software"), to deal in the Software without restriction, including + # without limitation the rights to use, copy, modify, merge, publish, + # distribute, sublicense, and/or sell copies of the Software, and to + # permit persons to whom the Software is furnished to do so, subject to + # the following conditions: + # + # The above copyright notice and this permission notice shall be + # included in all copies or substantial portions of the Software. + # + # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + #++ + def titleize(word) + humanize(underscore(word)).gsub(/\b([a-z])/) { $1.capitalize } + end + + def underscore(camel_cased_word) camel_cased_word.to_s.gsub(/::/, '/'). + gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').gsub(/([a-z\d])([A-Z])/,'\1_\2').tr("-", "_").downcase + end + + def humanize(lower_case_and_underscored_word) + lower_case_and_underscored_word.to_s.gsub(/_id$/, "").gsub(/_/, " ").capitalize + end + + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/behaviors/test/behaviors_tasks_test.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/behaviors/test/behaviors_tasks_test.rb new file mode 100644 index 0000000..9382e07 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/behaviors/test/behaviors_tasks_test.rb @@ -0,0 +1,73 @@ +require 'test/unit' +require 'fileutils' + +class BehaviorsTasksTest < Test::Unit::TestCase + include FileUtils + + def setup + @here = File.expand_path(File.dirname(__FILE__)) + @base_cmd = RUBY_PLATFORM[/mswin/] ? 'rake.cmd ' : 'rake ' + end + + # + # HELPERS + # + def run_behaviors_task + run_cmd "behaviors" + end + + def run_behaviors_html_task + run_cmd "behaviors_html" + end + + def run_cmd(cmd) + cd "#{@here}/tasks_test" do + @report = %x[ #{@base_cmd} #{cmd} ] + end + end + + def see_html_task_output_message + @html_output_filename = "#{@here}/tasks_test/behaviors_doc/behaviors.html" + assert_match(/Wrote #{@html_output_filename}/, @report) + end + + def see_that_html_report_file_exits + assert File.exists?(@html_output_filename), "html output file should exist" + end + + def html_report_file_should_contain(user_behaviors) + file_contents = File.read(@html_output_filename) + user_behaviors.each do |line| + assert_match(/#{line}/, file_contents) + end + rm_rf File.dirname(@html_output_filename) + end + + # + # TESTS + # + def test_that_behaviors_tasks_should_list_behavioral_definitions_for_the_classes_under_test + run_behaviors_task + user_behaviors = [ + "User should:", + " - be able set user name and age during construction", + " - be able to get user name and age", + " - be able to ask if a user is an adult" + ] + assert_match(/#{user_behaviors.join("\n")}/, @report) + end + + def test_that_behaviors_tasks_should_list_behavioral_definitions_for_the_classes_under_test_in_html_output + run_behaviors_html_task + see_html_task_output_message + see_that_html_report_file_exits + user_behaviors = [ + "User should:", + "be able set user name and age during construction", + "be able to get user name and age", + "be able to ask if a user is an adult" + ] + html_report_file_should_contain user_behaviors + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/behaviors/test/behaviors_test.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/behaviors/test/behaviors_test.rb new file mode 100644 index 0000000..fd0a77f --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/behaviors/test/behaviors_test.rb @@ -0,0 +1,50 @@ +require 'test/unit' +require File.expand_path(File.dirname(__FILE__)) + '/../lib/behaviors' +require 'stringio' + +loading_developer_test_class_stdout = StringIO.new +saved_stdout = $stdout.dup +$stdout = loading_developer_test_class_stdout + +class DeveloperTest + extend Behaviors + attr_accessor :flunk_msg, :tested_code + + should "test their code" do + @tested_code = true + end + should "go to meetings" +end + +$stdout = saved_stdout +loading_developer_test_class_stdout.rewind +$loading_developer_test_class_output = loading_developer_test_class_stdout.read + +class BehaviorsTest < Test::Unit::TestCase + + + def setup + @target = DeveloperTest.new + assert_nil @target.tested_code, "block called too early" + end + + # + # TESTS + # + def test_should_called_with_a_block_defines_a_test + assert @target.methods.include?("test_should_test their code"), "Missing test method" + + @target.send("test_should_test their code") + + assert @target.tested_code, "block not called" + end + + def test_should_called_without_a_block_does_not_create_a_test_method + assert !@target.methods.include?("test_should_go to meetings"), "Should not have method" + end + + def test_should_called_without_a_block_will_give_unimplemented_output_when_class_loads + unimplemented_output = "UNIMPLEMENTED CASE: Developer should go to meetings" + assert_match(/#{unimplemented_output}/, $loading_developer_test_class_output) + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/behaviors/test/tasks_test/Rakefile b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/behaviors/test/tasks_test/Rakefile new file mode 100644 index 0000000..ba71f71 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/behaviors/test/tasks_test/Rakefile @@ -0,0 +1,19 @@ +require 'rake' +require 'rake/testtask' + +here = File.expand_path(File.dirname(__FILE__)) +require "#{here}/../../lib/behaviors/reporttask" + +desc 'Default: run unit tests.' +task :default => :test + +Rake::TestTask.new(:test) do |t| + t.libs << "#{here}/../../lib" + t.pattern = 'test/**/*_test.rb' + t.verbose = true +end + +Behaviors::ReportTask.new(:behaviors) do |t| + t.pattern = 'test/**/*_test.rb' + t.html_dir = 'behaviors_doc' +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/behaviors/test/tasks_test/lib/user.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/behaviors/test/tasks_test/lib/user.rb new file mode 100644 index 0000000..40bc07c --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/behaviors/test/tasks_test/lib/user.rb @@ -0,0 +1,2 @@ +class User +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/behaviors/test/tasks_test/test/user_test.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/behaviors/test/tasks_test/test/user_test.rb new file mode 100644 index 0000000..ad3cd1b --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/behaviors/test/tasks_test/test/user_test.rb @@ -0,0 +1,17 @@ +require 'test/unit' +require 'behaviors' + +require 'user' + +class UserTest < Test::Unit::TestCase + extend Behaviors + + def setup + end + + should "be able set user name and age during construction" + should "be able to get user name and age" + should "be able to ask if a user is an adult" + def test_DELETEME + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/docs/CExceptionSummary.odt b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/docs/CExceptionSummary.odt new file mode 100644 index 0000000..ea852a0 Binary files /dev/null and b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/docs/CExceptionSummary.odt differ diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/docs/CExceptionSummary.pdf b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/docs/CExceptionSummary.pdf new file mode 100644 index 0000000..a838337 Binary files /dev/null and b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/docs/CExceptionSummary.pdf differ diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/docs/license.txt b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/docs/license.txt new file mode 100644 index 0000000..561e5f2 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/docs/license.txt @@ -0,0 +1,30 @@ + Copyright (c) 2007 Mark VanderVoord + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + The end-user documentation included with the redistribution, if + any, must include the following acknowledgment: "This product + includes software developed for the CEXCeption Project, by Mark + VanderVoord and other contributors", in the same place and form + as other third-party acknowledgments. Alternately, this + acknowledgment may appear in the software itself, in the same + form and location as other such third-party acknowledgments. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/docs/readme.txt b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/docs/readme.txt new file mode 100644 index 0000000..92cac38 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/docs/readme.txt @@ -0,0 +1,236 @@ +==================================================================== +CException +==================================================================== + +CException is a basic exception framework for C, suitable for use in +embedded applications. It provides an exception framework similar in +use to C++, but with much less overhead. + +CException uses C standard library functions setjmp and longjmp to +operate. As long as the target system has these two functions defined, +this library should be useable with very little configuration. It +even supports environments where multiple program flows are in use, +such as real-time operating systems. + +There are about a gabillion exception frameworks using a similar +setjmp/longjmp method out there... and there will probably be more +in the future. Unfortunately, when we started our last embedded +project, all those that existed either (a) did not support multiple +tasks (therefore multiple stacks) or (b) were way more complex than +we really wanted. CException was born. + +Why use CException? + +0. It's ANSI C, and it beats passing error codes around. + +1. You want something simple... CException throws a single id. You can + define those ID's to be whatever you like. You might even choose which + type that number is for your project. But that's as far as it goes. + We weren't interested in passing objects or structs or strings... + just simple error codes. + +2. Performance... CException can be configured for single tasking or + multitasking. In single tasking, there is very little overhead past + the setjmp/longjmp calls (which are already fast). In multitasking, + your only additional overhead is the time it takes you to determine + a unique task id 0 - num_tasks. + +For the latest version, go to http://cexception.sourceforge.net + +-------------------------------------------------------------------- +CONTENTS OF THIS DOCUMENT +-------------------------------------------------------------------- + +Usage +Limitations +API +Configuration +Testing +License + +-------------------------------------------------------------------- +Usage +-------------------------------------------------------------------- + +Code that is to be protected are wrapped in Try { } Catch { } blocks. +The code directly following the Try call is "protected", meaning that +if any Throws occur, program control is directly transferred to the +start of the Catch block. + +A numerical exception ID is included with Throw, and is made accessible +from the Catch block. + +Throws can occur from within function calls (nested as deeply as you +like) or directly from within the function itself. + +-------------------------------------------------------------------- +Limitations +-------------------------------------------------------------------- + +This library was made to be as fast as possible, and provide basic +exception handling. It is not a full-blown exception library. Because +of this, there are a few limitations that should be observed in order +to successfully utilize this library: + +1. Do not directly "return" from within a Try block, nor "goto" + into or out of a Try block. + + Why? + + The "Try" macro allocates some local memory and alters a global + pointer. These are cleaned up at the top of the "Catch" macro. + Gotos and returns would bypass some of these steps, resulting in + memory leaks or unpredictable behavior. + +2. If (a) you change local (stack) variables within your Try block, + AND (b) wish to make use of the updated values after an exception + is thrown, those variables should be made volatile. Note that this + is ONLY for locals and ONLY when you need access to them after a + throw. + + Why? + + Compilers optimize. There is no way to guarantee that the actual + memory location was updated and not just a register unless the + variable is marked volatile. + +3. Memory which is malloc'd or new'd is not automatically released + when an error is thrown. This will sometimes be desirable, and + othertimes may not. It will be the responsibility of the Catch + block to perform this kind of cleanup. + + Why? + + There's just no easy way to track malloc'd memory, etc., without + replacing or wrapping malloc calls or something like that. This + is a light framework, so these options were not desirable. + +-------------------------------------------------------------------- +API +-------------------------------------------------------------------- + +Try +--- + +Try is a macro which starts a protected block. It MUST be followed by +a pair of braces or a single protected line (similar to an 'if'), +enclosing the data that is to be protected. It MUST be followed by a +Catch block (don't worry, you'll get compiler errors to let you know if +you mess any of that up). + +Catch(e) +-------- + +Catch is a macro which ends the Try block and starts the error handling +block. The catch block is called if and only if an exception was thrown +while within the Try block. This error was thrown by a Throw call +somewhere within Try (or within a function called within Try, or a function +called by a function called within Try, etc). + +The single parameter 'e' is filled with the error code which was thrown. +This can be used for reporting, conditional cleanup, etc. (or you can just +ignore it if you really want... people ignore return codes all the time, +right?). 'e' should be of type EXCEPTION_T; + +Throw(e) +-------- + +The method of throwing an error. Throws should only occur from within a +protected (Try...Catch) block, though it may easily be nested many function +calls deep without an impact on performance or functionality. Throw takes +a single argument, which is an exception id which will be passed to Catch +as the reason for the error. + +If you wish to Rethrow an error, this can be done by calling Throw(e) with +the error code you just caught. It IS valid to throw from a catch block. + +-------------------------------------------------------------------- +CONFIGURATION +-------------------------------------------------------------------- + +CException is a mostly portable library. It has one universal +dependency, and some macros which are required if working in a +multi-tasking environment. + +1. The standard C library setjmp must be available. Since this is part + of the standard library, chances are good that you'll be fine. + +2. If working in a multitasking environment, methods for obtaining an + index into an array of frames and to get the overall number of + id's are required. If the OS supports a method to retrieve Task + ID's, and those Tasks are number 0, 1, 2... you are in an ideal + situation. Otherwise, a more creative mapping function may be + required. Note that this function is likely to be called twice + for each protected block and once during a throw. This is the + only overhead in the system. + +Exception.h +----------------- +By convention, most projects include Exception.h which defines any +further requirements, then calls CException.h to do the gruntwork. All +of these are optional. You could directly include CException.h if +you wanted and just use the defaults provided. + +EXCEPTION_T - Set this to the type you want your exception id's + to be. Defaults to 'unsigned int'. + +EXCEPTION_NONE - Set this to a number which will never be an + exception id in your system. Defaults to 0x5a5a5a5a. + +EXCEPTION_GET_ID - If in a multi-tasking environment, this should be + set to be a call to the function described in #2 above. + Defaults to just return 0 all the time (good for + single tasking environments) + +EXCEPTION_NUM_ID - If in a multi-tasking environment, this should be set + to the number of ID's required (usually the number of + tasks in the system). Defaults to 1 (for single + tasking environments). + +You may also want to include any header files which will commonly be +needed by the rest of your application where it uses exception handling +here. For example, OS header files or exception codes would be useful. + +-------------------------------------------------------------------- +TESTING +-------------------------------------------------------------------- + +If you want to validate that CException works with your tools or that +it works with your custom configuration, you may want to run the test +suite. + +The test suite included makes use of the Unity Test Framework. It will +require a native C compiler. The example makefile uses MinGW's gcc. +Modify the makefile to include the proper paths to tools, then run 'make' +to compile and run the test application. + +C_COMPILER - The C compiler to use to perform the tests +C_LIBS - The path to the C libraries (including setjmp) +UNITY_DIR - The path to the Unity framework (required to run tests) + (get it at http://embunity.sourceforge.net) + +-------------------------------------------------------------------- +LICENSE +-------------------------------------------------------------------- + +This software is licensed under the MIT License + +Copyright (c) 2007 Mark VanderVoord + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/lib/CException.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/lib/CException.c new file mode 100644 index 0000000..57f5353 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/lib/CException.c @@ -0,0 +1,39 @@ +#include "CException.h" + +volatile CEXCEPTION_FRAME_T CExceptionFrames[CEXCEPTION_NUM_ID]; + +//------------------------------------------------------------------------------------------ +// Throw +//------------------------------------------------------------------------------------------ +void Throw(CEXCEPTION_T ExceptionID) +{ + unsigned int MY_ID = CEXCEPTION_GET_ID; + CExceptionFrames[MY_ID].Exception = ExceptionID; + longjmp(*CExceptionFrames[MY_ID].pFrame, 1); +} + +//------------------------------------------------------------------------------------------ +// Explaination of what it's all for: +//------------------------------------------------------------------------------------------ +/* +#define Try + { <- give us some local scope. most compilers are happy with this + jmp_buf *PrevFrame, NewFrame; <- prev frame points to the last try block's frame. new frame gets created on stack for this Try block + unsigned int MY_ID = CEXCEPTION_GET_ID; <- look up this task's id for use in frame array. always 0 if single-tasking + PrevFrame = CExceptionFrames[CEXCEPTION_GET_ID].pFrame; <- set pointer to point at old frame (which array is currently pointing at) + CExceptionFrames[MY_ID].pFrame = &NewFrame; <- set array to point at my new frame instead, now + CExceptionFrames[MY_ID].Exception = CEXCEPTION_NONE; <- initialize my exception id to be NONE + if (setjmp(NewFrame) == 0) { <- do setjmp. it returns 1 if longjump called, otherwise 0 + if (&PrevFrame) <- this is here to force proper scoping. it requires braces or a single line to be but after Try, otherwise won't compile. This is always true at this point. + +#define Catch(e) + else { } <- this also forces proper scoping. Without this they could stick their own 'else' in and it would get ugly + CExceptionFrames[MY_ID].Exception = CEXCEPTION_NONE; <- no errors happened, so just set the exception id to NONE (in case it was corrupted) + } + else <- an exception occurred + { e = CExceptionFrames[MY_ID].Exception; e=e;} <- assign the caught exception id to the variable passed in. + CExceptionFrames[MY_ID].pFrame = PrevFrame; <- make the pointer in the array point at the previous frame again, as if NewFrame never existed. + } <- finish off that local scope we created to have our own variables + if (CExceptionFrames[CEXCEPTION_GET_ID].Exception != CEXCEPTION_NONE) <- start the actual 'catch' processing if we have an exception id saved away + */ + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/lib/CException.h b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/lib/CException.h new file mode 100644 index 0000000..40c6fc7 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/lib/CException.h @@ -0,0 +1,70 @@ +#ifndef _CEXCEPTION_H +#define _CEXCEPTION_H + +#include + +//To Use CException, you have a number of options: +//1. Just include it and run with the defaults +//2. Define any of the following symbols at the command line to override them +//3. Include a header file before CException.h everywhere which defines any of these +//4. Create an Exception.h in your path, and just define EXCEPTION_USE_CONFIG_FILE first + +#ifdef CEXCEPTION_USE_CONFIG_FILE +#include "CExceptionConfig.h" +#endif + +//This is the value to assign when there isn't an exception +#ifndef CEXCEPTION_NONE +#define CEXCEPTION_NONE (0x5A5A5A5A) +#endif + +//This is number of exception stacks to keep track of (one per task) +#ifndef CEXCEPTION_NUM_ID +#define CEXCEPTION_NUM_ID (1) //there is only the one stack by default +#endif + +//This is the method of getting the current exception stack index (0 if only one stack) +#ifndef CEXCEPTION_GET_ID +#define CEXCEPTION_GET_ID (0) //use the first index always because there is only one anyway +#endif + +//The type to use to store the exception values. +#ifndef CEXCEPTION_T +#define CEXCEPTION_T unsigned int +#endif + +//exception frame structures +typedef struct { + jmp_buf* pFrame; + volatile CEXCEPTION_T Exception; +} CEXCEPTION_FRAME_T; + +//actual root frame storage (only one if single-tasking) +extern volatile CEXCEPTION_FRAME_T CExceptionFrames[]; + +//Try (see C file for explanation) +#define Try \ + { \ + jmp_buf *PrevFrame, NewFrame; \ + unsigned int MY_ID = CEXCEPTION_GET_ID; \ + PrevFrame = CExceptionFrames[CEXCEPTION_GET_ID].pFrame; \ + CExceptionFrames[MY_ID].pFrame = (jmp_buf*)(&NewFrame); \ + CExceptionFrames[MY_ID].Exception = CEXCEPTION_NONE; \ + if (setjmp(NewFrame) == 0) { \ + if (&PrevFrame) + +//Catch (see C file for explanation) +#define Catch(e) \ + else { } \ + CExceptionFrames[MY_ID].Exception = CEXCEPTION_NONE; \ + } \ + else \ + { e = CExceptionFrames[MY_ID].Exception; e=e; } \ + CExceptionFrames[MY_ID].pFrame = PrevFrame; \ + } \ + if (CExceptionFrames[CEXCEPTION_GET_ID].Exception != CEXCEPTION_NONE) + +//Throw an Error +void Throw(CEXCEPTION_T ExceptionID); + +#endif // _CEXCEPTION_H diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/makefile b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/makefile new file mode 100644 index 0000000..c168a41 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/makefile @@ -0,0 +1,24 @@ +#Tool and Lib Locations +C_COMPILER=gcc +C_LIBS=C:/MinGW/lib +UNITY_DIR=vendor/unity/src + +#Test File To Be Created +OUT_FILE=test_cexceptions +ifeq ($(OS),Windows_NT) +OUT_EXTENSION=.exe +else +OUT_EXTENSION=.out +endif + +#Options +SRC_FILES=lib/CException.c test/TestException.c test/TestException_Runner.c $(UNITY_DIR)/unity.c +INC_DIRS=-Ilib -Itest -I$(UNITY_DIR) +LIB_DIRS=-L$(C_LIBS) +SYMBOLS=-DTEST -DEXCEPTION_USE_CONFIG_FILE + +#Default Task: Compile And Run Tests +default: + $(C_COMPILER) $(INC_DIRS) $(LIB_DIRS) $(SYMBOLS) $(SRC_FILES) -o $(OUT_FILE)$(OUT_EXTENSION) + $(OUT_FILE)$(OUT_EXTENSION) + \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/rakefile.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/rakefile.rb new file mode 100644 index 0000000..2458c6f --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/rakefile.rb @@ -0,0 +1,41 @@ +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require HERE+'vendor/unity/auto/colour_reporter.rb' + +#Tool and Lib Locations +C_COMPILER = 'gcc' +C_LIBS = '' +UNITY_DIR = 'vendor/unity/src' + +#Test File To Be Created +OUT_FILE = 'test_cexceptions' +OUT_EXTENSION = '.out' + +#Options +SRC_FILES = "lib/CException.c test/TestException.c test/TestException_Runner.c #{UNITY_DIR}/unity.c" +INC_DIRS = "-Ilib -Itest -I#{UNITY_DIR}" +LIB_DIRS = C_LIBS.empty? ? '' : "-L#{C_LIBS}" +SYMBOLS = '-DTEST -DEXCEPTION_USE_CONFIG_FILE' + +CLEAN.include("#{HERE}*.out") + +task :default => [:clobber, :test] +task :cruise => [:no_color, :default] + +desc "performs a quick set of unit tests to confirm you're ready to go" +task :test do + report "#{C_COMPILER} #{INC_DIRS} #{LIB_DIRS} #{SYMBOLS} #{SRC_FILES} -o #{OUT_FILE}#{OUT_EXTENSION}" + output = `#{C_COMPILER} #{INC_DIRS} #{LIB_DIRS} #{SYMBOLS} #{SRC_FILES} -o #{OUT_FILE}#{OUT_EXTENSION}` + report output + + report "#{HERE}#{OUT_FILE}#{OUT_EXTENSION}" + output = `#{HERE}#{OUT_FILE}#{OUT_EXTENSION}` + report output +end + +task :no_color do + $colour_output = false +end \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/release/build.info b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/release/build.info new file mode 100644 index 0000000..b5794c5 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/release/build.info @@ -0,0 +1,2 @@ +16 + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/release/version.info b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/release/version.info new file mode 100644 index 0000000..cb7e5f6 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/release/version.info @@ -0,0 +1,2 @@ +1.2.0 + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/test/CExceptionConfig.h b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/test/CExceptionConfig.h new file mode 100644 index 0000000..79b085d --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/test/CExceptionConfig.h @@ -0,0 +1,27 @@ +#ifndef _EXCEPTION_H +#define _EXCEPTION_H + +//Optionally define the exception type (something like an int which can be directly assigned) +#define CEXCEPTION_T int + +// Optionally define the reserved value representing NO EXCEPTION +#define CEXCEPTION_NONE (1234) + +// Multi-Tasking environments will need a couple of macros defined to make this library +// properly handle multiple exception stacks. You will need to include and required +// definitions, then define the following macros: +// EXCEPTION_GET_ID - returns the id of the current task indexed 0 to (numtasks - 1) +// EXCEPTION_NUM_ID - returns the number of tasks that might be returned +// +// For example, Quadros might include the following implementation: +#ifndef TEST +#include "OSAPI.h" +#define CEXCEPTION_GET_ID (KS_GetTaskID()) +#define CEXCEPTION_NUM_ID (NTASKS + 1) +#endif + +//This could be a good place to define/include some error ID's: +#define ERROR_ID_EVERYTHING_IS_BROKEN (0x88) +#define ERROR_ID_ONLY_THIS_IS_BROKEN (0x77) + +#endif // _EXCEPTION_H diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/test/TestException.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/test/TestException.c new file mode 100644 index 0000000..704cfdb --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/test/TestException.c @@ -0,0 +1,291 @@ +#include "unity.h" +#include "CException.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void test_BasicTryDoesNothingIfNoThrow(void) +{ + int i; + CEXCEPTION_T e = 0x5a; + + Try + { + i += 1; + } + Catch(e) + { + TEST_FAIL_MESSAGE("Should Not Enter Catch If Not Thrown") + } + + //verify that e was untouched + TEST_ASSERT_EQUAL(0x5a, e); +} + +void test_BasicThrowAndCatch(void) +{ + CEXCEPTION_T e; + + Try + { + Throw(0xBE); + TEST_FAIL_MESSAGE("Should Have Thrown An Error") + } + Catch(e) + { + //verify that e has the right data + TEST_ASSERT_EQUAL(0xBE, e); + } + + //verify that e STILL has the right data + TEST_ASSERT_EQUAL(0xBE, e); +} + +void test_BasicThrowAndCatch_WithMiniSyntax(void) +{ + CEXCEPTION_T e; + + //Mini Throw and Catch + Try + Throw(0xEF); + Catch(e) + TEST_ASSERT_EQUAL(0xEF, e); + TEST_ASSERT_EQUAL(0xEF, e); + + //Mini Passthrough + Try + e = 0; + Catch(e) + TEST_FAIL_MESSAGE("I shouldn't be caught because there was no throw"); + + TEST_ASSERT_EQUAL(0, e); +} + +void test_VerifyVolatilesSurviveThrowAndCatch(void) +{ + volatile unsigned int VolVal = 0; + CEXCEPTION_T e; + + Try + { + VolVal = 2; + Throw(0xBF); + TEST_FAIL_MESSAGE("Should Have Thrown An Error") + } + Catch(e) + { + VolVal += 2; + TEST_ASSERT_EQUAL(0xBF, e); + } + + TEST_ASSERT_EQUAL(4, VolVal); + TEST_ASSERT_EQUAL(0xBF, e); +} + +void HappyExceptionThrower(unsigned int ID) +{ + if (ID != 0) + { + Throw(ID); + } +} + +void test_ThrowFromASubFunctionAndCatchInRootFunc(void) +{ + volatile unsigned int ID = 0; + CEXCEPTION_T e; + + Try + { + + HappyExceptionThrower(0xBA); + TEST_FAIL_MESSAGE("Should Have Thrown An Exception"); + } + Catch(e) + { + ID = e; + } + + //verify that I can pass that value to something else + TEST_ASSERT_EQUAL(0xBA, e); +} + +void HappyExceptionRethrower(unsigned int ID) +{ + CEXCEPTION_T e; + + Try + { + Throw(ID); + } + Catch(e) + { + switch (e) + { + case 0xBD: + Throw(0xBF); + break; + default: + break; + } + } +} + +void test_ThrowAndCatchFromASubFunctionAndRethrowToCatchInRootFunc(void) +{ + volatile unsigned int ID = 0; + CEXCEPTION_T e; + + Try + { + HappyExceptionRethrower(0xBD); + TEST_FAIL_MESSAGE("Should Have Rethrown Exception"); + } + Catch(e) + { + ID = 1; + } + + TEST_ASSERT_EQUAL(0xBF, e); + TEST_ASSERT_EQUAL(1, ID); +} + +void test_ThrowAndCatchFromASubFunctionAndNoRethrowToCatchInRootFunc(void) +{ + CEXCEPTION_T e = 3; + + Try + { + HappyExceptionRethrower(0xBF); + } + Catch(e) + { + TEST_FAIL_MESSAGE("Should Not Have Re-thrown Error (it should have already been caught)"); + } + + //verify that THIS e is still untouched, even though subfunction was touched + TEST_ASSERT_EQUAL(3, e); +} + +void test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThisDoesntCorruptExceptionId(void) +{ + CEXCEPTION_T e; + + Try + { + HappyExceptionThrower(0xBF); + TEST_FAIL_MESSAGE("Should Have Thrown Exception"); + } + Catch(e) + { + TEST_ASSERT_EQUAL(0xBF, e); + HappyExceptionRethrower(0x12); + TEST_ASSERT_EQUAL(0xBF, e); + } + TEST_ASSERT_EQUAL(0xBF, e); +} + +void test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThatEachExceptionIdIndependent(void) +{ + CEXCEPTION_T e1, e2; + + Try + { + HappyExceptionThrower(0xBF); + TEST_FAIL_MESSAGE("Should Have Thrown Exception"); + } + Catch(e1) + { + TEST_ASSERT_EQUAL(0xBF, e1); + Try + { + HappyExceptionThrower(0x12); + } + Catch(e2) + { + TEST_ASSERT_EQUAL(0x12, e2); + } + TEST_ASSERT_EQUAL(0x12, e2); + TEST_ASSERT_EQUAL(0xBF, e1); + } + TEST_ASSERT_EQUAL(0x12, e2); + TEST_ASSERT_EQUAL(0xBF, e1); +} + +void test_CanHaveMultipleTryBlocksInASingleFunction(void) +{ + CEXCEPTION_T e; + + Try + { + HappyExceptionThrower(0x01); + TEST_FAIL_MESSAGE("Should Have Thrown Exception"); + } + Catch(e) + { + TEST_ASSERT_EQUAL(0x01, e); + } + + Try + { + HappyExceptionThrower(0xF0); + TEST_FAIL_MESSAGE("Should Have Thrown Exception"); + } + Catch(e) + { + TEST_ASSERT_EQUAL(0xF0, e); + } +} + +void test_CanHaveNestedTryBlocksInASingleFunction_ThrowInside(void) +{ + int i = 0; + CEXCEPTION_T e; + + Try + { + Try + { + HappyExceptionThrower(0x01); + i = 1; + TEST_FAIL_MESSAGE("Should Have Rethrown Exception"); + } + Catch(e) + { + TEST_ASSERT_EQUAL(0x01, e); + } + } + Catch(e) + { + TEST_FAIL_MESSAGE("Should Have Been Caught By Inside Catch"); + } +} + +void test_CanHaveNestedTryBlocksInASingleFunction_ThrowOutside(void) +{ + int i = 0; + CEXCEPTION_T e; + + Try + { + Try + { + i = 2; + } + Catch(e) + { + TEST_FAIL_MESSAGE("Should NotBe Caught Here"); + } + HappyExceptionThrower(0x01); + TEST_FAIL_MESSAGE("Should Have Rethrown Exception"); + } + Catch(e) + { + TEST_ASSERT_EQUAL(0x01, e); + } +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/test/TestException_Runner.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/test/TestException_Runner.c new file mode 100644 index 0000000..1697a0e --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/test/TestException_Runner.c @@ -0,0 +1,62 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ +#include "unity.h" +#include "CException.h" + +extern void setUp(void); +extern void tearDown(void); + +extern void test_BasicTryDoesNothingIfNoThrow(void); +extern void test_BasicThrowAndCatch(void); +extern void test_BasicThrowAndCatch_WithMiniSyntax(void); +extern void test_VerifyVolatilesSurviveThrowAndCatch(void); +extern void test_ThrowFromASubFunctionAndCatchInRootFunc(void); +extern void test_ThrowAndCatchFromASubFunctionAndRethrowToCatchInRootFunc(void); +extern void test_ThrowAndCatchFromASubFunctionAndNoRethrowToCatchInRootFunc(void); +extern void test_CanHaveMultipleTryBlocksInASingleFunction(void); +extern void test_CanHaveNestedTryBlocksInASingleFunction_ThrowInside(void); +extern void test_CanHaveNestedTryBlocksInASingleFunction_ThrowOutside(void); +extern void test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThisDoesntCorruptExceptionId(void); +extern void test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThatEachExceptionIdIndependent(void); + +static void runTest(UnityTestFunction test) +{ + CEXCEPTION_T e; + if (TEST_PROTECT()) + { + setUp(); + Try + { + test(); + } + Catch(e) + { + TEST_FAIL_MESSAGE("Unexpected exception!") + } + } + tearDown(); +} + + +int main(void) +{ + Unity.TestFile = __FILE__; + UnityBegin(); + + // RUN_TEST calls runTest + RUN_TEST(test_BasicTryDoesNothingIfNoThrow, 12); + RUN_TEST(test_BasicThrowAndCatch, 30); + RUN_TEST(test_BasicThrowAndCatch_WithMiniSyntax, 49); + RUN_TEST(test_VerifyVolatilesSurviveThrowAndCatch, 69); + RUN_TEST(test_ThrowFromASubFunctionAndCatchInRootFunc, 98); + RUN_TEST(test_ThrowAndCatchFromASubFunctionAndRethrowToCatchInRootFunc, 139); + RUN_TEST(test_ThrowAndCatchFromASubFunctionAndNoRethrowToCatchInRootFunc, 158); + RUN_TEST(test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThisDoesntCorruptExceptionId, 175); + RUN_TEST(test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThatEachExceptionIdIndependent, 193); + RUN_TEST(test_CanHaveMultipleTryBlocksInASingleFunction, 220); + RUN_TEST(test_CanHaveNestedTryBlocksInASingleFunction_ThrowInside, 245); + RUN_TEST(test_CanHaveNestedTryBlocksInASingleFunction_ThrowOutside, 269); + + UnityEnd(); + + return 0; +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/colour_prompt.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/colour_prompt.rb new file mode 100644 index 0000000..81003dd --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/colour_prompt.rb @@ -0,0 +1,94 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +if RUBY_PLATFORM =~/(win|w)32$/ + begin + require 'Win32API' + rescue LoadError + puts "ERROR! \"Win32API\" library not found" + puts "\"Win32API\" is required for colour on a windows machine" + puts " try => \"gem install Win32API\" on the command line" + puts + end + # puts + # puts 'Windows Environment Detected...' + # puts 'Win32API Library Found.' + # puts +end + +class ColourCommandLine + def initialize + if RUBY_PLATFORM =~/(win|w)32$/ + get_std_handle = Win32API.new("kernel32", "GetStdHandle", ['L'], 'L') + @set_console_txt_attrb = + Win32API.new("kernel32","SetConsoleTextAttribute",['L','N'], 'I') + @hout = get_std_handle.call(-11) + end + end + + def change_to(new_colour) + if RUBY_PLATFORM =~/(win|w)32$/ + @set_console_txt_attrb.call(@hout,self.win32_colour(new_colour)) + else + "\033[30;#{posix_colour(new_colour)};22m" + end + end + + def win32_colour(colour) + case colour + when :black then 0 + when :dark_blue then 1 + when :dark_green then 2 + when :dark_cyan then 3 + when :dark_red then 4 + when :dark_purple then 5 + when :dark_yellow, :narrative then 6 + when :default_white, :default, :dark_white then 7 + when :silver then 8 + when :blue then 9 + when :green, :success then 10 + when :cyan, :output then 11 + when :red, :failure then 12 + when :purple then 13 + when :yellow then 14 + when :white then 15 + else + 0 + end + end + + def posix_colour(colour) + case colour + when :black then 30 + when :red, :failure then 31 + when :green, :success then 32 + when :yellow then 33 + when :blue, :narrative then 34 + when :purple, :magenta then 35 + when :cyan, :output then 36 + when :white, :default_white, :default then 37 + else + 30 + end + end + + def out_c(mode, colour, str) + case RUBY_PLATFORM + when /(win|w)32$/ + change_to(colour) + $stdout.puts str if mode == :puts + $stdout.print str if mode == :print + change_to(:default_white) + else + $stdout.puts("#{change_to(colour)}#{str}\033[0m") if mode == :puts + $stdout.print("#{change_to(colour)}#{str}\033[0m") if mode == :print + end + end +end # ColourCommandLine + +def colour_puts(role,str) ColourCommandLine.new.out_c(:puts, role, str) end +def colour_print(role,str) ColourCommandLine.new.out_c(:print, role, str) end + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/colour_reporter.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/colour_reporter.rb new file mode 100644 index 0000000..5aa1d27 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/colour_reporter.rb @@ -0,0 +1,39 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require "#{File.expand_path(File.dirname(__FILE__))}/colour_prompt" + +$colour_output = true + +def report(message) + if not $colour_output + $stdout.puts(message) + else + message = message.join('\n') if (message.class == Array) + message.each_line do |line| + line.chomp! + colour = case(line) + when /(?:total\s+)?tests:?\s+(\d+)\s+(?:total\s+)?failures:?\s+\d+\s+Ignored:?/i + ($1.to_i == 0) ? :green : :red + when /PASS/ + :green + when /^OK$/ + :green + when /(?:FAIL|ERROR)/ + :red + when /IGNORE/ + :yellow + when /^(?:Creating|Compiling|Linking)/ + :white + else + :silver + end + colour_puts(colour, line) + end + end + $stdout.flush + $stderr.flush +end \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_config.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_config.yml new file mode 100644 index 0000000..4a5e474 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_config.yml @@ -0,0 +1,36 @@ +#this is a sample configuration file for generate_module +#you would use it by calling generate_module with the -ygenerate_config.yml option +#files like this are useful for customizing generate_module to your environment +:generate_module: + :defaults: + #these defaults are used in place of any missing options at the command line + :path_src: ../src/ + :path_inc: ../src/ + :path_tst: ../test/ + :update_svn: true + :includes: + #use [] for no additional includes, otherwise list the includes on separate lines + :src: + - Defs.h + - Board.h + :inc: [] + :tst: + - Defs.h + - Board.h + - Exception.h + :boilerplates: + #these are inserted at the top of generated files. + #just comment out or remove if not desired. + #use %1$s where you would like the file name to appear (path/extension not included) + :src: | + //------------------------------------------- + // %1$s.c + //------------------------------------------- + :inc: | + //------------------------------------------- + // %1$s.h + //------------------------------------------- + :tst: | + //------------------------------------------- + // Test%1$s.c : Units tests for %1$s.c + //------------------------------------------- diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_module.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_module.rb new file mode 100644 index 0000000..3db1a98 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_module.rb @@ -0,0 +1,202 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +# This script creates all the files with start code necessary for a new module. +# A simple module only requires a source file, header file, and test file. +# Triad modules require a source, header, and test file for each triad type (like model, conductor, and hardware). + +require 'rubygems' +require 'fileutils' + +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +#help text when requested +HELP_TEXT = [ "\nGENERATE MODULE\n-------- ------", + "\nUsage: ruby generate_module [options] module_name", + " -i\"include\" sets the path to output headers to 'include' (DEFAULT ../src)", + " -s\"../src\" sets the path to output source to '../src' (DEFAULT ../src)", + " -t\"C:/test\" sets the path to output source to 'C:/test' (DEFAULT ../test)", + " -p\"MCH\" sets the output pattern to MCH.", + " dh - driver hardware.", + " dih - driver interrupt hardware.", + " mch - model conductor hardware.", + " mvp - model view presenter.", + " src - just a single source module. (DEFAULT)", + " -d destroy module instead of creating it.", + " -u update subversion too (requires subversion command line)", + " -y\"my.yml\" selects a different yaml config file for module generation", + "" ].join("\n") + +#Built in patterns +PATTERNS = { 'src' => {'' => { :inc => [] } }, + 'dh' => {'Driver' => { :inc => ['%1$sHardware.h'] }, + 'Hardware' => { :inc => [] } + }, + 'dih' => {'Driver' => { :inc => ['%1$sHardware.h', '%1$sInterrupt.h'] }, + 'Interrupt'=> { :inc => ['%1$sHardware.h'] }, + 'Hardware' => { :inc => [] } + }, + 'mch' => {'Model' => { :inc => [] }, + 'Conductor'=> { :inc => ['%1$sModel.h', '%1$sHardware.h'] }, + 'Hardware' => { :inc => [] } + }, + 'mvp' => {'Model' => { :inc => [] }, + 'Presenter'=> { :inc => ['%1$sModel.h', '%1$sView.h'] }, + 'View' => { :inc => [] } + } + } + +#TEMPLATE_TST +TEMPLATE_TST = %q[#include "unity.h" +%2$s#include "%1$s.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void test_%1$s_NeedToImplement(void) +{ + TEST_IGNORE(); +} +] + +#TEMPLATE_SRC +TEMPLATE_SRC = %q[%2$s#include "%1$s.h" +] + +#TEMPLATE_INC +TEMPLATE_INC = %q[#ifndef _%3$s_H +#define _%3$s_H%2$s + +#endif // _%3$s_H +] + +# Parse the command line parameters. +ARGV.each do |arg| + case(arg) + when /^-d/ then @destroy = true + when /^-u/ then @update_svn = true + when /^-p(\w+)/ then @pattern = $1 + when /^-s(.+)/ then @path_src = $1 + when /^-i(.+)/ then @path_inc = $1 + when /^-t(.+)/ then @path_tst = $1 + when /^-y(.+)/ then @yaml_config = $1 + when /^(\w+)/ + raise "ERROR: You can't have more than one Module name specified!" unless @module_name.nil? + @module_name = arg + when /^-(h|-help)/ + puts HELP_TEXT + exit + else + raise "ERROR: Unknown option specified '#{arg}'" + end +end +raise "ERROR: You must have a Module name specified! (use option -h for help)" if @module_name.nil? + +#load yaml file if one was requested +if @yaml_config + require 'yaml' + cfg = YAML.load_file(HERE + @yaml_config)[:generate_module] + @path_src = cfg[:defaults][:path_src] if @path_src.nil? + @path_inc = cfg[:defaults][:path_inc] if @path_inc.nil? + @path_tst = cfg[:defaults][:path_tst] if @path_tst.nil? + @update_svn = cfg[:defaults][:update_svn] if @update_svn.nil? + @extra_inc = cfg[:includes] + @boilerplates = cfg[:boilerplates] +else + @boilerplates = {} +end + +# Create default file paths if none were provided +@path_src = HERE + "../src/" if @path_src.nil? +@path_inc = @path_src if @path_inc.nil? +@path_tst = HERE + "../test/" if @path_tst.nil? +@path_src += '/' unless (@path_src[-1] == 47) +@path_inc += '/' unless (@path_inc[-1] == 47) +@path_tst += '/' unless (@path_tst[-1] == 47) +@pattern = 'src' if @pattern.nil? +@includes = { :src => [], :inc => [], :tst => [] } +@includes.merge!(@extra_inc) unless @extra_inc.nil? + +#create triad definition +TRIAD = [ { :ext => '.c', :path => @path_src, :template => TEMPLATE_SRC, :inc => :src, :boilerplate => @boilerplates[:src] }, + { :ext => '.h', :path => @path_inc, :template => TEMPLATE_INC, :inc => :inc, :boilerplate => @boilerplates[:inc] }, + { :ext => '.c', :path => @path_tst+'Test', :template => TEMPLATE_TST, :inc => :tst, :boilerplate => @boilerplates[:tst] }, + ] + +#prepare the pattern for use +@patterns = PATTERNS[@pattern.downcase] +raise "ERROR: The design pattern specified isn't one that I recognize!" if @patterns.nil? + +# Assemble the path/names of the files we need to work with. +files = [] +TRIAD.each do |triad| + @patterns.each_pair do |pattern_file, pattern_traits| + files << { + :path => "#{triad[:path]}#{@module_name}#{pattern_file}#{triad[:ext]}", + :name => "#{@module_name}#{pattern_file}", + :template => triad[:template], + :boilerplate => triad[:boilerplate], + :includes => case(triad[:inc]) + when :src then @includes[:src] | pattern_traits[:inc].map{|f| f % [@module_name]} + when :inc then @includes[:inc] + when :tst then @includes[:tst] | pattern_traits[:inc].map{|f| "Mock#{f}"% [@module_name]} + end + } + end +end + +# destroy files if that was what was requested +if @destroy + files.each do |filespec| + file = filespec[:path] + if File.exist?(file) + if @update_svn + `svn delete \"#{file}\" --force` + puts "File #{file} deleted and removed from source control" + else + FileUtils.remove(file) + puts "File #{file} deleted" + end + else + puts "File #{file} does not exist so cannot be removed." + end + end + puts "Destroy Complete" + exit +end + +#Abort if any module already exists +files.each do |file| + raise "ERROR: File #{file[:name]} already exists. Exiting." if File.exist?(file[:path]) +end + +# Create Source Modules +files.each_with_index do |file, i| + File.open(file[:path], 'w') do |f| + f.write(file[:boilerplate] % [file[:name]]) unless file[:boilerplate].nil? + f.write(file[:template] % [ file[:name], + file[:includes].map{|f| "#include \"#{f}\"\n"}.join, + file[:name].upcase ] + ) + end + if (@update_svn) + `svn add \"#{file[:path]}\"` + if $?.exitstatus == 0 + puts "File #{file[:path]} created and added to source control" + else + puts "File #{file[:path]} created but FAILED adding to source control!" + end + else + puts "File #{file[:path]} created" + end +end + +puts 'Generate Complete' diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb new file mode 100644 index 0000000..aff5053 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb @@ -0,0 +1,303 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +File.expand_path(File.join(File.dirname(__FILE__),'colour_prompt')) + +class UnityTestRunnerGenerator + + def initialize(options = nil) + @options = { :includes => [], :plugins => [], :framework => :unity } + case(options) + when NilClass then @options + when String then @options.merge!(UnityTestRunnerGenerator.grab_config(options)) + when Hash then @options.merge!(options) + else raise "If you specify arguments, it should be a filename or a hash of options" + end + end + + def self.grab_config(config_file) + options = { :includes => [], :plugins => [], :framework => :unity } + unless (config_file.nil? or config_file.empty?) + require 'yaml' + yaml_guts = YAML.load_file(config_file) + options.merge!(yaml_guts[:unity] ? yaml_guts[:unity] : yaml_guts[:cmock]) + raise "No :unity or :cmock section found in #{config_file}" unless options + end + return(options) + end + + def run(input_file, output_file, options=nil) + tests = [] + includes = [] + used_mocks = [] + + @options.merge!(options) unless options.nil? + module_name = File.basename(input_file) + + #pull required data from source file + File.open(input_file, 'r') do |input| + tests = find_tests(input) + includes = find_includes(input) + used_mocks = find_mocks(includes) + end + + #build runner file + File.open(output_file, 'w') do |output| + create_header(output, used_mocks) + create_externs(output, tests, used_mocks) + create_mock_management(output, used_mocks) + create_suite_setup_and_teardown(output) + create_reset(output, used_mocks) + create_main(output, input_file, tests) + end + + all_files_used = [input_file, output_file] + all_files_used += includes.map {|filename| filename + '.c'} unless includes.empty? + all_files_used += @options[:includes] unless @options[:includes].empty? + return all_files_used.uniq + end + + def find_tests(input_file) + tests_raw = [] + tests_args = [] + tests_and_line_numbers = [] + + input_file.rewind + source_raw = input_file.read + source_scrubbed = source_raw.gsub(/\/\/.*$/, '') # remove line comments + source_scrubbed = source_scrubbed.gsub(/\/\*.*?\*\//m, '') # remove block comments + lines = source_scrubbed.split(/(^\s*\#.*$) # Treat preprocessor directives as a logical line + | (;|\{|\}) /x) # Match ;, {, and } as end of lines + + lines.each_with_index do |line, index| + #find tests + if line =~ /^((?:\s*TEST_CASE\s*\(.*?\)\s*)*)\s*void\s+(test.*?)\s*\(\s*(.*)\s*\)/ + arguments = $1 + name = $2 + call = $3 + args = nil + if (@options[:use_param_tests] and !arguments.empty?) + args = [] + arguments.scan(/\s*TEST_CASE\s*\((.*)\)\s*$/) {|a| args << a[0]} + end + tests_and_line_numbers << { :name => name, :args => args, :call => call, :line_number => 0 } + tests_args = [] + end + end + + #determine line numbers and create tests to run + source_lines = source_raw.split("\n") + source_index = 0; + tests_and_line_numbers.size.times do |i| + source_lines[source_index..-1].each_with_index do |line, index| + if (line =~ /#{tests_and_line_numbers[i][:name]}/) + source_index += index + tests_and_line_numbers[i][:line_number] = source_index + 1 + break + end + end + end + + return tests_and_line_numbers + end + + def find_includes(input_file) + input_file.rewind + includes = [] + input_file.readlines.each do |line| + scan_results = line.scan(/^\s*#include\s+\"\s*(.+)\.[hH]\s*\"/) + includes << scan_results[0][0] if (scan_results.size > 0) + end + return includes + end + + def find_mocks(includes) + mock_headers = [] + includes.each do |include_file| + mock_headers << File.basename(include_file) if (include_file =~ /^mock/i) + end + return mock_headers + end + + def create_header(output, mocks) + output.puts('/* AUTOGENERATED FILE. DO NOT EDIT. */') + create_runtest(output, mocks) + output.puts("\n//=======Automagically Detected Files To Include=====") + output.puts("#include \"#{@options[:framework].to_s}.h\"") + output.puts('#include "cmock.h"') unless (mocks.empty?) + @options[:includes].flatten.uniq.compact.each do |inc| + output.puts("#include #{inc.include?('<') ? inc : "\"#{inc.gsub('.h','')}.h\""}") + end + output.puts('#include ') + output.puts('#include ') + output.puts('#include "CException.h"') if @options[:plugins].include?(:cexception) + mocks.each do |mock| + output.puts("#include \"#{mock.gsub('.h','')}.h\"") + end + if @options[:enforce_strict_ordering] + output.puts('') + output.puts('int GlobalExpectCount;') + output.puts('int GlobalVerifyOrder;') + output.puts('char* GlobalOrderError;') + end + end + + def create_externs(output, tests, mocks) + output.puts("\n//=======External Functions This Runner Calls=====") + output.puts("extern void setUp(void);") + output.puts("extern void tearDown(void);") + tests.each do |test| + output.puts("extern void #{test[:name]}(#{test[:call]});") + end + output.puts('') + end + + def create_mock_management(output, mocks) + unless (mocks.empty?) + output.puts("\n//=======Mock Management=====") + output.puts("static void CMock_Init(void)") + output.puts("{") + if @options[:enforce_strict_ordering] + output.puts(" GlobalExpectCount = 0;") + output.puts(" GlobalVerifyOrder = 0;") + output.puts(" GlobalOrderError = NULL;") + end + mocks.each do |mock| + output.puts(" #{mock}_Init();") + end + output.puts("}\n") + + output.puts("static void CMock_Verify(void)") + output.puts("{") + mocks.each do |mock| + output.puts(" #{mock}_Verify();") + end + output.puts("}\n") + + output.puts("static void CMock_Destroy(void)") + output.puts("{") + mocks.each do |mock| + output.puts(" #{mock}_Destroy();") + end + output.puts("}\n") + end + end + + def create_suite_setup_and_teardown(output) + unless (@options[:suite_setup].nil?) + output.puts("\n//=======Suite Setup=====") + output.puts("static int suite_setup(void)") + output.puts("{") + output.puts(@options[:suite_setup]) + output.puts("}") + end + unless (@options[:suite_teardown].nil?) + output.puts("\n//=======Suite Teardown=====") + output.puts("static int suite_teardown(int num_failures)") + output.puts("{") + output.puts(@options[:suite_teardown]) + output.puts("}") + end + end + + def create_runtest(output, used_mocks) + cexception = @options[:plugins].include? :cexception + va_args1 = @options[:use_param_tests] ? ', ...' : '' + va_args2 = @options[:use_param_tests] ? '__VA_ARGS__' : '' + output.puts("\n//=======Test Runner Used To Run Each Test Below=====") + output.puts("#define RUN_TEST_NO_ARGS") if @options[:use_param_tests] + output.puts("#define RUN_TEST(TestFunc, TestLineNum#{va_args1}) \\") + output.puts("{ \\") + output.puts(" Unity.CurrentTestName = #TestFunc#{va_args2.empty? ? '' : " \"(\" ##{va_args2} \")\""}; \\") + output.puts(" Unity.CurrentTestLineNumber = TestLineNum; \\") + output.puts(" Unity.NumberOfTests++; \\") + output.puts(" if (TEST_PROTECT()) \\") + output.puts(" { \\") + output.puts(" CEXCEPTION_T e; \\") if cexception + output.puts(" Try { \\") if cexception + output.puts(" CMock_Init(); \\") unless (used_mocks.empty?) + output.puts(" setUp(); \\") + output.puts(" TestFunc(#{va_args2}); \\") + output.puts(" CMock_Verify(); \\") unless (used_mocks.empty?) + output.puts(" } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, \"Unhandled Exception!\"); } \\") if cexception + output.puts(" } \\") + output.puts(" CMock_Destroy(); \\") unless (used_mocks.empty?) + output.puts(" if (TEST_PROTECT() && !TEST_IS_IGNORED) \\") + output.puts(" { \\") + output.puts(" tearDown(); \\") + output.puts(" } \\") + output.puts(" UnityConcludeTest(); \\") + output.puts("}\n") + end + + def create_reset(output, used_mocks) + output.puts("\n//=======Test Reset Option=====") + output.puts("void resetTest()") + output.puts("{") + output.puts(" CMock_Verify();") unless (used_mocks.empty?) + output.puts(" CMock_Destroy();") unless (used_mocks.empty?) + output.puts(" tearDown();") + output.puts(" CMock_Init();") unless (used_mocks.empty?) + output.puts(" setUp();") + output.puts("}") + end + + def create_main(output, filename, tests) + output.puts("\n\n//=======MAIN=====") + output.puts("int main(void)") + output.puts("{") + output.puts(" suite_setup();") unless @options[:suite_setup].nil? + output.puts(" Unity.TestFile = \"#{filename}\";") + output.puts(" UnityBegin();") + if (@options[:use_param_tests]) + tests.each do |test| + if ((test[:args].nil?) or (test[:args].empty?)) + output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]}, RUN_TEST_NO_ARGS);") + else + test[:args].each {|args| output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]}, #{args});")} + end + end + else + tests.each { |test| output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]});") } + end + output.puts() + output.puts(" return #{@options[:suite_teardown].nil? ? "" : "suite_teardown"}(UnityEnd());") + output.puts("}") + end +end + + +if ($0 == __FILE__) + options = { :includes => [] } + yaml_file = nil + + #parse out all the options first + ARGV.reject! do |arg| + case(arg) + when '-cexception' + options[:plugins] = [:cexception]; true + when /\.*\.yml/ + options = UnityTestRunnerGenerator.grab_config(arg); true + else false + end + end + + #make sure there is at least one parameter left (the input file) + if !ARGV[0] + puts ["usage: ruby #{__FILE__} (yaml) (options) input_test_file output_test_runner (includes)", + " blah.yml - will use config options in the yml file (see docs)", + " -cexception - include cexception support"].join("\n") + exit 1 + end + + #create the default test runner name if not specified + ARGV[1] = ARGV[0].gsub(".c","_Runner.c") if (!ARGV[1]) + + #everything else is an include file + options[:includes] ||= (ARGV.slice(2..-1).flatten.compact) if (ARGV.size > 2) + + UnityTestRunnerGenerator.new(options).run(ARGV[0], ARGV[1]) +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/test_file_filter.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/test_file_filter.rb new file mode 100644 index 0000000..3dbc26a --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/test_file_filter.rb @@ -0,0 +1,23 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require'yaml' + +module RakefileHelpers + class TestFileFilter + def initialize(all_files = false) + @all_files = all_files + if not @all_files == true + if File.exist?('test_file_filter.yml') + filters = YAML.load_file( 'test_file_filter.yml' ) + @all_files, @only_files, @exclude_files = + filters[:all_files], filters[:only_files], filters[:exclude_files] + end + end + end + attr_accessor :all_files, :only_files, :exclude_files + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/unity_test_summary.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/unity_test_summary.rb new file mode 100644 index 0000000..69ec2e8 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/unity_test_summary.rb @@ -0,0 +1,126 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +#!/usr/bin/ruby +# +# unity_test_summary.rb +# +require 'fileutils' +require 'set' + +class UnityTestSummary + include FileUtils::Verbose + + attr_reader :report, :total_tests, :failures, :ignored + + def initialize + @report = '' + @total_tests = 0 + @failures = 0 + @ignored = 0 + end + + def run + # Clean up result file names + results = @targets.map {|target| target.gsub(/\\/,'/')} + + # Dig through each result file, looking for details on pass/fail: + failure_output = [] + ignore_output = [] + + results.each do |result_file| + lines = File.readlines(result_file).map { |line| line.chomp } + if lines.length == 0 + raise "Empty test result file: #{result_file}" + else + output = get_details(result_file, lines) + failure_output << output[:failures] unless output[:failures].empty? + ignore_output << output[:ignores] unless output[:ignores].empty? + tests,failures,ignored = parse_test_summary(lines) + @total_tests += tests + @failures += failures + @ignored += ignored + end + end + + if @ignored > 0 + @report += "\n" + @report += "--------------------------\n" + @report += "UNITY IGNORED TEST SUMMARY\n" + @report += "--------------------------\n" + @report += ignore_output.flatten.join("\n") + end + + if @failures > 0 + @report += "\n" + @report += "--------------------------\n" + @report += "UNITY FAILED TEST SUMMARY\n" + @report += "--------------------------\n" + @report += failure_output.flatten.join("\n") + end + + @report += "\n" + @report += "--------------------------\n" + @report += "OVERALL UNITY TEST SUMMARY\n" + @report += "--------------------------\n" + @report += "#{@total_tests} TOTAL TESTS #{@failures} TOTAL FAILURES #{@ignored} IGNORED\n" + @report += "\n" + end + + def set_targets(target_array) + @targets = target_array + end + + def set_root_path(path) + @root = path + end + + def usage(err_msg=nil) + puts err_msg if err_msg + puts "Usage: unity_test_summary.rb" + exit 1 + end + + protected + + @@targets=nil + @@path=nil + @@root=nil + + def get_details(result_file, lines) + results = { :failures => [], :ignores => [], :successes => [] } + lines.each do |line| + src_file,src_line,test_name,status,msg = line.split(/:/) + line_out = ((@root and (@root != 0)) ? "#{@root}#{line}" : line ).gsub(/\//, "\\") + case(status) + when 'IGNORE' then results[:ignores] << line_out + when 'FAIL' then results[:failures] << line_out + when 'PASS' then results[:successes] << line_out + end + end + return results + end + + def parse_test_summary(summary) + if summary[-3..-1].join("\n") =~ /(\d+) Tests (\d+) Failures (\d+) Ignored/ + [$1.to_i,$2.to_i,$3.to_i] + else + raise "Couldn't parse test results: #{summary}" + end + end + + def here; File.expand_path(File.dirname(__FILE__)); end + +end + +if $0 == __FILE__ + script = UnityTestSummary.new + begin + script.run + rescue Exception => e + script.usage e.message + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/docs/Unity Summary.odt b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/docs/Unity Summary.odt new file mode 100644 index 0000000..f699661 Binary files /dev/null and b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/docs/Unity Summary.odt differ diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/docs/Unity Summary.pdf b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/docs/Unity Summary.pdf new file mode 100644 index 0000000..ad1a956 Binary files /dev/null and b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/docs/Unity Summary.pdf differ diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/docs/Unity Summary.txt b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/docs/Unity Summary.txt new file mode 100644 index 0000000..e0b179d --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/docs/Unity Summary.txt @@ -0,0 +1,217 @@ +============== +Unity Test API +============== + +[Copyright (c) 2007 - Unity Project by Mike Karlesky, Mark VanderVoord, and Greg Williams] + +------------- +Running Tests +------------- + +RUN_TEST(func, linenum) + +Each Test is run within the macro RUN_TEST. This macro performs necessary setup before the test is called and handles cleanup and result tabulation afterwards. + +-------------- +Ignoring Tests +-------------- + +There are times when a test is incomplete or not valid for some reason. At these times, TEST_IGNORE can be called. Control will immediately be returned to the caller of the test, and no failures will be returned. + +TEST_IGNORE() + +Ignore this test and return immediately + +TEST_IGNORE_MESSAGE (message) + +Ignore this test and return immediately. Output a message stating why the test was ignored. + +-------------- +Aborting Tests +-------------- + +There are times when a test will contain an infinite loop on error conditions, or there may be reason to escape from the test early without executing the rest of the test. A pair of macros support this functionality in Unity. The first (TEST_PROTECT) sets up the feature, and handles emergency abort cases. TEST_ABORT can then be used at any time within the tests to return to the last TEST_PROTECT call. + +TEST_PROTECT() + +Setup and Catch macro + +TEST_ABORT() + +Abort Test macro + +Example: + +main() +{ + if (TEST_PROTECT() == 0) + { + MyTest(); + } +} + +If MyTest calls TEST_ABORT, program control will immediately return to TEST_PROTECT with a non-zero return value. + + +======================= +Unity Assertion Summary +======================= + +-------------------- +Basic Validity Tests +-------------------- + +TEST_ASSERT_TRUE(condition) + +Evaluates whatever code is in condition and fails if it evaluates to false + +TEST_ASSERT_FALSE(condition) + +Evaluates whatever code is in condition and fails if it evaluates to true + +TEST_ASSERT(condition) + +Another way of calling TEST_ASSERT_TRUE + +TEST_ASSERT_UNLESS(condition) + +Another way of calling TEST_ASSERT_FALSE + +TEST_FAIL() +TEST_FAIL_MESSAGE(message) + +This test is automatically marked as a failure. The message is output stating why. + +------------------------------ +Numerical Assertions: Integers +------------------------------ + +TEST_ASSERT_EQUAL_INT(expected, actual) +TEST_ASSERT_EQUAL_INT8(expected, actual) +TEST_ASSERT_EQUAL_INT16(expected, actual) +TEST_ASSERT_EQUAL_INT32(expected, actual) +TEST_ASSERT_EQUAL_INT64(expected, actual) + +Compare two integers for equality and display errors as signed integers. A cast will be performed +to your natural integer size so often this can just be used. When you need to specify the exact size, +like when comparing arrays, you can use a specific version: + + + +TEST_ASSERT_EQUAL_UINT(expected, actual) + +Compare two integers for equality and display errors as unsigned integers. Like INT, there are +variants for different sizes also. + + + +TEST_ASSERT_EQUAL_HEX(expected, actual) + +Compares two integers for equality and display errors as hexadecimal. Like the other integer comparisons, +you can specify the size... here the size will also effect how many nibbles are shown (for example, HEX16 +will show 4 nibbles). + +_ARRAY + +You can append _ARRAY to any of these macros to make an array comparison of that type. Here you will +need to care a bit more about the actual size of the value being checked. You will also specify an +additional argument which is the number of elements to compare. For example: + +TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, elements) + + +TEST_ASSERT_EQUAL(expected, actual) + +Another way of calling TEST_ASSERT_EQUAL_INT + + + +TEST_ASSERT_INT_WITHIN(delta, expected, actual) + +Asserts that the actual value is within plus or minus delta of the expected value. This also comes in +size specific variants. + + +----------------------------- +Numerical Assertions: Bitwise +----------------------------- + +TEST_ASSERT_BITS(mask, expected, actual) + +Use an integer mask to specify which bits should be compared between two other integers. High bits in the mask are compared, low bits ignored. + +TEST_ASSERT_BITS_HIGH(mask, actual) + +Use an integer mask to specify which bits should be inspected to determine if they are all set high. High bits in the mask are compared, low bits ignored. + +TEST_ASSERT_BITS_LOW(mask, actual) + +Use an integer mask to specify which bits should be inspected to determine if they are all set low. High bits in the mask are compared, low bits ignored. + +TEST_ASSERT_BIT_HIGH(bit, actual) + +Test a single bit and verify that it is high. The bit is specified 0-31 for a 32-bit integer. + +TEST_ASSERT_BIT_LOW(bit, actual) + +Test a single bit and verify that it is low. The bit is specified 0-31 for a 32-bit integer. + +---------------------------- +Numerical Assertions: Floats +---------------------------- + +TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual) + +Asserts that the actual value is within plus or minus delta of the expected value. + +TEST_ASSERT_EQUAL_FLOAT(expected, actual) + +Asserts that two floating point values are "equal" within a small % delta of the expected value. + +----------------- +String Assertions +----------------- + +TEST_ASSERT_EQUAL_STRING(expected, actual) + +Compare two null-terminate strings. Fail if any character is different or if the lengths are different. + +TEST_ASSERT_EQUAL_STRING_MESSAGE(expected, actual, message) + +Compare two null-terminate strings. Fail if any character is different or if the lengths are different. Output a custom message on failure. + +------------------ +Pointer Assertions +------------------ + +Most pointer operations can be performed by simply using the integer comparisons above. However, a couple of special cases are added for clarity. + +TEST_ASSERT_NULL(pointer) + +Fails if the pointer is not equal to NULL + +TEST_ASSERT_NOT_NULL(pointer) + +Fails if the pointer is equal to NULL + + +----------------- +Memory Assertions +----------------- + +TEST_ASSERT_EQUAL_MEMORY(expected, actual, len) + +Compare two blocks of memory. This is a good generic assertion for types that can't be coerced into acting like +standard types... but since it's a memory compare, you have to be careful that your data types are packed. + +-------- +_MESSAGE +-------- + +you can append _MESSAGE to any of the macros to make them take an additional argument. This argument +is a string that will be printed at the end of the failure strings. This is useful for specifying more +information about the problem. + + + + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/docs/license.txt b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/docs/license.txt new file mode 100644 index 0000000..c42e330 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/docs/license.txt @@ -0,0 +1,31 @@ + Copyright (c) 2007-2010 Mike Karlesky, Mark VanderVoord, Greg Williams + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + The end-user documentation included with the redistribution, if + any, must include the following acknowledgment: "This product + includes software developed for the Unity Project, by Mike Karlesky, + Mark VanderVoord, and Greg Williams and other contributors", in + the same place and form as other third-party acknowledgments. + Alternately, this acknowledgment may appear in the software + itself, in the same form and location as other such third-party + acknowledgments. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.c new file mode 100644 index 0000000..9cf42c6 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.c @@ -0,0 +1,10 @@ +#include "unity.h" +#include "UnityHelper.h" +#include +#include + +void AssertEqualExampleStruct(const EXAMPLE_STRUCT_T expected, const EXAMPLE_STRUCT_T actual, const unsigned short line) +{ + UNITY_TEST_ASSERT_EQUAL_INT(expected.x, actual.x, line, "Example Struct Failed For Field x"); + UNITY_TEST_ASSERT_EQUAL_INT(expected.y, actual.y, line, "Example Struct Failed For Field y"); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.h b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.h new file mode 100644 index 0000000..1516111 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.h @@ -0,0 +1,12 @@ +#ifndef _TESTHELPER_H +#define _TESTHELPER_H + +#include "Types.h" + +void AssertEqualExampleStruct(const EXAMPLE_STRUCT_T expected, const EXAMPLE_STRUCT_T actual, const unsigned short line); + +#define UNITY_TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(expected, actual, line, message) AssertEqualExampleStruct(expected, actual, line); + +#define TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(expected, actual) UNITY_TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(expected, actual, __LINE__, NULL); + +#endif // _TESTHELPER_H diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/makefile b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/makefile new file mode 100644 index 0000000..723d390 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/makefile @@ -0,0 +1,40 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +C_COMPILER=gcc +TARGET_BASE1=test1 +TARGET_BASE2=test2 +ifeq ($(OS),Windows_NT) + TARGET_EXTENSION=.exe +else + TARGET_EXTENSION=.out +endif +TARGET1 = $(TARGET_BASE1)$(TARGET_EXTENSION) +TARGET2 = $(TARGET_BASE2)$(TARGET_EXTENSION) +SRC_FILES1=../src/unity.c src/ProductionCode.c test/TestProductionCode.c test/no_ruby/TestProductionCode_Runner.c +SRC_FILES2=../src/unity.c src/ProductionCode2.c test/TestProductionCode2.c test/no_ruby/TestProductionCode2_Runner.c +INC_DIRS=-Isrc -I../src +SYMBOLS=-DTEST + +ifeq ($(OS),Windows_NT) + CLEANUP = del /F /Q build\* && del /F /Q $(TARGET1) && del /F /Q $(TARGET2) +else + CLEANUP = rm -f build/*.o ; rm -f $(TARGET1) ; rm -f $(TARGET2) +endif + +all: clean default + +default: +# ruby auto/generate_test_runner.rb test/TestProductionCode.c test/no_ruby/TestProductionCode_Runner.c +# ruby auto/generate_test_runner.rb test/TestProductionCode2.c test/no_ruby/TestProductionCode2_Runner.c + $(C_COMPILER) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES1) -o $(TARGET1) + $(C_COMPILER) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES2) -o $(TARGET2) + $(TARGET1) + $(TARGET2) + +clean: + $(CLEANUP) + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/rakefile.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/rakefile.rb new file mode 100644 index 0000000..0905b4b --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/rakefile.rb @@ -0,0 +1,32 @@ +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require HERE+'rakefile_helper' + +include RakefileHelpers + +# Load default configuration, for now +DEFAULT_CONFIG_FILE = 'gcc.yml' +configure_toolchain(DEFAULT_CONFIG_FILE) + +task :unit do + run_tests get_unit_test_files +end + +desc "Generate test summary" +task :summary do + report_summary +end + +desc "Build and test Unity" +task :all => [:clean, :unit, :summary] +task :default => [:clobber, :all] +task :ci => [:default] +task :cruise => [:default] + +desc "Load configuration" +task :config, :config_file do |t, args| + configure_toolchain(args[:config_file]) +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/rakefile_helper.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/rakefile_helper.rb new file mode 100644 index 0000000..0127d69 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/rakefile_helper.rb @@ -0,0 +1,260 @@ +require 'yaml' +require 'fileutils' +require HERE+'../auto/unity_test_summary' +require HERE+'../auto/generate_test_runner' +require HERE+'../auto/colour_reporter' + +module RakefileHelpers + + C_EXTENSION = '.c' + + def load_configuration(config_file) + $cfg_file = "../targets/#{config_file}" + $cfg = YAML.load(File.read($cfg_file)) + end + + def configure_clean + CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil? + end + + def configure_toolchain(config_file=DEFAULT_CONFIG_FILE) + config_file += '.yml' unless config_file =~ /\.yml$/ + load_configuration('../targets/'+config_file) + configure_clean + end + + def get_unit_test_files + path = $cfg['compiler']['unit_tests_path'] + 'Test*' + C_EXTENSION + path.gsub!(/\\/, '/') + FileList.new(path) + end + + def get_local_include_dirs + include_dirs = $cfg['compiler']['includes']['items'].dup + include_dirs.delete_if {|dir| dir.is_a?(Array)} + return include_dirs + end + + def extract_headers(filename) + includes = [] + lines = File.readlines(filename) + lines.each do |line| + m = line.match(/^\s*#include\s+\"\s*(.+\.[hH])\s*\"/) + if not m.nil? + includes << m[1] + end + end + return includes + end + + def find_source_file(header, paths) + paths.each do |dir| + src_file = dir + header.ext(C_EXTENSION) + if (File.exists?(src_file)) + return src_file + end + end + return nil + end + + def tackit(strings) + if strings.is_a?(Array) + result = "\"#{strings.join}\"" + else + result = strings + end + return result + end + + def squash(prefix, items) + result = '' + items.each { |item| result += " #{prefix}#{tackit(item)}" } + return result + end + + def build_compiler_fields + command = tackit($cfg['compiler']['path']) + if $cfg['compiler']['defines']['items'].nil? + defines = '' + else + defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items']) + end + options = squash('', $cfg['compiler']['options']) + includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :defines => defines, :options => options, :includes => includes} + end + + def compile(file, defines=[]) + compiler = build_compiler_fields + cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{file} " + + "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" + + "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" + execute(cmd_str) + end + + def build_linker_fields + command = tackit($cfg['linker']['path']) + if $cfg['linker']['options'].nil? + options = '' + else + options = squash('', $cfg['linker']['options']) + end + if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?) + includes = '' + else + includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) + end + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :options => options, :includes => includes} + end + + def link(exe_name, obj_list) + linker = build_linker_fields + cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + + (obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).join + + $cfg['linker']['bin_files']['prefix'] + ' ' + + $cfg['linker']['bin_files']['destination'] + + exe_name + $cfg['linker']['bin_files']['extension'] + execute(cmd_str) + end + + def build_simulator_fields + return nil if $cfg['simulator'].nil? + if $cfg['simulator']['path'].nil? + command = '' + else + command = (tackit($cfg['simulator']['path']) + ' ') + end + if $cfg['simulator']['pre_support'].nil? + pre_support = '' + else + pre_support = squash('', $cfg['simulator']['pre_support']) + end + if $cfg['simulator']['post_support'].nil? + post_support = '' + else + post_support = squash('', $cfg['simulator']['post_support']) + end + return {:command => command, :pre_support => pre_support, :post_support => post_support} + end + + def execute(command_string, verbose=true, raise_on_fail=true) + report command_string + output = `#{command_string}`.chomp + report(output) if (verbose && !output.nil? && (output.length > 0)) + if (($?.exitstatus != 0) and (raise_on_fail)) + raise "Command failed. (Returned #{$?.exitstatus})" + end + return output + end + + def report_summary + summary = UnityTestSummary.new + summary.set_root_path(HERE) + results_glob = "#{$cfg['compiler']['build_path']}*.test*" + results_glob.gsub!(/\\/, '/') + results = Dir[results_glob] + summary.set_targets(results) + summary.run + fail_out "FAIL: There were failures" if (summary.failures > 0) + end + + def run_tests(test_files) + + report 'Running system tests...' + + # Tack on TEST define for compiling unit tests + load_configuration($cfg_file) + test_defines = ['TEST'] + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + $cfg['compiler']['defines']['items'] << 'TEST' + + include_dirs = get_local_include_dirs + + # Build and execute each unit test + test_files.each do |test| + obj_list = [] + + # Detect dependencies and build required required modules + extract_headers(test).each do |header| + # Compile corresponding source file if it exists + src_file = find_source_file(header, include_dirs) + if !src_file.nil? + compile(src_file, test_defines) + obj_list << header.ext($cfg['compiler']['object_files']['extension']) + end + end + + # Build the test runner (generate if configured to do so) + test_base = File.basename(test, C_EXTENSION) + runner_name = test_base + '_Runner.c' + if $cfg['compiler']['runner_path'].nil? + runner_path = $cfg['compiler']['build_path'] + runner_name + test_gen = UnityTestRunnerGenerator.new($cfg_file) + test_gen.run(test, runner_path) + else + runner_path = $cfg['compiler']['runner_path'] + runner_name + end + + compile(runner_path, test_defines) + obj_list << runner_name.ext($cfg['compiler']['object_files']['extension']) + + # Build the test module + compile(test, test_defines) + obj_list << test_base.ext($cfg['compiler']['object_files']['extension']) + + # Link the test executable + link(test_base, obj_list) + + # Execute unit test and generate results file + simulator = build_simulator_fields + executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] + if simulator.nil? + cmd_str = executable + else + cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" + end + output = execute(cmd_str, true, false) + test_results = $cfg['compiler']['build_path'] + test_base + if output.match(/OK$/m).nil? + test_results += '.testfail' + else + test_results += '.testpass' + end + File.open(test_results, 'w') { |f| f.print output } + end + end + + def build_application(main) + + report "Building application..." + + obj_list = [] + load_configuration($cfg_file) + main_path = $cfg['compiler']['source_path'] + main + C_EXTENSION + + # Detect dependencies and build required required modules + include_dirs = get_local_include_dirs + extract_headers(main_path).each do |header| + src_file = find_source_file(header, include_dirs) + if !src_file.nil? + compile(src_file) + obj_list << header.ext($cfg['compiler']['object_files']['extension']) + end + end + + # Build the main source file + main_base = File.basename(main_path, C_EXTENSION) + compile(main_path) + obj_list << main_base.ext($cfg['compiler']['object_files']['extension']) + + # Create the executable + link(main_base, obj_list) + end + + def fail_out(msg) + puts msg + exit(-1) + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/readme.txt b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/readme.txt new file mode 100644 index 0000000..6c7780e --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/readme.txt @@ -0,0 +1,18 @@ +Example Project + +This example project gives an example of some passing, ignored, and failing tests. +It's simple and meant for you to look over and get an idea for what all of this stuff does. + +You can build and test using the makefile if you have gcc installed (you may need to tweak +the locations of some tools in the makefile). Otherwise, the rake version will let you +test with gcc or a couple versions of IAR. You can tweak the yaml files to get those versions +running. + +Ruby is required if you're using the rake version (obviously). This version shows off most of +Unity's advanced features (automatically creating test runners, fancy summaries, etc.) + +The makefile version doesn't require anything outside of your normal build tools, but won't do the +extras for you. So that you can test right away, we've written the test runners for you and +put them in the test\no_ruby subdirectory. If you make changes to the tests or source, you might +need to update these (like when you add or remove tests). Do that for a while and you'll learn +why you really want to start using the Ruby tools. \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/src/ProductionCode.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/src/ProductionCode.c new file mode 100644 index 0000000..500b44b --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/src/ProductionCode.c @@ -0,0 +1,24 @@ + +#include "ProductionCode.h" + +int Counter = 0; +int NumbersToFind[9] = { 0, 34, 55, 66, 32, 11, 1, 77, 888 }; //some obnoxious array to search that is 1-based indexing instead of 0. + +// This function is supposed to search through NumbersToFind and find a particular number. +// If it finds it, the index is returned. Otherwise 0 is returned which sorta makes sense since +// NumbersToFind is indexed from 1. Unfortunately it's broken +// (and should therefore be caught by our tests) +int FindFunction_WhichIsBroken(int NumberToFind) +{ + int i = 0; + while (i <= 8) //Notice I should have been in braces + i++; + if (NumbersToFind[i] == NumberToFind) //Yikes! I'm getting run after the loop finishes instead of during it! + return i; + return 0; +} + +int FunctionWhichReturnsLocalVariable(void) +{ + return Counter; +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/src/ProductionCode.h b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/src/ProductionCode.h new file mode 100644 index 0000000..250ca0d --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/src/ProductionCode.h @@ -0,0 +1,3 @@ + +int FindFunction_WhichIsBroken(int NumberToFind); +int FunctionWhichReturnsLocalVariable(void); diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/src/ProductionCode2.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/src/ProductionCode2.c new file mode 100644 index 0000000..a8c72e1 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/src/ProductionCode2.c @@ -0,0 +1,9 @@ + +#include "ProductionCode2.h" + +char* ThisFunctionHasNotBeenTested(int Poor, char* LittleFunction) +{ + //Since There Are No Tests Yet, This Function Could Be Empty For All We Know. + // Which isn't terribly useful... but at least we put in a TEST_IGNORE so we won't forget + return (char*)0; +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/src/ProductionCode2.h b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/src/ProductionCode2.h new file mode 100644 index 0000000..34ae980 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/src/ProductionCode2.h @@ -0,0 +1,2 @@ + +char* ThisFunctionHasNotBeenTested(int Poor, char* LittleFunction); diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/test/TestProductionCode.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/test/TestProductionCode.c new file mode 100644 index 0000000..28a5581 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/test/TestProductionCode.c @@ -0,0 +1,62 @@ + +#include "ProductionCode.h" +#include "unity.h" + +//sometimes you may want to get at local data in a module. +//for example: If you plan to pass by reference, this could be useful +//however, it should often be avoided +extern int Counter; + +void setUp(void) +{ + //This is run before EACH TEST + Counter = 0x5a5a; +} + +void tearDown(void) +{ +} + +void test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode(void) +{ + //All of these should pass + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(78)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(1)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(33)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(999)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(-1)); +} + +void test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken(void) +{ + // You should see this line fail in your test summary + TEST_ASSERT_EQUAL(1, FindFunction_WhichIsBroken(34)); + + // Notice the rest of these didn't get a chance to run because the line above failed. + // Unit tests abort each test function on the first sign of trouble. + // Then NEXT test function runs as normal. + TEST_ASSERT_EQUAL(8, FindFunction_WhichIsBroken(8888)); +} + +void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue(void) +{ + //This should be true because setUp set this up for us before this test + TEST_ASSERT_EQUAL_HEX(0x5a5a, FunctionWhichReturnsLocalVariable()); + + //This should be true because we can still change our answer + Counter = 0x1234; + TEST_ASSERT_EQUAL_HEX(0x1234, FunctionWhichReturnsLocalVariable()); +} + +void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain(void) +{ + //This should be true again because setup was rerun before this test (and after we changed it to 0x1234) + TEST_ASSERT_EQUAL_HEX(0x5a5a, FunctionWhichReturnsLocalVariable()); +} + +void test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed(void) +{ + //Sometimes you get the test wrong. When that happens, you get a failure too... and a quick look should tell + // you what actually happened...which in this case was a failure to setup the initial condition. + TEST_ASSERT_EQUAL_HEX(0x1234, FunctionWhichReturnsLocalVariable()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/test/TestProductionCode2.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/test/TestProductionCode2.c new file mode 100644 index 0000000..20c9251 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/test/TestProductionCode2.c @@ -0,0 +1,26 @@ + +#include "ProductionCode2.h" +#include "unity.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void test_IgnoredTest(void) +{ + TEST_IGNORE_MESSAGE("This Test Was Ignored On Purpose"); +} + +void test_AnotherIgnoredTest(void) +{ + TEST_IGNORE_MESSAGE("These Can Be Useful For Leaving Yourself Notes On What You Need To Do Yet"); +} + +void test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented(void) +{ + TEST_IGNORE(); //Like This +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode2_Runner.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode2_Runner.c new file mode 100644 index 0000000..56515ae --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode2_Runner.c @@ -0,0 +1,46 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ +#include "unity.h" +#include +#include + +char MessageBuffer[50]; + +extern void setUp(void); +extern void tearDown(void); + +extern void test_IgnoredTest(void); +extern void test_AnotherIgnoredTest(void); +extern void test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented(void); + +static void runTest(UnityTestFunction test) +{ + if (TEST_PROTECT()) + { + setUp(); + test(); + } + if (TEST_PROTECT() && !TEST_IS_IGNORED) + { + tearDown(); + } +} +void resetTest() +{ + tearDown(); + setUp(); +} + + +int main(void) +{ + Unity.TestFile = "test/TestProductionCode2.c"; + UnityBegin(); + + // RUN_TEST calls runTest + RUN_TEST(test_IgnoredTest, 13); + RUN_TEST(test_AnotherIgnoredTest, 18); + RUN_TEST(test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented, 23); + + UnityEnd(); + return 0; +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode_Runner.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode_Runner.c new file mode 100644 index 0000000..64112f3 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode_Runner.c @@ -0,0 +1,50 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ +#include "unity.h" +#include +#include + +char MessageBuffer[50]; + +extern void setUp(void); +extern void tearDown(void); + +extern void test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode(void); +extern void test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken(void); +extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue(void); +extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain(void); +extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed(void); + +static void runTest(UnityTestFunction test) +{ + if (TEST_PROTECT()) + { + setUp(); + test(); + } + if (TEST_PROTECT() && !TEST_IS_IGNORED) + { + tearDown(); + } +} +void resetTest() +{ + tearDown(); + setUp(); +} + + +int main(void) +{ + Unity.TestFile = "test/TestProductionCode.c"; + UnityBegin(); + + // RUN_TEST calls runTest + RUN_TEST(test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode, 20); + RUN_TEST(test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken, 30); + RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue, 41); + RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain, 51); + RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed, 57); + + UnityEnd(); + return 0; +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/build/MakefileWorker.mk b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/build/MakefileWorker.mk new file mode 100644 index 0000000..9948751 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/build/MakefileWorker.mk @@ -0,0 +1,331 @@ +#--------- +# +# MakefileWorker.mk +# +# Include this helper file in your makefile +# It makes +# A static library holding the application objs +# A test executable +# +# See this example for parameter settings +# examples/Makefile +# +#---------- +# Inputs - these variables describe what to build +# +# INCLUDE_DIRS - Directories used to search for include files. +# This generates a -I for each directory +# SRC_DIRS - Directories containing source file to built into the library +# SRC_FILES - Specific source files to build into library. Helpful when not all code +# in a directory can be built for test (hopefully a temporary situation) +# TEST_SRC_DIRS - Directories containing unit test code build into the unit test runner +# These do not go in a library. They are explicitly included in the test runner +# MOCKS_SRC_DIRS - Directories containing mock source files to build into the test runner +# These do not go in a library. They are explicitly included in the test runner +#---------- +# You can adjust these variables to influence how to build the test target +# and where to put and name outputs +# See below to determine defaults +# COMPONENT_NAME - the name of the thing being built +# UNITY_HOME - where Unity home dir found +# UNITY_BUILD_HOME - place for scripts +# UNITY_OBJS_DIR - a directory where o and d files go +# UNITY_LIB_DIR - a directory where libs go +# UNITY_ENABLE_DEBUG - build for debug +# UNITY_USE_MEM_LEAK_DETECTION - Links with overridden new and delete +# UNITY_USE_STD_CPP_LIB - Set to N to keep the standard C++ library out +# of the test harness +# UNITY_USE_GCOV - Turn on coverage analysis +# Clean then build with this flag set to Y, then 'make gcov' +# UNITY_TEST_RUNNER_FLAGS +# None by default +# UNITY_MAPFILE - generate a map file +# UNITY_WARNINGFLAGS - overly picky by default +# OTHER_MAKEFILE_TO_INCLUDE - a hook to use this makefile to make +# other targets. Like CSlim, which is part of fitnesse +#---------- +# +# Other flags users can initialize to sneak in their settings +# UNITY_CFLAGS - C complier +# UNITY_LDFLAGS - Linker flags +#---------- + + +ifndef COMPONENT_NAME + COMPONENT_NAME = name_this_in_the_makefile +endif + +# Debug on by default +ifndef UNITY_ENABLE_DEBUG + UNITY_ENABLE_DEBUG = Y +endif + +# new and delete for memory leak detection on by default +ifndef UNITY_USE_MEM_LEAK_DETECTION + UNITY_USE_MEM_LEAK_DETECTION = Y +endif + +# Use gcov, off by default +ifndef UNITY_USE_GCOV + UNITY_USE_GCOV = N +endif + +# Default warnings +ifndef UNITY_WARNINGFLAGS + UNITY_WARNINGFLAGS = -Wall -Werror -Wshadow -Wswitch-default +endif + +# Default dir for temporary files (d, o) +ifndef UNITY_OBJS_DIR + UNITY_OBJS_DIR = objs +endif + +# Default dir for the outout library +ifndef UNITY_LIB_DIR + UNITY_LIB_DIR = lib +endif + +# No map by default +ifndef UNITY_MAP_FILE + UNITY_MAP_FILE = N +endif + +#Not verbose by deafult +ifdef VERBOSE + UNITY_TEST_RUNNER_FLAGS += -v +endif + +ifdef GROUP + UNITY_TEST_RUNNER_FLAGS += -g $(GROUP) +endif + +ifdef NAME + UNITY_TEST_RUNNER_FLAGS += -n $(NAME) +endif + +ifdef REPEAT + UNITY_TEST_RUNNER_FLAGS += -r $(REPEAT) +endif + + +# -------------------------------------- +# derived flags in the following area +# -------------------------------------- +ifeq ($(UNITY_USE_MEM_LEAK_DETECTION), N) + UNITY_CFLAGS += -DUNITY_MEM_LEAK_DETECTION_DISABLED +else + UNITY_MEMLEAK_DETECTOR_MALLOC_MACRO_FILE = -include $(UNITY_HOME)/extras/fixture/src/unity_fixture_malloc_overrides.h +endif + +ifeq ($(UNITY_ENABLE_DEBUG), Y) + UNITY_CFLAGS += -g +endif + +ifeq ($(UNITY_USE_GCOV), Y) + UNITY_CFLAGS += -fprofile-arcs -ftest-coverage +endif + +UNITY_CFLAGS += $(UNITY_MEMLEAK_DETECTOR_MALLOC_MACRO_FILE) + +TARGET_MAP = $(COMPONENT_NAME).map.txt +ifeq ($(UNITY_MAP_FILE), Y) + UNITY_LDFLAGS += -Wl,-map,$(TARGET_MAP) +endif + +LD_LIBRARIES += -lgcov + +TARGET_LIB = \ + $(UNITY_LIB_DIR)/lib$(COMPONENT_NAME).a + +TEST_TARGET = \ + $(COMPONENT_NAME)_tests + +#Helper Functions +get_src_from_dir = $(wildcard $1/*.cpp) $(wildcard $1/*.c) +get_dirs_from_dirspec = $(wildcard $1) +get_src_from_dir_list = $(foreach dir, $1, $(call get_src_from_dir,$(dir))) +__src_to = $(subst .c,$1, $(subst .cpp,$1,$2)) +src_to = $(addprefix $(UNITY_OBJS_DIR)/,$(call __src_to,$1,$2)) +src_to_o = $(call src_to,.o,$1) +src_to_d = $(call src_to,.d,$1) +src_to_gcda = $(call src_to,.gcda,$1) +src_to_gcno = $(call src_to,.gcno,$1) +make_dotdot_a_subdir = $(subst ..,_dot_dot, $1) +time = $(shell date +%s) +delta_t = $(eval minus, $1, $2) +debug_print_list = $(foreach word,$1,echo " $(word)";) echo; + +#Derived +STUFF_TO_CLEAN += $(TEST_TARGET) $(TEST_TARGET).exe $(TARGET_LIB) $(TARGET_MAP) + +SRC += $(call get_src_from_dir_list, $(SRC_DIRS)) $(SRC_FILES) +OBJ = $(call src_to_o,$(SRC)) +OBJ2 = $(call make_dotdot_a_subdir. $(OBJ)) + +STUFF_TO_CLEAN += $(OBJ) + +TEST_SRC = $(call get_src_from_dir_list, $(TEST_SRC_DIRS)) +TEST_OBJS = $(call src_to_o,$(TEST_SRC)) +STUFF_TO_CLEAN += $(TEST_OBJS) + + +MOCKS_SRC = $(call get_src_from_dir_list, $(MOCKS_SRC_DIRS)) +MOCKS_OBJS = $(call src_to_o,$(MOCKS_SRC)) +STUFF_TO_CLEAN += $(MOCKS_OBJS) + +ALL_SRC = $(SRC) $(TEST_SRC) $(MOCKS_SRC) + +#Test coverage with gcov +GCOV_OUTPUT = gcov_output.txt +GCOV_REPORT = gcov_report.txt +GCOV_ERROR = gcov_error.txt +GCOV_GCDA_FILES = $(call src_to_gcda, $(ALL_SRC)) +GCOV_GCNO_FILES = $(call src_to_gcno, $(ALL_SRC)) +TEST_OUTPUT = $(TEST_TARGET).txt +STUFF_TO_CLEAN += \ + $(GCOV_OUTPUT)\ + $(GCOV_REPORT)\ + $(GCOV_REPORT).html\ + $(GCOV_ERROR)\ + $(GCOV_GCDA_FILES)\ + $(GCOV_GCNO_FILES)\ + $(TEST_OUTPUT) + + +#The gcda files for gcov need to be deleted before each run +#To avoid annoying messages. +GCOV_CLEAN = $(SILENCE)rm -f $(GCOV_GCDA_FILES) $(GCOV_OUTPUT) $(GCOV_REPORT) $(GCOV_ERROR) +RUN_TEST_TARGET = $(SILENCE) $(GCOV_CLEAN) ; echo "Running $(TEST_TARGET)"; ./$(TEST_TARGET) $(UNITY_TEST_RUNNER_FLAGS) + +INCLUDES_DIRS_EXPANDED = $(call get_dirs_from_dirspec, $(INCLUDE_DIRS)) +INCLUDES += $(foreach dir, $(INCLUDES_DIRS_EXPANDED), -I$(dir)) +MOCK_DIRS_EXPANDED = $(call get_dirs_from_dirspec, $(MOCKS_SRC_DIRS)) +INCLUDES += $(foreach dir, $(MOCK_DIRS_EXPANDED), -I$(dir)) + + +DEP_FILES = $(call src_to_d, $(ALL_SRC)) +STUFF_TO_CLEAN += $(DEP_FILES) $(PRODUCTION_CODE_START) $(PRODUCTION_CODE_END) +STUFF_TO_CLEAN += $(STDLIB_CODE_START) $(MAP_FILE) cpputest_*.xml junit_run_output + +# We'll use the UNITY_CFLAGS etc so that you can override AND add to the CppUTest flags +CFLAGS = $(UNITY_CFLAGS) $(UNITY_ADDITIONAL_CFLAGS) $(INCLUDES) $(UNITY_WARNINGFLAGS) +LDFLAGS = $(UNITY_LDFLAGS) $(UNITY_ADDITIONAL_LDFLAGS) + +# Targets + +.PHONY: all +all: start $(TEST_TARGET) + $(RUN_TEST_TARGET) + +.PHONY: start +start: $(TEST_TARGET) + $(SILENCE)START_TIME=$(call time) + +.PHONY: all_no_tests +all_no_tests: $(TEST_TARGET) + +.PHONY: flags +flags: + @echo + @echo "Compile C source with CFLAGS:" + @$(call debug_print_list,$(CFLAGS)) + @echo "Link with LDFLAGS:" + @$(call debug_print_list,$(LDFLAGS)) + @echo "Link with LD_LIBRARIES:" + @$(call debug_print_list,$(LD_LIBRARIES)) + @echo "Create libraries with ARFLAGS:" + @$(call debug_print_list,$(ARFLAGS)) + @echo "OBJ files:" + @$(call debug_print_list,$(OBJ2)) + + +$(TEST_TARGET): $(TEST_OBJS) $(MOCKS_OBJS) $(PRODUCTION_CODE_START) $(TARGET_LIB) $(USER_LIBS) $(PRODUCTION_CODE_END) $(STDLIB_CODE_START) + $(SILENCE)echo Linking $@ + $(SILENCE)$(LINK.o) -o $@ $^ $(LD_LIBRARIES) + +$(TARGET_LIB): $(OBJ) + $(SILENCE)echo Building archive $@ + $(SILENCE)mkdir -p lib + $(SILENCE)$(AR) $(ARFLAGS) $@ $^ + $(SILENCE)ranlib $@ + +test: $(TEST_TARGET) + $(RUN_TEST_TARGET) | tee $(TEST_OUTPUT) + +vtest: $(TEST_TARGET) + $(RUN_TEST_TARGET) -v | tee $(TEST_OUTPUT) + +$(UNITY_OBJS_DIR)/%.o: %.cpp + @echo compiling $(notdir $<) + $(SILENCE)mkdir -p $(dir $@) + $(SILENCE)$(COMPILE.cpp) -MMD -MP $(OUTPUT_OPTION) $< + +$(UNITY_OBJS_DIR)/%.o: %.c + @echo compiling $(notdir $<) + $(SILENCE)mkdir -p $(dir $@) + $(SILENCE)$(COMPILE.c) -MMD -MP $(OUTPUT_OPTION) $< + +ifneq "$(MAKECMDGOALS)" "clean" +-include $(DEP_FILES) +endif + +.PHONY: clean +clean: + $(SILENCE)echo Making clean + $(SILENCE)$(RM) $(STUFF_TO_CLEAN) + $(SILENCE)rm -rf gcov $(UNITY_OBJS_DIR) + $(SILENCE)find . -name "*.gcno" | xargs rm -f + $(SILENCE)find . -name "*.gcda" | xargs rm -f + +#realclean gets rid of all gcov, o and d files in the directory tree +#not just the ones made by this makefile +.PHONY: realclean +realclean: clean + $(SILENCE)rm -rf gcov + $(SILENCE)find . -name "*.gdcno" | xargs rm -f + $(SILENCE)find . -name "*.[do]" | xargs rm -f + +gcov: test + $(SILENCE)for d in $(SRC_DIRS) ; do \ + gcov --object-directory $(UNITY_OBJS_DIR)/$$d $$d/*.c $$d/*.cpp >> $(GCOV_OUTPUT) 2>>$(GCOV_ERROR) ; \ + done + $(SILENCE)for f in $(SRC_FILES) ; do \ + gcov --object-directory $(UNITY_OBJS_DIR)/$$f $$f >> $(GCOV_OUTPUT) 2>>$(GCOV_ERROR) ; \ + done + $(UNITY_BUILD_HOME)/filterGcov.sh $(GCOV_OUTPUT) $(GCOV_ERROR) $(GCOV_REPORT) $(TEST_OUTPUT) + $(SILENCE)cat $(GCOV_REPORT) + $(SILENCE)mkdir -p gcov + $(SILENCE)mv *.gcov gcov + $(SILENCE)mv gcov_* gcov + $(SILENCE)echo "See gcov directory for details" + +debug: + @echo + @echo "Target Source files:" + @$(call debug_print_list,$(SRC)) + @echo "Target Object files:" + @$(call debug_print_list,$(OBJ)) + @echo "Test Source files:" + @$(call debug_print_list,$(TEST_SRC)) + @echo "Test Object files:" + @$(call debug_print_list,$(TEST_OBJS)) + @echo "Mock Source files:" + @$(call debug_print_list,$(MOCKS_SRC)) + @echo "Mock Object files:" + @$(call debug_print_list,$(MOCKS_OBJS)) + @echo "All Input Dependency files:" + @$(call debug_print_list,$(DEP_FILES)) + @echo Stuff to clean: + @$(call debug_print_list,$(STUFF_TO_CLEAN)) + @echo Includes: + @$(call debug_print_list,$(INCLUDES)) + +ifneq "$(OTHER_MAKEFILE_TO_INCLUDE)" "" +-include $(OTHER_MAKEFILE_TO_INCLUDE) +endif + + + +st,$(TEST_SRC)) + @echo "Test Object files:" + @$(call debug_print \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/build/filterGcov.sh b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/build/filterGcov.sh new file mode 100644 index 0000000..a861cf6 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/build/filterGcov.sh @@ -0,0 +1,61 @@ +#!/bin/bash +INPUT_FILE=$1 +TEMP_FILE1=${INPUT_FILE}1.tmp +TEMP_FILE2=${INPUT_FILE}2.tmp +TEMP_FILE3=${INPUT_FILE}3.tmp +ERROR_FILE=$2 +OUTPUT_FILE=$3 +HTML_OUTPUT_FILE=$3.html +TEST_RESULTS=$4 + +flattenGcovOutput() { +while read line1 +do + read line2 + echo $line2 " " $line1 + read junk + read junk +done < ${INPUT_FILE} +} + +getRidOfCruft() { +sed '-e s/^Lines.*://g' \ + '-e s/^[0-9]\./ &/g' \ + '-e s/^[0-9][0-9]\./ &/g' \ + '-e s/of.*File/ /g' \ + "-e s/'//g" \ + '-e s/^.*\/usr\/.*$//g' \ + '-e s/^.*\.$//g' +} + +getFileNameRootFromErrorFile() { +sed '-e s/gc..:cannot open .* file//g' ${ERROR_FILE} +} + +writeEachNoTestCoverageFile() { +while read line +do + echo " 0.00% " ${line} +done +} + +createHtmlOutput() { + echo "" + echo "" + sed "-e s/.*% /
CoverageFile
&<\/td>/" \ + "-e s/[a-zA-Z0-9_]*\.[ch][a-z]*/&<\/a><\/td><\/tr>/" + echo "
" + sed "-e s/.*/&
/g" < ${TEST_RESULTS} +} + + +flattenGcovOutput | getRidOfCruft > ${TEMP_FILE1} +getFileNameRootFromErrorFile | writeEachNoTestCoverageFile > ${TEMP_FILE2} +cat ${TEMP_FILE1} ${TEMP_FILE2} | sort | uniq > ${OUTPUT_FILE} +createHtmlOutput < ${OUTPUT_FILE} > ${HTML_OUTPUT_FILE} +rm -f ${TEMP_FILE1} ${TEMP_FILE2} +erageFile" + sed "-e s/.*% /&<\/td>/" \ + "-e s/[a-zA-Z0-9_]*\.[ch][a-z]*/
&<\/a><\/td><\/tr>/" + echo "" + sed "-e s/.*/&
/g" < ${TEST_RESULTS \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/rakefile.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/rakefile.rb new file mode 100644 index 0000000..6181707 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/rakefile.rb @@ -0,0 +1,37 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require HERE + 'rakefile_helper' + +include RakefileHelpers + +# Load default configuration, for now +DEFAULT_CONFIG_FILE = 'gcc.yml' +configure_toolchain(DEFAULT_CONFIG_FILE) + +task :unit do + run_tests +end + +desc "Build and test Unity Framework" +task :all => [:clean, :unit] +task :default => [:clobber, :all] +task :ci => [:no_color, :default] +task :cruise => [:no_color, :default] + +desc "Load configuration" +task :config, :config_file do |t, args| + configure_toolchain(args[:config_file]) +end + +task :no_color do + $colour_output = false +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/rakefile_helper.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/rakefile_helper.rb new file mode 100644 index 0000000..a7f6a28 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/rakefile_helper.rb @@ -0,0 +1,178 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require 'yaml' +require 'fileutils' +require HERE+'../../auto/unity_test_summary' +require HERE+'../../auto/generate_test_runner' +require HERE+'../../auto/colour_reporter' + +module RakefileHelpers + + C_EXTENSION = '.c' + + def load_configuration(config_file) + unless ($configured) + $cfg_file = HERE+"../../targets/#{config_file}" unless (config_file =~ /[\\|\/]/) + $cfg = YAML.load(File.read($cfg_file)) + $colour_output = false unless $cfg['colour'] + $configured = true if (config_file != DEFAULT_CONFIG_FILE) + end + end + + def configure_clean + CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil? + end + + def configure_toolchain(config_file=DEFAULT_CONFIG_FILE) + config_file += '.yml' unless config_file =~ /\.yml$/ + config_file = config_file unless config_file =~ /[\\|\/]/ + load_configuration(config_file) + configure_clean + end + + def tackit(strings) + if strings.is_a?(Array) + result = "\"#{strings.join}\"" + else + result = strings + end + return result + end + + def squash(prefix, items) + result = '' + items.each { |item| result += " #{prefix}#{tackit(item)}" } + return result + end + + def build_compiler_fields + command = tackit($cfg['compiler']['path']) + if $cfg['compiler']['defines']['items'].nil? + defines = '' + else + defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items'] + ['UNITY_OUTPUT_CHAR=UnityOutputCharSpy_OutputChar']) + end + options = squash('', $cfg['compiler']['options']) + includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :defines => defines, :options => options, :includes => includes} + end + + def compile(file, defines=[]) + compiler = build_compiler_fields + unity_include = $cfg['compiler']['includes']['prefix']+'../../src' + cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{unity_include} #{file} " + + "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" + + "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" + execute(cmd_str) + end + + def build_linker_fields + command = tackit($cfg['linker']['path']) + if $cfg['linker']['options'].nil? + options = '' + else + options = squash('', $cfg['linker']['options']) + end + if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?) + includes = '' + else + includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) + end + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :options => options, :includes => includes} + end + + def link(exe_name, obj_list) + linker = build_linker_fields + cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + + (obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).join + + $cfg['linker']['bin_files']['prefix'] + ' ' + + $cfg['linker']['bin_files']['destination'] + + exe_name + $cfg['linker']['bin_files']['extension'] + execute(cmd_str) + end + + def build_simulator_fields + return nil if $cfg['simulator'].nil? + if $cfg['simulator']['path'].nil? + command = '' + else + command = (tackit($cfg['simulator']['path']) + ' ') + end + if $cfg['simulator']['pre_support'].nil? + pre_support = '' + else + pre_support = squash('', $cfg['simulator']['pre_support']) + end + if $cfg['simulator']['post_support'].nil? + post_support = '' + else + post_support = squash('', $cfg['simulator']['post_support']) + end + return {:command => command, :pre_support => pre_support, :post_support => post_support} + end + + def execute(command_string, verbose=true) + report command_string + output = `#{command_string}`.chomp + report(output) if (verbose && !output.nil? && (output.length > 0)) + if ($?.exitstatus != 0) + raise "Command failed. (Returned #{$?.exitstatus})" + end + return output + end + + def report_summary + summary = UnityTestSummary.new + summary.set_root_path(HERE) + results_glob = "#{$cfg['compiler']['build_path']}*.test*" + results_glob.gsub!(/\\/, '/') + results = Dir[results_glob] + summary.set_targets(results) + summary.run + end + + def run_tests + report 'Running Unity system tests...' + + # Tack on TEST define for compiling unit tests + load_configuration($cfg_file) + test_defines = ['TEST'] + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + + # Get a list of all source files needed + src_files = Dir[HERE+'src/*.c'] + src_files += Dir[HERE+'test/*.c'] + src_files << '../../src/Unity.c' + + # Build object files + src_files.each { |f| compile(f, test_defines) } + obj_list = src_files.map {|f| File.basename(f.ext($cfg['compiler']['object_files']['extension'])) } + + # Link the test executable + test_base = "framework_test" + link(test_base, obj_list) + + # Execute unit test and generate results file + simulator = build_simulator_fields + executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] + if simulator.nil? + cmd_str = executable + " -v -r" + else + cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" + end + output = execute(cmd_str) + test_results = $cfg['compiler']['build_path'] + test_base + if output.match(/OK$/m).nil? + test_results += '.testfail' + else + test_results += '.testpass' + end + File.open(test_results, 'w') { |f| f.print output } + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/readme.txt b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/readme.txt new file mode 100644 index 0000000..6b9a78c --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/readme.txt @@ -0,0 +1,9 @@ +Copyright (c) 2010 James Grenning and Contributed to Unity Project + +Unity Project - A Test Framework for C +Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +[Released under MIT License. Please refer to license.txt for details] + +This Framework is an optional add-on to Unity. By including unity_framework.h in place of unity.h, +you may now work with Unity in a manner similar to CppUTest. This framework adds the concepts of +test groups and gives finer control of your tests over the command line. \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c new file mode 100644 index 0000000..1ba3e9a --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c @@ -0,0 +1,381 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" +#include "unity_internals.h" +#include + +UNITY_FIXTURE_T UnityFixture; + +//If you decide to use the function pointer approach. +int (*outputChar)(int) = putchar; + +int verbose = 0; + +void setUp(void) { /*does nothing*/ } +void tearDown(void) { /*does nothing*/ } + +void announceTestRun(int runNumber) +{ + UnityPrint("Unity test run "); + UnityPrintNumber(runNumber+1); + UnityPrint(" of "); + UnityPrintNumber(UnityFixture.RepeatCount); + UNITY_OUTPUT_CHAR('\n'); +} + +int UnityMain(int argc, char* argv[], void (*runAllTests)()) +{ + int result = UnityGetCommandLineOptions(argc, argv); + int r; + if (result != 0) + return result; + + for (r = 0; r < UnityFixture.RepeatCount; r++) + { + announceTestRun(r); + UnityBegin(); + runAllTests(); + UNITY_OUTPUT_CHAR('\n'); + UnityEnd(); + } + + return UnityFailureCount(); +} + +static int selected(const char * filter, const char * name) +{ + if (filter == 0) + return 1; + return strstr(name, filter) ? 1 : 0; +} + +static int testSelected(const char* test) +{ + return selected(UnityFixture.NameFilter, test); +} + +static int groupSelected(const char* group) +{ + return selected(UnityFixture.GroupFilter, group); +} + +static void runTestCase() +{ + +} + +void UnityTestRunner(unityfunction* setup, + unityfunction* testBody, + unityfunction* teardown, + const char * printableName, + const char * group, + const char * name, + const char * file, int line) +{ + if (testSelected(name) && groupSelected(group)) + { + Unity.CurrentTestFailed = 0; + Unity.TestFile = file; + Unity.CurrentTestName = printableName; + Unity.CurrentTestLineNumber = line; + if (!UnityFixture.Verbose) + UNITY_OUTPUT_CHAR('.'); + else + UnityPrint(printableName); + + Unity.NumberOfTests++; + UnityMalloc_StartTest(); + UnityPointer_Init(); + + runTestCase(); + if (TEST_PROTECT()) + { + setup(); + testBody(); + } + if (TEST_PROTECT()) + { + teardown(); + } + if (TEST_PROTECT()) + { + UnityPointer_UndoAllSets(); + if (!Unity.CurrentTestFailed) + UnityMalloc_EndTest(); + UnityConcludeFixtureTest(); + } + else + { + //aborting - jwg - di i need these for the other TEST_PROTECTS? + } + } +} + +void UnityIgnoreTest() +{ + Unity.NumberOfTests++; + Unity.CurrentTestIgnored = 1; + UNITY_OUTPUT_CHAR('!'); +} + + +//------------------------------------------------- +//Malloc and free stuff +// +#define MALLOC_DONT_FAIL -1 +static int malloc_count; +static int malloc_fail_countdown = MALLOC_DONT_FAIL; + +void UnityMalloc_StartTest() +{ + malloc_count = 0; + malloc_fail_countdown = MALLOC_DONT_FAIL; +} + +void UnityMalloc_EndTest() +{ + malloc_fail_countdown = MALLOC_DONT_FAIL; + if (malloc_count != 0) + { + TEST_FAIL_MESSAGE("This test leaks!"); + } +} + +void UnityMalloc_MakeMallocFailAfterCount(int countdown) +{ + malloc_fail_countdown = countdown; +} + +#ifdef malloc +#undef malloc +#endif + +#ifdef free +#undef free +#endif + +#include +#include + +typedef struct GuardBytes +{ + int size; + char guard[sizeof(int)]; +} Guard; + + +static const char * end = "END"; + +void * unity_malloc(size_t size) +{ + char* mem; + Guard* guard; + + if (malloc_fail_countdown != MALLOC_DONT_FAIL) + { + if (malloc_fail_countdown == 0) + return 0; + malloc_fail_countdown--; + } + + malloc_count++; + + guard = (Guard*)malloc(size + sizeof(Guard) + 4); + guard->size = size; + mem = (char*)&(guard[1]); + memcpy(&mem[size], end, strlen(end) + 1); + + return (void*)mem; +} + +static int isOverrun(void * mem) +{ + Guard* guard = (Guard*)mem; + char* memAsChar = (char*)mem; + guard--; + + return strcmp(&memAsChar[guard->size], end) != 0; +} + +static void release_memory(void * mem) +{ + Guard* guard = (Guard*)mem; + guard--; + + malloc_count--; + free(guard); +} + +void unity_free(void * mem) +{ + int overrun = isOverrun(mem);//strcmp(&memAsChar[guard->size], end) != 0; + release_memory(mem); + if (overrun) + { + TEST_FAIL_MESSAGE("Buffer overrun detected during free()"); + } +} + +void* unity_calloc(size_t num, size_t size) +{ + void* mem = unity_malloc(num * size); + memset(mem, 0, num*size); + return mem; +} + +void* unity_realloc(void * oldMem, size_t size) +{ + Guard* guard = (Guard*)oldMem; +// char* memAsChar = (char*)oldMem; + void* newMem; + + if (oldMem == 0) + return unity_malloc(size); + + guard--; + if (isOverrun(oldMem)) + { + release_memory(oldMem); + TEST_FAIL_MESSAGE("Buffer overrun detected during realloc()"); + } + + if (size == 0) + { + release_memory(oldMem); + return 0; + } + + if (guard->size >= size) + return oldMem; + + newMem = unity_malloc(size); + memcpy(newMem, oldMem, size); + unity_free(oldMem); + return newMem; +} + + +//-------------------------------------------------------- +//Automatic pointer restoration functions +typedef struct _PointerPair +{ + struct _PointerPair * next; + void ** pointer; + void * old_value; +} PointerPair; + +enum {MAX_POINTERS=50}; +static PointerPair pointer_store[MAX_POINTERS]; +static int pointer_index = 0; + +void UnityPointer_Init() +{ + pointer_index = 0; +} + +void UnityPointer_Set(void ** pointer, void * newValue) +{ + if (pointer_index >= MAX_POINTERS) + TEST_FAIL_MESSAGE("Too many pointers set"); + + pointer_store[pointer_index].pointer = pointer; + pointer_store[pointer_index].old_value = *pointer; + *pointer = newValue; + pointer_index++; +} + +void UnityPointer_UndoAllSets() +{ + while (pointer_index > 0) + { + pointer_index--; + *(pointer_store[pointer_index].pointer) = + pointer_store[pointer_index].old_value; + + } +} + +int UnityFailureCount() +{ + return Unity.TestFailures; +} + +int UnityGetCommandLineOptions(int argc, char* argv[]) +{ + int i; + UnityFixture.Verbose = 0; + UnityFixture.GroupFilter = 0; + UnityFixture.NameFilter = 0; + UnityFixture.RepeatCount = 1; + + if (argc == 1) + return 0; + + for (i = 1; i < argc; ) + { + if (strcmp(argv[i], "-v") == 0) + { + UnityFixture.Verbose = 1; + i++; + } + else if (strcmp(argv[i], "-g") == 0) + { + i++; + if (i >= argc) + return 1; + UnityFixture.GroupFilter = argv[i]; + i++; + } + else if (strcmp(argv[i], "-n") == 0) + { + i++; + if (i >= argc) + return 1; + UnityFixture.NameFilter = argv[i]; + i++; + } + else if (strcmp(argv[i], "-r") == 0) + { + UnityFixture.RepeatCount = 2; + i++; + if (i < argc) + { + if (*(argv[i]) >= '0' && *(argv[i]) <= '9') + { + UnityFixture.RepeatCount = atoi(argv[i]); + i++; + } + } + } + } + return 0; +} + +void UnityConcludeFixtureTest() +{ + if (Unity.CurrentTestIgnored) + { + Unity.TestIgnores++; + } + else if (!Unity.CurrentTestFailed) + { + if (UnityFixture.Verbose) + { + UnityPrint(" PASS"); + UNITY_OUTPUT_CHAR('\n'); + } + } + else if (Unity.CurrentTestFailed) + { + Unity.TestFailures++; + } + + Unity.CurrentTestFailed = 0; + Unity.CurrentTestIgnored = 0; +} + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.h b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.h new file mode 100644 index 0000000..da1f871 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.h @@ -0,0 +1,81 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FIXTURE_H_ +#define UNITY_FIXTURE_H_ + +#include "unity.h" +#include "unity_internals.h" +#include "unity_fixture_malloc_overrides.h" +#include "unity_fixture_internals.h" + +int UnityMain(int argc, char* argv[], void (*runAllTests)()); + + +#define TEST_GROUP(group)\ + int TEST_GROUP_##group = 0 + +#define TEST_SETUP(group) void TEST_##group##_SETUP() + +#define TEST_TEAR_DOWN(group) void TEST_##group##_TEAR_DOWN() + + +#define TEST(group, name) \ + void TEST_##group##_##name##_();\ + void TEST_##group##_##name##_run()\ + {\ + UnityTestRunner(TEST_##group##_SETUP,\ + TEST_##group##_##name##_,\ + TEST_##group##_TEAR_DOWN,\ + "TEST(" #group ", " #name ")",\ + #group, #name,\ + __FILE__, __LINE__);\ + }\ + void TEST_##group##_##name##_() + +#define IGNORE_TEST(group, name) \ + void TEST_##group##_##name##_();\ + void TEST_##group##_##name##_run()\ + {\ + UnityIgnoreTest();\ + }\ + void TEST_##group##_##name##_() + +#define DECLARE_TEST_CASE(group, name) \ + void TEST_##group##_##name##_run() + +#define RUN_TEST_CASE(group, name) \ + DECLARE_TEST_CASE(group, name);\ + TEST_##group##_##name##_run(); + +//This goes at the bottom of each test file or in a separate c file +#define TEST_GROUP_RUNNER(group)\ + void TEST_##group##_GROUP_RUNNER_runAll();\ + void TEST_##group##_GROUP_RUNNER()\ + {\ + TEST_##group##_GROUP_RUNNER_runAll();\ + }\ + void TEST_##group##_GROUP_RUNNER_runAll() + +//Call this from main +#define RUN_TEST_GROUP(group)\ + void TEST_##group##_GROUP_RUNNER();\ + TEST_##group##_GROUP_RUNNER(); + +//CppUTest Compatibility Macros +#define UT_PTR_SET(ptr, newPointerValue) UnityPointer_Set((void**)&ptr, (void*)newPointerValue) +#define TEST_ASSERT_POINTERS_EQUAL(expected, actual) TEST_ASSERT_EQUAL_PTR(expected, actual) +#define TEST_ASSERT_BYTES_EQUAL(expected, actual) TEST_ASSERT_EQUAL_HEX8(0xff & (expected), 0xff & (actual)) +#define FAIL(message) TEST_FAIL((message)) +#define CHECK(condition) TEST_ASSERT_TRUE((condition)) +#define LONGS_EQUAL(expected, actual) TEST_ASSERT_EQUAL_INT((expected), (actual)) +#define STRCMP_EQUAL(expected, actual) TEST_ASSERT_EQUAL_STRING((expected), (actual)) +#define DOUBLES_EQUAL(expected, actual, delta) TEST_ASSERT_FLOAT_WITHIN(((expected), (actual), (delta)) + +void UnityMalloc_MakeMallocFailAfterCount(int count); + +#endif /* UNITY_FIXTURE_H_ */ diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h new file mode 100644 index 0000000..db23f67 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h @@ -0,0 +1,44 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FIXTURE_INTERNALS_H_ +#define UNITY_FIXTURE_INTERNALS_H_ + +typedef struct _UNITY_FIXTURE_T +{ + int Verbose; + unsigned int RepeatCount; + const char* NameFilter; + const char* GroupFilter; +} UNITY_FIXTURE_T; + +typedef void unityfunction(); +void UnityTestRunner(unityfunction * setup, + unityfunction * body, + unityfunction * teardown, + const char * printableName, + const char * group, + const char * name, + const char * file, int line); + +void UnityIgnoreTest(); +void UnityMalloc_StartTest(); +void UnityMalloc_EndTest(); +int UnityFailureCount(); +int UnityGetCommandLineOptions(int argc, char* argv[]); +void UnityConcludeFixtureTest(); + +void UnityPointer_Set(void ** ptr, void * newValue); +void UnityPointer_UndoAllSets(); +void UnityPointer_Init(); + +void UnityAssertEqualPointer(const void * expected, + const void * actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +#endif /* UNITY_FIXTURE_INTERNALS_H_ */ diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h new file mode 100644 index 0000000..38f8e34 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h @@ -0,0 +1,16 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FIXTURE_MALLOC_OVERRIDES_H_ +#define UNITY_FIXTURE_MALLOC_OVERRIDES_H_ + +#define malloc unity_malloc +#define calloc unity_calloc +#define realloc unity_realloc +#define free unity_free + +#endif /* UNITY_FIXTURE_MALLOC_OVERRIDES_H_ */ diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/main/AllTests.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/main/AllTests.c new file mode 100644 index 0000000..ccb775b --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/main/AllTests.c @@ -0,0 +1,21 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" + +static void runAllTests() +{ + RUN_TEST_GROUP(UnityFixture); + RUN_TEST_GROUP(UnityCommandOptions); + RUN_TEST_GROUP(LeakDetection) +} + +int main(int argc, char* argv[]) +{ + return UnityMain(argc, argv, runAllTests); +} + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/testunity_fixture.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/testunity_fixture.c new file mode 100644 index 0000000..de0c04c --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/testunity_fixture.c @@ -0,0 +1,39 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" + +static int data = -1; + +TEST_GROUP(mygroup); + +TEST_SETUP(mygroup) +{ + data = 0; +} + +TEST_TEAR_DOWN(mygroup) +{ + data = -1; +} + +TEST(mygroup, test1) +{ + TEST_ASSERT_EQUAL_INT(0, data); +} + +TEST(mygroup, test2) +{ + TEST_ASSERT_EQUAL_INT(0, data); + data = 5; +} + +TEST(mygroup, test3) +{ + data = 7; + TEST_ASSERT_EQUAL_INT(7, data); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c new file mode 100644 index 0000000..b8b4524 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c @@ -0,0 +1,321 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" +#include "unity_output_Spy.h" +#include +#include + +extern UNITY_FIXTURE_T UnityFixture; + +TEST_GROUP(UnityFixture); + +TEST_SETUP(UnityFixture) +{ +} + +TEST_TEAR_DOWN(UnityFixture) +{ +} + +int my_int; +int* pointer1 = 0; +int* pointer2 = (int*)2; +int* pointer3 = (int*)3; +int int1; +int int2; +int int3; +int int4; + +TEST(UnityFixture, PointerSetting) +{ + TEST_ASSERT_POINTERS_EQUAL(pointer1, 0); + UT_PTR_SET(pointer1, &int1); + UT_PTR_SET(pointer2, &int2); + UT_PTR_SET(pointer3, &int3); + TEST_ASSERT_POINTERS_EQUAL(pointer1, &int1); + TEST_ASSERT_POINTERS_EQUAL(pointer2, &int2); + TEST_ASSERT_POINTERS_EQUAL(pointer3, &int3); + UT_PTR_SET(pointer1, &int4); + UnityPointer_UndoAllSets(); + TEST_ASSERT_POINTERS_EQUAL(pointer1, 0); + TEST_ASSERT_POINTERS_EQUAL(pointer2, (int*)2); + TEST_ASSERT_POINTERS_EQUAL(pointer3, (int*)3); +} + +TEST(UnityFixture, ForceMallocFail) +{ + UnityMalloc_MakeMallocFailAfterCount(1); + void* m = malloc(10); + CHECK(m); + void* mfails = malloc(10); + TEST_ASSERT_POINTERS_EQUAL(0, mfails); + free(m); +} + +TEST(UnityFixture, ReallocSmallerIsUnchanged) +{ + void* m1 = malloc(10); + void* m2 = realloc(m1, 5); + TEST_ASSERT_POINTERS_EQUAL(m1, m2); + free(m2); +} + +TEST(UnityFixture, ReallocSameIsUnchanged) +{ + void* m1 = malloc(10); + void* m2 = realloc(m1, 10); + TEST_ASSERT_POINTERS_EQUAL(m1, m2); + free(m2); +} + +TEST(UnityFixture, ReallocLargerNeeded) +{ + void* m1 = malloc(10); + strcpy((char*)m1, "123456789"); + void* m2 = realloc(m1, 15); + CHECK(m1 != m2); + STRCMP_EQUAL("123456789", m2); + free(m2); +} + +TEST(UnityFixture, ReallocNullPointerIsLikeMalloc) +{ + void* m = realloc(0, 15); + CHECK(m != 0); + free(m); +} + +TEST(UnityFixture, ReallocSizeZeroFreesMemAndReturnsNullPointer) +{ + void* m1 = malloc(10); + void* m2 = realloc(m1, 0); + TEST_ASSERT_POINTERS_EQUAL(0, m2); +} + +TEST(UnityFixture, CallocFillsWithZero) +{ + void* m = calloc(3, sizeof(char)); + char* s = (char*)m; + TEST_ASSERT_BYTES_EQUAL(0, s[0]); + TEST_ASSERT_BYTES_EQUAL(0, s[1]); + TEST_ASSERT_BYTES_EQUAL(0, s[2]); + free(m); +} + +char *p1; +char *p2; + +TEST(UnityFixture, PointerSet) +{ + char c1; + char c2; + char newC1; + char newC2; + p1 = &c1; + p2 = &c2; + + UnityPointer_Init(10); + UT_PTR_SET(p1, &newC1); + UT_PTR_SET(p2, &newC2); + TEST_ASSERT_POINTERS_EQUAL(&newC1, p1); + TEST_ASSERT_POINTERS_EQUAL(&newC2, p2); + UnityPointer_UndoAllSets(); + TEST_ASSERT_POINTERS_EQUAL(&c1, p1); + TEST_ASSERT_POINTERS_EQUAL(&c2, p2); +} + +//------------------------------------------------------------ + +TEST_GROUP(UnityCommandOptions); + +int savedVerbose; +int savedRepeat; +const char* savedName; +const char* savedGroup; + +TEST_SETUP(UnityCommandOptions) +{ + savedVerbose = UnityFixture.Verbose; + savedRepeat = UnityFixture.RepeatCount; + savedName = UnityFixture.NameFilter; + savedGroup = UnityFixture.GroupFilter; +} + +TEST_TEAR_DOWN(UnityCommandOptions) +{ + UnityFixture.Verbose = savedVerbose; + UnityFixture.RepeatCount= savedRepeat; + UnityFixture.NameFilter = savedName; + UnityFixture.GroupFilter = savedGroup; +} + + +static char* noOptions[] = { + "testrunner.exe" +}; + +TEST(UnityCommandOptions, DefaultOptions) +{ + UnityGetCommandLineOptions(1, noOptions); + TEST_ASSERT_EQUAL(0, UnityFixture.Verbose); + TEST_ASSERT_POINTERS_EQUAL(0, UnityFixture.GroupFilter); + TEST_ASSERT_POINTERS_EQUAL(0, UnityFixture.NameFilter); + TEST_ASSERT_EQUAL(1, UnityFixture.RepeatCount); +} + +static char* verbose[] = { + "testrunner.exe", + "-v" +}; + +TEST(UnityCommandOptions, OptionVerbose) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(2, verbose)); + TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); +} + +static char* group[] = { + "testrunner.exe", + "-g", "groupname" +}; + +TEST(UnityCommandOptions, OptionSelectTestByGroup) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, group)); + STRCMP_EQUAL("groupname", UnityFixture.GroupFilter); +} + +static char* name[] = { + "testrunner.exe", + "-n", "testname" +}; + +TEST(UnityCommandOptions, OptionSelectTestByName) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, name)); + STRCMP_EQUAL("testname", UnityFixture.NameFilter); +} + +static char* repeat[] = { + "testrunner.exe", + "-r", "99" +}; + +TEST(UnityCommandOptions, OptionSelectRepeatTestsDefaultCount) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(2, repeat)); + TEST_ASSERT_EQUAL(2, UnityFixture.RepeatCount); +} + +TEST(UnityCommandOptions, OptionSelectRepeatTestsSpecificCount) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, repeat)); + TEST_ASSERT_EQUAL(99, UnityFixture.RepeatCount); +} + +static char* multiple[] = { + "testrunner.exe", + "-v", + "-g", "groupname", + "-n", "testname", + "-r", "98" +}; + +TEST(UnityCommandOptions, MultipleOptions) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(8, multiple)); + TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); + STRCMP_EQUAL("groupname", UnityFixture.GroupFilter); + STRCMP_EQUAL("testname", UnityFixture.NameFilter); + TEST_ASSERT_EQUAL(98, UnityFixture.RepeatCount); +} + +static char* dashRNotLast[] = { + "testrunner.exe", + "-v", + "-g", "gggg", + "-r", + "-n", "tttt", +}; + +TEST(UnityCommandOptions, MultipleOptionsDashRNotLastAndNoValueSpecified) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(7, dashRNotLast)); + TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); + STRCMP_EQUAL("gggg", UnityFixture.GroupFilter); + STRCMP_EQUAL("tttt", UnityFixture.NameFilter); + TEST_ASSERT_EQUAL(2, UnityFixture.RepeatCount); +} + + +//------------------------------------------------------------ + +TEST_GROUP(LeakDetection); + +TEST_SETUP(LeakDetection) +{ + UnityOutputCharSpy_Create(1000); +} + +TEST_TEAR_DOWN(LeakDetection) +{ + UnityOutputCharSpy_Destroy(); +} + +#define EXPECT_ABORT_BEGIN \ + { \ + jmp_buf TestAbortFrame; \ + memcpy(TestAbortFrame, Unity.AbortFrame, sizeof(jmp_buf)); \ + if (TEST_PROTECT()) \ + { + +#define EXPECT_ABORT_END \ + } \ + memcpy(Unity.AbortFrame, TestAbortFrame, sizeof(jmp_buf)); \ + } + +TEST(LeakDetection, DetectsLeak) +{ + void* m = malloc(10); + UnityOutputCharSpy_Enable(1); + EXPECT_ABORT_BEGIN + UnityMalloc_EndTest(); + EXPECT_ABORT_END + UnityOutputCharSpy_Enable(0); + CHECK(strstr(UnityOutputCharSpy_Get(), "This test leaks!")); + free(m); + Unity.CurrentTestFailed = 0; +} + +TEST(LeakDetection, BufferOverrunFoundDuringFree) +{ + void* m = malloc(10); + char* s = (char*)m; + s[10] = (char)0xFF; + UnityOutputCharSpy_Enable(1); + EXPECT_ABORT_BEGIN + free(m); + EXPECT_ABORT_END + UnityOutputCharSpy_Enable(0); + CHECK(strstr(UnityOutputCharSpy_Get(), "Buffer overrun detected during free()")); + Unity.CurrentTestFailed = 0; +} + +TEST(LeakDetection, BufferOverrunFoundDuringRealloc) +{ + void* m = malloc(10); + char* s = (char*)m; + s[10] = (char)0xFF; + UnityOutputCharSpy_Enable(1); + EXPECT_ABORT_BEGIN + m = realloc(m, 100); + EXPECT_ABORT_END + UnityOutputCharSpy_Enable(0); + CHECK(strstr(UnityOutputCharSpy_Get(), "Buffer overrun detected during realloc()")); + Unity.CurrentTestFailed = 0; +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c new file mode 100644 index 0000000..80fec09 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c @@ -0,0 +1,40 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" + +TEST_GROUP_RUNNER(UnityFixture) +{ + RUN_TEST_CASE(UnityFixture, PointerSetting); + RUN_TEST_CASE(UnityFixture, ForceMallocFail); + RUN_TEST_CASE(UnityFixture, ReallocSmallerIsUnchanged); + RUN_TEST_CASE(UnityFixture, ReallocSameIsUnchanged); + RUN_TEST_CASE(UnityFixture, ReallocLargerNeeded); + RUN_TEST_CASE(UnityFixture, ReallocNullPointerIsLikeMalloc); + RUN_TEST_CASE(UnityFixture, ReallocSizeZeroFreesMemAndReturnsNullPointer); + RUN_TEST_CASE(UnityFixture, CallocFillsWithZero); + RUN_TEST_CASE(UnityFixture, PointerSet); +} + +TEST_GROUP_RUNNER(UnityCommandOptions) +{ + RUN_TEST_CASE(UnityCommandOptions, DefaultOptions); + RUN_TEST_CASE(UnityCommandOptions, OptionVerbose); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectTestByGroup); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectTestByName); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectRepeatTestsDefaultCount); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectRepeatTestsSpecificCount); + RUN_TEST_CASE(UnityCommandOptions, MultipleOptions); + RUN_TEST_CASE(UnityCommandOptions, MultipleOptionsDashRNotLastAndNoValueSpecified); +} + +TEST_GROUP_RUNNER(LeakDetection) +{ + RUN_TEST_CASE(LeakDetection, DetectsLeak); + RUN_TEST_CASE(LeakDetection, BufferOverrunFoundDuringFree); + RUN_TEST_CASE(LeakDetection, BufferOverrunFoundDuringRealloc); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.c new file mode 100644 index 0000000..16faefa --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.c @@ -0,0 +1,56 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + + +#include "unity_output_Spy.h" +#include +#include +#include + +static int size; +static int count; +static char* buffer; +static int spy_enable; + +void UnityOutputCharSpy_Create(int s) +{ + size = s; + count = 0; + spy_enable = 0; + buffer = malloc(size); + memset(buffer, 0, size); +} + +void UnityOutputCharSpy_Destroy() +{ + size = 0; + free(buffer); +} + +int UnityOutputCharSpy_OutputChar(int c) +{ + if (spy_enable) + { + if (count < (size-1)) + buffer[count++] = c; + } + else + { + putchar(c); + } + return c; +} + +const char * UnityOutputCharSpy_Get() +{ + return buffer; +} + +void UnityOutputCharSpy_Enable(int enable) +{ + spy_enable = enable; +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.h b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.h new file mode 100644 index 0000000..7c1590e --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.h @@ -0,0 +1,17 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef D_unity_output_Spy_H +#define D_unity_output_Spy_H + +void UnityOutputCharSpy_Create(int s); +void UnityOutputCharSpy_Destroy(); +int UnityOutputCharSpy_OutputChar(int c); +const char * UnityOutputCharSpy_Get(); +void UnityOutputCharSpy_Enable(int enable); + +#endif diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/makefile b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/makefile new file mode 100644 index 0000000..8c8444b --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/makefile @@ -0,0 +1,35 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +C_COMPILER=gcc +TARGET_BASE = testunity +ifeq ($(OS),Windows_NT) + TARGET_EXTENSION=.exe +else + TARGET_EXTENSION=.out +endif +TARGET = $(TARGET_BASE)$(TARGET_EXTENSION) +OUT_FILE=-o $(TARGET) +SRC_FILES=src/unity.c test/testunity.c build/testunity_Runner.c +INC_DIRS=-Isrc +SYMBOLS=-DTEST -DUNITY_SUPPORT_64 + +ifeq ($(OS),Windows_NT) + CLEANUP = del /F /Q build\* && del /F /Q $(TARGET) +else + CLEANUP = rm -f build/*.o ; rm -f $(TARGET) +endif + +all: clean default + +default: + ruby auto/generate_test_runner.rb test/testunity.c build/testunity_Runner.c + $(C_COMPILER) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES) $(OUT_FILE) + $(TARGET) + +clean: + $(CLEANUP) + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/rakefile.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/rakefile.rb new file mode 100644 index 0000000..3ec5d5a --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/rakefile.rb @@ -0,0 +1,48 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require HERE + 'rakefile_helper' + +include RakefileHelpers + +# Load default configuration, for now +DEFAULT_CONFIG_FILE = 'gcc.yml' +configure_toolchain(DEFAULT_CONFIG_FILE) + +desc "Test unity with its own unit tests" +task :unit do + run_tests get_unit_test_files +end + +Rake::TestTask.new(:scripts) do |t| + t.pattern = 'test/test_*.rb' + t.verbose = true +end + +desc "Generate test summary" +task :summary do + report_summary +end + +desc "Build and test Unity" +task :all => [:clean, :scripts, :unit, :summary] +task :default => [:clobber, :all] +task :ci => [:no_color, :default] +task :cruise => [:no_color, :default] + +desc "Load configuration" +task :config, :config_file do |t, args| + configure_toolchain(args[:config_file]) +end + +task :no_color do + $colour_output = false +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/rakefile_helper.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/rakefile_helper.rb new file mode 100644 index 0000000..218fcaa --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/rakefile_helper.rb @@ -0,0 +1,243 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require 'yaml' +require 'fileutils' +require HERE+'auto/unity_test_summary' +require HERE+'auto/generate_test_runner' +require HERE+'auto/colour_reporter' + +module RakefileHelpers + + C_EXTENSION = '.c' + + def load_configuration(config_file) + unless ($configured) + $cfg_file = "targets/#{config_file}" unless (config_file =~ /[\\|\/]/) + $cfg = YAML.load(File.read($cfg_file)) + $colour_output = false unless $cfg['colour'] + $configured = true if (config_file != DEFAULT_CONFIG_FILE) + end + end + + def configure_clean + CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil? + end + + def configure_toolchain(config_file=DEFAULT_CONFIG_FILE) + config_file += '.yml' unless config_file =~ /\.yml$/ + config_file = config_file unless config_file =~ /[\\|\/]/ + load_configuration(config_file) + configure_clean + end + + def get_unit_test_files + path = $cfg['compiler']['unit_tests_path'] + 'test*' + C_EXTENSION + path.gsub!(/\\/, '/') + FileList.new(path) + end + + def get_local_include_dirs + include_dirs = $cfg['compiler']['includes']['items'].dup + include_dirs.delete_if {|dir| dir.is_a?(Array)} + return include_dirs + end + + def extract_headers(filename) + includes = [] + lines = File.readlines(filename) + lines.each do |line| + m = line.match(/^\s*#include\s+\"\s*(.+\.[hH])\s*\"/) + if not m.nil? + includes << m[1] + end + end + return includes + end + + def find_source_file(header, paths) + paths.each do |dir| + src_file = dir + header.ext(C_EXTENSION) + if (File.exists?(src_file)) + return src_file + end + end + return nil + end + + def tackit(strings) + if strings.is_a?(Array) + result = "\"#{strings.join}\"" + else + result = strings + end + return result + end + + def squash(prefix, items) + result = '' + items.each { |item| result += " #{prefix}#{tackit(item)}" } + return result + end + + def build_compiler_fields + command = tackit($cfg['compiler']['path']) + if $cfg['compiler']['defines']['items'].nil? + defines = '' + else + defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items']) + end + options = squash('', $cfg['compiler']['options']) + includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :defines => defines, :options => options, :includes => includes} + end + + def compile(file, defines=[]) + compiler = build_compiler_fields + cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{file} " + + "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" + + "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" + execute(cmd_str) + end + + def build_linker_fields + command = tackit($cfg['linker']['path']) + if $cfg['linker']['options'].nil? + options = '' + else + options = squash('', $cfg['linker']['options']) + end + if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?) + includes = '' + else + includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) + end + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :options => options, :includes => includes} + end + + def link(exe_name, obj_list) + linker = build_linker_fields + cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + + (obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).join + + $cfg['linker']['bin_files']['prefix'] + ' ' + + $cfg['linker']['bin_files']['destination'] + + exe_name + $cfg['linker']['bin_files']['extension'] + execute(cmd_str) + end + + def build_simulator_fields + return nil if $cfg['simulator'].nil? + if $cfg['simulator']['path'].nil? + command = '' + else + command = (tackit($cfg['simulator']['path']) + ' ') + end + if $cfg['simulator']['pre_support'].nil? + pre_support = '' + else + pre_support = squash('', $cfg['simulator']['pre_support']) + end + if $cfg['simulator']['post_support'].nil? + post_support = '' + else + post_support = squash('', $cfg['simulator']['post_support']) + end + return {:command => command, :pre_support => pre_support, :post_support => post_support} + end + + def execute(command_string, verbose=true) + report command_string + output = `#{command_string}`.chomp + report(output) if (verbose && !output.nil? && (output.length > 0)) + if $?.exitstatus != 0 + raise "Command failed. (Returned #{$?.exitstatus})" + end + return output + end + + def report_summary + summary = UnityTestSummary.new + summary.set_root_path(HERE) + results_glob = "#{$cfg['compiler']['build_path']}*.test*" + results_glob.gsub!(/\\/, '/') + results = Dir[results_glob] + summary.set_targets(results) + summary.run + end + + def run_tests(test_files) + report 'Running Unity system tests...' + + # Tack on TEST define for compiling unit tests + load_configuration($cfg_file) + test_defines = ['TEST'] + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + $cfg['compiler']['defines']['items'] << 'TEST' + + include_dirs = get_local_include_dirs + + # Build and execute each unit test + test_files.each do |test| + obj_list = [] + + # Detect dependencies and build required modules + extract_headers(test).each do |header| + # Compile corresponding source file if it exists + src_file = find_source_file(header, include_dirs) + if !src_file.nil? + compile(src_file, test_defines) + obj_list << header.ext($cfg['compiler']['object_files']['extension']) + end + end + + # Build the test runner (generate if configured to do so) + test_base = File.basename(test, C_EXTENSION) + + runner_name = test_base + '_Runner.c' + runner_path = '' + + if $cfg['compiler']['runner_path'].nil? + runner_path = $cfg['compiler']['build_path'] + runner_name + else + runner_path = $cfg['compiler']['runner_path'] + runner_name + end + + options = $cfg[:unity] + options[:use_param_tests] = (test =~ /parameterized/) ? true : false + UnityTestRunnerGenerator.new(options).run(test, runner_path) + + compile(runner_path, test_defines) + obj_list << runner_name.ext($cfg['compiler']['object_files']['extension']) + + # Build the test module + compile(test, test_defines) + obj_list << test_base.ext($cfg['compiler']['object_files']['extension']) + + # Link the test executable + link(test_base, obj_list) + + # Execute unit test and generate results file + simulator = build_simulator_fields + executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] + if simulator.nil? + cmd_str = executable + else + cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" + end + output = execute(cmd_str) + test_results = $cfg['compiler']['build_path'] + test_base + if output.match(/OK$/m).nil? + test_results += '.testfail' + else + test_results += '.testpass' + end + File.open(test_results, 'w') { |f| f.print output } + + end + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/release/build.info b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/release/build.info new file mode 100644 index 0000000..7871b21 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/release/build.info @@ -0,0 +1,2 @@ +118 + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/release/version.info b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/release/version.info new file mode 100644 index 0000000..0d71c08 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/release/version.info @@ -0,0 +1,2 @@ +2.0 + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/src/unity.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/src/unity.c new file mode 100644 index 0000000..d85b880 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/src/unity.c @@ -0,0 +1,855 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity.h" +#include +#include + +#define UNITY_FAIL_AND_BAIL { Unity.CurrentTestFailed = 1; UNITY_OUTPUT_CHAR('\n'); longjmp(Unity.AbortFrame, 1); } +#define UNITY_IGNORE_AND_BAIL { Unity.CurrentTestIgnored = 1; UNITY_OUTPUT_CHAR('\n'); longjmp(Unity.AbortFrame, 1); } +/// return prematurely if we are already in failure or ignore state +#define UNITY_SKIP_EXECUTION { if ((Unity.CurrentTestFailed != 0) || (Unity.CurrentTestIgnored != 0)) {return;} } +#define UNITY_PRINT_EOL { UNITY_OUTPUT_CHAR('\n'); } + +struct _Unity Unity = { 0 }; + +const char* UnityStrNull = "NULL"; +const char* UnityStrSpacer = ". "; +const char* UnityStrExpected = " Expected "; +const char* UnityStrWas = " Was "; +const char* UnityStrTo = " To "; +const char* UnityStrElement = " Element "; +const char* UnityStrMemory = " Memory Mismatch"; +const char* UnityStrDelta = " Values Not Within Delta "; +const char* UnityStrPointless= " You Asked Me To Compare Nothing, Which Was Pointless."; +const char* UnityStrNullPointerForExpected= " Expected pointer to be NULL"; +const char* UnityStrNullPointerForActual = " Actual pointer was NULL"; + +const _U_UINT UnitySizeMask[] = +{ + 255, + 65535, + 65535, + 4294967295, + 4294967295, + 4294967295, + 4294967295 +#ifdef UNITY_SUPPORT_64 + ,0xFFFFFFFFFFFFFFFF +#endif +}; + +//----------------------------------------------- +// Pretty Printers & Test Result Output Handlers +//----------------------------------------------- + +void UnityPrint(const char* string) +{ + const char* pch = string; + + if (pch != NULL) + { + while (*pch) + { + // printable characters plus CR & LF are printed + if ((*pch <= 126) && (*pch >= 32)) + { + UNITY_OUTPUT_CHAR(*pch); + } + //write escaped carriage returns + else if (*pch == 13) + { + UNITY_OUTPUT_CHAR('\\'); + UNITY_OUTPUT_CHAR('r'); + } + //write escaped line feeds + else if (*pch == 10) + { + UNITY_OUTPUT_CHAR('\\'); + UNITY_OUTPUT_CHAR('n'); + } + // unprintable characters are shown as codes + else + { + UNITY_OUTPUT_CHAR('\\'); + UnityPrintNumberHex((_U_SINT)*pch, 2); + } + pch++; + } + } +} + +//----------------------------------------------- +void UnityPrintNumberByStyle(const _U_SINT number, const UNITY_DISPLAY_STYLE_T style) +{ + if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT) + { + UnityPrintNumber(number); + } + else if ((style & UNITY_DISPLAY_RANGE_UINT) == UNITY_DISPLAY_RANGE_UINT) + { + UnityPrintNumberUnsigned( (_U_UINT)number & UnitySizeMask[((_U_UINT)style & (_U_UINT)0x0F) - 1] ); + } + else + { + UnityPrintNumberHex((_U_UINT)number, (style & 0x000F) << 1); + } +} + +//----------------------------------------------- +/// basically do an itoa using as little ram as possible +void UnityPrintNumber(const _U_SINT number_to_print) +{ + _U_SINT divisor = 1; + _U_SINT next_divisor; + _U_SINT number = number_to_print; + + if (number < 0) + { + UNITY_OUTPUT_CHAR('-'); + number = -number; + } + + // figure out initial divisor + while (number / divisor > 9) + { + next_divisor = divisor * 10; + if (next_divisor > divisor) + divisor = next_divisor; + else + break; + } + + // now mod and print, then divide divisor + do + { + UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10))); + divisor /= 10; + } + while (divisor > 0); +} + +//----------------------------------------------- +/// basically do an itoa using as little ram as possible +void UnityPrintNumberUnsigned(const _U_UINT number) +{ + _U_UINT divisor = 1; + _U_UINT next_divisor; + + // figure out initial divisor + while (number / divisor > 9) + { + next_divisor = divisor * 10; + if (next_divisor > divisor) + divisor = next_divisor; + else + break; + } + + // now mod and print, then divide divisor + do + { + UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10))); + divisor /= 10; + } + while (divisor > 0); +} + +//----------------------------------------------- +void UnityPrintNumberHex(const _U_UINT number, const char nibbles_to_print) +{ + _U_UINT nibble; + char nibbles = nibbles_to_print; + UNITY_OUTPUT_CHAR('0'); + UNITY_OUTPUT_CHAR('x'); + + while (nibbles > 0) + { + nibble = (number >> (--nibbles << 2)) & 0x0000000F; + if (nibble <= 9) + { + UNITY_OUTPUT_CHAR((char)('0' + nibble)); + } + else + { + UNITY_OUTPUT_CHAR((char)('A' - 10 + nibble)); + } + } +} + +//----------------------------------------------- +void UnityPrintMask(const _U_UINT mask, const _U_UINT number) +{ + _U_UINT current_bit = (_U_UINT)1 << (UNITY_INT_WIDTH - 1); + _US32 i; + + for (i = 0; i < UNITY_INT_WIDTH; i++) + { + if (current_bit & mask) + { + if (current_bit & number) + { + UNITY_OUTPUT_CHAR('1'); + } + else + { + UNITY_OUTPUT_CHAR('0'); + } + } + else + { + UNITY_OUTPUT_CHAR('X'); + } + current_bit = current_bit >> 1; + } +} + +//----------------------------------------------- +#ifdef UNITY_FLOAT_VERBOSE +void UnityPrintFloat(_UF number) +{ + char TempBuffer[32]; + sprintf(TempBuffer, "%.6f", number); + UnityPrint(TempBuffer); +} +#endif + +//----------------------------------------------- +void UnityTestResultsBegin(const char* file, const UNITY_LINE_TYPE line) +{ + UnityPrint(file); + UNITY_OUTPUT_CHAR(':'); + UnityPrintNumber(line); + UNITY_OUTPUT_CHAR(':'); + UnityPrint(Unity.CurrentTestName); + UNITY_OUTPUT_CHAR(':'); +} + +//----------------------------------------------- +void UnityTestResultsFailBegin(const UNITY_LINE_TYPE line) +{ + UnityTestResultsBegin(Unity.TestFile, line); + UnityPrint("FAIL:"); +} + +//----------------------------------------------- +void UnityConcludeTest(void) +{ + if (Unity.CurrentTestIgnored) + { + Unity.TestIgnores++; + } + else if (!Unity.CurrentTestFailed) + { + UnityTestResultsBegin(Unity.TestFile, Unity.CurrentTestLineNumber); + UnityPrint("PASS"); + UNITY_PRINT_EOL; + } + else + { + Unity.TestFailures++; + } + + Unity.CurrentTestFailed = 0; + Unity.CurrentTestIgnored = 0; +} + +//----------------------------------------------- +void UnityAddMsgIfSpecified(const char* msg) +{ + if (msg) + { + UnityPrint(UnityStrSpacer); + UnityPrint(msg); + } +} + +//----------------------------------------------- +void UnityPrintExpectedAndActualStrings(const char* expected, const char* actual) +{ + UnityPrint(UnityStrExpected); + if (expected != NULL) + { + UNITY_OUTPUT_CHAR('\''); + UnityPrint(expected); + UNITY_OUTPUT_CHAR('\''); + } + else + { + UnityPrint(UnityStrNull); + } + UnityPrint(UnityStrWas); + if (actual != NULL) + { + UNITY_OUTPUT_CHAR('\''); + UnityPrint(actual); + UNITY_OUTPUT_CHAR('\''); + } + else + { + UnityPrint(UnityStrNull); + } +} + +//----------------------------------------------- +// Assertion & Control Helpers +//----------------------------------------------- + +int UnityCheckArraysForNull(const void* expected, const void* actual, const UNITY_LINE_TYPE lineNumber, const char* msg) +{ + //return true if they are both NULL + if ((expected == NULL) && (actual == NULL)) + return 1; + + //throw error if just expected is NULL + if (expected == NULL) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrNullPointerForExpected); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + //throw error if just actual is NULL + if (actual == NULL) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrNullPointerForActual); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + //return false if neither is NULL + return 0; +} + +//----------------------------------------------- +// Assertion Functions +//----------------------------------------------- + +void UnityAssertBits(const _U_SINT mask, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + UNITY_SKIP_EXECUTION; + + if ((mask & expected) != (mask & actual)) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrExpected); + UnityPrintMask(mask, expected); + UnityPrint(UnityStrWas); + UnityPrintMask(mask, actual); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualNumber(const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style) +{ + UNITY_SKIP_EXECUTION; + + if (expected != actual) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(expected, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(actual, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualIntArray(const _U_SINT* expected, + const _U_SINT* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style) +{ + _UU32 elements = num_elements; + const _US8* ptr_exp = (_US8*)expected; + const _US8* ptr_act = (_US8*)actual; + + UNITY_SKIP_EXECUTION; + + if (elements == 0) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + switch(style) + { + case UNITY_DISPLAY_STYLE_HEX8: + case UNITY_DISPLAY_STYLE_INT8: + case UNITY_DISPLAY_STYLE_UINT8: + while (elements--) + { + if (*ptr_exp != *ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 1; + ptr_act += 1; + } + break; + case UNITY_DISPLAY_STYLE_HEX16: + case UNITY_DISPLAY_STYLE_INT16: + case UNITY_DISPLAY_STYLE_UINT16: + while (elements--) + { + if (*(_US16*)ptr_exp != *(_US16*)ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*(_US16*)ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*(_US16*)ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 2; + ptr_act += 2; + } + break; +#ifdef UNITY_SUPPORT_64 + case UNITY_DISPLAY_STYLE_HEX64: + case UNITY_DISPLAY_STYLE_INT64: + case UNITY_DISPLAY_STYLE_UINT64: + while (elements--) + { + if (*(_US64*)ptr_exp != *(_US64*)ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*(_US64*)ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*(_US64*)ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 8; + ptr_act += 8; + } + break; +#endif + default: + while (elements--) + { + if (*(_US32*)ptr_exp != *(_US32*)ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*(_US32*)ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*(_US32*)ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 4; + ptr_act += 4; + } + break; + } +} + +//----------------------------------------------- +#ifndef UNITY_EXCLUDE_FLOAT +void UnityAssertEqualFloatArray(const _UF* expected, + const _UF* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UU32 elements = num_elements; + const _UF* ptr_expected = expected; + const _UF* ptr_actual = actual; + _UF diff, tol; + + UNITY_SKIP_EXECUTION; + + if (elements == 0) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + while (elements--) + { + diff = *ptr_expected - *ptr_actual; + if (diff < 0.0) + diff = 0.0 - diff; + tol = UNITY_FLOAT_PRECISION * *ptr_expected; + if (tol < 0.0) + tol = 0.0 - tol; + if (diff > tol) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); +#ifdef UNITY_FLOAT_VERBOSE + UnityPrint(UnityStrExpected); + UnityPrintFloat(*ptr_expected); + UnityPrint(UnityStrWas); + UnityPrintFloat(*ptr_actual); +#else + UnityPrint(UnityStrDelta); +#endif + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_expected++; + ptr_actual++; + } +} + +//----------------------------------------------- +void UnityAssertFloatsWithin(const _UF delta, + const _UF expected, + const _UF actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UF diff = actual - expected; + _UF pos_delta = delta; + + UNITY_SKIP_EXECUTION; + + if (diff < 0) + { + diff = 0.0f - diff; + } + if (pos_delta < 0) + { + pos_delta = 0.0f - pos_delta; + } + + if (pos_delta < diff) + { + UnityTestResultsFailBegin(lineNumber); +#ifdef UNITY_FLOAT_VERBOSE + UnityPrint(UnityStrExpected); + UnityPrintFloat(expected); + UnityPrint(UnityStrWas); + UnityPrintFloat(actual); +#else + UnityPrint(UnityStrDelta); +#endif + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} +#endif + +//----------------------------------------------- +void UnityAssertNumbersWithin( const _U_SINT delta, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style) +{ + UNITY_SKIP_EXECUTION; + + if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT) + { + if (actual > expected) + Unity.CurrentTestFailed = ((actual - expected) > delta); + else + Unity.CurrentTestFailed = ((expected - actual) > delta); + } + else + { + if ((_U_UINT)actual > (_U_UINT)expected) + Unity.CurrentTestFailed = ((_U_UINT)(actual - expected) > (_U_UINT)delta); + else + Unity.CurrentTestFailed = ((_U_UINT)(expected - actual) > (_U_UINT)delta); + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrDelta); + UnityPrintNumberByStyle(delta, style); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(expected, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(actual, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualString(const char* expected, + const char* actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UU32 i; + + UNITY_SKIP_EXECUTION; + + // if both pointers not null compare the strings + if (expected && actual) + { + for (i = 0; expected[i] || actual[i]; i++) + { + if (expected[i] != actual[i]) + { + Unity.CurrentTestFailed = 1; + break; + } + } + } + else + { // handle case of one pointers being null (if both null, test should pass) + if (expected != actual) + { + Unity.CurrentTestFailed = 1; + } + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrintExpectedAndActualStrings(expected, actual); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualStringArray( const char** expected, + const char** actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UU32 i, j = 0; + + UNITY_SKIP_EXECUTION; + + // if no elements, it's an error + if (num_elements == 0) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + do + { + // if both pointers not null compare the strings + if (expected[j] && actual[j]) + { + for (i = 0; expected[j][i] || actual[j][i]; i++) + { + if (expected[j][i] != actual[j][i]) + { + Unity.CurrentTestFailed = 1; + break; + } + } + } + else + { // handle case of one pointers being null (if both null, test should pass) + if (expected[j] != actual[j]) + { + Unity.CurrentTestFailed = 1; + } + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + if (num_elements > 1) + { + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - j - 1), UNITY_DISPLAY_STYLE_UINT); + } + UnityPrintExpectedAndActualStrings((const char*)(expected[j]), (const char*)(actual[j])); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + } while (++j < num_elements); +} + +//----------------------------------------------- +void UnityAssertEqualMemory( const void* expected, + const void* actual, + _UU32 length, + _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + unsigned char* expected_ptr = (unsigned char*)expected; + unsigned char* actual_ptr = (unsigned char*)actual; + _UU32 elements = num_elements; + + UNITY_SKIP_EXECUTION; + + if ((elements == 0) || (length == 0)) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + while (elements--) + { + if (memcmp((const void*)expected_ptr, (const void*)actual_ptr, length) != 0) + { + Unity.CurrentTestFailed = 1; + break; + } + expected_ptr += length; + actual_ptr += length; + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + if (num_elements > 1) + { + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + } + UnityPrint(UnityStrMemory); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +// Control Functions +//----------------------------------------------- + +void UnityFail(const char* msg, const UNITY_LINE_TYPE line) +{ + UNITY_SKIP_EXECUTION; + + UnityTestResultsBegin(Unity.TestFile, line); + UnityPrint("FAIL"); + if (msg != NULL) + { + UNITY_OUTPUT_CHAR(':'); + if (msg[0] != ' ') + { + UNITY_OUTPUT_CHAR(' '); + } + UnityPrint(msg); + } + UNITY_FAIL_AND_BAIL; +} + +//----------------------------------------------- +void UnityIgnore(const char* msg, const UNITY_LINE_TYPE line) +{ + UNITY_SKIP_EXECUTION; + + UnityTestResultsBegin(Unity.TestFile, line); + UnityPrint("IGNORE"); + if (msg != NULL) + { + UNITY_OUTPUT_CHAR(':'); + UNITY_OUTPUT_CHAR(' '); + UnityPrint(msg); + } + UNITY_IGNORE_AND_BAIL; +} + +//----------------------------------------------- +void setUp(void); +void tearDown(void); +void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum) +{ + Unity.CurrentTestName = FuncName; + Unity.CurrentTestLineNumber = FuncLineNum; + Unity.NumberOfTests++; + if (TEST_PROTECT()) + { + setUp(); + Func(); + } + if (TEST_PROTECT() && !(Unity.CurrentTestIgnored)) + { + tearDown(); + } + UnityConcludeTest(); +} + +//----------------------------------------------- +void UnityBegin(void) +{ + Unity.NumberOfTests = 0; +} + +//----------------------------------------------- +int UnityEnd(void) +{ + UnityPrint("-----------------------"); + UNITY_PRINT_EOL; + UnityPrintNumber(Unity.NumberOfTests); + UnityPrint(" Tests "); + UnityPrintNumber(Unity.TestFailures); + UnityPrint(" Failures "); + UnityPrintNumber(Unity.TestIgnores); + UnityPrint(" Ignored"); + UNITY_PRINT_EOL; + if (Unity.TestFailures == 0U) + { + UnityPrint("OK"); + } + else + { + UnityPrint("FAIL"); + } + UNITY_PRINT_EOL; + return Unity.TestFailures; +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/src/unity.h b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/src/unity.h new file mode 100644 index 0000000..0b1b187 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/src/unity.h @@ -0,0 +1,213 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FRAMEWORK_H +#define UNITY_FRAMEWORK_H + +#define UNITY + +#include "unity_internals.h" + +//------------------------------------------------------- +// Configuration Options +//------------------------------------------------------- + +// Integers +// - Unity assumes 32 bit integers by default +// - If your compiler treats ints of a different size, define UNITY_INT_WIDTH + +// Floats +// - define UNITY_EXCLUDE_FLOAT to disallow floating point comparisons +// - define UNITY_FLOAT_PRECISION to specify the precision to use when doing TEST_ASSERT_EQUAL_FLOAT +// - define UNITY_FLOAT_TYPE to specify doubles instead of single precision floats +// - define UNITY_FLOAT_VERBOSE to print floating point values in errors (uses sprintf) + +// Output +// - by default, Unity prints to standard out with putchar. define UNITY_OUTPUT_CHAR(a) with a different function if desired + +// Optimization +// - by default, line numbers are stored in unsigned shorts. Define UNITY_LINE_TYPE with a different type if your files are huge +// - by default, test and failure counters are unsigned shorts. Define UNITY_COUNTER_TYPE with a different type if you want to save space or have more than 65535 Tests. + +// Test Cases +// - define UNITY_SUPPORT_TEST_CASES to include the TEST_CASE macro, though really it's mostly about the runner generator script + +// Parameterized Tests +// - you'll want to create a define of TEST_CASE(...) which basically evaluates to nothing + +//------------------------------------------------------- +// Test Running Macros +//------------------------------------------------------- + +#define TEST_PROTECT() (setjmp(Unity.AbortFrame) == 0) + +#define TEST_ABORT() {longjmp(Unity.AbortFrame, 1);} + +#ifndef RUN_TEST +#define RUN_TEST(func, line_num) UnityDefaultTestRun(func, #func, line_num) +#endif + +#define TEST_LINE_NUM (Unity.CurrentTestLineNumber) +#define TEST_IS_IGNORED (Unity.CurrentTestIgnored) + +//------------------------------------------------------- +// Basic Fail and Ignore +//------------------------------------------------------- + +#define TEST_FAIL_MESSAGE(message) UNITY_TEST_FAIL(__LINE__, message) +#define TEST_FAIL() UNITY_TEST_FAIL(__LINE__, NULL) +#define TEST_IGNORE_MESSAGE(message) UNITY_TEST_IGNORE(__LINE__, message) +#define TEST_IGNORE() UNITY_TEST_IGNORE(__LINE__, NULL) +#define TEST_ONLY() + +//------------------------------------------------------- +// Test Asserts (simple) +//------------------------------------------------------- + +//Boolean +#define TEST_ASSERT(condition) UNITY_TEST_ASSERT( (condition), __LINE__, " Expression Evaluated To FALSE") +#define TEST_ASSERT_TRUE(condition) UNITY_TEST_ASSERT( (condition), __LINE__, " Expected TRUE Was FALSE") +#define TEST_ASSERT_UNLESS(condition) UNITY_TEST_ASSERT( !(condition), __LINE__, " Expression Evaluated To TRUE") +#define TEST_ASSERT_FALSE(condition) UNITY_TEST_ASSERT( !(condition), __LINE__, " Expected FALSE Was TRUE") +#define TEST_ASSERT_NULL(pointer) UNITY_TEST_ASSERT_NULL( (pointer), __LINE__, " Expected NULL") +#define TEST_ASSERT_NOT_NULL(pointer) UNITY_TEST_ASSERT_NOT_NULL((pointer), __LINE__, " Expected Non-NULL") + +//Integers (of all sizes) +#define TEST_ASSERT_EQUAL_INT(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT8(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT8((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT16(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT16((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT32(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT32((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT64(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT64((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_NOT_EQUAL(expected, actual) UNITY_TEST_ASSERT(((expected) != (actual)), __LINE__, " Expected Not-Equal") +#define TEST_ASSERT_EQUAL_UINT(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT8(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT8( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT16(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT16( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT32(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT32( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT64(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT64( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX8(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX8( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX16(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX16((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX32(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX64(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX64((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_BITS(mask, expected, actual) UNITY_TEST_ASSERT_BITS((mask), (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_BITS_HIGH(mask, actual) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(-1), (actual), __LINE__, NULL) +#define TEST_ASSERT_BITS_LOW(mask, actual) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(0), (actual), __LINE__, NULL) +#define TEST_ASSERT_BIT_HIGH(bit, actual) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(-1), (actual), __LINE__, NULL) +#define TEST_ASSERT_BIT_LOW(bit, actual) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(0), (actual), __LINE__, NULL) + +//Integer Ranges (of all sizes) +#define TEST_ASSERT_INT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_UINT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX8_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX16_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX32_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX64_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, __LINE__, NULL) + +//Structs and Strings +#define TEST_ASSERT_EQUAL_PTR(expected, actual) UNITY_TEST_ASSERT_EQUAL_PTR((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_STRING(expected, actual) UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_MEMORY(expected, actual, len) UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, __LINE__, NULL) + +//Arrays +#define TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements) UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, __LINE__, NULL) + +//Floating Point (If Enabled) +#define TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_FLOAT(expected, actual) UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, __LINE__, NULL) + +//------------------------------------------------------- +// Test Asserts (with additional messages) +//------------------------------------------------------- + +//Boolean +#define TEST_ASSERT_MESSAGE(condition, message) UNITY_TEST_ASSERT( (condition), __LINE__, message) +#define TEST_ASSERT_TRUE_MESSAGE(condition, message) UNITY_TEST_ASSERT( (condition), __LINE__, message) +#define TEST_ASSERT_UNLESS_MESSAGE(condition, message) UNITY_TEST_ASSERT( !(condition), __LINE__, message) +#define TEST_ASSERT_FALSE_MESSAGE(condition, message) UNITY_TEST_ASSERT( !(condition), __LINE__, message) +#define TEST_ASSERT_NULL_MESSAGE(pointer, message) UNITY_TEST_ASSERT_NULL( (pointer), __LINE__, message) +#define TEST_ASSERT_NOT_NULL_MESSAGE(pointer, message) UNITY_TEST_ASSERT_NOT_NULL((pointer), __LINE__, message) + +//Integers (of all sizes) +#define TEST_ASSERT_EQUAL_INT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT8((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT16((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT32((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT64((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, message) +#define TEST_ASSERT_NOT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT(((expected) != (actual)), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT8( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT16( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT32( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT64( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX8( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX16((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX64((expected), (actual), __LINE__, message) +#define TEST_ASSERT_BITS_MESSAGE(mask, expected, actual, message) UNITY_TEST_ASSERT_BITS((mask), (expected), (actual), __LINE__, message) +#define TEST_ASSERT_BITS_HIGH_MESSAGE(mask, actual, message) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(-1), (actual), __LINE__, message) +#define TEST_ASSERT_BITS_LOW_MESSAGE(mask, actual, message) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(0), (actual), __LINE__, message) +#define TEST_ASSERT_BIT_HIGH_MESSAGE(bit, actual, message) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(-1), (actual), __LINE__, message) +#define TEST_ASSERT_BIT_LOW_MESSAGE(bit, actual, message) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(0), (actual), __LINE__, message) + +//Integer Ranges (of all sizes) +#define TEST_ASSERT_INT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_UINT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX8_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX16_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX32_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX64_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, __LINE__, message) + +//Structs and Strings +#define TEST_ASSERT_EQUAL_PTR_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_PTR(expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_STRING_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_MEMORY_MESSAGE(expected, actual, len, message) UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, __LINE__, message) + +//Arrays +#define TEST_ASSERT_EQUAL_INT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_STRING_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_MEMORY_ARRAY_MESSAGE(expected, actual, len, num_elements, message) UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, __LINE__, message) + +//Floating Point (If Enabled) +#define TEST_ASSERT_FLOAT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_FLOAT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_FLOAT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, __LINE__, message) +#endif diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/src/unity_internals.h b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/src/unity_internals.h new file mode 100644 index 0000000..29c9d1d --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/src/unity_internals.h @@ -0,0 +1,355 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_INTERNALS_H +#define UNITY_INTERNALS_H + +#include +#include + +//------------------------------------------------------- +// Int Support +//------------------------------------------------------- + +#ifndef UNITY_INT_WIDTH +#define UNITY_INT_WIDTH (32) +#endif + +#ifndef UNITY_LONG_WIDTH +#define UNITY_LONG_WIDTH (32) +#endif + +#if (UNITY_INT_WIDTH == 32) + typedef unsigned char _UU8; + typedef unsigned short _UU16; + typedef unsigned int _UU32; + typedef signed char _US8; + typedef signed short _US16; + typedef signed int _US32; +#elif (UNITY_INT_WIDTH == 16) + typedef unsigned char _UU8; + typedef unsigned int _UU16; + typedef unsigned long _UU32; + typedef signed char _US8; + typedef signed int _US16; + typedef signed long _US32; +#else + #error Invalid UNITY_INT_WIDTH specified! (16 or 32 are supported) +#endif + +//------------------------------------------------------- +// 64-bit Support +//------------------------------------------------------- + +#ifndef UNITY_SUPPORT_64 + +//No 64-bit Support +typedef _UU32 _U_UINT; +typedef _US32 _U_SINT; + +#else + +//64-bit Support +#if (UNITY_LONG_WIDTH == 32) + typedef unsigned long long _UU64; + typedef signed long long _US64; +#elif (UNITY_LONG_WIDTH == 64) + typedef unsigned long _UU64; + typedef signed long _US64; +#else + #error Invalid UNITY_LONG_WIDTH specified! (32 or 64 are supported) +#endif +typedef _UU64 _U_UINT; +typedef _US64 _U_SINT; + +#endif + +//------------------------------------------------------- +// Pointer Support +//------------------------------------------------------- + +#ifndef UNITY_POINTER_WIDTH +#define UNITY_POINTER_WIDTH (32) +#endif + +#if (UNITY_POINTER_WIDTH == 32) + typedef _UU32 _UP; +#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX32 +#elif (UNITY_POINTER_WIDTH == 64) + typedef _UU64 _UP; +#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX64 +#elif (UNITY_POINTER_WIDTH == 16) + typedef _UU16 _UP; +#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX16 +#else + #error Invalid UNITY_POINTER_WIDTH specified! (16, 32 or 64 are supported) +#endif + +//------------------------------------------------------- +// Float Support +//------------------------------------------------------- + +#ifdef UNITY_EXCLUDE_FLOAT + +//No Floating Point Support +#undef UNITY_FLOAT_PRECISION +#undef UNITY_FLOAT_TYPE +#undef UNITY_FLOAT_VERBOSE + +#else + +//Floating Point Support +#ifndef UNITY_FLOAT_PRECISION +#define UNITY_FLOAT_PRECISION (0.00001f) +#endif +#ifndef UNITY_FLOAT_TYPE +#define UNITY_FLOAT_TYPE float +#endif +typedef UNITY_FLOAT_TYPE _UF; + +#endif + +//------------------------------------------------------- +// Output Method +//------------------------------------------------------- + +#ifndef UNITY_OUTPUT_CHAR +//Default to using putchar, which is defined in stdio.h above +#define UNITY_OUTPUT_CHAR(a) putchar(a) +#else +//If defined as something else, make sure we declare it here so it's ready for use +extern int UNITY_OUTPUT_CHAR(int); +#endif + +//------------------------------------------------------- +// Footprint +//------------------------------------------------------- + +#ifndef UNITY_LINE_TYPE +#define UNITY_LINE_TYPE unsigned short +#endif + +#ifndef UNITY_COUNTER_TYPE +#define UNITY_COUNTER_TYPE unsigned short +#endif + +//------------------------------------------------------- +// Internal Structs Needed +//------------------------------------------------------- + +typedef void (*UnityTestFunction)(void); + +#define UNITY_DISPLAY_RANGE_INT (0x10) +#define UNITY_DISPLAY_RANGE_UINT (0x20) +#define UNITY_DISPLAY_RANGE_HEX (0x40) +#define UNITY_DISPLAY_RANGE_AUTO (0x80) + +typedef enum +{ + UNITY_DISPLAY_STYLE_INT = 4 + UNITY_DISPLAY_RANGE_INT + UNITY_DISPLAY_RANGE_AUTO, + UNITY_DISPLAY_STYLE_INT8 = 1 + UNITY_DISPLAY_RANGE_INT, + UNITY_DISPLAY_STYLE_INT16 = 2 + UNITY_DISPLAY_RANGE_INT, + UNITY_DISPLAY_STYLE_INT32 = 4 + UNITY_DISPLAY_RANGE_INT, +#ifdef UNITY_SUPPORT_64 + UNITY_DISPLAY_STYLE_INT64 = 8 + UNITY_DISPLAY_RANGE_INT, +#endif + UNITY_DISPLAY_STYLE_UINT = 4 + UNITY_DISPLAY_RANGE_UINT + UNITY_DISPLAY_RANGE_AUTO, + UNITY_DISPLAY_STYLE_UINT8 = 1 + UNITY_DISPLAY_RANGE_UINT, + UNITY_DISPLAY_STYLE_UINT16 = 2 + UNITY_DISPLAY_RANGE_UINT, + UNITY_DISPLAY_STYLE_UINT32 = 4 + UNITY_DISPLAY_RANGE_UINT, +#ifdef UNITY_SUPPORT_64 + UNITY_DISPLAY_STYLE_UINT64 = 8 + UNITY_DISPLAY_RANGE_UINT, +#endif + UNITY_DISPLAY_STYLE_HEX8 = 1 + UNITY_DISPLAY_RANGE_HEX, + UNITY_DISPLAY_STYLE_HEX16 = 2 + UNITY_DISPLAY_RANGE_HEX, + UNITY_DISPLAY_STYLE_HEX32 = 4 + UNITY_DISPLAY_RANGE_HEX, +#ifdef UNITY_SUPPORT_64 + UNITY_DISPLAY_STYLE_HEX64 = 8 + UNITY_DISPLAY_RANGE_HEX, +#endif +} UNITY_DISPLAY_STYLE_T; + +struct _Unity +{ + const char* TestFile; + const char* CurrentTestName; + _UU32 CurrentTestLineNumber; + UNITY_COUNTER_TYPE NumberOfTests; + UNITY_COUNTER_TYPE TestFailures; + UNITY_COUNTER_TYPE TestIgnores; + UNITY_COUNTER_TYPE CurrentTestFailed; + UNITY_COUNTER_TYPE CurrentTestIgnored; + jmp_buf AbortFrame; +}; + +extern struct _Unity Unity; + +//------------------------------------------------------- +// Test Suite Management +//------------------------------------------------------- + +void UnityBegin(void); +int UnityEnd(void); +void UnityConcludeTest(void); +void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum); + +//------------------------------------------------------- +// Test Output +//------------------------------------------------------- + +void UnityPrint(const char* string); +void UnityPrintMask(const _U_UINT mask, const _U_UINT number); +void UnityPrintNumberByStyle(const _U_SINT number, const UNITY_DISPLAY_STYLE_T style); +void UnityPrintNumber(const _U_SINT number); +void UnityPrintNumberUnsigned(const _U_UINT number); +void UnityPrintNumberHex(const _U_UINT number, const char nibbles); + +#ifdef UNITY_FLOAT_VERBOSE +void UnityPrintFloat(const _UF number); +#endif + +//------------------------------------------------------- +// Test Assertion Fuctions +//------------------------------------------------------- +// Use the macros below this section instead of calling +// these directly. The macros have a consistent naming +// convention and will pull in file and line information +// for you. + +void UnityAssertEqualNumber(const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style); + +void UnityAssertEqualIntArray(const _U_SINT* expected, + const _U_SINT* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style); + +void UnityAssertBits(const _U_SINT mask, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualString(const char* expected, + const char* actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualStringArray( const char** expected, + const char** actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualMemory( const void* expected, + const void* actual, + const _UU32 length, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertNumbersWithin(const _U_SINT delta, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style); + +void UnityFail(const char* message, const UNITY_LINE_TYPE line); + +void UnityIgnore(const char* message, const UNITY_LINE_TYPE line); + +#ifndef UNITY_EXCLUDE_FLOAT +void UnityAssertFloatsWithin(const _UF delta, + const _UF expected, + const _UF actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualFloatArray(const _UF* expected, + const _UF* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber); +#endif + +//------------------------------------------------------- +// Basic Fail and Ignore +//------------------------------------------------------- + +#define UNITY_TEST_FAIL(line, message) UnityFail( (message), (UNITY_LINE_TYPE)line); +#define UNITY_TEST_IGNORE(line, message) UnityIgnore( (message), (UNITY_LINE_TYPE)line); + +//------------------------------------------------------- +// Test Asserts +//------------------------------------------------------- + +#define UNITY_TEST_ASSERT(condition, line, message) if (condition) {} else {UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, message);} +#define UNITY_TEST_ASSERT_NULL(pointer, line, message) UNITY_TEST_ASSERT(((pointer) == NULL), (UNITY_LINE_TYPE)line, message) +#define UNITY_TEST_ASSERT_NOT_NULL(pointer, line, message) UNITY_TEST_ASSERT(((pointer) != NULL), (UNITY_LINE_TYPE)line, message) + +#define UNITY_TEST_ASSERT_EQUAL_INT(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_UINT(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_HEX8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX8) +#define UNITY_TEST_ASSERT_EQUAL_HEX16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX16) +#define UNITY_TEST_ASSERT_EQUAL_HEX32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX32) +#define UNITY_TEST_ASSERT_BITS(mask, expected, actual, line, message) UnityAssertBits((_U_SINT)(mask), (_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line) + +#define UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX8) +#define UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX16) +#define UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX32) +#define UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64) + +#define UNITY_TEST_ASSERT_EQUAL_PTR(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(_UP)(expected), (_U_SINT)(_UP)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_POINTER) +#define UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, line, message) UnityAssertEqualString((const char*)(expected), (const char*)(actual), (message), (UNITY_LINE_TYPE)line) +#define UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, line, message) UnityAssertEqualMemory((void*)(expected), (void*)(actual), (_UU32)(len), 1, (message), (UNITY_LINE_TYPE)line) + +#define UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT8) +#define UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT16) +#define UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT32) +#define UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT8) +#define UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT16) +#define UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT32) +#define UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX8) +#define UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX16) +#define UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX32) +#define UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualStringArray((const char**)(expected), (const char**)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line) +#define UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, line, message) UnityAssertEqualMemory((void*)(expected), (void*)(actual), (_UU32)(len), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line) + +#ifdef UNITY_SUPPORT_64 +#define UNITY_TEST_ASSERT_EQUAL_INT64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT64) +#define UNITY_TEST_ASSERT_EQUAL_UINT64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT64) +#define UNITY_TEST_ASSERT_EQUAL_HEX64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64) +#define UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT64) +#define UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT64) +#define UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64) +#endif + +#ifdef UNITY_EXCLUDE_FLOAT +#define UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled") +#define UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled") +#define UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled") +#else +#define UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, line, message) UnityAssertFloatsWithin((_UF)(delta), (_UF)(expected), (_UF)(actual), (message), (UNITY_LINE_TYPE)line) +#define UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, line, message) UNITY_TEST_ASSERT_FLOAT_WITHIN((_UF)(expected) * (_UF)UNITY_FLOAT_PRECISION, (_UF)expected, (_UF)actual, (UNITY_LINE_TYPE)line, message) +#define UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualFloatArray((_UF*)(expected), (_UF*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line) +#endif + +#endif diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/gcc.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/gcc.yml new file mode 100644 index 0000000..0f18c6c --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/gcc.yml @@ -0,0 +1,42 @@ +compiler: + path: gcc + source_path: 'src/' + unit_tests_path: &unit_tests_path 'test/' + build_path: &build_path 'build/' + options: + - '-c' + - '-Wall' + - '-Wno-address' + - '-std=c99' + - '-pedantic' + includes: + prefix: '-I' + items: + - 'src/' + - '../src/' + - *unit_tests_path + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - UNITY_SUPPORT_TEST_CASES + object_files: + prefix: '-o' + extension: '.o' + destination: *build_path +linker: + path: gcc + options: + - -lm + includes: + prefix: '-I' + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.exe' + destination: *build_path +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/gcc_64.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/gcc_64.yml new file mode 100644 index 0000000..97cb958 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/gcc_64.yml @@ -0,0 +1,43 @@ +compiler: + path: gcc + source_path: 'src/' + unit_tests_path: &unit_tests_path 'test/' + build_path: &build_path 'build/' + options: + - '-c' + - '-Wall' + - '-Wno-address' + - '-std=c99' + - '-pedantic' + includes: + prefix: '-I' + items: + - 'src/' + - '../src/' + - *unit_tests_path + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - UNITY_SUPPORT_TEST_CASES + - 'UNITY_POINTER_WIDTH=64' + object_files: + prefix: '-o' + extension: '.o' + destination: *build_path +linker: + path: gcc + options: + - -lm + includes: + prefix: '-I' + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.exe' + destination: *build_path +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/hitech_picc18.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/hitech_picc18.yml new file mode 100644 index 0000000..210d944 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/hitech_picc18.yml @@ -0,0 +1,101 @@ +# rumor has it that this yaml file works for the standard edition of the +# hitech PICC18 compiler, but not the pro version. +# +compiler: + path: cd build && picc18 + source_path: 'c:\Projects\NexGen\Prototypes\CMockTest\src\' + unit_tests_path: &unit_tests_path 'c:\Projects\NexGen\Prototypes\CMockTest\test\' + build_path: &build_path 'c:\Projects\NexGen\Prototypes\CMockTest\build\' + options: + - --chip=18F87J10 + - --ide=hitide + - --q #quiet please + - --asmlist + - --codeoffset=0 + - --emi=wordwrite # External memory interface protocol + - --warn=0 # allow all normal warning messages + - --errors=10 # Number of errors before aborting compile + - --char=unsigned + - -Bl # Large memory model + - -G # generate symbol file + - --cp=16 # 16-bit pointers + - --double=24 + - -N255 # 255-char symbol names + - --opt=none # Do not use any compiler optimziations + - -c # compile only + - -M + includes: + prefix: '-I' + items: + - 'c:/Projects/NexGen/Prototypes/CMockTest/src/' + - 'c:/Projects/NexGen/Prototypes/CMockTest/mocks/' + - 'c:/CMock/src/' + - 'c:/CMock/examples/src/' + - 'c:/CMock/vendor/unity/src/' + - 'c:/CMock/vendor/unity/examples/helper/' + - *unit_tests_path + defines: + prefix: '-D' + items: + - UNITY_INT_WIDTH=16 + - UNITY_POINTER_WIDTH=16 + - CMOCK_MEM_STATIC + - CMOCK_MEM_SIZE=3000 + - UNITY_SUPPORT_TEST_CASES + - _PICC18 + object_files: + # prefix: '-O' # Hi-Tech doesn't want a prefix. They key off of filename .extensions, instead + extension: '.obj' + destination: *build_path + +linker: + path: cd build && picc18 + options: + - --chip=18F87J10 + - --ide=hitide + - --cp=24 # 24-bit pointers. Is this needed for linker?? + - --double=24 # Is this needed for linker?? + - -Lw # Scan the pic87*w.lib in the lib/ of the compiler installation directory + - --summary=mem,file # info listing + - --summary=+psect + - --summary=+hex + - --output=+intel + - --output=+mcof + - --runtime=+init # Directs startup code to copy idata, ibigdata and ifardata psects from ROM to RAM. + - --runtime=+clear # Directs startup code to clear bss, bigbss, rbss and farbss psects + - --runtime=+clib # link in the c-runtime + - --runtime=+keep # Keep the generated startup src after its obj is linked + - -G # Generate src-level symbol file + - -MIWasTheLastToBuild.map + - --warn=0 # allow all normal warning messages + - -Bl # Large memory model (probably not needed for linking) + includes: + prefix: '-I' + object_files: + path: *build_path + extension: '.obj' + bin_files: + prefix: '-O' + extension: '.hex' + destination: *build_path + +simulator: + path: + pre_support: + - 'java -client -jar ' # note space + - ['C:\Program Files\HI-TECH Software\HI-TIDE\3.15\lib\', 'simpic18.jar'] + - 18F87J10 + post_support: + +:cmock: + :plugins: [] + :includes: + - Types.h + :suite_teardown: | + if (num_failures) + _FAILED_TEST(); + else + _PASSED_TESTS(); + return 0; + +colour: true \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_arm_v4.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_arm_v4.yml new file mode 100644 index 0000000..c2e7f18 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_arm_v4.yml @@ -0,0 +1,89 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 4.0 Kickstart\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\lib\dl4tptinl8n.h'] + - -z3 + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian little + - --cpu ARM7TDMI + - --stack_align 4 + - --interwork + - -e + - --silent + - --warnings_are_errors + - --fpu None + - --diag_suppress Pa050 + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'common\bin\xlink.exe'] + options: + - -rt + - [*tools_root, 'arm\lib\dl4tptinl8n.r79'] + - -D_L_EXTMEM_START=0 + - -D_L_EXTMEM_SIZE=0 + - -D_L_HEAP_SIZE=120 + - -D_L_STACK_SIZE=32 + - -e_small_write=_formatted_write + - -s + - __program_start + - -f + - [*tools_root, '\arm\config\lnkarm.xcl'] + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\config\'] + - [*tools_root, 'arm\lib\'] + object_files: + path: *build_path + extension: '.r79' + bin_files: + prefix: '-o' + extension: '.d79' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\ioat91sam7X256.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_arm_v5.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_arm_v5.yml new file mode 100644 index 0000000..0549d8e --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_arm_v5.yml @@ -0,0 +1,79 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian=little + - --cpu=ARM7TDMI + - --interwork + - --warnings_are_errors + - --fpu=None + - --diag_suppress=Pa050 + - --diag_suppress=Pe111 + - -e + - -On + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\debugger\atmel\ioat91sam7X256.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_arm_v5_3.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_arm_v5_3.yml new file mode 100644 index 0000000..0549d8e --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_arm_v5_3.yml @@ -0,0 +1,79 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian=little + - --cpu=ARM7TDMI + - --interwork + - --warnings_are_errors + - --fpu=None + - --diag_suppress=Pa050 + - --diag_suppress=Pe111 + - -e + - -On + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\debugger\atmel\ioat91sam7X256.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml new file mode 100644 index 0000000..eb0785c --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml @@ -0,0 +1,93 @@ +#Default tool path for IAR 5.4 on Windows XP 64bit +tools_root: &tools_root 'C:\Program Files (x86)\IAR Systems\Embedded Workbench 5.4 Kickstart\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --diag_suppress=Pa050 + #- --diag_suppress=Pe111 + - --debug + - --endian=little + - --cpu=Cortex-M3 + - --no_path_in_file_macros + - -e + - --fpu=None + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + #- --preinclude --preinclude C:\Vss\T2 Working\common\system.h + - --interwork + - --warnings_are_errors +# - Ohz + - -Oh +# - --no_cse +# - --no_unroll +# - --no_inline +# - --no_code_motion +# - --no_tbaa +# - --no_clustering +# - --no_scheduling + + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - ewarm + - PART_LM3S9B92 + - TARGET_IS_TEMPEST_RB1 + - USE_ROM_DRIVERS + - UART_BUFFERED + - UNITY_SUPPORT_64 + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic.icf'] +# - ['C:\Temp\lm3s9b92.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + #- --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim2.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - --endian=little + - --cpu=Cortex-M3 + - --fpu=None + - -p + - [*tools_root, 'arm\config\debugger\TexasInstruments\iolm3sxxxx.ddf'] + - --semihosting + - --device=LM3SxBxx + #- -d + #- sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_cortexm3_v5.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_cortexm3_v5.yml new file mode 100644 index 0000000..cf0d1d0 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_cortexm3_v5.yml @@ -0,0 +1,83 @@ +# unit testing under iar compiler / simulator for STM32 Cortex-M3 + +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.4\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian=little + - --cpu=Cortex-M3 + - --interwork + - --warnings_are_errors + - --fpu=None + - --diag_suppress=Pa050 + - --diag_suppress=Pe111 + - -e + - -On + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - 'IAR' + - 'UNITY_SUPPORT_64' + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic_cortex.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\debugger\ST\iostm32f107xx.ddf'] + - --cpu=Cortex-M3 + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_msp430.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_msp430.yml new file mode 100644 index 0000000..e022647 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_msp430.yml @@ -0,0 +1,94 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3 MSP430\' +core_root: &core_root [*tools_root, '430\'] +core_bin: &core_bin [*core_root, 'bin\'] +core_config: &core_config [*core_root, 'config\'] +core_lib: &core_lib [*core_root, 'lib\'] +core_inc: &core_inc [*core_root, 'inc\'] +core_config: &core_config [*core_root, 'config\'] + +compiler: + path: [*core_bin, 'icc430.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*core_lib, 'dlib\dl430fn.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --debug + - -e + - -Ol + - --multiplier=16 + - --double=32 + - --diag_suppress Pa050 + - --diag_suppress Pe111 + includes: + prefix: '-I' + items: + - *core_inc + - [*core_inc, 'dlib'] + - [*core_lib, 'dlib'] + - 'src\' + - '../src/' + - *unit_tests_path + - 'vendor\unity\src' + defines: + prefix: '-D' + items: + - '__MSP430F149__' + - 'INT_WIDTH=16' + - 'UNITY_EXCLUDE_FLOAT' + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r43' + destination: *build_path +linker: + path: [*core_bin, 'xlink.exe'] + options: + - -rt + - [*core_lib, 'dlib\dl430fn.r43'] + - -e_PrintfTiny=_Printf + - -e_ScanfSmall=_Scanf + - -s __program_start + - -D_STACK_SIZE=50 + - -D_DATA16_HEAP_SIZE=50 + - -D_DATA20_HEAP_SIZE=50 + - -f + - [*core_config, 'lnk430f5438.xcl'] + - -f + - [*core_config, 'multiplier.xcl'] + includes: + prefix: '-I' + items: + - *core_config + - *core_lib + - [*core_lib, 'dlib'] + object_files: + path: *build_path + extension: '.r79' + bin_files: + prefix: '-o' + extension: '.d79' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*core_bin, '430proc.dll'] + - [*core_bin, '430sim.dll'] + post_support: + - --plugin + - [*core_bin, '430bat.dll'] + - --backend -B + - --cpu MSP430F5438 + - -p + - [*core_config, 'MSP430F5438.ddf'] + - -d sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_sh2a_v6.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_sh2a_v6.yml new file mode 100644 index 0000000..ddc5603 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_sh2a_v6.yml @@ -0,0 +1,85 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 6.0\' +compiler: + path: [*tools_root, 'sh\bin\iccsh.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - -e + - --char_is_signed + - -Ol + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_scheduling + - --no_clustering + - --debug + - --dlib_config + - [*tools_root, 'sh\inc\DLib_Product.h'] + - --double=32 + - --code_model=huge + - --data_model=huge + - --core=sh2afpu + - --warnings_affect_exit_code + - --warnings_are_errors + - --mfc + - --use_unix_directory_separators + - --diag_suppress=Pe161 + includes: + prefix: '-I' + items: + - [*tools_root, 'sh\inc\'] + - [*tools_root, 'sh\inc\c'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.o' + destination: *build_path +linker: + path: [*tools_root, 'sh\bin\ilinksh.exe'] + options: + - --redirect __Printf=__PrintfSmall + - --redirect __Scanf=__ScanfSmall + - --config + - [*tools_root, 'sh\config\generic.icf'] + - --config_def _CSTACK_SIZE=0x800 + - --config_def _HEAP_SIZE=0x800 + - --config_def _INT_TABLE=0x10 + - --entry __iar_program_start + - --debug_lib + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'sh\bin\shproc.dll'] + - [*tools_root, 'sh\bin\shsim.dll'] + post_support: + - --plugin + - [*tools_root, 'sh\bin\shbat.dll'] + - --backend + - -B + - --core sh2afpu + - -p + - [*tools_root, 'sh\config\debugger\io7264.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_cmd.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_cmd.c new file mode 100644 index 0000000..42841d8 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_cmd.c @@ -0,0 +1,54 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include +#include "CException.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_def.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_def.c new file mode 100644 index 0000000..8280804 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_def.c @@ -0,0 +1,50 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_cmd.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_cmd.c new file mode 100644 index 0000000..e47b31c --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_cmd.c @@ -0,0 +1,76 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_def.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_def.c new file mode 100644 index 0000000..3ca9dba --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_def.c @@ -0,0 +1,72 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new1.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new1.c new file mode 100644 index 0000000..a7cbcd8 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new1.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + GlobalExpectCount = 0; + GlobalVerifyOrder = 0; + GlobalOrderError = NULL; + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new2.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new2.c new file mode 100644 index 0000000..2c76bf2 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new2.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_param.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_param.c new file mode 100644 index 0000000..23c04f4 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_param.c @@ -0,0 +1,73 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST_NO_ARGS +#define RUN_TEST(TestFunc, TestLineNum, ...) \ +{ \ + Unity.CurrentTestName = #TestFunc "(" #__VA_ARGS__ ")"; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(__VA_ARGS__); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21, RUN_TEST_NO_ARGS); + RUN_TEST(test_TheSecondThingToTest, 43, RUN_TEST_NO_ARGS); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run1.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run1.c new file mode 100644 index 0000000..a7cbcd8 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run1.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + GlobalExpectCount = 0; + GlobalVerifyOrder = 0; + GlobalOrderError = NULL; + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run2.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run2.c new file mode 100644 index 0000000..2c76bf2 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run2.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_yaml.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_yaml.c new file mode 100644 index 0000000..68b545a --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_yaml.c @@ -0,0 +1,86 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include "two.h" +#include "three.h" +#include +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_yaml_setup(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_new1.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_new1.c new file mode 100644 index 0000000..e5bcac2 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_new1.c @@ -0,0 +1,60 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_new2.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_new2.c new file mode 100644 index 0000000..b7c7e5b --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_new2.c @@ -0,0 +1,63 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_param.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_param.c new file mode 100644 index 0000000..4157007 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_param.c @@ -0,0 +1,51 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST_NO_ARGS +#define RUN_TEST(TestFunc, TestLineNum, ...) \ +{ \ + Unity.CurrentTestName = #TestFunc "(" #__VA_ARGS__ ")"; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(__VA_ARGS__); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21, RUN_TEST_NO_ARGS); + RUN_TEST(test_TheSecondThingToTest, 43, RUN_TEST_NO_ARGS); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_run1.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_run1.c new file mode 100644 index 0000000..e5bcac2 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_run1.c @@ -0,0 +1,60 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_run2.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_run2.c new file mode 100644 index 0000000..b7c7e5b --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_run2.c @@ -0,0 +1,63 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_yaml.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_yaml.c new file mode 100644 index 0000000..d109287 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_yaml.c @@ -0,0 +1,64 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "two.h" +#include "three.h" +#include +#include +#include +#include "CException.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_yaml_setup(); +} + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/test_generate_test_runner.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/test_generate_test_runner.rb new file mode 100644 index 0000000..61c8df9 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/test_generate_test_runner.rb @@ -0,0 +1,94 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +ruby_version = RUBY_VERSION.split('.') +if (ruby_version[1].to_i == 9) and (ruby_version[2].to_i > 1) + require 'rubygems' + gem 'test-unit' +end +require 'test/unit' +require './auto/generate_test_runner.rb' + +TEST_FILE = 'test/testdata/testsample.c' +TEST_MOCK = 'test/testdata/mocksample.c' +OUT_FILE = 'build/testsample_' +EXP_FILE = 'test/expectdata/testsample_' + +class TestGenerateTestRunner < Test::Unit::TestCase + def setup + end + + def teardown + end + + def verify_output_equal(subtest) + expected = File.read(EXP_FILE + subtest + '.c').gsub(/\r\n/,"\n") + actual = File.read(OUT_FILE + subtest + '.c').gsub(/\r\n/,"\n") + assert_equal(expected, actual, "Generated File Sub-Test '#{subtest}' Failed") + end + + def test_ShouldGenerateARunnerByCreatingRunnerWithOptions + sets = { 'def' => nil, + 'new1' => { :plugins => [:cexception], :includes => ['one.h', 'two.h'], :enforce_strict_ordering => true }, + 'new2' => { :plugins => [:ignore], :suite_setup => "a_custom_setup();", :suite_teardown => "a_custom_teardown();" } + } + + sets.each_pair do |subtest, options| + UnityTestRunnerGenerator.new(options).run(TEST_FILE, OUT_FILE + subtest + '.c') + verify_output_equal(subtest) + UnityTestRunnerGenerator.new(options).run(TEST_MOCK, OUT_FILE + 'mock_' + subtest + '.c') + verify_output_equal('mock_' + subtest) + end + end + + def test_ShouldGenerateARunnerByRunningRunnerWithOptions + sets = { 'run1' => { :plugins => [:cexception], :includes => ['one.h', 'two.h'], :enforce_strict_ordering => true }, + 'run2' => { :plugins => [:ignore], :suite_setup => "a_custom_setup();", :suite_teardown => "a_custom_teardown();" } + } + + sets.each_pair do |subtest, options| + UnityTestRunnerGenerator.new.run(TEST_FILE, OUT_FILE + subtest + '.c', options) + verify_output_equal(subtest) + UnityTestRunnerGenerator.new.run(TEST_MOCK, OUT_FILE + 'mock_' + subtest + '.c', options) + verify_output_equal('mock_' + subtest) + end + end + + def test_ShouldGenerateARunnerByPullingYamlOptions + subtest = 'yaml' + cmdstr = "ruby auto/generate_test_runner.rb test/testdata/sample.yml \"#{TEST_FILE}\" \"#{OUT_FILE + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal(subtest) + + cmdstr = "ruby auto/generate_test_runner.rb test/testdata/sample.yml \"#{TEST_MOCK}\" \"#{OUT_FILE + 'mock_' + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal('mock_' + subtest) + end + + def test_ShouldGenerateARunnerByPullingCommandlineOptions + subtest = 'cmd' + cmdstr = "ruby auto/generate_test_runner.rb -cexception \"#{TEST_FILE}\" \"#{OUT_FILE + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal(subtest) + + cmdstr = "ruby auto/generate_test_runner.rb -cexception \"#{TEST_MOCK}\" \"#{OUT_FILE + 'mock_' + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal('mock_' + subtest) + end + + def test_ShouldGenerateARunnerThatUsesParameterizedTests + sets = { 'param' => { :plugins => [:ignore], :use_param_tests => true } + } + + sets.each_pair do |subtest, options| + UnityTestRunnerGenerator.new(options).run(TEST_FILE, OUT_FILE + subtest + '.c') + verify_output_equal(subtest) + UnityTestRunnerGenerator.new(options).run(TEST_MOCK, OUT_FILE + 'mock_' + subtest + '.c') + verify_output_equal('mock_' + subtest) + end + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/mocksample.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/mocksample.c new file mode 100644 index 0000000..b709438 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/mocksample.c @@ -0,0 +1,51 @@ +// This is just a sample test file to be used to test the generator script +#ifndef TEST_SAMPLE_H +#define TEST_SAMPLE_H + +#include +#include "unity.h" +#include "funky.h" +#include "Mockstanky.h" + +void setUp(void) +{ + CustomSetupStuff(); +} + +void tearDown(void) +{ + CustomTeardownStuff +} + +//Yup, nice comment +void test_TheFirstThingToTest(void) +{ + TEST_ASSERT(1); + + TEST_ASSERT_TRUE(1); +} + +/* +void test_ShouldBeIgnored(void) +{ + DoesStuff(); +} +*/ + +//void test_ShouldAlsoNotBeTested(void) +//{ +// Call_An_Expect(); +// +// CallAFunction(); +// test_CallAFunctionThatLooksLikeATest(); +//} + +void test_TheSecondThingToTest(void) +{ + Call_An_Expect(); + + CallAFunction(); + test_CallAFunctionThatLooksLikeATest(); +} + +#endif //TEST_SAMPLE_H diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/sample.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/sample.yml new file mode 100644 index 0000000..9e5eece --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/sample.yml @@ -0,0 +1,9 @@ +:unity: + :includes: + - two.h + - three.h + - + :plugins: + - :cexception + :suite_setup: | + a_yaml_setup(); \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/testsample.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/testsample.c new file mode 100644 index 0000000..4f30ec7 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/testsample.c @@ -0,0 +1,51 @@ +// This is just a sample test file to be used to test the generator script +#ifndef TEST_SAMPLE_H +#define TEST_SAMPLE_H + +#include +#include "unity.h" +#include "funky.h" +#include "stanky.h" + +void setUp(void) +{ + CustomSetupStuff(); +} + +void tearDown(void) +{ + CustomTeardownStuff +} + +//Yup, nice comment +void test_TheFirstThingToTest(void) +{ + TEST_ASSERT(1); + + TEST_ASSERT_TRUE(1); +} + +/* +void test_ShouldBeIgnored(void) +{ + DoesStuff(); +} +*/ + +//void test_ShouldAlsoNotBeTested(void) +//{ +// Call_An_Expect(); +// +// CallAFunction(); +// test_CallAFunctionThatLooksLikeATest(); +//} + +void test_TheSecondThingToTest(void) +{ + Call_An_Expect(); + + CallAFunction(); + test_CallAFunctionThatLooksLikeATest(); +} + +#endif //TEST_SAMPLE_H diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testparameterized.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testparameterized.c new file mode 100644 index 0000000..037cd21 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testparameterized.c @@ -0,0 +1,101 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include +#include "unity.h" + +#define TEST_CASE(...) + +#define EXPECT_ABORT_BEGIN \ + if (TEST_PROTECT()) \ + { + +#define VERIFY_FAILS_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestFailed == 1) ? 0 : 1; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Failed But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +#define VERIFY_IGNORES_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestIgnored == 1) ? 0 : 1; \ + Unity.CurrentTestIgnored = 0; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Ignored But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +int SetToOneToFailInTearDown; +int SetToOneMeanWeAlreadyCheckedThisGuy; + +void setUp(void) +{ + SetToOneToFailInTearDown = 0; + SetToOneMeanWeAlreadyCheckedThisGuy = 0; +} + +void tearDown(void) +{ + if (SetToOneToFailInTearDown == 1) + TEST_FAIL_MESSAGE("<= Failed in tearDown"); + if ((SetToOneMeanWeAlreadyCheckedThisGuy == 0) && (Unity.CurrentTestFailed > 0)) + { + UnityPrint("[[[[ Previous Test Should Have Passed But Did Not ]]]]"); + UNITY_OUTPUT_CHAR('\n'); + } +} + +TEST_CASE(0) +TEST_CASE(44) +TEST_CASE((90)+9) +void test_TheseShouldAllPass(int Num) +{ + TEST_ASSERT_TRUE(Num < 100); +} + +TEST_CASE(3) +TEST_CASE(77) +TEST_CASE( (99) + 1 - (1)) +void test_TheseShouldAllFail(int Num) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(Num > 100); + VERIFY_FAILS_END +} + +TEST_CASE(1) +TEST_CASE(44) +TEST_CASE(99) +TEST_CASE(98) +void test_TheseAreEveryOther(int Num) +{ + if (Num & 1) + { + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(Num > 100); + VERIFY_FAILS_END + } + else + { + TEST_ASSERT_TRUE(Num < 100); + } +} + +void test_NormalPassesStillWork(void) +{ + TEST_ASSERT_TRUE(1); +} + +void test_NormalFailsStillWork(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(0); + VERIFY_FAILS_END +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testunity.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testunity.c new file mode 100644 index 0000000..9f826dc --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testunity.c @@ -0,0 +1,1510 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include +#include "unity.h" + +#define EXPECT_ABORT_BEGIN \ + if (TEST_PROTECT()) \ + { + +#define VERIFY_FAILS_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestFailed == 1) ? 0 : 1; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Failed But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +#define VERIFY_IGNORES_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestIgnored == 1) ? 0 : 1; \ + Unity.CurrentTestIgnored = 0; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Ignored But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +int SetToOneToFailInTearDown; +int SetToOneMeanWeAlreadyCheckedThisGuy; + +void setUp(void) +{ + SetToOneToFailInTearDown = 0; + SetToOneMeanWeAlreadyCheckedThisGuy = 0; +} + +void tearDown(void) +{ + if (SetToOneToFailInTearDown == 1) + TEST_FAIL_MESSAGE("<= Failed in tearDown"); + if ((SetToOneMeanWeAlreadyCheckedThisGuy == 0) && (Unity.CurrentTestFailed > 0)) + { + UnityPrint("[[[[ Previous Test Should Have Passed But Did Not ]]]]"); + UNITY_OUTPUT_CHAR('\n'); + } +} + +void testTrue(void) +{ + TEST_ASSERT(1); + + TEST_ASSERT_TRUE(1); +} + +void testFalse(void) +{ + TEST_ASSERT_FALSE(0); + + TEST_ASSERT_UNLESS(0); +} + +void testPreviousPass(void) +{ + TEST_ASSERT_EQUAL_INT(0U, Unity.TestFailures); +} + +void testNotVanilla(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT(0); + VERIFY_FAILS_END +} + +void testNotTrue(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(0); + VERIFY_FAILS_END +} + +void testNotFalse(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_FALSE(1); + VERIFY_FAILS_END +} + +void testNotUnless(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UNLESS(1); + VERIFY_FAILS_END +} + +void testNotNotEqual(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_NOT_EQUAL(10, 10); + VERIFY_FAILS_END +} + +void testFail(void) +{ + EXPECT_ABORT_BEGIN + TEST_FAIL_MESSAGE("Expected for testing"); + VERIFY_FAILS_END +} + +void testIsNull(void) +{ + char* ptr1 = NULL; + char* ptr2 = "hello"; + + TEST_ASSERT_NULL(ptr1); + TEST_ASSERT_NOT_NULL(ptr2); +} + +void testIsNullShouldFailIfNot(void) +{ + char* ptr1 = "hello"; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_NULL(ptr1); + VERIFY_FAILS_END +} + +void testNotNullShouldFailIfNULL(void) +{ + char* ptr1 = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_NOT_NULL(ptr1); + VERIFY_FAILS_END +} + +void testIgnore(void) +{ + EXPECT_ABORT_BEGIN + TEST_IGNORE(); + TEST_FAIL_MESSAGE("This should not be reached"); + VERIFY_IGNORES_END +} + +void testIgnoreMessage(void) +{ + EXPECT_ABORT_BEGIN + TEST_IGNORE_MESSAGE("This is an expected TEST_IGNORE_MESSAGE string!"); + TEST_FAIL_MESSAGE("This should not be reached"); + VERIFY_IGNORES_END +} + +void testNotEqualInts(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT(3982, 3983); + VERIFY_FAILS_END +} + +void testNotEqualInt8s(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT8(-127, -126); + VERIFY_FAILS_END +} + +void testNotEqualInt16s(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT16(-16383, -16382); + VERIFY_FAILS_END +} + +void testNotEqualInt32s(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT32(-2147483647, -2147483646); + VERIFY_FAILS_END +} + +void testNotEqualBits(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_BITS(0xFF00, 0x5555, 0x5A55); + VERIFY_FAILS_END +} + +void testNotEqualUInts(void) +{ + _UU16 v0, v1; + + v0 = 9000; + v1 = 9001; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualUInt8s(void) +{ + _UU8 v0, v1; + + v0 = 254; + v1 = 255; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT8(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualUInt16s(void) +{ + _UU16 v0, v1; + + v0 = 65535; + v1 = 65534; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualUInt32s(void) +{ + _UU32 v0, v1; + + v0 = 4294967295; + v1 = 4294967294; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT32(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex8s(void) +{ + _UU8 v0, v1; + + v0 = 0x23; + v1 = 0x22; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex8sIfSigned(void) +{ + _US8 v0, v1; + + v0 = -2; + v1 = 2; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex16s(void) +{ + _UU16 v0, v1; + + v0 = 0x1234; + v1 = 0x1235; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex16sIfSigned(void) +{ + _US16 v0, v1; + + v0 = -1024; + v1 = -1028; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex32s(void) +{ + _UU32 v0, v1; + + v0 = 900000; + v1 = 900001; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex32sIfSigned(void) +{ + _US32 v0, v1; + + v0 = -900000; + v1 = 900001; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32(v0, v1); + VERIFY_FAILS_END +} + +void testEqualInts(void) +{ + int v0, v1; + int *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(1837, 1837); + TEST_ASSERT_EQUAL_INT(-27365, -27365); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(19467, v1); + TEST_ASSERT_EQUAL_INT(v0, 19467); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 19467); +} + +void testEqualUints(void) +{ + unsigned int v0, v1; + unsigned int *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_UINT(1837, 1837); + TEST_ASSERT_EQUAL_UINT(v0, v1); + TEST_ASSERT_EQUAL_UINT(19467, v1); + TEST_ASSERT_EQUAL_UINT(v0, 19467); + TEST_ASSERT_EQUAL_UINT(*p0, v1); + TEST_ASSERT_EQUAL_UINT(*p0, *p1); + TEST_ASSERT_EQUAL_UINT(*p0, 19467); + TEST_ASSERT_EQUAL_UINT(60872u, 60872u); +} + +void testNotEqual(void) +{ + TEST_ASSERT_NOT_EQUAL(0, 1); + TEST_ASSERT_NOT_EQUAL(1, 0); + TEST_ASSERT_NOT_EQUAL(100, 101); + TEST_ASSERT_NOT_EQUAL(0, -1); + TEST_ASSERT_NOT_EQUAL(65535, -65535); + TEST_ASSERT_NOT_EQUAL(75, 900); + TEST_ASSERT_NOT_EQUAL(-100, -101); +} + +void testEqualHex8s(void) +{ + _UU8 v0, v1; + _UU8 *p0, *p1; + + v0 = 0x22; + v1 = 0x22; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX8(0x22, 0x22); + TEST_ASSERT_EQUAL_HEX8(v0, v1); + TEST_ASSERT_EQUAL_HEX8(0x22, v1); + TEST_ASSERT_EQUAL_HEX8(v0, 0x22); + TEST_ASSERT_EQUAL_HEX8(*p0, v1); + TEST_ASSERT_EQUAL_HEX8(*p0, *p1); + TEST_ASSERT_EQUAL_HEX8(*p0, 0x22); +} + +void testEqualHex8sNegatives(void) +{ + _UU8 v0, v1; + _UU8 *p0, *p1; + + v0 = 0xDD; + v1 = 0xDD; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX8(0xDD, 0xDD); + TEST_ASSERT_EQUAL_HEX8(v0, v1); + TEST_ASSERT_EQUAL_HEX8(0xDD, v1); + TEST_ASSERT_EQUAL_HEX8(v0, 0xDD); + TEST_ASSERT_EQUAL_HEX8(*p0, v1); + TEST_ASSERT_EQUAL_HEX8(*p0, *p1); + TEST_ASSERT_EQUAL_HEX8(*p0, 0xDD); +} + +void testEqualHex16s(void) +{ + _UU16 v0, v1; + _UU16 *p0, *p1; + + v0 = 0x9876; + v1 = 0x9876; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX16(0x9876, 0x9876); + TEST_ASSERT_EQUAL_HEX16(v0, v1); + TEST_ASSERT_EQUAL_HEX16(0x9876, v1); + TEST_ASSERT_EQUAL_HEX16(v0, 0x9876); + TEST_ASSERT_EQUAL_HEX16(*p0, v1); + TEST_ASSERT_EQUAL_HEX16(*p0, *p1); + TEST_ASSERT_EQUAL_HEX16(*p0, 0x9876); +} + +void testEqualHex32s(void) +{ + _UU32 v0, v1; + _UU32 *p0, *p1; + + v0 = 0x98765432ul; + v1 = 0x98765432ul; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX32(0x98765432ul, 0x98765432ul); + TEST_ASSERT_EQUAL_HEX32(v0, v1); + TEST_ASSERT_EQUAL_HEX32(0x98765432ul, v1); + TEST_ASSERT_EQUAL_HEX32(v0, 0x98765432ul); + TEST_ASSERT_EQUAL_HEX32(*p0, v1); + TEST_ASSERT_EQUAL_HEX32(*p0, *p1); + TEST_ASSERT_EQUAL_HEX32(*p0, 0x98765432ul); +} + +void testEqualBits(void) +{ + _UU32 v0 = 0xFF55AA00; + _UU32 v1 = 0x55550000; + + TEST_ASSERT_BITS(v1, v0, 0x55550000); + TEST_ASSERT_BITS(v1, v0, 0xFF55CC00); + TEST_ASSERT_BITS(0xFFFFFFFF, v0, 0xFF55AA00); + TEST_ASSERT_BITS(0xFFFFFFFF, v0, v0); + TEST_ASSERT_BITS(0xF0F0F0F0, v0, 0xFC5DAE0F); + TEST_ASSERT_BITS_HIGH(v1, v0); + TEST_ASSERT_BITS_LOW(0x000055FF, v0); + TEST_ASSERT_BIT_HIGH(30, v0); + TEST_ASSERT_BIT_LOW(5, v0); +} + +void testEqualShorts(void) +{ + short v0, v1; + short *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(1837, 1837); + TEST_ASSERT_EQUAL_INT(-2987, -2987); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(19467, v1); + TEST_ASSERT_EQUAL_INT(v0, 19467); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 19467); +} + +void testEqualUShorts(void) +{ + unsigned short v0, v1; + unsigned short *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_UINT(1837, 1837); + TEST_ASSERT_EQUAL_UINT(2987, 2987); + TEST_ASSERT_EQUAL_UINT(v0, v1); + TEST_ASSERT_EQUAL_UINT(19467, v1); + TEST_ASSERT_EQUAL_UINT(v0, 19467); + TEST_ASSERT_EQUAL_UINT(*p0, v1); + TEST_ASSERT_EQUAL_UINT(*p0, *p1); + TEST_ASSERT_EQUAL_UINT(*p0, 19467); +} + +void testEqualChars(void) +{ + signed char v0, v1; + signed char *p0, *p1; + + v0 = 109; + v1 = 109; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(42, 42); + TEST_ASSERT_EQUAL_INT(-116, -116); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(109, v1); + TEST_ASSERT_EQUAL_INT(v0, 109); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 109); +} + +void testEqualUChars(void) +{ + unsigned char v0, v1; + unsigned char *p0, *p1; + + v0 = 251; + v1 = 251; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(42, 42); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(251, v1); + TEST_ASSERT_EQUAL_INT(v0, 251); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 251); +} + +void testEqualPointers(void) +{ + int v0, v1; + int *p0, *p1, *p2; + + v0 = 19467; + v1 = 18271; + p0 = &v0; + p1 = &v1; + p2 = &v1; + + TEST_ASSERT_EQUAL_PTR(p0, &v0); + TEST_ASSERT_EQUAL_PTR(&v1, p1); + TEST_ASSERT_EQUAL_PTR(p2, p1); + TEST_ASSERT_EQUAL_PTR(&v0, &v0); +} + +void testNotEqualPointers(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_PTR(0x12345678, 0x12345677); + VERIFY_FAILS_END +} + +void testIntsWithinDelta(void) +{ + TEST_ASSERT_INT_WITHIN(1, 5000, 5001); + TEST_ASSERT_INT_WITHIN(5, 5000, 4996); + TEST_ASSERT_INT_WITHIN(5, 5000, 5005); + TEST_ASSERT_INT_WITHIN(500, 50, -440); + + TEST_ASSERT_INT_WITHIN(2, -1, -1); + TEST_ASSERT_INT_WITHIN(5, 1, -1); + TEST_ASSERT_INT_WITHIN(5, -1, 1); +} + +void testIntsNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_INT_WITHIN(5, 5000, 5006); + VERIFY_FAILS_END +} + +void testUIntsWithinDelta(void) +{ + TEST_ASSERT_UINT_WITHIN(1, 5000, 5001); + TEST_ASSERT_UINT_WITHIN(5, 5000, 4996); + TEST_ASSERT_UINT_WITHIN(5, 5000, 5005); +} + +void testUIntsNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UINT_WITHIN(1, 2147483647u, 2147483649u); + VERIFY_FAILS_END +} + +void testUIntsNotWithinDeltaEvenThoughASignedIntWouldPassSmallFirst(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UINT_WITHIN(5, 1, -1); + VERIFY_FAILS_END +} + +void testUIntsNotWithinDeltaEvenThoughASignedIntWouldPassBigFirst(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UINT_WITHIN(5, -1, 1); + VERIFY_FAILS_END +} + +void testHEX32sWithinDelta(void) +{ + TEST_ASSERT_HEX32_WITHIN(1, 5000, 5001); + TEST_ASSERT_HEX32_WITHIN(5, 5000, 4996); + TEST_ASSERT_HEX32_WITHIN(5, 5000, 5005); +} + +void testHEX32sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX32_WITHIN(1, 2147483647u, 2147483649u); + VERIFY_FAILS_END +} + +void testHEX32sNotWithinDeltaEvenThoughASignedIntWouldPass(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX32_WITHIN(5, 1, -1); + VERIFY_FAILS_END +} + +void testHEX16sWithinDelta(void) +{ + TEST_ASSERT_HEX16_WITHIN(1, 5000, 5001); + TEST_ASSERT_HEX16_WITHIN(5, 5000, 4996); + TEST_ASSERT_HEX16_WITHIN(5, 5000, 5005); +} + +void testHEX16sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX16_WITHIN(2, 65535, 0); + VERIFY_FAILS_END +} + +void testHEX8sWithinDelta(void) +{ + TEST_ASSERT_HEX8_WITHIN(1, 254, 255); + TEST_ASSERT_HEX8_WITHIN(5, 251, 255); + TEST_ASSERT_HEX8_WITHIN(5, 1, 4); +} + +void testHEX8sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX8_WITHIN(2, 255, 0); + VERIFY_FAILS_END +} + +void testEqualStrings(void) +{ + const char *testString = "foo"; + + TEST_ASSERT_EQUAL_STRING(testString, testString); + TEST_ASSERT_EQUAL_STRING("foo", "foo"); + TEST_ASSERT_EQUAL_STRING("foo", testString); + TEST_ASSERT_EQUAL_STRING(testString, "foo"); + TEST_ASSERT_EQUAL_STRING("", ""); +} + +void testEqualStringsWithCarriageReturnsAndLineFeeds(void) +{ + const char *testString = "foo\r\nbar"; + + TEST_ASSERT_EQUAL_STRING(testString, testString); + TEST_ASSERT_EQUAL_STRING("foo\r\nbar", "foo\r\nbar"); + TEST_ASSERT_EQUAL_STRING("foo\r\nbar", testString); + TEST_ASSERT_EQUAL_STRING(testString, "foo\r\nbar"); + TEST_ASSERT_EQUAL_STRING("", ""); +} + +void testNotEqualString1(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("foo", "bar"); + VERIFY_FAILS_END +} + +void testNotEqualString2(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("foo", ""); + VERIFY_FAILS_END +} + +void testNotEqualString3(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("", "bar"); + VERIFY_FAILS_END +} + +void testNotEqualString4(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("bar\r", "bar\n"); + VERIFY_FAILS_END +} + +void testNotEqualString5(void) +{ + const char str1[] = { 0x41, 0x42, 0x03, 0x00 }; + const char str2[] = { 0x41, 0x42, 0x04, 0x00 }; + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING(str1, str2); + VERIFY_FAILS_END +} + +void testNotEqualString_ExpectedStringIsNull(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING(NULL, "bar"); + VERIFY_FAILS_END +} + +void testNotEqualString_ActualStringIsNull(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("foo", NULL); + VERIFY_FAILS_END +} + +void testEqualStringArrays(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, expStrings, 3); + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 3); + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 2); + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 1); +} + +void testNotEqualStringArray1(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray2(void) +{ + const char *testStrings[] = { "zoo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", "boo", "woo", "moo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray3(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", NULL }; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray4(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", NULL, "woo", "moo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray5(void) +{ + const char **testStrings = NULL; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray6(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "zoo" }; + const char **expStrings = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testEqualStringArrayIfBothNulls(void) +{ + const char **testStrings = NULL; + const char **expStrings = NULL; + + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); +} + +void testEqualMemory(void) +{ + const char *testString = "whatever"; + + TEST_ASSERT_EQUAL_MEMORY(testString, testString, 8); + TEST_ASSERT_EQUAL_MEMORY("whatever", "whatever", 8); + TEST_ASSERT_EQUAL_MEMORY("whatever", testString, 8); + TEST_ASSERT_EQUAL_MEMORY(testString, "whatever", 8); + TEST_ASSERT_EQUAL_MEMORY(testString, "whatever", 2); + TEST_ASSERT_EQUAL_MEMORY(NULL, NULL, 1); +} + +void testNotEqualMemory1(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY("foo", "bar", 3); + VERIFY_FAILS_END +} + +void testNotEqualMemory2(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY("fool", "food", 4); + VERIFY_FAILS_END +} + +void testNotEqualMemory3(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY(NULL, "food", 4); + VERIFY_FAILS_END +} + +void testNotEqualMemory4(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY("fool", NULL, 4); + VERIFY_FAILS_END +} + +void testEqualIntArrays(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, -2}; + int p2[] = {1, 8, 987, 2}; + int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p3, 1); +} + +void testNotEqualIntArraysNullExpected(void) +{ + int* p0 = NULL; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArraysNullActual(void) +{ + int* p1 = NULL; + int p0[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArrays1(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArrays2(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {2, 8, 987, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArrays3(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 986, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualInt8Arrays(void) +{ + _US8 p0[] = {1, 8, 117, -2}; + _US8 p1[] = {1, 8, 117, -2}; + _US8 p2[] = {1, 8, 117, 2}; + _US8 p3[] = {1, 50, 60, 70}; + + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p3, 1); +} + +void testNotEqualInt8Arrays(void) +{ + _US8 p0[] = {1, 8, 127, -2}; + _US8 p1[] = {1, 8, 127, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualUIntArrays(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65132u}; + unsigned int p2[] = {1, 8, 987, 2}; + unsigned int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p3, 1); +} + +void testNotEqualUIntArrays1(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUIntArrays2(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUIntArrays3(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualInt16Arrays(void) +{ + _UU16 p0[] = {1, 8, 117, 3}; + _UU16 p1[] = {1, 8, 117, 3}; + _UU16 p2[] = {1, 8, 117, 2}; + _UU16 p3[] = {1, 50, 60, 70}; + + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p3, 1); +} + +void testNotEqualInt16Arrays(void) +{ + _UU16 p0[] = {1, 8, 127, 3}; + _UU16 p1[] = {1, 8, 127, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualUINT16Arrays(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65132u}; + unsigned short p2[] = {1, 8, 987, 2}; + unsigned short p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p3, 1); +} + +void testNotEqualUINT16Arrays1(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUINT16Arrays2(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUINT16Arrays3(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualHEXArrays(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65132u}; + unsigned int p2[] = {1, 8, 987, 2}; + unsigned int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p3, 1); +} + +void testNotEqualHEXArrays1(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEXArrays2(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEXArrays3(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualHEX16Arrays(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65132u}; + unsigned short p2[] = {1, 8, 987, 2}; + unsigned short p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p3, 1); +} + +void testNotEqualHEX16Arrays1(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX16Arrays2(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX16Arrays3(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualHEX8Arrays(void) +{ + unsigned short p0[] = {1, 8, 254u, 123}; + unsigned short p1[] = {1, 8, 254u, 123}; + unsigned short p2[] = {1, 8, 254u, 2}; + unsigned short p3[] = {1, 23, 25, 26}; + + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p3, 1); +} + +void testNotEqualHEX8Arrays1(void) +{ + unsigned char p0[] = {1, 8, 254u, 253u}; + unsigned char p1[] = {1, 8, 254u, 252u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX8Arrays2(void) +{ + unsigned char p0[] = {1, 8, 254u, 253u}; + unsigned char p1[] = {2, 8, 254u, 253u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX8Arrays3(void) +{ + unsigned char p0[] = {1, 8, 254u, 253u}; + unsigned char p1[] = {1, 8, 255u, 253u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualMemoryArrays(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, -2}; + int p2[] = {1, 8, 987, 2}; + int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p0, 4, 1); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p0, 4, 4); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p2, 4, 3); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p3, 4, 1); +} + +void testNotEqualMemoryArraysExpectedNull(void) +{ + int* p0 = NULL; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArraysActualNull(void) +{ + int p0[] = {1, 8, 987, -2}; + int* p1 = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArrays1(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArrays2(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {2, 8, 987, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArrays3(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 986, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testProtection(void) +{ + volatile int mask = 0; + + if (TEST_PROTECT()) + { + mask |= 1; + TEST_ABORT(); + } + else + { + Unity.CurrentTestFailed = 0; + mask |= 2; + } + + TEST_ASSERT_EQUAL(3, mask); +} + +void testIgnoredAndThenFailInTearDown(void) +{ + SetToOneToFailInTearDown = 1; + TEST_IGNORE(); +} + +// ===================== THESE TEST WILL RUN IF YOUR CONFIG INCLUDES 64 BIT SUPPORT ================== +#ifdef UNITY_SUPPORT_64 + +void testEqualHex64s(void) +{ + _UU64 v0, v1; + _UU64 *p0, *p1; + + v0 = 0x9876543201234567; + v1 = 0x9876543201234567; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX64(0x9876543201234567, 0x9876543201234567); + TEST_ASSERT_EQUAL_HEX64(v0, v1); + TEST_ASSERT_EQUAL_HEX64(0x9876543201234567, v1); + TEST_ASSERT_EQUAL_HEX64(v0, 0x9876543201234567); + TEST_ASSERT_EQUAL_HEX64(*p0, v1); + TEST_ASSERT_EQUAL_HEX64(*p0, *p1); + TEST_ASSERT_EQUAL_HEX64(*p0, 0x9876543201234567); +} + +void testNotEqualHex64s(void) +{ + _UU64 v0, v1; + + v0 = 9000000000; + v1 = 9100000000; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex64sIfSigned(void) +{ + _US64 v0, v1; + + v0 = -9000000000; + v1 = 9000000000; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64(v0, v1); + VERIFY_FAILS_END +} + +void testHEX64sWithinDelta(void) +{ + TEST_ASSERT_HEX64_WITHIN(1, 0x7FFFFFFFFFFFFFFF,0x7FFFFFFFFFFFFFFE); + TEST_ASSERT_HEX64_WITHIN(5, 5000, 4996); + TEST_ASSERT_HEX64_WITHIN(5, 5000, 5005); +} + +void testHEX64sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX64_WITHIN(1, 0x7FFFFFFFFFFFFFFF, 0x7FFFFFFFFFFFFFFC); + VERIFY_FAILS_END +} + +void testHEX64sNotWithinDeltaEvenThoughASignedIntWouldPass(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX64_WITHIN(5, 1, -1); + VERIFY_FAILS_END +} + +void testEqualHEX64Arrays(void) +{ + _UU64 p0[] = {1, 8, 987, 65132u}; + _UU64 p1[] = {1, 8, 987, 65132u}; + _UU64 p2[] = {1, 8, 987, 2}; + _UU64 p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p3, 1); +} + +void testNotEqualHEX64Arrays1(void) +{ + _UU64 p0[] = {1, 8, 987, 65132u}; + _UU64 p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX64Arrays2(void) +{ + _UU64 p0[] = {1, 8, 987, 65132u}; + _UU64 p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +#endif //64-bit SUPPORT + +// ===================== THESE TEST WILL RUN IF YOUR CONFIG INCLUDES FLOAT SUPPORT ================== +#ifndef UNITY_EXCLUDE_FLOAT + +void testFloatsWithinDelta(void) +{ + TEST_ASSERT_FLOAT_WITHIN(0.00003f, 187245.03485f, 187245.03488f); + TEST_ASSERT_FLOAT_WITHIN(1.0f, 187245.0f, 187246.0f); + TEST_ASSERT_FLOAT_WITHIN(0.05f, 9273.2549f, 9273.2049f); + TEST_ASSERT_FLOAT_WITHIN(0.007f, -726.93724f, -726.94424f); +} + +void testFloatsNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_FLOAT_WITHIN(0.05f, 9273.2649f, 9273.2049f); + VERIFY_FAILS_END +} + +void testFloatsEqual(void) +{ + TEST_ASSERT_EQUAL_FLOAT(187245.0f, 187246.0f); + TEST_ASSERT_EQUAL_FLOAT(18724.5f, 18724.6f); + TEST_ASSERT_EQUAL_FLOAT(9273.2549f, 9273.2599f); + TEST_ASSERT_EQUAL_FLOAT(-726.93724f, -726.9374f); +} + +void testFloatsNotEqual(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT(9273.9649f, 9273.0049f); + VERIFY_FAILS_END +} + +void testFloatsNotEqualNegative1(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT(-9273.9649f, -9273.0049f); + VERIFY_FAILS_END +} + +void testFloatsNotEqualNegative2(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT(-9273.0049f, -9273.9649f); + VERIFY_FAILS_END +} + +void testEqualFloatArrays(void) +{ + float p0[] = {1.0, -8.0, 25.4, -0.123}; + float p1[] = {1.0, -8.0, 25.4, -0.123}; + float p2[] = {1.0, -8.0, 25.4, -0.2}; + float p3[] = {1.0, -23.0, 25.0, -0.26}; + + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p3, 1); +} + +void testNotEqualFloatArraysExpectedNull(void) +{ + float* p0 = NULL; + float p1[] = {1.0, 8.0, 25.4, 0.252}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysActualNull(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float* p1 = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArrays1(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float p1[] = {1.0, 8.0, 25.4, 0.252}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArrays2(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float p1[] = {2.0, 8.0, 25.4, 0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArrays3(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float p1[] = {1.0, 8.0, 25.5, 0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysNegative1(void) +{ + float p0[] = {-1.0, -8.0, -25.4, -0.253}; + float p1[] = {-1.0, -8.0, -25.4, -0.252}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysNegative2(void) +{ + float p0[] = {-1.0, -8.0, -25.4, -0.253}; + float p1[] = {-2.0, -8.0, -25.4, -0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysNegative3(void) +{ + float p0[] = {-1.0, -8.0, -25.4, -0.253}; + float p1[] = {-1.0, -8.0, -25.5, -0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +#endif //FLOAT SUPPORT diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/CHANGES b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/CHANGES new file mode 100644 index 0000000..4b5184c --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/CHANGES @@ -0,0 +1,78 @@ +Hardmock 1.3.7 + +* BUG FIX: expects! could not setup expectations for more than one concrete method on an object, since the method aliasing and rewriting was only taking place when the background mock instance was first created. This logic has been updated and now you can do all the things you'd expect. + +Hardmock 1.3.6 + +* BUG FIX: In Rails apps (and others) Hardmock and Fixtures battled viciously over "setup" and "teardown" and "method_added" (and any other clever test enhancement tool, namely Mocha) causing unpredictable results, notably failure to auto-verify mocks after teardown (leading to false positive tests). + * The newly-added TestUnitBeforeAfter provides TestCase.before_setup and TestCase.after_teardown -- formal test wrapping hooks -- lets Hardmock provide its preparation and auto-verify behavior without contending for setup/teardown supremacy. + +Hardmock 1.3.5 + +* Aliased should_receive => expects and and_return => returns for easier transition from rspec mock and flexmock users. + +Hardmock 1.3.4 + +* Prevents accidental stubbing and mocking on NilClasses + +Hardmock 1.3.3 + +* stubs! and expects! no longer require that their target methods exist in reality (this used to prevent you from stubbing methods that "exist" by virtue of "method_missing" +* Tweaked inner metaclass code to avoid collisions with rspec's "metaid" stuff +* Moved this project's Rake tasks into rake_tasks... otherwise Rails will load them, if Hardmock is installed as a Rails plugin +* Alias added: 'verify_hardmocks' is now an alias for 'verify_mocks' (some internal projects were using this modified method name as a means of cooexisting with mocha) + +Hardmock 1.3.2 + +November 2007 + +* adds 'with' as an alternate syntax for specifying argument expectations. + +Hardmock 1.3.1 + +October 2007 + +* Can use stubs! on a mock object +* expects! now generates mocked methods that can safely transfer runtime blocks to the mock instance itself +* No longer need to call "prepare_hardmock_control" when using stubs in the absence of mocks +* Stubs of concrete class or instance methods are restored to original state in teardown + +Hardmock 1.3.0 + +October 2007 + +* Adds stubs! and expects! method to all objects and classes to support concrete stubbing/mocking. + +Hardmock 1.2.3 + +Sat Apr 28 01:16:15 EDT 2007 + +* Re-release of 1.2.2 (which was canceled)... tasks moved to lib/tasks + +Hardmock 1.2.2 + +Sat Apr 28 00:41:30 EDT 2007 + +* assert_error has been broken out into its own lib file +* Gem package can now run all tests successfully +* Internal code refactoring; a number of classes that were defined in hardmock.rb are now in their own files + +Hardmock 1.2.1 + +Sat Apr 28 00:41:30 EDT 2007 + +* (botched release, see 1.2.2) + +Hardmock 1.2.0 + +* You can now use "expect" in place of "expects" if you must. +* "inspect" has been added to the list of methods NOT erased by MethodCleanout. + +Hardmock 1.1.0 + +* "expects" replaces "expect" ("expect" now raises Hardmock::DeprecationError) +* "verify_mocks" is now implicit in teardown, you needn't call it anymore +* Mocking methods that Mock would otherwise inherit from Object (eg, to_s) is now possible +* require 'hardmock' is all that's required to use the library now; no need to include in TestCase + +(previously called CMock, translated to Hardmock on 2006-12-10) diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/LICENSE b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/LICENSE new file mode 100644 index 0000000..396211e --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/LICENSE @@ -0,0 +1,7 @@ +Copyright (c) 2006,2007 David Crosby at Atomic Object, LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/README b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/README new file mode 100644 index 0000000..4650a2a --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/README @@ -0,0 +1,70 @@ +== Hardmock + +Strict, ordered mock objects using very lightweight syntax in your tests. + +== How + +The basic procedure for using Hardmock in your tests is: + +* require 'hardmock' (this happens automatically when being used as a Rails plugin) +* Create some mocks +* Setup some expectations +* Execute the target code +* Verification of calls is automatic in =teardown= + +The expectations you set when using mocks are strict and ordered. +Expectations you declare by creating and using mocks are all considered together. + +* Hardmock::Mock#expects will show you more examples +* Hardmock::SimpleExpectation will teach you more about expectation methods + +== Example + + create_mocks :garage, :car + + # Set some expectations + @garage.expects.open_door + @car.expects.start(:choke) + @car.expects.drive(:reverse, 5.mph) + + # Execute the code (this code is usually, obviously, in your class under test) + @garage.open_door + @car.start :choke + @car.drive :reverse, 5.mph + + verify_mocks # OPTIONAL, teardown will do this for you + +Expects @garage.open_door, @car.start(:choke) and @car.drive(:reverse, 5.mph) to be called in that order, with those specific arguments. +* Violations of expectations, such as mis-ordered calls, calls on wrong objects, or incorrect methods result in Hardmock::ExpectationError +* verify_mocks will raise VerifyError if not all expectations have been met. + +== Download and Install + +* Homepage: http://hardmock.rubyforge.org +* GEM or TGZ or ZIP: http://rubyforge.org/frs/?group_id=2742 +* Rails plugin: script/plugin install +* SVN access: svn co svn://rubyforge.org/var/svn/hardmock/trunk +* Developer SVN access: svn co svn://developername@rubyforge.org/var/svn/hardmock/trunk + +== Setup for Test::Unit + + require 'hardmock' + require 'assert_error' # OPTIONAL: this adds the TestUnit extension 'assert_error' + +NOTE: If installed as a Rails plugin, init.rb does this for you... nothing else is needed. + +== Setup for RSpec + +Get this into your spec helper or environment or Rakefile or wherever you prefer: + + Spec::Runner.configure do |configuration| + configuration.include Hardmock + configuration.after(:each) {verify_mocks} + end + +This puts the implicit conveniences into your spec context, like "create_mocks" etc, and also provides for automatic +"verify_mocks" after each Example is run. + +== Author +* David Crosby crosby at http://atomicobject.com +* (c) 2006,2007 Atomic Object LLC diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/Rakefile b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/Rakefile new file mode 100644 index 0000000..aff126c --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/Rakefile @@ -0,0 +1,8 @@ +require 'rake' +require 'rubygems' + +HARDMOCK_VERSION = "1.3.7" + +Dir["rake_tasks/*.rake"].each { |f| load f } + +task :default => [ 'test:all' ] diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/config/environment.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/config/environment.rb new file mode 100644 index 0000000..a15e598 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/config/environment.rb @@ -0,0 +1,12 @@ +# The path to the root directory of your application. +APP_ROOT = File.join(File.dirname(__FILE__), '..') + +ADDITIONAL_LOAD_PATHS = [] +ADDITIONAL_LOAD_PATHS.concat %w( + lib +).map { |dir| "#{APP_ROOT}/#{dir}" }.select { |dir| File.directory?(dir) } + +# Prepend to $LOAD_PATH +ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) } + +# Require any additional libraries needed diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/lib/assert_error.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/lib/assert_error.rb new file mode 100644 index 0000000..6da61de --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/lib/assert_error.rb @@ -0,0 +1,23 @@ +require 'test/unit/assertions' + +module Test::Unit #:nodoc:# + module Assertions #:nodoc:# + # A better 'assert_raise'. +patterns+ can be one or more Regexps, or a literal String that + # must match the entire error message. + def assert_error(err_type,*patterns,&block) + assert_not_nil block, "assert_error requires a block" + assert((err_type and err_type.kind_of?(Class)), "First argument to assert_error has to be an error type") + err = assert_raise(err_type) do + block.call + end + patterns.each do |pattern| + case pattern + when Regexp + assert_match(pattern, err.message) + else + assert_equal pattern, err.message + end + end + end + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/lib/extend_test_unit.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/lib/extend_test_unit.rb new file mode 100644 index 0000000..3d7ef9d --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/lib/extend_test_unit.rb @@ -0,0 +1,14 @@ + +require 'test/unit/testcase' +class Test::Unit::TestCase + include Hardmock +end + +require 'test_unit_before_after' +Test::Unit::TestCase.before_setup do |test| + test.prepare_hardmock_control +end + +Test::Unit::TestCase.after_teardown do |test| + test.verify_mocks +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock.rb new file mode 100644 index 0000000..50f9a94 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock.rb @@ -0,0 +1,86 @@ +require 'hardmock/method_cleanout' +require 'hardmock/mock' +require 'hardmock/mock_control' +require 'hardmock/utils' +require 'hardmock/errors' +require 'hardmock/trapper' +require 'hardmock/expector' +require 'hardmock/expectation' +require 'hardmock/expectation_builder' +require 'hardmock/stubbing' + +module Hardmock + + # Create one or more new Mock instances in your test suite. + # Once created, the Mocks are accessible as instance variables in your test. + # Newly built Mocks are added to the full set of Mocks for this test, which will + # be verified when you call verify_mocks. + # + # create_mocks :donkey, :cat # Your test now has @donkey and @cat + # create_mock :dog # Test now has @donkey, @cat and @dog + # + # The first call returned a hash { :donkey => @donkey, :cat => @cat } + # and the second call returned { :dog => @dog } + # + # For more info on how to use your mocks, see Mock and Expectation + # + def create_mocks(*mock_names) + prepare_hardmock_control unless @main_mock_control + + mocks = {} + mock_names.each do |mock_name| + raise ArgumentError, "'nil' is not a valid name for a mock" if mock_name.nil? + mock_name = mock_name.to_s + mock_object = Mock.new(mock_name, @main_mock_control) + mocks[mock_name.to_sym] = mock_object + self.instance_variable_set "@#{mock_name}", mock_object + end + @all_mocks ||= {} + @all_mocks.merge! mocks + + return mocks.clone + end + + def prepare_hardmock_control + if @main_mock_control.nil? + @main_mock_control = MockControl.new + $main_mock_control = @main_mock_control + else + raise "@main_mock_control is already setup for this test!" + end + end + + alias :create_mock :create_mocks + + # Ensures that all expectations have been met. If not, VerifyException is + # raised. + # + # You normally won't need to call this yourself. Within Test::Unit::TestCase, this will be done automatically at teardown time. + # + # * +force+ -- if +false+, and a VerifyError or ExpectationError has already occurred, this method will not raise. This is to help you suppress repeated errors when if you're calling #verify_mocks in the teardown method of your test suite. BE WARNED - only use this if you're sure you aren't obscuring useful information. Eg, if your code handles exceptions internally, and an ExpectationError gets gobbled up by your +rescue+ block, the cause of failure for your test may be hidden from you. For this reason, #verify_mocks defaults to force=true as of Hardmock 1.0.1 + def verify_mocks(force=true) + return unless @main_mock_control + return if @main_mock_control.disappointed? and !force + @main_mock_control.verify + ensure + @main_mock_control.clear_expectations if @main_mock_control + $main_mock_control = nil + reset_stubs + end + + alias :verify_hardmocks :verify_mocks + + # Purge the main MockControl of all expectations, restore all concrete stubbed/mocked methods + def clear_expectations + @main_mock_control.clear_expectations if @main_mock_control + reset_stubs + $main_mock_control = nil + end + + def reset_stubs + Hardmock.restore_all_replaced_methods + end + +end + +require 'extend_test_unit' diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/errors.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/errors.rb new file mode 100644 index 0000000..48698a6 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/errors.rb @@ -0,0 +1,22 @@ +module Hardmock + # Raised when: + # * Unexpected method is called on a mock object + # * Bad arguments passed to an expected call + class ExpectationError < StandardError #:nodoc:# + end + + # Raised for methods that should no longer be called. Hopefully, the exception message contains helpful alternatives. + class DeprecationError < StandardError #:nodoc:# + end + + # Raised when stubbing fails + class StubbingError < StandardError #:nodoc:# + end + + # Raised when it is discovered that an expected method call was never made. + class VerifyError < StandardError #:nodoc:# + def initialize(msg,unmet_expectations) + super("#{msg}:" + unmet_expectations.map { |ex| "\n * #{ex.to_s}" }.join) + end + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/expectation.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/expectation.rb new file mode 100644 index 0000000..4d1db92 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/expectation.rb @@ -0,0 +1,229 @@ +require 'hardmock/utils' + +module Hardmock + class Expectation + include Utils + attr_reader :block_value + + def initialize(options) #:nodoc: + @options = options + end + + def apply_method_call(mock,mname,args,block) #:nodoc: + unless @options[:mock].equal?(mock) + raise anger("Wrong object", mock,mname,args) + end + unless @options[:method] == mname + raise anger("Wrong method",mock,mname,args) + end + + # Tester-defined block to invoke at method-call-time: + expectation_block = @options[:block] + + expected_args = @options[:arguments] + # if we have a block, we can skip the argument check if none were specified + unless (expected_args.nil? || expected_args.empty?) && expectation_block && !@options[:suppress_arguments_to_block] + unless expected_args == args + raise anger("Wrong arguments",mock,mname,args) + end + end + + relayed_args = args.dup + if block + if expectation_block.nil? + # Can't handle a runtime block without an expectation block + raise ExpectationError.new("Unexpected block provided to #{to_s}") + else + # Runtime blocks are passed as final argument to the expectation block + unless @options[:suppress_arguments_to_block] + relayed_args << block + else + # Arguments suppressed; send only the block + relayed_args = [block] + end + end + end + + # Run the expectation block: + @block_value = expectation_block.call(*relayed_args) if expectation_block + + raise @options[:raises] unless @options[:raises].nil? + + return_value = @options[:returns] + if return_value.nil? + return @block_value + else + return return_value + end + end + + # Set the return value for an expected method call. + # Eg, + # @cash_machine.expects.withdraw(20,:dollars).returns(20.00) + def returns(val) + @options[:returns] = val + self + end + alias_method :and_return, :returns + + # Set the arguments for an expected method call. + # Eg, + # @cash_machine.expects.deposit.with(20, "dollars").returns(:balance => "20") + def with(*args) + @options[:arguments] = args + self + end + + # Rig an expected method to raise an exception when the mock is invoked. + # + # Eg, + # @cash_machine.expects.withdraw(20,:dollars).raises "Insufficient funds" + # + # The argument can be: + # * an Exception -- will be used directly + # * a String -- will be used as the message for a RuntimeError + # * nothing -- RuntimeError.new("An Error") will be raised + def raises(err=nil) + case err + when Exception + @options[:raises] = err + when String + @options[:raises] = RuntimeError.new(err) + else + @options[:raises] = RuntimeError.new("An Error") + end + self + end + + # Convenience method: assumes +block_value+ is set, and is set to a Proc + # (or anything that responds to 'call') + # + # light_event = @traffic_light.trap.subscribe(:light_changes) + # + # # This code will meet the expectation: + # @traffic_light.subscribe :light_changes do |color| + # puts color + # end + # + # The color-handling block is now stored in light_event.block_value + # + # The block can be invoked like this: + # + # light_event.trigger :red + # + # See Mock#trap and Mock#expects for information on using expectation objects + # after they are set. + # + def trigger(*block_arguments) + unless block_value + raise ExpectationError.new("No block value is currently set for expectation #{to_s}") + end + unless block_value.respond_to?(:call) + raise ExpectationError.new("Can't apply trigger to #{block_value} for expectation #{to_s}") + end + block_value.call *block_arguments + end + + # Used when an expected method accepts a block at runtime. + # When the expected method is invoked, the block passed to + # that method will be invoked as well. + # + # NOTE: ExpectationError will be thrown upon running the expected method + # if the arguments you set up in +yields+ do not properly match up with + # the actual block that ends up getting passed. + # + # == Examples + # Single invocation: The block passed to +lock_down+ gets invoked + # once with no arguments: + # + # @safe_zone.expects.lock_down.yields + # + # # (works on code that looks like:) + # @safe_zone.lock_down do + # # ... this block invoked once + # end + # + # Multi-parameter blocks: The block passed to +each_item+ gets + # invoked twice, with :item1 the first time, and with + # :item2 the second time: + # + # @fruit_basket.expects.each_with_index.yields [:apple,1], [:orange,2] + # + # # (works on code that looks like:) + # @fruit_basket.each_with_index do |fruit,index| + # # ... this block invoked with fruit=:apple, index=1, + # # ... and then with fruit=:orange, index=2 + # end + # + # Arrays can be passed as arguments too... if the block + # takes a single argument and you want to pass a series of arrays into it, + # that will work as well: + # + # @list_provider.expects.each_list.yields [1,2,3], [4,5,6] + # + # # (works on code that looks like:) + # @list_provider.each_list do |list| + # # ... list is [1,2,3] the first time + # # ... list is [4,5,6] the second time + # end + # + # Return value: You can set the return value for the method that + # accepts the block like so: + # + # @cruncher.expects.do_things.yields(:bean1,:bean2).returns("The Results") + # + # Raising errors: You can set the raised exception for the method that + # accepts the block. NOTE: the error will be raised _after_ the block has + # been invoked. + # + # # :bean1 and :bean2 will be passed to the block, then an error is raised: + # @cruncher.expects.do_things.yields(:bean1,:bean2).raises("Too crunchy") + # + def yields(*items) + @options[:suppress_arguments_to_block] = true + if items.empty? + # Yield once + @options[:block] = lambda do |block| + if block.arity != 0 and block.arity != -1 + raise ExpectationError.new("The given block was expected to have no parameter count; instead, got #{block.arity} to <#{to_s}>") + end + block.call + end + else + # Yield one or more specific items + @options[:block] = lambda do |block| + items.each do |item| + if item.kind_of?(Array) + if block.arity == item.size + # Unfold the array into the block's arguments: + block.call *item + elsif block.arity == 1 + # Just pass the array in + block.call item + else + # Size mismatch + raise ExpectationError.new("Can't pass #{item.inspect} to block with arity #{block.arity} to <#{to_s}>") + end + else + if block.arity != 1 + # Size mismatch + raise ExpectationError.new("Can't pass #{item.inspect} to block with arity #{block.arity} to <#{to_s}>") + end + block.call item + end + end + end + end + self + end + + def to_s # :nodoc: + format_method_call_string(@options[:mock],@options[:method],@options[:arguments]) + end + + private + def anger(msg, mock,mname,args) + ExpectationError.new("#{msg}: expected call <#{to_s}> but was <#{format_method_call_string(mock,mname,args)}>") + end + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/expectation_builder.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/expectation_builder.rb new file mode 100644 index 0000000..7445fb1 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/expectation_builder.rb @@ -0,0 +1,9 @@ +require 'hardmock/expectation' + +module Hardmock + class ExpectationBuilder #:nodoc: + def build_expectation(options) + Expectation.new(options) + end + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/expector.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/expector.rb new file mode 100644 index 0000000..8055460 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/expector.rb @@ -0,0 +1,26 @@ +require 'hardmock/method_cleanout' +require 'hardmock/errors' + +module Hardmock + class Expector #:nodoc: + include MethodCleanout + + def initialize(mock,mock_control,expectation_builder) + @mock = mock + @mock_control = mock_control + @expectation_builder = expectation_builder + end + + def method_missing(mname, *args, &block) + expectation = @expectation_builder.build_expectation( + :mock => @mock, + :method => mname, + :arguments => args, + :block => block) + + @mock_control.add_expectation expectation + expectation + end + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/method_cleanout.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/method_cleanout.rb new file mode 100644 index 0000000..51797e6 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/method_cleanout.rb @@ -0,0 +1,33 @@ + +module Hardmock #:nodoc: + module MethodCleanout #:nodoc: + SACRED_METHODS = %w{ + __id__ + __send__ + equal? + object_id + send + nil? + class + kind_of? + respond_to? + inspect + method + to_s + instance_variables + instance_eval + == + hm_metaclass + hm_meta_eval + hm_meta_def + } + + def self.included(base) #:nodoc: + base.class_eval do + instance_methods.each do |m| + undef_method m unless SACRED_METHODS.include?(m.to_s) + end + end + end + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/mock.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/mock.rb new file mode 100644 index 0000000..928c432 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/mock.rb @@ -0,0 +1,180 @@ + +module Hardmock + # Mock is used to set expectations in your test. Most of the time you'll use + # #expects to create expectations. + # + # Aside from the scant few control methods (like +expects+, +trap+ and +_verify+) + # all calls made on a Mock instance will be immediately applied to the internal + # expectation mechanism. + # + # * If the method call was expected and all the parameters match properly, execution continues + # * If the expectation was configured with an expectation block, the block is invoked + # * If the expectation was set up to raise an error, the error is raised now + # * If the expectation was set up to return a value, it is returned + # * If the method call was _not_ expected, or the parameter values are wrong, an ExpectationError is raised. + class Mock + include Hardmock::MethodCleanout + + # Create a new Mock instance with a name and a MockControl to support it. + # If not given, a MockControl is made implicitly for this Mock alone; this means + # expectations for this mock are not tied to other expectations in your test. + # + # It's not recommended to use a Mock directly; see Hardmock and + # Hardmock#create_mocks for the more wholistic approach. + def initialize(name, mock_control=nil) + @name = name + @control = mock_control || MockControl.new + @expectation_builder = ExpectationBuilder.new + end + + def inspect + "" + end + + # Begin declaring an expectation for this Mock. + # + # == Simple Examples + # Expect the +customer+ to be queried for +account+, and return "The + # Account": + # @customer.expects.account.returns "The Account" + # + # Expect the +withdraw+ method to be called, and raise an exception when it + # is (see Expectation#raises for more info): + # @cash_machine.expects.withdraw(20,:dollars).raises("not enough money") + # + # Expect +customer+ to have its +user_name+ set + # @customer.expects.user_name = 'Big Boss' + # + # Expect +customer+ to have its +user_name+ set, and raise a RuntimeException when + # that happens: + # @customer.expects('user_name=', "Big Boss").raises "lost connection" + # + # Expect +evaluate+ to be passed a block, and when that happens, pass a value + # to the block (see Expectation#yields for more info): + # @cruncher.expects.evaluate.yields("some data").returns("some results") + # + # + # == Expectation Blocks + # To do special handling of expected method calls when they occur, you + # may pass a block to your expectation, like: + # @page_scraper.expects.handle_content do |address,request,status| + # assert_not_nil address, "Can't abide nil addresses" + # assert_equal "http-get", request.method, "Can only handle GET" + # assert status > 200 and status < 300, status, "Failed status" + # "Simulated results #{request.content.downcase}" + # end + # In this example, when page_scraper.handle_content is called, its + # three arguments are passed to the expectation block and evaluated + # using the above assertions. The last value in the block will be used + # as the return value for +handle_content+ + # + # You may specify arguments to the expected method call, just like any normal + # expectation, and those arguments will be pre-validated before being passed + # to the expectation block. This is useful when you know all of the + # expected values but still need to do something programmatic. + # + # If the method being invoked on the mock accepts a block, that block will be + # passed to your expectation block as the last (or only) argument. Eg, the + # convenience method +yields+ can be replaced with the more explicit: + # @cruncher.expects.evaluate do |block| + # block.call "some data" + # "some results" + # end + # + # The result value of the expectation block becomes the return value for the + # expected method call. This can be overidden by using the +returns+ method: + # @cruncher.expects.evaluate do |block| + # block.call "some data" + # "some results" + # end.returns("the actual value") + # + # Additionally, the resulting value of the expectation block is stored + # in the +block_value+ field on the expectation. If you've saved a reference + # to your expectation, you may retrieve the block value once the expectation + # has been met. + # + # evaluation_event = @cruncher.expects.evaluate do |block| + # block.call "some data" + # "some results" + # end.returns("the actual value") + # + # result = @cruncher.evaluate do |input| + # puts input # => 'some data' + # end + # # result is 'the actual value' + # + # evaluation_event.block_value # => 'some results' + # + def expects(*args, &block) + expector = Expector.new(self,@control,@expectation_builder) + # If there are no args, we return the Expector + return expector if args.empty? + # If there ARE args, we set up the expectation right here and return it + expector.send(args.shift.to_sym, *args, &block) + end + alias_method :expect, :expects + alias_method :should_receive, :expects + + # Special-case convenience: #trap sets up an expectation for a method + # that will take a block. That block, when sent to the expected method, will + # be trapped and stored in the expectation's +block_value+ field. + # The Expectation#trigger method may then be used to invoke that block. + # + # Like +expects+, the +trap+ mechanism can be followed by +raises+ or +returns+. + # + # _Unlike_ +expects+, you may not use an expectation block with +trap+. If + # the expected method takes arguments in addition to the block, they must + # be specified in the arguments to the +trap+ call itself. + # + # == Example + # + # create_mocks :address_book, :editor_form + # + # # Expect a subscription on the :person_added event for @address_book: + # person_event = @address_book.trap.subscribe(:person_added) + # + # # The runtime code would look like: + # @address_book.subscribe :person_added do |person_name| + # @editor_form.name = person_name + # end + # + # # At this point, the expectation for 'subscribe' is met and the + # # block has been captured. But we're not done: + # @editor_form.expects.name = "David" + # + # # Now invoke the block we trapped earlier: + # person_event.trigger "David" + # + # verify_mocks + def trap(*args) + Trapper.new(self,@control,ExpectationBuilder.new) + end + + def method_missing(mname,*args) #:nodoc: + block = nil + block = Proc.new if block_given? + @control.apply_method_call(self,mname,args,block) + end + + + def _control #:nodoc: + @control + end + + def _name #:nodoc: + @name + end + + # Verify that all expectations are fulfilled. NOTE: this method triggers + # validation on the _control_ for this mock, so all Mocks that share the + # MockControl with this instance will be included in the verification. + # + # Only use this method if you are managing your own Mocks and their controls. + # + # Normal usage of Hardmock doesn't require you to call this; let + # Hardmock#verify_mocks do it for you. + def _verify + @control.verify + end + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/mock_control.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/mock_control.rb new file mode 100644 index 0000000..302ebce --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/mock_control.rb @@ -0,0 +1,53 @@ +require 'hardmock/utils' + +module Hardmock + class MockControl #:nodoc: + include Utils + attr_accessor :name + + def initialize + clear_expectations + end + + def happy? + @expectations.empty? + end + + def disappointed? + @disappointed + end + + def add_expectation(expectation) +# puts "MockControl #{self.object_id.to_s(16)} adding expectation: #{expectation}" + @expectations << expectation + end + + def apply_method_call(mock,mname,args,block) + # Are we even expecting any sort of call? + if happy? + @disappointed = true + raise ExpectationError.new("Surprise call to #{format_method_call_string(mock,mname,args)}") + end + + begin + @expectations.shift.apply_method_call(mock,mname,args,block) + rescue Exception => ouch + @disappointed = true + raise ouch + end + end + + def verify +# puts "MockControl #{self.object_id.to_s(16)} verify: happy? #{happy?}" + @disappointed = !happy? + raise VerifyError.new("Unmet expectations", @expectations) unless happy? + end + + def clear_expectations + @expectations = [] + @disappointed = false + end + + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/stubbing.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/stubbing.rb new file mode 100644 index 0000000..0f8a293 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/stubbing.rb @@ -0,0 +1,210 @@ + + +# Stubbing support +# +# Stubs methods on classes and instances +# + +# Why's "metaid.rb" stuff crunched down: +class Object #:nodoc:# + def hm_metaclass #:nodoc:# + class << self + self + end + end + + def hm_meta_eval(&blk) #:nodoc:# + hm_metaclass.instance_eval(&blk) + end + + def hm_meta_def(name, &blk) #:nodoc:# + hm_meta_eval { define_method name, &blk } + end +end + + + +module Hardmock + + # == Hardmock: Stubbing and Mocking Concrete Methods + # + # Hardmock lets you stub and/or mock methods on concrete classes or objects. + # + # * To "stub" a concrete method is to rig it to return the same thing always, disregarding any arguments. + # * To "mock" a concrete method is to surplant its funcionality by delegating to a mock object who will cover this behavior. + # + # Mocked methods have their expectations considered along with all other mock object expectations. + # + # If you use stubbing or concrete mocking in the absence (or before creation) of other mocks, you need to invoke prepare_hardmock_control. + # Once verify_mocks or clear_expectaions is called, the overriden behavior in the target objects is restored. + # + # == Examples + # + # River.stubs!(:sounds_like).returns("gurgle") + # + # River.expects!(:jump).returns("splash") + # + # rogue.stubs!(:sounds_like).returns("pshshsh") + # + # rogue.expects!(:rawhide_tanning_solvents).returns("giant snapping turtles") + # + module Stubbing + # Exists only for documentation + end + + class ReplacedMethod #:nodoc:# + attr_reader :target, :method_name + + def initialize(target, method_name) + @target = target + @method_name = method_name + + Hardmock.track_replaced_method self + end + end + + class StubbedMethod < ReplacedMethod #:nodoc:# + def invoke(args) + raise @raises if @raises + @return_value + end + + def returns(stubbed_return) + @return_value = stubbed_return + end + + def raises(err) + err = RuntimeError.new(err) unless err.kind_of?(Exception) + @raises = err + end + end + + class ::Object + def stubs!(method_name) + method_name = method_name.to_s + already_stubbed = Hardmock.has_replaced_method?(self, method_name) + + stubbed_method = Hardmock::StubbedMethod.new(self, method_name) + + + unless _is_mock? or already_stubbed + if methods.include?(method_name.to_s) + hm_meta_eval do + alias_method "_hardmock_original_#{method_name}".to_sym, method_name.to_sym + end + end + end + + hm_meta_def method_name do |*args| + stubbed_method.invoke(args) + end + + stubbed_method + end + + def expects!(method_name, *args, &block) + if self._is_mock? + raise Hardmock::StubbingError, "Cannot use 'expects!(:#{method_name})' on a Mock object; try 'expects' instead" + end + + method_name = method_name.to_s + + @_my_mock = Mock.new(_my_name, $main_mock_control) if @_my_mock.nil? + + unless Hardmock.has_replaced_method?(self, method_name) + # Track the method as replaced + Hardmock::ReplacedMethod.new(self, method_name) + + # Preserver original implementation of the method by aliasing it away + if methods.include?(method_name) + hm_meta_eval do + alias_method "_hardmock_original_#{method_name}".to_sym, method_name.to_sym + end + end + + # Re-define the method to utilize our patron mock instance. + # (This global-temp-var thing is hokey but I was having difficulty generating + # code for the meta class.) + begin + $method_text_temp = %{ + def #{method_name}(*args,&block) + @_my_mock.__send__(:#{method_name}, *args, &block) + end + } + class << self + eval $method_text_temp + end + ensure + $method_text_temp = nil + end + end + + return @_my_mock.expects(method_name, *args, &block) + end + + def _is_mock? + self.kind_of?(Mock) + end + + def _my_name + self.kind_of?(Class) ? self.name : self.class.name + end + + def _clear_mock + @_my_mock = nil + end + + end + + class ::NilClass + # Use this only if you really mean it + alias_method :intentionally_stubs!, :stubs! + + # Use this only if you really mean it + alias_method :intentionally_expects!, :expects! + + # Overridden to protect against accidental nil reference self delusion + def stubs!(mname) + raise StubbingError, "Cannot stub #{mname} method on nil. (If you really mean to, try 'intentionally_stubs!')" + end + + # Overridden to protect against accidental nil reference self delusion + def expects!(mname, *args) + raise StubbingError, "Cannot mock #{mname} method on nil. (If you really mean to, try 'intentionally_expects!')" + end + end + + class << self + def track_replaced_method(replaced_method) + all_replaced_methods << replaced_method + end + + def all_replaced_methods + $all_replaced_methods ||= [] + end + + def has_replaced_method?(obj, method_name) + hits = all_replaced_methods.select do |replaced| + (replaced.target.object_id == obj.object_id) and (replaced.method_name.to_s == method_name.to_s) + end + return !hits.empty? + end + + def restore_all_replaced_methods + all_replaced_methods.each do |replaced| + unless replaced.target._is_mock? + backed_up = "_hardmock_original_#{replaced.method_name}" + if replaced.target.methods.include?(backed_up) + replaced.target.hm_meta_eval do + alias_method replaced.method_name.to_sym, backed_up.to_sym + end + end + replaced.target._clear_mock + end + end + all_replaced_methods.clear + end + end + +end + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/trapper.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/trapper.rb new file mode 100644 index 0000000..6aab176 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/trapper.rb @@ -0,0 +1,31 @@ +require 'test/unit/assertions' +require 'hardmock/errors' + +module Hardmock + class Trapper #:nodoc: + include Hardmock::MethodCleanout + + def initialize(mock,mock_control,expectation_builder) + @mock = mock + @mock_control = mock_control + @expectation_builder = expectation_builder + end + + def method_missing(mname, *args) + if block_given? + raise ExpectationError.new("Don't pass blocks when using 'trap' (setting exepectations for '#{mname}')") + end + + the_block = lambda { |target_block| target_block } + expectation = @expectation_builder.build_expectation( + :mock => @mock, + :method => mname, + :arguments => args, + :suppress_arguments_to_block => true, + :block => the_block) + + @mock_control.add_expectation expectation + expectation + end + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/utils.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/utils.rb new file mode 100644 index 0000000..1740577 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/utils.rb @@ -0,0 +1,9 @@ + +module Hardmock + module Utils #:nodoc: + def format_method_call_string(mock,mname,args) + arg_string = args.map { |a| a.inspect }.join(', ') + call_text = "#{mock._name}.#{mname}(#{arg_string})" + end + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/lib/test_unit_before_after.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/lib/test_unit_before_after.rb new file mode 100644 index 0000000..0499e39 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/lib/test_unit_before_after.rb @@ -0,0 +1,169 @@ +require 'test/unit' +require 'test/unit/testcase' +require 'test/unit/assertions' + +module Test #:nodoc:# + module Unit #:nodoc:# + + # == TestCase Modifications + # + # Monkey-patch to provide a formal mechanism for appending actions to be executed after teardown. + # Use after_teardown to define one or more actions to be executed after teardown for ALL tests. + # + # COMING SOON? + # * (maybe?) Hooks for before_teardown, after_setup, on_error + # * (maybe?) Options for positional control, eg, after_teardown :before_other_actions + # * (maybe?) Provide tagging/filtering so action execution can be controlled specifically? + # + # == Usage + # + # Invoke TestCase.after_teardown with optional parameter, which will be invoked with a reference + # to the test instance that has just been torn down. + # + # Example: + # + # Test::Unit::TestCase.after_teardown do |test| + # test.verify_mocks + # end + # + # == Justification + # + # There are a number of tools and libraries that play fast-n-loose with setup and teardown by + # wrapping them, and by overriding method_added as a means of upholding special setup/teardown + # behavior, usually by re-wrapping newly defined user-level setup/teardown methods. + # mocha and active_record/fixtures (and previously, hardmock) will fight for this + # territory with often unpredictable results. + # + # We wouldn't have to battle if Test::Unit provided a formal pre- and post- hook mechanism. + # + class TestCase + + class << self + + # Define an action to be run after teardown. Subsequent calls result in + # multiple actions. The block will be given a reference to the test + # being executed. + # + # Example: + # + # Test::Unit::TestCase.after_teardown do |test| + # test.verify_mocks + # end + def after_teardown(&block) + post_teardown_actions << block + end + + # Used internally. Access the list of post teardown actions for to be + # used by all tests. + def post_teardown_actions + @@post_teardown_actions ||= [] + end + + # Define an action to be run before setup. Subsequent calls result in + # multiple actions, EACH BEING PREPENDED TO THE PREVIOUS. + # The block will be given a reference to the test being executed. + # + # Example: + # + # Test::Unit::TestCase.before_setup do |test| + # test.prepare_hardmock_control + # end + def before_setup(&block) + pre_setup_actions.unshift block + end + + # Used internally. Access the list of post teardown actions for to be + # used by all tests. + def pre_setup_actions + @@pre_setup_actions ||= [] + end + end + + # OVERRIDE: This is a reimplementation of the default "run", updated to + # execute actions after teardown. + def run(result) + yield(STARTED, name) + @_result = result + begin + execute_pre_setup_actions(self) + setup + __send__(@method_name) + rescue Test::Unit::AssertionFailedError => e + add_failure(e.message, auxiliary_backtrace_filter(e.backtrace)) + rescue Exception + raise if should_passthru_exception($!) # See implementation; this is for pre-1.8.6 compat + add_error($!) + ensure + begin + teardown + rescue Test::Unit::AssertionFailedError => e + add_failure(e.message, auxiliary_backtrace_filter(e.backtrace)) + rescue Exception + raise if should_passthru_exception($!) # See implementation; this is for pre-1.8.6 compat + add_error($!) + ensure + execute_post_teardown_actions(self) + end + end + result.add_run + yield(FINISHED, name) + end + + private + + # Run through the after_teardown actions, treating failures and errors + # in the same way that "run" does: they are reported, and the remaining + # actions are executed. + def execute_post_teardown_actions(test_instance) + self.class.post_teardown_actions.each do |action| + begin + action.call test_instance + rescue Test::Unit::AssertionFailedError => e + add_failure(e.message, auxiliary_backtrace_filter(e.backtrace)) + rescue Exception + raise if should_passthru_exception($!) + add_error($!) + end + end + end + + # Run through the before_setup actions. + # Failures or errors cause execution to stop. + def execute_pre_setup_actions(test_instance) + self.class.pre_setup_actions.each do |action| +# begin + action.call test_instance +# rescue Test::Unit::AssertionFailedError => e +# add_failure(e.message, auxiliary_backtrace_filter(e.backtrace)) +# rescue Exception +# raise if should_passthru_exception($!) +# add_error($!) +# end + end + end + + # Make sure that this extension doesn't show up in failure backtraces + def auxiliary_backtrace_filter(trace) + trace.reject { |x| x =~ /test_unit_before_after/ } + end + + # Is the given error of the type that we allow to fly out (rather than catching it)? + def should_passthru_exception(ex) + return passthrough_exception_types.include?($!.class) + end + + # Provide a list of exception types that are to be allowed to explode out. + # Pre-ruby-1.8.6 doesn't use this functionality, so the PASSTHROUGH_EXCEPTIONS + # constant won't be defined. This methods defends against that and returns + # an empty list instead. + def passthrough_exception_types + begin + return PASSTHROUGH_EXCEPTIONS + rescue NameError + # older versions of test/unit do not have PASSTHROUGH_EXCEPTIONS constant + return [] + end + end + end + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/rake_tasks/rdoc.rake b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/rake_tasks/rdoc.rake new file mode 100644 index 0000000..6a6d79f --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/rake_tasks/rdoc.rake @@ -0,0 +1,19 @@ +require 'rake/rdoctask' +require File.expand_path(File.dirname(__FILE__) + "/rdoc_options.rb") + +namespace :doc do + + desc "Generate RDoc documentation" + Rake::RDocTask.new { |rdoc| + rdoc.rdoc_dir = 'doc' + rdoc.title = "Hardmock: Strict expectation-based mock object library " + add_rdoc_options(rdoc.options) + rdoc.rdoc_files.include('lib/**/*.rb', 'README','CHANGES','LICENSE') + } + + task :show => [ 'doc:rerdoc' ] do + sh "open doc/index.html" + end + +end + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/rake_tasks/rdoc_options.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/rake_tasks/rdoc_options.rb new file mode 100644 index 0000000..85bf4ce --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/rake_tasks/rdoc_options.rb @@ -0,0 +1,4 @@ + +def add_rdoc_options(options) + options << '--line-numbers' << '--inline-source' << '--main' << 'README' << '--title' << 'Hardmock' +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/rake_tasks/test.rake b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/rake_tasks/test.rake new file mode 100644 index 0000000..85a3753 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/rake_tasks/test.rake @@ -0,0 +1,22 @@ +require 'rake/testtask' + +namespace :test do + + desc "Run unit tests" + Rake::TestTask.new("units") { |t| + t.libs << "test" + t.pattern = 'test/unit/*_test.rb' + t.verbose = true + } + + desc "Run functional tests" + Rake::TestTask.new("functional") { |t| + t.libs << "test" + t.pattern = 'test/functional/*_test.rb' + t.verbose = true + } + + desc "Run all the tests" + task :all => [ 'test:units', 'test:functional' ] + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/assert_error_test.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/assert_error_test.rb new file mode 100644 index 0000000..e4b35cf --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/assert_error_test.rb @@ -0,0 +1,52 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'assert_error' + +class AssertErrorTest < Test::Unit::TestCase + + it "specfies an error type and message that should be raised" do + assert_error RuntimeError, "Too funky" do + raise RuntimeError.new("Too funky") + end + end + + it "flunks if the error message is wrong" do + err = assert_raise Test::Unit::AssertionFailedError do + assert_error RuntimeError, "not good" do + raise RuntimeError.new("Too funky") + end + end + assert_match(/not good/i, err.message) + assert_match(/too funky/i, err.message) + end + + it "flunks if the error type is wrong" do + err = assert_raise Test::Unit::AssertionFailedError do + assert_error StandardError, "Too funky" do + raise RuntimeError.new("Too funky") + end + end + assert_match(/StandardError/i, err.message) + assert_match(/RuntimeError/i, err.message) + end + + it "can match error message text using a series of Regexps" do + assert_error StandardError, /too/i, /funky/i do + raise StandardError.new("Too funky") + end + end + + it "flunks if the error message doesn't match all the Regexps" do + err = assert_raise Test::Unit::AssertionFailedError do + assert_error StandardError, /way/i, /too/i, /funky/i do + raise StandardError.new("Too funky") + end + end + assert_match(/way/i, err.message) + end + + it "can operate without any message specification" do + assert_error StandardError do + raise StandardError.new("ooof") + end + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/auto_verify_test.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/auto_verify_test.rb new file mode 100644 index 0000000..1b005bd --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/auto_verify_test.rb @@ -0,0 +1,178 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'fileutils' + +class AutoVerifyTest < Test::Unit::TestCase + + def setup + @expect_unmet_expectations = true + end + + def teardown + remove_temp_test_file + end + + # + # TESTS + # + + it "auto-verifies all mocks in teardown" do + write_and_execute_test + end + + it "auto-verifies even if user defines own teardown" do + @teardown_code =<<-EOM + def teardown + # just in the way + end + EOM + write_and_execute_test + end + + should "not obscure normal failures when verification fails" do + @test_code =<<-EOM + def test_setup_doomed_expectation + create_mock :automobile + @automobile.expects.start + flunk "natural failure" + end + EOM + @expect_failures = 1 + write_and_execute_test + end + + should "not skip user-defined teardown when verification fails" do + @teardown_code =<<-EOM + def teardown + puts "User teardown" + end + EOM + write_and_execute_test + assert_output_contains(/User teardown/) + end + + it "is quiet when verification is ok" do + @test_code =<<-EOM + def test_ok + create_mock :automobile + @automobile.expects.start + @automobile.start + end + EOM + @teardown_code =<<-EOM + def teardown + puts "User teardown" + end + EOM + @expect_unmet_expectations = false + @expect_failures = 0 + @expect_errors = 0 + write_and_execute_test + assert_output_contains(/User teardown/) + end + + should "auto-verify even if user teardown explodes" do + @teardown_code =<<-EOM + def teardown + raise "self destruct" + end + EOM + @expect_errors = 2 + write_and_execute_test + assert_output_contains(/self destruct/) + end + + it "plays nice with inherited teardown methods" do + @full_code ||=<<-EOTEST + require File.expand_path(File.dirname(__FILE__) + "/../test_helper") + require 'hardmock' + class Test::Unit::TestCase + def teardown + puts "Test helper teardown" + end + end + class DummyTest < Test::Unit::TestCase + def test_prepare_to_die + create_mock :automobile + @automobile.expects.start + end + end + EOTEST + write_and_execute_test + assert_output_contains(/Test helper teardown/) + end + + # + # HELPERS + # + + def temp_test_file + File.expand_path(File.dirname(__FILE__) + "/tear_down_verification_test.rb") + end + + def run_test(tbody) + File.open(temp_test_file,"w") { |f| f.print(tbody) } + @test_output = `ruby #{temp_test_file} 2>&1` + end + + def formatted_test_output + if @test_output + @test_output.split(/\n/).map { |line| "> #{line}" }.join("\n") + else + "(NO TEST OUTPUT!)" + end + end + + def remove_temp_test_file + FileUtils::rm_f temp_test_file + end + + def assert_results(h) + if @test_output !~ /#{h[:tests]} tests, [0-9]+ assertions, #{h[:failures]} failures, #{h[:errors]} errors/ + flunk "Test results didn't match #{h.inspect}:\n#{formatted_test_output}" + end + end + + def assert_output_contains(*patterns) + patterns.each do |pattern| + if @test_output !~ pattern + flunk "Test output didn't match #{pattern.inspect}:\n#{formatted_test_output}" + end + end + end + + def assert_output_doesnt_contain(*patterns) + patterns.each do |pattern| + assert @test_output !~ pattern, "Output shouldn't match #{pattern.inspect} but it does." + end + end + + def write_and_execute_test + @test_code ||=<<-EOM + def test_setup_doomed_expectation + create_mock :automobile + @automobile.expects.start + end + EOM + @full_code ||=<<-EOTEST + require File.expand_path(File.dirname(__FILE__) + "/../test_helper") + require 'hardmock' + class DummyTest < Test::Unit::TestCase + #{@teardown_code} + #{@test_code} + end + EOTEST + run_test @full_code + + if @expect_unmet_expectations + assert_output_contains(/unmet expectations/i, /automobile/, /start/) + else + assert_output_doesnt_contain(/unmet expectations/i, /automobile/, /start/) + end + + @expect_tests ||= 1 + @expect_failures ||= 0 + @expect_errors ||= 1 + assert_results :tests => @expect_tests, :failures => @expect_failures, :errors => @expect_errors + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/direct_mock_usage_test.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/direct_mock_usage_test.rb new file mode 100644 index 0000000..dcf2b2a --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/direct_mock_usage_test.rb @@ -0,0 +1,396 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock' + +class DirectMockUsageTest < Test::Unit::TestCase + + def setup + @bird = Mock.new('bird') + end + + def teardown + end + + # + # TESTS + # + + it "raises VerifyError if expected method not called" do + @bird.expects.flap_flap + + err = assert_raise VerifyError do + @bird._verify + end + assert_match(/unmet expectations/i, err.message) + end + + should "not raise when expected calls are made in order" do + @bird.expects.flap_flap + @bird.expects.bang + @bird.expects.plop + + @bird.flap_flap + @bird.bang + @bird.plop + + @bird._verify + end + + it "raises ExpectationError when unexpected method are called" do + @bird.expects.flap_flap + + err = assert_raise ExpectationError do + @bird.shoot + end + assert_match(/wrong method/i, err.message) + end + + it "raises ExpectationError on bad arguments" do + @bird.expects.flap_flap(:swoosh) + + err = assert_raise ExpectationError do + @bird.flap_flap(:rip) + end + assert_match(/wrong arguments/i, err.message) + end + + it "raises VerifyError when not all expected methods are called" do + @bird.expects.flap_flap + @bird.expects.bang + @bird.expects.plop + + @bird.flap_flap + + err = assert_raise VerifyError do + @bird._verify + end + assert_match(/unmet expectations/i, err.message) + end + + it "raises ExpectationError when calls are made out of order" do + @bird.expects.flap_flap + @bird.expects.bang + @bird.expects.plop + + @bird.flap_flap + err = assert_raise ExpectationError do + @bird.plop + end + assert_match(/wrong method/i, err.message) + end + + it "returns the configured value" do + @bird.expects.plop.returns(':P') + assert_equal ':P', @bird.plop + @bird._verify + + @bird.expects.plop.returns(':x') + assert_equal ':x', @bird.plop + @bird._verify + end + + it "returns nil when no return is specified" do + @bird.expects.plop + assert_nil @bird.plop + @bird._verify + end + + it "raises the configured exception" do + err = RuntimeError.new('shaq') + @bird.expects.plop.raises(err) + actual_err = assert_raise RuntimeError do + @bird.plop + end + assert_same err, actual_err, 'should be the same error' + @bird._verify + end + + it "raises a RuntimeError when told to 'raise' a string" do + @bird.expects.plop.raises('shaq') + err = assert_raise RuntimeError do + @bird.plop + end + assert_match(/shaq/i, err.message) + @bird._verify + end + + it "raises a default RuntimeError" do + @bird.expects.plop.raises + err = assert_raise RuntimeError do + @bird.plop + end + assert_match(/error/i, err.message) + @bird._verify + end + + it "is quiet when correct arguments given" do + thing = Object.new + @bird.expects.plop(:big,'one',thing) + @bird.plop(:big,'one',thing) + @bird._verify + end + + it "raises ExpectationError when wrong number of arguments specified" do + thing = Object.new + @bird.expects.plop(:big,'one',thing) + err = assert_raise ExpectationError do + # more + @bird.plop(:big,'one',thing,:other) + end + assert_match(/wrong arguments/i, err.message) + @bird._verify + + @bird.expects.plop(:big,'one',thing) + err = assert_raise ExpectationError do + # less + @bird.plop(:big,'one') + end + assert_match(/wrong arguments/i, err.message) + @bird._verify + + @bird.expects.plop + err = assert_raise ExpectationError do + # less + @bird.plop(:big) + end + assert_match(/wrong arguments/i, err.message) + @bird._verify + end + + it "raises ExpectationError when arguments don't match" do + thing = Object.new + @bird.expects.plop(:big,'one',thing) + err = assert_raise ExpectationError do + @bird.plop(:big,'two',thing,:other) + end + assert_match(/wrong arguments/i, err.message) + @bird._verify + end + + it "can use a block for custom reactions" do + mitt = nil + @bird.expects.plop { mitt = :ball } + assert_nil mitt + @bird.plop + assert_equal :ball, mitt, 'didnt catch the ball' + @bird._verify + + @bird.expects.plop { raise 'ball' } + err = assert_raise RuntimeError do + @bird.plop + end + assert_match(/ball/i, err.message) + @bird._verify + end + + it "passes mock-call arguments to the expectation block" do + ball = nil + mitt = nil + @bird.expects.plop {|arg1,arg2| + ball = arg1 + mitt = arg2 + } + assert_nil ball + assert_nil mitt + @bird.plop(:ball,:mitt) + assert_equal :ball, ball + assert_equal :mitt, mitt + @bird._verify + end + + it "validates arguments if specified in addition to a block" do + ball = nil + mitt = nil + @bird.expects.plop(:ball,:mitt) {|arg1,arg2| + ball = arg1 + mitt = arg2 + } + assert_nil ball + assert_nil mitt + @bird.plop(:ball,:mitt) + assert_equal :ball, ball + assert_equal :mitt, mitt + @bird._verify + + ball = nil + mitt = nil + @bird.expects.plop(:bad,:stupid) {|arg1,arg2| + ball = arg1 + mitt = arg2 + } + assert_nil ball + assert_nil mitt + err = assert_raise ExpectationError do + @bird.plop(:ball,:mitt) + end + assert_match(/wrong arguments/i, err.message) + assert_nil ball + assert_nil mitt + @bird._verify + + ball = nil + mitt = nil + @bird.expects.plop(:ball,:mitt) {|arg1,arg2| + ball = arg1 + mitt = arg2 + } + assert_nil ball + assert_nil mitt + err = assert_raise ExpectationError do + @bird.plop(:ball) + end + assert_match(/wrong arguments/i, err.message) + assert_nil ball + assert_nil mitt + @bird._verify + end + + it "passes runtime blocks to the expectation block as the final argument" do + runtime_block_called = false + got_arg = nil + + # Eg, bird expects someone to subscribe to :tweet using the 'when' method + @bird.expects.when(:tweet) { |arg1, block| + got_arg = arg1 + block.call + } + + @bird.when(:tweet) do + runtime_block_called = true + end + + assert_equal :tweet, got_arg, "Wrong arg" + assert runtime_block_called, "The runtime block should have been invoked by the user block" + + @bird.expects.when(:warnk) { |e,blk| } + + err = assert_raise ExpectationError do + @bird.when(:honk) { } + end + assert_match(/wrong arguments/i, err.message) + + @bird._verify + end + + it "passes the runtime block to the expectation block as sole argument if no other args come into play" do + runtime_block_called = false + @bird.expects.subscribe { |block| block.call } + @bird.subscribe do + runtime_block_called = true + end + assert runtime_block_called, "The runtime block should have been invoked by the user block" + end + + it "provides nil as final argument if expectation block seems to want a block" do + invoked = false + @bird.expects.kablam(:scatter) { |shot,block| + assert_equal :scatter, shot, "Wrong shot" + assert_nil block, "The expectation block should get a nil block when user neglects to pass one" + invoked = true + } + @bird.kablam :scatter + assert invoked, "Expectation block not invoked" + + @bird._verify + end + + it "can set explicit return after an expectation block" do + got = nil + @bird.expects.kablam(:scatter) { |shot| + got = shot + }.returns(:death) + + val = @bird.kablam :scatter + assert_equal :death, val, "Wrong return value" + assert_equal :scatter, got, "Wrong argument" + @bird._verify + end + + it "can raise after an expectation block" do + got = nil + @bird.expects.kablam(:scatter) do |shot| + got = shot + end.raises "hell" + + err = assert_raise RuntimeError do + @bird.kablam :scatter + end + assert_match(/hell/i, err.message) + + @bird._verify + end + + it "stores the semantic value of the expectation block after it executes" do + expectation = @bird.expects.kablam(:slug) { |shot| + "The shot was #{shot}" + } + + assert_not_nil expectation, "Expectation nil" + assert_nil expectation.block_value, "Block value should start out nil" + + ret_val = @bird.kablam :slug + + assert_equal "The shot was slug", expectation.block_value + assert_equal "The shot was slug", ret_val, "Block value should also be used for return" + + @bird._verify + end + + + it "uses the value of the expectation block as the default return value" do + @bird.expects.kablam(:scatter) { |shot| + "The shot was #{shot}" + } + val = @bird.kablam :scatter + assert_equal "The shot was scatter", val, "Wrong return value" + @bird._verify + end + + it "returns the Expectation even if 'returns' is used" do + expectation = @bird.expects.kablam(:slug) { |shot| + "The shot was #{shot}" + }.returns :hosed + + assert_not_nil expectation, "Expectation nil" + assert_nil expectation.block_value, "Block value should start out nil" + + ret_val = @bird.kablam :slug + + assert_equal "The shot was slug", expectation.block_value + assert_equal :hosed, ret_val, "Block value should also be used for return" + + @bird._verify + end + + it "returns the Expectation even if 'raises' is used" do + expectation = @bird.expects.kablam(:slug) { |shot| + "The shot was #{shot}" + }.raises "aiee!" + + assert_not_nil expectation, "Expectation nil" + assert_nil expectation.block_value, "Block value should start out nil" + + err = assert_raise RuntimeError do + @bird.kablam :slug + end + assert_match(/aiee!/i, err.message) + assert_equal "The shot was slug", expectation.block_value + @bird._verify + end + + + it "supports assignment-style methods" do + @bird.expects.size = "large" + @bird.size = "large" + @bird._verify + end + + it "supports assignments and raising (using explicit-method syntax)" do + @bird.expects('size=','large').raises "boom" + + err = assert_raise RuntimeError do + @bird.size = "large" + end + assert_match(/boom/i, err.message) + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/hardmock_test.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/hardmock_test.rb new file mode 100644 index 0000000..159d369 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/hardmock_test.rb @@ -0,0 +1,434 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock' +require 'assert_error' + +class HardmockTest < Test::Unit::TestCase + + # + # TESTS + # + + it "conveniently creates mocks using create_mock and create_mocks" do + + h = create_mock :donkey + assert_equal [ :donkey ], h.keys + + assert_mock_exists :donkey + assert_same @donkey, h[:donkey] + + assert_equal [ :donkey ], @all_mocks.keys, "Wrong keyset for @all_mocks" + + h2 = create_mocks :cat, 'dog' # symbol/string indifference at this level + assert_equal [:cat,:dog].to_set, h2.keys.to_set, "Wrong keyset for second hash" + assert_equal [:cat,:dog,:donkey].to_set, @all_mocks.keys.to_set, "@all_mocks wrong" + + assert_mock_exists :cat + assert_same @cat, h2[:cat] + assert_mock_exists :dog + assert_same @dog, h2[:dog] + + assert_mock_exists :donkey + end + + it "provides literal 'expects' syntax" do + assert_nil @order, "Should be no @order yet" + create_mock :order + assert_not_nil @order, "@order should be built" + + # Setup an expectation + @order.expects.update_stuff :key1 => 'val1', :key2 => 'val2' + + # Use the mock + @order.update_stuff :key1 => 'val1', :key2 => 'val2' + + # Verify + verify_mocks + + # See that it's ok to do it again + verify_mocks + end + + it "supports 'with' for specifying argument expectations" do + create_mocks :car + @car.expects(:fill).with('gas','booze') + @car.fill('gas', 'booze') + verify_mocks + end + + it "supports several mocks at once" do + create_mocks :order_builder, :order, :customer + + @order_builder.expects.create_new_order.returns @order + @customer.expects.account_number.returns(1234) + @order.expects.account_no = 1234 + @order.expects.save! + + # Run "the code" + o = @order_builder.create_new_order + o.account_no = @customer.account_number + o.save! + + verify_mocks + end + + it "enforces inter-mock call ordering" do + create_mocks :order_builder, :order, :customer + + @order_builder.expects.create_new_order.returns @order + @customer.expects.account_number.returns(1234) + @order.expects.account_no = 1234 + @order.expects.save! + + # Run "the code" + o = @order_builder.create_new_order + err = assert_raise ExpectationError do + o.save! + end + assert_match(/wrong object/i, err.message) + assert_match(/order.save!/i, err.message) + assert_match(/customer.account_number/i, err.message) + + assert_error VerifyError, /unmet expectations/i do + verify_mocks + end + end + + class UserPresenter + def initialize(args) + view = args[:view] + model = args[:model] + model.when :data_changes do + view.user_name = model.user_name + end + view.when :user_edited do + model.user_name = view.user_name + end + end + end + + it "makes MVP testing simple" do + mox = create_mocks :model, :view + + data_change = @model.expects.when(:data_changes) { |evt,block| block } + user_edit = @view.expects.when(:user_edited) { |evt,block| block } + + UserPresenter.new mox + + # Expect user name transfer from model to view + @model.expects.user_name.returns 'Da Croz' + @view.expects.user_name = 'Da Croz' + # Trigger data change event in model + data_change.block_value.call + + # Expect user name transfer from view to model + @view.expects.user_name.returns '6:8' + @model.expects.user_name = '6:8' + # Trigger edit event in view + user_edit.block_value.call + + verify_mocks + end + + it "continues to function after verify, if verification error is controlled" do + mox = create_mocks :model, :view + data_change = @model.expects.when(:data_changes) { |evt,block| block } + user_edit = @view.expects.when(:user_edited) { |evt,block| block } + UserPresenter.new mox + + # Expect user name transfer from model to view + @model.expects.user_name.returns 'Da Croz' + @view.expects.user_name = 'Da Croz' + + assert_error ExpectationError, /model.monkey_wrench/i do + @model.monkey_wrench + end + + # This should raise because of unmet expectations + assert_error VerifyError, /unmet expectations/i, /user_name/i do + verify_mocks + end + + # See that the non-forced verification remains quiet + assert_nothing_raised VerifyError do + verify_mocks(false) + end + + @model.expects.never_gonna_happen + + assert_error VerifyError, /unmet expectations/i, /never_gonna_happen/i do + verify_mocks + end + end + + class UserPresenterBroken + def initialize(args) + view = args[:view] + model = args[:model] + model.when :data_changes do + view.user_name = model.user_name + end + # no view stuff, will break appropriately + end + end + + it "flunks for typical Presenter constructor wiring failure" do + mox = create_mocks :model, :view + + data_change = @model.expects.when(:data_changes) { |evt,block| block } + user_edit = @view.expects.when(:user_edited) { |evt,block| block } + + UserPresenterBroken.new mox + + err = assert_raise VerifyError do + verify_mocks + end + assert_match(/unmet expectations/i, err.message) + assert_match(/view.when\(:user_edited\)/i, err.message) + + end + + it "provides convenient event-subscription trap syntax for MVP testing" do + mox = create_mocks :model, :view + + data_change = @model.trap.when(:data_changes) + user_edit = @view.trap.when(:user_edited) + + UserPresenter.new mox + + # Expect user name transfer from model to view + @model.expects.user_name.returns 'Da Croz' + @view.expects.user_name = 'Da Croz' + # Trigger data change event in model + data_change.trigger + + # Expect user name transfer from view to model + @view.expects.user_name.returns '6:8' + @model.expects.user_name = '6:8' + # Trigger edit event in view + user_edit.trigger + + verify_mocks + end + + it "raises if you try to pass an expectation block to 'trap'" do + create_mock :model + assert_error Hardmock::ExpectationError, /blocks/i, /trap/i do + @model.trap.when(:some_event) do raise "huh?" end + end + end + + class Grinder + def initialize(objects) + @chute = objects[:chute] + @bucket = objects[:bucket] + @blade = objects[:blade] + end + + def grind(slot) + @chute.each_bean(slot) do |bean| + @bucket << @blade.chop(bean) + end + end + end + + it "lets you write clear iteration-oriented expectations" do + grinder = Grinder.new create_mocks(:blade, :chute, :bucket) + + # Style 1: assertions on method args is done explicitly in block + @chute.expects.each_bean { |slot,block| + assert_equal :side_slot, slot, "Wrong slot" + block.call :bean1 + block.call :bean2 + } + + @blade.expects.chop(:bean1).returns(:grounds1) + @bucket.expects('<<', :grounds1) + + @blade.expects.chop(:bean2).returns(:grounds2) + @bucket.expects('<<', :grounds2) + + # Run "the code" + grinder.grind(:side_slot) + + verify_mocks + + # Style 2: assertions on method arguments done implicitly in the expectation code + @chute.expects.each_bean(:main_slot) { |slot,block| + block.call :bean3 + } + @blade.expects.chop(:bean3).returns(:grounds3) + @bucket.expects('<<', :grounds3) + grinder.grind :main_slot + verify_mocks + end + + it "further supports iteration testing using 'yield'" do + grinder = Grinder.new create_mocks(:blade, :chute, :bucket) + + @chute.expects.each_bean(:side_slot).yields :bean1, :bean2 + + @blade.expects.chop(:bean1).returns(:grounds1) + @bucket.expects('<<', :grounds1) + + @blade.expects.chop(:bean2).returns(:grounds2) + @bucket.expects('<<', :grounds2) + + grinder.grind :side_slot + + verify_mocks + end + + class HurtLocker + attr_reader :caught + def initialize(opts) + @locker = opts[:locker] + @store = opts[:store] + end + + def do_the_thing(area,data) + @locker.with_lock(area) do + @store.eat(data) + end + rescue => oops + @caught = oops + end + end + + it "makes mutex-style locking scenarios easy to test" do + hurt = HurtLocker.new create_mocks(:locker, :store) + + @locker.expects.with_lock(:main).yields + @store.expects.eat("some info") + + hurt.do_the_thing(:main, "some info") + + verify_mocks + end + + it "makes it easy to simulate error in mutex-style locking scenarios" do + hurt = HurtLocker.new create_mocks(:locker, :store) + err = StandardError.new('fmshooop') + @locker.expects.with_lock(:main).yields + @store.expects.eat("some info").raises(err) + + hurt.do_the_thing(:main, "some info") + + assert_same err, hurt.caught, "Expected that error to be handled internally" + verify_mocks + end + + it "actually returns 'false' instead of nil when mocking boolean return values" do + create_mock :car + @car.expects.ignition_on?.returns(true) + assert_equal true, @car.ignition_on?, "Should be true" + @car.expects.ignition_on?.returns(false) + assert_equal false, @car.ignition_on?, "Should be false" + end + + it "can mock most methods inherited from object using literal syntax" do + target_methods = %w|id clone display dup eql? ==| + create_mock :foo + target_methods.each do |m| + eval %{@foo.expects(m, "some stuff")} + eval %{@foo.#{m} "some stuff"} + end + end + + it "provides 'expect' as an alias for 'expects'" do + create_mock :foo + @foo.expect.boomboom + @foo.boomboom + verify_mocks + end + + it "provides 'should_receive' as an alias for 'expects'" do + create_mock :foo + @foo.should_receive.boomboom + @foo.boomboom + verify_mocks + end + + it "provides 'and_return' as an alias for 'returns'" do + create_mock :foo + @foo.expects(:boomboom).and_return :brick + assert_equal :brick, @foo.boomboom + verify_mocks + end + + it "does not interfere with a core subset of Object methods" do + create_mock :foo + @foo.method(:inspect) + @foo.inspect + @foo.to_s + @foo.instance_variables + @foo.instance_eval("") + verify_mocks + end + + it "can raise errors from within an expectation block" do + create_mock :cat + @cat.expects.meow do |arg| + assert_equal "mix", arg + raise 'HAIRBALL' + end + assert_error RuntimeError, 'HAIRBALL' do + @cat.meow("mix") + end + end + + it "can raise errors AFTER an expectation block" do + create_mock :cat + @cat.expects.meow do |arg| + assert_equal "mix", arg + end.raises('HAIRBALL') + assert_error RuntimeError, 'HAIRBALL' do + @cat.meow("mix") + end + end + + it "raises an immediate error if a mock is created with a nil name (common mistake: create_mock @cat)" do + # I make this mistake all the time: Typing in an instance var name instead of a symbol in create_mocks. + # When you do that, you're effectively passing nil(s) in as mock names. + assert_error ArgumentError, /'nil' is not a valid name for a mock/ do + create_mocks @apples, @oranges + end + end + + it "overrides 'inspect' to make nice output" do + create_mock :hay_bailer + assert_equal "", @hay_bailer.inspect, "Wrong output from 'inspect'" + end + + it "raises if prepare_hardmock_control is invoked after create_mocks, or more than once" do + create_mock :hi_there + create_mocks :another, :one + assert_error RuntimeError, /already setup/ do + prepare_hardmock_control + end + end + + should "support alias verify_hardmocks" do + create_mock :tree + @tree.expects(:grow) + assert_error VerifyError, /unmet/i do + verify_hardmocks + end + end + + # + # HELPERS + # + + def assert_mock_exists(name) + assert_not_nil @all_mocks, "@all_mocks not here yet" + mo = @all_mocks[name] + assert_not_nil mo, "Mock '#{name}' not in @all_mocks" + assert_kind_of Mock, mo, "Wrong type of object, wanted a Mock" + assert_equal name.to_s, mo._name, "Mock '#{name}' had wrong name" + ivar = self.instance_variable_get("@#{name}") + assert_not_nil ivar, "Mock '#{name}' not set as ivar" + assert_same mo, ivar, "Mock '#{name}' ivar not same as instance in @all_mocks" + assert_same @main_mock_control, mo._control, "Mock '#{name}' doesn't share the main mock control" + end +end + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/stubbing_test.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/stubbing_test.rb new file mode 100644 index 0000000..f07a670 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/stubbing_test.rb @@ -0,0 +1,479 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock' +require 'assert_error' + +class StubbingTest < Test::Unit::TestCase + + # + # TESTS + # + + it "stubs a class method (and un-stubs after reset_stubs)" do + assert_equal "stones and gravel", Concrete.pour + assert_equal "glug glug", Jug.pour + + Concrete.stubs!(:pour).returns("dust and plaster") + + 3.times do + assert_equal "dust and plaster", Concrete.pour + end + + assert_equal "glug glug", Jug.pour, "Jug's 'pour' method broken" + assert_equal "stones and gravel", Concrete._hardmock_original_pour, "Original 'pour' method not aliased" + + assert_equal "For roads", Concrete.describe, "'describe' method broken" + + reset_stubs + + assert_equal "stones and gravel", Concrete.pour, "'pour' method not restored" + assert_equal "For roads", Concrete.describe, "'describe' method broken after verify" + + end + + it "stubs several class methods" do + Concrete.stubs!(:pour).returns("sludge") + Concrete.stubs!(:describe).returns("awful") + Jug.stubs!(:pour).returns("milk") + + assert_equal "sludge", Concrete.pour + assert_equal "awful", Concrete.describe + assert_equal "milk", Jug.pour + + reset_stubs + + assert_equal "stones and gravel", Concrete.pour + assert_equal "For roads", Concrete.describe + assert_equal "glug glug", Jug.pour + end + + it "stubs instance methods" do + slab = Concrete.new + assert_equal "bonk", slab.hit + + slab.stubs!(:hit).returns("slap") + assert_equal "slap", slab.hit, "'hit' not stubbed" + + reset_stubs + + assert_equal "bonk", slab.hit, "'hit' not restored" + end + + it "stubs instance methods without breaking class methods or other instances" do + slab = Concrete.new + scrape = Concrete.new + assert_equal "an instance", slab.describe + assert_equal "an instance", scrape.describe + assert_equal "For roads", Concrete.describe + + slab.stubs!(:describe).returns("new instance describe") + assert_equal "new instance describe", slab.describe, "'describe' on instance not stubbed" + assert_equal "an instance", scrape.describe, "'describe' on 'scrape' instance broken" + assert_equal "For roads", Concrete.describe, "'describe' class method broken" + + reset_stubs + + assert_equal "an instance", slab.describe, "'describe' instance method not restored" + assert_equal "an instance", scrape.describe, "'describe' on 'scrape' instance broken after restore" + assert_equal "For roads", Concrete.describe, "'describe' class method broken after restore" + end + + should "allow stubbing of nonexistant class methods" do + Concrete.stubs!(:funky).returns('juice') + assert_equal 'juice', Concrete.funky + end + + should "allow stubbing of nonexistant instance methods" do + chunk = Concrete.new + chunk.stubs!(:shark).returns('bite') + assert_equal 'bite', chunk.shark + end + + should "allow re-stubbing" do + Concrete.stubs!(:pour).returns("one") + assert_equal "one", Concrete.pour + + Concrete.stubs!(:pour).raises("hell") + assert_error RuntimeError, /hell/ do + Concrete.pour + end + + Concrete.stubs!(:pour).returns("two") + assert_equal "two", Concrete.pour + + reset_stubs + + assert_equal "stones and gravel", Concrete.pour + end + + it "does nothing with a runtime block when simply stubbing" do + slab = Concrete.new + slab.stubs!(:hit) do |nothing| + raise "BOOOMM!" + end + slab.hit + reset_stubs + end + + it "can raise errors from a stubbed method" do + Concrete.stubs!(:pour).raises(StandardError.new("no!")) + assert_error StandardError, /no!/ do + Concrete.pour + end + end + + it "provides string syntax for convenient raising of RuntimeErrors" do + Concrete.stubs!(:pour).raises("never!") + assert_error RuntimeError, /never!/ do + Concrete.pour + end + end + + + # + # Per-method mocking on classes or instances + # + + it "mocks specific methods on existing classes, and returns the class method to normal after verification" do + + assert_equal "stones and gravel", Concrete.pour, "Concrete.pour is already messed up" + + Concrete.expects!(:pour).returns("ALIGATORS") + assert_equal "ALIGATORS", Concrete.pour + + verify_mocks + assert_equal "stones and gravel", Concrete.pour, "Concrete.pour not restored" + end + + it "flunks if expected class method is not invoked" do + + Concrete.expects!(:pour).returns("ALIGATORS") + assert_error(Hardmock::VerifyError, /Concrete.pour/, /unmet expectations/i) do + verify_mocks + end + clear_expectations + end + + it "supports all normal mock functionality for class methods" do + + Concrete.expects!(:pour, "two tons").returns("mice") + Concrete.expects!(:pour, "three tons").returns("cats") + Concrete.expects!(:pour, "four tons").raises("Can't do it") + Concrete.expects!(:pour) do |some, args| + "==#{some}+#{args}==" + end + + assert_equal "mice", Concrete.pour("two tons") + assert_equal "cats", Concrete.pour("three tons") + assert_error(RuntimeError, /Can't do it/) do + Concrete.pour("four tons") + end + assert_equal "==first+second==", Concrete.pour("first","second") + end + + + it "enforces inter-mock ordering when mocking class methods" do + create_mocks :truck, :foreman + + @truck.expects.backup + Concrete.expects!(:pour, "something") + @foreman.expects.shout + + @truck.backup + assert_error Hardmock::ExpectationError, /wrong/i, /expected call/i, /Concrete.pour/ do + @foreman.shout + end + assert_error Hardmock::VerifyError, /unmet expectations/i, /foreman.shout/ do + verify_mocks + end + clear_expectations + end + + should "allow mocking non-existant class methods" do + Concrete.expects!(:something).returns("else") + assert_equal "else", Concrete.something + end + + it "mocks specific methods on existing instances, then restore them after verify" do + + slab = Concrete.new + assert_equal "bonk", slab.hit + + slab.expects!(:hit).returns("slap") + assert_equal "slap", slab.hit, "'hit' not stubbed" + + verify_mocks + assert_equal "bonk", slab.hit, "'hit' not restored" + end + + it "flunks if expected instance method is not invoked" do + + slab = Concrete.new + slab.expects!(:hit) + + assert_error Hardmock::VerifyError, /unmet expectations/i, /Concrete.hit/ do + verify_mocks + end + clear_expectations + end + + it "supports all normal mock functionality for instance methods" do + + slab = Concrete.new + + slab.expects!(:hit, "soft").returns("hey") + slab.expects!(:hit, "hard").returns("OOF") + slab.expects!(:hit).raises("stoppit") + slab.expects!(:hit) do |some, args| + "==#{some}+#{args}==" + end + + assert_equal "hey", slab.hit("soft") + assert_equal "OOF", slab.hit("hard") + assert_error(RuntimeError, /stoppit/) do + slab.hit + end + assert_equal "==first+second==", slab.hit("first","second") + + end + + it "enforces inter-mock ordering when mocking instance methods" do + create_mocks :truck, :foreman + slab1 = Concrete.new + slab2 = Concrete.new + + @truck.expects.backup + slab1.expects!(:hit) + @foreman.expects.shout + slab2.expects!(:hit) + @foreman.expects.whatever + + @truck.backup + slab1.hit + @foreman.shout + assert_error Hardmock::ExpectationError, /wrong/i, /expected call/i, /Concrete.hit/ do + @foreman.whatever + end + assert_error Hardmock::VerifyError, /unmet expectations/i, /foreman.whatever/ do + verify_mocks + end + clear_expectations + end + + should "allow mocking non-existant instance methods" do + slab = Concrete.new + slab.expects!(:wholly).returns('happy') + assert_equal 'happy', slab.wholly + end + + should "support concrete expectations that deal with runtime blocks" do + + Concrete.expects!(:pour, "a lot") do |how_much, block| + assert_equal "a lot", how_much, "Wrong how_much arg" + assert_not_nil block, "nil runtime block" + assert_equal "the block value", block.call, "Wrong runtime block value" + end + + Concrete.pour("a lot") do + "the block value" + end + + end + + it "can stub methods on mock objects" do + create_mock :horse + @horse.stubs!(:speak).returns("silence") + @horse.stubs!(:hello).returns("nothing") + @horse.expects(:canter).returns("clip clop") + + assert_equal "silence", @horse.speak + assert_equal "clip clop", @horse.canter + assert_equal "silence", @horse.speak + assert_equal "silence", @horse.speak + assert_equal "nothing", @horse.hello + assert_equal "nothing", @horse.hello + + verify_mocks + reset_stubs + end + + it "can stub the new method and return values" do + Concrete.stubs!(:new).returns("this value") + assert_equal "this value", Concrete.new, "did not properly stub new class method" + reset_stubs + end + + it "can mock the new method and return values" do + Concrete.expects!(:new).with("foo").returns("hello") + Concrete.expects!(:new).with("bar").returns("world") + + assert_equal "hello", Concrete.new("foo"), "did not properly mock out new class method" + assert_equal "world", Concrete.new("bar"), "did not properly mock out new class method" + + verify_mocks + reset_stubs + end + + it "can mock several different class methods at once" do + sim_code = lambda do |input| + record = Multitool.find_record(input) + report = Multitool.generate_report(record) + Multitool.format_output(report) + end + + @identifier = "the id" + @record = "the record" + @report = "the report" + @output = "the output" + + Multitool.expects!(:find_record).with(@identifier).returns(@record) + Multitool.expects!(:generate_report).with(@record).returns(@report) + Multitool.expects!(:format_output).with(@report).returns(@output) + + result = sim_code.call(@identifier) + assert_equal @output, result, "Wrong output" + end + + it "can handle a mix of different and repeat class method mock calls" do + prep = lambda { + Multitool.expects!(:find_record).with("A").returns("1") + Multitool.expects!(:generate_report).with("1") + Multitool.expects!(:find_record).with("B").returns("2") + Multitool.expects!(:generate_report).with("2") + } + + prep[] + Multitool.generate_report(Multitool.find_record("A")) + Multitool.generate_report(Multitool.find_record("B")) + + prep[] + Multitool.generate_report(Multitool.find_record("A")) + assert_error Hardmock::ExpectationError, /Wrong arguments/, /find_record\("B"\)/, /find_record\("C"\)/ do + Multitool.generate_report(Multitool.find_record("C")) + end + clear_expectations + end + + it "can mock several concrete instance methods at once" do + inst = OtherMultitool.new + sim_code = lambda do |input| + record = inst.find_record(input) + report = inst.generate_report(record) + inst.format_output(report) + end + + @identifier = "the id" + @record = "the record" + @report = "the report" + @output = "the output" + + inst.expects!(:find_record).with(@identifier).returns(@record) + inst.expects!(:generate_report).with(@record).returns(@report) + inst.expects!(:format_output).with(@report).returns(@output) + + result = sim_code.call(@identifier) + assert_equal @output, result, "Wrong output" + end + + it "verifies all concrete expects! from several different expectations" do + Multitool.expects!(:find_record) + Multitool.expects!(:generate_report) + Multitool.expects!(:format_output) + + Multitool.find_record + Multitool.generate_report + + assert_error Hardmock::VerifyError, /unmet expectations/i, /format_output/i do + verify_mocks + end + end + + it "will not allow expects! to be used on a mock object" do + create_mock :cow + assert_error Hardmock::StubbingError, /expects!/, /mock/i, /something/ do + @cow.expects!(:something) + end + end + + it "does not allow stubbing on nil objects" do + [ nil, @this_is_nil ].each do |nil_obj| + assert_error Hardmock::StubbingError, /cannot/i, /nil/i, /intentionally/ do + nil_obj.stubs!(:wont_work) + end + end + end + + it "does not allow concrete method mocking on nil objects" do + [ nil, @this_is_nil ].each do |nil_obj| + assert_error Hardmock::StubbingError, /cannot/i, /nil/i, /intentionally/ do + nil_obj.expects!(:wont_work) + end + end + end + + it "provides an alternate method for stubbing on nil objects" do + @this_is_nil.intentionally_stubs!(:bogus).returns('output') + assert_equal 'output', @this_is_nil.bogus + end + + it "provides an alternate method for mocking concreate methods on nil objects" do + @this_is_nil.intentionally_expects!(:bogus).returns('output') + assert_error Hardmock::VerifyError, /unmet expectations/i, /NilClass.bogus/ do + verify_mocks + end + end + + # + # HELPERS + # + + class Concrete + def initialize; end + def self.pour + "stones and gravel" + end + + def self.describe + "For roads" + end + + def hit + "bonk" + end + + def describe + "an instance" + end + end + + class Jug + def self.pour + "glug glug" + end + end + + class Multitool + def self.find_record(*a) + raise "The real Multitool.find_record was called with #{a.inspect}" + end + def self.generate_report(*a) + raise "The real Multitool.generate_report was called with #{a.inspect}" + end + def self.format_output(*a) + raise "The real Multitool.format_output was called with #{a.inspect}" + end + end + + class OtherMultitool + def find_record(*a) + raise "The real OtherMultitool#find_record was called with #{a.inspect}" + end + def generate_report(*a) + raise "The real OtherMultitool#generate_report was called with #{a.inspect}" + end + def format_output(*a) + raise "The real OtherMultitool#format_output was called with #{a.inspect}" + end + end + +end + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/test/test_helper.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/test/test_helper.rb new file mode 100644 index 0000000..af159a4 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/test/test_helper.rb @@ -0,0 +1,43 @@ +here = File.expand_path(File.dirname(__FILE__)) +$: << here + +require "#{here}/../config/environment" +require 'test/unit' +require 'fileutils' +require 'logger' +require 'find' +require 'yaml' +require 'set' +require 'ostruct' + +class Test::Unit::TestCase + include FileUtils + + def poll(time_limit) + (time_limit * 10).to_i.times do + return true if yield + sleep 0.1 + end + return false + end + + def self.it(str, &block) + make_test_case "it", str, &block + end + + def self.should(str, &block) + make_test_case "should", str, &block + end + + def self.make_test_case(prefix, str, &block) + tname = self.name.sub(/Test$/,'') + if block + define_method "test #{prefix} #{str}" do + instance_eval &block + end + else + puts ">>> UNIMPLEMENTED CASE: #{tname}: #{str}" + end + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/expectation_builder_test.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/expectation_builder_test.rb new file mode 100644 index 0000000..f689f98 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/expectation_builder_test.rb @@ -0,0 +1,19 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/expectation_builder' + +class ExpectationBuilderTest < Test::Unit::TestCase + include Hardmock + + def test_build_expectation + builder = ExpectationBuilder.new + + ex = builder.build_expectation( :stuff => 'inside' ) + assert_not_nil ex, "Didn't build an expectation" + assert_kind_of Expectation, ex, "Wrong type!" + + # Shhhh... fragile, yes, whatever. The functional tests do the + # real testing of this anyway + assert_equal({:stuff => 'inside'}, ex.instance_variable_get('@options'), "Hash not sent to SimpleExpectation constructor") + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/expectation_test.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/expectation_test.rb new file mode 100644 index 0000000..54bd204 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/expectation_test.rb @@ -0,0 +1,372 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/expectation' +require 'hardmock/errors' +require 'assert_error' + +class ExpectationTest < Test::Unit::TestCase + include Hardmock + + def setup + @mock = TheMock.new + end + # + # HELPERS + # + + class TheMock + def _name; 'the_mock'; end + end + class OtherMock + def _name; 'other_mock'; end + end + + # + # TESTS + # + + def test_to_s + ex = Expectation.new( :mock => @mock, :method => 'a_func', :arguments => [1, "two", :three, { :four => 4 }] ) + assert_equal %|the_mock.a_func(1, "two", :three, {:four=>4})|, ex.to_s + end + + def test_apply_method_call + se = Expectation.new(:mock => @mock, :method => 'some_func', + :arguments => [1,'two',:three] ) + + # Try it good: + assert_nothing_raised ExpectationError do + se.apply_method_call( @mock, 'some_func', [1,'two',:three], nil ) + end + + # Bad func name: + err = assert_raise ExpectationError do + se.apply_method_call( @mock, 'wrong_func', [1,'two',:three], nil ) + end + assert_match(/wrong method/i, err.message) + assert_match(/wrong_func/i, err.message) + assert_match(/[1, "two", :three]/i, err.message) + assert_match(/some_func/i, err.message) + assert_match(/the_mock/i, err.message) + + # Wrong mock + err = assert_raise ExpectationError do + se.apply_method_call( OtherMock.new, 'some_func', [1,'two',:three], nil ) + end + assert_match(/[1, "two", :three]/i, err.message) + assert_match(/some_func/i, err.message) + assert_match(/the_mock/i, err.message) + assert_match(/other_mock/i, err.message) + + # Wrong args + err = assert_raise ExpectationError do + se.apply_method_call( @mock, 'some_func', [1,'two',:four], nil) + end + assert_match(/[1, "two", :three]/i, err.message) + assert_match(/[1, "two", :four]/i, err.message) + assert_match(/wrong arguments/i, err.message) + assert_match(/some_func/i, err.message) + end + + def test_apply_method_call_should_call_proc_when_given + # now with a proc + thinger = nil + the_proc = Proc.new { thinger = :shaq } + se = Expectation.new(:mock => @mock, :method => 'some_func', + :block => the_proc) + + # Try it good: + assert_nil thinger + assert_nothing_raised ExpectationError do + se.apply_method_call(@mock, 'some_func', [], nil) + end + assert_equal :shaq, thinger, 'wheres shaq??' + end + + def test_apply_method_call_passes_runtime_block_as_last_argument_to_expectation_block + + passed_block = nil + exp_block_called = false + exp_block = Proc.new { |blk| + exp_block_called = true + passed_block = blk + } + + se = Expectation.new(:mock => @mock, :method => 'some_func', :block => exp_block, + :arguments => []) + + set_flag = false + runtime_block = Proc.new { set_flag = true } + + assert_nil passed_block, "Passed block should be nil" + assert !set_flag, "set_flag should be off" + + # Go + se.apply_method_call( @mock, 'some_func', [], runtime_block) + + # Examine the passed block + assert exp_block_called, "Expectation block not called" + assert_not_nil passed_block, "Should have been passed a block" + assert !set_flag, "set_flag should still be off" + passed_block.call + assert set_flag, "set_flag should be on" + end + + def test_apply_method_call_fails_when_theres_no_expectation_block_to_handle_the_runtime_block + se = Expectation.new(:mock => @mock, :method => 'some_func', :arguments => []) + runtime_block = Proc.new { set_flag = true } + err = assert_raise ExpectationError do + se.apply_method_call( @mock, 'some_func', [], runtime_block) + end + assert_match(/unexpected block/i, err.message) + assert_match(/the_mock.some_func()/i, err.message) + end + + def test_returns + se = Expectation.new(:mock => @mock, :method => 'some_func', + :arguments => [1,'two',:three]) + + se.returns "A value" + + assert_equal "A value", se.apply_method_call(@mock, 'some_func', [1,'two',:three], nil) + end + + def test_apply_method_call_captures_block_value + the_proc = lambda { "in the block" } + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => [], :block => the_proc) + + assert_nil se.block_value, "Block value starts out nil" + + se.apply_method_call(@mock, 'do_it', [], nil) + + assert_equal "in the block", se.block_value, "Block value not captured" + end + + def test_trigger + # convenience method for block_value.call + target = false + inner_proc = lambda { target = true } + the_proc = lambda { inner_proc } + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => [], :block => the_proc) + + assert_nil se.block_value, "Block value starts out nil" + se.apply_method_call(@mock, 'do_it', [], nil) + assert_not_nil se.block_value, "Block value not set" + + assert !target, "Target should still be false" + se.trigger + assert target, "Target not true!" + end + + def test_trigger_with_arguments + # convenience method for block_value.call + target = nil + inner_proc = lambda { |one,two| target = [one,two] } + the_proc = lambda { inner_proc } + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => [], :block => the_proc) + + assert_nil se.block_value, "Block value starts out nil" + se.apply_method_call(@mock, 'do_it', [], nil) + assert_not_nil se.block_value, "Block value not set" + + assert_nil target, "target should still be nil" + se.trigger 'cat','dog' + assert_equal ['cat','dog'], target + end + + def test_trigger_nil_block_value + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => []) + + assert_nil se.block_value, "Block value starts out nil" + se.apply_method_call(@mock, 'do_it', [], nil) + assert_nil se.block_value, "Block value should still be nil" + + err = assert_raise ExpectationError do + se.trigger + end + assert_match(/do_it/i, err.message) + assert_match(/block value/i, err.message) + end + + def test_trigger_non_proc_block_value + the_block = lambda { "woops" } + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => [], :block => the_block) + + se.apply_method_call(@mock, 'do_it', [], nil) + assert_equal "woops", se.block_value + + err = assert_raise ExpectationError do + se.trigger + end + assert_match(/do_it/i, err.message) + assert_match(/trigger/i, err.message) + assert_match(/woops/i, err.message) + end + + + + def test_proc_used_for_return + the_proc = lambda { "in the block" } + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => [], :block => the_proc) + + assert_equal "in the block", se.apply_method_call(@mock, 'do_it', [], nil) + assert_equal "in the block", se.block_value, "Captured block value affected wrongly" + end + + def test_explicit_return_overrides_proc_return + the_proc = lambda { "in the block" } + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => [], :block => the_proc) + se.returns "the override" + assert_equal "the override", se.apply_method_call(@mock, 'do_it', [], nil) + assert_equal "in the block", se.block_value, "Captured block value affected wrongly" + end + + def test_yields + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] ) + se.yields :bean1, :bean2 + + things = [] + a_block = lambda { |thinger| things << thinger } + + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + assert_equal [:bean1,:bean2], things, "Wrong things" + end + + def test_yields_block_takes_no_arguments + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] ) + se.yields + + things = [] + a_block = lambda { things << 'OOF' } + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + assert_equal ['OOF'], things + end + + def test_yields_params_to_block_takes_no_arguments + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] ) + se.yields :wont_fit + + things = [] + a_block = lambda { things << 'WUP' } + + err = assert_raise ExpectationError do + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + end + assert_match(/wont_fit/i, err.message) + assert_match(/arity -1/i, err.message) + assert_equal [], things, "Wrong things" + end + + def test_yields_with_returns + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] , + :returns => 'the results') + + exp = se.yields :bean1, :bean2 + assert_same se, exp, "'yields' needs to return a reference to the expectation" + things = [] + a_block = lambda { |thinger| things << thinger } + returned = se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + assert_equal [:bean1,:bean2], things, "Wrong things" + assert_equal 'the results', returned, "Wrong return value" + end + + def test_yields_with_raises + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot], + :raises => RuntimeError.new("kerboom")) + + exp = se.yields :bean1, :bean2 + assert_same se, exp, "'yields' needs to return a reference to the expectation" + things = [] + a_block = lambda { |thinger| things << thinger } + err = assert_raise RuntimeError do + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + end + assert_match(/kerboom/i, err.message) + assert_equal [:bean1,:bean2], things, "Wrong things" + end + + def test_yields_and_inner_block_explodes + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot]) + + exp = se.yields :bean1, :bean2 + assert_same se, exp, "'yields' needs to return a reference to the expectation" + things = [] + a_block = lambda { |thinger| + things << thinger + raise "nasty" + } + err = assert_raise RuntimeError do + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + end + assert_match(/nasty/i, err.message) + assert_equal [:bean1], things, "Wrong things" + end + + def test_yields_with_several_arrays + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] ) + se.yields ['a','b'], ['c','d'] + + things = [] + a_block = lambda { |thinger| things << thinger } + + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + assert_equal [ ['a','b'], ['c','d'] ], things, "Wrong things" + end + + def test_yields_tuples + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] ) + se.yields ['a','b','c'], ['d','e','f'] + + things = [] + a_block = lambda { |left,mid,right| + things << { :left => left, :mid => mid, :right => right } + } + + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + assert_equal [ + {:left => 'a', :mid => 'b', :right => 'c' }, + {:left => 'd', :mid => 'e', :right => 'f' }, + ], things, "Wrong things" + end + + def test_yields_tuples_size_mismatch + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] ) + se.yields ['a','b','c'], ['d','e','f'] + + things = [] + a_block = lambda { |left,mid| + things << { :left => left, :mid => mid } + } + + err = assert_raise ExpectationError do + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + end + assert_match(/arity/i, err.message) + assert_match(/the_mock.each_bean/i, err.message) + assert_match(/"a", "b", "c"/i, err.message) + assert_equal [], things, "Wrong things" + end + + def test_yields_bad_block_arity + se = Expectation.new(:mock => @mock, :method => 'do_later', :arguments => [] ) + se.yields + + assert_error Hardmock::ExpectationError, /block/i, /expected/i, /no param/i, /got 2/i do + se.apply_method_call(@mock,'do_later',[],lambda { |doesnt,match| raise "Surprise!" } ) + end + end + + def test_that_arguments_can_be_added_to_expectation + expectation = Expectation.new(:mock => @mock, :method => "each_bean") + assert_same expectation, expectation.with("jello", "for", "cosby"), "should have returned the same expectation" + + err = assert_raise ExpectationError do + expectation.apply_method_call(@mock, 'each_bean', [], nil) + end + assert_match(/wrong arguments/i, err.message) + + assert_nothing_raised(ExpectationError) do + expectation.apply_method_call(@mock, 'each_bean', ["jello", "for", "cosby"], nil) + end + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/expector_test.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/expector_test.rb new file mode 100644 index 0000000..f420db2 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/expector_test.rb @@ -0,0 +1,57 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/expector' + +class ExpectorTest < Test::Unit::TestCase + include Hardmock + + class MyControl + attr_reader :added + def add_expectation(expectation) + @added ||= [] + @added << expectation + end + end + + class ExpBuilder + attr_reader :options + def build_expectation(options) + @options = options + "dummy expectation" + end + end + + def try_it_with(method_name) + mock = Object.new + mock_control = MyControl.new + builder = ExpBuilder.new + + exp = Expector.new(mock, mock_control, builder) + output = exp.send(method_name,:with, 1, 'sauce') + + assert_same mock, builder.options[:mock] + assert_equal method_name, builder.options[:method].to_s + assert_equal [:with,1,'sauce'], builder.options[:arguments] + assert_nil builder.options[:block] + assert_equal [ "dummy expectation" ], mock_control.added, + "Wrong expectation added to control" + + assert_equal "dummy expectation", output, "Expectation should have been returned" + end + + # + # TESTS + # + def test_method_missing + try_it_with 'wonder_bread' + try_it_with 'whatever' + end + + def test_methods_that_wont_trigger_method_missing + mock = Object.new + mock_control = MyControl.new + builder = ExpBuilder.new + + exp = Expector.new(mock, mock_control, builder) + assert_equal mock, exp.instance_eval("@mock") + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/method_cleanout_test.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/method_cleanout_test.rb new file mode 100644 index 0000000..7aa6293 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/method_cleanout_test.rb @@ -0,0 +1,36 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/method_cleanout' + +class MethodCleanoutTest < Test::Unit::TestCase + class Victim + OriginalMethods = instance_methods + include Hardmock::MethodCleanout + end + + def setup + @victim = Victim.new + end + + def test_should_remove_most_methods_from_a_class + expect_removed = Victim::OriginalMethods.reject { |m| + Hardmock::MethodCleanout::SACRED_METHODS.include?(m) + } + expect_removed.each do |m| + assert !@victim.respond_to?(m), "should not have method #{m}" + end + end + + def test_should_leave_the_sacred_methods_defined + Hardmock::MethodCleanout::SACRED_METHODS.each do |m| + next if m =~ /^hm_/ + assert @victim.respond_to?(m), "Sacred method '#{m}' was removed unexpectedly" + end + end + + def test_should_include_certain_important_methods_in_the_sacred_methods_list + %w|__id__ __send__ equal? object_id send nil? class kind_of? respond_to? inspect method to_s instance_variables instance_eval|.each do |m| + assert Hardmock::MethodCleanout::SACRED_METHODS.include?(m), "important method #{m} is not included in SACRED_METHODS" + end + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/mock_control_test.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/mock_control_test.rb new file mode 100644 index 0000000..3c52db6 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/mock_control_test.rb @@ -0,0 +1,175 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/utils' +require 'hardmock/errors' +require 'hardmock/mock_control' + +class MockControlTest < Test::Unit::TestCase + include Hardmock + + def setup + @unmock = OpenStruct.new( :_name => 'fakemock' ) + + @control = MockControl.new + assert @control.happy?, "Control should start out happy" + end + + def teardown + end + + # + # HELPERS + # + + class MyExp + attr_reader :mock, :mname, :args, :block + def apply_method_call(mock, mname, args, block) + @mock = mock + @mname = mname + @args = args + @block = block + end + end + + class BoomExp < MyExp + def apply_method_call(mock, mname, args, block) + super + raise "BOOM" + end + end + + # + # TESTS + # + + def test_add_exepectation_and_apply_method_call + e1 = MyExp.new + + @control.add_expectation e1 + assert !@control.happy? + + @control.apply_method_call @unmock, 'some_func', [ 'the', :args ], nil + assert @control.happy? + + assert_same @unmock, e1.mock, "Wrong mock" + assert_equal 'some_func', e1.mname, "Wrong method" + assert_equal [ 'the', :args ], e1.args, "Wrong args" + + @control.verify + end + + def test_add_exepectation_and_apply_method_call_with_block + e1 = MyExp.new + + @control.add_expectation e1 + assert !@control.happy? + + runtime_block = Proc.new { "hello" } + @control.apply_method_call @unmock, 'some_func', [ 'the', :args ], runtime_block + assert @control.happy? + + assert_same @unmock, e1.mock, "Wrong mock" + assert_equal 'some_func', e1.mname, "Wrong method" + assert_equal [ 'the', :args ], e1.args, "Wrong args" + assert_equal "hello", e1.block.call, "Wrong block in expectation" + + @control.verify + end + + def test_add_expectation_then_verify + e1 = MyExp.new + + @control.add_expectation e1 + assert !@control.happy?, "Shoudn't be happy" + err = assert_raise VerifyError do + @control.verify + end + assert_match(/unmet expectations/i, err.message) + + @control.apply_method_call @unmock, 'some_func', [ 'the', :args ], nil + assert @control.happy? + + assert_same @unmock, e1.mock, "Wrong mock" + assert_equal 'some_func', e1.mname, "Wrong method" + assert_equal [ 'the', :args ], e1.args, "Wrong args" + + @control.verify + end + + def test_expectation_explosion + be1 = BoomExp.new + + @control.add_expectation be1 + + err = assert_raise RuntimeError do + @control.apply_method_call @unmock, 'a func', [:arg], nil + end + assert_match(/BOOM/i, err.message) + + assert_same @unmock, be1.mock + assert_equal 'a func', be1.mname + assert_equal [:arg], be1.args + end + + def test_disappointment_on_bad_verify + @control.add_expectation MyExp.new + assert !@control.happy?, "Shouldn't be happy" + assert !@control.disappointed?, "too early to be disappointed" + + # See verify fails + err = assert_raise VerifyError do + @control.verify + end + assert_match(/unmet expectations/i, err.message) + + assert !@control.happy?, "Still have unmet expectation" + assert @control.disappointed?, "We should be disappointed following that failure" + + @control.apply_method_call @unmock, 'something', [], nil + assert @control.happy?, "Should be happy" + assert @control.disappointed?, "We should be skeptical" + + @control.verify + + assert !@control.disappointed?, "Should be non-disappointed" + end + + def test_disappointment_from_surprise_calls + assert @control.happy?, "Should be happy" + assert !@control.disappointed?, "too early to be disappointed" + + # See verify fails + err = assert_raise ExpectationError do + @control.apply_method_call @unmock, "something", [], nil + end + assert_match(/surprise/i, err.message) + + assert @control.happy?, "Happiness is an empty list of expectations" + assert @control.disappointed?, "We should be disappointed following that failure" + + @control.verify + assert !@control.disappointed?, "Disappointment should be gone" + end + + def test_disappointment_from_bad_calls + be1 = BoomExp.new + assert !@control.disappointed?, "Shouldn't be disappointed" + @control.add_expectation be1 + assert !@control.disappointed?, "Shouldn't be disappointed" + + err = assert_raise RuntimeError do + @control.apply_method_call @unmock, 'a func', [:arg], nil + end + assert_match(/BOOM/i, err.message) + assert @control.disappointed?, "Should be disappointed" + + assert_same @unmock, be1.mock + assert_equal 'a func', be1.mname + assert_equal [:arg], be1.args + + assert @control.happy?, "Happiness is an empty list of expectations" + @control.verify + assert !@control.disappointed?, "Disappointment should be gone" + end + + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/mock_test.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/mock_test.rb new file mode 100644 index 0000000..2579bcc --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/mock_test.rb @@ -0,0 +1,279 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/method_cleanout' +require 'hardmock/mock' +require 'hardmock/mock_control' +require 'hardmock/expectation_builder' +require 'hardmock/expector' +require 'hardmock/trapper' + +class MockTest < Test::Unit::TestCase + include Hardmock + + def test_build_with_control + mc1 = MockControl.new + mock = Mock.new('hi', mc1) + assert_equal 'hi', mock._name, "Wrong name" + assert_same mc1, mock._control, "Wrong contol" + end + + def test_basics + mock = Mock.new('a name') + assert_equal 'a name', mock._name, "Wrong name for mock" + assert_not_nil mock._control, "Nil control in mock" + end + + def test_expects + mock = Mock.new('order') + control = mock._control + assert control.happy?, "Mock should start out satisfied" + + mock.expects.absorb_something(:location, 'garbage') + assert !control.happy?, "mock control should be unhappy" + + # Do the call + mock.absorb_something(:location, 'garbage') + assert control.happy?, "mock control should be happy again" + + # Verify + assert_nothing_raised Exception do + mock._verify + end + end + + def test_expects_using_arguments_for_method_and_arguments + mock = Mock.new('order') + mock.expects(:absorb_something, :location, 'garbage') + mock.absorb_something(:location, 'garbage') + mock._verify + end + + def test_expects_using_arguments_for_method_and_arguments_with_block + mock = Mock.new('order') + mock.expects(:absorb_something, :location, 'garbage') { |a,b,block| + assert_equal :location, a, "Wrong 'a' argument" + assert_equal 'garbage', b, "Wrong 'b' argument" + assert_equal 'innards', block.call, "Wrong block" + } + mock.absorb_something(:location, 'garbage') do "innards" end + mock._verify + end + + def test_expects_using_string_method_name + mock = Mock.new('order') + mock.expects('absorb_something', :location, 'garbage') + mock.absorb_something(:location, 'garbage') + mock._verify + end + + + def test_expects_assignment + mock = Mock.new('order') + mock.expects.account_number = 1234 + + mock.account_number = 1234 + + mock._verify + end + + def test_expects_assigment_using_arguments_for_method_and_arguments + mock = Mock.new('order') + mock.expects(:account_number=, 1234) + mock.account_number = 1234 + mock._verify + end + + def test_expects_assigment_using_string_method_name + mock = Mock.new('order') + mock.expects('account_number=', 1234) + mock.account_number = 1234 + mock._verify + end + + def test_expects_assignment_and_return_is_overruled_by_ruby_syntax + # Prove that we can set up a return but that it doesn't mean much, + # because ruby's parser will 'do the right thing' as regards semantic + # values for assignment. (That is, the rvalue of the assignment) + mock = Mock.new('order') + mock.expects(:account_number=, 1234).returns "gold" + got = mock.account_number = 1234 + mock._verify + assert_equal 1234, got, "Expected rvalue" + end + + def test_expects_assignment_and_raise + mock = Mock.new('order') + mock.expects(:account_number=, 1234).raises StandardError.new("kaboom") + err = assert_raise StandardError do + mock.account_number = 1234 + end + assert_match(/kaboom/i, err.message) + mock._verify + end + + + def test_expects_multiple + mock = Mock.new('order') + control = mock._control + + assert control.happy? + + mock.expects.one_thing :hi, { :goose => 'neck' } + mock.expects.another 5,6,7 + assert !control.happy? + + mock.one_thing :hi, { :goose => 'neck' } + assert !control.happy? + + mock.another 5,6,7 + assert control.happy? + end + + def test_surprise_call + mock = Mock.new('order') + err = assert_raise ExpectationError do + mock.uh_oh + end + assert_match(/surprise/i, err.message) + assert_match(/uh_oh/i, err.message) + + err = assert_raise ExpectationError do + mock.whoa :horse + end + assert_match(/surprise/i, err.message) + assert_match(/order\.whoa\(:horse\)/i, err.message) + end + + def test_wrong_call + mock = Mock.new('order') + mock.expects.pig 'arse' + err = assert_raise ExpectationError do + mock.whoa :horse + end + assert_match(/wrong method/i, err.message) + assert_match(/order\.whoa\(:horse\)/i, err.message) + assert_match(/order\.pig\("arse"\)/i, err.message) + end + + def test_wrong_arguments + mock = Mock.new('order') + mock.expects.go_fast(:a, 1, 'three') + + err = assert_raise ExpectationError do + mock.go_fast :a, 1, 'not right' + end + assert_match(/wrong argument/i, err.message) + assert_match(/order\.go_fast\(:a, 1, "three"\)/i, err.message) + assert_match(/order\.go_fast\(:a, 1, "not right"\)/i, err.message) + end + + def test_expects_and_return + mock = Mock.new('order') + mock.expects.delivery_date.returns Date.today + assert_equal Date.today, mock.delivery_date + mock._verify + end + + def test_expects_and_return_with_arguments + mock = Mock.new('order') + mock.expects.delivery_date(:arf,14).returns(Date.today) + assert_equal Date.today, mock.delivery_date(:arf,14) + mock._verify + end + + def test_expects_and_raise + mock = Mock.new('order') + mock.expects.delivery_date.raises StandardError.new("bloof") + + err = assert_raise StandardError do + mock.delivery_date + end + assert_match(/bloof/i, err.message) + + mock._verify + + # Try convenience argument String + mock.expects.pow.raises "hell" + err = assert_raise RuntimeError do + mock.pow + end + assert_match(/hell/i, err.message) + + mock._verify + + # Try convenience argument nothing + mock.expects.pow.raises + err = assert_raise RuntimeError do + mock.pow + end + assert_match(/an error/i, err.message) + + mock._verify + end + + def test_expects_a_runtime_block + mock = Mock.new('order') + got_val = nil + + mock.expects.when(:something) { |e,block| + got_val = block.call + } + + mock.when :something do "hi there" end + + assert_equal "hi there", got_val, "Expectation block not invoked" + mock._verify + end + + def test_trap_block + mock = Mock.new('order') + exp = mock.trap.observe + + # use it + mock.observe { "burp" } + + assert_equal "burp", exp.block_value.call + end + + def test_trap_arguments_and_block + mock = Mock.new('order') + exp = mock.trap.subscribe(:data_changed) + + # use it + mock.subscribe(:data_changed) { "burp" } + assert_equal "burp", exp.block_value.call + mock._verify + end + + def test_trap_arguments_and_block_wrong_num_args + mock = Mock.new('order') + exp = mock.trap.subscribe(:data_changed) + + assert_raise ExpectationError do + mock.subscribe(:data_changed,1) { "burp" } + end + mock._verify + end + + def test_trap_arguments_and_block_wrong_args + mock = Mock.new('order') + exp = mock.trap.subscribe(:data_changed) + + assert_raise ExpectationError do + mock.subscribe("no good") { "burp" } + end + + mock._verify + end + + def test_trap_is_not_leniant_about_arguments + mock = Mock.new('order') + exp = mock.trap.subscribe + + assert_raise ExpectationError do + mock.subscribe("no good") { "burp" } + end + + mock._verify + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/test_unit_before_after_test.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/test_unit_before_after_test.rb new file mode 100644 index 0000000..172f527 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/test_unit_before_after_test.rb @@ -0,0 +1,452 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") + +class TestUnitBeforeAfter < Test::Unit::TestCase + + # + # after_teardown + # + + it "adds TestCase.after_teardown hook for appending post-teardown actions" do + write_and_run_test :use_after_teardown => true + + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "THE TEARDOWN", + "1st after_teardown", + "2nd after_teardown", + "Finished in" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 0 + end + + should "execute all after_teardowns, even if the main teardown flunks" do + write_and_run_test :use_after_teardown => true, :flunk_in_teardown => true + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "F", + "1st after_teardown", + "2nd after_teardown", + "Finished in", + "1) Failure:", + "test_something(MyExampleTest) [_test_file_temp.rb:20]:", + "FLUNK IN TEARDOWN" + see_results :tests => 1, :assertions => 1, :failures => 1, :errors => 0 + end + + should "execute all after_teardowns, even if the main teardown explodes" do + write_and_run_test :use_after_teardown => true, :raise_in_teardown => true + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "E", + "1st after_teardown", + "2nd after_teardown", + "Finished in", + "RuntimeError: ERROR IN TEARDOWN" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 1 + end + + should "execute all after_teardowns, even if some of them flunk" do + write_and_run_test :use_after_teardown => true, :flunk_in_after_teardown => true + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "THE TEARDOWN", + "1st after_teardown", + "F", + "2nd after_teardown", + "Finished in", + "1) Failure:", + "test_something(MyExampleTest) [_test_file_temp.rb:7]:", + "Flunk in first after_teardown", + "2) Failure:", + "test_something(MyExampleTest) [_test_file_temp.rb:10]:", + "Flunk in second after_teardown" + see_results :tests => 1, :assertions => 2, :failures => 2, :errors => 0 + end + + should "execute all after_teardowns, even if some of them explode" do + write_and_run_test :use_after_teardown => true, :raise_in_after_teardown => true + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "THE TEARDOWN", + "1st after_teardown", + "E", + "2nd after_teardown", + "Finished in", + "RuntimeError: Error in first after_teardown", + "RuntimeError: Error in second after_teardown" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 2 + end + + it "will run after_teardowns in the absence of a regular teardown" do + write_and_run_test :omit_teardown => true, :use_after_teardown => true + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "1st after_teardown", + "2nd after_teardown", + "Finished in" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 0 + end + + should "not interfere with normal test writing" do + write_and_run_test + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "THE TEARDOWN", + "Finished in" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 0 + end + + it "provides a cleaned-up backtrace" do + write_and_run_test :with_failure => true + see_in_order "Loaded suite", + "THE SETUP", + "A FAILING TEST", + "F", "THE TEARDOWN", + "Finished in", + "1) Failure:", + "test_something(MyExampleTest) [_test_file_temp.rb:17]:", + "Instrumented failure.", + " is not true." + see_results :tests => 1, :assertions => 1, :failures => 1, :errors => 0 + end + + it "provides a cleaned-up backtrace, but not TOO cleaned up" do + write_and_run_test :with_failure => true, :use_helpers => true + see_in_order "Loaded suite", + "THE SETUP", + "A FAILING TEST", + "F", "THE TEARDOWN", + "Finished in", + "1) Failure:", + "test_something(MyExampleTest)\n", + "[_test_file_temp.rb:25:in `tripwire'", + "_test_file_temp.rb:21:in `my_helper'", + "_test_file_temp.rb:17:in `test_something']:", + "Instrumented failure.", + " is not true." + see_results :tests => 1, :assertions => 1, :failures => 1, :errors => 0 + end + + should "not interfere with passthrough exception types" do + if is_modern_test_unit? + write_and_run_test :raise_nasty_in_test => true + see_in_no_particular_order "Loaded suite", + "THE TEARDOWN", + "_test_file_temp.rb:16:in `test_something': NASTY ERROR (NoMemoryError)" + see_no_results + end + end + + # + # before_setup + # + + it "adds TestCase.before_setup hook for prepending pre-setup actions" do + write_and_run_test :use_before_setup => true + see_in_order "Loaded suite", + "3rd before_setup", + "2nd before_setup", + "1st before_setup", + "THE SETUP", + "A TEST", + "THE TEARDOWN", + "Finished in" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 0 + end + + should "stop executing the test on the first failure withing a before_setup action" do + write_and_run_test :use_before_setup => true, :flunk_in_before_setup => true + see_in_order "Loaded suite", + "3rd before_setup", + "2nd before_setup", + "FTHE TEARDOWN", + "1) Failure:", + "test_something(MyExampleTest) [_test_file_temp.rb:10]:", + "Flunk in 2nd before_setup." + see_results :tests => 1, :assertions => 1, :failures => 1, :errors => 0 + end + + should "stop executing the test on the first error within a before_setup action" do + write_and_run_test :use_before_setup => true, :raise_in_before_setup => true + see_in_order "Loaded suite", + "3rd before_setup", + "2nd before_setup", + "ETHE TEARDOWN", + "Finished in", + "test_something(MyExampleTest):", + "RuntimeError: Error in 2nd before_setup", + "_test_file_temp.rb:10", + "/hardmock/lib/test_unit_before_after.rb:", ":in `call'" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 1 + end + + it "will run before_setup actions in the absence of a regular setup" do + write_and_run_test :omit_setup => true, :use_before_setup => true + see_in_order "Loaded suite", + "3rd before_setup", + "2nd before_setup", + "1st before_setup", + "A TEST", + "THE TEARDOWN", + "Finished in" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 0 + end + + it "allows before_setup and after_teardown to be used at the same time" do + write_and_run_test :use_before_setup => true, :use_after_teardown => true + see_in_order "Loaded suite", + "3rd before_setup", + "2nd before_setup", + "1st before_setup", + "A TEST", + "THE TEARDOWN", + "1st after_teardown", + "2nd after_teardown", + "Finished in" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 0 + end + + # + # HELPERS + # + + def teardown + remove_test + end + + def test_filename + "_test_file_temp.rb" + end + + def remove_test + rm_f test_filename + end + + def write_and_run_test(opts={}) + write(test_filename, generate_test_code(opts)) + run_test + end + + def run_test + @output = `ruby #{test_filename} 2>&1` + end + + + def write(fname, code) + File.open(fname,"w") do |f| + f.print code + end + end + + def show_output + puts "-- BEGIN TEST OUTPUT" + puts @output + puts "-- END TEST OUTPUT" + end + + def see_in_order(*phrases) + idx = 0 + phrases.each do |txt| + idx = @output.index(txt, idx) + if idx.nil? + if @output.index(txt) + flunk "Phrase '#{txt}' is out-of-order in test output:\n#{@output}" + else + flunk "Phrase '#{txt}' not found in test output:\n#{@output}" + end + end + end + end + + def see_in_no_particular_order(*phrases) + phrases.each do |txt| + assert_not_nil @output.index(txt), "Didn't see '#{txt}' in test output:\n#{@output}" + end + end + + def see_results(opts) + if @output =~ /(\d+) tests, (\d+) assertions, (\d+) failures, (\d+) errors/ + tests, assertions, failures, errors = [ $1, $2, $3, $4 ] + [:tests, :assertions, :failures, :errors].each do |key| + eval %{assert_equal(opts[:#{key}].to_s, #{key}, "Wrong number of #{key} in report") if opts[:#{key}]} + end + else + flunk "Didn't see the test results report line" + end + end + + def see_no_results + if @output =~ /\d+ tests, \d+ assertions, \d+ failures, \d+ errors/ + flunk "Should not have had a results line:\n#{@output}" + end + end + + def lib_dir + File.expand_path(File.dirname(__FILE__) + "/../../lib") + end + + def generate_test_code(opts={}) + + if opts[:with_failure] or opts[:raise_nasty_in_test] + test_method_code = generate_failing_test("test_something", opts) + else + test_method_code = generate_passing_test("test_something") + end + + + requires_for_ext = '' + if opts[:use_before_setup] or opts[:use_after_teardown] + requires_for_ext =<<-RFE + $: << "#{lib_dir}" + require 'test_unit_before_after' + RFE + end + + before_setups = '' + if opts[:use_before_setup] + add_on_two = "" + if opts[:flunk_in_before_setup] + add_on_two = %{; test.flunk "Flunk in 2nd before_setup"} + elsif opts[:raise_in_before_setup] + add_on_two = %{; raise "Error in 2nd before_setup"} + end + before_setups =<<-BSTS + Test::Unit::TestCase.before_setup do |test| + puts "1st before_setup" + end + Test::Unit::TestCase.before_setup do |test| + puts "2nd before_setup" #{add_on_two} + end + Test::Unit::TestCase.before_setup do |test| + puts "3rd before_setup" + end + + BSTS + end + + + setup_code =<<-SC + def setup + puts "THE SETUP" + end + SC + if opts[:omit_setup] + setup_code = "" + end + + after_teardowns = '' + if opts[:use_after_teardown] + add_on_one = "" + add_on_two = "" + if opts[:flunk_in_after_teardown] + add_on_one = %{; test.flunk "Flunk in first after_teardown"} + add_on_two = %{; test.flunk "Flunk in second after_teardown"} + elsif opts[:raise_in_after_teardown] + add_on_one = %{; raise "Error in first after_teardown"} + add_on_two = %{; raise "Error in second after_teardown"} + end + after_teardowns =<<-ATDS + Test::Unit::TestCase.after_teardown do |test| + puts "1st after_teardown" #{add_on_one} + end + Test::Unit::TestCase.after_teardown do |test| + puts "2nd after_teardown" #{add_on_two} + end + ATDS + end + + teardown_code =<<-TDC + def teardown + puts "THE TEARDOWN" + end + TDC + if opts[:flunk_in_teardown] + teardown_code =<<-TDC + def teardown + flunk "FLUNK IN TEARDOWN" + end + TDC + elsif opts[:raise_in_teardown] + teardown_code =<<-TDC + def teardown + raise "ERROR IN TEARDOWN" + end + TDC + end + if opts[:omit_teardown] + teardown_code = "" + end + + str = <<-TCODE + require 'test/unit' + #{requires_for_ext} + + #{before_setups} #{after_teardowns} + + class MyExampleTest < Test::Unit::TestCase + #{setup_code} + #{teardown_code} + #{test_method_code} + end + TCODE + end + + def generate_passing_test(tname) + str = <<-TMETH + def #{tname} + puts "A TEST" + end + TMETH + end + + def generate_failing_test(tname, opts={}) + str = "NOT DEFINED?" + if opts[:raise_nasty_in_test] + str = <<-TMETH + def #{tname} + raise NoMemoryError, "NASTY ERROR" + end + TMETH + + elsif opts[:use_helpers] + str = <<-TMETH + def #{tname} + puts "A FAILING TEST" + my_helper + end + + def my_helper + tripwire + end + + def tripwire + assert false, "Instrumented failure" + end + TMETH + else + str = <<-TMETH + def #{tname} + puts "A FAILING TEST" + assert false, "Instrumented failure" + end + TMETH + end + return str + end + + def is_modern_test_unit? + begin + Test::Unit::TestCase::PASSTHROUGH_EXCEPTIONS + return true + rescue NameError + return false + end + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/trapper_test.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/trapper_test.rb new file mode 100644 index 0000000..f7d4114 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/trapper_test.rb @@ -0,0 +1,62 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/method_cleanout' +require 'hardmock/trapper' + +class TrapperTest < Test::Unit::TestCase + include Hardmock + + def setup + @mock = Object.new + @mock_control = MyControl.new + @builder = ExpBuilder.new + @trapper = Trapper.new(@mock, @mock_control, @builder) + end + + # + # HELPERS + # + + class MyControl + attr_reader :added + def add_expectation(expectation) + @added ||= [] + @added << expectation + end + end + + class ExpBuilder + attr_reader :options + def build_expectation(options) + @options = options + "dummy expectation" + end + end + + # + # TESTS + # + + def test_method_missing + + output = @trapper.change(:less) + + assert_same @mock, @builder.options[:mock] + assert_equal :change, @builder.options[:method] + assert_equal [:less], @builder.options[:arguments] + assert_not_nil @builder.options[:block] + assert @builder.options[:suppress_arguments_to_block], ":suppress_arguments_to_block should be set" + assert_equal [ "dummy expectation" ], @mock_control.added, + "Wrong expectation added to control" + + assert_equal "dummy expectation", output, "Expectation should have been returned" + + # Examine the block. It should take one argument and simply return + # that argument. because of the 'suppress arguments to block' + # setting, the argument can only end up being a block, in practice. + trapper_block = @builder.options[:block] + assert_equal "the argument", trapper_block.call("the argument"), + "The block should merely return the passed argument" + end + + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/verify_error_test.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/verify_error_test.rb new file mode 100644 index 0000000..ecd23fd --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/verify_error_test.rb @@ -0,0 +1,40 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/method_cleanout' +require 'hardmock/mock_control' +require 'hardmock/errors' +require 'hardmock/expectation_builder' +require 'hardmock/expectation' +require 'hardmock/mock' + +class VerifyErrorTest < Test::Unit::TestCase + include Hardmock + + # + # TESTS + # + + def test_formatted_list_of_unmet_expectations + mock1 = Mock.new('mock1') + mock2 = Mock.new('mock2') + exp1 = Expectation.new( :mock => mock1, :method => 'send_parts', :arguments => [1,2,:a] ) + exp2 = Expectation.new( :mock => mock2, :method => 'grind_it', :arguments => [] ) + + exp_list = [ exp1, exp2 ] + + err = VerifyError.new("This is the error", exp_list) + assert_equal "This is the error:\n * #{exp1.to_s}\n * #{exp2.to_s}", err.message + end + + def test_empty_list_of_expectations + # this is not a normal case; not spending a lot of time to make this better + exp_list = [] + err = VerifyError.new("This is the error:\n", exp_list) + end + + def test_nil_expectation_list + # this is not a normal case; not spending a lot of time to make this better + exp_list = [] + err = VerifyError.new("This is the error:\n", exp_list) + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/auto/colour_prompt.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/auto/colour_prompt.rb new file mode 100644 index 0000000..81003dd --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/auto/colour_prompt.rb @@ -0,0 +1,94 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +if RUBY_PLATFORM =~/(win|w)32$/ + begin + require 'Win32API' + rescue LoadError + puts "ERROR! \"Win32API\" library not found" + puts "\"Win32API\" is required for colour on a windows machine" + puts " try => \"gem install Win32API\" on the command line" + puts + end + # puts + # puts 'Windows Environment Detected...' + # puts 'Win32API Library Found.' + # puts +end + +class ColourCommandLine + def initialize + if RUBY_PLATFORM =~/(win|w)32$/ + get_std_handle = Win32API.new("kernel32", "GetStdHandle", ['L'], 'L') + @set_console_txt_attrb = + Win32API.new("kernel32","SetConsoleTextAttribute",['L','N'], 'I') + @hout = get_std_handle.call(-11) + end + end + + def change_to(new_colour) + if RUBY_PLATFORM =~/(win|w)32$/ + @set_console_txt_attrb.call(@hout,self.win32_colour(new_colour)) + else + "\033[30;#{posix_colour(new_colour)};22m" + end + end + + def win32_colour(colour) + case colour + when :black then 0 + when :dark_blue then 1 + when :dark_green then 2 + when :dark_cyan then 3 + when :dark_red then 4 + when :dark_purple then 5 + when :dark_yellow, :narrative then 6 + when :default_white, :default, :dark_white then 7 + when :silver then 8 + when :blue then 9 + when :green, :success then 10 + when :cyan, :output then 11 + when :red, :failure then 12 + when :purple then 13 + when :yellow then 14 + when :white then 15 + else + 0 + end + end + + def posix_colour(colour) + case colour + when :black then 30 + when :red, :failure then 31 + when :green, :success then 32 + when :yellow then 33 + when :blue, :narrative then 34 + when :purple, :magenta then 35 + when :cyan, :output then 36 + when :white, :default_white, :default then 37 + else + 30 + end + end + + def out_c(mode, colour, str) + case RUBY_PLATFORM + when /(win|w)32$/ + change_to(colour) + $stdout.puts str if mode == :puts + $stdout.print str if mode == :print + change_to(:default_white) + else + $stdout.puts("#{change_to(colour)}#{str}\033[0m") if mode == :puts + $stdout.print("#{change_to(colour)}#{str}\033[0m") if mode == :print + end + end +end # ColourCommandLine + +def colour_puts(role,str) ColourCommandLine.new.out_c(:puts, role, str) end +def colour_print(role,str) ColourCommandLine.new.out_c(:print, role, str) end + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/auto/colour_reporter.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/auto/colour_reporter.rb new file mode 100644 index 0000000..5aa1d27 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/auto/colour_reporter.rb @@ -0,0 +1,39 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require "#{File.expand_path(File.dirname(__FILE__))}/colour_prompt" + +$colour_output = true + +def report(message) + if not $colour_output + $stdout.puts(message) + else + message = message.join('\n') if (message.class == Array) + message.each_line do |line| + line.chomp! + colour = case(line) + when /(?:total\s+)?tests:?\s+(\d+)\s+(?:total\s+)?failures:?\s+\d+\s+Ignored:?/i + ($1.to_i == 0) ? :green : :red + when /PASS/ + :green + when /^OK$/ + :green + when /(?:FAIL|ERROR)/ + :red + when /IGNORE/ + :yellow + when /^(?:Creating|Compiling|Linking)/ + :white + else + :silver + end + colour_puts(colour, line) + end + end + $stdout.flush + $stderr.flush +end \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/auto/generate_config.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/auto/generate_config.yml new file mode 100644 index 0000000..4a5e474 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/auto/generate_config.yml @@ -0,0 +1,36 @@ +#this is a sample configuration file for generate_module +#you would use it by calling generate_module with the -ygenerate_config.yml option +#files like this are useful for customizing generate_module to your environment +:generate_module: + :defaults: + #these defaults are used in place of any missing options at the command line + :path_src: ../src/ + :path_inc: ../src/ + :path_tst: ../test/ + :update_svn: true + :includes: + #use [] for no additional includes, otherwise list the includes on separate lines + :src: + - Defs.h + - Board.h + :inc: [] + :tst: + - Defs.h + - Board.h + - Exception.h + :boilerplates: + #these are inserted at the top of generated files. + #just comment out or remove if not desired. + #use %1$s where you would like the file name to appear (path/extension not included) + :src: | + //------------------------------------------- + // %1$s.c + //------------------------------------------- + :inc: | + //------------------------------------------- + // %1$s.h + //------------------------------------------- + :tst: | + //------------------------------------------- + // Test%1$s.c : Units tests for %1$s.c + //------------------------------------------- diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/auto/generate_module.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/auto/generate_module.rb new file mode 100644 index 0000000..3db1a98 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/auto/generate_module.rb @@ -0,0 +1,202 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +# This script creates all the files with start code necessary for a new module. +# A simple module only requires a source file, header file, and test file. +# Triad modules require a source, header, and test file for each triad type (like model, conductor, and hardware). + +require 'rubygems' +require 'fileutils' + +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +#help text when requested +HELP_TEXT = [ "\nGENERATE MODULE\n-------- ------", + "\nUsage: ruby generate_module [options] module_name", + " -i\"include\" sets the path to output headers to 'include' (DEFAULT ../src)", + " -s\"../src\" sets the path to output source to '../src' (DEFAULT ../src)", + " -t\"C:/test\" sets the path to output source to 'C:/test' (DEFAULT ../test)", + " -p\"MCH\" sets the output pattern to MCH.", + " dh - driver hardware.", + " dih - driver interrupt hardware.", + " mch - model conductor hardware.", + " mvp - model view presenter.", + " src - just a single source module. (DEFAULT)", + " -d destroy module instead of creating it.", + " -u update subversion too (requires subversion command line)", + " -y\"my.yml\" selects a different yaml config file for module generation", + "" ].join("\n") + +#Built in patterns +PATTERNS = { 'src' => {'' => { :inc => [] } }, + 'dh' => {'Driver' => { :inc => ['%1$sHardware.h'] }, + 'Hardware' => { :inc => [] } + }, + 'dih' => {'Driver' => { :inc => ['%1$sHardware.h', '%1$sInterrupt.h'] }, + 'Interrupt'=> { :inc => ['%1$sHardware.h'] }, + 'Hardware' => { :inc => [] } + }, + 'mch' => {'Model' => { :inc => [] }, + 'Conductor'=> { :inc => ['%1$sModel.h', '%1$sHardware.h'] }, + 'Hardware' => { :inc => [] } + }, + 'mvp' => {'Model' => { :inc => [] }, + 'Presenter'=> { :inc => ['%1$sModel.h', '%1$sView.h'] }, + 'View' => { :inc => [] } + } + } + +#TEMPLATE_TST +TEMPLATE_TST = %q[#include "unity.h" +%2$s#include "%1$s.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void test_%1$s_NeedToImplement(void) +{ + TEST_IGNORE(); +} +] + +#TEMPLATE_SRC +TEMPLATE_SRC = %q[%2$s#include "%1$s.h" +] + +#TEMPLATE_INC +TEMPLATE_INC = %q[#ifndef _%3$s_H +#define _%3$s_H%2$s + +#endif // _%3$s_H +] + +# Parse the command line parameters. +ARGV.each do |arg| + case(arg) + when /^-d/ then @destroy = true + when /^-u/ then @update_svn = true + when /^-p(\w+)/ then @pattern = $1 + when /^-s(.+)/ then @path_src = $1 + when /^-i(.+)/ then @path_inc = $1 + when /^-t(.+)/ then @path_tst = $1 + when /^-y(.+)/ then @yaml_config = $1 + when /^(\w+)/ + raise "ERROR: You can't have more than one Module name specified!" unless @module_name.nil? + @module_name = arg + when /^-(h|-help)/ + puts HELP_TEXT + exit + else + raise "ERROR: Unknown option specified '#{arg}'" + end +end +raise "ERROR: You must have a Module name specified! (use option -h for help)" if @module_name.nil? + +#load yaml file if one was requested +if @yaml_config + require 'yaml' + cfg = YAML.load_file(HERE + @yaml_config)[:generate_module] + @path_src = cfg[:defaults][:path_src] if @path_src.nil? + @path_inc = cfg[:defaults][:path_inc] if @path_inc.nil? + @path_tst = cfg[:defaults][:path_tst] if @path_tst.nil? + @update_svn = cfg[:defaults][:update_svn] if @update_svn.nil? + @extra_inc = cfg[:includes] + @boilerplates = cfg[:boilerplates] +else + @boilerplates = {} +end + +# Create default file paths if none were provided +@path_src = HERE + "../src/" if @path_src.nil? +@path_inc = @path_src if @path_inc.nil? +@path_tst = HERE + "../test/" if @path_tst.nil? +@path_src += '/' unless (@path_src[-1] == 47) +@path_inc += '/' unless (@path_inc[-1] == 47) +@path_tst += '/' unless (@path_tst[-1] == 47) +@pattern = 'src' if @pattern.nil? +@includes = { :src => [], :inc => [], :tst => [] } +@includes.merge!(@extra_inc) unless @extra_inc.nil? + +#create triad definition +TRIAD = [ { :ext => '.c', :path => @path_src, :template => TEMPLATE_SRC, :inc => :src, :boilerplate => @boilerplates[:src] }, + { :ext => '.h', :path => @path_inc, :template => TEMPLATE_INC, :inc => :inc, :boilerplate => @boilerplates[:inc] }, + { :ext => '.c', :path => @path_tst+'Test', :template => TEMPLATE_TST, :inc => :tst, :boilerplate => @boilerplates[:tst] }, + ] + +#prepare the pattern for use +@patterns = PATTERNS[@pattern.downcase] +raise "ERROR: The design pattern specified isn't one that I recognize!" if @patterns.nil? + +# Assemble the path/names of the files we need to work with. +files = [] +TRIAD.each do |triad| + @patterns.each_pair do |pattern_file, pattern_traits| + files << { + :path => "#{triad[:path]}#{@module_name}#{pattern_file}#{triad[:ext]}", + :name => "#{@module_name}#{pattern_file}", + :template => triad[:template], + :boilerplate => triad[:boilerplate], + :includes => case(triad[:inc]) + when :src then @includes[:src] | pattern_traits[:inc].map{|f| f % [@module_name]} + when :inc then @includes[:inc] + when :tst then @includes[:tst] | pattern_traits[:inc].map{|f| "Mock#{f}"% [@module_name]} + end + } + end +end + +# destroy files if that was what was requested +if @destroy + files.each do |filespec| + file = filespec[:path] + if File.exist?(file) + if @update_svn + `svn delete \"#{file}\" --force` + puts "File #{file} deleted and removed from source control" + else + FileUtils.remove(file) + puts "File #{file} deleted" + end + else + puts "File #{file} does not exist so cannot be removed." + end + end + puts "Destroy Complete" + exit +end + +#Abort if any module already exists +files.each do |file| + raise "ERROR: File #{file[:name]} already exists. Exiting." if File.exist?(file[:path]) +end + +# Create Source Modules +files.each_with_index do |file, i| + File.open(file[:path], 'w') do |f| + f.write(file[:boilerplate] % [file[:name]]) unless file[:boilerplate].nil? + f.write(file[:template] % [ file[:name], + file[:includes].map{|f| "#include \"#{f}\"\n"}.join, + file[:name].upcase ] + ) + end + if (@update_svn) + `svn add \"#{file[:path]}\"` + if $?.exitstatus == 0 + puts "File #{file[:path]} created and added to source control" + else + puts "File #{file[:path]} created but FAILED adding to source control!" + end + else + puts "File #{file[:path]} created" + end +end + +puts 'Generate Complete' diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/auto/generate_test_runner.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/auto/generate_test_runner.rb new file mode 100644 index 0000000..aff5053 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/auto/generate_test_runner.rb @@ -0,0 +1,303 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +File.expand_path(File.join(File.dirname(__FILE__),'colour_prompt')) + +class UnityTestRunnerGenerator + + def initialize(options = nil) + @options = { :includes => [], :plugins => [], :framework => :unity } + case(options) + when NilClass then @options + when String then @options.merge!(UnityTestRunnerGenerator.grab_config(options)) + when Hash then @options.merge!(options) + else raise "If you specify arguments, it should be a filename or a hash of options" + end + end + + def self.grab_config(config_file) + options = { :includes => [], :plugins => [], :framework => :unity } + unless (config_file.nil? or config_file.empty?) + require 'yaml' + yaml_guts = YAML.load_file(config_file) + options.merge!(yaml_guts[:unity] ? yaml_guts[:unity] : yaml_guts[:cmock]) + raise "No :unity or :cmock section found in #{config_file}" unless options + end + return(options) + end + + def run(input_file, output_file, options=nil) + tests = [] + includes = [] + used_mocks = [] + + @options.merge!(options) unless options.nil? + module_name = File.basename(input_file) + + #pull required data from source file + File.open(input_file, 'r') do |input| + tests = find_tests(input) + includes = find_includes(input) + used_mocks = find_mocks(includes) + end + + #build runner file + File.open(output_file, 'w') do |output| + create_header(output, used_mocks) + create_externs(output, tests, used_mocks) + create_mock_management(output, used_mocks) + create_suite_setup_and_teardown(output) + create_reset(output, used_mocks) + create_main(output, input_file, tests) + end + + all_files_used = [input_file, output_file] + all_files_used += includes.map {|filename| filename + '.c'} unless includes.empty? + all_files_used += @options[:includes] unless @options[:includes].empty? + return all_files_used.uniq + end + + def find_tests(input_file) + tests_raw = [] + tests_args = [] + tests_and_line_numbers = [] + + input_file.rewind + source_raw = input_file.read + source_scrubbed = source_raw.gsub(/\/\/.*$/, '') # remove line comments + source_scrubbed = source_scrubbed.gsub(/\/\*.*?\*\//m, '') # remove block comments + lines = source_scrubbed.split(/(^\s*\#.*$) # Treat preprocessor directives as a logical line + | (;|\{|\}) /x) # Match ;, {, and } as end of lines + + lines.each_with_index do |line, index| + #find tests + if line =~ /^((?:\s*TEST_CASE\s*\(.*?\)\s*)*)\s*void\s+(test.*?)\s*\(\s*(.*)\s*\)/ + arguments = $1 + name = $2 + call = $3 + args = nil + if (@options[:use_param_tests] and !arguments.empty?) + args = [] + arguments.scan(/\s*TEST_CASE\s*\((.*)\)\s*$/) {|a| args << a[0]} + end + tests_and_line_numbers << { :name => name, :args => args, :call => call, :line_number => 0 } + tests_args = [] + end + end + + #determine line numbers and create tests to run + source_lines = source_raw.split("\n") + source_index = 0; + tests_and_line_numbers.size.times do |i| + source_lines[source_index..-1].each_with_index do |line, index| + if (line =~ /#{tests_and_line_numbers[i][:name]}/) + source_index += index + tests_and_line_numbers[i][:line_number] = source_index + 1 + break + end + end + end + + return tests_and_line_numbers + end + + def find_includes(input_file) + input_file.rewind + includes = [] + input_file.readlines.each do |line| + scan_results = line.scan(/^\s*#include\s+\"\s*(.+)\.[hH]\s*\"/) + includes << scan_results[0][0] if (scan_results.size > 0) + end + return includes + end + + def find_mocks(includes) + mock_headers = [] + includes.each do |include_file| + mock_headers << File.basename(include_file) if (include_file =~ /^mock/i) + end + return mock_headers + end + + def create_header(output, mocks) + output.puts('/* AUTOGENERATED FILE. DO NOT EDIT. */') + create_runtest(output, mocks) + output.puts("\n//=======Automagically Detected Files To Include=====") + output.puts("#include \"#{@options[:framework].to_s}.h\"") + output.puts('#include "cmock.h"') unless (mocks.empty?) + @options[:includes].flatten.uniq.compact.each do |inc| + output.puts("#include #{inc.include?('<') ? inc : "\"#{inc.gsub('.h','')}.h\""}") + end + output.puts('#include ') + output.puts('#include ') + output.puts('#include "CException.h"') if @options[:plugins].include?(:cexception) + mocks.each do |mock| + output.puts("#include \"#{mock.gsub('.h','')}.h\"") + end + if @options[:enforce_strict_ordering] + output.puts('') + output.puts('int GlobalExpectCount;') + output.puts('int GlobalVerifyOrder;') + output.puts('char* GlobalOrderError;') + end + end + + def create_externs(output, tests, mocks) + output.puts("\n//=======External Functions This Runner Calls=====") + output.puts("extern void setUp(void);") + output.puts("extern void tearDown(void);") + tests.each do |test| + output.puts("extern void #{test[:name]}(#{test[:call]});") + end + output.puts('') + end + + def create_mock_management(output, mocks) + unless (mocks.empty?) + output.puts("\n//=======Mock Management=====") + output.puts("static void CMock_Init(void)") + output.puts("{") + if @options[:enforce_strict_ordering] + output.puts(" GlobalExpectCount = 0;") + output.puts(" GlobalVerifyOrder = 0;") + output.puts(" GlobalOrderError = NULL;") + end + mocks.each do |mock| + output.puts(" #{mock}_Init();") + end + output.puts("}\n") + + output.puts("static void CMock_Verify(void)") + output.puts("{") + mocks.each do |mock| + output.puts(" #{mock}_Verify();") + end + output.puts("}\n") + + output.puts("static void CMock_Destroy(void)") + output.puts("{") + mocks.each do |mock| + output.puts(" #{mock}_Destroy();") + end + output.puts("}\n") + end + end + + def create_suite_setup_and_teardown(output) + unless (@options[:suite_setup].nil?) + output.puts("\n//=======Suite Setup=====") + output.puts("static int suite_setup(void)") + output.puts("{") + output.puts(@options[:suite_setup]) + output.puts("}") + end + unless (@options[:suite_teardown].nil?) + output.puts("\n//=======Suite Teardown=====") + output.puts("static int suite_teardown(int num_failures)") + output.puts("{") + output.puts(@options[:suite_teardown]) + output.puts("}") + end + end + + def create_runtest(output, used_mocks) + cexception = @options[:plugins].include? :cexception + va_args1 = @options[:use_param_tests] ? ', ...' : '' + va_args2 = @options[:use_param_tests] ? '__VA_ARGS__' : '' + output.puts("\n//=======Test Runner Used To Run Each Test Below=====") + output.puts("#define RUN_TEST_NO_ARGS") if @options[:use_param_tests] + output.puts("#define RUN_TEST(TestFunc, TestLineNum#{va_args1}) \\") + output.puts("{ \\") + output.puts(" Unity.CurrentTestName = #TestFunc#{va_args2.empty? ? '' : " \"(\" ##{va_args2} \")\""}; \\") + output.puts(" Unity.CurrentTestLineNumber = TestLineNum; \\") + output.puts(" Unity.NumberOfTests++; \\") + output.puts(" if (TEST_PROTECT()) \\") + output.puts(" { \\") + output.puts(" CEXCEPTION_T e; \\") if cexception + output.puts(" Try { \\") if cexception + output.puts(" CMock_Init(); \\") unless (used_mocks.empty?) + output.puts(" setUp(); \\") + output.puts(" TestFunc(#{va_args2}); \\") + output.puts(" CMock_Verify(); \\") unless (used_mocks.empty?) + output.puts(" } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, \"Unhandled Exception!\"); } \\") if cexception + output.puts(" } \\") + output.puts(" CMock_Destroy(); \\") unless (used_mocks.empty?) + output.puts(" if (TEST_PROTECT() && !TEST_IS_IGNORED) \\") + output.puts(" { \\") + output.puts(" tearDown(); \\") + output.puts(" } \\") + output.puts(" UnityConcludeTest(); \\") + output.puts("}\n") + end + + def create_reset(output, used_mocks) + output.puts("\n//=======Test Reset Option=====") + output.puts("void resetTest()") + output.puts("{") + output.puts(" CMock_Verify();") unless (used_mocks.empty?) + output.puts(" CMock_Destroy();") unless (used_mocks.empty?) + output.puts(" tearDown();") + output.puts(" CMock_Init();") unless (used_mocks.empty?) + output.puts(" setUp();") + output.puts("}") + end + + def create_main(output, filename, tests) + output.puts("\n\n//=======MAIN=====") + output.puts("int main(void)") + output.puts("{") + output.puts(" suite_setup();") unless @options[:suite_setup].nil? + output.puts(" Unity.TestFile = \"#{filename}\";") + output.puts(" UnityBegin();") + if (@options[:use_param_tests]) + tests.each do |test| + if ((test[:args].nil?) or (test[:args].empty?)) + output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]}, RUN_TEST_NO_ARGS);") + else + test[:args].each {|args| output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]}, #{args});")} + end + end + else + tests.each { |test| output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]});") } + end + output.puts() + output.puts(" return #{@options[:suite_teardown].nil? ? "" : "suite_teardown"}(UnityEnd());") + output.puts("}") + end +end + + +if ($0 == __FILE__) + options = { :includes => [] } + yaml_file = nil + + #parse out all the options first + ARGV.reject! do |arg| + case(arg) + when '-cexception' + options[:plugins] = [:cexception]; true + when /\.*\.yml/ + options = UnityTestRunnerGenerator.grab_config(arg); true + else false + end + end + + #make sure there is at least one parameter left (the input file) + if !ARGV[0] + puts ["usage: ruby #{__FILE__} (yaml) (options) input_test_file output_test_runner (includes)", + " blah.yml - will use config options in the yml file (see docs)", + " -cexception - include cexception support"].join("\n") + exit 1 + end + + #create the default test runner name if not specified + ARGV[1] = ARGV[0].gsub(".c","_Runner.c") if (!ARGV[1]) + + #everything else is an include file + options[:includes] ||= (ARGV.slice(2..-1).flatten.compact) if (ARGV.size > 2) + + UnityTestRunnerGenerator.new(options).run(ARGV[0], ARGV[1]) +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/auto/test_file_filter.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/auto/test_file_filter.rb new file mode 100644 index 0000000..3dbc26a --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/auto/test_file_filter.rb @@ -0,0 +1,23 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require'yaml' + +module RakefileHelpers + class TestFileFilter + def initialize(all_files = false) + @all_files = all_files + if not @all_files == true + if File.exist?('test_file_filter.yml') + filters = YAML.load_file( 'test_file_filter.yml' ) + @all_files, @only_files, @exclude_files = + filters[:all_files], filters[:only_files], filters[:exclude_files] + end + end + end + attr_accessor :all_files, :only_files, :exclude_files + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/auto/unity_test_summary.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/auto/unity_test_summary.rb new file mode 100644 index 0000000..69ec2e8 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/auto/unity_test_summary.rb @@ -0,0 +1,126 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +#!/usr/bin/ruby +# +# unity_test_summary.rb +# +require 'fileutils' +require 'set' + +class UnityTestSummary + include FileUtils::Verbose + + attr_reader :report, :total_tests, :failures, :ignored + + def initialize + @report = '' + @total_tests = 0 + @failures = 0 + @ignored = 0 + end + + def run + # Clean up result file names + results = @targets.map {|target| target.gsub(/\\/,'/')} + + # Dig through each result file, looking for details on pass/fail: + failure_output = [] + ignore_output = [] + + results.each do |result_file| + lines = File.readlines(result_file).map { |line| line.chomp } + if lines.length == 0 + raise "Empty test result file: #{result_file}" + else + output = get_details(result_file, lines) + failure_output << output[:failures] unless output[:failures].empty? + ignore_output << output[:ignores] unless output[:ignores].empty? + tests,failures,ignored = parse_test_summary(lines) + @total_tests += tests + @failures += failures + @ignored += ignored + end + end + + if @ignored > 0 + @report += "\n" + @report += "--------------------------\n" + @report += "UNITY IGNORED TEST SUMMARY\n" + @report += "--------------------------\n" + @report += ignore_output.flatten.join("\n") + end + + if @failures > 0 + @report += "\n" + @report += "--------------------------\n" + @report += "UNITY FAILED TEST SUMMARY\n" + @report += "--------------------------\n" + @report += failure_output.flatten.join("\n") + end + + @report += "\n" + @report += "--------------------------\n" + @report += "OVERALL UNITY TEST SUMMARY\n" + @report += "--------------------------\n" + @report += "#{@total_tests} TOTAL TESTS #{@failures} TOTAL FAILURES #{@ignored} IGNORED\n" + @report += "\n" + end + + def set_targets(target_array) + @targets = target_array + end + + def set_root_path(path) + @root = path + end + + def usage(err_msg=nil) + puts err_msg if err_msg + puts "Usage: unity_test_summary.rb" + exit 1 + end + + protected + + @@targets=nil + @@path=nil + @@root=nil + + def get_details(result_file, lines) + results = { :failures => [], :ignores => [], :successes => [] } + lines.each do |line| + src_file,src_line,test_name,status,msg = line.split(/:/) + line_out = ((@root and (@root != 0)) ? "#{@root}#{line}" : line ).gsub(/\//, "\\") + case(status) + when 'IGNORE' then results[:ignores] << line_out + when 'FAIL' then results[:failures] << line_out + when 'PASS' then results[:successes] << line_out + end + end + return results + end + + def parse_test_summary(summary) + if summary[-3..-1].join("\n") =~ /(\d+) Tests (\d+) Failures (\d+) Ignored/ + [$1.to_i,$2.to_i,$3.to_i] + else + raise "Couldn't parse test results: #{summary}" + end + end + + def here; File.expand_path(File.dirname(__FILE__)); end + +end + +if $0 == __FILE__ + script = UnityTestSummary.new + begin + script.run + rescue Exception => e + script.usage e.message + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/docs/Unity Summary.odt b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/docs/Unity Summary.odt new file mode 100644 index 0000000..f699661 Binary files /dev/null and b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/docs/Unity Summary.odt differ diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/docs/Unity Summary.pdf b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/docs/Unity Summary.pdf new file mode 100644 index 0000000..ad1a956 Binary files /dev/null and b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/docs/Unity Summary.pdf differ diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/docs/Unity Summary.txt b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/docs/Unity Summary.txt new file mode 100644 index 0000000..e0b179d --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/docs/Unity Summary.txt @@ -0,0 +1,217 @@ +============== +Unity Test API +============== + +[Copyright (c) 2007 - Unity Project by Mike Karlesky, Mark VanderVoord, and Greg Williams] + +------------- +Running Tests +------------- + +RUN_TEST(func, linenum) + +Each Test is run within the macro RUN_TEST. This macro performs necessary setup before the test is called and handles cleanup and result tabulation afterwards. + +-------------- +Ignoring Tests +-------------- + +There are times when a test is incomplete or not valid for some reason. At these times, TEST_IGNORE can be called. Control will immediately be returned to the caller of the test, and no failures will be returned. + +TEST_IGNORE() + +Ignore this test and return immediately + +TEST_IGNORE_MESSAGE (message) + +Ignore this test and return immediately. Output a message stating why the test was ignored. + +-------------- +Aborting Tests +-------------- + +There are times when a test will contain an infinite loop on error conditions, or there may be reason to escape from the test early without executing the rest of the test. A pair of macros support this functionality in Unity. The first (TEST_PROTECT) sets up the feature, and handles emergency abort cases. TEST_ABORT can then be used at any time within the tests to return to the last TEST_PROTECT call. + +TEST_PROTECT() + +Setup and Catch macro + +TEST_ABORT() + +Abort Test macro + +Example: + +main() +{ + if (TEST_PROTECT() == 0) + { + MyTest(); + } +} + +If MyTest calls TEST_ABORT, program control will immediately return to TEST_PROTECT with a non-zero return value. + + +======================= +Unity Assertion Summary +======================= + +-------------------- +Basic Validity Tests +-------------------- + +TEST_ASSERT_TRUE(condition) + +Evaluates whatever code is in condition and fails if it evaluates to false + +TEST_ASSERT_FALSE(condition) + +Evaluates whatever code is in condition and fails if it evaluates to true + +TEST_ASSERT(condition) + +Another way of calling TEST_ASSERT_TRUE + +TEST_ASSERT_UNLESS(condition) + +Another way of calling TEST_ASSERT_FALSE + +TEST_FAIL() +TEST_FAIL_MESSAGE(message) + +This test is automatically marked as a failure. The message is output stating why. + +------------------------------ +Numerical Assertions: Integers +------------------------------ + +TEST_ASSERT_EQUAL_INT(expected, actual) +TEST_ASSERT_EQUAL_INT8(expected, actual) +TEST_ASSERT_EQUAL_INT16(expected, actual) +TEST_ASSERT_EQUAL_INT32(expected, actual) +TEST_ASSERT_EQUAL_INT64(expected, actual) + +Compare two integers for equality and display errors as signed integers. A cast will be performed +to your natural integer size so often this can just be used. When you need to specify the exact size, +like when comparing arrays, you can use a specific version: + + + +TEST_ASSERT_EQUAL_UINT(expected, actual) + +Compare two integers for equality and display errors as unsigned integers. Like INT, there are +variants for different sizes also. + + + +TEST_ASSERT_EQUAL_HEX(expected, actual) + +Compares two integers for equality and display errors as hexadecimal. Like the other integer comparisons, +you can specify the size... here the size will also effect how many nibbles are shown (for example, HEX16 +will show 4 nibbles). + +_ARRAY + +You can append _ARRAY to any of these macros to make an array comparison of that type. Here you will +need to care a bit more about the actual size of the value being checked. You will also specify an +additional argument which is the number of elements to compare. For example: + +TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, elements) + + +TEST_ASSERT_EQUAL(expected, actual) + +Another way of calling TEST_ASSERT_EQUAL_INT + + + +TEST_ASSERT_INT_WITHIN(delta, expected, actual) + +Asserts that the actual value is within plus or minus delta of the expected value. This also comes in +size specific variants. + + +----------------------------- +Numerical Assertions: Bitwise +----------------------------- + +TEST_ASSERT_BITS(mask, expected, actual) + +Use an integer mask to specify which bits should be compared between two other integers. High bits in the mask are compared, low bits ignored. + +TEST_ASSERT_BITS_HIGH(mask, actual) + +Use an integer mask to specify which bits should be inspected to determine if they are all set high. High bits in the mask are compared, low bits ignored. + +TEST_ASSERT_BITS_LOW(mask, actual) + +Use an integer mask to specify which bits should be inspected to determine if they are all set low. High bits in the mask are compared, low bits ignored. + +TEST_ASSERT_BIT_HIGH(bit, actual) + +Test a single bit and verify that it is high. The bit is specified 0-31 for a 32-bit integer. + +TEST_ASSERT_BIT_LOW(bit, actual) + +Test a single bit and verify that it is low. The bit is specified 0-31 for a 32-bit integer. + +---------------------------- +Numerical Assertions: Floats +---------------------------- + +TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual) + +Asserts that the actual value is within plus or minus delta of the expected value. + +TEST_ASSERT_EQUAL_FLOAT(expected, actual) + +Asserts that two floating point values are "equal" within a small % delta of the expected value. + +----------------- +String Assertions +----------------- + +TEST_ASSERT_EQUAL_STRING(expected, actual) + +Compare two null-terminate strings. Fail if any character is different or if the lengths are different. + +TEST_ASSERT_EQUAL_STRING_MESSAGE(expected, actual, message) + +Compare two null-terminate strings. Fail if any character is different or if the lengths are different. Output a custom message on failure. + +------------------ +Pointer Assertions +------------------ + +Most pointer operations can be performed by simply using the integer comparisons above. However, a couple of special cases are added for clarity. + +TEST_ASSERT_NULL(pointer) + +Fails if the pointer is not equal to NULL + +TEST_ASSERT_NOT_NULL(pointer) + +Fails if the pointer is equal to NULL + + +----------------- +Memory Assertions +----------------- + +TEST_ASSERT_EQUAL_MEMORY(expected, actual, len) + +Compare two blocks of memory. This is a good generic assertion for types that can't be coerced into acting like +standard types... but since it's a memory compare, you have to be careful that your data types are packed. + +-------- +_MESSAGE +-------- + +you can append _MESSAGE to any of the macros to make them take an additional argument. This argument +is a string that will be printed at the end of the failure strings. This is useful for specifying more +information about the problem. + + + + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/docs/license.txt b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/docs/license.txt new file mode 100644 index 0000000..c42e330 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/docs/license.txt @@ -0,0 +1,31 @@ + Copyright (c) 2007-2010 Mike Karlesky, Mark VanderVoord, Greg Williams + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + The end-user documentation included with the redistribution, if + any, must include the following acknowledgment: "This product + includes software developed for the Unity Project, by Mike Karlesky, + Mark VanderVoord, and Greg Williams and other contributors", in + the same place and form as other third-party acknowledgments. + Alternately, this acknowledgment may appear in the software + itself, in the same form and location as other such third-party + acknowledgments. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/examples/helper/UnityHelper.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/examples/helper/UnityHelper.c new file mode 100644 index 0000000..9cf42c6 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/examples/helper/UnityHelper.c @@ -0,0 +1,10 @@ +#include "unity.h" +#include "UnityHelper.h" +#include +#include + +void AssertEqualExampleStruct(const EXAMPLE_STRUCT_T expected, const EXAMPLE_STRUCT_T actual, const unsigned short line) +{ + UNITY_TEST_ASSERT_EQUAL_INT(expected.x, actual.x, line, "Example Struct Failed For Field x"); + UNITY_TEST_ASSERT_EQUAL_INT(expected.y, actual.y, line, "Example Struct Failed For Field y"); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/examples/helper/UnityHelper.h b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/examples/helper/UnityHelper.h new file mode 100644 index 0000000..1516111 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/examples/helper/UnityHelper.h @@ -0,0 +1,12 @@ +#ifndef _TESTHELPER_H +#define _TESTHELPER_H + +#include "Types.h" + +void AssertEqualExampleStruct(const EXAMPLE_STRUCT_T expected, const EXAMPLE_STRUCT_T actual, const unsigned short line); + +#define UNITY_TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(expected, actual, line, message) AssertEqualExampleStruct(expected, actual, line); + +#define TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(expected, actual) UNITY_TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(expected, actual, __LINE__, NULL); + +#endif // _TESTHELPER_H diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/examples/makefile b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/examples/makefile new file mode 100644 index 0000000..723d390 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/examples/makefile @@ -0,0 +1,40 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +C_COMPILER=gcc +TARGET_BASE1=test1 +TARGET_BASE2=test2 +ifeq ($(OS),Windows_NT) + TARGET_EXTENSION=.exe +else + TARGET_EXTENSION=.out +endif +TARGET1 = $(TARGET_BASE1)$(TARGET_EXTENSION) +TARGET2 = $(TARGET_BASE2)$(TARGET_EXTENSION) +SRC_FILES1=../src/unity.c src/ProductionCode.c test/TestProductionCode.c test/no_ruby/TestProductionCode_Runner.c +SRC_FILES2=../src/unity.c src/ProductionCode2.c test/TestProductionCode2.c test/no_ruby/TestProductionCode2_Runner.c +INC_DIRS=-Isrc -I../src +SYMBOLS=-DTEST + +ifeq ($(OS),Windows_NT) + CLEANUP = del /F /Q build\* && del /F /Q $(TARGET1) && del /F /Q $(TARGET2) +else + CLEANUP = rm -f build/*.o ; rm -f $(TARGET1) ; rm -f $(TARGET2) +endif + +all: clean default + +default: +# ruby auto/generate_test_runner.rb test/TestProductionCode.c test/no_ruby/TestProductionCode_Runner.c +# ruby auto/generate_test_runner.rb test/TestProductionCode2.c test/no_ruby/TestProductionCode2_Runner.c + $(C_COMPILER) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES1) -o $(TARGET1) + $(C_COMPILER) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES2) -o $(TARGET2) + $(TARGET1) + $(TARGET2) + +clean: + $(CLEANUP) + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/examples/rakefile.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/examples/rakefile.rb new file mode 100644 index 0000000..0905b4b --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/examples/rakefile.rb @@ -0,0 +1,32 @@ +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require HERE+'rakefile_helper' + +include RakefileHelpers + +# Load default configuration, for now +DEFAULT_CONFIG_FILE = 'gcc.yml' +configure_toolchain(DEFAULT_CONFIG_FILE) + +task :unit do + run_tests get_unit_test_files +end + +desc "Generate test summary" +task :summary do + report_summary +end + +desc "Build and test Unity" +task :all => [:clean, :unit, :summary] +task :default => [:clobber, :all] +task :ci => [:default] +task :cruise => [:default] + +desc "Load configuration" +task :config, :config_file do |t, args| + configure_toolchain(args[:config_file]) +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/examples/rakefile_helper.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/examples/rakefile_helper.rb new file mode 100644 index 0000000..0127d69 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/examples/rakefile_helper.rb @@ -0,0 +1,260 @@ +require 'yaml' +require 'fileutils' +require HERE+'../auto/unity_test_summary' +require HERE+'../auto/generate_test_runner' +require HERE+'../auto/colour_reporter' + +module RakefileHelpers + + C_EXTENSION = '.c' + + def load_configuration(config_file) + $cfg_file = "../targets/#{config_file}" + $cfg = YAML.load(File.read($cfg_file)) + end + + def configure_clean + CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil? + end + + def configure_toolchain(config_file=DEFAULT_CONFIG_FILE) + config_file += '.yml' unless config_file =~ /\.yml$/ + load_configuration('../targets/'+config_file) + configure_clean + end + + def get_unit_test_files + path = $cfg['compiler']['unit_tests_path'] + 'Test*' + C_EXTENSION + path.gsub!(/\\/, '/') + FileList.new(path) + end + + def get_local_include_dirs + include_dirs = $cfg['compiler']['includes']['items'].dup + include_dirs.delete_if {|dir| dir.is_a?(Array)} + return include_dirs + end + + def extract_headers(filename) + includes = [] + lines = File.readlines(filename) + lines.each do |line| + m = line.match(/^\s*#include\s+\"\s*(.+\.[hH])\s*\"/) + if not m.nil? + includes << m[1] + end + end + return includes + end + + def find_source_file(header, paths) + paths.each do |dir| + src_file = dir + header.ext(C_EXTENSION) + if (File.exists?(src_file)) + return src_file + end + end + return nil + end + + def tackit(strings) + if strings.is_a?(Array) + result = "\"#{strings.join}\"" + else + result = strings + end + return result + end + + def squash(prefix, items) + result = '' + items.each { |item| result += " #{prefix}#{tackit(item)}" } + return result + end + + def build_compiler_fields + command = tackit($cfg['compiler']['path']) + if $cfg['compiler']['defines']['items'].nil? + defines = '' + else + defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items']) + end + options = squash('', $cfg['compiler']['options']) + includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :defines => defines, :options => options, :includes => includes} + end + + def compile(file, defines=[]) + compiler = build_compiler_fields + cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{file} " + + "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" + + "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" + execute(cmd_str) + end + + def build_linker_fields + command = tackit($cfg['linker']['path']) + if $cfg['linker']['options'].nil? + options = '' + else + options = squash('', $cfg['linker']['options']) + end + if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?) + includes = '' + else + includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) + end + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :options => options, :includes => includes} + end + + def link(exe_name, obj_list) + linker = build_linker_fields + cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + + (obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).join + + $cfg['linker']['bin_files']['prefix'] + ' ' + + $cfg['linker']['bin_files']['destination'] + + exe_name + $cfg['linker']['bin_files']['extension'] + execute(cmd_str) + end + + def build_simulator_fields + return nil if $cfg['simulator'].nil? + if $cfg['simulator']['path'].nil? + command = '' + else + command = (tackit($cfg['simulator']['path']) + ' ') + end + if $cfg['simulator']['pre_support'].nil? + pre_support = '' + else + pre_support = squash('', $cfg['simulator']['pre_support']) + end + if $cfg['simulator']['post_support'].nil? + post_support = '' + else + post_support = squash('', $cfg['simulator']['post_support']) + end + return {:command => command, :pre_support => pre_support, :post_support => post_support} + end + + def execute(command_string, verbose=true, raise_on_fail=true) + report command_string + output = `#{command_string}`.chomp + report(output) if (verbose && !output.nil? && (output.length > 0)) + if (($?.exitstatus != 0) and (raise_on_fail)) + raise "Command failed. (Returned #{$?.exitstatus})" + end + return output + end + + def report_summary + summary = UnityTestSummary.new + summary.set_root_path(HERE) + results_glob = "#{$cfg['compiler']['build_path']}*.test*" + results_glob.gsub!(/\\/, '/') + results = Dir[results_glob] + summary.set_targets(results) + summary.run + fail_out "FAIL: There were failures" if (summary.failures > 0) + end + + def run_tests(test_files) + + report 'Running system tests...' + + # Tack on TEST define for compiling unit tests + load_configuration($cfg_file) + test_defines = ['TEST'] + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + $cfg['compiler']['defines']['items'] << 'TEST' + + include_dirs = get_local_include_dirs + + # Build and execute each unit test + test_files.each do |test| + obj_list = [] + + # Detect dependencies and build required required modules + extract_headers(test).each do |header| + # Compile corresponding source file if it exists + src_file = find_source_file(header, include_dirs) + if !src_file.nil? + compile(src_file, test_defines) + obj_list << header.ext($cfg['compiler']['object_files']['extension']) + end + end + + # Build the test runner (generate if configured to do so) + test_base = File.basename(test, C_EXTENSION) + runner_name = test_base + '_Runner.c' + if $cfg['compiler']['runner_path'].nil? + runner_path = $cfg['compiler']['build_path'] + runner_name + test_gen = UnityTestRunnerGenerator.new($cfg_file) + test_gen.run(test, runner_path) + else + runner_path = $cfg['compiler']['runner_path'] + runner_name + end + + compile(runner_path, test_defines) + obj_list << runner_name.ext($cfg['compiler']['object_files']['extension']) + + # Build the test module + compile(test, test_defines) + obj_list << test_base.ext($cfg['compiler']['object_files']['extension']) + + # Link the test executable + link(test_base, obj_list) + + # Execute unit test and generate results file + simulator = build_simulator_fields + executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] + if simulator.nil? + cmd_str = executable + else + cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" + end + output = execute(cmd_str, true, false) + test_results = $cfg['compiler']['build_path'] + test_base + if output.match(/OK$/m).nil? + test_results += '.testfail' + else + test_results += '.testpass' + end + File.open(test_results, 'w') { |f| f.print output } + end + end + + def build_application(main) + + report "Building application..." + + obj_list = [] + load_configuration($cfg_file) + main_path = $cfg['compiler']['source_path'] + main + C_EXTENSION + + # Detect dependencies and build required required modules + include_dirs = get_local_include_dirs + extract_headers(main_path).each do |header| + src_file = find_source_file(header, include_dirs) + if !src_file.nil? + compile(src_file) + obj_list << header.ext($cfg['compiler']['object_files']['extension']) + end + end + + # Build the main source file + main_base = File.basename(main_path, C_EXTENSION) + compile(main_path) + obj_list << main_base.ext($cfg['compiler']['object_files']['extension']) + + # Create the executable + link(main_base, obj_list) + end + + def fail_out(msg) + puts msg + exit(-1) + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/examples/readme.txt b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/examples/readme.txt new file mode 100644 index 0000000..6c7780e --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/examples/readme.txt @@ -0,0 +1,18 @@ +Example Project + +This example project gives an example of some passing, ignored, and failing tests. +It's simple and meant for you to look over and get an idea for what all of this stuff does. + +You can build and test using the makefile if you have gcc installed (you may need to tweak +the locations of some tools in the makefile). Otherwise, the rake version will let you +test with gcc or a couple versions of IAR. You can tweak the yaml files to get those versions +running. + +Ruby is required if you're using the rake version (obviously). This version shows off most of +Unity's advanced features (automatically creating test runners, fancy summaries, etc.) + +The makefile version doesn't require anything outside of your normal build tools, but won't do the +extras for you. So that you can test right away, we've written the test runners for you and +put them in the test\no_ruby subdirectory. If you make changes to the tests or source, you might +need to update these (like when you add or remove tests). Do that for a while and you'll learn +why you really want to start using the Ruby tools. \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/examples/src/ProductionCode.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/examples/src/ProductionCode.c new file mode 100644 index 0000000..500b44b --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/examples/src/ProductionCode.c @@ -0,0 +1,24 @@ + +#include "ProductionCode.h" + +int Counter = 0; +int NumbersToFind[9] = { 0, 34, 55, 66, 32, 11, 1, 77, 888 }; //some obnoxious array to search that is 1-based indexing instead of 0. + +// This function is supposed to search through NumbersToFind and find a particular number. +// If it finds it, the index is returned. Otherwise 0 is returned which sorta makes sense since +// NumbersToFind is indexed from 1. Unfortunately it's broken +// (and should therefore be caught by our tests) +int FindFunction_WhichIsBroken(int NumberToFind) +{ + int i = 0; + while (i <= 8) //Notice I should have been in braces + i++; + if (NumbersToFind[i] == NumberToFind) //Yikes! I'm getting run after the loop finishes instead of during it! + return i; + return 0; +} + +int FunctionWhichReturnsLocalVariable(void) +{ + return Counter; +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/examples/src/ProductionCode.h b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/examples/src/ProductionCode.h new file mode 100644 index 0000000..250ca0d --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/examples/src/ProductionCode.h @@ -0,0 +1,3 @@ + +int FindFunction_WhichIsBroken(int NumberToFind); +int FunctionWhichReturnsLocalVariable(void); diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/examples/src/ProductionCode2.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/examples/src/ProductionCode2.c new file mode 100644 index 0000000..a8c72e1 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/examples/src/ProductionCode2.c @@ -0,0 +1,9 @@ + +#include "ProductionCode2.h" + +char* ThisFunctionHasNotBeenTested(int Poor, char* LittleFunction) +{ + //Since There Are No Tests Yet, This Function Could Be Empty For All We Know. + // Which isn't terribly useful... but at least we put in a TEST_IGNORE so we won't forget + return (char*)0; +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/examples/src/ProductionCode2.h b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/examples/src/ProductionCode2.h new file mode 100644 index 0000000..34ae980 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/examples/src/ProductionCode2.h @@ -0,0 +1,2 @@ + +char* ThisFunctionHasNotBeenTested(int Poor, char* LittleFunction); diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/examples/test/TestProductionCode.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/examples/test/TestProductionCode.c new file mode 100644 index 0000000..28a5581 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/examples/test/TestProductionCode.c @@ -0,0 +1,62 @@ + +#include "ProductionCode.h" +#include "unity.h" + +//sometimes you may want to get at local data in a module. +//for example: If you plan to pass by reference, this could be useful +//however, it should often be avoided +extern int Counter; + +void setUp(void) +{ + //This is run before EACH TEST + Counter = 0x5a5a; +} + +void tearDown(void) +{ +} + +void test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode(void) +{ + //All of these should pass + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(78)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(1)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(33)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(999)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(-1)); +} + +void test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken(void) +{ + // You should see this line fail in your test summary + TEST_ASSERT_EQUAL(1, FindFunction_WhichIsBroken(34)); + + // Notice the rest of these didn't get a chance to run because the line above failed. + // Unit tests abort each test function on the first sign of trouble. + // Then NEXT test function runs as normal. + TEST_ASSERT_EQUAL(8, FindFunction_WhichIsBroken(8888)); +} + +void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue(void) +{ + //This should be true because setUp set this up for us before this test + TEST_ASSERT_EQUAL_HEX(0x5a5a, FunctionWhichReturnsLocalVariable()); + + //This should be true because we can still change our answer + Counter = 0x1234; + TEST_ASSERT_EQUAL_HEX(0x1234, FunctionWhichReturnsLocalVariable()); +} + +void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain(void) +{ + //This should be true again because setup was rerun before this test (and after we changed it to 0x1234) + TEST_ASSERT_EQUAL_HEX(0x5a5a, FunctionWhichReturnsLocalVariable()); +} + +void test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed(void) +{ + //Sometimes you get the test wrong. When that happens, you get a failure too... and a quick look should tell + // you what actually happened...which in this case was a failure to setup the initial condition. + TEST_ASSERT_EQUAL_HEX(0x1234, FunctionWhichReturnsLocalVariable()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/examples/test/TestProductionCode2.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/examples/test/TestProductionCode2.c new file mode 100644 index 0000000..20c9251 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/examples/test/TestProductionCode2.c @@ -0,0 +1,26 @@ + +#include "ProductionCode2.h" +#include "unity.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void test_IgnoredTest(void) +{ + TEST_IGNORE_MESSAGE("This Test Was Ignored On Purpose"); +} + +void test_AnotherIgnoredTest(void) +{ + TEST_IGNORE_MESSAGE("These Can Be Useful For Leaving Yourself Notes On What You Need To Do Yet"); +} + +void test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented(void) +{ + TEST_IGNORE(); //Like This +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/examples/test/no_ruby/TestProductionCode2_Runner.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/examples/test/no_ruby/TestProductionCode2_Runner.c new file mode 100644 index 0000000..56515ae --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/examples/test/no_ruby/TestProductionCode2_Runner.c @@ -0,0 +1,46 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ +#include "unity.h" +#include +#include + +char MessageBuffer[50]; + +extern void setUp(void); +extern void tearDown(void); + +extern void test_IgnoredTest(void); +extern void test_AnotherIgnoredTest(void); +extern void test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented(void); + +static void runTest(UnityTestFunction test) +{ + if (TEST_PROTECT()) + { + setUp(); + test(); + } + if (TEST_PROTECT() && !TEST_IS_IGNORED) + { + tearDown(); + } +} +void resetTest() +{ + tearDown(); + setUp(); +} + + +int main(void) +{ + Unity.TestFile = "test/TestProductionCode2.c"; + UnityBegin(); + + // RUN_TEST calls runTest + RUN_TEST(test_IgnoredTest, 13); + RUN_TEST(test_AnotherIgnoredTest, 18); + RUN_TEST(test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented, 23); + + UnityEnd(); + return 0; +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/examples/test/no_ruby/TestProductionCode_Runner.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/examples/test/no_ruby/TestProductionCode_Runner.c new file mode 100644 index 0000000..64112f3 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/examples/test/no_ruby/TestProductionCode_Runner.c @@ -0,0 +1,50 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ +#include "unity.h" +#include +#include + +char MessageBuffer[50]; + +extern void setUp(void); +extern void tearDown(void); + +extern void test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode(void); +extern void test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken(void); +extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue(void); +extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain(void); +extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed(void); + +static void runTest(UnityTestFunction test) +{ + if (TEST_PROTECT()) + { + setUp(); + test(); + } + if (TEST_PROTECT() && !TEST_IS_IGNORED) + { + tearDown(); + } +} +void resetTest() +{ + tearDown(); + setUp(); +} + + +int main(void) +{ + Unity.TestFile = "test/TestProductionCode.c"; + UnityBegin(); + + // RUN_TEST calls runTest + RUN_TEST(test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode, 20); + RUN_TEST(test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken, 30); + RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue, 41); + RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain, 51); + RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed, 57); + + UnityEnd(); + return 0; +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/build/MakefileWorker.mk b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/build/MakefileWorker.mk new file mode 100644 index 0000000..9948751 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/build/MakefileWorker.mk @@ -0,0 +1,331 @@ +#--------- +# +# MakefileWorker.mk +# +# Include this helper file in your makefile +# It makes +# A static library holding the application objs +# A test executable +# +# See this example for parameter settings +# examples/Makefile +# +#---------- +# Inputs - these variables describe what to build +# +# INCLUDE_DIRS - Directories used to search for include files. +# This generates a -I for each directory +# SRC_DIRS - Directories containing source file to built into the library +# SRC_FILES - Specific source files to build into library. Helpful when not all code +# in a directory can be built for test (hopefully a temporary situation) +# TEST_SRC_DIRS - Directories containing unit test code build into the unit test runner +# These do not go in a library. They are explicitly included in the test runner +# MOCKS_SRC_DIRS - Directories containing mock source files to build into the test runner +# These do not go in a library. They are explicitly included in the test runner +#---------- +# You can adjust these variables to influence how to build the test target +# and where to put and name outputs +# See below to determine defaults +# COMPONENT_NAME - the name of the thing being built +# UNITY_HOME - where Unity home dir found +# UNITY_BUILD_HOME - place for scripts +# UNITY_OBJS_DIR - a directory where o and d files go +# UNITY_LIB_DIR - a directory where libs go +# UNITY_ENABLE_DEBUG - build for debug +# UNITY_USE_MEM_LEAK_DETECTION - Links with overridden new and delete +# UNITY_USE_STD_CPP_LIB - Set to N to keep the standard C++ library out +# of the test harness +# UNITY_USE_GCOV - Turn on coverage analysis +# Clean then build with this flag set to Y, then 'make gcov' +# UNITY_TEST_RUNNER_FLAGS +# None by default +# UNITY_MAPFILE - generate a map file +# UNITY_WARNINGFLAGS - overly picky by default +# OTHER_MAKEFILE_TO_INCLUDE - a hook to use this makefile to make +# other targets. Like CSlim, which is part of fitnesse +#---------- +# +# Other flags users can initialize to sneak in their settings +# UNITY_CFLAGS - C complier +# UNITY_LDFLAGS - Linker flags +#---------- + + +ifndef COMPONENT_NAME + COMPONENT_NAME = name_this_in_the_makefile +endif + +# Debug on by default +ifndef UNITY_ENABLE_DEBUG + UNITY_ENABLE_DEBUG = Y +endif + +# new and delete for memory leak detection on by default +ifndef UNITY_USE_MEM_LEAK_DETECTION + UNITY_USE_MEM_LEAK_DETECTION = Y +endif + +# Use gcov, off by default +ifndef UNITY_USE_GCOV + UNITY_USE_GCOV = N +endif + +# Default warnings +ifndef UNITY_WARNINGFLAGS + UNITY_WARNINGFLAGS = -Wall -Werror -Wshadow -Wswitch-default +endif + +# Default dir for temporary files (d, o) +ifndef UNITY_OBJS_DIR + UNITY_OBJS_DIR = objs +endif + +# Default dir for the outout library +ifndef UNITY_LIB_DIR + UNITY_LIB_DIR = lib +endif + +# No map by default +ifndef UNITY_MAP_FILE + UNITY_MAP_FILE = N +endif + +#Not verbose by deafult +ifdef VERBOSE + UNITY_TEST_RUNNER_FLAGS += -v +endif + +ifdef GROUP + UNITY_TEST_RUNNER_FLAGS += -g $(GROUP) +endif + +ifdef NAME + UNITY_TEST_RUNNER_FLAGS += -n $(NAME) +endif + +ifdef REPEAT + UNITY_TEST_RUNNER_FLAGS += -r $(REPEAT) +endif + + +# -------------------------------------- +# derived flags in the following area +# -------------------------------------- +ifeq ($(UNITY_USE_MEM_LEAK_DETECTION), N) + UNITY_CFLAGS += -DUNITY_MEM_LEAK_DETECTION_DISABLED +else + UNITY_MEMLEAK_DETECTOR_MALLOC_MACRO_FILE = -include $(UNITY_HOME)/extras/fixture/src/unity_fixture_malloc_overrides.h +endif + +ifeq ($(UNITY_ENABLE_DEBUG), Y) + UNITY_CFLAGS += -g +endif + +ifeq ($(UNITY_USE_GCOV), Y) + UNITY_CFLAGS += -fprofile-arcs -ftest-coverage +endif + +UNITY_CFLAGS += $(UNITY_MEMLEAK_DETECTOR_MALLOC_MACRO_FILE) + +TARGET_MAP = $(COMPONENT_NAME).map.txt +ifeq ($(UNITY_MAP_FILE), Y) + UNITY_LDFLAGS += -Wl,-map,$(TARGET_MAP) +endif + +LD_LIBRARIES += -lgcov + +TARGET_LIB = \ + $(UNITY_LIB_DIR)/lib$(COMPONENT_NAME).a + +TEST_TARGET = \ + $(COMPONENT_NAME)_tests + +#Helper Functions +get_src_from_dir = $(wildcard $1/*.cpp) $(wildcard $1/*.c) +get_dirs_from_dirspec = $(wildcard $1) +get_src_from_dir_list = $(foreach dir, $1, $(call get_src_from_dir,$(dir))) +__src_to = $(subst .c,$1, $(subst .cpp,$1,$2)) +src_to = $(addprefix $(UNITY_OBJS_DIR)/,$(call __src_to,$1,$2)) +src_to_o = $(call src_to,.o,$1) +src_to_d = $(call src_to,.d,$1) +src_to_gcda = $(call src_to,.gcda,$1) +src_to_gcno = $(call src_to,.gcno,$1) +make_dotdot_a_subdir = $(subst ..,_dot_dot, $1) +time = $(shell date +%s) +delta_t = $(eval minus, $1, $2) +debug_print_list = $(foreach word,$1,echo " $(word)";) echo; + +#Derived +STUFF_TO_CLEAN += $(TEST_TARGET) $(TEST_TARGET).exe $(TARGET_LIB) $(TARGET_MAP) + +SRC += $(call get_src_from_dir_list, $(SRC_DIRS)) $(SRC_FILES) +OBJ = $(call src_to_o,$(SRC)) +OBJ2 = $(call make_dotdot_a_subdir. $(OBJ)) + +STUFF_TO_CLEAN += $(OBJ) + +TEST_SRC = $(call get_src_from_dir_list, $(TEST_SRC_DIRS)) +TEST_OBJS = $(call src_to_o,$(TEST_SRC)) +STUFF_TO_CLEAN += $(TEST_OBJS) + + +MOCKS_SRC = $(call get_src_from_dir_list, $(MOCKS_SRC_DIRS)) +MOCKS_OBJS = $(call src_to_o,$(MOCKS_SRC)) +STUFF_TO_CLEAN += $(MOCKS_OBJS) + +ALL_SRC = $(SRC) $(TEST_SRC) $(MOCKS_SRC) + +#Test coverage with gcov +GCOV_OUTPUT = gcov_output.txt +GCOV_REPORT = gcov_report.txt +GCOV_ERROR = gcov_error.txt +GCOV_GCDA_FILES = $(call src_to_gcda, $(ALL_SRC)) +GCOV_GCNO_FILES = $(call src_to_gcno, $(ALL_SRC)) +TEST_OUTPUT = $(TEST_TARGET).txt +STUFF_TO_CLEAN += \ + $(GCOV_OUTPUT)\ + $(GCOV_REPORT)\ + $(GCOV_REPORT).html\ + $(GCOV_ERROR)\ + $(GCOV_GCDA_FILES)\ + $(GCOV_GCNO_FILES)\ + $(TEST_OUTPUT) + + +#The gcda files for gcov need to be deleted before each run +#To avoid annoying messages. +GCOV_CLEAN = $(SILENCE)rm -f $(GCOV_GCDA_FILES) $(GCOV_OUTPUT) $(GCOV_REPORT) $(GCOV_ERROR) +RUN_TEST_TARGET = $(SILENCE) $(GCOV_CLEAN) ; echo "Running $(TEST_TARGET)"; ./$(TEST_TARGET) $(UNITY_TEST_RUNNER_FLAGS) + +INCLUDES_DIRS_EXPANDED = $(call get_dirs_from_dirspec, $(INCLUDE_DIRS)) +INCLUDES += $(foreach dir, $(INCLUDES_DIRS_EXPANDED), -I$(dir)) +MOCK_DIRS_EXPANDED = $(call get_dirs_from_dirspec, $(MOCKS_SRC_DIRS)) +INCLUDES += $(foreach dir, $(MOCK_DIRS_EXPANDED), -I$(dir)) + + +DEP_FILES = $(call src_to_d, $(ALL_SRC)) +STUFF_TO_CLEAN += $(DEP_FILES) $(PRODUCTION_CODE_START) $(PRODUCTION_CODE_END) +STUFF_TO_CLEAN += $(STDLIB_CODE_START) $(MAP_FILE) cpputest_*.xml junit_run_output + +# We'll use the UNITY_CFLAGS etc so that you can override AND add to the CppUTest flags +CFLAGS = $(UNITY_CFLAGS) $(UNITY_ADDITIONAL_CFLAGS) $(INCLUDES) $(UNITY_WARNINGFLAGS) +LDFLAGS = $(UNITY_LDFLAGS) $(UNITY_ADDITIONAL_LDFLAGS) + +# Targets + +.PHONY: all +all: start $(TEST_TARGET) + $(RUN_TEST_TARGET) + +.PHONY: start +start: $(TEST_TARGET) + $(SILENCE)START_TIME=$(call time) + +.PHONY: all_no_tests +all_no_tests: $(TEST_TARGET) + +.PHONY: flags +flags: + @echo + @echo "Compile C source with CFLAGS:" + @$(call debug_print_list,$(CFLAGS)) + @echo "Link with LDFLAGS:" + @$(call debug_print_list,$(LDFLAGS)) + @echo "Link with LD_LIBRARIES:" + @$(call debug_print_list,$(LD_LIBRARIES)) + @echo "Create libraries with ARFLAGS:" + @$(call debug_print_list,$(ARFLAGS)) + @echo "OBJ files:" + @$(call debug_print_list,$(OBJ2)) + + +$(TEST_TARGET): $(TEST_OBJS) $(MOCKS_OBJS) $(PRODUCTION_CODE_START) $(TARGET_LIB) $(USER_LIBS) $(PRODUCTION_CODE_END) $(STDLIB_CODE_START) + $(SILENCE)echo Linking $@ + $(SILENCE)$(LINK.o) -o $@ $^ $(LD_LIBRARIES) + +$(TARGET_LIB): $(OBJ) + $(SILENCE)echo Building archive $@ + $(SILENCE)mkdir -p lib + $(SILENCE)$(AR) $(ARFLAGS) $@ $^ + $(SILENCE)ranlib $@ + +test: $(TEST_TARGET) + $(RUN_TEST_TARGET) | tee $(TEST_OUTPUT) + +vtest: $(TEST_TARGET) + $(RUN_TEST_TARGET) -v | tee $(TEST_OUTPUT) + +$(UNITY_OBJS_DIR)/%.o: %.cpp + @echo compiling $(notdir $<) + $(SILENCE)mkdir -p $(dir $@) + $(SILENCE)$(COMPILE.cpp) -MMD -MP $(OUTPUT_OPTION) $< + +$(UNITY_OBJS_DIR)/%.o: %.c + @echo compiling $(notdir $<) + $(SILENCE)mkdir -p $(dir $@) + $(SILENCE)$(COMPILE.c) -MMD -MP $(OUTPUT_OPTION) $< + +ifneq "$(MAKECMDGOALS)" "clean" +-include $(DEP_FILES) +endif + +.PHONY: clean +clean: + $(SILENCE)echo Making clean + $(SILENCE)$(RM) $(STUFF_TO_CLEAN) + $(SILENCE)rm -rf gcov $(UNITY_OBJS_DIR) + $(SILENCE)find . -name "*.gcno" | xargs rm -f + $(SILENCE)find . -name "*.gcda" | xargs rm -f + +#realclean gets rid of all gcov, o and d files in the directory tree +#not just the ones made by this makefile +.PHONY: realclean +realclean: clean + $(SILENCE)rm -rf gcov + $(SILENCE)find . -name "*.gdcno" | xargs rm -f + $(SILENCE)find . -name "*.[do]" | xargs rm -f + +gcov: test + $(SILENCE)for d in $(SRC_DIRS) ; do \ + gcov --object-directory $(UNITY_OBJS_DIR)/$$d $$d/*.c $$d/*.cpp >> $(GCOV_OUTPUT) 2>>$(GCOV_ERROR) ; \ + done + $(SILENCE)for f in $(SRC_FILES) ; do \ + gcov --object-directory $(UNITY_OBJS_DIR)/$$f $$f >> $(GCOV_OUTPUT) 2>>$(GCOV_ERROR) ; \ + done + $(UNITY_BUILD_HOME)/filterGcov.sh $(GCOV_OUTPUT) $(GCOV_ERROR) $(GCOV_REPORT) $(TEST_OUTPUT) + $(SILENCE)cat $(GCOV_REPORT) + $(SILENCE)mkdir -p gcov + $(SILENCE)mv *.gcov gcov + $(SILENCE)mv gcov_* gcov + $(SILENCE)echo "See gcov directory for details" + +debug: + @echo + @echo "Target Source files:" + @$(call debug_print_list,$(SRC)) + @echo "Target Object files:" + @$(call debug_print_list,$(OBJ)) + @echo "Test Source files:" + @$(call debug_print_list,$(TEST_SRC)) + @echo "Test Object files:" + @$(call debug_print_list,$(TEST_OBJS)) + @echo "Mock Source files:" + @$(call debug_print_list,$(MOCKS_SRC)) + @echo "Mock Object files:" + @$(call debug_print_list,$(MOCKS_OBJS)) + @echo "All Input Dependency files:" + @$(call debug_print_list,$(DEP_FILES)) + @echo Stuff to clean: + @$(call debug_print_list,$(STUFF_TO_CLEAN)) + @echo Includes: + @$(call debug_print_list,$(INCLUDES)) + +ifneq "$(OTHER_MAKEFILE_TO_INCLUDE)" "" +-include $(OTHER_MAKEFILE_TO_INCLUDE) +endif + + + +st,$(TEST_SRC)) + @echo "Test Object files:" + @$(call debug_print \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/build/filterGcov.sh b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/build/filterGcov.sh new file mode 100644 index 0000000..a861cf6 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/build/filterGcov.sh @@ -0,0 +1,61 @@ +#!/bin/bash +INPUT_FILE=$1 +TEMP_FILE1=${INPUT_FILE}1.tmp +TEMP_FILE2=${INPUT_FILE}2.tmp +TEMP_FILE3=${INPUT_FILE}3.tmp +ERROR_FILE=$2 +OUTPUT_FILE=$3 +HTML_OUTPUT_FILE=$3.html +TEST_RESULTS=$4 + +flattenGcovOutput() { +while read line1 +do + read line2 + echo $line2 " " $line1 + read junk + read junk +done < ${INPUT_FILE} +} + +getRidOfCruft() { +sed '-e s/^Lines.*://g' \ + '-e s/^[0-9]\./ &/g' \ + '-e s/^[0-9][0-9]\./ &/g' \ + '-e s/of.*File/ /g' \ + "-e s/'//g" \ + '-e s/^.*\/usr\/.*$//g' \ + '-e s/^.*\.$//g' +} + +getFileNameRootFromErrorFile() { +sed '-e s/gc..:cannot open .* file//g' ${ERROR_FILE} +} + +writeEachNoTestCoverageFile() { +while read line +do + echo " 0.00% " ${line} +done +} + +createHtmlOutput() { + echo "" + echo "" + sed "-e s/.*% /
CoverageFile
&<\/td>/" \ + "-e s/[a-zA-Z0-9_]*\.[ch][a-z]*/&<\/a><\/td><\/tr>/" + echo "
" + sed "-e s/.*/&
/g" < ${TEST_RESULTS} +} + + +flattenGcovOutput | getRidOfCruft > ${TEMP_FILE1} +getFileNameRootFromErrorFile | writeEachNoTestCoverageFile > ${TEMP_FILE2} +cat ${TEMP_FILE1} ${TEMP_FILE2} | sort | uniq > ${OUTPUT_FILE} +createHtmlOutput < ${OUTPUT_FILE} > ${HTML_OUTPUT_FILE} +rm -f ${TEMP_FILE1} ${TEMP_FILE2} +erageFile" + sed "-e s/.*% /&<\/td>/" \ + "-e s/[a-zA-Z0-9_]*\.[ch][a-z]*/
&<\/a><\/td><\/tr>/" + echo "" + sed "-e s/.*/&
/g" < ${TEST_RESULTS \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/rakefile.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/rakefile.rb new file mode 100644 index 0000000..6181707 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/rakefile.rb @@ -0,0 +1,37 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require HERE + 'rakefile_helper' + +include RakefileHelpers + +# Load default configuration, for now +DEFAULT_CONFIG_FILE = 'gcc.yml' +configure_toolchain(DEFAULT_CONFIG_FILE) + +task :unit do + run_tests +end + +desc "Build and test Unity Framework" +task :all => [:clean, :unit] +task :default => [:clobber, :all] +task :ci => [:no_color, :default] +task :cruise => [:no_color, :default] + +desc "Load configuration" +task :config, :config_file do |t, args| + configure_toolchain(args[:config_file]) +end + +task :no_color do + $colour_output = false +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/rakefile_helper.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/rakefile_helper.rb new file mode 100644 index 0000000..a7f6a28 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/rakefile_helper.rb @@ -0,0 +1,178 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require 'yaml' +require 'fileutils' +require HERE+'../../auto/unity_test_summary' +require HERE+'../../auto/generate_test_runner' +require HERE+'../../auto/colour_reporter' + +module RakefileHelpers + + C_EXTENSION = '.c' + + def load_configuration(config_file) + unless ($configured) + $cfg_file = HERE+"../../targets/#{config_file}" unless (config_file =~ /[\\|\/]/) + $cfg = YAML.load(File.read($cfg_file)) + $colour_output = false unless $cfg['colour'] + $configured = true if (config_file != DEFAULT_CONFIG_FILE) + end + end + + def configure_clean + CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil? + end + + def configure_toolchain(config_file=DEFAULT_CONFIG_FILE) + config_file += '.yml' unless config_file =~ /\.yml$/ + config_file = config_file unless config_file =~ /[\\|\/]/ + load_configuration(config_file) + configure_clean + end + + def tackit(strings) + if strings.is_a?(Array) + result = "\"#{strings.join}\"" + else + result = strings + end + return result + end + + def squash(prefix, items) + result = '' + items.each { |item| result += " #{prefix}#{tackit(item)}" } + return result + end + + def build_compiler_fields + command = tackit($cfg['compiler']['path']) + if $cfg['compiler']['defines']['items'].nil? + defines = '' + else + defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items'] + ['UNITY_OUTPUT_CHAR=UnityOutputCharSpy_OutputChar']) + end + options = squash('', $cfg['compiler']['options']) + includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :defines => defines, :options => options, :includes => includes} + end + + def compile(file, defines=[]) + compiler = build_compiler_fields + unity_include = $cfg['compiler']['includes']['prefix']+'../../src' + cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{unity_include} #{file} " + + "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" + + "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" + execute(cmd_str) + end + + def build_linker_fields + command = tackit($cfg['linker']['path']) + if $cfg['linker']['options'].nil? + options = '' + else + options = squash('', $cfg['linker']['options']) + end + if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?) + includes = '' + else + includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) + end + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :options => options, :includes => includes} + end + + def link(exe_name, obj_list) + linker = build_linker_fields + cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + + (obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).join + + $cfg['linker']['bin_files']['prefix'] + ' ' + + $cfg['linker']['bin_files']['destination'] + + exe_name + $cfg['linker']['bin_files']['extension'] + execute(cmd_str) + end + + def build_simulator_fields + return nil if $cfg['simulator'].nil? + if $cfg['simulator']['path'].nil? + command = '' + else + command = (tackit($cfg['simulator']['path']) + ' ') + end + if $cfg['simulator']['pre_support'].nil? + pre_support = '' + else + pre_support = squash('', $cfg['simulator']['pre_support']) + end + if $cfg['simulator']['post_support'].nil? + post_support = '' + else + post_support = squash('', $cfg['simulator']['post_support']) + end + return {:command => command, :pre_support => pre_support, :post_support => post_support} + end + + def execute(command_string, verbose=true) + report command_string + output = `#{command_string}`.chomp + report(output) if (verbose && !output.nil? && (output.length > 0)) + if ($?.exitstatus != 0) + raise "Command failed. (Returned #{$?.exitstatus})" + end + return output + end + + def report_summary + summary = UnityTestSummary.new + summary.set_root_path(HERE) + results_glob = "#{$cfg['compiler']['build_path']}*.test*" + results_glob.gsub!(/\\/, '/') + results = Dir[results_glob] + summary.set_targets(results) + summary.run + end + + def run_tests + report 'Running Unity system tests...' + + # Tack on TEST define for compiling unit tests + load_configuration($cfg_file) + test_defines = ['TEST'] + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + + # Get a list of all source files needed + src_files = Dir[HERE+'src/*.c'] + src_files += Dir[HERE+'test/*.c'] + src_files << '../../src/Unity.c' + + # Build object files + src_files.each { |f| compile(f, test_defines) } + obj_list = src_files.map {|f| File.basename(f.ext($cfg['compiler']['object_files']['extension'])) } + + # Link the test executable + test_base = "framework_test" + link(test_base, obj_list) + + # Execute unit test and generate results file + simulator = build_simulator_fields + executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] + if simulator.nil? + cmd_str = executable + " -v -r" + else + cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" + end + output = execute(cmd_str) + test_results = $cfg['compiler']['build_path'] + test_base + if output.match(/OK$/m).nil? + test_results += '.testfail' + else + test_results += '.testpass' + end + File.open(test_results, 'w') { |f| f.print output } + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/readme.txt b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/readme.txt new file mode 100644 index 0000000..6b9a78c --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/readme.txt @@ -0,0 +1,9 @@ +Copyright (c) 2010 James Grenning and Contributed to Unity Project + +Unity Project - A Test Framework for C +Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +[Released under MIT License. Please refer to license.txt for details] + +This Framework is an optional add-on to Unity. By including unity_framework.h in place of unity.h, +you may now work with Unity in a manner similar to CppUTest. This framework adds the concepts of +test groups and gives finer control of your tests over the command line. \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.c new file mode 100644 index 0000000..1ba3e9a --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.c @@ -0,0 +1,381 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" +#include "unity_internals.h" +#include + +UNITY_FIXTURE_T UnityFixture; + +//If you decide to use the function pointer approach. +int (*outputChar)(int) = putchar; + +int verbose = 0; + +void setUp(void) { /*does nothing*/ } +void tearDown(void) { /*does nothing*/ } + +void announceTestRun(int runNumber) +{ + UnityPrint("Unity test run "); + UnityPrintNumber(runNumber+1); + UnityPrint(" of "); + UnityPrintNumber(UnityFixture.RepeatCount); + UNITY_OUTPUT_CHAR('\n'); +} + +int UnityMain(int argc, char* argv[], void (*runAllTests)()) +{ + int result = UnityGetCommandLineOptions(argc, argv); + int r; + if (result != 0) + return result; + + for (r = 0; r < UnityFixture.RepeatCount; r++) + { + announceTestRun(r); + UnityBegin(); + runAllTests(); + UNITY_OUTPUT_CHAR('\n'); + UnityEnd(); + } + + return UnityFailureCount(); +} + +static int selected(const char * filter, const char * name) +{ + if (filter == 0) + return 1; + return strstr(name, filter) ? 1 : 0; +} + +static int testSelected(const char* test) +{ + return selected(UnityFixture.NameFilter, test); +} + +static int groupSelected(const char* group) +{ + return selected(UnityFixture.GroupFilter, group); +} + +static void runTestCase() +{ + +} + +void UnityTestRunner(unityfunction* setup, + unityfunction* testBody, + unityfunction* teardown, + const char * printableName, + const char * group, + const char * name, + const char * file, int line) +{ + if (testSelected(name) && groupSelected(group)) + { + Unity.CurrentTestFailed = 0; + Unity.TestFile = file; + Unity.CurrentTestName = printableName; + Unity.CurrentTestLineNumber = line; + if (!UnityFixture.Verbose) + UNITY_OUTPUT_CHAR('.'); + else + UnityPrint(printableName); + + Unity.NumberOfTests++; + UnityMalloc_StartTest(); + UnityPointer_Init(); + + runTestCase(); + if (TEST_PROTECT()) + { + setup(); + testBody(); + } + if (TEST_PROTECT()) + { + teardown(); + } + if (TEST_PROTECT()) + { + UnityPointer_UndoAllSets(); + if (!Unity.CurrentTestFailed) + UnityMalloc_EndTest(); + UnityConcludeFixtureTest(); + } + else + { + //aborting - jwg - di i need these for the other TEST_PROTECTS? + } + } +} + +void UnityIgnoreTest() +{ + Unity.NumberOfTests++; + Unity.CurrentTestIgnored = 1; + UNITY_OUTPUT_CHAR('!'); +} + + +//------------------------------------------------- +//Malloc and free stuff +// +#define MALLOC_DONT_FAIL -1 +static int malloc_count; +static int malloc_fail_countdown = MALLOC_DONT_FAIL; + +void UnityMalloc_StartTest() +{ + malloc_count = 0; + malloc_fail_countdown = MALLOC_DONT_FAIL; +} + +void UnityMalloc_EndTest() +{ + malloc_fail_countdown = MALLOC_DONT_FAIL; + if (malloc_count != 0) + { + TEST_FAIL_MESSAGE("This test leaks!"); + } +} + +void UnityMalloc_MakeMallocFailAfterCount(int countdown) +{ + malloc_fail_countdown = countdown; +} + +#ifdef malloc +#undef malloc +#endif + +#ifdef free +#undef free +#endif + +#include +#include + +typedef struct GuardBytes +{ + int size; + char guard[sizeof(int)]; +} Guard; + + +static const char * end = "END"; + +void * unity_malloc(size_t size) +{ + char* mem; + Guard* guard; + + if (malloc_fail_countdown != MALLOC_DONT_FAIL) + { + if (malloc_fail_countdown == 0) + return 0; + malloc_fail_countdown--; + } + + malloc_count++; + + guard = (Guard*)malloc(size + sizeof(Guard) + 4); + guard->size = size; + mem = (char*)&(guard[1]); + memcpy(&mem[size], end, strlen(end) + 1); + + return (void*)mem; +} + +static int isOverrun(void * mem) +{ + Guard* guard = (Guard*)mem; + char* memAsChar = (char*)mem; + guard--; + + return strcmp(&memAsChar[guard->size], end) != 0; +} + +static void release_memory(void * mem) +{ + Guard* guard = (Guard*)mem; + guard--; + + malloc_count--; + free(guard); +} + +void unity_free(void * mem) +{ + int overrun = isOverrun(mem);//strcmp(&memAsChar[guard->size], end) != 0; + release_memory(mem); + if (overrun) + { + TEST_FAIL_MESSAGE("Buffer overrun detected during free()"); + } +} + +void* unity_calloc(size_t num, size_t size) +{ + void* mem = unity_malloc(num * size); + memset(mem, 0, num*size); + return mem; +} + +void* unity_realloc(void * oldMem, size_t size) +{ + Guard* guard = (Guard*)oldMem; +// char* memAsChar = (char*)oldMem; + void* newMem; + + if (oldMem == 0) + return unity_malloc(size); + + guard--; + if (isOverrun(oldMem)) + { + release_memory(oldMem); + TEST_FAIL_MESSAGE("Buffer overrun detected during realloc()"); + } + + if (size == 0) + { + release_memory(oldMem); + return 0; + } + + if (guard->size >= size) + return oldMem; + + newMem = unity_malloc(size); + memcpy(newMem, oldMem, size); + unity_free(oldMem); + return newMem; +} + + +//-------------------------------------------------------- +//Automatic pointer restoration functions +typedef struct _PointerPair +{ + struct _PointerPair * next; + void ** pointer; + void * old_value; +} PointerPair; + +enum {MAX_POINTERS=50}; +static PointerPair pointer_store[MAX_POINTERS]; +static int pointer_index = 0; + +void UnityPointer_Init() +{ + pointer_index = 0; +} + +void UnityPointer_Set(void ** pointer, void * newValue) +{ + if (pointer_index >= MAX_POINTERS) + TEST_FAIL_MESSAGE("Too many pointers set"); + + pointer_store[pointer_index].pointer = pointer; + pointer_store[pointer_index].old_value = *pointer; + *pointer = newValue; + pointer_index++; +} + +void UnityPointer_UndoAllSets() +{ + while (pointer_index > 0) + { + pointer_index--; + *(pointer_store[pointer_index].pointer) = + pointer_store[pointer_index].old_value; + + } +} + +int UnityFailureCount() +{ + return Unity.TestFailures; +} + +int UnityGetCommandLineOptions(int argc, char* argv[]) +{ + int i; + UnityFixture.Verbose = 0; + UnityFixture.GroupFilter = 0; + UnityFixture.NameFilter = 0; + UnityFixture.RepeatCount = 1; + + if (argc == 1) + return 0; + + for (i = 1; i < argc; ) + { + if (strcmp(argv[i], "-v") == 0) + { + UnityFixture.Verbose = 1; + i++; + } + else if (strcmp(argv[i], "-g") == 0) + { + i++; + if (i >= argc) + return 1; + UnityFixture.GroupFilter = argv[i]; + i++; + } + else if (strcmp(argv[i], "-n") == 0) + { + i++; + if (i >= argc) + return 1; + UnityFixture.NameFilter = argv[i]; + i++; + } + else if (strcmp(argv[i], "-r") == 0) + { + UnityFixture.RepeatCount = 2; + i++; + if (i < argc) + { + if (*(argv[i]) >= '0' && *(argv[i]) <= '9') + { + UnityFixture.RepeatCount = atoi(argv[i]); + i++; + } + } + } + } + return 0; +} + +void UnityConcludeFixtureTest() +{ + if (Unity.CurrentTestIgnored) + { + Unity.TestIgnores++; + } + else if (!Unity.CurrentTestFailed) + { + if (UnityFixture.Verbose) + { + UnityPrint(" PASS"); + UNITY_OUTPUT_CHAR('\n'); + } + } + else if (Unity.CurrentTestFailed) + { + Unity.TestFailures++; + } + + Unity.CurrentTestFailed = 0; + Unity.CurrentTestIgnored = 0; +} + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.h b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.h new file mode 100644 index 0000000..da1f871 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.h @@ -0,0 +1,81 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FIXTURE_H_ +#define UNITY_FIXTURE_H_ + +#include "unity.h" +#include "unity_internals.h" +#include "unity_fixture_malloc_overrides.h" +#include "unity_fixture_internals.h" + +int UnityMain(int argc, char* argv[], void (*runAllTests)()); + + +#define TEST_GROUP(group)\ + int TEST_GROUP_##group = 0 + +#define TEST_SETUP(group) void TEST_##group##_SETUP() + +#define TEST_TEAR_DOWN(group) void TEST_##group##_TEAR_DOWN() + + +#define TEST(group, name) \ + void TEST_##group##_##name##_();\ + void TEST_##group##_##name##_run()\ + {\ + UnityTestRunner(TEST_##group##_SETUP,\ + TEST_##group##_##name##_,\ + TEST_##group##_TEAR_DOWN,\ + "TEST(" #group ", " #name ")",\ + #group, #name,\ + __FILE__, __LINE__);\ + }\ + void TEST_##group##_##name##_() + +#define IGNORE_TEST(group, name) \ + void TEST_##group##_##name##_();\ + void TEST_##group##_##name##_run()\ + {\ + UnityIgnoreTest();\ + }\ + void TEST_##group##_##name##_() + +#define DECLARE_TEST_CASE(group, name) \ + void TEST_##group##_##name##_run() + +#define RUN_TEST_CASE(group, name) \ + DECLARE_TEST_CASE(group, name);\ + TEST_##group##_##name##_run(); + +//This goes at the bottom of each test file or in a separate c file +#define TEST_GROUP_RUNNER(group)\ + void TEST_##group##_GROUP_RUNNER_runAll();\ + void TEST_##group##_GROUP_RUNNER()\ + {\ + TEST_##group##_GROUP_RUNNER_runAll();\ + }\ + void TEST_##group##_GROUP_RUNNER_runAll() + +//Call this from main +#define RUN_TEST_GROUP(group)\ + void TEST_##group##_GROUP_RUNNER();\ + TEST_##group##_GROUP_RUNNER(); + +//CppUTest Compatibility Macros +#define UT_PTR_SET(ptr, newPointerValue) UnityPointer_Set((void**)&ptr, (void*)newPointerValue) +#define TEST_ASSERT_POINTERS_EQUAL(expected, actual) TEST_ASSERT_EQUAL_PTR(expected, actual) +#define TEST_ASSERT_BYTES_EQUAL(expected, actual) TEST_ASSERT_EQUAL_HEX8(0xff & (expected), 0xff & (actual)) +#define FAIL(message) TEST_FAIL((message)) +#define CHECK(condition) TEST_ASSERT_TRUE((condition)) +#define LONGS_EQUAL(expected, actual) TEST_ASSERT_EQUAL_INT((expected), (actual)) +#define STRCMP_EQUAL(expected, actual) TEST_ASSERT_EQUAL_STRING((expected), (actual)) +#define DOUBLES_EQUAL(expected, actual, delta) TEST_ASSERT_FLOAT_WITHIN(((expected), (actual), (delta)) + +void UnityMalloc_MakeMallocFailAfterCount(int count); + +#endif /* UNITY_FIXTURE_H_ */ diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_internals.h b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_internals.h new file mode 100644 index 0000000..db23f67 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_internals.h @@ -0,0 +1,44 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FIXTURE_INTERNALS_H_ +#define UNITY_FIXTURE_INTERNALS_H_ + +typedef struct _UNITY_FIXTURE_T +{ + int Verbose; + unsigned int RepeatCount; + const char* NameFilter; + const char* GroupFilter; +} UNITY_FIXTURE_T; + +typedef void unityfunction(); +void UnityTestRunner(unityfunction * setup, + unityfunction * body, + unityfunction * teardown, + const char * printableName, + const char * group, + const char * name, + const char * file, int line); + +void UnityIgnoreTest(); +void UnityMalloc_StartTest(); +void UnityMalloc_EndTest(); +int UnityFailureCount(); +int UnityGetCommandLineOptions(int argc, char* argv[]); +void UnityConcludeFixtureTest(); + +void UnityPointer_Set(void ** ptr, void * newValue); +void UnityPointer_UndoAllSets(); +void UnityPointer_Init(); + +void UnityAssertEqualPointer(const void * expected, + const void * actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +#endif /* UNITY_FIXTURE_INTERNALS_H_ */ diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h new file mode 100644 index 0000000..38f8e34 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h @@ -0,0 +1,16 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FIXTURE_MALLOC_OVERRIDES_H_ +#define UNITY_FIXTURE_MALLOC_OVERRIDES_H_ + +#define malloc unity_malloc +#define calloc unity_calloc +#define realloc unity_realloc +#define free unity_free + +#endif /* UNITY_FIXTURE_MALLOC_OVERRIDES_H_ */ diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/main/AllTests.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/main/AllTests.c new file mode 100644 index 0000000..ccb775b --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/main/AllTests.c @@ -0,0 +1,21 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" + +static void runAllTests() +{ + RUN_TEST_GROUP(UnityFixture); + RUN_TEST_GROUP(UnityCommandOptions); + RUN_TEST_GROUP(LeakDetection) +} + +int main(int argc, char* argv[]) +{ + return UnityMain(argc, argv, runAllTests); +} + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/testunity_fixture.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/testunity_fixture.c new file mode 100644 index 0000000..de0c04c --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/testunity_fixture.c @@ -0,0 +1,39 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" + +static int data = -1; + +TEST_GROUP(mygroup); + +TEST_SETUP(mygroup) +{ + data = 0; +} + +TEST_TEAR_DOWN(mygroup) +{ + data = -1; +} + +TEST(mygroup, test1) +{ + TEST_ASSERT_EQUAL_INT(0, data); +} + +TEST(mygroup, test2) +{ + TEST_ASSERT_EQUAL_INT(0, data); + data = 5; +} + +TEST(mygroup, test3) +{ + data = 7; + TEST_ASSERT_EQUAL_INT(7, data); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_Test.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_Test.c new file mode 100644 index 0000000..b8b4524 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_Test.c @@ -0,0 +1,321 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" +#include "unity_output_Spy.h" +#include +#include + +extern UNITY_FIXTURE_T UnityFixture; + +TEST_GROUP(UnityFixture); + +TEST_SETUP(UnityFixture) +{ +} + +TEST_TEAR_DOWN(UnityFixture) +{ +} + +int my_int; +int* pointer1 = 0; +int* pointer2 = (int*)2; +int* pointer3 = (int*)3; +int int1; +int int2; +int int3; +int int4; + +TEST(UnityFixture, PointerSetting) +{ + TEST_ASSERT_POINTERS_EQUAL(pointer1, 0); + UT_PTR_SET(pointer1, &int1); + UT_PTR_SET(pointer2, &int2); + UT_PTR_SET(pointer3, &int3); + TEST_ASSERT_POINTERS_EQUAL(pointer1, &int1); + TEST_ASSERT_POINTERS_EQUAL(pointer2, &int2); + TEST_ASSERT_POINTERS_EQUAL(pointer3, &int3); + UT_PTR_SET(pointer1, &int4); + UnityPointer_UndoAllSets(); + TEST_ASSERT_POINTERS_EQUAL(pointer1, 0); + TEST_ASSERT_POINTERS_EQUAL(pointer2, (int*)2); + TEST_ASSERT_POINTERS_EQUAL(pointer3, (int*)3); +} + +TEST(UnityFixture, ForceMallocFail) +{ + UnityMalloc_MakeMallocFailAfterCount(1); + void* m = malloc(10); + CHECK(m); + void* mfails = malloc(10); + TEST_ASSERT_POINTERS_EQUAL(0, mfails); + free(m); +} + +TEST(UnityFixture, ReallocSmallerIsUnchanged) +{ + void* m1 = malloc(10); + void* m2 = realloc(m1, 5); + TEST_ASSERT_POINTERS_EQUAL(m1, m2); + free(m2); +} + +TEST(UnityFixture, ReallocSameIsUnchanged) +{ + void* m1 = malloc(10); + void* m2 = realloc(m1, 10); + TEST_ASSERT_POINTERS_EQUAL(m1, m2); + free(m2); +} + +TEST(UnityFixture, ReallocLargerNeeded) +{ + void* m1 = malloc(10); + strcpy((char*)m1, "123456789"); + void* m2 = realloc(m1, 15); + CHECK(m1 != m2); + STRCMP_EQUAL("123456789", m2); + free(m2); +} + +TEST(UnityFixture, ReallocNullPointerIsLikeMalloc) +{ + void* m = realloc(0, 15); + CHECK(m != 0); + free(m); +} + +TEST(UnityFixture, ReallocSizeZeroFreesMemAndReturnsNullPointer) +{ + void* m1 = malloc(10); + void* m2 = realloc(m1, 0); + TEST_ASSERT_POINTERS_EQUAL(0, m2); +} + +TEST(UnityFixture, CallocFillsWithZero) +{ + void* m = calloc(3, sizeof(char)); + char* s = (char*)m; + TEST_ASSERT_BYTES_EQUAL(0, s[0]); + TEST_ASSERT_BYTES_EQUAL(0, s[1]); + TEST_ASSERT_BYTES_EQUAL(0, s[2]); + free(m); +} + +char *p1; +char *p2; + +TEST(UnityFixture, PointerSet) +{ + char c1; + char c2; + char newC1; + char newC2; + p1 = &c1; + p2 = &c2; + + UnityPointer_Init(10); + UT_PTR_SET(p1, &newC1); + UT_PTR_SET(p2, &newC2); + TEST_ASSERT_POINTERS_EQUAL(&newC1, p1); + TEST_ASSERT_POINTERS_EQUAL(&newC2, p2); + UnityPointer_UndoAllSets(); + TEST_ASSERT_POINTERS_EQUAL(&c1, p1); + TEST_ASSERT_POINTERS_EQUAL(&c2, p2); +} + +//------------------------------------------------------------ + +TEST_GROUP(UnityCommandOptions); + +int savedVerbose; +int savedRepeat; +const char* savedName; +const char* savedGroup; + +TEST_SETUP(UnityCommandOptions) +{ + savedVerbose = UnityFixture.Verbose; + savedRepeat = UnityFixture.RepeatCount; + savedName = UnityFixture.NameFilter; + savedGroup = UnityFixture.GroupFilter; +} + +TEST_TEAR_DOWN(UnityCommandOptions) +{ + UnityFixture.Verbose = savedVerbose; + UnityFixture.RepeatCount= savedRepeat; + UnityFixture.NameFilter = savedName; + UnityFixture.GroupFilter = savedGroup; +} + + +static char* noOptions[] = { + "testrunner.exe" +}; + +TEST(UnityCommandOptions, DefaultOptions) +{ + UnityGetCommandLineOptions(1, noOptions); + TEST_ASSERT_EQUAL(0, UnityFixture.Verbose); + TEST_ASSERT_POINTERS_EQUAL(0, UnityFixture.GroupFilter); + TEST_ASSERT_POINTERS_EQUAL(0, UnityFixture.NameFilter); + TEST_ASSERT_EQUAL(1, UnityFixture.RepeatCount); +} + +static char* verbose[] = { + "testrunner.exe", + "-v" +}; + +TEST(UnityCommandOptions, OptionVerbose) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(2, verbose)); + TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); +} + +static char* group[] = { + "testrunner.exe", + "-g", "groupname" +}; + +TEST(UnityCommandOptions, OptionSelectTestByGroup) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, group)); + STRCMP_EQUAL("groupname", UnityFixture.GroupFilter); +} + +static char* name[] = { + "testrunner.exe", + "-n", "testname" +}; + +TEST(UnityCommandOptions, OptionSelectTestByName) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, name)); + STRCMP_EQUAL("testname", UnityFixture.NameFilter); +} + +static char* repeat[] = { + "testrunner.exe", + "-r", "99" +}; + +TEST(UnityCommandOptions, OptionSelectRepeatTestsDefaultCount) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(2, repeat)); + TEST_ASSERT_EQUAL(2, UnityFixture.RepeatCount); +} + +TEST(UnityCommandOptions, OptionSelectRepeatTestsSpecificCount) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, repeat)); + TEST_ASSERT_EQUAL(99, UnityFixture.RepeatCount); +} + +static char* multiple[] = { + "testrunner.exe", + "-v", + "-g", "groupname", + "-n", "testname", + "-r", "98" +}; + +TEST(UnityCommandOptions, MultipleOptions) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(8, multiple)); + TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); + STRCMP_EQUAL("groupname", UnityFixture.GroupFilter); + STRCMP_EQUAL("testname", UnityFixture.NameFilter); + TEST_ASSERT_EQUAL(98, UnityFixture.RepeatCount); +} + +static char* dashRNotLast[] = { + "testrunner.exe", + "-v", + "-g", "gggg", + "-r", + "-n", "tttt", +}; + +TEST(UnityCommandOptions, MultipleOptionsDashRNotLastAndNoValueSpecified) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(7, dashRNotLast)); + TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); + STRCMP_EQUAL("gggg", UnityFixture.GroupFilter); + STRCMP_EQUAL("tttt", UnityFixture.NameFilter); + TEST_ASSERT_EQUAL(2, UnityFixture.RepeatCount); +} + + +//------------------------------------------------------------ + +TEST_GROUP(LeakDetection); + +TEST_SETUP(LeakDetection) +{ + UnityOutputCharSpy_Create(1000); +} + +TEST_TEAR_DOWN(LeakDetection) +{ + UnityOutputCharSpy_Destroy(); +} + +#define EXPECT_ABORT_BEGIN \ + { \ + jmp_buf TestAbortFrame; \ + memcpy(TestAbortFrame, Unity.AbortFrame, sizeof(jmp_buf)); \ + if (TEST_PROTECT()) \ + { + +#define EXPECT_ABORT_END \ + } \ + memcpy(Unity.AbortFrame, TestAbortFrame, sizeof(jmp_buf)); \ + } + +TEST(LeakDetection, DetectsLeak) +{ + void* m = malloc(10); + UnityOutputCharSpy_Enable(1); + EXPECT_ABORT_BEGIN + UnityMalloc_EndTest(); + EXPECT_ABORT_END + UnityOutputCharSpy_Enable(0); + CHECK(strstr(UnityOutputCharSpy_Get(), "This test leaks!")); + free(m); + Unity.CurrentTestFailed = 0; +} + +TEST(LeakDetection, BufferOverrunFoundDuringFree) +{ + void* m = malloc(10); + char* s = (char*)m; + s[10] = (char)0xFF; + UnityOutputCharSpy_Enable(1); + EXPECT_ABORT_BEGIN + free(m); + EXPECT_ABORT_END + UnityOutputCharSpy_Enable(0); + CHECK(strstr(UnityOutputCharSpy_Get(), "Buffer overrun detected during free()")); + Unity.CurrentTestFailed = 0; +} + +TEST(LeakDetection, BufferOverrunFoundDuringRealloc) +{ + void* m = malloc(10); + char* s = (char*)m; + s[10] = (char)0xFF; + UnityOutputCharSpy_Enable(1); + EXPECT_ABORT_BEGIN + m = realloc(m, 100); + EXPECT_ABORT_END + UnityOutputCharSpy_Enable(0); + CHECK(strstr(UnityOutputCharSpy_Get(), "Buffer overrun detected during realloc()")); + Unity.CurrentTestFailed = 0; +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c new file mode 100644 index 0000000..80fec09 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c @@ -0,0 +1,40 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" + +TEST_GROUP_RUNNER(UnityFixture) +{ + RUN_TEST_CASE(UnityFixture, PointerSetting); + RUN_TEST_CASE(UnityFixture, ForceMallocFail); + RUN_TEST_CASE(UnityFixture, ReallocSmallerIsUnchanged); + RUN_TEST_CASE(UnityFixture, ReallocSameIsUnchanged); + RUN_TEST_CASE(UnityFixture, ReallocLargerNeeded); + RUN_TEST_CASE(UnityFixture, ReallocNullPointerIsLikeMalloc); + RUN_TEST_CASE(UnityFixture, ReallocSizeZeroFreesMemAndReturnsNullPointer); + RUN_TEST_CASE(UnityFixture, CallocFillsWithZero); + RUN_TEST_CASE(UnityFixture, PointerSet); +} + +TEST_GROUP_RUNNER(UnityCommandOptions) +{ + RUN_TEST_CASE(UnityCommandOptions, DefaultOptions); + RUN_TEST_CASE(UnityCommandOptions, OptionVerbose); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectTestByGroup); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectTestByName); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectRepeatTestsDefaultCount); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectRepeatTestsSpecificCount); + RUN_TEST_CASE(UnityCommandOptions, MultipleOptions); + RUN_TEST_CASE(UnityCommandOptions, MultipleOptionsDashRNotLastAndNoValueSpecified); +} + +TEST_GROUP_RUNNER(LeakDetection) +{ + RUN_TEST_CASE(LeakDetection, DetectsLeak); + RUN_TEST_CASE(LeakDetection, BufferOverrunFoundDuringFree); + RUN_TEST_CASE(LeakDetection, BufferOverrunFoundDuringRealloc); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/unity_output_Spy.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/unity_output_Spy.c new file mode 100644 index 0000000..16faefa --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/unity_output_Spy.c @@ -0,0 +1,56 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + + +#include "unity_output_Spy.h" +#include +#include +#include + +static int size; +static int count; +static char* buffer; +static int spy_enable; + +void UnityOutputCharSpy_Create(int s) +{ + size = s; + count = 0; + spy_enable = 0; + buffer = malloc(size); + memset(buffer, 0, size); +} + +void UnityOutputCharSpy_Destroy() +{ + size = 0; + free(buffer); +} + +int UnityOutputCharSpy_OutputChar(int c) +{ + if (spy_enable) + { + if (count < (size-1)) + buffer[count++] = c; + } + else + { + putchar(c); + } + return c; +} + +const char * UnityOutputCharSpy_Get() +{ + return buffer; +} + +void UnityOutputCharSpy_Enable(int enable) +{ + spy_enable = enable; +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/unity_output_Spy.h b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/unity_output_Spy.h new file mode 100644 index 0000000..7c1590e --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/unity_output_Spy.h @@ -0,0 +1,17 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef D_unity_output_Spy_H +#define D_unity_output_Spy_H + +void UnityOutputCharSpy_Create(int s); +void UnityOutputCharSpy_Destroy(); +int UnityOutputCharSpy_OutputChar(int c); +const char * UnityOutputCharSpy_Get(); +void UnityOutputCharSpy_Enable(int enable); + +#endif diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/makefile b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/makefile new file mode 100644 index 0000000..8c8444b --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/makefile @@ -0,0 +1,35 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +C_COMPILER=gcc +TARGET_BASE = testunity +ifeq ($(OS),Windows_NT) + TARGET_EXTENSION=.exe +else + TARGET_EXTENSION=.out +endif +TARGET = $(TARGET_BASE)$(TARGET_EXTENSION) +OUT_FILE=-o $(TARGET) +SRC_FILES=src/unity.c test/testunity.c build/testunity_Runner.c +INC_DIRS=-Isrc +SYMBOLS=-DTEST -DUNITY_SUPPORT_64 + +ifeq ($(OS),Windows_NT) + CLEANUP = del /F /Q build\* && del /F /Q $(TARGET) +else + CLEANUP = rm -f build/*.o ; rm -f $(TARGET) +endif + +all: clean default + +default: + ruby auto/generate_test_runner.rb test/testunity.c build/testunity_Runner.c + $(C_COMPILER) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES) $(OUT_FILE) + $(TARGET) + +clean: + $(CLEANUP) + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/rakefile.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/rakefile.rb new file mode 100644 index 0000000..3ec5d5a --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/rakefile.rb @@ -0,0 +1,48 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require HERE + 'rakefile_helper' + +include RakefileHelpers + +# Load default configuration, for now +DEFAULT_CONFIG_FILE = 'gcc.yml' +configure_toolchain(DEFAULT_CONFIG_FILE) + +desc "Test unity with its own unit tests" +task :unit do + run_tests get_unit_test_files +end + +Rake::TestTask.new(:scripts) do |t| + t.pattern = 'test/test_*.rb' + t.verbose = true +end + +desc "Generate test summary" +task :summary do + report_summary +end + +desc "Build and test Unity" +task :all => [:clean, :scripts, :unit, :summary] +task :default => [:clobber, :all] +task :ci => [:no_color, :default] +task :cruise => [:no_color, :default] + +desc "Load configuration" +task :config, :config_file do |t, args| + configure_toolchain(args[:config_file]) +end + +task :no_color do + $colour_output = false +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/rakefile_helper.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/rakefile_helper.rb new file mode 100644 index 0000000..218fcaa --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/rakefile_helper.rb @@ -0,0 +1,243 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require 'yaml' +require 'fileutils' +require HERE+'auto/unity_test_summary' +require HERE+'auto/generate_test_runner' +require HERE+'auto/colour_reporter' + +module RakefileHelpers + + C_EXTENSION = '.c' + + def load_configuration(config_file) + unless ($configured) + $cfg_file = "targets/#{config_file}" unless (config_file =~ /[\\|\/]/) + $cfg = YAML.load(File.read($cfg_file)) + $colour_output = false unless $cfg['colour'] + $configured = true if (config_file != DEFAULT_CONFIG_FILE) + end + end + + def configure_clean + CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil? + end + + def configure_toolchain(config_file=DEFAULT_CONFIG_FILE) + config_file += '.yml' unless config_file =~ /\.yml$/ + config_file = config_file unless config_file =~ /[\\|\/]/ + load_configuration(config_file) + configure_clean + end + + def get_unit_test_files + path = $cfg['compiler']['unit_tests_path'] + 'test*' + C_EXTENSION + path.gsub!(/\\/, '/') + FileList.new(path) + end + + def get_local_include_dirs + include_dirs = $cfg['compiler']['includes']['items'].dup + include_dirs.delete_if {|dir| dir.is_a?(Array)} + return include_dirs + end + + def extract_headers(filename) + includes = [] + lines = File.readlines(filename) + lines.each do |line| + m = line.match(/^\s*#include\s+\"\s*(.+\.[hH])\s*\"/) + if not m.nil? + includes << m[1] + end + end + return includes + end + + def find_source_file(header, paths) + paths.each do |dir| + src_file = dir + header.ext(C_EXTENSION) + if (File.exists?(src_file)) + return src_file + end + end + return nil + end + + def tackit(strings) + if strings.is_a?(Array) + result = "\"#{strings.join}\"" + else + result = strings + end + return result + end + + def squash(prefix, items) + result = '' + items.each { |item| result += " #{prefix}#{tackit(item)}" } + return result + end + + def build_compiler_fields + command = tackit($cfg['compiler']['path']) + if $cfg['compiler']['defines']['items'].nil? + defines = '' + else + defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items']) + end + options = squash('', $cfg['compiler']['options']) + includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :defines => defines, :options => options, :includes => includes} + end + + def compile(file, defines=[]) + compiler = build_compiler_fields + cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{file} " + + "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" + + "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" + execute(cmd_str) + end + + def build_linker_fields + command = tackit($cfg['linker']['path']) + if $cfg['linker']['options'].nil? + options = '' + else + options = squash('', $cfg['linker']['options']) + end + if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?) + includes = '' + else + includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) + end + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :options => options, :includes => includes} + end + + def link(exe_name, obj_list) + linker = build_linker_fields + cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + + (obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).join + + $cfg['linker']['bin_files']['prefix'] + ' ' + + $cfg['linker']['bin_files']['destination'] + + exe_name + $cfg['linker']['bin_files']['extension'] + execute(cmd_str) + end + + def build_simulator_fields + return nil if $cfg['simulator'].nil? + if $cfg['simulator']['path'].nil? + command = '' + else + command = (tackit($cfg['simulator']['path']) + ' ') + end + if $cfg['simulator']['pre_support'].nil? + pre_support = '' + else + pre_support = squash('', $cfg['simulator']['pre_support']) + end + if $cfg['simulator']['post_support'].nil? + post_support = '' + else + post_support = squash('', $cfg['simulator']['post_support']) + end + return {:command => command, :pre_support => pre_support, :post_support => post_support} + end + + def execute(command_string, verbose=true) + report command_string + output = `#{command_string}`.chomp + report(output) if (verbose && !output.nil? && (output.length > 0)) + if $?.exitstatus != 0 + raise "Command failed. (Returned #{$?.exitstatus})" + end + return output + end + + def report_summary + summary = UnityTestSummary.new + summary.set_root_path(HERE) + results_glob = "#{$cfg['compiler']['build_path']}*.test*" + results_glob.gsub!(/\\/, '/') + results = Dir[results_glob] + summary.set_targets(results) + summary.run + end + + def run_tests(test_files) + report 'Running Unity system tests...' + + # Tack on TEST define for compiling unit tests + load_configuration($cfg_file) + test_defines = ['TEST'] + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + $cfg['compiler']['defines']['items'] << 'TEST' + + include_dirs = get_local_include_dirs + + # Build and execute each unit test + test_files.each do |test| + obj_list = [] + + # Detect dependencies and build required modules + extract_headers(test).each do |header| + # Compile corresponding source file if it exists + src_file = find_source_file(header, include_dirs) + if !src_file.nil? + compile(src_file, test_defines) + obj_list << header.ext($cfg['compiler']['object_files']['extension']) + end + end + + # Build the test runner (generate if configured to do so) + test_base = File.basename(test, C_EXTENSION) + + runner_name = test_base + '_Runner.c' + runner_path = '' + + if $cfg['compiler']['runner_path'].nil? + runner_path = $cfg['compiler']['build_path'] + runner_name + else + runner_path = $cfg['compiler']['runner_path'] + runner_name + end + + options = $cfg[:unity] + options[:use_param_tests] = (test =~ /parameterized/) ? true : false + UnityTestRunnerGenerator.new(options).run(test, runner_path) + + compile(runner_path, test_defines) + obj_list << runner_name.ext($cfg['compiler']['object_files']['extension']) + + # Build the test module + compile(test, test_defines) + obj_list << test_base.ext($cfg['compiler']['object_files']['extension']) + + # Link the test executable + link(test_base, obj_list) + + # Execute unit test and generate results file + simulator = build_simulator_fields + executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] + if simulator.nil? + cmd_str = executable + else + cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" + end + output = execute(cmd_str) + test_results = $cfg['compiler']['build_path'] + test_base + if output.match(/OK$/m).nil? + test_results += '.testfail' + else + test_results += '.testpass' + end + File.open(test_results, 'w') { |f| f.print output } + + end + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/release/build.info b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/release/build.info new file mode 100644 index 0000000..7871b21 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/release/build.info @@ -0,0 +1,2 @@ +118 + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/release/version.info b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/release/version.info new file mode 100644 index 0000000..0d71c08 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/release/version.info @@ -0,0 +1,2 @@ +2.0 + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/src/unity.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/src/unity.c new file mode 100644 index 0000000..d85b880 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/src/unity.c @@ -0,0 +1,855 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity.h" +#include +#include + +#define UNITY_FAIL_AND_BAIL { Unity.CurrentTestFailed = 1; UNITY_OUTPUT_CHAR('\n'); longjmp(Unity.AbortFrame, 1); } +#define UNITY_IGNORE_AND_BAIL { Unity.CurrentTestIgnored = 1; UNITY_OUTPUT_CHAR('\n'); longjmp(Unity.AbortFrame, 1); } +/// return prematurely if we are already in failure or ignore state +#define UNITY_SKIP_EXECUTION { if ((Unity.CurrentTestFailed != 0) || (Unity.CurrentTestIgnored != 0)) {return;} } +#define UNITY_PRINT_EOL { UNITY_OUTPUT_CHAR('\n'); } + +struct _Unity Unity = { 0 }; + +const char* UnityStrNull = "NULL"; +const char* UnityStrSpacer = ". "; +const char* UnityStrExpected = " Expected "; +const char* UnityStrWas = " Was "; +const char* UnityStrTo = " To "; +const char* UnityStrElement = " Element "; +const char* UnityStrMemory = " Memory Mismatch"; +const char* UnityStrDelta = " Values Not Within Delta "; +const char* UnityStrPointless= " You Asked Me To Compare Nothing, Which Was Pointless."; +const char* UnityStrNullPointerForExpected= " Expected pointer to be NULL"; +const char* UnityStrNullPointerForActual = " Actual pointer was NULL"; + +const _U_UINT UnitySizeMask[] = +{ + 255, + 65535, + 65535, + 4294967295, + 4294967295, + 4294967295, + 4294967295 +#ifdef UNITY_SUPPORT_64 + ,0xFFFFFFFFFFFFFFFF +#endif +}; + +//----------------------------------------------- +// Pretty Printers & Test Result Output Handlers +//----------------------------------------------- + +void UnityPrint(const char* string) +{ + const char* pch = string; + + if (pch != NULL) + { + while (*pch) + { + // printable characters plus CR & LF are printed + if ((*pch <= 126) && (*pch >= 32)) + { + UNITY_OUTPUT_CHAR(*pch); + } + //write escaped carriage returns + else if (*pch == 13) + { + UNITY_OUTPUT_CHAR('\\'); + UNITY_OUTPUT_CHAR('r'); + } + //write escaped line feeds + else if (*pch == 10) + { + UNITY_OUTPUT_CHAR('\\'); + UNITY_OUTPUT_CHAR('n'); + } + // unprintable characters are shown as codes + else + { + UNITY_OUTPUT_CHAR('\\'); + UnityPrintNumberHex((_U_SINT)*pch, 2); + } + pch++; + } + } +} + +//----------------------------------------------- +void UnityPrintNumberByStyle(const _U_SINT number, const UNITY_DISPLAY_STYLE_T style) +{ + if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT) + { + UnityPrintNumber(number); + } + else if ((style & UNITY_DISPLAY_RANGE_UINT) == UNITY_DISPLAY_RANGE_UINT) + { + UnityPrintNumberUnsigned( (_U_UINT)number & UnitySizeMask[((_U_UINT)style & (_U_UINT)0x0F) - 1] ); + } + else + { + UnityPrintNumberHex((_U_UINT)number, (style & 0x000F) << 1); + } +} + +//----------------------------------------------- +/// basically do an itoa using as little ram as possible +void UnityPrintNumber(const _U_SINT number_to_print) +{ + _U_SINT divisor = 1; + _U_SINT next_divisor; + _U_SINT number = number_to_print; + + if (number < 0) + { + UNITY_OUTPUT_CHAR('-'); + number = -number; + } + + // figure out initial divisor + while (number / divisor > 9) + { + next_divisor = divisor * 10; + if (next_divisor > divisor) + divisor = next_divisor; + else + break; + } + + // now mod and print, then divide divisor + do + { + UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10))); + divisor /= 10; + } + while (divisor > 0); +} + +//----------------------------------------------- +/// basically do an itoa using as little ram as possible +void UnityPrintNumberUnsigned(const _U_UINT number) +{ + _U_UINT divisor = 1; + _U_UINT next_divisor; + + // figure out initial divisor + while (number / divisor > 9) + { + next_divisor = divisor * 10; + if (next_divisor > divisor) + divisor = next_divisor; + else + break; + } + + // now mod and print, then divide divisor + do + { + UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10))); + divisor /= 10; + } + while (divisor > 0); +} + +//----------------------------------------------- +void UnityPrintNumberHex(const _U_UINT number, const char nibbles_to_print) +{ + _U_UINT nibble; + char nibbles = nibbles_to_print; + UNITY_OUTPUT_CHAR('0'); + UNITY_OUTPUT_CHAR('x'); + + while (nibbles > 0) + { + nibble = (number >> (--nibbles << 2)) & 0x0000000F; + if (nibble <= 9) + { + UNITY_OUTPUT_CHAR((char)('0' + nibble)); + } + else + { + UNITY_OUTPUT_CHAR((char)('A' - 10 + nibble)); + } + } +} + +//----------------------------------------------- +void UnityPrintMask(const _U_UINT mask, const _U_UINT number) +{ + _U_UINT current_bit = (_U_UINT)1 << (UNITY_INT_WIDTH - 1); + _US32 i; + + for (i = 0; i < UNITY_INT_WIDTH; i++) + { + if (current_bit & mask) + { + if (current_bit & number) + { + UNITY_OUTPUT_CHAR('1'); + } + else + { + UNITY_OUTPUT_CHAR('0'); + } + } + else + { + UNITY_OUTPUT_CHAR('X'); + } + current_bit = current_bit >> 1; + } +} + +//----------------------------------------------- +#ifdef UNITY_FLOAT_VERBOSE +void UnityPrintFloat(_UF number) +{ + char TempBuffer[32]; + sprintf(TempBuffer, "%.6f", number); + UnityPrint(TempBuffer); +} +#endif + +//----------------------------------------------- +void UnityTestResultsBegin(const char* file, const UNITY_LINE_TYPE line) +{ + UnityPrint(file); + UNITY_OUTPUT_CHAR(':'); + UnityPrintNumber(line); + UNITY_OUTPUT_CHAR(':'); + UnityPrint(Unity.CurrentTestName); + UNITY_OUTPUT_CHAR(':'); +} + +//----------------------------------------------- +void UnityTestResultsFailBegin(const UNITY_LINE_TYPE line) +{ + UnityTestResultsBegin(Unity.TestFile, line); + UnityPrint("FAIL:"); +} + +//----------------------------------------------- +void UnityConcludeTest(void) +{ + if (Unity.CurrentTestIgnored) + { + Unity.TestIgnores++; + } + else if (!Unity.CurrentTestFailed) + { + UnityTestResultsBegin(Unity.TestFile, Unity.CurrentTestLineNumber); + UnityPrint("PASS"); + UNITY_PRINT_EOL; + } + else + { + Unity.TestFailures++; + } + + Unity.CurrentTestFailed = 0; + Unity.CurrentTestIgnored = 0; +} + +//----------------------------------------------- +void UnityAddMsgIfSpecified(const char* msg) +{ + if (msg) + { + UnityPrint(UnityStrSpacer); + UnityPrint(msg); + } +} + +//----------------------------------------------- +void UnityPrintExpectedAndActualStrings(const char* expected, const char* actual) +{ + UnityPrint(UnityStrExpected); + if (expected != NULL) + { + UNITY_OUTPUT_CHAR('\''); + UnityPrint(expected); + UNITY_OUTPUT_CHAR('\''); + } + else + { + UnityPrint(UnityStrNull); + } + UnityPrint(UnityStrWas); + if (actual != NULL) + { + UNITY_OUTPUT_CHAR('\''); + UnityPrint(actual); + UNITY_OUTPUT_CHAR('\''); + } + else + { + UnityPrint(UnityStrNull); + } +} + +//----------------------------------------------- +// Assertion & Control Helpers +//----------------------------------------------- + +int UnityCheckArraysForNull(const void* expected, const void* actual, const UNITY_LINE_TYPE lineNumber, const char* msg) +{ + //return true if they are both NULL + if ((expected == NULL) && (actual == NULL)) + return 1; + + //throw error if just expected is NULL + if (expected == NULL) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrNullPointerForExpected); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + //throw error if just actual is NULL + if (actual == NULL) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrNullPointerForActual); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + //return false if neither is NULL + return 0; +} + +//----------------------------------------------- +// Assertion Functions +//----------------------------------------------- + +void UnityAssertBits(const _U_SINT mask, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + UNITY_SKIP_EXECUTION; + + if ((mask & expected) != (mask & actual)) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrExpected); + UnityPrintMask(mask, expected); + UnityPrint(UnityStrWas); + UnityPrintMask(mask, actual); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualNumber(const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style) +{ + UNITY_SKIP_EXECUTION; + + if (expected != actual) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(expected, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(actual, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualIntArray(const _U_SINT* expected, + const _U_SINT* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style) +{ + _UU32 elements = num_elements; + const _US8* ptr_exp = (_US8*)expected; + const _US8* ptr_act = (_US8*)actual; + + UNITY_SKIP_EXECUTION; + + if (elements == 0) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + switch(style) + { + case UNITY_DISPLAY_STYLE_HEX8: + case UNITY_DISPLAY_STYLE_INT8: + case UNITY_DISPLAY_STYLE_UINT8: + while (elements--) + { + if (*ptr_exp != *ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 1; + ptr_act += 1; + } + break; + case UNITY_DISPLAY_STYLE_HEX16: + case UNITY_DISPLAY_STYLE_INT16: + case UNITY_DISPLAY_STYLE_UINT16: + while (elements--) + { + if (*(_US16*)ptr_exp != *(_US16*)ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*(_US16*)ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*(_US16*)ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 2; + ptr_act += 2; + } + break; +#ifdef UNITY_SUPPORT_64 + case UNITY_DISPLAY_STYLE_HEX64: + case UNITY_DISPLAY_STYLE_INT64: + case UNITY_DISPLAY_STYLE_UINT64: + while (elements--) + { + if (*(_US64*)ptr_exp != *(_US64*)ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*(_US64*)ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*(_US64*)ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 8; + ptr_act += 8; + } + break; +#endif + default: + while (elements--) + { + if (*(_US32*)ptr_exp != *(_US32*)ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*(_US32*)ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*(_US32*)ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 4; + ptr_act += 4; + } + break; + } +} + +//----------------------------------------------- +#ifndef UNITY_EXCLUDE_FLOAT +void UnityAssertEqualFloatArray(const _UF* expected, + const _UF* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UU32 elements = num_elements; + const _UF* ptr_expected = expected; + const _UF* ptr_actual = actual; + _UF diff, tol; + + UNITY_SKIP_EXECUTION; + + if (elements == 0) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + while (elements--) + { + diff = *ptr_expected - *ptr_actual; + if (diff < 0.0) + diff = 0.0 - diff; + tol = UNITY_FLOAT_PRECISION * *ptr_expected; + if (tol < 0.0) + tol = 0.0 - tol; + if (diff > tol) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); +#ifdef UNITY_FLOAT_VERBOSE + UnityPrint(UnityStrExpected); + UnityPrintFloat(*ptr_expected); + UnityPrint(UnityStrWas); + UnityPrintFloat(*ptr_actual); +#else + UnityPrint(UnityStrDelta); +#endif + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_expected++; + ptr_actual++; + } +} + +//----------------------------------------------- +void UnityAssertFloatsWithin(const _UF delta, + const _UF expected, + const _UF actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UF diff = actual - expected; + _UF pos_delta = delta; + + UNITY_SKIP_EXECUTION; + + if (diff < 0) + { + diff = 0.0f - diff; + } + if (pos_delta < 0) + { + pos_delta = 0.0f - pos_delta; + } + + if (pos_delta < diff) + { + UnityTestResultsFailBegin(lineNumber); +#ifdef UNITY_FLOAT_VERBOSE + UnityPrint(UnityStrExpected); + UnityPrintFloat(expected); + UnityPrint(UnityStrWas); + UnityPrintFloat(actual); +#else + UnityPrint(UnityStrDelta); +#endif + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} +#endif + +//----------------------------------------------- +void UnityAssertNumbersWithin( const _U_SINT delta, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style) +{ + UNITY_SKIP_EXECUTION; + + if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT) + { + if (actual > expected) + Unity.CurrentTestFailed = ((actual - expected) > delta); + else + Unity.CurrentTestFailed = ((expected - actual) > delta); + } + else + { + if ((_U_UINT)actual > (_U_UINT)expected) + Unity.CurrentTestFailed = ((_U_UINT)(actual - expected) > (_U_UINT)delta); + else + Unity.CurrentTestFailed = ((_U_UINT)(expected - actual) > (_U_UINT)delta); + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrDelta); + UnityPrintNumberByStyle(delta, style); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(expected, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(actual, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualString(const char* expected, + const char* actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UU32 i; + + UNITY_SKIP_EXECUTION; + + // if both pointers not null compare the strings + if (expected && actual) + { + for (i = 0; expected[i] || actual[i]; i++) + { + if (expected[i] != actual[i]) + { + Unity.CurrentTestFailed = 1; + break; + } + } + } + else + { // handle case of one pointers being null (if both null, test should pass) + if (expected != actual) + { + Unity.CurrentTestFailed = 1; + } + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrintExpectedAndActualStrings(expected, actual); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualStringArray( const char** expected, + const char** actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UU32 i, j = 0; + + UNITY_SKIP_EXECUTION; + + // if no elements, it's an error + if (num_elements == 0) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + do + { + // if both pointers not null compare the strings + if (expected[j] && actual[j]) + { + for (i = 0; expected[j][i] || actual[j][i]; i++) + { + if (expected[j][i] != actual[j][i]) + { + Unity.CurrentTestFailed = 1; + break; + } + } + } + else + { // handle case of one pointers being null (if both null, test should pass) + if (expected[j] != actual[j]) + { + Unity.CurrentTestFailed = 1; + } + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + if (num_elements > 1) + { + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - j - 1), UNITY_DISPLAY_STYLE_UINT); + } + UnityPrintExpectedAndActualStrings((const char*)(expected[j]), (const char*)(actual[j])); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + } while (++j < num_elements); +} + +//----------------------------------------------- +void UnityAssertEqualMemory( const void* expected, + const void* actual, + _UU32 length, + _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + unsigned char* expected_ptr = (unsigned char*)expected; + unsigned char* actual_ptr = (unsigned char*)actual; + _UU32 elements = num_elements; + + UNITY_SKIP_EXECUTION; + + if ((elements == 0) || (length == 0)) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + while (elements--) + { + if (memcmp((const void*)expected_ptr, (const void*)actual_ptr, length) != 0) + { + Unity.CurrentTestFailed = 1; + break; + } + expected_ptr += length; + actual_ptr += length; + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + if (num_elements > 1) + { + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + } + UnityPrint(UnityStrMemory); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +// Control Functions +//----------------------------------------------- + +void UnityFail(const char* msg, const UNITY_LINE_TYPE line) +{ + UNITY_SKIP_EXECUTION; + + UnityTestResultsBegin(Unity.TestFile, line); + UnityPrint("FAIL"); + if (msg != NULL) + { + UNITY_OUTPUT_CHAR(':'); + if (msg[0] != ' ') + { + UNITY_OUTPUT_CHAR(' '); + } + UnityPrint(msg); + } + UNITY_FAIL_AND_BAIL; +} + +//----------------------------------------------- +void UnityIgnore(const char* msg, const UNITY_LINE_TYPE line) +{ + UNITY_SKIP_EXECUTION; + + UnityTestResultsBegin(Unity.TestFile, line); + UnityPrint("IGNORE"); + if (msg != NULL) + { + UNITY_OUTPUT_CHAR(':'); + UNITY_OUTPUT_CHAR(' '); + UnityPrint(msg); + } + UNITY_IGNORE_AND_BAIL; +} + +//----------------------------------------------- +void setUp(void); +void tearDown(void); +void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum) +{ + Unity.CurrentTestName = FuncName; + Unity.CurrentTestLineNumber = FuncLineNum; + Unity.NumberOfTests++; + if (TEST_PROTECT()) + { + setUp(); + Func(); + } + if (TEST_PROTECT() && !(Unity.CurrentTestIgnored)) + { + tearDown(); + } + UnityConcludeTest(); +} + +//----------------------------------------------- +void UnityBegin(void) +{ + Unity.NumberOfTests = 0; +} + +//----------------------------------------------- +int UnityEnd(void) +{ + UnityPrint("-----------------------"); + UNITY_PRINT_EOL; + UnityPrintNumber(Unity.NumberOfTests); + UnityPrint(" Tests "); + UnityPrintNumber(Unity.TestFailures); + UnityPrint(" Failures "); + UnityPrintNumber(Unity.TestIgnores); + UnityPrint(" Ignored"); + UNITY_PRINT_EOL; + if (Unity.TestFailures == 0U) + { + UnityPrint("OK"); + } + else + { + UnityPrint("FAIL"); + } + UNITY_PRINT_EOL; + return Unity.TestFailures; +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/src/unity.h b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/src/unity.h new file mode 100644 index 0000000..0b1b187 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/src/unity.h @@ -0,0 +1,213 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FRAMEWORK_H +#define UNITY_FRAMEWORK_H + +#define UNITY + +#include "unity_internals.h" + +//------------------------------------------------------- +// Configuration Options +//------------------------------------------------------- + +// Integers +// - Unity assumes 32 bit integers by default +// - If your compiler treats ints of a different size, define UNITY_INT_WIDTH + +// Floats +// - define UNITY_EXCLUDE_FLOAT to disallow floating point comparisons +// - define UNITY_FLOAT_PRECISION to specify the precision to use when doing TEST_ASSERT_EQUAL_FLOAT +// - define UNITY_FLOAT_TYPE to specify doubles instead of single precision floats +// - define UNITY_FLOAT_VERBOSE to print floating point values in errors (uses sprintf) + +// Output +// - by default, Unity prints to standard out with putchar. define UNITY_OUTPUT_CHAR(a) with a different function if desired + +// Optimization +// - by default, line numbers are stored in unsigned shorts. Define UNITY_LINE_TYPE with a different type if your files are huge +// - by default, test and failure counters are unsigned shorts. Define UNITY_COUNTER_TYPE with a different type if you want to save space or have more than 65535 Tests. + +// Test Cases +// - define UNITY_SUPPORT_TEST_CASES to include the TEST_CASE macro, though really it's mostly about the runner generator script + +// Parameterized Tests +// - you'll want to create a define of TEST_CASE(...) which basically evaluates to nothing + +//------------------------------------------------------- +// Test Running Macros +//------------------------------------------------------- + +#define TEST_PROTECT() (setjmp(Unity.AbortFrame) == 0) + +#define TEST_ABORT() {longjmp(Unity.AbortFrame, 1);} + +#ifndef RUN_TEST +#define RUN_TEST(func, line_num) UnityDefaultTestRun(func, #func, line_num) +#endif + +#define TEST_LINE_NUM (Unity.CurrentTestLineNumber) +#define TEST_IS_IGNORED (Unity.CurrentTestIgnored) + +//------------------------------------------------------- +// Basic Fail and Ignore +//------------------------------------------------------- + +#define TEST_FAIL_MESSAGE(message) UNITY_TEST_FAIL(__LINE__, message) +#define TEST_FAIL() UNITY_TEST_FAIL(__LINE__, NULL) +#define TEST_IGNORE_MESSAGE(message) UNITY_TEST_IGNORE(__LINE__, message) +#define TEST_IGNORE() UNITY_TEST_IGNORE(__LINE__, NULL) +#define TEST_ONLY() + +//------------------------------------------------------- +// Test Asserts (simple) +//------------------------------------------------------- + +//Boolean +#define TEST_ASSERT(condition) UNITY_TEST_ASSERT( (condition), __LINE__, " Expression Evaluated To FALSE") +#define TEST_ASSERT_TRUE(condition) UNITY_TEST_ASSERT( (condition), __LINE__, " Expected TRUE Was FALSE") +#define TEST_ASSERT_UNLESS(condition) UNITY_TEST_ASSERT( !(condition), __LINE__, " Expression Evaluated To TRUE") +#define TEST_ASSERT_FALSE(condition) UNITY_TEST_ASSERT( !(condition), __LINE__, " Expected FALSE Was TRUE") +#define TEST_ASSERT_NULL(pointer) UNITY_TEST_ASSERT_NULL( (pointer), __LINE__, " Expected NULL") +#define TEST_ASSERT_NOT_NULL(pointer) UNITY_TEST_ASSERT_NOT_NULL((pointer), __LINE__, " Expected Non-NULL") + +//Integers (of all sizes) +#define TEST_ASSERT_EQUAL_INT(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT8(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT8((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT16(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT16((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT32(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT32((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT64(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT64((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_NOT_EQUAL(expected, actual) UNITY_TEST_ASSERT(((expected) != (actual)), __LINE__, " Expected Not-Equal") +#define TEST_ASSERT_EQUAL_UINT(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT8(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT8( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT16(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT16( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT32(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT32( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT64(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT64( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX8(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX8( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX16(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX16((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX32(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX64(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX64((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_BITS(mask, expected, actual) UNITY_TEST_ASSERT_BITS((mask), (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_BITS_HIGH(mask, actual) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(-1), (actual), __LINE__, NULL) +#define TEST_ASSERT_BITS_LOW(mask, actual) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(0), (actual), __LINE__, NULL) +#define TEST_ASSERT_BIT_HIGH(bit, actual) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(-1), (actual), __LINE__, NULL) +#define TEST_ASSERT_BIT_LOW(bit, actual) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(0), (actual), __LINE__, NULL) + +//Integer Ranges (of all sizes) +#define TEST_ASSERT_INT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_UINT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX8_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX16_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX32_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX64_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, __LINE__, NULL) + +//Structs and Strings +#define TEST_ASSERT_EQUAL_PTR(expected, actual) UNITY_TEST_ASSERT_EQUAL_PTR((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_STRING(expected, actual) UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_MEMORY(expected, actual, len) UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, __LINE__, NULL) + +//Arrays +#define TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements) UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, __LINE__, NULL) + +//Floating Point (If Enabled) +#define TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_FLOAT(expected, actual) UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, __LINE__, NULL) + +//------------------------------------------------------- +// Test Asserts (with additional messages) +//------------------------------------------------------- + +//Boolean +#define TEST_ASSERT_MESSAGE(condition, message) UNITY_TEST_ASSERT( (condition), __LINE__, message) +#define TEST_ASSERT_TRUE_MESSAGE(condition, message) UNITY_TEST_ASSERT( (condition), __LINE__, message) +#define TEST_ASSERT_UNLESS_MESSAGE(condition, message) UNITY_TEST_ASSERT( !(condition), __LINE__, message) +#define TEST_ASSERT_FALSE_MESSAGE(condition, message) UNITY_TEST_ASSERT( !(condition), __LINE__, message) +#define TEST_ASSERT_NULL_MESSAGE(pointer, message) UNITY_TEST_ASSERT_NULL( (pointer), __LINE__, message) +#define TEST_ASSERT_NOT_NULL_MESSAGE(pointer, message) UNITY_TEST_ASSERT_NOT_NULL((pointer), __LINE__, message) + +//Integers (of all sizes) +#define TEST_ASSERT_EQUAL_INT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT8((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT16((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT32((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT64((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, message) +#define TEST_ASSERT_NOT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT(((expected) != (actual)), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT8( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT16( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT32( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT64( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX8( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX16((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX64((expected), (actual), __LINE__, message) +#define TEST_ASSERT_BITS_MESSAGE(mask, expected, actual, message) UNITY_TEST_ASSERT_BITS((mask), (expected), (actual), __LINE__, message) +#define TEST_ASSERT_BITS_HIGH_MESSAGE(mask, actual, message) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(-1), (actual), __LINE__, message) +#define TEST_ASSERT_BITS_LOW_MESSAGE(mask, actual, message) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(0), (actual), __LINE__, message) +#define TEST_ASSERT_BIT_HIGH_MESSAGE(bit, actual, message) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(-1), (actual), __LINE__, message) +#define TEST_ASSERT_BIT_LOW_MESSAGE(bit, actual, message) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(0), (actual), __LINE__, message) + +//Integer Ranges (of all sizes) +#define TEST_ASSERT_INT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_UINT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX8_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX16_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX32_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX64_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, __LINE__, message) + +//Structs and Strings +#define TEST_ASSERT_EQUAL_PTR_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_PTR(expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_STRING_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_MEMORY_MESSAGE(expected, actual, len, message) UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, __LINE__, message) + +//Arrays +#define TEST_ASSERT_EQUAL_INT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_STRING_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_MEMORY_ARRAY_MESSAGE(expected, actual, len, num_elements, message) UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, __LINE__, message) + +//Floating Point (If Enabled) +#define TEST_ASSERT_FLOAT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_FLOAT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_FLOAT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, __LINE__, message) +#endif diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/src/unity_internals.h b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/src/unity_internals.h new file mode 100644 index 0000000..29c9d1d --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/src/unity_internals.h @@ -0,0 +1,355 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_INTERNALS_H +#define UNITY_INTERNALS_H + +#include +#include + +//------------------------------------------------------- +// Int Support +//------------------------------------------------------- + +#ifndef UNITY_INT_WIDTH +#define UNITY_INT_WIDTH (32) +#endif + +#ifndef UNITY_LONG_WIDTH +#define UNITY_LONG_WIDTH (32) +#endif + +#if (UNITY_INT_WIDTH == 32) + typedef unsigned char _UU8; + typedef unsigned short _UU16; + typedef unsigned int _UU32; + typedef signed char _US8; + typedef signed short _US16; + typedef signed int _US32; +#elif (UNITY_INT_WIDTH == 16) + typedef unsigned char _UU8; + typedef unsigned int _UU16; + typedef unsigned long _UU32; + typedef signed char _US8; + typedef signed int _US16; + typedef signed long _US32; +#else + #error Invalid UNITY_INT_WIDTH specified! (16 or 32 are supported) +#endif + +//------------------------------------------------------- +// 64-bit Support +//------------------------------------------------------- + +#ifndef UNITY_SUPPORT_64 + +//No 64-bit Support +typedef _UU32 _U_UINT; +typedef _US32 _U_SINT; + +#else + +//64-bit Support +#if (UNITY_LONG_WIDTH == 32) + typedef unsigned long long _UU64; + typedef signed long long _US64; +#elif (UNITY_LONG_WIDTH == 64) + typedef unsigned long _UU64; + typedef signed long _US64; +#else + #error Invalid UNITY_LONG_WIDTH specified! (32 or 64 are supported) +#endif +typedef _UU64 _U_UINT; +typedef _US64 _U_SINT; + +#endif + +//------------------------------------------------------- +// Pointer Support +//------------------------------------------------------- + +#ifndef UNITY_POINTER_WIDTH +#define UNITY_POINTER_WIDTH (32) +#endif + +#if (UNITY_POINTER_WIDTH == 32) + typedef _UU32 _UP; +#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX32 +#elif (UNITY_POINTER_WIDTH == 64) + typedef _UU64 _UP; +#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX64 +#elif (UNITY_POINTER_WIDTH == 16) + typedef _UU16 _UP; +#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX16 +#else + #error Invalid UNITY_POINTER_WIDTH specified! (16, 32 or 64 are supported) +#endif + +//------------------------------------------------------- +// Float Support +//------------------------------------------------------- + +#ifdef UNITY_EXCLUDE_FLOAT + +//No Floating Point Support +#undef UNITY_FLOAT_PRECISION +#undef UNITY_FLOAT_TYPE +#undef UNITY_FLOAT_VERBOSE + +#else + +//Floating Point Support +#ifndef UNITY_FLOAT_PRECISION +#define UNITY_FLOAT_PRECISION (0.00001f) +#endif +#ifndef UNITY_FLOAT_TYPE +#define UNITY_FLOAT_TYPE float +#endif +typedef UNITY_FLOAT_TYPE _UF; + +#endif + +//------------------------------------------------------- +// Output Method +//------------------------------------------------------- + +#ifndef UNITY_OUTPUT_CHAR +//Default to using putchar, which is defined in stdio.h above +#define UNITY_OUTPUT_CHAR(a) putchar(a) +#else +//If defined as something else, make sure we declare it here so it's ready for use +extern int UNITY_OUTPUT_CHAR(int); +#endif + +//------------------------------------------------------- +// Footprint +//------------------------------------------------------- + +#ifndef UNITY_LINE_TYPE +#define UNITY_LINE_TYPE unsigned short +#endif + +#ifndef UNITY_COUNTER_TYPE +#define UNITY_COUNTER_TYPE unsigned short +#endif + +//------------------------------------------------------- +// Internal Structs Needed +//------------------------------------------------------- + +typedef void (*UnityTestFunction)(void); + +#define UNITY_DISPLAY_RANGE_INT (0x10) +#define UNITY_DISPLAY_RANGE_UINT (0x20) +#define UNITY_DISPLAY_RANGE_HEX (0x40) +#define UNITY_DISPLAY_RANGE_AUTO (0x80) + +typedef enum +{ + UNITY_DISPLAY_STYLE_INT = 4 + UNITY_DISPLAY_RANGE_INT + UNITY_DISPLAY_RANGE_AUTO, + UNITY_DISPLAY_STYLE_INT8 = 1 + UNITY_DISPLAY_RANGE_INT, + UNITY_DISPLAY_STYLE_INT16 = 2 + UNITY_DISPLAY_RANGE_INT, + UNITY_DISPLAY_STYLE_INT32 = 4 + UNITY_DISPLAY_RANGE_INT, +#ifdef UNITY_SUPPORT_64 + UNITY_DISPLAY_STYLE_INT64 = 8 + UNITY_DISPLAY_RANGE_INT, +#endif + UNITY_DISPLAY_STYLE_UINT = 4 + UNITY_DISPLAY_RANGE_UINT + UNITY_DISPLAY_RANGE_AUTO, + UNITY_DISPLAY_STYLE_UINT8 = 1 + UNITY_DISPLAY_RANGE_UINT, + UNITY_DISPLAY_STYLE_UINT16 = 2 + UNITY_DISPLAY_RANGE_UINT, + UNITY_DISPLAY_STYLE_UINT32 = 4 + UNITY_DISPLAY_RANGE_UINT, +#ifdef UNITY_SUPPORT_64 + UNITY_DISPLAY_STYLE_UINT64 = 8 + UNITY_DISPLAY_RANGE_UINT, +#endif + UNITY_DISPLAY_STYLE_HEX8 = 1 + UNITY_DISPLAY_RANGE_HEX, + UNITY_DISPLAY_STYLE_HEX16 = 2 + UNITY_DISPLAY_RANGE_HEX, + UNITY_DISPLAY_STYLE_HEX32 = 4 + UNITY_DISPLAY_RANGE_HEX, +#ifdef UNITY_SUPPORT_64 + UNITY_DISPLAY_STYLE_HEX64 = 8 + UNITY_DISPLAY_RANGE_HEX, +#endif +} UNITY_DISPLAY_STYLE_T; + +struct _Unity +{ + const char* TestFile; + const char* CurrentTestName; + _UU32 CurrentTestLineNumber; + UNITY_COUNTER_TYPE NumberOfTests; + UNITY_COUNTER_TYPE TestFailures; + UNITY_COUNTER_TYPE TestIgnores; + UNITY_COUNTER_TYPE CurrentTestFailed; + UNITY_COUNTER_TYPE CurrentTestIgnored; + jmp_buf AbortFrame; +}; + +extern struct _Unity Unity; + +//------------------------------------------------------- +// Test Suite Management +//------------------------------------------------------- + +void UnityBegin(void); +int UnityEnd(void); +void UnityConcludeTest(void); +void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum); + +//------------------------------------------------------- +// Test Output +//------------------------------------------------------- + +void UnityPrint(const char* string); +void UnityPrintMask(const _U_UINT mask, const _U_UINT number); +void UnityPrintNumberByStyle(const _U_SINT number, const UNITY_DISPLAY_STYLE_T style); +void UnityPrintNumber(const _U_SINT number); +void UnityPrintNumberUnsigned(const _U_UINT number); +void UnityPrintNumberHex(const _U_UINT number, const char nibbles); + +#ifdef UNITY_FLOAT_VERBOSE +void UnityPrintFloat(const _UF number); +#endif + +//------------------------------------------------------- +// Test Assertion Fuctions +//------------------------------------------------------- +// Use the macros below this section instead of calling +// these directly. The macros have a consistent naming +// convention and will pull in file and line information +// for you. + +void UnityAssertEqualNumber(const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style); + +void UnityAssertEqualIntArray(const _U_SINT* expected, + const _U_SINT* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style); + +void UnityAssertBits(const _U_SINT mask, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualString(const char* expected, + const char* actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualStringArray( const char** expected, + const char** actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualMemory( const void* expected, + const void* actual, + const _UU32 length, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertNumbersWithin(const _U_SINT delta, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style); + +void UnityFail(const char* message, const UNITY_LINE_TYPE line); + +void UnityIgnore(const char* message, const UNITY_LINE_TYPE line); + +#ifndef UNITY_EXCLUDE_FLOAT +void UnityAssertFloatsWithin(const _UF delta, + const _UF expected, + const _UF actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualFloatArray(const _UF* expected, + const _UF* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber); +#endif + +//------------------------------------------------------- +// Basic Fail and Ignore +//------------------------------------------------------- + +#define UNITY_TEST_FAIL(line, message) UnityFail( (message), (UNITY_LINE_TYPE)line); +#define UNITY_TEST_IGNORE(line, message) UnityIgnore( (message), (UNITY_LINE_TYPE)line); + +//------------------------------------------------------- +// Test Asserts +//------------------------------------------------------- + +#define UNITY_TEST_ASSERT(condition, line, message) if (condition) {} else {UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, message);} +#define UNITY_TEST_ASSERT_NULL(pointer, line, message) UNITY_TEST_ASSERT(((pointer) == NULL), (UNITY_LINE_TYPE)line, message) +#define UNITY_TEST_ASSERT_NOT_NULL(pointer, line, message) UNITY_TEST_ASSERT(((pointer) != NULL), (UNITY_LINE_TYPE)line, message) + +#define UNITY_TEST_ASSERT_EQUAL_INT(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_UINT(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_HEX8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX8) +#define UNITY_TEST_ASSERT_EQUAL_HEX16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX16) +#define UNITY_TEST_ASSERT_EQUAL_HEX32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX32) +#define UNITY_TEST_ASSERT_BITS(mask, expected, actual, line, message) UnityAssertBits((_U_SINT)(mask), (_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line) + +#define UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX8) +#define UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX16) +#define UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX32) +#define UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64) + +#define UNITY_TEST_ASSERT_EQUAL_PTR(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(_UP)(expected), (_U_SINT)(_UP)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_POINTER) +#define UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, line, message) UnityAssertEqualString((const char*)(expected), (const char*)(actual), (message), (UNITY_LINE_TYPE)line) +#define UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, line, message) UnityAssertEqualMemory((void*)(expected), (void*)(actual), (_UU32)(len), 1, (message), (UNITY_LINE_TYPE)line) + +#define UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT8) +#define UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT16) +#define UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT32) +#define UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT8) +#define UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT16) +#define UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT32) +#define UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX8) +#define UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX16) +#define UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX32) +#define UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualStringArray((const char**)(expected), (const char**)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line) +#define UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, line, message) UnityAssertEqualMemory((void*)(expected), (void*)(actual), (_UU32)(len), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line) + +#ifdef UNITY_SUPPORT_64 +#define UNITY_TEST_ASSERT_EQUAL_INT64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT64) +#define UNITY_TEST_ASSERT_EQUAL_UINT64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT64) +#define UNITY_TEST_ASSERT_EQUAL_HEX64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64) +#define UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT64) +#define UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT64) +#define UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64) +#endif + +#ifdef UNITY_EXCLUDE_FLOAT +#define UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled") +#define UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled") +#define UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled") +#else +#define UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, line, message) UnityAssertFloatsWithin((_UF)(delta), (_UF)(expected), (_UF)(actual), (message), (UNITY_LINE_TYPE)line) +#define UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, line, message) UNITY_TEST_ASSERT_FLOAT_WITHIN((_UF)(expected) * (_UF)UNITY_FLOAT_PRECISION, (_UF)expected, (_UF)actual, (UNITY_LINE_TYPE)line, message) +#define UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualFloatArray((_UF*)(expected), (_UF*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line) +#endif + +#endif diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/targets/gcc.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/targets/gcc.yml new file mode 100644 index 0000000..0f18c6c --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/targets/gcc.yml @@ -0,0 +1,42 @@ +compiler: + path: gcc + source_path: 'src/' + unit_tests_path: &unit_tests_path 'test/' + build_path: &build_path 'build/' + options: + - '-c' + - '-Wall' + - '-Wno-address' + - '-std=c99' + - '-pedantic' + includes: + prefix: '-I' + items: + - 'src/' + - '../src/' + - *unit_tests_path + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - UNITY_SUPPORT_TEST_CASES + object_files: + prefix: '-o' + extension: '.o' + destination: *build_path +linker: + path: gcc + options: + - -lm + includes: + prefix: '-I' + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.exe' + destination: *build_path +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/targets/gcc_64.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/targets/gcc_64.yml new file mode 100644 index 0000000..97cb958 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/targets/gcc_64.yml @@ -0,0 +1,43 @@ +compiler: + path: gcc + source_path: 'src/' + unit_tests_path: &unit_tests_path 'test/' + build_path: &build_path 'build/' + options: + - '-c' + - '-Wall' + - '-Wno-address' + - '-std=c99' + - '-pedantic' + includes: + prefix: '-I' + items: + - 'src/' + - '../src/' + - *unit_tests_path + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - UNITY_SUPPORT_TEST_CASES + - 'UNITY_POINTER_WIDTH=64' + object_files: + prefix: '-o' + extension: '.o' + destination: *build_path +linker: + path: gcc + options: + - -lm + includes: + prefix: '-I' + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.exe' + destination: *build_path +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/targets/hitech_picc18.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/targets/hitech_picc18.yml new file mode 100644 index 0000000..210d944 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/targets/hitech_picc18.yml @@ -0,0 +1,101 @@ +# rumor has it that this yaml file works for the standard edition of the +# hitech PICC18 compiler, but not the pro version. +# +compiler: + path: cd build && picc18 + source_path: 'c:\Projects\NexGen\Prototypes\CMockTest\src\' + unit_tests_path: &unit_tests_path 'c:\Projects\NexGen\Prototypes\CMockTest\test\' + build_path: &build_path 'c:\Projects\NexGen\Prototypes\CMockTest\build\' + options: + - --chip=18F87J10 + - --ide=hitide + - --q #quiet please + - --asmlist + - --codeoffset=0 + - --emi=wordwrite # External memory interface protocol + - --warn=0 # allow all normal warning messages + - --errors=10 # Number of errors before aborting compile + - --char=unsigned + - -Bl # Large memory model + - -G # generate symbol file + - --cp=16 # 16-bit pointers + - --double=24 + - -N255 # 255-char symbol names + - --opt=none # Do not use any compiler optimziations + - -c # compile only + - -M + includes: + prefix: '-I' + items: + - 'c:/Projects/NexGen/Prototypes/CMockTest/src/' + - 'c:/Projects/NexGen/Prototypes/CMockTest/mocks/' + - 'c:/CMock/src/' + - 'c:/CMock/examples/src/' + - 'c:/CMock/vendor/unity/src/' + - 'c:/CMock/vendor/unity/examples/helper/' + - *unit_tests_path + defines: + prefix: '-D' + items: + - UNITY_INT_WIDTH=16 + - UNITY_POINTER_WIDTH=16 + - CMOCK_MEM_STATIC + - CMOCK_MEM_SIZE=3000 + - UNITY_SUPPORT_TEST_CASES + - _PICC18 + object_files: + # prefix: '-O' # Hi-Tech doesn't want a prefix. They key off of filename .extensions, instead + extension: '.obj' + destination: *build_path + +linker: + path: cd build && picc18 + options: + - --chip=18F87J10 + - --ide=hitide + - --cp=24 # 24-bit pointers. Is this needed for linker?? + - --double=24 # Is this needed for linker?? + - -Lw # Scan the pic87*w.lib in the lib/ of the compiler installation directory + - --summary=mem,file # info listing + - --summary=+psect + - --summary=+hex + - --output=+intel + - --output=+mcof + - --runtime=+init # Directs startup code to copy idata, ibigdata and ifardata psects from ROM to RAM. + - --runtime=+clear # Directs startup code to clear bss, bigbss, rbss and farbss psects + - --runtime=+clib # link in the c-runtime + - --runtime=+keep # Keep the generated startup src after its obj is linked + - -G # Generate src-level symbol file + - -MIWasTheLastToBuild.map + - --warn=0 # allow all normal warning messages + - -Bl # Large memory model (probably not needed for linking) + includes: + prefix: '-I' + object_files: + path: *build_path + extension: '.obj' + bin_files: + prefix: '-O' + extension: '.hex' + destination: *build_path + +simulator: + path: + pre_support: + - 'java -client -jar ' # note space + - ['C:\Program Files\HI-TECH Software\HI-TIDE\3.15\lib\', 'simpic18.jar'] + - 18F87J10 + post_support: + +:cmock: + :plugins: [] + :includes: + - Types.h + :suite_teardown: | + if (num_failures) + _FAILED_TEST(); + else + _PASSED_TESTS(); + return 0; + +colour: true \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_arm_v4.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_arm_v4.yml new file mode 100644 index 0000000..c2e7f18 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_arm_v4.yml @@ -0,0 +1,89 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 4.0 Kickstart\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\lib\dl4tptinl8n.h'] + - -z3 + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian little + - --cpu ARM7TDMI + - --stack_align 4 + - --interwork + - -e + - --silent + - --warnings_are_errors + - --fpu None + - --diag_suppress Pa050 + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'common\bin\xlink.exe'] + options: + - -rt + - [*tools_root, 'arm\lib\dl4tptinl8n.r79'] + - -D_L_EXTMEM_START=0 + - -D_L_EXTMEM_SIZE=0 + - -D_L_HEAP_SIZE=120 + - -D_L_STACK_SIZE=32 + - -e_small_write=_formatted_write + - -s + - __program_start + - -f + - [*tools_root, '\arm\config\lnkarm.xcl'] + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\config\'] + - [*tools_root, 'arm\lib\'] + object_files: + path: *build_path + extension: '.r79' + bin_files: + prefix: '-o' + extension: '.d79' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\ioat91sam7X256.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_arm_v5.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_arm_v5.yml new file mode 100644 index 0000000..0549d8e --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_arm_v5.yml @@ -0,0 +1,79 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian=little + - --cpu=ARM7TDMI + - --interwork + - --warnings_are_errors + - --fpu=None + - --diag_suppress=Pa050 + - --diag_suppress=Pe111 + - -e + - -On + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\debugger\atmel\ioat91sam7X256.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_arm_v5_3.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_arm_v5_3.yml new file mode 100644 index 0000000..0549d8e --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_arm_v5_3.yml @@ -0,0 +1,79 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian=little + - --cpu=ARM7TDMI + - --interwork + - --warnings_are_errors + - --fpu=None + - --diag_suppress=Pa050 + - --diag_suppress=Pe111 + - -e + - -On + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\debugger\atmel\ioat91sam7X256.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml new file mode 100644 index 0000000..eb0785c --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml @@ -0,0 +1,93 @@ +#Default tool path for IAR 5.4 on Windows XP 64bit +tools_root: &tools_root 'C:\Program Files (x86)\IAR Systems\Embedded Workbench 5.4 Kickstart\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --diag_suppress=Pa050 + #- --diag_suppress=Pe111 + - --debug + - --endian=little + - --cpu=Cortex-M3 + - --no_path_in_file_macros + - -e + - --fpu=None + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + #- --preinclude --preinclude C:\Vss\T2 Working\common\system.h + - --interwork + - --warnings_are_errors +# - Ohz + - -Oh +# - --no_cse +# - --no_unroll +# - --no_inline +# - --no_code_motion +# - --no_tbaa +# - --no_clustering +# - --no_scheduling + + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - ewarm + - PART_LM3S9B92 + - TARGET_IS_TEMPEST_RB1 + - USE_ROM_DRIVERS + - UART_BUFFERED + - UNITY_SUPPORT_64 + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic.icf'] +# - ['C:\Temp\lm3s9b92.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + #- --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim2.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - --endian=little + - --cpu=Cortex-M3 + - --fpu=None + - -p + - [*tools_root, 'arm\config\debugger\TexasInstruments\iolm3sxxxx.ddf'] + - --semihosting + - --device=LM3SxBxx + #- -d + #- sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_cortexm3_v5.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_cortexm3_v5.yml new file mode 100644 index 0000000..cf0d1d0 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_cortexm3_v5.yml @@ -0,0 +1,83 @@ +# unit testing under iar compiler / simulator for STM32 Cortex-M3 + +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.4\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian=little + - --cpu=Cortex-M3 + - --interwork + - --warnings_are_errors + - --fpu=None + - --diag_suppress=Pa050 + - --diag_suppress=Pe111 + - -e + - -On + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - 'IAR' + - 'UNITY_SUPPORT_64' + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic_cortex.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\debugger\ST\iostm32f107xx.ddf'] + - --cpu=Cortex-M3 + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_msp430.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_msp430.yml new file mode 100644 index 0000000..e022647 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_msp430.yml @@ -0,0 +1,94 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3 MSP430\' +core_root: &core_root [*tools_root, '430\'] +core_bin: &core_bin [*core_root, 'bin\'] +core_config: &core_config [*core_root, 'config\'] +core_lib: &core_lib [*core_root, 'lib\'] +core_inc: &core_inc [*core_root, 'inc\'] +core_config: &core_config [*core_root, 'config\'] + +compiler: + path: [*core_bin, 'icc430.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*core_lib, 'dlib\dl430fn.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --debug + - -e + - -Ol + - --multiplier=16 + - --double=32 + - --diag_suppress Pa050 + - --diag_suppress Pe111 + includes: + prefix: '-I' + items: + - *core_inc + - [*core_inc, 'dlib'] + - [*core_lib, 'dlib'] + - 'src\' + - '../src/' + - *unit_tests_path + - 'vendor\unity\src' + defines: + prefix: '-D' + items: + - '__MSP430F149__' + - 'INT_WIDTH=16' + - 'UNITY_EXCLUDE_FLOAT' + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r43' + destination: *build_path +linker: + path: [*core_bin, 'xlink.exe'] + options: + - -rt + - [*core_lib, 'dlib\dl430fn.r43'] + - -e_PrintfTiny=_Printf + - -e_ScanfSmall=_Scanf + - -s __program_start + - -D_STACK_SIZE=50 + - -D_DATA16_HEAP_SIZE=50 + - -D_DATA20_HEAP_SIZE=50 + - -f + - [*core_config, 'lnk430f5438.xcl'] + - -f + - [*core_config, 'multiplier.xcl'] + includes: + prefix: '-I' + items: + - *core_config + - *core_lib + - [*core_lib, 'dlib'] + object_files: + path: *build_path + extension: '.r79' + bin_files: + prefix: '-o' + extension: '.d79' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*core_bin, '430proc.dll'] + - [*core_bin, '430sim.dll'] + post_support: + - --plugin + - [*core_bin, '430bat.dll'] + - --backend -B + - --cpu MSP430F5438 + - -p + - [*core_config, 'MSP430F5438.ddf'] + - -d sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_sh2a_v6.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_sh2a_v6.yml new file mode 100644 index 0000000..ddc5603 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_sh2a_v6.yml @@ -0,0 +1,85 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 6.0\' +compiler: + path: [*tools_root, 'sh\bin\iccsh.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - -e + - --char_is_signed + - -Ol + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_scheduling + - --no_clustering + - --debug + - --dlib_config + - [*tools_root, 'sh\inc\DLib_Product.h'] + - --double=32 + - --code_model=huge + - --data_model=huge + - --core=sh2afpu + - --warnings_affect_exit_code + - --warnings_are_errors + - --mfc + - --use_unix_directory_separators + - --diag_suppress=Pe161 + includes: + prefix: '-I' + items: + - [*tools_root, 'sh\inc\'] + - [*tools_root, 'sh\inc\c'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.o' + destination: *build_path +linker: + path: [*tools_root, 'sh\bin\ilinksh.exe'] + options: + - --redirect __Printf=__PrintfSmall + - --redirect __Scanf=__ScanfSmall + - --config + - [*tools_root, 'sh\config\generic.icf'] + - --config_def _CSTACK_SIZE=0x800 + - --config_def _HEAP_SIZE=0x800 + - --config_def _INT_TABLE=0x10 + - --entry __iar_program_start + - --debug_lib + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'sh\bin\shproc.dll'] + - [*tools_root, 'sh\bin\shsim.dll'] + post_support: + - --plugin + - [*tools_root, 'sh\bin\shbat.dll'] + - --backend + - -B + - --core sh2afpu + - -p + - [*tools_root, 'sh\config\debugger\io7264.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_cmd.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_cmd.c new file mode 100644 index 0000000..42841d8 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_cmd.c @@ -0,0 +1,54 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include +#include "CException.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_def.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_def.c new file mode 100644 index 0000000..8280804 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_def.c @@ -0,0 +1,50 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_cmd.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_cmd.c new file mode 100644 index 0000000..e47b31c --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_cmd.c @@ -0,0 +1,76 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_def.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_def.c new file mode 100644 index 0000000..3ca9dba --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_def.c @@ -0,0 +1,72 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new1.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new1.c new file mode 100644 index 0000000..a7cbcd8 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new1.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + GlobalExpectCount = 0; + GlobalVerifyOrder = 0; + GlobalOrderError = NULL; + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new2.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new2.c new file mode 100644 index 0000000..2c76bf2 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new2.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_param.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_param.c new file mode 100644 index 0000000..23c04f4 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_param.c @@ -0,0 +1,73 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST_NO_ARGS +#define RUN_TEST(TestFunc, TestLineNum, ...) \ +{ \ + Unity.CurrentTestName = #TestFunc "(" #__VA_ARGS__ ")"; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(__VA_ARGS__); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21, RUN_TEST_NO_ARGS); + RUN_TEST(test_TheSecondThingToTest, 43, RUN_TEST_NO_ARGS); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run1.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run1.c new file mode 100644 index 0000000..a7cbcd8 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run1.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + GlobalExpectCount = 0; + GlobalVerifyOrder = 0; + GlobalOrderError = NULL; + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run2.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run2.c new file mode 100644 index 0000000..2c76bf2 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run2.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_yaml.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_yaml.c new file mode 100644 index 0000000..68b545a --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_yaml.c @@ -0,0 +1,86 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include "two.h" +#include "three.h" +#include +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_yaml_setup(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_new1.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_new1.c new file mode 100644 index 0000000..e5bcac2 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_new1.c @@ -0,0 +1,60 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_new2.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_new2.c new file mode 100644 index 0000000..b7c7e5b --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_new2.c @@ -0,0 +1,63 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_param.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_param.c new file mode 100644 index 0000000..4157007 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_param.c @@ -0,0 +1,51 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST_NO_ARGS +#define RUN_TEST(TestFunc, TestLineNum, ...) \ +{ \ + Unity.CurrentTestName = #TestFunc "(" #__VA_ARGS__ ")"; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(__VA_ARGS__); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21, RUN_TEST_NO_ARGS); + RUN_TEST(test_TheSecondThingToTest, 43, RUN_TEST_NO_ARGS); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_run1.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_run1.c new file mode 100644 index 0000000..e5bcac2 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_run1.c @@ -0,0 +1,60 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_run2.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_run2.c new file mode 100644 index 0000000..b7c7e5b --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_run2.c @@ -0,0 +1,63 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_yaml.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_yaml.c new file mode 100644 index 0000000..d109287 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_yaml.c @@ -0,0 +1,64 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "two.h" +#include "three.h" +#include +#include +#include +#include "CException.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_yaml_setup(); +} + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/test_generate_test_runner.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/test_generate_test_runner.rb new file mode 100644 index 0000000..61c8df9 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/test_generate_test_runner.rb @@ -0,0 +1,94 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +ruby_version = RUBY_VERSION.split('.') +if (ruby_version[1].to_i == 9) and (ruby_version[2].to_i > 1) + require 'rubygems' + gem 'test-unit' +end +require 'test/unit' +require './auto/generate_test_runner.rb' + +TEST_FILE = 'test/testdata/testsample.c' +TEST_MOCK = 'test/testdata/mocksample.c' +OUT_FILE = 'build/testsample_' +EXP_FILE = 'test/expectdata/testsample_' + +class TestGenerateTestRunner < Test::Unit::TestCase + def setup + end + + def teardown + end + + def verify_output_equal(subtest) + expected = File.read(EXP_FILE + subtest + '.c').gsub(/\r\n/,"\n") + actual = File.read(OUT_FILE + subtest + '.c').gsub(/\r\n/,"\n") + assert_equal(expected, actual, "Generated File Sub-Test '#{subtest}' Failed") + end + + def test_ShouldGenerateARunnerByCreatingRunnerWithOptions + sets = { 'def' => nil, + 'new1' => { :plugins => [:cexception], :includes => ['one.h', 'two.h'], :enforce_strict_ordering => true }, + 'new2' => { :plugins => [:ignore], :suite_setup => "a_custom_setup();", :suite_teardown => "a_custom_teardown();" } + } + + sets.each_pair do |subtest, options| + UnityTestRunnerGenerator.new(options).run(TEST_FILE, OUT_FILE + subtest + '.c') + verify_output_equal(subtest) + UnityTestRunnerGenerator.new(options).run(TEST_MOCK, OUT_FILE + 'mock_' + subtest + '.c') + verify_output_equal('mock_' + subtest) + end + end + + def test_ShouldGenerateARunnerByRunningRunnerWithOptions + sets = { 'run1' => { :plugins => [:cexception], :includes => ['one.h', 'two.h'], :enforce_strict_ordering => true }, + 'run2' => { :plugins => [:ignore], :suite_setup => "a_custom_setup();", :suite_teardown => "a_custom_teardown();" } + } + + sets.each_pair do |subtest, options| + UnityTestRunnerGenerator.new.run(TEST_FILE, OUT_FILE + subtest + '.c', options) + verify_output_equal(subtest) + UnityTestRunnerGenerator.new.run(TEST_MOCK, OUT_FILE + 'mock_' + subtest + '.c', options) + verify_output_equal('mock_' + subtest) + end + end + + def test_ShouldGenerateARunnerByPullingYamlOptions + subtest = 'yaml' + cmdstr = "ruby auto/generate_test_runner.rb test/testdata/sample.yml \"#{TEST_FILE}\" \"#{OUT_FILE + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal(subtest) + + cmdstr = "ruby auto/generate_test_runner.rb test/testdata/sample.yml \"#{TEST_MOCK}\" \"#{OUT_FILE + 'mock_' + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal('mock_' + subtest) + end + + def test_ShouldGenerateARunnerByPullingCommandlineOptions + subtest = 'cmd' + cmdstr = "ruby auto/generate_test_runner.rb -cexception \"#{TEST_FILE}\" \"#{OUT_FILE + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal(subtest) + + cmdstr = "ruby auto/generate_test_runner.rb -cexception \"#{TEST_MOCK}\" \"#{OUT_FILE + 'mock_' + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal('mock_' + subtest) + end + + def test_ShouldGenerateARunnerThatUsesParameterizedTests + sets = { 'param' => { :plugins => [:ignore], :use_param_tests => true } + } + + sets.each_pair do |subtest, options| + UnityTestRunnerGenerator.new(options).run(TEST_FILE, OUT_FILE + subtest + '.c') + verify_output_equal(subtest) + UnityTestRunnerGenerator.new(options).run(TEST_MOCK, OUT_FILE + 'mock_' + subtest + '.c') + verify_output_equal('mock_' + subtest) + end + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/testdata/mocksample.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/testdata/mocksample.c new file mode 100644 index 0000000..b709438 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/testdata/mocksample.c @@ -0,0 +1,51 @@ +// This is just a sample test file to be used to test the generator script +#ifndef TEST_SAMPLE_H +#define TEST_SAMPLE_H + +#include +#include "unity.h" +#include "funky.h" +#include "Mockstanky.h" + +void setUp(void) +{ + CustomSetupStuff(); +} + +void tearDown(void) +{ + CustomTeardownStuff +} + +//Yup, nice comment +void test_TheFirstThingToTest(void) +{ + TEST_ASSERT(1); + + TEST_ASSERT_TRUE(1); +} + +/* +void test_ShouldBeIgnored(void) +{ + DoesStuff(); +} +*/ + +//void test_ShouldAlsoNotBeTested(void) +//{ +// Call_An_Expect(); +// +// CallAFunction(); +// test_CallAFunctionThatLooksLikeATest(); +//} + +void test_TheSecondThingToTest(void) +{ + Call_An_Expect(); + + CallAFunction(); + test_CallAFunctionThatLooksLikeATest(); +} + +#endif //TEST_SAMPLE_H diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/testdata/sample.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/testdata/sample.yml new file mode 100644 index 0000000..9e5eece --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/testdata/sample.yml @@ -0,0 +1,9 @@ +:unity: + :includes: + - two.h + - three.h + - + :plugins: + - :cexception + :suite_setup: | + a_yaml_setup(); \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/testdata/testsample.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/testdata/testsample.c new file mode 100644 index 0000000..4f30ec7 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/testdata/testsample.c @@ -0,0 +1,51 @@ +// This is just a sample test file to be used to test the generator script +#ifndef TEST_SAMPLE_H +#define TEST_SAMPLE_H + +#include +#include "unity.h" +#include "funky.h" +#include "stanky.h" + +void setUp(void) +{ + CustomSetupStuff(); +} + +void tearDown(void) +{ + CustomTeardownStuff +} + +//Yup, nice comment +void test_TheFirstThingToTest(void) +{ + TEST_ASSERT(1); + + TEST_ASSERT_TRUE(1); +} + +/* +void test_ShouldBeIgnored(void) +{ + DoesStuff(); +} +*/ + +//void test_ShouldAlsoNotBeTested(void) +//{ +// Call_An_Expect(); +// +// CallAFunction(); +// test_CallAFunctionThatLooksLikeATest(); +//} + +void test_TheSecondThingToTest(void) +{ + Call_An_Expect(); + + CallAFunction(); + test_CallAFunctionThatLooksLikeATest(); +} + +#endif //TEST_SAMPLE_H diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/testparameterized.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/testparameterized.c new file mode 100644 index 0000000..037cd21 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/testparameterized.c @@ -0,0 +1,101 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include +#include "unity.h" + +#define TEST_CASE(...) + +#define EXPECT_ABORT_BEGIN \ + if (TEST_PROTECT()) \ + { + +#define VERIFY_FAILS_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestFailed == 1) ? 0 : 1; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Failed But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +#define VERIFY_IGNORES_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestIgnored == 1) ? 0 : 1; \ + Unity.CurrentTestIgnored = 0; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Ignored But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +int SetToOneToFailInTearDown; +int SetToOneMeanWeAlreadyCheckedThisGuy; + +void setUp(void) +{ + SetToOneToFailInTearDown = 0; + SetToOneMeanWeAlreadyCheckedThisGuy = 0; +} + +void tearDown(void) +{ + if (SetToOneToFailInTearDown == 1) + TEST_FAIL_MESSAGE("<= Failed in tearDown"); + if ((SetToOneMeanWeAlreadyCheckedThisGuy == 0) && (Unity.CurrentTestFailed > 0)) + { + UnityPrint("[[[[ Previous Test Should Have Passed But Did Not ]]]]"); + UNITY_OUTPUT_CHAR('\n'); + } +} + +TEST_CASE(0) +TEST_CASE(44) +TEST_CASE((90)+9) +void test_TheseShouldAllPass(int Num) +{ + TEST_ASSERT_TRUE(Num < 100); +} + +TEST_CASE(3) +TEST_CASE(77) +TEST_CASE( (99) + 1 - (1)) +void test_TheseShouldAllFail(int Num) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(Num > 100); + VERIFY_FAILS_END +} + +TEST_CASE(1) +TEST_CASE(44) +TEST_CASE(99) +TEST_CASE(98) +void test_TheseAreEveryOther(int Num) +{ + if (Num & 1) + { + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(Num > 100); + VERIFY_FAILS_END + } + else + { + TEST_ASSERT_TRUE(Num < 100); + } +} + +void test_NormalPassesStillWork(void) +{ + TEST_ASSERT_TRUE(1); +} + +void test_NormalFailsStillWork(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(0); + VERIFY_FAILS_END +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/testunity.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/testunity.c new file mode 100644 index 0000000..9f826dc --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/cmock/vendor/unity/test/testunity.c @@ -0,0 +1,1510 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include +#include "unity.h" + +#define EXPECT_ABORT_BEGIN \ + if (TEST_PROTECT()) \ + { + +#define VERIFY_FAILS_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestFailed == 1) ? 0 : 1; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Failed But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +#define VERIFY_IGNORES_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestIgnored == 1) ? 0 : 1; \ + Unity.CurrentTestIgnored = 0; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Ignored But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +int SetToOneToFailInTearDown; +int SetToOneMeanWeAlreadyCheckedThisGuy; + +void setUp(void) +{ + SetToOneToFailInTearDown = 0; + SetToOneMeanWeAlreadyCheckedThisGuy = 0; +} + +void tearDown(void) +{ + if (SetToOneToFailInTearDown == 1) + TEST_FAIL_MESSAGE("<= Failed in tearDown"); + if ((SetToOneMeanWeAlreadyCheckedThisGuy == 0) && (Unity.CurrentTestFailed > 0)) + { + UnityPrint("[[[[ Previous Test Should Have Passed But Did Not ]]]]"); + UNITY_OUTPUT_CHAR('\n'); + } +} + +void testTrue(void) +{ + TEST_ASSERT(1); + + TEST_ASSERT_TRUE(1); +} + +void testFalse(void) +{ + TEST_ASSERT_FALSE(0); + + TEST_ASSERT_UNLESS(0); +} + +void testPreviousPass(void) +{ + TEST_ASSERT_EQUAL_INT(0U, Unity.TestFailures); +} + +void testNotVanilla(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT(0); + VERIFY_FAILS_END +} + +void testNotTrue(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(0); + VERIFY_FAILS_END +} + +void testNotFalse(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_FALSE(1); + VERIFY_FAILS_END +} + +void testNotUnless(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UNLESS(1); + VERIFY_FAILS_END +} + +void testNotNotEqual(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_NOT_EQUAL(10, 10); + VERIFY_FAILS_END +} + +void testFail(void) +{ + EXPECT_ABORT_BEGIN + TEST_FAIL_MESSAGE("Expected for testing"); + VERIFY_FAILS_END +} + +void testIsNull(void) +{ + char* ptr1 = NULL; + char* ptr2 = "hello"; + + TEST_ASSERT_NULL(ptr1); + TEST_ASSERT_NOT_NULL(ptr2); +} + +void testIsNullShouldFailIfNot(void) +{ + char* ptr1 = "hello"; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_NULL(ptr1); + VERIFY_FAILS_END +} + +void testNotNullShouldFailIfNULL(void) +{ + char* ptr1 = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_NOT_NULL(ptr1); + VERIFY_FAILS_END +} + +void testIgnore(void) +{ + EXPECT_ABORT_BEGIN + TEST_IGNORE(); + TEST_FAIL_MESSAGE("This should not be reached"); + VERIFY_IGNORES_END +} + +void testIgnoreMessage(void) +{ + EXPECT_ABORT_BEGIN + TEST_IGNORE_MESSAGE("This is an expected TEST_IGNORE_MESSAGE string!"); + TEST_FAIL_MESSAGE("This should not be reached"); + VERIFY_IGNORES_END +} + +void testNotEqualInts(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT(3982, 3983); + VERIFY_FAILS_END +} + +void testNotEqualInt8s(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT8(-127, -126); + VERIFY_FAILS_END +} + +void testNotEqualInt16s(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT16(-16383, -16382); + VERIFY_FAILS_END +} + +void testNotEqualInt32s(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT32(-2147483647, -2147483646); + VERIFY_FAILS_END +} + +void testNotEqualBits(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_BITS(0xFF00, 0x5555, 0x5A55); + VERIFY_FAILS_END +} + +void testNotEqualUInts(void) +{ + _UU16 v0, v1; + + v0 = 9000; + v1 = 9001; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualUInt8s(void) +{ + _UU8 v0, v1; + + v0 = 254; + v1 = 255; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT8(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualUInt16s(void) +{ + _UU16 v0, v1; + + v0 = 65535; + v1 = 65534; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualUInt32s(void) +{ + _UU32 v0, v1; + + v0 = 4294967295; + v1 = 4294967294; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT32(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex8s(void) +{ + _UU8 v0, v1; + + v0 = 0x23; + v1 = 0x22; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex8sIfSigned(void) +{ + _US8 v0, v1; + + v0 = -2; + v1 = 2; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex16s(void) +{ + _UU16 v0, v1; + + v0 = 0x1234; + v1 = 0x1235; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex16sIfSigned(void) +{ + _US16 v0, v1; + + v0 = -1024; + v1 = -1028; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex32s(void) +{ + _UU32 v0, v1; + + v0 = 900000; + v1 = 900001; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex32sIfSigned(void) +{ + _US32 v0, v1; + + v0 = -900000; + v1 = 900001; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32(v0, v1); + VERIFY_FAILS_END +} + +void testEqualInts(void) +{ + int v0, v1; + int *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(1837, 1837); + TEST_ASSERT_EQUAL_INT(-27365, -27365); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(19467, v1); + TEST_ASSERT_EQUAL_INT(v0, 19467); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 19467); +} + +void testEqualUints(void) +{ + unsigned int v0, v1; + unsigned int *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_UINT(1837, 1837); + TEST_ASSERT_EQUAL_UINT(v0, v1); + TEST_ASSERT_EQUAL_UINT(19467, v1); + TEST_ASSERT_EQUAL_UINT(v0, 19467); + TEST_ASSERT_EQUAL_UINT(*p0, v1); + TEST_ASSERT_EQUAL_UINT(*p0, *p1); + TEST_ASSERT_EQUAL_UINT(*p0, 19467); + TEST_ASSERT_EQUAL_UINT(60872u, 60872u); +} + +void testNotEqual(void) +{ + TEST_ASSERT_NOT_EQUAL(0, 1); + TEST_ASSERT_NOT_EQUAL(1, 0); + TEST_ASSERT_NOT_EQUAL(100, 101); + TEST_ASSERT_NOT_EQUAL(0, -1); + TEST_ASSERT_NOT_EQUAL(65535, -65535); + TEST_ASSERT_NOT_EQUAL(75, 900); + TEST_ASSERT_NOT_EQUAL(-100, -101); +} + +void testEqualHex8s(void) +{ + _UU8 v0, v1; + _UU8 *p0, *p1; + + v0 = 0x22; + v1 = 0x22; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX8(0x22, 0x22); + TEST_ASSERT_EQUAL_HEX8(v0, v1); + TEST_ASSERT_EQUAL_HEX8(0x22, v1); + TEST_ASSERT_EQUAL_HEX8(v0, 0x22); + TEST_ASSERT_EQUAL_HEX8(*p0, v1); + TEST_ASSERT_EQUAL_HEX8(*p0, *p1); + TEST_ASSERT_EQUAL_HEX8(*p0, 0x22); +} + +void testEqualHex8sNegatives(void) +{ + _UU8 v0, v1; + _UU8 *p0, *p1; + + v0 = 0xDD; + v1 = 0xDD; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX8(0xDD, 0xDD); + TEST_ASSERT_EQUAL_HEX8(v0, v1); + TEST_ASSERT_EQUAL_HEX8(0xDD, v1); + TEST_ASSERT_EQUAL_HEX8(v0, 0xDD); + TEST_ASSERT_EQUAL_HEX8(*p0, v1); + TEST_ASSERT_EQUAL_HEX8(*p0, *p1); + TEST_ASSERT_EQUAL_HEX8(*p0, 0xDD); +} + +void testEqualHex16s(void) +{ + _UU16 v0, v1; + _UU16 *p0, *p1; + + v0 = 0x9876; + v1 = 0x9876; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX16(0x9876, 0x9876); + TEST_ASSERT_EQUAL_HEX16(v0, v1); + TEST_ASSERT_EQUAL_HEX16(0x9876, v1); + TEST_ASSERT_EQUAL_HEX16(v0, 0x9876); + TEST_ASSERT_EQUAL_HEX16(*p0, v1); + TEST_ASSERT_EQUAL_HEX16(*p0, *p1); + TEST_ASSERT_EQUAL_HEX16(*p0, 0x9876); +} + +void testEqualHex32s(void) +{ + _UU32 v0, v1; + _UU32 *p0, *p1; + + v0 = 0x98765432ul; + v1 = 0x98765432ul; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX32(0x98765432ul, 0x98765432ul); + TEST_ASSERT_EQUAL_HEX32(v0, v1); + TEST_ASSERT_EQUAL_HEX32(0x98765432ul, v1); + TEST_ASSERT_EQUAL_HEX32(v0, 0x98765432ul); + TEST_ASSERT_EQUAL_HEX32(*p0, v1); + TEST_ASSERT_EQUAL_HEX32(*p0, *p1); + TEST_ASSERT_EQUAL_HEX32(*p0, 0x98765432ul); +} + +void testEqualBits(void) +{ + _UU32 v0 = 0xFF55AA00; + _UU32 v1 = 0x55550000; + + TEST_ASSERT_BITS(v1, v0, 0x55550000); + TEST_ASSERT_BITS(v1, v0, 0xFF55CC00); + TEST_ASSERT_BITS(0xFFFFFFFF, v0, 0xFF55AA00); + TEST_ASSERT_BITS(0xFFFFFFFF, v0, v0); + TEST_ASSERT_BITS(0xF0F0F0F0, v0, 0xFC5DAE0F); + TEST_ASSERT_BITS_HIGH(v1, v0); + TEST_ASSERT_BITS_LOW(0x000055FF, v0); + TEST_ASSERT_BIT_HIGH(30, v0); + TEST_ASSERT_BIT_LOW(5, v0); +} + +void testEqualShorts(void) +{ + short v0, v1; + short *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(1837, 1837); + TEST_ASSERT_EQUAL_INT(-2987, -2987); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(19467, v1); + TEST_ASSERT_EQUAL_INT(v0, 19467); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 19467); +} + +void testEqualUShorts(void) +{ + unsigned short v0, v1; + unsigned short *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_UINT(1837, 1837); + TEST_ASSERT_EQUAL_UINT(2987, 2987); + TEST_ASSERT_EQUAL_UINT(v0, v1); + TEST_ASSERT_EQUAL_UINT(19467, v1); + TEST_ASSERT_EQUAL_UINT(v0, 19467); + TEST_ASSERT_EQUAL_UINT(*p0, v1); + TEST_ASSERT_EQUAL_UINT(*p0, *p1); + TEST_ASSERT_EQUAL_UINT(*p0, 19467); +} + +void testEqualChars(void) +{ + signed char v0, v1; + signed char *p0, *p1; + + v0 = 109; + v1 = 109; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(42, 42); + TEST_ASSERT_EQUAL_INT(-116, -116); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(109, v1); + TEST_ASSERT_EQUAL_INT(v0, 109); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 109); +} + +void testEqualUChars(void) +{ + unsigned char v0, v1; + unsigned char *p0, *p1; + + v0 = 251; + v1 = 251; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(42, 42); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(251, v1); + TEST_ASSERT_EQUAL_INT(v0, 251); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 251); +} + +void testEqualPointers(void) +{ + int v0, v1; + int *p0, *p1, *p2; + + v0 = 19467; + v1 = 18271; + p0 = &v0; + p1 = &v1; + p2 = &v1; + + TEST_ASSERT_EQUAL_PTR(p0, &v0); + TEST_ASSERT_EQUAL_PTR(&v1, p1); + TEST_ASSERT_EQUAL_PTR(p2, p1); + TEST_ASSERT_EQUAL_PTR(&v0, &v0); +} + +void testNotEqualPointers(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_PTR(0x12345678, 0x12345677); + VERIFY_FAILS_END +} + +void testIntsWithinDelta(void) +{ + TEST_ASSERT_INT_WITHIN(1, 5000, 5001); + TEST_ASSERT_INT_WITHIN(5, 5000, 4996); + TEST_ASSERT_INT_WITHIN(5, 5000, 5005); + TEST_ASSERT_INT_WITHIN(500, 50, -440); + + TEST_ASSERT_INT_WITHIN(2, -1, -1); + TEST_ASSERT_INT_WITHIN(5, 1, -1); + TEST_ASSERT_INT_WITHIN(5, -1, 1); +} + +void testIntsNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_INT_WITHIN(5, 5000, 5006); + VERIFY_FAILS_END +} + +void testUIntsWithinDelta(void) +{ + TEST_ASSERT_UINT_WITHIN(1, 5000, 5001); + TEST_ASSERT_UINT_WITHIN(5, 5000, 4996); + TEST_ASSERT_UINT_WITHIN(5, 5000, 5005); +} + +void testUIntsNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UINT_WITHIN(1, 2147483647u, 2147483649u); + VERIFY_FAILS_END +} + +void testUIntsNotWithinDeltaEvenThoughASignedIntWouldPassSmallFirst(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UINT_WITHIN(5, 1, -1); + VERIFY_FAILS_END +} + +void testUIntsNotWithinDeltaEvenThoughASignedIntWouldPassBigFirst(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UINT_WITHIN(5, -1, 1); + VERIFY_FAILS_END +} + +void testHEX32sWithinDelta(void) +{ + TEST_ASSERT_HEX32_WITHIN(1, 5000, 5001); + TEST_ASSERT_HEX32_WITHIN(5, 5000, 4996); + TEST_ASSERT_HEX32_WITHIN(5, 5000, 5005); +} + +void testHEX32sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX32_WITHIN(1, 2147483647u, 2147483649u); + VERIFY_FAILS_END +} + +void testHEX32sNotWithinDeltaEvenThoughASignedIntWouldPass(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX32_WITHIN(5, 1, -1); + VERIFY_FAILS_END +} + +void testHEX16sWithinDelta(void) +{ + TEST_ASSERT_HEX16_WITHIN(1, 5000, 5001); + TEST_ASSERT_HEX16_WITHIN(5, 5000, 4996); + TEST_ASSERT_HEX16_WITHIN(5, 5000, 5005); +} + +void testHEX16sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX16_WITHIN(2, 65535, 0); + VERIFY_FAILS_END +} + +void testHEX8sWithinDelta(void) +{ + TEST_ASSERT_HEX8_WITHIN(1, 254, 255); + TEST_ASSERT_HEX8_WITHIN(5, 251, 255); + TEST_ASSERT_HEX8_WITHIN(5, 1, 4); +} + +void testHEX8sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX8_WITHIN(2, 255, 0); + VERIFY_FAILS_END +} + +void testEqualStrings(void) +{ + const char *testString = "foo"; + + TEST_ASSERT_EQUAL_STRING(testString, testString); + TEST_ASSERT_EQUAL_STRING("foo", "foo"); + TEST_ASSERT_EQUAL_STRING("foo", testString); + TEST_ASSERT_EQUAL_STRING(testString, "foo"); + TEST_ASSERT_EQUAL_STRING("", ""); +} + +void testEqualStringsWithCarriageReturnsAndLineFeeds(void) +{ + const char *testString = "foo\r\nbar"; + + TEST_ASSERT_EQUAL_STRING(testString, testString); + TEST_ASSERT_EQUAL_STRING("foo\r\nbar", "foo\r\nbar"); + TEST_ASSERT_EQUAL_STRING("foo\r\nbar", testString); + TEST_ASSERT_EQUAL_STRING(testString, "foo\r\nbar"); + TEST_ASSERT_EQUAL_STRING("", ""); +} + +void testNotEqualString1(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("foo", "bar"); + VERIFY_FAILS_END +} + +void testNotEqualString2(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("foo", ""); + VERIFY_FAILS_END +} + +void testNotEqualString3(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("", "bar"); + VERIFY_FAILS_END +} + +void testNotEqualString4(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("bar\r", "bar\n"); + VERIFY_FAILS_END +} + +void testNotEqualString5(void) +{ + const char str1[] = { 0x41, 0x42, 0x03, 0x00 }; + const char str2[] = { 0x41, 0x42, 0x04, 0x00 }; + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING(str1, str2); + VERIFY_FAILS_END +} + +void testNotEqualString_ExpectedStringIsNull(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING(NULL, "bar"); + VERIFY_FAILS_END +} + +void testNotEqualString_ActualStringIsNull(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("foo", NULL); + VERIFY_FAILS_END +} + +void testEqualStringArrays(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, expStrings, 3); + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 3); + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 2); + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 1); +} + +void testNotEqualStringArray1(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray2(void) +{ + const char *testStrings[] = { "zoo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", "boo", "woo", "moo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray3(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", NULL }; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray4(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", NULL, "woo", "moo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray5(void) +{ + const char **testStrings = NULL; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray6(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "zoo" }; + const char **expStrings = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testEqualStringArrayIfBothNulls(void) +{ + const char **testStrings = NULL; + const char **expStrings = NULL; + + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); +} + +void testEqualMemory(void) +{ + const char *testString = "whatever"; + + TEST_ASSERT_EQUAL_MEMORY(testString, testString, 8); + TEST_ASSERT_EQUAL_MEMORY("whatever", "whatever", 8); + TEST_ASSERT_EQUAL_MEMORY("whatever", testString, 8); + TEST_ASSERT_EQUAL_MEMORY(testString, "whatever", 8); + TEST_ASSERT_EQUAL_MEMORY(testString, "whatever", 2); + TEST_ASSERT_EQUAL_MEMORY(NULL, NULL, 1); +} + +void testNotEqualMemory1(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY("foo", "bar", 3); + VERIFY_FAILS_END +} + +void testNotEqualMemory2(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY("fool", "food", 4); + VERIFY_FAILS_END +} + +void testNotEqualMemory3(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY(NULL, "food", 4); + VERIFY_FAILS_END +} + +void testNotEqualMemory4(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY("fool", NULL, 4); + VERIFY_FAILS_END +} + +void testEqualIntArrays(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, -2}; + int p2[] = {1, 8, 987, 2}; + int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p3, 1); +} + +void testNotEqualIntArraysNullExpected(void) +{ + int* p0 = NULL; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArraysNullActual(void) +{ + int* p1 = NULL; + int p0[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArrays1(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArrays2(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {2, 8, 987, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArrays3(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 986, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualInt8Arrays(void) +{ + _US8 p0[] = {1, 8, 117, -2}; + _US8 p1[] = {1, 8, 117, -2}; + _US8 p2[] = {1, 8, 117, 2}; + _US8 p3[] = {1, 50, 60, 70}; + + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p3, 1); +} + +void testNotEqualInt8Arrays(void) +{ + _US8 p0[] = {1, 8, 127, -2}; + _US8 p1[] = {1, 8, 127, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualUIntArrays(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65132u}; + unsigned int p2[] = {1, 8, 987, 2}; + unsigned int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p3, 1); +} + +void testNotEqualUIntArrays1(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUIntArrays2(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUIntArrays3(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualInt16Arrays(void) +{ + _UU16 p0[] = {1, 8, 117, 3}; + _UU16 p1[] = {1, 8, 117, 3}; + _UU16 p2[] = {1, 8, 117, 2}; + _UU16 p3[] = {1, 50, 60, 70}; + + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p3, 1); +} + +void testNotEqualInt16Arrays(void) +{ + _UU16 p0[] = {1, 8, 127, 3}; + _UU16 p1[] = {1, 8, 127, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualUINT16Arrays(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65132u}; + unsigned short p2[] = {1, 8, 987, 2}; + unsigned short p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p3, 1); +} + +void testNotEqualUINT16Arrays1(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUINT16Arrays2(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUINT16Arrays3(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualHEXArrays(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65132u}; + unsigned int p2[] = {1, 8, 987, 2}; + unsigned int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p3, 1); +} + +void testNotEqualHEXArrays1(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEXArrays2(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEXArrays3(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualHEX16Arrays(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65132u}; + unsigned short p2[] = {1, 8, 987, 2}; + unsigned short p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p3, 1); +} + +void testNotEqualHEX16Arrays1(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX16Arrays2(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX16Arrays3(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualHEX8Arrays(void) +{ + unsigned short p0[] = {1, 8, 254u, 123}; + unsigned short p1[] = {1, 8, 254u, 123}; + unsigned short p2[] = {1, 8, 254u, 2}; + unsigned short p3[] = {1, 23, 25, 26}; + + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p3, 1); +} + +void testNotEqualHEX8Arrays1(void) +{ + unsigned char p0[] = {1, 8, 254u, 253u}; + unsigned char p1[] = {1, 8, 254u, 252u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX8Arrays2(void) +{ + unsigned char p0[] = {1, 8, 254u, 253u}; + unsigned char p1[] = {2, 8, 254u, 253u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX8Arrays3(void) +{ + unsigned char p0[] = {1, 8, 254u, 253u}; + unsigned char p1[] = {1, 8, 255u, 253u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualMemoryArrays(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, -2}; + int p2[] = {1, 8, 987, 2}; + int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p0, 4, 1); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p0, 4, 4); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p2, 4, 3); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p3, 4, 1); +} + +void testNotEqualMemoryArraysExpectedNull(void) +{ + int* p0 = NULL; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArraysActualNull(void) +{ + int p0[] = {1, 8, 987, -2}; + int* p1 = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArrays1(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArrays2(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {2, 8, 987, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArrays3(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 986, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testProtection(void) +{ + volatile int mask = 0; + + if (TEST_PROTECT()) + { + mask |= 1; + TEST_ABORT(); + } + else + { + Unity.CurrentTestFailed = 0; + mask |= 2; + } + + TEST_ASSERT_EQUAL(3, mask); +} + +void testIgnoredAndThenFailInTearDown(void) +{ + SetToOneToFailInTearDown = 1; + TEST_IGNORE(); +} + +// ===================== THESE TEST WILL RUN IF YOUR CONFIG INCLUDES 64 BIT SUPPORT ================== +#ifdef UNITY_SUPPORT_64 + +void testEqualHex64s(void) +{ + _UU64 v0, v1; + _UU64 *p0, *p1; + + v0 = 0x9876543201234567; + v1 = 0x9876543201234567; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX64(0x9876543201234567, 0x9876543201234567); + TEST_ASSERT_EQUAL_HEX64(v0, v1); + TEST_ASSERT_EQUAL_HEX64(0x9876543201234567, v1); + TEST_ASSERT_EQUAL_HEX64(v0, 0x9876543201234567); + TEST_ASSERT_EQUAL_HEX64(*p0, v1); + TEST_ASSERT_EQUAL_HEX64(*p0, *p1); + TEST_ASSERT_EQUAL_HEX64(*p0, 0x9876543201234567); +} + +void testNotEqualHex64s(void) +{ + _UU64 v0, v1; + + v0 = 9000000000; + v1 = 9100000000; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex64sIfSigned(void) +{ + _US64 v0, v1; + + v0 = -9000000000; + v1 = 9000000000; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64(v0, v1); + VERIFY_FAILS_END +} + +void testHEX64sWithinDelta(void) +{ + TEST_ASSERT_HEX64_WITHIN(1, 0x7FFFFFFFFFFFFFFF,0x7FFFFFFFFFFFFFFE); + TEST_ASSERT_HEX64_WITHIN(5, 5000, 4996); + TEST_ASSERT_HEX64_WITHIN(5, 5000, 5005); +} + +void testHEX64sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX64_WITHIN(1, 0x7FFFFFFFFFFFFFFF, 0x7FFFFFFFFFFFFFFC); + VERIFY_FAILS_END +} + +void testHEX64sNotWithinDeltaEvenThoughASignedIntWouldPass(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX64_WITHIN(5, 1, -1); + VERIFY_FAILS_END +} + +void testEqualHEX64Arrays(void) +{ + _UU64 p0[] = {1, 8, 987, 65132u}; + _UU64 p1[] = {1, 8, 987, 65132u}; + _UU64 p2[] = {1, 8, 987, 2}; + _UU64 p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p3, 1); +} + +void testNotEqualHEX64Arrays1(void) +{ + _UU64 p0[] = {1, 8, 987, 65132u}; + _UU64 p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX64Arrays2(void) +{ + _UU64 p0[] = {1, 8, 987, 65132u}; + _UU64 p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +#endif //64-bit SUPPORT + +// ===================== THESE TEST WILL RUN IF YOUR CONFIG INCLUDES FLOAT SUPPORT ================== +#ifndef UNITY_EXCLUDE_FLOAT + +void testFloatsWithinDelta(void) +{ + TEST_ASSERT_FLOAT_WITHIN(0.00003f, 187245.03485f, 187245.03488f); + TEST_ASSERT_FLOAT_WITHIN(1.0f, 187245.0f, 187246.0f); + TEST_ASSERT_FLOAT_WITHIN(0.05f, 9273.2549f, 9273.2049f); + TEST_ASSERT_FLOAT_WITHIN(0.007f, -726.93724f, -726.94424f); +} + +void testFloatsNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_FLOAT_WITHIN(0.05f, 9273.2649f, 9273.2049f); + VERIFY_FAILS_END +} + +void testFloatsEqual(void) +{ + TEST_ASSERT_EQUAL_FLOAT(187245.0f, 187246.0f); + TEST_ASSERT_EQUAL_FLOAT(18724.5f, 18724.6f); + TEST_ASSERT_EQUAL_FLOAT(9273.2549f, 9273.2599f); + TEST_ASSERT_EQUAL_FLOAT(-726.93724f, -726.9374f); +} + +void testFloatsNotEqual(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT(9273.9649f, 9273.0049f); + VERIFY_FAILS_END +} + +void testFloatsNotEqualNegative1(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT(-9273.9649f, -9273.0049f); + VERIFY_FAILS_END +} + +void testFloatsNotEqualNegative2(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT(-9273.0049f, -9273.9649f); + VERIFY_FAILS_END +} + +void testEqualFloatArrays(void) +{ + float p0[] = {1.0, -8.0, 25.4, -0.123}; + float p1[] = {1.0, -8.0, 25.4, -0.123}; + float p2[] = {1.0, -8.0, 25.4, -0.2}; + float p3[] = {1.0, -23.0, 25.0, -0.26}; + + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p3, 1); +} + +void testNotEqualFloatArraysExpectedNull(void) +{ + float* p0 = NULL; + float p1[] = {1.0, 8.0, 25.4, 0.252}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysActualNull(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float* p1 = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArrays1(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float p1[] = {1.0, 8.0, 25.4, 0.252}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArrays2(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float p1[] = {2.0, 8.0, 25.4, 0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArrays3(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float p1[] = {1.0, 8.0, 25.5, 0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysNegative1(void) +{ + float p0[] = {-1.0, -8.0, -25.4, -0.253}; + float p1[] = {-1.0, -8.0, -25.4, -0.252}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysNegative2(void) +{ + float p0[] = {-1.0, -8.0, -25.4, -0.253}; + float p1[] = {-2.0, -8.0, -25.4, -0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysNegative3(void) +{ + float p0[] = {-1.0, -8.0, -25.4, -0.253}; + float p1[] = {-1.0, -8.0, -25.5, -0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +#endif //FLOAT SUPPORT diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/constructor/History.rdoc b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/constructor/History.rdoc new file mode 100644 index 0000000..b220b1d --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/constructor/History.rdoc @@ -0,0 +1,19 @@ +== 1.0.4 / 2009-12-01 + + * Building is now done with Jeweler. + +== 1.0.3 / 2009-11-30 + + * Quick release to include ConstructorStruct. + +== 1.0.2 / 2008-05-07 + + * An error is raised when constructor keys are passed in that already exist in the super class + +== 1.0.1 / 2007-12-21 + +* You can now pass a block to your constructor call; it gets executed after all the ivars get assigned. (This lets you write some initializer code if you need to.) + +== 1.0.0 / 2007-11-18 + +* Released! diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/constructor/README.rdoc b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/constructor/README.rdoc new file mode 100644 index 0000000..e6177de --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/constructor/README.rdoc @@ -0,0 +1,72 @@ +== Constructor + +* http://atomicobject.github.com/constructor + +== DESCRIPTION: + +Declarative means to define object properties by passing a hash +to the constructor, which will set the corresponding ivars. + +== SYNOPSIS: + + require 'constructor' + + class Horse + constructor :name, :breed, :weight + end + Horse.new :name => 'Ed', :breed => 'Mustang', :weight => 342 + +By default the ivars do not get accessors defined. +But you can get them auto-made if you want: + + class Horse + constructor :name, :breed, :weight, :accessors => true + end + ... + puts my_horse.weight + +Arguments specified are required by default. You can disable +strict argument checking with :strict option. This means that +the constructor will not raise an error if you pass more or +fewer arguments than declared. + + class Donkey + constructor :age, :odor, :strict => false + end + +... this allows you to pass either an age or odor key (or neither) +to the Donkey constructor. + + +== REQUIREMENTS: + +* rubygems + +== INSTALL: + +* sudo gem install constructor + +== LICENSE: + +(The MIT License) + +Copyright (c) 2007 Atomic Object + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/constructor/Rakefile b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/constructor/Rakefile new file mode 100644 index 0000000..e1c3536 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/constructor/Rakefile @@ -0,0 +1,33 @@ +require 'rubygems' + +desc 'Default: run specs' +task :default => :spec + +require 'spec/rake/spectask' +desc 'Run constructor specs' +Spec::Rake::SpecTask.new(:spec) do |t| + t.spec_files = FileList['specs/*_spec.rb'] + t.spec_opts << '-c -f s' +end + +begin + require 'jeweler' + Jeweler::Tasks.new do |gemspec| + $: << "lib" + require 'constructor.rb' + gemspec.name = 'constructor' + gemspec.version = CONSTRUCTOR_VERSION + gemspec.summary = 'Declarative named-argument object initialization.' + gemspec.description = 'Declarative means to define object properties by passing a hash to the constructor, which will set the corresponding ivars.' + gemspec.homepage = 'http://atomicobject.github.com/constructor' + gemspec.authors = 'Atomic Object' + gemspec.email = 'github@atomicobject.com' + gemspec.test_files = FileList['specs/*_spec.rb'] + end + + Jeweler::GemcutterTasks.new + +rescue LoadError + puts "(jeweler not installed)" +end + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/constructor/homepage/Notes.txt b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/constructor/homepage/Notes.txt new file mode 100644 index 0000000..258d959 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/constructor/homepage/Notes.txt @@ -0,0 +1,27 @@ +Wed Nov 21 21:49:27 EST 2007 +crosby + +1. Edit page_header.graffle +2. Export as HTML imagemap +3. Open ../sample_code/synopsis.rb +4. Screen shot, save as sample_code.png +5. rake (rewrites index.html) +6. cd .. +7. rake publish_docs + +page_header.graffle + Export-as-HTML-Imagemap + Use png + Use 125% scale + Remember to use the style inspector to assign actions to things that should be links. + +rake index + Rewrites index.html using index.erb and page_header.html (and some values in the Rakefile) + +The code sample screenshot: + Taken with Snapz Pro X (this is important, as Snapz is providing the + dropshadow and about 28 extra pixels widthwise) + + Should be 650 px wide to line up with the page header. + + Transparency: be conscious of WHAT'S IN THE BACKGROUND diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/constructor/homepage/Rakefile b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/constructor/homepage/Rakefile new file mode 100644 index 0000000..c2bca7a --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/constructor/homepage/Rakefile @@ -0,0 +1,15 @@ +desc "Rewrite index.html using index.erb and publisher_homepage.html" +task :index do + require 'erb' + @title = "Constructor - atomicobject.rb" + @plugin_install = "$ script/plugin install svn://rubyforge.org/var/svn/atomicobjectrb/tags/constructor" + @header_html = File.read("page_header.html") + html = ERB.new(File.read("index.erb")).result(binding) + fname = "index.html" + File.open(fname,"w") do |f| + f.print html + end + puts "Wrote #{fname}" +end + +task :default => :index diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/constructor/homepage/index.erb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/constructor/homepage/index.erb new file mode 100644 index 0000000..9af27c1 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/constructor/homepage/index.erb @@ -0,0 +1,27 @@ + + + <%= @title %> + + + + + +
+ + + + + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/constructor/homepage/index.html b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/constructor/homepage/index.html new file mode 100644 index 0000000..c2f8e64 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/constructor/homepage/index.html @@ -0,0 +1,36 @@ + + + Constructor - atomicobject.rb + + + + + +
+ + + + + + + + + + + + +
$ script/plugin install svn://rubyforge.org/var/svn/atomicobjectrb/tags/constructor
+ + +
+ + + + + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/constructor/homepage/page_header.graffle b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/constructor/homepage/page_header.graffle new file mode 100644 index 0000000..a910021 Binary files /dev/null and b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/constructor/homepage/page_header.graffle differ diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/constructor/homepage/page_header.html b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/constructor/homepage/page_header.html new file mode 100644 index 0000000..1530968 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/constructor/homepage/page_header.html @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/constructor/homepage/page_header.png b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/constructor/homepage/page_header.png new file mode 100644 index 0000000..82b3aae Binary files /dev/null and b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/constructor/homepage/page_header.png differ diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/constructor/homepage/sample_code.png b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/constructor/homepage/sample_code.png new file mode 100644 index 0000000..6084202 Binary files /dev/null and b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/constructor/homepage/sample_code.png differ diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/constructor/homepage/sample_code.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/constructor/homepage/sample_code.rb new file mode 100644 index 0000000..2b6dc21 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/constructor/homepage/sample_code.rb @@ -0,0 +1,12 @@ +require 'rubygems' +require 'constructor' + +class Horse + constructor :name, :breed, :weight, :accessors => true +end + +ed = Horse.new(:name => 'Ed', :breed => 'Mustang', :weight => 342) +puts ed.name +puts ed.breed +puts ed.weight + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/constructor/lib/constructor.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/constructor/lib/constructor.rb new file mode 100644 index 0000000..87eb6dd --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/constructor/lib/constructor.rb @@ -0,0 +1,127 @@ +CONSTRUCTOR_VERSION = '1.0.4' #:nodoc:# + +class Class #:nodoc:# + def constructor(*attrs, &block) + call_block = '' + if block_given? + @constructor_block = block + call_block = 'self.instance_eval(&self.class.constructor_block)' + end + # Look for embedded options in the listing: + opts = attrs.find { |a| a.kind_of?(Hash) and attrs.delete(a) } + do_acc = opts.nil? ? false : opts[:accessors] == true + do_reader = opts.nil? ? false : opts[:readers] == true + require_args = opts.nil? ? true : opts[:strict] != false + super_args = opts.nil? ? nil : opts[:super] + + # Incorporate superclass's constructor keys, if our superclass + if superclass.constructor_keys + similar_keys = superclass.constructor_keys & attrs + raise "Base class already has keys #{similar_keys.inspect}" unless similar_keys.empty? + attrs = [attrs,superclass.constructor_keys].flatten + end + # Generate ivar assigner code lines + assigns = '' + attrs.each do |k| + assigns += "@#{k.to_s} = args[:#{k.to_s}]\n" + end + + # If accessors option is on, declare accessors for the attributes: + if do_acc + add_accessors = "attr_accessor " + attrs.reject {|x| superclass.constructor_keys.include?(x.to_sym)}.map {|x| ":#{x.to_s}"}.join(',') + #add_accessors = "attr_accessor " + attrs.map {|x| ":#{x.to_s}"}.join(',') + self.class_eval add_accessors + end + + # If readers option is on, declare readers for the attributes: + if do_reader + self.class_eval "attr_reader " + attrs.reject {|x| superclass.constructor_keys.include?(x.to_sym)}.map {|x| ":#{x.to_s}"}.join(',') + end + + # If user supplied super-constructor hints: + super_call = '' + if super_args + list = super_args.map do |a| + case a + when String + %|"#{a}"| + when Symbol + %|:#{a}| + end + end + super_call = %|super(#{list.join(',')})| + end + + # If strict is on, define the constructor argument validator method, + # and setup the initializer to invoke the validator method. + # Otherwise, insert lax code into the initializer. + validation_code = "return if args.nil?" + if require_args + self.class_eval do + def _validate_constructor_args(args) + # First, make sure we've got args of some kind + unless args and args.keys and args.keys.size > 0 + raise ConstructorArgumentError.new(self.class.constructor_keys) + end + # Scan for missing keys in the argument hash + a_keys = args.keys + missing = [] + self.class.constructor_keys.each do |ck| + unless a_keys.member?(ck) + missing << ck + end + a_keys.delete(ck) # Delete inbound keys as we address them + end + if missing.size > 0 || a_keys.size > 0 + raise ConstructorArgumentError.new(missing,a_keys) + end + end + end + # Setup the code to insert into the initializer: + validation_code = "_validate_constructor_args args " + end + + # Generate the initializer code + self.class_eval %{ + def initialize(args=nil) + #{super_call} + #{validation_code} + #{assigns} + setup if respond_to?(:setup) + #{call_block} + end + } + + # Remember our constructor keys + @_ctor_keys = attrs + end + + # Access the constructor keys for this class + def constructor_keys; @_ctor_keys ||=[]; end + + def constructor_block #:nodoc:# + @constructor_block + end + +end + +# Fancy validation exception, based on missing and extraneous keys. +class ConstructorArgumentError < RuntimeError #:nodoc:# + def initialize(missing,rejected=[]) + err_msg = '' + if missing.size > 0 + err_msg = "Missing constructor args [#{missing.join(',')}]" + end + if rejected.size > 0 + # Some inbound keys were not addressed earlier; this means they're unwanted + if err_msg + err_msg << "; " # Appending to earlier message about missing items + else + err_msg = '' + end + # Enumerate the rejected key names + err_msg << "Rejected constructor args [#{rejected.join(',')}]" + end + super err_msg + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/constructor/lib/constructor_struct.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/constructor/lib/constructor_struct.rb new file mode 100644 index 0000000..e97ff62 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/constructor/lib/constructor_struct.rb @@ -0,0 +1,33 @@ +class ConstructorStruct + def self.new(*accessors, &block) + defaults = {:accessors => true, :strict => false} + + accessor_names = accessors.dup + if accessors.last.is_a? Hash + accessor_names.pop + user_opts = accessors.last + user_opts.delete(:accessors) + defaults.each do |k,v| + user_opts[k] ||= v + end + else + accessors << defaults + end + + Class.new do + constructor *accessors + + class_eval(&block) if block + + comparator_code = accessor_names.map { |fname| "self.#{fname} == o.#{fname}" }.join(" && ") + eval %| + def ==(o) + (self.class == o.class) && #{comparator_code} + end + def eql?(o) + (self.class == o.class) && #{comparator_code} + end + | + end + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/constructor/specs/constructor_spec.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/constructor/specs/constructor_spec.rb new file mode 100644 index 0000000..80345ae --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/constructor/specs/constructor_spec.rb @@ -0,0 +1,407 @@ +require File.expand_path(File.dirname(__FILE__) + '/../lib/constructor') + +describe 'standard constructor usage' do + it 'allows for object construction using a hash of named arguments' do + fuh = TestingClass.new( + :foo => 'my foo', + :bar => 'my bar', + :qux => 'my qux', + :why => 'lucky' + ) + + fuh.foo.should eql('my foo') + fuh.bar.should eql('my bar') + fuh.qux.should eql('my qux') + fuh.why.should eql('lucky') + fuh.to_pretty_pretty.should eql('my foo my bar') + end + + it 'calls setup method if defined' do + ralph = Llamma.new :hair => 'red' + ralph.hungry.should be_true + ralph.hair.should eql('red') + end +end + +describe "constructor's accessor option" do + it 'provides accessors for constructor arguments when accessor option is true' do + fuh = TestingAutoAccessors.new( + :foo => 'my foo', + :bar => 'my bar', + :qux => 'my qux', + :why => 'lucky' + ) + fuh.foo.should eql('my foo') + fuh.bar.should eql('my bar') + fuh.qux.should eql('my qux') + fuh.why.should eql('lucky') + fuh.to_pretty_pretty.should eql('my foo my bar') + end + + it 'does not provide accessors for constructor arguments when accessor option is false' do + fuh = TestingBlockedAccessors.new :foo => 'my foo', :bar => 'my bar' + lambda {fuh.foo}.should raise_error(NoMethodError) + lambda {fuh.bar}.should raise_error(NoMethodError) + fuh.to_pretty_pretty.should eql('my foo my bar') + end +end + +describe "constructor's reader option" do + it 'provides readers for constructor arguments when reader option is true' do + fuh = TestingAutoReaders.new( + :foo => 'my foo', + :why => 'lucky' + ) + fuh.foo.should eql('my foo') + fuh.why.should eql('lucky') + fuh.to_pretty_pretty.should eql('my foo lucky') + + lambda {fuh.why = 'no way'}.should raise_error(NoMethodError) + lambda {fuh.foo = 'uh uh'}.should raise_error(NoMethodError) + end + + it 'does not provide reader for constructor arguments when reader option is false' do + fuh = TestingBlockedReaders.new :foo => 'my foo', :why => 'my why' + lambda {fuh.foo}.should raise_error(NoMethodError) + lambda {fuh.bar}.should raise_error(NoMethodError) + fuh.to_pretty_pretty.should eql('my foo my why') + + lambda {fuh.why = 'no way'}.should raise_error(NoMethodError) + lambda {fuh.foo = 'uh uh'}.should raise_error(NoMethodError) + end +end + +describe 'using constructor with inheritance' do + it 'allows for inheritance of constructor arguments using a non-constructor defined subclass' do + fuh = SubclassOfTestingClass.new :foo => 'whu?' + fuh.foo.should eql('whu?') + fuh.bar.should be_nil + fuh.qux.should be_nil + fuh.why.should be_nil + end + + it 'allows for standard construction of a non-constructor subclass of a non-strict constuctor superclass' do + fuh = SubclassOfTestingClass2.new + fuh.foo.should be_nil + end + + it 'runs initialize method of a sublcass' do + fuh = SubclassOfTestingClass3.new + fuh.my_new_var.should eql('something') + fuh.foo.should be_nil + fuh.bar.should be_nil + fuh.qux.should be_nil + fuh.why.should be_nil + end + + it 'passes named constructor args to superclass when subclass calls super' do + fuh = SubclassOfTestingClass3.new :foo => 12 + fuh.my_new_var.should eql('something') + fuh.foo.should eql(12) + fuh.bar.should be_nil + fuh.qux.should be_nil + fuh.why.should be_nil + end + + it 'allows for inheritance of constructor arguments using a constructor defined subclass' do + s = Sonny.new :car => 'Nissan', :saw => 'Dewalt', :computer => 'Dell' + s.computer.should eql('Dell') + s.saw.should eql('Dewalt') + s.car.should eql('Nissan') + end + + it 'calls the setup method on superclass if subclass does not define a setup method' do + baby = Baby.new :cuteness => 'little', :age => 1 + baby.fat.should eql('much') + end + + it 'calls parent class setup when super is called from subclass setup' do + m = Mama.new :age => 55 + m.age.should eql(55) + m.fat.should eql('much') + + s = Sissy.new :age => 19, :beauty => 'medium', :fat => 'yeah' + s.age.should eql(19) + s.beauty.should eql('medium') + s.fat.should eql('much') + s.friends.should eql('many') + end + + it 'passes arguments given in the super option to the initializer of a non-constructor defined superclass' do + tsc = TestingSuperConstructor.new(:far => 'oo', :away => 'kk') + tsc.far.should eql('oo') + tsc.away.should eql('kk') + tsc.a.should eql("once") + tsc.b.should eql(:twice) + end + + it 'calls non-constructor defined superclass constructor when the super option is an empty array' do + tsc = TestingSuperConstructor2.new(:some => 'thing') + tsc.some.should eql('thing') + tsc.c.should eql('what a') + tsc.d.should eql('day for') + end + + it "raises an error if subclass tries to build a constructor with the keys as its parents" do + class1 = constructor_class(Object, :star, :wars) + class2 = constructor_class(class1, :space, :balls) + lambda { constructor_class(class2, :star, :space, :chewy) }.should raise_error("Base class already has keys [:space, :star]") + end + + it 'does not create accessors for superclass constructor arguments' do + tas = TestingAccessorSubclass.new(:far => 'thing') + tas.respond_to?(:cuteness).should be_false + end + + it 'does not create a reader for superclass constructor arguments' do + t1 = TestingReaderSubclass.new(:foo => 'thing') + t1.respond_to?(:foo).should be_false + end +end + +describe 'stict mode usage' do + it 'allows omission of arguments when strict is off' do + fuh = TestingClass.new :foo => 'my foo' + + fuh.foo.should eql('my foo') + fuh.bar.should be_nil + fuh.qux.should be_nil + fuh.why.should be_nil + end + + it 'allows no arguments to a constructor when strict is off' do + fuh = TestingClass.new + fuh.foo.should be_nil + fuh.bar.should be_nil + fuh.qux.should be_nil + fuh.why.should be_nil + end + + it 'does not interfere with normal object construction' do + require 'rexml/document' + d = REXML::Document.new '' + d.should_not be_nil + d.root.name.should eql('base') + end + + def see_strict_args_in_effect_for(clazz) + fuh = clazz.new :foo => 'my foo', :bar => 'my bar' + fuh.to_pretty_pretty.should eql('my foo my bar') + + # Omit foo + lambda { + TestingStrictArgsDefault.new :bar => 'ok,yeah' + }.should raise_error(ConstructorArgumentError, /foo/) + + # Omit bar + lambda { + TestingStrictArgsDefault.new :foo => 'ok,yeah' + }.should raise_error(ConstructorArgumentError, /bar/) + end + + it 'defaults to strict argument enforcement' do + see_strict_args_in_effect_for TestingStrictArgsDefault + end + + it 'enforces strict arguments when strict option is true' do + see_strict_args_in_effect_for TestingStrictArgs + end + + it 'does not allow empty constructor arguments when strict option is true' do + lambda {TestingStrictArgs.new {}}.should raise_error(ConstructorArgumentError,/foo,bar/) + lambda {TestingStrictArgs.new}.should raise_error(ConstructorArgumentError,/foo,bar/) + lambda {TestingStrictArgs.new nil}.should raise_error(ConstructorArgumentError,/foo,bar/) + end + + it 'does not allow extraneous arguments when strict option is true' do + [ /thing/, /other/ ].each do |rejected_arg| + lambda { + TestingStrictArgs.new(:foo => 1, :bar => 2, :other => 3, :thing => 4) + }.should raise_error(ConstructorArgumentError, rejected_arg) + end + end + + it 'allows for setting accessors option while in strict mode' do + t2 = TestingStrictArgs2.new :foo => 1, :bar => 2 + + # See that accessors work + t2.foo.should eql(1) + t2.bar.should eql(2) + + # See that strictness still applies + lambda {TestingStrictArgs2.new :no => 'good'}.should raise_error(ConstructorArgumentError) + end +end + +describe 'catching ConstructorArgumentError' do + it 'allows for generic rescuing of constructor argument errors' do + begin + TestingStrictArgs.new :broken => 'yoobetcha' + rescue => bad_news + bad_news.should be_kind_of(ConstructorArgumentError) + end + end +end + +describe 'block yielding' do + it 'executes a specified block after instantiating' do + TestingBlockYield.new(:a => false).a.should == true + end +end + +def constructor_class(base, *keys) + Class.new(base) do + constructor *keys + end +end + +class TestingClass + attr_accessor :foo, :bar, :why, :qux + constructor :foo, :bar, :why, :qux, :strict => false + + def to_pretty_pretty + "#{@foo} #{@bar}" + end + +end + +class Mama + attr_accessor :fat, :age + constructor :age, :strict => false + def setup + @fat = "much" + end +end + +class Baby < Mama + constructor :cuteness +end + +class Sissy < Mama + attr_accessor :friends, :beauty + constructor :beauty, :strict => false + def setup + super #IMPORTANT! + @friends = "many" + end +end + +class TestingStrictArgsDefault + constructor :foo, :bar + def to_pretty_pretty + "#{@foo} #{@bar}" + end +end + +class TestingStrictArgs + constructor :foo, :bar, :strict => true + def to_pretty_pretty + "#{@foo} #{@bar}" + end +end + +class TestingStrictArgs2 + constructor :foo, :bar, :accessors => true +end + +class SubclassOfTestingClass < TestingClass +end + +class SubclassOfTestingClass2 < TestingClass + def initialize; end +end + +class SubclassOfTestingClass3 < TestingClass + attr_reader :my_new_var + def initialize(hash = nil) + super + @my_new_var = "something" + end +end + +class TestingAutoAccessors + constructor :foo, :bar, :why, :qux, :accessors => true, :strict => false + def to_pretty_pretty + "#{@foo} #{@bar}" + end +end + +class TestingAutoReaders + constructor :foo, :why, :readers => true, :strict => false + def to_pretty_pretty + "#{@foo} #{@why}" + end +end + +class TestingReaderSuperclass + constructor :foo +end + +class TestingReaderSubclass < TestingReaderSuperclass + constructor :bar, :readers => true, :strict => false +end + +class TestingSuperConstructorBase + attr_reader :a, :b + def initialize(a,b) + @a = a + @b = b + end +end + +class TestingSuperConstructor < TestingSuperConstructorBase + constructor :far, :away, :accessors => true, :super => ["once", :twice], :strict => false +end + +class TestingSuperConstructorBase2 + attr_reader :c, :d + def initialize + @c = 'what a' + @d = 'day for' + end +end + +class TestingSuperConstructor2 < TestingSuperConstructorBase2 + constructor :some, :accessors => true, :super => [], :strict => false +end + +class TestingAccessorSubclass < Baby + constructor :foo, :accessors => true, :strict => false +end + +class TestingBlockedAccessors + constructor :foo, :bar, :accessors => false + def to_pretty_pretty + "#{@foo} #{@bar}" + end +end + +class TestingBlockedReaders + constructor :foo, :why, :readers => false + def to_pretty_pretty + "#{@foo} #{@why}" + end +end + +class Papa + constructor :car, :saw +end + +class Sonny < Papa + attr_accessor :car, :saw, :computer + constructor :computer +end + +class Llamma + attr_accessor :hungry, :hair + constructor :hair + def setup + @hungry = true + end +end + +class TestingBlockYield + constructor :a, :accessors => true do + @a = true + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/constructor/specs/constructor_struct_spec.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/constructor/specs/constructor_struct_spec.rb new file mode 100644 index 0000000..2442da3 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/constructor/specs/constructor_struct_spec.rb @@ -0,0 +1,84 @@ +require File.dirname(__FILE__) + '/../lib/constructor_struct' + +describe ConstructorStruct, "#new" do + def struct(*accessors) + ConstructorStruct.new(*accessors) + end + + def instance_of(clazz, args=nil) + args = [args] || [] + clazz.new(*args) + end + + before do + AClass = struct(:hello, :world) unless defined?(AClass) + end + + it "creates a new class with accessors given a set of symbols or strings" do + instance_of(AClass, {:hello => "foo", :world => "bar"}).hello.should == "foo" + instance_of(AClass, {:hello => "foo", :world => "bar"}).world.should == "bar" + end + + it "creates a real class" do + instance_of(AClass).class.should == AClass + end + + it "has the option of creating a strict accessors" do + lambda { instance_of(struct(:foo, :strict => true)) }.should raise_error + end + + it "does not have the option of not creating accessors" do + instance_of(struct(:foo, :accessors => false), :foo => "bar").foo.should == "bar" + end + + describe "equivalence" do + before do + @hello = "Hello" + @world = "World" + @args = { :hello => @hello, :world => @world } + @target = AClass.new(@args) + end + + it "uses all accessors" do + [ nil, :hello, :world ].each do |field_to_alter| + alt = AClass.new(:hello => @hello, :world => @world) + + unless field_to_alter + # Base case: they should be equal + @target.should == alt + @target.eql?(alt).should be_true #should eql(alt) + else + # Change 1 field and see not equal + alt.send("#{field_to_alter}=", "other data") + @target.should_not == alt + @target.should_not eql(alt) + end + end + end + + it "will not compare to another class with same fields" do + BClass = ConstructorStruct.new(:hello, :world) + alt = BClass.new(:hello => @hello, :world => @world) + @target.should_not == alt + @target.should_not eql(alt) + end + end + + describe "extra method definitions" do + NightTrain = ConstructorStruct.new(:beer, :conductor) do + def setup + @conductor ||= "Bill" + end + end + + it "lets you declare instance methods within a block" do + night_train = NightTrain.new(:beer => "Founders") + night_train.beer.should == "Founders" + night_train.conductor.should == "Bill" + + other_train = NightTrain.new(:beer => "Bells", :conductor => "Dave") + other_train.conductor.should == "Dave" + end + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/deep_merge/MIT-LICENSE b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/deep_merge/MIT-LICENSE new file mode 100644 index 0000000..8eaf6db --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/deep_merge/MIT-LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2008 [name of plugin creator] + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/deep_merge/README b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/deep_merge/README new file mode 100644 index 0000000..0302735 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/deep_merge/README @@ -0,0 +1,94 @@ +DeepMerge Overview +================== + +Deep Merge is a simple set of utility functions for Hash. It permits +you to merge elements inside a hash together recursively. The manner +by which it does this is somewhat arbitrary (since there is no defining +standard for this) but it should end up being pretty intuitive and do what +you expect. + +You can learn a lot more about this by reading the test file. It's pretty +well documented and has many examples of various merges from very simple +to pretty complex. + +The primary need that caused me to write this library is the merging of elements +coming from HTTP parameters and related stored parameters in session. This lets +a user build up a set of parameters over time, modifying individual items. + +Deep Merge Core Documentation +============================= + There are three key methods that are added to Hash when you require deep_merge: + + deep_merge!(new_hash[, opts]) -- merges and new_hash wins unmergeable situations + deep_merge(new_hash[, opts]) -- merges and "self" hash wins unmergeable situations + ko_deep_merge!(new_hash[, opts]) -- same as deep_merge! but "--" provides "knockout" functions + + deep_merge! method permits merging of arbitrary child elements. The two top level + elements must be hashes. These hashes can contain unlimited (to stack limit) levels + of child elements. These child elements to not have to be of the same types. + Where child elements are of the same type, deep_merge will attempt to merge them together. + Where child elements are not of the same type, deep_merge will skip or optionally overwrite + the destination element with the contents of the source element at that level. + So if you have two hashes like this: + source = {:x => [1,2,3], :y => 2} + dest = {:x => [4,5,'6'], :y => [7,8,9]} + dest.deep_merge!(source) + Results: {:x => [1,2,3,4,5,'6'], :y => 2} + By default, "deep_merge!" will overwrite any unmergeables and merge everything else. + To avoid this, use "deep_merge" (no bang/exclamation mark) + + Options: + Options are specified in the last parameter passed, which should be in hash format: + hash.deep_merge!({:x => [1,2]}, {:knockout_prefix => '--'}) + :preserve_unmergeables DEFAULT: false + Set to true to skip any unmergeable elements from source + :knockout_prefix DEFAULT: nil + Set to string value to signify prefix which deletes elements from existing element + :sort_merged_arrays DEFAULT: false + Set to true to sort all arrays that are merged together + :unpack_arrays DEFAULT: nil + Set to string value to run "Array::join" then "String::split" against all arrays + :merge_debug DEFAULT: false + Set to true to get console output of merge process for debugging + + Selected Options Details: + :knockout_prefix => The purpose of this is to provide a way to remove elements + from existing Hash by specifying them in a special way in incoming hash + source = {:x => ['--1', '2']} + dest = {:x => ['1', '3']} + dest.ko_deep_merge!(source) + Results: {:x => ['2','3']} + Additionally, if the knockout_prefix is passed alone as a string, it will cause + the entire element to be removed: + source = {:x => '--'} + dest = {:x => [1,2,3]} + dest.ko_deep_merge!(source) + Results: {:x => ""} + :unpack_arrays => The purpose of this is to permit compound elements to be passed + in as strings and to be converted into discrete array elements + irsource = {:x => ['1,2,3', '4']} + dest = {:x => ['5','6','7,8']} + dest.deep_merge!(source, {:unpack_arrays => ','}) + Results: {:x => ['1','2','3','4','5','6','7','8'} + Why: If receiving data from an HTML form, this makes it easy for a checkbox + to pass multiple values from within a single HTML element + + There are many tests for this library - and you can learn more about the features + and usages of deep_merge! by just browsing the test examples + + +Simple Example Code +=================== + +require 'deep_merge' +x = {:x => [3,4,5]} +y = {:x => [1,2,3]} +y.deep_merge!(x) +# results: y = {:x => [1,2,3,4,5]} + +Availablility +============= +SVN Repo here: http://trac.misuse.org/science/wiki/DeepMerge +Contact author: http://www.misuse.org/science + +Copyright (c) 2008 Steve Midgley, released under the MIT license diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/deep_merge/Rakefile b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/deep_merge/Rakefile new file mode 100644 index 0000000..82e43b3 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/deep_merge/Rakefile @@ -0,0 +1,28 @@ +require 'rubygems' +require 'lib/deep_merge' +Gem::manage_gems +require 'rake/gempackagetask' + +spec = Gem::Specification.new do |s| + s.platform = Gem::Platform::RUBY + s.name = "deep_merge" + s.version = DeepMerge::VERSION + s.author = "Steve Midgley" + s.email = "public@misuse.org" + s.summary = "Permits recursive/deep merges of arrays and hashes." + s.files = FileList['lib/*.rb', 'test/*'].to_a + s.require_path = "lib" + s.autorequire = "deep_merge" + s.test_files = Dir.glob('tests/*.rb') + s.has_rdoc = true + s.extra_rdoc_files = ["README"] +end + +Rake::GemPackageTask.new(spec) do |pkg| + pkg.need_tar = true +end + +task :default => "pkg/#{spec.name}-#{spec.version}.gem" do + puts "generated latest version" +end + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/deep_merge/lib/deep_merge.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/deep_merge/lib/deep_merge.rb new file mode 100644 index 0000000..4c4b761 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/deep_merge/lib/deep_merge.rb @@ -0,0 +1,211 @@ +module DeepMerge + + MAJOR_VERSION = 0 + MINOR_VERSION = 1 + FIX_VERSION = 0 + VERSION = "#{MAJOR_VERSION}.#{MINOR_VERSION}.#{FIX_VERSION}" + + class InvalidParameter < StandardError; end + + DEFAULT_FIELD_KNOCKOUT_PREFIX = '--' + + module DeepMergeHash + # ko_hash_merge! will merge and knockout elements prefixed with DEFAULT_FIELD_KNOCKOUT_PREFIX + def ko_deep_merge!(source, options = {}) + default_opts = {:knockout_prefix => "--", :preserve_unmergeables => false} + DeepMerge::deep_merge!(source, self, default_opts.merge(options)) + end + + # deep_merge! will merge and overwrite any unmergeables in destination hash + def deep_merge!(source, options = {}) + default_opts = {:preserve_unmergeables => false} + DeepMerge::deep_merge!(source, self, default_opts.merge(options)) + end + + # deep_merge will merge and skip any unmergeables in destination hash + def deep_merge(source, options = {}) + default_opts = {:preserve_unmergeables => true} + DeepMerge::deep_merge!(source, self, default_opts.merge(options)) + end + + end # DeepMergeHashExt + + # Deep Merge core documentation. + # deep_merge! method permits merging of arbitrary child elements. The two top level + # elements must be hashes. These hashes can contain unlimited (to stack limit) levels + # of child elements. These child elements to not have to be of the same types. + # Where child elements are of the same type, deep_merge will attempt to merge them together. + # Where child elements are not of the same type, deep_merge will skip or optionally overwrite + # the destination element with the contents of the source element at that level. + # So if you have two hashes like this: + # source = {:x => [1,2,3], :y => 2} + # dest = {:x => [4,5,'6'], :y => [7,8,9]} + # dest.deep_merge!(source) + # Results: {:x => [1,2,3,4,5,'6'], :y => 2} + # By default, "deep_merge!" will overwrite any unmergeables and merge everything else. + # To avoid this, use "deep_merge" (no bang/exclamation mark) + # + # Options: + # Options are specified in the last parameter passed, which should be in hash format: + # hash.deep_merge!({:x => [1,2]}, {:knockout_prefix => '--'}) + # :preserve_unmergeables DEFAULT: false + # Set to true to skip any unmergeable elements from source + # :knockout_prefix DEFAULT: nil + # Set to string value to signify prefix which deletes elements from existing element + # :sort_merged_arrays DEFAULT: false + # Set to true to sort all arrays that are merged together + # :unpack_arrays DEFAULT: nil + # Set to string value to run "Array::join" then "String::split" against all arrays + # :merge_debug DEFAULT: false + # Set to true to get console output of merge process for debugging + # + # Selected Options Details: + # :knockout_prefix => The purpose of this is to provide a way to remove elements + # from existing Hash by specifying them in a special way in incoming hash + # source = {:x => ['--1', '2']} + # dest = {:x => ['1', '3']} + # dest.ko_deep_merge!(source) + # Results: {:x => ['2','3']} + # Additionally, if the knockout_prefix is passed alone as a string, it will cause + # the entire element to be removed: + # source = {:x => '--'} + # dest = {:x => [1,2,3]} + # dest.ko_deep_merge!(source) + # Results: {:x => ""} + # :unpack_arrays => The purpose of this is to permit compound elements to be passed + # in as strings and to be converted into discrete array elements + # irsource = {:x => ['1,2,3', '4']} + # dest = {:x => ['5','6','7,8']} + # dest.deep_merge!(source, {:unpack_arrays => ','}) + # Results: {:x => ['1','2','3','4','5','6','7','8'} + # Why: If receiving data from an HTML form, this makes it easy for a checkbox + # to pass multiple values from within a single HTML element + # + # There are many tests for this library - and you can learn more about the features + # and usages of deep_merge! by just browsing the test examples + def DeepMerge.deep_merge!(source, dest, options = {}) + # turn on this line for stdout debugging text + merge_debug = options[:merge_debug] || false + overwrite_unmergeable = !options[:preserve_unmergeables] + knockout_prefix = options[:knockout_prefix] || nil + if knockout_prefix == "" then raise InvalidParameter, "knockout_prefix cannot be an empty string in deep_merge!"; end + if knockout_prefix && !overwrite_unmergeable then raise InvalidParameter, "overwrite_unmergeable must be true if knockout_prefix is specified in deep_merge!"; end + # if present: we will split and join arrays on this char before merging + array_split_char = options[:unpack_arrays] || false + # request that we sort together any arrays when they are merged + sort_merged_arrays = options[:sort_merged_arrays] || false + di = options[:debug_indent] || '' + # do nothing if source is nil + if source.nil? || (source.respond_to?(:blank?) && source.blank?) then return dest; end + # if dest doesn't exist, then simply copy source to it + if dest.nil? && overwrite_unmergeable then dest = source; return dest; end + + puts "#{di}Source class: #{source.class.inspect} :: Dest class: #{dest.class.inspect}" if merge_debug + if source.kind_of?(Hash) + puts "#{di}Hashes: #{source.inspect} :: #{dest.inspect}" if merge_debug + source.each do |src_key, src_value| + if dest.kind_of?(Hash) + puts "#{di} looping: #{src_key.inspect} => #{src_value.inspect} :: #{dest.inspect}" if merge_debug + if not dest[src_key].nil? + puts "#{di} ==>merging: #{src_key.inspect} => #{src_value.inspect} :: #{dest[src_key].inspect}" if merge_debug + dest[src_key] = deep_merge!(src_value, dest[src_key], options.merge(:debug_indent => di + ' ')) + else # dest[src_key] doesn't exist so we want to create and overwrite it (but we do this via deep_merge!) + puts "#{di} ==>merging over: #{src_key.inspect} => #{src_value.inspect}" if merge_debug + # note: we rescue here b/c some classes respond to "dup" but don't implement it (Numeric, TrueClass, FalseClass, NilClass among maybe others) + begin + src_dup = src_value.dup # we dup src_value if possible because we're going to merge into it (since dest is empty) + rescue TypeError + src_dup = src_value + end + dest[src_key] = deep_merge!(src_value, src_dup, options.merge(:debug_indent => di + ' ')) + end + else # dest isn't a hash, so we overwrite it completely (if permitted) + if overwrite_unmergeable + puts "#{di} overwriting dest: #{src_key.inspect} => #{src_value.inspect} -over-> #{dest.inspect}" if merge_debug + dest = overwrite_unmergeables(source, dest, options) + end + end + end + elsif source.kind_of?(Array) + puts "#{di}Arrays: #{source.inspect} :: #{dest.inspect}" if merge_debug + # if we are instructed, join/split any source arrays before processing + if array_split_char + puts "#{di} split/join on source: #{source.inspect}" if merge_debug + source = source.join(array_split_char).split(array_split_char) + if dest.kind_of?(Array) then dest = dest.join(array_split_char).split(array_split_char); end + end + # if there's a naked knockout_prefix in source, that means we are to truncate dest + if source.index(knockout_prefix) then dest = clear_or_nil(dest); source.delete(knockout_prefix); end + if dest.kind_of?(Array) + if knockout_prefix + print "#{di} knocking out: " if merge_debug + # remove knockout prefix items from both source and dest + source.delete_if do |ko_item| + retval = false + item = ko_item.respond_to?(:gsub) ? ko_item.gsub(%r{^#{knockout_prefix}}, "") : ko_item + if item != ko_item + print "#{ko_item} - " if merge_debug + dest.delete(item) + dest.delete(ko_item) + retval = true + end + retval + end + puts if merge_debug + end + puts "#{di} merging arrays: #{source.inspect} :: #{dest.inspect}" if merge_debug + dest = dest | source + if sort_merged_arrays then dest.sort!; end + elsif overwrite_unmergeable + puts "#{di} overwriting dest: #{source.inspect} -over-> #{dest.inspect}" if merge_debug + dest = overwrite_unmergeables(source, dest, options) + end + else # src_hash is not an array or hash, so we'll have to overwrite dest + puts "#{di}Others: #{source.inspect} :: #{dest.inspect}" if merge_debug + dest = overwrite_unmergeables(source, dest, options) + end + puts "#{di}Returning #{dest.inspect}" if merge_debug + dest + end # deep_merge! + + # allows deep_merge! to uniformly handle overwriting of unmergeable entities + def DeepMerge::overwrite_unmergeables(source, dest, options) + merge_debug = options[:merge_debug] || false + overwrite_unmergeable = !options[:preserve_unmergeables] + knockout_prefix = options[:knockout_prefix] || false + di = options[:debug_indent] || '' + if knockout_prefix && overwrite_unmergeable + if source.kind_of?(String) # remove knockout string from source before overwriting dest + src_tmp = source.gsub(%r{^#{knockout_prefix}},"") + elsif source.kind_of?(Array) # remove all knockout elements before overwriting dest + src_tmp = source.delete_if {|ko_item| ko_item.kind_of?(String) && ko_item.match(%r{^#{knockout_prefix}}) } + else + src_tmp = source + end + if src_tmp == source # if we didn't find a knockout_prefix then we just overwrite dest + puts "#{di}#{src_tmp.inspect} -over-> #{dest.inspect}" if merge_debug + dest = src_tmp + else # if we do find a knockout_prefix, then we just delete dest + puts "#{di}\"\" -over-> #{dest.inspect}" if merge_debug + dest = "" + end + elsif overwrite_unmergeable + dest = source + end + dest + end + + def DeepMerge::clear_or_nil(obj) + if obj.respond_to?(:clear) + obj.clear + else + obj = nil + end + obj + end + +end # module DeepMerge + +class Hash + include DeepMerge::DeepMergeHash +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/deep_merge/pkg/deep_merge-0.1.0.gem b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/deep_merge/pkg/deep_merge-0.1.0.gem new file mode 100644 index 0000000..ffd2448 Binary files /dev/null and b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/deep_merge/pkg/deep_merge-0.1.0.gem differ diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/deep_merge/test/test_deep_merge.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/deep_merge/test/test_deep_merge.rb new file mode 100644 index 0000000..7ebd918 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/deep_merge/test/test_deep_merge.rb @@ -0,0 +1,553 @@ +require 'test/unit' +require '../lib/deep_merge.rb' + +class TestDeepMerge < Test::Unit::TestCase + + def setup + end + + # show that Hash object has deep merge capabilities in form of three methods: + # ko_deep_merge! # uses '--' knockout and overwrites unmergeable + # deep_merge! # overwrites unmergeable + # deep_merge # skips unmergeable + def test_hash_deep_merge + x = {} + assert x.respond_to?('deep_merge!'.to_sym) + hash_src = {'id' => [3,4,5]} + hash_dest = {'id' => [1,2,3]} + assert hash_dest.ko_deep_merge!(hash_src) + assert_equal({'id' => [1,2,3,4,5]}, hash_dest) + + hash_src = {'id' => [3,4,5]} + hash_dest = {'id' => [1,2,3]} + assert hash_dest.deep_merge!(hash_src) + assert_equal({'id' => [1,2,3,4,5]}, hash_dest) + + hash_src = {'id' => 'xxx'} + hash_dest = {'id' => [1,2,3]} + assert hash_dest.deep_merge(hash_src) + assert_equal({'id' => [1,2,3]}, hash_dest) + end + + FIELD_KNOCKOUT_PREFIX = DeepMerge::DEFAULT_FIELD_KNOCKOUT_PREFIX + + # tests DeepMerge::deep_merge! function + def test_deep_merge + # merge tests (moving from basic to more complex) + + # test merging an hash w/array into blank hash + hash_src = {'id' => '2'} + hash_dst = {} + DeepMerge::deep_merge!(hash_src.dup, hash_dst, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal hash_src, hash_dst + + # test merging an hash w/array into blank hash + hash_src = {'region' => {'id' => ['227', '2']}} + hash_dst = {} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal hash_src, hash_dst + + # merge from empty hash + hash_src = {} + hash_dst = {"property" => ["2","4"]} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => ["2","4"]}, hash_dst) + + # merge to empty hash + hash_src = {"property" => ["2","4"]} + hash_dst = {} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => ["2","4"]}, hash_dst) + + # simple string overwrite + hash_src = {"name" => "value"} + hash_dst = {"name" => "value1"} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"name" => "value"}, hash_dst) + + # simple string overwrite of empty hash + hash_src = {"name" => "value"} + hash_dst = {} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal(hash_src, hash_dst) + + # hashes holding array + hash_src = {"property" => ["1","3"]} + hash_dst = {"property" => ["2","4"]} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal(["2","4","1","3"], hash_dst['property']) + + # hashes holding array (sorted) + hash_src = {"property" => ["1","3"]} + hash_dst = {"property" => ["2","4"]} + DeepMerge::deep_merge!(hash_src, hash_dst, {:sort_merged_arrays => true}) + assert_equal(["1","2","3","4"].sort, hash_dst['property']) + + # hashes holding hashes holding arrays (array with duplicate elements is merged with dest then src + hash_src = {"property" => {"bedroom_count" => ["1", "2"], "bathroom_count" => ["1", "4+"]}} + hash_dst = {"property" => {"bedroom_count" => ["3", "2"], "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => {"bedroom_count" => ["3","2","1"], "bathroom_count" => ["2", "1", "4+"]}}, hash_dst) + + # hash holding hash holding array v string (string is overwritten by array) + hash_src = {"property" => {"bedroom_count" => ["1", "2"], "bathroom_count" => ["1", "4+"]}} + hash_dst = {"property" => {"bedroom_count" => "3", "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => {"bedroom_count" => ["1", "2"], "bathroom_count" => ["2","1","4+"]}}, hash_dst) + + # hash holding hash holding array v string (string is NOT overwritten by array) + hash_src = {"property" => {"bedroom_count" => ["1", "2"], "bathroom_count" => ["1", "4+"]}} + hash_dst = {"property" => {"bedroom_count" => "3", "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst, {:preserve_unmergeables => true}) + assert_equal({"property" => {"bedroom_count" => "3", "bathroom_count" => ["2","1","4+"]}}, hash_dst) + + # hash holding hash holding string v array (array is overwritten by string) + hash_src = {"property" => {"bedroom_count" => "3", "bathroom_count" => ["1", "4+"]}} + hash_dst = {"property" => {"bedroom_count" => ["1", "2"], "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => {"bedroom_count" => "3", "bathroom_count" => ["2","1","4+"]}}, hash_dst) + + # hash holding hash holding string v array (array does NOT overwrite string) + hash_src = {"property" => {"bedroom_count" => "3", "bathroom_count" => ["1", "4+"]}} + hash_dst = {"property" => {"bedroom_count" => ["1", "2"], "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst, {:preserve_unmergeables => true}) + assert_equal({"property" => {"bedroom_count" => ["1", "2"], "bathroom_count" => ["2","1","4+"]}}, hash_dst) + + # hash holding hash holding hash v array (array is overwritten by hash) + hash_src = {"property" => {"bedroom_count" => {"king_bed" => 3, "queen_bed" => 1}, "bathroom_count" => ["1", "4+"]}} + hash_dst = {"property" => {"bedroom_count" => ["1", "2"], "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => {"bedroom_count" => {"king_bed" => 3, "queen_bed" => 1}, "bathroom_count" => ["2","1","4+"]}}, hash_dst) + + # hash holding hash holding hash v array (array is NOT overwritten by hash) + hash_src = {"property" => {"bedroom_count" => {"king_bed" => 3, "queen_bed" => 1}, "bathroom_count" => ["1", "4+"]}} + hash_dst = {"property" => {"bedroom_count" => ["1", "2"], "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst, {:preserve_unmergeables => true}) + assert_equal({"property" => {"bedroom_count" => ["1", "2"], "bathroom_count" => ["2","1","4+"]}}, hash_dst) + + # 3 hash layers holding integers (integers are overwritten by source) + hash_src = {"property" => {"bedroom_count" => {"king_bed" => 3, "queen_bed" => 1}, "bathroom_count" => ["1", "4+"]}} + hash_dst = {"property" => {"bedroom_count" => {"king_bed" => 2, "queen_bed" => 4}, "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => {"bedroom_count" => {"king_bed" => 3, "queen_bed" => 1}, "bathroom_count" => ["2","1","4+"]}}, hash_dst) + + # 3 hash layers holding arrays of int (arrays are merged) + hash_src = {"property" => {"bedroom_count" => {"king_bed" => [3], "queen_bed" => [1]}, "bathroom_count" => ["1", "4+"]}} + hash_dst = {"property" => {"bedroom_count" => {"king_bed" => [2], "queen_bed" => [4]}, "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => {"bedroom_count" => {"king_bed" => [2,3], "queen_bed" => [4,1]}, "bathroom_count" => ["2","1","4+"]}}, hash_dst) + + # 1 hash overwriting 3 hash layers holding arrays of int + hash_src = {"property" => "1"} + hash_dst = {"property" => {"bedroom_count" => {"king_bed" => [2], "queen_bed" => [4]}, "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => "1"}, hash_dst) + + # 1 hash NOT overwriting 3 hash layers holding arrays of int + hash_src = {"property" => "1"} + hash_dst = {"property" => {"bedroom_count" => {"king_bed" => [2], "queen_bed" => [4]}, "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst, {:preserve_unmergeables => true}) + assert_equal({"property" => {"bedroom_count" => {"king_bed" => [2], "queen_bed" => [4]}, "bathroom_count" => ["2"]}}, hash_dst) + + # 3 hash layers holding arrays of int (arrays are merged) but second hash's array is overwritten + hash_src = {"property" => {"bedroom_count" => {"king_bed" => [3], "queen_bed" => [1]}, "bathroom_count" => "1"}} + hash_dst = {"property" => {"bedroom_count" => {"king_bed" => [2], "queen_bed" => [4]}, "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => {"bedroom_count" => {"king_bed" => [2,3], "queen_bed" => [4,1]}, "bathroom_count" => "1"}}, hash_dst) + + # 3 hash layers holding arrays of int (arrays are merged) but second hash's array is NOT overwritten + hash_src = {"property" => {"bedroom_count" => {"king_bed" => [3], "queen_bed" => [1]}, "bathroom_count" => "1"}} + hash_dst = {"property" => {"bedroom_count" => {"king_bed" => [2], "queen_bed" => [4]}, "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst, {:preserve_unmergeables => true}) + assert_equal({"property" => {"bedroom_count" => {"king_bed" => [2,3], "queen_bed" => [4,1]}, "bathroom_count" => ["2"]}}, hash_dst) + + # 3 hash layers holding arrays of int, but one holds int. This one overwrites, but the rest merge + hash_src = {"property" => {"bedroom_count" => {"king_bed" => 3, "queen_bed" => [1]}, "bathroom_count" => ["1"]}} + hash_dst = {"property" => {"bedroom_count" => {"king_bed" => [2], "queen_bed" => [4]}, "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => {"bedroom_count" => {"king_bed" => 3, "queen_bed" => [4,1]}, "bathroom_count" => ["2","1"]}}, hash_dst) + + # 3 hash layers holding arrays of int, but source is incomplete. + hash_src = {"property" => {"bedroom_count" => {"king_bed" => [3]}, "bathroom_count" => ["1"]}} + hash_dst = {"property" => {"bedroom_count" => {"king_bed" => [2], "queen_bed" => [4]}, "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => {"bedroom_count" => {"king_bed" => [2,3], "queen_bed" => [4]}, "bathroom_count" => ["2","1"]}}, hash_dst) + + # 3 hash layers holding arrays of int, but source is shorter and has new 2nd level ints. + hash_src = {"property" => {"bedroom_count" => {2=>3, "king_bed" => [3]}, "bathroom_count" => ["1"]}} + hash_dst = {"property" => {"bedroom_count" => {"king_bed" => [2], "queen_bed" => [4]}, "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => {"bedroom_count" => {2=>3, "king_bed" => [2,3], "queen_bed" => [4]}, "bathroom_count" => ["2","1"]}}, hash_dst) + + # 3 hash layers holding arrays of int, but source is empty + hash_src = {} + hash_dst = {"property" => {"bedroom_count" => {"king_bed" => [2], "queen_bed" => [4]}, "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => {"bedroom_count" => {"king_bed" => [2], "queen_bed" => [4]}, "bathroom_count" => ["2"]}}, hash_dst) + + # 3 hash layers holding arrays of int, but dest is empty + hash_src = {"property" => {"bedroom_count" => {2=>3, "king_bed" => [3]}, "bathroom_count" => ["1"]}} + hash_dst = {} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => {"bedroom_count" => {2=>3, "king_bed" => [3]}, "bathroom_count" => ["1"]}}, hash_dst) + + # test parameter management for knockout_prefix and overwrite unmergable + assert_raise(DeepMerge::InvalidParameter) {DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => ""})} + assert_raise(DeepMerge::InvalidParameter) {DeepMerge::deep_merge!(hash_src, hash_dst, {:preserve_unmergeables => true, :knockout_prefix => ""})} + assert_raise(DeepMerge::InvalidParameter) {DeepMerge::deep_merge!(hash_src, hash_dst, {:preserve_unmergeables => true, :knockout_prefix => "--"})} + assert_nothing_raised(DeepMerge::InvalidParameter) {DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => "--"})} + assert_nothing_raised(DeepMerge::InvalidParameter) {DeepMerge::deep_merge!(hash_src, hash_dst)} + assert_nothing_raised(DeepMerge::InvalidParameter) {DeepMerge::deep_merge!(hash_src, hash_dst, {:preserve_unmergeables => true})} + + # hash holding arrays of arrays + hash_src = {["1", "2", "3"] => ["1", "2"]} + hash_dst = {["4", "5"] => ["3"]} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({["1","2","3"] => ["1", "2"], ["4", "5"] => ["3"]}, hash_dst) + + # test merging of hash with blank hash, and make sure that source array split still functions + hash_src = {'property' => {'bedroom_count' => ["1","2,3"]}} + hash_dst = {} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({'property' => {'bedroom_count' => ["1","2","3"]}}, hash_dst) + + # test merging of hash with blank hash, and make sure that source array split does not function when turned off + hash_src = {'property' => {'bedroom_count' => ["1","2,3"]}} + hash_dst = {} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX}) + assert_equal({'property' => {'bedroom_count' => ["1","2,3"]}}, hash_dst) + + # test merging into a blank hash with overwrite_unmergeables turned on + hash_src = {"action"=>"browse", "controller"=>"results"} + hash_dst = {} + DeepMerge::deep_merge!(hash_src, hash_dst, {:overwrite_unmergeables => true, :knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal hash_src, hash_dst + + # KNOCKOUT_PREFIX testing + # the next few tests are looking for correct behavior from specific real-world params/session merges + # using the custom modifiers built for param/session merges + + [nil, ","].each do |ko_split| + # typical params/session style hash with knockout_merge elements + hash_params = {"property"=>{"bedroom_count"=>[FIELD_KNOCKOUT_PREFIX+"1", "2", "3"]}} + hash_session = {"property"=>{"bedroom_count"=>["1", "2", "3"]}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ko_split}) + assert_equal({"property"=>{"bedroom_count"=>["2", "3"]}}, hash_session) + + # typical params/session style hash with knockout_merge elements + hash_params = {"property"=>{"bedroom_count"=>[FIELD_KNOCKOUT_PREFIX+"1", "2", "3"]}} + hash_session = {"property"=>{"bedroom_count"=>["3"]}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ko_split}) + assert_equal({"property"=>{"bedroom_count"=>["3","2"]}}, hash_session) + + # typical params/session style hash with knockout_merge elements + hash_params = {"property"=>{"bedroom_count"=>[FIELD_KNOCKOUT_PREFIX+"1", "2", "3"]}} + hash_session = {"property"=>{"bedroom_count"=>["4"]}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ko_split}) + assert_equal({"property"=>{"bedroom_count"=>["4","2","3"]}}, hash_session) + + # typical params/session style hash with knockout_merge elements + hash_params = {"property"=>{"bedroom_count"=>[FIELD_KNOCKOUT_PREFIX+"1", "2", "3"]}} + hash_session = {"property"=>{"bedroom_count"=>[FIELD_KNOCKOUT_PREFIX+"1", "4"]}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ko_split}) + assert_equal({"property"=>{"bedroom_count"=>["4","2","3"]}}, hash_session) + + # typical params/session style hash with knockout_merge elements + hash_params = {"amenity"=>{"id"=>[FIELD_KNOCKOUT_PREFIX+"1", FIELD_KNOCKOUT_PREFIX+"2", "3", "4"]}} + hash_session = {"amenity"=>{"id"=>["1", "2"]}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ko_split}) + assert_equal({"amenity"=>{"id"=>["3","4"]}}, hash_session) + end + + # special params/session style hash with knockout_merge elements in form src: ["1","2"] dest:["--1,--2", "3,4"] + hash_params = {"amenity"=>{"id"=>[FIELD_KNOCKOUT_PREFIX+"1,"+FIELD_KNOCKOUT_PREFIX+"2", "3,4"]}} + hash_session = {"amenity"=>{"id"=>["1", "2"]}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"amenity"=>{"id"=>["3","4"]}}, hash_session) + + # same as previous but without ko_split value, this merge should fail + hash_params = {"amenity"=>{"id"=>[FIELD_KNOCKOUT_PREFIX+"1,"+FIELD_KNOCKOUT_PREFIX+"2", "3,4"]}} + hash_session = {"amenity"=>{"id"=>["1", "2"]}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX}) + assert_equal({"amenity"=>{"id"=>["1","2","3,4"]}}, hash_session) + + # special params/session style hash with knockout_merge elements in form src: ["1","2"] dest:["--1,--2", "3,4"] + hash_params = {"amenity"=>{"id"=>[FIELD_KNOCKOUT_PREFIX+"1,2", "3,4", "--5", "6"]}} + hash_session = {"amenity"=>{"id"=>["1", "2"]}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"amenity"=>{"id"=>["2","3","4","6"]}}, hash_session) + + # special params/session style hash with knockout_merge elements in form src: ["--1,--2", "3,4", "--5", "6"] dest:["1,2", "3,4"] + hash_params = {"amenity"=>{"id"=>["#{FIELD_KNOCKOUT_PREFIX}1,#{FIELD_KNOCKOUT_PREFIX}2", "3,4", "#{FIELD_KNOCKOUT_PREFIX}5", "6"]}} + hash_session = {"amenity"=>{"id"=>["1", "2", "3", "4"]}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"amenity"=>{"id"=>["3","4","6"]}}, hash_session) + + + hash_src = {"url_regions"=>[], "region"=>{"ids"=>["227,233"]}, "action"=>"browse", "task"=>"browse", "controller"=>"results"} + hash_dst = {"region"=>{"ids"=>["227"]}} + DeepMerge::deep_merge!(hash_src.dup, hash_dst, {:overwrite_unmergeables => true, :knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"url_regions"=>[], "region"=>{"ids"=>["227","233"]}, "action"=>"browse", "task"=>"browse", "controller"=>"results"}, hash_dst) + + hash_src = {"region"=>{"ids"=>["--","227"], "id"=>"230"}} + hash_dst = {"region"=>{"ids"=>["227", "233", "324", "230", "230"], "id"=>"230"}} + DeepMerge::deep_merge!(hash_src, hash_dst, {:overwrite_unmergeables => true, :knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"region"=>{"ids"=>["227"], "id"=>"230"}}, hash_dst) + + hash_src = {"region"=>{"ids"=>["--","227", "232", "233"], "id"=>"232"}} + hash_dst = {"region"=>{"ids"=>["227", "233", "324", "230", "230"], "id"=>"230"}} + DeepMerge::deep_merge!(hash_src, hash_dst, {:overwrite_unmergeables => true, :knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"region"=>{"ids"=>["227", "232", "233"], "id"=>"232"}}, hash_dst) + + hash_src = {"region"=>{"ids"=>["--,227,232,233"], "id"=>"232"}} + hash_dst = {"region"=>{"ids"=>["227", "233", "324", "230", "230"], "id"=>"230"}} + DeepMerge::deep_merge!(hash_src, hash_dst, {:overwrite_unmergeables => true, :knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"region"=>{"ids"=>["227", "232", "233"], "id"=>"232"}}, hash_dst) + + hash_src = {"region"=>{"ids"=>["--,227,232","233"], "id"=>"232"}} + hash_dst = {"region"=>{"ids"=>["227", "233", "324", "230", "230"], "id"=>"230"}} + DeepMerge::deep_merge!(hash_src, hash_dst, {:overwrite_unmergeables => true, :knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"region"=>{"ids"=>["227", "232", "233"], "id"=>"232"}}, hash_dst) + + hash_src = {"region"=>{"ids"=>["--,227"], "id"=>"230"}} + hash_dst = {"region"=>{"ids"=>["227", "233", "324", "230", "230"], "id"=>"230"}} + DeepMerge::deep_merge!(hash_src, hash_dst, {:overwrite_unmergeables => true, :knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"region"=>{"ids"=>["227"], "id"=>"230"}}, hash_dst) + + hash_src = {"region"=>{"ids"=>["--,227"], "id"=>"230"}} + hash_dst = {"region"=>{"ids"=>["227", "233", "324", "230", "230"], "id"=>"230"}, "action"=>"browse", "task"=>"browse", "controller"=>"results", "property_order_by"=>"property_type.descr"} + DeepMerge::deep_merge!(hash_src, hash_dst, {:overwrite_unmergeables => true, :knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"region"=>{"ids"=>["227"], "id"=>"230"}, "action"=>"browse", "task"=>"browse", + "controller"=>"results", "property_order_by"=>"property_type.descr"}, hash_dst) + + hash_src = {"query_uuid"=>"6386333d-389b-ab5c-8943-6f3a2aa914d7", "region"=>{"ids"=>["--,227"], "id"=>"230"}} + hash_dst = {"query_uuid"=>"6386333d-389b-ab5c-8943-6f3a2aa914d7", "url_regions"=>[], "region"=>{"ids"=>["227", "233", "324", "230", "230"], "id"=>"230"}, "action"=>"browse", "task"=>"browse", "controller"=>"results", "property_order_by"=>"property_type.descr"} + DeepMerge::deep_merge!(hash_src, hash_dst, {:overwrite_unmergeables => true, :knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"query_uuid" => "6386333d-389b-ab5c-8943-6f3a2aa914d7", "url_regions"=>[], + "region"=>{"ids"=>["227"], "id"=>"230"}, "action"=>"browse", "task"=>"browse", + "controller"=>"results", "property_order_by"=>"property_type.descr"}, hash_dst) + + # knock out entire dest hash if "--" is passed for source + hash_params = {'amenity' => "--"} + hash_session = {"amenity" => "1"} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => "--", :unpack_arrays => ","}) + assert_equal({'amenity' => ""}, hash_session) + + # knock out entire dest hash if "--" is passed for source + hash_params = {'amenity' => ["--"]} + hash_session = {"amenity" => "1"} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => "--", :unpack_arrays => ","}) + assert_equal({'amenity' => []}, hash_session) + + # knock out entire dest hash if "--" is passed for source + hash_params = {'amenity' => "--"} + hash_session = {"amenity" => ["1"]} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => "--", :unpack_arrays => ","}) + assert_equal({'amenity' => ""}, hash_session) + + # knock out entire dest hash if "--" is passed for source + hash_params = {'amenity' => ["--"]} + hash_session = {"amenity" => ["1"]} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => "--", :unpack_arrays => ","}) + assert_equal({'amenity' => []}, hash_session) + + # knock out entire dest hash if "--" is passed for source + hash_params = {'amenity' => ["--"]} + hash_session = {"amenity" => "1"} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => "--", :unpack_arrays => ","}) + assert_equal({'amenity' => []}, hash_session) + + # knock out entire dest hash if "--" is passed for source + hash_params = {'amenity' => ["--", "2"]} + hash_session = {'amenity' => ["1", "3", "7+"]} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => "--", :unpack_arrays => ","}) + assert_equal({'amenity' => ["2"]}, hash_session) + + # knock out entire dest hash if "--" is passed for source + hash_params = {'amenity' => ["--", "2"]} + hash_session = {'amenity' => "5"} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => "--", :unpack_arrays => ","}) + assert_equal({'amenity' => ['2']}, hash_session) + + # knock out entire dest hash if "--" is passed for source + hash_params = {'amenity' => "--"} + hash_session = {"amenity"=>{"id"=>["1", "2", "3", "4"]}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => "--", :unpack_arrays => ","}) + assert_equal({'amenity' => ""}, hash_session) + + # knock out entire dest hash if "--" is passed for source + hash_params = {'amenity' => ["--"]} + hash_session = {"amenity"=>{"id"=>["1", "2", "3", "4"]}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => "--", :unpack_arrays => ","}) + assert_equal({'amenity' => []}, hash_session) + + # knock out dest array if "--" is passed for source + hash_params = {"region" => {'ids' => FIELD_KNOCKOUT_PREFIX}} + hash_session = {"region"=>{"ids"=>["1", "2", "3", "4"]}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({'region' => {'ids' => ""}}, hash_session) + + # knock out dest array but leave other elements of hash intact + hash_params = {"region" => {'ids' => FIELD_KNOCKOUT_PREFIX}} + hash_session = {"region"=>{"ids"=>["1", "2", "3", "4"], 'id'=>'11'}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({'region' => {'ids' => "", 'id'=>'11'}}, hash_session) + + # knock out entire tree of dest hash + hash_params = {"region" => FIELD_KNOCKOUT_PREFIX} + hash_session = {"region"=>{"ids"=>["1", "2", "3", "4"], 'id'=>'11'}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({'region' => ""}, hash_session) + + # knock out entire tree of dest hash - retaining array format + hash_params = {"region" => {'ids' => [FIELD_KNOCKOUT_PREFIX]}} + hash_session = {"region"=>{"ids"=>["1", "2", "3", "4"], 'id'=>'11'}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({'region' => {'ids' => [], 'id'=>'11'}}, hash_session) + + # knock out entire tree of dest hash & replace with new content + hash_params = {"region" => {'ids' => ["2", FIELD_KNOCKOUT_PREFIX, "6"]}} + hash_session = {"region"=>{"ids"=>["1", "2", "3", "4"], 'id'=>'11'}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({'region' => {'ids' => ["2", "6"], 'id'=>'11'}}, hash_session) + + # knock out entire tree of dest hash & replace with new content + hash_params = {"region" => {'ids' => ["7", FIELD_KNOCKOUT_PREFIX, "6"]}} + hash_session = {"region"=>{"ids"=>["1", "2", "3", "4"], 'id'=>'11'}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({'region' => {'ids' => ["7", "6"], 'id'=>'11'}}, hash_session) + + # edge test: make sure that when we turn off knockout_prefix that all values are processed correctly + hash_params = {"region" => {'ids' => ["7", "--", "2", "6,8"]}} + hash_session = {"region"=>{"ids"=>["1", "2", "3", "4"], 'id'=>'11'}} + DeepMerge::deep_merge!(hash_params, hash_session, {:unpack_arrays => ","}) + assert_equal({'region' => {'ids' => ["1", "2", "3", "4", "7", "--", "6", "8"], 'id'=>'11'}}, hash_session) + + # edge test 2: make sure that when we turn off source array split that all values are processed correctly + hash_params = {"region" => {'ids' => ["7", "3", "--", "6,8"]}} + hash_session = {"region"=>{"ids"=>["1", "2", "3", "4"], 'id'=>'11'}} + DeepMerge::deep_merge!(hash_params, hash_session) + assert_equal({'region' => {'ids' => ["1", "2", "3", "4", "7", "--", "6,8"], 'id'=>'11'}}, hash_session) + + # Example: src = {'key' => "--1"}, dst = {'key' => "1"} -> merges to {'key' => ""} + hash_params = {"amenity"=>"--1"} + hash_session = {"amenity"=>"1"} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX}) + assert_equal({"amenity"=>""}, hash_session) + + # Example: src = {'key' => "--1"}, dst = {'key' => "2"} -> merges to {'key' => ""} + hash_params = {"amenity"=>"--1"} + hash_session = {"amenity"=>"2"} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX}) + assert_equal({"amenity"=>""}, hash_session) + + # Example: src = {'key' => "--1"}, dst = {'key' => "1"} -> merges to {'key' => ""} + hash_params = {"amenity"=>["--1"]} + hash_session = {"amenity"=>"1"} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX}) + assert_equal({"amenity"=>[]}, hash_session) + + # Example: src = {'key' => "--1"}, dst = {'key' => "1"} -> merges to {'key' => ""} + hash_params = {"amenity"=>["--1"]} + hash_session = {"amenity"=>["1"]} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX}) + assert_equal({"amenity"=>[]}, hash_session) + + # Example: src = {'key' => "--1"}, dst = {'key' => "1"} -> merges to {'key' => ""} + hash_params = {"amenity"=>"--1"} + hash_session = {} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX}) + assert_equal({"amenity"=>""}, hash_session) + + + # Example: src = {'key' => "--1"}, dst = {'key' => "1"} -> merges to {'key' => ""} + hash_params = {"amenity"=>"--1"} + hash_session = {"amenity"=>["1"]} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX}) + assert_equal({"amenity"=>""}, hash_session) + + #are unmerged hashes passed unmodified w/out :unpack_arrays? + hash_params = {"amenity"=>{"id"=>["26,27"]}} + hash_session = {} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX}) + assert_equal({"amenity"=>{"id"=>["26,27"]}}, hash_session) + + #hash should be merged + hash_params = {"amenity"=>{"id"=>["26,27"]}} + hash_session = {} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"amenity"=>{"id"=>["26","27"]}}, hash_session) + + # second merge of same values should result in no change in output + hash_params = {"amenity"=>{"id"=>["26,27"]}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"amenity"=>{"id"=>["26","27"]}}, hash_session) + + #hashes with knockout values are suppressed + hash_params = {"amenity"=>{"id"=>["#{FIELD_KNOCKOUT_PREFIX}26,#{FIELD_KNOCKOUT_PREFIX}27,28"]}} + hash_session = {} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"amenity"=>{"id"=>["28"]}}, hash_session) + + hash_src= {'region' =>{'ids'=>['--']}, 'query_uuid' => 'zzz'} + hash_dst= {'region' =>{'ids'=>['227','2','3','3']}, 'query_uuid' => 'zzz'} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => '--', :unpack_arrays => ","}) + assert_equal({'region' =>{'ids'=>[]}, 'query_uuid' => 'zzz'}, hash_dst) + + hash_src= {'region' =>{'ids'=>['--']}, 'query_uuid' => 'zzz'} + hash_dst= {'region' =>{'ids'=>['227','2','3','3'], 'id' => '3'}, 'query_uuid' => 'zzz'} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => '--', :unpack_arrays => ","}) + assert_equal({'region' =>{'ids'=>[], 'id'=>'3'}, 'query_uuid' => 'zzz'}, hash_dst) + + hash_src= {'region' =>{'ids'=>['--']}, 'query_uuid' => 'zzz'} + hash_dst= {'region' =>{'muni_city_id' => '2244', 'ids'=>['227','2','3','3'], 'id'=>'3'}, 'query_uuid' => 'zzz'} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => '--', :unpack_arrays => ","}) + assert_equal({'region' =>{'muni_city_id' => '2244', 'ids'=>[], 'id'=>'3'}, 'query_uuid' => 'zzz'}, hash_dst) + + hash_src= {'region' =>{'ids'=>['--'], 'id' => '5'}, 'query_uuid' => 'zzz'} + hash_dst= {'region' =>{'muni_city_id' => '2244', 'ids'=>['227','2','3','3'], 'id'=>'3'}, 'query_uuid' => 'zzz'} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => '--', :unpack_arrays => ","}) + assert_equal({'region' =>{'muni_city_id' => '2244', 'ids'=>[], 'id'=>'5'}, 'query_uuid' => 'zzz'}, hash_dst) + + hash_src= {'region' =>{'ids'=>['--', '227'], 'id' => '5'}, 'query_uuid' => 'zzz'} + hash_dst= {'region' =>{'muni_city_id' => '2244', 'ids'=>['227','2','3','3'], 'id'=>'3'}, 'query_uuid' => 'zzz'} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => '--', :unpack_arrays => ","}) + assert_equal({'region' =>{'muni_city_id' => '2244', 'ids'=>['227'], 'id'=>'5'}, 'query_uuid' => 'zzz'}, hash_dst) + + hash_src= {'region' =>{'muni_city_id' => '--', 'ids'=>'--', 'id'=>'5'}, 'query_uuid' => 'zzz'} + hash_dst= {'region' =>{'muni_city_id' => '2244', 'ids'=>['227','2','3','3'], 'id'=>'3'}, 'query_uuid' => 'zzz'} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => '--', :unpack_arrays => ","}) + assert_equal({'region' =>{'muni_city_id' => '', 'ids'=>'', 'id'=>'5'}, 'query_uuid' => 'zzz'}, hash_dst) + + hash_src= {'region' =>{'muni_city_id' => '--', 'ids'=>['--'], 'id'=>'5'}, 'query_uuid' => 'zzz'} + hash_dst= {'region' =>{'muni_city_id' => '2244', 'ids'=>['227','2','3','3'], 'id'=>'3'}, 'query_uuid' => 'zzz'} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => '--', :unpack_arrays => ","}) + assert_equal({'region' =>{'muni_city_id' => '', 'ids'=>[], 'id'=>'5'}, 'query_uuid' => 'zzz'}, hash_dst) + + hash_src= {'region' =>{'muni_city_id' => '--', 'ids'=>['--','227'], 'id'=>'5'}, 'query_uuid' => 'zzz'} + hash_dst= {'region' =>{'muni_city_id' => '2244', 'ids'=>['227','2','3','3'], 'id'=>'3'}, 'query_uuid' => 'zzz'} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => '--', :unpack_arrays => ","}) + assert_equal({'region' =>{'muni_city_id' => '', 'ids'=>['227'], 'id'=>'5'}, 'query_uuid' => 'zzz'}, hash_dst) + + hash_src = {"muni_city_id"=>"--", "id"=>""} + hash_dst = {"muni_city_id"=>"", "id"=>""} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => '--', :unpack_arrays => ","}) + assert_equal({"muni_city_id"=>"", "id"=>""}, hash_dst) + + hash_src = {"region"=>{"muni_city_id"=>"--", "id"=>""}} + hash_dst = {"region"=>{"muni_city_id"=>"", "id"=>""}} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => '--', :unpack_arrays => ","}) + assert_equal({"region"=>{"muni_city_id"=>"", "id"=>""}}, hash_dst) + + hash_src = {"query_uuid"=>"a0dc3c84-ec7f-6756-bdb0-fff9157438ab", "url_regions"=>[], "region"=>{"muni_city_id"=>"--", "id"=>""}, "property"=>{"property_type_id"=>"", "search_rate_min"=>"", "search_rate_max"=>""}, "task"=>"search", "run_query"=>"Search"} + hash_dst = {"query_uuid"=>"a0dc3c84-ec7f-6756-bdb0-fff9157438ab", "url_regions"=>[], "region"=>{"muni_city_id"=>"", "id"=>""}, "property"=>{"property_type_id"=>"", "search_rate_min"=>"", "search_rate_max"=>""}, "task"=>"search", "run_query"=>"Search"} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => '--', :unpack_arrays => ","}) + assert_equal({"query_uuid"=>"a0dc3c84-ec7f-6756-bdb0-fff9157438ab", "url_regions"=>[], "region"=>{"muni_city_id"=>"", "id"=>""}, "property"=>{"property_type_id"=>"", "search_rate_min"=>"", "search_rate_max"=>""}, "task"=>"search", "run_query"=>"Search"}, hash_dst) + + # hash of array of hashes + hash_src = {"item" => [{"1" => "3"}, {"2" => "4"}]} + hash_dst = {"item" => [{"3" => "5"}]} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"item" => [{"3" => "5"}, {"1" => "3"}, {"2" => "4"}]}, hash_dst) + end # test_deep_merge +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/History.txt b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/History.txt new file mode 100644 index 0000000..9833fd1 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/History.txt @@ -0,0 +1,28 @@ +== 1.1.2 / 2009-11-30 + * Converted to Jeweler for gem packaging + * diy/factory.rb was somehow missing from the 1.1.1 gem on gemcutter. This has been fixed as part of the Jeweler changeover. + * Rebuilt homepage http://atomicobject.github.com/diy + +== 1.1.1 / 2008-05-21 + * Fixed bug that did not allow a method to be properly injected into an object + +== 1.1 / 2008-05-20 + * Added 'method' directive for building a bounded method from an object defined in diy + +== 1.0.3 / 2007-12-11 + +* The 1.0.1 release had a load-path search in it that resulted in requiring files with full path names (rooted in loadpath entries). This is unintuitive, and will almost always result in a double "require" if the application code ever requires a library. The "require" for library loading now relies implicitly on the load path (just like normal human-coded requires.) + +== 1.0.1 / 2007-12-02 + +* Added 'using_namespace' directive for assuming a module for a group of object defs +* Added 'use_class_directly' option for configuring an ObjectDef. Instead of instantiating an instance + of the specified class, the class itself is referenced. (Good for injecting ActiveRecord classes into + other components in the guise of factories. +* Added DIY::Context.auto_require boolean setting. When false, the library of a + class is not autoloaded ahead of object construction. Is true by default. +* 'auto_require' can, if neccessary, be set in the YAML config for an individual object. + +== 1.0.0 / 2007-11-19 + +* Released! diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/README.rdoc b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/README.rdoc new file mode 100644 index 0000000..6dfef2e --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/README.rdoc @@ -0,0 +1,233 @@ +== DIY + +* http://atomicobject.github.com/diy + +== DESCRIPTION: + +DIY (Dependency Injection in YAML) is a simple dependency injection library +which focuses on declarative composition of objects through constructor injection. + +== INSTALL: + +* gem install diy + +== SYNOPSIS: + +=== Common Usage + +Author a YAML file that describes your objects and how they fit together. +This means you're building a Hash whose keys are the object names, and whose +values are Hashes that define the object. + +The following context defines an automobile engine: + +context.yml: + --- + engine: + compose: throttle, block + throttle: + compose: cable, pedal + block: + cable: + pedal: + +In your code, use DIY to load the YAML, then access its parts: + + context = DIY::Context.from_file('context.yml') + context[:engine] => + +This approach assumes: + +* You've got classes for Engine, Throttle, Block, Cable and Pedal +* They're defined in engine.rb, throttle.rb, etc +* The library files are in your load-path +* Engine and Throttle both have a constructor that accepts a Hash. The Hash + will contain keys 'throttle', 'block' (for Engine) and 'cable, 'pedal' (for Throttle) + and the values will be references to their respective objects. +* Block, Cable and Pedal all have default constructors that accept no arguments + +Sample code for Engine's constructor: + + class Engine + def initialize(components) + @throttle = components['throttle'] + @block = components['block'] + end + end + +Writing code like that is repetetive; that's why we created the Constructor gem, which lets you +specify object components using the "constructor" class method: + +Using constructor, you can write Engine like this: + + class Engine + constructor :throttle, :block + end + +=== Special Cases + +If your object has a lot of components (or they have big names) you can specify an array of component names +as opposed to a comma-separated list: + + engine: + compose: + - throttle + - block + +Sometimes you won't be able to rely on DIY's basic assumptions about class names and library files. + +* You can specify the 'class' option +* You can specify the 'library' option. If you do not, the library is inferred from the class name. + (Eg, My::Train::Station will be sought in "my/train/station.rb" + + engine: + class: FourHorse::Base + library: general_engines/base + compose: throttle, block + +If the Hash coming into your constructor needs to have some keys that do not exactly match the official +object names, you can specify them one-by-one: + + engine: + the_throttle: throttle + the_block: block + +=== Non-singleton objects + +Non-singletons are named objects that provide a new instance every time you ask for them. +By default, DIY considers all objects to be singletons. To override, use the "singleton" setting and +set it to false: + + foo: + singleton: false + +=== Sub-Contexts + +Sub-contexts are useful for creating isolated object networks that may need to be instantiated +zero or many times in your application. Objects defined in subcontexts can reference "upward" to +their surroundings, as well as objects in the subcontext itself. + +If you wanted to be able to make more than one Engine from the preceding examples, you might try: + + --- + epa_regulations: + + +automotive_plant: + engine: + compose: block, throttle, epa_regulations + block: + throttle: + +Each time you delve into the automotive_plant, you get a solar system of the defined objects. +In this context, the objects are singleton-like. The next time you invoke the subcontext, however, +you'll be working with a fresh set of objects... another solar system with the same layout, so to speak. + +Subcontexts are not initialized until you call upon them, which you do using the "within" method: + + context = DIY::Context.from_file('context.yml') + context.within('automotive_plant') do |plant| + puts plant[:engine] + end + +=== Direct Class References + +Occasionally you will have a class at your disposal that you'd like to provide directly as components +to other objects (as opposed to getting _instances_ of that class, you want to reference the class itself, eg, +to use its factory methods). Enter the "use_class_directly" flag: + + --- + customer_order_finder: + class: CustomerOrder + use_class_directly: true + +This can be handy in Rails when you'd like to use some of class methods on an ActiveRecord subclass, but +you'd like to avoid direct ActiveRecord class usage in your code. In this case, the customer_order_finder +is actually the CustomerOrder class, and so, it has methods like "find" and "destroy_all". + +=== Namespace Convenience + +If you find yourself writing context entries like this: + + --- + engine: + class: Car::Parts::Engine + throttle: + class: Car::Parts::Block + cable: + class: Car::Parts::Cable + +You can set the "assumed" module for a group of objects like this: + + --- + using_namespace Car Parts: + engine: + + throttle: + + block: + +=== Preventing auto-requiring of library files + +Normally, DIY will "require" the library for an object just before it instantiates the object. +If this is not desired (in Rails, auto-require can lead to library double-load issues), you +can deactivate auto-require. There is a global default setting (handled in code) and +a per-object override (handled in the context YAML): + + DIY::Context.auto_require = false + + --- + engine: + auto_require: false + +=== Factories + +It is possible to create factories automatically with DIY: + + --- + car_dealer: + compose: car_factory + + car_factory: + builds: car + +Then you can use the factory to easily build objects: + + context = DIY::Context.from_file('context.yml') + context[:car_factory].create => + +=== Method Directive + +This introduces the concept of first class methods. An object can now be constructed with a method object +bound to a particular object in the diy context. + + --- + trinket_builder: + + method build_trinket: + object: trinket_builder + method: build + +== LICENSE: + +(The MIT License) + +Copyright (c) 2007 Atomic Object + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/Rakefile b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/Rakefile new file mode 100644 index 0000000..0fb9c44 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/Rakefile @@ -0,0 +1,33 @@ +require 'rubygems' + +task :default => [ :test ] + +require 'rake/testtask' +Rake::TestTask.new do |t| + t.libs << "test" + t.test_files = FileList['test/**/*_test.rb'] + t.verbose = true +end + + +begin + require 'jeweler' + Jeweler::Tasks.new do |gemspec| + $: << "lib" + require 'diy.rb' + gemspec.name = 'diy' + gemspec.version = DIY::VERSION + gemspec.summary = 'Constructor-based dependency injection container using YAML input.' + gemspec.description = 'Constructor-based dependency injection container using YAML input.' + gemspec.homepage = 'http://atomicobject.github.com/diy' + gemspec.authors = 'Atomic Object' + gemspec.email = 'github@atomicobject.com' + gemspec.test_files = FileList['test/*_test.rb'] + gemspec.add_dependency 'constructor', '>= 1.0.0' + end + + Jeweler::GemcutterTasks.new + +rescue LoadError + puts "(jeweler not installed)" +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/TODO.txt b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/TODO.txt new file mode 100644 index 0000000..8533234 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/TODO.txt @@ -0,0 +1,9 @@ +Sun Dec 2 19:59:16 EST 2007 +crosby + +Features from FRE's rogue diy.rb (inside Injection) that need to be +incorporated into trunk: + +* auto_require +* use_class_directly + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/diy.gemspec b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/diy.gemspec new file mode 100644 index 0000000..fe9ac19 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/diy.gemspec @@ -0,0 +1,131 @@ +# Generated by jeweler +# DO NOT EDIT THIS FILE DIRECTLY +# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command +# -*- encoding: utf-8 -*- + +Gem::Specification.new do |s| + s.name = %q{diy} + s.version = "1.1.2" + + s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= + s.authors = ["Atomic Object"] + s.date = %q{2009-12-01} + s.description = %q{Constructor-based dependency injection container using YAML input.} + s.email = %q{github@atomicobject.com} + s.extra_rdoc_files = [ + "README.rdoc" + ] + s.files = [ + "History.txt", + "README.rdoc", + "Rakefile", + "TODO.txt", + "diy.gemspec", + "lib/diy.rb", + "lib/diy/factory.rb", + "sample_code/car.rb", + "sample_code/chassis.rb", + "sample_code/diy_example.rb", + "sample_code/engine.rb", + "sample_code/objects.yml", + "test/constructor.rb", + "test/diy_test.rb", + "test/factory_test.rb", + "test/files/broken_construction.yml", + "test/files/cat/cat.rb", + "test/files/cat/extra_conflict.yml", + "test/files/cat/heritage.rb", + "test/files/cat/needs_input.yml", + "test/files/cat/the_cat_lineage.rb", + "test/files/dog/dog_model.rb", + "test/files/dog/dog_presenter.rb", + "test/files/dog/dog_view.rb", + "test/files/dog/file_resolver.rb", + "test/files/dog/other_thing.rb", + "test/files/dog/simple.yml", + "test/files/donkey/foo.rb", + "test/files/donkey/foo/bar/qux.rb", + "test/files/factory/beef.rb", + "test/files/factory/dog.rb", + "test/files/factory/factory.yml", + "test/files/factory/farm/llama.rb", + "test/files/factory/farm/pork.rb", + "test/files/factory/kitten.rb", + "test/files/fud/objects.yml", + "test/files/fud/toy.rb", + "test/files/functions/attached_things_builder.rb", + "test/files/functions/invalid_method.yml", + "test/files/functions/method_extractor.rb", + "test/files/functions/nonsingleton_objects.yml", + "test/files/functions/objects.yml", + "test/files/functions/thing.rb", + "test/files/functions/thing_builder.rb", + "test/files/functions/things_builder.rb", + "test/files/gnu/objects.yml", + "test/files/gnu/thinger.rb", + "test/files/goat/base.rb", + "test/files/goat/can.rb", + "test/files/goat/goat.rb", + "test/files/goat/objects.yml", + "test/files/goat/paper.rb", + "test/files/goat/plane.rb", + "test/files/goat/shirt.rb", + "test/files/goat/wings.rb", + "test/files/horse/holder_thing.rb", + "test/files/horse/objects.yml", + "test/files/namespace/animal/bird.rb", + "test/files/namespace/animal/cat.rb", + "test/files/namespace/animal/reptile/hardshell/turtle.rb", + "test/files/namespace/animal/reptile/lizard.rb", + "test/files/namespace/bad_module_specified.yml", + "test/files/namespace/class_name_combine.yml", + "test/files/namespace/hello.txt", + "test/files/namespace/no_module_specified.yml", + "test/files/namespace/objects.yml", + "test/files/namespace/road.rb", + "test/files/namespace/sky.rb", + "test/files/namespace/subcontext.yml", + "test/files/non_singleton/air.rb", + "test/files/non_singleton/fat_cat.rb", + "test/files/non_singleton/objects.yml", + "test/files/non_singleton/pig.rb", + "test/files/non_singleton/thread_spinner.rb", + "test/files/non_singleton/tick.rb", + "test/files/non_singleton/yard.rb", + "test/files/yak/core_model.rb", + "test/files/yak/core_presenter.rb", + "test/files/yak/core_view.rb", + "test/files/yak/data_source.rb", + "test/files/yak/fringe_model.rb", + "test/files/yak/fringe_presenter.rb", + "test/files/yak/fringe_view.rb", + "test/files/yak/giant_squid.rb", + "test/files/yak/krill.rb", + "test/files/yak/my_objects.yml", + "test/files/yak/sub_sub_context_test.yml", + "test/test_helper.rb" + ] + s.homepage = %q{http://atomicobject.github.com/diy} + s.rdoc_options = ["--charset=UTF-8"] + s.require_paths = ["lib"] + s.rubygems_version = %q{1.3.5} + s.summary = %q{Constructor-based dependency injection container using YAML input.} + s.test_files = [ + "test/diy_test.rb", + "test/factory_test.rb" + ] + + if s.respond_to? :specification_version then + current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION + s.specification_version = 3 + + if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then + s.add_runtime_dependency(%q, [">= 1.0.0"]) + else + s.add_dependency(%q, [">= 1.0.0"]) + end + else + s.add_dependency(%q, [">= 1.0.0"]) + end +end + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/lib/diy.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/lib/diy.rb new file mode 100644 index 0000000..581afc7 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/lib/diy.rb @@ -0,0 +1,403 @@ +require 'diy/factory.rb' +require 'yaml' +require 'set' + +module DIY #:nodoc:# + VERSION = '1.1.2' + class Context + + class << self + # Enable / disable automatic requiring of libraries. Default: true + attr_accessor :auto_require + end + @auto_require = true + + # Accepts a Hash defining the object context (usually loaded from objects.yml), and an additional + # Hash containing objects to inject into the context. + def initialize(context_hash, extra_inputs={}) + raise "Nil context hash" unless context_hash + raise "Need a hash" unless context_hash.kind_of?(Hash) + [ "[]", "keys" ].each do |mname| + unless extra_inputs.respond_to?(mname) + raise "Extra inputs must respond to hash-like [] operator and methods #keys and #each" + end + end + + # store extra inputs + if extra_inputs.kind_of?(Hash) + @extra_inputs= {} + extra_inputs.each { |k,v| @extra_inputs[k.to_s] = v } # smooth out the names + else + @extra_inputs = extra_inputs + end + + collect_object_and_subcontext_defs context_hash + + # init the cache + @cache = {} + @cache['this_context'] = self + end + + + # Convenience: create a new DIY::Context by loading from a String (or open file handle.) + def self.from_yaml(io_or_string, extra_inputs={}) + raise "nil input to YAML" unless io_or_string + Context.new(YAML.load(io_or_string), extra_inputs) + end + + # Convenience: create a new DIY::Context by loading from the named file. + def self.from_file(fname, extra_inputs={}) + raise "nil file name" unless fname + self.from_yaml(File.read(fname), extra_inputs) + end + + # Return a reference to the object named. If necessary, the object will + # be instantiated on first use. If the object is non-singleton, a new + # object will be produced each time. + def get_object(obj_name) + key = obj_name.to_s + obj = @cache[key] + unless obj + if extra_inputs_has(key) + obj = @extra_inputs[key] + else + case @defs[key] + when MethodDef + obj = construct_method(key) + when FactoryDef + obj = construct_factory(key) + @cache[key] = obj + else + obj = construct_object(key) + @cache[key] = obj if @defs[key].singleton? + end + end + end + obj + end + alias :[] :get_object + + # Inject a named object into the Context. This must be done before the Context has instantiated the + # object in question. + def set_object(obj_name,obj) + key = obj_name.to_s + raise "object '#{key}' already exists in context" if @cache.keys.include?(key) + @cache[key] = obj + end + alias :[]= :set_object + + # Provide a listing of object names + def keys + (@defs.keys.to_set + @extra_inputs.keys.to_set).to_a + end + + # Instantiate and yield the named subcontext + def within(sub_context_name) + # Find the subcontext definitaion: + context_def = @sub_context_defs[sub_context_name.to_s] + raise "No sub-context named #{sub_context_name}" unless context_def + # Instantiate a new context using self as parent: + context = Context.new( context_def, self ) + + yield context + end + + # Returns true if the context contains an object with the given name + def contains_object(obj_name) + key = obj_name.to_s + @defs.keys.member?(key) or extra_inputs_has(key) + end + + # Every top level object in the Context is instantiated. This is especially useful for + # systems that have "floating observers"... objects that are never directly accessed, who + # would thus never be instantiated by coincedence. This does not build any subcontexts + # that may exist. + def build_everything + @defs.keys.each { |k| self[k] } + end + alias :build_all :build_everything + alias :preinstantiate_singletons :build_everything + + private + + def collect_object_and_subcontext_defs(context_hash) + @defs = {} + @sub_context_defs = {} + get_defs_from context_hash + end + + def get_defs_from(hash, namespace=nil) + hash.each do |name,info| + # we modify the info hash below so it's important to have a new + # instance to play with + info = info.dup if info + + # see if we are building a factory + if info and info.has_key?('builds') + unless info.has_key?('auto_require') + info['auto_require'] = self.class.auto_require + end + + if namespace + info['builds'] = namespace.build_classname(info['builds']) + end + @defs[name] = FactoryDef.new({:name => name, + :target => info['builds'], + :library => info['library'], + :auto_require => info['auto_require']}) + next + end + + name = name.to_s + case name + when /^\+/ + # subcontext + @sub_context_defs[name.gsub(/^\+/,'')] = info + + when /^using_namespace/ + # namespace: use a module(s) prefix for the classname of contained object defs + # NOTE: namespacing is NOT scope... it's just a convenient way to setup class names for a group of objects. + get_defs_from info, parse_namespace(name) + when /^method\s/ + key_name = name.gsub(/^method\s/, "") + @defs[key_name] = MethodDef.new(:name => key_name, + :object => info['object'], + :method => info['method'], + :attach => info['attach']) + else + # Normal object def + info ||= {} + if extra_inputs_has(name) + raise ConstructionError.new(name, "Object definition conflicts with parent context") + end + unless info.has_key?('auto_require') + info['auto_require'] = self.class.auto_require + end + if namespace + if info['class'] + info['class'] = namespace.build_classname(info['class']) + else + info['class'] = namespace.build_classname(name) + end + end + + @defs[name] = ObjectDef.new(:name => name, :info => info) + + end + end + end + + def construct_method(key) + method_definition = @defs[key] + object = get_object(method_definition.object) + method = object.method(method_definition.method) + + unless method_definition.attach.nil? + instance_var_name = "@__diy_#{method_definition.object}" + + method_definition.attach.each do |object_key| + get_object(object_key).instance_eval do + instance_variable_set(instance_var_name, object) + eval %|def #{key}(*args) + #{instance_var_name}.#{method_definition.method}(*args) + end| + end + end + end + + return method + rescue Exception => oops + build_and_raise_construction_error(key, oops) + end + + def construct_object(key) + # Find the object definition + obj_def = @defs[key] + raise "No object definition for '#{key}'" unless obj_def + # If object def mentions a library, load it + require obj_def.library if obj_def.library + + # Resolve all components for the object + arg_hash = {} + obj_def.components.each do |name,value| + case value + when Lookup + arg_hash[name.to_sym] = get_object(value.name) + when StringValue + arg_hash[name.to_sym] = value.literal_value + else + raise "Cannot cope with component definition '#{value.inspect}'" + end + end + # Get a reference to the class for the object + big_c = get_class_for_name_with_module_delimeters(obj_def.class_name) + # Make and return the instance + if obj_def.use_class_directly? + return big_c + elsif arg_hash.keys.size > 0 + return big_c.new(arg_hash) + else + return big_c.new + end + rescue Exception => oops + build_and_raise_construction_error(key, oops) + end + + def build_and_raise_construction_error(key, oops) + cerr = ConstructionError.new(key,oops) + cerr.set_backtrace(oops.backtrace) + raise cerr + end + + def get_class_for_name_with_module_delimeters(class_name) + class_name.split(/::/).inject(Object) do |mod,const_name| mod.const_get(const_name) end + end + + def extra_inputs_has(key) + if key.nil? or key.strip == '' + raise ArgumentError.new("Cannot lookup objects with nil keys") + end + @extra_inputs.keys.member?(key) or @extra_inputs.keys.member?(key.to_sym) + end + + def parse_namespace(str) + Namespace.new(str) + end + end + + class Namespace #:nodoc:# + def initialize(str) + # 'using_namespace Animal Reptile' + parts = str.split(/\s+/) + raise "Namespace definitions must begin with 'using_namespace'" unless parts[0] == 'using_namespace' + parts.shift + + if parts.length > 0 and parts[0] =~ /::/ + parts = parts[0].split(/::/) + end + + raise NamespaceError, "Namespace needs to indicate a module" if parts.empty? + + @module_nest = parts + end + + def build_classname(name) + [ @module_nest, Infl.camelize(name) ].flatten.join("::") + end + end + + class Lookup #:nodoc: + attr_reader :name + def initialize(obj_name) + @name = obj_name + end + end + + class MethodDef #:nodoc: + attr_accessor :name, :object, :method, :attach + + def initialize(opts) + @name, @object, @method, @attach = opts[:name], opts[:object], opts[:method], opts[:attach] + end + end + + class ObjectDef #:nodoc: + attr_accessor :name, :class_name, :library, :components + def initialize(opts) + name = opts[:name] + raise "Can't make an ObjectDef without a name" if name.nil? + + info = opts[:info] || {} + info = info.clone + + @components = {} + + # Object name + @name = name + + # Class name + @class_name = info.delete 'class' + @class_name ||= info.delete 'type' + @class_name ||= Infl.camelize(@name) + + # Auto Require + @auto_require = info.delete 'auto_require' + + # Library + @library = info.delete 'library' + @library ||= info.delete 'lib' + @library ||= Infl.underscore(@class_name) if @auto_require + + # Use Class Directly + @use_class_directly = info.delete 'use_class_directly' + + # Auto-compose + compose = info.delete 'compose' + if compose + case compose + when Array + auto_names = compose.map { |x| x.to_s } + when String + auto_names = compose.split(',').map { |x| x.to_s.strip } + when Symbol + auto_names = [ compose.to_s ] + else + raise "Cannot auto compose object #{@name}, bad 'compose' format: #{compose.inspect}" + end + end + auto_names ||= [] + auto_names.each do |cname| + @components[cname] = Lookup.new(cname) + end + + # Singleton status + if info['singleton'].nil? + @singleton = true + else + @singleton = info['singleton'] + end + info.delete 'singleton' + + # Remaining keys + info.each do |key,val| + @components[key.to_s] = Lookup.new(val.to_s) + end + + end + + def singleton? + @singleton + end + + def use_class_directly? + @use_class_directly == true + end + + end + + class ConstructionError < RuntimeError #:nodoc:# + def initialize(object_name, cause=nil) + object_name = object_name + cause = cause + m = "Failed to construct '#{object_name}'" + if cause + m << "\n ...caused by:\n >>> #{cause}" + end + super m + end + end + + class NamespaceError < RuntimeError #:nodoc:# + end + + module Infl #:nodoc:# + # Ganked this from Inflector: + def self.camelize(lower_case_and_underscored_word) + lower_case_and_underscored_word.to_s.gsub(/\/(.?)/) { "::" + $1.upcase }.gsub(/(^|_)(.)/) { $2.upcase } + end + # Ganked this from Inflector: + def self.underscore(camel_cased_word) + camel_cased_word.to_s.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z])/,'\1_\2').gsub(/([a-z\d])([A-Z])/,'\1_\2').downcase + end + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/lib/diy/factory.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/lib/diy/factory.rb new file mode 100644 index 0000000..d2566c5 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/lib/diy/factory.rb @@ -0,0 +1,36 @@ +module DIY #:nodoc:# + class FactoryDef #:nodoc: + attr_accessor :name, :target, :class_name, :library + + def initialize(opts) + @name, @target, @library, @auto_require = + opts[:name], opts[:target], opts[:library], opts[:auto_require] + + @class_name = Infl.camelize(@target) + @library ||= Infl.underscore(@class_name) if @auto_require + end + end + + class Context + def construct_factory(key) + factory_def = @defs[key] +# puts "requiring #{factory_def.library}" + require factory_def.library if factory_def.library + + big_c = get_class_for_name_with_module_delimeters(factory_def.class_name) + + FactoryFactory.new(big_c) + end + end + + class FactoryFactory + def initialize(clazz) + @class_to_create = clazz + end + + def create(*args) + @class_to_create.new(*args) + end + end +end + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/sample_code/car.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/sample_code/car.rb new file mode 100644 index 0000000..9a6a8ed --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/sample_code/car.rb @@ -0,0 +1,7 @@ +class Car + attr_reader :engine, :chassis + def initialize(arg_hash) + @engine = arg_hash[:engine] + @chassis = arg_hash[:chassis] + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/sample_code/chassis.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/sample_code/chassis.rb new file mode 100644 index 0000000..b745b0b --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/sample_code/chassis.rb @@ -0,0 +1,5 @@ +class Chassis + def to_s + "Chassis" + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/sample_code/diy_example.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/sample_code/diy_example.rb new file mode 100644 index 0000000..88d5b7e --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/sample_code/diy_example.rb @@ -0,0 +1,26 @@ +require "rubygems" +require "diy" + +class Car + attr_reader :engine, :chassis + def initialize(arg_hash) + @engine = arg_hash[:engine] + @chassis = arg_hash[:chassis] + end +end + +class Chassis + def to_s + "Chassis" + end +end + +class Engine + def to_s + "Engine" + end +end + +context = DIY::Context.from_file("objects.yml") +car = context['car'] +puts "Car is made of: #{car.engine} and #{car.chassis}" diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/sample_code/engine.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/sample_code/engine.rb new file mode 100644 index 0000000..65c2dd5 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/sample_code/engine.rb @@ -0,0 +1,5 @@ +class Engine + def to_s + "Engine" + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/sample_code/objects.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/sample_code/objects.yml new file mode 100644 index 0000000..6deb100 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/sample_code/objects.yml @@ -0,0 +1,10 @@ +--- +car: + compose: + - engine + - chassis + +engine: + +chassis: + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/constructor.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/constructor.rb new file mode 100644 index 0000000..5fe8f3a --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/constructor.rb @@ -0,0 +1,119 @@ +CONSTRUCTOR_VERSION = '1.0.2' #:nodoc:# + +class Class #:nodoc:# + def constructor(*attrs, &block) + call_block = '' + if block_given? + @constructor_block = block + call_block = 'self.instance_eval(&self.class.constructor_block)' + end + # Look for embedded options in the listing: + opts = attrs.find { |a| a.kind_of?(Hash) and attrs.delete(a) } + do_acc = opts.nil? ? false : opts[:accessors] == true + require_args = opts.nil? ? true : opts[:strict] != false + super_args = opts.nil? ? nil : opts[:super] + + # Incorporate superclass's constructor keys, if our superclass + if superclass.constructor_keys + similar_keys = superclass.constructor_keys & attrs + raise "Base class already has keys #{similar_keys.inspect}" unless similar_keys.empty? + attrs = [attrs,superclass.constructor_keys].flatten + end + # Generate ivar assigner code lines + assigns = '' + attrs.each do |k| + assigns += "@#{k.to_s} = args[:#{k.to_s}]\n" + end + + # If accessors option is on, declare accessors for the attributes: + if do_acc + self.class_eval "attr_accessor " + attrs.map {|x| ":#{x.to_s}"}.join(',') + end + + # If user supplied super-constructor hints: + super_call = '' + if super_args + list = super_args.map do |a| + case a + when String + %|"#{a}"| + when Symbol + %|:#{a}| + end + end + super_call = %|super(#{list.join(',')})| + end + + # If strict is on, define the constructor argument validator method, + # and setup the initializer to invoke the validator method. + # Otherwise, insert lax code into the initializer. + validation_code = "return if args.nil?" + if require_args + self.class_eval do + def _validate_constructor_args(args) + # First, make sure we've got args of some kind + unless args and args.keys and args.keys.size > 0 + raise ConstructorArgumentError.new(self.class.constructor_keys) + end + # Scan for missing keys in the argument hash + a_keys = args.keys + missing = [] + self.class.constructor_keys.each do |ck| + unless a_keys.member?(ck) + missing << ck + end + a_keys.delete(ck) # Delete inbound keys as we address them + end + if missing.size > 0 || a_keys.size > 0 + raise ConstructorArgumentError.new(missing,a_keys) + end + end + end + # Setup the code to insert into the initializer: + validation_code = "_validate_constructor_args args " + end + + # Generate the initializer code + self.class_eval %{ + def initialize(args=nil) + #{super_call} + #{validation_code} + #{assigns} + setup if respond_to?(:setup) + #{call_block} + end + } + + # Remember our constructor keys + @_ctor_keys = attrs + end + + # Access the constructor keys for this class + def constructor_keys; @_ctor_keys ||=[]; end + + def constructor_block #:nodoc:# + @constructor_block + end + +end + +# Fancy validation exception, based on missing and extraneous keys. +class ConstructorArgumentError < RuntimeError #:nodoc:# + def initialize(missing,rejected=[]) + err_msg = '' + if missing.size > 0 + err_msg = "Missing constructor args [#{missing.join(',')}]" + end + if rejected.size > 0 + # Some inbound keys were not addressed earlier; this means they're unwanted + if err_msg + err_msg << "; " # Appending to earlier message about missing items + else + err_msg = '' + end + # Enumerate the rejected key names + err_msg << "Rejected constructor args [#{rejected.join(',')}]" + end + super err_msg + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/diy_test.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/diy_test.rb new file mode 100644 index 0000000..3540200 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/diy_test.rb @@ -0,0 +1,608 @@ +require File.dirname(__FILE__) + "/test_helper" +require 'diy' +require 'fileutils' +include FileUtils + +class DIYTest < Test::Unit::TestCase + + def setup + # Add load paths: + %w|gnu dog cat yak donkey goat horse fud non_singleton namespace functions|.each do |p| + libdir = path_to_test_file(p) + $: << libdir unless $:.member?(libdir) + end + DIY::Context.auto_require = true # Restore default + end + + + # + # TESTS + # + + def test_essential_use_case + load_context "dog/simple.yml" + + # Check object defs + check_dog_objects @diy + + # Tweak the load-path + $: << path_to_test_file("dog") + + # Get the objects, use reference comparison to check composition + presenter = @diy.get_object('dog_presenter') + assert_not_nil presenter, 'nil dog_presenter' + + model = @diy.get_object('dog_model') + assert_not_nil model, 'nil dog_model' + assert_same presenter.model, model, "Different model came from context than found in presenter" + + view = @diy.get_object('dog_view') + assert_not_nil view, 'nil dog_view' + assert_same presenter.view, view, "Different view came from context than found in presenter" + + resolver = @diy.get_object('file_resolver') + assert_not_nil resolver, 'nil file_resolver' + assert_same model.file_resolver, resolver, "File resolver in model is different than one in context" + + # Check repeat access: + assert_same model, @diy.get_object('dog_model'), "Second access of model yielded different result" + assert_same view, @diy.get_object('dog_view'), "Second access of view yielded different result" + assert_same presenter, @diy.get_object('dog_presenter'), "Second access of presenter got difrnt result" + end + + def test_classname_inside_a_module + load_hash 'thinger' => {'class' => "DiyTesting::Bar::Foo", 'lib' => 'foo'} + @diy.build_everything + assert_not_nil @diy['thinger'], "Should have got my thinger (which is hiding in a couple modules)" + end + + def test_classname_inside_a_module_loads_from_directories_named_after_the_underscored_module_names + load_hash 'thinger' => {'class' => "Foo::Bar::Qux"} + # expect it to be loaded from: foo/bar/qux.rb + @diy.build_everything + assert_not_nil @diy['thinger'], "Should have got my thinger (which is hiding in a couple modules)" + end + + def test_use_class_directly + load_hash 'thinger' => {'class' => "DiyTesting::Bar::Foo", 'lib' => 'foo', 'use_class_directly' => true} + @diy.build_everything + assert_equal DiyTesting::Bar::Foo, @diy['thinger'], "Should be the class 'object'" + end + + def test_classname_inside_a_module_derives_the_namespaced_classname_from_the_underscored_object_def_key + load_hash 'foo/bar/qux' => nil + @diy.build_everything + assert_not_nil @diy['foo/bar/qux'], "Should have got my qux (which is hiding in a couple modules)" + end + + def test_keys + load_context "dog/simple.yml" + assert_equal %w|dog_model dog_presenter dog_view file_resolver other_thing|, @diy.keys.sort + end + + def test_subcontext_keys_should_include_parent_context_keys + load_context 'yak/sub_sub_context_test.yml' + main_keys = %w|core_presenter core_model core_view data_source|.sort + assert_equal main_keys, @diy.keys.sort, "Wrong keys in main context" + @diy.within :fringe_context do |fcontext| + fringe_keys = [main_keys, %w|fringe_model fringe_view fringe_presenter|].flatten.sort + assert_equal fringe_keys, fcontext.keys.sort, "Wrong keys in fringe context" + fcontext.within :deep_context do |dcontext| + deep_keys = [fringe_keys, %w|krill giant_squid|].flatten.sort + assert_equal deep_keys, dcontext.keys.sort + end + end + end + + def test_constructor_no_hash + assert_raise RuntimeError do DIY::Context.new(nil) end + end + + def test_constructor_bad_extra_inputs + err = assert_raise RuntimeError do + DIY::Context.new({}, Object.new) + end + assert_match(/extra inputs/i, err.message) + end + + def test_from_yaml + text = File.read(path_to_test_file("dog/simple.yml")) + diy = DIY::Context.from_yaml(text) + check_dog_objects diy + end + + def test_from_yaml_extra_inputs + extra = { 'the_cat_lineage' => 'siamese', :some_meat => 'horse' } + diy = DIY::Context.from_yaml(File.read(path_to_test_file('cat/needs_input.yml')), extra) + cat = diy['cat'] + assert_equal 'siamese', cat.heritage + assert_equal 'horse', cat.food + end + + def test_from_file + diy = DIY::Context.from_file(path_to_test_file("dog/simple.yml")) + check_dog_objects diy + end + + def test_from_file_bad + assert_raise RuntimeError do + DIY::Context.from_file(nil) + end + assert_raise Errno::ENOENT do + DIY::Context.from_file("bad file name") + end + end + + def test_from_file_extra_inputs + extra = { 'the_cat_lineage' => 'siamese', :some_meat => 'horse' } + diy = DIY::Context.from_file(path_to_test_file('cat/needs_input.yml'), extra) + cat = diy['cat'] + assert_equal 'siamese', cat.heritage + assert_equal 'horse', cat.food + end + + def test_contains_object + load_context "dog/simple.yml" + assert @diy.contains_object('dog_presenter'), "Should be true for dog_presenter" + assert !@diy.contains_object('woops'), "Should return false for 'woops'" + err = assert_raise ArgumentError do + @diy.contains_object(nil) + end + end + + def test_contains_object_extra_inputs + extra = { 'the_cat_lineage' => 'siamese', :some_meat => 'horse' } + main = YAML.load(File.read(path_to_test_file('cat/needs_input.yml'))) + diy = DIY::Context.new(main, extra) + + assert diy.contains_object('cat') + assert diy.contains_object('the_cat_lineage') + assert diy.contains_object('some_meat') + end + + def test_get_object + load_context "dog/simple.yml" + assert_not_nil @diy.get_object('file_resolver'), "nil resolver?" + assert_raise ArgumentError do + @diy.get_object(nil) + end + assert_raise DIY::ConstructionError do + @diy.get_object("no such object") + end + end + + def test_hash_style_access + load_context "dog/simple.yml" + assert_not_nil @diy['file_resolver'], "nil resolver?" + assert_raise ArgumentError do + @diy[nil] + end + assert_raise DIY::ConstructionError do + @diy["no such object"] + end + end + + def test_get_object_construction_error + load_context "broken_construction.yml" + err = assert_raise DIY::ConstructionError do + @diy.get_object 'dog_presenter' + end + assert_match(/dog_presenter/, err.message) + end + + def test_context_with_extra_inputs + extra = { 'the_cat_lineage' => 'siamese', :some_meat => 'horse' } + main = YAML.load(File.read(path_to_test_file('cat/needs_input.yml'))) + diy = DIY::Context.new(main, extra) + cat = diy['cat'] + assert_equal 'siamese', cat.heritage + assert_equal 'horse', cat.food + end + + def test_conflicting_extra_inputs + extra = { 'the_cat_lineage' => 'siamese', :some_meat => 'horse' } + main = YAML.load(File.read(path_to_test_file('cat/extra_conflict.yml'))) + + DIY::Context.new(main,extra) + flunk "Should have raised err" + rescue Exception => err + assert_match(/conflict/i, err.message) + end + + def test_sub_context + load_context 'yak/my_objects.yml' + + core_model = @diy['core_model'] + assert_not_nil core_model, "no core model in main context?" + + fmodel1 = nil + fview1 = nil + @diy.within('fringe_context') do |fc| + assert_not_nil fc["fringe_presenter"], "no fringe presenter" + fmodel1 = fc["fringe_model"] + fmodel1a = fc["fringe_model"] + assert_same fmodel1, fmodel1a, "Second fring model in fringe_context came out different" + assert_not_nil fmodel1, "no fringe_model" + fview1 = fc["fringe_view"] + assert_not_nil fview1, "no fringe_view" + assert_same core_model, fmodel1.connected + end + + fmodel2 = nil + fview2 = nil + @diy.within('fringe_context') do |fc| + assert_not_nil fc["fringe_presenter"], "2: no fringe presenter" + fmodel2 = fc["fringe_model"] + fmodel2a = fc["fringe_model"] + assert_same fmodel2, fmodel2a, "Second fringe model in fringe_context came out different" + assert_not_nil fmodel2, "2: no fringe_model" + fview2 = fc["fringe_view"] + assert_not_nil fview2, "2: no fringe_view" + assert_same core_model, fmodel2.connected + + assert fmodel1.object_id != fmodel2.object_id, "fringe models 1 and 2 are same!" + assert fview1.object_id != fview2.object_id, "fringe views 1 and 2 are same!" + end + end + + def test_sub_sub_context + load_context 'yak/sub_sub_context_test.yml' + + core_model = @diy['core_model'] + assert_not_nil core_model, "no core model in main context?" + + fmodel1 = nil + fview1 = nil + @diy.within('fringe_context') do |fc| + assert_not_nil fc["fringe_presenter"], "no fringe presenter" + fmodel1 = fc["fringe_model"] + fmodel1a = fc["fringe_model"] + assert_same fmodel1, fmodel1a, "Second fring model in fringe_context came out different" + assert_not_nil fmodel1, "no fringe_model" + fview1 = fc["fringe_view"] + assert_not_nil fview1, "no fringe_view" + assert_same core_model, fmodel1.connected + + fc.within :deep_context do |dc| + krill = dc['krill'] + assert_not_nil krill, "nil krill" + assert_same krill, dc['krill'], "krill was different second time" + giant_squid = dc['giant_squid'] + assert_same fview1, giant_squid.fringe_view, "wrong view in squid" + assert_same core_model, giant_squid.core_model, "wrong model in squid" + assert_same krill, giant_squid.krill, "wrong krill in squid" + end + end + + end + + def test_build_everything + # Singletons in the goat context will generate test output in their constructors. + # We just gotta tell em where: + ofile = path_to_test_file('goat/output.tmp') + $goat_test_output_file = ofile + + # Reusable setup for this test + prep_output = proc do + remove ofile if File.exist?(ofile) + end + + # Reusable assertion set and cleanup + examine_output = proc do + # Examine output file for expected construction + assert File.exist?(ofile), "no goat output created" + lines = File.readlines(ofile).map { |x| x.strip } + %w|can paper shirt goat|.each do |object| + assert lines.member?("#{object} built"), "Didn't see constructor output for #{object}" + end + assert_equal 4, lines.size, "wrong number of entries in output file" + + # Make sure the subcontext was not built + assert !lines.member?("plane built"), "plane should not have been built -- it's in the subcontext" + assert !lines.member?("wings built"), "wings should not have been built -- it's in the subcontext" + + # Check the objects in the context + %w|can paper shirt goat|.each do |object| + assert_same @diy[object], @diy[object], "Multiple accesses on #{object} yielded different refs" + end + + # Try the subcontext + @diy.within('the_sub_context') do |tsc| + %w|plane wings|.each do |object| + assert_same tsc[object], tsc[object], "Multiple accesses on #{object} (in subcontext) yielded different refs" + end + end + # cleanup + remove ofile if File.exist?(ofile) + end + + # Test all three methods + [:build_everything, :build_all, :preinstantiate_singletons].each do |method_name| + prep_output.call + load_context 'goat/objects.yml' + # go + @diy.send method_name + examine_output.call + end + ensure + # cleanup + remove ofile if File.exist?(ofile) + end + + # See that the current object factory context can be referenced within the yaml + def test_this_context + load_context 'horse/objects.yml' + + assert_same @diy, @diy['this_context'], "basic self-reference failed" + assert_same @diy, @diy['holder_thing'].thing_held, "composition self-reference failed" + end + + def test_this_context_works_for_subcontexts + load_context 'horse/objects.yml' + + @diy.within('repeater') do |ctx| + assert_same ctx, ctx['this_context'], "self-ref inside a subcontext doesn't work" + end + end + + def test_multiple_classes_in_one_file + load_context 'fud/objects.yml' + + toy = @diy['toy'] + widget = @diy['widget'] + thing = @diy['thing_ama_jack'] + trinket = @diy['trinket'] + + assert_same widget, toy.widget, "wrong widget in toy" + assert_same trinket, toy.trinket, "wrong trinket in toy" + assert_same thing, trinket.thing_ama_jack, "wrong thing_ama_jack in trinket" + end + + def test_objects_can_be_set_in_a_context_and_diy_will_not_attempt_to_build_it_as_a_dependency + load_context 'gnu/objects.yml' + + injected = 'boom' + @diy[:injected] = injected + thinger = @diy[:thinger] + assert_not_nil thinger + assert_same injected, thinger.injected + assert_same injected, @diy[:injected] + + inner_injected = 'slam' + @diy.within :inny do |sub| + sub.set_object :inner_injected, inner_injected + inner_thinger = sub[:inner_thinger] + assert_not_nil inner_thinger + assert_same inner_injected, inner_thinger.injected + assert_same inner_injected, sub[:inner_injected] + end + end + + def test_should_not_allow_setting_of_an_object_which_has_already_been_loaded + load_context 'gnu/objects.yml' + + injected = 'boom' + @diy[:injected] = injected + err = assert_raise RuntimeError do + @diy[:injected] = injected + end + assert_match(/object 'injected' already exists/i, err.message) + assert_same injected, @diy[:injected] + + thinger = @diy[:thinger] + err = assert_raise RuntimeError do + @diy[:thinger] = 'sdf' + end + assert_match(/object 'thinger' already exists/i, err.message) + assert_same thinger, @diy[:thinger] + end + + def test_should_be_able_to_turn_off_auto_require_for_all_objects + DIY::Context.auto_require = false + load_context 'horse/objects.yml' + + exception = assert_raise(DIY::ConstructionError) { @diy['holder_thing'] } + assert_match(/uninitialized constant/, exception.message) + end + + def test_should_cause_non_singletons_to_be_rebuilt_every_time_they_are_accessed + load_context 'non_singleton/objects.yml' + + air = @diy['air'] + assert_not_nil air, "No air" + assert_same air, @diy['air'], "Air should be a singleton" + + yard = @diy['yard'] + assert_not_nil yard, "No yard" + assert_same yard, @diy['yard'], "yard should be a singleton" + + pig = @diy['pig'] + assert_not_nil pig, "No pig" + assert_same pig, @diy['pig'], "Pig should be a singleton" + + thread_spinner1 = @diy['thread_spinner'] + assert_not_nil thread_spinner1, "Couldn't get thread spinner" + thread_spinner2 = @diy['thread_spinner'] + assert_not_nil thread_spinner2, "Couldn't get second thread spinner" + assert thread_spinner1.object_id != thread_spinner2.object_id, "Thread spinners should be different instances" + thread_spinner3 = pig.thread_spinner + assert_not_nil thread_spinner3, "Didn't get a spinner from the pig" + assert thread_spinner2.object_id != thread_spinner3.object_id, "Thread spinner from pig should be different instance than the others" + assert thread_spinner1.object_id != thread_spinner3.object_id, "Thread spinner from pig should be different instance than the others" + + assert_same air, thread_spinner1.air, "spinner 1 air should be singleton reference" + assert_same air, thread_spinner2.air, "spinner 2 air should be singleton reference" + assert_same air, thread_spinner3.air, "spinner 3 air should be singleton reference" + end + + def test_should_handle_nonsingletons_in_sub_contexts + load_context 'non_singleton/objects.yml' + + yard = @diy['yard'] + assert_not_nil yard, "No yard" + assert_same yard, @diy['yard'], "yard should be a singleton" + + thread_spinner1 = @diy['thread_spinner'] + assert_not_nil thread_spinner1, "Couldn't get thread spinner" + + air = @diy['air'] + assert_not_nil air, "No air" + assert_same air, @diy['air'], "Air should be a singleton" + + @diy.within :inner_sanctum do |sanct| + tick1 = sanct['tick'] + assert_not_nil tick1, "Couldn't get tick1 from inner sanctum" + tick2 = sanct['tick'] + assert_not_nil tick2, "Couldn't get tick2 from inner sanctum" + assert tick1.object_id != tick2.object_id, "Tick should not be a singleton" + + cat = sanct['fat_cat'] + assert_not_nil cat, "Couldn't get cat from sanctum" + assert_same cat, sanct['fat_cat'], "Cat SHOULD be singleton" + + tick3 = cat.tick + assert_not_nil tick3, "Couldn't get tick from cat" + assert tick1.object_id != tick3.object_id, "tick from cat matched an earlier tick; should not be so" + + assert_same yard, cat.yard, "Cat's yard should be same as other yard" + assert_not_nil cat.thread_spinner, "No thread spinner in cat?" + + assert_same air, cat.thread_spinner.air, "spinner 1 air should be singleton reference" + assert thread_spinner1.object_id != cat.thread_spinner.object_id, "cat's thread spinner matched the other spinner; should not be so" + end + end + + def test_should_provide_syntax_for_using_namespace + # This test exercises single and triple-level namespaces for nested + # modules, and their interaction with other namespaced-objects. + load_context "namespace/objects.yml" + + %w{road sky cat bird lizard turtle}.each do |obj| + assert @diy.contains_object(obj), "Context had no object '#{obj}'" + end + + road = @diy['road'] + sky = @diy['sky'] + cat = @diy['cat'] + bird = @diy['bird'] + lizard = @diy['lizard'] + turtle = @diy['turtle'] + + assert_same road, cat.road, "Cat has wrong Road" + assert_same sky, bird.sky, "Bird has wrong Sky" + assert_same bird, lizard.bird, "Lizard has wrong Bird" + end + + def test_should_combine_a_given_class_name_with_the_namespace + load_context "namespace/class_name_combine.yml" + assert_not_nil @diy['garfield'], "No garfield" + assert_kind_of Animal::Cat, @diy['garfield'], "Garfield wrong" + end + + def test_should_let_you_use_namespaces_in_subcontexts + load_context "namespace/subcontext.yml" + @diy.build_everything + %w{road sky cat turtle}.each do |obj| + assert @diy.contains_object(obj), "Main context had no object '#{obj}'" + end + sky = @diy['sky'] + + @diy.within("aviary") do |subc| + assert subc.contains_object("bird"), "Sub context didn't have 'bird'" + assert subc.contains_object("lizard"), "Sub context didn't have 'lizard'" + bird = subc['bird'] + lizard = subc['lizard'] + assert_same sky, bird.sky, "Bird has wrong Sky" + assert_same bird, lizard.bird, "Lizard has wrong Bird" + end + end + + def test_should_raise_for_namespace_w_no_modules_named + ex = assert_raises DIY::NamespaceError do + load_context "namespace/no_module_specified.yml" + end + assert_equal "Namespace needs to indicate a module", ex.message + end + + def test_should_raise_for_namespace_whose_modules_dont_exist + load_context "namespace/bad_module_specified.yml" + ex = assert_raises DIY::ConstructionError do + @diy['bird'] + end + assert_match(/failed to construct/i, ex.message) + assert_match(/no such file to load -- fuzzy_creature\/bird/, ex.message) + end + + def test_should_be_able_define_and_access_bounded_methods + load_context "functions/objects.yml" + @diy.build_everything + build_thing = @diy['build_thing'] + + assert_not_nil build_thing, "should not be nil" + assert_kind_of(Method, build_thing) + assert_equal(build_thing, @diy['build_thing']) + end + + def test_bounded_method_can_be_used + load_context "functions/objects.yml" + @diy.build_everything + build_thing = @diy['build_thing'] + + thing = build_thing["the name", "flying"] + + assert_equal("the name", thing.name) + assert_equal("flying", thing.ability) + end + + def test_building_bounded_method_uses_object_in_diy_context_correctly + load_context "functions/objects.yml" + @diy.build_everything + assert_equal(@diy['build_thing'], @diy['thing_builder'].method(:build)) + + load_context "functions/nonsingleton_objects.yml" + @diy.build_everything + assert_not_equal(@diy['build_thing'], @diy['thing_builder'].method(:build)) + end + + def test_composing_bounded_methods_into_other_objects + load_context "functions/objects.yml" + @diy.build_everything + assert_equal(@diy['build_thing'], @diy['things_builder'].build_thing) + end + + def test_raises_construction_error_if_invalid_method_specified + load_context "functions/invalid_method.yml" + assert_raises DIY::ConstructionError do + @diy.build_everything + end + end + + def test_can_optionally_attach_method_to_other_objects_in_context + load_context "functions/objects.yml" + @diy.build_everything + + thing = @diy['attached_things_builder'].build_thing("the name", "flying") + assert_kind_of(Thing, thing) + assert_equal("the name", thing.name) + assert_equal("flying", thing.ability) + + ["attached_things_builder", "things_builder"].each do |key| + thing = @diy[key].build_default_thing + assert_kind_of(Thing, thing) + assert_equal("Thing", thing.name) + assert_equal("nothing", thing.ability) + end + end + + # + # HELPERS + # + def check_dog_objects(context) + assert_not_nil context, "nil context" + names = %w|dog_presenter dog_model dog_view file_resolver| + names.each do |n| + assert context.contains_object(n), "Context had no object '#{n}'" + end + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/factory_test.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/factory_test.rb new file mode 100644 index 0000000..ed02f01 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/factory_test.rb @@ -0,0 +1,79 @@ +require File.dirname(__FILE__) + "/test_helper" +require 'diy' +require 'fileutils' +include FileUtils + +class FactoryTest < Test::Unit::TestCase + + def setup + # Add load paths: + %w|factory|.each do |p| + libdir = path_to_test_file(p) + $: << libdir unless $:.member?(libdir) + end + DIY::Context.auto_require = true # Restore default + end + + + # + # TESTS + # + + def test_creates_factory + load_context "factory/factory.yml" + + cat_factory = @diy.get_object(:cat_factory) + assert_not_nil cat_factory + + cat = cat_factory.create('a', 'b') + + assert cat.is_a?(Kitten) + assert_equal "meow", cat.meow + assert_equal 'a', cat.a + assert_equal 'b', cat.b + end + + def test_creates_factory_with_autorequire + load_context "factory/factory.yml" + + dog_factory = @diy.get_object(:dog_factory) + assert_not_nil dog_factory + + dog = dog_factory.create + + assert dog.is_a?(Dog) + assert_equal "woof", dog.woof + end + + def test_creates_factory_with_subcontext + load_context "factory/factory.yml" + + @diy.within :inny do |context| + bull_factory = context.get_object(:bull_factory) + beef = bull_factory.create + end + end + + def test_creates_factory_with_subcontext_and_namespace + load_context "factory/factory.yml" + + @diy.within :congress do |context| + politician = context.get_object(:politician) + pork = politician.create + assert pork.is_a?(Farm::Pork) + assert_equal "money!", pork.oink + end + end + + def test_creates_factory_with_namespace + load_context "factory/factory.yml" + + llama_factory = @diy.get_object(:llama_factory) + assert_not_nil llama_factory + + llama = llama_factory.create + + assert llama.is_a?(Farm::Llama) + assert_equal "?", llama.make_llama_noise + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/broken_construction.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/broken_construction.yml new file mode 100644 index 0000000..1dacb01 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/broken_construction.yml @@ -0,0 +1,7 @@ + +dog_presenter: + model: dog_model + view: dog_view + +dog_model: +# VIEW IS MISSING, PRESENTER SHOULD CRASH diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/cat/cat.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/cat/cat.rb new file mode 100644 index 0000000..2d17514 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/cat/cat.rb @@ -0,0 +1,3 @@ +class Cat + constructor :heritage, :food, :strict => true, :accessors => true +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/cat/extra_conflict.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/cat/extra_conflict.yml new file mode 100644 index 0000000..9c6b375 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/cat/extra_conflict.yml @@ -0,0 +1,5 @@ +the_cat_lineage: + +cat: + heritage: the_cat_lineage + food: some_meat diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/cat/heritage.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/cat/heritage.rb new file mode 100644 index 0000000..617d47a --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/cat/heritage.rb @@ -0,0 +1,2 @@ +class Heritage +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/cat/needs_input.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/cat/needs_input.yml new file mode 100644 index 0000000..9f622f2 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/cat/needs_input.yml @@ -0,0 +1,3 @@ +cat: + heritage: the_cat_lineage + food: some_meat diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/cat/the_cat_lineage.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/cat/the_cat_lineage.rb new file mode 100644 index 0000000..b0f4308 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/cat/the_cat_lineage.rb @@ -0,0 +1 @@ +class TheCatLineage; end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/dog/dog_model.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/dog/dog_model.rb new file mode 100644 index 0000000..51e7df0 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/dog/dog_model.rb @@ -0,0 +1,3 @@ +class DogModel + constructor :file_resolver, :other_thing, :strict => true, :accessors => true +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/dog/dog_presenter.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/dog/dog_presenter.rb new file mode 100644 index 0000000..786977d --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/dog/dog_presenter.rb @@ -0,0 +1,3 @@ +class DogPresenter + constructor :model, :view, :strict => true, :accessors => true +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/dog/dog_view.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/dog/dog_view.rb new file mode 100644 index 0000000..aae86bc --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/dog/dog_view.rb @@ -0,0 +1,2 @@ +class DogView +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/dog/file_resolver.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/dog/file_resolver.rb new file mode 100644 index 0000000..09cf18a --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/dog/file_resolver.rb @@ -0,0 +1,2 @@ +class FileResolver +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/dog/other_thing.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/dog/other_thing.rb new file mode 100644 index 0000000..48e6a95 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/dog/other_thing.rb @@ -0,0 +1,2 @@ +class OtherThing +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/dog/simple.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/dog/simple.yml new file mode 100644 index 0000000..7737236 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/dog/simple.yml @@ -0,0 +1,11 @@ +dog_presenter: + model: dog_model + view: dog_view + +file_resolver: +other_thing: + +dog_model: + compose: file_resolver, other_thing + +dog_view: diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/donkey/foo.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/donkey/foo.rb new file mode 100644 index 0000000..5182cf3 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/donkey/foo.rb @@ -0,0 +1,8 @@ + +module DiyTesting + module Bar + class Foo + end + end +end + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/donkey/foo/bar/qux.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/donkey/foo/bar/qux.rb new file mode 100644 index 0000000..bb05a02 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/donkey/foo/bar/qux.rb @@ -0,0 +1,7 @@ + +module Foo + module Bar + class Qux + end + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/factory/beef.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/factory/beef.rb new file mode 100644 index 0000000..2cd31a0 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/factory/beef.rb @@ -0,0 +1,5 @@ +class Beef + def cook + return "rare" + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/factory/dog.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/factory/dog.rb new file mode 100644 index 0000000..06b9daf --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/factory/dog.rb @@ -0,0 +1,6 @@ +class Dog + def woof + "woof" + end +end + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/factory/factory.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/factory/factory.yml new file mode 100644 index 0000000..8264d37 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/factory/factory.yml @@ -0,0 +1,19 @@ +cat_factory: + builds: kitten + library: kitten + +dog_factory: + builds: dog + +using_namespace Farm: + llama_factory: + builds: llama + ++inny: + bull_factory: + builds: beef + ++congress: + using_namespace Farm: + politician: + builds: pork diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/factory/farm/llama.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/factory/farm/llama.rb new file mode 100644 index 0000000..40e9fa2 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/factory/farm/llama.rb @@ -0,0 +1,7 @@ +module Farm + class Llama + def make_llama_noise + "?" + end + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/factory/farm/pork.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/factory/farm/pork.rb new file mode 100644 index 0000000..a5aa4e5 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/factory/farm/pork.rb @@ -0,0 +1,7 @@ +module Farm + class Pork + def oink + "money!" + end + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/factory/kitten.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/factory/kitten.rb new file mode 100644 index 0000000..f27a3ef --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/factory/kitten.rb @@ -0,0 +1,13 @@ +class Kitten + attr_accessor :a,:b + + def initialize(a, b) + @a = a + @b = b + end + + def meow + "meow" + end +end + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/fud/objects.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/fud/objects.yml new file mode 100644 index 0000000..1a152b9 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/fud/objects.yml @@ -0,0 +1,13 @@ +widget: + lib: toy + +trinket: + lib: toy + compose: thing_ama_jack + +thing_ama_jack: + lib: toy + +toy: + lib: toy + compose: widget, trinket diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/fud/toy.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/fud/toy.rb new file mode 100644 index 0000000..937b71d --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/fud/toy.rb @@ -0,0 +1,14 @@ + +class Toy + constructor :widget, :trinket, :accessors => true, :strict => true +end + +class Widget +end + +class ThingAmaJack +end + +class Trinket + constructor :thing_ama_jack, :accessors => true, :strict => true +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/functions/attached_things_builder.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/functions/attached_things_builder.rb new file mode 100644 index 0000000..f67888a --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/functions/attached_things_builder.rb @@ -0,0 +1,2 @@ +class AttachedThingsBuilder +end \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/functions/invalid_method.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/functions/invalid_method.yml new file mode 100644 index 0000000..96690c3 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/functions/invalid_method.yml @@ -0,0 +1,5 @@ +thing_builder: + +method build_thing: + object: thing_builder + method: no_exist \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/functions/method_extractor.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/functions/method_extractor.rb new file mode 100644 index 0000000..55daf46 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/functions/method_extractor.rb @@ -0,0 +1,3 @@ +class MethodExtractor + +end \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/functions/nonsingleton_objects.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/functions/nonsingleton_objects.yml new file mode 100644 index 0000000..39b6fd6 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/functions/nonsingleton_objects.yml @@ -0,0 +1,6 @@ +thing_builder: + singleton: false + +method build_thing: + object: thing_builder + method: build \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/functions/objects.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/functions/objects.yml new file mode 100644 index 0000000..4d0a05a --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/functions/objects.yml @@ -0,0 +1,22 @@ +thing_builder: + +method_extractor: + +attached_things_builder: + +method build_thing: + object: thing_builder + method: build + attach: + - attached_things_builder + +method build_default_thing: + object: thing_builder + method: build_default + attach: + - attached_things_builder + - things_builder + +things_builder: + compose: + - build_thing \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/functions/thing.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/functions/thing.rb new file mode 100644 index 0000000..4bc652d --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/functions/thing.rb @@ -0,0 +1,3 @@ +class Thing + constructor :name, :ability, :accessors => true +end \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/functions/thing_builder.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/functions/thing_builder.rb new file mode 100644 index 0000000..288bab4 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/functions/thing_builder.rb @@ -0,0 +1,25 @@ +require 'thing' + +class ThingBuilder + @@builder_count = 0 + + def self.reset_builder_count + @@builder_count = 0 + end + + def self.builder_count + @@builder_count + end + + def initialize + @@builder_count += 1 + end + + def build(name, ability) + Thing.new(:name => name, :ability => ability) + end + + def build_default + Thing.new(:name => "Thing", :ability => "nothing") + end +end \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/functions/things_builder.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/functions/things_builder.rb new file mode 100644 index 0000000..198c85a --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/functions/things_builder.rb @@ -0,0 +1,3 @@ +class ThingsBuilder + constructor :build_thing, :accessors => true +end \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/gnu/objects.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/gnu/objects.yml new file mode 100644 index 0000000..39581ef --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/gnu/objects.yml @@ -0,0 +1,14 @@ + +injected: + +thinger: + compose: injected + ++inny: + inner_injected: + + inner_thinger: + injected: inner_injected + lib: thinger + class: Thinger + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/gnu/thinger.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/gnu/thinger.rb new file mode 100644 index 0000000..1d332f6 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/gnu/thinger.rb @@ -0,0 +1,7 @@ + + +class Thinger + constructor :injected + attr_reader :injected +end + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/goat/base.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/goat/base.rb new file mode 100644 index 0000000..a4f5d0e --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/goat/base.rb @@ -0,0 +1,8 @@ +class Base + def test_output(name) + # See diy_context_test.rb + File.open($goat_test_output_file, "a") do |f| + f.puts "#{name} built" + end + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/goat/can.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/goat/can.rb new file mode 100644 index 0000000..0bd1eeb --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/goat/can.rb @@ -0,0 +1,6 @@ +require 'base' +class Can < Base + def initialize + test_output "can" + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/goat/goat.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/goat/goat.rb new file mode 100644 index 0000000..ad084d3 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/goat/goat.rb @@ -0,0 +1,6 @@ +require 'base' +class Goat < Base + def initialize + test_output "goat" + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/goat/objects.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/goat/objects.yml new file mode 100644 index 0000000..a31123e --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/goat/objects.yml @@ -0,0 +1,12 @@ +can: + +paper: + +shirt: + +goat: + ++the_sub_context: + plane: + compose: wings + wings: diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/goat/paper.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/goat/paper.rb new file mode 100644 index 0000000..2068e41 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/goat/paper.rb @@ -0,0 +1,6 @@ +require 'base' +class Paper < Base + def initialize + test_output "paper" + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/goat/plane.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/goat/plane.rb new file mode 100644 index 0000000..712e904 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/goat/plane.rb @@ -0,0 +1,7 @@ +require 'base' +class Plane < Base + constructor :wings, :strict => true + def setup + test_output "plane" + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/goat/shirt.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/goat/shirt.rb new file mode 100644 index 0000000..7b28bec --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/goat/shirt.rb @@ -0,0 +1,6 @@ +require 'base' +class Shirt < Base + def initialize + test_output "shirt" + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/goat/wings.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/goat/wings.rb new file mode 100644 index 0000000..dc0e70c --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/goat/wings.rb @@ -0,0 +1,8 @@ +require 'base' +class Wings < Base + def initialize + test_output "wings" + end + def stay_on; end + def fall_off; end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/horse/holder_thing.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/horse/holder_thing.rb new file mode 100644 index 0000000..5480216 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/horse/holder_thing.rb @@ -0,0 +1,3 @@ +class HolderThing + constructor :thing_held, :strict => true, :accessors => true +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/horse/objects.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/horse/objects.yml new file mode 100644 index 0000000..54a0e9c --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/horse/objects.yml @@ -0,0 +1,7 @@ +holder_thing: + thing_held: this_context + ++repeater: + other_thing: + class: HolderThing + thing_held: this_context diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/namespace/animal/bird.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/namespace/animal/bird.rb new file mode 100644 index 0000000..27be474 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/namespace/animal/bird.rb @@ -0,0 +1,5 @@ +module Animal + class Bird + constructor :sky, :accessors => true + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/namespace/animal/cat.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/namespace/animal/cat.rb new file mode 100644 index 0000000..632257e --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/namespace/animal/cat.rb @@ -0,0 +1,5 @@ +module Animal + class Cat + constructor :road, :accessors => true + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/namespace/animal/reptile/hardshell/turtle.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/namespace/animal/reptile/hardshell/turtle.rb new file mode 100644 index 0000000..fd05feb --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/namespace/animal/reptile/hardshell/turtle.rb @@ -0,0 +1,8 @@ +module Animal + module Reptile + module Hardshell + class Turtle + end + end + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/namespace/animal/reptile/lizard.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/namespace/animal/reptile/lizard.rb new file mode 100644 index 0000000..d2c6c96 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/namespace/animal/reptile/lizard.rb @@ -0,0 +1,7 @@ +module Animal + module Reptile + class Lizard + constructor :bird, :accessors => true + end + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/namespace/bad_module_specified.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/namespace/bad_module_specified.yml new file mode 100644 index 0000000..7befcac --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/namespace/bad_module_specified.yml @@ -0,0 +1,8 @@ + +sky: + +using_namespace FuzzyCreature: + + bird: + compose: sky + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/namespace/class_name_combine.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/namespace/class_name_combine.yml new file mode 100644 index 0000000..77f66fc --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/namespace/class_name_combine.yml @@ -0,0 +1,8 @@ +road: + +using_namespace Animal: + + garfield: + class: Cat + compose: road + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/namespace/hello.txt b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/namespace/hello.txt new file mode 100644 index 0000000..f6bfc02 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/namespace/hello.txt @@ -0,0 +1 @@ +this is the info \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/namespace/no_module_specified.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/namespace/no_module_specified.yml new file mode 100644 index 0000000..065e83f --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/namespace/no_module_specified.yml @@ -0,0 +1,8 @@ + +sky: + +using_namespace: + + bird: + compose: sky + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/namespace/objects.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/namespace/objects.yml new file mode 100644 index 0000000..55511be --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/namespace/objects.yml @@ -0,0 +1,21 @@ +road: + +sky: + +using_namespace Animal: + + cat: + compose: road + + bird: + compose: sky + +using_namespace Animal Reptile: + + lizard: + compose: bird + +using_namespace Animal::Reptile::Hardshell: + + turtle: + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/namespace/road.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/namespace/road.rb new file mode 100644 index 0000000..bb050fb --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/namespace/road.rb @@ -0,0 +1,2 @@ +class Road +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/namespace/sky.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/namespace/sky.rb new file mode 100644 index 0000000..fc1e2bb --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/namespace/sky.rb @@ -0,0 +1,2 @@ +class Sky +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/namespace/subcontext.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/namespace/subcontext.yml new file mode 100644 index 0000000..da63311 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/namespace/subcontext.yml @@ -0,0 +1,22 @@ +road: + +sky: + +using_namespace Animal: + + cat: + compose: road + + ++aviary: + using_namespace Animal: + bird: + compose: sky + + using_namespace Animal Reptile: + lizard: + compose: bird + +using_namespace Animal::Reptile::Hardshell: + turtle: + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/non_singleton/air.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/non_singleton/air.rb new file mode 100644 index 0000000..63414af --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/non_singleton/air.rb @@ -0,0 +1,2 @@ +class Air +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/non_singleton/fat_cat.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/non_singleton/fat_cat.rb new file mode 100644 index 0000000..54c195c --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/non_singleton/fat_cat.rb @@ -0,0 +1,3 @@ +class FatCat + constructor :thread_spinner, :tick, :yard, :accessors => true +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/non_singleton/objects.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/non_singleton/objects.yml new file mode 100644 index 0000000..77b4505 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/non_singleton/objects.yml @@ -0,0 +1,19 @@ +air: + +thread_spinner: + compose: air + singleton: false + +yard: + +pig: + compose: thread_spinner, yard + ++inner_sanctum: + tick: + compose: thread_spinner + singleton: false + + fat_cat: + compose: thread_spinner, tick, yard + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/non_singleton/pig.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/non_singleton/pig.rb new file mode 100644 index 0000000..9d75013 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/non_singleton/pig.rb @@ -0,0 +1,3 @@ +class Pig + constructor :thread_spinner, :yard, :accessors => true +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/non_singleton/thread_spinner.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/non_singleton/thread_spinner.rb new file mode 100644 index 0000000..384cd11 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/non_singleton/thread_spinner.rb @@ -0,0 +1,3 @@ +class ThreadSpinner + constructor :air, :accessors => true +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/non_singleton/tick.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/non_singleton/tick.rb new file mode 100644 index 0000000..e243c16 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/non_singleton/tick.rb @@ -0,0 +1,3 @@ +class Tick + constructor :thread_spinner, :accessors => true +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/non_singleton/yard.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/non_singleton/yard.rb new file mode 100644 index 0000000..43936a7 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/non_singleton/yard.rb @@ -0,0 +1,2 @@ +class Yard +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/yak/core_model.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/yak/core_model.rb new file mode 100644 index 0000000..539b56b --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/yak/core_model.rb @@ -0,0 +1,3 @@ +class CoreModel + constructor :data_source, :strict => true +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/yak/core_presenter.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/yak/core_presenter.rb new file mode 100644 index 0000000..6caca4d --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/yak/core_presenter.rb @@ -0,0 +1,3 @@ +class CorePresenter + constructor :model, :view, :strict => true +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/yak/core_view.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/yak/core_view.rb new file mode 100644 index 0000000..7e606da --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/yak/core_view.rb @@ -0,0 +1 @@ +class CoreView; end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/yak/data_source.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/yak/data_source.rb new file mode 100644 index 0000000..772d3f4 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/yak/data_source.rb @@ -0,0 +1 @@ +class DataSource; end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/yak/fringe_model.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/yak/fringe_model.rb new file mode 100644 index 0000000..255a22e --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/yak/fringe_model.rb @@ -0,0 +1,3 @@ +class FringeModel + constructor :connected, :accessors => true, :strict => true +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/yak/fringe_presenter.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/yak/fringe_presenter.rb new file mode 100644 index 0000000..e404435 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/yak/fringe_presenter.rb @@ -0,0 +1,3 @@ +class FringePresenter + constructor :fringe_model, :fringe_view, :strict => true +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/yak/fringe_view.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/yak/fringe_view.rb new file mode 100644 index 0000000..d406d3d --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/yak/fringe_view.rb @@ -0,0 +1 @@ +class FringeView; end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/yak/giant_squid.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/yak/giant_squid.rb new file mode 100644 index 0000000..2ddc2cc --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/yak/giant_squid.rb @@ -0,0 +1,3 @@ +class GiantSquid + constructor :fringe_view, :core_model, :krill, :accessors => true +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/yak/krill.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/yak/krill.rb new file mode 100644 index 0000000..5e79f91 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/yak/krill.rb @@ -0,0 +1,2 @@ +class Krill +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/yak/my_objects.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/yak/my_objects.yml new file mode 100644 index 0000000..ddc8264 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/yak/my_objects.yml @@ -0,0 +1,21 @@ + +core_model: + compose: data_source + +core_view: + +core_presenter: + model: core_model + view: core_view + +data_source: + ++fringe_context: + + fringe_model: + connected: core_model + + fringe_view: + + fringe_presenter: + compose: fringe_model, fringe_view diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/yak/sub_sub_context_test.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/yak/sub_sub_context_test.yml new file mode 100644 index 0000000..465418a --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/files/yak/sub_sub_context_test.yml @@ -0,0 +1,27 @@ + +core_model: + compose: data_source + +core_view: + +core_presenter: + model: core_model + view: core_view + +data_source: + ++fringe_context: + + fringe_model: + connected: core_model + + fringe_view: + + fringe_presenter: + compose: fringe_model, fringe_view + + +deep_context: + krill: + + giant_squid: + compose: fringe_view, core_model, krill diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/test_helper.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/test_helper.rb new file mode 100644 index 0000000..90089f0 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/diy/test/test_helper.rb @@ -0,0 +1,55 @@ +here = File.expand_path(File.dirname(__FILE__)) +PROJ_ROOT = File.expand_path("#{here}/..") +$: << "#{PROJ_ROOT}/lib" +require 'test/unit' +require 'fileutils' +require 'find' +require 'yaml' +require 'ostruct' +require "#{here}/constructor" + +class Test::Unit::TestCase + include FileUtils + + def path_to(file) + File.expand_path(File.dirname(__FILE__)) + file + end + + def not_done + flunk "IMPLEMENT ME" + end + alias :implement_me :not_done + + def poll(time_limit) + (time_limit * 10).to_i.times do + return true if yield + sleep 0.1 + end + return false + end + + def self.method_added(msym) + # Prevent duplicate test methods + if msym.to_s =~ /^test_/ + @_tracked_tests ||= {} + raise "Duplicate test #{msym}" if @_tracked_tests[msym] + @_tracked_tests[msym] = true + end + end + + # + # HELPERS + # + def path_to_test_file(fname) + path_to("/files/#{fname}") + end + + def load_context(file_name) + hash = YAML.load(File.read(path_to_test_file(file_name))) + load_hash(hash) + end + + def load_hash(hash) + @diy = DIY::Context.new(hash) + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/CHANGES b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/CHANGES new file mode 100644 index 0000000..4b5184c --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/CHANGES @@ -0,0 +1,78 @@ +Hardmock 1.3.7 + +* BUG FIX: expects! could not setup expectations for more than one concrete method on an object, since the method aliasing and rewriting was only taking place when the background mock instance was first created. This logic has been updated and now you can do all the things you'd expect. + +Hardmock 1.3.6 + +* BUG FIX: In Rails apps (and others) Hardmock and Fixtures battled viciously over "setup" and "teardown" and "method_added" (and any other clever test enhancement tool, namely Mocha) causing unpredictable results, notably failure to auto-verify mocks after teardown (leading to false positive tests). + * The newly-added TestUnitBeforeAfter provides TestCase.before_setup and TestCase.after_teardown -- formal test wrapping hooks -- lets Hardmock provide its preparation and auto-verify behavior without contending for setup/teardown supremacy. + +Hardmock 1.3.5 + +* Aliased should_receive => expects and and_return => returns for easier transition from rspec mock and flexmock users. + +Hardmock 1.3.4 + +* Prevents accidental stubbing and mocking on NilClasses + +Hardmock 1.3.3 + +* stubs! and expects! no longer require that their target methods exist in reality (this used to prevent you from stubbing methods that "exist" by virtue of "method_missing" +* Tweaked inner metaclass code to avoid collisions with rspec's "metaid" stuff +* Moved this project's Rake tasks into rake_tasks... otherwise Rails will load them, if Hardmock is installed as a Rails plugin +* Alias added: 'verify_hardmocks' is now an alias for 'verify_mocks' (some internal projects were using this modified method name as a means of cooexisting with mocha) + +Hardmock 1.3.2 + +November 2007 + +* adds 'with' as an alternate syntax for specifying argument expectations. + +Hardmock 1.3.1 + +October 2007 + +* Can use stubs! on a mock object +* expects! now generates mocked methods that can safely transfer runtime blocks to the mock instance itself +* No longer need to call "prepare_hardmock_control" when using stubs in the absence of mocks +* Stubs of concrete class or instance methods are restored to original state in teardown + +Hardmock 1.3.0 + +October 2007 + +* Adds stubs! and expects! method to all objects and classes to support concrete stubbing/mocking. + +Hardmock 1.2.3 + +Sat Apr 28 01:16:15 EDT 2007 + +* Re-release of 1.2.2 (which was canceled)... tasks moved to lib/tasks + +Hardmock 1.2.2 + +Sat Apr 28 00:41:30 EDT 2007 + +* assert_error has been broken out into its own lib file +* Gem package can now run all tests successfully +* Internal code refactoring; a number of classes that were defined in hardmock.rb are now in their own files + +Hardmock 1.2.1 + +Sat Apr 28 00:41:30 EDT 2007 + +* (botched release, see 1.2.2) + +Hardmock 1.2.0 + +* You can now use "expect" in place of "expects" if you must. +* "inspect" has been added to the list of methods NOT erased by MethodCleanout. + +Hardmock 1.1.0 + +* "expects" replaces "expect" ("expect" now raises Hardmock::DeprecationError) +* "verify_mocks" is now implicit in teardown, you needn't call it anymore +* Mocking methods that Mock would otherwise inherit from Object (eg, to_s) is now possible +* require 'hardmock' is all that's required to use the library now; no need to include in TestCase + +(previously called CMock, translated to Hardmock on 2006-12-10) diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/LICENSE b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/LICENSE new file mode 100644 index 0000000..396211e --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/LICENSE @@ -0,0 +1,7 @@ +Copyright (c) 2006,2007 David Crosby at Atomic Object, LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/README b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/README new file mode 100644 index 0000000..4650a2a --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/README @@ -0,0 +1,70 @@ +== Hardmock + +Strict, ordered mock objects using very lightweight syntax in your tests. + +== How + +The basic procedure for using Hardmock in your tests is: + +* require 'hardmock' (this happens automatically when being used as a Rails plugin) +* Create some mocks +* Setup some expectations +* Execute the target code +* Verification of calls is automatic in =teardown= + +The expectations you set when using mocks are strict and ordered. +Expectations you declare by creating and using mocks are all considered together. + +* Hardmock::Mock#expects will show you more examples +* Hardmock::SimpleExpectation will teach you more about expectation methods + +== Example + + create_mocks :garage, :car + + # Set some expectations + @garage.expects.open_door + @car.expects.start(:choke) + @car.expects.drive(:reverse, 5.mph) + + # Execute the code (this code is usually, obviously, in your class under test) + @garage.open_door + @car.start :choke + @car.drive :reverse, 5.mph + + verify_mocks # OPTIONAL, teardown will do this for you + +Expects @garage.open_door, @car.start(:choke) and @car.drive(:reverse, 5.mph) to be called in that order, with those specific arguments. +* Violations of expectations, such as mis-ordered calls, calls on wrong objects, or incorrect methods result in Hardmock::ExpectationError +* verify_mocks will raise VerifyError if not all expectations have been met. + +== Download and Install + +* Homepage: http://hardmock.rubyforge.org +* GEM or TGZ or ZIP: http://rubyforge.org/frs/?group_id=2742 +* Rails plugin: script/plugin install +* SVN access: svn co svn://rubyforge.org/var/svn/hardmock/trunk +* Developer SVN access: svn co svn://developername@rubyforge.org/var/svn/hardmock/trunk + +== Setup for Test::Unit + + require 'hardmock' + require 'assert_error' # OPTIONAL: this adds the TestUnit extension 'assert_error' + +NOTE: If installed as a Rails plugin, init.rb does this for you... nothing else is needed. + +== Setup for RSpec + +Get this into your spec helper or environment or Rakefile or wherever you prefer: + + Spec::Runner.configure do |configuration| + configuration.include Hardmock + configuration.after(:each) {verify_mocks} + end + +This puts the implicit conveniences into your spec context, like "create_mocks" etc, and also provides for automatic +"verify_mocks" after each Example is run. + +== Author +* David Crosby crosby at http://atomicobject.com +* (c) 2006,2007 Atomic Object LLC diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/Rakefile b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/Rakefile new file mode 100644 index 0000000..aff126c --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/Rakefile @@ -0,0 +1,8 @@ +require 'rake' +require 'rubygems' + +HARDMOCK_VERSION = "1.3.7" + +Dir["rake_tasks/*.rake"].each { |f| load f } + +task :default => [ 'test:all' ] diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/config/environment.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/config/environment.rb new file mode 100644 index 0000000..a15e598 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/config/environment.rb @@ -0,0 +1,12 @@ +# The path to the root directory of your application. +APP_ROOT = File.join(File.dirname(__FILE__), '..') + +ADDITIONAL_LOAD_PATHS = [] +ADDITIONAL_LOAD_PATHS.concat %w( + lib +).map { |dir| "#{APP_ROOT}/#{dir}" }.select { |dir| File.directory?(dir) } + +# Prepend to $LOAD_PATH +ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) } + +# Require any additional libraries needed diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/lib/assert_error.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/lib/assert_error.rb new file mode 100644 index 0000000..6da61de --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/lib/assert_error.rb @@ -0,0 +1,23 @@ +require 'test/unit/assertions' + +module Test::Unit #:nodoc:# + module Assertions #:nodoc:# + # A better 'assert_raise'. +patterns+ can be one or more Regexps, or a literal String that + # must match the entire error message. + def assert_error(err_type,*patterns,&block) + assert_not_nil block, "assert_error requires a block" + assert((err_type and err_type.kind_of?(Class)), "First argument to assert_error has to be an error type") + err = assert_raise(err_type) do + block.call + end + patterns.each do |pattern| + case pattern + when Regexp + assert_match(pattern, err.message) + else + assert_equal pattern, err.message + end + end + end + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/lib/extend_test_unit.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/lib/extend_test_unit.rb new file mode 100644 index 0000000..3d7ef9d --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/lib/extend_test_unit.rb @@ -0,0 +1,14 @@ + +require 'test/unit/testcase' +class Test::Unit::TestCase + include Hardmock +end + +require 'test_unit_before_after' +Test::Unit::TestCase.before_setup do |test| + test.prepare_hardmock_control +end + +Test::Unit::TestCase.after_teardown do |test| + test.verify_mocks +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/lib/hardmock.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/lib/hardmock.rb new file mode 100644 index 0000000..50f9a94 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/lib/hardmock.rb @@ -0,0 +1,86 @@ +require 'hardmock/method_cleanout' +require 'hardmock/mock' +require 'hardmock/mock_control' +require 'hardmock/utils' +require 'hardmock/errors' +require 'hardmock/trapper' +require 'hardmock/expector' +require 'hardmock/expectation' +require 'hardmock/expectation_builder' +require 'hardmock/stubbing' + +module Hardmock + + # Create one or more new Mock instances in your test suite. + # Once created, the Mocks are accessible as instance variables in your test. + # Newly built Mocks are added to the full set of Mocks for this test, which will + # be verified when you call verify_mocks. + # + # create_mocks :donkey, :cat # Your test now has @donkey and @cat + # create_mock :dog # Test now has @donkey, @cat and @dog + # + # The first call returned a hash { :donkey => @donkey, :cat => @cat } + # and the second call returned { :dog => @dog } + # + # For more info on how to use your mocks, see Mock and Expectation + # + def create_mocks(*mock_names) + prepare_hardmock_control unless @main_mock_control + + mocks = {} + mock_names.each do |mock_name| + raise ArgumentError, "'nil' is not a valid name for a mock" if mock_name.nil? + mock_name = mock_name.to_s + mock_object = Mock.new(mock_name, @main_mock_control) + mocks[mock_name.to_sym] = mock_object + self.instance_variable_set "@#{mock_name}", mock_object + end + @all_mocks ||= {} + @all_mocks.merge! mocks + + return mocks.clone + end + + def prepare_hardmock_control + if @main_mock_control.nil? + @main_mock_control = MockControl.new + $main_mock_control = @main_mock_control + else + raise "@main_mock_control is already setup for this test!" + end + end + + alias :create_mock :create_mocks + + # Ensures that all expectations have been met. If not, VerifyException is + # raised. + # + # You normally won't need to call this yourself. Within Test::Unit::TestCase, this will be done automatically at teardown time. + # + # * +force+ -- if +false+, and a VerifyError or ExpectationError has already occurred, this method will not raise. This is to help you suppress repeated errors when if you're calling #verify_mocks in the teardown method of your test suite. BE WARNED - only use this if you're sure you aren't obscuring useful information. Eg, if your code handles exceptions internally, and an ExpectationError gets gobbled up by your +rescue+ block, the cause of failure for your test may be hidden from you. For this reason, #verify_mocks defaults to force=true as of Hardmock 1.0.1 + def verify_mocks(force=true) + return unless @main_mock_control + return if @main_mock_control.disappointed? and !force + @main_mock_control.verify + ensure + @main_mock_control.clear_expectations if @main_mock_control + $main_mock_control = nil + reset_stubs + end + + alias :verify_hardmocks :verify_mocks + + # Purge the main MockControl of all expectations, restore all concrete stubbed/mocked methods + def clear_expectations + @main_mock_control.clear_expectations if @main_mock_control + reset_stubs + $main_mock_control = nil + end + + def reset_stubs + Hardmock.restore_all_replaced_methods + end + +end + +require 'extend_test_unit' diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/lib/hardmock/errors.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/lib/hardmock/errors.rb new file mode 100644 index 0000000..48698a6 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/lib/hardmock/errors.rb @@ -0,0 +1,22 @@ +module Hardmock + # Raised when: + # * Unexpected method is called on a mock object + # * Bad arguments passed to an expected call + class ExpectationError < StandardError #:nodoc:# + end + + # Raised for methods that should no longer be called. Hopefully, the exception message contains helpful alternatives. + class DeprecationError < StandardError #:nodoc:# + end + + # Raised when stubbing fails + class StubbingError < StandardError #:nodoc:# + end + + # Raised when it is discovered that an expected method call was never made. + class VerifyError < StandardError #:nodoc:# + def initialize(msg,unmet_expectations) + super("#{msg}:" + unmet_expectations.map { |ex| "\n * #{ex.to_s}" }.join) + end + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/lib/hardmock/expectation.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/lib/hardmock/expectation.rb new file mode 100644 index 0000000..4d1db92 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/lib/hardmock/expectation.rb @@ -0,0 +1,229 @@ +require 'hardmock/utils' + +module Hardmock + class Expectation + include Utils + attr_reader :block_value + + def initialize(options) #:nodoc: + @options = options + end + + def apply_method_call(mock,mname,args,block) #:nodoc: + unless @options[:mock].equal?(mock) + raise anger("Wrong object", mock,mname,args) + end + unless @options[:method] == mname + raise anger("Wrong method",mock,mname,args) + end + + # Tester-defined block to invoke at method-call-time: + expectation_block = @options[:block] + + expected_args = @options[:arguments] + # if we have a block, we can skip the argument check if none were specified + unless (expected_args.nil? || expected_args.empty?) && expectation_block && !@options[:suppress_arguments_to_block] + unless expected_args == args + raise anger("Wrong arguments",mock,mname,args) + end + end + + relayed_args = args.dup + if block + if expectation_block.nil? + # Can't handle a runtime block without an expectation block + raise ExpectationError.new("Unexpected block provided to #{to_s}") + else + # Runtime blocks are passed as final argument to the expectation block + unless @options[:suppress_arguments_to_block] + relayed_args << block + else + # Arguments suppressed; send only the block + relayed_args = [block] + end + end + end + + # Run the expectation block: + @block_value = expectation_block.call(*relayed_args) if expectation_block + + raise @options[:raises] unless @options[:raises].nil? + + return_value = @options[:returns] + if return_value.nil? + return @block_value + else + return return_value + end + end + + # Set the return value for an expected method call. + # Eg, + # @cash_machine.expects.withdraw(20,:dollars).returns(20.00) + def returns(val) + @options[:returns] = val + self + end + alias_method :and_return, :returns + + # Set the arguments for an expected method call. + # Eg, + # @cash_machine.expects.deposit.with(20, "dollars").returns(:balance => "20") + def with(*args) + @options[:arguments] = args + self + end + + # Rig an expected method to raise an exception when the mock is invoked. + # + # Eg, + # @cash_machine.expects.withdraw(20,:dollars).raises "Insufficient funds" + # + # The argument can be: + # * an Exception -- will be used directly + # * a String -- will be used as the message for a RuntimeError + # * nothing -- RuntimeError.new("An Error") will be raised + def raises(err=nil) + case err + when Exception + @options[:raises] = err + when String + @options[:raises] = RuntimeError.new(err) + else + @options[:raises] = RuntimeError.new("An Error") + end + self + end + + # Convenience method: assumes +block_value+ is set, and is set to a Proc + # (or anything that responds to 'call') + # + # light_event = @traffic_light.trap.subscribe(:light_changes) + # + # # This code will meet the expectation: + # @traffic_light.subscribe :light_changes do |color| + # puts color + # end + # + # The color-handling block is now stored in light_event.block_value + # + # The block can be invoked like this: + # + # light_event.trigger :red + # + # See Mock#trap and Mock#expects for information on using expectation objects + # after they are set. + # + def trigger(*block_arguments) + unless block_value + raise ExpectationError.new("No block value is currently set for expectation #{to_s}") + end + unless block_value.respond_to?(:call) + raise ExpectationError.new("Can't apply trigger to #{block_value} for expectation #{to_s}") + end + block_value.call *block_arguments + end + + # Used when an expected method accepts a block at runtime. + # When the expected method is invoked, the block passed to + # that method will be invoked as well. + # + # NOTE: ExpectationError will be thrown upon running the expected method + # if the arguments you set up in +yields+ do not properly match up with + # the actual block that ends up getting passed. + # + # == Examples + # Single invocation: The block passed to +lock_down+ gets invoked + # once with no arguments: + # + # @safe_zone.expects.lock_down.yields + # + # # (works on code that looks like:) + # @safe_zone.lock_down do + # # ... this block invoked once + # end + # + # Multi-parameter blocks: The block passed to +each_item+ gets + # invoked twice, with :item1 the first time, and with + # :item2 the second time: + # + # @fruit_basket.expects.each_with_index.yields [:apple,1], [:orange,2] + # + # # (works on code that looks like:) + # @fruit_basket.each_with_index do |fruit,index| + # # ... this block invoked with fruit=:apple, index=1, + # # ... and then with fruit=:orange, index=2 + # end + # + # Arrays can be passed as arguments too... if the block + # takes a single argument and you want to pass a series of arrays into it, + # that will work as well: + # + # @list_provider.expects.each_list.yields [1,2,3], [4,5,6] + # + # # (works on code that looks like:) + # @list_provider.each_list do |list| + # # ... list is [1,2,3] the first time + # # ... list is [4,5,6] the second time + # end + # + # Return value: You can set the return value for the method that + # accepts the block like so: + # + # @cruncher.expects.do_things.yields(:bean1,:bean2).returns("The Results") + # + # Raising errors: You can set the raised exception for the method that + # accepts the block. NOTE: the error will be raised _after_ the block has + # been invoked. + # + # # :bean1 and :bean2 will be passed to the block, then an error is raised: + # @cruncher.expects.do_things.yields(:bean1,:bean2).raises("Too crunchy") + # + def yields(*items) + @options[:suppress_arguments_to_block] = true + if items.empty? + # Yield once + @options[:block] = lambda do |block| + if block.arity != 0 and block.arity != -1 + raise ExpectationError.new("The given block was expected to have no parameter count; instead, got #{block.arity} to <#{to_s}>") + end + block.call + end + else + # Yield one or more specific items + @options[:block] = lambda do |block| + items.each do |item| + if item.kind_of?(Array) + if block.arity == item.size + # Unfold the array into the block's arguments: + block.call *item + elsif block.arity == 1 + # Just pass the array in + block.call item + else + # Size mismatch + raise ExpectationError.new("Can't pass #{item.inspect} to block with arity #{block.arity} to <#{to_s}>") + end + else + if block.arity != 1 + # Size mismatch + raise ExpectationError.new("Can't pass #{item.inspect} to block with arity #{block.arity} to <#{to_s}>") + end + block.call item + end + end + end + end + self + end + + def to_s # :nodoc: + format_method_call_string(@options[:mock],@options[:method],@options[:arguments]) + end + + private + def anger(msg, mock,mname,args) + ExpectationError.new("#{msg}: expected call <#{to_s}> but was <#{format_method_call_string(mock,mname,args)}>") + end + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/lib/hardmock/expectation_builder.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/lib/hardmock/expectation_builder.rb new file mode 100644 index 0000000..7445fb1 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/lib/hardmock/expectation_builder.rb @@ -0,0 +1,9 @@ +require 'hardmock/expectation' + +module Hardmock + class ExpectationBuilder #:nodoc: + def build_expectation(options) + Expectation.new(options) + end + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/lib/hardmock/expector.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/lib/hardmock/expector.rb new file mode 100644 index 0000000..8055460 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/lib/hardmock/expector.rb @@ -0,0 +1,26 @@ +require 'hardmock/method_cleanout' +require 'hardmock/errors' + +module Hardmock + class Expector #:nodoc: + include MethodCleanout + + def initialize(mock,mock_control,expectation_builder) + @mock = mock + @mock_control = mock_control + @expectation_builder = expectation_builder + end + + def method_missing(mname, *args, &block) + expectation = @expectation_builder.build_expectation( + :mock => @mock, + :method => mname, + :arguments => args, + :block => block) + + @mock_control.add_expectation expectation + expectation + end + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/lib/hardmock/method_cleanout.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/lib/hardmock/method_cleanout.rb new file mode 100644 index 0000000..51797e6 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/lib/hardmock/method_cleanout.rb @@ -0,0 +1,33 @@ + +module Hardmock #:nodoc: + module MethodCleanout #:nodoc: + SACRED_METHODS = %w{ + __id__ + __send__ + equal? + object_id + send + nil? + class + kind_of? + respond_to? + inspect + method + to_s + instance_variables + instance_eval + == + hm_metaclass + hm_meta_eval + hm_meta_def + } + + def self.included(base) #:nodoc: + base.class_eval do + instance_methods.each do |m| + undef_method m unless SACRED_METHODS.include?(m.to_s) + end + end + end + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/lib/hardmock/mock.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/lib/hardmock/mock.rb new file mode 100644 index 0000000..928c432 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/lib/hardmock/mock.rb @@ -0,0 +1,180 @@ + +module Hardmock + # Mock is used to set expectations in your test. Most of the time you'll use + # #expects to create expectations. + # + # Aside from the scant few control methods (like +expects+, +trap+ and +_verify+) + # all calls made on a Mock instance will be immediately applied to the internal + # expectation mechanism. + # + # * If the method call was expected and all the parameters match properly, execution continues + # * If the expectation was configured with an expectation block, the block is invoked + # * If the expectation was set up to raise an error, the error is raised now + # * If the expectation was set up to return a value, it is returned + # * If the method call was _not_ expected, or the parameter values are wrong, an ExpectationError is raised. + class Mock + include Hardmock::MethodCleanout + + # Create a new Mock instance with a name and a MockControl to support it. + # If not given, a MockControl is made implicitly for this Mock alone; this means + # expectations for this mock are not tied to other expectations in your test. + # + # It's not recommended to use a Mock directly; see Hardmock and + # Hardmock#create_mocks for the more wholistic approach. + def initialize(name, mock_control=nil) + @name = name + @control = mock_control || MockControl.new + @expectation_builder = ExpectationBuilder.new + end + + def inspect + "" + end + + # Begin declaring an expectation for this Mock. + # + # == Simple Examples + # Expect the +customer+ to be queried for +account+, and return "The + # Account": + # @customer.expects.account.returns "The Account" + # + # Expect the +withdraw+ method to be called, and raise an exception when it + # is (see Expectation#raises for more info): + # @cash_machine.expects.withdraw(20,:dollars).raises("not enough money") + # + # Expect +customer+ to have its +user_name+ set + # @customer.expects.user_name = 'Big Boss' + # + # Expect +customer+ to have its +user_name+ set, and raise a RuntimeException when + # that happens: + # @customer.expects('user_name=', "Big Boss").raises "lost connection" + # + # Expect +evaluate+ to be passed a block, and when that happens, pass a value + # to the block (see Expectation#yields for more info): + # @cruncher.expects.evaluate.yields("some data").returns("some results") + # + # + # == Expectation Blocks + # To do special handling of expected method calls when they occur, you + # may pass a block to your expectation, like: + # @page_scraper.expects.handle_content do |address,request,status| + # assert_not_nil address, "Can't abide nil addresses" + # assert_equal "http-get", request.method, "Can only handle GET" + # assert status > 200 and status < 300, status, "Failed status" + # "Simulated results #{request.content.downcase}" + # end + # In this example, when page_scraper.handle_content is called, its + # three arguments are passed to the expectation block and evaluated + # using the above assertions. The last value in the block will be used + # as the return value for +handle_content+ + # + # You may specify arguments to the expected method call, just like any normal + # expectation, and those arguments will be pre-validated before being passed + # to the expectation block. This is useful when you know all of the + # expected values but still need to do something programmatic. + # + # If the method being invoked on the mock accepts a block, that block will be + # passed to your expectation block as the last (or only) argument. Eg, the + # convenience method +yields+ can be replaced with the more explicit: + # @cruncher.expects.evaluate do |block| + # block.call "some data" + # "some results" + # end + # + # The result value of the expectation block becomes the return value for the + # expected method call. This can be overidden by using the +returns+ method: + # @cruncher.expects.evaluate do |block| + # block.call "some data" + # "some results" + # end.returns("the actual value") + # + # Additionally, the resulting value of the expectation block is stored + # in the +block_value+ field on the expectation. If you've saved a reference + # to your expectation, you may retrieve the block value once the expectation + # has been met. + # + # evaluation_event = @cruncher.expects.evaluate do |block| + # block.call "some data" + # "some results" + # end.returns("the actual value") + # + # result = @cruncher.evaluate do |input| + # puts input # => 'some data' + # end + # # result is 'the actual value' + # + # evaluation_event.block_value # => 'some results' + # + def expects(*args, &block) + expector = Expector.new(self,@control,@expectation_builder) + # If there are no args, we return the Expector + return expector if args.empty? + # If there ARE args, we set up the expectation right here and return it + expector.send(args.shift.to_sym, *args, &block) + end + alias_method :expect, :expects + alias_method :should_receive, :expects + + # Special-case convenience: #trap sets up an expectation for a method + # that will take a block. That block, when sent to the expected method, will + # be trapped and stored in the expectation's +block_value+ field. + # The Expectation#trigger method may then be used to invoke that block. + # + # Like +expects+, the +trap+ mechanism can be followed by +raises+ or +returns+. + # + # _Unlike_ +expects+, you may not use an expectation block with +trap+. If + # the expected method takes arguments in addition to the block, they must + # be specified in the arguments to the +trap+ call itself. + # + # == Example + # + # create_mocks :address_book, :editor_form + # + # # Expect a subscription on the :person_added event for @address_book: + # person_event = @address_book.trap.subscribe(:person_added) + # + # # The runtime code would look like: + # @address_book.subscribe :person_added do |person_name| + # @editor_form.name = person_name + # end + # + # # At this point, the expectation for 'subscribe' is met and the + # # block has been captured. But we're not done: + # @editor_form.expects.name = "David" + # + # # Now invoke the block we trapped earlier: + # person_event.trigger "David" + # + # verify_mocks + def trap(*args) + Trapper.new(self,@control,ExpectationBuilder.new) + end + + def method_missing(mname,*args) #:nodoc: + block = nil + block = Proc.new if block_given? + @control.apply_method_call(self,mname,args,block) + end + + + def _control #:nodoc: + @control + end + + def _name #:nodoc: + @name + end + + # Verify that all expectations are fulfilled. NOTE: this method triggers + # validation on the _control_ for this mock, so all Mocks that share the + # MockControl with this instance will be included in the verification. + # + # Only use this method if you are managing your own Mocks and their controls. + # + # Normal usage of Hardmock doesn't require you to call this; let + # Hardmock#verify_mocks do it for you. + def _verify + @control.verify + end + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/lib/hardmock/mock_control.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/lib/hardmock/mock_control.rb new file mode 100644 index 0000000..302ebce --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/lib/hardmock/mock_control.rb @@ -0,0 +1,53 @@ +require 'hardmock/utils' + +module Hardmock + class MockControl #:nodoc: + include Utils + attr_accessor :name + + def initialize + clear_expectations + end + + def happy? + @expectations.empty? + end + + def disappointed? + @disappointed + end + + def add_expectation(expectation) +# puts "MockControl #{self.object_id.to_s(16)} adding expectation: #{expectation}" + @expectations << expectation + end + + def apply_method_call(mock,mname,args,block) + # Are we even expecting any sort of call? + if happy? + @disappointed = true + raise ExpectationError.new("Surprise call to #{format_method_call_string(mock,mname,args)}") + end + + begin + @expectations.shift.apply_method_call(mock,mname,args,block) + rescue Exception => ouch + @disappointed = true + raise ouch + end + end + + def verify +# puts "MockControl #{self.object_id.to_s(16)} verify: happy? #{happy?}" + @disappointed = !happy? + raise VerifyError.new("Unmet expectations", @expectations) unless happy? + end + + def clear_expectations + @expectations = [] + @disappointed = false + end + + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/lib/hardmock/stubbing.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/lib/hardmock/stubbing.rb new file mode 100644 index 0000000..0f8a293 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/lib/hardmock/stubbing.rb @@ -0,0 +1,210 @@ + + +# Stubbing support +# +# Stubs methods on classes and instances +# + +# Why's "metaid.rb" stuff crunched down: +class Object #:nodoc:# + def hm_metaclass #:nodoc:# + class << self + self + end + end + + def hm_meta_eval(&blk) #:nodoc:# + hm_metaclass.instance_eval(&blk) + end + + def hm_meta_def(name, &blk) #:nodoc:# + hm_meta_eval { define_method name, &blk } + end +end + + + +module Hardmock + + # == Hardmock: Stubbing and Mocking Concrete Methods + # + # Hardmock lets you stub and/or mock methods on concrete classes or objects. + # + # * To "stub" a concrete method is to rig it to return the same thing always, disregarding any arguments. + # * To "mock" a concrete method is to surplant its funcionality by delegating to a mock object who will cover this behavior. + # + # Mocked methods have their expectations considered along with all other mock object expectations. + # + # If you use stubbing or concrete mocking in the absence (or before creation) of other mocks, you need to invoke prepare_hardmock_control. + # Once verify_mocks or clear_expectaions is called, the overriden behavior in the target objects is restored. + # + # == Examples + # + # River.stubs!(:sounds_like).returns("gurgle") + # + # River.expects!(:jump).returns("splash") + # + # rogue.stubs!(:sounds_like).returns("pshshsh") + # + # rogue.expects!(:rawhide_tanning_solvents).returns("giant snapping turtles") + # + module Stubbing + # Exists only for documentation + end + + class ReplacedMethod #:nodoc:# + attr_reader :target, :method_name + + def initialize(target, method_name) + @target = target + @method_name = method_name + + Hardmock.track_replaced_method self + end + end + + class StubbedMethod < ReplacedMethod #:nodoc:# + def invoke(args) + raise @raises if @raises + @return_value + end + + def returns(stubbed_return) + @return_value = stubbed_return + end + + def raises(err) + err = RuntimeError.new(err) unless err.kind_of?(Exception) + @raises = err + end + end + + class ::Object + def stubs!(method_name) + method_name = method_name.to_s + already_stubbed = Hardmock.has_replaced_method?(self, method_name) + + stubbed_method = Hardmock::StubbedMethod.new(self, method_name) + + + unless _is_mock? or already_stubbed + if methods.include?(method_name.to_s) + hm_meta_eval do + alias_method "_hardmock_original_#{method_name}".to_sym, method_name.to_sym + end + end + end + + hm_meta_def method_name do |*args| + stubbed_method.invoke(args) + end + + stubbed_method + end + + def expects!(method_name, *args, &block) + if self._is_mock? + raise Hardmock::StubbingError, "Cannot use 'expects!(:#{method_name})' on a Mock object; try 'expects' instead" + end + + method_name = method_name.to_s + + @_my_mock = Mock.new(_my_name, $main_mock_control) if @_my_mock.nil? + + unless Hardmock.has_replaced_method?(self, method_name) + # Track the method as replaced + Hardmock::ReplacedMethod.new(self, method_name) + + # Preserver original implementation of the method by aliasing it away + if methods.include?(method_name) + hm_meta_eval do + alias_method "_hardmock_original_#{method_name}".to_sym, method_name.to_sym + end + end + + # Re-define the method to utilize our patron mock instance. + # (This global-temp-var thing is hokey but I was having difficulty generating + # code for the meta class.) + begin + $method_text_temp = %{ + def #{method_name}(*args,&block) + @_my_mock.__send__(:#{method_name}, *args, &block) + end + } + class << self + eval $method_text_temp + end + ensure + $method_text_temp = nil + end + end + + return @_my_mock.expects(method_name, *args, &block) + end + + def _is_mock? + self.kind_of?(Mock) + end + + def _my_name + self.kind_of?(Class) ? self.name : self.class.name + end + + def _clear_mock + @_my_mock = nil + end + + end + + class ::NilClass + # Use this only if you really mean it + alias_method :intentionally_stubs!, :stubs! + + # Use this only if you really mean it + alias_method :intentionally_expects!, :expects! + + # Overridden to protect against accidental nil reference self delusion + def stubs!(mname) + raise StubbingError, "Cannot stub #{mname} method on nil. (If you really mean to, try 'intentionally_stubs!')" + end + + # Overridden to protect against accidental nil reference self delusion + def expects!(mname, *args) + raise StubbingError, "Cannot mock #{mname} method on nil. (If you really mean to, try 'intentionally_expects!')" + end + end + + class << self + def track_replaced_method(replaced_method) + all_replaced_methods << replaced_method + end + + def all_replaced_methods + $all_replaced_methods ||= [] + end + + def has_replaced_method?(obj, method_name) + hits = all_replaced_methods.select do |replaced| + (replaced.target.object_id == obj.object_id) and (replaced.method_name.to_s == method_name.to_s) + end + return !hits.empty? + end + + def restore_all_replaced_methods + all_replaced_methods.each do |replaced| + unless replaced.target._is_mock? + backed_up = "_hardmock_original_#{replaced.method_name}" + if replaced.target.methods.include?(backed_up) + replaced.target.hm_meta_eval do + alias_method replaced.method_name.to_sym, backed_up.to_sym + end + end + replaced.target._clear_mock + end + end + all_replaced_methods.clear + end + end + +end + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/lib/hardmock/trapper.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/lib/hardmock/trapper.rb new file mode 100644 index 0000000..6aab176 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/lib/hardmock/trapper.rb @@ -0,0 +1,31 @@ +require 'test/unit/assertions' +require 'hardmock/errors' + +module Hardmock + class Trapper #:nodoc: + include Hardmock::MethodCleanout + + def initialize(mock,mock_control,expectation_builder) + @mock = mock + @mock_control = mock_control + @expectation_builder = expectation_builder + end + + def method_missing(mname, *args) + if block_given? + raise ExpectationError.new("Don't pass blocks when using 'trap' (setting exepectations for '#{mname}')") + end + + the_block = lambda { |target_block| target_block } + expectation = @expectation_builder.build_expectation( + :mock => @mock, + :method => mname, + :arguments => args, + :suppress_arguments_to_block => true, + :block => the_block) + + @mock_control.add_expectation expectation + expectation + end + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/lib/hardmock/utils.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/lib/hardmock/utils.rb new file mode 100644 index 0000000..1740577 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/lib/hardmock/utils.rb @@ -0,0 +1,9 @@ + +module Hardmock + module Utils #:nodoc: + def format_method_call_string(mock,mname,args) + arg_string = args.map { |a| a.inspect }.join(', ') + call_text = "#{mock._name}.#{mname}(#{arg_string})" + end + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/lib/test_unit_before_after.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/lib/test_unit_before_after.rb new file mode 100644 index 0000000..0499e39 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/lib/test_unit_before_after.rb @@ -0,0 +1,169 @@ +require 'test/unit' +require 'test/unit/testcase' +require 'test/unit/assertions' + +module Test #:nodoc:# + module Unit #:nodoc:# + + # == TestCase Modifications + # + # Monkey-patch to provide a formal mechanism for appending actions to be executed after teardown. + # Use after_teardown to define one or more actions to be executed after teardown for ALL tests. + # + # COMING SOON? + # * (maybe?) Hooks for before_teardown, after_setup, on_error + # * (maybe?) Options for positional control, eg, after_teardown :before_other_actions + # * (maybe?) Provide tagging/filtering so action execution can be controlled specifically? + # + # == Usage + # + # Invoke TestCase.after_teardown with optional parameter, which will be invoked with a reference + # to the test instance that has just been torn down. + # + # Example: + # + # Test::Unit::TestCase.after_teardown do |test| + # test.verify_mocks + # end + # + # == Justification + # + # There are a number of tools and libraries that play fast-n-loose with setup and teardown by + # wrapping them, and by overriding method_added as a means of upholding special setup/teardown + # behavior, usually by re-wrapping newly defined user-level setup/teardown methods. + # mocha and active_record/fixtures (and previously, hardmock) will fight for this + # territory with often unpredictable results. + # + # We wouldn't have to battle if Test::Unit provided a formal pre- and post- hook mechanism. + # + class TestCase + + class << self + + # Define an action to be run after teardown. Subsequent calls result in + # multiple actions. The block will be given a reference to the test + # being executed. + # + # Example: + # + # Test::Unit::TestCase.after_teardown do |test| + # test.verify_mocks + # end + def after_teardown(&block) + post_teardown_actions << block + end + + # Used internally. Access the list of post teardown actions for to be + # used by all tests. + def post_teardown_actions + @@post_teardown_actions ||= [] + end + + # Define an action to be run before setup. Subsequent calls result in + # multiple actions, EACH BEING PREPENDED TO THE PREVIOUS. + # The block will be given a reference to the test being executed. + # + # Example: + # + # Test::Unit::TestCase.before_setup do |test| + # test.prepare_hardmock_control + # end + def before_setup(&block) + pre_setup_actions.unshift block + end + + # Used internally. Access the list of post teardown actions for to be + # used by all tests. + def pre_setup_actions + @@pre_setup_actions ||= [] + end + end + + # OVERRIDE: This is a reimplementation of the default "run", updated to + # execute actions after teardown. + def run(result) + yield(STARTED, name) + @_result = result + begin + execute_pre_setup_actions(self) + setup + __send__(@method_name) + rescue Test::Unit::AssertionFailedError => e + add_failure(e.message, auxiliary_backtrace_filter(e.backtrace)) + rescue Exception + raise if should_passthru_exception($!) # See implementation; this is for pre-1.8.6 compat + add_error($!) + ensure + begin + teardown + rescue Test::Unit::AssertionFailedError => e + add_failure(e.message, auxiliary_backtrace_filter(e.backtrace)) + rescue Exception + raise if should_passthru_exception($!) # See implementation; this is for pre-1.8.6 compat + add_error($!) + ensure + execute_post_teardown_actions(self) + end + end + result.add_run + yield(FINISHED, name) + end + + private + + # Run through the after_teardown actions, treating failures and errors + # in the same way that "run" does: they are reported, and the remaining + # actions are executed. + def execute_post_teardown_actions(test_instance) + self.class.post_teardown_actions.each do |action| + begin + action.call test_instance + rescue Test::Unit::AssertionFailedError => e + add_failure(e.message, auxiliary_backtrace_filter(e.backtrace)) + rescue Exception + raise if should_passthru_exception($!) + add_error($!) + end + end + end + + # Run through the before_setup actions. + # Failures or errors cause execution to stop. + def execute_pre_setup_actions(test_instance) + self.class.pre_setup_actions.each do |action| +# begin + action.call test_instance +# rescue Test::Unit::AssertionFailedError => e +# add_failure(e.message, auxiliary_backtrace_filter(e.backtrace)) +# rescue Exception +# raise if should_passthru_exception($!) +# add_error($!) +# end + end + end + + # Make sure that this extension doesn't show up in failure backtraces + def auxiliary_backtrace_filter(trace) + trace.reject { |x| x =~ /test_unit_before_after/ } + end + + # Is the given error of the type that we allow to fly out (rather than catching it)? + def should_passthru_exception(ex) + return passthrough_exception_types.include?($!.class) + end + + # Provide a list of exception types that are to be allowed to explode out. + # Pre-ruby-1.8.6 doesn't use this functionality, so the PASSTHROUGH_EXCEPTIONS + # constant won't be defined. This methods defends against that and returns + # an empty list instead. + def passthrough_exception_types + begin + return PASSTHROUGH_EXCEPTIONS + rescue NameError + # older versions of test/unit do not have PASSTHROUGH_EXCEPTIONS constant + return [] + end + end + end + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/rake_tasks/rdoc.rake b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/rake_tasks/rdoc.rake new file mode 100644 index 0000000..6a6d79f --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/rake_tasks/rdoc.rake @@ -0,0 +1,19 @@ +require 'rake/rdoctask' +require File.expand_path(File.dirname(__FILE__) + "/rdoc_options.rb") + +namespace :doc do + + desc "Generate RDoc documentation" + Rake::RDocTask.new { |rdoc| + rdoc.rdoc_dir = 'doc' + rdoc.title = "Hardmock: Strict expectation-based mock object library " + add_rdoc_options(rdoc.options) + rdoc.rdoc_files.include('lib/**/*.rb', 'README','CHANGES','LICENSE') + } + + task :show => [ 'doc:rerdoc' ] do + sh "open doc/index.html" + end + +end + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/rake_tasks/rdoc_options.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/rake_tasks/rdoc_options.rb new file mode 100644 index 0000000..85bf4ce --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/rake_tasks/rdoc_options.rb @@ -0,0 +1,4 @@ + +def add_rdoc_options(options) + options << '--line-numbers' << '--inline-source' << '--main' << 'README' << '--title' << 'Hardmock' +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/rake_tasks/test.rake b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/rake_tasks/test.rake new file mode 100644 index 0000000..85a3753 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/rake_tasks/test.rake @@ -0,0 +1,22 @@ +require 'rake/testtask' + +namespace :test do + + desc "Run unit tests" + Rake::TestTask.new("units") { |t| + t.libs << "test" + t.pattern = 'test/unit/*_test.rb' + t.verbose = true + } + + desc "Run functional tests" + Rake::TestTask.new("functional") { |t| + t.libs << "test" + t.pattern = 'test/functional/*_test.rb' + t.verbose = true + } + + desc "Run all the tests" + task :all => [ 'test:units', 'test:functional' ] + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/test/functional/assert_error_test.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/test/functional/assert_error_test.rb new file mode 100644 index 0000000..e4b35cf --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/test/functional/assert_error_test.rb @@ -0,0 +1,52 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'assert_error' + +class AssertErrorTest < Test::Unit::TestCase + + it "specfies an error type and message that should be raised" do + assert_error RuntimeError, "Too funky" do + raise RuntimeError.new("Too funky") + end + end + + it "flunks if the error message is wrong" do + err = assert_raise Test::Unit::AssertionFailedError do + assert_error RuntimeError, "not good" do + raise RuntimeError.new("Too funky") + end + end + assert_match(/not good/i, err.message) + assert_match(/too funky/i, err.message) + end + + it "flunks if the error type is wrong" do + err = assert_raise Test::Unit::AssertionFailedError do + assert_error StandardError, "Too funky" do + raise RuntimeError.new("Too funky") + end + end + assert_match(/StandardError/i, err.message) + assert_match(/RuntimeError/i, err.message) + end + + it "can match error message text using a series of Regexps" do + assert_error StandardError, /too/i, /funky/i do + raise StandardError.new("Too funky") + end + end + + it "flunks if the error message doesn't match all the Regexps" do + err = assert_raise Test::Unit::AssertionFailedError do + assert_error StandardError, /way/i, /too/i, /funky/i do + raise StandardError.new("Too funky") + end + end + assert_match(/way/i, err.message) + end + + it "can operate without any message specification" do + assert_error StandardError do + raise StandardError.new("ooof") + end + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/test/functional/auto_verify_test.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/test/functional/auto_verify_test.rb new file mode 100644 index 0000000..1b005bd --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/test/functional/auto_verify_test.rb @@ -0,0 +1,178 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'fileutils' + +class AutoVerifyTest < Test::Unit::TestCase + + def setup + @expect_unmet_expectations = true + end + + def teardown + remove_temp_test_file + end + + # + # TESTS + # + + it "auto-verifies all mocks in teardown" do + write_and_execute_test + end + + it "auto-verifies even if user defines own teardown" do + @teardown_code =<<-EOM + def teardown + # just in the way + end + EOM + write_and_execute_test + end + + should "not obscure normal failures when verification fails" do + @test_code =<<-EOM + def test_setup_doomed_expectation + create_mock :automobile + @automobile.expects.start + flunk "natural failure" + end + EOM + @expect_failures = 1 + write_and_execute_test + end + + should "not skip user-defined teardown when verification fails" do + @teardown_code =<<-EOM + def teardown + puts "User teardown" + end + EOM + write_and_execute_test + assert_output_contains(/User teardown/) + end + + it "is quiet when verification is ok" do + @test_code =<<-EOM + def test_ok + create_mock :automobile + @automobile.expects.start + @automobile.start + end + EOM + @teardown_code =<<-EOM + def teardown + puts "User teardown" + end + EOM + @expect_unmet_expectations = false + @expect_failures = 0 + @expect_errors = 0 + write_and_execute_test + assert_output_contains(/User teardown/) + end + + should "auto-verify even if user teardown explodes" do + @teardown_code =<<-EOM + def teardown + raise "self destruct" + end + EOM + @expect_errors = 2 + write_and_execute_test + assert_output_contains(/self destruct/) + end + + it "plays nice with inherited teardown methods" do + @full_code ||=<<-EOTEST + require File.expand_path(File.dirname(__FILE__) + "/../test_helper") + require 'hardmock' + class Test::Unit::TestCase + def teardown + puts "Test helper teardown" + end + end + class DummyTest < Test::Unit::TestCase + def test_prepare_to_die + create_mock :automobile + @automobile.expects.start + end + end + EOTEST + write_and_execute_test + assert_output_contains(/Test helper teardown/) + end + + # + # HELPERS + # + + def temp_test_file + File.expand_path(File.dirname(__FILE__) + "/tear_down_verification_test.rb") + end + + def run_test(tbody) + File.open(temp_test_file,"w") { |f| f.print(tbody) } + @test_output = `ruby #{temp_test_file} 2>&1` + end + + def formatted_test_output + if @test_output + @test_output.split(/\n/).map { |line| "> #{line}" }.join("\n") + else + "(NO TEST OUTPUT!)" + end + end + + def remove_temp_test_file + FileUtils::rm_f temp_test_file + end + + def assert_results(h) + if @test_output !~ /#{h[:tests]} tests, [0-9]+ assertions, #{h[:failures]} failures, #{h[:errors]} errors/ + flunk "Test results didn't match #{h.inspect}:\n#{formatted_test_output}" + end + end + + def assert_output_contains(*patterns) + patterns.each do |pattern| + if @test_output !~ pattern + flunk "Test output didn't match #{pattern.inspect}:\n#{formatted_test_output}" + end + end + end + + def assert_output_doesnt_contain(*patterns) + patterns.each do |pattern| + assert @test_output !~ pattern, "Output shouldn't match #{pattern.inspect} but it does." + end + end + + def write_and_execute_test + @test_code ||=<<-EOM + def test_setup_doomed_expectation + create_mock :automobile + @automobile.expects.start + end + EOM + @full_code ||=<<-EOTEST + require File.expand_path(File.dirname(__FILE__) + "/../test_helper") + require 'hardmock' + class DummyTest < Test::Unit::TestCase + #{@teardown_code} + #{@test_code} + end + EOTEST + run_test @full_code + + if @expect_unmet_expectations + assert_output_contains(/unmet expectations/i, /automobile/, /start/) + else + assert_output_doesnt_contain(/unmet expectations/i, /automobile/, /start/) + end + + @expect_tests ||= 1 + @expect_failures ||= 0 + @expect_errors ||= 1 + assert_results :tests => @expect_tests, :failures => @expect_failures, :errors => @expect_errors + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/test/functional/direct_mock_usage_test.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/test/functional/direct_mock_usage_test.rb new file mode 100644 index 0000000..dcf2b2a --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/test/functional/direct_mock_usage_test.rb @@ -0,0 +1,396 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock' + +class DirectMockUsageTest < Test::Unit::TestCase + + def setup + @bird = Mock.new('bird') + end + + def teardown + end + + # + # TESTS + # + + it "raises VerifyError if expected method not called" do + @bird.expects.flap_flap + + err = assert_raise VerifyError do + @bird._verify + end + assert_match(/unmet expectations/i, err.message) + end + + should "not raise when expected calls are made in order" do + @bird.expects.flap_flap + @bird.expects.bang + @bird.expects.plop + + @bird.flap_flap + @bird.bang + @bird.plop + + @bird._verify + end + + it "raises ExpectationError when unexpected method are called" do + @bird.expects.flap_flap + + err = assert_raise ExpectationError do + @bird.shoot + end + assert_match(/wrong method/i, err.message) + end + + it "raises ExpectationError on bad arguments" do + @bird.expects.flap_flap(:swoosh) + + err = assert_raise ExpectationError do + @bird.flap_flap(:rip) + end + assert_match(/wrong arguments/i, err.message) + end + + it "raises VerifyError when not all expected methods are called" do + @bird.expects.flap_flap + @bird.expects.bang + @bird.expects.plop + + @bird.flap_flap + + err = assert_raise VerifyError do + @bird._verify + end + assert_match(/unmet expectations/i, err.message) + end + + it "raises ExpectationError when calls are made out of order" do + @bird.expects.flap_flap + @bird.expects.bang + @bird.expects.plop + + @bird.flap_flap + err = assert_raise ExpectationError do + @bird.plop + end + assert_match(/wrong method/i, err.message) + end + + it "returns the configured value" do + @bird.expects.plop.returns(':P') + assert_equal ':P', @bird.plop + @bird._verify + + @bird.expects.plop.returns(':x') + assert_equal ':x', @bird.plop + @bird._verify + end + + it "returns nil when no return is specified" do + @bird.expects.plop + assert_nil @bird.plop + @bird._verify + end + + it "raises the configured exception" do + err = RuntimeError.new('shaq') + @bird.expects.plop.raises(err) + actual_err = assert_raise RuntimeError do + @bird.plop + end + assert_same err, actual_err, 'should be the same error' + @bird._verify + end + + it "raises a RuntimeError when told to 'raise' a string" do + @bird.expects.plop.raises('shaq') + err = assert_raise RuntimeError do + @bird.plop + end + assert_match(/shaq/i, err.message) + @bird._verify + end + + it "raises a default RuntimeError" do + @bird.expects.plop.raises + err = assert_raise RuntimeError do + @bird.plop + end + assert_match(/error/i, err.message) + @bird._verify + end + + it "is quiet when correct arguments given" do + thing = Object.new + @bird.expects.plop(:big,'one',thing) + @bird.plop(:big,'one',thing) + @bird._verify + end + + it "raises ExpectationError when wrong number of arguments specified" do + thing = Object.new + @bird.expects.plop(:big,'one',thing) + err = assert_raise ExpectationError do + # more + @bird.plop(:big,'one',thing,:other) + end + assert_match(/wrong arguments/i, err.message) + @bird._verify + + @bird.expects.plop(:big,'one',thing) + err = assert_raise ExpectationError do + # less + @bird.plop(:big,'one') + end + assert_match(/wrong arguments/i, err.message) + @bird._verify + + @bird.expects.plop + err = assert_raise ExpectationError do + # less + @bird.plop(:big) + end + assert_match(/wrong arguments/i, err.message) + @bird._verify + end + + it "raises ExpectationError when arguments don't match" do + thing = Object.new + @bird.expects.plop(:big,'one',thing) + err = assert_raise ExpectationError do + @bird.plop(:big,'two',thing,:other) + end + assert_match(/wrong arguments/i, err.message) + @bird._verify + end + + it "can use a block for custom reactions" do + mitt = nil + @bird.expects.plop { mitt = :ball } + assert_nil mitt + @bird.plop + assert_equal :ball, mitt, 'didnt catch the ball' + @bird._verify + + @bird.expects.plop { raise 'ball' } + err = assert_raise RuntimeError do + @bird.plop + end + assert_match(/ball/i, err.message) + @bird._verify + end + + it "passes mock-call arguments to the expectation block" do + ball = nil + mitt = nil + @bird.expects.plop {|arg1,arg2| + ball = arg1 + mitt = arg2 + } + assert_nil ball + assert_nil mitt + @bird.plop(:ball,:mitt) + assert_equal :ball, ball + assert_equal :mitt, mitt + @bird._verify + end + + it "validates arguments if specified in addition to a block" do + ball = nil + mitt = nil + @bird.expects.plop(:ball,:mitt) {|arg1,arg2| + ball = arg1 + mitt = arg2 + } + assert_nil ball + assert_nil mitt + @bird.plop(:ball,:mitt) + assert_equal :ball, ball + assert_equal :mitt, mitt + @bird._verify + + ball = nil + mitt = nil + @bird.expects.plop(:bad,:stupid) {|arg1,arg2| + ball = arg1 + mitt = arg2 + } + assert_nil ball + assert_nil mitt + err = assert_raise ExpectationError do + @bird.plop(:ball,:mitt) + end + assert_match(/wrong arguments/i, err.message) + assert_nil ball + assert_nil mitt + @bird._verify + + ball = nil + mitt = nil + @bird.expects.plop(:ball,:mitt) {|arg1,arg2| + ball = arg1 + mitt = arg2 + } + assert_nil ball + assert_nil mitt + err = assert_raise ExpectationError do + @bird.plop(:ball) + end + assert_match(/wrong arguments/i, err.message) + assert_nil ball + assert_nil mitt + @bird._verify + end + + it "passes runtime blocks to the expectation block as the final argument" do + runtime_block_called = false + got_arg = nil + + # Eg, bird expects someone to subscribe to :tweet using the 'when' method + @bird.expects.when(:tweet) { |arg1, block| + got_arg = arg1 + block.call + } + + @bird.when(:tweet) do + runtime_block_called = true + end + + assert_equal :tweet, got_arg, "Wrong arg" + assert runtime_block_called, "The runtime block should have been invoked by the user block" + + @bird.expects.when(:warnk) { |e,blk| } + + err = assert_raise ExpectationError do + @bird.when(:honk) { } + end + assert_match(/wrong arguments/i, err.message) + + @bird._verify + end + + it "passes the runtime block to the expectation block as sole argument if no other args come into play" do + runtime_block_called = false + @bird.expects.subscribe { |block| block.call } + @bird.subscribe do + runtime_block_called = true + end + assert runtime_block_called, "The runtime block should have been invoked by the user block" + end + + it "provides nil as final argument if expectation block seems to want a block" do + invoked = false + @bird.expects.kablam(:scatter) { |shot,block| + assert_equal :scatter, shot, "Wrong shot" + assert_nil block, "The expectation block should get a nil block when user neglects to pass one" + invoked = true + } + @bird.kablam :scatter + assert invoked, "Expectation block not invoked" + + @bird._verify + end + + it "can set explicit return after an expectation block" do + got = nil + @bird.expects.kablam(:scatter) { |shot| + got = shot + }.returns(:death) + + val = @bird.kablam :scatter + assert_equal :death, val, "Wrong return value" + assert_equal :scatter, got, "Wrong argument" + @bird._verify + end + + it "can raise after an expectation block" do + got = nil + @bird.expects.kablam(:scatter) do |shot| + got = shot + end.raises "hell" + + err = assert_raise RuntimeError do + @bird.kablam :scatter + end + assert_match(/hell/i, err.message) + + @bird._verify + end + + it "stores the semantic value of the expectation block after it executes" do + expectation = @bird.expects.kablam(:slug) { |shot| + "The shot was #{shot}" + } + + assert_not_nil expectation, "Expectation nil" + assert_nil expectation.block_value, "Block value should start out nil" + + ret_val = @bird.kablam :slug + + assert_equal "The shot was slug", expectation.block_value + assert_equal "The shot was slug", ret_val, "Block value should also be used for return" + + @bird._verify + end + + + it "uses the value of the expectation block as the default return value" do + @bird.expects.kablam(:scatter) { |shot| + "The shot was #{shot}" + } + val = @bird.kablam :scatter + assert_equal "The shot was scatter", val, "Wrong return value" + @bird._verify + end + + it "returns the Expectation even if 'returns' is used" do + expectation = @bird.expects.kablam(:slug) { |shot| + "The shot was #{shot}" + }.returns :hosed + + assert_not_nil expectation, "Expectation nil" + assert_nil expectation.block_value, "Block value should start out nil" + + ret_val = @bird.kablam :slug + + assert_equal "The shot was slug", expectation.block_value + assert_equal :hosed, ret_val, "Block value should also be used for return" + + @bird._verify + end + + it "returns the Expectation even if 'raises' is used" do + expectation = @bird.expects.kablam(:slug) { |shot| + "The shot was #{shot}" + }.raises "aiee!" + + assert_not_nil expectation, "Expectation nil" + assert_nil expectation.block_value, "Block value should start out nil" + + err = assert_raise RuntimeError do + @bird.kablam :slug + end + assert_match(/aiee!/i, err.message) + assert_equal "The shot was slug", expectation.block_value + @bird._verify + end + + + it "supports assignment-style methods" do + @bird.expects.size = "large" + @bird.size = "large" + @bird._verify + end + + it "supports assignments and raising (using explicit-method syntax)" do + @bird.expects('size=','large').raises "boom" + + err = assert_raise RuntimeError do + @bird.size = "large" + end + assert_match(/boom/i, err.message) + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/test/functional/hardmock_test.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/test/functional/hardmock_test.rb new file mode 100644 index 0000000..159d369 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/test/functional/hardmock_test.rb @@ -0,0 +1,434 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock' +require 'assert_error' + +class HardmockTest < Test::Unit::TestCase + + # + # TESTS + # + + it "conveniently creates mocks using create_mock and create_mocks" do + + h = create_mock :donkey + assert_equal [ :donkey ], h.keys + + assert_mock_exists :donkey + assert_same @donkey, h[:donkey] + + assert_equal [ :donkey ], @all_mocks.keys, "Wrong keyset for @all_mocks" + + h2 = create_mocks :cat, 'dog' # symbol/string indifference at this level + assert_equal [:cat,:dog].to_set, h2.keys.to_set, "Wrong keyset for second hash" + assert_equal [:cat,:dog,:donkey].to_set, @all_mocks.keys.to_set, "@all_mocks wrong" + + assert_mock_exists :cat + assert_same @cat, h2[:cat] + assert_mock_exists :dog + assert_same @dog, h2[:dog] + + assert_mock_exists :donkey + end + + it "provides literal 'expects' syntax" do + assert_nil @order, "Should be no @order yet" + create_mock :order + assert_not_nil @order, "@order should be built" + + # Setup an expectation + @order.expects.update_stuff :key1 => 'val1', :key2 => 'val2' + + # Use the mock + @order.update_stuff :key1 => 'val1', :key2 => 'val2' + + # Verify + verify_mocks + + # See that it's ok to do it again + verify_mocks + end + + it "supports 'with' for specifying argument expectations" do + create_mocks :car + @car.expects(:fill).with('gas','booze') + @car.fill('gas', 'booze') + verify_mocks + end + + it "supports several mocks at once" do + create_mocks :order_builder, :order, :customer + + @order_builder.expects.create_new_order.returns @order + @customer.expects.account_number.returns(1234) + @order.expects.account_no = 1234 + @order.expects.save! + + # Run "the code" + o = @order_builder.create_new_order + o.account_no = @customer.account_number + o.save! + + verify_mocks + end + + it "enforces inter-mock call ordering" do + create_mocks :order_builder, :order, :customer + + @order_builder.expects.create_new_order.returns @order + @customer.expects.account_number.returns(1234) + @order.expects.account_no = 1234 + @order.expects.save! + + # Run "the code" + o = @order_builder.create_new_order + err = assert_raise ExpectationError do + o.save! + end + assert_match(/wrong object/i, err.message) + assert_match(/order.save!/i, err.message) + assert_match(/customer.account_number/i, err.message) + + assert_error VerifyError, /unmet expectations/i do + verify_mocks + end + end + + class UserPresenter + def initialize(args) + view = args[:view] + model = args[:model] + model.when :data_changes do + view.user_name = model.user_name + end + view.when :user_edited do + model.user_name = view.user_name + end + end + end + + it "makes MVP testing simple" do + mox = create_mocks :model, :view + + data_change = @model.expects.when(:data_changes) { |evt,block| block } + user_edit = @view.expects.when(:user_edited) { |evt,block| block } + + UserPresenter.new mox + + # Expect user name transfer from model to view + @model.expects.user_name.returns 'Da Croz' + @view.expects.user_name = 'Da Croz' + # Trigger data change event in model + data_change.block_value.call + + # Expect user name transfer from view to model + @view.expects.user_name.returns '6:8' + @model.expects.user_name = '6:8' + # Trigger edit event in view + user_edit.block_value.call + + verify_mocks + end + + it "continues to function after verify, if verification error is controlled" do + mox = create_mocks :model, :view + data_change = @model.expects.when(:data_changes) { |evt,block| block } + user_edit = @view.expects.when(:user_edited) { |evt,block| block } + UserPresenter.new mox + + # Expect user name transfer from model to view + @model.expects.user_name.returns 'Da Croz' + @view.expects.user_name = 'Da Croz' + + assert_error ExpectationError, /model.monkey_wrench/i do + @model.monkey_wrench + end + + # This should raise because of unmet expectations + assert_error VerifyError, /unmet expectations/i, /user_name/i do + verify_mocks + end + + # See that the non-forced verification remains quiet + assert_nothing_raised VerifyError do + verify_mocks(false) + end + + @model.expects.never_gonna_happen + + assert_error VerifyError, /unmet expectations/i, /never_gonna_happen/i do + verify_mocks + end + end + + class UserPresenterBroken + def initialize(args) + view = args[:view] + model = args[:model] + model.when :data_changes do + view.user_name = model.user_name + end + # no view stuff, will break appropriately + end + end + + it "flunks for typical Presenter constructor wiring failure" do + mox = create_mocks :model, :view + + data_change = @model.expects.when(:data_changes) { |evt,block| block } + user_edit = @view.expects.when(:user_edited) { |evt,block| block } + + UserPresenterBroken.new mox + + err = assert_raise VerifyError do + verify_mocks + end + assert_match(/unmet expectations/i, err.message) + assert_match(/view.when\(:user_edited\)/i, err.message) + + end + + it "provides convenient event-subscription trap syntax for MVP testing" do + mox = create_mocks :model, :view + + data_change = @model.trap.when(:data_changes) + user_edit = @view.trap.when(:user_edited) + + UserPresenter.new mox + + # Expect user name transfer from model to view + @model.expects.user_name.returns 'Da Croz' + @view.expects.user_name = 'Da Croz' + # Trigger data change event in model + data_change.trigger + + # Expect user name transfer from view to model + @view.expects.user_name.returns '6:8' + @model.expects.user_name = '6:8' + # Trigger edit event in view + user_edit.trigger + + verify_mocks + end + + it "raises if you try to pass an expectation block to 'trap'" do + create_mock :model + assert_error Hardmock::ExpectationError, /blocks/i, /trap/i do + @model.trap.when(:some_event) do raise "huh?" end + end + end + + class Grinder + def initialize(objects) + @chute = objects[:chute] + @bucket = objects[:bucket] + @blade = objects[:blade] + end + + def grind(slot) + @chute.each_bean(slot) do |bean| + @bucket << @blade.chop(bean) + end + end + end + + it "lets you write clear iteration-oriented expectations" do + grinder = Grinder.new create_mocks(:blade, :chute, :bucket) + + # Style 1: assertions on method args is done explicitly in block + @chute.expects.each_bean { |slot,block| + assert_equal :side_slot, slot, "Wrong slot" + block.call :bean1 + block.call :bean2 + } + + @blade.expects.chop(:bean1).returns(:grounds1) + @bucket.expects('<<', :grounds1) + + @blade.expects.chop(:bean2).returns(:grounds2) + @bucket.expects('<<', :grounds2) + + # Run "the code" + grinder.grind(:side_slot) + + verify_mocks + + # Style 2: assertions on method arguments done implicitly in the expectation code + @chute.expects.each_bean(:main_slot) { |slot,block| + block.call :bean3 + } + @blade.expects.chop(:bean3).returns(:grounds3) + @bucket.expects('<<', :grounds3) + grinder.grind :main_slot + verify_mocks + end + + it "further supports iteration testing using 'yield'" do + grinder = Grinder.new create_mocks(:blade, :chute, :bucket) + + @chute.expects.each_bean(:side_slot).yields :bean1, :bean2 + + @blade.expects.chop(:bean1).returns(:grounds1) + @bucket.expects('<<', :grounds1) + + @blade.expects.chop(:bean2).returns(:grounds2) + @bucket.expects('<<', :grounds2) + + grinder.grind :side_slot + + verify_mocks + end + + class HurtLocker + attr_reader :caught + def initialize(opts) + @locker = opts[:locker] + @store = opts[:store] + end + + def do_the_thing(area,data) + @locker.with_lock(area) do + @store.eat(data) + end + rescue => oops + @caught = oops + end + end + + it "makes mutex-style locking scenarios easy to test" do + hurt = HurtLocker.new create_mocks(:locker, :store) + + @locker.expects.with_lock(:main).yields + @store.expects.eat("some info") + + hurt.do_the_thing(:main, "some info") + + verify_mocks + end + + it "makes it easy to simulate error in mutex-style locking scenarios" do + hurt = HurtLocker.new create_mocks(:locker, :store) + err = StandardError.new('fmshooop') + @locker.expects.with_lock(:main).yields + @store.expects.eat("some info").raises(err) + + hurt.do_the_thing(:main, "some info") + + assert_same err, hurt.caught, "Expected that error to be handled internally" + verify_mocks + end + + it "actually returns 'false' instead of nil when mocking boolean return values" do + create_mock :car + @car.expects.ignition_on?.returns(true) + assert_equal true, @car.ignition_on?, "Should be true" + @car.expects.ignition_on?.returns(false) + assert_equal false, @car.ignition_on?, "Should be false" + end + + it "can mock most methods inherited from object using literal syntax" do + target_methods = %w|id clone display dup eql? ==| + create_mock :foo + target_methods.each do |m| + eval %{@foo.expects(m, "some stuff")} + eval %{@foo.#{m} "some stuff"} + end + end + + it "provides 'expect' as an alias for 'expects'" do + create_mock :foo + @foo.expect.boomboom + @foo.boomboom + verify_mocks + end + + it "provides 'should_receive' as an alias for 'expects'" do + create_mock :foo + @foo.should_receive.boomboom + @foo.boomboom + verify_mocks + end + + it "provides 'and_return' as an alias for 'returns'" do + create_mock :foo + @foo.expects(:boomboom).and_return :brick + assert_equal :brick, @foo.boomboom + verify_mocks + end + + it "does not interfere with a core subset of Object methods" do + create_mock :foo + @foo.method(:inspect) + @foo.inspect + @foo.to_s + @foo.instance_variables + @foo.instance_eval("") + verify_mocks + end + + it "can raise errors from within an expectation block" do + create_mock :cat + @cat.expects.meow do |arg| + assert_equal "mix", arg + raise 'HAIRBALL' + end + assert_error RuntimeError, 'HAIRBALL' do + @cat.meow("mix") + end + end + + it "can raise errors AFTER an expectation block" do + create_mock :cat + @cat.expects.meow do |arg| + assert_equal "mix", arg + end.raises('HAIRBALL') + assert_error RuntimeError, 'HAIRBALL' do + @cat.meow("mix") + end + end + + it "raises an immediate error if a mock is created with a nil name (common mistake: create_mock @cat)" do + # I make this mistake all the time: Typing in an instance var name instead of a symbol in create_mocks. + # When you do that, you're effectively passing nil(s) in as mock names. + assert_error ArgumentError, /'nil' is not a valid name for a mock/ do + create_mocks @apples, @oranges + end + end + + it "overrides 'inspect' to make nice output" do + create_mock :hay_bailer + assert_equal "", @hay_bailer.inspect, "Wrong output from 'inspect'" + end + + it "raises if prepare_hardmock_control is invoked after create_mocks, or more than once" do + create_mock :hi_there + create_mocks :another, :one + assert_error RuntimeError, /already setup/ do + prepare_hardmock_control + end + end + + should "support alias verify_hardmocks" do + create_mock :tree + @tree.expects(:grow) + assert_error VerifyError, /unmet/i do + verify_hardmocks + end + end + + # + # HELPERS + # + + def assert_mock_exists(name) + assert_not_nil @all_mocks, "@all_mocks not here yet" + mo = @all_mocks[name] + assert_not_nil mo, "Mock '#{name}' not in @all_mocks" + assert_kind_of Mock, mo, "Wrong type of object, wanted a Mock" + assert_equal name.to_s, mo._name, "Mock '#{name}' had wrong name" + ivar = self.instance_variable_get("@#{name}") + assert_not_nil ivar, "Mock '#{name}' not set as ivar" + assert_same mo, ivar, "Mock '#{name}' ivar not same as instance in @all_mocks" + assert_same @main_mock_control, mo._control, "Mock '#{name}' doesn't share the main mock control" + end +end + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/test/functional/stubbing_test.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/test/functional/stubbing_test.rb new file mode 100644 index 0000000..f07a670 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/test/functional/stubbing_test.rb @@ -0,0 +1,479 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock' +require 'assert_error' + +class StubbingTest < Test::Unit::TestCase + + # + # TESTS + # + + it "stubs a class method (and un-stubs after reset_stubs)" do + assert_equal "stones and gravel", Concrete.pour + assert_equal "glug glug", Jug.pour + + Concrete.stubs!(:pour).returns("dust and plaster") + + 3.times do + assert_equal "dust and plaster", Concrete.pour + end + + assert_equal "glug glug", Jug.pour, "Jug's 'pour' method broken" + assert_equal "stones and gravel", Concrete._hardmock_original_pour, "Original 'pour' method not aliased" + + assert_equal "For roads", Concrete.describe, "'describe' method broken" + + reset_stubs + + assert_equal "stones and gravel", Concrete.pour, "'pour' method not restored" + assert_equal "For roads", Concrete.describe, "'describe' method broken after verify" + + end + + it "stubs several class methods" do + Concrete.stubs!(:pour).returns("sludge") + Concrete.stubs!(:describe).returns("awful") + Jug.stubs!(:pour).returns("milk") + + assert_equal "sludge", Concrete.pour + assert_equal "awful", Concrete.describe + assert_equal "milk", Jug.pour + + reset_stubs + + assert_equal "stones and gravel", Concrete.pour + assert_equal "For roads", Concrete.describe + assert_equal "glug glug", Jug.pour + end + + it "stubs instance methods" do + slab = Concrete.new + assert_equal "bonk", slab.hit + + slab.stubs!(:hit).returns("slap") + assert_equal "slap", slab.hit, "'hit' not stubbed" + + reset_stubs + + assert_equal "bonk", slab.hit, "'hit' not restored" + end + + it "stubs instance methods without breaking class methods or other instances" do + slab = Concrete.new + scrape = Concrete.new + assert_equal "an instance", slab.describe + assert_equal "an instance", scrape.describe + assert_equal "For roads", Concrete.describe + + slab.stubs!(:describe).returns("new instance describe") + assert_equal "new instance describe", slab.describe, "'describe' on instance not stubbed" + assert_equal "an instance", scrape.describe, "'describe' on 'scrape' instance broken" + assert_equal "For roads", Concrete.describe, "'describe' class method broken" + + reset_stubs + + assert_equal "an instance", slab.describe, "'describe' instance method not restored" + assert_equal "an instance", scrape.describe, "'describe' on 'scrape' instance broken after restore" + assert_equal "For roads", Concrete.describe, "'describe' class method broken after restore" + end + + should "allow stubbing of nonexistant class methods" do + Concrete.stubs!(:funky).returns('juice') + assert_equal 'juice', Concrete.funky + end + + should "allow stubbing of nonexistant instance methods" do + chunk = Concrete.new + chunk.stubs!(:shark).returns('bite') + assert_equal 'bite', chunk.shark + end + + should "allow re-stubbing" do + Concrete.stubs!(:pour).returns("one") + assert_equal "one", Concrete.pour + + Concrete.stubs!(:pour).raises("hell") + assert_error RuntimeError, /hell/ do + Concrete.pour + end + + Concrete.stubs!(:pour).returns("two") + assert_equal "two", Concrete.pour + + reset_stubs + + assert_equal "stones and gravel", Concrete.pour + end + + it "does nothing with a runtime block when simply stubbing" do + slab = Concrete.new + slab.stubs!(:hit) do |nothing| + raise "BOOOMM!" + end + slab.hit + reset_stubs + end + + it "can raise errors from a stubbed method" do + Concrete.stubs!(:pour).raises(StandardError.new("no!")) + assert_error StandardError, /no!/ do + Concrete.pour + end + end + + it "provides string syntax for convenient raising of RuntimeErrors" do + Concrete.stubs!(:pour).raises("never!") + assert_error RuntimeError, /never!/ do + Concrete.pour + end + end + + + # + # Per-method mocking on classes or instances + # + + it "mocks specific methods on existing classes, and returns the class method to normal after verification" do + + assert_equal "stones and gravel", Concrete.pour, "Concrete.pour is already messed up" + + Concrete.expects!(:pour).returns("ALIGATORS") + assert_equal "ALIGATORS", Concrete.pour + + verify_mocks + assert_equal "stones and gravel", Concrete.pour, "Concrete.pour not restored" + end + + it "flunks if expected class method is not invoked" do + + Concrete.expects!(:pour).returns("ALIGATORS") + assert_error(Hardmock::VerifyError, /Concrete.pour/, /unmet expectations/i) do + verify_mocks + end + clear_expectations + end + + it "supports all normal mock functionality for class methods" do + + Concrete.expects!(:pour, "two tons").returns("mice") + Concrete.expects!(:pour, "three tons").returns("cats") + Concrete.expects!(:pour, "four tons").raises("Can't do it") + Concrete.expects!(:pour) do |some, args| + "==#{some}+#{args}==" + end + + assert_equal "mice", Concrete.pour("two tons") + assert_equal "cats", Concrete.pour("three tons") + assert_error(RuntimeError, /Can't do it/) do + Concrete.pour("four tons") + end + assert_equal "==first+second==", Concrete.pour("first","second") + end + + + it "enforces inter-mock ordering when mocking class methods" do + create_mocks :truck, :foreman + + @truck.expects.backup + Concrete.expects!(:pour, "something") + @foreman.expects.shout + + @truck.backup + assert_error Hardmock::ExpectationError, /wrong/i, /expected call/i, /Concrete.pour/ do + @foreman.shout + end + assert_error Hardmock::VerifyError, /unmet expectations/i, /foreman.shout/ do + verify_mocks + end + clear_expectations + end + + should "allow mocking non-existant class methods" do + Concrete.expects!(:something).returns("else") + assert_equal "else", Concrete.something + end + + it "mocks specific methods on existing instances, then restore them after verify" do + + slab = Concrete.new + assert_equal "bonk", slab.hit + + slab.expects!(:hit).returns("slap") + assert_equal "slap", slab.hit, "'hit' not stubbed" + + verify_mocks + assert_equal "bonk", slab.hit, "'hit' not restored" + end + + it "flunks if expected instance method is not invoked" do + + slab = Concrete.new + slab.expects!(:hit) + + assert_error Hardmock::VerifyError, /unmet expectations/i, /Concrete.hit/ do + verify_mocks + end + clear_expectations + end + + it "supports all normal mock functionality for instance methods" do + + slab = Concrete.new + + slab.expects!(:hit, "soft").returns("hey") + slab.expects!(:hit, "hard").returns("OOF") + slab.expects!(:hit).raises("stoppit") + slab.expects!(:hit) do |some, args| + "==#{some}+#{args}==" + end + + assert_equal "hey", slab.hit("soft") + assert_equal "OOF", slab.hit("hard") + assert_error(RuntimeError, /stoppit/) do + slab.hit + end + assert_equal "==first+second==", slab.hit("first","second") + + end + + it "enforces inter-mock ordering when mocking instance methods" do + create_mocks :truck, :foreman + slab1 = Concrete.new + slab2 = Concrete.new + + @truck.expects.backup + slab1.expects!(:hit) + @foreman.expects.shout + slab2.expects!(:hit) + @foreman.expects.whatever + + @truck.backup + slab1.hit + @foreman.shout + assert_error Hardmock::ExpectationError, /wrong/i, /expected call/i, /Concrete.hit/ do + @foreman.whatever + end + assert_error Hardmock::VerifyError, /unmet expectations/i, /foreman.whatever/ do + verify_mocks + end + clear_expectations + end + + should "allow mocking non-existant instance methods" do + slab = Concrete.new + slab.expects!(:wholly).returns('happy') + assert_equal 'happy', slab.wholly + end + + should "support concrete expectations that deal with runtime blocks" do + + Concrete.expects!(:pour, "a lot") do |how_much, block| + assert_equal "a lot", how_much, "Wrong how_much arg" + assert_not_nil block, "nil runtime block" + assert_equal "the block value", block.call, "Wrong runtime block value" + end + + Concrete.pour("a lot") do + "the block value" + end + + end + + it "can stub methods on mock objects" do + create_mock :horse + @horse.stubs!(:speak).returns("silence") + @horse.stubs!(:hello).returns("nothing") + @horse.expects(:canter).returns("clip clop") + + assert_equal "silence", @horse.speak + assert_equal "clip clop", @horse.canter + assert_equal "silence", @horse.speak + assert_equal "silence", @horse.speak + assert_equal "nothing", @horse.hello + assert_equal "nothing", @horse.hello + + verify_mocks + reset_stubs + end + + it "can stub the new method and return values" do + Concrete.stubs!(:new).returns("this value") + assert_equal "this value", Concrete.new, "did not properly stub new class method" + reset_stubs + end + + it "can mock the new method and return values" do + Concrete.expects!(:new).with("foo").returns("hello") + Concrete.expects!(:new).with("bar").returns("world") + + assert_equal "hello", Concrete.new("foo"), "did not properly mock out new class method" + assert_equal "world", Concrete.new("bar"), "did not properly mock out new class method" + + verify_mocks + reset_stubs + end + + it "can mock several different class methods at once" do + sim_code = lambda do |input| + record = Multitool.find_record(input) + report = Multitool.generate_report(record) + Multitool.format_output(report) + end + + @identifier = "the id" + @record = "the record" + @report = "the report" + @output = "the output" + + Multitool.expects!(:find_record).with(@identifier).returns(@record) + Multitool.expects!(:generate_report).with(@record).returns(@report) + Multitool.expects!(:format_output).with(@report).returns(@output) + + result = sim_code.call(@identifier) + assert_equal @output, result, "Wrong output" + end + + it "can handle a mix of different and repeat class method mock calls" do + prep = lambda { + Multitool.expects!(:find_record).with("A").returns("1") + Multitool.expects!(:generate_report).with("1") + Multitool.expects!(:find_record).with("B").returns("2") + Multitool.expects!(:generate_report).with("2") + } + + prep[] + Multitool.generate_report(Multitool.find_record("A")) + Multitool.generate_report(Multitool.find_record("B")) + + prep[] + Multitool.generate_report(Multitool.find_record("A")) + assert_error Hardmock::ExpectationError, /Wrong arguments/, /find_record\("B"\)/, /find_record\("C"\)/ do + Multitool.generate_report(Multitool.find_record("C")) + end + clear_expectations + end + + it "can mock several concrete instance methods at once" do + inst = OtherMultitool.new + sim_code = lambda do |input| + record = inst.find_record(input) + report = inst.generate_report(record) + inst.format_output(report) + end + + @identifier = "the id" + @record = "the record" + @report = "the report" + @output = "the output" + + inst.expects!(:find_record).with(@identifier).returns(@record) + inst.expects!(:generate_report).with(@record).returns(@report) + inst.expects!(:format_output).with(@report).returns(@output) + + result = sim_code.call(@identifier) + assert_equal @output, result, "Wrong output" + end + + it "verifies all concrete expects! from several different expectations" do + Multitool.expects!(:find_record) + Multitool.expects!(:generate_report) + Multitool.expects!(:format_output) + + Multitool.find_record + Multitool.generate_report + + assert_error Hardmock::VerifyError, /unmet expectations/i, /format_output/i do + verify_mocks + end + end + + it "will not allow expects! to be used on a mock object" do + create_mock :cow + assert_error Hardmock::StubbingError, /expects!/, /mock/i, /something/ do + @cow.expects!(:something) + end + end + + it "does not allow stubbing on nil objects" do + [ nil, @this_is_nil ].each do |nil_obj| + assert_error Hardmock::StubbingError, /cannot/i, /nil/i, /intentionally/ do + nil_obj.stubs!(:wont_work) + end + end + end + + it "does not allow concrete method mocking on nil objects" do + [ nil, @this_is_nil ].each do |nil_obj| + assert_error Hardmock::StubbingError, /cannot/i, /nil/i, /intentionally/ do + nil_obj.expects!(:wont_work) + end + end + end + + it "provides an alternate method for stubbing on nil objects" do + @this_is_nil.intentionally_stubs!(:bogus).returns('output') + assert_equal 'output', @this_is_nil.bogus + end + + it "provides an alternate method for mocking concreate methods on nil objects" do + @this_is_nil.intentionally_expects!(:bogus).returns('output') + assert_error Hardmock::VerifyError, /unmet expectations/i, /NilClass.bogus/ do + verify_mocks + end + end + + # + # HELPERS + # + + class Concrete + def initialize; end + def self.pour + "stones and gravel" + end + + def self.describe + "For roads" + end + + def hit + "bonk" + end + + def describe + "an instance" + end + end + + class Jug + def self.pour + "glug glug" + end + end + + class Multitool + def self.find_record(*a) + raise "The real Multitool.find_record was called with #{a.inspect}" + end + def self.generate_report(*a) + raise "The real Multitool.generate_report was called with #{a.inspect}" + end + def self.format_output(*a) + raise "The real Multitool.format_output was called with #{a.inspect}" + end + end + + class OtherMultitool + def find_record(*a) + raise "The real OtherMultitool#find_record was called with #{a.inspect}" + end + def generate_report(*a) + raise "The real OtherMultitool#generate_report was called with #{a.inspect}" + end + def format_output(*a) + raise "The real OtherMultitool#format_output was called with #{a.inspect}" + end + end + +end + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/test/test_helper.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/test/test_helper.rb new file mode 100644 index 0000000..af159a4 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/test/test_helper.rb @@ -0,0 +1,43 @@ +here = File.expand_path(File.dirname(__FILE__)) +$: << here + +require "#{here}/../config/environment" +require 'test/unit' +require 'fileutils' +require 'logger' +require 'find' +require 'yaml' +require 'set' +require 'ostruct' + +class Test::Unit::TestCase + include FileUtils + + def poll(time_limit) + (time_limit * 10).to_i.times do + return true if yield + sleep 0.1 + end + return false + end + + def self.it(str, &block) + make_test_case "it", str, &block + end + + def self.should(str, &block) + make_test_case "should", str, &block + end + + def self.make_test_case(prefix, str, &block) + tname = self.name.sub(/Test$/,'') + if block + define_method "test #{prefix} #{str}" do + instance_eval &block + end + else + puts ">>> UNIMPLEMENTED CASE: #{tname}: #{str}" + end + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/test/unit/expectation_builder_test.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/test/unit/expectation_builder_test.rb new file mode 100644 index 0000000..f689f98 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/test/unit/expectation_builder_test.rb @@ -0,0 +1,19 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/expectation_builder' + +class ExpectationBuilderTest < Test::Unit::TestCase + include Hardmock + + def test_build_expectation + builder = ExpectationBuilder.new + + ex = builder.build_expectation( :stuff => 'inside' ) + assert_not_nil ex, "Didn't build an expectation" + assert_kind_of Expectation, ex, "Wrong type!" + + # Shhhh... fragile, yes, whatever. The functional tests do the + # real testing of this anyway + assert_equal({:stuff => 'inside'}, ex.instance_variable_get('@options'), "Hash not sent to SimpleExpectation constructor") + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/test/unit/expectation_test.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/test/unit/expectation_test.rb new file mode 100644 index 0000000..54bd204 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/test/unit/expectation_test.rb @@ -0,0 +1,372 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/expectation' +require 'hardmock/errors' +require 'assert_error' + +class ExpectationTest < Test::Unit::TestCase + include Hardmock + + def setup + @mock = TheMock.new + end + # + # HELPERS + # + + class TheMock + def _name; 'the_mock'; end + end + class OtherMock + def _name; 'other_mock'; end + end + + # + # TESTS + # + + def test_to_s + ex = Expectation.new( :mock => @mock, :method => 'a_func', :arguments => [1, "two", :three, { :four => 4 }] ) + assert_equal %|the_mock.a_func(1, "two", :three, {:four=>4})|, ex.to_s + end + + def test_apply_method_call + se = Expectation.new(:mock => @mock, :method => 'some_func', + :arguments => [1,'two',:three] ) + + # Try it good: + assert_nothing_raised ExpectationError do + se.apply_method_call( @mock, 'some_func', [1,'two',:three], nil ) + end + + # Bad func name: + err = assert_raise ExpectationError do + se.apply_method_call( @mock, 'wrong_func', [1,'two',:three], nil ) + end + assert_match(/wrong method/i, err.message) + assert_match(/wrong_func/i, err.message) + assert_match(/[1, "two", :three]/i, err.message) + assert_match(/some_func/i, err.message) + assert_match(/the_mock/i, err.message) + + # Wrong mock + err = assert_raise ExpectationError do + se.apply_method_call( OtherMock.new, 'some_func', [1,'two',:three], nil ) + end + assert_match(/[1, "two", :three]/i, err.message) + assert_match(/some_func/i, err.message) + assert_match(/the_mock/i, err.message) + assert_match(/other_mock/i, err.message) + + # Wrong args + err = assert_raise ExpectationError do + se.apply_method_call( @mock, 'some_func', [1,'two',:four], nil) + end + assert_match(/[1, "two", :three]/i, err.message) + assert_match(/[1, "two", :four]/i, err.message) + assert_match(/wrong arguments/i, err.message) + assert_match(/some_func/i, err.message) + end + + def test_apply_method_call_should_call_proc_when_given + # now with a proc + thinger = nil + the_proc = Proc.new { thinger = :shaq } + se = Expectation.new(:mock => @mock, :method => 'some_func', + :block => the_proc) + + # Try it good: + assert_nil thinger + assert_nothing_raised ExpectationError do + se.apply_method_call(@mock, 'some_func', [], nil) + end + assert_equal :shaq, thinger, 'wheres shaq??' + end + + def test_apply_method_call_passes_runtime_block_as_last_argument_to_expectation_block + + passed_block = nil + exp_block_called = false + exp_block = Proc.new { |blk| + exp_block_called = true + passed_block = blk + } + + se = Expectation.new(:mock => @mock, :method => 'some_func', :block => exp_block, + :arguments => []) + + set_flag = false + runtime_block = Proc.new { set_flag = true } + + assert_nil passed_block, "Passed block should be nil" + assert !set_flag, "set_flag should be off" + + # Go + se.apply_method_call( @mock, 'some_func', [], runtime_block) + + # Examine the passed block + assert exp_block_called, "Expectation block not called" + assert_not_nil passed_block, "Should have been passed a block" + assert !set_flag, "set_flag should still be off" + passed_block.call + assert set_flag, "set_flag should be on" + end + + def test_apply_method_call_fails_when_theres_no_expectation_block_to_handle_the_runtime_block + se = Expectation.new(:mock => @mock, :method => 'some_func', :arguments => []) + runtime_block = Proc.new { set_flag = true } + err = assert_raise ExpectationError do + se.apply_method_call( @mock, 'some_func', [], runtime_block) + end + assert_match(/unexpected block/i, err.message) + assert_match(/the_mock.some_func()/i, err.message) + end + + def test_returns + se = Expectation.new(:mock => @mock, :method => 'some_func', + :arguments => [1,'two',:three]) + + se.returns "A value" + + assert_equal "A value", se.apply_method_call(@mock, 'some_func', [1,'two',:three], nil) + end + + def test_apply_method_call_captures_block_value + the_proc = lambda { "in the block" } + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => [], :block => the_proc) + + assert_nil se.block_value, "Block value starts out nil" + + se.apply_method_call(@mock, 'do_it', [], nil) + + assert_equal "in the block", se.block_value, "Block value not captured" + end + + def test_trigger + # convenience method for block_value.call + target = false + inner_proc = lambda { target = true } + the_proc = lambda { inner_proc } + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => [], :block => the_proc) + + assert_nil se.block_value, "Block value starts out nil" + se.apply_method_call(@mock, 'do_it', [], nil) + assert_not_nil se.block_value, "Block value not set" + + assert !target, "Target should still be false" + se.trigger + assert target, "Target not true!" + end + + def test_trigger_with_arguments + # convenience method for block_value.call + target = nil + inner_proc = lambda { |one,two| target = [one,two] } + the_proc = lambda { inner_proc } + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => [], :block => the_proc) + + assert_nil se.block_value, "Block value starts out nil" + se.apply_method_call(@mock, 'do_it', [], nil) + assert_not_nil se.block_value, "Block value not set" + + assert_nil target, "target should still be nil" + se.trigger 'cat','dog' + assert_equal ['cat','dog'], target + end + + def test_trigger_nil_block_value + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => []) + + assert_nil se.block_value, "Block value starts out nil" + se.apply_method_call(@mock, 'do_it', [], nil) + assert_nil se.block_value, "Block value should still be nil" + + err = assert_raise ExpectationError do + se.trigger + end + assert_match(/do_it/i, err.message) + assert_match(/block value/i, err.message) + end + + def test_trigger_non_proc_block_value + the_block = lambda { "woops" } + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => [], :block => the_block) + + se.apply_method_call(@mock, 'do_it', [], nil) + assert_equal "woops", se.block_value + + err = assert_raise ExpectationError do + se.trigger + end + assert_match(/do_it/i, err.message) + assert_match(/trigger/i, err.message) + assert_match(/woops/i, err.message) + end + + + + def test_proc_used_for_return + the_proc = lambda { "in the block" } + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => [], :block => the_proc) + + assert_equal "in the block", se.apply_method_call(@mock, 'do_it', [], nil) + assert_equal "in the block", se.block_value, "Captured block value affected wrongly" + end + + def test_explicit_return_overrides_proc_return + the_proc = lambda { "in the block" } + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => [], :block => the_proc) + se.returns "the override" + assert_equal "the override", se.apply_method_call(@mock, 'do_it', [], nil) + assert_equal "in the block", se.block_value, "Captured block value affected wrongly" + end + + def test_yields + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] ) + se.yields :bean1, :bean2 + + things = [] + a_block = lambda { |thinger| things << thinger } + + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + assert_equal [:bean1,:bean2], things, "Wrong things" + end + + def test_yields_block_takes_no_arguments + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] ) + se.yields + + things = [] + a_block = lambda { things << 'OOF' } + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + assert_equal ['OOF'], things + end + + def test_yields_params_to_block_takes_no_arguments + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] ) + se.yields :wont_fit + + things = [] + a_block = lambda { things << 'WUP' } + + err = assert_raise ExpectationError do + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + end + assert_match(/wont_fit/i, err.message) + assert_match(/arity -1/i, err.message) + assert_equal [], things, "Wrong things" + end + + def test_yields_with_returns + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] , + :returns => 'the results') + + exp = se.yields :bean1, :bean2 + assert_same se, exp, "'yields' needs to return a reference to the expectation" + things = [] + a_block = lambda { |thinger| things << thinger } + returned = se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + assert_equal [:bean1,:bean2], things, "Wrong things" + assert_equal 'the results', returned, "Wrong return value" + end + + def test_yields_with_raises + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot], + :raises => RuntimeError.new("kerboom")) + + exp = se.yields :bean1, :bean2 + assert_same se, exp, "'yields' needs to return a reference to the expectation" + things = [] + a_block = lambda { |thinger| things << thinger } + err = assert_raise RuntimeError do + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + end + assert_match(/kerboom/i, err.message) + assert_equal [:bean1,:bean2], things, "Wrong things" + end + + def test_yields_and_inner_block_explodes + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot]) + + exp = se.yields :bean1, :bean2 + assert_same se, exp, "'yields' needs to return a reference to the expectation" + things = [] + a_block = lambda { |thinger| + things << thinger + raise "nasty" + } + err = assert_raise RuntimeError do + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + end + assert_match(/nasty/i, err.message) + assert_equal [:bean1], things, "Wrong things" + end + + def test_yields_with_several_arrays + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] ) + se.yields ['a','b'], ['c','d'] + + things = [] + a_block = lambda { |thinger| things << thinger } + + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + assert_equal [ ['a','b'], ['c','d'] ], things, "Wrong things" + end + + def test_yields_tuples + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] ) + se.yields ['a','b','c'], ['d','e','f'] + + things = [] + a_block = lambda { |left,mid,right| + things << { :left => left, :mid => mid, :right => right } + } + + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + assert_equal [ + {:left => 'a', :mid => 'b', :right => 'c' }, + {:left => 'd', :mid => 'e', :right => 'f' }, + ], things, "Wrong things" + end + + def test_yields_tuples_size_mismatch + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] ) + se.yields ['a','b','c'], ['d','e','f'] + + things = [] + a_block = lambda { |left,mid| + things << { :left => left, :mid => mid } + } + + err = assert_raise ExpectationError do + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + end + assert_match(/arity/i, err.message) + assert_match(/the_mock.each_bean/i, err.message) + assert_match(/"a", "b", "c"/i, err.message) + assert_equal [], things, "Wrong things" + end + + def test_yields_bad_block_arity + se = Expectation.new(:mock => @mock, :method => 'do_later', :arguments => [] ) + se.yields + + assert_error Hardmock::ExpectationError, /block/i, /expected/i, /no param/i, /got 2/i do + se.apply_method_call(@mock,'do_later',[],lambda { |doesnt,match| raise "Surprise!" } ) + end + end + + def test_that_arguments_can_be_added_to_expectation + expectation = Expectation.new(:mock => @mock, :method => "each_bean") + assert_same expectation, expectation.with("jello", "for", "cosby"), "should have returned the same expectation" + + err = assert_raise ExpectationError do + expectation.apply_method_call(@mock, 'each_bean', [], nil) + end + assert_match(/wrong arguments/i, err.message) + + assert_nothing_raised(ExpectationError) do + expectation.apply_method_call(@mock, 'each_bean', ["jello", "for", "cosby"], nil) + end + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/test/unit/expector_test.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/test/unit/expector_test.rb new file mode 100644 index 0000000..f420db2 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/test/unit/expector_test.rb @@ -0,0 +1,57 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/expector' + +class ExpectorTest < Test::Unit::TestCase + include Hardmock + + class MyControl + attr_reader :added + def add_expectation(expectation) + @added ||= [] + @added << expectation + end + end + + class ExpBuilder + attr_reader :options + def build_expectation(options) + @options = options + "dummy expectation" + end + end + + def try_it_with(method_name) + mock = Object.new + mock_control = MyControl.new + builder = ExpBuilder.new + + exp = Expector.new(mock, mock_control, builder) + output = exp.send(method_name,:with, 1, 'sauce') + + assert_same mock, builder.options[:mock] + assert_equal method_name, builder.options[:method].to_s + assert_equal [:with,1,'sauce'], builder.options[:arguments] + assert_nil builder.options[:block] + assert_equal [ "dummy expectation" ], mock_control.added, + "Wrong expectation added to control" + + assert_equal "dummy expectation", output, "Expectation should have been returned" + end + + # + # TESTS + # + def test_method_missing + try_it_with 'wonder_bread' + try_it_with 'whatever' + end + + def test_methods_that_wont_trigger_method_missing + mock = Object.new + mock_control = MyControl.new + builder = ExpBuilder.new + + exp = Expector.new(mock, mock_control, builder) + assert_equal mock, exp.instance_eval("@mock") + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/test/unit/method_cleanout_test.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/test/unit/method_cleanout_test.rb new file mode 100644 index 0000000..7aa6293 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/test/unit/method_cleanout_test.rb @@ -0,0 +1,36 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/method_cleanout' + +class MethodCleanoutTest < Test::Unit::TestCase + class Victim + OriginalMethods = instance_methods + include Hardmock::MethodCleanout + end + + def setup + @victim = Victim.new + end + + def test_should_remove_most_methods_from_a_class + expect_removed = Victim::OriginalMethods.reject { |m| + Hardmock::MethodCleanout::SACRED_METHODS.include?(m) + } + expect_removed.each do |m| + assert !@victim.respond_to?(m), "should not have method #{m}" + end + end + + def test_should_leave_the_sacred_methods_defined + Hardmock::MethodCleanout::SACRED_METHODS.each do |m| + next if m =~ /^hm_/ + assert @victim.respond_to?(m), "Sacred method '#{m}' was removed unexpectedly" + end + end + + def test_should_include_certain_important_methods_in_the_sacred_methods_list + %w|__id__ __send__ equal? object_id send nil? class kind_of? respond_to? inspect method to_s instance_variables instance_eval|.each do |m| + assert Hardmock::MethodCleanout::SACRED_METHODS.include?(m), "important method #{m} is not included in SACRED_METHODS" + end + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/test/unit/mock_control_test.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/test/unit/mock_control_test.rb new file mode 100644 index 0000000..3c52db6 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/test/unit/mock_control_test.rb @@ -0,0 +1,175 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/utils' +require 'hardmock/errors' +require 'hardmock/mock_control' + +class MockControlTest < Test::Unit::TestCase + include Hardmock + + def setup + @unmock = OpenStruct.new( :_name => 'fakemock' ) + + @control = MockControl.new + assert @control.happy?, "Control should start out happy" + end + + def teardown + end + + # + # HELPERS + # + + class MyExp + attr_reader :mock, :mname, :args, :block + def apply_method_call(mock, mname, args, block) + @mock = mock + @mname = mname + @args = args + @block = block + end + end + + class BoomExp < MyExp + def apply_method_call(mock, mname, args, block) + super + raise "BOOM" + end + end + + # + # TESTS + # + + def test_add_exepectation_and_apply_method_call + e1 = MyExp.new + + @control.add_expectation e1 + assert !@control.happy? + + @control.apply_method_call @unmock, 'some_func', [ 'the', :args ], nil + assert @control.happy? + + assert_same @unmock, e1.mock, "Wrong mock" + assert_equal 'some_func', e1.mname, "Wrong method" + assert_equal [ 'the', :args ], e1.args, "Wrong args" + + @control.verify + end + + def test_add_exepectation_and_apply_method_call_with_block + e1 = MyExp.new + + @control.add_expectation e1 + assert !@control.happy? + + runtime_block = Proc.new { "hello" } + @control.apply_method_call @unmock, 'some_func', [ 'the', :args ], runtime_block + assert @control.happy? + + assert_same @unmock, e1.mock, "Wrong mock" + assert_equal 'some_func', e1.mname, "Wrong method" + assert_equal [ 'the', :args ], e1.args, "Wrong args" + assert_equal "hello", e1.block.call, "Wrong block in expectation" + + @control.verify + end + + def test_add_expectation_then_verify + e1 = MyExp.new + + @control.add_expectation e1 + assert !@control.happy?, "Shoudn't be happy" + err = assert_raise VerifyError do + @control.verify + end + assert_match(/unmet expectations/i, err.message) + + @control.apply_method_call @unmock, 'some_func', [ 'the', :args ], nil + assert @control.happy? + + assert_same @unmock, e1.mock, "Wrong mock" + assert_equal 'some_func', e1.mname, "Wrong method" + assert_equal [ 'the', :args ], e1.args, "Wrong args" + + @control.verify + end + + def test_expectation_explosion + be1 = BoomExp.new + + @control.add_expectation be1 + + err = assert_raise RuntimeError do + @control.apply_method_call @unmock, 'a func', [:arg], nil + end + assert_match(/BOOM/i, err.message) + + assert_same @unmock, be1.mock + assert_equal 'a func', be1.mname + assert_equal [:arg], be1.args + end + + def test_disappointment_on_bad_verify + @control.add_expectation MyExp.new + assert !@control.happy?, "Shouldn't be happy" + assert !@control.disappointed?, "too early to be disappointed" + + # See verify fails + err = assert_raise VerifyError do + @control.verify + end + assert_match(/unmet expectations/i, err.message) + + assert !@control.happy?, "Still have unmet expectation" + assert @control.disappointed?, "We should be disappointed following that failure" + + @control.apply_method_call @unmock, 'something', [], nil + assert @control.happy?, "Should be happy" + assert @control.disappointed?, "We should be skeptical" + + @control.verify + + assert !@control.disappointed?, "Should be non-disappointed" + end + + def test_disappointment_from_surprise_calls + assert @control.happy?, "Should be happy" + assert !@control.disappointed?, "too early to be disappointed" + + # See verify fails + err = assert_raise ExpectationError do + @control.apply_method_call @unmock, "something", [], nil + end + assert_match(/surprise/i, err.message) + + assert @control.happy?, "Happiness is an empty list of expectations" + assert @control.disappointed?, "We should be disappointed following that failure" + + @control.verify + assert !@control.disappointed?, "Disappointment should be gone" + end + + def test_disappointment_from_bad_calls + be1 = BoomExp.new + assert !@control.disappointed?, "Shouldn't be disappointed" + @control.add_expectation be1 + assert !@control.disappointed?, "Shouldn't be disappointed" + + err = assert_raise RuntimeError do + @control.apply_method_call @unmock, 'a func', [:arg], nil + end + assert_match(/BOOM/i, err.message) + assert @control.disappointed?, "Should be disappointed" + + assert_same @unmock, be1.mock + assert_equal 'a func', be1.mname + assert_equal [:arg], be1.args + + assert @control.happy?, "Happiness is an empty list of expectations" + @control.verify + assert !@control.disappointed?, "Disappointment should be gone" + end + + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/test/unit/mock_test.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/test/unit/mock_test.rb new file mode 100644 index 0000000..2579bcc --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/test/unit/mock_test.rb @@ -0,0 +1,279 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/method_cleanout' +require 'hardmock/mock' +require 'hardmock/mock_control' +require 'hardmock/expectation_builder' +require 'hardmock/expector' +require 'hardmock/trapper' + +class MockTest < Test::Unit::TestCase + include Hardmock + + def test_build_with_control + mc1 = MockControl.new + mock = Mock.new('hi', mc1) + assert_equal 'hi', mock._name, "Wrong name" + assert_same mc1, mock._control, "Wrong contol" + end + + def test_basics + mock = Mock.new('a name') + assert_equal 'a name', mock._name, "Wrong name for mock" + assert_not_nil mock._control, "Nil control in mock" + end + + def test_expects + mock = Mock.new('order') + control = mock._control + assert control.happy?, "Mock should start out satisfied" + + mock.expects.absorb_something(:location, 'garbage') + assert !control.happy?, "mock control should be unhappy" + + # Do the call + mock.absorb_something(:location, 'garbage') + assert control.happy?, "mock control should be happy again" + + # Verify + assert_nothing_raised Exception do + mock._verify + end + end + + def test_expects_using_arguments_for_method_and_arguments + mock = Mock.new('order') + mock.expects(:absorb_something, :location, 'garbage') + mock.absorb_something(:location, 'garbage') + mock._verify + end + + def test_expects_using_arguments_for_method_and_arguments_with_block + mock = Mock.new('order') + mock.expects(:absorb_something, :location, 'garbage') { |a,b,block| + assert_equal :location, a, "Wrong 'a' argument" + assert_equal 'garbage', b, "Wrong 'b' argument" + assert_equal 'innards', block.call, "Wrong block" + } + mock.absorb_something(:location, 'garbage') do "innards" end + mock._verify + end + + def test_expects_using_string_method_name + mock = Mock.new('order') + mock.expects('absorb_something', :location, 'garbage') + mock.absorb_something(:location, 'garbage') + mock._verify + end + + + def test_expects_assignment + mock = Mock.new('order') + mock.expects.account_number = 1234 + + mock.account_number = 1234 + + mock._verify + end + + def test_expects_assigment_using_arguments_for_method_and_arguments + mock = Mock.new('order') + mock.expects(:account_number=, 1234) + mock.account_number = 1234 + mock._verify + end + + def test_expects_assigment_using_string_method_name + mock = Mock.new('order') + mock.expects('account_number=', 1234) + mock.account_number = 1234 + mock._verify + end + + def test_expects_assignment_and_return_is_overruled_by_ruby_syntax + # Prove that we can set up a return but that it doesn't mean much, + # because ruby's parser will 'do the right thing' as regards semantic + # values for assignment. (That is, the rvalue of the assignment) + mock = Mock.new('order') + mock.expects(:account_number=, 1234).returns "gold" + got = mock.account_number = 1234 + mock._verify + assert_equal 1234, got, "Expected rvalue" + end + + def test_expects_assignment_and_raise + mock = Mock.new('order') + mock.expects(:account_number=, 1234).raises StandardError.new("kaboom") + err = assert_raise StandardError do + mock.account_number = 1234 + end + assert_match(/kaboom/i, err.message) + mock._verify + end + + + def test_expects_multiple + mock = Mock.new('order') + control = mock._control + + assert control.happy? + + mock.expects.one_thing :hi, { :goose => 'neck' } + mock.expects.another 5,6,7 + assert !control.happy? + + mock.one_thing :hi, { :goose => 'neck' } + assert !control.happy? + + mock.another 5,6,7 + assert control.happy? + end + + def test_surprise_call + mock = Mock.new('order') + err = assert_raise ExpectationError do + mock.uh_oh + end + assert_match(/surprise/i, err.message) + assert_match(/uh_oh/i, err.message) + + err = assert_raise ExpectationError do + mock.whoa :horse + end + assert_match(/surprise/i, err.message) + assert_match(/order\.whoa\(:horse\)/i, err.message) + end + + def test_wrong_call + mock = Mock.new('order') + mock.expects.pig 'arse' + err = assert_raise ExpectationError do + mock.whoa :horse + end + assert_match(/wrong method/i, err.message) + assert_match(/order\.whoa\(:horse\)/i, err.message) + assert_match(/order\.pig\("arse"\)/i, err.message) + end + + def test_wrong_arguments + mock = Mock.new('order') + mock.expects.go_fast(:a, 1, 'three') + + err = assert_raise ExpectationError do + mock.go_fast :a, 1, 'not right' + end + assert_match(/wrong argument/i, err.message) + assert_match(/order\.go_fast\(:a, 1, "three"\)/i, err.message) + assert_match(/order\.go_fast\(:a, 1, "not right"\)/i, err.message) + end + + def test_expects_and_return + mock = Mock.new('order') + mock.expects.delivery_date.returns Date.today + assert_equal Date.today, mock.delivery_date + mock._verify + end + + def test_expects_and_return_with_arguments + mock = Mock.new('order') + mock.expects.delivery_date(:arf,14).returns(Date.today) + assert_equal Date.today, mock.delivery_date(:arf,14) + mock._verify + end + + def test_expects_and_raise + mock = Mock.new('order') + mock.expects.delivery_date.raises StandardError.new("bloof") + + err = assert_raise StandardError do + mock.delivery_date + end + assert_match(/bloof/i, err.message) + + mock._verify + + # Try convenience argument String + mock.expects.pow.raises "hell" + err = assert_raise RuntimeError do + mock.pow + end + assert_match(/hell/i, err.message) + + mock._verify + + # Try convenience argument nothing + mock.expects.pow.raises + err = assert_raise RuntimeError do + mock.pow + end + assert_match(/an error/i, err.message) + + mock._verify + end + + def test_expects_a_runtime_block + mock = Mock.new('order') + got_val = nil + + mock.expects.when(:something) { |e,block| + got_val = block.call + } + + mock.when :something do "hi there" end + + assert_equal "hi there", got_val, "Expectation block not invoked" + mock._verify + end + + def test_trap_block + mock = Mock.new('order') + exp = mock.trap.observe + + # use it + mock.observe { "burp" } + + assert_equal "burp", exp.block_value.call + end + + def test_trap_arguments_and_block + mock = Mock.new('order') + exp = mock.trap.subscribe(:data_changed) + + # use it + mock.subscribe(:data_changed) { "burp" } + assert_equal "burp", exp.block_value.call + mock._verify + end + + def test_trap_arguments_and_block_wrong_num_args + mock = Mock.new('order') + exp = mock.trap.subscribe(:data_changed) + + assert_raise ExpectationError do + mock.subscribe(:data_changed,1) { "burp" } + end + mock._verify + end + + def test_trap_arguments_and_block_wrong_args + mock = Mock.new('order') + exp = mock.trap.subscribe(:data_changed) + + assert_raise ExpectationError do + mock.subscribe("no good") { "burp" } + end + + mock._verify + end + + def test_trap_is_not_leniant_about_arguments + mock = Mock.new('order') + exp = mock.trap.subscribe + + assert_raise ExpectationError do + mock.subscribe("no good") { "burp" } + end + + mock._verify + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/test/unit/test_unit_before_after_test.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/test/unit/test_unit_before_after_test.rb new file mode 100644 index 0000000..172f527 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/test/unit/test_unit_before_after_test.rb @@ -0,0 +1,452 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") + +class TestUnitBeforeAfter < Test::Unit::TestCase + + # + # after_teardown + # + + it "adds TestCase.after_teardown hook for appending post-teardown actions" do + write_and_run_test :use_after_teardown => true + + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "THE TEARDOWN", + "1st after_teardown", + "2nd after_teardown", + "Finished in" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 0 + end + + should "execute all after_teardowns, even if the main teardown flunks" do + write_and_run_test :use_after_teardown => true, :flunk_in_teardown => true + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "F", + "1st after_teardown", + "2nd after_teardown", + "Finished in", + "1) Failure:", + "test_something(MyExampleTest) [_test_file_temp.rb:20]:", + "FLUNK IN TEARDOWN" + see_results :tests => 1, :assertions => 1, :failures => 1, :errors => 0 + end + + should "execute all after_teardowns, even if the main teardown explodes" do + write_and_run_test :use_after_teardown => true, :raise_in_teardown => true + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "E", + "1st after_teardown", + "2nd after_teardown", + "Finished in", + "RuntimeError: ERROR IN TEARDOWN" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 1 + end + + should "execute all after_teardowns, even if some of them flunk" do + write_and_run_test :use_after_teardown => true, :flunk_in_after_teardown => true + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "THE TEARDOWN", + "1st after_teardown", + "F", + "2nd after_teardown", + "Finished in", + "1) Failure:", + "test_something(MyExampleTest) [_test_file_temp.rb:7]:", + "Flunk in first after_teardown", + "2) Failure:", + "test_something(MyExampleTest) [_test_file_temp.rb:10]:", + "Flunk in second after_teardown" + see_results :tests => 1, :assertions => 2, :failures => 2, :errors => 0 + end + + should "execute all after_teardowns, even if some of them explode" do + write_and_run_test :use_after_teardown => true, :raise_in_after_teardown => true + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "THE TEARDOWN", + "1st after_teardown", + "E", + "2nd after_teardown", + "Finished in", + "RuntimeError: Error in first after_teardown", + "RuntimeError: Error in second after_teardown" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 2 + end + + it "will run after_teardowns in the absence of a regular teardown" do + write_and_run_test :omit_teardown => true, :use_after_teardown => true + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "1st after_teardown", + "2nd after_teardown", + "Finished in" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 0 + end + + should "not interfere with normal test writing" do + write_and_run_test + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "THE TEARDOWN", + "Finished in" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 0 + end + + it "provides a cleaned-up backtrace" do + write_and_run_test :with_failure => true + see_in_order "Loaded suite", + "THE SETUP", + "A FAILING TEST", + "F", "THE TEARDOWN", + "Finished in", + "1) Failure:", + "test_something(MyExampleTest) [_test_file_temp.rb:17]:", + "Instrumented failure.", + " is not true." + see_results :tests => 1, :assertions => 1, :failures => 1, :errors => 0 + end + + it "provides a cleaned-up backtrace, but not TOO cleaned up" do + write_and_run_test :with_failure => true, :use_helpers => true + see_in_order "Loaded suite", + "THE SETUP", + "A FAILING TEST", + "F", "THE TEARDOWN", + "Finished in", + "1) Failure:", + "test_something(MyExampleTest)\n", + "[_test_file_temp.rb:25:in `tripwire'", + "_test_file_temp.rb:21:in `my_helper'", + "_test_file_temp.rb:17:in `test_something']:", + "Instrumented failure.", + " is not true." + see_results :tests => 1, :assertions => 1, :failures => 1, :errors => 0 + end + + should "not interfere with passthrough exception types" do + if is_modern_test_unit? + write_and_run_test :raise_nasty_in_test => true + see_in_no_particular_order "Loaded suite", + "THE TEARDOWN", + "_test_file_temp.rb:16:in `test_something': NASTY ERROR (NoMemoryError)" + see_no_results + end + end + + # + # before_setup + # + + it "adds TestCase.before_setup hook for prepending pre-setup actions" do + write_and_run_test :use_before_setup => true + see_in_order "Loaded suite", + "3rd before_setup", + "2nd before_setup", + "1st before_setup", + "THE SETUP", + "A TEST", + "THE TEARDOWN", + "Finished in" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 0 + end + + should "stop executing the test on the first failure withing a before_setup action" do + write_and_run_test :use_before_setup => true, :flunk_in_before_setup => true + see_in_order "Loaded suite", + "3rd before_setup", + "2nd before_setup", + "FTHE TEARDOWN", + "1) Failure:", + "test_something(MyExampleTest) [_test_file_temp.rb:10]:", + "Flunk in 2nd before_setup." + see_results :tests => 1, :assertions => 1, :failures => 1, :errors => 0 + end + + should "stop executing the test on the first error within a before_setup action" do + write_and_run_test :use_before_setup => true, :raise_in_before_setup => true + see_in_order "Loaded suite", + "3rd before_setup", + "2nd before_setup", + "ETHE TEARDOWN", + "Finished in", + "test_something(MyExampleTest):", + "RuntimeError: Error in 2nd before_setup", + "_test_file_temp.rb:10", + "/hardmock/lib/test_unit_before_after.rb:", ":in `call'" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 1 + end + + it "will run before_setup actions in the absence of a regular setup" do + write_and_run_test :omit_setup => true, :use_before_setup => true + see_in_order "Loaded suite", + "3rd before_setup", + "2nd before_setup", + "1st before_setup", + "A TEST", + "THE TEARDOWN", + "Finished in" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 0 + end + + it "allows before_setup and after_teardown to be used at the same time" do + write_and_run_test :use_before_setup => true, :use_after_teardown => true + see_in_order "Loaded suite", + "3rd before_setup", + "2nd before_setup", + "1st before_setup", + "A TEST", + "THE TEARDOWN", + "1st after_teardown", + "2nd after_teardown", + "Finished in" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 0 + end + + # + # HELPERS + # + + def teardown + remove_test + end + + def test_filename + "_test_file_temp.rb" + end + + def remove_test + rm_f test_filename + end + + def write_and_run_test(opts={}) + write(test_filename, generate_test_code(opts)) + run_test + end + + def run_test + @output = `ruby #{test_filename} 2>&1` + end + + + def write(fname, code) + File.open(fname,"w") do |f| + f.print code + end + end + + def show_output + puts "-- BEGIN TEST OUTPUT" + puts @output + puts "-- END TEST OUTPUT" + end + + def see_in_order(*phrases) + idx = 0 + phrases.each do |txt| + idx = @output.index(txt, idx) + if idx.nil? + if @output.index(txt) + flunk "Phrase '#{txt}' is out-of-order in test output:\n#{@output}" + else + flunk "Phrase '#{txt}' not found in test output:\n#{@output}" + end + end + end + end + + def see_in_no_particular_order(*phrases) + phrases.each do |txt| + assert_not_nil @output.index(txt), "Didn't see '#{txt}' in test output:\n#{@output}" + end + end + + def see_results(opts) + if @output =~ /(\d+) tests, (\d+) assertions, (\d+) failures, (\d+) errors/ + tests, assertions, failures, errors = [ $1, $2, $3, $4 ] + [:tests, :assertions, :failures, :errors].each do |key| + eval %{assert_equal(opts[:#{key}].to_s, #{key}, "Wrong number of #{key} in report") if opts[:#{key}]} + end + else + flunk "Didn't see the test results report line" + end + end + + def see_no_results + if @output =~ /\d+ tests, \d+ assertions, \d+ failures, \d+ errors/ + flunk "Should not have had a results line:\n#{@output}" + end + end + + def lib_dir + File.expand_path(File.dirname(__FILE__) + "/../../lib") + end + + def generate_test_code(opts={}) + + if opts[:with_failure] or opts[:raise_nasty_in_test] + test_method_code = generate_failing_test("test_something", opts) + else + test_method_code = generate_passing_test("test_something") + end + + + requires_for_ext = '' + if opts[:use_before_setup] or opts[:use_after_teardown] + requires_for_ext =<<-RFE + $: << "#{lib_dir}" + require 'test_unit_before_after' + RFE + end + + before_setups = '' + if opts[:use_before_setup] + add_on_two = "" + if opts[:flunk_in_before_setup] + add_on_two = %{; test.flunk "Flunk in 2nd before_setup"} + elsif opts[:raise_in_before_setup] + add_on_two = %{; raise "Error in 2nd before_setup"} + end + before_setups =<<-BSTS + Test::Unit::TestCase.before_setup do |test| + puts "1st before_setup" + end + Test::Unit::TestCase.before_setup do |test| + puts "2nd before_setup" #{add_on_two} + end + Test::Unit::TestCase.before_setup do |test| + puts "3rd before_setup" + end + + BSTS + end + + + setup_code =<<-SC + def setup + puts "THE SETUP" + end + SC + if opts[:omit_setup] + setup_code = "" + end + + after_teardowns = '' + if opts[:use_after_teardown] + add_on_one = "" + add_on_two = "" + if opts[:flunk_in_after_teardown] + add_on_one = %{; test.flunk "Flunk in first after_teardown"} + add_on_two = %{; test.flunk "Flunk in second after_teardown"} + elsif opts[:raise_in_after_teardown] + add_on_one = %{; raise "Error in first after_teardown"} + add_on_two = %{; raise "Error in second after_teardown"} + end + after_teardowns =<<-ATDS + Test::Unit::TestCase.after_teardown do |test| + puts "1st after_teardown" #{add_on_one} + end + Test::Unit::TestCase.after_teardown do |test| + puts "2nd after_teardown" #{add_on_two} + end + ATDS + end + + teardown_code =<<-TDC + def teardown + puts "THE TEARDOWN" + end + TDC + if opts[:flunk_in_teardown] + teardown_code =<<-TDC + def teardown + flunk "FLUNK IN TEARDOWN" + end + TDC + elsif opts[:raise_in_teardown] + teardown_code =<<-TDC + def teardown + raise "ERROR IN TEARDOWN" + end + TDC + end + if opts[:omit_teardown] + teardown_code = "" + end + + str = <<-TCODE + require 'test/unit' + #{requires_for_ext} + + #{before_setups} #{after_teardowns} + + class MyExampleTest < Test::Unit::TestCase + #{setup_code} + #{teardown_code} + #{test_method_code} + end + TCODE + end + + def generate_passing_test(tname) + str = <<-TMETH + def #{tname} + puts "A TEST" + end + TMETH + end + + def generate_failing_test(tname, opts={}) + str = "NOT DEFINED?" + if opts[:raise_nasty_in_test] + str = <<-TMETH + def #{tname} + raise NoMemoryError, "NASTY ERROR" + end + TMETH + + elsif opts[:use_helpers] + str = <<-TMETH + def #{tname} + puts "A FAILING TEST" + my_helper + end + + def my_helper + tripwire + end + + def tripwire + assert false, "Instrumented failure" + end + TMETH + else + str = <<-TMETH + def #{tname} + puts "A FAILING TEST" + assert false, "Instrumented failure" + end + TMETH + end + return str + end + + def is_modern_test_unit? + begin + Test::Unit::TestCase::PASSTHROUGH_EXCEPTIONS + return true + rescue NameError + return false + end + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/test/unit/trapper_test.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/test/unit/trapper_test.rb new file mode 100644 index 0000000..f7d4114 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/test/unit/trapper_test.rb @@ -0,0 +1,62 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/method_cleanout' +require 'hardmock/trapper' + +class TrapperTest < Test::Unit::TestCase + include Hardmock + + def setup + @mock = Object.new + @mock_control = MyControl.new + @builder = ExpBuilder.new + @trapper = Trapper.new(@mock, @mock_control, @builder) + end + + # + # HELPERS + # + + class MyControl + attr_reader :added + def add_expectation(expectation) + @added ||= [] + @added << expectation + end + end + + class ExpBuilder + attr_reader :options + def build_expectation(options) + @options = options + "dummy expectation" + end + end + + # + # TESTS + # + + def test_method_missing + + output = @trapper.change(:less) + + assert_same @mock, @builder.options[:mock] + assert_equal :change, @builder.options[:method] + assert_equal [:less], @builder.options[:arguments] + assert_not_nil @builder.options[:block] + assert @builder.options[:suppress_arguments_to_block], ":suppress_arguments_to_block should be set" + assert_equal [ "dummy expectation" ], @mock_control.added, + "Wrong expectation added to control" + + assert_equal "dummy expectation", output, "Expectation should have been returned" + + # Examine the block. It should take one argument and simply return + # that argument. because of the 'suppress arguments to block' + # setting, the argument can only end up being a block, in practice. + trapper_block = @builder.options[:block] + assert_equal "the argument", trapper_block.call("the argument"), + "The block should merely return the passed argument" + end + + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/test/unit/verify_error_test.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/test/unit/verify_error_test.rb new file mode 100644 index 0000000..ecd23fd --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/hardmock/test/unit/verify_error_test.rb @@ -0,0 +1,40 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/method_cleanout' +require 'hardmock/mock_control' +require 'hardmock/errors' +require 'hardmock/expectation_builder' +require 'hardmock/expectation' +require 'hardmock/mock' + +class VerifyErrorTest < Test::Unit::TestCase + include Hardmock + + # + # TESTS + # + + def test_formatted_list_of_unmet_expectations + mock1 = Mock.new('mock1') + mock2 = Mock.new('mock2') + exp1 = Expectation.new( :mock => mock1, :method => 'send_parts', :arguments => [1,2,:a] ) + exp2 = Expectation.new( :mock => mock2, :method => 'grind_it', :arguments => [] ) + + exp_list = [ exp1, exp2 ] + + err = VerifyError.new("This is the error", exp_list) + assert_equal "This is the error:\n * #{exp1.to_s}\n * #{exp2.to_s}", err.message + end + + def test_empty_list_of_expectations + # this is not a normal case; not spending a lot of time to make this better + exp_list = [] + err = VerifyError.new("This is the error:\n", exp_list) + end + + def test_nil_expectation_list + # this is not a normal case; not spending a lot of time to make this better + exp_list = [] + err = VerifyError.new("This is the error:\n", exp_list) + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/auto/colour_prompt.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/auto/colour_prompt.rb new file mode 100644 index 0000000..81003dd --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/auto/colour_prompt.rb @@ -0,0 +1,94 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +if RUBY_PLATFORM =~/(win|w)32$/ + begin + require 'Win32API' + rescue LoadError + puts "ERROR! \"Win32API\" library not found" + puts "\"Win32API\" is required for colour on a windows machine" + puts " try => \"gem install Win32API\" on the command line" + puts + end + # puts + # puts 'Windows Environment Detected...' + # puts 'Win32API Library Found.' + # puts +end + +class ColourCommandLine + def initialize + if RUBY_PLATFORM =~/(win|w)32$/ + get_std_handle = Win32API.new("kernel32", "GetStdHandle", ['L'], 'L') + @set_console_txt_attrb = + Win32API.new("kernel32","SetConsoleTextAttribute",['L','N'], 'I') + @hout = get_std_handle.call(-11) + end + end + + def change_to(new_colour) + if RUBY_PLATFORM =~/(win|w)32$/ + @set_console_txt_attrb.call(@hout,self.win32_colour(new_colour)) + else + "\033[30;#{posix_colour(new_colour)};22m" + end + end + + def win32_colour(colour) + case colour + when :black then 0 + when :dark_blue then 1 + when :dark_green then 2 + when :dark_cyan then 3 + when :dark_red then 4 + when :dark_purple then 5 + when :dark_yellow, :narrative then 6 + when :default_white, :default, :dark_white then 7 + when :silver then 8 + when :blue then 9 + when :green, :success then 10 + when :cyan, :output then 11 + when :red, :failure then 12 + when :purple then 13 + when :yellow then 14 + when :white then 15 + else + 0 + end + end + + def posix_colour(colour) + case colour + when :black then 30 + when :red, :failure then 31 + when :green, :success then 32 + when :yellow then 33 + when :blue, :narrative then 34 + when :purple, :magenta then 35 + when :cyan, :output then 36 + when :white, :default_white, :default then 37 + else + 30 + end + end + + def out_c(mode, colour, str) + case RUBY_PLATFORM + when /(win|w)32$/ + change_to(colour) + $stdout.puts str if mode == :puts + $stdout.print str if mode == :print + change_to(:default_white) + else + $stdout.puts("#{change_to(colour)}#{str}\033[0m") if mode == :puts + $stdout.print("#{change_to(colour)}#{str}\033[0m") if mode == :print + end + end +end # ColourCommandLine + +def colour_puts(role,str) ColourCommandLine.new.out_c(:puts, role, str) end +def colour_print(role,str) ColourCommandLine.new.out_c(:print, role, str) end + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/auto/colour_reporter.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/auto/colour_reporter.rb new file mode 100644 index 0000000..5aa1d27 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/auto/colour_reporter.rb @@ -0,0 +1,39 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require "#{File.expand_path(File.dirname(__FILE__))}/colour_prompt" + +$colour_output = true + +def report(message) + if not $colour_output + $stdout.puts(message) + else + message = message.join('\n') if (message.class == Array) + message.each_line do |line| + line.chomp! + colour = case(line) + when /(?:total\s+)?tests:?\s+(\d+)\s+(?:total\s+)?failures:?\s+\d+\s+Ignored:?/i + ($1.to_i == 0) ? :green : :red + when /PASS/ + :green + when /^OK$/ + :green + when /(?:FAIL|ERROR)/ + :red + when /IGNORE/ + :yellow + when /^(?:Creating|Compiling|Linking)/ + :white + else + :silver + end + colour_puts(colour, line) + end + end + $stdout.flush + $stderr.flush +end \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/auto/generate_config.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/auto/generate_config.yml new file mode 100644 index 0000000..4a5e474 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/auto/generate_config.yml @@ -0,0 +1,36 @@ +#this is a sample configuration file for generate_module +#you would use it by calling generate_module with the -ygenerate_config.yml option +#files like this are useful for customizing generate_module to your environment +:generate_module: + :defaults: + #these defaults are used in place of any missing options at the command line + :path_src: ../src/ + :path_inc: ../src/ + :path_tst: ../test/ + :update_svn: true + :includes: + #use [] for no additional includes, otherwise list the includes on separate lines + :src: + - Defs.h + - Board.h + :inc: [] + :tst: + - Defs.h + - Board.h + - Exception.h + :boilerplates: + #these are inserted at the top of generated files. + #just comment out or remove if not desired. + #use %1$s where you would like the file name to appear (path/extension not included) + :src: | + //------------------------------------------- + // %1$s.c + //------------------------------------------- + :inc: | + //------------------------------------------- + // %1$s.h + //------------------------------------------- + :tst: | + //------------------------------------------- + // Test%1$s.c : Units tests for %1$s.c + //------------------------------------------- diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/auto/generate_module.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/auto/generate_module.rb new file mode 100644 index 0000000..3db1a98 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/auto/generate_module.rb @@ -0,0 +1,202 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +# This script creates all the files with start code necessary for a new module. +# A simple module only requires a source file, header file, and test file. +# Triad modules require a source, header, and test file for each triad type (like model, conductor, and hardware). + +require 'rubygems' +require 'fileutils' + +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +#help text when requested +HELP_TEXT = [ "\nGENERATE MODULE\n-------- ------", + "\nUsage: ruby generate_module [options] module_name", + " -i\"include\" sets the path to output headers to 'include' (DEFAULT ../src)", + " -s\"../src\" sets the path to output source to '../src' (DEFAULT ../src)", + " -t\"C:/test\" sets the path to output source to 'C:/test' (DEFAULT ../test)", + " -p\"MCH\" sets the output pattern to MCH.", + " dh - driver hardware.", + " dih - driver interrupt hardware.", + " mch - model conductor hardware.", + " mvp - model view presenter.", + " src - just a single source module. (DEFAULT)", + " -d destroy module instead of creating it.", + " -u update subversion too (requires subversion command line)", + " -y\"my.yml\" selects a different yaml config file for module generation", + "" ].join("\n") + +#Built in patterns +PATTERNS = { 'src' => {'' => { :inc => [] } }, + 'dh' => {'Driver' => { :inc => ['%1$sHardware.h'] }, + 'Hardware' => { :inc => [] } + }, + 'dih' => {'Driver' => { :inc => ['%1$sHardware.h', '%1$sInterrupt.h'] }, + 'Interrupt'=> { :inc => ['%1$sHardware.h'] }, + 'Hardware' => { :inc => [] } + }, + 'mch' => {'Model' => { :inc => [] }, + 'Conductor'=> { :inc => ['%1$sModel.h', '%1$sHardware.h'] }, + 'Hardware' => { :inc => [] } + }, + 'mvp' => {'Model' => { :inc => [] }, + 'Presenter'=> { :inc => ['%1$sModel.h', '%1$sView.h'] }, + 'View' => { :inc => [] } + } + } + +#TEMPLATE_TST +TEMPLATE_TST = %q[#include "unity.h" +%2$s#include "%1$s.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void test_%1$s_NeedToImplement(void) +{ + TEST_IGNORE(); +} +] + +#TEMPLATE_SRC +TEMPLATE_SRC = %q[%2$s#include "%1$s.h" +] + +#TEMPLATE_INC +TEMPLATE_INC = %q[#ifndef _%3$s_H +#define _%3$s_H%2$s + +#endif // _%3$s_H +] + +# Parse the command line parameters. +ARGV.each do |arg| + case(arg) + when /^-d/ then @destroy = true + when /^-u/ then @update_svn = true + when /^-p(\w+)/ then @pattern = $1 + when /^-s(.+)/ then @path_src = $1 + when /^-i(.+)/ then @path_inc = $1 + when /^-t(.+)/ then @path_tst = $1 + when /^-y(.+)/ then @yaml_config = $1 + when /^(\w+)/ + raise "ERROR: You can't have more than one Module name specified!" unless @module_name.nil? + @module_name = arg + when /^-(h|-help)/ + puts HELP_TEXT + exit + else + raise "ERROR: Unknown option specified '#{arg}'" + end +end +raise "ERROR: You must have a Module name specified! (use option -h for help)" if @module_name.nil? + +#load yaml file if one was requested +if @yaml_config + require 'yaml' + cfg = YAML.load_file(HERE + @yaml_config)[:generate_module] + @path_src = cfg[:defaults][:path_src] if @path_src.nil? + @path_inc = cfg[:defaults][:path_inc] if @path_inc.nil? + @path_tst = cfg[:defaults][:path_tst] if @path_tst.nil? + @update_svn = cfg[:defaults][:update_svn] if @update_svn.nil? + @extra_inc = cfg[:includes] + @boilerplates = cfg[:boilerplates] +else + @boilerplates = {} +end + +# Create default file paths if none were provided +@path_src = HERE + "../src/" if @path_src.nil? +@path_inc = @path_src if @path_inc.nil? +@path_tst = HERE + "../test/" if @path_tst.nil? +@path_src += '/' unless (@path_src[-1] == 47) +@path_inc += '/' unless (@path_inc[-1] == 47) +@path_tst += '/' unless (@path_tst[-1] == 47) +@pattern = 'src' if @pattern.nil? +@includes = { :src => [], :inc => [], :tst => [] } +@includes.merge!(@extra_inc) unless @extra_inc.nil? + +#create triad definition +TRIAD = [ { :ext => '.c', :path => @path_src, :template => TEMPLATE_SRC, :inc => :src, :boilerplate => @boilerplates[:src] }, + { :ext => '.h', :path => @path_inc, :template => TEMPLATE_INC, :inc => :inc, :boilerplate => @boilerplates[:inc] }, + { :ext => '.c', :path => @path_tst+'Test', :template => TEMPLATE_TST, :inc => :tst, :boilerplate => @boilerplates[:tst] }, + ] + +#prepare the pattern for use +@patterns = PATTERNS[@pattern.downcase] +raise "ERROR: The design pattern specified isn't one that I recognize!" if @patterns.nil? + +# Assemble the path/names of the files we need to work with. +files = [] +TRIAD.each do |triad| + @patterns.each_pair do |pattern_file, pattern_traits| + files << { + :path => "#{triad[:path]}#{@module_name}#{pattern_file}#{triad[:ext]}", + :name => "#{@module_name}#{pattern_file}", + :template => triad[:template], + :boilerplate => triad[:boilerplate], + :includes => case(triad[:inc]) + when :src then @includes[:src] | pattern_traits[:inc].map{|f| f % [@module_name]} + when :inc then @includes[:inc] + when :tst then @includes[:tst] | pattern_traits[:inc].map{|f| "Mock#{f}"% [@module_name]} + end + } + end +end + +# destroy files if that was what was requested +if @destroy + files.each do |filespec| + file = filespec[:path] + if File.exist?(file) + if @update_svn + `svn delete \"#{file}\" --force` + puts "File #{file} deleted and removed from source control" + else + FileUtils.remove(file) + puts "File #{file} deleted" + end + else + puts "File #{file} does not exist so cannot be removed." + end + end + puts "Destroy Complete" + exit +end + +#Abort if any module already exists +files.each do |file| + raise "ERROR: File #{file[:name]} already exists. Exiting." if File.exist?(file[:path]) +end + +# Create Source Modules +files.each_with_index do |file, i| + File.open(file[:path], 'w') do |f| + f.write(file[:boilerplate] % [file[:name]]) unless file[:boilerplate].nil? + f.write(file[:template] % [ file[:name], + file[:includes].map{|f| "#include \"#{f}\"\n"}.join, + file[:name].upcase ] + ) + end + if (@update_svn) + `svn add \"#{file[:path]}\"` + if $?.exitstatus == 0 + puts "File #{file[:path]} created and added to source control" + else + puts "File #{file[:path]} created but FAILED adding to source control!" + end + else + puts "File #{file[:path]} created" + end +end + +puts 'Generate Complete' diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/auto/generate_test_runner.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/auto/generate_test_runner.rb new file mode 100644 index 0000000..aff5053 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/auto/generate_test_runner.rb @@ -0,0 +1,303 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +File.expand_path(File.join(File.dirname(__FILE__),'colour_prompt')) + +class UnityTestRunnerGenerator + + def initialize(options = nil) + @options = { :includes => [], :plugins => [], :framework => :unity } + case(options) + when NilClass then @options + when String then @options.merge!(UnityTestRunnerGenerator.grab_config(options)) + when Hash then @options.merge!(options) + else raise "If you specify arguments, it should be a filename or a hash of options" + end + end + + def self.grab_config(config_file) + options = { :includes => [], :plugins => [], :framework => :unity } + unless (config_file.nil? or config_file.empty?) + require 'yaml' + yaml_guts = YAML.load_file(config_file) + options.merge!(yaml_guts[:unity] ? yaml_guts[:unity] : yaml_guts[:cmock]) + raise "No :unity or :cmock section found in #{config_file}" unless options + end + return(options) + end + + def run(input_file, output_file, options=nil) + tests = [] + includes = [] + used_mocks = [] + + @options.merge!(options) unless options.nil? + module_name = File.basename(input_file) + + #pull required data from source file + File.open(input_file, 'r') do |input| + tests = find_tests(input) + includes = find_includes(input) + used_mocks = find_mocks(includes) + end + + #build runner file + File.open(output_file, 'w') do |output| + create_header(output, used_mocks) + create_externs(output, tests, used_mocks) + create_mock_management(output, used_mocks) + create_suite_setup_and_teardown(output) + create_reset(output, used_mocks) + create_main(output, input_file, tests) + end + + all_files_used = [input_file, output_file] + all_files_used += includes.map {|filename| filename + '.c'} unless includes.empty? + all_files_used += @options[:includes] unless @options[:includes].empty? + return all_files_used.uniq + end + + def find_tests(input_file) + tests_raw = [] + tests_args = [] + tests_and_line_numbers = [] + + input_file.rewind + source_raw = input_file.read + source_scrubbed = source_raw.gsub(/\/\/.*$/, '') # remove line comments + source_scrubbed = source_scrubbed.gsub(/\/\*.*?\*\//m, '') # remove block comments + lines = source_scrubbed.split(/(^\s*\#.*$) # Treat preprocessor directives as a logical line + | (;|\{|\}) /x) # Match ;, {, and } as end of lines + + lines.each_with_index do |line, index| + #find tests + if line =~ /^((?:\s*TEST_CASE\s*\(.*?\)\s*)*)\s*void\s+(test.*?)\s*\(\s*(.*)\s*\)/ + arguments = $1 + name = $2 + call = $3 + args = nil + if (@options[:use_param_tests] and !arguments.empty?) + args = [] + arguments.scan(/\s*TEST_CASE\s*\((.*)\)\s*$/) {|a| args << a[0]} + end + tests_and_line_numbers << { :name => name, :args => args, :call => call, :line_number => 0 } + tests_args = [] + end + end + + #determine line numbers and create tests to run + source_lines = source_raw.split("\n") + source_index = 0; + tests_and_line_numbers.size.times do |i| + source_lines[source_index..-1].each_with_index do |line, index| + if (line =~ /#{tests_and_line_numbers[i][:name]}/) + source_index += index + tests_and_line_numbers[i][:line_number] = source_index + 1 + break + end + end + end + + return tests_and_line_numbers + end + + def find_includes(input_file) + input_file.rewind + includes = [] + input_file.readlines.each do |line| + scan_results = line.scan(/^\s*#include\s+\"\s*(.+)\.[hH]\s*\"/) + includes << scan_results[0][0] if (scan_results.size > 0) + end + return includes + end + + def find_mocks(includes) + mock_headers = [] + includes.each do |include_file| + mock_headers << File.basename(include_file) if (include_file =~ /^mock/i) + end + return mock_headers + end + + def create_header(output, mocks) + output.puts('/* AUTOGENERATED FILE. DO NOT EDIT. */') + create_runtest(output, mocks) + output.puts("\n//=======Automagically Detected Files To Include=====") + output.puts("#include \"#{@options[:framework].to_s}.h\"") + output.puts('#include "cmock.h"') unless (mocks.empty?) + @options[:includes].flatten.uniq.compact.each do |inc| + output.puts("#include #{inc.include?('<') ? inc : "\"#{inc.gsub('.h','')}.h\""}") + end + output.puts('#include ') + output.puts('#include ') + output.puts('#include "CException.h"') if @options[:plugins].include?(:cexception) + mocks.each do |mock| + output.puts("#include \"#{mock.gsub('.h','')}.h\"") + end + if @options[:enforce_strict_ordering] + output.puts('') + output.puts('int GlobalExpectCount;') + output.puts('int GlobalVerifyOrder;') + output.puts('char* GlobalOrderError;') + end + end + + def create_externs(output, tests, mocks) + output.puts("\n//=======External Functions This Runner Calls=====") + output.puts("extern void setUp(void);") + output.puts("extern void tearDown(void);") + tests.each do |test| + output.puts("extern void #{test[:name]}(#{test[:call]});") + end + output.puts('') + end + + def create_mock_management(output, mocks) + unless (mocks.empty?) + output.puts("\n//=======Mock Management=====") + output.puts("static void CMock_Init(void)") + output.puts("{") + if @options[:enforce_strict_ordering] + output.puts(" GlobalExpectCount = 0;") + output.puts(" GlobalVerifyOrder = 0;") + output.puts(" GlobalOrderError = NULL;") + end + mocks.each do |mock| + output.puts(" #{mock}_Init();") + end + output.puts("}\n") + + output.puts("static void CMock_Verify(void)") + output.puts("{") + mocks.each do |mock| + output.puts(" #{mock}_Verify();") + end + output.puts("}\n") + + output.puts("static void CMock_Destroy(void)") + output.puts("{") + mocks.each do |mock| + output.puts(" #{mock}_Destroy();") + end + output.puts("}\n") + end + end + + def create_suite_setup_and_teardown(output) + unless (@options[:suite_setup].nil?) + output.puts("\n//=======Suite Setup=====") + output.puts("static int suite_setup(void)") + output.puts("{") + output.puts(@options[:suite_setup]) + output.puts("}") + end + unless (@options[:suite_teardown].nil?) + output.puts("\n//=======Suite Teardown=====") + output.puts("static int suite_teardown(int num_failures)") + output.puts("{") + output.puts(@options[:suite_teardown]) + output.puts("}") + end + end + + def create_runtest(output, used_mocks) + cexception = @options[:plugins].include? :cexception + va_args1 = @options[:use_param_tests] ? ', ...' : '' + va_args2 = @options[:use_param_tests] ? '__VA_ARGS__' : '' + output.puts("\n//=======Test Runner Used To Run Each Test Below=====") + output.puts("#define RUN_TEST_NO_ARGS") if @options[:use_param_tests] + output.puts("#define RUN_TEST(TestFunc, TestLineNum#{va_args1}) \\") + output.puts("{ \\") + output.puts(" Unity.CurrentTestName = #TestFunc#{va_args2.empty? ? '' : " \"(\" ##{va_args2} \")\""}; \\") + output.puts(" Unity.CurrentTestLineNumber = TestLineNum; \\") + output.puts(" Unity.NumberOfTests++; \\") + output.puts(" if (TEST_PROTECT()) \\") + output.puts(" { \\") + output.puts(" CEXCEPTION_T e; \\") if cexception + output.puts(" Try { \\") if cexception + output.puts(" CMock_Init(); \\") unless (used_mocks.empty?) + output.puts(" setUp(); \\") + output.puts(" TestFunc(#{va_args2}); \\") + output.puts(" CMock_Verify(); \\") unless (used_mocks.empty?) + output.puts(" } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, \"Unhandled Exception!\"); } \\") if cexception + output.puts(" } \\") + output.puts(" CMock_Destroy(); \\") unless (used_mocks.empty?) + output.puts(" if (TEST_PROTECT() && !TEST_IS_IGNORED) \\") + output.puts(" { \\") + output.puts(" tearDown(); \\") + output.puts(" } \\") + output.puts(" UnityConcludeTest(); \\") + output.puts("}\n") + end + + def create_reset(output, used_mocks) + output.puts("\n//=======Test Reset Option=====") + output.puts("void resetTest()") + output.puts("{") + output.puts(" CMock_Verify();") unless (used_mocks.empty?) + output.puts(" CMock_Destroy();") unless (used_mocks.empty?) + output.puts(" tearDown();") + output.puts(" CMock_Init();") unless (used_mocks.empty?) + output.puts(" setUp();") + output.puts("}") + end + + def create_main(output, filename, tests) + output.puts("\n\n//=======MAIN=====") + output.puts("int main(void)") + output.puts("{") + output.puts(" suite_setup();") unless @options[:suite_setup].nil? + output.puts(" Unity.TestFile = \"#{filename}\";") + output.puts(" UnityBegin();") + if (@options[:use_param_tests]) + tests.each do |test| + if ((test[:args].nil?) or (test[:args].empty?)) + output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]}, RUN_TEST_NO_ARGS);") + else + test[:args].each {|args| output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]}, #{args});")} + end + end + else + tests.each { |test| output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]});") } + end + output.puts() + output.puts(" return #{@options[:suite_teardown].nil? ? "" : "suite_teardown"}(UnityEnd());") + output.puts("}") + end +end + + +if ($0 == __FILE__) + options = { :includes => [] } + yaml_file = nil + + #parse out all the options first + ARGV.reject! do |arg| + case(arg) + when '-cexception' + options[:plugins] = [:cexception]; true + when /\.*\.yml/ + options = UnityTestRunnerGenerator.grab_config(arg); true + else false + end + end + + #make sure there is at least one parameter left (the input file) + if !ARGV[0] + puts ["usage: ruby #{__FILE__} (yaml) (options) input_test_file output_test_runner (includes)", + " blah.yml - will use config options in the yml file (see docs)", + " -cexception - include cexception support"].join("\n") + exit 1 + end + + #create the default test runner name if not specified + ARGV[1] = ARGV[0].gsub(".c","_Runner.c") if (!ARGV[1]) + + #everything else is an include file + options[:includes] ||= (ARGV.slice(2..-1).flatten.compact) if (ARGV.size > 2) + + UnityTestRunnerGenerator.new(options).run(ARGV[0], ARGV[1]) +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/auto/test_file_filter.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/auto/test_file_filter.rb new file mode 100644 index 0000000..3dbc26a --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/auto/test_file_filter.rb @@ -0,0 +1,23 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require'yaml' + +module RakefileHelpers + class TestFileFilter + def initialize(all_files = false) + @all_files = all_files + if not @all_files == true + if File.exist?('test_file_filter.yml') + filters = YAML.load_file( 'test_file_filter.yml' ) + @all_files, @only_files, @exclude_files = + filters[:all_files], filters[:only_files], filters[:exclude_files] + end + end + end + attr_accessor :all_files, :only_files, :exclude_files + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/auto/unity_test_summary.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/auto/unity_test_summary.rb new file mode 100644 index 0000000..69ec2e8 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/auto/unity_test_summary.rb @@ -0,0 +1,126 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +#!/usr/bin/ruby +# +# unity_test_summary.rb +# +require 'fileutils' +require 'set' + +class UnityTestSummary + include FileUtils::Verbose + + attr_reader :report, :total_tests, :failures, :ignored + + def initialize + @report = '' + @total_tests = 0 + @failures = 0 + @ignored = 0 + end + + def run + # Clean up result file names + results = @targets.map {|target| target.gsub(/\\/,'/')} + + # Dig through each result file, looking for details on pass/fail: + failure_output = [] + ignore_output = [] + + results.each do |result_file| + lines = File.readlines(result_file).map { |line| line.chomp } + if lines.length == 0 + raise "Empty test result file: #{result_file}" + else + output = get_details(result_file, lines) + failure_output << output[:failures] unless output[:failures].empty? + ignore_output << output[:ignores] unless output[:ignores].empty? + tests,failures,ignored = parse_test_summary(lines) + @total_tests += tests + @failures += failures + @ignored += ignored + end + end + + if @ignored > 0 + @report += "\n" + @report += "--------------------------\n" + @report += "UNITY IGNORED TEST SUMMARY\n" + @report += "--------------------------\n" + @report += ignore_output.flatten.join("\n") + end + + if @failures > 0 + @report += "\n" + @report += "--------------------------\n" + @report += "UNITY FAILED TEST SUMMARY\n" + @report += "--------------------------\n" + @report += failure_output.flatten.join("\n") + end + + @report += "\n" + @report += "--------------------------\n" + @report += "OVERALL UNITY TEST SUMMARY\n" + @report += "--------------------------\n" + @report += "#{@total_tests} TOTAL TESTS #{@failures} TOTAL FAILURES #{@ignored} IGNORED\n" + @report += "\n" + end + + def set_targets(target_array) + @targets = target_array + end + + def set_root_path(path) + @root = path + end + + def usage(err_msg=nil) + puts err_msg if err_msg + puts "Usage: unity_test_summary.rb" + exit 1 + end + + protected + + @@targets=nil + @@path=nil + @@root=nil + + def get_details(result_file, lines) + results = { :failures => [], :ignores => [], :successes => [] } + lines.each do |line| + src_file,src_line,test_name,status,msg = line.split(/:/) + line_out = ((@root and (@root != 0)) ? "#{@root}#{line}" : line ).gsub(/\//, "\\") + case(status) + when 'IGNORE' then results[:ignores] << line_out + when 'FAIL' then results[:failures] << line_out + when 'PASS' then results[:successes] << line_out + end + end + return results + end + + def parse_test_summary(summary) + if summary[-3..-1].join("\n") =~ /(\d+) Tests (\d+) Failures (\d+) Ignored/ + [$1.to_i,$2.to_i,$3.to_i] + else + raise "Couldn't parse test results: #{summary}" + end + end + + def here; File.expand_path(File.dirname(__FILE__)); end + +end + +if $0 == __FILE__ + script = UnityTestSummary.new + begin + script.run + rescue Exception => e + script.usage e.message + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/docs/Unity Summary.odt b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/docs/Unity Summary.odt new file mode 100644 index 0000000..f699661 Binary files /dev/null and b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/docs/Unity Summary.odt differ diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/docs/Unity Summary.pdf b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/docs/Unity Summary.pdf new file mode 100644 index 0000000..ad1a956 Binary files /dev/null and b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/docs/Unity Summary.pdf differ diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/docs/Unity Summary.txt b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/docs/Unity Summary.txt new file mode 100644 index 0000000..e0b179d --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/docs/Unity Summary.txt @@ -0,0 +1,217 @@ +============== +Unity Test API +============== + +[Copyright (c) 2007 - Unity Project by Mike Karlesky, Mark VanderVoord, and Greg Williams] + +------------- +Running Tests +------------- + +RUN_TEST(func, linenum) + +Each Test is run within the macro RUN_TEST. This macro performs necessary setup before the test is called and handles cleanup and result tabulation afterwards. + +-------------- +Ignoring Tests +-------------- + +There are times when a test is incomplete or not valid for some reason. At these times, TEST_IGNORE can be called. Control will immediately be returned to the caller of the test, and no failures will be returned. + +TEST_IGNORE() + +Ignore this test and return immediately + +TEST_IGNORE_MESSAGE (message) + +Ignore this test and return immediately. Output a message stating why the test was ignored. + +-------------- +Aborting Tests +-------------- + +There are times when a test will contain an infinite loop on error conditions, or there may be reason to escape from the test early without executing the rest of the test. A pair of macros support this functionality in Unity. The first (TEST_PROTECT) sets up the feature, and handles emergency abort cases. TEST_ABORT can then be used at any time within the tests to return to the last TEST_PROTECT call. + +TEST_PROTECT() + +Setup and Catch macro + +TEST_ABORT() + +Abort Test macro + +Example: + +main() +{ + if (TEST_PROTECT() == 0) + { + MyTest(); + } +} + +If MyTest calls TEST_ABORT, program control will immediately return to TEST_PROTECT with a non-zero return value. + + +======================= +Unity Assertion Summary +======================= + +-------------------- +Basic Validity Tests +-------------------- + +TEST_ASSERT_TRUE(condition) + +Evaluates whatever code is in condition and fails if it evaluates to false + +TEST_ASSERT_FALSE(condition) + +Evaluates whatever code is in condition and fails if it evaluates to true + +TEST_ASSERT(condition) + +Another way of calling TEST_ASSERT_TRUE + +TEST_ASSERT_UNLESS(condition) + +Another way of calling TEST_ASSERT_FALSE + +TEST_FAIL() +TEST_FAIL_MESSAGE(message) + +This test is automatically marked as a failure. The message is output stating why. + +------------------------------ +Numerical Assertions: Integers +------------------------------ + +TEST_ASSERT_EQUAL_INT(expected, actual) +TEST_ASSERT_EQUAL_INT8(expected, actual) +TEST_ASSERT_EQUAL_INT16(expected, actual) +TEST_ASSERT_EQUAL_INT32(expected, actual) +TEST_ASSERT_EQUAL_INT64(expected, actual) + +Compare two integers for equality and display errors as signed integers. A cast will be performed +to your natural integer size so often this can just be used. When you need to specify the exact size, +like when comparing arrays, you can use a specific version: + + + +TEST_ASSERT_EQUAL_UINT(expected, actual) + +Compare two integers for equality and display errors as unsigned integers. Like INT, there are +variants for different sizes also. + + + +TEST_ASSERT_EQUAL_HEX(expected, actual) + +Compares two integers for equality and display errors as hexadecimal. Like the other integer comparisons, +you can specify the size... here the size will also effect how many nibbles are shown (for example, HEX16 +will show 4 nibbles). + +_ARRAY + +You can append _ARRAY to any of these macros to make an array comparison of that type. Here you will +need to care a bit more about the actual size of the value being checked. You will also specify an +additional argument which is the number of elements to compare. For example: + +TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, elements) + + +TEST_ASSERT_EQUAL(expected, actual) + +Another way of calling TEST_ASSERT_EQUAL_INT + + + +TEST_ASSERT_INT_WITHIN(delta, expected, actual) + +Asserts that the actual value is within plus or minus delta of the expected value. This also comes in +size specific variants. + + +----------------------------- +Numerical Assertions: Bitwise +----------------------------- + +TEST_ASSERT_BITS(mask, expected, actual) + +Use an integer mask to specify which bits should be compared between two other integers. High bits in the mask are compared, low bits ignored. + +TEST_ASSERT_BITS_HIGH(mask, actual) + +Use an integer mask to specify which bits should be inspected to determine if they are all set high. High bits in the mask are compared, low bits ignored. + +TEST_ASSERT_BITS_LOW(mask, actual) + +Use an integer mask to specify which bits should be inspected to determine if they are all set low. High bits in the mask are compared, low bits ignored. + +TEST_ASSERT_BIT_HIGH(bit, actual) + +Test a single bit and verify that it is high. The bit is specified 0-31 for a 32-bit integer. + +TEST_ASSERT_BIT_LOW(bit, actual) + +Test a single bit and verify that it is low. The bit is specified 0-31 for a 32-bit integer. + +---------------------------- +Numerical Assertions: Floats +---------------------------- + +TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual) + +Asserts that the actual value is within plus or minus delta of the expected value. + +TEST_ASSERT_EQUAL_FLOAT(expected, actual) + +Asserts that two floating point values are "equal" within a small % delta of the expected value. + +----------------- +String Assertions +----------------- + +TEST_ASSERT_EQUAL_STRING(expected, actual) + +Compare two null-terminate strings. Fail if any character is different or if the lengths are different. + +TEST_ASSERT_EQUAL_STRING_MESSAGE(expected, actual, message) + +Compare two null-terminate strings. Fail if any character is different or if the lengths are different. Output a custom message on failure. + +------------------ +Pointer Assertions +------------------ + +Most pointer operations can be performed by simply using the integer comparisons above. However, a couple of special cases are added for clarity. + +TEST_ASSERT_NULL(pointer) + +Fails if the pointer is not equal to NULL + +TEST_ASSERT_NOT_NULL(pointer) + +Fails if the pointer is equal to NULL + + +----------------- +Memory Assertions +----------------- + +TEST_ASSERT_EQUAL_MEMORY(expected, actual, len) + +Compare two blocks of memory. This is a good generic assertion for types that can't be coerced into acting like +standard types... but since it's a memory compare, you have to be careful that your data types are packed. + +-------- +_MESSAGE +-------- + +you can append _MESSAGE to any of the macros to make them take an additional argument. This argument +is a string that will be printed at the end of the failure strings. This is useful for specifying more +information about the problem. + + + + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/docs/license.txt b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/docs/license.txt new file mode 100644 index 0000000..c42e330 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/docs/license.txt @@ -0,0 +1,31 @@ + Copyright (c) 2007-2010 Mike Karlesky, Mark VanderVoord, Greg Williams + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + The end-user documentation included with the redistribution, if + any, must include the following acknowledgment: "This product + includes software developed for the Unity Project, by Mike Karlesky, + Mark VanderVoord, and Greg Williams and other contributors", in + the same place and form as other third-party acknowledgments. + Alternately, this acknowledgment may appear in the software + itself, in the same form and location as other such third-party + acknowledgments. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/extras/fixture/build/MakefileWorker.mk b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/extras/fixture/build/MakefileWorker.mk new file mode 100644 index 0000000..9948751 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/extras/fixture/build/MakefileWorker.mk @@ -0,0 +1,331 @@ +#--------- +# +# MakefileWorker.mk +# +# Include this helper file in your makefile +# It makes +# A static library holding the application objs +# A test executable +# +# See this example for parameter settings +# examples/Makefile +# +#---------- +# Inputs - these variables describe what to build +# +# INCLUDE_DIRS - Directories used to search for include files. +# This generates a -I for each directory +# SRC_DIRS - Directories containing source file to built into the library +# SRC_FILES - Specific source files to build into library. Helpful when not all code +# in a directory can be built for test (hopefully a temporary situation) +# TEST_SRC_DIRS - Directories containing unit test code build into the unit test runner +# These do not go in a library. They are explicitly included in the test runner +# MOCKS_SRC_DIRS - Directories containing mock source files to build into the test runner +# These do not go in a library. They are explicitly included in the test runner +#---------- +# You can adjust these variables to influence how to build the test target +# and where to put and name outputs +# See below to determine defaults +# COMPONENT_NAME - the name of the thing being built +# UNITY_HOME - where Unity home dir found +# UNITY_BUILD_HOME - place for scripts +# UNITY_OBJS_DIR - a directory where o and d files go +# UNITY_LIB_DIR - a directory where libs go +# UNITY_ENABLE_DEBUG - build for debug +# UNITY_USE_MEM_LEAK_DETECTION - Links with overridden new and delete +# UNITY_USE_STD_CPP_LIB - Set to N to keep the standard C++ library out +# of the test harness +# UNITY_USE_GCOV - Turn on coverage analysis +# Clean then build with this flag set to Y, then 'make gcov' +# UNITY_TEST_RUNNER_FLAGS +# None by default +# UNITY_MAPFILE - generate a map file +# UNITY_WARNINGFLAGS - overly picky by default +# OTHER_MAKEFILE_TO_INCLUDE - a hook to use this makefile to make +# other targets. Like CSlim, which is part of fitnesse +#---------- +# +# Other flags users can initialize to sneak in their settings +# UNITY_CFLAGS - C complier +# UNITY_LDFLAGS - Linker flags +#---------- + + +ifndef COMPONENT_NAME + COMPONENT_NAME = name_this_in_the_makefile +endif + +# Debug on by default +ifndef UNITY_ENABLE_DEBUG + UNITY_ENABLE_DEBUG = Y +endif + +# new and delete for memory leak detection on by default +ifndef UNITY_USE_MEM_LEAK_DETECTION + UNITY_USE_MEM_LEAK_DETECTION = Y +endif + +# Use gcov, off by default +ifndef UNITY_USE_GCOV + UNITY_USE_GCOV = N +endif + +# Default warnings +ifndef UNITY_WARNINGFLAGS + UNITY_WARNINGFLAGS = -Wall -Werror -Wshadow -Wswitch-default +endif + +# Default dir for temporary files (d, o) +ifndef UNITY_OBJS_DIR + UNITY_OBJS_DIR = objs +endif + +# Default dir for the outout library +ifndef UNITY_LIB_DIR + UNITY_LIB_DIR = lib +endif + +# No map by default +ifndef UNITY_MAP_FILE + UNITY_MAP_FILE = N +endif + +#Not verbose by deafult +ifdef VERBOSE + UNITY_TEST_RUNNER_FLAGS += -v +endif + +ifdef GROUP + UNITY_TEST_RUNNER_FLAGS += -g $(GROUP) +endif + +ifdef NAME + UNITY_TEST_RUNNER_FLAGS += -n $(NAME) +endif + +ifdef REPEAT + UNITY_TEST_RUNNER_FLAGS += -r $(REPEAT) +endif + + +# -------------------------------------- +# derived flags in the following area +# -------------------------------------- +ifeq ($(UNITY_USE_MEM_LEAK_DETECTION), N) + UNITY_CFLAGS += -DUNITY_MEM_LEAK_DETECTION_DISABLED +else + UNITY_MEMLEAK_DETECTOR_MALLOC_MACRO_FILE = -include $(UNITY_HOME)/extras/fixture/src/unity_fixture_malloc_overrides.h +endif + +ifeq ($(UNITY_ENABLE_DEBUG), Y) + UNITY_CFLAGS += -g +endif + +ifeq ($(UNITY_USE_GCOV), Y) + UNITY_CFLAGS += -fprofile-arcs -ftest-coverage +endif + +UNITY_CFLAGS += $(UNITY_MEMLEAK_DETECTOR_MALLOC_MACRO_FILE) + +TARGET_MAP = $(COMPONENT_NAME).map.txt +ifeq ($(UNITY_MAP_FILE), Y) + UNITY_LDFLAGS += -Wl,-map,$(TARGET_MAP) +endif + +LD_LIBRARIES += -lgcov + +TARGET_LIB = \ + $(UNITY_LIB_DIR)/lib$(COMPONENT_NAME).a + +TEST_TARGET = \ + $(COMPONENT_NAME)_tests + +#Helper Functions +get_src_from_dir = $(wildcard $1/*.cpp) $(wildcard $1/*.c) +get_dirs_from_dirspec = $(wildcard $1) +get_src_from_dir_list = $(foreach dir, $1, $(call get_src_from_dir,$(dir))) +__src_to = $(subst .c,$1, $(subst .cpp,$1,$2)) +src_to = $(addprefix $(UNITY_OBJS_DIR)/,$(call __src_to,$1,$2)) +src_to_o = $(call src_to,.o,$1) +src_to_d = $(call src_to,.d,$1) +src_to_gcda = $(call src_to,.gcda,$1) +src_to_gcno = $(call src_to,.gcno,$1) +make_dotdot_a_subdir = $(subst ..,_dot_dot, $1) +time = $(shell date +%s) +delta_t = $(eval minus, $1, $2) +debug_print_list = $(foreach word,$1,echo " $(word)";) echo; + +#Derived +STUFF_TO_CLEAN += $(TEST_TARGET) $(TEST_TARGET).exe $(TARGET_LIB) $(TARGET_MAP) + +SRC += $(call get_src_from_dir_list, $(SRC_DIRS)) $(SRC_FILES) +OBJ = $(call src_to_o,$(SRC)) +OBJ2 = $(call make_dotdot_a_subdir. $(OBJ)) + +STUFF_TO_CLEAN += $(OBJ) + +TEST_SRC = $(call get_src_from_dir_list, $(TEST_SRC_DIRS)) +TEST_OBJS = $(call src_to_o,$(TEST_SRC)) +STUFF_TO_CLEAN += $(TEST_OBJS) + + +MOCKS_SRC = $(call get_src_from_dir_list, $(MOCKS_SRC_DIRS)) +MOCKS_OBJS = $(call src_to_o,$(MOCKS_SRC)) +STUFF_TO_CLEAN += $(MOCKS_OBJS) + +ALL_SRC = $(SRC) $(TEST_SRC) $(MOCKS_SRC) + +#Test coverage with gcov +GCOV_OUTPUT = gcov_output.txt +GCOV_REPORT = gcov_report.txt +GCOV_ERROR = gcov_error.txt +GCOV_GCDA_FILES = $(call src_to_gcda, $(ALL_SRC)) +GCOV_GCNO_FILES = $(call src_to_gcno, $(ALL_SRC)) +TEST_OUTPUT = $(TEST_TARGET).txt +STUFF_TO_CLEAN += \ + $(GCOV_OUTPUT)\ + $(GCOV_REPORT)\ + $(GCOV_REPORT).html\ + $(GCOV_ERROR)\ + $(GCOV_GCDA_FILES)\ + $(GCOV_GCNO_FILES)\ + $(TEST_OUTPUT) + + +#The gcda files for gcov need to be deleted before each run +#To avoid annoying messages. +GCOV_CLEAN = $(SILENCE)rm -f $(GCOV_GCDA_FILES) $(GCOV_OUTPUT) $(GCOV_REPORT) $(GCOV_ERROR) +RUN_TEST_TARGET = $(SILENCE) $(GCOV_CLEAN) ; echo "Running $(TEST_TARGET)"; ./$(TEST_TARGET) $(UNITY_TEST_RUNNER_FLAGS) + +INCLUDES_DIRS_EXPANDED = $(call get_dirs_from_dirspec, $(INCLUDE_DIRS)) +INCLUDES += $(foreach dir, $(INCLUDES_DIRS_EXPANDED), -I$(dir)) +MOCK_DIRS_EXPANDED = $(call get_dirs_from_dirspec, $(MOCKS_SRC_DIRS)) +INCLUDES += $(foreach dir, $(MOCK_DIRS_EXPANDED), -I$(dir)) + + +DEP_FILES = $(call src_to_d, $(ALL_SRC)) +STUFF_TO_CLEAN += $(DEP_FILES) $(PRODUCTION_CODE_START) $(PRODUCTION_CODE_END) +STUFF_TO_CLEAN += $(STDLIB_CODE_START) $(MAP_FILE) cpputest_*.xml junit_run_output + +# We'll use the UNITY_CFLAGS etc so that you can override AND add to the CppUTest flags +CFLAGS = $(UNITY_CFLAGS) $(UNITY_ADDITIONAL_CFLAGS) $(INCLUDES) $(UNITY_WARNINGFLAGS) +LDFLAGS = $(UNITY_LDFLAGS) $(UNITY_ADDITIONAL_LDFLAGS) + +# Targets + +.PHONY: all +all: start $(TEST_TARGET) + $(RUN_TEST_TARGET) + +.PHONY: start +start: $(TEST_TARGET) + $(SILENCE)START_TIME=$(call time) + +.PHONY: all_no_tests +all_no_tests: $(TEST_TARGET) + +.PHONY: flags +flags: + @echo + @echo "Compile C source with CFLAGS:" + @$(call debug_print_list,$(CFLAGS)) + @echo "Link with LDFLAGS:" + @$(call debug_print_list,$(LDFLAGS)) + @echo "Link with LD_LIBRARIES:" + @$(call debug_print_list,$(LD_LIBRARIES)) + @echo "Create libraries with ARFLAGS:" + @$(call debug_print_list,$(ARFLAGS)) + @echo "OBJ files:" + @$(call debug_print_list,$(OBJ2)) + + +$(TEST_TARGET): $(TEST_OBJS) $(MOCKS_OBJS) $(PRODUCTION_CODE_START) $(TARGET_LIB) $(USER_LIBS) $(PRODUCTION_CODE_END) $(STDLIB_CODE_START) + $(SILENCE)echo Linking $@ + $(SILENCE)$(LINK.o) -o $@ $^ $(LD_LIBRARIES) + +$(TARGET_LIB): $(OBJ) + $(SILENCE)echo Building archive $@ + $(SILENCE)mkdir -p lib + $(SILENCE)$(AR) $(ARFLAGS) $@ $^ + $(SILENCE)ranlib $@ + +test: $(TEST_TARGET) + $(RUN_TEST_TARGET) | tee $(TEST_OUTPUT) + +vtest: $(TEST_TARGET) + $(RUN_TEST_TARGET) -v | tee $(TEST_OUTPUT) + +$(UNITY_OBJS_DIR)/%.o: %.cpp + @echo compiling $(notdir $<) + $(SILENCE)mkdir -p $(dir $@) + $(SILENCE)$(COMPILE.cpp) -MMD -MP $(OUTPUT_OPTION) $< + +$(UNITY_OBJS_DIR)/%.o: %.c + @echo compiling $(notdir $<) + $(SILENCE)mkdir -p $(dir $@) + $(SILENCE)$(COMPILE.c) -MMD -MP $(OUTPUT_OPTION) $< + +ifneq "$(MAKECMDGOALS)" "clean" +-include $(DEP_FILES) +endif + +.PHONY: clean +clean: + $(SILENCE)echo Making clean + $(SILENCE)$(RM) $(STUFF_TO_CLEAN) + $(SILENCE)rm -rf gcov $(UNITY_OBJS_DIR) + $(SILENCE)find . -name "*.gcno" | xargs rm -f + $(SILENCE)find . -name "*.gcda" | xargs rm -f + +#realclean gets rid of all gcov, o and d files in the directory tree +#not just the ones made by this makefile +.PHONY: realclean +realclean: clean + $(SILENCE)rm -rf gcov + $(SILENCE)find . -name "*.gdcno" | xargs rm -f + $(SILENCE)find . -name "*.[do]" | xargs rm -f + +gcov: test + $(SILENCE)for d in $(SRC_DIRS) ; do \ + gcov --object-directory $(UNITY_OBJS_DIR)/$$d $$d/*.c $$d/*.cpp >> $(GCOV_OUTPUT) 2>>$(GCOV_ERROR) ; \ + done + $(SILENCE)for f in $(SRC_FILES) ; do \ + gcov --object-directory $(UNITY_OBJS_DIR)/$$f $$f >> $(GCOV_OUTPUT) 2>>$(GCOV_ERROR) ; \ + done + $(UNITY_BUILD_HOME)/filterGcov.sh $(GCOV_OUTPUT) $(GCOV_ERROR) $(GCOV_REPORT) $(TEST_OUTPUT) + $(SILENCE)cat $(GCOV_REPORT) + $(SILENCE)mkdir -p gcov + $(SILENCE)mv *.gcov gcov + $(SILENCE)mv gcov_* gcov + $(SILENCE)echo "See gcov directory for details" + +debug: + @echo + @echo "Target Source files:" + @$(call debug_print_list,$(SRC)) + @echo "Target Object files:" + @$(call debug_print_list,$(OBJ)) + @echo "Test Source files:" + @$(call debug_print_list,$(TEST_SRC)) + @echo "Test Object files:" + @$(call debug_print_list,$(TEST_OBJS)) + @echo "Mock Source files:" + @$(call debug_print_list,$(MOCKS_SRC)) + @echo "Mock Object files:" + @$(call debug_print_list,$(MOCKS_OBJS)) + @echo "All Input Dependency files:" + @$(call debug_print_list,$(DEP_FILES)) + @echo Stuff to clean: + @$(call debug_print_list,$(STUFF_TO_CLEAN)) + @echo Includes: + @$(call debug_print_list,$(INCLUDES)) + +ifneq "$(OTHER_MAKEFILE_TO_INCLUDE)" "" +-include $(OTHER_MAKEFILE_TO_INCLUDE) +endif + + + +st,$(TEST_SRC)) + @echo "Test Object files:" + @$(call debug_print \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/extras/fixture/build/filterGcov.sh b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/extras/fixture/build/filterGcov.sh new file mode 100644 index 0000000..a861cf6 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/extras/fixture/build/filterGcov.sh @@ -0,0 +1,61 @@ +#!/bin/bash +INPUT_FILE=$1 +TEMP_FILE1=${INPUT_FILE}1.tmp +TEMP_FILE2=${INPUT_FILE}2.tmp +TEMP_FILE3=${INPUT_FILE}3.tmp +ERROR_FILE=$2 +OUTPUT_FILE=$3 +HTML_OUTPUT_FILE=$3.html +TEST_RESULTS=$4 + +flattenGcovOutput() { +while read line1 +do + read line2 + echo $line2 " " $line1 + read junk + read junk +done < ${INPUT_FILE} +} + +getRidOfCruft() { +sed '-e s/^Lines.*://g' \ + '-e s/^[0-9]\./ &/g' \ + '-e s/^[0-9][0-9]\./ &/g' \ + '-e s/of.*File/ /g' \ + "-e s/'//g" \ + '-e s/^.*\/usr\/.*$//g' \ + '-e s/^.*\.$//g' +} + +getFileNameRootFromErrorFile() { +sed '-e s/gc..:cannot open .* file//g' ${ERROR_FILE} +} + +writeEachNoTestCoverageFile() { +while read line +do + echo " 0.00% " ${line} +done +} + +createHtmlOutput() { + echo "" + echo "" + sed "-e s/.*% /
CoverageFile
&<\/td>/" \ + "-e s/[a-zA-Z0-9_]*\.[ch][a-z]*/&<\/a><\/td><\/tr>/" + echo "
" + sed "-e s/.*/&
/g" < ${TEST_RESULTS} +} + + +flattenGcovOutput | getRidOfCruft > ${TEMP_FILE1} +getFileNameRootFromErrorFile | writeEachNoTestCoverageFile > ${TEMP_FILE2} +cat ${TEMP_FILE1} ${TEMP_FILE2} | sort | uniq > ${OUTPUT_FILE} +createHtmlOutput < ${OUTPUT_FILE} > ${HTML_OUTPUT_FILE} +rm -f ${TEMP_FILE1} ${TEMP_FILE2} +erageFile" + sed "-e s/.*% /&<\/td>/" \ + "-e s/[a-zA-Z0-9_]*\.[ch][a-z]*/&<\/a><\/td><\/tr>/" + echo "" + sed "-e s/.*/&
/g" < ${TEST_RESULTS \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/extras/fixture/rakefile.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/extras/fixture/rakefile.rb new file mode 100644 index 0000000..6181707 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/extras/fixture/rakefile.rb @@ -0,0 +1,37 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require HERE + 'rakefile_helper' + +include RakefileHelpers + +# Load default configuration, for now +DEFAULT_CONFIG_FILE = 'gcc.yml' +configure_toolchain(DEFAULT_CONFIG_FILE) + +task :unit do + run_tests +end + +desc "Build and test Unity Framework" +task :all => [:clean, :unit] +task :default => [:clobber, :all] +task :ci => [:no_color, :default] +task :cruise => [:no_color, :default] + +desc "Load configuration" +task :config, :config_file do |t, args| + configure_toolchain(args[:config_file]) +end + +task :no_color do + $colour_output = false +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/extras/fixture/rakefile_helper.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/extras/fixture/rakefile_helper.rb new file mode 100644 index 0000000..a7f6a28 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/extras/fixture/rakefile_helper.rb @@ -0,0 +1,178 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require 'yaml' +require 'fileutils' +require HERE+'../../auto/unity_test_summary' +require HERE+'../../auto/generate_test_runner' +require HERE+'../../auto/colour_reporter' + +module RakefileHelpers + + C_EXTENSION = '.c' + + def load_configuration(config_file) + unless ($configured) + $cfg_file = HERE+"../../targets/#{config_file}" unless (config_file =~ /[\\|\/]/) + $cfg = YAML.load(File.read($cfg_file)) + $colour_output = false unless $cfg['colour'] + $configured = true if (config_file != DEFAULT_CONFIG_FILE) + end + end + + def configure_clean + CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil? + end + + def configure_toolchain(config_file=DEFAULT_CONFIG_FILE) + config_file += '.yml' unless config_file =~ /\.yml$/ + config_file = config_file unless config_file =~ /[\\|\/]/ + load_configuration(config_file) + configure_clean + end + + def tackit(strings) + if strings.is_a?(Array) + result = "\"#{strings.join}\"" + else + result = strings + end + return result + end + + def squash(prefix, items) + result = '' + items.each { |item| result += " #{prefix}#{tackit(item)}" } + return result + end + + def build_compiler_fields + command = tackit($cfg['compiler']['path']) + if $cfg['compiler']['defines']['items'].nil? + defines = '' + else + defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items'] + ['UNITY_OUTPUT_CHAR=UnityOutputCharSpy_OutputChar']) + end + options = squash('', $cfg['compiler']['options']) + includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :defines => defines, :options => options, :includes => includes} + end + + def compile(file, defines=[]) + compiler = build_compiler_fields + unity_include = $cfg['compiler']['includes']['prefix']+'../../src' + cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{unity_include} #{file} " + + "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" + + "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" + execute(cmd_str) + end + + def build_linker_fields + command = tackit($cfg['linker']['path']) + if $cfg['linker']['options'].nil? + options = '' + else + options = squash('', $cfg['linker']['options']) + end + if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?) + includes = '' + else + includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) + end + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :options => options, :includes => includes} + end + + def link(exe_name, obj_list) + linker = build_linker_fields + cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + + (obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).join + + $cfg['linker']['bin_files']['prefix'] + ' ' + + $cfg['linker']['bin_files']['destination'] + + exe_name + $cfg['linker']['bin_files']['extension'] + execute(cmd_str) + end + + def build_simulator_fields + return nil if $cfg['simulator'].nil? + if $cfg['simulator']['path'].nil? + command = '' + else + command = (tackit($cfg['simulator']['path']) + ' ') + end + if $cfg['simulator']['pre_support'].nil? + pre_support = '' + else + pre_support = squash('', $cfg['simulator']['pre_support']) + end + if $cfg['simulator']['post_support'].nil? + post_support = '' + else + post_support = squash('', $cfg['simulator']['post_support']) + end + return {:command => command, :pre_support => pre_support, :post_support => post_support} + end + + def execute(command_string, verbose=true) + report command_string + output = `#{command_string}`.chomp + report(output) if (verbose && !output.nil? && (output.length > 0)) + if ($?.exitstatus != 0) + raise "Command failed. (Returned #{$?.exitstatus})" + end + return output + end + + def report_summary + summary = UnityTestSummary.new + summary.set_root_path(HERE) + results_glob = "#{$cfg['compiler']['build_path']}*.test*" + results_glob.gsub!(/\\/, '/') + results = Dir[results_glob] + summary.set_targets(results) + summary.run + end + + def run_tests + report 'Running Unity system tests...' + + # Tack on TEST define for compiling unit tests + load_configuration($cfg_file) + test_defines = ['TEST'] + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + + # Get a list of all source files needed + src_files = Dir[HERE+'src/*.c'] + src_files += Dir[HERE+'test/*.c'] + src_files << '../../src/Unity.c' + + # Build object files + src_files.each { |f| compile(f, test_defines) } + obj_list = src_files.map {|f| File.basename(f.ext($cfg['compiler']['object_files']['extension'])) } + + # Link the test executable + test_base = "framework_test" + link(test_base, obj_list) + + # Execute unit test and generate results file + simulator = build_simulator_fields + executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] + if simulator.nil? + cmd_str = executable + " -v -r" + else + cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" + end + output = execute(cmd_str) + test_results = $cfg['compiler']['build_path'] + test_base + if output.match(/OK$/m).nil? + test_results += '.testfail' + else + test_results += '.testpass' + end + File.open(test_results, 'w') { |f| f.print output } + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/extras/fixture/readme.txt b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/extras/fixture/readme.txt new file mode 100644 index 0000000..6b9a78c --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/extras/fixture/readme.txt @@ -0,0 +1,9 @@ +Copyright (c) 2010 James Grenning and Contributed to Unity Project + +Unity Project - A Test Framework for C +Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +[Released under MIT License. Please refer to license.txt for details] + +This Framework is an optional add-on to Unity. By including unity_framework.h in place of unity.h, +you may now work with Unity in a manner similar to CppUTest. This framework adds the concepts of +test groups and gives finer control of your tests over the command line. \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/extras/fixture/src/unity_fixture.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/extras/fixture/src/unity_fixture.c new file mode 100644 index 0000000..1ba3e9a --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/extras/fixture/src/unity_fixture.c @@ -0,0 +1,381 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" +#include "unity_internals.h" +#include + +UNITY_FIXTURE_T UnityFixture; + +//If you decide to use the function pointer approach. +int (*outputChar)(int) = putchar; + +int verbose = 0; + +void setUp(void) { /*does nothing*/ } +void tearDown(void) { /*does nothing*/ } + +void announceTestRun(int runNumber) +{ + UnityPrint("Unity test run "); + UnityPrintNumber(runNumber+1); + UnityPrint(" of "); + UnityPrintNumber(UnityFixture.RepeatCount); + UNITY_OUTPUT_CHAR('\n'); +} + +int UnityMain(int argc, char* argv[], void (*runAllTests)()) +{ + int result = UnityGetCommandLineOptions(argc, argv); + int r; + if (result != 0) + return result; + + for (r = 0; r < UnityFixture.RepeatCount; r++) + { + announceTestRun(r); + UnityBegin(); + runAllTests(); + UNITY_OUTPUT_CHAR('\n'); + UnityEnd(); + } + + return UnityFailureCount(); +} + +static int selected(const char * filter, const char * name) +{ + if (filter == 0) + return 1; + return strstr(name, filter) ? 1 : 0; +} + +static int testSelected(const char* test) +{ + return selected(UnityFixture.NameFilter, test); +} + +static int groupSelected(const char* group) +{ + return selected(UnityFixture.GroupFilter, group); +} + +static void runTestCase() +{ + +} + +void UnityTestRunner(unityfunction* setup, + unityfunction* testBody, + unityfunction* teardown, + const char * printableName, + const char * group, + const char * name, + const char * file, int line) +{ + if (testSelected(name) && groupSelected(group)) + { + Unity.CurrentTestFailed = 0; + Unity.TestFile = file; + Unity.CurrentTestName = printableName; + Unity.CurrentTestLineNumber = line; + if (!UnityFixture.Verbose) + UNITY_OUTPUT_CHAR('.'); + else + UnityPrint(printableName); + + Unity.NumberOfTests++; + UnityMalloc_StartTest(); + UnityPointer_Init(); + + runTestCase(); + if (TEST_PROTECT()) + { + setup(); + testBody(); + } + if (TEST_PROTECT()) + { + teardown(); + } + if (TEST_PROTECT()) + { + UnityPointer_UndoAllSets(); + if (!Unity.CurrentTestFailed) + UnityMalloc_EndTest(); + UnityConcludeFixtureTest(); + } + else + { + //aborting - jwg - di i need these for the other TEST_PROTECTS? + } + } +} + +void UnityIgnoreTest() +{ + Unity.NumberOfTests++; + Unity.CurrentTestIgnored = 1; + UNITY_OUTPUT_CHAR('!'); +} + + +//------------------------------------------------- +//Malloc and free stuff +// +#define MALLOC_DONT_FAIL -1 +static int malloc_count; +static int malloc_fail_countdown = MALLOC_DONT_FAIL; + +void UnityMalloc_StartTest() +{ + malloc_count = 0; + malloc_fail_countdown = MALLOC_DONT_FAIL; +} + +void UnityMalloc_EndTest() +{ + malloc_fail_countdown = MALLOC_DONT_FAIL; + if (malloc_count != 0) + { + TEST_FAIL_MESSAGE("This test leaks!"); + } +} + +void UnityMalloc_MakeMallocFailAfterCount(int countdown) +{ + malloc_fail_countdown = countdown; +} + +#ifdef malloc +#undef malloc +#endif + +#ifdef free +#undef free +#endif + +#include +#include + +typedef struct GuardBytes +{ + int size; + char guard[sizeof(int)]; +} Guard; + + +static const char * end = "END"; + +void * unity_malloc(size_t size) +{ + char* mem; + Guard* guard; + + if (malloc_fail_countdown != MALLOC_DONT_FAIL) + { + if (malloc_fail_countdown == 0) + return 0; + malloc_fail_countdown--; + } + + malloc_count++; + + guard = (Guard*)malloc(size + sizeof(Guard) + 4); + guard->size = size; + mem = (char*)&(guard[1]); + memcpy(&mem[size], end, strlen(end) + 1); + + return (void*)mem; +} + +static int isOverrun(void * mem) +{ + Guard* guard = (Guard*)mem; + char* memAsChar = (char*)mem; + guard--; + + return strcmp(&memAsChar[guard->size], end) != 0; +} + +static void release_memory(void * mem) +{ + Guard* guard = (Guard*)mem; + guard--; + + malloc_count--; + free(guard); +} + +void unity_free(void * mem) +{ + int overrun = isOverrun(mem);//strcmp(&memAsChar[guard->size], end) != 0; + release_memory(mem); + if (overrun) + { + TEST_FAIL_MESSAGE("Buffer overrun detected during free()"); + } +} + +void* unity_calloc(size_t num, size_t size) +{ + void* mem = unity_malloc(num * size); + memset(mem, 0, num*size); + return mem; +} + +void* unity_realloc(void * oldMem, size_t size) +{ + Guard* guard = (Guard*)oldMem; +// char* memAsChar = (char*)oldMem; + void* newMem; + + if (oldMem == 0) + return unity_malloc(size); + + guard--; + if (isOverrun(oldMem)) + { + release_memory(oldMem); + TEST_FAIL_MESSAGE("Buffer overrun detected during realloc()"); + } + + if (size == 0) + { + release_memory(oldMem); + return 0; + } + + if (guard->size >= size) + return oldMem; + + newMem = unity_malloc(size); + memcpy(newMem, oldMem, size); + unity_free(oldMem); + return newMem; +} + + +//-------------------------------------------------------- +//Automatic pointer restoration functions +typedef struct _PointerPair +{ + struct _PointerPair * next; + void ** pointer; + void * old_value; +} PointerPair; + +enum {MAX_POINTERS=50}; +static PointerPair pointer_store[MAX_POINTERS]; +static int pointer_index = 0; + +void UnityPointer_Init() +{ + pointer_index = 0; +} + +void UnityPointer_Set(void ** pointer, void * newValue) +{ + if (pointer_index >= MAX_POINTERS) + TEST_FAIL_MESSAGE("Too many pointers set"); + + pointer_store[pointer_index].pointer = pointer; + pointer_store[pointer_index].old_value = *pointer; + *pointer = newValue; + pointer_index++; +} + +void UnityPointer_UndoAllSets() +{ + while (pointer_index > 0) + { + pointer_index--; + *(pointer_store[pointer_index].pointer) = + pointer_store[pointer_index].old_value; + + } +} + +int UnityFailureCount() +{ + return Unity.TestFailures; +} + +int UnityGetCommandLineOptions(int argc, char* argv[]) +{ + int i; + UnityFixture.Verbose = 0; + UnityFixture.GroupFilter = 0; + UnityFixture.NameFilter = 0; + UnityFixture.RepeatCount = 1; + + if (argc == 1) + return 0; + + for (i = 1; i < argc; ) + { + if (strcmp(argv[i], "-v") == 0) + { + UnityFixture.Verbose = 1; + i++; + } + else if (strcmp(argv[i], "-g") == 0) + { + i++; + if (i >= argc) + return 1; + UnityFixture.GroupFilter = argv[i]; + i++; + } + else if (strcmp(argv[i], "-n") == 0) + { + i++; + if (i >= argc) + return 1; + UnityFixture.NameFilter = argv[i]; + i++; + } + else if (strcmp(argv[i], "-r") == 0) + { + UnityFixture.RepeatCount = 2; + i++; + if (i < argc) + { + if (*(argv[i]) >= '0' && *(argv[i]) <= '9') + { + UnityFixture.RepeatCount = atoi(argv[i]); + i++; + } + } + } + } + return 0; +} + +void UnityConcludeFixtureTest() +{ + if (Unity.CurrentTestIgnored) + { + Unity.TestIgnores++; + } + else if (!Unity.CurrentTestFailed) + { + if (UnityFixture.Verbose) + { + UnityPrint(" PASS"); + UNITY_OUTPUT_CHAR('\n'); + } + } + else if (Unity.CurrentTestFailed) + { + Unity.TestFailures++; + } + + Unity.CurrentTestFailed = 0; + Unity.CurrentTestIgnored = 0; +} + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/extras/fixture/src/unity_fixture.h b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/extras/fixture/src/unity_fixture.h new file mode 100644 index 0000000..da1f871 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/extras/fixture/src/unity_fixture.h @@ -0,0 +1,81 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FIXTURE_H_ +#define UNITY_FIXTURE_H_ + +#include "unity.h" +#include "unity_internals.h" +#include "unity_fixture_malloc_overrides.h" +#include "unity_fixture_internals.h" + +int UnityMain(int argc, char* argv[], void (*runAllTests)()); + + +#define TEST_GROUP(group)\ + int TEST_GROUP_##group = 0 + +#define TEST_SETUP(group) void TEST_##group##_SETUP() + +#define TEST_TEAR_DOWN(group) void TEST_##group##_TEAR_DOWN() + + +#define TEST(group, name) \ + void TEST_##group##_##name##_();\ + void TEST_##group##_##name##_run()\ + {\ + UnityTestRunner(TEST_##group##_SETUP,\ + TEST_##group##_##name##_,\ + TEST_##group##_TEAR_DOWN,\ + "TEST(" #group ", " #name ")",\ + #group, #name,\ + __FILE__, __LINE__);\ + }\ + void TEST_##group##_##name##_() + +#define IGNORE_TEST(group, name) \ + void TEST_##group##_##name##_();\ + void TEST_##group##_##name##_run()\ + {\ + UnityIgnoreTest();\ + }\ + void TEST_##group##_##name##_() + +#define DECLARE_TEST_CASE(group, name) \ + void TEST_##group##_##name##_run() + +#define RUN_TEST_CASE(group, name) \ + DECLARE_TEST_CASE(group, name);\ + TEST_##group##_##name##_run(); + +//This goes at the bottom of each test file or in a separate c file +#define TEST_GROUP_RUNNER(group)\ + void TEST_##group##_GROUP_RUNNER_runAll();\ + void TEST_##group##_GROUP_RUNNER()\ + {\ + TEST_##group##_GROUP_RUNNER_runAll();\ + }\ + void TEST_##group##_GROUP_RUNNER_runAll() + +//Call this from main +#define RUN_TEST_GROUP(group)\ + void TEST_##group##_GROUP_RUNNER();\ + TEST_##group##_GROUP_RUNNER(); + +//CppUTest Compatibility Macros +#define UT_PTR_SET(ptr, newPointerValue) UnityPointer_Set((void**)&ptr, (void*)newPointerValue) +#define TEST_ASSERT_POINTERS_EQUAL(expected, actual) TEST_ASSERT_EQUAL_PTR(expected, actual) +#define TEST_ASSERT_BYTES_EQUAL(expected, actual) TEST_ASSERT_EQUAL_HEX8(0xff & (expected), 0xff & (actual)) +#define FAIL(message) TEST_FAIL((message)) +#define CHECK(condition) TEST_ASSERT_TRUE((condition)) +#define LONGS_EQUAL(expected, actual) TEST_ASSERT_EQUAL_INT((expected), (actual)) +#define STRCMP_EQUAL(expected, actual) TEST_ASSERT_EQUAL_STRING((expected), (actual)) +#define DOUBLES_EQUAL(expected, actual, delta) TEST_ASSERT_FLOAT_WITHIN(((expected), (actual), (delta)) + +void UnityMalloc_MakeMallocFailAfterCount(int count); + +#endif /* UNITY_FIXTURE_H_ */ diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/extras/fixture/src/unity_fixture_internals.h b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/extras/fixture/src/unity_fixture_internals.h new file mode 100644 index 0000000..db23f67 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/extras/fixture/src/unity_fixture_internals.h @@ -0,0 +1,44 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FIXTURE_INTERNALS_H_ +#define UNITY_FIXTURE_INTERNALS_H_ + +typedef struct _UNITY_FIXTURE_T +{ + int Verbose; + unsigned int RepeatCount; + const char* NameFilter; + const char* GroupFilter; +} UNITY_FIXTURE_T; + +typedef void unityfunction(); +void UnityTestRunner(unityfunction * setup, + unityfunction * body, + unityfunction * teardown, + const char * printableName, + const char * group, + const char * name, + const char * file, int line); + +void UnityIgnoreTest(); +void UnityMalloc_StartTest(); +void UnityMalloc_EndTest(); +int UnityFailureCount(); +int UnityGetCommandLineOptions(int argc, char* argv[]); +void UnityConcludeFixtureTest(); + +void UnityPointer_Set(void ** ptr, void * newValue); +void UnityPointer_UndoAllSets(); +void UnityPointer_Init(); + +void UnityAssertEqualPointer(const void * expected, + const void * actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +#endif /* UNITY_FIXTURE_INTERNALS_H_ */ diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h new file mode 100644 index 0000000..38f8e34 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h @@ -0,0 +1,16 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FIXTURE_MALLOC_OVERRIDES_H_ +#define UNITY_FIXTURE_MALLOC_OVERRIDES_H_ + +#define malloc unity_malloc +#define calloc unity_calloc +#define realloc unity_realloc +#define free unity_free + +#endif /* UNITY_FIXTURE_MALLOC_OVERRIDES_H_ */ diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/extras/fixture/test/main/AllTests.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/extras/fixture/test/main/AllTests.c new file mode 100644 index 0000000..ccb775b --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/extras/fixture/test/main/AllTests.c @@ -0,0 +1,21 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" + +static void runAllTests() +{ + RUN_TEST_GROUP(UnityFixture); + RUN_TEST_GROUP(UnityCommandOptions); + RUN_TEST_GROUP(LeakDetection) +} + +int main(int argc, char* argv[]) +{ + return UnityMain(argc, argv, runAllTests); +} + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/extras/fixture/test/testunity_fixture.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/extras/fixture/test/testunity_fixture.c new file mode 100644 index 0000000..de0c04c --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/extras/fixture/test/testunity_fixture.c @@ -0,0 +1,39 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" + +static int data = -1; + +TEST_GROUP(mygroup); + +TEST_SETUP(mygroup) +{ + data = 0; +} + +TEST_TEAR_DOWN(mygroup) +{ + data = -1; +} + +TEST(mygroup, test1) +{ + TEST_ASSERT_EQUAL_INT(0, data); +} + +TEST(mygroup, test2) +{ + TEST_ASSERT_EQUAL_INT(0, data); + data = 5; +} + +TEST(mygroup, test3) +{ + data = 7; + TEST_ASSERT_EQUAL_INT(7, data); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/extras/fixture/test/unity_fixture_Test.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/extras/fixture/test/unity_fixture_Test.c new file mode 100644 index 0000000..b8b4524 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/extras/fixture/test/unity_fixture_Test.c @@ -0,0 +1,321 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" +#include "unity_output_Spy.h" +#include +#include + +extern UNITY_FIXTURE_T UnityFixture; + +TEST_GROUP(UnityFixture); + +TEST_SETUP(UnityFixture) +{ +} + +TEST_TEAR_DOWN(UnityFixture) +{ +} + +int my_int; +int* pointer1 = 0; +int* pointer2 = (int*)2; +int* pointer3 = (int*)3; +int int1; +int int2; +int int3; +int int4; + +TEST(UnityFixture, PointerSetting) +{ + TEST_ASSERT_POINTERS_EQUAL(pointer1, 0); + UT_PTR_SET(pointer1, &int1); + UT_PTR_SET(pointer2, &int2); + UT_PTR_SET(pointer3, &int3); + TEST_ASSERT_POINTERS_EQUAL(pointer1, &int1); + TEST_ASSERT_POINTERS_EQUAL(pointer2, &int2); + TEST_ASSERT_POINTERS_EQUAL(pointer3, &int3); + UT_PTR_SET(pointer1, &int4); + UnityPointer_UndoAllSets(); + TEST_ASSERT_POINTERS_EQUAL(pointer1, 0); + TEST_ASSERT_POINTERS_EQUAL(pointer2, (int*)2); + TEST_ASSERT_POINTERS_EQUAL(pointer3, (int*)3); +} + +TEST(UnityFixture, ForceMallocFail) +{ + UnityMalloc_MakeMallocFailAfterCount(1); + void* m = malloc(10); + CHECK(m); + void* mfails = malloc(10); + TEST_ASSERT_POINTERS_EQUAL(0, mfails); + free(m); +} + +TEST(UnityFixture, ReallocSmallerIsUnchanged) +{ + void* m1 = malloc(10); + void* m2 = realloc(m1, 5); + TEST_ASSERT_POINTERS_EQUAL(m1, m2); + free(m2); +} + +TEST(UnityFixture, ReallocSameIsUnchanged) +{ + void* m1 = malloc(10); + void* m2 = realloc(m1, 10); + TEST_ASSERT_POINTERS_EQUAL(m1, m2); + free(m2); +} + +TEST(UnityFixture, ReallocLargerNeeded) +{ + void* m1 = malloc(10); + strcpy((char*)m1, "123456789"); + void* m2 = realloc(m1, 15); + CHECK(m1 != m2); + STRCMP_EQUAL("123456789", m2); + free(m2); +} + +TEST(UnityFixture, ReallocNullPointerIsLikeMalloc) +{ + void* m = realloc(0, 15); + CHECK(m != 0); + free(m); +} + +TEST(UnityFixture, ReallocSizeZeroFreesMemAndReturnsNullPointer) +{ + void* m1 = malloc(10); + void* m2 = realloc(m1, 0); + TEST_ASSERT_POINTERS_EQUAL(0, m2); +} + +TEST(UnityFixture, CallocFillsWithZero) +{ + void* m = calloc(3, sizeof(char)); + char* s = (char*)m; + TEST_ASSERT_BYTES_EQUAL(0, s[0]); + TEST_ASSERT_BYTES_EQUAL(0, s[1]); + TEST_ASSERT_BYTES_EQUAL(0, s[2]); + free(m); +} + +char *p1; +char *p2; + +TEST(UnityFixture, PointerSet) +{ + char c1; + char c2; + char newC1; + char newC2; + p1 = &c1; + p2 = &c2; + + UnityPointer_Init(10); + UT_PTR_SET(p1, &newC1); + UT_PTR_SET(p2, &newC2); + TEST_ASSERT_POINTERS_EQUAL(&newC1, p1); + TEST_ASSERT_POINTERS_EQUAL(&newC2, p2); + UnityPointer_UndoAllSets(); + TEST_ASSERT_POINTERS_EQUAL(&c1, p1); + TEST_ASSERT_POINTERS_EQUAL(&c2, p2); +} + +//------------------------------------------------------------ + +TEST_GROUP(UnityCommandOptions); + +int savedVerbose; +int savedRepeat; +const char* savedName; +const char* savedGroup; + +TEST_SETUP(UnityCommandOptions) +{ + savedVerbose = UnityFixture.Verbose; + savedRepeat = UnityFixture.RepeatCount; + savedName = UnityFixture.NameFilter; + savedGroup = UnityFixture.GroupFilter; +} + +TEST_TEAR_DOWN(UnityCommandOptions) +{ + UnityFixture.Verbose = savedVerbose; + UnityFixture.RepeatCount= savedRepeat; + UnityFixture.NameFilter = savedName; + UnityFixture.GroupFilter = savedGroup; +} + + +static char* noOptions[] = { + "testrunner.exe" +}; + +TEST(UnityCommandOptions, DefaultOptions) +{ + UnityGetCommandLineOptions(1, noOptions); + TEST_ASSERT_EQUAL(0, UnityFixture.Verbose); + TEST_ASSERT_POINTERS_EQUAL(0, UnityFixture.GroupFilter); + TEST_ASSERT_POINTERS_EQUAL(0, UnityFixture.NameFilter); + TEST_ASSERT_EQUAL(1, UnityFixture.RepeatCount); +} + +static char* verbose[] = { + "testrunner.exe", + "-v" +}; + +TEST(UnityCommandOptions, OptionVerbose) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(2, verbose)); + TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); +} + +static char* group[] = { + "testrunner.exe", + "-g", "groupname" +}; + +TEST(UnityCommandOptions, OptionSelectTestByGroup) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, group)); + STRCMP_EQUAL("groupname", UnityFixture.GroupFilter); +} + +static char* name[] = { + "testrunner.exe", + "-n", "testname" +}; + +TEST(UnityCommandOptions, OptionSelectTestByName) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, name)); + STRCMP_EQUAL("testname", UnityFixture.NameFilter); +} + +static char* repeat[] = { + "testrunner.exe", + "-r", "99" +}; + +TEST(UnityCommandOptions, OptionSelectRepeatTestsDefaultCount) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(2, repeat)); + TEST_ASSERT_EQUAL(2, UnityFixture.RepeatCount); +} + +TEST(UnityCommandOptions, OptionSelectRepeatTestsSpecificCount) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, repeat)); + TEST_ASSERT_EQUAL(99, UnityFixture.RepeatCount); +} + +static char* multiple[] = { + "testrunner.exe", + "-v", + "-g", "groupname", + "-n", "testname", + "-r", "98" +}; + +TEST(UnityCommandOptions, MultipleOptions) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(8, multiple)); + TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); + STRCMP_EQUAL("groupname", UnityFixture.GroupFilter); + STRCMP_EQUAL("testname", UnityFixture.NameFilter); + TEST_ASSERT_EQUAL(98, UnityFixture.RepeatCount); +} + +static char* dashRNotLast[] = { + "testrunner.exe", + "-v", + "-g", "gggg", + "-r", + "-n", "tttt", +}; + +TEST(UnityCommandOptions, MultipleOptionsDashRNotLastAndNoValueSpecified) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(7, dashRNotLast)); + TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); + STRCMP_EQUAL("gggg", UnityFixture.GroupFilter); + STRCMP_EQUAL("tttt", UnityFixture.NameFilter); + TEST_ASSERT_EQUAL(2, UnityFixture.RepeatCount); +} + + +//------------------------------------------------------------ + +TEST_GROUP(LeakDetection); + +TEST_SETUP(LeakDetection) +{ + UnityOutputCharSpy_Create(1000); +} + +TEST_TEAR_DOWN(LeakDetection) +{ + UnityOutputCharSpy_Destroy(); +} + +#define EXPECT_ABORT_BEGIN \ + { \ + jmp_buf TestAbortFrame; \ + memcpy(TestAbortFrame, Unity.AbortFrame, sizeof(jmp_buf)); \ + if (TEST_PROTECT()) \ + { + +#define EXPECT_ABORT_END \ + } \ + memcpy(Unity.AbortFrame, TestAbortFrame, sizeof(jmp_buf)); \ + } + +TEST(LeakDetection, DetectsLeak) +{ + void* m = malloc(10); + UnityOutputCharSpy_Enable(1); + EXPECT_ABORT_BEGIN + UnityMalloc_EndTest(); + EXPECT_ABORT_END + UnityOutputCharSpy_Enable(0); + CHECK(strstr(UnityOutputCharSpy_Get(), "This test leaks!")); + free(m); + Unity.CurrentTestFailed = 0; +} + +TEST(LeakDetection, BufferOverrunFoundDuringFree) +{ + void* m = malloc(10); + char* s = (char*)m; + s[10] = (char)0xFF; + UnityOutputCharSpy_Enable(1); + EXPECT_ABORT_BEGIN + free(m); + EXPECT_ABORT_END + UnityOutputCharSpy_Enable(0); + CHECK(strstr(UnityOutputCharSpy_Get(), "Buffer overrun detected during free()")); + Unity.CurrentTestFailed = 0; +} + +TEST(LeakDetection, BufferOverrunFoundDuringRealloc) +{ + void* m = malloc(10); + char* s = (char*)m; + s[10] = (char)0xFF; + UnityOutputCharSpy_Enable(1); + EXPECT_ABORT_BEGIN + m = realloc(m, 100); + EXPECT_ABORT_END + UnityOutputCharSpy_Enable(0); + CHECK(strstr(UnityOutputCharSpy_Get(), "Buffer overrun detected during realloc()")); + Unity.CurrentTestFailed = 0; +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c new file mode 100644 index 0000000..80fec09 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c @@ -0,0 +1,40 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" + +TEST_GROUP_RUNNER(UnityFixture) +{ + RUN_TEST_CASE(UnityFixture, PointerSetting); + RUN_TEST_CASE(UnityFixture, ForceMallocFail); + RUN_TEST_CASE(UnityFixture, ReallocSmallerIsUnchanged); + RUN_TEST_CASE(UnityFixture, ReallocSameIsUnchanged); + RUN_TEST_CASE(UnityFixture, ReallocLargerNeeded); + RUN_TEST_CASE(UnityFixture, ReallocNullPointerIsLikeMalloc); + RUN_TEST_CASE(UnityFixture, ReallocSizeZeroFreesMemAndReturnsNullPointer); + RUN_TEST_CASE(UnityFixture, CallocFillsWithZero); + RUN_TEST_CASE(UnityFixture, PointerSet); +} + +TEST_GROUP_RUNNER(UnityCommandOptions) +{ + RUN_TEST_CASE(UnityCommandOptions, DefaultOptions); + RUN_TEST_CASE(UnityCommandOptions, OptionVerbose); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectTestByGroup); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectTestByName); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectRepeatTestsDefaultCount); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectRepeatTestsSpecificCount); + RUN_TEST_CASE(UnityCommandOptions, MultipleOptions); + RUN_TEST_CASE(UnityCommandOptions, MultipleOptionsDashRNotLastAndNoValueSpecified); +} + +TEST_GROUP_RUNNER(LeakDetection) +{ + RUN_TEST_CASE(LeakDetection, DetectsLeak); + RUN_TEST_CASE(LeakDetection, BufferOverrunFoundDuringFree); + RUN_TEST_CASE(LeakDetection, BufferOverrunFoundDuringRealloc); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/extras/fixture/test/unity_output_Spy.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/extras/fixture/test/unity_output_Spy.c new file mode 100644 index 0000000..16faefa --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/extras/fixture/test/unity_output_Spy.c @@ -0,0 +1,56 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + + +#include "unity_output_Spy.h" +#include +#include +#include + +static int size; +static int count; +static char* buffer; +static int spy_enable; + +void UnityOutputCharSpy_Create(int s) +{ + size = s; + count = 0; + spy_enable = 0; + buffer = malloc(size); + memset(buffer, 0, size); +} + +void UnityOutputCharSpy_Destroy() +{ + size = 0; + free(buffer); +} + +int UnityOutputCharSpy_OutputChar(int c) +{ + if (spy_enable) + { + if (count < (size-1)) + buffer[count++] = c; + } + else + { + putchar(c); + } + return c; +} + +const char * UnityOutputCharSpy_Get() +{ + return buffer; +} + +void UnityOutputCharSpy_Enable(int enable) +{ + spy_enable = enable; +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/extras/fixture/test/unity_output_Spy.h b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/extras/fixture/test/unity_output_Spy.h new file mode 100644 index 0000000..7c1590e --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/extras/fixture/test/unity_output_Spy.h @@ -0,0 +1,17 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef D_unity_output_Spy_H +#define D_unity_output_Spy_H + +void UnityOutputCharSpy_Create(int s); +void UnityOutputCharSpy_Destroy(); +int UnityOutputCharSpy_OutputChar(int c); +const char * UnityOutputCharSpy_Get(); +void UnityOutputCharSpy_Enable(int enable); + +#endif diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/makefile b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/makefile new file mode 100644 index 0000000..8c8444b --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/makefile @@ -0,0 +1,35 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +C_COMPILER=gcc +TARGET_BASE = testunity +ifeq ($(OS),Windows_NT) + TARGET_EXTENSION=.exe +else + TARGET_EXTENSION=.out +endif +TARGET = $(TARGET_BASE)$(TARGET_EXTENSION) +OUT_FILE=-o $(TARGET) +SRC_FILES=src/unity.c test/testunity.c build/testunity_Runner.c +INC_DIRS=-Isrc +SYMBOLS=-DTEST -DUNITY_SUPPORT_64 + +ifeq ($(OS),Windows_NT) + CLEANUP = del /F /Q build\* && del /F /Q $(TARGET) +else + CLEANUP = rm -f build/*.o ; rm -f $(TARGET) +endif + +all: clean default + +default: + ruby auto/generate_test_runner.rb test/testunity.c build/testunity_Runner.c + $(C_COMPILER) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES) $(OUT_FILE) + $(TARGET) + +clean: + $(CLEANUP) + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/rakefile.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/rakefile.rb new file mode 100644 index 0000000..3ec5d5a --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/rakefile.rb @@ -0,0 +1,48 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require HERE + 'rakefile_helper' + +include RakefileHelpers + +# Load default configuration, for now +DEFAULT_CONFIG_FILE = 'gcc.yml' +configure_toolchain(DEFAULT_CONFIG_FILE) + +desc "Test unity with its own unit tests" +task :unit do + run_tests get_unit_test_files +end + +Rake::TestTask.new(:scripts) do |t| + t.pattern = 'test/test_*.rb' + t.verbose = true +end + +desc "Generate test summary" +task :summary do + report_summary +end + +desc "Build and test Unity" +task :all => [:clean, :scripts, :unit, :summary] +task :default => [:clobber, :all] +task :ci => [:no_color, :default] +task :cruise => [:no_color, :default] + +desc "Load configuration" +task :config, :config_file do |t, args| + configure_toolchain(args[:config_file]) +end + +task :no_color do + $colour_output = false +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/rakefile_helper.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/rakefile_helper.rb new file mode 100644 index 0000000..218fcaa --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/rakefile_helper.rb @@ -0,0 +1,243 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require 'yaml' +require 'fileutils' +require HERE+'auto/unity_test_summary' +require HERE+'auto/generate_test_runner' +require HERE+'auto/colour_reporter' + +module RakefileHelpers + + C_EXTENSION = '.c' + + def load_configuration(config_file) + unless ($configured) + $cfg_file = "targets/#{config_file}" unless (config_file =~ /[\\|\/]/) + $cfg = YAML.load(File.read($cfg_file)) + $colour_output = false unless $cfg['colour'] + $configured = true if (config_file != DEFAULT_CONFIG_FILE) + end + end + + def configure_clean + CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil? + end + + def configure_toolchain(config_file=DEFAULT_CONFIG_FILE) + config_file += '.yml' unless config_file =~ /\.yml$/ + config_file = config_file unless config_file =~ /[\\|\/]/ + load_configuration(config_file) + configure_clean + end + + def get_unit_test_files + path = $cfg['compiler']['unit_tests_path'] + 'test*' + C_EXTENSION + path.gsub!(/\\/, '/') + FileList.new(path) + end + + def get_local_include_dirs + include_dirs = $cfg['compiler']['includes']['items'].dup + include_dirs.delete_if {|dir| dir.is_a?(Array)} + return include_dirs + end + + def extract_headers(filename) + includes = [] + lines = File.readlines(filename) + lines.each do |line| + m = line.match(/^\s*#include\s+\"\s*(.+\.[hH])\s*\"/) + if not m.nil? + includes << m[1] + end + end + return includes + end + + def find_source_file(header, paths) + paths.each do |dir| + src_file = dir + header.ext(C_EXTENSION) + if (File.exists?(src_file)) + return src_file + end + end + return nil + end + + def tackit(strings) + if strings.is_a?(Array) + result = "\"#{strings.join}\"" + else + result = strings + end + return result + end + + def squash(prefix, items) + result = '' + items.each { |item| result += " #{prefix}#{tackit(item)}" } + return result + end + + def build_compiler_fields + command = tackit($cfg['compiler']['path']) + if $cfg['compiler']['defines']['items'].nil? + defines = '' + else + defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items']) + end + options = squash('', $cfg['compiler']['options']) + includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :defines => defines, :options => options, :includes => includes} + end + + def compile(file, defines=[]) + compiler = build_compiler_fields + cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{file} " + + "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" + + "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" + execute(cmd_str) + end + + def build_linker_fields + command = tackit($cfg['linker']['path']) + if $cfg['linker']['options'].nil? + options = '' + else + options = squash('', $cfg['linker']['options']) + end + if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?) + includes = '' + else + includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) + end + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :options => options, :includes => includes} + end + + def link(exe_name, obj_list) + linker = build_linker_fields + cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + + (obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).join + + $cfg['linker']['bin_files']['prefix'] + ' ' + + $cfg['linker']['bin_files']['destination'] + + exe_name + $cfg['linker']['bin_files']['extension'] + execute(cmd_str) + end + + def build_simulator_fields + return nil if $cfg['simulator'].nil? + if $cfg['simulator']['path'].nil? + command = '' + else + command = (tackit($cfg['simulator']['path']) + ' ') + end + if $cfg['simulator']['pre_support'].nil? + pre_support = '' + else + pre_support = squash('', $cfg['simulator']['pre_support']) + end + if $cfg['simulator']['post_support'].nil? + post_support = '' + else + post_support = squash('', $cfg['simulator']['post_support']) + end + return {:command => command, :pre_support => pre_support, :post_support => post_support} + end + + def execute(command_string, verbose=true) + report command_string + output = `#{command_string}`.chomp + report(output) if (verbose && !output.nil? && (output.length > 0)) + if $?.exitstatus != 0 + raise "Command failed. (Returned #{$?.exitstatus})" + end + return output + end + + def report_summary + summary = UnityTestSummary.new + summary.set_root_path(HERE) + results_glob = "#{$cfg['compiler']['build_path']}*.test*" + results_glob.gsub!(/\\/, '/') + results = Dir[results_glob] + summary.set_targets(results) + summary.run + end + + def run_tests(test_files) + report 'Running Unity system tests...' + + # Tack on TEST define for compiling unit tests + load_configuration($cfg_file) + test_defines = ['TEST'] + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + $cfg['compiler']['defines']['items'] << 'TEST' + + include_dirs = get_local_include_dirs + + # Build and execute each unit test + test_files.each do |test| + obj_list = [] + + # Detect dependencies and build required modules + extract_headers(test).each do |header| + # Compile corresponding source file if it exists + src_file = find_source_file(header, include_dirs) + if !src_file.nil? + compile(src_file, test_defines) + obj_list << header.ext($cfg['compiler']['object_files']['extension']) + end + end + + # Build the test runner (generate if configured to do so) + test_base = File.basename(test, C_EXTENSION) + + runner_name = test_base + '_Runner.c' + runner_path = '' + + if $cfg['compiler']['runner_path'].nil? + runner_path = $cfg['compiler']['build_path'] + runner_name + else + runner_path = $cfg['compiler']['runner_path'] + runner_name + end + + options = $cfg[:unity] + options[:use_param_tests] = (test =~ /parameterized/) ? true : false + UnityTestRunnerGenerator.new(options).run(test, runner_path) + + compile(runner_path, test_defines) + obj_list << runner_name.ext($cfg['compiler']['object_files']['extension']) + + # Build the test module + compile(test, test_defines) + obj_list << test_base.ext($cfg['compiler']['object_files']['extension']) + + # Link the test executable + link(test_base, obj_list) + + # Execute unit test and generate results file + simulator = build_simulator_fields + executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] + if simulator.nil? + cmd_str = executable + else + cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" + end + output = execute(cmd_str) + test_results = $cfg['compiler']['build_path'] + test_base + if output.match(/OK$/m).nil? + test_results += '.testfail' + else + test_results += '.testpass' + end + File.open(test_results, 'w') { |f| f.print output } + + end + end +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/release/build.info b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/release/build.info new file mode 100644 index 0000000..7871b21 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/release/build.info @@ -0,0 +1,2 @@ +118 + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/release/version.info b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/release/version.info new file mode 100644 index 0000000..0d71c08 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/release/version.info @@ -0,0 +1,2 @@ +2.0 + diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/src/unity.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/src/unity.c new file mode 100644 index 0000000..fa712c7 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/src/unity.c @@ -0,0 +1,855 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity.h" +#include +#include + +#define UNITY_FAIL_AND_BAIL { Unity.CurrentTestFailed = 1; UNITY_OUTPUT_CHAR('\n'); longjmp(Unity.AbortFrame, 1); } +#define UNITY_IGNORE_AND_BAIL { Unity.CurrentTestIgnored = 1; UNITY_OUTPUT_CHAR('\n'); longjmp(Unity.AbortFrame, 1); } +/// return prematurely if we are already in failure or ignore state +#define UNITY_SKIP_EXECUTION { if ((Unity.CurrentTestFailed != 0) || (Unity.CurrentTestIgnored != 0)) {return;} } +#define UNITY_PRINT_EOL { UNITY_OUTPUT_CHAR('\n'); } + +struct _Unity Unity = { 0 }; + +const char* UnityStrNull = "NULL"; +const char* UnityStrSpacer = ". "; +const char* UnityStrExpected = " Expected "; +const char* UnityStrWas = " Was "; +const char* UnityStrTo = " To "; +const char* UnityStrElement = " Element "; +const char* UnityStrMemory = " Memory Mismatch"; +const char* UnityStrDelta = " Values Not Within Delta "; +const char* UnityStrPointless= " You Asked Me To Compare Nothing, Which Was Pointless."; +const char* UnityStrNullPointerForExpected= " Expected pointer to be NULL"; +const char* UnityStrNullPointerForActual = " Actual pointer was NULL"; + +const _U_UINT UnitySizeMask[] = +{ + 255, + 65535, + 65535, + 4294967295u, + 4294967295u, + 4294967295u, + 4294967295u +#ifdef UNITY_SUPPORT_64 + ,0xFFFFFFFFFFFFFFFF +#endif +}; + +//----------------------------------------------- +// Pretty Printers & Test Result Output Handlers +//----------------------------------------------- + +void UnityPrint(const char* string) +{ + const char* pch = string; + + if (pch != NULL) + { + while (*pch) + { + // printable characters plus CR & LF are printed + if ((*pch <= 126) && (*pch >= 32)) + { + UNITY_OUTPUT_CHAR(*pch); + } + //write escaped carriage returns + else if (*pch == 13) + { + UNITY_OUTPUT_CHAR('\\'); + UNITY_OUTPUT_CHAR('r'); + } + //write escaped line feeds + else if (*pch == 10) + { + UNITY_OUTPUT_CHAR('\\'); + UNITY_OUTPUT_CHAR('n'); + } + // unprintable characters are shown as codes + else + { + UNITY_OUTPUT_CHAR('\\'); + UnityPrintNumberHex((_U_SINT)*pch, 2); + } + pch++; + } + } +} + +//----------------------------------------------- +void UnityPrintNumberByStyle(const _U_SINT number, const UNITY_DISPLAY_STYLE_T style) +{ + if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT) + { + UnityPrintNumber(number); + } + else if ((style & UNITY_DISPLAY_RANGE_UINT) == UNITY_DISPLAY_RANGE_UINT) + { + UnityPrintNumberUnsigned( (_U_UINT)number & UnitySizeMask[((_U_UINT)style & (_U_UINT)0x0F) - 1] ); + } + else + { + UnityPrintNumberHex((_U_UINT)number, (style & 0x000F) << 1); + } +} + +//----------------------------------------------- +/// basically do an itoa using as little ram as possible +void UnityPrintNumber(const _U_SINT number_to_print) +{ + _U_SINT divisor = 1; + _U_SINT next_divisor; + _U_SINT number = number_to_print; + + if (number < 0) + { + UNITY_OUTPUT_CHAR('-'); + number = -number; + } + + // figure out initial divisor + while (number / divisor > 9) + { + next_divisor = divisor * 10; + if (next_divisor > divisor) + divisor = next_divisor; + else + break; + } + + // now mod and print, then divide divisor + do + { + UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10))); + divisor /= 10; + } + while (divisor > 0); +} + +//----------------------------------------------- +/// basically do an itoa using as little ram as possible +void UnityPrintNumberUnsigned(const _U_UINT number) +{ + _U_UINT divisor = 1; + _U_UINT next_divisor; + + // figure out initial divisor + while (number / divisor > 9) + { + next_divisor = divisor * 10; + if (next_divisor > divisor) + divisor = next_divisor; + else + break; + } + + // now mod and print, then divide divisor + do + { + UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10))); + divisor /= 10; + } + while (divisor > 0); +} + +//----------------------------------------------- +void UnityPrintNumberHex(const _U_UINT number, const char nibbles_to_print) +{ + _U_UINT nibble; + char nibbles = nibbles_to_print; + UNITY_OUTPUT_CHAR('0'); + UNITY_OUTPUT_CHAR('x'); + + while (nibbles > 0) + { + nibble = (number >> (--nibbles << 2)) & 0x0000000F; + if (nibble <= 9) + { + UNITY_OUTPUT_CHAR((char)('0' + nibble)); + } + else + { + UNITY_OUTPUT_CHAR((char)('A' - 10 + nibble)); + } + } +} + +//----------------------------------------------- +void UnityPrintMask(const _U_UINT mask, const _U_UINT number) +{ + _U_UINT current_bit = (_U_UINT)1 << (UNITY_INT_WIDTH - 1); + _US32 i; + + for (i = 0; i < UNITY_INT_WIDTH; i++) + { + if (current_bit & mask) + { + if (current_bit & number) + { + UNITY_OUTPUT_CHAR('1'); + } + else + { + UNITY_OUTPUT_CHAR('0'); + } + } + else + { + UNITY_OUTPUT_CHAR('X'); + } + current_bit = current_bit >> 1; + } +} + +//----------------------------------------------- +#ifdef UNITY_FLOAT_VERBOSE +void UnityPrintFloat(_UF number) +{ + char TempBuffer[32]; + sprintf(TempBuffer, "%.6f", number); + UnityPrint(TempBuffer); +} +#endif + +//----------------------------------------------- +void UnityTestResultsBegin(const char* file, const UNITY_LINE_TYPE line) +{ + UnityPrint(file); + UNITY_OUTPUT_CHAR(':'); + UnityPrintNumber(line); + UNITY_OUTPUT_CHAR(':'); + UnityPrint(Unity.CurrentTestName); + UNITY_OUTPUT_CHAR(':'); +} + +//----------------------------------------------- +void UnityTestResultsFailBegin(const UNITY_LINE_TYPE line) +{ + UnityTestResultsBegin(Unity.TestFile, line); + UnityPrint("FAIL:"); +} + +//----------------------------------------------- +void UnityConcludeTest(void) +{ + if (Unity.CurrentTestIgnored) + { + Unity.TestIgnores++; + } + else if (!Unity.CurrentTestFailed) + { + UnityTestResultsBegin(Unity.TestFile, Unity.CurrentTestLineNumber); + UnityPrint("PASS"); + UNITY_PRINT_EOL; + } + else + { + Unity.TestFailures++; + } + + Unity.CurrentTestFailed = 0; + Unity.CurrentTestIgnored = 0; +} + +//----------------------------------------------- +void UnityAddMsgIfSpecified(const char* msg) +{ + if (msg) + { + UnityPrint(UnityStrSpacer); + UnityPrint(msg); + } +} + +//----------------------------------------------- +void UnityPrintExpectedAndActualStrings(const char* expected, const char* actual) +{ + UnityPrint(UnityStrExpected); + if (expected != NULL) + { + UNITY_OUTPUT_CHAR('\''); + UnityPrint(expected); + UNITY_OUTPUT_CHAR('\''); + } + else + { + UnityPrint(UnityStrNull); + } + UnityPrint(UnityStrWas); + if (actual != NULL) + { + UNITY_OUTPUT_CHAR('\''); + UnityPrint(actual); + UNITY_OUTPUT_CHAR('\''); + } + else + { + UnityPrint(UnityStrNull); + } +} + +//----------------------------------------------- +// Assertion & Control Helpers +//----------------------------------------------- + +int UnityCheckArraysForNull(const void* expected, const void* actual, const UNITY_LINE_TYPE lineNumber, const char* msg) +{ + //return true if they are both NULL + if ((expected == NULL) && (actual == NULL)) + return 1; + + //throw error if just expected is NULL + if (expected == NULL) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrNullPointerForExpected); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + //throw error if just actual is NULL + if (actual == NULL) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrNullPointerForActual); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + //return false if neither is NULL + return 0; +} + +//----------------------------------------------- +// Assertion Functions +//----------------------------------------------- + +void UnityAssertBits(const _U_SINT mask, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + UNITY_SKIP_EXECUTION; + + if ((mask & expected) != (mask & actual)) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrExpected); + UnityPrintMask(mask, expected); + UnityPrint(UnityStrWas); + UnityPrintMask(mask, actual); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualNumber(const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style) +{ + UNITY_SKIP_EXECUTION; + + if (expected != actual) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(expected, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(actual, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualIntArray(const _U_SINT* expected, + const _U_SINT* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style) +{ + _UU32 elements = num_elements; + const _US8* ptr_exp = (_US8*)expected; + const _US8* ptr_act = (_US8*)actual; + + UNITY_SKIP_EXECUTION; + + if (elements == 0) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + switch(style) + { + case UNITY_DISPLAY_STYLE_HEX8: + case UNITY_DISPLAY_STYLE_INT8: + case UNITY_DISPLAY_STYLE_UINT8: + while (elements--) + { + if (*ptr_exp != *ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 1; + ptr_act += 1; + } + break; + case UNITY_DISPLAY_STYLE_HEX16: + case UNITY_DISPLAY_STYLE_INT16: + case UNITY_DISPLAY_STYLE_UINT16: + while (elements--) + { + if (*(_US16*)ptr_exp != *(_US16*)ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*(_US16*)ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*(_US16*)ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 2; + ptr_act += 2; + } + break; +#ifdef UNITY_SUPPORT_64 + case UNITY_DISPLAY_STYLE_HEX64: + case UNITY_DISPLAY_STYLE_INT64: + case UNITY_DISPLAY_STYLE_UINT64: + while (elements--) + { + if (*(_US64*)ptr_exp != *(_US64*)ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*(_US64*)ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*(_US64*)ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 8; + ptr_act += 8; + } + break; +#endif + default: + while (elements--) + { + if (*(_US32*)ptr_exp != *(_US32*)ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*(_US32*)ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*(_US32*)ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 4; + ptr_act += 4; + } + break; + } +} + +//----------------------------------------------- +#ifndef UNITY_EXCLUDE_FLOAT +void UnityAssertEqualFloatArray(const _UF* expected, + const _UF* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UU32 elements = num_elements; + const _UF* ptr_expected = expected; + const _UF* ptr_actual = actual; + _UF diff, tol; + + UNITY_SKIP_EXECUTION; + + if (elements == 0) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + while (elements--) + { + diff = *ptr_expected - *ptr_actual; + if (diff < 0.0) + diff = 0.0 - diff; + tol = UNITY_FLOAT_PRECISION * *ptr_expected; + if (tol < 0.0) + tol = 0.0 - tol; + if (diff > tol) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); +#ifdef UNITY_FLOAT_VERBOSE + UnityPrint(UnityStrExpected); + UnityPrintFloat(*ptr_expected); + UnityPrint(UnityStrWas); + UnityPrintFloat(*ptr_actual); +#else + UnityPrint(UnityStrDelta); +#endif + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_expected++; + ptr_actual++; + } +} + +//----------------------------------------------- +void UnityAssertFloatsWithin(const _UF delta, + const _UF expected, + const _UF actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UF diff = actual - expected; + _UF pos_delta = delta; + + UNITY_SKIP_EXECUTION; + + if (diff < 0) + { + diff = 0.0f - diff; + } + if (pos_delta < 0) + { + pos_delta = 0.0f - pos_delta; + } + + if (pos_delta < diff) + { + UnityTestResultsFailBegin(lineNumber); +#ifdef UNITY_FLOAT_VERBOSE + UnityPrint(UnityStrExpected); + UnityPrintFloat(expected); + UnityPrint(UnityStrWas); + UnityPrintFloat(actual); +#else + UnityPrint(UnityStrDelta); +#endif + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} +#endif + +//----------------------------------------------- +void UnityAssertNumbersWithin( const _U_SINT delta, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style) +{ + UNITY_SKIP_EXECUTION; + + if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT) + { + if (actual > expected) + Unity.CurrentTestFailed = ((actual - expected) > delta); + else + Unity.CurrentTestFailed = ((expected - actual) > delta); + } + else + { + if ((_U_UINT)actual > (_U_UINT)expected) + Unity.CurrentTestFailed = ((_U_UINT)(actual - expected) > (_U_UINT)delta); + else + Unity.CurrentTestFailed = ((_U_UINT)(expected - actual) > (_U_UINT)delta); + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrDelta); + UnityPrintNumberByStyle(delta, style); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(expected, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(actual, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualString(const char* expected, + const char* actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UU32 i; + + UNITY_SKIP_EXECUTION; + + // if both pointers not null compare the strings + if (expected && actual) + { + for (i = 0; expected[i] || actual[i]; i++) + { + if (expected[i] != actual[i]) + { + Unity.CurrentTestFailed = 1; + break; + } + } + } + else + { // handle case of one pointers being null (if both null, test should pass) + if (expected != actual) + { + Unity.CurrentTestFailed = 1; + } + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrintExpectedAndActualStrings(expected, actual); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualStringArray( const char** expected, + const char** actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UU32 i, j = 0; + + UNITY_SKIP_EXECUTION; + + // if no elements, it's an error + if (num_elements == 0) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + do + { + // if both pointers not null compare the strings + if (expected[j] && actual[j]) + { + for (i = 0; expected[j][i] || actual[j][i]; i++) + { + if (expected[j][i] != actual[j][i]) + { + Unity.CurrentTestFailed = 1; + break; + } + } + } + else + { // handle case of one pointers being null (if both null, test should pass) + if (expected[j] != actual[j]) + { + Unity.CurrentTestFailed = 1; + } + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + if (num_elements > 1) + { + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - j - 1), UNITY_DISPLAY_STYLE_UINT); + } + UnityPrintExpectedAndActualStrings((const char*)(expected[j]), (const char*)(actual[j])); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + } while (++j < num_elements); +} + +//----------------------------------------------- +void UnityAssertEqualMemory( const void* expected, + const void* actual, + _UU32 length, + _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + unsigned char* expected_ptr = (unsigned char*)expected; + unsigned char* actual_ptr = (unsigned char*)actual; + _UU32 elements = num_elements; + + UNITY_SKIP_EXECUTION; + + if ((elements == 0) || (length == 0)) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + while (elements--) + { + if (memcmp((const void*)expected_ptr, (const void*)actual_ptr, length) != 0) + { + Unity.CurrentTestFailed = 1; + break; + } + expected_ptr += length; + actual_ptr += length; + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + if (num_elements > 1) + { + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + } + UnityPrint(UnityStrMemory); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +// Control Functions +//----------------------------------------------- + +void UnityFail(const char* msg, const UNITY_LINE_TYPE line) +{ + UNITY_SKIP_EXECUTION; + + UnityTestResultsBegin(Unity.TestFile, line); + UnityPrint("FAIL"); + if (msg != NULL) + { + UNITY_OUTPUT_CHAR(':'); + if (msg[0] != ' ') + { + UNITY_OUTPUT_CHAR(' '); + } + UnityPrint(msg); + } + UNITY_FAIL_AND_BAIL; +} + +//----------------------------------------------- +void UnityIgnore(const char* msg, const UNITY_LINE_TYPE line) +{ + UNITY_SKIP_EXECUTION; + + UnityTestResultsBegin(Unity.TestFile, line); + UnityPrint("IGNORE"); + if (msg != NULL) + { + UNITY_OUTPUT_CHAR(':'); + UNITY_OUTPUT_CHAR(' '); + UnityPrint(msg); + } + UNITY_IGNORE_AND_BAIL; +} + +//----------------------------------------------- +void setUp(void); +void tearDown(void); +void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum) +{ + Unity.CurrentTestName = FuncName; + Unity.CurrentTestLineNumber = FuncLineNum; + Unity.NumberOfTests++; + if (TEST_PROTECT()) + { + setUp(); + Func(); + } + if (TEST_PROTECT() && !(Unity.CurrentTestIgnored)) + { + tearDown(); + } + UnityConcludeTest(); +} + +//----------------------------------------------- +void UnityBegin(void) +{ + Unity.NumberOfTests = 0; +} + +//----------------------------------------------- +int UnityEnd(void) +{ + UnityPrint("-----------------------"); + UNITY_PRINT_EOL; + UnityPrintNumber(Unity.NumberOfTests); + UnityPrint(" Tests "); + UnityPrintNumber(Unity.TestFailures); + UnityPrint(" Failures "); + UnityPrintNumber(Unity.TestIgnores); + UnityPrint(" Ignored"); + UNITY_PRINT_EOL; + if (Unity.TestFailures == 0U) + { + UnityPrint("OK"); + } + else + { + UnityPrint("FAIL"); + } + UNITY_PRINT_EOL; + return Unity.TestFailures; +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/src/unity.h b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/src/unity.h new file mode 100644 index 0000000..0b1b187 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/src/unity.h @@ -0,0 +1,213 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FRAMEWORK_H +#define UNITY_FRAMEWORK_H + +#define UNITY + +#include "unity_internals.h" + +//------------------------------------------------------- +// Configuration Options +//------------------------------------------------------- + +// Integers +// - Unity assumes 32 bit integers by default +// - If your compiler treats ints of a different size, define UNITY_INT_WIDTH + +// Floats +// - define UNITY_EXCLUDE_FLOAT to disallow floating point comparisons +// - define UNITY_FLOAT_PRECISION to specify the precision to use when doing TEST_ASSERT_EQUAL_FLOAT +// - define UNITY_FLOAT_TYPE to specify doubles instead of single precision floats +// - define UNITY_FLOAT_VERBOSE to print floating point values in errors (uses sprintf) + +// Output +// - by default, Unity prints to standard out with putchar. define UNITY_OUTPUT_CHAR(a) with a different function if desired + +// Optimization +// - by default, line numbers are stored in unsigned shorts. Define UNITY_LINE_TYPE with a different type if your files are huge +// - by default, test and failure counters are unsigned shorts. Define UNITY_COUNTER_TYPE with a different type if you want to save space or have more than 65535 Tests. + +// Test Cases +// - define UNITY_SUPPORT_TEST_CASES to include the TEST_CASE macro, though really it's mostly about the runner generator script + +// Parameterized Tests +// - you'll want to create a define of TEST_CASE(...) which basically evaluates to nothing + +//------------------------------------------------------- +// Test Running Macros +//------------------------------------------------------- + +#define TEST_PROTECT() (setjmp(Unity.AbortFrame) == 0) + +#define TEST_ABORT() {longjmp(Unity.AbortFrame, 1);} + +#ifndef RUN_TEST +#define RUN_TEST(func, line_num) UnityDefaultTestRun(func, #func, line_num) +#endif + +#define TEST_LINE_NUM (Unity.CurrentTestLineNumber) +#define TEST_IS_IGNORED (Unity.CurrentTestIgnored) + +//------------------------------------------------------- +// Basic Fail and Ignore +//------------------------------------------------------- + +#define TEST_FAIL_MESSAGE(message) UNITY_TEST_FAIL(__LINE__, message) +#define TEST_FAIL() UNITY_TEST_FAIL(__LINE__, NULL) +#define TEST_IGNORE_MESSAGE(message) UNITY_TEST_IGNORE(__LINE__, message) +#define TEST_IGNORE() UNITY_TEST_IGNORE(__LINE__, NULL) +#define TEST_ONLY() + +//------------------------------------------------------- +// Test Asserts (simple) +//------------------------------------------------------- + +//Boolean +#define TEST_ASSERT(condition) UNITY_TEST_ASSERT( (condition), __LINE__, " Expression Evaluated To FALSE") +#define TEST_ASSERT_TRUE(condition) UNITY_TEST_ASSERT( (condition), __LINE__, " Expected TRUE Was FALSE") +#define TEST_ASSERT_UNLESS(condition) UNITY_TEST_ASSERT( !(condition), __LINE__, " Expression Evaluated To TRUE") +#define TEST_ASSERT_FALSE(condition) UNITY_TEST_ASSERT( !(condition), __LINE__, " Expected FALSE Was TRUE") +#define TEST_ASSERT_NULL(pointer) UNITY_TEST_ASSERT_NULL( (pointer), __LINE__, " Expected NULL") +#define TEST_ASSERT_NOT_NULL(pointer) UNITY_TEST_ASSERT_NOT_NULL((pointer), __LINE__, " Expected Non-NULL") + +//Integers (of all sizes) +#define TEST_ASSERT_EQUAL_INT(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT8(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT8((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT16(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT16((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT32(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT32((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT64(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT64((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_NOT_EQUAL(expected, actual) UNITY_TEST_ASSERT(((expected) != (actual)), __LINE__, " Expected Not-Equal") +#define TEST_ASSERT_EQUAL_UINT(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT8(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT8( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT16(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT16( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT32(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT32( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT64(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT64( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX8(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX8( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX16(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX16((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX32(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX64(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX64((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_BITS(mask, expected, actual) UNITY_TEST_ASSERT_BITS((mask), (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_BITS_HIGH(mask, actual) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(-1), (actual), __LINE__, NULL) +#define TEST_ASSERT_BITS_LOW(mask, actual) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(0), (actual), __LINE__, NULL) +#define TEST_ASSERT_BIT_HIGH(bit, actual) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(-1), (actual), __LINE__, NULL) +#define TEST_ASSERT_BIT_LOW(bit, actual) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(0), (actual), __LINE__, NULL) + +//Integer Ranges (of all sizes) +#define TEST_ASSERT_INT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_UINT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX8_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX16_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX32_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX64_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, __LINE__, NULL) + +//Structs and Strings +#define TEST_ASSERT_EQUAL_PTR(expected, actual) UNITY_TEST_ASSERT_EQUAL_PTR((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_STRING(expected, actual) UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_MEMORY(expected, actual, len) UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, __LINE__, NULL) + +//Arrays +#define TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements) UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, __LINE__, NULL) + +//Floating Point (If Enabled) +#define TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_FLOAT(expected, actual) UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, __LINE__, NULL) + +//------------------------------------------------------- +// Test Asserts (with additional messages) +//------------------------------------------------------- + +//Boolean +#define TEST_ASSERT_MESSAGE(condition, message) UNITY_TEST_ASSERT( (condition), __LINE__, message) +#define TEST_ASSERT_TRUE_MESSAGE(condition, message) UNITY_TEST_ASSERT( (condition), __LINE__, message) +#define TEST_ASSERT_UNLESS_MESSAGE(condition, message) UNITY_TEST_ASSERT( !(condition), __LINE__, message) +#define TEST_ASSERT_FALSE_MESSAGE(condition, message) UNITY_TEST_ASSERT( !(condition), __LINE__, message) +#define TEST_ASSERT_NULL_MESSAGE(pointer, message) UNITY_TEST_ASSERT_NULL( (pointer), __LINE__, message) +#define TEST_ASSERT_NOT_NULL_MESSAGE(pointer, message) UNITY_TEST_ASSERT_NOT_NULL((pointer), __LINE__, message) + +//Integers (of all sizes) +#define TEST_ASSERT_EQUAL_INT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT8((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT16((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT32((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT64((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, message) +#define TEST_ASSERT_NOT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT(((expected) != (actual)), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT8( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT16( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT32( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT64( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX8( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX16((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX64((expected), (actual), __LINE__, message) +#define TEST_ASSERT_BITS_MESSAGE(mask, expected, actual, message) UNITY_TEST_ASSERT_BITS((mask), (expected), (actual), __LINE__, message) +#define TEST_ASSERT_BITS_HIGH_MESSAGE(mask, actual, message) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(-1), (actual), __LINE__, message) +#define TEST_ASSERT_BITS_LOW_MESSAGE(mask, actual, message) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(0), (actual), __LINE__, message) +#define TEST_ASSERT_BIT_HIGH_MESSAGE(bit, actual, message) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(-1), (actual), __LINE__, message) +#define TEST_ASSERT_BIT_LOW_MESSAGE(bit, actual, message) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(0), (actual), __LINE__, message) + +//Integer Ranges (of all sizes) +#define TEST_ASSERT_INT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_UINT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX8_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX16_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX32_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX64_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, __LINE__, message) + +//Structs and Strings +#define TEST_ASSERT_EQUAL_PTR_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_PTR(expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_STRING_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_MEMORY_MESSAGE(expected, actual, len, message) UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, __LINE__, message) + +//Arrays +#define TEST_ASSERT_EQUAL_INT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_STRING_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_MEMORY_ARRAY_MESSAGE(expected, actual, len, num_elements, message) UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, __LINE__, message) + +//Floating Point (If Enabled) +#define TEST_ASSERT_FLOAT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_FLOAT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_FLOAT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, __LINE__, message) +#endif diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/src/unity_internals.h b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/src/unity_internals.h new file mode 100644 index 0000000..29c9d1d --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/src/unity_internals.h @@ -0,0 +1,355 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_INTERNALS_H +#define UNITY_INTERNALS_H + +#include +#include + +//------------------------------------------------------- +// Int Support +//------------------------------------------------------- + +#ifndef UNITY_INT_WIDTH +#define UNITY_INT_WIDTH (32) +#endif + +#ifndef UNITY_LONG_WIDTH +#define UNITY_LONG_WIDTH (32) +#endif + +#if (UNITY_INT_WIDTH == 32) + typedef unsigned char _UU8; + typedef unsigned short _UU16; + typedef unsigned int _UU32; + typedef signed char _US8; + typedef signed short _US16; + typedef signed int _US32; +#elif (UNITY_INT_WIDTH == 16) + typedef unsigned char _UU8; + typedef unsigned int _UU16; + typedef unsigned long _UU32; + typedef signed char _US8; + typedef signed int _US16; + typedef signed long _US32; +#else + #error Invalid UNITY_INT_WIDTH specified! (16 or 32 are supported) +#endif + +//------------------------------------------------------- +// 64-bit Support +//------------------------------------------------------- + +#ifndef UNITY_SUPPORT_64 + +//No 64-bit Support +typedef _UU32 _U_UINT; +typedef _US32 _U_SINT; + +#else + +//64-bit Support +#if (UNITY_LONG_WIDTH == 32) + typedef unsigned long long _UU64; + typedef signed long long _US64; +#elif (UNITY_LONG_WIDTH == 64) + typedef unsigned long _UU64; + typedef signed long _US64; +#else + #error Invalid UNITY_LONG_WIDTH specified! (32 or 64 are supported) +#endif +typedef _UU64 _U_UINT; +typedef _US64 _U_SINT; + +#endif + +//------------------------------------------------------- +// Pointer Support +//------------------------------------------------------- + +#ifndef UNITY_POINTER_WIDTH +#define UNITY_POINTER_WIDTH (32) +#endif + +#if (UNITY_POINTER_WIDTH == 32) + typedef _UU32 _UP; +#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX32 +#elif (UNITY_POINTER_WIDTH == 64) + typedef _UU64 _UP; +#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX64 +#elif (UNITY_POINTER_WIDTH == 16) + typedef _UU16 _UP; +#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX16 +#else + #error Invalid UNITY_POINTER_WIDTH specified! (16, 32 or 64 are supported) +#endif + +//------------------------------------------------------- +// Float Support +//------------------------------------------------------- + +#ifdef UNITY_EXCLUDE_FLOAT + +//No Floating Point Support +#undef UNITY_FLOAT_PRECISION +#undef UNITY_FLOAT_TYPE +#undef UNITY_FLOAT_VERBOSE + +#else + +//Floating Point Support +#ifndef UNITY_FLOAT_PRECISION +#define UNITY_FLOAT_PRECISION (0.00001f) +#endif +#ifndef UNITY_FLOAT_TYPE +#define UNITY_FLOAT_TYPE float +#endif +typedef UNITY_FLOAT_TYPE _UF; + +#endif + +//------------------------------------------------------- +// Output Method +//------------------------------------------------------- + +#ifndef UNITY_OUTPUT_CHAR +//Default to using putchar, which is defined in stdio.h above +#define UNITY_OUTPUT_CHAR(a) putchar(a) +#else +//If defined as something else, make sure we declare it here so it's ready for use +extern int UNITY_OUTPUT_CHAR(int); +#endif + +//------------------------------------------------------- +// Footprint +//------------------------------------------------------- + +#ifndef UNITY_LINE_TYPE +#define UNITY_LINE_TYPE unsigned short +#endif + +#ifndef UNITY_COUNTER_TYPE +#define UNITY_COUNTER_TYPE unsigned short +#endif + +//------------------------------------------------------- +// Internal Structs Needed +//------------------------------------------------------- + +typedef void (*UnityTestFunction)(void); + +#define UNITY_DISPLAY_RANGE_INT (0x10) +#define UNITY_DISPLAY_RANGE_UINT (0x20) +#define UNITY_DISPLAY_RANGE_HEX (0x40) +#define UNITY_DISPLAY_RANGE_AUTO (0x80) + +typedef enum +{ + UNITY_DISPLAY_STYLE_INT = 4 + UNITY_DISPLAY_RANGE_INT + UNITY_DISPLAY_RANGE_AUTO, + UNITY_DISPLAY_STYLE_INT8 = 1 + UNITY_DISPLAY_RANGE_INT, + UNITY_DISPLAY_STYLE_INT16 = 2 + UNITY_DISPLAY_RANGE_INT, + UNITY_DISPLAY_STYLE_INT32 = 4 + UNITY_DISPLAY_RANGE_INT, +#ifdef UNITY_SUPPORT_64 + UNITY_DISPLAY_STYLE_INT64 = 8 + UNITY_DISPLAY_RANGE_INT, +#endif + UNITY_DISPLAY_STYLE_UINT = 4 + UNITY_DISPLAY_RANGE_UINT + UNITY_DISPLAY_RANGE_AUTO, + UNITY_DISPLAY_STYLE_UINT8 = 1 + UNITY_DISPLAY_RANGE_UINT, + UNITY_DISPLAY_STYLE_UINT16 = 2 + UNITY_DISPLAY_RANGE_UINT, + UNITY_DISPLAY_STYLE_UINT32 = 4 + UNITY_DISPLAY_RANGE_UINT, +#ifdef UNITY_SUPPORT_64 + UNITY_DISPLAY_STYLE_UINT64 = 8 + UNITY_DISPLAY_RANGE_UINT, +#endif + UNITY_DISPLAY_STYLE_HEX8 = 1 + UNITY_DISPLAY_RANGE_HEX, + UNITY_DISPLAY_STYLE_HEX16 = 2 + UNITY_DISPLAY_RANGE_HEX, + UNITY_DISPLAY_STYLE_HEX32 = 4 + UNITY_DISPLAY_RANGE_HEX, +#ifdef UNITY_SUPPORT_64 + UNITY_DISPLAY_STYLE_HEX64 = 8 + UNITY_DISPLAY_RANGE_HEX, +#endif +} UNITY_DISPLAY_STYLE_T; + +struct _Unity +{ + const char* TestFile; + const char* CurrentTestName; + _UU32 CurrentTestLineNumber; + UNITY_COUNTER_TYPE NumberOfTests; + UNITY_COUNTER_TYPE TestFailures; + UNITY_COUNTER_TYPE TestIgnores; + UNITY_COUNTER_TYPE CurrentTestFailed; + UNITY_COUNTER_TYPE CurrentTestIgnored; + jmp_buf AbortFrame; +}; + +extern struct _Unity Unity; + +//------------------------------------------------------- +// Test Suite Management +//------------------------------------------------------- + +void UnityBegin(void); +int UnityEnd(void); +void UnityConcludeTest(void); +void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum); + +//------------------------------------------------------- +// Test Output +//------------------------------------------------------- + +void UnityPrint(const char* string); +void UnityPrintMask(const _U_UINT mask, const _U_UINT number); +void UnityPrintNumberByStyle(const _U_SINT number, const UNITY_DISPLAY_STYLE_T style); +void UnityPrintNumber(const _U_SINT number); +void UnityPrintNumberUnsigned(const _U_UINT number); +void UnityPrintNumberHex(const _U_UINT number, const char nibbles); + +#ifdef UNITY_FLOAT_VERBOSE +void UnityPrintFloat(const _UF number); +#endif + +//------------------------------------------------------- +// Test Assertion Fuctions +//------------------------------------------------------- +// Use the macros below this section instead of calling +// these directly. The macros have a consistent naming +// convention and will pull in file and line information +// for you. + +void UnityAssertEqualNumber(const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style); + +void UnityAssertEqualIntArray(const _U_SINT* expected, + const _U_SINT* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style); + +void UnityAssertBits(const _U_SINT mask, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualString(const char* expected, + const char* actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualStringArray( const char** expected, + const char** actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualMemory( const void* expected, + const void* actual, + const _UU32 length, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertNumbersWithin(const _U_SINT delta, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style); + +void UnityFail(const char* message, const UNITY_LINE_TYPE line); + +void UnityIgnore(const char* message, const UNITY_LINE_TYPE line); + +#ifndef UNITY_EXCLUDE_FLOAT +void UnityAssertFloatsWithin(const _UF delta, + const _UF expected, + const _UF actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualFloatArray(const _UF* expected, + const _UF* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber); +#endif + +//------------------------------------------------------- +// Basic Fail and Ignore +//------------------------------------------------------- + +#define UNITY_TEST_FAIL(line, message) UnityFail( (message), (UNITY_LINE_TYPE)line); +#define UNITY_TEST_IGNORE(line, message) UnityIgnore( (message), (UNITY_LINE_TYPE)line); + +//------------------------------------------------------- +// Test Asserts +//------------------------------------------------------- + +#define UNITY_TEST_ASSERT(condition, line, message) if (condition) {} else {UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, message);} +#define UNITY_TEST_ASSERT_NULL(pointer, line, message) UNITY_TEST_ASSERT(((pointer) == NULL), (UNITY_LINE_TYPE)line, message) +#define UNITY_TEST_ASSERT_NOT_NULL(pointer, line, message) UNITY_TEST_ASSERT(((pointer) != NULL), (UNITY_LINE_TYPE)line, message) + +#define UNITY_TEST_ASSERT_EQUAL_INT(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_UINT(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_HEX8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX8) +#define UNITY_TEST_ASSERT_EQUAL_HEX16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX16) +#define UNITY_TEST_ASSERT_EQUAL_HEX32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX32) +#define UNITY_TEST_ASSERT_BITS(mask, expected, actual, line, message) UnityAssertBits((_U_SINT)(mask), (_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line) + +#define UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX8) +#define UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX16) +#define UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX32) +#define UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64) + +#define UNITY_TEST_ASSERT_EQUAL_PTR(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(_UP)(expected), (_U_SINT)(_UP)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_POINTER) +#define UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, line, message) UnityAssertEqualString((const char*)(expected), (const char*)(actual), (message), (UNITY_LINE_TYPE)line) +#define UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, line, message) UnityAssertEqualMemory((void*)(expected), (void*)(actual), (_UU32)(len), 1, (message), (UNITY_LINE_TYPE)line) + +#define UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT8) +#define UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT16) +#define UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT32) +#define UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT8) +#define UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT16) +#define UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT32) +#define UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX8) +#define UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX16) +#define UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX32) +#define UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualStringArray((const char**)(expected), (const char**)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line) +#define UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, line, message) UnityAssertEqualMemory((void*)(expected), (void*)(actual), (_UU32)(len), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line) + +#ifdef UNITY_SUPPORT_64 +#define UNITY_TEST_ASSERT_EQUAL_INT64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT64) +#define UNITY_TEST_ASSERT_EQUAL_UINT64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT64) +#define UNITY_TEST_ASSERT_EQUAL_HEX64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64) +#define UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT64) +#define UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT64) +#define UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64) +#endif + +#ifdef UNITY_EXCLUDE_FLOAT +#define UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled") +#define UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled") +#define UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled") +#else +#define UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, line, message) UnityAssertFloatsWithin((_UF)(delta), (_UF)(expected), (_UF)(actual), (message), (UNITY_LINE_TYPE)line) +#define UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, line, message) UNITY_TEST_ASSERT_FLOAT_WITHIN((_UF)(expected) * (_UF)UNITY_FLOAT_PRECISION, (_UF)expected, (_UF)actual, (UNITY_LINE_TYPE)line, message) +#define UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualFloatArray((_UF*)(expected), (_UF*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line) +#endif + +#endif diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/targets/gcc.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/targets/gcc.yml new file mode 100644 index 0000000..0f18c6c --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/targets/gcc.yml @@ -0,0 +1,42 @@ +compiler: + path: gcc + source_path: 'src/' + unit_tests_path: &unit_tests_path 'test/' + build_path: &build_path 'build/' + options: + - '-c' + - '-Wall' + - '-Wno-address' + - '-std=c99' + - '-pedantic' + includes: + prefix: '-I' + items: + - 'src/' + - '../src/' + - *unit_tests_path + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - UNITY_SUPPORT_TEST_CASES + object_files: + prefix: '-o' + extension: '.o' + destination: *build_path +linker: + path: gcc + options: + - -lm + includes: + prefix: '-I' + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.exe' + destination: *build_path +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/targets/gcc_64.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/targets/gcc_64.yml new file mode 100644 index 0000000..97cb958 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/targets/gcc_64.yml @@ -0,0 +1,43 @@ +compiler: + path: gcc + source_path: 'src/' + unit_tests_path: &unit_tests_path 'test/' + build_path: &build_path 'build/' + options: + - '-c' + - '-Wall' + - '-Wno-address' + - '-std=c99' + - '-pedantic' + includes: + prefix: '-I' + items: + - 'src/' + - '../src/' + - *unit_tests_path + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - UNITY_SUPPORT_TEST_CASES + - 'UNITY_POINTER_WIDTH=64' + object_files: + prefix: '-o' + extension: '.o' + destination: *build_path +linker: + path: gcc + options: + - -lm + includes: + prefix: '-I' + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.exe' + destination: *build_path +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/targets/hitech_picc18.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/targets/hitech_picc18.yml new file mode 100644 index 0000000..210d944 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/targets/hitech_picc18.yml @@ -0,0 +1,101 @@ +# rumor has it that this yaml file works for the standard edition of the +# hitech PICC18 compiler, but not the pro version. +# +compiler: + path: cd build && picc18 + source_path: 'c:\Projects\NexGen\Prototypes\CMockTest\src\' + unit_tests_path: &unit_tests_path 'c:\Projects\NexGen\Prototypes\CMockTest\test\' + build_path: &build_path 'c:\Projects\NexGen\Prototypes\CMockTest\build\' + options: + - --chip=18F87J10 + - --ide=hitide + - --q #quiet please + - --asmlist + - --codeoffset=0 + - --emi=wordwrite # External memory interface protocol + - --warn=0 # allow all normal warning messages + - --errors=10 # Number of errors before aborting compile + - --char=unsigned + - -Bl # Large memory model + - -G # generate symbol file + - --cp=16 # 16-bit pointers + - --double=24 + - -N255 # 255-char symbol names + - --opt=none # Do not use any compiler optimziations + - -c # compile only + - -M + includes: + prefix: '-I' + items: + - 'c:/Projects/NexGen/Prototypes/CMockTest/src/' + - 'c:/Projects/NexGen/Prototypes/CMockTest/mocks/' + - 'c:/CMock/src/' + - 'c:/CMock/examples/src/' + - 'c:/CMock/vendor/unity/src/' + - 'c:/CMock/vendor/unity/examples/helper/' + - *unit_tests_path + defines: + prefix: '-D' + items: + - UNITY_INT_WIDTH=16 + - UNITY_POINTER_WIDTH=16 + - CMOCK_MEM_STATIC + - CMOCK_MEM_SIZE=3000 + - UNITY_SUPPORT_TEST_CASES + - _PICC18 + object_files: + # prefix: '-O' # Hi-Tech doesn't want a prefix. They key off of filename .extensions, instead + extension: '.obj' + destination: *build_path + +linker: + path: cd build && picc18 + options: + - --chip=18F87J10 + - --ide=hitide + - --cp=24 # 24-bit pointers. Is this needed for linker?? + - --double=24 # Is this needed for linker?? + - -Lw # Scan the pic87*w.lib in the lib/ of the compiler installation directory + - --summary=mem,file # info listing + - --summary=+psect + - --summary=+hex + - --output=+intel + - --output=+mcof + - --runtime=+init # Directs startup code to copy idata, ibigdata and ifardata psects from ROM to RAM. + - --runtime=+clear # Directs startup code to clear bss, bigbss, rbss and farbss psects + - --runtime=+clib # link in the c-runtime + - --runtime=+keep # Keep the generated startup src after its obj is linked + - -G # Generate src-level symbol file + - -MIWasTheLastToBuild.map + - --warn=0 # allow all normal warning messages + - -Bl # Large memory model (probably not needed for linking) + includes: + prefix: '-I' + object_files: + path: *build_path + extension: '.obj' + bin_files: + prefix: '-O' + extension: '.hex' + destination: *build_path + +simulator: + path: + pre_support: + - 'java -client -jar ' # note space + - ['C:\Program Files\HI-TECH Software\HI-TIDE\3.15\lib\', 'simpic18.jar'] + - 18F87J10 + post_support: + +:cmock: + :plugins: [] + :includes: + - Types.h + :suite_teardown: | + if (num_failures) + _FAILED_TEST(); + else + _PASSED_TESTS(); + return 0; + +colour: true \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/targets/iar_arm_v4.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/targets/iar_arm_v4.yml new file mode 100644 index 0000000..c2e7f18 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/targets/iar_arm_v4.yml @@ -0,0 +1,89 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 4.0 Kickstart\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\lib\dl4tptinl8n.h'] + - -z3 + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian little + - --cpu ARM7TDMI + - --stack_align 4 + - --interwork + - -e + - --silent + - --warnings_are_errors + - --fpu None + - --diag_suppress Pa050 + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'common\bin\xlink.exe'] + options: + - -rt + - [*tools_root, 'arm\lib\dl4tptinl8n.r79'] + - -D_L_EXTMEM_START=0 + - -D_L_EXTMEM_SIZE=0 + - -D_L_HEAP_SIZE=120 + - -D_L_STACK_SIZE=32 + - -e_small_write=_formatted_write + - -s + - __program_start + - -f + - [*tools_root, '\arm\config\lnkarm.xcl'] + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\config\'] + - [*tools_root, 'arm\lib\'] + object_files: + path: *build_path + extension: '.r79' + bin_files: + prefix: '-o' + extension: '.d79' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\ioat91sam7X256.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/targets/iar_arm_v5.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/targets/iar_arm_v5.yml new file mode 100644 index 0000000..0549d8e --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/targets/iar_arm_v5.yml @@ -0,0 +1,79 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian=little + - --cpu=ARM7TDMI + - --interwork + - --warnings_are_errors + - --fpu=None + - --diag_suppress=Pa050 + - --diag_suppress=Pe111 + - -e + - -On + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\debugger\atmel\ioat91sam7X256.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/targets/iar_arm_v5_3.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/targets/iar_arm_v5_3.yml new file mode 100644 index 0000000..0549d8e --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/targets/iar_arm_v5_3.yml @@ -0,0 +1,79 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian=little + - --cpu=ARM7TDMI + - --interwork + - --warnings_are_errors + - --fpu=None + - --diag_suppress=Pa050 + - --diag_suppress=Pe111 + - -e + - -On + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\debugger\atmel\ioat91sam7X256.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml new file mode 100644 index 0000000..eb0785c --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml @@ -0,0 +1,93 @@ +#Default tool path for IAR 5.4 on Windows XP 64bit +tools_root: &tools_root 'C:\Program Files (x86)\IAR Systems\Embedded Workbench 5.4 Kickstart\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --diag_suppress=Pa050 + #- --diag_suppress=Pe111 + - --debug + - --endian=little + - --cpu=Cortex-M3 + - --no_path_in_file_macros + - -e + - --fpu=None + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + #- --preinclude --preinclude C:\Vss\T2 Working\common\system.h + - --interwork + - --warnings_are_errors +# - Ohz + - -Oh +# - --no_cse +# - --no_unroll +# - --no_inline +# - --no_code_motion +# - --no_tbaa +# - --no_clustering +# - --no_scheduling + + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - ewarm + - PART_LM3S9B92 + - TARGET_IS_TEMPEST_RB1 + - USE_ROM_DRIVERS + - UART_BUFFERED + - UNITY_SUPPORT_64 + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic.icf'] +# - ['C:\Temp\lm3s9b92.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + #- --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim2.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - --endian=little + - --cpu=Cortex-M3 + - --fpu=None + - -p + - [*tools_root, 'arm\config\debugger\TexasInstruments\iolm3sxxxx.ddf'] + - --semihosting + - --device=LM3SxBxx + #- -d + #- sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/targets/iar_cortexm3_v5.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/targets/iar_cortexm3_v5.yml new file mode 100644 index 0000000..cf0d1d0 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/targets/iar_cortexm3_v5.yml @@ -0,0 +1,83 @@ +# unit testing under iar compiler / simulator for STM32 Cortex-M3 + +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.4\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian=little + - --cpu=Cortex-M3 + - --interwork + - --warnings_are_errors + - --fpu=None + - --diag_suppress=Pa050 + - --diag_suppress=Pe111 + - -e + - -On + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - 'IAR' + - 'UNITY_SUPPORT_64' + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic_cortex.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\debugger\ST\iostm32f107xx.ddf'] + - --cpu=Cortex-M3 + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/targets/iar_msp430.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/targets/iar_msp430.yml new file mode 100644 index 0000000..e022647 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/targets/iar_msp430.yml @@ -0,0 +1,94 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3 MSP430\' +core_root: &core_root [*tools_root, '430\'] +core_bin: &core_bin [*core_root, 'bin\'] +core_config: &core_config [*core_root, 'config\'] +core_lib: &core_lib [*core_root, 'lib\'] +core_inc: &core_inc [*core_root, 'inc\'] +core_config: &core_config [*core_root, 'config\'] + +compiler: + path: [*core_bin, 'icc430.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*core_lib, 'dlib\dl430fn.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --debug + - -e + - -Ol + - --multiplier=16 + - --double=32 + - --diag_suppress Pa050 + - --diag_suppress Pe111 + includes: + prefix: '-I' + items: + - *core_inc + - [*core_inc, 'dlib'] + - [*core_lib, 'dlib'] + - 'src\' + - '../src/' + - *unit_tests_path + - 'vendor\unity\src' + defines: + prefix: '-D' + items: + - '__MSP430F149__' + - 'INT_WIDTH=16' + - 'UNITY_EXCLUDE_FLOAT' + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r43' + destination: *build_path +linker: + path: [*core_bin, 'xlink.exe'] + options: + - -rt + - [*core_lib, 'dlib\dl430fn.r43'] + - -e_PrintfTiny=_Printf + - -e_ScanfSmall=_Scanf + - -s __program_start + - -D_STACK_SIZE=50 + - -D_DATA16_HEAP_SIZE=50 + - -D_DATA20_HEAP_SIZE=50 + - -f + - [*core_config, 'lnk430f5438.xcl'] + - -f + - [*core_config, 'multiplier.xcl'] + includes: + prefix: '-I' + items: + - *core_config + - *core_lib + - [*core_lib, 'dlib'] + object_files: + path: *build_path + extension: '.r79' + bin_files: + prefix: '-o' + extension: '.d79' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*core_bin, '430proc.dll'] + - [*core_bin, '430sim.dll'] + post_support: + - --plugin + - [*core_bin, '430bat.dll'] + - --backend -B + - --cpu MSP430F5438 + - -p + - [*core_config, 'MSP430F5438.ddf'] + - -d sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/targets/iar_sh2a_v6.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/targets/iar_sh2a_v6.yml new file mode 100644 index 0000000..ddc5603 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/targets/iar_sh2a_v6.yml @@ -0,0 +1,85 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 6.0\' +compiler: + path: [*tools_root, 'sh\bin\iccsh.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - -e + - --char_is_signed + - -Ol + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_scheduling + - --no_clustering + - --debug + - --dlib_config + - [*tools_root, 'sh\inc\DLib_Product.h'] + - --double=32 + - --code_model=huge + - --data_model=huge + - --core=sh2afpu + - --warnings_affect_exit_code + - --warnings_are_errors + - --mfc + - --use_unix_directory_separators + - --diag_suppress=Pe161 + includes: + prefix: '-I' + items: + - [*tools_root, 'sh\inc\'] + - [*tools_root, 'sh\inc\c'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.o' + destination: *build_path +linker: + path: [*tools_root, 'sh\bin\ilinksh.exe'] + options: + - --redirect __Printf=__PrintfSmall + - --redirect __Scanf=__ScanfSmall + - --config + - [*tools_root, 'sh\config\generic.icf'] + - --config_def _CSTACK_SIZE=0x800 + - --config_def _HEAP_SIZE=0x800 + - --config_def _INT_TABLE=0x10 + - --entry __iar_program_start + - --debug_lib + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'sh\bin\shproc.dll'] + - [*tools_root, 'sh\bin\shsim.dll'] + post_support: + - --plugin + - [*tools_root, 'sh\bin\shbat.dll'] + - --backend + - -B + - --core sh2afpu + - -p + - [*tools_root, 'sh\config\debugger\io7264.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/expectdata/testsample_cmd.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/expectdata/testsample_cmd.c new file mode 100644 index 0000000..42841d8 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/expectdata/testsample_cmd.c @@ -0,0 +1,54 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include +#include "CException.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/expectdata/testsample_def.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/expectdata/testsample_def.c new file mode 100644 index 0000000..8280804 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/expectdata/testsample_def.c @@ -0,0 +1,50 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_cmd.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_cmd.c new file mode 100644 index 0000000..e47b31c --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_cmd.c @@ -0,0 +1,76 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_def.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_def.c new file mode 100644 index 0000000..3ca9dba --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_def.c @@ -0,0 +1,72 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_new1.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_new1.c new file mode 100644 index 0000000..a7cbcd8 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_new1.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + GlobalExpectCount = 0; + GlobalVerifyOrder = 0; + GlobalOrderError = NULL; + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_new2.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_new2.c new file mode 100644 index 0000000..2c76bf2 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_new2.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_param.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_param.c new file mode 100644 index 0000000..23c04f4 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_param.c @@ -0,0 +1,73 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST_NO_ARGS +#define RUN_TEST(TestFunc, TestLineNum, ...) \ +{ \ + Unity.CurrentTestName = #TestFunc "(" #__VA_ARGS__ ")"; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(__VA_ARGS__); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21, RUN_TEST_NO_ARGS); + RUN_TEST(test_TheSecondThingToTest, 43, RUN_TEST_NO_ARGS); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_run1.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_run1.c new file mode 100644 index 0000000..a7cbcd8 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_run1.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + GlobalExpectCount = 0; + GlobalVerifyOrder = 0; + GlobalOrderError = NULL; + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_run2.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_run2.c new file mode 100644 index 0000000..2c76bf2 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_run2.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_yaml.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_yaml.c new file mode 100644 index 0000000..68b545a --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_yaml.c @@ -0,0 +1,86 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include "two.h" +#include "three.h" +#include +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_yaml_setup(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/expectdata/testsample_new1.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/expectdata/testsample_new1.c new file mode 100644 index 0000000..e5bcac2 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/expectdata/testsample_new1.c @@ -0,0 +1,60 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/expectdata/testsample_new2.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/expectdata/testsample_new2.c new file mode 100644 index 0000000..b7c7e5b --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/expectdata/testsample_new2.c @@ -0,0 +1,63 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/expectdata/testsample_param.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/expectdata/testsample_param.c new file mode 100644 index 0000000..4157007 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/expectdata/testsample_param.c @@ -0,0 +1,51 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST_NO_ARGS +#define RUN_TEST(TestFunc, TestLineNum, ...) \ +{ \ + Unity.CurrentTestName = #TestFunc "(" #__VA_ARGS__ ")"; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(__VA_ARGS__); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21, RUN_TEST_NO_ARGS); + RUN_TEST(test_TheSecondThingToTest, 43, RUN_TEST_NO_ARGS); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/expectdata/testsample_run1.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/expectdata/testsample_run1.c new file mode 100644 index 0000000..e5bcac2 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/expectdata/testsample_run1.c @@ -0,0 +1,60 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/expectdata/testsample_run2.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/expectdata/testsample_run2.c new file mode 100644 index 0000000..b7c7e5b --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/expectdata/testsample_run2.c @@ -0,0 +1,63 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/expectdata/testsample_yaml.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/expectdata/testsample_yaml.c new file mode 100644 index 0000000..d109287 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/expectdata/testsample_yaml.c @@ -0,0 +1,64 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "two.h" +#include "three.h" +#include +#include +#include +#include "CException.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_yaml_setup(); +} + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/test_generate_test_runner.rb b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/test_generate_test_runner.rb new file mode 100644 index 0000000..61c8df9 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/test_generate_test_runner.rb @@ -0,0 +1,94 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +ruby_version = RUBY_VERSION.split('.') +if (ruby_version[1].to_i == 9) and (ruby_version[2].to_i > 1) + require 'rubygems' + gem 'test-unit' +end +require 'test/unit' +require './auto/generate_test_runner.rb' + +TEST_FILE = 'test/testdata/testsample.c' +TEST_MOCK = 'test/testdata/mocksample.c' +OUT_FILE = 'build/testsample_' +EXP_FILE = 'test/expectdata/testsample_' + +class TestGenerateTestRunner < Test::Unit::TestCase + def setup + end + + def teardown + end + + def verify_output_equal(subtest) + expected = File.read(EXP_FILE + subtest + '.c').gsub(/\r\n/,"\n") + actual = File.read(OUT_FILE + subtest + '.c').gsub(/\r\n/,"\n") + assert_equal(expected, actual, "Generated File Sub-Test '#{subtest}' Failed") + end + + def test_ShouldGenerateARunnerByCreatingRunnerWithOptions + sets = { 'def' => nil, + 'new1' => { :plugins => [:cexception], :includes => ['one.h', 'two.h'], :enforce_strict_ordering => true }, + 'new2' => { :plugins => [:ignore], :suite_setup => "a_custom_setup();", :suite_teardown => "a_custom_teardown();" } + } + + sets.each_pair do |subtest, options| + UnityTestRunnerGenerator.new(options).run(TEST_FILE, OUT_FILE + subtest + '.c') + verify_output_equal(subtest) + UnityTestRunnerGenerator.new(options).run(TEST_MOCK, OUT_FILE + 'mock_' + subtest + '.c') + verify_output_equal('mock_' + subtest) + end + end + + def test_ShouldGenerateARunnerByRunningRunnerWithOptions + sets = { 'run1' => { :plugins => [:cexception], :includes => ['one.h', 'two.h'], :enforce_strict_ordering => true }, + 'run2' => { :plugins => [:ignore], :suite_setup => "a_custom_setup();", :suite_teardown => "a_custom_teardown();" } + } + + sets.each_pair do |subtest, options| + UnityTestRunnerGenerator.new.run(TEST_FILE, OUT_FILE + subtest + '.c', options) + verify_output_equal(subtest) + UnityTestRunnerGenerator.new.run(TEST_MOCK, OUT_FILE + 'mock_' + subtest + '.c', options) + verify_output_equal('mock_' + subtest) + end + end + + def test_ShouldGenerateARunnerByPullingYamlOptions + subtest = 'yaml' + cmdstr = "ruby auto/generate_test_runner.rb test/testdata/sample.yml \"#{TEST_FILE}\" \"#{OUT_FILE + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal(subtest) + + cmdstr = "ruby auto/generate_test_runner.rb test/testdata/sample.yml \"#{TEST_MOCK}\" \"#{OUT_FILE + 'mock_' + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal('mock_' + subtest) + end + + def test_ShouldGenerateARunnerByPullingCommandlineOptions + subtest = 'cmd' + cmdstr = "ruby auto/generate_test_runner.rb -cexception \"#{TEST_FILE}\" \"#{OUT_FILE + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal(subtest) + + cmdstr = "ruby auto/generate_test_runner.rb -cexception \"#{TEST_MOCK}\" \"#{OUT_FILE + 'mock_' + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal('mock_' + subtest) + end + + def test_ShouldGenerateARunnerThatUsesParameterizedTests + sets = { 'param' => { :plugins => [:ignore], :use_param_tests => true } + } + + sets.each_pair do |subtest, options| + UnityTestRunnerGenerator.new(options).run(TEST_FILE, OUT_FILE + subtest + '.c') + verify_output_equal(subtest) + UnityTestRunnerGenerator.new(options).run(TEST_MOCK, OUT_FILE + 'mock_' + subtest + '.c') + verify_output_equal('mock_' + subtest) + end + end + +end diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/testdata/mocksample.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/testdata/mocksample.c new file mode 100644 index 0000000..b709438 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/testdata/mocksample.c @@ -0,0 +1,51 @@ +// This is just a sample test file to be used to test the generator script +#ifndef TEST_SAMPLE_H +#define TEST_SAMPLE_H + +#include +#include "unity.h" +#include "funky.h" +#include "Mockstanky.h" + +void setUp(void) +{ + CustomSetupStuff(); +} + +void tearDown(void) +{ + CustomTeardownStuff +} + +//Yup, nice comment +void test_TheFirstThingToTest(void) +{ + TEST_ASSERT(1); + + TEST_ASSERT_TRUE(1); +} + +/* +void test_ShouldBeIgnored(void) +{ + DoesStuff(); +} +*/ + +//void test_ShouldAlsoNotBeTested(void) +//{ +// Call_An_Expect(); +// +// CallAFunction(); +// test_CallAFunctionThatLooksLikeATest(); +//} + +void test_TheSecondThingToTest(void) +{ + Call_An_Expect(); + + CallAFunction(); + test_CallAFunctionThatLooksLikeATest(); +} + +#endif //TEST_SAMPLE_H diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/testdata/sample.yml b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/testdata/sample.yml new file mode 100644 index 0000000..9e5eece --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/testdata/sample.yml @@ -0,0 +1,9 @@ +:unity: + :includes: + - two.h + - three.h + - + :plugins: + - :cexception + :suite_setup: | + a_yaml_setup(); \ No newline at end of file diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/testdata/testsample.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/testdata/testsample.c new file mode 100644 index 0000000..4f30ec7 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/testdata/testsample.c @@ -0,0 +1,51 @@ +// This is just a sample test file to be used to test the generator script +#ifndef TEST_SAMPLE_H +#define TEST_SAMPLE_H + +#include +#include "unity.h" +#include "funky.h" +#include "stanky.h" + +void setUp(void) +{ + CustomSetupStuff(); +} + +void tearDown(void) +{ + CustomTeardownStuff +} + +//Yup, nice comment +void test_TheFirstThingToTest(void) +{ + TEST_ASSERT(1); + + TEST_ASSERT_TRUE(1); +} + +/* +void test_ShouldBeIgnored(void) +{ + DoesStuff(); +} +*/ + +//void test_ShouldAlsoNotBeTested(void) +//{ +// Call_An_Expect(); +// +// CallAFunction(); +// test_CallAFunctionThatLooksLikeATest(); +//} + +void test_TheSecondThingToTest(void) +{ + Call_An_Expect(); + + CallAFunction(); + test_CallAFunctionThatLooksLikeATest(); +} + +#endif //TEST_SAMPLE_H diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/testparameterized.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/testparameterized.c new file mode 100644 index 0000000..037cd21 --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/testparameterized.c @@ -0,0 +1,101 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include +#include "unity.h" + +#define TEST_CASE(...) + +#define EXPECT_ABORT_BEGIN \ + if (TEST_PROTECT()) \ + { + +#define VERIFY_FAILS_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestFailed == 1) ? 0 : 1; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Failed But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +#define VERIFY_IGNORES_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestIgnored == 1) ? 0 : 1; \ + Unity.CurrentTestIgnored = 0; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Ignored But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +int SetToOneToFailInTearDown; +int SetToOneMeanWeAlreadyCheckedThisGuy; + +void setUp(void) +{ + SetToOneToFailInTearDown = 0; + SetToOneMeanWeAlreadyCheckedThisGuy = 0; +} + +void tearDown(void) +{ + if (SetToOneToFailInTearDown == 1) + TEST_FAIL_MESSAGE("<= Failed in tearDown"); + if ((SetToOneMeanWeAlreadyCheckedThisGuy == 0) && (Unity.CurrentTestFailed > 0)) + { + UnityPrint("[[[[ Previous Test Should Have Passed But Did Not ]]]]"); + UNITY_OUTPUT_CHAR('\n'); + } +} + +TEST_CASE(0) +TEST_CASE(44) +TEST_CASE((90)+9) +void test_TheseShouldAllPass(int Num) +{ + TEST_ASSERT_TRUE(Num < 100); +} + +TEST_CASE(3) +TEST_CASE(77) +TEST_CASE( (99) + 1 - (1)) +void test_TheseShouldAllFail(int Num) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(Num > 100); + VERIFY_FAILS_END +} + +TEST_CASE(1) +TEST_CASE(44) +TEST_CASE(99) +TEST_CASE(98) +void test_TheseAreEveryOther(int Num) +{ + if (Num & 1) + { + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(Num > 100); + VERIFY_FAILS_END + } + else + { + TEST_ASSERT_TRUE(Num < 100); + } +} + +void test_NormalPassesStillWork(void) +{ + TEST_ASSERT_TRUE(1); +} + +void test_NormalFailsStillWork(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(0); + VERIFY_FAILS_END +} diff --git a/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/testunity.c b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/testunity.c new file mode 100644 index 0000000..9f826dc --- /dev/null +++ b/flex-bison/clcalc/modules/common-includes/tools/ceedling/vendor/unity/test/testunity.c @@ -0,0 +1,1510 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include +#include "unity.h" + +#define EXPECT_ABORT_BEGIN \ + if (TEST_PROTECT()) \ + { + +#define VERIFY_FAILS_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestFailed == 1) ? 0 : 1; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Failed But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +#define VERIFY_IGNORES_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestIgnored == 1) ? 0 : 1; \ + Unity.CurrentTestIgnored = 0; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Ignored But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +int SetToOneToFailInTearDown; +int SetToOneMeanWeAlreadyCheckedThisGuy; + +void setUp(void) +{ + SetToOneToFailInTearDown = 0; + SetToOneMeanWeAlreadyCheckedThisGuy = 0; +} + +void tearDown(void) +{ + if (SetToOneToFailInTearDown == 1) + TEST_FAIL_MESSAGE("<= Failed in tearDown"); + if ((SetToOneMeanWeAlreadyCheckedThisGuy == 0) && (Unity.CurrentTestFailed > 0)) + { + UnityPrint("[[[[ Previous Test Should Have Passed But Did Not ]]]]"); + UNITY_OUTPUT_CHAR('\n'); + } +} + +void testTrue(void) +{ + TEST_ASSERT(1); + + TEST_ASSERT_TRUE(1); +} + +void testFalse(void) +{ + TEST_ASSERT_FALSE(0); + + TEST_ASSERT_UNLESS(0); +} + +void testPreviousPass(void) +{ + TEST_ASSERT_EQUAL_INT(0U, Unity.TestFailures); +} + +void testNotVanilla(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT(0); + VERIFY_FAILS_END +} + +void testNotTrue(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(0); + VERIFY_FAILS_END +} + +void testNotFalse(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_FALSE(1); + VERIFY_FAILS_END +} + +void testNotUnless(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UNLESS(1); + VERIFY_FAILS_END +} + +void testNotNotEqual(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_NOT_EQUAL(10, 10); + VERIFY_FAILS_END +} + +void testFail(void) +{ + EXPECT_ABORT_BEGIN + TEST_FAIL_MESSAGE("Expected for testing"); + VERIFY_FAILS_END +} + +void testIsNull(void) +{ + char* ptr1 = NULL; + char* ptr2 = "hello"; + + TEST_ASSERT_NULL(ptr1); + TEST_ASSERT_NOT_NULL(ptr2); +} + +void testIsNullShouldFailIfNot(void) +{ + char* ptr1 = "hello"; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_NULL(ptr1); + VERIFY_FAILS_END +} + +void testNotNullShouldFailIfNULL(void) +{ + char* ptr1 = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_NOT_NULL(ptr1); + VERIFY_FAILS_END +} + +void testIgnore(void) +{ + EXPECT_ABORT_BEGIN + TEST_IGNORE(); + TEST_FAIL_MESSAGE("This should not be reached"); + VERIFY_IGNORES_END +} + +void testIgnoreMessage(void) +{ + EXPECT_ABORT_BEGIN + TEST_IGNORE_MESSAGE("This is an expected TEST_IGNORE_MESSAGE string!"); + TEST_FAIL_MESSAGE("This should not be reached"); + VERIFY_IGNORES_END +} + +void testNotEqualInts(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT(3982, 3983); + VERIFY_FAILS_END +} + +void testNotEqualInt8s(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT8(-127, -126); + VERIFY_FAILS_END +} + +void testNotEqualInt16s(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT16(-16383, -16382); + VERIFY_FAILS_END +} + +void testNotEqualInt32s(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT32(-2147483647, -2147483646); + VERIFY_FAILS_END +} + +void testNotEqualBits(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_BITS(0xFF00, 0x5555, 0x5A55); + VERIFY_FAILS_END +} + +void testNotEqualUInts(void) +{ + _UU16 v0, v1; + + v0 = 9000; + v1 = 9001; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualUInt8s(void) +{ + _UU8 v0, v1; + + v0 = 254; + v1 = 255; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT8(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualUInt16s(void) +{ + _UU16 v0, v1; + + v0 = 65535; + v1 = 65534; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualUInt32s(void) +{ + _UU32 v0, v1; + + v0 = 4294967295; + v1 = 4294967294; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT32(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex8s(void) +{ + _UU8 v0, v1; + + v0 = 0x23; + v1 = 0x22; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex8sIfSigned(void) +{ + _US8 v0, v1; + + v0 = -2; + v1 = 2; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex16s(void) +{ + _UU16 v0, v1; + + v0 = 0x1234; + v1 = 0x1235; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex16sIfSigned(void) +{ + _US16 v0, v1; + + v0 = -1024; + v1 = -1028; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex32s(void) +{ + _UU32 v0, v1; + + v0 = 900000; + v1 = 900001; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex32sIfSigned(void) +{ + _US32 v0, v1; + + v0 = -900000; + v1 = 900001; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32(v0, v1); + VERIFY_FAILS_END +} + +void testEqualInts(void) +{ + int v0, v1; + int *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(1837, 1837); + TEST_ASSERT_EQUAL_INT(-27365, -27365); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(19467, v1); + TEST_ASSERT_EQUAL_INT(v0, 19467); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 19467); +} + +void testEqualUints(void) +{ + unsigned int v0, v1; + unsigned int *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_UINT(1837, 1837); + TEST_ASSERT_EQUAL_UINT(v0, v1); + TEST_ASSERT_EQUAL_UINT(19467, v1); + TEST_ASSERT_EQUAL_UINT(v0, 19467); + TEST_ASSERT_EQUAL_UINT(*p0, v1); + TEST_ASSERT_EQUAL_UINT(*p0, *p1); + TEST_ASSERT_EQUAL_UINT(*p0, 19467); + TEST_ASSERT_EQUAL_UINT(60872u, 60872u); +} + +void testNotEqual(void) +{ + TEST_ASSERT_NOT_EQUAL(0, 1); + TEST_ASSERT_NOT_EQUAL(1, 0); + TEST_ASSERT_NOT_EQUAL(100, 101); + TEST_ASSERT_NOT_EQUAL(0, -1); + TEST_ASSERT_NOT_EQUAL(65535, -65535); + TEST_ASSERT_NOT_EQUAL(75, 900); + TEST_ASSERT_NOT_EQUAL(-100, -101); +} + +void testEqualHex8s(void) +{ + _UU8 v0, v1; + _UU8 *p0, *p1; + + v0 = 0x22; + v1 = 0x22; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX8(0x22, 0x22); + TEST_ASSERT_EQUAL_HEX8(v0, v1); + TEST_ASSERT_EQUAL_HEX8(0x22, v1); + TEST_ASSERT_EQUAL_HEX8(v0, 0x22); + TEST_ASSERT_EQUAL_HEX8(*p0, v1); + TEST_ASSERT_EQUAL_HEX8(*p0, *p1); + TEST_ASSERT_EQUAL_HEX8(*p0, 0x22); +} + +void testEqualHex8sNegatives(void) +{ + _UU8 v0, v1; + _UU8 *p0, *p1; + + v0 = 0xDD; + v1 = 0xDD; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX8(0xDD, 0xDD); + TEST_ASSERT_EQUAL_HEX8(v0, v1); + TEST_ASSERT_EQUAL_HEX8(0xDD, v1); + TEST_ASSERT_EQUAL_HEX8(v0, 0xDD); + TEST_ASSERT_EQUAL_HEX8(*p0, v1); + TEST_ASSERT_EQUAL_HEX8(*p0, *p1); + TEST_ASSERT_EQUAL_HEX8(*p0, 0xDD); +} + +void testEqualHex16s(void) +{ + _UU16 v0, v1; + _UU16 *p0, *p1; + + v0 = 0x9876; + v1 = 0x9876; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX16(0x9876, 0x9876); + TEST_ASSERT_EQUAL_HEX16(v0, v1); + TEST_ASSERT_EQUAL_HEX16(0x9876, v1); + TEST_ASSERT_EQUAL_HEX16(v0, 0x9876); + TEST_ASSERT_EQUAL_HEX16(*p0, v1); + TEST_ASSERT_EQUAL_HEX16(*p0, *p1); + TEST_ASSERT_EQUAL_HEX16(*p0, 0x9876); +} + +void testEqualHex32s(void) +{ + _UU32 v0, v1; + _UU32 *p0, *p1; + + v0 = 0x98765432ul; + v1 = 0x98765432ul; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX32(0x98765432ul, 0x98765432ul); + TEST_ASSERT_EQUAL_HEX32(v0, v1); + TEST_ASSERT_EQUAL_HEX32(0x98765432ul, v1); + TEST_ASSERT_EQUAL_HEX32(v0, 0x98765432ul); + TEST_ASSERT_EQUAL_HEX32(*p0, v1); + TEST_ASSERT_EQUAL_HEX32(*p0, *p1); + TEST_ASSERT_EQUAL_HEX32(*p0, 0x98765432ul); +} + +void testEqualBits(void) +{ + _UU32 v0 = 0xFF55AA00; + _UU32 v1 = 0x55550000; + + TEST_ASSERT_BITS(v1, v0, 0x55550000); + TEST_ASSERT_BITS(v1, v0, 0xFF55CC00); + TEST_ASSERT_BITS(0xFFFFFFFF, v0, 0xFF55AA00); + TEST_ASSERT_BITS(0xFFFFFFFF, v0, v0); + TEST_ASSERT_BITS(0xF0F0F0F0, v0, 0xFC5DAE0F); + TEST_ASSERT_BITS_HIGH(v1, v0); + TEST_ASSERT_BITS_LOW(0x000055FF, v0); + TEST_ASSERT_BIT_HIGH(30, v0); + TEST_ASSERT_BIT_LOW(5, v0); +} + +void testEqualShorts(void) +{ + short v0, v1; + short *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(1837, 1837); + TEST_ASSERT_EQUAL_INT(-2987, -2987); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(19467, v1); + TEST_ASSERT_EQUAL_INT(v0, 19467); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 19467); +} + +void testEqualUShorts(void) +{ + unsigned short v0, v1; + unsigned short *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_UINT(1837, 1837); + TEST_ASSERT_EQUAL_UINT(2987, 2987); + TEST_ASSERT_EQUAL_UINT(v0, v1); + TEST_ASSERT_EQUAL_UINT(19467, v1); + TEST_ASSERT_EQUAL_UINT(v0, 19467); + TEST_ASSERT_EQUAL_UINT(*p0, v1); + TEST_ASSERT_EQUAL_UINT(*p0, *p1); + TEST_ASSERT_EQUAL_UINT(*p0, 19467); +} + +void testEqualChars(void) +{ + signed char v0, v1; + signed char *p0, *p1; + + v0 = 109; + v1 = 109; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(42, 42); + TEST_ASSERT_EQUAL_INT(-116, -116); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(109, v1); + TEST_ASSERT_EQUAL_INT(v0, 109); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 109); +} + +void testEqualUChars(void) +{ + unsigned char v0, v1; + unsigned char *p0, *p1; + + v0 = 251; + v1 = 251; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(42, 42); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(251, v1); + TEST_ASSERT_EQUAL_INT(v0, 251); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 251); +} + +void testEqualPointers(void) +{ + int v0, v1; + int *p0, *p1, *p2; + + v0 = 19467; + v1 = 18271; + p0 = &v0; + p1 = &v1; + p2 = &v1; + + TEST_ASSERT_EQUAL_PTR(p0, &v0); + TEST_ASSERT_EQUAL_PTR(&v1, p1); + TEST_ASSERT_EQUAL_PTR(p2, p1); + TEST_ASSERT_EQUAL_PTR(&v0, &v0); +} + +void testNotEqualPointers(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_PTR(0x12345678, 0x12345677); + VERIFY_FAILS_END +} + +void testIntsWithinDelta(void) +{ + TEST_ASSERT_INT_WITHIN(1, 5000, 5001); + TEST_ASSERT_INT_WITHIN(5, 5000, 4996); + TEST_ASSERT_INT_WITHIN(5, 5000, 5005); + TEST_ASSERT_INT_WITHIN(500, 50, -440); + + TEST_ASSERT_INT_WITHIN(2, -1, -1); + TEST_ASSERT_INT_WITHIN(5, 1, -1); + TEST_ASSERT_INT_WITHIN(5, -1, 1); +} + +void testIntsNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_INT_WITHIN(5, 5000, 5006); + VERIFY_FAILS_END +} + +void testUIntsWithinDelta(void) +{ + TEST_ASSERT_UINT_WITHIN(1, 5000, 5001); + TEST_ASSERT_UINT_WITHIN(5, 5000, 4996); + TEST_ASSERT_UINT_WITHIN(5, 5000, 5005); +} + +void testUIntsNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UINT_WITHIN(1, 2147483647u, 2147483649u); + VERIFY_FAILS_END +} + +void testUIntsNotWithinDeltaEvenThoughASignedIntWouldPassSmallFirst(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UINT_WITHIN(5, 1, -1); + VERIFY_FAILS_END +} + +void testUIntsNotWithinDeltaEvenThoughASignedIntWouldPassBigFirst(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UINT_WITHIN(5, -1, 1); + VERIFY_FAILS_END +} + +void testHEX32sWithinDelta(void) +{ + TEST_ASSERT_HEX32_WITHIN(1, 5000, 5001); + TEST_ASSERT_HEX32_WITHIN(5, 5000, 4996); + TEST_ASSERT_HEX32_WITHIN(5, 5000, 5005); +} + +void testHEX32sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX32_WITHIN(1, 2147483647u, 2147483649u); + VERIFY_FAILS_END +} + +void testHEX32sNotWithinDeltaEvenThoughASignedIntWouldPass(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX32_WITHIN(5, 1, -1); + VERIFY_FAILS_END +} + +void testHEX16sWithinDelta(void) +{ + TEST_ASSERT_HEX16_WITHIN(1, 5000, 5001); + TEST_ASSERT_HEX16_WITHIN(5, 5000, 4996); + TEST_ASSERT_HEX16_WITHIN(5, 5000, 5005); +} + +void testHEX16sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX16_WITHIN(2, 65535, 0); + VERIFY_FAILS_END +} + +void testHEX8sWithinDelta(void) +{ + TEST_ASSERT_HEX8_WITHIN(1, 254, 255); + TEST_ASSERT_HEX8_WITHIN(5, 251, 255); + TEST_ASSERT_HEX8_WITHIN(5, 1, 4); +} + +void testHEX8sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX8_WITHIN(2, 255, 0); + VERIFY_FAILS_END +} + +void testEqualStrings(void) +{ + const char *testString = "foo"; + + TEST_ASSERT_EQUAL_STRING(testString, testString); + TEST_ASSERT_EQUAL_STRING("foo", "foo"); + TEST_ASSERT_EQUAL_STRING("foo", testString); + TEST_ASSERT_EQUAL_STRING(testString, "foo"); + TEST_ASSERT_EQUAL_STRING("", ""); +} + +void testEqualStringsWithCarriageReturnsAndLineFeeds(void) +{ + const char *testString = "foo\r\nbar"; + + TEST_ASSERT_EQUAL_STRING(testString, testString); + TEST_ASSERT_EQUAL_STRING("foo\r\nbar", "foo\r\nbar"); + TEST_ASSERT_EQUAL_STRING("foo\r\nbar", testString); + TEST_ASSERT_EQUAL_STRING(testString, "foo\r\nbar"); + TEST_ASSERT_EQUAL_STRING("", ""); +} + +void testNotEqualString1(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("foo", "bar"); + VERIFY_FAILS_END +} + +void testNotEqualString2(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("foo", ""); + VERIFY_FAILS_END +} + +void testNotEqualString3(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("", "bar"); + VERIFY_FAILS_END +} + +void testNotEqualString4(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("bar\r", "bar\n"); + VERIFY_FAILS_END +} + +void testNotEqualString5(void) +{ + const char str1[] = { 0x41, 0x42, 0x03, 0x00 }; + const char str2[] = { 0x41, 0x42, 0x04, 0x00 }; + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING(str1, str2); + VERIFY_FAILS_END +} + +void testNotEqualString_ExpectedStringIsNull(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING(NULL, "bar"); + VERIFY_FAILS_END +} + +void testNotEqualString_ActualStringIsNull(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("foo", NULL); + VERIFY_FAILS_END +} + +void testEqualStringArrays(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, expStrings, 3); + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 3); + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 2); + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 1); +} + +void testNotEqualStringArray1(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray2(void) +{ + const char *testStrings[] = { "zoo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", "boo", "woo", "moo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray3(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", NULL }; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray4(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", NULL, "woo", "moo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray5(void) +{ + const char **testStrings = NULL; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray6(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "zoo" }; + const char **expStrings = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testEqualStringArrayIfBothNulls(void) +{ + const char **testStrings = NULL; + const char **expStrings = NULL; + + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); +} + +void testEqualMemory(void) +{ + const char *testString = "whatever"; + + TEST_ASSERT_EQUAL_MEMORY(testString, testString, 8); + TEST_ASSERT_EQUAL_MEMORY("whatever", "whatever", 8); + TEST_ASSERT_EQUAL_MEMORY("whatever", testString, 8); + TEST_ASSERT_EQUAL_MEMORY(testString, "whatever", 8); + TEST_ASSERT_EQUAL_MEMORY(testString, "whatever", 2); + TEST_ASSERT_EQUAL_MEMORY(NULL, NULL, 1); +} + +void testNotEqualMemory1(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY("foo", "bar", 3); + VERIFY_FAILS_END +} + +void testNotEqualMemory2(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY("fool", "food", 4); + VERIFY_FAILS_END +} + +void testNotEqualMemory3(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY(NULL, "food", 4); + VERIFY_FAILS_END +} + +void testNotEqualMemory4(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY("fool", NULL, 4); + VERIFY_FAILS_END +} + +void testEqualIntArrays(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, -2}; + int p2[] = {1, 8, 987, 2}; + int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p3, 1); +} + +void testNotEqualIntArraysNullExpected(void) +{ + int* p0 = NULL; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArraysNullActual(void) +{ + int* p1 = NULL; + int p0[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArrays1(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArrays2(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {2, 8, 987, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArrays3(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 986, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualInt8Arrays(void) +{ + _US8 p0[] = {1, 8, 117, -2}; + _US8 p1[] = {1, 8, 117, -2}; + _US8 p2[] = {1, 8, 117, 2}; + _US8 p3[] = {1, 50, 60, 70}; + + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p3, 1); +} + +void testNotEqualInt8Arrays(void) +{ + _US8 p0[] = {1, 8, 127, -2}; + _US8 p1[] = {1, 8, 127, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualUIntArrays(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65132u}; + unsigned int p2[] = {1, 8, 987, 2}; + unsigned int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p3, 1); +} + +void testNotEqualUIntArrays1(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUIntArrays2(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUIntArrays3(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualInt16Arrays(void) +{ + _UU16 p0[] = {1, 8, 117, 3}; + _UU16 p1[] = {1, 8, 117, 3}; + _UU16 p2[] = {1, 8, 117, 2}; + _UU16 p3[] = {1, 50, 60, 70}; + + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p3, 1); +} + +void testNotEqualInt16Arrays(void) +{ + _UU16 p0[] = {1, 8, 127, 3}; + _UU16 p1[] = {1, 8, 127, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualUINT16Arrays(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65132u}; + unsigned short p2[] = {1, 8, 987, 2}; + unsigned short p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p3, 1); +} + +void testNotEqualUINT16Arrays1(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUINT16Arrays2(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUINT16Arrays3(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualHEXArrays(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65132u}; + unsigned int p2[] = {1, 8, 987, 2}; + unsigned int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p3, 1); +} + +void testNotEqualHEXArrays1(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEXArrays2(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEXArrays3(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualHEX16Arrays(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65132u}; + unsigned short p2[] = {1, 8, 987, 2}; + unsigned short p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p3, 1); +} + +void testNotEqualHEX16Arrays1(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX16Arrays2(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX16Arrays3(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualHEX8Arrays(void) +{ + unsigned short p0[] = {1, 8, 254u, 123}; + unsigned short p1[] = {1, 8, 254u, 123}; + unsigned short p2[] = {1, 8, 254u, 2}; + unsigned short p3[] = {1, 23, 25, 26}; + + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p3, 1); +} + +void testNotEqualHEX8Arrays1(void) +{ + unsigned char p0[] = {1, 8, 254u, 253u}; + unsigned char p1[] = {1, 8, 254u, 252u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX8Arrays2(void) +{ + unsigned char p0[] = {1, 8, 254u, 253u}; + unsigned char p1[] = {2, 8, 254u, 253u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX8Arrays3(void) +{ + unsigned char p0[] = {1, 8, 254u, 253u}; + unsigned char p1[] = {1, 8, 255u, 253u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualMemoryArrays(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, -2}; + int p2[] = {1, 8, 987, 2}; + int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p0, 4, 1); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p0, 4, 4); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p2, 4, 3); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p3, 4, 1); +} + +void testNotEqualMemoryArraysExpectedNull(void) +{ + int* p0 = NULL; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArraysActualNull(void) +{ + int p0[] = {1, 8, 987, -2}; + int* p1 = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArrays1(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArrays2(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {2, 8, 987, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArrays3(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 986, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testProtection(void) +{ + volatile int mask = 0; + + if (TEST_PROTECT()) + { + mask |= 1; + TEST_ABORT(); + } + else + { + Unity.CurrentTestFailed = 0; + mask |= 2; + } + + TEST_ASSERT_EQUAL(3, mask); +} + +void testIgnoredAndThenFailInTearDown(void) +{ + SetToOneToFailInTearDown = 1; + TEST_IGNORE(); +} + +// ===================== THESE TEST WILL RUN IF YOUR CONFIG INCLUDES 64 BIT SUPPORT ================== +#ifdef UNITY_SUPPORT_64 + +void testEqualHex64s(void) +{ + _UU64 v0, v1; + _UU64 *p0, *p1; + + v0 = 0x9876543201234567; + v1 = 0x9876543201234567; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX64(0x9876543201234567, 0x9876543201234567); + TEST_ASSERT_EQUAL_HEX64(v0, v1); + TEST_ASSERT_EQUAL_HEX64(0x9876543201234567, v1); + TEST_ASSERT_EQUAL_HEX64(v0, 0x9876543201234567); + TEST_ASSERT_EQUAL_HEX64(*p0, v1); + TEST_ASSERT_EQUAL_HEX64(*p0, *p1); + TEST_ASSERT_EQUAL_HEX64(*p0, 0x9876543201234567); +} + +void testNotEqualHex64s(void) +{ + _UU64 v0, v1; + + v0 = 9000000000; + v1 = 9100000000; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex64sIfSigned(void) +{ + _US64 v0, v1; + + v0 = -9000000000; + v1 = 9000000000; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64(v0, v1); + VERIFY_FAILS_END +} + +void testHEX64sWithinDelta(void) +{ + TEST_ASSERT_HEX64_WITHIN(1, 0x7FFFFFFFFFFFFFFF,0x7FFFFFFFFFFFFFFE); + TEST_ASSERT_HEX64_WITHIN(5, 5000, 4996); + TEST_ASSERT_HEX64_WITHIN(5, 5000, 5005); +} + +void testHEX64sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX64_WITHIN(1, 0x7FFFFFFFFFFFFFFF, 0x7FFFFFFFFFFFFFFC); + VERIFY_FAILS_END +} + +void testHEX64sNotWithinDeltaEvenThoughASignedIntWouldPass(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX64_WITHIN(5, 1, -1); + VERIFY_FAILS_END +} + +void testEqualHEX64Arrays(void) +{ + _UU64 p0[] = {1, 8, 987, 65132u}; + _UU64 p1[] = {1, 8, 987, 65132u}; + _UU64 p2[] = {1, 8, 987, 2}; + _UU64 p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p3, 1); +} + +void testNotEqualHEX64Arrays1(void) +{ + _UU64 p0[] = {1, 8, 987, 65132u}; + _UU64 p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX64Arrays2(void) +{ + _UU64 p0[] = {1, 8, 987, 65132u}; + _UU64 p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +#endif //64-bit SUPPORT + +// ===================== THESE TEST WILL RUN IF YOUR CONFIG INCLUDES FLOAT SUPPORT ================== +#ifndef UNITY_EXCLUDE_FLOAT + +void testFloatsWithinDelta(void) +{ + TEST_ASSERT_FLOAT_WITHIN(0.00003f, 187245.03485f, 187245.03488f); + TEST_ASSERT_FLOAT_WITHIN(1.0f, 187245.0f, 187246.0f); + TEST_ASSERT_FLOAT_WITHIN(0.05f, 9273.2549f, 9273.2049f); + TEST_ASSERT_FLOAT_WITHIN(0.007f, -726.93724f, -726.94424f); +} + +void testFloatsNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_FLOAT_WITHIN(0.05f, 9273.2649f, 9273.2049f); + VERIFY_FAILS_END +} + +void testFloatsEqual(void) +{ + TEST_ASSERT_EQUAL_FLOAT(187245.0f, 187246.0f); + TEST_ASSERT_EQUAL_FLOAT(18724.5f, 18724.6f); + TEST_ASSERT_EQUAL_FLOAT(9273.2549f, 9273.2599f); + TEST_ASSERT_EQUAL_FLOAT(-726.93724f, -726.9374f); +} + +void testFloatsNotEqual(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT(9273.9649f, 9273.0049f); + VERIFY_FAILS_END +} + +void testFloatsNotEqualNegative1(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT(-9273.9649f, -9273.0049f); + VERIFY_FAILS_END +} + +void testFloatsNotEqualNegative2(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT(-9273.0049f, -9273.9649f); + VERIFY_FAILS_END +} + +void testEqualFloatArrays(void) +{ + float p0[] = {1.0, -8.0, 25.4, -0.123}; + float p1[] = {1.0, -8.0, 25.4, -0.123}; + float p2[] = {1.0, -8.0, 25.4, -0.2}; + float p3[] = {1.0, -23.0, 25.0, -0.26}; + + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p3, 1); +} + +void testNotEqualFloatArraysExpectedNull(void) +{ + float* p0 = NULL; + float p1[] = {1.0, 8.0, 25.4, 0.252}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysActualNull(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float* p1 = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArrays1(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float p1[] = {1.0, 8.0, 25.4, 0.252}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArrays2(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float p1[] = {2.0, 8.0, 25.4, 0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArrays3(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float p1[] = {1.0, 8.0, 25.5, 0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysNegative1(void) +{ + float p0[] = {-1.0, -8.0, -25.4, -0.253}; + float p1[] = {-1.0, -8.0, -25.4, -0.252}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysNegative2(void) +{ + float p0[] = {-1.0, -8.0, -25.4, -0.253}; + float p1[] = {-2.0, -8.0, -25.4, -0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysNegative3(void) +{ + float p0[] = {-1.0, -8.0, -25.4, -0.253}; + float p1[] = {-1.0, -8.0, -25.5, -0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +#endif //FLOAT SUPPORT diff --git a/flex-bison/clcalc/modules/data-structures/LICENSE b/flex-bison/clcalc/modules/data-structures/LICENSE new file mode 100644 index 0000000..94a9ed0 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/flex-bison/clcalc/modules/data-structures/README b/flex-bison/clcalc/modules/data-structures/README new file mode 100644 index 0000000..a5f9105 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/README @@ -0,0 +1,25 @@ +=============================================================================== +Project Goals +=============================================================================== + +=============================================================================== +Build Requirements +=============================================================================== + +=============================================================================== +Build Instructions +=============================================================================== + +=============================================================================== +Installation Instructions +=============================================================================== + +=============================================================================== +Unit Tests +=============================================================================== + +=============================================================================== +TODO +=============================================================================== + + diff --git a/flex-bison/clcalc/modules/data-structures/build/DUMMY b/flex-bison/clcalc/modules/data-structures/build/DUMMY new file mode 100644 index 0000000..e69de29 diff --git a/flex-bison/clcalc/modules/data-structures/project.yml b/flex-bison/clcalc/modules/data-structures/project.yml new file mode 100644 index 0000000..a2fc78b --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/project.yml @@ -0,0 +1,38 @@ +--- + +:project: + :use_exceptions: FALSE + :use_test_preprocessor: TRUE + :use_auxiliary_dependencies: TRUE + :build_root: build + :test_file_prefix: test_ + +:paths: + :test: + - tests/** + :source: + - src/** + +:defines: + :commmon: &common_defines + :test: + - *common_defines + - TEST + :test_preprocess: + - *common_defines + - TEST + +:cmock: + :mock_prefix: mock_ + :when_no_prototypes: :warn + :enforce_strict_ordering: TRUE + :plugins: + - :ignore + +:plugins: + :load_paths: + - tools/ceedling/plugins + :enabled: + - stdout_pretty_tests_report + +... diff --git a/flex-bison/clcalc/modules/data-structures/rakefile.rb b/flex-bison/clcalc/modules/data-structures/rakefile.rb new file mode 100644 index 0000000..a23ac80 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/rakefile.rb @@ -0,0 +1,3 @@ +require 'rake' +load 'tools/ceedling/lib/rakefile.rb' +task :default => ['test:all'] diff --git a/flex-bison/clcalc/modules/data-structures/src/hashtable/hashtable.c b/flex-bison/clcalc/modules/data-structures/src/hashtable/hashtable.c new file mode 100644 index 0000000..1363849 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/src/hashtable/hashtable.c @@ -0,0 +1,132 @@ +/****************************************************************************** + * Copyright (C) 2011 Michael D. Lowis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ +#include "hashtable.h" +#include +#include +#include + +STATIC U32 Hash_HashString(String key); + +/****************************************************************************** + * Private Functions + *****************************************************************************/ +U32 Hash_HashString(String key) +{ + U32 hash = 0; + U8 i = 0; + for (i = 0; key[i] != '\0'; i++) + { + hash += key[i]; + } + return hash; +} + +/****************************************************************************** + * Public Functions + *****************************************************************************/ +HashTable_T* Hash_New(U32 size, HashFuncPtr_T fn) +{ + U32 table_size = size * sizeof(HashNode_T*); + HashTable_T* table = (HashTable_T*) malloc( sizeof(HashTable_T) ); + table->size = size; + table->table = (HashNode_T**) malloc( table_size ); + table->hash_func = (fn != NULL) ? fn : (HashFuncPtr_T) Hash_HashString; + memset(table->table, 0, table_size); + return table; +} + +void Hash_Free(HashTable_T* table) +{ + U8 i = 0; + for (i = 0; i < table->size; i++) + { + HashNode_T* cur = table->table[i]; + while (cur != NULL) + { + printf("Index: %d\tKey: %s\tVal: %#x\tNext: %#x\n", i, cur->key, (int)cur->val, (int)cur->next); + HashNode_T* next = cur->next; + free( cur->key ); + free( cur->val ); + free( cur ); + cur = next; + } + } +} + +BOOL Hash_Put(HashTable_T* table, String key, void* val) +{ + U32 index = table->hash_func( key ) % table->size; + HashNode_T* cur = table->table[index]; + HashNode_T* last = cur; + + while (cur != NULL) + { + if ( !strcmp( key, cur->key ) ) + { + cur->val = val; + break; + } + last = cur; + cur = cur->next; + } + + if (cur == NULL) + { + HashNode_T* node = (HashNode_T*) malloc( sizeof(HashNode_T) ); + node->key = (String) strdup( key ); + node->val = val; + node->next = NULL; + + if (last != NULL) + { + last->next = node; + } + else + { + table->table[ index ] = node; + } + } + return TRUE; +} + +void* Hash_Get(HashTable_T* table, String key) +{ + void* ret = NULL; + U32 index= table->hash_func( key ) % table->size; + HashNode_T* node = table->table[ index ]; + while ( node != NULL ) + { + if ( !strcmp( key, node->key ) ) + { + ret = node->val; + break; + } + node = node->next; + } + return ret; +} + +U32 Hash_Delete(HashTable_T* table, String key) +{ + return 0; +} + +U32 Hash_Resize(HashTable_T* table, U32 size) +{ + return 0; +} + diff --git a/flex-bison/clcalc/modules/data-structures/src/hashtable/hashtable.h b/flex-bison/clcalc/modules/data-structures/src/hashtable/hashtable.h new file mode 100644 index 0000000..ab31b54 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/src/hashtable/hashtable.h @@ -0,0 +1,44 @@ +/****************************************************************************** + * Copyright (C) 2011 Michael D. Lowis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ +#ifndef HASHTABLE_H +#define HASHTABLE_H + +#include "common.h" + +typedef U32 (*HashFuncPtr_T) (String) ; +typedef struct HashNode +{ + String key; + void* val; + struct HashNode* next; +} HashNode_T; + +typedef struct +{ + U32 size; + HashNode_T** table; + HashFuncPtr_T hash_func; +} HashTable_T; + +HashTable_T* Hash_New(U32 size, HashFuncPtr_T fn); +void Hash_Free(HashTable_T* table); +BOOL Hash_Put(HashTable_T* table, String key, void* val); +void* Hash_Get(HashTable_T* table, String key); +U32 Hash_Delete(HashTable_T* table, String key); +U32 Hash_Resize(HashTable_T* table, U32 size); + +#endif diff --git a/flex-bison/clcalc/modules/data-structures/src/linked_list/linked_list.c b/flex-bison/clcalc/modules/data-structures/src/linked_list/linked_list.c new file mode 100644 index 0000000..a0df8ac --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/src/linked_list/linked_list.c @@ -0,0 +1,119 @@ +/****************************************************************************** + * Copyright (C) 2011 Michael D. Lowis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ +#include "linked_list.h" +#include + +/****************************************************************************** + * Public Functions + ******************************************************************************/ +LinkedList_T* LL_New( PTR_TYPE contents ) +{ + LinkedList_T* list = (LinkedList_T*)malloc( sizeof(LinkedList_T) ); + list->contents = contents; + list->next = NULL; + return list; +} + +LinkedList_T* LL_Last( LinkedList_T* list ) +{ + LinkedList_T* node = list; + while((node != NULL) && (node->next != NULL)) + { + node = node->next; + } + return node; +} + +LinkedList_T* LL_Get( LinkedList_T* list, int index ) +{ + int current = 0; + LinkedList_T* node = list; + LinkedList_T* indexed_node = NULL; + while ((node != NULL)) + { + if ( current == index ) + { + indexed_node = node; + break; + } + node = node->next; + current++; + } + return indexed_node; +} + +void LL_Add( LinkedList_T* list, PTR_TYPE contents ) +{ + LinkedList_T* node = LL_Last( list ); + node->next = LL_New( contents ); +} + +LinkedList_T* LL_Insert( LinkedList_T* list, int index, PTR_TYPE contents ) +{ + int req_index = ((index-1) < 0) ? 0 : index-1; + LinkedList_T* node = LL_Get( list, req_index ); + if(node != NULL) + { + LinkedList_T* next_next = node->next; + node->next = LL_New( contents ); + node->next->next = next_next; + node = node->next; + } + return node; +} + +void LL_Delete( LinkedList_T* list, int index, BOOL free_contents) +{ + LinkedList_T* node = LL_Get( list, (index-1)); + if((node != NULL) && (node->next != NULL)) + { + LinkedList_T* node_to_delete = node->next; + node->next = node_to_delete->next; + if (free_contents) + { + free(node_to_delete->contents); + } + free(node_to_delete); + } +} + +void LL_Free( LinkedList_T* list, BOOL free_contents) +{ + LinkedList_T* node = list; + while( node != NULL ) + { + LinkedList_T* next = node->next; + if (free_contents) + { + free(node->contents); + } + free(node); + node = next; + } +} + +U32 LL_Length(LinkedList_T* list) +{ + U32 length = 0; + LinkedList_T* item = list; + for ( item = list; item != NULL; item = item->next ) + { + length++; + } + return length; +} + diff --git a/flex-bison/clcalc/modules/data-structures/src/linked_list/linked_list.h b/flex-bison/clcalc/modules/data-structures/src/linked_list/linked_list.h new file mode 100644 index 0000000..551a1da --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/src/linked_list/linked_list.h @@ -0,0 +1,119 @@ +/****************************************************************************** + * Copyright (C) 2011 Michael D. Lowis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ +#ifndef LINKED_LIST_H +#define LINKED_LIST_H + +#include "common.h" + +#define PTR_TYPE void * + +typedef struct LinkedList +{ + PTR_TYPE contents; + struct LinkedList * next; +} LinkedList_T; + +/** + * @brief Creates a new linked list node with the supplied value. + * + * Allocates a new node on the heap and populates the node contents with the + * supplied contents pointer. + * + * @param contents The contents of the newly created node. + * + * @return A pointer to the newly created node. + * */ +LinkedList_T* LL_New( PTR_TYPE contents ); + +/** + * @brief Finds and returns the last node in the supplied linked list. + * + * @param list The linked list to search. + * + * @return Pointer to the last node in the supplied list. + * */ +LinkedList_T* LL_Last(LinkedList_T* list); + +/** + * @brief Return the node at the specified index in a linked list. + * + * Loops through the linked list and returns the node in the list at the + * specified index. Returns NULL if the index is out of range. + * + * @param list The list to search for the supplied index. + * @param index The index of the node to return. + * + * @return A pointer to the node and the supplied index, NULL if out of range. + * */ +LinkedList_T* LL_Get(LinkedList_T* list, int index); + +/** + * @brief Adds a new node to an existing linked list. + * + * @param list + * @param contents + * */ +void LL_Add( LinkedList_T* list, PTR_TYPE contents ); + +/** + * @brief Inserts a new node in a linked list at the specified index. + * + * @param list + * @param index + * @param contents + * + * @return Pointer to the newly inserted node, NULL if index is out of range. + * */ +LinkedList_T* LL_Insert( LinkedList_T* list, int index, PTR_TYPE contents); + +/** + * @brief Deletes a node from the supplied list. + * + * Deletes the node found at the supplied index from the supplied list and frees + * the memory used by the node and its contents. + * + * @param list + * @param index + * @param free_contents Whether or not to also free the contents of the node. + * */ +void LL_Delete( LinkedList_T* list, int index, BOOL free_contents); + +/** + * @brief Frees all memory used by a linked list. + * + * Loops through the supplied list and frees all nodes. Also frees contents if + * free_contents is passed TRUE. This is to avoid trying to free memory + * allocated on the stack. + * + * @param list The list to be freed. + * @param free_contents Whether or not to also free the contents of each node. + * */ +void LL_Free( LinkedList_T* list, BOOL free_contents); + +/** + * @brief Returns the number of elements in the list. + * + * Loops through the supplied list and returns a count of the number of elements + * contained in the list. + * + * @param list The list to be counted. + * + * @return The number of elements in the list. + **/ +U32 LL_Length(LinkedList_T* list); + +#endif diff --git a/flex-bison/clcalc/modules/data-structures/tests/DUMMY b/flex-bison/clcalc/modules/data-structures/tests/DUMMY new file mode 100644 index 0000000..e69de29 diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/config/test_environment.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/config/test_environment.rb new file mode 100644 index 0000000..2290f29 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/config/test_environment.rb @@ -0,0 +1,12 @@ + +# Setup our load path: +[ + 'lib', + 'test', + 'vendor/behaviors/lib', + 'vendor/hardmock/lib', + 'vendor/constructor/lib', + 'vendor/deep_merge/lib', +].each do |dir| + $LOAD_PATH.unshift( File.join( File.expand_path(File.dirname(__FILE__) + "/../"), dir) ) +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/docs/Ceedling Packet.odt b/flex-bison/clcalc/modules/data-structures/tools/ceedling/docs/Ceedling Packet.odt new file mode 100644 index 0000000..3e9902d Binary files /dev/null and b/flex-bison/clcalc/modules/data-structures/tools/ceedling/docs/Ceedling Packet.odt differ diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/docs/Ceedling Packet.pdf b/flex-bison/clcalc/modules/data-structures/tools/ceedling/docs/Ceedling Packet.pdf new file mode 100644 index 0000000..1c9cce8 Binary files /dev/null and b/flex-bison/clcalc/modules/data-structures/tools/ceedling/docs/Ceedling Packet.pdf differ diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/docs/CeedlingLogo.png b/flex-bison/clcalc/modules/data-structures/tools/ceedling/docs/CeedlingLogo.png new file mode 100644 index 0000000..52f1ce6 Binary files /dev/null and b/flex-bison/clcalc/modules/data-structures/tools/ceedling/docs/CeedlingLogo.png differ diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/cacheinator.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/cacheinator.rb new file mode 100644 index 0000000..47953dd --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/cacheinator.rb @@ -0,0 +1,42 @@ + +class Cacheinator + + constructor :cacheinator_helper, :file_path_utils, :file_wrapper, :yaml_wrapper + + def cache_test_config(hash) + @yaml_wrapper.dump( @file_path_utils.form_test_build_cache_path( INPUT_CONFIGURATION_CACHE_FILE), hash ) + end + + def cache_release_config(hash) + @yaml_wrapper.dump( @file_path_utils.form_release_build_cache_path( INPUT_CONFIGURATION_CACHE_FILE ), hash ) + end + + + def diff_cached_test_file( filepath ) + cached_filepath = @file_path_utils.form_test_build_cache_path( filepath ) + + if (@file_wrapper.exist?( cached_filepath ) and (!@file_wrapper.compare( filepath, cached_filepath ))) + @file_wrapper.cp(filepath, cached_filepath, {:preserve => false}) + return filepath + elsif (!@file_wrapper.exist?( cached_filepath )) + @file_wrapper.cp(filepath, cached_filepath, {:preserve => false}) + return filepath + end + + return cached_filepath + end + + + def diff_cached_test_config?(hash) + cached_filepath = @file_path_utils.form_test_build_cache_path(INPUT_CONFIGURATION_CACHE_FILE) + + return @cacheinator_helper.diff_cached_config?( cached_filepath, hash ) + end + + def diff_cached_release_config?(hash) + cached_filepath = @file_path_utils.form_release_build_cache_path(INPUT_CONFIGURATION_CACHE_FILE) + + return @cacheinator_helper.diff_cached_config?( cached_filepath, hash ) + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/cacheinator_helper.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/cacheinator_helper.rb new file mode 100644 index 0000000..cb0ef78 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/cacheinator_helper.rb @@ -0,0 +1,12 @@ + +class CacheinatorHelper + + constructor :file_wrapper, :yaml_wrapper + + def diff_cached_config?(cached_filepath, hash) + return true if ( not @file_wrapper.exist?(cached_filepath) ) + return true if ( (@file_wrapper.exist?(cached_filepath)) and (!(@yaml_wrapper.load(cached_filepath) == hash)) ) + return false + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/cmock_builder.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/cmock_builder.rb new file mode 100644 index 0000000..4a74aa8 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/cmock_builder.rb @@ -0,0 +1,15 @@ +require 'cmock' + +class CmockBuilder + + attr_accessor :cmock + + def setup + @cmock = nil + end + + def manufacture(cmock_config) + @cmock = CMock.new(cmock_config) + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/configurator.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/configurator.rb new file mode 100644 index 0000000..82b1e61 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/configurator.rb @@ -0,0 +1,248 @@ +require 'defaults' +require 'constants' +require 'file_path_utils' +require 'deep_merge' + + + +class Configurator + + attr_reader :project_config_hash, :environment, :script_plugins, :rake_plugins + attr_accessor :project_logging, :project_debug, :project_verbosity, :sanity_checks + + constructor(:configurator_setup, :configurator_builder, :configurator_plugins, :cmock_builder, :yaml_wrapper, :system_wrapper) do + @project_logging = false + @project_debug = false + @project_verbosity = Verbosity::NORMAL + @sanity_checks = TestResultsSanityChecks::NORMAL + end + + + def setup + # special copy of cmock config to provide to cmock for construction + @cmock_config_hash = {} + + # capture our source config for later merge operations + @source_config_hash = {} + + # note: project_config_hash is an instance variable so constants and accessors created + # in eval() statements in build() have something of proper scope and persistence to reference + @project_config_hash = {} + @project_config_hash_backup = {} + + @script_plugins = [] + @rake_plugins = [] + end + + + def replace_flattened_config(config) + @project_config_hash.merge!(config) + @configurator_setup.build_constants_and_accessors(@project_config_hash, binding()) + end + + + def store_config + @project_config_hash_backup = @project_config_hash.clone + end + + + def restore_config + @project_config_hash = @project_config_hash_backup + @configurator_setup.build_constants_and_accessors(@project_config_hash, binding()) + end + + + def reset_defaults(config) + [:test_compiler, + :test_linker, + :test_fixture, + :test_includes_preprocessor, + :test_file_preprocessor, + :test_dependencies_generator, + :release_compiler, + :release_assembler, + :release_linker, + :release_dependencies_generator].each do |tool| + config[:tools].delete(tool) if (not (config[:tools][tool].nil?)) + end + end + + + def populate_defaults(config) + new_config = DEFAULT_CEEDLING_CONFIG.clone + new_config.deep_merge!(config) + config.replace(new_config) + + @configurator_builder.populate_defaults( config, DEFAULT_TOOLS_TEST ) + @configurator_builder.populate_defaults( config, DEFAULT_TOOLS_TEST_PREPROCESSORS ) if (config[:project][:use_test_preprocessor]) + @configurator_builder.populate_defaults( config, DEFAULT_TOOLS_TEST_DEPENDENCIES ) if (config[:project][:use_auxiliary_dependencies]) + + @configurator_builder.populate_defaults( config, DEFAULT_TOOLS_RELEASE ) if (config[:project][:release_build]) + @configurator_builder.populate_defaults( config, DEFAULT_TOOLS_RELEASE_ASSEMBLER ) if (config[:project][:release_build] and config[:release_build][:use_assembly]) + @configurator_builder.populate_defaults( config, DEFAULT_TOOLS_RELEASE_DEPENDENCIES ) if (config[:project][:release_build] and config[:project][:use_auxiliary_dependencies]) + end + + + def populate_unity_defines(config) + run_test = true + + config[:unity][:defines].each do |define| + if (define =~ /RUN_TEST\s*\(.+\)\s*=/) + run_test = false + break + end + end + + if (run_test) + config[:unity][:defines] << "\"RUN_TEST(func, line_num)=TestRun(func, #func, line_num)\"" + end + end + + + def populate_cmock_defaults(config) + # cmock has its own internal defaults handling, but we need to set these specific values + # so they're present for the build environment to access; + # note: these need to end up in the hash given to initialize cmock for this to be successful + cmock = config[:cmock] + + # yes, we're duplicating the default mock_prefix in cmock, but it's because we need CMOCK_MOCK_PREFIX always available in Ceedling's environment + cmock[:mock_prefix] = 'Mock' if (cmock[:mock_prefix].nil?) + + # just because strict ordering is the way to go + cmock[:enforce_strict_ordering] = true if (cmock[:enforce_strict_ordering].nil?) + + cmock[:mock_path] = File.join(config[:project][:build_root], TESTS_BASE_PATH, 'mocks') if (cmock[:mock_path].nil?) + cmock[:verbosity] = @project_verbosity if (cmock[:verbosity].nil?) + + cmock[:plugins] = [] if (cmock[:plugins].nil?) + cmock[:plugins].map! { |plugin| plugin.to_sym } + cmock[:plugins] << (:cexception) if (!cmock[:plugins].include?(:cexception) and (config[:project][:use_exceptions])) + cmock[:plugins].uniq! + + cmock[:unity_helper] = false if (cmock[:unity_helper].nil?) + + if (cmock[:unity_helper]) + cmock[:includes] << File.basename(cmock[:unity_helper]) + cmock[:includes].uniq! + end + + @cmock_builder.manufacture(cmock) + end + + + # grab tool names from yaml and insert into tool structures so available for error messages + def populate_tool_names_and_stderr_redirect(config) + config[:tools].each_key do |name| + tool = config[:tools][name] + + # populate name if not given + tool[:name] = name.to_s if (tool[:name].nil?) + + # populate stderr redirect option + tool[:stderr_redirect] = StdErrRedirect::NONE if (tool[:stderr_redirect].nil?) + end + end + + + def find_and_merge_plugins(config) + @configurator_plugins.add_load_paths(config) + + @rake_plugins = @configurator_plugins.find_rake_plugins(config) + @script_plugins = @configurator_plugins.find_script_plugins(config) + config_plugins = @configurator_plugins.find_config_plugins(config) + plugin_defaults = @configurator_plugins.find_plugin_defaults(config) + + config_plugins.each do |plugin| + config.deep_merge( @yaml_wrapper.load(plugin) ) + end + + plugin_defaults.each do |defaults| + @configurator_builder.populate_defaults( config, @yaml_wrapper.load(defaults) ) + end + + # special plugin setting for results printing + config[:plugins][:display_raw_test_results] = true if (config[:plugins][:display_raw_test_results].nil?) + end + + + def eval_environment_variables(config) + config[:environment].each do |hash| + key = hash.keys[0] + value_string = hash[key].to_s + if (value_string =~ RUBY_STRING_REPLACEMENT_PATTERN) + value_string.replace(@system_wrapper.module_eval(value_string)) + end + @system_wrapper.env_set(key.to_s.upcase, value_string) + end + end + + + def eval_paths(config) + individual_paths = [ + config[:project][:build_root], + config[:project][:options_paths], + config[:plugins][:load_paths]] + + individual_paths.flatten.each do |path| + path.replace(@system_wrapper.module_eval(path)) if (path =~ RUBY_STRING_REPLACEMENT_PATTERN) + end + + config[:paths].each_pair do |key, list| + list.each { |path_entry| path_entry.replace(@system_wrapper.module_eval(path_entry)) if (path_entry =~ RUBY_STRING_REPLACEMENT_PATTERN) } + end + end + + + def standardize_paths(config) + individual_paths = [ + config[:project][:build_root], + config[:project][:options_paths], + config[:plugins][:load_paths], + config[:cmock][:mock_path]] # cmock path in case it was explicitly set in config + + individual_paths.flatten.each { |path| FilePathUtils::standardize(path) } + + config[:paths].each_pair do |key, list| + list.each{|path| FilePathUtils::standardize(path)} + # ensure that list is an array (i.e. handle case of list being a single string) + config[:paths][key] = [list].flatten + end + + config[:tools].each_pair do |key, tool_config| + FilePathUtils::standardize(tool_config[:executable]) + end + end + + + def validate(config) + # collect felonies and go straight to jail + raise if (not @configurator_setup.validate_required_sections(config)) + + # collect all misdemeanors, everybody on probation + blotter = [] + blotter << @configurator_setup.validate_required_section_values(config) + blotter << @configurator_setup.validate_paths(config) + blotter << @configurator_setup.validate_tools(config) + + raise if (blotter.include?(false)) + end + + + def build(config) + built_config = @configurator_setup.build_project_config(config) + + @source_config_hash = config.clone + @project_config_hash = built_config.clone + store_config() + + @configurator_setup.build_constants_and_accessors(built_config, binding()) + end + + + def insert_rake_plugins(plugins) + plugins.each do |plugin| + @project_config_hash[:project_rakefile_component_files] << plugin + end + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/configurator_builder.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/configurator_builder.rb new file mode 100644 index 0000000..48d99eb --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/configurator_builder.rb @@ -0,0 +1,408 @@ +require 'rubygems' +require 'rake' # for ext() method +require 'file_path_utils' # for class methods +require 'defaults' +require 'constants' # for Verbosity constants class & base file paths + + + +class ConfiguratorBuilder + + constructor :file_system_utils, :file_wrapper, :system_wrapper + + + def build_global_constants(config) + config.each_pair do |key, value| + formatted_key = key.to_s.upcase + # undefine global constant if it already exists + Object.send(:remove_const, formatted_key.to_sym) if @system_wrapper.constants_include?(formatted_key) + # create global constant + Object.module_eval("#{formatted_key} = value") + end + end + + + def build_accessor_methods(config, context) + config.each_pair do |key, value| + # fill configurator object with accessor methods + eval("def #{key.to_s.downcase}() return @project_config_hash[:#{key.to_s}] end", context) + end + end + + + # create a flattened hash from the original configuration structure + def flattenify(config) + new_hash = {} + + config.each_key do | parent | + + # gracefully handle empty top-level entries + next if (config[parent].nil?) + + case config[parent] + when Array + config[parent].each do |hash| + key = "#{parent.to_s.downcase}_#{hash.keys[0].to_s.downcase}".to_sym + new_hash[key] = hash[hash.keys[0]] + end + when Hash + config[parent].each_pair do | child, value | + key = "#{parent.to_s.downcase}_#{child.to_s.downcase}".to_sym + new_hash[key] = value + end + # handle entries with no children, only values + else + new_hash["#{parent.to_s.downcase}".to_sym] = config[parent] + end + + end + + return new_hash + end + + + def populate_defaults(config, defaults) + defaults.keys.sort.each do |section| + defaults[section].keys.sort.each do |entry| + config[section][entry] = defaults[section][entry] if (config[section].nil? or config[section][entry].nil?) + end + end + end + + + def clean(in_hash) + # ensure that include files inserted into test runners have file extensions & proper ones at that + in_hash[:test_runner_includes].map!{|include| include.ext(in_hash[:extension_header])} + end + + + def set_build_paths(in_hash) + out_hash = {} + + project_build_artifacts_root = File.join(in_hash[:project_build_root], 'artifacts') + project_build_tests_root = File.join(in_hash[:project_build_root], TESTS_BASE_PATH) + project_build_release_root = File.join(in_hash[:project_build_root], RELEASE_BASE_PATH) + + paths = [ + [:project_build_artifacts_root, project_build_artifacts_root, true ], + [:project_build_tests_root, project_build_tests_root, true ], + [:project_build_release_root, project_build_release_root, in_hash[:project_release_build] ], + + [:project_test_artifacts_path, File.join(project_build_artifacts_root, TESTS_BASE_PATH), true ], + [:project_test_runners_path, File.join(project_build_tests_root, 'runners'), true ], + [:project_test_results_path, File.join(project_build_tests_root, 'results'), true ], + [:project_test_build_output_path, File.join(project_build_tests_root, 'out'), true ], + [:project_test_build_cache_path, File.join(project_build_tests_root, 'cache'), true ], + [:project_test_dependencies_path, File.join(project_build_tests_root, 'dependencies'), true ], + + [:project_release_artifacts_path, File.join(project_build_artifacts_root, RELEASE_BASE_PATH), in_hash[:project_release_build] ], + [:project_release_build_cache_path, File.join(project_build_release_root, 'cache'), in_hash[:project_release_build] ], + [:project_release_build_output_path, File.join(project_build_release_root, 'out'), in_hash[:project_release_build] ], + [:project_release_build_output_asm_path, File.join(project_build_release_root, 'out', 'asm'), in_hash[:project_release_build] ], + [:project_release_build_output_c_path, File.join(project_build_release_root, 'out', 'c'), in_hash[:project_release_build] ], + [:project_release_dependencies_path, File.join(project_build_release_root, 'dependencies'), in_hash[:project_release_build] ], + + [:project_log_path, File.join(in_hash[:project_build_root], 'logs'), true ], + [:project_temp_path, File.join(in_hash[:project_build_root], 'temp'), true ], + + [:project_test_preprocess_includes_path, File.join(project_build_tests_root, 'preprocess/includes'), in_hash[:project_use_test_preprocessor] ], + [:project_test_preprocess_files_path, File.join(project_build_tests_root, 'preprocess/files'), in_hash[:project_use_test_preprocessor] ], + ] + + out_hash[:project_build_paths] = [] + + # fetch already set mock path + out_hash[:project_build_paths] << in_hash[:cmock_mock_path] if (in_hash[:project_use_mocks]) + + paths.each do |path| + build_path_name = path[0] + build_path = path[1] + build_path_add_condition = path[2] + + # insert path into build paths if associated with true condition + out_hash[:project_build_paths] << build_path if build_path_add_condition + # set path symbol name and path for each entry in paths array + out_hash[build_path_name] = build_path + end + + return out_hash + end + + + def set_force_build_filepaths(in_hash) + out_hash = {} + + out_hash[:project_test_force_rebuild_filepath] = File.join( in_hash[:project_test_dependencies_path], 'force_build' ) + out_hash[:project_release_force_rebuild_filepath] = File.join( in_hash[:project_release_dependencies_path], 'force_build' ) if (in_hash[:project_release_build]) + + return out_hash + end + + + def set_rakefile_components(in_hash) + out_hash = { + :project_rakefile_component_files => + [File.join(CEEDLING_LIB, 'tasks_base.rake'), + File.join(CEEDLING_LIB, 'tasks_filesystem.rake'), + File.join(CEEDLING_LIB, 'tasks_tests.rake'), + File.join(CEEDLING_LIB, 'tasks_vendor.rake'), + File.join(CEEDLING_LIB, 'rules_tests.rake')]} + + out_hash[:project_rakefile_component_files] << File.join(CEEDLING_LIB, 'rules_cmock.rake') if (in_hash[:project_use_mocks]) + out_hash[:project_rakefile_component_files] << File.join(CEEDLING_LIB, 'rules_preprocess.rake') if (in_hash[:project_use_test_preprocessor]) + out_hash[:project_rakefile_component_files] << File.join(CEEDLING_LIB, 'rules_tests_aux_dependencies.rake') if (in_hash[:project_use_auxiliary_dependencies]) + + out_hash[:project_rakefile_component_files] << File.join(CEEDLING_LIB, 'rules_release_aux_dependencies.rake') if (in_hash[:project_release_build] and in_hash[:project_use_auxiliary_dependencies]) + out_hash[:project_rakefile_component_files] << File.join(CEEDLING_LIB, 'rules_release.rake') if (in_hash[:project_release_build]) + out_hash[:project_rakefile_component_files] << File.join(CEEDLING_LIB, 'tasks_release.rake') if (in_hash[:project_release_build]) + + return out_hash + end + + + def set_library_build_info_filepaths(hash) + + # Notes: + # - Dependency on a change to our input configuration hash is handled elsewhere as it is + # dynamically formed during ceedling's execution + # - Compiled vendor dependencies like cmock.o, unity.o, cexception.o are handled below; + # here we're interested only in ceedling-based code generation dependencies + + ceedling_build_info_filepath = File.join(CEEDLING_RELEASE, 'build.info') + cmock_build_info_filepath = FilePathUtils::form_ceedling_vendor_path('cmock/release', 'build.info') + + out_hash = { + :ceedling_build_info_filepath => ceedling_build_info_filepath, + :cmock_build_info_filepath => cmock_build_info_filepath + } + + return out_hash + end + + + def set_release_target(in_hash) + return {} if (not in_hash[:project_release_build]) + + release_target_file = ((in_hash[:release_build_output].nil?) ? (DEFAULT_RELEASE_TARGET_NAME.ext(in_hash[:extension_executable])) : in_hash[:release_build_output]) + + return { + # tempted to make a helper method in file_path_utils? stop right there, pal. you'll introduce a cyclical dependency + :project_release_build_target => File.join(in_hash[:project_release_artifacts_path], release_target_file) + } + end + + + def collect_environment_variables(in_hash) + return { + :collection_environment => in_hash[:environment] + } + end + + + def collect_project_options(in_hash) + options = [] + + in_hash[:project_options_paths].each do |path| + options << @file_wrapper.directory_listing( File.join(path, '*.yml') ) + end + + return { + :collection_project_options => options.flatten + } + end + + + def expand_all_path_globs(in_hash) + out_hash = {} + path_keys = [] + + in_hash.each_key do |key| + next if (not key.to_s[0..4] == 'paths') + path_keys << key + end + + # sorted to provide assured order of traversal in test calls on mocks + path_keys.sort.each do |key| + out_hash["collection_#{key.to_s}".to_sym] = @file_system_utils.collect_paths( in_hash[key] ) + end + + return out_hash + end + + + def collect_source_and_include_paths(in_hash) + return { + :collection_paths_source_and_include => + in_hash[:collection_paths_source] + + in_hash[:collection_paths_include] + } + end + + + def collect_source_include_vendor_paths(in_hash) + extra_paths = [] + extra_paths << FilePathUtils::form_ceedling_vendor_path(CEXCEPTION_LIB_PATH) if (in_hash[:project_use_exceptions]) + + return { + :collection_paths_source_include_vendor => + in_hash[:collection_paths_source_and_include] + + extra_paths + } + end + + + def collect_test_support_source_include_paths(in_hash) + return { + :collection_paths_test_support_source_include => + in_hash[:collection_paths_test] + + in_hash[:collection_paths_support] + + in_hash[:collection_paths_source] + + in_hash[:collection_paths_include] + } + end + + + def collect_test_support_source_include_vendor_paths(in_hash) + extra_paths = [] + extra_paths << FilePathUtils::form_ceedling_vendor_path(UNITY_LIB_PATH) + extra_paths << FilePathUtils::form_ceedling_vendor_path(CEXCEPTION_LIB_PATH) if (in_hash[:project_use_exceptions]) + extra_paths << FilePathUtils::form_ceedling_vendor_path(CMOCK_LIB_PATH) if (in_hash[:project_use_mocks]) + extra_paths << in_hash[:cmock_mock_path] if (in_hash[:project_use_mocks]) + + return { + :collection_paths_test_support_source_include_vendor => + in_hash[:collection_paths_test_support_source_include] + + extra_paths + } + end + + + def collect_tests(in_hash) + all_tests = @file_wrapper.instantiate_file_list + + in_hash[:collection_paths_test].each do |path| + all_tests.include( File.join(path, "#{in_hash[:project_test_file_prefix]}*#{in_hash[:extension_source]}") ) + end + + return {:collection_all_tests => all_tests} + end + + + def collect_assembly(in_hash) + all_assembly = @file_wrapper.instantiate_file_list + + return {:collection_all_assembly => all_assembly} if (not in_hash[:release_build_use_assembly]) + + in_hash[:collection_paths_source].each do |path| + all_assembly.include( File.join(path, "*#{in_hash[:extension_assembly]}") ) + end + + return {:collection_all_assembly => all_assembly} + end + + + def collect_source(in_hash) + all_source = @file_wrapper.instantiate_file_list + + in_hash[:collection_paths_source].each do |path| + all_source.include( File.join(path, "*#{in_hash[:extension_source]}") ) + end + + return {:collection_all_source => all_source} + end + + + def collect_headers(in_hash) + all_headers = @file_wrapper.instantiate_file_list + + paths = + in_hash[:collection_paths_test] + + in_hash[:collection_paths_support] + + in_hash[:collection_paths_source] + + in_hash[:collection_paths_include] + + (paths).each do |path| + all_headers.include( File.join(path, "*#{in_hash[:extension_header]}") ) + end + + return {:collection_all_headers => all_headers} + end + + + def collect_all_existing_compilation_input(in_hash) + all_input = @file_wrapper.instantiate_file_list + + paths = + in_hash[:collection_paths_test] + + in_hash[:collection_paths_support] + + in_hash[:collection_paths_source] + + in_hash[:collection_paths_include] + + [FilePathUtils::form_ceedling_vendor_path(UNITY_LIB_PATH)] + + paths << FilePathUtils::form_ceedling_vendor_path(CEXCEPTION_LIB_PATH) if (in_hash[:project_use_exceptions]) + paths << FilePathUtils::form_ceedling_vendor_path(CMOCK_LIB_PATH) if (in_hash[:project_use_mocks]) + + (paths).each do |path| + all_input.include( File.join(path, "*#{in_hash[:extension_header]}") ) + all_input.include( File.join(path, "*#{in_hash[:extension_source]}") ) + end + + return {:collection_all_existing_compilation_input => all_input} + end + + + def collect_test_and_vendor_defines(in_hash) + test_defines = in_hash[:defines_test].clone + + test_defines.concat(in_hash[:unity_defines]) + test_defines.concat(in_hash[:cmock_defines]) if (in_hash[:project_use_mocks]) + test_defines.concat(in_hash[:cexception_defines]) if (in_hash[:project_use_exceptions]) + + return {:collection_defines_test_and_vendor => test_defines} + end + + + def collect_release_and_vendor_defines(in_hash) + release_defines = in_hash[:defines_release].clone + + release_defines.concat(in_hash[:cexception_defines]) if (in_hash[:project_use_exceptions]) + + return {:collection_defines_release_and_vendor => release_defines} + end + + + def collect_release_artifact_extra_link_objects(in_hash) + objects = [] + + # no build paths here so plugins can remap if necessary (i.e. path mapping happens at runtime) + objects << CEXCEPTION_C_FILE.ext( in_hash[:extension_object] ) if (in_hash[:project_use_exceptions]) + + return {:collection_release_artifact_extra_link_objects => objects} + end + + + def collect_test_fixture_extra_link_objects(in_hash) + # Note: Symbols passed to compiler at command line can change Unity and CException behavior / configuration; + # we also handle those dependencies elsewhere in compilation dependencies + + objects = [UNITY_C_FILE] + + # we don't include paths here because use of plugins or mixing different compilers may require different build paths + objects << CEXCEPTION_C_FILE if (in_hash[:project_use_exceptions]) + objects << CMOCK_C_FILE if (in_hash[:project_use_mocks]) + + # if we're using mocks & a unity helper is defined & that unity helper includes a source file component (not only a header of macros), + # then link in the unity_helper object file too + if ( in_hash[:project_use_mocks] and + in_hash[:cmock_unity_helper] and + @file_wrapper.exist?(in_hash[:cmock_unity_helper].ext(in_hash[:extension_source])) ) + objects << File.basename(in_hash[:cmock_unity_helper]) + end + + # no build paths here so plugins can remap if necessary (i.e. path mapping happens at runtime) + objects.map! { |object| object.ext(in_hash[:extension_object]) } + + return { :collection_test_fixture_extra_link_objects => objects } + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/configurator_plugins.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/configurator_plugins.rb new file mode 100644 index 0000000..4a65579 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/configurator_plugins.rb @@ -0,0 +1,96 @@ +require 'constants' + +class ConfiguratorPlugins + + constructor :stream_wrapper, :file_wrapper, :system_wrapper + + def setup + @rake_plugins = [] + @script_plugins = [] + end + + + def add_load_paths(config) + config[:plugins][:load_paths].each do |root| + @system_wrapper.add_load_path( root ) if ( not @file_wrapper.directory_listing( File.join( root, '*.rb' ) ).empty? ) + + config[:plugins][:enabled].each do |plugin| + path = File.join( root, plugin ) + @system_wrapper.add_load_path( path ) if ( not @file_wrapper.directory_listing( File.join( path, '*.rb' ) ).empty? ) + end + end + end + + + # gather up and return .rake filepaths that exist on-disk + def find_rake_plugins(config) + plugins_with_path = [] + + config[:plugins][:load_paths].each do |root| + config[:plugins][:enabled].each do |plugin| + rake_plugin_path = File.join(root, plugin, "#{plugin}.rake") + if (@file_wrapper.exist?(rake_plugin_path)) + plugins_with_path << rake_plugin_path + @rake_plugins << plugin + end + end + end + + return plugins_with_path + end + + + # gather up and return just names of .rb classes that exist on-disk + def find_script_plugins(config) + config[:plugins][:load_paths].each do |root| + config[:plugins][:enabled].each do |plugin| + script_plugin_path = File.join(root, plugin, "#{plugin}.rb") + @script_plugins << plugin if @file_wrapper.exist?(script_plugin_path) + end + end + + return @script_plugins + end + + + # gather up and return configuration .yml filepaths that exist on-disk + def find_config_plugins(config) + plugins_with_path = [] + + config[:plugins][:load_paths].each do |root| + config[:plugins][:enabled].each do |plugin| + config_plugin_path = File.join(root, plugin, "#{plugin}.yml") + plugins_with_path << config_plugin_path if @file_wrapper.exist?(config_plugin_path) + end + end + + return plugins_with_path + end + + + # gather up and return default .yml filepaths that exist on-disk + def find_plugin_defaults(config) + defaults_with_path = [] + + config[:plugins][:load_paths].each do |root| + config[:plugins][:enabled].each do |plugin| + default_path = File.join(root, plugin, 'defaults.yml') + defaults_with_path << default_path if @file_wrapper.exist?(default_path) + end + end + + return defaults_with_path + end + + + def validate_plugins(enabled_plugins) + missing_plugins = Set.new(enabled_plugins) - Set.new(@rake_plugins) - Set.new(@script_plugins) + + missing_plugins.each do |plugin| + @stream_wrapper.stdout_puts.stderr_puts("ERROR: Ceedling plugin '#{plugin}' contains no rake or ruby class entry point. (Misspelled or missing files?)") + end + + raise if (missing_plugins.size > 0) + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/configurator_setup.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/configurator_setup.rb new file mode 100644 index 0000000..e404727 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/configurator_setup.rb @@ -0,0 +1,114 @@ + +# add sort-ability to symbol so we can order keys array in hash for test-ability +class Symbol + include Comparable + + def <=>(other) + self.to_s <=> other.to_s + end +end + + +class ConfiguratorSetup + + constructor :configurator_builder, :configurator_validator + + + def build_project_config(config) + # convert config object to flattened hash + new_config = @configurator_builder.flattenify(config) + + # flesh out config + @configurator_builder.clean(new_config) + + # add to hash values we build up from configuration & file system contents + new_config.merge!(@configurator_builder.set_build_paths(new_config)) + new_config.merge!(@configurator_builder.set_force_build_filepaths(new_config)) + new_config.merge!(@configurator_builder.set_rakefile_components(new_config)) + new_config.merge!(@configurator_builder.set_library_build_info_filepaths(new_config)) + new_config.merge!(@configurator_builder.set_release_target(new_config)) + new_config.merge!(@configurator_builder.collect_project_options(new_config)) + new_config.merge!(@configurator_builder.collect_environment_variables(config)) + + # iterate through all entries in paths section and expand any & all globs to actual paths + new_config.merge!(@configurator_builder.expand_all_path_globs(new_config)) + + new_config.merge!(@configurator_builder.collect_source_and_include_paths(new_config)) + new_config.merge!(@configurator_builder.collect_source_include_vendor_paths(new_config)) + new_config.merge!(@configurator_builder.collect_test_support_source_include_paths(new_config)) + new_config.merge!(@configurator_builder.collect_test_support_source_include_vendor_paths(new_config)) + new_config.merge!(@configurator_builder.collect_tests(new_config)) + new_config.merge!(@configurator_builder.collect_assembly(new_config)) + new_config.merge!(@configurator_builder.collect_source(new_config)) + new_config.merge!(@configurator_builder.collect_headers(new_config)) + new_config.merge!(@configurator_builder.collect_all_existing_compilation_input(new_config)) + new_config.merge!(@configurator_builder.collect_test_and_vendor_defines(new_config)) + new_config.merge!(@configurator_builder.collect_release_and_vendor_defines(new_config)) + new_config.merge!(@configurator_builder.collect_release_artifact_extra_link_objects(new_config)) + new_config.merge!(@configurator_builder.collect_test_fixture_extra_link_objects(new_config)) + + return new_config + end + + + def build_constants_and_accessors(config, context) + @configurator_builder.build_global_constants(config) + @configurator_builder.build_accessor_methods(config, context) + end + + + def validate_required_sections(config) + validation = [] + validation << @configurator_validator.exists?(config, :project) + validation << @configurator_validator.exists?(config, :paths) + + return false if (validation.include?(false)) + return true + end + + def validate_required_section_values(config) + validation = [] + validation << @configurator_validator.exists?(config, :project, :build_root) + validation << @configurator_validator.exists?(config, :paths, :test) + validation << @configurator_validator.exists?(config, :paths, :source) + + return false if (validation.include?(false)) + return true + end + + def validate_paths(config) + validation = [] + + validation << @configurator_validator.validate_filepath(config, {:search_system_path => false}, :project, :build_root) + validation << @configurator_validator.validate_filepath(config, {:search_system_path => false}, :cmock, :unity_helper) if config[:cmock][:unity_helper] + + config[:project][:options_paths].each do |path| + validation << @configurator_validator.validate_filepath_simple( path, :project, :options_paths ) + end + + config[:plugins][:load_paths].each do |path| + validation << @configurator_validator.validate_filepath_simple( path, :plugins, :load_paths ) + end + + config[:paths].keys.sort.each do |key| + validation << @configurator_validator.validate_path_list(config, :paths, key) + end + + return false if (validation.include?(false)) + return true + end + + def validate_tools(config) + validation = [] + + config[:tools].keys.sort.each do |key| + validation << @configurator_validator.exists?(config, :tools, key, :executable) + validation << @configurator_validator.validate_filepath(config, {:search_system_path => true}, :tools, key, :executable) + validation << @configurator_validator.validate_tool_stderr_redirect(config, :tools, key) + end + + return false if (validation.include?(false)) + return true + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/configurator_validator.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/configurator_validator.rb new file mode 100644 index 0000000..e50c0d4 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/configurator_validator.rb @@ -0,0 +1,154 @@ +require 'constants' +require 'tool_executor' # for argument replacement pattern +require 'file_path_utils' # for glob handling class methods + + +class ConfiguratorValidator + + constructor :file_wrapper, :stream_wrapper, :system_wrapper + + # walk into config hash verify existence of data at key depth + def exists?(config, *keys) + hash = retrieve_value(config, keys) + exist = !hash[:value].nil? + + if (not exist) + # no verbosity checking since this is lowest level anyhow & verbosity checking depends on configurator + @stream_wrapper.stderr_puts("ERROR: Required config file entry #{format_key_sequence(keys, hash[:depth])} does not exist.") + end + + return exist + end + + + # walk into config hash. verify directory path(s) at given key depth + def validate_path_list(config, *keys) + hash = retrieve_value(config, keys) + list = hash[:value] + + # return early if we couldn't walk into hash and find a value + return false if (list.nil?) + + path_list = [] + exist = true + + case list + when String then path_list << list + when Array then path_list = list + end + + path_list.each do |path| + base_path = FilePathUtils::extract_path(path) # lop off add/subtract notation & glob specifiers + + if (not @file_wrapper.exist?(base_path)) + # no verbosity checking since this is lowest level anyhow & verbosity checking depends on configurator + @stream_wrapper.stderr_puts("ERROR: Config path #{format_key_sequence(keys, hash[:depth])}['#{base_path}'] does not exist on disk.") + exist = false + end + end + + return exist + end + + + # simple path verification + def validate_filepath_simple(path, *keys) + validate_path = path + + if (not @file_wrapper.exist?(validate_path)) + # no verbosity checking since this is lowest level anyhow & verbosity checking depends on configurator + @stream_wrapper.stderr_puts("ERROR: Config path '#{validate_path}' associated with #{format_key_sequence(keys, keys.size)} does not exist on disk.") + return false + end + + return true + end + + + # walk into config hash. verify specified file exists. + def validate_filepath(config, options, *keys) + hash = retrieve_value(config, keys) + filepath = hash[:value] + + # return early if we couldn't walk into hash and find a value + return false if (filepath.nil?) + + # skip everything if we've got an argument replacement pattern + return true if (filepath =~ TOOL_EXECUTOR_ARGUMENT_REPLACEMENT_PATTERN) + + # if there's no path included, verify file exists somewhere in system search paths + if (not filepath.include?('/') and options[:search_system_path]) + exists = false + + @system_wrapper.search_paths.each do |path| + if (@file_wrapper.exist?(File.join(path, filepath))) + exists = true + break + end + end + + if (not exists) + # no verbosity checking since this is lowest level anyhow & verbosity checking depends on configurator + @stream_wrapper.stderr_puts("ERROR: Config filepath #{format_key_sequence(keys, hash[:depth])}['#{filepath}'] does not exist in system search paths.") + return false + end + + # if there is a path included, check that explicit filepath exists + else + if (not @file_wrapper.exist?(filepath)) + # no verbosity checking since this is lowest level anyhow & verbosity checking depends on configurator + @stream_wrapper.stderr_puts("ERROR: Config filepath #{format_key_sequence(keys, hash[:depth])}['#{filepath}'] does not exist on disk.") + return false + end + end + + return true + end + + def validate_tool_stderr_redirect(config, tools, tool) + redirect = config[tools][tool][:stderr_redirect] + if (redirect.class == Symbol) + # map constants and force to array of strings for runtime universality across ruby versions + if (not StdErrRedirect.constants.map{|constant| constant.to_s}.include?(redirect.to_s.upcase)) + error = "ERROR: [:#{tools}][:#{tool}][:stderr_redirect][:#{redirect}] is not a recognized option " + + "{#{StdErrRedirect.constants.map{|constant| ':' + constant.to_s.downcase}.join(', ')}}." + @stream_wrapper.stderr_puts(error) + return false + end + end + + return true + end + + private ######################################### + + + def retrieve_value(config, keys) + value = nil + hash = config + depth = 0 + + # walk into hash & extract value at requested key sequence + keys.each do |symbol| + depth += 1 + if (not hash[symbol].nil?) + hash = hash[symbol] + value = hash + else + value = nil + break + end + end + + return {:value => value, :depth => depth} + end + + + def format_key_sequence(keys, depth) + walked_keys = keys.slice(0, depth) + formatted_keys = walked_keys.map{|key| "[:#{key.to_s}]"} + + return formatted_keys.join + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/constants.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/constants.rb new file mode 100644 index 0000000..634a7e4 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/constants.rb @@ -0,0 +1,62 @@ + +class Verbosity + SILENT = 0 # as silent as possible (though there are some messages that must be spit out) + ERRORS = 1 # only errors + COMPLAIN = 2 # spit out errors and warnings/notices + NORMAL = 3 # errors, warnings/notices, standard status messages + OBNOXIOUS = 4 # all messages including extra verbose output (used for lite debugging / verification) + DEBUG = 5 # special extra verbose output for hardcore debugging +end + + +class TestResultsSanityChecks + NONE = 0 # no sanity checking of test results + NORMAL = 1 # perform non-problematic checks + THOROUGH = 2 # perform checks that require inside knowledge of system workings +end + + +class StdErrRedirect + NONE = :none + AUTO = :auto + WIN = :win + UNIX = :unix + TCSH = :tcsh +end + +CEXCEPTION_ROOT_PATH = 'c_exception' +CEXCEPTION_LIB_PATH = "#{CEXCEPTION_ROOT_PATH}/lib" +CEXCEPTION_C_FILE = 'CException.c' +CEXCEPTION_H_FILE = 'CException.h' + +UNITY_ROOT_PATH = 'unity' +UNITY_LIB_PATH = "#{UNITY_ROOT_PATH}/src" +UNITY_C_FILE = 'unity.c' +UNITY_H_FILE = 'unity.h' +UNITY_INTERNALS_H_FILE = 'unity_internals.h' + +CMOCK_ROOT_PATH = 'cmock' +CMOCK_LIB_PATH = "#{CMOCK_ROOT_PATH}/src" +CMOCK_C_FILE = 'cmock.c' +CMOCK_H_FILE = 'cmock.h' + + +DEFAULT_CEEDLING_MAIN_PROJECT_FILE = 'project.yml' # main project file +DEFAULT_CEEDLING_USER_PROJECT_FILE = 'user.yml' # supplemental user config file + +INPUT_CONFIGURATION_CACHE_FILE = 'input.yml' # input configuration file dump + + +TEST_ROOT_NAME = 'test' +TEST_TASK_ROOT = TEST_ROOT_NAME + ':' +TEST_CONTEXT = TEST_ROOT_NAME.to_sym +RELEASE_ROOT_NAME = 'release' + +RUBY_STRING_REPLACEMENT_PATTERN = /#\{.+\}/ +RUBY_EVAL_REPLACEMENT_PATTERN = /^\{(.+)\}$/ +TOOL_EXECUTOR_ARGUMENT_REPLACEMENT_PATTERN = /(\$\{(\d+)\})/ + +NULL_FILE_PATH = '/dev/null' + +TESTS_BASE_PATH = 'tests' +RELEASE_BASE_PATH = 'release' diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/defaults.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/defaults.rb new file mode 100644 index 0000000..78cbcbd --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/defaults.rb @@ -0,0 +1,349 @@ +require 'constants' +require 'system_wrapper' +require 'file_path_utils' + + +DEFAULT_TEST_COMPILER_TOOL = { + :executable => FilePathUtils.os_executable_ext('gcc'), + :name => 'default_test_compiler', + :stderr_redirect => StdErrRedirect::NONE, + :arguments => [ + {"-I\"$\"" => 'COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR'}, + {"-I\"$\"" => 'COLLECTION_PATHS_TEST_TOOLCHAIN_INCLUDE'}, + {"-D$" => 'COLLECTION_DEFINES_TEST_AND_VENDOR'}, + "-DGNU_COMPILER", + {"$" => 'TEST_COMPILER_ARGUMENTS'}, + "-c \"${1}\"", + "-o \"${2}\"", + ] + } + +DEFAULT_TEST_LINKER_TOOL = { + :executable => FilePathUtils.os_executable_ext('gcc'), + :name => 'default_test_linker', + :stderr_redirect => StdErrRedirect::NONE, + :arguments => [ + {"$" => 'TEST_LINKER_ARGUMENTS'}, + "\"${1}\"", + "-o \"${2}\"", + ] + } + +DEFAULT_TEST_FIXTURE_TOOL = { + :executable => '${1}', + :name => 'default_test_fixture', + :stderr_redirect => StdErrRedirect::AUTO, + :arguments => [ + {"$" => 'TEST_FIXTURE_ARGUMENTS'}, + ] + } + + + +DEFAULT_TEST_INCLUDES_PREPROCESSOR_TOOL = { + :executable => FilePathUtils.os_executable_ext('cpp'), + :name => 'default_test_includes_preprocessor', + :stderr_redirect => StdErrRedirect::NONE, + :arguments => [ + '-MM', '-MG', + # avoid some possibility of deep system lib header file complications by omitting vendor paths + # if cpp is run on *nix system, escape spaces in paths; if cpp on windows just use the paths collection as is + {"-I\"$\"" => "{SystemWrapper.is_windows? ? COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE : COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE.map{|path| path.gsub(\/ \/, \'\\\\ \') }}"}, + {"-D$" => 'COLLECTION_DEFINES_TEST_AND_VENDOR'}, + {"-D$" => 'DEFINES_TEST_PREPROCESS'}, + "-DGNU_PREPROCESSOR", + {"$" => 'TEST_INCLUDES_PREPROCESSOR_ARGUMENTS'}, + '-w', + '-nostdinc', + "\"${1}\"" + ] + } + +DEFAULT_TEST_FILE_PREPROCESSOR_TOOL = { + :executable => FilePathUtils.os_executable_ext('gcc'), + :name => 'default_test_file_preprocessor', + :stderr_redirect => StdErrRedirect::NONE, + :arguments => [ + '-E', + {"-I\"$\"" => 'COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR'}, + {"-I\"$\"" => 'PATHS_TEST_TOOLCHAIN_INCLUDE'}, + {"-D$" => 'COLLECTION_DEFINES_TEST_AND_VENDOR'}, + {"-D$" => 'DEFINES_TEST_PREPROCESS'}, + "-DGNU_PREPROCESSOR", + {"$" => 'TEST_FILE_PREPROCESSOR_ARGUMENTS'}, + "\"${1}\"", + "-o \"${2}\"" + ] + } + +DEFAULT_TEST_DEPENDENCIES_GENERATOR_TOOL = { + :executable => FilePathUtils.os_executable_ext('gcc'), + :name => 'default_test_dependencies_generator', + :stderr_redirect => StdErrRedirect::NONE, + :arguments => [ + {"-I\"$\"" => 'COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR'}, + {"-I\"$\"" => 'COLLECTION_PATHS_TEST_TOOLCHAIN_INCLUDE'}, + {"-D$" => 'COLLECTION_DEFINES_TEST_AND_VENDOR'}, + {"-D$" => 'DEFINES_TEST_PREPROCESS'}, + "-DGNU_PREPROCESSOR", + "-MT \"${3}\"", + '-MM', '-MD', '-MG', + "-MF \"${2}\"", + {"$" => 'TEST_DEPENDENCIES_GENERATOR_ARGUMENTS'}, + "-c \"${1}\"", + ] + } + +DEFAULT_RELEASE_DEPENDENCIES_GENERATOR_TOOL = { + :executable => FilePathUtils.os_executable_ext('gcc'), + :name => 'default_release_dependencies_generator', + :stderr_redirect => StdErrRedirect::NONE, + :arguments => [ + {"-I\"$\"" => 'COLLECTION_PATHS_SOURCE_AND_INCLUDE'}, + {"-I\"$\"" => 'COLLECTION_PATHS_RELEASE_TOOLCHAIN_INCLUDE'}, + {"-D$" => 'COLLECTION_DEFINES_RELEASE_AND_VENDOR'}, + {"-D$" => 'DEFINES_RELEASE_PREPROCESS'}, + "-DGNU_PREPROCESSOR", + "-MT \"${3}\"", + '-MM', '-MD', '-MG', + "-MF \"${2}\"", + {"$" => 'RELEASE_DEPENDENCIES_GENERATOR_ARGUMENTS'}, + "-c \"${1}\"", + ] + } + + +DEFAULT_RELEASE_COMPILER_TOOL = { + :executable => FilePathUtils.os_executable_ext('gcc'), + :name => 'default_release_compiler', + :stderr_redirect => StdErrRedirect::NONE, + :arguments => [ + {"-I\"$\"" => 'COLLECTION_PATHS_SOURCE_INCLUDE_VENDOR'}, + {"-I\"$\"" => 'COLLECTION_PATHS_RELEASE_TOOLCHAIN_INCLUDE'}, + {"-D$" => 'COLLECTION_DEFINES_RELEASE_AND_VENDOR'}, + "-DGNU_COMPILER", + {"$" => 'RELEASE_COMPILER_ARGUMENTS'}, + "-c \"${1}\"", + "-o \"${2}\"", + ] + } + +DEFAULT_RELEASE_ASSEMBLER_TOOL = { + :executable => FilePathUtils.os_executable_ext('as'), + :name => 'default_release_assembler', + :stderr_redirect => StdErrRedirect::NONE, + :arguments => [ + {"-I\"$\"" => 'COLLECTION_PATHS_SOURCE_AND_INCLUDE'}, + {"$" => 'RELEASE_ASSEMBLER_ARGUMENTS'}, + "\"${1}\"", + "-o \"${2}\"", + ] + } + +DEFAULT_RELEASE_LINKER_TOOL = { + :executable => FilePathUtils.os_executable_ext('gcc'), + :name => 'default_release_linker', + :stderr_redirect => StdErrRedirect::NONE, + :arguments => [ + {"$" => 'RELEASE_LINKER_ARGUMENTS'}, + "\"${1}\"", + "-o \"${2}\"", + ] + } + + +DEFAULT_TOOLS_TEST = { + :tools => { + :test_compiler => DEFAULT_TEST_COMPILER_TOOL, + :test_linker => DEFAULT_TEST_LINKER_TOOL, + :test_fixture => DEFAULT_TEST_FIXTURE_TOOL, + } + } + +DEFAULT_TOOLS_TEST_PREPROCESSORS = { + :tools => { + :test_includes_preprocessor => DEFAULT_TEST_INCLUDES_PREPROCESSOR_TOOL, + :test_file_preprocessor => DEFAULT_TEST_FILE_PREPROCESSOR_TOOL, + } + } + +DEFAULT_TOOLS_TEST_DEPENDENCIES = { + :tools => { + :test_dependencies_generator => DEFAULT_TEST_DEPENDENCIES_GENERATOR_TOOL, + } + } + + +DEFAULT_TOOLS_RELEASE = { + :tools => { + :release_compiler => DEFAULT_RELEASE_COMPILER_TOOL, + :release_linker => DEFAULT_RELEASE_LINKER_TOOL, + } + } + +DEFAULT_TOOLS_RELEASE_ASSEMBLER = { + :tools => { + :release_assembler => DEFAULT_RELEASE_ASSEMBLER_TOOL, + } + } + +DEFAULT_TOOLS_RELEASE_DEPENDENCIES = { + :tools => { + :release_dependencies_generator => DEFAULT_RELEASE_DEPENDENCIES_GENERATOR_TOOL, + } + } + + +DEFAULT_RELEASE_TARGET_NAME = 'project' + +DEFAULT_CEEDLING_CONFIG = { + :project => { + # :build_root must be set by user + :use_exceptions => true, + :use_mocks => true, + :use_test_preprocessor => false, + :use_auxiliary_dependencies => false, + :test_file_prefix => 'test_', + :options_paths => [], + :release_build => false, + }, + + :release_build => { + # :output is set while building configuration -- allows smart default system-dependent file extension handling + :use_assembly => false, + }, + + :paths => { + :test => [], # must be populated by user + :source => [], # must be populated by user + :support => [], + :include => [], + :test_toolchain_include => [], + :release_toolchain_include => [], + }, + + # unlike other top-level entries, environment's value is an array to preserve order + :environment => [ + # when evaluated, this provides wider text field for rake task comments + {:rake_columns => '120'}, + ], + + :defines => { + :test => [], + :test_preprocess => [], + :release => [], + :release_preprocess => [], + }, + + :extension => { + :header => '.h', + :source => '.c', + :assembly => '.s', + :object => '.o', + :executable => ( SystemWrapper.is_windows? ? '.exe' : '.out' ), + :testpass => '.pass', + :testfail => '.fail', + :dependencies => '.d', + }, + + :unity => { + :defines => [] + }, + + :cmock => { + :defines => [] + }, + + :cexception => { + :defines => [] + }, + + :test_runner => { + :includes => [], + :file_suffix => '_runner', + }, + + # all tools populated while building up config structure + :tools => {}, + + # empty argument lists for default tools + # (these can be overridden in project file to add arguments to tools without totally redefining tools) + :test_compiler => { :arguments => [] }, + :test_linker => { :arguments => [] }, + :test_fixture => { + :arguments => [], + :link_objects => [], # compiled object files to always be linked in (e.g. cmock.o if using mocks) + }, + :test_includes_preprocessor => { :arguments => [] }, + :test_file_preprocessor => { :arguments => [] }, + :test_dependencies_generator => { :arguments => [] }, + :release_compiler => { :arguments => [] }, + :release_linker => { :arguments => [] }, + :release_assembler => { :arguments => [] }, + :release_dependencies_generator => { :arguments => [] }, + + :plugins => { + :load_paths => [], + :enabled => [], + } + } + + +DEFAULT_TESTS_RESULTS_REPORT_TEMPLATE = %q{ +% ignored = hash[:results][:counts][:ignored] +% failed = hash[:results][:counts][:failed] +% stdout_count = hash[:results][:counts][:stdout] +% header_prepend = ((hash[:header].length > 0) ? "#{hash[:header]}: " : '') +% banner_width = 25 + header_prepend.length # widest message + +% if (ignored > 0) +<%=@ceedling[:plugin_reportinator].generate_banner(header_prepend + 'IGNORED UNIT TEST SUMMARY')%> +% hash[:results][:ignores].each do |ignore| +% ignore[:collection].each do |item| +<%=ignore[:source][:path]%><%=File::SEPARATOR%><%=ignore[:source][:file]%>:<%=item[:line]%>:<%=item[:test]%> +% if (item[:message].length > 0) +: "<%=item[:message]%>" +% else +<%="\n"%> +% end +% end +% end + +% end +% if (failed > 0) +<%=@ceedling[:plugin_reportinator].generate_banner(header_prepend + 'FAILED UNIT TEST SUMMARY')%> +% hash[:results][:failures].each do |failure| +% failure[:collection].each do |item| +<%=failure[:source][:path]%><%=File::SEPARATOR%><%=failure[:source][:file]%>:<%=item[:line]%>:<%=item[:test]%> +% if (item[:message].length > 0) +: "<%=item[:message]%>" +% else +<%="\n"%> +% end +% end +% end + +% end +% if (stdout_count > 0) +<%=@ceedling[:plugin_reportinator].generate_banner(header_prepend + 'UNIT TEST OTHER OUTPUT')%> +% hash[:results][:stdout].each do |string| +% string[:collection].each do |item| +<%=string[:source][:path]%><%=File::SEPARATOR%><%=string[:source][:file]%>: "<%=item%>" +% end +% end + +% end +% total_string = hash[:results][:counts][:total].to_s +% format_string = "%#{total_string.length}i" +<%=@ceedling[:plugin_reportinator].generate_banner(header_prepend + 'OVERALL UNIT TEST SUMMARY')%> +% if (hash[:results][:counts][:total] > 0) +TESTED: <%=hash[:results][:counts][:total].to_s%> +PASSED: <%=sprintf(format_string, hash[:results][:counts][:passed])%> +FAILED: <%=sprintf(format_string, failed)%> +IGNORED: <%=sprintf(format_string, ignored)%> +% else + +No tests executed. +% end + +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/dependinator.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/dependinator.rb new file mode 100644 index 0000000..061caee --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/dependinator.rb @@ -0,0 +1,92 @@ + +class Dependinator + + constructor :configurator, :project_config_manager, :test_includes_extractor, :file_path_utils, :rake_wrapper, :file_wrapper + + def touch_force_rebuild_files + @file_wrapper.touch( @configurator.project_test_force_rebuild_filepath ) + @file_wrapper.touch( @configurator.project_release_force_rebuild_filepath ) if (@configurator.project_release_build) + end + + + + def load_release_object_deep_dependencies(dependencies_list) + dependencies_list.each { |dependencies_file| @rake_wrapper.load_dependencies( dependencies_file ) } + end + + + def enhance_release_file_dependencies(files) + files.each do |filepath| + @rake_wrapper[filepath].enhance( [@configurator.project_release_force_rebuild_filepath] ) if (@project_config_manager.release_config_changed) + @rake_wrapper[filepath].enhance( [@configurator.ceedling_build_info_filepath] ) + end + end + + + + def load_test_object_deep_dependencies(files_list) + dependencies_list = @file_path_utils.form_test_dependencies_filelist(files_list) + dependencies_list.each { |dependencies_file| @rake_wrapper.load_dependencies(dependencies_file) } + end + + + def enhance_runner_dependencies(runner_filepath) + @rake_wrapper[runner_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed) + @rake_wrapper[runner_filepath].enhance( [@configurator.ceedling_build_info_filepath] ) + end + + + def enhance_shallow_include_lists_dependencies(include_lists) + include_lists.each do |include_list_filepath| + @rake_wrapper[include_list_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed) + @rake_wrapper[include_list_filepath].enhance( [@configurator.ceedling_build_info_filepath] ) + end + end + + + def enhance_preprocesed_file_dependencies(files) + files.each do |filepath| + @rake_wrapper[filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed) + @rake_wrapper[filepath].enhance( [@configurator.ceedling_build_info_filepath] ) + end + end + + + def enhance_mock_dependencies(mocks_list) + # if input configuration or ceedling changes, make sure these guys get rebuilt + mocks_list.each do |mock_filepath| + @rake_wrapper[mock_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed) + @rake_wrapper[mock_filepath].enhance( [@configurator.cmock_unity_helper] ) if (@configurator.cmock_unity_helper) + @rake_wrapper[mock_filepath].enhance( [@configurator.ceedling_build_info_filepath] ) + @rake_wrapper[mock_filepath].enhance( [@configurator.cmock_build_info_filepath] ) + end + end + + + def enhance_dependencies_dependencies(dependencies) + dependencies.each do |dependencies_filepath| + @rake_wrapper[dependencies_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed) + @rake_wrapper[dependencies_filepath].enhance( [@configurator.ceedling_build_info_filepath] ) + end + end + + + def enhance_test_build_object_dependencies(objects) + objects.each do |object_filepath| + @rake_wrapper[object_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed) + @rake_wrapper[object_filepath].enhance( [@configurator.ceedling_build_info_filepath] ) + end + end + + + def enhance_results_dependencies(result_filepath) + @rake_wrapper[result_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed) + @rake_wrapper[result_filepath].enhance( [@configurator.ceedling_build_info_filepath] ) + end + + + def setup_test_executable_dependencies(test, objects) + @rake_wrapper.create_file_task( @file_path_utils.form_test_executable_filepath(test), objects) + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/file_finder.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/file_finder.rb new file mode 100644 index 0000000..752d6bd --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/file_finder.rb @@ -0,0 +1,132 @@ +require 'rubygems' +require 'rake' # for adding ext() method to string + +class FileFinder + + constructor :configurator, :file_finder_helper, :cacheinator, :file_path_utils, :file_wrapper, :yaml_wrapper + + def prepare_search_sources + @all_test_source_and_header_file_collection = + @configurator.collection_all_tests + + @configurator.collection_all_source + + @configurator.collection_all_headers + end + + + def find_header_file(mock_file) + header = File.basename(mock_file).sub(/#{@configurator.cmock_mock_prefix}/, '').ext(@configurator.extension_header) + + found_path = @file_finder_helper.find_file_in_collection(header, @configurator.collection_all_headers, :error) + + return found_path + end + + + def find_header_input_for_mock_file(mock_file) + found_path = find_header_file(mock_file) + mock_input = found_path + + if (@configurator.project_use_test_preprocessor) + mock_input = @cacheinator.diff_cached_test_file( @file_path_utils.form_preprocessed_file_filepath( found_path ) ) + end + + return mock_input + end + + + def find_source_from_test(test, complain) + test_prefix = @configurator.project_test_file_prefix + source_paths = @configurator.collection_all_source + + source = File.basename(test).sub(/#{test_prefix}/, '') + + # we don't blow up if a test file has no corresponding source file + return @file_finder_helper.find_file_in_collection(source, source_paths, complain) + end + + + def find_test_from_runner_path(runner_path) + extension_source = @configurator.extension_source + + test_file = File.basename(runner_path).sub(/#{@configurator.test_runner_file_suffix}#{'\\'+extension_source}/, extension_source) + + found_path = @file_finder_helper.find_file_in_collection(test_file, @configurator.collection_all_tests, :error) + + return found_path + end + + + def find_test_input_for_runner_file(runner_path) + found_path = find_test_from_runner_path(runner_path) + runner_input = found_path + + if (@configurator.project_use_test_preprocessor) + runner_input = @cacheinator.diff_cached_test_file( @file_path_utils.form_preprocessed_file_filepath( found_path ) ) + end + + return runner_input + end + + + def find_test_from_file_path(file_path) + test_file = File.basename(file_path).ext(@configurator.extension_source) + + found_path = @file_finder_helper.find_file_in_collection(test_file, @configurator.collection_all_tests, :error) + + return found_path + end + + + def find_test_or_source_or_header_file(file_path) + file = File.basename(file_path) + return @file_finder_helper.find_file_in_collection(file, @all_test_source_and_header_file_collection, :error) + end + + + def find_compilation_input_file(file_path) + found_file = '' + + source_file = File.basename(file_path).ext(@configurator.extension_source) + + # We only collect files that already exist when we start up. + # FileLists can produce undesired results for dynamically generated files depending on when they're accessed. + # So collect mocks and runners separately and right now. + if (source_file =~ /#{@configurator.test_runner_file_suffix}/) + found_file = + @file_finder_helper.find_file_in_collection( + source_file, + @file_wrapper.directory_listing( File.join(@configurator.project_test_runners_path, '*') ), + :error) + + elsif (@configurator.project_use_mocks and (source_file =~ /#{@configurator.cmock_mock_prefix}/)) + found_file = + @file_finder_helper.find_file_in_collection( + source_file, + @file_wrapper.directory_listing( File.join(@configurator.cmock_mock_path, '*') ), + :error) + + else + found_file = + @file_finder_helper.find_file_in_collection( + source_file, + @configurator.collection_all_existing_compilation_input, + :error) + end + + return found_file + end + + + def find_source_file(file_path, complain) + source_file = File.basename(file_path).ext(@configurator.extension_source) + return @file_finder_helper.find_file_in_collection(source_file, @configurator.collection_all_source, complain) + end + + + def find_assembly_file(file_path) + assembly_file = File.basename(file_path).ext(@configurator.extension_assembly) + return @file_finder_helper.find_file_in_collection(assembly_file, @configurator.collection_all_assembly, :error) + end + +end + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/file_finder_helper.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/file_finder_helper.rb new file mode 100644 index 0000000..487f0fe --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/file_finder_helper.rb @@ -0,0 +1,54 @@ +require 'fileutils' +require 'constants' # for Verbosity enumeration + +class FileFinderHelper + + constructor :streaminator + + + def find_file_in_collection(file_name, file_list, complain, extra_message="") + file_to_find = nil + + file_list.each do |item| + base_file = File.basename(item) + + # case insensitive comparison + if (base_file.casecmp(file_name) == 0) + # case sensitive check + if (base_file == file_name) + file_to_find = item + break + else + blow_up(file_name, "However, a filename having different capitalization was found: '#{item}'.") + end + end + + end + + case (complain) + when :error then blow_up(file_name, extra_message) if (file_to_find.nil?) + when :warn then gripe(file_name, extra_message) if (file_to_find.nil?) + #when :ignore then + end + + return file_to_find + end + + private + + def blow_up(file_name, extra_message="") + error = "ERROR: Found no file '#{file_name}' in search paths." + error += ' ' if (extra_message.length > 0) + @streaminator.stderr_puts(error + extra_message, Verbosity::ERRORS) + raise + end + + def gripe(file_name, extra_message="") + warning = "WARNING: Found no file '#{file_name}' in search paths." + warning += ' ' if (extra_message.length > 0) + @streaminator.stderr_puts(warning + extra_message, Verbosity::COMPLAIN) + end + +end + + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/file_path_utils.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/file_path_utils.rb new file mode 100644 index 0000000..cb029f9 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/file_path_utils.rb @@ -0,0 +1,177 @@ +require 'rubygems' +require 'rake' # for ext() +require 'fileutils' +require 'system_wrapper' + +# global utility methods (for plugins, project files, etc.) +def ceedling_form_filepath(destination_path, original_filepath, new_extension=nil) + filename = File.basename(original_filepath) + filename.replace(filename.ext(new_extension)) if (!new_extension.nil?) + return File.join( destination_path.gsub(/\\/, '/'), filename ) +end + +class FilePathUtils + + GLOB_MATCHER = /[\*\?\{\}\[\]]/ + + constructor :configurator, :file_wrapper + + + ######### class methods ########## + + # standardize path to use '/' path separator & begin with './' & have no trailing path separator + def self.standardize(path) + path.strip! + path.gsub!(/\\/, '/') + path.gsub!(/^((\+|-):)?\.\//, '') + path.chomp!('/') + return path + end + + def self.os_executable_ext(executable) + return executable.ext('.exe') if SystemWrapper.is_windows? + return executable + end + + # extract directory path from between optional add/subtract aggregation modifiers and up to glob specifiers + # note: slightly different than File.dirname in that /files/foo remains /files/foo and does not become /files + def self.extract_path(path) + path = path.sub(/^(\+|-):/, '') + + # find first occurrence of path separator followed by directory glob specifier: *, ?, {, }, [, ] + find_index = (path =~ GLOB_MATCHER) + + # no changes needed (lop off final path separator) + return path.chomp('/') if (find_index.nil?) + + # extract up to first glob specifier + path = path[0..(find_index-1)] + + # lop off everything up to and including final path separator + find_index = path.rindex('/') + return path[0..(find_index-1)] if (not find_index.nil?) + + # return string up to first glob specifier if no path separator found + return path + end + + # return whether the given path is to be aggregated (no aggregation modifier defaults to same as +:) + def self.add_path?(path) + return (path =~ /^-:/).nil? + end + + # get path (and glob) lopping off optional +: / -: prefixed aggregation modifiers + def self.extract_path_no_aggregation_operators(path) + return path.sub(/^(\+|-):/, '') + end + + # all the globs that may be in a path string work fine with one exception; + # to recurse through all subdirectories, the glob is dir/**/** but our paths use + # convention of only dir/** + def self.reform_glob(path) + return path if (path =~ /\/\*\*$/).nil? + return path + '/**' + end + + def self.form_ceedling_vendor_path(*filepaths) + return File.join( CEEDLING_VENDOR, filepaths ) + end + + ######### instance methods ########## + + def form_temp_path(filepath, prefix='') + return File.join( @configurator.project_temp_path, prefix + File.basename(filepath) ) + end + + ### release ### + def form_release_build_cache_path(filepath) + return File.join( @configurator.project_release_build_cache_path, File.basename(filepath) ) + end + + def form_release_dependencies_filepath(filepath) + return File.join( @configurator.project_release_dependencies_path, File.basename(filepath).ext(@configurator.extension_dependencies) ) + end + + def form_release_build_c_object_filepath(filepath) + return File.join( @configurator.project_release_build_output_c_path, File.basename(filepath).ext(@configurator.extension_object) ) + end + + def form_release_build_asm_object_filepath(filepath) + return File.join( @configurator.project_release_build_output_asm_path, File.basename(filepath).ext(@configurator.extension_object) ) + end + + def form_release_build_c_objects_filelist(files) + return (@file_wrapper.instantiate_file_list(files)).pathmap("#{@configurator.project_release_build_output_c_path}/%n#{@configurator.extension_object}") + end + + def form_release_build_asm_objects_filelist(files) + return (@file_wrapper.instantiate_file_list(files)).pathmap("#{@configurator.project_release_build_output_asm_path}/%n#{@configurator.extension_object}") + end + + def form_release_dependencies_filelist(files) + return (@file_wrapper.instantiate_file_list(files)).pathmap("#{@configurator.project_release_dependencies_path}/%n#{@configurator.extension_dependencies}") + end + + ### tests ### + def form_test_build_cache_path(filepath) + return File.join( @configurator.project_test_build_cache_path, File.basename(filepath) ) + end + + def form_pass_results_filepath(filepath) + return File.join( @configurator.project_test_results_path, File.basename(filepath).ext(@configurator.extension_testpass) ) + end + + def form_fail_results_filepath(filepath) + return File.join( @configurator.project_test_results_path, File.basename(filepath).ext(@configurator.extension_testfail) ) + end + + def form_runner_filepath_from_test(filepath) + return File.join( @configurator.project_test_runners_path, File.basename(filepath, @configurator.extension_source)) + @configurator.test_runner_file_suffix + @configurator.extension_source + end + + def form_test_filepath_from_runner(filepath) + return filepath.sub(/#{TEST_RUNNER_FILE_SUFFIX}/, '') + end + + def form_runner_object_filepath_from_test(filepath) + return (form_test_build_object_filepath(filepath)).sub(/(#{@configurator.extension_object})$/, "#{@configurator.test_runner_file_suffix}\\1") + end + + def form_test_build_object_filepath(filepath) + return File.join( @configurator.project_test_build_output_path, File.basename(filepath).ext(@configurator.extension_object) ) + end + + def form_test_executable_filepath(filepath) + return File.join( @configurator.project_test_build_output_path, File.basename(filepath).ext(@configurator.extension_executable) ) + end + + def form_preprocessed_file_filepath(filepath) + return File.join( @configurator.project_test_preprocess_files_path, File.basename(filepath) ) + end + + def form_preprocessed_includes_list_filepath(filepath) + return File.join( @configurator.project_test_preprocess_includes_path, File.basename(filepath) ) + end + + def form_test_build_objects_filelist(sources) + return (@file_wrapper.instantiate_file_list(sources)).pathmap("#{@configurator.project_test_build_output_path}/%n#{@configurator.extension_object}") + end + + def form_preprocessed_mockable_headers_filelist(mocks) + # pathmapping note: "%{#{@configurator.cmock_mock_prefix},}n" replaces mock_prefix with nothing (signified by absence of anything after comma inside replacement brackets) + return (@file_wrapper.instantiate_file_list(mocks)).pathmap("#{@configurator.project_test_preprocess_files_path}/%{#{@configurator.cmock_mock_prefix},}n#{@configurator.extension_header}") + end + + def form_mocks_source_filelist(mocks) + return (@file_wrapper.instantiate_file_list(mocks)).pathmap("#{@configurator.cmock_mock_path}/%n#{@configurator.extension_source}") + end + + def form_test_dependencies_filelist(files) + return (@file_wrapper.instantiate_file_list(files)).pathmap("#{@configurator.project_test_dependencies_path}/%n#{@configurator.extension_dependencies}") + end + + def form_pass_results_filelist(path, files) + return (@file_wrapper.instantiate_file_list(files)).pathmap("#{path}/%n#{@configurator.extension_testpass}") + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/file_system_utils.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/file_system_utils.rb new file mode 100644 index 0000000..2c286ca --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/file_system_utils.rb @@ -0,0 +1,59 @@ +require 'rubygems' +require 'rake' +require 'set' +require 'fileutils' +require 'file_path_utils.rb' + + +class FileSystemUtils + + constructor :file_wrapper + + # build up path list from input of one or more strings or arrays of (+/-) paths & globs + def collect_paths(*paths) + raw = [] # all paths and globs + plus = Set.new # all paths to expand and add + minus = Set.new # all paths to remove from plus set + + # assemble all globs and simple paths, reforming our glob notation to ruby globs + paths.each do |paths_container| + case (paths_container) + when String then raw << (FilePathUtils::reform_glob(paths_container)) + when Array then paths_container.each {|path| raw << (FilePathUtils::reform_glob(path))} + else raise "Don't know how to handle #{paths_container.class}" + end + end + + # iterate through each path and glob + raw.each do |path| + + dirs = [] # container for only (expanded) paths + + # if a glob, expand it and slurp up all non-file paths + if path.include?('*') + # grab base directory only if globs are snug up to final path separator + if (path =~ /\/\*+$/) + dirs << FilePathUtils.extract_path(path) + end + + # grab expanded sub-directory globs + expanded = @file_wrapper.directory_listing( FilePathUtils.extract_path_no_aggregation_operators(path) ) + expanded.each do |entry| + dirs << entry if @file_wrapper.directory?(entry) + end + + # else just grab simple path + # note: we could just run this through glob expansion but such an + # approach doesn't handle a path not yet on disk) + else + dirs << FilePathUtils.extract_path_no_aggregation_operators(path) + end + + # add dirs to the appropriate set based on path aggregation modifier if present + FilePathUtils.add_path?(path) ? plus.merge(dirs) : minus.merge(dirs) + end + + return (plus - minus).to_a.uniq + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/file_wrapper.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/file_wrapper.rb new file mode 100644 index 0000000..04e1007 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/file_wrapper.rb @@ -0,0 +1,74 @@ +require 'rubygems' +require 'rake' # for FileList +require 'constants' +require 'fileutils' + + +class FileWrapper + + def get_expanded_path(path) + return File.expand_path(path) + end + + def exist?(filepath) + return true if (filepath == NULL_FILE_PATH) + return File.exist?(filepath) + end + + def directory?(path) + return File.directory?(path) + end + + def dirname(path) + return File.dirname(path) + end + + def directory_listing(glob) + return Dir.glob(glob) + end + + def rm_f(filepath, options={}) + FileUtils.rm_f(filepath, options) + end + + def rm_r(filepath, options={}) + FileUtils.rm_r(filepath, options={}) + end + + def cp(source, destination, options={}) + FileUtils.cp(source, destination, options) + end + + def compare(from, to) + return FileUtils.compare_file(from, to) + end + + def open(filepath, flags) + File.open(filepath, flags) do |file| + yield(file) + end + end + + def read(filepath) + return File.read(filepath) + end + + def touch(filepath, options={}) + FileUtils.touch(filepath, options) + end + + def write(filepath, contents, flags='w') + File.open(filepath, flags) do |file| + file.write(contents) + end + end + + def readlines(filepath) + return File.readlines(filepath) + end + + def instantiate_file_list(files=[]) + return FileList.new(files) + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/generator.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/generator.rb new file mode 100644 index 0000000..f620ee4 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/generator.rb @@ -0,0 +1,131 @@ +require 'constants' # for Verbosity constants class + + +class Generator + + constructor :configurator, :preprocessinator, :cmock_builder, :generator_test_runner, :generator_test_results, :test_includes_extractor, :tool_executor, :file_finder, :file_path_utils, :streaminator, :plugin_manager, :file_wrapper + + + def generate_shallow_includes_list(context, file) + @preprocessinator.preprocess_shallow_includes(file) + end + + def generate_preprocessed_file(context, file) + @streaminator.stdout_puts("Preprocessing #{File.basename(file)}...", Verbosity::NORMAL) + @preprocessinator.preprocess_file(file) + end + + def generate_dependencies_file(tool, context, source, object, dependencies) + @streaminator.stdout_puts("Generating dependencies for #{File.basename(source)}...", Verbosity::NORMAL) + + command_line = + @tool_executor.build_command_line( + tool, + source, + dependencies, + object) + + @tool_executor.exec(command_line) + end + + def generate_mock(context, header_filepath) + arg_hash = {:header_file => header_filepath, :context => context} + @plugin_manager.pre_mock_execute(arg_hash) + + @cmock_builder.cmock.setup_mocks( arg_hash[:header_file] ) + + @plugin_manager.post_mock_execute(arg_hash) + end + + # test_filepath may be either preprocessed test file or original test file + def generate_test_runner(context, test_filepath, runner_filepath) + arg_hash = {:context => context, :test_file => test_filepath, :runner_file => runner_filepath} + + @plugin_manager.pre_runner_execute(arg_hash) + + # collect info we need + module_name = File.basename(arg_hash[:test_file]) + test_cases = @generator_test_runner.find_test_cases( @file_finder.find_test_from_runner_path(runner_filepath) ) + mock_list = @test_includes_extractor.lookup_raw_mock_list(arg_hash[:test_file]) + + @streaminator.stdout_puts("Generating runner for #{module_name}...", Verbosity::NORMAL) + + # build runner file + @file_wrapper.open(runner_filepath, 'w') do |output| + @generator_test_runner.create_header(output, mock_list) + @generator_test_runner.create_externs(output, test_cases) + @generator_test_runner.create_mock_management(output, mock_list) + @generator_test_runner.create_runtest(output, mock_list, test_cases) + @generator_test_runner.create_main(output, module_name, test_cases) + end + + @plugin_manager.post_runner_execute(arg_hash) + end + + def generate_object_file(tool, context, source, object) + arg_hash = {:tool => tool, :context => context, :source => source, :object => object} + @plugin_manager.pre_compile_execute(arg_hash) + + @streaminator.stdout_puts("Compiling #{File.basename(arg_hash[:source])}...", Verbosity::NORMAL) + shell_result = @tool_executor.exec( @tool_executor.build_command_line(arg_hash[:tool], arg_hash[:source], arg_hash[:object]) ) + + arg_hash[:shell_result] = shell_result + @plugin_manager.post_compile_execute(arg_hash) + end + + def generate_executable_file(tool, context, objects, executable) + shell_result = {} + arg_hash = {:tool => tool, :context => context, :objects => objects, :executable => executable} + @plugin_manager.pre_link_execute(arg_hash) + + @streaminator.stdout_puts("Linking #{File.basename(arg_hash[:executable])}...", Verbosity::NORMAL) + + begin + shell_result = @tool_executor.exec( @tool_executor.build_command_line(arg_hash[:tool], arg_hash[:objects], arg_hash[:executable]) ) + rescue + notice = "\n" + + "NOTICE: If the linker reports missing symbols, the following may be to blame:\n" + + " 1. Test lacks #include statements corresponding to needed source files.\n" + + " 2. Project search paths do not contain source files corresponding to #include statements in the test.\n" + + if (@configurator.project_use_mocks) + notice += " 3. Test does not #include needed mocks.\n\n" + else + notice += "\n" + end + + @streaminator.stderr_puts(notice, Verbosity::COMPLAIN) + raise + end + + arg_hash[:shell_result] = shell_result + @plugin_manager.post_link_execute(arg_hash) + end + + def generate_test_results(tool, context, executable, result) + arg_hash = {:tool => tool, :context => context, :executable => executable, :result_file => result} + @plugin_manager.pre_test_execute(arg_hash) + + @streaminator.stdout_puts("Running #{File.basename(arg_hash[:executable])}...", Verbosity::NORMAL) + + # Unity's exit code is equivalent to the number of failed tests, so we tell @tool_executor not to fail out if there are failures + # so that we can run all tests and collect all results + shell_result = @tool_executor.exec( @tool_executor.build_command_line(arg_hash[:tool], arg_hash[:executable]), [], {:boom => false} ) + + if (shell_result[:output].nil? or shell_result[:output].strip.empty?) + @streaminator.stderr_puts("ERROR: Test executable \"#{File.basename(executable)}\" did not produce any results.", Verbosity::ERRORS) + raise + end + + processed = @generator_test_results.process_and_write_results( shell_result, + arg_hash[:result_file], + @file_finder.find_test_from_file_path(arg_hash[:executable]) ) + + arg_hash[:result_file] = processed[:result_file] + arg_hash[:results] = processed[:results] + arg_hash[:shell_result] = shell_result # for raw output display if no plugins for formatted display + + @plugin_manager.post_test_execute(arg_hash) + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/generator_test_results.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/generator_test_results.rb new file mode 100644 index 0000000..3ac79e2 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/generator_test_results.rb @@ -0,0 +1,90 @@ +require 'rubygems' +require 'rake' # for .ext() +require 'constants' + + +class GeneratorTestResults + TEST_STATISTICS_REGEX = /-+\s+(\d+)\s+Tests\s+(\d+)\s+Failures\s+(\d+)\s+Ignored\s+(OK|FAIL)\s*/i + + constructor :configurator, :generator_test_results_sanity_checker, :yaml_wrapper + + def process_and_write_results(unity_shell_result, results_file, test_file) + output_file = results_file + + results = get_results_structure + + results[:source][:path] = File.dirname(test_file) + results[:source][:file] = File.basename(test_file) + + # process test statistics + if (unity_shell_result[:output] =~ TEST_STATISTICS_REGEX) + results[:counts][:total] = $1.to_i + results[:counts][:failed] = $2.to_i + results[:counts][:ignored] = $3.to_i + results[:counts][:passed] = (results[:counts][:total] - results[:counts][:failed] - results[:counts][:ignored]) + end + + # remove test statistics lines + unity_shell_result[:output].sub!(TEST_STATISTICS_REGEX, '') + + # bust up the output into individual lines + raw_unity_lines = unity_shell_result[:output].split(/\n|\r\n/) + + raw_unity_lines.each do |line| + # process unity output + case line + when /(:IGNORE)/ + elements = extract_line_elements(line, results[:source][:file]) + results[:ignores] << elements[0] + results[:stdout] << elements[1] if (!elements[1].nil?) + when /(:PASS$)/ + elements = extract_line_elements(line, results[:source][:file]) + results[:successes] << elements[0] + results[:stdout] << elements[1] if (!elements[1].nil?) + when /(:FAIL)/ + elements = extract_line_elements(line, results[:source][:file]) + results[:failures] << elements[0] + results[:stdout] << elements[1] if (!elements[1].nil?) + else # collect up all other + results[:stdout] << line.chomp + end + end + + @generator_test_results_sanity_checker.verify(results, unity_shell_result[:exit_code]) + + output_file = results_file.ext(@configurator.extension_testfail) if (results[:counts][:failed] > 0) + + @yaml_wrapper.dump(output_file, results) + + return { :result_file => output_file, :result => results } + end + + private + + def get_results_structure + return { + :source => {:path => '', :file => ''}, + :successes => [], + :failures => [], + :ignores => [], + :counts => {:total => 0, :passed => 0, :failed => 0, :ignored => 0}, + :stdout => [], + } + end + + def extract_line_elements(line, filename) + # handle anything preceding filename in line as extra output to be collected + stdout = nil + stdout_regex = /(.+)#{Regexp.escape(filename)}.+/i + + if (line =~ stdout_regex) + stdout = $1.clone + line.sub!(/#{Regexp.escape(stdout)}/, '') + end + + # collect up test results minus and extra output + elements = (line.strip.split(':'))[1..-1] + return {:test => elements[1], :line => elements[0].to_i, :message => (elements[3..-1].join(':')).strip}, stdout + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/generator_test_results_sanity_checker.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/generator_test_results_sanity_checker.rb new file mode 100644 index 0000000..9f1b65c --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/generator_test_results_sanity_checker.rb @@ -0,0 +1,62 @@ +require 'constants' +require 'rubygems' +require 'rake' # for ext() method + + +class GeneratorTestResultsSanityChecker + + constructor :configurator, :streaminator + + def verify(results, unity_exit_code) + + # do no sanity checking if it's disabled + return if (@configurator.sanity_checks == TestResultsSanityChecks::NONE) + + ceedling_ignores_count = results[:ignores].size + ceedling_failures_count = results[:failures].size + ceedling_tests_summation = (ceedling_ignores_count + ceedling_failures_count + results[:successes].size) + + # Exit code handling is not a sanity check that can always be performed because + # command line simulators may or may not pass through Unity's exit code + if (@configurator.sanity_checks >= TestResultsSanityChecks::THOROUGH) + # many platforms limit exit codes to a maximum of 255 + if ((ceedling_failures_count != unity_exit_code) and (unity_exit_code < 255)) + sanity_check_warning(results[:source][:file], "Unity's exit code (#{unity_exit_code}) does not match Ceedling's summation of failed test cases (#{ceedling_failures_count}).") + end + + if ((ceedling_failures_count < 255) and (unity_exit_code == 255)) + sanity_check_warning(results[:source][:file], "Ceedling's summation of failed test cases (#{ceedling_failures_count}) is less than Unity's exit code (255 or more).") + end + end + + if (ceedling_ignores_count != results[:counts][:ignored]) + sanity_check_warning(results[:source][:file], "Unity's final ignore count (#{results[:counts][:ignored]}) does not match Ceedling's summation of ignored test cases (#{ceedling_ignores_count}).") + end + + if (ceedling_failures_count != results[:counts][:failed]) + sanity_check_warning(results[:source][:file], "Unity's final fail count (#{results[:counts][:failed]}) does not match Ceedling's summation of failed test cases (#{ceedling_failures_count}).") + end + + if (ceedling_tests_summation != results[:counts][:total]) + sanity_check_warning(results[:source][:file], "Unity's final test count (#{results[:counts][:total]}) does not match Ceedling's summation of all test cases (#{ceedling_tests_summation}).") + end + + end + + private + + def sanity_check_warning(file, message) + notice = "\n" + + "ERROR: Internal sanity check for test fixture '#{file.ext(@configurator.extension_executable)}' finds that #{message}\n" + + " Possible causes:\n" + + " 1. Your test + source dereferenced a null pointer.\n" + + " 2. Your test + source indexed past the end of a buffer.\n" + + " 3. Your test + source committed a memory access violation.\n" + + " 4. Your test fixture produced an exit code of 0 despite execution ending prematurely.\n" + + " Sanity check failures of test results are usually a symptom of interrupted test execution.\n\n" + + @streaminator.stderr_puts( notice ) + raise + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/generator_test_runner.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/generator_test_runner.rb new file mode 100644 index 0000000..361be61 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/generator_test_runner.rb @@ -0,0 +1,206 @@ + +class GeneratorTestRunner + + constructor :configurator, :file_path_utils, :file_wrapper + + + def find_test_cases(test_file) + tests = [] + tests_and_line_numbers = [] + lines = [] + + # if we don't have preprocessor assistance, do some basic preprocessing of our own + if (not @configurator.project_use_test_preprocessor) + source = @file_wrapper.read(test_file) + + # remove line comments + source = source.gsub(/\/\/.*$/, '') + # remove block comments + source = source.gsub(/\/\*.*?\*\//m, '') + + # treat preprocessor directives as a logical line + lines = source.split(/(^\s*\#.*$) | (;|\{|\}) /x) # match ;, {, and } as end of lines + # otherwise, read the preprocessed file raw + else + lines = @file_wrapper.read( @file_path_utils.form_preprocessed_file_filepath(test_file) ).split(/;|\{|\}/) + end + + # step 1. find test functions in (possibly preprocessed) file + # (note that lines are not broken up at end of lines) + lines.each do |line| + if (line =~ /^\s*void\s+((T|t)est.*)\s*\(\s*(void)?\s*\)/m) + tests << ($1.strip) + end + end + + # step 2. associate test functions with line numbers in (non-preprocessed) original file + # (note that this time we must scan file contents broken up by end of lines) + raw_lines = @file_wrapper.read(test_file).split("\n") + raw_index = 0 + + tests.each do |test| + raw_lines[raw_index..-1].each_with_index do |line, index| + # test function might be declared across lines; look for it by its name followed + # by a few tell-tale signs + if (line =~ /#{test}\s*($|\(|\()/) + raw_index += (index + 1) + tests_and_line_numbers << {:test => test, :line_number => raw_index} + break + end + end + end + + return tests_and_line_numbers + end + + + def create_header(output, mock_list) + output << "/* AUTOGENERATED FILE. DO NOT EDIT. */\n" + output << "#include \"unity.h\"\n" + + @configurator.test_runner_includes.each do |include| + output << "#include \"#{include}\"\n" + end + + output << "#include \n" + output << "#include \n" + + if (@configurator.project_use_exceptions == true) + output << "#include \"CException.h\"\n" + end + + unless (mock_list.empty?) + header_extension = @configurator.extension_header + mock_list.each do |mock| + output << "#include \"#{mock}#{header_extension}\"\n" + end + if (@configurator.cmock_enforce_strict_ordering == true) + output << "\n" + output << "int GlobalExpectCount;\n" + output << "int GlobalVerifyOrder;\n" + output << "char* GlobalOrderError;\n" + end + end + + output << "\n" + output << "char MessageBuffer[50];\n" + end + + + def create_externs(output, test_cases) + output << "\n" + output << "extern void setUp(void);\n" + output << "extern void tearDown(void);\n" + output << "\n" if not test_cases.empty? + + test_cases.each do |item| + output << "extern void #{item[:test]}(void);\n" + end + end + + + def create_mock_management(output, mock_list) + + unless (mock_list.empty?) + header_extension = @configurator.extension_header + + output << "\n" + output << "static void CMock_Init(void)\n" + output << "{\n" + + if (@configurator.cmock_enforce_strict_ordering == true) + output << " GlobalExpectCount = 0;\n" + output << " GlobalVerifyOrder = 0;\n" + output << " GlobalOrderError = NULL;\n" + end + + mock_list.each do |mock| + output << " #{mock.sub(/#{'\\'+header_extension}/, '')}_Init();\n" + end + output << "}\n" + output << "\n" + + output << "static void CMock_Verify(void)\n" + output << "{\n" + mock_list.each do |mock| + output << " #{mock.sub(/#{'\\'+header_extension}/, '')}_Verify();\n" + end + output << "}\n" + output << "\n" + + output << "static void CMock_Destroy(void)\n" + output << "{\n" + mock_list.each do |mock| + output << " #{mock.sub(/#{'\\'+header_extension}/, '')}_Destroy();\n" + end + output << "}\n" + output << "\n" + + output << "void CMock_VerifyAndReset(void)\n" + output << "{\n" + output << " CMock_Verify();\n" + output << " CMock_Destroy();\n" + output << " CMock_Init();\n" + output << "}\n" + output << "\n" + end + + end + + + def create_runtest(output, mock_list, test_cases) + + unless(test_cases.empty?) + use_exceptions = @configurator.project_use_exceptions + + tab = ' ' # default spacing + tab = ' ' if (use_exceptions) + + output << "\n" + output << "static void TestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum)\n" + output << "{\n" + output << " Unity.CurrentTestName = FuncName;\n" + output << " Unity.CurrentTestLineNumber = FuncLineNum;\n" + output << " Unity.NumberOfTests++;\n" + output << " if (TEST_PROTECT())\n" + output << " {\n" + output << " CEXCEPTION_T e;\n" if use_exceptions + output << " Try {\n" if use_exceptions + output << "#{tab}CMock_Init();\n" unless (mock_list.empty?) + output << "#{tab}setUp();\n" + output << "#{tab}Func();\n" + output << "#{tab}CMock_Verify();\n" unless (mock_list.empty?) + output << " } Catch(e) { TEST_FAIL_MESSAGE(\"Unhandled Exception!\"); }\n" if use_exceptions + output << " }\n" + output << " CMock_Destroy();\n" unless (mock_list.empty?) + output << " if (TEST_PROTECT() && !(Unity.CurrentTestIgnored))\n" + output << " {\n" + output << " tearDown();\n" + output << " }\n" + output << " UnityConcludeTest();\n" + output << "}\n" + end + + end + + + def create_main(output, module_name, test_cases) + output << "\n" + output << "int main(void)\n" + output << "{\n" + output << " UnityBegin();\n" + output << " Unity.TestFile = \"#{module_name}\";\n" + output << "\n" + + output << " // RUN_TEST calls runTest\n" unless (test_cases.empty?) + test_cases.each do |item| + output << " RUN_TEST(#{item[:test]}, #{item[:line_number]});\n" + end + + output << "\n" + output << " return UnityEnd();\n" + output << "}\n" + output << "\n" + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/loginator.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/loginator.rb new file mode 100644 index 0000000..92276e1 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/loginator.rb @@ -0,0 +1,31 @@ + +class Loginator + + constructor :configurator, :project_file_loader, :project_config_manager, :file_wrapper, :system_wrapper + + + def setup_log_filepath + config_files = [] + config_files << @project_file_loader.main_file + config_files << @project_file_loader.user_file + config_files.concat( @project_config_manager.options_files ) + config_files.compact! + config_files.map! { |file| file.ext('') } + + log_name = config_files.join( '_' ) + + @project_log_filepath = File.join( @configurator.project_log_path, log_name.ext('.log') ) + end + + + def log(string, heading=nil) + return if (not @configurator.project_logging) + + output = "\n[#{@system_wrapper.time_now}]" + output += " :: #{heading}" if (not heading.nil?) + output += "\n#{string.strip}\n" + + @file_wrapper.write(@project_log_filepath, output, 'a') + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/makefile.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/makefile.rb new file mode 100644 index 0000000..a1ff9bd --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/makefile.rb @@ -0,0 +1,44 @@ + +# modified version of Rake's provided make-style dependency loader +# customizations: (1) handles windows drives in paths -- colons don't confuse task demarcation (2) handles spaces in directory paths + +module Rake + + # Makefile loader to be used with the import file loader. + class MakefileLoader + + # Load the makefile dependencies in +fn+. + def load(fn) + open(fn) do |mf| + lines = mf.read + lines.gsub!(/#[^\n]*\n/m, "") # remove comments + lines.gsub!(/\\\n/, ' ') # string together line continuations into single line + lines.split("\n").each do |line| + process_line(line) + end + end + end + + private + + # Process one logical line of makefile data. + def process_line(line) + # split on presence of task demaractor followed by space (i.e don't get confused by a colon in a win path) + file_tasks, args = line.split(/:\s/) + + return if args.nil? + + # split at non-escaped space boundary between files (i.e. escaped spaces in paths are left alone) + dependents = args.split(/\b\s+/) + # replace escaped spaces and clean up any extra whitespace + dependents.map! { |path| path.gsub(/\\ /, ' ').strip } + + file_tasks.strip.split.each do |file_task| + file file_task => dependents + end + end + end + + # Install the handler + Rake.application.add_loader('mf', MakefileLoader.new) +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/objects.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/objects.yml new file mode 100644 index 0000000..95a6d9b --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/objects.yml @@ -0,0 +1,278 @@ + +file_wrapper: + +stream_wrapper: + +rake_wrapper: + +yaml_wrapper: + +system_wrapper: + +cmock_builder: + +reportinator: + +rake_utils: + compose: + - rake_wrapper + +file_path_utils: + compose: + - configurator + - file_wrapper + +file_system_utils: + compose: file_wrapper + +project_file_loader: + compose: + - yaml_wrapper + - stream_wrapper + - system_wrapper + - file_wrapper + +project_config_manager: + compose: + - cacheinator + - yaml_wrapper + +cacheinator: + compose: + - cacheinator_helper + - file_path_utils + - file_wrapper + - yaml_wrapper + +cacheinator_helper: + compose: + - file_wrapper + - yaml_wrapper + +tool_executor: + compose: + - configurator + - tool_executor_helper + - streaminator + - system_wrapper + +tool_executor_helper: + compose: + - streaminator + - system_wrapper + +configurator: + compose: + - configurator_setup + - configurator_plugins + - configurator_builder + - cmock_builder + - yaml_wrapper + - system_wrapper + +configurator_setup: + compose: + - configurator_builder + - configurator_validator + +configurator_plugins: + compose: + - stream_wrapper + - file_wrapper + - system_wrapper + +configurator_validator: + compose: + - file_wrapper + - stream_wrapper + - system_wrapper + +configurator_builder: + compose: + - file_system_utils + - file_wrapper + - system_wrapper + +loginator: + compose: + - configurator + - project_file_loader + - project_config_manager + - file_wrapper + - system_wrapper + +streaminator: + compose: + - streaminator_helper + - verbosinator + - loginator + - stream_wrapper + +streaminator_helper: + +setupinator: + +plugin_manager: + compose: + - configurator + - plugin_manager_helper + - streaminator + - reportinator + - system_wrapper + +plugin_manager_helper: + +plugin_reportinator: + compose: + - plugin_reportinator_helper + - plugin_manager + - reportinator + +plugin_reportinator_helper: + compose: + - configurator + - streaminator + - yaml_wrapper + - file_wrapper + +verbosinator: + compose: configurator + +file_finder: + compose: + - configurator + - file_finder_helper + - cacheinator + - file_path_utils + - file_wrapper + - yaml_wrapper + +file_finder_helper: + compose: streaminator + +test_includes_extractor: + compose: + - configurator + - yaml_wrapper + - file_wrapper + +task_invoker: + compose: + - dependinator + - rake_utils + - rake_wrapper + +generator: + compose: + - configurator + - preprocessinator + - cmock_builder + - generator_test_runner + - generator_test_results + - test_includes_extractor + - tool_executor + - file_finder + - file_path_utils + - streaminator + - plugin_manager + - file_wrapper + +generator_test_results: + compose: + - configurator + - generator_test_results_sanity_checker + - yaml_wrapper + +generator_test_results_sanity_checker: + compose: + - configurator + - streaminator + +generator_test_runner: + compose: + - configurator + - file_path_utils + - file_wrapper + +dependinator: + compose: + - configurator + - project_config_manager + - test_includes_extractor + - file_path_utils + - rake_wrapper + - file_wrapper + +preprocessinator: + compose: + - preprocessinator_helper + - preprocessinator_includes_handler + - preprocessinator_file_handler + - task_invoker + - file_path_utils + - yaml_wrapper + +preprocessinator_helper: + compose: + - configurator + - test_includes_extractor + - task_invoker + - file_finder + - file_path_utils + +preprocessinator_includes_handler: + compose: + - configurator + - tool_executor + - task_invoker + - file_path_utils + - yaml_wrapper + - file_wrapper + +preprocessinator_file_handler: + compose: + - preprocessinator_extractor + - configurator + - tool_executor + - file_path_utils + - file_wrapper + +preprocessinator_extractor: + compose: + - file_wrapper + +test_invoker: + compose: + - configurator + - test_invoker_helper + - streaminator + - preprocessinator + - task_invoker + - dependinator + - project_config_manager + - file_path_utils + +test_invoker_helper: + compose: + - configurator + - task_invoker + - dependinator + - test_includes_extractor + - file_finder + - file_path_utils + - streaminator + - file_wrapper + +release_invoker: + compose: + - release_invoker_helper + - configurator + - dependinator + - task_invoker + - file_path_utils + +release_invoker_helper: + compose: + - configurator + - dependinator + - task_invoker diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/plugin.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/plugin.rb new file mode 100644 index 0000000..a412555 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/plugin.rb @@ -0,0 +1,63 @@ + +class String + def left_margin(margin=0) + non_whitespace_column = 0 + new_lines = [] + + # find first line with non-whitespace and count left columns of whitespace + self.each_line do |line| + if (line =~ /^\s*\S/) + non_whitespace_column = $&.length - 1 + break + end + end + + # iterate through each line, chopping off leftmost whitespace columns and add back the desired whitespace margin + self.each_line do |line| + columns = [] + margin.times{columns << ' '} + # handle special case of line being narrower than width to be lopped off + if (non_whitespace_column < line.length) + new_lines << "#{columns.join}#{line[non_whitespace_column..-1]}" + else + new_lines << "\n" + end + end + + return new_lines.join + end +end + +class Plugin + attr_reader :name + + def initialize(system_objects, name) + @ceedling = system_objects + @name = name + self.setup + end + + def setup; end + + def pre_build; end + + def pre_mock_execute(arg_hash); end + def post_mock_execute(arg_hash); end + + def pre_runner_execute(arg_hash); end + def post_runner_execute(arg_hash); end + + def pre_compile_execute(arg_hash); end + def post_compile_execute(arg_hash); end + + def pre_link_execute(arg_hash); end + def post_link_execute(arg_hash); end + + def pre_test_execute(arg_hash); end + def post_test_execute(arg_hash); end + + def post_build; end + + def summary; end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/plugin_manager.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/plugin_manager.rb new file mode 100644 index 0000000..0ec22ec --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/plugin_manager.rb @@ -0,0 +1,85 @@ +require 'constants' +require 'set' + +class PluginManager + + constructor :configurator, :plugin_manager_helper, :streaminator, :reportinator, :system_wrapper + + def setup + @build_fail_registry = [] + @plugin_objects = [] # so we can preserve order + end + + def load_plugin_scripts(script_plugins, system_objects) + script_plugins.each do |plugin| + # protect against instantiating object multiple times due to processing config multiple times (options, etc) + next if (@plugin_manager_helper.include?(@plugin_objects, plugin)) + @system_wrapper.require_file( "#{plugin}.rb" ) + object = @plugin_manager_helper.instantiate_plugin_script( camelize(plugin), system_objects, plugin ) + @plugin_objects << object + + # add plugins to hash of all system objects + system_objects[plugin.downcase.to_sym] = object + end + end + + def plugins_failed? + return (@build_fail_registry.size > 0) + end + + def print_plugin_failures + if (@build_fail_registry.size > 0) + report = @reportinator.generate_banner('BUILD FAILURE SUMMARY') + + @build_fail_registry.each do |failure| + report += "#{' - ' if (@build_fail_registry.size > 1)}#{failure}\n" + end + + report += "\n" + + @streaminator.stderr_puts(report, Verbosity::ERRORS) + end + end + + def register_build_failure(message) + @build_fail_registry << message if (message and not message.empty?) + end + + #### execute all plugin methods #### + + def pre_build; execute_plugins(:pre_build); end + + def pre_mock_execute(arg_hash); execute_plugins(:pre_mock_execute, arg_hash); end + def post_mock_execute(arg_hash); execute_plugins(:post_mock_execute, arg_hash); end + + def pre_runner_execute(arg_hash); execute_plugins(:pre_runner_execute, arg_hash); end + def post_runner_execute(arg_hash); execute_plugins(:post_runner_execute, arg_hash); end + + def pre_compile_execute(arg_hash); execute_plugins(:pre_compile_execute, arg_hash); end + def post_compile_execute(arg_hash); execute_plugins(:post_compile_execute, arg_hash); end + + def pre_link_execute(arg_hash); execute_plugins(:pre_link_execute, arg_hash); end + def post_link_execute(arg_hash); execute_plugins(:post_link_execute, arg_hash); end + + def pre_test_execute(arg_hash); execute_plugins(:pre_test_execute, arg_hash); end + def post_test_execute(arg_hash) + # special arbitration: raw test results are printed or taken over by plugins handling the job + @streaminator.stdout_puts(arg_hash[:shell_result][:output]) if (@configurator.plugins_display_raw_test_results) + execute_plugins(:post_test_execute, arg_hash) + end + + def post_build; execute_plugins(:post_build); end + + def summary; execute_plugins(:summary); end + + private #################################### + + def camelize(underscored_name) + return underscored_name.gsub(/(_|^)([a-z0-9])/) {$2.upcase} + end + + def execute_plugins(method, *args) + @plugin_objects.each {|plugin| plugin.send(method, *args) } + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/plugin_manager_helper.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/plugin_manager_helper.rb new file mode 100644 index 0000000..b18248a --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/plugin_manager_helper.rb @@ -0,0 +1,19 @@ + +class PluginManagerHelper + + def include?(plugins, name) + include = false + plugins.each do |plugin| + if (plugin.name == name) + include = true + break + end + end + return include + end + + def instantiate_plugin_script(plugin, system_objects, name) + return eval("#{plugin}.new(system_objects, name)") + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/plugin_reportinator.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/plugin_reportinator.rb new file mode 100644 index 0000000..b08801a --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/plugin_reportinator.rb @@ -0,0 +1,75 @@ +require 'constants' +require 'defaults' + +class PluginReportinator + + constructor :plugin_reportinator_helper, :plugin_manager, :reportinator + + def setup + @test_results_template = nil + end + + + def set_system_objects(system_objects) + @plugin_reportinator_helper.ceedling = system_objects + end + + + def fetch_results(results_path, test, options={:boom => false}) + return @plugin_reportinator_helper.fetch_results( File.join(results_path, test), options ) + end + + + def generate_banner(message) + return @reportinator.generate_banner(message) + end + + + def assemble_test_results(results_list, options={:boom => false}) + aggregated_results = get_results_structure + + results_list.each do |result_path| + results = @plugin_reportinator_helper.fetch_results( result_path, options ) + @plugin_reportinator_helper.process_results(aggregated_results, results) + end + + return aggregated_results + end + + + def register_test_results_template(template) + @test_results_template = template if (@test_results_template.nil?) + end + + + def run_test_results_report(hash, verbosity=Verbosity::NORMAL, &block) + run_report( $stdout, + ((@test_results_template.nil?) ? DEFAULT_TESTS_RESULTS_REPORT_TEMPLATE : @test_results_template), + hash, + verbosity, + &block ) + end + + + def run_report(stream, template, hash=nil, verbosity=Verbosity::NORMAL) + failure = nil + failure = yield() if block_given? + + @plugin_manager.register_build_failure( failure ) + + @plugin_reportinator_helper.run_report( stream, template, hash, verbosity ) + end + + private ############################### + + def get_results_structure + return { + :successes => [], + :failures => [], + :ignores => [], + :stdout => [], + :counts => {:total => 0, :passed => 0, :failed => 0, :ignored => 0, :stdout => 0} + } + end + +end \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/plugin_reportinator_helper.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/plugin_reportinator_helper.rb new file mode 100644 index 0000000..c30a833 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/plugin_reportinator_helper.rb @@ -0,0 +1,52 @@ +require 'constants' +require 'erb' +require 'rubygems' +require 'rake' # for ext() + + +class PluginReportinatorHelper + + attr_writer :ceedling + + constructor :configurator, :streaminator, :yaml_wrapper, :file_wrapper + + def fetch_results(results_path, options) + pass_path = File.join(results_path.ext( @configurator.extension_testpass )) + fail_path = File.join(results_path.ext( @configurator.extension_testfail )) + + if (@file_wrapper.exist?(fail_path)) + return @yaml_wrapper.load(fail_path) + elsif (@file_wrapper.exist?(pass_path)) + return @yaml_wrapper.load(pass_path) + else + if (options[:boom]) + @streaminator.stderr_puts("Could find no test results for '#{File.basename(results_path).ext(@configurator.extension_source)}'", Verbosity::ERRORS) + raise + end + end + + return {} + end + + + def process_results(aggregate_results, results) + return if (results.empty?) + + aggregate_results[:successes] << { :source => results[:source].clone, :collection => results[:successes].clone } if (results[:successes].size > 0) + aggregate_results[:failures] << { :source => results[:source].clone, :collection => results[:failures].clone } if (results[:failures].size > 0) + aggregate_results[:ignores] << { :source => results[:source].clone, :collection => results[:ignores].clone } if (results[:ignores].size > 0) + aggregate_results[:stdout] << { :source => results[:source].clone, :collection => results[:stdout].clone } if (results[:stdout].size > 0) + aggregate_results[:counts][:total] += results[:counts][:total] + aggregate_results[:counts][:passed] += results[:counts][:passed] + aggregate_results[:counts][:failed] += results[:counts][:failed] + aggregate_results[:counts][:ignored] += results[:counts][:ignored] + aggregate_results[:counts][:stdout] += results[:stdout].size + end + + + def run_report(stream, template, hash, verbosity) + output = ERB.new(template, 0, "%<>") + @streaminator.stream_puts(stream, output.result(binding()), verbosity) + end + +end \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/preprocessinator.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/preprocessinator.rb new file mode 100644 index 0000000..e5c46c3 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/preprocessinator.rb @@ -0,0 +1,43 @@ + +class Preprocessinator + + attr_reader :preprocess_file_proc + + constructor :preprocessinator_helper, :preprocessinator_includes_handler, :preprocessinator_file_handler, :task_invoker, :file_path_utils, :yaml_wrapper + + + def setup + # fashion ourselves callbacks @preprocessinator_helper can use + @preprocess_includes_proc = Proc.new { |filepath| self.preprocess_shallow_includes(filepath) } + @preprocess_file_proc = Proc.new { |filepath| self.preprocess_file(filepath) } + end + + + def preprocess_test_and_invoke_test_mocks(test) + @preprocessinator_helper.preprocess_includes(test, @preprocess_includes_proc) + + mocks_list = @preprocessinator_helper.assemble_mocks_list(test) + + @preprocessinator_helper.preprocess_mockable_headers(mocks_list, @preprocess_file_proc) + + @task_invoker.invoke_test_mocks(mocks_list) + + @preprocessinator_helper.preprocess_test_file(test, @preprocess_file_proc) + + return mocks_list + end + + def preprocess_shallow_includes(filepath) + dependencies_rule = @preprocessinator_includes_handler.form_shallow_dependencies_rule(filepath) + includes = @preprocessinator_includes_handler.extract_shallow_includes(dependencies_rule) + + @preprocessinator_includes_handler.write_shallow_includes_list( + @file_path_utils.form_preprocessed_includes_list_filepath(filepath), includes) + end + + def preprocess_file(filepath) + @preprocessinator_includes_handler.invoke_shallow_includes_list(filepath) + @preprocessinator_file_handler.preprocess_file( filepath, @yaml_wrapper.load(@file_path_utils.form_preprocessed_includes_list_filepath(filepath)) ) + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/preprocessinator_extractor.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/preprocessinator_extractor.rb new file mode 100644 index 0000000..947d5af --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/preprocessinator_extractor.rb @@ -0,0 +1,27 @@ + + +class PreprocessinatorExtractor + + constructor :file_wrapper + + # extract from cpp-processed file only content of file we care about + def extract_base_file_from_preprocessed_expansion(filepath) + contents = [] + extract = false + + @file_wrapper.readlines(filepath).each do |line| + if (extract) + if (line =~ /^#/) + extract = false + else + contents << line + end + end + # extract = true if (line =~ /^#.*#{Regexp.escape(File.basename(filepath))}/) + extract = true if (line =~ /^#.*(\s|\/|\\|\")#{Regexp.escape(File.basename(filepath))}/) + end + + return contents + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/preprocessinator_file_handler.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/preprocessinator_file_handler.rb new file mode 100644 index 0000000..cc84e7f --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/preprocessinator_file_handler.rb @@ -0,0 +1,21 @@ + + +class PreprocessinatorFileHandler + + constructor :preprocessinator_extractor, :configurator, :tool_executor, :file_path_utils, :file_wrapper + + + def preprocess_file(filepath, includes) + preprocessed_filepath = @file_path_utils.form_preprocessed_file_filepath(filepath) + + command_line = @tool_executor.build_command_line(@configurator.tools_test_file_preprocessor, filepath, preprocessed_filepath) + @tool_executor.exec(command_line) + + contents = @preprocessinator_extractor.extract_base_file_from_preprocessed_expansion(preprocessed_filepath) + + includes.each{|include| contents.unshift("#include \"#{include}\"")} + + @file_wrapper.write(preprocessed_filepath, contents.join("\n")) + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/preprocessinator_helper.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/preprocessinator_helper.rb new file mode 100644 index 0000000..6175637 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/preprocessinator_helper.rb @@ -0,0 +1,46 @@ + + +class PreprocessinatorHelper + + constructor :configurator, :test_includes_extractor, :task_invoker, :file_finder, :file_path_utils + + + def preprocess_includes(test, preprocess_includes_proc) + if (@configurator.project_use_test_preprocessor) + preprocessed_includes_list = @file_path_utils.form_preprocessed_includes_list_filepath(test) + preprocess_includes_proc.call( @file_finder.find_test_from_file_path(preprocessed_includes_list) ) + @test_includes_extractor.parse_includes_list(preprocessed_includes_list) + else + @test_includes_extractor.parse_test_file(test) + end + end + + def assemble_mocks_list(test) + return @file_path_utils.form_mocks_source_filelist( @test_includes_extractor.lookup_raw_mock_list(test) ) + end + + def preprocess_mockable_headers(mock_list, preprocess_file_proc) + if (@configurator.project_use_test_preprocessor) + preprocess_files_smartly( + @file_path_utils.form_preprocessed_mockable_headers_filelist(mock_list), + preprocess_file_proc ) { |file| @file_finder.find_header_file(file) } + end + end + + def preprocess_test_file(test, preprocess_file_proc) + return if (!@configurator.project_use_test_preprocessor) + + preprocess_file_proc.call(test) + end + + private ############################ + + def preprocess_files_smartly(file_list, preprocess_file_proc) + if (@configurator.project_use_auxiliary_dependencies) + @task_invoker.invoke_test_preprocessed_files(file_list) + else + file_list.each { |file| preprocess_file_proc.call( yield(file) ) } + end + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/preprocessinator_includes_handler.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/preprocessinator_includes_handler.rb new file mode 100644 index 0000000..3cca916 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/preprocessinator_includes_handler.rb @@ -0,0 +1,55 @@ + + +class PreprocessinatorIncludesHandler + + constructor :configurator, :tool_executor, :task_invoker, :file_path_utils, :yaml_wrapper, :file_wrapper + + # shallow includes: only those headers a source file explicitly includes + + def invoke_shallow_includes_list(filepath) + @task_invoker.invoke_test_shallow_include_lists( [@file_path_utils.form_preprocessed_includes_list_filepath(filepath)] ) + end + + # ask the preprocessor for a make-style dependency rule of only the headers the source file immediately includes + def form_shallow_dependencies_rule(filepath) + # change filename (prefix of '_') to prevent preprocessor from finding include files in temp directory containing file it's scanning + temp_filepath = @file_path_utils.form_temp_path(filepath, '_') + + # read the file and replace all include statements with a decorated version + # (decorating the names creates file names that don't exist, thus preventing the preprocessor + # from snaking out and discovering the entire include path that winds through the code) + contents = @file_wrapper.read(filepath) + contents.gsub!( /#include\s+\"\s*(\S+)\s*\"/, "#include \"\\1\"\n#include \"@@@@\\1\"" ) + @file_wrapper.write( temp_filepath, contents ) + + # extract the make-style dependency rule telling the preprocessor to + # ignore the fact that it can't find the included files + command_line = @tool_executor.build_command_line(@configurator.tools_test_includes_preprocessor, temp_filepath) + shell_result = @tool_executor.exec(command_line) + + return shell_result[:output] + end + + # headers only; ignore any crazy .c includes + def extract_shallow_includes(make_rule) + list = [] + header_extension = @configurator.extension_header + + headers = make_rule.scan(/(\S+#{'\\'+header_extension})/).flatten # escape slashes before dot file extension + headers.uniq! + headers.map! { |header| header.sub(/(@@@@)|(.+\/)/, '') } + headers.sort! + + headers.each_with_index do |header, index| + break if (headers.size == (index-1)) + list << header if (header == headers[index + 1]) + end + + return list + end + + def write_shallow_includes_list(filepath, list) + @yaml_wrapper.dump(filepath, list) + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/project_config_manager.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/project_config_manager.rb new file mode 100644 index 0000000..3599689 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/project_config_manager.rb @@ -0,0 +1,38 @@ +require 'constants' + + +class ProjectConfigManager + + attr_reader :options_files, :release_config_changed, :test_config_changed + attr_accessor :config_hash + + constructor :cacheinator, :yaml_wrapper + + + def setup + @options_files = [] + @release_config_changed = false + @test_config_changed = false + end + + + def merge_options(config_hash, option_filepath) + @options_files << File.basename( option_filepath ) + config_hash.deep_merge( @yaml_wrapper.load( option_filepath ) ) + return config_hash + end + + + + def process_release_config_change + # has project configuration changed since last release build + @release_config_changed = @cacheinator.diff_cached_release_config?( @config_hash ) + end + + + def process_test_config_change + # has project configuration changed since last test build + @test_config_changed = @cacheinator.diff_cached_test_config?( @config_hash ) + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/project_file_loader.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/project_file_loader.rb new file mode 100644 index 0000000..182d23a --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/project_file_loader.rb @@ -0,0 +1,64 @@ +require 'constants' + + +class ProjectFileLoader + + attr_reader :main_file, :user_file + + constructor :yaml_wrapper, :stream_wrapper, :system_wrapper, :file_wrapper + + def setup + @main_file = nil + @user_file = nil + + @main_project_filepath = '' + @user_project_filepath = '' + end + + + def find_project_files + # first go hunting for optional user project file by looking for environment variable and then default location on disk + user_filepath = @system_wrapper.env_get('CEEDLING_USER_PROJECT_FILE') + + if ( not user_filepath.nil? and @file_wrapper.exist?(user_filepath) ) + @user_project_filepath = user_filepath + elsif (@file_wrapper.exist?(DEFAULT_CEEDLING_USER_PROJECT_FILE)) + @user_project_filepath = DEFAULT_CEEDLING_USER_PROJECT_FILE + end + + # next check for main project file by looking for environment variable and then default location on disk; + # blow up if we don't find this guy -- like, he's so totally important + main_filepath = @system_wrapper.env_get('CEEDLING_MAIN_PROJECT_FILE') + + if ( not main_filepath.nil? and @file_wrapper.exist?(main_filepath) ) + @main_project_filepath = main_filepath + elsif (@file_wrapper.exist?(DEFAULT_CEEDLING_MAIN_PROJECT_FILE)) + @main_project_filepath = DEFAULT_CEEDLING_MAIN_PROJECT_FILE + else + # no verbosity checking since this is lowest level reporting anyhow & + # verbosity checking depends on configurator which in turns needs this class (circular dependency) + @stream_wrapper.stderr_puts('Found no Ceedling project file (*.yml)') + raise + end + + @main_file = File.basename( @main_project_filepath ) + @user_file = File.basename( @user_project_filepath ) if ( not @user_project_filepath.empty? ) + end + + + def load_project_config + config_hash = {} + + # if there's no user project file, then just provide hash from project file + if (@user_project_filepath.empty?) + config_hash = @yaml_wrapper.load(@main_project_filepath) + # if there is a user project file, load it too and merge it on top of the project file, + # superseding anything that's common between them + else + config_hash = (@yaml_wrapper.load(@main_project_filepath)).merge(@yaml_wrapper.load(@user_project_filepath)) + end + + return config_hash + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/rake_utils.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/rake_utils.rb new file mode 100644 index 0000000..3f667c8 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/rake_utils.rb @@ -0,0 +1,17 @@ + +class RakeUtils + + constructor :rake_wrapper + + def task_invoked?(task_regex) + task_invoked = false + @rake_wrapper.task_list.each do |task| + if ((task.already_invoked) and (task.to_s =~ task_regex)) + task_invoked = true + break + end + end + return task_invoked + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/rake_wrapper.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/rake_wrapper.rb new file mode 100644 index 0000000..d4d9e25 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/rake_wrapper.rb @@ -0,0 +1,31 @@ +require 'rubygems' +require 'rake' +require 'makefile' # our replacement for rake's make-style dependency loader + +class Rake::Task + attr_reader :already_invoked +end + +class RakeWrapper + + def initialize + @makefile_loader = Rake::MakefileLoader.new # use our custom replacement noted above + end + + def [](task) + return Rake::Task[task] + end + + def task_list + return Rake::Task.tasks + end + + def create_file_task(file_task, dependencies) + file(file_task => dependencies) + end + + def load_dependencies(dependencies_path) + @makefile_loader.load(dependencies_path) + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/rakefile.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/rakefile.rb new file mode 100644 index 0000000..0c22e33 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/rakefile.rb @@ -0,0 +1,60 @@ +require 'fileutils' + +# get directory containing this here file, back up one directory, and expand to full path +CEEDLING_ROOT = File.expand_path(File.dirname(__FILE__) + '/..') +CEEDLING_LIB = File.join(CEEDLING_ROOT, 'lib') +CEEDLING_VENDOR = File.join(CEEDLING_ROOT, 'vendor') +CEEDLING_RELEASE = File.join(CEEDLING_ROOT, 'release') + +$LOAD_PATH.unshift( CEEDLING_LIB ) +$LOAD_PATH.unshift( File.join(CEEDLING_VENDOR, 'diy/lib') ) +$LOAD_PATH.unshift( File.join(CEEDLING_VENDOR, 'constructor/lib') ) +$LOAD_PATH.unshift( File.join(CEEDLING_VENDOR, 'cmock/lib') ) +$LOAD_PATH.unshift( File.join(CEEDLING_VENDOR, 'deep_merge/lib') ) + +require 'rake' + +require 'diy' +require 'constructor' + +require 'constants' + + +# construct all our objects +@ceedling = DIY::Context.from_yaml( File.read( File.join(CEEDLING_LIB, 'objects.yml') ) ) +@ceedling.build_everything + +# one-stop shopping for all our setup and such after construction +@ceedling[:setupinator].ceedling = @ceedling +@ceedling[:setupinator].do_setup( @ceedling[:setupinator].load_project_files ) + +# tell all our plugins we're about to do something +@ceedling[:plugin_manager].pre_build + +# load rakefile component files (*.rake) +PROJECT_RAKEFILE_COMPONENT_FILES.each { |component| load(component) } + +# tell rake to shut up by default (overridden in verbosity / debug tasks as appropriate) +verbose(false) + + +# end block always executed following rake run +END { + # cache our input configurations to use in comparison upon next execution + @ceedling[:cacheinator].cache_test_config( @ceedling[:setupinator].config_hash ) if (@ceedling[:task_invoker].test_invoked?) + @ceedling[:cacheinator].cache_release_config( @ceedling[:setupinator].config_hash ) if (@ceedling[:task_invoker].release_invoked?) + + # delete all temp files unless we're in debug mode + if (not @ceedling[:configurator].project_debug) + @ceedling[:file_wrapper].rm_f( @ceedling[:file_wrapper].directory_listing( File.join(@ceedling[:configurator].project_temp_path, '*') )) + end + + # only perform these final steps if we got here without runtime exceptions or errors + if (@ceedling[:system_wrapper].ruby_success) + + # tell all our plugins the build is done and process results + @ceedling[:plugin_manager].post_build + @ceedling[:plugin_manager].print_plugin_failures + exit(1) if (@ceedling[:plugin_manager].plugins_failed?) + end +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/release_invoker.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/release_invoker.rb new file mode 100644 index 0000000..2df2e68 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/release_invoker.rb @@ -0,0 +1,29 @@ + + +class ReleaseInvoker + + constructor :configurator, :release_invoker_helper, :dependinator, :task_invoker, :file_path_utils + + + def setup_and_invoke_c_objects(c_files) + objects = ( @file_path_utils.form_release_build_c_objects_filelist( c_files ) ) + + @release_invoker_helper.process_auxiliary_dependencies( @file_path_utils.form_release_dependencies_filelist( c_files ) ) + + @dependinator.enhance_release_file_dependencies( objects ) + @task_invoker.invoke_release_objects( objects ) + + return objects + end + + + def setup_and_invoke_asm_objects(asm_files) + objects = @file_path_utils.form_release_build_asm_objects_filelist( asm_files ) + + @dependinator.enhance_release_file_dependencies( objects ) + @task_invoker.invoke_release_objects( objects ) + + return objects + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/release_invoker_helper.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/release_invoker_helper.rb new file mode 100644 index 0000000..2843f2e --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/release_invoker_helper.rb @@ -0,0 +1,16 @@ + + +class ReleaseInvokerHelper + + constructor :configurator, :dependinator, :task_invoker + + + def process_auxiliary_dependencies(dependencies_list) + return if (not @configurator.project_use_auxiliary_dependencies) + + @dependinator.enhance_release_file_dependencies( dependencies_list ) + @task_invoker.invoke_release_dependencies_files( dependencies_list ) + @dependinator.load_release_object_deep_dependencies( dependencies_list ) + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/reportinator.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/reportinator.rb new file mode 100644 index 0000000..a41e9a0 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/reportinator.rb @@ -0,0 +1,9 @@ + +class Reportinator + + def generate_banner(message, width=nil) + dash_count = ((width.nil?) ? message.strip.length : width) + return "#{'-' * dash_count}\n#{message}\n#{'-' * dash_count}\n" + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/rules_cmock.rake b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/rules_cmock.rake new file mode 100644 index 0000000..ab29e85 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/rules_cmock.rake @@ -0,0 +1,9 @@ + + +rule(/#{CMOCK_MOCK_PREFIX}.+#{'\\'+EXTENSION_SOURCE}$/ => [ + proc do |task_name| + @ceedling[:file_finder].find_header_input_for_mock_file(task_name) + end + ]) do |mock| + @ceedling[:generator].generate_mock(TEST_CONTEXT, mock.source) +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/rules_preprocess.rake b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/rules_preprocess.rake new file mode 100644 index 0000000..fda14dc --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/rules_preprocess.rake @@ -0,0 +1,26 @@ + + +# invocations against this rule should only happen when enhanced dependencies are enabled; +# otherwise, dependency tracking will be too shallow and preprocessed files could intermittently +# fail to be updated when they actually need to be. +rule(/#{PROJECT_TEST_PREPROCESS_FILES_PATH}\/.+/ => [ + proc do |task_name| + @ceedling[:file_finder].find_test_or_source_or_header_file(task_name) + end + ]) do |file| + if (not @ceedling[:configurator].project_use_auxiliary_dependencies) + raise 'ERROR: Ceedling preprocessing rule invoked though neccessary auxiliary dependency support not enabled.' + end + @ceedling[:generator].generate_preprocessed_file(TEST_CONTEXT, file.source) +end + + +# invocations against this rule can always happen as there are no deeper dependencies to consider +rule(/#{PROJECT_TEST_PREPROCESS_INCLUDES_PATH}\/.+/ => [ + proc do |task_name| + @ceedling[:file_finder].find_test_or_source_or_header_file(task_name) + end + ]) do |file| + @ceedling[:generator].generate_shallow_includes_list(TEST_CONTEXT, file.source) +end + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/rules_release.rake b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/rules_release.rake new file mode 100644 index 0000000..f8dc29a --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/rules_release.rake @@ -0,0 +1,24 @@ + +rule(/#{PROJECT_RELEASE_BUILD_OUTPUT_ASM_PATH}\/#{'.+\\'+EXTENSION_OBJECT}$/ => [ + proc do |task_name| + @ceedling[:file_finder].find_assembly_file(task_name) + end + ]) do |object| + @ceedling[:generator].generate_object_file(TOOLS_RELEASE_ASSEMBLER, object.source, object.name) +end + + +rule(/#{PROJECT_RELEASE_BUILD_OUTPUT_C_PATH}\/#{'.+\\'+EXTENSION_OBJECT}$/ => [ + proc do |task_name| + @ceedling[:file_finder].find_compilation_input_file(task_name) + end + ]) do |object| + @ceedling[:generator].generate_object_file(TOOLS_RELEASE_COMPILER, object.source, object.name) +end + + +rule(/#{PROJECT_RELEASE_BUILD_TARGET}/) do |bin_file| + @ceedling[:generator].generate_executable_file(TOOLS_RELEASE_LINKER, bin_file.prerequisites, bin_file.name) +end + + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/rules_release_aux_dependencies.rake b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/rules_release_aux_dependencies.rake new file mode 100644 index 0000000..485973f --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/rules_release_aux_dependencies.rake @@ -0,0 +1,14 @@ + + +rule(/#{PROJECT_RELEASE_DEPENDENCIES_PATH}\/#{'.+\\'+EXTENSION_DEPENDENCIES}$/ => [ + proc do |task_name| + @ceedling[:file_finder].find_compilation_input_file(task_name) + end + ]) do |dep| + @ceedling[:generator].generate_dependencies_file( + TOOLS_RELEASE_DEPENDENCIES_GENERATOR, + dep.source, + @ceedling[:file_path_utils].form_release_build_c_object_filepath(dep.source), + dep.name) +end + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/rules_tests.rake b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/rules_tests.rake new file mode 100644 index 0000000..a3902b7 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/rules_tests.rake @@ -0,0 +1,49 @@ + + +rule(/#{PROJECT_TEST_FILE_PREFIX}#{'.+'+TEST_RUNNER_FILE_SUFFIX}#{'\\'+EXTENSION_SOURCE}$/ => [ + proc do |task_name| + @ceedling[:file_finder].find_test_input_for_runner_file(task_name) + end + ]) do |runner| + @ceedling[:generator].generate_test_runner(TEST_CONTEXT, runner.source, runner.name) +end + + +rule(/#{PROJECT_TEST_BUILD_OUTPUT_PATH}\/#{'.+\\'+EXTENSION_OBJECT}$/ => [ + proc do |task_name| + @ceedling[:file_finder].find_compilation_input_file(task_name) + end + ]) do |object| + @ceedling[:generator].generate_object_file(TOOLS_TEST_COMPILER, TEST_CONTEXT, object.source, object.name) +end + + +rule(/#{PROJECT_TEST_BUILD_OUTPUT_PATH}\/#{'.+\\'+EXTENSION_EXECUTABLE}$/) do |bin_file| + @ceedling[:generator].generate_executable_file(TOOLS_TEST_LINKER, TEST_CONTEXT, bin_file.prerequisites, bin_file.name) +end + + +rule(/#{PROJECT_TEST_RESULTS_PATH}\/#{'.+\\'+EXTENSION_TESTPASS}$/ => [ + proc do |task_name| + @ceedling[:file_path_utils].form_test_executable_filepath(task_name) + end + ]) do |test_result| + @ceedling[:generator].generate_test_results(TOOLS_TEST_FIXTURE, TEST_CONTEXT, test_result.source, test_result.name) +end + + +namespace TEST_CONTEXT do + # use a rule to increase efficiency for large projects + # test tasks by regex + rule(/^#{TEST_TASK_ROOT}\S+$/ => [ + proc do |task_name| + test = task_name.sub(/#{TEST_TASK_ROOT}/, '') + test = "#{PROJECT_TEST_FILE_PREFIX}#{test}" if not (test.start_with?(PROJECT_TEST_FILE_PREFIX)) + @ceedling[:file_finder].find_test_from_file_path(test) + end + ]) do |test| + @ceedling[:rake_wrapper][:directories].invoke + @ceedling[:test_invoker].setup_and_invoke([test.source]) + end +end + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/rules_tests_aux_dependencies.rake b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/rules_tests_aux_dependencies.rake new file mode 100644 index 0000000..db9a92b --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/rules_tests_aux_dependencies.rake @@ -0,0 +1,15 @@ + + +rule(/#{PROJECT_TEST_DEPENDENCIES_PATH}\/#{'.+\\'+EXTENSION_DEPENDENCIES}$/ => [ + proc do |task_name| + @ceedling[:file_finder].find_compilation_input_file(task_name) + end + ]) do |dep| + @ceedling[:generator].generate_dependencies_file( + TOOLS_TEST_DEPENDENCIES_GENERATOR, + TEST_CONTEXT, + dep.source, + @ceedling[:file_path_utils].form_test_build_object_filepath(dep.source), + dep.name) +end + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/setupinator.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/setupinator.rb new file mode 100644 index 0000000..ffe141d --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/setupinator.rb @@ -0,0 +1,45 @@ + +class Setupinator + + attr_reader :config_hash + attr_writer :ceedling + + def setup + @ceedling = {} + @config_hash = {} + end + + def load_project_files + @ceedling[:project_file_loader].find_project_files + return @ceedling[:project_file_loader].load_project_config + end + + def do_setup(config_hash) + @config_hash = config_hash + + # load up all the constants and accessors our rake files, objects, & external scripts will need; + # note: configurator modifies the cmock section of the hash with a couple defaults to tie + # project together - the modified hash is used to build cmock object + @ceedling[:configurator].populate_defaults( config_hash ) + @ceedling[:configurator].populate_unity_defines( config_hash ) + @ceedling[:configurator].populate_cmock_defaults( config_hash ) + @ceedling[:configurator].find_and_merge_plugins( config_hash ) + @ceedling[:configurator].populate_tool_names_and_stderr_redirect( config_hash ) + @ceedling[:configurator].eval_environment_variables( config_hash ) + @ceedling[:configurator].eval_paths( config_hash ) + @ceedling[:configurator].standardize_paths( config_hash ) + @ceedling[:configurator].validate( config_hash ) + @ceedling[:configurator].build( config_hash ) + @ceedling[:configurator].insert_rake_plugins( @ceedling[:configurator].rake_plugins ) + + @ceedling[:plugin_manager].load_plugin_scripts( @ceedling[:configurator].script_plugins, @ceedling ) + @ceedling[:plugin_reportinator].set_system_objects( @ceedling ) + @ceedling[:file_finder].prepare_search_sources + @ceedling[:loginator].setup_log_filepath + @ceedling[:project_config_manager].config_hash = config_hash + end + + def reset_defaults(config_hash) + @ceedling[:configurator].reset_defaults( config_hash ) + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/stream_wrapper.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/stream_wrapper.rb new file mode 100644 index 0000000..33d3c10 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/stream_wrapper.rb @@ -0,0 +1,20 @@ + +class StreamWrapper + + def stdout_puts(string) + $stdout.puts(string) + end + + def stdout_flush + $stdout.flush + end + + def stderr_puts(string) + $stderr.puts(string) + end + + def stderr_flush + $stderr.flush + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/streaminator.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/streaminator.rb new file mode 100644 index 0000000..abbc9b8 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/streaminator.rb @@ -0,0 +1,41 @@ + +class Streaminator + + require 'constants' + + constructor :streaminator_helper, :verbosinator, :loginator, :stream_wrapper + + # for those objects for whom the configurator has already been instantiated, + # Streaminator is a convenience object for handling verbosity and writing to the std streams + + def stdout_puts(string, verbosity=Verbosity::NORMAL) + if (@verbosinator.should_output?(verbosity)) + @stream_wrapper.stdout_puts(string) + @stream_wrapper.stdout_flush + end + + # write to log as though Verbosity::OBNOXIOUS + @loginator.log( string, @streaminator_helper.extract_name($stdout) ) + end + + def stderr_puts(string, verbosity=Verbosity::NORMAL) + if (@verbosinator.should_output?(verbosity)) + @stream_wrapper.stderr_puts(string) + @stream_wrapper.stderr_flush + end + + # write to log as though Verbosity::OBNOXIOUS + @loginator.log( string, @streaminator_helper.extract_name($stderr) ) + end + + def stream_puts(stream, string, verbosity=Verbosity::NORMAL) + if (@verbosinator.should_output?(verbosity)) + stream.puts(string) + stream.flush + end + + # write to log as though Verbosity::OBNOXIOUS + @loginator.log( string, @streaminator_helper.extract_name(stream) ) + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/streaminator_helper.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/streaminator_helper.rb new file mode 100644 index 0000000..9fb5cc0 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/streaminator_helper.rb @@ -0,0 +1,15 @@ + +class StreaminatorHelper + + def extract_name(stream) + name = case (stream.fileno) + when 0 then '#' + when 1 then '#' + when 2 then '#' + else stream.inspect + end + + return name + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/system_wrapper.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/system_wrapper.rb new file mode 100644 index 0000000..631be36 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/system_wrapper.rb @@ -0,0 +1,67 @@ +require 'rbconfig' + +class SystemWrapper + + # static method for use in defaults + def self.is_windows? + return ((Config::CONFIG['host_os'] =~ /mswin|mingw/) ? true : false) + end + + # class method so as to be mockable for tests + def is_windows? + return SystemWrapper.is_windows? + end + + def module_eval(string) + return Object.module_eval("\"" + string + "\"") + end + + def eval(string) + return eval(string) + end + + def search_paths + return ENV['PATH'].split(File::PATH_SEPARATOR) + end + + def cmdline_args + return ARGV + end + + def env_set(name, value) + ENV[name] = value + end + + def env_get(name) + return ENV[name] + end + + def time_now + return Time.now.asctime + end + + def shell_execute(command) + return { + :output => `#{command}`, + :exit_code => ($?.exitstatus) + } + end + + def add_load_path(path) + $LOAD_PATH.unshift(path) + end + + def require_file(path) + require(path) + end + + def ruby_success + return ($!.nil? || $!.is_a?(SystemExit) && $!.success?) + end + + def constants_include?(item) + # forcing to strings provides consistency across Ruby versions + return Object.constants.map{|constant| constant.to_s}.include?(item.to_s) + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/task_invoker.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/task_invoker.rb new file mode 100644 index 0000000..92f3854 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/task_invoker.rb @@ -0,0 +1,85 @@ + +class TaskInvoker + + constructor :dependinator, :rake_utils, :rake_wrapper + + def setup + @test_regexs = [/^#{TEST_ROOT_NAME}:/] + @release_regexs = [/^#{RELEASE_ROOT_NAME}(:|$)/] + end + + def add_test_task_regex(regex) + @test_regexs << regex + end + + def add_release_task_regex(regex) + @release_regexs << regex + end + + def test_invoked? + invoked = false + + @test_regexs.each do |regex| + invoked = true if (@rake_utils.task_invoked?(regex)) + break if invoked + end + + return invoked + end + + def release_invoked? + invoked = false + + @release_regexs.each do |regex| + invoked = true if (@rake_utils.task_invoked?(regex)) + break if invoked + end + + return invoked + end + + def invoked?(regex) + return @rake_utils.task_invoked?(regex) + end + + + def invoke_test_mocks(mocks) + @dependinator.enhance_mock_dependencies( mocks ) + mocks.each { |mock| @rake_wrapper[mock].invoke } + end + + def invoke_test_runner(runner) + @dependinator.enhance_runner_dependencies( runner ) + @rake_wrapper[runner].invoke + end + + def invoke_test_shallow_include_lists(files) + @dependinator.enhance_shallow_include_lists_dependencies( files ) + files.each { |file| @rake_wrapper[file].invoke } + end + + def invoke_test_preprocessed_files(files) + @dependinator.enhance_preprocesed_file_dependencies( files ) + files.each { |file| @rake_wrapper[file].invoke } + end + + def invoke_test_dependencies_files(files) + @dependinator.enhance_dependencies_dependencies( files ) + files.each { |file| @rake_wrapper[file].invoke } + end + + def invoke_test_results(result) + @dependinator.enhance_results_dependencies( result ) + @rake_wrapper[result].invoke + end + + + def invoke_release_dependencies_files(files) + files.each { |file| @rake_wrapper[file].invoke } + end + + def invoke_release_objects(objects) + objects.each { |object| @rake_wrapper[object].invoke } + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/tasks_base.rake b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/tasks_base.rake new file mode 100644 index 0000000..fbe4081 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/tasks_base.rake @@ -0,0 +1,104 @@ +require 'constants' +require 'file_path_utils' + + +desc "Display build environment version info." +task :version do + tools = [ + [' Ceedling', CEEDLING_ROOT], + ['CException', File.join( CEEDLING_VENDOR, CEXCEPTION_ROOT_PATH)], + [' CMock', File.join( CEEDLING_VENDOR, CMOCK_ROOT_PATH)], + [' Unity', File.join( CEEDLING_VENDOR, UNITY_ROOT_PATH)], + ] + + tools.each do |tool| + name = tool[0] + base_path = tool[1] + + version_string = @ceedling[:file_wrapper].read( File.join(base_path, 'release', 'version.info') ).strip + build_string = @ceedling[:file_wrapper].read( File.join(base_path, 'release', 'build.info') ).strip + puts "#{name}:: #{version_string.empty? ? '#.#.' : (version_string + '.')}#{build_string.empty? ? '?' : build_string}" + end +end + + +desc "Set verbose output (silent:[#{Verbosity::SILENT}] - obnoxious:[#{Verbosity::OBNOXIOUS}])." +task :verbosity, :level do |t, args| + verbosity_level = args.level.to_i + + if (PROJECT_USE_MOCKS) + # don't store verbosity level in setupinator's config hash, use a copy; + # otherwise, the input configuration will change and trigger entire project rebuilds + hash = @ceedling[:setupinator].config_hash[:cmock].clone + hash[:verbosity] = verbosity_level + + @ceedling[:cmock_builder].manufacture( hash ) + end + + @ceedling[:configurator].project_verbosity = verbosity_level + + # control rake's verbosity with new setting + verbose( ((verbosity_level >= Verbosity::OBNOXIOUS) ? true : false) ) +end + + +desc "Enable logging" +task :logging do + @ceedling[:configurator].project_logging = true +end + + +# non advertised debug task +task :debug do + Rake::Task[:verbosity].invoke(Verbosity::DEBUG) + Rake.application.options.trace = true + @ceedling[:configurator].project_debug = true +end + + +# non advertised sanity checking task +task :sanity_checks, :level do |t, args| + check_level = args.level.to_i + @ceedling[:configurator].sanity_checks = check_level +end + + +# list expanded environment variables +if (not COLLECTION_ENVIRONMENT.empty?) +desc "List all configured environment variables." +task :environment do + COLLECTION_ENVIRONMENT.each do |env| + env.each_key do |key| + name = key.to_s.upcase + puts " - #{name}: \"#{env[key]}\"" + end + end +end +end + + +namespace :options do + + COLLECTION_PROJECT_OPTIONS.each do |option_path| + option = File.basename(option_path, '.yml') + + desc "Merge #{option} project options." + task option.downcase.to_sym do + @ceedling[:setupinator].reset_defaults( @ceedling[:setupinator].config_hash ) + hash = @ceedling[:project_config_manager].merge_options( @ceedling[:setupinator].config_hash, option_path ) + @ceedling[:setupinator].do_setup( hash ) + end + end + +end + + +# do not present task if there's no plugins +if (not PLUGINS_ENABLED.empty?) +desc "Execute plugin result summaries (no build triggering)." +task :summary do + @ceedling[:plugin_manager].summary + puts "\nNOTE: Summaries may be out of date with project sources.\n\n" +end +end + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/tasks_filesystem.rake b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/tasks_filesystem.rake new file mode 100644 index 0000000..e119d64 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/tasks_filesystem.rake @@ -0,0 +1,89 @@ + +# rather than require 'rake/clean' & try to override, we replicate for finer control +CLEAN = Rake::FileList["**/*~", "**/*.bak"] +CLOBBER = Rake::FileList.new + +CLEAN.clear_exclude.exclude { |fn| fn.pathmap("%f") == 'core' && File.directory?(fn) } + +CLEAN.include(File.join(PROJECT_TEST_BUILD_OUTPUT_PATH, '*')) +CLEAN.include(File.join(PROJECT_TEST_RESULTS_PATH, '*')) +CLEAN.include(File.join(PROJECT_TEST_DEPENDENCIES_PATH, '*')) +CLEAN.include(File.join(PROJECT_RELEASE_BUILD_OUTPUT_PATH, '*')) + +CLOBBER.include(File.join(PROJECT_BUILD_ARTIFACTS_ROOT, '**/*')) +CLOBBER.include(File.join(PROJECT_BUILD_TESTS_ROOT, '**/*')) +CLOBBER.include(File.join(PROJECT_BUILD_RELEASE_ROOT, '**/*')) +CLOBBER.include(File.join(PROJECT_LOG_PATH, '**/*')) +CLOBBER.include(File.join(PROJECT_TEMP_PATH, '**/*')) + +# because of cmock config, mock path can optionally exist apart from standard test build paths +CLOBBER.include(File.join(CMOCK_MOCK_PATH, '*')) + +REMOVE_FILE_PROC = Proc.new { |fn| rm_r fn rescue nil } + +# redefine clean so we can override how it advertises itself +desc "Delete all build artifacts and temporary products." +task(:clean) do + # because :clean is a prerequisite for :clobber, intelligently display the progress message + if (not @ceedling[:task_invoker].invoked?(/^clobber$/)) + @ceedling[:streaminator].stdout_puts("\nCleaning build artifacts...\n(For large projects, this task may take a long time to complete)\n\n") + end + CLEAN.each { |fn| REMOVE_FILE_PROC.call(fn) } +end + +# redefine clobber so we can override how it advertises itself +desc "Delete all generated files (and build artifacts)." +task(:clobber => [:clean]) do + @ceedling[:streaminator].stdout_puts("\nClobbering all generated files...\n(For large projects, this task may take a long time to complete)\n\n") + CLOBBER.each { |fn| REMOVE_FILE_PROC.call(fn) } +end + + +PROJECT_BUILD_PATHS.each { |path| directory(path) } + +# create directories that hold build output and generated files & touching rebuild dependency sources +task(:directories => PROJECT_BUILD_PATHS) { @ceedling[:dependinator].touch_force_rebuild_files } + + +# list paths discovered at load time +namespace :paths do + + paths = @ceedling[:setupinator].config_hash[:paths] + paths.each_key do |section| + name = section.to_s.downcase + path_list = Object.const_get("COLLECTION_PATHS_#{name.upcase}") + + if (path_list.size != 0) + desc "List all collected #{name} paths." + task(name.to_sym) { puts "#{name} paths:"; path_list.sort.each {|path| puts " - #{path}" } } + end + end + +end + + +# list files & file counts discovered at load time +namespace :files do + + categories = [ + ['test', COLLECTION_ALL_TESTS], + ['source', COLLECTION_ALL_SOURCE], + ['header', COLLECTION_ALL_HEADERS] + ] + categories << ['assembly', COLLECTION_ALL_ASSEMBLY] if (RELEASE_BUILD_USE_ASSEMBLY) + + categories.each do |category| + name = category[0] + collection = category[1] + + desc "List all collected #{name} files." + task(name.to_sym) do + puts "#{name} files:" + collection.sort.each { |filepath| puts " - #{filepath}" } + puts "file count: #{collection.size}" + end + end + +end + + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/tasks_release.rake b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/tasks_release.rake new file mode 100644 index 0000000..88aa678 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/tasks_release.rake @@ -0,0 +1,44 @@ +require 'constants' +require 'file_path_utils' + + +desc "Build release target." +task :release => [:directories] do + header = "Release build '#{File.basename(PROJECT_RELEASE_BUILD_TARGET)}'" + @ceedling[:streaminator].stdout_puts("\n\n#{header}\n#{'-' * header.length}") + + core_objects = [] + extra_objects = @ceedling[:file_path_utils].form_release_build_c_objects_filelist( COLLECTION_RELEASE_ARTIFACT_EXTRA_LINK_OBJECTS ) + + @ceedling[:project_config_manager].process_release_config_change + core_objects.concat( @ceedling[:release_invoker].setup_and_invoke_c_objects( COLLECTION_ALL_SOURCE ) ) + core_objects.concat( @ceedling[:release_invoker].setup_and_invoke_asm_objects( COLLECTION_ALL_ASSEMBLY ) ) + + file( PROJECT_RELEASE_BUILD_TARGET => (core_objects + extra_objects) ) + Rake::Task[PROJECT_RELEASE_BUILD_TARGET].invoke +end + + +namespace :release do + + namespace :compile do + COLLECTION_ALL_SOURCE.each do |source| + name = File.basename( source ) + task name.to_sym => [:directories] do + @ceedling[:project_config_manager].process_release_config_change + @ceedling[:release_invoker].setup_and_invoke_c_objects( [source] ) + end + end + end + + namespace :assemble do + COLLECTION_ALL_ASSEMBLY.each do |source| + name = File.basename( source ) + task name.to_sym => [:directories] do + @ceedling[:project_config_manager].process_release_config_change + @ceedling[:release_invoker].setup_and_invoke_asm_objects( [source] ) + end + end + end + +end \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/tasks_tests.rake b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/tasks_tests.rake new file mode 100644 index 0000000..a1845ac --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/tasks_tests.rake @@ -0,0 +1,49 @@ + +namespace TEST_CONTEXT do + + desc "Run all unit tests." + task :all => [:directories] do + @ceedling[:test_invoker].setup_and_invoke(COLLECTION_ALL_TESTS) + end + + desc "Run single test ([*] real test or source file name, no path)." + task :* do + message = "\nOops! '#{TEST_ROOT_NAME}:*' isn't a real task. " + + "Use a real test or source file name (no path) in place of the wildcard.\n" + + "Example: rake #{TEST_ROOT_NAME}:foo.c\n\n" + + @ceedling[:streaminator].stdout_puts( message ) + end + + desc "Run tests for changed files." + task :delta => [:directories] do + @ceedling[:test_invoker].setup_and_invoke(COLLECTION_ALL_TESTS, {:force_run => false}) + end + + desc "Run tests by matching regular expression pattern." + task :pattern, [:regex] => [:directories] do |t, args| + matches = [] + + COLLECTION_ALL_TESTS.each { |test| matches << test if (test =~ /#{args.regex}/) } + + if (matches.size > 0) + @ceedling[:test_invoker].setup_and_invoke(matches, {:force_run => false}) + else + @ceedling[:streaminator].stdout_puts("\nFound no tests matching pattern /#{args.regex}/.") + end + end + + desc "Run tests whose test path contains [dir] or [dir] substring." + task :path, [:dir] => [:directories] do |t, args| + matches = [] + + COLLECTION_ALL_TESTS.each { |test| matches << test if File.dirname(test).include?(args.dir.gsub(/\\/, '/')) } + + if (matches.size > 0) + @ceedling[:test_invoker].setup_and_invoke(matches, {:force_run => false}) + else + @ceedling[:streaminator].stdout_puts("\nFound no tests including the given path or path component.") + end + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/tasks_vendor.rake b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/tasks_vendor.rake new file mode 100644 index 0000000..0d07154 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/tasks_vendor.rake @@ -0,0 +1,36 @@ +require 'constants' +require 'file_path_utils' + +# create file dependencies to ensure C-based components of vendor tools are recompiled when they are updated with new versions +# forming these explicitly rather than depend on auxiliary dependencies so all scenarios are explicitly covered + +file( @ceedling[:file_path_utils].form_test_build_object_filepath( UNITY_C_FILE ) => [ + FilePathUtils.form_ceedling_vendor_path( UNITY_LIB_PATH, UNITY_C_FILE ), + FilePathUtils.form_ceedling_vendor_path( UNITY_LIB_PATH, UNITY_H_FILE ), + FilePathUtils.form_ceedling_vendor_path( UNITY_LIB_PATH, UNITY_INTERNALS_H_FILE ) ] + ) + + +if (PROJECT_USE_MOCKS) +file( @ceedling[:file_path_utils].form_test_build_object_filepath( CMOCK_C_FILE ) => [ + FilePathUtils.form_ceedling_vendor_path( CMOCK_LIB_PATH, CMOCK_C_FILE ), + FilePathUtils.form_ceedling_vendor_path( CMOCK_LIB_PATH, CMOCK_H_FILE ) ] + ) +end + + +if (PROJECT_USE_EXCEPTIONS) +file( @ceedling[:file_path_utils].form_test_build_object_filepath( CEXCEPTION_C_FILE ) => [ + FilePathUtils.form_ceedling_vendor_path( CEXCEPTION_LIB_PATH, CEXCEPTION_C_FILE ), + FilePathUtils.form_ceedling_vendor_path( CEXCEPTION_LIB_PATH, CEXCEPTION_H_FILE ) ] + ) +end + + +if (PROJECT_USE_EXCEPTIONS and PROJECT_RELEASE_BUILD) +file( @ceedling[:file_path_utils].form_release_build_c_object_filepath( CEXCEPTION_C_FILE ) => [ + FilePathUtils.form_ceedling_vendor_path( CEXCEPTION_LIB_PATH, CEXCEPTION_C_FILE ), + FilePathUtils.form_ceedling_vendor_path( CEXCEPTION_LIB_PATH, CEXCEPTION_H_FILE ) ] + ) +end + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/test_includes_extractor.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/test_includes_extractor.rb new file mode 100644 index 0000000..35f7c53 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/test_includes_extractor.rb @@ -0,0 +1,81 @@ + +class TestIncludesExtractor + + constructor :configurator, :yaml_wrapper, :file_wrapper + + + def setup + @includes = {} + @mocks = {} + end + + + # for includes_list file, slurp up array from yaml file and sort & store includes + def parse_includes_list(includes_list) + gather_and_store_includes( includes_list, @yaml_wrapper.load(includes_list) ) + end + + # open, scan for, and sort & store includes of test file + def parse_test_file(test) + gather_and_store_includes( test, extract_from_file(test) ) + end + + # mocks with no file extension + def lookup_raw_mock_list(test) + file_key = form_file_key(test) + return [] if @mocks[file_key].nil? + return @mocks[file_key] + end + + # includes with file extension + def lookup_includes_list(file) + file_key = form_file_key(file) + return [] if (@includes[file_key]).nil? + return @includes[file_key] + end + + private ################################# + + def form_file_key(filepath) + return File.basename(filepath).to_sym + end + + def extract_from_file(file) + includes = [] + header_extension = @configurator.extension_header + + contents = @file_wrapper.read(file) + + # remove line comments + contents = contents.gsub(/\/\/.*$/, '') + # remove block comments + contents = contents.gsub(/\/\*.*?\*\//m, '') + + contents.split("\n").each do |line| + # look for include statement + scan_results = line.scan(/#include\s+\"\s*(.+#{'\\'+header_extension})\s*\"/) + + includes << scan_results[0][0] if (scan_results.size > 0) + end + + return includes.uniq + end + + def gather_and_store_includes(file, includes) + mock_prefix = @configurator.cmock_mock_prefix + header_extension = @configurator.extension_header + file_key = form_file_key(file) + @mocks[file_key] = [] + + # add includes to lookup hash + @includes[file_key] = includes + + includes.each do |include_file| + # check if include is a mock + scan_results = include_file.scan(/(#{mock_prefix}.+)#{'\\'+header_extension}/) + # add mock to lookup hash + @mocks[file_key] << scan_results[0][0] if (scan_results.size > 0) + end + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/test_invoker.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/test_invoker.rb new file mode 100644 index 0000000..b80d91e --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/test_invoker.rb @@ -0,0 +1,72 @@ +require 'rubygems' +require 'rake' # for ext() + + +class TestInvoker + + attr_reader :sources, :tests, :mocks + + constructor :configurator, :test_invoker_helper, :streaminator, :preprocessinator, :task_invoker, :dependinator, :project_config_manager, :file_path_utils + + def setup + @sources = [] + @tests = [] + @mocks = [] + end + + def setup_and_invoke(tests, options={:force_run => true}) + + @tests = tests + + @project_config_manager.process_test_config_change + + @tests.each do |test| + # announce beginning of test run + header = "Test '#{File.basename(test)}'" + @streaminator.stdout_puts("\n\n#{header}\n#{'-' * header.length}") + + begin + # collect up test fixture pieces & parts + runner = @file_path_utils.form_runner_filepath_from_test( test ) + mock_list = @preprocessinator.preprocess_test_and_invoke_test_mocks( test ) + sources = @test_invoker_helper.extract_sources( test ) + extras = @configurator.collection_test_fixture_extra_link_objects + core = [test] + mock_list + sources + objects = @file_path_utils.form_test_build_objects_filelist( [runner] + core + extras ) + results_pass = @file_path_utils.form_pass_results_filepath( test ) + results_fail = @file_path_utils.form_fail_results_filepath( test ) + + # clean results files so we have a missing file with which to kick off rake's dependency rules + @test_invoker_helper.clean_results( {:pass => results_pass, :fail => results_fail}, options ) + + # load up auxiliary dependencies so deep changes cause rebuilding appropriately + @test_invoker_helper.process_auxiliary_dependencies( core ) + + # tell rake to create test runner if needed + @task_invoker.invoke_test_runner( runner ) + + # enhance object file dependencies to capture externalities influencing regeneration + @dependinator.enhance_test_build_object_dependencies( objects ) + + # associate object files with executable + @dependinator.setup_test_executable_dependencies( test, objects ) + + # 3, 2, 1... launch + @task_invoker.invoke_test_results( results_pass ) + rescue => e + @test_invoker_helper.process_exception(e) + end + + # store away what's been processed + @mocks.concat( mock_list ) + @sources.concat( sources ) + end + + # post-process collected mock list + @mocks.uniq! + + # post-process collected sources list + @sources.uniq! + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/test_invoker_helper.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/test_invoker_helper.rb new file mode 100644 index 0000000..f7d848d --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/test_invoker_helper.rb @@ -0,0 +1,41 @@ +require 'rubygems' +require 'rake' # for ext() + + +class TestInvokerHelper + + constructor :configurator, :task_invoker, :dependinator, :test_includes_extractor, :file_finder, :file_path_utils, :streaminator, :file_wrapper + + def clean_results(results, options) + @file_wrapper.rm_f( results[:fail] ) + @file_wrapper.rm_f( results[:pass] ) if (options[:force_run]) + end + + def process_auxiliary_dependencies(files) + return if (not @configurator.project_use_auxiliary_dependencies) + + dependencies_list = @file_path_utils.form_test_dependencies_filelist( files ) + @task_invoker.invoke_test_dependencies_files( dependencies_list ) + @dependinator.load_test_object_deep_dependencies( dependencies_list ) + end + + def extract_sources(test) + sources = [] + includes = @test_includes_extractor.lookup_includes_list(test) + + includes.each { |include| sources << @file_finder.find_source_file(include, :ignore) } + + return sources.compact + end + + def process_exception(exception) + if (exception.message =~ /Don't know how to build task '(.+)'/i) + @streaminator.stderr_puts("ERROR: Rake could not find file referenced in source or test: '#{$1}'.") + @streaminator.stderr_puts("Possible stale dependency due to a file name change, etc. Execute 'clean' task and try again.") if (@configurator.project_use_auxiliary_dependencies) + raise '' + else + raise exception + end + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/tool_executor.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/tool_executor.rb new file mode 100644 index 0000000..fcd4d42 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/tool_executor.rb @@ -0,0 +1,178 @@ +require 'constants' + + +class ToolExecutor + + constructor :configurator, :tool_executor_helper, :streaminator, :system_wrapper + + def setup + @tool_name = '' + @executable = '' + end + + # build up a command line from yaml provided config + def build_command_line(tool_config, *args) + @tool_name = tool_config[:name] + @executable = tool_config[:executable] + + # basic premise is to iterate top to bottom through arguments using '$' as + # a string replacement indicator to expand globals or inline yaml arrays + # into command line arguments via substitution strings + return [ + @tool_executor_helper.osify_path_separators( expandify_element(@executable, *args) ), + build_arguments(tool_config[:arguments], *args), + @tool_executor_helper.stderr_redirect_addendum(tool_config) ].compact.join(' ') + end + + + # shell out, execute command, and return response + def exec(command, args=[], options={:boom => true}) + command_str = "#{command} #{args.join(' ')}".strip + + shell_result = @system_wrapper.shell_execute(command_str) + + @tool_executor_helper.print_happy_results(command_str, shell_result) + @tool_executor_helper.print_error_results(command_str, shell_result) if (options[:boom]) + + raise if ((shell_result[:exit_code] != 0) and options[:boom]) + + return shell_result + end + + + private ############################# + + + def build_arguments(config, *args) + build_string = '' + + return nil if (config.nil?) + + # iterate through each argument + + # the yaml blob array needs to be flattened so that yaml substitution + # is handled correctly, since it creates a nested array when an anchor is + # dereferenced + config.flatten.each do |element| + argument = '' + + case(element) + # if we find a simple string then look for string replacement operators + # and expand with the parameters in this method's argument list + when String then argument = expandify_element(element, *args) + # if we find a hash, then we grab the key as a substitution string and expand the + # hash's value(s) within that substitution string + when Hash then argument = dehashify_argument_elements(element) + end + + build_string.concat("#{argument} ") if (argument.length > 0) + end + + build_string.strip! + return build_string if (build_string.length > 0) + return nil + end + + + # handle simple text string argument & argument array string replacement operators + def expandify_element(element, *args) + match = // + to_process = nil + args_index = 0 + + # handle ${#} input replacement + if (element =~ TOOL_EXECUTOR_ARGUMENT_REPLACEMENT_PATTERN) + args_index = ($2.to_i - 1) + + if (args.nil? or args[args_index].nil?) + @streaminator.stderr_puts("ERROR: Tool '#{@tool_name}' expected valid argument data to accompany replacement operator #{$1}.", Verbosity::ERRORS) + raise + end + + match = /#{Regexp.escape($1)}/ + to_process = args[args_index] + end + + # simple string argument: replace escaped '\$' and strip + element.sub!(/\\\$/, '$') + element.strip! + + # handle inline ruby execution + if (element =~ RUBY_EVAL_REPLACEMENT_PATTERN) + element.replace(eval($1)) + end + + build_string = '' + + # handle array or anything else passed into method to be expanded in place of replacement operators + case (to_process) + when Array then to_process.each {|value| build_string.concat( "#{element.sub(match, value.to_s)} " ) } if (to_process.size > 0) + else build_string.concat( element.sub(match, to_process.to_s) ) + end + + # handle inline ruby string substitution + if (build_string =~ RUBY_STRING_REPLACEMENT_PATTERN) + build_string.replace(@system_wrapper.module_eval(build_string)) + end + + return build_string.strip + end + + + # handle argument hash: keys are substitution strings, values are data to be expanded within substitution strings + def dehashify_argument_elements(hash) + build_string = '' + elements = [] + + # grab the substitution string (hash key) + substitution = hash.keys[0].to_s + # grab the string(s) to squirt into the substitution string (hash value) + expand = hash[hash.keys[0]] + + if (expand.nil?) + @streaminator.stderr_puts("ERROR: Tool '#{@tool_name}' could not expand nil elements for substitution string '#{substitution}'.", Verbosity::ERRORS) + raise + end + + # array-ify expansion input if only a single string + expansion = ((expand.class == String) ? [expand] : expand) + + expansion.each do |item| + # code eval substitution + if (item =~ RUBY_EVAL_REPLACEMENT_PATTERN) + elements << eval($1) + # string eval substitution + elsif (item =~ RUBY_STRING_REPLACEMENT_PATTERN) + elements << @system_wrapper.module_eval(item) + # global constants + elsif (@system_wrapper.constants_include?(item)) + const = Object.const_get(item) + if (const.nil?) + @streaminator.stderr_puts("ERROR: Tool '#{@tool_name}' found constant '#{item}' to be nil.", Verbosity::ERRORS) + raise + else + elements << const + end + elsif (item.class == Array) + elements << item + elsif (item.class == String) + @streaminator.stderr_puts("ERROR: Tool '#{@tool_name}' cannot expand nonexistent value '#{item}' for substitution string '#{substitution}'.", Verbosity::ERRORS) + raise + else + @streaminator.stderr_puts("ERROR: Tool '#{@tool_name}' cannot expand value having type '#{item.class}' for substitution string '#{substitution}'.", Verbosity::ERRORS) + raise + end + end + + # expand elements (whether string or array) into substitution string & replace escaped '\$' + elements.flatten! + elements.each do |element| + build_string.concat( substitution.sub(/([^\\]*)\$/, "\\1#{element}") ) # don't replace escaped '\$' but allow us to replace just a lonesome '$' + build_string.gsub!(/\\\$/, '$') + build_string.concat(' ') + end + + return build_string.strip + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/tool_executor_helper.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/tool_executor_helper.rb new file mode 100644 index 0000000..c9f9ca2 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/tool_executor_helper.rb @@ -0,0 +1,57 @@ +require 'constants' # for Verbosity enumeration & $stderr redirect enumeration + +class ToolExecutorHelper + + constructor :streaminator, :system_wrapper + + def osify_path_separators(executable) + return executable.gsub(/\//, '\\') if (@system_wrapper.is_windows?) + return executable + end + + def stderr_redirect_addendum(tool_config) + return nil if (tool_config[:stderr_redirect].nil?) + + redirect = tool_config[:stderr_redirect] + + case redirect + # we may need more complicated processing after some learning with various environments + when StdErrRedirect::NONE then nil + when StdErrRedirect::AUTO then '2>&1' + when StdErrRedirect::WIN then '2>&1' + when StdErrRedirect::UNIX then '2>&1' + when StdErrRedirect::TCSH then '|&' + else redirect.to_s + end + end + + # if command succeeded and we have verbosity cranked up, spill our guts + def print_happy_results(command_str, shell_result) + if (shell_result[:exit_code] == 0) + output = "> Shell executed command:\n" + output += "#{command_str}\n" + output += "> Produced response:\n" if (not shell_result[:output].empty?) + output += "#{shell_result[:output].strip}\n" if (not shell_result[:output].empty?) + output += "\n" + + @streaminator.stdout_puts(output, Verbosity::OBNOXIOUS) + end + end + + # if command failed and we have verbosity set to minimum error level, spill our guts + def print_error_results(command_str, shell_result) + if (shell_result[:exit_code] != 0) + output = "ERROR: Shell command failed.\n" + output += "> Shell executed command:\n" + output += "'#{command_str}'\n" + output += "> Produced response:\n" if (not shell_result[:output].empty?) + output += "#{shell_result[:output].strip}\n" if (not shell_result[:output].empty?) + output += "> And exited with status: [#{shell_result[:exit_code]}].\n" if (shell_result[:exit_code] != nil) + output += "> And then likely crashed.\n" if (shell_result[:exit_code] == nil) + output += "\n" + + @streaminator.stderr_puts(output, Verbosity::ERRORS) + end + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/verbosinator.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/verbosinator.rb new file mode 100644 index 0000000..e8ed38d --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/verbosinator.rb @@ -0,0 +1,10 @@ + +class Verbosinator + + constructor :configurator + + def should_output?(level) + return (level <= @configurator.project_verbosity) + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/yaml_wrapper.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/yaml_wrapper.rb new file mode 100644 index 0000000..77cef59 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/lib/yaml_wrapper.rb @@ -0,0 +1,16 @@ +require 'yaml' + + +class YamlWrapper + + def load(filepath) + return YAML.load(File.read(filepath)) + end + + def dump(filepath, structure) + File.open(filepath, 'w') do |output| + YAML.dump(structure, output) + end + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/plugins/stdout_ide_tests_report/stdout_ide_tests_report.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/plugins/stdout_ide_tests_report/stdout_ide_tests_report.rb new file mode 100644 index 0000000..f76ec14 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/plugins/stdout_ide_tests_report/stdout_ide_tests_report.rb @@ -0,0 +1,44 @@ +require 'plugin' +require 'defaults' + +class StdoutIdeTestsReport < Plugin + + def setup + @result_list = [] + end + + def post_test_execute(arg_hash) + return if not (arg_hash[:context] == TEST_CONTEXT) + + @result_list << arg_hash[:result_file] + end + + def post_build + return if (not @ceedling[:task_invoker].test_invoked?) + + results = @ceedling[:plugin_reportinator].assemble_test_results(@result_list) + hash = { + :header => '', + :results => results + } + + @ceedling[:plugin_reportinator].run_test_results_report(hash) do + message = '' + message = 'Unit test failures.' if (hash[:results[:counts][:failed] > 0) + message + end + end + + def summary + result_list = @ceedling[:file_path_utils].form_pass_results_filelist( PROJECT_TEST_RESULTS_PATH, COLLECTION_ALL_TESTS ) + + # get test results for only those tests in our configuration and of those only tests with results on disk + hash = { + :header => '', + :results => @ceedling[:plugin_reportinator].assemble_test_results(result_list, {:boom => false}) + } + + @ceedling[:plugin_reportinator].run_test_results_report(hash) + end + +end \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/plugins/stdout_ide_tests_report/stdout_ide_tests_report.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/plugins/stdout_ide_tests_report/stdout_ide_tests_report.yml new file mode 100644 index 0000000..c25acf5 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/plugins/stdout_ide_tests_report/stdout_ide_tests_report.yml @@ -0,0 +1,4 @@ +--- +:plugins: + # tell Ceedling we got results display taken care of + :display_raw_test_results: FALSE diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/plugins/stdout_pretty_tests_report/stdout_pretty_tests_report.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/plugins/stdout_pretty_tests_report/stdout_pretty_tests_report.rb new file mode 100644 index 0000000..1213a19 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/plugins/stdout_pretty_tests_report/stdout_pretty_tests_report.rb @@ -0,0 +1,108 @@ +require 'plugin' +require 'defaults' + +class StdoutPrettyTestsReport < Plugin + + def setup + @result_list = [] + + template = %q{ + % ignored = hash[:results][:counts][:ignored] + % failed = hash[:results][:counts][:failed] + % stdout_count = hash[:results][:counts][:stdout] + % header_prepend = ((hash[:header].length > 0) ? "#{hash[:header]}: " : '') + % banner_width = 25 + header_prepend.length # widest message + + % if (ignored > 0) + <%=@ceedling[:plugin_reportinator].generate_banner(header_prepend + 'IGNORED UNIT TEST SUMMARY')%> + % hash[:results][:ignores].each do |ignore| + [<%=ignore[:source][:file]%>] + % ignore[:collection].each do |item| + Test: <%=item[:test]%> + % if (not item[:message].empty?) + At line (<%=item[:line]%>): "<%=item[:message]%>" + % else + At line (<%=item[:line]%>) + % end + + % end + % end + % end + % if (failed > 0) + <%=@ceedling[:plugin_reportinator].generate_banner(header_prepend + 'FAILED UNIT TEST SUMMARY')%> + % hash[:results][:failures].each do |failure| + [<%=failure[:source][:file]%>] + % failure[:collection].each do |item| + Test: <%=item[:test]%> + % if (not item[:message].empty?) + At line (<%=item[:line]%>): "<%=item[:message]%>" + % else + At line (<%=item[:line]%>) + % end + + % end + % end + % end + % if (stdout_count > 0) + <%=@ceedling[:plugin_reportinator].generate_banner(header_prepend + 'UNIT TEST OTHER OUTPUT')%> + % hash[:results][:stdout].each do |string| + [<%=string[:source][:file]%>] + % string[:collection].each do |item| + - "<%=item%>" + % end + + % end + % end + % total_string = hash[:results][:counts][:total].to_s + % format_string = "%#{total_string.length}i" + <%=@ceedling[:plugin_reportinator].generate_banner(header_prepend + 'OVERALL UNIT TEST SUMMARY')%> + % if (hash[:results][:counts][:total] > 0) + TESTED: <%=hash[:results][:counts][:total].to_s%> + PASSED: <%=sprintf(format_string, hash[:results][:counts][:passed])%> + FAILED: <%=sprintf(format_string, failed)%> + IGNORED: <%=sprintf(format_string, ignored)%> + % else + + No tests executed. + % end + + }.left_margin + + @ceedling[:plugin_reportinator].register_test_results_template( template ) + end + + def post_test_execute(arg_hash) + return if not (arg_hash[:context] == TEST_CONTEXT) + + @result_list << arg_hash[:result_file] + end + + def post_build + return if not (@ceedling[:task_invoker].test_invoked?) + + results = @ceedling[:plugin_reportinator].assemble_test_results(@result_list) + hash = { + :header => '', + :results => results + } + + @ceedling[:plugin_reportinator].run_test_results_report(hash) do + message = '' + message = 'Unit test failures.' if (results[:counts][:failed] > 0) + message + end + end + + def summary + result_list = @ceedling[:file_path_utils].form_pass_results_filelist( PROJECT_TEST_RESULTS_PATH, COLLECTION_ALL_TESTS ) + + # get test results for only those tests in our configuration and of those only tests with results on disk + hash = { + :header => '', + :results => @ceedling[:plugin_reportinator].assemble_test_results(result_list, {:boom => false}) + } + + @ceedling[:plugin_reportinator].run_test_results_report(hash) + end + +end \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/plugins/stdout_pretty_tests_report/stdout_pretty_tests_report.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/plugins/stdout_pretty_tests_report/stdout_pretty_tests_report.yml new file mode 100644 index 0000000..c25acf5 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/plugins/stdout_pretty_tests_report/stdout_pretty_tests_report.yml @@ -0,0 +1,4 @@ +--- +:plugins: + # tell Ceedling we got results display taken care of + :display_raw_test_results: FALSE diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/plugins/xml_tests_report/xml_tests_report.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/plugins/xml_tests_report/xml_tests_report.rb new file mode 100644 index 0000000..4aa4f77 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/plugins/xml_tests_report/xml_tests_report.rb @@ -0,0 +1,106 @@ +require 'plugin' +require 'constants' + +class XmlTestsReport < Plugin + + def setup + @file_path = File.join( PROJECT_TEST_ARTIFACTS_PATH, 'report.xml' ) + @results_list = [] + @test_counter = 1 + end + + def post_test_execute(arg_hash) + return if not (arg_hash[:context] == TEST_TASKS_CONTEXT) + + @results_list << arg_hash[:result_file] + end + + def post_build + return if (not @ceedling[:task_invoker].test_invoked?) + + results = @ceedling[:plugin_reportinator].assemble_test_results(@results_list) + + @ceedling[:file_wrapper].open( @file_path, 'w' ) do |f| + write_results( results, f ) + end + end + + private + + def write_results( results, stream ) + write_header( stream ) + write_failures( results[:failures], stream ) + write_tests( results[:successes], stream, 'SuccessfulTests' ) + write_tests( results[:ignores], stream, 'IgnoredTests' ) + write_statistics( results[:counts], stream ) + write_footer( stream ) + end + + def write_header( stream ) + stream.puts "" + stream.puts "" + end + + def write_failures( results, stream ) + if (results.size == 0) + stream.puts "\t" + return + end + + stream.puts "\t" + + results.each do |result| + result[:collection].each do |item| + filename = File.join( result[:source][:path], result[:source][:file] ) + + stream.puts "\t\t" + stream.puts "\t\t\t#{filename}::#{item[:test]}" + stream.puts "\t\t\tAssertion" + stream.puts "\t\t\t" + stream.puts "\t\t\t\t#{filename}" + stream.puts "\t\t\t\t#{item[:line]}" + stream.puts "\t\t\t" + stream.puts "\t\t\t#{item[:message]}" + stream.puts "\t\t" + @test_counter += 1 + end + end + + stream.puts "\t" + end + + def write_tests( results, stream, tag ) + if (results.size == 0) + stream.puts "\t<#{tag}/>" + return + end + + stream.puts "\t<#{tag}>" + + results.each do |result| + result[:collection].each do |item| + stream.puts "\t\t" + stream.puts "\t\t\t#{File.join( result[:source][:path], result[:source][:file] )}::#{item[:test]}" + stream.puts "\t\t" + @test_counter += 1 + end + end + + stream.puts "\t" + end + + def write_statistics( counts, stream ) + stream.puts "\t" + stream.puts "\t\t#{counts[:total]}" + stream.puts "\t\t#{counts[:ignored]}" + stream.puts "\t\t#{counts[:failed]}" + stream.puts "\t\t0" + stream.puts "\t\t#{counts[:failed]}" + stream.puts "\t" + end + + def write_footer( stream ) + stream.puts "" + end + +end \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/release/build.info b/flex-bison/clcalc/modules/data-structures/tools/ceedling/release/build.info new file mode 100644 index 0000000..fa8f08c --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/release/build.info @@ -0,0 +1 @@ +150 diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/release/version.info b/flex-bison/clcalc/modules/data-structures/tools/ceedling/release/version.info new file mode 100644 index 0000000..9a7d84f --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/release/version.info @@ -0,0 +1 @@ +0.9 \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/behaviors/Manifest.txt b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/behaviors/Manifest.txt new file mode 100644 index 0000000..6c954ec --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/behaviors/Manifest.txt @@ -0,0 +1,9 @@ +Manifest.txt +Rakefile +lib/behaviors.rb +lib/behaviors/reporttask.rb +test/behaviors_tasks_test.rb +test/behaviors_test.rb +test/tasks_test/lib/user.rb +test/tasks_test/Rakefile +test/tasks_test/test/user_test.rb diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/behaviors/Rakefile b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/behaviors/Rakefile new file mode 100644 index 0000000..d4d68b9 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/behaviors/Rakefile @@ -0,0 +1,19 @@ +require 'rake' +require 'rubygems' +require 'hoe' + +Hoe.new('behaviors','1.0.3') do |p| + p.author = "Atomic Object LLC" + p.email = "dev@atomicobject.com" + p.url = "http://behaviors.rubyforge.org" + p.summary = "behavior-driven unit test helper" + p.description = <<-EOS +Behaviors allows for Test::Unit test case methods to be defined as +human-readable descriptions of program behavior. It also provides +Rake tasks to list the behaviors of your project. + EOS + p.test_globs = ['test/*_test.rb'] + + p.changes = <<-EOS + EOS +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/behaviors/lib/behaviors.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/behaviors/lib/behaviors.rb new file mode 100644 index 0000000..d8d70f7 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/behaviors/lib/behaviors.rb @@ -0,0 +1,76 @@ +=begin rdoc += Usage +Behaviors provides a single method: should. + +Instead of naming test methods like: + + def test_something + end + +You declare test methods like: + + should "perform action" do + end + +You may omit the body of a should method to describe unimplemented behavior. + + should "perform other action" + +When you run your unit tests, empty should methods will appear as an 'UNIMPLEMENTED CASE' along with the described behavior. +This is useful for sketching out planned behavior quickly. + +Simply extend Behaviors in your TestCase to start using behaviors. + + require 'test/unit' + require 'behaviors' + require 'user' + + class UserTest < Test::Unit::TestCase + extend Behaviors + ... + end + += Motivation +Test methods typically focus on the name of the method under test instead of its behavior. +Creating test methods with should statements focuses on the behavior of an object. +This helps you to think about the role of the object under test. + +Using a behavior-driven approach prevents the danger in assuming a one-to-one mapping of method names to +test method names. +As always, you get the most value by writing the tests first. + +For a more complete BDD framework, try RSpec http://rspec.rubyforge.org/ + += Rake tasks + +You can define a Behaviors::ReportTask in your Rakefile to generate rake tasks that +summarize the behavior of your project. + +These tasks are named behaviors and behaviors_html. They will output to the +console or an html file in the doc directory with a list all of your should tests. + Behaviors::ReportTask.new do |t| + t.pattern = 'test/**/*_test.rb' + end + +You may also initialize the ReportTask with a custom name to associate with a particular suite of tests. + Behaviors::ReportTask.new(:widget_subsystem) do |t| + t.pattern = 'test/widgets/*_test.rb' + end + +The html report will be placed in the doc directory by default. +You can override this default by setting the html_dir in the ReportTask. + Behaviors::ReportTask.new do |t| + t.pattern = 'test/**/*_test.rb' + t.html_dir = 'behaviors_html_reports' + end +=end +module Behaviors + def should(behave,&block) + mname = "test_should_#{behave}" + if block + define_method mname, &block + else + puts ">>> UNIMPLEMENTED CASE: #{name.sub(/Test$/,'')} should #{behave}" + end + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/behaviors/lib/behaviors/reporttask.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/behaviors/lib/behaviors/reporttask.rb new file mode 100644 index 0000000..51c0eca --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/behaviors/lib/behaviors/reporttask.rb @@ -0,0 +1,158 @@ +require 'rake' +require 'rake/tasklib' + +module Behaviors +include Rake + + class ReportTask < TaskLib + attr_accessor :pattern + attr_accessor :html_dir + + def initialize(name=:behaviors) + @name = name + @html_dir = 'doc' + yield self if block_given? + define + end + + def define + desc "List behavioral definitions for the classes specified (use for= to further limit files included in report)" + task @name do + specifications.each do |spec| + puts "#{spec.name} should:\n" + spec.requirements.each do |req| + puts " - #{req}" + end + end + end + + desc "Generate html report of behavioral definitions for the classes specified (use for= to further limit files included in report)" + task "#{@name}_html" do + require 'erb' + txt =<<-EOS + + + + + +
Specifications
+<% specifications.each do |spec| %> +
+<%= spec.name %> should: +
    +<% spec.requirements.each do |req| %> +
  • <%= req %>
  • +<% end %> +
+
+<% end %> + + + EOS + output_dir = File.expand_path(@html_dir) + mkdir_p output_dir + output_filename = output_dir + "/behaviors.html" + File.open(output_filename,"w") do |f| + f.write ERB.new(txt).result(binding) + end + puts "(Wrote #{output_filename})" + end + end + + private + def test_files + test_list = FileList[@pattern] + if ENV['for'] + test_list = test_list.grep(/#{ENV['for']}/i) + end + test_list + end + + def specifications + test_files.map do |file| + spec = OpenStruct.new + m = %r".*/([^/].*)_test.rb".match(file) + class_name = titleize(m[1]) if m[1] + spec.name = class_name + spec.requirements = [] + File::readlines(file).each do |line| + if line =~ /^\s*should\s+\(?\s*["'](.*)["']/ + spec.requirements << $1 + end + end + spec + end + end + + ############################################################ + # STOLEN FROM inflector.rb + ############################################################ + #-- + # Copyright (c) 2005 David Heinemeier Hansson + # + # Permission is hereby granted, free of charge, to any person obtaining + # a copy of this software and associated documentation files (the + # "Software"), to deal in the Software without restriction, including + # without limitation the rights to use, copy, modify, merge, publish, + # distribute, sublicense, and/or sell copies of the Software, and to + # permit persons to whom the Software is furnished to do so, subject to + # the following conditions: + # + # The above copyright notice and this permission notice shall be + # included in all copies or substantial portions of the Software. + # + # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + #++ + def titleize(word) + humanize(underscore(word)).gsub(/\b([a-z])/) { $1.capitalize } + end + + def underscore(camel_cased_word) camel_cased_word.to_s.gsub(/::/, '/'). + gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').gsub(/([a-z\d])([A-Z])/,'\1_\2').tr("-", "_").downcase + end + + def humanize(lower_case_and_underscored_word) + lower_case_and_underscored_word.to_s.gsub(/_id$/, "").gsub(/_/, " ").capitalize + end + + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/behaviors/test/behaviors_tasks_test.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/behaviors/test/behaviors_tasks_test.rb new file mode 100644 index 0000000..9382e07 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/behaviors/test/behaviors_tasks_test.rb @@ -0,0 +1,73 @@ +require 'test/unit' +require 'fileutils' + +class BehaviorsTasksTest < Test::Unit::TestCase + include FileUtils + + def setup + @here = File.expand_path(File.dirname(__FILE__)) + @base_cmd = RUBY_PLATFORM[/mswin/] ? 'rake.cmd ' : 'rake ' + end + + # + # HELPERS + # + def run_behaviors_task + run_cmd "behaviors" + end + + def run_behaviors_html_task + run_cmd "behaviors_html" + end + + def run_cmd(cmd) + cd "#{@here}/tasks_test" do + @report = %x[ #{@base_cmd} #{cmd} ] + end + end + + def see_html_task_output_message + @html_output_filename = "#{@here}/tasks_test/behaviors_doc/behaviors.html" + assert_match(/Wrote #{@html_output_filename}/, @report) + end + + def see_that_html_report_file_exits + assert File.exists?(@html_output_filename), "html output file should exist" + end + + def html_report_file_should_contain(user_behaviors) + file_contents = File.read(@html_output_filename) + user_behaviors.each do |line| + assert_match(/#{line}/, file_contents) + end + rm_rf File.dirname(@html_output_filename) + end + + # + # TESTS + # + def test_that_behaviors_tasks_should_list_behavioral_definitions_for_the_classes_under_test + run_behaviors_task + user_behaviors = [ + "User should:", + " - be able set user name and age during construction", + " - be able to get user name and age", + " - be able to ask if a user is an adult" + ] + assert_match(/#{user_behaviors.join("\n")}/, @report) + end + + def test_that_behaviors_tasks_should_list_behavioral_definitions_for_the_classes_under_test_in_html_output + run_behaviors_html_task + see_html_task_output_message + see_that_html_report_file_exits + user_behaviors = [ + "User should:", + "be able set user name and age during construction", + "be able to get user name and age", + "be able to ask if a user is an adult" + ] + html_report_file_should_contain user_behaviors + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/behaviors/test/behaviors_test.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/behaviors/test/behaviors_test.rb new file mode 100644 index 0000000..fd0a77f --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/behaviors/test/behaviors_test.rb @@ -0,0 +1,50 @@ +require 'test/unit' +require File.expand_path(File.dirname(__FILE__)) + '/../lib/behaviors' +require 'stringio' + +loading_developer_test_class_stdout = StringIO.new +saved_stdout = $stdout.dup +$stdout = loading_developer_test_class_stdout + +class DeveloperTest + extend Behaviors + attr_accessor :flunk_msg, :tested_code + + should "test their code" do + @tested_code = true + end + should "go to meetings" +end + +$stdout = saved_stdout +loading_developer_test_class_stdout.rewind +$loading_developer_test_class_output = loading_developer_test_class_stdout.read + +class BehaviorsTest < Test::Unit::TestCase + + + def setup + @target = DeveloperTest.new + assert_nil @target.tested_code, "block called too early" + end + + # + # TESTS + # + def test_should_called_with_a_block_defines_a_test + assert @target.methods.include?("test_should_test their code"), "Missing test method" + + @target.send("test_should_test their code") + + assert @target.tested_code, "block not called" + end + + def test_should_called_without_a_block_does_not_create_a_test_method + assert !@target.methods.include?("test_should_go to meetings"), "Should not have method" + end + + def test_should_called_without_a_block_will_give_unimplemented_output_when_class_loads + unimplemented_output = "UNIMPLEMENTED CASE: Developer should go to meetings" + assert_match(/#{unimplemented_output}/, $loading_developer_test_class_output) + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/behaviors/test/tasks_test/Rakefile b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/behaviors/test/tasks_test/Rakefile new file mode 100644 index 0000000..ba71f71 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/behaviors/test/tasks_test/Rakefile @@ -0,0 +1,19 @@ +require 'rake' +require 'rake/testtask' + +here = File.expand_path(File.dirname(__FILE__)) +require "#{here}/../../lib/behaviors/reporttask" + +desc 'Default: run unit tests.' +task :default => :test + +Rake::TestTask.new(:test) do |t| + t.libs << "#{here}/../../lib" + t.pattern = 'test/**/*_test.rb' + t.verbose = true +end + +Behaviors::ReportTask.new(:behaviors) do |t| + t.pattern = 'test/**/*_test.rb' + t.html_dir = 'behaviors_doc' +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/behaviors/test/tasks_test/lib/user.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/behaviors/test/tasks_test/lib/user.rb new file mode 100644 index 0000000..40bc07c --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/behaviors/test/tasks_test/lib/user.rb @@ -0,0 +1,2 @@ +class User +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/behaviors/test/tasks_test/test/user_test.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/behaviors/test/tasks_test/test/user_test.rb new file mode 100644 index 0000000..ad3cd1b --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/behaviors/test/tasks_test/test/user_test.rb @@ -0,0 +1,17 @@ +require 'test/unit' +require 'behaviors' + +require 'user' + +class UserTest < Test::Unit::TestCase + extend Behaviors + + def setup + end + + should "be able set user name and age during construction" + should "be able to get user name and age" + should "be able to ask if a user is an adult" + def test_DELETEME + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/docs/CExceptionSummary.odt b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/docs/CExceptionSummary.odt new file mode 100644 index 0000000..ea852a0 Binary files /dev/null and b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/docs/CExceptionSummary.odt differ diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/docs/CExceptionSummary.pdf b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/docs/CExceptionSummary.pdf new file mode 100644 index 0000000..a838337 Binary files /dev/null and b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/docs/CExceptionSummary.pdf differ diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/docs/license.txt b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/docs/license.txt new file mode 100644 index 0000000..561e5f2 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/docs/license.txt @@ -0,0 +1,30 @@ + Copyright (c) 2007 Mark VanderVoord + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + The end-user documentation included with the redistribution, if + any, must include the following acknowledgment: "This product + includes software developed for the CEXCeption Project, by Mark + VanderVoord and other contributors", in the same place and form + as other third-party acknowledgments. Alternately, this + acknowledgment may appear in the software itself, in the same + form and location as other such third-party acknowledgments. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/docs/readme.txt b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/docs/readme.txt new file mode 100644 index 0000000..92cac38 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/docs/readme.txt @@ -0,0 +1,236 @@ +==================================================================== +CException +==================================================================== + +CException is a basic exception framework for C, suitable for use in +embedded applications. It provides an exception framework similar in +use to C++, but with much less overhead. + +CException uses C standard library functions setjmp and longjmp to +operate. As long as the target system has these two functions defined, +this library should be useable with very little configuration. It +even supports environments where multiple program flows are in use, +such as real-time operating systems. + +There are about a gabillion exception frameworks using a similar +setjmp/longjmp method out there... and there will probably be more +in the future. Unfortunately, when we started our last embedded +project, all those that existed either (a) did not support multiple +tasks (therefore multiple stacks) or (b) were way more complex than +we really wanted. CException was born. + +Why use CException? + +0. It's ANSI C, and it beats passing error codes around. + +1. You want something simple... CException throws a single id. You can + define those ID's to be whatever you like. You might even choose which + type that number is for your project. But that's as far as it goes. + We weren't interested in passing objects or structs or strings... + just simple error codes. + +2. Performance... CException can be configured for single tasking or + multitasking. In single tasking, there is very little overhead past + the setjmp/longjmp calls (which are already fast). In multitasking, + your only additional overhead is the time it takes you to determine + a unique task id 0 - num_tasks. + +For the latest version, go to http://cexception.sourceforge.net + +-------------------------------------------------------------------- +CONTENTS OF THIS DOCUMENT +-------------------------------------------------------------------- + +Usage +Limitations +API +Configuration +Testing +License + +-------------------------------------------------------------------- +Usage +-------------------------------------------------------------------- + +Code that is to be protected are wrapped in Try { } Catch { } blocks. +The code directly following the Try call is "protected", meaning that +if any Throws occur, program control is directly transferred to the +start of the Catch block. + +A numerical exception ID is included with Throw, and is made accessible +from the Catch block. + +Throws can occur from within function calls (nested as deeply as you +like) or directly from within the function itself. + +-------------------------------------------------------------------- +Limitations +-------------------------------------------------------------------- + +This library was made to be as fast as possible, and provide basic +exception handling. It is not a full-blown exception library. Because +of this, there are a few limitations that should be observed in order +to successfully utilize this library: + +1. Do not directly "return" from within a Try block, nor "goto" + into or out of a Try block. + + Why? + + The "Try" macro allocates some local memory and alters a global + pointer. These are cleaned up at the top of the "Catch" macro. + Gotos and returns would bypass some of these steps, resulting in + memory leaks or unpredictable behavior. + +2. If (a) you change local (stack) variables within your Try block, + AND (b) wish to make use of the updated values after an exception + is thrown, those variables should be made volatile. Note that this + is ONLY for locals and ONLY when you need access to them after a + throw. + + Why? + + Compilers optimize. There is no way to guarantee that the actual + memory location was updated and not just a register unless the + variable is marked volatile. + +3. Memory which is malloc'd or new'd is not automatically released + when an error is thrown. This will sometimes be desirable, and + othertimes may not. It will be the responsibility of the Catch + block to perform this kind of cleanup. + + Why? + + There's just no easy way to track malloc'd memory, etc., without + replacing or wrapping malloc calls or something like that. This + is a light framework, so these options were not desirable. + +-------------------------------------------------------------------- +API +-------------------------------------------------------------------- + +Try +--- + +Try is a macro which starts a protected block. It MUST be followed by +a pair of braces or a single protected line (similar to an 'if'), +enclosing the data that is to be protected. It MUST be followed by a +Catch block (don't worry, you'll get compiler errors to let you know if +you mess any of that up). + +Catch(e) +-------- + +Catch is a macro which ends the Try block and starts the error handling +block. The catch block is called if and only if an exception was thrown +while within the Try block. This error was thrown by a Throw call +somewhere within Try (or within a function called within Try, or a function +called by a function called within Try, etc). + +The single parameter 'e' is filled with the error code which was thrown. +This can be used for reporting, conditional cleanup, etc. (or you can just +ignore it if you really want... people ignore return codes all the time, +right?). 'e' should be of type EXCEPTION_T; + +Throw(e) +-------- + +The method of throwing an error. Throws should only occur from within a +protected (Try...Catch) block, though it may easily be nested many function +calls deep without an impact on performance or functionality. Throw takes +a single argument, which is an exception id which will be passed to Catch +as the reason for the error. + +If you wish to Rethrow an error, this can be done by calling Throw(e) with +the error code you just caught. It IS valid to throw from a catch block. + +-------------------------------------------------------------------- +CONFIGURATION +-------------------------------------------------------------------- + +CException is a mostly portable library. It has one universal +dependency, and some macros which are required if working in a +multi-tasking environment. + +1. The standard C library setjmp must be available. Since this is part + of the standard library, chances are good that you'll be fine. + +2. If working in a multitasking environment, methods for obtaining an + index into an array of frames and to get the overall number of + id's are required. If the OS supports a method to retrieve Task + ID's, and those Tasks are number 0, 1, 2... you are in an ideal + situation. Otherwise, a more creative mapping function may be + required. Note that this function is likely to be called twice + for each protected block and once during a throw. This is the + only overhead in the system. + +Exception.h +----------------- +By convention, most projects include Exception.h which defines any +further requirements, then calls CException.h to do the gruntwork. All +of these are optional. You could directly include CException.h if +you wanted and just use the defaults provided. + +EXCEPTION_T - Set this to the type you want your exception id's + to be. Defaults to 'unsigned int'. + +EXCEPTION_NONE - Set this to a number which will never be an + exception id in your system. Defaults to 0x5a5a5a5a. + +EXCEPTION_GET_ID - If in a multi-tasking environment, this should be + set to be a call to the function described in #2 above. + Defaults to just return 0 all the time (good for + single tasking environments) + +EXCEPTION_NUM_ID - If in a multi-tasking environment, this should be set + to the number of ID's required (usually the number of + tasks in the system). Defaults to 1 (for single + tasking environments). + +You may also want to include any header files which will commonly be +needed by the rest of your application where it uses exception handling +here. For example, OS header files or exception codes would be useful. + +-------------------------------------------------------------------- +TESTING +-------------------------------------------------------------------- + +If you want to validate that CException works with your tools or that +it works with your custom configuration, you may want to run the test +suite. + +The test suite included makes use of the Unity Test Framework. It will +require a native C compiler. The example makefile uses MinGW's gcc. +Modify the makefile to include the proper paths to tools, then run 'make' +to compile and run the test application. + +C_COMPILER - The C compiler to use to perform the tests +C_LIBS - The path to the C libraries (including setjmp) +UNITY_DIR - The path to the Unity framework (required to run tests) + (get it at http://embunity.sourceforge.net) + +-------------------------------------------------------------------- +LICENSE +-------------------------------------------------------------------- + +This software is licensed under the MIT License + +Copyright (c) 2007 Mark VanderVoord + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/lib/CException.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/lib/CException.c new file mode 100644 index 0000000..57f5353 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/lib/CException.c @@ -0,0 +1,39 @@ +#include "CException.h" + +volatile CEXCEPTION_FRAME_T CExceptionFrames[CEXCEPTION_NUM_ID]; + +//------------------------------------------------------------------------------------------ +// Throw +//------------------------------------------------------------------------------------------ +void Throw(CEXCEPTION_T ExceptionID) +{ + unsigned int MY_ID = CEXCEPTION_GET_ID; + CExceptionFrames[MY_ID].Exception = ExceptionID; + longjmp(*CExceptionFrames[MY_ID].pFrame, 1); +} + +//------------------------------------------------------------------------------------------ +// Explaination of what it's all for: +//------------------------------------------------------------------------------------------ +/* +#define Try + { <- give us some local scope. most compilers are happy with this + jmp_buf *PrevFrame, NewFrame; <- prev frame points to the last try block's frame. new frame gets created on stack for this Try block + unsigned int MY_ID = CEXCEPTION_GET_ID; <- look up this task's id for use in frame array. always 0 if single-tasking + PrevFrame = CExceptionFrames[CEXCEPTION_GET_ID].pFrame; <- set pointer to point at old frame (which array is currently pointing at) + CExceptionFrames[MY_ID].pFrame = &NewFrame; <- set array to point at my new frame instead, now + CExceptionFrames[MY_ID].Exception = CEXCEPTION_NONE; <- initialize my exception id to be NONE + if (setjmp(NewFrame) == 0) { <- do setjmp. it returns 1 if longjump called, otherwise 0 + if (&PrevFrame) <- this is here to force proper scoping. it requires braces or a single line to be but after Try, otherwise won't compile. This is always true at this point. + +#define Catch(e) + else { } <- this also forces proper scoping. Without this they could stick their own 'else' in and it would get ugly + CExceptionFrames[MY_ID].Exception = CEXCEPTION_NONE; <- no errors happened, so just set the exception id to NONE (in case it was corrupted) + } + else <- an exception occurred + { e = CExceptionFrames[MY_ID].Exception; e=e;} <- assign the caught exception id to the variable passed in. + CExceptionFrames[MY_ID].pFrame = PrevFrame; <- make the pointer in the array point at the previous frame again, as if NewFrame never existed. + } <- finish off that local scope we created to have our own variables + if (CExceptionFrames[CEXCEPTION_GET_ID].Exception != CEXCEPTION_NONE) <- start the actual 'catch' processing if we have an exception id saved away + */ + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/lib/CException.h b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/lib/CException.h new file mode 100644 index 0000000..40c6fc7 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/lib/CException.h @@ -0,0 +1,70 @@ +#ifndef _CEXCEPTION_H +#define _CEXCEPTION_H + +#include + +//To Use CException, you have a number of options: +//1. Just include it and run with the defaults +//2. Define any of the following symbols at the command line to override them +//3. Include a header file before CException.h everywhere which defines any of these +//4. Create an Exception.h in your path, and just define EXCEPTION_USE_CONFIG_FILE first + +#ifdef CEXCEPTION_USE_CONFIG_FILE +#include "CExceptionConfig.h" +#endif + +//This is the value to assign when there isn't an exception +#ifndef CEXCEPTION_NONE +#define CEXCEPTION_NONE (0x5A5A5A5A) +#endif + +//This is number of exception stacks to keep track of (one per task) +#ifndef CEXCEPTION_NUM_ID +#define CEXCEPTION_NUM_ID (1) //there is only the one stack by default +#endif + +//This is the method of getting the current exception stack index (0 if only one stack) +#ifndef CEXCEPTION_GET_ID +#define CEXCEPTION_GET_ID (0) //use the first index always because there is only one anyway +#endif + +//The type to use to store the exception values. +#ifndef CEXCEPTION_T +#define CEXCEPTION_T unsigned int +#endif + +//exception frame structures +typedef struct { + jmp_buf* pFrame; + volatile CEXCEPTION_T Exception; +} CEXCEPTION_FRAME_T; + +//actual root frame storage (only one if single-tasking) +extern volatile CEXCEPTION_FRAME_T CExceptionFrames[]; + +//Try (see C file for explanation) +#define Try \ + { \ + jmp_buf *PrevFrame, NewFrame; \ + unsigned int MY_ID = CEXCEPTION_GET_ID; \ + PrevFrame = CExceptionFrames[CEXCEPTION_GET_ID].pFrame; \ + CExceptionFrames[MY_ID].pFrame = (jmp_buf*)(&NewFrame); \ + CExceptionFrames[MY_ID].Exception = CEXCEPTION_NONE; \ + if (setjmp(NewFrame) == 0) { \ + if (&PrevFrame) + +//Catch (see C file for explanation) +#define Catch(e) \ + else { } \ + CExceptionFrames[MY_ID].Exception = CEXCEPTION_NONE; \ + } \ + else \ + { e = CExceptionFrames[MY_ID].Exception; e=e; } \ + CExceptionFrames[MY_ID].pFrame = PrevFrame; \ + } \ + if (CExceptionFrames[CEXCEPTION_GET_ID].Exception != CEXCEPTION_NONE) + +//Throw an Error +void Throw(CEXCEPTION_T ExceptionID); + +#endif // _CEXCEPTION_H diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/makefile b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/makefile new file mode 100644 index 0000000..c168a41 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/makefile @@ -0,0 +1,24 @@ +#Tool and Lib Locations +C_COMPILER=gcc +C_LIBS=C:/MinGW/lib +UNITY_DIR=vendor/unity/src + +#Test File To Be Created +OUT_FILE=test_cexceptions +ifeq ($(OS),Windows_NT) +OUT_EXTENSION=.exe +else +OUT_EXTENSION=.out +endif + +#Options +SRC_FILES=lib/CException.c test/TestException.c test/TestException_Runner.c $(UNITY_DIR)/unity.c +INC_DIRS=-Ilib -Itest -I$(UNITY_DIR) +LIB_DIRS=-L$(C_LIBS) +SYMBOLS=-DTEST -DEXCEPTION_USE_CONFIG_FILE + +#Default Task: Compile And Run Tests +default: + $(C_COMPILER) $(INC_DIRS) $(LIB_DIRS) $(SYMBOLS) $(SRC_FILES) -o $(OUT_FILE)$(OUT_EXTENSION) + $(OUT_FILE)$(OUT_EXTENSION) + \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/rakefile.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/rakefile.rb new file mode 100644 index 0000000..2458c6f --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/rakefile.rb @@ -0,0 +1,41 @@ +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require HERE+'vendor/unity/auto/colour_reporter.rb' + +#Tool and Lib Locations +C_COMPILER = 'gcc' +C_LIBS = '' +UNITY_DIR = 'vendor/unity/src' + +#Test File To Be Created +OUT_FILE = 'test_cexceptions' +OUT_EXTENSION = '.out' + +#Options +SRC_FILES = "lib/CException.c test/TestException.c test/TestException_Runner.c #{UNITY_DIR}/unity.c" +INC_DIRS = "-Ilib -Itest -I#{UNITY_DIR}" +LIB_DIRS = C_LIBS.empty? ? '' : "-L#{C_LIBS}" +SYMBOLS = '-DTEST -DEXCEPTION_USE_CONFIG_FILE' + +CLEAN.include("#{HERE}*.out") + +task :default => [:clobber, :test] +task :cruise => [:no_color, :default] + +desc "performs a quick set of unit tests to confirm you're ready to go" +task :test do + report "#{C_COMPILER} #{INC_DIRS} #{LIB_DIRS} #{SYMBOLS} #{SRC_FILES} -o #{OUT_FILE}#{OUT_EXTENSION}" + output = `#{C_COMPILER} #{INC_DIRS} #{LIB_DIRS} #{SYMBOLS} #{SRC_FILES} -o #{OUT_FILE}#{OUT_EXTENSION}` + report output + + report "#{HERE}#{OUT_FILE}#{OUT_EXTENSION}" + output = `#{HERE}#{OUT_FILE}#{OUT_EXTENSION}` + report output +end + +task :no_color do + $colour_output = false +end \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/release/build.info b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/release/build.info new file mode 100644 index 0000000..b5794c5 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/release/build.info @@ -0,0 +1,2 @@ +16 + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/release/version.info b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/release/version.info new file mode 100644 index 0000000..cb7e5f6 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/release/version.info @@ -0,0 +1,2 @@ +1.2.0 + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/test/CExceptionConfig.h b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/test/CExceptionConfig.h new file mode 100644 index 0000000..79b085d --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/test/CExceptionConfig.h @@ -0,0 +1,27 @@ +#ifndef _EXCEPTION_H +#define _EXCEPTION_H + +//Optionally define the exception type (something like an int which can be directly assigned) +#define CEXCEPTION_T int + +// Optionally define the reserved value representing NO EXCEPTION +#define CEXCEPTION_NONE (1234) + +// Multi-Tasking environments will need a couple of macros defined to make this library +// properly handle multiple exception stacks. You will need to include and required +// definitions, then define the following macros: +// EXCEPTION_GET_ID - returns the id of the current task indexed 0 to (numtasks - 1) +// EXCEPTION_NUM_ID - returns the number of tasks that might be returned +// +// For example, Quadros might include the following implementation: +#ifndef TEST +#include "OSAPI.h" +#define CEXCEPTION_GET_ID (KS_GetTaskID()) +#define CEXCEPTION_NUM_ID (NTASKS + 1) +#endif + +//This could be a good place to define/include some error ID's: +#define ERROR_ID_EVERYTHING_IS_BROKEN (0x88) +#define ERROR_ID_ONLY_THIS_IS_BROKEN (0x77) + +#endif // _EXCEPTION_H diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/test/TestException.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/test/TestException.c new file mode 100644 index 0000000..704cfdb --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/test/TestException.c @@ -0,0 +1,291 @@ +#include "unity.h" +#include "CException.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void test_BasicTryDoesNothingIfNoThrow(void) +{ + int i; + CEXCEPTION_T e = 0x5a; + + Try + { + i += 1; + } + Catch(e) + { + TEST_FAIL_MESSAGE("Should Not Enter Catch If Not Thrown") + } + + //verify that e was untouched + TEST_ASSERT_EQUAL(0x5a, e); +} + +void test_BasicThrowAndCatch(void) +{ + CEXCEPTION_T e; + + Try + { + Throw(0xBE); + TEST_FAIL_MESSAGE("Should Have Thrown An Error") + } + Catch(e) + { + //verify that e has the right data + TEST_ASSERT_EQUAL(0xBE, e); + } + + //verify that e STILL has the right data + TEST_ASSERT_EQUAL(0xBE, e); +} + +void test_BasicThrowAndCatch_WithMiniSyntax(void) +{ + CEXCEPTION_T e; + + //Mini Throw and Catch + Try + Throw(0xEF); + Catch(e) + TEST_ASSERT_EQUAL(0xEF, e); + TEST_ASSERT_EQUAL(0xEF, e); + + //Mini Passthrough + Try + e = 0; + Catch(e) + TEST_FAIL_MESSAGE("I shouldn't be caught because there was no throw"); + + TEST_ASSERT_EQUAL(0, e); +} + +void test_VerifyVolatilesSurviveThrowAndCatch(void) +{ + volatile unsigned int VolVal = 0; + CEXCEPTION_T e; + + Try + { + VolVal = 2; + Throw(0xBF); + TEST_FAIL_MESSAGE("Should Have Thrown An Error") + } + Catch(e) + { + VolVal += 2; + TEST_ASSERT_EQUAL(0xBF, e); + } + + TEST_ASSERT_EQUAL(4, VolVal); + TEST_ASSERT_EQUAL(0xBF, e); +} + +void HappyExceptionThrower(unsigned int ID) +{ + if (ID != 0) + { + Throw(ID); + } +} + +void test_ThrowFromASubFunctionAndCatchInRootFunc(void) +{ + volatile unsigned int ID = 0; + CEXCEPTION_T e; + + Try + { + + HappyExceptionThrower(0xBA); + TEST_FAIL_MESSAGE("Should Have Thrown An Exception"); + } + Catch(e) + { + ID = e; + } + + //verify that I can pass that value to something else + TEST_ASSERT_EQUAL(0xBA, e); +} + +void HappyExceptionRethrower(unsigned int ID) +{ + CEXCEPTION_T e; + + Try + { + Throw(ID); + } + Catch(e) + { + switch (e) + { + case 0xBD: + Throw(0xBF); + break; + default: + break; + } + } +} + +void test_ThrowAndCatchFromASubFunctionAndRethrowToCatchInRootFunc(void) +{ + volatile unsigned int ID = 0; + CEXCEPTION_T e; + + Try + { + HappyExceptionRethrower(0xBD); + TEST_FAIL_MESSAGE("Should Have Rethrown Exception"); + } + Catch(e) + { + ID = 1; + } + + TEST_ASSERT_EQUAL(0xBF, e); + TEST_ASSERT_EQUAL(1, ID); +} + +void test_ThrowAndCatchFromASubFunctionAndNoRethrowToCatchInRootFunc(void) +{ + CEXCEPTION_T e = 3; + + Try + { + HappyExceptionRethrower(0xBF); + } + Catch(e) + { + TEST_FAIL_MESSAGE("Should Not Have Re-thrown Error (it should have already been caught)"); + } + + //verify that THIS e is still untouched, even though subfunction was touched + TEST_ASSERT_EQUAL(3, e); +} + +void test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThisDoesntCorruptExceptionId(void) +{ + CEXCEPTION_T e; + + Try + { + HappyExceptionThrower(0xBF); + TEST_FAIL_MESSAGE("Should Have Thrown Exception"); + } + Catch(e) + { + TEST_ASSERT_EQUAL(0xBF, e); + HappyExceptionRethrower(0x12); + TEST_ASSERT_EQUAL(0xBF, e); + } + TEST_ASSERT_EQUAL(0xBF, e); +} + +void test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThatEachExceptionIdIndependent(void) +{ + CEXCEPTION_T e1, e2; + + Try + { + HappyExceptionThrower(0xBF); + TEST_FAIL_MESSAGE("Should Have Thrown Exception"); + } + Catch(e1) + { + TEST_ASSERT_EQUAL(0xBF, e1); + Try + { + HappyExceptionThrower(0x12); + } + Catch(e2) + { + TEST_ASSERT_EQUAL(0x12, e2); + } + TEST_ASSERT_EQUAL(0x12, e2); + TEST_ASSERT_EQUAL(0xBF, e1); + } + TEST_ASSERT_EQUAL(0x12, e2); + TEST_ASSERT_EQUAL(0xBF, e1); +} + +void test_CanHaveMultipleTryBlocksInASingleFunction(void) +{ + CEXCEPTION_T e; + + Try + { + HappyExceptionThrower(0x01); + TEST_FAIL_MESSAGE("Should Have Thrown Exception"); + } + Catch(e) + { + TEST_ASSERT_EQUAL(0x01, e); + } + + Try + { + HappyExceptionThrower(0xF0); + TEST_FAIL_MESSAGE("Should Have Thrown Exception"); + } + Catch(e) + { + TEST_ASSERT_EQUAL(0xF0, e); + } +} + +void test_CanHaveNestedTryBlocksInASingleFunction_ThrowInside(void) +{ + int i = 0; + CEXCEPTION_T e; + + Try + { + Try + { + HappyExceptionThrower(0x01); + i = 1; + TEST_FAIL_MESSAGE("Should Have Rethrown Exception"); + } + Catch(e) + { + TEST_ASSERT_EQUAL(0x01, e); + } + } + Catch(e) + { + TEST_FAIL_MESSAGE("Should Have Been Caught By Inside Catch"); + } +} + +void test_CanHaveNestedTryBlocksInASingleFunction_ThrowOutside(void) +{ + int i = 0; + CEXCEPTION_T e; + + Try + { + Try + { + i = 2; + } + Catch(e) + { + TEST_FAIL_MESSAGE("Should NotBe Caught Here"); + } + HappyExceptionThrower(0x01); + TEST_FAIL_MESSAGE("Should Have Rethrown Exception"); + } + Catch(e) + { + TEST_ASSERT_EQUAL(0x01, e); + } +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/test/TestException_Runner.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/test/TestException_Runner.c new file mode 100644 index 0000000..1697a0e --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/test/TestException_Runner.c @@ -0,0 +1,62 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ +#include "unity.h" +#include "CException.h" + +extern void setUp(void); +extern void tearDown(void); + +extern void test_BasicTryDoesNothingIfNoThrow(void); +extern void test_BasicThrowAndCatch(void); +extern void test_BasicThrowAndCatch_WithMiniSyntax(void); +extern void test_VerifyVolatilesSurviveThrowAndCatch(void); +extern void test_ThrowFromASubFunctionAndCatchInRootFunc(void); +extern void test_ThrowAndCatchFromASubFunctionAndRethrowToCatchInRootFunc(void); +extern void test_ThrowAndCatchFromASubFunctionAndNoRethrowToCatchInRootFunc(void); +extern void test_CanHaveMultipleTryBlocksInASingleFunction(void); +extern void test_CanHaveNestedTryBlocksInASingleFunction_ThrowInside(void); +extern void test_CanHaveNestedTryBlocksInASingleFunction_ThrowOutside(void); +extern void test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThisDoesntCorruptExceptionId(void); +extern void test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThatEachExceptionIdIndependent(void); + +static void runTest(UnityTestFunction test) +{ + CEXCEPTION_T e; + if (TEST_PROTECT()) + { + setUp(); + Try + { + test(); + } + Catch(e) + { + TEST_FAIL_MESSAGE("Unexpected exception!") + } + } + tearDown(); +} + + +int main(void) +{ + Unity.TestFile = __FILE__; + UnityBegin(); + + // RUN_TEST calls runTest + RUN_TEST(test_BasicTryDoesNothingIfNoThrow, 12); + RUN_TEST(test_BasicThrowAndCatch, 30); + RUN_TEST(test_BasicThrowAndCatch_WithMiniSyntax, 49); + RUN_TEST(test_VerifyVolatilesSurviveThrowAndCatch, 69); + RUN_TEST(test_ThrowFromASubFunctionAndCatchInRootFunc, 98); + RUN_TEST(test_ThrowAndCatchFromASubFunctionAndRethrowToCatchInRootFunc, 139); + RUN_TEST(test_ThrowAndCatchFromASubFunctionAndNoRethrowToCatchInRootFunc, 158); + RUN_TEST(test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThisDoesntCorruptExceptionId, 175); + RUN_TEST(test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThatEachExceptionIdIndependent, 193); + RUN_TEST(test_CanHaveMultipleTryBlocksInASingleFunction, 220); + RUN_TEST(test_CanHaveNestedTryBlocksInASingleFunction_ThrowInside, 245); + RUN_TEST(test_CanHaveNestedTryBlocksInASingleFunction_ThrowOutside, 269); + + UnityEnd(); + + return 0; +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/auto/colour_prompt.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/auto/colour_prompt.rb new file mode 100644 index 0000000..81003dd --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/auto/colour_prompt.rb @@ -0,0 +1,94 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +if RUBY_PLATFORM =~/(win|w)32$/ + begin + require 'Win32API' + rescue LoadError + puts "ERROR! \"Win32API\" library not found" + puts "\"Win32API\" is required for colour on a windows machine" + puts " try => \"gem install Win32API\" on the command line" + puts + end + # puts + # puts 'Windows Environment Detected...' + # puts 'Win32API Library Found.' + # puts +end + +class ColourCommandLine + def initialize + if RUBY_PLATFORM =~/(win|w)32$/ + get_std_handle = Win32API.new("kernel32", "GetStdHandle", ['L'], 'L') + @set_console_txt_attrb = + Win32API.new("kernel32","SetConsoleTextAttribute",['L','N'], 'I') + @hout = get_std_handle.call(-11) + end + end + + def change_to(new_colour) + if RUBY_PLATFORM =~/(win|w)32$/ + @set_console_txt_attrb.call(@hout,self.win32_colour(new_colour)) + else + "\033[30;#{posix_colour(new_colour)};22m" + end + end + + def win32_colour(colour) + case colour + when :black then 0 + when :dark_blue then 1 + when :dark_green then 2 + when :dark_cyan then 3 + when :dark_red then 4 + when :dark_purple then 5 + when :dark_yellow, :narrative then 6 + when :default_white, :default, :dark_white then 7 + when :silver then 8 + when :blue then 9 + when :green, :success then 10 + when :cyan, :output then 11 + when :red, :failure then 12 + when :purple then 13 + when :yellow then 14 + when :white then 15 + else + 0 + end + end + + def posix_colour(colour) + case colour + when :black then 30 + when :red, :failure then 31 + when :green, :success then 32 + when :yellow then 33 + when :blue, :narrative then 34 + when :purple, :magenta then 35 + when :cyan, :output then 36 + when :white, :default_white, :default then 37 + else + 30 + end + end + + def out_c(mode, colour, str) + case RUBY_PLATFORM + when /(win|w)32$/ + change_to(colour) + $stdout.puts str if mode == :puts + $stdout.print str if mode == :print + change_to(:default_white) + else + $stdout.puts("#{change_to(colour)}#{str}\033[0m") if mode == :puts + $stdout.print("#{change_to(colour)}#{str}\033[0m") if mode == :print + end + end +end # ColourCommandLine + +def colour_puts(role,str) ColourCommandLine.new.out_c(:puts, role, str) end +def colour_print(role,str) ColourCommandLine.new.out_c(:print, role, str) end + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/auto/colour_reporter.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/auto/colour_reporter.rb new file mode 100644 index 0000000..5aa1d27 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/auto/colour_reporter.rb @@ -0,0 +1,39 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require "#{File.expand_path(File.dirname(__FILE__))}/colour_prompt" + +$colour_output = true + +def report(message) + if not $colour_output + $stdout.puts(message) + else + message = message.join('\n') if (message.class == Array) + message.each_line do |line| + line.chomp! + colour = case(line) + when /(?:total\s+)?tests:?\s+(\d+)\s+(?:total\s+)?failures:?\s+\d+\s+Ignored:?/i + ($1.to_i == 0) ? :green : :red + when /PASS/ + :green + when /^OK$/ + :green + when /(?:FAIL|ERROR)/ + :red + when /IGNORE/ + :yellow + when /^(?:Creating|Compiling|Linking)/ + :white + else + :silver + end + colour_puts(colour, line) + end + end + $stdout.flush + $stderr.flush +end \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/auto/generate_config.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/auto/generate_config.yml new file mode 100644 index 0000000..4a5e474 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/auto/generate_config.yml @@ -0,0 +1,36 @@ +#this is a sample configuration file for generate_module +#you would use it by calling generate_module with the -ygenerate_config.yml option +#files like this are useful for customizing generate_module to your environment +:generate_module: + :defaults: + #these defaults are used in place of any missing options at the command line + :path_src: ../src/ + :path_inc: ../src/ + :path_tst: ../test/ + :update_svn: true + :includes: + #use [] for no additional includes, otherwise list the includes on separate lines + :src: + - Defs.h + - Board.h + :inc: [] + :tst: + - Defs.h + - Board.h + - Exception.h + :boilerplates: + #these are inserted at the top of generated files. + #just comment out or remove if not desired. + #use %1$s where you would like the file name to appear (path/extension not included) + :src: | + //------------------------------------------- + // %1$s.c + //------------------------------------------- + :inc: | + //------------------------------------------- + // %1$s.h + //------------------------------------------- + :tst: | + //------------------------------------------- + // Test%1$s.c : Units tests for %1$s.c + //------------------------------------------- diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/auto/generate_module.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/auto/generate_module.rb new file mode 100644 index 0000000..3db1a98 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/auto/generate_module.rb @@ -0,0 +1,202 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +# This script creates all the files with start code necessary for a new module. +# A simple module only requires a source file, header file, and test file. +# Triad modules require a source, header, and test file for each triad type (like model, conductor, and hardware). + +require 'rubygems' +require 'fileutils' + +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +#help text when requested +HELP_TEXT = [ "\nGENERATE MODULE\n-------- ------", + "\nUsage: ruby generate_module [options] module_name", + " -i\"include\" sets the path to output headers to 'include' (DEFAULT ../src)", + " -s\"../src\" sets the path to output source to '../src' (DEFAULT ../src)", + " -t\"C:/test\" sets the path to output source to 'C:/test' (DEFAULT ../test)", + " -p\"MCH\" sets the output pattern to MCH.", + " dh - driver hardware.", + " dih - driver interrupt hardware.", + " mch - model conductor hardware.", + " mvp - model view presenter.", + " src - just a single source module. (DEFAULT)", + " -d destroy module instead of creating it.", + " -u update subversion too (requires subversion command line)", + " -y\"my.yml\" selects a different yaml config file for module generation", + "" ].join("\n") + +#Built in patterns +PATTERNS = { 'src' => {'' => { :inc => [] } }, + 'dh' => {'Driver' => { :inc => ['%1$sHardware.h'] }, + 'Hardware' => { :inc => [] } + }, + 'dih' => {'Driver' => { :inc => ['%1$sHardware.h', '%1$sInterrupt.h'] }, + 'Interrupt'=> { :inc => ['%1$sHardware.h'] }, + 'Hardware' => { :inc => [] } + }, + 'mch' => {'Model' => { :inc => [] }, + 'Conductor'=> { :inc => ['%1$sModel.h', '%1$sHardware.h'] }, + 'Hardware' => { :inc => [] } + }, + 'mvp' => {'Model' => { :inc => [] }, + 'Presenter'=> { :inc => ['%1$sModel.h', '%1$sView.h'] }, + 'View' => { :inc => [] } + } + } + +#TEMPLATE_TST +TEMPLATE_TST = %q[#include "unity.h" +%2$s#include "%1$s.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void test_%1$s_NeedToImplement(void) +{ + TEST_IGNORE(); +} +] + +#TEMPLATE_SRC +TEMPLATE_SRC = %q[%2$s#include "%1$s.h" +] + +#TEMPLATE_INC +TEMPLATE_INC = %q[#ifndef _%3$s_H +#define _%3$s_H%2$s + +#endif // _%3$s_H +] + +# Parse the command line parameters. +ARGV.each do |arg| + case(arg) + when /^-d/ then @destroy = true + when /^-u/ then @update_svn = true + when /^-p(\w+)/ then @pattern = $1 + when /^-s(.+)/ then @path_src = $1 + when /^-i(.+)/ then @path_inc = $1 + when /^-t(.+)/ then @path_tst = $1 + when /^-y(.+)/ then @yaml_config = $1 + when /^(\w+)/ + raise "ERROR: You can't have more than one Module name specified!" unless @module_name.nil? + @module_name = arg + when /^-(h|-help)/ + puts HELP_TEXT + exit + else + raise "ERROR: Unknown option specified '#{arg}'" + end +end +raise "ERROR: You must have a Module name specified! (use option -h for help)" if @module_name.nil? + +#load yaml file if one was requested +if @yaml_config + require 'yaml' + cfg = YAML.load_file(HERE + @yaml_config)[:generate_module] + @path_src = cfg[:defaults][:path_src] if @path_src.nil? + @path_inc = cfg[:defaults][:path_inc] if @path_inc.nil? + @path_tst = cfg[:defaults][:path_tst] if @path_tst.nil? + @update_svn = cfg[:defaults][:update_svn] if @update_svn.nil? + @extra_inc = cfg[:includes] + @boilerplates = cfg[:boilerplates] +else + @boilerplates = {} +end + +# Create default file paths if none were provided +@path_src = HERE + "../src/" if @path_src.nil? +@path_inc = @path_src if @path_inc.nil? +@path_tst = HERE + "../test/" if @path_tst.nil? +@path_src += '/' unless (@path_src[-1] == 47) +@path_inc += '/' unless (@path_inc[-1] == 47) +@path_tst += '/' unless (@path_tst[-1] == 47) +@pattern = 'src' if @pattern.nil? +@includes = { :src => [], :inc => [], :tst => [] } +@includes.merge!(@extra_inc) unless @extra_inc.nil? + +#create triad definition +TRIAD = [ { :ext => '.c', :path => @path_src, :template => TEMPLATE_SRC, :inc => :src, :boilerplate => @boilerplates[:src] }, + { :ext => '.h', :path => @path_inc, :template => TEMPLATE_INC, :inc => :inc, :boilerplate => @boilerplates[:inc] }, + { :ext => '.c', :path => @path_tst+'Test', :template => TEMPLATE_TST, :inc => :tst, :boilerplate => @boilerplates[:tst] }, + ] + +#prepare the pattern for use +@patterns = PATTERNS[@pattern.downcase] +raise "ERROR: The design pattern specified isn't one that I recognize!" if @patterns.nil? + +# Assemble the path/names of the files we need to work with. +files = [] +TRIAD.each do |triad| + @patterns.each_pair do |pattern_file, pattern_traits| + files << { + :path => "#{triad[:path]}#{@module_name}#{pattern_file}#{triad[:ext]}", + :name => "#{@module_name}#{pattern_file}", + :template => triad[:template], + :boilerplate => triad[:boilerplate], + :includes => case(triad[:inc]) + when :src then @includes[:src] | pattern_traits[:inc].map{|f| f % [@module_name]} + when :inc then @includes[:inc] + when :tst then @includes[:tst] | pattern_traits[:inc].map{|f| "Mock#{f}"% [@module_name]} + end + } + end +end + +# destroy files if that was what was requested +if @destroy + files.each do |filespec| + file = filespec[:path] + if File.exist?(file) + if @update_svn + `svn delete \"#{file}\" --force` + puts "File #{file} deleted and removed from source control" + else + FileUtils.remove(file) + puts "File #{file} deleted" + end + else + puts "File #{file} does not exist so cannot be removed." + end + end + puts "Destroy Complete" + exit +end + +#Abort if any module already exists +files.each do |file| + raise "ERROR: File #{file[:name]} already exists. Exiting." if File.exist?(file[:path]) +end + +# Create Source Modules +files.each_with_index do |file, i| + File.open(file[:path], 'w') do |f| + f.write(file[:boilerplate] % [file[:name]]) unless file[:boilerplate].nil? + f.write(file[:template] % [ file[:name], + file[:includes].map{|f| "#include \"#{f}\"\n"}.join, + file[:name].upcase ] + ) + end + if (@update_svn) + `svn add \"#{file[:path]}\"` + if $?.exitstatus == 0 + puts "File #{file[:path]} created and added to source control" + else + puts "File #{file[:path]} created but FAILED adding to source control!" + end + else + puts "File #{file[:path]} created" + end +end + +puts 'Generate Complete' diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb new file mode 100644 index 0000000..aff5053 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb @@ -0,0 +1,303 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +File.expand_path(File.join(File.dirname(__FILE__),'colour_prompt')) + +class UnityTestRunnerGenerator + + def initialize(options = nil) + @options = { :includes => [], :plugins => [], :framework => :unity } + case(options) + when NilClass then @options + when String then @options.merge!(UnityTestRunnerGenerator.grab_config(options)) + when Hash then @options.merge!(options) + else raise "If you specify arguments, it should be a filename or a hash of options" + end + end + + def self.grab_config(config_file) + options = { :includes => [], :plugins => [], :framework => :unity } + unless (config_file.nil? or config_file.empty?) + require 'yaml' + yaml_guts = YAML.load_file(config_file) + options.merge!(yaml_guts[:unity] ? yaml_guts[:unity] : yaml_guts[:cmock]) + raise "No :unity or :cmock section found in #{config_file}" unless options + end + return(options) + end + + def run(input_file, output_file, options=nil) + tests = [] + includes = [] + used_mocks = [] + + @options.merge!(options) unless options.nil? + module_name = File.basename(input_file) + + #pull required data from source file + File.open(input_file, 'r') do |input| + tests = find_tests(input) + includes = find_includes(input) + used_mocks = find_mocks(includes) + end + + #build runner file + File.open(output_file, 'w') do |output| + create_header(output, used_mocks) + create_externs(output, tests, used_mocks) + create_mock_management(output, used_mocks) + create_suite_setup_and_teardown(output) + create_reset(output, used_mocks) + create_main(output, input_file, tests) + end + + all_files_used = [input_file, output_file] + all_files_used += includes.map {|filename| filename + '.c'} unless includes.empty? + all_files_used += @options[:includes] unless @options[:includes].empty? + return all_files_used.uniq + end + + def find_tests(input_file) + tests_raw = [] + tests_args = [] + tests_and_line_numbers = [] + + input_file.rewind + source_raw = input_file.read + source_scrubbed = source_raw.gsub(/\/\/.*$/, '') # remove line comments + source_scrubbed = source_scrubbed.gsub(/\/\*.*?\*\//m, '') # remove block comments + lines = source_scrubbed.split(/(^\s*\#.*$) # Treat preprocessor directives as a logical line + | (;|\{|\}) /x) # Match ;, {, and } as end of lines + + lines.each_with_index do |line, index| + #find tests + if line =~ /^((?:\s*TEST_CASE\s*\(.*?\)\s*)*)\s*void\s+(test.*?)\s*\(\s*(.*)\s*\)/ + arguments = $1 + name = $2 + call = $3 + args = nil + if (@options[:use_param_tests] and !arguments.empty?) + args = [] + arguments.scan(/\s*TEST_CASE\s*\((.*)\)\s*$/) {|a| args << a[0]} + end + tests_and_line_numbers << { :name => name, :args => args, :call => call, :line_number => 0 } + tests_args = [] + end + end + + #determine line numbers and create tests to run + source_lines = source_raw.split("\n") + source_index = 0; + tests_and_line_numbers.size.times do |i| + source_lines[source_index..-1].each_with_index do |line, index| + if (line =~ /#{tests_and_line_numbers[i][:name]}/) + source_index += index + tests_and_line_numbers[i][:line_number] = source_index + 1 + break + end + end + end + + return tests_and_line_numbers + end + + def find_includes(input_file) + input_file.rewind + includes = [] + input_file.readlines.each do |line| + scan_results = line.scan(/^\s*#include\s+\"\s*(.+)\.[hH]\s*\"/) + includes << scan_results[0][0] if (scan_results.size > 0) + end + return includes + end + + def find_mocks(includes) + mock_headers = [] + includes.each do |include_file| + mock_headers << File.basename(include_file) if (include_file =~ /^mock/i) + end + return mock_headers + end + + def create_header(output, mocks) + output.puts('/* AUTOGENERATED FILE. DO NOT EDIT. */') + create_runtest(output, mocks) + output.puts("\n//=======Automagically Detected Files To Include=====") + output.puts("#include \"#{@options[:framework].to_s}.h\"") + output.puts('#include "cmock.h"') unless (mocks.empty?) + @options[:includes].flatten.uniq.compact.each do |inc| + output.puts("#include #{inc.include?('<') ? inc : "\"#{inc.gsub('.h','')}.h\""}") + end + output.puts('#include ') + output.puts('#include ') + output.puts('#include "CException.h"') if @options[:plugins].include?(:cexception) + mocks.each do |mock| + output.puts("#include \"#{mock.gsub('.h','')}.h\"") + end + if @options[:enforce_strict_ordering] + output.puts('') + output.puts('int GlobalExpectCount;') + output.puts('int GlobalVerifyOrder;') + output.puts('char* GlobalOrderError;') + end + end + + def create_externs(output, tests, mocks) + output.puts("\n//=======External Functions This Runner Calls=====") + output.puts("extern void setUp(void);") + output.puts("extern void tearDown(void);") + tests.each do |test| + output.puts("extern void #{test[:name]}(#{test[:call]});") + end + output.puts('') + end + + def create_mock_management(output, mocks) + unless (mocks.empty?) + output.puts("\n//=======Mock Management=====") + output.puts("static void CMock_Init(void)") + output.puts("{") + if @options[:enforce_strict_ordering] + output.puts(" GlobalExpectCount = 0;") + output.puts(" GlobalVerifyOrder = 0;") + output.puts(" GlobalOrderError = NULL;") + end + mocks.each do |mock| + output.puts(" #{mock}_Init();") + end + output.puts("}\n") + + output.puts("static void CMock_Verify(void)") + output.puts("{") + mocks.each do |mock| + output.puts(" #{mock}_Verify();") + end + output.puts("}\n") + + output.puts("static void CMock_Destroy(void)") + output.puts("{") + mocks.each do |mock| + output.puts(" #{mock}_Destroy();") + end + output.puts("}\n") + end + end + + def create_suite_setup_and_teardown(output) + unless (@options[:suite_setup].nil?) + output.puts("\n//=======Suite Setup=====") + output.puts("static int suite_setup(void)") + output.puts("{") + output.puts(@options[:suite_setup]) + output.puts("}") + end + unless (@options[:suite_teardown].nil?) + output.puts("\n//=======Suite Teardown=====") + output.puts("static int suite_teardown(int num_failures)") + output.puts("{") + output.puts(@options[:suite_teardown]) + output.puts("}") + end + end + + def create_runtest(output, used_mocks) + cexception = @options[:plugins].include? :cexception + va_args1 = @options[:use_param_tests] ? ', ...' : '' + va_args2 = @options[:use_param_tests] ? '__VA_ARGS__' : '' + output.puts("\n//=======Test Runner Used To Run Each Test Below=====") + output.puts("#define RUN_TEST_NO_ARGS") if @options[:use_param_tests] + output.puts("#define RUN_TEST(TestFunc, TestLineNum#{va_args1}) \\") + output.puts("{ \\") + output.puts(" Unity.CurrentTestName = #TestFunc#{va_args2.empty? ? '' : " \"(\" ##{va_args2} \")\""}; \\") + output.puts(" Unity.CurrentTestLineNumber = TestLineNum; \\") + output.puts(" Unity.NumberOfTests++; \\") + output.puts(" if (TEST_PROTECT()) \\") + output.puts(" { \\") + output.puts(" CEXCEPTION_T e; \\") if cexception + output.puts(" Try { \\") if cexception + output.puts(" CMock_Init(); \\") unless (used_mocks.empty?) + output.puts(" setUp(); \\") + output.puts(" TestFunc(#{va_args2}); \\") + output.puts(" CMock_Verify(); \\") unless (used_mocks.empty?) + output.puts(" } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, \"Unhandled Exception!\"); } \\") if cexception + output.puts(" } \\") + output.puts(" CMock_Destroy(); \\") unless (used_mocks.empty?) + output.puts(" if (TEST_PROTECT() && !TEST_IS_IGNORED) \\") + output.puts(" { \\") + output.puts(" tearDown(); \\") + output.puts(" } \\") + output.puts(" UnityConcludeTest(); \\") + output.puts("}\n") + end + + def create_reset(output, used_mocks) + output.puts("\n//=======Test Reset Option=====") + output.puts("void resetTest()") + output.puts("{") + output.puts(" CMock_Verify();") unless (used_mocks.empty?) + output.puts(" CMock_Destroy();") unless (used_mocks.empty?) + output.puts(" tearDown();") + output.puts(" CMock_Init();") unless (used_mocks.empty?) + output.puts(" setUp();") + output.puts("}") + end + + def create_main(output, filename, tests) + output.puts("\n\n//=======MAIN=====") + output.puts("int main(void)") + output.puts("{") + output.puts(" suite_setup();") unless @options[:suite_setup].nil? + output.puts(" Unity.TestFile = \"#{filename}\";") + output.puts(" UnityBegin();") + if (@options[:use_param_tests]) + tests.each do |test| + if ((test[:args].nil?) or (test[:args].empty?)) + output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]}, RUN_TEST_NO_ARGS);") + else + test[:args].each {|args| output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]}, #{args});")} + end + end + else + tests.each { |test| output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]});") } + end + output.puts() + output.puts(" return #{@options[:suite_teardown].nil? ? "" : "suite_teardown"}(UnityEnd());") + output.puts("}") + end +end + + +if ($0 == __FILE__) + options = { :includes => [] } + yaml_file = nil + + #parse out all the options first + ARGV.reject! do |arg| + case(arg) + when '-cexception' + options[:plugins] = [:cexception]; true + when /\.*\.yml/ + options = UnityTestRunnerGenerator.grab_config(arg); true + else false + end + end + + #make sure there is at least one parameter left (the input file) + if !ARGV[0] + puts ["usage: ruby #{__FILE__} (yaml) (options) input_test_file output_test_runner (includes)", + " blah.yml - will use config options in the yml file (see docs)", + " -cexception - include cexception support"].join("\n") + exit 1 + end + + #create the default test runner name if not specified + ARGV[1] = ARGV[0].gsub(".c","_Runner.c") if (!ARGV[1]) + + #everything else is an include file + options[:includes] ||= (ARGV.slice(2..-1).flatten.compact) if (ARGV.size > 2) + + UnityTestRunnerGenerator.new(options).run(ARGV[0], ARGV[1]) +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/auto/test_file_filter.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/auto/test_file_filter.rb new file mode 100644 index 0000000..3dbc26a --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/auto/test_file_filter.rb @@ -0,0 +1,23 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require'yaml' + +module RakefileHelpers + class TestFileFilter + def initialize(all_files = false) + @all_files = all_files + if not @all_files == true + if File.exist?('test_file_filter.yml') + filters = YAML.load_file( 'test_file_filter.yml' ) + @all_files, @only_files, @exclude_files = + filters[:all_files], filters[:only_files], filters[:exclude_files] + end + end + end + attr_accessor :all_files, :only_files, :exclude_files + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/auto/unity_test_summary.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/auto/unity_test_summary.rb new file mode 100644 index 0000000..69ec2e8 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/auto/unity_test_summary.rb @@ -0,0 +1,126 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +#!/usr/bin/ruby +# +# unity_test_summary.rb +# +require 'fileutils' +require 'set' + +class UnityTestSummary + include FileUtils::Verbose + + attr_reader :report, :total_tests, :failures, :ignored + + def initialize + @report = '' + @total_tests = 0 + @failures = 0 + @ignored = 0 + end + + def run + # Clean up result file names + results = @targets.map {|target| target.gsub(/\\/,'/')} + + # Dig through each result file, looking for details on pass/fail: + failure_output = [] + ignore_output = [] + + results.each do |result_file| + lines = File.readlines(result_file).map { |line| line.chomp } + if lines.length == 0 + raise "Empty test result file: #{result_file}" + else + output = get_details(result_file, lines) + failure_output << output[:failures] unless output[:failures].empty? + ignore_output << output[:ignores] unless output[:ignores].empty? + tests,failures,ignored = parse_test_summary(lines) + @total_tests += tests + @failures += failures + @ignored += ignored + end + end + + if @ignored > 0 + @report += "\n" + @report += "--------------------------\n" + @report += "UNITY IGNORED TEST SUMMARY\n" + @report += "--------------------------\n" + @report += ignore_output.flatten.join("\n") + end + + if @failures > 0 + @report += "\n" + @report += "--------------------------\n" + @report += "UNITY FAILED TEST SUMMARY\n" + @report += "--------------------------\n" + @report += failure_output.flatten.join("\n") + end + + @report += "\n" + @report += "--------------------------\n" + @report += "OVERALL UNITY TEST SUMMARY\n" + @report += "--------------------------\n" + @report += "#{@total_tests} TOTAL TESTS #{@failures} TOTAL FAILURES #{@ignored} IGNORED\n" + @report += "\n" + end + + def set_targets(target_array) + @targets = target_array + end + + def set_root_path(path) + @root = path + end + + def usage(err_msg=nil) + puts err_msg if err_msg + puts "Usage: unity_test_summary.rb" + exit 1 + end + + protected + + @@targets=nil + @@path=nil + @@root=nil + + def get_details(result_file, lines) + results = { :failures => [], :ignores => [], :successes => [] } + lines.each do |line| + src_file,src_line,test_name,status,msg = line.split(/:/) + line_out = ((@root and (@root != 0)) ? "#{@root}#{line}" : line ).gsub(/\//, "\\") + case(status) + when 'IGNORE' then results[:ignores] << line_out + when 'FAIL' then results[:failures] << line_out + when 'PASS' then results[:successes] << line_out + end + end + return results + end + + def parse_test_summary(summary) + if summary[-3..-1].join("\n") =~ /(\d+) Tests (\d+) Failures (\d+) Ignored/ + [$1.to_i,$2.to_i,$3.to_i] + else + raise "Couldn't parse test results: #{summary}" + end + end + + def here; File.expand_path(File.dirname(__FILE__)); end + +end + +if $0 == __FILE__ + script = UnityTestSummary.new + begin + script.run + rescue Exception => e + script.usage e.message + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/docs/Unity Summary.odt b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/docs/Unity Summary.odt new file mode 100644 index 0000000..f699661 Binary files /dev/null and b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/docs/Unity Summary.odt differ diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/docs/Unity Summary.pdf b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/docs/Unity Summary.pdf new file mode 100644 index 0000000..ad1a956 Binary files /dev/null and b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/docs/Unity Summary.pdf differ diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/docs/Unity Summary.txt b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/docs/Unity Summary.txt new file mode 100644 index 0000000..e0b179d --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/docs/Unity Summary.txt @@ -0,0 +1,217 @@ +============== +Unity Test API +============== + +[Copyright (c) 2007 - Unity Project by Mike Karlesky, Mark VanderVoord, and Greg Williams] + +------------- +Running Tests +------------- + +RUN_TEST(func, linenum) + +Each Test is run within the macro RUN_TEST. This macro performs necessary setup before the test is called and handles cleanup and result tabulation afterwards. + +-------------- +Ignoring Tests +-------------- + +There are times when a test is incomplete or not valid for some reason. At these times, TEST_IGNORE can be called. Control will immediately be returned to the caller of the test, and no failures will be returned. + +TEST_IGNORE() + +Ignore this test and return immediately + +TEST_IGNORE_MESSAGE (message) + +Ignore this test and return immediately. Output a message stating why the test was ignored. + +-------------- +Aborting Tests +-------------- + +There are times when a test will contain an infinite loop on error conditions, or there may be reason to escape from the test early without executing the rest of the test. A pair of macros support this functionality in Unity. The first (TEST_PROTECT) sets up the feature, and handles emergency abort cases. TEST_ABORT can then be used at any time within the tests to return to the last TEST_PROTECT call. + +TEST_PROTECT() + +Setup and Catch macro + +TEST_ABORT() + +Abort Test macro + +Example: + +main() +{ + if (TEST_PROTECT() == 0) + { + MyTest(); + } +} + +If MyTest calls TEST_ABORT, program control will immediately return to TEST_PROTECT with a non-zero return value. + + +======================= +Unity Assertion Summary +======================= + +-------------------- +Basic Validity Tests +-------------------- + +TEST_ASSERT_TRUE(condition) + +Evaluates whatever code is in condition and fails if it evaluates to false + +TEST_ASSERT_FALSE(condition) + +Evaluates whatever code is in condition and fails if it evaluates to true + +TEST_ASSERT(condition) + +Another way of calling TEST_ASSERT_TRUE + +TEST_ASSERT_UNLESS(condition) + +Another way of calling TEST_ASSERT_FALSE + +TEST_FAIL() +TEST_FAIL_MESSAGE(message) + +This test is automatically marked as a failure. The message is output stating why. + +------------------------------ +Numerical Assertions: Integers +------------------------------ + +TEST_ASSERT_EQUAL_INT(expected, actual) +TEST_ASSERT_EQUAL_INT8(expected, actual) +TEST_ASSERT_EQUAL_INT16(expected, actual) +TEST_ASSERT_EQUAL_INT32(expected, actual) +TEST_ASSERT_EQUAL_INT64(expected, actual) + +Compare two integers for equality and display errors as signed integers. A cast will be performed +to your natural integer size so often this can just be used. When you need to specify the exact size, +like when comparing arrays, you can use a specific version: + + + +TEST_ASSERT_EQUAL_UINT(expected, actual) + +Compare two integers for equality and display errors as unsigned integers. Like INT, there are +variants for different sizes also. + + + +TEST_ASSERT_EQUAL_HEX(expected, actual) + +Compares two integers for equality and display errors as hexadecimal. Like the other integer comparisons, +you can specify the size... here the size will also effect how many nibbles are shown (for example, HEX16 +will show 4 nibbles). + +_ARRAY + +You can append _ARRAY to any of these macros to make an array comparison of that type. Here you will +need to care a bit more about the actual size of the value being checked. You will also specify an +additional argument which is the number of elements to compare. For example: + +TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, elements) + + +TEST_ASSERT_EQUAL(expected, actual) + +Another way of calling TEST_ASSERT_EQUAL_INT + + + +TEST_ASSERT_INT_WITHIN(delta, expected, actual) + +Asserts that the actual value is within plus or minus delta of the expected value. This also comes in +size specific variants. + + +----------------------------- +Numerical Assertions: Bitwise +----------------------------- + +TEST_ASSERT_BITS(mask, expected, actual) + +Use an integer mask to specify which bits should be compared between two other integers. High bits in the mask are compared, low bits ignored. + +TEST_ASSERT_BITS_HIGH(mask, actual) + +Use an integer mask to specify which bits should be inspected to determine if they are all set high. High bits in the mask are compared, low bits ignored. + +TEST_ASSERT_BITS_LOW(mask, actual) + +Use an integer mask to specify which bits should be inspected to determine if they are all set low. High bits in the mask are compared, low bits ignored. + +TEST_ASSERT_BIT_HIGH(bit, actual) + +Test a single bit and verify that it is high. The bit is specified 0-31 for a 32-bit integer. + +TEST_ASSERT_BIT_LOW(bit, actual) + +Test a single bit and verify that it is low. The bit is specified 0-31 for a 32-bit integer. + +---------------------------- +Numerical Assertions: Floats +---------------------------- + +TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual) + +Asserts that the actual value is within plus or minus delta of the expected value. + +TEST_ASSERT_EQUAL_FLOAT(expected, actual) + +Asserts that two floating point values are "equal" within a small % delta of the expected value. + +----------------- +String Assertions +----------------- + +TEST_ASSERT_EQUAL_STRING(expected, actual) + +Compare two null-terminate strings. Fail if any character is different or if the lengths are different. + +TEST_ASSERT_EQUAL_STRING_MESSAGE(expected, actual, message) + +Compare two null-terminate strings. Fail if any character is different or if the lengths are different. Output a custom message on failure. + +------------------ +Pointer Assertions +------------------ + +Most pointer operations can be performed by simply using the integer comparisons above. However, a couple of special cases are added for clarity. + +TEST_ASSERT_NULL(pointer) + +Fails if the pointer is not equal to NULL + +TEST_ASSERT_NOT_NULL(pointer) + +Fails if the pointer is equal to NULL + + +----------------- +Memory Assertions +----------------- + +TEST_ASSERT_EQUAL_MEMORY(expected, actual, len) + +Compare two blocks of memory. This is a good generic assertion for types that can't be coerced into acting like +standard types... but since it's a memory compare, you have to be careful that your data types are packed. + +-------- +_MESSAGE +-------- + +you can append _MESSAGE to any of the macros to make them take an additional argument. This argument +is a string that will be printed at the end of the failure strings. This is useful for specifying more +information about the problem. + + + + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/docs/license.txt b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/docs/license.txt new file mode 100644 index 0000000..c42e330 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/docs/license.txt @@ -0,0 +1,31 @@ + Copyright (c) 2007-2010 Mike Karlesky, Mark VanderVoord, Greg Williams + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + The end-user documentation included with the redistribution, if + any, must include the following acknowledgment: "This product + includes software developed for the Unity Project, by Mike Karlesky, + Mark VanderVoord, and Greg Williams and other contributors", in + the same place and form as other third-party acknowledgments. + Alternately, this acknowledgment may appear in the software + itself, in the same form and location as other such third-party + acknowledgments. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.c new file mode 100644 index 0000000..9cf42c6 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.c @@ -0,0 +1,10 @@ +#include "unity.h" +#include "UnityHelper.h" +#include +#include + +void AssertEqualExampleStruct(const EXAMPLE_STRUCT_T expected, const EXAMPLE_STRUCT_T actual, const unsigned short line) +{ + UNITY_TEST_ASSERT_EQUAL_INT(expected.x, actual.x, line, "Example Struct Failed For Field x"); + UNITY_TEST_ASSERT_EQUAL_INT(expected.y, actual.y, line, "Example Struct Failed For Field y"); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.h b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.h new file mode 100644 index 0000000..1516111 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.h @@ -0,0 +1,12 @@ +#ifndef _TESTHELPER_H +#define _TESTHELPER_H + +#include "Types.h" + +void AssertEqualExampleStruct(const EXAMPLE_STRUCT_T expected, const EXAMPLE_STRUCT_T actual, const unsigned short line); + +#define UNITY_TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(expected, actual, line, message) AssertEqualExampleStruct(expected, actual, line); + +#define TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(expected, actual) UNITY_TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(expected, actual, __LINE__, NULL); + +#endif // _TESTHELPER_H diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/examples/makefile b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/examples/makefile new file mode 100644 index 0000000..723d390 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/examples/makefile @@ -0,0 +1,40 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +C_COMPILER=gcc +TARGET_BASE1=test1 +TARGET_BASE2=test2 +ifeq ($(OS),Windows_NT) + TARGET_EXTENSION=.exe +else + TARGET_EXTENSION=.out +endif +TARGET1 = $(TARGET_BASE1)$(TARGET_EXTENSION) +TARGET2 = $(TARGET_BASE2)$(TARGET_EXTENSION) +SRC_FILES1=../src/unity.c src/ProductionCode.c test/TestProductionCode.c test/no_ruby/TestProductionCode_Runner.c +SRC_FILES2=../src/unity.c src/ProductionCode2.c test/TestProductionCode2.c test/no_ruby/TestProductionCode2_Runner.c +INC_DIRS=-Isrc -I../src +SYMBOLS=-DTEST + +ifeq ($(OS),Windows_NT) + CLEANUP = del /F /Q build\* && del /F /Q $(TARGET1) && del /F /Q $(TARGET2) +else + CLEANUP = rm -f build/*.o ; rm -f $(TARGET1) ; rm -f $(TARGET2) +endif + +all: clean default + +default: +# ruby auto/generate_test_runner.rb test/TestProductionCode.c test/no_ruby/TestProductionCode_Runner.c +# ruby auto/generate_test_runner.rb test/TestProductionCode2.c test/no_ruby/TestProductionCode2_Runner.c + $(C_COMPILER) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES1) -o $(TARGET1) + $(C_COMPILER) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES2) -o $(TARGET2) + $(TARGET1) + $(TARGET2) + +clean: + $(CLEANUP) + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/examples/rakefile.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/examples/rakefile.rb new file mode 100644 index 0000000..0905b4b --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/examples/rakefile.rb @@ -0,0 +1,32 @@ +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require HERE+'rakefile_helper' + +include RakefileHelpers + +# Load default configuration, for now +DEFAULT_CONFIG_FILE = 'gcc.yml' +configure_toolchain(DEFAULT_CONFIG_FILE) + +task :unit do + run_tests get_unit_test_files +end + +desc "Generate test summary" +task :summary do + report_summary +end + +desc "Build and test Unity" +task :all => [:clean, :unit, :summary] +task :default => [:clobber, :all] +task :ci => [:default] +task :cruise => [:default] + +desc "Load configuration" +task :config, :config_file do |t, args| + configure_toolchain(args[:config_file]) +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/examples/rakefile_helper.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/examples/rakefile_helper.rb new file mode 100644 index 0000000..0127d69 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/examples/rakefile_helper.rb @@ -0,0 +1,260 @@ +require 'yaml' +require 'fileutils' +require HERE+'../auto/unity_test_summary' +require HERE+'../auto/generate_test_runner' +require HERE+'../auto/colour_reporter' + +module RakefileHelpers + + C_EXTENSION = '.c' + + def load_configuration(config_file) + $cfg_file = "../targets/#{config_file}" + $cfg = YAML.load(File.read($cfg_file)) + end + + def configure_clean + CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil? + end + + def configure_toolchain(config_file=DEFAULT_CONFIG_FILE) + config_file += '.yml' unless config_file =~ /\.yml$/ + load_configuration('../targets/'+config_file) + configure_clean + end + + def get_unit_test_files + path = $cfg['compiler']['unit_tests_path'] + 'Test*' + C_EXTENSION + path.gsub!(/\\/, '/') + FileList.new(path) + end + + def get_local_include_dirs + include_dirs = $cfg['compiler']['includes']['items'].dup + include_dirs.delete_if {|dir| dir.is_a?(Array)} + return include_dirs + end + + def extract_headers(filename) + includes = [] + lines = File.readlines(filename) + lines.each do |line| + m = line.match(/^\s*#include\s+\"\s*(.+\.[hH])\s*\"/) + if not m.nil? + includes << m[1] + end + end + return includes + end + + def find_source_file(header, paths) + paths.each do |dir| + src_file = dir + header.ext(C_EXTENSION) + if (File.exists?(src_file)) + return src_file + end + end + return nil + end + + def tackit(strings) + if strings.is_a?(Array) + result = "\"#{strings.join}\"" + else + result = strings + end + return result + end + + def squash(prefix, items) + result = '' + items.each { |item| result += " #{prefix}#{tackit(item)}" } + return result + end + + def build_compiler_fields + command = tackit($cfg['compiler']['path']) + if $cfg['compiler']['defines']['items'].nil? + defines = '' + else + defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items']) + end + options = squash('', $cfg['compiler']['options']) + includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :defines => defines, :options => options, :includes => includes} + end + + def compile(file, defines=[]) + compiler = build_compiler_fields + cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{file} " + + "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" + + "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" + execute(cmd_str) + end + + def build_linker_fields + command = tackit($cfg['linker']['path']) + if $cfg['linker']['options'].nil? + options = '' + else + options = squash('', $cfg['linker']['options']) + end + if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?) + includes = '' + else + includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) + end + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :options => options, :includes => includes} + end + + def link(exe_name, obj_list) + linker = build_linker_fields + cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + + (obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).join + + $cfg['linker']['bin_files']['prefix'] + ' ' + + $cfg['linker']['bin_files']['destination'] + + exe_name + $cfg['linker']['bin_files']['extension'] + execute(cmd_str) + end + + def build_simulator_fields + return nil if $cfg['simulator'].nil? + if $cfg['simulator']['path'].nil? + command = '' + else + command = (tackit($cfg['simulator']['path']) + ' ') + end + if $cfg['simulator']['pre_support'].nil? + pre_support = '' + else + pre_support = squash('', $cfg['simulator']['pre_support']) + end + if $cfg['simulator']['post_support'].nil? + post_support = '' + else + post_support = squash('', $cfg['simulator']['post_support']) + end + return {:command => command, :pre_support => pre_support, :post_support => post_support} + end + + def execute(command_string, verbose=true, raise_on_fail=true) + report command_string + output = `#{command_string}`.chomp + report(output) if (verbose && !output.nil? && (output.length > 0)) + if (($?.exitstatus != 0) and (raise_on_fail)) + raise "Command failed. (Returned #{$?.exitstatus})" + end + return output + end + + def report_summary + summary = UnityTestSummary.new + summary.set_root_path(HERE) + results_glob = "#{$cfg['compiler']['build_path']}*.test*" + results_glob.gsub!(/\\/, '/') + results = Dir[results_glob] + summary.set_targets(results) + summary.run + fail_out "FAIL: There were failures" if (summary.failures > 0) + end + + def run_tests(test_files) + + report 'Running system tests...' + + # Tack on TEST define for compiling unit tests + load_configuration($cfg_file) + test_defines = ['TEST'] + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + $cfg['compiler']['defines']['items'] << 'TEST' + + include_dirs = get_local_include_dirs + + # Build and execute each unit test + test_files.each do |test| + obj_list = [] + + # Detect dependencies and build required required modules + extract_headers(test).each do |header| + # Compile corresponding source file if it exists + src_file = find_source_file(header, include_dirs) + if !src_file.nil? + compile(src_file, test_defines) + obj_list << header.ext($cfg['compiler']['object_files']['extension']) + end + end + + # Build the test runner (generate if configured to do so) + test_base = File.basename(test, C_EXTENSION) + runner_name = test_base + '_Runner.c' + if $cfg['compiler']['runner_path'].nil? + runner_path = $cfg['compiler']['build_path'] + runner_name + test_gen = UnityTestRunnerGenerator.new($cfg_file) + test_gen.run(test, runner_path) + else + runner_path = $cfg['compiler']['runner_path'] + runner_name + end + + compile(runner_path, test_defines) + obj_list << runner_name.ext($cfg['compiler']['object_files']['extension']) + + # Build the test module + compile(test, test_defines) + obj_list << test_base.ext($cfg['compiler']['object_files']['extension']) + + # Link the test executable + link(test_base, obj_list) + + # Execute unit test and generate results file + simulator = build_simulator_fields + executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] + if simulator.nil? + cmd_str = executable + else + cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" + end + output = execute(cmd_str, true, false) + test_results = $cfg['compiler']['build_path'] + test_base + if output.match(/OK$/m).nil? + test_results += '.testfail' + else + test_results += '.testpass' + end + File.open(test_results, 'w') { |f| f.print output } + end + end + + def build_application(main) + + report "Building application..." + + obj_list = [] + load_configuration($cfg_file) + main_path = $cfg['compiler']['source_path'] + main + C_EXTENSION + + # Detect dependencies and build required required modules + include_dirs = get_local_include_dirs + extract_headers(main_path).each do |header| + src_file = find_source_file(header, include_dirs) + if !src_file.nil? + compile(src_file) + obj_list << header.ext($cfg['compiler']['object_files']['extension']) + end + end + + # Build the main source file + main_base = File.basename(main_path, C_EXTENSION) + compile(main_path) + obj_list << main_base.ext($cfg['compiler']['object_files']['extension']) + + # Create the executable + link(main_base, obj_list) + end + + def fail_out(msg) + puts msg + exit(-1) + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/examples/readme.txt b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/examples/readme.txt new file mode 100644 index 0000000..6c7780e --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/examples/readme.txt @@ -0,0 +1,18 @@ +Example Project + +This example project gives an example of some passing, ignored, and failing tests. +It's simple and meant for you to look over and get an idea for what all of this stuff does. + +You can build and test using the makefile if you have gcc installed (you may need to tweak +the locations of some tools in the makefile). Otherwise, the rake version will let you +test with gcc or a couple versions of IAR. You can tweak the yaml files to get those versions +running. + +Ruby is required if you're using the rake version (obviously). This version shows off most of +Unity's advanced features (automatically creating test runners, fancy summaries, etc.) + +The makefile version doesn't require anything outside of your normal build tools, but won't do the +extras for you. So that you can test right away, we've written the test runners for you and +put them in the test\no_ruby subdirectory. If you make changes to the tests or source, you might +need to update these (like when you add or remove tests). Do that for a while and you'll learn +why you really want to start using the Ruby tools. \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/examples/src/ProductionCode.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/examples/src/ProductionCode.c new file mode 100644 index 0000000..500b44b --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/examples/src/ProductionCode.c @@ -0,0 +1,24 @@ + +#include "ProductionCode.h" + +int Counter = 0; +int NumbersToFind[9] = { 0, 34, 55, 66, 32, 11, 1, 77, 888 }; //some obnoxious array to search that is 1-based indexing instead of 0. + +// This function is supposed to search through NumbersToFind and find a particular number. +// If it finds it, the index is returned. Otherwise 0 is returned which sorta makes sense since +// NumbersToFind is indexed from 1. Unfortunately it's broken +// (and should therefore be caught by our tests) +int FindFunction_WhichIsBroken(int NumberToFind) +{ + int i = 0; + while (i <= 8) //Notice I should have been in braces + i++; + if (NumbersToFind[i] == NumberToFind) //Yikes! I'm getting run after the loop finishes instead of during it! + return i; + return 0; +} + +int FunctionWhichReturnsLocalVariable(void) +{ + return Counter; +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/examples/src/ProductionCode.h b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/examples/src/ProductionCode.h new file mode 100644 index 0000000..250ca0d --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/examples/src/ProductionCode.h @@ -0,0 +1,3 @@ + +int FindFunction_WhichIsBroken(int NumberToFind); +int FunctionWhichReturnsLocalVariable(void); diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/examples/src/ProductionCode2.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/examples/src/ProductionCode2.c new file mode 100644 index 0000000..a8c72e1 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/examples/src/ProductionCode2.c @@ -0,0 +1,9 @@ + +#include "ProductionCode2.h" + +char* ThisFunctionHasNotBeenTested(int Poor, char* LittleFunction) +{ + //Since There Are No Tests Yet, This Function Could Be Empty For All We Know. + // Which isn't terribly useful... but at least we put in a TEST_IGNORE so we won't forget + return (char*)0; +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/examples/src/ProductionCode2.h b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/examples/src/ProductionCode2.h new file mode 100644 index 0000000..34ae980 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/examples/src/ProductionCode2.h @@ -0,0 +1,2 @@ + +char* ThisFunctionHasNotBeenTested(int Poor, char* LittleFunction); diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/examples/test/TestProductionCode.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/examples/test/TestProductionCode.c new file mode 100644 index 0000000..28a5581 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/examples/test/TestProductionCode.c @@ -0,0 +1,62 @@ + +#include "ProductionCode.h" +#include "unity.h" + +//sometimes you may want to get at local data in a module. +//for example: If you plan to pass by reference, this could be useful +//however, it should often be avoided +extern int Counter; + +void setUp(void) +{ + //This is run before EACH TEST + Counter = 0x5a5a; +} + +void tearDown(void) +{ +} + +void test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode(void) +{ + //All of these should pass + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(78)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(1)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(33)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(999)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(-1)); +} + +void test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken(void) +{ + // You should see this line fail in your test summary + TEST_ASSERT_EQUAL(1, FindFunction_WhichIsBroken(34)); + + // Notice the rest of these didn't get a chance to run because the line above failed. + // Unit tests abort each test function on the first sign of trouble. + // Then NEXT test function runs as normal. + TEST_ASSERT_EQUAL(8, FindFunction_WhichIsBroken(8888)); +} + +void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue(void) +{ + //This should be true because setUp set this up for us before this test + TEST_ASSERT_EQUAL_HEX(0x5a5a, FunctionWhichReturnsLocalVariable()); + + //This should be true because we can still change our answer + Counter = 0x1234; + TEST_ASSERT_EQUAL_HEX(0x1234, FunctionWhichReturnsLocalVariable()); +} + +void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain(void) +{ + //This should be true again because setup was rerun before this test (and after we changed it to 0x1234) + TEST_ASSERT_EQUAL_HEX(0x5a5a, FunctionWhichReturnsLocalVariable()); +} + +void test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed(void) +{ + //Sometimes you get the test wrong. When that happens, you get a failure too... and a quick look should tell + // you what actually happened...which in this case was a failure to setup the initial condition. + TEST_ASSERT_EQUAL_HEX(0x1234, FunctionWhichReturnsLocalVariable()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/examples/test/TestProductionCode2.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/examples/test/TestProductionCode2.c new file mode 100644 index 0000000..20c9251 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/examples/test/TestProductionCode2.c @@ -0,0 +1,26 @@ + +#include "ProductionCode2.h" +#include "unity.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void test_IgnoredTest(void) +{ + TEST_IGNORE_MESSAGE("This Test Was Ignored On Purpose"); +} + +void test_AnotherIgnoredTest(void) +{ + TEST_IGNORE_MESSAGE("These Can Be Useful For Leaving Yourself Notes On What You Need To Do Yet"); +} + +void test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented(void) +{ + TEST_IGNORE(); //Like This +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode2_Runner.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode2_Runner.c new file mode 100644 index 0000000..56515ae --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode2_Runner.c @@ -0,0 +1,46 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ +#include "unity.h" +#include +#include + +char MessageBuffer[50]; + +extern void setUp(void); +extern void tearDown(void); + +extern void test_IgnoredTest(void); +extern void test_AnotherIgnoredTest(void); +extern void test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented(void); + +static void runTest(UnityTestFunction test) +{ + if (TEST_PROTECT()) + { + setUp(); + test(); + } + if (TEST_PROTECT() && !TEST_IS_IGNORED) + { + tearDown(); + } +} +void resetTest() +{ + tearDown(); + setUp(); +} + + +int main(void) +{ + Unity.TestFile = "test/TestProductionCode2.c"; + UnityBegin(); + + // RUN_TEST calls runTest + RUN_TEST(test_IgnoredTest, 13); + RUN_TEST(test_AnotherIgnoredTest, 18); + RUN_TEST(test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented, 23); + + UnityEnd(); + return 0; +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode_Runner.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode_Runner.c new file mode 100644 index 0000000..64112f3 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode_Runner.c @@ -0,0 +1,50 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ +#include "unity.h" +#include +#include + +char MessageBuffer[50]; + +extern void setUp(void); +extern void tearDown(void); + +extern void test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode(void); +extern void test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken(void); +extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue(void); +extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain(void); +extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed(void); + +static void runTest(UnityTestFunction test) +{ + if (TEST_PROTECT()) + { + setUp(); + test(); + } + if (TEST_PROTECT() && !TEST_IS_IGNORED) + { + tearDown(); + } +} +void resetTest() +{ + tearDown(); + setUp(); +} + + +int main(void) +{ + Unity.TestFile = "test/TestProductionCode.c"; + UnityBegin(); + + // RUN_TEST calls runTest + RUN_TEST(test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode, 20); + RUN_TEST(test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken, 30); + RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue, 41); + RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain, 51); + RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed, 57); + + UnityEnd(); + return 0; +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/build/MakefileWorker.mk b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/build/MakefileWorker.mk new file mode 100644 index 0000000..9948751 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/build/MakefileWorker.mk @@ -0,0 +1,331 @@ +#--------- +# +# MakefileWorker.mk +# +# Include this helper file in your makefile +# It makes +# A static library holding the application objs +# A test executable +# +# See this example for parameter settings +# examples/Makefile +# +#---------- +# Inputs - these variables describe what to build +# +# INCLUDE_DIRS - Directories used to search for include files. +# This generates a -I for each directory +# SRC_DIRS - Directories containing source file to built into the library +# SRC_FILES - Specific source files to build into library. Helpful when not all code +# in a directory can be built for test (hopefully a temporary situation) +# TEST_SRC_DIRS - Directories containing unit test code build into the unit test runner +# These do not go in a library. They are explicitly included in the test runner +# MOCKS_SRC_DIRS - Directories containing mock source files to build into the test runner +# These do not go in a library. They are explicitly included in the test runner +#---------- +# You can adjust these variables to influence how to build the test target +# and where to put and name outputs +# See below to determine defaults +# COMPONENT_NAME - the name of the thing being built +# UNITY_HOME - where Unity home dir found +# UNITY_BUILD_HOME - place for scripts +# UNITY_OBJS_DIR - a directory where o and d files go +# UNITY_LIB_DIR - a directory where libs go +# UNITY_ENABLE_DEBUG - build for debug +# UNITY_USE_MEM_LEAK_DETECTION - Links with overridden new and delete +# UNITY_USE_STD_CPP_LIB - Set to N to keep the standard C++ library out +# of the test harness +# UNITY_USE_GCOV - Turn on coverage analysis +# Clean then build with this flag set to Y, then 'make gcov' +# UNITY_TEST_RUNNER_FLAGS +# None by default +# UNITY_MAPFILE - generate a map file +# UNITY_WARNINGFLAGS - overly picky by default +# OTHER_MAKEFILE_TO_INCLUDE - a hook to use this makefile to make +# other targets. Like CSlim, which is part of fitnesse +#---------- +# +# Other flags users can initialize to sneak in their settings +# UNITY_CFLAGS - C complier +# UNITY_LDFLAGS - Linker flags +#---------- + + +ifndef COMPONENT_NAME + COMPONENT_NAME = name_this_in_the_makefile +endif + +# Debug on by default +ifndef UNITY_ENABLE_DEBUG + UNITY_ENABLE_DEBUG = Y +endif + +# new and delete for memory leak detection on by default +ifndef UNITY_USE_MEM_LEAK_DETECTION + UNITY_USE_MEM_LEAK_DETECTION = Y +endif + +# Use gcov, off by default +ifndef UNITY_USE_GCOV + UNITY_USE_GCOV = N +endif + +# Default warnings +ifndef UNITY_WARNINGFLAGS + UNITY_WARNINGFLAGS = -Wall -Werror -Wshadow -Wswitch-default +endif + +# Default dir for temporary files (d, o) +ifndef UNITY_OBJS_DIR + UNITY_OBJS_DIR = objs +endif + +# Default dir for the outout library +ifndef UNITY_LIB_DIR + UNITY_LIB_DIR = lib +endif + +# No map by default +ifndef UNITY_MAP_FILE + UNITY_MAP_FILE = N +endif + +#Not verbose by deafult +ifdef VERBOSE + UNITY_TEST_RUNNER_FLAGS += -v +endif + +ifdef GROUP + UNITY_TEST_RUNNER_FLAGS += -g $(GROUP) +endif + +ifdef NAME + UNITY_TEST_RUNNER_FLAGS += -n $(NAME) +endif + +ifdef REPEAT + UNITY_TEST_RUNNER_FLAGS += -r $(REPEAT) +endif + + +# -------------------------------------- +# derived flags in the following area +# -------------------------------------- +ifeq ($(UNITY_USE_MEM_LEAK_DETECTION), N) + UNITY_CFLAGS += -DUNITY_MEM_LEAK_DETECTION_DISABLED +else + UNITY_MEMLEAK_DETECTOR_MALLOC_MACRO_FILE = -include $(UNITY_HOME)/extras/fixture/src/unity_fixture_malloc_overrides.h +endif + +ifeq ($(UNITY_ENABLE_DEBUG), Y) + UNITY_CFLAGS += -g +endif + +ifeq ($(UNITY_USE_GCOV), Y) + UNITY_CFLAGS += -fprofile-arcs -ftest-coverage +endif + +UNITY_CFLAGS += $(UNITY_MEMLEAK_DETECTOR_MALLOC_MACRO_FILE) + +TARGET_MAP = $(COMPONENT_NAME).map.txt +ifeq ($(UNITY_MAP_FILE), Y) + UNITY_LDFLAGS += -Wl,-map,$(TARGET_MAP) +endif + +LD_LIBRARIES += -lgcov + +TARGET_LIB = \ + $(UNITY_LIB_DIR)/lib$(COMPONENT_NAME).a + +TEST_TARGET = \ + $(COMPONENT_NAME)_tests + +#Helper Functions +get_src_from_dir = $(wildcard $1/*.cpp) $(wildcard $1/*.c) +get_dirs_from_dirspec = $(wildcard $1) +get_src_from_dir_list = $(foreach dir, $1, $(call get_src_from_dir,$(dir))) +__src_to = $(subst .c,$1, $(subst .cpp,$1,$2)) +src_to = $(addprefix $(UNITY_OBJS_DIR)/,$(call __src_to,$1,$2)) +src_to_o = $(call src_to,.o,$1) +src_to_d = $(call src_to,.d,$1) +src_to_gcda = $(call src_to,.gcda,$1) +src_to_gcno = $(call src_to,.gcno,$1) +make_dotdot_a_subdir = $(subst ..,_dot_dot, $1) +time = $(shell date +%s) +delta_t = $(eval minus, $1, $2) +debug_print_list = $(foreach word,$1,echo " $(word)";) echo; + +#Derived +STUFF_TO_CLEAN += $(TEST_TARGET) $(TEST_TARGET).exe $(TARGET_LIB) $(TARGET_MAP) + +SRC += $(call get_src_from_dir_list, $(SRC_DIRS)) $(SRC_FILES) +OBJ = $(call src_to_o,$(SRC)) +OBJ2 = $(call make_dotdot_a_subdir. $(OBJ)) + +STUFF_TO_CLEAN += $(OBJ) + +TEST_SRC = $(call get_src_from_dir_list, $(TEST_SRC_DIRS)) +TEST_OBJS = $(call src_to_o,$(TEST_SRC)) +STUFF_TO_CLEAN += $(TEST_OBJS) + + +MOCKS_SRC = $(call get_src_from_dir_list, $(MOCKS_SRC_DIRS)) +MOCKS_OBJS = $(call src_to_o,$(MOCKS_SRC)) +STUFF_TO_CLEAN += $(MOCKS_OBJS) + +ALL_SRC = $(SRC) $(TEST_SRC) $(MOCKS_SRC) + +#Test coverage with gcov +GCOV_OUTPUT = gcov_output.txt +GCOV_REPORT = gcov_report.txt +GCOV_ERROR = gcov_error.txt +GCOV_GCDA_FILES = $(call src_to_gcda, $(ALL_SRC)) +GCOV_GCNO_FILES = $(call src_to_gcno, $(ALL_SRC)) +TEST_OUTPUT = $(TEST_TARGET).txt +STUFF_TO_CLEAN += \ + $(GCOV_OUTPUT)\ + $(GCOV_REPORT)\ + $(GCOV_REPORT).html\ + $(GCOV_ERROR)\ + $(GCOV_GCDA_FILES)\ + $(GCOV_GCNO_FILES)\ + $(TEST_OUTPUT) + + +#The gcda files for gcov need to be deleted before each run +#To avoid annoying messages. +GCOV_CLEAN = $(SILENCE)rm -f $(GCOV_GCDA_FILES) $(GCOV_OUTPUT) $(GCOV_REPORT) $(GCOV_ERROR) +RUN_TEST_TARGET = $(SILENCE) $(GCOV_CLEAN) ; echo "Running $(TEST_TARGET)"; ./$(TEST_TARGET) $(UNITY_TEST_RUNNER_FLAGS) + +INCLUDES_DIRS_EXPANDED = $(call get_dirs_from_dirspec, $(INCLUDE_DIRS)) +INCLUDES += $(foreach dir, $(INCLUDES_DIRS_EXPANDED), -I$(dir)) +MOCK_DIRS_EXPANDED = $(call get_dirs_from_dirspec, $(MOCKS_SRC_DIRS)) +INCLUDES += $(foreach dir, $(MOCK_DIRS_EXPANDED), -I$(dir)) + + +DEP_FILES = $(call src_to_d, $(ALL_SRC)) +STUFF_TO_CLEAN += $(DEP_FILES) $(PRODUCTION_CODE_START) $(PRODUCTION_CODE_END) +STUFF_TO_CLEAN += $(STDLIB_CODE_START) $(MAP_FILE) cpputest_*.xml junit_run_output + +# We'll use the UNITY_CFLAGS etc so that you can override AND add to the CppUTest flags +CFLAGS = $(UNITY_CFLAGS) $(UNITY_ADDITIONAL_CFLAGS) $(INCLUDES) $(UNITY_WARNINGFLAGS) +LDFLAGS = $(UNITY_LDFLAGS) $(UNITY_ADDITIONAL_LDFLAGS) + +# Targets + +.PHONY: all +all: start $(TEST_TARGET) + $(RUN_TEST_TARGET) + +.PHONY: start +start: $(TEST_TARGET) + $(SILENCE)START_TIME=$(call time) + +.PHONY: all_no_tests +all_no_tests: $(TEST_TARGET) + +.PHONY: flags +flags: + @echo + @echo "Compile C source with CFLAGS:" + @$(call debug_print_list,$(CFLAGS)) + @echo "Link with LDFLAGS:" + @$(call debug_print_list,$(LDFLAGS)) + @echo "Link with LD_LIBRARIES:" + @$(call debug_print_list,$(LD_LIBRARIES)) + @echo "Create libraries with ARFLAGS:" + @$(call debug_print_list,$(ARFLAGS)) + @echo "OBJ files:" + @$(call debug_print_list,$(OBJ2)) + + +$(TEST_TARGET): $(TEST_OBJS) $(MOCKS_OBJS) $(PRODUCTION_CODE_START) $(TARGET_LIB) $(USER_LIBS) $(PRODUCTION_CODE_END) $(STDLIB_CODE_START) + $(SILENCE)echo Linking $@ + $(SILENCE)$(LINK.o) -o $@ $^ $(LD_LIBRARIES) + +$(TARGET_LIB): $(OBJ) + $(SILENCE)echo Building archive $@ + $(SILENCE)mkdir -p lib + $(SILENCE)$(AR) $(ARFLAGS) $@ $^ + $(SILENCE)ranlib $@ + +test: $(TEST_TARGET) + $(RUN_TEST_TARGET) | tee $(TEST_OUTPUT) + +vtest: $(TEST_TARGET) + $(RUN_TEST_TARGET) -v | tee $(TEST_OUTPUT) + +$(UNITY_OBJS_DIR)/%.o: %.cpp + @echo compiling $(notdir $<) + $(SILENCE)mkdir -p $(dir $@) + $(SILENCE)$(COMPILE.cpp) -MMD -MP $(OUTPUT_OPTION) $< + +$(UNITY_OBJS_DIR)/%.o: %.c + @echo compiling $(notdir $<) + $(SILENCE)mkdir -p $(dir $@) + $(SILENCE)$(COMPILE.c) -MMD -MP $(OUTPUT_OPTION) $< + +ifneq "$(MAKECMDGOALS)" "clean" +-include $(DEP_FILES) +endif + +.PHONY: clean +clean: + $(SILENCE)echo Making clean + $(SILENCE)$(RM) $(STUFF_TO_CLEAN) + $(SILENCE)rm -rf gcov $(UNITY_OBJS_DIR) + $(SILENCE)find . -name "*.gcno" | xargs rm -f + $(SILENCE)find . -name "*.gcda" | xargs rm -f + +#realclean gets rid of all gcov, o and d files in the directory tree +#not just the ones made by this makefile +.PHONY: realclean +realclean: clean + $(SILENCE)rm -rf gcov + $(SILENCE)find . -name "*.gdcno" | xargs rm -f + $(SILENCE)find . -name "*.[do]" | xargs rm -f + +gcov: test + $(SILENCE)for d in $(SRC_DIRS) ; do \ + gcov --object-directory $(UNITY_OBJS_DIR)/$$d $$d/*.c $$d/*.cpp >> $(GCOV_OUTPUT) 2>>$(GCOV_ERROR) ; \ + done + $(SILENCE)for f in $(SRC_FILES) ; do \ + gcov --object-directory $(UNITY_OBJS_DIR)/$$f $$f >> $(GCOV_OUTPUT) 2>>$(GCOV_ERROR) ; \ + done + $(UNITY_BUILD_HOME)/filterGcov.sh $(GCOV_OUTPUT) $(GCOV_ERROR) $(GCOV_REPORT) $(TEST_OUTPUT) + $(SILENCE)cat $(GCOV_REPORT) + $(SILENCE)mkdir -p gcov + $(SILENCE)mv *.gcov gcov + $(SILENCE)mv gcov_* gcov + $(SILENCE)echo "See gcov directory for details" + +debug: + @echo + @echo "Target Source files:" + @$(call debug_print_list,$(SRC)) + @echo "Target Object files:" + @$(call debug_print_list,$(OBJ)) + @echo "Test Source files:" + @$(call debug_print_list,$(TEST_SRC)) + @echo "Test Object files:" + @$(call debug_print_list,$(TEST_OBJS)) + @echo "Mock Source files:" + @$(call debug_print_list,$(MOCKS_SRC)) + @echo "Mock Object files:" + @$(call debug_print_list,$(MOCKS_OBJS)) + @echo "All Input Dependency files:" + @$(call debug_print_list,$(DEP_FILES)) + @echo Stuff to clean: + @$(call debug_print_list,$(STUFF_TO_CLEAN)) + @echo Includes: + @$(call debug_print_list,$(INCLUDES)) + +ifneq "$(OTHER_MAKEFILE_TO_INCLUDE)" "" +-include $(OTHER_MAKEFILE_TO_INCLUDE) +endif + + + +st,$(TEST_SRC)) + @echo "Test Object files:" + @$(call debug_print \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/build/filterGcov.sh b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/build/filterGcov.sh new file mode 100644 index 0000000..a861cf6 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/build/filterGcov.sh @@ -0,0 +1,61 @@ +#!/bin/bash +INPUT_FILE=$1 +TEMP_FILE1=${INPUT_FILE}1.tmp +TEMP_FILE2=${INPUT_FILE}2.tmp +TEMP_FILE3=${INPUT_FILE}3.tmp +ERROR_FILE=$2 +OUTPUT_FILE=$3 +HTML_OUTPUT_FILE=$3.html +TEST_RESULTS=$4 + +flattenGcovOutput() { +while read line1 +do + read line2 + echo $line2 " " $line1 + read junk + read junk +done < ${INPUT_FILE} +} + +getRidOfCruft() { +sed '-e s/^Lines.*://g' \ + '-e s/^[0-9]\./ &/g' \ + '-e s/^[0-9][0-9]\./ &/g' \ + '-e s/of.*File/ /g' \ + "-e s/'//g" \ + '-e s/^.*\/usr\/.*$//g' \ + '-e s/^.*\.$//g' +} + +getFileNameRootFromErrorFile() { +sed '-e s/gc..:cannot open .* file//g' ${ERROR_FILE} +} + +writeEachNoTestCoverageFile() { +while read line +do + echo " 0.00% " ${line} +done +} + +createHtmlOutput() { + echo "" + echo "" + sed "-e s/.*% /
CoverageFile
&<\/td>/" \ + "-e s/[a-zA-Z0-9_]*\.[ch][a-z]*/&<\/a><\/td><\/tr>/" + echo "
" + sed "-e s/.*/&
/g" < ${TEST_RESULTS} +} + + +flattenGcovOutput | getRidOfCruft > ${TEMP_FILE1} +getFileNameRootFromErrorFile | writeEachNoTestCoverageFile > ${TEMP_FILE2} +cat ${TEMP_FILE1} ${TEMP_FILE2} | sort | uniq > ${OUTPUT_FILE} +createHtmlOutput < ${OUTPUT_FILE} > ${HTML_OUTPUT_FILE} +rm -f ${TEMP_FILE1} ${TEMP_FILE2} +erageFile" + sed "-e s/.*% /&<\/td>/" \ + "-e s/[a-zA-Z0-9_]*\.[ch][a-z]*/
&<\/a><\/td><\/tr>/" + echo "" + sed "-e s/.*/&
/g" < ${TEST_RESULTS \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/rakefile.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/rakefile.rb new file mode 100644 index 0000000..6181707 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/rakefile.rb @@ -0,0 +1,37 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require HERE + 'rakefile_helper' + +include RakefileHelpers + +# Load default configuration, for now +DEFAULT_CONFIG_FILE = 'gcc.yml' +configure_toolchain(DEFAULT_CONFIG_FILE) + +task :unit do + run_tests +end + +desc "Build and test Unity Framework" +task :all => [:clean, :unit] +task :default => [:clobber, :all] +task :ci => [:no_color, :default] +task :cruise => [:no_color, :default] + +desc "Load configuration" +task :config, :config_file do |t, args| + configure_toolchain(args[:config_file]) +end + +task :no_color do + $colour_output = false +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/rakefile_helper.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/rakefile_helper.rb new file mode 100644 index 0000000..a7f6a28 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/rakefile_helper.rb @@ -0,0 +1,178 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require 'yaml' +require 'fileutils' +require HERE+'../../auto/unity_test_summary' +require HERE+'../../auto/generate_test_runner' +require HERE+'../../auto/colour_reporter' + +module RakefileHelpers + + C_EXTENSION = '.c' + + def load_configuration(config_file) + unless ($configured) + $cfg_file = HERE+"../../targets/#{config_file}" unless (config_file =~ /[\\|\/]/) + $cfg = YAML.load(File.read($cfg_file)) + $colour_output = false unless $cfg['colour'] + $configured = true if (config_file != DEFAULT_CONFIG_FILE) + end + end + + def configure_clean + CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil? + end + + def configure_toolchain(config_file=DEFAULT_CONFIG_FILE) + config_file += '.yml' unless config_file =~ /\.yml$/ + config_file = config_file unless config_file =~ /[\\|\/]/ + load_configuration(config_file) + configure_clean + end + + def tackit(strings) + if strings.is_a?(Array) + result = "\"#{strings.join}\"" + else + result = strings + end + return result + end + + def squash(prefix, items) + result = '' + items.each { |item| result += " #{prefix}#{tackit(item)}" } + return result + end + + def build_compiler_fields + command = tackit($cfg['compiler']['path']) + if $cfg['compiler']['defines']['items'].nil? + defines = '' + else + defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items'] + ['UNITY_OUTPUT_CHAR=UnityOutputCharSpy_OutputChar']) + end + options = squash('', $cfg['compiler']['options']) + includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :defines => defines, :options => options, :includes => includes} + end + + def compile(file, defines=[]) + compiler = build_compiler_fields + unity_include = $cfg['compiler']['includes']['prefix']+'../../src' + cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{unity_include} #{file} " + + "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" + + "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" + execute(cmd_str) + end + + def build_linker_fields + command = tackit($cfg['linker']['path']) + if $cfg['linker']['options'].nil? + options = '' + else + options = squash('', $cfg['linker']['options']) + end + if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?) + includes = '' + else + includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) + end + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :options => options, :includes => includes} + end + + def link(exe_name, obj_list) + linker = build_linker_fields + cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + + (obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).join + + $cfg['linker']['bin_files']['prefix'] + ' ' + + $cfg['linker']['bin_files']['destination'] + + exe_name + $cfg['linker']['bin_files']['extension'] + execute(cmd_str) + end + + def build_simulator_fields + return nil if $cfg['simulator'].nil? + if $cfg['simulator']['path'].nil? + command = '' + else + command = (tackit($cfg['simulator']['path']) + ' ') + end + if $cfg['simulator']['pre_support'].nil? + pre_support = '' + else + pre_support = squash('', $cfg['simulator']['pre_support']) + end + if $cfg['simulator']['post_support'].nil? + post_support = '' + else + post_support = squash('', $cfg['simulator']['post_support']) + end + return {:command => command, :pre_support => pre_support, :post_support => post_support} + end + + def execute(command_string, verbose=true) + report command_string + output = `#{command_string}`.chomp + report(output) if (verbose && !output.nil? && (output.length > 0)) + if ($?.exitstatus != 0) + raise "Command failed. (Returned #{$?.exitstatus})" + end + return output + end + + def report_summary + summary = UnityTestSummary.new + summary.set_root_path(HERE) + results_glob = "#{$cfg['compiler']['build_path']}*.test*" + results_glob.gsub!(/\\/, '/') + results = Dir[results_glob] + summary.set_targets(results) + summary.run + end + + def run_tests + report 'Running Unity system tests...' + + # Tack on TEST define for compiling unit tests + load_configuration($cfg_file) + test_defines = ['TEST'] + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + + # Get a list of all source files needed + src_files = Dir[HERE+'src/*.c'] + src_files += Dir[HERE+'test/*.c'] + src_files << '../../src/Unity.c' + + # Build object files + src_files.each { |f| compile(f, test_defines) } + obj_list = src_files.map {|f| File.basename(f.ext($cfg['compiler']['object_files']['extension'])) } + + # Link the test executable + test_base = "framework_test" + link(test_base, obj_list) + + # Execute unit test and generate results file + simulator = build_simulator_fields + executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] + if simulator.nil? + cmd_str = executable + " -v -r" + else + cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" + end + output = execute(cmd_str) + test_results = $cfg['compiler']['build_path'] + test_base + if output.match(/OK$/m).nil? + test_results += '.testfail' + else + test_results += '.testpass' + end + File.open(test_results, 'w') { |f| f.print output } + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/readme.txt b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/readme.txt new file mode 100644 index 0000000..6b9a78c --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/readme.txt @@ -0,0 +1,9 @@ +Copyright (c) 2010 James Grenning and Contributed to Unity Project + +Unity Project - A Test Framework for C +Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +[Released under MIT License. Please refer to license.txt for details] + +This Framework is an optional add-on to Unity. By including unity_framework.h in place of unity.h, +you may now work with Unity in a manner similar to CppUTest. This framework adds the concepts of +test groups and gives finer control of your tests over the command line. \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c new file mode 100644 index 0000000..1ba3e9a --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c @@ -0,0 +1,381 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" +#include "unity_internals.h" +#include + +UNITY_FIXTURE_T UnityFixture; + +//If you decide to use the function pointer approach. +int (*outputChar)(int) = putchar; + +int verbose = 0; + +void setUp(void) { /*does nothing*/ } +void tearDown(void) { /*does nothing*/ } + +void announceTestRun(int runNumber) +{ + UnityPrint("Unity test run "); + UnityPrintNumber(runNumber+1); + UnityPrint(" of "); + UnityPrintNumber(UnityFixture.RepeatCount); + UNITY_OUTPUT_CHAR('\n'); +} + +int UnityMain(int argc, char* argv[], void (*runAllTests)()) +{ + int result = UnityGetCommandLineOptions(argc, argv); + int r; + if (result != 0) + return result; + + for (r = 0; r < UnityFixture.RepeatCount; r++) + { + announceTestRun(r); + UnityBegin(); + runAllTests(); + UNITY_OUTPUT_CHAR('\n'); + UnityEnd(); + } + + return UnityFailureCount(); +} + +static int selected(const char * filter, const char * name) +{ + if (filter == 0) + return 1; + return strstr(name, filter) ? 1 : 0; +} + +static int testSelected(const char* test) +{ + return selected(UnityFixture.NameFilter, test); +} + +static int groupSelected(const char* group) +{ + return selected(UnityFixture.GroupFilter, group); +} + +static void runTestCase() +{ + +} + +void UnityTestRunner(unityfunction* setup, + unityfunction* testBody, + unityfunction* teardown, + const char * printableName, + const char * group, + const char * name, + const char * file, int line) +{ + if (testSelected(name) && groupSelected(group)) + { + Unity.CurrentTestFailed = 0; + Unity.TestFile = file; + Unity.CurrentTestName = printableName; + Unity.CurrentTestLineNumber = line; + if (!UnityFixture.Verbose) + UNITY_OUTPUT_CHAR('.'); + else + UnityPrint(printableName); + + Unity.NumberOfTests++; + UnityMalloc_StartTest(); + UnityPointer_Init(); + + runTestCase(); + if (TEST_PROTECT()) + { + setup(); + testBody(); + } + if (TEST_PROTECT()) + { + teardown(); + } + if (TEST_PROTECT()) + { + UnityPointer_UndoAllSets(); + if (!Unity.CurrentTestFailed) + UnityMalloc_EndTest(); + UnityConcludeFixtureTest(); + } + else + { + //aborting - jwg - di i need these for the other TEST_PROTECTS? + } + } +} + +void UnityIgnoreTest() +{ + Unity.NumberOfTests++; + Unity.CurrentTestIgnored = 1; + UNITY_OUTPUT_CHAR('!'); +} + + +//------------------------------------------------- +//Malloc and free stuff +// +#define MALLOC_DONT_FAIL -1 +static int malloc_count; +static int malloc_fail_countdown = MALLOC_DONT_FAIL; + +void UnityMalloc_StartTest() +{ + malloc_count = 0; + malloc_fail_countdown = MALLOC_DONT_FAIL; +} + +void UnityMalloc_EndTest() +{ + malloc_fail_countdown = MALLOC_DONT_FAIL; + if (malloc_count != 0) + { + TEST_FAIL_MESSAGE("This test leaks!"); + } +} + +void UnityMalloc_MakeMallocFailAfterCount(int countdown) +{ + malloc_fail_countdown = countdown; +} + +#ifdef malloc +#undef malloc +#endif + +#ifdef free +#undef free +#endif + +#include +#include + +typedef struct GuardBytes +{ + int size; + char guard[sizeof(int)]; +} Guard; + + +static const char * end = "END"; + +void * unity_malloc(size_t size) +{ + char* mem; + Guard* guard; + + if (malloc_fail_countdown != MALLOC_DONT_FAIL) + { + if (malloc_fail_countdown == 0) + return 0; + malloc_fail_countdown--; + } + + malloc_count++; + + guard = (Guard*)malloc(size + sizeof(Guard) + 4); + guard->size = size; + mem = (char*)&(guard[1]); + memcpy(&mem[size], end, strlen(end) + 1); + + return (void*)mem; +} + +static int isOverrun(void * mem) +{ + Guard* guard = (Guard*)mem; + char* memAsChar = (char*)mem; + guard--; + + return strcmp(&memAsChar[guard->size], end) != 0; +} + +static void release_memory(void * mem) +{ + Guard* guard = (Guard*)mem; + guard--; + + malloc_count--; + free(guard); +} + +void unity_free(void * mem) +{ + int overrun = isOverrun(mem);//strcmp(&memAsChar[guard->size], end) != 0; + release_memory(mem); + if (overrun) + { + TEST_FAIL_MESSAGE("Buffer overrun detected during free()"); + } +} + +void* unity_calloc(size_t num, size_t size) +{ + void* mem = unity_malloc(num * size); + memset(mem, 0, num*size); + return mem; +} + +void* unity_realloc(void * oldMem, size_t size) +{ + Guard* guard = (Guard*)oldMem; +// char* memAsChar = (char*)oldMem; + void* newMem; + + if (oldMem == 0) + return unity_malloc(size); + + guard--; + if (isOverrun(oldMem)) + { + release_memory(oldMem); + TEST_FAIL_MESSAGE("Buffer overrun detected during realloc()"); + } + + if (size == 0) + { + release_memory(oldMem); + return 0; + } + + if (guard->size >= size) + return oldMem; + + newMem = unity_malloc(size); + memcpy(newMem, oldMem, size); + unity_free(oldMem); + return newMem; +} + + +//-------------------------------------------------------- +//Automatic pointer restoration functions +typedef struct _PointerPair +{ + struct _PointerPair * next; + void ** pointer; + void * old_value; +} PointerPair; + +enum {MAX_POINTERS=50}; +static PointerPair pointer_store[MAX_POINTERS]; +static int pointer_index = 0; + +void UnityPointer_Init() +{ + pointer_index = 0; +} + +void UnityPointer_Set(void ** pointer, void * newValue) +{ + if (pointer_index >= MAX_POINTERS) + TEST_FAIL_MESSAGE("Too many pointers set"); + + pointer_store[pointer_index].pointer = pointer; + pointer_store[pointer_index].old_value = *pointer; + *pointer = newValue; + pointer_index++; +} + +void UnityPointer_UndoAllSets() +{ + while (pointer_index > 0) + { + pointer_index--; + *(pointer_store[pointer_index].pointer) = + pointer_store[pointer_index].old_value; + + } +} + +int UnityFailureCount() +{ + return Unity.TestFailures; +} + +int UnityGetCommandLineOptions(int argc, char* argv[]) +{ + int i; + UnityFixture.Verbose = 0; + UnityFixture.GroupFilter = 0; + UnityFixture.NameFilter = 0; + UnityFixture.RepeatCount = 1; + + if (argc == 1) + return 0; + + for (i = 1; i < argc; ) + { + if (strcmp(argv[i], "-v") == 0) + { + UnityFixture.Verbose = 1; + i++; + } + else if (strcmp(argv[i], "-g") == 0) + { + i++; + if (i >= argc) + return 1; + UnityFixture.GroupFilter = argv[i]; + i++; + } + else if (strcmp(argv[i], "-n") == 0) + { + i++; + if (i >= argc) + return 1; + UnityFixture.NameFilter = argv[i]; + i++; + } + else if (strcmp(argv[i], "-r") == 0) + { + UnityFixture.RepeatCount = 2; + i++; + if (i < argc) + { + if (*(argv[i]) >= '0' && *(argv[i]) <= '9') + { + UnityFixture.RepeatCount = atoi(argv[i]); + i++; + } + } + } + } + return 0; +} + +void UnityConcludeFixtureTest() +{ + if (Unity.CurrentTestIgnored) + { + Unity.TestIgnores++; + } + else if (!Unity.CurrentTestFailed) + { + if (UnityFixture.Verbose) + { + UnityPrint(" PASS"); + UNITY_OUTPUT_CHAR('\n'); + } + } + else if (Unity.CurrentTestFailed) + { + Unity.TestFailures++; + } + + Unity.CurrentTestFailed = 0; + Unity.CurrentTestIgnored = 0; +} + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.h b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.h new file mode 100644 index 0000000..da1f871 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.h @@ -0,0 +1,81 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FIXTURE_H_ +#define UNITY_FIXTURE_H_ + +#include "unity.h" +#include "unity_internals.h" +#include "unity_fixture_malloc_overrides.h" +#include "unity_fixture_internals.h" + +int UnityMain(int argc, char* argv[], void (*runAllTests)()); + + +#define TEST_GROUP(group)\ + int TEST_GROUP_##group = 0 + +#define TEST_SETUP(group) void TEST_##group##_SETUP() + +#define TEST_TEAR_DOWN(group) void TEST_##group##_TEAR_DOWN() + + +#define TEST(group, name) \ + void TEST_##group##_##name##_();\ + void TEST_##group##_##name##_run()\ + {\ + UnityTestRunner(TEST_##group##_SETUP,\ + TEST_##group##_##name##_,\ + TEST_##group##_TEAR_DOWN,\ + "TEST(" #group ", " #name ")",\ + #group, #name,\ + __FILE__, __LINE__);\ + }\ + void TEST_##group##_##name##_() + +#define IGNORE_TEST(group, name) \ + void TEST_##group##_##name##_();\ + void TEST_##group##_##name##_run()\ + {\ + UnityIgnoreTest();\ + }\ + void TEST_##group##_##name##_() + +#define DECLARE_TEST_CASE(group, name) \ + void TEST_##group##_##name##_run() + +#define RUN_TEST_CASE(group, name) \ + DECLARE_TEST_CASE(group, name);\ + TEST_##group##_##name##_run(); + +//This goes at the bottom of each test file or in a separate c file +#define TEST_GROUP_RUNNER(group)\ + void TEST_##group##_GROUP_RUNNER_runAll();\ + void TEST_##group##_GROUP_RUNNER()\ + {\ + TEST_##group##_GROUP_RUNNER_runAll();\ + }\ + void TEST_##group##_GROUP_RUNNER_runAll() + +//Call this from main +#define RUN_TEST_GROUP(group)\ + void TEST_##group##_GROUP_RUNNER();\ + TEST_##group##_GROUP_RUNNER(); + +//CppUTest Compatibility Macros +#define UT_PTR_SET(ptr, newPointerValue) UnityPointer_Set((void**)&ptr, (void*)newPointerValue) +#define TEST_ASSERT_POINTERS_EQUAL(expected, actual) TEST_ASSERT_EQUAL_PTR(expected, actual) +#define TEST_ASSERT_BYTES_EQUAL(expected, actual) TEST_ASSERT_EQUAL_HEX8(0xff & (expected), 0xff & (actual)) +#define FAIL(message) TEST_FAIL((message)) +#define CHECK(condition) TEST_ASSERT_TRUE((condition)) +#define LONGS_EQUAL(expected, actual) TEST_ASSERT_EQUAL_INT((expected), (actual)) +#define STRCMP_EQUAL(expected, actual) TEST_ASSERT_EQUAL_STRING((expected), (actual)) +#define DOUBLES_EQUAL(expected, actual, delta) TEST_ASSERT_FLOAT_WITHIN(((expected), (actual), (delta)) + +void UnityMalloc_MakeMallocFailAfterCount(int count); + +#endif /* UNITY_FIXTURE_H_ */ diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h new file mode 100644 index 0000000..db23f67 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h @@ -0,0 +1,44 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FIXTURE_INTERNALS_H_ +#define UNITY_FIXTURE_INTERNALS_H_ + +typedef struct _UNITY_FIXTURE_T +{ + int Verbose; + unsigned int RepeatCount; + const char* NameFilter; + const char* GroupFilter; +} UNITY_FIXTURE_T; + +typedef void unityfunction(); +void UnityTestRunner(unityfunction * setup, + unityfunction * body, + unityfunction * teardown, + const char * printableName, + const char * group, + const char * name, + const char * file, int line); + +void UnityIgnoreTest(); +void UnityMalloc_StartTest(); +void UnityMalloc_EndTest(); +int UnityFailureCount(); +int UnityGetCommandLineOptions(int argc, char* argv[]); +void UnityConcludeFixtureTest(); + +void UnityPointer_Set(void ** ptr, void * newValue); +void UnityPointer_UndoAllSets(); +void UnityPointer_Init(); + +void UnityAssertEqualPointer(const void * expected, + const void * actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +#endif /* UNITY_FIXTURE_INTERNALS_H_ */ diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h new file mode 100644 index 0000000..38f8e34 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h @@ -0,0 +1,16 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FIXTURE_MALLOC_OVERRIDES_H_ +#define UNITY_FIXTURE_MALLOC_OVERRIDES_H_ + +#define malloc unity_malloc +#define calloc unity_calloc +#define realloc unity_realloc +#define free unity_free + +#endif /* UNITY_FIXTURE_MALLOC_OVERRIDES_H_ */ diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/main/AllTests.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/main/AllTests.c new file mode 100644 index 0000000..ccb775b --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/main/AllTests.c @@ -0,0 +1,21 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" + +static void runAllTests() +{ + RUN_TEST_GROUP(UnityFixture); + RUN_TEST_GROUP(UnityCommandOptions); + RUN_TEST_GROUP(LeakDetection) +} + +int main(int argc, char* argv[]) +{ + return UnityMain(argc, argv, runAllTests); +} + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/testunity_fixture.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/testunity_fixture.c new file mode 100644 index 0000000..de0c04c --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/testunity_fixture.c @@ -0,0 +1,39 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" + +static int data = -1; + +TEST_GROUP(mygroup); + +TEST_SETUP(mygroup) +{ + data = 0; +} + +TEST_TEAR_DOWN(mygroup) +{ + data = -1; +} + +TEST(mygroup, test1) +{ + TEST_ASSERT_EQUAL_INT(0, data); +} + +TEST(mygroup, test2) +{ + TEST_ASSERT_EQUAL_INT(0, data); + data = 5; +} + +TEST(mygroup, test3) +{ + data = 7; + TEST_ASSERT_EQUAL_INT(7, data); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c new file mode 100644 index 0000000..b8b4524 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c @@ -0,0 +1,321 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" +#include "unity_output_Spy.h" +#include +#include + +extern UNITY_FIXTURE_T UnityFixture; + +TEST_GROUP(UnityFixture); + +TEST_SETUP(UnityFixture) +{ +} + +TEST_TEAR_DOWN(UnityFixture) +{ +} + +int my_int; +int* pointer1 = 0; +int* pointer2 = (int*)2; +int* pointer3 = (int*)3; +int int1; +int int2; +int int3; +int int4; + +TEST(UnityFixture, PointerSetting) +{ + TEST_ASSERT_POINTERS_EQUAL(pointer1, 0); + UT_PTR_SET(pointer1, &int1); + UT_PTR_SET(pointer2, &int2); + UT_PTR_SET(pointer3, &int3); + TEST_ASSERT_POINTERS_EQUAL(pointer1, &int1); + TEST_ASSERT_POINTERS_EQUAL(pointer2, &int2); + TEST_ASSERT_POINTERS_EQUAL(pointer3, &int3); + UT_PTR_SET(pointer1, &int4); + UnityPointer_UndoAllSets(); + TEST_ASSERT_POINTERS_EQUAL(pointer1, 0); + TEST_ASSERT_POINTERS_EQUAL(pointer2, (int*)2); + TEST_ASSERT_POINTERS_EQUAL(pointer3, (int*)3); +} + +TEST(UnityFixture, ForceMallocFail) +{ + UnityMalloc_MakeMallocFailAfterCount(1); + void* m = malloc(10); + CHECK(m); + void* mfails = malloc(10); + TEST_ASSERT_POINTERS_EQUAL(0, mfails); + free(m); +} + +TEST(UnityFixture, ReallocSmallerIsUnchanged) +{ + void* m1 = malloc(10); + void* m2 = realloc(m1, 5); + TEST_ASSERT_POINTERS_EQUAL(m1, m2); + free(m2); +} + +TEST(UnityFixture, ReallocSameIsUnchanged) +{ + void* m1 = malloc(10); + void* m2 = realloc(m1, 10); + TEST_ASSERT_POINTERS_EQUAL(m1, m2); + free(m2); +} + +TEST(UnityFixture, ReallocLargerNeeded) +{ + void* m1 = malloc(10); + strcpy((char*)m1, "123456789"); + void* m2 = realloc(m1, 15); + CHECK(m1 != m2); + STRCMP_EQUAL("123456789", m2); + free(m2); +} + +TEST(UnityFixture, ReallocNullPointerIsLikeMalloc) +{ + void* m = realloc(0, 15); + CHECK(m != 0); + free(m); +} + +TEST(UnityFixture, ReallocSizeZeroFreesMemAndReturnsNullPointer) +{ + void* m1 = malloc(10); + void* m2 = realloc(m1, 0); + TEST_ASSERT_POINTERS_EQUAL(0, m2); +} + +TEST(UnityFixture, CallocFillsWithZero) +{ + void* m = calloc(3, sizeof(char)); + char* s = (char*)m; + TEST_ASSERT_BYTES_EQUAL(0, s[0]); + TEST_ASSERT_BYTES_EQUAL(0, s[1]); + TEST_ASSERT_BYTES_EQUAL(0, s[2]); + free(m); +} + +char *p1; +char *p2; + +TEST(UnityFixture, PointerSet) +{ + char c1; + char c2; + char newC1; + char newC2; + p1 = &c1; + p2 = &c2; + + UnityPointer_Init(10); + UT_PTR_SET(p1, &newC1); + UT_PTR_SET(p2, &newC2); + TEST_ASSERT_POINTERS_EQUAL(&newC1, p1); + TEST_ASSERT_POINTERS_EQUAL(&newC2, p2); + UnityPointer_UndoAllSets(); + TEST_ASSERT_POINTERS_EQUAL(&c1, p1); + TEST_ASSERT_POINTERS_EQUAL(&c2, p2); +} + +//------------------------------------------------------------ + +TEST_GROUP(UnityCommandOptions); + +int savedVerbose; +int savedRepeat; +const char* savedName; +const char* savedGroup; + +TEST_SETUP(UnityCommandOptions) +{ + savedVerbose = UnityFixture.Verbose; + savedRepeat = UnityFixture.RepeatCount; + savedName = UnityFixture.NameFilter; + savedGroup = UnityFixture.GroupFilter; +} + +TEST_TEAR_DOWN(UnityCommandOptions) +{ + UnityFixture.Verbose = savedVerbose; + UnityFixture.RepeatCount= savedRepeat; + UnityFixture.NameFilter = savedName; + UnityFixture.GroupFilter = savedGroup; +} + + +static char* noOptions[] = { + "testrunner.exe" +}; + +TEST(UnityCommandOptions, DefaultOptions) +{ + UnityGetCommandLineOptions(1, noOptions); + TEST_ASSERT_EQUAL(0, UnityFixture.Verbose); + TEST_ASSERT_POINTERS_EQUAL(0, UnityFixture.GroupFilter); + TEST_ASSERT_POINTERS_EQUAL(0, UnityFixture.NameFilter); + TEST_ASSERT_EQUAL(1, UnityFixture.RepeatCount); +} + +static char* verbose[] = { + "testrunner.exe", + "-v" +}; + +TEST(UnityCommandOptions, OptionVerbose) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(2, verbose)); + TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); +} + +static char* group[] = { + "testrunner.exe", + "-g", "groupname" +}; + +TEST(UnityCommandOptions, OptionSelectTestByGroup) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, group)); + STRCMP_EQUAL("groupname", UnityFixture.GroupFilter); +} + +static char* name[] = { + "testrunner.exe", + "-n", "testname" +}; + +TEST(UnityCommandOptions, OptionSelectTestByName) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, name)); + STRCMP_EQUAL("testname", UnityFixture.NameFilter); +} + +static char* repeat[] = { + "testrunner.exe", + "-r", "99" +}; + +TEST(UnityCommandOptions, OptionSelectRepeatTestsDefaultCount) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(2, repeat)); + TEST_ASSERT_EQUAL(2, UnityFixture.RepeatCount); +} + +TEST(UnityCommandOptions, OptionSelectRepeatTestsSpecificCount) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, repeat)); + TEST_ASSERT_EQUAL(99, UnityFixture.RepeatCount); +} + +static char* multiple[] = { + "testrunner.exe", + "-v", + "-g", "groupname", + "-n", "testname", + "-r", "98" +}; + +TEST(UnityCommandOptions, MultipleOptions) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(8, multiple)); + TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); + STRCMP_EQUAL("groupname", UnityFixture.GroupFilter); + STRCMP_EQUAL("testname", UnityFixture.NameFilter); + TEST_ASSERT_EQUAL(98, UnityFixture.RepeatCount); +} + +static char* dashRNotLast[] = { + "testrunner.exe", + "-v", + "-g", "gggg", + "-r", + "-n", "tttt", +}; + +TEST(UnityCommandOptions, MultipleOptionsDashRNotLastAndNoValueSpecified) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(7, dashRNotLast)); + TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); + STRCMP_EQUAL("gggg", UnityFixture.GroupFilter); + STRCMP_EQUAL("tttt", UnityFixture.NameFilter); + TEST_ASSERT_EQUAL(2, UnityFixture.RepeatCount); +} + + +//------------------------------------------------------------ + +TEST_GROUP(LeakDetection); + +TEST_SETUP(LeakDetection) +{ + UnityOutputCharSpy_Create(1000); +} + +TEST_TEAR_DOWN(LeakDetection) +{ + UnityOutputCharSpy_Destroy(); +} + +#define EXPECT_ABORT_BEGIN \ + { \ + jmp_buf TestAbortFrame; \ + memcpy(TestAbortFrame, Unity.AbortFrame, sizeof(jmp_buf)); \ + if (TEST_PROTECT()) \ + { + +#define EXPECT_ABORT_END \ + } \ + memcpy(Unity.AbortFrame, TestAbortFrame, sizeof(jmp_buf)); \ + } + +TEST(LeakDetection, DetectsLeak) +{ + void* m = malloc(10); + UnityOutputCharSpy_Enable(1); + EXPECT_ABORT_BEGIN + UnityMalloc_EndTest(); + EXPECT_ABORT_END + UnityOutputCharSpy_Enable(0); + CHECK(strstr(UnityOutputCharSpy_Get(), "This test leaks!")); + free(m); + Unity.CurrentTestFailed = 0; +} + +TEST(LeakDetection, BufferOverrunFoundDuringFree) +{ + void* m = malloc(10); + char* s = (char*)m; + s[10] = (char)0xFF; + UnityOutputCharSpy_Enable(1); + EXPECT_ABORT_BEGIN + free(m); + EXPECT_ABORT_END + UnityOutputCharSpy_Enable(0); + CHECK(strstr(UnityOutputCharSpy_Get(), "Buffer overrun detected during free()")); + Unity.CurrentTestFailed = 0; +} + +TEST(LeakDetection, BufferOverrunFoundDuringRealloc) +{ + void* m = malloc(10); + char* s = (char*)m; + s[10] = (char)0xFF; + UnityOutputCharSpy_Enable(1); + EXPECT_ABORT_BEGIN + m = realloc(m, 100); + EXPECT_ABORT_END + UnityOutputCharSpy_Enable(0); + CHECK(strstr(UnityOutputCharSpy_Get(), "Buffer overrun detected during realloc()")); + Unity.CurrentTestFailed = 0; +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c new file mode 100644 index 0000000..80fec09 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c @@ -0,0 +1,40 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" + +TEST_GROUP_RUNNER(UnityFixture) +{ + RUN_TEST_CASE(UnityFixture, PointerSetting); + RUN_TEST_CASE(UnityFixture, ForceMallocFail); + RUN_TEST_CASE(UnityFixture, ReallocSmallerIsUnchanged); + RUN_TEST_CASE(UnityFixture, ReallocSameIsUnchanged); + RUN_TEST_CASE(UnityFixture, ReallocLargerNeeded); + RUN_TEST_CASE(UnityFixture, ReallocNullPointerIsLikeMalloc); + RUN_TEST_CASE(UnityFixture, ReallocSizeZeroFreesMemAndReturnsNullPointer); + RUN_TEST_CASE(UnityFixture, CallocFillsWithZero); + RUN_TEST_CASE(UnityFixture, PointerSet); +} + +TEST_GROUP_RUNNER(UnityCommandOptions) +{ + RUN_TEST_CASE(UnityCommandOptions, DefaultOptions); + RUN_TEST_CASE(UnityCommandOptions, OptionVerbose); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectTestByGroup); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectTestByName); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectRepeatTestsDefaultCount); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectRepeatTestsSpecificCount); + RUN_TEST_CASE(UnityCommandOptions, MultipleOptions); + RUN_TEST_CASE(UnityCommandOptions, MultipleOptionsDashRNotLastAndNoValueSpecified); +} + +TEST_GROUP_RUNNER(LeakDetection) +{ + RUN_TEST_CASE(LeakDetection, DetectsLeak); + RUN_TEST_CASE(LeakDetection, BufferOverrunFoundDuringFree); + RUN_TEST_CASE(LeakDetection, BufferOverrunFoundDuringRealloc); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.c new file mode 100644 index 0000000..16faefa --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.c @@ -0,0 +1,56 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + + +#include "unity_output_Spy.h" +#include +#include +#include + +static int size; +static int count; +static char* buffer; +static int spy_enable; + +void UnityOutputCharSpy_Create(int s) +{ + size = s; + count = 0; + spy_enable = 0; + buffer = malloc(size); + memset(buffer, 0, size); +} + +void UnityOutputCharSpy_Destroy() +{ + size = 0; + free(buffer); +} + +int UnityOutputCharSpy_OutputChar(int c) +{ + if (spy_enable) + { + if (count < (size-1)) + buffer[count++] = c; + } + else + { + putchar(c); + } + return c; +} + +const char * UnityOutputCharSpy_Get() +{ + return buffer; +} + +void UnityOutputCharSpy_Enable(int enable) +{ + spy_enable = enable; +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.h b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.h new file mode 100644 index 0000000..7c1590e --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.h @@ -0,0 +1,17 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef D_unity_output_Spy_H +#define D_unity_output_Spy_H + +void UnityOutputCharSpy_Create(int s); +void UnityOutputCharSpy_Destroy(); +int UnityOutputCharSpy_OutputChar(int c); +const char * UnityOutputCharSpy_Get(); +void UnityOutputCharSpy_Enable(int enable); + +#endif diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/makefile b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/makefile new file mode 100644 index 0000000..8c8444b --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/makefile @@ -0,0 +1,35 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +C_COMPILER=gcc +TARGET_BASE = testunity +ifeq ($(OS),Windows_NT) + TARGET_EXTENSION=.exe +else + TARGET_EXTENSION=.out +endif +TARGET = $(TARGET_BASE)$(TARGET_EXTENSION) +OUT_FILE=-o $(TARGET) +SRC_FILES=src/unity.c test/testunity.c build/testunity_Runner.c +INC_DIRS=-Isrc +SYMBOLS=-DTEST -DUNITY_SUPPORT_64 + +ifeq ($(OS),Windows_NT) + CLEANUP = del /F /Q build\* && del /F /Q $(TARGET) +else + CLEANUP = rm -f build/*.o ; rm -f $(TARGET) +endif + +all: clean default + +default: + ruby auto/generate_test_runner.rb test/testunity.c build/testunity_Runner.c + $(C_COMPILER) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES) $(OUT_FILE) + $(TARGET) + +clean: + $(CLEANUP) + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/rakefile.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/rakefile.rb new file mode 100644 index 0000000..3ec5d5a --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/rakefile.rb @@ -0,0 +1,48 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require HERE + 'rakefile_helper' + +include RakefileHelpers + +# Load default configuration, for now +DEFAULT_CONFIG_FILE = 'gcc.yml' +configure_toolchain(DEFAULT_CONFIG_FILE) + +desc "Test unity with its own unit tests" +task :unit do + run_tests get_unit_test_files +end + +Rake::TestTask.new(:scripts) do |t| + t.pattern = 'test/test_*.rb' + t.verbose = true +end + +desc "Generate test summary" +task :summary do + report_summary +end + +desc "Build and test Unity" +task :all => [:clean, :scripts, :unit, :summary] +task :default => [:clobber, :all] +task :ci => [:no_color, :default] +task :cruise => [:no_color, :default] + +desc "Load configuration" +task :config, :config_file do |t, args| + configure_toolchain(args[:config_file]) +end + +task :no_color do + $colour_output = false +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/rakefile_helper.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/rakefile_helper.rb new file mode 100644 index 0000000..218fcaa --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/rakefile_helper.rb @@ -0,0 +1,243 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require 'yaml' +require 'fileutils' +require HERE+'auto/unity_test_summary' +require HERE+'auto/generate_test_runner' +require HERE+'auto/colour_reporter' + +module RakefileHelpers + + C_EXTENSION = '.c' + + def load_configuration(config_file) + unless ($configured) + $cfg_file = "targets/#{config_file}" unless (config_file =~ /[\\|\/]/) + $cfg = YAML.load(File.read($cfg_file)) + $colour_output = false unless $cfg['colour'] + $configured = true if (config_file != DEFAULT_CONFIG_FILE) + end + end + + def configure_clean + CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil? + end + + def configure_toolchain(config_file=DEFAULT_CONFIG_FILE) + config_file += '.yml' unless config_file =~ /\.yml$/ + config_file = config_file unless config_file =~ /[\\|\/]/ + load_configuration(config_file) + configure_clean + end + + def get_unit_test_files + path = $cfg['compiler']['unit_tests_path'] + 'test*' + C_EXTENSION + path.gsub!(/\\/, '/') + FileList.new(path) + end + + def get_local_include_dirs + include_dirs = $cfg['compiler']['includes']['items'].dup + include_dirs.delete_if {|dir| dir.is_a?(Array)} + return include_dirs + end + + def extract_headers(filename) + includes = [] + lines = File.readlines(filename) + lines.each do |line| + m = line.match(/^\s*#include\s+\"\s*(.+\.[hH])\s*\"/) + if not m.nil? + includes << m[1] + end + end + return includes + end + + def find_source_file(header, paths) + paths.each do |dir| + src_file = dir + header.ext(C_EXTENSION) + if (File.exists?(src_file)) + return src_file + end + end + return nil + end + + def tackit(strings) + if strings.is_a?(Array) + result = "\"#{strings.join}\"" + else + result = strings + end + return result + end + + def squash(prefix, items) + result = '' + items.each { |item| result += " #{prefix}#{tackit(item)}" } + return result + end + + def build_compiler_fields + command = tackit($cfg['compiler']['path']) + if $cfg['compiler']['defines']['items'].nil? + defines = '' + else + defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items']) + end + options = squash('', $cfg['compiler']['options']) + includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :defines => defines, :options => options, :includes => includes} + end + + def compile(file, defines=[]) + compiler = build_compiler_fields + cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{file} " + + "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" + + "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" + execute(cmd_str) + end + + def build_linker_fields + command = tackit($cfg['linker']['path']) + if $cfg['linker']['options'].nil? + options = '' + else + options = squash('', $cfg['linker']['options']) + end + if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?) + includes = '' + else + includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) + end + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :options => options, :includes => includes} + end + + def link(exe_name, obj_list) + linker = build_linker_fields + cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + + (obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).join + + $cfg['linker']['bin_files']['prefix'] + ' ' + + $cfg['linker']['bin_files']['destination'] + + exe_name + $cfg['linker']['bin_files']['extension'] + execute(cmd_str) + end + + def build_simulator_fields + return nil if $cfg['simulator'].nil? + if $cfg['simulator']['path'].nil? + command = '' + else + command = (tackit($cfg['simulator']['path']) + ' ') + end + if $cfg['simulator']['pre_support'].nil? + pre_support = '' + else + pre_support = squash('', $cfg['simulator']['pre_support']) + end + if $cfg['simulator']['post_support'].nil? + post_support = '' + else + post_support = squash('', $cfg['simulator']['post_support']) + end + return {:command => command, :pre_support => pre_support, :post_support => post_support} + end + + def execute(command_string, verbose=true) + report command_string + output = `#{command_string}`.chomp + report(output) if (verbose && !output.nil? && (output.length > 0)) + if $?.exitstatus != 0 + raise "Command failed. (Returned #{$?.exitstatus})" + end + return output + end + + def report_summary + summary = UnityTestSummary.new + summary.set_root_path(HERE) + results_glob = "#{$cfg['compiler']['build_path']}*.test*" + results_glob.gsub!(/\\/, '/') + results = Dir[results_glob] + summary.set_targets(results) + summary.run + end + + def run_tests(test_files) + report 'Running Unity system tests...' + + # Tack on TEST define for compiling unit tests + load_configuration($cfg_file) + test_defines = ['TEST'] + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + $cfg['compiler']['defines']['items'] << 'TEST' + + include_dirs = get_local_include_dirs + + # Build and execute each unit test + test_files.each do |test| + obj_list = [] + + # Detect dependencies and build required modules + extract_headers(test).each do |header| + # Compile corresponding source file if it exists + src_file = find_source_file(header, include_dirs) + if !src_file.nil? + compile(src_file, test_defines) + obj_list << header.ext($cfg['compiler']['object_files']['extension']) + end + end + + # Build the test runner (generate if configured to do so) + test_base = File.basename(test, C_EXTENSION) + + runner_name = test_base + '_Runner.c' + runner_path = '' + + if $cfg['compiler']['runner_path'].nil? + runner_path = $cfg['compiler']['build_path'] + runner_name + else + runner_path = $cfg['compiler']['runner_path'] + runner_name + end + + options = $cfg[:unity] + options[:use_param_tests] = (test =~ /parameterized/) ? true : false + UnityTestRunnerGenerator.new(options).run(test, runner_path) + + compile(runner_path, test_defines) + obj_list << runner_name.ext($cfg['compiler']['object_files']['extension']) + + # Build the test module + compile(test, test_defines) + obj_list << test_base.ext($cfg['compiler']['object_files']['extension']) + + # Link the test executable + link(test_base, obj_list) + + # Execute unit test and generate results file + simulator = build_simulator_fields + executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] + if simulator.nil? + cmd_str = executable + else + cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" + end + output = execute(cmd_str) + test_results = $cfg['compiler']['build_path'] + test_base + if output.match(/OK$/m).nil? + test_results += '.testfail' + else + test_results += '.testpass' + end + File.open(test_results, 'w') { |f| f.print output } + + end + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/release/build.info b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/release/build.info new file mode 100644 index 0000000..7871b21 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/release/build.info @@ -0,0 +1,2 @@ +118 + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/release/version.info b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/release/version.info new file mode 100644 index 0000000..0d71c08 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/release/version.info @@ -0,0 +1,2 @@ +2.0 + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/src/unity.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/src/unity.c new file mode 100644 index 0000000..d85b880 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/src/unity.c @@ -0,0 +1,855 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity.h" +#include +#include + +#define UNITY_FAIL_AND_BAIL { Unity.CurrentTestFailed = 1; UNITY_OUTPUT_CHAR('\n'); longjmp(Unity.AbortFrame, 1); } +#define UNITY_IGNORE_AND_BAIL { Unity.CurrentTestIgnored = 1; UNITY_OUTPUT_CHAR('\n'); longjmp(Unity.AbortFrame, 1); } +/// return prematurely if we are already in failure or ignore state +#define UNITY_SKIP_EXECUTION { if ((Unity.CurrentTestFailed != 0) || (Unity.CurrentTestIgnored != 0)) {return;} } +#define UNITY_PRINT_EOL { UNITY_OUTPUT_CHAR('\n'); } + +struct _Unity Unity = { 0 }; + +const char* UnityStrNull = "NULL"; +const char* UnityStrSpacer = ". "; +const char* UnityStrExpected = " Expected "; +const char* UnityStrWas = " Was "; +const char* UnityStrTo = " To "; +const char* UnityStrElement = " Element "; +const char* UnityStrMemory = " Memory Mismatch"; +const char* UnityStrDelta = " Values Not Within Delta "; +const char* UnityStrPointless= " You Asked Me To Compare Nothing, Which Was Pointless."; +const char* UnityStrNullPointerForExpected= " Expected pointer to be NULL"; +const char* UnityStrNullPointerForActual = " Actual pointer was NULL"; + +const _U_UINT UnitySizeMask[] = +{ + 255, + 65535, + 65535, + 4294967295, + 4294967295, + 4294967295, + 4294967295 +#ifdef UNITY_SUPPORT_64 + ,0xFFFFFFFFFFFFFFFF +#endif +}; + +//----------------------------------------------- +// Pretty Printers & Test Result Output Handlers +//----------------------------------------------- + +void UnityPrint(const char* string) +{ + const char* pch = string; + + if (pch != NULL) + { + while (*pch) + { + // printable characters plus CR & LF are printed + if ((*pch <= 126) && (*pch >= 32)) + { + UNITY_OUTPUT_CHAR(*pch); + } + //write escaped carriage returns + else if (*pch == 13) + { + UNITY_OUTPUT_CHAR('\\'); + UNITY_OUTPUT_CHAR('r'); + } + //write escaped line feeds + else if (*pch == 10) + { + UNITY_OUTPUT_CHAR('\\'); + UNITY_OUTPUT_CHAR('n'); + } + // unprintable characters are shown as codes + else + { + UNITY_OUTPUT_CHAR('\\'); + UnityPrintNumberHex((_U_SINT)*pch, 2); + } + pch++; + } + } +} + +//----------------------------------------------- +void UnityPrintNumberByStyle(const _U_SINT number, const UNITY_DISPLAY_STYLE_T style) +{ + if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT) + { + UnityPrintNumber(number); + } + else if ((style & UNITY_DISPLAY_RANGE_UINT) == UNITY_DISPLAY_RANGE_UINT) + { + UnityPrintNumberUnsigned( (_U_UINT)number & UnitySizeMask[((_U_UINT)style & (_U_UINT)0x0F) - 1] ); + } + else + { + UnityPrintNumberHex((_U_UINT)number, (style & 0x000F) << 1); + } +} + +//----------------------------------------------- +/// basically do an itoa using as little ram as possible +void UnityPrintNumber(const _U_SINT number_to_print) +{ + _U_SINT divisor = 1; + _U_SINT next_divisor; + _U_SINT number = number_to_print; + + if (number < 0) + { + UNITY_OUTPUT_CHAR('-'); + number = -number; + } + + // figure out initial divisor + while (number / divisor > 9) + { + next_divisor = divisor * 10; + if (next_divisor > divisor) + divisor = next_divisor; + else + break; + } + + // now mod and print, then divide divisor + do + { + UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10))); + divisor /= 10; + } + while (divisor > 0); +} + +//----------------------------------------------- +/// basically do an itoa using as little ram as possible +void UnityPrintNumberUnsigned(const _U_UINT number) +{ + _U_UINT divisor = 1; + _U_UINT next_divisor; + + // figure out initial divisor + while (number / divisor > 9) + { + next_divisor = divisor * 10; + if (next_divisor > divisor) + divisor = next_divisor; + else + break; + } + + // now mod and print, then divide divisor + do + { + UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10))); + divisor /= 10; + } + while (divisor > 0); +} + +//----------------------------------------------- +void UnityPrintNumberHex(const _U_UINT number, const char nibbles_to_print) +{ + _U_UINT nibble; + char nibbles = nibbles_to_print; + UNITY_OUTPUT_CHAR('0'); + UNITY_OUTPUT_CHAR('x'); + + while (nibbles > 0) + { + nibble = (number >> (--nibbles << 2)) & 0x0000000F; + if (nibble <= 9) + { + UNITY_OUTPUT_CHAR((char)('0' + nibble)); + } + else + { + UNITY_OUTPUT_CHAR((char)('A' - 10 + nibble)); + } + } +} + +//----------------------------------------------- +void UnityPrintMask(const _U_UINT mask, const _U_UINT number) +{ + _U_UINT current_bit = (_U_UINT)1 << (UNITY_INT_WIDTH - 1); + _US32 i; + + for (i = 0; i < UNITY_INT_WIDTH; i++) + { + if (current_bit & mask) + { + if (current_bit & number) + { + UNITY_OUTPUT_CHAR('1'); + } + else + { + UNITY_OUTPUT_CHAR('0'); + } + } + else + { + UNITY_OUTPUT_CHAR('X'); + } + current_bit = current_bit >> 1; + } +} + +//----------------------------------------------- +#ifdef UNITY_FLOAT_VERBOSE +void UnityPrintFloat(_UF number) +{ + char TempBuffer[32]; + sprintf(TempBuffer, "%.6f", number); + UnityPrint(TempBuffer); +} +#endif + +//----------------------------------------------- +void UnityTestResultsBegin(const char* file, const UNITY_LINE_TYPE line) +{ + UnityPrint(file); + UNITY_OUTPUT_CHAR(':'); + UnityPrintNumber(line); + UNITY_OUTPUT_CHAR(':'); + UnityPrint(Unity.CurrentTestName); + UNITY_OUTPUT_CHAR(':'); +} + +//----------------------------------------------- +void UnityTestResultsFailBegin(const UNITY_LINE_TYPE line) +{ + UnityTestResultsBegin(Unity.TestFile, line); + UnityPrint("FAIL:"); +} + +//----------------------------------------------- +void UnityConcludeTest(void) +{ + if (Unity.CurrentTestIgnored) + { + Unity.TestIgnores++; + } + else if (!Unity.CurrentTestFailed) + { + UnityTestResultsBegin(Unity.TestFile, Unity.CurrentTestLineNumber); + UnityPrint("PASS"); + UNITY_PRINT_EOL; + } + else + { + Unity.TestFailures++; + } + + Unity.CurrentTestFailed = 0; + Unity.CurrentTestIgnored = 0; +} + +//----------------------------------------------- +void UnityAddMsgIfSpecified(const char* msg) +{ + if (msg) + { + UnityPrint(UnityStrSpacer); + UnityPrint(msg); + } +} + +//----------------------------------------------- +void UnityPrintExpectedAndActualStrings(const char* expected, const char* actual) +{ + UnityPrint(UnityStrExpected); + if (expected != NULL) + { + UNITY_OUTPUT_CHAR('\''); + UnityPrint(expected); + UNITY_OUTPUT_CHAR('\''); + } + else + { + UnityPrint(UnityStrNull); + } + UnityPrint(UnityStrWas); + if (actual != NULL) + { + UNITY_OUTPUT_CHAR('\''); + UnityPrint(actual); + UNITY_OUTPUT_CHAR('\''); + } + else + { + UnityPrint(UnityStrNull); + } +} + +//----------------------------------------------- +// Assertion & Control Helpers +//----------------------------------------------- + +int UnityCheckArraysForNull(const void* expected, const void* actual, const UNITY_LINE_TYPE lineNumber, const char* msg) +{ + //return true if they are both NULL + if ((expected == NULL) && (actual == NULL)) + return 1; + + //throw error if just expected is NULL + if (expected == NULL) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrNullPointerForExpected); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + //throw error if just actual is NULL + if (actual == NULL) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrNullPointerForActual); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + //return false if neither is NULL + return 0; +} + +//----------------------------------------------- +// Assertion Functions +//----------------------------------------------- + +void UnityAssertBits(const _U_SINT mask, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + UNITY_SKIP_EXECUTION; + + if ((mask & expected) != (mask & actual)) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrExpected); + UnityPrintMask(mask, expected); + UnityPrint(UnityStrWas); + UnityPrintMask(mask, actual); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualNumber(const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style) +{ + UNITY_SKIP_EXECUTION; + + if (expected != actual) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(expected, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(actual, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualIntArray(const _U_SINT* expected, + const _U_SINT* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style) +{ + _UU32 elements = num_elements; + const _US8* ptr_exp = (_US8*)expected; + const _US8* ptr_act = (_US8*)actual; + + UNITY_SKIP_EXECUTION; + + if (elements == 0) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + switch(style) + { + case UNITY_DISPLAY_STYLE_HEX8: + case UNITY_DISPLAY_STYLE_INT8: + case UNITY_DISPLAY_STYLE_UINT8: + while (elements--) + { + if (*ptr_exp != *ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 1; + ptr_act += 1; + } + break; + case UNITY_DISPLAY_STYLE_HEX16: + case UNITY_DISPLAY_STYLE_INT16: + case UNITY_DISPLAY_STYLE_UINT16: + while (elements--) + { + if (*(_US16*)ptr_exp != *(_US16*)ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*(_US16*)ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*(_US16*)ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 2; + ptr_act += 2; + } + break; +#ifdef UNITY_SUPPORT_64 + case UNITY_DISPLAY_STYLE_HEX64: + case UNITY_DISPLAY_STYLE_INT64: + case UNITY_DISPLAY_STYLE_UINT64: + while (elements--) + { + if (*(_US64*)ptr_exp != *(_US64*)ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*(_US64*)ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*(_US64*)ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 8; + ptr_act += 8; + } + break; +#endif + default: + while (elements--) + { + if (*(_US32*)ptr_exp != *(_US32*)ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*(_US32*)ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*(_US32*)ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 4; + ptr_act += 4; + } + break; + } +} + +//----------------------------------------------- +#ifndef UNITY_EXCLUDE_FLOAT +void UnityAssertEqualFloatArray(const _UF* expected, + const _UF* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UU32 elements = num_elements; + const _UF* ptr_expected = expected; + const _UF* ptr_actual = actual; + _UF diff, tol; + + UNITY_SKIP_EXECUTION; + + if (elements == 0) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + while (elements--) + { + diff = *ptr_expected - *ptr_actual; + if (diff < 0.0) + diff = 0.0 - diff; + tol = UNITY_FLOAT_PRECISION * *ptr_expected; + if (tol < 0.0) + tol = 0.0 - tol; + if (diff > tol) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); +#ifdef UNITY_FLOAT_VERBOSE + UnityPrint(UnityStrExpected); + UnityPrintFloat(*ptr_expected); + UnityPrint(UnityStrWas); + UnityPrintFloat(*ptr_actual); +#else + UnityPrint(UnityStrDelta); +#endif + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_expected++; + ptr_actual++; + } +} + +//----------------------------------------------- +void UnityAssertFloatsWithin(const _UF delta, + const _UF expected, + const _UF actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UF diff = actual - expected; + _UF pos_delta = delta; + + UNITY_SKIP_EXECUTION; + + if (diff < 0) + { + diff = 0.0f - diff; + } + if (pos_delta < 0) + { + pos_delta = 0.0f - pos_delta; + } + + if (pos_delta < diff) + { + UnityTestResultsFailBegin(lineNumber); +#ifdef UNITY_FLOAT_VERBOSE + UnityPrint(UnityStrExpected); + UnityPrintFloat(expected); + UnityPrint(UnityStrWas); + UnityPrintFloat(actual); +#else + UnityPrint(UnityStrDelta); +#endif + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} +#endif + +//----------------------------------------------- +void UnityAssertNumbersWithin( const _U_SINT delta, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style) +{ + UNITY_SKIP_EXECUTION; + + if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT) + { + if (actual > expected) + Unity.CurrentTestFailed = ((actual - expected) > delta); + else + Unity.CurrentTestFailed = ((expected - actual) > delta); + } + else + { + if ((_U_UINT)actual > (_U_UINT)expected) + Unity.CurrentTestFailed = ((_U_UINT)(actual - expected) > (_U_UINT)delta); + else + Unity.CurrentTestFailed = ((_U_UINT)(expected - actual) > (_U_UINT)delta); + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrDelta); + UnityPrintNumberByStyle(delta, style); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(expected, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(actual, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualString(const char* expected, + const char* actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UU32 i; + + UNITY_SKIP_EXECUTION; + + // if both pointers not null compare the strings + if (expected && actual) + { + for (i = 0; expected[i] || actual[i]; i++) + { + if (expected[i] != actual[i]) + { + Unity.CurrentTestFailed = 1; + break; + } + } + } + else + { // handle case of one pointers being null (if both null, test should pass) + if (expected != actual) + { + Unity.CurrentTestFailed = 1; + } + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrintExpectedAndActualStrings(expected, actual); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualStringArray( const char** expected, + const char** actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UU32 i, j = 0; + + UNITY_SKIP_EXECUTION; + + // if no elements, it's an error + if (num_elements == 0) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + do + { + // if both pointers not null compare the strings + if (expected[j] && actual[j]) + { + for (i = 0; expected[j][i] || actual[j][i]; i++) + { + if (expected[j][i] != actual[j][i]) + { + Unity.CurrentTestFailed = 1; + break; + } + } + } + else + { // handle case of one pointers being null (if both null, test should pass) + if (expected[j] != actual[j]) + { + Unity.CurrentTestFailed = 1; + } + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + if (num_elements > 1) + { + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - j - 1), UNITY_DISPLAY_STYLE_UINT); + } + UnityPrintExpectedAndActualStrings((const char*)(expected[j]), (const char*)(actual[j])); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + } while (++j < num_elements); +} + +//----------------------------------------------- +void UnityAssertEqualMemory( const void* expected, + const void* actual, + _UU32 length, + _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + unsigned char* expected_ptr = (unsigned char*)expected; + unsigned char* actual_ptr = (unsigned char*)actual; + _UU32 elements = num_elements; + + UNITY_SKIP_EXECUTION; + + if ((elements == 0) || (length == 0)) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + while (elements--) + { + if (memcmp((const void*)expected_ptr, (const void*)actual_ptr, length) != 0) + { + Unity.CurrentTestFailed = 1; + break; + } + expected_ptr += length; + actual_ptr += length; + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + if (num_elements > 1) + { + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + } + UnityPrint(UnityStrMemory); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +// Control Functions +//----------------------------------------------- + +void UnityFail(const char* msg, const UNITY_LINE_TYPE line) +{ + UNITY_SKIP_EXECUTION; + + UnityTestResultsBegin(Unity.TestFile, line); + UnityPrint("FAIL"); + if (msg != NULL) + { + UNITY_OUTPUT_CHAR(':'); + if (msg[0] != ' ') + { + UNITY_OUTPUT_CHAR(' '); + } + UnityPrint(msg); + } + UNITY_FAIL_AND_BAIL; +} + +//----------------------------------------------- +void UnityIgnore(const char* msg, const UNITY_LINE_TYPE line) +{ + UNITY_SKIP_EXECUTION; + + UnityTestResultsBegin(Unity.TestFile, line); + UnityPrint("IGNORE"); + if (msg != NULL) + { + UNITY_OUTPUT_CHAR(':'); + UNITY_OUTPUT_CHAR(' '); + UnityPrint(msg); + } + UNITY_IGNORE_AND_BAIL; +} + +//----------------------------------------------- +void setUp(void); +void tearDown(void); +void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum) +{ + Unity.CurrentTestName = FuncName; + Unity.CurrentTestLineNumber = FuncLineNum; + Unity.NumberOfTests++; + if (TEST_PROTECT()) + { + setUp(); + Func(); + } + if (TEST_PROTECT() && !(Unity.CurrentTestIgnored)) + { + tearDown(); + } + UnityConcludeTest(); +} + +//----------------------------------------------- +void UnityBegin(void) +{ + Unity.NumberOfTests = 0; +} + +//----------------------------------------------- +int UnityEnd(void) +{ + UnityPrint("-----------------------"); + UNITY_PRINT_EOL; + UnityPrintNumber(Unity.NumberOfTests); + UnityPrint(" Tests "); + UnityPrintNumber(Unity.TestFailures); + UnityPrint(" Failures "); + UnityPrintNumber(Unity.TestIgnores); + UnityPrint(" Ignored"); + UNITY_PRINT_EOL; + if (Unity.TestFailures == 0U) + { + UnityPrint("OK"); + } + else + { + UnityPrint("FAIL"); + } + UNITY_PRINT_EOL; + return Unity.TestFailures; +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/src/unity.h b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/src/unity.h new file mode 100644 index 0000000..0b1b187 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/src/unity.h @@ -0,0 +1,213 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FRAMEWORK_H +#define UNITY_FRAMEWORK_H + +#define UNITY + +#include "unity_internals.h" + +//------------------------------------------------------- +// Configuration Options +//------------------------------------------------------- + +// Integers +// - Unity assumes 32 bit integers by default +// - If your compiler treats ints of a different size, define UNITY_INT_WIDTH + +// Floats +// - define UNITY_EXCLUDE_FLOAT to disallow floating point comparisons +// - define UNITY_FLOAT_PRECISION to specify the precision to use when doing TEST_ASSERT_EQUAL_FLOAT +// - define UNITY_FLOAT_TYPE to specify doubles instead of single precision floats +// - define UNITY_FLOAT_VERBOSE to print floating point values in errors (uses sprintf) + +// Output +// - by default, Unity prints to standard out with putchar. define UNITY_OUTPUT_CHAR(a) with a different function if desired + +// Optimization +// - by default, line numbers are stored in unsigned shorts. Define UNITY_LINE_TYPE with a different type if your files are huge +// - by default, test and failure counters are unsigned shorts. Define UNITY_COUNTER_TYPE with a different type if you want to save space or have more than 65535 Tests. + +// Test Cases +// - define UNITY_SUPPORT_TEST_CASES to include the TEST_CASE macro, though really it's mostly about the runner generator script + +// Parameterized Tests +// - you'll want to create a define of TEST_CASE(...) which basically evaluates to nothing + +//------------------------------------------------------- +// Test Running Macros +//------------------------------------------------------- + +#define TEST_PROTECT() (setjmp(Unity.AbortFrame) == 0) + +#define TEST_ABORT() {longjmp(Unity.AbortFrame, 1);} + +#ifndef RUN_TEST +#define RUN_TEST(func, line_num) UnityDefaultTestRun(func, #func, line_num) +#endif + +#define TEST_LINE_NUM (Unity.CurrentTestLineNumber) +#define TEST_IS_IGNORED (Unity.CurrentTestIgnored) + +//------------------------------------------------------- +// Basic Fail and Ignore +//------------------------------------------------------- + +#define TEST_FAIL_MESSAGE(message) UNITY_TEST_FAIL(__LINE__, message) +#define TEST_FAIL() UNITY_TEST_FAIL(__LINE__, NULL) +#define TEST_IGNORE_MESSAGE(message) UNITY_TEST_IGNORE(__LINE__, message) +#define TEST_IGNORE() UNITY_TEST_IGNORE(__LINE__, NULL) +#define TEST_ONLY() + +//------------------------------------------------------- +// Test Asserts (simple) +//------------------------------------------------------- + +//Boolean +#define TEST_ASSERT(condition) UNITY_TEST_ASSERT( (condition), __LINE__, " Expression Evaluated To FALSE") +#define TEST_ASSERT_TRUE(condition) UNITY_TEST_ASSERT( (condition), __LINE__, " Expected TRUE Was FALSE") +#define TEST_ASSERT_UNLESS(condition) UNITY_TEST_ASSERT( !(condition), __LINE__, " Expression Evaluated To TRUE") +#define TEST_ASSERT_FALSE(condition) UNITY_TEST_ASSERT( !(condition), __LINE__, " Expected FALSE Was TRUE") +#define TEST_ASSERT_NULL(pointer) UNITY_TEST_ASSERT_NULL( (pointer), __LINE__, " Expected NULL") +#define TEST_ASSERT_NOT_NULL(pointer) UNITY_TEST_ASSERT_NOT_NULL((pointer), __LINE__, " Expected Non-NULL") + +//Integers (of all sizes) +#define TEST_ASSERT_EQUAL_INT(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT8(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT8((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT16(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT16((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT32(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT32((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT64(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT64((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_NOT_EQUAL(expected, actual) UNITY_TEST_ASSERT(((expected) != (actual)), __LINE__, " Expected Not-Equal") +#define TEST_ASSERT_EQUAL_UINT(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT8(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT8( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT16(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT16( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT32(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT32( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT64(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT64( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX8(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX8( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX16(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX16((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX32(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX64(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX64((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_BITS(mask, expected, actual) UNITY_TEST_ASSERT_BITS((mask), (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_BITS_HIGH(mask, actual) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(-1), (actual), __LINE__, NULL) +#define TEST_ASSERT_BITS_LOW(mask, actual) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(0), (actual), __LINE__, NULL) +#define TEST_ASSERT_BIT_HIGH(bit, actual) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(-1), (actual), __LINE__, NULL) +#define TEST_ASSERT_BIT_LOW(bit, actual) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(0), (actual), __LINE__, NULL) + +//Integer Ranges (of all sizes) +#define TEST_ASSERT_INT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_UINT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX8_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX16_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX32_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX64_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, __LINE__, NULL) + +//Structs and Strings +#define TEST_ASSERT_EQUAL_PTR(expected, actual) UNITY_TEST_ASSERT_EQUAL_PTR((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_STRING(expected, actual) UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_MEMORY(expected, actual, len) UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, __LINE__, NULL) + +//Arrays +#define TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements) UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, __LINE__, NULL) + +//Floating Point (If Enabled) +#define TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_FLOAT(expected, actual) UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, __LINE__, NULL) + +//------------------------------------------------------- +// Test Asserts (with additional messages) +//------------------------------------------------------- + +//Boolean +#define TEST_ASSERT_MESSAGE(condition, message) UNITY_TEST_ASSERT( (condition), __LINE__, message) +#define TEST_ASSERT_TRUE_MESSAGE(condition, message) UNITY_TEST_ASSERT( (condition), __LINE__, message) +#define TEST_ASSERT_UNLESS_MESSAGE(condition, message) UNITY_TEST_ASSERT( !(condition), __LINE__, message) +#define TEST_ASSERT_FALSE_MESSAGE(condition, message) UNITY_TEST_ASSERT( !(condition), __LINE__, message) +#define TEST_ASSERT_NULL_MESSAGE(pointer, message) UNITY_TEST_ASSERT_NULL( (pointer), __LINE__, message) +#define TEST_ASSERT_NOT_NULL_MESSAGE(pointer, message) UNITY_TEST_ASSERT_NOT_NULL((pointer), __LINE__, message) + +//Integers (of all sizes) +#define TEST_ASSERT_EQUAL_INT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT8((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT16((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT32((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT64((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, message) +#define TEST_ASSERT_NOT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT(((expected) != (actual)), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT8( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT16( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT32( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT64( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX8( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX16((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX64((expected), (actual), __LINE__, message) +#define TEST_ASSERT_BITS_MESSAGE(mask, expected, actual, message) UNITY_TEST_ASSERT_BITS((mask), (expected), (actual), __LINE__, message) +#define TEST_ASSERT_BITS_HIGH_MESSAGE(mask, actual, message) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(-1), (actual), __LINE__, message) +#define TEST_ASSERT_BITS_LOW_MESSAGE(mask, actual, message) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(0), (actual), __LINE__, message) +#define TEST_ASSERT_BIT_HIGH_MESSAGE(bit, actual, message) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(-1), (actual), __LINE__, message) +#define TEST_ASSERT_BIT_LOW_MESSAGE(bit, actual, message) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(0), (actual), __LINE__, message) + +//Integer Ranges (of all sizes) +#define TEST_ASSERT_INT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_UINT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX8_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX16_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX32_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX64_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, __LINE__, message) + +//Structs and Strings +#define TEST_ASSERT_EQUAL_PTR_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_PTR(expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_STRING_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_MEMORY_MESSAGE(expected, actual, len, message) UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, __LINE__, message) + +//Arrays +#define TEST_ASSERT_EQUAL_INT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_STRING_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_MEMORY_ARRAY_MESSAGE(expected, actual, len, num_elements, message) UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, __LINE__, message) + +//Floating Point (If Enabled) +#define TEST_ASSERT_FLOAT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_FLOAT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_FLOAT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, __LINE__, message) +#endif diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/src/unity_internals.h b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/src/unity_internals.h new file mode 100644 index 0000000..29c9d1d --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/src/unity_internals.h @@ -0,0 +1,355 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_INTERNALS_H +#define UNITY_INTERNALS_H + +#include +#include + +//------------------------------------------------------- +// Int Support +//------------------------------------------------------- + +#ifndef UNITY_INT_WIDTH +#define UNITY_INT_WIDTH (32) +#endif + +#ifndef UNITY_LONG_WIDTH +#define UNITY_LONG_WIDTH (32) +#endif + +#if (UNITY_INT_WIDTH == 32) + typedef unsigned char _UU8; + typedef unsigned short _UU16; + typedef unsigned int _UU32; + typedef signed char _US8; + typedef signed short _US16; + typedef signed int _US32; +#elif (UNITY_INT_WIDTH == 16) + typedef unsigned char _UU8; + typedef unsigned int _UU16; + typedef unsigned long _UU32; + typedef signed char _US8; + typedef signed int _US16; + typedef signed long _US32; +#else + #error Invalid UNITY_INT_WIDTH specified! (16 or 32 are supported) +#endif + +//------------------------------------------------------- +// 64-bit Support +//------------------------------------------------------- + +#ifndef UNITY_SUPPORT_64 + +//No 64-bit Support +typedef _UU32 _U_UINT; +typedef _US32 _U_SINT; + +#else + +//64-bit Support +#if (UNITY_LONG_WIDTH == 32) + typedef unsigned long long _UU64; + typedef signed long long _US64; +#elif (UNITY_LONG_WIDTH == 64) + typedef unsigned long _UU64; + typedef signed long _US64; +#else + #error Invalid UNITY_LONG_WIDTH specified! (32 or 64 are supported) +#endif +typedef _UU64 _U_UINT; +typedef _US64 _U_SINT; + +#endif + +//------------------------------------------------------- +// Pointer Support +//------------------------------------------------------- + +#ifndef UNITY_POINTER_WIDTH +#define UNITY_POINTER_WIDTH (32) +#endif + +#if (UNITY_POINTER_WIDTH == 32) + typedef _UU32 _UP; +#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX32 +#elif (UNITY_POINTER_WIDTH == 64) + typedef _UU64 _UP; +#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX64 +#elif (UNITY_POINTER_WIDTH == 16) + typedef _UU16 _UP; +#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX16 +#else + #error Invalid UNITY_POINTER_WIDTH specified! (16, 32 or 64 are supported) +#endif + +//------------------------------------------------------- +// Float Support +//------------------------------------------------------- + +#ifdef UNITY_EXCLUDE_FLOAT + +//No Floating Point Support +#undef UNITY_FLOAT_PRECISION +#undef UNITY_FLOAT_TYPE +#undef UNITY_FLOAT_VERBOSE + +#else + +//Floating Point Support +#ifndef UNITY_FLOAT_PRECISION +#define UNITY_FLOAT_PRECISION (0.00001f) +#endif +#ifndef UNITY_FLOAT_TYPE +#define UNITY_FLOAT_TYPE float +#endif +typedef UNITY_FLOAT_TYPE _UF; + +#endif + +//------------------------------------------------------- +// Output Method +//------------------------------------------------------- + +#ifndef UNITY_OUTPUT_CHAR +//Default to using putchar, which is defined in stdio.h above +#define UNITY_OUTPUT_CHAR(a) putchar(a) +#else +//If defined as something else, make sure we declare it here so it's ready for use +extern int UNITY_OUTPUT_CHAR(int); +#endif + +//------------------------------------------------------- +// Footprint +//------------------------------------------------------- + +#ifndef UNITY_LINE_TYPE +#define UNITY_LINE_TYPE unsigned short +#endif + +#ifndef UNITY_COUNTER_TYPE +#define UNITY_COUNTER_TYPE unsigned short +#endif + +//------------------------------------------------------- +// Internal Structs Needed +//------------------------------------------------------- + +typedef void (*UnityTestFunction)(void); + +#define UNITY_DISPLAY_RANGE_INT (0x10) +#define UNITY_DISPLAY_RANGE_UINT (0x20) +#define UNITY_DISPLAY_RANGE_HEX (0x40) +#define UNITY_DISPLAY_RANGE_AUTO (0x80) + +typedef enum +{ + UNITY_DISPLAY_STYLE_INT = 4 + UNITY_DISPLAY_RANGE_INT + UNITY_DISPLAY_RANGE_AUTO, + UNITY_DISPLAY_STYLE_INT8 = 1 + UNITY_DISPLAY_RANGE_INT, + UNITY_DISPLAY_STYLE_INT16 = 2 + UNITY_DISPLAY_RANGE_INT, + UNITY_DISPLAY_STYLE_INT32 = 4 + UNITY_DISPLAY_RANGE_INT, +#ifdef UNITY_SUPPORT_64 + UNITY_DISPLAY_STYLE_INT64 = 8 + UNITY_DISPLAY_RANGE_INT, +#endif + UNITY_DISPLAY_STYLE_UINT = 4 + UNITY_DISPLAY_RANGE_UINT + UNITY_DISPLAY_RANGE_AUTO, + UNITY_DISPLAY_STYLE_UINT8 = 1 + UNITY_DISPLAY_RANGE_UINT, + UNITY_DISPLAY_STYLE_UINT16 = 2 + UNITY_DISPLAY_RANGE_UINT, + UNITY_DISPLAY_STYLE_UINT32 = 4 + UNITY_DISPLAY_RANGE_UINT, +#ifdef UNITY_SUPPORT_64 + UNITY_DISPLAY_STYLE_UINT64 = 8 + UNITY_DISPLAY_RANGE_UINT, +#endif + UNITY_DISPLAY_STYLE_HEX8 = 1 + UNITY_DISPLAY_RANGE_HEX, + UNITY_DISPLAY_STYLE_HEX16 = 2 + UNITY_DISPLAY_RANGE_HEX, + UNITY_DISPLAY_STYLE_HEX32 = 4 + UNITY_DISPLAY_RANGE_HEX, +#ifdef UNITY_SUPPORT_64 + UNITY_DISPLAY_STYLE_HEX64 = 8 + UNITY_DISPLAY_RANGE_HEX, +#endif +} UNITY_DISPLAY_STYLE_T; + +struct _Unity +{ + const char* TestFile; + const char* CurrentTestName; + _UU32 CurrentTestLineNumber; + UNITY_COUNTER_TYPE NumberOfTests; + UNITY_COUNTER_TYPE TestFailures; + UNITY_COUNTER_TYPE TestIgnores; + UNITY_COUNTER_TYPE CurrentTestFailed; + UNITY_COUNTER_TYPE CurrentTestIgnored; + jmp_buf AbortFrame; +}; + +extern struct _Unity Unity; + +//------------------------------------------------------- +// Test Suite Management +//------------------------------------------------------- + +void UnityBegin(void); +int UnityEnd(void); +void UnityConcludeTest(void); +void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum); + +//------------------------------------------------------- +// Test Output +//------------------------------------------------------- + +void UnityPrint(const char* string); +void UnityPrintMask(const _U_UINT mask, const _U_UINT number); +void UnityPrintNumberByStyle(const _U_SINT number, const UNITY_DISPLAY_STYLE_T style); +void UnityPrintNumber(const _U_SINT number); +void UnityPrintNumberUnsigned(const _U_UINT number); +void UnityPrintNumberHex(const _U_UINT number, const char nibbles); + +#ifdef UNITY_FLOAT_VERBOSE +void UnityPrintFloat(const _UF number); +#endif + +//------------------------------------------------------- +// Test Assertion Fuctions +//------------------------------------------------------- +// Use the macros below this section instead of calling +// these directly. The macros have a consistent naming +// convention and will pull in file and line information +// for you. + +void UnityAssertEqualNumber(const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style); + +void UnityAssertEqualIntArray(const _U_SINT* expected, + const _U_SINT* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style); + +void UnityAssertBits(const _U_SINT mask, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualString(const char* expected, + const char* actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualStringArray( const char** expected, + const char** actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualMemory( const void* expected, + const void* actual, + const _UU32 length, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertNumbersWithin(const _U_SINT delta, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style); + +void UnityFail(const char* message, const UNITY_LINE_TYPE line); + +void UnityIgnore(const char* message, const UNITY_LINE_TYPE line); + +#ifndef UNITY_EXCLUDE_FLOAT +void UnityAssertFloatsWithin(const _UF delta, + const _UF expected, + const _UF actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualFloatArray(const _UF* expected, + const _UF* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber); +#endif + +//------------------------------------------------------- +// Basic Fail and Ignore +//------------------------------------------------------- + +#define UNITY_TEST_FAIL(line, message) UnityFail( (message), (UNITY_LINE_TYPE)line); +#define UNITY_TEST_IGNORE(line, message) UnityIgnore( (message), (UNITY_LINE_TYPE)line); + +//------------------------------------------------------- +// Test Asserts +//------------------------------------------------------- + +#define UNITY_TEST_ASSERT(condition, line, message) if (condition) {} else {UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, message);} +#define UNITY_TEST_ASSERT_NULL(pointer, line, message) UNITY_TEST_ASSERT(((pointer) == NULL), (UNITY_LINE_TYPE)line, message) +#define UNITY_TEST_ASSERT_NOT_NULL(pointer, line, message) UNITY_TEST_ASSERT(((pointer) != NULL), (UNITY_LINE_TYPE)line, message) + +#define UNITY_TEST_ASSERT_EQUAL_INT(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_UINT(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_HEX8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX8) +#define UNITY_TEST_ASSERT_EQUAL_HEX16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX16) +#define UNITY_TEST_ASSERT_EQUAL_HEX32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX32) +#define UNITY_TEST_ASSERT_BITS(mask, expected, actual, line, message) UnityAssertBits((_U_SINT)(mask), (_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line) + +#define UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX8) +#define UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX16) +#define UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX32) +#define UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64) + +#define UNITY_TEST_ASSERT_EQUAL_PTR(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(_UP)(expected), (_U_SINT)(_UP)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_POINTER) +#define UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, line, message) UnityAssertEqualString((const char*)(expected), (const char*)(actual), (message), (UNITY_LINE_TYPE)line) +#define UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, line, message) UnityAssertEqualMemory((void*)(expected), (void*)(actual), (_UU32)(len), 1, (message), (UNITY_LINE_TYPE)line) + +#define UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT8) +#define UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT16) +#define UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT32) +#define UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT8) +#define UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT16) +#define UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT32) +#define UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX8) +#define UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX16) +#define UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX32) +#define UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualStringArray((const char**)(expected), (const char**)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line) +#define UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, line, message) UnityAssertEqualMemory((void*)(expected), (void*)(actual), (_UU32)(len), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line) + +#ifdef UNITY_SUPPORT_64 +#define UNITY_TEST_ASSERT_EQUAL_INT64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT64) +#define UNITY_TEST_ASSERT_EQUAL_UINT64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT64) +#define UNITY_TEST_ASSERT_EQUAL_HEX64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64) +#define UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT64) +#define UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT64) +#define UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64) +#endif + +#ifdef UNITY_EXCLUDE_FLOAT +#define UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled") +#define UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled") +#define UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled") +#else +#define UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, line, message) UnityAssertFloatsWithin((_UF)(delta), (_UF)(expected), (_UF)(actual), (message), (UNITY_LINE_TYPE)line) +#define UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, line, message) UNITY_TEST_ASSERT_FLOAT_WITHIN((_UF)(expected) * (_UF)UNITY_FLOAT_PRECISION, (_UF)expected, (_UF)actual, (UNITY_LINE_TYPE)line, message) +#define UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualFloatArray((_UF*)(expected), (_UF*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line) +#endif + +#endif diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/targets/gcc.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/targets/gcc.yml new file mode 100644 index 0000000..0f18c6c --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/targets/gcc.yml @@ -0,0 +1,42 @@ +compiler: + path: gcc + source_path: 'src/' + unit_tests_path: &unit_tests_path 'test/' + build_path: &build_path 'build/' + options: + - '-c' + - '-Wall' + - '-Wno-address' + - '-std=c99' + - '-pedantic' + includes: + prefix: '-I' + items: + - 'src/' + - '../src/' + - *unit_tests_path + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - UNITY_SUPPORT_TEST_CASES + object_files: + prefix: '-o' + extension: '.o' + destination: *build_path +linker: + path: gcc + options: + - -lm + includes: + prefix: '-I' + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.exe' + destination: *build_path +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/targets/gcc_64.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/targets/gcc_64.yml new file mode 100644 index 0000000..97cb958 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/targets/gcc_64.yml @@ -0,0 +1,43 @@ +compiler: + path: gcc + source_path: 'src/' + unit_tests_path: &unit_tests_path 'test/' + build_path: &build_path 'build/' + options: + - '-c' + - '-Wall' + - '-Wno-address' + - '-std=c99' + - '-pedantic' + includes: + prefix: '-I' + items: + - 'src/' + - '../src/' + - *unit_tests_path + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - UNITY_SUPPORT_TEST_CASES + - 'UNITY_POINTER_WIDTH=64' + object_files: + prefix: '-o' + extension: '.o' + destination: *build_path +linker: + path: gcc + options: + - -lm + includes: + prefix: '-I' + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.exe' + destination: *build_path +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/targets/hitech_picc18.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/targets/hitech_picc18.yml new file mode 100644 index 0000000..210d944 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/targets/hitech_picc18.yml @@ -0,0 +1,101 @@ +# rumor has it that this yaml file works for the standard edition of the +# hitech PICC18 compiler, but not the pro version. +# +compiler: + path: cd build && picc18 + source_path: 'c:\Projects\NexGen\Prototypes\CMockTest\src\' + unit_tests_path: &unit_tests_path 'c:\Projects\NexGen\Prototypes\CMockTest\test\' + build_path: &build_path 'c:\Projects\NexGen\Prototypes\CMockTest\build\' + options: + - --chip=18F87J10 + - --ide=hitide + - --q #quiet please + - --asmlist + - --codeoffset=0 + - --emi=wordwrite # External memory interface protocol + - --warn=0 # allow all normal warning messages + - --errors=10 # Number of errors before aborting compile + - --char=unsigned + - -Bl # Large memory model + - -G # generate symbol file + - --cp=16 # 16-bit pointers + - --double=24 + - -N255 # 255-char symbol names + - --opt=none # Do not use any compiler optimziations + - -c # compile only + - -M + includes: + prefix: '-I' + items: + - 'c:/Projects/NexGen/Prototypes/CMockTest/src/' + - 'c:/Projects/NexGen/Prototypes/CMockTest/mocks/' + - 'c:/CMock/src/' + - 'c:/CMock/examples/src/' + - 'c:/CMock/vendor/unity/src/' + - 'c:/CMock/vendor/unity/examples/helper/' + - *unit_tests_path + defines: + prefix: '-D' + items: + - UNITY_INT_WIDTH=16 + - UNITY_POINTER_WIDTH=16 + - CMOCK_MEM_STATIC + - CMOCK_MEM_SIZE=3000 + - UNITY_SUPPORT_TEST_CASES + - _PICC18 + object_files: + # prefix: '-O' # Hi-Tech doesn't want a prefix. They key off of filename .extensions, instead + extension: '.obj' + destination: *build_path + +linker: + path: cd build && picc18 + options: + - --chip=18F87J10 + - --ide=hitide + - --cp=24 # 24-bit pointers. Is this needed for linker?? + - --double=24 # Is this needed for linker?? + - -Lw # Scan the pic87*w.lib in the lib/ of the compiler installation directory + - --summary=mem,file # info listing + - --summary=+psect + - --summary=+hex + - --output=+intel + - --output=+mcof + - --runtime=+init # Directs startup code to copy idata, ibigdata and ifardata psects from ROM to RAM. + - --runtime=+clear # Directs startup code to clear bss, bigbss, rbss and farbss psects + - --runtime=+clib # link in the c-runtime + - --runtime=+keep # Keep the generated startup src after its obj is linked + - -G # Generate src-level symbol file + - -MIWasTheLastToBuild.map + - --warn=0 # allow all normal warning messages + - -Bl # Large memory model (probably not needed for linking) + includes: + prefix: '-I' + object_files: + path: *build_path + extension: '.obj' + bin_files: + prefix: '-O' + extension: '.hex' + destination: *build_path + +simulator: + path: + pre_support: + - 'java -client -jar ' # note space + - ['C:\Program Files\HI-TECH Software\HI-TIDE\3.15\lib\', 'simpic18.jar'] + - 18F87J10 + post_support: + +:cmock: + :plugins: [] + :includes: + - Types.h + :suite_teardown: | + if (num_failures) + _FAILED_TEST(); + else + _PASSED_TESTS(); + return 0; + +colour: true \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_arm_v4.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_arm_v4.yml new file mode 100644 index 0000000..c2e7f18 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_arm_v4.yml @@ -0,0 +1,89 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 4.0 Kickstart\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\lib\dl4tptinl8n.h'] + - -z3 + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian little + - --cpu ARM7TDMI + - --stack_align 4 + - --interwork + - -e + - --silent + - --warnings_are_errors + - --fpu None + - --diag_suppress Pa050 + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'common\bin\xlink.exe'] + options: + - -rt + - [*tools_root, 'arm\lib\dl4tptinl8n.r79'] + - -D_L_EXTMEM_START=0 + - -D_L_EXTMEM_SIZE=0 + - -D_L_HEAP_SIZE=120 + - -D_L_STACK_SIZE=32 + - -e_small_write=_formatted_write + - -s + - __program_start + - -f + - [*tools_root, '\arm\config\lnkarm.xcl'] + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\config\'] + - [*tools_root, 'arm\lib\'] + object_files: + path: *build_path + extension: '.r79' + bin_files: + prefix: '-o' + extension: '.d79' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\ioat91sam7X256.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_arm_v5.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_arm_v5.yml new file mode 100644 index 0000000..0549d8e --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_arm_v5.yml @@ -0,0 +1,79 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian=little + - --cpu=ARM7TDMI + - --interwork + - --warnings_are_errors + - --fpu=None + - --diag_suppress=Pa050 + - --diag_suppress=Pe111 + - -e + - -On + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\debugger\atmel\ioat91sam7X256.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_arm_v5_3.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_arm_v5_3.yml new file mode 100644 index 0000000..0549d8e --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_arm_v5_3.yml @@ -0,0 +1,79 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian=little + - --cpu=ARM7TDMI + - --interwork + - --warnings_are_errors + - --fpu=None + - --diag_suppress=Pa050 + - --diag_suppress=Pe111 + - -e + - -On + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\debugger\atmel\ioat91sam7X256.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml new file mode 100644 index 0000000..eb0785c --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml @@ -0,0 +1,93 @@ +#Default tool path for IAR 5.4 on Windows XP 64bit +tools_root: &tools_root 'C:\Program Files (x86)\IAR Systems\Embedded Workbench 5.4 Kickstart\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --diag_suppress=Pa050 + #- --diag_suppress=Pe111 + - --debug + - --endian=little + - --cpu=Cortex-M3 + - --no_path_in_file_macros + - -e + - --fpu=None + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + #- --preinclude --preinclude C:\Vss\T2 Working\common\system.h + - --interwork + - --warnings_are_errors +# - Ohz + - -Oh +# - --no_cse +# - --no_unroll +# - --no_inline +# - --no_code_motion +# - --no_tbaa +# - --no_clustering +# - --no_scheduling + + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - ewarm + - PART_LM3S9B92 + - TARGET_IS_TEMPEST_RB1 + - USE_ROM_DRIVERS + - UART_BUFFERED + - UNITY_SUPPORT_64 + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic.icf'] +# - ['C:\Temp\lm3s9b92.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + #- --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim2.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - --endian=little + - --cpu=Cortex-M3 + - --fpu=None + - -p + - [*tools_root, 'arm\config\debugger\TexasInstruments\iolm3sxxxx.ddf'] + - --semihosting + - --device=LM3SxBxx + #- -d + #- sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_cortexm3_v5.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_cortexm3_v5.yml new file mode 100644 index 0000000..cf0d1d0 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_cortexm3_v5.yml @@ -0,0 +1,83 @@ +# unit testing under iar compiler / simulator for STM32 Cortex-M3 + +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.4\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian=little + - --cpu=Cortex-M3 + - --interwork + - --warnings_are_errors + - --fpu=None + - --diag_suppress=Pa050 + - --diag_suppress=Pe111 + - -e + - -On + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - 'IAR' + - 'UNITY_SUPPORT_64' + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic_cortex.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\debugger\ST\iostm32f107xx.ddf'] + - --cpu=Cortex-M3 + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_msp430.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_msp430.yml new file mode 100644 index 0000000..e022647 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_msp430.yml @@ -0,0 +1,94 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3 MSP430\' +core_root: &core_root [*tools_root, '430\'] +core_bin: &core_bin [*core_root, 'bin\'] +core_config: &core_config [*core_root, 'config\'] +core_lib: &core_lib [*core_root, 'lib\'] +core_inc: &core_inc [*core_root, 'inc\'] +core_config: &core_config [*core_root, 'config\'] + +compiler: + path: [*core_bin, 'icc430.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*core_lib, 'dlib\dl430fn.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --debug + - -e + - -Ol + - --multiplier=16 + - --double=32 + - --diag_suppress Pa050 + - --diag_suppress Pe111 + includes: + prefix: '-I' + items: + - *core_inc + - [*core_inc, 'dlib'] + - [*core_lib, 'dlib'] + - 'src\' + - '../src/' + - *unit_tests_path + - 'vendor\unity\src' + defines: + prefix: '-D' + items: + - '__MSP430F149__' + - 'INT_WIDTH=16' + - 'UNITY_EXCLUDE_FLOAT' + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r43' + destination: *build_path +linker: + path: [*core_bin, 'xlink.exe'] + options: + - -rt + - [*core_lib, 'dlib\dl430fn.r43'] + - -e_PrintfTiny=_Printf + - -e_ScanfSmall=_Scanf + - -s __program_start + - -D_STACK_SIZE=50 + - -D_DATA16_HEAP_SIZE=50 + - -D_DATA20_HEAP_SIZE=50 + - -f + - [*core_config, 'lnk430f5438.xcl'] + - -f + - [*core_config, 'multiplier.xcl'] + includes: + prefix: '-I' + items: + - *core_config + - *core_lib + - [*core_lib, 'dlib'] + object_files: + path: *build_path + extension: '.r79' + bin_files: + prefix: '-o' + extension: '.d79' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*core_bin, '430proc.dll'] + - [*core_bin, '430sim.dll'] + post_support: + - --plugin + - [*core_bin, '430bat.dll'] + - --backend -B + - --cpu MSP430F5438 + - -p + - [*core_config, 'MSP430F5438.ddf'] + - -d sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_sh2a_v6.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_sh2a_v6.yml new file mode 100644 index 0000000..ddc5603 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_sh2a_v6.yml @@ -0,0 +1,85 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 6.0\' +compiler: + path: [*tools_root, 'sh\bin\iccsh.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - -e + - --char_is_signed + - -Ol + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_scheduling + - --no_clustering + - --debug + - --dlib_config + - [*tools_root, 'sh\inc\DLib_Product.h'] + - --double=32 + - --code_model=huge + - --data_model=huge + - --core=sh2afpu + - --warnings_affect_exit_code + - --warnings_are_errors + - --mfc + - --use_unix_directory_separators + - --diag_suppress=Pe161 + includes: + prefix: '-I' + items: + - [*tools_root, 'sh\inc\'] + - [*tools_root, 'sh\inc\c'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.o' + destination: *build_path +linker: + path: [*tools_root, 'sh\bin\ilinksh.exe'] + options: + - --redirect __Printf=__PrintfSmall + - --redirect __Scanf=__ScanfSmall + - --config + - [*tools_root, 'sh\config\generic.icf'] + - --config_def _CSTACK_SIZE=0x800 + - --config_def _HEAP_SIZE=0x800 + - --config_def _INT_TABLE=0x10 + - --entry __iar_program_start + - --debug_lib + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'sh\bin\shproc.dll'] + - [*tools_root, 'sh\bin\shsim.dll'] + post_support: + - --plugin + - [*tools_root, 'sh\bin\shbat.dll'] + - --backend + - -B + - --core sh2afpu + - -p + - [*tools_root, 'sh\config\debugger\io7264.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_cmd.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_cmd.c new file mode 100644 index 0000000..42841d8 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_cmd.c @@ -0,0 +1,54 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include +#include "CException.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_def.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_def.c new file mode 100644 index 0000000..8280804 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_def.c @@ -0,0 +1,50 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_cmd.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_cmd.c new file mode 100644 index 0000000..e47b31c --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_cmd.c @@ -0,0 +1,76 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_def.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_def.c new file mode 100644 index 0000000..3ca9dba --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_def.c @@ -0,0 +1,72 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new1.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new1.c new file mode 100644 index 0000000..a7cbcd8 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new1.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + GlobalExpectCount = 0; + GlobalVerifyOrder = 0; + GlobalOrderError = NULL; + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new2.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new2.c new file mode 100644 index 0000000..2c76bf2 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new2.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_param.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_param.c new file mode 100644 index 0000000..23c04f4 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_param.c @@ -0,0 +1,73 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST_NO_ARGS +#define RUN_TEST(TestFunc, TestLineNum, ...) \ +{ \ + Unity.CurrentTestName = #TestFunc "(" #__VA_ARGS__ ")"; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(__VA_ARGS__); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21, RUN_TEST_NO_ARGS); + RUN_TEST(test_TheSecondThingToTest, 43, RUN_TEST_NO_ARGS); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run1.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run1.c new file mode 100644 index 0000000..a7cbcd8 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run1.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + GlobalExpectCount = 0; + GlobalVerifyOrder = 0; + GlobalOrderError = NULL; + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run2.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run2.c new file mode 100644 index 0000000..2c76bf2 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run2.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_yaml.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_yaml.c new file mode 100644 index 0000000..68b545a --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_yaml.c @@ -0,0 +1,86 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include "two.h" +#include "three.h" +#include +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_yaml_setup(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_new1.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_new1.c new file mode 100644 index 0000000..e5bcac2 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_new1.c @@ -0,0 +1,60 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_new2.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_new2.c new file mode 100644 index 0000000..b7c7e5b --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_new2.c @@ -0,0 +1,63 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_param.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_param.c new file mode 100644 index 0000000..4157007 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_param.c @@ -0,0 +1,51 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST_NO_ARGS +#define RUN_TEST(TestFunc, TestLineNum, ...) \ +{ \ + Unity.CurrentTestName = #TestFunc "(" #__VA_ARGS__ ")"; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(__VA_ARGS__); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21, RUN_TEST_NO_ARGS); + RUN_TEST(test_TheSecondThingToTest, 43, RUN_TEST_NO_ARGS); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_run1.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_run1.c new file mode 100644 index 0000000..e5bcac2 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_run1.c @@ -0,0 +1,60 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_run2.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_run2.c new file mode 100644 index 0000000..b7c7e5b --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_run2.c @@ -0,0 +1,63 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_yaml.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_yaml.c new file mode 100644 index 0000000..d109287 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_yaml.c @@ -0,0 +1,64 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "two.h" +#include "three.h" +#include +#include +#include +#include "CException.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_yaml_setup(); +} + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/test_generate_test_runner.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/test_generate_test_runner.rb new file mode 100644 index 0000000..61c8df9 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/test_generate_test_runner.rb @@ -0,0 +1,94 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +ruby_version = RUBY_VERSION.split('.') +if (ruby_version[1].to_i == 9) and (ruby_version[2].to_i > 1) + require 'rubygems' + gem 'test-unit' +end +require 'test/unit' +require './auto/generate_test_runner.rb' + +TEST_FILE = 'test/testdata/testsample.c' +TEST_MOCK = 'test/testdata/mocksample.c' +OUT_FILE = 'build/testsample_' +EXP_FILE = 'test/expectdata/testsample_' + +class TestGenerateTestRunner < Test::Unit::TestCase + def setup + end + + def teardown + end + + def verify_output_equal(subtest) + expected = File.read(EXP_FILE + subtest + '.c').gsub(/\r\n/,"\n") + actual = File.read(OUT_FILE + subtest + '.c').gsub(/\r\n/,"\n") + assert_equal(expected, actual, "Generated File Sub-Test '#{subtest}' Failed") + end + + def test_ShouldGenerateARunnerByCreatingRunnerWithOptions + sets = { 'def' => nil, + 'new1' => { :plugins => [:cexception], :includes => ['one.h', 'two.h'], :enforce_strict_ordering => true }, + 'new2' => { :plugins => [:ignore], :suite_setup => "a_custom_setup();", :suite_teardown => "a_custom_teardown();" } + } + + sets.each_pair do |subtest, options| + UnityTestRunnerGenerator.new(options).run(TEST_FILE, OUT_FILE + subtest + '.c') + verify_output_equal(subtest) + UnityTestRunnerGenerator.new(options).run(TEST_MOCK, OUT_FILE + 'mock_' + subtest + '.c') + verify_output_equal('mock_' + subtest) + end + end + + def test_ShouldGenerateARunnerByRunningRunnerWithOptions + sets = { 'run1' => { :plugins => [:cexception], :includes => ['one.h', 'two.h'], :enforce_strict_ordering => true }, + 'run2' => { :plugins => [:ignore], :suite_setup => "a_custom_setup();", :suite_teardown => "a_custom_teardown();" } + } + + sets.each_pair do |subtest, options| + UnityTestRunnerGenerator.new.run(TEST_FILE, OUT_FILE + subtest + '.c', options) + verify_output_equal(subtest) + UnityTestRunnerGenerator.new.run(TEST_MOCK, OUT_FILE + 'mock_' + subtest + '.c', options) + verify_output_equal('mock_' + subtest) + end + end + + def test_ShouldGenerateARunnerByPullingYamlOptions + subtest = 'yaml' + cmdstr = "ruby auto/generate_test_runner.rb test/testdata/sample.yml \"#{TEST_FILE}\" \"#{OUT_FILE + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal(subtest) + + cmdstr = "ruby auto/generate_test_runner.rb test/testdata/sample.yml \"#{TEST_MOCK}\" \"#{OUT_FILE + 'mock_' + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal('mock_' + subtest) + end + + def test_ShouldGenerateARunnerByPullingCommandlineOptions + subtest = 'cmd' + cmdstr = "ruby auto/generate_test_runner.rb -cexception \"#{TEST_FILE}\" \"#{OUT_FILE + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal(subtest) + + cmdstr = "ruby auto/generate_test_runner.rb -cexception \"#{TEST_MOCK}\" \"#{OUT_FILE + 'mock_' + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal('mock_' + subtest) + end + + def test_ShouldGenerateARunnerThatUsesParameterizedTests + sets = { 'param' => { :plugins => [:ignore], :use_param_tests => true } + } + + sets.each_pair do |subtest, options| + UnityTestRunnerGenerator.new(options).run(TEST_FILE, OUT_FILE + subtest + '.c') + verify_output_equal(subtest) + UnityTestRunnerGenerator.new(options).run(TEST_MOCK, OUT_FILE + 'mock_' + subtest + '.c') + verify_output_equal('mock_' + subtest) + end + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/testdata/mocksample.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/testdata/mocksample.c new file mode 100644 index 0000000..b709438 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/testdata/mocksample.c @@ -0,0 +1,51 @@ +// This is just a sample test file to be used to test the generator script +#ifndef TEST_SAMPLE_H +#define TEST_SAMPLE_H + +#include +#include "unity.h" +#include "funky.h" +#include "Mockstanky.h" + +void setUp(void) +{ + CustomSetupStuff(); +} + +void tearDown(void) +{ + CustomTeardownStuff +} + +//Yup, nice comment +void test_TheFirstThingToTest(void) +{ + TEST_ASSERT(1); + + TEST_ASSERT_TRUE(1); +} + +/* +void test_ShouldBeIgnored(void) +{ + DoesStuff(); +} +*/ + +//void test_ShouldAlsoNotBeTested(void) +//{ +// Call_An_Expect(); +// +// CallAFunction(); +// test_CallAFunctionThatLooksLikeATest(); +//} + +void test_TheSecondThingToTest(void) +{ + Call_An_Expect(); + + CallAFunction(); + test_CallAFunctionThatLooksLikeATest(); +} + +#endif //TEST_SAMPLE_H diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/testdata/sample.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/testdata/sample.yml new file mode 100644 index 0000000..9e5eece --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/testdata/sample.yml @@ -0,0 +1,9 @@ +:unity: + :includes: + - two.h + - three.h + - + :plugins: + - :cexception + :suite_setup: | + a_yaml_setup(); \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/testdata/testsample.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/testdata/testsample.c new file mode 100644 index 0000000..4f30ec7 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/testdata/testsample.c @@ -0,0 +1,51 @@ +// This is just a sample test file to be used to test the generator script +#ifndef TEST_SAMPLE_H +#define TEST_SAMPLE_H + +#include +#include "unity.h" +#include "funky.h" +#include "stanky.h" + +void setUp(void) +{ + CustomSetupStuff(); +} + +void tearDown(void) +{ + CustomTeardownStuff +} + +//Yup, nice comment +void test_TheFirstThingToTest(void) +{ + TEST_ASSERT(1); + + TEST_ASSERT_TRUE(1); +} + +/* +void test_ShouldBeIgnored(void) +{ + DoesStuff(); +} +*/ + +//void test_ShouldAlsoNotBeTested(void) +//{ +// Call_An_Expect(); +// +// CallAFunction(); +// test_CallAFunctionThatLooksLikeATest(); +//} + +void test_TheSecondThingToTest(void) +{ + Call_An_Expect(); + + CallAFunction(); + test_CallAFunctionThatLooksLikeATest(); +} + +#endif //TEST_SAMPLE_H diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/testparameterized.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/testparameterized.c new file mode 100644 index 0000000..037cd21 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/testparameterized.c @@ -0,0 +1,101 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include +#include "unity.h" + +#define TEST_CASE(...) + +#define EXPECT_ABORT_BEGIN \ + if (TEST_PROTECT()) \ + { + +#define VERIFY_FAILS_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestFailed == 1) ? 0 : 1; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Failed But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +#define VERIFY_IGNORES_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestIgnored == 1) ? 0 : 1; \ + Unity.CurrentTestIgnored = 0; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Ignored But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +int SetToOneToFailInTearDown; +int SetToOneMeanWeAlreadyCheckedThisGuy; + +void setUp(void) +{ + SetToOneToFailInTearDown = 0; + SetToOneMeanWeAlreadyCheckedThisGuy = 0; +} + +void tearDown(void) +{ + if (SetToOneToFailInTearDown == 1) + TEST_FAIL_MESSAGE("<= Failed in tearDown"); + if ((SetToOneMeanWeAlreadyCheckedThisGuy == 0) && (Unity.CurrentTestFailed > 0)) + { + UnityPrint("[[[[ Previous Test Should Have Passed But Did Not ]]]]"); + UNITY_OUTPUT_CHAR('\n'); + } +} + +TEST_CASE(0) +TEST_CASE(44) +TEST_CASE((90)+9) +void test_TheseShouldAllPass(int Num) +{ + TEST_ASSERT_TRUE(Num < 100); +} + +TEST_CASE(3) +TEST_CASE(77) +TEST_CASE( (99) + 1 - (1)) +void test_TheseShouldAllFail(int Num) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(Num > 100); + VERIFY_FAILS_END +} + +TEST_CASE(1) +TEST_CASE(44) +TEST_CASE(99) +TEST_CASE(98) +void test_TheseAreEveryOther(int Num) +{ + if (Num & 1) + { + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(Num > 100); + VERIFY_FAILS_END + } + else + { + TEST_ASSERT_TRUE(Num < 100); + } +} + +void test_NormalPassesStillWork(void) +{ + TEST_ASSERT_TRUE(1); +} + +void test_NormalFailsStillWork(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(0); + VERIFY_FAILS_END +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/testunity.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/testunity.c new file mode 100644 index 0000000..9f826dc --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/c_exception/vendor/unity/test/testunity.c @@ -0,0 +1,1510 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include +#include "unity.h" + +#define EXPECT_ABORT_BEGIN \ + if (TEST_PROTECT()) \ + { + +#define VERIFY_FAILS_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestFailed == 1) ? 0 : 1; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Failed But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +#define VERIFY_IGNORES_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestIgnored == 1) ? 0 : 1; \ + Unity.CurrentTestIgnored = 0; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Ignored But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +int SetToOneToFailInTearDown; +int SetToOneMeanWeAlreadyCheckedThisGuy; + +void setUp(void) +{ + SetToOneToFailInTearDown = 0; + SetToOneMeanWeAlreadyCheckedThisGuy = 0; +} + +void tearDown(void) +{ + if (SetToOneToFailInTearDown == 1) + TEST_FAIL_MESSAGE("<= Failed in tearDown"); + if ((SetToOneMeanWeAlreadyCheckedThisGuy == 0) && (Unity.CurrentTestFailed > 0)) + { + UnityPrint("[[[[ Previous Test Should Have Passed But Did Not ]]]]"); + UNITY_OUTPUT_CHAR('\n'); + } +} + +void testTrue(void) +{ + TEST_ASSERT(1); + + TEST_ASSERT_TRUE(1); +} + +void testFalse(void) +{ + TEST_ASSERT_FALSE(0); + + TEST_ASSERT_UNLESS(0); +} + +void testPreviousPass(void) +{ + TEST_ASSERT_EQUAL_INT(0U, Unity.TestFailures); +} + +void testNotVanilla(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT(0); + VERIFY_FAILS_END +} + +void testNotTrue(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(0); + VERIFY_FAILS_END +} + +void testNotFalse(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_FALSE(1); + VERIFY_FAILS_END +} + +void testNotUnless(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UNLESS(1); + VERIFY_FAILS_END +} + +void testNotNotEqual(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_NOT_EQUAL(10, 10); + VERIFY_FAILS_END +} + +void testFail(void) +{ + EXPECT_ABORT_BEGIN + TEST_FAIL_MESSAGE("Expected for testing"); + VERIFY_FAILS_END +} + +void testIsNull(void) +{ + char* ptr1 = NULL; + char* ptr2 = "hello"; + + TEST_ASSERT_NULL(ptr1); + TEST_ASSERT_NOT_NULL(ptr2); +} + +void testIsNullShouldFailIfNot(void) +{ + char* ptr1 = "hello"; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_NULL(ptr1); + VERIFY_FAILS_END +} + +void testNotNullShouldFailIfNULL(void) +{ + char* ptr1 = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_NOT_NULL(ptr1); + VERIFY_FAILS_END +} + +void testIgnore(void) +{ + EXPECT_ABORT_BEGIN + TEST_IGNORE(); + TEST_FAIL_MESSAGE("This should not be reached"); + VERIFY_IGNORES_END +} + +void testIgnoreMessage(void) +{ + EXPECT_ABORT_BEGIN + TEST_IGNORE_MESSAGE("This is an expected TEST_IGNORE_MESSAGE string!"); + TEST_FAIL_MESSAGE("This should not be reached"); + VERIFY_IGNORES_END +} + +void testNotEqualInts(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT(3982, 3983); + VERIFY_FAILS_END +} + +void testNotEqualInt8s(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT8(-127, -126); + VERIFY_FAILS_END +} + +void testNotEqualInt16s(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT16(-16383, -16382); + VERIFY_FAILS_END +} + +void testNotEqualInt32s(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT32(-2147483647, -2147483646); + VERIFY_FAILS_END +} + +void testNotEqualBits(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_BITS(0xFF00, 0x5555, 0x5A55); + VERIFY_FAILS_END +} + +void testNotEqualUInts(void) +{ + _UU16 v0, v1; + + v0 = 9000; + v1 = 9001; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualUInt8s(void) +{ + _UU8 v0, v1; + + v0 = 254; + v1 = 255; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT8(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualUInt16s(void) +{ + _UU16 v0, v1; + + v0 = 65535; + v1 = 65534; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualUInt32s(void) +{ + _UU32 v0, v1; + + v0 = 4294967295; + v1 = 4294967294; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT32(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex8s(void) +{ + _UU8 v0, v1; + + v0 = 0x23; + v1 = 0x22; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex8sIfSigned(void) +{ + _US8 v0, v1; + + v0 = -2; + v1 = 2; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex16s(void) +{ + _UU16 v0, v1; + + v0 = 0x1234; + v1 = 0x1235; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex16sIfSigned(void) +{ + _US16 v0, v1; + + v0 = -1024; + v1 = -1028; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex32s(void) +{ + _UU32 v0, v1; + + v0 = 900000; + v1 = 900001; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex32sIfSigned(void) +{ + _US32 v0, v1; + + v0 = -900000; + v1 = 900001; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32(v0, v1); + VERIFY_FAILS_END +} + +void testEqualInts(void) +{ + int v0, v1; + int *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(1837, 1837); + TEST_ASSERT_EQUAL_INT(-27365, -27365); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(19467, v1); + TEST_ASSERT_EQUAL_INT(v0, 19467); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 19467); +} + +void testEqualUints(void) +{ + unsigned int v0, v1; + unsigned int *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_UINT(1837, 1837); + TEST_ASSERT_EQUAL_UINT(v0, v1); + TEST_ASSERT_EQUAL_UINT(19467, v1); + TEST_ASSERT_EQUAL_UINT(v0, 19467); + TEST_ASSERT_EQUAL_UINT(*p0, v1); + TEST_ASSERT_EQUAL_UINT(*p0, *p1); + TEST_ASSERT_EQUAL_UINT(*p0, 19467); + TEST_ASSERT_EQUAL_UINT(60872u, 60872u); +} + +void testNotEqual(void) +{ + TEST_ASSERT_NOT_EQUAL(0, 1); + TEST_ASSERT_NOT_EQUAL(1, 0); + TEST_ASSERT_NOT_EQUAL(100, 101); + TEST_ASSERT_NOT_EQUAL(0, -1); + TEST_ASSERT_NOT_EQUAL(65535, -65535); + TEST_ASSERT_NOT_EQUAL(75, 900); + TEST_ASSERT_NOT_EQUAL(-100, -101); +} + +void testEqualHex8s(void) +{ + _UU8 v0, v1; + _UU8 *p0, *p1; + + v0 = 0x22; + v1 = 0x22; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX8(0x22, 0x22); + TEST_ASSERT_EQUAL_HEX8(v0, v1); + TEST_ASSERT_EQUAL_HEX8(0x22, v1); + TEST_ASSERT_EQUAL_HEX8(v0, 0x22); + TEST_ASSERT_EQUAL_HEX8(*p0, v1); + TEST_ASSERT_EQUAL_HEX8(*p0, *p1); + TEST_ASSERT_EQUAL_HEX8(*p0, 0x22); +} + +void testEqualHex8sNegatives(void) +{ + _UU8 v0, v1; + _UU8 *p0, *p1; + + v0 = 0xDD; + v1 = 0xDD; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX8(0xDD, 0xDD); + TEST_ASSERT_EQUAL_HEX8(v0, v1); + TEST_ASSERT_EQUAL_HEX8(0xDD, v1); + TEST_ASSERT_EQUAL_HEX8(v0, 0xDD); + TEST_ASSERT_EQUAL_HEX8(*p0, v1); + TEST_ASSERT_EQUAL_HEX8(*p0, *p1); + TEST_ASSERT_EQUAL_HEX8(*p0, 0xDD); +} + +void testEqualHex16s(void) +{ + _UU16 v0, v1; + _UU16 *p0, *p1; + + v0 = 0x9876; + v1 = 0x9876; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX16(0x9876, 0x9876); + TEST_ASSERT_EQUAL_HEX16(v0, v1); + TEST_ASSERT_EQUAL_HEX16(0x9876, v1); + TEST_ASSERT_EQUAL_HEX16(v0, 0x9876); + TEST_ASSERT_EQUAL_HEX16(*p0, v1); + TEST_ASSERT_EQUAL_HEX16(*p0, *p1); + TEST_ASSERT_EQUAL_HEX16(*p0, 0x9876); +} + +void testEqualHex32s(void) +{ + _UU32 v0, v1; + _UU32 *p0, *p1; + + v0 = 0x98765432ul; + v1 = 0x98765432ul; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX32(0x98765432ul, 0x98765432ul); + TEST_ASSERT_EQUAL_HEX32(v0, v1); + TEST_ASSERT_EQUAL_HEX32(0x98765432ul, v1); + TEST_ASSERT_EQUAL_HEX32(v0, 0x98765432ul); + TEST_ASSERT_EQUAL_HEX32(*p0, v1); + TEST_ASSERT_EQUAL_HEX32(*p0, *p1); + TEST_ASSERT_EQUAL_HEX32(*p0, 0x98765432ul); +} + +void testEqualBits(void) +{ + _UU32 v0 = 0xFF55AA00; + _UU32 v1 = 0x55550000; + + TEST_ASSERT_BITS(v1, v0, 0x55550000); + TEST_ASSERT_BITS(v1, v0, 0xFF55CC00); + TEST_ASSERT_BITS(0xFFFFFFFF, v0, 0xFF55AA00); + TEST_ASSERT_BITS(0xFFFFFFFF, v0, v0); + TEST_ASSERT_BITS(0xF0F0F0F0, v0, 0xFC5DAE0F); + TEST_ASSERT_BITS_HIGH(v1, v0); + TEST_ASSERT_BITS_LOW(0x000055FF, v0); + TEST_ASSERT_BIT_HIGH(30, v0); + TEST_ASSERT_BIT_LOW(5, v0); +} + +void testEqualShorts(void) +{ + short v0, v1; + short *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(1837, 1837); + TEST_ASSERT_EQUAL_INT(-2987, -2987); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(19467, v1); + TEST_ASSERT_EQUAL_INT(v0, 19467); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 19467); +} + +void testEqualUShorts(void) +{ + unsigned short v0, v1; + unsigned short *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_UINT(1837, 1837); + TEST_ASSERT_EQUAL_UINT(2987, 2987); + TEST_ASSERT_EQUAL_UINT(v0, v1); + TEST_ASSERT_EQUAL_UINT(19467, v1); + TEST_ASSERT_EQUAL_UINT(v0, 19467); + TEST_ASSERT_EQUAL_UINT(*p0, v1); + TEST_ASSERT_EQUAL_UINT(*p0, *p1); + TEST_ASSERT_EQUAL_UINT(*p0, 19467); +} + +void testEqualChars(void) +{ + signed char v0, v1; + signed char *p0, *p1; + + v0 = 109; + v1 = 109; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(42, 42); + TEST_ASSERT_EQUAL_INT(-116, -116); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(109, v1); + TEST_ASSERT_EQUAL_INT(v0, 109); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 109); +} + +void testEqualUChars(void) +{ + unsigned char v0, v1; + unsigned char *p0, *p1; + + v0 = 251; + v1 = 251; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(42, 42); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(251, v1); + TEST_ASSERT_EQUAL_INT(v0, 251); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 251); +} + +void testEqualPointers(void) +{ + int v0, v1; + int *p0, *p1, *p2; + + v0 = 19467; + v1 = 18271; + p0 = &v0; + p1 = &v1; + p2 = &v1; + + TEST_ASSERT_EQUAL_PTR(p0, &v0); + TEST_ASSERT_EQUAL_PTR(&v1, p1); + TEST_ASSERT_EQUAL_PTR(p2, p1); + TEST_ASSERT_EQUAL_PTR(&v0, &v0); +} + +void testNotEqualPointers(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_PTR(0x12345678, 0x12345677); + VERIFY_FAILS_END +} + +void testIntsWithinDelta(void) +{ + TEST_ASSERT_INT_WITHIN(1, 5000, 5001); + TEST_ASSERT_INT_WITHIN(5, 5000, 4996); + TEST_ASSERT_INT_WITHIN(5, 5000, 5005); + TEST_ASSERT_INT_WITHIN(500, 50, -440); + + TEST_ASSERT_INT_WITHIN(2, -1, -1); + TEST_ASSERT_INT_WITHIN(5, 1, -1); + TEST_ASSERT_INT_WITHIN(5, -1, 1); +} + +void testIntsNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_INT_WITHIN(5, 5000, 5006); + VERIFY_FAILS_END +} + +void testUIntsWithinDelta(void) +{ + TEST_ASSERT_UINT_WITHIN(1, 5000, 5001); + TEST_ASSERT_UINT_WITHIN(5, 5000, 4996); + TEST_ASSERT_UINT_WITHIN(5, 5000, 5005); +} + +void testUIntsNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UINT_WITHIN(1, 2147483647u, 2147483649u); + VERIFY_FAILS_END +} + +void testUIntsNotWithinDeltaEvenThoughASignedIntWouldPassSmallFirst(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UINT_WITHIN(5, 1, -1); + VERIFY_FAILS_END +} + +void testUIntsNotWithinDeltaEvenThoughASignedIntWouldPassBigFirst(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UINT_WITHIN(5, -1, 1); + VERIFY_FAILS_END +} + +void testHEX32sWithinDelta(void) +{ + TEST_ASSERT_HEX32_WITHIN(1, 5000, 5001); + TEST_ASSERT_HEX32_WITHIN(5, 5000, 4996); + TEST_ASSERT_HEX32_WITHIN(5, 5000, 5005); +} + +void testHEX32sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX32_WITHIN(1, 2147483647u, 2147483649u); + VERIFY_FAILS_END +} + +void testHEX32sNotWithinDeltaEvenThoughASignedIntWouldPass(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX32_WITHIN(5, 1, -1); + VERIFY_FAILS_END +} + +void testHEX16sWithinDelta(void) +{ + TEST_ASSERT_HEX16_WITHIN(1, 5000, 5001); + TEST_ASSERT_HEX16_WITHIN(5, 5000, 4996); + TEST_ASSERT_HEX16_WITHIN(5, 5000, 5005); +} + +void testHEX16sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX16_WITHIN(2, 65535, 0); + VERIFY_FAILS_END +} + +void testHEX8sWithinDelta(void) +{ + TEST_ASSERT_HEX8_WITHIN(1, 254, 255); + TEST_ASSERT_HEX8_WITHIN(5, 251, 255); + TEST_ASSERT_HEX8_WITHIN(5, 1, 4); +} + +void testHEX8sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX8_WITHIN(2, 255, 0); + VERIFY_FAILS_END +} + +void testEqualStrings(void) +{ + const char *testString = "foo"; + + TEST_ASSERT_EQUAL_STRING(testString, testString); + TEST_ASSERT_EQUAL_STRING("foo", "foo"); + TEST_ASSERT_EQUAL_STRING("foo", testString); + TEST_ASSERT_EQUAL_STRING(testString, "foo"); + TEST_ASSERT_EQUAL_STRING("", ""); +} + +void testEqualStringsWithCarriageReturnsAndLineFeeds(void) +{ + const char *testString = "foo\r\nbar"; + + TEST_ASSERT_EQUAL_STRING(testString, testString); + TEST_ASSERT_EQUAL_STRING("foo\r\nbar", "foo\r\nbar"); + TEST_ASSERT_EQUAL_STRING("foo\r\nbar", testString); + TEST_ASSERT_EQUAL_STRING(testString, "foo\r\nbar"); + TEST_ASSERT_EQUAL_STRING("", ""); +} + +void testNotEqualString1(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("foo", "bar"); + VERIFY_FAILS_END +} + +void testNotEqualString2(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("foo", ""); + VERIFY_FAILS_END +} + +void testNotEqualString3(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("", "bar"); + VERIFY_FAILS_END +} + +void testNotEqualString4(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("bar\r", "bar\n"); + VERIFY_FAILS_END +} + +void testNotEqualString5(void) +{ + const char str1[] = { 0x41, 0x42, 0x03, 0x00 }; + const char str2[] = { 0x41, 0x42, 0x04, 0x00 }; + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING(str1, str2); + VERIFY_FAILS_END +} + +void testNotEqualString_ExpectedStringIsNull(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING(NULL, "bar"); + VERIFY_FAILS_END +} + +void testNotEqualString_ActualStringIsNull(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("foo", NULL); + VERIFY_FAILS_END +} + +void testEqualStringArrays(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, expStrings, 3); + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 3); + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 2); + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 1); +} + +void testNotEqualStringArray1(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray2(void) +{ + const char *testStrings[] = { "zoo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", "boo", "woo", "moo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray3(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", NULL }; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray4(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", NULL, "woo", "moo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray5(void) +{ + const char **testStrings = NULL; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray6(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "zoo" }; + const char **expStrings = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testEqualStringArrayIfBothNulls(void) +{ + const char **testStrings = NULL; + const char **expStrings = NULL; + + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); +} + +void testEqualMemory(void) +{ + const char *testString = "whatever"; + + TEST_ASSERT_EQUAL_MEMORY(testString, testString, 8); + TEST_ASSERT_EQUAL_MEMORY("whatever", "whatever", 8); + TEST_ASSERT_EQUAL_MEMORY("whatever", testString, 8); + TEST_ASSERT_EQUAL_MEMORY(testString, "whatever", 8); + TEST_ASSERT_EQUAL_MEMORY(testString, "whatever", 2); + TEST_ASSERT_EQUAL_MEMORY(NULL, NULL, 1); +} + +void testNotEqualMemory1(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY("foo", "bar", 3); + VERIFY_FAILS_END +} + +void testNotEqualMemory2(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY("fool", "food", 4); + VERIFY_FAILS_END +} + +void testNotEqualMemory3(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY(NULL, "food", 4); + VERIFY_FAILS_END +} + +void testNotEqualMemory4(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY("fool", NULL, 4); + VERIFY_FAILS_END +} + +void testEqualIntArrays(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, -2}; + int p2[] = {1, 8, 987, 2}; + int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p3, 1); +} + +void testNotEqualIntArraysNullExpected(void) +{ + int* p0 = NULL; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArraysNullActual(void) +{ + int* p1 = NULL; + int p0[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArrays1(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArrays2(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {2, 8, 987, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArrays3(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 986, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualInt8Arrays(void) +{ + _US8 p0[] = {1, 8, 117, -2}; + _US8 p1[] = {1, 8, 117, -2}; + _US8 p2[] = {1, 8, 117, 2}; + _US8 p3[] = {1, 50, 60, 70}; + + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p3, 1); +} + +void testNotEqualInt8Arrays(void) +{ + _US8 p0[] = {1, 8, 127, -2}; + _US8 p1[] = {1, 8, 127, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualUIntArrays(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65132u}; + unsigned int p2[] = {1, 8, 987, 2}; + unsigned int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p3, 1); +} + +void testNotEqualUIntArrays1(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUIntArrays2(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUIntArrays3(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualInt16Arrays(void) +{ + _UU16 p0[] = {1, 8, 117, 3}; + _UU16 p1[] = {1, 8, 117, 3}; + _UU16 p2[] = {1, 8, 117, 2}; + _UU16 p3[] = {1, 50, 60, 70}; + + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p3, 1); +} + +void testNotEqualInt16Arrays(void) +{ + _UU16 p0[] = {1, 8, 127, 3}; + _UU16 p1[] = {1, 8, 127, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualUINT16Arrays(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65132u}; + unsigned short p2[] = {1, 8, 987, 2}; + unsigned short p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p3, 1); +} + +void testNotEqualUINT16Arrays1(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUINT16Arrays2(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUINT16Arrays3(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualHEXArrays(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65132u}; + unsigned int p2[] = {1, 8, 987, 2}; + unsigned int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p3, 1); +} + +void testNotEqualHEXArrays1(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEXArrays2(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEXArrays3(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualHEX16Arrays(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65132u}; + unsigned short p2[] = {1, 8, 987, 2}; + unsigned short p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p3, 1); +} + +void testNotEqualHEX16Arrays1(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX16Arrays2(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX16Arrays3(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualHEX8Arrays(void) +{ + unsigned short p0[] = {1, 8, 254u, 123}; + unsigned short p1[] = {1, 8, 254u, 123}; + unsigned short p2[] = {1, 8, 254u, 2}; + unsigned short p3[] = {1, 23, 25, 26}; + + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p3, 1); +} + +void testNotEqualHEX8Arrays1(void) +{ + unsigned char p0[] = {1, 8, 254u, 253u}; + unsigned char p1[] = {1, 8, 254u, 252u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX8Arrays2(void) +{ + unsigned char p0[] = {1, 8, 254u, 253u}; + unsigned char p1[] = {2, 8, 254u, 253u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX8Arrays3(void) +{ + unsigned char p0[] = {1, 8, 254u, 253u}; + unsigned char p1[] = {1, 8, 255u, 253u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualMemoryArrays(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, -2}; + int p2[] = {1, 8, 987, 2}; + int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p0, 4, 1); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p0, 4, 4); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p2, 4, 3); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p3, 4, 1); +} + +void testNotEqualMemoryArraysExpectedNull(void) +{ + int* p0 = NULL; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArraysActualNull(void) +{ + int p0[] = {1, 8, 987, -2}; + int* p1 = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArrays1(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArrays2(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {2, 8, 987, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArrays3(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 986, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testProtection(void) +{ + volatile int mask = 0; + + if (TEST_PROTECT()) + { + mask |= 1; + TEST_ABORT(); + } + else + { + Unity.CurrentTestFailed = 0; + mask |= 2; + } + + TEST_ASSERT_EQUAL(3, mask); +} + +void testIgnoredAndThenFailInTearDown(void) +{ + SetToOneToFailInTearDown = 1; + TEST_IGNORE(); +} + +// ===================== THESE TEST WILL RUN IF YOUR CONFIG INCLUDES 64 BIT SUPPORT ================== +#ifdef UNITY_SUPPORT_64 + +void testEqualHex64s(void) +{ + _UU64 v0, v1; + _UU64 *p0, *p1; + + v0 = 0x9876543201234567; + v1 = 0x9876543201234567; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX64(0x9876543201234567, 0x9876543201234567); + TEST_ASSERT_EQUAL_HEX64(v0, v1); + TEST_ASSERT_EQUAL_HEX64(0x9876543201234567, v1); + TEST_ASSERT_EQUAL_HEX64(v0, 0x9876543201234567); + TEST_ASSERT_EQUAL_HEX64(*p0, v1); + TEST_ASSERT_EQUAL_HEX64(*p0, *p1); + TEST_ASSERT_EQUAL_HEX64(*p0, 0x9876543201234567); +} + +void testNotEqualHex64s(void) +{ + _UU64 v0, v1; + + v0 = 9000000000; + v1 = 9100000000; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex64sIfSigned(void) +{ + _US64 v0, v1; + + v0 = -9000000000; + v1 = 9000000000; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64(v0, v1); + VERIFY_FAILS_END +} + +void testHEX64sWithinDelta(void) +{ + TEST_ASSERT_HEX64_WITHIN(1, 0x7FFFFFFFFFFFFFFF,0x7FFFFFFFFFFFFFFE); + TEST_ASSERT_HEX64_WITHIN(5, 5000, 4996); + TEST_ASSERT_HEX64_WITHIN(5, 5000, 5005); +} + +void testHEX64sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX64_WITHIN(1, 0x7FFFFFFFFFFFFFFF, 0x7FFFFFFFFFFFFFFC); + VERIFY_FAILS_END +} + +void testHEX64sNotWithinDeltaEvenThoughASignedIntWouldPass(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX64_WITHIN(5, 1, -1); + VERIFY_FAILS_END +} + +void testEqualHEX64Arrays(void) +{ + _UU64 p0[] = {1, 8, 987, 65132u}; + _UU64 p1[] = {1, 8, 987, 65132u}; + _UU64 p2[] = {1, 8, 987, 2}; + _UU64 p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p3, 1); +} + +void testNotEqualHEX64Arrays1(void) +{ + _UU64 p0[] = {1, 8, 987, 65132u}; + _UU64 p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX64Arrays2(void) +{ + _UU64 p0[] = {1, 8, 987, 65132u}; + _UU64 p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +#endif //64-bit SUPPORT + +// ===================== THESE TEST WILL RUN IF YOUR CONFIG INCLUDES FLOAT SUPPORT ================== +#ifndef UNITY_EXCLUDE_FLOAT + +void testFloatsWithinDelta(void) +{ + TEST_ASSERT_FLOAT_WITHIN(0.00003f, 187245.03485f, 187245.03488f); + TEST_ASSERT_FLOAT_WITHIN(1.0f, 187245.0f, 187246.0f); + TEST_ASSERT_FLOAT_WITHIN(0.05f, 9273.2549f, 9273.2049f); + TEST_ASSERT_FLOAT_WITHIN(0.007f, -726.93724f, -726.94424f); +} + +void testFloatsNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_FLOAT_WITHIN(0.05f, 9273.2649f, 9273.2049f); + VERIFY_FAILS_END +} + +void testFloatsEqual(void) +{ + TEST_ASSERT_EQUAL_FLOAT(187245.0f, 187246.0f); + TEST_ASSERT_EQUAL_FLOAT(18724.5f, 18724.6f); + TEST_ASSERT_EQUAL_FLOAT(9273.2549f, 9273.2599f); + TEST_ASSERT_EQUAL_FLOAT(-726.93724f, -726.9374f); +} + +void testFloatsNotEqual(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT(9273.9649f, 9273.0049f); + VERIFY_FAILS_END +} + +void testFloatsNotEqualNegative1(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT(-9273.9649f, -9273.0049f); + VERIFY_FAILS_END +} + +void testFloatsNotEqualNegative2(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT(-9273.0049f, -9273.9649f); + VERIFY_FAILS_END +} + +void testEqualFloatArrays(void) +{ + float p0[] = {1.0, -8.0, 25.4, -0.123}; + float p1[] = {1.0, -8.0, 25.4, -0.123}; + float p2[] = {1.0, -8.0, 25.4, -0.2}; + float p3[] = {1.0, -23.0, 25.0, -0.26}; + + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p3, 1); +} + +void testNotEqualFloatArraysExpectedNull(void) +{ + float* p0 = NULL; + float p1[] = {1.0, 8.0, 25.4, 0.252}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysActualNull(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float* p1 = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArrays1(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float p1[] = {1.0, 8.0, 25.4, 0.252}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArrays2(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float p1[] = {2.0, 8.0, 25.4, 0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArrays3(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float p1[] = {1.0, 8.0, 25.5, 0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysNegative1(void) +{ + float p0[] = {-1.0, -8.0, -25.4, -0.253}; + float p1[] = {-1.0, -8.0, -25.4, -0.252}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysNegative2(void) +{ + float p0[] = {-1.0, -8.0, -25.4, -0.253}; + float p1[] = {-2.0, -8.0, -25.4, -0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysNegative3(void) +{ + float p0[] = {-1.0, -8.0, -25.4, -0.253}; + float p1[] = {-1.0, -8.0, -25.5, -0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +#endif //FLOAT SUPPORT diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/config/production_environment.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/config/production_environment.rb new file mode 100644 index 0000000..915582b --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/config/production_environment.rb @@ -0,0 +1,14 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +# Setup our load path: +[ + 'lib', +].each do |dir| + $LOAD_PATH.unshift( File.join( File.expand_path(File.dirname(__FILE__)) + '/../', dir) ) +end + + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/config/test_environment.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/config/test_environment.rb new file mode 100644 index 0000000..442e110 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/config/test_environment.rb @@ -0,0 +1,16 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +# Setup our load path: +[ + 'lib', + 'vendor/behaviors/lib', + 'vendor/hardmock/lib', + 'vendor/unity/auto/', + 'test/system/' +].each do |dir| + $LOAD_PATH.unshift( File.join( File.expand_path(File.dirname(__FILE__) + "/../"), dir) ) +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/docs/CMock Summary.odt b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/docs/CMock Summary.odt new file mode 100644 index 0000000..6126075 Binary files /dev/null and b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/docs/CMock Summary.odt differ diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/docs/CMock Summary.pdf b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/docs/CMock Summary.pdf new file mode 100644 index 0000000..98f8ea1 Binary files /dev/null and b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/docs/CMock Summary.pdf differ diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/docs/license.txt b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/docs/license.txt new file mode 100644 index 0000000..8eb75ad --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/docs/license.txt @@ -0,0 +1,31 @@ + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + The end-user documentation included with the redistribution, if + any, must include the following acknowledgment: "This product + includes software developed for the CMock Project, by Mike Karlesky, + Mark VanderVoord, and Greg Williams and other contributors", in + the same place and form as other third-party acknowledgments. + Alternately, this acknowledgment may appear in the software + itself, in the same form and location as other such third-party + acknowledgments. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/SAM7_FLASH.mac b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/SAM7_FLASH.mac new file mode 100644 index 0000000..407acb2 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/SAM7_FLASH.mac @@ -0,0 +1,71 @@ +// ---------------------------------------------------------------------------- +// ATMEL Microcontroller Software Support - ROUSSET - +// ---------------------------------------------------------------------------- +// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// ---------------------------------------------------------------------------- +// File Name : SAM7_FLASH.mac +// Object : Generic Macro File for IAR +// 1.0 17/Aug/05 FBr : Creation +// ---------------------------------------------------------------------------- + +/********************************************************************* +* +* _InitRSTC() +* +* Function description +* Initializes the RSTC (Reset controller). +* This makes sense since the default is to not allow user resets, which makes it impossible to +* apply a second RESET via J-Link +*/ +_InitRSTC() { + __writeMemory32(0xA5000001, 0xFFFFFD08,"Memory"); // Allow user reset +} + +/********************************************************************* +* +* _InitPLL() +* Function description +* Initializes the PMC. +* 1. Enable the Main Oscillator +* 2. Configure PLL to 96MHz +* 3. Switch Master Clock (MCK) on PLL/2 = 48MHz +*/ + _InitPLL() { + + __message "Enable Main Oscillator"; + __writeMemory32(0x00000601,0xFFFFFc20,"Memory"); // MOSC + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x1) ); + + __message "Set PLL to 96MHz"; + __writeMemory32(0x10191c05,0xFFFFFc2c,"Memory"); // LOCK + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x4) ); + + __message "Set Master Clock to 48MHz"; + __writeMemory32(0x00000004,0xFFFFFc30,"Memory"); // MCKRDY + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x8) ); + __writeMemory32(0x00000007,0xFFFFFc30,"Memory"); // MCKRDY + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x8) ); +} + +/********************************************************************* +* +* execUserReset() : JTAG set initially to Full Speed +*/ +execUserReset() { + __message "execUserReset()"; + __emulatorSpeed(30000); // Set JTAG speed to 30kHz to make a hardware reset + __hwReset(0); // Hardware Reset: CPU is automatically halted after the reset (JTAG is already configured to 32kHz) + _InitPLL(); // Allow to debug at JTAG Full Speed + _InitRSTC(); // Enable User Reset to allow execUserReset() execution + __emulatorSpeed(0); // Set JTAG speed to full speed +} + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/SAM7_RAM.mac b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/SAM7_RAM.mac new file mode 100644 index 0000000..a2b8a01 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/SAM7_RAM.mac @@ -0,0 +1,94 @@ +// ---------------------------------------------------------------------------- +// ATMEL Microcontroller Software Support - ROUSSET - +// ---------------------------------------------------------------------------- +// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// ---------------------------------------------------------------------------- +// File Name : SAM7_RAM.mac +// Object : Generic Macro File for IAR +// 1.0 17/Aug/05 FBr : Creation +// ---------------------------------------------------------------------------- + +/********************************************************************* +* +* _MapRAMAt0() +* +* Function description +* Maps RAM at 0. +*/ +_MapRAMAt0(){ + __message "Changing mapping: RAM mapped to 0"; + __writeMemory32(0x00000001,0xFFFFFF00,"Memory"); +} + +/********************************************************************* +* +* _InitRSTC() +* +* Function description +* Initializes the RSTC (Reset controller). +* This makes sense since the default is to not allow user resets, which makes it impossible to +* apply a second RESET via J-Link +*/ +_InitRSTC() { + __writeMemory32(0xA5000001, 0xFFFFFD08,"Memory"); // Allow user reset +} + +/********************************************************************* +* +* _InitPLL() +* Function description +* Initializes the PMC. +* 1. Enable the Main Oscillator +* 2. Configure PLL to 96MHz +* 3. Switch Master Clock (MCK) on PLL/2 = 48MHz +*/ + _InitPLL() { + + __message "Set Main Oscillator"; + __writeMemory32(0x00004001,0xFFFFFc20,"Memory"); // MOSC + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x1) ); + + __message "Set PLL to 96MHz"; + __writeMemory32(0x10483f0e,0xFFFFFc2c,"Memory"); // LOCK + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x4) ); + + __message "Set Master Clock to 48MHz"; + __writeMemory32(0x00000004,0xFFFFFc30,"Memory"); // MCKRDY + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x8) ); + __writeMemory32(0x00000007,0xFFFFFc30,"Memory"); // MCKRDY + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x8) ); +} + +/********************************************************************* +* +* execUserReset() : JTAG set initially to Full Speed +*/ +execUserReset() { + __message "execUserReset()"; + __emulatorSpeed(30000); // Set JTAG speed to 30kHz to make a hardware reset + __hwReset(0); // Hardware Reset: CPU is automatically halted after the reset + _InitPLL(); // Allow to debug at JTAG Full Speed + _MapRAMAt0(); // Remap RAM to address 0 + __emulatorSpeed(0); // Set JTAG speed to full speed +} + +/********************************************************************* +* +* execUserPreload() : JTAG set initially to 32kHz +*/ +execUserPreload() { + __message "execUserPreload()"; + __hwReset(0); // Hardware Reset: CPU is automatically halted after the reset (JTAG is already configured to 32kHz) + _InitPLL(); // Allow to load Code at JTAG Full Speed + _MapRAMAt0(); // Remap RAM to address 0 + _InitRSTC(); // Enable User Reset to allow execUserReset() execution +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/SAM7_SIM.mac b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/SAM7_SIM.mac new file mode 100644 index 0000000..418a2c3 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/SAM7_SIM.mac @@ -0,0 +1,67 @@ +//========================================================= +// Simulation setup file for esc07_demo project +//========================================================= + +__var _timer0_interrupt_ID; + +irqBreak() +{ + __var __AIC_SMR; + __var __AIC_IECR; + __var __AIC_IVR; + + // read AIC_IECR instead, since not fully supported by simulator + __AIC_IECR = __readMemory32(0xFFFFF120, "Memory"); + if(__AIC_IECR & 0x1000) + { + __AIC_SMR = __readMemory32(0xFFFFF060, "Memory"); + __AIC_IVR = __readMemory32(0xFFFFF0B0, "Memory"); //AIC_IVR = AIC_SVR[x] + __writeMemory32(__AIC_IVR, 0xFFFFF100, "Memory"); //AIC_IVR + __writeMemory32(0x1000, 0xFFFFF10C, "Memory"); //AIC_IPR + __writeMemory32(0x2, 0xFFFFF114, "Memory"); //AIC_CISR + } + + return 0; +} + +setupProcessorRegisters() +{ + // Write TC0_SR.CPCS with correct status for ISR (Clock enabled; RC Compare Flag = TRUE) + __writeMemory32(0x00010010, 0xfffa0020, "Memory"); + + // Set TX ready flag in USART0 status register + // USART0_BASE->US_CSR = AT91C_US_TXRDY + __writeMemory32(0x00000002, 0xfffc0014, "Memory"); +} + +configureTimer0Interrupt() +{ + __var _master_clock_frequency; + __var _timer0_period_cycles; + + // Calculate timer0 frequency in master clock cycles + _master_clock_frequency = 48054857; + _timer0_period_cycles = _master_clock_frequency / 100; + if((_master_clock_frequency % 100) >= 50) + { + _timer0_period_cycles++; + } + + __cancelAllInterrupts(); + __enableInterrupts(); + + _timer0_interrupt_ID = __orderInterrupt("IRQ", _timer0_period_cycles, _timer0_period_cycles, 0, 0, 0, 100); + + if(-1 == _timer0_interrupt_ID) + { + __message "ERROR: failed to order timer 0 interrupt"; + } + + __setCodeBreak("0x18", 0, "irqBreak()", "TRUE", ""); +} + +execUserReset() +{ + setupProcessorRegisters(); + configureTimer0Interrupt(); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/at91SAM7X256_FLASH.xcl b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/at91SAM7X256_FLASH.xcl new file mode 100644 index 0000000..02eaec7 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/at91SAM7X256_FLASH.xcl @@ -0,0 +1,185 @@ +// ---------------------------------------------------------------------------- +// ATMEL Microcontroller Software Support - ROUSSET - +// ---------------------------------------------------------------------------- +// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// ---------------------------------------------------------------------------- +// File Name : at91SAM7X256_FLASH.xcl +// Object : Generic Linker Command File for IAR +// 1.0 30/Aug/05 FBr : Creation for 4.30A +// ---------------------------------------------------------------------------- + +//************************************************************************* +// XLINK command file template for EWARM/ICCARM +// +// Usage: xlink -f lnkarm +// -s +//************************************************************************* +// +// ------------- +// Code segments - may be placed anywhere in memory. +// ------------- +// +// INTVEC -- Exception vector table. +// SWITAB -- Software interrupt vector table. +// ICODE -- Startup (cstartup) and exception code. +// DIFUNCT -- Dynamic initialization vectors used by C++. +// CODE -- Compiler generated code. +// CODE_I -- Compiler generated code declared __ramfunc (executes in RAM) +// CODE_ID -- Initializer for CODE_I (ROM). +// +// ------------- +// Data segments - may be placed anywhere in memory. +// ------------- +// +// CSTACK -- The stack used by C/C++ programs (system and user mode). +// IRQ_STACK -- The stack used by IRQ service routines. +// SVC_STACK -- The stack used in supervisor mode +// (Define other exception stacks as needed for +// FIQ, ABT, UND). +// HEAP -- The heap used by malloc and free in C and new and +// delete in C++. +// INITTAB -- Table containing addresses and sizes of segments that +// need to be initialized at startup (by cstartup). +// CHECKSUM -- The linker places checksum byte(s) in this segment, +// when the -J linker command line option is used. +// DATA_y -- Data objects. +// +// Where _y can be one of: +// +// _AN -- Holds uninitialized located objects, i.e. objects with +// an absolute location given by the @ operator or the +// #pragma location directive. Since these segments +// contain objects which already have a fixed address, +// they should not be mentioned in this linker command +// file. +// _C -- Constants (ROM). +// _I -- Initialized data (RAM). +// _ID -- The original content of _I (copied to _I by cstartup) (ROM). +// _N -- Uninitialized data (RAM). +// _Z -- Zero initialized data (RAM). +// +// Note: Be sure to use end values for the defined address ranges. +// Otherwise, the linker may allocate space outside the +// intended memory range. +//************************************************************************* + +//************************************************************************* +// Inform the linker about the CPU family used. +// AT91SAM7X256 Memory mapping +// No remap +// ROMSTART +// Start address 0x0000 0000 +// Size 256 Kbo 0x0004 0000 +// RAMSTART +// Start address 0x0020 0000 +// Size 64 Kbo 0x0001 0000 +// Remap done +// RAMSTART +// Start address 0x0000 0000 +// Size 64 Kbo 0x0001 0000 +// ROMSTART +// Start address 0x0010 0000 +// Size 256 Kbo 0x0004 0000 + +//************************************************************************* +-carm + +//************************************************************************* +// Internal Ram segments mapped AFTER REMAP 64 K. +//************************************************************************* +-Z(CONST)INTRAMSTART_REMAP=00200000 +-Z(CONST)INTRAMEND_REMAP=0020FFFF + +//************************************************************************* +// Read-only segments mapped to Flash 256 K. +//************************************************************************* +-DROMSTART=00000000 +-DROMEND=0003FFFF +//************************************************************************* +// Read/write segments mapped to 64 K RAM. +//************************************************************************* +-DRAMSTART=00200000 +-DRAMEND=0020FFFF + +//************************************************************************* +// Address range for reset and exception +// vectors (INTVEC). +// The vector area is 32 bytes, +// an additional 32 bytes is allocated for the +// constant table used by ldr PC in cstartup.s79. +//************************************************************************* +-Z(CODE)INTVEC=00-3F + +//************************************************************************* +// Startup code and exception routines (ICODE). +//************************************************************************* +-Z(CODE)ICODE,DIFUNCT=ROMSTART-ROMEND +-Z(CODE)SWITAB=ROMSTART-ROMEND + +//************************************************************************* +// Code segments may be placed anywhere. +//************************************************************************* +-Z(CODE)CODE=ROMSTART-ROMEND + +//************************************************************************* +// Various constants and initializers. +//************************************************************************* +-Z(CONST)INITTAB,DATA_ID,DATA_C=ROMSTART-ROMEND +-Z(CONST)CHECKSUM=ROMSTART-ROMEND + +//************************************************************************* +// Data segments. +//************************************************************************* +-Z(DATA)DATA_I,DATA_Z,DATA_N=RAMSTART-RAMEND + +//************************************************************************* +// __ramfunc code copied to and executed from RAM. +//************************************************************************* +-Z(DATA)CODE_I=RAMSTART-RAMEND +-Z(CONST)CODE_ID=ROMSTART-ROMEND // Initializer for +-QCODE_I=CODE_ID + +//************************************************************************* +// ICCARM produces code for __ramfunc functions in +// CODE_I segments. The -Q XLINK command line +// option redirects XLINK to emit the code in the +// debug information associated with the CODE_I +// segment, where the code will execute. +//************************************************************************* + +//************************************************************************* +// Stack and heap segments. +//************************************************************************* +-D_CSTACK_SIZE=(100*4) +-D_IRQ_STACK_SIZE=(3*8*4) +-D_HEAP_SIZE=(1024*1) + +-Z(DATA)CSTACK+_CSTACK_SIZE=RAMSTART-RAMEND +-Z(DATA)IRQ_STACK+_IRQ_STACK_SIZE=RAMSTART-RAMEND +-Z(DATA)HEAP+_HEAP_SIZE=RAMSTART-RAMEND + +//************************************************************************* +// ELF/DWARF support. +// +// Uncomment the line "-Felf" below to generate ELF/DWARF output. +// Available format specifiers are: +// +// "-yn": Suppress DWARF debug output +// "-yp": Multiple ELF program sections +// "-yas": Format suitable for debuggers from ARM Ltd (also sets -p flag) +// +// "-Felf" and the format specifiers can also be supplied directly as +// command line options, or selected from the Xlink Output tab in the +// IAR Embedded Workbench. +//************************************************************************* + +// -Felf diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/at91SAM7X256_RAM.xcl b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/at91SAM7X256_RAM.xcl new file mode 100644 index 0000000..adcec10 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/at91SAM7X256_RAM.xcl @@ -0,0 +1,185 @@ +// ---------------------------------------------------------------------------- +// ATMEL Microcontroller Software Support - ROUSSET - +// ---------------------------------------------------------------------------- +// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// ---------------------------------------------------------------------------- +// File Name : at91SAM7X256_RAM.xcl +// Object : Generic Linker Command File for IAR +// 1.0 30/Aug/05 FBr : Creation for 4.30A +// ---------------------------------------------------------------------------- + +//************************************************************************* +// XLINK command file template for EWARM/ICCARM +// +// Usage: xlink -f lnkarm +// -s +//************************************************************************* +// +// ------------- +// Code segments - may be placed anywhere in memory. +// ------------- +// +// INTVEC -- Exception vector table. +// SWITAB -- Software interrupt vector table. +// ICODE -- Startup (cstartup) and exception code. +// DIFUNCT -- Dynamic initialization vectors used by C++. +// CODE -- Compiler generated code. +// CODE_I -- Compiler generated code declared __ramfunc (executes in RAM) +// CODE_ID -- Initializer for CODE_I (ROM). +// +// ------------- +// Data segments - may be placed anywhere in memory. +// ------------- +// +// CSTACK -- The stack used by C/C++ programs (system and user mode). +// IRQ_STACK -- The stack used by IRQ service routines. +// SVC_STACK -- The stack used in supervisor mode +// (Define other exception stacks as needed for +// FIQ, ABT, UND). +// HEAP -- The heap used by malloc and free in C and new and +// delete in C++. +// INITTAB -- Table containing addresses and sizes of segments that +// need to be initialized at startup (by cstartup). +// CHECKSUM -- The linker places checksum byte(s) in this segment, +// when the -J linker command line option is used. +// DATA_y -- Data objects. +// +// Where _y can be one of: +// +// _AN -- Holds uninitialized located objects, i.e. objects with +// an absolute location given by the @ operator or the +// #pragma location directive. Since these segments +// contain objects which already have a fixed address, +// they should not be mentioned in this linker command +// file. +// _C -- Constants (ROM). +// _I -- Initialized data (RAM). +// _ID -- The original content of _I (copied to _I by cstartup) (ROM). +// _N -- Uninitialized data (RAM). +// _Z -- Zero initialized data (RAM). +// +// Note: Be sure to use end values for the defined address ranges. +// Otherwise, the linker may allocate space outside the +// intended memory range. +//************************************************************************* + +//************************************************************************* +// Inform the linker about the CPU family used. +// AT91SAM7X256 Memory mapping +// No remap +// ROMSTART +// Start address 0x0000 0000 +// Size 256 Kbo 0x0004 0000 +// RAMSTART +// Start address 0x0020 0000 +// Size 64 Kbo 0x0001 0000 +// Remap done +// RAMSTART +// Start address 0x0000 0000 +// Size 64 Kbo 0x0001 0000 +// ROMSTART +// Start address 0x0010 0000 +// Size 256 Kbo 0x0004 0000 + +//************************************************************************* +-carm + +//************************************************************************* +// Internal Ram segments mapped AFTER REMAP 64 K. +//************************************************************************* +-Z(CONST)INTRAMSTART_REMAP=00000000 +-Z(CONST)INTRAMEND_REMAP=0000FFFF + +//************************************************************************* +// Read-only segments mapped to Flash 256 K. +//************************************************************************* +-DROMSTART=00000000 +-DROMEND=0003FFFF +//************************************************************************* +// Read/write segments mapped to 64 K RAM. +//************************************************************************* +-DRAMSTART=00000000 +-DRAMEND=0000FFFF + +//************************************************************************* +// Address range for reset and exception +// vectors (INTVEC). +// The vector area is 32 bytes, +// an additional 32 bytes is allocated for the +// constant table used by ldr PC in cstartup.s79. +//************************************************************************* +-Z(CODE)INTVEC=00-3F + +//************************************************************************* +// Startup code and exception routines (ICODE). +//************************************************************************* +-Z(CODE)ICODE,DIFUNCT=ROMSTART-ROMEND +-Z(CODE)SWITAB=ROMSTART-ROMEND + +//************************************************************************* +// Code segments may be placed anywhere. +//************************************************************************* +-Z(CODE)CODE=ROMSTART-ROMEND + +//************************************************************************* +// Various constants and initializers. +//************************************************************************* +-Z(CONST)INITTAB,DATA_ID,DATA_C=ROMSTART-ROMEND +-Z(CONST)CHECKSUM=ROMSTART-ROMEND + +//************************************************************************* +// Data segments. +//************************************************************************* +-Z(DATA)DATA_I,DATA_Z,DATA_N=RAMSTART-RAMEND + +//************************************************************************* +// __ramfunc code copied to and executed from RAM. +//************************************************************************* +-Z(DATA)CODE_I=RAMSTART-RAMEND +-Z(CONST)CODE_ID=ROMSTART-ROMEND // Initializer for +-QCODE_I=CODE_ID + +//************************************************************************* +// ICCARM produces code for __ramfunc functions in +// CODE_I segments. The -Q XLINK command line +// option redirects XLINK to emit the code in the +// debug information associated with the CODE_I +// segment, where the code will execute. +//************************************************************************* + +//************************************************************************* +// Stack and heap segments. +//************************************************************************* +-D_CSTACK_SIZE=(100*4) +-D_IRQ_STACK_SIZE=(3*8*4) +-D_HEAP_SIZE=(1024*2) + +-Z(DATA)CSTACK+_CSTACK_SIZE=RAMSTART-RAMEND +-Z(DATA)IRQ_STACK+_IRQ_STACK_SIZE=RAMSTART-RAMEND +-Z(DATA)HEAP+_HEAP_SIZE=RAMSTART-RAMEND + +//************************************************************************* +// ELF/DWARF support. +// +// Uncomment the line "-Felf" below to generate ELF/DWARF output. +// Available format specifiers are: +// +// "-yn": Suppress DWARF debug output +// "-yp": Multiple ELF program sections +// "-yas": Format suitable for debuggers from ARM Ltd (also sets -p flag) +// +// "-Felf" and the format specifiers can also be supplied directly as +// command line options, or selected from the Xlink Output tab in the +// IAR Embedded Workbench. +//************************************************************************* + +// -Felf diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/ioat91sam7x256.ddf b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/ioat91sam7x256.ddf new file mode 100644 index 0000000..c9fcf32 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/ioat91sam7x256.ddf @@ -0,0 +1,2259 @@ +; ---------------------------------------------------------------------------- +; ATMEL Microcontroller Software Support - ROUSSET - +; ---------------------------------------------------------------------------- +; DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +; DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +; INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +; OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +; LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +; EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +; ---------------------------------------------------------------------------- +; File Name : AT91SAM7X256.ddf +; Object : AT91SAM7X256 definitions +; Generated : AT91 SW Application Group 11/02/2005 (15:17:30) +; +; CVS Reference : /AT91SAM7X256.pl/1.14/Tue Sep 13 15:06:52 2005// +; CVS Reference : /SYS_SAM7X.pl/1.3/Tue Feb 1 17:01:43 2005// +; CVS Reference : /MC_SAM7X.pl/1.2/Fri May 20 14:13:04 2005// +; CVS Reference : /PMC_SAM7X.pl/1.4/Tue Feb 8 13:58:10 2005// +; CVS Reference : /RSTC_SAM7X.pl/1.2/Wed Jul 13 14:57:50 2005// +; CVS Reference : /UDP_SAM7X.pl/1.1/Tue May 10 11:35:35 2005// +; CVS Reference : /PWM_SAM7X.pl/1.1/Tue May 10 11:53:07 2005// +; CVS Reference : /AIC_6075B.pl/1.3/Fri May 20 14:01:30 2005// +; CVS Reference : /PIO_6057A.pl/1.2/Thu Feb 3 10:18:28 2005// +; CVS Reference : /RTTC_6081A.pl/1.2/Tue Nov 9 14:43:58 2004// +; CVS Reference : /PITC_6079A.pl/1.2/Tue Nov 9 14:43:56 2004// +; CVS Reference : /WDTC_6080A.pl/1.3/Tue Nov 9 14:44:00 2004// +; CVS Reference : /VREG_6085B.pl/1.1/Tue Feb 1 16:05:48 2005// +; CVS Reference : /PDC_6074C.pl/1.2/Thu Feb 3 08:48:54 2005// +; CVS Reference : /DBGU_6059D.pl/1.1/Mon Jan 31 13:15:32 2005// +; CVS Reference : /SPI_6088D.pl/1.3/Fri May 20 14:08:59 2005// +; CVS Reference : /US_6089C.pl/1.1/Mon Jul 12 18:23:26 2004// +; CVS Reference : /SSC_6078B.pl/1.1/Wed Jul 13 15:19:19 2005// +; CVS Reference : /TWI_6061A.pl/1.1/Tue Jul 13 07:38:06 2004// +; CVS Reference : /TC_6082A.pl/1.7/Fri Mar 11 12:52:17 2005// +; CVS Reference : /CAN_6019B.pl/1.1/Tue Mar 8 12:42:22 2005// +; CVS Reference : /EMACB_6119A.pl/1.6/Wed Jul 13 15:05:35 2005// +; CVS Reference : /ADC_6051C.pl/1.1/Fri Oct 17 09:12:38 2003// +; ---------------------------------------------------------------------------- + +[Sfr] + +; ========== Register definition for SYS peripheral ========== +; ========== Register definition for AIC peripheral ========== +sfr = "AIC_SMR", "Memory", 0xfffff000, 4, base=16 +sfr = "AIC_SMR.PRIOR", "Memory", 0xfffff000, 4, base=16, bitRange=0-2 +sfr = "AIC_SMR.SRCTYPE", "Memory", 0xfffff000, 4, base=16, bitRange=5-6 +sfr = "AIC_SVR", "Memory", 0xfffff080, 4, base=16 +sfr = "AIC_IVR", "Memory", 0xfffff100, 4, base=16 +sfr = "AIC_FVR", "Memory", 0xfffff104, 4, base=16 +sfr = "AIC_ISR", "Memory", 0xfffff108, 4, base=16 +sfr = "AIC_IPR", "Memory", 0xfffff10c, 4, base=16 +sfr = "AIC_IMR", "Memory", 0xfffff110, 4, base=16 +sfr = "AIC_CISR", "Memory", 0xfffff114, 4, base=16 +sfr = "AIC_CISR.NFIQ", "Memory", 0xfffff114, 4, base=16, bitRange=0 +sfr = "AIC_CISR.NIRQ", "Memory", 0xfffff114, 4, base=16, bitRange=1 +sfr = "AIC_IECR", "Memory", 0xfffff120, 4, base=16 +sfr = "AIC_IDCR", "Memory", 0xfffff124, 4, base=16 +sfr = "AIC_ICCR", "Memory", 0xfffff128, 4, base=16 +sfr = "AIC_ISCR", "Memory", 0xfffff12c, 4, base=16 +sfr = "AIC_EOICR", "Memory", 0xfffff130, 4, base=16 +sfr = "AIC_SPU", "Memory", 0xfffff134, 4, base=16 +sfr = "AIC_DCR", "Memory", 0xfffff138, 4, base=16 +sfr = "AIC_DCR.PROT", "Memory", 0xfffff138, 4, base=16, bitRange=0 +sfr = "AIC_DCR.GMSK", "Memory", 0xfffff138, 4, base=16, bitRange=1 +sfr = "AIC_FFER", "Memory", 0xfffff140, 4, base=16 +sfr = "AIC_FFDR", "Memory", 0xfffff144, 4, base=16 +sfr = "AIC_FFSR", "Memory", 0xfffff148, 4, base=16 +; ========== Register definition for PDC_DBGU peripheral ========== +sfr = "DBGU_RPR", "Memory", 0xfffff300, 4, base=16 +sfr = "DBGU_RCR", "Memory", 0xfffff304, 4, base=16 +sfr = "DBGU_TPR", "Memory", 0xfffff308, 4, base=16 +sfr = "DBGU_TCR", "Memory", 0xfffff30c, 4, base=16 +sfr = "DBGU_RNPR", "Memory", 0xfffff310, 4, base=16 +sfr = "DBGU_RNCR", "Memory", 0xfffff314, 4, base=16 +sfr = "DBGU_TNPR", "Memory", 0xfffff318, 4, base=16 +sfr = "DBGU_TNCR", "Memory", 0xfffff31c, 4, base=16 +sfr = "DBGU_PTCR", "Memory", 0xfffff320, 4, base=16 +sfr = "DBGU_PTCR.RXTEN", "Memory", 0xfffff320, 4, base=16, bitRange=0 +sfr = "DBGU_PTCR.RXTDIS", "Memory", 0xfffff320, 4, base=16, bitRange=1 +sfr = "DBGU_PTCR.TXTEN", "Memory", 0xfffff320, 4, base=16, bitRange=8 +sfr = "DBGU_PTCR.TXTDIS", "Memory", 0xfffff320, 4, base=16, bitRange=9 +sfr = "DBGU_PTSR", "Memory", 0xfffff324, 4, base=16 +sfr = "DBGU_PTSR.RXTEN", "Memory", 0xfffff324, 4, base=16, bitRange=0 +sfr = "DBGU_PTSR.TXTEN", "Memory", 0xfffff324, 4, base=16, bitRange=8 +; ========== Register definition for DBGU peripheral ========== +sfr = "DBGU_CR", "Memory", 0xfffff200, 4, base=16 +sfr = "DBGU_CR.RSTRX", "Memory", 0xfffff200, 4, base=16, bitRange=2 +sfr = "DBGU_CR.RSTTX", "Memory", 0xfffff200, 4, base=16, bitRange=3 +sfr = "DBGU_CR.RXEN", "Memory", 0xfffff200, 4, base=16, bitRange=4 +sfr = "DBGU_CR.RXDIS", "Memory", 0xfffff200, 4, base=16, bitRange=5 +sfr = "DBGU_CR.TXEN", "Memory", 0xfffff200, 4, base=16, bitRange=6 +sfr = "DBGU_CR.TXDIS", "Memory", 0xfffff200, 4, base=16, bitRange=7 +sfr = "DBGU_CR.RSTSTA", "Memory", 0xfffff200, 4, base=16, bitRange=8 +sfr = "DBGU_MR", "Memory", 0xfffff204, 4, base=16 +sfr = "DBGU_MR.PAR", "Memory", 0xfffff204, 4, base=16, bitRange=9-11 +sfr = "DBGU_MR.CHMODE", "Memory", 0xfffff204, 4, base=16, bitRange=14-15 +sfr = "DBGU_IER", "Memory", 0xfffff208, 4, base=16 +sfr = "DBGU_IER.RXRDY", "Memory", 0xfffff208, 4, base=16, bitRange=0 +sfr = "DBGU_IER.TXRDY", "Memory", 0xfffff208, 4, base=16, bitRange=1 +sfr = "DBGU_IER.ENDRX", "Memory", 0xfffff208, 4, base=16, bitRange=3 +sfr = "DBGU_IER.ENDTX", "Memory", 0xfffff208, 4, base=16, bitRange=4 +sfr = "DBGU_IER.OVRE", "Memory", 0xfffff208, 4, base=16, bitRange=5 +sfr = "DBGU_IER.FRAME", "Memory", 0xfffff208, 4, base=16, bitRange=6 +sfr = "DBGU_IER.PARE", "Memory", 0xfffff208, 4, base=16, bitRange=7 +sfr = "DBGU_IER.TXEMPTY", "Memory", 0xfffff208, 4, base=16, bitRange=9 +sfr = "DBGU_IER.TXBUFE", "Memory", 0xfffff208, 4, base=16, bitRange=11 +sfr = "DBGU_IER.RXBUFF", "Memory", 0xfffff208, 4, base=16, bitRange=12 +sfr = "DBGU_IER.TX", "Memory", 0xfffff208, 4, base=16, bitRange=30 +sfr = "DBGU_IER.RX", "Memory", 0xfffff208, 4, base=16, bitRange=31 +sfr = "DBGU_IDR", "Memory", 0xfffff20c, 4, base=16 +sfr = "DBGU_IDR.RXRDY", "Memory", 0xfffff20c, 4, base=16, bitRange=0 +sfr = "DBGU_IDR.TXRDY", "Memory", 0xfffff20c, 4, base=16, bitRange=1 +sfr = "DBGU_IDR.ENDRX", "Memory", 0xfffff20c, 4, base=16, bitRange=3 +sfr = "DBGU_IDR.ENDTX", "Memory", 0xfffff20c, 4, base=16, bitRange=4 +sfr = "DBGU_IDR.OVRE", "Memory", 0xfffff20c, 4, base=16, bitRange=5 +sfr = "DBGU_IDR.FRAME", "Memory", 0xfffff20c, 4, base=16, bitRange=6 +sfr = "DBGU_IDR.PARE", "Memory", 0xfffff20c, 4, base=16, bitRange=7 +sfr = "DBGU_IDR.TXEMPTY", "Memory", 0xfffff20c, 4, base=16, bitRange=9 +sfr = "DBGU_IDR.TXBUFE", "Memory", 0xfffff20c, 4, base=16, bitRange=11 +sfr = "DBGU_IDR.RXBUFF", "Memory", 0xfffff20c, 4, base=16, bitRange=12 +sfr = "DBGU_IDR.TX", "Memory", 0xfffff20c, 4, base=16, bitRange=30 +sfr = "DBGU_IDR.RX", "Memory", 0xfffff20c, 4, base=16, bitRange=31 +sfr = "DBGU_IMR", "Memory", 0xfffff210, 4, base=16 +sfr = "DBGU_IMR.RXRDY", "Memory", 0xfffff210, 4, base=16, bitRange=0 +sfr = "DBGU_IMR.TXRDY", "Memory", 0xfffff210, 4, base=16, bitRange=1 +sfr = "DBGU_IMR.ENDRX", "Memory", 0xfffff210, 4, base=16, bitRange=3 +sfr = "DBGU_IMR.ENDTX", "Memory", 0xfffff210, 4, base=16, bitRange=4 +sfr = "DBGU_IMR.OVRE", "Memory", 0xfffff210, 4, base=16, bitRange=5 +sfr = "DBGU_IMR.FRAME", "Memory", 0xfffff210, 4, base=16, bitRange=6 +sfr = "DBGU_IMR.PARE", "Memory", 0xfffff210, 4, base=16, bitRange=7 +sfr = "DBGU_IMR.TXEMPTY", "Memory", 0xfffff210, 4, base=16, bitRange=9 +sfr = "DBGU_IMR.TXBUFE", "Memory", 0xfffff210, 4, base=16, bitRange=11 +sfr = "DBGU_IMR.RXBUFF", "Memory", 0xfffff210, 4, base=16, bitRange=12 +sfr = "DBGU_IMR.TX", "Memory", 0xfffff210, 4, base=16, bitRange=30 +sfr = "DBGU_IMR.RX", "Memory", 0xfffff210, 4, base=16, bitRange=31 +sfr = "DBGU_CSR", "Memory", 0xfffff214, 4, base=16 +sfr = "DBGU_CSR.RXRDY", "Memory", 0xfffff214, 4, base=16, bitRange=0 +sfr = "DBGU_CSR.TXRDY", "Memory", 0xfffff214, 4, base=16, bitRange=1 +sfr = "DBGU_CSR.ENDRX", "Memory", 0xfffff214, 4, base=16, bitRange=3 +sfr = "DBGU_CSR.ENDTX", "Memory", 0xfffff214, 4, base=16, bitRange=4 +sfr = "DBGU_CSR.OVRE", "Memory", 0xfffff214, 4, base=16, bitRange=5 +sfr = "DBGU_CSR.FRAME", "Memory", 0xfffff214, 4, base=16, bitRange=6 +sfr = "DBGU_CSR.PARE", "Memory", 0xfffff214, 4, base=16, bitRange=7 +sfr = "DBGU_CSR.TXEMPTY", "Memory", 0xfffff214, 4, base=16, bitRange=9 +sfr = "DBGU_CSR.TXBUFE", "Memory", 0xfffff214, 4, base=16, bitRange=11 +sfr = "DBGU_CSR.RXBUFF", "Memory", 0xfffff214, 4, base=16, bitRange=12 +sfr = "DBGU_CSR.TX", "Memory", 0xfffff214, 4, base=16, bitRange=30 +sfr = "DBGU_CSR.RX", "Memory", 0xfffff214, 4, base=16, bitRange=31 +sfr = "DBGU_RHR", "Memory", 0xfffff218, 4, base=16 +sfr = "DBGU_THR", "Memory", 0xfffff21c, 4, base=16 +sfr = "DBGU_BRGR", "Memory", 0xfffff220, 4, base=16 +sfr = "DBGU_CIDR", "Memory", 0xfffff240, 4, base=16 +sfr = "DBGU_EXID", "Memory", 0xfffff244, 4, base=16 +sfr = "DBGU_FNTR", "Memory", 0xfffff248, 4, base=16 +sfr = "DBGU_FNTR.NTRST", "Memory", 0xfffff248, 4, base=16, bitRange=0 +; ========== Register definition for PIOA peripheral ========== +sfr = "PIOA_PER", "Memory", 0xfffff400, 4, base=16 +sfr = "PIOA_PDR", "Memory", 0xfffff404, 4, base=16 +sfr = "PIOA_PSR", "Memory", 0xfffff408, 4, base=16 +sfr = "PIOA_OER", "Memory", 0xfffff410, 4, base=16 +sfr = "PIOA_ODR", "Memory", 0xfffff414, 4, base=16 +sfr = "PIOA_OSR", "Memory", 0xfffff418, 4, base=16 +sfr = "PIOA_IFER", "Memory", 0xfffff420, 4, base=16 +sfr = "PIOA_IFDR", "Memory", 0xfffff424, 4, base=16 +sfr = "PIOA_IFSR", "Memory", 0xfffff428, 4, base=16 +sfr = "PIOA_SODR", "Memory", 0xfffff430, 4, base=16 +sfr = "PIOA_CODR", "Memory", 0xfffff434, 4, base=16 +sfr = "PIOA_ODSR", "Memory", 0xfffff438, 4, base=16 +sfr = "PIOA_PDSR", "Memory", 0xfffff43c, 4, base=16 +sfr = "PIOA_IER", "Memory", 0xfffff440, 4, base=16 +sfr = "PIOA_IDR", "Memory", 0xfffff444, 4, base=16 +sfr = "PIOA_IMR", "Memory", 0xfffff448, 4, base=16 +sfr = "PIOA_ISR", "Memory", 0xfffff44c, 4, base=16 +sfr = "PIOA_MDER", "Memory", 0xfffff450, 4, base=16 +sfr = "PIOA_MDDR", "Memory", 0xfffff454, 4, base=16 +sfr = "PIOA_MDSR", "Memory", 0xfffff458, 4, base=16 +sfr = "PIOA_PPUDR", "Memory", 0xfffff460, 4, base=16 +sfr = "PIOA_PPUER", "Memory", 0xfffff464, 4, base=16 +sfr = "PIOA_PPUSR", "Memory", 0xfffff468, 4, base=16 +sfr = "PIOA_ASR", "Memory", 0xfffff470, 4, base=16 +sfr = "PIOA_BSR", "Memory", 0xfffff474, 4, base=16 +sfr = "PIOA_ABSR", "Memory", 0xfffff478, 4, base=16 +sfr = "PIOA_OWER", "Memory", 0xfffff4a0, 4, base=16 +sfr = "PIOA_OWDR", "Memory", 0xfffff4a4, 4, base=16 +sfr = "PIOA_OWSR", "Memory", 0xfffff4a8, 4, base=16 +; ========== Register definition for PIOB peripheral ========== +sfr = "PIOB_PER", "Memory", 0xfffff600, 4, base=16 +sfr = "PIOB_PDR", "Memory", 0xfffff604, 4, base=16 +sfr = "PIOB_PSR", "Memory", 0xfffff608, 4, base=16 +sfr = "PIOB_OER", "Memory", 0xfffff610, 4, base=16 +sfr = "PIOB_ODR", "Memory", 0xfffff614, 4, base=16 +sfr = "PIOB_OSR", "Memory", 0xfffff618, 4, base=16 +sfr = "PIOB_IFER", "Memory", 0xfffff620, 4, base=16 +sfr = "PIOB_IFDR", "Memory", 0xfffff624, 4, base=16 +sfr = "PIOB_IFSR", "Memory", 0xfffff628, 4, base=16 +sfr = "PIOB_SODR", "Memory", 0xfffff630, 4, base=16 +sfr = "PIOB_CODR", "Memory", 0xfffff634, 4, base=16 +sfr = "PIOB_ODSR", "Memory", 0xfffff638, 4, base=16 +sfr = "PIOB_PDSR", "Memory", 0xfffff63c, 4, base=16 +sfr = "PIOB_IER", "Memory", 0xfffff640, 4, base=16 +sfr = "PIOB_IDR", "Memory", 0xfffff644, 4, base=16 +sfr = "PIOB_IMR", "Memory", 0xfffff648, 4, base=16 +sfr = "PIOB_ISR", "Memory", 0xfffff64c, 4, base=16 +sfr = "PIOB_MDER", "Memory", 0xfffff650, 4, base=16 +sfr = "PIOB_MDDR", "Memory", 0xfffff654, 4, base=16 +sfr = "PIOB_MDSR", "Memory", 0xfffff658, 4, base=16 +sfr = "PIOB_PPUDR", "Memory", 0xfffff660, 4, base=16 +sfr = "PIOB_PPUER", "Memory", 0xfffff664, 4, base=16 +sfr = "PIOB_PPUSR", "Memory", 0xfffff668, 4, base=16 +sfr = "PIOB_ASR", "Memory", 0xfffff670, 4, base=16 +sfr = "PIOB_BSR", "Memory", 0xfffff674, 4, base=16 +sfr = "PIOB_ABSR", "Memory", 0xfffff678, 4, base=16 +sfr = "PIOB_OWER", "Memory", 0xfffff6a0, 4, base=16 +sfr = "PIOB_OWDR", "Memory", 0xfffff6a4, 4, base=16 +sfr = "PIOB_OWSR", "Memory", 0xfffff6a8, 4, base=16 +; ========== Register definition for CKGR peripheral ========== +sfr = "CKGR_MOR", "Memory", 0xfffffc20, 4, base=16 +sfr = "CKGR_MOR.MOSCEN", "Memory", 0xfffffc20, 4, base=16, bitRange=0 +sfr = "CKGR_MOR.OSCBYPASS", "Memory", 0xfffffc20, 4, base=16, bitRange=1 +sfr = "CKGR_MOR.OSCOUNT", "Memory", 0xfffffc20, 4, base=16, bitRange=8-15 +sfr = "CKGR_MCFR", "Memory", 0xfffffc24, 4, base=16 +sfr = "CKGR_MCFR.MAINF", "Memory", 0xfffffc24, 4, base=16, bitRange=0-15 +sfr = "CKGR_MCFR.MAINRDY", "Memory", 0xfffffc24, 4, base=16, bitRange=16 +sfr = "CKGR_PLLR", "Memory", 0xfffffc2c, 4, base=16 +sfr = "CKGR_PLLR.DIV", "Memory", 0xfffffc2c, 4, base=16, bitRange=0-7 +sfr = "CKGR_PLLR.PLLCOUNT", "Memory", 0xfffffc2c, 4, base=16, bitRange=8-13 +sfr = "CKGR_PLLR.OUT", "Memory", 0xfffffc2c, 4, base=16, bitRange=14-15 +sfr = "CKGR_PLLR.MUL", "Memory", 0xfffffc2c, 4, base=16, bitRange=16-26 +sfr = "CKGR_PLLR.USBDIV", "Memory", 0xfffffc2c, 4, base=16, bitRange=28-29 +; ========== Register definition for PMC peripheral ========== +sfr = "PMC_SCER", "Memory", 0xfffffc00, 4, base=16 +sfr = "PMC_SCER.PCK", "Memory", 0xfffffc00, 4, base=16, bitRange=0 +sfr = "PMC_SCER.UDP", "Memory", 0xfffffc00, 4, base=16, bitRange=7 +sfr = "PMC_SCER.PCK0", "Memory", 0xfffffc00, 4, base=16, bitRange=8 +sfr = "PMC_SCER.PCK1", "Memory", 0xfffffc00, 4, base=16, bitRange=9 +sfr = "PMC_SCER.PCK2", "Memory", 0xfffffc00, 4, base=16, bitRange=10 +sfr = "PMC_SCER.PCK3", "Memory", 0xfffffc00, 4, base=16, bitRange=11 +sfr = "PMC_SCDR", "Memory", 0xfffffc04, 4, base=16 +sfr = "PMC_SCDR.PCK", "Memory", 0xfffffc04, 4, base=16, bitRange=0 +sfr = "PMC_SCDR.UDP", "Memory", 0xfffffc04, 4, base=16, bitRange=7 +sfr = "PMC_SCDR.PCK0", "Memory", 0xfffffc04, 4, base=16, bitRange=8 +sfr = "PMC_SCDR.PCK1", "Memory", 0xfffffc04, 4, base=16, bitRange=9 +sfr = "PMC_SCDR.PCK2", "Memory", 0xfffffc04, 4, base=16, bitRange=10 +sfr = "PMC_SCDR.PCK3", "Memory", 0xfffffc04, 4, base=16, bitRange=11 +sfr = "PMC_SCSR", "Memory", 0xfffffc08, 4, base=16 +sfr = "PMC_SCSR.PCK", "Memory", 0xfffffc08, 4, base=16, bitRange=0 +sfr = "PMC_SCSR.UDP", "Memory", 0xfffffc08, 4, base=16, bitRange=7 +sfr = "PMC_SCSR.PCK0", "Memory", 0xfffffc08, 4, base=16, bitRange=8 +sfr = "PMC_SCSR.PCK1", "Memory", 0xfffffc08, 4, base=16, bitRange=9 +sfr = "PMC_SCSR.PCK2", "Memory", 0xfffffc08, 4, base=16, bitRange=10 +sfr = "PMC_SCSR.PCK3", "Memory", 0xfffffc08, 4, base=16, bitRange=11 +sfr = "PMC_PCER", "Memory", 0xfffffc10, 4, base=16 +sfr = "PMC_PCDR", "Memory", 0xfffffc14, 4, base=16 +sfr = "PMC_PCSR", "Memory", 0xfffffc18, 4, base=16 +sfr = "PMC_MOR", "Memory", 0xfffffc20, 4, base=16 +sfr = "PMC_MOR.MOSCEN", "Memory", 0xfffffc20, 4, base=16, bitRange=0 +sfr = "PMC_MOR.OSCBYPASS", "Memory", 0xfffffc20, 4, base=16, bitRange=1 +sfr = "PMC_MOR.OSCOUNT", "Memory", 0xfffffc20, 4, base=16, bitRange=8-15 +sfr = "PMC_MCFR", "Memory", 0xfffffc24, 4, base=16 +sfr = "PMC_MCFR.MAINF", "Memory", 0xfffffc24, 4, base=16, bitRange=0-15 +sfr = "PMC_MCFR.MAINRDY", "Memory", 0xfffffc24, 4, base=16, bitRange=16 +sfr = "PMC_PLLR", "Memory", 0xfffffc2c, 4, base=16 +sfr = "PMC_PLLR.DIV", "Memory", 0xfffffc2c, 4, base=16, bitRange=0-7 +sfr = "PMC_PLLR.PLLCOUNT", "Memory", 0xfffffc2c, 4, base=16, bitRange=8-13 +sfr = "PMC_PLLR.OUT", "Memory", 0xfffffc2c, 4, base=16, bitRange=14-15 +sfr = "PMC_PLLR.MUL", "Memory", 0xfffffc2c, 4, base=16, bitRange=16-26 +sfr = "PMC_PLLR.USBDIV", "Memory", 0xfffffc2c, 4, base=16, bitRange=28-29 +sfr = "PMC_MCKR", "Memory", 0xfffffc30, 4, base=16 +sfr = "PMC_MCKR.CSS", "Memory", 0xfffffc30, 4, base=16, bitRange=0-1 +sfr = "PMC_MCKR.PRES", "Memory", 0xfffffc30, 4, base=16, bitRange=2-4 +sfr = "PMC_PCKR", "Memory", 0xfffffc40, 4, base=16 +sfr = "PMC_PCKR.CSS", "Memory", 0xfffffc40, 4, base=16, bitRange=0-1 +sfr = "PMC_PCKR.PRES", "Memory", 0xfffffc40, 4, base=16, bitRange=2-4 +sfr = "PMC_IER", "Memory", 0xfffffc60, 4, base=16 +sfr = "PMC_IER.MOSCS", "Memory", 0xfffffc60, 4, base=16, bitRange=0 +sfr = "PMC_IER.LOCK", "Memory", 0xfffffc60, 4, base=16, bitRange=2 +sfr = "PMC_IER.MCKRDY", "Memory", 0xfffffc60, 4, base=16, bitRange=3 +sfr = "PMC_IER.PCK0RDY", "Memory", 0xfffffc60, 4, base=16, bitRange=8 +sfr = "PMC_IER.PCK1RDY", "Memory", 0xfffffc60, 4, base=16, bitRange=9 +sfr = "PMC_IER.PCK2RDY", "Memory", 0xfffffc60, 4, base=16, bitRange=10 +sfr = "PMC_IER.PCK3RDY", "Memory", 0xfffffc60, 4, base=16, bitRange=11 +sfr = "PMC_IDR", "Memory", 0xfffffc64, 4, base=16 +sfr = "PMC_IDR.MOSCS", "Memory", 0xfffffc64, 4, base=16, bitRange=0 +sfr = "PMC_IDR.LOCK", "Memory", 0xfffffc64, 4, base=16, bitRange=2 +sfr = "PMC_IDR.MCKRDY", "Memory", 0xfffffc64, 4, base=16, bitRange=3 +sfr = "PMC_IDR.PCK0RDY", "Memory", 0xfffffc64, 4, base=16, bitRange=8 +sfr = "PMC_IDR.PCK1RDY", "Memory", 0xfffffc64, 4, base=16, bitRange=9 +sfr = "PMC_IDR.PCK2RDY", "Memory", 0xfffffc64, 4, base=16, bitRange=10 +sfr = "PMC_IDR.PCK3RDY", "Memory", 0xfffffc64, 4, base=16, bitRange=11 +sfr = "PMC_SR", "Memory", 0xfffffc68, 4, base=16 +sfr = "PMC_SR.MOSCS", "Memory", 0xfffffc68, 4, base=16, bitRange=0 +sfr = "PMC_SR.LOCK", "Memory", 0xfffffc68, 4, base=16, bitRange=2 +sfr = "PMC_SR.MCKRDY", "Memory", 0xfffffc68, 4, base=16, bitRange=3 +sfr = "PMC_SR.PCK0RDY", "Memory", 0xfffffc68, 4, base=16, bitRange=8 +sfr = "PMC_SR.PCK1RDY", "Memory", 0xfffffc68, 4, base=16, bitRange=9 +sfr = "PMC_SR.PCK2RDY", "Memory", 0xfffffc68, 4, base=16, bitRange=10 +sfr = "PMC_SR.PCK3RDY", "Memory", 0xfffffc68, 4, base=16, bitRange=11 +sfr = "PMC_IMR", "Memory", 0xfffffc6c, 4, base=16 +sfr = "PMC_IMR.MOSCS", "Memory", 0xfffffc6c, 4, base=16, bitRange=0 +sfr = "PMC_IMR.LOCK", "Memory", 0xfffffc6c, 4, base=16, bitRange=2 +sfr = "PMC_IMR.MCKRDY", "Memory", 0xfffffc6c, 4, base=16, bitRange=3 +sfr = "PMC_IMR.PCK0RDY", "Memory", 0xfffffc6c, 4, base=16, bitRange=8 +sfr = "PMC_IMR.PCK1RDY", "Memory", 0xfffffc6c, 4, base=16, bitRange=9 +sfr = "PMC_IMR.PCK2RDY", "Memory", 0xfffffc6c, 4, base=16, bitRange=10 +sfr = "PMC_IMR.PCK3RDY", "Memory", 0xfffffc6c, 4, base=16, bitRange=11 +; ========== Register definition for RSTC peripheral ========== +sfr = "RSTC_RCR", "Memory", 0xfffffd00, 4, base=16 +sfr = "RSTC_RCR.PROCRST", "Memory", 0xfffffd00, 4, base=16, bitRange=0 +sfr = "RSTC_RCR.PERRST", "Memory", 0xfffffd00, 4, base=16, bitRange=2 +sfr = "RSTC_RCR.EXTRST", "Memory", 0xfffffd00, 4, base=16, bitRange=3 +sfr = "RSTC_RCR.KEY", "Memory", 0xfffffd00, 4, base=16, bitRange=24-31 +sfr = "RSTC_RSR", "Memory", 0xfffffd04, 4, base=16 +sfr = "RSTC_RSR.URSTS", "Memory", 0xfffffd04, 4, base=16, bitRange=0 +sfr = "RSTC_RSR.BODSTS", "Memory", 0xfffffd04, 4, base=16, bitRange=1 +sfr = "RSTC_RSR.RSTTYP", "Memory", 0xfffffd04, 4, base=16, bitRange=8-10 +sfr = "RSTC_RSR.NRSTL", "Memory", 0xfffffd04, 4, base=16, bitRange=16 +sfr = "RSTC_RSR.SRCMP", "Memory", 0xfffffd04, 4, base=16, bitRange=17 +sfr = "RSTC_RMR", "Memory", 0xfffffd08, 4, base=16 +sfr = "RSTC_RMR.URSTEN", "Memory", 0xfffffd08, 4, base=16, bitRange=0 +sfr = "RSTC_RMR.URSTIEN", "Memory", 0xfffffd08, 4, base=16, bitRange=4 +sfr = "RSTC_RMR.ERSTL", "Memory", 0xfffffd08, 4, base=16, bitRange=8-11 +sfr = "RSTC_RMR.BODIEN", "Memory", 0xfffffd08, 4, base=16, bitRange=16 +sfr = "RSTC_RMR.KEY", "Memory", 0xfffffd08, 4, base=16, bitRange=24-31 +; ========== Register definition for RTTC peripheral ========== +sfr = "RTTC_RTMR", "Memory", 0xfffffd20, 4, base=16 +sfr = "RTTC_RTMR.RTPRES", "Memory", 0xfffffd20, 4, base=16, bitRange=0-15 +sfr = "RTTC_RTMR.ALMIEN", "Memory", 0xfffffd20, 4, base=16, bitRange=16 +sfr = "RTTC_RTMR.RTTINCIEN", "Memory", 0xfffffd20, 4, base=16, bitRange=17 +sfr = "RTTC_RTMR.RTTRST", "Memory", 0xfffffd20, 4, base=16, bitRange=18 +sfr = "RTTC_RTAR", "Memory", 0xfffffd24, 4, base=16 +sfr = "RTTC_RTAR.ALMV", "Memory", 0xfffffd24, 4, base=16, bitRange=0-31 +sfr = "RTTC_RTVR", "Memory", 0xfffffd28, 4, base=16 +sfr = "RTTC_RTVR.CRTV", "Memory", 0xfffffd28, 4, base=16, bitRange=0-31 +sfr = "RTTC_RTSR", "Memory", 0xfffffd2c, 4, base=16 +sfr = "RTTC_RTSR.ALMS", "Memory", 0xfffffd2c, 4, base=16, bitRange=0 +sfr = "RTTC_RTSR.RTTINC", "Memory", 0xfffffd2c, 4, base=16, bitRange=1 +; ========== Register definition for PITC peripheral ========== +sfr = "PITC_PIMR", "Memory", 0xfffffd30, 4, base=16 +sfr = "PITC_PIMR.PIV", "Memory", 0xfffffd30, 4, base=16, bitRange=0-19 +sfr = "PITC_PIMR.PITEN", "Memory", 0xfffffd30, 4, base=16, bitRange=24 +sfr = "PITC_PIMR.PITIEN", "Memory", 0xfffffd30, 4, base=16, bitRange=25 +sfr = "PITC_PISR", "Memory", 0xfffffd34, 4, base=16 +sfr = "PITC_PISR.PITS", "Memory", 0xfffffd34, 4, base=16, bitRange=0 +sfr = "PITC_PIVR", "Memory", 0xfffffd38, 4, base=16 +sfr = "PITC_PIVR.CPIV", "Memory", 0xfffffd38, 4, base=16, bitRange=0-19 +sfr = "PITC_PIVR.PICNT", "Memory", 0xfffffd38, 4, base=16, bitRange=20-31 +sfr = "PITC_PIIR", "Memory", 0xfffffd3c, 4, base=16 +sfr = "PITC_PIIR.CPIV", "Memory", 0xfffffd3c, 4, base=16, bitRange=0-19 +sfr = "PITC_PIIR.PICNT", "Memory", 0xfffffd3c, 4, base=16, bitRange=20-31 +; ========== Register definition for WDTC peripheral ========== +sfr = "WDTC_WDCR", "Memory", 0xfffffd40, 4, base=16 +sfr = "WDTC_WDCR.WDRSTT", "Memory", 0xfffffd40, 4, base=16, bitRange=0 +sfr = "WDTC_WDCR.KEY", "Memory", 0xfffffd40, 4, base=16, bitRange=24-31 +sfr = "WDTC_WDMR", "Memory", 0xfffffd44, 4, base=16 +sfr = "WDTC_WDMR.WDV", "Memory", 0xfffffd44, 4, base=16, bitRange=0-11 +sfr = "WDTC_WDMR.WDFIEN", "Memory", 0xfffffd44, 4, base=16, bitRange=12 +sfr = "WDTC_WDMR.WDRSTEN", "Memory", 0xfffffd44, 4, base=16, bitRange=13 +sfr = "WDTC_WDMR.WDRPROC", "Memory", 0xfffffd44, 4, base=16, bitRange=14 +sfr = "WDTC_WDMR.WDDIS", "Memory", 0xfffffd44, 4, base=16, bitRange=15 +sfr = "WDTC_WDMR.WDD", "Memory", 0xfffffd44, 4, base=16, bitRange=16-27 +sfr = "WDTC_WDMR.WDDBGHLT", "Memory", 0xfffffd44, 4, base=16, bitRange=28 +sfr = "WDTC_WDMR.WDIDLEHLT", "Memory", 0xfffffd44, 4, base=16, bitRange=29 +sfr = "WDTC_WDSR", "Memory", 0xfffffd48, 4, base=16 +sfr = "WDTC_WDSR.WDUNF", "Memory", 0xfffffd48, 4, base=16, bitRange=0 +sfr = "WDTC_WDSR.WDERR", "Memory", 0xfffffd48, 4, base=16, bitRange=1 +; ========== Register definition for VREG peripheral ========== +sfr = "VREG_MR", "Memory", 0xfffffd60, 4, base=16 +sfr = "VREG_MR.PSTDBY", "Memory", 0xfffffd60, 4, base=16, bitRange=0 +; ========== Register definition for MC peripheral ========== +sfr = "MC_RCR", "Memory", 0xffffff00, 4, base=16 +sfr = "MC_RCR.RCB", "Memory", 0xffffff00, 4, base=16, bitRange=0 +sfr = "MC_ASR", "Memory", 0xffffff04, 4, base=16 +sfr = "MC_ASR.UNDADD", "Memory", 0xffffff04, 4, base=16, bitRange=0 +sfr = "MC_ASR.MISADD", "Memory", 0xffffff04, 4, base=16, bitRange=1 +sfr = "MC_ASR.ABTSZ", "Memory", 0xffffff04, 4, base=16, bitRange=8-9 +sfr = "MC_ASR.ABTTYP", "Memory", 0xffffff04, 4, base=16, bitRange=10-11 +sfr = "MC_ASR.MST0", "Memory", 0xffffff04, 4, base=16, bitRange=16 +sfr = "MC_ASR.MST1", "Memory", 0xffffff04, 4, base=16, bitRange=17 +sfr = "MC_ASR.SVMST0", "Memory", 0xffffff04, 4, base=16, bitRange=24 +sfr = "MC_ASR.SVMST1", "Memory", 0xffffff04, 4, base=16, bitRange=25 +sfr = "MC_AASR", "Memory", 0xffffff08, 4, base=16 +sfr = "MC_FMR", "Memory", 0xffffff60, 4, base=16 +sfr = "MC_FMR.FRDY", "Memory", 0xffffff60, 4, base=16, bitRange=0 +sfr = "MC_FMR.LOCKE", "Memory", 0xffffff60, 4, base=16, bitRange=2 +sfr = "MC_FMR.PROGE", "Memory", 0xffffff60, 4, base=16, bitRange=3 +sfr = "MC_FMR.NEBP", "Memory", 0xffffff60, 4, base=16, bitRange=7 +sfr = "MC_FMR.FWS", "Memory", 0xffffff60, 4, base=16, bitRange=8-9 +sfr = "MC_FMR.FMCN", "Memory", 0xffffff60, 4, base=16, bitRange=16-23 +sfr = "MC_FCR", "Memory", 0xffffff64, 4, base=16 +sfr = "MC_FCR.FCMD", "Memory", 0xffffff64, 4, base=16, bitRange=0-3 +sfr = "MC_FCR.PAGEN", "Memory", 0xffffff64, 4, base=16, bitRange=8-17 +sfr = "MC_FCR.KEY", "Memory", 0xffffff64, 4, base=16, bitRange=24-31 +sfr = "MC_FSR", "Memory", 0xffffff68, 4, base=16 +sfr = "MC_FSR.FRDY", "Memory", 0xffffff68, 4, base=16, bitRange=0 +sfr = "MC_FSR.LOCKE", "Memory", 0xffffff68, 4, base=16, bitRange=2 +sfr = "MC_FSR.PROGE", "Memory", 0xffffff68, 4, base=16, bitRange=3 +sfr = "MC_FSR.SECURITY", "Memory", 0xffffff68, 4, base=16, bitRange=4 +sfr = "MC_FSR.GPNVM0", "Memory", 0xffffff68, 4, base=16, bitRange=8 +sfr = "MC_FSR.GPNVM1", "Memory", 0xffffff68, 4, base=16, bitRange=9 +sfr = "MC_FSR.GPNVM2", "Memory", 0xffffff68, 4, base=16, bitRange=10 +sfr = "MC_FSR.GPNVM3", "Memory", 0xffffff68, 4, base=16, bitRange=11 +sfr = "MC_FSR.GPNVM4", "Memory", 0xffffff68, 4, base=16, bitRange=12 +sfr = "MC_FSR.GPNVM5", "Memory", 0xffffff68, 4, base=16, bitRange=13 +sfr = "MC_FSR.GPNVM6", "Memory", 0xffffff68, 4, base=16, bitRange=14 +sfr = "MC_FSR.GPNVM7", "Memory", 0xffffff68, 4, base=16, bitRange=15 +sfr = "MC_FSR.LOCKS0", "Memory", 0xffffff68, 4, base=16, bitRange=16 +sfr = "MC_FSR.LOCKS1", "Memory", 0xffffff68, 4, base=16, bitRange=17 +sfr = "MC_FSR.LOCKS2", "Memory", 0xffffff68, 4, base=16, bitRange=18 +sfr = "MC_FSR.LOCKS3", "Memory", 0xffffff68, 4, base=16, bitRange=19 +sfr = "MC_FSR.LOCKS4", "Memory", 0xffffff68, 4, base=16, bitRange=20 +sfr = "MC_FSR.LOCKS5", "Memory", 0xffffff68, 4, base=16, bitRange=21 +sfr = "MC_FSR.LOCKS6", "Memory", 0xffffff68, 4, base=16, bitRange=22 +sfr = "MC_FSR.LOCKS7", "Memory", 0xffffff68, 4, base=16, bitRange=23 +sfr = "MC_FSR.LOCKS8", "Memory", 0xffffff68, 4, base=16, bitRange=24 +sfr = "MC_FSR.LOCKS9", "Memory", 0xffffff68, 4, base=16, bitRange=25 +sfr = "MC_FSR.LOCKS10", "Memory", 0xffffff68, 4, base=16, bitRange=26 +sfr = "MC_FSR.LOCKS11", "Memory", 0xffffff68, 4, base=16, bitRange=27 +sfr = "MC_FSR.LOCKS12", "Memory", 0xffffff68, 4, base=16, bitRange=28 +sfr = "MC_FSR.LOCKS13", "Memory", 0xffffff68, 4, base=16, bitRange=29 +sfr = "MC_FSR.LOCKS14", "Memory", 0xffffff68, 4, base=16, bitRange=30 +sfr = "MC_FSR.LOCKS15", "Memory", 0xffffff68, 4, base=16, bitRange=31 +; ========== Register definition for PDC_SPI1 peripheral ========== +sfr = "SPI1_RPR", "Memory", 0xfffe4100, 4, base=16 +sfr = "SPI1_RCR", "Memory", 0xfffe4104, 4, base=16 +sfr = "SPI1_TPR", "Memory", 0xfffe4108, 4, base=16 +sfr = "SPI1_TCR", "Memory", 0xfffe410c, 4, base=16 +sfr = "SPI1_RNPR", "Memory", 0xfffe4110, 4, base=16 +sfr = "SPI1_RNCR", "Memory", 0xfffe4114, 4, base=16 +sfr = "SPI1_TNPR", "Memory", 0xfffe4118, 4, base=16 +sfr = "SPI1_TNCR", "Memory", 0xfffe411c, 4, base=16 +sfr = "SPI1_PTCR", "Memory", 0xfffe4120, 4, base=16 +sfr = "SPI1_PTCR.RXTEN", "Memory", 0xfffe4120, 4, base=16, bitRange=0 +sfr = "SPI1_PTCR.RXTDIS", "Memory", 0xfffe4120, 4, base=16, bitRange=1 +sfr = "SPI1_PTCR.TXTEN", "Memory", 0xfffe4120, 4, base=16, bitRange=8 +sfr = "SPI1_PTCR.TXTDIS", "Memory", 0xfffe4120, 4, base=16, bitRange=9 +sfr = "SPI1_PTSR", "Memory", 0xfffe4124, 4, base=16 +sfr = "SPI1_PTSR.RXTEN", "Memory", 0xfffe4124, 4, base=16, bitRange=0 +sfr = "SPI1_PTSR.TXTEN", "Memory", 0xfffe4124, 4, base=16, bitRange=8 +; ========== Register definition for SPI1 peripheral ========== +sfr = "SPI1_CR", "Memory", 0xfffe4000, 4, base=16 +sfr = "SPI1_CR.SPIEN", "Memory", 0xfffe4000, 4, base=16, bitRange=0 +sfr = "SPI1_CR.SPIDIS", "Memory", 0xfffe4000, 4, base=16, bitRange=1 +sfr = "SPI1_CR.SWRST", "Memory", 0xfffe4000, 4, base=16, bitRange=7 +sfr = "SPI1_CR.LASTXFER", "Memory", 0xfffe4000, 4, base=16, bitRange=24 +sfr = "SPI1_MR", "Memory", 0xfffe4004, 4, base=16 +sfr = "SPI1_MR.MSTR", "Memory", 0xfffe4004, 4, base=16, bitRange=0 +sfr = "SPI1_MR.PS", "Memory", 0xfffe4004, 4, base=16, bitRange=1 +sfr = "SPI1_MR.PCSDEC", "Memory", 0xfffe4004, 4, base=16, bitRange=2 +sfr = "SPI1_MR.FDIV", "Memory", 0xfffe4004, 4, base=16, bitRange=3 +sfr = "SPI1_MR.MODFDIS", "Memory", 0xfffe4004, 4, base=16, bitRange=4 +sfr = "SPI1_MR.LLB", "Memory", 0xfffe4004, 4, base=16, bitRange=7 +sfr = "SPI1_MR.PCS", "Memory", 0xfffe4004, 4, base=16, bitRange=16-19 +sfr = "SPI1_MR.DLYBCS", "Memory", 0xfffe4004, 4, base=16, bitRange=24-31 +sfr = "SPI1_RDR", "Memory", 0xfffe4008, 4, base=16 +sfr = "SPI1_RDR.RD", "Memory", 0xfffe4008, 4, base=16, bitRange=0-15 +sfr = "SPI1_RDR.RPCS", "Memory", 0xfffe4008, 4, base=16, bitRange=16-19 +sfr = "SPI1_TDR", "Memory", 0xfffe400c, 4, base=16 +sfr = "SPI1_TDR.TD", "Memory", 0xfffe400c, 4, base=16, bitRange=0-15 +sfr = "SPI1_TDR.TPCS", "Memory", 0xfffe400c, 4, base=16, bitRange=16-19 +sfr = "SPI1_TDR.LASTXFER", "Memory", 0xfffe400c, 4, base=16, bitRange=24 +sfr = "SPI1_SR", "Memory", 0xfffe4010, 4, base=16 +sfr = "SPI1_SR.RDRF", "Memory", 0xfffe4010, 4, base=16, bitRange=0 +sfr = "SPI1_SR.TDRE", "Memory", 0xfffe4010, 4, base=16, bitRange=1 +sfr = "SPI1_SR.MODF", "Memory", 0xfffe4010, 4, base=16, bitRange=2 +sfr = "SPI1_SR.OVRES", "Memory", 0xfffe4010, 4, base=16, bitRange=3 +sfr = "SPI1_SR.ENDRX", "Memory", 0xfffe4010, 4, base=16, bitRange=4 +sfr = "SPI1_SR.ENDTX", "Memory", 0xfffe4010, 4, base=16, bitRange=5 +sfr = "SPI1_SR.RXBUFF", "Memory", 0xfffe4010, 4, base=16, bitRange=6 +sfr = "SPI1_SR.TXBUFE", "Memory", 0xfffe4010, 4, base=16, bitRange=7 +sfr = "SPI1_SR.NSSR", "Memory", 0xfffe4010, 4, base=16, bitRange=8 +sfr = "SPI1_SR.TXEMPTY", "Memory", 0xfffe4010, 4, base=16, bitRange=9 +sfr = "SPI1_SR.SPIENS", "Memory", 0xfffe4010, 4, base=16, bitRange=16 +sfr = "SPI1_IER", "Memory", 0xfffe4014, 4, base=16 +sfr = "SPI1_IER.RDRF", "Memory", 0xfffe4014, 4, base=16, bitRange=0 +sfr = "SPI1_IER.TDRE", "Memory", 0xfffe4014, 4, base=16, bitRange=1 +sfr = "SPI1_IER.MODF", "Memory", 0xfffe4014, 4, base=16, bitRange=2 +sfr = "SPI1_IER.OVRES", "Memory", 0xfffe4014, 4, base=16, bitRange=3 +sfr = "SPI1_IER.ENDRX", "Memory", 0xfffe4014, 4, base=16, bitRange=4 +sfr = "SPI1_IER.ENDTX", "Memory", 0xfffe4014, 4, base=16, bitRange=5 +sfr = "SPI1_IER.RXBUFF", "Memory", 0xfffe4014, 4, base=16, bitRange=6 +sfr = "SPI1_IER.TXBUFE", "Memory", 0xfffe4014, 4, base=16, bitRange=7 +sfr = "SPI1_IER.NSSR", "Memory", 0xfffe4014, 4, base=16, bitRange=8 +sfr = "SPI1_IER.TXEMPTY", "Memory", 0xfffe4014, 4, base=16, bitRange=9 +sfr = "SPI1_IDR", "Memory", 0xfffe4018, 4, base=16 +sfr = "SPI1_IDR.RDRF", "Memory", 0xfffe4018, 4, base=16, bitRange=0 +sfr = "SPI1_IDR.TDRE", "Memory", 0xfffe4018, 4, base=16, bitRange=1 +sfr = "SPI1_IDR.MODF", "Memory", 0xfffe4018, 4, base=16, bitRange=2 +sfr = "SPI1_IDR.OVRES", "Memory", 0xfffe4018, 4, base=16, bitRange=3 +sfr = "SPI1_IDR.ENDRX", "Memory", 0xfffe4018, 4, base=16, bitRange=4 +sfr = "SPI1_IDR.ENDTX", "Memory", 0xfffe4018, 4, base=16, bitRange=5 +sfr = "SPI1_IDR.RXBUFF", "Memory", 0xfffe4018, 4, base=16, bitRange=6 +sfr = "SPI1_IDR.TXBUFE", "Memory", 0xfffe4018, 4, base=16, bitRange=7 +sfr = "SPI1_IDR.NSSR", "Memory", 0xfffe4018, 4, base=16, bitRange=8 +sfr = "SPI1_IDR.TXEMPTY", "Memory", 0xfffe4018, 4, base=16, bitRange=9 +sfr = "SPI1_IMR", "Memory", 0xfffe401c, 4, base=16 +sfr = "SPI1_IMR.RDRF", "Memory", 0xfffe401c, 4, base=16, bitRange=0 +sfr = "SPI1_IMR.TDRE", "Memory", 0xfffe401c, 4, base=16, bitRange=1 +sfr = "SPI1_IMR.MODF", "Memory", 0xfffe401c, 4, base=16, bitRange=2 +sfr = "SPI1_IMR.OVRES", "Memory", 0xfffe401c, 4, base=16, bitRange=3 +sfr = "SPI1_IMR.ENDRX", "Memory", 0xfffe401c, 4, base=16, bitRange=4 +sfr = "SPI1_IMR.ENDTX", "Memory", 0xfffe401c, 4, base=16, bitRange=5 +sfr = "SPI1_IMR.RXBUFF", "Memory", 0xfffe401c, 4, base=16, bitRange=6 +sfr = "SPI1_IMR.TXBUFE", "Memory", 0xfffe401c, 4, base=16, bitRange=7 +sfr = "SPI1_IMR.NSSR", "Memory", 0xfffe401c, 4, base=16, bitRange=8 +sfr = "SPI1_IMR.TXEMPTY", "Memory", 0xfffe401c, 4, base=16, bitRange=9 +sfr = "SPI1_CSR", "Memory", 0xfffe4030, 4, base=16 +sfr = "SPI1_CSR.CPOL", "Memory", 0xfffe4030, 4, base=16, bitRange=0 +sfr = "SPI1_CSR.NCPHA", "Memory", 0xfffe4030, 4, base=16, bitRange=1 +sfr = "SPI1_CSR.CSAAT", "Memory", 0xfffe4030, 4, base=16, bitRange=3 +sfr = "SPI1_CSR.BITS", "Memory", 0xfffe4030, 4, base=16, bitRange=4-7 +sfr = "SPI1_CSR.SCBR", "Memory", 0xfffe4030, 4, base=16, bitRange=8-15 +sfr = "SPI1_CSR.DLYBS", "Memory", 0xfffe4030, 4, base=16, bitRange=16-23 +sfr = "SPI1_CSR.DLYBCT", "Memory", 0xfffe4030, 4, base=16, bitRange=24-31 +; ========== Register definition for PDC_SPI0 peripheral ========== +sfr = "SPI0_RPR", "Memory", 0xfffe0100, 4, base=16 +sfr = "SPI0_RCR", "Memory", 0xfffe0104, 4, base=16 +sfr = "SPI0_TPR", "Memory", 0xfffe0108, 4, base=16 +sfr = "SPI0_TCR", "Memory", 0xfffe010c, 4, base=16 +sfr = "SPI0_RNPR", "Memory", 0xfffe0110, 4, base=16 +sfr = "SPI0_RNCR", "Memory", 0xfffe0114, 4, base=16 +sfr = "SPI0_TNPR", "Memory", 0xfffe0118, 4, base=16 +sfr = "SPI0_TNCR", "Memory", 0xfffe011c, 4, base=16 +sfr = "SPI0_PTCR", "Memory", 0xfffe0120, 4, base=16 +sfr = "SPI0_PTCR.RXTEN", "Memory", 0xfffe0120, 4, base=16, bitRange=0 +sfr = "SPI0_PTCR.RXTDIS", "Memory", 0xfffe0120, 4, base=16, bitRange=1 +sfr = "SPI0_PTCR.TXTEN", "Memory", 0xfffe0120, 4, base=16, bitRange=8 +sfr = "SPI0_PTCR.TXTDIS", "Memory", 0xfffe0120, 4, base=16, bitRange=9 +sfr = "SPI0_PTSR", "Memory", 0xfffe0124, 4, base=16 +sfr = "SPI0_PTSR.RXTEN", "Memory", 0xfffe0124, 4, base=16, bitRange=0 +sfr = "SPI0_PTSR.TXTEN", "Memory", 0xfffe0124, 4, base=16, bitRange=8 +; ========== Register definition for SPI0 peripheral ========== +sfr = "SPI0_CR", "Memory", 0xfffe0000, 4, base=16 +sfr = "SPI0_CR.SPIEN", "Memory", 0xfffe0000, 4, base=16, bitRange=0 +sfr = "SPI0_CR.SPIDIS", "Memory", 0xfffe0000, 4, base=16, bitRange=1 +sfr = "SPI0_CR.SWRST", "Memory", 0xfffe0000, 4, base=16, bitRange=7 +sfr = "SPI0_CR.LASTXFER", "Memory", 0xfffe0000, 4, base=16, bitRange=24 +sfr = "SPI0_MR", "Memory", 0xfffe0004, 4, base=16 +sfr = "SPI0_MR.MSTR", "Memory", 0xfffe0004, 4, base=16, bitRange=0 +sfr = "SPI0_MR.PS", "Memory", 0xfffe0004, 4, base=16, bitRange=1 +sfr = "SPI0_MR.PCSDEC", "Memory", 0xfffe0004, 4, base=16, bitRange=2 +sfr = "SPI0_MR.FDIV", "Memory", 0xfffe0004, 4, base=16, bitRange=3 +sfr = "SPI0_MR.MODFDIS", "Memory", 0xfffe0004, 4, base=16, bitRange=4 +sfr = "SPI0_MR.LLB", "Memory", 0xfffe0004, 4, base=16, bitRange=7 +sfr = "SPI0_MR.PCS", "Memory", 0xfffe0004, 4, base=16, bitRange=16-19 +sfr = "SPI0_MR.DLYBCS", "Memory", 0xfffe0004, 4, base=16, bitRange=24-31 +sfr = "SPI0_RDR", "Memory", 0xfffe0008, 4, base=16 +sfr = "SPI0_RDR.RD", "Memory", 0xfffe0008, 4, base=16, bitRange=0-15 +sfr = "SPI0_RDR.RPCS", "Memory", 0xfffe0008, 4, base=16, bitRange=16-19 +sfr = "SPI0_TDR", "Memory", 0xfffe000c, 4, base=16 +sfr = "SPI0_TDR.TD", "Memory", 0xfffe000c, 4, base=16, bitRange=0-15 +sfr = "SPI0_TDR.TPCS", "Memory", 0xfffe000c, 4, base=16, bitRange=16-19 +sfr = "SPI0_TDR.LASTXFER", "Memory", 0xfffe000c, 4, base=16, bitRange=24 +sfr = "SPI0_SR", "Memory", 0xfffe0010, 4, base=16 +sfr = "SPI0_SR.RDRF", "Memory", 0xfffe0010, 4, base=16, bitRange=0 +sfr = "SPI0_SR.TDRE", "Memory", 0xfffe0010, 4, base=16, bitRange=1 +sfr = "SPI0_SR.MODF", "Memory", 0xfffe0010, 4, base=16, bitRange=2 +sfr = "SPI0_SR.OVRES", "Memory", 0xfffe0010, 4, base=16, bitRange=3 +sfr = "SPI0_SR.ENDRX", "Memory", 0xfffe0010, 4, base=16, bitRange=4 +sfr = "SPI0_SR.ENDTX", "Memory", 0xfffe0010, 4, base=16, bitRange=5 +sfr = "SPI0_SR.RXBUFF", "Memory", 0xfffe0010, 4, base=16, bitRange=6 +sfr = "SPI0_SR.TXBUFE", "Memory", 0xfffe0010, 4, base=16, bitRange=7 +sfr = "SPI0_SR.NSSR", "Memory", 0xfffe0010, 4, base=16, bitRange=8 +sfr = "SPI0_SR.TXEMPTY", "Memory", 0xfffe0010, 4, base=16, bitRange=9 +sfr = "SPI0_SR.SPIENS", "Memory", 0xfffe0010, 4, base=16, bitRange=16 +sfr = "SPI0_IER", "Memory", 0xfffe0014, 4, base=16 +sfr = "SPI0_IER.RDRF", "Memory", 0xfffe0014, 4, base=16, bitRange=0 +sfr = "SPI0_IER.TDRE", "Memory", 0xfffe0014, 4, base=16, bitRange=1 +sfr = "SPI0_IER.MODF", "Memory", 0xfffe0014, 4, base=16, bitRange=2 +sfr = "SPI0_IER.OVRES", "Memory", 0xfffe0014, 4, base=16, bitRange=3 +sfr = "SPI0_IER.ENDRX", "Memory", 0xfffe0014, 4, base=16, bitRange=4 +sfr = "SPI0_IER.ENDTX", "Memory", 0xfffe0014, 4, base=16, bitRange=5 +sfr = "SPI0_IER.RXBUFF", "Memory", 0xfffe0014, 4, base=16, bitRange=6 +sfr = "SPI0_IER.TXBUFE", "Memory", 0xfffe0014, 4, base=16, bitRange=7 +sfr = "SPI0_IER.NSSR", "Memory", 0xfffe0014, 4, base=16, bitRange=8 +sfr = "SPI0_IER.TXEMPTY", "Memory", 0xfffe0014, 4, base=16, bitRange=9 +sfr = "SPI0_IDR", "Memory", 0xfffe0018, 4, base=16 +sfr = "SPI0_IDR.RDRF", "Memory", 0xfffe0018, 4, base=16, bitRange=0 +sfr = "SPI0_IDR.TDRE", "Memory", 0xfffe0018, 4, base=16, bitRange=1 +sfr = "SPI0_IDR.MODF", "Memory", 0xfffe0018, 4, base=16, bitRange=2 +sfr = "SPI0_IDR.OVRES", "Memory", 0xfffe0018, 4, base=16, bitRange=3 +sfr = "SPI0_IDR.ENDRX", "Memory", 0xfffe0018, 4, base=16, bitRange=4 +sfr = "SPI0_IDR.ENDTX", "Memory", 0xfffe0018, 4, base=16, bitRange=5 +sfr = "SPI0_IDR.RXBUFF", "Memory", 0xfffe0018, 4, base=16, bitRange=6 +sfr = "SPI0_IDR.TXBUFE", "Memory", 0xfffe0018, 4, base=16, bitRange=7 +sfr = "SPI0_IDR.NSSR", "Memory", 0xfffe0018, 4, base=16, bitRange=8 +sfr = "SPI0_IDR.TXEMPTY", "Memory", 0xfffe0018, 4, base=16, bitRange=9 +sfr = "SPI0_IMR", "Memory", 0xfffe001c, 4, base=16 +sfr = "SPI0_IMR.RDRF", "Memory", 0xfffe001c, 4, base=16, bitRange=0 +sfr = "SPI0_IMR.TDRE", "Memory", 0xfffe001c, 4, base=16, bitRange=1 +sfr = "SPI0_IMR.MODF", "Memory", 0xfffe001c, 4, base=16, bitRange=2 +sfr = "SPI0_IMR.OVRES", "Memory", 0xfffe001c, 4, base=16, bitRange=3 +sfr = "SPI0_IMR.ENDRX", "Memory", 0xfffe001c, 4, base=16, bitRange=4 +sfr = "SPI0_IMR.ENDTX", "Memory", 0xfffe001c, 4, base=16, bitRange=5 +sfr = "SPI0_IMR.RXBUFF", "Memory", 0xfffe001c, 4, base=16, bitRange=6 +sfr = "SPI0_IMR.TXBUFE", "Memory", 0xfffe001c, 4, base=16, bitRange=7 +sfr = "SPI0_IMR.NSSR", "Memory", 0xfffe001c, 4, base=16, bitRange=8 +sfr = "SPI0_IMR.TXEMPTY", "Memory", 0xfffe001c, 4, base=16, bitRange=9 +sfr = "SPI0_CSR", "Memory", 0xfffe0030, 4, base=16 +sfr = "SPI0_CSR.CPOL", "Memory", 0xfffe0030, 4, base=16, bitRange=0 +sfr = "SPI0_CSR.NCPHA", "Memory", 0xfffe0030, 4, base=16, bitRange=1 +sfr = "SPI0_CSR.CSAAT", "Memory", 0xfffe0030, 4, base=16, bitRange=3 +sfr = "SPI0_CSR.BITS", "Memory", 0xfffe0030, 4, base=16, bitRange=4-7 +sfr = "SPI0_CSR.SCBR", "Memory", 0xfffe0030, 4, base=16, bitRange=8-15 +sfr = "SPI0_CSR.DLYBS", "Memory", 0xfffe0030, 4, base=16, bitRange=16-23 +sfr = "SPI0_CSR.DLYBCT", "Memory", 0xfffe0030, 4, base=16, bitRange=24-31 +; ========== Register definition for PDC_US1 peripheral ========== +sfr = "US1_RPR", "Memory", 0xfffc4100, 4, base=16 +sfr = "US1_RCR", "Memory", 0xfffc4104, 4, base=16 +sfr = "US1_TPR", "Memory", 0xfffc4108, 4, base=16 +sfr = "US1_TCR", "Memory", 0xfffc410c, 4, base=16 +sfr = "US1_RNPR", "Memory", 0xfffc4110, 4, base=16 +sfr = "US1_RNCR", "Memory", 0xfffc4114, 4, base=16 +sfr = "US1_TNPR", "Memory", 0xfffc4118, 4, base=16 +sfr = "US1_TNCR", "Memory", 0xfffc411c, 4, base=16 +sfr = "US1_PTCR", "Memory", 0xfffc4120, 4, base=16 +sfr = "US1_PTCR.RXTEN", "Memory", 0xfffc4120, 4, base=16, bitRange=0 +sfr = "US1_PTCR.RXTDIS", "Memory", 0xfffc4120, 4, base=16, bitRange=1 +sfr = "US1_PTCR.TXTEN", "Memory", 0xfffc4120, 4, base=16, bitRange=8 +sfr = "US1_PTCR.TXTDIS", "Memory", 0xfffc4120, 4, base=16, bitRange=9 +sfr = "US1_PTSR", "Memory", 0xfffc4124, 4, base=16 +sfr = "US1_PTSR.RXTEN", "Memory", 0xfffc4124, 4, base=16, bitRange=0 +sfr = "US1_PTSR.TXTEN", "Memory", 0xfffc4124, 4, base=16, bitRange=8 +; ========== Register definition for US1 peripheral ========== +sfr = "US1_CR", "Memory", 0xfffc4000, 4, base=16 +sfr = "US1_CR.RSTRX", "Memory", 0xfffc4000, 4, base=16, bitRange=2 +sfr = "US1_CR.RSTTX", "Memory", 0xfffc4000, 4, base=16, bitRange=3 +sfr = "US1_CR.RXEN", "Memory", 0xfffc4000, 4, base=16, bitRange=4 +sfr = "US1_CR.RXDIS", "Memory", 0xfffc4000, 4, base=16, bitRange=5 +sfr = "US1_CR.TXEN", "Memory", 0xfffc4000, 4, base=16, bitRange=6 +sfr = "US1_CR.TXDIS", "Memory", 0xfffc4000, 4, base=16, bitRange=7 +sfr = "US1_CR.RSTSTA", "Memory", 0xfffc4000, 4, base=16, bitRange=8 +sfr = "US1_CR.STTBRK", "Memory", 0xfffc4000, 4, base=16, bitRange=9 +sfr = "US1_CR.STPBRK", "Memory", 0xfffc4000, 4, base=16, bitRange=10 +sfr = "US1_CR.STTTO", "Memory", 0xfffc4000, 4, base=16, bitRange=11 +sfr = "US1_CR.SENDA", "Memory", 0xfffc4000, 4, base=16, bitRange=12 +sfr = "US1_CR.RSTIT", "Memory", 0xfffc4000, 4, base=16, bitRange=13 +sfr = "US1_CR.RSTNACK", "Memory", 0xfffc4000, 4, base=16, bitRange=14 +sfr = "US1_CR.RETTO", "Memory", 0xfffc4000, 4, base=16, bitRange=15 +sfr = "US1_CR.DTREN", "Memory", 0xfffc4000, 4, base=16, bitRange=16 +sfr = "US1_CR.DTRDIS", "Memory", 0xfffc4000, 4, base=16, bitRange=17 +sfr = "US1_CR.RTSEN", "Memory", 0xfffc4000, 4, base=16, bitRange=18 +sfr = "US1_CR.RTSDIS", "Memory", 0xfffc4000, 4, base=16, bitRange=19 +sfr = "US1_MR", "Memory", 0xfffc4004, 4, base=16 +sfr = "US1_MR.USMODE", "Memory", 0xfffc4004, 4, base=16, bitRange=0-3 +sfr = "US1_MR.CLKS", "Memory", 0xfffc4004, 4, base=16, bitRange=4-5 +sfr = "US1_MR.CHRL", "Memory", 0xfffc4004, 4, base=16, bitRange=6-7 +sfr = "US1_MR.SYNC", "Memory", 0xfffc4004, 4, base=16, bitRange=8 +sfr = "US1_MR.PAR", "Memory", 0xfffc4004, 4, base=16, bitRange=9-11 +sfr = "US1_MR.NBSTOP", "Memory", 0xfffc4004, 4, base=16, bitRange=12-13 +sfr = "US1_MR.CHMODE", "Memory", 0xfffc4004, 4, base=16, bitRange=14-15 +sfr = "US1_MR.MSBF", "Memory", 0xfffc4004, 4, base=16, bitRange=16 +sfr = "US1_MR.MODE9", "Memory", 0xfffc4004, 4, base=16, bitRange=17 +sfr = "US1_MR.CKLO", "Memory", 0xfffc4004, 4, base=16, bitRange=18 +sfr = "US1_MR.OVER", "Memory", 0xfffc4004, 4, base=16, bitRange=19 +sfr = "US1_MR.INACK", "Memory", 0xfffc4004, 4, base=16, bitRange=20 +sfr = "US1_MR.DSNACK", "Memory", 0xfffc4004, 4, base=16, bitRange=21 +sfr = "US1_MR.ITER", "Memory", 0xfffc4004, 4, base=16, bitRange=24 +sfr = "US1_MR.FILTER", "Memory", 0xfffc4004, 4, base=16, bitRange=28 +sfr = "US1_IER", "Memory", 0xfffc4008, 4, base=16 +sfr = "US1_IER.RXRDY", "Memory", 0xfffc4008, 4, base=16, bitRange=0 +sfr = "US1_IER.TXRDY", "Memory", 0xfffc4008, 4, base=16, bitRange=1 +sfr = "US1_IER.RXBRK", "Memory", 0xfffc4008, 4, base=16, bitRange=2 +sfr = "US1_IER.ENDRX", "Memory", 0xfffc4008, 4, base=16, bitRange=3 +sfr = "US1_IER.ENDTX", "Memory", 0xfffc4008, 4, base=16, bitRange=4 +sfr = "US1_IER.OVRE", "Memory", 0xfffc4008, 4, base=16, bitRange=5 +sfr = "US1_IER.FRAME", "Memory", 0xfffc4008, 4, base=16, bitRange=6 +sfr = "US1_IER.PARE", "Memory", 0xfffc4008, 4, base=16, bitRange=7 +sfr = "US1_IER.TIMEOUT", "Memory", 0xfffc4008, 4, base=16, bitRange=8 +sfr = "US1_IER.TXEMPTY", "Memory", 0xfffc4008, 4, base=16, bitRange=9 +sfr = "US1_IER.ITERATION", "Memory", 0xfffc4008, 4, base=16, bitRange=10 +sfr = "US1_IER.TXBUFE", "Memory", 0xfffc4008, 4, base=16, bitRange=11 +sfr = "US1_IER.RXBUFF", "Memory", 0xfffc4008, 4, base=16, bitRange=12 +sfr = "US1_IER.NACK", "Memory", 0xfffc4008, 4, base=16, bitRange=13 +sfr = "US1_IER.RIIC", "Memory", 0xfffc4008, 4, base=16, bitRange=16 +sfr = "US1_IER.DSRIC", "Memory", 0xfffc4008, 4, base=16, bitRange=17 +sfr = "US1_IER.DCDIC", "Memory", 0xfffc4008, 4, base=16, bitRange=18 +sfr = "US1_IER.CTSIC", "Memory", 0xfffc4008, 4, base=16, bitRange=19 +sfr = "US1_IDR", "Memory", 0xfffc400c, 4, base=16 +sfr = "US1_IDR.RXRDY", "Memory", 0xfffc400c, 4, base=16, bitRange=0 +sfr = "US1_IDR.TXRDY", "Memory", 0xfffc400c, 4, base=16, bitRange=1 +sfr = "US1_IDR.RXBRK", "Memory", 0xfffc400c, 4, base=16, bitRange=2 +sfr = "US1_IDR.ENDRX", "Memory", 0xfffc400c, 4, base=16, bitRange=3 +sfr = "US1_IDR.ENDTX", "Memory", 0xfffc400c, 4, base=16, bitRange=4 +sfr = "US1_IDR.OVRE", "Memory", 0xfffc400c, 4, base=16, bitRange=5 +sfr = "US1_IDR.FRAME", "Memory", 0xfffc400c, 4, base=16, bitRange=6 +sfr = "US1_IDR.PARE", "Memory", 0xfffc400c, 4, base=16, bitRange=7 +sfr = "US1_IDR.TIMEOUT", "Memory", 0xfffc400c, 4, base=16, bitRange=8 +sfr = "US1_IDR.TXEMPTY", "Memory", 0xfffc400c, 4, base=16, bitRange=9 +sfr = "US1_IDR.ITERATION", "Memory", 0xfffc400c, 4, base=16, bitRange=10 +sfr = "US1_IDR.TXBUFE", "Memory", 0xfffc400c, 4, base=16, bitRange=11 +sfr = "US1_IDR.RXBUFF", "Memory", 0xfffc400c, 4, base=16, bitRange=12 +sfr = "US1_IDR.NACK", "Memory", 0xfffc400c, 4, base=16, bitRange=13 +sfr = "US1_IDR.RIIC", "Memory", 0xfffc400c, 4, base=16, bitRange=16 +sfr = "US1_IDR.DSRIC", "Memory", 0xfffc400c, 4, base=16, bitRange=17 +sfr = "US1_IDR.DCDIC", "Memory", 0xfffc400c, 4, base=16, bitRange=18 +sfr = "US1_IDR.CTSIC", "Memory", 0xfffc400c, 4, base=16, bitRange=19 +sfr = "US1_IMR", "Memory", 0xfffc4010, 4, base=16 +sfr = "US1_IMR.RXRDY", "Memory", 0xfffc4010, 4, base=16, bitRange=0 +sfr = "US1_IMR.TXRDY", "Memory", 0xfffc4010, 4, base=16, bitRange=1 +sfr = "US1_IMR.RXBRK", "Memory", 0xfffc4010, 4, base=16, bitRange=2 +sfr = "US1_IMR.ENDRX", "Memory", 0xfffc4010, 4, base=16, bitRange=3 +sfr = "US1_IMR.ENDTX", "Memory", 0xfffc4010, 4, base=16, bitRange=4 +sfr = "US1_IMR.OVRE", "Memory", 0xfffc4010, 4, base=16, bitRange=5 +sfr = "US1_IMR.FRAME", "Memory", 0xfffc4010, 4, base=16, bitRange=6 +sfr = "US1_IMR.PARE", "Memory", 0xfffc4010, 4, base=16, bitRange=7 +sfr = "US1_IMR.TIMEOUT", "Memory", 0xfffc4010, 4, base=16, bitRange=8 +sfr = "US1_IMR.TXEMPTY", "Memory", 0xfffc4010, 4, base=16, bitRange=9 +sfr = "US1_IMR.ITERATION", "Memory", 0xfffc4010, 4, base=16, bitRange=10 +sfr = "US1_IMR.TXBUFE", "Memory", 0xfffc4010, 4, base=16, bitRange=11 +sfr = "US1_IMR.RXBUFF", "Memory", 0xfffc4010, 4, base=16, bitRange=12 +sfr = "US1_IMR.NACK", "Memory", 0xfffc4010, 4, base=16, bitRange=13 +sfr = "US1_IMR.RIIC", "Memory", 0xfffc4010, 4, base=16, bitRange=16 +sfr = "US1_IMR.DSRIC", "Memory", 0xfffc4010, 4, base=16, bitRange=17 +sfr = "US1_IMR.DCDIC", "Memory", 0xfffc4010, 4, base=16, bitRange=18 +sfr = "US1_IMR.CTSIC", "Memory", 0xfffc4010, 4, base=16, bitRange=19 +sfr = "US1_CSR", "Memory", 0xfffc4014, 4, base=16 +sfr = "US1_CSR.RXRDY", "Memory", 0xfffc4014, 4, base=16, bitRange=0 +sfr = "US1_CSR.TXRDY", "Memory", 0xfffc4014, 4, base=16, bitRange=1 +sfr = "US1_CSR.RXBRK", "Memory", 0xfffc4014, 4, base=16, bitRange=2 +sfr = "US1_CSR.ENDRX", "Memory", 0xfffc4014, 4, base=16, bitRange=3 +sfr = "US1_CSR.ENDTX", "Memory", 0xfffc4014, 4, base=16, bitRange=4 +sfr = "US1_CSR.OVRE", "Memory", 0xfffc4014, 4, base=16, bitRange=5 +sfr = "US1_CSR.FRAME", "Memory", 0xfffc4014, 4, base=16, bitRange=6 +sfr = "US1_CSR.PARE", "Memory", 0xfffc4014, 4, base=16, bitRange=7 +sfr = "US1_CSR.TIMEOUT", "Memory", 0xfffc4014, 4, base=16, bitRange=8 +sfr = "US1_CSR.TXEMPTY", "Memory", 0xfffc4014, 4, base=16, bitRange=9 +sfr = "US1_CSR.ITERATION", "Memory", 0xfffc4014, 4, base=16, bitRange=10 +sfr = "US1_CSR.TXBUFE", "Memory", 0xfffc4014, 4, base=16, bitRange=11 +sfr = "US1_CSR.RXBUFF", "Memory", 0xfffc4014, 4, base=16, bitRange=12 +sfr = "US1_CSR.NACK", "Memory", 0xfffc4014, 4, base=16, bitRange=13 +sfr = "US1_CSR.RIIC", "Memory", 0xfffc4014, 4, base=16, bitRange=16 +sfr = "US1_CSR.DSRIC", "Memory", 0xfffc4014, 4, base=16, bitRange=17 +sfr = "US1_CSR.DCDIC", "Memory", 0xfffc4014, 4, base=16, bitRange=18 +sfr = "US1_CSR.CTSIC", "Memory", 0xfffc4014, 4, base=16, bitRange=19 +sfr = "US1_CSR.RI", "Memory", 0xfffc4014, 4, base=16, bitRange=20 +sfr = "US1_CSR.DSR", "Memory", 0xfffc4014, 4, base=16, bitRange=21 +sfr = "US1_CSR.DCD", "Memory", 0xfffc4014, 4, base=16, bitRange=22 +sfr = "US1_CSR.CTS", "Memory", 0xfffc4014, 4, base=16, bitRange=23 +sfr = "US1_RHR", "Memory", 0xfffc4018, 4, base=16 +sfr = "US1_THR", "Memory", 0xfffc401c, 4, base=16 +sfr = "US1_BRGR", "Memory", 0xfffc4020, 4, base=16 +sfr = "US1_RTOR", "Memory", 0xfffc4024, 4, base=16 +sfr = "US1_TTGR", "Memory", 0xfffc4028, 4, base=16 +sfr = "US1_FIDI", "Memory", 0xfffc4040, 4, base=16 +sfr = "US1_NER", "Memory", 0xfffc4044, 4, base=16 +sfr = "US1_IF", "Memory", 0xfffc404c, 4, base=16 +; ========== Register definition for PDC_US0 peripheral ========== +sfr = "US0_RPR", "Memory", 0xfffc0100, 4, base=16 +sfr = "US0_RCR", "Memory", 0xfffc0104, 4, base=16 +sfr = "US0_TPR", "Memory", 0xfffc0108, 4, base=16 +sfr = "US0_TCR", "Memory", 0xfffc010c, 4, base=16 +sfr = "US0_RNPR", "Memory", 0xfffc0110, 4, base=16 +sfr = "US0_RNCR", "Memory", 0xfffc0114, 4, base=16 +sfr = "US0_TNPR", "Memory", 0xfffc0118, 4, base=16 +sfr = "US0_TNCR", "Memory", 0xfffc011c, 4, base=16 +sfr = "US0_PTCR", "Memory", 0xfffc0120, 4, base=16 +sfr = "US0_PTCR.RXTEN", "Memory", 0xfffc0120, 4, base=16, bitRange=0 +sfr = "US0_PTCR.RXTDIS", "Memory", 0xfffc0120, 4, base=16, bitRange=1 +sfr = "US0_PTCR.TXTEN", "Memory", 0xfffc0120, 4, base=16, bitRange=8 +sfr = "US0_PTCR.TXTDIS", "Memory", 0xfffc0120, 4, base=16, bitRange=9 +sfr = "US0_PTSR", "Memory", 0xfffc0124, 4, base=16 +sfr = "US0_PTSR.RXTEN", "Memory", 0xfffc0124, 4, base=16, bitRange=0 +sfr = "US0_PTSR.TXTEN", "Memory", 0xfffc0124, 4, base=16, bitRange=8 +; ========== Register definition for US0 peripheral ========== +sfr = "US0_CR", "Memory", 0xfffc0000, 4, base=16 +sfr = "US0_CR.RSTRX", "Memory", 0xfffc0000, 4, base=16, bitRange=2 +sfr = "US0_CR.RSTTX", "Memory", 0xfffc0000, 4, base=16, bitRange=3 +sfr = "US0_CR.RXEN", "Memory", 0xfffc0000, 4, base=16, bitRange=4 +sfr = "US0_CR.RXDIS", "Memory", 0xfffc0000, 4, base=16, bitRange=5 +sfr = "US0_CR.TXEN", "Memory", 0xfffc0000, 4, base=16, bitRange=6 +sfr = "US0_CR.TXDIS", "Memory", 0xfffc0000, 4, base=16, bitRange=7 +sfr = "US0_CR.RSTSTA", "Memory", 0xfffc0000, 4, base=16, bitRange=8 +sfr = "US0_CR.STTBRK", "Memory", 0xfffc0000, 4, base=16, bitRange=9 +sfr = "US0_CR.STPBRK", "Memory", 0xfffc0000, 4, base=16, bitRange=10 +sfr = "US0_CR.STTTO", "Memory", 0xfffc0000, 4, base=16, bitRange=11 +sfr = "US0_CR.SENDA", "Memory", 0xfffc0000, 4, base=16, bitRange=12 +sfr = "US0_CR.RSTIT", "Memory", 0xfffc0000, 4, base=16, bitRange=13 +sfr = "US0_CR.RSTNACK", "Memory", 0xfffc0000, 4, base=16, bitRange=14 +sfr = "US0_CR.RETTO", "Memory", 0xfffc0000, 4, base=16, bitRange=15 +sfr = "US0_CR.DTREN", "Memory", 0xfffc0000, 4, base=16, bitRange=16 +sfr = "US0_CR.DTRDIS", "Memory", 0xfffc0000, 4, base=16, bitRange=17 +sfr = "US0_CR.RTSEN", "Memory", 0xfffc0000, 4, base=16, bitRange=18 +sfr = "US0_CR.RTSDIS", "Memory", 0xfffc0000, 4, base=16, bitRange=19 +sfr = "US0_MR", "Memory", 0xfffc0004, 4, base=16 +sfr = "US0_MR.USMODE", "Memory", 0xfffc0004, 4, base=16, bitRange=0-3 +sfr = "US0_MR.CLKS", "Memory", 0xfffc0004, 4, base=16, bitRange=4-5 +sfr = "US0_MR.CHRL", "Memory", 0xfffc0004, 4, base=16, bitRange=6-7 +sfr = "US0_MR.SYNC", "Memory", 0xfffc0004, 4, base=16, bitRange=8 +sfr = "US0_MR.PAR", "Memory", 0xfffc0004, 4, base=16, bitRange=9-11 +sfr = "US0_MR.NBSTOP", "Memory", 0xfffc0004, 4, base=16, bitRange=12-13 +sfr = "US0_MR.CHMODE", "Memory", 0xfffc0004, 4, base=16, bitRange=14-15 +sfr = "US0_MR.MSBF", "Memory", 0xfffc0004, 4, base=16, bitRange=16 +sfr = "US0_MR.MODE9", "Memory", 0xfffc0004, 4, base=16, bitRange=17 +sfr = "US0_MR.CKLO", "Memory", 0xfffc0004, 4, base=16, bitRange=18 +sfr = "US0_MR.OVER", "Memory", 0xfffc0004, 4, base=16, bitRange=19 +sfr = "US0_MR.INACK", "Memory", 0xfffc0004, 4, base=16, bitRange=20 +sfr = "US0_MR.DSNACK", "Memory", 0xfffc0004, 4, base=16, bitRange=21 +sfr = "US0_MR.ITER", "Memory", 0xfffc0004, 4, base=16, bitRange=24 +sfr = "US0_MR.FILTER", "Memory", 0xfffc0004, 4, base=16, bitRange=28 +sfr = "US0_IER", "Memory", 0xfffc0008, 4, base=16 +sfr = "US0_IER.RXRDY", "Memory", 0xfffc0008, 4, base=16, bitRange=0 +sfr = "US0_IER.TXRDY", "Memory", 0xfffc0008, 4, base=16, bitRange=1 +sfr = "US0_IER.RXBRK", "Memory", 0xfffc0008, 4, base=16, bitRange=2 +sfr = "US0_IER.ENDRX", "Memory", 0xfffc0008, 4, base=16, bitRange=3 +sfr = "US0_IER.ENDTX", "Memory", 0xfffc0008, 4, base=16, bitRange=4 +sfr = "US0_IER.OVRE", "Memory", 0xfffc0008, 4, base=16, bitRange=5 +sfr = "US0_IER.FRAME", "Memory", 0xfffc0008, 4, base=16, bitRange=6 +sfr = "US0_IER.PARE", "Memory", 0xfffc0008, 4, base=16, bitRange=7 +sfr = "US0_IER.TIMEOUT", "Memory", 0xfffc0008, 4, base=16, bitRange=8 +sfr = "US0_IER.TXEMPTY", "Memory", 0xfffc0008, 4, base=16, bitRange=9 +sfr = "US0_IER.ITERATION", "Memory", 0xfffc0008, 4, base=16, bitRange=10 +sfr = "US0_IER.TXBUFE", "Memory", 0xfffc0008, 4, base=16, bitRange=11 +sfr = "US0_IER.RXBUFF", "Memory", 0xfffc0008, 4, base=16, bitRange=12 +sfr = "US0_IER.NACK", "Memory", 0xfffc0008, 4, base=16, bitRange=13 +sfr = "US0_IER.RIIC", "Memory", 0xfffc0008, 4, base=16, bitRange=16 +sfr = "US0_IER.DSRIC", "Memory", 0xfffc0008, 4, base=16, bitRange=17 +sfr = "US0_IER.DCDIC", "Memory", 0xfffc0008, 4, base=16, bitRange=18 +sfr = "US0_IER.CTSIC", "Memory", 0xfffc0008, 4, base=16, bitRange=19 +sfr = "US0_IDR", "Memory", 0xfffc000c, 4, base=16 +sfr = "US0_IDR.RXRDY", "Memory", 0xfffc000c, 4, base=16, bitRange=0 +sfr = "US0_IDR.TXRDY", "Memory", 0xfffc000c, 4, base=16, bitRange=1 +sfr = "US0_IDR.RXBRK", "Memory", 0xfffc000c, 4, base=16, bitRange=2 +sfr = "US0_IDR.ENDRX", "Memory", 0xfffc000c, 4, base=16, bitRange=3 +sfr = "US0_IDR.ENDTX", "Memory", 0xfffc000c, 4, base=16, bitRange=4 +sfr = "US0_IDR.OVRE", "Memory", 0xfffc000c, 4, base=16, bitRange=5 +sfr = "US0_IDR.FRAME", "Memory", 0xfffc000c, 4, base=16, bitRange=6 +sfr = "US0_IDR.PARE", "Memory", 0xfffc000c, 4, base=16, bitRange=7 +sfr = "US0_IDR.TIMEOUT", "Memory", 0xfffc000c, 4, base=16, bitRange=8 +sfr = "US0_IDR.TXEMPTY", "Memory", 0xfffc000c, 4, base=16, bitRange=9 +sfr = "US0_IDR.ITERATION", "Memory", 0xfffc000c, 4, base=16, bitRange=10 +sfr = "US0_IDR.TXBUFE", "Memory", 0xfffc000c, 4, base=16, bitRange=11 +sfr = "US0_IDR.RXBUFF", "Memory", 0xfffc000c, 4, base=16, bitRange=12 +sfr = "US0_IDR.NACK", "Memory", 0xfffc000c, 4, base=16, bitRange=13 +sfr = "US0_IDR.RIIC", "Memory", 0xfffc000c, 4, base=16, bitRange=16 +sfr = "US0_IDR.DSRIC", "Memory", 0xfffc000c, 4, base=16, bitRange=17 +sfr = "US0_IDR.DCDIC", "Memory", 0xfffc000c, 4, base=16, bitRange=18 +sfr = "US0_IDR.CTSIC", "Memory", 0xfffc000c, 4, base=16, bitRange=19 +sfr = "US0_IMR", "Memory", 0xfffc0010, 4, base=16 +sfr = "US0_IMR.RXRDY", "Memory", 0xfffc0010, 4, base=16, bitRange=0 +sfr = "US0_IMR.TXRDY", "Memory", 0xfffc0010, 4, base=16, bitRange=1 +sfr = "US0_IMR.RXBRK", "Memory", 0xfffc0010, 4, base=16, bitRange=2 +sfr = "US0_IMR.ENDRX", "Memory", 0xfffc0010, 4, base=16, bitRange=3 +sfr = "US0_IMR.ENDTX", "Memory", 0xfffc0010, 4, base=16, bitRange=4 +sfr = "US0_IMR.OVRE", "Memory", 0xfffc0010, 4, base=16, bitRange=5 +sfr = "US0_IMR.FRAME", "Memory", 0xfffc0010, 4, base=16, bitRange=6 +sfr = "US0_IMR.PARE", "Memory", 0xfffc0010, 4, base=16, bitRange=7 +sfr = "US0_IMR.TIMEOUT", "Memory", 0xfffc0010, 4, base=16, bitRange=8 +sfr = "US0_IMR.TXEMPTY", "Memory", 0xfffc0010, 4, base=16, bitRange=9 +sfr = "US0_IMR.ITERATION", "Memory", 0xfffc0010, 4, base=16, bitRange=10 +sfr = "US0_IMR.TXBUFE", "Memory", 0xfffc0010, 4, base=16, bitRange=11 +sfr = "US0_IMR.RXBUFF", "Memory", 0xfffc0010, 4, base=16, bitRange=12 +sfr = "US0_IMR.NACK", "Memory", 0xfffc0010, 4, base=16, bitRange=13 +sfr = "US0_IMR.RIIC", "Memory", 0xfffc0010, 4, base=16, bitRange=16 +sfr = "US0_IMR.DSRIC", "Memory", 0xfffc0010, 4, base=16, bitRange=17 +sfr = "US0_IMR.DCDIC", "Memory", 0xfffc0010, 4, base=16, bitRange=18 +sfr = "US0_IMR.CTSIC", "Memory", 0xfffc0010, 4, base=16, bitRange=19 +sfr = "US0_CSR", "Memory", 0xfffc0014, 4, base=16 +sfr = "US0_CSR.RXRDY", "Memory", 0xfffc0014, 4, base=16, bitRange=0 +sfr = "US0_CSR.TXRDY", "Memory", 0xfffc0014, 4, base=16, bitRange=1 +sfr = "US0_CSR.RXBRK", "Memory", 0xfffc0014, 4, base=16, bitRange=2 +sfr = "US0_CSR.ENDRX", "Memory", 0xfffc0014, 4, base=16, bitRange=3 +sfr = "US0_CSR.ENDTX", "Memory", 0xfffc0014, 4, base=16, bitRange=4 +sfr = "US0_CSR.OVRE", "Memory", 0xfffc0014, 4, base=16, bitRange=5 +sfr = "US0_CSR.FRAME", "Memory", 0xfffc0014, 4, base=16, bitRange=6 +sfr = "US0_CSR.PARE", "Memory", 0xfffc0014, 4, base=16, bitRange=7 +sfr = "US0_CSR.TIMEOUT", "Memory", 0xfffc0014, 4, base=16, bitRange=8 +sfr = "US0_CSR.TXEMPTY", "Memory", 0xfffc0014, 4, base=16, bitRange=9 +sfr = "US0_CSR.ITERATION", "Memory", 0xfffc0014, 4, base=16, bitRange=10 +sfr = "US0_CSR.TXBUFE", "Memory", 0xfffc0014, 4, base=16, bitRange=11 +sfr = "US0_CSR.RXBUFF", "Memory", 0xfffc0014, 4, base=16, bitRange=12 +sfr = "US0_CSR.NACK", "Memory", 0xfffc0014, 4, base=16, bitRange=13 +sfr = "US0_CSR.RIIC", "Memory", 0xfffc0014, 4, base=16, bitRange=16 +sfr = "US0_CSR.DSRIC", "Memory", 0xfffc0014, 4, base=16, bitRange=17 +sfr = "US0_CSR.DCDIC", "Memory", 0xfffc0014, 4, base=16, bitRange=18 +sfr = "US0_CSR.CTSIC", "Memory", 0xfffc0014, 4, base=16, bitRange=19 +sfr = "US0_CSR.RI", "Memory", 0xfffc0014, 4, base=16, bitRange=20 +sfr = "US0_CSR.DSR", "Memory", 0xfffc0014, 4, base=16, bitRange=21 +sfr = "US0_CSR.DCD", "Memory", 0xfffc0014, 4, base=16, bitRange=22 +sfr = "US0_CSR.CTS", "Memory", 0xfffc0014, 4, base=16, bitRange=23 +sfr = "US0_RHR", "Memory", 0xfffc0018, 4, base=16 +sfr = "US0_THR", "Memory", 0xfffc001c, 4, base=16 +sfr = "US0_BRGR", "Memory", 0xfffc0020, 4, base=16 +sfr = "US0_RTOR", "Memory", 0xfffc0024, 4, base=16 +sfr = "US0_TTGR", "Memory", 0xfffc0028, 4, base=16 +sfr = "US0_FIDI", "Memory", 0xfffc0040, 4, base=16 +sfr = "US0_NER", "Memory", 0xfffc0044, 4, base=16 +sfr = "US0_IF", "Memory", 0xfffc004c, 4, base=16 +; ========== Register definition for PDC_SSC peripheral ========== +sfr = "SSC_RPR", "Memory", 0xfffd4100, 4, base=16 +sfr = "SSC_RCR", "Memory", 0xfffd4104, 4, base=16 +sfr = "SSC_TPR", "Memory", 0xfffd4108, 4, base=16 +sfr = "SSC_TCR", "Memory", 0xfffd410c, 4, base=16 +sfr = "SSC_RNPR", "Memory", 0xfffd4110, 4, base=16 +sfr = "SSC_RNCR", "Memory", 0xfffd4114, 4, base=16 +sfr = "SSC_TNPR", "Memory", 0xfffd4118, 4, base=16 +sfr = "SSC_TNCR", "Memory", 0xfffd411c, 4, base=16 +sfr = "SSC_PTCR", "Memory", 0xfffd4120, 4, base=16 +sfr = "SSC_PTCR.RXTEN", "Memory", 0xfffd4120, 4, base=16, bitRange=0 +sfr = "SSC_PTCR.RXTDIS", "Memory", 0xfffd4120, 4, base=16, bitRange=1 +sfr = "SSC_PTCR.TXTEN", "Memory", 0xfffd4120, 4, base=16, bitRange=8 +sfr = "SSC_PTCR.TXTDIS", "Memory", 0xfffd4120, 4, base=16, bitRange=9 +sfr = "SSC_PTSR", "Memory", 0xfffd4124, 4, base=16 +sfr = "SSC_PTSR.RXTEN", "Memory", 0xfffd4124, 4, base=16, bitRange=0 +sfr = "SSC_PTSR.TXTEN", "Memory", 0xfffd4124, 4, base=16, bitRange=8 +; ========== Register definition for SSC peripheral ========== +sfr = "SSC_CR", "Memory", 0xfffd4000, 4, base=16 +sfr = "SSC_CR.RXEN", "Memory", 0xfffd4000, 4, base=16, bitRange=0 +sfr = "SSC_CR.RXDIS", "Memory", 0xfffd4000, 4, base=16, bitRange=1 +sfr = "SSC_CR.TXEN", "Memory", 0xfffd4000, 4, base=16, bitRange=8 +sfr = "SSC_CR.TXDIS", "Memory", 0xfffd4000, 4, base=16, bitRange=9 +sfr = "SSC_CR.SWRST", "Memory", 0xfffd4000, 4, base=16, bitRange=15 +sfr = "SSC_CMR", "Memory", 0xfffd4004, 4, base=16 +sfr = "SSC_RCMR", "Memory", 0xfffd4010, 4, base=16 +sfr = "SSC_RCMR.CKS", "Memory", 0xfffd4010, 4, base=16, bitRange=0-1 +sfr = "SSC_RCMR.CKO", "Memory", 0xfffd4010, 4, base=16, bitRange=2-4 +sfr = "SSC_RCMR.CKI", "Memory", 0xfffd4010, 4, base=16, bitRange=5 +sfr = "SSC_RCMR.CKG", "Memory", 0xfffd4010, 4, base=16, bitRange=6-7 +sfr = "SSC_RCMR.START", "Memory", 0xfffd4010, 4, base=16, bitRange=8-11 +sfr = "SSC_RCMR.STOP", "Memory", 0xfffd4010, 4, base=16, bitRange=12 +sfr = "SSC_RCMR.STTDLY", "Memory", 0xfffd4010, 4, base=16, bitRange=16-23 +sfr = "SSC_RCMR.PERIOD", "Memory", 0xfffd4010, 4, base=16, bitRange=24-31 +sfr = "SSC_RFMR", "Memory", 0xfffd4014, 4, base=16 +sfr = "SSC_RFMR.DATLEN", "Memory", 0xfffd4014, 4, base=16, bitRange=0-4 +sfr = "SSC_RFMR.LOOP", "Memory", 0xfffd4014, 4, base=16, bitRange=5 +sfr = "SSC_RFMR.MSBF", "Memory", 0xfffd4014, 4, base=16, bitRange=7 +sfr = "SSC_RFMR.DATNB", "Memory", 0xfffd4014, 4, base=16, bitRange=8-11 +sfr = "SSC_RFMR.FSLEN", "Memory", 0xfffd4014, 4, base=16, bitRange=16-19 +sfr = "SSC_RFMR.FSOS", "Memory", 0xfffd4014, 4, base=16, bitRange=20-22 +sfr = "SSC_RFMR.FSEDGE", "Memory", 0xfffd4014, 4, base=16, bitRange=24 +sfr = "SSC_TCMR", "Memory", 0xfffd4018, 4, base=16 +sfr = "SSC_TCMR.CKS", "Memory", 0xfffd4018, 4, base=16, bitRange=0-1 +sfr = "SSC_TCMR.CKO", "Memory", 0xfffd4018, 4, base=16, bitRange=2-4 +sfr = "SSC_TCMR.CKI", "Memory", 0xfffd4018, 4, base=16, bitRange=5 +sfr = "SSC_TCMR.CKG", "Memory", 0xfffd4018, 4, base=16, bitRange=6-7 +sfr = "SSC_TCMR.START", "Memory", 0xfffd4018, 4, base=16, bitRange=8-11 +sfr = "SSC_TCMR.STTDLY", "Memory", 0xfffd4018, 4, base=16, bitRange=16-23 +sfr = "SSC_TCMR.PERIOD", "Memory", 0xfffd4018, 4, base=16, bitRange=24-31 +sfr = "SSC_TFMR", "Memory", 0xfffd401c, 4, base=16 +sfr = "SSC_TFMR.DATLEN", "Memory", 0xfffd401c, 4, base=16, bitRange=0-4 +sfr = "SSC_TFMR.DATDEF", "Memory", 0xfffd401c, 4, base=16, bitRange=5 +sfr = "SSC_TFMR.MSBF", "Memory", 0xfffd401c, 4, base=16, bitRange=7 +sfr = "SSC_TFMR.DATNB", "Memory", 0xfffd401c, 4, base=16, bitRange=8-11 +sfr = "SSC_TFMR.FSLEN", "Memory", 0xfffd401c, 4, base=16, bitRange=16-19 +sfr = "SSC_TFMR.FSOS", "Memory", 0xfffd401c, 4, base=16, bitRange=20-22 +sfr = "SSC_TFMR.FSDEN", "Memory", 0xfffd401c, 4, base=16, bitRange=23 +sfr = "SSC_TFMR.FSEDGE", "Memory", 0xfffd401c, 4, base=16, bitRange=24 +sfr = "SSC_RHR", "Memory", 0xfffd4020, 4, base=16 +sfr = "SSC_THR", "Memory", 0xfffd4024, 4, base=16 +sfr = "SSC_RSHR", "Memory", 0xfffd4030, 4, base=16 +sfr = "SSC_TSHR", "Memory", 0xfffd4034, 4, base=16 +sfr = "SSC_SR", "Memory", 0xfffd4040, 4, base=16 +sfr = "SSC_SR.TXRDY", "Memory", 0xfffd4040, 4, base=16, bitRange=0 +sfr = "SSC_SR.TXEMPTY", "Memory", 0xfffd4040, 4, base=16, bitRange=1 +sfr = "SSC_SR.ENDTX", "Memory", 0xfffd4040, 4, base=16, bitRange=2 +sfr = "SSC_SR.TXBUFE", "Memory", 0xfffd4040, 4, base=16, bitRange=3 +sfr = "SSC_SR.RXRDY", "Memory", 0xfffd4040, 4, base=16, bitRange=4 +sfr = "SSC_SR.OVRUN", "Memory", 0xfffd4040, 4, base=16, bitRange=5 +sfr = "SSC_SR.ENDRX", "Memory", 0xfffd4040, 4, base=16, bitRange=6 +sfr = "SSC_SR.RXBUFF", "Memory", 0xfffd4040, 4, base=16, bitRange=7 +sfr = "SSC_SR.CP0", "Memory", 0xfffd4040, 4, base=16, bitRange=8 +sfr = "SSC_SR.CP1", "Memory", 0xfffd4040, 4, base=16, bitRange=9 +sfr = "SSC_SR.TXSYN", "Memory", 0xfffd4040, 4, base=16, bitRange=10 +sfr = "SSC_SR.RXSYN", "Memory", 0xfffd4040, 4, base=16, bitRange=11 +sfr = "SSC_SR.TXENA", "Memory", 0xfffd4040, 4, base=16, bitRange=16 +sfr = "SSC_SR.RXENA", "Memory", 0xfffd4040, 4, base=16, bitRange=17 +sfr = "SSC_IER", "Memory", 0xfffd4044, 4, base=16 +sfr = "SSC_IER.TXRDY", "Memory", 0xfffd4044, 4, base=16, bitRange=0 +sfr = "SSC_IER.TXEMPTY", "Memory", 0xfffd4044, 4, base=16, bitRange=1 +sfr = "SSC_IER.ENDTX", "Memory", 0xfffd4044, 4, base=16, bitRange=2 +sfr = "SSC_IER.TXBUFE", "Memory", 0xfffd4044, 4, base=16, bitRange=3 +sfr = "SSC_IER.RXRDY", "Memory", 0xfffd4044, 4, base=16, bitRange=4 +sfr = "SSC_IER.OVRUN", "Memory", 0xfffd4044, 4, base=16, bitRange=5 +sfr = "SSC_IER.ENDRX", "Memory", 0xfffd4044, 4, base=16, bitRange=6 +sfr = "SSC_IER.RXBUFF", "Memory", 0xfffd4044, 4, base=16, bitRange=7 +sfr = "SSC_IER.CP0", "Memory", 0xfffd4044, 4, base=16, bitRange=8 +sfr = "SSC_IER.CP1", "Memory", 0xfffd4044, 4, base=16, bitRange=9 +sfr = "SSC_IER.TXSYN", "Memory", 0xfffd4044, 4, base=16, bitRange=10 +sfr = "SSC_IER.RXSYN", "Memory", 0xfffd4044, 4, base=16, bitRange=11 +sfr = "SSC_IDR", "Memory", 0xfffd4048, 4, base=16 +sfr = "SSC_IDR.TXRDY", "Memory", 0xfffd4048, 4, base=16, bitRange=0 +sfr = "SSC_IDR.TXEMPTY", "Memory", 0xfffd4048, 4, base=16, bitRange=1 +sfr = "SSC_IDR.ENDTX", "Memory", 0xfffd4048, 4, base=16, bitRange=2 +sfr = "SSC_IDR.TXBUFE", "Memory", 0xfffd4048, 4, base=16, bitRange=3 +sfr = "SSC_IDR.RXRDY", "Memory", 0xfffd4048, 4, base=16, bitRange=4 +sfr = "SSC_IDR.OVRUN", "Memory", 0xfffd4048, 4, base=16, bitRange=5 +sfr = "SSC_IDR.ENDRX", "Memory", 0xfffd4048, 4, base=16, bitRange=6 +sfr = "SSC_IDR.RXBUFF", "Memory", 0xfffd4048, 4, base=16, bitRange=7 +sfr = "SSC_IDR.CP0", "Memory", 0xfffd4048, 4, base=16, bitRange=8 +sfr = "SSC_IDR.CP1", "Memory", 0xfffd4048, 4, base=16, bitRange=9 +sfr = "SSC_IDR.TXSYN", "Memory", 0xfffd4048, 4, base=16, bitRange=10 +sfr = "SSC_IDR.RXSYN", "Memory", 0xfffd4048, 4, base=16, bitRange=11 +sfr = "SSC_IMR", "Memory", 0xfffd404c, 4, base=16 +sfr = "SSC_IMR.TXRDY", "Memory", 0xfffd404c, 4, base=16, bitRange=0 +sfr = "SSC_IMR.TXEMPTY", "Memory", 0xfffd404c, 4, base=16, bitRange=1 +sfr = "SSC_IMR.ENDTX", "Memory", 0xfffd404c, 4, base=16, bitRange=2 +sfr = "SSC_IMR.TXBUFE", "Memory", 0xfffd404c, 4, base=16, bitRange=3 +sfr = "SSC_IMR.RXRDY", "Memory", 0xfffd404c, 4, base=16, bitRange=4 +sfr = "SSC_IMR.OVRUN", "Memory", 0xfffd404c, 4, base=16, bitRange=5 +sfr = "SSC_IMR.ENDRX", "Memory", 0xfffd404c, 4, base=16, bitRange=6 +sfr = "SSC_IMR.RXBUFF", "Memory", 0xfffd404c, 4, base=16, bitRange=7 +sfr = "SSC_IMR.CP0", "Memory", 0xfffd404c, 4, base=16, bitRange=8 +sfr = "SSC_IMR.CP1", "Memory", 0xfffd404c, 4, base=16, bitRange=9 +sfr = "SSC_IMR.TXSYN", "Memory", 0xfffd404c, 4, base=16, bitRange=10 +sfr = "SSC_IMR.RXSYN", "Memory", 0xfffd404c, 4, base=16, bitRange=11 +; ========== Register definition for TWI peripheral ========== +sfr = "TWI_CR", "Memory", 0xfffb8000, 4, base=16 +sfr = "TWI_CR.START", "Memory", 0xfffb8000, 4, base=16, bitRange=0 +sfr = "TWI_CR.STOP", "Memory", 0xfffb8000, 4, base=16, bitRange=1 +sfr = "TWI_CR.MSEN", "Memory", 0xfffb8000, 4, base=16, bitRange=2 +sfr = "TWI_CR.MSDIS", "Memory", 0xfffb8000, 4, base=16, bitRange=3 +sfr = "TWI_CR.SWRST", "Memory", 0xfffb8000, 4, base=16, bitRange=7 +sfr = "TWI_MMR", "Memory", 0xfffb8004, 4, base=16 +sfr = "TWI_MMR.IADRSZ", "Memory", 0xfffb8004, 4, base=16, bitRange=8-9 +sfr = "TWI_MMR.MREAD", "Memory", 0xfffb8004, 4, base=16, bitRange=12 +sfr = "TWI_MMR.DADR", "Memory", 0xfffb8004, 4, base=16, bitRange=16-22 +sfr = "TWI_IADR", "Memory", 0xfffb800c, 4, base=16 +sfr = "TWI_CWGR", "Memory", 0xfffb8010, 4, base=16 +sfr = "TWI_CWGR.CLDIV", "Memory", 0xfffb8010, 4, base=16, bitRange=0-7 +sfr = "TWI_CWGR.CHDIV", "Memory", 0xfffb8010, 4, base=16, bitRange=8-15 +sfr = "TWI_CWGR.CKDIV", "Memory", 0xfffb8010, 4, base=16, bitRange=16-18 +sfr = "TWI_SR", "Memory", 0xfffb8020, 4, base=16 +sfr = "TWI_SR.TXCOMP", "Memory", 0xfffb8020, 4, base=16, bitRange=0 +sfr = "TWI_SR.RXRDY", "Memory", 0xfffb8020, 4, base=16, bitRange=1 +sfr = "TWI_SR.TXRDY", "Memory", 0xfffb8020, 4, base=16, bitRange=2 +sfr = "TWI_SR.OVRE", "Memory", 0xfffb8020, 4, base=16, bitRange=6 +sfr = "TWI_SR.UNRE", "Memory", 0xfffb8020, 4, base=16, bitRange=7 +sfr = "TWI_SR.NACK", "Memory", 0xfffb8020, 4, base=16, bitRange=8 +sfr = "TWI_IER", "Memory", 0xfffb8024, 4, base=16 +sfr = "TWI_IER.TXCOMP", "Memory", 0xfffb8024, 4, base=16, bitRange=0 +sfr = "TWI_IER.RXRDY", "Memory", 0xfffb8024, 4, base=16, bitRange=1 +sfr = "TWI_IER.TXRDY", "Memory", 0xfffb8024, 4, base=16, bitRange=2 +sfr = "TWI_IER.OVRE", "Memory", 0xfffb8024, 4, base=16, bitRange=6 +sfr = "TWI_IER.UNRE", "Memory", 0xfffb8024, 4, base=16, bitRange=7 +sfr = "TWI_IER.NACK", "Memory", 0xfffb8024, 4, base=16, bitRange=8 +sfr = "TWI_IDR", "Memory", 0xfffb8028, 4, base=16 +sfr = "TWI_IDR.TXCOMP", "Memory", 0xfffb8028, 4, base=16, bitRange=0 +sfr = "TWI_IDR.RXRDY", "Memory", 0xfffb8028, 4, base=16, bitRange=1 +sfr = "TWI_IDR.TXRDY", "Memory", 0xfffb8028, 4, base=16, bitRange=2 +sfr = "TWI_IDR.OVRE", "Memory", 0xfffb8028, 4, base=16, bitRange=6 +sfr = "TWI_IDR.UNRE", "Memory", 0xfffb8028, 4, base=16, bitRange=7 +sfr = "TWI_IDR.NACK", "Memory", 0xfffb8028, 4, base=16, bitRange=8 +sfr = "TWI_IMR", "Memory", 0xfffb802c, 4, base=16 +sfr = "TWI_IMR.TXCOMP", "Memory", 0xfffb802c, 4, base=16, bitRange=0 +sfr = "TWI_IMR.RXRDY", "Memory", 0xfffb802c, 4, base=16, bitRange=1 +sfr = "TWI_IMR.TXRDY", "Memory", 0xfffb802c, 4, base=16, bitRange=2 +sfr = "TWI_IMR.OVRE", "Memory", 0xfffb802c, 4, base=16, bitRange=6 +sfr = "TWI_IMR.UNRE", "Memory", 0xfffb802c, 4, base=16, bitRange=7 +sfr = "TWI_IMR.NACK", "Memory", 0xfffb802c, 4, base=16, bitRange=8 +sfr = "TWI_RHR", "Memory", 0xfffb8030, 4, base=16 +sfr = "TWI_THR", "Memory", 0xfffb8034, 4, base=16 +; ========== Register definition for PWMC_CH3 peripheral ========== +sfr = "PWMC_CH3_CMR", "Memory", 0xfffcc260, 4, base=16 +sfr = "PWMC_CH3_CMR.CPRE", "Memory", 0xfffcc260, 4, base=16, bitRange=0-3 +sfr = "PWMC_CH3_CMR.CALG", "Memory", 0xfffcc260, 4, base=16, bitRange=8 +sfr = "PWMC_CH3_CMR.CPOL", "Memory", 0xfffcc260, 4, base=16, bitRange=9 +sfr = "PWMC_CH3_CMR.CPD", "Memory", 0xfffcc260, 4, base=16, bitRange=10 +sfr = "PWMC_CH3_CDTYR", "Memory", 0xfffcc264, 4, base=16 +sfr = "PWMC_CH3_CDTYR.CDTY", "Memory", 0xfffcc264, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH3_CPRDR", "Memory", 0xfffcc268, 4, base=16 +sfr = "PWMC_CH3_CPRDR.CPRD", "Memory", 0xfffcc268, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH3_CCNTR", "Memory", 0xfffcc26c, 4, base=16 +sfr = "PWMC_CH3_CCNTR.CCNT", "Memory", 0xfffcc26c, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH3_CUPDR", "Memory", 0xfffcc270, 4, base=16 +sfr = "PWMC_CH3_CUPDR.CUPD", "Memory", 0xfffcc270, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH3_Reserved", "Memory", 0xfffcc274, 4, base=16 +; ========== Register definition for PWMC_CH2 peripheral ========== +sfr = "PWMC_CH2_CMR", "Memory", 0xfffcc240, 4, base=16 +sfr = "PWMC_CH2_CMR.CPRE", "Memory", 0xfffcc240, 4, base=16, bitRange=0-3 +sfr = "PWMC_CH2_CMR.CALG", "Memory", 0xfffcc240, 4, base=16, bitRange=8 +sfr = "PWMC_CH2_CMR.CPOL", "Memory", 0xfffcc240, 4, base=16, bitRange=9 +sfr = "PWMC_CH2_CMR.CPD", "Memory", 0xfffcc240, 4, base=16, bitRange=10 +sfr = "PWMC_CH2_CDTYR", "Memory", 0xfffcc244, 4, base=16 +sfr = "PWMC_CH2_CDTYR.CDTY", "Memory", 0xfffcc244, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH2_CPRDR", "Memory", 0xfffcc248, 4, base=16 +sfr = "PWMC_CH2_CPRDR.CPRD", "Memory", 0xfffcc248, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH2_CCNTR", "Memory", 0xfffcc24c, 4, base=16 +sfr = "PWMC_CH2_CCNTR.CCNT", "Memory", 0xfffcc24c, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH2_CUPDR", "Memory", 0xfffcc250, 4, base=16 +sfr = "PWMC_CH2_CUPDR.CUPD", "Memory", 0xfffcc250, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH2_Reserved", "Memory", 0xfffcc254, 4, base=16 +; ========== Register definition for PWMC_CH1 peripheral ========== +sfr = "PWMC_CH1_CMR", "Memory", 0xfffcc220, 4, base=16 +sfr = "PWMC_CH1_CMR.CPRE", "Memory", 0xfffcc220, 4, base=16, bitRange=0-3 +sfr = "PWMC_CH1_CMR.CALG", "Memory", 0xfffcc220, 4, base=16, bitRange=8 +sfr = "PWMC_CH1_CMR.CPOL", "Memory", 0xfffcc220, 4, base=16, bitRange=9 +sfr = "PWMC_CH1_CMR.CPD", "Memory", 0xfffcc220, 4, base=16, bitRange=10 +sfr = "PWMC_CH1_CDTYR", "Memory", 0xfffcc224, 4, base=16 +sfr = "PWMC_CH1_CDTYR.CDTY", "Memory", 0xfffcc224, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH1_CPRDR", "Memory", 0xfffcc228, 4, base=16 +sfr = "PWMC_CH1_CPRDR.CPRD", "Memory", 0xfffcc228, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH1_CCNTR", "Memory", 0xfffcc22c, 4, base=16 +sfr = "PWMC_CH1_CCNTR.CCNT", "Memory", 0xfffcc22c, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH1_CUPDR", "Memory", 0xfffcc230, 4, base=16 +sfr = "PWMC_CH1_CUPDR.CUPD", "Memory", 0xfffcc230, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH1_Reserved", "Memory", 0xfffcc234, 4, base=16 +; ========== Register definition for PWMC_CH0 peripheral ========== +sfr = "PWMC_CH0_CMR", "Memory", 0xfffcc200, 4, base=16 +sfr = "PWMC_CH0_CMR.CPRE", "Memory", 0xfffcc200, 4, base=16, bitRange=0-3 +sfr = "PWMC_CH0_CMR.CALG", "Memory", 0xfffcc200, 4, base=16, bitRange=8 +sfr = "PWMC_CH0_CMR.CPOL", "Memory", 0xfffcc200, 4, base=16, bitRange=9 +sfr = "PWMC_CH0_CMR.CPD", "Memory", 0xfffcc200, 4, base=16, bitRange=10 +sfr = "PWMC_CH0_CDTYR", "Memory", 0xfffcc204, 4, base=16 +sfr = "PWMC_CH0_CDTYR.CDTY", "Memory", 0xfffcc204, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH0_CPRDR", "Memory", 0xfffcc208, 4, base=16 +sfr = "PWMC_CH0_CPRDR.CPRD", "Memory", 0xfffcc208, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH0_CCNTR", "Memory", 0xfffcc20c, 4, base=16 +sfr = "PWMC_CH0_CCNTR.CCNT", "Memory", 0xfffcc20c, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH0_CUPDR", "Memory", 0xfffcc210, 4, base=16 +sfr = "PWMC_CH0_CUPDR.CUPD", "Memory", 0xfffcc210, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH0_Reserved", "Memory", 0xfffcc214, 4, base=16 +; ========== Register definition for PWMC peripheral ========== +sfr = "PWMC_MR", "Memory", 0xfffcc000, 4, base=16 +sfr = "PWMC_MR.DIVA", "Memory", 0xfffcc000, 4, base=16, bitRange=0-7 +sfr = "PWMC_MR.PREA", "Memory", 0xfffcc000, 4, base=16, bitRange=8-11 +sfr = "PWMC_MR.DIVB", "Memory", 0xfffcc000, 4, base=16, bitRange=16-23 +sfr = "PWMC_MR.PREB", "Memory", 0xfffcc000, 4, base=16, bitRange=24-27 +sfr = "PWMC_ENA", "Memory", 0xfffcc004, 4, base=16 +sfr = "PWMC_ENA.CHID0", "Memory", 0xfffcc004, 4, base=16, bitRange=0 +sfr = "PWMC_ENA.CHID1", "Memory", 0xfffcc004, 4, base=16, bitRange=1 +sfr = "PWMC_ENA.CHID2", "Memory", 0xfffcc004, 4, base=16, bitRange=2 +sfr = "PWMC_ENA.CHID3", "Memory", 0xfffcc004, 4, base=16, bitRange=3 +sfr = "PWMC_DIS", "Memory", 0xfffcc008, 4, base=16 +sfr = "PWMC_DIS.CHID0", "Memory", 0xfffcc008, 4, base=16, bitRange=0 +sfr = "PWMC_DIS.CHID1", "Memory", 0xfffcc008, 4, base=16, bitRange=1 +sfr = "PWMC_DIS.CHID2", "Memory", 0xfffcc008, 4, base=16, bitRange=2 +sfr = "PWMC_DIS.CHID3", "Memory", 0xfffcc008, 4, base=16, bitRange=3 +sfr = "PWMC_SR", "Memory", 0xfffcc00c, 4, base=16 +sfr = "PWMC_SR.CHID0", "Memory", 0xfffcc00c, 4, base=16, bitRange=0 +sfr = "PWMC_SR.CHID1", "Memory", 0xfffcc00c, 4, base=16, bitRange=1 +sfr = "PWMC_SR.CHID2", "Memory", 0xfffcc00c, 4, base=16, bitRange=2 +sfr = "PWMC_SR.CHID3", "Memory", 0xfffcc00c, 4, base=16, bitRange=3 +sfr = "PWMC_IER", "Memory", 0xfffcc010, 4, base=16 +sfr = "PWMC_IER.CHID0", "Memory", 0xfffcc010, 4, base=16, bitRange=0 +sfr = "PWMC_IER.CHID1", "Memory", 0xfffcc010, 4, base=16, bitRange=1 +sfr = "PWMC_IER.CHID2", "Memory", 0xfffcc010, 4, base=16, bitRange=2 +sfr = "PWMC_IER.CHID3", "Memory", 0xfffcc010, 4, base=16, bitRange=3 +sfr = "PWMC_IDR", "Memory", 0xfffcc014, 4, base=16 +sfr = "PWMC_IDR.CHID0", "Memory", 0xfffcc014, 4, base=16, bitRange=0 +sfr = "PWMC_IDR.CHID1", "Memory", 0xfffcc014, 4, base=16, bitRange=1 +sfr = "PWMC_IDR.CHID2", "Memory", 0xfffcc014, 4, base=16, bitRange=2 +sfr = "PWMC_IDR.CHID3", "Memory", 0xfffcc014, 4, base=16, bitRange=3 +sfr = "PWMC_IMR", "Memory", 0xfffcc018, 4, base=16 +sfr = "PWMC_IMR.CHID0", "Memory", 0xfffcc018, 4, base=16, bitRange=0 +sfr = "PWMC_IMR.CHID1", "Memory", 0xfffcc018, 4, base=16, bitRange=1 +sfr = "PWMC_IMR.CHID2", "Memory", 0xfffcc018, 4, base=16, bitRange=2 +sfr = "PWMC_IMR.CHID3", "Memory", 0xfffcc018, 4, base=16, bitRange=3 +sfr = "PWMC_ISR", "Memory", 0xfffcc01c, 4, base=16 +sfr = "PWMC_ISR.CHID0", "Memory", 0xfffcc01c, 4, base=16, bitRange=0 +sfr = "PWMC_ISR.CHID1", "Memory", 0xfffcc01c, 4, base=16, bitRange=1 +sfr = "PWMC_ISR.CHID2", "Memory", 0xfffcc01c, 4, base=16, bitRange=2 +sfr = "PWMC_ISR.CHID3", "Memory", 0xfffcc01c, 4, base=16, bitRange=3 +sfr = "PWMC_VR", "Memory", 0xfffcc0fc, 4, base=16 +; ========== Register definition for UDP peripheral ========== +sfr = "UDP_NUM", "Memory", 0xfffb0000, 4, base=16 +sfr = "UDP_NUM.NUM", "Memory", 0xfffb0000, 4, base=16, bitRange=0-10 +sfr = "UDP_NUM.ERR", "Memory", 0xfffb0000, 4, base=16, bitRange=16 +sfr = "UDP_NUM.OK", "Memory", 0xfffb0000, 4, base=16, bitRange=17 +sfr = "UDP_GLBSTATE", "Memory", 0xfffb0004, 4, base=16 +sfr = "UDP_GLBSTATE.FADDEN", "Memory", 0xfffb0004, 4, base=16, bitRange=0 +sfr = "UDP_GLBSTATE.CONFG", "Memory", 0xfffb0004, 4, base=16, bitRange=1 +sfr = "UDP_GLBSTATE.ESR", "Memory", 0xfffb0004, 4, base=16, bitRange=2 +sfr = "UDP_GLBSTATE.RSMINPR", "Memory", 0xfffb0004, 4, base=16, bitRange=3 +sfr = "UDP_GLBSTATE.RMWUPE", "Memory", 0xfffb0004, 4, base=16, bitRange=4 +sfr = "UDP_FADDR", "Memory", 0xfffb0008, 4, base=16 +sfr = "UDP_FADDR.FADD", "Memory", 0xfffb0008, 4, base=16, bitRange=0-7 +sfr = "UDP_FADDR.FEN", "Memory", 0xfffb0008, 4, base=16, bitRange=8 +sfr = "UDP_IER", "Memory", 0xfffb0010, 4, base=16 +sfr = "UDP_IER.EPINT0", "Memory", 0xfffb0010, 4, base=16, bitRange=0 +sfr = "UDP_IER.EPINT1", "Memory", 0xfffb0010, 4, base=16, bitRange=1 +sfr = "UDP_IER.EPINT2", "Memory", 0xfffb0010, 4, base=16, bitRange=2 +sfr = "UDP_IER.EPINT3", "Memory", 0xfffb0010, 4, base=16, bitRange=3 +sfr = "UDP_IER.EPINT4", "Memory", 0xfffb0010, 4, base=16, bitRange=4 +sfr = "UDP_IER.EPINT5", "Memory", 0xfffb0010, 4, base=16, bitRange=5 +sfr = "UDP_IER.RXSUSP", "Memory", 0xfffb0010, 4, base=16, bitRange=8 +sfr = "UDP_IER.RXRSM", "Memory", 0xfffb0010, 4, base=16, bitRange=9 +sfr = "UDP_IER.EXTRSM", "Memory", 0xfffb0010, 4, base=16, bitRange=10 +sfr = "UDP_IER.SOFINT", "Memory", 0xfffb0010, 4, base=16, bitRange=11 +sfr = "UDP_IER.WAKEUP", "Memory", 0xfffb0010, 4, base=16, bitRange=13 +sfr = "UDP_IDR", "Memory", 0xfffb0014, 4, base=16 +sfr = "UDP_IDR.EPINT0", "Memory", 0xfffb0014, 4, base=16, bitRange=0 +sfr = "UDP_IDR.EPINT1", "Memory", 0xfffb0014, 4, base=16, bitRange=1 +sfr = "UDP_IDR.EPINT2", "Memory", 0xfffb0014, 4, base=16, bitRange=2 +sfr = "UDP_IDR.EPINT3", "Memory", 0xfffb0014, 4, base=16, bitRange=3 +sfr = "UDP_IDR.EPINT4", "Memory", 0xfffb0014, 4, base=16, bitRange=4 +sfr = "UDP_IDR.EPINT5", "Memory", 0xfffb0014, 4, base=16, bitRange=5 +sfr = "UDP_IDR.RXSUSP", "Memory", 0xfffb0014, 4, base=16, bitRange=8 +sfr = "UDP_IDR.RXRSM", "Memory", 0xfffb0014, 4, base=16, bitRange=9 +sfr = "UDP_IDR.EXTRSM", "Memory", 0xfffb0014, 4, base=16, bitRange=10 +sfr = "UDP_IDR.SOFINT", "Memory", 0xfffb0014, 4, base=16, bitRange=11 +sfr = "UDP_IDR.WAKEUP", "Memory", 0xfffb0014, 4, base=16, bitRange=13 +sfr = "UDP_IMR", "Memory", 0xfffb0018, 4, base=16 +sfr = "UDP_IMR.EPINT0", "Memory", 0xfffb0018, 4, base=16, bitRange=0 +sfr = "UDP_IMR.EPINT1", "Memory", 0xfffb0018, 4, base=16, bitRange=1 +sfr = "UDP_IMR.EPINT2", "Memory", 0xfffb0018, 4, base=16, bitRange=2 +sfr = "UDP_IMR.EPINT3", "Memory", 0xfffb0018, 4, base=16, bitRange=3 +sfr = "UDP_IMR.EPINT4", "Memory", 0xfffb0018, 4, base=16, bitRange=4 +sfr = "UDP_IMR.EPINT5", "Memory", 0xfffb0018, 4, base=16, bitRange=5 +sfr = "UDP_IMR.RXSUSP", "Memory", 0xfffb0018, 4, base=16, bitRange=8 +sfr = "UDP_IMR.RXRSM", "Memory", 0xfffb0018, 4, base=16, bitRange=9 +sfr = "UDP_IMR.EXTRSM", "Memory", 0xfffb0018, 4, base=16, bitRange=10 +sfr = "UDP_IMR.SOFINT", "Memory", 0xfffb0018, 4, base=16, bitRange=11 +sfr = "UDP_IMR.WAKEUP", "Memory", 0xfffb0018, 4, base=16, bitRange=13 +sfr = "UDP_ISR", "Memory", 0xfffb001c, 4, base=16 +sfr = "UDP_ISR.EPINT0", "Memory", 0xfffb001c, 4, base=16, bitRange=0 +sfr = "UDP_ISR.EPINT1", "Memory", 0xfffb001c, 4, base=16, bitRange=1 +sfr = "UDP_ISR.EPINT2", "Memory", 0xfffb001c, 4, base=16, bitRange=2 +sfr = "UDP_ISR.EPINT3", "Memory", 0xfffb001c, 4, base=16, bitRange=3 +sfr = "UDP_ISR.EPINT4", "Memory", 0xfffb001c, 4, base=16, bitRange=4 +sfr = "UDP_ISR.EPINT5", "Memory", 0xfffb001c, 4, base=16, bitRange=5 +sfr = "UDP_ISR.RXSUSP", "Memory", 0xfffb001c, 4, base=16, bitRange=8 +sfr = "UDP_ISR.RXRSM", "Memory", 0xfffb001c, 4, base=16, bitRange=9 +sfr = "UDP_ISR.EXTRSM", "Memory", 0xfffb001c, 4, base=16, bitRange=10 +sfr = "UDP_ISR.SOFINT", "Memory", 0xfffb001c, 4, base=16, bitRange=11 +sfr = "UDP_ISR.ENDBUSRES", "Memory", 0xfffb001c, 4, base=16, bitRange=12 +sfr = "UDP_ISR.WAKEUP", "Memory", 0xfffb001c, 4, base=16, bitRange=13 +sfr = "UDP_ICR", "Memory", 0xfffb0020, 4, base=16 +sfr = "UDP_ICR.EPINT0", "Memory", 0xfffb0020, 4, base=16, bitRange=0 +sfr = "UDP_ICR.EPINT1", "Memory", 0xfffb0020, 4, base=16, bitRange=1 +sfr = "UDP_ICR.EPINT2", "Memory", 0xfffb0020, 4, base=16, bitRange=2 +sfr = "UDP_ICR.EPINT3", "Memory", 0xfffb0020, 4, base=16, bitRange=3 +sfr = "UDP_ICR.EPINT4", "Memory", 0xfffb0020, 4, base=16, bitRange=4 +sfr = "UDP_ICR.EPINT5", "Memory", 0xfffb0020, 4, base=16, bitRange=5 +sfr = "UDP_ICR.RXSUSP", "Memory", 0xfffb0020, 4, base=16, bitRange=8 +sfr = "UDP_ICR.RXRSM", "Memory", 0xfffb0020, 4, base=16, bitRange=9 +sfr = "UDP_ICR.EXTRSM", "Memory", 0xfffb0020, 4, base=16, bitRange=10 +sfr = "UDP_ICR.SOFINT", "Memory", 0xfffb0020, 4, base=16, bitRange=11 +sfr = "UDP_ICR.WAKEUP", "Memory", 0xfffb0020, 4, base=16, bitRange=13 +sfr = "UDP_RSTEP", "Memory", 0xfffb0028, 4, base=16 +sfr = "UDP_RSTEP.EP0", "Memory", 0xfffb0028, 4, base=16, bitRange=0 +sfr = "UDP_RSTEP.EP1", "Memory", 0xfffb0028, 4, base=16, bitRange=1 +sfr = "UDP_RSTEP.EP2", "Memory", 0xfffb0028, 4, base=16, bitRange=2 +sfr = "UDP_RSTEP.EP3", "Memory", 0xfffb0028, 4, base=16, bitRange=3 +sfr = "UDP_RSTEP.EP4", "Memory", 0xfffb0028, 4, base=16, bitRange=4 +sfr = "UDP_RSTEP.EP5", "Memory", 0xfffb0028, 4, base=16, bitRange=5 +sfr = "UDP_CSR", "Memory", 0xfffb0030, 4, base=16 +sfr = "UDP_CSR.TXCOMP", "Memory", 0xfffb0030, 4, base=16, bitRange=0 +sfr = "UDP_CSR.BK0", "Memory", 0xfffb0030, 4, base=16, bitRange=1 +sfr = "UDP_CSR.RXSETUP", "Memory", 0xfffb0030, 4, base=16, bitRange=2 +sfr = "UDP_CSR.ISOERROR", "Memory", 0xfffb0030, 4, base=16, bitRange=3 +sfr = "UDP_CSR.TXPKTRDY", "Memory", 0xfffb0030, 4, base=16, bitRange=4 +sfr = "UDP_CSR.FORCESTALL", "Memory", 0xfffb0030, 4, base=16, bitRange=5 +sfr = "UDP_CSR.BK1", "Memory", 0xfffb0030, 4, base=16, bitRange=6 +sfr = "UDP_CSR.DIR", "Memory", 0xfffb0030, 4, base=16, bitRange=7 +sfr = "UDP_CSR.EPTYPE", "Memory", 0xfffb0030, 4, base=16, bitRange=8-10 +sfr = "UDP_CSR.DTGLE", "Memory", 0xfffb0030, 4, base=16, bitRange=11 +sfr = "UDP_CSR.EPEDS", "Memory", 0xfffb0030, 4, base=16, bitRange=15 +sfr = "UDP_CSR.RXBYTECNT", "Memory", 0xfffb0030, 4, base=16, bitRange=16-26 +sfr = "UDP_FDR", "Memory", 0xfffb0050, 4, base=16 +sfr = "UDP_TXVC", "Memory", 0xfffb0074, 4, base=16 +sfr = "UDP_TXVC.TXVDIS", "Memory", 0xfffb0074, 4, base=16, bitRange=8 +sfr = "UDP_TXVC.PUON", "Memory", 0xfffb0074, 4, base=16, bitRange=9 +; ========== Register definition for TC0 peripheral ========== +sfr = "TC0_CCR", "Memory", 0xfffa0000, 4, base=16 +sfr = "TC0_CCR.CLKEN", "Memory", 0xfffa0000, 4, base=16, bitRange=0 +sfr = "TC0_CCR.CLKDIS", "Memory", 0xfffa0000, 4, base=16, bitRange=1 +sfr = "TC0_CCR.SWTRG", "Memory", 0xfffa0000, 4, base=16, bitRange=2 +sfr = "TC0_CMR", "Memory", 0xfffa0004, 4, base=16 +sfr = "TC0_CMR.CLKS", "Memory", 0xfffa0004, 4, base=16, bitRange=0-2 +sfr = "TC0_CMR.CLKI", "Memory", 0xfffa0004, 4, base=16, bitRange=3 +sfr = "TC0_CMR.BURST", "Memory", 0xfffa0004, 4, base=16, bitRange=4-5 +sfr = "TC0_CMR.CPCSTOP", "Memory", 0xfffa0004, 4, base=16, bitRange=6 +sfr = "TC0_CMR.LDBSTOP", "Memory", 0xfffa0004, 4, base=16, bitRange=6 +sfr = "TC0_CMR.CPCDIS", "Memory", 0xfffa0004, 4, base=16, bitRange=7 +sfr = "TC0_CMR.LDBDIS", "Memory", 0xfffa0004, 4, base=16, bitRange=7 +sfr = "TC0_CMR.ETRGEDG", "Memory", 0xfffa0004, 4, base=16, bitRange=8-9 +sfr = "TC0_CMR.EEVTEDG", "Memory", 0xfffa0004, 4, base=16, bitRange=8-9 +sfr = "TC0_CMR.EEVT", "Memory", 0xfffa0004, 4, base=16, bitRange=10-11 +sfr = "TC0_CMR.ABETRG", "Memory", 0xfffa0004, 4, base=16, bitRange=10 +sfr = "TC0_CMR.ENETRG", "Memory", 0xfffa0004, 4, base=16, bitRange=12 +sfr = "TC0_CMR.WAVESEL", "Memory", 0xfffa0004, 4, base=16, bitRange=13-14 +sfr = "TC0_CMR.CPCTRG", "Memory", 0xfffa0004, 4, base=16, bitRange=14 +sfr = "TC0_CMR.WAVE", "Memory", 0xfffa0004, 4, base=16, bitRange=15 +sfr = "TC0_CMR.ACPA", "Memory", 0xfffa0004, 4, base=16, bitRange=16-17 +sfr = "TC0_CMR.LDRA", "Memory", 0xfffa0004, 4, base=16, bitRange=16-17 +sfr = "TC0_CMR.ACPC", "Memory", 0xfffa0004, 4, base=16, bitRange=18-19 +sfr = "TC0_CMR.LDRB", "Memory", 0xfffa0004, 4, base=16, bitRange=18-19 +sfr = "TC0_CMR.AEEVT", "Memory", 0xfffa0004, 4, base=16, bitRange=20-21 +sfr = "TC0_CMR.ASWTRG", "Memory", 0xfffa0004, 4, base=16, bitRange=22-23 +sfr = "TC0_CMR.BCPB", "Memory", 0xfffa0004, 4, base=16, bitRange=24-25 +sfr = "TC0_CMR.BCPC", "Memory", 0xfffa0004, 4, base=16, bitRange=26-27 +sfr = "TC0_CMR.BEEVT", "Memory", 0xfffa0004, 4, base=16, bitRange=28-29 +sfr = "TC0_CMR.BSWTRG", "Memory", 0xfffa0004, 4, base=16, bitRange=30-31 +sfr = "TC0_CV", "Memory", 0xfffa0010, 4, base=16 +sfr = "TC0_RA", "Memory", 0xfffa0014, 4, base=16 +sfr = "TC0_RB", "Memory", 0xfffa0018, 4, base=16 +sfr = "TC0_RC", "Memory", 0xfffa001c, 4, base=16 +sfr = "TC0_SR", "Memory", 0xfffa0020, 4, base=16 +sfr = "TC0_SR.COVFS", "Memory", 0xfffa0020, 4, base=16, bitRange=0 +sfr = "TC0_SR.LOVRS", "Memory", 0xfffa0020, 4, base=16, bitRange=1 +sfr = "TC0_SR.CPAS", "Memory", 0xfffa0020, 4, base=16, bitRange=2 +sfr = "TC0_SR.CPBS", "Memory", 0xfffa0020, 4, base=16, bitRange=3 +sfr = "TC0_SR.CPCS", "Memory", 0xfffa0020, 4, base=16, bitRange=4 +sfr = "TC0_SR.LDRAS", "Memory", 0xfffa0020, 4, base=16, bitRange=5 +sfr = "TC0_SR.LDRBS", "Memory", 0xfffa0020, 4, base=16, bitRange=6 +sfr = "TC0_SR.ETRGS", "Memory", 0xfffa0020, 4, base=16, bitRange=7 +sfr = "TC0_SR.CLKSTA", "Memory", 0xfffa0020, 4, base=16, bitRange=16 +sfr = "TC0_SR.MTIOA", "Memory", 0xfffa0020, 4, base=16, bitRange=17 +sfr = "TC0_SR.MTIOB", "Memory", 0xfffa0020, 4, base=16, bitRange=18 +sfr = "TC0_IER", "Memory", 0xfffa0024, 4, base=16 +sfr = "TC0_IER.COVFS", "Memory", 0xfffa0024, 4, base=16, bitRange=0 +sfr = "TC0_IER.LOVRS", "Memory", 0xfffa0024, 4, base=16, bitRange=1 +sfr = "TC0_IER.CPAS", "Memory", 0xfffa0024, 4, base=16, bitRange=2 +sfr = "TC0_IER.CPBS", "Memory", 0xfffa0024, 4, base=16, bitRange=3 +sfr = "TC0_IER.CPCS", "Memory", 0xfffa0024, 4, base=16, bitRange=4 +sfr = "TC0_IER.LDRAS", "Memory", 0xfffa0024, 4, base=16, bitRange=5 +sfr = "TC0_IER.LDRBS", "Memory", 0xfffa0024, 4, base=16, bitRange=6 +sfr = "TC0_IER.ETRGS", "Memory", 0xfffa0024, 4, base=16, bitRange=7 +sfr = "TC0_IDR", "Memory", 0xfffa0028, 4, base=16 +sfr = "TC0_IDR.COVFS", "Memory", 0xfffa0028, 4, base=16, bitRange=0 +sfr = "TC0_IDR.LOVRS", "Memory", 0xfffa0028, 4, base=16, bitRange=1 +sfr = "TC0_IDR.CPAS", "Memory", 0xfffa0028, 4, base=16, bitRange=2 +sfr = "TC0_IDR.CPBS", "Memory", 0xfffa0028, 4, base=16, bitRange=3 +sfr = "TC0_IDR.CPCS", "Memory", 0xfffa0028, 4, base=16, bitRange=4 +sfr = "TC0_IDR.LDRAS", "Memory", 0xfffa0028, 4, base=16, bitRange=5 +sfr = "TC0_IDR.LDRBS", "Memory", 0xfffa0028, 4, base=16, bitRange=6 +sfr = "TC0_IDR.ETRGS", "Memory", 0xfffa0028, 4, base=16, bitRange=7 +sfr = "TC0_IMR", "Memory", 0xfffa002c, 4, base=16 +sfr = "TC0_IMR.COVFS", "Memory", 0xfffa002c, 4, base=16, bitRange=0 +sfr = "TC0_IMR.LOVRS", "Memory", 0xfffa002c, 4, base=16, bitRange=1 +sfr = "TC0_IMR.CPAS", "Memory", 0xfffa002c, 4, base=16, bitRange=2 +sfr = "TC0_IMR.CPBS", "Memory", 0xfffa002c, 4, base=16, bitRange=3 +sfr = "TC0_IMR.CPCS", "Memory", 0xfffa002c, 4, base=16, bitRange=4 +sfr = "TC0_IMR.LDRAS", "Memory", 0xfffa002c, 4, base=16, bitRange=5 +sfr = "TC0_IMR.LDRBS", "Memory", 0xfffa002c, 4, base=16, bitRange=6 +sfr = "TC0_IMR.ETRGS", "Memory", 0xfffa002c, 4, base=16, bitRange=7 +; ========== Register definition for TC1 peripheral ========== +sfr = "TC1_CCR", "Memory", 0xfffa0040, 4, base=16 +sfr = "TC1_CCR.CLKEN", "Memory", 0xfffa0040, 4, base=16, bitRange=0 +sfr = "TC1_CCR.CLKDIS", "Memory", 0xfffa0040, 4, base=16, bitRange=1 +sfr = "TC1_CCR.SWTRG", "Memory", 0xfffa0040, 4, base=16, bitRange=2 +sfr = "TC1_CMR", "Memory", 0xfffa0044, 4, base=16 +sfr = "TC1_CMR.CLKS", "Memory", 0xfffa0044, 4, base=16, bitRange=0-2 +sfr = "TC1_CMR.CLKI", "Memory", 0xfffa0044, 4, base=16, bitRange=3 +sfr = "TC1_CMR.BURST", "Memory", 0xfffa0044, 4, base=16, bitRange=4-5 +sfr = "TC1_CMR.CPCSTOP", "Memory", 0xfffa0044, 4, base=16, bitRange=6 +sfr = "TC1_CMR.LDBSTOP", "Memory", 0xfffa0044, 4, base=16, bitRange=6 +sfr = "TC1_CMR.CPCDIS", "Memory", 0xfffa0044, 4, base=16, bitRange=7 +sfr = "TC1_CMR.LDBDIS", "Memory", 0xfffa0044, 4, base=16, bitRange=7 +sfr = "TC1_CMR.ETRGEDG", "Memory", 0xfffa0044, 4, base=16, bitRange=8-9 +sfr = "TC1_CMR.EEVTEDG", "Memory", 0xfffa0044, 4, base=16, bitRange=8-9 +sfr = "TC1_CMR.EEVT", "Memory", 0xfffa0044, 4, base=16, bitRange=10-11 +sfr = "TC1_CMR.ABETRG", "Memory", 0xfffa0044, 4, base=16, bitRange=10 +sfr = "TC1_CMR.ENETRG", "Memory", 0xfffa0044, 4, base=16, bitRange=12 +sfr = "TC1_CMR.WAVESEL", "Memory", 0xfffa0044, 4, base=16, bitRange=13-14 +sfr = "TC1_CMR.CPCTRG", "Memory", 0xfffa0044, 4, base=16, bitRange=14 +sfr = "TC1_CMR.WAVE", "Memory", 0xfffa0044, 4, base=16, bitRange=15 +sfr = "TC1_CMR.ACPA", "Memory", 0xfffa0044, 4, base=16, bitRange=16-17 +sfr = "TC1_CMR.LDRA", "Memory", 0xfffa0044, 4, base=16, bitRange=16-17 +sfr = "TC1_CMR.ACPC", "Memory", 0xfffa0044, 4, base=16, bitRange=18-19 +sfr = "TC1_CMR.LDRB", "Memory", 0xfffa0044, 4, base=16, bitRange=18-19 +sfr = "TC1_CMR.AEEVT", "Memory", 0xfffa0044, 4, base=16, bitRange=20-21 +sfr = "TC1_CMR.ASWTRG", "Memory", 0xfffa0044, 4, base=16, bitRange=22-23 +sfr = "TC1_CMR.BCPB", "Memory", 0xfffa0044, 4, base=16, bitRange=24-25 +sfr = "TC1_CMR.BCPC", "Memory", 0xfffa0044, 4, base=16, bitRange=26-27 +sfr = "TC1_CMR.BEEVT", "Memory", 0xfffa0044, 4, base=16, bitRange=28-29 +sfr = "TC1_CMR.BSWTRG", "Memory", 0xfffa0044, 4, base=16, bitRange=30-31 +sfr = "TC1_CV", "Memory", 0xfffa0050, 4, base=16 +sfr = "TC1_RA", "Memory", 0xfffa0054, 4, base=16 +sfr = "TC1_RB", "Memory", 0xfffa0058, 4, base=16 +sfr = "TC1_RC", "Memory", 0xfffa005c, 4, base=16 +sfr = "TC1_SR", "Memory", 0xfffa0060, 4, base=16 +sfr = "TC1_SR.COVFS", "Memory", 0xfffa0060, 4, base=16, bitRange=0 +sfr = "TC1_SR.LOVRS", "Memory", 0xfffa0060, 4, base=16, bitRange=1 +sfr = "TC1_SR.CPAS", "Memory", 0xfffa0060, 4, base=16, bitRange=2 +sfr = "TC1_SR.CPBS", "Memory", 0xfffa0060, 4, base=16, bitRange=3 +sfr = "TC1_SR.CPCS", "Memory", 0xfffa0060, 4, base=16, bitRange=4 +sfr = "TC1_SR.LDRAS", "Memory", 0xfffa0060, 4, base=16, bitRange=5 +sfr = "TC1_SR.LDRBS", "Memory", 0xfffa0060, 4, base=16, bitRange=6 +sfr = "TC1_SR.ETRGS", "Memory", 0xfffa0060, 4, base=16, bitRange=7 +sfr = "TC1_SR.CLKSTA", "Memory", 0xfffa0060, 4, base=16, bitRange=16 +sfr = "TC1_SR.MTIOA", "Memory", 0xfffa0060, 4, base=16, bitRange=17 +sfr = "TC1_SR.MTIOB", "Memory", 0xfffa0060, 4, base=16, bitRange=18 +sfr = "TC1_IER", "Memory", 0xfffa0064, 4, base=16 +sfr = "TC1_IER.COVFS", "Memory", 0xfffa0064, 4, base=16, bitRange=0 +sfr = "TC1_IER.LOVRS", "Memory", 0xfffa0064, 4, base=16, bitRange=1 +sfr = "TC1_IER.CPAS", "Memory", 0xfffa0064, 4, base=16, bitRange=2 +sfr = "TC1_IER.CPBS", "Memory", 0xfffa0064, 4, base=16, bitRange=3 +sfr = "TC1_IER.CPCS", "Memory", 0xfffa0064, 4, base=16, bitRange=4 +sfr = "TC1_IER.LDRAS", "Memory", 0xfffa0064, 4, base=16, bitRange=5 +sfr = "TC1_IER.LDRBS", "Memory", 0xfffa0064, 4, base=16, bitRange=6 +sfr = "TC1_IER.ETRGS", "Memory", 0xfffa0064, 4, base=16, bitRange=7 +sfr = "TC1_IDR", "Memory", 0xfffa0068, 4, base=16 +sfr = "TC1_IDR.COVFS", "Memory", 0xfffa0068, 4, base=16, bitRange=0 +sfr = "TC1_IDR.LOVRS", "Memory", 0xfffa0068, 4, base=16, bitRange=1 +sfr = "TC1_IDR.CPAS", "Memory", 0xfffa0068, 4, base=16, bitRange=2 +sfr = "TC1_IDR.CPBS", "Memory", 0xfffa0068, 4, base=16, bitRange=3 +sfr = "TC1_IDR.CPCS", "Memory", 0xfffa0068, 4, base=16, bitRange=4 +sfr = "TC1_IDR.LDRAS", "Memory", 0xfffa0068, 4, base=16, bitRange=5 +sfr = "TC1_IDR.LDRBS", "Memory", 0xfffa0068, 4, base=16, bitRange=6 +sfr = "TC1_IDR.ETRGS", "Memory", 0xfffa0068, 4, base=16, bitRange=7 +sfr = "TC1_IMR", "Memory", 0xfffa006c, 4, base=16 +sfr = "TC1_IMR.COVFS", "Memory", 0xfffa006c, 4, base=16, bitRange=0 +sfr = "TC1_IMR.LOVRS", "Memory", 0xfffa006c, 4, base=16, bitRange=1 +sfr = "TC1_IMR.CPAS", "Memory", 0xfffa006c, 4, base=16, bitRange=2 +sfr = "TC1_IMR.CPBS", "Memory", 0xfffa006c, 4, base=16, bitRange=3 +sfr = "TC1_IMR.CPCS", "Memory", 0xfffa006c, 4, base=16, bitRange=4 +sfr = "TC1_IMR.LDRAS", "Memory", 0xfffa006c, 4, base=16, bitRange=5 +sfr = "TC1_IMR.LDRBS", "Memory", 0xfffa006c, 4, base=16, bitRange=6 +sfr = "TC1_IMR.ETRGS", "Memory", 0xfffa006c, 4, base=16, bitRange=7 +; ========== Register definition for TC2 peripheral ========== +sfr = "TC2_CCR", "Memory", 0xfffa0080, 4, base=16 +sfr = "TC2_CCR.CLKEN", "Memory", 0xfffa0080, 4, base=16, bitRange=0 +sfr = "TC2_CCR.CLKDIS", "Memory", 0xfffa0080, 4, base=16, bitRange=1 +sfr = "TC2_CCR.SWTRG", "Memory", 0xfffa0080, 4, base=16, bitRange=2 +sfr = "TC2_CMR", "Memory", 0xfffa0084, 4, base=16 +sfr = "TC2_CMR.CLKS", "Memory", 0xfffa0084, 4, base=16, bitRange=0-2 +sfr = "TC2_CMR.CLKI", "Memory", 0xfffa0084, 4, base=16, bitRange=3 +sfr = "TC2_CMR.BURST", "Memory", 0xfffa0084, 4, base=16, bitRange=4-5 +sfr = "TC2_CMR.CPCSTOP", "Memory", 0xfffa0084, 4, base=16, bitRange=6 +sfr = "TC2_CMR.LDBSTOP", "Memory", 0xfffa0084, 4, base=16, bitRange=6 +sfr = "TC2_CMR.CPCDIS", "Memory", 0xfffa0084, 4, base=16, bitRange=7 +sfr = "TC2_CMR.LDBDIS", "Memory", 0xfffa0084, 4, base=16, bitRange=7 +sfr = "TC2_CMR.ETRGEDG", "Memory", 0xfffa0084, 4, base=16, bitRange=8-9 +sfr = "TC2_CMR.EEVTEDG", "Memory", 0xfffa0084, 4, base=16, bitRange=8-9 +sfr = "TC2_CMR.EEVT", "Memory", 0xfffa0084, 4, base=16, bitRange=10-11 +sfr = "TC2_CMR.ABETRG", "Memory", 0xfffa0084, 4, base=16, bitRange=10 +sfr = "TC2_CMR.ENETRG", "Memory", 0xfffa0084, 4, base=16, bitRange=12 +sfr = "TC2_CMR.WAVESEL", "Memory", 0xfffa0084, 4, base=16, bitRange=13-14 +sfr = "TC2_CMR.CPCTRG", "Memory", 0xfffa0084, 4, base=16, bitRange=14 +sfr = "TC2_CMR.WAVE", "Memory", 0xfffa0084, 4, base=16, bitRange=15 +sfr = "TC2_CMR.ACPA", "Memory", 0xfffa0084, 4, base=16, bitRange=16-17 +sfr = "TC2_CMR.LDRA", "Memory", 0xfffa0084, 4, base=16, bitRange=16-17 +sfr = "TC2_CMR.ACPC", "Memory", 0xfffa0084, 4, base=16, bitRange=18-19 +sfr = "TC2_CMR.LDRB", "Memory", 0xfffa0084, 4, base=16, bitRange=18-19 +sfr = "TC2_CMR.AEEVT", "Memory", 0xfffa0084, 4, base=16, bitRange=20-21 +sfr = "TC2_CMR.ASWTRG", "Memory", 0xfffa0084, 4, base=16, bitRange=22-23 +sfr = "TC2_CMR.BCPB", "Memory", 0xfffa0084, 4, base=16, bitRange=24-25 +sfr = "TC2_CMR.BCPC", "Memory", 0xfffa0084, 4, base=16, bitRange=26-27 +sfr = "TC2_CMR.BEEVT", "Memory", 0xfffa0084, 4, base=16, bitRange=28-29 +sfr = "TC2_CMR.BSWTRG", "Memory", 0xfffa0084, 4, base=16, bitRange=30-31 +sfr = "TC2_CV", "Memory", 0xfffa0090, 4, base=16 +sfr = "TC2_RA", "Memory", 0xfffa0094, 4, base=16 +sfr = "TC2_RB", "Memory", 0xfffa0098, 4, base=16 +sfr = "TC2_RC", "Memory", 0xfffa009c, 4, base=16 +sfr = "TC2_SR", "Memory", 0xfffa00a0, 4, base=16 +sfr = "TC2_SR.COVFS", "Memory", 0xfffa00a0, 4, base=16, bitRange=0 +sfr = "TC2_SR.LOVRS", "Memory", 0xfffa00a0, 4, base=16, bitRange=1 +sfr = "TC2_SR.CPAS", "Memory", 0xfffa00a0, 4, base=16, bitRange=2 +sfr = "TC2_SR.CPBS", "Memory", 0xfffa00a0, 4, base=16, bitRange=3 +sfr = "TC2_SR.CPCS", "Memory", 0xfffa00a0, 4, base=16, bitRange=4 +sfr = "TC2_SR.LDRAS", "Memory", 0xfffa00a0, 4, base=16, bitRange=5 +sfr = "TC2_SR.LDRBS", "Memory", 0xfffa00a0, 4, base=16, bitRange=6 +sfr = "TC2_SR.ETRGS", "Memory", 0xfffa00a0, 4, base=16, bitRange=7 +sfr = "TC2_SR.CLKSTA", "Memory", 0xfffa00a0, 4, base=16, bitRange=16 +sfr = "TC2_SR.MTIOA", "Memory", 0xfffa00a0, 4, base=16, bitRange=17 +sfr = "TC2_SR.MTIOB", "Memory", 0xfffa00a0, 4, base=16, bitRange=18 +sfr = "TC2_IER", "Memory", 0xfffa00a4, 4, base=16 +sfr = "TC2_IER.COVFS", "Memory", 0xfffa00a4, 4, base=16, bitRange=0 +sfr = "TC2_IER.LOVRS", "Memory", 0xfffa00a4, 4, base=16, bitRange=1 +sfr = "TC2_IER.CPAS", "Memory", 0xfffa00a4, 4, base=16, bitRange=2 +sfr = "TC2_IER.CPBS", "Memory", 0xfffa00a4, 4, base=16, bitRange=3 +sfr = "TC2_IER.CPCS", "Memory", 0xfffa00a4, 4, base=16, bitRange=4 +sfr = "TC2_IER.LDRAS", "Memory", 0xfffa00a4, 4, base=16, bitRange=5 +sfr = "TC2_IER.LDRBS", "Memory", 0xfffa00a4, 4, base=16, bitRange=6 +sfr = "TC2_IER.ETRGS", "Memory", 0xfffa00a4, 4, base=16, bitRange=7 +sfr = "TC2_IDR", "Memory", 0xfffa00a8, 4, base=16 +sfr = "TC2_IDR.COVFS", "Memory", 0xfffa00a8, 4, base=16, bitRange=0 +sfr = "TC2_IDR.LOVRS", "Memory", 0xfffa00a8, 4, base=16, bitRange=1 +sfr = "TC2_IDR.CPAS", "Memory", 0xfffa00a8, 4, base=16, bitRange=2 +sfr = "TC2_IDR.CPBS", "Memory", 0xfffa00a8, 4, base=16, bitRange=3 +sfr = "TC2_IDR.CPCS", "Memory", 0xfffa00a8, 4, base=16, bitRange=4 +sfr = "TC2_IDR.LDRAS", "Memory", 0xfffa00a8, 4, base=16, bitRange=5 +sfr = "TC2_IDR.LDRBS", "Memory", 0xfffa00a8, 4, base=16, bitRange=6 +sfr = "TC2_IDR.ETRGS", "Memory", 0xfffa00a8, 4, base=16, bitRange=7 +sfr = "TC2_IMR", "Memory", 0xfffa00ac, 4, base=16 +sfr = "TC2_IMR.COVFS", "Memory", 0xfffa00ac, 4, base=16, bitRange=0 +sfr = "TC2_IMR.LOVRS", "Memory", 0xfffa00ac, 4, base=16, bitRange=1 +sfr = "TC2_IMR.CPAS", "Memory", 0xfffa00ac, 4, base=16, bitRange=2 +sfr = "TC2_IMR.CPBS", "Memory", 0xfffa00ac, 4, base=16, bitRange=3 +sfr = "TC2_IMR.CPCS", "Memory", 0xfffa00ac, 4, base=16, bitRange=4 +sfr = "TC2_IMR.LDRAS", "Memory", 0xfffa00ac, 4, base=16, bitRange=5 +sfr = "TC2_IMR.LDRBS", "Memory", 0xfffa00ac, 4, base=16, bitRange=6 +sfr = "TC2_IMR.ETRGS", "Memory", 0xfffa00ac, 4, base=16, bitRange=7 +; ========== Register definition for TCB peripheral ========== +sfr = "TCB_BCR", "Memory", 0xfffa00c0, 4, base=16 +sfr = "TCB_BCR.SYNC", "Memory", 0xfffa00c0, 4, base=16, bitRange=0 +sfr = "TCB_BMR", "Memory", 0xfffa00c4, 4, base=16 +sfr = "TCB_BMR.TC0XC0S", "Memory", 0xfffa00c4, 4, base=16, bitRange=0-1 +sfr = "TCB_BMR.TC1XC1S", "Memory", 0xfffa00c4, 4, base=16, bitRange=2-3 +sfr = "TCB_BMR.TC2XC2S", "Memory", 0xfffa00c4, 4, base=16, bitRange=4-5 +; ========== Register definition for CAN_MB0 peripheral ========== +sfr = "CAN_MB0_MMR", "Memory", 0xfffd0200, 4, base=16 +sfr = "CAN_MB0_MMR.MTIMEMARK", "Memory", 0xfffd0200, 4, base=16, bitRange=0-15 +sfr = "CAN_MB0_MMR.PRIOR", "Memory", 0xfffd0200, 4, base=16, bitRange=16-19 +sfr = "CAN_MB0_MMR.MOT", "Memory", 0xfffd0200, 4, base=16, bitRange=24-26 +sfr = "CAN_MB0_MAM", "Memory", 0xfffd0204, 4, base=16 +sfr = "CAN_MB0_MAM.MIDvB", "Memory", 0xfffd0204, 4, base=16, bitRange=0-17 +sfr = "CAN_MB0_MAM.MIDvA", "Memory", 0xfffd0204, 4, base=16, bitRange=18-28 +sfr = "CAN_MB0_MAM.MIDE", "Memory", 0xfffd0204, 4, base=16, bitRange=29 +sfr = "CAN_MB0_MID", "Memory", 0xfffd0208, 4, base=16 +sfr = "CAN_MB0_MID.MIDvB", "Memory", 0xfffd0208, 4, base=16, bitRange=0-17 +sfr = "CAN_MB0_MID.MIDvA", "Memory", 0xfffd0208, 4, base=16, bitRange=18-28 +sfr = "CAN_MB0_MID.MIDE", "Memory", 0xfffd0208, 4, base=16, bitRange=29 +sfr = "CAN_MB0_MFID", "Memory", 0xfffd020c, 4, base=16 +sfr = "CAN_MB0_MSR", "Memory", 0xfffd0210, 4, base=16 +sfr = "CAN_MB0_MSR.MTIMESTAMP", "Memory", 0xfffd0210, 4, base=16, bitRange=0-15 +sfr = "CAN_MB0_MSR.MDLC", "Memory", 0xfffd0210, 4, base=16, bitRange=16-19 +sfr = "CAN_MB0_MSR.MRTR", "Memory", 0xfffd0210, 4, base=16, bitRange=20 +sfr = "CAN_MB0_MSR.MABT", "Memory", 0xfffd0210, 4, base=16, bitRange=22 +sfr = "CAN_MB0_MSR.MRDY", "Memory", 0xfffd0210, 4, base=16, bitRange=23 +sfr = "CAN_MB0_MSR.MMI", "Memory", 0xfffd0210, 4, base=16, bitRange=24 +sfr = "CAN_MB0_MDL", "Memory", 0xfffd0214, 4, base=16 +sfr = "CAN_MB0_MDH", "Memory", 0xfffd0218, 4, base=16 +sfr = "CAN_MB0_MCR", "Memory", 0xfffd021c, 4, base=16 +sfr = "CAN_MB0_MCR.MDLC", "Memory", 0xfffd021c, 4, base=16, bitRange=16-19 +sfr = "CAN_MB0_MCR.MRTR", "Memory", 0xfffd021c, 4, base=16, bitRange=20 +sfr = "CAN_MB0_MCR.MACR", "Memory", 0xfffd021c, 4, base=16, bitRange=22 +sfr = "CAN_MB0_MCR.MTCR", "Memory", 0xfffd021c, 4, base=16, bitRange=23 +; ========== Register definition for CAN_MB1 peripheral ========== +sfr = "CAN_MB1_MMR", "Memory", 0xfffd0220, 4, base=16 +sfr = "CAN_MB1_MMR.MTIMEMARK", "Memory", 0xfffd0220, 4, base=16, bitRange=0-15 +sfr = "CAN_MB1_MMR.PRIOR", "Memory", 0xfffd0220, 4, base=16, bitRange=16-19 +sfr = "CAN_MB1_MMR.MOT", "Memory", 0xfffd0220, 4, base=16, bitRange=24-26 +sfr = "CAN_MB1_MAM", "Memory", 0xfffd0224, 4, base=16 +sfr = "CAN_MB1_MAM.MIDvB", "Memory", 0xfffd0224, 4, base=16, bitRange=0-17 +sfr = "CAN_MB1_MAM.MIDvA", "Memory", 0xfffd0224, 4, base=16, bitRange=18-28 +sfr = "CAN_MB1_MAM.MIDE", "Memory", 0xfffd0224, 4, base=16, bitRange=29 +sfr = "CAN_MB1_MID", "Memory", 0xfffd0228, 4, base=16 +sfr = "CAN_MB1_MID.MIDvB", "Memory", 0xfffd0228, 4, base=16, bitRange=0-17 +sfr = "CAN_MB1_MID.MIDvA", "Memory", 0xfffd0228, 4, base=16, bitRange=18-28 +sfr = "CAN_MB1_MID.MIDE", "Memory", 0xfffd0228, 4, base=16, bitRange=29 +sfr = "CAN_MB1_MFID", "Memory", 0xfffd022c, 4, base=16 +sfr = "CAN_MB1_MSR", "Memory", 0xfffd0230, 4, base=16 +sfr = "CAN_MB1_MSR.MTIMESTAMP", "Memory", 0xfffd0230, 4, base=16, bitRange=0-15 +sfr = "CAN_MB1_MSR.MDLC", "Memory", 0xfffd0230, 4, base=16, bitRange=16-19 +sfr = "CAN_MB1_MSR.MRTR", "Memory", 0xfffd0230, 4, base=16, bitRange=20 +sfr = "CAN_MB1_MSR.MABT", "Memory", 0xfffd0230, 4, base=16, bitRange=22 +sfr = "CAN_MB1_MSR.MRDY", "Memory", 0xfffd0230, 4, base=16, bitRange=23 +sfr = "CAN_MB1_MSR.MMI", "Memory", 0xfffd0230, 4, base=16, bitRange=24 +sfr = "CAN_MB1_MDL", "Memory", 0xfffd0234, 4, base=16 +sfr = "CAN_MB1_MDH", "Memory", 0xfffd0238, 4, base=16 +sfr = "CAN_MB1_MCR", "Memory", 0xfffd023c, 4, base=16 +sfr = "CAN_MB1_MCR.MDLC", "Memory", 0xfffd023c, 4, base=16, bitRange=16-19 +sfr = "CAN_MB1_MCR.MRTR", "Memory", 0xfffd023c, 4, base=16, bitRange=20 +sfr = "CAN_MB1_MCR.MACR", "Memory", 0xfffd023c, 4, base=16, bitRange=22 +sfr = "CAN_MB1_MCR.MTCR", "Memory", 0xfffd023c, 4, base=16, bitRange=23 +; ========== Register definition for CAN_MB2 peripheral ========== +sfr = "CAN_MB2_MMR", "Memory", 0xfffd0240, 4, base=16 +sfr = "CAN_MB2_MMR.MTIMEMARK", "Memory", 0xfffd0240, 4, base=16, bitRange=0-15 +sfr = "CAN_MB2_MMR.PRIOR", "Memory", 0xfffd0240, 4, base=16, bitRange=16-19 +sfr = "CAN_MB2_MMR.MOT", "Memory", 0xfffd0240, 4, base=16, bitRange=24-26 +sfr = "CAN_MB2_MAM", "Memory", 0xfffd0244, 4, base=16 +sfr = "CAN_MB2_MAM.MIDvB", "Memory", 0xfffd0244, 4, base=16, bitRange=0-17 +sfr = "CAN_MB2_MAM.MIDvA", "Memory", 0xfffd0244, 4, base=16, bitRange=18-28 +sfr = "CAN_MB2_MAM.MIDE", "Memory", 0xfffd0244, 4, base=16, bitRange=29 +sfr = "CAN_MB2_MID", "Memory", 0xfffd0248, 4, base=16 +sfr = "CAN_MB2_MID.MIDvB", "Memory", 0xfffd0248, 4, base=16, bitRange=0-17 +sfr = "CAN_MB2_MID.MIDvA", "Memory", 0xfffd0248, 4, base=16, bitRange=18-28 +sfr = "CAN_MB2_MID.MIDE", "Memory", 0xfffd0248, 4, base=16, bitRange=29 +sfr = "CAN_MB2_MFID", "Memory", 0xfffd024c, 4, base=16 +sfr = "CAN_MB2_MSR", "Memory", 0xfffd0250, 4, base=16 +sfr = "CAN_MB2_MSR.MTIMESTAMP", "Memory", 0xfffd0250, 4, base=16, bitRange=0-15 +sfr = "CAN_MB2_MSR.MDLC", "Memory", 0xfffd0250, 4, base=16, bitRange=16-19 +sfr = "CAN_MB2_MSR.MRTR", "Memory", 0xfffd0250, 4, base=16, bitRange=20 +sfr = "CAN_MB2_MSR.MABT", "Memory", 0xfffd0250, 4, base=16, bitRange=22 +sfr = "CAN_MB2_MSR.MRDY", "Memory", 0xfffd0250, 4, base=16, bitRange=23 +sfr = "CAN_MB2_MSR.MMI", "Memory", 0xfffd0250, 4, base=16, bitRange=24 +sfr = "CAN_MB2_MDL", "Memory", 0xfffd0254, 4, base=16 +sfr = "CAN_MB2_MDH", "Memory", 0xfffd0258, 4, base=16 +sfr = "CAN_MB2_MCR", "Memory", 0xfffd025c, 4, base=16 +sfr = "CAN_MB2_MCR.MDLC", "Memory", 0xfffd025c, 4, base=16, bitRange=16-19 +sfr = "CAN_MB2_MCR.MRTR", "Memory", 0xfffd025c, 4, base=16, bitRange=20 +sfr = "CAN_MB2_MCR.MACR", "Memory", 0xfffd025c, 4, base=16, bitRange=22 +sfr = "CAN_MB2_MCR.MTCR", "Memory", 0xfffd025c, 4, base=16, bitRange=23 +; ========== Register definition for CAN_MB3 peripheral ========== +sfr = "CAN_MB3_MMR", "Memory", 0xfffd0260, 4, base=16 +sfr = "CAN_MB3_MMR.MTIMEMARK", "Memory", 0xfffd0260, 4, base=16, bitRange=0-15 +sfr = "CAN_MB3_MMR.PRIOR", "Memory", 0xfffd0260, 4, base=16, bitRange=16-19 +sfr = "CAN_MB3_MMR.MOT", "Memory", 0xfffd0260, 4, base=16, bitRange=24-26 +sfr = "CAN_MB3_MAM", "Memory", 0xfffd0264, 4, base=16 +sfr = "CAN_MB3_MAM.MIDvB", "Memory", 0xfffd0264, 4, base=16, bitRange=0-17 +sfr = "CAN_MB3_MAM.MIDvA", "Memory", 0xfffd0264, 4, base=16, bitRange=18-28 +sfr = "CAN_MB3_MAM.MIDE", "Memory", 0xfffd0264, 4, base=16, bitRange=29 +sfr = "CAN_MB3_MID", "Memory", 0xfffd0268, 4, base=16 +sfr = "CAN_MB3_MID.MIDvB", "Memory", 0xfffd0268, 4, base=16, bitRange=0-17 +sfr = "CAN_MB3_MID.MIDvA", "Memory", 0xfffd0268, 4, base=16, bitRange=18-28 +sfr = "CAN_MB3_MID.MIDE", "Memory", 0xfffd0268, 4, base=16, bitRange=29 +sfr = "CAN_MB3_MFID", "Memory", 0xfffd026c, 4, base=16 +sfr = "CAN_MB3_MSR", "Memory", 0xfffd0270, 4, base=16 +sfr = "CAN_MB3_MSR.MTIMESTAMP", "Memory", 0xfffd0270, 4, base=16, bitRange=0-15 +sfr = "CAN_MB3_MSR.MDLC", "Memory", 0xfffd0270, 4, base=16, bitRange=16-19 +sfr = "CAN_MB3_MSR.MRTR", "Memory", 0xfffd0270, 4, base=16, bitRange=20 +sfr = "CAN_MB3_MSR.MABT", "Memory", 0xfffd0270, 4, base=16, bitRange=22 +sfr = "CAN_MB3_MSR.MRDY", "Memory", 0xfffd0270, 4, base=16, bitRange=23 +sfr = "CAN_MB3_MSR.MMI", "Memory", 0xfffd0270, 4, base=16, bitRange=24 +sfr = "CAN_MB3_MDL", "Memory", 0xfffd0274, 4, base=16 +sfr = "CAN_MB3_MDH", "Memory", 0xfffd0278, 4, base=16 +sfr = "CAN_MB3_MCR", "Memory", 0xfffd027c, 4, base=16 +sfr = "CAN_MB3_MCR.MDLC", "Memory", 0xfffd027c, 4, base=16, bitRange=16-19 +sfr = "CAN_MB3_MCR.MRTR", "Memory", 0xfffd027c, 4, base=16, bitRange=20 +sfr = "CAN_MB3_MCR.MACR", "Memory", 0xfffd027c, 4, base=16, bitRange=22 +sfr = "CAN_MB3_MCR.MTCR", "Memory", 0xfffd027c, 4, base=16, bitRange=23 +; ========== Register definition for CAN_MB4 peripheral ========== +sfr = "CAN_MB4_MMR", "Memory", 0xfffd0280, 4, base=16 +sfr = "CAN_MB4_MMR.MTIMEMARK", "Memory", 0xfffd0280, 4, base=16, bitRange=0-15 +sfr = "CAN_MB4_MMR.PRIOR", "Memory", 0xfffd0280, 4, base=16, bitRange=16-19 +sfr = "CAN_MB4_MMR.MOT", "Memory", 0xfffd0280, 4, base=16, bitRange=24-26 +sfr = "CAN_MB4_MAM", "Memory", 0xfffd0284, 4, base=16 +sfr = "CAN_MB4_MAM.MIDvB", "Memory", 0xfffd0284, 4, base=16, bitRange=0-17 +sfr = "CAN_MB4_MAM.MIDvA", "Memory", 0xfffd0284, 4, base=16, bitRange=18-28 +sfr = "CAN_MB4_MAM.MIDE", "Memory", 0xfffd0284, 4, base=16, bitRange=29 +sfr = "CAN_MB4_MID", "Memory", 0xfffd0288, 4, base=16 +sfr = "CAN_MB4_MID.MIDvB", "Memory", 0xfffd0288, 4, base=16, bitRange=0-17 +sfr = "CAN_MB4_MID.MIDvA", "Memory", 0xfffd0288, 4, base=16, bitRange=18-28 +sfr = "CAN_MB4_MID.MIDE", "Memory", 0xfffd0288, 4, base=16, bitRange=29 +sfr = "CAN_MB4_MFID", "Memory", 0xfffd028c, 4, base=16 +sfr = "CAN_MB4_MSR", "Memory", 0xfffd0290, 4, base=16 +sfr = "CAN_MB4_MSR.MTIMESTAMP", "Memory", 0xfffd0290, 4, base=16, bitRange=0-15 +sfr = "CAN_MB4_MSR.MDLC", "Memory", 0xfffd0290, 4, base=16, bitRange=16-19 +sfr = "CAN_MB4_MSR.MRTR", "Memory", 0xfffd0290, 4, base=16, bitRange=20 +sfr = "CAN_MB4_MSR.MABT", "Memory", 0xfffd0290, 4, base=16, bitRange=22 +sfr = "CAN_MB4_MSR.MRDY", "Memory", 0xfffd0290, 4, base=16, bitRange=23 +sfr = "CAN_MB4_MSR.MMI", "Memory", 0xfffd0290, 4, base=16, bitRange=24 +sfr = "CAN_MB4_MDL", "Memory", 0xfffd0294, 4, base=16 +sfr = "CAN_MB4_MDH", "Memory", 0xfffd0298, 4, base=16 +sfr = "CAN_MB4_MCR", "Memory", 0xfffd029c, 4, base=16 +sfr = "CAN_MB4_MCR.MDLC", "Memory", 0xfffd029c, 4, base=16, bitRange=16-19 +sfr = "CAN_MB4_MCR.MRTR", "Memory", 0xfffd029c, 4, base=16, bitRange=20 +sfr = "CAN_MB4_MCR.MACR", "Memory", 0xfffd029c, 4, base=16, bitRange=22 +sfr = "CAN_MB4_MCR.MTCR", "Memory", 0xfffd029c, 4, base=16, bitRange=23 +; ========== Register definition for CAN_MB5 peripheral ========== +sfr = "CAN_MB5_MMR", "Memory", 0xfffd02a0, 4, base=16 +sfr = "CAN_MB5_MMR.MTIMEMARK", "Memory", 0xfffd02a0, 4, base=16, bitRange=0-15 +sfr = "CAN_MB5_MMR.PRIOR", "Memory", 0xfffd02a0, 4, base=16, bitRange=16-19 +sfr = "CAN_MB5_MMR.MOT", "Memory", 0xfffd02a0, 4, base=16, bitRange=24-26 +sfr = "CAN_MB5_MAM", "Memory", 0xfffd02a4, 4, base=16 +sfr = "CAN_MB5_MAM.MIDvB", "Memory", 0xfffd02a4, 4, base=16, bitRange=0-17 +sfr = "CAN_MB5_MAM.MIDvA", "Memory", 0xfffd02a4, 4, base=16, bitRange=18-28 +sfr = "CAN_MB5_MAM.MIDE", "Memory", 0xfffd02a4, 4, base=16, bitRange=29 +sfr = "CAN_MB5_MID", "Memory", 0xfffd02a8, 4, base=16 +sfr = "CAN_MB5_MID.MIDvB", "Memory", 0xfffd02a8, 4, base=16, bitRange=0-17 +sfr = "CAN_MB5_MID.MIDvA", "Memory", 0xfffd02a8, 4, base=16, bitRange=18-28 +sfr = "CAN_MB5_MID.MIDE", "Memory", 0xfffd02a8, 4, base=16, bitRange=29 +sfr = "CAN_MB5_MFID", "Memory", 0xfffd02ac, 4, base=16 +sfr = "CAN_MB5_MSR", "Memory", 0xfffd02b0, 4, base=16 +sfr = "CAN_MB5_MSR.MTIMESTAMP", "Memory", 0xfffd02b0, 4, base=16, bitRange=0-15 +sfr = "CAN_MB5_MSR.MDLC", "Memory", 0xfffd02b0, 4, base=16, bitRange=16-19 +sfr = "CAN_MB5_MSR.MRTR", "Memory", 0xfffd02b0, 4, base=16, bitRange=20 +sfr = "CAN_MB5_MSR.MABT", "Memory", 0xfffd02b0, 4, base=16, bitRange=22 +sfr = "CAN_MB5_MSR.MRDY", "Memory", 0xfffd02b0, 4, base=16, bitRange=23 +sfr = "CAN_MB5_MSR.MMI", "Memory", 0xfffd02b0, 4, base=16, bitRange=24 +sfr = "CAN_MB5_MDL", "Memory", 0xfffd02b4, 4, base=16 +sfr = "CAN_MB5_MDH", "Memory", 0xfffd02b8, 4, base=16 +sfr = "CAN_MB5_MCR", "Memory", 0xfffd02bc, 4, base=16 +sfr = "CAN_MB5_MCR.MDLC", "Memory", 0xfffd02bc, 4, base=16, bitRange=16-19 +sfr = "CAN_MB5_MCR.MRTR", "Memory", 0xfffd02bc, 4, base=16, bitRange=20 +sfr = "CAN_MB5_MCR.MACR", "Memory", 0xfffd02bc, 4, base=16, bitRange=22 +sfr = "CAN_MB5_MCR.MTCR", "Memory", 0xfffd02bc, 4, base=16, bitRange=23 +; ========== Register definition for CAN_MB6 peripheral ========== +sfr = "CAN_MB6_MMR", "Memory", 0xfffd02c0, 4, base=16 +sfr = "CAN_MB6_MMR.MTIMEMARK", "Memory", 0xfffd02c0, 4, base=16, bitRange=0-15 +sfr = "CAN_MB6_MMR.PRIOR", "Memory", 0xfffd02c0, 4, base=16, bitRange=16-19 +sfr = "CAN_MB6_MMR.MOT", "Memory", 0xfffd02c0, 4, base=16, bitRange=24-26 +sfr = "CAN_MB6_MAM", "Memory", 0xfffd02c4, 4, base=16 +sfr = "CAN_MB6_MAM.MIDvB", "Memory", 0xfffd02c4, 4, base=16, bitRange=0-17 +sfr = "CAN_MB6_MAM.MIDvA", "Memory", 0xfffd02c4, 4, base=16, bitRange=18-28 +sfr = "CAN_MB6_MAM.MIDE", "Memory", 0xfffd02c4, 4, base=16, bitRange=29 +sfr = "CAN_MB6_MID", "Memory", 0xfffd02c8, 4, base=16 +sfr = "CAN_MB6_MID.MIDvB", "Memory", 0xfffd02c8, 4, base=16, bitRange=0-17 +sfr = "CAN_MB6_MID.MIDvA", "Memory", 0xfffd02c8, 4, base=16, bitRange=18-28 +sfr = "CAN_MB6_MID.MIDE", "Memory", 0xfffd02c8, 4, base=16, bitRange=29 +sfr = "CAN_MB6_MFID", "Memory", 0xfffd02cc, 4, base=16 +sfr = "CAN_MB6_MSR", "Memory", 0xfffd02d0, 4, base=16 +sfr = "CAN_MB6_MSR.MTIMESTAMP", "Memory", 0xfffd02d0, 4, base=16, bitRange=0-15 +sfr = "CAN_MB6_MSR.MDLC", "Memory", 0xfffd02d0, 4, base=16, bitRange=16-19 +sfr = "CAN_MB6_MSR.MRTR", "Memory", 0xfffd02d0, 4, base=16, bitRange=20 +sfr = "CAN_MB6_MSR.MABT", "Memory", 0xfffd02d0, 4, base=16, bitRange=22 +sfr = "CAN_MB6_MSR.MRDY", "Memory", 0xfffd02d0, 4, base=16, bitRange=23 +sfr = "CAN_MB6_MSR.MMI", "Memory", 0xfffd02d0, 4, base=16, bitRange=24 +sfr = "CAN_MB6_MDL", "Memory", 0xfffd02d4, 4, base=16 +sfr = "CAN_MB6_MDH", "Memory", 0xfffd02d8, 4, base=16 +sfr = "CAN_MB6_MCR", "Memory", 0xfffd02dc, 4, base=16 +sfr = "CAN_MB6_MCR.MDLC", "Memory", 0xfffd02dc, 4, base=16, bitRange=16-19 +sfr = "CAN_MB6_MCR.MRTR", "Memory", 0xfffd02dc, 4, base=16, bitRange=20 +sfr = "CAN_MB6_MCR.MACR", "Memory", 0xfffd02dc, 4, base=16, bitRange=22 +sfr = "CAN_MB6_MCR.MTCR", "Memory", 0xfffd02dc, 4, base=16, bitRange=23 +; ========== Register definition for CAN_MB7 peripheral ========== +sfr = "CAN_MB7_MMR", "Memory", 0xfffd02e0, 4, base=16 +sfr = "CAN_MB7_MMR.MTIMEMARK", "Memory", 0xfffd02e0, 4, base=16, bitRange=0-15 +sfr = "CAN_MB7_MMR.PRIOR", "Memory", 0xfffd02e0, 4, base=16, bitRange=16-19 +sfr = "CAN_MB7_MMR.MOT", "Memory", 0xfffd02e0, 4, base=16, bitRange=24-26 +sfr = "CAN_MB7_MAM", "Memory", 0xfffd02e4, 4, base=16 +sfr = "CAN_MB7_MAM.MIDvB", "Memory", 0xfffd02e4, 4, base=16, bitRange=0-17 +sfr = "CAN_MB7_MAM.MIDvA", "Memory", 0xfffd02e4, 4, base=16, bitRange=18-28 +sfr = "CAN_MB7_MAM.MIDE", "Memory", 0xfffd02e4, 4, base=16, bitRange=29 +sfr = "CAN_MB7_MID", "Memory", 0xfffd02e8, 4, base=16 +sfr = "CAN_MB7_MID.MIDvB", "Memory", 0xfffd02e8, 4, base=16, bitRange=0-17 +sfr = "CAN_MB7_MID.MIDvA", "Memory", 0xfffd02e8, 4, base=16, bitRange=18-28 +sfr = "CAN_MB7_MID.MIDE", "Memory", 0xfffd02e8, 4, base=16, bitRange=29 +sfr = "CAN_MB7_MFID", "Memory", 0xfffd02ec, 4, base=16 +sfr = "CAN_MB7_MSR", "Memory", 0xfffd02f0, 4, base=16 +sfr = "CAN_MB7_MSR.MTIMESTAMP", "Memory", 0xfffd02f0, 4, base=16, bitRange=0-15 +sfr = "CAN_MB7_MSR.MDLC", "Memory", 0xfffd02f0, 4, base=16, bitRange=16-19 +sfr = "CAN_MB7_MSR.MRTR", "Memory", 0xfffd02f0, 4, base=16, bitRange=20 +sfr = "CAN_MB7_MSR.MABT", "Memory", 0xfffd02f0, 4, base=16, bitRange=22 +sfr = "CAN_MB7_MSR.MRDY", "Memory", 0xfffd02f0, 4, base=16, bitRange=23 +sfr = "CAN_MB7_MSR.MMI", "Memory", 0xfffd02f0, 4, base=16, bitRange=24 +sfr = "CAN_MB7_MDL", "Memory", 0xfffd02f4, 4, base=16 +sfr = "CAN_MB7_MDH", "Memory", 0xfffd02f8, 4, base=16 +sfr = "CAN_MB7_MCR", "Memory", 0xfffd02fc, 4, base=16 +sfr = "CAN_MB7_MCR.MDLC", "Memory", 0xfffd02fc, 4, base=16, bitRange=16-19 +sfr = "CAN_MB7_MCR.MRTR", "Memory", 0xfffd02fc, 4, base=16, bitRange=20 +sfr = "CAN_MB7_MCR.MACR", "Memory", 0xfffd02fc, 4, base=16, bitRange=22 +sfr = "CAN_MB7_MCR.MTCR", "Memory", 0xfffd02fc, 4, base=16, bitRange=23 +; ========== Register definition for CAN peripheral ========== +sfr = "CAN_MR", "Memory", 0xfffd0000, 4, base=16 +sfr = "CAN_MR.CANEN", "Memory", 0xfffd0000, 4, base=16, bitRange=0 +sfr = "CAN_MR.LPM", "Memory", 0xfffd0000, 4, base=16, bitRange=1 +sfr = "CAN_MR.ABM", "Memory", 0xfffd0000, 4, base=16, bitRange=2 +sfr = "CAN_MR.OVL", "Memory", 0xfffd0000, 4, base=16, bitRange=3 +sfr = "CAN_MR.TEOF", "Memory", 0xfffd0000, 4, base=16, bitRange=4 +sfr = "CAN_MR.TTM", "Memory", 0xfffd0000, 4, base=16, bitRange=5 +sfr = "CAN_MR.TIMFRZ", "Memory", 0xfffd0000, 4, base=16, bitRange=6 +sfr = "CAN_MR.DRPT", "Memory", 0xfffd0000, 4, base=16, bitRange=7 +sfr = "CAN_IER", "Memory", 0xfffd0004, 4, base=16 +sfr = "CAN_IER.MB0", "Memory", 0xfffd0004, 4, base=16, bitRange=0 +sfr = "CAN_IER.MB1", "Memory", 0xfffd0004, 4, base=16, bitRange=1 +sfr = "CAN_IER.MB2", "Memory", 0xfffd0004, 4, base=16, bitRange=2 +sfr = "CAN_IER.MB3", "Memory", 0xfffd0004, 4, base=16, bitRange=3 +sfr = "CAN_IER.MB4", "Memory", 0xfffd0004, 4, base=16, bitRange=4 +sfr = "CAN_IER.MB5", "Memory", 0xfffd0004, 4, base=16, bitRange=5 +sfr = "CAN_IER.MB6", "Memory", 0xfffd0004, 4, base=16, bitRange=6 +sfr = "CAN_IER.MB7", "Memory", 0xfffd0004, 4, base=16, bitRange=7 +sfr = "CAN_IER.MB8", "Memory", 0xfffd0004, 4, base=16, bitRange=8 +sfr = "CAN_IER.MB9", "Memory", 0xfffd0004, 4, base=16, bitRange=9 +sfr = "CAN_IER.MB10", "Memory", 0xfffd0004, 4, base=16, bitRange=10 +sfr = "CAN_IER.MB11", "Memory", 0xfffd0004, 4, base=16, bitRange=11 +sfr = "CAN_IER.MB12", "Memory", 0xfffd0004, 4, base=16, bitRange=12 +sfr = "CAN_IER.MB13", "Memory", 0xfffd0004, 4, base=16, bitRange=13 +sfr = "CAN_IER.MB14", "Memory", 0xfffd0004, 4, base=16, bitRange=14 +sfr = "CAN_IER.MB15", "Memory", 0xfffd0004, 4, base=16, bitRange=15 +sfr = "CAN_IER.ERRA", "Memory", 0xfffd0004, 4, base=16, bitRange=16 +sfr = "CAN_IER.WARN", "Memory", 0xfffd0004, 4, base=16, bitRange=17 +sfr = "CAN_IER.ERRP", "Memory", 0xfffd0004, 4, base=16, bitRange=18 +sfr = "CAN_IER.BOFF", "Memory", 0xfffd0004, 4, base=16, bitRange=19 +sfr = "CAN_IER.SLEEP", "Memory", 0xfffd0004, 4, base=16, bitRange=20 +sfr = "CAN_IER.WAKEUP", "Memory", 0xfffd0004, 4, base=16, bitRange=21 +sfr = "CAN_IER.TOVF", "Memory", 0xfffd0004, 4, base=16, bitRange=22 +sfr = "CAN_IER.TSTP", "Memory", 0xfffd0004, 4, base=16, bitRange=23 +sfr = "CAN_IER.CERR", "Memory", 0xfffd0004, 4, base=16, bitRange=24 +sfr = "CAN_IER.SERR", "Memory", 0xfffd0004, 4, base=16, bitRange=25 +sfr = "CAN_IER.AERR", "Memory", 0xfffd0004, 4, base=16, bitRange=26 +sfr = "CAN_IER.FERR", "Memory", 0xfffd0004, 4, base=16, bitRange=27 +sfr = "CAN_IER.BERR", "Memory", 0xfffd0004, 4, base=16, bitRange=28 +sfr = "CAN_IDR", "Memory", 0xfffd0008, 4, base=16 +sfr = "CAN_IDR.MB0", "Memory", 0xfffd0008, 4, base=16, bitRange=0 +sfr = "CAN_IDR.MB1", "Memory", 0xfffd0008, 4, base=16, bitRange=1 +sfr = "CAN_IDR.MB2", "Memory", 0xfffd0008, 4, base=16, bitRange=2 +sfr = "CAN_IDR.MB3", "Memory", 0xfffd0008, 4, base=16, bitRange=3 +sfr = "CAN_IDR.MB4", "Memory", 0xfffd0008, 4, base=16, bitRange=4 +sfr = "CAN_IDR.MB5", "Memory", 0xfffd0008, 4, base=16, bitRange=5 +sfr = "CAN_IDR.MB6", "Memory", 0xfffd0008, 4, base=16, bitRange=6 +sfr = "CAN_IDR.MB7", "Memory", 0xfffd0008, 4, base=16, bitRange=7 +sfr = "CAN_IDR.MB8", "Memory", 0xfffd0008, 4, base=16, bitRange=8 +sfr = "CAN_IDR.MB9", "Memory", 0xfffd0008, 4, base=16, bitRange=9 +sfr = "CAN_IDR.MB10", "Memory", 0xfffd0008, 4, base=16, bitRange=10 +sfr = "CAN_IDR.MB11", "Memory", 0xfffd0008, 4, base=16, bitRange=11 +sfr = "CAN_IDR.MB12", "Memory", 0xfffd0008, 4, base=16, bitRange=12 +sfr = "CAN_IDR.MB13", "Memory", 0xfffd0008, 4, base=16, bitRange=13 +sfr = "CAN_IDR.MB14", "Memory", 0xfffd0008, 4, base=16, bitRange=14 +sfr = "CAN_IDR.MB15", "Memory", 0xfffd0008, 4, base=16, bitRange=15 +sfr = "CAN_IDR.ERRA", "Memory", 0xfffd0008, 4, base=16, bitRange=16 +sfr = "CAN_IDR.WARN", "Memory", 0xfffd0008, 4, base=16, bitRange=17 +sfr = "CAN_IDR.ERRP", "Memory", 0xfffd0008, 4, base=16, bitRange=18 +sfr = "CAN_IDR.BOFF", "Memory", 0xfffd0008, 4, base=16, bitRange=19 +sfr = "CAN_IDR.SLEEP", "Memory", 0xfffd0008, 4, base=16, bitRange=20 +sfr = "CAN_IDR.WAKEUP", "Memory", 0xfffd0008, 4, base=16, bitRange=21 +sfr = "CAN_IDR.TOVF", "Memory", 0xfffd0008, 4, base=16, bitRange=22 +sfr = "CAN_IDR.TSTP", "Memory", 0xfffd0008, 4, base=16, bitRange=23 +sfr = "CAN_IDR.CERR", "Memory", 0xfffd0008, 4, base=16, bitRange=24 +sfr = "CAN_IDR.SERR", "Memory", 0xfffd0008, 4, base=16, bitRange=25 +sfr = "CAN_IDR.AERR", "Memory", 0xfffd0008, 4, base=16, bitRange=26 +sfr = "CAN_IDR.FERR", "Memory", 0xfffd0008, 4, base=16, bitRange=27 +sfr = "CAN_IDR.BERR", "Memory", 0xfffd0008, 4, base=16, bitRange=28 +sfr = "CAN_IMR", "Memory", 0xfffd000c, 4, base=16 +sfr = "CAN_IMR.MB0", "Memory", 0xfffd000c, 4, base=16, bitRange=0 +sfr = "CAN_IMR.MB1", "Memory", 0xfffd000c, 4, base=16, bitRange=1 +sfr = "CAN_IMR.MB2", "Memory", 0xfffd000c, 4, base=16, bitRange=2 +sfr = "CAN_IMR.MB3", "Memory", 0xfffd000c, 4, base=16, bitRange=3 +sfr = "CAN_IMR.MB4", "Memory", 0xfffd000c, 4, base=16, bitRange=4 +sfr = "CAN_IMR.MB5", "Memory", 0xfffd000c, 4, base=16, bitRange=5 +sfr = "CAN_IMR.MB6", "Memory", 0xfffd000c, 4, base=16, bitRange=6 +sfr = "CAN_IMR.MB7", "Memory", 0xfffd000c, 4, base=16, bitRange=7 +sfr = "CAN_IMR.MB8", "Memory", 0xfffd000c, 4, base=16, bitRange=8 +sfr = "CAN_IMR.MB9", "Memory", 0xfffd000c, 4, base=16, bitRange=9 +sfr = "CAN_IMR.MB10", "Memory", 0xfffd000c, 4, base=16, bitRange=10 +sfr = "CAN_IMR.MB11", "Memory", 0xfffd000c, 4, base=16, bitRange=11 +sfr = "CAN_IMR.MB12", "Memory", 0xfffd000c, 4, base=16, bitRange=12 +sfr = "CAN_IMR.MB13", "Memory", 0xfffd000c, 4, base=16, bitRange=13 +sfr = "CAN_IMR.MB14", "Memory", 0xfffd000c, 4, base=16, bitRange=14 +sfr = "CAN_IMR.MB15", "Memory", 0xfffd000c, 4, base=16, bitRange=15 +sfr = "CAN_IMR.ERRA", "Memory", 0xfffd000c, 4, base=16, bitRange=16 +sfr = "CAN_IMR.WARN", "Memory", 0xfffd000c, 4, base=16, bitRange=17 +sfr = "CAN_IMR.ERRP", "Memory", 0xfffd000c, 4, base=16, bitRange=18 +sfr = "CAN_IMR.BOFF", "Memory", 0xfffd000c, 4, base=16, bitRange=19 +sfr = "CAN_IMR.SLEEP", "Memory", 0xfffd000c, 4, base=16, bitRange=20 +sfr = "CAN_IMR.WAKEUP", "Memory", 0xfffd000c, 4, base=16, bitRange=21 +sfr = "CAN_IMR.TOVF", "Memory", 0xfffd000c, 4, base=16, bitRange=22 +sfr = "CAN_IMR.TSTP", "Memory", 0xfffd000c, 4, base=16, bitRange=23 +sfr = "CAN_IMR.CERR", "Memory", 0xfffd000c, 4, base=16, bitRange=24 +sfr = "CAN_IMR.SERR", "Memory", 0xfffd000c, 4, base=16, bitRange=25 +sfr = "CAN_IMR.AERR", "Memory", 0xfffd000c, 4, base=16, bitRange=26 +sfr = "CAN_IMR.FERR", "Memory", 0xfffd000c, 4, base=16, bitRange=27 +sfr = "CAN_IMR.BERR", "Memory", 0xfffd000c, 4, base=16, bitRange=28 +sfr = "CAN_SR", "Memory", 0xfffd0010, 4, base=16 +sfr = "CAN_SR.MB0", "Memory", 0xfffd0010, 4, base=16, bitRange=0 +sfr = "CAN_SR.MB1", "Memory", 0xfffd0010, 4, base=16, bitRange=1 +sfr = "CAN_SR.MB2", "Memory", 0xfffd0010, 4, base=16, bitRange=2 +sfr = "CAN_SR.MB3", "Memory", 0xfffd0010, 4, base=16, bitRange=3 +sfr = "CAN_SR.MB4", "Memory", 0xfffd0010, 4, base=16, bitRange=4 +sfr = "CAN_SR.MB5", "Memory", 0xfffd0010, 4, base=16, bitRange=5 +sfr = "CAN_SR.MB6", "Memory", 0xfffd0010, 4, base=16, bitRange=6 +sfr = "CAN_SR.MB7", "Memory", 0xfffd0010, 4, base=16, bitRange=7 +sfr = "CAN_SR.MB8", "Memory", 0xfffd0010, 4, base=16, bitRange=8 +sfr = "CAN_SR.MB9", "Memory", 0xfffd0010, 4, base=16, bitRange=9 +sfr = "CAN_SR.MB10", "Memory", 0xfffd0010, 4, base=16, bitRange=10 +sfr = "CAN_SR.MB11", "Memory", 0xfffd0010, 4, base=16, bitRange=11 +sfr = "CAN_SR.MB12", "Memory", 0xfffd0010, 4, base=16, bitRange=12 +sfr = "CAN_SR.MB13", "Memory", 0xfffd0010, 4, base=16, bitRange=13 +sfr = "CAN_SR.MB14", "Memory", 0xfffd0010, 4, base=16, bitRange=14 +sfr = "CAN_SR.MB15", "Memory", 0xfffd0010, 4, base=16, bitRange=15 +sfr = "CAN_SR.ERRA", "Memory", 0xfffd0010, 4, base=16, bitRange=16 +sfr = "CAN_SR.WARN", "Memory", 0xfffd0010, 4, base=16, bitRange=17 +sfr = "CAN_SR.ERRP", "Memory", 0xfffd0010, 4, base=16, bitRange=18 +sfr = "CAN_SR.BOFF", "Memory", 0xfffd0010, 4, base=16, bitRange=19 +sfr = "CAN_SR.SLEEP", "Memory", 0xfffd0010, 4, base=16, bitRange=20 +sfr = "CAN_SR.WAKEUP", "Memory", 0xfffd0010, 4, base=16, bitRange=21 +sfr = "CAN_SR.TOVF", "Memory", 0xfffd0010, 4, base=16, bitRange=22 +sfr = "CAN_SR.TSTP", "Memory", 0xfffd0010, 4, base=16, bitRange=23 +sfr = "CAN_SR.CERR", "Memory", 0xfffd0010, 4, base=16, bitRange=24 +sfr = "CAN_SR.SERR", "Memory", 0xfffd0010, 4, base=16, bitRange=25 +sfr = "CAN_SR.AERR", "Memory", 0xfffd0010, 4, base=16, bitRange=26 +sfr = "CAN_SR.FERR", "Memory", 0xfffd0010, 4, base=16, bitRange=27 +sfr = "CAN_SR.BERR", "Memory", 0xfffd0010, 4, base=16, bitRange=28 +sfr = "CAN_SR.RBSY", "Memory", 0xfffd0010, 4, base=16, bitRange=29 +sfr = "CAN_SR.TBSY", "Memory", 0xfffd0010, 4, base=16, bitRange=30 +sfr = "CAN_SR.OVLY", "Memory", 0xfffd0010, 4, base=16, bitRange=31 +sfr = "CAN_BR", "Memory", 0xfffd0014, 4, base=16 +sfr = "CAN_BR.PHASE2", "Memory", 0xfffd0014, 4, base=16, bitRange=0-2 +sfr = "CAN_BR.PHASE1", "Memory", 0xfffd0014, 4, base=16, bitRange=4-6 +sfr = "CAN_BR.PROPAG", "Memory", 0xfffd0014, 4, base=16, bitRange=8-10 +sfr = "CAN_BR.SYNC", "Memory", 0xfffd0014, 4, base=16, bitRange=12-13 +sfr = "CAN_BR.BRP", "Memory", 0xfffd0014, 4, base=16, bitRange=16-22 +sfr = "CAN_BR.SMP", "Memory", 0xfffd0014, 4, base=16, bitRange=24 +sfr = "CAN_TIM", "Memory", 0xfffd0018, 4, base=16 +sfr = "CAN_TIM.TIMER", "Memory", 0xfffd0018, 4, base=16, bitRange=0-15 +sfr = "CAN_TIMESTP", "Memory", 0xfffd001c, 4, base=16 +sfr = "CAN_TIMESTP.MTIMESTAMP", "Memory", 0xfffd001c, 4, base=16, bitRange=0-15 +sfr = "CAN_ECR", "Memory", 0xfffd0020, 4, base=16 +sfr = "CAN_ECR.REC", "Memory", 0xfffd0020, 4, base=16, bitRange=0-7 +sfr = "CAN_ECR.TEC", "Memory", 0xfffd0020, 4, base=16, bitRange=16-23 +sfr = "CAN_TCR", "Memory", 0xfffd0024, 4, base=16 +sfr = "CAN_TCR.MB0", "Memory", 0xfffd0024, 4, base=16, bitRange=0 +sfr = "CAN_TCR.MB1", "Memory", 0xfffd0024, 4, base=16, bitRange=1 +sfr = "CAN_TCR.MB2", "Memory", 0xfffd0024, 4, base=16, bitRange=2 +sfr = "CAN_TCR.MB3", "Memory", 0xfffd0024, 4, base=16, bitRange=3 +sfr = "CAN_TCR.MB4", "Memory", 0xfffd0024, 4, base=16, bitRange=4 +sfr = "CAN_TCR.MB5", "Memory", 0xfffd0024, 4, base=16, bitRange=5 +sfr = "CAN_TCR.MB6", "Memory", 0xfffd0024, 4, base=16, bitRange=6 +sfr = "CAN_TCR.MB7", "Memory", 0xfffd0024, 4, base=16, bitRange=7 +sfr = "CAN_TCR.MB8", "Memory", 0xfffd0024, 4, base=16, bitRange=8 +sfr = "CAN_TCR.MB9", "Memory", 0xfffd0024, 4, base=16, bitRange=9 +sfr = "CAN_TCR.MB10", "Memory", 0xfffd0024, 4, base=16, bitRange=10 +sfr = "CAN_TCR.MB11", "Memory", 0xfffd0024, 4, base=16, bitRange=11 +sfr = "CAN_TCR.MB12", "Memory", 0xfffd0024, 4, base=16, bitRange=12 +sfr = "CAN_TCR.MB13", "Memory", 0xfffd0024, 4, base=16, bitRange=13 +sfr = "CAN_TCR.MB14", "Memory", 0xfffd0024, 4, base=16, bitRange=14 +sfr = "CAN_TCR.MB15", "Memory", 0xfffd0024, 4, base=16, bitRange=15 +sfr = "CAN_TCR.TIMRST", "Memory", 0xfffd0024, 4, base=16, bitRange=31 +sfr = "CAN_ACR", "Memory", 0xfffd0028, 4, base=16 +sfr = "CAN_ACR.MB0", "Memory", 0xfffd0028, 4, base=16, bitRange=0 +sfr = "CAN_ACR.MB1", "Memory", 0xfffd0028, 4, base=16, bitRange=1 +sfr = "CAN_ACR.MB2", "Memory", 0xfffd0028, 4, base=16, bitRange=2 +sfr = "CAN_ACR.MB3", "Memory", 0xfffd0028, 4, base=16, bitRange=3 +sfr = "CAN_ACR.MB4", "Memory", 0xfffd0028, 4, base=16, bitRange=4 +sfr = "CAN_ACR.MB5", "Memory", 0xfffd0028, 4, base=16, bitRange=5 +sfr = "CAN_ACR.MB6", "Memory", 0xfffd0028, 4, base=16, bitRange=6 +sfr = "CAN_ACR.MB7", "Memory", 0xfffd0028, 4, base=16, bitRange=7 +sfr = "CAN_ACR.MB8", "Memory", 0xfffd0028, 4, base=16, bitRange=8 +sfr = "CAN_ACR.MB9", "Memory", 0xfffd0028, 4, base=16, bitRange=9 +sfr = "CAN_ACR.MB10", "Memory", 0xfffd0028, 4, base=16, bitRange=10 +sfr = "CAN_ACR.MB11", "Memory", 0xfffd0028, 4, base=16, bitRange=11 +sfr = "CAN_ACR.MB12", "Memory", 0xfffd0028, 4, base=16, bitRange=12 +sfr = "CAN_ACR.MB13", "Memory", 0xfffd0028, 4, base=16, bitRange=13 +sfr = "CAN_ACR.MB14", "Memory", 0xfffd0028, 4, base=16, bitRange=14 +sfr = "CAN_ACR.MB15", "Memory", 0xfffd0028, 4, base=16, bitRange=15 +sfr = "CAN_VR", "Memory", 0xfffd00fc, 4, base=16 +; ========== Register definition for EMAC peripheral ========== +sfr = "EMAC_NCR", "Memory", 0xfffdc000, 4, base=16 +sfr = "EMAC_NCR.LB", "Memory", 0xfffdc000, 4, base=16, bitRange=0 +sfr = "EMAC_NCR.LLB", "Memory", 0xfffdc000, 4, base=16, bitRange=1 +sfr = "EMAC_NCR.RE", "Memory", 0xfffdc000, 4, base=16, bitRange=2 +sfr = "EMAC_NCR.TE", "Memory", 0xfffdc000, 4, base=16, bitRange=3 +sfr = "EMAC_NCR.MPE", "Memory", 0xfffdc000, 4, base=16, bitRange=4 +sfr = "EMAC_NCR.CLRSTAT", "Memory", 0xfffdc000, 4, base=16, bitRange=5 +sfr = "EMAC_NCR.INCSTAT", "Memory", 0xfffdc000, 4, base=16, bitRange=6 +sfr = "EMAC_NCR.WESTAT", "Memory", 0xfffdc000, 4, base=16, bitRange=7 +sfr = "EMAC_NCR.BP", "Memory", 0xfffdc000, 4, base=16, bitRange=8 +sfr = "EMAC_NCR.TSTART", "Memory", 0xfffdc000, 4, base=16, bitRange=9 +sfr = "EMAC_NCR.THALT", "Memory", 0xfffdc000, 4, base=16, bitRange=10 +sfr = "EMAC_NCR.TPFR", "Memory", 0xfffdc000, 4, base=16, bitRange=11 +sfr = "EMAC_NCR.TZQ", "Memory", 0xfffdc000, 4, base=16, bitRange=12 +sfr = "EMAC_NCFGR", "Memory", 0xfffdc004, 4, base=16 +sfr = "EMAC_NCFGR.SPD", "Memory", 0xfffdc004, 4, base=16, bitRange=0 +sfr = "EMAC_NCFGR.FD", "Memory", 0xfffdc004, 4, base=16, bitRange=1 +sfr = "EMAC_NCFGR.JFRAME", "Memory", 0xfffdc004, 4, base=16, bitRange=3 +sfr = "EMAC_NCFGR.CAF", "Memory", 0xfffdc004, 4, base=16, bitRange=4 +sfr = "EMAC_NCFGR.NBC", "Memory", 0xfffdc004, 4, base=16, bitRange=5 +sfr = "EMAC_NCFGR.MTI", "Memory", 0xfffdc004, 4, base=16, bitRange=6 +sfr = "EMAC_NCFGR.UNI", "Memory", 0xfffdc004, 4, base=16, bitRange=7 +sfr = "EMAC_NCFGR.BIG", "Memory", 0xfffdc004, 4, base=16, bitRange=8 +sfr = "EMAC_NCFGR.EAE", "Memory", 0xfffdc004, 4, base=16, bitRange=9 +sfr = "EMAC_NCFGR.CLK", "Memory", 0xfffdc004, 4, base=16, bitRange=10-11 +sfr = "EMAC_NCFGR.RTY", "Memory", 0xfffdc004, 4, base=16, bitRange=12 +sfr = "EMAC_NCFGR.PAE", "Memory", 0xfffdc004, 4, base=16, bitRange=13 +sfr = "EMAC_NCFGR.RBOF", "Memory", 0xfffdc004, 4, base=16, bitRange=14-15 +sfr = "EMAC_NCFGR.RLCE", "Memory", 0xfffdc004, 4, base=16, bitRange=16 +sfr = "EMAC_NCFGR.DRFCS", "Memory", 0xfffdc004, 4, base=16, bitRange=17 +sfr = "EMAC_NCFGR.EFRHD", "Memory", 0xfffdc004, 4, base=16, bitRange=18 +sfr = "EMAC_NCFGR.IRXFCS", "Memory", 0xfffdc004, 4, base=16, bitRange=19 +sfr = "EMAC_NSR", "Memory", 0xfffdc008, 4, base=16 +sfr = "EMAC_NSR.LINKR", "Memory", 0xfffdc008, 4, base=16, bitRange=0 +sfr = "EMAC_NSR.MDIO", "Memory", 0xfffdc008, 4, base=16, bitRange=1 +sfr = "EMAC_NSR.IDLE", "Memory", 0xfffdc008, 4, base=16, bitRange=2 +sfr = "EMAC_TSR", "Memory", 0xfffdc014, 4, base=16 +sfr = "EMAC_TSR.UBR", "Memory", 0xfffdc014, 4, base=16, bitRange=0 +sfr = "EMAC_TSR.COL", "Memory", 0xfffdc014, 4, base=16, bitRange=1 +sfr = "EMAC_TSR.RLES", "Memory", 0xfffdc014, 4, base=16, bitRange=2 +sfr = "EMAC_TSR.TGO", "Memory", 0xfffdc014, 4, base=16, bitRange=3 +sfr = "EMAC_TSR.BEX", "Memory", 0xfffdc014, 4, base=16, bitRange=4 +sfr = "EMAC_TSR.COMP", "Memory", 0xfffdc014, 4, base=16, bitRange=5 +sfr = "EMAC_TSR.UND", "Memory", 0xfffdc014, 4, base=16, bitRange=6 +sfr = "EMAC_RBQP", "Memory", 0xfffdc018, 4, base=16 +sfr = "EMAC_TBQP", "Memory", 0xfffdc01c, 4, base=16 +sfr = "EMAC_RSR", "Memory", 0xfffdc020, 4, base=16 +sfr = "EMAC_RSR.BNA", "Memory", 0xfffdc020, 4, base=16, bitRange=0 +sfr = "EMAC_RSR.REC", "Memory", 0xfffdc020, 4, base=16, bitRange=1 +sfr = "EMAC_RSR.OVR", "Memory", 0xfffdc020, 4, base=16, bitRange=2 +sfr = "EMAC_ISR", "Memory", 0xfffdc024, 4, base=16 +sfr = "EMAC_ISR.MFD", "Memory", 0xfffdc024, 4, base=16, bitRange=0 +sfr = "EMAC_ISR.RCOMP", "Memory", 0xfffdc024, 4, base=16, bitRange=1 +sfr = "EMAC_ISR.RXUBR", "Memory", 0xfffdc024, 4, base=16, bitRange=2 +sfr = "EMAC_ISR.TXUBR", "Memory", 0xfffdc024, 4, base=16, bitRange=3 +sfr = "EMAC_ISR.TUNDR", "Memory", 0xfffdc024, 4, base=16, bitRange=4 +sfr = "EMAC_ISR.RLEX", "Memory", 0xfffdc024, 4, base=16, bitRange=5 +sfr = "EMAC_ISR.TXERR", "Memory", 0xfffdc024, 4, base=16, bitRange=6 +sfr = "EMAC_ISR.TCOMP", "Memory", 0xfffdc024, 4, base=16, bitRange=7 +sfr = "EMAC_ISR.LINK", "Memory", 0xfffdc024, 4, base=16, bitRange=9 +sfr = "EMAC_ISR.ROVR", "Memory", 0xfffdc024, 4, base=16, bitRange=10 +sfr = "EMAC_ISR.HRESP", "Memory", 0xfffdc024, 4, base=16, bitRange=11 +sfr = "EMAC_ISR.PFRE", "Memory", 0xfffdc024, 4, base=16, bitRange=12 +sfr = "EMAC_ISR.PTZ", "Memory", 0xfffdc024, 4, base=16, bitRange=13 +sfr = "EMAC_IER", "Memory", 0xfffdc028, 4, base=16 +sfr = "EMAC_IER.MFD", "Memory", 0xfffdc028, 4, base=16, bitRange=0 +sfr = "EMAC_IER.RCOMP", "Memory", 0xfffdc028, 4, base=16, bitRange=1 +sfr = "EMAC_IER.RXUBR", "Memory", 0xfffdc028, 4, base=16, bitRange=2 +sfr = "EMAC_IER.TXUBR", "Memory", 0xfffdc028, 4, base=16, bitRange=3 +sfr = "EMAC_IER.TUNDR", "Memory", 0xfffdc028, 4, base=16, bitRange=4 +sfr = "EMAC_IER.RLEX", "Memory", 0xfffdc028, 4, base=16, bitRange=5 +sfr = "EMAC_IER.TXERR", "Memory", 0xfffdc028, 4, base=16, bitRange=6 +sfr = "EMAC_IER.TCOMP", "Memory", 0xfffdc028, 4, base=16, bitRange=7 +sfr = "EMAC_IER.LINK", "Memory", 0xfffdc028, 4, base=16, bitRange=9 +sfr = "EMAC_IER.ROVR", "Memory", 0xfffdc028, 4, base=16, bitRange=10 +sfr = "EMAC_IER.HRESP", "Memory", 0xfffdc028, 4, base=16, bitRange=11 +sfr = "EMAC_IER.PFRE", "Memory", 0xfffdc028, 4, base=16, bitRange=12 +sfr = "EMAC_IER.PTZ", "Memory", 0xfffdc028, 4, base=16, bitRange=13 +sfr = "EMAC_IDR", "Memory", 0xfffdc02c, 4, base=16 +sfr = "EMAC_IDR.MFD", "Memory", 0xfffdc02c, 4, base=16, bitRange=0 +sfr = "EMAC_IDR.RCOMP", "Memory", 0xfffdc02c, 4, base=16, bitRange=1 +sfr = "EMAC_IDR.RXUBR", "Memory", 0xfffdc02c, 4, base=16, bitRange=2 +sfr = "EMAC_IDR.TXUBR", "Memory", 0xfffdc02c, 4, base=16, bitRange=3 +sfr = "EMAC_IDR.TUNDR", "Memory", 0xfffdc02c, 4, base=16, bitRange=4 +sfr = "EMAC_IDR.RLEX", "Memory", 0xfffdc02c, 4, base=16, bitRange=5 +sfr = "EMAC_IDR.TXERR", "Memory", 0xfffdc02c, 4, base=16, bitRange=6 +sfr = "EMAC_IDR.TCOMP", "Memory", 0xfffdc02c, 4, base=16, bitRange=7 +sfr = "EMAC_IDR.LINK", "Memory", 0xfffdc02c, 4, base=16, bitRange=9 +sfr = "EMAC_IDR.ROVR", "Memory", 0xfffdc02c, 4, base=16, bitRange=10 +sfr = "EMAC_IDR.HRESP", "Memory", 0xfffdc02c, 4, base=16, bitRange=11 +sfr = "EMAC_IDR.PFRE", "Memory", 0xfffdc02c, 4, base=16, bitRange=12 +sfr = "EMAC_IDR.PTZ", "Memory", 0xfffdc02c, 4, base=16, bitRange=13 +sfr = "EMAC_IMR", "Memory", 0xfffdc030, 4, base=16 +sfr = "EMAC_IMR.MFD", "Memory", 0xfffdc030, 4, base=16, bitRange=0 +sfr = "EMAC_IMR.RCOMP", "Memory", 0xfffdc030, 4, base=16, bitRange=1 +sfr = "EMAC_IMR.RXUBR", "Memory", 0xfffdc030, 4, base=16, bitRange=2 +sfr = "EMAC_IMR.TXUBR", "Memory", 0xfffdc030, 4, base=16, bitRange=3 +sfr = "EMAC_IMR.TUNDR", "Memory", 0xfffdc030, 4, base=16, bitRange=4 +sfr = "EMAC_IMR.RLEX", "Memory", 0xfffdc030, 4, base=16, bitRange=5 +sfr = "EMAC_IMR.TXERR", "Memory", 0xfffdc030, 4, base=16, bitRange=6 +sfr = "EMAC_IMR.TCOMP", "Memory", 0xfffdc030, 4, base=16, bitRange=7 +sfr = "EMAC_IMR.LINK", "Memory", 0xfffdc030, 4, base=16, bitRange=9 +sfr = "EMAC_IMR.ROVR", "Memory", 0xfffdc030, 4, base=16, bitRange=10 +sfr = "EMAC_IMR.HRESP", "Memory", 0xfffdc030, 4, base=16, bitRange=11 +sfr = "EMAC_IMR.PFRE", "Memory", 0xfffdc030, 4, base=16, bitRange=12 +sfr = "EMAC_IMR.PTZ", "Memory", 0xfffdc030, 4, base=16, bitRange=13 +sfr = "EMAC_MAN", "Memory", 0xfffdc034, 4, base=16 +sfr = "EMAC_MAN.DATA", "Memory", 0xfffdc034, 4, base=16, bitRange=0-15 +sfr = "EMAC_MAN.CODE", "Memory", 0xfffdc034, 4, base=16, bitRange=16-17 +sfr = "EMAC_MAN.REGA", "Memory", 0xfffdc034, 4, base=16, bitRange=18-22 +sfr = "EMAC_MAN.PHYA", "Memory", 0xfffdc034, 4, base=16, bitRange=23-27 +sfr = "EMAC_MAN.RW", "Memory", 0xfffdc034, 4, base=16, bitRange=28-29 +sfr = "EMAC_MAN.SOF", "Memory", 0xfffdc034, 4, base=16, bitRange=30-31 +sfr = "EMAC_PTR", "Memory", 0xfffdc038, 4, base=16 +sfr = "EMAC_PFR", "Memory", 0xfffdc03c, 4, base=16 +sfr = "EMAC_FTO", "Memory", 0xfffdc040, 4, base=16 +sfr = "EMAC_SCF", "Memory", 0xfffdc044, 4, base=16 +sfr = "EMAC_MCF", "Memory", 0xfffdc048, 4, base=16 +sfr = "EMAC_FRO", "Memory", 0xfffdc04c, 4, base=16 +sfr = "EMAC_FCSE", "Memory", 0xfffdc050, 4, base=16 +sfr = "EMAC_ALE", "Memory", 0xfffdc054, 4, base=16 +sfr = "EMAC_DTF", "Memory", 0xfffdc058, 4, base=16 +sfr = "EMAC_LCOL", "Memory", 0xfffdc05c, 4, base=16 +sfr = "EMAC_ECOL", "Memory", 0xfffdc060, 4, base=16 +sfr = "EMAC_TUND", "Memory", 0xfffdc064, 4, base=16 +sfr = "EMAC_CSE", "Memory", 0xfffdc068, 4, base=16 +sfr = "EMAC_RRE", "Memory", 0xfffdc06c, 4, base=16 +sfr = "EMAC_ROV", "Memory", 0xfffdc070, 4, base=16 +sfr = "EMAC_RSE", "Memory", 0xfffdc074, 4, base=16 +sfr = "EMAC_ELE", "Memory", 0xfffdc078, 4, base=16 +sfr = "EMAC_RJA", "Memory", 0xfffdc07c, 4, base=16 +sfr = "EMAC_USF", "Memory", 0xfffdc080, 4, base=16 +sfr = "EMAC_STE", "Memory", 0xfffdc084, 4, base=16 +sfr = "EMAC_RLE", "Memory", 0xfffdc088, 4, base=16 +sfr = "EMAC_TPF", "Memory", 0xfffdc08c, 4, base=16 +sfr = "EMAC_HRB", "Memory", 0xfffdc090, 4, base=16 +sfr = "EMAC_HRT", "Memory", 0xfffdc094, 4, base=16 +sfr = "EMAC_SA1L", "Memory", 0xfffdc098, 4, base=16 +sfr = "EMAC_SA1H", "Memory", 0xfffdc09c, 4, base=16 +sfr = "EMAC_SA2L", "Memory", 0xfffdc0a0, 4, base=16 +sfr = "EMAC_SA2H", "Memory", 0xfffdc0a4, 4, base=16 +sfr = "EMAC_SA3L", "Memory", 0xfffdc0a8, 4, base=16 +sfr = "EMAC_SA3H", "Memory", 0xfffdc0ac, 4, base=16 +sfr = "EMAC_SA4L", "Memory", 0xfffdc0b0, 4, base=16 +sfr = "EMAC_SA4H", "Memory", 0xfffdc0b4, 4, base=16 +sfr = "EMAC_TID", "Memory", 0xfffdc0b8, 4, base=16 +sfr = "EMAC_TPQ", "Memory", 0xfffdc0bc, 4, base=16 +sfr = "EMAC_USRIO", "Memory", 0xfffdc0c0, 4, base=16 +sfr = "EMAC_USRIO.RMII", "Memory", 0xfffdc0c0, 4, base=16, bitRange=0 +sfr = "EMAC_USRIO.CLKEN", "Memory", 0xfffdc0c0, 4, base=16, bitRange=1 +sfr = "EMAC_WOL", "Memory", 0xfffdc0c4, 4, base=16 +sfr = "EMAC_WOL.IP", "Memory", 0xfffdc0c4, 4, base=16, bitRange=0-15 +sfr = "EMAC_WOL.MAG", "Memory", 0xfffdc0c4, 4, base=16, bitRange=16 +sfr = "EMAC_WOL.ARP", "Memory", 0xfffdc0c4, 4, base=16, bitRange=17 +sfr = "EMAC_WOL.SA1", "Memory", 0xfffdc0c4, 4, base=16, bitRange=18 +sfr = "EMAC_WOL.MTI", "Memory", 0xfffdc0c4, 4, base=16, bitRange=19 +sfr = "EMAC_REV", "Memory", 0xfffdc0fc, 4, base=16 +sfr = "EMAC_REV.REVREF", "Memory", 0xfffdc0fc, 4, base=16, bitRange=0-15 +sfr = "EMAC_REV.PARTREF", "Memory", 0xfffdc0fc, 4, base=16, bitRange=16-31 +; ========== Register definition for PDC_ADC peripheral ========== +sfr = "ADC_RPR", "Memory", 0xfffd8100, 4, base=16 +sfr = "ADC_RCR", "Memory", 0xfffd8104, 4, base=16 +sfr = "ADC_TPR", "Memory", 0xfffd8108, 4, base=16 +sfr = "ADC_TCR", "Memory", 0xfffd810c, 4, base=16 +sfr = "ADC_RNPR", "Memory", 0xfffd8110, 4, base=16 +sfr = "ADC_RNCR", "Memory", 0xfffd8114, 4, base=16 +sfr = "ADC_TNPR", "Memory", 0xfffd8118, 4, base=16 +sfr = "ADC_TNCR", "Memory", 0xfffd811c, 4, base=16 +sfr = "ADC_PTCR", "Memory", 0xfffd8120, 4, base=16 +sfr = "ADC_PTCR.RXTEN", "Memory", 0xfffd8120, 4, base=16, bitRange=0 +sfr = "ADC_PTCR.RXTDIS", "Memory", 0xfffd8120, 4, base=16, bitRange=1 +sfr = "ADC_PTCR.TXTEN", "Memory", 0xfffd8120, 4, base=16, bitRange=8 +sfr = "ADC_PTCR.TXTDIS", "Memory", 0xfffd8120, 4, base=16, bitRange=9 +sfr = "ADC_PTSR", "Memory", 0xfffd8124, 4, base=16 +sfr = "ADC_PTSR.RXTEN", "Memory", 0xfffd8124, 4, base=16, bitRange=0 +sfr = "ADC_PTSR.TXTEN", "Memory", 0xfffd8124, 4, base=16, bitRange=8 +; ========== Register definition for ADC peripheral ========== +sfr = "ADC_CR", "Memory", 0xfffd8000, 4, base=16 +sfr = "ADC_CR.SWRST", "Memory", 0xfffd8000, 4, base=16, bitRange=0 +sfr = "ADC_CR.START", "Memory", 0xfffd8000, 4, base=16, bitRange=1 +sfr = "ADC_MR", "Memory", 0xfffd8004, 4, base=16 +sfr = "ADC_MR.TRGEN", "Memory", 0xfffd8004, 4, base=16, bitRange=0 +sfr = "ADC_MR.TRGSEL", "Memory", 0xfffd8004, 4, base=16, bitRange=1-3 +sfr = "ADC_MR.LOWRES", "Memory", 0xfffd8004, 4, base=16, bitRange=4 +sfr = "ADC_MR.SLEEP", "Memory", 0xfffd8004, 4, base=16, bitRange=5 +sfr = "ADC_MR.PRESCAL", "Memory", 0xfffd8004, 4, base=16, bitRange=8-13 +sfr = "ADC_MR.STARTUP", "Memory", 0xfffd8004, 4, base=16, bitRange=16-20 +sfr = "ADC_MR.SHTIM", "Memory", 0xfffd8004, 4, base=16, bitRange=24-27 +sfr = "ADC_CHER", "Memory", 0xfffd8010, 4, base=16 +sfr = "ADC_CHER.CH0", "Memory", 0xfffd8010, 4, base=16, bitRange=0 +sfr = "ADC_CHER.CH1", "Memory", 0xfffd8010, 4, base=16, bitRange=1 +sfr = "ADC_CHER.CH2", "Memory", 0xfffd8010, 4, base=16, bitRange=2 +sfr = "ADC_CHER.CH3", "Memory", 0xfffd8010, 4, base=16, bitRange=3 +sfr = "ADC_CHER.CH4", "Memory", 0xfffd8010, 4, base=16, bitRange=4 +sfr = "ADC_CHER.CH5", "Memory", 0xfffd8010, 4, base=16, bitRange=5 +sfr = "ADC_CHER.CH6", "Memory", 0xfffd8010, 4, base=16, bitRange=6 +sfr = "ADC_CHER.CH7", "Memory", 0xfffd8010, 4, base=16, bitRange=7 +sfr = "ADC_CHDR", "Memory", 0xfffd8014, 4, base=16 +sfr = "ADC_CHDR.CH0", "Memory", 0xfffd8014, 4, base=16, bitRange=0 +sfr = "ADC_CHDR.CH1", "Memory", 0xfffd8014, 4, base=16, bitRange=1 +sfr = "ADC_CHDR.CH2", "Memory", 0xfffd8014, 4, base=16, bitRange=2 +sfr = "ADC_CHDR.CH3", "Memory", 0xfffd8014, 4, base=16, bitRange=3 +sfr = "ADC_CHDR.CH4", "Memory", 0xfffd8014, 4, base=16, bitRange=4 +sfr = "ADC_CHDR.CH5", "Memory", 0xfffd8014, 4, base=16, bitRange=5 +sfr = "ADC_CHDR.CH6", "Memory", 0xfffd8014, 4, base=16, bitRange=6 +sfr = "ADC_CHDR.CH7", "Memory", 0xfffd8014, 4, base=16, bitRange=7 +sfr = "ADC_CHSR", "Memory", 0xfffd8018, 4, base=16 +sfr = "ADC_CHSR.CH0", "Memory", 0xfffd8018, 4, base=16, bitRange=0 +sfr = "ADC_CHSR.CH1", "Memory", 0xfffd8018, 4, base=16, bitRange=1 +sfr = "ADC_CHSR.CH2", "Memory", 0xfffd8018, 4, base=16, bitRange=2 +sfr = "ADC_CHSR.CH3", "Memory", 0xfffd8018, 4, base=16, bitRange=3 +sfr = "ADC_CHSR.CH4", "Memory", 0xfffd8018, 4, base=16, bitRange=4 +sfr = "ADC_CHSR.CH5", "Memory", 0xfffd8018, 4, base=16, bitRange=5 +sfr = "ADC_CHSR.CH6", "Memory", 0xfffd8018, 4, base=16, bitRange=6 +sfr = "ADC_CHSR.CH7", "Memory", 0xfffd8018, 4, base=16, bitRange=7 +sfr = "ADC_SR", "Memory", 0xfffd801c, 4, base=16 +sfr = "ADC_SR.EOC0", "Memory", 0xfffd801c, 4, base=16, bitRange=0 +sfr = "ADC_SR.EOC1", "Memory", 0xfffd801c, 4, base=16, bitRange=1 +sfr = "ADC_SR.EOC2", "Memory", 0xfffd801c, 4, base=16, bitRange=2 +sfr = "ADC_SR.EOC3", "Memory", 0xfffd801c, 4, base=16, bitRange=3 +sfr = "ADC_SR.EOC4", "Memory", 0xfffd801c, 4, base=16, bitRange=4 +sfr = "ADC_SR.EOC5", "Memory", 0xfffd801c, 4, base=16, bitRange=5 +sfr = "ADC_SR.EOC6", "Memory", 0xfffd801c, 4, base=16, bitRange=6 +sfr = "ADC_SR.EOC7", "Memory", 0xfffd801c, 4, base=16, bitRange=7 +sfr = "ADC_SR.OVRE0", "Memory", 0xfffd801c, 4, base=16, bitRange=8 +sfr = "ADC_SR.OVRE1", "Memory", 0xfffd801c, 4, base=16, bitRange=9 +sfr = "ADC_SR.OVRE2", "Memory", 0xfffd801c, 4, base=16, bitRange=10 +sfr = "ADC_SR.OVRE3", "Memory", 0xfffd801c, 4, base=16, bitRange=11 +sfr = "ADC_SR.OVRE4", "Memory", 0xfffd801c, 4, base=16, bitRange=12 +sfr = "ADC_SR.OVRE5", "Memory", 0xfffd801c, 4, base=16, bitRange=13 +sfr = "ADC_SR.OVRE6", "Memory", 0xfffd801c, 4, base=16, bitRange=14 +sfr = "ADC_SR.OVRE7", "Memory", 0xfffd801c, 4, base=16, bitRange=15 +sfr = "ADC_SR.DRDY", "Memory", 0xfffd801c, 4, base=16, bitRange=16 +sfr = "ADC_SR.GOVRE", "Memory", 0xfffd801c, 4, base=16, bitRange=17 +sfr = "ADC_SR.ENDRX", "Memory", 0xfffd801c, 4, base=16, bitRange=18 +sfr = "ADC_SR.RXBUFF", "Memory", 0xfffd801c, 4, base=16, bitRange=19 +sfr = "ADC_LCDR", "Memory", 0xfffd8020, 4, base=16 +sfr = "ADC_LCDR.LDATA", "Memory", 0xfffd8020, 4, base=16, bitRange=0-9 +sfr = "ADC_IER", "Memory", 0xfffd8024, 4, base=16 +sfr = "ADC_IER.EOC0", "Memory", 0xfffd8024, 4, base=16, bitRange=0 +sfr = "ADC_IER.EOC1", "Memory", 0xfffd8024, 4, base=16, bitRange=1 +sfr = "ADC_IER.EOC2", "Memory", 0xfffd8024, 4, base=16, bitRange=2 +sfr = "ADC_IER.EOC3", "Memory", 0xfffd8024, 4, base=16, bitRange=3 +sfr = "ADC_IER.EOC4", "Memory", 0xfffd8024, 4, base=16, bitRange=4 +sfr = "ADC_IER.EOC5", "Memory", 0xfffd8024, 4, base=16, bitRange=5 +sfr = "ADC_IER.EOC6", "Memory", 0xfffd8024, 4, base=16, bitRange=6 +sfr = "ADC_IER.EOC7", "Memory", 0xfffd8024, 4, base=16, bitRange=7 +sfr = "ADC_IER.OVRE0", "Memory", 0xfffd8024, 4, base=16, bitRange=8 +sfr = "ADC_IER.OVRE1", "Memory", 0xfffd8024, 4, base=16, bitRange=9 +sfr = "ADC_IER.OVRE2", "Memory", 0xfffd8024, 4, base=16, bitRange=10 +sfr = "ADC_IER.OVRE3", "Memory", 0xfffd8024, 4, base=16, bitRange=11 +sfr = "ADC_IER.OVRE4", "Memory", 0xfffd8024, 4, base=16, bitRange=12 +sfr = "ADC_IER.OVRE5", "Memory", 0xfffd8024, 4, base=16, bitRange=13 +sfr = "ADC_IER.OVRE6", "Memory", 0xfffd8024, 4, base=16, bitRange=14 +sfr = "ADC_IER.OVRE7", "Memory", 0xfffd8024, 4, base=16, bitRange=15 +sfr = "ADC_IER.DRDY", "Memory", 0xfffd8024, 4, base=16, bitRange=16 +sfr = "ADC_IER.GOVRE", "Memory", 0xfffd8024, 4, base=16, bitRange=17 +sfr = "ADC_IER.ENDRX", "Memory", 0xfffd8024, 4, base=16, bitRange=18 +sfr = "ADC_IER.RXBUFF", "Memory", 0xfffd8024, 4, base=16, bitRange=19 +sfr = "ADC_IDR", "Memory", 0xfffd8028, 4, base=16 +sfr = "ADC_IDR.EOC0", "Memory", 0xfffd8028, 4, base=16, bitRange=0 +sfr = "ADC_IDR.EOC1", "Memory", 0xfffd8028, 4, base=16, bitRange=1 +sfr = "ADC_IDR.EOC2", "Memory", 0xfffd8028, 4, base=16, bitRange=2 +sfr = "ADC_IDR.EOC3", "Memory", 0xfffd8028, 4, base=16, bitRange=3 +sfr = "ADC_IDR.EOC4", "Memory", 0xfffd8028, 4, base=16, bitRange=4 +sfr = "ADC_IDR.EOC5", "Memory", 0xfffd8028, 4, base=16, bitRange=5 +sfr = "ADC_IDR.EOC6", "Memory", 0xfffd8028, 4, base=16, bitRange=6 +sfr = "ADC_IDR.EOC7", "Memory", 0xfffd8028, 4, base=16, bitRange=7 +sfr = "ADC_IDR.OVRE0", "Memory", 0xfffd8028, 4, base=16, bitRange=8 +sfr = "ADC_IDR.OVRE1", "Memory", 0xfffd8028, 4, base=16, bitRange=9 +sfr = "ADC_IDR.OVRE2", "Memory", 0xfffd8028, 4, base=16, bitRange=10 +sfr = "ADC_IDR.OVRE3", "Memory", 0xfffd8028, 4, base=16, bitRange=11 +sfr = "ADC_IDR.OVRE4", "Memory", 0xfffd8028, 4, base=16, bitRange=12 +sfr = "ADC_IDR.OVRE5", "Memory", 0xfffd8028, 4, base=16, bitRange=13 +sfr = "ADC_IDR.OVRE6", "Memory", 0xfffd8028, 4, base=16, bitRange=14 +sfr = "ADC_IDR.OVRE7", "Memory", 0xfffd8028, 4, base=16, bitRange=15 +sfr = "ADC_IDR.DRDY", "Memory", 0xfffd8028, 4, base=16, bitRange=16 +sfr = "ADC_IDR.GOVRE", "Memory", 0xfffd8028, 4, base=16, bitRange=17 +sfr = "ADC_IDR.ENDRX", "Memory", 0xfffd8028, 4, base=16, bitRange=18 +sfr = "ADC_IDR.RXBUFF", "Memory", 0xfffd8028, 4, base=16, bitRange=19 +sfr = "ADC_IMR", "Memory", 0xfffd802c, 4, base=16 +sfr = "ADC_IMR.EOC0", "Memory", 0xfffd802c, 4, base=16, bitRange=0 +sfr = "ADC_IMR.EOC1", "Memory", 0xfffd802c, 4, base=16, bitRange=1 +sfr = "ADC_IMR.EOC2", "Memory", 0xfffd802c, 4, base=16, bitRange=2 +sfr = "ADC_IMR.EOC3", "Memory", 0xfffd802c, 4, base=16, bitRange=3 +sfr = "ADC_IMR.EOC4", "Memory", 0xfffd802c, 4, base=16, bitRange=4 +sfr = "ADC_IMR.EOC5", "Memory", 0xfffd802c, 4, base=16, bitRange=5 +sfr = "ADC_IMR.EOC6", "Memory", 0xfffd802c, 4, base=16, bitRange=6 +sfr = "ADC_IMR.EOC7", "Memory", 0xfffd802c, 4, base=16, bitRange=7 +sfr = "ADC_IMR.OVRE0", "Memory", 0xfffd802c, 4, base=16, bitRange=8 +sfr = "ADC_IMR.OVRE1", "Memory", 0xfffd802c, 4, base=16, bitRange=9 +sfr = "ADC_IMR.OVRE2", "Memory", 0xfffd802c, 4, base=16, bitRange=10 +sfr = "ADC_IMR.OVRE3", "Memory", 0xfffd802c, 4, base=16, bitRange=11 +sfr = "ADC_IMR.OVRE4", "Memory", 0xfffd802c, 4, base=16, bitRange=12 +sfr = "ADC_IMR.OVRE5", "Memory", 0xfffd802c, 4, base=16, bitRange=13 +sfr = "ADC_IMR.OVRE6", "Memory", 0xfffd802c, 4, base=16, bitRange=14 +sfr = "ADC_IMR.OVRE7", "Memory", 0xfffd802c, 4, base=16, bitRange=15 +sfr = "ADC_IMR.DRDY", "Memory", 0xfffd802c, 4, base=16, bitRange=16 +sfr = "ADC_IMR.GOVRE", "Memory", 0xfffd802c, 4, base=16, bitRange=17 +sfr = "ADC_IMR.ENDRX", "Memory", 0xfffd802c, 4, base=16, bitRange=18 +sfr = "ADC_IMR.RXBUFF", "Memory", 0xfffd802c, 4, base=16, bitRange=19 +sfr = "ADC_CDR0", "Memory", 0xfffd8030, 4, base=16 +sfr = "ADC_CDR0.DATA", "Memory", 0xfffd8030, 4, base=16, bitRange=0-9 +sfr = "ADC_CDR1", "Memory", 0xfffd8034, 4, base=16 +sfr = "ADC_CDR1.DATA", "Memory", 0xfffd8034, 4, base=16, bitRange=0-9 +sfr = "ADC_CDR2", "Memory", 0xfffd8038, 4, base=16 +sfr = "ADC_CDR2.DATA", "Memory", 0xfffd8038, 4, base=16, bitRange=0-9 +sfr = "ADC_CDR3", "Memory", 0xfffd803c, 4, base=16 +sfr = "ADC_CDR3.DATA", "Memory", 0xfffd803c, 4, base=16, bitRange=0-9 +sfr = "ADC_CDR4", "Memory", 0xfffd8040, 4, base=16 +sfr = "ADC_CDR4.DATA", "Memory", 0xfffd8040, 4, base=16, bitRange=0-9 +sfr = "ADC_CDR5", "Memory", 0xfffd8044, 4, base=16 +sfr = "ADC_CDR5.DATA", "Memory", 0xfffd8044, 4, base=16, bitRange=0-9 +sfr = "ADC_CDR6", "Memory", 0xfffd8048, 4, base=16 +sfr = "ADC_CDR6.DATA", "Memory", 0xfffd8048, 4, base=16, bitRange=0-9 +sfr = "ADC_CDR7", "Memory", 0xfffd804c, 4, base=16 +sfr = "ADC_CDR7.DATA", "Memory", 0xfffd804c, 4, base=16, bitRange=0-9 + + +[SfrGroupInfo] +group = "TC0", "TC0_CCR", "TC0_CMR", "TC0_CV", "TC0_RA", "TC0_RB", "TC0_RC", "TC0_SR", "TC0_IER", "TC0_IDR", "TC0_IMR" +group = "TCB", "TCB_BCR", "TCB_BMR" +group = "TC1", "TC1_CCR", "TC1_CMR", "TC1_CV", "TC1_RA", "TC1_RB", "TC1_RC", "TC1_SR", "TC1_IER", "TC1_IDR", "TC1_IMR" +group = "TC2", "TC2_CCR", "TC2_CMR", "TC2_CV", "TC2_RA", "TC2_RB", "TC2_RC", "TC2_SR", "TC2_IER", "TC2_IDR", "TC2_IMR" +group = "UDP", "UDP_NUM", "UDP_GLBSTATE", "UDP_FADDR", "UDP_IER", "UDP_IDR", "UDP_IMR", "UDP_ISR", "UDP_ICR", "UDP_RSTEP", "UDP_CSR", "UDP_FDR", "UDP_TXVC" +group = "TWI", "TWI_CR", "TWI_MMR", "TWI_IADR", "TWI_CWGR", "TWI_SR", "TWI_IER", "TWI_IDR", "TWI_IMR", "TWI_RHR", "TWI_THR" +group = "US0", "US0_CR", "US0_MR", "US0_IER", "US0_IDR", "US0_IMR", "US0_CSR", "US0_RHR", "US0_THR", "US0_BRGR", "US0_RTOR", "US0_TTGR", "US0_FIDI", "US0_NER", "US0_IF" +group = "PDC_US0", "US0_RPR", "US0_RCR", "US0_TPR", "US0_TCR", "US0_RNPR", "US0_RNCR", "US0_TNPR", "US0_TNCR", "US0_PTCR", "US0_PTSR" +group = "US1", "US1_CR", "US1_MR", "US1_IER", "US1_IDR", "US1_IMR", "US1_CSR", "US1_RHR", "US1_THR", "US1_BRGR", "US1_RTOR", "US1_TTGR", "US1_FIDI", "US1_NER", "US1_IF" +group = "PDC_US1", "US1_RPR", "US1_RCR", "US1_TPR", "US1_TCR", "US1_RNPR", "US1_RNCR", "US1_TNPR", "US1_TNCR", "US1_PTCR", "US1_PTSR" +group = "PWMC", "PWMC_MR", "PWMC_ENA", "PWMC_DIS", "PWMC_SR", "PWMC_IER", "PWMC_IDR", "PWMC_IMR", "PWMC_ISR", "PWMC_VR" +group = "PWMC_CH0", "PWMC_CH0_CMR", "PWMC_CH0_CDTYR", "PWMC_CH0_CPRDR", "PWMC_CH0_CCNTR", "PWMC_CH0_CUPDR", "PWMC_CH0_Reserved" +group = "PWMC_CH1", "PWMC_CH1_CMR", "PWMC_CH1_CDTYR", "PWMC_CH1_CPRDR", "PWMC_CH1_CCNTR", "PWMC_CH1_CUPDR", "PWMC_CH1_Reserved" +group = "PWMC_CH2", "PWMC_CH2_CMR", "PWMC_CH2_CDTYR", "PWMC_CH2_CPRDR", "PWMC_CH2_CCNTR", "PWMC_CH2_CUPDR", "PWMC_CH2_Reserved" +group = "PWMC_CH3", "PWMC_CH3_CMR", "PWMC_CH3_CDTYR", "PWMC_CH3_CPRDR", "PWMC_CH3_CCNTR", "PWMC_CH3_CUPDR", "PWMC_CH3_Reserved" +group = "CAN", "CAN_MR", "CAN_IER", "CAN_IDR", "CAN_IMR", "CAN_SR", "CAN_BR", "CAN_TIM", "CAN_TIMESTP", "CAN_ECR", "CAN_TCR", "CAN_ACR", "CAN_VR" +group = "CAN_MB0", "CAN_MB0_MMR", "CAN_MB0_MAM", "CAN_MB0_MID", "CAN_MB0_MFID", "CAN_MB0_MSR", "CAN_MB0_MDL", "CAN_MB0_MDH", "CAN_MB0_MCR" +group = "CAN_MB1", "CAN_MB1_MMR", "CAN_MB1_MAM", "CAN_MB1_MID", "CAN_MB1_MFID", "CAN_MB1_MSR", "CAN_MB1_MDL", "CAN_MB1_MDH", "CAN_MB1_MCR" +group = "CAN_MB2", "CAN_MB2_MMR", "CAN_MB2_MAM", "CAN_MB2_MID", "CAN_MB2_MFID", "CAN_MB2_MSR", "CAN_MB2_MDL", "CAN_MB2_MDH", "CAN_MB2_MCR" +group = "CAN_MB3", "CAN_MB3_MMR", "CAN_MB3_MAM", "CAN_MB3_MID", "CAN_MB3_MFID", "CAN_MB3_MSR", "CAN_MB3_MDL", "CAN_MB3_MDH", "CAN_MB3_MCR" +group = "CAN_MB4", "CAN_MB4_MMR", "CAN_MB4_MAM", "CAN_MB4_MID", "CAN_MB4_MFID", "CAN_MB4_MSR", "CAN_MB4_MDL", "CAN_MB4_MDH", "CAN_MB4_MCR" +group = "CAN_MB5", "CAN_MB5_MMR", "CAN_MB5_MAM", "CAN_MB5_MID", "CAN_MB5_MFID", "CAN_MB5_MSR", "CAN_MB5_MDL", "CAN_MB5_MDH", "CAN_MB5_MCR" +group = "CAN_MB6", "CAN_MB6_MMR", "CAN_MB6_MAM", "CAN_MB6_MID", "CAN_MB6_MFID", "CAN_MB6_MSR", "CAN_MB6_MDL", "CAN_MB6_MDH", "CAN_MB6_MCR" +group = "CAN_MB7", "CAN_MB7_MMR", "CAN_MB7_MAM", "CAN_MB7_MID", "CAN_MB7_MFID", "CAN_MB7_MSR", "CAN_MB7_MDL", "CAN_MB7_MDH", "CAN_MB7_MCR" +group = "SSC", "SSC_CR", "SSC_CMR", "SSC_RCMR", "SSC_RFMR", "SSC_TCMR", "SSC_TFMR", "SSC_RHR", "SSC_THR", "SSC_RSHR", "SSC_TSHR", "SSC_SR", "SSC_IER", "SSC_IDR", "SSC_IMR" +group = "PDC_SSC", "SSC_RPR", "SSC_RCR", "SSC_TPR", "SSC_TCR", "SSC_RNPR", "SSC_RNCR", "SSC_TNPR", "SSC_TNCR", "SSC_PTCR", "SSC_PTSR" +group = "ADC", "ADC_CR", "ADC_MR", "ADC_CHER", "ADC_CHDR", "ADC_CHSR", "ADC_SR", "ADC_LCDR", "ADC_IER", "ADC_IDR", "ADC_IMR", "ADC_CDR0", "ADC_CDR1", "ADC_CDR2", "ADC_CDR3", "ADC_CDR4", "ADC_CDR5", "ADC_CDR6", "ADC_CDR7" +group = "PDC_ADC", "ADC_RPR", "ADC_RCR", "ADC_TPR", "ADC_TCR", "ADC_RNPR", "ADC_RNCR", "ADC_TNPR", "ADC_TNCR", "ADC_PTCR", "ADC_PTSR" +group = "EMAC", "EMAC_NCR", "EMAC_NCFGR", "EMAC_NSR", "EMAC_TSR", "EMAC_RBQP", "EMAC_TBQP", "EMAC_RSR", "EMAC_ISR", "EMAC_IER", "EMAC_IDR", "EMAC_IMR", "EMAC_MAN", "EMAC_PTR", "EMAC_PFR", "EMAC_FTO", "EMAC_SCF", "EMAC_MCF", "EMAC_FRO", "EMAC_FCSE", "EMAC_ALE", "EMAC_DTF", "EMAC_LCOL", "EMAC_ECOL", "EMAC_TUND", "EMAC_CSE", "EMAC_RRE", "EMAC_ROV", "EMAC_RSE", "EMAC_ELE", "EMAC_RJA", "EMAC_USF", "EMAC_STE", "EMAC_RLE", "EMAC_TPF", "EMAC_HRB", "EMAC_HRT", "EMAC_SA1L", "EMAC_SA1H", "EMAC_SA2L", "EMAC_SA2H", "EMAC_SA3L", "EMAC_SA3H", "EMAC_SA4L", "EMAC_SA4H", "EMAC_TID", "EMAC_TPQ", "EMAC_USRIO", "EMAC_WOL", "EMAC_REV" +group = "SPI0", "SPI0_CR", "SPI0_MR", "SPI0_RDR", "SPI0_TDR", "SPI0_SR", "SPI0_IER", "SPI0_IDR", "SPI0_IMR", "SPI0_CSR" +group = "PDC_SPI0", "SPI0_RPR", "SPI0_RCR", "SPI0_TPR", "SPI0_TCR", "SPI0_RNPR", "SPI0_RNCR", "SPI0_TNPR", "SPI0_TNCR", "SPI0_PTCR", "SPI0_PTSR" +group = "SPI1", "SPI1_CR", "SPI1_MR", "SPI1_RDR", "SPI1_TDR", "SPI1_SR", "SPI1_IER", "SPI1_IDR", "SPI1_IMR", "SPI1_CSR" +group = "PDC_SPI1", "SPI1_RPR", "SPI1_RCR", "SPI1_TPR", "SPI1_TCR", "SPI1_RNPR", "SPI1_RNCR", "SPI1_TNPR", "SPI1_TNCR", "SPI1_PTCR", "SPI1_PTSR" +group = "SYS" +group = "AIC", "AIC_SMR", "AIC_SVR", "AIC_IVR", "AIC_FVR", "AIC_ISR", "AIC_IPR", "AIC_IMR", "AIC_CISR", "AIC_IECR", "AIC_IDCR", "AIC_ICCR", "AIC_ISCR", "AIC_EOICR", "AIC_SPU", "AIC_DCR", "AIC_FFER", "AIC_FFDR", "AIC_FFSR" +group = "DBGU", "DBGU_CR", "DBGU_MR", "DBGU_IER", "DBGU_IDR", "DBGU_IMR", "DBGU_CSR", "DBGU_RHR", "DBGU_THR", "DBGU_BRGR", "DBGU_CIDR", "DBGU_EXID", "DBGU_FNTR" +group = "PDC_DBGU", "DBGU_RPR", "DBGU_RCR", "DBGU_TPR", "DBGU_TCR", "DBGU_RNPR", "DBGU_RNCR", "DBGU_TNPR", "DBGU_TNCR", "DBGU_PTCR", "DBGU_PTSR" +group = "PIOA", "PIOA_PER", "PIOA_PDR", "PIOA_PSR", "PIOA_OER", "PIOA_ODR", "PIOA_OSR", "PIOA_IFER", "PIOA_IFDR", "PIOA_IFSR", "PIOA_SODR", "PIOA_CODR", "PIOA_ODSR", "PIOA_PDSR", "PIOA_IER", "PIOA_IDR", "PIOA_IMR", "PIOA_ISR", "PIOA_MDER", "PIOA_MDDR", "PIOA_MDSR", "PIOA_PPUDR", "PIOA_PPUER", "PIOA_PPUSR", "PIOA_ASR", "PIOA_BSR", "PIOA_ABSR", "PIOA_OWER", "PIOA_OWDR", "PIOA_OWSR" +group = "PIOB", "PIOB_PER", "PIOB_PDR", "PIOB_PSR", "PIOB_OER", "PIOB_ODR", "PIOB_OSR", "PIOB_IFER", "PIOB_IFDR", "PIOB_IFSR", "PIOB_SODR", "PIOB_CODR", "PIOB_ODSR", "PIOB_PDSR", "PIOB_IER", "PIOB_IDR", "PIOB_IMR", "PIOB_ISR", "PIOB_MDER", "PIOB_MDDR", "PIOB_MDSR", "PIOB_PPUDR", "PIOB_PPUER", "PIOB_PPUSR", "PIOB_ASR", "PIOB_BSR", "PIOB_ABSR", "PIOB_OWER", "PIOB_OWDR", "PIOB_OWSR" +group = "PMC", "PMC_SCER", "PMC_SCDR", "PMC_SCSR", "PMC_PCER", "PMC_PCDR", "PMC_PCSR", "PMC_MOR", "PMC_MCFR", "PMC_PLLR", "PMC_MCKR", "PMC_PCKR", "PMC_IER", "PMC_IDR", "PMC_SR", "PMC_IMR" +group = "CKGR", "CKGR_MOR", "CKGR_MCFR", "CKGR_PLLR" +group = "RSTC", "RSTC_RCR", "RSTC_RSR", "RSTC_RMR" +group = "RTTC", "RTTC_RTMR", "RTTC_RTAR", "RTTC_RTVR", "RTTC_RTSR" +group = "PITC", "PITC_PIMR", "PITC_PISR", "PITC_PIVR", "PITC_PIIR" +group = "WDTC", "WDTC_WDCR", "WDTC_WDMR", "WDTC_WDSR" +group = "VREG", "VREG_MR" +group = "MC", "MC_RCR", "MC_ASR", "MC_AASR", "MC_FMR", "MC_FCR", "MC_FSR" diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/cmock_demo.dep b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/cmock_demo.dep new file mode 100644 index 0000000..ed68769 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/cmock_demo.dep @@ -0,0 +1,3691 @@ + + + + 2 + + Debug + + $PROJ_DIR$\Debug\Obj\Main.r79 + $PROJ_DIR$\Debug\Obj\IntrinsicsWrapper.r79 + $PROJ_DIR$\Debug\Obj\cmock_demo.pbd + $PROJ_DIR$\Debug\Obj\TimerInterruptConfigurator.r79 + $PROJ_DIR$\Debug\Obj\AdcConductor.r79 + $PROJ_DIR$\Debug\Obj\AdcModel.pbi + $PROJ_DIR$\Debug\Obj\Model.pbi + $PROJ_DIR$\Debug\Obj\AdcModel.r79 + $PROJ_DIR$\Debug\Obj\UsartModel.r79 + $PROJ_DIR$\Debug\Obj\TemperatureFilter.pbi + $PROJ_DIR$\Debug\List\AdcHardwareConfigurator.lst + $PROJ_DIR$\Debug\Obj\UsartConductor.pbi + $PROJ_DIR$\..\..\examples\src\Types.h + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.h + $TOOLKIT_DIR$\inc\DLib_Defaults.h + $PROJ_DIR$\..\..\examples\src\AT91SAM7X256.h + $PROJ_DIR$\..\..\examples\src\AdcConductor.h + $PROJ_DIR$\Debug\List\TimerInterruptHandler.lst + $PROJ_DIR$\..\..\examples\src\TaskScheduler.h + $PROJ_DIR$\..\..\examples\src\UsartConductor.h + $PROJ_DIR$\..\..\examples\src\Model.h + $TOOLKIT_DIR$\inc\intrinsics.h + $PROJ_DIR$\Debug\Obj\UsartHardware.pbi + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.h + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.h + $PROJ_DIR$\Debug\Exe\cmock_demo.d79 + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.h + $PROJ_DIR$\..\..\examples\src\AdcHardware.h + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.h + $PROJ_DIR$\..\..\examples\src\TimerConductor.h + $PROJ_DIR$\..\..\examples\src\UsartPutChar.h + $PROJ_DIR$\Debug\Obj\Executor.pbi + $PROJ_DIR$\..\..\examples\src\UsartModel.h + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.h + $PROJ_DIR$\Debug\List\UsartBaudRateRegisterCalculator.lst + $PROJ_DIR$\..\..\examples\src\UsartHardware.h + $PROJ_DIR$\Debug\List\UsartModel.lst + $PROJ_DIR$\Debug\List\Executor.lst + $PROJ_DIR$\Debug\List\UsartTransmitBufferStatus.lst + $PROJ_DIR$\Debug\Exe\cmock_demo.sim + $PROJ_DIR$\Debug\List\TimerModel.lst + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.h + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.h + $PROJ_DIR$\Debug\List\TimerHardware.lst + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.h + $PROJ_DIR$\Debug\Obj\UsartTransmitBufferStatus.r79 + $PROJ_DIR$\..\..\examples\src\TimerModel.h + $PROJ_DIR$\Debug\List\IntrinsicsWrapper.lst + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.h + $PROJ_DIR$\..\..\examples\src\TimerHardware.h + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.h + $PROJ_DIR$\Debug\List\Cstartup_SAM7.lst + $TOOLKIT_DIR$\inc\DLib_Product.h + $PROJ_DIR$\Debug\Obj\UsartModel.pbi + $TOOLKIT_DIR$\inc\math.h + $PROJ_DIR$\Debug\Obj\AdcHardware.r79 + $PROJ_DIR$\Debug\Obj\TimerModel.r79 + $TOOLKIT_DIR$\inc\stdio.h + $PROJ_DIR$\Debug\Obj\UsartConfigurator.pbi + $PROJ_DIR$\Debug\List\AdcModel.lst + $PROJ_DIR$\Debug\List\AdcConductor.lst + $PROJ_DIR$\Debug\List\UsartConductor.lst + $PROJ_DIR$\Debug\List\Model.lst + $PROJ_DIR$\Debug\List\TaskScheduler.lst + $PROJ_DIR$\Debug\List\UsartHardware.lst + $PROJ_DIR$\Debug\List\AdcHardware.lst + $PROJ_DIR$\Debug\List\Main.lst + $PROJ_DIR$\Debug\Obj\UsartBaudRateRegisterCalculator.r79 + $PROJ_DIR$\Debug\Obj\AdcConductor.pbi + $PROJ_DIR$\Debug\Obj\TaskScheduler.pbi + $PROJ_DIR$\Debug\List\UsartConfigurator.lst + $PROJ_DIR$\Debug\Obj\TaskScheduler.r79 + $TOOLKIT_DIR$\inc\ymath.h + $PROJ_DIR$\Debug\Obj\TemperatureFilter.r79 + $TOOLKIT_DIR$\inc\ysizet.h + $PROJ_DIR$\Debug\Obj\TimerHardware.pbi + $PROJ_DIR$\Debug\Obj\TemperatureCalculator.r79 + $PROJ_DIR$\Debug\Obj\AdcTemperatureSensor.pbi + $PROJ_DIR$\Debug\List\TemperatureCalculator.lst + $PROJ_DIR$\Debug\List\AdcTemperatureSensor.lst + $TOOLKIT_DIR$\lib\dl4tptinl8n.h + $PROJ_DIR$\Debug\Obj\AdcHardware.pbi + $PROJ_DIR$\Debug\Obj\UsartConfigurator.r79 + $TOOLKIT_DIR$\inc\xencoding_limits.h + $PROJ_DIR$\Debug\Obj\TimerConfigurator.r79 + $PROJ_DIR$\Debug\Obj\AdcTemperatureSensor.r79 + $PROJ_DIR$\Debug\Obj\Main.pbi + $TOOLKIT_DIR$\lib\dl4tptinl8n.r79 + $PROJ_DIR$\Debug\Obj\TimerInterruptHandler.r79 + $PROJ_DIR$\Debug\Obj\UsartHardware.r79 + $PROJ_DIR$\Debug\Obj\UsartPutChar.pbi + $PROJ_DIR$\Debug\Obj\TimerInterruptConfigurator.pbi + $TOOLKIT_DIR$\inc\yvals.h + $PROJ_DIR$\Debug\Obj\UsartTransmitBufferStatus.pbi + $PROJ_DIR$\Debug\Obj\IntrinsicsWrapper.pbi + $PROJ_DIR$\Debug\Obj\AdcHardwareConfigurator.r79 + $PROJ_DIR$\incIAR\AT91SAM7X256_inc.h + $TOOLKIT_DIR$\inc\DLib_Threads.h + $PROJ_DIR$\Debug\Obj\TimerConfigurator.pbi + $PROJ_DIR$\Debug\Obj\TimerConductor.pbi + $PROJ_DIR$\Debug\Obj\TimerInterruptHandler.pbi + $PROJ_DIR$\Debug\Obj\UsartPutChar.r79 + $PROJ_DIR$\Debug\Obj\UsartConductor.r79 + $PROJ_DIR$\Debug\Obj\TimerHardware.r79 + $PROJ_DIR$\Debug\Obj\Cstartup_SAM7.r79 + $PROJ_DIR$\Debug\List\cmock_demo.map + $PROJ_DIR$\Debug\List\TimerInterruptConfigurator.lst + $PROJ_DIR$\Debug\Obj\TimerConductor.r79 + $PROJ_DIR$\Debug\Obj\Model.r79 + $PROJ_DIR$\Debug\Obj\UsartBaudRateRegisterCalculator.pbi + $PROJ_DIR$\Debug\Obj\AdcHardwareConfigurator.pbi + $PROJ_DIR$\Debug\Obj\TemperatureCalculator.pbi + $PROJ_DIR$\Debug\Obj\Cstartup_SAM7.pbi + $PROJ_DIR$\Resource\at91SAM7X256_FLASH.xcl + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + $PROJ_DIR$\..\..\examples\src\TimerModel.c + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + $PROJ_DIR$\..\..\examples\src\UsartModel.c + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + $PROJ_DIR$\Cstartup.s79 + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + $PROJ_DIR$\Cstartup_SAM7.c + $PROJ_DIR$\..\..\examples\src\AdcModel.c + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + $PROJ_DIR$\..\..\examples\src\Executor.c + $PROJ_DIR$\..\..\examples\src\Main.c + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + $PROJ_DIR$\..\..\examples\src\Model.c + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + $PROJ_DIR$\Debug\Obj\Cstartup.r79 + $PROJ_DIR$\Debug\List\TimerConfigurator.lst + $PROJ_DIR$\..\..\examples\src\Executor.h + $PROJ_DIR$\Debug\List\TimerConductor.lst + $PROJ_DIR$\..\..\examples\src\AdcModel.h + $PROJ_DIR$\..\..\examples\src\ModelConfig.h + $PROJ_DIR$\Debug\Obj\Executor.r79 + $PROJ_DIR$\Debug\List\UsartPutChar.lst + $PROJ_DIR$\Debug\List\TemperatureFilter.lst + $PROJ_DIR$\Debug\Obj\TimerModel.pbi + $PROJ_DIR$\srcIAR\Cstartup.s79 + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + + + [ROOT_NODE] + + + XLINK + 25 105 39 + + + + + $PROJ_DIR$\Debug\Obj\cmock_demo.pbd + + + BILINK + 68 81 110 5 77 112 31 94 86 6 69 111 9 99 98 75 91 100 150 109 11 58 22 53 90 93 + + + + + $PROJ_DIR$\Debug\Exe\cmock_demo.d79 + + + XLINK + 105 39 + + + + + XLINK + 113 4 55 95 7 85 141 104 147 1 0 108 71 76 73 107 84 103 3 88 56 67 102 82 89 8 101 45 87 + + + + + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + + + ICCARM + 107 144 + + + BICOMP + 99 + + + + + ICCARM + 12 15 29 46 49 44 + + + BICOMP + 12 15 29 46 49 44 + + + + + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + + + ICCARM + 84 142 + + + BICOMP + 98 + + + + + ICCARM + 12 15 48 42 + + + BICOMP + 12 15 48 42 + + + + + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + + + ICCARM + 103 43 + + + BICOMP + 75 + + + + + ICCARM + 12 15 49 48 + + + BICOMP + 12 15 49 48 + + + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + + + ICCARM + 3 106 + + + BICOMP + 91 + + + + + ICCARM + 12 15 42 44 + + + BICOMP + 12 15 42 44 + + + + + $PROJ_DIR$\..\..\examples\src\TimerModel.c + + + ICCARM + 56 40 + + + BICOMP + 150 + + + + + ICCARM + 12 15 46 18 + + + BICOMP + 12 15 46 18 + + + + + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + + + ICCARM + 67 34 + + + BICOMP + 109 + + + + + ICCARM + 12 15 50 + + + BICOMP + 12 15 50 + + + + + $PROJ_DIR$\..\..\examples\src\UsartModel.c + + + ICCARM + 8 36 + + + BICOMP + 53 + + + + + ICCARM + 12 15 32 146 50 28 57 92 14 80 52 83 97 74 54 72 + + + BICOMP + 12 15 32 146 50 28 57 92 14 52 83 97 74 54 72 + + + + + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + + + ICCARM + 102 61 + + + BICOMP + 11 + + + + + ICCARM + 12 15 19 35 32 18 + + + BICOMP + 12 15 19 35 32 18 + + + + + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + + + ICCARM + 82 70 + + + BICOMP + 58 + + + + + ICCARM + 12 15 26 + + + BICOMP + 12 15 26 + + + + + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + + + ICCARM + 89 64 + + + BICOMP + 22 + + + + + ICCARM + 12 15 35 26 30 + + + BICOMP + 12 15 35 26 30 + + + + + $PROJ_DIR$\Cstartup.s79 + + + AARM + 141 + + + + + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + + + ICCARM + 101 148 + + + BICOMP + 90 + + + + + ICCARM + 12 15 30 41 + + + BICOMP + 12 15 30 41 + + + + + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + + + ICCARM + 45 38 + + + BICOMP + 93 + + + + + ICCARM + 12 15 41 + + + BICOMP + 12 15 41 + + + + + $PROJ_DIR$\Cstartup_SAM7.c + + + ICCARM + 104 51 + + + BICOMP + 112 + + + + + ICCARM + 15 + + + + + $PROJ_DIR$\..\..\examples\src\AdcModel.c + + + ICCARM + 7 59 + + + BICOMP + 5 + + + + + ICCARM + 12 15 145 18 23 28 + + + BICOMP + 12 15 145 18 23 28 + + + + + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + + + ICCARM + 85 79 + + + BICOMP + 77 + + + + + ICCARM + 12 15 24 + + + BICOMP + 12 15 24 + + + + + $PROJ_DIR$\..\..\examples\src\Executor.c + + + ICCARM + 147 37 + + + BICOMP + 31 + + + + + ICCARM + 12 15 143 20 19 29 16 33 + + + BICOMP + 12 15 143 20 19 29 16 33 + + + + + $PROJ_DIR$\..\..\examples\src\Main.c + + + ICCARM + 0 66 + + + BICOMP + 86 + + + + + ICCARM + 12 15 33 143 20 18 23 28 19 35 26 30 32 50 41 29 49 48 42 44 46 16 27 13 24 145 + + + BICOMP + 12 15 33 143 20 18 23 28 19 35 26 30 32 50 41 29 49 48 42 44 46 16 27 13 24 145 + + + + + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + + + ICCARM + 1 47 + + + BICOMP + 94 + + + + + ICCARM + 33 21 + + + BICOMP + 33 21 + + + + + $PROJ_DIR$\..\..\examples\src\Model.c + + + ICCARM + 108 62 + + + BICOMP + 6 + + + + + ICCARM + 20 12 15 18 28 + + + BICOMP + 20 12 15 18 28 + + + + + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + + + ICCARM + 76 78 + + + BICOMP + 111 + + + + + ICCARM + 12 15 23 54 72 92 14 80 52 83 97 + + + BICOMP + 12 15 23 54 72 92 14 52 83 97 + + + + + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + + + ICCARM + 71 63 + + + BICOMP + 69 + + + + + ICCARM + 12 15 18 + + + BICOMP + 12 15 18 + + + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + + + ICCARM + 88 17 + + + BICOMP + 100 + + + + + ICCARM + 12 15 44 42 + + + BICOMP + 12 15 44 42 + + + + + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + + + ICCARM + 73 149 + + + BICOMP + 9 + + + + + ICCARM + 12 15 28 54 72 92 14 80 52 83 97 + + + BICOMP + 12 15 28 54 72 92 14 52 83 97 + + + + + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + + + ICCARM + 95 10 + + + BICOMP + 110 + + + + + ICCARM + 12 15 13 146 + + + BICOMP + 12 15 13 146 + + + + + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + + + ICCARM + 4 60 + + + BICOMP + 68 + + + + + ICCARM + 12 15 16 145 27 + + + BICOMP + 12 15 16 145 27 + + + + + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + + + ICCARM + 55 65 + + + BICOMP + 81 + + + + + ICCARM + 12 15 27 13 24 + + + BICOMP + 12 15 27 13 24 + + + + + $PROJ_DIR$\srcIAR\Cstartup.s79 + + + AARM + 141 + + + + + AARM + 96 + + + + + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + + + ICCARM + 104 51 + + + BICOMP + 112 + + + + + ICCARM + 15 + + + + + + Release + + $PROJ_DIR$\..\test\system\src\TemperatureCalculator.h + $PROJ_DIR$\..\..\examples\src\Types.h + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.h + $TOOLKIT_DIR$\inc\DLib_Defaults.h + $PROJ_DIR$\..\..\examples\src\AT91SAM7X256.h + $PROJ_DIR$\..\..\examples\src\AdcConductor.h + $PROJ_DIR$\..\..\examples\src\TaskScheduler.h + $PROJ_DIR$\..\..\examples\src\UsartConductor.h + $PROJ_DIR$\..\..\examples\src\Model.h + $TOOLKIT_DIR$\inc\intrinsics.h + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.h + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.h + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.h + $PROJ_DIR$\..\..\examples\src\AdcHardware.h + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.h + $PROJ_DIR$\..\..\examples\src\TimerConductor.h + $PROJ_DIR$\..\..\examples\src\UsartPutChar.h + $PROJ_DIR$\..\..\examples\src\UsartModel.h + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.h + $PROJ_DIR$\..\..\examples\src\UsartHardware.h + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.h + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.h + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.h + $PROJ_DIR$\..\..\examples\src\TimerModel.h + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.h + $PROJ_DIR$\..\..\examples\src\TimerHardware.h + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.h + $TOOLKIT_DIR$\inc\DLib_Product.h + $TOOLKIT_DIR$\inc\math.h + $TOOLKIT_DIR$\inc\stdio.h + $TOOLKIT_DIR$\inc\ymath.h + $TOOLKIT_DIR$\inc\ysizet.h + $TOOLKIT_DIR$\lib\dl4tptinl8n.h + $PROJ_DIR$\..\test\system\src\UsartPutChar.h + $PROJ_DIR$\..\test\system\src\AdcTemperatureSensor.h + $PROJ_DIR$\..\test\system\src\TaskScheduler.h + $PROJ_DIR$\..\test\system\src\UsartTransmitBufferStatus.h + $PROJ_DIR$\..\test\system\src\UsartConfigurator.h + $PROJ_DIR$\..\test\system\src\TimerConfigurator.h + $PROJ_DIR$\..\test\system\src\AT91SAM7X256.h + $PROJ_DIR$\..\test\system\src\UsartBaudRateRegisterCalculator.h + $PROJ_DIR$\..\test\system\src\Executor.h + $PROJ_DIR$\..\test\system\src\ModelConfig.h + $PROJ_DIR$\..\test\system\src\TimerModel.h + $PROJ_DIR$\..\test\system\src\TimerInterruptHandler.h + $PROJ_DIR$\..\test\system\src\Main.c + $PROJ_DIR$\..\test\system\src\Model.c + $PROJ_DIR$\..\test\system\src\AdcHardwareConfigurator.c + $PROJ_DIR$\..\test\system\src\TimerModel.c + $PROJ_DIR$\..\test\system\src\UsartModel.c + $PROJ_DIR$\..\test\system\src\UsartHardware.c + $PROJ_DIR$\..\test\system\src\UsartTransmitBufferStatus.c + $PROJ_DIR$\..\test\system\src\UsartPutChar.c + $PROJ_DIR$\..\test\system\src\TimerInterruptConfigurator.c + $PROJ_DIR$\..\test\system\src\UsartBaudRateRegisterCalculator.c + $PROJ_DIR$\..\test\system\src\TaskScheduler.c + $PROJ_DIR$\..\test\system\src\AdcConductor.h + $PROJ_DIR$\..\test\system\src\TimerInterruptConfigurator.h + $PROJ_DIR$\..\test\system\src\Model.h + $PROJ_DIR$\..\test\system\src\TemperatureFilter.h + $PROJ_DIR$\..\test\system\src\AdcModel.c + $PROJ_DIR$\..\test\system\src\TimerHardware.h + $PROJ_DIR$\..\test\system\src\AdcTemperatureSensor.c + $PROJ_DIR$\..\test\system\src\AdcConductor.c + $PROJ_DIR$\..\test\system\src\AdcHardware.c + $PROJ_DIR$\..\test\system\src\AdcHardware.h + $PROJ_DIR$\..\test\system\src\Executor.c + $TOOLKIT_DIR$\inc\xencoding_limits.h + $TOOLKIT_DIR$\lib\dl4tptinl8n.r79 + $PROJ_DIR$\..\test\system\src\TemperatureCalculator.c + $PROJ_DIR$\..\test\system\src\Types.h + $PROJ_DIR$\..\test\system\src\TemperatureFilter.c + $PROJ_DIR$\..\test\system\src\TimerConductor.c + $PROJ_DIR$\..\test\system\src\TimerConfigurator.c + $PROJ_DIR$\..\test\system\src\TimerHardware.c + $PROJ_DIR$\..\test\system\src\TimerInterruptHandler.c + $PROJ_DIR$\..\test\system\src\UsartConductor.c + $PROJ_DIR$\..\test\system\src\UsartConfigurator.c + $PROJ_DIR$\..\test\system\src\UsartHardware.h + $PROJ_DIR$\..\test\system\src\TimerConductor.h + $PROJ_DIR$\..\test\system\src\AdcModel.h + $PROJ_DIR$\..\test\system\src\AdcHardwareConfigurator.h + $PROJ_DIR$\..\test\system\src\UsartConductor.h + $PROJ_DIR$\Release\Obj\Executor.pbi + $PROJ_DIR$\..\test\system\src\UsartModel.h + $PROJ_DIR$\Release\Obj\Model.pbi + $PROJ_DIR$\Release\Obj\Cstartup_SAM7.pbi + $PROJ_DIR$\Release\Obj\UsartConductor.pbi + $PROJ_DIR$\Release\Obj\AdcConductor.r79 + $PROJ_DIR$\Release\Obj\AdcHardware.r79 + $PROJ_DIR$\Release\Obj\TimerModel.pbi + $PROJ_DIR$\Release\Obj\AdcTemperatureSensor.pbi + $PROJ_DIR$\Release\Obj\UsartHardware.r79 + $PROJ_DIR$\Release\Obj\TemperatureFilter.pbi + $PROJ_DIR$\Release\Obj\UsartPutChar.pbi + $PROJ_DIR$\Release\Obj\TemperatureCalculator.r79 + $PROJ_DIR$\Release\Obj\AdcHardwareConfigurator.r79 + $PROJ_DIR$\Release\Obj\cmock_demo.pbd + $PROJ_DIR$\Release\Obj\UsartModel.r79 + $PROJ_DIR$\Release\Obj\UsartBaudRateRegisterCalculator.r79 + $PROJ_DIR$\Release\Obj\Model.r79 + $PROJ_DIR$\Release\Obj\AdcModel.r79 + $PROJ_DIR$\Release\Obj\AdcHardware.pbi + $PROJ_DIR$\Release\Obj\TimerModel.r79 + $PROJ_DIR$\Release\Obj\TimerHardware.r79 + $PROJ_DIR$\Release\Obj\UsartPutChar.r79 + $PROJ_DIR$\Release\Obj\AdcHardwareConfigurator.pbi + $PROJ_DIR$\Release\Obj\TimerInterruptConfigurator.r79 + $PROJ_DIR$\Release\Obj\TaskScheduler.pbi + $PROJ_DIR$\Release\List\cmock_demo.map + $PROJ_DIR$\Release\Obj\UsartTransmitBufferStatus.pbi + $PROJ_DIR$\Release\Exe\cmock_demo.d79 + $PROJ_DIR$\Release\Obj\AdcTemperatureSensor.r79 + $PROJ_DIR$\Release\Obj\TimerConductor.r79 + $PROJ_DIR$\Release\Obj\TimerConfigurator.r79 + $PROJ_DIR$\Release\Obj\Main.pbi + $PROJ_DIR$\Release\Obj\TimerInterruptConfigurator.pbi + $PROJ_DIR$\Release\Obj\UsartTransmitBufferStatus.r79 + $PROJ_DIR$\Release\Obj\AdcModel.pbi + $PROJ_DIR$\Release\Obj\TemperatureFilter.r79 + $PROJ_DIR$\Release\Obj\UsartHardware.pbi + $PROJ_DIR$\Release\Obj\Cstartup.r79 + $PROJ_DIR$\Release\Obj\UsartConductor.r79 + $PROJ_DIR$\Release\Obj\TimerInterruptHandler.pbi + $PROJ_DIR$\Release\Obj\TimerConductor.pbi + $PROJ_DIR$\Release\Obj\Main.r79 + $PROJ_DIR$\Release\Obj\UsartConfigurator.pbi + $PROJ_DIR$\Release\Obj\Executor.r79 + $PROJ_DIR$\Release\Obj\Cstartup_SAM7.r79 + $PROJ_DIR$\Release\Obj\TemperatureCalculator.pbi + $PROJ_DIR$\Release\Obj\TimerHardware.pbi + $PROJ_DIR$\Release\Exe\cmock_demo.sim + $PROJ_DIR$\Release\Obj\TimerConfigurator.pbi + $PROJ_DIR$\Release\Obj\UsartModel.pbi + $PROJ_DIR$\Release\Obj\TaskScheduler.r79 + $PROJ_DIR$\Release\Obj\UsartBaudRateRegisterCalculator.pbi + $PROJ_DIR$\Release\Obj\AdcConductor.pbi + $PROJ_DIR$\Release\Obj\TimerInterruptHandler.r79 + $PROJ_DIR$\Release\Obj\UsartConfigurator.r79 + $PROJ_DIR$\Release\Obj\IntrinsicsWrapper.pbi + $PROJ_DIR$\Release\Obj\IntrinsicsWrapper.r79 + $TOOLKIT_DIR$\inc\yvals.h + $PROJ_DIR$\incIAR\AT91SAM7X256_inc.h + $TOOLKIT_DIR$\inc\DLib_Threads.h + $PROJ_DIR$\Resource\at91SAM7X256_FLASH.xcl + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + $PROJ_DIR$\..\..\examples\src\TimerModel.c + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + $PROJ_DIR$\..\..\examples\src\UsartModel.c + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + $PROJ_DIR$\Cstartup.s79 + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + $PROJ_DIR$\Cstartup_SAM7.c + $PROJ_DIR$\..\..\examples\src\AdcModel.c + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + $PROJ_DIR$\..\..\examples\src\Executor.c + $PROJ_DIR$\..\..\examples\src\Main.c + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + $PROJ_DIR$\..\..\examples\src\Model.c + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + $PROJ_DIR$\..\..\examples\src\Executor.h + $PROJ_DIR$\..\..\examples\src\AdcModel.h + $PROJ_DIR$\..\..\examples\src\ModelConfig.h + $PROJ_DIR$\srcIAR\Cstartup.s79 + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + + + [ROOT_NODE] + + + XLINK + 111 109 131 + + + + + $PROJ_DIR$\..\test\system\src\Main.c + + + ICCARM + 125 + + + BICOMP + 115 + + + + + ICCARM + 70 39 41 58 35 0 59 82 78 37 33 84 40 36 79 61 38 57 44 43 56 65 81 34 80 + + + + + $PROJ_DIR$\..\test\system\src\Model.c + + + ICCARM + 100 + + + BICOMP + 85 + + + + + ICCARM + 58 70 39 35 59 + + + + + $PROJ_DIR$\..\test\system\src\AdcHardwareConfigurator.c + + + ICCARM + 96 + + + BICOMP + 106 + + + + + ICCARM + 70 39 81 42 + + + + + $PROJ_DIR$\..\test\system\src\TimerModel.c + + + ICCARM + 103 + + + BICOMP + 90 + + + + + ICCARM + 70 39 43 35 + + + + + $PROJ_DIR$\..\test\system\src\UsartModel.c + + + ICCARM + 98 + + + BICOMP + 133 + + + + + ICCARM + 70 39 84 42 40 59 29 141 3 32 27 67 143 31 28 30 + + + + + $PROJ_DIR$\..\test\system\src\UsartHardware.c + + + ICCARM + 92 + + + BICOMP + 120 + + + + + ICCARM + 70 39 78 37 33 + + + + + $PROJ_DIR$\..\test\system\src\UsartTransmitBufferStatus.c + + + ICCARM + 117 + + + BICOMP + 110 + + + + + ICCARM + 70 39 36 + + + + + $PROJ_DIR$\..\test\system\src\UsartPutChar.c + + + ICCARM + 105 + + + BICOMP + 94 + + + + + ICCARM + 70 39 33 36 + + + + + $PROJ_DIR$\..\test\system\src\TimerInterruptConfigurator.c + + + ICCARM + 107 + + + BICOMP + 116 + + + + + ICCARM + 70 39 57 44 + + + + + $PROJ_DIR$\..\test\system\src\UsartBaudRateRegisterCalculator.c + + + ICCARM + 99 + + + BICOMP + 135 + + + + + ICCARM + 70 39 40 + + + + + $PROJ_DIR$\..\test\system\src\TaskScheduler.c + + + ICCARM + 134 + + + BICOMP + 108 + + + + + ICCARM + 70 39 35 + + + + + $PROJ_DIR$\..\test\system\src\AdcModel.c + + + ICCARM + 101 + + + BICOMP + 118 + + + + + ICCARM + 70 39 80 35 0 59 + + + + + $PROJ_DIR$\..\test\system\src\AdcTemperatureSensor.c + + + ICCARM + 112 + + + BICOMP + 91 + + + + + ICCARM + 70 39 34 + + + + + $PROJ_DIR$\..\test\system\src\AdcConductor.c + + + ICCARM + 88 + + + BICOMP + 136 + + + + + $PROJ_DIR$\..\test\system\src\AdcHardware.c + + + ICCARM + 89 + + + BICOMP + 102 + + + + + ICCARM + 70 39 65 81 34 + + + + + $PROJ_DIR$\..\test\system\src\Executor.c + + + ICCARM + 127 + + + BICOMP + 83 + + + + + ICCARM + 70 39 41 58 82 79 56 + + + + + $PROJ_DIR$\..\test\system\src\TemperatureCalculator.c + + + ICCARM + 95 + + + BICOMP + 129 + + + + + ICCARM + 70 39 0 28 30 141 3 32 27 67 143 + + + + + $PROJ_DIR$\..\test\system\src\TemperatureFilter.c + + + ICCARM + 119 + + + BICOMP + 93 + + + + + ICCARM + 70 39 59 28 30 141 3 32 27 67 143 + + + + + $PROJ_DIR$\..\test\system\src\TimerConductor.c + + + ICCARM + 113 + + + BICOMP + 124 + + + + + ICCARM + 70 39 79 43 61 44 + + + + + $PROJ_DIR$\..\test\system\src\TimerConfigurator.c + + + ICCARM + 114 + + + BICOMP + 132 + + + + + ICCARM + 70 39 38 57 + + + + + $PROJ_DIR$\..\test\system\src\TimerHardware.c + + + ICCARM + 104 + + + BICOMP + 130 + + + + + ICCARM + 70 39 61 38 + + + + + $PROJ_DIR$\..\test\system\src\TimerInterruptHandler.c + + + ICCARM + 137 + + + BICOMP + 123 + + + + + ICCARM + 70 39 44 57 + + + + + $PROJ_DIR$\..\test\system\src\UsartConductor.c + + + ICCARM + 122 + + + BICOMP + 87 + + + + + ICCARM + 70 39 82 78 84 35 + + + + + $PROJ_DIR$\..\test\system\src\UsartConfigurator.c + + + ICCARM + 138 + + + BICOMP + 126 + + + + + ICCARM + 70 39 37 + + + + + $PROJ_DIR$\Release\Obj\cmock_demo.pbd + + + BILINK + 136 102 106 118 91 86 83 139 115 85 108 129 93 124 132 130 116 123 90 135 87 126 120 133 94 110 + + + + + $PROJ_DIR$\Release\Exe\cmock_demo.d79 + + + XLINK + 109 131 + + + + + XLINK + 144 88 89 96 101 112 121 128 127 140 125 100 134 95 119 113 114 104 107 137 103 99 122 138 92 98 105 117 68 + + + + + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + + + ICCARM + 113 + + + BICOMP + 124 + + + + + ICCARM + 1 4 15 23 25 22 + + + BICOMP + 1 4 15 23 25 22 + + + + + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + + + ICCARM + 114 + + + BICOMP + 132 + + + + + ICCARM + 1 4 24 21 + + + BICOMP + 1 4 24 21 + + + + + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + + + ICCARM + 104 + + + BICOMP + 130 + + + + + ICCARM + 1 4 25 24 + + + BICOMP + 1 4 25 24 + + + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + + + ICCARM + 107 + + + BICOMP + 116 + + + + + ICCARM + 1 4 21 22 + + + BICOMP + 1 4 21 22 + + + + + $PROJ_DIR$\..\..\examples\src\TimerModel.c + + + ICCARM + 103 + + + BICOMP + 90 + + + + + ICCARM + 1 4 23 6 + + + BICOMP + 1 4 23 6 + + + + + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + + + ICCARM + 99 + + + BICOMP + 135 + + + + + ICCARM + 1 4 26 + + + BICOMP + 1 4 26 + + + + + $PROJ_DIR$\..\..\examples\src\UsartModel.c + + + ICCARM + 98 + + + BICOMP + 133 + + + + + ICCARM + 1 4 17 174 26 14 29 141 3 32 27 67 143 31 28 30 + + + BICOMP + 1 4 17 174 26 14 29 141 3 27 67 143 31 28 30 + + + + + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + + + ICCARM + 122 + + + BICOMP + 87 + + + + + ICCARM + 1 4 7 19 17 6 + + + BICOMP + 1 4 7 19 17 6 + + + + + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + + + ICCARM + 138 + + + BICOMP + 126 + + + + + ICCARM + 1 4 12 + + + BICOMP + 1 4 12 + + + + + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + + + ICCARM + 92 + + + BICOMP + 120 + + + + + ICCARM + 1 4 19 12 16 + + + BICOMP + 1 4 19 12 16 + + + + + $PROJ_DIR$\Cstartup.s79 + + + AARM + 121 + + + + + AARM + 142 + + + + + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + + + ICCARM + 105 + + + BICOMP + 94 + + + + + ICCARM + 1 4 16 20 + + + BICOMP + 1 4 16 20 + + + + + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + + + ICCARM + 117 + + + BICOMP + 110 + + + + + ICCARM + 1 4 20 + + + BICOMP + 1 4 20 + + + + + $PROJ_DIR$\Cstartup_SAM7.c + + + ICCARM + 128 + + + BICOMP + 86 + + + + + ICCARM + 4 + + + BICOMP + 4 + + + + + $PROJ_DIR$\..\..\examples\src\AdcModel.c + + + ICCARM + 101 + + + BICOMP + 118 + + + + + ICCARM + 1 4 173 6 10 14 + + + BICOMP + 1 4 173 6 10 14 + + + + + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + + + ICCARM + 112 + + + BICOMP + 91 + + + + + ICCARM + 1 4 11 + + + BICOMP + 1 4 11 + + + + + $PROJ_DIR$\..\..\examples\src\Executor.c + + + ICCARM + 127 + + + BICOMP + 83 + + + + + ICCARM + 1 4 172 8 7 15 5 18 + + + BICOMP + 1 4 172 8 7 15 5 18 + + + + + $PROJ_DIR$\..\..\examples\src\Main.c + + + ICCARM + 125 + + + BICOMP + 115 + + + + + ICCARM + 1 4 18 172 8 6 10 14 7 19 12 16 17 26 20 15 25 24 21 22 23 5 13 2 11 173 + + + BICOMP + 1 4 18 172 8 6 10 14 7 19 12 16 17 26 20 15 25 24 21 22 23 5 13 2 11 173 + + + + + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + + + ICCARM + 140 + + + BICOMP + 139 + + + + + ICCARM + 18 9 + + + BICOMP + 18 9 + + + + + $PROJ_DIR$\..\..\examples\src\Model.c + + + ICCARM + 100 + + + BICOMP + 85 + + + + + ICCARM + 8 1 4 6 14 + + + BICOMP + 8 1 4 6 14 + + + + + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + + + ICCARM + 95 + + + BICOMP + 129 + + + + + ICCARM + 1 4 10 28 30 141 3 32 27 67 143 + + + BICOMP + 1 4 10 28 30 141 3 27 67 143 + + + + + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + + + ICCARM + 134 + + + BICOMP + 108 + + + + + ICCARM + 1 4 6 + + + BICOMP + 1 4 6 + + + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + + + ICCARM + 137 + + + BICOMP + 123 + + + + + ICCARM + 1 4 22 21 + + + BICOMP + 1 4 22 21 + + + + + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + + + ICCARM + 119 + + + BICOMP + 93 + + + + + ICCARM + 1 4 14 28 30 141 3 32 27 67 143 + + + BICOMP + 1 4 14 28 30 141 3 27 67 143 + + + + + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + + + ICCARM + 96 + + + BICOMP + 106 + + + + + ICCARM + 1 4 2 174 + + + BICOMP + 1 4 2 174 + + + + + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + + + ICCARM + 88 + + + BICOMP + 136 + + + + + ICCARM + 1 4 5 173 13 + + + BICOMP + 1 4 5 173 13 + + + + + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + + + ICCARM + 89 + + + BICOMP + 102 + + + + + ICCARM + 1 4 13 2 11 + + + BICOMP + 1 4 13 2 11 + + + + + $PROJ_DIR$\srcIAR\Cstartup.s79 + + + AARM + 121 + + + + + AARM + 142 + + + + + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + + + ICCARM + 128 + + + BICOMP + 86 + + + + + ICCARM + 4 + + + BICOMP + 4 + + + + + $PROJ_DIR$\..\test\system\src\Main.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\Model.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\AdcHardwareConfigurator.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\TimerModel.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\UsartModel.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\UsartHardware.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\UsartTransmitBufferStatus.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\UsartPutChar.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\TimerInterruptConfigurator.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\UsartBaudRateRegisterCalculator.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\TaskScheduler.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\AdcModel.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\AdcTemperatureSensor.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\AdcConductor.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\AdcHardware.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\Executor.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\TemperatureCalculator.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\TemperatureFilter.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\TimerConductor.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\TimerConfigurator.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\TimerHardware.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\TimerInterruptHandler.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\UsartConductor.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\UsartConfigurator.c + ICCARM + + + + Simulate + + $PROJ_DIR$\..\test\system\src\TemperatureCalculator.h + $PROJ_DIR$\..\..\examples\src\Types.h + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.h + $TOOLKIT_DIR$\inc\DLib_Defaults.h + $PROJ_DIR$\..\..\examples\src\AT91SAM7X256.h + $PROJ_DIR$\..\..\examples\src\AdcConductor.h + $PROJ_DIR$\..\..\examples\src\TaskScheduler.h + $PROJ_DIR$\..\..\examples\src\UsartConductor.h + $PROJ_DIR$\..\..\examples\src\Model.h + $TOOLKIT_DIR$\inc\intrinsics.h + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.h + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.h + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.h + $PROJ_DIR$\..\..\examples\src\AdcHardware.h + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.h + $PROJ_DIR$\..\..\examples\src\TimerConductor.h + $PROJ_DIR$\..\..\examples\src\UsartPutChar.h + $PROJ_DIR$\..\..\examples\src\UsartModel.h + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.h + $PROJ_DIR$\..\..\examples\src\UsartHardware.h + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.h + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.h + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.h + $PROJ_DIR$\..\..\examples\src\TimerModel.h + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.h + $PROJ_DIR$\..\..\examples\src\TimerHardware.h + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.h + $TOOLKIT_DIR$\inc\DLib_Product.h + $TOOLKIT_DIR$\inc\math.h + $TOOLKIT_DIR$\inc\stdio.h + $TOOLKIT_DIR$\inc\ymath.h + $TOOLKIT_DIR$\inc\ysizet.h + $TOOLKIT_DIR$\lib\dl4tptinl8n.h + $PROJ_DIR$\..\test\system\src\UsartPutChar.h + $PROJ_DIR$\..\test\system\src\AdcTemperatureSensor.h + $PROJ_DIR$\Simulate\Obj\cmock_demo.pbd + $PROJ_DIR$\..\test\system\src\TaskScheduler.h + $PROJ_DIR$\..\test\system\src\UsartTransmitBufferStatus.h + $PROJ_DIR$\..\test\system\src\UsartConfigurator.h + $PROJ_DIR$\..\test\system\src\TimerConfigurator.h + $PROJ_DIR$\..\test\system\src\AT91SAM7X256.h + $PROJ_DIR$\..\test\system\src\UsartBaudRateRegisterCalculator.h + $PROJ_DIR$\..\test\system\src\Executor.h + $PROJ_DIR$\..\test\system\src\ModelConfig.h + $PROJ_DIR$\..\test\system\src\TimerModel.h + $PROJ_DIR$\..\test\system\src\TimerInterruptHandler.h + $PROJ_DIR$\..\test\system\src\Main.c + $PROJ_DIR$\..\test\system\src\Model.c + $PROJ_DIR$\..\test\system\src\AdcHardwareConfigurator.c + $PROJ_DIR$\..\test\system\src\TimerModel.c + $PROJ_DIR$\..\test\system\src\UsartModel.c + $PROJ_DIR$\..\test\system\src\UsartHardware.c + $PROJ_DIR$\..\test\system\src\UsartTransmitBufferStatus.c + $PROJ_DIR$\..\test\system\src\UsartPutChar.c + $PROJ_DIR$\..\test\system\src\TimerInterruptConfigurator.c + $PROJ_DIR$\..\test\system\src\UsartBaudRateRegisterCalculator.c + $PROJ_DIR$\..\test\system\src\TaskScheduler.c + $PROJ_DIR$\..\test\system\src\AdcConductor.h + $PROJ_DIR$\..\test\system\src\TimerInterruptConfigurator.h + $PROJ_DIR$\..\test\system\src\Model.h + $PROJ_DIR$\..\test\system\src\TemperatureFilter.h + $PROJ_DIR$\..\test\system\src\AdcModel.c + $PROJ_DIR$\..\test\system\src\TimerHardware.h + $PROJ_DIR$\..\test\system\src\AdcTemperatureSensor.c + $PROJ_DIR$\..\test\system\src\AdcConductor.c + $PROJ_DIR$\..\test\system\src\AdcHardware.c + $PROJ_DIR$\..\test\system\src\AdcHardware.h + $PROJ_DIR$\..\test\system\src\Executor.c + $TOOLKIT_DIR$\inc\xencoding_limits.h + $TOOLKIT_DIR$\lib\dl4tptinl8n.r79 + $PROJ_DIR$\..\test\system\src\TemperatureCalculator.c + $PROJ_DIR$\..\test\system\src\Types.h + $PROJ_DIR$\..\test\system\src\TemperatureFilter.c + $PROJ_DIR$\..\test\system\src\TimerConductor.c + $PROJ_DIR$\..\test\system\src\TimerConfigurator.c + $PROJ_DIR$\..\test\system\src\TimerHardware.c + $PROJ_DIR$\..\test\system\src\TimerInterruptHandler.c + $PROJ_DIR$\..\test\system\src\UsartConductor.c + $PROJ_DIR$\..\test\system\src\UsartConfigurator.c + $PROJ_DIR$\..\test\system\src\UsartHardware.h + $PROJ_DIR$\..\test\system\src\TimerConductor.h + $PROJ_DIR$\..\test\system\src\AdcModel.h + $PROJ_DIR$\..\test\system\src\AdcHardwareConfigurator.h + $PROJ_DIR$\..\test\system\src\UsartConductor.h + $PROJ_DIR$\..\test\system\src\UsartModel.h + $PROJ_DIR$\Simulate\Obj\AdcConductor.r79 + $PROJ_DIR$\Simulate\Obj\Cstartup_SAM7.pbi + $PROJ_DIR$\Simulate\Obj\UsartHardware.r79 + $TOOLKIT_DIR$\inc\yvals.h + $PROJ_DIR$\incIAR\AT91SAM7X256_inc.h + $PROJ_DIR$\Simulate\List\TimerModel.lst + $PROJ_DIR$\Simulate\Obj\Executor.r79 + $PROJ_DIR$\Simulate\Obj\TimerHardware.pbi + $PROJ_DIR$\Simulate\Obj\UsartModel.pbi + $PROJ_DIR$\Simulate\Obj\IntrinsicsWrapper.r79 + $PROJ_DIR$\Simulate\Obj\TimerConductor.pbi + $PROJ_DIR$\Simulate\List\UsartConductor.lst + $PROJ_DIR$\Simulate\Obj\Main.pbi + $TOOLKIT_DIR$\inc\DLib_Threads.h + $PROJ_DIR$\Simulate\Obj\AdcHardwareConfigurator.pbi + $PROJ_DIR$\Simulate\Obj\TimerConfigurator.pbi + $PROJ_DIR$\Simulate\Exe\cmock_demo.sim + $PROJ_DIR$\Simulate\Obj\UsartTransmitBufferStatus.pbi + $PROJ_DIR$\Simulate\Obj\AdcHardware.r79 + $PROJ_DIR$\Simulate\Obj\Main.r79 + $PROJ_DIR$\Simulate\Obj\AdcTemperatureSensor.pbi + $PROJ_DIR$\Simulate\Obj\UsartPutChar.r79 + $PROJ_DIR$\Simulate\Obj\AdcHardwareConfigurator.r79 + $PROJ_DIR$\Simulate\Obj\UsartConductor.r79 + $PROJ_DIR$\Simulate\Obj\TimerHardware.r79 + $PROJ_DIR$\Simulate\Obj\TemperatureFilter.r79 + $PROJ_DIR$\Simulate\Obj\TemperatureCalculator.pbi + $PROJ_DIR$\Simulate\Obj\TimerInterruptConfigurator.r79 + $PROJ_DIR$\Simulate\Obj\UsartTransmitBufferStatus.r79 + $PROJ_DIR$\Simulate\Obj\TimerConductor.r79 + $PROJ_DIR$\Simulate\Obj\Executor.pbi + $PROJ_DIR$\Simulate\Obj\UsartConductor.pbi + $PROJ_DIR$\Simulate\Obj\TimerModel.pbi + $PROJ_DIR$\Simulate\Obj\AdcModel.pbi + $PROJ_DIR$\Simulate\List\TaskScheduler.lst + $PROJ_DIR$\Simulate\Obj\TimerModel.r79 + $PROJ_DIR$\Simulate\Obj\TemperatureFilter.pbi + $PROJ_DIR$\Simulate\Obj\UsartBaudRateRegisterCalculator.pbi + $PROJ_DIR$\Simulate\Obj\UsartHardware.pbi + $PROJ_DIR$\Simulate\Obj\TaskScheduler.pbi + $PROJ_DIR$\Simulate\Obj\AdcConductor.pbi + $PROJ_DIR$\Simulate\Obj\TimerConfigurator.r79 + $PROJ_DIR$\Simulate\Obj\Cstartup.r79 + $PROJ_DIR$\Simulate\Obj\TimerInterruptHandler.pbi + $PROJ_DIR$\Simulate\Obj\AdcModel.r79 + $PROJ_DIR$\Simulate\Obj\IntrinsicsWrapper.pbi + $PROJ_DIR$\Simulate\List\cmock_demo.map + $PROJ_DIR$\Simulate\Obj\TimerInterruptConfigurator.pbi + $PROJ_DIR$\Simulate\Exe\cmock_demo.d79 + $PROJ_DIR$\Simulate\Obj\TaskScheduler.r79 + $PROJ_DIR$\Simulate\Obj\Model.r79 + $PROJ_DIR$\Simulate\Obj\UsartConfigurator.pbi + $PROJ_DIR$\Simulate\Obj\UsartModel.r79 + $PROJ_DIR$\Simulate\Obj\Cstartup_SAM7.r79 + $PROJ_DIR$\Simulate\Obj\TemperatureCalculator.r79 + $PROJ_DIR$\Simulate\Obj\UsartPutChar.pbi + $PROJ_DIR$\Simulate\Obj\UsartConfigurator.r79 + $PROJ_DIR$\Simulate\Obj\AdcHardware.pbi + $PROJ_DIR$\Simulate\Obj\AdcTemperatureSensor.r79 + $PROJ_DIR$\Simulate\Obj\Model.pbi + $PROJ_DIR$\Simulate\Obj\UsartBaudRateRegisterCalculator.r79 + $PROJ_DIR$\Simulate\List\UsartBaudRateRegisterCalculator.lst + $PROJ_DIR$\Simulate\List\UsartTransmitBufferStatus.lst + $PROJ_DIR$\Simulate\List\AdcHardware.lst + $PROJ_DIR$\Simulate\List\TimerInterruptConfigurator.lst + $PROJ_DIR$\Simulate\List\Model.lst + $PROJ_DIR$\Simulate\Obj\TimerInterruptHandler.r79 + $PROJ_DIR$\Simulate\List\UsartPutChar.lst + $PROJ_DIR$\Simulate\List\UsartHardware.lst + $PROJ_DIR$\Simulate\List\Executor.lst + $PROJ_DIR$\Simulate\List\TimerConfigurator.lst + $PROJ_DIR$\Simulate\List\AdcTemperatureSensor.lst + $PROJ_DIR$\Simulate\List\Cstartup_SAM7.lst + $PROJ_DIR$\Simulate\List\AdcHardwareConfigurator.lst + $PROJ_DIR$\Simulate\List\AdcModel.lst + $PROJ_DIR$\Simulate\List\TemperatureFilter.lst + $PROJ_DIR$\Simulate\List\AdcConductor.lst + $PROJ_DIR$\Simulate\List\UsartConfigurator.lst + $PROJ_DIR$\Simulate\List\IntrinsicsWrapper.lst + $PROJ_DIR$\Simulate\List\TimerHardware.lst + $PROJ_DIR$\Simulate\List\TemperatureCalculator.lst + $PROJ_DIR$\Simulate\List\TimerInterruptHandler.lst + $PROJ_DIR$\Simulate\List\UsartModel.lst + $PROJ_DIR$\Simulate\List\Main.lst + $PROJ_DIR$\Simulate\List\TimerConductor.lst + $PROJ_DIR$\Resource\at91SAM7X256_FLASH.xcl + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + $PROJ_DIR$\..\..\examples\src\TimerModel.c + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + $PROJ_DIR$\..\..\examples\src\UsartModel.c + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + $PROJ_DIR$\Cstartup.s79 + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + $PROJ_DIR$\Cstartup_SAM7.c + $PROJ_DIR$\..\..\examples\src\AdcModel.c + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + $PROJ_DIR$\..\..\examples\src\Executor.c + $PROJ_DIR$\..\..\examples\src\Main.c + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + $PROJ_DIR$\..\..\examples\src\Model.c + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + $PROJ_DIR$\..\..\examples\src\Executor.h + $PROJ_DIR$\..\..\examples\src\AdcModel.h + $PROJ_DIR$\..\..\examples\src\ModelConfig.h + $PROJ_DIR$\srcIAR\Cstartup.s79 + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + + + [ROOT_NODE] + + + XLINK + 133 131 101 + + + + + $PROJ_DIR$\Simulate\Obj\cmock_demo.pbd + + + BILINK + 125 142 99 118 105 86 115 130 97 144 124 111 121 95 100 92 132 128 117 122 116 136 123 93 140 102 + + + + + $PROJ_DIR$\..\test\system\src\Main.c + + + ICCARM + 104 + + + BICOMP + 97 + + + + + ICCARM + 71 40 42 59 36 0 60 83 79 38 33 84 41 37 80 62 39 58 45 44 57 66 82 34 81 + + + BICOMP + 71 40 42 59 36 0 60 83 79 38 33 84 41 37 80 62 39 58 45 44 57 66 82 34 81 + + + + + $PROJ_DIR$\..\test\system\src\Model.c + + + ICCARM + 135 + + + BICOMP + 144 + + + + + ICCARM + 59 71 40 36 60 + + + BICOMP + 59 71 40 36 60 + + + + + $PROJ_DIR$\..\test\system\src\AdcHardwareConfigurator.c + + + ICCARM + 107 + + + BICOMP + 99 + + + + + ICCARM + 71 40 82 43 + + + BICOMP + 71 40 82 43 + + + + + $PROJ_DIR$\..\test\system\src\TimerModel.c + + + ICCARM + 120 + + + BICOMP + 117 + + + + + ICCARM + 71 40 44 36 + + + BICOMP + 71 40 44 36 + + + + + $PROJ_DIR$\..\test\system\src\UsartModel.c + + + ICCARM + 137 + + + BICOMP + 93 + + + + + ICCARM + 71 40 84 43 41 60 29 88 3 32 27 68 98 31 28 30 + + + BICOMP + 71 40 84 43 41 60 29 88 3 27 68 98 31 28 30 + + + + + $PROJ_DIR$\..\test\system\src\UsartHardware.c + + + ICCARM + 87 + + + BICOMP + 123 + + + + + ICCARM + 71 40 79 38 33 + + + BICOMP + 71 40 79 38 33 + + + + + $PROJ_DIR$\..\test\system\src\UsartTransmitBufferStatus.c + + + ICCARM + 113 + + + BICOMP + 102 + + + + + ICCARM + 71 40 37 + + + BICOMP + 71 40 37 + + + + + $PROJ_DIR$\..\test\system\src\UsartPutChar.c + + + ICCARM + 106 + + + BICOMP + 140 + + + + + ICCARM + 71 40 33 37 29 88 3 32 27 68 98 31 + + + BICOMP + 71 40 33 37 29 88 3 27 68 98 31 + + + + + $PROJ_DIR$\..\test\system\src\TimerInterruptConfigurator.c + + + ICCARM + 112 + + + BICOMP + 132 + + + + + ICCARM + 71 40 58 45 + + + BICOMP + 71 40 58 45 + + + + + $PROJ_DIR$\..\test\system\src\UsartBaudRateRegisterCalculator.c + + + ICCARM + 145 + + + BICOMP + 122 + + + + + ICCARM + 71 40 41 + + + BICOMP + 71 40 41 + + + + + $PROJ_DIR$\..\test\system\src\TaskScheduler.c + + + ICCARM + 134 + + + BICOMP + 124 + + + + + ICCARM + 71 40 36 + + + BICOMP + 71 40 36 + + + + + $PROJ_DIR$\..\test\system\src\AdcModel.c + + + ICCARM + 129 + + + BICOMP + 118 + + + + + ICCARM + 71 40 81 36 0 60 + + + BICOMP + 71 40 81 36 0 60 + + + + + $PROJ_DIR$\..\test\system\src\AdcTemperatureSensor.c + + + ICCARM + 143 + + + BICOMP + 105 + + + + + ICCARM + 71 40 34 + + + BICOMP + 71 40 34 + + + + + $PROJ_DIR$\..\test\system\src\AdcConductor.c + + + ICCARM + 85 + + + BICOMP + 125 + + + + + ICCARM + 71 40 57 81 66 + + + BICOMP + 71 40 57 81 66 + + + + + $PROJ_DIR$\..\test\system\src\AdcHardware.c + + + ICCARM + 103 + + + BICOMP + 142 + + + + + ICCARM + 71 40 66 82 34 + + + BICOMP + 71 40 66 82 34 + + + + + $PROJ_DIR$\..\test\system\src\Executor.c + + + ICCARM + 91 + + + BICOMP + 115 + + + + + ICCARM + 71 40 42 59 83 80 57 + + + BICOMP + 71 40 42 59 83 80 57 + + + + + $PROJ_DIR$\..\test\system\src\TemperatureCalculator.c + + + ICCARM + 139 + + + BICOMP + 111 + + + + + ICCARM + 71 40 0 28 30 88 3 32 27 68 98 + + + BICOMP + 71 40 0 28 30 88 3 27 68 98 + + + + + $PROJ_DIR$\..\test\system\src\TemperatureFilter.c + + + ICCARM + 110 + + + BICOMP + 121 + + + + + ICCARM + 71 40 60 28 30 88 3 32 27 68 98 + + + BICOMP + 71 40 60 28 30 88 3 27 68 98 + + + + + $PROJ_DIR$\..\test\system\src\TimerConductor.c + + + ICCARM + 114 + + + BICOMP + 95 + + + + + ICCARM + 71 40 80 44 62 45 + + + BICOMP + 71 40 80 44 62 45 + + + + + $PROJ_DIR$\..\test\system\src\TimerConfigurator.c + + + ICCARM + 126 + + + BICOMP + 100 + + + + + ICCARM + 71 40 39 58 + + + BICOMP + 71 40 39 58 + + + + + $PROJ_DIR$\..\test\system\src\TimerHardware.c + + + ICCARM + 109 + + + BICOMP + 92 + + + + + ICCARM + 71 40 62 39 + + + BICOMP + 71 40 62 39 + + + + + $PROJ_DIR$\..\test\system\src\TimerInterruptHandler.c + + + ICCARM + 151 + + + BICOMP + 128 + + + + + ICCARM + 71 40 45 58 + + + BICOMP + 71 40 45 58 + + + + + $PROJ_DIR$\..\test\system\src\UsartConductor.c + + + ICCARM + 108 + + + BICOMP + 116 + + + + + ICCARM + 71 40 83 79 84 36 + + + BICOMP + 71 40 83 79 84 36 + + + + + $PROJ_DIR$\..\test\system\src\UsartConfigurator.c + + + ICCARM + 141 + + + BICOMP + 136 + + + + + ICCARM + 71 40 38 + + + BICOMP + 71 40 38 + + + + + $PROJ_DIR$\Simulate\Exe\cmock_demo.d79 + + + XLINK + 131 101 + + + + + XLINK + 170 85 103 107 129 143 127 138 91 94 104 135 134 139 110 114 126 109 112 151 120 145 108 141 87 137 106 113 69 + + + + + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + + + ICCARM + 114 169 + + + BICOMP + 95 + + + + + ICCARM + 1 4 15 23 25 22 + + + BICOMP + 1 4 15 23 25 22 + + + + + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + + + ICCARM + 126 155 + + + BICOMP + 100 + + + + + ICCARM + 1 4 24 21 + + + BICOMP + 1 4 24 21 + + + + + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + + + ICCARM + 109 164 + + + BICOMP + 92 + + + + + ICCARM + 1 4 25 24 + + + BICOMP + 1 4 25 24 + + + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + + + ICCARM + 112 149 + + + BICOMP + 132 + + + + + ICCARM + 1 4 21 22 + + + BICOMP + 1 4 21 22 + + + + + $PROJ_DIR$\..\..\examples\src\TimerModel.c + + + ICCARM + 120 90 + + + BICOMP + 117 + + + + + ICCARM + 1 4 23 6 + + + BICOMP + 1 4 23 6 + + + + + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + + + ICCARM + 145 146 + + + BICOMP + 122 + + + + + ICCARM + 1 4 26 + + + BICOMP + 1 4 26 + + + + + $PROJ_DIR$\..\..\examples\src\UsartModel.c + + + ICCARM + 137 167 + + + BICOMP + 93 + + + + + ICCARM + 1 4 17 200 26 14 29 88 3 32 27 68 98 31 28 30 + + + BICOMP + 1 4 17 200 26 14 29 88 3 27 68 98 31 28 30 + + + + + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + + + ICCARM + 108 96 + + + BICOMP + 116 + + + + + ICCARM + 1 4 7 19 17 6 + + + BICOMP + 1 4 7 19 17 6 + + + + + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + + + ICCARM + 141 162 + + + BICOMP + 136 + + + + + ICCARM + 1 4 12 + + + BICOMP + 1 4 12 + + + + + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + + + ICCARM + 87 153 + + + BICOMP + 123 + + + + + ICCARM + 1 4 19 12 16 + + + BICOMP + 1 4 19 12 16 + + + + + $PROJ_DIR$\Cstartup.s79 + + + AARM + 127 + + + + + AARM + 89 + + + + + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + + + ICCARM + 106 152 + + + BICOMP + 140 + + + + + ICCARM + 1 4 16 20 29 88 3 32 27 68 98 31 + + + BICOMP + 1 4 16 20 29 88 3 27 68 98 31 + + + + + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + + + ICCARM + 113 147 + + + BICOMP + 102 + + + + + ICCARM + 1 4 20 + + + BICOMP + 1 4 20 + + + + + $PROJ_DIR$\Cstartup_SAM7.c + + + ICCARM + 138 157 + + + BICOMP + 86 + + + + + ICCARM + 4 + + + BICOMP + 4 + + + + + $PROJ_DIR$\..\..\examples\src\AdcModel.c + + + ICCARM + 129 159 + + + BICOMP + 118 + + + + + ICCARM + 1 4 199 6 10 14 + + + BICOMP + 1 4 199 6 10 14 + + + + + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + + + ICCARM + 143 156 + + + BICOMP + 105 + + + + + ICCARM + 1 4 11 + + + BICOMP + 1 4 11 + + + + + $PROJ_DIR$\..\..\examples\src\Executor.c + + + ICCARM + 91 154 + + + BICOMP + 115 + + + + + ICCARM + 1 4 198 8 7 15 5 18 + + + BICOMP + 1 4 198 8 7 15 5 18 + + + + + $PROJ_DIR$\..\..\examples\src\Main.c + + + ICCARM + 104 168 + + + BICOMP + 97 + + + + + ICCARM + 1 4 18 198 8 6 10 14 7 19 12 16 17 26 20 15 25 24 21 22 23 5 13 2 11 199 + + + BICOMP + 1 4 18 198 8 6 10 14 7 19 12 16 17 26 20 15 25 24 21 22 23 5 13 2 11 199 + + + + + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + + + ICCARM + 94 163 + + + BICOMP + 130 + + + + + ICCARM + 18 9 + + + BICOMP + 18 9 + + + + + $PROJ_DIR$\..\..\examples\src\Model.c + + + ICCARM + 135 150 + + + BICOMP + 144 + + + + + ICCARM + 8 1 4 6 14 + + + BICOMP + 8 1 4 6 14 + + + + + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + + + ICCARM + 139 165 + + + BICOMP + 111 + + + + + ICCARM + 1 4 10 28 30 88 3 32 27 68 98 + + + BICOMP + 1 4 10 28 30 88 3 27 68 98 + + + + + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + + + ICCARM + 134 119 + + + BICOMP + 124 + + + + + ICCARM + 1 4 6 + + + BICOMP + 1 4 6 + + + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + + + ICCARM + 151 166 + + + BICOMP + 128 + + + + + ICCARM + 1 4 22 21 + + + BICOMP + 1 4 22 21 + + + + + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + + + ICCARM + 110 160 + + + BICOMP + 121 + + + + + ICCARM + 1 4 14 28 30 88 3 32 27 68 98 + + + BICOMP + 1 4 14 28 30 88 3 27 68 98 + + + + + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + + + ICCARM + 107 158 + + + BICOMP + 99 + + + + + ICCARM + 1 4 2 200 + + + BICOMP + 1 4 2 200 + + + + + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + + + ICCARM + 85 161 + + + BICOMP + 125 + + + + + ICCARM + 1 4 5 199 13 + + + BICOMP + 1 4 5 199 13 + + + + + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + + + ICCARM + 103 148 + + + BICOMP + 142 + + + + + ICCARM + 1 4 13 2 11 + + + BICOMP + 1 4 13 2 11 + + + + + $PROJ_DIR$\srcIAR\Cstartup.s79 + + + AARM + 127 + + + + + AARM + 89 + + + + + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + + + ICCARM + 138 157 + + + BICOMP + 86 + + + + + ICCARM + 4 + + + BICOMP + 4 + + + + + + + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/cmock_demo.ewd b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/cmock_demo.ewd new file mode 100644 index 0000000..37a724d --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/cmock_demo.ewd @@ -0,0 +1,1696 @@ + + + + 1 + + Debug + + ARM + + 1 + + C-SPY + 2 + + 13 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 0 + 1 + 1 + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + JLINK_ID + 2 + + 6 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + MACRAIGOR_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ewplugin + 1 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CMXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CMXTinyArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + + + Simulate + + ARM + + 1 + + C-SPY + 2 + + 13 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 0 + 1 + 1 + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + JLINK_ID + 2 + + 6 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + MACRAIGOR_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ewplugin + 1 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CMXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CMXTinyArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + + + Release + + ARM + + 0 + + C-SPY + 2 + + 13 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 0 + 1 + 0 + + + + + ANGEL_ID + 2 + + 0 + 1 + 0 + + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 0 + + + + + + + + + + JLINK_ID + 2 + + 6 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 0 + 1 + 0 + + + + + + + + + + + + MACRAIGOR_ID + 2 + + 2 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 0 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 0 + + + + + + + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ewplugin + 1 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CMXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CMXTinyArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + + + + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/cmock_demo.ewp b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/cmock_demo.ewp new file mode 100644 index 0000000..ec55fbe --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/cmock_demo.ewp @@ -0,0 +1,2581 @@ + + + + 1 + + Debug + + ARM + + 1 + + General + 2 + + 9 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 14 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + XLINK + 2 + + 18 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + XAR + 2 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + Simulate + + ARM + + 1 + + General + 2 + + 9 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 14 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + XLINK + 2 + + 18 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + XAR + 2 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + Release + + ARM + + 0 + + General + 2 + + 9 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 14 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + XLINK + 2 + + 18 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + XAR + 2 + + 0 + 1 + 0 + + + + + + + BILINK + 0 + + + + + Resource + + $PROJ_DIR$\Resource\at91SAM7X256_FLASH.xcl + + + $PROJ_DIR$\Resource\at91SAM7X256_RAM.xcl + + + $PROJ_DIR$\Resource\SAM7_FLASH.mac + + + $PROJ_DIR$\Resource\SAM7_RAM.mac + + + $PROJ_DIR$\Resource\SAM7_SIM.mac + + + + Source + + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + + + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + + + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + + + $PROJ_DIR$\..\..\examples\src\AdcModel.c + + + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + + + $PROJ_DIR$\..\..\examples\src\Executor.c + + + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + + + $PROJ_DIR$\..\..\examples\src\Main.c + + + $PROJ_DIR$\..\..\examples\src\Model.c + + + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + + + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + + + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + + + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + + + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + + + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + + + $PROJ_DIR$\..\..\examples\src\TimerModel.c + + + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + + + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + + + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + + + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + + + $PROJ_DIR$\..\..\examples\src\UsartModel.c + + + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + + + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + + + + Startup + + $PROJ_DIR$\srcIAR\Cstartup.s79 + + + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + + + + + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/cmock_demo.eww b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/cmock_demo.eww new file mode 100644 index 0000000..5f78f6e --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/cmock_demo.eww @@ -0,0 +1,10 @@ + + + + + $WS_DIR$\cmock_demo.ewp + + + + + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X-EK.h b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X-EK.h new file mode 100644 index 0000000..9834675 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X-EK.h @@ -0,0 +1,61 @@ +// ---------------------------------------------------------------------------- +// ATMEL Microcontroller Software Support - ROUSSET - +// ---------------------------------------------------------------------------- +// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// ---------------------------------------------------------------------------- +// File Name : AT91SAM7X-EK.h +// Object : AT91SAM7X-EK Evaluation Board Features Definition File +// +// ---------------------------------------------------------------------------- + +#ifndef AT91SAM7X_EK_H +#define AT91SAM7X_EK_H + +/*-----------------*/ +/* LEDs Definition */ +/*-----------------*/ +#define AT91B_LED1 (1<<19) // AT91C_PIO_PB19 AT91C_PB19_PWM0 AT91C_PB19_TCLK1 +#define AT91B_LED2 (1<<20) // AT91C_PIO_PB20 AT91C_PB20_PWM1 AT91C_PB20_PWM1 +#define AT91B_LED3 (AT91C_PIO_PB21) // AT91C_PIO_PB21 AT91C_PB21_PWM2 AT91C_PB21_PCK1 +#define AT91B_LED4 (AT91C_PIO_PB22) // AT91C_PIO_PB22 AT91C_PB22_PWM3 AT91C_PB22_PCK2 +#define AT91B_NB_LEB 4 +#define AT91B_LED_MASK (AT91B_LED1|AT91B_LED2|AT91B_LED3|AT91B_LED4) +#define AT91D_BASE_PIO_LED (AT91C_BASE_PIOB) + +#define AT91B_POWERLED (1<<25) // PB25 + + +/*-------------------------------*/ +/* JOYSTICK Position Definition */ +/*-------------------------------*/ +#define AT91B_SW1 (1<<21) // PA21 Up Button AT91C_PA21_TF AT91C_PA21_NPCS10 +#define AT91B_SW2 (1<<22) // PA22 Down Button AT91C_PA22_TK AT91C_PA22_SPCK1 +#define AT91B_SW3 (1<<23) // PA23 Left Button AT91C_PA23_TD AT91C_PA23_MOSI1 +#define AT91B_SW4 (1<<24) // PA24 Right Button AT91C_PA24_RD AT91C_PA24_MISO1 +#define AT91B_SW5 (1<<25) // PA25 Push Button AT91C_PA25_RK AT91C_PA25_NPCS11 +#define AT91B_SW_MASK (AT91B_SW1|AT91B_SW2|AT91B_SW3|AT91B_SW4|AT91B_SW5) + + +#define AT91D_BASE_PIO_SW (AT91C_BASE_PIOA) + +/*------------------*/ +/* CAN Definition */ +/*------------------*/ +#define AT91B_CAN_TRANSCEIVER_RS (1<<2) // PA2 + +/*--------------*/ +/* Clocks */ +/*--------------*/ +#define AT91B_MAIN_OSC 18432000 // Main Oscillator MAINCK +#define AT91B_MCK ((18432000*73/14)/2) // Output PLL Clock + +#endif /* AT91SAM7X-EK_H */ diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.inc b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.inc new file mode 100644 index 0000000..da33985 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.inc @@ -0,0 +1,2314 @@ +;- ---------------------------------------------------------------------------- +;- ATMEL Microcontroller Software Support - ROUSSET - +;- ---------------------------------------------------------------------------- +;- DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +;- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +;- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +;- DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +;- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +;- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +;- OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +;- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +;- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +;- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +;- ---------------------------------------------------------------------------- +;- File Name : AT91SAM7X256.h +;- Object : AT91SAM7X256 definitions +;- Generated : AT91 SW Application Group 11/02/2005 (15:17:24) +;- +;- CVS Reference : /AT91SAM7X256.pl/1.14/Tue Sep 13 15:06:52 2005// +;- CVS Reference : /SYS_SAM7X.pl/1.3/Tue Feb 1 17:01:43 2005// +;- CVS Reference : /MC_SAM7X.pl/1.2/Fri May 20 14:13:04 2005// +;- CVS Reference : /PMC_SAM7X.pl/1.4/Tue Feb 8 13:58:10 2005// +;- CVS Reference : /RSTC_SAM7X.pl/1.2/Wed Jul 13 14:57:50 2005// +;- CVS Reference : /UDP_SAM7X.pl/1.1/Tue May 10 11:35:35 2005// +;- CVS Reference : /PWM_SAM7X.pl/1.1/Tue May 10 11:53:07 2005// +;- CVS Reference : /AIC_6075B.pl/1.3/Fri May 20 14:01:30 2005// +;- CVS Reference : /PIO_6057A.pl/1.2/Thu Feb 3 10:18:28 2005// +;- CVS Reference : /RTTC_6081A.pl/1.2/Tue Nov 9 14:43:58 2004// +;- CVS Reference : /PITC_6079A.pl/1.2/Tue Nov 9 14:43:56 2004// +;- CVS Reference : /WDTC_6080A.pl/1.3/Tue Nov 9 14:44:00 2004// +;- CVS Reference : /VREG_6085B.pl/1.1/Tue Feb 1 16:05:48 2005// +;- CVS Reference : /PDC_6074C.pl/1.2/Thu Feb 3 08:48:54 2005// +;- CVS Reference : /DBGU_6059D.pl/1.1/Mon Jan 31 13:15:32 2005// +;- CVS Reference : /SPI_6088D.pl/1.3/Fri May 20 14:08:59 2005// +;- CVS Reference : /US_6089C.pl/1.1/Mon Jul 12 18:23:26 2004// +;- CVS Reference : /SSC_6078B.pl/1.1/Wed Jul 13 15:19:19 2005// +;- CVS Reference : /TWI_6061A.pl/1.1/Tue Jul 13 07:38:06 2004// +;- CVS Reference : /TC_6082A.pl/1.7/Fri Mar 11 12:52:17 2005// +;- CVS Reference : /CAN_6019B.pl/1.1/Tue Mar 8 12:42:22 2005// +;- CVS Reference : /EMACB_6119A.pl/1.6/Wed Jul 13 15:05:35 2005// +;- CVS Reference : /ADC_6051C.pl/1.1/Fri Oct 17 09:12:38 2003// +;- ---------------------------------------------------------------------------- + +;- Hardware register definition + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR System Peripherals +;- ***************************************************************************** + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Advanced Interrupt Controller +;- ***************************************************************************** + ^ 0 ;- AT91S_AIC +AIC_SMR # 128 ;- Source Mode Register +AIC_SVR # 128 ;- Source Vector Register +AIC_IVR # 4 ;- IRQ Vector Register +AIC_FVR # 4 ;- FIQ Vector Register +AIC_ISR # 4 ;- Interrupt Status Register +AIC_IPR # 4 ;- Interrupt Pending Register +AIC_IMR # 4 ;- Interrupt Mask Register +AIC_CISR # 4 ;- Core Interrupt Status Register + # 8 ;- Reserved +AIC_IECR # 4 ;- Interrupt Enable Command Register +AIC_IDCR # 4 ;- Interrupt Disable Command Register +AIC_ICCR # 4 ;- Interrupt Clear Command Register +AIC_ISCR # 4 ;- Interrupt Set Command Register +AIC_EOICR # 4 ;- End of Interrupt Command Register +AIC_SPU # 4 ;- Spurious Vector Register +AIC_DCR # 4 ;- Debug Control Register (Protect) + # 4 ;- Reserved +AIC_FFER # 4 ;- Fast Forcing Enable Register +AIC_FFDR # 4 ;- Fast Forcing Disable Register +AIC_FFSR # 4 ;- Fast Forcing Status Register +;- -------- AIC_SMR : (AIC Offset: 0x0) Control Register -------- +AT91C_AIC_PRIOR EQU (0x7:SHL:0) ;- (AIC) Priority Level +AT91C_AIC_PRIOR_LOWEST EQU (0x0) ;- (AIC) Lowest priority level +AT91C_AIC_PRIOR_HIGHEST EQU (0x7) ;- (AIC) Highest priority level +AT91C_AIC_SRCTYPE EQU (0x3:SHL:5) ;- (AIC) Interrupt Source Type +AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL EQU (0x0:SHL:5) ;- (AIC) Internal Sources Code Label High-level Sensitive +AT91C_AIC_SRCTYPE_EXT_LOW_LEVEL EQU (0x0:SHL:5) ;- (AIC) External Sources Code Label Low-level Sensitive +AT91C_AIC_SRCTYPE_INT_POSITIVE_EDGE EQU (0x1:SHL:5) ;- (AIC) Internal Sources Code Label Positive Edge triggered +AT91C_AIC_SRCTYPE_EXT_NEGATIVE_EDGE EQU (0x1:SHL:5) ;- (AIC) External Sources Code Label Negative Edge triggered +AT91C_AIC_SRCTYPE_HIGH_LEVEL EQU (0x2:SHL:5) ;- (AIC) Internal Or External Sources Code Label High-level Sensitive +AT91C_AIC_SRCTYPE_POSITIVE_EDGE EQU (0x3:SHL:5) ;- (AIC) Internal Or External Sources Code Label Positive Edge triggered +;- -------- AIC_CISR : (AIC Offset: 0x114) AIC Core Interrupt Status Register -------- +AT91C_AIC_NFIQ EQU (0x1:SHL:0) ;- (AIC) NFIQ Status +AT91C_AIC_NIRQ EQU (0x1:SHL:1) ;- (AIC) NIRQ Status +;- -------- AIC_DCR : (AIC Offset: 0x138) AIC Debug Control Register (Protect) -------- +AT91C_AIC_DCR_PROT EQU (0x1:SHL:0) ;- (AIC) Protection Mode +AT91C_AIC_DCR_GMSK EQU (0x1:SHL:1) ;- (AIC) General Mask + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Peripheral DMA Controller +;- ***************************************************************************** + ^ 0 ;- AT91S_PDC +PDC_RPR # 4 ;- Receive Pointer Register +PDC_RCR # 4 ;- Receive Counter Register +PDC_TPR # 4 ;- Transmit Pointer Register +PDC_TCR # 4 ;- Transmit Counter Register +PDC_RNPR # 4 ;- Receive Next Pointer Register +PDC_RNCR # 4 ;- Receive Next Counter Register +PDC_TNPR # 4 ;- Transmit Next Pointer Register +PDC_TNCR # 4 ;- Transmit Next Counter Register +PDC_PTCR # 4 ;- PDC Transfer Control Register +PDC_PTSR # 4 ;- PDC Transfer Status Register +;- -------- PDC_PTCR : (PDC Offset: 0x20) PDC Transfer Control Register -------- +AT91C_PDC_RXTEN EQU (0x1:SHL:0) ;- (PDC) Receiver Transfer Enable +AT91C_PDC_RXTDIS EQU (0x1:SHL:1) ;- (PDC) Receiver Transfer Disable +AT91C_PDC_TXTEN EQU (0x1:SHL:8) ;- (PDC) Transmitter Transfer Enable +AT91C_PDC_TXTDIS EQU (0x1:SHL:9) ;- (PDC) Transmitter Transfer Disable +;- -------- PDC_PTSR : (PDC Offset: 0x24) PDC Transfer Status Register -------- + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Debug Unit +;- ***************************************************************************** + ^ 0 ;- AT91S_DBGU +DBGU_CR # 4 ;- Control Register +DBGU_MR # 4 ;- Mode Register +DBGU_IER # 4 ;- Interrupt Enable Register +DBGU_IDR # 4 ;- Interrupt Disable Register +DBGU_IMR # 4 ;- Interrupt Mask Register +DBGU_CSR # 4 ;- Channel Status Register +DBGU_RHR # 4 ;- Receiver Holding Register +DBGU_THR # 4 ;- Transmitter Holding Register +DBGU_BRGR # 4 ;- Baud Rate Generator Register + # 28 ;- Reserved +DBGU_CIDR # 4 ;- Chip ID Register +DBGU_EXID # 4 ;- Chip ID Extension Register +DBGU_FNTR # 4 ;- Force NTRST Register + # 180 ;- Reserved +DBGU_RPR # 4 ;- Receive Pointer Register +DBGU_RCR # 4 ;- Receive Counter Register +DBGU_TPR # 4 ;- Transmit Pointer Register +DBGU_TCR # 4 ;- Transmit Counter Register +DBGU_RNPR # 4 ;- Receive Next Pointer Register +DBGU_RNCR # 4 ;- Receive Next Counter Register +DBGU_TNPR # 4 ;- Transmit Next Pointer Register +DBGU_TNCR # 4 ;- Transmit Next Counter Register +DBGU_PTCR # 4 ;- PDC Transfer Control Register +DBGU_PTSR # 4 ;- PDC Transfer Status Register +;- -------- DBGU_CR : (DBGU Offset: 0x0) Debug Unit Control Register -------- +AT91C_US_RSTRX EQU (0x1:SHL:2) ;- (DBGU) Reset Receiver +AT91C_US_RSTTX EQU (0x1:SHL:3) ;- (DBGU) Reset Transmitter +AT91C_US_RXEN EQU (0x1:SHL:4) ;- (DBGU) Receiver Enable +AT91C_US_RXDIS EQU (0x1:SHL:5) ;- (DBGU) Receiver Disable +AT91C_US_TXEN EQU (0x1:SHL:6) ;- (DBGU) Transmitter Enable +AT91C_US_TXDIS EQU (0x1:SHL:7) ;- (DBGU) Transmitter Disable +AT91C_US_RSTSTA EQU (0x1:SHL:8) ;- (DBGU) Reset Status Bits +;- -------- DBGU_MR : (DBGU Offset: 0x4) Debug Unit Mode Register -------- +AT91C_US_PAR EQU (0x7:SHL:9) ;- (DBGU) Parity type +AT91C_US_PAR_EVEN EQU (0x0:SHL:9) ;- (DBGU) Even Parity +AT91C_US_PAR_ODD EQU (0x1:SHL:9) ;- (DBGU) Odd Parity +AT91C_US_PAR_SPACE EQU (0x2:SHL:9) ;- (DBGU) Parity forced to 0 (Space) +AT91C_US_PAR_MARK EQU (0x3:SHL:9) ;- (DBGU) Parity forced to 1 (Mark) +AT91C_US_PAR_NONE EQU (0x4:SHL:9) ;- (DBGU) No Parity +AT91C_US_PAR_MULTI_DROP EQU (0x6:SHL:9) ;- (DBGU) Multi-drop mode +AT91C_US_CHMODE EQU (0x3:SHL:14) ;- (DBGU) Channel Mode +AT91C_US_CHMODE_NORMAL EQU (0x0:SHL:14) ;- (DBGU) Normal Mode: The USART channel operates as an RX/TX USART. +AT91C_US_CHMODE_AUTO EQU (0x1:SHL:14) ;- (DBGU) Automatic Echo: Receiver Data Input is connected to the TXD pin. +AT91C_US_CHMODE_LOCAL EQU (0x2:SHL:14) ;- (DBGU) Local Loopback: Transmitter Output Signal is connected to Receiver Input Signal. +AT91C_US_CHMODE_REMOTE EQU (0x3:SHL:14) ;- (DBGU) Remote Loopback: RXD pin is internally connected to TXD pin. +;- -------- DBGU_IER : (DBGU Offset: 0x8) Debug Unit Interrupt Enable Register -------- +AT91C_US_RXRDY EQU (0x1:SHL:0) ;- (DBGU) RXRDY Interrupt +AT91C_US_TXRDY EQU (0x1:SHL:1) ;- (DBGU) TXRDY Interrupt +AT91C_US_ENDRX EQU (0x1:SHL:3) ;- (DBGU) End of Receive Transfer Interrupt +AT91C_US_ENDTX EQU (0x1:SHL:4) ;- (DBGU) End of Transmit Interrupt +AT91C_US_OVRE EQU (0x1:SHL:5) ;- (DBGU) Overrun Interrupt +AT91C_US_FRAME EQU (0x1:SHL:6) ;- (DBGU) Framing Error Interrupt +AT91C_US_PARE EQU (0x1:SHL:7) ;- (DBGU) Parity Error Interrupt +AT91C_US_TXEMPTY EQU (0x1:SHL:9) ;- (DBGU) TXEMPTY Interrupt +AT91C_US_TXBUFE EQU (0x1:SHL:11) ;- (DBGU) TXBUFE Interrupt +AT91C_US_RXBUFF EQU (0x1:SHL:12) ;- (DBGU) RXBUFF Interrupt +AT91C_US_COMM_TX EQU (0x1:SHL:30) ;- (DBGU) COMM_TX Interrupt +AT91C_US_COMM_RX EQU (0x1:SHL:31) ;- (DBGU) COMM_RX Interrupt +;- -------- DBGU_IDR : (DBGU Offset: 0xc) Debug Unit Interrupt Disable Register -------- +;- -------- DBGU_IMR : (DBGU Offset: 0x10) Debug Unit Interrupt Mask Register -------- +;- -------- DBGU_CSR : (DBGU Offset: 0x14) Debug Unit Channel Status Register -------- +;- -------- DBGU_FNTR : (DBGU Offset: 0x48) Debug Unit FORCE_NTRST Register -------- +AT91C_US_FORCE_NTRST EQU (0x1:SHL:0) ;- (DBGU) Force NTRST in JTAG + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Parallel Input Output Controler +;- ***************************************************************************** + ^ 0 ;- AT91S_PIO +PIO_PER # 4 ;- PIO Enable Register +PIO_PDR # 4 ;- PIO Disable Register +PIO_PSR # 4 ;- PIO Status Register + # 4 ;- Reserved +PIO_OER # 4 ;- Output Enable Register +PIO_ODR # 4 ;- Output Disable Registerr +PIO_OSR # 4 ;- Output Status Register + # 4 ;- Reserved +PIO_IFER # 4 ;- Input Filter Enable Register +PIO_IFDR # 4 ;- Input Filter Disable Register +PIO_IFSR # 4 ;- Input Filter Status Register + # 4 ;- Reserved +PIO_SODR # 4 ;- Set Output Data Register +PIO_CODR # 4 ;- Clear Output Data Register +PIO_ODSR # 4 ;- Output Data Status Register +PIO_PDSR # 4 ;- Pin Data Status Register +PIO_IER # 4 ;- Interrupt Enable Register +PIO_IDR # 4 ;- Interrupt Disable Register +PIO_IMR # 4 ;- Interrupt Mask Register +PIO_ISR # 4 ;- Interrupt Status Register +PIO_MDER # 4 ;- Multi-driver Enable Register +PIO_MDDR # 4 ;- Multi-driver Disable Register +PIO_MDSR # 4 ;- Multi-driver Status Register + # 4 ;- Reserved +PIO_PPUDR # 4 ;- Pull-up Disable Register +PIO_PPUER # 4 ;- Pull-up Enable Register +PIO_PPUSR # 4 ;- Pull-up Status Register + # 4 ;- Reserved +PIO_ASR # 4 ;- Select A Register +PIO_BSR # 4 ;- Select B Register +PIO_ABSR # 4 ;- AB Select Status Register + # 36 ;- Reserved +PIO_OWER # 4 ;- Output Write Enable Register +PIO_OWDR # 4 ;- Output Write Disable Register +PIO_OWSR # 4 ;- Output Write Status Register + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Clock Generator Controler +;- ***************************************************************************** + ^ 0 ;- AT91S_CKGR +CKGR_MOR # 4 ;- Main Oscillator Register +CKGR_MCFR # 4 ;- Main Clock Frequency Register + # 4 ;- Reserved +CKGR_PLLR # 4 ;- PLL Register +;- -------- CKGR_MOR : (CKGR Offset: 0x0) Main Oscillator Register -------- +AT91C_CKGR_MOSCEN EQU (0x1:SHL:0) ;- (CKGR) Main Oscillator Enable +AT91C_CKGR_OSCBYPASS EQU (0x1:SHL:1) ;- (CKGR) Main Oscillator Bypass +AT91C_CKGR_OSCOUNT EQU (0xFF:SHL:8) ;- (CKGR) Main Oscillator Start-up Time +;- -------- CKGR_MCFR : (CKGR Offset: 0x4) Main Clock Frequency Register -------- +AT91C_CKGR_MAINF EQU (0xFFFF:SHL:0) ;- (CKGR) Main Clock Frequency +AT91C_CKGR_MAINRDY EQU (0x1:SHL:16) ;- (CKGR) Main Clock Ready +;- -------- CKGR_PLLR : (CKGR Offset: 0xc) PLL B Register -------- +AT91C_CKGR_DIV EQU (0xFF:SHL:0) ;- (CKGR) Divider Selected +AT91C_CKGR_DIV_0 EQU (0x0) ;- (CKGR) Divider output is 0 +AT91C_CKGR_DIV_BYPASS EQU (0x1) ;- (CKGR) Divider is bypassed +AT91C_CKGR_PLLCOUNT EQU (0x3F:SHL:8) ;- (CKGR) PLL Counter +AT91C_CKGR_OUT EQU (0x3:SHL:14) ;- (CKGR) PLL Output Frequency Range +AT91C_CKGR_OUT_0 EQU (0x0:SHL:14) ;- (CKGR) Please refer to the PLL datasheet +AT91C_CKGR_OUT_1 EQU (0x1:SHL:14) ;- (CKGR) Please refer to the PLL datasheet +AT91C_CKGR_OUT_2 EQU (0x2:SHL:14) ;- (CKGR) Please refer to the PLL datasheet +AT91C_CKGR_OUT_3 EQU (0x3:SHL:14) ;- (CKGR) Please refer to the PLL datasheet +AT91C_CKGR_MUL EQU (0x7FF:SHL:16) ;- (CKGR) PLL Multiplier +AT91C_CKGR_USBDIV EQU (0x3:SHL:28) ;- (CKGR) Divider for USB Clocks +AT91C_CKGR_USBDIV_0 EQU (0x0:SHL:28) ;- (CKGR) Divider output is PLL clock output +AT91C_CKGR_USBDIV_1 EQU (0x1:SHL:28) ;- (CKGR) Divider output is PLL clock output divided by 2 +AT91C_CKGR_USBDIV_2 EQU (0x2:SHL:28) ;- (CKGR) Divider output is PLL clock output divided by 4 + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Power Management Controler +;- ***************************************************************************** + ^ 0 ;- AT91S_PMC +PMC_SCER # 4 ;- System Clock Enable Register +PMC_SCDR # 4 ;- System Clock Disable Register +PMC_SCSR # 4 ;- System Clock Status Register + # 4 ;- Reserved +PMC_PCER # 4 ;- Peripheral Clock Enable Register +PMC_PCDR # 4 ;- Peripheral Clock Disable Register +PMC_PCSR # 4 ;- Peripheral Clock Status Register + # 4 ;- Reserved +PMC_MOR # 4 ;- Main Oscillator Register +PMC_MCFR # 4 ;- Main Clock Frequency Register + # 4 ;- Reserved +PMC_PLLR # 4 ;- PLL Register +PMC_MCKR # 4 ;- Master Clock Register + # 12 ;- Reserved +PMC_PCKR # 16 ;- Programmable Clock Register + # 16 ;- Reserved +PMC_IER # 4 ;- Interrupt Enable Register +PMC_IDR # 4 ;- Interrupt Disable Register +PMC_SR # 4 ;- Status Register +PMC_IMR # 4 ;- Interrupt Mask Register +;- -------- PMC_SCER : (PMC Offset: 0x0) System Clock Enable Register -------- +AT91C_PMC_PCK EQU (0x1:SHL:0) ;- (PMC) Processor Clock +AT91C_PMC_UDP EQU (0x1:SHL:7) ;- (PMC) USB Device Port Clock +AT91C_PMC_PCK0 EQU (0x1:SHL:8) ;- (PMC) Programmable Clock Output +AT91C_PMC_PCK1 EQU (0x1:SHL:9) ;- (PMC) Programmable Clock Output +AT91C_PMC_PCK2 EQU (0x1:SHL:10) ;- (PMC) Programmable Clock Output +AT91C_PMC_PCK3 EQU (0x1:SHL:11) ;- (PMC) Programmable Clock Output +;- -------- PMC_SCDR : (PMC Offset: 0x4) System Clock Disable Register -------- +;- -------- PMC_SCSR : (PMC Offset: 0x8) System Clock Status Register -------- +;- -------- CKGR_MOR : (PMC Offset: 0x20) Main Oscillator Register -------- +;- -------- CKGR_MCFR : (PMC Offset: 0x24) Main Clock Frequency Register -------- +;- -------- CKGR_PLLR : (PMC Offset: 0x2c) PLL B Register -------- +;- -------- PMC_MCKR : (PMC Offset: 0x30) Master Clock Register -------- +AT91C_PMC_CSS EQU (0x3:SHL:0) ;- (PMC) Programmable Clock Selection +AT91C_PMC_CSS_SLOW_CLK EQU (0x0) ;- (PMC) Slow Clock is selected +AT91C_PMC_CSS_MAIN_CLK EQU (0x1) ;- (PMC) Main Clock is selected +AT91C_PMC_CSS_PLL_CLK EQU (0x3) ;- (PMC) Clock from PLL is selected +AT91C_PMC_PRES EQU (0x7:SHL:2) ;- (PMC) Programmable Clock Prescaler +AT91C_PMC_PRES_CLK EQU (0x0:SHL:2) ;- (PMC) Selected clock +AT91C_PMC_PRES_CLK_2 EQU (0x1:SHL:2) ;- (PMC) Selected clock divided by 2 +AT91C_PMC_PRES_CLK_4 EQU (0x2:SHL:2) ;- (PMC) Selected clock divided by 4 +AT91C_PMC_PRES_CLK_8 EQU (0x3:SHL:2) ;- (PMC) Selected clock divided by 8 +AT91C_PMC_PRES_CLK_16 EQU (0x4:SHL:2) ;- (PMC) Selected clock divided by 16 +AT91C_PMC_PRES_CLK_32 EQU (0x5:SHL:2) ;- (PMC) Selected clock divided by 32 +AT91C_PMC_PRES_CLK_64 EQU (0x6:SHL:2) ;- (PMC) Selected clock divided by 64 +;- -------- PMC_PCKR : (PMC Offset: 0x40) Programmable Clock Register -------- +;- -------- PMC_IER : (PMC Offset: 0x60) PMC Interrupt Enable Register -------- +AT91C_PMC_MOSCS EQU (0x1:SHL:0) ;- (PMC) MOSC Status/Enable/Disable/Mask +AT91C_PMC_LOCK EQU (0x1:SHL:2) ;- (PMC) PLL Status/Enable/Disable/Mask +AT91C_PMC_MCKRDY EQU (0x1:SHL:3) ;- (PMC) MCK_RDY Status/Enable/Disable/Mask +AT91C_PMC_PCK0RDY EQU (0x1:SHL:8) ;- (PMC) PCK0_RDY Status/Enable/Disable/Mask +AT91C_PMC_PCK1RDY EQU (0x1:SHL:9) ;- (PMC) PCK1_RDY Status/Enable/Disable/Mask +AT91C_PMC_PCK2RDY EQU (0x1:SHL:10) ;- (PMC) PCK2_RDY Status/Enable/Disable/Mask +AT91C_PMC_PCK3RDY EQU (0x1:SHL:11) ;- (PMC) PCK3_RDY Status/Enable/Disable/Mask +;- -------- PMC_IDR : (PMC Offset: 0x64) PMC Interrupt Disable Register -------- +;- -------- PMC_SR : (PMC Offset: 0x68) PMC Status Register -------- +;- -------- PMC_IMR : (PMC Offset: 0x6c) PMC Interrupt Mask Register -------- + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Reset Controller Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_RSTC +RSTC_RCR # 4 ;- Reset Control Register +RSTC_RSR # 4 ;- Reset Status Register +RSTC_RMR # 4 ;- Reset Mode Register +;- -------- RSTC_RCR : (RSTC Offset: 0x0) Reset Control Register -------- +AT91C_RSTC_PROCRST EQU (0x1:SHL:0) ;- (RSTC) Processor Reset +AT91C_RSTC_PERRST EQU (0x1:SHL:2) ;- (RSTC) Peripheral Reset +AT91C_RSTC_EXTRST EQU (0x1:SHL:3) ;- (RSTC) External Reset +AT91C_RSTC_KEY EQU (0xFF:SHL:24) ;- (RSTC) Password +;- -------- RSTC_RSR : (RSTC Offset: 0x4) Reset Status Register -------- +AT91C_RSTC_URSTS EQU (0x1:SHL:0) ;- (RSTC) User Reset Status +AT91C_RSTC_BODSTS EQU (0x1:SHL:1) ;- (RSTC) Brownout Detection Status +AT91C_RSTC_RSTTYP EQU (0x7:SHL:8) ;- (RSTC) Reset Type +AT91C_RSTC_RSTTYP_POWERUP EQU (0x0:SHL:8) ;- (RSTC) Power-up Reset. VDDCORE rising. +AT91C_RSTC_RSTTYP_WAKEUP EQU (0x1:SHL:8) ;- (RSTC) WakeUp Reset. VDDCORE rising. +AT91C_RSTC_RSTTYP_WATCHDOG EQU (0x2:SHL:8) ;- (RSTC) Watchdog Reset. Watchdog overflow occured. +AT91C_RSTC_RSTTYP_SOFTWARE EQU (0x3:SHL:8) ;- (RSTC) Software Reset. Processor reset required by the software. +AT91C_RSTC_RSTTYP_USER EQU (0x4:SHL:8) ;- (RSTC) User Reset. NRST pin detected low. +AT91C_RSTC_RSTTYP_BROWNOUT EQU (0x5:SHL:8) ;- (RSTC) Brownout Reset occured. +AT91C_RSTC_NRSTL EQU (0x1:SHL:16) ;- (RSTC) NRST pin level +AT91C_RSTC_SRCMP EQU (0x1:SHL:17) ;- (RSTC) Software Reset Command in Progress. +;- -------- RSTC_RMR : (RSTC Offset: 0x8) Reset Mode Register -------- +AT91C_RSTC_URSTEN EQU (0x1:SHL:0) ;- (RSTC) User Reset Enable +AT91C_RSTC_URSTIEN EQU (0x1:SHL:4) ;- (RSTC) User Reset Interrupt Enable +AT91C_RSTC_ERSTL EQU (0xF:SHL:8) ;- (RSTC) User Reset Length +AT91C_RSTC_BODIEN EQU (0x1:SHL:16) ;- (RSTC) Brownout Detection Interrupt Enable + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Real Time Timer Controller Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_RTTC +RTTC_RTMR # 4 ;- Real-time Mode Register +RTTC_RTAR # 4 ;- Real-time Alarm Register +RTTC_RTVR # 4 ;- Real-time Value Register +RTTC_RTSR # 4 ;- Real-time Status Register +;- -------- RTTC_RTMR : (RTTC Offset: 0x0) Real-time Mode Register -------- +AT91C_RTTC_RTPRES EQU (0xFFFF:SHL:0) ;- (RTTC) Real-time Timer Prescaler Value +AT91C_RTTC_ALMIEN EQU (0x1:SHL:16) ;- (RTTC) Alarm Interrupt Enable +AT91C_RTTC_RTTINCIEN EQU (0x1:SHL:17) ;- (RTTC) Real Time Timer Increment Interrupt Enable +AT91C_RTTC_RTTRST EQU (0x1:SHL:18) ;- (RTTC) Real Time Timer Restart +;- -------- RTTC_RTAR : (RTTC Offset: 0x4) Real-time Alarm Register -------- +AT91C_RTTC_ALMV EQU (0x0:SHL:0) ;- (RTTC) Alarm Value +;- -------- RTTC_RTVR : (RTTC Offset: 0x8) Current Real-time Value Register -------- +AT91C_RTTC_CRTV EQU (0x0:SHL:0) ;- (RTTC) Current Real-time Value +;- -------- RTTC_RTSR : (RTTC Offset: 0xc) Real-time Status Register -------- +AT91C_RTTC_ALMS EQU (0x1:SHL:0) ;- (RTTC) Real-time Alarm Status +AT91C_RTTC_RTTINC EQU (0x1:SHL:1) ;- (RTTC) Real-time Timer Increment + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Periodic Interval Timer Controller Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_PITC +PITC_PIMR # 4 ;- Period Interval Mode Register +PITC_PISR # 4 ;- Period Interval Status Register +PITC_PIVR # 4 ;- Period Interval Value Register +PITC_PIIR # 4 ;- Period Interval Image Register +;- -------- PITC_PIMR : (PITC Offset: 0x0) Periodic Interval Mode Register -------- +AT91C_PITC_PIV EQU (0xFFFFF:SHL:0) ;- (PITC) Periodic Interval Value +AT91C_PITC_PITEN EQU (0x1:SHL:24) ;- (PITC) Periodic Interval Timer Enabled +AT91C_PITC_PITIEN EQU (0x1:SHL:25) ;- (PITC) Periodic Interval Timer Interrupt Enable +;- -------- PITC_PISR : (PITC Offset: 0x4) Periodic Interval Status Register -------- +AT91C_PITC_PITS EQU (0x1:SHL:0) ;- (PITC) Periodic Interval Timer Status +;- -------- PITC_PIVR : (PITC Offset: 0x8) Periodic Interval Value Register -------- +AT91C_PITC_CPIV EQU (0xFFFFF:SHL:0) ;- (PITC) Current Periodic Interval Value +AT91C_PITC_PICNT EQU (0xFFF:SHL:20) ;- (PITC) Periodic Interval Counter +;- -------- PITC_PIIR : (PITC Offset: 0xc) Periodic Interval Image Register -------- + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Watchdog Timer Controller Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_WDTC +WDTC_WDCR # 4 ;- Watchdog Control Register +WDTC_WDMR # 4 ;- Watchdog Mode Register +WDTC_WDSR # 4 ;- Watchdog Status Register +;- -------- WDTC_WDCR : (WDTC Offset: 0x0) Periodic Interval Image Register -------- +AT91C_WDTC_WDRSTT EQU (0x1:SHL:0) ;- (WDTC) Watchdog Restart +AT91C_WDTC_KEY EQU (0xFF:SHL:24) ;- (WDTC) Watchdog KEY Password +;- -------- WDTC_WDMR : (WDTC Offset: 0x4) Watchdog Mode Register -------- +AT91C_WDTC_WDV EQU (0xFFF:SHL:0) ;- (WDTC) Watchdog Timer Restart +AT91C_WDTC_WDFIEN EQU (0x1:SHL:12) ;- (WDTC) Watchdog Fault Interrupt Enable +AT91C_WDTC_WDRSTEN EQU (0x1:SHL:13) ;- (WDTC) Watchdog Reset Enable +AT91C_WDTC_WDRPROC EQU (0x1:SHL:14) ;- (WDTC) Watchdog Timer Restart +AT91C_WDTC_WDDIS EQU (0x1:SHL:15) ;- (WDTC) Watchdog Disable +AT91C_WDTC_WDD EQU (0xFFF:SHL:16) ;- (WDTC) Watchdog Delta Value +AT91C_WDTC_WDDBGHLT EQU (0x1:SHL:28) ;- (WDTC) Watchdog Debug Halt +AT91C_WDTC_WDIDLEHLT EQU (0x1:SHL:29) ;- (WDTC) Watchdog Idle Halt +;- -------- WDTC_WDSR : (WDTC Offset: 0x8) Watchdog Status Register -------- +AT91C_WDTC_WDUNF EQU (0x1:SHL:0) ;- (WDTC) Watchdog Underflow +AT91C_WDTC_WDERR EQU (0x1:SHL:1) ;- (WDTC) Watchdog Error + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Voltage Regulator Mode Controller Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_VREG +VREG_MR # 4 ;- Voltage Regulator Mode Register +;- -------- VREG_MR : (VREG Offset: 0x0) Voltage Regulator Mode Register -------- +AT91C_VREG_PSTDBY EQU (0x1:SHL:0) ;- (VREG) Voltage Regulator Power Standby Mode + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Memory Controller Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_MC +MC_RCR # 4 ;- MC Remap Control Register +MC_ASR # 4 ;- MC Abort Status Register +MC_AASR # 4 ;- MC Abort Address Status Register + # 84 ;- Reserved +MC_FMR # 4 ;- MC Flash Mode Register +MC_FCR # 4 ;- MC Flash Command Register +MC_FSR # 4 ;- MC Flash Status Register +;- -------- MC_RCR : (MC Offset: 0x0) MC Remap Control Register -------- +AT91C_MC_RCB EQU (0x1:SHL:0) ;- (MC) Remap Command Bit +;- -------- MC_ASR : (MC Offset: 0x4) MC Abort Status Register -------- +AT91C_MC_UNDADD EQU (0x1:SHL:0) ;- (MC) Undefined Addess Abort Status +AT91C_MC_MISADD EQU (0x1:SHL:1) ;- (MC) Misaligned Addess Abort Status +AT91C_MC_ABTSZ EQU (0x3:SHL:8) ;- (MC) Abort Size Status +AT91C_MC_ABTSZ_BYTE EQU (0x0:SHL:8) ;- (MC) Byte +AT91C_MC_ABTSZ_HWORD EQU (0x1:SHL:8) ;- (MC) Half-word +AT91C_MC_ABTSZ_WORD EQU (0x2:SHL:8) ;- (MC) Word +AT91C_MC_ABTTYP EQU (0x3:SHL:10) ;- (MC) Abort Type Status +AT91C_MC_ABTTYP_DATAR EQU (0x0:SHL:10) ;- (MC) Data Read +AT91C_MC_ABTTYP_DATAW EQU (0x1:SHL:10) ;- (MC) Data Write +AT91C_MC_ABTTYP_FETCH EQU (0x2:SHL:10) ;- (MC) Code Fetch +AT91C_MC_MST0 EQU (0x1:SHL:16) ;- (MC) Master 0 Abort Source +AT91C_MC_MST1 EQU (0x1:SHL:17) ;- (MC) Master 1 Abort Source +AT91C_MC_SVMST0 EQU (0x1:SHL:24) ;- (MC) Saved Master 0 Abort Source +AT91C_MC_SVMST1 EQU (0x1:SHL:25) ;- (MC) Saved Master 1 Abort Source +;- -------- MC_FMR : (MC Offset: 0x60) MC Flash Mode Register -------- +AT91C_MC_FRDY EQU (0x1:SHL:0) ;- (MC) Flash Ready +AT91C_MC_LOCKE EQU (0x1:SHL:2) ;- (MC) Lock Error +AT91C_MC_PROGE EQU (0x1:SHL:3) ;- (MC) Programming Error +AT91C_MC_NEBP EQU (0x1:SHL:7) ;- (MC) No Erase Before Programming +AT91C_MC_FWS EQU (0x3:SHL:8) ;- (MC) Flash Wait State +AT91C_MC_FWS_0FWS EQU (0x0:SHL:8) ;- (MC) 1 cycle for Read, 2 for Write operations +AT91C_MC_FWS_1FWS EQU (0x1:SHL:8) ;- (MC) 2 cycles for Read, 3 for Write operations +AT91C_MC_FWS_2FWS EQU (0x2:SHL:8) ;- (MC) 3 cycles for Read, 4 for Write operations +AT91C_MC_FWS_3FWS EQU (0x3:SHL:8) ;- (MC) 4 cycles for Read, 4 for Write operations +AT91C_MC_FMCN EQU (0xFF:SHL:16) ;- (MC) Flash Microsecond Cycle Number +;- -------- MC_FCR : (MC Offset: 0x64) MC Flash Command Register -------- +AT91C_MC_FCMD EQU (0xF:SHL:0) ;- (MC) Flash Command +AT91C_MC_FCMD_START_PROG EQU (0x1) ;- (MC) Starts the programming of th epage specified by PAGEN. +AT91C_MC_FCMD_LOCK EQU (0x2) ;- (MC) Starts a lock sequence of the sector defined by the bits 4 to 7 of the field PAGEN. +AT91C_MC_FCMD_PROG_AND_LOCK EQU (0x3) ;- (MC) The lock sequence automatically happens after the programming sequence is completed. +AT91C_MC_FCMD_UNLOCK EQU (0x4) ;- (MC) Starts an unlock sequence of the sector defined by the bits 4 to 7 of the field PAGEN. +AT91C_MC_FCMD_ERASE_ALL EQU (0x8) ;- (MC) Starts the erase of the entire flash.If at least a page is locked, the command is cancelled. +AT91C_MC_FCMD_SET_GP_NVM EQU (0xB) ;- (MC) Set General Purpose NVM bits. +AT91C_MC_FCMD_CLR_GP_NVM EQU (0xD) ;- (MC) Clear General Purpose NVM bits. +AT91C_MC_FCMD_SET_SECURITY EQU (0xF) ;- (MC) Set Security Bit. +AT91C_MC_PAGEN EQU (0x3FF:SHL:8) ;- (MC) Page Number +AT91C_MC_KEY EQU (0xFF:SHL:24) ;- (MC) Writing Protect Key +;- -------- MC_FSR : (MC Offset: 0x68) MC Flash Command Register -------- +AT91C_MC_SECURITY EQU (0x1:SHL:4) ;- (MC) Security Bit Status +AT91C_MC_GPNVM0 EQU (0x1:SHL:8) ;- (MC) Sector 0 Lock Status +AT91C_MC_GPNVM1 EQU (0x1:SHL:9) ;- (MC) Sector 1 Lock Status +AT91C_MC_GPNVM2 EQU (0x1:SHL:10) ;- (MC) Sector 2 Lock Status +AT91C_MC_GPNVM3 EQU (0x1:SHL:11) ;- (MC) Sector 3 Lock Status +AT91C_MC_GPNVM4 EQU (0x1:SHL:12) ;- (MC) Sector 4 Lock Status +AT91C_MC_GPNVM5 EQU (0x1:SHL:13) ;- (MC) Sector 5 Lock Status +AT91C_MC_GPNVM6 EQU (0x1:SHL:14) ;- (MC) Sector 6 Lock Status +AT91C_MC_GPNVM7 EQU (0x1:SHL:15) ;- (MC) Sector 7 Lock Status +AT91C_MC_LOCKS0 EQU (0x1:SHL:16) ;- (MC) Sector 0 Lock Status +AT91C_MC_LOCKS1 EQU (0x1:SHL:17) ;- (MC) Sector 1 Lock Status +AT91C_MC_LOCKS2 EQU (0x1:SHL:18) ;- (MC) Sector 2 Lock Status +AT91C_MC_LOCKS3 EQU (0x1:SHL:19) ;- (MC) Sector 3 Lock Status +AT91C_MC_LOCKS4 EQU (0x1:SHL:20) ;- (MC) Sector 4 Lock Status +AT91C_MC_LOCKS5 EQU (0x1:SHL:21) ;- (MC) Sector 5 Lock Status +AT91C_MC_LOCKS6 EQU (0x1:SHL:22) ;- (MC) Sector 6 Lock Status +AT91C_MC_LOCKS7 EQU (0x1:SHL:23) ;- (MC) Sector 7 Lock Status +AT91C_MC_LOCKS8 EQU (0x1:SHL:24) ;- (MC) Sector 8 Lock Status +AT91C_MC_LOCKS9 EQU (0x1:SHL:25) ;- (MC) Sector 9 Lock Status +AT91C_MC_LOCKS10 EQU (0x1:SHL:26) ;- (MC) Sector 10 Lock Status +AT91C_MC_LOCKS11 EQU (0x1:SHL:27) ;- (MC) Sector 11 Lock Status +AT91C_MC_LOCKS12 EQU (0x1:SHL:28) ;- (MC) Sector 12 Lock Status +AT91C_MC_LOCKS13 EQU (0x1:SHL:29) ;- (MC) Sector 13 Lock Status +AT91C_MC_LOCKS14 EQU (0x1:SHL:30) ;- (MC) Sector 14 Lock Status +AT91C_MC_LOCKS15 EQU (0x1:SHL:31) ;- (MC) Sector 15 Lock Status + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Serial Parallel Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_SPI +SPI_CR # 4 ;- Control Register +SPI_MR # 4 ;- Mode Register +SPI_RDR # 4 ;- Receive Data Register +SPI_TDR # 4 ;- Transmit Data Register +SPI_SR # 4 ;- Status Register +SPI_IER # 4 ;- Interrupt Enable Register +SPI_IDR # 4 ;- Interrupt Disable Register +SPI_IMR # 4 ;- Interrupt Mask Register + # 16 ;- Reserved +SPI_CSR # 16 ;- Chip Select Register + # 192 ;- Reserved +SPI_RPR # 4 ;- Receive Pointer Register +SPI_RCR # 4 ;- Receive Counter Register +SPI_TPR # 4 ;- Transmit Pointer Register +SPI_TCR # 4 ;- Transmit Counter Register +SPI_RNPR # 4 ;- Receive Next Pointer Register +SPI_RNCR # 4 ;- Receive Next Counter Register +SPI_TNPR # 4 ;- Transmit Next Pointer Register +SPI_TNCR # 4 ;- Transmit Next Counter Register +SPI_PTCR # 4 ;- PDC Transfer Control Register +SPI_PTSR # 4 ;- PDC Transfer Status Register +;- -------- SPI_CR : (SPI Offset: 0x0) SPI Control Register -------- +AT91C_SPI_SPIEN EQU (0x1:SHL:0) ;- (SPI) SPI Enable +AT91C_SPI_SPIDIS EQU (0x1:SHL:1) ;- (SPI) SPI Disable +AT91C_SPI_SWRST EQU (0x1:SHL:7) ;- (SPI) SPI Software reset +AT91C_SPI_LASTXFER EQU (0x1:SHL:24) ;- (SPI) SPI Last Transfer +;- -------- SPI_MR : (SPI Offset: 0x4) SPI Mode Register -------- +AT91C_SPI_MSTR EQU (0x1:SHL:0) ;- (SPI) Master/Slave Mode +AT91C_SPI_PS EQU (0x1:SHL:1) ;- (SPI) Peripheral Select +AT91C_SPI_PS_FIXED EQU (0x0:SHL:1) ;- (SPI) Fixed Peripheral Select +AT91C_SPI_PS_VARIABLE EQU (0x1:SHL:1) ;- (SPI) Variable Peripheral Select +AT91C_SPI_PCSDEC EQU (0x1:SHL:2) ;- (SPI) Chip Select Decode +AT91C_SPI_FDIV EQU (0x1:SHL:3) ;- (SPI) Clock Selection +AT91C_SPI_MODFDIS EQU (0x1:SHL:4) ;- (SPI) Mode Fault Detection +AT91C_SPI_LLB EQU (0x1:SHL:7) ;- (SPI) Clock Selection +AT91C_SPI_PCS EQU (0xF:SHL:16) ;- (SPI) Peripheral Chip Select +AT91C_SPI_DLYBCS EQU (0xFF:SHL:24) ;- (SPI) Delay Between Chip Selects +;- -------- SPI_RDR : (SPI Offset: 0x8) Receive Data Register -------- +AT91C_SPI_RD EQU (0xFFFF:SHL:0) ;- (SPI) Receive Data +AT91C_SPI_RPCS EQU (0xF:SHL:16) ;- (SPI) Peripheral Chip Select Status +;- -------- SPI_TDR : (SPI Offset: 0xc) Transmit Data Register -------- +AT91C_SPI_TD EQU (0xFFFF:SHL:0) ;- (SPI) Transmit Data +AT91C_SPI_TPCS EQU (0xF:SHL:16) ;- (SPI) Peripheral Chip Select Status +;- -------- SPI_SR : (SPI Offset: 0x10) Status Register -------- +AT91C_SPI_RDRF EQU (0x1:SHL:0) ;- (SPI) Receive Data Register Full +AT91C_SPI_TDRE EQU (0x1:SHL:1) ;- (SPI) Transmit Data Register Empty +AT91C_SPI_MODF EQU (0x1:SHL:2) ;- (SPI) Mode Fault Error +AT91C_SPI_OVRES EQU (0x1:SHL:3) ;- (SPI) Overrun Error Status +AT91C_SPI_ENDRX EQU (0x1:SHL:4) ;- (SPI) End of Receiver Transfer +AT91C_SPI_ENDTX EQU (0x1:SHL:5) ;- (SPI) End of Receiver Transfer +AT91C_SPI_RXBUFF EQU (0x1:SHL:6) ;- (SPI) RXBUFF Interrupt +AT91C_SPI_TXBUFE EQU (0x1:SHL:7) ;- (SPI) TXBUFE Interrupt +AT91C_SPI_NSSR EQU (0x1:SHL:8) ;- (SPI) NSSR Interrupt +AT91C_SPI_TXEMPTY EQU (0x1:SHL:9) ;- (SPI) TXEMPTY Interrupt +AT91C_SPI_SPIENS EQU (0x1:SHL:16) ;- (SPI) Enable Status +;- -------- SPI_IER : (SPI Offset: 0x14) Interrupt Enable Register -------- +;- -------- SPI_IDR : (SPI Offset: 0x18) Interrupt Disable Register -------- +;- -------- SPI_IMR : (SPI Offset: 0x1c) Interrupt Mask Register -------- +;- -------- SPI_CSR : (SPI Offset: 0x30) Chip Select Register -------- +AT91C_SPI_CPOL EQU (0x1:SHL:0) ;- (SPI) Clock Polarity +AT91C_SPI_NCPHA EQU (0x1:SHL:1) ;- (SPI) Clock Phase +AT91C_SPI_CSAAT EQU (0x1:SHL:3) ;- (SPI) Chip Select Active After Transfer +AT91C_SPI_BITS EQU (0xF:SHL:4) ;- (SPI) Bits Per Transfer +AT91C_SPI_BITS_8 EQU (0x0:SHL:4) ;- (SPI) 8 Bits Per transfer +AT91C_SPI_BITS_9 EQU (0x1:SHL:4) ;- (SPI) 9 Bits Per transfer +AT91C_SPI_BITS_10 EQU (0x2:SHL:4) ;- (SPI) 10 Bits Per transfer +AT91C_SPI_BITS_11 EQU (0x3:SHL:4) ;- (SPI) 11 Bits Per transfer +AT91C_SPI_BITS_12 EQU (0x4:SHL:4) ;- (SPI) 12 Bits Per transfer +AT91C_SPI_BITS_13 EQU (0x5:SHL:4) ;- (SPI) 13 Bits Per transfer +AT91C_SPI_BITS_14 EQU (0x6:SHL:4) ;- (SPI) 14 Bits Per transfer +AT91C_SPI_BITS_15 EQU (0x7:SHL:4) ;- (SPI) 15 Bits Per transfer +AT91C_SPI_BITS_16 EQU (0x8:SHL:4) ;- (SPI) 16 Bits Per transfer +AT91C_SPI_SCBR EQU (0xFF:SHL:8) ;- (SPI) Serial Clock Baud Rate +AT91C_SPI_DLYBS EQU (0xFF:SHL:16) ;- (SPI) Delay Before SPCK +AT91C_SPI_DLYBCT EQU (0xFF:SHL:24) ;- (SPI) Delay Between Consecutive Transfers + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Usart +;- ***************************************************************************** + ^ 0 ;- AT91S_USART +US_CR # 4 ;- Control Register +US_MR # 4 ;- Mode Register +US_IER # 4 ;- Interrupt Enable Register +US_IDR # 4 ;- Interrupt Disable Register +US_IMR # 4 ;- Interrupt Mask Register +US_CSR # 4 ;- Channel Status Register +US_RHR # 4 ;- Receiver Holding Register +US_THR # 4 ;- Transmitter Holding Register +US_BRGR # 4 ;- Baud Rate Generator Register +US_RTOR # 4 ;- Receiver Time-out Register +US_TTGR # 4 ;- Transmitter Time-guard Register + # 20 ;- Reserved +US_FIDI # 4 ;- FI_DI_Ratio Register +US_NER # 4 ;- Nb Errors Register + # 4 ;- Reserved +US_IF # 4 ;- IRDA_FILTER Register + # 176 ;- Reserved +US_RPR # 4 ;- Receive Pointer Register +US_RCR # 4 ;- Receive Counter Register +US_TPR # 4 ;- Transmit Pointer Register +US_TCR # 4 ;- Transmit Counter Register +US_RNPR # 4 ;- Receive Next Pointer Register +US_RNCR # 4 ;- Receive Next Counter Register +US_TNPR # 4 ;- Transmit Next Pointer Register +US_TNCR # 4 ;- Transmit Next Counter Register +US_PTCR # 4 ;- PDC Transfer Control Register +US_PTSR # 4 ;- PDC Transfer Status Register +;- -------- US_CR : (USART Offset: 0x0) Debug Unit Control Register -------- +AT91C_US_STTBRK EQU (0x1:SHL:9) ;- (USART) Start Break +AT91C_US_STPBRK EQU (0x1:SHL:10) ;- (USART) Stop Break +AT91C_US_STTTO EQU (0x1:SHL:11) ;- (USART) Start Time-out +AT91C_US_SENDA EQU (0x1:SHL:12) ;- (USART) Send Address +AT91C_US_RSTIT EQU (0x1:SHL:13) ;- (USART) Reset Iterations +AT91C_US_RSTNACK EQU (0x1:SHL:14) ;- (USART) Reset Non Acknowledge +AT91C_US_RETTO EQU (0x1:SHL:15) ;- (USART) Rearm Time-out +AT91C_US_DTREN EQU (0x1:SHL:16) ;- (USART) Data Terminal ready Enable +AT91C_US_DTRDIS EQU (0x1:SHL:17) ;- (USART) Data Terminal ready Disable +AT91C_US_RTSEN EQU (0x1:SHL:18) ;- (USART) Request to Send enable +AT91C_US_RTSDIS EQU (0x1:SHL:19) ;- (USART) Request to Send Disable +;- -------- US_MR : (USART Offset: 0x4) Debug Unit Mode Register -------- +AT91C_US_USMODE EQU (0xF:SHL:0) ;- (USART) Usart mode +AT91C_US_USMODE_NORMAL EQU (0x0) ;- (USART) Normal +AT91C_US_USMODE_RS485 EQU (0x1) ;- (USART) RS485 +AT91C_US_USMODE_HWHSH EQU (0x2) ;- (USART) Hardware Handshaking +AT91C_US_USMODE_MODEM EQU (0x3) ;- (USART) Modem +AT91C_US_USMODE_ISO7816_0 EQU (0x4) ;- (USART) ISO7816 protocol: T = 0 +AT91C_US_USMODE_ISO7816_1 EQU (0x6) ;- (USART) ISO7816 protocol: T = 1 +AT91C_US_USMODE_IRDA EQU (0x8) ;- (USART) IrDA +AT91C_US_USMODE_SWHSH EQU (0xC) ;- (USART) Software Handshaking +AT91C_US_CLKS EQU (0x3:SHL:4) ;- (USART) Clock Selection (Baud Rate generator Input Clock +AT91C_US_CLKS_CLOCK EQU (0x0:SHL:4) ;- (USART) Clock +AT91C_US_CLKS_FDIV1 EQU (0x1:SHL:4) ;- (USART) fdiv1 +AT91C_US_CLKS_SLOW EQU (0x2:SHL:4) ;- (USART) slow_clock (ARM) +AT91C_US_CLKS_EXT EQU (0x3:SHL:4) ;- (USART) External (SCK) +AT91C_US_CHRL EQU (0x3:SHL:6) ;- (USART) Clock Selection (Baud Rate generator Input Clock +AT91C_US_CHRL_5_BITS EQU (0x0:SHL:6) ;- (USART) Character Length: 5 bits +AT91C_US_CHRL_6_BITS EQU (0x1:SHL:6) ;- (USART) Character Length: 6 bits +AT91C_US_CHRL_7_BITS EQU (0x2:SHL:6) ;- (USART) Character Length: 7 bits +AT91C_US_CHRL_8_BITS EQU (0x3:SHL:6) ;- (USART) Character Length: 8 bits +AT91C_US_SYNC EQU (0x1:SHL:8) ;- (USART) Synchronous Mode Select +AT91C_US_NBSTOP EQU (0x3:SHL:12) ;- (USART) Number of Stop bits +AT91C_US_NBSTOP_1_BIT EQU (0x0:SHL:12) ;- (USART) 1 stop bit +AT91C_US_NBSTOP_15_BIT EQU (0x1:SHL:12) ;- (USART) Asynchronous (SYNC=0) 2 stop bits Synchronous (SYNC=1) 2 stop bits +AT91C_US_NBSTOP_2_BIT EQU (0x2:SHL:12) ;- (USART) 2 stop bits +AT91C_US_MSBF EQU (0x1:SHL:16) ;- (USART) Bit Order +AT91C_US_MODE9 EQU (0x1:SHL:17) ;- (USART) 9-bit Character length +AT91C_US_CKLO EQU (0x1:SHL:18) ;- (USART) Clock Output Select +AT91C_US_OVER EQU (0x1:SHL:19) ;- (USART) Over Sampling Mode +AT91C_US_INACK EQU (0x1:SHL:20) ;- (USART) Inhibit Non Acknowledge +AT91C_US_DSNACK EQU (0x1:SHL:21) ;- (USART) Disable Successive NACK +AT91C_US_MAX_ITER EQU (0x1:SHL:24) ;- (USART) Number of Repetitions +AT91C_US_FILTER EQU (0x1:SHL:28) ;- (USART) Receive Line Filter +;- -------- US_IER : (USART Offset: 0x8) Debug Unit Interrupt Enable Register -------- +AT91C_US_RXBRK EQU (0x1:SHL:2) ;- (USART) Break Received/End of Break +AT91C_US_TIMEOUT EQU (0x1:SHL:8) ;- (USART) Receiver Time-out +AT91C_US_ITERATION EQU (0x1:SHL:10) ;- (USART) Max number of Repetitions Reached +AT91C_US_NACK EQU (0x1:SHL:13) ;- (USART) Non Acknowledge +AT91C_US_RIIC EQU (0x1:SHL:16) ;- (USART) Ring INdicator Input Change Flag +AT91C_US_DSRIC EQU (0x1:SHL:17) ;- (USART) Data Set Ready Input Change Flag +AT91C_US_DCDIC EQU (0x1:SHL:18) ;- (USART) Data Carrier Flag +AT91C_US_CTSIC EQU (0x1:SHL:19) ;- (USART) Clear To Send Input Change Flag +;- -------- US_IDR : (USART Offset: 0xc) Debug Unit Interrupt Disable Register -------- +;- -------- US_IMR : (USART Offset: 0x10) Debug Unit Interrupt Mask Register -------- +;- -------- US_CSR : (USART Offset: 0x14) Debug Unit Channel Status Register -------- +AT91C_US_RI EQU (0x1:SHL:20) ;- (USART) Image of RI Input +AT91C_US_DSR EQU (0x1:SHL:21) ;- (USART) Image of DSR Input +AT91C_US_DCD EQU (0x1:SHL:22) ;- (USART) Image of DCD Input +AT91C_US_CTS EQU (0x1:SHL:23) ;- (USART) Image of CTS Input + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Synchronous Serial Controller Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_SSC +SSC_CR # 4 ;- Control Register +SSC_CMR # 4 ;- Clock Mode Register + # 8 ;- Reserved +SSC_RCMR # 4 ;- Receive Clock ModeRegister +SSC_RFMR # 4 ;- Receive Frame Mode Register +SSC_TCMR # 4 ;- Transmit Clock Mode Register +SSC_TFMR # 4 ;- Transmit Frame Mode Register +SSC_RHR # 4 ;- Receive Holding Register +SSC_THR # 4 ;- Transmit Holding Register + # 8 ;- Reserved +SSC_RSHR # 4 ;- Receive Sync Holding Register +SSC_TSHR # 4 ;- Transmit Sync Holding Register + # 8 ;- Reserved +SSC_SR # 4 ;- Status Register +SSC_IER # 4 ;- Interrupt Enable Register +SSC_IDR # 4 ;- Interrupt Disable Register +SSC_IMR # 4 ;- Interrupt Mask Register + # 176 ;- Reserved +SSC_RPR # 4 ;- Receive Pointer Register +SSC_RCR # 4 ;- Receive Counter Register +SSC_TPR # 4 ;- Transmit Pointer Register +SSC_TCR # 4 ;- Transmit Counter Register +SSC_RNPR # 4 ;- Receive Next Pointer Register +SSC_RNCR # 4 ;- Receive Next Counter Register +SSC_TNPR # 4 ;- Transmit Next Pointer Register +SSC_TNCR # 4 ;- Transmit Next Counter Register +SSC_PTCR # 4 ;- PDC Transfer Control Register +SSC_PTSR # 4 ;- PDC Transfer Status Register +;- -------- SSC_CR : (SSC Offset: 0x0) SSC Control Register -------- +AT91C_SSC_RXEN EQU (0x1:SHL:0) ;- (SSC) Receive Enable +AT91C_SSC_RXDIS EQU (0x1:SHL:1) ;- (SSC) Receive Disable +AT91C_SSC_TXEN EQU (0x1:SHL:8) ;- (SSC) Transmit Enable +AT91C_SSC_TXDIS EQU (0x1:SHL:9) ;- (SSC) Transmit Disable +AT91C_SSC_SWRST EQU (0x1:SHL:15) ;- (SSC) Software Reset +;- -------- SSC_RCMR : (SSC Offset: 0x10) SSC Receive Clock Mode Register -------- +AT91C_SSC_CKS EQU (0x3:SHL:0) ;- (SSC) Receive/Transmit Clock Selection +AT91C_SSC_CKS_DIV EQU (0x0) ;- (SSC) Divided Clock +AT91C_SSC_CKS_TK EQU (0x1) ;- (SSC) TK Clock signal +AT91C_SSC_CKS_RK EQU (0x2) ;- (SSC) RK pin +AT91C_SSC_CKO EQU (0x7:SHL:2) ;- (SSC) Receive/Transmit Clock Output Mode Selection +AT91C_SSC_CKO_NONE EQU (0x0:SHL:2) ;- (SSC) Receive/Transmit Clock Output Mode: None RK pin: Input-only +AT91C_SSC_CKO_CONTINOUS EQU (0x1:SHL:2) ;- (SSC) Continuous Receive/Transmit Clock RK pin: Output +AT91C_SSC_CKO_DATA_TX EQU (0x2:SHL:2) ;- (SSC) Receive/Transmit Clock only during data transfers RK pin: Output +AT91C_SSC_CKI EQU (0x1:SHL:5) ;- (SSC) Receive/Transmit Clock Inversion +AT91C_SSC_CKG EQU (0x3:SHL:6) ;- (SSC) Receive/Transmit Clock Gating Selection +AT91C_SSC_CKG_NONE EQU (0x0:SHL:6) ;- (SSC) Receive/Transmit Clock Gating: None, continuous clock +AT91C_SSC_CKG_LOW EQU (0x1:SHL:6) ;- (SSC) Receive/Transmit Clock enabled only if RF Low +AT91C_SSC_CKG_HIGH EQU (0x2:SHL:6) ;- (SSC) Receive/Transmit Clock enabled only if RF High +AT91C_SSC_START EQU (0xF:SHL:8) ;- (SSC) Receive/Transmit Start Selection +AT91C_SSC_START_CONTINOUS EQU (0x0:SHL:8) ;- (SSC) Continuous, as soon as the receiver is enabled, and immediately after the end of transfer of the previous data. +AT91C_SSC_START_TX EQU (0x1:SHL:8) ;- (SSC) Transmit/Receive start +AT91C_SSC_START_LOW_RF EQU (0x2:SHL:8) ;- (SSC) Detection of a low level on RF input +AT91C_SSC_START_HIGH_RF EQU (0x3:SHL:8) ;- (SSC) Detection of a high level on RF input +AT91C_SSC_START_FALL_RF EQU (0x4:SHL:8) ;- (SSC) Detection of a falling edge on RF input +AT91C_SSC_START_RISE_RF EQU (0x5:SHL:8) ;- (SSC) Detection of a rising edge on RF input +AT91C_SSC_START_LEVEL_RF EQU (0x6:SHL:8) ;- (SSC) Detection of any level change on RF input +AT91C_SSC_START_EDGE_RF EQU (0x7:SHL:8) ;- (SSC) Detection of any edge on RF input +AT91C_SSC_START_0 EQU (0x8:SHL:8) ;- (SSC) Compare 0 +AT91C_SSC_STOP EQU (0x1:SHL:12) ;- (SSC) Receive Stop Selection +AT91C_SSC_STTDLY EQU (0xFF:SHL:16) ;- (SSC) Receive/Transmit Start Delay +AT91C_SSC_PERIOD EQU (0xFF:SHL:24) ;- (SSC) Receive/Transmit Period Divider Selection +;- -------- SSC_RFMR : (SSC Offset: 0x14) SSC Receive Frame Mode Register -------- +AT91C_SSC_DATLEN EQU (0x1F:SHL:0) ;- (SSC) Data Length +AT91C_SSC_LOOP EQU (0x1:SHL:5) ;- (SSC) Loop Mode +AT91C_SSC_MSBF EQU (0x1:SHL:7) ;- (SSC) Most Significant Bit First +AT91C_SSC_DATNB EQU (0xF:SHL:8) ;- (SSC) Data Number per Frame +AT91C_SSC_FSLEN EQU (0xF:SHL:16) ;- (SSC) Receive/Transmit Frame Sync length +AT91C_SSC_FSOS EQU (0x7:SHL:20) ;- (SSC) Receive/Transmit Frame Sync Output Selection +AT91C_SSC_FSOS_NONE EQU (0x0:SHL:20) ;- (SSC) Selected Receive/Transmit Frame Sync Signal: None RK pin Input-only +AT91C_SSC_FSOS_NEGATIVE EQU (0x1:SHL:20) ;- (SSC) Selected Receive/Transmit Frame Sync Signal: Negative Pulse +AT91C_SSC_FSOS_POSITIVE EQU (0x2:SHL:20) ;- (SSC) Selected Receive/Transmit Frame Sync Signal: Positive Pulse +AT91C_SSC_FSOS_LOW EQU (0x3:SHL:20) ;- (SSC) Selected Receive/Transmit Frame Sync Signal: Driver Low during data transfer +AT91C_SSC_FSOS_HIGH EQU (0x4:SHL:20) ;- (SSC) Selected Receive/Transmit Frame Sync Signal: Driver High during data transfer +AT91C_SSC_FSOS_TOGGLE EQU (0x5:SHL:20) ;- (SSC) Selected Receive/Transmit Frame Sync Signal: Toggling at each start of data transfer +AT91C_SSC_FSEDGE EQU (0x1:SHL:24) ;- (SSC) Frame Sync Edge Detection +;- -------- SSC_TCMR : (SSC Offset: 0x18) SSC Transmit Clock Mode Register -------- +;- -------- SSC_TFMR : (SSC Offset: 0x1c) SSC Transmit Frame Mode Register -------- +AT91C_SSC_DATDEF EQU (0x1:SHL:5) ;- (SSC) Data Default Value +AT91C_SSC_FSDEN EQU (0x1:SHL:23) ;- (SSC) Frame Sync Data Enable +;- -------- SSC_SR : (SSC Offset: 0x40) SSC Status Register -------- +AT91C_SSC_TXRDY EQU (0x1:SHL:0) ;- (SSC) Transmit Ready +AT91C_SSC_TXEMPTY EQU (0x1:SHL:1) ;- (SSC) Transmit Empty +AT91C_SSC_ENDTX EQU (0x1:SHL:2) ;- (SSC) End Of Transmission +AT91C_SSC_TXBUFE EQU (0x1:SHL:3) ;- (SSC) Transmit Buffer Empty +AT91C_SSC_RXRDY EQU (0x1:SHL:4) ;- (SSC) Receive Ready +AT91C_SSC_OVRUN EQU (0x1:SHL:5) ;- (SSC) Receive Overrun +AT91C_SSC_ENDRX EQU (0x1:SHL:6) ;- (SSC) End of Reception +AT91C_SSC_RXBUFF EQU (0x1:SHL:7) ;- (SSC) Receive Buffer Full +AT91C_SSC_CP0 EQU (0x1:SHL:8) ;- (SSC) Compare 0 +AT91C_SSC_CP1 EQU (0x1:SHL:9) ;- (SSC) Compare 1 +AT91C_SSC_TXSYN EQU (0x1:SHL:10) ;- (SSC) Transmit Sync +AT91C_SSC_RXSYN EQU (0x1:SHL:11) ;- (SSC) Receive Sync +AT91C_SSC_TXENA EQU (0x1:SHL:16) ;- (SSC) Transmit Enable +AT91C_SSC_RXENA EQU (0x1:SHL:17) ;- (SSC) Receive Enable +;- -------- SSC_IER : (SSC Offset: 0x44) SSC Interrupt Enable Register -------- +;- -------- SSC_IDR : (SSC Offset: 0x48) SSC Interrupt Disable Register -------- +;- -------- SSC_IMR : (SSC Offset: 0x4c) SSC Interrupt Mask Register -------- + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Two-wire Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_TWI +TWI_CR # 4 ;- Control Register +TWI_MMR # 4 ;- Master Mode Register + # 4 ;- Reserved +TWI_IADR # 4 ;- Internal Address Register +TWI_CWGR # 4 ;- Clock Waveform Generator Register + # 12 ;- Reserved +TWI_SR # 4 ;- Status Register +TWI_IER # 4 ;- Interrupt Enable Register +TWI_IDR # 4 ;- Interrupt Disable Register +TWI_IMR # 4 ;- Interrupt Mask Register +TWI_RHR # 4 ;- Receive Holding Register +TWI_THR # 4 ;- Transmit Holding Register +;- -------- TWI_CR : (TWI Offset: 0x0) TWI Control Register -------- +AT91C_TWI_START EQU (0x1:SHL:0) ;- (TWI) Send a START Condition +AT91C_TWI_STOP EQU (0x1:SHL:1) ;- (TWI) Send a STOP Condition +AT91C_TWI_MSEN EQU (0x1:SHL:2) ;- (TWI) TWI Master Transfer Enabled +AT91C_TWI_MSDIS EQU (0x1:SHL:3) ;- (TWI) TWI Master Transfer Disabled +AT91C_TWI_SWRST EQU (0x1:SHL:7) ;- (TWI) Software Reset +;- -------- TWI_MMR : (TWI Offset: 0x4) TWI Master Mode Register -------- +AT91C_TWI_IADRSZ EQU (0x3:SHL:8) ;- (TWI) Internal Device Address Size +AT91C_TWI_IADRSZ_NO EQU (0x0:SHL:8) ;- (TWI) No internal device address +AT91C_TWI_IADRSZ_1_BYTE EQU (0x1:SHL:8) ;- (TWI) One-byte internal device address +AT91C_TWI_IADRSZ_2_BYTE EQU (0x2:SHL:8) ;- (TWI) Two-byte internal device address +AT91C_TWI_IADRSZ_3_BYTE EQU (0x3:SHL:8) ;- (TWI) Three-byte internal device address +AT91C_TWI_MREAD EQU (0x1:SHL:12) ;- (TWI) Master Read Direction +AT91C_TWI_DADR EQU (0x7F:SHL:16) ;- (TWI) Device Address +;- -------- TWI_CWGR : (TWI Offset: 0x10) TWI Clock Waveform Generator Register -------- +AT91C_TWI_CLDIV EQU (0xFF:SHL:0) ;- (TWI) Clock Low Divider +AT91C_TWI_CHDIV EQU (0xFF:SHL:8) ;- (TWI) Clock High Divider +AT91C_TWI_CKDIV EQU (0x7:SHL:16) ;- (TWI) Clock Divider +;- -------- TWI_SR : (TWI Offset: 0x20) TWI Status Register -------- +AT91C_TWI_TXCOMP EQU (0x1:SHL:0) ;- (TWI) Transmission Completed +AT91C_TWI_RXRDY EQU (0x1:SHL:1) ;- (TWI) Receive holding register ReaDY +AT91C_TWI_TXRDY EQU (0x1:SHL:2) ;- (TWI) Transmit holding register ReaDY +AT91C_TWI_OVRE EQU (0x1:SHL:6) ;- (TWI) Overrun Error +AT91C_TWI_UNRE EQU (0x1:SHL:7) ;- (TWI) Underrun Error +AT91C_TWI_NACK EQU (0x1:SHL:8) ;- (TWI) Not Acknowledged +;- -------- TWI_IER : (TWI Offset: 0x24) TWI Interrupt Enable Register -------- +;- -------- TWI_IDR : (TWI Offset: 0x28) TWI Interrupt Disable Register -------- +;- -------- TWI_IMR : (TWI Offset: 0x2c) TWI Interrupt Mask Register -------- + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR PWMC Channel Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_PWMC_CH +PWMC_CMR # 4 ;- Channel Mode Register +PWMC_CDTYR # 4 ;- Channel Duty Cycle Register +PWMC_CPRDR # 4 ;- Channel Period Register +PWMC_CCNTR # 4 ;- Channel Counter Register +PWMC_CUPDR # 4 ;- Channel Update Register +PWMC_Reserved # 12 ;- Reserved +;- -------- PWMC_CMR : (PWMC_CH Offset: 0x0) PWMC Channel Mode Register -------- +AT91C_PWMC_CPRE EQU (0xF:SHL:0) ;- (PWMC_CH) Channel Pre-scaler : PWMC_CLKx +AT91C_PWMC_CPRE_MCK EQU (0x0) ;- (PWMC_CH) +AT91C_PWMC_CPRE_MCKA EQU (0xB) ;- (PWMC_CH) +AT91C_PWMC_CPRE_MCKB EQU (0xC) ;- (PWMC_CH) +AT91C_PWMC_CALG EQU (0x1:SHL:8) ;- (PWMC_CH) Channel Alignment +AT91C_PWMC_CPOL EQU (0x1:SHL:9) ;- (PWMC_CH) Channel Polarity +AT91C_PWMC_CPD EQU (0x1:SHL:10) ;- (PWMC_CH) Channel Update Period +;- -------- PWMC_CDTYR : (PWMC_CH Offset: 0x4) PWMC Channel Duty Cycle Register -------- +AT91C_PWMC_CDTY EQU (0x0:SHL:0) ;- (PWMC_CH) Channel Duty Cycle +;- -------- PWMC_CPRDR : (PWMC_CH Offset: 0x8) PWMC Channel Period Register -------- +AT91C_PWMC_CPRD EQU (0x0:SHL:0) ;- (PWMC_CH) Channel Period +;- -------- PWMC_CCNTR : (PWMC_CH Offset: 0xc) PWMC Channel Counter Register -------- +AT91C_PWMC_CCNT EQU (0x0:SHL:0) ;- (PWMC_CH) Channel Counter +;- -------- PWMC_CUPDR : (PWMC_CH Offset: 0x10) PWMC Channel Update Register -------- +AT91C_PWMC_CUPD EQU (0x0:SHL:0) ;- (PWMC_CH) Channel Update + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Pulse Width Modulation Controller Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_PWMC +PWMC_MR # 4 ;- PWMC Mode Register +PWMC_ENA # 4 ;- PWMC Enable Register +PWMC_DIS # 4 ;- PWMC Disable Register +PWMC_SR # 4 ;- PWMC Status Register +PWMC_IER # 4 ;- PWMC Interrupt Enable Register +PWMC_IDR # 4 ;- PWMC Interrupt Disable Register +PWMC_IMR # 4 ;- PWMC Interrupt Mask Register +PWMC_ISR # 4 ;- PWMC Interrupt Status Register + # 220 ;- Reserved +PWMC_VR # 4 ;- PWMC Version Register + # 256 ;- Reserved +PWMC_CH # 96 ;- PWMC Channel +;- -------- PWMC_MR : (PWMC Offset: 0x0) PWMC Mode Register -------- +AT91C_PWMC_DIVA EQU (0xFF:SHL:0) ;- (PWMC) CLKA divide factor. +AT91C_PWMC_PREA EQU (0xF:SHL:8) ;- (PWMC) Divider Input Clock Prescaler A +AT91C_PWMC_PREA_MCK EQU (0x0:SHL:8) ;- (PWMC) +AT91C_PWMC_DIVB EQU (0xFF:SHL:16) ;- (PWMC) CLKB divide factor. +AT91C_PWMC_PREB EQU (0xF:SHL:24) ;- (PWMC) Divider Input Clock Prescaler B +AT91C_PWMC_PREB_MCK EQU (0x0:SHL:24) ;- (PWMC) +;- -------- PWMC_ENA : (PWMC Offset: 0x4) PWMC Enable Register -------- +AT91C_PWMC_CHID0 EQU (0x1:SHL:0) ;- (PWMC) Channel ID 0 +AT91C_PWMC_CHID1 EQU (0x1:SHL:1) ;- (PWMC) Channel ID 1 +AT91C_PWMC_CHID2 EQU (0x1:SHL:2) ;- (PWMC) Channel ID 2 +AT91C_PWMC_CHID3 EQU (0x1:SHL:3) ;- (PWMC) Channel ID 3 +;- -------- PWMC_DIS : (PWMC Offset: 0x8) PWMC Disable Register -------- +;- -------- PWMC_SR : (PWMC Offset: 0xc) PWMC Status Register -------- +;- -------- PWMC_IER : (PWMC Offset: 0x10) PWMC Interrupt Enable Register -------- +;- -------- PWMC_IDR : (PWMC Offset: 0x14) PWMC Interrupt Disable Register -------- +;- -------- PWMC_IMR : (PWMC Offset: 0x18) PWMC Interrupt Mask Register -------- +;- -------- PWMC_ISR : (PWMC Offset: 0x1c) PWMC Interrupt Status Register -------- + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR USB Device Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_UDP +UDP_NUM # 4 ;- Frame Number Register +UDP_GLBSTATE # 4 ;- Global State Register +UDP_FADDR # 4 ;- Function Address Register + # 4 ;- Reserved +UDP_IER # 4 ;- Interrupt Enable Register +UDP_IDR # 4 ;- Interrupt Disable Register +UDP_IMR # 4 ;- Interrupt Mask Register +UDP_ISR # 4 ;- Interrupt Status Register +UDP_ICR # 4 ;- Interrupt Clear Register + # 4 ;- Reserved +UDP_RSTEP # 4 ;- Reset Endpoint Register + # 4 ;- Reserved +UDP_CSR # 24 ;- Endpoint Control and Status Register + # 8 ;- Reserved +UDP_FDR # 24 ;- Endpoint FIFO Data Register + # 12 ;- Reserved +UDP_TXVC # 4 ;- Transceiver Control Register +;- -------- UDP_FRM_NUM : (UDP Offset: 0x0) USB Frame Number Register -------- +AT91C_UDP_FRM_NUM EQU (0x7FF:SHL:0) ;- (UDP) Frame Number as Defined in the Packet Field Formats +AT91C_UDP_FRM_ERR EQU (0x1:SHL:16) ;- (UDP) Frame Error +AT91C_UDP_FRM_OK EQU (0x1:SHL:17) ;- (UDP) Frame OK +;- -------- UDP_GLB_STATE : (UDP Offset: 0x4) USB Global State Register -------- +AT91C_UDP_FADDEN EQU (0x1:SHL:0) ;- (UDP) Function Address Enable +AT91C_UDP_CONFG EQU (0x1:SHL:1) ;- (UDP) Configured +AT91C_UDP_ESR EQU (0x1:SHL:2) ;- (UDP) Enable Send Resume +AT91C_UDP_RSMINPR EQU (0x1:SHL:3) ;- (UDP) A Resume Has Been Sent to the Host +AT91C_UDP_RMWUPE EQU (0x1:SHL:4) ;- (UDP) Remote Wake Up Enable +;- -------- UDP_FADDR : (UDP Offset: 0x8) USB Function Address Register -------- +AT91C_UDP_FADD EQU (0xFF:SHL:0) ;- (UDP) Function Address Value +AT91C_UDP_FEN EQU (0x1:SHL:8) ;- (UDP) Function Enable +;- -------- UDP_IER : (UDP Offset: 0x10) USB Interrupt Enable Register -------- +AT91C_UDP_EPINT0 EQU (0x1:SHL:0) ;- (UDP) Endpoint 0 Interrupt +AT91C_UDP_EPINT1 EQU (0x1:SHL:1) ;- (UDP) Endpoint 0 Interrupt +AT91C_UDP_EPINT2 EQU (0x1:SHL:2) ;- (UDP) Endpoint 2 Interrupt +AT91C_UDP_EPINT3 EQU (0x1:SHL:3) ;- (UDP) Endpoint 3 Interrupt +AT91C_UDP_EPINT4 EQU (0x1:SHL:4) ;- (UDP) Endpoint 4 Interrupt +AT91C_UDP_EPINT5 EQU (0x1:SHL:5) ;- (UDP) Endpoint 5 Interrupt +AT91C_UDP_RXSUSP EQU (0x1:SHL:8) ;- (UDP) USB Suspend Interrupt +AT91C_UDP_RXRSM EQU (0x1:SHL:9) ;- (UDP) USB Resume Interrupt +AT91C_UDP_EXTRSM EQU (0x1:SHL:10) ;- (UDP) USB External Resume Interrupt +AT91C_UDP_SOFINT EQU (0x1:SHL:11) ;- (UDP) USB Start Of frame Interrupt +AT91C_UDP_WAKEUP EQU (0x1:SHL:13) ;- (UDP) USB Resume Interrupt +;- -------- UDP_IDR : (UDP Offset: 0x14) USB Interrupt Disable Register -------- +;- -------- UDP_IMR : (UDP Offset: 0x18) USB Interrupt Mask Register -------- +;- -------- UDP_ISR : (UDP Offset: 0x1c) USB Interrupt Status Register -------- +AT91C_UDP_ENDBUSRES EQU (0x1:SHL:12) ;- (UDP) USB End Of Bus Reset Interrupt +;- -------- UDP_ICR : (UDP Offset: 0x20) USB Interrupt Clear Register -------- +;- -------- UDP_RST_EP : (UDP Offset: 0x28) USB Reset Endpoint Register -------- +AT91C_UDP_EP0 EQU (0x1:SHL:0) ;- (UDP) Reset Endpoint 0 +AT91C_UDP_EP1 EQU (0x1:SHL:1) ;- (UDP) Reset Endpoint 1 +AT91C_UDP_EP2 EQU (0x1:SHL:2) ;- (UDP) Reset Endpoint 2 +AT91C_UDP_EP3 EQU (0x1:SHL:3) ;- (UDP) Reset Endpoint 3 +AT91C_UDP_EP4 EQU (0x1:SHL:4) ;- (UDP) Reset Endpoint 4 +AT91C_UDP_EP5 EQU (0x1:SHL:5) ;- (UDP) Reset Endpoint 5 +;- -------- UDP_CSR : (UDP Offset: 0x30) USB Endpoint Control and Status Register -------- +AT91C_UDP_TXCOMP EQU (0x1:SHL:0) ;- (UDP) Generates an IN packet with data previously written in the DPR +AT91C_UDP_RX_DATA_BK0 EQU (0x1:SHL:1) ;- (UDP) Receive Data Bank 0 +AT91C_UDP_RXSETUP EQU (0x1:SHL:2) ;- (UDP) Sends STALL to the Host (Control endpoints) +AT91C_UDP_ISOERROR EQU (0x1:SHL:3) ;- (UDP) Isochronous error (Isochronous endpoints) +AT91C_UDP_TXPKTRDY EQU (0x1:SHL:4) ;- (UDP) Transmit Packet Ready +AT91C_UDP_FORCESTALL EQU (0x1:SHL:5) ;- (UDP) Force Stall (used by Control, Bulk and Isochronous endpoints). +AT91C_UDP_RX_DATA_BK1 EQU (0x1:SHL:6) ;- (UDP) Receive Data Bank 1 (only used by endpoints with ping-pong attributes). +AT91C_UDP_DIR EQU (0x1:SHL:7) ;- (UDP) Transfer Direction +AT91C_UDP_EPTYPE EQU (0x7:SHL:8) ;- (UDP) Endpoint type +AT91C_UDP_EPTYPE_CTRL EQU (0x0:SHL:8) ;- (UDP) Control +AT91C_UDP_EPTYPE_ISO_OUT EQU (0x1:SHL:8) ;- (UDP) Isochronous OUT +AT91C_UDP_EPTYPE_BULK_OUT EQU (0x2:SHL:8) ;- (UDP) Bulk OUT +AT91C_UDP_EPTYPE_INT_OUT EQU (0x3:SHL:8) ;- (UDP) Interrupt OUT +AT91C_UDP_EPTYPE_ISO_IN EQU (0x5:SHL:8) ;- (UDP) Isochronous IN +AT91C_UDP_EPTYPE_BULK_IN EQU (0x6:SHL:8) ;- (UDP) Bulk IN +AT91C_UDP_EPTYPE_INT_IN EQU (0x7:SHL:8) ;- (UDP) Interrupt IN +AT91C_UDP_DTGLE EQU (0x1:SHL:11) ;- (UDP) Data Toggle +AT91C_UDP_EPEDS EQU (0x1:SHL:15) ;- (UDP) Endpoint Enable Disable +AT91C_UDP_RXBYTECNT EQU (0x7FF:SHL:16) ;- (UDP) Number Of Bytes Available in the FIFO +;- -------- UDP_TXVC : (UDP Offset: 0x74) Transceiver Control Register -------- +AT91C_UDP_TXVDIS EQU (0x1:SHL:8) ;- (UDP) +AT91C_UDP_PUON EQU (0x1:SHL:9) ;- (UDP) Pull-up ON + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Timer Counter Channel Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_TC +TC_CCR # 4 ;- Channel Control Register +TC_CMR # 4 ;- Channel Mode Register (Capture Mode / Waveform Mode) + # 8 ;- Reserved +TC_CV # 4 ;- Counter Value +TC_RA # 4 ;- Register A +TC_RB # 4 ;- Register B +TC_RC # 4 ;- Register C +TC_SR # 4 ;- Status Register +TC_IER # 4 ;- Interrupt Enable Register +TC_IDR # 4 ;- Interrupt Disable Register +TC_IMR # 4 ;- Interrupt Mask Register +;- -------- TC_CCR : (TC Offset: 0x0) TC Channel Control Register -------- +AT91C_TC_CLKEN EQU (0x1:SHL:0) ;- (TC) Counter Clock Enable Command +AT91C_TC_CLKDIS EQU (0x1:SHL:1) ;- (TC) Counter Clock Disable Command +AT91C_TC_SWTRG EQU (0x1:SHL:2) ;- (TC) Software Trigger Command +;- -------- TC_CMR : (TC Offset: 0x4) TC Channel Mode Register: Capture Mode / Waveform Mode -------- +AT91C_TC_CLKS EQU (0x7:SHL:0) ;- (TC) Clock Selection +AT91C_TC_CLKS_TIMER_DIV1_CLOCK EQU (0x0) ;- (TC) Clock selected: TIMER_DIV1_CLOCK +AT91C_TC_CLKS_TIMER_DIV2_CLOCK EQU (0x1) ;- (TC) Clock selected: TIMER_DIV2_CLOCK +AT91C_TC_CLKS_TIMER_DIV3_CLOCK EQU (0x2) ;- (TC) Clock selected: TIMER_DIV3_CLOCK +AT91C_TC_CLKS_TIMER_DIV4_CLOCK EQU (0x3) ;- (TC) Clock selected: TIMER_DIV4_CLOCK +AT91C_TC_CLKS_TIMER_DIV5_CLOCK EQU (0x4) ;- (TC) Clock selected: TIMER_DIV5_CLOCK +AT91C_TC_CLKS_XC0 EQU (0x5) ;- (TC) Clock selected: XC0 +AT91C_TC_CLKS_XC1 EQU (0x6) ;- (TC) Clock selected: XC1 +AT91C_TC_CLKS_XC2 EQU (0x7) ;- (TC) Clock selected: XC2 +AT91C_TC_CLKI EQU (0x1:SHL:3) ;- (TC) Clock Invert +AT91C_TC_BURST EQU (0x3:SHL:4) ;- (TC) Burst Signal Selection +AT91C_TC_BURST_NONE EQU (0x0:SHL:4) ;- (TC) The clock is not gated by an external signal +AT91C_TC_BURST_XC0 EQU (0x1:SHL:4) ;- (TC) XC0 is ANDed with the selected clock +AT91C_TC_BURST_XC1 EQU (0x2:SHL:4) ;- (TC) XC1 is ANDed with the selected clock +AT91C_TC_BURST_XC2 EQU (0x3:SHL:4) ;- (TC) XC2 is ANDed with the selected clock +AT91C_TC_CPCSTOP EQU (0x1:SHL:6) ;- (TC) Counter Clock Stopped with RC Compare +AT91C_TC_LDBSTOP EQU (0x1:SHL:6) ;- (TC) Counter Clock Stopped with RB Loading +AT91C_TC_CPCDIS EQU (0x1:SHL:7) ;- (TC) Counter Clock Disable with RC Compare +AT91C_TC_LDBDIS EQU (0x1:SHL:7) ;- (TC) Counter Clock Disabled with RB Loading +AT91C_TC_ETRGEDG EQU (0x3:SHL:8) ;- (TC) External Trigger Edge Selection +AT91C_TC_ETRGEDG_NONE EQU (0x0:SHL:8) ;- (TC) Edge: None +AT91C_TC_ETRGEDG_RISING EQU (0x1:SHL:8) ;- (TC) Edge: rising edge +AT91C_TC_ETRGEDG_FALLING EQU (0x2:SHL:8) ;- (TC) Edge: falling edge +AT91C_TC_ETRGEDG_BOTH EQU (0x3:SHL:8) ;- (TC) Edge: each edge +AT91C_TC_EEVTEDG EQU (0x3:SHL:8) ;- (TC) External Event Edge Selection +AT91C_TC_EEVTEDG_NONE EQU (0x0:SHL:8) ;- (TC) Edge: None +AT91C_TC_EEVTEDG_RISING EQU (0x1:SHL:8) ;- (TC) Edge: rising edge +AT91C_TC_EEVTEDG_FALLING EQU (0x2:SHL:8) ;- (TC) Edge: falling edge +AT91C_TC_EEVTEDG_BOTH EQU (0x3:SHL:8) ;- (TC) Edge: each edge +AT91C_TC_EEVT EQU (0x3:SHL:10) ;- (TC) External Event Selection +AT91C_TC_EEVT_TIOB EQU (0x0:SHL:10) ;- (TC) Signal selected as external event: TIOB TIOB direction: input +AT91C_TC_EEVT_XC0 EQU (0x1:SHL:10) ;- (TC) Signal selected as external event: XC0 TIOB direction: output +AT91C_TC_EEVT_XC1 EQU (0x2:SHL:10) ;- (TC) Signal selected as external event: XC1 TIOB direction: output +AT91C_TC_EEVT_XC2 EQU (0x3:SHL:10) ;- (TC) Signal selected as external event: XC2 TIOB direction: output +AT91C_TC_ABETRG EQU (0x1:SHL:10) ;- (TC) TIOA or TIOB External Trigger Selection +AT91C_TC_ENETRG EQU (0x1:SHL:12) ;- (TC) External Event Trigger enable +AT91C_TC_WAVESEL EQU (0x3:SHL:13) ;- (TC) Waveform Selection +AT91C_TC_WAVESEL_UP EQU (0x0:SHL:13) ;- (TC) UP mode without atomatic trigger on RC Compare +AT91C_TC_WAVESEL_UPDOWN EQU (0x1:SHL:13) ;- (TC) UPDOWN mode without automatic trigger on RC Compare +AT91C_TC_WAVESEL_UP_AUTO EQU (0x2:SHL:13) ;- (TC) UP mode with automatic trigger on RC Compare +AT91C_TC_WAVESEL_UPDOWN_AUTO EQU (0x3:SHL:13) ;- (TC) UPDOWN mode with automatic trigger on RC Compare +AT91C_TC_CPCTRG EQU (0x1:SHL:14) ;- (TC) RC Compare Trigger Enable +AT91C_TC_WAVE EQU (0x1:SHL:15) ;- (TC) +AT91C_TC_ACPA EQU (0x3:SHL:16) ;- (TC) RA Compare Effect on TIOA +AT91C_TC_ACPA_NONE EQU (0x0:SHL:16) ;- (TC) Effect: none +AT91C_TC_ACPA_SET EQU (0x1:SHL:16) ;- (TC) Effect: set +AT91C_TC_ACPA_CLEAR EQU (0x2:SHL:16) ;- (TC) Effect: clear +AT91C_TC_ACPA_TOGGLE EQU (0x3:SHL:16) ;- (TC) Effect: toggle +AT91C_TC_LDRA EQU (0x3:SHL:16) ;- (TC) RA Loading Selection +AT91C_TC_LDRA_NONE EQU (0x0:SHL:16) ;- (TC) Edge: None +AT91C_TC_LDRA_RISING EQU (0x1:SHL:16) ;- (TC) Edge: rising edge of TIOA +AT91C_TC_LDRA_FALLING EQU (0x2:SHL:16) ;- (TC) Edge: falling edge of TIOA +AT91C_TC_LDRA_BOTH EQU (0x3:SHL:16) ;- (TC) Edge: each edge of TIOA +AT91C_TC_ACPC EQU (0x3:SHL:18) ;- (TC) RC Compare Effect on TIOA +AT91C_TC_ACPC_NONE EQU (0x0:SHL:18) ;- (TC) Effect: none +AT91C_TC_ACPC_SET EQU (0x1:SHL:18) ;- (TC) Effect: set +AT91C_TC_ACPC_CLEAR EQU (0x2:SHL:18) ;- (TC) Effect: clear +AT91C_TC_ACPC_TOGGLE EQU (0x3:SHL:18) ;- (TC) Effect: toggle +AT91C_TC_LDRB EQU (0x3:SHL:18) ;- (TC) RB Loading Selection +AT91C_TC_LDRB_NONE EQU (0x0:SHL:18) ;- (TC) Edge: None +AT91C_TC_LDRB_RISING EQU (0x1:SHL:18) ;- (TC) Edge: rising edge of TIOA +AT91C_TC_LDRB_FALLING EQU (0x2:SHL:18) ;- (TC) Edge: falling edge of TIOA +AT91C_TC_LDRB_BOTH EQU (0x3:SHL:18) ;- (TC) Edge: each edge of TIOA +AT91C_TC_AEEVT EQU (0x3:SHL:20) ;- (TC) External Event Effect on TIOA +AT91C_TC_AEEVT_NONE EQU (0x0:SHL:20) ;- (TC) Effect: none +AT91C_TC_AEEVT_SET EQU (0x1:SHL:20) ;- (TC) Effect: set +AT91C_TC_AEEVT_CLEAR EQU (0x2:SHL:20) ;- (TC) Effect: clear +AT91C_TC_AEEVT_TOGGLE EQU (0x3:SHL:20) ;- (TC) Effect: toggle +AT91C_TC_ASWTRG EQU (0x3:SHL:22) ;- (TC) Software Trigger Effect on TIOA +AT91C_TC_ASWTRG_NONE EQU (0x0:SHL:22) ;- (TC) Effect: none +AT91C_TC_ASWTRG_SET EQU (0x1:SHL:22) ;- (TC) Effect: set +AT91C_TC_ASWTRG_CLEAR EQU (0x2:SHL:22) ;- (TC) Effect: clear +AT91C_TC_ASWTRG_TOGGLE EQU (0x3:SHL:22) ;- (TC) Effect: toggle +AT91C_TC_BCPB EQU (0x3:SHL:24) ;- (TC) RB Compare Effect on TIOB +AT91C_TC_BCPB_NONE EQU (0x0:SHL:24) ;- (TC) Effect: none +AT91C_TC_BCPB_SET EQU (0x1:SHL:24) ;- (TC) Effect: set +AT91C_TC_BCPB_CLEAR EQU (0x2:SHL:24) ;- (TC) Effect: clear +AT91C_TC_BCPB_TOGGLE EQU (0x3:SHL:24) ;- (TC) Effect: toggle +AT91C_TC_BCPC EQU (0x3:SHL:26) ;- (TC) RC Compare Effect on TIOB +AT91C_TC_BCPC_NONE EQU (0x0:SHL:26) ;- (TC) Effect: none +AT91C_TC_BCPC_SET EQU (0x1:SHL:26) ;- (TC) Effect: set +AT91C_TC_BCPC_CLEAR EQU (0x2:SHL:26) ;- (TC) Effect: clear +AT91C_TC_BCPC_TOGGLE EQU (0x3:SHL:26) ;- (TC) Effect: toggle +AT91C_TC_BEEVT EQU (0x3:SHL:28) ;- (TC) External Event Effect on TIOB +AT91C_TC_BEEVT_NONE EQU (0x0:SHL:28) ;- (TC) Effect: none +AT91C_TC_BEEVT_SET EQU (0x1:SHL:28) ;- (TC) Effect: set +AT91C_TC_BEEVT_CLEAR EQU (0x2:SHL:28) ;- (TC) Effect: clear +AT91C_TC_BEEVT_TOGGLE EQU (0x3:SHL:28) ;- (TC) Effect: toggle +AT91C_TC_BSWTRG EQU (0x3:SHL:30) ;- (TC) Software Trigger Effect on TIOB +AT91C_TC_BSWTRG_NONE EQU (0x0:SHL:30) ;- (TC) Effect: none +AT91C_TC_BSWTRG_SET EQU (0x1:SHL:30) ;- (TC) Effect: set +AT91C_TC_BSWTRG_CLEAR EQU (0x2:SHL:30) ;- (TC) Effect: clear +AT91C_TC_BSWTRG_TOGGLE EQU (0x3:SHL:30) ;- (TC) Effect: toggle +;- -------- TC_SR : (TC Offset: 0x20) TC Channel Status Register -------- +AT91C_TC_COVFS EQU (0x1:SHL:0) ;- (TC) Counter Overflow +AT91C_TC_LOVRS EQU (0x1:SHL:1) ;- (TC) Load Overrun +AT91C_TC_CPAS EQU (0x1:SHL:2) ;- (TC) RA Compare +AT91C_TC_CPBS EQU (0x1:SHL:3) ;- (TC) RB Compare +AT91C_TC_CPCS EQU (0x1:SHL:4) ;- (TC) RC Compare +AT91C_TC_LDRAS EQU (0x1:SHL:5) ;- (TC) RA Loading +AT91C_TC_LDRBS EQU (0x1:SHL:6) ;- (TC) RB Loading +AT91C_TC_ETRGS EQU (0x1:SHL:7) ;- (TC) External Trigger +AT91C_TC_CLKSTA EQU (0x1:SHL:16) ;- (TC) Clock Enabling +AT91C_TC_MTIOA EQU (0x1:SHL:17) ;- (TC) TIOA Mirror +AT91C_TC_MTIOB EQU (0x1:SHL:18) ;- (TC) TIOA Mirror +;- -------- TC_IER : (TC Offset: 0x24) TC Channel Interrupt Enable Register -------- +;- -------- TC_IDR : (TC Offset: 0x28) TC Channel Interrupt Disable Register -------- +;- -------- TC_IMR : (TC Offset: 0x2c) TC Channel Interrupt Mask Register -------- + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Timer Counter Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_TCB +TCB_TC0 # 48 ;- TC Channel 0 + # 16 ;- Reserved +TCB_TC1 # 48 ;- TC Channel 1 + # 16 ;- Reserved +TCB_TC2 # 48 ;- TC Channel 2 + # 16 ;- Reserved +TCB_BCR # 4 ;- TC Block Control Register +TCB_BMR # 4 ;- TC Block Mode Register +;- -------- TCB_BCR : (TCB Offset: 0xc0) TC Block Control Register -------- +AT91C_TCB_SYNC EQU (0x1:SHL:0) ;- (TCB) Synchro Command +;- -------- TCB_BMR : (TCB Offset: 0xc4) TC Block Mode Register -------- +AT91C_TCB_TC0XC0S EQU (0x3:SHL:0) ;- (TCB) External Clock Signal 0 Selection +AT91C_TCB_TC0XC0S_TCLK0 EQU (0x0) ;- (TCB) TCLK0 connected to XC0 +AT91C_TCB_TC0XC0S_NONE EQU (0x1) ;- (TCB) None signal connected to XC0 +AT91C_TCB_TC0XC0S_TIOA1 EQU (0x2) ;- (TCB) TIOA1 connected to XC0 +AT91C_TCB_TC0XC0S_TIOA2 EQU (0x3) ;- (TCB) TIOA2 connected to XC0 +AT91C_TCB_TC1XC1S EQU (0x3:SHL:2) ;- (TCB) External Clock Signal 1 Selection +AT91C_TCB_TC1XC1S_TCLK1 EQU (0x0:SHL:2) ;- (TCB) TCLK1 connected to XC1 +AT91C_TCB_TC1XC1S_NONE EQU (0x1:SHL:2) ;- (TCB) None signal connected to XC1 +AT91C_TCB_TC1XC1S_TIOA0 EQU (0x2:SHL:2) ;- (TCB) TIOA0 connected to XC1 +AT91C_TCB_TC1XC1S_TIOA2 EQU (0x3:SHL:2) ;- (TCB) TIOA2 connected to XC1 +AT91C_TCB_TC2XC2S EQU (0x3:SHL:4) ;- (TCB) External Clock Signal 2 Selection +AT91C_TCB_TC2XC2S_TCLK2 EQU (0x0:SHL:4) ;- (TCB) TCLK2 connected to XC2 +AT91C_TCB_TC2XC2S_NONE EQU (0x1:SHL:4) ;- (TCB) None signal connected to XC2 +AT91C_TCB_TC2XC2S_TIOA0 EQU (0x2:SHL:4) ;- (TCB) TIOA0 connected to XC2 +AT91C_TCB_TC2XC2S_TIOA1 EQU (0x3:SHL:4) ;- (TCB) TIOA2 connected to XC2 + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Control Area Network MailBox Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_CAN_MB +CAN_MB_MMR # 4 ;- MailBox Mode Register +CAN_MB_MAM # 4 ;- MailBox Acceptance Mask Register +CAN_MB_MID # 4 ;- MailBox ID Register +CAN_MB_MFID # 4 ;- MailBox Family ID Register +CAN_MB_MSR # 4 ;- MailBox Status Register +CAN_MB_MDL # 4 ;- MailBox Data Low Register +CAN_MB_MDH # 4 ;- MailBox Data High Register +CAN_MB_MCR # 4 ;- MailBox Control Register +;- -------- CAN_MMR : (CAN_MB Offset: 0x0) CAN Message Mode Register -------- +AT91C_CAN_MTIMEMARK EQU (0xFFFF:SHL:0) ;- (CAN_MB) Mailbox Timemark +AT91C_CAN_PRIOR EQU (0xF:SHL:16) ;- (CAN_MB) Mailbox Priority +AT91C_CAN_MOT EQU (0x7:SHL:24) ;- (CAN_MB) Mailbox Object Type +AT91C_CAN_MOT_DIS EQU (0x0:SHL:24) ;- (CAN_MB) +AT91C_CAN_MOT_RX EQU (0x1:SHL:24) ;- (CAN_MB) +AT91C_CAN_MOT_RXOVERWRITE EQU (0x2:SHL:24) ;- (CAN_MB) +AT91C_CAN_MOT_TX EQU (0x3:SHL:24) ;- (CAN_MB) +AT91C_CAN_MOT_CONSUMER EQU (0x4:SHL:24) ;- (CAN_MB) +AT91C_CAN_MOT_PRODUCER EQU (0x5:SHL:24) ;- (CAN_MB) +;- -------- CAN_MAM : (CAN_MB Offset: 0x4) CAN Message Acceptance Mask Register -------- +AT91C_CAN_MIDvB EQU (0x3FFFF:SHL:0) ;- (CAN_MB) Complementary bits for identifier in extended mode +AT91C_CAN_MIDvA EQU (0x7FF:SHL:18) ;- (CAN_MB) Identifier for standard frame mode +AT91C_CAN_MIDE EQU (0x1:SHL:29) ;- (CAN_MB) Identifier Version +;- -------- CAN_MID : (CAN_MB Offset: 0x8) CAN Message ID Register -------- +;- -------- CAN_MFID : (CAN_MB Offset: 0xc) CAN Message Family ID Register -------- +;- -------- CAN_MSR : (CAN_MB Offset: 0x10) CAN Message Status Register -------- +AT91C_CAN_MTIMESTAMP EQU (0xFFFF:SHL:0) ;- (CAN_MB) Timer Value +AT91C_CAN_MDLC EQU (0xF:SHL:16) ;- (CAN_MB) Mailbox Data Length Code +AT91C_CAN_MRTR EQU (0x1:SHL:20) ;- (CAN_MB) Mailbox Remote Transmission Request +AT91C_CAN_MABT EQU (0x1:SHL:22) ;- (CAN_MB) Mailbox Message Abort +AT91C_CAN_MRDY EQU (0x1:SHL:23) ;- (CAN_MB) Mailbox Ready +AT91C_CAN_MMI EQU (0x1:SHL:24) ;- (CAN_MB) Mailbox Message Ignored +;- -------- CAN_MDL : (CAN_MB Offset: 0x14) CAN Message Data Low Register -------- +;- -------- CAN_MDH : (CAN_MB Offset: 0x18) CAN Message Data High Register -------- +;- -------- CAN_MCR : (CAN_MB Offset: 0x1c) CAN Message Control Register -------- +AT91C_CAN_MACR EQU (0x1:SHL:22) ;- (CAN_MB) Abort Request for Mailbox +AT91C_CAN_MTCR EQU (0x1:SHL:23) ;- (CAN_MB) Mailbox Transfer Command + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Control Area Network Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_CAN +CAN_MR # 4 ;- Mode Register +CAN_IER # 4 ;- Interrupt Enable Register +CAN_IDR # 4 ;- Interrupt Disable Register +CAN_IMR # 4 ;- Interrupt Mask Register +CAN_SR # 4 ;- Status Register +CAN_BR # 4 ;- Baudrate Register +CAN_TIM # 4 ;- Timer Register +CAN_TIMESTP # 4 ;- Time Stamp Register +CAN_ECR # 4 ;- Error Counter Register +CAN_TCR # 4 ;- Transfer Command Register +CAN_ACR # 4 ;- Abort Command Register + # 208 ;- Reserved +CAN_VR # 4 ;- Version Register + # 256 ;- Reserved +CAN_MB0 # 32 ;- CAN Mailbox 0 +CAN_MB1 # 32 ;- CAN Mailbox 1 +CAN_MB2 # 32 ;- CAN Mailbox 2 +CAN_MB3 # 32 ;- CAN Mailbox 3 +CAN_MB4 # 32 ;- CAN Mailbox 4 +CAN_MB5 # 32 ;- CAN Mailbox 5 +CAN_MB6 # 32 ;- CAN Mailbox 6 +CAN_MB7 # 32 ;- CAN Mailbox 7 +CAN_MB8 # 32 ;- CAN Mailbox 8 +CAN_MB9 # 32 ;- CAN Mailbox 9 +CAN_MB10 # 32 ;- CAN Mailbox 10 +CAN_MB11 # 32 ;- CAN Mailbox 11 +CAN_MB12 # 32 ;- CAN Mailbox 12 +CAN_MB13 # 32 ;- CAN Mailbox 13 +CAN_MB14 # 32 ;- CAN Mailbox 14 +CAN_MB15 # 32 ;- CAN Mailbox 15 +;- -------- CAN_MR : (CAN Offset: 0x0) CAN Mode Register -------- +AT91C_CAN_CANEN EQU (0x1:SHL:0) ;- (CAN) CAN Controller Enable +AT91C_CAN_LPM EQU (0x1:SHL:1) ;- (CAN) Disable/Enable Low Power Mode +AT91C_CAN_ABM EQU (0x1:SHL:2) ;- (CAN) Disable/Enable Autobaud/Listen Mode +AT91C_CAN_OVL EQU (0x1:SHL:3) ;- (CAN) Disable/Enable Overload Frame +AT91C_CAN_TEOF EQU (0x1:SHL:4) ;- (CAN) Time Stamp messages at each end of Frame +AT91C_CAN_TTM EQU (0x1:SHL:5) ;- (CAN) Disable/Enable Time Trigger Mode +AT91C_CAN_TIMFRZ EQU (0x1:SHL:6) ;- (CAN) Enable Timer Freeze +AT91C_CAN_DRPT EQU (0x1:SHL:7) ;- (CAN) Disable Repeat +;- -------- CAN_IER : (CAN Offset: 0x4) CAN Interrupt Enable Register -------- +AT91C_CAN_MB0 EQU (0x1:SHL:0) ;- (CAN) Mailbox 0 Flag +AT91C_CAN_MB1 EQU (0x1:SHL:1) ;- (CAN) Mailbox 1 Flag +AT91C_CAN_MB2 EQU (0x1:SHL:2) ;- (CAN) Mailbox 2 Flag +AT91C_CAN_MB3 EQU (0x1:SHL:3) ;- (CAN) Mailbox 3 Flag +AT91C_CAN_MB4 EQU (0x1:SHL:4) ;- (CAN) Mailbox 4 Flag +AT91C_CAN_MB5 EQU (0x1:SHL:5) ;- (CAN) Mailbox 5 Flag +AT91C_CAN_MB6 EQU (0x1:SHL:6) ;- (CAN) Mailbox 6 Flag +AT91C_CAN_MB7 EQU (0x1:SHL:7) ;- (CAN) Mailbox 7 Flag +AT91C_CAN_MB8 EQU (0x1:SHL:8) ;- (CAN) Mailbox 8 Flag +AT91C_CAN_MB9 EQU (0x1:SHL:9) ;- (CAN) Mailbox 9 Flag +AT91C_CAN_MB10 EQU (0x1:SHL:10) ;- (CAN) Mailbox 10 Flag +AT91C_CAN_MB11 EQU (0x1:SHL:11) ;- (CAN) Mailbox 11 Flag +AT91C_CAN_MB12 EQU (0x1:SHL:12) ;- (CAN) Mailbox 12 Flag +AT91C_CAN_MB13 EQU (0x1:SHL:13) ;- (CAN) Mailbox 13 Flag +AT91C_CAN_MB14 EQU (0x1:SHL:14) ;- (CAN) Mailbox 14 Flag +AT91C_CAN_MB15 EQU (0x1:SHL:15) ;- (CAN) Mailbox 15 Flag +AT91C_CAN_ERRA EQU (0x1:SHL:16) ;- (CAN) Error Active Mode Flag +AT91C_CAN_WARN EQU (0x1:SHL:17) ;- (CAN) Warning Limit Flag +AT91C_CAN_ERRP EQU (0x1:SHL:18) ;- (CAN) Error Passive Mode Flag +AT91C_CAN_BOFF EQU (0x1:SHL:19) ;- (CAN) Bus Off Mode Flag +AT91C_CAN_SLEEP EQU (0x1:SHL:20) ;- (CAN) Sleep Flag +AT91C_CAN_WAKEUP EQU (0x1:SHL:21) ;- (CAN) Wakeup Flag +AT91C_CAN_TOVF EQU (0x1:SHL:22) ;- (CAN) Timer Overflow Flag +AT91C_CAN_TSTP EQU (0x1:SHL:23) ;- (CAN) Timestamp Flag +AT91C_CAN_CERR EQU (0x1:SHL:24) ;- (CAN) CRC Error +AT91C_CAN_SERR EQU (0x1:SHL:25) ;- (CAN) Stuffing Error +AT91C_CAN_AERR EQU (0x1:SHL:26) ;- (CAN) Acknowledgment Error +AT91C_CAN_FERR EQU (0x1:SHL:27) ;- (CAN) Form Error +AT91C_CAN_BERR EQU (0x1:SHL:28) ;- (CAN) Bit Error +;- -------- CAN_IDR : (CAN Offset: 0x8) CAN Interrupt Disable Register -------- +;- -------- CAN_IMR : (CAN Offset: 0xc) CAN Interrupt Mask Register -------- +;- -------- CAN_SR : (CAN Offset: 0x10) CAN Status Register -------- +AT91C_CAN_RBSY EQU (0x1:SHL:29) ;- (CAN) Receiver Busy +AT91C_CAN_TBSY EQU (0x1:SHL:30) ;- (CAN) Transmitter Busy +AT91C_CAN_OVLY EQU (0x1:SHL:31) ;- (CAN) Overload Busy +;- -------- CAN_BR : (CAN Offset: 0x14) CAN Baudrate Register -------- +AT91C_CAN_PHASE2 EQU (0x7:SHL:0) ;- (CAN) Phase 2 segment +AT91C_CAN_PHASE1 EQU (0x7:SHL:4) ;- (CAN) Phase 1 segment +AT91C_CAN_PROPAG EQU (0x7:SHL:8) ;- (CAN) Programmation time segment +AT91C_CAN_SYNC EQU (0x3:SHL:12) ;- (CAN) Re-synchronization jump width segment +AT91C_CAN_BRP EQU (0x7F:SHL:16) ;- (CAN) Baudrate Prescaler +AT91C_CAN_SMP EQU (0x1:SHL:24) ;- (CAN) Sampling mode +;- -------- CAN_TIM : (CAN Offset: 0x18) CAN Timer Register -------- +AT91C_CAN_TIMER EQU (0xFFFF:SHL:0) ;- (CAN) Timer field +;- -------- CAN_TIMESTP : (CAN Offset: 0x1c) CAN Timestamp Register -------- +;- -------- CAN_ECR : (CAN Offset: 0x20) CAN Error Counter Register -------- +AT91C_CAN_REC EQU (0xFF:SHL:0) ;- (CAN) Receive Error Counter +AT91C_CAN_TEC EQU (0xFF:SHL:16) ;- (CAN) Transmit Error Counter +;- -------- CAN_TCR : (CAN Offset: 0x24) CAN Transfer Command Register -------- +AT91C_CAN_TIMRST EQU (0x1:SHL:31) ;- (CAN) Timer Reset Field +;- -------- CAN_ACR : (CAN Offset: 0x28) CAN Abort Command Register -------- + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Ethernet MAC 10/100 +;- ***************************************************************************** + ^ 0 ;- AT91S_EMAC +EMAC_NCR # 4 ;- Network Control Register +EMAC_NCFGR # 4 ;- Network Configuration Register +EMAC_NSR # 4 ;- Network Status Register + # 8 ;- Reserved +EMAC_TSR # 4 ;- Transmit Status Register +EMAC_RBQP # 4 ;- Receive Buffer Queue Pointer +EMAC_TBQP # 4 ;- Transmit Buffer Queue Pointer +EMAC_RSR # 4 ;- Receive Status Register +EMAC_ISR # 4 ;- Interrupt Status Register +EMAC_IER # 4 ;- Interrupt Enable Register +EMAC_IDR # 4 ;- Interrupt Disable Register +EMAC_IMR # 4 ;- Interrupt Mask Register +EMAC_MAN # 4 ;- PHY Maintenance Register +EMAC_PTR # 4 ;- Pause Time Register +EMAC_PFR # 4 ;- Pause Frames received Register +EMAC_FTO # 4 ;- Frames Transmitted OK Register +EMAC_SCF # 4 ;- Single Collision Frame Register +EMAC_MCF # 4 ;- Multiple Collision Frame Register +EMAC_FRO # 4 ;- Frames Received OK Register +EMAC_FCSE # 4 ;- Frame Check Sequence Error Register +EMAC_ALE # 4 ;- Alignment Error Register +EMAC_DTF # 4 ;- Deferred Transmission Frame Register +EMAC_LCOL # 4 ;- Late Collision Register +EMAC_ECOL # 4 ;- Excessive Collision Register +EMAC_TUND # 4 ;- Transmit Underrun Error Register +EMAC_CSE # 4 ;- Carrier Sense Error Register +EMAC_RRE # 4 ;- Receive Ressource Error Register +EMAC_ROV # 4 ;- Receive Overrun Errors Register +EMAC_RSE # 4 ;- Receive Symbol Errors Register +EMAC_ELE # 4 ;- Excessive Length Errors Register +EMAC_RJA # 4 ;- Receive Jabbers Register +EMAC_USF # 4 ;- Undersize Frames Register +EMAC_STE # 4 ;- SQE Test Error Register +EMAC_RLE # 4 ;- Receive Length Field Mismatch Register +EMAC_TPF # 4 ;- Transmitted Pause Frames Register +EMAC_HRB # 4 ;- Hash Address Bottom[31:0] +EMAC_HRT # 4 ;- Hash Address Top[63:32] +EMAC_SA1L # 4 ;- Specific Address 1 Bottom, First 4 bytes +EMAC_SA1H # 4 ;- Specific Address 1 Top, Last 2 bytes +EMAC_SA2L # 4 ;- Specific Address 2 Bottom, First 4 bytes +EMAC_SA2H # 4 ;- Specific Address 2 Top, Last 2 bytes +EMAC_SA3L # 4 ;- Specific Address 3 Bottom, First 4 bytes +EMAC_SA3H # 4 ;- Specific Address 3 Top, Last 2 bytes +EMAC_SA4L # 4 ;- Specific Address 4 Bottom, First 4 bytes +EMAC_SA4H # 4 ;- Specific Address 4 Top, Last 2 bytes +EMAC_TID # 4 ;- Type ID Checking Register +EMAC_TPQ # 4 ;- Transmit Pause Quantum Register +EMAC_USRIO # 4 ;- USER Input/Output Register +EMAC_WOL # 4 ;- Wake On LAN Register + # 52 ;- Reserved +EMAC_REV # 4 ;- Revision Register +;- -------- EMAC_NCR : (EMAC Offset: 0x0) -------- +AT91C_EMAC_LB EQU (0x1:SHL:0) ;- (EMAC) Loopback. Optional. When set, loopback signal is at high level. +AT91C_EMAC_LLB EQU (0x1:SHL:1) ;- (EMAC) Loopback local. +AT91C_EMAC_RE EQU (0x1:SHL:2) ;- (EMAC) Receive enable. +AT91C_EMAC_TE EQU (0x1:SHL:3) ;- (EMAC) Transmit enable. +AT91C_EMAC_MPE EQU (0x1:SHL:4) ;- (EMAC) Management port enable. +AT91C_EMAC_CLRSTAT EQU (0x1:SHL:5) ;- (EMAC) Clear statistics registers. +AT91C_EMAC_INCSTAT EQU (0x1:SHL:6) ;- (EMAC) Increment statistics registers. +AT91C_EMAC_WESTAT EQU (0x1:SHL:7) ;- (EMAC) Write enable for statistics registers. +AT91C_EMAC_BP EQU (0x1:SHL:8) ;- (EMAC) Back pressure. +AT91C_EMAC_TSTART EQU (0x1:SHL:9) ;- (EMAC) Start Transmission. +AT91C_EMAC_THALT EQU (0x1:SHL:10) ;- (EMAC) Transmission Halt. +AT91C_EMAC_TPFR EQU (0x1:SHL:11) ;- (EMAC) Transmit pause frame +AT91C_EMAC_TZQ EQU (0x1:SHL:12) ;- (EMAC) Transmit zero quantum pause frame +;- -------- EMAC_NCFGR : (EMAC Offset: 0x4) Network Configuration Register -------- +AT91C_EMAC_SPD EQU (0x1:SHL:0) ;- (EMAC) Speed. +AT91C_EMAC_FD EQU (0x1:SHL:1) ;- (EMAC) Full duplex. +AT91C_EMAC_JFRAME EQU (0x1:SHL:3) ;- (EMAC) Jumbo Frames. +AT91C_EMAC_CAF EQU (0x1:SHL:4) ;- (EMAC) Copy all frames. +AT91C_EMAC_NBC EQU (0x1:SHL:5) ;- (EMAC) No broadcast. +AT91C_EMAC_MTI EQU (0x1:SHL:6) ;- (EMAC) Multicast hash event enable +AT91C_EMAC_UNI EQU (0x1:SHL:7) ;- (EMAC) Unicast hash enable. +AT91C_EMAC_BIG EQU (0x1:SHL:8) ;- (EMAC) Receive 1522 bytes. +AT91C_EMAC_EAE EQU (0x1:SHL:9) ;- (EMAC) External address match enable. +AT91C_EMAC_CLK EQU (0x3:SHL:10) ;- (EMAC) +AT91C_EMAC_CLK_HCLK_8 EQU (0x0:SHL:10) ;- (EMAC) HCLK divided by 8 +AT91C_EMAC_CLK_HCLK_16 EQU (0x1:SHL:10) ;- (EMAC) HCLK divided by 16 +AT91C_EMAC_CLK_HCLK_32 EQU (0x2:SHL:10) ;- (EMAC) HCLK divided by 32 +AT91C_EMAC_CLK_HCLK_64 EQU (0x3:SHL:10) ;- (EMAC) HCLK divided by 64 +AT91C_EMAC_RTY EQU (0x1:SHL:12) ;- (EMAC) +AT91C_EMAC_PAE EQU (0x1:SHL:13) ;- (EMAC) +AT91C_EMAC_RBOF EQU (0x3:SHL:14) ;- (EMAC) +AT91C_EMAC_RBOF_OFFSET_0 EQU (0x0:SHL:14) ;- (EMAC) no offset from start of receive buffer +AT91C_EMAC_RBOF_OFFSET_1 EQU (0x1:SHL:14) ;- (EMAC) one byte offset from start of receive buffer +AT91C_EMAC_RBOF_OFFSET_2 EQU (0x2:SHL:14) ;- (EMAC) two bytes offset from start of receive buffer +AT91C_EMAC_RBOF_OFFSET_3 EQU (0x3:SHL:14) ;- (EMAC) three bytes offset from start of receive buffer +AT91C_EMAC_RLCE EQU (0x1:SHL:16) ;- (EMAC) Receive Length field Checking Enable +AT91C_EMAC_DRFCS EQU (0x1:SHL:17) ;- (EMAC) Discard Receive FCS +AT91C_EMAC_EFRHD EQU (0x1:SHL:18) ;- (EMAC) +AT91C_EMAC_IRXFCS EQU (0x1:SHL:19) ;- (EMAC) Ignore RX FCS +;- -------- EMAC_NSR : (EMAC Offset: 0x8) Network Status Register -------- +AT91C_EMAC_LINKR EQU (0x1:SHL:0) ;- (EMAC) +AT91C_EMAC_MDIO EQU (0x1:SHL:1) ;- (EMAC) +AT91C_EMAC_IDLE EQU (0x1:SHL:2) ;- (EMAC) +;- -------- EMAC_TSR : (EMAC Offset: 0x14) Transmit Status Register -------- +AT91C_EMAC_UBR EQU (0x1:SHL:0) ;- (EMAC) +AT91C_EMAC_COL EQU (0x1:SHL:1) ;- (EMAC) +AT91C_EMAC_RLES EQU (0x1:SHL:2) ;- (EMAC) +AT91C_EMAC_TGO EQU (0x1:SHL:3) ;- (EMAC) Transmit Go +AT91C_EMAC_BEX EQU (0x1:SHL:4) ;- (EMAC) Buffers exhausted mid frame +AT91C_EMAC_COMP EQU (0x1:SHL:5) ;- (EMAC) +AT91C_EMAC_UND EQU (0x1:SHL:6) ;- (EMAC) +;- -------- EMAC_RSR : (EMAC Offset: 0x20) Receive Status Register -------- +AT91C_EMAC_BNA EQU (0x1:SHL:0) ;- (EMAC) +AT91C_EMAC_REC EQU (0x1:SHL:1) ;- (EMAC) +AT91C_EMAC_OVR EQU (0x1:SHL:2) ;- (EMAC) +;- -------- EMAC_ISR : (EMAC Offset: 0x24) Interrupt Status Register -------- +AT91C_EMAC_MFD EQU (0x1:SHL:0) ;- (EMAC) +AT91C_EMAC_RCOMP EQU (0x1:SHL:1) ;- (EMAC) +AT91C_EMAC_RXUBR EQU (0x1:SHL:2) ;- (EMAC) +AT91C_EMAC_TXUBR EQU (0x1:SHL:3) ;- (EMAC) +AT91C_EMAC_TUNDR EQU (0x1:SHL:4) ;- (EMAC) +AT91C_EMAC_RLEX EQU (0x1:SHL:5) ;- (EMAC) +AT91C_EMAC_TXERR EQU (0x1:SHL:6) ;- (EMAC) +AT91C_EMAC_TCOMP EQU (0x1:SHL:7) ;- (EMAC) +AT91C_EMAC_LINK EQU (0x1:SHL:9) ;- (EMAC) +AT91C_EMAC_ROVR EQU (0x1:SHL:10) ;- (EMAC) +AT91C_EMAC_HRESP EQU (0x1:SHL:11) ;- (EMAC) +AT91C_EMAC_PFRE EQU (0x1:SHL:12) ;- (EMAC) +AT91C_EMAC_PTZ EQU (0x1:SHL:13) ;- (EMAC) +;- -------- EMAC_IER : (EMAC Offset: 0x28) Interrupt Enable Register -------- +;- -------- EMAC_IDR : (EMAC Offset: 0x2c) Interrupt Disable Register -------- +;- -------- EMAC_IMR : (EMAC Offset: 0x30) Interrupt Mask Register -------- +;- -------- EMAC_MAN : (EMAC Offset: 0x34) PHY Maintenance Register -------- +AT91C_EMAC_DATA EQU (0xFFFF:SHL:0) ;- (EMAC) +AT91C_EMAC_CODE EQU (0x3:SHL:16) ;- (EMAC) +AT91C_EMAC_REGA EQU (0x1F:SHL:18) ;- (EMAC) +AT91C_EMAC_PHYA EQU (0x1F:SHL:23) ;- (EMAC) +AT91C_EMAC_RW EQU (0x3:SHL:28) ;- (EMAC) +AT91C_EMAC_SOF EQU (0x3:SHL:30) ;- (EMAC) +;- -------- EMAC_USRIO : (EMAC Offset: 0xc0) USER Input Output Register -------- +AT91C_EMAC_RMII EQU (0x1:SHL:0) ;- (EMAC) Reduce MII +AT91C_EMAC_CLKEN EQU (0x1:SHL:1) ;- (EMAC) Clock Enable +;- -------- EMAC_WOL : (EMAC Offset: 0xc4) Wake On LAN Register -------- +AT91C_EMAC_IP EQU (0xFFFF:SHL:0) ;- (EMAC) ARP request IP address +AT91C_EMAC_MAG EQU (0x1:SHL:16) ;- (EMAC) Magic packet event enable +AT91C_EMAC_ARP EQU (0x1:SHL:17) ;- (EMAC) ARP request event enable +AT91C_EMAC_SA1 EQU (0x1:SHL:18) ;- (EMAC) Specific address register 1 event enable +;- -------- EMAC_REV : (EMAC Offset: 0xfc) Revision Register -------- +AT91C_EMAC_REVREF EQU (0xFFFF:SHL:0) ;- (EMAC) +AT91C_EMAC_PARTREF EQU (0xFFFF:SHL:16) ;- (EMAC) + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Analog to Digital Convertor +;- ***************************************************************************** + ^ 0 ;- AT91S_ADC +ADC_CR # 4 ;- ADC Control Register +ADC_MR # 4 ;- ADC Mode Register + # 8 ;- Reserved +ADC_CHER # 4 ;- ADC Channel Enable Register +ADC_CHDR # 4 ;- ADC Channel Disable Register +ADC_CHSR # 4 ;- ADC Channel Status Register +ADC_SR # 4 ;- ADC Status Register +ADC_LCDR # 4 ;- ADC Last Converted Data Register +ADC_IER # 4 ;- ADC Interrupt Enable Register +ADC_IDR # 4 ;- ADC Interrupt Disable Register +ADC_IMR # 4 ;- ADC Interrupt Mask Register +ADC_CDR0 # 4 ;- ADC Channel Data Register 0 +ADC_CDR1 # 4 ;- ADC Channel Data Register 1 +ADC_CDR2 # 4 ;- ADC Channel Data Register 2 +ADC_CDR3 # 4 ;- ADC Channel Data Register 3 +ADC_CDR4 # 4 ;- ADC Channel Data Register 4 +ADC_CDR5 # 4 ;- ADC Channel Data Register 5 +ADC_CDR6 # 4 ;- ADC Channel Data Register 6 +ADC_CDR7 # 4 ;- ADC Channel Data Register 7 + # 176 ;- Reserved +ADC_RPR # 4 ;- Receive Pointer Register +ADC_RCR # 4 ;- Receive Counter Register +ADC_TPR # 4 ;- Transmit Pointer Register +ADC_TCR # 4 ;- Transmit Counter Register +ADC_RNPR # 4 ;- Receive Next Pointer Register +ADC_RNCR # 4 ;- Receive Next Counter Register +ADC_TNPR # 4 ;- Transmit Next Pointer Register +ADC_TNCR # 4 ;- Transmit Next Counter Register +ADC_PTCR # 4 ;- PDC Transfer Control Register +ADC_PTSR # 4 ;- PDC Transfer Status Register +;- -------- ADC_CR : (ADC Offset: 0x0) ADC Control Register -------- +AT91C_ADC_SWRST EQU (0x1:SHL:0) ;- (ADC) Software Reset +AT91C_ADC_START EQU (0x1:SHL:1) ;- (ADC) Start Conversion +;- -------- ADC_MR : (ADC Offset: 0x4) ADC Mode Register -------- +AT91C_ADC_TRGEN EQU (0x1:SHL:0) ;- (ADC) Trigger Enable +AT91C_ADC_TRGEN_DIS EQU (0x0) ;- (ADC) Hradware triggers are disabled. Starting a conversion is only possible by software +AT91C_ADC_TRGEN_EN EQU (0x1) ;- (ADC) Hardware trigger selected by TRGSEL field is enabled. +AT91C_ADC_TRGSEL EQU (0x7:SHL:1) ;- (ADC) Trigger Selection +AT91C_ADC_TRGSEL_TIOA0 EQU (0x0:SHL:1) ;- (ADC) Selected TRGSEL = TIAO0 +AT91C_ADC_TRGSEL_TIOA1 EQU (0x1:SHL:1) ;- (ADC) Selected TRGSEL = TIAO1 +AT91C_ADC_TRGSEL_TIOA2 EQU (0x2:SHL:1) ;- (ADC) Selected TRGSEL = TIAO2 +AT91C_ADC_TRGSEL_TIOA3 EQU (0x3:SHL:1) ;- (ADC) Selected TRGSEL = TIAO3 +AT91C_ADC_TRGSEL_TIOA4 EQU (0x4:SHL:1) ;- (ADC) Selected TRGSEL = TIAO4 +AT91C_ADC_TRGSEL_TIOA5 EQU (0x5:SHL:1) ;- (ADC) Selected TRGSEL = TIAO5 +AT91C_ADC_TRGSEL_EXT EQU (0x6:SHL:1) ;- (ADC) Selected TRGSEL = External Trigger +AT91C_ADC_LOWRES EQU (0x1:SHL:4) ;- (ADC) Resolution. +AT91C_ADC_LOWRES_10_BIT EQU (0x0:SHL:4) ;- (ADC) 10-bit resolution +AT91C_ADC_LOWRES_8_BIT EQU (0x1:SHL:4) ;- (ADC) 8-bit resolution +AT91C_ADC_SLEEP EQU (0x1:SHL:5) ;- (ADC) Sleep Mode +AT91C_ADC_SLEEP_NORMAL_MODE EQU (0x0:SHL:5) ;- (ADC) Normal Mode +AT91C_ADC_SLEEP_MODE EQU (0x1:SHL:5) ;- (ADC) Sleep Mode +AT91C_ADC_PRESCAL EQU (0x3F:SHL:8) ;- (ADC) Prescaler rate selection +AT91C_ADC_STARTUP EQU (0x1F:SHL:16) ;- (ADC) Startup Time +AT91C_ADC_SHTIM EQU (0xF:SHL:24) ;- (ADC) Sample & Hold Time +;- -------- ADC_CHER : (ADC Offset: 0x10) ADC Channel Enable Register -------- +AT91C_ADC_CH0 EQU (0x1:SHL:0) ;- (ADC) Channel 0 +AT91C_ADC_CH1 EQU (0x1:SHL:1) ;- (ADC) Channel 1 +AT91C_ADC_CH2 EQU (0x1:SHL:2) ;- (ADC) Channel 2 +AT91C_ADC_CH3 EQU (0x1:SHL:3) ;- (ADC) Channel 3 +AT91C_ADC_CH4 EQU (0x1:SHL:4) ;- (ADC) Channel 4 +AT91C_ADC_CH5 EQU (0x1:SHL:5) ;- (ADC) Channel 5 +AT91C_ADC_CH6 EQU (0x1:SHL:6) ;- (ADC) Channel 6 +AT91C_ADC_CH7 EQU (0x1:SHL:7) ;- (ADC) Channel 7 +;- -------- ADC_CHDR : (ADC Offset: 0x14) ADC Channel Disable Register -------- +;- -------- ADC_CHSR : (ADC Offset: 0x18) ADC Channel Status Register -------- +;- -------- ADC_SR : (ADC Offset: 0x1c) ADC Status Register -------- +AT91C_ADC_EOC0 EQU (0x1:SHL:0) ;- (ADC) End of Conversion +AT91C_ADC_EOC1 EQU (0x1:SHL:1) ;- (ADC) End of Conversion +AT91C_ADC_EOC2 EQU (0x1:SHL:2) ;- (ADC) End of Conversion +AT91C_ADC_EOC3 EQU (0x1:SHL:3) ;- (ADC) End of Conversion +AT91C_ADC_EOC4 EQU (0x1:SHL:4) ;- (ADC) End of Conversion +AT91C_ADC_EOC5 EQU (0x1:SHL:5) ;- (ADC) End of Conversion +AT91C_ADC_EOC6 EQU (0x1:SHL:6) ;- (ADC) End of Conversion +AT91C_ADC_EOC7 EQU (0x1:SHL:7) ;- (ADC) End of Conversion +AT91C_ADC_OVRE0 EQU (0x1:SHL:8) ;- (ADC) Overrun Error +AT91C_ADC_OVRE1 EQU (0x1:SHL:9) ;- (ADC) Overrun Error +AT91C_ADC_OVRE2 EQU (0x1:SHL:10) ;- (ADC) Overrun Error +AT91C_ADC_OVRE3 EQU (0x1:SHL:11) ;- (ADC) Overrun Error +AT91C_ADC_OVRE4 EQU (0x1:SHL:12) ;- (ADC) Overrun Error +AT91C_ADC_OVRE5 EQU (0x1:SHL:13) ;- (ADC) Overrun Error +AT91C_ADC_OVRE6 EQU (0x1:SHL:14) ;- (ADC) Overrun Error +AT91C_ADC_OVRE7 EQU (0x1:SHL:15) ;- (ADC) Overrun Error +AT91C_ADC_DRDY EQU (0x1:SHL:16) ;- (ADC) Data Ready +AT91C_ADC_GOVRE EQU (0x1:SHL:17) ;- (ADC) General Overrun +AT91C_ADC_ENDRX EQU (0x1:SHL:18) ;- (ADC) End of Receiver Transfer +AT91C_ADC_RXBUFF EQU (0x1:SHL:19) ;- (ADC) RXBUFF Interrupt +;- -------- ADC_LCDR : (ADC Offset: 0x20) ADC Last Converted Data Register -------- +AT91C_ADC_LDATA EQU (0x3FF:SHL:0) ;- (ADC) Last Data Converted +;- -------- ADC_IER : (ADC Offset: 0x24) ADC Interrupt Enable Register -------- +;- -------- ADC_IDR : (ADC Offset: 0x28) ADC Interrupt Disable Register -------- +;- -------- ADC_IMR : (ADC Offset: 0x2c) ADC Interrupt Mask Register -------- +;- -------- ADC_CDR0 : (ADC Offset: 0x30) ADC Channel Data Register 0 -------- +AT91C_ADC_DATA EQU (0x3FF:SHL:0) ;- (ADC) Converted Data +;- -------- ADC_CDR1 : (ADC Offset: 0x34) ADC Channel Data Register 1 -------- +;- -------- ADC_CDR2 : (ADC Offset: 0x38) ADC Channel Data Register 2 -------- +;- -------- ADC_CDR3 : (ADC Offset: 0x3c) ADC Channel Data Register 3 -------- +;- -------- ADC_CDR4 : (ADC Offset: 0x40) ADC Channel Data Register 4 -------- +;- -------- ADC_CDR5 : (ADC Offset: 0x44) ADC Channel Data Register 5 -------- +;- -------- ADC_CDR6 : (ADC Offset: 0x48) ADC Channel Data Register 6 -------- +;- -------- ADC_CDR7 : (ADC Offset: 0x4c) ADC Channel Data Register 7 -------- + +;- ***************************************************************************** +;- REGISTER ADDRESS DEFINITION FOR AT91SAM7X256 +;- ***************************************************************************** +;- ========== Register definition for SYS peripheral ========== +;- ========== Register definition for AIC peripheral ========== +AT91C_AIC_IVR EQU (0xFFFFF100) ;- (AIC) IRQ Vector Register +AT91C_AIC_SMR EQU (0xFFFFF000) ;- (AIC) Source Mode Register +AT91C_AIC_FVR EQU (0xFFFFF104) ;- (AIC) FIQ Vector Register +AT91C_AIC_DCR EQU (0xFFFFF138) ;- (AIC) Debug Control Register (Protect) +AT91C_AIC_EOICR EQU (0xFFFFF130) ;- (AIC) End of Interrupt Command Register +AT91C_AIC_SVR EQU (0xFFFFF080) ;- (AIC) Source Vector Register +AT91C_AIC_FFSR EQU (0xFFFFF148) ;- (AIC) Fast Forcing Status Register +AT91C_AIC_ICCR EQU (0xFFFFF128) ;- (AIC) Interrupt Clear Command Register +AT91C_AIC_ISR EQU (0xFFFFF108) ;- (AIC) Interrupt Status Register +AT91C_AIC_IMR EQU (0xFFFFF110) ;- (AIC) Interrupt Mask Register +AT91C_AIC_IPR EQU (0xFFFFF10C) ;- (AIC) Interrupt Pending Register +AT91C_AIC_FFER EQU (0xFFFFF140) ;- (AIC) Fast Forcing Enable Register +AT91C_AIC_IECR EQU (0xFFFFF120) ;- (AIC) Interrupt Enable Command Register +AT91C_AIC_ISCR EQU (0xFFFFF12C) ;- (AIC) Interrupt Set Command Register +AT91C_AIC_FFDR EQU (0xFFFFF144) ;- (AIC) Fast Forcing Disable Register +AT91C_AIC_CISR EQU (0xFFFFF114) ;- (AIC) Core Interrupt Status Register +AT91C_AIC_IDCR EQU (0xFFFFF124) ;- (AIC) Interrupt Disable Command Register +AT91C_AIC_SPU EQU (0xFFFFF134) ;- (AIC) Spurious Vector Register +;- ========== Register definition for PDC_DBGU peripheral ========== +AT91C_DBGU_TCR EQU (0xFFFFF30C) ;- (PDC_DBGU) Transmit Counter Register +AT91C_DBGU_RNPR EQU (0xFFFFF310) ;- (PDC_DBGU) Receive Next Pointer Register +AT91C_DBGU_TNPR EQU (0xFFFFF318) ;- (PDC_DBGU) Transmit Next Pointer Register +AT91C_DBGU_TPR EQU (0xFFFFF308) ;- (PDC_DBGU) Transmit Pointer Register +AT91C_DBGU_RPR EQU (0xFFFFF300) ;- (PDC_DBGU) Receive Pointer Register +AT91C_DBGU_RCR EQU (0xFFFFF304) ;- (PDC_DBGU) Receive Counter Register +AT91C_DBGU_RNCR EQU (0xFFFFF314) ;- (PDC_DBGU) Receive Next Counter Register +AT91C_DBGU_PTCR EQU (0xFFFFF320) ;- (PDC_DBGU) PDC Transfer Control Register +AT91C_DBGU_PTSR EQU (0xFFFFF324) ;- (PDC_DBGU) PDC Transfer Status Register +AT91C_DBGU_TNCR EQU (0xFFFFF31C) ;- (PDC_DBGU) Transmit Next Counter Register +;- ========== Register definition for DBGU peripheral ========== +AT91C_DBGU_EXID EQU (0xFFFFF244) ;- (DBGU) Chip ID Extension Register +AT91C_DBGU_BRGR EQU (0xFFFFF220) ;- (DBGU) Baud Rate Generator Register +AT91C_DBGU_IDR EQU (0xFFFFF20C) ;- (DBGU) Interrupt Disable Register +AT91C_DBGU_CSR EQU (0xFFFFF214) ;- (DBGU) Channel Status Register +AT91C_DBGU_CIDR EQU (0xFFFFF240) ;- (DBGU) Chip ID Register +AT91C_DBGU_MR EQU (0xFFFFF204) ;- (DBGU) Mode Register +AT91C_DBGU_IMR EQU (0xFFFFF210) ;- (DBGU) Interrupt Mask Register +AT91C_DBGU_CR EQU (0xFFFFF200) ;- (DBGU) Control Register +AT91C_DBGU_FNTR EQU (0xFFFFF248) ;- (DBGU) Force NTRST Register +AT91C_DBGU_THR EQU (0xFFFFF21C) ;- (DBGU) Transmitter Holding Register +AT91C_DBGU_RHR EQU (0xFFFFF218) ;- (DBGU) Receiver Holding Register +AT91C_DBGU_IER EQU (0xFFFFF208) ;- (DBGU) Interrupt Enable Register +;- ========== Register definition for PIOA peripheral ========== +AT91C_PIOA_ODR EQU (0xFFFFF414) ;- (PIOA) Output Disable Registerr +AT91C_PIOA_SODR EQU (0xFFFFF430) ;- (PIOA) Set Output Data Register +AT91C_PIOA_ISR EQU (0xFFFFF44C) ;- (PIOA) Interrupt Status Register +AT91C_PIOA_ABSR EQU (0xFFFFF478) ;- (PIOA) AB Select Status Register +AT91C_PIOA_IER EQU (0xFFFFF440) ;- (PIOA) Interrupt Enable Register +AT91C_PIOA_PPUDR EQU (0xFFFFF460) ;- (PIOA) Pull-up Disable Register +AT91C_PIOA_IMR EQU (0xFFFFF448) ;- (PIOA) Interrupt Mask Register +AT91C_PIOA_PER EQU (0xFFFFF400) ;- (PIOA) PIO Enable Register +AT91C_PIOA_IFDR EQU (0xFFFFF424) ;- (PIOA) Input Filter Disable Register +AT91C_PIOA_OWDR EQU (0xFFFFF4A4) ;- (PIOA) Output Write Disable Register +AT91C_PIOA_MDSR EQU (0xFFFFF458) ;- (PIOA) Multi-driver Status Register +AT91C_PIOA_IDR EQU (0xFFFFF444) ;- (PIOA) Interrupt Disable Register +AT91C_PIOA_ODSR EQU (0xFFFFF438) ;- (PIOA) Output Data Status Register +AT91C_PIOA_PPUSR EQU (0xFFFFF468) ;- (PIOA) Pull-up Status Register +AT91C_PIOA_OWSR EQU (0xFFFFF4A8) ;- (PIOA) Output Write Status Register +AT91C_PIOA_BSR EQU (0xFFFFF474) ;- (PIOA) Select B Register +AT91C_PIOA_OWER EQU (0xFFFFF4A0) ;- (PIOA) Output Write Enable Register +AT91C_PIOA_IFER EQU (0xFFFFF420) ;- (PIOA) Input Filter Enable Register +AT91C_PIOA_PDSR EQU (0xFFFFF43C) ;- (PIOA) Pin Data Status Register +AT91C_PIOA_PPUER EQU (0xFFFFF464) ;- (PIOA) Pull-up Enable Register +AT91C_PIOA_OSR EQU (0xFFFFF418) ;- (PIOA) Output Status Register +AT91C_PIOA_ASR EQU (0xFFFFF470) ;- (PIOA) Select A Register +AT91C_PIOA_MDDR EQU (0xFFFFF454) ;- (PIOA) Multi-driver Disable Register +AT91C_PIOA_CODR EQU (0xFFFFF434) ;- (PIOA) Clear Output Data Register +AT91C_PIOA_MDER EQU (0xFFFFF450) ;- (PIOA) Multi-driver Enable Register +AT91C_PIOA_PDR EQU (0xFFFFF404) ;- (PIOA) PIO Disable Register +AT91C_PIOA_IFSR EQU (0xFFFFF428) ;- (PIOA) Input Filter Status Register +AT91C_PIOA_OER EQU (0xFFFFF410) ;- (PIOA) Output Enable Register +AT91C_PIOA_PSR EQU (0xFFFFF408) ;- (PIOA) PIO Status Register +;- ========== Register definition for PIOB peripheral ========== +AT91C_PIOB_OWDR EQU (0xFFFFF6A4) ;- (PIOB) Output Write Disable Register +AT91C_PIOB_MDER EQU (0xFFFFF650) ;- (PIOB) Multi-driver Enable Register +AT91C_PIOB_PPUSR EQU (0xFFFFF668) ;- (PIOB) Pull-up Status Register +AT91C_PIOB_IMR EQU (0xFFFFF648) ;- (PIOB) Interrupt Mask Register +AT91C_PIOB_ASR EQU (0xFFFFF670) ;- (PIOB) Select A Register +AT91C_PIOB_PPUDR EQU (0xFFFFF660) ;- (PIOB) Pull-up Disable Register +AT91C_PIOB_PSR EQU (0xFFFFF608) ;- (PIOB) PIO Status Register +AT91C_PIOB_IER EQU (0xFFFFF640) ;- (PIOB) Interrupt Enable Register +AT91C_PIOB_CODR EQU (0xFFFFF634) ;- (PIOB) Clear Output Data Register +AT91C_PIOB_OWER EQU (0xFFFFF6A0) ;- (PIOB) Output Write Enable Register +AT91C_PIOB_ABSR EQU (0xFFFFF678) ;- (PIOB) AB Select Status Register +AT91C_PIOB_IFDR EQU (0xFFFFF624) ;- (PIOB) Input Filter Disable Register +AT91C_PIOB_PDSR EQU (0xFFFFF63C) ;- (PIOB) Pin Data Status Register +AT91C_PIOB_IDR EQU (0xFFFFF644) ;- (PIOB) Interrupt Disable Register +AT91C_PIOB_OWSR EQU (0xFFFFF6A8) ;- (PIOB) Output Write Status Register +AT91C_PIOB_PDR EQU (0xFFFFF604) ;- (PIOB) PIO Disable Register +AT91C_PIOB_ODR EQU (0xFFFFF614) ;- (PIOB) Output Disable Registerr +AT91C_PIOB_IFSR EQU (0xFFFFF628) ;- (PIOB) Input Filter Status Register +AT91C_PIOB_PPUER EQU (0xFFFFF664) ;- (PIOB) Pull-up Enable Register +AT91C_PIOB_SODR EQU (0xFFFFF630) ;- (PIOB) Set Output Data Register +AT91C_PIOB_ISR EQU (0xFFFFF64C) ;- (PIOB) Interrupt Status Register +AT91C_PIOB_ODSR EQU (0xFFFFF638) ;- (PIOB) Output Data Status Register +AT91C_PIOB_OSR EQU (0xFFFFF618) ;- (PIOB) Output Status Register +AT91C_PIOB_MDSR EQU (0xFFFFF658) ;- (PIOB) Multi-driver Status Register +AT91C_PIOB_IFER EQU (0xFFFFF620) ;- (PIOB) Input Filter Enable Register +AT91C_PIOB_BSR EQU (0xFFFFF674) ;- (PIOB) Select B Register +AT91C_PIOB_MDDR EQU (0xFFFFF654) ;- (PIOB) Multi-driver Disable Register +AT91C_PIOB_OER EQU (0xFFFFF610) ;- (PIOB) Output Enable Register +AT91C_PIOB_PER EQU (0xFFFFF600) ;- (PIOB) PIO Enable Register +;- ========== Register definition for CKGR peripheral ========== +AT91C_CKGR_MOR EQU (0xFFFFFC20) ;- (CKGR) Main Oscillator Register +AT91C_CKGR_PLLR EQU (0xFFFFFC2C) ;- (CKGR) PLL Register +AT91C_CKGR_MCFR EQU (0xFFFFFC24) ;- (CKGR) Main Clock Frequency Register +;- ========== Register definition for PMC peripheral ========== +AT91C_PMC_IDR EQU (0xFFFFFC64) ;- (PMC) Interrupt Disable Register +AT91C_PMC_MOR EQU (0xFFFFFC20) ;- (PMC) Main Oscillator Register +AT91C_PMC_PLLR EQU (0xFFFFFC2C) ;- (PMC) PLL Register +AT91C_PMC_PCER EQU (0xFFFFFC10) ;- (PMC) Peripheral Clock Enable Register +AT91C_PMC_PCKR EQU (0xFFFFFC40) ;- (PMC) Programmable Clock Register +AT91C_PMC_MCKR EQU (0xFFFFFC30) ;- (PMC) Master Clock Register +AT91C_PMC_SCDR EQU (0xFFFFFC04) ;- (PMC) System Clock Disable Register +AT91C_PMC_PCDR EQU (0xFFFFFC14) ;- (PMC) Peripheral Clock Disable Register +AT91C_PMC_SCSR EQU (0xFFFFFC08) ;- (PMC) System Clock Status Register +AT91C_PMC_PCSR EQU (0xFFFFFC18) ;- (PMC) Peripheral Clock Status Register +AT91C_PMC_MCFR EQU (0xFFFFFC24) ;- (PMC) Main Clock Frequency Register +AT91C_PMC_SCER EQU (0xFFFFFC00) ;- (PMC) System Clock Enable Register +AT91C_PMC_IMR EQU (0xFFFFFC6C) ;- (PMC) Interrupt Mask Register +AT91C_PMC_IER EQU (0xFFFFFC60) ;- (PMC) Interrupt Enable Register +AT91C_PMC_SR EQU (0xFFFFFC68) ;- (PMC) Status Register +;- ========== Register definition for RSTC peripheral ========== +AT91C_RSTC_RCR EQU (0xFFFFFD00) ;- (RSTC) Reset Control Register +AT91C_RSTC_RMR EQU (0xFFFFFD08) ;- (RSTC) Reset Mode Register +AT91C_RSTC_RSR EQU (0xFFFFFD04) ;- (RSTC) Reset Status Register +;- ========== Register definition for RTTC peripheral ========== +AT91C_RTTC_RTSR EQU (0xFFFFFD2C) ;- (RTTC) Real-time Status Register +AT91C_RTTC_RTMR EQU (0xFFFFFD20) ;- (RTTC) Real-time Mode Register +AT91C_RTTC_RTVR EQU (0xFFFFFD28) ;- (RTTC) Real-time Value Register +AT91C_RTTC_RTAR EQU (0xFFFFFD24) ;- (RTTC) Real-time Alarm Register +;- ========== Register definition for PITC peripheral ========== +AT91C_PITC_PIVR EQU (0xFFFFFD38) ;- (PITC) Period Interval Value Register +AT91C_PITC_PISR EQU (0xFFFFFD34) ;- (PITC) Period Interval Status Register +AT91C_PITC_PIIR EQU (0xFFFFFD3C) ;- (PITC) Period Interval Image Register +AT91C_PITC_PIMR EQU (0xFFFFFD30) ;- (PITC) Period Interval Mode Register +;- ========== Register definition for WDTC peripheral ========== +AT91C_WDTC_WDCR EQU (0xFFFFFD40) ;- (WDTC) Watchdog Control Register +AT91C_WDTC_WDSR EQU (0xFFFFFD48) ;- (WDTC) Watchdog Status Register +AT91C_WDTC_WDMR EQU (0xFFFFFD44) ;- (WDTC) Watchdog Mode Register +;- ========== Register definition for VREG peripheral ========== +AT91C_VREG_MR EQU (0xFFFFFD60) ;- (VREG) Voltage Regulator Mode Register +;- ========== Register definition for MC peripheral ========== +AT91C_MC_ASR EQU (0xFFFFFF04) ;- (MC) MC Abort Status Register +AT91C_MC_RCR EQU (0xFFFFFF00) ;- (MC) MC Remap Control Register +AT91C_MC_FCR EQU (0xFFFFFF64) ;- (MC) MC Flash Command Register +AT91C_MC_AASR EQU (0xFFFFFF08) ;- (MC) MC Abort Address Status Register +AT91C_MC_FSR EQU (0xFFFFFF68) ;- (MC) MC Flash Status Register +AT91C_MC_FMR EQU (0xFFFFFF60) ;- (MC) MC Flash Mode Register +;- ========== Register definition for PDC_SPI1 peripheral ========== +AT91C_SPI1_PTCR EQU (0xFFFE4120) ;- (PDC_SPI1) PDC Transfer Control Register +AT91C_SPI1_RPR EQU (0xFFFE4100) ;- (PDC_SPI1) Receive Pointer Register +AT91C_SPI1_TNCR EQU (0xFFFE411C) ;- (PDC_SPI1) Transmit Next Counter Register +AT91C_SPI1_TPR EQU (0xFFFE4108) ;- (PDC_SPI1) Transmit Pointer Register +AT91C_SPI1_TNPR EQU (0xFFFE4118) ;- (PDC_SPI1) Transmit Next Pointer Register +AT91C_SPI1_TCR EQU (0xFFFE410C) ;- (PDC_SPI1) Transmit Counter Register +AT91C_SPI1_RCR EQU (0xFFFE4104) ;- (PDC_SPI1) Receive Counter Register +AT91C_SPI1_RNPR EQU (0xFFFE4110) ;- (PDC_SPI1) Receive Next Pointer Register +AT91C_SPI1_RNCR EQU (0xFFFE4114) ;- (PDC_SPI1) Receive Next Counter Register +AT91C_SPI1_PTSR EQU (0xFFFE4124) ;- (PDC_SPI1) PDC Transfer Status Register +;- ========== Register definition for SPI1 peripheral ========== +AT91C_SPI1_IMR EQU (0xFFFE401C) ;- (SPI1) Interrupt Mask Register +AT91C_SPI1_IER EQU (0xFFFE4014) ;- (SPI1) Interrupt Enable Register +AT91C_SPI1_MR EQU (0xFFFE4004) ;- (SPI1) Mode Register +AT91C_SPI1_RDR EQU (0xFFFE4008) ;- (SPI1) Receive Data Register +AT91C_SPI1_IDR EQU (0xFFFE4018) ;- (SPI1) Interrupt Disable Register +AT91C_SPI1_SR EQU (0xFFFE4010) ;- (SPI1) Status Register +AT91C_SPI1_TDR EQU (0xFFFE400C) ;- (SPI1) Transmit Data Register +AT91C_SPI1_CR EQU (0xFFFE4000) ;- (SPI1) Control Register +AT91C_SPI1_CSR EQU (0xFFFE4030) ;- (SPI1) Chip Select Register +;- ========== Register definition for PDC_SPI0 peripheral ========== +AT91C_SPI0_PTCR EQU (0xFFFE0120) ;- (PDC_SPI0) PDC Transfer Control Register +AT91C_SPI0_TPR EQU (0xFFFE0108) ;- (PDC_SPI0) Transmit Pointer Register +AT91C_SPI0_TCR EQU (0xFFFE010C) ;- (PDC_SPI0) Transmit Counter Register +AT91C_SPI0_RCR EQU (0xFFFE0104) ;- (PDC_SPI0) Receive Counter Register +AT91C_SPI0_PTSR EQU (0xFFFE0124) ;- (PDC_SPI0) PDC Transfer Status Register +AT91C_SPI0_RNPR EQU (0xFFFE0110) ;- (PDC_SPI0) Receive Next Pointer Register +AT91C_SPI0_RPR EQU (0xFFFE0100) ;- (PDC_SPI0) Receive Pointer Register +AT91C_SPI0_TNCR EQU (0xFFFE011C) ;- (PDC_SPI0) Transmit Next Counter Register +AT91C_SPI0_RNCR EQU (0xFFFE0114) ;- (PDC_SPI0) Receive Next Counter Register +AT91C_SPI0_TNPR EQU (0xFFFE0118) ;- (PDC_SPI0) Transmit Next Pointer Register +;- ========== Register definition for SPI0 peripheral ========== +AT91C_SPI0_IER EQU (0xFFFE0014) ;- (SPI0) Interrupt Enable Register +AT91C_SPI0_SR EQU (0xFFFE0010) ;- (SPI0) Status Register +AT91C_SPI0_IDR EQU (0xFFFE0018) ;- (SPI0) Interrupt Disable Register +AT91C_SPI0_CR EQU (0xFFFE0000) ;- (SPI0) Control Register +AT91C_SPI0_MR EQU (0xFFFE0004) ;- (SPI0) Mode Register +AT91C_SPI0_IMR EQU (0xFFFE001C) ;- (SPI0) Interrupt Mask Register +AT91C_SPI0_TDR EQU (0xFFFE000C) ;- (SPI0) Transmit Data Register +AT91C_SPI0_RDR EQU (0xFFFE0008) ;- (SPI0) Receive Data Register +AT91C_SPI0_CSR EQU (0xFFFE0030) ;- (SPI0) Chip Select Register +;- ========== Register definition for PDC_US1 peripheral ========== +AT91C_US1_RNCR EQU (0xFFFC4114) ;- (PDC_US1) Receive Next Counter Register +AT91C_US1_PTCR EQU (0xFFFC4120) ;- (PDC_US1) PDC Transfer Control Register +AT91C_US1_TCR EQU (0xFFFC410C) ;- (PDC_US1) Transmit Counter Register +AT91C_US1_PTSR EQU (0xFFFC4124) ;- (PDC_US1) PDC Transfer Status Register +AT91C_US1_TNPR EQU (0xFFFC4118) ;- (PDC_US1) Transmit Next Pointer Register +AT91C_US1_RCR EQU (0xFFFC4104) ;- (PDC_US1) Receive Counter Register +AT91C_US1_RNPR EQU (0xFFFC4110) ;- (PDC_US1) Receive Next Pointer Register +AT91C_US1_RPR EQU (0xFFFC4100) ;- (PDC_US1) Receive Pointer Register +AT91C_US1_TNCR EQU (0xFFFC411C) ;- (PDC_US1) Transmit Next Counter Register +AT91C_US1_TPR EQU (0xFFFC4108) ;- (PDC_US1) Transmit Pointer Register +;- ========== Register definition for US1 peripheral ========== +AT91C_US1_IF EQU (0xFFFC404C) ;- (US1) IRDA_FILTER Register +AT91C_US1_NER EQU (0xFFFC4044) ;- (US1) Nb Errors Register +AT91C_US1_RTOR EQU (0xFFFC4024) ;- (US1) Receiver Time-out Register +AT91C_US1_CSR EQU (0xFFFC4014) ;- (US1) Channel Status Register +AT91C_US1_IDR EQU (0xFFFC400C) ;- (US1) Interrupt Disable Register +AT91C_US1_IER EQU (0xFFFC4008) ;- (US1) Interrupt Enable Register +AT91C_US1_THR EQU (0xFFFC401C) ;- (US1) Transmitter Holding Register +AT91C_US1_TTGR EQU (0xFFFC4028) ;- (US1) Transmitter Time-guard Register +AT91C_US1_RHR EQU (0xFFFC4018) ;- (US1) Receiver Holding Register +AT91C_US1_BRGR EQU (0xFFFC4020) ;- (US1) Baud Rate Generator Register +AT91C_US1_IMR EQU (0xFFFC4010) ;- (US1) Interrupt Mask Register +AT91C_US1_FIDI EQU (0xFFFC4040) ;- (US1) FI_DI_Ratio Register +AT91C_US1_CR EQU (0xFFFC4000) ;- (US1) Control Register +AT91C_US1_MR EQU (0xFFFC4004) ;- (US1) Mode Register +;- ========== Register definition for PDC_US0 peripheral ========== +AT91C_US0_TNPR EQU (0xFFFC0118) ;- (PDC_US0) Transmit Next Pointer Register +AT91C_US0_RNPR EQU (0xFFFC0110) ;- (PDC_US0) Receive Next Pointer Register +AT91C_US0_TCR EQU (0xFFFC010C) ;- (PDC_US0) Transmit Counter Register +AT91C_US0_PTCR EQU (0xFFFC0120) ;- (PDC_US0) PDC Transfer Control Register +AT91C_US0_PTSR EQU (0xFFFC0124) ;- (PDC_US0) PDC Transfer Status Register +AT91C_US0_TNCR EQU (0xFFFC011C) ;- (PDC_US0) Transmit Next Counter Register +AT91C_US0_TPR EQU (0xFFFC0108) ;- (PDC_US0) Transmit Pointer Register +AT91C_US0_RCR EQU (0xFFFC0104) ;- (PDC_US0) Receive Counter Register +AT91C_US0_RPR EQU (0xFFFC0100) ;- (PDC_US0) Receive Pointer Register +AT91C_US0_RNCR EQU (0xFFFC0114) ;- (PDC_US0) Receive Next Counter Register +;- ========== Register definition for US0 peripheral ========== +AT91C_US0_BRGR EQU (0xFFFC0020) ;- (US0) Baud Rate Generator Register +AT91C_US0_NER EQU (0xFFFC0044) ;- (US0) Nb Errors Register +AT91C_US0_CR EQU (0xFFFC0000) ;- (US0) Control Register +AT91C_US0_IMR EQU (0xFFFC0010) ;- (US0) Interrupt Mask Register +AT91C_US0_FIDI EQU (0xFFFC0040) ;- (US0) FI_DI_Ratio Register +AT91C_US0_TTGR EQU (0xFFFC0028) ;- (US0) Transmitter Time-guard Register +AT91C_US0_MR EQU (0xFFFC0004) ;- (US0) Mode Register +AT91C_US0_RTOR EQU (0xFFFC0024) ;- (US0) Receiver Time-out Register +AT91C_US0_CSR EQU (0xFFFC0014) ;- (US0) Channel Status Register +AT91C_US0_RHR EQU (0xFFFC0018) ;- (US0) Receiver Holding Register +AT91C_US0_IDR EQU (0xFFFC000C) ;- (US0) Interrupt Disable Register +AT91C_US0_THR EQU (0xFFFC001C) ;- (US0) Transmitter Holding Register +AT91C_US0_IF EQU (0xFFFC004C) ;- (US0) IRDA_FILTER Register +AT91C_US0_IER EQU (0xFFFC0008) ;- (US0) Interrupt Enable Register +;- ========== Register definition for PDC_SSC peripheral ========== +AT91C_SSC_TNCR EQU (0xFFFD411C) ;- (PDC_SSC) Transmit Next Counter Register +AT91C_SSC_RPR EQU (0xFFFD4100) ;- (PDC_SSC) Receive Pointer Register +AT91C_SSC_RNCR EQU (0xFFFD4114) ;- (PDC_SSC) Receive Next Counter Register +AT91C_SSC_TPR EQU (0xFFFD4108) ;- (PDC_SSC) Transmit Pointer Register +AT91C_SSC_PTCR EQU (0xFFFD4120) ;- (PDC_SSC) PDC Transfer Control Register +AT91C_SSC_TCR EQU (0xFFFD410C) ;- (PDC_SSC) Transmit Counter Register +AT91C_SSC_RCR EQU (0xFFFD4104) ;- (PDC_SSC) Receive Counter Register +AT91C_SSC_RNPR EQU (0xFFFD4110) ;- (PDC_SSC) Receive Next Pointer Register +AT91C_SSC_TNPR EQU (0xFFFD4118) ;- (PDC_SSC) Transmit Next Pointer Register +AT91C_SSC_PTSR EQU (0xFFFD4124) ;- (PDC_SSC) PDC Transfer Status Register +;- ========== Register definition for SSC peripheral ========== +AT91C_SSC_RHR EQU (0xFFFD4020) ;- (SSC) Receive Holding Register +AT91C_SSC_RSHR EQU (0xFFFD4030) ;- (SSC) Receive Sync Holding Register +AT91C_SSC_TFMR EQU (0xFFFD401C) ;- (SSC) Transmit Frame Mode Register +AT91C_SSC_IDR EQU (0xFFFD4048) ;- (SSC) Interrupt Disable Register +AT91C_SSC_THR EQU (0xFFFD4024) ;- (SSC) Transmit Holding Register +AT91C_SSC_RCMR EQU (0xFFFD4010) ;- (SSC) Receive Clock ModeRegister +AT91C_SSC_IER EQU (0xFFFD4044) ;- (SSC) Interrupt Enable Register +AT91C_SSC_TSHR EQU (0xFFFD4034) ;- (SSC) Transmit Sync Holding Register +AT91C_SSC_SR EQU (0xFFFD4040) ;- (SSC) Status Register +AT91C_SSC_CMR EQU (0xFFFD4004) ;- (SSC) Clock Mode Register +AT91C_SSC_TCMR EQU (0xFFFD4018) ;- (SSC) Transmit Clock Mode Register +AT91C_SSC_CR EQU (0xFFFD4000) ;- (SSC) Control Register +AT91C_SSC_IMR EQU (0xFFFD404C) ;- (SSC) Interrupt Mask Register +AT91C_SSC_RFMR EQU (0xFFFD4014) ;- (SSC) Receive Frame Mode Register +;- ========== Register definition for TWI peripheral ========== +AT91C_TWI_IER EQU (0xFFFB8024) ;- (TWI) Interrupt Enable Register +AT91C_TWI_CR EQU (0xFFFB8000) ;- (TWI) Control Register +AT91C_TWI_SR EQU (0xFFFB8020) ;- (TWI) Status Register +AT91C_TWI_IMR EQU (0xFFFB802C) ;- (TWI) Interrupt Mask Register +AT91C_TWI_THR EQU (0xFFFB8034) ;- (TWI) Transmit Holding Register +AT91C_TWI_IDR EQU (0xFFFB8028) ;- (TWI) Interrupt Disable Register +AT91C_TWI_IADR EQU (0xFFFB800C) ;- (TWI) Internal Address Register +AT91C_TWI_MMR EQU (0xFFFB8004) ;- (TWI) Master Mode Register +AT91C_TWI_CWGR EQU (0xFFFB8010) ;- (TWI) Clock Waveform Generator Register +AT91C_TWI_RHR EQU (0xFFFB8030) ;- (TWI) Receive Holding Register +;- ========== Register definition for PWMC_CH3 peripheral ========== +AT91C_PWMC_CH3_CUPDR EQU (0xFFFCC270) ;- (PWMC_CH3) Channel Update Register +AT91C_PWMC_CH3_Reserved EQU (0xFFFCC274) ;- (PWMC_CH3) Reserved +AT91C_PWMC_CH3_CPRDR EQU (0xFFFCC268) ;- (PWMC_CH3) Channel Period Register +AT91C_PWMC_CH3_CDTYR EQU (0xFFFCC264) ;- (PWMC_CH3) Channel Duty Cycle Register +AT91C_PWMC_CH3_CCNTR EQU (0xFFFCC26C) ;- (PWMC_CH3) Channel Counter Register +AT91C_PWMC_CH3_CMR EQU (0xFFFCC260) ;- (PWMC_CH3) Channel Mode Register +;- ========== Register definition for PWMC_CH2 peripheral ========== +AT91C_PWMC_CH2_Reserved EQU (0xFFFCC254) ;- (PWMC_CH2) Reserved +AT91C_PWMC_CH2_CMR EQU (0xFFFCC240) ;- (PWMC_CH2) Channel Mode Register +AT91C_PWMC_CH2_CCNTR EQU (0xFFFCC24C) ;- (PWMC_CH2) Channel Counter Register +AT91C_PWMC_CH2_CPRDR EQU (0xFFFCC248) ;- (PWMC_CH2) Channel Period Register +AT91C_PWMC_CH2_CUPDR EQU (0xFFFCC250) ;- (PWMC_CH2) Channel Update Register +AT91C_PWMC_CH2_CDTYR EQU (0xFFFCC244) ;- (PWMC_CH2) Channel Duty Cycle Register +;- ========== Register definition for PWMC_CH1 peripheral ========== +AT91C_PWMC_CH1_Reserved EQU (0xFFFCC234) ;- (PWMC_CH1) Reserved +AT91C_PWMC_CH1_CUPDR EQU (0xFFFCC230) ;- (PWMC_CH1) Channel Update Register +AT91C_PWMC_CH1_CPRDR EQU (0xFFFCC228) ;- (PWMC_CH1) Channel Period Register +AT91C_PWMC_CH1_CCNTR EQU (0xFFFCC22C) ;- (PWMC_CH1) Channel Counter Register +AT91C_PWMC_CH1_CDTYR EQU (0xFFFCC224) ;- (PWMC_CH1) Channel Duty Cycle Register +AT91C_PWMC_CH1_CMR EQU (0xFFFCC220) ;- (PWMC_CH1) Channel Mode Register +;- ========== Register definition for PWMC_CH0 peripheral ========== +AT91C_PWMC_CH0_Reserved EQU (0xFFFCC214) ;- (PWMC_CH0) Reserved +AT91C_PWMC_CH0_CPRDR EQU (0xFFFCC208) ;- (PWMC_CH0) Channel Period Register +AT91C_PWMC_CH0_CDTYR EQU (0xFFFCC204) ;- (PWMC_CH0) Channel Duty Cycle Register +AT91C_PWMC_CH0_CMR EQU (0xFFFCC200) ;- (PWMC_CH0) Channel Mode Register +AT91C_PWMC_CH0_CUPDR EQU (0xFFFCC210) ;- (PWMC_CH0) Channel Update Register +AT91C_PWMC_CH0_CCNTR EQU (0xFFFCC20C) ;- (PWMC_CH0) Channel Counter Register +;- ========== Register definition for PWMC peripheral ========== +AT91C_PWMC_IDR EQU (0xFFFCC014) ;- (PWMC) PWMC Interrupt Disable Register +AT91C_PWMC_DIS EQU (0xFFFCC008) ;- (PWMC) PWMC Disable Register +AT91C_PWMC_IER EQU (0xFFFCC010) ;- (PWMC) PWMC Interrupt Enable Register +AT91C_PWMC_VR EQU (0xFFFCC0FC) ;- (PWMC) PWMC Version Register +AT91C_PWMC_ISR EQU (0xFFFCC01C) ;- (PWMC) PWMC Interrupt Status Register +AT91C_PWMC_SR EQU (0xFFFCC00C) ;- (PWMC) PWMC Status Register +AT91C_PWMC_IMR EQU (0xFFFCC018) ;- (PWMC) PWMC Interrupt Mask Register +AT91C_PWMC_MR EQU (0xFFFCC000) ;- (PWMC) PWMC Mode Register +AT91C_PWMC_ENA EQU (0xFFFCC004) ;- (PWMC) PWMC Enable Register +;- ========== Register definition for UDP peripheral ========== +AT91C_UDP_IMR EQU (0xFFFB0018) ;- (UDP) Interrupt Mask Register +AT91C_UDP_FADDR EQU (0xFFFB0008) ;- (UDP) Function Address Register +AT91C_UDP_NUM EQU (0xFFFB0000) ;- (UDP) Frame Number Register +AT91C_UDP_FDR EQU (0xFFFB0050) ;- (UDP) Endpoint FIFO Data Register +AT91C_UDP_ISR EQU (0xFFFB001C) ;- (UDP) Interrupt Status Register +AT91C_UDP_CSR EQU (0xFFFB0030) ;- (UDP) Endpoint Control and Status Register +AT91C_UDP_IDR EQU (0xFFFB0014) ;- (UDP) Interrupt Disable Register +AT91C_UDP_ICR EQU (0xFFFB0020) ;- (UDP) Interrupt Clear Register +AT91C_UDP_RSTEP EQU (0xFFFB0028) ;- (UDP) Reset Endpoint Register +AT91C_UDP_TXVC EQU (0xFFFB0074) ;- (UDP) Transceiver Control Register +AT91C_UDP_GLBSTATE EQU (0xFFFB0004) ;- (UDP) Global State Register +AT91C_UDP_IER EQU (0xFFFB0010) ;- (UDP) Interrupt Enable Register +;- ========== Register definition for TC0 peripheral ========== +AT91C_TC0_SR EQU (0xFFFA0020) ;- (TC0) Status Register +AT91C_TC0_RC EQU (0xFFFA001C) ;- (TC0) Register C +AT91C_TC0_RB EQU (0xFFFA0018) ;- (TC0) Register B +AT91C_TC0_CCR EQU (0xFFFA0000) ;- (TC0) Channel Control Register +AT91C_TC0_CMR EQU (0xFFFA0004) ;- (TC0) Channel Mode Register (Capture Mode / Waveform Mode) +AT91C_TC0_IER EQU (0xFFFA0024) ;- (TC0) Interrupt Enable Register +AT91C_TC0_RA EQU (0xFFFA0014) ;- (TC0) Register A +AT91C_TC0_IDR EQU (0xFFFA0028) ;- (TC0) Interrupt Disable Register +AT91C_TC0_CV EQU (0xFFFA0010) ;- (TC0) Counter Value +AT91C_TC0_IMR EQU (0xFFFA002C) ;- (TC0) Interrupt Mask Register +;- ========== Register definition for TC1 peripheral ========== +AT91C_TC1_RB EQU (0xFFFA0058) ;- (TC1) Register B +AT91C_TC1_CCR EQU (0xFFFA0040) ;- (TC1) Channel Control Register +AT91C_TC1_IER EQU (0xFFFA0064) ;- (TC1) Interrupt Enable Register +AT91C_TC1_IDR EQU (0xFFFA0068) ;- (TC1) Interrupt Disable Register +AT91C_TC1_SR EQU (0xFFFA0060) ;- (TC1) Status Register +AT91C_TC1_CMR EQU (0xFFFA0044) ;- (TC1) Channel Mode Register (Capture Mode / Waveform Mode) +AT91C_TC1_RA EQU (0xFFFA0054) ;- (TC1) Register A +AT91C_TC1_RC EQU (0xFFFA005C) ;- (TC1) Register C +AT91C_TC1_IMR EQU (0xFFFA006C) ;- (TC1) Interrupt Mask Register +AT91C_TC1_CV EQU (0xFFFA0050) ;- (TC1) Counter Value +;- ========== Register definition for TC2 peripheral ========== +AT91C_TC2_CMR EQU (0xFFFA0084) ;- (TC2) Channel Mode Register (Capture Mode / Waveform Mode) +AT91C_TC2_CCR EQU (0xFFFA0080) ;- (TC2) Channel Control Register +AT91C_TC2_CV EQU (0xFFFA0090) ;- (TC2) Counter Value +AT91C_TC2_RA EQU (0xFFFA0094) ;- (TC2) Register A +AT91C_TC2_RB EQU (0xFFFA0098) ;- (TC2) Register B +AT91C_TC2_IDR EQU (0xFFFA00A8) ;- (TC2) Interrupt Disable Register +AT91C_TC2_IMR EQU (0xFFFA00AC) ;- (TC2) Interrupt Mask Register +AT91C_TC2_RC EQU (0xFFFA009C) ;- (TC2) Register C +AT91C_TC2_IER EQU (0xFFFA00A4) ;- (TC2) Interrupt Enable Register +AT91C_TC2_SR EQU (0xFFFA00A0) ;- (TC2) Status Register +;- ========== Register definition for TCB peripheral ========== +AT91C_TCB_BMR EQU (0xFFFA00C4) ;- (TCB) TC Block Mode Register +AT91C_TCB_BCR EQU (0xFFFA00C0) ;- (TCB) TC Block Control Register +;- ========== Register definition for CAN_MB0 peripheral ========== +AT91C_CAN_MB0_MDL EQU (0xFFFD0214) ;- (CAN_MB0) MailBox Data Low Register +AT91C_CAN_MB0_MAM EQU (0xFFFD0204) ;- (CAN_MB0) MailBox Acceptance Mask Register +AT91C_CAN_MB0_MCR EQU (0xFFFD021C) ;- (CAN_MB0) MailBox Control Register +AT91C_CAN_MB0_MID EQU (0xFFFD0208) ;- (CAN_MB0) MailBox ID Register +AT91C_CAN_MB0_MSR EQU (0xFFFD0210) ;- (CAN_MB0) MailBox Status Register +AT91C_CAN_MB0_MFID EQU (0xFFFD020C) ;- (CAN_MB0) MailBox Family ID Register +AT91C_CAN_MB0_MDH EQU (0xFFFD0218) ;- (CAN_MB0) MailBox Data High Register +AT91C_CAN_MB0_MMR EQU (0xFFFD0200) ;- (CAN_MB0) MailBox Mode Register +;- ========== Register definition for CAN_MB1 peripheral ========== +AT91C_CAN_MB1_MDL EQU (0xFFFD0234) ;- (CAN_MB1) MailBox Data Low Register +AT91C_CAN_MB1_MID EQU (0xFFFD0228) ;- (CAN_MB1) MailBox ID Register +AT91C_CAN_MB1_MMR EQU (0xFFFD0220) ;- (CAN_MB1) MailBox Mode Register +AT91C_CAN_MB1_MSR EQU (0xFFFD0230) ;- (CAN_MB1) MailBox Status Register +AT91C_CAN_MB1_MAM EQU (0xFFFD0224) ;- (CAN_MB1) MailBox Acceptance Mask Register +AT91C_CAN_MB1_MDH EQU (0xFFFD0238) ;- (CAN_MB1) MailBox Data High Register +AT91C_CAN_MB1_MCR EQU (0xFFFD023C) ;- (CAN_MB1) MailBox Control Register +AT91C_CAN_MB1_MFID EQU (0xFFFD022C) ;- (CAN_MB1) MailBox Family ID Register +;- ========== Register definition for CAN_MB2 peripheral ========== +AT91C_CAN_MB2_MCR EQU (0xFFFD025C) ;- (CAN_MB2) MailBox Control Register +AT91C_CAN_MB2_MDH EQU (0xFFFD0258) ;- (CAN_MB2) MailBox Data High Register +AT91C_CAN_MB2_MID EQU (0xFFFD0248) ;- (CAN_MB2) MailBox ID Register +AT91C_CAN_MB2_MDL EQU (0xFFFD0254) ;- (CAN_MB2) MailBox Data Low Register +AT91C_CAN_MB2_MMR EQU (0xFFFD0240) ;- (CAN_MB2) MailBox Mode Register +AT91C_CAN_MB2_MAM EQU (0xFFFD0244) ;- (CAN_MB2) MailBox Acceptance Mask Register +AT91C_CAN_MB2_MFID EQU (0xFFFD024C) ;- (CAN_MB2) MailBox Family ID Register +AT91C_CAN_MB2_MSR EQU (0xFFFD0250) ;- (CAN_MB2) MailBox Status Register +;- ========== Register definition for CAN_MB3 peripheral ========== +AT91C_CAN_MB3_MFID EQU (0xFFFD026C) ;- (CAN_MB3) MailBox Family ID Register +AT91C_CAN_MB3_MAM EQU (0xFFFD0264) ;- (CAN_MB3) MailBox Acceptance Mask Register +AT91C_CAN_MB3_MID EQU (0xFFFD0268) ;- (CAN_MB3) MailBox ID Register +AT91C_CAN_MB3_MCR EQU (0xFFFD027C) ;- (CAN_MB3) MailBox Control Register +AT91C_CAN_MB3_MMR EQU (0xFFFD0260) ;- (CAN_MB3) MailBox Mode Register +AT91C_CAN_MB3_MSR EQU (0xFFFD0270) ;- (CAN_MB3) MailBox Status Register +AT91C_CAN_MB3_MDL EQU (0xFFFD0274) ;- (CAN_MB3) MailBox Data Low Register +AT91C_CAN_MB3_MDH EQU (0xFFFD0278) ;- (CAN_MB3) MailBox Data High Register +;- ========== Register definition for CAN_MB4 peripheral ========== +AT91C_CAN_MB4_MID EQU (0xFFFD0288) ;- (CAN_MB4) MailBox ID Register +AT91C_CAN_MB4_MMR EQU (0xFFFD0280) ;- (CAN_MB4) MailBox Mode Register +AT91C_CAN_MB4_MDH EQU (0xFFFD0298) ;- (CAN_MB4) MailBox Data High Register +AT91C_CAN_MB4_MFID EQU (0xFFFD028C) ;- (CAN_MB4) MailBox Family ID Register +AT91C_CAN_MB4_MSR EQU (0xFFFD0290) ;- (CAN_MB4) MailBox Status Register +AT91C_CAN_MB4_MCR EQU (0xFFFD029C) ;- (CAN_MB4) MailBox Control Register +AT91C_CAN_MB4_MDL EQU (0xFFFD0294) ;- (CAN_MB4) MailBox Data Low Register +AT91C_CAN_MB4_MAM EQU (0xFFFD0284) ;- (CAN_MB4) MailBox Acceptance Mask Register +;- ========== Register definition for CAN_MB5 peripheral ========== +AT91C_CAN_MB5_MSR EQU (0xFFFD02B0) ;- (CAN_MB5) MailBox Status Register +AT91C_CAN_MB5_MCR EQU (0xFFFD02BC) ;- (CAN_MB5) MailBox Control Register +AT91C_CAN_MB5_MFID EQU (0xFFFD02AC) ;- (CAN_MB5) MailBox Family ID Register +AT91C_CAN_MB5_MDH EQU (0xFFFD02B8) ;- (CAN_MB5) MailBox Data High Register +AT91C_CAN_MB5_MID EQU (0xFFFD02A8) ;- (CAN_MB5) MailBox ID Register +AT91C_CAN_MB5_MMR EQU (0xFFFD02A0) ;- (CAN_MB5) MailBox Mode Register +AT91C_CAN_MB5_MDL EQU (0xFFFD02B4) ;- (CAN_MB5) MailBox Data Low Register +AT91C_CAN_MB5_MAM EQU (0xFFFD02A4) ;- (CAN_MB5) MailBox Acceptance Mask Register +;- ========== Register definition for CAN_MB6 peripheral ========== +AT91C_CAN_MB6_MFID EQU (0xFFFD02CC) ;- (CAN_MB6) MailBox Family ID Register +AT91C_CAN_MB6_MID EQU (0xFFFD02C8) ;- (CAN_MB6) MailBox ID Register +AT91C_CAN_MB6_MAM EQU (0xFFFD02C4) ;- (CAN_MB6) MailBox Acceptance Mask Register +AT91C_CAN_MB6_MSR EQU (0xFFFD02D0) ;- (CAN_MB6) MailBox Status Register +AT91C_CAN_MB6_MDL EQU (0xFFFD02D4) ;- (CAN_MB6) MailBox Data Low Register +AT91C_CAN_MB6_MCR EQU (0xFFFD02DC) ;- (CAN_MB6) MailBox Control Register +AT91C_CAN_MB6_MDH EQU (0xFFFD02D8) ;- (CAN_MB6) MailBox Data High Register +AT91C_CAN_MB6_MMR EQU (0xFFFD02C0) ;- (CAN_MB6) MailBox Mode Register +;- ========== Register definition for CAN_MB7 peripheral ========== +AT91C_CAN_MB7_MCR EQU (0xFFFD02FC) ;- (CAN_MB7) MailBox Control Register +AT91C_CAN_MB7_MDH EQU (0xFFFD02F8) ;- (CAN_MB7) MailBox Data High Register +AT91C_CAN_MB7_MFID EQU (0xFFFD02EC) ;- (CAN_MB7) MailBox Family ID Register +AT91C_CAN_MB7_MDL EQU (0xFFFD02F4) ;- (CAN_MB7) MailBox Data Low Register +AT91C_CAN_MB7_MID EQU (0xFFFD02E8) ;- (CAN_MB7) MailBox ID Register +AT91C_CAN_MB7_MMR EQU (0xFFFD02E0) ;- (CAN_MB7) MailBox Mode Register +AT91C_CAN_MB7_MAM EQU (0xFFFD02E4) ;- (CAN_MB7) MailBox Acceptance Mask Register +AT91C_CAN_MB7_MSR EQU (0xFFFD02F0) ;- (CAN_MB7) MailBox Status Register +;- ========== Register definition for CAN peripheral ========== +AT91C_CAN_TCR EQU (0xFFFD0024) ;- (CAN) Transfer Command Register +AT91C_CAN_IMR EQU (0xFFFD000C) ;- (CAN) Interrupt Mask Register +AT91C_CAN_IER EQU (0xFFFD0004) ;- (CAN) Interrupt Enable Register +AT91C_CAN_ECR EQU (0xFFFD0020) ;- (CAN) Error Counter Register +AT91C_CAN_TIMESTP EQU (0xFFFD001C) ;- (CAN) Time Stamp Register +AT91C_CAN_MR EQU (0xFFFD0000) ;- (CAN) Mode Register +AT91C_CAN_IDR EQU (0xFFFD0008) ;- (CAN) Interrupt Disable Register +AT91C_CAN_ACR EQU (0xFFFD0028) ;- (CAN) Abort Command Register +AT91C_CAN_TIM EQU (0xFFFD0018) ;- (CAN) Timer Register +AT91C_CAN_SR EQU (0xFFFD0010) ;- (CAN) Status Register +AT91C_CAN_BR EQU (0xFFFD0014) ;- (CAN) Baudrate Register +AT91C_CAN_VR EQU (0xFFFD00FC) ;- (CAN) Version Register +;- ========== Register definition for EMAC peripheral ========== +AT91C_EMAC_ISR EQU (0xFFFDC024) ;- (EMAC) Interrupt Status Register +AT91C_EMAC_SA4H EQU (0xFFFDC0B4) ;- (EMAC) Specific Address 4 Top, Last 2 bytes +AT91C_EMAC_SA1L EQU (0xFFFDC098) ;- (EMAC) Specific Address 1 Bottom, First 4 bytes +AT91C_EMAC_ELE EQU (0xFFFDC078) ;- (EMAC) Excessive Length Errors Register +AT91C_EMAC_LCOL EQU (0xFFFDC05C) ;- (EMAC) Late Collision Register +AT91C_EMAC_RLE EQU (0xFFFDC088) ;- (EMAC) Receive Length Field Mismatch Register +AT91C_EMAC_WOL EQU (0xFFFDC0C4) ;- (EMAC) Wake On LAN Register +AT91C_EMAC_DTF EQU (0xFFFDC058) ;- (EMAC) Deferred Transmission Frame Register +AT91C_EMAC_TUND EQU (0xFFFDC064) ;- (EMAC) Transmit Underrun Error Register +AT91C_EMAC_NCR EQU (0xFFFDC000) ;- (EMAC) Network Control Register +AT91C_EMAC_SA4L EQU (0xFFFDC0B0) ;- (EMAC) Specific Address 4 Bottom, First 4 bytes +AT91C_EMAC_RSR EQU (0xFFFDC020) ;- (EMAC) Receive Status Register +AT91C_EMAC_SA3L EQU (0xFFFDC0A8) ;- (EMAC) Specific Address 3 Bottom, First 4 bytes +AT91C_EMAC_TSR EQU (0xFFFDC014) ;- (EMAC) Transmit Status Register +AT91C_EMAC_IDR EQU (0xFFFDC02C) ;- (EMAC) Interrupt Disable Register +AT91C_EMAC_RSE EQU (0xFFFDC074) ;- (EMAC) Receive Symbol Errors Register +AT91C_EMAC_ECOL EQU (0xFFFDC060) ;- (EMAC) Excessive Collision Register +AT91C_EMAC_TID EQU (0xFFFDC0B8) ;- (EMAC) Type ID Checking Register +AT91C_EMAC_HRB EQU (0xFFFDC090) ;- (EMAC) Hash Address Bottom[31:0] +AT91C_EMAC_TBQP EQU (0xFFFDC01C) ;- (EMAC) Transmit Buffer Queue Pointer +AT91C_EMAC_USRIO EQU (0xFFFDC0C0) ;- (EMAC) USER Input/Output Register +AT91C_EMAC_PTR EQU (0xFFFDC038) ;- (EMAC) Pause Time Register +AT91C_EMAC_SA2H EQU (0xFFFDC0A4) ;- (EMAC) Specific Address 2 Top, Last 2 bytes +AT91C_EMAC_ROV EQU (0xFFFDC070) ;- (EMAC) Receive Overrun Errors Register +AT91C_EMAC_ALE EQU (0xFFFDC054) ;- (EMAC) Alignment Error Register +AT91C_EMAC_RJA EQU (0xFFFDC07C) ;- (EMAC) Receive Jabbers Register +AT91C_EMAC_RBQP EQU (0xFFFDC018) ;- (EMAC) Receive Buffer Queue Pointer +AT91C_EMAC_TPF EQU (0xFFFDC08C) ;- (EMAC) Transmitted Pause Frames Register +AT91C_EMAC_NCFGR EQU (0xFFFDC004) ;- (EMAC) Network Configuration Register +AT91C_EMAC_HRT EQU (0xFFFDC094) ;- (EMAC) Hash Address Top[63:32] +AT91C_EMAC_USF EQU (0xFFFDC080) ;- (EMAC) Undersize Frames Register +AT91C_EMAC_FCSE EQU (0xFFFDC050) ;- (EMAC) Frame Check Sequence Error Register +AT91C_EMAC_TPQ EQU (0xFFFDC0BC) ;- (EMAC) Transmit Pause Quantum Register +AT91C_EMAC_MAN EQU (0xFFFDC034) ;- (EMAC) PHY Maintenance Register +AT91C_EMAC_FTO EQU (0xFFFDC040) ;- (EMAC) Frames Transmitted OK Register +AT91C_EMAC_REV EQU (0xFFFDC0FC) ;- (EMAC) Revision Register +AT91C_EMAC_IMR EQU (0xFFFDC030) ;- (EMAC) Interrupt Mask Register +AT91C_EMAC_SCF EQU (0xFFFDC044) ;- (EMAC) Single Collision Frame Register +AT91C_EMAC_PFR EQU (0xFFFDC03C) ;- (EMAC) Pause Frames received Register +AT91C_EMAC_MCF EQU (0xFFFDC048) ;- (EMAC) Multiple Collision Frame Register +AT91C_EMAC_NSR EQU (0xFFFDC008) ;- (EMAC) Network Status Register +AT91C_EMAC_SA2L EQU (0xFFFDC0A0) ;- (EMAC) Specific Address 2 Bottom, First 4 bytes +AT91C_EMAC_FRO EQU (0xFFFDC04C) ;- (EMAC) Frames Received OK Register +AT91C_EMAC_IER EQU (0xFFFDC028) ;- (EMAC) Interrupt Enable Register +AT91C_EMAC_SA1H EQU (0xFFFDC09C) ;- (EMAC) Specific Address 1 Top, Last 2 bytes +AT91C_EMAC_CSE EQU (0xFFFDC068) ;- (EMAC) Carrier Sense Error Register +AT91C_EMAC_SA3H EQU (0xFFFDC0AC) ;- (EMAC) Specific Address 3 Top, Last 2 bytes +AT91C_EMAC_RRE EQU (0xFFFDC06C) ;- (EMAC) Receive Ressource Error Register +AT91C_EMAC_STE EQU (0xFFFDC084) ;- (EMAC) SQE Test Error Register +;- ========== Register definition for PDC_ADC peripheral ========== +AT91C_ADC_PTSR EQU (0xFFFD8124) ;- (PDC_ADC) PDC Transfer Status Register +AT91C_ADC_PTCR EQU (0xFFFD8120) ;- (PDC_ADC) PDC Transfer Control Register +AT91C_ADC_TNPR EQU (0xFFFD8118) ;- (PDC_ADC) Transmit Next Pointer Register +AT91C_ADC_TNCR EQU (0xFFFD811C) ;- (PDC_ADC) Transmit Next Counter Register +AT91C_ADC_RNPR EQU (0xFFFD8110) ;- (PDC_ADC) Receive Next Pointer Register +AT91C_ADC_RNCR EQU (0xFFFD8114) ;- (PDC_ADC) Receive Next Counter Register +AT91C_ADC_RPR EQU (0xFFFD8100) ;- (PDC_ADC) Receive Pointer Register +AT91C_ADC_TCR EQU (0xFFFD810C) ;- (PDC_ADC) Transmit Counter Register +AT91C_ADC_TPR EQU (0xFFFD8108) ;- (PDC_ADC) Transmit Pointer Register +AT91C_ADC_RCR EQU (0xFFFD8104) ;- (PDC_ADC) Receive Counter Register +;- ========== Register definition for ADC peripheral ========== +AT91C_ADC_CDR2 EQU (0xFFFD8038) ;- (ADC) ADC Channel Data Register 2 +AT91C_ADC_CDR3 EQU (0xFFFD803C) ;- (ADC) ADC Channel Data Register 3 +AT91C_ADC_CDR0 EQU (0xFFFD8030) ;- (ADC) ADC Channel Data Register 0 +AT91C_ADC_CDR5 EQU (0xFFFD8044) ;- (ADC) ADC Channel Data Register 5 +AT91C_ADC_CHDR EQU (0xFFFD8014) ;- (ADC) ADC Channel Disable Register +AT91C_ADC_SR EQU (0xFFFD801C) ;- (ADC) ADC Status Register +AT91C_ADC_CDR4 EQU (0xFFFD8040) ;- (ADC) ADC Channel Data Register 4 +AT91C_ADC_CDR1 EQU (0xFFFD8034) ;- (ADC) ADC Channel Data Register 1 +AT91C_ADC_LCDR EQU (0xFFFD8020) ;- (ADC) ADC Last Converted Data Register +AT91C_ADC_IDR EQU (0xFFFD8028) ;- (ADC) ADC Interrupt Disable Register +AT91C_ADC_CR EQU (0xFFFD8000) ;- (ADC) ADC Control Register +AT91C_ADC_CDR7 EQU (0xFFFD804C) ;- (ADC) ADC Channel Data Register 7 +AT91C_ADC_CDR6 EQU (0xFFFD8048) ;- (ADC) ADC Channel Data Register 6 +AT91C_ADC_IER EQU (0xFFFD8024) ;- (ADC) ADC Interrupt Enable Register +AT91C_ADC_CHER EQU (0xFFFD8010) ;- (ADC) ADC Channel Enable Register +AT91C_ADC_CHSR EQU (0xFFFD8018) ;- (ADC) ADC Channel Status Register +AT91C_ADC_MR EQU (0xFFFD8004) ;- (ADC) ADC Mode Register +AT91C_ADC_IMR EQU (0xFFFD802C) ;- (ADC) ADC Interrupt Mask Register + +;- ***************************************************************************** +;- PIO DEFINITIONS FOR AT91SAM7X256 +;- ***************************************************************************** +AT91C_PIO_PA0 EQU (1:SHL:0) ;- Pin Controlled by PA0 +AT91C_PA0_RXD0 EQU (AT91C_PIO_PA0) ;- USART 0 Receive Data +AT91C_PIO_PA1 EQU (1:SHL:1) ;- Pin Controlled by PA1 +AT91C_PA1_TXD0 EQU (AT91C_PIO_PA1) ;- USART 0 Transmit Data +AT91C_PIO_PA10 EQU (1:SHL:10) ;- Pin Controlled by PA10 +AT91C_PA10_TWD EQU (AT91C_PIO_PA10) ;- TWI Two-wire Serial Data +AT91C_PIO_PA11 EQU (1:SHL:11) ;- Pin Controlled by PA11 +AT91C_PA11_TWCK EQU (AT91C_PIO_PA11) ;- TWI Two-wire Serial Clock +AT91C_PIO_PA12 EQU (1:SHL:12) ;- Pin Controlled by PA12 +AT91C_PA12_SPI0_NPCS0 EQU (AT91C_PIO_PA12) ;- SPI 0 Peripheral Chip Select 0 +AT91C_PIO_PA13 EQU (1:SHL:13) ;- Pin Controlled by PA13 +AT91C_PA13_SPI0_NPCS1 EQU (AT91C_PIO_PA13) ;- SPI 0 Peripheral Chip Select 1 +AT91C_PA13_PCK1 EQU (AT91C_PIO_PA13) ;- PMC Programmable Clock Output 1 +AT91C_PIO_PA14 EQU (1:SHL:14) ;- Pin Controlled by PA14 +AT91C_PA14_SPI0_NPCS2 EQU (AT91C_PIO_PA14) ;- SPI 0 Peripheral Chip Select 2 +AT91C_PA14_IRQ1 EQU (AT91C_PIO_PA14) ;- External Interrupt 1 +AT91C_PIO_PA15 EQU (1:SHL:15) ;- Pin Controlled by PA15 +AT91C_PA15_SPI0_NPCS3 EQU (AT91C_PIO_PA15) ;- SPI 0 Peripheral Chip Select 3 +AT91C_PA15_TCLK2 EQU (AT91C_PIO_PA15) ;- Timer Counter 2 external clock input +AT91C_PIO_PA16 EQU (1:SHL:16) ;- Pin Controlled by PA16 +AT91C_PA16_SPI0_MISO EQU (AT91C_PIO_PA16) ;- SPI 0 Master In Slave +AT91C_PIO_PA17 EQU (1:SHL:17) ;- Pin Controlled by PA17 +AT91C_PA17_SPI0_MOSI EQU (AT91C_PIO_PA17) ;- SPI 0 Master Out Slave +AT91C_PIO_PA18 EQU (1:SHL:18) ;- Pin Controlled by PA18 +AT91C_PA18_SPI0_SPCK EQU (AT91C_PIO_PA18) ;- SPI 0 Serial Clock +AT91C_PIO_PA19 EQU (1:SHL:19) ;- Pin Controlled by PA19 +AT91C_PA19_CANRX EQU (AT91C_PIO_PA19) ;- CAN Receive +AT91C_PIO_PA2 EQU (1:SHL:2) ;- Pin Controlled by PA2 +AT91C_PA2_SCK0 EQU (AT91C_PIO_PA2) ;- USART 0 Serial Clock +AT91C_PA2_SPI1_NPCS1 EQU (AT91C_PIO_PA2) ;- SPI 1 Peripheral Chip Select 1 +AT91C_PIO_PA20 EQU (1:SHL:20) ;- Pin Controlled by PA20 +AT91C_PA20_CANTX EQU (AT91C_PIO_PA20) ;- CAN Transmit +AT91C_PIO_PA21 EQU (1:SHL:21) ;- Pin Controlled by PA21 +AT91C_PA21_TF EQU (AT91C_PIO_PA21) ;- SSC Transmit Frame Sync +AT91C_PA21_SPI1_NPCS0 EQU (AT91C_PIO_PA21) ;- SPI 1 Peripheral Chip Select 0 +AT91C_PIO_PA22 EQU (1:SHL:22) ;- Pin Controlled by PA22 +AT91C_PA22_TK EQU (AT91C_PIO_PA22) ;- SSC Transmit Clock +AT91C_PA22_SPI1_SPCK EQU (AT91C_PIO_PA22) ;- SPI 1 Serial Clock +AT91C_PIO_PA23 EQU (1:SHL:23) ;- Pin Controlled by PA23 +AT91C_PA23_TD EQU (AT91C_PIO_PA23) ;- SSC Transmit data +AT91C_PA23_SPI1_MOSI EQU (AT91C_PIO_PA23) ;- SPI 1 Master Out Slave +AT91C_PIO_PA24 EQU (1:SHL:24) ;- Pin Controlled by PA24 +AT91C_PA24_RD EQU (AT91C_PIO_PA24) ;- SSC Receive Data +AT91C_PA24_SPI1_MISO EQU (AT91C_PIO_PA24) ;- SPI 1 Master In Slave +AT91C_PIO_PA25 EQU (1:SHL:25) ;- Pin Controlled by PA25 +AT91C_PA25_RK EQU (AT91C_PIO_PA25) ;- SSC Receive Clock +AT91C_PA25_SPI1_NPCS1 EQU (AT91C_PIO_PA25) ;- SPI 1 Peripheral Chip Select 1 +AT91C_PIO_PA26 EQU (1:SHL:26) ;- Pin Controlled by PA26 +AT91C_PA26_RF EQU (AT91C_PIO_PA26) ;- SSC Receive Frame Sync +AT91C_PA26_SPI1_NPCS2 EQU (AT91C_PIO_PA26) ;- SPI 1 Peripheral Chip Select 2 +AT91C_PIO_PA27 EQU (1:SHL:27) ;- Pin Controlled by PA27 +AT91C_PA27_DRXD EQU (AT91C_PIO_PA27) ;- DBGU Debug Receive Data +AT91C_PA27_PCK3 EQU (AT91C_PIO_PA27) ;- PMC Programmable Clock Output 3 +AT91C_PIO_PA28 EQU (1:SHL:28) ;- Pin Controlled by PA28 +AT91C_PA28_DTXD EQU (AT91C_PIO_PA28) ;- DBGU Debug Transmit Data +AT91C_PIO_PA29 EQU (1:SHL:29) ;- Pin Controlled by PA29 +AT91C_PA29_FIQ EQU (AT91C_PIO_PA29) ;- AIC Fast Interrupt Input +AT91C_PA29_SPI1_NPCS3 EQU (AT91C_PIO_PA29) ;- SPI 1 Peripheral Chip Select 3 +AT91C_PIO_PA3 EQU (1:SHL:3) ;- Pin Controlled by PA3 +AT91C_PA3_RTS0 EQU (AT91C_PIO_PA3) ;- USART 0 Ready To Send +AT91C_PA3_SPI1_NPCS2 EQU (AT91C_PIO_PA3) ;- SPI 1 Peripheral Chip Select 2 +AT91C_PIO_PA30 EQU (1:SHL:30) ;- Pin Controlled by PA30 +AT91C_PA30_IRQ0 EQU (AT91C_PIO_PA30) ;- External Interrupt 0 +AT91C_PA30_PCK2 EQU (AT91C_PIO_PA30) ;- PMC Programmable Clock Output 2 +AT91C_PIO_PA4 EQU (1:SHL:4) ;- Pin Controlled by PA4 +AT91C_PA4_CTS0 EQU (AT91C_PIO_PA4) ;- USART 0 Clear To Send +AT91C_PA4_SPI1_NPCS3 EQU (AT91C_PIO_PA4) ;- SPI 1 Peripheral Chip Select 3 +AT91C_PIO_PA5 EQU (1:SHL:5) ;- Pin Controlled by PA5 +AT91C_PA5_RXD1 EQU (AT91C_PIO_PA5) ;- USART 1 Receive Data +AT91C_PIO_PA6 EQU (1:SHL:6) ;- Pin Controlled by PA6 +AT91C_PA6_TXD1 EQU (AT91C_PIO_PA6) ;- USART 1 Transmit Data +AT91C_PIO_PA7 EQU (1:SHL:7) ;- Pin Controlled by PA7 +AT91C_PA7_SCK1 EQU (AT91C_PIO_PA7) ;- USART 1 Serial Clock +AT91C_PA7_SPI0_NPCS1 EQU (AT91C_PIO_PA7) ;- SPI 0 Peripheral Chip Select 1 +AT91C_PIO_PA8 EQU (1:SHL:8) ;- Pin Controlled by PA8 +AT91C_PA8_RTS1 EQU (AT91C_PIO_PA8) ;- USART 1 Ready To Send +AT91C_PA8_SPI0_NPCS2 EQU (AT91C_PIO_PA8) ;- SPI 0 Peripheral Chip Select 2 +AT91C_PIO_PA9 EQU (1:SHL:9) ;- Pin Controlled by PA9 +AT91C_PA9_CTS1 EQU (AT91C_PIO_PA9) ;- USART 1 Clear To Send +AT91C_PA9_SPI0_NPCS3 EQU (AT91C_PIO_PA9) ;- SPI 0 Peripheral Chip Select 3 +AT91C_PIO_PB0 EQU (1:SHL:0) ;- Pin Controlled by PB0 +AT91C_PB0_ETXCK_EREFCK EQU (AT91C_PIO_PB0) ;- Ethernet MAC Transmit Clock/Reference Clock +AT91C_PB0_PCK0 EQU (AT91C_PIO_PB0) ;- PMC Programmable Clock Output 0 +AT91C_PIO_PB1 EQU (1:SHL:1) ;- Pin Controlled by PB1 +AT91C_PB1_ETXEN EQU (AT91C_PIO_PB1) ;- Ethernet MAC Transmit Enable +AT91C_PIO_PB10 EQU (1:SHL:10) ;- Pin Controlled by PB10 +AT91C_PB10_ETX2 EQU (AT91C_PIO_PB10) ;- Ethernet MAC Transmit Data 2 +AT91C_PB10_SPI1_NPCS1 EQU (AT91C_PIO_PB10) ;- SPI 1 Peripheral Chip Select 1 +AT91C_PIO_PB11 EQU (1:SHL:11) ;- Pin Controlled by PB11 +AT91C_PB11_ETX3 EQU (AT91C_PIO_PB11) ;- Ethernet MAC Transmit Data 3 +AT91C_PB11_SPI1_NPCS2 EQU (AT91C_PIO_PB11) ;- SPI 1 Peripheral Chip Select 2 +AT91C_PIO_PB12 EQU (1:SHL:12) ;- Pin Controlled by PB12 +AT91C_PB12_ETXER EQU (AT91C_PIO_PB12) ;- Ethernet MAC Transmikt Coding Error +AT91C_PB12_TCLK0 EQU (AT91C_PIO_PB12) ;- Timer Counter 0 external clock input +AT91C_PIO_PB13 EQU (1:SHL:13) ;- Pin Controlled by PB13 +AT91C_PB13_ERX2 EQU (AT91C_PIO_PB13) ;- Ethernet MAC Receive Data 2 +AT91C_PB13_SPI0_NPCS1 EQU (AT91C_PIO_PB13) ;- SPI 0 Peripheral Chip Select 1 +AT91C_PIO_PB14 EQU (1:SHL:14) ;- Pin Controlled by PB14 +AT91C_PB14_ERX3 EQU (AT91C_PIO_PB14) ;- Ethernet MAC Receive Data 3 +AT91C_PB14_SPI0_NPCS2 EQU (AT91C_PIO_PB14) ;- SPI 0 Peripheral Chip Select 2 +AT91C_PIO_PB15 EQU (1:SHL:15) ;- Pin Controlled by PB15 +AT91C_PB15_ERXDV_ECRSDV EQU (AT91C_PIO_PB15) ;- Ethernet MAC Receive Data Valid +AT91C_PIO_PB16 EQU (1:SHL:16) ;- Pin Controlled by PB16 +AT91C_PB16_ECOL EQU (AT91C_PIO_PB16) ;- Ethernet MAC Collision Detected +AT91C_PB16_SPI1_NPCS3 EQU (AT91C_PIO_PB16) ;- SPI 1 Peripheral Chip Select 3 +AT91C_PIO_PB17 EQU (1:SHL:17) ;- Pin Controlled by PB17 +AT91C_PB17_ERXCK EQU (AT91C_PIO_PB17) ;- Ethernet MAC Receive Clock +AT91C_PB17_SPI0_NPCS3 EQU (AT91C_PIO_PB17) ;- SPI 0 Peripheral Chip Select 3 +AT91C_PIO_PB18 EQU (1:SHL:18) ;- Pin Controlled by PB18 +AT91C_PB18_EF100 EQU (AT91C_PIO_PB18) ;- Ethernet MAC Force 100 Mbits/sec +AT91C_PB18_ADTRG EQU (AT91C_PIO_PB18) ;- ADC External Trigger +AT91C_PIO_PB19 EQU (1:SHL:19) ;- Pin Controlled by PB19 +AT91C_PB19_PWM0 EQU (AT91C_PIO_PB19) ;- PWM Channel 0 +AT91C_PB19_TCLK1 EQU (AT91C_PIO_PB19) ;- Timer Counter 1 external clock input +AT91C_PIO_PB2 EQU (1:SHL:2) ;- Pin Controlled by PB2 +AT91C_PB2_ETX0 EQU (AT91C_PIO_PB2) ;- Ethernet MAC Transmit Data 0 +AT91C_PIO_PB20 EQU (1:SHL:20) ;- Pin Controlled by PB20 +AT91C_PB20_PWM1 EQU (AT91C_PIO_PB20) ;- PWM Channel 1 +AT91C_PB20_PCK0 EQU (AT91C_PIO_PB20) ;- PMC Programmable Clock Output 0 +AT91C_PIO_PB21 EQU (1:SHL:21) ;- Pin Controlled by PB21 +AT91C_PB21_PWM2 EQU (AT91C_PIO_PB21) ;- PWM Channel 2 +AT91C_PB21_PCK1 EQU (AT91C_PIO_PB21) ;- PMC Programmable Clock Output 1 +AT91C_PIO_PB22 EQU (1:SHL:22) ;- Pin Controlled by PB22 +AT91C_PB22_PWM3 EQU (AT91C_PIO_PB22) ;- PWM Channel 3 +AT91C_PB22_PCK2 EQU (AT91C_PIO_PB22) ;- PMC Programmable Clock Output 2 +AT91C_PIO_PB23 EQU (1:SHL:23) ;- Pin Controlled by PB23 +AT91C_PB23_TIOA0 EQU (AT91C_PIO_PB23) ;- Timer Counter 0 Multipurpose Timer I/O Pin A +AT91C_PB23_DCD1 EQU (AT91C_PIO_PB23) ;- USART 1 Data Carrier Detect +AT91C_PIO_PB24 EQU (1:SHL:24) ;- Pin Controlled by PB24 +AT91C_PB24_TIOB0 EQU (AT91C_PIO_PB24) ;- Timer Counter 0 Multipurpose Timer I/O Pin B +AT91C_PB24_DSR1 EQU (AT91C_PIO_PB24) ;- USART 1 Data Set ready +AT91C_PIO_PB25 EQU (1:SHL:25) ;- Pin Controlled by PB25 +AT91C_PB25_TIOA1 EQU (AT91C_PIO_PB25) ;- Timer Counter 1 Multipurpose Timer I/O Pin A +AT91C_PB25_DTR1 EQU (AT91C_PIO_PB25) ;- USART 1 Data Terminal ready +AT91C_PIO_PB26 EQU (1:SHL:26) ;- Pin Controlled by PB26 +AT91C_PB26_TIOB1 EQU (AT91C_PIO_PB26) ;- Timer Counter 1 Multipurpose Timer I/O Pin B +AT91C_PB26_RI1 EQU (AT91C_PIO_PB26) ;- USART 1 Ring Indicator +AT91C_PIO_PB27 EQU (1:SHL:27) ;- Pin Controlled by PB27 +AT91C_PB27_TIOA2 EQU (AT91C_PIO_PB27) ;- Timer Counter 2 Multipurpose Timer I/O Pin A +AT91C_PB27_PWM0 EQU (AT91C_PIO_PB27) ;- PWM Channel 0 +AT91C_PIO_PB28 EQU (1:SHL:28) ;- Pin Controlled by PB28 +AT91C_PB28_TIOB2 EQU (AT91C_PIO_PB28) ;- Timer Counter 2 Multipurpose Timer I/O Pin B +AT91C_PB28_PWM1 EQU (AT91C_PIO_PB28) ;- PWM Channel 1 +AT91C_PIO_PB29 EQU (1:SHL:29) ;- Pin Controlled by PB29 +AT91C_PB29_PCK1 EQU (AT91C_PIO_PB29) ;- PMC Programmable Clock Output 1 +AT91C_PB29_PWM2 EQU (AT91C_PIO_PB29) ;- PWM Channel 2 +AT91C_PIO_PB3 EQU (1:SHL:3) ;- Pin Controlled by PB3 +AT91C_PB3_ETX1 EQU (AT91C_PIO_PB3) ;- Ethernet MAC Transmit Data 1 +AT91C_PIO_PB30 EQU (1:SHL:30) ;- Pin Controlled by PB30 +AT91C_PB30_PCK2 EQU (AT91C_PIO_PB30) ;- PMC Programmable Clock Output 2 +AT91C_PB30_PWM3 EQU (AT91C_PIO_PB30) ;- PWM Channel 3 +AT91C_PIO_PB4 EQU (1:SHL:4) ;- Pin Controlled by PB4 +AT91C_PB4_ECRS EQU (AT91C_PIO_PB4) ;- Ethernet MAC Carrier Sense/Carrier Sense and Data Valid +AT91C_PIO_PB5 EQU (1:SHL:5) ;- Pin Controlled by PB5 +AT91C_PB5_ERX0 EQU (AT91C_PIO_PB5) ;- Ethernet MAC Receive Data 0 +AT91C_PIO_PB6 EQU (1:SHL:6) ;- Pin Controlled by PB6 +AT91C_PB6_ERX1 EQU (AT91C_PIO_PB6) ;- Ethernet MAC Receive Data 1 +AT91C_PIO_PB7 EQU (1:SHL:7) ;- Pin Controlled by PB7 +AT91C_PB7_ERXER EQU (AT91C_PIO_PB7) ;- Ethernet MAC Receive Error +AT91C_PIO_PB8 EQU (1:SHL:8) ;- Pin Controlled by PB8 +AT91C_PB8_EMDC EQU (AT91C_PIO_PB8) ;- Ethernet MAC Management Data Clock +AT91C_PIO_PB9 EQU (1:SHL:9) ;- Pin Controlled by PB9 +AT91C_PB9_EMDIO EQU (AT91C_PIO_PB9) ;- Ethernet MAC Management Data Input/Output + +;- ***************************************************************************** +;- PERIPHERAL ID DEFINITIONS FOR AT91SAM7X256 +;- ***************************************************************************** +AT91C_ID_FIQ EQU ( 0) ;- Advanced Interrupt Controller (FIQ) +AT91C_ID_SYS EQU ( 1) ;- System Peripheral +AT91C_ID_PIOA EQU ( 2) ;- Parallel IO Controller A +AT91C_ID_PIOB EQU ( 3) ;- Parallel IO Controller B +AT91C_ID_SPI0 EQU ( 4) ;- Serial Peripheral Interface 0 +AT91C_ID_SPI1 EQU ( 5) ;- Serial Peripheral Interface 1 +AT91C_ID_US0 EQU ( 6) ;- USART 0 +AT91C_ID_US1 EQU ( 7) ;- USART 1 +AT91C_ID_SSC EQU ( 8) ;- Serial Synchronous Controller +AT91C_ID_TWI EQU ( 9) ;- Two-Wire Interface +AT91C_ID_PWMC EQU (10) ;- PWM Controller +AT91C_ID_UDP EQU (11) ;- USB Device Port +AT91C_ID_TC0 EQU (12) ;- Timer Counter 0 +AT91C_ID_TC1 EQU (13) ;- Timer Counter 1 +AT91C_ID_TC2 EQU (14) ;- Timer Counter 2 +AT91C_ID_CAN EQU (15) ;- Control Area Network Controller +AT91C_ID_EMAC EQU (16) ;- Ethernet MAC +AT91C_ID_ADC EQU (17) ;- Analog-to-Digital Converter +AT91C_ID_18_Reserved EQU (18) ;- Reserved +AT91C_ID_19_Reserved EQU (19) ;- Reserved +AT91C_ID_20_Reserved EQU (20) ;- Reserved +AT91C_ID_21_Reserved EQU (21) ;- Reserved +AT91C_ID_22_Reserved EQU (22) ;- Reserved +AT91C_ID_23_Reserved EQU (23) ;- Reserved +AT91C_ID_24_Reserved EQU (24) ;- Reserved +AT91C_ID_25_Reserved EQU (25) ;- Reserved +AT91C_ID_26_Reserved EQU (26) ;- Reserved +AT91C_ID_27_Reserved EQU (27) ;- Reserved +AT91C_ID_28_Reserved EQU (28) ;- Reserved +AT91C_ID_29_Reserved EQU (29) ;- Reserved +AT91C_ID_IRQ0 EQU (30) ;- Advanced Interrupt Controller (IRQ0) +AT91C_ID_IRQ1 EQU (31) ;- Advanced Interrupt Controller (IRQ1) +AT91C_ALL_INT EQU (0xC003FFFF) ;- ALL VALID INTERRUPTS + +;- ***************************************************************************** +;- BASE ADDRESS DEFINITIONS FOR AT91SAM7X256 +;- ***************************************************************************** +AT91C_BASE_SYS EQU (0xFFFFF000) ;- (SYS) Base Address +AT91C_BASE_AIC EQU (0xFFFFF000) ;- (AIC) Base Address +AT91C_BASE_PDC_DBGU EQU (0xFFFFF300) ;- (PDC_DBGU) Base Address +AT91C_BASE_DBGU EQU (0xFFFFF200) ;- (DBGU) Base Address +AT91C_BASE_PIOA EQU (0xFFFFF400) ;- (PIOA) Base Address +AT91C_BASE_PIOB EQU (0xFFFFF600) ;- (PIOB) Base Address +AT91C_BASE_CKGR EQU (0xFFFFFC20) ;- (CKGR) Base Address +AT91C_BASE_PMC EQU (0xFFFFFC00) ;- (PMC) Base Address +AT91C_BASE_RSTC EQU (0xFFFFFD00) ;- (RSTC) Base Address +AT91C_BASE_RTTC EQU (0xFFFFFD20) ;- (RTTC) Base Address +AT91C_BASE_PITC EQU (0xFFFFFD30) ;- (PITC) Base Address +AT91C_BASE_WDTC EQU (0xFFFFFD40) ;- (WDTC) Base Address +AT91C_BASE_VREG EQU (0xFFFFFD60) ;- (VREG) Base Address +AT91C_BASE_MC EQU (0xFFFFFF00) ;- (MC) Base Address +AT91C_BASE_PDC_SPI1 EQU (0xFFFE4100) ;- (PDC_SPI1) Base Address +AT91C_BASE_SPI1 EQU (0xFFFE4000) ;- (SPI1) Base Address +AT91C_BASE_PDC_SPI0 EQU (0xFFFE0100) ;- (PDC_SPI0) Base Address +AT91C_BASE_SPI0 EQU (0xFFFE0000) ;- (SPI0) Base Address +AT91C_BASE_PDC_US1 EQU (0xFFFC4100) ;- (PDC_US1) Base Address +AT91C_BASE_US1 EQU (0xFFFC4000) ;- (US1) Base Address +AT91C_BASE_PDC_US0 EQU (0xFFFC0100) ;- (PDC_US0) Base Address +AT91C_BASE_US0 EQU (0xFFFC0000) ;- (US0) Base Address +AT91C_BASE_PDC_SSC EQU (0xFFFD4100) ;- (PDC_SSC) Base Address +AT91C_BASE_SSC EQU (0xFFFD4000) ;- (SSC) Base Address +AT91C_BASE_TWI EQU (0xFFFB8000) ;- (TWI) Base Address +AT91C_BASE_PWMC_CH3 EQU (0xFFFCC260) ;- (PWMC_CH3) Base Address +AT91C_BASE_PWMC_CH2 EQU (0xFFFCC240) ;- (PWMC_CH2) Base Address +AT91C_BASE_PWMC_CH1 EQU (0xFFFCC220) ;- (PWMC_CH1) Base Address +AT91C_BASE_PWMC_CH0 EQU (0xFFFCC200) ;- (PWMC_CH0) Base Address +AT91C_BASE_PWMC EQU (0xFFFCC000) ;- (PWMC) Base Address +AT91C_BASE_UDP EQU (0xFFFB0000) ;- (UDP) Base Address +AT91C_BASE_TC0 EQU (0xFFFA0000) ;- (TC0) Base Address +AT91C_BASE_TC1 EQU (0xFFFA0040) ;- (TC1) Base Address +AT91C_BASE_TC2 EQU (0xFFFA0080) ;- (TC2) Base Address +AT91C_BASE_TCB EQU (0xFFFA0000) ;- (TCB) Base Address +AT91C_BASE_CAN_MB0 EQU (0xFFFD0200) ;- (CAN_MB0) Base Address +AT91C_BASE_CAN_MB1 EQU (0xFFFD0220) ;- (CAN_MB1) Base Address +AT91C_BASE_CAN_MB2 EQU (0xFFFD0240) ;- (CAN_MB2) Base Address +AT91C_BASE_CAN_MB3 EQU (0xFFFD0260) ;- (CAN_MB3) Base Address +AT91C_BASE_CAN_MB4 EQU (0xFFFD0280) ;- (CAN_MB4) Base Address +AT91C_BASE_CAN_MB5 EQU (0xFFFD02A0) ;- (CAN_MB5) Base Address +AT91C_BASE_CAN_MB6 EQU (0xFFFD02C0) ;- (CAN_MB6) Base Address +AT91C_BASE_CAN_MB7 EQU (0xFFFD02E0) ;- (CAN_MB7) Base Address +AT91C_BASE_CAN EQU (0xFFFD0000) ;- (CAN) Base Address +AT91C_BASE_EMAC EQU (0xFFFDC000) ;- (EMAC) Base Address +AT91C_BASE_PDC_ADC EQU (0xFFFD8100) ;- (PDC_ADC) Base Address +AT91C_BASE_ADC EQU (0xFFFD8000) ;- (ADC) Base Address + +;- ***************************************************************************** +;- MEMORY MAPPING DEFINITIONS FOR AT91SAM7X256 +;- ***************************************************************************** +;- ISRAM +AT91C_ISRAM EQU (0x00200000) ;- Internal SRAM base address +AT91C_ISRAM_SIZE EQU (0x00010000) ;- Internal SRAM size in byte (64 Kbytes) +;- IFLASH +AT91C_IFLASH EQU (0x00100000) ;- Internal FLASH base address +AT91C_IFLASH_SIZE EQU (0x00040000) ;- Internal FLASH size in byte (256 Kbytes) +AT91C_IFLASH_PAGE_SIZE EQU (256) ;- Internal FLASH Page Size: 256 bytes +AT91C_IFLASH_LOCK_REGION_SIZE EQU (16384) ;- Internal FLASH Lock Region Size: 16 Kbytes +AT91C_IFLASH_NB_OF_PAGES EQU (1024) ;- Internal FLASH Number of Pages: 1024 bytes +AT91C_IFLASH_NB_OF_LOCK_BITS EQU (16) ;- Internal FLASH Number of Lock Bits: 16 bytes + + + END diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.rdf b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.rdf new file mode 100644 index 0000000..7668f5b --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.rdf @@ -0,0 +1,4704 @@ +# ---------------------------------------------------------------------------- +# ATMEL Microcontroller Software Support - ROUSSET - +# ---------------------------------------------------------------------------- +# DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +# DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ---------------------------------------------------------------------------- +# File Name : AT91SAM7X256.h +# Object : AT91SAM7X256 definitions +# Generated : AT91 SW Application Group 11/02/2005 (15:17:24) +# +# CVS Reference : /AT91SAM7X256.pl/1.14/Tue Sep 13 15:06:52 2005// +# CVS Reference : /SYS_SAM7X.pl/1.3/Tue Feb 1 17:01:43 2005// +# CVS Reference : /MC_SAM7X.pl/1.2/Fri May 20 14:13:04 2005// +# CVS Reference : /PMC_SAM7X.pl/1.4/Tue Feb 8 13:58:10 2005// +# CVS Reference : /RSTC_SAM7X.pl/1.2/Wed Jul 13 14:57:50 2005// +# CVS Reference : /UDP_SAM7X.pl/1.1/Tue May 10 11:35:35 2005// +# CVS Reference : /PWM_SAM7X.pl/1.1/Tue May 10 11:53:07 2005// +# CVS Reference : /AIC_6075B.pl/1.3/Fri May 20 14:01:30 2005// +# CVS Reference : /PIO_6057A.pl/1.2/Thu Feb 3 10:18:28 2005// +# CVS Reference : /RTTC_6081A.pl/1.2/Tue Nov 9 14:43:58 2004// +# CVS Reference : /PITC_6079A.pl/1.2/Tue Nov 9 14:43:56 2004// +# CVS Reference : /WDTC_6080A.pl/1.3/Tue Nov 9 14:44:00 2004// +# CVS Reference : /VREG_6085B.pl/1.1/Tue Feb 1 16:05:48 2005// +# CVS Reference : /PDC_6074C.pl/1.2/Thu Feb 3 08:48:54 2005// +# CVS Reference : /DBGU_6059D.pl/1.1/Mon Jan 31 13:15:32 2005// +# CVS Reference : /SPI_6088D.pl/1.3/Fri May 20 14:08:59 2005// +# CVS Reference : /US_6089C.pl/1.1/Mon Jul 12 18:23:26 2004// +# CVS Reference : /SSC_6078B.pl/1.1/Wed Jul 13 15:19:19 2005// +# CVS Reference : /TWI_6061A.pl/1.1/Tue Jul 13 07:38:06 2004// +# CVS Reference : /TC_6082A.pl/1.7/Fri Mar 11 12:52:17 2005// +# CVS Reference : /CAN_6019B.pl/1.1/Tue Mar 8 12:42:22 2005// +# CVS Reference : /EMACB_6119A.pl/1.6/Wed Jul 13 15:05:35 2005// +# CVS Reference : /ADC_6051C.pl/1.1/Fri Oct 17 09:12:38 2003// +# ---------------------------------------------------------------------------- + +rdf.version=1 + +~sysinclude=arm_default.rdf +~sysinclude=arm_status.rdf +# ========== Register definition for SYS peripheral ========== +# ========== Register definition for AIC peripheral ========== +AT91C_AIC_IVR.name="AT91C_AIC_IVR" +AT91C_AIC_IVR.description="IRQ Vector Register" +AT91C_AIC_IVR.helpkey="IRQ Vector Register" +AT91C_AIC_IVR.access=memorymapped +AT91C_AIC_IVR.address=0xFFFFF100 +AT91C_AIC_IVR.width=32 +AT91C_AIC_IVR.byteEndian=little +AT91C_AIC_IVR.permission.write=none +AT91C_AIC_SMR.name="AT91C_AIC_SMR" +AT91C_AIC_SMR.description="Source Mode Register" +AT91C_AIC_SMR.helpkey="Source Mode Register" +AT91C_AIC_SMR.access=memorymapped +AT91C_AIC_SMR.address=0xFFFFF000 +AT91C_AIC_SMR.width=32 +AT91C_AIC_SMR.byteEndian=little +AT91C_AIC_FVR.name="AT91C_AIC_FVR" +AT91C_AIC_FVR.description="FIQ Vector Register" +AT91C_AIC_FVR.helpkey="FIQ Vector Register" +AT91C_AIC_FVR.access=memorymapped +AT91C_AIC_FVR.address=0xFFFFF104 +AT91C_AIC_FVR.width=32 +AT91C_AIC_FVR.byteEndian=little +AT91C_AIC_FVR.permission.write=none +AT91C_AIC_DCR.name="AT91C_AIC_DCR" +AT91C_AIC_DCR.description="Debug Control Register (Protect)" +AT91C_AIC_DCR.helpkey="Debug Control Register (Protect)" +AT91C_AIC_DCR.access=memorymapped +AT91C_AIC_DCR.address=0xFFFFF138 +AT91C_AIC_DCR.width=32 +AT91C_AIC_DCR.byteEndian=little +AT91C_AIC_EOICR.name="AT91C_AIC_EOICR" +AT91C_AIC_EOICR.description="End of Interrupt Command Register" +AT91C_AIC_EOICR.helpkey="End of Interrupt Command Register" +AT91C_AIC_EOICR.access=memorymapped +AT91C_AIC_EOICR.address=0xFFFFF130 +AT91C_AIC_EOICR.width=32 +AT91C_AIC_EOICR.byteEndian=little +AT91C_AIC_EOICR.type=enum +AT91C_AIC_EOICR.enum.0.name=*** Write only *** +AT91C_AIC_EOICR.enum.1.name=Error +AT91C_AIC_SVR.name="AT91C_AIC_SVR" +AT91C_AIC_SVR.description="Source Vector Register" +AT91C_AIC_SVR.helpkey="Source Vector Register" +AT91C_AIC_SVR.access=memorymapped +AT91C_AIC_SVR.address=0xFFFFF080 +AT91C_AIC_SVR.width=32 +AT91C_AIC_SVR.byteEndian=little +AT91C_AIC_FFSR.name="AT91C_AIC_FFSR" +AT91C_AIC_FFSR.description="Fast Forcing Status Register" +AT91C_AIC_FFSR.helpkey="Fast Forcing Status Register" +AT91C_AIC_FFSR.access=memorymapped +AT91C_AIC_FFSR.address=0xFFFFF148 +AT91C_AIC_FFSR.width=32 +AT91C_AIC_FFSR.byteEndian=little +AT91C_AIC_FFSR.permission.write=none +AT91C_AIC_ICCR.name="AT91C_AIC_ICCR" +AT91C_AIC_ICCR.description="Interrupt Clear Command Register" +AT91C_AIC_ICCR.helpkey="Interrupt Clear Command Register" +AT91C_AIC_ICCR.access=memorymapped +AT91C_AIC_ICCR.address=0xFFFFF128 +AT91C_AIC_ICCR.width=32 +AT91C_AIC_ICCR.byteEndian=little +AT91C_AIC_ICCR.type=enum +AT91C_AIC_ICCR.enum.0.name=*** Write only *** +AT91C_AIC_ICCR.enum.1.name=Error +AT91C_AIC_ISR.name="AT91C_AIC_ISR" +AT91C_AIC_ISR.description="Interrupt Status Register" +AT91C_AIC_ISR.helpkey="Interrupt Status Register" +AT91C_AIC_ISR.access=memorymapped +AT91C_AIC_ISR.address=0xFFFFF108 +AT91C_AIC_ISR.width=32 +AT91C_AIC_ISR.byteEndian=little +AT91C_AIC_ISR.permission.write=none +AT91C_AIC_IMR.name="AT91C_AIC_IMR" +AT91C_AIC_IMR.description="Interrupt Mask Register" +AT91C_AIC_IMR.helpkey="Interrupt Mask Register" +AT91C_AIC_IMR.access=memorymapped +AT91C_AIC_IMR.address=0xFFFFF110 +AT91C_AIC_IMR.width=32 +AT91C_AIC_IMR.byteEndian=little +AT91C_AIC_IMR.permission.write=none +AT91C_AIC_IPR.name="AT91C_AIC_IPR" +AT91C_AIC_IPR.description="Interrupt Pending Register" +AT91C_AIC_IPR.helpkey="Interrupt Pending Register" +AT91C_AIC_IPR.access=memorymapped +AT91C_AIC_IPR.address=0xFFFFF10C +AT91C_AIC_IPR.width=32 +AT91C_AIC_IPR.byteEndian=little +AT91C_AIC_IPR.permission.write=none +AT91C_AIC_FFER.name="AT91C_AIC_FFER" +AT91C_AIC_FFER.description="Fast Forcing Enable Register" +AT91C_AIC_FFER.helpkey="Fast Forcing Enable Register" +AT91C_AIC_FFER.access=memorymapped +AT91C_AIC_FFER.address=0xFFFFF140 +AT91C_AIC_FFER.width=32 +AT91C_AIC_FFER.byteEndian=little +AT91C_AIC_FFER.type=enum +AT91C_AIC_FFER.enum.0.name=*** Write only *** +AT91C_AIC_FFER.enum.1.name=Error +AT91C_AIC_IECR.name="AT91C_AIC_IECR" +AT91C_AIC_IECR.description="Interrupt Enable Command Register" +AT91C_AIC_IECR.helpkey="Interrupt Enable Command Register" +AT91C_AIC_IECR.access=memorymapped +AT91C_AIC_IECR.address=0xFFFFF120 +AT91C_AIC_IECR.width=32 +AT91C_AIC_IECR.byteEndian=little +AT91C_AIC_IECR.type=enum +AT91C_AIC_IECR.enum.0.name=*** Write only *** +AT91C_AIC_IECR.enum.1.name=Error +AT91C_AIC_ISCR.name="AT91C_AIC_ISCR" +AT91C_AIC_ISCR.description="Interrupt Set Command Register" +AT91C_AIC_ISCR.helpkey="Interrupt Set Command Register" +AT91C_AIC_ISCR.access=memorymapped +AT91C_AIC_ISCR.address=0xFFFFF12C +AT91C_AIC_ISCR.width=32 +AT91C_AIC_ISCR.byteEndian=little +AT91C_AIC_ISCR.type=enum +AT91C_AIC_ISCR.enum.0.name=*** Write only *** +AT91C_AIC_ISCR.enum.1.name=Error +AT91C_AIC_FFDR.name="AT91C_AIC_FFDR" +AT91C_AIC_FFDR.description="Fast Forcing Disable Register" +AT91C_AIC_FFDR.helpkey="Fast Forcing Disable Register" +AT91C_AIC_FFDR.access=memorymapped +AT91C_AIC_FFDR.address=0xFFFFF144 +AT91C_AIC_FFDR.width=32 +AT91C_AIC_FFDR.byteEndian=little +AT91C_AIC_FFDR.type=enum +AT91C_AIC_FFDR.enum.0.name=*** Write only *** +AT91C_AIC_FFDR.enum.1.name=Error +AT91C_AIC_CISR.name="AT91C_AIC_CISR" +AT91C_AIC_CISR.description="Core Interrupt Status Register" +AT91C_AIC_CISR.helpkey="Core Interrupt Status Register" +AT91C_AIC_CISR.access=memorymapped +AT91C_AIC_CISR.address=0xFFFFF114 +AT91C_AIC_CISR.width=32 +AT91C_AIC_CISR.byteEndian=little +AT91C_AIC_CISR.permission.write=none +AT91C_AIC_IDCR.name="AT91C_AIC_IDCR" +AT91C_AIC_IDCR.description="Interrupt Disable Command Register" +AT91C_AIC_IDCR.helpkey="Interrupt Disable Command Register" +AT91C_AIC_IDCR.access=memorymapped +AT91C_AIC_IDCR.address=0xFFFFF124 +AT91C_AIC_IDCR.width=32 +AT91C_AIC_IDCR.byteEndian=little +AT91C_AIC_IDCR.type=enum +AT91C_AIC_IDCR.enum.0.name=*** Write only *** +AT91C_AIC_IDCR.enum.1.name=Error +AT91C_AIC_SPU.name="AT91C_AIC_SPU" +AT91C_AIC_SPU.description="Spurious Vector Register" +AT91C_AIC_SPU.helpkey="Spurious Vector Register" +AT91C_AIC_SPU.access=memorymapped +AT91C_AIC_SPU.address=0xFFFFF134 +AT91C_AIC_SPU.width=32 +AT91C_AIC_SPU.byteEndian=little +# ========== Register definition for PDC_DBGU peripheral ========== +AT91C_DBGU_TCR.name="AT91C_DBGU_TCR" +AT91C_DBGU_TCR.description="Transmit Counter Register" +AT91C_DBGU_TCR.helpkey="Transmit Counter Register" +AT91C_DBGU_TCR.access=memorymapped +AT91C_DBGU_TCR.address=0xFFFFF30C +AT91C_DBGU_TCR.width=32 +AT91C_DBGU_TCR.byteEndian=little +AT91C_DBGU_RNPR.name="AT91C_DBGU_RNPR" +AT91C_DBGU_RNPR.description="Receive Next Pointer Register" +AT91C_DBGU_RNPR.helpkey="Receive Next Pointer Register" +AT91C_DBGU_RNPR.access=memorymapped +AT91C_DBGU_RNPR.address=0xFFFFF310 +AT91C_DBGU_RNPR.width=32 +AT91C_DBGU_RNPR.byteEndian=little +AT91C_DBGU_TNPR.name="AT91C_DBGU_TNPR" +AT91C_DBGU_TNPR.description="Transmit Next Pointer Register" +AT91C_DBGU_TNPR.helpkey="Transmit Next Pointer Register" +AT91C_DBGU_TNPR.access=memorymapped +AT91C_DBGU_TNPR.address=0xFFFFF318 +AT91C_DBGU_TNPR.width=32 +AT91C_DBGU_TNPR.byteEndian=little +AT91C_DBGU_TPR.name="AT91C_DBGU_TPR" +AT91C_DBGU_TPR.description="Transmit Pointer Register" +AT91C_DBGU_TPR.helpkey="Transmit Pointer Register" +AT91C_DBGU_TPR.access=memorymapped +AT91C_DBGU_TPR.address=0xFFFFF308 +AT91C_DBGU_TPR.width=32 +AT91C_DBGU_TPR.byteEndian=little +AT91C_DBGU_RPR.name="AT91C_DBGU_RPR" +AT91C_DBGU_RPR.description="Receive Pointer Register" +AT91C_DBGU_RPR.helpkey="Receive Pointer Register" +AT91C_DBGU_RPR.access=memorymapped +AT91C_DBGU_RPR.address=0xFFFFF300 +AT91C_DBGU_RPR.width=32 +AT91C_DBGU_RPR.byteEndian=little +AT91C_DBGU_RCR.name="AT91C_DBGU_RCR" +AT91C_DBGU_RCR.description="Receive Counter Register" +AT91C_DBGU_RCR.helpkey="Receive Counter Register" +AT91C_DBGU_RCR.access=memorymapped +AT91C_DBGU_RCR.address=0xFFFFF304 +AT91C_DBGU_RCR.width=32 +AT91C_DBGU_RCR.byteEndian=little +AT91C_DBGU_RNCR.name="AT91C_DBGU_RNCR" +AT91C_DBGU_RNCR.description="Receive Next Counter Register" +AT91C_DBGU_RNCR.helpkey="Receive Next Counter Register" +AT91C_DBGU_RNCR.access=memorymapped +AT91C_DBGU_RNCR.address=0xFFFFF314 +AT91C_DBGU_RNCR.width=32 +AT91C_DBGU_RNCR.byteEndian=little +AT91C_DBGU_PTCR.name="AT91C_DBGU_PTCR" +AT91C_DBGU_PTCR.description="PDC Transfer Control Register" +AT91C_DBGU_PTCR.helpkey="PDC Transfer Control Register" +AT91C_DBGU_PTCR.access=memorymapped +AT91C_DBGU_PTCR.address=0xFFFFF320 +AT91C_DBGU_PTCR.width=32 +AT91C_DBGU_PTCR.byteEndian=little +AT91C_DBGU_PTCR.type=enum +AT91C_DBGU_PTCR.enum.0.name=*** Write only *** +AT91C_DBGU_PTCR.enum.1.name=Error +AT91C_DBGU_PTSR.name="AT91C_DBGU_PTSR" +AT91C_DBGU_PTSR.description="PDC Transfer Status Register" +AT91C_DBGU_PTSR.helpkey="PDC Transfer Status Register" +AT91C_DBGU_PTSR.access=memorymapped +AT91C_DBGU_PTSR.address=0xFFFFF324 +AT91C_DBGU_PTSR.width=32 +AT91C_DBGU_PTSR.byteEndian=little +AT91C_DBGU_PTSR.permission.write=none +AT91C_DBGU_TNCR.name="AT91C_DBGU_TNCR" +AT91C_DBGU_TNCR.description="Transmit Next Counter Register" +AT91C_DBGU_TNCR.helpkey="Transmit Next Counter Register" +AT91C_DBGU_TNCR.access=memorymapped +AT91C_DBGU_TNCR.address=0xFFFFF31C +AT91C_DBGU_TNCR.width=32 +AT91C_DBGU_TNCR.byteEndian=little +# ========== Register definition for DBGU peripheral ========== +AT91C_DBGU_EXID.name="AT91C_DBGU_EXID" +AT91C_DBGU_EXID.description="Chip ID Extension Register" +AT91C_DBGU_EXID.helpkey="Chip ID Extension Register" +AT91C_DBGU_EXID.access=memorymapped +AT91C_DBGU_EXID.address=0xFFFFF244 +AT91C_DBGU_EXID.width=32 +AT91C_DBGU_EXID.byteEndian=little +AT91C_DBGU_EXID.permission.write=none +AT91C_DBGU_BRGR.name="AT91C_DBGU_BRGR" +AT91C_DBGU_BRGR.description="Baud Rate Generator Register" +AT91C_DBGU_BRGR.helpkey="Baud Rate Generator Register" +AT91C_DBGU_BRGR.access=memorymapped +AT91C_DBGU_BRGR.address=0xFFFFF220 +AT91C_DBGU_BRGR.width=32 +AT91C_DBGU_BRGR.byteEndian=little +AT91C_DBGU_IDR.name="AT91C_DBGU_IDR" +AT91C_DBGU_IDR.description="Interrupt Disable Register" +AT91C_DBGU_IDR.helpkey="Interrupt Disable Register" +AT91C_DBGU_IDR.access=memorymapped +AT91C_DBGU_IDR.address=0xFFFFF20C +AT91C_DBGU_IDR.width=32 +AT91C_DBGU_IDR.byteEndian=little +AT91C_DBGU_IDR.type=enum +AT91C_DBGU_IDR.enum.0.name=*** Write only *** +AT91C_DBGU_IDR.enum.1.name=Error +AT91C_DBGU_CSR.name="AT91C_DBGU_CSR" +AT91C_DBGU_CSR.description="Channel Status Register" +AT91C_DBGU_CSR.helpkey="Channel Status Register" +AT91C_DBGU_CSR.access=memorymapped +AT91C_DBGU_CSR.address=0xFFFFF214 +AT91C_DBGU_CSR.width=32 +AT91C_DBGU_CSR.byteEndian=little +AT91C_DBGU_CSR.permission.write=none +AT91C_DBGU_CIDR.name="AT91C_DBGU_CIDR" +AT91C_DBGU_CIDR.description="Chip ID Register" +AT91C_DBGU_CIDR.helpkey="Chip ID Register" +AT91C_DBGU_CIDR.access=memorymapped +AT91C_DBGU_CIDR.address=0xFFFFF240 +AT91C_DBGU_CIDR.width=32 +AT91C_DBGU_CIDR.byteEndian=little +AT91C_DBGU_CIDR.permission.write=none +AT91C_DBGU_MR.name="AT91C_DBGU_MR" +AT91C_DBGU_MR.description="Mode Register" +AT91C_DBGU_MR.helpkey="Mode Register" +AT91C_DBGU_MR.access=memorymapped +AT91C_DBGU_MR.address=0xFFFFF204 +AT91C_DBGU_MR.width=32 +AT91C_DBGU_MR.byteEndian=little +AT91C_DBGU_IMR.name="AT91C_DBGU_IMR" +AT91C_DBGU_IMR.description="Interrupt Mask Register" +AT91C_DBGU_IMR.helpkey="Interrupt Mask Register" +AT91C_DBGU_IMR.access=memorymapped +AT91C_DBGU_IMR.address=0xFFFFF210 +AT91C_DBGU_IMR.width=32 +AT91C_DBGU_IMR.byteEndian=little +AT91C_DBGU_IMR.permission.write=none +AT91C_DBGU_CR.name="AT91C_DBGU_CR" +AT91C_DBGU_CR.description="Control Register" +AT91C_DBGU_CR.helpkey="Control Register" +AT91C_DBGU_CR.access=memorymapped +AT91C_DBGU_CR.address=0xFFFFF200 +AT91C_DBGU_CR.width=32 +AT91C_DBGU_CR.byteEndian=little +AT91C_DBGU_CR.type=enum +AT91C_DBGU_CR.enum.0.name=*** Write only *** +AT91C_DBGU_CR.enum.1.name=Error +AT91C_DBGU_FNTR.name="AT91C_DBGU_FNTR" +AT91C_DBGU_FNTR.description="Force NTRST Register" +AT91C_DBGU_FNTR.helpkey="Force NTRST Register" +AT91C_DBGU_FNTR.access=memorymapped +AT91C_DBGU_FNTR.address=0xFFFFF248 +AT91C_DBGU_FNTR.width=32 +AT91C_DBGU_FNTR.byteEndian=little +AT91C_DBGU_THR.name="AT91C_DBGU_THR" +AT91C_DBGU_THR.description="Transmitter Holding Register" +AT91C_DBGU_THR.helpkey="Transmitter Holding Register" +AT91C_DBGU_THR.access=memorymapped +AT91C_DBGU_THR.address=0xFFFFF21C +AT91C_DBGU_THR.width=32 +AT91C_DBGU_THR.byteEndian=little +AT91C_DBGU_THR.type=enum +AT91C_DBGU_THR.enum.0.name=*** Write only *** +AT91C_DBGU_THR.enum.1.name=Error +AT91C_DBGU_RHR.name="AT91C_DBGU_RHR" +AT91C_DBGU_RHR.description="Receiver Holding Register" +AT91C_DBGU_RHR.helpkey="Receiver Holding Register" +AT91C_DBGU_RHR.access=memorymapped +AT91C_DBGU_RHR.address=0xFFFFF218 +AT91C_DBGU_RHR.width=32 +AT91C_DBGU_RHR.byteEndian=little +AT91C_DBGU_RHR.permission.write=none +AT91C_DBGU_IER.name="AT91C_DBGU_IER" +AT91C_DBGU_IER.description="Interrupt Enable Register" +AT91C_DBGU_IER.helpkey="Interrupt Enable Register" +AT91C_DBGU_IER.access=memorymapped +AT91C_DBGU_IER.address=0xFFFFF208 +AT91C_DBGU_IER.width=32 +AT91C_DBGU_IER.byteEndian=little +AT91C_DBGU_IER.type=enum +AT91C_DBGU_IER.enum.0.name=*** Write only *** +AT91C_DBGU_IER.enum.1.name=Error +# ========== Register definition for PIOA peripheral ========== +AT91C_PIOA_ODR.name="AT91C_PIOA_ODR" +AT91C_PIOA_ODR.description="Output Disable Registerr" +AT91C_PIOA_ODR.helpkey="Output Disable Registerr" +AT91C_PIOA_ODR.access=memorymapped +AT91C_PIOA_ODR.address=0xFFFFF414 +AT91C_PIOA_ODR.width=32 +AT91C_PIOA_ODR.byteEndian=little +AT91C_PIOA_ODR.type=enum +AT91C_PIOA_ODR.enum.0.name=*** Write only *** +AT91C_PIOA_ODR.enum.1.name=Error +AT91C_PIOA_SODR.name="AT91C_PIOA_SODR" +AT91C_PIOA_SODR.description="Set Output Data Register" +AT91C_PIOA_SODR.helpkey="Set Output Data Register" +AT91C_PIOA_SODR.access=memorymapped +AT91C_PIOA_SODR.address=0xFFFFF430 +AT91C_PIOA_SODR.width=32 +AT91C_PIOA_SODR.byteEndian=little +AT91C_PIOA_SODR.type=enum +AT91C_PIOA_SODR.enum.0.name=*** Write only *** +AT91C_PIOA_SODR.enum.1.name=Error +AT91C_PIOA_ISR.name="AT91C_PIOA_ISR" +AT91C_PIOA_ISR.description="Interrupt Status Register" +AT91C_PIOA_ISR.helpkey="Interrupt Status Register" +AT91C_PIOA_ISR.access=memorymapped +AT91C_PIOA_ISR.address=0xFFFFF44C +AT91C_PIOA_ISR.width=32 +AT91C_PIOA_ISR.byteEndian=little +AT91C_PIOA_ISR.permission.write=none +AT91C_PIOA_ABSR.name="AT91C_PIOA_ABSR" +AT91C_PIOA_ABSR.description="AB Select Status Register" +AT91C_PIOA_ABSR.helpkey="AB Select Status Register" +AT91C_PIOA_ABSR.access=memorymapped +AT91C_PIOA_ABSR.address=0xFFFFF478 +AT91C_PIOA_ABSR.width=32 +AT91C_PIOA_ABSR.byteEndian=little +AT91C_PIOA_ABSR.permission.write=none +AT91C_PIOA_IER.name="AT91C_PIOA_IER" +AT91C_PIOA_IER.description="Interrupt Enable Register" +AT91C_PIOA_IER.helpkey="Interrupt Enable Register" +AT91C_PIOA_IER.access=memorymapped +AT91C_PIOA_IER.address=0xFFFFF440 +AT91C_PIOA_IER.width=32 +AT91C_PIOA_IER.byteEndian=little +AT91C_PIOA_IER.type=enum +AT91C_PIOA_IER.enum.0.name=*** Write only *** +AT91C_PIOA_IER.enum.1.name=Error +AT91C_PIOA_PPUDR.name="AT91C_PIOA_PPUDR" +AT91C_PIOA_PPUDR.description="Pull-up Disable Register" +AT91C_PIOA_PPUDR.helpkey="Pull-up Disable Register" +AT91C_PIOA_PPUDR.access=memorymapped +AT91C_PIOA_PPUDR.address=0xFFFFF460 +AT91C_PIOA_PPUDR.width=32 +AT91C_PIOA_PPUDR.byteEndian=little +AT91C_PIOA_PPUDR.type=enum +AT91C_PIOA_PPUDR.enum.0.name=*** Write only *** +AT91C_PIOA_PPUDR.enum.1.name=Error +AT91C_PIOA_IMR.name="AT91C_PIOA_IMR" +AT91C_PIOA_IMR.description="Interrupt Mask Register" +AT91C_PIOA_IMR.helpkey="Interrupt Mask Register" +AT91C_PIOA_IMR.access=memorymapped +AT91C_PIOA_IMR.address=0xFFFFF448 +AT91C_PIOA_IMR.width=32 +AT91C_PIOA_IMR.byteEndian=little +AT91C_PIOA_IMR.permission.write=none +AT91C_PIOA_PER.name="AT91C_PIOA_PER" +AT91C_PIOA_PER.description="PIO Enable Register" +AT91C_PIOA_PER.helpkey="PIO Enable Register" +AT91C_PIOA_PER.access=memorymapped +AT91C_PIOA_PER.address=0xFFFFF400 +AT91C_PIOA_PER.width=32 +AT91C_PIOA_PER.byteEndian=little +AT91C_PIOA_PER.type=enum +AT91C_PIOA_PER.enum.0.name=*** Write only *** +AT91C_PIOA_PER.enum.1.name=Error +AT91C_PIOA_IFDR.name="AT91C_PIOA_IFDR" +AT91C_PIOA_IFDR.description="Input Filter Disable Register" +AT91C_PIOA_IFDR.helpkey="Input Filter Disable Register" +AT91C_PIOA_IFDR.access=memorymapped +AT91C_PIOA_IFDR.address=0xFFFFF424 +AT91C_PIOA_IFDR.width=32 +AT91C_PIOA_IFDR.byteEndian=little +AT91C_PIOA_IFDR.type=enum +AT91C_PIOA_IFDR.enum.0.name=*** Write only *** +AT91C_PIOA_IFDR.enum.1.name=Error +AT91C_PIOA_OWDR.name="AT91C_PIOA_OWDR" +AT91C_PIOA_OWDR.description="Output Write Disable Register" +AT91C_PIOA_OWDR.helpkey="Output Write Disable Register" +AT91C_PIOA_OWDR.access=memorymapped +AT91C_PIOA_OWDR.address=0xFFFFF4A4 +AT91C_PIOA_OWDR.width=32 +AT91C_PIOA_OWDR.byteEndian=little +AT91C_PIOA_OWDR.type=enum +AT91C_PIOA_OWDR.enum.0.name=*** Write only *** +AT91C_PIOA_OWDR.enum.1.name=Error +AT91C_PIOA_MDSR.name="AT91C_PIOA_MDSR" +AT91C_PIOA_MDSR.description="Multi-driver Status Register" +AT91C_PIOA_MDSR.helpkey="Multi-driver Status Register" +AT91C_PIOA_MDSR.access=memorymapped +AT91C_PIOA_MDSR.address=0xFFFFF458 +AT91C_PIOA_MDSR.width=32 +AT91C_PIOA_MDSR.byteEndian=little +AT91C_PIOA_MDSR.permission.write=none +AT91C_PIOA_IDR.name="AT91C_PIOA_IDR" +AT91C_PIOA_IDR.description="Interrupt Disable Register" +AT91C_PIOA_IDR.helpkey="Interrupt Disable Register" +AT91C_PIOA_IDR.access=memorymapped +AT91C_PIOA_IDR.address=0xFFFFF444 +AT91C_PIOA_IDR.width=32 +AT91C_PIOA_IDR.byteEndian=little +AT91C_PIOA_IDR.type=enum +AT91C_PIOA_IDR.enum.0.name=*** Write only *** +AT91C_PIOA_IDR.enum.1.name=Error +AT91C_PIOA_ODSR.name="AT91C_PIOA_ODSR" +AT91C_PIOA_ODSR.description="Output Data Status Register" +AT91C_PIOA_ODSR.helpkey="Output Data Status Register" +AT91C_PIOA_ODSR.access=memorymapped +AT91C_PIOA_ODSR.address=0xFFFFF438 +AT91C_PIOA_ODSR.width=32 +AT91C_PIOA_ODSR.byteEndian=little +AT91C_PIOA_ODSR.permission.write=none +AT91C_PIOA_PPUSR.name="AT91C_PIOA_PPUSR" +AT91C_PIOA_PPUSR.description="Pull-up Status Register" +AT91C_PIOA_PPUSR.helpkey="Pull-up Status Register" +AT91C_PIOA_PPUSR.access=memorymapped +AT91C_PIOA_PPUSR.address=0xFFFFF468 +AT91C_PIOA_PPUSR.width=32 +AT91C_PIOA_PPUSR.byteEndian=little +AT91C_PIOA_PPUSR.permission.write=none +AT91C_PIOA_OWSR.name="AT91C_PIOA_OWSR" +AT91C_PIOA_OWSR.description="Output Write Status Register" +AT91C_PIOA_OWSR.helpkey="Output Write Status Register" +AT91C_PIOA_OWSR.access=memorymapped +AT91C_PIOA_OWSR.address=0xFFFFF4A8 +AT91C_PIOA_OWSR.width=32 +AT91C_PIOA_OWSR.byteEndian=little +AT91C_PIOA_OWSR.permission.write=none +AT91C_PIOA_BSR.name="AT91C_PIOA_BSR" +AT91C_PIOA_BSR.description="Select B Register" +AT91C_PIOA_BSR.helpkey="Select B Register" +AT91C_PIOA_BSR.access=memorymapped +AT91C_PIOA_BSR.address=0xFFFFF474 +AT91C_PIOA_BSR.width=32 +AT91C_PIOA_BSR.byteEndian=little +AT91C_PIOA_BSR.type=enum +AT91C_PIOA_BSR.enum.0.name=*** Write only *** +AT91C_PIOA_BSR.enum.1.name=Error +AT91C_PIOA_OWER.name="AT91C_PIOA_OWER" +AT91C_PIOA_OWER.description="Output Write Enable Register" +AT91C_PIOA_OWER.helpkey="Output Write Enable Register" +AT91C_PIOA_OWER.access=memorymapped +AT91C_PIOA_OWER.address=0xFFFFF4A0 +AT91C_PIOA_OWER.width=32 +AT91C_PIOA_OWER.byteEndian=little +AT91C_PIOA_OWER.type=enum +AT91C_PIOA_OWER.enum.0.name=*** Write only *** +AT91C_PIOA_OWER.enum.1.name=Error +AT91C_PIOA_IFER.name="AT91C_PIOA_IFER" +AT91C_PIOA_IFER.description="Input Filter Enable Register" +AT91C_PIOA_IFER.helpkey="Input Filter Enable Register" +AT91C_PIOA_IFER.access=memorymapped +AT91C_PIOA_IFER.address=0xFFFFF420 +AT91C_PIOA_IFER.width=32 +AT91C_PIOA_IFER.byteEndian=little +AT91C_PIOA_IFER.type=enum +AT91C_PIOA_IFER.enum.0.name=*** Write only *** +AT91C_PIOA_IFER.enum.1.name=Error +AT91C_PIOA_PDSR.name="AT91C_PIOA_PDSR" +AT91C_PIOA_PDSR.description="Pin Data Status Register" +AT91C_PIOA_PDSR.helpkey="Pin Data Status Register" +AT91C_PIOA_PDSR.access=memorymapped +AT91C_PIOA_PDSR.address=0xFFFFF43C +AT91C_PIOA_PDSR.width=32 +AT91C_PIOA_PDSR.byteEndian=little +AT91C_PIOA_PDSR.permission.write=none +AT91C_PIOA_PPUER.name="AT91C_PIOA_PPUER" +AT91C_PIOA_PPUER.description="Pull-up Enable Register" +AT91C_PIOA_PPUER.helpkey="Pull-up Enable Register" +AT91C_PIOA_PPUER.access=memorymapped +AT91C_PIOA_PPUER.address=0xFFFFF464 +AT91C_PIOA_PPUER.width=32 +AT91C_PIOA_PPUER.byteEndian=little +AT91C_PIOA_PPUER.type=enum +AT91C_PIOA_PPUER.enum.0.name=*** Write only *** +AT91C_PIOA_PPUER.enum.1.name=Error +AT91C_PIOA_OSR.name="AT91C_PIOA_OSR" +AT91C_PIOA_OSR.description="Output Status Register" +AT91C_PIOA_OSR.helpkey="Output Status Register" +AT91C_PIOA_OSR.access=memorymapped +AT91C_PIOA_OSR.address=0xFFFFF418 +AT91C_PIOA_OSR.width=32 +AT91C_PIOA_OSR.byteEndian=little +AT91C_PIOA_OSR.permission.write=none +AT91C_PIOA_ASR.name="AT91C_PIOA_ASR" +AT91C_PIOA_ASR.description="Select A Register" +AT91C_PIOA_ASR.helpkey="Select A Register" +AT91C_PIOA_ASR.access=memorymapped +AT91C_PIOA_ASR.address=0xFFFFF470 +AT91C_PIOA_ASR.width=32 +AT91C_PIOA_ASR.byteEndian=little +AT91C_PIOA_ASR.type=enum +AT91C_PIOA_ASR.enum.0.name=*** Write only *** +AT91C_PIOA_ASR.enum.1.name=Error +AT91C_PIOA_MDDR.name="AT91C_PIOA_MDDR" +AT91C_PIOA_MDDR.description="Multi-driver Disable Register" +AT91C_PIOA_MDDR.helpkey="Multi-driver Disable Register" +AT91C_PIOA_MDDR.access=memorymapped +AT91C_PIOA_MDDR.address=0xFFFFF454 +AT91C_PIOA_MDDR.width=32 +AT91C_PIOA_MDDR.byteEndian=little +AT91C_PIOA_MDDR.type=enum +AT91C_PIOA_MDDR.enum.0.name=*** Write only *** +AT91C_PIOA_MDDR.enum.1.name=Error +AT91C_PIOA_CODR.name="AT91C_PIOA_CODR" +AT91C_PIOA_CODR.description="Clear Output Data Register" +AT91C_PIOA_CODR.helpkey="Clear Output Data Register" +AT91C_PIOA_CODR.access=memorymapped +AT91C_PIOA_CODR.address=0xFFFFF434 +AT91C_PIOA_CODR.width=32 +AT91C_PIOA_CODR.byteEndian=little +AT91C_PIOA_CODR.type=enum +AT91C_PIOA_CODR.enum.0.name=*** Write only *** +AT91C_PIOA_CODR.enum.1.name=Error +AT91C_PIOA_MDER.name="AT91C_PIOA_MDER" +AT91C_PIOA_MDER.description="Multi-driver Enable Register" +AT91C_PIOA_MDER.helpkey="Multi-driver Enable Register" +AT91C_PIOA_MDER.access=memorymapped +AT91C_PIOA_MDER.address=0xFFFFF450 +AT91C_PIOA_MDER.width=32 +AT91C_PIOA_MDER.byteEndian=little +AT91C_PIOA_MDER.type=enum +AT91C_PIOA_MDER.enum.0.name=*** Write only *** +AT91C_PIOA_MDER.enum.1.name=Error +AT91C_PIOA_PDR.name="AT91C_PIOA_PDR" +AT91C_PIOA_PDR.description="PIO Disable Register" +AT91C_PIOA_PDR.helpkey="PIO Disable Register" +AT91C_PIOA_PDR.access=memorymapped +AT91C_PIOA_PDR.address=0xFFFFF404 +AT91C_PIOA_PDR.width=32 +AT91C_PIOA_PDR.byteEndian=little +AT91C_PIOA_PDR.type=enum +AT91C_PIOA_PDR.enum.0.name=*** Write only *** +AT91C_PIOA_PDR.enum.1.name=Error +AT91C_PIOA_IFSR.name="AT91C_PIOA_IFSR" +AT91C_PIOA_IFSR.description="Input Filter Status Register" +AT91C_PIOA_IFSR.helpkey="Input Filter Status Register" +AT91C_PIOA_IFSR.access=memorymapped +AT91C_PIOA_IFSR.address=0xFFFFF428 +AT91C_PIOA_IFSR.width=32 +AT91C_PIOA_IFSR.byteEndian=little +AT91C_PIOA_IFSR.permission.write=none +AT91C_PIOA_OER.name="AT91C_PIOA_OER" +AT91C_PIOA_OER.description="Output Enable Register" +AT91C_PIOA_OER.helpkey="Output Enable Register" +AT91C_PIOA_OER.access=memorymapped +AT91C_PIOA_OER.address=0xFFFFF410 +AT91C_PIOA_OER.width=32 +AT91C_PIOA_OER.byteEndian=little +AT91C_PIOA_OER.type=enum +AT91C_PIOA_OER.enum.0.name=*** Write only *** +AT91C_PIOA_OER.enum.1.name=Error +AT91C_PIOA_PSR.name="AT91C_PIOA_PSR" +AT91C_PIOA_PSR.description="PIO Status Register" +AT91C_PIOA_PSR.helpkey="PIO Status Register" +AT91C_PIOA_PSR.access=memorymapped +AT91C_PIOA_PSR.address=0xFFFFF408 +AT91C_PIOA_PSR.width=32 +AT91C_PIOA_PSR.byteEndian=little +AT91C_PIOA_PSR.permission.write=none +# ========== Register definition for PIOB peripheral ========== +AT91C_PIOB_OWDR.name="AT91C_PIOB_OWDR" +AT91C_PIOB_OWDR.description="Output Write Disable Register" +AT91C_PIOB_OWDR.helpkey="Output Write Disable Register" +AT91C_PIOB_OWDR.access=memorymapped +AT91C_PIOB_OWDR.address=0xFFFFF6A4 +AT91C_PIOB_OWDR.width=32 +AT91C_PIOB_OWDR.byteEndian=little +AT91C_PIOB_OWDR.type=enum +AT91C_PIOB_OWDR.enum.0.name=*** Write only *** +AT91C_PIOB_OWDR.enum.1.name=Error +AT91C_PIOB_MDER.name="AT91C_PIOB_MDER" +AT91C_PIOB_MDER.description="Multi-driver Enable Register" +AT91C_PIOB_MDER.helpkey="Multi-driver Enable Register" +AT91C_PIOB_MDER.access=memorymapped +AT91C_PIOB_MDER.address=0xFFFFF650 +AT91C_PIOB_MDER.width=32 +AT91C_PIOB_MDER.byteEndian=little +AT91C_PIOB_MDER.type=enum +AT91C_PIOB_MDER.enum.0.name=*** Write only *** +AT91C_PIOB_MDER.enum.1.name=Error +AT91C_PIOB_PPUSR.name="AT91C_PIOB_PPUSR" +AT91C_PIOB_PPUSR.description="Pull-up Status Register" +AT91C_PIOB_PPUSR.helpkey="Pull-up Status Register" +AT91C_PIOB_PPUSR.access=memorymapped +AT91C_PIOB_PPUSR.address=0xFFFFF668 +AT91C_PIOB_PPUSR.width=32 +AT91C_PIOB_PPUSR.byteEndian=little +AT91C_PIOB_PPUSR.permission.write=none +AT91C_PIOB_IMR.name="AT91C_PIOB_IMR" +AT91C_PIOB_IMR.description="Interrupt Mask Register" +AT91C_PIOB_IMR.helpkey="Interrupt Mask Register" +AT91C_PIOB_IMR.access=memorymapped +AT91C_PIOB_IMR.address=0xFFFFF648 +AT91C_PIOB_IMR.width=32 +AT91C_PIOB_IMR.byteEndian=little +AT91C_PIOB_IMR.permission.write=none +AT91C_PIOB_ASR.name="AT91C_PIOB_ASR" +AT91C_PIOB_ASR.description="Select A Register" +AT91C_PIOB_ASR.helpkey="Select A Register" +AT91C_PIOB_ASR.access=memorymapped +AT91C_PIOB_ASR.address=0xFFFFF670 +AT91C_PIOB_ASR.width=32 +AT91C_PIOB_ASR.byteEndian=little +AT91C_PIOB_ASR.type=enum +AT91C_PIOB_ASR.enum.0.name=*** Write only *** +AT91C_PIOB_ASR.enum.1.name=Error +AT91C_PIOB_PPUDR.name="AT91C_PIOB_PPUDR" +AT91C_PIOB_PPUDR.description="Pull-up Disable Register" +AT91C_PIOB_PPUDR.helpkey="Pull-up Disable Register" +AT91C_PIOB_PPUDR.access=memorymapped +AT91C_PIOB_PPUDR.address=0xFFFFF660 +AT91C_PIOB_PPUDR.width=32 +AT91C_PIOB_PPUDR.byteEndian=little +AT91C_PIOB_PPUDR.type=enum +AT91C_PIOB_PPUDR.enum.0.name=*** Write only *** +AT91C_PIOB_PPUDR.enum.1.name=Error +AT91C_PIOB_PSR.name="AT91C_PIOB_PSR" +AT91C_PIOB_PSR.description="PIO Status Register" +AT91C_PIOB_PSR.helpkey="PIO Status Register" +AT91C_PIOB_PSR.access=memorymapped +AT91C_PIOB_PSR.address=0xFFFFF608 +AT91C_PIOB_PSR.width=32 +AT91C_PIOB_PSR.byteEndian=little +AT91C_PIOB_PSR.permission.write=none +AT91C_PIOB_IER.name="AT91C_PIOB_IER" +AT91C_PIOB_IER.description="Interrupt Enable Register" +AT91C_PIOB_IER.helpkey="Interrupt Enable Register" +AT91C_PIOB_IER.access=memorymapped +AT91C_PIOB_IER.address=0xFFFFF640 +AT91C_PIOB_IER.width=32 +AT91C_PIOB_IER.byteEndian=little +AT91C_PIOB_IER.type=enum +AT91C_PIOB_IER.enum.0.name=*** Write only *** +AT91C_PIOB_IER.enum.1.name=Error +AT91C_PIOB_CODR.name="AT91C_PIOB_CODR" +AT91C_PIOB_CODR.description="Clear Output Data Register" +AT91C_PIOB_CODR.helpkey="Clear Output Data Register" +AT91C_PIOB_CODR.access=memorymapped +AT91C_PIOB_CODR.address=0xFFFFF634 +AT91C_PIOB_CODR.width=32 +AT91C_PIOB_CODR.byteEndian=little +AT91C_PIOB_CODR.type=enum +AT91C_PIOB_CODR.enum.0.name=*** Write only *** +AT91C_PIOB_CODR.enum.1.name=Error +AT91C_PIOB_OWER.name="AT91C_PIOB_OWER" +AT91C_PIOB_OWER.description="Output Write Enable Register" +AT91C_PIOB_OWER.helpkey="Output Write Enable Register" +AT91C_PIOB_OWER.access=memorymapped +AT91C_PIOB_OWER.address=0xFFFFF6A0 +AT91C_PIOB_OWER.width=32 +AT91C_PIOB_OWER.byteEndian=little +AT91C_PIOB_OWER.type=enum +AT91C_PIOB_OWER.enum.0.name=*** Write only *** +AT91C_PIOB_OWER.enum.1.name=Error +AT91C_PIOB_ABSR.name="AT91C_PIOB_ABSR" +AT91C_PIOB_ABSR.description="AB Select Status Register" +AT91C_PIOB_ABSR.helpkey="AB Select Status Register" +AT91C_PIOB_ABSR.access=memorymapped +AT91C_PIOB_ABSR.address=0xFFFFF678 +AT91C_PIOB_ABSR.width=32 +AT91C_PIOB_ABSR.byteEndian=little +AT91C_PIOB_ABSR.permission.write=none +AT91C_PIOB_IFDR.name="AT91C_PIOB_IFDR" +AT91C_PIOB_IFDR.description="Input Filter Disable Register" +AT91C_PIOB_IFDR.helpkey="Input Filter Disable Register" +AT91C_PIOB_IFDR.access=memorymapped +AT91C_PIOB_IFDR.address=0xFFFFF624 +AT91C_PIOB_IFDR.width=32 +AT91C_PIOB_IFDR.byteEndian=little +AT91C_PIOB_IFDR.type=enum +AT91C_PIOB_IFDR.enum.0.name=*** Write only *** +AT91C_PIOB_IFDR.enum.1.name=Error +AT91C_PIOB_PDSR.name="AT91C_PIOB_PDSR" +AT91C_PIOB_PDSR.description="Pin Data Status Register" +AT91C_PIOB_PDSR.helpkey="Pin Data Status Register" +AT91C_PIOB_PDSR.access=memorymapped +AT91C_PIOB_PDSR.address=0xFFFFF63C +AT91C_PIOB_PDSR.width=32 +AT91C_PIOB_PDSR.byteEndian=little +AT91C_PIOB_PDSR.permission.write=none +AT91C_PIOB_IDR.name="AT91C_PIOB_IDR" +AT91C_PIOB_IDR.description="Interrupt Disable Register" +AT91C_PIOB_IDR.helpkey="Interrupt Disable Register" +AT91C_PIOB_IDR.access=memorymapped +AT91C_PIOB_IDR.address=0xFFFFF644 +AT91C_PIOB_IDR.width=32 +AT91C_PIOB_IDR.byteEndian=little +AT91C_PIOB_IDR.type=enum +AT91C_PIOB_IDR.enum.0.name=*** Write only *** +AT91C_PIOB_IDR.enum.1.name=Error +AT91C_PIOB_OWSR.name="AT91C_PIOB_OWSR" +AT91C_PIOB_OWSR.description="Output Write Status Register" +AT91C_PIOB_OWSR.helpkey="Output Write Status Register" +AT91C_PIOB_OWSR.access=memorymapped +AT91C_PIOB_OWSR.address=0xFFFFF6A8 +AT91C_PIOB_OWSR.width=32 +AT91C_PIOB_OWSR.byteEndian=little +AT91C_PIOB_OWSR.permission.write=none +AT91C_PIOB_PDR.name="AT91C_PIOB_PDR" +AT91C_PIOB_PDR.description="PIO Disable Register" +AT91C_PIOB_PDR.helpkey="PIO Disable Register" +AT91C_PIOB_PDR.access=memorymapped +AT91C_PIOB_PDR.address=0xFFFFF604 +AT91C_PIOB_PDR.width=32 +AT91C_PIOB_PDR.byteEndian=little +AT91C_PIOB_PDR.type=enum +AT91C_PIOB_PDR.enum.0.name=*** Write only *** +AT91C_PIOB_PDR.enum.1.name=Error +AT91C_PIOB_ODR.name="AT91C_PIOB_ODR" +AT91C_PIOB_ODR.description="Output Disable Registerr" +AT91C_PIOB_ODR.helpkey="Output Disable Registerr" +AT91C_PIOB_ODR.access=memorymapped +AT91C_PIOB_ODR.address=0xFFFFF614 +AT91C_PIOB_ODR.width=32 +AT91C_PIOB_ODR.byteEndian=little +AT91C_PIOB_ODR.type=enum +AT91C_PIOB_ODR.enum.0.name=*** Write only *** +AT91C_PIOB_ODR.enum.1.name=Error +AT91C_PIOB_IFSR.name="AT91C_PIOB_IFSR" +AT91C_PIOB_IFSR.description="Input Filter Status Register" +AT91C_PIOB_IFSR.helpkey="Input Filter Status Register" +AT91C_PIOB_IFSR.access=memorymapped +AT91C_PIOB_IFSR.address=0xFFFFF628 +AT91C_PIOB_IFSR.width=32 +AT91C_PIOB_IFSR.byteEndian=little +AT91C_PIOB_IFSR.permission.write=none +AT91C_PIOB_PPUER.name="AT91C_PIOB_PPUER" +AT91C_PIOB_PPUER.description="Pull-up Enable Register" +AT91C_PIOB_PPUER.helpkey="Pull-up Enable Register" +AT91C_PIOB_PPUER.access=memorymapped +AT91C_PIOB_PPUER.address=0xFFFFF664 +AT91C_PIOB_PPUER.width=32 +AT91C_PIOB_PPUER.byteEndian=little +AT91C_PIOB_PPUER.type=enum +AT91C_PIOB_PPUER.enum.0.name=*** Write only *** +AT91C_PIOB_PPUER.enum.1.name=Error +AT91C_PIOB_SODR.name="AT91C_PIOB_SODR" +AT91C_PIOB_SODR.description="Set Output Data Register" +AT91C_PIOB_SODR.helpkey="Set Output Data Register" +AT91C_PIOB_SODR.access=memorymapped +AT91C_PIOB_SODR.address=0xFFFFF630 +AT91C_PIOB_SODR.width=32 +AT91C_PIOB_SODR.byteEndian=little +AT91C_PIOB_SODR.type=enum +AT91C_PIOB_SODR.enum.0.name=*** Write only *** +AT91C_PIOB_SODR.enum.1.name=Error +AT91C_PIOB_ISR.name="AT91C_PIOB_ISR" +AT91C_PIOB_ISR.description="Interrupt Status Register" +AT91C_PIOB_ISR.helpkey="Interrupt Status Register" +AT91C_PIOB_ISR.access=memorymapped +AT91C_PIOB_ISR.address=0xFFFFF64C +AT91C_PIOB_ISR.width=32 +AT91C_PIOB_ISR.byteEndian=little +AT91C_PIOB_ISR.permission.write=none +AT91C_PIOB_ODSR.name="AT91C_PIOB_ODSR" +AT91C_PIOB_ODSR.description="Output Data Status Register" +AT91C_PIOB_ODSR.helpkey="Output Data Status Register" +AT91C_PIOB_ODSR.access=memorymapped +AT91C_PIOB_ODSR.address=0xFFFFF638 +AT91C_PIOB_ODSR.width=32 +AT91C_PIOB_ODSR.byteEndian=little +AT91C_PIOB_ODSR.permission.write=none +AT91C_PIOB_OSR.name="AT91C_PIOB_OSR" +AT91C_PIOB_OSR.description="Output Status Register" +AT91C_PIOB_OSR.helpkey="Output Status Register" +AT91C_PIOB_OSR.access=memorymapped +AT91C_PIOB_OSR.address=0xFFFFF618 +AT91C_PIOB_OSR.width=32 +AT91C_PIOB_OSR.byteEndian=little +AT91C_PIOB_OSR.permission.write=none +AT91C_PIOB_MDSR.name="AT91C_PIOB_MDSR" +AT91C_PIOB_MDSR.description="Multi-driver Status Register" +AT91C_PIOB_MDSR.helpkey="Multi-driver Status Register" +AT91C_PIOB_MDSR.access=memorymapped +AT91C_PIOB_MDSR.address=0xFFFFF658 +AT91C_PIOB_MDSR.width=32 +AT91C_PIOB_MDSR.byteEndian=little +AT91C_PIOB_MDSR.permission.write=none +AT91C_PIOB_IFER.name="AT91C_PIOB_IFER" +AT91C_PIOB_IFER.description="Input Filter Enable Register" +AT91C_PIOB_IFER.helpkey="Input Filter Enable Register" +AT91C_PIOB_IFER.access=memorymapped +AT91C_PIOB_IFER.address=0xFFFFF620 +AT91C_PIOB_IFER.width=32 +AT91C_PIOB_IFER.byteEndian=little +AT91C_PIOB_IFER.type=enum +AT91C_PIOB_IFER.enum.0.name=*** Write only *** +AT91C_PIOB_IFER.enum.1.name=Error +AT91C_PIOB_BSR.name="AT91C_PIOB_BSR" +AT91C_PIOB_BSR.description="Select B Register" +AT91C_PIOB_BSR.helpkey="Select B Register" +AT91C_PIOB_BSR.access=memorymapped +AT91C_PIOB_BSR.address=0xFFFFF674 +AT91C_PIOB_BSR.width=32 +AT91C_PIOB_BSR.byteEndian=little +AT91C_PIOB_BSR.type=enum +AT91C_PIOB_BSR.enum.0.name=*** Write only *** +AT91C_PIOB_BSR.enum.1.name=Error +AT91C_PIOB_MDDR.name="AT91C_PIOB_MDDR" +AT91C_PIOB_MDDR.description="Multi-driver Disable Register" +AT91C_PIOB_MDDR.helpkey="Multi-driver Disable Register" +AT91C_PIOB_MDDR.access=memorymapped +AT91C_PIOB_MDDR.address=0xFFFFF654 +AT91C_PIOB_MDDR.width=32 +AT91C_PIOB_MDDR.byteEndian=little +AT91C_PIOB_MDDR.type=enum +AT91C_PIOB_MDDR.enum.0.name=*** Write only *** +AT91C_PIOB_MDDR.enum.1.name=Error +AT91C_PIOB_OER.name="AT91C_PIOB_OER" +AT91C_PIOB_OER.description="Output Enable Register" +AT91C_PIOB_OER.helpkey="Output Enable Register" +AT91C_PIOB_OER.access=memorymapped +AT91C_PIOB_OER.address=0xFFFFF610 +AT91C_PIOB_OER.width=32 +AT91C_PIOB_OER.byteEndian=little +AT91C_PIOB_OER.type=enum +AT91C_PIOB_OER.enum.0.name=*** Write only *** +AT91C_PIOB_OER.enum.1.name=Error +AT91C_PIOB_PER.name="AT91C_PIOB_PER" +AT91C_PIOB_PER.description="PIO Enable Register" +AT91C_PIOB_PER.helpkey="PIO Enable Register" +AT91C_PIOB_PER.access=memorymapped +AT91C_PIOB_PER.address=0xFFFFF600 +AT91C_PIOB_PER.width=32 +AT91C_PIOB_PER.byteEndian=little +AT91C_PIOB_PER.type=enum +AT91C_PIOB_PER.enum.0.name=*** Write only *** +AT91C_PIOB_PER.enum.1.name=Error +# ========== Register definition for CKGR peripheral ========== +AT91C_CKGR_MOR.name="AT91C_CKGR_MOR" +AT91C_CKGR_MOR.description="Main Oscillator Register" +AT91C_CKGR_MOR.helpkey="Main Oscillator Register" +AT91C_CKGR_MOR.access=memorymapped +AT91C_CKGR_MOR.address=0xFFFFFC20 +AT91C_CKGR_MOR.width=32 +AT91C_CKGR_MOR.byteEndian=little +AT91C_CKGR_PLLR.name="AT91C_CKGR_PLLR" +AT91C_CKGR_PLLR.description="PLL Register" +AT91C_CKGR_PLLR.helpkey="PLL Register" +AT91C_CKGR_PLLR.access=memorymapped +AT91C_CKGR_PLLR.address=0xFFFFFC2C +AT91C_CKGR_PLLR.width=32 +AT91C_CKGR_PLLR.byteEndian=little +AT91C_CKGR_MCFR.name="AT91C_CKGR_MCFR" +AT91C_CKGR_MCFR.description="Main Clock Frequency Register" +AT91C_CKGR_MCFR.helpkey="Main Clock Frequency Register" +AT91C_CKGR_MCFR.access=memorymapped +AT91C_CKGR_MCFR.address=0xFFFFFC24 +AT91C_CKGR_MCFR.width=32 +AT91C_CKGR_MCFR.byteEndian=little +AT91C_CKGR_MCFR.permission.write=none +# ========== Register definition for PMC peripheral ========== +AT91C_PMC_IDR.name="AT91C_PMC_IDR" +AT91C_PMC_IDR.description="Interrupt Disable Register" +AT91C_PMC_IDR.helpkey="Interrupt Disable Register" +AT91C_PMC_IDR.access=memorymapped +AT91C_PMC_IDR.address=0xFFFFFC64 +AT91C_PMC_IDR.width=32 +AT91C_PMC_IDR.byteEndian=little +AT91C_PMC_IDR.type=enum +AT91C_PMC_IDR.enum.0.name=*** Write only *** +AT91C_PMC_IDR.enum.1.name=Error +AT91C_PMC_MOR.name="AT91C_PMC_MOR" +AT91C_PMC_MOR.description="Main Oscillator Register" +AT91C_PMC_MOR.helpkey="Main Oscillator Register" +AT91C_PMC_MOR.access=memorymapped +AT91C_PMC_MOR.address=0xFFFFFC20 +AT91C_PMC_MOR.width=32 +AT91C_PMC_MOR.byteEndian=little +AT91C_PMC_PLLR.name="AT91C_PMC_PLLR" +AT91C_PMC_PLLR.description="PLL Register" +AT91C_PMC_PLLR.helpkey="PLL Register" +AT91C_PMC_PLLR.access=memorymapped +AT91C_PMC_PLLR.address=0xFFFFFC2C +AT91C_PMC_PLLR.width=32 +AT91C_PMC_PLLR.byteEndian=little +AT91C_PMC_PCER.name="AT91C_PMC_PCER" +AT91C_PMC_PCER.description="Peripheral Clock Enable Register" +AT91C_PMC_PCER.helpkey="Peripheral Clock Enable Register" +AT91C_PMC_PCER.access=memorymapped +AT91C_PMC_PCER.address=0xFFFFFC10 +AT91C_PMC_PCER.width=32 +AT91C_PMC_PCER.byteEndian=little +AT91C_PMC_PCER.type=enum +AT91C_PMC_PCER.enum.0.name=*** Write only *** +AT91C_PMC_PCER.enum.1.name=Error +AT91C_PMC_PCKR.name="AT91C_PMC_PCKR" +AT91C_PMC_PCKR.description="Programmable Clock Register" +AT91C_PMC_PCKR.helpkey="Programmable Clock Register" +AT91C_PMC_PCKR.access=memorymapped +AT91C_PMC_PCKR.address=0xFFFFFC40 +AT91C_PMC_PCKR.width=32 +AT91C_PMC_PCKR.byteEndian=little +AT91C_PMC_MCKR.name="AT91C_PMC_MCKR" +AT91C_PMC_MCKR.description="Master Clock Register" +AT91C_PMC_MCKR.helpkey="Master Clock Register" +AT91C_PMC_MCKR.access=memorymapped +AT91C_PMC_MCKR.address=0xFFFFFC30 +AT91C_PMC_MCKR.width=32 +AT91C_PMC_MCKR.byteEndian=little +AT91C_PMC_SCDR.name="AT91C_PMC_SCDR" +AT91C_PMC_SCDR.description="System Clock Disable Register" +AT91C_PMC_SCDR.helpkey="System Clock Disable Register" +AT91C_PMC_SCDR.access=memorymapped +AT91C_PMC_SCDR.address=0xFFFFFC04 +AT91C_PMC_SCDR.width=32 +AT91C_PMC_SCDR.byteEndian=little +AT91C_PMC_SCDR.type=enum +AT91C_PMC_SCDR.enum.0.name=*** Write only *** +AT91C_PMC_SCDR.enum.1.name=Error +AT91C_PMC_PCDR.name="AT91C_PMC_PCDR" +AT91C_PMC_PCDR.description="Peripheral Clock Disable Register" +AT91C_PMC_PCDR.helpkey="Peripheral Clock Disable Register" +AT91C_PMC_PCDR.access=memorymapped +AT91C_PMC_PCDR.address=0xFFFFFC14 +AT91C_PMC_PCDR.width=32 +AT91C_PMC_PCDR.byteEndian=little +AT91C_PMC_PCDR.type=enum +AT91C_PMC_PCDR.enum.0.name=*** Write only *** +AT91C_PMC_PCDR.enum.1.name=Error +AT91C_PMC_SCSR.name="AT91C_PMC_SCSR" +AT91C_PMC_SCSR.description="System Clock Status Register" +AT91C_PMC_SCSR.helpkey="System Clock Status Register" +AT91C_PMC_SCSR.access=memorymapped +AT91C_PMC_SCSR.address=0xFFFFFC08 +AT91C_PMC_SCSR.width=32 +AT91C_PMC_SCSR.byteEndian=little +AT91C_PMC_SCSR.permission.write=none +AT91C_PMC_PCSR.name="AT91C_PMC_PCSR" +AT91C_PMC_PCSR.description="Peripheral Clock Status Register" +AT91C_PMC_PCSR.helpkey="Peripheral Clock Status Register" +AT91C_PMC_PCSR.access=memorymapped +AT91C_PMC_PCSR.address=0xFFFFFC18 +AT91C_PMC_PCSR.width=32 +AT91C_PMC_PCSR.byteEndian=little +AT91C_PMC_PCSR.permission.write=none +AT91C_PMC_MCFR.name="AT91C_PMC_MCFR" +AT91C_PMC_MCFR.description="Main Clock Frequency Register" +AT91C_PMC_MCFR.helpkey="Main Clock Frequency Register" +AT91C_PMC_MCFR.access=memorymapped +AT91C_PMC_MCFR.address=0xFFFFFC24 +AT91C_PMC_MCFR.width=32 +AT91C_PMC_MCFR.byteEndian=little +AT91C_PMC_MCFR.permission.write=none +AT91C_PMC_SCER.name="AT91C_PMC_SCER" +AT91C_PMC_SCER.description="System Clock Enable Register" +AT91C_PMC_SCER.helpkey="System Clock Enable Register" +AT91C_PMC_SCER.access=memorymapped +AT91C_PMC_SCER.address=0xFFFFFC00 +AT91C_PMC_SCER.width=32 +AT91C_PMC_SCER.byteEndian=little +AT91C_PMC_SCER.type=enum +AT91C_PMC_SCER.enum.0.name=*** Write only *** +AT91C_PMC_SCER.enum.1.name=Error +AT91C_PMC_IMR.name="AT91C_PMC_IMR" +AT91C_PMC_IMR.description="Interrupt Mask Register" +AT91C_PMC_IMR.helpkey="Interrupt Mask Register" +AT91C_PMC_IMR.access=memorymapped +AT91C_PMC_IMR.address=0xFFFFFC6C +AT91C_PMC_IMR.width=32 +AT91C_PMC_IMR.byteEndian=little +AT91C_PMC_IMR.permission.write=none +AT91C_PMC_IER.name="AT91C_PMC_IER" +AT91C_PMC_IER.description="Interrupt Enable Register" +AT91C_PMC_IER.helpkey="Interrupt Enable Register" +AT91C_PMC_IER.access=memorymapped +AT91C_PMC_IER.address=0xFFFFFC60 +AT91C_PMC_IER.width=32 +AT91C_PMC_IER.byteEndian=little +AT91C_PMC_IER.type=enum +AT91C_PMC_IER.enum.0.name=*** Write only *** +AT91C_PMC_IER.enum.1.name=Error +AT91C_PMC_SR.name="AT91C_PMC_SR" +AT91C_PMC_SR.description="Status Register" +AT91C_PMC_SR.helpkey="Status Register" +AT91C_PMC_SR.access=memorymapped +AT91C_PMC_SR.address=0xFFFFFC68 +AT91C_PMC_SR.width=32 +AT91C_PMC_SR.byteEndian=little +AT91C_PMC_SR.permission.write=none +# ========== Register definition for RSTC peripheral ========== +AT91C_RSTC_RCR.name="AT91C_RSTC_RCR" +AT91C_RSTC_RCR.description="Reset Control Register" +AT91C_RSTC_RCR.helpkey="Reset Control Register" +AT91C_RSTC_RCR.access=memorymapped +AT91C_RSTC_RCR.address=0xFFFFFD00 +AT91C_RSTC_RCR.width=32 +AT91C_RSTC_RCR.byteEndian=little +AT91C_RSTC_RCR.type=enum +AT91C_RSTC_RCR.enum.0.name=*** Write only *** +AT91C_RSTC_RCR.enum.1.name=Error +AT91C_RSTC_RMR.name="AT91C_RSTC_RMR" +AT91C_RSTC_RMR.description="Reset Mode Register" +AT91C_RSTC_RMR.helpkey="Reset Mode Register" +AT91C_RSTC_RMR.access=memorymapped +AT91C_RSTC_RMR.address=0xFFFFFD08 +AT91C_RSTC_RMR.width=32 +AT91C_RSTC_RMR.byteEndian=little +AT91C_RSTC_RSR.name="AT91C_RSTC_RSR" +AT91C_RSTC_RSR.description="Reset Status Register" +AT91C_RSTC_RSR.helpkey="Reset Status Register" +AT91C_RSTC_RSR.access=memorymapped +AT91C_RSTC_RSR.address=0xFFFFFD04 +AT91C_RSTC_RSR.width=32 +AT91C_RSTC_RSR.byteEndian=little +AT91C_RSTC_RSR.permission.write=none +# ========== Register definition for RTTC peripheral ========== +AT91C_RTTC_RTSR.name="AT91C_RTTC_RTSR" +AT91C_RTTC_RTSR.description="Real-time Status Register" +AT91C_RTTC_RTSR.helpkey="Real-time Status Register" +AT91C_RTTC_RTSR.access=memorymapped +AT91C_RTTC_RTSR.address=0xFFFFFD2C +AT91C_RTTC_RTSR.width=32 +AT91C_RTTC_RTSR.byteEndian=little +AT91C_RTTC_RTSR.permission.write=none +AT91C_RTTC_RTMR.name="AT91C_RTTC_RTMR" +AT91C_RTTC_RTMR.description="Real-time Mode Register" +AT91C_RTTC_RTMR.helpkey="Real-time Mode Register" +AT91C_RTTC_RTMR.access=memorymapped +AT91C_RTTC_RTMR.address=0xFFFFFD20 +AT91C_RTTC_RTMR.width=32 +AT91C_RTTC_RTMR.byteEndian=little +AT91C_RTTC_RTVR.name="AT91C_RTTC_RTVR" +AT91C_RTTC_RTVR.description="Real-time Value Register" +AT91C_RTTC_RTVR.helpkey="Real-time Value Register" +AT91C_RTTC_RTVR.access=memorymapped +AT91C_RTTC_RTVR.address=0xFFFFFD28 +AT91C_RTTC_RTVR.width=32 +AT91C_RTTC_RTVR.byteEndian=little +AT91C_RTTC_RTVR.permission.write=none +AT91C_RTTC_RTAR.name="AT91C_RTTC_RTAR" +AT91C_RTTC_RTAR.description="Real-time Alarm Register" +AT91C_RTTC_RTAR.helpkey="Real-time Alarm Register" +AT91C_RTTC_RTAR.access=memorymapped +AT91C_RTTC_RTAR.address=0xFFFFFD24 +AT91C_RTTC_RTAR.width=32 +AT91C_RTTC_RTAR.byteEndian=little +# ========== Register definition for PITC peripheral ========== +AT91C_PITC_PIVR.name="AT91C_PITC_PIVR" +AT91C_PITC_PIVR.description="Period Interval Value Register" +AT91C_PITC_PIVR.helpkey="Period Interval Value Register" +AT91C_PITC_PIVR.access=memorymapped +AT91C_PITC_PIVR.address=0xFFFFFD38 +AT91C_PITC_PIVR.width=32 +AT91C_PITC_PIVR.byteEndian=little +AT91C_PITC_PIVR.permission.write=none +AT91C_PITC_PISR.name="AT91C_PITC_PISR" +AT91C_PITC_PISR.description="Period Interval Status Register" +AT91C_PITC_PISR.helpkey="Period Interval Status Register" +AT91C_PITC_PISR.access=memorymapped +AT91C_PITC_PISR.address=0xFFFFFD34 +AT91C_PITC_PISR.width=32 +AT91C_PITC_PISR.byteEndian=little +AT91C_PITC_PISR.permission.write=none +AT91C_PITC_PIIR.name="AT91C_PITC_PIIR" +AT91C_PITC_PIIR.description="Period Interval Image Register" +AT91C_PITC_PIIR.helpkey="Period Interval Image Register" +AT91C_PITC_PIIR.access=memorymapped +AT91C_PITC_PIIR.address=0xFFFFFD3C +AT91C_PITC_PIIR.width=32 +AT91C_PITC_PIIR.byteEndian=little +AT91C_PITC_PIIR.permission.write=none +AT91C_PITC_PIMR.name="AT91C_PITC_PIMR" +AT91C_PITC_PIMR.description="Period Interval Mode Register" +AT91C_PITC_PIMR.helpkey="Period Interval Mode Register" +AT91C_PITC_PIMR.access=memorymapped +AT91C_PITC_PIMR.address=0xFFFFFD30 +AT91C_PITC_PIMR.width=32 +AT91C_PITC_PIMR.byteEndian=little +# ========== Register definition for WDTC peripheral ========== +AT91C_WDTC_WDCR.name="AT91C_WDTC_WDCR" +AT91C_WDTC_WDCR.description="Watchdog Control Register" +AT91C_WDTC_WDCR.helpkey="Watchdog Control Register" +AT91C_WDTC_WDCR.access=memorymapped +AT91C_WDTC_WDCR.address=0xFFFFFD40 +AT91C_WDTC_WDCR.width=32 +AT91C_WDTC_WDCR.byteEndian=little +AT91C_WDTC_WDCR.type=enum +AT91C_WDTC_WDCR.enum.0.name=*** Write only *** +AT91C_WDTC_WDCR.enum.1.name=Error +AT91C_WDTC_WDSR.name="AT91C_WDTC_WDSR" +AT91C_WDTC_WDSR.description="Watchdog Status Register" +AT91C_WDTC_WDSR.helpkey="Watchdog Status Register" +AT91C_WDTC_WDSR.access=memorymapped +AT91C_WDTC_WDSR.address=0xFFFFFD48 +AT91C_WDTC_WDSR.width=32 +AT91C_WDTC_WDSR.byteEndian=little +AT91C_WDTC_WDSR.permission.write=none +AT91C_WDTC_WDMR.name="AT91C_WDTC_WDMR" +AT91C_WDTC_WDMR.description="Watchdog Mode Register" +AT91C_WDTC_WDMR.helpkey="Watchdog Mode Register" +AT91C_WDTC_WDMR.access=memorymapped +AT91C_WDTC_WDMR.address=0xFFFFFD44 +AT91C_WDTC_WDMR.width=32 +AT91C_WDTC_WDMR.byteEndian=little +# ========== Register definition for VREG peripheral ========== +AT91C_VREG_MR.name="AT91C_VREG_MR" +AT91C_VREG_MR.description="Voltage Regulator Mode Register" +AT91C_VREG_MR.helpkey="Voltage Regulator Mode Register" +AT91C_VREG_MR.access=memorymapped +AT91C_VREG_MR.address=0xFFFFFD60 +AT91C_VREG_MR.width=32 +AT91C_VREG_MR.byteEndian=little +# ========== Register definition for MC peripheral ========== +AT91C_MC_ASR.name="AT91C_MC_ASR" +AT91C_MC_ASR.description="MC Abort Status Register" +AT91C_MC_ASR.helpkey="MC Abort Status Register" +AT91C_MC_ASR.access=memorymapped +AT91C_MC_ASR.address=0xFFFFFF04 +AT91C_MC_ASR.width=32 +AT91C_MC_ASR.byteEndian=little +AT91C_MC_ASR.permission.write=none +AT91C_MC_RCR.name="AT91C_MC_RCR" +AT91C_MC_RCR.description="MC Remap Control Register" +AT91C_MC_RCR.helpkey="MC Remap Control Register" +AT91C_MC_RCR.access=memorymapped +AT91C_MC_RCR.address=0xFFFFFF00 +AT91C_MC_RCR.width=32 +AT91C_MC_RCR.byteEndian=little +AT91C_MC_RCR.type=enum +AT91C_MC_RCR.enum.0.name=*** Write only *** +AT91C_MC_RCR.enum.1.name=Error +AT91C_MC_FCR.name="AT91C_MC_FCR" +AT91C_MC_FCR.description="MC Flash Command Register" +AT91C_MC_FCR.helpkey="MC Flash Command Register" +AT91C_MC_FCR.access=memorymapped +AT91C_MC_FCR.address=0xFFFFFF64 +AT91C_MC_FCR.width=32 +AT91C_MC_FCR.byteEndian=little +AT91C_MC_FCR.type=enum +AT91C_MC_FCR.enum.0.name=*** Write only *** +AT91C_MC_FCR.enum.1.name=Error +AT91C_MC_AASR.name="AT91C_MC_AASR" +AT91C_MC_AASR.description="MC Abort Address Status Register" +AT91C_MC_AASR.helpkey="MC Abort Address Status Register" +AT91C_MC_AASR.access=memorymapped +AT91C_MC_AASR.address=0xFFFFFF08 +AT91C_MC_AASR.width=32 +AT91C_MC_AASR.byteEndian=little +AT91C_MC_AASR.permission.write=none +AT91C_MC_FSR.name="AT91C_MC_FSR" +AT91C_MC_FSR.description="MC Flash Status Register" +AT91C_MC_FSR.helpkey="MC Flash Status Register" +AT91C_MC_FSR.access=memorymapped +AT91C_MC_FSR.address=0xFFFFFF68 +AT91C_MC_FSR.width=32 +AT91C_MC_FSR.byteEndian=little +AT91C_MC_FSR.permission.write=none +AT91C_MC_FMR.name="AT91C_MC_FMR" +AT91C_MC_FMR.description="MC Flash Mode Register" +AT91C_MC_FMR.helpkey="MC Flash Mode Register" +AT91C_MC_FMR.access=memorymapped +AT91C_MC_FMR.address=0xFFFFFF60 +AT91C_MC_FMR.width=32 +AT91C_MC_FMR.byteEndian=little +# ========== Register definition for PDC_SPI1 peripheral ========== +AT91C_SPI1_PTCR.name="AT91C_SPI1_PTCR" +AT91C_SPI1_PTCR.description="PDC Transfer Control Register" +AT91C_SPI1_PTCR.helpkey="PDC Transfer Control Register" +AT91C_SPI1_PTCR.access=memorymapped +AT91C_SPI1_PTCR.address=0xFFFE4120 +AT91C_SPI1_PTCR.width=32 +AT91C_SPI1_PTCR.byteEndian=little +AT91C_SPI1_PTCR.type=enum +AT91C_SPI1_PTCR.enum.0.name=*** Write only *** +AT91C_SPI1_PTCR.enum.1.name=Error +AT91C_SPI1_RPR.name="AT91C_SPI1_RPR" +AT91C_SPI1_RPR.description="Receive Pointer Register" +AT91C_SPI1_RPR.helpkey="Receive Pointer Register" +AT91C_SPI1_RPR.access=memorymapped +AT91C_SPI1_RPR.address=0xFFFE4100 +AT91C_SPI1_RPR.width=32 +AT91C_SPI1_RPR.byteEndian=little +AT91C_SPI1_TNCR.name="AT91C_SPI1_TNCR" +AT91C_SPI1_TNCR.description="Transmit Next Counter Register" +AT91C_SPI1_TNCR.helpkey="Transmit Next Counter Register" +AT91C_SPI1_TNCR.access=memorymapped +AT91C_SPI1_TNCR.address=0xFFFE411C +AT91C_SPI1_TNCR.width=32 +AT91C_SPI1_TNCR.byteEndian=little +AT91C_SPI1_TPR.name="AT91C_SPI1_TPR" +AT91C_SPI1_TPR.description="Transmit Pointer Register" +AT91C_SPI1_TPR.helpkey="Transmit Pointer Register" +AT91C_SPI1_TPR.access=memorymapped +AT91C_SPI1_TPR.address=0xFFFE4108 +AT91C_SPI1_TPR.width=32 +AT91C_SPI1_TPR.byteEndian=little +AT91C_SPI1_TNPR.name="AT91C_SPI1_TNPR" +AT91C_SPI1_TNPR.description="Transmit Next Pointer Register" +AT91C_SPI1_TNPR.helpkey="Transmit Next Pointer Register" +AT91C_SPI1_TNPR.access=memorymapped +AT91C_SPI1_TNPR.address=0xFFFE4118 +AT91C_SPI1_TNPR.width=32 +AT91C_SPI1_TNPR.byteEndian=little +AT91C_SPI1_TCR.name="AT91C_SPI1_TCR" +AT91C_SPI1_TCR.description="Transmit Counter Register" +AT91C_SPI1_TCR.helpkey="Transmit Counter Register" +AT91C_SPI1_TCR.access=memorymapped +AT91C_SPI1_TCR.address=0xFFFE410C +AT91C_SPI1_TCR.width=32 +AT91C_SPI1_TCR.byteEndian=little +AT91C_SPI1_RCR.name="AT91C_SPI1_RCR" +AT91C_SPI1_RCR.description="Receive Counter Register" +AT91C_SPI1_RCR.helpkey="Receive Counter Register" +AT91C_SPI1_RCR.access=memorymapped +AT91C_SPI1_RCR.address=0xFFFE4104 +AT91C_SPI1_RCR.width=32 +AT91C_SPI1_RCR.byteEndian=little +AT91C_SPI1_RNPR.name="AT91C_SPI1_RNPR" +AT91C_SPI1_RNPR.description="Receive Next Pointer Register" +AT91C_SPI1_RNPR.helpkey="Receive Next Pointer Register" +AT91C_SPI1_RNPR.access=memorymapped +AT91C_SPI1_RNPR.address=0xFFFE4110 +AT91C_SPI1_RNPR.width=32 +AT91C_SPI1_RNPR.byteEndian=little +AT91C_SPI1_RNCR.name="AT91C_SPI1_RNCR" +AT91C_SPI1_RNCR.description="Receive Next Counter Register" +AT91C_SPI1_RNCR.helpkey="Receive Next Counter Register" +AT91C_SPI1_RNCR.access=memorymapped +AT91C_SPI1_RNCR.address=0xFFFE4114 +AT91C_SPI1_RNCR.width=32 +AT91C_SPI1_RNCR.byteEndian=little +AT91C_SPI1_PTSR.name="AT91C_SPI1_PTSR" +AT91C_SPI1_PTSR.description="PDC Transfer Status Register" +AT91C_SPI1_PTSR.helpkey="PDC Transfer Status Register" +AT91C_SPI1_PTSR.access=memorymapped +AT91C_SPI1_PTSR.address=0xFFFE4124 +AT91C_SPI1_PTSR.width=32 +AT91C_SPI1_PTSR.byteEndian=little +AT91C_SPI1_PTSR.permission.write=none +# ========== Register definition for SPI1 peripheral ========== +AT91C_SPI1_IMR.name="AT91C_SPI1_IMR" +AT91C_SPI1_IMR.description="Interrupt Mask Register" +AT91C_SPI1_IMR.helpkey="Interrupt Mask Register" +AT91C_SPI1_IMR.access=memorymapped +AT91C_SPI1_IMR.address=0xFFFE401C +AT91C_SPI1_IMR.width=32 +AT91C_SPI1_IMR.byteEndian=little +AT91C_SPI1_IMR.permission.write=none +AT91C_SPI1_IER.name="AT91C_SPI1_IER" +AT91C_SPI1_IER.description="Interrupt Enable Register" +AT91C_SPI1_IER.helpkey="Interrupt Enable Register" +AT91C_SPI1_IER.access=memorymapped +AT91C_SPI1_IER.address=0xFFFE4014 +AT91C_SPI1_IER.width=32 +AT91C_SPI1_IER.byteEndian=little +AT91C_SPI1_IER.type=enum +AT91C_SPI1_IER.enum.0.name=*** Write only *** +AT91C_SPI1_IER.enum.1.name=Error +AT91C_SPI1_MR.name="AT91C_SPI1_MR" +AT91C_SPI1_MR.description="Mode Register" +AT91C_SPI1_MR.helpkey="Mode Register" +AT91C_SPI1_MR.access=memorymapped +AT91C_SPI1_MR.address=0xFFFE4004 +AT91C_SPI1_MR.width=32 +AT91C_SPI1_MR.byteEndian=little +AT91C_SPI1_RDR.name="AT91C_SPI1_RDR" +AT91C_SPI1_RDR.description="Receive Data Register" +AT91C_SPI1_RDR.helpkey="Receive Data Register" +AT91C_SPI1_RDR.access=memorymapped +AT91C_SPI1_RDR.address=0xFFFE4008 +AT91C_SPI1_RDR.width=32 +AT91C_SPI1_RDR.byteEndian=little +AT91C_SPI1_RDR.permission.write=none +AT91C_SPI1_IDR.name="AT91C_SPI1_IDR" +AT91C_SPI1_IDR.description="Interrupt Disable Register" +AT91C_SPI1_IDR.helpkey="Interrupt Disable Register" +AT91C_SPI1_IDR.access=memorymapped +AT91C_SPI1_IDR.address=0xFFFE4018 +AT91C_SPI1_IDR.width=32 +AT91C_SPI1_IDR.byteEndian=little +AT91C_SPI1_IDR.type=enum +AT91C_SPI1_IDR.enum.0.name=*** Write only *** +AT91C_SPI1_IDR.enum.1.name=Error +AT91C_SPI1_SR.name="AT91C_SPI1_SR" +AT91C_SPI1_SR.description="Status Register" +AT91C_SPI1_SR.helpkey="Status Register" +AT91C_SPI1_SR.access=memorymapped +AT91C_SPI1_SR.address=0xFFFE4010 +AT91C_SPI1_SR.width=32 +AT91C_SPI1_SR.byteEndian=little +AT91C_SPI1_SR.permission.write=none +AT91C_SPI1_TDR.name="AT91C_SPI1_TDR" +AT91C_SPI1_TDR.description="Transmit Data Register" +AT91C_SPI1_TDR.helpkey="Transmit Data Register" +AT91C_SPI1_TDR.access=memorymapped +AT91C_SPI1_TDR.address=0xFFFE400C +AT91C_SPI1_TDR.width=32 +AT91C_SPI1_TDR.byteEndian=little +AT91C_SPI1_TDR.type=enum +AT91C_SPI1_TDR.enum.0.name=*** Write only *** +AT91C_SPI1_TDR.enum.1.name=Error +AT91C_SPI1_CR.name="AT91C_SPI1_CR" +AT91C_SPI1_CR.description="Control Register" +AT91C_SPI1_CR.helpkey="Control Register" +AT91C_SPI1_CR.access=memorymapped +AT91C_SPI1_CR.address=0xFFFE4000 +AT91C_SPI1_CR.width=32 +AT91C_SPI1_CR.byteEndian=little +AT91C_SPI1_CR.permission.write=none +AT91C_SPI1_CSR.name="AT91C_SPI1_CSR" +AT91C_SPI1_CSR.description="Chip Select Register" +AT91C_SPI1_CSR.helpkey="Chip Select Register" +AT91C_SPI1_CSR.access=memorymapped +AT91C_SPI1_CSR.address=0xFFFE4030 +AT91C_SPI1_CSR.width=32 +AT91C_SPI1_CSR.byteEndian=little +# ========== Register definition for PDC_SPI0 peripheral ========== +AT91C_SPI0_PTCR.name="AT91C_SPI0_PTCR" +AT91C_SPI0_PTCR.description="PDC Transfer Control Register" +AT91C_SPI0_PTCR.helpkey="PDC Transfer Control Register" +AT91C_SPI0_PTCR.access=memorymapped +AT91C_SPI0_PTCR.address=0xFFFE0120 +AT91C_SPI0_PTCR.width=32 +AT91C_SPI0_PTCR.byteEndian=little +AT91C_SPI0_PTCR.type=enum +AT91C_SPI0_PTCR.enum.0.name=*** Write only *** +AT91C_SPI0_PTCR.enum.1.name=Error +AT91C_SPI0_TPR.name="AT91C_SPI0_TPR" +AT91C_SPI0_TPR.description="Transmit Pointer Register" +AT91C_SPI0_TPR.helpkey="Transmit Pointer Register" +AT91C_SPI0_TPR.access=memorymapped +AT91C_SPI0_TPR.address=0xFFFE0108 +AT91C_SPI0_TPR.width=32 +AT91C_SPI0_TPR.byteEndian=little +AT91C_SPI0_TCR.name="AT91C_SPI0_TCR" +AT91C_SPI0_TCR.description="Transmit Counter Register" +AT91C_SPI0_TCR.helpkey="Transmit Counter Register" +AT91C_SPI0_TCR.access=memorymapped +AT91C_SPI0_TCR.address=0xFFFE010C +AT91C_SPI0_TCR.width=32 +AT91C_SPI0_TCR.byteEndian=little +AT91C_SPI0_RCR.name="AT91C_SPI0_RCR" +AT91C_SPI0_RCR.description="Receive Counter Register" +AT91C_SPI0_RCR.helpkey="Receive Counter Register" +AT91C_SPI0_RCR.access=memorymapped +AT91C_SPI0_RCR.address=0xFFFE0104 +AT91C_SPI0_RCR.width=32 +AT91C_SPI0_RCR.byteEndian=little +AT91C_SPI0_PTSR.name="AT91C_SPI0_PTSR" +AT91C_SPI0_PTSR.description="PDC Transfer Status Register" +AT91C_SPI0_PTSR.helpkey="PDC Transfer Status Register" +AT91C_SPI0_PTSR.access=memorymapped +AT91C_SPI0_PTSR.address=0xFFFE0124 +AT91C_SPI0_PTSR.width=32 +AT91C_SPI0_PTSR.byteEndian=little +AT91C_SPI0_PTSR.permission.write=none +AT91C_SPI0_RNPR.name="AT91C_SPI0_RNPR" +AT91C_SPI0_RNPR.description="Receive Next Pointer Register" +AT91C_SPI0_RNPR.helpkey="Receive Next Pointer Register" +AT91C_SPI0_RNPR.access=memorymapped +AT91C_SPI0_RNPR.address=0xFFFE0110 +AT91C_SPI0_RNPR.width=32 +AT91C_SPI0_RNPR.byteEndian=little +AT91C_SPI0_RPR.name="AT91C_SPI0_RPR" +AT91C_SPI0_RPR.description="Receive Pointer Register" +AT91C_SPI0_RPR.helpkey="Receive Pointer Register" +AT91C_SPI0_RPR.access=memorymapped +AT91C_SPI0_RPR.address=0xFFFE0100 +AT91C_SPI0_RPR.width=32 +AT91C_SPI0_RPR.byteEndian=little +AT91C_SPI0_TNCR.name="AT91C_SPI0_TNCR" +AT91C_SPI0_TNCR.description="Transmit Next Counter Register" +AT91C_SPI0_TNCR.helpkey="Transmit Next Counter Register" +AT91C_SPI0_TNCR.access=memorymapped +AT91C_SPI0_TNCR.address=0xFFFE011C +AT91C_SPI0_TNCR.width=32 +AT91C_SPI0_TNCR.byteEndian=little +AT91C_SPI0_RNCR.name="AT91C_SPI0_RNCR" +AT91C_SPI0_RNCR.description="Receive Next Counter Register" +AT91C_SPI0_RNCR.helpkey="Receive Next Counter Register" +AT91C_SPI0_RNCR.access=memorymapped +AT91C_SPI0_RNCR.address=0xFFFE0114 +AT91C_SPI0_RNCR.width=32 +AT91C_SPI0_RNCR.byteEndian=little +AT91C_SPI0_TNPR.name="AT91C_SPI0_TNPR" +AT91C_SPI0_TNPR.description="Transmit Next Pointer Register" +AT91C_SPI0_TNPR.helpkey="Transmit Next Pointer Register" +AT91C_SPI0_TNPR.access=memorymapped +AT91C_SPI0_TNPR.address=0xFFFE0118 +AT91C_SPI0_TNPR.width=32 +AT91C_SPI0_TNPR.byteEndian=little +# ========== Register definition for SPI0 peripheral ========== +AT91C_SPI0_IER.name="AT91C_SPI0_IER" +AT91C_SPI0_IER.description="Interrupt Enable Register" +AT91C_SPI0_IER.helpkey="Interrupt Enable Register" +AT91C_SPI0_IER.access=memorymapped +AT91C_SPI0_IER.address=0xFFFE0014 +AT91C_SPI0_IER.width=32 +AT91C_SPI0_IER.byteEndian=little +AT91C_SPI0_IER.type=enum +AT91C_SPI0_IER.enum.0.name=*** Write only *** +AT91C_SPI0_IER.enum.1.name=Error +AT91C_SPI0_SR.name="AT91C_SPI0_SR" +AT91C_SPI0_SR.description="Status Register" +AT91C_SPI0_SR.helpkey="Status Register" +AT91C_SPI0_SR.access=memorymapped +AT91C_SPI0_SR.address=0xFFFE0010 +AT91C_SPI0_SR.width=32 +AT91C_SPI0_SR.byteEndian=little +AT91C_SPI0_SR.permission.write=none +AT91C_SPI0_IDR.name="AT91C_SPI0_IDR" +AT91C_SPI0_IDR.description="Interrupt Disable Register" +AT91C_SPI0_IDR.helpkey="Interrupt Disable Register" +AT91C_SPI0_IDR.access=memorymapped +AT91C_SPI0_IDR.address=0xFFFE0018 +AT91C_SPI0_IDR.width=32 +AT91C_SPI0_IDR.byteEndian=little +AT91C_SPI0_IDR.type=enum +AT91C_SPI0_IDR.enum.0.name=*** Write only *** +AT91C_SPI0_IDR.enum.1.name=Error +AT91C_SPI0_CR.name="AT91C_SPI0_CR" +AT91C_SPI0_CR.description="Control Register" +AT91C_SPI0_CR.helpkey="Control Register" +AT91C_SPI0_CR.access=memorymapped +AT91C_SPI0_CR.address=0xFFFE0000 +AT91C_SPI0_CR.width=32 +AT91C_SPI0_CR.byteEndian=little +AT91C_SPI0_CR.permission.write=none +AT91C_SPI0_MR.name="AT91C_SPI0_MR" +AT91C_SPI0_MR.description="Mode Register" +AT91C_SPI0_MR.helpkey="Mode Register" +AT91C_SPI0_MR.access=memorymapped +AT91C_SPI0_MR.address=0xFFFE0004 +AT91C_SPI0_MR.width=32 +AT91C_SPI0_MR.byteEndian=little +AT91C_SPI0_IMR.name="AT91C_SPI0_IMR" +AT91C_SPI0_IMR.description="Interrupt Mask Register" +AT91C_SPI0_IMR.helpkey="Interrupt Mask Register" +AT91C_SPI0_IMR.access=memorymapped +AT91C_SPI0_IMR.address=0xFFFE001C +AT91C_SPI0_IMR.width=32 +AT91C_SPI0_IMR.byteEndian=little +AT91C_SPI0_IMR.permission.write=none +AT91C_SPI0_TDR.name="AT91C_SPI0_TDR" +AT91C_SPI0_TDR.description="Transmit Data Register" +AT91C_SPI0_TDR.helpkey="Transmit Data Register" +AT91C_SPI0_TDR.access=memorymapped +AT91C_SPI0_TDR.address=0xFFFE000C +AT91C_SPI0_TDR.width=32 +AT91C_SPI0_TDR.byteEndian=little +AT91C_SPI0_TDR.type=enum +AT91C_SPI0_TDR.enum.0.name=*** Write only *** +AT91C_SPI0_TDR.enum.1.name=Error +AT91C_SPI0_RDR.name="AT91C_SPI0_RDR" +AT91C_SPI0_RDR.description="Receive Data Register" +AT91C_SPI0_RDR.helpkey="Receive Data Register" +AT91C_SPI0_RDR.access=memorymapped +AT91C_SPI0_RDR.address=0xFFFE0008 +AT91C_SPI0_RDR.width=32 +AT91C_SPI0_RDR.byteEndian=little +AT91C_SPI0_RDR.permission.write=none +AT91C_SPI0_CSR.name="AT91C_SPI0_CSR" +AT91C_SPI0_CSR.description="Chip Select Register" +AT91C_SPI0_CSR.helpkey="Chip Select Register" +AT91C_SPI0_CSR.access=memorymapped +AT91C_SPI0_CSR.address=0xFFFE0030 +AT91C_SPI0_CSR.width=32 +AT91C_SPI0_CSR.byteEndian=little +# ========== Register definition for PDC_US1 peripheral ========== +AT91C_US1_RNCR.name="AT91C_US1_RNCR" +AT91C_US1_RNCR.description="Receive Next Counter Register" +AT91C_US1_RNCR.helpkey="Receive Next Counter Register" +AT91C_US1_RNCR.access=memorymapped +AT91C_US1_RNCR.address=0xFFFC4114 +AT91C_US1_RNCR.width=32 +AT91C_US1_RNCR.byteEndian=little +AT91C_US1_PTCR.name="AT91C_US1_PTCR" +AT91C_US1_PTCR.description="PDC Transfer Control Register" +AT91C_US1_PTCR.helpkey="PDC Transfer Control Register" +AT91C_US1_PTCR.access=memorymapped +AT91C_US1_PTCR.address=0xFFFC4120 +AT91C_US1_PTCR.width=32 +AT91C_US1_PTCR.byteEndian=little +AT91C_US1_PTCR.type=enum +AT91C_US1_PTCR.enum.0.name=*** Write only *** +AT91C_US1_PTCR.enum.1.name=Error +AT91C_US1_TCR.name="AT91C_US1_TCR" +AT91C_US1_TCR.description="Transmit Counter Register" +AT91C_US1_TCR.helpkey="Transmit Counter Register" +AT91C_US1_TCR.access=memorymapped +AT91C_US1_TCR.address=0xFFFC410C +AT91C_US1_TCR.width=32 +AT91C_US1_TCR.byteEndian=little +AT91C_US1_PTSR.name="AT91C_US1_PTSR" +AT91C_US1_PTSR.description="PDC Transfer Status Register" +AT91C_US1_PTSR.helpkey="PDC Transfer Status Register" +AT91C_US1_PTSR.access=memorymapped +AT91C_US1_PTSR.address=0xFFFC4124 +AT91C_US1_PTSR.width=32 +AT91C_US1_PTSR.byteEndian=little +AT91C_US1_PTSR.permission.write=none +AT91C_US1_TNPR.name="AT91C_US1_TNPR" +AT91C_US1_TNPR.description="Transmit Next Pointer Register" +AT91C_US1_TNPR.helpkey="Transmit Next Pointer Register" +AT91C_US1_TNPR.access=memorymapped +AT91C_US1_TNPR.address=0xFFFC4118 +AT91C_US1_TNPR.width=32 +AT91C_US1_TNPR.byteEndian=little +AT91C_US1_RCR.name="AT91C_US1_RCR" +AT91C_US1_RCR.description="Receive Counter Register" +AT91C_US1_RCR.helpkey="Receive Counter Register" +AT91C_US1_RCR.access=memorymapped +AT91C_US1_RCR.address=0xFFFC4104 +AT91C_US1_RCR.width=32 +AT91C_US1_RCR.byteEndian=little +AT91C_US1_RNPR.name="AT91C_US1_RNPR" +AT91C_US1_RNPR.description="Receive Next Pointer Register" +AT91C_US1_RNPR.helpkey="Receive Next Pointer Register" +AT91C_US1_RNPR.access=memorymapped +AT91C_US1_RNPR.address=0xFFFC4110 +AT91C_US1_RNPR.width=32 +AT91C_US1_RNPR.byteEndian=little +AT91C_US1_RPR.name="AT91C_US1_RPR" +AT91C_US1_RPR.description="Receive Pointer Register" +AT91C_US1_RPR.helpkey="Receive Pointer Register" +AT91C_US1_RPR.access=memorymapped +AT91C_US1_RPR.address=0xFFFC4100 +AT91C_US1_RPR.width=32 +AT91C_US1_RPR.byteEndian=little +AT91C_US1_TNCR.name="AT91C_US1_TNCR" +AT91C_US1_TNCR.description="Transmit Next Counter Register" +AT91C_US1_TNCR.helpkey="Transmit Next Counter Register" +AT91C_US1_TNCR.access=memorymapped +AT91C_US1_TNCR.address=0xFFFC411C +AT91C_US1_TNCR.width=32 +AT91C_US1_TNCR.byteEndian=little +AT91C_US1_TPR.name="AT91C_US1_TPR" +AT91C_US1_TPR.description="Transmit Pointer Register" +AT91C_US1_TPR.helpkey="Transmit Pointer Register" +AT91C_US1_TPR.access=memorymapped +AT91C_US1_TPR.address=0xFFFC4108 +AT91C_US1_TPR.width=32 +AT91C_US1_TPR.byteEndian=little +# ========== Register definition for US1 peripheral ========== +AT91C_US1_IF.name="AT91C_US1_IF" +AT91C_US1_IF.description="IRDA_FILTER Register" +AT91C_US1_IF.helpkey="IRDA_FILTER Register" +AT91C_US1_IF.access=memorymapped +AT91C_US1_IF.address=0xFFFC404C +AT91C_US1_IF.width=32 +AT91C_US1_IF.byteEndian=little +AT91C_US1_NER.name="AT91C_US1_NER" +AT91C_US1_NER.description="Nb Errors Register" +AT91C_US1_NER.helpkey="Nb Errors Register" +AT91C_US1_NER.access=memorymapped +AT91C_US1_NER.address=0xFFFC4044 +AT91C_US1_NER.width=32 +AT91C_US1_NER.byteEndian=little +AT91C_US1_NER.permission.write=none +AT91C_US1_RTOR.name="AT91C_US1_RTOR" +AT91C_US1_RTOR.description="Receiver Time-out Register" +AT91C_US1_RTOR.helpkey="Receiver Time-out Register" +AT91C_US1_RTOR.access=memorymapped +AT91C_US1_RTOR.address=0xFFFC4024 +AT91C_US1_RTOR.width=32 +AT91C_US1_RTOR.byteEndian=little +AT91C_US1_CSR.name="AT91C_US1_CSR" +AT91C_US1_CSR.description="Channel Status Register" +AT91C_US1_CSR.helpkey="Channel Status Register" +AT91C_US1_CSR.access=memorymapped +AT91C_US1_CSR.address=0xFFFC4014 +AT91C_US1_CSR.width=32 +AT91C_US1_CSR.byteEndian=little +AT91C_US1_CSR.permission.write=none +AT91C_US1_IDR.name="AT91C_US1_IDR" +AT91C_US1_IDR.description="Interrupt Disable Register" +AT91C_US1_IDR.helpkey="Interrupt Disable Register" +AT91C_US1_IDR.access=memorymapped +AT91C_US1_IDR.address=0xFFFC400C +AT91C_US1_IDR.width=32 +AT91C_US1_IDR.byteEndian=little +AT91C_US1_IDR.type=enum +AT91C_US1_IDR.enum.0.name=*** Write only *** +AT91C_US1_IDR.enum.1.name=Error +AT91C_US1_IER.name="AT91C_US1_IER" +AT91C_US1_IER.description="Interrupt Enable Register" +AT91C_US1_IER.helpkey="Interrupt Enable Register" +AT91C_US1_IER.access=memorymapped +AT91C_US1_IER.address=0xFFFC4008 +AT91C_US1_IER.width=32 +AT91C_US1_IER.byteEndian=little +AT91C_US1_IER.type=enum +AT91C_US1_IER.enum.0.name=*** Write only *** +AT91C_US1_IER.enum.1.name=Error +AT91C_US1_THR.name="AT91C_US1_THR" +AT91C_US1_THR.description="Transmitter Holding Register" +AT91C_US1_THR.helpkey="Transmitter Holding Register" +AT91C_US1_THR.access=memorymapped +AT91C_US1_THR.address=0xFFFC401C +AT91C_US1_THR.width=32 +AT91C_US1_THR.byteEndian=little +AT91C_US1_THR.type=enum +AT91C_US1_THR.enum.0.name=*** Write only *** +AT91C_US1_THR.enum.1.name=Error +AT91C_US1_TTGR.name="AT91C_US1_TTGR" +AT91C_US1_TTGR.description="Transmitter Time-guard Register" +AT91C_US1_TTGR.helpkey="Transmitter Time-guard Register" +AT91C_US1_TTGR.access=memorymapped +AT91C_US1_TTGR.address=0xFFFC4028 +AT91C_US1_TTGR.width=32 +AT91C_US1_TTGR.byteEndian=little +AT91C_US1_RHR.name="AT91C_US1_RHR" +AT91C_US1_RHR.description="Receiver Holding Register" +AT91C_US1_RHR.helpkey="Receiver Holding Register" +AT91C_US1_RHR.access=memorymapped +AT91C_US1_RHR.address=0xFFFC4018 +AT91C_US1_RHR.width=32 +AT91C_US1_RHR.byteEndian=little +AT91C_US1_RHR.permission.write=none +AT91C_US1_BRGR.name="AT91C_US1_BRGR" +AT91C_US1_BRGR.description="Baud Rate Generator Register" +AT91C_US1_BRGR.helpkey="Baud Rate Generator Register" +AT91C_US1_BRGR.access=memorymapped +AT91C_US1_BRGR.address=0xFFFC4020 +AT91C_US1_BRGR.width=32 +AT91C_US1_BRGR.byteEndian=little +AT91C_US1_IMR.name="AT91C_US1_IMR" +AT91C_US1_IMR.description="Interrupt Mask Register" +AT91C_US1_IMR.helpkey="Interrupt Mask Register" +AT91C_US1_IMR.access=memorymapped +AT91C_US1_IMR.address=0xFFFC4010 +AT91C_US1_IMR.width=32 +AT91C_US1_IMR.byteEndian=little +AT91C_US1_IMR.permission.write=none +AT91C_US1_FIDI.name="AT91C_US1_FIDI" +AT91C_US1_FIDI.description="FI_DI_Ratio Register" +AT91C_US1_FIDI.helpkey="FI_DI_Ratio Register" +AT91C_US1_FIDI.access=memorymapped +AT91C_US1_FIDI.address=0xFFFC4040 +AT91C_US1_FIDI.width=32 +AT91C_US1_FIDI.byteEndian=little +AT91C_US1_CR.name="AT91C_US1_CR" +AT91C_US1_CR.description="Control Register" +AT91C_US1_CR.helpkey="Control Register" +AT91C_US1_CR.access=memorymapped +AT91C_US1_CR.address=0xFFFC4000 +AT91C_US1_CR.width=32 +AT91C_US1_CR.byteEndian=little +AT91C_US1_CR.type=enum +AT91C_US1_CR.enum.0.name=*** Write only *** +AT91C_US1_CR.enum.1.name=Error +AT91C_US1_MR.name="AT91C_US1_MR" +AT91C_US1_MR.description="Mode Register" +AT91C_US1_MR.helpkey="Mode Register" +AT91C_US1_MR.access=memorymapped +AT91C_US1_MR.address=0xFFFC4004 +AT91C_US1_MR.width=32 +AT91C_US1_MR.byteEndian=little +# ========== Register definition for PDC_US0 peripheral ========== +AT91C_US0_TNPR.name="AT91C_US0_TNPR" +AT91C_US0_TNPR.description="Transmit Next Pointer Register" +AT91C_US0_TNPR.helpkey="Transmit Next Pointer Register" +AT91C_US0_TNPR.access=memorymapped +AT91C_US0_TNPR.address=0xFFFC0118 +AT91C_US0_TNPR.width=32 +AT91C_US0_TNPR.byteEndian=little +AT91C_US0_RNPR.name="AT91C_US0_RNPR" +AT91C_US0_RNPR.description="Receive Next Pointer Register" +AT91C_US0_RNPR.helpkey="Receive Next Pointer Register" +AT91C_US0_RNPR.access=memorymapped +AT91C_US0_RNPR.address=0xFFFC0110 +AT91C_US0_RNPR.width=32 +AT91C_US0_RNPR.byteEndian=little +AT91C_US0_TCR.name="AT91C_US0_TCR" +AT91C_US0_TCR.description="Transmit Counter Register" +AT91C_US0_TCR.helpkey="Transmit Counter Register" +AT91C_US0_TCR.access=memorymapped +AT91C_US0_TCR.address=0xFFFC010C +AT91C_US0_TCR.width=32 +AT91C_US0_TCR.byteEndian=little +AT91C_US0_PTCR.name="AT91C_US0_PTCR" +AT91C_US0_PTCR.description="PDC Transfer Control Register" +AT91C_US0_PTCR.helpkey="PDC Transfer Control Register" +AT91C_US0_PTCR.access=memorymapped +AT91C_US0_PTCR.address=0xFFFC0120 +AT91C_US0_PTCR.width=32 +AT91C_US0_PTCR.byteEndian=little +AT91C_US0_PTCR.type=enum +AT91C_US0_PTCR.enum.0.name=*** Write only *** +AT91C_US0_PTCR.enum.1.name=Error +AT91C_US0_PTSR.name="AT91C_US0_PTSR" +AT91C_US0_PTSR.description="PDC Transfer Status Register" +AT91C_US0_PTSR.helpkey="PDC Transfer Status Register" +AT91C_US0_PTSR.access=memorymapped +AT91C_US0_PTSR.address=0xFFFC0124 +AT91C_US0_PTSR.width=32 +AT91C_US0_PTSR.byteEndian=little +AT91C_US0_PTSR.permission.write=none +AT91C_US0_TNCR.name="AT91C_US0_TNCR" +AT91C_US0_TNCR.description="Transmit Next Counter Register" +AT91C_US0_TNCR.helpkey="Transmit Next Counter Register" +AT91C_US0_TNCR.access=memorymapped +AT91C_US0_TNCR.address=0xFFFC011C +AT91C_US0_TNCR.width=32 +AT91C_US0_TNCR.byteEndian=little +AT91C_US0_TPR.name="AT91C_US0_TPR" +AT91C_US0_TPR.description="Transmit Pointer Register" +AT91C_US0_TPR.helpkey="Transmit Pointer Register" +AT91C_US0_TPR.access=memorymapped +AT91C_US0_TPR.address=0xFFFC0108 +AT91C_US0_TPR.width=32 +AT91C_US0_TPR.byteEndian=little +AT91C_US0_RCR.name="AT91C_US0_RCR" +AT91C_US0_RCR.description="Receive Counter Register" +AT91C_US0_RCR.helpkey="Receive Counter Register" +AT91C_US0_RCR.access=memorymapped +AT91C_US0_RCR.address=0xFFFC0104 +AT91C_US0_RCR.width=32 +AT91C_US0_RCR.byteEndian=little +AT91C_US0_RPR.name="AT91C_US0_RPR" +AT91C_US0_RPR.description="Receive Pointer Register" +AT91C_US0_RPR.helpkey="Receive Pointer Register" +AT91C_US0_RPR.access=memorymapped +AT91C_US0_RPR.address=0xFFFC0100 +AT91C_US0_RPR.width=32 +AT91C_US0_RPR.byteEndian=little +AT91C_US0_RNCR.name="AT91C_US0_RNCR" +AT91C_US0_RNCR.description="Receive Next Counter Register" +AT91C_US0_RNCR.helpkey="Receive Next Counter Register" +AT91C_US0_RNCR.access=memorymapped +AT91C_US0_RNCR.address=0xFFFC0114 +AT91C_US0_RNCR.width=32 +AT91C_US0_RNCR.byteEndian=little +# ========== Register definition for US0 peripheral ========== +AT91C_US0_BRGR.name="AT91C_US0_BRGR" +AT91C_US0_BRGR.description="Baud Rate Generator Register" +AT91C_US0_BRGR.helpkey="Baud Rate Generator Register" +AT91C_US0_BRGR.access=memorymapped +AT91C_US0_BRGR.address=0xFFFC0020 +AT91C_US0_BRGR.width=32 +AT91C_US0_BRGR.byteEndian=little +AT91C_US0_NER.name="AT91C_US0_NER" +AT91C_US0_NER.description="Nb Errors Register" +AT91C_US0_NER.helpkey="Nb Errors Register" +AT91C_US0_NER.access=memorymapped +AT91C_US0_NER.address=0xFFFC0044 +AT91C_US0_NER.width=32 +AT91C_US0_NER.byteEndian=little +AT91C_US0_NER.permission.write=none +AT91C_US0_CR.name="AT91C_US0_CR" +AT91C_US0_CR.description="Control Register" +AT91C_US0_CR.helpkey="Control Register" +AT91C_US0_CR.access=memorymapped +AT91C_US0_CR.address=0xFFFC0000 +AT91C_US0_CR.width=32 +AT91C_US0_CR.byteEndian=little +AT91C_US0_CR.type=enum +AT91C_US0_CR.enum.0.name=*** Write only *** +AT91C_US0_CR.enum.1.name=Error +AT91C_US0_IMR.name="AT91C_US0_IMR" +AT91C_US0_IMR.description="Interrupt Mask Register" +AT91C_US0_IMR.helpkey="Interrupt Mask Register" +AT91C_US0_IMR.access=memorymapped +AT91C_US0_IMR.address=0xFFFC0010 +AT91C_US0_IMR.width=32 +AT91C_US0_IMR.byteEndian=little +AT91C_US0_IMR.permission.write=none +AT91C_US0_FIDI.name="AT91C_US0_FIDI" +AT91C_US0_FIDI.description="FI_DI_Ratio Register" +AT91C_US0_FIDI.helpkey="FI_DI_Ratio Register" +AT91C_US0_FIDI.access=memorymapped +AT91C_US0_FIDI.address=0xFFFC0040 +AT91C_US0_FIDI.width=32 +AT91C_US0_FIDI.byteEndian=little +AT91C_US0_TTGR.name="AT91C_US0_TTGR" +AT91C_US0_TTGR.description="Transmitter Time-guard Register" +AT91C_US0_TTGR.helpkey="Transmitter Time-guard Register" +AT91C_US0_TTGR.access=memorymapped +AT91C_US0_TTGR.address=0xFFFC0028 +AT91C_US0_TTGR.width=32 +AT91C_US0_TTGR.byteEndian=little +AT91C_US0_MR.name="AT91C_US0_MR" +AT91C_US0_MR.description="Mode Register" +AT91C_US0_MR.helpkey="Mode Register" +AT91C_US0_MR.access=memorymapped +AT91C_US0_MR.address=0xFFFC0004 +AT91C_US0_MR.width=32 +AT91C_US0_MR.byteEndian=little +AT91C_US0_RTOR.name="AT91C_US0_RTOR" +AT91C_US0_RTOR.description="Receiver Time-out Register" +AT91C_US0_RTOR.helpkey="Receiver Time-out Register" +AT91C_US0_RTOR.access=memorymapped +AT91C_US0_RTOR.address=0xFFFC0024 +AT91C_US0_RTOR.width=32 +AT91C_US0_RTOR.byteEndian=little +AT91C_US0_CSR.name="AT91C_US0_CSR" +AT91C_US0_CSR.description="Channel Status Register" +AT91C_US0_CSR.helpkey="Channel Status Register" +AT91C_US0_CSR.access=memorymapped +AT91C_US0_CSR.address=0xFFFC0014 +AT91C_US0_CSR.width=32 +AT91C_US0_CSR.byteEndian=little +AT91C_US0_CSR.permission.write=none +AT91C_US0_RHR.name="AT91C_US0_RHR" +AT91C_US0_RHR.description="Receiver Holding Register" +AT91C_US0_RHR.helpkey="Receiver Holding Register" +AT91C_US0_RHR.access=memorymapped +AT91C_US0_RHR.address=0xFFFC0018 +AT91C_US0_RHR.width=32 +AT91C_US0_RHR.byteEndian=little +AT91C_US0_RHR.permission.write=none +AT91C_US0_IDR.name="AT91C_US0_IDR" +AT91C_US0_IDR.description="Interrupt Disable Register" +AT91C_US0_IDR.helpkey="Interrupt Disable Register" +AT91C_US0_IDR.access=memorymapped +AT91C_US0_IDR.address=0xFFFC000C +AT91C_US0_IDR.width=32 +AT91C_US0_IDR.byteEndian=little +AT91C_US0_IDR.type=enum +AT91C_US0_IDR.enum.0.name=*** Write only *** +AT91C_US0_IDR.enum.1.name=Error +AT91C_US0_THR.name="AT91C_US0_THR" +AT91C_US0_THR.description="Transmitter Holding Register" +AT91C_US0_THR.helpkey="Transmitter Holding Register" +AT91C_US0_THR.access=memorymapped +AT91C_US0_THR.address=0xFFFC001C +AT91C_US0_THR.width=32 +AT91C_US0_THR.byteEndian=little +AT91C_US0_THR.type=enum +AT91C_US0_THR.enum.0.name=*** Write only *** +AT91C_US0_THR.enum.1.name=Error +AT91C_US0_IF.name="AT91C_US0_IF" +AT91C_US0_IF.description="IRDA_FILTER Register" +AT91C_US0_IF.helpkey="IRDA_FILTER Register" +AT91C_US0_IF.access=memorymapped +AT91C_US0_IF.address=0xFFFC004C +AT91C_US0_IF.width=32 +AT91C_US0_IF.byteEndian=little +AT91C_US0_IER.name="AT91C_US0_IER" +AT91C_US0_IER.description="Interrupt Enable Register" +AT91C_US0_IER.helpkey="Interrupt Enable Register" +AT91C_US0_IER.access=memorymapped +AT91C_US0_IER.address=0xFFFC0008 +AT91C_US0_IER.width=32 +AT91C_US0_IER.byteEndian=little +AT91C_US0_IER.type=enum +AT91C_US0_IER.enum.0.name=*** Write only *** +AT91C_US0_IER.enum.1.name=Error +# ========== Register definition for PDC_SSC peripheral ========== +AT91C_SSC_TNCR.name="AT91C_SSC_TNCR" +AT91C_SSC_TNCR.description="Transmit Next Counter Register" +AT91C_SSC_TNCR.helpkey="Transmit Next Counter Register" +AT91C_SSC_TNCR.access=memorymapped +AT91C_SSC_TNCR.address=0xFFFD411C +AT91C_SSC_TNCR.width=32 +AT91C_SSC_TNCR.byteEndian=little +AT91C_SSC_RPR.name="AT91C_SSC_RPR" +AT91C_SSC_RPR.description="Receive Pointer Register" +AT91C_SSC_RPR.helpkey="Receive Pointer Register" +AT91C_SSC_RPR.access=memorymapped +AT91C_SSC_RPR.address=0xFFFD4100 +AT91C_SSC_RPR.width=32 +AT91C_SSC_RPR.byteEndian=little +AT91C_SSC_RNCR.name="AT91C_SSC_RNCR" +AT91C_SSC_RNCR.description="Receive Next Counter Register" +AT91C_SSC_RNCR.helpkey="Receive Next Counter Register" +AT91C_SSC_RNCR.access=memorymapped +AT91C_SSC_RNCR.address=0xFFFD4114 +AT91C_SSC_RNCR.width=32 +AT91C_SSC_RNCR.byteEndian=little +AT91C_SSC_TPR.name="AT91C_SSC_TPR" +AT91C_SSC_TPR.description="Transmit Pointer Register" +AT91C_SSC_TPR.helpkey="Transmit Pointer Register" +AT91C_SSC_TPR.access=memorymapped +AT91C_SSC_TPR.address=0xFFFD4108 +AT91C_SSC_TPR.width=32 +AT91C_SSC_TPR.byteEndian=little +AT91C_SSC_PTCR.name="AT91C_SSC_PTCR" +AT91C_SSC_PTCR.description="PDC Transfer Control Register" +AT91C_SSC_PTCR.helpkey="PDC Transfer Control Register" +AT91C_SSC_PTCR.access=memorymapped +AT91C_SSC_PTCR.address=0xFFFD4120 +AT91C_SSC_PTCR.width=32 +AT91C_SSC_PTCR.byteEndian=little +AT91C_SSC_PTCR.type=enum +AT91C_SSC_PTCR.enum.0.name=*** Write only *** +AT91C_SSC_PTCR.enum.1.name=Error +AT91C_SSC_TCR.name="AT91C_SSC_TCR" +AT91C_SSC_TCR.description="Transmit Counter Register" +AT91C_SSC_TCR.helpkey="Transmit Counter Register" +AT91C_SSC_TCR.access=memorymapped +AT91C_SSC_TCR.address=0xFFFD410C +AT91C_SSC_TCR.width=32 +AT91C_SSC_TCR.byteEndian=little +AT91C_SSC_RCR.name="AT91C_SSC_RCR" +AT91C_SSC_RCR.description="Receive Counter Register" +AT91C_SSC_RCR.helpkey="Receive Counter Register" +AT91C_SSC_RCR.access=memorymapped +AT91C_SSC_RCR.address=0xFFFD4104 +AT91C_SSC_RCR.width=32 +AT91C_SSC_RCR.byteEndian=little +AT91C_SSC_RNPR.name="AT91C_SSC_RNPR" +AT91C_SSC_RNPR.description="Receive Next Pointer Register" +AT91C_SSC_RNPR.helpkey="Receive Next Pointer Register" +AT91C_SSC_RNPR.access=memorymapped +AT91C_SSC_RNPR.address=0xFFFD4110 +AT91C_SSC_RNPR.width=32 +AT91C_SSC_RNPR.byteEndian=little +AT91C_SSC_TNPR.name="AT91C_SSC_TNPR" +AT91C_SSC_TNPR.description="Transmit Next Pointer Register" +AT91C_SSC_TNPR.helpkey="Transmit Next Pointer Register" +AT91C_SSC_TNPR.access=memorymapped +AT91C_SSC_TNPR.address=0xFFFD4118 +AT91C_SSC_TNPR.width=32 +AT91C_SSC_TNPR.byteEndian=little +AT91C_SSC_PTSR.name="AT91C_SSC_PTSR" +AT91C_SSC_PTSR.description="PDC Transfer Status Register" +AT91C_SSC_PTSR.helpkey="PDC Transfer Status Register" +AT91C_SSC_PTSR.access=memorymapped +AT91C_SSC_PTSR.address=0xFFFD4124 +AT91C_SSC_PTSR.width=32 +AT91C_SSC_PTSR.byteEndian=little +AT91C_SSC_PTSR.permission.write=none +# ========== Register definition for SSC peripheral ========== +AT91C_SSC_RHR.name="AT91C_SSC_RHR" +AT91C_SSC_RHR.description="Receive Holding Register" +AT91C_SSC_RHR.helpkey="Receive Holding Register" +AT91C_SSC_RHR.access=memorymapped +AT91C_SSC_RHR.address=0xFFFD4020 +AT91C_SSC_RHR.width=32 +AT91C_SSC_RHR.byteEndian=little +AT91C_SSC_RHR.permission.write=none +AT91C_SSC_RSHR.name="AT91C_SSC_RSHR" +AT91C_SSC_RSHR.description="Receive Sync Holding Register" +AT91C_SSC_RSHR.helpkey="Receive Sync Holding Register" +AT91C_SSC_RSHR.access=memorymapped +AT91C_SSC_RSHR.address=0xFFFD4030 +AT91C_SSC_RSHR.width=32 +AT91C_SSC_RSHR.byteEndian=little +AT91C_SSC_RSHR.permission.write=none +AT91C_SSC_TFMR.name="AT91C_SSC_TFMR" +AT91C_SSC_TFMR.description="Transmit Frame Mode Register" +AT91C_SSC_TFMR.helpkey="Transmit Frame Mode Register" +AT91C_SSC_TFMR.access=memorymapped +AT91C_SSC_TFMR.address=0xFFFD401C +AT91C_SSC_TFMR.width=32 +AT91C_SSC_TFMR.byteEndian=little +AT91C_SSC_IDR.name="AT91C_SSC_IDR" +AT91C_SSC_IDR.description="Interrupt Disable Register" +AT91C_SSC_IDR.helpkey="Interrupt Disable Register" +AT91C_SSC_IDR.access=memorymapped +AT91C_SSC_IDR.address=0xFFFD4048 +AT91C_SSC_IDR.width=32 +AT91C_SSC_IDR.byteEndian=little +AT91C_SSC_IDR.type=enum +AT91C_SSC_IDR.enum.0.name=*** Write only *** +AT91C_SSC_IDR.enum.1.name=Error +AT91C_SSC_THR.name="AT91C_SSC_THR" +AT91C_SSC_THR.description="Transmit Holding Register" +AT91C_SSC_THR.helpkey="Transmit Holding Register" +AT91C_SSC_THR.access=memorymapped +AT91C_SSC_THR.address=0xFFFD4024 +AT91C_SSC_THR.width=32 +AT91C_SSC_THR.byteEndian=little +AT91C_SSC_THR.type=enum +AT91C_SSC_THR.enum.0.name=*** Write only *** +AT91C_SSC_THR.enum.1.name=Error +AT91C_SSC_RCMR.name="AT91C_SSC_RCMR" +AT91C_SSC_RCMR.description="Receive Clock ModeRegister" +AT91C_SSC_RCMR.helpkey="Receive Clock ModeRegister" +AT91C_SSC_RCMR.access=memorymapped +AT91C_SSC_RCMR.address=0xFFFD4010 +AT91C_SSC_RCMR.width=32 +AT91C_SSC_RCMR.byteEndian=little +AT91C_SSC_IER.name="AT91C_SSC_IER" +AT91C_SSC_IER.description="Interrupt Enable Register" +AT91C_SSC_IER.helpkey="Interrupt Enable Register" +AT91C_SSC_IER.access=memorymapped +AT91C_SSC_IER.address=0xFFFD4044 +AT91C_SSC_IER.width=32 +AT91C_SSC_IER.byteEndian=little +AT91C_SSC_IER.type=enum +AT91C_SSC_IER.enum.0.name=*** Write only *** +AT91C_SSC_IER.enum.1.name=Error +AT91C_SSC_TSHR.name="AT91C_SSC_TSHR" +AT91C_SSC_TSHR.description="Transmit Sync Holding Register" +AT91C_SSC_TSHR.helpkey="Transmit Sync Holding Register" +AT91C_SSC_TSHR.access=memorymapped +AT91C_SSC_TSHR.address=0xFFFD4034 +AT91C_SSC_TSHR.width=32 +AT91C_SSC_TSHR.byteEndian=little +AT91C_SSC_SR.name="AT91C_SSC_SR" +AT91C_SSC_SR.description="Status Register" +AT91C_SSC_SR.helpkey="Status Register" +AT91C_SSC_SR.access=memorymapped +AT91C_SSC_SR.address=0xFFFD4040 +AT91C_SSC_SR.width=32 +AT91C_SSC_SR.byteEndian=little +AT91C_SSC_SR.permission.write=none +AT91C_SSC_CMR.name="AT91C_SSC_CMR" +AT91C_SSC_CMR.description="Clock Mode Register" +AT91C_SSC_CMR.helpkey="Clock Mode Register" +AT91C_SSC_CMR.access=memorymapped +AT91C_SSC_CMR.address=0xFFFD4004 +AT91C_SSC_CMR.width=32 +AT91C_SSC_CMR.byteEndian=little +AT91C_SSC_TCMR.name="AT91C_SSC_TCMR" +AT91C_SSC_TCMR.description="Transmit Clock Mode Register" +AT91C_SSC_TCMR.helpkey="Transmit Clock Mode Register" +AT91C_SSC_TCMR.access=memorymapped +AT91C_SSC_TCMR.address=0xFFFD4018 +AT91C_SSC_TCMR.width=32 +AT91C_SSC_TCMR.byteEndian=little +AT91C_SSC_CR.name="AT91C_SSC_CR" +AT91C_SSC_CR.description="Control Register" +AT91C_SSC_CR.helpkey="Control Register" +AT91C_SSC_CR.access=memorymapped +AT91C_SSC_CR.address=0xFFFD4000 +AT91C_SSC_CR.width=32 +AT91C_SSC_CR.byteEndian=little +AT91C_SSC_CR.type=enum +AT91C_SSC_CR.enum.0.name=*** Write only *** +AT91C_SSC_CR.enum.1.name=Error +AT91C_SSC_IMR.name="AT91C_SSC_IMR" +AT91C_SSC_IMR.description="Interrupt Mask Register" +AT91C_SSC_IMR.helpkey="Interrupt Mask Register" +AT91C_SSC_IMR.access=memorymapped +AT91C_SSC_IMR.address=0xFFFD404C +AT91C_SSC_IMR.width=32 +AT91C_SSC_IMR.byteEndian=little +AT91C_SSC_IMR.permission.write=none +AT91C_SSC_RFMR.name="AT91C_SSC_RFMR" +AT91C_SSC_RFMR.description="Receive Frame Mode Register" +AT91C_SSC_RFMR.helpkey="Receive Frame Mode Register" +AT91C_SSC_RFMR.access=memorymapped +AT91C_SSC_RFMR.address=0xFFFD4014 +AT91C_SSC_RFMR.width=32 +AT91C_SSC_RFMR.byteEndian=little +# ========== Register definition for TWI peripheral ========== +AT91C_TWI_IER.name="AT91C_TWI_IER" +AT91C_TWI_IER.description="Interrupt Enable Register" +AT91C_TWI_IER.helpkey="Interrupt Enable Register" +AT91C_TWI_IER.access=memorymapped +AT91C_TWI_IER.address=0xFFFB8024 +AT91C_TWI_IER.width=32 +AT91C_TWI_IER.byteEndian=little +AT91C_TWI_IER.type=enum +AT91C_TWI_IER.enum.0.name=*** Write only *** +AT91C_TWI_IER.enum.1.name=Error +AT91C_TWI_CR.name="AT91C_TWI_CR" +AT91C_TWI_CR.description="Control Register" +AT91C_TWI_CR.helpkey="Control Register" +AT91C_TWI_CR.access=memorymapped +AT91C_TWI_CR.address=0xFFFB8000 +AT91C_TWI_CR.width=32 +AT91C_TWI_CR.byteEndian=little +AT91C_TWI_CR.type=enum +AT91C_TWI_CR.enum.0.name=*** Write only *** +AT91C_TWI_CR.enum.1.name=Error +AT91C_TWI_SR.name="AT91C_TWI_SR" +AT91C_TWI_SR.description="Status Register" +AT91C_TWI_SR.helpkey="Status Register" +AT91C_TWI_SR.access=memorymapped +AT91C_TWI_SR.address=0xFFFB8020 +AT91C_TWI_SR.width=32 +AT91C_TWI_SR.byteEndian=little +AT91C_TWI_SR.permission.write=none +AT91C_TWI_IMR.name="AT91C_TWI_IMR" +AT91C_TWI_IMR.description="Interrupt Mask Register" +AT91C_TWI_IMR.helpkey="Interrupt Mask Register" +AT91C_TWI_IMR.access=memorymapped +AT91C_TWI_IMR.address=0xFFFB802C +AT91C_TWI_IMR.width=32 +AT91C_TWI_IMR.byteEndian=little +AT91C_TWI_IMR.permission.write=none +AT91C_TWI_THR.name="AT91C_TWI_THR" +AT91C_TWI_THR.description="Transmit Holding Register" +AT91C_TWI_THR.helpkey="Transmit Holding Register" +AT91C_TWI_THR.access=memorymapped +AT91C_TWI_THR.address=0xFFFB8034 +AT91C_TWI_THR.width=32 +AT91C_TWI_THR.byteEndian=little +AT91C_TWI_THR.type=enum +AT91C_TWI_THR.enum.0.name=*** Write only *** +AT91C_TWI_THR.enum.1.name=Error +AT91C_TWI_IDR.name="AT91C_TWI_IDR" +AT91C_TWI_IDR.description="Interrupt Disable Register" +AT91C_TWI_IDR.helpkey="Interrupt Disable Register" +AT91C_TWI_IDR.access=memorymapped +AT91C_TWI_IDR.address=0xFFFB8028 +AT91C_TWI_IDR.width=32 +AT91C_TWI_IDR.byteEndian=little +AT91C_TWI_IDR.type=enum +AT91C_TWI_IDR.enum.0.name=*** Write only *** +AT91C_TWI_IDR.enum.1.name=Error +AT91C_TWI_IADR.name="AT91C_TWI_IADR" +AT91C_TWI_IADR.description="Internal Address Register" +AT91C_TWI_IADR.helpkey="Internal Address Register" +AT91C_TWI_IADR.access=memorymapped +AT91C_TWI_IADR.address=0xFFFB800C +AT91C_TWI_IADR.width=32 +AT91C_TWI_IADR.byteEndian=little +AT91C_TWI_MMR.name="AT91C_TWI_MMR" +AT91C_TWI_MMR.description="Master Mode Register" +AT91C_TWI_MMR.helpkey="Master Mode Register" +AT91C_TWI_MMR.access=memorymapped +AT91C_TWI_MMR.address=0xFFFB8004 +AT91C_TWI_MMR.width=32 +AT91C_TWI_MMR.byteEndian=little +AT91C_TWI_CWGR.name="AT91C_TWI_CWGR" +AT91C_TWI_CWGR.description="Clock Waveform Generator Register" +AT91C_TWI_CWGR.helpkey="Clock Waveform Generator Register" +AT91C_TWI_CWGR.access=memorymapped +AT91C_TWI_CWGR.address=0xFFFB8010 +AT91C_TWI_CWGR.width=32 +AT91C_TWI_CWGR.byteEndian=little +AT91C_TWI_RHR.name="AT91C_TWI_RHR" +AT91C_TWI_RHR.description="Receive Holding Register" +AT91C_TWI_RHR.helpkey="Receive Holding Register" +AT91C_TWI_RHR.access=memorymapped +AT91C_TWI_RHR.address=0xFFFB8030 +AT91C_TWI_RHR.width=32 +AT91C_TWI_RHR.byteEndian=little +AT91C_TWI_RHR.permission.write=none +# ========== Register definition for PWMC_CH3 peripheral ========== +AT91C_PWMC_CH3_CUPDR.name="AT91C_PWMC_CH3_CUPDR" +AT91C_PWMC_CH3_CUPDR.description="Channel Update Register" +AT91C_PWMC_CH3_CUPDR.helpkey="Channel Update Register" +AT91C_PWMC_CH3_CUPDR.access=memorymapped +AT91C_PWMC_CH3_CUPDR.address=0xFFFCC270 +AT91C_PWMC_CH3_CUPDR.width=32 +AT91C_PWMC_CH3_CUPDR.byteEndian=little +AT91C_PWMC_CH3_CUPDR.type=enum +AT91C_PWMC_CH3_CUPDR.enum.0.name=*** Write only *** +AT91C_PWMC_CH3_CUPDR.enum.1.name=Error +AT91C_PWMC_CH3_Reserved.name="AT91C_PWMC_CH3_Reserved" +AT91C_PWMC_CH3_Reserved.description="Reserved" +AT91C_PWMC_CH3_Reserved.helpkey="Reserved" +AT91C_PWMC_CH3_Reserved.access=memorymapped +AT91C_PWMC_CH3_Reserved.address=0xFFFCC274 +AT91C_PWMC_CH3_Reserved.width=32 +AT91C_PWMC_CH3_Reserved.byteEndian=little +AT91C_PWMC_CH3_Reserved.type=enum +AT91C_PWMC_CH3_Reserved.enum.0.name=*** Write only *** +AT91C_PWMC_CH3_Reserved.enum.1.name=Error +AT91C_PWMC_CH3_CPRDR.name="AT91C_PWMC_CH3_CPRDR" +AT91C_PWMC_CH3_CPRDR.description="Channel Period Register" +AT91C_PWMC_CH3_CPRDR.helpkey="Channel Period Register" +AT91C_PWMC_CH3_CPRDR.access=memorymapped +AT91C_PWMC_CH3_CPRDR.address=0xFFFCC268 +AT91C_PWMC_CH3_CPRDR.width=32 +AT91C_PWMC_CH3_CPRDR.byteEndian=little +AT91C_PWMC_CH3_CDTYR.name="AT91C_PWMC_CH3_CDTYR" +AT91C_PWMC_CH3_CDTYR.description="Channel Duty Cycle Register" +AT91C_PWMC_CH3_CDTYR.helpkey="Channel Duty Cycle Register" +AT91C_PWMC_CH3_CDTYR.access=memorymapped +AT91C_PWMC_CH3_CDTYR.address=0xFFFCC264 +AT91C_PWMC_CH3_CDTYR.width=32 +AT91C_PWMC_CH3_CDTYR.byteEndian=little +AT91C_PWMC_CH3_CCNTR.name="AT91C_PWMC_CH3_CCNTR" +AT91C_PWMC_CH3_CCNTR.description="Channel Counter Register" +AT91C_PWMC_CH3_CCNTR.helpkey="Channel Counter Register" +AT91C_PWMC_CH3_CCNTR.access=memorymapped +AT91C_PWMC_CH3_CCNTR.address=0xFFFCC26C +AT91C_PWMC_CH3_CCNTR.width=32 +AT91C_PWMC_CH3_CCNTR.byteEndian=little +AT91C_PWMC_CH3_CCNTR.permission.write=none +AT91C_PWMC_CH3_CMR.name="AT91C_PWMC_CH3_CMR" +AT91C_PWMC_CH3_CMR.description="Channel Mode Register" +AT91C_PWMC_CH3_CMR.helpkey="Channel Mode Register" +AT91C_PWMC_CH3_CMR.access=memorymapped +AT91C_PWMC_CH3_CMR.address=0xFFFCC260 +AT91C_PWMC_CH3_CMR.width=32 +AT91C_PWMC_CH3_CMR.byteEndian=little +# ========== Register definition for PWMC_CH2 peripheral ========== +AT91C_PWMC_CH2_Reserved.name="AT91C_PWMC_CH2_Reserved" +AT91C_PWMC_CH2_Reserved.description="Reserved" +AT91C_PWMC_CH2_Reserved.helpkey="Reserved" +AT91C_PWMC_CH2_Reserved.access=memorymapped +AT91C_PWMC_CH2_Reserved.address=0xFFFCC254 +AT91C_PWMC_CH2_Reserved.width=32 +AT91C_PWMC_CH2_Reserved.byteEndian=little +AT91C_PWMC_CH2_Reserved.type=enum +AT91C_PWMC_CH2_Reserved.enum.0.name=*** Write only *** +AT91C_PWMC_CH2_Reserved.enum.1.name=Error +AT91C_PWMC_CH2_CMR.name="AT91C_PWMC_CH2_CMR" +AT91C_PWMC_CH2_CMR.description="Channel Mode Register" +AT91C_PWMC_CH2_CMR.helpkey="Channel Mode Register" +AT91C_PWMC_CH2_CMR.access=memorymapped +AT91C_PWMC_CH2_CMR.address=0xFFFCC240 +AT91C_PWMC_CH2_CMR.width=32 +AT91C_PWMC_CH2_CMR.byteEndian=little +AT91C_PWMC_CH2_CCNTR.name="AT91C_PWMC_CH2_CCNTR" +AT91C_PWMC_CH2_CCNTR.description="Channel Counter Register" +AT91C_PWMC_CH2_CCNTR.helpkey="Channel Counter Register" +AT91C_PWMC_CH2_CCNTR.access=memorymapped +AT91C_PWMC_CH2_CCNTR.address=0xFFFCC24C +AT91C_PWMC_CH2_CCNTR.width=32 +AT91C_PWMC_CH2_CCNTR.byteEndian=little +AT91C_PWMC_CH2_CCNTR.permission.write=none +AT91C_PWMC_CH2_CPRDR.name="AT91C_PWMC_CH2_CPRDR" +AT91C_PWMC_CH2_CPRDR.description="Channel Period Register" +AT91C_PWMC_CH2_CPRDR.helpkey="Channel Period Register" +AT91C_PWMC_CH2_CPRDR.access=memorymapped +AT91C_PWMC_CH2_CPRDR.address=0xFFFCC248 +AT91C_PWMC_CH2_CPRDR.width=32 +AT91C_PWMC_CH2_CPRDR.byteEndian=little +AT91C_PWMC_CH2_CUPDR.name="AT91C_PWMC_CH2_CUPDR" +AT91C_PWMC_CH2_CUPDR.description="Channel Update Register" +AT91C_PWMC_CH2_CUPDR.helpkey="Channel Update Register" +AT91C_PWMC_CH2_CUPDR.access=memorymapped +AT91C_PWMC_CH2_CUPDR.address=0xFFFCC250 +AT91C_PWMC_CH2_CUPDR.width=32 +AT91C_PWMC_CH2_CUPDR.byteEndian=little +AT91C_PWMC_CH2_CUPDR.type=enum +AT91C_PWMC_CH2_CUPDR.enum.0.name=*** Write only *** +AT91C_PWMC_CH2_CUPDR.enum.1.name=Error +AT91C_PWMC_CH2_CDTYR.name="AT91C_PWMC_CH2_CDTYR" +AT91C_PWMC_CH2_CDTYR.description="Channel Duty Cycle Register" +AT91C_PWMC_CH2_CDTYR.helpkey="Channel Duty Cycle Register" +AT91C_PWMC_CH2_CDTYR.access=memorymapped +AT91C_PWMC_CH2_CDTYR.address=0xFFFCC244 +AT91C_PWMC_CH2_CDTYR.width=32 +AT91C_PWMC_CH2_CDTYR.byteEndian=little +# ========== Register definition for PWMC_CH1 peripheral ========== +AT91C_PWMC_CH1_Reserved.name="AT91C_PWMC_CH1_Reserved" +AT91C_PWMC_CH1_Reserved.description="Reserved" +AT91C_PWMC_CH1_Reserved.helpkey="Reserved" +AT91C_PWMC_CH1_Reserved.access=memorymapped +AT91C_PWMC_CH1_Reserved.address=0xFFFCC234 +AT91C_PWMC_CH1_Reserved.width=32 +AT91C_PWMC_CH1_Reserved.byteEndian=little +AT91C_PWMC_CH1_Reserved.type=enum +AT91C_PWMC_CH1_Reserved.enum.0.name=*** Write only *** +AT91C_PWMC_CH1_Reserved.enum.1.name=Error +AT91C_PWMC_CH1_CUPDR.name="AT91C_PWMC_CH1_CUPDR" +AT91C_PWMC_CH1_CUPDR.description="Channel Update Register" +AT91C_PWMC_CH1_CUPDR.helpkey="Channel Update Register" +AT91C_PWMC_CH1_CUPDR.access=memorymapped +AT91C_PWMC_CH1_CUPDR.address=0xFFFCC230 +AT91C_PWMC_CH1_CUPDR.width=32 +AT91C_PWMC_CH1_CUPDR.byteEndian=little +AT91C_PWMC_CH1_CUPDR.type=enum +AT91C_PWMC_CH1_CUPDR.enum.0.name=*** Write only *** +AT91C_PWMC_CH1_CUPDR.enum.1.name=Error +AT91C_PWMC_CH1_CPRDR.name="AT91C_PWMC_CH1_CPRDR" +AT91C_PWMC_CH1_CPRDR.description="Channel Period Register" +AT91C_PWMC_CH1_CPRDR.helpkey="Channel Period Register" +AT91C_PWMC_CH1_CPRDR.access=memorymapped +AT91C_PWMC_CH1_CPRDR.address=0xFFFCC228 +AT91C_PWMC_CH1_CPRDR.width=32 +AT91C_PWMC_CH1_CPRDR.byteEndian=little +AT91C_PWMC_CH1_CCNTR.name="AT91C_PWMC_CH1_CCNTR" +AT91C_PWMC_CH1_CCNTR.description="Channel Counter Register" +AT91C_PWMC_CH1_CCNTR.helpkey="Channel Counter Register" +AT91C_PWMC_CH1_CCNTR.access=memorymapped +AT91C_PWMC_CH1_CCNTR.address=0xFFFCC22C +AT91C_PWMC_CH1_CCNTR.width=32 +AT91C_PWMC_CH1_CCNTR.byteEndian=little +AT91C_PWMC_CH1_CCNTR.permission.write=none +AT91C_PWMC_CH1_CDTYR.name="AT91C_PWMC_CH1_CDTYR" +AT91C_PWMC_CH1_CDTYR.description="Channel Duty Cycle Register" +AT91C_PWMC_CH1_CDTYR.helpkey="Channel Duty Cycle Register" +AT91C_PWMC_CH1_CDTYR.access=memorymapped +AT91C_PWMC_CH1_CDTYR.address=0xFFFCC224 +AT91C_PWMC_CH1_CDTYR.width=32 +AT91C_PWMC_CH1_CDTYR.byteEndian=little +AT91C_PWMC_CH1_CMR.name="AT91C_PWMC_CH1_CMR" +AT91C_PWMC_CH1_CMR.description="Channel Mode Register" +AT91C_PWMC_CH1_CMR.helpkey="Channel Mode Register" +AT91C_PWMC_CH1_CMR.access=memorymapped +AT91C_PWMC_CH1_CMR.address=0xFFFCC220 +AT91C_PWMC_CH1_CMR.width=32 +AT91C_PWMC_CH1_CMR.byteEndian=little +# ========== Register definition for PWMC_CH0 peripheral ========== +AT91C_PWMC_CH0_Reserved.name="AT91C_PWMC_CH0_Reserved" +AT91C_PWMC_CH0_Reserved.description="Reserved" +AT91C_PWMC_CH0_Reserved.helpkey="Reserved" +AT91C_PWMC_CH0_Reserved.access=memorymapped +AT91C_PWMC_CH0_Reserved.address=0xFFFCC214 +AT91C_PWMC_CH0_Reserved.width=32 +AT91C_PWMC_CH0_Reserved.byteEndian=little +AT91C_PWMC_CH0_Reserved.type=enum +AT91C_PWMC_CH0_Reserved.enum.0.name=*** Write only *** +AT91C_PWMC_CH0_Reserved.enum.1.name=Error +AT91C_PWMC_CH0_CPRDR.name="AT91C_PWMC_CH0_CPRDR" +AT91C_PWMC_CH0_CPRDR.description="Channel Period Register" +AT91C_PWMC_CH0_CPRDR.helpkey="Channel Period Register" +AT91C_PWMC_CH0_CPRDR.access=memorymapped +AT91C_PWMC_CH0_CPRDR.address=0xFFFCC208 +AT91C_PWMC_CH0_CPRDR.width=32 +AT91C_PWMC_CH0_CPRDR.byteEndian=little +AT91C_PWMC_CH0_CDTYR.name="AT91C_PWMC_CH0_CDTYR" +AT91C_PWMC_CH0_CDTYR.description="Channel Duty Cycle Register" +AT91C_PWMC_CH0_CDTYR.helpkey="Channel Duty Cycle Register" +AT91C_PWMC_CH0_CDTYR.access=memorymapped +AT91C_PWMC_CH0_CDTYR.address=0xFFFCC204 +AT91C_PWMC_CH0_CDTYR.width=32 +AT91C_PWMC_CH0_CDTYR.byteEndian=little +AT91C_PWMC_CH0_CMR.name="AT91C_PWMC_CH0_CMR" +AT91C_PWMC_CH0_CMR.description="Channel Mode Register" +AT91C_PWMC_CH0_CMR.helpkey="Channel Mode Register" +AT91C_PWMC_CH0_CMR.access=memorymapped +AT91C_PWMC_CH0_CMR.address=0xFFFCC200 +AT91C_PWMC_CH0_CMR.width=32 +AT91C_PWMC_CH0_CMR.byteEndian=little +AT91C_PWMC_CH0_CUPDR.name="AT91C_PWMC_CH0_CUPDR" +AT91C_PWMC_CH0_CUPDR.description="Channel Update Register" +AT91C_PWMC_CH0_CUPDR.helpkey="Channel Update Register" +AT91C_PWMC_CH0_CUPDR.access=memorymapped +AT91C_PWMC_CH0_CUPDR.address=0xFFFCC210 +AT91C_PWMC_CH0_CUPDR.width=32 +AT91C_PWMC_CH0_CUPDR.byteEndian=little +AT91C_PWMC_CH0_CUPDR.type=enum +AT91C_PWMC_CH0_CUPDR.enum.0.name=*** Write only *** +AT91C_PWMC_CH0_CUPDR.enum.1.name=Error +AT91C_PWMC_CH0_CCNTR.name="AT91C_PWMC_CH0_CCNTR" +AT91C_PWMC_CH0_CCNTR.description="Channel Counter Register" +AT91C_PWMC_CH0_CCNTR.helpkey="Channel Counter Register" +AT91C_PWMC_CH0_CCNTR.access=memorymapped +AT91C_PWMC_CH0_CCNTR.address=0xFFFCC20C +AT91C_PWMC_CH0_CCNTR.width=32 +AT91C_PWMC_CH0_CCNTR.byteEndian=little +AT91C_PWMC_CH0_CCNTR.permission.write=none +# ========== Register definition for PWMC peripheral ========== +AT91C_PWMC_IDR.name="AT91C_PWMC_IDR" +AT91C_PWMC_IDR.description="PWMC Interrupt Disable Register" +AT91C_PWMC_IDR.helpkey="PWMC Interrupt Disable Register" +AT91C_PWMC_IDR.access=memorymapped +AT91C_PWMC_IDR.address=0xFFFCC014 +AT91C_PWMC_IDR.width=32 +AT91C_PWMC_IDR.byteEndian=little +AT91C_PWMC_IDR.type=enum +AT91C_PWMC_IDR.enum.0.name=*** Write only *** +AT91C_PWMC_IDR.enum.1.name=Error +AT91C_PWMC_DIS.name="AT91C_PWMC_DIS" +AT91C_PWMC_DIS.description="PWMC Disable Register" +AT91C_PWMC_DIS.helpkey="PWMC Disable Register" +AT91C_PWMC_DIS.access=memorymapped +AT91C_PWMC_DIS.address=0xFFFCC008 +AT91C_PWMC_DIS.width=32 +AT91C_PWMC_DIS.byteEndian=little +AT91C_PWMC_DIS.type=enum +AT91C_PWMC_DIS.enum.0.name=*** Write only *** +AT91C_PWMC_DIS.enum.1.name=Error +AT91C_PWMC_IER.name="AT91C_PWMC_IER" +AT91C_PWMC_IER.description="PWMC Interrupt Enable Register" +AT91C_PWMC_IER.helpkey="PWMC Interrupt Enable Register" +AT91C_PWMC_IER.access=memorymapped +AT91C_PWMC_IER.address=0xFFFCC010 +AT91C_PWMC_IER.width=32 +AT91C_PWMC_IER.byteEndian=little +AT91C_PWMC_IER.type=enum +AT91C_PWMC_IER.enum.0.name=*** Write only *** +AT91C_PWMC_IER.enum.1.name=Error +AT91C_PWMC_VR.name="AT91C_PWMC_VR" +AT91C_PWMC_VR.description="PWMC Version Register" +AT91C_PWMC_VR.helpkey="PWMC Version Register" +AT91C_PWMC_VR.access=memorymapped +AT91C_PWMC_VR.address=0xFFFCC0FC +AT91C_PWMC_VR.width=32 +AT91C_PWMC_VR.byteEndian=little +AT91C_PWMC_VR.permission.write=none +AT91C_PWMC_ISR.name="AT91C_PWMC_ISR" +AT91C_PWMC_ISR.description="PWMC Interrupt Status Register" +AT91C_PWMC_ISR.helpkey="PWMC Interrupt Status Register" +AT91C_PWMC_ISR.access=memorymapped +AT91C_PWMC_ISR.address=0xFFFCC01C +AT91C_PWMC_ISR.width=32 +AT91C_PWMC_ISR.byteEndian=little +AT91C_PWMC_ISR.permission.write=none +AT91C_PWMC_SR.name="AT91C_PWMC_SR" +AT91C_PWMC_SR.description="PWMC Status Register" +AT91C_PWMC_SR.helpkey="PWMC Status Register" +AT91C_PWMC_SR.access=memorymapped +AT91C_PWMC_SR.address=0xFFFCC00C +AT91C_PWMC_SR.width=32 +AT91C_PWMC_SR.byteEndian=little +AT91C_PWMC_SR.permission.write=none +AT91C_PWMC_IMR.name="AT91C_PWMC_IMR" +AT91C_PWMC_IMR.description="PWMC Interrupt Mask Register" +AT91C_PWMC_IMR.helpkey="PWMC Interrupt Mask Register" +AT91C_PWMC_IMR.access=memorymapped +AT91C_PWMC_IMR.address=0xFFFCC018 +AT91C_PWMC_IMR.width=32 +AT91C_PWMC_IMR.byteEndian=little +AT91C_PWMC_IMR.permission.write=none +AT91C_PWMC_MR.name="AT91C_PWMC_MR" +AT91C_PWMC_MR.description="PWMC Mode Register" +AT91C_PWMC_MR.helpkey="PWMC Mode Register" +AT91C_PWMC_MR.access=memorymapped +AT91C_PWMC_MR.address=0xFFFCC000 +AT91C_PWMC_MR.width=32 +AT91C_PWMC_MR.byteEndian=little +AT91C_PWMC_ENA.name="AT91C_PWMC_ENA" +AT91C_PWMC_ENA.description="PWMC Enable Register" +AT91C_PWMC_ENA.helpkey="PWMC Enable Register" +AT91C_PWMC_ENA.access=memorymapped +AT91C_PWMC_ENA.address=0xFFFCC004 +AT91C_PWMC_ENA.width=32 +AT91C_PWMC_ENA.byteEndian=little +AT91C_PWMC_ENA.type=enum +AT91C_PWMC_ENA.enum.0.name=*** Write only *** +AT91C_PWMC_ENA.enum.1.name=Error +# ========== Register definition for UDP peripheral ========== +AT91C_UDP_IMR.name="AT91C_UDP_IMR" +AT91C_UDP_IMR.description="Interrupt Mask Register" +AT91C_UDP_IMR.helpkey="Interrupt Mask Register" +AT91C_UDP_IMR.access=memorymapped +AT91C_UDP_IMR.address=0xFFFB0018 +AT91C_UDP_IMR.width=32 +AT91C_UDP_IMR.byteEndian=little +AT91C_UDP_IMR.permission.write=none +AT91C_UDP_FADDR.name="AT91C_UDP_FADDR" +AT91C_UDP_FADDR.description="Function Address Register" +AT91C_UDP_FADDR.helpkey="Function Address Register" +AT91C_UDP_FADDR.access=memorymapped +AT91C_UDP_FADDR.address=0xFFFB0008 +AT91C_UDP_FADDR.width=32 +AT91C_UDP_FADDR.byteEndian=little +AT91C_UDP_NUM.name="AT91C_UDP_NUM" +AT91C_UDP_NUM.description="Frame Number Register" +AT91C_UDP_NUM.helpkey="Frame Number Register" +AT91C_UDP_NUM.access=memorymapped +AT91C_UDP_NUM.address=0xFFFB0000 +AT91C_UDP_NUM.width=32 +AT91C_UDP_NUM.byteEndian=little +AT91C_UDP_NUM.permission.write=none +AT91C_UDP_FDR.name="AT91C_UDP_FDR" +AT91C_UDP_FDR.description="Endpoint FIFO Data Register" +AT91C_UDP_FDR.helpkey="Endpoint FIFO Data Register" +AT91C_UDP_FDR.access=memorymapped +AT91C_UDP_FDR.address=0xFFFB0050 +AT91C_UDP_FDR.width=32 +AT91C_UDP_FDR.byteEndian=little +AT91C_UDP_ISR.name="AT91C_UDP_ISR" +AT91C_UDP_ISR.description="Interrupt Status Register" +AT91C_UDP_ISR.helpkey="Interrupt Status Register" +AT91C_UDP_ISR.access=memorymapped +AT91C_UDP_ISR.address=0xFFFB001C +AT91C_UDP_ISR.width=32 +AT91C_UDP_ISR.byteEndian=little +AT91C_UDP_ISR.permission.write=none +AT91C_UDP_CSR.name="AT91C_UDP_CSR" +AT91C_UDP_CSR.description="Endpoint Control and Status Register" +AT91C_UDP_CSR.helpkey="Endpoint Control and Status Register" +AT91C_UDP_CSR.access=memorymapped +AT91C_UDP_CSR.address=0xFFFB0030 +AT91C_UDP_CSR.width=32 +AT91C_UDP_CSR.byteEndian=little +AT91C_UDP_IDR.name="AT91C_UDP_IDR" +AT91C_UDP_IDR.description="Interrupt Disable Register" +AT91C_UDP_IDR.helpkey="Interrupt Disable Register" +AT91C_UDP_IDR.access=memorymapped +AT91C_UDP_IDR.address=0xFFFB0014 +AT91C_UDP_IDR.width=32 +AT91C_UDP_IDR.byteEndian=little +AT91C_UDP_IDR.type=enum +AT91C_UDP_IDR.enum.0.name=*** Write only *** +AT91C_UDP_IDR.enum.1.name=Error +AT91C_UDP_ICR.name="AT91C_UDP_ICR" +AT91C_UDP_ICR.description="Interrupt Clear Register" +AT91C_UDP_ICR.helpkey="Interrupt Clear Register" +AT91C_UDP_ICR.access=memorymapped +AT91C_UDP_ICR.address=0xFFFB0020 +AT91C_UDP_ICR.width=32 +AT91C_UDP_ICR.byteEndian=little +AT91C_UDP_ICR.permission.write=none +AT91C_UDP_RSTEP.name="AT91C_UDP_RSTEP" +AT91C_UDP_RSTEP.description="Reset Endpoint Register" +AT91C_UDP_RSTEP.helpkey="Reset Endpoint Register" +AT91C_UDP_RSTEP.access=memorymapped +AT91C_UDP_RSTEP.address=0xFFFB0028 +AT91C_UDP_RSTEP.width=32 +AT91C_UDP_RSTEP.byteEndian=little +AT91C_UDP_RSTEP.permission.write=none +AT91C_UDP_TXVC.name="AT91C_UDP_TXVC" +AT91C_UDP_TXVC.description="Transceiver Control Register" +AT91C_UDP_TXVC.helpkey="Transceiver Control Register" +AT91C_UDP_TXVC.access=memorymapped +AT91C_UDP_TXVC.address=0xFFFB0074 +AT91C_UDP_TXVC.width=32 +AT91C_UDP_TXVC.byteEndian=little +AT91C_UDP_GLBSTATE.name="AT91C_UDP_GLBSTATE" +AT91C_UDP_GLBSTATE.description="Global State Register" +AT91C_UDP_GLBSTATE.helpkey="Global State Register" +AT91C_UDP_GLBSTATE.access=memorymapped +AT91C_UDP_GLBSTATE.address=0xFFFB0004 +AT91C_UDP_GLBSTATE.width=32 +AT91C_UDP_GLBSTATE.byteEndian=little +AT91C_UDP_IER.name="AT91C_UDP_IER" +AT91C_UDP_IER.description="Interrupt Enable Register" +AT91C_UDP_IER.helpkey="Interrupt Enable Register" +AT91C_UDP_IER.access=memorymapped +AT91C_UDP_IER.address=0xFFFB0010 +AT91C_UDP_IER.width=32 +AT91C_UDP_IER.byteEndian=little +AT91C_UDP_IER.type=enum +AT91C_UDP_IER.enum.0.name=*** Write only *** +AT91C_UDP_IER.enum.1.name=Error +# ========== Register definition for TC0 peripheral ========== +AT91C_TC0_SR.name="AT91C_TC0_SR" +AT91C_TC0_SR.description="Status Register" +AT91C_TC0_SR.helpkey="Status Register" +AT91C_TC0_SR.access=memorymapped +AT91C_TC0_SR.address=0xFFFA0020 +AT91C_TC0_SR.width=32 +AT91C_TC0_SR.byteEndian=little +AT91C_TC0_SR.permission.write=none +AT91C_TC0_RC.name="AT91C_TC0_RC" +AT91C_TC0_RC.description="Register C" +AT91C_TC0_RC.helpkey="Register C" +AT91C_TC0_RC.access=memorymapped +AT91C_TC0_RC.address=0xFFFA001C +AT91C_TC0_RC.width=32 +AT91C_TC0_RC.byteEndian=little +AT91C_TC0_RB.name="AT91C_TC0_RB" +AT91C_TC0_RB.description="Register B" +AT91C_TC0_RB.helpkey="Register B" +AT91C_TC0_RB.access=memorymapped +AT91C_TC0_RB.address=0xFFFA0018 +AT91C_TC0_RB.width=32 +AT91C_TC0_RB.byteEndian=little +AT91C_TC0_CCR.name="AT91C_TC0_CCR" +AT91C_TC0_CCR.description="Channel Control Register" +AT91C_TC0_CCR.helpkey="Channel Control Register" +AT91C_TC0_CCR.access=memorymapped +AT91C_TC0_CCR.address=0xFFFA0000 +AT91C_TC0_CCR.width=32 +AT91C_TC0_CCR.byteEndian=little +AT91C_TC0_CCR.type=enum +AT91C_TC0_CCR.enum.0.name=*** Write only *** +AT91C_TC0_CCR.enum.1.name=Error +AT91C_TC0_CMR.name="AT91C_TC0_CMR" +AT91C_TC0_CMR.description="Channel Mode Register (Capture Mode / Waveform Mode)" +AT91C_TC0_CMR.helpkey="Channel Mode Register (Capture Mode / Waveform Mode)" +AT91C_TC0_CMR.access=memorymapped +AT91C_TC0_CMR.address=0xFFFA0004 +AT91C_TC0_CMR.width=32 +AT91C_TC0_CMR.byteEndian=little +AT91C_TC0_IER.name="AT91C_TC0_IER" +AT91C_TC0_IER.description="Interrupt Enable Register" +AT91C_TC0_IER.helpkey="Interrupt Enable Register" +AT91C_TC0_IER.access=memorymapped +AT91C_TC0_IER.address=0xFFFA0024 +AT91C_TC0_IER.width=32 +AT91C_TC0_IER.byteEndian=little +AT91C_TC0_IER.type=enum +AT91C_TC0_IER.enum.0.name=*** Write only *** +AT91C_TC0_IER.enum.1.name=Error +AT91C_TC0_RA.name="AT91C_TC0_RA" +AT91C_TC0_RA.description="Register A" +AT91C_TC0_RA.helpkey="Register A" +AT91C_TC0_RA.access=memorymapped +AT91C_TC0_RA.address=0xFFFA0014 +AT91C_TC0_RA.width=32 +AT91C_TC0_RA.byteEndian=little +AT91C_TC0_IDR.name="AT91C_TC0_IDR" +AT91C_TC0_IDR.description="Interrupt Disable Register" +AT91C_TC0_IDR.helpkey="Interrupt Disable Register" +AT91C_TC0_IDR.access=memorymapped +AT91C_TC0_IDR.address=0xFFFA0028 +AT91C_TC0_IDR.width=32 +AT91C_TC0_IDR.byteEndian=little +AT91C_TC0_IDR.type=enum +AT91C_TC0_IDR.enum.0.name=*** Write only *** +AT91C_TC0_IDR.enum.1.name=Error +AT91C_TC0_CV.name="AT91C_TC0_CV" +AT91C_TC0_CV.description="Counter Value" +AT91C_TC0_CV.helpkey="Counter Value" +AT91C_TC0_CV.access=memorymapped +AT91C_TC0_CV.address=0xFFFA0010 +AT91C_TC0_CV.width=32 +AT91C_TC0_CV.byteEndian=little +AT91C_TC0_IMR.name="AT91C_TC0_IMR" +AT91C_TC0_IMR.description="Interrupt Mask Register" +AT91C_TC0_IMR.helpkey="Interrupt Mask Register" +AT91C_TC0_IMR.access=memorymapped +AT91C_TC0_IMR.address=0xFFFA002C +AT91C_TC0_IMR.width=32 +AT91C_TC0_IMR.byteEndian=little +AT91C_TC0_IMR.permission.write=none +# ========== Register definition for TC1 peripheral ========== +AT91C_TC1_RB.name="AT91C_TC1_RB" +AT91C_TC1_RB.description="Register B" +AT91C_TC1_RB.helpkey="Register B" +AT91C_TC1_RB.access=memorymapped +AT91C_TC1_RB.address=0xFFFA0058 +AT91C_TC1_RB.width=32 +AT91C_TC1_RB.byteEndian=little +AT91C_TC1_CCR.name="AT91C_TC1_CCR" +AT91C_TC1_CCR.description="Channel Control Register" +AT91C_TC1_CCR.helpkey="Channel Control Register" +AT91C_TC1_CCR.access=memorymapped +AT91C_TC1_CCR.address=0xFFFA0040 +AT91C_TC1_CCR.width=32 +AT91C_TC1_CCR.byteEndian=little +AT91C_TC1_CCR.type=enum +AT91C_TC1_CCR.enum.0.name=*** Write only *** +AT91C_TC1_CCR.enum.1.name=Error +AT91C_TC1_IER.name="AT91C_TC1_IER" +AT91C_TC1_IER.description="Interrupt Enable Register" +AT91C_TC1_IER.helpkey="Interrupt Enable Register" +AT91C_TC1_IER.access=memorymapped +AT91C_TC1_IER.address=0xFFFA0064 +AT91C_TC1_IER.width=32 +AT91C_TC1_IER.byteEndian=little +AT91C_TC1_IER.type=enum +AT91C_TC1_IER.enum.0.name=*** Write only *** +AT91C_TC1_IER.enum.1.name=Error +AT91C_TC1_IDR.name="AT91C_TC1_IDR" +AT91C_TC1_IDR.description="Interrupt Disable Register" +AT91C_TC1_IDR.helpkey="Interrupt Disable Register" +AT91C_TC1_IDR.access=memorymapped +AT91C_TC1_IDR.address=0xFFFA0068 +AT91C_TC1_IDR.width=32 +AT91C_TC1_IDR.byteEndian=little +AT91C_TC1_IDR.type=enum +AT91C_TC1_IDR.enum.0.name=*** Write only *** +AT91C_TC1_IDR.enum.1.name=Error +AT91C_TC1_SR.name="AT91C_TC1_SR" +AT91C_TC1_SR.description="Status Register" +AT91C_TC1_SR.helpkey="Status Register" +AT91C_TC1_SR.access=memorymapped +AT91C_TC1_SR.address=0xFFFA0060 +AT91C_TC1_SR.width=32 +AT91C_TC1_SR.byteEndian=little +AT91C_TC1_SR.permission.write=none +AT91C_TC1_CMR.name="AT91C_TC1_CMR" +AT91C_TC1_CMR.description="Channel Mode Register (Capture Mode / Waveform Mode)" +AT91C_TC1_CMR.helpkey="Channel Mode Register (Capture Mode / Waveform Mode)" +AT91C_TC1_CMR.access=memorymapped +AT91C_TC1_CMR.address=0xFFFA0044 +AT91C_TC1_CMR.width=32 +AT91C_TC1_CMR.byteEndian=little +AT91C_TC1_RA.name="AT91C_TC1_RA" +AT91C_TC1_RA.description="Register A" +AT91C_TC1_RA.helpkey="Register A" +AT91C_TC1_RA.access=memorymapped +AT91C_TC1_RA.address=0xFFFA0054 +AT91C_TC1_RA.width=32 +AT91C_TC1_RA.byteEndian=little +AT91C_TC1_RC.name="AT91C_TC1_RC" +AT91C_TC1_RC.description="Register C" +AT91C_TC1_RC.helpkey="Register C" +AT91C_TC1_RC.access=memorymapped +AT91C_TC1_RC.address=0xFFFA005C +AT91C_TC1_RC.width=32 +AT91C_TC1_RC.byteEndian=little +AT91C_TC1_IMR.name="AT91C_TC1_IMR" +AT91C_TC1_IMR.description="Interrupt Mask Register" +AT91C_TC1_IMR.helpkey="Interrupt Mask Register" +AT91C_TC1_IMR.access=memorymapped +AT91C_TC1_IMR.address=0xFFFA006C +AT91C_TC1_IMR.width=32 +AT91C_TC1_IMR.byteEndian=little +AT91C_TC1_IMR.permission.write=none +AT91C_TC1_CV.name="AT91C_TC1_CV" +AT91C_TC1_CV.description="Counter Value" +AT91C_TC1_CV.helpkey="Counter Value" +AT91C_TC1_CV.access=memorymapped +AT91C_TC1_CV.address=0xFFFA0050 +AT91C_TC1_CV.width=32 +AT91C_TC1_CV.byteEndian=little +# ========== Register definition for TC2 peripheral ========== +AT91C_TC2_CMR.name="AT91C_TC2_CMR" +AT91C_TC2_CMR.description="Channel Mode Register (Capture Mode / Waveform Mode)" +AT91C_TC2_CMR.helpkey="Channel Mode Register (Capture Mode / Waveform Mode)" +AT91C_TC2_CMR.access=memorymapped +AT91C_TC2_CMR.address=0xFFFA0084 +AT91C_TC2_CMR.width=32 +AT91C_TC2_CMR.byteEndian=little +AT91C_TC2_CCR.name="AT91C_TC2_CCR" +AT91C_TC2_CCR.description="Channel Control Register" +AT91C_TC2_CCR.helpkey="Channel Control Register" +AT91C_TC2_CCR.access=memorymapped +AT91C_TC2_CCR.address=0xFFFA0080 +AT91C_TC2_CCR.width=32 +AT91C_TC2_CCR.byteEndian=little +AT91C_TC2_CCR.type=enum +AT91C_TC2_CCR.enum.0.name=*** Write only *** +AT91C_TC2_CCR.enum.1.name=Error +AT91C_TC2_CV.name="AT91C_TC2_CV" +AT91C_TC2_CV.description="Counter Value" +AT91C_TC2_CV.helpkey="Counter Value" +AT91C_TC2_CV.access=memorymapped +AT91C_TC2_CV.address=0xFFFA0090 +AT91C_TC2_CV.width=32 +AT91C_TC2_CV.byteEndian=little +AT91C_TC2_RA.name="AT91C_TC2_RA" +AT91C_TC2_RA.description="Register A" +AT91C_TC2_RA.helpkey="Register A" +AT91C_TC2_RA.access=memorymapped +AT91C_TC2_RA.address=0xFFFA0094 +AT91C_TC2_RA.width=32 +AT91C_TC2_RA.byteEndian=little +AT91C_TC2_RB.name="AT91C_TC2_RB" +AT91C_TC2_RB.description="Register B" +AT91C_TC2_RB.helpkey="Register B" +AT91C_TC2_RB.access=memorymapped +AT91C_TC2_RB.address=0xFFFA0098 +AT91C_TC2_RB.width=32 +AT91C_TC2_RB.byteEndian=little +AT91C_TC2_IDR.name="AT91C_TC2_IDR" +AT91C_TC2_IDR.description="Interrupt Disable Register" +AT91C_TC2_IDR.helpkey="Interrupt Disable Register" +AT91C_TC2_IDR.access=memorymapped +AT91C_TC2_IDR.address=0xFFFA00A8 +AT91C_TC2_IDR.width=32 +AT91C_TC2_IDR.byteEndian=little +AT91C_TC2_IDR.type=enum +AT91C_TC2_IDR.enum.0.name=*** Write only *** +AT91C_TC2_IDR.enum.1.name=Error +AT91C_TC2_IMR.name="AT91C_TC2_IMR" +AT91C_TC2_IMR.description="Interrupt Mask Register" +AT91C_TC2_IMR.helpkey="Interrupt Mask Register" +AT91C_TC2_IMR.access=memorymapped +AT91C_TC2_IMR.address=0xFFFA00AC +AT91C_TC2_IMR.width=32 +AT91C_TC2_IMR.byteEndian=little +AT91C_TC2_IMR.permission.write=none +AT91C_TC2_RC.name="AT91C_TC2_RC" +AT91C_TC2_RC.description="Register C" +AT91C_TC2_RC.helpkey="Register C" +AT91C_TC2_RC.access=memorymapped +AT91C_TC2_RC.address=0xFFFA009C +AT91C_TC2_RC.width=32 +AT91C_TC2_RC.byteEndian=little +AT91C_TC2_IER.name="AT91C_TC2_IER" +AT91C_TC2_IER.description="Interrupt Enable Register" +AT91C_TC2_IER.helpkey="Interrupt Enable Register" +AT91C_TC2_IER.access=memorymapped +AT91C_TC2_IER.address=0xFFFA00A4 +AT91C_TC2_IER.width=32 +AT91C_TC2_IER.byteEndian=little +AT91C_TC2_IER.type=enum +AT91C_TC2_IER.enum.0.name=*** Write only *** +AT91C_TC2_IER.enum.1.name=Error +AT91C_TC2_SR.name="AT91C_TC2_SR" +AT91C_TC2_SR.description="Status Register" +AT91C_TC2_SR.helpkey="Status Register" +AT91C_TC2_SR.access=memorymapped +AT91C_TC2_SR.address=0xFFFA00A0 +AT91C_TC2_SR.width=32 +AT91C_TC2_SR.byteEndian=little +AT91C_TC2_SR.permission.write=none +# ========== Register definition for TCB peripheral ========== +AT91C_TCB_BMR.name="AT91C_TCB_BMR" +AT91C_TCB_BMR.description="TC Block Mode Register" +AT91C_TCB_BMR.helpkey="TC Block Mode Register" +AT91C_TCB_BMR.access=memorymapped +AT91C_TCB_BMR.address=0xFFFA00C4 +AT91C_TCB_BMR.width=32 +AT91C_TCB_BMR.byteEndian=little +AT91C_TCB_BCR.name="AT91C_TCB_BCR" +AT91C_TCB_BCR.description="TC Block Control Register" +AT91C_TCB_BCR.helpkey="TC Block Control Register" +AT91C_TCB_BCR.access=memorymapped +AT91C_TCB_BCR.address=0xFFFA00C0 +AT91C_TCB_BCR.width=32 +AT91C_TCB_BCR.byteEndian=little +AT91C_TCB_BCR.type=enum +AT91C_TCB_BCR.enum.0.name=*** Write only *** +AT91C_TCB_BCR.enum.1.name=Error +# ========== Register definition for CAN_MB0 peripheral ========== +AT91C_CAN_MB0_MDL.name="AT91C_CAN_MB0_MDL" +AT91C_CAN_MB0_MDL.description="MailBox Data Low Register" +AT91C_CAN_MB0_MDL.helpkey="MailBox Data Low Register" +AT91C_CAN_MB0_MDL.access=memorymapped +AT91C_CAN_MB0_MDL.address=0xFFFD0214 +AT91C_CAN_MB0_MDL.width=32 +AT91C_CAN_MB0_MDL.byteEndian=little +AT91C_CAN_MB0_MAM.name="AT91C_CAN_MB0_MAM" +AT91C_CAN_MB0_MAM.description="MailBox Acceptance Mask Register" +AT91C_CAN_MB0_MAM.helpkey="MailBox Acceptance Mask Register" +AT91C_CAN_MB0_MAM.access=memorymapped +AT91C_CAN_MB0_MAM.address=0xFFFD0204 +AT91C_CAN_MB0_MAM.width=32 +AT91C_CAN_MB0_MAM.byteEndian=little +AT91C_CAN_MB0_MCR.name="AT91C_CAN_MB0_MCR" +AT91C_CAN_MB0_MCR.description="MailBox Control Register" +AT91C_CAN_MB0_MCR.helpkey="MailBox Control Register" +AT91C_CAN_MB0_MCR.access=memorymapped +AT91C_CAN_MB0_MCR.address=0xFFFD021C +AT91C_CAN_MB0_MCR.width=32 +AT91C_CAN_MB0_MCR.byteEndian=little +AT91C_CAN_MB0_MCR.type=enum +AT91C_CAN_MB0_MCR.enum.0.name=*** Write only *** +AT91C_CAN_MB0_MCR.enum.1.name=Error +AT91C_CAN_MB0_MID.name="AT91C_CAN_MB0_MID" +AT91C_CAN_MB0_MID.description="MailBox ID Register" +AT91C_CAN_MB0_MID.helpkey="MailBox ID Register" +AT91C_CAN_MB0_MID.access=memorymapped +AT91C_CAN_MB0_MID.address=0xFFFD0208 +AT91C_CAN_MB0_MID.width=32 +AT91C_CAN_MB0_MID.byteEndian=little +AT91C_CAN_MB0_MSR.name="AT91C_CAN_MB0_MSR" +AT91C_CAN_MB0_MSR.description="MailBox Status Register" +AT91C_CAN_MB0_MSR.helpkey="MailBox Status Register" +AT91C_CAN_MB0_MSR.access=memorymapped +AT91C_CAN_MB0_MSR.address=0xFFFD0210 +AT91C_CAN_MB0_MSR.width=32 +AT91C_CAN_MB0_MSR.byteEndian=little +AT91C_CAN_MB0_MSR.permission.write=none +AT91C_CAN_MB0_MFID.name="AT91C_CAN_MB0_MFID" +AT91C_CAN_MB0_MFID.description="MailBox Family ID Register" +AT91C_CAN_MB0_MFID.helpkey="MailBox Family ID Register" +AT91C_CAN_MB0_MFID.access=memorymapped +AT91C_CAN_MB0_MFID.address=0xFFFD020C +AT91C_CAN_MB0_MFID.width=32 +AT91C_CAN_MB0_MFID.byteEndian=little +AT91C_CAN_MB0_MFID.permission.write=none +AT91C_CAN_MB0_MDH.name="AT91C_CAN_MB0_MDH" +AT91C_CAN_MB0_MDH.description="MailBox Data High Register" +AT91C_CAN_MB0_MDH.helpkey="MailBox Data High Register" +AT91C_CAN_MB0_MDH.access=memorymapped +AT91C_CAN_MB0_MDH.address=0xFFFD0218 +AT91C_CAN_MB0_MDH.width=32 +AT91C_CAN_MB0_MDH.byteEndian=little +AT91C_CAN_MB0_MMR.name="AT91C_CAN_MB0_MMR" +AT91C_CAN_MB0_MMR.description="MailBox Mode Register" +AT91C_CAN_MB0_MMR.helpkey="MailBox Mode Register" +AT91C_CAN_MB0_MMR.access=memorymapped +AT91C_CAN_MB0_MMR.address=0xFFFD0200 +AT91C_CAN_MB0_MMR.width=32 +AT91C_CAN_MB0_MMR.byteEndian=little +# ========== Register definition for CAN_MB1 peripheral ========== +AT91C_CAN_MB1_MDL.name="AT91C_CAN_MB1_MDL" +AT91C_CAN_MB1_MDL.description="MailBox Data Low Register" +AT91C_CAN_MB1_MDL.helpkey="MailBox Data Low Register" +AT91C_CAN_MB1_MDL.access=memorymapped +AT91C_CAN_MB1_MDL.address=0xFFFD0234 +AT91C_CAN_MB1_MDL.width=32 +AT91C_CAN_MB1_MDL.byteEndian=little +AT91C_CAN_MB1_MID.name="AT91C_CAN_MB1_MID" +AT91C_CAN_MB1_MID.description="MailBox ID Register" +AT91C_CAN_MB1_MID.helpkey="MailBox ID Register" +AT91C_CAN_MB1_MID.access=memorymapped +AT91C_CAN_MB1_MID.address=0xFFFD0228 +AT91C_CAN_MB1_MID.width=32 +AT91C_CAN_MB1_MID.byteEndian=little +AT91C_CAN_MB1_MMR.name="AT91C_CAN_MB1_MMR" +AT91C_CAN_MB1_MMR.description="MailBox Mode Register" +AT91C_CAN_MB1_MMR.helpkey="MailBox Mode Register" +AT91C_CAN_MB1_MMR.access=memorymapped +AT91C_CAN_MB1_MMR.address=0xFFFD0220 +AT91C_CAN_MB1_MMR.width=32 +AT91C_CAN_MB1_MMR.byteEndian=little +AT91C_CAN_MB1_MSR.name="AT91C_CAN_MB1_MSR" +AT91C_CAN_MB1_MSR.description="MailBox Status Register" +AT91C_CAN_MB1_MSR.helpkey="MailBox Status Register" +AT91C_CAN_MB1_MSR.access=memorymapped +AT91C_CAN_MB1_MSR.address=0xFFFD0230 +AT91C_CAN_MB1_MSR.width=32 +AT91C_CAN_MB1_MSR.byteEndian=little +AT91C_CAN_MB1_MSR.permission.write=none +AT91C_CAN_MB1_MAM.name="AT91C_CAN_MB1_MAM" +AT91C_CAN_MB1_MAM.description="MailBox Acceptance Mask Register" +AT91C_CAN_MB1_MAM.helpkey="MailBox Acceptance Mask Register" +AT91C_CAN_MB1_MAM.access=memorymapped +AT91C_CAN_MB1_MAM.address=0xFFFD0224 +AT91C_CAN_MB1_MAM.width=32 +AT91C_CAN_MB1_MAM.byteEndian=little +AT91C_CAN_MB1_MDH.name="AT91C_CAN_MB1_MDH" +AT91C_CAN_MB1_MDH.description="MailBox Data High Register" +AT91C_CAN_MB1_MDH.helpkey="MailBox Data High Register" +AT91C_CAN_MB1_MDH.access=memorymapped +AT91C_CAN_MB1_MDH.address=0xFFFD0238 +AT91C_CAN_MB1_MDH.width=32 +AT91C_CAN_MB1_MDH.byteEndian=little +AT91C_CAN_MB1_MCR.name="AT91C_CAN_MB1_MCR" +AT91C_CAN_MB1_MCR.description="MailBox Control Register" +AT91C_CAN_MB1_MCR.helpkey="MailBox Control Register" +AT91C_CAN_MB1_MCR.access=memorymapped +AT91C_CAN_MB1_MCR.address=0xFFFD023C +AT91C_CAN_MB1_MCR.width=32 +AT91C_CAN_MB1_MCR.byteEndian=little +AT91C_CAN_MB1_MCR.type=enum +AT91C_CAN_MB1_MCR.enum.0.name=*** Write only *** +AT91C_CAN_MB1_MCR.enum.1.name=Error +AT91C_CAN_MB1_MFID.name="AT91C_CAN_MB1_MFID" +AT91C_CAN_MB1_MFID.description="MailBox Family ID Register" +AT91C_CAN_MB1_MFID.helpkey="MailBox Family ID Register" +AT91C_CAN_MB1_MFID.access=memorymapped +AT91C_CAN_MB1_MFID.address=0xFFFD022C +AT91C_CAN_MB1_MFID.width=32 +AT91C_CAN_MB1_MFID.byteEndian=little +AT91C_CAN_MB1_MFID.permission.write=none +# ========== Register definition for CAN_MB2 peripheral ========== +AT91C_CAN_MB2_MCR.name="AT91C_CAN_MB2_MCR" +AT91C_CAN_MB2_MCR.description="MailBox Control Register" +AT91C_CAN_MB2_MCR.helpkey="MailBox Control Register" +AT91C_CAN_MB2_MCR.access=memorymapped +AT91C_CAN_MB2_MCR.address=0xFFFD025C +AT91C_CAN_MB2_MCR.width=32 +AT91C_CAN_MB2_MCR.byteEndian=little +AT91C_CAN_MB2_MCR.type=enum +AT91C_CAN_MB2_MCR.enum.0.name=*** Write only *** +AT91C_CAN_MB2_MCR.enum.1.name=Error +AT91C_CAN_MB2_MDH.name="AT91C_CAN_MB2_MDH" +AT91C_CAN_MB2_MDH.description="MailBox Data High Register" +AT91C_CAN_MB2_MDH.helpkey="MailBox Data High Register" +AT91C_CAN_MB2_MDH.access=memorymapped +AT91C_CAN_MB2_MDH.address=0xFFFD0258 +AT91C_CAN_MB2_MDH.width=32 +AT91C_CAN_MB2_MDH.byteEndian=little +AT91C_CAN_MB2_MID.name="AT91C_CAN_MB2_MID" +AT91C_CAN_MB2_MID.description="MailBox ID Register" +AT91C_CAN_MB2_MID.helpkey="MailBox ID Register" +AT91C_CAN_MB2_MID.access=memorymapped +AT91C_CAN_MB2_MID.address=0xFFFD0248 +AT91C_CAN_MB2_MID.width=32 +AT91C_CAN_MB2_MID.byteEndian=little +AT91C_CAN_MB2_MDL.name="AT91C_CAN_MB2_MDL" +AT91C_CAN_MB2_MDL.description="MailBox Data Low Register" +AT91C_CAN_MB2_MDL.helpkey="MailBox Data Low Register" +AT91C_CAN_MB2_MDL.access=memorymapped +AT91C_CAN_MB2_MDL.address=0xFFFD0254 +AT91C_CAN_MB2_MDL.width=32 +AT91C_CAN_MB2_MDL.byteEndian=little +AT91C_CAN_MB2_MMR.name="AT91C_CAN_MB2_MMR" +AT91C_CAN_MB2_MMR.description="MailBox Mode Register" +AT91C_CAN_MB2_MMR.helpkey="MailBox Mode Register" +AT91C_CAN_MB2_MMR.access=memorymapped +AT91C_CAN_MB2_MMR.address=0xFFFD0240 +AT91C_CAN_MB2_MMR.width=32 +AT91C_CAN_MB2_MMR.byteEndian=little +AT91C_CAN_MB2_MAM.name="AT91C_CAN_MB2_MAM" +AT91C_CAN_MB2_MAM.description="MailBox Acceptance Mask Register" +AT91C_CAN_MB2_MAM.helpkey="MailBox Acceptance Mask Register" +AT91C_CAN_MB2_MAM.access=memorymapped +AT91C_CAN_MB2_MAM.address=0xFFFD0244 +AT91C_CAN_MB2_MAM.width=32 +AT91C_CAN_MB2_MAM.byteEndian=little +AT91C_CAN_MB2_MFID.name="AT91C_CAN_MB2_MFID" +AT91C_CAN_MB2_MFID.description="MailBox Family ID Register" +AT91C_CAN_MB2_MFID.helpkey="MailBox Family ID Register" +AT91C_CAN_MB2_MFID.access=memorymapped +AT91C_CAN_MB2_MFID.address=0xFFFD024C +AT91C_CAN_MB2_MFID.width=32 +AT91C_CAN_MB2_MFID.byteEndian=little +AT91C_CAN_MB2_MFID.permission.write=none +AT91C_CAN_MB2_MSR.name="AT91C_CAN_MB2_MSR" +AT91C_CAN_MB2_MSR.description="MailBox Status Register" +AT91C_CAN_MB2_MSR.helpkey="MailBox Status Register" +AT91C_CAN_MB2_MSR.access=memorymapped +AT91C_CAN_MB2_MSR.address=0xFFFD0250 +AT91C_CAN_MB2_MSR.width=32 +AT91C_CAN_MB2_MSR.byteEndian=little +AT91C_CAN_MB2_MSR.permission.write=none +# ========== Register definition for CAN_MB3 peripheral ========== +AT91C_CAN_MB3_MFID.name="AT91C_CAN_MB3_MFID" +AT91C_CAN_MB3_MFID.description="MailBox Family ID Register" +AT91C_CAN_MB3_MFID.helpkey="MailBox Family ID Register" +AT91C_CAN_MB3_MFID.access=memorymapped +AT91C_CAN_MB3_MFID.address=0xFFFD026C +AT91C_CAN_MB3_MFID.width=32 +AT91C_CAN_MB3_MFID.byteEndian=little +AT91C_CAN_MB3_MFID.permission.write=none +AT91C_CAN_MB3_MAM.name="AT91C_CAN_MB3_MAM" +AT91C_CAN_MB3_MAM.description="MailBox Acceptance Mask Register" +AT91C_CAN_MB3_MAM.helpkey="MailBox Acceptance Mask Register" +AT91C_CAN_MB3_MAM.access=memorymapped +AT91C_CAN_MB3_MAM.address=0xFFFD0264 +AT91C_CAN_MB3_MAM.width=32 +AT91C_CAN_MB3_MAM.byteEndian=little +AT91C_CAN_MB3_MID.name="AT91C_CAN_MB3_MID" +AT91C_CAN_MB3_MID.description="MailBox ID Register" +AT91C_CAN_MB3_MID.helpkey="MailBox ID Register" +AT91C_CAN_MB3_MID.access=memorymapped +AT91C_CAN_MB3_MID.address=0xFFFD0268 +AT91C_CAN_MB3_MID.width=32 +AT91C_CAN_MB3_MID.byteEndian=little +AT91C_CAN_MB3_MCR.name="AT91C_CAN_MB3_MCR" +AT91C_CAN_MB3_MCR.description="MailBox Control Register" +AT91C_CAN_MB3_MCR.helpkey="MailBox Control Register" +AT91C_CAN_MB3_MCR.access=memorymapped +AT91C_CAN_MB3_MCR.address=0xFFFD027C +AT91C_CAN_MB3_MCR.width=32 +AT91C_CAN_MB3_MCR.byteEndian=little +AT91C_CAN_MB3_MCR.type=enum +AT91C_CAN_MB3_MCR.enum.0.name=*** Write only *** +AT91C_CAN_MB3_MCR.enum.1.name=Error +AT91C_CAN_MB3_MMR.name="AT91C_CAN_MB3_MMR" +AT91C_CAN_MB3_MMR.description="MailBox Mode Register" +AT91C_CAN_MB3_MMR.helpkey="MailBox Mode Register" +AT91C_CAN_MB3_MMR.access=memorymapped +AT91C_CAN_MB3_MMR.address=0xFFFD0260 +AT91C_CAN_MB3_MMR.width=32 +AT91C_CAN_MB3_MMR.byteEndian=little +AT91C_CAN_MB3_MSR.name="AT91C_CAN_MB3_MSR" +AT91C_CAN_MB3_MSR.description="MailBox Status Register" +AT91C_CAN_MB3_MSR.helpkey="MailBox Status Register" +AT91C_CAN_MB3_MSR.access=memorymapped +AT91C_CAN_MB3_MSR.address=0xFFFD0270 +AT91C_CAN_MB3_MSR.width=32 +AT91C_CAN_MB3_MSR.byteEndian=little +AT91C_CAN_MB3_MSR.permission.write=none +AT91C_CAN_MB3_MDL.name="AT91C_CAN_MB3_MDL" +AT91C_CAN_MB3_MDL.description="MailBox Data Low Register" +AT91C_CAN_MB3_MDL.helpkey="MailBox Data Low Register" +AT91C_CAN_MB3_MDL.access=memorymapped +AT91C_CAN_MB3_MDL.address=0xFFFD0274 +AT91C_CAN_MB3_MDL.width=32 +AT91C_CAN_MB3_MDL.byteEndian=little +AT91C_CAN_MB3_MDH.name="AT91C_CAN_MB3_MDH" +AT91C_CAN_MB3_MDH.description="MailBox Data High Register" +AT91C_CAN_MB3_MDH.helpkey="MailBox Data High Register" +AT91C_CAN_MB3_MDH.access=memorymapped +AT91C_CAN_MB3_MDH.address=0xFFFD0278 +AT91C_CAN_MB3_MDH.width=32 +AT91C_CAN_MB3_MDH.byteEndian=little +# ========== Register definition for CAN_MB4 peripheral ========== +AT91C_CAN_MB4_MID.name="AT91C_CAN_MB4_MID" +AT91C_CAN_MB4_MID.description="MailBox ID Register" +AT91C_CAN_MB4_MID.helpkey="MailBox ID Register" +AT91C_CAN_MB4_MID.access=memorymapped +AT91C_CAN_MB4_MID.address=0xFFFD0288 +AT91C_CAN_MB4_MID.width=32 +AT91C_CAN_MB4_MID.byteEndian=little +AT91C_CAN_MB4_MMR.name="AT91C_CAN_MB4_MMR" +AT91C_CAN_MB4_MMR.description="MailBox Mode Register" +AT91C_CAN_MB4_MMR.helpkey="MailBox Mode Register" +AT91C_CAN_MB4_MMR.access=memorymapped +AT91C_CAN_MB4_MMR.address=0xFFFD0280 +AT91C_CAN_MB4_MMR.width=32 +AT91C_CAN_MB4_MMR.byteEndian=little +AT91C_CAN_MB4_MDH.name="AT91C_CAN_MB4_MDH" +AT91C_CAN_MB4_MDH.description="MailBox Data High Register" +AT91C_CAN_MB4_MDH.helpkey="MailBox Data High Register" +AT91C_CAN_MB4_MDH.access=memorymapped +AT91C_CAN_MB4_MDH.address=0xFFFD0298 +AT91C_CAN_MB4_MDH.width=32 +AT91C_CAN_MB4_MDH.byteEndian=little +AT91C_CAN_MB4_MFID.name="AT91C_CAN_MB4_MFID" +AT91C_CAN_MB4_MFID.description="MailBox Family ID Register" +AT91C_CAN_MB4_MFID.helpkey="MailBox Family ID Register" +AT91C_CAN_MB4_MFID.access=memorymapped +AT91C_CAN_MB4_MFID.address=0xFFFD028C +AT91C_CAN_MB4_MFID.width=32 +AT91C_CAN_MB4_MFID.byteEndian=little +AT91C_CAN_MB4_MFID.permission.write=none +AT91C_CAN_MB4_MSR.name="AT91C_CAN_MB4_MSR" +AT91C_CAN_MB4_MSR.description="MailBox Status Register" +AT91C_CAN_MB4_MSR.helpkey="MailBox Status Register" +AT91C_CAN_MB4_MSR.access=memorymapped +AT91C_CAN_MB4_MSR.address=0xFFFD0290 +AT91C_CAN_MB4_MSR.width=32 +AT91C_CAN_MB4_MSR.byteEndian=little +AT91C_CAN_MB4_MSR.permission.write=none +AT91C_CAN_MB4_MCR.name="AT91C_CAN_MB4_MCR" +AT91C_CAN_MB4_MCR.description="MailBox Control Register" +AT91C_CAN_MB4_MCR.helpkey="MailBox Control Register" +AT91C_CAN_MB4_MCR.access=memorymapped +AT91C_CAN_MB4_MCR.address=0xFFFD029C +AT91C_CAN_MB4_MCR.width=32 +AT91C_CAN_MB4_MCR.byteEndian=little +AT91C_CAN_MB4_MCR.type=enum +AT91C_CAN_MB4_MCR.enum.0.name=*** Write only *** +AT91C_CAN_MB4_MCR.enum.1.name=Error +AT91C_CAN_MB4_MDL.name="AT91C_CAN_MB4_MDL" +AT91C_CAN_MB4_MDL.description="MailBox Data Low Register" +AT91C_CAN_MB4_MDL.helpkey="MailBox Data Low Register" +AT91C_CAN_MB4_MDL.access=memorymapped +AT91C_CAN_MB4_MDL.address=0xFFFD0294 +AT91C_CAN_MB4_MDL.width=32 +AT91C_CAN_MB4_MDL.byteEndian=little +AT91C_CAN_MB4_MAM.name="AT91C_CAN_MB4_MAM" +AT91C_CAN_MB4_MAM.description="MailBox Acceptance Mask Register" +AT91C_CAN_MB4_MAM.helpkey="MailBox Acceptance Mask Register" +AT91C_CAN_MB4_MAM.access=memorymapped +AT91C_CAN_MB4_MAM.address=0xFFFD0284 +AT91C_CAN_MB4_MAM.width=32 +AT91C_CAN_MB4_MAM.byteEndian=little +# ========== Register definition for CAN_MB5 peripheral ========== +AT91C_CAN_MB5_MSR.name="AT91C_CAN_MB5_MSR" +AT91C_CAN_MB5_MSR.description="MailBox Status Register" +AT91C_CAN_MB5_MSR.helpkey="MailBox Status Register" +AT91C_CAN_MB5_MSR.access=memorymapped +AT91C_CAN_MB5_MSR.address=0xFFFD02B0 +AT91C_CAN_MB5_MSR.width=32 +AT91C_CAN_MB5_MSR.byteEndian=little +AT91C_CAN_MB5_MSR.permission.write=none +AT91C_CAN_MB5_MCR.name="AT91C_CAN_MB5_MCR" +AT91C_CAN_MB5_MCR.description="MailBox Control Register" +AT91C_CAN_MB5_MCR.helpkey="MailBox Control Register" +AT91C_CAN_MB5_MCR.access=memorymapped +AT91C_CAN_MB5_MCR.address=0xFFFD02BC +AT91C_CAN_MB5_MCR.width=32 +AT91C_CAN_MB5_MCR.byteEndian=little +AT91C_CAN_MB5_MCR.type=enum +AT91C_CAN_MB5_MCR.enum.0.name=*** Write only *** +AT91C_CAN_MB5_MCR.enum.1.name=Error +AT91C_CAN_MB5_MFID.name="AT91C_CAN_MB5_MFID" +AT91C_CAN_MB5_MFID.description="MailBox Family ID Register" +AT91C_CAN_MB5_MFID.helpkey="MailBox Family ID Register" +AT91C_CAN_MB5_MFID.access=memorymapped +AT91C_CAN_MB5_MFID.address=0xFFFD02AC +AT91C_CAN_MB5_MFID.width=32 +AT91C_CAN_MB5_MFID.byteEndian=little +AT91C_CAN_MB5_MFID.permission.write=none +AT91C_CAN_MB5_MDH.name="AT91C_CAN_MB5_MDH" +AT91C_CAN_MB5_MDH.description="MailBox Data High Register" +AT91C_CAN_MB5_MDH.helpkey="MailBox Data High Register" +AT91C_CAN_MB5_MDH.access=memorymapped +AT91C_CAN_MB5_MDH.address=0xFFFD02B8 +AT91C_CAN_MB5_MDH.width=32 +AT91C_CAN_MB5_MDH.byteEndian=little +AT91C_CAN_MB5_MID.name="AT91C_CAN_MB5_MID" +AT91C_CAN_MB5_MID.description="MailBox ID Register" +AT91C_CAN_MB5_MID.helpkey="MailBox ID Register" +AT91C_CAN_MB5_MID.access=memorymapped +AT91C_CAN_MB5_MID.address=0xFFFD02A8 +AT91C_CAN_MB5_MID.width=32 +AT91C_CAN_MB5_MID.byteEndian=little +AT91C_CAN_MB5_MMR.name="AT91C_CAN_MB5_MMR" +AT91C_CAN_MB5_MMR.description="MailBox Mode Register" +AT91C_CAN_MB5_MMR.helpkey="MailBox Mode Register" +AT91C_CAN_MB5_MMR.access=memorymapped +AT91C_CAN_MB5_MMR.address=0xFFFD02A0 +AT91C_CAN_MB5_MMR.width=32 +AT91C_CAN_MB5_MMR.byteEndian=little +AT91C_CAN_MB5_MDL.name="AT91C_CAN_MB5_MDL" +AT91C_CAN_MB5_MDL.description="MailBox Data Low Register" +AT91C_CAN_MB5_MDL.helpkey="MailBox Data Low Register" +AT91C_CAN_MB5_MDL.access=memorymapped +AT91C_CAN_MB5_MDL.address=0xFFFD02B4 +AT91C_CAN_MB5_MDL.width=32 +AT91C_CAN_MB5_MDL.byteEndian=little +AT91C_CAN_MB5_MAM.name="AT91C_CAN_MB5_MAM" +AT91C_CAN_MB5_MAM.description="MailBox Acceptance Mask Register" +AT91C_CAN_MB5_MAM.helpkey="MailBox Acceptance Mask Register" +AT91C_CAN_MB5_MAM.access=memorymapped +AT91C_CAN_MB5_MAM.address=0xFFFD02A4 +AT91C_CAN_MB5_MAM.width=32 +AT91C_CAN_MB5_MAM.byteEndian=little +# ========== Register definition for CAN_MB6 peripheral ========== +AT91C_CAN_MB6_MFID.name="AT91C_CAN_MB6_MFID" +AT91C_CAN_MB6_MFID.description="MailBox Family ID Register" +AT91C_CAN_MB6_MFID.helpkey="MailBox Family ID Register" +AT91C_CAN_MB6_MFID.access=memorymapped +AT91C_CAN_MB6_MFID.address=0xFFFD02CC +AT91C_CAN_MB6_MFID.width=32 +AT91C_CAN_MB6_MFID.byteEndian=little +AT91C_CAN_MB6_MFID.permission.write=none +AT91C_CAN_MB6_MID.name="AT91C_CAN_MB6_MID" +AT91C_CAN_MB6_MID.description="MailBox ID Register" +AT91C_CAN_MB6_MID.helpkey="MailBox ID Register" +AT91C_CAN_MB6_MID.access=memorymapped +AT91C_CAN_MB6_MID.address=0xFFFD02C8 +AT91C_CAN_MB6_MID.width=32 +AT91C_CAN_MB6_MID.byteEndian=little +AT91C_CAN_MB6_MAM.name="AT91C_CAN_MB6_MAM" +AT91C_CAN_MB6_MAM.description="MailBox Acceptance Mask Register" +AT91C_CAN_MB6_MAM.helpkey="MailBox Acceptance Mask Register" +AT91C_CAN_MB6_MAM.access=memorymapped +AT91C_CAN_MB6_MAM.address=0xFFFD02C4 +AT91C_CAN_MB6_MAM.width=32 +AT91C_CAN_MB6_MAM.byteEndian=little +AT91C_CAN_MB6_MSR.name="AT91C_CAN_MB6_MSR" +AT91C_CAN_MB6_MSR.description="MailBox Status Register" +AT91C_CAN_MB6_MSR.helpkey="MailBox Status Register" +AT91C_CAN_MB6_MSR.access=memorymapped +AT91C_CAN_MB6_MSR.address=0xFFFD02D0 +AT91C_CAN_MB6_MSR.width=32 +AT91C_CAN_MB6_MSR.byteEndian=little +AT91C_CAN_MB6_MSR.permission.write=none +AT91C_CAN_MB6_MDL.name="AT91C_CAN_MB6_MDL" +AT91C_CAN_MB6_MDL.description="MailBox Data Low Register" +AT91C_CAN_MB6_MDL.helpkey="MailBox Data Low Register" +AT91C_CAN_MB6_MDL.access=memorymapped +AT91C_CAN_MB6_MDL.address=0xFFFD02D4 +AT91C_CAN_MB6_MDL.width=32 +AT91C_CAN_MB6_MDL.byteEndian=little +AT91C_CAN_MB6_MCR.name="AT91C_CAN_MB6_MCR" +AT91C_CAN_MB6_MCR.description="MailBox Control Register" +AT91C_CAN_MB6_MCR.helpkey="MailBox Control Register" +AT91C_CAN_MB6_MCR.access=memorymapped +AT91C_CAN_MB6_MCR.address=0xFFFD02DC +AT91C_CAN_MB6_MCR.width=32 +AT91C_CAN_MB6_MCR.byteEndian=little +AT91C_CAN_MB6_MCR.type=enum +AT91C_CAN_MB6_MCR.enum.0.name=*** Write only *** +AT91C_CAN_MB6_MCR.enum.1.name=Error +AT91C_CAN_MB6_MDH.name="AT91C_CAN_MB6_MDH" +AT91C_CAN_MB6_MDH.description="MailBox Data High Register" +AT91C_CAN_MB6_MDH.helpkey="MailBox Data High Register" +AT91C_CAN_MB6_MDH.access=memorymapped +AT91C_CAN_MB6_MDH.address=0xFFFD02D8 +AT91C_CAN_MB6_MDH.width=32 +AT91C_CAN_MB6_MDH.byteEndian=little +AT91C_CAN_MB6_MMR.name="AT91C_CAN_MB6_MMR" +AT91C_CAN_MB6_MMR.description="MailBox Mode Register" +AT91C_CAN_MB6_MMR.helpkey="MailBox Mode Register" +AT91C_CAN_MB6_MMR.access=memorymapped +AT91C_CAN_MB6_MMR.address=0xFFFD02C0 +AT91C_CAN_MB6_MMR.width=32 +AT91C_CAN_MB6_MMR.byteEndian=little +# ========== Register definition for CAN_MB7 peripheral ========== +AT91C_CAN_MB7_MCR.name="AT91C_CAN_MB7_MCR" +AT91C_CAN_MB7_MCR.description="MailBox Control Register" +AT91C_CAN_MB7_MCR.helpkey="MailBox Control Register" +AT91C_CAN_MB7_MCR.access=memorymapped +AT91C_CAN_MB7_MCR.address=0xFFFD02FC +AT91C_CAN_MB7_MCR.width=32 +AT91C_CAN_MB7_MCR.byteEndian=little +AT91C_CAN_MB7_MCR.type=enum +AT91C_CAN_MB7_MCR.enum.0.name=*** Write only *** +AT91C_CAN_MB7_MCR.enum.1.name=Error +AT91C_CAN_MB7_MDH.name="AT91C_CAN_MB7_MDH" +AT91C_CAN_MB7_MDH.description="MailBox Data High Register" +AT91C_CAN_MB7_MDH.helpkey="MailBox Data High Register" +AT91C_CAN_MB7_MDH.access=memorymapped +AT91C_CAN_MB7_MDH.address=0xFFFD02F8 +AT91C_CAN_MB7_MDH.width=32 +AT91C_CAN_MB7_MDH.byteEndian=little +AT91C_CAN_MB7_MFID.name="AT91C_CAN_MB7_MFID" +AT91C_CAN_MB7_MFID.description="MailBox Family ID Register" +AT91C_CAN_MB7_MFID.helpkey="MailBox Family ID Register" +AT91C_CAN_MB7_MFID.access=memorymapped +AT91C_CAN_MB7_MFID.address=0xFFFD02EC +AT91C_CAN_MB7_MFID.width=32 +AT91C_CAN_MB7_MFID.byteEndian=little +AT91C_CAN_MB7_MFID.permission.write=none +AT91C_CAN_MB7_MDL.name="AT91C_CAN_MB7_MDL" +AT91C_CAN_MB7_MDL.description="MailBox Data Low Register" +AT91C_CAN_MB7_MDL.helpkey="MailBox Data Low Register" +AT91C_CAN_MB7_MDL.access=memorymapped +AT91C_CAN_MB7_MDL.address=0xFFFD02F4 +AT91C_CAN_MB7_MDL.width=32 +AT91C_CAN_MB7_MDL.byteEndian=little +AT91C_CAN_MB7_MID.name="AT91C_CAN_MB7_MID" +AT91C_CAN_MB7_MID.description="MailBox ID Register" +AT91C_CAN_MB7_MID.helpkey="MailBox ID Register" +AT91C_CAN_MB7_MID.access=memorymapped +AT91C_CAN_MB7_MID.address=0xFFFD02E8 +AT91C_CAN_MB7_MID.width=32 +AT91C_CAN_MB7_MID.byteEndian=little +AT91C_CAN_MB7_MMR.name="AT91C_CAN_MB7_MMR" +AT91C_CAN_MB7_MMR.description="MailBox Mode Register" +AT91C_CAN_MB7_MMR.helpkey="MailBox Mode Register" +AT91C_CAN_MB7_MMR.access=memorymapped +AT91C_CAN_MB7_MMR.address=0xFFFD02E0 +AT91C_CAN_MB7_MMR.width=32 +AT91C_CAN_MB7_MMR.byteEndian=little +AT91C_CAN_MB7_MAM.name="AT91C_CAN_MB7_MAM" +AT91C_CAN_MB7_MAM.description="MailBox Acceptance Mask Register" +AT91C_CAN_MB7_MAM.helpkey="MailBox Acceptance Mask Register" +AT91C_CAN_MB7_MAM.access=memorymapped +AT91C_CAN_MB7_MAM.address=0xFFFD02E4 +AT91C_CAN_MB7_MAM.width=32 +AT91C_CAN_MB7_MAM.byteEndian=little +AT91C_CAN_MB7_MSR.name="AT91C_CAN_MB7_MSR" +AT91C_CAN_MB7_MSR.description="MailBox Status Register" +AT91C_CAN_MB7_MSR.helpkey="MailBox Status Register" +AT91C_CAN_MB7_MSR.access=memorymapped +AT91C_CAN_MB7_MSR.address=0xFFFD02F0 +AT91C_CAN_MB7_MSR.width=32 +AT91C_CAN_MB7_MSR.byteEndian=little +AT91C_CAN_MB7_MSR.permission.write=none +# ========== Register definition for CAN peripheral ========== +AT91C_CAN_TCR.name="AT91C_CAN_TCR" +AT91C_CAN_TCR.description="Transfer Command Register" +AT91C_CAN_TCR.helpkey="Transfer Command Register" +AT91C_CAN_TCR.access=memorymapped +AT91C_CAN_TCR.address=0xFFFD0024 +AT91C_CAN_TCR.width=32 +AT91C_CAN_TCR.byteEndian=little +AT91C_CAN_TCR.type=enum +AT91C_CAN_TCR.enum.0.name=*** Write only *** +AT91C_CAN_TCR.enum.1.name=Error +AT91C_CAN_IMR.name="AT91C_CAN_IMR" +AT91C_CAN_IMR.description="Interrupt Mask Register" +AT91C_CAN_IMR.helpkey="Interrupt Mask Register" +AT91C_CAN_IMR.access=memorymapped +AT91C_CAN_IMR.address=0xFFFD000C +AT91C_CAN_IMR.width=32 +AT91C_CAN_IMR.byteEndian=little +AT91C_CAN_IMR.permission.write=none +AT91C_CAN_IER.name="AT91C_CAN_IER" +AT91C_CAN_IER.description="Interrupt Enable Register" +AT91C_CAN_IER.helpkey="Interrupt Enable Register" +AT91C_CAN_IER.access=memorymapped +AT91C_CAN_IER.address=0xFFFD0004 +AT91C_CAN_IER.width=32 +AT91C_CAN_IER.byteEndian=little +AT91C_CAN_IER.type=enum +AT91C_CAN_IER.enum.0.name=*** Write only *** +AT91C_CAN_IER.enum.1.name=Error +AT91C_CAN_ECR.name="AT91C_CAN_ECR" +AT91C_CAN_ECR.description="Error Counter Register" +AT91C_CAN_ECR.helpkey="Error Counter Register" +AT91C_CAN_ECR.access=memorymapped +AT91C_CAN_ECR.address=0xFFFD0020 +AT91C_CAN_ECR.width=32 +AT91C_CAN_ECR.byteEndian=little +AT91C_CAN_ECR.permission.write=none +AT91C_CAN_TIMESTP.name="AT91C_CAN_TIMESTP" +AT91C_CAN_TIMESTP.description="Time Stamp Register" +AT91C_CAN_TIMESTP.helpkey="Time Stamp Register" +AT91C_CAN_TIMESTP.access=memorymapped +AT91C_CAN_TIMESTP.address=0xFFFD001C +AT91C_CAN_TIMESTP.width=32 +AT91C_CAN_TIMESTP.byteEndian=little +AT91C_CAN_TIMESTP.permission.write=none +AT91C_CAN_MR.name="AT91C_CAN_MR" +AT91C_CAN_MR.description="Mode Register" +AT91C_CAN_MR.helpkey="Mode Register" +AT91C_CAN_MR.access=memorymapped +AT91C_CAN_MR.address=0xFFFD0000 +AT91C_CAN_MR.width=32 +AT91C_CAN_MR.byteEndian=little +AT91C_CAN_IDR.name="AT91C_CAN_IDR" +AT91C_CAN_IDR.description="Interrupt Disable Register" +AT91C_CAN_IDR.helpkey="Interrupt Disable Register" +AT91C_CAN_IDR.access=memorymapped +AT91C_CAN_IDR.address=0xFFFD0008 +AT91C_CAN_IDR.width=32 +AT91C_CAN_IDR.byteEndian=little +AT91C_CAN_IDR.type=enum +AT91C_CAN_IDR.enum.0.name=*** Write only *** +AT91C_CAN_IDR.enum.1.name=Error +AT91C_CAN_ACR.name="AT91C_CAN_ACR" +AT91C_CAN_ACR.description="Abort Command Register" +AT91C_CAN_ACR.helpkey="Abort Command Register" +AT91C_CAN_ACR.access=memorymapped +AT91C_CAN_ACR.address=0xFFFD0028 +AT91C_CAN_ACR.width=32 +AT91C_CAN_ACR.byteEndian=little +AT91C_CAN_ACR.type=enum +AT91C_CAN_ACR.enum.0.name=*** Write only *** +AT91C_CAN_ACR.enum.1.name=Error +AT91C_CAN_TIM.name="AT91C_CAN_TIM" +AT91C_CAN_TIM.description="Timer Register" +AT91C_CAN_TIM.helpkey="Timer Register" +AT91C_CAN_TIM.access=memorymapped +AT91C_CAN_TIM.address=0xFFFD0018 +AT91C_CAN_TIM.width=32 +AT91C_CAN_TIM.byteEndian=little +AT91C_CAN_TIM.permission.write=none +AT91C_CAN_SR.name="AT91C_CAN_SR" +AT91C_CAN_SR.description="Status Register" +AT91C_CAN_SR.helpkey="Status Register" +AT91C_CAN_SR.access=memorymapped +AT91C_CAN_SR.address=0xFFFD0010 +AT91C_CAN_SR.width=32 +AT91C_CAN_SR.byteEndian=little +AT91C_CAN_SR.permission.write=none +AT91C_CAN_BR.name="AT91C_CAN_BR" +AT91C_CAN_BR.description="Baudrate Register" +AT91C_CAN_BR.helpkey="Baudrate Register" +AT91C_CAN_BR.access=memorymapped +AT91C_CAN_BR.address=0xFFFD0014 +AT91C_CAN_BR.width=32 +AT91C_CAN_BR.byteEndian=little +AT91C_CAN_VR.name="AT91C_CAN_VR" +AT91C_CAN_VR.description="Version Register" +AT91C_CAN_VR.helpkey="Version Register" +AT91C_CAN_VR.access=memorymapped +AT91C_CAN_VR.address=0xFFFD00FC +AT91C_CAN_VR.width=32 +AT91C_CAN_VR.byteEndian=little +AT91C_CAN_VR.permission.write=none +# ========== Register definition for EMAC peripheral ========== +AT91C_EMAC_ISR.name="AT91C_EMAC_ISR" +AT91C_EMAC_ISR.description="Interrupt Status Register" +AT91C_EMAC_ISR.helpkey="Interrupt Status Register" +AT91C_EMAC_ISR.access=memorymapped +AT91C_EMAC_ISR.address=0xFFFDC024 +AT91C_EMAC_ISR.width=32 +AT91C_EMAC_ISR.byteEndian=little +AT91C_EMAC_SA4H.name="AT91C_EMAC_SA4H" +AT91C_EMAC_SA4H.description="Specific Address 4 Top, Last 2 bytes" +AT91C_EMAC_SA4H.helpkey="Specific Address 4 Top, Last 2 bytes" +AT91C_EMAC_SA4H.access=memorymapped +AT91C_EMAC_SA4H.address=0xFFFDC0B4 +AT91C_EMAC_SA4H.width=32 +AT91C_EMAC_SA4H.byteEndian=little +AT91C_EMAC_SA1L.name="AT91C_EMAC_SA1L" +AT91C_EMAC_SA1L.description="Specific Address 1 Bottom, First 4 bytes" +AT91C_EMAC_SA1L.helpkey="Specific Address 1 Bottom, First 4 bytes" +AT91C_EMAC_SA1L.access=memorymapped +AT91C_EMAC_SA1L.address=0xFFFDC098 +AT91C_EMAC_SA1L.width=32 +AT91C_EMAC_SA1L.byteEndian=little +AT91C_EMAC_ELE.name="AT91C_EMAC_ELE" +AT91C_EMAC_ELE.description="Excessive Length Errors Register" +AT91C_EMAC_ELE.helpkey="Excessive Length Errors Register" +AT91C_EMAC_ELE.access=memorymapped +AT91C_EMAC_ELE.address=0xFFFDC078 +AT91C_EMAC_ELE.width=32 +AT91C_EMAC_ELE.byteEndian=little +AT91C_EMAC_LCOL.name="AT91C_EMAC_LCOL" +AT91C_EMAC_LCOL.description="Late Collision Register" +AT91C_EMAC_LCOL.helpkey="Late Collision Register" +AT91C_EMAC_LCOL.access=memorymapped +AT91C_EMAC_LCOL.address=0xFFFDC05C +AT91C_EMAC_LCOL.width=32 +AT91C_EMAC_LCOL.byteEndian=little +AT91C_EMAC_RLE.name="AT91C_EMAC_RLE" +AT91C_EMAC_RLE.description="Receive Length Field Mismatch Register" +AT91C_EMAC_RLE.helpkey="Receive Length Field Mismatch Register" +AT91C_EMAC_RLE.access=memorymapped +AT91C_EMAC_RLE.address=0xFFFDC088 +AT91C_EMAC_RLE.width=32 +AT91C_EMAC_RLE.byteEndian=little +AT91C_EMAC_WOL.name="AT91C_EMAC_WOL" +AT91C_EMAC_WOL.description="Wake On LAN Register" +AT91C_EMAC_WOL.helpkey="Wake On LAN Register" +AT91C_EMAC_WOL.access=memorymapped +AT91C_EMAC_WOL.address=0xFFFDC0C4 +AT91C_EMAC_WOL.width=32 +AT91C_EMAC_WOL.byteEndian=little +AT91C_EMAC_DTF.name="AT91C_EMAC_DTF" +AT91C_EMAC_DTF.description="Deferred Transmission Frame Register" +AT91C_EMAC_DTF.helpkey="Deferred Transmission Frame Register" +AT91C_EMAC_DTF.access=memorymapped +AT91C_EMAC_DTF.address=0xFFFDC058 +AT91C_EMAC_DTF.width=32 +AT91C_EMAC_DTF.byteEndian=little +AT91C_EMAC_TUND.name="AT91C_EMAC_TUND" +AT91C_EMAC_TUND.description="Transmit Underrun Error Register" +AT91C_EMAC_TUND.helpkey="Transmit Underrun Error Register" +AT91C_EMAC_TUND.access=memorymapped +AT91C_EMAC_TUND.address=0xFFFDC064 +AT91C_EMAC_TUND.width=32 +AT91C_EMAC_TUND.byteEndian=little +AT91C_EMAC_NCR.name="AT91C_EMAC_NCR" +AT91C_EMAC_NCR.description="Network Control Register" +AT91C_EMAC_NCR.helpkey="Network Control Register" +AT91C_EMAC_NCR.access=memorymapped +AT91C_EMAC_NCR.address=0xFFFDC000 +AT91C_EMAC_NCR.width=32 +AT91C_EMAC_NCR.byteEndian=little +AT91C_EMAC_SA4L.name="AT91C_EMAC_SA4L" +AT91C_EMAC_SA4L.description="Specific Address 4 Bottom, First 4 bytes" +AT91C_EMAC_SA4L.helpkey="Specific Address 4 Bottom, First 4 bytes" +AT91C_EMAC_SA4L.access=memorymapped +AT91C_EMAC_SA4L.address=0xFFFDC0B0 +AT91C_EMAC_SA4L.width=32 +AT91C_EMAC_SA4L.byteEndian=little +AT91C_EMAC_RSR.name="AT91C_EMAC_RSR" +AT91C_EMAC_RSR.description="Receive Status Register" +AT91C_EMAC_RSR.helpkey="Receive Status Register" +AT91C_EMAC_RSR.access=memorymapped +AT91C_EMAC_RSR.address=0xFFFDC020 +AT91C_EMAC_RSR.width=32 +AT91C_EMAC_RSR.byteEndian=little +AT91C_EMAC_SA3L.name="AT91C_EMAC_SA3L" +AT91C_EMAC_SA3L.description="Specific Address 3 Bottom, First 4 bytes" +AT91C_EMAC_SA3L.helpkey="Specific Address 3 Bottom, First 4 bytes" +AT91C_EMAC_SA3L.access=memorymapped +AT91C_EMAC_SA3L.address=0xFFFDC0A8 +AT91C_EMAC_SA3L.width=32 +AT91C_EMAC_SA3L.byteEndian=little +AT91C_EMAC_TSR.name="AT91C_EMAC_TSR" +AT91C_EMAC_TSR.description="Transmit Status Register" +AT91C_EMAC_TSR.helpkey="Transmit Status Register" +AT91C_EMAC_TSR.access=memorymapped +AT91C_EMAC_TSR.address=0xFFFDC014 +AT91C_EMAC_TSR.width=32 +AT91C_EMAC_TSR.byteEndian=little +AT91C_EMAC_IDR.name="AT91C_EMAC_IDR" +AT91C_EMAC_IDR.description="Interrupt Disable Register" +AT91C_EMAC_IDR.helpkey="Interrupt Disable Register" +AT91C_EMAC_IDR.access=memorymapped +AT91C_EMAC_IDR.address=0xFFFDC02C +AT91C_EMAC_IDR.width=32 +AT91C_EMAC_IDR.byteEndian=little +AT91C_EMAC_IDR.type=enum +AT91C_EMAC_IDR.enum.0.name=*** Write only *** +AT91C_EMAC_IDR.enum.1.name=Error +AT91C_EMAC_RSE.name="AT91C_EMAC_RSE" +AT91C_EMAC_RSE.description="Receive Symbol Errors Register" +AT91C_EMAC_RSE.helpkey="Receive Symbol Errors Register" +AT91C_EMAC_RSE.access=memorymapped +AT91C_EMAC_RSE.address=0xFFFDC074 +AT91C_EMAC_RSE.width=32 +AT91C_EMAC_RSE.byteEndian=little +AT91C_EMAC_ECOL.name="AT91C_EMAC_ECOL" +AT91C_EMAC_ECOL.description="Excessive Collision Register" +AT91C_EMAC_ECOL.helpkey="Excessive Collision Register" +AT91C_EMAC_ECOL.access=memorymapped +AT91C_EMAC_ECOL.address=0xFFFDC060 +AT91C_EMAC_ECOL.width=32 +AT91C_EMAC_ECOL.byteEndian=little +AT91C_EMAC_TID.name="AT91C_EMAC_TID" +AT91C_EMAC_TID.description="Type ID Checking Register" +AT91C_EMAC_TID.helpkey="Type ID Checking Register" +AT91C_EMAC_TID.access=memorymapped +AT91C_EMAC_TID.address=0xFFFDC0B8 +AT91C_EMAC_TID.width=32 +AT91C_EMAC_TID.byteEndian=little +AT91C_EMAC_HRB.name="AT91C_EMAC_HRB" +AT91C_EMAC_HRB.description="Hash Address Bottom[31:0]" +AT91C_EMAC_HRB.helpkey="Hash Address Bottom[31:0]" +AT91C_EMAC_HRB.access=memorymapped +AT91C_EMAC_HRB.address=0xFFFDC090 +AT91C_EMAC_HRB.width=32 +AT91C_EMAC_HRB.byteEndian=little +AT91C_EMAC_TBQP.name="AT91C_EMAC_TBQP" +AT91C_EMAC_TBQP.description="Transmit Buffer Queue Pointer" +AT91C_EMAC_TBQP.helpkey="Transmit Buffer Queue Pointer" +AT91C_EMAC_TBQP.access=memorymapped +AT91C_EMAC_TBQP.address=0xFFFDC01C +AT91C_EMAC_TBQP.width=32 +AT91C_EMAC_TBQP.byteEndian=little +AT91C_EMAC_USRIO.name="AT91C_EMAC_USRIO" +AT91C_EMAC_USRIO.description="USER Input/Output Register" +AT91C_EMAC_USRIO.helpkey="USER Input/Output Register" +AT91C_EMAC_USRIO.access=memorymapped +AT91C_EMAC_USRIO.address=0xFFFDC0C0 +AT91C_EMAC_USRIO.width=32 +AT91C_EMAC_USRIO.byteEndian=little +AT91C_EMAC_PTR.name="AT91C_EMAC_PTR" +AT91C_EMAC_PTR.description="Pause Time Register" +AT91C_EMAC_PTR.helpkey="Pause Time Register" +AT91C_EMAC_PTR.access=memorymapped +AT91C_EMAC_PTR.address=0xFFFDC038 +AT91C_EMAC_PTR.width=32 +AT91C_EMAC_PTR.byteEndian=little +AT91C_EMAC_SA2H.name="AT91C_EMAC_SA2H" +AT91C_EMAC_SA2H.description="Specific Address 2 Top, Last 2 bytes" +AT91C_EMAC_SA2H.helpkey="Specific Address 2 Top, Last 2 bytes" +AT91C_EMAC_SA2H.access=memorymapped +AT91C_EMAC_SA2H.address=0xFFFDC0A4 +AT91C_EMAC_SA2H.width=32 +AT91C_EMAC_SA2H.byteEndian=little +AT91C_EMAC_ROV.name="AT91C_EMAC_ROV" +AT91C_EMAC_ROV.description="Receive Overrun Errors Register" +AT91C_EMAC_ROV.helpkey="Receive Overrun Errors Register" +AT91C_EMAC_ROV.access=memorymapped +AT91C_EMAC_ROV.address=0xFFFDC070 +AT91C_EMAC_ROV.width=32 +AT91C_EMAC_ROV.byteEndian=little +AT91C_EMAC_ALE.name="AT91C_EMAC_ALE" +AT91C_EMAC_ALE.description="Alignment Error Register" +AT91C_EMAC_ALE.helpkey="Alignment Error Register" +AT91C_EMAC_ALE.access=memorymapped +AT91C_EMAC_ALE.address=0xFFFDC054 +AT91C_EMAC_ALE.width=32 +AT91C_EMAC_ALE.byteEndian=little +AT91C_EMAC_RJA.name="AT91C_EMAC_RJA" +AT91C_EMAC_RJA.description="Receive Jabbers Register" +AT91C_EMAC_RJA.helpkey="Receive Jabbers Register" +AT91C_EMAC_RJA.access=memorymapped +AT91C_EMAC_RJA.address=0xFFFDC07C +AT91C_EMAC_RJA.width=32 +AT91C_EMAC_RJA.byteEndian=little +AT91C_EMAC_RBQP.name="AT91C_EMAC_RBQP" +AT91C_EMAC_RBQP.description="Receive Buffer Queue Pointer" +AT91C_EMAC_RBQP.helpkey="Receive Buffer Queue Pointer" +AT91C_EMAC_RBQP.access=memorymapped +AT91C_EMAC_RBQP.address=0xFFFDC018 +AT91C_EMAC_RBQP.width=32 +AT91C_EMAC_RBQP.byteEndian=little +AT91C_EMAC_TPF.name="AT91C_EMAC_TPF" +AT91C_EMAC_TPF.description="Transmitted Pause Frames Register" +AT91C_EMAC_TPF.helpkey="Transmitted Pause Frames Register" +AT91C_EMAC_TPF.access=memorymapped +AT91C_EMAC_TPF.address=0xFFFDC08C +AT91C_EMAC_TPF.width=32 +AT91C_EMAC_TPF.byteEndian=little +AT91C_EMAC_NCFGR.name="AT91C_EMAC_NCFGR" +AT91C_EMAC_NCFGR.description="Network Configuration Register" +AT91C_EMAC_NCFGR.helpkey="Network Configuration Register" +AT91C_EMAC_NCFGR.access=memorymapped +AT91C_EMAC_NCFGR.address=0xFFFDC004 +AT91C_EMAC_NCFGR.width=32 +AT91C_EMAC_NCFGR.byteEndian=little +AT91C_EMAC_HRT.name="AT91C_EMAC_HRT" +AT91C_EMAC_HRT.description="Hash Address Top[63:32]" +AT91C_EMAC_HRT.helpkey="Hash Address Top[63:32]" +AT91C_EMAC_HRT.access=memorymapped +AT91C_EMAC_HRT.address=0xFFFDC094 +AT91C_EMAC_HRT.width=32 +AT91C_EMAC_HRT.byteEndian=little +AT91C_EMAC_USF.name="AT91C_EMAC_USF" +AT91C_EMAC_USF.description="Undersize Frames Register" +AT91C_EMAC_USF.helpkey="Undersize Frames Register" +AT91C_EMAC_USF.access=memorymapped +AT91C_EMAC_USF.address=0xFFFDC080 +AT91C_EMAC_USF.width=32 +AT91C_EMAC_USF.byteEndian=little +AT91C_EMAC_FCSE.name="AT91C_EMAC_FCSE" +AT91C_EMAC_FCSE.description="Frame Check Sequence Error Register" +AT91C_EMAC_FCSE.helpkey="Frame Check Sequence Error Register" +AT91C_EMAC_FCSE.access=memorymapped +AT91C_EMAC_FCSE.address=0xFFFDC050 +AT91C_EMAC_FCSE.width=32 +AT91C_EMAC_FCSE.byteEndian=little +AT91C_EMAC_TPQ.name="AT91C_EMAC_TPQ" +AT91C_EMAC_TPQ.description="Transmit Pause Quantum Register" +AT91C_EMAC_TPQ.helpkey="Transmit Pause Quantum Register" +AT91C_EMAC_TPQ.access=memorymapped +AT91C_EMAC_TPQ.address=0xFFFDC0BC +AT91C_EMAC_TPQ.width=32 +AT91C_EMAC_TPQ.byteEndian=little +AT91C_EMAC_MAN.name="AT91C_EMAC_MAN" +AT91C_EMAC_MAN.description="PHY Maintenance Register" +AT91C_EMAC_MAN.helpkey="PHY Maintenance Register" +AT91C_EMAC_MAN.access=memorymapped +AT91C_EMAC_MAN.address=0xFFFDC034 +AT91C_EMAC_MAN.width=32 +AT91C_EMAC_MAN.byteEndian=little +AT91C_EMAC_FTO.name="AT91C_EMAC_FTO" +AT91C_EMAC_FTO.description="Frames Transmitted OK Register" +AT91C_EMAC_FTO.helpkey="Frames Transmitted OK Register" +AT91C_EMAC_FTO.access=memorymapped +AT91C_EMAC_FTO.address=0xFFFDC040 +AT91C_EMAC_FTO.width=32 +AT91C_EMAC_FTO.byteEndian=little +AT91C_EMAC_REV.name="AT91C_EMAC_REV" +AT91C_EMAC_REV.description="Revision Register" +AT91C_EMAC_REV.helpkey="Revision Register" +AT91C_EMAC_REV.access=memorymapped +AT91C_EMAC_REV.address=0xFFFDC0FC +AT91C_EMAC_REV.width=32 +AT91C_EMAC_REV.byteEndian=little +AT91C_EMAC_REV.permission.write=none +AT91C_EMAC_IMR.name="AT91C_EMAC_IMR" +AT91C_EMAC_IMR.description="Interrupt Mask Register" +AT91C_EMAC_IMR.helpkey="Interrupt Mask Register" +AT91C_EMAC_IMR.access=memorymapped +AT91C_EMAC_IMR.address=0xFFFDC030 +AT91C_EMAC_IMR.width=32 +AT91C_EMAC_IMR.byteEndian=little +AT91C_EMAC_IMR.permission.write=none +AT91C_EMAC_SCF.name="AT91C_EMAC_SCF" +AT91C_EMAC_SCF.description="Single Collision Frame Register" +AT91C_EMAC_SCF.helpkey="Single Collision Frame Register" +AT91C_EMAC_SCF.access=memorymapped +AT91C_EMAC_SCF.address=0xFFFDC044 +AT91C_EMAC_SCF.width=32 +AT91C_EMAC_SCF.byteEndian=little +AT91C_EMAC_PFR.name="AT91C_EMAC_PFR" +AT91C_EMAC_PFR.description="Pause Frames received Register" +AT91C_EMAC_PFR.helpkey="Pause Frames received Register" +AT91C_EMAC_PFR.access=memorymapped +AT91C_EMAC_PFR.address=0xFFFDC03C +AT91C_EMAC_PFR.width=32 +AT91C_EMAC_PFR.byteEndian=little +AT91C_EMAC_MCF.name="AT91C_EMAC_MCF" +AT91C_EMAC_MCF.description="Multiple Collision Frame Register" +AT91C_EMAC_MCF.helpkey="Multiple Collision Frame Register" +AT91C_EMAC_MCF.access=memorymapped +AT91C_EMAC_MCF.address=0xFFFDC048 +AT91C_EMAC_MCF.width=32 +AT91C_EMAC_MCF.byteEndian=little +AT91C_EMAC_NSR.name="AT91C_EMAC_NSR" +AT91C_EMAC_NSR.description="Network Status Register" +AT91C_EMAC_NSR.helpkey="Network Status Register" +AT91C_EMAC_NSR.access=memorymapped +AT91C_EMAC_NSR.address=0xFFFDC008 +AT91C_EMAC_NSR.width=32 +AT91C_EMAC_NSR.byteEndian=little +AT91C_EMAC_NSR.permission.write=none +AT91C_EMAC_SA2L.name="AT91C_EMAC_SA2L" +AT91C_EMAC_SA2L.description="Specific Address 2 Bottom, First 4 bytes" +AT91C_EMAC_SA2L.helpkey="Specific Address 2 Bottom, First 4 bytes" +AT91C_EMAC_SA2L.access=memorymapped +AT91C_EMAC_SA2L.address=0xFFFDC0A0 +AT91C_EMAC_SA2L.width=32 +AT91C_EMAC_SA2L.byteEndian=little +AT91C_EMAC_FRO.name="AT91C_EMAC_FRO" +AT91C_EMAC_FRO.description="Frames Received OK Register" +AT91C_EMAC_FRO.helpkey="Frames Received OK Register" +AT91C_EMAC_FRO.access=memorymapped +AT91C_EMAC_FRO.address=0xFFFDC04C +AT91C_EMAC_FRO.width=32 +AT91C_EMAC_FRO.byteEndian=little +AT91C_EMAC_IER.name="AT91C_EMAC_IER" +AT91C_EMAC_IER.description="Interrupt Enable Register" +AT91C_EMAC_IER.helpkey="Interrupt Enable Register" +AT91C_EMAC_IER.access=memorymapped +AT91C_EMAC_IER.address=0xFFFDC028 +AT91C_EMAC_IER.width=32 +AT91C_EMAC_IER.byteEndian=little +AT91C_EMAC_IER.type=enum +AT91C_EMAC_IER.enum.0.name=*** Write only *** +AT91C_EMAC_IER.enum.1.name=Error +AT91C_EMAC_SA1H.name="AT91C_EMAC_SA1H" +AT91C_EMAC_SA1H.description="Specific Address 1 Top, Last 2 bytes" +AT91C_EMAC_SA1H.helpkey="Specific Address 1 Top, Last 2 bytes" +AT91C_EMAC_SA1H.access=memorymapped +AT91C_EMAC_SA1H.address=0xFFFDC09C +AT91C_EMAC_SA1H.width=32 +AT91C_EMAC_SA1H.byteEndian=little +AT91C_EMAC_CSE.name="AT91C_EMAC_CSE" +AT91C_EMAC_CSE.description="Carrier Sense Error Register" +AT91C_EMAC_CSE.helpkey="Carrier Sense Error Register" +AT91C_EMAC_CSE.access=memorymapped +AT91C_EMAC_CSE.address=0xFFFDC068 +AT91C_EMAC_CSE.width=32 +AT91C_EMAC_CSE.byteEndian=little +AT91C_EMAC_SA3H.name="AT91C_EMAC_SA3H" +AT91C_EMAC_SA3H.description="Specific Address 3 Top, Last 2 bytes" +AT91C_EMAC_SA3H.helpkey="Specific Address 3 Top, Last 2 bytes" +AT91C_EMAC_SA3H.access=memorymapped +AT91C_EMAC_SA3H.address=0xFFFDC0AC +AT91C_EMAC_SA3H.width=32 +AT91C_EMAC_SA3H.byteEndian=little +AT91C_EMAC_RRE.name="AT91C_EMAC_RRE" +AT91C_EMAC_RRE.description="Receive Ressource Error Register" +AT91C_EMAC_RRE.helpkey="Receive Ressource Error Register" +AT91C_EMAC_RRE.access=memorymapped +AT91C_EMAC_RRE.address=0xFFFDC06C +AT91C_EMAC_RRE.width=32 +AT91C_EMAC_RRE.byteEndian=little +AT91C_EMAC_STE.name="AT91C_EMAC_STE" +AT91C_EMAC_STE.description="SQE Test Error Register" +AT91C_EMAC_STE.helpkey="SQE Test Error Register" +AT91C_EMAC_STE.access=memorymapped +AT91C_EMAC_STE.address=0xFFFDC084 +AT91C_EMAC_STE.width=32 +AT91C_EMAC_STE.byteEndian=little +# ========== Register definition for PDC_ADC peripheral ========== +AT91C_ADC_PTSR.name="AT91C_ADC_PTSR" +AT91C_ADC_PTSR.description="PDC Transfer Status Register" +AT91C_ADC_PTSR.helpkey="PDC Transfer Status Register" +AT91C_ADC_PTSR.access=memorymapped +AT91C_ADC_PTSR.address=0xFFFD8124 +AT91C_ADC_PTSR.width=32 +AT91C_ADC_PTSR.byteEndian=little +AT91C_ADC_PTSR.permission.write=none +AT91C_ADC_PTCR.name="AT91C_ADC_PTCR" +AT91C_ADC_PTCR.description="PDC Transfer Control Register" +AT91C_ADC_PTCR.helpkey="PDC Transfer Control Register" +AT91C_ADC_PTCR.access=memorymapped +AT91C_ADC_PTCR.address=0xFFFD8120 +AT91C_ADC_PTCR.width=32 +AT91C_ADC_PTCR.byteEndian=little +AT91C_ADC_PTCR.type=enum +AT91C_ADC_PTCR.enum.0.name=*** Write only *** +AT91C_ADC_PTCR.enum.1.name=Error +AT91C_ADC_TNPR.name="AT91C_ADC_TNPR" +AT91C_ADC_TNPR.description="Transmit Next Pointer Register" +AT91C_ADC_TNPR.helpkey="Transmit Next Pointer Register" +AT91C_ADC_TNPR.access=memorymapped +AT91C_ADC_TNPR.address=0xFFFD8118 +AT91C_ADC_TNPR.width=32 +AT91C_ADC_TNPR.byteEndian=little +AT91C_ADC_TNCR.name="AT91C_ADC_TNCR" +AT91C_ADC_TNCR.description="Transmit Next Counter Register" +AT91C_ADC_TNCR.helpkey="Transmit Next Counter Register" +AT91C_ADC_TNCR.access=memorymapped +AT91C_ADC_TNCR.address=0xFFFD811C +AT91C_ADC_TNCR.width=32 +AT91C_ADC_TNCR.byteEndian=little +AT91C_ADC_RNPR.name="AT91C_ADC_RNPR" +AT91C_ADC_RNPR.description="Receive Next Pointer Register" +AT91C_ADC_RNPR.helpkey="Receive Next Pointer Register" +AT91C_ADC_RNPR.access=memorymapped +AT91C_ADC_RNPR.address=0xFFFD8110 +AT91C_ADC_RNPR.width=32 +AT91C_ADC_RNPR.byteEndian=little +AT91C_ADC_RNCR.name="AT91C_ADC_RNCR" +AT91C_ADC_RNCR.description="Receive Next Counter Register" +AT91C_ADC_RNCR.helpkey="Receive Next Counter Register" +AT91C_ADC_RNCR.access=memorymapped +AT91C_ADC_RNCR.address=0xFFFD8114 +AT91C_ADC_RNCR.width=32 +AT91C_ADC_RNCR.byteEndian=little +AT91C_ADC_RPR.name="AT91C_ADC_RPR" +AT91C_ADC_RPR.description="Receive Pointer Register" +AT91C_ADC_RPR.helpkey="Receive Pointer Register" +AT91C_ADC_RPR.access=memorymapped +AT91C_ADC_RPR.address=0xFFFD8100 +AT91C_ADC_RPR.width=32 +AT91C_ADC_RPR.byteEndian=little +AT91C_ADC_TCR.name="AT91C_ADC_TCR" +AT91C_ADC_TCR.description="Transmit Counter Register" +AT91C_ADC_TCR.helpkey="Transmit Counter Register" +AT91C_ADC_TCR.access=memorymapped +AT91C_ADC_TCR.address=0xFFFD810C +AT91C_ADC_TCR.width=32 +AT91C_ADC_TCR.byteEndian=little +AT91C_ADC_TPR.name="AT91C_ADC_TPR" +AT91C_ADC_TPR.description="Transmit Pointer Register" +AT91C_ADC_TPR.helpkey="Transmit Pointer Register" +AT91C_ADC_TPR.access=memorymapped +AT91C_ADC_TPR.address=0xFFFD8108 +AT91C_ADC_TPR.width=32 +AT91C_ADC_TPR.byteEndian=little +AT91C_ADC_RCR.name="AT91C_ADC_RCR" +AT91C_ADC_RCR.description="Receive Counter Register" +AT91C_ADC_RCR.helpkey="Receive Counter Register" +AT91C_ADC_RCR.access=memorymapped +AT91C_ADC_RCR.address=0xFFFD8104 +AT91C_ADC_RCR.width=32 +AT91C_ADC_RCR.byteEndian=little +# ========== Register definition for ADC peripheral ========== +AT91C_ADC_CDR2.name="AT91C_ADC_CDR2" +AT91C_ADC_CDR2.description="ADC Channel Data Register 2" +AT91C_ADC_CDR2.helpkey="ADC Channel Data Register 2" +AT91C_ADC_CDR2.access=memorymapped +AT91C_ADC_CDR2.address=0xFFFD8038 +AT91C_ADC_CDR2.width=32 +AT91C_ADC_CDR2.byteEndian=little +AT91C_ADC_CDR2.permission.write=none +AT91C_ADC_CDR3.name="AT91C_ADC_CDR3" +AT91C_ADC_CDR3.description="ADC Channel Data Register 3" +AT91C_ADC_CDR3.helpkey="ADC Channel Data Register 3" +AT91C_ADC_CDR3.access=memorymapped +AT91C_ADC_CDR3.address=0xFFFD803C +AT91C_ADC_CDR3.width=32 +AT91C_ADC_CDR3.byteEndian=little +AT91C_ADC_CDR3.permission.write=none +AT91C_ADC_CDR0.name="AT91C_ADC_CDR0" +AT91C_ADC_CDR0.description="ADC Channel Data Register 0" +AT91C_ADC_CDR0.helpkey="ADC Channel Data Register 0" +AT91C_ADC_CDR0.access=memorymapped +AT91C_ADC_CDR0.address=0xFFFD8030 +AT91C_ADC_CDR0.width=32 +AT91C_ADC_CDR0.byteEndian=little +AT91C_ADC_CDR0.permission.write=none +AT91C_ADC_CDR5.name="AT91C_ADC_CDR5" +AT91C_ADC_CDR5.description="ADC Channel Data Register 5" +AT91C_ADC_CDR5.helpkey="ADC Channel Data Register 5" +AT91C_ADC_CDR5.access=memorymapped +AT91C_ADC_CDR5.address=0xFFFD8044 +AT91C_ADC_CDR5.width=32 +AT91C_ADC_CDR5.byteEndian=little +AT91C_ADC_CDR5.permission.write=none +AT91C_ADC_CHDR.name="AT91C_ADC_CHDR" +AT91C_ADC_CHDR.description="ADC Channel Disable Register" +AT91C_ADC_CHDR.helpkey="ADC Channel Disable Register" +AT91C_ADC_CHDR.access=memorymapped +AT91C_ADC_CHDR.address=0xFFFD8014 +AT91C_ADC_CHDR.width=32 +AT91C_ADC_CHDR.byteEndian=little +AT91C_ADC_CHDR.type=enum +AT91C_ADC_CHDR.enum.0.name=*** Write only *** +AT91C_ADC_CHDR.enum.1.name=Error +AT91C_ADC_SR.name="AT91C_ADC_SR" +AT91C_ADC_SR.description="ADC Status Register" +AT91C_ADC_SR.helpkey="ADC Status Register" +AT91C_ADC_SR.access=memorymapped +AT91C_ADC_SR.address=0xFFFD801C +AT91C_ADC_SR.width=32 +AT91C_ADC_SR.byteEndian=little +AT91C_ADC_SR.permission.write=none +AT91C_ADC_CDR4.name="AT91C_ADC_CDR4" +AT91C_ADC_CDR4.description="ADC Channel Data Register 4" +AT91C_ADC_CDR4.helpkey="ADC Channel Data Register 4" +AT91C_ADC_CDR4.access=memorymapped +AT91C_ADC_CDR4.address=0xFFFD8040 +AT91C_ADC_CDR4.width=32 +AT91C_ADC_CDR4.byteEndian=little +AT91C_ADC_CDR4.permission.write=none +AT91C_ADC_CDR1.name="AT91C_ADC_CDR1" +AT91C_ADC_CDR1.description="ADC Channel Data Register 1" +AT91C_ADC_CDR1.helpkey="ADC Channel Data Register 1" +AT91C_ADC_CDR1.access=memorymapped +AT91C_ADC_CDR1.address=0xFFFD8034 +AT91C_ADC_CDR1.width=32 +AT91C_ADC_CDR1.byteEndian=little +AT91C_ADC_CDR1.permission.write=none +AT91C_ADC_LCDR.name="AT91C_ADC_LCDR" +AT91C_ADC_LCDR.description="ADC Last Converted Data Register" +AT91C_ADC_LCDR.helpkey="ADC Last Converted Data Register" +AT91C_ADC_LCDR.access=memorymapped +AT91C_ADC_LCDR.address=0xFFFD8020 +AT91C_ADC_LCDR.width=32 +AT91C_ADC_LCDR.byteEndian=little +AT91C_ADC_LCDR.permission.write=none +AT91C_ADC_IDR.name="AT91C_ADC_IDR" +AT91C_ADC_IDR.description="ADC Interrupt Disable Register" +AT91C_ADC_IDR.helpkey="ADC Interrupt Disable Register" +AT91C_ADC_IDR.access=memorymapped +AT91C_ADC_IDR.address=0xFFFD8028 +AT91C_ADC_IDR.width=32 +AT91C_ADC_IDR.byteEndian=little +AT91C_ADC_IDR.type=enum +AT91C_ADC_IDR.enum.0.name=*** Write only *** +AT91C_ADC_IDR.enum.1.name=Error +AT91C_ADC_CR.name="AT91C_ADC_CR" +AT91C_ADC_CR.description="ADC Control Register" +AT91C_ADC_CR.helpkey="ADC Control Register" +AT91C_ADC_CR.access=memorymapped +AT91C_ADC_CR.address=0xFFFD8000 +AT91C_ADC_CR.width=32 +AT91C_ADC_CR.byteEndian=little +AT91C_ADC_CR.type=enum +AT91C_ADC_CR.enum.0.name=*** Write only *** +AT91C_ADC_CR.enum.1.name=Error +AT91C_ADC_CDR7.name="AT91C_ADC_CDR7" +AT91C_ADC_CDR7.description="ADC Channel Data Register 7" +AT91C_ADC_CDR7.helpkey="ADC Channel Data Register 7" +AT91C_ADC_CDR7.access=memorymapped +AT91C_ADC_CDR7.address=0xFFFD804C +AT91C_ADC_CDR7.width=32 +AT91C_ADC_CDR7.byteEndian=little +AT91C_ADC_CDR7.permission.write=none +AT91C_ADC_CDR6.name="AT91C_ADC_CDR6" +AT91C_ADC_CDR6.description="ADC Channel Data Register 6" +AT91C_ADC_CDR6.helpkey="ADC Channel Data Register 6" +AT91C_ADC_CDR6.access=memorymapped +AT91C_ADC_CDR6.address=0xFFFD8048 +AT91C_ADC_CDR6.width=32 +AT91C_ADC_CDR6.byteEndian=little +AT91C_ADC_CDR6.permission.write=none +AT91C_ADC_IER.name="AT91C_ADC_IER" +AT91C_ADC_IER.description="ADC Interrupt Enable Register" +AT91C_ADC_IER.helpkey="ADC Interrupt Enable Register" +AT91C_ADC_IER.access=memorymapped +AT91C_ADC_IER.address=0xFFFD8024 +AT91C_ADC_IER.width=32 +AT91C_ADC_IER.byteEndian=little +AT91C_ADC_IER.type=enum +AT91C_ADC_IER.enum.0.name=*** Write only *** +AT91C_ADC_IER.enum.1.name=Error +AT91C_ADC_CHER.name="AT91C_ADC_CHER" +AT91C_ADC_CHER.description="ADC Channel Enable Register" +AT91C_ADC_CHER.helpkey="ADC Channel Enable Register" +AT91C_ADC_CHER.access=memorymapped +AT91C_ADC_CHER.address=0xFFFD8010 +AT91C_ADC_CHER.width=32 +AT91C_ADC_CHER.byteEndian=little +AT91C_ADC_CHER.type=enum +AT91C_ADC_CHER.enum.0.name=*** Write only *** +AT91C_ADC_CHER.enum.1.name=Error +AT91C_ADC_CHSR.name="AT91C_ADC_CHSR" +AT91C_ADC_CHSR.description="ADC Channel Status Register" +AT91C_ADC_CHSR.helpkey="ADC Channel Status Register" +AT91C_ADC_CHSR.access=memorymapped +AT91C_ADC_CHSR.address=0xFFFD8018 +AT91C_ADC_CHSR.width=32 +AT91C_ADC_CHSR.byteEndian=little +AT91C_ADC_CHSR.permission.write=none +AT91C_ADC_MR.name="AT91C_ADC_MR" +AT91C_ADC_MR.description="ADC Mode Register" +AT91C_ADC_MR.helpkey="ADC Mode Register" +AT91C_ADC_MR.access=memorymapped +AT91C_ADC_MR.address=0xFFFD8004 +AT91C_ADC_MR.width=32 +AT91C_ADC_MR.byteEndian=little +AT91C_ADC_IMR.name="AT91C_ADC_IMR" +AT91C_ADC_IMR.description="ADC Interrupt Mask Register" +AT91C_ADC_IMR.helpkey="ADC Interrupt Mask Register" +AT91C_ADC_IMR.access=memorymapped +AT91C_ADC_IMR.address=0xFFFD802C +AT91C_ADC_IMR.width=32 +AT91C_ADC_IMR.byteEndian=little +AT91C_ADC_IMR.permission.write=none +# ========== Group definition for SYS peripheral ========== +group.SYS.description="ATMEL SYS Registers" +group.SYS.helpkey="ATMEL SYS Registers" +# ========== Group definition for AIC peripheral ========== +group.AIC.description="ATMEL AIC Registers" +group.AIC.helpkey="ATMEL AIC Registers" +group.AIC.register.0=AT91C_AIC_IVR +group.AIC.register.1=AT91C_AIC_SMR +group.AIC.register.2=AT91C_AIC_FVR +group.AIC.register.3=AT91C_AIC_DCR +group.AIC.register.4=AT91C_AIC_EOICR +group.AIC.register.5=AT91C_AIC_SVR +group.AIC.register.6=AT91C_AIC_FFSR +group.AIC.register.7=AT91C_AIC_ICCR +group.AIC.register.8=AT91C_AIC_ISR +group.AIC.register.9=AT91C_AIC_IMR +group.AIC.register.10=AT91C_AIC_IPR +group.AIC.register.11=AT91C_AIC_FFER +group.AIC.register.12=AT91C_AIC_IECR +group.AIC.register.13=AT91C_AIC_ISCR +group.AIC.register.14=AT91C_AIC_FFDR +group.AIC.register.15=AT91C_AIC_CISR +group.AIC.register.16=AT91C_AIC_IDCR +group.AIC.register.17=AT91C_AIC_SPU +# ========== Group definition for PDC_DBGU peripheral ========== +group.PDC_DBGU.description="ATMEL PDC_DBGU Registers" +group.PDC_DBGU.helpkey="ATMEL PDC_DBGU Registers" +group.PDC_DBGU.register.0=AT91C_DBGU_TCR +group.PDC_DBGU.register.1=AT91C_DBGU_RNPR +group.PDC_DBGU.register.2=AT91C_DBGU_TNPR +group.PDC_DBGU.register.3=AT91C_DBGU_TPR +group.PDC_DBGU.register.4=AT91C_DBGU_RPR +group.PDC_DBGU.register.5=AT91C_DBGU_RCR +group.PDC_DBGU.register.6=AT91C_DBGU_RNCR +group.PDC_DBGU.register.7=AT91C_DBGU_PTCR +group.PDC_DBGU.register.8=AT91C_DBGU_PTSR +group.PDC_DBGU.register.9=AT91C_DBGU_TNCR +# ========== Group definition for DBGU peripheral ========== +group.DBGU.description="ATMEL DBGU Registers" +group.DBGU.helpkey="ATMEL DBGU Registers" +group.DBGU.register.0=AT91C_DBGU_EXID +group.DBGU.register.1=AT91C_DBGU_BRGR +group.DBGU.register.2=AT91C_DBGU_IDR +group.DBGU.register.3=AT91C_DBGU_CSR +group.DBGU.register.4=AT91C_DBGU_CIDR +group.DBGU.register.5=AT91C_DBGU_MR +group.DBGU.register.6=AT91C_DBGU_IMR +group.DBGU.register.7=AT91C_DBGU_CR +group.DBGU.register.8=AT91C_DBGU_FNTR +group.DBGU.register.9=AT91C_DBGU_THR +group.DBGU.register.10=AT91C_DBGU_RHR +group.DBGU.register.11=AT91C_DBGU_IER +# ========== Group definition for PIOA peripheral ========== +group.PIOA.description="ATMEL PIOA Registers" +group.PIOA.helpkey="ATMEL PIOA Registers" +group.PIOA.register.0=AT91C_PIOA_ODR +group.PIOA.register.1=AT91C_PIOA_SODR +group.PIOA.register.2=AT91C_PIOA_ISR +group.PIOA.register.3=AT91C_PIOA_ABSR +group.PIOA.register.4=AT91C_PIOA_IER +group.PIOA.register.5=AT91C_PIOA_PPUDR +group.PIOA.register.6=AT91C_PIOA_IMR +group.PIOA.register.7=AT91C_PIOA_PER +group.PIOA.register.8=AT91C_PIOA_IFDR +group.PIOA.register.9=AT91C_PIOA_OWDR +group.PIOA.register.10=AT91C_PIOA_MDSR +group.PIOA.register.11=AT91C_PIOA_IDR +group.PIOA.register.12=AT91C_PIOA_ODSR +group.PIOA.register.13=AT91C_PIOA_PPUSR +group.PIOA.register.14=AT91C_PIOA_OWSR +group.PIOA.register.15=AT91C_PIOA_BSR +group.PIOA.register.16=AT91C_PIOA_OWER +group.PIOA.register.17=AT91C_PIOA_IFER +group.PIOA.register.18=AT91C_PIOA_PDSR +group.PIOA.register.19=AT91C_PIOA_PPUER +group.PIOA.register.20=AT91C_PIOA_OSR +group.PIOA.register.21=AT91C_PIOA_ASR +group.PIOA.register.22=AT91C_PIOA_MDDR +group.PIOA.register.23=AT91C_PIOA_CODR +group.PIOA.register.24=AT91C_PIOA_MDER +group.PIOA.register.25=AT91C_PIOA_PDR +group.PIOA.register.26=AT91C_PIOA_IFSR +group.PIOA.register.27=AT91C_PIOA_OER +group.PIOA.register.28=AT91C_PIOA_PSR +# ========== Group definition for PIOB peripheral ========== +group.PIOB.description="ATMEL PIOB Registers" +group.PIOB.helpkey="ATMEL PIOB Registers" +group.PIOB.register.0=AT91C_PIOB_OWDR +group.PIOB.register.1=AT91C_PIOB_MDER +group.PIOB.register.2=AT91C_PIOB_PPUSR +group.PIOB.register.3=AT91C_PIOB_IMR +group.PIOB.register.4=AT91C_PIOB_ASR +group.PIOB.register.5=AT91C_PIOB_PPUDR +group.PIOB.register.6=AT91C_PIOB_PSR +group.PIOB.register.7=AT91C_PIOB_IER +group.PIOB.register.8=AT91C_PIOB_CODR +group.PIOB.register.9=AT91C_PIOB_OWER +group.PIOB.register.10=AT91C_PIOB_ABSR +group.PIOB.register.11=AT91C_PIOB_IFDR +group.PIOB.register.12=AT91C_PIOB_PDSR +group.PIOB.register.13=AT91C_PIOB_IDR +group.PIOB.register.14=AT91C_PIOB_OWSR +group.PIOB.register.15=AT91C_PIOB_PDR +group.PIOB.register.16=AT91C_PIOB_ODR +group.PIOB.register.17=AT91C_PIOB_IFSR +group.PIOB.register.18=AT91C_PIOB_PPUER +group.PIOB.register.19=AT91C_PIOB_SODR +group.PIOB.register.20=AT91C_PIOB_ISR +group.PIOB.register.21=AT91C_PIOB_ODSR +group.PIOB.register.22=AT91C_PIOB_OSR +group.PIOB.register.23=AT91C_PIOB_MDSR +group.PIOB.register.24=AT91C_PIOB_IFER +group.PIOB.register.25=AT91C_PIOB_BSR +group.PIOB.register.26=AT91C_PIOB_MDDR +group.PIOB.register.27=AT91C_PIOB_OER +group.PIOB.register.28=AT91C_PIOB_PER +# ========== Group definition for CKGR peripheral ========== +group.CKGR.description="ATMEL CKGR Registers" +group.CKGR.helpkey="ATMEL CKGR Registers" +group.CKGR.register.0=AT91C_CKGR_MOR +group.CKGR.register.1=AT91C_CKGR_PLLR +group.CKGR.register.2=AT91C_CKGR_MCFR +# ========== Group definition for PMC peripheral ========== +group.PMC.description="ATMEL PMC Registers" +group.PMC.helpkey="ATMEL PMC Registers" +group.PMC.register.0=AT91C_PMC_IDR +group.PMC.register.1=AT91C_PMC_MOR +group.PMC.register.2=AT91C_PMC_PLLR +group.PMC.register.3=AT91C_PMC_PCER +group.PMC.register.4=AT91C_PMC_PCKR +group.PMC.register.5=AT91C_PMC_MCKR +group.PMC.register.6=AT91C_PMC_SCDR +group.PMC.register.7=AT91C_PMC_PCDR +group.PMC.register.8=AT91C_PMC_SCSR +group.PMC.register.9=AT91C_PMC_PCSR +group.PMC.register.10=AT91C_PMC_MCFR +group.PMC.register.11=AT91C_PMC_SCER +group.PMC.register.12=AT91C_PMC_IMR +group.PMC.register.13=AT91C_PMC_IER +group.PMC.register.14=AT91C_PMC_SR +# ========== Group definition for RSTC peripheral ========== +group.RSTC.description="ATMEL RSTC Registers" +group.RSTC.helpkey="ATMEL RSTC Registers" +group.RSTC.register.0=AT91C_RSTC_RCR +group.RSTC.register.1=AT91C_RSTC_RMR +group.RSTC.register.2=AT91C_RSTC_RSR +# ========== Group definition for RTTC peripheral ========== +group.RTTC.description="ATMEL RTTC Registers" +group.RTTC.helpkey="ATMEL RTTC Registers" +group.RTTC.register.0=AT91C_RTTC_RTSR +group.RTTC.register.1=AT91C_RTTC_RTMR +group.RTTC.register.2=AT91C_RTTC_RTVR +group.RTTC.register.3=AT91C_RTTC_RTAR +# ========== Group definition for PITC peripheral ========== +group.PITC.description="ATMEL PITC Registers" +group.PITC.helpkey="ATMEL PITC Registers" +group.PITC.register.0=AT91C_PITC_PIVR +group.PITC.register.1=AT91C_PITC_PISR +group.PITC.register.2=AT91C_PITC_PIIR +group.PITC.register.3=AT91C_PITC_PIMR +# ========== Group definition for WDTC peripheral ========== +group.WDTC.description="ATMEL WDTC Registers" +group.WDTC.helpkey="ATMEL WDTC Registers" +group.WDTC.register.0=AT91C_WDTC_WDCR +group.WDTC.register.1=AT91C_WDTC_WDSR +group.WDTC.register.2=AT91C_WDTC_WDMR +# ========== Group definition for VREG peripheral ========== +group.VREG.description="ATMEL VREG Registers" +group.VREG.helpkey="ATMEL VREG Registers" +group.VREG.register.0=AT91C_VREG_MR +# ========== Group definition for MC peripheral ========== +group.MC.description="ATMEL MC Registers" +group.MC.helpkey="ATMEL MC Registers" +group.MC.register.0=AT91C_MC_ASR +group.MC.register.1=AT91C_MC_RCR +group.MC.register.2=AT91C_MC_FCR +group.MC.register.3=AT91C_MC_AASR +group.MC.register.4=AT91C_MC_FSR +group.MC.register.5=AT91C_MC_FMR +# ========== Group definition for PDC_SPI1 peripheral ========== +group.PDC_SPI1.description="ATMEL PDC_SPI1 Registers" +group.PDC_SPI1.helpkey="ATMEL PDC_SPI1 Registers" +group.PDC_SPI1.register.0=AT91C_SPI1_PTCR +group.PDC_SPI1.register.1=AT91C_SPI1_RPR +group.PDC_SPI1.register.2=AT91C_SPI1_TNCR +group.PDC_SPI1.register.3=AT91C_SPI1_TPR +group.PDC_SPI1.register.4=AT91C_SPI1_TNPR +group.PDC_SPI1.register.5=AT91C_SPI1_TCR +group.PDC_SPI1.register.6=AT91C_SPI1_RCR +group.PDC_SPI1.register.7=AT91C_SPI1_RNPR +group.PDC_SPI1.register.8=AT91C_SPI1_RNCR +group.PDC_SPI1.register.9=AT91C_SPI1_PTSR +# ========== Group definition for SPI1 peripheral ========== +group.SPI1.description="ATMEL SPI1 Registers" +group.SPI1.helpkey="ATMEL SPI1 Registers" +group.SPI1.register.0=AT91C_SPI1_IMR +group.SPI1.register.1=AT91C_SPI1_IER +group.SPI1.register.2=AT91C_SPI1_MR +group.SPI1.register.3=AT91C_SPI1_RDR +group.SPI1.register.4=AT91C_SPI1_IDR +group.SPI1.register.5=AT91C_SPI1_SR +group.SPI1.register.6=AT91C_SPI1_TDR +group.SPI1.register.7=AT91C_SPI1_CR +group.SPI1.register.8=AT91C_SPI1_CSR +# ========== Group definition for PDC_SPI0 peripheral ========== +group.PDC_SPI0.description="ATMEL PDC_SPI0 Registers" +group.PDC_SPI0.helpkey="ATMEL PDC_SPI0 Registers" +group.PDC_SPI0.register.0=AT91C_SPI0_PTCR +group.PDC_SPI0.register.1=AT91C_SPI0_TPR +group.PDC_SPI0.register.2=AT91C_SPI0_TCR +group.PDC_SPI0.register.3=AT91C_SPI0_RCR +group.PDC_SPI0.register.4=AT91C_SPI0_PTSR +group.PDC_SPI0.register.5=AT91C_SPI0_RNPR +group.PDC_SPI0.register.6=AT91C_SPI0_RPR +group.PDC_SPI0.register.7=AT91C_SPI0_TNCR +group.PDC_SPI0.register.8=AT91C_SPI0_RNCR +group.PDC_SPI0.register.9=AT91C_SPI0_TNPR +# ========== Group definition for SPI0 peripheral ========== +group.SPI0.description="ATMEL SPI0 Registers" +group.SPI0.helpkey="ATMEL SPI0 Registers" +group.SPI0.register.0=AT91C_SPI0_IER +group.SPI0.register.1=AT91C_SPI0_SR +group.SPI0.register.2=AT91C_SPI0_IDR +group.SPI0.register.3=AT91C_SPI0_CR +group.SPI0.register.4=AT91C_SPI0_MR +group.SPI0.register.5=AT91C_SPI0_IMR +group.SPI0.register.6=AT91C_SPI0_TDR +group.SPI0.register.7=AT91C_SPI0_RDR +group.SPI0.register.8=AT91C_SPI0_CSR +# ========== Group definition for PDC_US1 peripheral ========== +group.PDC_US1.description="ATMEL PDC_US1 Registers" +group.PDC_US1.helpkey="ATMEL PDC_US1 Registers" +group.PDC_US1.register.0=AT91C_US1_RNCR +group.PDC_US1.register.1=AT91C_US1_PTCR +group.PDC_US1.register.2=AT91C_US1_TCR +group.PDC_US1.register.3=AT91C_US1_PTSR +group.PDC_US1.register.4=AT91C_US1_TNPR +group.PDC_US1.register.5=AT91C_US1_RCR +group.PDC_US1.register.6=AT91C_US1_RNPR +group.PDC_US1.register.7=AT91C_US1_RPR +group.PDC_US1.register.8=AT91C_US1_TNCR +group.PDC_US1.register.9=AT91C_US1_TPR +# ========== Group definition for US1 peripheral ========== +group.US1.description="ATMEL US1 Registers" +group.US1.helpkey="ATMEL US1 Registers" +group.US1.register.0=AT91C_US1_IF +group.US1.register.1=AT91C_US1_NER +group.US1.register.2=AT91C_US1_RTOR +group.US1.register.3=AT91C_US1_CSR +group.US1.register.4=AT91C_US1_IDR +group.US1.register.5=AT91C_US1_IER +group.US1.register.6=AT91C_US1_THR +group.US1.register.7=AT91C_US1_TTGR +group.US1.register.8=AT91C_US1_RHR +group.US1.register.9=AT91C_US1_BRGR +group.US1.register.10=AT91C_US1_IMR +group.US1.register.11=AT91C_US1_FIDI +group.US1.register.12=AT91C_US1_CR +group.US1.register.13=AT91C_US1_MR +# ========== Group definition for PDC_US0 peripheral ========== +group.PDC_US0.description="ATMEL PDC_US0 Registers" +group.PDC_US0.helpkey="ATMEL PDC_US0 Registers" +group.PDC_US0.register.0=AT91C_US0_TNPR +group.PDC_US0.register.1=AT91C_US0_RNPR +group.PDC_US0.register.2=AT91C_US0_TCR +group.PDC_US0.register.3=AT91C_US0_PTCR +group.PDC_US0.register.4=AT91C_US0_PTSR +group.PDC_US0.register.5=AT91C_US0_TNCR +group.PDC_US0.register.6=AT91C_US0_TPR +group.PDC_US0.register.7=AT91C_US0_RCR +group.PDC_US0.register.8=AT91C_US0_RPR +group.PDC_US0.register.9=AT91C_US0_RNCR +# ========== Group definition for US0 peripheral ========== +group.US0.description="ATMEL US0 Registers" +group.US0.helpkey="ATMEL US0 Registers" +group.US0.register.0=AT91C_US0_BRGR +group.US0.register.1=AT91C_US0_NER +group.US0.register.2=AT91C_US0_CR +group.US0.register.3=AT91C_US0_IMR +group.US0.register.4=AT91C_US0_FIDI +group.US0.register.5=AT91C_US0_TTGR +group.US0.register.6=AT91C_US0_MR +group.US0.register.7=AT91C_US0_RTOR +group.US0.register.8=AT91C_US0_CSR +group.US0.register.9=AT91C_US0_RHR +group.US0.register.10=AT91C_US0_IDR +group.US0.register.11=AT91C_US0_THR +group.US0.register.12=AT91C_US0_IF +group.US0.register.13=AT91C_US0_IER +# ========== Group definition for PDC_SSC peripheral ========== +group.PDC_SSC.description="ATMEL PDC_SSC Registers" +group.PDC_SSC.helpkey="ATMEL PDC_SSC Registers" +group.PDC_SSC.register.0=AT91C_SSC_TNCR +group.PDC_SSC.register.1=AT91C_SSC_RPR +group.PDC_SSC.register.2=AT91C_SSC_RNCR +group.PDC_SSC.register.3=AT91C_SSC_TPR +group.PDC_SSC.register.4=AT91C_SSC_PTCR +group.PDC_SSC.register.5=AT91C_SSC_TCR +group.PDC_SSC.register.6=AT91C_SSC_RCR +group.PDC_SSC.register.7=AT91C_SSC_RNPR +group.PDC_SSC.register.8=AT91C_SSC_TNPR +group.PDC_SSC.register.9=AT91C_SSC_PTSR +# ========== Group definition for SSC peripheral ========== +group.SSC.description="ATMEL SSC Registers" +group.SSC.helpkey="ATMEL SSC Registers" +group.SSC.register.0=AT91C_SSC_RHR +group.SSC.register.1=AT91C_SSC_RSHR +group.SSC.register.2=AT91C_SSC_TFMR +group.SSC.register.3=AT91C_SSC_IDR +group.SSC.register.4=AT91C_SSC_THR +group.SSC.register.5=AT91C_SSC_RCMR +group.SSC.register.6=AT91C_SSC_IER +group.SSC.register.7=AT91C_SSC_TSHR +group.SSC.register.8=AT91C_SSC_SR +group.SSC.register.9=AT91C_SSC_CMR +group.SSC.register.10=AT91C_SSC_TCMR +group.SSC.register.11=AT91C_SSC_CR +group.SSC.register.12=AT91C_SSC_IMR +group.SSC.register.13=AT91C_SSC_RFMR +# ========== Group definition for TWI peripheral ========== +group.TWI.description="ATMEL TWI Registers" +group.TWI.helpkey="ATMEL TWI Registers" +group.TWI.register.0=AT91C_TWI_IER +group.TWI.register.1=AT91C_TWI_CR +group.TWI.register.2=AT91C_TWI_SR +group.TWI.register.3=AT91C_TWI_IMR +group.TWI.register.4=AT91C_TWI_THR +group.TWI.register.5=AT91C_TWI_IDR +group.TWI.register.6=AT91C_TWI_IADR +group.TWI.register.7=AT91C_TWI_MMR +group.TWI.register.8=AT91C_TWI_CWGR +group.TWI.register.9=AT91C_TWI_RHR +# ========== Group definition for PWMC_CH3 peripheral ========== +group.PWMC_CH3.description="ATMEL PWMC_CH3 Registers" +group.PWMC_CH3.helpkey="ATMEL PWMC_CH3 Registers" +group.PWMC_CH3.register.0=AT91C_PWMC_CH3_CUPDR +group.PWMC_CH3.register.1=AT91C_PWMC_CH3_Reserved +group.PWMC_CH3.register.2=AT91C_PWMC_CH3_CPRDR +group.PWMC_CH3.register.3=AT91C_PWMC_CH3_CDTYR +group.PWMC_CH3.register.4=AT91C_PWMC_CH3_CCNTR +group.PWMC_CH3.register.5=AT91C_PWMC_CH3_CMR +# ========== Group definition for PWMC_CH2 peripheral ========== +group.PWMC_CH2.description="ATMEL PWMC_CH2 Registers" +group.PWMC_CH2.helpkey="ATMEL PWMC_CH2 Registers" +group.PWMC_CH2.register.0=AT91C_PWMC_CH2_Reserved +group.PWMC_CH2.register.1=AT91C_PWMC_CH2_CMR +group.PWMC_CH2.register.2=AT91C_PWMC_CH2_CCNTR +group.PWMC_CH2.register.3=AT91C_PWMC_CH2_CPRDR +group.PWMC_CH2.register.4=AT91C_PWMC_CH2_CUPDR +group.PWMC_CH2.register.5=AT91C_PWMC_CH2_CDTYR +# ========== Group definition for PWMC_CH1 peripheral ========== +group.PWMC_CH1.description="ATMEL PWMC_CH1 Registers" +group.PWMC_CH1.helpkey="ATMEL PWMC_CH1 Registers" +group.PWMC_CH1.register.0=AT91C_PWMC_CH1_Reserved +group.PWMC_CH1.register.1=AT91C_PWMC_CH1_CUPDR +group.PWMC_CH1.register.2=AT91C_PWMC_CH1_CPRDR +group.PWMC_CH1.register.3=AT91C_PWMC_CH1_CCNTR +group.PWMC_CH1.register.4=AT91C_PWMC_CH1_CDTYR +group.PWMC_CH1.register.5=AT91C_PWMC_CH1_CMR +# ========== Group definition for PWMC_CH0 peripheral ========== +group.PWMC_CH0.description="ATMEL PWMC_CH0 Registers" +group.PWMC_CH0.helpkey="ATMEL PWMC_CH0 Registers" +group.PWMC_CH0.register.0=AT91C_PWMC_CH0_Reserved +group.PWMC_CH0.register.1=AT91C_PWMC_CH0_CPRDR +group.PWMC_CH0.register.2=AT91C_PWMC_CH0_CDTYR +group.PWMC_CH0.register.3=AT91C_PWMC_CH0_CMR +group.PWMC_CH0.register.4=AT91C_PWMC_CH0_CUPDR +group.PWMC_CH0.register.5=AT91C_PWMC_CH0_CCNTR +# ========== Group definition for PWMC peripheral ========== +group.PWMC.description="ATMEL PWMC Registers" +group.PWMC.helpkey="ATMEL PWMC Registers" +group.PWMC.register.0=AT91C_PWMC_IDR +group.PWMC.register.1=AT91C_PWMC_DIS +group.PWMC.register.2=AT91C_PWMC_IER +group.PWMC.register.3=AT91C_PWMC_VR +group.PWMC.register.4=AT91C_PWMC_ISR +group.PWMC.register.5=AT91C_PWMC_SR +group.PWMC.register.6=AT91C_PWMC_IMR +group.PWMC.register.7=AT91C_PWMC_MR +group.PWMC.register.8=AT91C_PWMC_ENA +# ========== Group definition for UDP peripheral ========== +group.UDP.description="ATMEL UDP Registers" +group.UDP.helpkey="ATMEL UDP Registers" +group.UDP.register.0=AT91C_UDP_IMR +group.UDP.register.1=AT91C_UDP_FADDR +group.UDP.register.2=AT91C_UDP_NUM +group.UDP.register.3=AT91C_UDP_FDR +group.UDP.register.4=AT91C_UDP_ISR +group.UDP.register.5=AT91C_UDP_CSR +group.UDP.register.6=AT91C_UDP_IDR +group.UDP.register.7=AT91C_UDP_ICR +group.UDP.register.8=AT91C_UDP_RSTEP +group.UDP.register.9=AT91C_UDP_TXVC +group.UDP.register.10=AT91C_UDP_GLBSTATE +group.UDP.register.11=AT91C_UDP_IER +# ========== Group definition for TC0 peripheral ========== +group.TC0.description="ATMEL TC0 Registers" +group.TC0.helpkey="ATMEL TC0 Registers" +group.TC0.register.0=AT91C_TC0_SR +group.TC0.register.1=AT91C_TC0_RC +group.TC0.register.2=AT91C_TC0_RB +group.TC0.register.3=AT91C_TC0_CCR +group.TC0.register.4=AT91C_TC0_CMR +group.TC0.register.5=AT91C_TC0_IER +group.TC0.register.6=AT91C_TC0_RA +group.TC0.register.7=AT91C_TC0_IDR +group.TC0.register.8=AT91C_TC0_CV +group.TC0.register.9=AT91C_TC0_IMR +# ========== Group definition for TC1 peripheral ========== +group.TC1.description="ATMEL TC1 Registers" +group.TC1.helpkey="ATMEL TC1 Registers" +group.TC1.register.0=AT91C_TC1_RB +group.TC1.register.1=AT91C_TC1_CCR +group.TC1.register.2=AT91C_TC1_IER +group.TC1.register.3=AT91C_TC1_IDR +group.TC1.register.4=AT91C_TC1_SR +group.TC1.register.5=AT91C_TC1_CMR +group.TC1.register.6=AT91C_TC1_RA +group.TC1.register.7=AT91C_TC1_RC +group.TC1.register.8=AT91C_TC1_IMR +group.TC1.register.9=AT91C_TC1_CV +# ========== Group definition for TC2 peripheral ========== +group.TC2.description="ATMEL TC2 Registers" +group.TC2.helpkey="ATMEL TC2 Registers" +group.TC2.register.0=AT91C_TC2_CMR +group.TC2.register.1=AT91C_TC2_CCR +group.TC2.register.2=AT91C_TC2_CV +group.TC2.register.3=AT91C_TC2_RA +group.TC2.register.4=AT91C_TC2_RB +group.TC2.register.5=AT91C_TC2_IDR +group.TC2.register.6=AT91C_TC2_IMR +group.TC2.register.7=AT91C_TC2_RC +group.TC2.register.8=AT91C_TC2_IER +group.TC2.register.9=AT91C_TC2_SR +# ========== Group definition for TCB peripheral ========== +group.TCB.description="ATMEL TCB Registers" +group.TCB.helpkey="ATMEL TCB Registers" +group.TCB.register.0=AT91C_TCB_BMR +group.TCB.register.1=AT91C_TCB_BCR +# ========== Group definition for CAN_MB0 peripheral ========== +group.CAN_MB0.description="ATMEL CAN_MB0 Registers" +group.CAN_MB0.helpkey="ATMEL CAN_MB0 Registers" +group.CAN_MB0.register.0=AT91C_CAN_MB0_MDL +group.CAN_MB0.register.1=AT91C_CAN_MB0_MAM +group.CAN_MB0.register.2=AT91C_CAN_MB0_MCR +group.CAN_MB0.register.3=AT91C_CAN_MB0_MID +group.CAN_MB0.register.4=AT91C_CAN_MB0_MSR +group.CAN_MB0.register.5=AT91C_CAN_MB0_MFID +group.CAN_MB0.register.6=AT91C_CAN_MB0_MDH +group.CAN_MB0.register.7=AT91C_CAN_MB0_MMR +# ========== Group definition for CAN_MB1 peripheral ========== +group.CAN_MB1.description="ATMEL CAN_MB1 Registers" +group.CAN_MB1.helpkey="ATMEL CAN_MB1 Registers" +group.CAN_MB1.register.0=AT91C_CAN_MB1_MDL +group.CAN_MB1.register.1=AT91C_CAN_MB1_MID +group.CAN_MB1.register.2=AT91C_CAN_MB1_MMR +group.CAN_MB1.register.3=AT91C_CAN_MB1_MSR +group.CAN_MB1.register.4=AT91C_CAN_MB1_MAM +group.CAN_MB1.register.5=AT91C_CAN_MB1_MDH +group.CAN_MB1.register.6=AT91C_CAN_MB1_MCR +group.CAN_MB1.register.7=AT91C_CAN_MB1_MFID +# ========== Group definition for CAN_MB2 peripheral ========== +group.CAN_MB2.description="ATMEL CAN_MB2 Registers" +group.CAN_MB2.helpkey="ATMEL CAN_MB2 Registers" +group.CAN_MB2.register.0=AT91C_CAN_MB2_MCR +group.CAN_MB2.register.1=AT91C_CAN_MB2_MDH +group.CAN_MB2.register.2=AT91C_CAN_MB2_MID +group.CAN_MB2.register.3=AT91C_CAN_MB2_MDL +group.CAN_MB2.register.4=AT91C_CAN_MB2_MMR +group.CAN_MB2.register.5=AT91C_CAN_MB2_MAM +group.CAN_MB2.register.6=AT91C_CAN_MB2_MFID +group.CAN_MB2.register.7=AT91C_CAN_MB2_MSR +# ========== Group definition for CAN_MB3 peripheral ========== +group.CAN_MB3.description="ATMEL CAN_MB3 Registers" +group.CAN_MB3.helpkey="ATMEL CAN_MB3 Registers" +group.CAN_MB3.register.0=AT91C_CAN_MB3_MFID +group.CAN_MB3.register.1=AT91C_CAN_MB3_MAM +group.CAN_MB3.register.2=AT91C_CAN_MB3_MID +group.CAN_MB3.register.3=AT91C_CAN_MB3_MCR +group.CAN_MB3.register.4=AT91C_CAN_MB3_MMR +group.CAN_MB3.register.5=AT91C_CAN_MB3_MSR +group.CAN_MB3.register.6=AT91C_CAN_MB3_MDL +group.CAN_MB3.register.7=AT91C_CAN_MB3_MDH +# ========== Group definition for CAN_MB4 peripheral ========== +group.CAN_MB4.description="ATMEL CAN_MB4 Registers" +group.CAN_MB4.helpkey="ATMEL CAN_MB4 Registers" +group.CAN_MB4.register.0=AT91C_CAN_MB4_MID +group.CAN_MB4.register.1=AT91C_CAN_MB4_MMR +group.CAN_MB4.register.2=AT91C_CAN_MB4_MDH +group.CAN_MB4.register.3=AT91C_CAN_MB4_MFID +group.CAN_MB4.register.4=AT91C_CAN_MB4_MSR +group.CAN_MB4.register.5=AT91C_CAN_MB4_MCR +group.CAN_MB4.register.6=AT91C_CAN_MB4_MDL +group.CAN_MB4.register.7=AT91C_CAN_MB4_MAM +# ========== Group definition for CAN_MB5 peripheral ========== +group.CAN_MB5.description="ATMEL CAN_MB5 Registers" +group.CAN_MB5.helpkey="ATMEL CAN_MB5 Registers" +group.CAN_MB5.register.0=AT91C_CAN_MB5_MSR +group.CAN_MB5.register.1=AT91C_CAN_MB5_MCR +group.CAN_MB5.register.2=AT91C_CAN_MB5_MFID +group.CAN_MB5.register.3=AT91C_CAN_MB5_MDH +group.CAN_MB5.register.4=AT91C_CAN_MB5_MID +group.CAN_MB5.register.5=AT91C_CAN_MB5_MMR +group.CAN_MB5.register.6=AT91C_CAN_MB5_MDL +group.CAN_MB5.register.7=AT91C_CAN_MB5_MAM +# ========== Group definition for CAN_MB6 peripheral ========== +group.CAN_MB6.description="ATMEL CAN_MB6 Registers" +group.CAN_MB6.helpkey="ATMEL CAN_MB6 Registers" +group.CAN_MB6.register.0=AT91C_CAN_MB6_MFID +group.CAN_MB6.register.1=AT91C_CAN_MB6_MID +group.CAN_MB6.register.2=AT91C_CAN_MB6_MAM +group.CAN_MB6.register.3=AT91C_CAN_MB6_MSR +group.CAN_MB6.register.4=AT91C_CAN_MB6_MDL +group.CAN_MB6.register.5=AT91C_CAN_MB6_MCR +group.CAN_MB6.register.6=AT91C_CAN_MB6_MDH +group.CAN_MB6.register.7=AT91C_CAN_MB6_MMR +# ========== Group definition for CAN_MB7 peripheral ========== +group.CAN_MB7.description="ATMEL CAN_MB7 Registers" +group.CAN_MB7.helpkey="ATMEL CAN_MB7 Registers" +group.CAN_MB7.register.0=AT91C_CAN_MB7_MCR +group.CAN_MB7.register.1=AT91C_CAN_MB7_MDH +group.CAN_MB7.register.2=AT91C_CAN_MB7_MFID +group.CAN_MB7.register.3=AT91C_CAN_MB7_MDL +group.CAN_MB7.register.4=AT91C_CAN_MB7_MID +group.CAN_MB7.register.5=AT91C_CAN_MB7_MMR +group.CAN_MB7.register.6=AT91C_CAN_MB7_MAM +group.CAN_MB7.register.7=AT91C_CAN_MB7_MSR +# ========== Group definition for CAN peripheral ========== +group.CAN.description="ATMEL CAN Registers" +group.CAN.helpkey="ATMEL CAN Registers" +group.CAN.register.0=AT91C_CAN_TCR +group.CAN.register.1=AT91C_CAN_IMR +group.CAN.register.2=AT91C_CAN_IER +group.CAN.register.3=AT91C_CAN_ECR +group.CAN.register.4=AT91C_CAN_TIMESTP +group.CAN.register.5=AT91C_CAN_MR +group.CAN.register.6=AT91C_CAN_IDR +group.CAN.register.7=AT91C_CAN_ACR +group.CAN.register.8=AT91C_CAN_TIM +group.CAN.register.9=AT91C_CAN_SR +group.CAN.register.10=AT91C_CAN_BR +group.CAN.register.11=AT91C_CAN_VR +# ========== Group definition for EMAC peripheral ========== +group.EMAC.description="ATMEL EMAC Registers" +group.EMAC.helpkey="ATMEL EMAC Registers" +group.EMAC.register.0=AT91C_EMAC_ISR +group.EMAC.register.1=AT91C_EMAC_SA4H +group.EMAC.register.2=AT91C_EMAC_SA1L +group.EMAC.register.3=AT91C_EMAC_ELE +group.EMAC.register.4=AT91C_EMAC_LCOL +group.EMAC.register.5=AT91C_EMAC_RLE +group.EMAC.register.6=AT91C_EMAC_WOL +group.EMAC.register.7=AT91C_EMAC_DTF +group.EMAC.register.8=AT91C_EMAC_TUND +group.EMAC.register.9=AT91C_EMAC_NCR +group.EMAC.register.10=AT91C_EMAC_SA4L +group.EMAC.register.11=AT91C_EMAC_RSR +group.EMAC.register.12=AT91C_EMAC_SA3L +group.EMAC.register.13=AT91C_EMAC_TSR +group.EMAC.register.14=AT91C_EMAC_IDR +group.EMAC.register.15=AT91C_EMAC_RSE +group.EMAC.register.16=AT91C_EMAC_ECOL +group.EMAC.register.17=AT91C_EMAC_TID +group.EMAC.register.18=AT91C_EMAC_HRB +group.EMAC.register.19=AT91C_EMAC_TBQP +group.EMAC.register.20=AT91C_EMAC_USRIO +group.EMAC.register.21=AT91C_EMAC_PTR +group.EMAC.register.22=AT91C_EMAC_SA2H +group.EMAC.register.23=AT91C_EMAC_ROV +group.EMAC.register.24=AT91C_EMAC_ALE +group.EMAC.register.25=AT91C_EMAC_RJA +group.EMAC.register.26=AT91C_EMAC_RBQP +group.EMAC.register.27=AT91C_EMAC_TPF +group.EMAC.register.28=AT91C_EMAC_NCFGR +group.EMAC.register.29=AT91C_EMAC_HRT +group.EMAC.register.30=AT91C_EMAC_USF +group.EMAC.register.31=AT91C_EMAC_FCSE +group.EMAC.register.32=AT91C_EMAC_TPQ +group.EMAC.register.33=AT91C_EMAC_MAN +group.EMAC.register.34=AT91C_EMAC_FTO +group.EMAC.register.35=AT91C_EMAC_REV +group.EMAC.register.36=AT91C_EMAC_IMR +group.EMAC.register.37=AT91C_EMAC_SCF +group.EMAC.register.38=AT91C_EMAC_PFR +group.EMAC.register.39=AT91C_EMAC_MCF +group.EMAC.register.40=AT91C_EMAC_NSR +group.EMAC.register.41=AT91C_EMAC_SA2L +group.EMAC.register.42=AT91C_EMAC_FRO +group.EMAC.register.43=AT91C_EMAC_IER +group.EMAC.register.44=AT91C_EMAC_SA1H +group.EMAC.register.45=AT91C_EMAC_CSE +group.EMAC.register.46=AT91C_EMAC_SA3H +group.EMAC.register.47=AT91C_EMAC_RRE +group.EMAC.register.48=AT91C_EMAC_STE +# ========== Group definition for PDC_ADC peripheral ========== +group.PDC_ADC.description="ATMEL PDC_ADC Registers" +group.PDC_ADC.helpkey="ATMEL PDC_ADC Registers" +group.PDC_ADC.register.0=AT91C_ADC_PTSR +group.PDC_ADC.register.1=AT91C_ADC_PTCR +group.PDC_ADC.register.2=AT91C_ADC_TNPR +group.PDC_ADC.register.3=AT91C_ADC_TNCR +group.PDC_ADC.register.4=AT91C_ADC_RNPR +group.PDC_ADC.register.5=AT91C_ADC_RNCR +group.PDC_ADC.register.6=AT91C_ADC_RPR +group.PDC_ADC.register.7=AT91C_ADC_TCR +group.PDC_ADC.register.8=AT91C_ADC_TPR +group.PDC_ADC.register.9=AT91C_ADC_RCR +# ========== Group definition for ADC peripheral ========== +group.ADC.description="ATMEL ADC Registers" +group.ADC.helpkey="ATMEL ADC Registers" +group.ADC.register.0=AT91C_ADC_CDR2 +group.ADC.register.1=AT91C_ADC_CDR3 +group.ADC.register.2=AT91C_ADC_CDR0 +group.ADC.register.3=AT91C_ADC_CDR5 +group.ADC.register.4=AT91C_ADC_CHDR +group.ADC.register.5=AT91C_ADC_SR +group.ADC.register.6=AT91C_ADC_CDR4 +group.ADC.register.7=AT91C_ADC_CDR1 +group.ADC.register.8=AT91C_ADC_LCDR +group.ADC.register.9=AT91C_ADC_IDR +group.ADC.register.10=AT91C_ADC_CR +group.ADC.register.11=AT91C_ADC_CDR7 +group.ADC.register.12=AT91C_ADC_CDR6 +group.ADC.register.13=AT91C_ADC_IER +group.ADC.register.14=AT91C_ADC_CHER +group.ADC.register.15=AT91C_ADC_CHSR +group.ADC.register.16=AT91C_ADC_MR +group.ADC.register.17=AT91C_ADC_IMR +group.AT91SAM7X256.description="ATMEL AT91SAM7X256 Registers" +group.AT91SAM7X256.helpkey="ATMEL AT91SAM7X256 Registers" +group.AT91SAM7X256.topLevelIndex=100 +group.AT91SAM7X256.group.0=SYS +group.AT91SAM7X256.group.1=AIC +group.AT91SAM7X256.group.2=PDC_DBGU +group.AT91SAM7X256.group.3=DBGU +group.AT91SAM7X256.group.4=PIOA +group.AT91SAM7X256.group.5=PIOB +group.AT91SAM7X256.group.6=CKGR +group.AT91SAM7X256.group.7=PMC +group.AT91SAM7X256.group.8=RSTC +group.AT91SAM7X256.group.9=RTTC +group.AT91SAM7X256.group.10=PITC +group.AT91SAM7X256.group.11=WDTC +group.AT91SAM7X256.group.12=VREG +group.AT91SAM7X256.group.13=MC +group.AT91SAM7X256.group.14=PDC_SPI1 +group.AT91SAM7X256.group.15=SPI1 +group.AT91SAM7X256.group.16=PDC_SPI0 +group.AT91SAM7X256.group.17=SPI0 +group.AT91SAM7X256.group.18=PDC_US1 +group.AT91SAM7X256.group.19=US1 +group.AT91SAM7X256.group.20=PDC_US0 +group.AT91SAM7X256.group.21=US0 +group.AT91SAM7X256.group.22=PDC_SSC +group.AT91SAM7X256.group.23=SSC +group.AT91SAM7X256.group.24=TWI +group.AT91SAM7X256.group.25=PWMC_CH3 +group.AT91SAM7X256.group.26=PWMC_CH2 +group.AT91SAM7X256.group.27=PWMC_CH1 +group.AT91SAM7X256.group.28=PWMC_CH0 +group.AT91SAM7X256.group.29=PWMC +group.AT91SAM7X256.group.30=UDP +group.AT91SAM7X256.group.31=TC0 +group.AT91SAM7X256.group.32=TC1 +group.AT91SAM7X256.group.33=TC2 +group.AT91SAM7X256.group.34=TCB +group.AT91SAM7X256.group.35=CAN_MB0 +group.AT91SAM7X256.group.36=CAN_MB1 +group.AT91SAM7X256.group.37=CAN_MB2 +group.AT91SAM7X256.group.38=CAN_MB3 +group.AT91SAM7X256.group.39=CAN_MB4 +group.AT91SAM7X256.group.40=CAN_MB5 +group.AT91SAM7X256.group.41=CAN_MB6 +group.AT91SAM7X256.group.42=CAN_MB7 +group.AT91SAM7X256.group.43=CAN +group.AT91SAM7X256.group.44=EMAC +group.AT91SAM7X256.group.45=PDC_ADC +group.AT91SAM7X256.group.46=ADC diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.tcl b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.tcl new file mode 100644 index 0000000..5d3a662 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.tcl @@ -0,0 +1,3407 @@ +# ---------------------------------------------------------------------------- +# ATMEL Microcontroller Software Support - ROUSSET - +# ---------------------------------------------------------------------------- +# DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +# DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ---------------------------------------------------------------------------- +# File Name : AT91SAM7X256.tcl +# Object : AT91SAM7X256 definitions +# Generated : AT91 SW Application Group 11/02/2005 (15:17:30) +# +# CVS Reference : /AT91SAM7X256.pl/1.14/Tue Sep 13 15:06:52 2005// +# CVS Reference : /SYS_SAM7X.pl/1.3/Tue Feb 1 17:01:43 2005// +# CVS Reference : /MC_SAM7X.pl/1.2/Fri May 20 14:13:04 2005// +# CVS Reference : /PMC_SAM7X.pl/1.4/Tue Feb 8 13:58:10 2005// +# CVS Reference : /RSTC_SAM7X.pl/1.2/Wed Jul 13 14:57:50 2005// +# CVS Reference : /UDP_SAM7X.pl/1.1/Tue May 10 11:35:35 2005// +# CVS Reference : /PWM_SAM7X.pl/1.1/Tue May 10 11:53:07 2005// +# CVS Reference : /AIC_6075B.pl/1.3/Fri May 20 14:01:30 2005// +# CVS Reference : /PIO_6057A.pl/1.2/Thu Feb 3 10:18:28 2005// +# CVS Reference : /RTTC_6081A.pl/1.2/Tue Nov 9 14:43:58 2004// +# CVS Reference : /PITC_6079A.pl/1.2/Tue Nov 9 14:43:56 2004// +# CVS Reference : /WDTC_6080A.pl/1.3/Tue Nov 9 14:44:00 2004// +# CVS Reference : /VREG_6085B.pl/1.1/Tue Feb 1 16:05:48 2005// +# CVS Reference : /PDC_6074C.pl/1.2/Thu Feb 3 08:48:54 2005// +# CVS Reference : /DBGU_6059D.pl/1.1/Mon Jan 31 13:15:32 2005// +# CVS Reference : /SPI_6088D.pl/1.3/Fri May 20 14:08:59 2005// +# CVS Reference : /US_6089C.pl/1.1/Mon Jul 12 18:23:26 2004// +# CVS Reference : /SSC_6078B.pl/1.1/Wed Jul 13 15:19:19 2005// +# CVS Reference : /TWI_6061A.pl/1.1/Tue Jul 13 07:38:06 2004// +# CVS Reference : /TC_6082A.pl/1.7/Fri Mar 11 12:52:17 2005// +# CVS Reference : /CAN_6019B.pl/1.1/Tue Mar 8 12:42:22 2005// +# CVS Reference : /EMACB_6119A.pl/1.6/Wed Jul 13 15:05:35 2005// +# CVS Reference : /ADC_6051C.pl/1.1/Fri Oct 17 09:12:38 2003// +# ---------------------------------------------------------------------------- + + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR System Peripherals +# ***************************************************************************** + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Advanced Interrupt Controller +# ***************************************************************************** +# -------- AIC_SMR : (AIC Offset: 0x0) Control Register -------- +set AT91C_AIC_PRIOR [expr 0x7 << 0 ] +set AT91C_AIC_PRIOR_LOWEST 0x0 +set AT91C_AIC_PRIOR_HIGHEST 0x7 +set AT91C_AIC_SRCTYPE [expr 0x3 << 5 ] +set AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL [expr 0x0 << 5 ] +set AT91C_AIC_SRCTYPE_EXT_LOW_LEVEL [expr 0x0 << 5 ] +set AT91C_AIC_SRCTYPE_INT_POSITIVE_EDGE [expr 0x1 << 5 ] +set AT91C_AIC_SRCTYPE_EXT_NEGATIVE_EDGE [expr 0x1 << 5 ] +set AT91C_AIC_SRCTYPE_HIGH_LEVEL [expr 0x2 << 5 ] +set AT91C_AIC_SRCTYPE_POSITIVE_EDGE [expr 0x3 << 5 ] +# -------- AIC_CISR : (AIC Offset: 0x114) AIC Core Interrupt Status Register -------- +set AT91C_AIC_NFIQ [expr 0x1 << 0 ] +set AT91C_AIC_NIRQ [expr 0x1 << 1 ] +# -------- AIC_DCR : (AIC Offset: 0x138) AIC Debug Control Register (Protect) -------- +set AT91C_AIC_DCR_PROT [expr 0x1 << 0 ] +set AT91C_AIC_DCR_GMSK [expr 0x1 << 1 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Peripheral DMA Controller +# ***************************************************************************** +# -------- PDC_PTCR : (PDC Offset: 0x20) PDC Transfer Control Register -------- +set AT91C_PDC_RXTEN [expr 0x1 << 0 ] +set AT91C_PDC_RXTDIS [expr 0x1 << 1 ] +set AT91C_PDC_TXTEN [expr 0x1 << 8 ] +set AT91C_PDC_TXTDIS [expr 0x1 << 9 ] +# -------- PDC_PTSR : (PDC Offset: 0x24) PDC Transfer Status Register -------- +set AT91C_PDC_RXTEN [expr 0x1 << 0 ] +set AT91C_PDC_TXTEN [expr 0x1 << 8 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Debug Unit +# ***************************************************************************** +# -------- DBGU_CR : (DBGU Offset: 0x0) Debug Unit Control Register -------- +set AT91C_US_RSTRX [expr 0x1 << 2 ] +set AT91C_US_RSTTX [expr 0x1 << 3 ] +set AT91C_US_RXEN [expr 0x1 << 4 ] +set AT91C_US_RXDIS [expr 0x1 << 5 ] +set AT91C_US_TXEN [expr 0x1 << 6 ] +set AT91C_US_TXDIS [expr 0x1 << 7 ] +set AT91C_US_RSTSTA [expr 0x1 << 8 ] +# -------- DBGU_MR : (DBGU Offset: 0x4) Debug Unit Mode Register -------- +set AT91C_US_PAR [expr 0x7 << 9 ] +set AT91C_US_PAR_EVEN [expr 0x0 << 9 ] +set AT91C_US_PAR_ODD [expr 0x1 << 9 ] +set AT91C_US_PAR_SPACE [expr 0x2 << 9 ] +set AT91C_US_PAR_MARK [expr 0x3 << 9 ] +set AT91C_US_PAR_NONE [expr 0x4 << 9 ] +set AT91C_US_PAR_MULTI_DROP [expr 0x6 << 9 ] +set AT91C_US_CHMODE [expr 0x3 << 14 ] +set AT91C_US_CHMODE_NORMAL [expr 0x0 << 14 ] +set AT91C_US_CHMODE_AUTO [expr 0x1 << 14 ] +set AT91C_US_CHMODE_LOCAL [expr 0x2 << 14 ] +set AT91C_US_CHMODE_REMOTE [expr 0x3 << 14 ] +# -------- DBGU_IER : (DBGU Offset: 0x8) Debug Unit Interrupt Enable Register -------- +set AT91C_US_RXRDY [expr 0x1 << 0 ] +set AT91C_US_TXRDY [expr 0x1 << 1 ] +set AT91C_US_ENDRX [expr 0x1 << 3 ] +set AT91C_US_ENDTX [expr 0x1 << 4 ] +set AT91C_US_OVRE [expr 0x1 << 5 ] +set AT91C_US_FRAME [expr 0x1 << 6 ] +set AT91C_US_PARE [expr 0x1 << 7 ] +set AT91C_US_TXEMPTY [expr 0x1 << 9 ] +set AT91C_US_TXBUFE [expr 0x1 << 11 ] +set AT91C_US_RXBUFF [expr 0x1 << 12 ] +set AT91C_US_COMM_TX [expr 0x1 << 30 ] +set AT91C_US_COMM_RX [expr 0x1 << 31 ] +# -------- DBGU_IDR : (DBGU Offset: 0xc) Debug Unit Interrupt Disable Register -------- +set AT91C_US_RXRDY [expr 0x1 << 0 ] +set AT91C_US_TXRDY [expr 0x1 << 1 ] +set AT91C_US_ENDRX [expr 0x1 << 3 ] +set AT91C_US_ENDTX [expr 0x1 << 4 ] +set AT91C_US_OVRE [expr 0x1 << 5 ] +set AT91C_US_FRAME [expr 0x1 << 6 ] +set AT91C_US_PARE [expr 0x1 << 7 ] +set AT91C_US_TXEMPTY [expr 0x1 << 9 ] +set AT91C_US_TXBUFE [expr 0x1 << 11 ] +set AT91C_US_RXBUFF [expr 0x1 << 12 ] +set AT91C_US_COMM_TX [expr 0x1 << 30 ] +set AT91C_US_COMM_RX [expr 0x1 << 31 ] +# -------- DBGU_IMR : (DBGU Offset: 0x10) Debug Unit Interrupt Mask Register -------- +set AT91C_US_RXRDY [expr 0x1 << 0 ] +set AT91C_US_TXRDY [expr 0x1 << 1 ] +set AT91C_US_ENDRX [expr 0x1 << 3 ] +set AT91C_US_ENDTX [expr 0x1 << 4 ] +set AT91C_US_OVRE [expr 0x1 << 5 ] +set AT91C_US_FRAME [expr 0x1 << 6 ] +set AT91C_US_PARE [expr 0x1 << 7 ] +set AT91C_US_TXEMPTY [expr 0x1 << 9 ] +set AT91C_US_TXBUFE [expr 0x1 << 11 ] +set AT91C_US_RXBUFF [expr 0x1 << 12 ] +set AT91C_US_COMM_TX [expr 0x1 << 30 ] +set AT91C_US_COMM_RX [expr 0x1 << 31 ] +# -------- DBGU_CSR : (DBGU Offset: 0x14) Debug Unit Channel Status Register -------- +set AT91C_US_RXRDY [expr 0x1 << 0 ] +set AT91C_US_TXRDY [expr 0x1 << 1 ] +set AT91C_US_ENDRX [expr 0x1 << 3 ] +set AT91C_US_ENDTX [expr 0x1 << 4 ] +set AT91C_US_OVRE [expr 0x1 << 5 ] +set AT91C_US_FRAME [expr 0x1 << 6 ] +set AT91C_US_PARE [expr 0x1 << 7 ] +set AT91C_US_TXEMPTY [expr 0x1 << 9 ] +set AT91C_US_TXBUFE [expr 0x1 << 11 ] +set AT91C_US_RXBUFF [expr 0x1 << 12 ] +set AT91C_US_COMM_TX [expr 0x1 << 30 ] +set AT91C_US_COMM_RX [expr 0x1 << 31 ] +# -------- DBGU_FNTR : (DBGU Offset: 0x48) Debug Unit FORCE_NTRST Register -------- +set AT91C_US_FORCE_NTRST [expr 0x1 << 0 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Parallel Input Output Controler +# ***************************************************************************** + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Clock Generator Controler +# ***************************************************************************** +# -------- CKGR_MOR : (CKGR Offset: 0x0) Main Oscillator Register -------- +set AT91C_CKGR_MOSCEN [expr 0x1 << 0 ] +set AT91C_CKGR_OSCBYPASS [expr 0x1 << 1 ] +set AT91C_CKGR_OSCOUNT [expr 0xFF << 8 ] +# -------- CKGR_MCFR : (CKGR Offset: 0x4) Main Clock Frequency Register -------- +set AT91C_CKGR_MAINF [expr 0xFFFF << 0 ] +set AT91C_CKGR_MAINRDY [expr 0x1 << 16 ] +# -------- CKGR_PLLR : (CKGR Offset: 0xc) PLL B Register -------- +set AT91C_CKGR_DIV [expr 0xFF << 0 ] +set AT91C_CKGR_DIV_0 0x0 +set AT91C_CKGR_DIV_BYPASS 0x1 +set AT91C_CKGR_PLLCOUNT [expr 0x3F << 8 ] +set AT91C_CKGR_OUT [expr 0x3 << 14 ] +set AT91C_CKGR_OUT_0 [expr 0x0 << 14 ] +set AT91C_CKGR_OUT_1 [expr 0x1 << 14 ] +set AT91C_CKGR_OUT_2 [expr 0x2 << 14 ] +set AT91C_CKGR_OUT_3 [expr 0x3 << 14 ] +set AT91C_CKGR_MUL [expr 0x7FF << 16 ] +set AT91C_CKGR_USBDIV [expr 0x3 << 28 ] +set AT91C_CKGR_USBDIV_0 [expr 0x0 << 28 ] +set AT91C_CKGR_USBDIV_1 [expr 0x1 << 28 ] +set AT91C_CKGR_USBDIV_2 [expr 0x2 << 28 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Power Management Controler +# ***************************************************************************** +# -------- PMC_SCER : (PMC Offset: 0x0) System Clock Enable Register -------- +set AT91C_PMC_PCK [expr 0x1 << 0 ] +set AT91C_PMC_UDP [expr 0x1 << 7 ] +set AT91C_PMC_PCK0 [expr 0x1 << 8 ] +set AT91C_PMC_PCK1 [expr 0x1 << 9 ] +set AT91C_PMC_PCK2 [expr 0x1 << 10 ] +set AT91C_PMC_PCK3 [expr 0x1 << 11 ] +# -------- PMC_SCDR : (PMC Offset: 0x4) System Clock Disable Register -------- +set AT91C_PMC_PCK [expr 0x1 << 0 ] +set AT91C_PMC_UDP [expr 0x1 << 7 ] +set AT91C_PMC_PCK0 [expr 0x1 << 8 ] +set AT91C_PMC_PCK1 [expr 0x1 << 9 ] +set AT91C_PMC_PCK2 [expr 0x1 << 10 ] +set AT91C_PMC_PCK3 [expr 0x1 << 11 ] +# -------- PMC_SCSR : (PMC Offset: 0x8) System Clock Status Register -------- +set AT91C_PMC_PCK [expr 0x1 << 0 ] +set AT91C_PMC_UDP [expr 0x1 << 7 ] +set AT91C_PMC_PCK0 [expr 0x1 << 8 ] +set AT91C_PMC_PCK1 [expr 0x1 << 9 ] +set AT91C_PMC_PCK2 [expr 0x1 << 10 ] +set AT91C_PMC_PCK3 [expr 0x1 << 11 ] +# -------- CKGR_MOR : (PMC Offset: 0x20) Main Oscillator Register -------- +set AT91C_CKGR_MOSCEN [expr 0x1 << 0 ] +set AT91C_CKGR_OSCBYPASS [expr 0x1 << 1 ] +set AT91C_CKGR_OSCOUNT [expr 0xFF << 8 ] +# -------- CKGR_MCFR : (PMC Offset: 0x24) Main Clock Frequency Register -------- +set AT91C_CKGR_MAINF [expr 0xFFFF << 0 ] +set AT91C_CKGR_MAINRDY [expr 0x1 << 16 ] +# -------- CKGR_PLLR : (PMC Offset: 0x2c) PLL B Register -------- +set AT91C_CKGR_DIV [expr 0xFF << 0 ] +set AT91C_CKGR_DIV_0 0x0 +set AT91C_CKGR_DIV_BYPASS 0x1 +set AT91C_CKGR_PLLCOUNT [expr 0x3F << 8 ] +set AT91C_CKGR_OUT [expr 0x3 << 14 ] +set AT91C_CKGR_OUT_0 [expr 0x0 << 14 ] +set AT91C_CKGR_OUT_1 [expr 0x1 << 14 ] +set AT91C_CKGR_OUT_2 [expr 0x2 << 14 ] +set AT91C_CKGR_OUT_3 [expr 0x3 << 14 ] +set AT91C_CKGR_MUL [expr 0x7FF << 16 ] +set AT91C_CKGR_USBDIV [expr 0x3 << 28 ] +set AT91C_CKGR_USBDIV_0 [expr 0x0 << 28 ] +set AT91C_CKGR_USBDIV_1 [expr 0x1 << 28 ] +set AT91C_CKGR_USBDIV_2 [expr 0x2 << 28 ] +# -------- PMC_MCKR : (PMC Offset: 0x30) Master Clock Register -------- +set AT91C_PMC_CSS [expr 0x3 << 0 ] +set AT91C_PMC_CSS_SLOW_CLK 0x0 +set AT91C_PMC_CSS_MAIN_CLK 0x1 +set AT91C_PMC_CSS_PLL_CLK 0x3 +set AT91C_PMC_PRES [expr 0x7 << 2 ] +set AT91C_PMC_PRES_CLK [expr 0x0 << 2 ] +set AT91C_PMC_PRES_CLK_2 [expr 0x1 << 2 ] +set AT91C_PMC_PRES_CLK_4 [expr 0x2 << 2 ] +set AT91C_PMC_PRES_CLK_8 [expr 0x3 << 2 ] +set AT91C_PMC_PRES_CLK_16 [expr 0x4 << 2 ] +set AT91C_PMC_PRES_CLK_32 [expr 0x5 << 2 ] +set AT91C_PMC_PRES_CLK_64 [expr 0x6 << 2 ] +# -------- PMC_PCKR : (PMC Offset: 0x40) Programmable Clock Register -------- +set AT91C_PMC_CSS [expr 0x3 << 0 ] +set AT91C_PMC_CSS_SLOW_CLK 0x0 +set AT91C_PMC_CSS_MAIN_CLK 0x1 +set AT91C_PMC_CSS_PLL_CLK 0x3 +set AT91C_PMC_PRES [expr 0x7 << 2 ] +set AT91C_PMC_PRES_CLK [expr 0x0 << 2 ] +set AT91C_PMC_PRES_CLK_2 [expr 0x1 << 2 ] +set AT91C_PMC_PRES_CLK_4 [expr 0x2 << 2 ] +set AT91C_PMC_PRES_CLK_8 [expr 0x3 << 2 ] +set AT91C_PMC_PRES_CLK_16 [expr 0x4 << 2 ] +set AT91C_PMC_PRES_CLK_32 [expr 0x5 << 2 ] +set AT91C_PMC_PRES_CLK_64 [expr 0x6 << 2 ] +# -------- PMC_IER : (PMC Offset: 0x60) PMC Interrupt Enable Register -------- +set AT91C_PMC_MOSCS [expr 0x1 << 0 ] +set AT91C_PMC_LOCK [expr 0x1 << 2 ] +set AT91C_PMC_MCKRDY [expr 0x1 << 3 ] +set AT91C_PMC_PCK0RDY [expr 0x1 << 8 ] +set AT91C_PMC_PCK1RDY [expr 0x1 << 9 ] +set AT91C_PMC_PCK2RDY [expr 0x1 << 10 ] +set AT91C_PMC_PCK3RDY [expr 0x1 << 11 ] +# -------- PMC_IDR : (PMC Offset: 0x64) PMC Interrupt Disable Register -------- +set AT91C_PMC_MOSCS [expr 0x1 << 0 ] +set AT91C_PMC_LOCK [expr 0x1 << 2 ] +set AT91C_PMC_MCKRDY [expr 0x1 << 3 ] +set AT91C_PMC_PCK0RDY [expr 0x1 << 8 ] +set AT91C_PMC_PCK1RDY [expr 0x1 << 9 ] +set AT91C_PMC_PCK2RDY [expr 0x1 << 10 ] +set AT91C_PMC_PCK3RDY [expr 0x1 << 11 ] +# -------- PMC_SR : (PMC Offset: 0x68) PMC Status Register -------- +set AT91C_PMC_MOSCS [expr 0x1 << 0 ] +set AT91C_PMC_LOCK [expr 0x1 << 2 ] +set AT91C_PMC_MCKRDY [expr 0x1 << 3 ] +set AT91C_PMC_PCK0RDY [expr 0x1 << 8 ] +set AT91C_PMC_PCK1RDY [expr 0x1 << 9 ] +set AT91C_PMC_PCK2RDY [expr 0x1 << 10 ] +set AT91C_PMC_PCK3RDY [expr 0x1 << 11 ] +# -------- PMC_IMR : (PMC Offset: 0x6c) PMC Interrupt Mask Register -------- +set AT91C_PMC_MOSCS [expr 0x1 << 0 ] +set AT91C_PMC_LOCK [expr 0x1 << 2 ] +set AT91C_PMC_MCKRDY [expr 0x1 << 3 ] +set AT91C_PMC_PCK0RDY [expr 0x1 << 8 ] +set AT91C_PMC_PCK1RDY [expr 0x1 << 9 ] +set AT91C_PMC_PCK2RDY [expr 0x1 << 10 ] +set AT91C_PMC_PCK3RDY [expr 0x1 << 11 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Reset Controller Interface +# ***************************************************************************** +# -------- RSTC_RCR : (RSTC Offset: 0x0) Reset Control Register -------- +set AT91C_RSTC_PROCRST [expr 0x1 << 0 ] +set AT91C_RSTC_PERRST [expr 0x1 << 2 ] +set AT91C_RSTC_EXTRST [expr 0x1 << 3 ] +set AT91C_RSTC_KEY [expr 0xFF << 24 ] +# -------- RSTC_RSR : (RSTC Offset: 0x4) Reset Status Register -------- +set AT91C_RSTC_URSTS [expr 0x1 << 0 ] +set AT91C_RSTC_BODSTS [expr 0x1 << 1 ] +set AT91C_RSTC_RSTTYP [expr 0x7 << 8 ] +set AT91C_RSTC_RSTTYP_POWERUP [expr 0x0 << 8 ] +set AT91C_RSTC_RSTTYP_WAKEUP [expr 0x1 << 8 ] +set AT91C_RSTC_RSTTYP_WATCHDOG [expr 0x2 << 8 ] +set AT91C_RSTC_RSTTYP_SOFTWARE [expr 0x3 << 8 ] +set AT91C_RSTC_RSTTYP_USER [expr 0x4 << 8 ] +set AT91C_RSTC_RSTTYP_BROWNOUT [expr 0x5 << 8 ] +set AT91C_RSTC_NRSTL [expr 0x1 << 16 ] +set AT91C_RSTC_SRCMP [expr 0x1 << 17 ] +# -------- RSTC_RMR : (RSTC Offset: 0x8) Reset Mode Register -------- +set AT91C_RSTC_URSTEN [expr 0x1 << 0 ] +set AT91C_RSTC_URSTIEN [expr 0x1 << 4 ] +set AT91C_RSTC_ERSTL [expr 0xF << 8 ] +set AT91C_RSTC_BODIEN [expr 0x1 << 16 ] +set AT91C_RSTC_KEY [expr 0xFF << 24 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Real Time Timer Controller Interface +# ***************************************************************************** +# -------- RTTC_RTMR : (RTTC Offset: 0x0) Real-time Mode Register -------- +set AT91C_RTTC_RTPRES [expr 0xFFFF << 0 ] +set AT91C_RTTC_ALMIEN [expr 0x1 << 16 ] +set AT91C_RTTC_RTTINCIEN [expr 0x1 << 17 ] +set AT91C_RTTC_RTTRST [expr 0x1 << 18 ] +# -------- RTTC_RTAR : (RTTC Offset: 0x4) Real-time Alarm Register -------- +set AT91C_RTTC_ALMV [expr 0x0 << 0 ] +# -------- RTTC_RTVR : (RTTC Offset: 0x8) Current Real-time Value Register -------- +set AT91C_RTTC_CRTV [expr 0x0 << 0 ] +# -------- RTTC_RTSR : (RTTC Offset: 0xc) Real-time Status Register -------- +set AT91C_RTTC_ALMS [expr 0x1 << 0 ] +set AT91C_RTTC_RTTINC [expr 0x1 << 1 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Periodic Interval Timer Controller Interface +# ***************************************************************************** +# -------- PITC_PIMR : (PITC Offset: 0x0) Periodic Interval Mode Register -------- +set AT91C_PITC_PIV [expr 0xFFFFF << 0 ] +set AT91C_PITC_PITEN [expr 0x1 << 24 ] +set AT91C_PITC_PITIEN [expr 0x1 << 25 ] +# -------- PITC_PISR : (PITC Offset: 0x4) Periodic Interval Status Register -------- +set AT91C_PITC_PITS [expr 0x1 << 0 ] +# -------- PITC_PIVR : (PITC Offset: 0x8) Periodic Interval Value Register -------- +set AT91C_PITC_CPIV [expr 0xFFFFF << 0 ] +set AT91C_PITC_PICNT [expr 0xFFF << 20 ] +# -------- PITC_PIIR : (PITC Offset: 0xc) Periodic Interval Image Register -------- +set AT91C_PITC_CPIV [expr 0xFFFFF << 0 ] +set AT91C_PITC_PICNT [expr 0xFFF << 20 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Watchdog Timer Controller Interface +# ***************************************************************************** +# -------- WDTC_WDCR : (WDTC Offset: 0x0) Periodic Interval Image Register -------- +set AT91C_WDTC_WDRSTT [expr 0x1 << 0 ] +set AT91C_WDTC_KEY [expr 0xFF << 24 ] +# -------- WDTC_WDMR : (WDTC Offset: 0x4) Watchdog Mode Register -------- +set AT91C_WDTC_WDV [expr 0xFFF << 0 ] +set AT91C_WDTC_WDFIEN [expr 0x1 << 12 ] +set AT91C_WDTC_WDRSTEN [expr 0x1 << 13 ] +set AT91C_WDTC_WDRPROC [expr 0x1 << 14 ] +set AT91C_WDTC_WDDIS [expr 0x1 << 15 ] +set AT91C_WDTC_WDD [expr 0xFFF << 16 ] +set AT91C_WDTC_WDDBGHLT [expr 0x1 << 28 ] +set AT91C_WDTC_WDIDLEHLT [expr 0x1 << 29 ] +# -------- WDTC_WDSR : (WDTC Offset: 0x8) Watchdog Status Register -------- +set AT91C_WDTC_WDUNF [expr 0x1 << 0 ] +set AT91C_WDTC_WDERR [expr 0x1 << 1 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Voltage Regulator Mode Controller Interface +# ***************************************************************************** +# -------- VREG_MR : (VREG Offset: 0x0) Voltage Regulator Mode Register -------- +set AT91C_VREG_PSTDBY [expr 0x1 << 0 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Memory Controller Interface +# ***************************************************************************** +# -------- MC_RCR : (MC Offset: 0x0) MC Remap Control Register -------- +set AT91C_MC_RCB [expr 0x1 << 0 ] +# -------- MC_ASR : (MC Offset: 0x4) MC Abort Status Register -------- +set AT91C_MC_UNDADD [expr 0x1 << 0 ] +set AT91C_MC_MISADD [expr 0x1 << 1 ] +set AT91C_MC_ABTSZ [expr 0x3 << 8 ] +set AT91C_MC_ABTSZ_BYTE [expr 0x0 << 8 ] +set AT91C_MC_ABTSZ_HWORD [expr 0x1 << 8 ] +set AT91C_MC_ABTSZ_WORD [expr 0x2 << 8 ] +set AT91C_MC_ABTTYP [expr 0x3 << 10 ] +set AT91C_MC_ABTTYP_DATAR [expr 0x0 << 10 ] +set AT91C_MC_ABTTYP_DATAW [expr 0x1 << 10 ] +set AT91C_MC_ABTTYP_FETCH [expr 0x2 << 10 ] +set AT91C_MC_MST0 [expr 0x1 << 16 ] +set AT91C_MC_MST1 [expr 0x1 << 17 ] +set AT91C_MC_SVMST0 [expr 0x1 << 24 ] +set AT91C_MC_SVMST1 [expr 0x1 << 25 ] +# -------- MC_FMR : (MC Offset: 0x60) MC Flash Mode Register -------- +set AT91C_MC_FRDY [expr 0x1 << 0 ] +set AT91C_MC_LOCKE [expr 0x1 << 2 ] +set AT91C_MC_PROGE [expr 0x1 << 3 ] +set AT91C_MC_NEBP [expr 0x1 << 7 ] +set AT91C_MC_FWS [expr 0x3 << 8 ] +set AT91C_MC_FWS_0FWS [expr 0x0 << 8 ] +set AT91C_MC_FWS_1FWS [expr 0x1 << 8 ] +set AT91C_MC_FWS_2FWS [expr 0x2 << 8 ] +set AT91C_MC_FWS_3FWS [expr 0x3 << 8 ] +set AT91C_MC_FMCN [expr 0xFF << 16 ] +# -------- MC_FCR : (MC Offset: 0x64) MC Flash Command Register -------- +set AT91C_MC_FCMD [expr 0xF << 0 ] +set AT91C_MC_FCMD_START_PROG 0x1 +set AT91C_MC_FCMD_LOCK 0x2 +set AT91C_MC_FCMD_PROG_AND_LOCK 0x3 +set AT91C_MC_FCMD_UNLOCK 0x4 +set AT91C_MC_FCMD_ERASE_ALL 0x8 +set AT91C_MC_FCMD_SET_GP_NVM 0xB +set AT91C_MC_FCMD_CLR_GP_NVM 0xD +set AT91C_MC_FCMD_SET_SECURITY 0xF +set AT91C_MC_PAGEN [expr 0x3FF << 8 ] +set AT91C_MC_KEY [expr 0xFF << 24 ] +# -------- MC_FSR : (MC Offset: 0x68) MC Flash Command Register -------- +set AT91C_MC_FRDY [expr 0x1 << 0 ] +set AT91C_MC_LOCKE [expr 0x1 << 2 ] +set AT91C_MC_PROGE [expr 0x1 << 3 ] +set AT91C_MC_SECURITY [expr 0x1 << 4 ] +set AT91C_MC_GPNVM0 [expr 0x1 << 8 ] +set AT91C_MC_GPNVM1 [expr 0x1 << 9 ] +set AT91C_MC_GPNVM2 [expr 0x1 << 10 ] +set AT91C_MC_GPNVM3 [expr 0x1 << 11 ] +set AT91C_MC_GPNVM4 [expr 0x1 << 12 ] +set AT91C_MC_GPNVM5 [expr 0x1 << 13 ] +set AT91C_MC_GPNVM6 [expr 0x1 << 14 ] +set AT91C_MC_GPNVM7 [expr 0x1 << 15 ] +set AT91C_MC_LOCKS0 [expr 0x1 << 16 ] +set AT91C_MC_LOCKS1 [expr 0x1 << 17 ] +set AT91C_MC_LOCKS2 [expr 0x1 << 18 ] +set AT91C_MC_LOCKS3 [expr 0x1 << 19 ] +set AT91C_MC_LOCKS4 [expr 0x1 << 20 ] +set AT91C_MC_LOCKS5 [expr 0x1 << 21 ] +set AT91C_MC_LOCKS6 [expr 0x1 << 22 ] +set AT91C_MC_LOCKS7 [expr 0x1 << 23 ] +set AT91C_MC_LOCKS8 [expr 0x1 << 24 ] +set AT91C_MC_LOCKS9 [expr 0x1 << 25 ] +set AT91C_MC_LOCKS10 [expr 0x1 << 26 ] +set AT91C_MC_LOCKS11 [expr 0x1 << 27 ] +set AT91C_MC_LOCKS12 [expr 0x1 << 28 ] +set AT91C_MC_LOCKS13 [expr 0x1 << 29 ] +set AT91C_MC_LOCKS14 [expr 0x1 << 30 ] +set AT91C_MC_LOCKS15 [expr 0x1 << 31 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Serial Parallel Interface +# ***************************************************************************** +# -------- SPI_CR : (SPI Offset: 0x0) SPI Control Register -------- +set AT91C_SPI_SPIEN [expr 0x1 << 0 ] +set AT91C_SPI_SPIDIS [expr 0x1 << 1 ] +set AT91C_SPI_SWRST [expr 0x1 << 7 ] +set AT91C_SPI_LASTXFER [expr 0x1 << 24 ] +# -------- SPI_MR : (SPI Offset: 0x4) SPI Mode Register -------- +set AT91C_SPI_MSTR [expr 0x1 << 0 ] +set AT91C_SPI_PS [expr 0x1 << 1 ] +set AT91C_SPI_PS_FIXED [expr 0x0 << 1 ] +set AT91C_SPI_PS_VARIABLE [expr 0x1 << 1 ] +set AT91C_SPI_PCSDEC [expr 0x1 << 2 ] +set AT91C_SPI_FDIV [expr 0x1 << 3 ] +set AT91C_SPI_MODFDIS [expr 0x1 << 4 ] +set AT91C_SPI_LLB [expr 0x1 << 7 ] +set AT91C_SPI_PCS [expr 0xF << 16 ] +set AT91C_SPI_DLYBCS [expr 0xFF << 24 ] +# -------- SPI_RDR : (SPI Offset: 0x8) Receive Data Register -------- +set AT91C_SPI_RD [expr 0xFFFF << 0 ] +set AT91C_SPI_RPCS [expr 0xF << 16 ] +# -------- SPI_TDR : (SPI Offset: 0xc) Transmit Data Register -------- +set AT91C_SPI_TD [expr 0xFFFF << 0 ] +set AT91C_SPI_TPCS [expr 0xF << 16 ] +set AT91C_SPI_LASTXFER [expr 0x1 << 24 ] +# -------- SPI_SR : (SPI Offset: 0x10) Status Register -------- +set AT91C_SPI_RDRF [expr 0x1 << 0 ] +set AT91C_SPI_TDRE [expr 0x1 << 1 ] +set AT91C_SPI_MODF [expr 0x1 << 2 ] +set AT91C_SPI_OVRES [expr 0x1 << 3 ] +set AT91C_SPI_ENDRX [expr 0x1 << 4 ] +set AT91C_SPI_ENDTX [expr 0x1 << 5 ] +set AT91C_SPI_RXBUFF [expr 0x1 << 6 ] +set AT91C_SPI_TXBUFE [expr 0x1 << 7 ] +set AT91C_SPI_NSSR [expr 0x1 << 8 ] +set AT91C_SPI_TXEMPTY [expr 0x1 << 9 ] +set AT91C_SPI_SPIENS [expr 0x1 << 16 ] +# -------- SPI_IER : (SPI Offset: 0x14) Interrupt Enable Register -------- +set AT91C_SPI_RDRF [expr 0x1 << 0 ] +set AT91C_SPI_TDRE [expr 0x1 << 1 ] +set AT91C_SPI_MODF [expr 0x1 << 2 ] +set AT91C_SPI_OVRES [expr 0x1 << 3 ] +set AT91C_SPI_ENDRX [expr 0x1 << 4 ] +set AT91C_SPI_ENDTX [expr 0x1 << 5 ] +set AT91C_SPI_RXBUFF [expr 0x1 << 6 ] +set AT91C_SPI_TXBUFE [expr 0x1 << 7 ] +set AT91C_SPI_NSSR [expr 0x1 << 8 ] +set AT91C_SPI_TXEMPTY [expr 0x1 << 9 ] +# -------- SPI_IDR : (SPI Offset: 0x18) Interrupt Disable Register -------- +set AT91C_SPI_RDRF [expr 0x1 << 0 ] +set AT91C_SPI_TDRE [expr 0x1 << 1 ] +set AT91C_SPI_MODF [expr 0x1 << 2 ] +set AT91C_SPI_OVRES [expr 0x1 << 3 ] +set AT91C_SPI_ENDRX [expr 0x1 << 4 ] +set AT91C_SPI_ENDTX [expr 0x1 << 5 ] +set AT91C_SPI_RXBUFF [expr 0x1 << 6 ] +set AT91C_SPI_TXBUFE [expr 0x1 << 7 ] +set AT91C_SPI_NSSR [expr 0x1 << 8 ] +set AT91C_SPI_TXEMPTY [expr 0x1 << 9 ] +# -------- SPI_IMR : (SPI Offset: 0x1c) Interrupt Mask Register -------- +set AT91C_SPI_RDRF [expr 0x1 << 0 ] +set AT91C_SPI_TDRE [expr 0x1 << 1 ] +set AT91C_SPI_MODF [expr 0x1 << 2 ] +set AT91C_SPI_OVRES [expr 0x1 << 3 ] +set AT91C_SPI_ENDRX [expr 0x1 << 4 ] +set AT91C_SPI_ENDTX [expr 0x1 << 5 ] +set AT91C_SPI_RXBUFF [expr 0x1 << 6 ] +set AT91C_SPI_TXBUFE [expr 0x1 << 7 ] +set AT91C_SPI_NSSR [expr 0x1 << 8 ] +set AT91C_SPI_TXEMPTY [expr 0x1 << 9 ] +# -------- SPI_CSR : (SPI Offset: 0x30) Chip Select Register -------- +set AT91C_SPI_CPOL [expr 0x1 << 0 ] +set AT91C_SPI_NCPHA [expr 0x1 << 1 ] +set AT91C_SPI_CSAAT [expr 0x1 << 3 ] +set AT91C_SPI_BITS [expr 0xF << 4 ] +set AT91C_SPI_BITS_8 [expr 0x0 << 4 ] +set AT91C_SPI_BITS_9 [expr 0x1 << 4 ] +set AT91C_SPI_BITS_10 [expr 0x2 << 4 ] +set AT91C_SPI_BITS_11 [expr 0x3 << 4 ] +set AT91C_SPI_BITS_12 [expr 0x4 << 4 ] +set AT91C_SPI_BITS_13 [expr 0x5 << 4 ] +set AT91C_SPI_BITS_14 [expr 0x6 << 4 ] +set AT91C_SPI_BITS_15 [expr 0x7 << 4 ] +set AT91C_SPI_BITS_16 [expr 0x8 << 4 ] +set AT91C_SPI_SCBR [expr 0xFF << 8 ] +set AT91C_SPI_DLYBS [expr 0xFF << 16 ] +set AT91C_SPI_DLYBCT [expr 0xFF << 24 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Usart +# ***************************************************************************** +# -------- US_CR : (USART Offset: 0x0) Debug Unit Control Register -------- +set AT91C_US_RSTRX [expr 0x1 << 2 ] +set AT91C_US_RSTTX [expr 0x1 << 3 ] +set AT91C_US_RXEN [expr 0x1 << 4 ] +set AT91C_US_RXDIS [expr 0x1 << 5 ] +set AT91C_US_TXEN [expr 0x1 << 6 ] +set AT91C_US_TXDIS [expr 0x1 << 7 ] +set AT91C_US_RSTSTA [expr 0x1 << 8 ] +set AT91C_US_STTBRK [expr 0x1 << 9 ] +set AT91C_US_STPBRK [expr 0x1 << 10 ] +set AT91C_US_STTTO [expr 0x1 << 11 ] +set AT91C_US_SENDA [expr 0x1 << 12 ] +set AT91C_US_RSTIT [expr 0x1 << 13 ] +set AT91C_US_RSTNACK [expr 0x1 << 14 ] +set AT91C_US_RETTO [expr 0x1 << 15 ] +set AT91C_US_DTREN [expr 0x1 << 16 ] +set AT91C_US_DTRDIS [expr 0x1 << 17 ] +set AT91C_US_RTSEN [expr 0x1 << 18 ] +set AT91C_US_RTSDIS [expr 0x1 << 19 ] +# -------- US_MR : (USART Offset: 0x4) Debug Unit Mode Register -------- +set AT91C_US_USMODE [expr 0xF << 0 ] +set AT91C_US_USMODE_NORMAL 0x0 +set AT91C_US_USMODE_RS485 0x1 +set AT91C_US_USMODE_HWHSH 0x2 +set AT91C_US_USMODE_MODEM 0x3 +set AT91C_US_USMODE_ISO7816_0 0x4 +set AT91C_US_USMODE_ISO7816_1 0x6 +set AT91C_US_USMODE_IRDA 0x8 +set AT91C_US_USMODE_SWHSH 0xC +set AT91C_US_CLKS [expr 0x3 << 4 ] +set AT91C_US_CLKS_CLOCK [expr 0x0 << 4 ] +set AT91C_US_CLKS_FDIV1 [expr 0x1 << 4 ] +set AT91C_US_CLKS_SLOW [expr 0x2 << 4 ] +set AT91C_US_CLKS_EXT [expr 0x3 << 4 ] +set AT91C_US_CHRL [expr 0x3 << 6 ] +set AT91C_US_CHRL_5_BITS [expr 0x0 << 6 ] +set AT91C_US_CHRL_6_BITS [expr 0x1 << 6 ] +set AT91C_US_CHRL_7_BITS [expr 0x2 << 6 ] +set AT91C_US_CHRL_8_BITS [expr 0x3 << 6 ] +set AT91C_US_SYNC [expr 0x1 << 8 ] +set AT91C_US_PAR [expr 0x7 << 9 ] +set AT91C_US_PAR_EVEN [expr 0x0 << 9 ] +set AT91C_US_PAR_ODD [expr 0x1 << 9 ] +set AT91C_US_PAR_SPACE [expr 0x2 << 9 ] +set AT91C_US_PAR_MARK [expr 0x3 << 9 ] +set AT91C_US_PAR_NONE [expr 0x4 << 9 ] +set AT91C_US_PAR_MULTI_DROP [expr 0x6 << 9 ] +set AT91C_US_NBSTOP [expr 0x3 << 12 ] +set AT91C_US_NBSTOP_1_BIT [expr 0x0 << 12 ] +set AT91C_US_NBSTOP_15_BIT [expr 0x1 << 12 ] +set AT91C_US_NBSTOP_2_BIT [expr 0x2 << 12 ] +set AT91C_US_CHMODE [expr 0x3 << 14 ] +set AT91C_US_CHMODE_NORMAL [expr 0x0 << 14 ] +set AT91C_US_CHMODE_AUTO [expr 0x1 << 14 ] +set AT91C_US_CHMODE_LOCAL [expr 0x2 << 14 ] +set AT91C_US_CHMODE_REMOTE [expr 0x3 << 14 ] +set AT91C_US_MSBF [expr 0x1 << 16 ] +set AT91C_US_MODE9 [expr 0x1 << 17 ] +set AT91C_US_CKLO [expr 0x1 << 18 ] +set AT91C_US_OVER [expr 0x1 << 19 ] +set AT91C_US_INACK [expr 0x1 << 20 ] +set AT91C_US_DSNACK [expr 0x1 << 21 ] +set AT91C_US_MAX_ITER [expr 0x1 << 24 ] +set AT91C_US_FILTER [expr 0x1 << 28 ] +# -------- US_IER : (USART Offset: 0x8) Debug Unit Interrupt Enable Register -------- +set AT91C_US_RXRDY [expr 0x1 << 0 ] +set AT91C_US_TXRDY [expr 0x1 << 1 ] +set AT91C_US_RXBRK [expr 0x1 << 2 ] +set AT91C_US_ENDRX [expr 0x1 << 3 ] +set AT91C_US_ENDTX [expr 0x1 << 4 ] +set AT91C_US_OVRE [expr 0x1 << 5 ] +set AT91C_US_FRAME [expr 0x1 << 6 ] +set AT91C_US_PARE [expr 0x1 << 7 ] +set AT91C_US_TIMEOUT [expr 0x1 << 8 ] +set AT91C_US_TXEMPTY [expr 0x1 << 9 ] +set AT91C_US_ITERATION [expr 0x1 << 10 ] +set AT91C_US_TXBUFE [expr 0x1 << 11 ] +set AT91C_US_RXBUFF [expr 0x1 << 12 ] +set AT91C_US_NACK [expr 0x1 << 13 ] +set AT91C_US_RIIC [expr 0x1 << 16 ] +set AT91C_US_DSRIC [expr 0x1 << 17 ] +set AT91C_US_DCDIC [expr 0x1 << 18 ] +set AT91C_US_CTSIC [expr 0x1 << 19 ] +# -------- US_IDR : (USART Offset: 0xc) Debug Unit Interrupt Disable Register -------- +set AT91C_US_RXRDY [expr 0x1 << 0 ] +set AT91C_US_TXRDY [expr 0x1 << 1 ] +set AT91C_US_RXBRK [expr 0x1 << 2 ] +set AT91C_US_ENDRX [expr 0x1 << 3 ] +set AT91C_US_ENDTX [expr 0x1 << 4 ] +set AT91C_US_OVRE [expr 0x1 << 5 ] +set AT91C_US_FRAME [expr 0x1 << 6 ] +set AT91C_US_PARE [expr 0x1 << 7 ] +set AT91C_US_TIMEOUT [expr 0x1 << 8 ] +set AT91C_US_TXEMPTY [expr 0x1 << 9 ] +set AT91C_US_ITERATION [expr 0x1 << 10 ] +set AT91C_US_TXBUFE [expr 0x1 << 11 ] +set AT91C_US_RXBUFF [expr 0x1 << 12 ] +set AT91C_US_NACK [expr 0x1 << 13 ] +set AT91C_US_RIIC [expr 0x1 << 16 ] +set AT91C_US_DSRIC [expr 0x1 << 17 ] +set AT91C_US_DCDIC [expr 0x1 << 18 ] +set AT91C_US_CTSIC [expr 0x1 << 19 ] +# -------- US_IMR : (USART Offset: 0x10) Debug Unit Interrupt Mask Register -------- +set AT91C_US_RXRDY [expr 0x1 << 0 ] +set AT91C_US_TXRDY [expr 0x1 << 1 ] +set AT91C_US_RXBRK [expr 0x1 << 2 ] +set AT91C_US_ENDRX [expr 0x1 << 3 ] +set AT91C_US_ENDTX [expr 0x1 << 4 ] +set AT91C_US_OVRE [expr 0x1 << 5 ] +set AT91C_US_FRAME [expr 0x1 << 6 ] +set AT91C_US_PARE [expr 0x1 << 7 ] +set AT91C_US_TIMEOUT [expr 0x1 << 8 ] +set AT91C_US_TXEMPTY [expr 0x1 << 9 ] +set AT91C_US_ITERATION [expr 0x1 << 10 ] +set AT91C_US_TXBUFE [expr 0x1 << 11 ] +set AT91C_US_RXBUFF [expr 0x1 << 12 ] +set AT91C_US_NACK [expr 0x1 << 13 ] +set AT91C_US_RIIC [expr 0x1 << 16 ] +set AT91C_US_DSRIC [expr 0x1 << 17 ] +set AT91C_US_DCDIC [expr 0x1 << 18 ] +set AT91C_US_CTSIC [expr 0x1 << 19 ] +# -------- US_CSR : (USART Offset: 0x14) Debug Unit Channel Status Register -------- +set AT91C_US_RXRDY [expr 0x1 << 0 ] +set AT91C_US_TXRDY [expr 0x1 << 1 ] +set AT91C_US_RXBRK [expr 0x1 << 2 ] +set AT91C_US_ENDRX [expr 0x1 << 3 ] +set AT91C_US_ENDTX [expr 0x1 << 4 ] +set AT91C_US_OVRE [expr 0x1 << 5 ] +set AT91C_US_FRAME [expr 0x1 << 6 ] +set AT91C_US_PARE [expr 0x1 << 7 ] +set AT91C_US_TIMEOUT [expr 0x1 << 8 ] +set AT91C_US_TXEMPTY [expr 0x1 << 9 ] +set AT91C_US_ITERATION [expr 0x1 << 10 ] +set AT91C_US_TXBUFE [expr 0x1 << 11 ] +set AT91C_US_RXBUFF [expr 0x1 << 12 ] +set AT91C_US_NACK [expr 0x1 << 13 ] +set AT91C_US_RIIC [expr 0x1 << 16 ] +set AT91C_US_DSRIC [expr 0x1 << 17 ] +set AT91C_US_DCDIC [expr 0x1 << 18 ] +set AT91C_US_CTSIC [expr 0x1 << 19 ] +set AT91C_US_RI [expr 0x1 << 20 ] +set AT91C_US_DSR [expr 0x1 << 21 ] +set AT91C_US_DCD [expr 0x1 << 22 ] +set AT91C_US_CTS [expr 0x1 << 23 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Synchronous Serial Controller Interface +# ***************************************************************************** +# -------- SSC_CR : (SSC Offset: 0x0) SSC Control Register -------- +set AT91C_SSC_RXEN [expr 0x1 << 0 ] +set AT91C_SSC_RXDIS [expr 0x1 << 1 ] +set AT91C_SSC_TXEN [expr 0x1 << 8 ] +set AT91C_SSC_TXDIS [expr 0x1 << 9 ] +set AT91C_SSC_SWRST [expr 0x1 << 15 ] +# -------- SSC_RCMR : (SSC Offset: 0x10) SSC Receive Clock Mode Register -------- +set AT91C_SSC_CKS [expr 0x3 << 0 ] +set AT91C_SSC_CKS_DIV 0x0 +set AT91C_SSC_CKS_TK 0x1 +set AT91C_SSC_CKS_RK 0x2 +set AT91C_SSC_CKO [expr 0x7 << 2 ] +set AT91C_SSC_CKO_NONE [expr 0x0 << 2 ] +set AT91C_SSC_CKO_CONTINOUS [expr 0x1 << 2 ] +set AT91C_SSC_CKO_DATA_TX [expr 0x2 << 2 ] +set AT91C_SSC_CKI [expr 0x1 << 5 ] +set AT91C_SSC_CKG [expr 0x3 << 6 ] +set AT91C_SSC_CKG_NONE [expr 0x0 << 6 ] +set AT91C_SSC_CKG_LOW [expr 0x1 << 6 ] +set AT91C_SSC_CKG_HIGH [expr 0x2 << 6 ] +set AT91C_SSC_START [expr 0xF << 8 ] +set AT91C_SSC_START_CONTINOUS [expr 0x0 << 8 ] +set AT91C_SSC_START_TX [expr 0x1 << 8 ] +set AT91C_SSC_START_LOW_RF [expr 0x2 << 8 ] +set AT91C_SSC_START_HIGH_RF [expr 0x3 << 8 ] +set AT91C_SSC_START_FALL_RF [expr 0x4 << 8 ] +set AT91C_SSC_START_RISE_RF [expr 0x5 << 8 ] +set AT91C_SSC_START_LEVEL_RF [expr 0x6 << 8 ] +set AT91C_SSC_START_EDGE_RF [expr 0x7 << 8 ] +set AT91C_SSC_START_0 [expr 0x8 << 8 ] +set AT91C_SSC_STOP [expr 0x1 << 12 ] +set AT91C_SSC_STTDLY [expr 0xFF << 16 ] +set AT91C_SSC_PERIOD [expr 0xFF << 24 ] +# -------- SSC_RFMR : (SSC Offset: 0x14) SSC Receive Frame Mode Register -------- +set AT91C_SSC_DATLEN [expr 0x1F << 0 ] +set AT91C_SSC_LOOP [expr 0x1 << 5 ] +set AT91C_SSC_MSBF [expr 0x1 << 7 ] +set AT91C_SSC_DATNB [expr 0xF << 8 ] +set AT91C_SSC_FSLEN [expr 0xF << 16 ] +set AT91C_SSC_FSOS [expr 0x7 << 20 ] +set AT91C_SSC_FSOS_NONE [expr 0x0 << 20 ] +set AT91C_SSC_FSOS_NEGATIVE [expr 0x1 << 20 ] +set AT91C_SSC_FSOS_POSITIVE [expr 0x2 << 20 ] +set AT91C_SSC_FSOS_LOW [expr 0x3 << 20 ] +set AT91C_SSC_FSOS_HIGH [expr 0x4 << 20 ] +set AT91C_SSC_FSOS_TOGGLE [expr 0x5 << 20 ] +set AT91C_SSC_FSEDGE [expr 0x1 << 24 ] +# -------- SSC_TCMR : (SSC Offset: 0x18) SSC Transmit Clock Mode Register -------- +set AT91C_SSC_CKS [expr 0x3 << 0 ] +set AT91C_SSC_CKS_DIV 0x0 +set AT91C_SSC_CKS_TK 0x1 +set AT91C_SSC_CKS_RK 0x2 +set AT91C_SSC_CKO [expr 0x7 << 2 ] +set AT91C_SSC_CKO_NONE [expr 0x0 << 2 ] +set AT91C_SSC_CKO_CONTINOUS [expr 0x1 << 2 ] +set AT91C_SSC_CKO_DATA_TX [expr 0x2 << 2 ] +set AT91C_SSC_CKI [expr 0x1 << 5 ] +set AT91C_SSC_CKG [expr 0x3 << 6 ] +set AT91C_SSC_CKG_NONE [expr 0x0 << 6 ] +set AT91C_SSC_CKG_LOW [expr 0x1 << 6 ] +set AT91C_SSC_CKG_HIGH [expr 0x2 << 6 ] +set AT91C_SSC_START [expr 0xF << 8 ] +set AT91C_SSC_START_CONTINOUS [expr 0x0 << 8 ] +set AT91C_SSC_START_TX [expr 0x1 << 8 ] +set AT91C_SSC_START_LOW_RF [expr 0x2 << 8 ] +set AT91C_SSC_START_HIGH_RF [expr 0x3 << 8 ] +set AT91C_SSC_START_FALL_RF [expr 0x4 << 8 ] +set AT91C_SSC_START_RISE_RF [expr 0x5 << 8 ] +set AT91C_SSC_START_LEVEL_RF [expr 0x6 << 8 ] +set AT91C_SSC_START_EDGE_RF [expr 0x7 << 8 ] +set AT91C_SSC_START_0 [expr 0x8 << 8 ] +set AT91C_SSC_STTDLY [expr 0xFF << 16 ] +set AT91C_SSC_PERIOD [expr 0xFF << 24 ] +# -------- SSC_TFMR : (SSC Offset: 0x1c) SSC Transmit Frame Mode Register -------- +set AT91C_SSC_DATLEN [expr 0x1F << 0 ] +set AT91C_SSC_DATDEF [expr 0x1 << 5 ] +set AT91C_SSC_MSBF [expr 0x1 << 7 ] +set AT91C_SSC_DATNB [expr 0xF << 8 ] +set AT91C_SSC_FSLEN [expr 0xF << 16 ] +set AT91C_SSC_FSOS [expr 0x7 << 20 ] +set AT91C_SSC_FSOS_NONE [expr 0x0 << 20 ] +set AT91C_SSC_FSOS_NEGATIVE [expr 0x1 << 20 ] +set AT91C_SSC_FSOS_POSITIVE [expr 0x2 << 20 ] +set AT91C_SSC_FSOS_LOW [expr 0x3 << 20 ] +set AT91C_SSC_FSOS_HIGH [expr 0x4 << 20 ] +set AT91C_SSC_FSOS_TOGGLE [expr 0x5 << 20 ] +set AT91C_SSC_FSDEN [expr 0x1 << 23 ] +set AT91C_SSC_FSEDGE [expr 0x1 << 24 ] +# -------- SSC_SR : (SSC Offset: 0x40) SSC Status Register -------- +set AT91C_SSC_TXRDY [expr 0x1 << 0 ] +set AT91C_SSC_TXEMPTY [expr 0x1 << 1 ] +set AT91C_SSC_ENDTX [expr 0x1 << 2 ] +set AT91C_SSC_TXBUFE [expr 0x1 << 3 ] +set AT91C_SSC_RXRDY [expr 0x1 << 4 ] +set AT91C_SSC_OVRUN [expr 0x1 << 5 ] +set AT91C_SSC_ENDRX [expr 0x1 << 6 ] +set AT91C_SSC_RXBUFF [expr 0x1 << 7 ] +set AT91C_SSC_CP0 [expr 0x1 << 8 ] +set AT91C_SSC_CP1 [expr 0x1 << 9 ] +set AT91C_SSC_TXSYN [expr 0x1 << 10 ] +set AT91C_SSC_RXSYN [expr 0x1 << 11 ] +set AT91C_SSC_TXENA [expr 0x1 << 16 ] +set AT91C_SSC_RXENA [expr 0x1 << 17 ] +# -------- SSC_IER : (SSC Offset: 0x44) SSC Interrupt Enable Register -------- +set AT91C_SSC_TXRDY [expr 0x1 << 0 ] +set AT91C_SSC_TXEMPTY [expr 0x1 << 1 ] +set AT91C_SSC_ENDTX [expr 0x1 << 2 ] +set AT91C_SSC_TXBUFE [expr 0x1 << 3 ] +set AT91C_SSC_RXRDY [expr 0x1 << 4 ] +set AT91C_SSC_OVRUN [expr 0x1 << 5 ] +set AT91C_SSC_ENDRX [expr 0x1 << 6 ] +set AT91C_SSC_RXBUFF [expr 0x1 << 7 ] +set AT91C_SSC_CP0 [expr 0x1 << 8 ] +set AT91C_SSC_CP1 [expr 0x1 << 9 ] +set AT91C_SSC_TXSYN [expr 0x1 << 10 ] +set AT91C_SSC_RXSYN [expr 0x1 << 11 ] +# -------- SSC_IDR : (SSC Offset: 0x48) SSC Interrupt Disable Register -------- +set AT91C_SSC_TXRDY [expr 0x1 << 0 ] +set AT91C_SSC_TXEMPTY [expr 0x1 << 1 ] +set AT91C_SSC_ENDTX [expr 0x1 << 2 ] +set AT91C_SSC_TXBUFE [expr 0x1 << 3 ] +set AT91C_SSC_RXRDY [expr 0x1 << 4 ] +set AT91C_SSC_OVRUN [expr 0x1 << 5 ] +set AT91C_SSC_ENDRX [expr 0x1 << 6 ] +set AT91C_SSC_RXBUFF [expr 0x1 << 7 ] +set AT91C_SSC_CP0 [expr 0x1 << 8 ] +set AT91C_SSC_CP1 [expr 0x1 << 9 ] +set AT91C_SSC_TXSYN [expr 0x1 << 10 ] +set AT91C_SSC_RXSYN [expr 0x1 << 11 ] +# -------- SSC_IMR : (SSC Offset: 0x4c) SSC Interrupt Mask Register -------- +set AT91C_SSC_TXRDY [expr 0x1 << 0 ] +set AT91C_SSC_TXEMPTY [expr 0x1 << 1 ] +set AT91C_SSC_ENDTX [expr 0x1 << 2 ] +set AT91C_SSC_TXBUFE [expr 0x1 << 3 ] +set AT91C_SSC_RXRDY [expr 0x1 << 4 ] +set AT91C_SSC_OVRUN [expr 0x1 << 5 ] +set AT91C_SSC_ENDRX [expr 0x1 << 6 ] +set AT91C_SSC_RXBUFF [expr 0x1 << 7 ] +set AT91C_SSC_CP0 [expr 0x1 << 8 ] +set AT91C_SSC_CP1 [expr 0x1 << 9 ] +set AT91C_SSC_TXSYN [expr 0x1 << 10 ] +set AT91C_SSC_RXSYN [expr 0x1 << 11 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Two-wire Interface +# ***************************************************************************** +# -------- TWI_CR : (TWI Offset: 0x0) TWI Control Register -------- +set AT91C_TWI_START [expr 0x1 << 0 ] +set AT91C_TWI_STOP [expr 0x1 << 1 ] +set AT91C_TWI_MSEN [expr 0x1 << 2 ] +set AT91C_TWI_MSDIS [expr 0x1 << 3 ] +set AT91C_TWI_SWRST [expr 0x1 << 7 ] +# -------- TWI_MMR : (TWI Offset: 0x4) TWI Master Mode Register -------- +set AT91C_TWI_IADRSZ [expr 0x3 << 8 ] +set AT91C_TWI_IADRSZ_NO [expr 0x0 << 8 ] +set AT91C_TWI_IADRSZ_1_BYTE [expr 0x1 << 8 ] +set AT91C_TWI_IADRSZ_2_BYTE [expr 0x2 << 8 ] +set AT91C_TWI_IADRSZ_3_BYTE [expr 0x3 << 8 ] +set AT91C_TWI_MREAD [expr 0x1 << 12 ] +set AT91C_TWI_DADR [expr 0x7F << 16 ] +# -------- TWI_CWGR : (TWI Offset: 0x10) TWI Clock Waveform Generator Register -------- +set AT91C_TWI_CLDIV [expr 0xFF << 0 ] +set AT91C_TWI_CHDIV [expr 0xFF << 8 ] +set AT91C_TWI_CKDIV [expr 0x7 << 16 ] +# -------- TWI_SR : (TWI Offset: 0x20) TWI Status Register -------- +set AT91C_TWI_TXCOMP [expr 0x1 << 0 ] +set AT91C_TWI_RXRDY [expr 0x1 << 1 ] +set AT91C_TWI_TXRDY [expr 0x1 << 2 ] +set AT91C_TWI_OVRE [expr 0x1 << 6 ] +set AT91C_TWI_UNRE [expr 0x1 << 7 ] +set AT91C_TWI_NACK [expr 0x1 << 8 ] +# -------- TWI_IER : (TWI Offset: 0x24) TWI Interrupt Enable Register -------- +set AT91C_TWI_TXCOMP [expr 0x1 << 0 ] +set AT91C_TWI_RXRDY [expr 0x1 << 1 ] +set AT91C_TWI_TXRDY [expr 0x1 << 2 ] +set AT91C_TWI_OVRE [expr 0x1 << 6 ] +set AT91C_TWI_UNRE [expr 0x1 << 7 ] +set AT91C_TWI_NACK [expr 0x1 << 8 ] +# -------- TWI_IDR : (TWI Offset: 0x28) TWI Interrupt Disable Register -------- +set AT91C_TWI_TXCOMP [expr 0x1 << 0 ] +set AT91C_TWI_RXRDY [expr 0x1 << 1 ] +set AT91C_TWI_TXRDY [expr 0x1 << 2 ] +set AT91C_TWI_OVRE [expr 0x1 << 6 ] +set AT91C_TWI_UNRE [expr 0x1 << 7 ] +set AT91C_TWI_NACK [expr 0x1 << 8 ] +# -------- TWI_IMR : (TWI Offset: 0x2c) TWI Interrupt Mask Register -------- +set AT91C_TWI_TXCOMP [expr 0x1 << 0 ] +set AT91C_TWI_RXRDY [expr 0x1 << 1 ] +set AT91C_TWI_TXRDY [expr 0x1 << 2 ] +set AT91C_TWI_OVRE [expr 0x1 << 6 ] +set AT91C_TWI_UNRE [expr 0x1 << 7 ] +set AT91C_TWI_NACK [expr 0x1 << 8 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR PWMC Channel Interface +# ***************************************************************************** +# -------- PWMC_CMR : (PWMC_CH Offset: 0x0) PWMC Channel Mode Register -------- +set AT91C_PWMC_CPRE [expr 0xF << 0 ] +set AT91C_PWMC_CPRE_MCK 0x0 +set AT91C_PWMC_CPRE_MCK/2 0x1 +set AT91C_PWMC_CPRE_MCK/4 0x2 +set AT91C_PWMC_CPRE_MCK/8 0x3 +set AT91C_PWMC_CPRE_MCK/16 0x4 +set AT91C_PWMC_CPRE_MCK/32 0x5 +set AT91C_PWMC_CPRE_MCK/64 0x6 +set AT91C_PWMC_CPRE_MCK/128 0x7 +set AT91C_PWMC_CPRE_MCK/256 0x8 +set AT91C_PWMC_CPRE_MCK/512 0x9 +set AT91C_PWMC_CPRE_MCK/1024 0xA +set AT91C_PWMC_CPRE_MCKA 0xB +set AT91C_PWMC_CPRE_MCKB 0xC +set AT91C_PWMC_CALG [expr 0x1 << 8 ] +set AT91C_PWMC_CPOL [expr 0x1 << 9 ] +set AT91C_PWMC_CPD [expr 0x1 << 10 ] +# -------- PWMC_CDTYR : (PWMC_CH Offset: 0x4) PWMC Channel Duty Cycle Register -------- +set AT91C_PWMC_CDTY [expr 0x0 << 0 ] +# -------- PWMC_CPRDR : (PWMC_CH Offset: 0x8) PWMC Channel Period Register -------- +set AT91C_PWMC_CPRD [expr 0x0 << 0 ] +# -------- PWMC_CCNTR : (PWMC_CH Offset: 0xc) PWMC Channel Counter Register -------- +set AT91C_PWMC_CCNT [expr 0x0 << 0 ] +# -------- PWMC_CUPDR : (PWMC_CH Offset: 0x10) PWMC Channel Update Register -------- +set AT91C_PWMC_CUPD [expr 0x0 << 0 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Pulse Width Modulation Controller Interface +# ***************************************************************************** +# -------- PWMC_MR : (PWMC Offset: 0x0) PWMC Mode Register -------- +set AT91C_PWMC_DIVA [expr 0xFF << 0 ] +set AT91C_PWMC_PREA [expr 0xF << 8 ] +set AT91C_PWMC_PREA_MCK [expr 0x0 << 8 ] +set AT91C_PWMC_PREA_MCK/2 [expr 0x1 << 8 ] +set AT91C_PWMC_PREA_MCK/4 [expr 0x2 << 8 ] +set AT91C_PWMC_PREA_MCK/8 [expr 0x3 << 8 ] +set AT91C_PWMC_PREA_MCK/16 [expr 0x4 << 8 ] +set AT91C_PWMC_PREA_MCK/32 [expr 0x5 << 8 ] +set AT91C_PWMC_PREA_MCK/64 [expr 0x6 << 8 ] +set AT91C_PWMC_PREA_MCK/128 [expr 0x7 << 8 ] +set AT91C_PWMC_PREA_MCK/256 [expr 0x8 << 8 ] +set AT91C_PWMC_DIVB [expr 0xFF << 16 ] +set AT91C_PWMC_PREB [expr 0xF << 24 ] +set AT91C_PWMC_PREB_MCK [expr 0x0 << 24 ] +set AT91C_PWMC_PREB_MCK/2 [expr 0x1 << 24 ] +set AT91C_PWMC_PREB_MCK/4 [expr 0x2 << 24 ] +set AT91C_PWMC_PREB_MCK/8 [expr 0x3 << 24 ] +set AT91C_PWMC_PREB_MCK/16 [expr 0x4 << 24 ] +set AT91C_PWMC_PREB_MCK/32 [expr 0x5 << 24 ] +set AT91C_PWMC_PREB_MCK/64 [expr 0x6 << 24 ] +set AT91C_PWMC_PREB_MCK/128 [expr 0x7 << 24 ] +set AT91C_PWMC_PREB_MCK/256 [expr 0x8 << 24 ] +# -------- PWMC_ENA : (PWMC Offset: 0x4) PWMC Enable Register -------- +set AT91C_PWMC_CHID0 [expr 0x1 << 0 ] +set AT91C_PWMC_CHID1 [expr 0x1 << 1 ] +set AT91C_PWMC_CHID2 [expr 0x1 << 2 ] +set AT91C_PWMC_CHID3 [expr 0x1 << 3 ] +# -------- PWMC_DIS : (PWMC Offset: 0x8) PWMC Disable Register -------- +set AT91C_PWMC_CHID0 [expr 0x1 << 0 ] +set AT91C_PWMC_CHID1 [expr 0x1 << 1 ] +set AT91C_PWMC_CHID2 [expr 0x1 << 2 ] +set AT91C_PWMC_CHID3 [expr 0x1 << 3 ] +# -------- PWMC_SR : (PWMC Offset: 0xc) PWMC Status Register -------- +set AT91C_PWMC_CHID0 [expr 0x1 << 0 ] +set AT91C_PWMC_CHID1 [expr 0x1 << 1 ] +set AT91C_PWMC_CHID2 [expr 0x1 << 2 ] +set AT91C_PWMC_CHID3 [expr 0x1 << 3 ] +# -------- PWMC_IER : (PWMC Offset: 0x10) PWMC Interrupt Enable Register -------- +set AT91C_PWMC_CHID0 [expr 0x1 << 0 ] +set AT91C_PWMC_CHID1 [expr 0x1 << 1 ] +set AT91C_PWMC_CHID2 [expr 0x1 << 2 ] +set AT91C_PWMC_CHID3 [expr 0x1 << 3 ] +# -------- PWMC_IDR : (PWMC Offset: 0x14) PWMC Interrupt Disable Register -------- +set AT91C_PWMC_CHID0 [expr 0x1 << 0 ] +set AT91C_PWMC_CHID1 [expr 0x1 << 1 ] +set AT91C_PWMC_CHID2 [expr 0x1 << 2 ] +set AT91C_PWMC_CHID3 [expr 0x1 << 3 ] +# -------- PWMC_IMR : (PWMC Offset: 0x18) PWMC Interrupt Mask Register -------- +set AT91C_PWMC_CHID0 [expr 0x1 << 0 ] +set AT91C_PWMC_CHID1 [expr 0x1 << 1 ] +set AT91C_PWMC_CHID2 [expr 0x1 << 2 ] +set AT91C_PWMC_CHID3 [expr 0x1 << 3 ] +# -------- PWMC_ISR : (PWMC Offset: 0x1c) PWMC Interrupt Status Register -------- +set AT91C_PWMC_CHID0 [expr 0x1 << 0 ] +set AT91C_PWMC_CHID1 [expr 0x1 << 1 ] +set AT91C_PWMC_CHID2 [expr 0x1 << 2 ] +set AT91C_PWMC_CHID3 [expr 0x1 << 3 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR USB Device Interface +# ***************************************************************************** +# -------- UDP_FRM_NUM : (UDP Offset: 0x0) USB Frame Number Register -------- +set AT91C_UDP_FRM_NUM [expr 0x7FF << 0 ] +set AT91C_UDP_FRM_ERR [expr 0x1 << 16 ] +set AT91C_UDP_FRM_OK [expr 0x1 << 17 ] +# -------- UDP_GLB_STATE : (UDP Offset: 0x4) USB Global State Register -------- +set AT91C_UDP_FADDEN [expr 0x1 << 0 ] +set AT91C_UDP_CONFG [expr 0x1 << 1 ] +set AT91C_UDP_ESR [expr 0x1 << 2 ] +set AT91C_UDP_RSMINPR [expr 0x1 << 3 ] +set AT91C_UDP_RMWUPE [expr 0x1 << 4 ] +# -------- UDP_FADDR : (UDP Offset: 0x8) USB Function Address Register -------- +set AT91C_UDP_FADD [expr 0xFF << 0 ] +set AT91C_UDP_FEN [expr 0x1 << 8 ] +# -------- UDP_IER : (UDP Offset: 0x10) USB Interrupt Enable Register -------- +set AT91C_UDP_EPINT0 [expr 0x1 << 0 ] +set AT91C_UDP_EPINT1 [expr 0x1 << 1 ] +set AT91C_UDP_EPINT2 [expr 0x1 << 2 ] +set AT91C_UDP_EPINT3 [expr 0x1 << 3 ] +set AT91C_UDP_EPINT4 [expr 0x1 << 4 ] +set AT91C_UDP_EPINT5 [expr 0x1 << 5 ] +set AT91C_UDP_RXSUSP [expr 0x1 << 8 ] +set AT91C_UDP_RXRSM [expr 0x1 << 9 ] +set AT91C_UDP_EXTRSM [expr 0x1 << 10 ] +set AT91C_UDP_SOFINT [expr 0x1 << 11 ] +set AT91C_UDP_WAKEUP [expr 0x1 << 13 ] +# -------- UDP_IDR : (UDP Offset: 0x14) USB Interrupt Disable Register -------- +set AT91C_UDP_EPINT0 [expr 0x1 << 0 ] +set AT91C_UDP_EPINT1 [expr 0x1 << 1 ] +set AT91C_UDP_EPINT2 [expr 0x1 << 2 ] +set AT91C_UDP_EPINT3 [expr 0x1 << 3 ] +set AT91C_UDP_EPINT4 [expr 0x1 << 4 ] +set AT91C_UDP_EPINT5 [expr 0x1 << 5 ] +set AT91C_UDP_RXSUSP [expr 0x1 << 8 ] +set AT91C_UDP_RXRSM [expr 0x1 << 9 ] +set AT91C_UDP_EXTRSM [expr 0x1 << 10 ] +set AT91C_UDP_SOFINT [expr 0x1 << 11 ] +set AT91C_UDP_WAKEUP [expr 0x1 << 13 ] +# -------- UDP_IMR : (UDP Offset: 0x18) USB Interrupt Mask Register -------- +set AT91C_UDP_EPINT0 [expr 0x1 << 0 ] +set AT91C_UDP_EPINT1 [expr 0x1 << 1 ] +set AT91C_UDP_EPINT2 [expr 0x1 << 2 ] +set AT91C_UDP_EPINT3 [expr 0x1 << 3 ] +set AT91C_UDP_EPINT4 [expr 0x1 << 4 ] +set AT91C_UDP_EPINT5 [expr 0x1 << 5 ] +set AT91C_UDP_RXSUSP [expr 0x1 << 8 ] +set AT91C_UDP_RXRSM [expr 0x1 << 9 ] +set AT91C_UDP_EXTRSM [expr 0x1 << 10 ] +set AT91C_UDP_SOFINT [expr 0x1 << 11 ] +set AT91C_UDP_WAKEUP [expr 0x1 << 13 ] +# -------- UDP_ISR : (UDP Offset: 0x1c) USB Interrupt Status Register -------- +set AT91C_UDP_EPINT0 [expr 0x1 << 0 ] +set AT91C_UDP_EPINT1 [expr 0x1 << 1 ] +set AT91C_UDP_EPINT2 [expr 0x1 << 2 ] +set AT91C_UDP_EPINT3 [expr 0x1 << 3 ] +set AT91C_UDP_EPINT4 [expr 0x1 << 4 ] +set AT91C_UDP_EPINT5 [expr 0x1 << 5 ] +set AT91C_UDP_RXSUSP [expr 0x1 << 8 ] +set AT91C_UDP_RXRSM [expr 0x1 << 9 ] +set AT91C_UDP_EXTRSM [expr 0x1 << 10 ] +set AT91C_UDP_SOFINT [expr 0x1 << 11 ] +set AT91C_UDP_ENDBUSRES [expr 0x1 << 12 ] +set AT91C_UDP_WAKEUP [expr 0x1 << 13 ] +# -------- UDP_ICR : (UDP Offset: 0x20) USB Interrupt Clear Register -------- +set AT91C_UDP_EPINT0 [expr 0x1 << 0 ] +set AT91C_UDP_EPINT1 [expr 0x1 << 1 ] +set AT91C_UDP_EPINT2 [expr 0x1 << 2 ] +set AT91C_UDP_EPINT3 [expr 0x1 << 3 ] +set AT91C_UDP_EPINT4 [expr 0x1 << 4 ] +set AT91C_UDP_EPINT5 [expr 0x1 << 5 ] +set AT91C_UDP_RXSUSP [expr 0x1 << 8 ] +set AT91C_UDP_RXRSM [expr 0x1 << 9 ] +set AT91C_UDP_EXTRSM [expr 0x1 << 10 ] +set AT91C_UDP_SOFINT [expr 0x1 << 11 ] +set AT91C_UDP_WAKEUP [expr 0x1 << 13 ] +# -------- UDP_RST_EP : (UDP Offset: 0x28) USB Reset Endpoint Register -------- +set AT91C_UDP_EP0 [expr 0x1 << 0 ] +set AT91C_UDP_EP1 [expr 0x1 << 1 ] +set AT91C_UDP_EP2 [expr 0x1 << 2 ] +set AT91C_UDP_EP3 [expr 0x1 << 3 ] +set AT91C_UDP_EP4 [expr 0x1 << 4 ] +set AT91C_UDP_EP5 [expr 0x1 << 5 ] +# -------- UDP_CSR : (UDP Offset: 0x30) USB Endpoint Control and Status Register -------- +set AT91C_UDP_TXCOMP [expr 0x1 << 0 ] +set AT91C_UDP_RX_DATA_BK0 [expr 0x1 << 1 ] +set AT91C_UDP_RXSETUP [expr 0x1 << 2 ] +set AT91C_UDP_ISOERROR [expr 0x1 << 3 ] +set AT91C_UDP_TXPKTRDY [expr 0x1 << 4 ] +set AT91C_UDP_FORCESTALL [expr 0x1 << 5 ] +set AT91C_UDP_RX_DATA_BK1 [expr 0x1 << 6 ] +set AT91C_UDP_DIR [expr 0x1 << 7 ] +set AT91C_UDP_EPTYPE [expr 0x7 << 8 ] +set AT91C_UDP_EPTYPE_CTRL [expr 0x0 << 8 ] +set AT91C_UDP_EPTYPE_ISO_OUT [expr 0x1 << 8 ] +set AT91C_UDP_EPTYPE_BULK_OUT [expr 0x2 << 8 ] +set AT91C_UDP_EPTYPE_INT_OUT [expr 0x3 << 8 ] +set AT91C_UDP_EPTYPE_ISO_IN [expr 0x5 << 8 ] +set AT91C_UDP_EPTYPE_BULK_IN [expr 0x6 << 8 ] +set AT91C_UDP_EPTYPE_INT_IN [expr 0x7 << 8 ] +set AT91C_UDP_DTGLE [expr 0x1 << 11 ] +set AT91C_UDP_EPEDS [expr 0x1 << 15 ] +set AT91C_UDP_RXBYTECNT [expr 0x7FF << 16 ] +# -------- UDP_TXVC : (UDP Offset: 0x74) Transceiver Control Register -------- +set AT91C_UDP_TXVDIS [expr 0x1 << 8 ] +set AT91C_UDP_PUON [expr 0x1 << 9 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Timer Counter Channel Interface +# ***************************************************************************** +# -------- TC_CCR : (TC Offset: 0x0) TC Channel Control Register -------- +set AT91C_TC_CLKEN [expr 0x1 << 0 ] +set AT91C_TC_CLKDIS [expr 0x1 << 1 ] +set AT91C_TC_SWTRG [expr 0x1 << 2 ] +# -------- TC_CMR : (TC Offset: 0x4) TC Channel Mode Register: Capture Mode / Waveform Mode -------- +set AT91C_TC_CLKS [expr 0x7 << 0 ] +set AT91C_TC_CLKS_TIMER_DIV1_CLOCK 0x0 +set AT91C_TC_CLKS_TIMER_DIV2_CLOCK 0x1 +set AT91C_TC_CLKS_TIMER_DIV3_CLOCK 0x2 +set AT91C_TC_CLKS_TIMER_DIV4_CLOCK 0x3 +set AT91C_TC_CLKS_TIMER_DIV5_CLOCK 0x4 +set AT91C_TC_CLKS_XC0 0x5 +set AT91C_TC_CLKS_XC1 0x6 +set AT91C_TC_CLKS_XC2 0x7 +set AT91C_TC_CLKS [expr 0x7 << 0 ] +set AT91C_TC_CLKS_TIMER_DIV1_CLOCK 0x0 +set AT91C_TC_CLKS_TIMER_DIV2_CLOCK 0x1 +set AT91C_TC_CLKS_TIMER_DIV3_CLOCK 0x2 +set AT91C_TC_CLKS_TIMER_DIV4_CLOCK 0x3 +set AT91C_TC_CLKS_TIMER_DIV5_CLOCK 0x4 +set AT91C_TC_CLKS_XC0 0x5 +set AT91C_TC_CLKS_XC1 0x6 +set AT91C_TC_CLKS_XC2 0x7 +set AT91C_TC_CLKI [expr 0x1 << 3 ] +set AT91C_TC_CLKI [expr 0x1 << 3 ] +set AT91C_TC_BURST [expr 0x3 << 4 ] +set AT91C_TC_BURST_NONE [expr 0x0 << 4 ] +set AT91C_TC_BURST_XC0 [expr 0x1 << 4 ] +set AT91C_TC_BURST_XC1 [expr 0x2 << 4 ] +set AT91C_TC_BURST_XC2 [expr 0x3 << 4 ] +set AT91C_TC_BURST [expr 0x3 << 4 ] +set AT91C_TC_BURST_NONE [expr 0x0 << 4 ] +set AT91C_TC_BURST_XC0 [expr 0x1 << 4 ] +set AT91C_TC_BURST_XC1 [expr 0x2 << 4 ] +set AT91C_TC_BURST_XC2 [expr 0x3 << 4 ] +set AT91C_TC_CPCSTOP [expr 0x1 << 6 ] +set AT91C_TC_LDBSTOP [expr 0x1 << 6 ] +set AT91C_TC_CPCDIS [expr 0x1 << 7 ] +set AT91C_TC_LDBDIS [expr 0x1 << 7 ] +set AT91C_TC_ETRGEDG [expr 0x3 << 8 ] +set AT91C_TC_ETRGEDG_NONE [expr 0x0 << 8 ] +set AT91C_TC_ETRGEDG_RISING [expr 0x1 << 8 ] +set AT91C_TC_ETRGEDG_FALLING [expr 0x2 << 8 ] +set AT91C_TC_ETRGEDG_BOTH [expr 0x3 << 8 ] +set AT91C_TC_EEVTEDG [expr 0x3 << 8 ] +set AT91C_TC_EEVTEDG_NONE [expr 0x0 << 8 ] +set AT91C_TC_EEVTEDG_RISING [expr 0x1 << 8 ] +set AT91C_TC_EEVTEDG_FALLING [expr 0x2 << 8 ] +set AT91C_TC_EEVTEDG_BOTH [expr 0x3 << 8 ] +set AT91C_TC_EEVT [expr 0x3 << 10 ] +set AT91C_TC_EEVT_TIOB [expr 0x0 << 10 ] +set AT91C_TC_EEVT_XC0 [expr 0x1 << 10 ] +set AT91C_TC_EEVT_XC1 [expr 0x2 << 10 ] +set AT91C_TC_EEVT_XC2 [expr 0x3 << 10 ] +set AT91C_TC_ABETRG [expr 0x1 << 10 ] +set AT91C_TC_ENETRG [expr 0x1 << 12 ] +set AT91C_TC_WAVESEL [expr 0x3 << 13 ] +set AT91C_TC_WAVESEL_UP [expr 0x0 << 13 ] +set AT91C_TC_WAVESEL_UPDOWN [expr 0x1 << 13 ] +set AT91C_TC_WAVESEL_UP_AUTO [expr 0x2 << 13 ] +set AT91C_TC_WAVESEL_UPDOWN_AUTO [expr 0x3 << 13 ] +set AT91C_TC_CPCTRG [expr 0x1 << 14 ] +set AT91C_TC_WAVE [expr 0x1 << 15 ] +set AT91C_TC_WAVE [expr 0x1 << 15 ] +set AT91C_TC_ACPA [expr 0x3 << 16 ] +set AT91C_TC_ACPA_NONE [expr 0x0 << 16 ] +set AT91C_TC_ACPA_SET [expr 0x1 << 16 ] +set AT91C_TC_ACPA_CLEAR [expr 0x2 << 16 ] +set AT91C_TC_ACPA_TOGGLE [expr 0x3 << 16 ] +set AT91C_TC_LDRA [expr 0x3 << 16 ] +set AT91C_TC_LDRA_NONE [expr 0x0 << 16 ] +set AT91C_TC_LDRA_RISING [expr 0x1 << 16 ] +set AT91C_TC_LDRA_FALLING [expr 0x2 << 16 ] +set AT91C_TC_LDRA_BOTH [expr 0x3 << 16 ] +set AT91C_TC_ACPC [expr 0x3 << 18 ] +set AT91C_TC_ACPC_NONE [expr 0x0 << 18 ] +set AT91C_TC_ACPC_SET [expr 0x1 << 18 ] +set AT91C_TC_ACPC_CLEAR [expr 0x2 << 18 ] +set AT91C_TC_ACPC_TOGGLE [expr 0x3 << 18 ] +set AT91C_TC_LDRB [expr 0x3 << 18 ] +set AT91C_TC_LDRB_NONE [expr 0x0 << 18 ] +set AT91C_TC_LDRB_RISING [expr 0x1 << 18 ] +set AT91C_TC_LDRB_FALLING [expr 0x2 << 18 ] +set AT91C_TC_LDRB_BOTH [expr 0x3 << 18 ] +set AT91C_TC_AEEVT [expr 0x3 << 20 ] +set AT91C_TC_AEEVT_NONE [expr 0x0 << 20 ] +set AT91C_TC_AEEVT_SET [expr 0x1 << 20 ] +set AT91C_TC_AEEVT_CLEAR [expr 0x2 << 20 ] +set AT91C_TC_AEEVT_TOGGLE [expr 0x3 << 20 ] +set AT91C_TC_ASWTRG [expr 0x3 << 22 ] +set AT91C_TC_ASWTRG_NONE [expr 0x0 << 22 ] +set AT91C_TC_ASWTRG_SET [expr 0x1 << 22 ] +set AT91C_TC_ASWTRG_CLEAR [expr 0x2 << 22 ] +set AT91C_TC_ASWTRG_TOGGLE [expr 0x3 << 22 ] +set AT91C_TC_BCPB [expr 0x3 << 24 ] +set AT91C_TC_BCPB_NONE [expr 0x0 << 24 ] +set AT91C_TC_BCPB_SET [expr 0x1 << 24 ] +set AT91C_TC_BCPB_CLEAR [expr 0x2 << 24 ] +set AT91C_TC_BCPB_TOGGLE [expr 0x3 << 24 ] +set AT91C_TC_BCPC [expr 0x3 << 26 ] +set AT91C_TC_BCPC_NONE [expr 0x0 << 26 ] +set AT91C_TC_BCPC_SET [expr 0x1 << 26 ] +set AT91C_TC_BCPC_CLEAR [expr 0x2 << 26 ] +set AT91C_TC_BCPC_TOGGLE [expr 0x3 << 26 ] +set AT91C_TC_BEEVT [expr 0x3 << 28 ] +set AT91C_TC_BEEVT_NONE [expr 0x0 << 28 ] +set AT91C_TC_BEEVT_SET [expr 0x1 << 28 ] +set AT91C_TC_BEEVT_CLEAR [expr 0x2 << 28 ] +set AT91C_TC_BEEVT_TOGGLE [expr 0x3 << 28 ] +set AT91C_TC_BSWTRG [expr 0x3 << 30 ] +set AT91C_TC_BSWTRG_NONE [expr 0x0 << 30 ] +set AT91C_TC_BSWTRG_SET [expr 0x1 << 30 ] +set AT91C_TC_BSWTRG_CLEAR [expr 0x2 << 30 ] +set AT91C_TC_BSWTRG_TOGGLE [expr 0x3 << 30 ] +# -------- TC_SR : (TC Offset: 0x20) TC Channel Status Register -------- +set AT91C_TC_COVFS [expr 0x1 << 0 ] +set AT91C_TC_LOVRS [expr 0x1 << 1 ] +set AT91C_TC_CPAS [expr 0x1 << 2 ] +set AT91C_TC_CPBS [expr 0x1 << 3 ] +set AT91C_TC_CPCS [expr 0x1 << 4 ] +set AT91C_TC_LDRAS [expr 0x1 << 5 ] +set AT91C_TC_LDRBS [expr 0x1 << 6 ] +set AT91C_TC_ETRGS [expr 0x1 << 7 ] +set AT91C_TC_CLKSTA [expr 0x1 << 16 ] +set AT91C_TC_MTIOA [expr 0x1 << 17 ] +set AT91C_TC_MTIOB [expr 0x1 << 18 ] +# -------- TC_IER : (TC Offset: 0x24) TC Channel Interrupt Enable Register -------- +set AT91C_TC_COVFS [expr 0x1 << 0 ] +set AT91C_TC_LOVRS [expr 0x1 << 1 ] +set AT91C_TC_CPAS [expr 0x1 << 2 ] +set AT91C_TC_CPBS [expr 0x1 << 3 ] +set AT91C_TC_CPCS [expr 0x1 << 4 ] +set AT91C_TC_LDRAS [expr 0x1 << 5 ] +set AT91C_TC_LDRBS [expr 0x1 << 6 ] +set AT91C_TC_ETRGS [expr 0x1 << 7 ] +# -------- TC_IDR : (TC Offset: 0x28) TC Channel Interrupt Disable Register -------- +set AT91C_TC_COVFS [expr 0x1 << 0 ] +set AT91C_TC_LOVRS [expr 0x1 << 1 ] +set AT91C_TC_CPAS [expr 0x1 << 2 ] +set AT91C_TC_CPBS [expr 0x1 << 3 ] +set AT91C_TC_CPCS [expr 0x1 << 4 ] +set AT91C_TC_LDRAS [expr 0x1 << 5 ] +set AT91C_TC_LDRBS [expr 0x1 << 6 ] +set AT91C_TC_ETRGS [expr 0x1 << 7 ] +# -------- TC_IMR : (TC Offset: 0x2c) TC Channel Interrupt Mask Register -------- +set AT91C_TC_COVFS [expr 0x1 << 0 ] +set AT91C_TC_LOVRS [expr 0x1 << 1 ] +set AT91C_TC_CPAS [expr 0x1 << 2 ] +set AT91C_TC_CPBS [expr 0x1 << 3 ] +set AT91C_TC_CPCS [expr 0x1 << 4 ] +set AT91C_TC_LDRAS [expr 0x1 << 5 ] +set AT91C_TC_LDRBS [expr 0x1 << 6 ] +set AT91C_TC_ETRGS [expr 0x1 << 7 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Timer Counter Interface +# ***************************************************************************** +# -------- TCB_BCR : (TCB Offset: 0xc0) TC Block Control Register -------- +set AT91C_TCB_SYNC [expr 0x1 << 0 ] +# -------- TCB_BMR : (TCB Offset: 0xc4) TC Block Mode Register -------- +set AT91C_TCB_TC0XC0S [expr 0x3 << 0 ] +set AT91C_TCB_TC0XC0S_TCLK0 0x0 +set AT91C_TCB_TC0XC0S_NONE 0x1 +set AT91C_TCB_TC0XC0S_TIOA1 0x2 +set AT91C_TCB_TC0XC0S_TIOA2 0x3 +set AT91C_TCB_TC1XC1S [expr 0x3 << 2 ] +set AT91C_TCB_TC1XC1S_TCLK1 [expr 0x0 << 2 ] +set AT91C_TCB_TC1XC1S_NONE [expr 0x1 << 2 ] +set AT91C_TCB_TC1XC1S_TIOA0 [expr 0x2 << 2 ] +set AT91C_TCB_TC1XC1S_TIOA2 [expr 0x3 << 2 ] +set AT91C_TCB_TC2XC2S [expr 0x3 << 4 ] +set AT91C_TCB_TC2XC2S_TCLK2 [expr 0x0 << 4 ] +set AT91C_TCB_TC2XC2S_NONE [expr 0x1 << 4 ] +set AT91C_TCB_TC2XC2S_TIOA0 [expr 0x2 << 4 ] +set AT91C_TCB_TC2XC2S_TIOA1 [expr 0x3 << 4 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Control Area Network MailBox Interface +# ***************************************************************************** +# -------- CAN_MMR : (CAN_MB Offset: 0x0) CAN Message Mode Register -------- +set AT91C_CAN_MTIMEMARK [expr 0xFFFF << 0 ] +set AT91C_CAN_PRIOR [expr 0xF << 16 ] +set AT91C_CAN_MOT [expr 0x7 << 24 ] +set AT91C_CAN_MOT_DIS [expr 0x0 << 24 ] +set AT91C_CAN_MOT_RX [expr 0x1 << 24 ] +set AT91C_CAN_MOT_RXOVERWRITE [expr 0x2 << 24 ] +set AT91C_CAN_MOT_TX [expr 0x3 << 24 ] +set AT91C_CAN_MOT_CONSUMER [expr 0x4 << 24 ] +set AT91C_CAN_MOT_PRODUCER [expr 0x5 << 24 ] +# -------- CAN_MAM : (CAN_MB Offset: 0x4) CAN Message Acceptance Mask Register -------- +set AT91C_CAN_MIDvB [expr 0x3FFFF << 0 ] +set AT91C_CAN_MIDvA [expr 0x7FF << 18 ] +set AT91C_CAN_MIDE [expr 0x1 << 29 ] +# -------- CAN_MID : (CAN_MB Offset: 0x8) CAN Message ID Register -------- +set AT91C_CAN_MIDvB [expr 0x3FFFF << 0 ] +set AT91C_CAN_MIDvA [expr 0x7FF << 18 ] +set AT91C_CAN_MIDE [expr 0x1 << 29 ] +# -------- CAN_MFID : (CAN_MB Offset: 0xc) CAN Message Family ID Register -------- +# -------- CAN_MSR : (CAN_MB Offset: 0x10) CAN Message Status Register -------- +set AT91C_CAN_MTIMESTAMP [expr 0xFFFF << 0 ] +set AT91C_CAN_MDLC [expr 0xF << 16 ] +set AT91C_CAN_MRTR [expr 0x1 << 20 ] +set AT91C_CAN_MABT [expr 0x1 << 22 ] +set AT91C_CAN_MRDY [expr 0x1 << 23 ] +set AT91C_CAN_MMI [expr 0x1 << 24 ] +# -------- CAN_MDL : (CAN_MB Offset: 0x14) CAN Message Data Low Register -------- +# -------- CAN_MDH : (CAN_MB Offset: 0x18) CAN Message Data High Register -------- +# -------- CAN_MCR : (CAN_MB Offset: 0x1c) CAN Message Control Register -------- +set AT91C_CAN_MDLC [expr 0xF << 16 ] +set AT91C_CAN_MRTR [expr 0x1 << 20 ] +set AT91C_CAN_MACR [expr 0x1 << 22 ] +set AT91C_CAN_MTCR [expr 0x1 << 23 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Control Area Network Interface +# ***************************************************************************** +# -------- CAN_MR : (CAN Offset: 0x0) CAN Mode Register -------- +set AT91C_CAN_CANEN [expr 0x1 << 0 ] +set AT91C_CAN_LPM [expr 0x1 << 1 ] +set AT91C_CAN_ABM [expr 0x1 << 2 ] +set AT91C_CAN_OVL [expr 0x1 << 3 ] +set AT91C_CAN_TEOF [expr 0x1 << 4 ] +set AT91C_CAN_TTM [expr 0x1 << 5 ] +set AT91C_CAN_TIMFRZ [expr 0x1 << 6 ] +set AT91C_CAN_DRPT [expr 0x1 << 7 ] +# -------- CAN_IER : (CAN Offset: 0x4) CAN Interrupt Enable Register -------- +set AT91C_CAN_MB0 [expr 0x1 << 0 ] +set AT91C_CAN_MB1 [expr 0x1 << 1 ] +set AT91C_CAN_MB2 [expr 0x1 << 2 ] +set AT91C_CAN_MB3 [expr 0x1 << 3 ] +set AT91C_CAN_MB4 [expr 0x1 << 4 ] +set AT91C_CAN_MB5 [expr 0x1 << 5 ] +set AT91C_CAN_MB6 [expr 0x1 << 6 ] +set AT91C_CAN_MB7 [expr 0x1 << 7 ] +set AT91C_CAN_MB8 [expr 0x1 << 8 ] +set AT91C_CAN_MB9 [expr 0x1 << 9 ] +set AT91C_CAN_MB10 [expr 0x1 << 10 ] +set AT91C_CAN_MB11 [expr 0x1 << 11 ] +set AT91C_CAN_MB12 [expr 0x1 << 12 ] +set AT91C_CAN_MB13 [expr 0x1 << 13 ] +set AT91C_CAN_MB14 [expr 0x1 << 14 ] +set AT91C_CAN_MB15 [expr 0x1 << 15 ] +set AT91C_CAN_ERRA [expr 0x1 << 16 ] +set AT91C_CAN_WARN [expr 0x1 << 17 ] +set AT91C_CAN_ERRP [expr 0x1 << 18 ] +set AT91C_CAN_BOFF [expr 0x1 << 19 ] +set AT91C_CAN_SLEEP [expr 0x1 << 20 ] +set AT91C_CAN_WAKEUP [expr 0x1 << 21 ] +set AT91C_CAN_TOVF [expr 0x1 << 22 ] +set AT91C_CAN_TSTP [expr 0x1 << 23 ] +set AT91C_CAN_CERR [expr 0x1 << 24 ] +set AT91C_CAN_SERR [expr 0x1 << 25 ] +set AT91C_CAN_AERR [expr 0x1 << 26 ] +set AT91C_CAN_FERR [expr 0x1 << 27 ] +set AT91C_CAN_BERR [expr 0x1 << 28 ] +# -------- CAN_IDR : (CAN Offset: 0x8) CAN Interrupt Disable Register -------- +set AT91C_CAN_MB0 [expr 0x1 << 0 ] +set AT91C_CAN_MB1 [expr 0x1 << 1 ] +set AT91C_CAN_MB2 [expr 0x1 << 2 ] +set AT91C_CAN_MB3 [expr 0x1 << 3 ] +set AT91C_CAN_MB4 [expr 0x1 << 4 ] +set AT91C_CAN_MB5 [expr 0x1 << 5 ] +set AT91C_CAN_MB6 [expr 0x1 << 6 ] +set AT91C_CAN_MB7 [expr 0x1 << 7 ] +set AT91C_CAN_MB8 [expr 0x1 << 8 ] +set AT91C_CAN_MB9 [expr 0x1 << 9 ] +set AT91C_CAN_MB10 [expr 0x1 << 10 ] +set AT91C_CAN_MB11 [expr 0x1 << 11 ] +set AT91C_CAN_MB12 [expr 0x1 << 12 ] +set AT91C_CAN_MB13 [expr 0x1 << 13 ] +set AT91C_CAN_MB14 [expr 0x1 << 14 ] +set AT91C_CAN_MB15 [expr 0x1 << 15 ] +set AT91C_CAN_ERRA [expr 0x1 << 16 ] +set AT91C_CAN_WARN [expr 0x1 << 17 ] +set AT91C_CAN_ERRP [expr 0x1 << 18 ] +set AT91C_CAN_BOFF [expr 0x1 << 19 ] +set AT91C_CAN_SLEEP [expr 0x1 << 20 ] +set AT91C_CAN_WAKEUP [expr 0x1 << 21 ] +set AT91C_CAN_TOVF [expr 0x1 << 22 ] +set AT91C_CAN_TSTP [expr 0x1 << 23 ] +set AT91C_CAN_CERR [expr 0x1 << 24 ] +set AT91C_CAN_SERR [expr 0x1 << 25 ] +set AT91C_CAN_AERR [expr 0x1 << 26 ] +set AT91C_CAN_FERR [expr 0x1 << 27 ] +set AT91C_CAN_BERR [expr 0x1 << 28 ] +# -------- CAN_IMR : (CAN Offset: 0xc) CAN Interrupt Mask Register -------- +set AT91C_CAN_MB0 [expr 0x1 << 0 ] +set AT91C_CAN_MB1 [expr 0x1 << 1 ] +set AT91C_CAN_MB2 [expr 0x1 << 2 ] +set AT91C_CAN_MB3 [expr 0x1 << 3 ] +set AT91C_CAN_MB4 [expr 0x1 << 4 ] +set AT91C_CAN_MB5 [expr 0x1 << 5 ] +set AT91C_CAN_MB6 [expr 0x1 << 6 ] +set AT91C_CAN_MB7 [expr 0x1 << 7 ] +set AT91C_CAN_MB8 [expr 0x1 << 8 ] +set AT91C_CAN_MB9 [expr 0x1 << 9 ] +set AT91C_CAN_MB10 [expr 0x1 << 10 ] +set AT91C_CAN_MB11 [expr 0x1 << 11 ] +set AT91C_CAN_MB12 [expr 0x1 << 12 ] +set AT91C_CAN_MB13 [expr 0x1 << 13 ] +set AT91C_CAN_MB14 [expr 0x1 << 14 ] +set AT91C_CAN_MB15 [expr 0x1 << 15 ] +set AT91C_CAN_ERRA [expr 0x1 << 16 ] +set AT91C_CAN_WARN [expr 0x1 << 17 ] +set AT91C_CAN_ERRP [expr 0x1 << 18 ] +set AT91C_CAN_BOFF [expr 0x1 << 19 ] +set AT91C_CAN_SLEEP [expr 0x1 << 20 ] +set AT91C_CAN_WAKEUP [expr 0x1 << 21 ] +set AT91C_CAN_TOVF [expr 0x1 << 22 ] +set AT91C_CAN_TSTP [expr 0x1 << 23 ] +set AT91C_CAN_CERR [expr 0x1 << 24 ] +set AT91C_CAN_SERR [expr 0x1 << 25 ] +set AT91C_CAN_AERR [expr 0x1 << 26 ] +set AT91C_CAN_FERR [expr 0x1 << 27 ] +set AT91C_CAN_BERR [expr 0x1 << 28 ] +# -------- CAN_SR : (CAN Offset: 0x10) CAN Status Register -------- +set AT91C_CAN_MB0 [expr 0x1 << 0 ] +set AT91C_CAN_MB1 [expr 0x1 << 1 ] +set AT91C_CAN_MB2 [expr 0x1 << 2 ] +set AT91C_CAN_MB3 [expr 0x1 << 3 ] +set AT91C_CAN_MB4 [expr 0x1 << 4 ] +set AT91C_CAN_MB5 [expr 0x1 << 5 ] +set AT91C_CAN_MB6 [expr 0x1 << 6 ] +set AT91C_CAN_MB7 [expr 0x1 << 7 ] +set AT91C_CAN_MB8 [expr 0x1 << 8 ] +set AT91C_CAN_MB9 [expr 0x1 << 9 ] +set AT91C_CAN_MB10 [expr 0x1 << 10 ] +set AT91C_CAN_MB11 [expr 0x1 << 11 ] +set AT91C_CAN_MB12 [expr 0x1 << 12 ] +set AT91C_CAN_MB13 [expr 0x1 << 13 ] +set AT91C_CAN_MB14 [expr 0x1 << 14 ] +set AT91C_CAN_MB15 [expr 0x1 << 15 ] +set AT91C_CAN_ERRA [expr 0x1 << 16 ] +set AT91C_CAN_WARN [expr 0x1 << 17 ] +set AT91C_CAN_ERRP [expr 0x1 << 18 ] +set AT91C_CAN_BOFF [expr 0x1 << 19 ] +set AT91C_CAN_SLEEP [expr 0x1 << 20 ] +set AT91C_CAN_WAKEUP [expr 0x1 << 21 ] +set AT91C_CAN_TOVF [expr 0x1 << 22 ] +set AT91C_CAN_TSTP [expr 0x1 << 23 ] +set AT91C_CAN_CERR [expr 0x1 << 24 ] +set AT91C_CAN_SERR [expr 0x1 << 25 ] +set AT91C_CAN_AERR [expr 0x1 << 26 ] +set AT91C_CAN_FERR [expr 0x1 << 27 ] +set AT91C_CAN_BERR [expr 0x1 << 28 ] +set AT91C_CAN_RBSY [expr 0x1 << 29 ] +set AT91C_CAN_TBSY [expr 0x1 << 30 ] +set AT91C_CAN_OVLY [expr 0x1 << 31 ] +# -------- CAN_BR : (CAN Offset: 0x14) CAN Baudrate Register -------- +set AT91C_CAN_PHASE2 [expr 0x7 << 0 ] +set AT91C_CAN_PHASE1 [expr 0x7 << 4 ] +set AT91C_CAN_PROPAG [expr 0x7 << 8 ] +set AT91C_CAN_SYNC [expr 0x3 << 12 ] +set AT91C_CAN_BRP [expr 0x7F << 16 ] +set AT91C_CAN_SMP [expr 0x1 << 24 ] +# -------- CAN_TIM : (CAN Offset: 0x18) CAN Timer Register -------- +set AT91C_CAN_TIMER [expr 0xFFFF << 0 ] +# -------- CAN_TIMESTP : (CAN Offset: 0x1c) CAN Timestamp Register -------- +set AT91C_CAN_MTIMESTAMP [expr 0xFFFF << 0 ] +# -------- CAN_ECR : (CAN Offset: 0x20) CAN Error Counter Register -------- +set AT91C_CAN_REC [expr 0xFF << 0 ] +set AT91C_CAN_TEC [expr 0xFF << 16 ] +# -------- CAN_TCR : (CAN Offset: 0x24) CAN Transfer Command Register -------- +set AT91C_CAN_MB0 [expr 0x1 << 0 ] +set AT91C_CAN_MB1 [expr 0x1 << 1 ] +set AT91C_CAN_MB2 [expr 0x1 << 2 ] +set AT91C_CAN_MB3 [expr 0x1 << 3 ] +set AT91C_CAN_MB4 [expr 0x1 << 4 ] +set AT91C_CAN_MB5 [expr 0x1 << 5 ] +set AT91C_CAN_MB6 [expr 0x1 << 6 ] +set AT91C_CAN_MB7 [expr 0x1 << 7 ] +set AT91C_CAN_MB8 [expr 0x1 << 8 ] +set AT91C_CAN_MB9 [expr 0x1 << 9 ] +set AT91C_CAN_MB10 [expr 0x1 << 10 ] +set AT91C_CAN_MB11 [expr 0x1 << 11 ] +set AT91C_CAN_MB12 [expr 0x1 << 12 ] +set AT91C_CAN_MB13 [expr 0x1 << 13 ] +set AT91C_CAN_MB14 [expr 0x1 << 14 ] +set AT91C_CAN_MB15 [expr 0x1 << 15 ] +set AT91C_CAN_TIMRST [expr 0x1 << 31 ] +# -------- CAN_ACR : (CAN Offset: 0x28) CAN Abort Command Register -------- +set AT91C_CAN_MB0 [expr 0x1 << 0 ] +set AT91C_CAN_MB1 [expr 0x1 << 1 ] +set AT91C_CAN_MB2 [expr 0x1 << 2 ] +set AT91C_CAN_MB3 [expr 0x1 << 3 ] +set AT91C_CAN_MB4 [expr 0x1 << 4 ] +set AT91C_CAN_MB5 [expr 0x1 << 5 ] +set AT91C_CAN_MB6 [expr 0x1 << 6 ] +set AT91C_CAN_MB7 [expr 0x1 << 7 ] +set AT91C_CAN_MB8 [expr 0x1 << 8 ] +set AT91C_CAN_MB9 [expr 0x1 << 9 ] +set AT91C_CAN_MB10 [expr 0x1 << 10 ] +set AT91C_CAN_MB11 [expr 0x1 << 11 ] +set AT91C_CAN_MB12 [expr 0x1 << 12 ] +set AT91C_CAN_MB13 [expr 0x1 << 13 ] +set AT91C_CAN_MB14 [expr 0x1 << 14 ] +set AT91C_CAN_MB15 [expr 0x1 << 15 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Ethernet MAC 10/100 +# ***************************************************************************** +# -------- EMAC_NCR : (EMAC Offset: 0x0) -------- +set AT91C_EMAC_LB [expr 0x1 << 0 ] +set AT91C_EMAC_LLB [expr 0x1 << 1 ] +set AT91C_EMAC_RE [expr 0x1 << 2 ] +set AT91C_EMAC_TE [expr 0x1 << 3 ] +set AT91C_EMAC_MPE [expr 0x1 << 4 ] +set AT91C_EMAC_CLRSTAT [expr 0x1 << 5 ] +set AT91C_EMAC_INCSTAT [expr 0x1 << 6 ] +set AT91C_EMAC_WESTAT [expr 0x1 << 7 ] +set AT91C_EMAC_BP [expr 0x1 << 8 ] +set AT91C_EMAC_TSTART [expr 0x1 << 9 ] +set AT91C_EMAC_THALT [expr 0x1 << 10 ] +set AT91C_EMAC_TPFR [expr 0x1 << 11 ] +set AT91C_EMAC_TZQ [expr 0x1 << 12 ] +# -------- EMAC_NCFGR : (EMAC Offset: 0x4) Network Configuration Register -------- +set AT91C_EMAC_SPD [expr 0x1 << 0 ] +set AT91C_EMAC_FD [expr 0x1 << 1 ] +set AT91C_EMAC_JFRAME [expr 0x1 << 3 ] +set AT91C_EMAC_CAF [expr 0x1 << 4 ] +set AT91C_EMAC_NBC [expr 0x1 << 5 ] +set AT91C_EMAC_MTI [expr 0x1 << 6 ] +set AT91C_EMAC_UNI [expr 0x1 << 7 ] +set AT91C_EMAC_BIG [expr 0x1 << 8 ] +set AT91C_EMAC_EAE [expr 0x1 << 9 ] +set AT91C_EMAC_CLK [expr 0x3 << 10 ] +set AT91C_EMAC_CLK_HCLK_8 [expr 0x0 << 10 ] +set AT91C_EMAC_CLK_HCLK_16 [expr 0x1 << 10 ] +set AT91C_EMAC_CLK_HCLK_32 [expr 0x2 << 10 ] +set AT91C_EMAC_CLK_HCLK_64 [expr 0x3 << 10 ] +set AT91C_EMAC_RTY [expr 0x1 << 12 ] +set AT91C_EMAC_PAE [expr 0x1 << 13 ] +set AT91C_EMAC_RBOF [expr 0x3 << 14 ] +set AT91C_EMAC_RBOF_OFFSET_0 [expr 0x0 << 14 ] +set AT91C_EMAC_RBOF_OFFSET_1 [expr 0x1 << 14 ] +set AT91C_EMAC_RBOF_OFFSET_2 [expr 0x2 << 14 ] +set AT91C_EMAC_RBOF_OFFSET_3 [expr 0x3 << 14 ] +set AT91C_EMAC_RLCE [expr 0x1 << 16 ] +set AT91C_EMAC_DRFCS [expr 0x1 << 17 ] +set AT91C_EMAC_EFRHD [expr 0x1 << 18 ] +set AT91C_EMAC_IRXFCS [expr 0x1 << 19 ] +# -------- EMAC_NSR : (EMAC Offset: 0x8) Network Status Register -------- +set AT91C_EMAC_LINKR [expr 0x1 << 0 ] +set AT91C_EMAC_MDIO [expr 0x1 << 1 ] +set AT91C_EMAC_IDLE [expr 0x1 << 2 ] +# -------- EMAC_TSR : (EMAC Offset: 0x14) Transmit Status Register -------- +set AT91C_EMAC_UBR [expr 0x1 << 0 ] +set AT91C_EMAC_COL [expr 0x1 << 1 ] +set AT91C_EMAC_RLES [expr 0x1 << 2 ] +set AT91C_EMAC_TGO [expr 0x1 << 3 ] +set AT91C_EMAC_BEX [expr 0x1 << 4 ] +set AT91C_EMAC_COMP [expr 0x1 << 5 ] +set AT91C_EMAC_UND [expr 0x1 << 6 ] +# -------- EMAC_RSR : (EMAC Offset: 0x20) Receive Status Register -------- +set AT91C_EMAC_BNA [expr 0x1 << 0 ] +set AT91C_EMAC_REC [expr 0x1 << 1 ] +set AT91C_EMAC_OVR [expr 0x1 << 2 ] +# -------- EMAC_ISR : (EMAC Offset: 0x24) Interrupt Status Register -------- +set AT91C_EMAC_MFD [expr 0x1 << 0 ] +set AT91C_EMAC_RCOMP [expr 0x1 << 1 ] +set AT91C_EMAC_RXUBR [expr 0x1 << 2 ] +set AT91C_EMAC_TXUBR [expr 0x1 << 3 ] +set AT91C_EMAC_TUNDR [expr 0x1 << 4 ] +set AT91C_EMAC_RLEX [expr 0x1 << 5 ] +set AT91C_EMAC_TXERR [expr 0x1 << 6 ] +set AT91C_EMAC_TCOMP [expr 0x1 << 7 ] +set AT91C_EMAC_LINK [expr 0x1 << 9 ] +set AT91C_EMAC_ROVR [expr 0x1 << 10 ] +set AT91C_EMAC_HRESP [expr 0x1 << 11 ] +set AT91C_EMAC_PFRE [expr 0x1 << 12 ] +set AT91C_EMAC_PTZ [expr 0x1 << 13 ] +# -------- EMAC_IER : (EMAC Offset: 0x28) Interrupt Enable Register -------- +set AT91C_EMAC_MFD [expr 0x1 << 0 ] +set AT91C_EMAC_RCOMP [expr 0x1 << 1 ] +set AT91C_EMAC_RXUBR [expr 0x1 << 2 ] +set AT91C_EMAC_TXUBR [expr 0x1 << 3 ] +set AT91C_EMAC_TUNDR [expr 0x1 << 4 ] +set AT91C_EMAC_RLEX [expr 0x1 << 5 ] +set AT91C_EMAC_TXERR [expr 0x1 << 6 ] +set AT91C_EMAC_TCOMP [expr 0x1 << 7 ] +set AT91C_EMAC_LINK [expr 0x1 << 9 ] +set AT91C_EMAC_ROVR [expr 0x1 << 10 ] +set AT91C_EMAC_HRESP [expr 0x1 << 11 ] +set AT91C_EMAC_PFRE [expr 0x1 << 12 ] +set AT91C_EMAC_PTZ [expr 0x1 << 13 ] +# -------- EMAC_IDR : (EMAC Offset: 0x2c) Interrupt Disable Register -------- +set AT91C_EMAC_MFD [expr 0x1 << 0 ] +set AT91C_EMAC_RCOMP [expr 0x1 << 1 ] +set AT91C_EMAC_RXUBR [expr 0x1 << 2 ] +set AT91C_EMAC_TXUBR [expr 0x1 << 3 ] +set AT91C_EMAC_TUNDR [expr 0x1 << 4 ] +set AT91C_EMAC_RLEX [expr 0x1 << 5 ] +set AT91C_EMAC_TXERR [expr 0x1 << 6 ] +set AT91C_EMAC_TCOMP [expr 0x1 << 7 ] +set AT91C_EMAC_LINK [expr 0x1 << 9 ] +set AT91C_EMAC_ROVR [expr 0x1 << 10 ] +set AT91C_EMAC_HRESP [expr 0x1 << 11 ] +set AT91C_EMAC_PFRE [expr 0x1 << 12 ] +set AT91C_EMAC_PTZ [expr 0x1 << 13 ] +# -------- EMAC_IMR : (EMAC Offset: 0x30) Interrupt Mask Register -------- +set AT91C_EMAC_MFD [expr 0x1 << 0 ] +set AT91C_EMAC_RCOMP [expr 0x1 << 1 ] +set AT91C_EMAC_RXUBR [expr 0x1 << 2 ] +set AT91C_EMAC_TXUBR [expr 0x1 << 3 ] +set AT91C_EMAC_TUNDR [expr 0x1 << 4 ] +set AT91C_EMAC_RLEX [expr 0x1 << 5 ] +set AT91C_EMAC_TXERR [expr 0x1 << 6 ] +set AT91C_EMAC_TCOMP [expr 0x1 << 7 ] +set AT91C_EMAC_LINK [expr 0x1 << 9 ] +set AT91C_EMAC_ROVR [expr 0x1 << 10 ] +set AT91C_EMAC_HRESP [expr 0x1 << 11 ] +set AT91C_EMAC_PFRE [expr 0x1 << 12 ] +set AT91C_EMAC_PTZ [expr 0x1 << 13 ] +# -------- EMAC_MAN : (EMAC Offset: 0x34) PHY Maintenance Register -------- +set AT91C_EMAC_DATA [expr 0xFFFF << 0 ] +set AT91C_EMAC_CODE [expr 0x3 << 16 ] +set AT91C_EMAC_REGA [expr 0x1F << 18 ] +set AT91C_EMAC_PHYA [expr 0x1F << 23 ] +set AT91C_EMAC_RW [expr 0x3 << 28 ] +set AT91C_EMAC_SOF [expr 0x3 << 30 ] +# -------- EMAC_USRIO : (EMAC Offset: 0xc0) USER Input Output Register -------- +set AT91C_EMAC_RMII [expr 0x1 << 0 ] +set AT91C_EMAC_CLKEN [expr 0x1 << 1 ] +# -------- EMAC_WOL : (EMAC Offset: 0xc4) Wake On LAN Register -------- +set AT91C_EMAC_IP [expr 0xFFFF << 0 ] +set AT91C_EMAC_MAG [expr 0x1 << 16 ] +set AT91C_EMAC_ARP [expr 0x1 << 17 ] +set AT91C_EMAC_SA1 [expr 0x1 << 18 ] +set AT91C_EMAC_MTI [expr 0x1 << 19 ] +# -------- EMAC_REV : (EMAC Offset: 0xfc) Revision Register -------- +set AT91C_EMAC_REVREF [expr 0xFFFF << 0 ] +set AT91C_EMAC_PARTREF [expr 0xFFFF << 16 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Analog to Digital Convertor +# ***************************************************************************** +# -------- ADC_CR : (ADC Offset: 0x0) ADC Control Register -------- +set AT91C_ADC_SWRST [expr 0x1 << 0 ] +set AT91C_ADC_START [expr 0x1 << 1 ] +# -------- ADC_MR : (ADC Offset: 0x4) ADC Mode Register -------- +set AT91C_ADC_TRGEN [expr 0x1 << 0 ] +set AT91C_ADC_TRGEN_DIS 0x0 +set AT91C_ADC_TRGEN_EN 0x1 +set AT91C_ADC_TRGSEL [expr 0x7 << 1 ] +set AT91C_ADC_TRGSEL_TIOA0 [expr 0x0 << 1 ] +set AT91C_ADC_TRGSEL_TIOA1 [expr 0x1 << 1 ] +set AT91C_ADC_TRGSEL_TIOA2 [expr 0x2 << 1 ] +set AT91C_ADC_TRGSEL_TIOA3 [expr 0x3 << 1 ] +set AT91C_ADC_TRGSEL_TIOA4 [expr 0x4 << 1 ] +set AT91C_ADC_TRGSEL_TIOA5 [expr 0x5 << 1 ] +set AT91C_ADC_TRGSEL_EXT [expr 0x6 << 1 ] +set AT91C_ADC_LOWRES [expr 0x1 << 4 ] +set AT91C_ADC_LOWRES_10_BIT [expr 0x0 << 4 ] +set AT91C_ADC_LOWRES_8_BIT [expr 0x1 << 4 ] +set AT91C_ADC_SLEEP [expr 0x1 << 5 ] +set AT91C_ADC_SLEEP_NORMAL_MODE [expr 0x0 << 5 ] +set AT91C_ADC_SLEEP_MODE [expr 0x1 << 5 ] +set AT91C_ADC_PRESCAL [expr 0x3F << 8 ] +set AT91C_ADC_STARTUP [expr 0x1F << 16 ] +set AT91C_ADC_SHTIM [expr 0xF << 24 ] +# -------- ADC_CHER : (ADC Offset: 0x10) ADC Channel Enable Register -------- +set AT91C_ADC_CH0 [expr 0x1 << 0 ] +set AT91C_ADC_CH1 [expr 0x1 << 1 ] +set AT91C_ADC_CH2 [expr 0x1 << 2 ] +set AT91C_ADC_CH3 [expr 0x1 << 3 ] +set AT91C_ADC_CH4 [expr 0x1 << 4 ] +set AT91C_ADC_CH5 [expr 0x1 << 5 ] +set AT91C_ADC_CH6 [expr 0x1 << 6 ] +set AT91C_ADC_CH7 [expr 0x1 << 7 ] +# -------- ADC_CHDR : (ADC Offset: 0x14) ADC Channel Disable Register -------- +set AT91C_ADC_CH0 [expr 0x1 << 0 ] +set AT91C_ADC_CH1 [expr 0x1 << 1 ] +set AT91C_ADC_CH2 [expr 0x1 << 2 ] +set AT91C_ADC_CH3 [expr 0x1 << 3 ] +set AT91C_ADC_CH4 [expr 0x1 << 4 ] +set AT91C_ADC_CH5 [expr 0x1 << 5 ] +set AT91C_ADC_CH6 [expr 0x1 << 6 ] +set AT91C_ADC_CH7 [expr 0x1 << 7 ] +# -------- ADC_CHSR : (ADC Offset: 0x18) ADC Channel Status Register -------- +set AT91C_ADC_CH0 [expr 0x1 << 0 ] +set AT91C_ADC_CH1 [expr 0x1 << 1 ] +set AT91C_ADC_CH2 [expr 0x1 << 2 ] +set AT91C_ADC_CH3 [expr 0x1 << 3 ] +set AT91C_ADC_CH4 [expr 0x1 << 4 ] +set AT91C_ADC_CH5 [expr 0x1 << 5 ] +set AT91C_ADC_CH6 [expr 0x1 << 6 ] +set AT91C_ADC_CH7 [expr 0x1 << 7 ] +# -------- ADC_SR : (ADC Offset: 0x1c) ADC Status Register -------- +set AT91C_ADC_EOC0 [expr 0x1 << 0 ] +set AT91C_ADC_EOC1 [expr 0x1 << 1 ] +set AT91C_ADC_EOC2 [expr 0x1 << 2 ] +set AT91C_ADC_EOC3 [expr 0x1 << 3 ] +set AT91C_ADC_EOC4 [expr 0x1 << 4 ] +set AT91C_ADC_EOC5 [expr 0x1 << 5 ] +set AT91C_ADC_EOC6 [expr 0x1 << 6 ] +set AT91C_ADC_EOC7 [expr 0x1 << 7 ] +set AT91C_ADC_OVRE0 [expr 0x1 << 8 ] +set AT91C_ADC_OVRE1 [expr 0x1 << 9 ] +set AT91C_ADC_OVRE2 [expr 0x1 << 10 ] +set AT91C_ADC_OVRE3 [expr 0x1 << 11 ] +set AT91C_ADC_OVRE4 [expr 0x1 << 12 ] +set AT91C_ADC_OVRE5 [expr 0x1 << 13 ] +set AT91C_ADC_OVRE6 [expr 0x1 << 14 ] +set AT91C_ADC_OVRE7 [expr 0x1 << 15 ] +set AT91C_ADC_DRDY [expr 0x1 << 16 ] +set AT91C_ADC_GOVRE [expr 0x1 << 17 ] +set AT91C_ADC_ENDRX [expr 0x1 << 18 ] +set AT91C_ADC_RXBUFF [expr 0x1 << 19 ] +# -------- ADC_LCDR : (ADC Offset: 0x20) ADC Last Converted Data Register -------- +set AT91C_ADC_LDATA [expr 0x3FF << 0 ] +# -------- ADC_IER : (ADC Offset: 0x24) ADC Interrupt Enable Register -------- +set AT91C_ADC_EOC0 [expr 0x1 << 0 ] +set AT91C_ADC_EOC1 [expr 0x1 << 1 ] +set AT91C_ADC_EOC2 [expr 0x1 << 2 ] +set AT91C_ADC_EOC3 [expr 0x1 << 3 ] +set AT91C_ADC_EOC4 [expr 0x1 << 4 ] +set AT91C_ADC_EOC5 [expr 0x1 << 5 ] +set AT91C_ADC_EOC6 [expr 0x1 << 6 ] +set AT91C_ADC_EOC7 [expr 0x1 << 7 ] +set AT91C_ADC_OVRE0 [expr 0x1 << 8 ] +set AT91C_ADC_OVRE1 [expr 0x1 << 9 ] +set AT91C_ADC_OVRE2 [expr 0x1 << 10 ] +set AT91C_ADC_OVRE3 [expr 0x1 << 11 ] +set AT91C_ADC_OVRE4 [expr 0x1 << 12 ] +set AT91C_ADC_OVRE5 [expr 0x1 << 13 ] +set AT91C_ADC_OVRE6 [expr 0x1 << 14 ] +set AT91C_ADC_OVRE7 [expr 0x1 << 15 ] +set AT91C_ADC_DRDY [expr 0x1 << 16 ] +set AT91C_ADC_GOVRE [expr 0x1 << 17 ] +set AT91C_ADC_ENDRX [expr 0x1 << 18 ] +set AT91C_ADC_RXBUFF [expr 0x1 << 19 ] +# -------- ADC_IDR : (ADC Offset: 0x28) ADC Interrupt Disable Register -------- +set AT91C_ADC_EOC0 [expr 0x1 << 0 ] +set AT91C_ADC_EOC1 [expr 0x1 << 1 ] +set AT91C_ADC_EOC2 [expr 0x1 << 2 ] +set AT91C_ADC_EOC3 [expr 0x1 << 3 ] +set AT91C_ADC_EOC4 [expr 0x1 << 4 ] +set AT91C_ADC_EOC5 [expr 0x1 << 5 ] +set AT91C_ADC_EOC6 [expr 0x1 << 6 ] +set AT91C_ADC_EOC7 [expr 0x1 << 7 ] +set AT91C_ADC_OVRE0 [expr 0x1 << 8 ] +set AT91C_ADC_OVRE1 [expr 0x1 << 9 ] +set AT91C_ADC_OVRE2 [expr 0x1 << 10 ] +set AT91C_ADC_OVRE3 [expr 0x1 << 11 ] +set AT91C_ADC_OVRE4 [expr 0x1 << 12 ] +set AT91C_ADC_OVRE5 [expr 0x1 << 13 ] +set AT91C_ADC_OVRE6 [expr 0x1 << 14 ] +set AT91C_ADC_OVRE7 [expr 0x1 << 15 ] +set AT91C_ADC_DRDY [expr 0x1 << 16 ] +set AT91C_ADC_GOVRE [expr 0x1 << 17 ] +set AT91C_ADC_ENDRX [expr 0x1 << 18 ] +set AT91C_ADC_RXBUFF [expr 0x1 << 19 ] +# -------- ADC_IMR : (ADC Offset: 0x2c) ADC Interrupt Mask Register -------- +set AT91C_ADC_EOC0 [expr 0x1 << 0 ] +set AT91C_ADC_EOC1 [expr 0x1 << 1 ] +set AT91C_ADC_EOC2 [expr 0x1 << 2 ] +set AT91C_ADC_EOC3 [expr 0x1 << 3 ] +set AT91C_ADC_EOC4 [expr 0x1 << 4 ] +set AT91C_ADC_EOC5 [expr 0x1 << 5 ] +set AT91C_ADC_EOC6 [expr 0x1 << 6 ] +set AT91C_ADC_EOC7 [expr 0x1 << 7 ] +set AT91C_ADC_OVRE0 [expr 0x1 << 8 ] +set AT91C_ADC_OVRE1 [expr 0x1 << 9 ] +set AT91C_ADC_OVRE2 [expr 0x1 << 10 ] +set AT91C_ADC_OVRE3 [expr 0x1 << 11 ] +set AT91C_ADC_OVRE4 [expr 0x1 << 12 ] +set AT91C_ADC_OVRE5 [expr 0x1 << 13 ] +set AT91C_ADC_OVRE6 [expr 0x1 << 14 ] +set AT91C_ADC_OVRE7 [expr 0x1 << 15 ] +set AT91C_ADC_DRDY [expr 0x1 << 16 ] +set AT91C_ADC_GOVRE [expr 0x1 << 17 ] +set AT91C_ADC_ENDRX [expr 0x1 << 18 ] +set AT91C_ADC_RXBUFF [expr 0x1 << 19 ] +# -------- ADC_CDR0 : (ADC Offset: 0x30) ADC Channel Data Register 0 -------- +set AT91C_ADC_DATA [expr 0x3FF << 0 ] +# -------- ADC_CDR1 : (ADC Offset: 0x34) ADC Channel Data Register 1 -------- +set AT91C_ADC_DATA [expr 0x3FF << 0 ] +# -------- ADC_CDR2 : (ADC Offset: 0x38) ADC Channel Data Register 2 -------- +set AT91C_ADC_DATA [expr 0x3FF << 0 ] +# -------- ADC_CDR3 : (ADC Offset: 0x3c) ADC Channel Data Register 3 -------- +set AT91C_ADC_DATA [expr 0x3FF << 0 ] +# -------- ADC_CDR4 : (ADC Offset: 0x40) ADC Channel Data Register 4 -------- +set AT91C_ADC_DATA [expr 0x3FF << 0 ] +# -------- ADC_CDR5 : (ADC Offset: 0x44) ADC Channel Data Register 5 -------- +set AT91C_ADC_DATA [expr 0x3FF << 0 ] +# -------- ADC_CDR6 : (ADC Offset: 0x48) ADC Channel Data Register 6 -------- +set AT91C_ADC_DATA [expr 0x3FF << 0 ] +# -------- ADC_CDR7 : (ADC Offset: 0x4c) ADC Channel Data Register 7 -------- +set AT91C_ADC_DATA [expr 0x3FF << 0 ] + +# ***************************************************************************** +# REGISTER ADDRESS DEFINITION FOR AT91SAM7X256 +# ***************************************************************************** +# ========== Register definition for SYS peripheral ========== +# ========== Register definition for AIC peripheral ========== +set AT91C_AIC_IVR 0xFFFFF100 +set AT91C_AIC_SMR 0xFFFFF000 +set AT91C_AIC_FVR 0xFFFFF104 +set AT91C_AIC_DCR 0xFFFFF138 +set AT91C_AIC_EOICR 0xFFFFF130 +set AT91C_AIC_SVR 0xFFFFF080 +set AT91C_AIC_FFSR 0xFFFFF148 +set AT91C_AIC_ICCR 0xFFFFF128 +set AT91C_AIC_ISR 0xFFFFF108 +set AT91C_AIC_IMR 0xFFFFF110 +set AT91C_AIC_IPR 0xFFFFF10C +set AT91C_AIC_FFER 0xFFFFF140 +set AT91C_AIC_IECR 0xFFFFF120 +set AT91C_AIC_ISCR 0xFFFFF12C +set AT91C_AIC_FFDR 0xFFFFF144 +set AT91C_AIC_CISR 0xFFFFF114 +set AT91C_AIC_IDCR 0xFFFFF124 +set AT91C_AIC_SPU 0xFFFFF134 +# ========== Register definition for PDC_DBGU peripheral ========== +set AT91C_DBGU_TCR 0xFFFFF30C +set AT91C_DBGU_RNPR 0xFFFFF310 +set AT91C_DBGU_TNPR 0xFFFFF318 +set AT91C_DBGU_TPR 0xFFFFF308 +set AT91C_DBGU_RPR 0xFFFFF300 +set AT91C_DBGU_RCR 0xFFFFF304 +set AT91C_DBGU_RNCR 0xFFFFF314 +set AT91C_DBGU_PTCR 0xFFFFF320 +set AT91C_DBGU_PTSR 0xFFFFF324 +set AT91C_DBGU_TNCR 0xFFFFF31C +# ========== Register definition for DBGU peripheral ========== +set AT91C_DBGU_EXID 0xFFFFF244 +set AT91C_DBGU_BRGR 0xFFFFF220 +set AT91C_DBGU_IDR 0xFFFFF20C +set AT91C_DBGU_CSR 0xFFFFF214 +set AT91C_DBGU_CIDR 0xFFFFF240 +set AT91C_DBGU_MR 0xFFFFF204 +set AT91C_DBGU_IMR 0xFFFFF210 +set AT91C_DBGU_CR 0xFFFFF200 +set AT91C_DBGU_FNTR 0xFFFFF248 +set AT91C_DBGU_THR 0xFFFFF21C +set AT91C_DBGU_RHR 0xFFFFF218 +set AT91C_DBGU_IER 0xFFFFF208 +# ========== Register definition for PIOA peripheral ========== +set AT91C_PIOA_ODR 0xFFFFF414 +set AT91C_PIOA_SODR 0xFFFFF430 +set AT91C_PIOA_ISR 0xFFFFF44C +set AT91C_PIOA_ABSR 0xFFFFF478 +set AT91C_PIOA_IER 0xFFFFF440 +set AT91C_PIOA_PPUDR 0xFFFFF460 +set AT91C_PIOA_IMR 0xFFFFF448 +set AT91C_PIOA_PER 0xFFFFF400 +set AT91C_PIOA_IFDR 0xFFFFF424 +set AT91C_PIOA_OWDR 0xFFFFF4A4 +set AT91C_PIOA_MDSR 0xFFFFF458 +set AT91C_PIOA_IDR 0xFFFFF444 +set AT91C_PIOA_ODSR 0xFFFFF438 +set AT91C_PIOA_PPUSR 0xFFFFF468 +set AT91C_PIOA_OWSR 0xFFFFF4A8 +set AT91C_PIOA_BSR 0xFFFFF474 +set AT91C_PIOA_OWER 0xFFFFF4A0 +set AT91C_PIOA_IFER 0xFFFFF420 +set AT91C_PIOA_PDSR 0xFFFFF43C +set AT91C_PIOA_PPUER 0xFFFFF464 +set AT91C_PIOA_OSR 0xFFFFF418 +set AT91C_PIOA_ASR 0xFFFFF470 +set AT91C_PIOA_MDDR 0xFFFFF454 +set AT91C_PIOA_CODR 0xFFFFF434 +set AT91C_PIOA_MDER 0xFFFFF450 +set AT91C_PIOA_PDR 0xFFFFF404 +set AT91C_PIOA_IFSR 0xFFFFF428 +set AT91C_PIOA_OER 0xFFFFF410 +set AT91C_PIOA_PSR 0xFFFFF408 +# ========== Register definition for PIOB peripheral ========== +set AT91C_PIOB_OWDR 0xFFFFF6A4 +set AT91C_PIOB_MDER 0xFFFFF650 +set AT91C_PIOB_PPUSR 0xFFFFF668 +set AT91C_PIOB_IMR 0xFFFFF648 +set AT91C_PIOB_ASR 0xFFFFF670 +set AT91C_PIOB_PPUDR 0xFFFFF660 +set AT91C_PIOB_PSR 0xFFFFF608 +set AT91C_PIOB_IER 0xFFFFF640 +set AT91C_PIOB_CODR 0xFFFFF634 +set AT91C_PIOB_OWER 0xFFFFF6A0 +set AT91C_PIOB_ABSR 0xFFFFF678 +set AT91C_PIOB_IFDR 0xFFFFF624 +set AT91C_PIOB_PDSR 0xFFFFF63C +set AT91C_PIOB_IDR 0xFFFFF644 +set AT91C_PIOB_OWSR 0xFFFFF6A8 +set AT91C_PIOB_PDR 0xFFFFF604 +set AT91C_PIOB_ODR 0xFFFFF614 +set AT91C_PIOB_IFSR 0xFFFFF628 +set AT91C_PIOB_PPUER 0xFFFFF664 +set AT91C_PIOB_SODR 0xFFFFF630 +set AT91C_PIOB_ISR 0xFFFFF64C +set AT91C_PIOB_ODSR 0xFFFFF638 +set AT91C_PIOB_OSR 0xFFFFF618 +set AT91C_PIOB_MDSR 0xFFFFF658 +set AT91C_PIOB_IFER 0xFFFFF620 +set AT91C_PIOB_BSR 0xFFFFF674 +set AT91C_PIOB_MDDR 0xFFFFF654 +set AT91C_PIOB_OER 0xFFFFF610 +set AT91C_PIOB_PER 0xFFFFF600 +# ========== Register definition for CKGR peripheral ========== +set AT91C_CKGR_MOR 0xFFFFFC20 +set AT91C_CKGR_PLLR 0xFFFFFC2C +set AT91C_CKGR_MCFR 0xFFFFFC24 +# ========== Register definition for PMC peripheral ========== +set AT91C_PMC_IDR 0xFFFFFC64 +set AT91C_PMC_MOR 0xFFFFFC20 +set AT91C_PMC_PLLR 0xFFFFFC2C +set AT91C_PMC_PCER 0xFFFFFC10 +set AT91C_PMC_PCKR 0xFFFFFC40 +set AT91C_PMC_MCKR 0xFFFFFC30 +set AT91C_PMC_SCDR 0xFFFFFC04 +set AT91C_PMC_PCDR 0xFFFFFC14 +set AT91C_PMC_SCSR 0xFFFFFC08 +set AT91C_PMC_PCSR 0xFFFFFC18 +set AT91C_PMC_MCFR 0xFFFFFC24 +set AT91C_PMC_SCER 0xFFFFFC00 +set AT91C_PMC_IMR 0xFFFFFC6C +set AT91C_PMC_IER 0xFFFFFC60 +set AT91C_PMC_SR 0xFFFFFC68 +# ========== Register definition for RSTC peripheral ========== +set AT91C_RSTC_RCR 0xFFFFFD00 +set AT91C_RSTC_RMR 0xFFFFFD08 +set AT91C_RSTC_RSR 0xFFFFFD04 +# ========== Register definition for RTTC peripheral ========== +set AT91C_RTTC_RTSR 0xFFFFFD2C +set AT91C_RTTC_RTMR 0xFFFFFD20 +set AT91C_RTTC_RTVR 0xFFFFFD28 +set AT91C_RTTC_RTAR 0xFFFFFD24 +# ========== Register definition for PITC peripheral ========== +set AT91C_PITC_PIVR 0xFFFFFD38 +set AT91C_PITC_PISR 0xFFFFFD34 +set AT91C_PITC_PIIR 0xFFFFFD3C +set AT91C_PITC_PIMR 0xFFFFFD30 +# ========== Register definition for WDTC peripheral ========== +set AT91C_WDTC_WDCR 0xFFFFFD40 +set AT91C_WDTC_WDSR 0xFFFFFD48 +set AT91C_WDTC_WDMR 0xFFFFFD44 +# ========== Register definition for VREG peripheral ========== +set AT91C_VREG_MR 0xFFFFFD60 +# ========== Register definition for MC peripheral ========== +set AT91C_MC_ASR 0xFFFFFF04 +set AT91C_MC_RCR 0xFFFFFF00 +set AT91C_MC_FCR 0xFFFFFF64 +set AT91C_MC_AASR 0xFFFFFF08 +set AT91C_MC_FSR 0xFFFFFF68 +set AT91C_MC_FMR 0xFFFFFF60 +# ========== Register definition for PDC_SPI1 peripheral ========== +set AT91C_SPI1_PTCR 0xFFFE4120 +set AT91C_SPI1_RPR 0xFFFE4100 +set AT91C_SPI1_TNCR 0xFFFE411C +set AT91C_SPI1_TPR 0xFFFE4108 +set AT91C_SPI1_TNPR 0xFFFE4118 +set AT91C_SPI1_TCR 0xFFFE410C +set AT91C_SPI1_RCR 0xFFFE4104 +set AT91C_SPI1_RNPR 0xFFFE4110 +set AT91C_SPI1_RNCR 0xFFFE4114 +set AT91C_SPI1_PTSR 0xFFFE4124 +# ========== Register definition for SPI1 peripheral ========== +set AT91C_SPI1_IMR 0xFFFE401C +set AT91C_SPI1_IER 0xFFFE4014 +set AT91C_SPI1_MR 0xFFFE4004 +set AT91C_SPI1_RDR 0xFFFE4008 +set AT91C_SPI1_IDR 0xFFFE4018 +set AT91C_SPI1_SR 0xFFFE4010 +set AT91C_SPI1_TDR 0xFFFE400C +set AT91C_SPI1_CR 0xFFFE4000 +set AT91C_SPI1_CSR 0xFFFE4030 +# ========== Register definition for PDC_SPI0 peripheral ========== +set AT91C_SPI0_PTCR 0xFFFE0120 +set AT91C_SPI0_TPR 0xFFFE0108 +set AT91C_SPI0_TCR 0xFFFE010C +set AT91C_SPI0_RCR 0xFFFE0104 +set AT91C_SPI0_PTSR 0xFFFE0124 +set AT91C_SPI0_RNPR 0xFFFE0110 +set AT91C_SPI0_RPR 0xFFFE0100 +set AT91C_SPI0_TNCR 0xFFFE011C +set AT91C_SPI0_RNCR 0xFFFE0114 +set AT91C_SPI0_TNPR 0xFFFE0118 +# ========== Register definition for SPI0 peripheral ========== +set AT91C_SPI0_IER 0xFFFE0014 +set AT91C_SPI0_SR 0xFFFE0010 +set AT91C_SPI0_IDR 0xFFFE0018 +set AT91C_SPI0_CR 0xFFFE0000 +set AT91C_SPI0_MR 0xFFFE0004 +set AT91C_SPI0_IMR 0xFFFE001C +set AT91C_SPI0_TDR 0xFFFE000C +set AT91C_SPI0_RDR 0xFFFE0008 +set AT91C_SPI0_CSR 0xFFFE0030 +# ========== Register definition for PDC_US1 peripheral ========== +set AT91C_US1_RNCR 0xFFFC4114 +set AT91C_US1_PTCR 0xFFFC4120 +set AT91C_US1_TCR 0xFFFC410C +set AT91C_US1_PTSR 0xFFFC4124 +set AT91C_US1_TNPR 0xFFFC4118 +set AT91C_US1_RCR 0xFFFC4104 +set AT91C_US1_RNPR 0xFFFC4110 +set AT91C_US1_RPR 0xFFFC4100 +set AT91C_US1_TNCR 0xFFFC411C +set AT91C_US1_TPR 0xFFFC4108 +# ========== Register definition for US1 peripheral ========== +set AT91C_US1_IF 0xFFFC404C +set AT91C_US1_NER 0xFFFC4044 +set AT91C_US1_RTOR 0xFFFC4024 +set AT91C_US1_CSR 0xFFFC4014 +set AT91C_US1_IDR 0xFFFC400C +set AT91C_US1_IER 0xFFFC4008 +set AT91C_US1_THR 0xFFFC401C +set AT91C_US1_TTGR 0xFFFC4028 +set AT91C_US1_RHR 0xFFFC4018 +set AT91C_US1_BRGR 0xFFFC4020 +set AT91C_US1_IMR 0xFFFC4010 +set AT91C_US1_FIDI 0xFFFC4040 +set AT91C_US1_CR 0xFFFC4000 +set AT91C_US1_MR 0xFFFC4004 +# ========== Register definition for PDC_US0 peripheral ========== +set AT91C_US0_TNPR 0xFFFC0118 +set AT91C_US0_RNPR 0xFFFC0110 +set AT91C_US0_TCR 0xFFFC010C +set AT91C_US0_PTCR 0xFFFC0120 +set AT91C_US0_PTSR 0xFFFC0124 +set AT91C_US0_TNCR 0xFFFC011C +set AT91C_US0_TPR 0xFFFC0108 +set AT91C_US0_RCR 0xFFFC0104 +set AT91C_US0_RPR 0xFFFC0100 +set AT91C_US0_RNCR 0xFFFC0114 +# ========== Register definition for US0 peripheral ========== +set AT91C_US0_BRGR 0xFFFC0020 +set AT91C_US0_NER 0xFFFC0044 +set AT91C_US0_CR 0xFFFC0000 +set AT91C_US0_IMR 0xFFFC0010 +set AT91C_US0_FIDI 0xFFFC0040 +set AT91C_US0_TTGR 0xFFFC0028 +set AT91C_US0_MR 0xFFFC0004 +set AT91C_US0_RTOR 0xFFFC0024 +set AT91C_US0_CSR 0xFFFC0014 +set AT91C_US0_RHR 0xFFFC0018 +set AT91C_US0_IDR 0xFFFC000C +set AT91C_US0_THR 0xFFFC001C +set AT91C_US0_IF 0xFFFC004C +set AT91C_US0_IER 0xFFFC0008 +# ========== Register definition for PDC_SSC peripheral ========== +set AT91C_SSC_TNCR 0xFFFD411C +set AT91C_SSC_RPR 0xFFFD4100 +set AT91C_SSC_RNCR 0xFFFD4114 +set AT91C_SSC_TPR 0xFFFD4108 +set AT91C_SSC_PTCR 0xFFFD4120 +set AT91C_SSC_TCR 0xFFFD410C +set AT91C_SSC_RCR 0xFFFD4104 +set AT91C_SSC_RNPR 0xFFFD4110 +set AT91C_SSC_TNPR 0xFFFD4118 +set AT91C_SSC_PTSR 0xFFFD4124 +# ========== Register definition for SSC peripheral ========== +set AT91C_SSC_RHR 0xFFFD4020 +set AT91C_SSC_RSHR 0xFFFD4030 +set AT91C_SSC_TFMR 0xFFFD401C +set AT91C_SSC_IDR 0xFFFD4048 +set AT91C_SSC_THR 0xFFFD4024 +set AT91C_SSC_RCMR 0xFFFD4010 +set AT91C_SSC_IER 0xFFFD4044 +set AT91C_SSC_TSHR 0xFFFD4034 +set AT91C_SSC_SR 0xFFFD4040 +set AT91C_SSC_CMR 0xFFFD4004 +set AT91C_SSC_TCMR 0xFFFD4018 +set AT91C_SSC_CR 0xFFFD4000 +set AT91C_SSC_IMR 0xFFFD404C +set AT91C_SSC_RFMR 0xFFFD4014 +# ========== Register definition for TWI peripheral ========== +set AT91C_TWI_IER 0xFFFB8024 +set AT91C_TWI_CR 0xFFFB8000 +set AT91C_TWI_SR 0xFFFB8020 +set AT91C_TWI_IMR 0xFFFB802C +set AT91C_TWI_THR 0xFFFB8034 +set AT91C_TWI_IDR 0xFFFB8028 +set AT91C_TWI_IADR 0xFFFB800C +set AT91C_TWI_MMR 0xFFFB8004 +set AT91C_TWI_CWGR 0xFFFB8010 +set AT91C_TWI_RHR 0xFFFB8030 +# ========== Register definition for PWMC_CH3 peripheral ========== +set AT91C_PWMC_CH3_CUPDR 0xFFFCC270 +set AT91C_PWMC_CH3_Reserved 0xFFFCC274 +set AT91C_PWMC_CH3_CPRDR 0xFFFCC268 +set AT91C_PWMC_CH3_CDTYR 0xFFFCC264 +set AT91C_PWMC_CH3_CCNTR 0xFFFCC26C +set AT91C_PWMC_CH3_CMR 0xFFFCC260 +# ========== Register definition for PWMC_CH2 peripheral ========== +set AT91C_PWMC_CH2_Reserved 0xFFFCC254 +set AT91C_PWMC_CH2_CMR 0xFFFCC240 +set AT91C_PWMC_CH2_CCNTR 0xFFFCC24C +set AT91C_PWMC_CH2_CPRDR 0xFFFCC248 +set AT91C_PWMC_CH2_CUPDR 0xFFFCC250 +set AT91C_PWMC_CH2_CDTYR 0xFFFCC244 +# ========== Register definition for PWMC_CH1 peripheral ========== +set AT91C_PWMC_CH1_Reserved 0xFFFCC234 +set AT91C_PWMC_CH1_CUPDR 0xFFFCC230 +set AT91C_PWMC_CH1_CPRDR 0xFFFCC228 +set AT91C_PWMC_CH1_CCNTR 0xFFFCC22C +set AT91C_PWMC_CH1_CDTYR 0xFFFCC224 +set AT91C_PWMC_CH1_CMR 0xFFFCC220 +# ========== Register definition for PWMC_CH0 peripheral ========== +set AT91C_PWMC_CH0_Reserved 0xFFFCC214 +set AT91C_PWMC_CH0_CPRDR 0xFFFCC208 +set AT91C_PWMC_CH0_CDTYR 0xFFFCC204 +set AT91C_PWMC_CH0_CMR 0xFFFCC200 +set AT91C_PWMC_CH0_CUPDR 0xFFFCC210 +set AT91C_PWMC_CH0_CCNTR 0xFFFCC20C +# ========== Register definition for PWMC peripheral ========== +set AT91C_PWMC_IDR 0xFFFCC014 +set AT91C_PWMC_DIS 0xFFFCC008 +set AT91C_PWMC_IER 0xFFFCC010 +set AT91C_PWMC_VR 0xFFFCC0FC +set AT91C_PWMC_ISR 0xFFFCC01C +set AT91C_PWMC_SR 0xFFFCC00C +set AT91C_PWMC_IMR 0xFFFCC018 +set AT91C_PWMC_MR 0xFFFCC000 +set AT91C_PWMC_ENA 0xFFFCC004 +# ========== Register definition for UDP peripheral ========== +set AT91C_UDP_IMR 0xFFFB0018 +set AT91C_UDP_FADDR 0xFFFB0008 +set AT91C_UDP_NUM 0xFFFB0000 +set AT91C_UDP_FDR 0xFFFB0050 +set AT91C_UDP_ISR 0xFFFB001C +set AT91C_UDP_CSR 0xFFFB0030 +set AT91C_UDP_IDR 0xFFFB0014 +set AT91C_UDP_ICR 0xFFFB0020 +set AT91C_UDP_RSTEP 0xFFFB0028 +set AT91C_UDP_TXVC 0xFFFB0074 +set AT91C_UDP_GLBSTATE 0xFFFB0004 +set AT91C_UDP_IER 0xFFFB0010 +# ========== Register definition for TC0 peripheral ========== +set AT91C_TC0_SR 0xFFFA0020 +set AT91C_TC0_RC 0xFFFA001C +set AT91C_TC0_RB 0xFFFA0018 +set AT91C_TC0_CCR 0xFFFA0000 +set AT91C_TC0_CMR 0xFFFA0004 +set AT91C_TC0_IER 0xFFFA0024 +set AT91C_TC0_RA 0xFFFA0014 +set AT91C_TC0_IDR 0xFFFA0028 +set AT91C_TC0_CV 0xFFFA0010 +set AT91C_TC0_IMR 0xFFFA002C +# ========== Register definition for TC1 peripheral ========== +set AT91C_TC1_RB 0xFFFA0058 +set AT91C_TC1_CCR 0xFFFA0040 +set AT91C_TC1_IER 0xFFFA0064 +set AT91C_TC1_IDR 0xFFFA0068 +set AT91C_TC1_SR 0xFFFA0060 +set AT91C_TC1_CMR 0xFFFA0044 +set AT91C_TC1_RA 0xFFFA0054 +set AT91C_TC1_RC 0xFFFA005C +set AT91C_TC1_IMR 0xFFFA006C +set AT91C_TC1_CV 0xFFFA0050 +# ========== Register definition for TC2 peripheral ========== +set AT91C_TC2_CMR 0xFFFA0084 +set AT91C_TC2_CCR 0xFFFA0080 +set AT91C_TC2_CV 0xFFFA0090 +set AT91C_TC2_RA 0xFFFA0094 +set AT91C_TC2_RB 0xFFFA0098 +set AT91C_TC2_IDR 0xFFFA00A8 +set AT91C_TC2_IMR 0xFFFA00AC +set AT91C_TC2_RC 0xFFFA009C +set AT91C_TC2_IER 0xFFFA00A4 +set AT91C_TC2_SR 0xFFFA00A0 +# ========== Register definition for TCB peripheral ========== +set AT91C_TCB_BMR 0xFFFA00C4 +set AT91C_TCB_BCR 0xFFFA00C0 +# ========== Register definition for CAN_MB0 peripheral ========== +set AT91C_CAN_MB0_MDL 0xFFFD0214 +set AT91C_CAN_MB0_MAM 0xFFFD0204 +set AT91C_CAN_MB0_MCR 0xFFFD021C +set AT91C_CAN_MB0_MID 0xFFFD0208 +set AT91C_CAN_MB0_MSR 0xFFFD0210 +set AT91C_CAN_MB0_MFID 0xFFFD020C +set AT91C_CAN_MB0_MDH 0xFFFD0218 +set AT91C_CAN_MB0_MMR 0xFFFD0200 +# ========== Register definition for CAN_MB1 peripheral ========== +set AT91C_CAN_MB1_MDL 0xFFFD0234 +set AT91C_CAN_MB1_MID 0xFFFD0228 +set AT91C_CAN_MB1_MMR 0xFFFD0220 +set AT91C_CAN_MB1_MSR 0xFFFD0230 +set AT91C_CAN_MB1_MAM 0xFFFD0224 +set AT91C_CAN_MB1_MDH 0xFFFD0238 +set AT91C_CAN_MB1_MCR 0xFFFD023C +set AT91C_CAN_MB1_MFID 0xFFFD022C +# ========== Register definition for CAN_MB2 peripheral ========== +set AT91C_CAN_MB2_MCR 0xFFFD025C +set AT91C_CAN_MB2_MDH 0xFFFD0258 +set AT91C_CAN_MB2_MID 0xFFFD0248 +set AT91C_CAN_MB2_MDL 0xFFFD0254 +set AT91C_CAN_MB2_MMR 0xFFFD0240 +set AT91C_CAN_MB2_MAM 0xFFFD0244 +set AT91C_CAN_MB2_MFID 0xFFFD024C +set AT91C_CAN_MB2_MSR 0xFFFD0250 +# ========== Register definition for CAN_MB3 peripheral ========== +set AT91C_CAN_MB3_MFID 0xFFFD026C +set AT91C_CAN_MB3_MAM 0xFFFD0264 +set AT91C_CAN_MB3_MID 0xFFFD0268 +set AT91C_CAN_MB3_MCR 0xFFFD027C +set AT91C_CAN_MB3_MMR 0xFFFD0260 +set AT91C_CAN_MB3_MSR 0xFFFD0270 +set AT91C_CAN_MB3_MDL 0xFFFD0274 +set AT91C_CAN_MB3_MDH 0xFFFD0278 +# ========== Register definition for CAN_MB4 peripheral ========== +set AT91C_CAN_MB4_MID 0xFFFD0288 +set AT91C_CAN_MB4_MMR 0xFFFD0280 +set AT91C_CAN_MB4_MDH 0xFFFD0298 +set AT91C_CAN_MB4_MFID 0xFFFD028C +set AT91C_CAN_MB4_MSR 0xFFFD0290 +set AT91C_CAN_MB4_MCR 0xFFFD029C +set AT91C_CAN_MB4_MDL 0xFFFD0294 +set AT91C_CAN_MB4_MAM 0xFFFD0284 +# ========== Register definition for CAN_MB5 peripheral ========== +set AT91C_CAN_MB5_MSR 0xFFFD02B0 +set AT91C_CAN_MB5_MCR 0xFFFD02BC +set AT91C_CAN_MB5_MFID 0xFFFD02AC +set AT91C_CAN_MB5_MDH 0xFFFD02B8 +set AT91C_CAN_MB5_MID 0xFFFD02A8 +set AT91C_CAN_MB5_MMR 0xFFFD02A0 +set AT91C_CAN_MB5_MDL 0xFFFD02B4 +set AT91C_CAN_MB5_MAM 0xFFFD02A4 +# ========== Register definition for CAN_MB6 peripheral ========== +set AT91C_CAN_MB6_MFID 0xFFFD02CC +set AT91C_CAN_MB6_MID 0xFFFD02C8 +set AT91C_CAN_MB6_MAM 0xFFFD02C4 +set AT91C_CAN_MB6_MSR 0xFFFD02D0 +set AT91C_CAN_MB6_MDL 0xFFFD02D4 +set AT91C_CAN_MB6_MCR 0xFFFD02DC +set AT91C_CAN_MB6_MDH 0xFFFD02D8 +set AT91C_CAN_MB6_MMR 0xFFFD02C0 +# ========== Register definition for CAN_MB7 peripheral ========== +set AT91C_CAN_MB7_MCR 0xFFFD02FC +set AT91C_CAN_MB7_MDH 0xFFFD02F8 +set AT91C_CAN_MB7_MFID 0xFFFD02EC +set AT91C_CAN_MB7_MDL 0xFFFD02F4 +set AT91C_CAN_MB7_MID 0xFFFD02E8 +set AT91C_CAN_MB7_MMR 0xFFFD02E0 +set AT91C_CAN_MB7_MAM 0xFFFD02E4 +set AT91C_CAN_MB7_MSR 0xFFFD02F0 +# ========== Register definition for CAN peripheral ========== +set AT91C_CAN_TCR 0xFFFD0024 +set AT91C_CAN_IMR 0xFFFD000C +set AT91C_CAN_IER 0xFFFD0004 +set AT91C_CAN_ECR 0xFFFD0020 +set AT91C_CAN_TIMESTP 0xFFFD001C +set AT91C_CAN_MR 0xFFFD0000 +set AT91C_CAN_IDR 0xFFFD0008 +set AT91C_CAN_ACR 0xFFFD0028 +set AT91C_CAN_TIM 0xFFFD0018 +set AT91C_CAN_SR 0xFFFD0010 +set AT91C_CAN_BR 0xFFFD0014 +set AT91C_CAN_VR 0xFFFD00FC +# ========== Register definition for EMAC peripheral ========== +set AT91C_EMAC_ISR 0xFFFDC024 +set AT91C_EMAC_SA4H 0xFFFDC0B4 +set AT91C_EMAC_SA1L 0xFFFDC098 +set AT91C_EMAC_ELE 0xFFFDC078 +set AT91C_EMAC_LCOL 0xFFFDC05C +set AT91C_EMAC_RLE 0xFFFDC088 +set AT91C_EMAC_WOL 0xFFFDC0C4 +set AT91C_EMAC_DTF 0xFFFDC058 +set AT91C_EMAC_TUND 0xFFFDC064 +set AT91C_EMAC_NCR 0xFFFDC000 +set AT91C_EMAC_SA4L 0xFFFDC0B0 +set AT91C_EMAC_RSR 0xFFFDC020 +set AT91C_EMAC_SA3L 0xFFFDC0A8 +set AT91C_EMAC_TSR 0xFFFDC014 +set AT91C_EMAC_IDR 0xFFFDC02C +set AT91C_EMAC_RSE 0xFFFDC074 +set AT91C_EMAC_ECOL 0xFFFDC060 +set AT91C_EMAC_TID 0xFFFDC0B8 +set AT91C_EMAC_HRB 0xFFFDC090 +set AT91C_EMAC_TBQP 0xFFFDC01C +set AT91C_EMAC_USRIO 0xFFFDC0C0 +set AT91C_EMAC_PTR 0xFFFDC038 +set AT91C_EMAC_SA2H 0xFFFDC0A4 +set AT91C_EMAC_ROV 0xFFFDC070 +set AT91C_EMAC_ALE 0xFFFDC054 +set AT91C_EMAC_RJA 0xFFFDC07C +set AT91C_EMAC_RBQP 0xFFFDC018 +set AT91C_EMAC_TPF 0xFFFDC08C +set AT91C_EMAC_NCFGR 0xFFFDC004 +set AT91C_EMAC_HRT 0xFFFDC094 +set AT91C_EMAC_USF 0xFFFDC080 +set AT91C_EMAC_FCSE 0xFFFDC050 +set AT91C_EMAC_TPQ 0xFFFDC0BC +set AT91C_EMAC_MAN 0xFFFDC034 +set AT91C_EMAC_FTO 0xFFFDC040 +set AT91C_EMAC_REV 0xFFFDC0FC +set AT91C_EMAC_IMR 0xFFFDC030 +set AT91C_EMAC_SCF 0xFFFDC044 +set AT91C_EMAC_PFR 0xFFFDC03C +set AT91C_EMAC_MCF 0xFFFDC048 +set AT91C_EMAC_NSR 0xFFFDC008 +set AT91C_EMAC_SA2L 0xFFFDC0A0 +set AT91C_EMAC_FRO 0xFFFDC04C +set AT91C_EMAC_IER 0xFFFDC028 +set AT91C_EMAC_SA1H 0xFFFDC09C +set AT91C_EMAC_CSE 0xFFFDC068 +set AT91C_EMAC_SA3H 0xFFFDC0AC +set AT91C_EMAC_RRE 0xFFFDC06C +set AT91C_EMAC_STE 0xFFFDC084 +# ========== Register definition for PDC_ADC peripheral ========== +set AT91C_ADC_PTSR 0xFFFD8124 +set AT91C_ADC_PTCR 0xFFFD8120 +set AT91C_ADC_TNPR 0xFFFD8118 +set AT91C_ADC_TNCR 0xFFFD811C +set AT91C_ADC_RNPR 0xFFFD8110 +set AT91C_ADC_RNCR 0xFFFD8114 +set AT91C_ADC_RPR 0xFFFD8100 +set AT91C_ADC_TCR 0xFFFD810C +set AT91C_ADC_TPR 0xFFFD8108 +set AT91C_ADC_RCR 0xFFFD8104 +# ========== Register definition for ADC peripheral ========== +set AT91C_ADC_CDR2 0xFFFD8038 +set AT91C_ADC_CDR3 0xFFFD803C +set AT91C_ADC_CDR0 0xFFFD8030 +set AT91C_ADC_CDR5 0xFFFD8044 +set AT91C_ADC_CHDR 0xFFFD8014 +set AT91C_ADC_SR 0xFFFD801C +set AT91C_ADC_CDR4 0xFFFD8040 +set AT91C_ADC_CDR1 0xFFFD8034 +set AT91C_ADC_LCDR 0xFFFD8020 +set AT91C_ADC_IDR 0xFFFD8028 +set AT91C_ADC_CR 0xFFFD8000 +set AT91C_ADC_CDR7 0xFFFD804C +set AT91C_ADC_CDR6 0xFFFD8048 +set AT91C_ADC_IER 0xFFFD8024 +set AT91C_ADC_CHER 0xFFFD8010 +set AT91C_ADC_CHSR 0xFFFD8018 +set AT91C_ADC_MR 0xFFFD8004 +set AT91C_ADC_IMR 0xFFFD802C + +# ***************************************************************************** +# BASE ADDRESS DEFINITIONS FOR AT91SAM7X256 +# ***************************************************************************** +set AT91C_BASE_SYS 0xFFFFF000 +set AT91C_BASE_AIC 0xFFFFF000 +set AT91C_BASE_PDC_DBGU 0xFFFFF300 +set AT91C_BASE_DBGU 0xFFFFF200 +set AT91C_BASE_PIOA 0xFFFFF400 +set AT91C_BASE_PIOB 0xFFFFF600 +set AT91C_BASE_CKGR 0xFFFFFC20 +set AT91C_BASE_PMC 0xFFFFFC00 +set AT91C_BASE_RSTC 0xFFFFFD00 +set AT91C_BASE_RTTC 0xFFFFFD20 +set AT91C_BASE_PITC 0xFFFFFD30 +set AT91C_BASE_WDTC 0xFFFFFD40 +set AT91C_BASE_VREG 0xFFFFFD60 +set AT91C_BASE_MC 0xFFFFFF00 +set AT91C_BASE_PDC_SPI1 0xFFFE4100 +set AT91C_BASE_SPI1 0xFFFE4000 +set AT91C_BASE_PDC_SPI0 0xFFFE0100 +set AT91C_BASE_SPI0 0xFFFE0000 +set AT91C_BASE_PDC_US1 0xFFFC4100 +set AT91C_BASE_US1 0xFFFC4000 +set AT91C_BASE_PDC_US0 0xFFFC0100 +set AT91C_BASE_US0 0xFFFC0000 +set AT91C_BASE_PDC_SSC 0xFFFD4100 +set AT91C_BASE_SSC 0xFFFD4000 +set AT91C_BASE_TWI 0xFFFB8000 +set AT91C_BASE_PWMC_CH3 0xFFFCC260 +set AT91C_BASE_PWMC_CH2 0xFFFCC240 +set AT91C_BASE_PWMC_CH1 0xFFFCC220 +set AT91C_BASE_PWMC_CH0 0xFFFCC200 +set AT91C_BASE_PWMC 0xFFFCC000 +set AT91C_BASE_UDP 0xFFFB0000 +set AT91C_BASE_TC0 0xFFFA0000 +set AT91C_BASE_TC1 0xFFFA0040 +set AT91C_BASE_TC2 0xFFFA0080 +set AT91C_BASE_TCB 0xFFFA0000 +set AT91C_BASE_CAN_MB0 0xFFFD0200 +set AT91C_BASE_CAN_MB1 0xFFFD0220 +set AT91C_BASE_CAN_MB2 0xFFFD0240 +set AT91C_BASE_CAN_MB3 0xFFFD0260 +set AT91C_BASE_CAN_MB4 0xFFFD0280 +set AT91C_BASE_CAN_MB5 0xFFFD02A0 +set AT91C_BASE_CAN_MB6 0xFFFD02C0 +set AT91C_BASE_CAN_MB7 0xFFFD02E0 +set AT91C_BASE_CAN 0xFFFD0000 +set AT91C_BASE_EMAC 0xFFFDC000 +set AT91C_BASE_PDC_ADC 0xFFFD8100 +set AT91C_BASE_ADC 0xFFFD8000 + +# ***************************************************************************** +# PERIPHERAL ID DEFINITIONS FOR AT91SAM7X256 +# ***************************************************************************** +set AT91C_ID_FIQ 0 +set AT91C_ID_SYS 1 +set AT91C_ID_PIOA 2 +set AT91C_ID_PIOB 3 +set AT91C_ID_SPI0 4 +set AT91C_ID_SPI1 5 +set AT91C_ID_US0 6 +set AT91C_ID_US1 7 +set AT91C_ID_SSC 8 +set AT91C_ID_TWI 9 +set AT91C_ID_PWMC 10 +set AT91C_ID_UDP 11 +set AT91C_ID_TC0 12 +set AT91C_ID_TC1 13 +set AT91C_ID_TC2 14 +set AT91C_ID_CAN 15 +set AT91C_ID_EMAC 16 +set AT91C_ID_ADC 17 +set AT91C_ID_18_Reserved 18 +set AT91C_ID_19_Reserved 19 +set AT91C_ID_20_Reserved 20 +set AT91C_ID_21_Reserved 21 +set AT91C_ID_22_Reserved 22 +set AT91C_ID_23_Reserved 23 +set AT91C_ID_24_Reserved 24 +set AT91C_ID_25_Reserved 25 +set AT91C_ID_26_Reserved 26 +set AT91C_ID_27_Reserved 27 +set AT91C_ID_28_Reserved 28 +set AT91C_ID_29_Reserved 29 +set AT91C_ID_IRQ0 30 +set AT91C_ID_IRQ1 31 + +# ***************************************************************************** +# PIO DEFINITIONS FOR AT91SAM7X256 +# ***************************************************************************** +set AT91C_PIO_PA0 [expr 1 << 0 ] +set AT91C_PA0_RXD0 $AT91C_PIO_PA0 +set AT91C_PIO_PA1 [expr 1 << 1 ] +set AT91C_PA1_TXD0 $AT91C_PIO_PA1 +set AT91C_PIO_PA10 [expr 1 << 10 ] +set AT91C_PA10_TWD $AT91C_PIO_PA10 +set AT91C_PIO_PA11 [expr 1 << 11 ] +set AT91C_PA11_TWCK $AT91C_PIO_PA11 +set AT91C_PIO_PA12 [expr 1 << 12 ] +set AT91C_PA12_SPI0_NPCS0 $AT91C_PIO_PA12 +set AT91C_PIO_PA13 [expr 1 << 13 ] +set AT91C_PA13_SPI0_NPCS1 $AT91C_PIO_PA13 +set AT91C_PA13_PCK1 $AT91C_PIO_PA13 +set AT91C_PIO_PA14 [expr 1 << 14 ] +set AT91C_PA14_SPI0_NPCS2 $AT91C_PIO_PA14 +set AT91C_PA14_IRQ1 $AT91C_PIO_PA14 +set AT91C_PIO_PA15 [expr 1 << 15 ] +set AT91C_PA15_SPI0_NPCS3 $AT91C_PIO_PA15 +set AT91C_PA15_TCLK2 $AT91C_PIO_PA15 +set AT91C_PIO_PA16 [expr 1 << 16 ] +set AT91C_PA16_SPI0_MISO $AT91C_PIO_PA16 +set AT91C_PIO_PA17 [expr 1 << 17 ] +set AT91C_PA17_SPI0_MOSI $AT91C_PIO_PA17 +set AT91C_PIO_PA18 [expr 1 << 18 ] +set AT91C_PA18_SPI0_SPCK $AT91C_PIO_PA18 +set AT91C_PIO_PA19 [expr 1 << 19 ] +set AT91C_PA19_CANRX $AT91C_PIO_PA19 +set AT91C_PIO_PA2 [expr 1 << 2 ] +set AT91C_PA2_SCK0 $AT91C_PIO_PA2 +set AT91C_PA2_SPI1_NPCS1 $AT91C_PIO_PA2 +set AT91C_PIO_PA20 [expr 1 << 20 ] +set AT91C_PA20_CANTX $AT91C_PIO_PA20 +set AT91C_PIO_PA21 [expr 1 << 21 ] +set AT91C_PA21_TF $AT91C_PIO_PA21 +set AT91C_PA21_SPI1_NPCS0 $AT91C_PIO_PA21 +set AT91C_PIO_PA22 [expr 1 << 22 ] +set AT91C_PA22_TK $AT91C_PIO_PA22 +set AT91C_PA22_SPI1_SPCK $AT91C_PIO_PA22 +set AT91C_PIO_PA23 [expr 1 << 23 ] +set AT91C_PA23_TD $AT91C_PIO_PA23 +set AT91C_PA23_SPI1_MOSI $AT91C_PIO_PA23 +set AT91C_PIO_PA24 [expr 1 << 24 ] +set AT91C_PA24_RD $AT91C_PIO_PA24 +set AT91C_PA24_SPI1_MISO $AT91C_PIO_PA24 +set AT91C_PIO_PA25 [expr 1 << 25 ] +set AT91C_PA25_RK $AT91C_PIO_PA25 +set AT91C_PA25_SPI1_NPCS1 $AT91C_PIO_PA25 +set AT91C_PIO_PA26 [expr 1 << 26 ] +set AT91C_PA26_RF $AT91C_PIO_PA26 +set AT91C_PA26_SPI1_NPCS2 $AT91C_PIO_PA26 +set AT91C_PIO_PA27 [expr 1 << 27 ] +set AT91C_PA27_DRXD $AT91C_PIO_PA27 +set AT91C_PA27_PCK3 $AT91C_PIO_PA27 +set AT91C_PIO_PA28 [expr 1 << 28 ] +set AT91C_PA28_DTXD $AT91C_PIO_PA28 +set AT91C_PIO_PA29 [expr 1 << 29 ] +set AT91C_PA29_FIQ $AT91C_PIO_PA29 +set AT91C_PA29_SPI1_NPCS3 $AT91C_PIO_PA29 +set AT91C_PIO_PA3 [expr 1 << 3 ] +set AT91C_PA3_RTS0 $AT91C_PIO_PA3 +set AT91C_PA3_SPI1_NPCS2 $AT91C_PIO_PA3 +set AT91C_PIO_PA30 [expr 1 << 30 ] +set AT91C_PA30_IRQ0 $AT91C_PIO_PA30 +set AT91C_PA30_PCK2 $AT91C_PIO_PA30 +set AT91C_PIO_PA4 [expr 1 << 4 ] +set AT91C_PA4_CTS0 $AT91C_PIO_PA4 +set AT91C_PA4_SPI1_NPCS3 $AT91C_PIO_PA4 +set AT91C_PIO_PA5 [expr 1 << 5 ] +set AT91C_PA5_RXD1 $AT91C_PIO_PA5 +set AT91C_PIO_PA6 [expr 1 << 6 ] +set AT91C_PA6_TXD1 $AT91C_PIO_PA6 +set AT91C_PIO_PA7 [expr 1 << 7 ] +set AT91C_PA7_SCK1 $AT91C_PIO_PA7 +set AT91C_PA7_SPI0_NPCS1 $AT91C_PIO_PA7 +set AT91C_PIO_PA8 [expr 1 << 8 ] +set AT91C_PA8_RTS1 $AT91C_PIO_PA8 +set AT91C_PA8_SPI0_NPCS2 $AT91C_PIO_PA8 +set AT91C_PIO_PA9 [expr 1 << 9 ] +set AT91C_PA9_CTS1 $AT91C_PIO_PA9 +set AT91C_PA9_SPI0_NPCS3 $AT91C_PIO_PA9 +set AT91C_PIO_PB0 [expr 1 << 0 ] +set AT91C_PB0_ETXCK_EREFCK $AT91C_PIO_PB0 +set AT91C_PB0_PCK0 $AT91C_PIO_PB0 +set AT91C_PIO_PB1 [expr 1 << 1 ] +set AT91C_PB1_ETXEN $AT91C_PIO_PB1 +set AT91C_PIO_PB10 [expr 1 << 10 ] +set AT91C_PB10_ETX2 $AT91C_PIO_PB10 +set AT91C_PB10_SPI1_NPCS1 $AT91C_PIO_PB10 +set AT91C_PIO_PB11 [expr 1 << 11 ] +set AT91C_PB11_ETX3 $AT91C_PIO_PB11 +set AT91C_PB11_SPI1_NPCS2 $AT91C_PIO_PB11 +set AT91C_PIO_PB12 [expr 1 << 12 ] +set AT91C_PB12_ETXER $AT91C_PIO_PB12 +set AT91C_PB12_TCLK0 $AT91C_PIO_PB12 +set AT91C_PIO_PB13 [expr 1 << 13 ] +set AT91C_PB13_ERX2 $AT91C_PIO_PB13 +set AT91C_PB13_SPI0_NPCS1 $AT91C_PIO_PB13 +set AT91C_PIO_PB14 [expr 1 << 14 ] +set AT91C_PB14_ERX3 $AT91C_PIO_PB14 +set AT91C_PB14_SPI0_NPCS2 $AT91C_PIO_PB14 +set AT91C_PIO_PB15 [expr 1 << 15 ] +set AT91C_PB15_ERXDV_ECRSDV $AT91C_PIO_PB15 +set AT91C_PIO_PB16 [expr 1 << 16 ] +set AT91C_PB16_ECOL $AT91C_PIO_PB16 +set AT91C_PB16_SPI1_NPCS3 $AT91C_PIO_PB16 +set AT91C_PIO_PB17 [expr 1 << 17 ] +set AT91C_PB17_ERXCK $AT91C_PIO_PB17 +set AT91C_PB17_SPI0_NPCS3 $AT91C_PIO_PB17 +set AT91C_PIO_PB18 [expr 1 << 18 ] +set AT91C_PB18_EF100 $AT91C_PIO_PB18 +set AT91C_PB18_ADTRG $AT91C_PIO_PB18 +set AT91C_PIO_PB19 [expr 1 << 19 ] +set AT91C_PB19_PWM0 $AT91C_PIO_PB19 +set AT91C_PB19_TCLK1 $AT91C_PIO_PB19 +set AT91C_PIO_PB2 [expr 1 << 2 ] +set AT91C_PB2_ETX0 $AT91C_PIO_PB2 +set AT91C_PIO_PB20 [expr 1 << 20 ] +set AT91C_PB20_PWM1 $AT91C_PIO_PB20 +set AT91C_PB20_PCK0 $AT91C_PIO_PB20 +set AT91C_PIO_PB21 [expr 1 << 21 ] +set AT91C_PB21_PWM2 $AT91C_PIO_PB21 +set AT91C_PB21_PCK1 $AT91C_PIO_PB21 +set AT91C_PIO_PB22 [expr 1 << 22 ] +set AT91C_PB22_PWM3 $AT91C_PIO_PB22 +set AT91C_PB22_PCK2 $AT91C_PIO_PB22 +set AT91C_PIO_PB23 [expr 1 << 23 ] +set AT91C_PB23_TIOA0 $AT91C_PIO_PB23 +set AT91C_PB23_DCD1 $AT91C_PIO_PB23 +set AT91C_PIO_PB24 [expr 1 << 24 ] +set AT91C_PB24_TIOB0 $AT91C_PIO_PB24 +set AT91C_PB24_DSR1 $AT91C_PIO_PB24 +set AT91C_PIO_PB25 [expr 1 << 25 ] +set AT91C_PB25_TIOA1 $AT91C_PIO_PB25 +set AT91C_PB25_DTR1 $AT91C_PIO_PB25 +set AT91C_PIO_PB26 [expr 1 << 26 ] +set AT91C_PB26_TIOB1 $AT91C_PIO_PB26 +set AT91C_PB26_RI1 $AT91C_PIO_PB26 +set AT91C_PIO_PB27 [expr 1 << 27 ] +set AT91C_PB27_TIOA2 $AT91C_PIO_PB27 +set AT91C_PB27_PWM0 $AT91C_PIO_PB27 +set AT91C_PIO_PB28 [expr 1 << 28 ] +set AT91C_PB28_TIOB2 $AT91C_PIO_PB28 +set AT91C_PB28_PWM1 $AT91C_PIO_PB28 +set AT91C_PIO_PB29 [expr 1 << 29 ] +set AT91C_PB29_PCK1 $AT91C_PIO_PB29 +set AT91C_PB29_PWM2 $AT91C_PIO_PB29 +set AT91C_PIO_PB3 [expr 1 << 3 ] +set AT91C_PB3_ETX1 $AT91C_PIO_PB3 +set AT91C_PIO_PB30 [expr 1 << 30 ] +set AT91C_PB30_PCK2 $AT91C_PIO_PB30 +set AT91C_PB30_PWM3 $AT91C_PIO_PB30 +set AT91C_PIO_PB4 [expr 1 << 4 ] +set AT91C_PB4_ECRS $AT91C_PIO_PB4 +set AT91C_PIO_PB5 [expr 1 << 5 ] +set AT91C_PB5_ERX0 $AT91C_PIO_PB5 +set AT91C_PIO_PB6 [expr 1 << 6 ] +set AT91C_PB6_ERX1 $AT91C_PIO_PB6 +set AT91C_PIO_PB7 [expr 1 << 7 ] +set AT91C_PB7_ERXER $AT91C_PIO_PB7 +set AT91C_PIO_PB8 [expr 1 << 8 ] +set AT91C_PB8_EMDC $AT91C_PIO_PB8 +set AT91C_PIO_PB9 [expr 1 << 9 ] +set AT91C_PB9_EMDIO $AT91C_PIO_PB9 + +# ***************************************************************************** +# MEMORY MAPPING DEFINITIONS FOR AT91SAM7X256 +# ***************************************************************************** +set AT91C_ISRAM 0x00200000 +set AT91C_ISRAM_SIZE 0x00010000 +set AT91C_IFLASH 0x00100000 +set AT91C_IFLASH_SIZE 0x00040000 + + +# ***************************************************************************** +# ATTRIBUTES DEFINITIONS FOR AT91SAM7X256 +# ***************************************************************************** +array set AT91SAM7X256_att { + DBGU { LP DBGU_att } + PMC { LP PMC_att } + VREG { LP VREG_att } + RSTC { LP RSTC_att } + SSC { LP SSC_att } + WDTC { LP WDTC_att } + USART { LP US1_att US0_att } + SPI { LP SPI1_att SPI0_att } + PITC { LP PITC_att } + TCB { LP TCB_att } + CKGR { LP CKGR_att } + AIC { LP AIC_att } + TWI { LP TWI_att } + ADC { LP ADC_att } + PWMC_CH { LP PWMC_CH3_att PWMC_CH2_att PWMC_CH1_att PWMC_CH0_att } + RTTC { LP RTTC_att } + UDP { LP UDP_att } + EMAC { LP EMAC_att } + CAN_MB { LP CAN_MB0_att CAN_MB1_att CAN_MB2_att CAN_MB3_att CAN_MB4_att CAN_MB5_att CAN_MB6_att CAN_MB7_att } + TC { LP TC0_att TC1_att TC2_att } + SYS { LP SYS_att } + MC { LP MC_att } + PIO { LP PIOA_att PIOB_att } + CAN { LP CAN_att } + PWMC { LP PWMC_att } + PDC { LP PDC_DBGU_att PDC_SPI1_att PDC_SPI0_att PDC_US1_att PDC_US0_att PDC_SSC_att PDC_ADC_att } + +} +# ========== Peripheral attributes for DBGU peripheral ========== +array set DBGU_att { + EXID { R AT91C_DBGU_EXID RO } + BRGR { R AT91C_DBGU_BRGR RW } + IDR { R AT91C_DBGU_IDR WO } + CSR { R AT91C_DBGU_CSR RO } + CIDR { R AT91C_DBGU_CIDR RO } + MR { R AT91C_DBGU_MR RW } + IMR { R AT91C_DBGU_IMR RO } + CR { R AT91C_DBGU_CR WO } + FNTR { R AT91C_DBGU_FNTR RW } + THR { R AT91C_DBGU_THR WO } + RHR { R AT91C_DBGU_RHR RO } + IER { R AT91C_DBGU_IER WO } + listeReg { EXID BRGR IDR CSR CIDR MR IMR CR FNTR THR RHR IER } + +} + +# ========== Peripheral attributes for PMC peripheral ========== +array set PMC_att { + IDR { R AT91C_PMC_IDR WO } + MOR { R AT91C_PMC_MOR RW } + PLLR { R AT91C_PMC_PLLR RW } + PCER { R AT91C_PMC_PCER WO } + PCKR { R AT91C_PMC_PCKR RW } + MCKR { R AT91C_PMC_MCKR RW } + SCDR { R AT91C_PMC_SCDR WO } + PCDR { R AT91C_PMC_PCDR WO } + SCSR { R AT91C_PMC_SCSR RO } + PCSR { R AT91C_PMC_PCSR RO } + MCFR { R AT91C_PMC_MCFR RO } + SCER { R AT91C_PMC_SCER WO } + IMR { R AT91C_PMC_IMR RO } + IER { R AT91C_PMC_IER WO } + SR { R AT91C_PMC_SR RO } + listeReg { IDR MOR PLLR PCER PCKR MCKR SCDR PCDR SCSR PCSR MCFR SCER IMR IER SR } + +} + +# ========== Peripheral attributes for VREG peripheral ========== +array set VREG_att { + MR { R AT91C_VREG_MR RW } + listeReg { MR } + +} + +# ========== Peripheral attributes for RSTC peripheral ========== +array set RSTC_att { + RCR { R AT91C_RSTC_RCR WO } + RMR { R AT91C_RSTC_RMR RW } + RSR { R AT91C_RSTC_RSR RO } + listeReg { RCR RMR RSR } + +} + +# ========== Peripheral attributes for SSC peripheral ========== +array set SSC_att { + RHR { R AT91C_SSC_RHR RO } + RSHR { R AT91C_SSC_RSHR RO } + TFMR { R AT91C_SSC_TFMR RW } + IDR { R AT91C_SSC_IDR WO } + THR { R AT91C_SSC_THR WO } + RCMR { R AT91C_SSC_RCMR RW } + IER { R AT91C_SSC_IER WO } + TSHR { R AT91C_SSC_TSHR RW } + SR { R AT91C_SSC_SR RO } + CMR { R AT91C_SSC_CMR RW } + TCMR { R AT91C_SSC_TCMR RW } + CR { R AT91C_SSC_CR WO } + IMR { R AT91C_SSC_IMR RO } + RFMR { R AT91C_SSC_RFMR RW } + listeReg { RHR RSHR TFMR IDR THR RCMR IER TSHR SR CMR TCMR CR IMR RFMR } + +} + +# ========== Peripheral attributes for WDTC peripheral ========== +array set WDTC_att { + WDCR { R AT91C_WDTC_WDCR WO } + WDSR { R AT91C_WDTC_WDSR RO } + WDMR { R AT91C_WDTC_WDMR RW } + listeReg { WDCR WDSR WDMR } + +} + +# ========== Peripheral attributes for USART peripheral ========== +array set US1_att { + IF { R AT91C_US1_IF RW } + NER { R AT91C_US1_NER RO } + RTOR { R AT91C_US1_RTOR RW } + CSR { R AT91C_US1_CSR RO } + IDR { R AT91C_US1_IDR WO } + IER { R AT91C_US1_IER WO } + THR { R AT91C_US1_THR WO } + TTGR { R AT91C_US1_TTGR RW } + RHR { R AT91C_US1_RHR RO } + BRGR { R AT91C_US1_BRGR RW } + IMR { R AT91C_US1_IMR RO } + FIDI { R AT91C_US1_FIDI RW } + CR { R AT91C_US1_CR WO } + MR { R AT91C_US1_MR RW } + listeReg { IF NER RTOR CSR IDR IER THR TTGR RHR BRGR IMR FIDI CR MR } + +} +array set US0_att { + BRGR { R AT91C_US0_BRGR RW } + NER { R AT91C_US0_NER RO } + CR { R AT91C_US0_CR WO } + IMR { R AT91C_US0_IMR RO } + FIDI { R AT91C_US0_FIDI RW } + TTGR { R AT91C_US0_TTGR RW } + MR { R AT91C_US0_MR RW } + RTOR { R AT91C_US0_RTOR RW } + CSR { R AT91C_US0_CSR RO } + RHR { R AT91C_US0_RHR RO } + IDR { R AT91C_US0_IDR WO } + THR { R AT91C_US0_THR WO } + IF { R AT91C_US0_IF RW } + IER { R AT91C_US0_IER WO } + listeReg { BRGR NER CR IMR FIDI TTGR MR RTOR CSR RHR IDR THR IF IER } + +} + +# ========== Peripheral attributes for SPI peripheral ========== +array set SPI1_att { + IMR { R AT91C_SPI1_IMR RO } + IER { R AT91C_SPI1_IER WO } + MR { R AT91C_SPI1_MR RW } + RDR { R AT91C_SPI1_RDR RO } + IDR { R AT91C_SPI1_IDR WO } + SR { R AT91C_SPI1_SR RO } + TDR { R AT91C_SPI1_TDR WO } + CR { R AT91C_SPI1_CR RO } + CSR { R AT91C_SPI1_CSR RW } + listeReg { IMR IER MR RDR IDR SR TDR CR CSR } + +} +array set SPI0_att { + IER { R AT91C_SPI0_IER WO } + SR { R AT91C_SPI0_SR RO } + IDR { R AT91C_SPI0_IDR WO } + CR { R AT91C_SPI0_CR RO } + MR { R AT91C_SPI0_MR RW } + IMR { R AT91C_SPI0_IMR RO } + TDR { R AT91C_SPI0_TDR WO } + RDR { R AT91C_SPI0_RDR RO } + CSR { R AT91C_SPI0_CSR RW } + listeReg { IER SR IDR CR MR IMR TDR RDR CSR } + +} + +# ========== Peripheral attributes for PITC peripheral ========== +array set PITC_att { + PIVR { R AT91C_PITC_PIVR RO } + PISR { R AT91C_PITC_PISR RO } + PIIR { R AT91C_PITC_PIIR RO } + PIMR { R AT91C_PITC_PIMR RW } + listeReg { PIVR PISR PIIR PIMR } + +} + +# ========== Peripheral attributes for TCB peripheral ========== +array set TCB_att { + BMR { R AT91C_TCB_BMR RW } + BCR { R AT91C_TCB_BCR WO } + listeReg { BMR BCR } + +} + +# ========== Peripheral attributes for CKGR peripheral ========== +array set CKGR_att { + MOR { R AT91C_CKGR_MOR RW } + PLLR { R AT91C_CKGR_PLLR RW } + MCFR { R AT91C_CKGR_MCFR RO } + listeReg { MOR PLLR MCFR } + +} + +# ========== Peripheral attributes for AIC peripheral ========== +array set AIC_att { + IVR { R AT91C_AIC_IVR RO } + SMR { R AT91C_AIC_SMR RW } + FVR { R AT91C_AIC_FVR RO } + DCR { R AT91C_AIC_DCR RW } + EOICR { R AT91C_AIC_EOICR WO } + SVR { R AT91C_AIC_SVR RW } + FFSR { R AT91C_AIC_FFSR RO } + ICCR { R AT91C_AIC_ICCR WO } + ISR { R AT91C_AIC_ISR RO } + IMR { R AT91C_AIC_IMR RO } + IPR { R AT91C_AIC_IPR RO } + FFER { R AT91C_AIC_FFER WO } + IECR { R AT91C_AIC_IECR WO } + ISCR { R AT91C_AIC_ISCR WO } + FFDR { R AT91C_AIC_FFDR WO } + CISR { R AT91C_AIC_CISR RO } + IDCR { R AT91C_AIC_IDCR WO } + SPU { R AT91C_AIC_SPU RW } + listeReg { IVR SMR FVR DCR EOICR SVR FFSR ICCR ISR IMR IPR FFER IECR ISCR FFDR CISR IDCR SPU } + +} + +# ========== Peripheral attributes for TWI peripheral ========== +array set TWI_att { + IER { R AT91C_TWI_IER WO } + CR { R AT91C_TWI_CR WO } + SR { R AT91C_TWI_SR RO } + IMR { R AT91C_TWI_IMR RO } + THR { R AT91C_TWI_THR WO } + IDR { R AT91C_TWI_IDR WO } + IADR { R AT91C_TWI_IADR RW } + MMR { R AT91C_TWI_MMR RW } + CWGR { R AT91C_TWI_CWGR RW } + RHR { R AT91C_TWI_RHR RO } + listeReg { IER CR SR IMR THR IDR IADR MMR CWGR RHR } + +} + +# ========== Peripheral attributes for ADC peripheral ========== +array set ADC_att { + CDR2 { R AT91C_ADC_CDR2 RO } + CDR3 { R AT91C_ADC_CDR3 RO } + CDR0 { R AT91C_ADC_CDR0 RO } + CDR5 { R AT91C_ADC_CDR5 RO } + CHDR { R AT91C_ADC_CHDR WO } + SR { R AT91C_ADC_SR RO } + CDR4 { R AT91C_ADC_CDR4 RO } + CDR1 { R AT91C_ADC_CDR1 RO } + LCDR { R AT91C_ADC_LCDR RO } + IDR { R AT91C_ADC_IDR WO } + CR { R AT91C_ADC_CR WO } + CDR7 { R AT91C_ADC_CDR7 RO } + CDR6 { R AT91C_ADC_CDR6 RO } + IER { R AT91C_ADC_IER WO } + CHER { R AT91C_ADC_CHER WO } + CHSR { R AT91C_ADC_CHSR RO } + MR { R AT91C_ADC_MR RW } + IMR { R AT91C_ADC_IMR RO } + listeReg { CDR2 CDR3 CDR0 CDR5 CHDR SR CDR4 CDR1 LCDR IDR CR CDR7 CDR6 IER CHER CHSR MR IMR } + +} + +# ========== Peripheral attributes for PWMC_CH peripheral ========== +array set PWMC_CH3_att { + CUPDR { R AT91C_PWMC_CH3_CUPDR WO } + Reserved { R AT91C_PWMC_CH3_Reserved WO } + CPRDR { R AT91C_PWMC_CH3_CPRDR RW } + CDTYR { R AT91C_PWMC_CH3_CDTYR RW } + CCNTR { R AT91C_PWMC_CH3_CCNTR RO } + CMR { R AT91C_PWMC_CH3_CMR RW } + listeReg { CUPDR Reserved CPRDR CDTYR CCNTR CMR } + +} +array set PWMC_CH2_att { + Reserved { R AT91C_PWMC_CH2_Reserved WO } + CMR { R AT91C_PWMC_CH2_CMR RW } + CCNTR { R AT91C_PWMC_CH2_CCNTR RO } + CPRDR { R AT91C_PWMC_CH2_CPRDR RW } + CUPDR { R AT91C_PWMC_CH2_CUPDR WO } + CDTYR { R AT91C_PWMC_CH2_CDTYR RW } + listeReg { Reserved CMR CCNTR CPRDR CUPDR CDTYR } + +} +array set PWMC_CH1_att { + Reserved { R AT91C_PWMC_CH1_Reserved WO } + CUPDR { R AT91C_PWMC_CH1_CUPDR WO } + CPRDR { R AT91C_PWMC_CH1_CPRDR RW } + CCNTR { R AT91C_PWMC_CH1_CCNTR RO } + CDTYR { R AT91C_PWMC_CH1_CDTYR RW } + CMR { R AT91C_PWMC_CH1_CMR RW } + listeReg { Reserved CUPDR CPRDR CCNTR CDTYR CMR } + +} +array set PWMC_CH0_att { + Reserved { R AT91C_PWMC_CH0_Reserved WO } + CPRDR { R AT91C_PWMC_CH0_CPRDR RW } + CDTYR { R AT91C_PWMC_CH0_CDTYR RW } + CMR { R AT91C_PWMC_CH0_CMR RW } + CUPDR { R AT91C_PWMC_CH0_CUPDR WO } + CCNTR { R AT91C_PWMC_CH0_CCNTR RO } + listeReg { Reserved CPRDR CDTYR CMR CUPDR CCNTR } + +} + +# ========== Peripheral attributes for RTTC peripheral ========== +array set RTTC_att { + RTSR { R AT91C_RTTC_RTSR RO } + RTMR { R AT91C_RTTC_RTMR RW } + RTVR { R AT91C_RTTC_RTVR RO } + RTAR { R AT91C_RTTC_RTAR RW } + listeReg { RTSR RTMR RTVR RTAR } + +} + +# ========== Peripheral attributes for UDP peripheral ========== +array set UDP_att { + IMR { R AT91C_UDP_IMR RO } + FADDR { R AT91C_UDP_FADDR RW } + NUM { R AT91C_UDP_NUM RO } + FDR { R AT91C_UDP_FDR RW } + ISR { R AT91C_UDP_ISR RO } + CSR { R AT91C_UDP_CSR RW } + IDR { R AT91C_UDP_IDR WO } + ICR { R AT91C_UDP_ICR RO } + RSTEP { R AT91C_UDP_RSTEP RO } + TXVC { R AT91C_UDP_TXVC RW } + GLBSTATE { R AT91C_UDP_GLBSTATE RW } + IER { R AT91C_UDP_IER WO } + listeReg { IMR FADDR NUM FDR ISR CSR IDR ICR RSTEP TXVC GLBSTATE IER } + +} + +# ========== Peripheral attributes for EMAC peripheral ========== +array set EMAC_att { + ISR { R AT91C_EMAC_ISR RW } + SA4H { R AT91C_EMAC_SA4H RW } + SA1L { R AT91C_EMAC_SA1L RW } + ELE { R AT91C_EMAC_ELE RW } + LCOL { R AT91C_EMAC_LCOL RW } + RLE { R AT91C_EMAC_RLE RW } + WOL { R AT91C_EMAC_WOL RW } + DTF { R AT91C_EMAC_DTF RW } + TUND { R AT91C_EMAC_TUND RW } + NCR { R AT91C_EMAC_NCR RW } + SA4L { R AT91C_EMAC_SA4L RW } + RSR { R AT91C_EMAC_RSR RW } + SA3L { R AT91C_EMAC_SA3L RW } + TSR { R AT91C_EMAC_TSR RW } + IDR { R AT91C_EMAC_IDR WO } + RSE { R AT91C_EMAC_RSE RW } + ECOL { R AT91C_EMAC_ECOL RW } + TID { R AT91C_EMAC_TID RW } + HRB { R AT91C_EMAC_HRB RW } + TBQP { R AT91C_EMAC_TBQP RW } + USRIO { R AT91C_EMAC_USRIO RW } + PTR { R AT91C_EMAC_PTR RW } + SA2H { R AT91C_EMAC_SA2H RW } + ROV { R AT91C_EMAC_ROV RW } + ALE { R AT91C_EMAC_ALE RW } + RJA { R AT91C_EMAC_RJA RW } + RBQP { R AT91C_EMAC_RBQP RW } + TPF { R AT91C_EMAC_TPF RW } + NCFGR { R AT91C_EMAC_NCFGR RW } + HRT { R AT91C_EMAC_HRT RW } + USF { R AT91C_EMAC_USF RW } + FCSE { R AT91C_EMAC_FCSE RW } + TPQ { R AT91C_EMAC_TPQ RW } + MAN { R AT91C_EMAC_MAN RW } + FTO { R AT91C_EMAC_FTO RW } + REV { R AT91C_EMAC_REV RO } + IMR { R AT91C_EMAC_IMR RO } + SCF { R AT91C_EMAC_SCF RW } + PFR { R AT91C_EMAC_PFR RW } + MCF { R AT91C_EMAC_MCF RW } + NSR { R AT91C_EMAC_NSR RO } + SA2L { R AT91C_EMAC_SA2L RW } + FRO { R AT91C_EMAC_FRO RW } + IER { R AT91C_EMAC_IER WO } + SA1H { R AT91C_EMAC_SA1H RW } + CSE { R AT91C_EMAC_CSE RW } + SA3H { R AT91C_EMAC_SA3H RW } + RRE { R AT91C_EMAC_RRE RW } + STE { R AT91C_EMAC_STE RW } + listeReg { ISR SA4H SA1L ELE LCOL RLE WOL DTF TUND NCR SA4L RSR SA3L TSR IDR RSE ECOL TID HRB TBQP USRIO PTR SA2H ROV ALE RJA RBQP TPF NCFGR HRT USF FCSE TPQ MAN FTO REV IMR SCF PFR MCF NSR SA2L FRO IER SA1H CSE SA3H RRE STE } + +} + +# ========== Peripheral attributes for CAN_MB peripheral ========== +array set CAN_MB0_att { + MDL { R AT91C_CAN_MB0_MDL RW } + MAM { R AT91C_CAN_MB0_MAM RW } + MCR { R AT91C_CAN_MB0_MCR WO } + MID { R AT91C_CAN_MB0_MID RW } + MSR { R AT91C_CAN_MB0_MSR RO } + MFID { R AT91C_CAN_MB0_MFID RO } + MDH { R AT91C_CAN_MB0_MDH RW } + MMR { R AT91C_CAN_MB0_MMR RW } + listeReg { MDL MAM MCR MID MSR MFID MDH MMR } + +} +array set CAN_MB1_att { + MDL { R AT91C_CAN_MB1_MDL RW } + MID { R AT91C_CAN_MB1_MID RW } + MMR { R AT91C_CAN_MB1_MMR RW } + MSR { R AT91C_CAN_MB1_MSR RO } + MAM { R AT91C_CAN_MB1_MAM RW } + MDH { R AT91C_CAN_MB1_MDH RW } + MCR { R AT91C_CAN_MB1_MCR WO } + MFID { R AT91C_CAN_MB1_MFID RO } + listeReg { MDL MID MMR MSR MAM MDH MCR MFID } + +} +array set CAN_MB2_att { + MCR { R AT91C_CAN_MB2_MCR WO } + MDH { R AT91C_CAN_MB2_MDH RW } + MID { R AT91C_CAN_MB2_MID RW } + MDL { R AT91C_CAN_MB2_MDL RW } + MMR { R AT91C_CAN_MB2_MMR RW } + MAM { R AT91C_CAN_MB2_MAM RW } + MFID { R AT91C_CAN_MB2_MFID RO } + MSR { R AT91C_CAN_MB2_MSR RO } + listeReg { MCR MDH MID MDL MMR MAM MFID MSR } + +} +array set CAN_MB3_att { + MFID { R AT91C_CAN_MB3_MFID RO } + MAM { R AT91C_CAN_MB3_MAM RW } + MID { R AT91C_CAN_MB3_MID RW } + MCR { R AT91C_CAN_MB3_MCR WO } + MMR { R AT91C_CAN_MB3_MMR RW } + MSR { R AT91C_CAN_MB3_MSR RO } + MDL { R AT91C_CAN_MB3_MDL RW } + MDH { R AT91C_CAN_MB3_MDH RW } + listeReg { MFID MAM MID MCR MMR MSR MDL MDH } + +} +array set CAN_MB4_att { + MID { R AT91C_CAN_MB4_MID RW } + MMR { R AT91C_CAN_MB4_MMR RW } + MDH { R AT91C_CAN_MB4_MDH RW } + MFID { R AT91C_CAN_MB4_MFID RO } + MSR { R AT91C_CAN_MB4_MSR RO } + MCR { R AT91C_CAN_MB4_MCR WO } + MDL { R AT91C_CAN_MB4_MDL RW } + MAM { R AT91C_CAN_MB4_MAM RW } + listeReg { MID MMR MDH MFID MSR MCR MDL MAM } + +} +array set CAN_MB5_att { + MSR { R AT91C_CAN_MB5_MSR RO } + MCR { R AT91C_CAN_MB5_MCR WO } + MFID { R AT91C_CAN_MB5_MFID RO } + MDH { R AT91C_CAN_MB5_MDH RW } + MID { R AT91C_CAN_MB5_MID RW } + MMR { R AT91C_CAN_MB5_MMR RW } + MDL { R AT91C_CAN_MB5_MDL RW } + MAM { R AT91C_CAN_MB5_MAM RW } + listeReg { MSR MCR MFID MDH MID MMR MDL MAM } + +} +array set CAN_MB6_att { + MFID { R AT91C_CAN_MB6_MFID RO } + MID { R AT91C_CAN_MB6_MID RW } + MAM { R AT91C_CAN_MB6_MAM RW } + MSR { R AT91C_CAN_MB6_MSR RO } + MDL { R AT91C_CAN_MB6_MDL RW } + MCR { R AT91C_CAN_MB6_MCR WO } + MDH { R AT91C_CAN_MB6_MDH RW } + MMR { R AT91C_CAN_MB6_MMR RW } + listeReg { MFID MID MAM MSR MDL MCR MDH MMR } + +} +array set CAN_MB7_att { + MCR { R AT91C_CAN_MB7_MCR WO } + MDH { R AT91C_CAN_MB7_MDH RW } + MFID { R AT91C_CAN_MB7_MFID RO } + MDL { R AT91C_CAN_MB7_MDL RW } + MID { R AT91C_CAN_MB7_MID RW } + MMR { R AT91C_CAN_MB7_MMR RW } + MAM { R AT91C_CAN_MB7_MAM RW } + MSR { R AT91C_CAN_MB7_MSR RO } + listeReg { MCR MDH MFID MDL MID MMR MAM MSR } + +} + +# ========== Peripheral attributes for TC peripheral ========== +array set TC0_att { + SR { R AT91C_TC0_SR RO } + RC { R AT91C_TC0_RC RW } + RB { R AT91C_TC0_RB RW } + CCR { R AT91C_TC0_CCR WO } + CMR { R AT91C_TC0_CMR RW } + IER { R AT91C_TC0_IER WO } + RA { R AT91C_TC0_RA RW } + IDR { R AT91C_TC0_IDR WO } + CV { R AT91C_TC0_CV RW } + IMR { R AT91C_TC0_IMR RO } + listeReg { SR RC RB CCR CMR IER RA IDR CV IMR } + +} +array set TC1_att { + RB { R AT91C_TC1_RB RW } + CCR { R AT91C_TC1_CCR WO } + IER { R AT91C_TC1_IER WO } + IDR { R AT91C_TC1_IDR WO } + SR { R AT91C_TC1_SR RO } + CMR { R AT91C_TC1_CMR RW } + RA { R AT91C_TC1_RA RW } + RC { R AT91C_TC1_RC RW } + IMR { R AT91C_TC1_IMR RO } + CV { R AT91C_TC1_CV RW } + listeReg { RB CCR IER IDR SR CMR RA RC IMR CV } + +} +array set TC2_att { + CMR { R AT91C_TC2_CMR RW } + CCR { R AT91C_TC2_CCR WO } + CV { R AT91C_TC2_CV RW } + RA { R AT91C_TC2_RA RW } + RB { R AT91C_TC2_RB RW } + IDR { R AT91C_TC2_IDR WO } + IMR { R AT91C_TC2_IMR RO } + RC { R AT91C_TC2_RC RW } + IER { R AT91C_TC2_IER WO } + SR { R AT91C_TC2_SR RO } + listeReg { CMR CCR CV RA RB IDR IMR RC IER SR } + +} + +# ========== Peripheral attributes for SYS peripheral ========== +array set SYS_att { + listeReg { } + +} + +# ========== Peripheral attributes for MC peripheral ========== +array set MC_att { + ASR { R AT91C_MC_ASR RO } + RCR { R AT91C_MC_RCR WO } + FCR { R AT91C_MC_FCR WO } + AASR { R AT91C_MC_AASR RO } + FSR { R AT91C_MC_FSR RO } + FMR { R AT91C_MC_FMR RW } + listeReg { ASR RCR FCR AASR FSR FMR } + +} + +# ========== Peripheral attributes for PIO peripheral ========== +array set PIOA_att { + ODR { R AT91C_PIOA_ODR WO } + SODR { R AT91C_PIOA_SODR WO } + ISR { R AT91C_PIOA_ISR RO } + ABSR { R AT91C_PIOA_ABSR RO } + IER { R AT91C_PIOA_IER WO } + PPUDR { R AT91C_PIOA_PPUDR WO } + IMR { R AT91C_PIOA_IMR RO } + PER { R AT91C_PIOA_PER WO } + IFDR { R AT91C_PIOA_IFDR WO } + OWDR { R AT91C_PIOA_OWDR WO } + MDSR { R AT91C_PIOA_MDSR RO } + IDR { R AT91C_PIOA_IDR WO } + ODSR { R AT91C_PIOA_ODSR RO } + PPUSR { R AT91C_PIOA_PPUSR RO } + OWSR { R AT91C_PIOA_OWSR RO } + BSR { R AT91C_PIOA_BSR WO } + OWER { R AT91C_PIOA_OWER WO } + IFER { R AT91C_PIOA_IFER WO } + PDSR { R AT91C_PIOA_PDSR RO } + PPUER { R AT91C_PIOA_PPUER WO } + OSR { R AT91C_PIOA_OSR RO } + ASR { R AT91C_PIOA_ASR WO } + MDDR { R AT91C_PIOA_MDDR WO } + CODR { R AT91C_PIOA_CODR WO } + MDER { R AT91C_PIOA_MDER WO } + PDR { R AT91C_PIOA_PDR WO } + IFSR { R AT91C_PIOA_IFSR RO } + OER { R AT91C_PIOA_OER WO } + PSR { R AT91C_PIOA_PSR RO } + listeReg { ODR SODR ISR ABSR IER PPUDR IMR PER IFDR OWDR MDSR IDR ODSR PPUSR OWSR BSR OWER IFER PDSR PPUER OSR ASR MDDR CODR MDER PDR IFSR OER PSR } + +} +array set PIOB_att { + OWDR { R AT91C_PIOB_OWDR WO } + MDER { R AT91C_PIOB_MDER WO } + PPUSR { R AT91C_PIOB_PPUSR RO } + IMR { R AT91C_PIOB_IMR RO } + ASR { R AT91C_PIOB_ASR WO } + PPUDR { R AT91C_PIOB_PPUDR WO } + PSR { R AT91C_PIOB_PSR RO } + IER { R AT91C_PIOB_IER WO } + CODR { R AT91C_PIOB_CODR WO } + OWER { R AT91C_PIOB_OWER WO } + ABSR { R AT91C_PIOB_ABSR RO } + IFDR { R AT91C_PIOB_IFDR WO } + PDSR { R AT91C_PIOB_PDSR RO } + IDR { R AT91C_PIOB_IDR WO } + OWSR { R AT91C_PIOB_OWSR RO } + PDR { R AT91C_PIOB_PDR WO } + ODR { R AT91C_PIOB_ODR WO } + IFSR { R AT91C_PIOB_IFSR RO } + PPUER { R AT91C_PIOB_PPUER WO } + SODR { R AT91C_PIOB_SODR WO } + ISR { R AT91C_PIOB_ISR RO } + ODSR { R AT91C_PIOB_ODSR RO } + OSR { R AT91C_PIOB_OSR RO } + MDSR { R AT91C_PIOB_MDSR RO } + IFER { R AT91C_PIOB_IFER WO } + BSR { R AT91C_PIOB_BSR WO } + MDDR { R AT91C_PIOB_MDDR WO } + OER { R AT91C_PIOB_OER WO } + PER { R AT91C_PIOB_PER WO } + listeReg { OWDR MDER PPUSR IMR ASR PPUDR PSR IER CODR OWER ABSR IFDR PDSR IDR OWSR PDR ODR IFSR PPUER SODR ISR ODSR OSR MDSR IFER BSR MDDR OER PER } + +} + +# ========== Peripheral attributes for CAN peripheral ========== +array set CAN_att { + TCR { R AT91C_CAN_TCR WO } + IMR { R AT91C_CAN_IMR RO } + IER { R AT91C_CAN_IER WO } + ECR { R AT91C_CAN_ECR RO } + TIMESTP { R AT91C_CAN_TIMESTP RO } + MR { R AT91C_CAN_MR RW } + IDR { R AT91C_CAN_IDR WO } + ACR { R AT91C_CAN_ACR WO } + TIM { R AT91C_CAN_TIM RO } + SR { R AT91C_CAN_SR RO } + BR { R AT91C_CAN_BR RW } + VR { R AT91C_CAN_VR RO } + listeReg { TCR IMR IER ECR TIMESTP MR IDR ACR TIM SR BR VR } + +} + +# ========== Peripheral attributes for PWMC peripheral ========== +array set PWMC_att { + IDR { R AT91C_PWMC_IDR WO } + DIS { R AT91C_PWMC_DIS WO } + IER { R AT91C_PWMC_IER WO } + VR { R AT91C_PWMC_VR RO } + ISR { R AT91C_PWMC_ISR RO } + SR { R AT91C_PWMC_SR RO } + IMR { R AT91C_PWMC_IMR RO } + MR { R AT91C_PWMC_MR RW } + ENA { R AT91C_PWMC_ENA WO } + listeReg { IDR DIS IER VR ISR SR IMR MR ENA } + +} + +# ========== Peripheral attributes for PDC peripheral ========== +array set PDC_DBGU_att { + TCR { R AT91C_DBGU_TCR RW } + RNPR { R AT91C_DBGU_RNPR RW } + TNPR { R AT91C_DBGU_TNPR RW } + TPR { R AT91C_DBGU_TPR RW } + RPR { R AT91C_DBGU_RPR RW } + RCR { R AT91C_DBGU_RCR RW } + RNCR { R AT91C_DBGU_RNCR RW } + PTCR { R AT91C_DBGU_PTCR WO } + PTSR { R AT91C_DBGU_PTSR RO } + TNCR { R AT91C_DBGU_TNCR RW } + listeReg { TCR RNPR TNPR TPR RPR RCR RNCR PTCR PTSR TNCR } + +} +array set PDC_SPI1_att { + PTCR { R AT91C_SPI1_PTCR WO } + RPR { R AT91C_SPI1_RPR RW } + TNCR { R AT91C_SPI1_TNCR RW } + TPR { R AT91C_SPI1_TPR RW } + TNPR { R AT91C_SPI1_TNPR RW } + TCR { R AT91C_SPI1_TCR RW } + RCR { R AT91C_SPI1_RCR RW } + RNPR { R AT91C_SPI1_RNPR RW } + RNCR { R AT91C_SPI1_RNCR RW } + PTSR { R AT91C_SPI1_PTSR RO } + listeReg { PTCR RPR TNCR TPR TNPR TCR RCR RNPR RNCR PTSR } + +} +array set PDC_SPI0_att { + PTCR { R AT91C_SPI0_PTCR WO } + TPR { R AT91C_SPI0_TPR RW } + TCR { R AT91C_SPI0_TCR RW } + RCR { R AT91C_SPI0_RCR RW } + PTSR { R AT91C_SPI0_PTSR RO } + RNPR { R AT91C_SPI0_RNPR RW } + RPR { R AT91C_SPI0_RPR RW } + TNCR { R AT91C_SPI0_TNCR RW } + RNCR { R AT91C_SPI0_RNCR RW } + TNPR { R AT91C_SPI0_TNPR RW } + listeReg { PTCR TPR TCR RCR PTSR RNPR RPR TNCR RNCR TNPR } + +} +array set PDC_US1_att { + RNCR { R AT91C_US1_RNCR RW } + PTCR { R AT91C_US1_PTCR WO } + TCR { R AT91C_US1_TCR RW } + PTSR { R AT91C_US1_PTSR RO } + TNPR { R AT91C_US1_TNPR RW } + RCR { R AT91C_US1_RCR RW } + RNPR { R AT91C_US1_RNPR RW } + RPR { R AT91C_US1_RPR RW } + TNCR { R AT91C_US1_TNCR RW } + TPR { R AT91C_US1_TPR RW } + listeReg { RNCR PTCR TCR PTSR TNPR RCR RNPR RPR TNCR TPR } + +} +array set PDC_US0_att { + TNPR { R AT91C_US0_TNPR RW } + RNPR { R AT91C_US0_RNPR RW } + TCR { R AT91C_US0_TCR RW } + PTCR { R AT91C_US0_PTCR WO } + PTSR { R AT91C_US0_PTSR RO } + TNCR { R AT91C_US0_TNCR RW } + TPR { R AT91C_US0_TPR RW } + RCR { R AT91C_US0_RCR RW } + RPR { R AT91C_US0_RPR RW } + RNCR { R AT91C_US0_RNCR RW } + listeReg { TNPR RNPR TCR PTCR PTSR TNCR TPR RCR RPR RNCR } + +} +array set PDC_SSC_att { + TNCR { R AT91C_SSC_TNCR RW } + RPR { R AT91C_SSC_RPR RW } + RNCR { R AT91C_SSC_RNCR RW } + TPR { R AT91C_SSC_TPR RW } + PTCR { R AT91C_SSC_PTCR WO } + TCR { R AT91C_SSC_TCR RW } + RCR { R AT91C_SSC_RCR RW } + RNPR { R AT91C_SSC_RNPR RW } + TNPR { R AT91C_SSC_TNPR RW } + PTSR { R AT91C_SSC_PTSR RO } + listeReg { TNCR RPR RNCR TPR PTCR TCR RCR RNPR TNPR PTSR } + +} +array set PDC_ADC_att { + PTSR { R AT91C_ADC_PTSR RO } + PTCR { R AT91C_ADC_PTCR WO } + TNPR { R AT91C_ADC_TNPR RW } + TNCR { R AT91C_ADC_TNCR RW } + RNPR { R AT91C_ADC_RNPR RW } + RNCR { R AT91C_ADC_RNCR RW } + RPR { R AT91C_ADC_RPR RW } + TCR { R AT91C_ADC_TCR RW } + TPR { R AT91C_ADC_TPR RW } + RCR { R AT91C_ADC_RCR RW } + listeReg { PTSR PTCR TNPR TNCR RNPR RNCR RPR TCR TPR RCR } + +} + +# ========== PIO information ========== + +array set def_PIOA_att { + PA0 { RXD0 } + PA1 { TXD0 } + PA10 { TWD } + PA11 { TWCK } + PA12 { SPI0_NPCS0 } + PA13 { SPI0_NPCS1 PCK1 } + PA14 { SPI0_NPCS2 IRQ1 } + PA15 { SPI0_NPCS3 TCLK2 } + PA16 { SPI0_MISO } + PA17 { SPI0_MOSI } + PA18 { SPI0_SPCK } + PA19 { CANRX } + PA2 { SCK0 SPI1_NPCS1 } + PA20 { CANTX } + PA21 { TF SPI1_NPCS0 } + PA22 { TK SPI1_SPCK } + PA23 { TD SPI1_MOSI } + PA24 { RD SPI1_MISO } + PA25 { RK SPI1_NPCS1 } + PA26 { RF SPI1_NPCS2 } + PA27 { DRXD PCK3 } + PA28 { DTXD } + PA29 { FIQ SPI1_NPCS3 } + PA3 { RTS0 SPI1_NPCS2 } + PA30 { IRQ0 PCK2 } + PA4 { CTS0 SPI1_NPCS3 } + PA5 { RXD1 } + PA6 { TXD1 } + PA7 { SCK1 SPI0_NPCS1 } + PA8 { RTS1 SPI0_NPCS2 } + PA9 { CTS1 SPI0_NPCS3 } + } + +array set def_PIOB_att { + PB0 { ETXCK_EREFCK PCK0 } + PB1 { ETXEN } + PB10 { ETX2 SPI1_NPCS1 } + PB11 { ETX3 SPI1_NPCS2 } + PB12 { ETXER TCLK0 } + PB13 { ERX2 SPI0_NPCS1 } + PB14 { ERX3 SPI0_NPCS2 } + PB15 { ERXDV_ECRSDV } + PB16 { ECOL SPI1_NPCS3 } + PB17 { ERXCK SPI0_NPCS3 } + PB18 { EF100 ADTRG } + PB19 { PWM0 TCLK1 } + PB2 { ETX0 } + PB20 { PWM1 PCK0 } + PB21 { PWM2 PCK1 } + PB22 { PWM3 PCK2 } + PB23 { TIOA0 DCD1 } + PB24 { TIOB0 DSR1 } + PB25 { TIOA1 DTR1 } + PB26 { TIOB1 RI1 } + PB27 { TIOA2 PWM0 } + PB28 { TIOB2 PWM1 } + PB29 { PCK1 PWM2 } + PB3 { ETX1 } + PB30 { PCK2 PWM3 } + PB4 { ECRS } + PB5 { ERX0 } + PB6 { ERX1 } + PB7 { ERXER } + PB8 { EMDC } + PB9 { EMDIO } + } diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256_inc.h b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256_inc.h new file mode 100644 index 0000000..b393d05 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256_inc.h @@ -0,0 +1,2268 @@ +// ---------------------------------------------------------------------------- +// ATMEL Microcontroller Software Support - ROUSSET - +// ---------------------------------------------------------------------------- +// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// ---------------------------------------------------------------------------- +// File Name : AT91SAM7X256.h +// Object : AT91SAM7X256 definitions +// Generated : AT91 SW Application Group 11/02/2005 (15:17:24) +// +// CVS Reference : /AT91SAM7X256.pl/1.14/Tue Sep 13 15:06:52 2005// +// CVS Reference : /SYS_SAM7X.pl/1.3/Tue Feb 1 17:01:43 2005// +// CVS Reference : /MC_SAM7X.pl/1.2/Fri May 20 14:13:04 2005// +// CVS Reference : /PMC_SAM7X.pl/1.4/Tue Feb 8 13:58:10 2005// +// CVS Reference : /RSTC_SAM7X.pl/1.2/Wed Jul 13 14:57:50 2005// +// CVS Reference : /UDP_SAM7X.pl/1.1/Tue May 10 11:35:35 2005// +// CVS Reference : /PWM_SAM7X.pl/1.1/Tue May 10 11:53:07 2005// +// CVS Reference : /AIC_6075B.pl/1.3/Fri May 20 14:01:30 2005// +// CVS Reference : /PIO_6057A.pl/1.2/Thu Feb 3 10:18:28 2005// +// CVS Reference : /RTTC_6081A.pl/1.2/Tue Nov 9 14:43:58 2004// +// CVS Reference : /PITC_6079A.pl/1.2/Tue Nov 9 14:43:56 2004// +// CVS Reference : /WDTC_6080A.pl/1.3/Tue Nov 9 14:44:00 2004// +// CVS Reference : /VREG_6085B.pl/1.1/Tue Feb 1 16:05:48 2005// +// CVS Reference : /PDC_6074C.pl/1.2/Thu Feb 3 08:48:54 2005// +// CVS Reference : /DBGU_6059D.pl/1.1/Mon Jan 31 13:15:32 2005// +// CVS Reference : /SPI_6088D.pl/1.3/Fri May 20 14:08:59 2005// +// CVS Reference : /US_6089C.pl/1.1/Mon Jul 12 18:23:26 2004// +// CVS Reference : /SSC_6078B.pl/1.1/Wed Jul 13 15:19:19 2005// +// CVS Reference : /TWI_6061A.pl/1.1/Tue Jul 13 07:38:06 2004// +// CVS Reference : /TC_6082A.pl/1.7/Fri Mar 11 12:52:17 2005// +// CVS Reference : /CAN_6019B.pl/1.1/Tue Mar 8 12:42:22 2005// +// CVS Reference : /EMACB_6119A.pl/1.6/Wed Jul 13 15:05:35 2005// +// CVS Reference : /ADC_6051C.pl/1.1/Fri Oct 17 09:12:38 2003// +// ---------------------------------------------------------------------------- + +// Hardware register definition + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR System Peripherals +// ***************************************************************************** + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Advanced Interrupt Controller +// ***************************************************************************** +// *** Register offset in AT91S_AIC structure *** +#define AIC_SMR ( 0) // Source Mode Register +#define AIC_SVR (128) // Source Vector Register +#define AIC_IVR (256) // IRQ Vector Register +#define AIC_FVR (260) // FIQ Vector Register +#define AIC_ISR (264) // Interrupt Status Register +#define AIC_IPR (268) // Interrupt Pending Register +#define AIC_IMR (272) // Interrupt Mask Register +#define AIC_CISR (276) // Core Interrupt Status Register +#define AIC_IECR (288) // Interrupt Enable Command Register +#define AIC_IDCR (292) // Interrupt Disable Command Register +#define AIC_ICCR (296) // Interrupt Clear Command Register +#define AIC_ISCR (300) // Interrupt Set Command Register +#define AIC_EOICR (304) // End of Interrupt Command Register +#define AIC_SPU (308) // Spurious Vector Register +#define AIC_DCR (312) // Debug Control Register (Protect) +#define AIC_FFER (320) // Fast Forcing Enable Register +#define AIC_FFDR (324) // Fast Forcing Disable Register +#define AIC_FFSR (328) // Fast Forcing Status Register +// -------- AIC_SMR : (AIC Offset: 0x0) Control Register -------- +#define AT91C_AIC_PRIOR (0x7 << 0) // (AIC) Priority Level +#define AT91C_AIC_PRIOR_LOWEST (0x0) // (AIC) Lowest priority level +#define AT91C_AIC_PRIOR_HIGHEST (0x7) // (AIC) Highest priority level +#define AT91C_AIC_SRCTYPE (0x3 << 5) // (AIC) Interrupt Source Type +#define AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL (0x0 << 5) // (AIC) Internal Sources Code Label High-level Sensitive +#define AT91C_AIC_SRCTYPE_EXT_LOW_LEVEL (0x0 << 5) // (AIC) External Sources Code Label Low-level Sensitive +#define AT91C_AIC_SRCTYPE_INT_POSITIVE_EDGE (0x1 << 5) // (AIC) Internal Sources Code Label Positive Edge triggered +#define AT91C_AIC_SRCTYPE_EXT_NEGATIVE_EDGE (0x1 << 5) // (AIC) External Sources Code Label Negative Edge triggered +#define AT91C_AIC_SRCTYPE_HIGH_LEVEL (0x2 << 5) // (AIC) Internal Or External Sources Code Label High-level Sensitive +#define AT91C_AIC_SRCTYPE_POSITIVE_EDGE (0x3 << 5) // (AIC) Internal Or External Sources Code Label Positive Edge triggered +// -------- AIC_CISR : (AIC Offset: 0x114) AIC Core Interrupt Status Register -------- +#define AT91C_AIC_NFIQ (0x1 << 0) // (AIC) NFIQ Status +#define AT91C_AIC_NIRQ (0x1 << 1) // (AIC) NIRQ Status +// -------- AIC_DCR : (AIC Offset: 0x138) AIC Debug Control Register (Protect) -------- +#define AT91C_AIC_DCR_PROT (0x1 << 0) // (AIC) Protection Mode +#define AT91C_AIC_DCR_GMSK (0x1 << 1) // (AIC) General Mask + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Peripheral DMA Controller +// ***************************************************************************** +// *** Register offset in AT91S_PDC structure *** +#define PDC_RPR ( 0) // Receive Pointer Register +#define PDC_RCR ( 4) // Receive Counter Register +#define PDC_TPR ( 8) // Transmit Pointer Register +#define PDC_TCR (12) // Transmit Counter Register +#define PDC_RNPR (16) // Receive Next Pointer Register +#define PDC_RNCR (20) // Receive Next Counter Register +#define PDC_TNPR (24) // Transmit Next Pointer Register +#define PDC_TNCR (28) // Transmit Next Counter Register +#define PDC_PTCR (32) // PDC Transfer Control Register +#define PDC_PTSR (36) // PDC Transfer Status Register +// -------- PDC_PTCR : (PDC Offset: 0x20) PDC Transfer Control Register -------- +#define AT91C_PDC_RXTEN (0x1 << 0) // (PDC) Receiver Transfer Enable +#define AT91C_PDC_RXTDIS (0x1 << 1) // (PDC) Receiver Transfer Disable +#define AT91C_PDC_TXTEN (0x1 << 8) // (PDC) Transmitter Transfer Enable +#define AT91C_PDC_TXTDIS (0x1 << 9) // (PDC) Transmitter Transfer Disable +// -------- PDC_PTSR : (PDC Offset: 0x24) PDC Transfer Status Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Debug Unit +// ***************************************************************************** +// *** Register offset in AT91S_DBGU structure *** +#define DBGU_CR ( 0) // Control Register +#define DBGU_MR ( 4) // Mode Register +#define DBGU_IER ( 8) // Interrupt Enable Register +#define DBGU_IDR (12) // Interrupt Disable Register +#define DBGU_IMR (16) // Interrupt Mask Register +#define DBGU_CSR (20) // Channel Status Register +#define DBGU_RHR (24) // Receiver Holding Register +#define DBGU_THR (28) // Transmitter Holding Register +#define DBGU_BRGR (32) // Baud Rate Generator Register +#define DBGU_CIDR (64) // Chip ID Register +#define DBGU_EXID (68) // Chip ID Extension Register +#define DBGU_FNTR (72) // Force NTRST Register +#define DBGU_RPR (256) // Receive Pointer Register +#define DBGU_RCR (260) // Receive Counter Register +#define DBGU_TPR (264) // Transmit Pointer Register +#define DBGU_TCR (268) // Transmit Counter Register +#define DBGU_RNPR (272) // Receive Next Pointer Register +#define DBGU_RNCR (276) // Receive Next Counter Register +#define DBGU_TNPR (280) // Transmit Next Pointer Register +#define DBGU_TNCR (284) // Transmit Next Counter Register +#define DBGU_PTCR (288) // PDC Transfer Control Register +#define DBGU_PTSR (292) // PDC Transfer Status Register +// -------- DBGU_CR : (DBGU Offset: 0x0) Debug Unit Control Register -------- +#define AT91C_US_RSTRX (0x1 << 2) // (DBGU) Reset Receiver +#define AT91C_US_RSTTX (0x1 << 3) // (DBGU) Reset Transmitter +#define AT91C_US_RXEN (0x1 << 4) // (DBGU) Receiver Enable +#define AT91C_US_RXDIS (0x1 << 5) // (DBGU) Receiver Disable +#define AT91C_US_TXEN (0x1 << 6) // (DBGU) Transmitter Enable +#define AT91C_US_TXDIS (0x1 << 7) // (DBGU) Transmitter Disable +#define AT91C_US_RSTSTA (0x1 << 8) // (DBGU) Reset Status Bits +// -------- DBGU_MR : (DBGU Offset: 0x4) Debug Unit Mode Register -------- +#define AT91C_US_PAR (0x7 << 9) // (DBGU) Parity type +#define AT91C_US_PAR_EVEN (0x0 << 9) // (DBGU) Even Parity +#define AT91C_US_PAR_ODD (0x1 << 9) // (DBGU) Odd Parity +#define AT91C_US_PAR_SPACE (0x2 << 9) // (DBGU) Parity forced to 0 (Space) +#define AT91C_US_PAR_MARK (0x3 << 9) // (DBGU) Parity forced to 1 (Mark) +#define AT91C_US_PAR_NONE (0x4 << 9) // (DBGU) No Parity +#define AT91C_US_PAR_MULTI_DROP (0x6 << 9) // (DBGU) Multi-drop mode +#define AT91C_US_CHMODE (0x3 << 14) // (DBGU) Channel Mode +#define AT91C_US_CHMODE_NORMAL (0x0 << 14) // (DBGU) Normal Mode: The USART channel operates as an RX/TX USART. +#define AT91C_US_CHMODE_AUTO (0x1 << 14) // (DBGU) Automatic Echo: Receiver Data Input is connected to the TXD pin. +#define AT91C_US_CHMODE_LOCAL (0x2 << 14) // (DBGU) Local Loopback: Transmitter Output Signal is connected to Receiver Input Signal. +#define AT91C_US_CHMODE_REMOTE (0x3 << 14) // (DBGU) Remote Loopback: RXD pin is internally connected to TXD pin. +// -------- DBGU_IER : (DBGU Offset: 0x8) Debug Unit Interrupt Enable Register -------- +#define AT91C_US_RXRDY (0x1 << 0) // (DBGU) RXRDY Interrupt +#define AT91C_US_TXRDY (0x1 << 1) // (DBGU) TXRDY Interrupt +#define AT91C_US_ENDRX (0x1 << 3) // (DBGU) End of Receive Transfer Interrupt +#define AT91C_US_ENDTX (0x1 << 4) // (DBGU) End of Transmit Interrupt +#define AT91C_US_OVRE (0x1 << 5) // (DBGU) Overrun Interrupt +#define AT91C_US_FRAME (0x1 << 6) // (DBGU) Framing Error Interrupt +#define AT91C_US_PARE (0x1 << 7) // (DBGU) Parity Error Interrupt +#define AT91C_US_TXEMPTY (0x1 << 9) // (DBGU) TXEMPTY Interrupt +#define AT91C_US_TXBUFE (0x1 << 11) // (DBGU) TXBUFE Interrupt +#define AT91C_US_RXBUFF (0x1 << 12) // (DBGU) RXBUFF Interrupt +#define AT91C_US_COMM_TX (0x1 << 30) // (DBGU) COMM_TX Interrupt +#define AT91C_US_COMM_RX (0x1 << 31) // (DBGU) COMM_RX Interrupt +// -------- DBGU_IDR : (DBGU Offset: 0xc) Debug Unit Interrupt Disable Register -------- +// -------- DBGU_IMR : (DBGU Offset: 0x10) Debug Unit Interrupt Mask Register -------- +// -------- DBGU_CSR : (DBGU Offset: 0x14) Debug Unit Channel Status Register -------- +// -------- DBGU_FNTR : (DBGU Offset: 0x48) Debug Unit FORCE_NTRST Register -------- +#define AT91C_US_FORCE_NTRST (0x1 << 0) // (DBGU) Force NTRST in JTAG + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Parallel Input Output Controler +// ***************************************************************************** +// *** Register offset in AT91S_PIO structure *** +#define PIO_PER ( 0) // PIO Enable Register +#define PIO_PDR ( 4) // PIO Disable Register +#define PIO_PSR ( 8) // PIO Status Register +#define PIO_OER (16) // Output Enable Register +#define PIO_ODR (20) // Output Disable Registerr +#define PIO_OSR (24) // Output Status Register +#define PIO_IFER (32) // Input Filter Enable Register +#define PIO_IFDR (36) // Input Filter Disable Register +#define PIO_IFSR (40) // Input Filter Status Register +#define PIO_SODR (48) // Set Output Data Register +#define PIO_CODR (52) // Clear Output Data Register +#define PIO_ODSR (56) // Output Data Status Register +#define PIO_PDSR (60) // Pin Data Status Register +#define PIO_IER (64) // Interrupt Enable Register +#define PIO_IDR (68) // Interrupt Disable Register +#define PIO_IMR (72) // Interrupt Mask Register +#define PIO_ISR (76) // Interrupt Status Register +#define PIO_MDER (80) // Multi-driver Enable Register +#define PIO_MDDR (84) // Multi-driver Disable Register +#define PIO_MDSR (88) // Multi-driver Status Register +#define PIO_PPUDR (96) // Pull-up Disable Register +#define PIO_PPUER (100) // Pull-up Enable Register +#define PIO_PPUSR (104) // Pull-up Status Register +#define PIO_ASR (112) // Select A Register +#define PIO_BSR (116) // Select B Register +#define PIO_ABSR (120) // AB Select Status Register +#define PIO_OWER (160) // Output Write Enable Register +#define PIO_OWDR (164) // Output Write Disable Register +#define PIO_OWSR (168) // Output Write Status Register + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Clock Generator Controler +// ***************************************************************************** +// *** Register offset in AT91S_CKGR structure *** +#define CKGR_MOR ( 0) // Main Oscillator Register +#define CKGR_MCFR ( 4) // Main Clock Frequency Register +#define CKGR_PLLR (12) // PLL Register +// -------- CKGR_MOR : (CKGR Offset: 0x0) Main Oscillator Register -------- +#define AT91C_CKGR_MOSCEN (0x1 << 0) // (CKGR) Main Oscillator Enable +#define AT91C_CKGR_OSCBYPASS (0x1 << 1) // (CKGR) Main Oscillator Bypass +#define AT91C_CKGR_OSCOUNT (0xFF << 8) // (CKGR) Main Oscillator Start-up Time +// -------- CKGR_MCFR : (CKGR Offset: 0x4) Main Clock Frequency Register -------- +#define AT91C_CKGR_MAINF (0xFFFF << 0) // (CKGR) Main Clock Frequency +#define AT91C_CKGR_MAINRDY (0x1 << 16) // (CKGR) Main Clock Ready +// -------- CKGR_PLLR : (CKGR Offset: 0xc) PLL B Register -------- +#define AT91C_CKGR_DIV (0xFF << 0) // (CKGR) Divider Selected +#define AT91C_CKGR_DIV_0 (0x0) // (CKGR) Divider output is 0 +#define AT91C_CKGR_DIV_BYPASS (0x1) // (CKGR) Divider is bypassed +#define AT91C_CKGR_PLLCOUNT (0x3F << 8) // (CKGR) PLL Counter +#define AT91C_CKGR_OUT (0x3 << 14) // (CKGR) PLL Output Frequency Range +#define AT91C_CKGR_OUT_0 (0x0 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_OUT_1 (0x1 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_OUT_2 (0x2 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_OUT_3 (0x3 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_MUL (0x7FF << 16) // (CKGR) PLL Multiplier +#define AT91C_CKGR_USBDIV (0x3 << 28) // (CKGR) Divider for USB Clocks +#define AT91C_CKGR_USBDIV_0 (0x0 << 28) // (CKGR) Divider output is PLL clock output +#define AT91C_CKGR_USBDIV_1 (0x1 << 28) // (CKGR) Divider output is PLL clock output divided by 2 +#define AT91C_CKGR_USBDIV_2 (0x2 << 28) // (CKGR) Divider output is PLL clock output divided by 4 + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Power Management Controler +// ***************************************************************************** +// *** Register offset in AT91S_PMC structure *** +#define PMC_SCER ( 0) // System Clock Enable Register +#define PMC_SCDR ( 4) // System Clock Disable Register +#define PMC_SCSR ( 8) // System Clock Status Register +#define PMC_PCER (16) // Peripheral Clock Enable Register +#define PMC_PCDR (20) // Peripheral Clock Disable Register +#define PMC_PCSR (24) // Peripheral Clock Status Register +#define PMC_MOR (32) // Main Oscillator Register +#define PMC_MCFR (36) // Main Clock Frequency Register +#define PMC_PLLR (44) // PLL Register +#define PMC_MCKR (48) // Master Clock Register +#define PMC_PCKR (64) // Programmable Clock Register +#define PMC_IER (96) // Interrupt Enable Register +#define PMC_IDR (100) // Interrupt Disable Register +#define PMC_SR (104) // Status Register +#define PMC_IMR (108) // Interrupt Mask Register +// -------- PMC_SCER : (PMC Offset: 0x0) System Clock Enable Register -------- +#define AT91C_PMC_PCK (0x1 << 0) // (PMC) Processor Clock +#define AT91C_PMC_UDP (0x1 << 7) // (PMC) USB Device Port Clock +#define AT91C_PMC_PCK0 (0x1 << 8) // (PMC) Programmable Clock Output +#define AT91C_PMC_PCK1 (0x1 << 9) // (PMC) Programmable Clock Output +#define AT91C_PMC_PCK2 (0x1 << 10) // (PMC) Programmable Clock Output +#define AT91C_PMC_PCK3 (0x1 << 11) // (PMC) Programmable Clock Output +// -------- PMC_SCDR : (PMC Offset: 0x4) System Clock Disable Register -------- +// -------- PMC_SCSR : (PMC Offset: 0x8) System Clock Status Register -------- +// -------- CKGR_MOR : (PMC Offset: 0x20) Main Oscillator Register -------- +// -------- CKGR_MCFR : (PMC Offset: 0x24) Main Clock Frequency Register -------- +// -------- CKGR_PLLR : (PMC Offset: 0x2c) PLL B Register -------- +// -------- PMC_MCKR : (PMC Offset: 0x30) Master Clock Register -------- +#define AT91C_PMC_CSS (0x3 << 0) // (PMC) Programmable Clock Selection +#define AT91C_PMC_CSS_SLOW_CLK (0x0) // (PMC) Slow Clock is selected +#define AT91C_PMC_CSS_MAIN_CLK (0x1) // (PMC) Main Clock is selected +#define AT91C_PMC_CSS_PLL_CLK (0x3) // (PMC) Clock from PLL is selected +#define AT91C_PMC_PRES (0x7 << 2) // (PMC) Programmable Clock Prescaler +#define AT91C_PMC_PRES_CLK (0x0 << 2) // (PMC) Selected clock +#define AT91C_PMC_PRES_CLK_2 (0x1 << 2) // (PMC) Selected clock divided by 2 +#define AT91C_PMC_PRES_CLK_4 (0x2 << 2) // (PMC) Selected clock divided by 4 +#define AT91C_PMC_PRES_CLK_8 (0x3 << 2) // (PMC) Selected clock divided by 8 +#define AT91C_PMC_PRES_CLK_16 (0x4 << 2) // (PMC) Selected clock divided by 16 +#define AT91C_PMC_PRES_CLK_32 (0x5 << 2) // (PMC) Selected clock divided by 32 +#define AT91C_PMC_PRES_CLK_64 (0x6 << 2) // (PMC) Selected clock divided by 64 +// -------- PMC_PCKR : (PMC Offset: 0x40) Programmable Clock Register -------- +// -------- PMC_IER : (PMC Offset: 0x60) PMC Interrupt Enable Register -------- +#define AT91C_PMC_MOSCS (0x1 << 0) // (PMC) MOSC Status/Enable/Disable/Mask +#define AT91C_PMC_LOCK (0x1 << 2) // (PMC) PLL Status/Enable/Disable/Mask +#define AT91C_PMC_MCKRDY (0x1 << 3) // (PMC) MCK_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK0RDY (0x1 << 8) // (PMC) PCK0_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK1RDY (0x1 << 9) // (PMC) PCK1_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK2RDY (0x1 << 10) // (PMC) PCK2_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK3RDY (0x1 << 11) // (PMC) PCK3_RDY Status/Enable/Disable/Mask +// -------- PMC_IDR : (PMC Offset: 0x64) PMC Interrupt Disable Register -------- +// -------- PMC_SR : (PMC Offset: 0x68) PMC Status Register -------- +// -------- PMC_IMR : (PMC Offset: 0x6c) PMC Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Reset Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_RSTC structure *** +#define RSTC_RCR ( 0) // Reset Control Register +#define RSTC_RSR ( 4) // Reset Status Register +#define RSTC_RMR ( 8) // Reset Mode Register +// -------- RSTC_RCR : (RSTC Offset: 0x0) Reset Control Register -------- +#define AT91C_RSTC_PROCRST (0x1 << 0) // (RSTC) Processor Reset +#define AT91C_RSTC_PERRST (0x1 << 2) // (RSTC) Peripheral Reset +#define AT91C_RSTC_EXTRST (0x1 << 3) // (RSTC) External Reset +#define AT91C_RSTC_KEY (0xFF << 24) // (RSTC) Password +// -------- RSTC_RSR : (RSTC Offset: 0x4) Reset Status Register -------- +#define AT91C_RSTC_URSTS (0x1 << 0) // (RSTC) User Reset Status +#define AT91C_RSTC_BODSTS (0x1 << 1) // (RSTC) Brownout Detection Status +#define AT91C_RSTC_RSTTYP (0x7 << 8) // (RSTC) Reset Type +#define AT91C_RSTC_RSTTYP_POWERUP (0x0 << 8) // (RSTC) Power-up Reset. VDDCORE rising. +#define AT91C_RSTC_RSTTYP_WAKEUP (0x1 << 8) // (RSTC) WakeUp Reset. VDDCORE rising. +#define AT91C_RSTC_RSTTYP_WATCHDOG (0x2 << 8) // (RSTC) Watchdog Reset. Watchdog overflow occured. +#define AT91C_RSTC_RSTTYP_SOFTWARE (0x3 << 8) // (RSTC) Software Reset. Processor reset required by the software. +#define AT91C_RSTC_RSTTYP_USER (0x4 << 8) // (RSTC) User Reset. NRST pin detected low. +#define AT91C_RSTC_RSTTYP_BROWNOUT (0x5 << 8) // (RSTC) Brownout Reset occured. +#define AT91C_RSTC_NRSTL (0x1 << 16) // (RSTC) NRST pin level +#define AT91C_RSTC_SRCMP (0x1 << 17) // (RSTC) Software Reset Command in Progress. +// -------- RSTC_RMR : (RSTC Offset: 0x8) Reset Mode Register -------- +#define AT91C_RSTC_URSTEN (0x1 << 0) // (RSTC) User Reset Enable +#define AT91C_RSTC_URSTIEN (0x1 << 4) // (RSTC) User Reset Interrupt Enable +#define AT91C_RSTC_ERSTL (0xF << 8) // (RSTC) User Reset Length +#define AT91C_RSTC_BODIEN (0x1 << 16) // (RSTC) Brownout Detection Interrupt Enable + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Real Time Timer Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_RTTC structure *** +#define RTTC_RTMR ( 0) // Real-time Mode Register +#define RTTC_RTAR ( 4) // Real-time Alarm Register +#define RTTC_RTVR ( 8) // Real-time Value Register +#define RTTC_RTSR (12) // Real-time Status Register +// -------- RTTC_RTMR : (RTTC Offset: 0x0) Real-time Mode Register -------- +#define AT91C_RTTC_RTPRES (0xFFFF << 0) // (RTTC) Real-time Timer Prescaler Value +#define AT91C_RTTC_ALMIEN (0x1 << 16) // (RTTC) Alarm Interrupt Enable +#define AT91C_RTTC_RTTINCIEN (0x1 << 17) // (RTTC) Real Time Timer Increment Interrupt Enable +#define AT91C_RTTC_RTTRST (0x1 << 18) // (RTTC) Real Time Timer Restart +// -------- RTTC_RTAR : (RTTC Offset: 0x4) Real-time Alarm Register -------- +#define AT91C_RTTC_ALMV (0x0 << 0) // (RTTC) Alarm Value +// -------- RTTC_RTVR : (RTTC Offset: 0x8) Current Real-time Value Register -------- +#define AT91C_RTTC_CRTV (0x0 << 0) // (RTTC) Current Real-time Value +// -------- RTTC_RTSR : (RTTC Offset: 0xc) Real-time Status Register -------- +#define AT91C_RTTC_ALMS (0x1 << 0) // (RTTC) Real-time Alarm Status +#define AT91C_RTTC_RTTINC (0x1 << 1) // (RTTC) Real-time Timer Increment + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Periodic Interval Timer Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_PITC structure *** +#define PITC_PIMR ( 0) // Period Interval Mode Register +#define PITC_PISR ( 4) // Period Interval Status Register +#define PITC_PIVR ( 8) // Period Interval Value Register +#define PITC_PIIR (12) // Period Interval Image Register +// -------- PITC_PIMR : (PITC Offset: 0x0) Periodic Interval Mode Register -------- +#define AT91C_PITC_PIV (0xFFFFF << 0) // (PITC) Periodic Interval Value +#define AT91C_PITC_PITEN (0x1 << 24) // (PITC) Periodic Interval Timer Enabled +#define AT91C_PITC_PITIEN (0x1 << 25) // (PITC) Periodic Interval Timer Interrupt Enable +// -------- PITC_PISR : (PITC Offset: 0x4) Periodic Interval Status Register -------- +#define AT91C_PITC_PITS (0x1 << 0) // (PITC) Periodic Interval Timer Status +// -------- PITC_PIVR : (PITC Offset: 0x8) Periodic Interval Value Register -------- +#define AT91C_PITC_CPIV (0xFFFFF << 0) // (PITC) Current Periodic Interval Value +#define AT91C_PITC_PICNT (0xFFF << 20) // (PITC) Periodic Interval Counter +// -------- PITC_PIIR : (PITC Offset: 0xc) Periodic Interval Image Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Watchdog Timer Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_WDTC structure *** +#define WDTC_WDCR ( 0) // Watchdog Control Register +#define WDTC_WDMR ( 4) // Watchdog Mode Register +#define WDTC_WDSR ( 8) // Watchdog Status Register +// -------- WDTC_WDCR : (WDTC Offset: 0x0) Periodic Interval Image Register -------- +#define AT91C_WDTC_WDRSTT (0x1 << 0) // (WDTC) Watchdog Restart +#define AT91C_WDTC_KEY (0xFF << 24) // (WDTC) Watchdog KEY Password +// -------- WDTC_WDMR : (WDTC Offset: 0x4) Watchdog Mode Register -------- +#define AT91C_WDTC_WDV (0xFFF << 0) // (WDTC) Watchdog Timer Restart +#define AT91C_WDTC_WDFIEN (0x1 << 12) // (WDTC) Watchdog Fault Interrupt Enable +#define AT91C_WDTC_WDRSTEN (0x1 << 13) // (WDTC) Watchdog Reset Enable +#define AT91C_WDTC_WDRPROC (0x1 << 14) // (WDTC) Watchdog Timer Restart +#define AT91C_WDTC_WDDIS (0x1 << 15) // (WDTC) Watchdog Disable +#define AT91C_WDTC_WDD (0xFFF << 16) // (WDTC) Watchdog Delta Value +#define AT91C_WDTC_WDDBGHLT (0x1 << 28) // (WDTC) Watchdog Debug Halt +#define AT91C_WDTC_WDIDLEHLT (0x1 << 29) // (WDTC) Watchdog Idle Halt +// -------- WDTC_WDSR : (WDTC Offset: 0x8) Watchdog Status Register -------- +#define AT91C_WDTC_WDUNF (0x1 << 0) // (WDTC) Watchdog Underflow +#define AT91C_WDTC_WDERR (0x1 << 1) // (WDTC) Watchdog Error + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Voltage Regulator Mode Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_VREG structure *** +#define VREG_MR ( 0) // Voltage Regulator Mode Register +// -------- VREG_MR : (VREG Offset: 0x0) Voltage Regulator Mode Register -------- +#define AT91C_VREG_PSTDBY (0x1 << 0) // (VREG) Voltage Regulator Power Standby Mode + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Memory Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_MC structure *** +#define MC_RCR ( 0) // MC Remap Control Register +#define MC_ASR ( 4) // MC Abort Status Register +#define MC_AASR ( 8) // MC Abort Address Status Register +#define MC_FMR (96) // MC Flash Mode Register +#define MC_FCR (100) // MC Flash Command Register +#define MC_FSR (104) // MC Flash Status Register +// -------- MC_RCR : (MC Offset: 0x0) MC Remap Control Register -------- +#define AT91C_MC_RCB (0x1 << 0) // (MC) Remap Command Bit +// -------- MC_ASR : (MC Offset: 0x4) MC Abort Status Register -------- +#define AT91C_MC_UNDADD (0x1 << 0) // (MC) Undefined Addess Abort Status +#define AT91C_MC_MISADD (0x1 << 1) // (MC) Misaligned Addess Abort Status +#define AT91C_MC_ABTSZ (0x3 << 8) // (MC) Abort Size Status +#define AT91C_MC_ABTSZ_BYTE (0x0 << 8) // (MC) Byte +#define AT91C_MC_ABTSZ_HWORD (0x1 << 8) // (MC) Half-word +#define AT91C_MC_ABTSZ_WORD (0x2 << 8) // (MC) Word +#define AT91C_MC_ABTTYP (0x3 << 10) // (MC) Abort Type Status +#define AT91C_MC_ABTTYP_DATAR (0x0 << 10) // (MC) Data Read +#define AT91C_MC_ABTTYP_DATAW (0x1 << 10) // (MC) Data Write +#define AT91C_MC_ABTTYP_FETCH (0x2 << 10) // (MC) Code Fetch +#define AT91C_MC_MST0 (0x1 << 16) // (MC) Master 0 Abort Source +#define AT91C_MC_MST1 (0x1 << 17) // (MC) Master 1 Abort Source +#define AT91C_MC_SVMST0 (0x1 << 24) // (MC) Saved Master 0 Abort Source +#define AT91C_MC_SVMST1 (0x1 << 25) // (MC) Saved Master 1 Abort Source +// -------- MC_FMR : (MC Offset: 0x60) MC Flash Mode Register -------- +#define AT91C_MC_FRDY (0x1 << 0) // (MC) Flash Ready +#define AT91C_MC_LOCKE (0x1 << 2) // (MC) Lock Error +#define AT91C_MC_PROGE (0x1 << 3) // (MC) Programming Error +#define AT91C_MC_NEBP (0x1 << 7) // (MC) No Erase Before Programming +#define AT91C_MC_FWS (0x3 << 8) // (MC) Flash Wait State +#define AT91C_MC_FWS_0FWS (0x0 << 8) // (MC) 1 cycle for Read, 2 for Write operations +#define AT91C_MC_FWS_1FWS (0x1 << 8) // (MC) 2 cycles for Read, 3 for Write operations +#define AT91C_MC_FWS_2FWS (0x2 << 8) // (MC) 3 cycles for Read, 4 for Write operations +#define AT91C_MC_FWS_3FWS (0x3 << 8) // (MC) 4 cycles for Read, 4 for Write operations +#define AT91C_MC_FMCN (0xFF << 16) // (MC) Flash Microsecond Cycle Number +// -------- MC_FCR : (MC Offset: 0x64) MC Flash Command Register -------- +#define AT91C_MC_FCMD (0xF << 0) // (MC) Flash Command +#define AT91C_MC_FCMD_START_PROG (0x1) // (MC) Starts the programming of th epage specified by PAGEN. +#define AT91C_MC_FCMD_LOCK (0x2) // (MC) Starts a lock sequence of the sector defined by the bits 4 to 7 of the field PAGEN. +#define AT91C_MC_FCMD_PROG_AND_LOCK (0x3) // (MC) The lock sequence automatically happens after the programming sequence is completed. +#define AT91C_MC_FCMD_UNLOCK (0x4) // (MC) Starts an unlock sequence of the sector defined by the bits 4 to 7 of the field PAGEN. +#define AT91C_MC_FCMD_ERASE_ALL (0x8) // (MC) Starts the erase of the entire flash.If at least a page is locked, the command is cancelled. +#define AT91C_MC_FCMD_SET_GP_NVM (0xB) // (MC) Set General Purpose NVM bits. +#define AT91C_MC_FCMD_CLR_GP_NVM (0xD) // (MC) Clear General Purpose NVM bits. +#define AT91C_MC_FCMD_SET_SECURITY (0xF) // (MC) Set Security Bit. +#define AT91C_MC_PAGEN (0x3FF << 8) // (MC) Page Number +#define AT91C_MC_KEY (0xFF << 24) // (MC) Writing Protect Key +// -------- MC_FSR : (MC Offset: 0x68) MC Flash Command Register -------- +#define AT91C_MC_SECURITY (0x1 << 4) // (MC) Security Bit Status +#define AT91C_MC_GPNVM0 (0x1 << 8) // (MC) Sector 0 Lock Status +#define AT91C_MC_GPNVM1 (0x1 << 9) // (MC) Sector 1 Lock Status +#define AT91C_MC_GPNVM2 (0x1 << 10) // (MC) Sector 2 Lock Status +#define AT91C_MC_GPNVM3 (0x1 << 11) // (MC) Sector 3 Lock Status +#define AT91C_MC_GPNVM4 (0x1 << 12) // (MC) Sector 4 Lock Status +#define AT91C_MC_GPNVM5 (0x1 << 13) // (MC) Sector 5 Lock Status +#define AT91C_MC_GPNVM6 (0x1 << 14) // (MC) Sector 6 Lock Status +#define AT91C_MC_GPNVM7 (0x1 << 15) // (MC) Sector 7 Lock Status +#define AT91C_MC_LOCKS0 (0x1 << 16) // (MC) Sector 0 Lock Status +#define AT91C_MC_LOCKS1 (0x1 << 17) // (MC) Sector 1 Lock Status +#define AT91C_MC_LOCKS2 (0x1 << 18) // (MC) Sector 2 Lock Status +#define AT91C_MC_LOCKS3 (0x1 << 19) // (MC) Sector 3 Lock Status +#define AT91C_MC_LOCKS4 (0x1 << 20) // (MC) Sector 4 Lock Status +#define AT91C_MC_LOCKS5 (0x1 << 21) // (MC) Sector 5 Lock Status +#define AT91C_MC_LOCKS6 (0x1 << 22) // (MC) Sector 6 Lock Status +#define AT91C_MC_LOCKS7 (0x1 << 23) // (MC) Sector 7 Lock Status +#define AT91C_MC_LOCKS8 (0x1 << 24) // (MC) Sector 8 Lock Status +#define AT91C_MC_LOCKS9 (0x1 << 25) // (MC) Sector 9 Lock Status +#define AT91C_MC_LOCKS10 (0x1 << 26) // (MC) Sector 10 Lock Status +#define AT91C_MC_LOCKS11 (0x1 << 27) // (MC) Sector 11 Lock Status +#define AT91C_MC_LOCKS12 (0x1 << 28) // (MC) Sector 12 Lock Status +#define AT91C_MC_LOCKS13 (0x1 << 29) // (MC) Sector 13 Lock Status +#define AT91C_MC_LOCKS14 (0x1 << 30) // (MC) Sector 14 Lock Status +#define AT91C_MC_LOCKS15 (0x1 << 31) // (MC) Sector 15 Lock Status + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Serial Parallel Interface +// ***************************************************************************** +// *** Register offset in AT91S_SPI structure *** +#define SPI_CR ( 0) // Control Register +#define SPI_MR ( 4) // Mode Register +#define SPI_RDR ( 8) // Receive Data Register +#define SPI_TDR (12) // Transmit Data Register +#define SPI_SR (16) // Status Register +#define SPI_IER (20) // Interrupt Enable Register +#define SPI_IDR (24) // Interrupt Disable Register +#define SPI_IMR (28) // Interrupt Mask Register +#define SPI_CSR (48) // Chip Select Register +#define SPI_RPR (256) // Receive Pointer Register +#define SPI_RCR (260) // Receive Counter Register +#define SPI_TPR (264) // Transmit Pointer Register +#define SPI_TCR (268) // Transmit Counter Register +#define SPI_RNPR (272) // Receive Next Pointer Register +#define SPI_RNCR (276) // Receive Next Counter Register +#define SPI_TNPR (280) // Transmit Next Pointer Register +#define SPI_TNCR (284) // Transmit Next Counter Register +#define SPI_PTCR (288) // PDC Transfer Control Register +#define SPI_PTSR (292) // PDC Transfer Status Register +// -------- SPI_CR : (SPI Offset: 0x0) SPI Control Register -------- +#define AT91C_SPI_SPIEN (0x1 << 0) // (SPI) SPI Enable +#define AT91C_SPI_SPIDIS (0x1 << 1) // (SPI) SPI Disable +#define AT91C_SPI_SWRST (0x1 << 7) // (SPI) SPI Software reset +#define AT91C_SPI_LASTXFER (0x1 << 24) // (SPI) SPI Last Transfer +// -------- SPI_MR : (SPI Offset: 0x4) SPI Mode Register -------- +#define AT91C_SPI_MSTR (0x1 << 0) // (SPI) Master/Slave Mode +#define AT91C_SPI_PS (0x1 << 1) // (SPI) Peripheral Select +#define AT91C_SPI_PS_FIXED (0x0 << 1) // (SPI) Fixed Peripheral Select +#define AT91C_SPI_PS_VARIABLE (0x1 << 1) // (SPI) Variable Peripheral Select +#define AT91C_SPI_PCSDEC (0x1 << 2) // (SPI) Chip Select Decode +#define AT91C_SPI_FDIV (0x1 << 3) // (SPI) Clock Selection +#define AT91C_SPI_MODFDIS (0x1 << 4) // (SPI) Mode Fault Detection +#define AT91C_SPI_LLB (0x1 << 7) // (SPI) Clock Selection +#define AT91C_SPI_PCS (0xF << 16) // (SPI) Peripheral Chip Select +#define AT91C_SPI_DLYBCS (0xFF << 24) // (SPI) Delay Between Chip Selects +// -------- SPI_RDR : (SPI Offset: 0x8) Receive Data Register -------- +#define AT91C_SPI_RD (0xFFFF << 0) // (SPI) Receive Data +#define AT91C_SPI_RPCS (0xF << 16) // (SPI) Peripheral Chip Select Status +// -------- SPI_TDR : (SPI Offset: 0xc) Transmit Data Register -------- +#define AT91C_SPI_TD (0xFFFF << 0) // (SPI) Transmit Data +#define AT91C_SPI_TPCS (0xF << 16) // (SPI) Peripheral Chip Select Status +// -------- SPI_SR : (SPI Offset: 0x10) Status Register -------- +#define AT91C_SPI_RDRF (0x1 << 0) // (SPI) Receive Data Register Full +#define AT91C_SPI_TDRE (0x1 << 1) // (SPI) Transmit Data Register Empty +#define AT91C_SPI_MODF (0x1 << 2) // (SPI) Mode Fault Error +#define AT91C_SPI_OVRES (0x1 << 3) // (SPI) Overrun Error Status +#define AT91C_SPI_ENDRX (0x1 << 4) // (SPI) End of Receiver Transfer +#define AT91C_SPI_ENDTX (0x1 << 5) // (SPI) End of Receiver Transfer +#define AT91C_SPI_RXBUFF (0x1 << 6) // (SPI) RXBUFF Interrupt +#define AT91C_SPI_TXBUFE (0x1 << 7) // (SPI) TXBUFE Interrupt +#define AT91C_SPI_NSSR (0x1 << 8) // (SPI) NSSR Interrupt +#define AT91C_SPI_TXEMPTY (0x1 << 9) // (SPI) TXEMPTY Interrupt +#define AT91C_SPI_SPIENS (0x1 << 16) // (SPI) Enable Status +// -------- SPI_IER : (SPI Offset: 0x14) Interrupt Enable Register -------- +// -------- SPI_IDR : (SPI Offset: 0x18) Interrupt Disable Register -------- +// -------- SPI_IMR : (SPI Offset: 0x1c) Interrupt Mask Register -------- +// -------- SPI_CSR : (SPI Offset: 0x30) Chip Select Register -------- +#define AT91C_SPI_CPOL (0x1 << 0) // (SPI) Clock Polarity +#define AT91C_SPI_NCPHA (0x1 << 1) // (SPI) Clock Phase +#define AT91C_SPI_CSAAT (0x1 << 3) // (SPI) Chip Select Active After Transfer +#define AT91C_SPI_BITS (0xF << 4) // (SPI) Bits Per Transfer +#define AT91C_SPI_BITS_8 (0x0 << 4) // (SPI) 8 Bits Per transfer +#define AT91C_SPI_BITS_9 (0x1 << 4) // (SPI) 9 Bits Per transfer +#define AT91C_SPI_BITS_10 (0x2 << 4) // (SPI) 10 Bits Per transfer +#define AT91C_SPI_BITS_11 (0x3 << 4) // (SPI) 11 Bits Per transfer +#define AT91C_SPI_BITS_12 (0x4 << 4) // (SPI) 12 Bits Per transfer +#define AT91C_SPI_BITS_13 (0x5 << 4) // (SPI) 13 Bits Per transfer +#define AT91C_SPI_BITS_14 (0x6 << 4) // (SPI) 14 Bits Per transfer +#define AT91C_SPI_BITS_15 (0x7 << 4) // (SPI) 15 Bits Per transfer +#define AT91C_SPI_BITS_16 (0x8 << 4) // (SPI) 16 Bits Per transfer +#define AT91C_SPI_SCBR (0xFF << 8) // (SPI) Serial Clock Baud Rate +#define AT91C_SPI_DLYBS (0xFF << 16) // (SPI) Delay Before SPCK +#define AT91C_SPI_DLYBCT (0xFF << 24) // (SPI) Delay Between Consecutive Transfers + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Usart +// ***************************************************************************** +// *** Register offset in AT91S_USART structure *** +#define US_CR ( 0) // Control Register +#define US_MR ( 4) // Mode Register +#define US_IER ( 8) // Interrupt Enable Register +#define US_IDR (12) // Interrupt Disable Register +#define US_IMR (16) // Interrupt Mask Register +#define US_CSR (20) // Channel Status Register +#define US_RHR (24) // Receiver Holding Register +#define US_THR (28) // Transmitter Holding Register +#define US_BRGR (32) // Baud Rate Generator Register +#define US_RTOR (36) // Receiver Time-out Register +#define US_TTGR (40) // Transmitter Time-guard Register +#define US_FIDI (64) // FI_DI_Ratio Register +#define US_NER (68) // Nb Errors Register +#define US_IF (76) // IRDA_FILTER Register +#define US_RPR (256) // Receive Pointer Register +#define US_RCR (260) // Receive Counter Register +#define US_TPR (264) // Transmit Pointer Register +#define US_TCR (268) // Transmit Counter Register +#define US_RNPR (272) // Receive Next Pointer Register +#define US_RNCR (276) // Receive Next Counter Register +#define US_TNPR (280) // Transmit Next Pointer Register +#define US_TNCR (284) // Transmit Next Counter Register +#define US_PTCR (288) // PDC Transfer Control Register +#define US_PTSR (292) // PDC Transfer Status Register +// -------- US_CR : (USART Offset: 0x0) Debug Unit Control Register -------- +#define AT91C_US_STTBRK (0x1 << 9) // (USART) Start Break +#define AT91C_US_STPBRK (0x1 << 10) // (USART) Stop Break +#define AT91C_US_STTTO (0x1 << 11) // (USART) Start Time-out +#define AT91C_US_SENDA (0x1 << 12) // (USART) Send Address +#define AT91C_US_RSTIT (0x1 << 13) // (USART) Reset Iterations +#define AT91C_US_RSTNACK (0x1 << 14) // (USART) Reset Non Acknowledge +#define AT91C_US_RETTO (0x1 << 15) // (USART) Rearm Time-out +#define AT91C_US_DTREN (0x1 << 16) // (USART) Data Terminal ready Enable +#define AT91C_US_DTRDIS (0x1 << 17) // (USART) Data Terminal ready Disable +#define AT91C_US_RTSEN (0x1 << 18) // (USART) Request to Send enable +#define AT91C_US_RTSDIS (0x1 << 19) // (USART) Request to Send Disable +// -------- US_MR : (USART Offset: 0x4) Debug Unit Mode Register -------- +#define AT91C_US_USMODE (0xF << 0) // (USART) Usart mode +#define AT91C_US_USMODE_NORMAL (0x0) // (USART) Normal +#define AT91C_US_USMODE_RS485 (0x1) // (USART) RS485 +#define AT91C_US_USMODE_HWHSH (0x2) // (USART) Hardware Handshaking +#define AT91C_US_USMODE_MODEM (0x3) // (USART) Modem +#define AT91C_US_USMODE_ISO7816_0 (0x4) // (USART) ISO7816 protocol: T = 0 +#define AT91C_US_USMODE_ISO7816_1 (0x6) // (USART) ISO7816 protocol: T = 1 +#define AT91C_US_USMODE_IRDA (0x8) // (USART) IrDA +#define AT91C_US_USMODE_SWHSH (0xC) // (USART) Software Handshaking +#define AT91C_US_CLKS (0x3 << 4) // (USART) Clock Selection (Baud Rate generator Input Clock +#define AT91C_US_CLKS_CLOCK (0x0 << 4) // (USART) Clock +#define AT91C_US_CLKS_FDIV1 (0x1 << 4) // (USART) fdiv1 +#define AT91C_US_CLKS_SLOW (0x2 << 4) // (USART) slow_clock (ARM) +#define AT91C_US_CLKS_EXT (0x3 << 4) // (USART) External (SCK) +#define AT91C_US_CHRL (0x3 << 6) // (USART) Clock Selection (Baud Rate generator Input Clock +#define AT91C_US_CHRL_5_BITS (0x0 << 6) // (USART) Character Length: 5 bits +#define AT91C_US_CHRL_6_BITS (0x1 << 6) // (USART) Character Length: 6 bits +#define AT91C_US_CHRL_7_BITS (0x2 << 6) // (USART) Character Length: 7 bits +#define AT91C_US_CHRL_8_BITS (0x3 << 6) // (USART) Character Length: 8 bits +#define AT91C_US_SYNC (0x1 << 8) // (USART) Synchronous Mode Select +#define AT91C_US_NBSTOP (0x3 << 12) // (USART) Number of Stop bits +#define AT91C_US_NBSTOP_1_BIT (0x0 << 12) // (USART) 1 stop bit +#define AT91C_US_NBSTOP_15_BIT (0x1 << 12) // (USART) Asynchronous (SYNC=0) 2 stop bits Synchronous (SYNC=1) 2 stop bits +#define AT91C_US_NBSTOP_2_BIT (0x2 << 12) // (USART) 2 stop bits +#define AT91C_US_MSBF (0x1 << 16) // (USART) Bit Order +#define AT91C_US_MODE9 (0x1 << 17) // (USART) 9-bit Character length +#define AT91C_US_CKLO (0x1 << 18) // (USART) Clock Output Select +#define AT91C_US_OVER (0x1 << 19) // (USART) Over Sampling Mode +#define AT91C_US_INACK (0x1 << 20) // (USART) Inhibit Non Acknowledge +#define AT91C_US_DSNACK (0x1 << 21) // (USART) Disable Successive NACK +#define AT91C_US_MAX_ITER (0x1 << 24) // (USART) Number of Repetitions +#define AT91C_US_FILTER (0x1 << 28) // (USART) Receive Line Filter +// -------- US_IER : (USART Offset: 0x8) Debug Unit Interrupt Enable Register -------- +#define AT91C_US_RXBRK (0x1 << 2) // (USART) Break Received/End of Break +#define AT91C_US_TIMEOUT (0x1 << 8) // (USART) Receiver Time-out +#define AT91C_US_ITERATION (0x1 << 10) // (USART) Max number of Repetitions Reached +#define AT91C_US_NACK (0x1 << 13) // (USART) Non Acknowledge +#define AT91C_US_RIIC (0x1 << 16) // (USART) Ring INdicator Input Change Flag +#define AT91C_US_DSRIC (0x1 << 17) // (USART) Data Set Ready Input Change Flag +#define AT91C_US_DCDIC (0x1 << 18) // (USART) Data Carrier Flag +#define AT91C_US_CTSIC (0x1 << 19) // (USART) Clear To Send Input Change Flag +// -------- US_IDR : (USART Offset: 0xc) Debug Unit Interrupt Disable Register -------- +// -------- US_IMR : (USART Offset: 0x10) Debug Unit Interrupt Mask Register -------- +// -------- US_CSR : (USART Offset: 0x14) Debug Unit Channel Status Register -------- +#define AT91C_US_RI (0x1 << 20) // (USART) Image of RI Input +#define AT91C_US_DSR (0x1 << 21) // (USART) Image of DSR Input +#define AT91C_US_DCD (0x1 << 22) // (USART) Image of DCD Input +#define AT91C_US_CTS (0x1 << 23) // (USART) Image of CTS Input + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Synchronous Serial Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_SSC structure *** +#define SSC_CR ( 0) // Control Register +#define SSC_CMR ( 4) // Clock Mode Register +#define SSC_RCMR (16) // Receive Clock ModeRegister +#define SSC_RFMR (20) // Receive Frame Mode Register +#define SSC_TCMR (24) // Transmit Clock Mode Register +#define SSC_TFMR (28) // Transmit Frame Mode Register +#define SSC_RHR (32) // Receive Holding Register +#define SSC_THR (36) // Transmit Holding Register +#define SSC_RSHR (48) // Receive Sync Holding Register +#define SSC_TSHR (52) // Transmit Sync Holding Register +#define SSC_SR (64) // Status Register +#define SSC_IER (68) // Interrupt Enable Register +#define SSC_IDR (72) // Interrupt Disable Register +#define SSC_IMR (76) // Interrupt Mask Register +#define SSC_RPR (256) // Receive Pointer Register +#define SSC_RCR (260) // Receive Counter Register +#define SSC_TPR (264) // Transmit Pointer Register +#define SSC_TCR (268) // Transmit Counter Register +#define SSC_RNPR (272) // Receive Next Pointer Register +#define SSC_RNCR (276) // Receive Next Counter Register +#define SSC_TNPR (280) // Transmit Next Pointer Register +#define SSC_TNCR (284) // Transmit Next Counter Register +#define SSC_PTCR (288) // PDC Transfer Control Register +#define SSC_PTSR (292) // PDC Transfer Status Register +// -------- SSC_CR : (SSC Offset: 0x0) SSC Control Register -------- +#define AT91C_SSC_RXEN (0x1 << 0) // (SSC) Receive Enable +#define AT91C_SSC_RXDIS (0x1 << 1) // (SSC) Receive Disable +#define AT91C_SSC_TXEN (0x1 << 8) // (SSC) Transmit Enable +#define AT91C_SSC_TXDIS (0x1 << 9) // (SSC) Transmit Disable +#define AT91C_SSC_SWRST (0x1 << 15) // (SSC) Software Reset +// -------- SSC_RCMR : (SSC Offset: 0x10) SSC Receive Clock Mode Register -------- +#define AT91C_SSC_CKS (0x3 << 0) // (SSC) Receive/Transmit Clock Selection +#define AT91C_SSC_CKS_DIV (0x0) // (SSC) Divided Clock +#define AT91C_SSC_CKS_TK (0x1) // (SSC) TK Clock signal +#define AT91C_SSC_CKS_RK (0x2) // (SSC) RK pin +#define AT91C_SSC_CKO (0x7 << 2) // (SSC) Receive/Transmit Clock Output Mode Selection +#define AT91C_SSC_CKO_NONE (0x0 << 2) // (SSC) Receive/Transmit Clock Output Mode: None RK pin: Input-only +#define AT91C_SSC_CKO_CONTINOUS (0x1 << 2) // (SSC) Continuous Receive/Transmit Clock RK pin: Output +#define AT91C_SSC_CKO_DATA_TX (0x2 << 2) // (SSC) Receive/Transmit Clock only during data transfers RK pin: Output +#define AT91C_SSC_CKI (0x1 << 5) // (SSC) Receive/Transmit Clock Inversion +#define AT91C_SSC_CKG (0x3 << 6) // (SSC) Receive/Transmit Clock Gating Selection +#define AT91C_SSC_CKG_NONE (0x0 << 6) // (SSC) Receive/Transmit Clock Gating: None, continuous clock +#define AT91C_SSC_CKG_LOW (0x1 << 6) // (SSC) Receive/Transmit Clock enabled only if RF Low +#define AT91C_SSC_CKG_HIGH (0x2 << 6) // (SSC) Receive/Transmit Clock enabled only if RF High +#define AT91C_SSC_START (0xF << 8) // (SSC) Receive/Transmit Start Selection +#define AT91C_SSC_START_CONTINOUS (0x0 << 8) // (SSC) Continuous, as soon as the receiver is enabled, and immediately after the end of transfer of the previous data. +#define AT91C_SSC_START_TX (0x1 << 8) // (SSC) Transmit/Receive start +#define AT91C_SSC_START_LOW_RF (0x2 << 8) // (SSC) Detection of a low level on RF input +#define AT91C_SSC_START_HIGH_RF (0x3 << 8) // (SSC) Detection of a high level on RF input +#define AT91C_SSC_START_FALL_RF (0x4 << 8) // (SSC) Detection of a falling edge on RF input +#define AT91C_SSC_START_RISE_RF (0x5 << 8) // (SSC) Detection of a rising edge on RF input +#define AT91C_SSC_START_LEVEL_RF (0x6 << 8) // (SSC) Detection of any level change on RF input +#define AT91C_SSC_START_EDGE_RF (0x7 << 8) // (SSC) Detection of any edge on RF input +#define AT91C_SSC_START_0 (0x8 << 8) // (SSC) Compare 0 +#define AT91C_SSC_STOP (0x1 << 12) // (SSC) Receive Stop Selection +#define AT91C_SSC_STTDLY (0xFF << 16) // (SSC) Receive/Transmit Start Delay +#define AT91C_SSC_PERIOD (0xFF << 24) // (SSC) Receive/Transmit Period Divider Selection +// -------- SSC_RFMR : (SSC Offset: 0x14) SSC Receive Frame Mode Register -------- +#define AT91C_SSC_DATLEN (0x1F << 0) // (SSC) Data Length +#define AT91C_SSC_LOOP (0x1 << 5) // (SSC) Loop Mode +#define AT91C_SSC_MSBF (0x1 << 7) // (SSC) Most Significant Bit First +#define AT91C_SSC_DATNB (0xF << 8) // (SSC) Data Number per Frame +#define AT91C_SSC_FSLEN (0xF << 16) // (SSC) Receive/Transmit Frame Sync length +#define AT91C_SSC_FSOS (0x7 << 20) // (SSC) Receive/Transmit Frame Sync Output Selection +#define AT91C_SSC_FSOS_NONE (0x0 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: None RK pin Input-only +#define AT91C_SSC_FSOS_NEGATIVE (0x1 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Negative Pulse +#define AT91C_SSC_FSOS_POSITIVE (0x2 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Positive Pulse +#define AT91C_SSC_FSOS_LOW (0x3 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Driver Low during data transfer +#define AT91C_SSC_FSOS_HIGH (0x4 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Driver High during data transfer +#define AT91C_SSC_FSOS_TOGGLE (0x5 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Toggling at each start of data transfer +#define AT91C_SSC_FSEDGE (0x1 << 24) // (SSC) Frame Sync Edge Detection +// -------- SSC_TCMR : (SSC Offset: 0x18) SSC Transmit Clock Mode Register -------- +// -------- SSC_TFMR : (SSC Offset: 0x1c) SSC Transmit Frame Mode Register -------- +#define AT91C_SSC_DATDEF (0x1 << 5) // (SSC) Data Default Value +#define AT91C_SSC_FSDEN (0x1 << 23) // (SSC) Frame Sync Data Enable +// -------- SSC_SR : (SSC Offset: 0x40) SSC Status Register -------- +#define AT91C_SSC_TXRDY (0x1 << 0) // (SSC) Transmit Ready +#define AT91C_SSC_TXEMPTY (0x1 << 1) // (SSC) Transmit Empty +#define AT91C_SSC_ENDTX (0x1 << 2) // (SSC) End Of Transmission +#define AT91C_SSC_TXBUFE (0x1 << 3) // (SSC) Transmit Buffer Empty +#define AT91C_SSC_RXRDY (0x1 << 4) // (SSC) Receive Ready +#define AT91C_SSC_OVRUN (0x1 << 5) // (SSC) Receive Overrun +#define AT91C_SSC_ENDRX (0x1 << 6) // (SSC) End of Reception +#define AT91C_SSC_RXBUFF (0x1 << 7) // (SSC) Receive Buffer Full +#define AT91C_SSC_CP0 (0x1 << 8) // (SSC) Compare 0 +#define AT91C_SSC_CP1 (0x1 << 9) // (SSC) Compare 1 +#define AT91C_SSC_TXSYN (0x1 << 10) // (SSC) Transmit Sync +#define AT91C_SSC_RXSYN (0x1 << 11) // (SSC) Receive Sync +#define AT91C_SSC_TXENA (0x1 << 16) // (SSC) Transmit Enable +#define AT91C_SSC_RXENA (0x1 << 17) // (SSC) Receive Enable +// -------- SSC_IER : (SSC Offset: 0x44) SSC Interrupt Enable Register -------- +// -------- SSC_IDR : (SSC Offset: 0x48) SSC Interrupt Disable Register -------- +// -------- SSC_IMR : (SSC Offset: 0x4c) SSC Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Two-wire Interface +// ***************************************************************************** +// *** Register offset in AT91S_TWI structure *** +#define TWI_CR ( 0) // Control Register +#define TWI_MMR ( 4) // Master Mode Register +#define TWI_IADR (12) // Internal Address Register +#define TWI_CWGR (16) // Clock Waveform Generator Register +#define TWI_SR (32) // Status Register +#define TWI_IER (36) // Interrupt Enable Register +#define TWI_IDR (40) // Interrupt Disable Register +#define TWI_IMR (44) // Interrupt Mask Register +#define TWI_RHR (48) // Receive Holding Register +#define TWI_THR (52) // Transmit Holding Register +// -------- TWI_CR : (TWI Offset: 0x0) TWI Control Register -------- +#define AT91C_TWI_START (0x1 << 0) // (TWI) Send a START Condition +#define AT91C_TWI_STOP (0x1 << 1) // (TWI) Send a STOP Condition +#define AT91C_TWI_MSEN (0x1 << 2) // (TWI) TWI Master Transfer Enabled +#define AT91C_TWI_MSDIS (0x1 << 3) // (TWI) TWI Master Transfer Disabled +#define AT91C_TWI_SWRST (0x1 << 7) // (TWI) Software Reset +// -------- TWI_MMR : (TWI Offset: 0x4) TWI Master Mode Register -------- +#define AT91C_TWI_IADRSZ (0x3 << 8) // (TWI) Internal Device Address Size +#define AT91C_TWI_IADRSZ_NO (0x0 << 8) // (TWI) No internal device address +#define AT91C_TWI_IADRSZ_1_BYTE (0x1 << 8) // (TWI) One-byte internal device address +#define AT91C_TWI_IADRSZ_2_BYTE (0x2 << 8) // (TWI) Two-byte internal device address +#define AT91C_TWI_IADRSZ_3_BYTE (0x3 << 8) // (TWI) Three-byte internal device address +#define AT91C_TWI_MREAD (0x1 << 12) // (TWI) Master Read Direction +#define AT91C_TWI_DADR (0x7F << 16) // (TWI) Device Address +// -------- TWI_CWGR : (TWI Offset: 0x10) TWI Clock Waveform Generator Register -------- +#define AT91C_TWI_CLDIV (0xFF << 0) // (TWI) Clock Low Divider +#define AT91C_TWI_CHDIV (0xFF << 8) // (TWI) Clock High Divider +#define AT91C_TWI_CKDIV (0x7 << 16) // (TWI) Clock Divider +// -------- TWI_SR : (TWI Offset: 0x20) TWI Status Register -------- +#define AT91C_TWI_TXCOMP (0x1 << 0) // (TWI) Transmission Completed +#define AT91C_TWI_RXRDY (0x1 << 1) // (TWI) Receive holding register ReaDY +#define AT91C_TWI_TXRDY (0x1 << 2) // (TWI) Transmit holding register ReaDY +#define AT91C_TWI_OVRE (0x1 << 6) // (TWI) Overrun Error +#define AT91C_TWI_UNRE (0x1 << 7) // (TWI) Underrun Error +#define AT91C_TWI_NACK (0x1 << 8) // (TWI) Not Acknowledged +// -------- TWI_IER : (TWI Offset: 0x24) TWI Interrupt Enable Register -------- +// -------- TWI_IDR : (TWI Offset: 0x28) TWI Interrupt Disable Register -------- +// -------- TWI_IMR : (TWI Offset: 0x2c) TWI Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR PWMC Channel Interface +// ***************************************************************************** +// *** Register offset in AT91S_PWMC_CH structure *** +#define PWMC_CMR ( 0) // Channel Mode Register +#define PWMC_CDTYR ( 4) // Channel Duty Cycle Register +#define PWMC_CPRDR ( 8) // Channel Period Register +#define PWMC_CCNTR (12) // Channel Counter Register +#define PWMC_CUPDR (16) // Channel Update Register +#define PWMC_Reserved (20) // Reserved +// -------- PWMC_CMR : (PWMC_CH Offset: 0x0) PWMC Channel Mode Register -------- +#define AT91C_PWMC_CPRE (0xF << 0) // (PWMC_CH) Channel Pre-scaler : PWMC_CLKx +#define AT91C_PWMC_CPRE_MCK (0x0) // (PWMC_CH) +#define AT91C_PWMC_CPRE_MCKA (0xB) // (PWMC_CH) +#define AT91C_PWMC_CPRE_MCKB (0xC) // (PWMC_CH) +#define AT91C_PWMC_CALG (0x1 << 8) // (PWMC_CH) Channel Alignment +#define AT91C_PWMC_CPOL (0x1 << 9) // (PWMC_CH) Channel Polarity +#define AT91C_PWMC_CPD (0x1 << 10) // (PWMC_CH) Channel Update Period +// -------- PWMC_CDTYR : (PWMC_CH Offset: 0x4) PWMC Channel Duty Cycle Register -------- +#define AT91C_PWMC_CDTY (0x0 << 0) // (PWMC_CH) Channel Duty Cycle +// -------- PWMC_CPRDR : (PWMC_CH Offset: 0x8) PWMC Channel Period Register -------- +#define AT91C_PWMC_CPRD (0x0 << 0) // (PWMC_CH) Channel Period +// -------- PWMC_CCNTR : (PWMC_CH Offset: 0xc) PWMC Channel Counter Register -------- +#define AT91C_PWMC_CCNT (0x0 << 0) // (PWMC_CH) Channel Counter +// -------- PWMC_CUPDR : (PWMC_CH Offset: 0x10) PWMC Channel Update Register -------- +#define AT91C_PWMC_CUPD (0x0 << 0) // (PWMC_CH) Channel Update + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Pulse Width Modulation Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_PWMC structure *** +#define PWMC_MR ( 0) // PWMC Mode Register +#define PWMC_ENA ( 4) // PWMC Enable Register +#define PWMC_DIS ( 8) // PWMC Disable Register +#define PWMC_SR (12) // PWMC Status Register +#define PWMC_IER (16) // PWMC Interrupt Enable Register +#define PWMC_IDR (20) // PWMC Interrupt Disable Register +#define PWMC_IMR (24) // PWMC Interrupt Mask Register +#define PWMC_ISR (28) // PWMC Interrupt Status Register +#define PWMC_VR (252) // PWMC Version Register +#define PWMC_CH (512) // PWMC Channel +// -------- PWMC_MR : (PWMC Offset: 0x0) PWMC Mode Register -------- +#define AT91C_PWMC_DIVA (0xFF << 0) // (PWMC) CLKA divide factor. +#define AT91C_PWMC_PREA (0xF << 8) // (PWMC) Divider Input Clock Prescaler A +#define AT91C_PWMC_PREA_MCK (0x0 << 8) // (PWMC) +#define AT91C_PWMC_DIVB (0xFF << 16) // (PWMC) CLKB divide factor. +#define AT91C_PWMC_PREB (0xF << 24) // (PWMC) Divider Input Clock Prescaler B +#define AT91C_PWMC_PREB_MCK (0x0 << 24) // (PWMC) +// -------- PWMC_ENA : (PWMC Offset: 0x4) PWMC Enable Register -------- +#define AT91C_PWMC_CHID0 (0x1 << 0) // (PWMC) Channel ID 0 +#define AT91C_PWMC_CHID1 (0x1 << 1) // (PWMC) Channel ID 1 +#define AT91C_PWMC_CHID2 (0x1 << 2) // (PWMC) Channel ID 2 +#define AT91C_PWMC_CHID3 (0x1 << 3) // (PWMC) Channel ID 3 +// -------- PWMC_DIS : (PWMC Offset: 0x8) PWMC Disable Register -------- +// -------- PWMC_SR : (PWMC Offset: 0xc) PWMC Status Register -------- +// -------- PWMC_IER : (PWMC Offset: 0x10) PWMC Interrupt Enable Register -------- +// -------- PWMC_IDR : (PWMC Offset: 0x14) PWMC Interrupt Disable Register -------- +// -------- PWMC_IMR : (PWMC Offset: 0x18) PWMC Interrupt Mask Register -------- +// -------- PWMC_ISR : (PWMC Offset: 0x1c) PWMC Interrupt Status Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR USB Device Interface +// ***************************************************************************** +// *** Register offset in AT91S_UDP structure *** +#define UDP_NUM ( 0) // Frame Number Register +#define UDP_GLBSTATE ( 4) // Global State Register +#define UDP_FADDR ( 8) // Function Address Register +#define UDP_IER (16) // Interrupt Enable Register +#define UDP_IDR (20) // Interrupt Disable Register +#define UDP_IMR (24) // Interrupt Mask Register +#define UDP_ISR (28) // Interrupt Status Register +#define UDP_ICR (32) // Interrupt Clear Register +#define UDP_RSTEP (40) // Reset Endpoint Register +#define UDP_CSR (48) // Endpoint Control and Status Register +#define UDP_FDR (80) // Endpoint FIFO Data Register +#define UDP_TXVC (116) // Transceiver Control Register +// -------- UDP_FRM_NUM : (UDP Offset: 0x0) USB Frame Number Register -------- +#define AT91C_UDP_FRM_NUM (0x7FF << 0) // (UDP) Frame Number as Defined in the Packet Field Formats +#define AT91C_UDP_FRM_ERR (0x1 << 16) // (UDP) Frame Error +#define AT91C_UDP_FRM_OK (0x1 << 17) // (UDP) Frame OK +// -------- UDP_GLB_STATE : (UDP Offset: 0x4) USB Global State Register -------- +#define AT91C_UDP_FADDEN (0x1 << 0) // (UDP) Function Address Enable +#define AT91C_UDP_CONFG (0x1 << 1) // (UDP) Configured +#define AT91C_UDP_ESR (0x1 << 2) // (UDP) Enable Send Resume +#define AT91C_UDP_RSMINPR (0x1 << 3) // (UDP) A Resume Has Been Sent to the Host +#define AT91C_UDP_RMWUPE (0x1 << 4) // (UDP) Remote Wake Up Enable +// -------- UDP_FADDR : (UDP Offset: 0x8) USB Function Address Register -------- +#define AT91C_UDP_FADD (0xFF << 0) // (UDP) Function Address Value +#define AT91C_UDP_FEN (0x1 << 8) // (UDP) Function Enable +// -------- UDP_IER : (UDP Offset: 0x10) USB Interrupt Enable Register -------- +#define AT91C_UDP_EPINT0 (0x1 << 0) // (UDP) Endpoint 0 Interrupt +#define AT91C_UDP_EPINT1 (0x1 << 1) // (UDP) Endpoint 0 Interrupt +#define AT91C_UDP_EPINT2 (0x1 << 2) // (UDP) Endpoint 2 Interrupt +#define AT91C_UDP_EPINT3 (0x1 << 3) // (UDP) Endpoint 3 Interrupt +#define AT91C_UDP_EPINT4 (0x1 << 4) // (UDP) Endpoint 4 Interrupt +#define AT91C_UDP_EPINT5 (0x1 << 5) // (UDP) Endpoint 5 Interrupt +#define AT91C_UDP_RXSUSP (0x1 << 8) // (UDP) USB Suspend Interrupt +#define AT91C_UDP_RXRSM (0x1 << 9) // (UDP) USB Resume Interrupt +#define AT91C_UDP_EXTRSM (0x1 << 10) // (UDP) USB External Resume Interrupt +#define AT91C_UDP_SOFINT (0x1 << 11) // (UDP) USB Start Of frame Interrupt +#define AT91C_UDP_WAKEUP (0x1 << 13) // (UDP) USB Resume Interrupt +// -------- UDP_IDR : (UDP Offset: 0x14) USB Interrupt Disable Register -------- +// -------- UDP_IMR : (UDP Offset: 0x18) USB Interrupt Mask Register -------- +// -------- UDP_ISR : (UDP Offset: 0x1c) USB Interrupt Status Register -------- +#define AT91C_UDP_ENDBUSRES (0x1 << 12) // (UDP) USB End Of Bus Reset Interrupt +// -------- UDP_ICR : (UDP Offset: 0x20) USB Interrupt Clear Register -------- +// -------- UDP_RST_EP : (UDP Offset: 0x28) USB Reset Endpoint Register -------- +#define AT91C_UDP_EP0 (0x1 << 0) // (UDP) Reset Endpoint 0 +#define AT91C_UDP_EP1 (0x1 << 1) // (UDP) Reset Endpoint 1 +#define AT91C_UDP_EP2 (0x1 << 2) // (UDP) Reset Endpoint 2 +#define AT91C_UDP_EP3 (0x1 << 3) // (UDP) Reset Endpoint 3 +#define AT91C_UDP_EP4 (0x1 << 4) // (UDP) Reset Endpoint 4 +#define AT91C_UDP_EP5 (0x1 << 5) // (UDP) Reset Endpoint 5 +// -------- UDP_CSR : (UDP Offset: 0x30) USB Endpoint Control and Status Register -------- +#define AT91C_UDP_TXCOMP (0x1 << 0) // (UDP) Generates an IN packet with data previously written in the DPR +#define AT91C_UDP_RX_DATA_BK0 (0x1 << 1) // (UDP) Receive Data Bank 0 +#define AT91C_UDP_RXSETUP (0x1 << 2) // (UDP) Sends STALL to the Host (Control endpoints) +#define AT91C_UDP_ISOERROR (0x1 << 3) // (UDP) Isochronous error (Isochronous endpoints) +#define AT91C_UDP_TXPKTRDY (0x1 << 4) // (UDP) Transmit Packet Ready +#define AT91C_UDP_FORCESTALL (0x1 << 5) // (UDP) Force Stall (used by Control, Bulk and Isochronous endpoints). +#define AT91C_UDP_RX_DATA_BK1 (0x1 << 6) // (UDP) Receive Data Bank 1 (only used by endpoints with ping-pong attributes). +#define AT91C_UDP_DIR (0x1 << 7) // (UDP) Transfer Direction +#define AT91C_UDP_EPTYPE (0x7 << 8) // (UDP) Endpoint type +#define AT91C_UDP_EPTYPE_CTRL (0x0 << 8) // (UDP) Control +#define AT91C_UDP_EPTYPE_ISO_OUT (0x1 << 8) // (UDP) Isochronous OUT +#define AT91C_UDP_EPTYPE_BULK_OUT (0x2 << 8) // (UDP) Bulk OUT +#define AT91C_UDP_EPTYPE_INT_OUT (0x3 << 8) // (UDP) Interrupt OUT +#define AT91C_UDP_EPTYPE_ISO_IN (0x5 << 8) // (UDP) Isochronous IN +#define AT91C_UDP_EPTYPE_BULK_IN (0x6 << 8) // (UDP) Bulk IN +#define AT91C_UDP_EPTYPE_INT_IN (0x7 << 8) // (UDP) Interrupt IN +#define AT91C_UDP_DTGLE (0x1 << 11) // (UDP) Data Toggle +#define AT91C_UDP_EPEDS (0x1 << 15) // (UDP) Endpoint Enable Disable +#define AT91C_UDP_RXBYTECNT (0x7FF << 16) // (UDP) Number Of Bytes Available in the FIFO +// -------- UDP_TXVC : (UDP Offset: 0x74) Transceiver Control Register -------- +#define AT91C_UDP_TXVDIS (0x1 << 8) // (UDP) +#define AT91C_UDP_PUON (0x1 << 9) // (UDP) Pull-up ON + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Timer Counter Channel Interface +// ***************************************************************************** +// *** Register offset in AT91S_TC structure *** +#define TC_CCR ( 0) // Channel Control Register +#define TC_CMR ( 4) // Channel Mode Register (Capture Mode / Waveform Mode) +#define TC_CV (16) // Counter Value +#define TC_RA (20) // Register A +#define TC_RB (24) // Register B +#define TC_RC (28) // Register C +#define TC_SR (32) // Status Register +#define TC_IER (36) // Interrupt Enable Register +#define TC_IDR (40) // Interrupt Disable Register +#define TC_IMR (44) // Interrupt Mask Register +// -------- TC_CCR : (TC Offset: 0x0) TC Channel Control Register -------- +#define AT91C_TC_CLKEN (0x1 << 0) // (TC) Counter Clock Enable Command +#define AT91C_TC_CLKDIS (0x1 << 1) // (TC) Counter Clock Disable Command +#define AT91C_TC_SWTRG (0x1 << 2) // (TC) Software Trigger Command +// -------- TC_CMR : (TC Offset: 0x4) TC Channel Mode Register: Capture Mode / Waveform Mode -------- +#define AT91C_TC_CLKS (0x7 << 0) // (TC) Clock Selection +#define AT91C_TC_CLKS_TIMER_DIV1_CLOCK (0x0) // (TC) Clock selected: TIMER_DIV1_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV2_CLOCK (0x1) // (TC) Clock selected: TIMER_DIV2_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV3_CLOCK (0x2) // (TC) Clock selected: TIMER_DIV3_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV4_CLOCK (0x3) // (TC) Clock selected: TIMER_DIV4_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV5_CLOCK (0x4) // (TC) Clock selected: TIMER_DIV5_CLOCK +#define AT91C_TC_CLKS_XC0 (0x5) // (TC) Clock selected: XC0 +#define AT91C_TC_CLKS_XC1 (0x6) // (TC) Clock selected: XC1 +#define AT91C_TC_CLKS_XC2 (0x7) // (TC) Clock selected: XC2 +#define AT91C_TC_CLKI (0x1 << 3) // (TC) Clock Invert +#define AT91C_TC_BURST (0x3 << 4) // (TC) Burst Signal Selection +#define AT91C_TC_BURST_NONE (0x0 << 4) // (TC) The clock is not gated by an external signal +#define AT91C_TC_BURST_XC0 (0x1 << 4) // (TC) XC0 is ANDed with the selected clock +#define AT91C_TC_BURST_XC1 (0x2 << 4) // (TC) XC1 is ANDed with the selected clock +#define AT91C_TC_BURST_XC2 (0x3 << 4) // (TC) XC2 is ANDed with the selected clock +#define AT91C_TC_CPCSTOP (0x1 << 6) // (TC) Counter Clock Stopped with RC Compare +#define AT91C_TC_LDBSTOP (0x1 << 6) // (TC) Counter Clock Stopped with RB Loading +#define AT91C_TC_CPCDIS (0x1 << 7) // (TC) Counter Clock Disable with RC Compare +#define AT91C_TC_LDBDIS (0x1 << 7) // (TC) Counter Clock Disabled with RB Loading +#define AT91C_TC_ETRGEDG (0x3 << 8) // (TC) External Trigger Edge Selection +#define AT91C_TC_ETRGEDG_NONE (0x0 << 8) // (TC) Edge: None +#define AT91C_TC_ETRGEDG_RISING (0x1 << 8) // (TC) Edge: rising edge +#define AT91C_TC_ETRGEDG_FALLING (0x2 << 8) // (TC) Edge: falling edge +#define AT91C_TC_ETRGEDG_BOTH (0x3 << 8) // (TC) Edge: each edge +#define AT91C_TC_EEVTEDG (0x3 << 8) // (TC) External Event Edge Selection +#define AT91C_TC_EEVTEDG_NONE (0x0 << 8) // (TC) Edge: None +#define AT91C_TC_EEVTEDG_RISING (0x1 << 8) // (TC) Edge: rising edge +#define AT91C_TC_EEVTEDG_FALLING (0x2 << 8) // (TC) Edge: falling edge +#define AT91C_TC_EEVTEDG_BOTH (0x3 << 8) // (TC) Edge: each edge +#define AT91C_TC_EEVT (0x3 << 10) // (TC) External Event Selection +#define AT91C_TC_EEVT_TIOB (0x0 << 10) // (TC) Signal selected as external event: TIOB TIOB direction: input +#define AT91C_TC_EEVT_XC0 (0x1 << 10) // (TC) Signal selected as external event: XC0 TIOB direction: output +#define AT91C_TC_EEVT_XC1 (0x2 << 10) // (TC) Signal selected as external event: XC1 TIOB direction: output +#define AT91C_TC_EEVT_XC2 (0x3 << 10) // (TC) Signal selected as external event: XC2 TIOB direction: output +#define AT91C_TC_ABETRG (0x1 << 10) // (TC) TIOA or TIOB External Trigger Selection +#define AT91C_TC_ENETRG (0x1 << 12) // (TC) External Event Trigger enable +#define AT91C_TC_WAVESEL (0x3 << 13) // (TC) Waveform Selection +#define AT91C_TC_WAVESEL_UP (0x0 << 13) // (TC) UP mode without atomatic trigger on RC Compare +#define AT91C_TC_WAVESEL_UPDOWN (0x1 << 13) // (TC) UPDOWN mode without automatic trigger on RC Compare +#define AT91C_TC_WAVESEL_UP_AUTO (0x2 << 13) // (TC) UP mode with automatic trigger on RC Compare +#define AT91C_TC_WAVESEL_UPDOWN_AUTO (0x3 << 13) // (TC) UPDOWN mode with automatic trigger on RC Compare +#define AT91C_TC_CPCTRG (0x1 << 14) // (TC) RC Compare Trigger Enable +#define AT91C_TC_WAVE (0x1 << 15) // (TC) +#define AT91C_TC_ACPA (0x3 << 16) // (TC) RA Compare Effect on TIOA +#define AT91C_TC_ACPA_NONE (0x0 << 16) // (TC) Effect: none +#define AT91C_TC_ACPA_SET (0x1 << 16) // (TC) Effect: set +#define AT91C_TC_ACPA_CLEAR (0x2 << 16) // (TC) Effect: clear +#define AT91C_TC_ACPA_TOGGLE (0x3 << 16) // (TC) Effect: toggle +#define AT91C_TC_LDRA (0x3 << 16) // (TC) RA Loading Selection +#define AT91C_TC_LDRA_NONE (0x0 << 16) // (TC) Edge: None +#define AT91C_TC_LDRA_RISING (0x1 << 16) // (TC) Edge: rising edge of TIOA +#define AT91C_TC_LDRA_FALLING (0x2 << 16) // (TC) Edge: falling edge of TIOA +#define AT91C_TC_LDRA_BOTH (0x3 << 16) // (TC) Edge: each edge of TIOA +#define AT91C_TC_ACPC (0x3 << 18) // (TC) RC Compare Effect on TIOA +#define AT91C_TC_ACPC_NONE (0x0 << 18) // (TC) Effect: none +#define AT91C_TC_ACPC_SET (0x1 << 18) // (TC) Effect: set +#define AT91C_TC_ACPC_CLEAR (0x2 << 18) // (TC) Effect: clear +#define AT91C_TC_ACPC_TOGGLE (0x3 << 18) // (TC) Effect: toggle +#define AT91C_TC_LDRB (0x3 << 18) // (TC) RB Loading Selection +#define AT91C_TC_LDRB_NONE (0x0 << 18) // (TC) Edge: None +#define AT91C_TC_LDRB_RISING (0x1 << 18) // (TC) Edge: rising edge of TIOA +#define AT91C_TC_LDRB_FALLING (0x2 << 18) // (TC) Edge: falling edge of TIOA +#define AT91C_TC_LDRB_BOTH (0x3 << 18) // (TC) Edge: each edge of TIOA +#define AT91C_TC_AEEVT (0x3 << 20) // (TC) External Event Effect on TIOA +#define AT91C_TC_AEEVT_NONE (0x0 << 20) // (TC) Effect: none +#define AT91C_TC_AEEVT_SET (0x1 << 20) // (TC) Effect: set +#define AT91C_TC_AEEVT_CLEAR (0x2 << 20) // (TC) Effect: clear +#define AT91C_TC_AEEVT_TOGGLE (0x3 << 20) // (TC) Effect: toggle +#define AT91C_TC_ASWTRG (0x3 << 22) // (TC) Software Trigger Effect on TIOA +#define AT91C_TC_ASWTRG_NONE (0x0 << 22) // (TC) Effect: none +#define AT91C_TC_ASWTRG_SET (0x1 << 22) // (TC) Effect: set +#define AT91C_TC_ASWTRG_CLEAR (0x2 << 22) // (TC) Effect: clear +#define AT91C_TC_ASWTRG_TOGGLE (0x3 << 22) // (TC) Effect: toggle +#define AT91C_TC_BCPB (0x3 << 24) // (TC) RB Compare Effect on TIOB +#define AT91C_TC_BCPB_NONE (0x0 << 24) // (TC) Effect: none +#define AT91C_TC_BCPB_SET (0x1 << 24) // (TC) Effect: set +#define AT91C_TC_BCPB_CLEAR (0x2 << 24) // (TC) Effect: clear +#define AT91C_TC_BCPB_TOGGLE (0x3 << 24) // (TC) Effect: toggle +#define AT91C_TC_BCPC (0x3 << 26) // (TC) RC Compare Effect on TIOB +#define AT91C_TC_BCPC_NONE (0x0 << 26) // (TC) Effect: none +#define AT91C_TC_BCPC_SET (0x1 << 26) // (TC) Effect: set +#define AT91C_TC_BCPC_CLEAR (0x2 << 26) // (TC) Effect: clear +#define AT91C_TC_BCPC_TOGGLE (0x3 << 26) // (TC) Effect: toggle +#define AT91C_TC_BEEVT (0x3 << 28) // (TC) External Event Effect on TIOB +#define AT91C_TC_BEEVT_NONE (0x0 << 28) // (TC) Effect: none +#define AT91C_TC_BEEVT_SET (0x1 << 28) // (TC) Effect: set +#define AT91C_TC_BEEVT_CLEAR (0x2 << 28) // (TC) Effect: clear +#define AT91C_TC_BEEVT_TOGGLE (0x3 << 28) // (TC) Effect: toggle +#define AT91C_TC_BSWTRG (0x3 << 30) // (TC) Software Trigger Effect on TIOB +#define AT91C_TC_BSWTRG_NONE (0x0 << 30) // (TC) Effect: none +#define AT91C_TC_BSWTRG_SET (0x1 << 30) // (TC) Effect: set +#define AT91C_TC_BSWTRG_CLEAR (0x2 << 30) // (TC) Effect: clear +#define AT91C_TC_BSWTRG_TOGGLE (0x3 << 30) // (TC) Effect: toggle +// -------- TC_SR : (TC Offset: 0x20) TC Channel Status Register -------- +#define AT91C_TC_COVFS (0x1 << 0) // (TC) Counter Overflow +#define AT91C_TC_LOVRS (0x1 << 1) // (TC) Load Overrun +#define AT91C_TC_CPAS (0x1 << 2) // (TC) RA Compare +#define AT91C_TC_CPBS (0x1 << 3) // (TC) RB Compare +#define AT91C_TC_CPCS (0x1 << 4) // (TC) RC Compare +#define AT91C_TC_LDRAS (0x1 << 5) // (TC) RA Loading +#define AT91C_TC_LDRBS (0x1 << 6) // (TC) RB Loading +#define AT91C_TC_ETRGS (0x1 << 7) // (TC) External Trigger +#define AT91C_TC_CLKSTA (0x1 << 16) // (TC) Clock Enabling +#define AT91C_TC_MTIOA (0x1 << 17) // (TC) TIOA Mirror +#define AT91C_TC_MTIOB (0x1 << 18) // (TC) TIOA Mirror +// -------- TC_IER : (TC Offset: 0x24) TC Channel Interrupt Enable Register -------- +// -------- TC_IDR : (TC Offset: 0x28) TC Channel Interrupt Disable Register -------- +// -------- TC_IMR : (TC Offset: 0x2c) TC Channel Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Timer Counter Interface +// ***************************************************************************** +// *** Register offset in AT91S_TCB structure *** +#define TCB_TC0 ( 0) // TC Channel 0 +#define TCB_TC1 (64) // TC Channel 1 +#define TCB_TC2 (128) // TC Channel 2 +#define TCB_BCR (192) // TC Block Control Register +#define TCB_BMR (196) // TC Block Mode Register +// -------- TCB_BCR : (TCB Offset: 0xc0) TC Block Control Register -------- +#define AT91C_TCB_SYNC (0x1 << 0) // (TCB) Synchro Command +// -------- TCB_BMR : (TCB Offset: 0xc4) TC Block Mode Register -------- +#define AT91C_TCB_TC0XC0S (0x3 << 0) // (TCB) External Clock Signal 0 Selection +#define AT91C_TCB_TC0XC0S_TCLK0 (0x0) // (TCB) TCLK0 connected to XC0 +#define AT91C_TCB_TC0XC0S_NONE (0x1) // (TCB) None signal connected to XC0 +#define AT91C_TCB_TC0XC0S_TIOA1 (0x2) // (TCB) TIOA1 connected to XC0 +#define AT91C_TCB_TC0XC0S_TIOA2 (0x3) // (TCB) TIOA2 connected to XC0 +#define AT91C_TCB_TC1XC1S (0x3 << 2) // (TCB) External Clock Signal 1 Selection +#define AT91C_TCB_TC1XC1S_TCLK1 (0x0 << 2) // (TCB) TCLK1 connected to XC1 +#define AT91C_TCB_TC1XC1S_NONE (0x1 << 2) // (TCB) None signal connected to XC1 +#define AT91C_TCB_TC1XC1S_TIOA0 (0x2 << 2) // (TCB) TIOA0 connected to XC1 +#define AT91C_TCB_TC1XC1S_TIOA2 (0x3 << 2) // (TCB) TIOA2 connected to XC1 +#define AT91C_TCB_TC2XC2S (0x3 << 4) // (TCB) External Clock Signal 2 Selection +#define AT91C_TCB_TC2XC2S_TCLK2 (0x0 << 4) // (TCB) TCLK2 connected to XC2 +#define AT91C_TCB_TC2XC2S_NONE (0x1 << 4) // (TCB) None signal connected to XC2 +#define AT91C_TCB_TC2XC2S_TIOA0 (0x2 << 4) // (TCB) TIOA0 connected to XC2 +#define AT91C_TCB_TC2XC2S_TIOA1 (0x3 << 4) // (TCB) TIOA2 connected to XC2 + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Control Area Network MailBox Interface +// ***************************************************************************** +// *** Register offset in AT91S_CAN_MB structure *** +#define CAN_MB_MMR ( 0) // MailBox Mode Register +#define CAN_MB_MAM ( 4) // MailBox Acceptance Mask Register +#define CAN_MB_MID ( 8) // MailBox ID Register +#define CAN_MB_MFID (12) // MailBox Family ID Register +#define CAN_MB_MSR (16) // MailBox Status Register +#define CAN_MB_MDL (20) // MailBox Data Low Register +#define CAN_MB_MDH (24) // MailBox Data High Register +#define CAN_MB_MCR (28) // MailBox Control Register +// -------- CAN_MMR : (CAN_MB Offset: 0x0) CAN Message Mode Register -------- +#define AT91C_CAN_MTIMEMARK (0xFFFF << 0) // (CAN_MB) Mailbox Timemark +#define AT91C_CAN_PRIOR (0xF << 16) // (CAN_MB) Mailbox Priority +#define AT91C_CAN_MOT (0x7 << 24) // (CAN_MB) Mailbox Object Type +#define AT91C_CAN_MOT_DIS (0x0 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_RX (0x1 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_RXOVERWRITE (0x2 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_TX (0x3 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_CONSUMER (0x4 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_PRODUCER (0x5 << 24) // (CAN_MB) +// -------- CAN_MAM : (CAN_MB Offset: 0x4) CAN Message Acceptance Mask Register -------- +#define AT91C_CAN_MIDvB (0x3FFFF << 0) // (CAN_MB) Complementary bits for identifier in extended mode +#define AT91C_CAN_MIDvA (0x7FF << 18) // (CAN_MB) Identifier for standard frame mode +#define AT91C_CAN_MIDE (0x1 << 29) // (CAN_MB) Identifier Version +// -------- CAN_MID : (CAN_MB Offset: 0x8) CAN Message ID Register -------- +// -------- CAN_MFID : (CAN_MB Offset: 0xc) CAN Message Family ID Register -------- +// -------- CAN_MSR : (CAN_MB Offset: 0x10) CAN Message Status Register -------- +#define AT91C_CAN_MTIMESTAMP (0xFFFF << 0) // (CAN_MB) Timer Value +#define AT91C_CAN_MDLC (0xF << 16) // (CAN_MB) Mailbox Data Length Code +#define AT91C_CAN_MRTR (0x1 << 20) // (CAN_MB) Mailbox Remote Transmission Request +#define AT91C_CAN_MABT (0x1 << 22) // (CAN_MB) Mailbox Message Abort +#define AT91C_CAN_MRDY (0x1 << 23) // (CAN_MB) Mailbox Ready +#define AT91C_CAN_MMI (0x1 << 24) // (CAN_MB) Mailbox Message Ignored +// -------- CAN_MDL : (CAN_MB Offset: 0x14) CAN Message Data Low Register -------- +// -------- CAN_MDH : (CAN_MB Offset: 0x18) CAN Message Data High Register -------- +// -------- CAN_MCR : (CAN_MB Offset: 0x1c) CAN Message Control Register -------- +#define AT91C_CAN_MACR (0x1 << 22) // (CAN_MB) Abort Request for Mailbox +#define AT91C_CAN_MTCR (0x1 << 23) // (CAN_MB) Mailbox Transfer Command + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Control Area Network Interface +// ***************************************************************************** +// *** Register offset in AT91S_CAN structure *** +#define CAN_MR ( 0) // Mode Register +#define CAN_IER ( 4) // Interrupt Enable Register +#define CAN_IDR ( 8) // Interrupt Disable Register +#define CAN_IMR (12) // Interrupt Mask Register +#define CAN_SR (16) // Status Register +#define CAN_BR (20) // Baudrate Register +#define CAN_TIM (24) // Timer Register +#define CAN_TIMESTP (28) // Time Stamp Register +#define CAN_ECR (32) // Error Counter Register +#define CAN_TCR (36) // Transfer Command Register +#define CAN_ACR (40) // Abort Command Register +#define CAN_VR (252) // Version Register +#define CAN_MB0 (512) // CAN Mailbox 0 +#define CAN_MB1 (544) // CAN Mailbox 1 +#define CAN_MB2 (576) // CAN Mailbox 2 +#define CAN_MB3 (608) // CAN Mailbox 3 +#define CAN_MB4 (640) // CAN Mailbox 4 +#define CAN_MB5 (672) // CAN Mailbox 5 +#define CAN_MB6 (704) // CAN Mailbox 6 +#define CAN_MB7 (736) // CAN Mailbox 7 +#define CAN_MB8 (768) // CAN Mailbox 8 +#define CAN_MB9 (800) // CAN Mailbox 9 +#define CAN_MB10 (832) // CAN Mailbox 10 +#define CAN_MB11 (864) // CAN Mailbox 11 +#define CAN_MB12 (896) // CAN Mailbox 12 +#define CAN_MB13 (928) // CAN Mailbox 13 +#define CAN_MB14 (960) // CAN Mailbox 14 +#define CAN_MB15 (992) // CAN Mailbox 15 +// -------- CAN_MR : (CAN Offset: 0x0) CAN Mode Register -------- +#define AT91C_CAN_CANEN (0x1 << 0) // (CAN) CAN Controller Enable +#define AT91C_CAN_LPM (0x1 << 1) // (CAN) Disable/Enable Low Power Mode +#define AT91C_CAN_ABM (0x1 << 2) // (CAN) Disable/Enable Autobaud/Listen Mode +#define AT91C_CAN_OVL (0x1 << 3) // (CAN) Disable/Enable Overload Frame +#define AT91C_CAN_TEOF (0x1 << 4) // (CAN) Time Stamp messages at each end of Frame +#define AT91C_CAN_TTM (0x1 << 5) // (CAN) Disable/Enable Time Trigger Mode +#define AT91C_CAN_TIMFRZ (0x1 << 6) // (CAN) Enable Timer Freeze +#define AT91C_CAN_DRPT (0x1 << 7) // (CAN) Disable Repeat +// -------- CAN_IER : (CAN Offset: 0x4) CAN Interrupt Enable Register -------- +#define AT91C_CAN_MB0 (0x1 << 0) // (CAN) Mailbox 0 Flag +#define AT91C_CAN_MB1 (0x1 << 1) // (CAN) Mailbox 1 Flag +#define AT91C_CAN_MB2 (0x1 << 2) // (CAN) Mailbox 2 Flag +#define AT91C_CAN_MB3 (0x1 << 3) // (CAN) Mailbox 3 Flag +#define AT91C_CAN_MB4 (0x1 << 4) // (CAN) Mailbox 4 Flag +#define AT91C_CAN_MB5 (0x1 << 5) // (CAN) Mailbox 5 Flag +#define AT91C_CAN_MB6 (0x1 << 6) // (CAN) Mailbox 6 Flag +#define AT91C_CAN_MB7 (0x1 << 7) // (CAN) Mailbox 7 Flag +#define AT91C_CAN_MB8 (0x1 << 8) // (CAN) Mailbox 8 Flag +#define AT91C_CAN_MB9 (0x1 << 9) // (CAN) Mailbox 9 Flag +#define AT91C_CAN_MB10 (0x1 << 10) // (CAN) Mailbox 10 Flag +#define AT91C_CAN_MB11 (0x1 << 11) // (CAN) Mailbox 11 Flag +#define AT91C_CAN_MB12 (0x1 << 12) // (CAN) Mailbox 12 Flag +#define AT91C_CAN_MB13 (0x1 << 13) // (CAN) Mailbox 13 Flag +#define AT91C_CAN_MB14 (0x1 << 14) // (CAN) Mailbox 14 Flag +#define AT91C_CAN_MB15 (0x1 << 15) // (CAN) Mailbox 15 Flag +#define AT91C_CAN_ERRA (0x1 << 16) // (CAN) Error Active Mode Flag +#define AT91C_CAN_WARN (0x1 << 17) // (CAN) Warning Limit Flag +#define AT91C_CAN_ERRP (0x1 << 18) // (CAN) Error Passive Mode Flag +#define AT91C_CAN_BOFF (0x1 << 19) // (CAN) Bus Off Mode Flag +#define AT91C_CAN_SLEEP (0x1 << 20) // (CAN) Sleep Flag +#define AT91C_CAN_WAKEUP (0x1 << 21) // (CAN) Wakeup Flag +#define AT91C_CAN_TOVF (0x1 << 22) // (CAN) Timer Overflow Flag +#define AT91C_CAN_TSTP (0x1 << 23) // (CAN) Timestamp Flag +#define AT91C_CAN_CERR (0x1 << 24) // (CAN) CRC Error +#define AT91C_CAN_SERR (0x1 << 25) // (CAN) Stuffing Error +#define AT91C_CAN_AERR (0x1 << 26) // (CAN) Acknowledgment Error +#define AT91C_CAN_FERR (0x1 << 27) // (CAN) Form Error +#define AT91C_CAN_BERR (0x1 << 28) // (CAN) Bit Error +// -------- CAN_IDR : (CAN Offset: 0x8) CAN Interrupt Disable Register -------- +// -------- CAN_IMR : (CAN Offset: 0xc) CAN Interrupt Mask Register -------- +// -------- CAN_SR : (CAN Offset: 0x10) CAN Status Register -------- +#define AT91C_CAN_RBSY (0x1 << 29) // (CAN) Receiver Busy +#define AT91C_CAN_TBSY (0x1 << 30) // (CAN) Transmitter Busy +#define AT91C_CAN_OVLY (0x1 << 31) // (CAN) Overload Busy +// -------- CAN_BR : (CAN Offset: 0x14) CAN Baudrate Register -------- +#define AT91C_CAN_PHASE2 (0x7 << 0) // (CAN) Phase 2 segment +#define AT91C_CAN_PHASE1 (0x7 << 4) // (CAN) Phase 1 segment +#define AT91C_CAN_PROPAG (0x7 << 8) // (CAN) Programmation time segment +#define AT91C_CAN_SYNC (0x3 << 12) // (CAN) Re-synchronization jump width segment +#define AT91C_CAN_BRP (0x7F << 16) // (CAN) Baudrate Prescaler +#define AT91C_CAN_SMP (0x1 << 24) // (CAN) Sampling mode +// -------- CAN_TIM : (CAN Offset: 0x18) CAN Timer Register -------- +#define AT91C_CAN_TIMER (0xFFFF << 0) // (CAN) Timer field +// -------- CAN_TIMESTP : (CAN Offset: 0x1c) CAN Timestamp Register -------- +// -------- CAN_ECR : (CAN Offset: 0x20) CAN Error Counter Register -------- +#define AT91C_CAN_REC (0xFF << 0) // (CAN) Receive Error Counter +#define AT91C_CAN_TEC (0xFF << 16) // (CAN) Transmit Error Counter +// -------- CAN_TCR : (CAN Offset: 0x24) CAN Transfer Command Register -------- +#define AT91C_CAN_TIMRST (0x1 << 31) // (CAN) Timer Reset Field +// -------- CAN_ACR : (CAN Offset: 0x28) CAN Abort Command Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Ethernet MAC 10/100 +// ***************************************************************************** +// *** Register offset in AT91S_EMAC structure *** +#define EMAC_NCR ( 0) // Network Control Register +#define EMAC_NCFGR ( 4) // Network Configuration Register +#define EMAC_NSR ( 8) // Network Status Register +#define EMAC_TSR (20) // Transmit Status Register +#define EMAC_RBQP (24) // Receive Buffer Queue Pointer +#define EMAC_TBQP (28) // Transmit Buffer Queue Pointer +#define EMAC_RSR (32) // Receive Status Register +#define EMAC_ISR (36) // Interrupt Status Register +#define EMAC_IER (40) // Interrupt Enable Register +#define EMAC_IDR (44) // Interrupt Disable Register +#define EMAC_IMR (48) // Interrupt Mask Register +#define EMAC_MAN (52) // PHY Maintenance Register +#define EMAC_PTR (56) // Pause Time Register +#define EMAC_PFR (60) // Pause Frames received Register +#define EMAC_FTO (64) // Frames Transmitted OK Register +#define EMAC_SCF (68) // Single Collision Frame Register +#define EMAC_MCF (72) // Multiple Collision Frame Register +#define EMAC_FRO (76) // Frames Received OK Register +#define EMAC_FCSE (80) // Frame Check Sequence Error Register +#define EMAC_ALE (84) // Alignment Error Register +#define EMAC_DTF (88) // Deferred Transmission Frame Register +#define EMAC_LCOL (92) // Late Collision Register +#define EMAC_ECOL (96) // Excessive Collision Register +#define EMAC_TUND (100) // Transmit Underrun Error Register +#define EMAC_CSE (104) // Carrier Sense Error Register +#define EMAC_RRE (108) // Receive Ressource Error Register +#define EMAC_ROV (112) // Receive Overrun Errors Register +#define EMAC_RSE (116) // Receive Symbol Errors Register +#define EMAC_ELE (120) // Excessive Length Errors Register +#define EMAC_RJA (124) // Receive Jabbers Register +#define EMAC_USF (128) // Undersize Frames Register +#define EMAC_STE (132) // SQE Test Error Register +#define EMAC_RLE (136) // Receive Length Field Mismatch Register +#define EMAC_TPF (140) // Transmitted Pause Frames Register +#define EMAC_HRB (144) // Hash Address Bottom[31:0] +#define EMAC_HRT (148) // Hash Address Top[63:32] +#define EMAC_SA1L (152) // Specific Address 1 Bottom, First 4 bytes +#define EMAC_SA1H (156) // Specific Address 1 Top, Last 2 bytes +#define EMAC_SA2L (160) // Specific Address 2 Bottom, First 4 bytes +#define EMAC_SA2H (164) // Specific Address 2 Top, Last 2 bytes +#define EMAC_SA3L (168) // Specific Address 3 Bottom, First 4 bytes +#define EMAC_SA3H (172) // Specific Address 3 Top, Last 2 bytes +#define EMAC_SA4L (176) // Specific Address 4 Bottom, First 4 bytes +#define EMAC_SA4H (180) // Specific Address 4 Top, Last 2 bytes +#define EMAC_TID (184) // Type ID Checking Register +#define EMAC_TPQ (188) // Transmit Pause Quantum Register +#define EMAC_USRIO (192) // USER Input/Output Register +#define EMAC_WOL (196) // Wake On LAN Register +#define EMAC_REV (252) // Revision Register +// -------- EMAC_NCR : (EMAC Offset: 0x0) -------- +#define AT91C_EMAC_LB (0x1 << 0) // (EMAC) Loopback. Optional. When set, loopback signal is at high level. +#define AT91C_EMAC_LLB (0x1 << 1) // (EMAC) Loopback local. +#define AT91C_EMAC_RE (0x1 << 2) // (EMAC) Receive enable. +#define AT91C_EMAC_TE (0x1 << 3) // (EMAC) Transmit enable. +#define AT91C_EMAC_MPE (0x1 << 4) // (EMAC) Management port enable. +#define AT91C_EMAC_CLRSTAT (0x1 << 5) // (EMAC) Clear statistics registers. +#define AT91C_EMAC_INCSTAT (0x1 << 6) // (EMAC) Increment statistics registers. +#define AT91C_EMAC_WESTAT (0x1 << 7) // (EMAC) Write enable for statistics registers. +#define AT91C_EMAC_BP (0x1 << 8) // (EMAC) Back pressure. +#define AT91C_EMAC_TSTART (0x1 << 9) // (EMAC) Start Transmission. +#define AT91C_EMAC_THALT (0x1 << 10) // (EMAC) Transmission Halt. +#define AT91C_EMAC_TPFR (0x1 << 11) // (EMAC) Transmit pause frame +#define AT91C_EMAC_TZQ (0x1 << 12) // (EMAC) Transmit zero quantum pause frame +// -------- EMAC_NCFGR : (EMAC Offset: 0x4) Network Configuration Register -------- +#define AT91C_EMAC_SPD (0x1 << 0) // (EMAC) Speed. +#define AT91C_EMAC_FD (0x1 << 1) // (EMAC) Full duplex. +#define AT91C_EMAC_JFRAME (0x1 << 3) // (EMAC) Jumbo Frames. +#define AT91C_EMAC_CAF (0x1 << 4) // (EMAC) Copy all frames. +#define AT91C_EMAC_NBC (0x1 << 5) // (EMAC) No broadcast. +#define AT91C_EMAC_MTI (0x1 << 6) // (EMAC) Multicast hash event enable +#define AT91C_EMAC_UNI (0x1 << 7) // (EMAC) Unicast hash enable. +#define AT91C_EMAC_BIG (0x1 << 8) // (EMAC) Receive 1522 bytes. +#define AT91C_EMAC_EAE (0x1 << 9) // (EMAC) External address match enable. +#define AT91C_EMAC_CLK (0x3 << 10) // (EMAC) +#define AT91C_EMAC_CLK_HCLK_8 (0x0 << 10) // (EMAC) HCLK divided by 8 +#define AT91C_EMAC_CLK_HCLK_16 (0x1 << 10) // (EMAC) HCLK divided by 16 +#define AT91C_EMAC_CLK_HCLK_32 (0x2 << 10) // (EMAC) HCLK divided by 32 +#define AT91C_EMAC_CLK_HCLK_64 (0x3 << 10) // (EMAC) HCLK divided by 64 +#define AT91C_EMAC_RTY (0x1 << 12) // (EMAC) +#define AT91C_EMAC_PAE (0x1 << 13) // (EMAC) +#define AT91C_EMAC_RBOF (0x3 << 14) // (EMAC) +#define AT91C_EMAC_RBOF_OFFSET_0 (0x0 << 14) // (EMAC) no offset from start of receive buffer +#define AT91C_EMAC_RBOF_OFFSET_1 (0x1 << 14) // (EMAC) one byte offset from start of receive buffer +#define AT91C_EMAC_RBOF_OFFSET_2 (0x2 << 14) // (EMAC) two bytes offset from start of receive buffer +#define AT91C_EMAC_RBOF_OFFSET_3 (0x3 << 14) // (EMAC) three bytes offset from start of receive buffer +#define AT91C_EMAC_RLCE (0x1 << 16) // (EMAC) Receive Length field Checking Enable +#define AT91C_EMAC_DRFCS (0x1 << 17) // (EMAC) Discard Receive FCS +#define AT91C_EMAC_EFRHD (0x1 << 18) // (EMAC) +#define AT91C_EMAC_IRXFCS (0x1 << 19) // (EMAC) Ignore RX FCS +// -------- EMAC_NSR : (EMAC Offset: 0x8) Network Status Register -------- +#define AT91C_EMAC_LINKR (0x1 << 0) // (EMAC) +#define AT91C_EMAC_MDIO (0x1 << 1) // (EMAC) +#define AT91C_EMAC_IDLE (0x1 << 2) // (EMAC) +// -------- EMAC_TSR : (EMAC Offset: 0x14) Transmit Status Register -------- +#define AT91C_EMAC_UBR (0x1 << 0) // (EMAC) +#define AT91C_EMAC_COL (0x1 << 1) // (EMAC) +#define AT91C_EMAC_RLES (0x1 << 2) // (EMAC) +#define AT91C_EMAC_TGO (0x1 << 3) // (EMAC) Transmit Go +#define AT91C_EMAC_BEX (0x1 << 4) // (EMAC) Buffers exhausted mid frame +#define AT91C_EMAC_COMP (0x1 << 5) // (EMAC) +#define AT91C_EMAC_UND (0x1 << 6) // (EMAC) +// -------- EMAC_RSR : (EMAC Offset: 0x20) Receive Status Register -------- +#define AT91C_EMAC_BNA (0x1 << 0) // (EMAC) +#define AT91C_EMAC_REC (0x1 << 1) // (EMAC) +#define AT91C_EMAC_OVR (0x1 << 2) // (EMAC) +// -------- EMAC_ISR : (EMAC Offset: 0x24) Interrupt Status Register -------- +#define AT91C_EMAC_MFD (0x1 << 0) // (EMAC) +#define AT91C_EMAC_RCOMP (0x1 << 1) // (EMAC) +#define AT91C_EMAC_RXUBR (0x1 << 2) // (EMAC) +#define AT91C_EMAC_TXUBR (0x1 << 3) // (EMAC) +#define AT91C_EMAC_TUNDR (0x1 << 4) // (EMAC) +#define AT91C_EMAC_RLEX (0x1 << 5) // (EMAC) +#define AT91C_EMAC_TXERR (0x1 << 6) // (EMAC) +#define AT91C_EMAC_TCOMP (0x1 << 7) // (EMAC) +#define AT91C_EMAC_LINK (0x1 << 9) // (EMAC) +#define AT91C_EMAC_ROVR (0x1 << 10) // (EMAC) +#define AT91C_EMAC_HRESP (0x1 << 11) // (EMAC) +#define AT91C_EMAC_PFRE (0x1 << 12) // (EMAC) +#define AT91C_EMAC_PTZ (0x1 << 13) // (EMAC) +// -------- EMAC_IER : (EMAC Offset: 0x28) Interrupt Enable Register -------- +// -------- EMAC_IDR : (EMAC Offset: 0x2c) Interrupt Disable Register -------- +// -------- EMAC_IMR : (EMAC Offset: 0x30) Interrupt Mask Register -------- +// -------- EMAC_MAN : (EMAC Offset: 0x34) PHY Maintenance Register -------- +#define AT91C_EMAC_DATA (0xFFFF << 0) // (EMAC) +#define AT91C_EMAC_CODE (0x3 << 16) // (EMAC) +#define AT91C_EMAC_REGA (0x1F << 18) // (EMAC) +#define AT91C_EMAC_PHYA (0x1F << 23) // (EMAC) +#define AT91C_EMAC_RW (0x3 << 28) // (EMAC) +#define AT91C_EMAC_SOF (0x3 << 30) // (EMAC) +// -------- EMAC_USRIO : (EMAC Offset: 0xc0) USER Input Output Register -------- +#define AT91C_EMAC_RMII (0x1 << 0) // (EMAC) Reduce MII +#define AT91C_EMAC_CLKEN (0x1 << 1) // (EMAC) Clock Enable +// -------- EMAC_WOL : (EMAC Offset: 0xc4) Wake On LAN Register -------- +#define AT91C_EMAC_IP (0xFFFF << 0) // (EMAC) ARP request IP address +#define AT91C_EMAC_MAG (0x1 << 16) // (EMAC) Magic packet event enable +#define AT91C_EMAC_ARP (0x1 << 17) // (EMAC) ARP request event enable +#define AT91C_EMAC_SA1 (0x1 << 18) // (EMAC) Specific address register 1 event enable +// -------- EMAC_REV : (EMAC Offset: 0xfc) Revision Register -------- +#define AT91C_EMAC_REVREF (0xFFFF << 0) // (EMAC) +#define AT91C_EMAC_PARTREF (0xFFFF << 16) // (EMAC) + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Analog to Digital Convertor +// ***************************************************************************** +// *** Register offset in AT91S_ADC structure *** +#define ADC_CR ( 0) // ADC Control Register +#define ADC_MR ( 4) // ADC Mode Register +#define ADC_CHER (16) // ADC Channel Enable Register +#define ADC_CHDR (20) // ADC Channel Disable Register +#define ADC_CHSR (24) // ADC Channel Status Register +#define ADC_SR (28) // ADC Status Register +#define ADC_LCDR (32) // ADC Last Converted Data Register +#define ADC_IER (36) // ADC Interrupt Enable Register +#define ADC_IDR (40) // ADC Interrupt Disable Register +#define ADC_IMR (44) // ADC Interrupt Mask Register +#define ADC_CDR0 (48) // ADC Channel Data Register 0 +#define ADC_CDR1 (52) // ADC Channel Data Register 1 +#define ADC_CDR2 (56) // ADC Channel Data Register 2 +#define ADC_CDR3 (60) // ADC Channel Data Register 3 +#define ADC_CDR4 (64) // ADC Channel Data Register 4 +#define ADC_CDR5 (68) // ADC Channel Data Register 5 +#define ADC_CDR6 (72) // ADC Channel Data Register 6 +#define ADC_CDR7 (76) // ADC Channel Data Register 7 +#define ADC_RPR (256) // Receive Pointer Register +#define ADC_RCR (260) // Receive Counter Register +#define ADC_TPR (264) // Transmit Pointer Register +#define ADC_TCR (268) // Transmit Counter Register +#define ADC_RNPR (272) // Receive Next Pointer Register +#define ADC_RNCR (276) // Receive Next Counter Register +#define ADC_TNPR (280) // Transmit Next Pointer Register +#define ADC_TNCR (284) // Transmit Next Counter Register +#define ADC_PTCR (288) // PDC Transfer Control Register +#define ADC_PTSR (292) // PDC Transfer Status Register +// -------- ADC_CR : (ADC Offset: 0x0) ADC Control Register -------- +#define AT91C_ADC_SWRST (0x1 << 0) // (ADC) Software Reset +#define AT91C_ADC_START (0x1 << 1) // (ADC) Start Conversion +// -------- ADC_MR : (ADC Offset: 0x4) ADC Mode Register -------- +#define AT91C_ADC_TRGEN (0x1 << 0) // (ADC) Trigger Enable +#define AT91C_ADC_TRGEN_DIS (0x0) // (ADC) Hradware triggers are disabled. Starting a conversion is only possible by software +#define AT91C_ADC_TRGEN_EN (0x1) // (ADC) Hardware trigger selected by TRGSEL field is enabled. +#define AT91C_ADC_TRGSEL (0x7 << 1) // (ADC) Trigger Selection +#define AT91C_ADC_TRGSEL_TIOA0 (0x0 << 1) // (ADC) Selected TRGSEL = TIAO0 +#define AT91C_ADC_TRGSEL_TIOA1 (0x1 << 1) // (ADC) Selected TRGSEL = TIAO1 +#define AT91C_ADC_TRGSEL_TIOA2 (0x2 << 1) // (ADC) Selected TRGSEL = TIAO2 +#define AT91C_ADC_TRGSEL_TIOA3 (0x3 << 1) // (ADC) Selected TRGSEL = TIAO3 +#define AT91C_ADC_TRGSEL_TIOA4 (0x4 << 1) // (ADC) Selected TRGSEL = TIAO4 +#define AT91C_ADC_TRGSEL_TIOA5 (0x5 << 1) // (ADC) Selected TRGSEL = TIAO5 +#define AT91C_ADC_TRGSEL_EXT (0x6 << 1) // (ADC) Selected TRGSEL = External Trigger +#define AT91C_ADC_LOWRES (0x1 << 4) // (ADC) Resolution. +#define AT91C_ADC_LOWRES_10_BIT (0x0 << 4) // (ADC) 10-bit resolution +#define AT91C_ADC_LOWRES_8_BIT (0x1 << 4) // (ADC) 8-bit resolution +#define AT91C_ADC_SLEEP (0x1 << 5) // (ADC) Sleep Mode +#define AT91C_ADC_SLEEP_NORMAL_MODE (0x0 << 5) // (ADC) Normal Mode +#define AT91C_ADC_SLEEP_MODE (0x1 << 5) // (ADC) Sleep Mode +#define AT91C_ADC_PRESCAL (0x3F << 8) // (ADC) Prescaler rate selection +#define AT91C_ADC_STARTUP (0x1F << 16) // (ADC) Startup Time +#define AT91C_ADC_SHTIM (0xF << 24) // (ADC) Sample & Hold Time +// -------- ADC_CHER : (ADC Offset: 0x10) ADC Channel Enable Register -------- +#define AT91C_ADC_CH0 (0x1 << 0) // (ADC) Channel 0 +#define AT91C_ADC_CH1 (0x1 << 1) // (ADC) Channel 1 +#define AT91C_ADC_CH2 (0x1 << 2) // (ADC) Channel 2 +#define AT91C_ADC_CH3 (0x1 << 3) // (ADC) Channel 3 +#define AT91C_ADC_CH4 (0x1 << 4) // (ADC) Channel 4 +#define AT91C_ADC_CH5 (0x1 << 5) // (ADC) Channel 5 +#define AT91C_ADC_CH6 (0x1 << 6) // (ADC) Channel 6 +#define AT91C_ADC_CH7 (0x1 << 7) // (ADC) Channel 7 +// -------- ADC_CHDR : (ADC Offset: 0x14) ADC Channel Disable Register -------- +// -------- ADC_CHSR : (ADC Offset: 0x18) ADC Channel Status Register -------- +// -------- ADC_SR : (ADC Offset: 0x1c) ADC Status Register -------- +#define AT91C_ADC_EOC0 (0x1 << 0) // (ADC) End of Conversion +#define AT91C_ADC_EOC1 (0x1 << 1) // (ADC) End of Conversion +#define AT91C_ADC_EOC2 (0x1 << 2) // (ADC) End of Conversion +#define AT91C_ADC_EOC3 (0x1 << 3) // (ADC) End of Conversion +#define AT91C_ADC_EOC4 (0x1 << 4) // (ADC) End of Conversion +#define AT91C_ADC_EOC5 (0x1 << 5) // (ADC) End of Conversion +#define AT91C_ADC_EOC6 (0x1 << 6) // (ADC) End of Conversion +#define AT91C_ADC_EOC7 (0x1 << 7) // (ADC) End of Conversion +#define AT91C_ADC_OVRE0 (0x1 << 8) // (ADC) Overrun Error +#define AT91C_ADC_OVRE1 (0x1 << 9) // (ADC) Overrun Error +#define AT91C_ADC_OVRE2 (0x1 << 10) // (ADC) Overrun Error +#define AT91C_ADC_OVRE3 (0x1 << 11) // (ADC) Overrun Error +#define AT91C_ADC_OVRE4 (0x1 << 12) // (ADC) Overrun Error +#define AT91C_ADC_OVRE5 (0x1 << 13) // (ADC) Overrun Error +#define AT91C_ADC_OVRE6 (0x1 << 14) // (ADC) Overrun Error +#define AT91C_ADC_OVRE7 (0x1 << 15) // (ADC) Overrun Error +#define AT91C_ADC_DRDY (0x1 << 16) // (ADC) Data Ready +#define AT91C_ADC_GOVRE (0x1 << 17) // (ADC) General Overrun +#define AT91C_ADC_ENDRX (0x1 << 18) // (ADC) End of Receiver Transfer +#define AT91C_ADC_RXBUFF (0x1 << 19) // (ADC) RXBUFF Interrupt +// -------- ADC_LCDR : (ADC Offset: 0x20) ADC Last Converted Data Register -------- +#define AT91C_ADC_LDATA (0x3FF << 0) // (ADC) Last Data Converted +// -------- ADC_IER : (ADC Offset: 0x24) ADC Interrupt Enable Register -------- +// -------- ADC_IDR : (ADC Offset: 0x28) ADC Interrupt Disable Register -------- +// -------- ADC_IMR : (ADC Offset: 0x2c) ADC Interrupt Mask Register -------- +// -------- ADC_CDR0 : (ADC Offset: 0x30) ADC Channel Data Register 0 -------- +#define AT91C_ADC_DATA (0x3FF << 0) // (ADC) Converted Data +// -------- ADC_CDR1 : (ADC Offset: 0x34) ADC Channel Data Register 1 -------- +// -------- ADC_CDR2 : (ADC Offset: 0x38) ADC Channel Data Register 2 -------- +// -------- ADC_CDR3 : (ADC Offset: 0x3c) ADC Channel Data Register 3 -------- +// -------- ADC_CDR4 : (ADC Offset: 0x40) ADC Channel Data Register 4 -------- +// -------- ADC_CDR5 : (ADC Offset: 0x44) ADC Channel Data Register 5 -------- +// -------- ADC_CDR6 : (ADC Offset: 0x48) ADC Channel Data Register 6 -------- +// -------- ADC_CDR7 : (ADC Offset: 0x4c) ADC Channel Data Register 7 -------- + +// ***************************************************************************** +// REGISTER ADDRESS DEFINITION FOR AT91SAM7X256 +// ***************************************************************************** +// ========== Register definition for SYS peripheral ========== +// ========== Register definition for AIC peripheral ========== +#define AT91C_AIC_IVR (0xFFFFF100) // (AIC) IRQ Vector Register +#define AT91C_AIC_SMR (0xFFFFF000) // (AIC) Source Mode Register +#define AT91C_AIC_FVR (0xFFFFF104) // (AIC) FIQ Vector Register +#define AT91C_AIC_DCR (0xFFFFF138) // (AIC) Debug Control Register (Protect) +#define AT91C_AIC_EOICR (0xFFFFF130) // (AIC) End of Interrupt Command Register +#define AT91C_AIC_SVR (0xFFFFF080) // (AIC) Source Vector Register +#define AT91C_AIC_FFSR (0xFFFFF148) // (AIC) Fast Forcing Status Register +#define AT91C_AIC_ICCR (0xFFFFF128) // (AIC) Interrupt Clear Command Register +#define AT91C_AIC_ISR (0xFFFFF108) // (AIC) Interrupt Status Register +#define AT91C_AIC_IMR (0xFFFFF110) // (AIC) Interrupt Mask Register +#define AT91C_AIC_IPR (0xFFFFF10C) // (AIC) Interrupt Pending Register +#define AT91C_AIC_FFER (0xFFFFF140) // (AIC) Fast Forcing Enable Register +#define AT91C_AIC_IECR (0xFFFFF120) // (AIC) Interrupt Enable Command Register +#define AT91C_AIC_ISCR (0xFFFFF12C) // (AIC) Interrupt Set Command Register +#define AT91C_AIC_FFDR (0xFFFFF144) // (AIC) Fast Forcing Disable Register +#define AT91C_AIC_CISR (0xFFFFF114) // (AIC) Core Interrupt Status Register +#define AT91C_AIC_IDCR (0xFFFFF124) // (AIC) Interrupt Disable Command Register +#define AT91C_AIC_SPU (0xFFFFF134) // (AIC) Spurious Vector Register +// ========== Register definition for PDC_DBGU peripheral ========== +#define AT91C_DBGU_TCR (0xFFFFF30C) // (PDC_DBGU) Transmit Counter Register +#define AT91C_DBGU_RNPR (0xFFFFF310) // (PDC_DBGU) Receive Next Pointer Register +#define AT91C_DBGU_TNPR (0xFFFFF318) // (PDC_DBGU) Transmit Next Pointer Register +#define AT91C_DBGU_TPR (0xFFFFF308) // (PDC_DBGU) Transmit Pointer Register +#define AT91C_DBGU_RPR (0xFFFFF300) // (PDC_DBGU) Receive Pointer Register +#define AT91C_DBGU_RCR (0xFFFFF304) // (PDC_DBGU) Receive Counter Register +#define AT91C_DBGU_RNCR (0xFFFFF314) // (PDC_DBGU) Receive Next Counter Register +#define AT91C_DBGU_PTCR (0xFFFFF320) // (PDC_DBGU) PDC Transfer Control Register +#define AT91C_DBGU_PTSR (0xFFFFF324) // (PDC_DBGU) PDC Transfer Status Register +#define AT91C_DBGU_TNCR (0xFFFFF31C) // (PDC_DBGU) Transmit Next Counter Register +// ========== Register definition for DBGU peripheral ========== +#define AT91C_DBGU_EXID (0xFFFFF244) // (DBGU) Chip ID Extension Register +#define AT91C_DBGU_BRGR (0xFFFFF220) // (DBGU) Baud Rate Generator Register +#define AT91C_DBGU_IDR (0xFFFFF20C) // (DBGU) Interrupt Disable Register +#define AT91C_DBGU_CSR (0xFFFFF214) // (DBGU) Channel Status Register +#define AT91C_DBGU_CIDR (0xFFFFF240) // (DBGU) Chip ID Register +#define AT91C_DBGU_MR (0xFFFFF204) // (DBGU) Mode Register +#define AT91C_DBGU_IMR (0xFFFFF210) // (DBGU) Interrupt Mask Register +#define AT91C_DBGU_CR (0xFFFFF200) // (DBGU) Control Register +#define AT91C_DBGU_FNTR (0xFFFFF248) // (DBGU) Force NTRST Register +#define AT91C_DBGU_THR (0xFFFFF21C) // (DBGU) Transmitter Holding Register +#define AT91C_DBGU_RHR (0xFFFFF218) // (DBGU) Receiver Holding Register +#define AT91C_DBGU_IER (0xFFFFF208) // (DBGU) Interrupt Enable Register +// ========== Register definition for PIOA peripheral ========== +#define AT91C_PIOA_ODR (0xFFFFF414) // (PIOA) Output Disable Registerr +#define AT91C_PIOA_SODR (0xFFFFF430) // (PIOA) Set Output Data Register +#define AT91C_PIOA_ISR (0xFFFFF44C) // (PIOA) Interrupt Status Register +#define AT91C_PIOA_ABSR (0xFFFFF478) // (PIOA) AB Select Status Register +#define AT91C_PIOA_IER (0xFFFFF440) // (PIOA) Interrupt Enable Register +#define AT91C_PIOA_PPUDR (0xFFFFF460) // (PIOA) Pull-up Disable Register +#define AT91C_PIOA_IMR (0xFFFFF448) // (PIOA) Interrupt Mask Register +#define AT91C_PIOA_PER (0xFFFFF400) // (PIOA) PIO Enable Register +#define AT91C_PIOA_IFDR (0xFFFFF424) // (PIOA) Input Filter Disable Register +#define AT91C_PIOA_OWDR (0xFFFFF4A4) // (PIOA) Output Write Disable Register +#define AT91C_PIOA_MDSR (0xFFFFF458) // (PIOA) Multi-driver Status Register +#define AT91C_PIOA_IDR (0xFFFFF444) // (PIOA) Interrupt Disable Register +#define AT91C_PIOA_ODSR (0xFFFFF438) // (PIOA) Output Data Status Register +#define AT91C_PIOA_PPUSR (0xFFFFF468) // (PIOA) Pull-up Status Register +#define AT91C_PIOA_OWSR (0xFFFFF4A8) // (PIOA) Output Write Status Register +#define AT91C_PIOA_BSR (0xFFFFF474) // (PIOA) Select B Register +#define AT91C_PIOA_OWER (0xFFFFF4A0) // (PIOA) Output Write Enable Register +#define AT91C_PIOA_IFER (0xFFFFF420) // (PIOA) Input Filter Enable Register +#define AT91C_PIOA_PDSR (0xFFFFF43C) // (PIOA) Pin Data Status Register +#define AT91C_PIOA_PPUER (0xFFFFF464) // (PIOA) Pull-up Enable Register +#define AT91C_PIOA_OSR (0xFFFFF418) // (PIOA) Output Status Register +#define AT91C_PIOA_ASR (0xFFFFF470) // (PIOA) Select A Register +#define AT91C_PIOA_MDDR (0xFFFFF454) // (PIOA) Multi-driver Disable Register +#define AT91C_PIOA_CODR (0xFFFFF434) // (PIOA) Clear Output Data Register +#define AT91C_PIOA_MDER (0xFFFFF450) // (PIOA) Multi-driver Enable Register +#define AT91C_PIOA_PDR (0xFFFFF404) // (PIOA) PIO Disable Register +#define AT91C_PIOA_IFSR (0xFFFFF428) // (PIOA) Input Filter Status Register +#define AT91C_PIOA_OER (0xFFFFF410) // (PIOA) Output Enable Register +#define AT91C_PIOA_PSR (0xFFFFF408) // (PIOA) PIO Status Register +// ========== Register definition for PIOB peripheral ========== +#define AT91C_PIOB_OWDR (0xFFFFF6A4) // (PIOB) Output Write Disable Register +#define AT91C_PIOB_MDER (0xFFFFF650) // (PIOB) Multi-driver Enable Register +#define AT91C_PIOB_PPUSR (0xFFFFF668) // (PIOB) Pull-up Status Register +#define AT91C_PIOB_IMR (0xFFFFF648) // (PIOB) Interrupt Mask Register +#define AT91C_PIOB_ASR (0xFFFFF670) // (PIOB) Select A Register +#define AT91C_PIOB_PPUDR (0xFFFFF660) // (PIOB) Pull-up Disable Register +#define AT91C_PIOB_PSR (0xFFFFF608) // (PIOB) PIO Status Register +#define AT91C_PIOB_IER (0xFFFFF640) // (PIOB) Interrupt Enable Register +#define AT91C_PIOB_CODR (0xFFFFF634) // (PIOB) Clear Output Data Register +#define AT91C_PIOB_OWER (0xFFFFF6A0) // (PIOB) Output Write Enable Register +#define AT91C_PIOB_ABSR (0xFFFFF678) // (PIOB) AB Select Status Register +#define AT91C_PIOB_IFDR (0xFFFFF624) // (PIOB) Input Filter Disable Register +#define AT91C_PIOB_PDSR (0xFFFFF63C) // (PIOB) Pin Data Status Register +#define AT91C_PIOB_IDR (0xFFFFF644) // (PIOB) Interrupt Disable Register +#define AT91C_PIOB_OWSR (0xFFFFF6A8) // (PIOB) Output Write Status Register +#define AT91C_PIOB_PDR (0xFFFFF604) // (PIOB) PIO Disable Register +#define AT91C_PIOB_ODR (0xFFFFF614) // (PIOB) Output Disable Registerr +#define AT91C_PIOB_IFSR (0xFFFFF628) // (PIOB) Input Filter Status Register +#define AT91C_PIOB_PPUER (0xFFFFF664) // (PIOB) Pull-up Enable Register +#define AT91C_PIOB_SODR (0xFFFFF630) // (PIOB) Set Output Data Register +#define AT91C_PIOB_ISR (0xFFFFF64C) // (PIOB) Interrupt Status Register +#define AT91C_PIOB_ODSR (0xFFFFF638) // (PIOB) Output Data Status Register +#define AT91C_PIOB_OSR (0xFFFFF618) // (PIOB) Output Status Register +#define AT91C_PIOB_MDSR (0xFFFFF658) // (PIOB) Multi-driver Status Register +#define AT91C_PIOB_IFER (0xFFFFF620) // (PIOB) Input Filter Enable Register +#define AT91C_PIOB_BSR (0xFFFFF674) // (PIOB) Select B Register +#define AT91C_PIOB_MDDR (0xFFFFF654) // (PIOB) Multi-driver Disable Register +#define AT91C_PIOB_OER (0xFFFFF610) // (PIOB) Output Enable Register +#define AT91C_PIOB_PER (0xFFFFF600) // (PIOB) PIO Enable Register +// ========== Register definition for CKGR peripheral ========== +#define AT91C_CKGR_MOR (0xFFFFFC20) // (CKGR) Main Oscillator Register +#define AT91C_CKGR_PLLR (0xFFFFFC2C) // (CKGR) PLL Register +#define AT91C_CKGR_MCFR (0xFFFFFC24) // (CKGR) Main Clock Frequency Register +// ========== Register definition for PMC peripheral ========== +#define AT91C_PMC_IDR (0xFFFFFC64) // (PMC) Interrupt Disable Register +#define AT91C_PMC_MOR (0xFFFFFC20) // (PMC) Main Oscillator Register +#define AT91C_PMC_PLLR (0xFFFFFC2C) // (PMC) PLL Register +#define AT91C_PMC_PCER (0xFFFFFC10) // (PMC) Peripheral Clock Enable Register +#define AT91C_PMC_PCKR (0xFFFFFC40) // (PMC) Programmable Clock Register +#define AT91C_PMC_MCKR (0xFFFFFC30) // (PMC) Master Clock Register +#define AT91C_PMC_SCDR (0xFFFFFC04) // (PMC) System Clock Disable Register +#define AT91C_PMC_PCDR (0xFFFFFC14) // (PMC) Peripheral Clock Disable Register +#define AT91C_PMC_SCSR (0xFFFFFC08) // (PMC) System Clock Status Register +#define AT91C_PMC_PCSR (0xFFFFFC18) // (PMC) Peripheral Clock Status Register +#define AT91C_PMC_MCFR (0xFFFFFC24) // (PMC) Main Clock Frequency Register +#define AT91C_PMC_SCER (0xFFFFFC00) // (PMC) System Clock Enable Register +#define AT91C_PMC_IMR (0xFFFFFC6C) // (PMC) Interrupt Mask Register +#define AT91C_PMC_IER (0xFFFFFC60) // (PMC) Interrupt Enable Register +#define AT91C_PMC_SR (0xFFFFFC68) // (PMC) Status Register +// ========== Register definition for RSTC peripheral ========== +#define AT91C_RSTC_RCR (0xFFFFFD00) // (RSTC) Reset Control Register +#define AT91C_RSTC_RMR (0xFFFFFD08) // (RSTC) Reset Mode Register +#define AT91C_RSTC_RSR (0xFFFFFD04) // (RSTC) Reset Status Register +// ========== Register definition for RTTC peripheral ========== +#define AT91C_RTTC_RTSR (0xFFFFFD2C) // (RTTC) Real-time Status Register +#define AT91C_RTTC_RTMR (0xFFFFFD20) // (RTTC) Real-time Mode Register +#define AT91C_RTTC_RTVR (0xFFFFFD28) // (RTTC) Real-time Value Register +#define AT91C_RTTC_RTAR (0xFFFFFD24) // (RTTC) Real-time Alarm Register +// ========== Register definition for PITC peripheral ========== +#define AT91C_PITC_PIVR (0xFFFFFD38) // (PITC) Period Interval Value Register +#define AT91C_PITC_PISR (0xFFFFFD34) // (PITC) Period Interval Status Register +#define AT91C_PITC_PIIR (0xFFFFFD3C) // (PITC) Period Interval Image Register +#define AT91C_PITC_PIMR (0xFFFFFD30) // (PITC) Period Interval Mode Register +// ========== Register definition for WDTC peripheral ========== +#define AT91C_WDTC_WDCR (0xFFFFFD40) // (WDTC) Watchdog Control Register +#define AT91C_WDTC_WDSR (0xFFFFFD48) // (WDTC) Watchdog Status Register +#define AT91C_WDTC_WDMR (0xFFFFFD44) // (WDTC) Watchdog Mode Register +// ========== Register definition for VREG peripheral ========== +#define AT91C_VREG_MR (0xFFFFFD60) // (VREG) Voltage Regulator Mode Register +// ========== Register definition for MC peripheral ========== +#define AT91C_MC_ASR (0xFFFFFF04) // (MC) MC Abort Status Register +#define AT91C_MC_RCR (0xFFFFFF00) // (MC) MC Remap Control Register +#define AT91C_MC_FCR (0xFFFFFF64) // (MC) MC Flash Command Register +#define AT91C_MC_AASR (0xFFFFFF08) // (MC) MC Abort Address Status Register +#define AT91C_MC_FSR (0xFFFFFF68) // (MC) MC Flash Status Register +#define AT91C_MC_FMR (0xFFFFFF60) // (MC) MC Flash Mode Register +// ========== Register definition for PDC_SPI1 peripheral ========== +#define AT91C_SPI1_PTCR (0xFFFE4120) // (PDC_SPI1) PDC Transfer Control Register +#define AT91C_SPI1_RPR (0xFFFE4100) // (PDC_SPI1) Receive Pointer Register +#define AT91C_SPI1_TNCR (0xFFFE411C) // (PDC_SPI1) Transmit Next Counter Register +#define AT91C_SPI1_TPR (0xFFFE4108) // (PDC_SPI1) Transmit Pointer Register +#define AT91C_SPI1_TNPR (0xFFFE4118) // (PDC_SPI1) Transmit Next Pointer Register +#define AT91C_SPI1_TCR (0xFFFE410C) // (PDC_SPI1) Transmit Counter Register +#define AT91C_SPI1_RCR (0xFFFE4104) // (PDC_SPI1) Receive Counter Register +#define AT91C_SPI1_RNPR (0xFFFE4110) // (PDC_SPI1) Receive Next Pointer Register +#define AT91C_SPI1_RNCR (0xFFFE4114) // (PDC_SPI1) Receive Next Counter Register +#define AT91C_SPI1_PTSR (0xFFFE4124) // (PDC_SPI1) PDC Transfer Status Register +// ========== Register definition for SPI1 peripheral ========== +#define AT91C_SPI1_IMR (0xFFFE401C) // (SPI1) Interrupt Mask Register +#define AT91C_SPI1_IER (0xFFFE4014) // (SPI1) Interrupt Enable Register +#define AT91C_SPI1_MR (0xFFFE4004) // (SPI1) Mode Register +#define AT91C_SPI1_RDR (0xFFFE4008) // (SPI1) Receive Data Register +#define AT91C_SPI1_IDR (0xFFFE4018) // (SPI1) Interrupt Disable Register +#define AT91C_SPI1_SR (0xFFFE4010) // (SPI1) Status Register +#define AT91C_SPI1_TDR (0xFFFE400C) // (SPI1) Transmit Data Register +#define AT91C_SPI1_CR (0xFFFE4000) // (SPI1) Control Register +#define AT91C_SPI1_CSR (0xFFFE4030) // (SPI1) Chip Select Register +// ========== Register definition for PDC_SPI0 peripheral ========== +#define AT91C_SPI0_PTCR (0xFFFE0120) // (PDC_SPI0) PDC Transfer Control Register +#define AT91C_SPI0_TPR (0xFFFE0108) // (PDC_SPI0) Transmit Pointer Register +#define AT91C_SPI0_TCR (0xFFFE010C) // (PDC_SPI0) Transmit Counter Register +#define AT91C_SPI0_RCR (0xFFFE0104) // (PDC_SPI0) Receive Counter Register +#define AT91C_SPI0_PTSR (0xFFFE0124) // (PDC_SPI0) PDC Transfer Status Register +#define AT91C_SPI0_RNPR (0xFFFE0110) // (PDC_SPI0) Receive Next Pointer Register +#define AT91C_SPI0_RPR (0xFFFE0100) // (PDC_SPI0) Receive Pointer Register +#define AT91C_SPI0_TNCR (0xFFFE011C) // (PDC_SPI0) Transmit Next Counter Register +#define AT91C_SPI0_RNCR (0xFFFE0114) // (PDC_SPI0) Receive Next Counter Register +#define AT91C_SPI0_TNPR (0xFFFE0118) // (PDC_SPI0) Transmit Next Pointer Register +// ========== Register definition for SPI0 peripheral ========== +#define AT91C_SPI0_IER (0xFFFE0014) // (SPI0) Interrupt Enable Register +#define AT91C_SPI0_SR (0xFFFE0010) // (SPI0) Status Register +#define AT91C_SPI0_IDR (0xFFFE0018) // (SPI0) Interrupt Disable Register +#define AT91C_SPI0_CR (0xFFFE0000) // (SPI0) Control Register +#define AT91C_SPI0_MR (0xFFFE0004) // (SPI0) Mode Register +#define AT91C_SPI0_IMR (0xFFFE001C) // (SPI0) Interrupt Mask Register +#define AT91C_SPI0_TDR (0xFFFE000C) // (SPI0) Transmit Data Register +#define AT91C_SPI0_RDR (0xFFFE0008) // (SPI0) Receive Data Register +#define AT91C_SPI0_CSR (0xFFFE0030) // (SPI0) Chip Select Register +// ========== Register definition for PDC_US1 peripheral ========== +#define AT91C_US1_RNCR (0xFFFC4114) // (PDC_US1) Receive Next Counter Register +#define AT91C_US1_PTCR (0xFFFC4120) // (PDC_US1) PDC Transfer Control Register +#define AT91C_US1_TCR (0xFFFC410C) // (PDC_US1) Transmit Counter Register +#define AT91C_US1_PTSR (0xFFFC4124) // (PDC_US1) PDC Transfer Status Register +#define AT91C_US1_TNPR (0xFFFC4118) // (PDC_US1) Transmit Next Pointer Register +#define AT91C_US1_RCR (0xFFFC4104) // (PDC_US1) Receive Counter Register +#define AT91C_US1_RNPR (0xFFFC4110) // (PDC_US1) Receive Next Pointer Register +#define AT91C_US1_RPR (0xFFFC4100) // (PDC_US1) Receive Pointer Register +#define AT91C_US1_TNCR (0xFFFC411C) // (PDC_US1) Transmit Next Counter Register +#define AT91C_US1_TPR (0xFFFC4108) // (PDC_US1) Transmit Pointer Register +// ========== Register definition for US1 peripheral ========== +#define AT91C_US1_IF (0xFFFC404C) // (US1) IRDA_FILTER Register +#define AT91C_US1_NER (0xFFFC4044) // (US1) Nb Errors Register +#define AT91C_US1_RTOR (0xFFFC4024) // (US1) Receiver Time-out Register +#define AT91C_US1_CSR (0xFFFC4014) // (US1) Channel Status Register +#define AT91C_US1_IDR (0xFFFC400C) // (US1) Interrupt Disable Register +#define AT91C_US1_IER (0xFFFC4008) // (US1) Interrupt Enable Register +#define AT91C_US1_THR (0xFFFC401C) // (US1) Transmitter Holding Register +#define AT91C_US1_TTGR (0xFFFC4028) // (US1) Transmitter Time-guard Register +#define AT91C_US1_RHR (0xFFFC4018) // (US1) Receiver Holding Register +#define AT91C_US1_BRGR (0xFFFC4020) // (US1) Baud Rate Generator Register +#define AT91C_US1_IMR (0xFFFC4010) // (US1) Interrupt Mask Register +#define AT91C_US1_FIDI (0xFFFC4040) // (US1) FI_DI_Ratio Register +#define AT91C_US1_CR (0xFFFC4000) // (US1) Control Register +#define AT91C_US1_MR (0xFFFC4004) // (US1) Mode Register +// ========== Register definition for PDC_US0 peripheral ========== +#define AT91C_US0_TNPR (0xFFFC0118) // (PDC_US0) Transmit Next Pointer Register +#define AT91C_US0_RNPR (0xFFFC0110) // (PDC_US0) Receive Next Pointer Register +#define AT91C_US0_TCR (0xFFFC010C) // (PDC_US0) Transmit Counter Register +#define AT91C_US0_PTCR (0xFFFC0120) // (PDC_US0) PDC Transfer Control Register +#define AT91C_US0_PTSR (0xFFFC0124) // (PDC_US0) PDC Transfer Status Register +#define AT91C_US0_TNCR (0xFFFC011C) // (PDC_US0) Transmit Next Counter Register +#define AT91C_US0_TPR (0xFFFC0108) // (PDC_US0) Transmit Pointer Register +#define AT91C_US0_RCR (0xFFFC0104) // (PDC_US0) Receive Counter Register +#define AT91C_US0_RPR (0xFFFC0100) // (PDC_US0) Receive Pointer Register +#define AT91C_US0_RNCR (0xFFFC0114) // (PDC_US0) Receive Next Counter Register +// ========== Register definition for US0 peripheral ========== +#define AT91C_US0_BRGR (0xFFFC0020) // (US0) Baud Rate Generator Register +#define AT91C_US0_NER (0xFFFC0044) // (US0) Nb Errors Register +#define AT91C_US0_CR (0xFFFC0000) // (US0) Control Register +#define AT91C_US0_IMR (0xFFFC0010) // (US0) Interrupt Mask Register +#define AT91C_US0_FIDI (0xFFFC0040) // (US0) FI_DI_Ratio Register +#define AT91C_US0_TTGR (0xFFFC0028) // (US0) Transmitter Time-guard Register +#define AT91C_US0_MR (0xFFFC0004) // (US0) Mode Register +#define AT91C_US0_RTOR (0xFFFC0024) // (US0) Receiver Time-out Register +#define AT91C_US0_CSR (0xFFFC0014) // (US0) Channel Status Register +#define AT91C_US0_RHR (0xFFFC0018) // (US0) Receiver Holding Register +#define AT91C_US0_IDR (0xFFFC000C) // (US0) Interrupt Disable Register +#define AT91C_US0_THR (0xFFFC001C) // (US0) Transmitter Holding Register +#define AT91C_US0_IF (0xFFFC004C) // (US0) IRDA_FILTER Register +#define AT91C_US0_IER (0xFFFC0008) // (US0) Interrupt Enable Register +// ========== Register definition for PDC_SSC peripheral ========== +#define AT91C_SSC_TNCR (0xFFFD411C) // (PDC_SSC) Transmit Next Counter Register +#define AT91C_SSC_RPR (0xFFFD4100) // (PDC_SSC) Receive Pointer Register +#define AT91C_SSC_RNCR (0xFFFD4114) // (PDC_SSC) Receive Next Counter Register +#define AT91C_SSC_TPR (0xFFFD4108) // (PDC_SSC) Transmit Pointer Register +#define AT91C_SSC_PTCR (0xFFFD4120) // (PDC_SSC) PDC Transfer Control Register +#define AT91C_SSC_TCR (0xFFFD410C) // (PDC_SSC) Transmit Counter Register +#define AT91C_SSC_RCR (0xFFFD4104) // (PDC_SSC) Receive Counter Register +#define AT91C_SSC_RNPR (0xFFFD4110) // (PDC_SSC) Receive Next Pointer Register +#define AT91C_SSC_TNPR (0xFFFD4118) // (PDC_SSC) Transmit Next Pointer Register +#define AT91C_SSC_PTSR (0xFFFD4124) // (PDC_SSC) PDC Transfer Status Register +// ========== Register definition for SSC peripheral ========== +#define AT91C_SSC_RHR (0xFFFD4020) // (SSC) Receive Holding Register +#define AT91C_SSC_RSHR (0xFFFD4030) // (SSC) Receive Sync Holding Register +#define AT91C_SSC_TFMR (0xFFFD401C) // (SSC) Transmit Frame Mode Register +#define AT91C_SSC_IDR (0xFFFD4048) // (SSC) Interrupt Disable Register +#define AT91C_SSC_THR (0xFFFD4024) // (SSC) Transmit Holding Register +#define AT91C_SSC_RCMR (0xFFFD4010) // (SSC) Receive Clock ModeRegister +#define AT91C_SSC_IER (0xFFFD4044) // (SSC) Interrupt Enable Register +#define AT91C_SSC_TSHR (0xFFFD4034) // (SSC) Transmit Sync Holding Register +#define AT91C_SSC_SR (0xFFFD4040) // (SSC) Status Register +#define AT91C_SSC_CMR (0xFFFD4004) // (SSC) Clock Mode Register +#define AT91C_SSC_TCMR (0xFFFD4018) // (SSC) Transmit Clock Mode Register +#define AT91C_SSC_CR (0xFFFD4000) // (SSC) Control Register +#define AT91C_SSC_IMR (0xFFFD404C) // (SSC) Interrupt Mask Register +#define AT91C_SSC_RFMR (0xFFFD4014) // (SSC) Receive Frame Mode Register +// ========== Register definition for TWI peripheral ========== +#define AT91C_TWI_IER (0xFFFB8024) // (TWI) Interrupt Enable Register +#define AT91C_TWI_CR (0xFFFB8000) // (TWI) Control Register +#define AT91C_TWI_SR (0xFFFB8020) // (TWI) Status Register +#define AT91C_TWI_IMR (0xFFFB802C) // (TWI) Interrupt Mask Register +#define AT91C_TWI_THR (0xFFFB8034) // (TWI) Transmit Holding Register +#define AT91C_TWI_IDR (0xFFFB8028) // (TWI) Interrupt Disable Register +#define AT91C_TWI_IADR (0xFFFB800C) // (TWI) Internal Address Register +#define AT91C_TWI_MMR (0xFFFB8004) // (TWI) Master Mode Register +#define AT91C_TWI_CWGR (0xFFFB8010) // (TWI) Clock Waveform Generator Register +#define AT91C_TWI_RHR (0xFFFB8030) // (TWI) Receive Holding Register +// ========== Register definition for PWMC_CH3 peripheral ========== +#define AT91C_PWMC_CH3_CUPDR (0xFFFCC270) // (PWMC_CH3) Channel Update Register +#define AT91C_PWMC_CH3_Reserved (0xFFFCC274) // (PWMC_CH3) Reserved +#define AT91C_PWMC_CH3_CPRDR (0xFFFCC268) // (PWMC_CH3) Channel Period Register +#define AT91C_PWMC_CH3_CDTYR (0xFFFCC264) // (PWMC_CH3) Channel Duty Cycle Register +#define AT91C_PWMC_CH3_CCNTR (0xFFFCC26C) // (PWMC_CH3) Channel Counter Register +#define AT91C_PWMC_CH3_CMR (0xFFFCC260) // (PWMC_CH3) Channel Mode Register +// ========== Register definition for PWMC_CH2 peripheral ========== +#define AT91C_PWMC_CH2_Reserved (0xFFFCC254) // (PWMC_CH2) Reserved +#define AT91C_PWMC_CH2_CMR (0xFFFCC240) // (PWMC_CH2) Channel Mode Register +#define AT91C_PWMC_CH2_CCNTR (0xFFFCC24C) // (PWMC_CH2) Channel Counter Register +#define AT91C_PWMC_CH2_CPRDR (0xFFFCC248) // (PWMC_CH2) Channel Period Register +#define AT91C_PWMC_CH2_CUPDR (0xFFFCC250) // (PWMC_CH2) Channel Update Register +#define AT91C_PWMC_CH2_CDTYR (0xFFFCC244) // (PWMC_CH2) Channel Duty Cycle Register +// ========== Register definition for PWMC_CH1 peripheral ========== +#define AT91C_PWMC_CH1_Reserved (0xFFFCC234) // (PWMC_CH1) Reserved +#define AT91C_PWMC_CH1_CUPDR (0xFFFCC230) // (PWMC_CH1) Channel Update Register +#define AT91C_PWMC_CH1_CPRDR (0xFFFCC228) // (PWMC_CH1) Channel Period Register +#define AT91C_PWMC_CH1_CCNTR (0xFFFCC22C) // (PWMC_CH1) Channel Counter Register +#define AT91C_PWMC_CH1_CDTYR (0xFFFCC224) // (PWMC_CH1) Channel Duty Cycle Register +#define AT91C_PWMC_CH1_CMR (0xFFFCC220) // (PWMC_CH1) Channel Mode Register +// ========== Register definition for PWMC_CH0 peripheral ========== +#define AT91C_PWMC_CH0_Reserved (0xFFFCC214) // (PWMC_CH0) Reserved +#define AT91C_PWMC_CH0_CPRDR (0xFFFCC208) // (PWMC_CH0) Channel Period Register +#define AT91C_PWMC_CH0_CDTYR (0xFFFCC204) // (PWMC_CH0) Channel Duty Cycle Register +#define AT91C_PWMC_CH0_CMR (0xFFFCC200) // (PWMC_CH0) Channel Mode Register +#define AT91C_PWMC_CH0_CUPDR (0xFFFCC210) // (PWMC_CH0) Channel Update Register +#define AT91C_PWMC_CH0_CCNTR (0xFFFCC20C) // (PWMC_CH0) Channel Counter Register +// ========== Register definition for PWMC peripheral ========== +#define AT91C_PWMC_IDR (0xFFFCC014) // (PWMC) PWMC Interrupt Disable Register +#define AT91C_PWMC_DIS (0xFFFCC008) // (PWMC) PWMC Disable Register +#define AT91C_PWMC_IER (0xFFFCC010) // (PWMC) PWMC Interrupt Enable Register +#define AT91C_PWMC_VR (0xFFFCC0FC) // (PWMC) PWMC Version Register +#define AT91C_PWMC_ISR (0xFFFCC01C) // (PWMC) PWMC Interrupt Status Register +#define AT91C_PWMC_SR (0xFFFCC00C) // (PWMC) PWMC Status Register +#define AT91C_PWMC_IMR (0xFFFCC018) // (PWMC) PWMC Interrupt Mask Register +#define AT91C_PWMC_MR (0xFFFCC000) // (PWMC) PWMC Mode Register +#define AT91C_PWMC_ENA (0xFFFCC004) // (PWMC) PWMC Enable Register +// ========== Register definition for UDP peripheral ========== +#define AT91C_UDP_IMR (0xFFFB0018) // (UDP) Interrupt Mask Register +#define AT91C_UDP_FADDR (0xFFFB0008) // (UDP) Function Address Register +#define AT91C_UDP_NUM (0xFFFB0000) // (UDP) Frame Number Register +#define AT91C_UDP_FDR (0xFFFB0050) // (UDP) Endpoint FIFO Data Register +#define AT91C_UDP_ISR (0xFFFB001C) // (UDP) Interrupt Status Register +#define AT91C_UDP_CSR (0xFFFB0030) // (UDP) Endpoint Control and Status Register +#define AT91C_UDP_IDR (0xFFFB0014) // (UDP) Interrupt Disable Register +#define AT91C_UDP_ICR (0xFFFB0020) // (UDP) Interrupt Clear Register +#define AT91C_UDP_RSTEP (0xFFFB0028) // (UDP) Reset Endpoint Register +#define AT91C_UDP_TXVC (0xFFFB0074) // (UDP) Transceiver Control Register +#define AT91C_UDP_GLBSTATE (0xFFFB0004) // (UDP) Global State Register +#define AT91C_UDP_IER (0xFFFB0010) // (UDP) Interrupt Enable Register +// ========== Register definition for TC0 peripheral ========== +#define AT91C_TC0_SR (0xFFFA0020) // (TC0) Status Register +#define AT91C_TC0_RC (0xFFFA001C) // (TC0) Register C +#define AT91C_TC0_RB (0xFFFA0018) // (TC0) Register B +#define AT91C_TC0_CCR (0xFFFA0000) // (TC0) Channel Control Register +#define AT91C_TC0_CMR (0xFFFA0004) // (TC0) Channel Mode Register (Capture Mode / Waveform Mode) +#define AT91C_TC0_IER (0xFFFA0024) // (TC0) Interrupt Enable Register +#define AT91C_TC0_RA (0xFFFA0014) // (TC0) Register A +#define AT91C_TC0_IDR (0xFFFA0028) // (TC0) Interrupt Disable Register +#define AT91C_TC0_CV (0xFFFA0010) // (TC0) Counter Value +#define AT91C_TC0_IMR (0xFFFA002C) // (TC0) Interrupt Mask Register +// ========== Register definition for TC1 peripheral ========== +#define AT91C_TC1_RB (0xFFFA0058) // (TC1) Register B +#define AT91C_TC1_CCR (0xFFFA0040) // (TC1) Channel Control Register +#define AT91C_TC1_IER (0xFFFA0064) // (TC1) Interrupt Enable Register +#define AT91C_TC1_IDR (0xFFFA0068) // (TC1) Interrupt Disable Register +#define AT91C_TC1_SR (0xFFFA0060) // (TC1) Status Register +#define AT91C_TC1_CMR (0xFFFA0044) // (TC1) Channel Mode Register (Capture Mode / Waveform Mode) +#define AT91C_TC1_RA (0xFFFA0054) // (TC1) Register A +#define AT91C_TC1_RC (0xFFFA005C) // (TC1) Register C +#define AT91C_TC1_IMR (0xFFFA006C) // (TC1) Interrupt Mask Register +#define AT91C_TC1_CV (0xFFFA0050) // (TC1) Counter Value +// ========== Register definition for TC2 peripheral ========== +#define AT91C_TC2_CMR (0xFFFA0084) // (TC2) Channel Mode Register (Capture Mode / Waveform Mode) +#define AT91C_TC2_CCR (0xFFFA0080) // (TC2) Channel Control Register +#define AT91C_TC2_CV (0xFFFA0090) // (TC2) Counter Value +#define AT91C_TC2_RA (0xFFFA0094) // (TC2) Register A +#define AT91C_TC2_RB (0xFFFA0098) // (TC2) Register B +#define AT91C_TC2_IDR (0xFFFA00A8) // (TC2) Interrupt Disable Register +#define AT91C_TC2_IMR (0xFFFA00AC) // (TC2) Interrupt Mask Register +#define AT91C_TC2_RC (0xFFFA009C) // (TC2) Register C +#define AT91C_TC2_IER (0xFFFA00A4) // (TC2) Interrupt Enable Register +#define AT91C_TC2_SR (0xFFFA00A0) // (TC2) Status Register +// ========== Register definition for TCB peripheral ========== +#define AT91C_TCB_BMR (0xFFFA00C4) // (TCB) TC Block Mode Register +#define AT91C_TCB_BCR (0xFFFA00C0) // (TCB) TC Block Control Register +// ========== Register definition for CAN_MB0 peripheral ========== +#define AT91C_CAN_MB0_MDL (0xFFFD0214) // (CAN_MB0) MailBox Data Low Register +#define AT91C_CAN_MB0_MAM (0xFFFD0204) // (CAN_MB0) MailBox Acceptance Mask Register +#define AT91C_CAN_MB0_MCR (0xFFFD021C) // (CAN_MB0) MailBox Control Register +#define AT91C_CAN_MB0_MID (0xFFFD0208) // (CAN_MB0) MailBox ID Register +#define AT91C_CAN_MB0_MSR (0xFFFD0210) // (CAN_MB0) MailBox Status Register +#define AT91C_CAN_MB0_MFID (0xFFFD020C) // (CAN_MB0) MailBox Family ID Register +#define AT91C_CAN_MB0_MDH (0xFFFD0218) // (CAN_MB0) MailBox Data High Register +#define AT91C_CAN_MB0_MMR (0xFFFD0200) // (CAN_MB0) MailBox Mode Register +// ========== Register definition for CAN_MB1 peripheral ========== +#define AT91C_CAN_MB1_MDL (0xFFFD0234) // (CAN_MB1) MailBox Data Low Register +#define AT91C_CAN_MB1_MID (0xFFFD0228) // (CAN_MB1) MailBox ID Register +#define AT91C_CAN_MB1_MMR (0xFFFD0220) // (CAN_MB1) MailBox Mode Register +#define AT91C_CAN_MB1_MSR (0xFFFD0230) // (CAN_MB1) MailBox Status Register +#define AT91C_CAN_MB1_MAM (0xFFFD0224) // (CAN_MB1) MailBox Acceptance Mask Register +#define AT91C_CAN_MB1_MDH (0xFFFD0238) // (CAN_MB1) MailBox Data High Register +#define AT91C_CAN_MB1_MCR (0xFFFD023C) // (CAN_MB1) MailBox Control Register +#define AT91C_CAN_MB1_MFID (0xFFFD022C) // (CAN_MB1) MailBox Family ID Register +// ========== Register definition for CAN_MB2 peripheral ========== +#define AT91C_CAN_MB2_MCR (0xFFFD025C) // (CAN_MB2) MailBox Control Register +#define AT91C_CAN_MB2_MDH (0xFFFD0258) // (CAN_MB2) MailBox Data High Register +#define AT91C_CAN_MB2_MID (0xFFFD0248) // (CAN_MB2) MailBox ID Register +#define AT91C_CAN_MB2_MDL (0xFFFD0254) // (CAN_MB2) MailBox Data Low Register +#define AT91C_CAN_MB2_MMR (0xFFFD0240) // (CAN_MB2) MailBox Mode Register +#define AT91C_CAN_MB2_MAM (0xFFFD0244) // (CAN_MB2) MailBox Acceptance Mask Register +#define AT91C_CAN_MB2_MFID (0xFFFD024C) // (CAN_MB2) MailBox Family ID Register +#define AT91C_CAN_MB2_MSR (0xFFFD0250) // (CAN_MB2) MailBox Status Register +// ========== Register definition for CAN_MB3 peripheral ========== +#define AT91C_CAN_MB3_MFID (0xFFFD026C) // (CAN_MB3) MailBox Family ID Register +#define AT91C_CAN_MB3_MAM (0xFFFD0264) // (CAN_MB3) MailBox Acceptance Mask Register +#define AT91C_CAN_MB3_MID (0xFFFD0268) // (CAN_MB3) MailBox ID Register +#define AT91C_CAN_MB3_MCR (0xFFFD027C) // (CAN_MB3) MailBox Control Register +#define AT91C_CAN_MB3_MMR (0xFFFD0260) // (CAN_MB3) MailBox Mode Register +#define AT91C_CAN_MB3_MSR (0xFFFD0270) // (CAN_MB3) MailBox Status Register +#define AT91C_CAN_MB3_MDL (0xFFFD0274) // (CAN_MB3) MailBox Data Low Register +#define AT91C_CAN_MB3_MDH (0xFFFD0278) // (CAN_MB3) MailBox Data High Register +// ========== Register definition for CAN_MB4 peripheral ========== +#define AT91C_CAN_MB4_MID (0xFFFD0288) // (CAN_MB4) MailBox ID Register +#define AT91C_CAN_MB4_MMR (0xFFFD0280) // (CAN_MB4) MailBox Mode Register +#define AT91C_CAN_MB4_MDH (0xFFFD0298) // (CAN_MB4) MailBox Data High Register +#define AT91C_CAN_MB4_MFID (0xFFFD028C) // (CAN_MB4) MailBox Family ID Register +#define AT91C_CAN_MB4_MSR (0xFFFD0290) // (CAN_MB4) MailBox Status Register +#define AT91C_CAN_MB4_MCR (0xFFFD029C) // (CAN_MB4) MailBox Control Register +#define AT91C_CAN_MB4_MDL (0xFFFD0294) // (CAN_MB4) MailBox Data Low Register +#define AT91C_CAN_MB4_MAM (0xFFFD0284) // (CAN_MB4) MailBox Acceptance Mask Register +// ========== Register definition for CAN_MB5 peripheral ========== +#define AT91C_CAN_MB5_MSR (0xFFFD02B0) // (CAN_MB5) MailBox Status Register +#define AT91C_CAN_MB5_MCR (0xFFFD02BC) // (CAN_MB5) MailBox Control Register +#define AT91C_CAN_MB5_MFID (0xFFFD02AC) // (CAN_MB5) MailBox Family ID Register +#define AT91C_CAN_MB5_MDH (0xFFFD02B8) // (CAN_MB5) MailBox Data High Register +#define AT91C_CAN_MB5_MID (0xFFFD02A8) // (CAN_MB5) MailBox ID Register +#define AT91C_CAN_MB5_MMR (0xFFFD02A0) // (CAN_MB5) MailBox Mode Register +#define AT91C_CAN_MB5_MDL (0xFFFD02B4) // (CAN_MB5) MailBox Data Low Register +#define AT91C_CAN_MB5_MAM (0xFFFD02A4) // (CAN_MB5) MailBox Acceptance Mask Register +// ========== Register definition for CAN_MB6 peripheral ========== +#define AT91C_CAN_MB6_MFID (0xFFFD02CC) // (CAN_MB6) MailBox Family ID Register +#define AT91C_CAN_MB6_MID (0xFFFD02C8) // (CAN_MB6) MailBox ID Register +#define AT91C_CAN_MB6_MAM (0xFFFD02C4) // (CAN_MB6) MailBox Acceptance Mask Register +#define AT91C_CAN_MB6_MSR (0xFFFD02D0) // (CAN_MB6) MailBox Status Register +#define AT91C_CAN_MB6_MDL (0xFFFD02D4) // (CAN_MB6) MailBox Data Low Register +#define AT91C_CAN_MB6_MCR (0xFFFD02DC) // (CAN_MB6) MailBox Control Register +#define AT91C_CAN_MB6_MDH (0xFFFD02D8) // (CAN_MB6) MailBox Data High Register +#define AT91C_CAN_MB6_MMR (0xFFFD02C0) // (CAN_MB6) MailBox Mode Register +// ========== Register definition for CAN_MB7 peripheral ========== +#define AT91C_CAN_MB7_MCR (0xFFFD02FC) // (CAN_MB7) MailBox Control Register +#define AT91C_CAN_MB7_MDH (0xFFFD02F8) // (CAN_MB7) MailBox Data High Register +#define AT91C_CAN_MB7_MFID (0xFFFD02EC) // (CAN_MB7) MailBox Family ID Register +#define AT91C_CAN_MB7_MDL (0xFFFD02F4) // (CAN_MB7) MailBox Data Low Register +#define AT91C_CAN_MB7_MID (0xFFFD02E8) // (CAN_MB7) MailBox ID Register +#define AT91C_CAN_MB7_MMR (0xFFFD02E0) // (CAN_MB7) MailBox Mode Register +#define AT91C_CAN_MB7_MAM (0xFFFD02E4) // (CAN_MB7) MailBox Acceptance Mask Register +#define AT91C_CAN_MB7_MSR (0xFFFD02F0) // (CAN_MB7) MailBox Status Register +// ========== Register definition for CAN peripheral ========== +#define AT91C_CAN_TCR (0xFFFD0024) // (CAN) Transfer Command Register +#define AT91C_CAN_IMR (0xFFFD000C) // (CAN) Interrupt Mask Register +#define AT91C_CAN_IER (0xFFFD0004) // (CAN) Interrupt Enable Register +#define AT91C_CAN_ECR (0xFFFD0020) // (CAN) Error Counter Register +#define AT91C_CAN_TIMESTP (0xFFFD001C) // (CAN) Time Stamp Register +#define AT91C_CAN_MR (0xFFFD0000) // (CAN) Mode Register +#define AT91C_CAN_IDR (0xFFFD0008) // (CAN) Interrupt Disable Register +#define AT91C_CAN_ACR (0xFFFD0028) // (CAN) Abort Command Register +#define AT91C_CAN_TIM (0xFFFD0018) // (CAN) Timer Register +#define AT91C_CAN_SR (0xFFFD0010) // (CAN) Status Register +#define AT91C_CAN_BR (0xFFFD0014) // (CAN) Baudrate Register +#define AT91C_CAN_VR (0xFFFD00FC) // (CAN) Version Register +// ========== Register definition for EMAC peripheral ========== +#define AT91C_EMAC_ISR (0xFFFDC024) // (EMAC) Interrupt Status Register +#define AT91C_EMAC_SA4H (0xFFFDC0B4) // (EMAC) Specific Address 4 Top, Last 2 bytes +#define AT91C_EMAC_SA1L (0xFFFDC098) // (EMAC) Specific Address 1 Bottom, First 4 bytes +#define AT91C_EMAC_ELE (0xFFFDC078) // (EMAC) Excessive Length Errors Register +#define AT91C_EMAC_LCOL (0xFFFDC05C) // (EMAC) Late Collision Register +#define AT91C_EMAC_RLE (0xFFFDC088) // (EMAC) Receive Length Field Mismatch Register +#define AT91C_EMAC_WOL (0xFFFDC0C4) // (EMAC) Wake On LAN Register +#define AT91C_EMAC_DTF (0xFFFDC058) // (EMAC) Deferred Transmission Frame Register +#define AT91C_EMAC_TUND (0xFFFDC064) // (EMAC) Transmit Underrun Error Register +#define AT91C_EMAC_NCR (0xFFFDC000) // (EMAC) Network Control Register +#define AT91C_EMAC_SA4L (0xFFFDC0B0) // (EMAC) Specific Address 4 Bottom, First 4 bytes +#define AT91C_EMAC_RSR (0xFFFDC020) // (EMAC) Receive Status Register +#define AT91C_EMAC_SA3L (0xFFFDC0A8) // (EMAC) Specific Address 3 Bottom, First 4 bytes +#define AT91C_EMAC_TSR (0xFFFDC014) // (EMAC) Transmit Status Register +#define AT91C_EMAC_IDR (0xFFFDC02C) // (EMAC) Interrupt Disable Register +#define AT91C_EMAC_RSE (0xFFFDC074) // (EMAC) Receive Symbol Errors Register +#define AT91C_EMAC_ECOL (0xFFFDC060) // (EMAC) Excessive Collision Register +#define AT91C_EMAC_TID (0xFFFDC0B8) // (EMAC) Type ID Checking Register +#define AT91C_EMAC_HRB (0xFFFDC090) // (EMAC) Hash Address Bottom[31:0] +#define AT91C_EMAC_TBQP (0xFFFDC01C) // (EMAC) Transmit Buffer Queue Pointer +#define AT91C_EMAC_USRIO (0xFFFDC0C0) // (EMAC) USER Input/Output Register +#define AT91C_EMAC_PTR (0xFFFDC038) // (EMAC) Pause Time Register +#define AT91C_EMAC_SA2H (0xFFFDC0A4) // (EMAC) Specific Address 2 Top, Last 2 bytes +#define AT91C_EMAC_ROV (0xFFFDC070) // (EMAC) Receive Overrun Errors Register +#define AT91C_EMAC_ALE (0xFFFDC054) // (EMAC) Alignment Error Register +#define AT91C_EMAC_RJA (0xFFFDC07C) // (EMAC) Receive Jabbers Register +#define AT91C_EMAC_RBQP (0xFFFDC018) // (EMAC) Receive Buffer Queue Pointer +#define AT91C_EMAC_TPF (0xFFFDC08C) // (EMAC) Transmitted Pause Frames Register +#define AT91C_EMAC_NCFGR (0xFFFDC004) // (EMAC) Network Configuration Register +#define AT91C_EMAC_HRT (0xFFFDC094) // (EMAC) Hash Address Top[63:32] +#define AT91C_EMAC_USF (0xFFFDC080) // (EMAC) Undersize Frames Register +#define AT91C_EMAC_FCSE (0xFFFDC050) // (EMAC) Frame Check Sequence Error Register +#define AT91C_EMAC_TPQ (0xFFFDC0BC) // (EMAC) Transmit Pause Quantum Register +#define AT91C_EMAC_MAN (0xFFFDC034) // (EMAC) PHY Maintenance Register +#define AT91C_EMAC_FTO (0xFFFDC040) // (EMAC) Frames Transmitted OK Register +#define AT91C_EMAC_REV (0xFFFDC0FC) // (EMAC) Revision Register +#define AT91C_EMAC_IMR (0xFFFDC030) // (EMAC) Interrupt Mask Register +#define AT91C_EMAC_SCF (0xFFFDC044) // (EMAC) Single Collision Frame Register +#define AT91C_EMAC_PFR (0xFFFDC03C) // (EMAC) Pause Frames received Register +#define AT91C_EMAC_MCF (0xFFFDC048) // (EMAC) Multiple Collision Frame Register +#define AT91C_EMAC_NSR (0xFFFDC008) // (EMAC) Network Status Register +#define AT91C_EMAC_SA2L (0xFFFDC0A0) // (EMAC) Specific Address 2 Bottom, First 4 bytes +#define AT91C_EMAC_FRO (0xFFFDC04C) // (EMAC) Frames Received OK Register +#define AT91C_EMAC_IER (0xFFFDC028) // (EMAC) Interrupt Enable Register +#define AT91C_EMAC_SA1H (0xFFFDC09C) // (EMAC) Specific Address 1 Top, Last 2 bytes +#define AT91C_EMAC_CSE (0xFFFDC068) // (EMAC) Carrier Sense Error Register +#define AT91C_EMAC_SA3H (0xFFFDC0AC) // (EMAC) Specific Address 3 Top, Last 2 bytes +#define AT91C_EMAC_RRE (0xFFFDC06C) // (EMAC) Receive Ressource Error Register +#define AT91C_EMAC_STE (0xFFFDC084) // (EMAC) SQE Test Error Register +// ========== Register definition for PDC_ADC peripheral ========== +#define AT91C_ADC_PTSR (0xFFFD8124) // (PDC_ADC) PDC Transfer Status Register +#define AT91C_ADC_PTCR (0xFFFD8120) // (PDC_ADC) PDC Transfer Control Register +#define AT91C_ADC_TNPR (0xFFFD8118) // (PDC_ADC) Transmit Next Pointer Register +#define AT91C_ADC_TNCR (0xFFFD811C) // (PDC_ADC) Transmit Next Counter Register +#define AT91C_ADC_RNPR (0xFFFD8110) // (PDC_ADC) Receive Next Pointer Register +#define AT91C_ADC_RNCR (0xFFFD8114) // (PDC_ADC) Receive Next Counter Register +#define AT91C_ADC_RPR (0xFFFD8100) // (PDC_ADC) Receive Pointer Register +#define AT91C_ADC_TCR (0xFFFD810C) // (PDC_ADC) Transmit Counter Register +#define AT91C_ADC_TPR (0xFFFD8108) // (PDC_ADC) Transmit Pointer Register +#define AT91C_ADC_RCR (0xFFFD8104) // (PDC_ADC) Receive Counter Register +// ========== Register definition for ADC peripheral ========== +#define AT91C_ADC_CDR2 (0xFFFD8038) // (ADC) ADC Channel Data Register 2 +#define AT91C_ADC_CDR3 (0xFFFD803C) // (ADC) ADC Channel Data Register 3 +#define AT91C_ADC_CDR0 (0xFFFD8030) // (ADC) ADC Channel Data Register 0 +#define AT91C_ADC_CDR5 (0xFFFD8044) // (ADC) ADC Channel Data Register 5 +#define AT91C_ADC_CHDR (0xFFFD8014) // (ADC) ADC Channel Disable Register +#define AT91C_ADC_SR (0xFFFD801C) // (ADC) ADC Status Register +#define AT91C_ADC_CDR4 (0xFFFD8040) // (ADC) ADC Channel Data Register 4 +#define AT91C_ADC_CDR1 (0xFFFD8034) // (ADC) ADC Channel Data Register 1 +#define AT91C_ADC_LCDR (0xFFFD8020) // (ADC) ADC Last Converted Data Register +#define AT91C_ADC_IDR (0xFFFD8028) // (ADC) ADC Interrupt Disable Register +#define AT91C_ADC_CR (0xFFFD8000) // (ADC) ADC Control Register +#define AT91C_ADC_CDR7 (0xFFFD804C) // (ADC) ADC Channel Data Register 7 +#define AT91C_ADC_CDR6 (0xFFFD8048) // (ADC) ADC Channel Data Register 6 +#define AT91C_ADC_IER (0xFFFD8024) // (ADC) ADC Interrupt Enable Register +#define AT91C_ADC_CHER (0xFFFD8010) // (ADC) ADC Channel Enable Register +#define AT91C_ADC_CHSR (0xFFFD8018) // (ADC) ADC Channel Status Register +#define AT91C_ADC_MR (0xFFFD8004) // (ADC) ADC Mode Register +#define AT91C_ADC_IMR (0xFFFD802C) // (ADC) ADC Interrupt Mask Register + +// ***************************************************************************** +// PIO DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** +#define AT91C_PIO_PA0 (1 << 0) // Pin Controlled by PA0 +#define AT91C_PA0_RXD0 (AT91C_PIO_PA0) // USART 0 Receive Data +#define AT91C_PIO_PA1 (1 << 1) // Pin Controlled by PA1 +#define AT91C_PA1_TXD0 (AT91C_PIO_PA1) // USART 0 Transmit Data +#define AT91C_PIO_PA10 (1 << 10) // Pin Controlled by PA10 +#define AT91C_PA10_TWD (AT91C_PIO_PA10) // TWI Two-wire Serial Data +#define AT91C_PIO_PA11 (1 << 11) // Pin Controlled by PA11 +#define AT91C_PA11_TWCK (AT91C_PIO_PA11) // TWI Two-wire Serial Clock +#define AT91C_PIO_PA12 (1 << 12) // Pin Controlled by PA12 +#define AT91C_PA12_SPI0_NPCS0 (AT91C_PIO_PA12) // SPI 0 Peripheral Chip Select 0 +#define AT91C_PIO_PA13 (1 << 13) // Pin Controlled by PA13 +#define AT91C_PA13_SPI0_NPCS1 (AT91C_PIO_PA13) // SPI 0 Peripheral Chip Select 1 +#define AT91C_PA13_PCK1 (AT91C_PIO_PA13) // PMC Programmable Clock Output 1 +#define AT91C_PIO_PA14 (1 << 14) // Pin Controlled by PA14 +#define AT91C_PA14_SPI0_NPCS2 (AT91C_PIO_PA14) // SPI 0 Peripheral Chip Select 2 +#define AT91C_PA14_IRQ1 (AT91C_PIO_PA14) // External Interrupt 1 +#define AT91C_PIO_PA15 (1 << 15) // Pin Controlled by PA15 +#define AT91C_PA15_SPI0_NPCS3 (AT91C_PIO_PA15) // SPI 0 Peripheral Chip Select 3 +#define AT91C_PA15_TCLK2 (AT91C_PIO_PA15) // Timer Counter 2 external clock input +#define AT91C_PIO_PA16 (1 << 16) // Pin Controlled by PA16 +#define AT91C_PA16_SPI0_MISO (AT91C_PIO_PA16) // SPI 0 Master In Slave +#define AT91C_PIO_PA17 (1 << 17) // Pin Controlled by PA17 +#define AT91C_PA17_SPI0_MOSI (AT91C_PIO_PA17) // SPI 0 Master Out Slave +#define AT91C_PIO_PA18 (1 << 18) // Pin Controlled by PA18 +#define AT91C_PA18_SPI0_SPCK (AT91C_PIO_PA18) // SPI 0 Serial Clock +#define AT91C_PIO_PA19 (1 << 19) // Pin Controlled by PA19 +#define AT91C_PA19_CANRX (AT91C_PIO_PA19) // CAN Receive +#define AT91C_PIO_PA2 (1 << 2) // Pin Controlled by PA2 +#define AT91C_PA2_SCK0 (AT91C_PIO_PA2) // USART 0 Serial Clock +#define AT91C_PA2_SPI1_NPCS1 (AT91C_PIO_PA2) // SPI 1 Peripheral Chip Select 1 +#define AT91C_PIO_PA20 (1 << 20) // Pin Controlled by PA20 +#define AT91C_PA20_CANTX (AT91C_PIO_PA20) // CAN Transmit +#define AT91C_PIO_PA21 (1 << 21) // Pin Controlled by PA21 +#define AT91C_PA21_TF (AT91C_PIO_PA21) // SSC Transmit Frame Sync +#define AT91C_PA21_SPI1_NPCS0 (AT91C_PIO_PA21) // SPI 1 Peripheral Chip Select 0 +#define AT91C_PIO_PA22 (1 << 22) // Pin Controlled by PA22 +#define AT91C_PA22_TK (AT91C_PIO_PA22) // SSC Transmit Clock +#define AT91C_PA22_SPI1_SPCK (AT91C_PIO_PA22) // SPI 1 Serial Clock +#define AT91C_PIO_PA23 (1 << 23) // Pin Controlled by PA23 +#define AT91C_PA23_TD (AT91C_PIO_PA23) // SSC Transmit data +#define AT91C_PA23_SPI1_MOSI (AT91C_PIO_PA23) // SPI 1 Master Out Slave +#define AT91C_PIO_PA24 (1 << 24) // Pin Controlled by PA24 +#define AT91C_PA24_RD (AT91C_PIO_PA24) // SSC Receive Data +#define AT91C_PA24_SPI1_MISO (AT91C_PIO_PA24) // SPI 1 Master In Slave +#define AT91C_PIO_PA25 (1 << 25) // Pin Controlled by PA25 +#define AT91C_PA25_RK (AT91C_PIO_PA25) // SSC Receive Clock +#define AT91C_PA25_SPI1_NPCS1 (AT91C_PIO_PA25) // SPI 1 Peripheral Chip Select 1 +#define AT91C_PIO_PA26 (1 << 26) // Pin Controlled by PA26 +#define AT91C_PA26_RF (AT91C_PIO_PA26) // SSC Receive Frame Sync +#define AT91C_PA26_SPI1_NPCS2 (AT91C_PIO_PA26) // SPI 1 Peripheral Chip Select 2 +#define AT91C_PIO_PA27 (1 << 27) // Pin Controlled by PA27 +#define AT91C_PA27_DRXD (AT91C_PIO_PA27) // DBGU Debug Receive Data +#define AT91C_PA27_PCK3 (AT91C_PIO_PA27) // PMC Programmable Clock Output 3 +#define AT91C_PIO_PA28 (1 << 28) // Pin Controlled by PA28 +#define AT91C_PA28_DTXD (AT91C_PIO_PA28) // DBGU Debug Transmit Data +#define AT91C_PIO_PA29 (1 << 29) // Pin Controlled by PA29 +#define AT91C_PA29_FIQ (AT91C_PIO_PA29) // AIC Fast Interrupt Input +#define AT91C_PA29_SPI1_NPCS3 (AT91C_PIO_PA29) // SPI 1 Peripheral Chip Select 3 +#define AT91C_PIO_PA3 (1 << 3) // Pin Controlled by PA3 +#define AT91C_PA3_RTS0 (AT91C_PIO_PA3) // USART 0 Ready To Send +#define AT91C_PA3_SPI1_NPCS2 (AT91C_PIO_PA3) // SPI 1 Peripheral Chip Select 2 +#define AT91C_PIO_PA30 (1 << 30) // Pin Controlled by PA30 +#define AT91C_PA30_IRQ0 (AT91C_PIO_PA30) // External Interrupt 0 +#define AT91C_PA30_PCK2 (AT91C_PIO_PA30) // PMC Programmable Clock Output 2 +#define AT91C_PIO_PA4 (1 << 4) // Pin Controlled by PA4 +#define AT91C_PA4_CTS0 (AT91C_PIO_PA4) // USART 0 Clear To Send +#define AT91C_PA4_SPI1_NPCS3 (AT91C_PIO_PA4) // SPI 1 Peripheral Chip Select 3 +#define AT91C_PIO_PA5 (1 << 5) // Pin Controlled by PA5 +#define AT91C_PA5_RXD1 (AT91C_PIO_PA5) // USART 1 Receive Data +#define AT91C_PIO_PA6 (1 << 6) // Pin Controlled by PA6 +#define AT91C_PA6_TXD1 (AT91C_PIO_PA6) // USART 1 Transmit Data +#define AT91C_PIO_PA7 (1 << 7) // Pin Controlled by PA7 +#define AT91C_PA7_SCK1 (AT91C_PIO_PA7) // USART 1 Serial Clock +#define AT91C_PA7_SPI0_NPCS1 (AT91C_PIO_PA7) // SPI 0 Peripheral Chip Select 1 +#define AT91C_PIO_PA8 (1 << 8) // Pin Controlled by PA8 +#define AT91C_PA8_RTS1 (AT91C_PIO_PA8) // USART 1 Ready To Send +#define AT91C_PA8_SPI0_NPCS2 (AT91C_PIO_PA8) // SPI 0 Peripheral Chip Select 2 +#define AT91C_PIO_PA9 (1 << 9) // Pin Controlled by PA9 +#define AT91C_PA9_CTS1 (AT91C_PIO_PA9) // USART 1 Clear To Send +#define AT91C_PA9_SPI0_NPCS3 (AT91C_PIO_PA9) // SPI 0 Peripheral Chip Select 3 +#define AT91C_PIO_PB0 (1 << 0) // Pin Controlled by PB0 +#define AT91C_PB0_ETXCK_EREFCK (AT91C_PIO_PB0) // Ethernet MAC Transmit Clock/Reference Clock +#define AT91C_PB0_PCK0 (AT91C_PIO_PB0) // PMC Programmable Clock Output 0 +#define AT91C_PIO_PB1 (1 << 1) // Pin Controlled by PB1 +#define AT91C_PB1_ETXEN (AT91C_PIO_PB1) // Ethernet MAC Transmit Enable +#define AT91C_PIO_PB10 (1 << 10) // Pin Controlled by PB10 +#define AT91C_PB10_ETX2 (AT91C_PIO_PB10) // Ethernet MAC Transmit Data 2 +#define AT91C_PB10_SPI1_NPCS1 (AT91C_PIO_PB10) // SPI 1 Peripheral Chip Select 1 +#define AT91C_PIO_PB11 (1 << 11) // Pin Controlled by PB11 +#define AT91C_PB11_ETX3 (AT91C_PIO_PB11) // Ethernet MAC Transmit Data 3 +#define AT91C_PB11_SPI1_NPCS2 (AT91C_PIO_PB11) // SPI 1 Peripheral Chip Select 2 +#define AT91C_PIO_PB12 (1 << 12) // Pin Controlled by PB12 +#define AT91C_PB12_ETXER (AT91C_PIO_PB12) // Ethernet MAC Transmikt Coding Error +#define AT91C_PB12_TCLK0 (AT91C_PIO_PB12) // Timer Counter 0 external clock input +#define AT91C_PIO_PB13 (1 << 13) // Pin Controlled by PB13 +#define AT91C_PB13_ERX2 (AT91C_PIO_PB13) // Ethernet MAC Receive Data 2 +#define AT91C_PB13_SPI0_NPCS1 (AT91C_PIO_PB13) // SPI 0 Peripheral Chip Select 1 +#define AT91C_PIO_PB14 (1 << 14) // Pin Controlled by PB14 +#define AT91C_PB14_ERX3 (AT91C_PIO_PB14) // Ethernet MAC Receive Data 3 +#define AT91C_PB14_SPI0_NPCS2 (AT91C_PIO_PB14) // SPI 0 Peripheral Chip Select 2 +#define AT91C_PIO_PB15 (1 << 15) // Pin Controlled by PB15 +#define AT91C_PB15_ERXDV_ECRSDV (AT91C_PIO_PB15) // Ethernet MAC Receive Data Valid +#define AT91C_PIO_PB16 (1 << 16) // Pin Controlled by PB16 +#define AT91C_PB16_ECOL (AT91C_PIO_PB16) // Ethernet MAC Collision Detected +#define AT91C_PB16_SPI1_NPCS3 (AT91C_PIO_PB16) // SPI 1 Peripheral Chip Select 3 +#define AT91C_PIO_PB17 (1 << 17) // Pin Controlled by PB17 +#define AT91C_PB17_ERXCK (AT91C_PIO_PB17) // Ethernet MAC Receive Clock +#define AT91C_PB17_SPI0_NPCS3 (AT91C_PIO_PB17) // SPI 0 Peripheral Chip Select 3 +#define AT91C_PIO_PB18 (1 << 18) // Pin Controlled by PB18 +#define AT91C_PB18_EF100 (AT91C_PIO_PB18) // Ethernet MAC Force 100 Mbits/sec +#define AT91C_PB18_ADTRG (AT91C_PIO_PB18) // ADC External Trigger +#define AT91C_PIO_PB19 (1 << 19) // Pin Controlled by PB19 +#define AT91C_PB19_PWM0 (AT91C_PIO_PB19) // PWM Channel 0 +#define AT91C_PB19_TCLK1 (AT91C_PIO_PB19) // Timer Counter 1 external clock input +#define AT91C_PIO_PB2 (1 << 2) // Pin Controlled by PB2 +#define AT91C_PB2_ETX0 (AT91C_PIO_PB2) // Ethernet MAC Transmit Data 0 +#define AT91C_PIO_PB20 (1 << 20) // Pin Controlled by PB20 +#define AT91C_PB20_PWM1 (AT91C_PIO_PB20) // PWM Channel 1 +#define AT91C_PB20_PCK0 (AT91C_PIO_PB20) // PMC Programmable Clock Output 0 +#define AT91C_PIO_PB21 (1 << 21) // Pin Controlled by PB21 +#define AT91C_PB21_PWM2 (AT91C_PIO_PB21) // PWM Channel 2 +#define AT91C_PB21_PCK1 (AT91C_PIO_PB21) // PMC Programmable Clock Output 1 +#define AT91C_PIO_PB22 (1 << 22) // Pin Controlled by PB22 +#define AT91C_PB22_PWM3 (AT91C_PIO_PB22) // PWM Channel 3 +#define AT91C_PB22_PCK2 (AT91C_PIO_PB22) // PMC Programmable Clock Output 2 +#define AT91C_PIO_PB23 (1 << 23) // Pin Controlled by PB23 +#define AT91C_PB23_TIOA0 (AT91C_PIO_PB23) // Timer Counter 0 Multipurpose Timer I/O Pin A +#define AT91C_PB23_DCD1 (AT91C_PIO_PB23) // USART 1 Data Carrier Detect +#define AT91C_PIO_PB24 (1 << 24) // Pin Controlled by PB24 +#define AT91C_PB24_TIOB0 (AT91C_PIO_PB24) // Timer Counter 0 Multipurpose Timer I/O Pin B +#define AT91C_PB24_DSR1 (AT91C_PIO_PB24) // USART 1 Data Set ready +#define AT91C_PIO_PB25 (1 << 25) // Pin Controlled by PB25 +#define AT91C_PB25_TIOA1 (AT91C_PIO_PB25) // Timer Counter 1 Multipurpose Timer I/O Pin A +#define AT91C_PB25_DTR1 (AT91C_PIO_PB25) // USART 1 Data Terminal ready +#define AT91C_PIO_PB26 (1 << 26) // Pin Controlled by PB26 +#define AT91C_PB26_TIOB1 (AT91C_PIO_PB26) // Timer Counter 1 Multipurpose Timer I/O Pin B +#define AT91C_PB26_RI1 (AT91C_PIO_PB26) // USART 1 Ring Indicator +#define AT91C_PIO_PB27 (1 << 27) // Pin Controlled by PB27 +#define AT91C_PB27_TIOA2 (AT91C_PIO_PB27) // Timer Counter 2 Multipurpose Timer I/O Pin A +#define AT91C_PB27_PWM0 (AT91C_PIO_PB27) // PWM Channel 0 +#define AT91C_PIO_PB28 (1 << 28) // Pin Controlled by PB28 +#define AT91C_PB28_TIOB2 (AT91C_PIO_PB28) // Timer Counter 2 Multipurpose Timer I/O Pin B +#define AT91C_PB28_PWM1 (AT91C_PIO_PB28) // PWM Channel 1 +#define AT91C_PIO_PB29 (1 << 29) // Pin Controlled by PB29 +#define AT91C_PB29_PCK1 (AT91C_PIO_PB29) // PMC Programmable Clock Output 1 +#define AT91C_PB29_PWM2 (AT91C_PIO_PB29) // PWM Channel 2 +#define AT91C_PIO_PB3 (1 << 3) // Pin Controlled by PB3 +#define AT91C_PB3_ETX1 (AT91C_PIO_PB3) // Ethernet MAC Transmit Data 1 +#define AT91C_PIO_PB30 (1 << 30) // Pin Controlled by PB30 +#define AT91C_PB30_PCK2 (AT91C_PIO_PB30) // PMC Programmable Clock Output 2 +#define AT91C_PB30_PWM3 (AT91C_PIO_PB30) // PWM Channel 3 +#define AT91C_PIO_PB4 (1 << 4) // Pin Controlled by PB4 +#define AT91C_PB4_ECRS (AT91C_PIO_PB4) // Ethernet MAC Carrier Sense/Carrier Sense and Data Valid +#define AT91C_PIO_PB5 (1 << 5) // Pin Controlled by PB5 +#define AT91C_PB5_ERX0 (AT91C_PIO_PB5) // Ethernet MAC Receive Data 0 +#define AT91C_PIO_PB6 (1 << 6) // Pin Controlled by PB6 +#define AT91C_PB6_ERX1 (AT91C_PIO_PB6) // Ethernet MAC Receive Data 1 +#define AT91C_PIO_PB7 (1 << 7) // Pin Controlled by PB7 +#define AT91C_PB7_ERXER (AT91C_PIO_PB7) // Ethernet MAC Receive Error +#define AT91C_PIO_PB8 (1 << 8) // Pin Controlled by PB8 +#define AT91C_PB8_EMDC (AT91C_PIO_PB8) // Ethernet MAC Management Data Clock +#define AT91C_PIO_PB9 (1 << 9) // Pin Controlled by PB9 +#define AT91C_PB9_EMDIO (AT91C_PIO_PB9) // Ethernet MAC Management Data Input/Output + +// ***************************************************************************** +// PERIPHERAL ID DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** +#define AT91C_ID_FIQ ( 0) // Advanced Interrupt Controller (FIQ) +#define AT91C_ID_SYS ( 1) // System Peripheral +#define AT91C_ID_PIOA ( 2) // Parallel IO Controller A +#define AT91C_ID_PIOB ( 3) // Parallel IO Controller B +#define AT91C_ID_SPI0 ( 4) // Serial Peripheral Interface 0 +#define AT91C_ID_SPI1 ( 5) // Serial Peripheral Interface 1 +#define AT91C_ID_US0 ( 6) // USART 0 +#define AT91C_ID_US1 ( 7) // USART 1 +#define AT91C_ID_SSC ( 8) // Serial Synchronous Controller +#define AT91C_ID_TWI ( 9) // Two-Wire Interface +#define AT91C_ID_PWMC (10) // PWM Controller +#define AT91C_ID_UDP (11) // USB Device Port +#define AT91C_ID_TC0 (12) // Timer Counter 0 +#define AT91C_ID_TC1 (13) // Timer Counter 1 +#define AT91C_ID_TC2 (14) // Timer Counter 2 +#define AT91C_ID_CAN (15) // Control Area Network Controller +#define AT91C_ID_EMAC (16) // Ethernet MAC +#define AT91C_ID_ADC (17) // Analog-to-Digital Converter +#define AT91C_ID_18_Reserved (18) // Reserved +#define AT91C_ID_19_Reserved (19) // Reserved +#define AT91C_ID_20_Reserved (20) // Reserved +#define AT91C_ID_21_Reserved (21) // Reserved +#define AT91C_ID_22_Reserved (22) // Reserved +#define AT91C_ID_23_Reserved (23) // Reserved +#define AT91C_ID_24_Reserved (24) // Reserved +#define AT91C_ID_25_Reserved (25) // Reserved +#define AT91C_ID_26_Reserved (26) // Reserved +#define AT91C_ID_27_Reserved (27) // Reserved +#define AT91C_ID_28_Reserved (28) // Reserved +#define AT91C_ID_29_Reserved (29) // Reserved +#define AT91C_ID_IRQ0 (30) // Advanced Interrupt Controller (IRQ0) +#define AT91C_ID_IRQ1 (31) // Advanced Interrupt Controller (IRQ1) +#define AT91C_ALL_INT (0xC003FFFF) // ALL VALID INTERRUPTS + +// ***************************************************************************** +// BASE ADDRESS DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** +#define AT91C_BASE_SYS (0xFFFFF000) // (SYS) Base Address +#define AT91C_BASE_AIC (0xFFFFF000) // (AIC) Base Address +#define AT91C_BASE_PDC_DBGU (0xFFFFF300) // (PDC_DBGU) Base Address +#define AT91C_BASE_DBGU (0xFFFFF200) // (DBGU) Base Address +#define AT91C_BASE_PIOA (0xFFFFF400) // (PIOA) Base Address +#define AT91C_BASE_PIOB (0xFFFFF600) // (PIOB) Base Address +#define AT91C_BASE_CKGR (0xFFFFFC20) // (CKGR) Base Address +#define AT91C_BASE_PMC (0xFFFFFC00) // (PMC) Base Address +#define AT91C_BASE_RSTC (0xFFFFFD00) // (RSTC) Base Address +#define AT91C_BASE_RTTC (0xFFFFFD20) // (RTTC) Base Address +#define AT91C_BASE_PITC (0xFFFFFD30) // (PITC) Base Address +#define AT91C_BASE_WDTC (0xFFFFFD40) // (WDTC) Base Address +#define AT91C_BASE_VREG (0xFFFFFD60) // (VREG) Base Address +#define AT91C_BASE_MC (0xFFFFFF00) // (MC) Base Address +#define AT91C_BASE_PDC_SPI1 (0xFFFE4100) // (PDC_SPI1) Base Address +#define AT91C_BASE_SPI1 (0xFFFE4000) // (SPI1) Base Address +#define AT91C_BASE_PDC_SPI0 (0xFFFE0100) // (PDC_SPI0) Base Address +#define AT91C_BASE_SPI0 (0xFFFE0000) // (SPI0) Base Address +#define AT91C_BASE_PDC_US1 (0xFFFC4100) // (PDC_US1) Base Address +#define AT91C_BASE_US1 (0xFFFC4000) // (US1) Base Address +#define AT91C_BASE_PDC_US0 (0xFFFC0100) // (PDC_US0) Base Address +#define AT91C_BASE_US0 (0xFFFC0000) // (US0) Base Address +#define AT91C_BASE_PDC_SSC (0xFFFD4100) // (PDC_SSC) Base Address +#define AT91C_BASE_SSC (0xFFFD4000) // (SSC) Base Address +#define AT91C_BASE_TWI (0xFFFB8000) // (TWI) Base Address +#define AT91C_BASE_PWMC_CH3 (0xFFFCC260) // (PWMC_CH3) Base Address +#define AT91C_BASE_PWMC_CH2 (0xFFFCC240) // (PWMC_CH2) Base Address +#define AT91C_BASE_PWMC_CH1 (0xFFFCC220) // (PWMC_CH1) Base Address +#define AT91C_BASE_PWMC_CH0 (0xFFFCC200) // (PWMC_CH0) Base Address +#define AT91C_BASE_PWMC (0xFFFCC000) // (PWMC) Base Address +#define AT91C_BASE_UDP (0xFFFB0000) // (UDP) Base Address +#define AT91C_BASE_TC0 (0xFFFA0000) // (TC0) Base Address +#define AT91C_BASE_TC1 (0xFFFA0040) // (TC1) Base Address +#define AT91C_BASE_TC2 (0xFFFA0080) // (TC2) Base Address +#define AT91C_BASE_TCB (0xFFFA0000) // (TCB) Base Address +#define AT91C_BASE_CAN_MB0 (0xFFFD0200) // (CAN_MB0) Base Address +#define AT91C_BASE_CAN_MB1 (0xFFFD0220) // (CAN_MB1) Base Address +#define AT91C_BASE_CAN_MB2 (0xFFFD0240) // (CAN_MB2) Base Address +#define AT91C_BASE_CAN_MB3 (0xFFFD0260) // (CAN_MB3) Base Address +#define AT91C_BASE_CAN_MB4 (0xFFFD0280) // (CAN_MB4) Base Address +#define AT91C_BASE_CAN_MB5 (0xFFFD02A0) // (CAN_MB5) Base Address +#define AT91C_BASE_CAN_MB6 (0xFFFD02C0) // (CAN_MB6) Base Address +#define AT91C_BASE_CAN_MB7 (0xFFFD02E0) // (CAN_MB7) Base Address +#define AT91C_BASE_CAN (0xFFFD0000) // (CAN) Base Address +#define AT91C_BASE_EMAC (0xFFFDC000) // (EMAC) Base Address +#define AT91C_BASE_PDC_ADC (0xFFFD8100) // (PDC_ADC) Base Address +#define AT91C_BASE_ADC (0xFFFD8000) // (ADC) Base Address + +// ***************************************************************************** +// MEMORY MAPPING DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** +// ISRAM +#define AT91C_ISRAM (0x00200000) // Internal SRAM base address +#define AT91C_ISRAM_SIZE (0x00010000) // Internal SRAM size in byte (64 Kbytes) +// IFLASH +#define AT91C_IFLASH (0x00100000) // Internal FLASH base address +#define AT91C_IFLASH_SIZE (0x00040000) // Internal FLASH size in byte (256 Kbytes) +#define AT91C_IFLASH_PAGE_SIZE (256) // Internal FLASH Page Size: 256 bytes +#define AT91C_IFLASH_LOCK_REGION_SIZE (16384) // Internal FLASH Lock Region Size: 16 Kbytes +#define AT91C_IFLASH_NB_OF_PAGES (1024) // Internal FLASH Number of Pages: 1024 bytes +#define AT91C_IFLASH_NB_OF_LOCK_BITS (16) // Internal FLASH Number of Lock Bits: 16 bytes + + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/ioat91sam7x256.h b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/ioat91sam7x256.h new file mode 100644 index 0000000..ab71b93 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/ioat91sam7x256.h @@ -0,0 +1,4380 @@ +// - ---------------------------------------------------------------------------- +// - ATMEL Microcontroller Software Support - ROUSSET - +// - ---------------------------------------------------------------------------- +// - DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// - DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// - OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// - EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// - ---------------------------------------------------------------------------- +// - File Name : AT91SAM7X256.h +// - Object : AT91SAM7X256 definitions +// - Generated : AT91 SW Application Group 11/02/2005 (15:17:24) +// - +// - CVS Reference : /AT91SAM7X256.pl/1.14/Tue Sep 13 15:06:52 2005// +// - CVS Reference : /SYS_SAM7X.pl/1.3/Tue Feb 1 17:01:43 2005// +// - CVS Reference : /MC_SAM7X.pl/1.2/Fri May 20 14:13:04 2005// +// - CVS Reference : /PMC_SAM7X.pl/1.4/Tue Feb 8 13:58:10 2005// +// - CVS Reference : /RSTC_SAM7X.pl/1.2/Wed Jul 13 14:57:50 2005// +// - CVS Reference : /UDP_SAM7X.pl/1.1/Tue May 10 11:35:35 2005// +// - CVS Reference : /PWM_SAM7X.pl/1.1/Tue May 10 11:53:07 2005// +// - CVS Reference : /AIC_6075B.pl/1.3/Fri May 20 14:01:30 2005// +// - CVS Reference : /PIO_6057A.pl/1.2/Thu Feb 3 10:18:28 2005// +// - CVS Reference : /RTTC_6081A.pl/1.2/Tue Nov 9 14:43:58 2004// +// - CVS Reference : /PITC_6079A.pl/1.2/Tue Nov 9 14:43:56 2004// +// - CVS Reference : /WDTC_6080A.pl/1.3/Tue Nov 9 14:44:00 2004// +// - CVS Reference : /VREG_6085B.pl/1.1/Tue Feb 1 16:05:48 2005// +// - CVS Reference : /PDC_6074C.pl/1.2/Thu Feb 3 08:48:54 2005// +// - CVS Reference : /DBGU_6059D.pl/1.1/Mon Jan 31 13:15:32 2005// +// - CVS Reference : /SPI_6088D.pl/1.3/Fri May 20 14:08:59 2005// +// - CVS Reference : /US_6089C.pl/1.1/Mon Jul 12 18:23:26 2004// +// - CVS Reference : /SSC_6078B.pl/1.1/Wed Jul 13 15:19:19 2005// +// - CVS Reference : /TWI_6061A.pl/1.1/Tue Jul 13 07:38:06 2004// +// - CVS Reference : /TC_6082A.pl/1.7/Fri Mar 11 12:52:17 2005// +// - CVS Reference : /CAN_6019B.pl/1.1/Tue Mar 8 12:42:22 2005// +// - CVS Reference : /EMACB_6119A.pl/1.6/Wed Jul 13 15:05:35 2005// +// - CVS Reference : /ADC_6051C.pl/1.1/Fri Oct 17 09:12:38 2003// +// - ---------------------------------------------------------------------------- + +#ifndef AT91SAM7X256_H +#define AT91SAM7X256_H + +#ifdef __IAR_SYSTEMS_ICC__ + +typedef volatile unsigned int AT91_REG;// Hardware register definition + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR System Peripherals +// ***************************************************************************** +typedef struct _AT91S_SYS { + AT91_REG AIC_SMR[32]; // Source Mode Register + AT91_REG AIC_SVR[32]; // Source Vector Register + AT91_REG AIC_IVR; // IRQ Vector Register + AT91_REG AIC_FVR; // FIQ Vector Register + AT91_REG AIC_ISR; // Interrupt Status Register + AT91_REG AIC_IPR; // Interrupt Pending Register + AT91_REG AIC_IMR; // Interrupt Mask Register + AT91_REG AIC_CISR; // Core Interrupt Status Register + AT91_REG Reserved0[2]; // + AT91_REG AIC_IECR; // Interrupt Enable Command Register + AT91_REG AIC_IDCR; // Interrupt Disable Command Register + AT91_REG AIC_ICCR; // Interrupt Clear Command Register + AT91_REG AIC_ISCR; // Interrupt Set Command Register + AT91_REG AIC_EOICR; // End of Interrupt Command Register + AT91_REG AIC_SPU; // Spurious Vector Register + AT91_REG AIC_DCR; // Debug Control Register (Protect) + AT91_REG Reserved1[1]; // + AT91_REG AIC_FFER; // Fast Forcing Enable Register + AT91_REG AIC_FFDR; // Fast Forcing Disable Register + AT91_REG AIC_FFSR; // Fast Forcing Status Register + AT91_REG Reserved2[45]; // + AT91_REG DBGU_CR; // Control Register + AT91_REG DBGU_MR; // Mode Register + AT91_REG DBGU_IER; // Interrupt Enable Register + AT91_REG DBGU_IDR; // Interrupt Disable Register + AT91_REG DBGU_IMR; // Interrupt Mask Register + AT91_REG DBGU_CSR; // Channel Status Register + AT91_REG DBGU_RHR; // Receiver Holding Register + AT91_REG DBGU_THR; // Transmitter Holding Register + AT91_REG DBGU_BRGR; // Baud Rate Generator Register + AT91_REG Reserved3[7]; // + AT91_REG DBGU_CIDR; // Chip ID Register + AT91_REG DBGU_EXID; // Chip ID Extension Register + AT91_REG DBGU_FNTR; // Force NTRST Register + AT91_REG Reserved4[45]; // + AT91_REG DBGU_RPR; // Receive Pointer Register + AT91_REG DBGU_RCR; // Receive Counter Register + AT91_REG DBGU_TPR; // Transmit Pointer Register + AT91_REG DBGU_TCR; // Transmit Counter Register + AT91_REG DBGU_RNPR; // Receive Next Pointer Register + AT91_REG DBGU_RNCR; // Receive Next Counter Register + AT91_REG DBGU_TNPR; // Transmit Next Pointer Register + AT91_REG DBGU_TNCR; // Transmit Next Counter Register + AT91_REG DBGU_PTCR; // PDC Transfer Control Register + AT91_REG DBGU_PTSR; // PDC Transfer Status Register + AT91_REG Reserved5[54]; // + AT91_REG PIOA_PER; // PIO Enable Register + AT91_REG PIOA_PDR; // PIO Disable Register + AT91_REG PIOA_PSR; // PIO Status Register + AT91_REG Reserved6[1]; // + AT91_REG PIOA_OER; // Output Enable Register + AT91_REG PIOA_ODR; // Output Disable Registerr + AT91_REG PIOA_OSR; // Output Status Register + AT91_REG Reserved7[1]; // + AT91_REG PIOA_IFER; // Input Filter Enable Register + AT91_REG PIOA_IFDR; // Input Filter Disable Register + AT91_REG PIOA_IFSR; // Input Filter Status Register + AT91_REG Reserved8[1]; // + AT91_REG PIOA_SODR; // Set Output Data Register + AT91_REG PIOA_CODR; // Clear Output Data Register + AT91_REG PIOA_ODSR; // Output Data Status Register + AT91_REG PIOA_PDSR; // Pin Data Status Register + AT91_REG PIOA_IER; // Interrupt Enable Register + AT91_REG PIOA_IDR; // Interrupt Disable Register + AT91_REG PIOA_IMR; // Interrupt Mask Register + AT91_REG PIOA_ISR; // Interrupt Status Register + AT91_REG PIOA_MDER; // Multi-driver Enable Register + AT91_REG PIOA_MDDR; // Multi-driver Disable Register + AT91_REG PIOA_MDSR; // Multi-driver Status Register + AT91_REG Reserved9[1]; // + AT91_REG PIOA_PPUDR; // Pull-up Disable Register + AT91_REG PIOA_PPUER; // Pull-up Enable Register + AT91_REG PIOA_PPUSR; // Pull-up Status Register + AT91_REG Reserved10[1]; // + AT91_REG PIOA_ASR; // Select A Register + AT91_REG PIOA_BSR; // Select B Register + AT91_REG PIOA_ABSR; // AB Select Status Register + AT91_REG Reserved11[9]; // + AT91_REG PIOA_OWER; // Output Write Enable Register + AT91_REG PIOA_OWDR; // Output Write Disable Register + AT91_REG PIOA_OWSR; // Output Write Status Register + AT91_REG Reserved12[85]; // + AT91_REG PIOB_PER; // PIO Enable Register + AT91_REG PIOB_PDR; // PIO Disable Register + AT91_REG PIOB_PSR; // PIO Status Register + AT91_REG Reserved13[1]; // + AT91_REG PIOB_OER; // Output Enable Register + AT91_REG PIOB_ODR; // Output Disable Registerr + AT91_REG PIOB_OSR; // Output Status Register + AT91_REG Reserved14[1]; // + AT91_REG PIOB_IFER; // Input Filter Enable Register + AT91_REG PIOB_IFDR; // Input Filter Disable Register + AT91_REG PIOB_IFSR; // Input Filter Status Register + AT91_REG Reserved15[1]; // + AT91_REG PIOB_SODR; // Set Output Data Register + AT91_REG PIOB_CODR; // Clear Output Data Register + AT91_REG PIOB_ODSR; // Output Data Status Register + AT91_REG PIOB_PDSR; // Pin Data Status Register + AT91_REG PIOB_IER; // Interrupt Enable Register + AT91_REG PIOB_IDR; // Interrupt Disable Register + AT91_REG PIOB_IMR; // Interrupt Mask Register + AT91_REG PIOB_ISR; // Interrupt Status Register + AT91_REG PIOB_MDER; // Multi-driver Enable Register + AT91_REG PIOB_MDDR; // Multi-driver Disable Register + AT91_REG PIOB_MDSR; // Multi-driver Status Register + AT91_REG Reserved16[1]; // + AT91_REG PIOB_PPUDR; // Pull-up Disable Register + AT91_REG PIOB_PPUER; // Pull-up Enable Register + AT91_REG PIOB_PPUSR; // Pull-up Status Register + AT91_REG Reserved17[1]; // + AT91_REG PIOB_ASR; // Select A Register + AT91_REG PIOB_BSR; // Select B Register + AT91_REG PIOB_ABSR; // AB Select Status Register + AT91_REG Reserved18[9]; // + AT91_REG PIOB_OWER; // Output Write Enable Register + AT91_REG PIOB_OWDR; // Output Write Disable Register + AT91_REG PIOB_OWSR; // Output Write Status Register + AT91_REG Reserved19[341]; // + AT91_REG PMC_SCER; // System Clock Enable Register + AT91_REG PMC_SCDR; // System Clock Disable Register + AT91_REG PMC_SCSR; // System Clock Status Register + AT91_REG Reserved20[1]; // + AT91_REG PMC_PCER; // Peripheral Clock Enable Register + AT91_REG PMC_PCDR; // Peripheral Clock Disable Register + AT91_REG PMC_PCSR; // Peripheral Clock Status Register + AT91_REG Reserved21[1]; // + AT91_REG PMC_MOR; // Main Oscillator Register + AT91_REG PMC_MCFR; // Main Clock Frequency Register + AT91_REG Reserved22[1]; // + AT91_REG PMC_PLLR; // PLL Register + AT91_REG PMC_MCKR; // Master Clock Register + AT91_REG Reserved23[3]; // + AT91_REG PMC_PCKR[4]; // Programmable Clock Register + AT91_REG Reserved24[4]; // + AT91_REG PMC_IER; // Interrupt Enable Register + AT91_REG PMC_IDR; // Interrupt Disable Register + AT91_REG PMC_SR; // Status Register + AT91_REG PMC_IMR; // Interrupt Mask Register + AT91_REG Reserved25[36]; // + AT91_REG RSTC_RCR; // Reset Control Register + AT91_REG RSTC_RSR; // Reset Status Register + AT91_REG RSTC_RMR; // Reset Mode Register + AT91_REG Reserved26[5]; // + AT91_REG RTTC_RTMR; // Real-time Mode Register + AT91_REG RTTC_RTAR; // Real-time Alarm Register + AT91_REG RTTC_RTVR; // Real-time Value Register + AT91_REG RTTC_RTSR; // Real-time Status Register + AT91_REG PITC_PIMR; // Period Interval Mode Register + AT91_REG PITC_PISR; // Period Interval Status Register + AT91_REG PITC_PIVR; // Period Interval Value Register + AT91_REG PITC_PIIR; // Period Interval Image Register + AT91_REG WDTC_WDCR; // Watchdog Control Register + AT91_REG WDTC_WDMR; // Watchdog Mode Register + AT91_REG WDTC_WDSR; // Watchdog Status Register + AT91_REG Reserved27[5]; // + AT91_REG VREG_MR; // Voltage Regulator Mode Register +} AT91S_SYS, *AT91PS_SYS; + + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Advanced Interrupt Controller +// ***************************************************************************** +typedef struct _AT91S_AIC { + AT91_REG AIC_SMR[32]; // Source Mode Register + AT91_REG AIC_SVR[32]; // Source Vector Register + AT91_REG AIC_IVR; // IRQ Vector Register + AT91_REG AIC_FVR; // FIQ Vector Register + AT91_REG AIC_ISR; // Interrupt Status Register + AT91_REG AIC_IPR; // Interrupt Pending Register + AT91_REG AIC_IMR; // Interrupt Mask Register + AT91_REG AIC_CISR; // Core Interrupt Status Register + AT91_REG Reserved0[2]; // + AT91_REG AIC_IECR; // Interrupt Enable Command Register + AT91_REG AIC_IDCR; // Interrupt Disable Command Register + AT91_REG AIC_ICCR; // Interrupt Clear Command Register + AT91_REG AIC_ISCR; // Interrupt Set Command Register + AT91_REG AIC_EOICR; // End of Interrupt Command Register + AT91_REG AIC_SPU; // Spurious Vector Register + AT91_REG AIC_DCR; // Debug Control Register (Protect) + AT91_REG Reserved1[1]; // + AT91_REG AIC_FFER; // Fast Forcing Enable Register + AT91_REG AIC_FFDR; // Fast Forcing Disable Register + AT91_REG AIC_FFSR; // Fast Forcing Status Register +} AT91S_AIC, *AT91PS_AIC; + +// -------- AIC_SMR : (AIC Offset: 0x0) Control Register -------- +#define AT91C_AIC_PRIOR ((unsigned int) 0x7 << 0) // (AIC) Priority Level +#define AT91C_AIC_PRIOR_LOWEST ((unsigned int) 0x0) // (AIC) Lowest priority level +#define AT91C_AIC_PRIOR_HIGHEST ((unsigned int) 0x7) // (AIC) Highest priority level +#define AT91C_AIC_SRCTYPE ((unsigned int) 0x3 << 5) // (AIC) Interrupt Source Type +#define AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL ((unsigned int) 0x0 << 5) // (AIC) Internal Sources Code Label High-level Sensitive +#define AT91C_AIC_SRCTYPE_EXT_LOW_LEVEL ((unsigned int) 0x0 << 5) // (AIC) External Sources Code Label Low-level Sensitive +#define AT91C_AIC_SRCTYPE_INT_POSITIVE_EDGE ((unsigned int) 0x1 << 5) // (AIC) Internal Sources Code Label Positive Edge triggered +#define AT91C_AIC_SRCTYPE_EXT_NEGATIVE_EDGE ((unsigned int) 0x1 << 5) // (AIC) External Sources Code Label Negative Edge triggered +#define AT91C_AIC_SRCTYPE_HIGH_LEVEL ((unsigned int) 0x2 << 5) // (AIC) Internal Or External Sources Code Label High-level Sensitive +#define AT91C_AIC_SRCTYPE_POSITIVE_EDGE ((unsigned int) 0x3 << 5) // (AIC) Internal Or External Sources Code Label Positive Edge triggered +// -------- AIC_CISR : (AIC Offset: 0x114) AIC Core Interrupt Status Register -------- +#define AT91C_AIC_NFIQ ((unsigned int) 0x1 << 0) // (AIC) NFIQ Status +#define AT91C_AIC_NIRQ ((unsigned int) 0x1 << 1) // (AIC) NIRQ Status +// -------- AIC_DCR : (AIC Offset: 0x138) AIC Debug Control Register (Protect) -------- +#define AT91C_AIC_DCR_PROT ((unsigned int) 0x1 << 0) // (AIC) Protection Mode +#define AT91C_AIC_DCR_GMSK ((unsigned int) 0x1 << 1) // (AIC) General Mask + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Peripheral DMA Controller +// ***************************************************************************** +typedef struct _AT91S_PDC { + AT91_REG PDC_RPR; // Receive Pointer Register + AT91_REG PDC_RCR; // Receive Counter Register + AT91_REG PDC_TPR; // Transmit Pointer Register + AT91_REG PDC_TCR; // Transmit Counter Register + AT91_REG PDC_RNPR; // Receive Next Pointer Register + AT91_REG PDC_RNCR; // Receive Next Counter Register + AT91_REG PDC_TNPR; // Transmit Next Pointer Register + AT91_REG PDC_TNCR; // Transmit Next Counter Register + AT91_REG PDC_PTCR; // PDC Transfer Control Register + AT91_REG PDC_PTSR; // PDC Transfer Status Register +} AT91S_PDC, *AT91PS_PDC; + +// -------- PDC_PTCR : (PDC Offset: 0x20) PDC Transfer Control Register -------- +#define AT91C_PDC_RXTEN ((unsigned int) 0x1 << 0) // (PDC) Receiver Transfer Enable +#define AT91C_PDC_RXTDIS ((unsigned int) 0x1 << 1) // (PDC) Receiver Transfer Disable +#define AT91C_PDC_TXTEN ((unsigned int) 0x1 << 8) // (PDC) Transmitter Transfer Enable +#define AT91C_PDC_TXTDIS ((unsigned int) 0x1 << 9) // (PDC) Transmitter Transfer Disable +// -------- PDC_PTSR : (PDC Offset: 0x24) PDC Transfer Status Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Debug Unit +// ***************************************************************************** +typedef struct _AT91S_DBGU { + AT91_REG DBGU_CR; // Control Register + AT91_REG DBGU_MR; // Mode Register + AT91_REG DBGU_IER; // Interrupt Enable Register + AT91_REG DBGU_IDR; // Interrupt Disable Register + AT91_REG DBGU_IMR; // Interrupt Mask Register + AT91_REG DBGU_CSR; // Channel Status Register + AT91_REG DBGU_RHR; // Receiver Holding Register + AT91_REG DBGU_THR; // Transmitter Holding Register + AT91_REG DBGU_BRGR; // Baud Rate Generator Register + AT91_REG Reserved0[7]; // + AT91_REG DBGU_CIDR; // Chip ID Register + AT91_REG DBGU_EXID; // Chip ID Extension Register + AT91_REG DBGU_FNTR; // Force NTRST Register + AT91_REG Reserved1[45]; // + AT91_REG DBGU_RPR; // Receive Pointer Register + AT91_REG DBGU_RCR; // Receive Counter Register + AT91_REG DBGU_TPR; // Transmit Pointer Register + AT91_REG DBGU_TCR; // Transmit Counter Register + AT91_REG DBGU_RNPR; // Receive Next Pointer Register + AT91_REG DBGU_RNCR; // Receive Next Counter Register + AT91_REG DBGU_TNPR; // Transmit Next Pointer Register + AT91_REG DBGU_TNCR; // Transmit Next Counter Register + AT91_REG DBGU_PTCR; // PDC Transfer Control Register + AT91_REG DBGU_PTSR; // PDC Transfer Status Register +} AT91S_DBGU, *AT91PS_DBGU; + +// -------- DBGU_CR : (DBGU Offset: 0x0) Debug Unit Control Register -------- +#define AT91C_US_RSTRX ((unsigned int) 0x1 << 2) // (DBGU) Reset Receiver +#define AT91C_US_RSTTX ((unsigned int) 0x1 << 3) // (DBGU) Reset Transmitter +#define AT91C_US_RXEN ((unsigned int) 0x1 << 4) // (DBGU) Receiver Enable +#define AT91C_US_RXDIS ((unsigned int) 0x1 << 5) // (DBGU) Receiver Disable +#define AT91C_US_TXEN ((unsigned int) 0x1 << 6) // (DBGU) Transmitter Enable +#define AT91C_US_TXDIS ((unsigned int) 0x1 << 7) // (DBGU) Transmitter Disable +#define AT91C_US_RSTSTA ((unsigned int) 0x1 << 8) // (DBGU) Reset Status Bits +// -------- DBGU_MR : (DBGU Offset: 0x4) Debug Unit Mode Register -------- +#define AT91C_US_PAR ((unsigned int) 0x7 << 9) // (DBGU) Parity type +#define AT91C_US_PAR_EVEN ((unsigned int) 0x0 << 9) // (DBGU) Even Parity +#define AT91C_US_PAR_ODD ((unsigned int) 0x1 << 9) // (DBGU) Odd Parity +#define AT91C_US_PAR_SPACE ((unsigned int) 0x2 << 9) // (DBGU) Parity forced to 0 (Space) +#define AT91C_US_PAR_MARK ((unsigned int) 0x3 << 9) // (DBGU) Parity forced to 1 (Mark) +#define AT91C_US_PAR_NONE ((unsigned int) 0x4 << 9) // (DBGU) No Parity +#define AT91C_US_PAR_MULTI_DROP ((unsigned int) 0x6 << 9) // (DBGU) Multi-drop mode +#define AT91C_US_CHMODE ((unsigned int) 0x3 << 14) // (DBGU) Channel Mode +#define AT91C_US_CHMODE_NORMAL ((unsigned int) 0x0 << 14) // (DBGU) Normal Mode: The USART channel operates as an RX/TX USART. +#define AT91C_US_CHMODE_AUTO ((unsigned int) 0x1 << 14) // (DBGU) Automatic Echo: Receiver Data Input is connected to the TXD pin. +#define AT91C_US_CHMODE_LOCAL ((unsigned int) 0x2 << 14) // (DBGU) Local Loopback: Transmitter Output Signal is connected to Receiver Input Signal. +#define AT91C_US_CHMODE_REMOTE ((unsigned int) 0x3 << 14) // (DBGU) Remote Loopback: RXD pin is internally connected to TXD pin. +// -------- DBGU_IER : (DBGU Offset: 0x8) Debug Unit Interrupt Enable Register -------- +#define AT91C_US_RXRDY ((unsigned int) 0x1 << 0) // (DBGU) RXRDY Interrupt +#define AT91C_US_TXRDY ((unsigned int) 0x1 << 1) // (DBGU) TXRDY Interrupt +#define AT91C_US_ENDRX ((unsigned int) 0x1 << 3) // (DBGU) End of Receive Transfer Interrupt +#define AT91C_US_ENDTX ((unsigned int) 0x1 << 4) // (DBGU) End of Transmit Interrupt +#define AT91C_US_OVRE ((unsigned int) 0x1 << 5) // (DBGU) Overrun Interrupt +#define AT91C_US_FRAME ((unsigned int) 0x1 << 6) // (DBGU) Framing Error Interrupt +#define AT91C_US_PARE ((unsigned int) 0x1 << 7) // (DBGU) Parity Error Interrupt +#define AT91C_US_TXEMPTY ((unsigned int) 0x1 << 9) // (DBGU) TXEMPTY Interrupt +#define AT91C_US_TXBUFE ((unsigned int) 0x1 << 11) // (DBGU) TXBUFE Interrupt +#define AT91C_US_RXBUFF ((unsigned int) 0x1 << 12) // (DBGU) RXBUFF Interrupt +#define AT91C_US_COMM_TX ((unsigned int) 0x1 << 30) // (DBGU) COMM_TX Interrupt +#define AT91C_US_COMM_RX ((unsigned int) 0x1 << 31) // (DBGU) COMM_RX Interrupt +// -------- DBGU_IDR : (DBGU Offset: 0xc) Debug Unit Interrupt Disable Register -------- +// -------- DBGU_IMR : (DBGU Offset: 0x10) Debug Unit Interrupt Mask Register -------- +// -------- DBGU_CSR : (DBGU Offset: 0x14) Debug Unit Channel Status Register -------- +// -------- DBGU_FNTR : (DBGU Offset: 0x48) Debug Unit FORCE_NTRST Register -------- +#define AT91C_US_FORCE_NTRST ((unsigned int) 0x1 << 0) // (DBGU) Force NTRST in JTAG + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Parallel Input Output Controler +// ***************************************************************************** +typedef struct _AT91S_PIO { + AT91_REG PIO_PER; // PIO Enable Register + AT91_REG PIO_PDR; // PIO Disable Register + AT91_REG PIO_PSR; // PIO Status Register + AT91_REG Reserved0[1]; // + AT91_REG PIO_OER; // Output Enable Register + AT91_REG PIO_ODR; // Output Disable Registerr + AT91_REG PIO_OSR; // Output Status Register + AT91_REG Reserved1[1]; // + AT91_REG PIO_IFER; // Input Filter Enable Register + AT91_REG PIO_IFDR; // Input Filter Disable Register + AT91_REG PIO_IFSR; // Input Filter Status Register + AT91_REG Reserved2[1]; // + AT91_REG PIO_SODR; // Set Output Data Register + AT91_REG PIO_CODR; // Clear Output Data Register + AT91_REG PIO_ODSR; // Output Data Status Register + AT91_REG PIO_PDSR; // Pin Data Status Register + AT91_REG PIO_IER; // Interrupt Enable Register + AT91_REG PIO_IDR; // Interrupt Disable Register + AT91_REG PIO_IMR; // Interrupt Mask Register + AT91_REG PIO_ISR; // Interrupt Status Register + AT91_REG PIO_MDER; // Multi-driver Enable Register + AT91_REG PIO_MDDR; // Multi-driver Disable Register + AT91_REG PIO_MDSR; // Multi-driver Status Register + AT91_REG Reserved3[1]; // + AT91_REG PIO_PPUDR; // Pull-up Disable Register + AT91_REG PIO_PPUER; // Pull-up Enable Register + AT91_REG PIO_PPUSR; // Pull-up Status Register + AT91_REG Reserved4[1]; // + AT91_REG PIO_ASR; // Select A Register + AT91_REG PIO_BSR; // Select B Register + AT91_REG PIO_ABSR; // AB Select Status Register + AT91_REG Reserved5[9]; // + AT91_REG PIO_OWER; // Output Write Enable Register + AT91_REG PIO_OWDR; // Output Write Disable Register + AT91_REG PIO_OWSR; // Output Write Status Register +} AT91S_PIO, *AT91PS_PIO; + + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Clock Generator Controler +// ***************************************************************************** +typedef struct _AT91S_CKGR { + AT91_REG CKGR_MOR; // Main Oscillator Register + AT91_REG CKGR_MCFR; // Main Clock Frequency Register + AT91_REG Reserved0[1]; // + AT91_REG CKGR_PLLR; // PLL Register +} AT91S_CKGR, *AT91PS_CKGR; + +// -------- CKGR_MOR : (CKGR Offset: 0x0) Main Oscillator Register -------- +#define AT91C_CKGR_MOSCEN ((unsigned int) 0x1 << 0) // (CKGR) Main Oscillator Enable +#define AT91C_CKGR_OSCBYPASS ((unsigned int) 0x1 << 1) // (CKGR) Main Oscillator Bypass +#define AT91C_CKGR_OSCOUNT ((unsigned int) 0xFF << 8) // (CKGR) Main Oscillator Start-up Time +// -------- CKGR_MCFR : (CKGR Offset: 0x4) Main Clock Frequency Register -------- +#define AT91C_CKGR_MAINF ((unsigned int) 0xFFFF << 0) // (CKGR) Main Clock Frequency +#define AT91C_CKGR_MAINRDY ((unsigned int) 0x1 << 16) // (CKGR) Main Clock Ready +// -------- CKGR_PLLR : (CKGR Offset: 0xc) PLL B Register -------- +#define AT91C_CKGR_DIV ((unsigned int) 0xFF << 0) // (CKGR) Divider Selected +#define AT91C_CKGR_DIV_0 ((unsigned int) 0x0) // (CKGR) Divider output is 0 +#define AT91C_CKGR_DIV_BYPASS ((unsigned int) 0x1) // (CKGR) Divider is bypassed +#define AT91C_CKGR_PLLCOUNT ((unsigned int) 0x3F << 8) // (CKGR) PLL Counter +#define AT91C_CKGR_OUT ((unsigned int) 0x3 << 14) // (CKGR) PLL Output Frequency Range +#define AT91C_CKGR_OUT_0 ((unsigned int) 0x0 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_OUT_1 ((unsigned int) 0x1 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_OUT_2 ((unsigned int) 0x2 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_OUT_3 ((unsigned int) 0x3 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_MUL ((unsigned int) 0x7FF << 16) // (CKGR) PLL Multiplier +#define AT91C_CKGR_USBDIV ((unsigned int) 0x3 << 28) // (CKGR) Divider for USB Clocks +#define AT91C_CKGR_USBDIV_0 ((unsigned int) 0x0 << 28) // (CKGR) Divider output is PLL clock output +#define AT91C_CKGR_USBDIV_1 ((unsigned int) 0x1 << 28) // (CKGR) Divider output is PLL clock output divided by 2 +#define AT91C_CKGR_USBDIV_2 ((unsigned int) 0x2 << 28) // (CKGR) Divider output is PLL clock output divided by 4 + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Power Management Controler +// ***************************************************************************** +typedef struct _AT91S_PMC { + AT91_REG PMC_SCER; // System Clock Enable Register + AT91_REG PMC_SCDR; // System Clock Disable Register + AT91_REG PMC_SCSR; // System Clock Status Register + AT91_REG Reserved0[1]; // + AT91_REG PMC_PCER; // Peripheral Clock Enable Register + AT91_REG PMC_PCDR; // Peripheral Clock Disable Register + AT91_REG PMC_PCSR; // Peripheral Clock Status Register + AT91_REG Reserved1[1]; // + AT91_REG PMC_MOR; // Main Oscillator Register + AT91_REG PMC_MCFR; // Main Clock Frequency Register + AT91_REG Reserved2[1]; // + AT91_REG PMC_PLLR; // PLL Register + AT91_REG PMC_MCKR; // Master Clock Register + AT91_REG Reserved3[3]; // + AT91_REG PMC_PCKR[4]; // Programmable Clock Register + AT91_REG Reserved4[4]; // + AT91_REG PMC_IER; // Interrupt Enable Register + AT91_REG PMC_IDR; // Interrupt Disable Register + AT91_REG PMC_SR; // Status Register + AT91_REG PMC_IMR; // Interrupt Mask Register +} AT91S_PMC, *AT91PS_PMC; + +// -------- PMC_SCER : (PMC Offset: 0x0) System Clock Enable Register -------- +#define AT91C_PMC_PCK ((unsigned int) 0x1 << 0) // (PMC) Processor Clock +#define AT91C_PMC_UDP ((unsigned int) 0x1 << 7) // (PMC) USB Device Port Clock +#define AT91C_PMC_PCK0 ((unsigned int) 0x1 << 8) // (PMC) Programmable Clock Output +#define AT91C_PMC_PCK1 ((unsigned int) 0x1 << 9) // (PMC) Programmable Clock Output +#define AT91C_PMC_PCK2 ((unsigned int) 0x1 << 10) // (PMC) Programmable Clock Output +#define AT91C_PMC_PCK3 ((unsigned int) 0x1 << 11) // (PMC) Programmable Clock Output +// -------- PMC_SCDR : (PMC Offset: 0x4) System Clock Disable Register -------- +// -------- PMC_SCSR : (PMC Offset: 0x8) System Clock Status Register -------- +// -------- CKGR_MOR : (PMC Offset: 0x20) Main Oscillator Register -------- +// -------- CKGR_MCFR : (PMC Offset: 0x24) Main Clock Frequency Register -------- +// -------- CKGR_PLLR : (PMC Offset: 0x2c) PLL B Register -------- +// -------- PMC_MCKR : (PMC Offset: 0x30) Master Clock Register -------- +#define AT91C_PMC_CSS ((unsigned int) 0x3 << 0) // (PMC) Programmable Clock Selection +#define AT91C_PMC_CSS_SLOW_CLK ((unsigned int) 0x0) // (PMC) Slow Clock is selected +#define AT91C_PMC_CSS_MAIN_CLK ((unsigned int) 0x1) // (PMC) Main Clock is selected +#define AT91C_PMC_CSS_PLL_CLK ((unsigned int) 0x3) // (PMC) Clock from PLL is selected +#define AT91C_PMC_PRES ((unsigned int) 0x7 << 2) // (PMC) Programmable Clock Prescaler +#define AT91C_PMC_PRES_CLK ((unsigned int) 0x0 << 2) // (PMC) Selected clock +#define AT91C_PMC_PRES_CLK_2 ((unsigned int) 0x1 << 2) // (PMC) Selected clock divided by 2 +#define AT91C_PMC_PRES_CLK_4 ((unsigned int) 0x2 << 2) // (PMC) Selected clock divided by 4 +#define AT91C_PMC_PRES_CLK_8 ((unsigned int) 0x3 << 2) // (PMC) Selected clock divided by 8 +#define AT91C_PMC_PRES_CLK_16 ((unsigned int) 0x4 << 2) // (PMC) Selected clock divided by 16 +#define AT91C_PMC_PRES_CLK_32 ((unsigned int) 0x5 << 2) // (PMC) Selected clock divided by 32 +#define AT91C_PMC_PRES_CLK_64 ((unsigned int) 0x6 << 2) // (PMC) Selected clock divided by 64 +// -------- PMC_PCKR : (PMC Offset: 0x40) Programmable Clock Register -------- +// -------- PMC_IER : (PMC Offset: 0x60) PMC Interrupt Enable Register -------- +#define AT91C_PMC_MOSCS ((unsigned int) 0x1 << 0) // (PMC) MOSC Status/Enable/Disable/Mask +#define AT91C_PMC_LOCK ((unsigned int) 0x1 << 2) // (PMC) PLL Status/Enable/Disable/Mask +#define AT91C_PMC_MCKRDY ((unsigned int) 0x1 << 3) // (PMC) MCK_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK0RDY ((unsigned int) 0x1 << 8) // (PMC) PCK0_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK1RDY ((unsigned int) 0x1 << 9) // (PMC) PCK1_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK2RDY ((unsigned int) 0x1 << 10) // (PMC) PCK2_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK3RDY ((unsigned int) 0x1 << 11) // (PMC) PCK3_RDY Status/Enable/Disable/Mask +// -------- PMC_IDR : (PMC Offset: 0x64) PMC Interrupt Disable Register -------- +// -------- PMC_SR : (PMC Offset: 0x68) PMC Status Register -------- +// -------- PMC_IMR : (PMC Offset: 0x6c) PMC Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Reset Controller Interface +// ***************************************************************************** +typedef struct _AT91S_RSTC { + AT91_REG RSTC_RCR; // Reset Control Register + AT91_REG RSTC_RSR; // Reset Status Register + AT91_REG RSTC_RMR; // Reset Mode Register +} AT91S_RSTC, *AT91PS_RSTC; + +// -------- RSTC_RCR : (RSTC Offset: 0x0) Reset Control Register -------- +#define AT91C_RSTC_PROCRST ((unsigned int) 0x1 << 0) // (RSTC) Processor Reset +#define AT91C_RSTC_PERRST ((unsigned int) 0x1 << 2) // (RSTC) Peripheral Reset +#define AT91C_RSTC_EXTRST ((unsigned int) 0x1 << 3) // (RSTC) External Reset +#define AT91C_RSTC_KEY ((unsigned int) 0xFF << 24) // (RSTC) Password +// -------- RSTC_RSR : (RSTC Offset: 0x4) Reset Status Register -------- +#define AT91C_RSTC_URSTS ((unsigned int) 0x1 << 0) // (RSTC) User Reset Status +#define AT91C_RSTC_BODSTS ((unsigned int) 0x1 << 1) // (RSTC) Brownout Detection Status +#define AT91C_RSTC_RSTTYP ((unsigned int) 0x7 << 8) // (RSTC) Reset Type +#define AT91C_RSTC_RSTTYP_POWERUP ((unsigned int) 0x0 << 8) // (RSTC) Power-up Reset. VDDCORE rising. +#define AT91C_RSTC_RSTTYP_WAKEUP ((unsigned int) 0x1 << 8) // (RSTC) WakeUp Reset. VDDCORE rising. +#define AT91C_RSTC_RSTTYP_WATCHDOG ((unsigned int) 0x2 << 8) // (RSTC) Watchdog Reset. Watchdog overflow occured. +#define AT91C_RSTC_RSTTYP_SOFTWARE ((unsigned int) 0x3 << 8) // (RSTC) Software Reset. Processor reset required by the software. +#define AT91C_RSTC_RSTTYP_USER ((unsigned int) 0x4 << 8) // (RSTC) User Reset. NRST pin detected low. +#define AT91C_RSTC_RSTTYP_BROWNOUT ((unsigned int) 0x5 << 8) // (RSTC) Brownout Reset occured. +#define AT91C_RSTC_NRSTL ((unsigned int) 0x1 << 16) // (RSTC) NRST pin level +#define AT91C_RSTC_SRCMP ((unsigned int) 0x1 << 17) // (RSTC) Software Reset Command in Progress. +// -------- RSTC_RMR : (RSTC Offset: 0x8) Reset Mode Register -------- +#define AT91C_RSTC_URSTEN ((unsigned int) 0x1 << 0) // (RSTC) User Reset Enable +#define AT91C_RSTC_URSTIEN ((unsigned int) 0x1 << 4) // (RSTC) User Reset Interrupt Enable +#define AT91C_RSTC_ERSTL ((unsigned int) 0xF << 8) // (RSTC) User Reset Length +#define AT91C_RSTC_BODIEN ((unsigned int) 0x1 << 16) // (RSTC) Brownout Detection Interrupt Enable + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Real Time Timer Controller Interface +// ***************************************************************************** +typedef struct _AT91S_RTTC { + AT91_REG RTTC_RTMR; // Real-time Mode Register + AT91_REG RTTC_RTAR; // Real-time Alarm Register + AT91_REG RTTC_RTVR; // Real-time Value Register + AT91_REG RTTC_RTSR; // Real-time Status Register +} AT91S_RTTC, *AT91PS_RTTC; + +// -------- RTTC_RTMR : (RTTC Offset: 0x0) Real-time Mode Register -------- +#define AT91C_RTTC_RTPRES ((unsigned int) 0xFFFF << 0) // (RTTC) Real-time Timer Prescaler Value +#define AT91C_RTTC_ALMIEN ((unsigned int) 0x1 << 16) // (RTTC) Alarm Interrupt Enable +#define AT91C_RTTC_RTTINCIEN ((unsigned int) 0x1 << 17) // (RTTC) Real Time Timer Increment Interrupt Enable +#define AT91C_RTTC_RTTRST ((unsigned int) 0x1 << 18) // (RTTC) Real Time Timer Restart +// -------- RTTC_RTAR : (RTTC Offset: 0x4) Real-time Alarm Register -------- +#define AT91C_RTTC_ALMV ((unsigned int) 0x0 << 0) // (RTTC) Alarm Value +// -------- RTTC_RTVR : (RTTC Offset: 0x8) Current Real-time Value Register -------- +#define AT91C_RTTC_CRTV ((unsigned int) 0x0 << 0) // (RTTC) Current Real-time Value +// -------- RTTC_RTSR : (RTTC Offset: 0xc) Real-time Status Register -------- +#define AT91C_RTTC_ALMS ((unsigned int) 0x1 << 0) // (RTTC) Real-time Alarm Status +#define AT91C_RTTC_RTTINC ((unsigned int) 0x1 << 1) // (RTTC) Real-time Timer Increment + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Periodic Interval Timer Controller Interface +// ***************************************************************************** +typedef struct _AT91S_PITC { + AT91_REG PITC_PIMR; // Period Interval Mode Register + AT91_REG PITC_PISR; // Period Interval Status Register + AT91_REG PITC_PIVR; // Period Interval Value Register + AT91_REG PITC_PIIR; // Period Interval Image Register +} AT91S_PITC, *AT91PS_PITC; + +// -------- PITC_PIMR : (PITC Offset: 0x0) Periodic Interval Mode Register -------- +#define AT91C_PITC_PIV ((unsigned int) 0xFFFFF << 0) // (PITC) Periodic Interval Value +#define AT91C_PITC_PITEN ((unsigned int) 0x1 << 24) // (PITC) Periodic Interval Timer Enabled +#define AT91C_PITC_PITIEN ((unsigned int) 0x1 << 25) // (PITC) Periodic Interval Timer Interrupt Enable +// -------- PITC_PISR : (PITC Offset: 0x4) Periodic Interval Status Register -------- +#define AT91C_PITC_PITS ((unsigned int) 0x1 << 0) // (PITC) Periodic Interval Timer Status +// -------- PITC_PIVR : (PITC Offset: 0x8) Periodic Interval Value Register -------- +#define AT91C_PITC_CPIV ((unsigned int) 0xFFFFF << 0) // (PITC) Current Periodic Interval Value +#define AT91C_PITC_PICNT ((unsigned int) 0xFFF << 20) // (PITC) Periodic Interval Counter +// -------- PITC_PIIR : (PITC Offset: 0xc) Periodic Interval Image Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Watchdog Timer Controller Interface +// ***************************************************************************** +typedef struct _AT91S_WDTC { + AT91_REG WDTC_WDCR; // Watchdog Control Register + AT91_REG WDTC_WDMR; // Watchdog Mode Register + AT91_REG WDTC_WDSR; // Watchdog Status Register +} AT91S_WDTC, *AT91PS_WDTC; + +// -------- WDTC_WDCR : (WDTC Offset: 0x0) Periodic Interval Image Register -------- +#define AT91C_WDTC_WDRSTT ((unsigned int) 0x1 << 0) // (WDTC) Watchdog Restart +#define AT91C_WDTC_KEY ((unsigned int) 0xFF << 24) // (WDTC) Watchdog KEY Password +// -------- WDTC_WDMR : (WDTC Offset: 0x4) Watchdog Mode Register -------- +#define AT91C_WDTC_WDV ((unsigned int) 0xFFF << 0) // (WDTC) Watchdog Timer Restart +#define AT91C_WDTC_WDFIEN ((unsigned int) 0x1 << 12) // (WDTC) Watchdog Fault Interrupt Enable +#define AT91C_WDTC_WDRSTEN ((unsigned int) 0x1 << 13) // (WDTC) Watchdog Reset Enable +#define AT91C_WDTC_WDRPROC ((unsigned int) 0x1 << 14) // (WDTC) Watchdog Timer Restart +#define AT91C_WDTC_WDDIS ((unsigned int) 0x1 << 15) // (WDTC) Watchdog Disable +#define AT91C_WDTC_WDD ((unsigned int) 0xFFF << 16) // (WDTC) Watchdog Delta Value +#define AT91C_WDTC_WDDBGHLT ((unsigned int) 0x1 << 28) // (WDTC) Watchdog Debug Halt +#define AT91C_WDTC_WDIDLEHLT ((unsigned int) 0x1 << 29) // (WDTC) Watchdog Idle Halt +// -------- WDTC_WDSR : (WDTC Offset: 0x8) Watchdog Status Register -------- +#define AT91C_WDTC_WDUNF ((unsigned int) 0x1 << 0) // (WDTC) Watchdog Underflow +#define AT91C_WDTC_WDERR ((unsigned int) 0x1 << 1) // (WDTC) Watchdog Error + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Voltage Regulator Mode Controller Interface +// ***************************************************************************** +typedef struct _AT91S_VREG { + AT91_REG VREG_MR; // Voltage Regulator Mode Register +} AT91S_VREG, *AT91PS_VREG; + +// -------- VREG_MR : (VREG Offset: 0x0) Voltage Regulator Mode Register -------- +#define AT91C_VREG_PSTDBY ((unsigned int) 0x1 << 0) // (VREG) Voltage Regulator Power Standby Mode + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Memory Controller Interface +// ***************************************************************************** +typedef struct _AT91S_MC { + AT91_REG MC_RCR; // MC Remap Control Register + AT91_REG MC_ASR; // MC Abort Status Register + AT91_REG MC_AASR; // MC Abort Address Status Register + AT91_REG Reserved0[21]; // + AT91_REG MC_FMR; // MC Flash Mode Register + AT91_REG MC_FCR; // MC Flash Command Register + AT91_REG MC_FSR; // MC Flash Status Register +} AT91S_MC, *AT91PS_MC; + +// -------- MC_RCR : (MC Offset: 0x0) MC Remap Control Register -------- +#define AT91C_MC_RCB ((unsigned int) 0x1 << 0) // (MC) Remap Command Bit +// -------- MC_ASR : (MC Offset: 0x4) MC Abort Status Register -------- +#define AT91C_MC_UNDADD ((unsigned int) 0x1 << 0) // (MC) Undefined Addess Abort Status +#define AT91C_MC_MISADD ((unsigned int) 0x1 << 1) // (MC) Misaligned Addess Abort Status +#define AT91C_MC_ABTSZ ((unsigned int) 0x3 << 8) // (MC) Abort Size Status +#define AT91C_MC_ABTSZ_BYTE ((unsigned int) 0x0 << 8) // (MC) Byte +#define AT91C_MC_ABTSZ_HWORD ((unsigned int) 0x1 << 8) // (MC) Half-word +#define AT91C_MC_ABTSZ_WORD ((unsigned int) 0x2 << 8) // (MC) Word +#define AT91C_MC_ABTTYP ((unsigned int) 0x3 << 10) // (MC) Abort Type Status +#define AT91C_MC_ABTTYP_DATAR ((unsigned int) 0x0 << 10) // (MC) Data Read +#define AT91C_MC_ABTTYP_DATAW ((unsigned int) 0x1 << 10) // (MC) Data Write +#define AT91C_MC_ABTTYP_FETCH ((unsigned int) 0x2 << 10) // (MC) Code Fetch +#define AT91C_MC_MST0 ((unsigned int) 0x1 << 16) // (MC) Master 0 Abort Source +#define AT91C_MC_MST1 ((unsigned int) 0x1 << 17) // (MC) Master 1 Abort Source +#define AT91C_MC_SVMST0 ((unsigned int) 0x1 << 24) // (MC) Saved Master 0 Abort Source +#define AT91C_MC_SVMST1 ((unsigned int) 0x1 << 25) // (MC) Saved Master 1 Abort Source +// -------- MC_FMR : (MC Offset: 0x60) MC Flash Mode Register -------- +#define AT91C_MC_FRDY ((unsigned int) 0x1 << 0) // (MC) Flash Ready +#define AT91C_MC_LOCKE ((unsigned int) 0x1 << 2) // (MC) Lock Error +#define AT91C_MC_PROGE ((unsigned int) 0x1 << 3) // (MC) Programming Error +#define AT91C_MC_NEBP ((unsigned int) 0x1 << 7) // (MC) No Erase Before Programming +#define AT91C_MC_FWS ((unsigned int) 0x3 << 8) // (MC) Flash Wait State +#define AT91C_MC_FWS_0FWS ((unsigned int) 0x0 << 8) // (MC) 1 cycle for Read, 2 for Write operations +#define AT91C_MC_FWS_1FWS ((unsigned int) 0x1 << 8) // (MC) 2 cycles for Read, 3 for Write operations +#define AT91C_MC_FWS_2FWS ((unsigned int) 0x2 << 8) // (MC) 3 cycles for Read, 4 for Write operations +#define AT91C_MC_FWS_3FWS ((unsigned int) 0x3 << 8) // (MC) 4 cycles for Read, 4 for Write operations +#define AT91C_MC_FMCN ((unsigned int) 0xFF << 16) // (MC) Flash Microsecond Cycle Number +// -------- MC_FCR : (MC Offset: 0x64) MC Flash Command Register -------- +#define AT91C_MC_FCMD ((unsigned int) 0xF << 0) // (MC) Flash Command +#define AT91C_MC_FCMD_START_PROG ((unsigned int) 0x1) // (MC) Starts the programming of th epage specified by PAGEN. +#define AT91C_MC_FCMD_LOCK ((unsigned int) 0x2) // (MC) Starts a lock sequence of the sector defined by the bits 4 to 7 of the field PAGEN. +#define AT91C_MC_FCMD_PROG_AND_LOCK ((unsigned int) 0x3) // (MC) The lock sequence automatically happens after the programming sequence is completed. +#define AT91C_MC_FCMD_UNLOCK ((unsigned int) 0x4) // (MC) Starts an unlock sequence of the sector defined by the bits 4 to 7 of the field PAGEN. +#define AT91C_MC_FCMD_ERASE_ALL ((unsigned int) 0x8) // (MC) Starts the erase of the entire flash.If at least a page is locked, the command is cancelled. +#define AT91C_MC_FCMD_SET_GP_NVM ((unsigned int) 0xB) // (MC) Set General Purpose NVM bits. +#define AT91C_MC_FCMD_CLR_GP_NVM ((unsigned int) 0xD) // (MC) Clear General Purpose NVM bits. +#define AT91C_MC_FCMD_SET_SECURITY ((unsigned int) 0xF) // (MC) Set Security Bit. +#define AT91C_MC_PAGEN ((unsigned int) 0x3FF << 8) // (MC) Page Number +#define AT91C_MC_KEY ((unsigned int) 0xFF << 24) // (MC) Writing Protect Key +// -------- MC_FSR : (MC Offset: 0x68) MC Flash Command Register -------- +#define AT91C_MC_SECURITY ((unsigned int) 0x1 << 4) // (MC) Security Bit Status +#define AT91C_MC_GPNVM0 ((unsigned int) 0x1 << 8) // (MC) Sector 0 Lock Status +#define AT91C_MC_GPNVM1 ((unsigned int) 0x1 << 9) // (MC) Sector 1 Lock Status +#define AT91C_MC_GPNVM2 ((unsigned int) 0x1 << 10) // (MC) Sector 2 Lock Status +#define AT91C_MC_GPNVM3 ((unsigned int) 0x1 << 11) // (MC) Sector 3 Lock Status +#define AT91C_MC_GPNVM4 ((unsigned int) 0x1 << 12) // (MC) Sector 4 Lock Status +#define AT91C_MC_GPNVM5 ((unsigned int) 0x1 << 13) // (MC) Sector 5 Lock Status +#define AT91C_MC_GPNVM6 ((unsigned int) 0x1 << 14) // (MC) Sector 6 Lock Status +#define AT91C_MC_GPNVM7 ((unsigned int) 0x1 << 15) // (MC) Sector 7 Lock Status +#define AT91C_MC_LOCKS0 ((unsigned int) 0x1 << 16) // (MC) Sector 0 Lock Status +#define AT91C_MC_LOCKS1 ((unsigned int) 0x1 << 17) // (MC) Sector 1 Lock Status +#define AT91C_MC_LOCKS2 ((unsigned int) 0x1 << 18) // (MC) Sector 2 Lock Status +#define AT91C_MC_LOCKS3 ((unsigned int) 0x1 << 19) // (MC) Sector 3 Lock Status +#define AT91C_MC_LOCKS4 ((unsigned int) 0x1 << 20) // (MC) Sector 4 Lock Status +#define AT91C_MC_LOCKS5 ((unsigned int) 0x1 << 21) // (MC) Sector 5 Lock Status +#define AT91C_MC_LOCKS6 ((unsigned int) 0x1 << 22) // (MC) Sector 6 Lock Status +#define AT91C_MC_LOCKS7 ((unsigned int) 0x1 << 23) // (MC) Sector 7 Lock Status +#define AT91C_MC_LOCKS8 ((unsigned int) 0x1 << 24) // (MC) Sector 8 Lock Status +#define AT91C_MC_LOCKS9 ((unsigned int) 0x1 << 25) // (MC) Sector 9 Lock Status +#define AT91C_MC_LOCKS10 ((unsigned int) 0x1 << 26) // (MC) Sector 10 Lock Status +#define AT91C_MC_LOCKS11 ((unsigned int) 0x1 << 27) // (MC) Sector 11 Lock Status +#define AT91C_MC_LOCKS12 ((unsigned int) 0x1 << 28) // (MC) Sector 12 Lock Status +#define AT91C_MC_LOCKS13 ((unsigned int) 0x1 << 29) // (MC) Sector 13 Lock Status +#define AT91C_MC_LOCKS14 ((unsigned int) 0x1 << 30) // (MC) Sector 14 Lock Status +#define AT91C_MC_LOCKS15 ((unsigned int) 0x1 << 31) // (MC) Sector 15 Lock Status + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Serial Parallel Interface +// ***************************************************************************** +typedef struct _AT91S_SPI { + AT91_REG SPI_CR; // Control Register + AT91_REG SPI_MR; // Mode Register + AT91_REG SPI_RDR; // Receive Data Register + AT91_REG SPI_TDR; // Transmit Data Register + AT91_REG SPI_SR; // Status Register + AT91_REG SPI_IER; // Interrupt Enable Register + AT91_REG SPI_IDR; // Interrupt Disable Register + AT91_REG SPI_IMR; // Interrupt Mask Register + AT91_REG Reserved0[4]; // + AT91_REG SPI_CSR[4]; // Chip Select Register + AT91_REG Reserved1[48]; // + AT91_REG SPI_RPR; // Receive Pointer Register + AT91_REG SPI_RCR; // Receive Counter Register + AT91_REG SPI_TPR; // Transmit Pointer Register + AT91_REG SPI_TCR; // Transmit Counter Register + AT91_REG SPI_RNPR; // Receive Next Pointer Register + AT91_REG SPI_RNCR; // Receive Next Counter Register + AT91_REG SPI_TNPR; // Transmit Next Pointer Register + AT91_REG SPI_TNCR; // Transmit Next Counter Register + AT91_REG SPI_PTCR; // PDC Transfer Control Register + AT91_REG SPI_PTSR; // PDC Transfer Status Register +} AT91S_SPI, *AT91PS_SPI; + +// -------- SPI_CR : (SPI Offset: 0x0) SPI Control Register -------- +#define AT91C_SPI_SPIEN ((unsigned int) 0x1 << 0) // (SPI) SPI Enable +#define AT91C_SPI_SPIDIS ((unsigned int) 0x1 << 1) // (SPI) SPI Disable +#define AT91C_SPI_SWRST ((unsigned int) 0x1 << 7) // (SPI) SPI Software reset +#define AT91C_SPI_LASTXFER ((unsigned int) 0x1 << 24) // (SPI) SPI Last Transfer +// -------- SPI_MR : (SPI Offset: 0x4) SPI Mode Register -------- +#define AT91C_SPI_MSTR ((unsigned int) 0x1 << 0) // (SPI) Master/Slave Mode +#define AT91C_SPI_PS ((unsigned int) 0x1 << 1) // (SPI) Peripheral Select +#define AT91C_SPI_PS_FIXED ((unsigned int) 0x0 << 1) // (SPI) Fixed Peripheral Select +#define AT91C_SPI_PS_VARIABLE ((unsigned int) 0x1 << 1) // (SPI) Variable Peripheral Select +#define AT91C_SPI_PCSDEC ((unsigned int) 0x1 << 2) // (SPI) Chip Select Decode +#define AT91C_SPI_FDIV ((unsigned int) 0x1 << 3) // (SPI) Clock Selection +#define AT91C_SPI_MODFDIS ((unsigned int) 0x1 << 4) // (SPI) Mode Fault Detection +#define AT91C_SPI_LLB ((unsigned int) 0x1 << 7) // (SPI) Clock Selection +#define AT91C_SPI_PCS ((unsigned int) 0xF << 16) // (SPI) Peripheral Chip Select +#define AT91C_SPI_DLYBCS ((unsigned int) 0xFF << 24) // (SPI) Delay Between Chip Selects +// -------- SPI_RDR : (SPI Offset: 0x8) Receive Data Register -------- +#define AT91C_SPI_RD ((unsigned int) 0xFFFF << 0) // (SPI) Receive Data +#define AT91C_SPI_RPCS ((unsigned int) 0xF << 16) // (SPI) Peripheral Chip Select Status +// -------- SPI_TDR : (SPI Offset: 0xc) Transmit Data Register -------- +#define AT91C_SPI_TD ((unsigned int) 0xFFFF << 0) // (SPI) Transmit Data +#define AT91C_SPI_TPCS ((unsigned int) 0xF << 16) // (SPI) Peripheral Chip Select Status +// -------- SPI_SR : (SPI Offset: 0x10) Status Register -------- +#define AT91C_SPI_RDRF ((unsigned int) 0x1 << 0) // (SPI) Receive Data Register Full +#define AT91C_SPI_TDRE ((unsigned int) 0x1 << 1) // (SPI) Transmit Data Register Empty +#define AT91C_SPI_MODF ((unsigned int) 0x1 << 2) // (SPI) Mode Fault Error +#define AT91C_SPI_OVRES ((unsigned int) 0x1 << 3) // (SPI) Overrun Error Status +#define AT91C_SPI_ENDRX ((unsigned int) 0x1 << 4) // (SPI) End of Receiver Transfer +#define AT91C_SPI_ENDTX ((unsigned int) 0x1 << 5) // (SPI) End of Receiver Transfer +#define AT91C_SPI_RXBUFF ((unsigned int) 0x1 << 6) // (SPI) RXBUFF Interrupt +#define AT91C_SPI_TXBUFE ((unsigned int) 0x1 << 7) // (SPI) TXBUFE Interrupt +#define AT91C_SPI_NSSR ((unsigned int) 0x1 << 8) // (SPI) NSSR Interrupt +#define AT91C_SPI_TXEMPTY ((unsigned int) 0x1 << 9) // (SPI) TXEMPTY Interrupt +#define AT91C_SPI_SPIENS ((unsigned int) 0x1 << 16) // (SPI) Enable Status +// -------- SPI_IER : (SPI Offset: 0x14) Interrupt Enable Register -------- +// -------- SPI_IDR : (SPI Offset: 0x18) Interrupt Disable Register -------- +// -------- SPI_IMR : (SPI Offset: 0x1c) Interrupt Mask Register -------- +// -------- SPI_CSR : (SPI Offset: 0x30) Chip Select Register -------- +#define AT91C_SPI_CPOL ((unsigned int) 0x1 << 0) // (SPI) Clock Polarity +#define AT91C_SPI_NCPHA ((unsigned int) 0x1 << 1) // (SPI) Clock Phase +#define AT91C_SPI_CSAAT ((unsigned int) 0x1 << 3) // (SPI) Chip Select Active After Transfer +#define AT91C_SPI_BITS ((unsigned int) 0xF << 4) // (SPI) Bits Per Transfer +#define AT91C_SPI_BITS_8 ((unsigned int) 0x0 << 4) // (SPI) 8 Bits Per transfer +#define AT91C_SPI_BITS_9 ((unsigned int) 0x1 << 4) // (SPI) 9 Bits Per transfer +#define AT91C_SPI_BITS_10 ((unsigned int) 0x2 << 4) // (SPI) 10 Bits Per transfer +#define AT91C_SPI_BITS_11 ((unsigned int) 0x3 << 4) // (SPI) 11 Bits Per transfer +#define AT91C_SPI_BITS_12 ((unsigned int) 0x4 << 4) // (SPI) 12 Bits Per transfer +#define AT91C_SPI_BITS_13 ((unsigned int) 0x5 << 4) // (SPI) 13 Bits Per transfer +#define AT91C_SPI_BITS_14 ((unsigned int) 0x6 << 4) // (SPI) 14 Bits Per transfer +#define AT91C_SPI_BITS_15 ((unsigned int) 0x7 << 4) // (SPI) 15 Bits Per transfer +#define AT91C_SPI_BITS_16 ((unsigned int) 0x8 << 4) // (SPI) 16 Bits Per transfer +#define AT91C_SPI_SCBR ((unsigned int) 0xFF << 8) // (SPI) Serial Clock Baud Rate +#define AT91C_SPI_DLYBS ((unsigned int) 0xFF << 16) // (SPI) Delay Before SPCK +#define AT91C_SPI_DLYBCT ((unsigned int) 0xFF << 24) // (SPI) Delay Between Consecutive Transfers + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Usart +// ***************************************************************************** +typedef struct _AT91S_USART { + AT91_REG US_CR; // Control Register + AT91_REG US_MR; // Mode Register + AT91_REG US_IER; // Interrupt Enable Register + AT91_REG US_IDR; // Interrupt Disable Register + AT91_REG US_IMR; // Interrupt Mask Register + AT91_REG US_CSR; // Channel Status Register + AT91_REG US_RHR; // Receiver Holding Register + AT91_REG US_THR; // Transmitter Holding Register + AT91_REG US_BRGR; // Baud Rate Generator Register + AT91_REG US_RTOR; // Receiver Time-out Register + AT91_REG US_TTGR; // Transmitter Time-guard Register + AT91_REG Reserved0[5]; // + AT91_REG US_FIDI; // FI_DI_Ratio Register + AT91_REG US_NER; // Nb Errors Register + AT91_REG Reserved1[1]; // + AT91_REG US_IF; // IRDA_FILTER Register + AT91_REG Reserved2[44]; // + AT91_REG US_RPR; // Receive Pointer Register + AT91_REG US_RCR; // Receive Counter Register + AT91_REG US_TPR; // Transmit Pointer Register + AT91_REG US_TCR; // Transmit Counter Register + AT91_REG US_RNPR; // Receive Next Pointer Register + AT91_REG US_RNCR; // Receive Next Counter Register + AT91_REG US_TNPR; // Transmit Next Pointer Register + AT91_REG US_TNCR; // Transmit Next Counter Register + AT91_REG US_PTCR; // PDC Transfer Control Register + AT91_REG US_PTSR; // PDC Transfer Status Register +} AT91S_USART, *AT91PS_USART; + +// -------- US_CR : (USART Offset: 0x0) Debug Unit Control Register -------- +#define AT91C_US_STTBRK ((unsigned int) 0x1 << 9) // (USART) Start Break +#define AT91C_US_STPBRK ((unsigned int) 0x1 << 10) // (USART) Stop Break +#define AT91C_US_STTTO ((unsigned int) 0x1 << 11) // (USART) Start Time-out +#define AT91C_US_SENDA ((unsigned int) 0x1 << 12) // (USART) Send Address +#define AT91C_US_RSTIT ((unsigned int) 0x1 << 13) // (USART) Reset Iterations +#define AT91C_US_RSTNACK ((unsigned int) 0x1 << 14) // (USART) Reset Non Acknowledge +#define AT91C_US_RETTO ((unsigned int) 0x1 << 15) // (USART) Rearm Time-out +#define AT91C_US_DTREN ((unsigned int) 0x1 << 16) // (USART) Data Terminal ready Enable +#define AT91C_US_DTRDIS ((unsigned int) 0x1 << 17) // (USART) Data Terminal ready Disable +#define AT91C_US_RTSEN ((unsigned int) 0x1 << 18) // (USART) Request to Send enable +#define AT91C_US_RTSDIS ((unsigned int) 0x1 << 19) // (USART) Request to Send Disable +// -------- US_MR : (USART Offset: 0x4) Debug Unit Mode Register -------- +#define AT91C_US_USMODE ((unsigned int) 0xF << 0) // (USART) Usart mode +#define AT91C_US_USMODE_NORMAL ((unsigned int) 0x0) // (USART) Normal +#define AT91C_US_USMODE_RS485 ((unsigned int) 0x1) // (USART) RS485 +#define AT91C_US_USMODE_HWHSH ((unsigned int) 0x2) // (USART) Hardware Handshaking +#define AT91C_US_USMODE_MODEM ((unsigned int) 0x3) // (USART) Modem +#define AT91C_US_USMODE_ISO7816_0 ((unsigned int) 0x4) // (USART) ISO7816 protocol: T = 0 +#define AT91C_US_USMODE_ISO7816_1 ((unsigned int) 0x6) // (USART) ISO7816 protocol: T = 1 +#define AT91C_US_USMODE_IRDA ((unsigned int) 0x8) // (USART) IrDA +#define AT91C_US_USMODE_SWHSH ((unsigned int) 0xC) // (USART) Software Handshaking +#define AT91C_US_CLKS ((unsigned int) 0x3 << 4) // (USART) Clock Selection (Baud Rate generator Input Clock +#define AT91C_US_CLKS_CLOCK ((unsigned int) 0x0 << 4) // (USART) Clock +#define AT91C_US_CLKS_FDIV1 ((unsigned int) 0x1 << 4) // (USART) fdiv1 +#define AT91C_US_CLKS_SLOW ((unsigned int) 0x2 << 4) // (USART) slow_clock (ARM) +#define AT91C_US_CLKS_EXT ((unsigned int) 0x3 << 4) // (USART) External (SCK) +#define AT91C_US_CHRL ((unsigned int) 0x3 << 6) // (USART) Clock Selection (Baud Rate generator Input Clock +#define AT91C_US_CHRL_5_BITS ((unsigned int) 0x0 << 6) // (USART) Character Length: 5 bits +#define AT91C_US_CHRL_6_BITS ((unsigned int) 0x1 << 6) // (USART) Character Length: 6 bits +#define AT91C_US_CHRL_7_BITS ((unsigned int) 0x2 << 6) // (USART) Character Length: 7 bits +#define AT91C_US_CHRL_8_BITS ((unsigned int) 0x3 << 6) // (USART) Character Length: 8 bits +#define AT91C_US_SYNC ((unsigned int) 0x1 << 8) // (USART) Synchronous Mode Select +#define AT91C_US_NBSTOP ((unsigned int) 0x3 << 12) // (USART) Number of Stop bits +#define AT91C_US_NBSTOP_1_BIT ((unsigned int) 0x0 << 12) // (USART) 1 stop bit +#define AT91C_US_NBSTOP_15_BIT ((unsigned int) 0x1 << 12) // (USART) Asynchronous (SYNC=0) 2 stop bits Synchronous (SYNC=1) 2 stop bits +#define AT91C_US_NBSTOP_2_BIT ((unsigned int) 0x2 << 12) // (USART) 2 stop bits +#define AT91C_US_MSBF ((unsigned int) 0x1 << 16) // (USART) Bit Order +#define AT91C_US_MODE9 ((unsigned int) 0x1 << 17) // (USART) 9-bit Character length +#define AT91C_US_CKLO ((unsigned int) 0x1 << 18) // (USART) Clock Output Select +#define AT91C_US_OVER ((unsigned int) 0x1 << 19) // (USART) Over Sampling Mode +#define AT91C_US_INACK ((unsigned int) 0x1 << 20) // (USART) Inhibit Non Acknowledge +#define AT91C_US_DSNACK ((unsigned int) 0x1 << 21) // (USART) Disable Successive NACK +#define AT91C_US_MAX_ITER ((unsigned int) 0x1 << 24) // (USART) Number of Repetitions +#define AT91C_US_FILTER ((unsigned int) 0x1 << 28) // (USART) Receive Line Filter +// -------- US_IER : (USART Offset: 0x8) Debug Unit Interrupt Enable Register -------- +#define AT91C_US_RXBRK ((unsigned int) 0x1 << 2) // (USART) Break Received/End of Break +#define AT91C_US_TIMEOUT ((unsigned int) 0x1 << 8) // (USART) Receiver Time-out +#define AT91C_US_ITERATION ((unsigned int) 0x1 << 10) // (USART) Max number of Repetitions Reached +#define AT91C_US_NACK ((unsigned int) 0x1 << 13) // (USART) Non Acknowledge +#define AT91C_US_RIIC ((unsigned int) 0x1 << 16) // (USART) Ring INdicator Input Change Flag +#define AT91C_US_DSRIC ((unsigned int) 0x1 << 17) // (USART) Data Set Ready Input Change Flag +#define AT91C_US_DCDIC ((unsigned int) 0x1 << 18) // (USART) Data Carrier Flag +#define AT91C_US_CTSIC ((unsigned int) 0x1 << 19) // (USART) Clear To Send Input Change Flag +// -------- US_IDR : (USART Offset: 0xc) Debug Unit Interrupt Disable Register -------- +// -------- US_IMR : (USART Offset: 0x10) Debug Unit Interrupt Mask Register -------- +// -------- US_CSR : (USART Offset: 0x14) Debug Unit Channel Status Register -------- +#define AT91C_US_RI ((unsigned int) 0x1 << 20) // (USART) Image of RI Input +#define AT91C_US_DSR ((unsigned int) 0x1 << 21) // (USART) Image of DSR Input +#define AT91C_US_DCD ((unsigned int) 0x1 << 22) // (USART) Image of DCD Input +#define AT91C_US_CTS ((unsigned int) 0x1 << 23) // (USART) Image of CTS Input + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Synchronous Serial Controller Interface +// ***************************************************************************** +typedef struct _AT91S_SSC { + AT91_REG SSC_CR; // Control Register + AT91_REG SSC_CMR; // Clock Mode Register + AT91_REG Reserved0[2]; // + AT91_REG SSC_RCMR; // Receive Clock ModeRegister + AT91_REG SSC_RFMR; // Receive Frame Mode Register + AT91_REG SSC_TCMR; // Transmit Clock Mode Register + AT91_REG SSC_TFMR; // Transmit Frame Mode Register + AT91_REG SSC_RHR; // Receive Holding Register + AT91_REG SSC_THR; // Transmit Holding Register + AT91_REG Reserved1[2]; // + AT91_REG SSC_RSHR; // Receive Sync Holding Register + AT91_REG SSC_TSHR; // Transmit Sync Holding Register + AT91_REG Reserved2[2]; // + AT91_REG SSC_SR; // Status Register + AT91_REG SSC_IER; // Interrupt Enable Register + AT91_REG SSC_IDR; // Interrupt Disable Register + AT91_REG SSC_IMR; // Interrupt Mask Register + AT91_REG Reserved3[44]; // + AT91_REG SSC_RPR; // Receive Pointer Register + AT91_REG SSC_RCR; // Receive Counter Register + AT91_REG SSC_TPR; // Transmit Pointer Register + AT91_REG SSC_TCR; // Transmit Counter Register + AT91_REG SSC_RNPR; // Receive Next Pointer Register + AT91_REG SSC_RNCR; // Receive Next Counter Register + AT91_REG SSC_TNPR; // Transmit Next Pointer Register + AT91_REG SSC_TNCR; // Transmit Next Counter Register + AT91_REG SSC_PTCR; // PDC Transfer Control Register + AT91_REG SSC_PTSR; // PDC Transfer Status Register +} AT91S_SSC, *AT91PS_SSC; + +// -------- SSC_CR : (SSC Offset: 0x0) SSC Control Register -------- +#define AT91C_SSC_RXEN ((unsigned int) 0x1 << 0) // (SSC) Receive Enable +#define AT91C_SSC_RXDIS ((unsigned int) 0x1 << 1) // (SSC) Receive Disable +#define AT91C_SSC_TXEN ((unsigned int) 0x1 << 8) // (SSC) Transmit Enable +#define AT91C_SSC_TXDIS ((unsigned int) 0x1 << 9) // (SSC) Transmit Disable +#define AT91C_SSC_SWRST ((unsigned int) 0x1 << 15) // (SSC) Software Reset +// -------- SSC_RCMR : (SSC Offset: 0x10) SSC Receive Clock Mode Register -------- +#define AT91C_SSC_CKS ((unsigned int) 0x3 << 0) // (SSC) Receive/Transmit Clock Selection +#define AT91C_SSC_CKS_DIV ((unsigned int) 0x0) // (SSC) Divided Clock +#define AT91C_SSC_CKS_TK ((unsigned int) 0x1) // (SSC) TK Clock signal +#define AT91C_SSC_CKS_RK ((unsigned int) 0x2) // (SSC) RK pin +#define AT91C_SSC_CKO ((unsigned int) 0x7 << 2) // (SSC) Receive/Transmit Clock Output Mode Selection +#define AT91C_SSC_CKO_NONE ((unsigned int) 0x0 << 2) // (SSC) Receive/Transmit Clock Output Mode: None RK pin: Input-only +#define AT91C_SSC_CKO_CONTINOUS ((unsigned int) 0x1 << 2) // (SSC) Continuous Receive/Transmit Clock RK pin: Output +#define AT91C_SSC_CKO_DATA_TX ((unsigned int) 0x2 << 2) // (SSC) Receive/Transmit Clock only during data transfers RK pin: Output +#define AT91C_SSC_CKI ((unsigned int) 0x1 << 5) // (SSC) Receive/Transmit Clock Inversion +#define AT91C_SSC_CKG ((unsigned int) 0x3 << 6) // (SSC) Receive/Transmit Clock Gating Selection +#define AT91C_SSC_CKG_NONE ((unsigned int) 0x0 << 6) // (SSC) Receive/Transmit Clock Gating: None, continuous clock +#define AT91C_SSC_CKG_LOW ((unsigned int) 0x1 << 6) // (SSC) Receive/Transmit Clock enabled only if RF Low +#define AT91C_SSC_CKG_HIGH ((unsigned int) 0x2 << 6) // (SSC) Receive/Transmit Clock enabled only if RF High +#define AT91C_SSC_START ((unsigned int) 0xF << 8) // (SSC) Receive/Transmit Start Selection +#define AT91C_SSC_START_CONTINOUS ((unsigned int) 0x0 << 8) // (SSC) Continuous, as soon as the receiver is enabled, and immediately after the end of transfer of the previous data. +#define AT91C_SSC_START_TX ((unsigned int) 0x1 << 8) // (SSC) Transmit/Receive start +#define AT91C_SSC_START_LOW_RF ((unsigned int) 0x2 << 8) // (SSC) Detection of a low level on RF input +#define AT91C_SSC_START_HIGH_RF ((unsigned int) 0x3 << 8) // (SSC) Detection of a high level on RF input +#define AT91C_SSC_START_FALL_RF ((unsigned int) 0x4 << 8) // (SSC) Detection of a falling edge on RF input +#define AT91C_SSC_START_RISE_RF ((unsigned int) 0x5 << 8) // (SSC) Detection of a rising edge on RF input +#define AT91C_SSC_START_LEVEL_RF ((unsigned int) 0x6 << 8) // (SSC) Detection of any level change on RF input +#define AT91C_SSC_START_EDGE_RF ((unsigned int) 0x7 << 8) // (SSC) Detection of any edge on RF input +#define AT91C_SSC_START_0 ((unsigned int) 0x8 << 8) // (SSC) Compare 0 +#define AT91C_SSC_STOP ((unsigned int) 0x1 << 12) // (SSC) Receive Stop Selection +#define AT91C_SSC_STTDLY ((unsigned int) 0xFF << 16) // (SSC) Receive/Transmit Start Delay +#define AT91C_SSC_PERIOD ((unsigned int) 0xFF << 24) // (SSC) Receive/Transmit Period Divider Selection +// -------- SSC_RFMR : (SSC Offset: 0x14) SSC Receive Frame Mode Register -------- +#define AT91C_SSC_DATLEN ((unsigned int) 0x1F << 0) // (SSC) Data Length +#define AT91C_SSC_LOOP ((unsigned int) 0x1 << 5) // (SSC) Loop Mode +#define AT91C_SSC_MSBF ((unsigned int) 0x1 << 7) // (SSC) Most Significant Bit First +#define AT91C_SSC_DATNB ((unsigned int) 0xF << 8) // (SSC) Data Number per Frame +#define AT91C_SSC_FSLEN ((unsigned int) 0xF << 16) // (SSC) Receive/Transmit Frame Sync length +#define AT91C_SSC_FSOS ((unsigned int) 0x7 << 20) // (SSC) Receive/Transmit Frame Sync Output Selection +#define AT91C_SSC_FSOS_NONE ((unsigned int) 0x0 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: None RK pin Input-only +#define AT91C_SSC_FSOS_NEGATIVE ((unsigned int) 0x1 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Negative Pulse +#define AT91C_SSC_FSOS_POSITIVE ((unsigned int) 0x2 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Positive Pulse +#define AT91C_SSC_FSOS_LOW ((unsigned int) 0x3 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Driver Low during data transfer +#define AT91C_SSC_FSOS_HIGH ((unsigned int) 0x4 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Driver High during data transfer +#define AT91C_SSC_FSOS_TOGGLE ((unsigned int) 0x5 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Toggling at each start of data transfer +#define AT91C_SSC_FSEDGE ((unsigned int) 0x1 << 24) // (SSC) Frame Sync Edge Detection +// -------- SSC_TCMR : (SSC Offset: 0x18) SSC Transmit Clock Mode Register -------- +// -------- SSC_TFMR : (SSC Offset: 0x1c) SSC Transmit Frame Mode Register -------- +#define AT91C_SSC_DATDEF ((unsigned int) 0x1 << 5) // (SSC) Data Default Value +#define AT91C_SSC_FSDEN ((unsigned int) 0x1 << 23) // (SSC) Frame Sync Data Enable +// -------- SSC_SR : (SSC Offset: 0x40) SSC Status Register -------- +#define AT91C_SSC_TXRDY ((unsigned int) 0x1 << 0) // (SSC) Transmit Ready +#define AT91C_SSC_TXEMPTY ((unsigned int) 0x1 << 1) // (SSC) Transmit Empty +#define AT91C_SSC_ENDTX ((unsigned int) 0x1 << 2) // (SSC) End Of Transmission +#define AT91C_SSC_TXBUFE ((unsigned int) 0x1 << 3) // (SSC) Transmit Buffer Empty +#define AT91C_SSC_RXRDY ((unsigned int) 0x1 << 4) // (SSC) Receive Ready +#define AT91C_SSC_OVRUN ((unsigned int) 0x1 << 5) // (SSC) Receive Overrun +#define AT91C_SSC_ENDRX ((unsigned int) 0x1 << 6) // (SSC) End of Reception +#define AT91C_SSC_RXBUFF ((unsigned int) 0x1 << 7) // (SSC) Receive Buffer Full +#define AT91C_SSC_CP0 ((unsigned int) 0x1 << 8) // (SSC) Compare 0 +#define AT91C_SSC_CP1 ((unsigned int) 0x1 << 9) // (SSC) Compare 1 +#define AT91C_SSC_TXSYN ((unsigned int) 0x1 << 10) // (SSC) Transmit Sync +#define AT91C_SSC_RXSYN ((unsigned int) 0x1 << 11) // (SSC) Receive Sync +#define AT91C_SSC_TXENA ((unsigned int) 0x1 << 16) // (SSC) Transmit Enable +#define AT91C_SSC_RXENA ((unsigned int) 0x1 << 17) // (SSC) Receive Enable +// -------- SSC_IER : (SSC Offset: 0x44) SSC Interrupt Enable Register -------- +// -------- SSC_IDR : (SSC Offset: 0x48) SSC Interrupt Disable Register -------- +// -------- SSC_IMR : (SSC Offset: 0x4c) SSC Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Two-wire Interface +// ***************************************************************************** +typedef struct _AT91S_TWI { + AT91_REG TWI_CR; // Control Register + AT91_REG TWI_MMR; // Master Mode Register + AT91_REG Reserved0[1]; // + AT91_REG TWI_IADR; // Internal Address Register + AT91_REG TWI_CWGR; // Clock Waveform Generator Register + AT91_REG Reserved1[3]; // + AT91_REG TWI_SR; // Status Register + AT91_REG TWI_IER; // Interrupt Enable Register + AT91_REG TWI_IDR; // Interrupt Disable Register + AT91_REG TWI_IMR; // Interrupt Mask Register + AT91_REG TWI_RHR; // Receive Holding Register + AT91_REG TWI_THR; // Transmit Holding Register +} AT91S_TWI, *AT91PS_TWI; + +// -------- TWI_CR : (TWI Offset: 0x0) TWI Control Register -------- +#define AT91C_TWI_START ((unsigned int) 0x1 << 0) // (TWI) Send a START Condition +#define AT91C_TWI_STOP ((unsigned int) 0x1 << 1) // (TWI) Send a STOP Condition +#define AT91C_TWI_MSEN ((unsigned int) 0x1 << 2) // (TWI) TWI Master Transfer Enabled +#define AT91C_TWI_MSDIS ((unsigned int) 0x1 << 3) // (TWI) TWI Master Transfer Disabled +#define AT91C_TWI_SWRST ((unsigned int) 0x1 << 7) // (TWI) Software Reset +// -------- TWI_MMR : (TWI Offset: 0x4) TWI Master Mode Register -------- +#define AT91C_TWI_IADRSZ ((unsigned int) 0x3 << 8) // (TWI) Internal Device Address Size +#define AT91C_TWI_IADRSZ_NO ((unsigned int) 0x0 << 8) // (TWI) No internal device address +#define AT91C_TWI_IADRSZ_1_BYTE ((unsigned int) 0x1 << 8) // (TWI) One-byte internal device address +#define AT91C_TWI_IADRSZ_2_BYTE ((unsigned int) 0x2 << 8) // (TWI) Two-byte internal device address +#define AT91C_TWI_IADRSZ_3_BYTE ((unsigned int) 0x3 << 8) // (TWI) Three-byte internal device address +#define AT91C_TWI_MREAD ((unsigned int) 0x1 << 12) // (TWI) Master Read Direction +#define AT91C_TWI_DADR ((unsigned int) 0x7F << 16) // (TWI) Device Address +// -------- TWI_CWGR : (TWI Offset: 0x10) TWI Clock Waveform Generator Register -------- +#define AT91C_TWI_CLDIV ((unsigned int) 0xFF << 0) // (TWI) Clock Low Divider +#define AT91C_TWI_CHDIV ((unsigned int) 0xFF << 8) // (TWI) Clock High Divider +#define AT91C_TWI_CKDIV ((unsigned int) 0x7 << 16) // (TWI) Clock Divider +// -------- TWI_SR : (TWI Offset: 0x20) TWI Status Register -------- +#define AT91C_TWI_TXCOMP ((unsigned int) 0x1 << 0) // (TWI) Transmission Completed +#define AT91C_TWI_RXRDY ((unsigned int) 0x1 << 1) // (TWI) Receive holding register ReaDY +#define AT91C_TWI_TXRDY ((unsigned int) 0x1 << 2) // (TWI) Transmit holding register ReaDY +#define AT91C_TWI_OVRE ((unsigned int) 0x1 << 6) // (TWI) Overrun Error +#define AT91C_TWI_UNRE ((unsigned int) 0x1 << 7) // (TWI) Underrun Error +#define AT91C_TWI_NACK ((unsigned int) 0x1 << 8) // (TWI) Not Acknowledged +// -------- TWI_IER : (TWI Offset: 0x24) TWI Interrupt Enable Register -------- +// -------- TWI_IDR : (TWI Offset: 0x28) TWI Interrupt Disable Register -------- +// -------- TWI_IMR : (TWI Offset: 0x2c) TWI Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR PWMC Channel Interface +// ***************************************************************************** +typedef struct _AT91S_PWMC_CH { + AT91_REG PWMC_CMR; // Channel Mode Register + AT91_REG PWMC_CDTYR; // Channel Duty Cycle Register + AT91_REG PWMC_CPRDR; // Channel Period Register + AT91_REG PWMC_CCNTR; // Channel Counter Register + AT91_REG PWMC_CUPDR; // Channel Update Register + AT91_REG PWMC_Reserved[3]; // Reserved +} AT91S_PWMC_CH, *AT91PS_PWMC_CH; + +// -------- PWMC_CMR : (PWMC_CH Offset: 0x0) PWMC Channel Mode Register -------- +#define AT91C_PWMC_CPRE ((unsigned int) 0xF << 0) // (PWMC_CH) Channel Pre-scaler : PWMC_CLKx +#define AT91C_PWMC_CPRE_MCK ((unsigned int) 0x0) // (PWMC_CH) +#define AT91C_PWMC_CPRE_MCKA ((unsigned int) 0xB) // (PWMC_CH) +#define AT91C_PWMC_CPRE_MCKB ((unsigned int) 0xC) // (PWMC_CH) +#define AT91C_PWMC_CALG ((unsigned int) 0x1 << 8) // (PWMC_CH) Channel Alignment +#define AT91C_PWMC_CPOL ((unsigned int) 0x1 << 9) // (PWMC_CH) Channel Polarity +#define AT91C_PWMC_CPD ((unsigned int) 0x1 << 10) // (PWMC_CH) Channel Update Period +// -------- PWMC_CDTYR : (PWMC_CH Offset: 0x4) PWMC Channel Duty Cycle Register -------- +#define AT91C_PWMC_CDTY ((unsigned int) 0x0 << 0) // (PWMC_CH) Channel Duty Cycle +// -------- PWMC_CPRDR : (PWMC_CH Offset: 0x8) PWMC Channel Period Register -------- +#define AT91C_PWMC_CPRD ((unsigned int) 0x0 << 0) // (PWMC_CH) Channel Period +// -------- PWMC_CCNTR : (PWMC_CH Offset: 0xc) PWMC Channel Counter Register -------- +#define AT91C_PWMC_CCNT ((unsigned int) 0x0 << 0) // (PWMC_CH) Channel Counter +// -------- PWMC_CUPDR : (PWMC_CH Offset: 0x10) PWMC Channel Update Register -------- +#define AT91C_PWMC_CUPD ((unsigned int) 0x0 << 0) // (PWMC_CH) Channel Update + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Pulse Width Modulation Controller Interface +// ***************************************************************************** +typedef struct _AT91S_PWMC { + AT91_REG PWMC_MR; // PWMC Mode Register + AT91_REG PWMC_ENA; // PWMC Enable Register + AT91_REG PWMC_DIS; // PWMC Disable Register + AT91_REG PWMC_SR; // PWMC Status Register + AT91_REG PWMC_IER; // PWMC Interrupt Enable Register + AT91_REG PWMC_IDR; // PWMC Interrupt Disable Register + AT91_REG PWMC_IMR; // PWMC Interrupt Mask Register + AT91_REG PWMC_ISR; // PWMC Interrupt Status Register + AT91_REG Reserved0[55]; // + AT91_REG PWMC_VR; // PWMC Version Register + AT91_REG Reserved1[64]; // + AT91S_PWMC_CH PWMC_CH[4]; // PWMC Channel +} AT91S_PWMC, *AT91PS_PWMC; + +// -------- PWMC_MR : (PWMC Offset: 0x0) PWMC Mode Register -------- +#define AT91C_PWMC_DIVA ((unsigned int) 0xFF << 0) // (PWMC) CLKA divide factor. +#define AT91C_PWMC_PREA ((unsigned int) 0xF << 8) // (PWMC) Divider Input Clock Prescaler A +#define AT91C_PWMC_PREA_MCK ((unsigned int) 0x0 << 8) // (PWMC) +#define AT91C_PWMC_DIVB ((unsigned int) 0xFF << 16) // (PWMC) CLKB divide factor. +#define AT91C_PWMC_PREB ((unsigned int) 0xF << 24) // (PWMC) Divider Input Clock Prescaler B +#define AT91C_PWMC_PREB_MCK ((unsigned int) 0x0 << 24) // (PWMC) +// -------- PWMC_ENA : (PWMC Offset: 0x4) PWMC Enable Register -------- +#define AT91C_PWMC_CHID0 ((unsigned int) 0x1 << 0) // (PWMC) Channel ID 0 +#define AT91C_PWMC_CHID1 ((unsigned int) 0x1 << 1) // (PWMC) Channel ID 1 +#define AT91C_PWMC_CHID2 ((unsigned int) 0x1 << 2) // (PWMC) Channel ID 2 +#define AT91C_PWMC_CHID3 ((unsigned int) 0x1 << 3) // (PWMC) Channel ID 3 +// -------- PWMC_DIS : (PWMC Offset: 0x8) PWMC Disable Register -------- +// -------- PWMC_SR : (PWMC Offset: 0xc) PWMC Status Register -------- +// -------- PWMC_IER : (PWMC Offset: 0x10) PWMC Interrupt Enable Register -------- +// -------- PWMC_IDR : (PWMC Offset: 0x14) PWMC Interrupt Disable Register -------- +// -------- PWMC_IMR : (PWMC Offset: 0x18) PWMC Interrupt Mask Register -------- +// -------- PWMC_ISR : (PWMC Offset: 0x1c) PWMC Interrupt Status Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR USB Device Interface +// ***************************************************************************** +typedef struct _AT91S_UDP { + AT91_REG UDP_NUM; // Frame Number Register + AT91_REG UDP_GLBSTATE; // Global State Register + AT91_REG UDP_FADDR; // Function Address Register + AT91_REG Reserved0[1]; // + AT91_REG UDP_IER; // Interrupt Enable Register + AT91_REG UDP_IDR; // Interrupt Disable Register + AT91_REG UDP_IMR; // Interrupt Mask Register + AT91_REG UDP_ISR; // Interrupt Status Register + AT91_REG UDP_ICR; // Interrupt Clear Register + AT91_REG Reserved1[1]; // + AT91_REG UDP_RSTEP; // Reset Endpoint Register + AT91_REG Reserved2[1]; // + AT91_REG UDP_CSR[6]; // Endpoint Control and Status Register + AT91_REG Reserved3[2]; // + AT91_REG UDP_FDR[6]; // Endpoint FIFO Data Register + AT91_REG Reserved4[3]; // + AT91_REG UDP_TXVC; // Transceiver Control Register +} AT91S_UDP, *AT91PS_UDP; + +// -------- UDP_FRM_NUM : (UDP Offset: 0x0) USB Frame Number Register -------- +#define AT91C_UDP_FRM_NUM ((unsigned int) 0x7FF << 0) // (UDP) Frame Number as Defined in the Packet Field Formats +#define AT91C_UDP_FRM_ERR ((unsigned int) 0x1 << 16) // (UDP) Frame Error +#define AT91C_UDP_FRM_OK ((unsigned int) 0x1 << 17) // (UDP) Frame OK +// -------- UDP_GLB_STATE : (UDP Offset: 0x4) USB Global State Register -------- +#define AT91C_UDP_FADDEN ((unsigned int) 0x1 << 0) // (UDP) Function Address Enable +#define AT91C_UDP_CONFG ((unsigned int) 0x1 << 1) // (UDP) Configured +#define AT91C_UDP_ESR ((unsigned int) 0x1 << 2) // (UDP) Enable Send Resume +#define AT91C_UDP_RSMINPR ((unsigned int) 0x1 << 3) // (UDP) A Resume Has Been Sent to the Host +#define AT91C_UDP_RMWUPE ((unsigned int) 0x1 << 4) // (UDP) Remote Wake Up Enable +// -------- UDP_FADDR : (UDP Offset: 0x8) USB Function Address Register -------- +#define AT91C_UDP_FADD ((unsigned int) 0xFF << 0) // (UDP) Function Address Value +#define AT91C_UDP_FEN ((unsigned int) 0x1 << 8) // (UDP) Function Enable +// -------- UDP_IER : (UDP Offset: 0x10) USB Interrupt Enable Register -------- +#define AT91C_UDP_EPINT0 ((unsigned int) 0x1 << 0) // (UDP) Endpoint 0 Interrupt +#define AT91C_UDP_EPINT1 ((unsigned int) 0x1 << 1) // (UDP) Endpoint 0 Interrupt +#define AT91C_UDP_EPINT2 ((unsigned int) 0x1 << 2) // (UDP) Endpoint 2 Interrupt +#define AT91C_UDP_EPINT3 ((unsigned int) 0x1 << 3) // (UDP) Endpoint 3 Interrupt +#define AT91C_UDP_EPINT4 ((unsigned int) 0x1 << 4) // (UDP) Endpoint 4 Interrupt +#define AT91C_UDP_EPINT5 ((unsigned int) 0x1 << 5) // (UDP) Endpoint 5 Interrupt +#define AT91C_UDP_RXSUSP ((unsigned int) 0x1 << 8) // (UDP) USB Suspend Interrupt +#define AT91C_UDP_RXRSM ((unsigned int) 0x1 << 9) // (UDP) USB Resume Interrupt +#define AT91C_UDP_EXTRSM ((unsigned int) 0x1 << 10) // (UDP) USB External Resume Interrupt +#define AT91C_UDP_SOFINT ((unsigned int) 0x1 << 11) // (UDP) USB Start Of frame Interrupt +#define AT91C_UDP_WAKEUP ((unsigned int) 0x1 << 13) // (UDP) USB Resume Interrupt +// -------- UDP_IDR : (UDP Offset: 0x14) USB Interrupt Disable Register -------- +// -------- UDP_IMR : (UDP Offset: 0x18) USB Interrupt Mask Register -------- +// -------- UDP_ISR : (UDP Offset: 0x1c) USB Interrupt Status Register -------- +#define AT91C_UDP_ENDBUSRES ((unsigned int) 0x1 << 12) // (UDP) USB End Of Bus Reset Interrupt +// -------- UDP_ICR : (UDP Offset: 0x20) USB Interrupt Clear Register -------- +// -------- UDP_RST_EP : (UDP Offset: 0x28) USB Reset Endpoint Register -------- +#define AT91C_UDP_EP0 ((unsigned int) 0x1 << 0) // (UDP) Reset Endpoint 0 +#define AT91C_UDP_EP1 ((unsigned int) 0x1 << 1) // (UDP) Reset Endpoint 1 +#define AT91C_UDP_EP2 ((unsigned int) 0x1 << 2) // (UDP) Reset Endpoint 2 +#define AT91C_UDP_EP3 ((unsigned int) 0x1 << 3) // (UDP) Reset Endpoint 3 +#define AT91C_UDP_EP4 ((unsigned int) 0x1 << 4) // (UDP) Reset Endpoint 4 +#define AT91C_UDP_EP5 ((unsigned int) 0x1 << 5) // (UDP) Reset Endpoint 5 +// -------- UDP_CSR : (UDP Offset: 0x30) USB Endpoint Control and Status Register -------- +#define AT91C_UDP_TXCOMP ((unsigned int) 0x1 << 0) // (UDP) Generates an IN packet with data previously written in the DPR +#define AT91C_UDP_RX_DATA_BK0 ((unsigned int) 0x1 << 1) // (UDP) Receive Data Bank 0 +#define AT91C_UDP_RXSETUP ((unsigned int) 0x1 << 2) // (UDP) Sends STALL to the Host (Control endpoints) +#define AT91C_UDP_ISOERROR ((unsigned int) 0x1 << 3) // (UDP) Isochronous error (Isochronous endpoints) +#define AT91C_UDP_TXPKTRDY ((unsigned int) 0x1 << 4) // (UDP) Transmit Packet Ready +#define AT91C_UDP_FORCESTALL ((unsigned int) 0x1 << 5) // (UDP) Force Stall (used by Control, Bulk and Isochronous endpoints). +#define AT91C_UDP_RX_DATA_BK1 ((unsigned int) 0x1 << 6) // (UDP) Receive Data Bank 1 (only used by endpoints with ping-pong attributes). +#define AT91C_UDP_DIR ((unsigned int) 0x1 << 7) // (UDP) Transfer Direction +#define AT91C_UDP_EPTYPE ((unsigned int) 0x7 << 8) // (UDP) Endpoint type +#define AT91C_UDP_EPTYPE_CTRL ((unsigned int) 0x0 << 8) // (UDP) Control +#define AT91C_UDP_EPTYPE_ISO_OUT ((unsigned int) 0x1 << 8) // (UDP) Isochronous OUT +#define AT91C_UDP_EPTYPE_BULK_OUT ((unsigned int) 0x2 << 8) // (UDP) Bulk OUT +#define AT91C_UDP_EPTYPE_INT_OUT ((unsigned int) 0x3 << 8) // (UDP) Interrupt OUT +#define AT91C_UDP_EPTYPE_ISO_IN ((unsigned int) 0x5 << 8) // (UDP) Isochronous IN +#define AT91C_UDP_EPTYPE_BULK_IN ((unsigned int) 0x6 << 8) // (UDP) Bulk IN +#define AT91C_UDP_EPTYPE_INT_IN ((unsigned int) 0x7 << 8) // (UDP) Interrupt IN +#define AT91C_UDP_DTGLE ((unsigned int) 0x1 << 11) // (UDP) Data Toggle +#define AT91C_UDP_EPEDS ((unsigned int) 0x1 << 15) // (UDP) Endpoint Enable Disable +#define AT91C_UDP_RXBYTECNT ((unsigned int) 0x7FF << 16) // (UDP) Number Of Bytes Available in the FIFO +// -------- UDP_TXVC : (UDP Offset: 0x74) Transceiver Control Register -------- +#define AT91C_UDP_TXVDIS ((unsigned int) 0x1 << 8) // (UDP) +#define AT91C_UDP_PUON ((unsigned int) 0x1 << 9) // (UDP) Pull-up ON + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Timer Counter Channel Interface +// ***************************************************************************** +typedef struct _AT91S_TC { + AT91_REG TC_CCR; // Channel Control Register + AT91_REG TC_CMR; // Channel Mode Register (Capture Mode / Waveform Mode) + AT91_REG Reserved0[2]; // + AT91_REG TC_CV; // Counter Value + AT91_REG TC_RA; // Register A + AT91_REG TC_RB; // Register B + AT91_REG TC_RC; // Register C + AT91_REG TC_SR; // Status Register + AT91_REG TC_IER; // Interrupt Enable Register + AT91_REG TC_IDR; // Interrupt Disable Register + AT91_REG TC_IMR; // Interrupt Mask Register +} AT91S_TC, *AT91PS_TC; + +// -------- TC_CCR : (TC Offset: 0x0) TC Channel Control Register -------- +#define AT91C_TC_CLKEN ((unsigned int) 0x1 << 0) // (TC) Counter Clock Enable Command +#define AT91C_TC_CLKDIS ((unsigned int) 0x1 << 1) // (TC) Counter Clock Disable Command +#define AT91C_TC_SWTRG ((unsigned int) 0x1 << 2) // (TC) Software Trigger Command +// -------- TC_CMR : (TC Offset: 0x4) TC Channel Mode Register: Capture Mode / Waveform Mode -------- +#define AT91C_TC_CLKS ((unsigned int) 0x7 << 0) // (TC) Clock Selection +#define AT91C_TC_CLKS_TIMER_DIV1_CLOCK ((unsigned int) 0x0) // (TC) Clock selected: TIMER_DIV1_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV2_CLOCK ((unsigned int) 0x1) // (TC) Clock selected: TIMER_DIV2_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV3_CLOCK ((unsigned int) 0x2) // (TC) Clock selected: TIMER_DIV3_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV4_CLOCK ((unsigned int) 0x3) // (TC) Clock selected: TIMER_DIV4_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV5_CLOCK ((unsigned int) 0x4) // (TC) Clock selected: TIMER_DIV5_CLOCK +#define AT91C_TC_CLKS_XC0 ((unsigned int) 0x5) // (TC) Clock selected: XC0 +#define AT91C_TC_CLKS_XC1 ((unsigned int) 0x6) // (TC) Clock selected: XC1 +#define AT91C_TC_CLKS_XC2 ((unsigned int) 0x7) // (TC) Clock selected: XC2 +#define AT91C_TC_CLKI ((unsigned int) 0x1 << 3) // (TC) Clock Invert +#define AT91C_TC_BURST ((unsigned int) 0x3 << 4) // (TC) Burst Signal Selection +#define AT91C_TC_BURST_NONE ((unsigned int) 0x0 << 4) // (TC) The clock is not gated by an external signal +#define AT91C_TC_BURST_XC0 ((unsigned int) 0x1 << 4) // (TC) XC0 is ANDed with the selected clock +#define AT91C_TC_BURST_XC1 ((unsigned int) 0x2 << 4) // (TC) XC1 is ANDed with the selected clock +#define AT91C_TC_BURST_XC2 ((unsigned int) 0x3 << 4) // (TC) XC2 is ANDed with the selected clock +#define AT91C_TC_CPCSTOP ((unsigned int) 0x1 << 6) // (TC) Counter Clock Stopped with RC Compare +#define AT91C_TC_LDBSTOP ((unsigned int) 0x1 << 6) // (TC) Counter Clock Stopped with RB Loading +#define AT91C_TC_CPCDIS ((unsigned int) 0x1 << 7) // (TC) Counter Clock Disable with RC Compare +#define AT91C_TC_LDBDIS ((unsigned int) 0x1 << 7) // (TC) Counter Clock Disabled with RB Loading +#define AT91C_TC_ETRGEDG ((unsigned int) 0x3 << 8) // (TC) External Trigger Edge Selection +#define AT91C_TC_ETRGEDG_NONE ((unsigned int) 0x0 << 8) // (TC) Edge: None +#define AT91C_TC_ETRGEDG_RISING ((unsigned int) 0x1 << 8) // (TC) Edge: rising edge +#define AT91C_TC_ETRGEDG_FALLING ((unsigned int) 0x2 << 8) // (TC) Edge: falling edge +#define AT91C_TC_ETRGEDG_BOTH ((unsigned int) 0x3 << 8) // (TC) Edge: each edge +#define AT91C_TC_EEVTEDG ((unsigned int) 0x3 << 8) // (TC) External Event Edge Selection +#define AT91C_TC_EEVTEDG_NONE ((unsigned int) 0x0 << 8) // (TC) Edge: None +#define AT91C_TC_EEVTEDG_RISING ((unsigned int) 0x1 << 8) // (TC) Edge: rising edge +#define AT91C_TC_EEVTEDG_FALLING ((unsigned int) 0x2 << 8) // (TC) Edge: falling edge +#define AT91C_TC_EEVTEDG_BOTH ((unsigned int) 0x3 << 8) // (TC) Edge: each edge +#define AT91C_TC_EEVT ((unsigned int) 0x3 << 10) // (TC) External Event Selection +#define AT91C_TC_EEVT_TIOB ((unsigned int) 0x0 << 10) // (TC) Signal selected as external event: TIOB TIOB direction: input +#define AT91C_TC_EEVT_XC0 ((unsigned int) 0x1 << 10) // (TC) Signal selected as external event: XC0 TIOB direction: output +#define AT91C_TC_EEVT_XC1 ((unsigned int) 0x2 << 10) // (TC) Signal selected as external event: XC1 TIOB direction: output +#define AT91C_TC_EEVT_XC2 ((unsigned int) 0x3 << 10) // (TC) Signal selected as external event: XC2 TIOB direction: output +#define AT91C_TC_ABETRG ((unsigned int) 0x1 << 10) // (TC) TIOA or TIOB External Trigger Selection +#define AT91C_TC_ENETRG ((unsigned int) 0x1 << 12) // (TC) External Event Trigger enable +#define AT91C_TC_WAVESEL ((unsigned int) 0x3 << 13) // (TC) Waveform Selection +#define AT91C_TC_WAVESEL_UP ((unsigned int) 0x0 << 13) // (TC) UP mode without atomatic trigger on RC Compare +#define AT91C_TC_WAVESEL_UPDOWN ((unsigned int) 0x1 << 13) // (TC) UPDOWN mode without automatic trigger on RC Compare +#define AT91C_TC_WAVESEL_UP_AUTO ((unsigned int) 0x2 << 13) // (TC) UP mode with automatic trigger on RC Compare +#define AT91C_TC_WAVESEL_UPDOWN_AUTO ((unsigned int) 0x3 << 13) // (TC) UPDOWN mode with automatic trigger on RC Compare +#define AT91C_TC_CPCTRG ((unsigned int) 0x1 << 14) // (TC) RC Compare Trigger Enable +#define AT91C_TC_WAVE ((unsigned int) 0x1 << 15) // (TC) +#define AT91C_TC_ACPA ((unsigned int) 0x3 << 16) // (TC) RA Compare Effect on TIOA +#define AT91C_TC_ACPA_NONE ((unsigned int) 0x0 << 16) // (TC) Effect: none +#define AT91C_TC_ACPA_SET ((unsigned int) 0x1 << 16) // (TC) Effect: set +#define AT91C_TC_ACPA_CLEAR ((unsigned int) 0x2 << 16) // (TC) Effect: clear +#define AT91C_TC_ACPA_TOGGLE ((unsigned int) 0x3 << 16) // (TC) Effect: toggle +#define AT91C_TC_LDRA ((unsigned int) 0x3 << 16) // (TC) RA Loading Selection +#define AT91C_TC_LDRA_NONE ((unsigned int) 0x0 << 16) // (TC) Edge: None +#define AT91C_TC_LDRA_RISING ((unsigned int) 0x1 << 16) // (TC) Edge: rising edge of TIOA +#define AT91C_TC_LDRA_FALLING ((unsigned int) 0x2 << 16) // (TC) Edge: falling edge of TIOA +#define AT91C_TC_LDRA_BOTH ((unsigned int) 0x3 << 16) // (TC) Edge: each edge of TIOA +#define AT91C_TC_ACPC ((unsigned int) 0x3 << 18) // (TC) RC Compare Effect on TIOA +#define AT91C_TC_ACPC_NONE ((unsigned int) 0x0 << 18) // (TC) Effect: none +#define AT91C_TC_ACPC_SET ((unsigned int) 0x1 << 18) // (TC) Effect: set +#define AT91C_TC_ACPC_CLEAR ((unsigned int) 0x2 << 18) // (TC) Effect: clear +#define AT91C_TC_ACPC_TOGGLE ((unsigned int) 0x3 << 18) // (TC) Effect: toggle +#define AT91C_TC_LDRB ((unsigned int) 0x3 << 18) // (TC) RB Loading Selection +#define AT91C_TC_LDRB_NONE ((unsigned int) 0x0 << 18) // (TC) Edge: None +#define AT91C_TC_LDRB_RISING ((unsigned int) 0x1 << 18) // (TC) Edge: rising edge of TIOA +#define AT91C_TC_LDRB_FALLING ((unsigned int) 0x2 << 18) // (TC) Edge: falling edge of TIOA +#define AT91C_TC_LDRB_BOTH ((unsigned int) 0x3 << 18) // (TC) Edge: each edge of TIOA +#define AT91C_TC_AEEVT ((unsigned int) 0x3 << 20) // (TC) External Event Effect on TIOA +#define AT91C_TC_AEEVT_NONE ((unsigned int) 0x0 << 20) // (TC) Effect: none +#define AT91C_TC_AEEVT_SET ((unsigned int) 0x1 << 20) // (TC) Effect: set +#define AT91C_TC_AEEVT_CLEAR ((unsigned int) 0x2 << 20) // (TC) Effect: clear +#define AT91C_TC_AEEVT_TOGGLE ((unsigned int) 0x3 << 20) // (TC) Effect: toggle +#define AT91C_TC_ASWTRG ((unsigned int) 0x3 << 22) // (TC) Software Trigger Effect on TIOA +#define AT91C_TC_ASWTRG_NONE ((unsigned int) 0x0 << 22) // (TC) Effect: none +#define AT91C_TC_ASWTRG_SET ((unsigned int) 0x1 << 22) // (TC) Effect: set +#define AT91C_TC_ASWTRG_CLEAR ((unsigned int) 0x2 << 22) // (TC) Effect: clear +#define AT91C_TC_ASWTRG_TOGGLE ((unsigned int) 0x3 << 22) // (TC) Effect: toggle +#define AT91C_TC_BCPB ((unsigned int) 0x3 << 24) // (TC) RB Compare Effect on TIOB +#define AT91C_TC_BCPB_NONE ((unsigned int) 0x0 << 24) // (TC) Effect: none +#define AT91C_TC_BCPB_SET ((unsigned int) 0x1 << 24) // (TC) Effect: set +#define AT91C_TC_BCPB_CLEAR ((unsigned int) 0x2 << 24) // (TC) Effect: clear +#define AT91C_TC_BCPB_TOGGLE ((unsigned int) 0x3 << 24) // (TC) Effect: toggle +#define AT91C_TC_BCPC ((unsigned int) 0x3 << 26) // (TC) RC Compare Effect on TIOB +#define AT91C_TC_BCPC_NONE ((unsigned int) 0x0 << 26) // (TC) Effect: none +#define AT91C_TC_BCPC_SET ((unsigned int) 0x1 << 26) // (TC) Effect: set +#define AT91C_TC_BCPC_CLEAR ((unsigned int) 0x2 << 26) // (TC) Effect: clear +#define AT91C_TC_BCPC_TOGGLE ((unsigned int) 0x3 << 26) // (TC) Effect: toggle +#define AT91C_TC_BEEVT ((unsigned int) 0x3 << 28) // (TC) External Event Effect on TIOB +#define AT91C_TC_BEEVT_NONE ((unsigned int) 0x0 << 28) // (TC) Effect: none +#define AT91C_TC_BEEVT_SET ((unsigned int) 0x1 << 28) // (TC) Effect: set +#define AT91C_TC_BEEVT_CLEAR ((unsigned int) 0x2 << 28) // (TC) Effect: clear +#define AT91C_TC_BEEVT_TOGGLE ((unsigned int) 0x3 << 28) // (TC) Effect: toggle +#define AT91C_TC_BSWTRG ((unsigned int) 0x3 << 30) // (TC) Software Trigger Effect on TIOB +#define AT91C_TC_BSWTRG_NONE ((unsigned int) 0x0 << 30) // (TC) Effect: none +#define AT91C_TC_BSWTRG_SET ((unsigned int) 0x1 << 30) // (TC) Effect: set +#define AT91C_TC_BSWTRG_CLEAR ((unsigned int) 0x2 << 30) // (TC) Effect: clear +#define AT91C_TC_BSWTRG_TOGGLE ((unsigned int) 0x3 << 30) // (TC) Effect: toggle +// -------- TC_SR : (TC Offset: 0x20) TC Channel Status Register -------- +#define AT91C_TC_COVFS ((unsigned int) 0x1 << 0) // (TC) Counter Overflow +#define AT91C_TC_LOVRS ((unsigned int) 0x1 << 1) // (TC) Load Overrun +#define AT91C_TC_CPAS ((unsigned int) 0x1 << 2) // (TC) RA Compare +#define AT91C_TC_CPBS ((unsigned int) 0x1 << 3) // (TC) RB Compare +#define AT91C_TC_CPCS ((unsigned int) 0x1 << 4) // (TC) RC Compare +#define AT91C_TC_LDRAS ((unsigned int) 0x1 << 5) // (TC) RA Loading +#define AT91C_TC_LDRBS ((unsigned int) 0x1 << 6) // (TC) RB Loading +#define AT91C_TC_ETRGS ((unsigned int) 0x1 << 7) // (TC) External Trigger +#define AT91C_TC_CLKSTA ((unsigned int) 0x1 << 16) // (TC) Clock Enabling +#define AT91C_TC_MTIOA ((unsigned int) 0x1 << 17) // (TC) TIOA Mirror +#define AT91C_TC_MTIOB ((unsigned int) 0x1 << 18) // (TC) TIOA Mirror +// -------- TC_IER : (TC Offset: 0x24) TC Channel Interrupt Enable Register -------- +// -------- TC_IDR : (TC Offset: 0x28) TC Channel Interrupt Disable Register -------- +// -------- TC_IMR : (TC Offset: 0x2c) TC Channel Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Timer Counter Interface +// ***************************************************************************** +typedef struct _AT91S_TCB { + AT91S_TC TCB_TC0; // TC Channel 0 + AT91_REG Reserved0[4]; // + AT91S_TC TCB_TC1; // TC Channel 1 + AT91_REG Reserved1[4]; // + AT91S_TC TCB_TC2; // TC Channel 2 + AT91_REG Reserved2[4]; // + AT91_REG TCB_BCR; // TC Block Control Register + AT91_REG TCB_BMR; // TC Block Mode Register +} AT91S_TCB, *AT91PS_TCB; + +// -------- TCB_BCR : (TCB Offset: 0xc0) TC Block Control Register -------- +#define AT91C_TCB_SYNC ((unsigned int) 0x1 << 0) // (TCB) Synchro Command +// -------- TCB_BMR : (TCB Offset: 0xc4) TC Block Mode Register -------- +#define AT91C_TCB_TC0XC0S ((unsigned int) 0x3 << 0) // (TCB) External Clock Signal 0 Selection +#define AT91C_TCB_TC0XC0S_TCLK0 ((unsigned int) 0x0) // (TCB) TCLK0 connected to XC0 +#define AT91C_TCB_TC0XC0S_NONE ((unsigned int) 0x1) // (TCB) None signal connected to XC0 +#define AT91C_TCB_TC0XC0S_TIOA1 ((unsigned int) 0x2) // (TCB) TIOA1 connected to XC0 +#define AT91C_TCB_TC0XC0S_TIOA2 ((unsigned int) 0x3) // (TCB) TIOA2 connected to XC0 +#define AT91C_TCB_TC1XC1S ((unsigned int) 0x3 << 2) // (TCB) External Clock Signal 1 Selection +#define AT91C_TCB_TC1XC1S_TCLK1 ((unsigned int) 0x0 << 2) // (TCB) TCLK1 connected to XC1 +#define AT91C_TCB_TC1XC1S_NONE ((unsigned int) 0x1 << 2) // (TCB) None signal connected to XC1 +#define AT91C_TCB_TC1XC1S_TIOA0 ((unsigned int) 0x2 << 2) // (TCB) TIOA0 connected to XC1 +#define AT91C_TCB_TC1XC1S_TIOA2 ((unsigned int) 0x3 << 2) // (TCB) TIOA2 connected to XC1 +#define AT91C_TCB_TC2XC2S ((unsigned int) 0x3 << 4) // (TCB) External Clock Signal 2 Selection +#define AT91C_TCB_TC2XC2S_TCLK2 ((unsigned int) 0x0 << 4) // (TCB) TCLK2 connected to XC2 +#define AT91C_TCB_TC2XC2S_NONE ((unsigned int) 0x1 << 4) // (TCB) None signal connected to XC2 +#define AT91C_TCB_TC2XC2S_TIOA0 ((unsigned int) 0x2 << 4) // (TCB) TIOA0 connected to XC2 +#define AT91C_TCB_TC2XC2S_TIOA1 ((unsigned int) 0x3 << 4) // (TCB) TIOA2 connected to XC2 + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Control Area Network MailBox Interface +// ***************************************************************************** +typedef struct _AT91S_CAN_MB { + AT91_REG CAN_MB_MMR; // MailBox Mode Register + AT91_REG CAN_MB_MAM; // MailBox Acceptance Mask Register + AT91_REG CAN_MB_MID; // MailBox ID Register + AT91_REG CAN_MB_MFID; // MailBox Family ID Register + AT91_REG CAN_MB_MSR; // MailBox Status Register + AT91_REG CAN_MB_MDL; // MailBox Data Low Register + AT91_REG CAN_MB_MDH; // MailBox Data High Register + AT91_REG CAN_MB_MCR; // MailBox Control Register +} AT91S_CAN_MB, *AT91PS_CAN_MB; + +// -------- CAN_MMR : (CAN_MB Offset: 0x0) CAN Message Mode Register -------- +#define AT91C_CAN_MTIMEMARK ((unsigned int) 0xFFFF << 0) // (CAN_MB) Mailbox Timemark +#define AT91C_CAN_PRIOR ((unsigned int) 0xF << 16) // (CAN_MB) Mailbox Priority +#define AT91C_CAN_MOT ((unsigned int) 0x7 << 24) // (CAN_MB) Mailbox Object Type +#define AT91C_CAN_MOT_DIS ((unsigned int) 0x0 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_RX ((unsigned int) 0x1 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_RXOVERWRITE ((unsigned int) 0x2 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_TX ((unsigned int) 0x3 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_CONSUMER ((unsigned int) 0x4 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_PRODUCER ((unsigned int) 0x5 << 24) // (CAN_MB) +// -------- CAN_MAM : (CAN_MB Offset: 0x4) CAN Message Acceptance Mask Register -------- +#define AT91C_CAN_MIDvB ((unsigned int) 0x3FFFF << 0) // (CAN_MB) Complementary bits for identifier in extended mode +#define AT91C_CAN_MIDvA ((unsigned int) 0x7FF << 18) // (CAN_MB) Identifier for standard frame mode +#define AT91C_CAN_MIDE ((unsigned int) 0x1 << 29) // (CAN_MB) Identifier Version +// -------- CAN_MID : (CAN_MB Offset: 0x8) CAN Message ID Register -------- +// -------- CAN_MFID : (CAN_MB Offset: 0xc) CAN Message Family ID Register -------- +// -------- CAN_MSR : (CAN_MB Offset: 0x10) CAN Message Status Register -------- +#define AT91C_CAN_MTIMESTAMP ((unsigned int) 0xFFFF << 0) // (CAN_MB) Timer Value +#define AT91C_CAN_MDLC ((unsigned int) 0xF << 16) // (CAN_MB) Mailbox Data Length Code +#define AT91C_CAN_MRTR ((unsigned int) 0x1 << 20) // (CAN_MB) Mailbox Remote Transmission Request +#define AT91C_CAN_MABT ((unsigned int) 0x1 << 22) // (CAN_MB) Mailbox Message Abort +#define AT91C_CAN_MRDY ((unsigned int) 0x1 << 23) // (CAN_MB) Mailbox Ready +#define AT91C_CAN_MMI ((unsigned int) 0x1 << 24) // (CAN_MB) Mailbox Message Ignored +// -------- CAN_MDL : (CAN_MB Offset: 0x14) CAN Message Data Low Register -------- +// -------- CAN_MDH : (CAN_MB Offset: 0x18) CAN Message Data High Register -------- +// -------- CAN_MCR : (CAN_MB Offset: 0x1c) CAN Message Control Register -------- +#define AT91C_CAN_MACR ((unsigned int) 0x1 << 22) // (CAN_MB) Abort Request for Mailbox +#define AT91C_CAN_MTCR ((unsigned int) 0x1 << 23) // (CAN_MB) Mailbox Transfer Command + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Control Area Network Interface +// ***************************************************************************** +typedef struct _AT91S_CAN { + AT91_REG CAN_MR; // Mode Register + AT91_REG CAN_IER; // Interrupt Enable Register + AT91_REG CAN_IDR; // Interrupt Disable Register + AT91_REG CAN_IMR; // Interrupt Mask Register + AT91_REG CAN_SR; // Status Register + AT91_REG CAN_BR; // Baudrate Register + AT91_REG CAN_TIM; // Timer Register + AT91_REG CAN_TIMESTP; // Time Stamp Register + AT91_REG CAN_ECR; // Error Counter Register + AT91_REG CAN_TCR; // Transfer Command Register + AT91_REG CAN_ACR; // Abort Command Register + AT91_REG Reserved0[52]; // + AT91_REG CAN_VR; // Version Register + AT91_REG Reserved1[64]; // + AT91S_CAN_MB CAN_MB0; // CAN Mailbox 0 + AT91S_CAN_MB CAN_MB1; // CAN Mailbox 1 + AT91S_CAN_MB CAN_MB2; // CAN Mailbox 2 + AT91S_CAN_MB CAN_MB3; // CAN Mailbox 3 + AT91S_CAN_MB CAN_MB4; // CAN Mailbox 4 + AT91S_CAN_MB CAN_MB5; // CAN Mailbox 5 + AT91S_CAN_MB CAN_MB6; // CAN Mailbox 6 + AT91S_CAN_MB CAN_MB7; // CAN Mailbox 7 + AT91S_CAN_MB CAN_MB8; // CAN Mailbox 8 + AT91S_CAN_MB CAN_MB9; // CAN Mailbox 9 + AT91S_CAN_MB CAN_MB10; // CAN Mailbox 10 + AT91S_CAN_MB CAN_MB11; // CAN Mailbox 11 + AT91S_CAN_MB CAN_MB12; // CAN Mailbox 12 + AT91S_CAN_MB CAN_MB13; // CAN Mailbox 13 + AT91S_CAN_MB CAN_MB14; // CAN Mailbox 14 + AT91S_CAN_MB CAN_MB15; // CAN Mailbox 15 +} AT91S_CAN, *AT91PS_CAN; + +// -------- CAN_MR : (CAN Offset: 0x0) CAN Mode Register -------- +#define AT91C_CAN_CANEN ((unsigned int) 0x1 << 0) // (CAN) CAN Controller Enable +#define AT91C_CAN_LPM ((unsigned int) 0x1 << 1) // (CAN) Disable/Enable Low Power Mode +#define AT91C_CAN_ABM ((unsigned int) 0x1 << 2) // (CAN) Disable/Enable Autobaud/Listen Mode +#define AT91C_CAN_OVL ((unsigned int) 0x1 << 3) // (CAN) Disable/Enable Overload Frame +#define AT91C_CAN_TEOF ((unsigned int) 0x1 << 4) // (CAN) Time Stamp messages at each end of Frame +#define AT91C_CAN_TTM ((unsigned int) 0x1 << 5) // (CAN) Disable/Enable Time Trigger Mode +#define AT91C_CAN_TIMFRZ ((unsigned int) 0x1 << 6) // (CAN) Enable Timer Freeze +#define AT91C_CAN_DRPT ((unsigned int) 0x1 << 7) // (CAN) Disable Repeat +// -------- CAN_IER : (CAN Offset: 0x4) CAN Interrupt Enable Register -------- +#define AT91C_CAN_MB0 ((unsigned int) 0x1 << 0) // (CAN) Mailbox 0 Flag +#define AT91C_CAN_MB1 ((unsigned int) 0x1 << 1) // (CAN) Mailbox 1 Flag +#define AT91C_CAN_MB2 ((unsigned int) 0x1 << 2) // (CAN) Mailbox 2 Flag +#define AT91C_CAN_MB3 ((unsigned int) 0x1 << 3) // (CAN) Mailbox 3 Flag +#define AT91C_CAN_MB4 ((unsigned int) 0x1 << 4) // (CAN) Mailbox 4 Flag +#define AT91C_CAN_MB5 ((unsigned int) 0x1 << 5) // (CAN) Mailbox 5 Flag +#define AT91C_CAN_MB6 ((unsigned int) 0x1 << 6) // (CAN) Mailbox 6 Flag +#define AT91C_CAN_MB7 ((unsigned int) 0x1 << 7) // (CAN) Mailbox 7 Flag +#define AT91C_CAN_MB8 ((unsigned int) 0x1 << 8) // (CAN) Mailbox 8 Flag +#define AT91C_CAN_MB9 ((unsigned int) 0x1 << 9) // (CAN) Mailbox 9 Flag +#define AT91C_CAN_MB10 ((unsigned int) 0x1 << 10) // (CAN) Mailbox 10 Flag +#define AT91C_CAN_MB11 ((unsigned int) 0x1 << 11) // (CAN) Mailbox 11 Flag +#define AT91C_CAN_MB12 ((unsigned int) 0x1 << 12) // (CAN) Mailbox 12 Flag +#define AT91C_CAN_MB13 ((unsigned int) 0x1 << 13) // (CAN) Mailbox 13 Flag +#define AT91C_CAN_MB14 ((unsigned int) 0x1 << 14) // (CAN) Mailbox 14 Flag +#define AT91C_CAN_MB15 ((unsigned int) 0x1 << 15) // (CAN) Mailbox 15 Flag +#define AT91C_CAN_ERRA ((unsigned int) 0x1 << 16) // (CAN) Error Active Mode Flag +#define AT91C_CAN_WARN ((unsigned int) 0x1 << 17) // (CAN) Warning Limit Flag +#define AT91C_CAN_ERRP ((unsigned int) 0x1 << 18) // (CAN) Error Passive Mode Flag +#define AT91C_CAN_BOFF ((unsigned int) 0x1 << 19) // (CAN) Bus Off Mode Flag +#define AT91C_CAN_SLEEP ((unsigned int) 0x1 << 20) // (CAN) Sleep Flag +#define AT91C_CAN_WAKEUP ((unsigned int) 0x1 << 21) // (CAN) Wakeup Flag +#define AT91C_CAN_TOVF ((unsigned int) 0x1 << 22) // (CAN) Timer Overflow Flag +#define AT91C_CAN_TSTP ((unsigned int) 0x1 << 23) // (CAN) Timestamp Flag +#define AT91C_CAN_CERR ((unsigned int) 0x1 << 24) // (CAN) CRC Error +#define AT91C_CAN_SERR ((unsigned int) 0x1 << 25) // (CAN) Stuffing Error +#define AT91C_CAN_AERR ((unsigned int) 0x1 << 26) // (CAN) Acknowledgment Error +#define AT91C_CAN_FERR ((unsigned int) 0x1 << 27) // (CAN) Form Error +#define AT91C_CAN_BERR ((unsigned int) 0x1 << 28) // (CAN) Bit Error +// -------- CAN_IDR : (CAN Offset: 0x8) CAN Interrupt Disable Register -------- +// -------- CAN_IMR : (CAN Offset: 0xc) CAN Interrupt Mask Register -------- +// -------- CAN_SR : (CAN Offset: 0x10) CAN Status Register -------- +#define AT91C_CAN_RBSY ((unsigned int) 0x1 << 29) // (CAN) Receiver Busy +#define AT91C_CAN_TBSY ((unsigned int) 0x1 << 30) // (CAN) Transmitter Busy +#define AT91C_CAN_OVLY ((unsigned int) 0x1 << 31) // (CAN) Overload Busy +// -------- CAN_BR : (CAN Offset: 0x14) CAN Baudrate Register -------- +#define AT91C_CAN_PHASE2 ((unsigned int) 0x7 << 0) // (CAN) Phase 2 segment +#define AT91C_CAN_PHASE1 ((unsigned int) 0x7 << 4) // (CAN) Phase 1 segment +#define AT91C_CAN_PROPAG ((unsigned int) 0x7 << 8) // (CAN) Programmation time segment +#define AT91C_CAN_SYNC ((unsigned int) 0x3 << 12) // (CAN) Re-synchronization jump width segment +#define AT91C_CAN_BRP ((unsigned int) 0x7F << 16) // (CAN) Baudrate Prescaler +#define AT91C_CAN_SMP ((unsigned int) 0x1 << 24) // (CAN) Sampling mode +// -------- CAN_TIM : (CAN Offset: 0x18) CAN Timer Register -------- +#define AT91C_CAN_TIMER ((unsigned int) 0xFFFF << 0) // (CAN) Timer field +// -------- CAN_TIMESTP : (CAN Offset: 0x1c) CAN Timestamp Register -------- +// -------- CAN_ECR : (CAN Offset: 0x20) CAN Error Counter Register -------- +#define AT91C_CAN_REC ((unsigned int) 0xFF << 0) // (CAN) Receive Error Counter +#define AT91C_CAN_TEC ((unsigned int) 0xFF << 16) // (CAN) Transmit Error Counter +// -------- CAN_TCR : (CAN Offset: 0x24) CAN Transfer Command Register -------- +#define AT91C_CAN_TIMRST ((unsigned int) 0x1 << 31) // (CAN) Timer Reset Field +// -------- CAN_ACR : (CAN Offset: 0x28) CAN Abort Command Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Ethernet MAC 10/100 +// ***************************************************************************** +typedef struct _AT91S_EMAC { + AT91_REG EMAC_NCR; // Network Control Register + AT91_REG EMAC_NCFGR; // Network Configuration Register + AT91_REG EMAC_NSR; // Network Status Register + AT91_REG Reserved0[2]; // + AT91_REG EMAC_TSR; // Transmit Status Register + AT91_REG EMAC_RBQP; // Receive Buffer Queue Pointer + AT91_REG EMAC_TBQP; // Transmit Buffer Queue Pointer + AT91_REG EMAC_RSR; // Receive Status Register + AT91_REG EMAC_ISR; // Interrupt Status Register + AT91_REG EMAC_IER; // Interrupt Enable Register + AT91_REG EMAC_IDR; // Interrupt Disable Register + AT91_REG EMAC_IMR; // Interrupt Mask Register + AT91_REG EMAC_MAN; // PHY Maintenance Register + AT91_REG EMAC_PTR; // Pause Time Register + AT91_REG EMAC_PFR; // Pause Frames received Register + AT91_REG EMAC_FTO; // Frames Transmitted OK Register + AT91_REG EMAC_SCF; // Single Collision Frame Register + AT91_REG EMAC_MCF; // Multiple Collision Frame Register + AT91_REG EMAC_FRO; // Frames Received OK Register + AT91_REG EMAC_FCSE; // Frame Check Sequence Error Register + AT91_REG EMAC_ALE; // Alignment Error Register + AT91_REG EMAC_DTF; // Deferred Transmission Frame Register + AT91_REG EMAC_LCOL; // Late Collision Register + AT91_REG EMAC_ECOL; // Excessive Collision Register + AT91_REG EMAC_TUND; // Transmit Underrun Error Register + AT91_REG EMAC_CSE; // Carrier Sense Error Register + AT91_REG EMAC_RRE; // Receive Ressource Error Register + AT91_REG EMAC_ROV; // Receive Overrun Errors Register + AT91_REG EMAC_RSE; // Receive Symbol Errors Register + AT91_REG EMAC_ELE; // Excessive Length Errors Register + AT91_REG EMAC_RJA; // Receive Jabbers Register + AT91_REG EMAC_USF; // Undersize Frames Register + AT91_REG EMAC_STE; // SQE Test Error Register + AT91_REG EMAC_RLE; // Receive Length Field Mismatch Register + AT91_REG EMAC_TPF; // Transmitted Pause Frames Register + AT91_REG EMAC_HRB; // Hash Address Bottom[31:0] + AT91_REG EMAC_HRT; // Hash Address Top[63:32] + AT91_REG EMAC_SA1L; // Specific Address 1 Bottom, First 4 bytes + AT91_REG EMAC_SA1H; // Specific Address 1 Top, Last 2 bytes + AT91_REG EMAC_SA2L; // Specific Address 2 Bottom, First 4 bytes + AT91_REG EMAC_SA2H; // Specific Address 2 Top, Last 2 bytes + AT91_REG EMAC_SA3L; // Specific Address 3 Bottom, First 4 bytes + AT91_REG EMAC_SA3H; // Specific Address 3 Top, Last 2 bytes + AT91_REG EMAC_SA4L; // Specific Address 4 Bottom, First 4 bytes + AT91_REG EMAC_SA4H; // Specific Address 4 Top, Last 2 bytes + AT91_REG EMAC_TID; // Type ID Checking Register + AT91_REG EMAC_TPQ; // Transmit Pause Quantum Register + AT91_REG EMAC_USRIO; // USER Input/Output Register + AT91_REG EMAC_WOL; // Wake On LAN Register + AT91_REG Reserved1[13]; // + AT91_REG EMAC_REV; // Revision Register +} AT91S_EMAC, *AT91PS_EMAC; + +// -------- EMAC_NCR : (EMAC Offset: 0x0) -------- +#define AT91C_EMAC_LB ((unsigned int) 0x1 << 0) // (EMAC) Loopback. Optional. When set, loopback signal is at high level. +#define AT91C_EMAC_LLB ((unsigned int) 0x1 << 1) // (EMAC) Loopback local. +#define AT91C_EMAC_RE ((unsigned int) 0x1 << 2) // (EMAC) Receive enable. +#define AT91C_EMAC_TE ((unsigned int) 0x1 << 3) // (EMAC) Transmit enable. +#define AT91C_EMAC_MPE ((unsigned int) 0x1 << 4) // (EMAC) Management port enable. +#define AT91C_EMAC_CLRSTAT ((unsigned int) 0x1 << 5) // (EMAC) Clear statistics registers. +#define AT91C_EMAC_INCSTAT ((unsigned int) 0x1 << 6) // (EMAC) Increment statistics registers. +#define AT91C_EMAC_WESTAT ((unsigned int) 0x1 << 7) // (EMAC) Write enable for statistics registers. +#define AT91C_EMAC_BP ((unsigned int) 0x1 << 8) // (EMAC) Back pressure. +#define AT91C_EMAC_TSTART ((unsigned int) 0x1 << 9) // (EMAC) Start Transmission. +#define AT91C_EMAC_THALT ((unsigned int) 0x1 << 10) // (EMAC) Transmission Halt. +#define AT91C_EMAC_TPFR ((unsigned int) 0x1 << 11) // (EMAC) Transmit pause frame +#define AT91C_EMAC_TZQ ((unsigned int) 0x1 << 12) // (EMAC) Transmit zero quantum pause frame +// -------- EMAC_NCFGR : (EMAC Offset: 0x4) Network Configuration Register -------- +#define AT91C_EMAC_SPD ((unsigned int) 0x1 << 0) // (EMAC) Speed. +#define AT91C_EMAC_FD ((unsigned int) 0x1 << 1) // (EMAC) Full duplex. +#define AT91C_EMAC_JFRAME ((unsigned int) 0x1 << 3) // (EMAC) Jumbo Frames. +#define AT91C_EMAC_CAF ((unsigned int) 0x1 << 4) // (EMAC) Copy all frames. +#define AT91C_EMAC_NBC ((unsigned int) 0x1 << 5) // (EMAC) No broadcast. +#define AT91C_EMAC_MTI ((unsigned int) 0x1 << 6) // (EMAC) Multicast hash event enable +#define AT91C_EMAC_UNI ((unsigned int) 0x1 << 7) // (EMAC) Unicast hash enable. +#define AT91C_EMAC_BIG ((unsigned int) 0x1 << 8) // (EMAC) Receive 1522 bytes. +#define AT91C_EMAC_EAE ((unsigned int) 0x1 << 9) // (EMAC) External address match enable. +#define AT91C_EMAC_CLK ((unsigned int) 0x3 << 10) // (EMAC) +#define AT91C_EMAC_CLK_HCLK_8 ((unsigned int) 0x0 << 10) // (EMAC) HCLK divided by 8 +#define AT91C_EMAC_CLK_HCLK_16 ((unsigned int) 0x1 << 10) // (EMAC) HCLK divided by 16 +#define AT91C_EMAC_CLK_HCLK_32 ((unsigned int) 0x2 << 10) // (EMAC) HCLK divided by 32 +#define AT91C_EMAC_CLK_HCLK_64 ((unsigned int) 0x3 << 10) // (EMAC) HCLK divided by 64 +#define AT91C_EMAC_RTY ((unsigned int) 0x1 << 12) // (EMAC) +#define AT91C_EMAC_PAE ((unsigned int) 0x1 << 13) // (EMAC) +#define AT91C_EMAC_RBOF ((unsigned int) 0x3 << 14) // (EMAC) +#define AT91C_EMAC_RBOF_OFFSET_0 ((unsigned int) 0x0 << 14) // (EMAC) no offset from start of receive buffer +#define AT91C_EMAC_RBOF_OFFSET_1 ((unsigned int) 0x1 << 14) // (EMAC) one byte offset from start of receive buffer +#define AT91C_EMAC_RBOF_OFFSET_2 ((unsigned int) 0x2 << 14) // (EMAC) two bytes offset from start of receive buffer +#define AT91C_EMAC_RBOF_OFFSET_3 ((unsigned int) 0x3 << 14) // (EMAC) three bytes offset from start of receive buffer +#define AT91C_EMAC_RLCE ((unsigned int) 0x1 << 16) // (EMAC) Receive Length field Checking Enable +#define AT91C_EMAC_DRFCS ((unsigned int) 0x1 << 17) // (EMAC) Discard Receive FCS +#define AT91C_EMAC_EFRHD ((unsigned int) 0x1 << 18) // (EMAC) +#define AT91C_EMAC_IRXFCS ((unsigned int) 0x1 << 19) // (EMAC) Ignore RX FCS +// -------- EMAC_NSR : (EMAC Offset: 0x8) Network Status Register -------- +#define AT91C_EMAC_LINKR ((unsigned int) 0x1 << 0) // (EMAC) +#define AT91C_EMAC_MDIO ((unsigned int) 0x1 << 1) // (EMAC) +#define AT91C_EMAC_IDLE ((unsigned int) 0x1 << 2) // (EMAC) +// -------- EMAC_TSR : (EMAC Offset: 0x14) Transmit Status Register -------- +#define AT91C_EMAC_UBR ((unsigned int) 0x1 << 0) // (EMAC) +#define AT91C_EMAC_COL ((unsigned int) 0x1 << 1) // (EMAC) +#define AT91C_EMAC_RLES ((unsigned int) 0x1 << 2) // (EMAC) +#define AT91C_EMAC_TGO ((unsigned int) 0x1 << 3) // (EMAC) Transmit Go +#define AT91C_EMAC_BEX ((unsigned int) 0x1 << 4) // (EMAC) Buffers exhausted mid frame +#define AT91C_EMAC_COMP ((unsigned int) 0x1 << 5) // (EMAC) +#define AT91C_EMAC_UND ((unsigned int) 0x1 << 6) // (EMAC) +// -------- EMAC_RSR : (EMAC Offset: 0x20) Receive Status Register -------- +#define AT91C_EMAC_BNA ((unsigned int) 0x1 << 0) // (EMAC) +#define AT91C_EMAC_REC ((unsigned int) 0x1 << 1) // (EMAC) +#define AT91C_EMAC_OVR ((unsigned int) 0x1 << 2) // (EMAC) +// -------- EMAC_ISR : (EMAC Offset: 0x24) Interrupt Status Register -------- +#define AT91C_EMAC_MFD ((unsigned int) 0x1 << 0) // (EMAC) +#define AT91C_EMAC_RCOMP ((unsigned int) 0x1 << 1) // (EMAC) +#define AT91C_EMAC_RXUBR ((unsigned int) 0x1 << 2) // (EMAC) +#define AT91C_EMAC_TXUBR ((unsigned int) 0x1 << 3) // (EMAC) +#define AT91C_EMAC_TUNDR ((unsigned int) 0x1 << 4) // (EMAC) +#define AT91C_EMAC_RLEX ((unsigned int) 0x1 << 5) // (EMAC) +#define AT91C_EMAC_TXERR ((unsigned int) 0x1 << 6) // (EMAC) +#define AT91C_EMAC_TCOMP ((unsigned int) 0x1 << 7) // (EMAC) +#define AT91C_EMAC_LINK ((unsigned int) 0x1 << 9) // (EMAC) +#define AT91C_EMAC_ROVR ((unsigned int) 0x1 << 10) // (EMAC) +#define AT91C_EMAC_HRESP ((unsigned int) 0x1 << 11) // (EMAC) +#define AT91C_EMAC_PFRE ((unsigned int) 0x1 << 12) // (EMAC) +#define AT91C_EMAC_PTZ ((unsigned int) 0x1 << 13) // (EMAC) +// -------- EMAC_IER : (EMAC Offset: 0x28) Interrupt Enable Register -------- +// -------- EMAC_IDR : (EMAC Offset: 0x2c) Interrupt Disable Register -------- +// -------- EMAC_IMR : (EMAC Offset: 0x30) Interrupt Mask Register -------- +// -------- EMAC_MAN : (EMAC Offset: 0x34) PHY Maintenance Register -------- +#define AT91C_EMAC_DATA ((unsigned int) 0xFFFF << 0) // (EMAC) +#define AT91C_EMAC_CODE ((unsigned int) 0x3 << 16) // (EMAC) +#define AT91C_EMAC_REGA ((unsigned int) 0x1F << 18) // (EMAC) +#define AT91C_EMAC_PHYA ((unsigned int) 0x1F << 23) // (EMAC) +#define AT91C_EMAC_RW ((unsigned int) 0x3 << 28) // (EMAC) +#define AT91C_EMAC_SOF ((unsigned int) 0x3 << 30) // (EMAC) +// -------- EMAC_USRIO : (EMAC Offset: 0xc0) USER Input Output Register -------- +#define AT91C_EMAC_RMII ((unsigned int) 0x1 << 0) // (EMAC) Reduce MII +#define AT91C_EMAC_CLKEN ((unsigned int) 0x1 << 1) // (EMAC) Clock Enable +// -------- EMAC_WOL : (EMAC Offset: 0xc4) Wake On LAN Register -------- +#define AT91C_EMAC_IP ((unsigned int) 0xFFFF << 0) // (EMAC) ARP request IP address +#define AT91C_EMAC_MAG ((unsigned int) 0x1 << 16) // (EMAC) Magic packet event enable +#define AT91C_EMAC_ARP ((unsigned int) 0x1 << 17) // (EMAC) ARP request event enable +#define AT91C_EMAC_SA1 ((unsigned int) 0x1 << 18) // (EMAC) Specific address register 1 event enable +// -------- EMAC_REV : (EMAC Offset: 0xfc) Revision Register -------- +#define AT91C_EMAC_REVREF ((unsigned int) 0xFFFF << 0) // (EMAC) +#define AT91C_EMAC_PARTREF ((unsigned int) 0xFFFF << 16) // (EMAC) + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Analog to Digital Convertor +// ***************************************************************************** +typedef struct _AT91S_ADC { + AT91_REG ADC_CR; // ADC Control Register + AT91_REG ADC_MR; // ADC Mode Register + AT91_REG Reserved0[2]; // + AT91_REG ADC_CHER; // ADC Channel Enable Register + AT91_REG ADC_CHDR; // ADC Channel Disable Register + AT91_REG ADC_CHSR; // ADC Channel Status Register + AT91_REG ADC_SR; // ADC Status Register + AT91_REG ADC_LCDR; // ADC Last Converted Data Register + AT91_REG ADC_IER; // ADC Interrupt Enable Register + AT91_REG ADC_IDR; // ADC Interrupt Disable Register + AT91_REG ADC_IMR; // ADC Interrupt Mask Register + AT91_REG ADC_CDR0; // ADC Channel Data Register 0 + AT91_REG ADC_CDR1; // ADC Channel Data Register 1 + AT91_REG ADC_CDR2; // ADC Channel Data Register 2 + AT91_REG ADC_CDR3; // ADC Channel Data Register 3 + AT91_REG ADC_CDR4; // ADC Channel Data Register 4 + AT91_REG ADC_CDR5; // ADC Channel Data Register 5 + AT91_REG ADC_CDR6; // ADC Channel Data Register 6 + AT91_REG ADC_CDR7; // ADC Channel Data Register 7 + AT91_REG Reserved1[44]; // + AT91_REG ADC_RPR; // Receive Pointer Register + AT91_REG ADC_RCR; // Receive Counter Register + AT91_REG ADC_TPR; // Transmit Pointer Register + AT91_REG ADC_TCR; // Transmit Counter Register + AT91_REG ADC_RNPR; // Receive Next Pointer Register + AT91_REG ADC_RNCR; // Receive Next Counter Register + AT91_REG ADC_TNPR; // Transmit Next Pointer Register + AT91_REG ADC_TNCR; // Transmit Next Counter Register + AT91_REG ADC_PTCR; // PDC Transfer Control Register + AT91_REG ADC_PTSR; // PDC Transfer Status Register +} AT91S_ADC, *AT91PS_ADC; + +// -------- ADC_CR : (ADC Offset: 0x0) ADC Control Register -------- +#define AT91C_ADC_SWRST ((unsigned int) 0x1 << 0) // (ADC) Software Reset +#define AT91C_ADC_START ((unsigned int) 0x1 << 1) // (ADC) Start Conversion +// -------- ADC_MR : (ADC Offset: 0x4) ADC Mode Register -------- +#define AT91C_ADC_TRGEN ((unsigned int) 0x1 << 0) // (ADC) Trigger Enable +#define AT91C_ADC_TRGEN_DIS ((unsigned int) 0x0) // (ADC) Hradware triggers are disabled. Starting a conversion is only possible by software +#define AT91C_ADC_TRGEN_EN ((unsigned int) 0x1) // (ADC) Hardware trigger selected by TRGSEL field is enabled. +#define AT91C_ADC_TRGSEL ((unsigned int) 0x7 << 1) // (ADC) Trigger Selection +#define AT91C_ADC_TRGSEL_TIOA0 ((unsigned int) 0x0 << 1) // (ADC) Selected TRGSEL = TIAO0 +#define AT91C_ADC_TRGSEL_TIOA1 ((unsigned int) 0x1 << 1) // (ADC) Selected TRGSEL = TIAO1 +#define AT91C_ADC_TRGSEL_TIOA2 ((unsigned int) 0x2 << 1) // (ADC) Selected TRGSEL = TIAO2 +#define AT91C_ADC_TRGSEL_TIOA3 ((unsigned int) 0x3 << 1) // (ADC) Selected TRGSEL = TIAO3 +#define AT91C_ADC_TRGSEL_TIOA4 ((unsigned int) 0x4 << 1) // (ADC) Selected TRGSEL = TIAO4 +#define AT91C_ADC_TRGSEL_TIOA5 ((unsigned int) 0x5 << 1) // (ADC) Selected TRGSEL = TIAO5 +#define AT91C_ADC_TRGSEL_EXT ((unsigned int) 0x6 << 1) // (ADC) Selected TRGSEL = External Trigger +#define AT91C_ADC_LOWRES ((unsigned int) 0x1 << 4) // (ADC) Resolution. +#define AT91C_ADC_LOWRES_10_BIT ((unsigned int) 0x0 << 4) // (ADC) 10-bit resolution +#define AT91C_ADC_LOWRES_8_BIT ((unsigned int) 0x1 << 4) // (ADC) 8-bit resolution +#define AT91C_ADC_SLEEP ((unsigned int) 0x1 << 5) // (ADC) Sleep Mode +#define AT91C_ADC_SLEEP_NORMAL_MODE ((unsigned int) 0x0 << 5) // (ADC) Normal Mode +#define AT91C_ADC_SLEEP_MODE ((unsigned int) 0x1 << 5) // (ADC) Sleep Mode +#define AT91C_ADC_PRESCAL ((unsigned int) 0x3F << 8) // (ADC) Prescaler rate selection +#define AT91C_ADC_STARTUP ((unsigned int) 0x1F << 16) // (ADC) Startup Time +#define AT91C_ADC_SHTIM ((unsigned int) 0xF << 24) // (ADC) Sample & Hold Time +// -------- ADC_CHER : (ADC Offset: 0x10) ADC Channel Enable Register -------- +#define AT91C_ADC_CH0 ((unsigned int) 0x1 << 0) // (ADC) Channel 0 +#define AT91C_ADC_CH1 ((unsigned int) 0x1 << 1) // (ADC) Channel 1 +#define AT91C_ADC_CH2 ((unsigned int) 0x1 << 2) // (ADC) Channel 2 +#define AT91C_ADC_CH3 ((unsigned int) 0x1 << 3) // (ADC) Channel 3 +#define AT91C_ADC_CH4 ((unsigned int) 0x1 << 4) // (ADC) Channel 4 +#define AT91C_ADC_CH5 ((unsigned int) 0x1 << 5) // (ADC) Channel 5 +#define AT91C_ADC_CH6 ((unsigned int) 0x1 << 6) // (ADC) Channel 6 +#define AT91C_ADC_CH7 ((unsigned int) 0x1 << 7) // (ADC) Channel 7 +// -------- ADC_CHDR : (ADC Offset: 0x14) ADC Channel Disable Register -------- +// -------- ADC_CHSR : (ADC Offset: 0x18) ADC Channel Status Register -------- +// -------- ADC_SR : (ADC Offset: 0x1c) ADC Status Register -------- +#define AT91C_ADC_EOC0 ((unsigned int) 0x1 << 0) // (ADC) End of Conversion +#define AT91C_ADC_EOC1 ((unsigned int) 0x1 << 1) // (ADC) End of Conversion +#define AT91C_ADC_EOC2 ((unsigned int) 0x1 << 2) // (ADC) End of Conversion +#define AT91C_ADC_EOC3 ((unsigned int) 0x1 << 3) // (ADC) End of Conversion +#define AT91C_ADC_EOC4 ((unsigned int) 0x1 << 4) // (ADC) End of Conversion +#define AT91C_ADC_EOC5 ((unsigned int) 0x1 << 5) // (ADC) End of Conversion +#define AT91C_ADC_EOC6 ((unsigned int) 0x1 << 6) // (ADC) End of Conversion +#define AT91C_ADC_EOC7 ((unsigned int) 0x1 << 7) // (ADC) End of Conversion +#define AT91C_ADC_OVRE0 ((unsigned int) 0x1 << 8) // (ADC) Overrun Error +#define AT91C_ADC_OVRE1 ((unsigned int) 0x1 << 9) // (ADC) Overrun Error +#define AT91C_ADC_OVRE2 ((unsigned int) 0x1 << 10) // (ADC) Overrun Error +#define AT91C_ADC_OVRE3 ((unsigned int) 0x1 << 11) // (ADC) Overrun Error +#define AT91C_ADC_OVRE4 ((unsigned int) 0x1 << 12) // (ADC) Overrun Error +#define AT91C_ADC_OVRE5 ((unsigned int) 0x1 << 13) // (ADC) Overrun Error +#define AT91C_ADC_OVRE6 ((unsigned int) 0x1 << 14) // (ADC) Overrun Error +#define AT91C_ADC_OVRE7 ((unsigned int) 0x1 << 15) // (ADC) Overrun Error +#define AT91C_ADC_DRDY ((unsigned int) 0x1 << 16) // (ADC) Data Ready +#define AT91C_ADC_GOVRE ((unsigned int) 0x1 << 17) // (ADC) General Overrun +#define AT91C_ADC_ENDRX ((unsigned int) 0x1 << 18) // (ADC) End of Receiver Transfer +#define AT91C_ADC_RXBUFF ((unsigned int) 0x1 << 19) // (ADC) RXBUFF Interrupt +// -------- ADC_LCDR : (ADC Offset: 0x20) ADC Last Converted Data Register -------- +#define AT91C_ADC_LDATA ((unsigned int) 0x3FF << 0) // (ADC) Last Data Converted +// -------- ADC_IER : (ADC Offset: 0x24) ADC Interrupt Enable Register -------- +// -------- ADC_IDR : (ADC Offset: 0x28) ADC Interrupt Disable Register -------- +// -------- ADC_IMR : (ADC Offset: 0x2c) ADC Interrupt Mask Register -------- +// -------- ADC_CDR0 : (ADC Offset: 0x30) ADC Channel Data Register 0 -------- +#define AT91C_ADC_DATA ((unsigned int) 0x3FF << 0) // (ADC) Converted Data +// -------- ADC_CDR1 : (ADC Offset: 0x34) ADC Channel Data Register 1 -------- +// -------- ADC_CDR2 : (ADC Offset: 0x38) ADC Channel Data Register 2 -------- +// -------- ADC_CDR3 : (ADC Offset: 0x3c) ADC Channel Data Register 3 -------- +// -------- ADC_CDR4 : (ADC Offset: 0x40) ADC Channel Data Register 4 -------- +// -------- ADC_CDR5 : (ADC Offset: 0x44) ADC Channel Data Register 5 -------- +// -------- ADC_CDR6 : (ADC Offset: 0x48) ADC Channel Data Register 6 -------- +// -------- ADC_CDR7 : (ADC Offset: 0x4c) ADC Channel Data Register 7 -------- + +// ***************************************************************************** +// REGISTER ADDRESS DEFINITION FOR AT91SAM7X256 +// ***************************************************************************** +// ========== Register definition for SYS peripheral ========== +// ========== Register definition for AIC peripheral ========== +#define AT91C_AIC_IVR ((AT91_REG *) 0xFFFFF100) // (AIC) IRQ Vector Register +#define AT91C_AIC_SMR ((AT91_REG *) 0xFFFFF000) // (AIC) Source Mode Register +#define AT91C_AIC_FVR ((AT91_REG *) 0xFFFFF104) // (AIC) FIQ Vector Register +#define AT91C_AIC_DCR ((AT91_REG *) 0xFFFFF138) // (AIC) Debug Control Register (Protect) +#define AT91C_AIC_EOICR ((AT91_REG *) 0xFFFFF130) // (AIC) End of Interrupt Command Register +#define AT91C_AIC_SVR ((AT91_REG *) 0xFFFFF080) // (AIC) Source Vector Register +#define AT91C_AIC_FFSR ((AT91_REG *) 0xFFFFF148) // (AIC) Fast Forcing Status Register +#define AT91C_AIC_ICCR ((AT91_REG *) 0xFFFFF128) // (AIC) Interrupt Clear Command Register +#define AT91C_AIC_ISR ((AT91_REG *) 0xFFFFF108) // (AIC) Interrupt Status Register +#define AT91C_AIC_IMR ((AT91_REG *) 0xFFFFF110) // (AIC) Interrupt Mask Register +#define AT91C_AIC_IPR ((AT91_REG *) 0xFFFFF10C) // (AIC) Interrupt Pending Register +#define AT91C_AIC_FFER ((AT91_REG *) 0xFFFFF140) // (AIC) Fast Forcing Enable Register +#define AT91C_AIC_IECR ((AT91_REG *) 0xFFFFF120) // (AIC) Interrupt Enable Command Register +#define AT91C_AIC_ISCR ((AT91_REG *) 0xFFFFF12C) // (AIC) Interrupt Set Command Register +#define AT91C_AIC_FFDR ((AT91_REG *) 0xFFFFF144) // (AIC) Fast Forcing Disable Register +#define AT91C_AIC_CISR ((AT91_REG *) 0xFFFFF114) // (AIC) Core Interrupt Status Register +#define AT91C_AIC_IDCR ((AT91_REG *) 0xFFFFF124) // (AIC) Interrupt Disable Command Register +#define AT91C_AIC_SPU ((AT91_REG *) 0xFFFFF134) // (AIC) Spurious Vector Register +// ========== Register definition for PDC_DBGU peripheral ========== +#define AT91C_DBGU_TCR ((AT91_REG *) 0xFFFFF30C) // (PDC_DBGU) Transmit Counter Register +#define AT91C_DBGU_RNPR ((AT91_REG *) 0xFFFFF310) // (PDC_DBGU) Receive Next Pointer Register +#define AT91C_DBGU_TNPR ((AT91_REG *) 0xFFFFF318) // (PDC_DBGU) Transmit Next Pointer Register +#define AT91C_DBGU_TPR ((AT91_REG *) 0xFFFFF308) // (PDC_DBGU) Transmit Pointer Register +#define AT91C_DBGU_RPR ((AT91_REG *) 0xFFFFF300) // (PDC_DBGU) Receive Pointer Register +#define AT91C_DBGU_RCR ((AT91_REG *) 0xFFFFF304) // (PDC_DBGU) Receive Counter Register +#define AT91C_DBGU_RNCR ((AT91_REG *) 0xFFFFF314) // (PDC_DBGU) Receive Next Counter Register +#define AT91C_DBGU_PTCR ((AT91_REG *) 0xFFFFF320) // (PDC_DBGU) PDC Transfer Control Register +#define AT91C_DBGU_PTSR ((AT91_REG *) 0xFFFFF324) // (PDC_DBGU) PDC Transfer Status Register +#define AT91C_DBGU_TNCR ((AT91_REG *) 0xFFFFF31C) // (PDC_DBGU) Transmit Next Counter Register +// ========== Register definition for DBGU peripheral ========== +#define AT91C_DBGU_EXID ((AT91_REG *) 0xFFFFF244) // (DBGU) Chip ID Extension Register +#define AT91C_DBGU_BRGR ((AT91_REG *) 0xFFFFF220) // (DBGU) Baud Rate Generator Register +#define AT91C_DBGU_IDR ((AT91_REG *) 0xFFFFF20C) // (DBGU) Interrupt Disable Register +#define AT91C_DBGU_CSR ((AT91_REG *) 0xFFFFF214) // (DBGU) Channel Status Register +#define AT91C_DBGU_CIDR ((AT91_REG *) 0xFFFFF240) // (DBGU) Chip ID Register +#define AT91C_DBGU_MR ((AT91_REG *) 0xFFFFF204) // (DBGU) Mode Register +#define AT91C_DBGU_IMR ((AT91_REG *) 0xFFFFF210) // (DBGU) Interrupt Mask Register +#define AT91C_DBGU_CR ((AT91_REG *) 0xFFFFF200) // (DBGU) Control Register +#define AT91C_DBGU_FNTR ((AT91_REG *) 0xFFFFF248) // (DBGU) Force NTRST Register +#define AT91C_DBGU_THR ((AT91_REG *) 0xFFFFF21C) // (DBGU) Transmitter Holding Register +#define AT91C_DBGU_RHR ((AT91_REG *) 0xFFFFF218) // (DBGU) Receiver Holding Register +#define AT91C_DBGU_IER ((AT91_REG *) 0xFFFFF208) // (DBGU) Interrupt Enable Register +// ========== Register definition for PIOA peripheral ========== +#define AT91C_PIOA_ODR ((AT91_REG *) 0xFFFFF414) // (PIOA) Output Disable Registerr +#define AT91C_PIOA_SODR ((AT91_REG *) 0xFFFFF430) // (PIOA) Set Output Data Register +#define AT91C_PIOA_ISR ((AT91_REG *) 0xFFFFF44C) // (PIOA) Interrupt Status Register +#define AT91C_PIOA_ABSR ((AT91_REG *) 0xFFFFF478) // (PIOA) AB Select Status Register +#define AT91C_PIOA_IER ((AT91_REG *) 0xFFFFF440) // (PIOA) Interrupt Enable Register +#define AT91C_PIOA_PPUDR ((AT91_REG *) 0xFFFFF460) // (PIOA) Pull-up Disable Register +#define AT91C_PIOA_IMR ((AT91_REG *) 0xFFFFF448) // (PIOA) Interrupt Mask Register +#define AT91C_PIOA_PER ((AT91_REG *) 0xFFFFF400) // (PIOA) PIO Enable Register +#define AT91C_PIOA_IFDR ((AT91_REG *) 0xFFFFF424) // (PIOA) Input Filter Disable Register +#define AT91C_PIOA_OWDR ((AT91_REG *) 0xFFFFF4A4) // (PIOA) Output Write Disable Register +#define AT91C_PIOA_MDSR ((AT91_REG *) 0xFFFFF458) // (PIOA) Multi-driver Status Register +#define AT91C_PIOA_IDR ((AT91_REG *) 0xFFFFF444) // (PIOA) Interrupt Disable Register +#define AT91C_PIOA_ODSR ((AT91_REG *) 0xFFFFF438) // (PIOA) Output Data Status Register +#define AT91C_PIOA_PPUSR ((AT91_REG *) 0xFFFFF468) // (PIOA) Pull-up Status Register +#define AT91C_PIOA_OWSR ((AT91_REG *) 0xFFFFF4A8) // (PIOA) Output Write Status Register +#define AT91C_PIOA_BSR ((AT91_REG *) 0xFFFFF474) // (PIOA) Select B Register +#define AT91C_PIOA_OWER ((AT91_REG *) 0xFFFFF4A0) // (PIOA) Output Write Enable Register +#define AT91C_PIOA_IFER ((AT91_REG *) 0xFFFFF420) // (PIOA) Input Filter Enable Register +#define AT91C_PIOA_PDSR ((AT91_REG *) 0xFFFFF43C) // (PIOA) Pin Data Status Register +#define AT91C_PIOA_PPUER ((AT91_REG *) 0xFFFFF464) // (PIOA) Pull-up Enable Register +#define AT91C_PIOA_OSR ((AT91_REG *) 0xFFFFF418) // (PIOA) Output Status Register +#define AT91C_PIOA_ASR ((AT91_REG *) 0xFFFFF470) // (PIOA) Select A Register +#define AT91C_PIOA_MDDR ((AT91_REG *) 0xFFFFF454) // (PIOA) Multi-driver Disable Register +#define AT91C_PIOA_CODR ((AT91_REG *) 0xFFFFF434) // (PIOA) Clear Output Data Register +#define AT91C_PIOA_MDER ((AT91_REG *) 0xFFFFF450) // (PIOA) Multi-driver Enable Register +#define AT91C_PIOA_PDR ((AT91_REG *) 0xFFFFF404) // (PIOA) PIO Disable Register +#define AT91C_PIOA_IFSR ((AT91_REG *) 0xFFFFF428) // (PIOA) Input Filter Status Register +#define AT91C_PIOA_OER ((AT91_REG *) 0xFFFFF410) // (PIOA) Output Enable Register +#define AT91C_PIOA_PSR ((AT91_REG *) 0xFFFFF408) // (PIOA) PIO Status Register +// ========== Register definition for PIOB peripheral ========== +#define AT91C_PIOB_OWDR ((AT91_REG *) 0xFFFFF6A4) // (PIOB) Output Write Disable Register +#define AT91C_PIOB_MDER ((AT91_REG *) 0xFFFFF650) // (PIOB) Multi-driver Enable Register +#define AT91C_PIOB_PPUSR ((AT91_REG *) 0xFFFFF668) // (PIOB) Pull-up Status Register +#define AT91C_PIOB_IMR ((AT91_REG *) 0xFFFFF648) // (PIOB) Interrupt Mask Register +#define AT91C_PIOB_ASR ((AT91_REG *) 0xFFFFF670) // (PIOB) Select A Register +#define AT91C_PIOB_PPUDR ((AT91_REG *) 0xFFFFF660) // (PIOB) Pull-up Disable Register +#define AT91C_PIOB_PSR ((AT91_REG *) 0xFFFFF608) // (PIOB) PIO Status Register +#define AT91C_PIOB_IER ((AT91_REG *) 0xFFFFF640) // (PIOB) Interrupt Enable Register +#define AT91C_PIOB_CODR ((AT91_REG *) 0xFFFFF634) // (PIOB) Clear Output Data Register +#define AT91C_PIOB_OWER ((AT91_REG *) 0xFFFFF6A0) // (PIOB) Output Write Enable Register +#define AT91C_PIOB_ABSR ((AT91_REG *) 0xFFFFF678) // (PIOB) AB Select Status Register +#define AT91C_PIOB_IFDR ((AT91_REG *) 0xFFFFF624) // (PIOB) Input Filter Disable Register +#define AT91C_PIOB_PDSR ((AT91_REG *) 0xFFFFF63C) // (PIOB) Pin Data Status Register +#define AT91C_PIOB_IDR ((AT91_REG *) 0xFFFFF644) // (PIOB) Interrupt Disable Register +#define AT91C_PIOB_OWSR ((AT91_REG *) 0xFFFFF6A8) // (PIOB) Output Write Status Register +#define AT91C_PIOB_PDR ((AT91_REG *) 0xFFFFF604) // (PIOB) PIO Disable Register +#define AT91C_PIOB_ODR ((AT91_REG *) 0xFFFFF614) // (PIOB) Output Disable Registerr +#define AT91C_PIOB_IFSR ((AT91_REG *) 0xFFFFF628) // (PIOB) Input Filter Status Register +#define AT91C_PIOB_PPUER ((AT91_REG *) 0xFFFFF664) // (PIOB) Pull-up Enable Register +#define AT91C_PIOB_SODR ((AT91_REG *) 0xFFFFF630) // (PIOB) Set Output Data Register +#define AT91C_PIOB_ISR ((AT91_REG *) 0xFFFFF64C) // (PIOB) Interrupt Status Register +#define AT91C_PIOB_ODSR ((AT91_REG *) 0xFFFFF638) // (PIOB) Output Data Status Register +#define AT91C_PIOB_OSR ((AT91_REG *) 0xFFFFF618) // (PIOB) Output Status Register +#define AT91C_PIOB_MDSR ((AT91_REG *) 0xFFFFF658) // (PIOB) Multi-driver Status Register +#define AT91C_PIOB_IFER ((AT91_REG *) 0xFFFFF620) // (PIOB) Input Filter Enable Register +#define AT91C_PIOB_BSR ((AT91_REG *) 0xFFFFF674) // (PIOB) Select B Register +#define AT91C_PIOB_MDDR ((AT91_REG *) 0xFFFFF654) // (PIOB) Multi-driver Disable Register +#define AT91C_PIOB_OER ((AT91_REG *) 0xFFFFF610) // (PIOB) Output Enable Register +#define AT91C_PIOB_PER ((AT91_REG *) 0xFFFFF600) // (PIOB) PIO Enable Register +// ========== Register definition for CKGR peripheral ========== +#define AT91C_CKGR_MOR ((AT91_REG *) 0xFFFFFC20) // (CKGR) Main Oscillator Register +#define AT91C_CKGR_PLLR ((AT91_REG *) 0xFFFFFC2C) // (CKGR) PLL Register +#define AT91C_CKGR_MCFR ((AT91_REG *) 0xFFFFFC24) // (CKGR) Main Clock Frequency Register +// ========== Register definition for PMC peripheral ========== +#define AT91C_PMC_IDR ((AT91_REG *) 0xFFFFFC64) // (PMC) Interrupt Disable Register +#define AT91C_PMC_MOR ((AT91_REG *) 0xFFFFFC20) // (PMC) Main Oscillator Register +#define AT91C_PMC_PLLR ((AT91_REG *) 0xFFFFFC2C) // (PMC) PLL Register +#define AT91C_PMC_PCER ((AT91_REG *) 0xFFFFFC10) // (PMC) Peripheral Clock Enable Register +#define AT91C_PMC_PCKR ((AT91_REG *) 0xFFFFFC40) // (PMC) Programmable Clock Register +#define AT91C_PMC_MCKR ((AT91_REG *) 0xFFFFFC30) // (PMC) Master Clock Register +#define AT91C_PMC_SCDR ((AT91_REG *) 0xFFFFFC04) // (PMC) System Clock Disable Register +#define AT91C_PMC_PCDR ((AT91_REG *) 0xFFFFFC14) // (PMC) Peripheral Clock Disable Register +#define AT91C_PMC_SCSR ((AT91_REG *) 0xFFFFFC08) // (PMC) System Clock Status Register +#define AT91C_PMC_PCSR ((AT91_REG *) 0xFFFFFC18) // (PMC) Peripheral Clock Status Register +#define AT91C_PMC_MCFR ((AT91_REG *) 0xFFFFFC24) // (PMC) Main Clock Frequency Register +#define AT91C_PMC_SCER ((AT91_REG *) 0xFFFFFC00) // (PMC) System Clock Enable Register +#define AT91C_PMC_IMR ((AT91_REG *) 0xFFFFFC6C) // (PMC) Interrupt Mask Register +#define AT91C_PMC_IER ((AT91_REG *) 0xFFFFFC60) // (PMC) Interrupt Enable Register +#define AT91C_PMC_SR ((AT91_REG *) 0xFFFFFC68) // (PMC) Status Register +// ========== Register definition for RSTC peripheral ========== +#define AT91C_RSTC_RCR ((AT91_REG *) 0xFFFFFD00) // (RSTC) Reset Control Register +#define AT91C_RSTC_RMR ((AT91_REG *) 0xFFFFFD08) // (RSTC) Reset Mode Register +#define AT91C_RSTC_RSR ((AT91_REG *) 0xFFFFFD04) // (RSTC) Reset Status Register +// ========== Register definition for RTTC peripheral ========== +#define AT91C_RTTC_RTSR ((AT91_REG *) 0xFFFFFD2C) // (RTTC) Real-time Status Register +#define AT91C_RTTC_RTMR ((AT91_REG *) 0xFFFFFD20) // (RTTC) Real-time Mode Register +#define AT91C_RTTC_RTVR ((AT91_REG *) 0xFFFFFD28) // (RTTC) Real-time Value Register +#define AT91C_RTTC_RTAR ((AT91_REG *) 0xFFFFFD24) // (RTTC) Real-time Alarm Register +// ========== Register definition for PITC peripheral ========== +#define AT91C_PITC_PIVR ((AT91_REG *) 0xFFFFFD38) // (PITC) Period Interval Value Register +#define AT91C_PITC_PISR ((AT91_REG *) 0xFFFFFD34) // (PITC) Period Interval Status Register +#define AT91C_PITC_PIIR ((AT91_REG *) 0xFFFFFD3C) // (PITC) Period Interval Image Register +#define AT91C_PITC_PIMR ((AT91_REG *) 0xFFFFFD30) // (PITC) Period Interval Mode Register +// ========== Register definition for WDTC peripheral ========== +#define AT91C_WDTC_WDCR ((AT91_REG *) 0xFFFFFD40) // (WDTC) Watchdog Control Register +#define AT91C_WDTC_WDSR ((AT91_REG *) 0xFFFFFD48) // (WDTC) Watchdog Status Register +#define AT91C_WDTC_WDMR ((AT91_REG *) 0xFFFFFD44) // (WDTC) Watchdog Mode Register +// ========== Register definition for VREG peripheral ========== +#define AT91C_VREG_MR ((AT91_REG *) 0xFFFFFD60) // (VREG) Voltage Regulator Mode Register +// ========== Register definition for MC peripheral ========== +#define AT91C_MC_ASR ((AT91_REG *) 0xFFFFFF04) // (MC) MC Abort Status Register +#define AT91C_MC_RCR ((AT91_REG *) 0xFFFFFF00) // (MC) MC Remap Control Register +#define AT91C_MC_FCR ((AT91_REG *) 0xFFFFFF64) // (MC) MC Flash Command Register +#define AT91C_MC_AASR ((AT91_REG *) 0xFFFFFF08) // (MC) MC Abort Address Status Register +#define AT91C_MC_FSR ((AT91_REG *) 0xFFFFFF68) // (MC) MC Flash Status Register +#define AT91C_MC_FMR ((AT91_REG *) 0xFFFFFF60) // (MC) MC Flash Mode Register +// ========== Register definition for PDC_SPI1 peripheral ========== +#define AT91C_SPI1_PTCR ((AT91_REG *) 0xFFFE4120) // (PDC_SPI1) PDC Transfer Control Register +#define AT91C_SPI1_RPR ((AT91_REG *) 0xFFFE4100) // (PDC_SPI1) Receive Pointer Register +#define AT91C_SPI1_TNCR ((AT91_REG *) 0xFFFE411C) // (PDC_SPI1) Transmit Next Counter Register +#define AT91C_SPI1_TPR ((AT91_REG *) 0xFFFE4108) // (PDC_SPI1) Transmit Pointer Register +#define AT91C_SPI1_TNPR ((AT91_REG *) 0xFFFE4118) // (PDC_SPI1) Transmit Next Pointer Register +#define AT91C_SPI1_TCR ((AT91_REG *) 0xFFFE410C) // (PDC_SPI1) Transmit Counter Register +#define AT91C_SPI1_RCR ((AT91_REG *) 0xFFFE4104) // (PDC_SPI1) Receive Counter Register +#define AT91C_SPI1_RNPR ((AT91_REG *) 0xFFFE4110) // (PDC_SPI1) Receive Next Pointer Register +#define AT91C_SPI1_RNCR ((AT91_REG *) 0xFFFE4114) // (PDC_SPI1) Receive Next Counter Register +#define AT91C_SPI1_PTSR ((AT91_REG *) 0xFFFE4124) // (PDC_SPI1) PDC Transfer Status Register +// ========== Register definition for SPI1 peripheral ========== +#define AT91C_SPI1_IMR ((AT91_REG *) 0xFFFE401C) // (SPI1) Interrupt Mask Register +#define AT91C_SPI1_IER ((AT91_REG *) 0xFFFE4014) // (SPI1) Interrupt Enable Register +#define AT91C_SPI1_MR ((AT91_REG *) 0xFFFE4004) // (SPI1) Mode Register +#define AT91C_SPI1_RDR ((AT91_REG *) 0xFFFE4008) // (SPI1) Receive Data Register +#define AT91C_SPI1_IDR ((AT91_REG *) 0xFFFE4018) // (SPI1) Interrupt Disable Register +#define AT91C_SPI1_SR ((AT91_REG *) 0xFFFE4010) // (SPI1) Status Register +#define AT91C_SPI1_TDR ((AT91_REG *) 0xFFFE400C) // (SPI1) Transmit Data Register +#define AT91C_SPI1_CR ((AT91_REG *) 0xFFFE4000) // (SPI1) Control Register +#define AT91C_SPI1_CSR ((AT91_REG *) 0xFFFE4030) // (SPI1) Chip Select Register +// ========== Register definition for PDC_SPI0 peripheral ========== +#define AT91C_SPI0_PTCR ((AT91_REG *) 0xFFFE0120) // (PDC_SPI0) PDC Transfer Control Register +#define AT91C_SPI0_TPR ((AT91_REG *) 0xFFFE0108) // (PDC_SPI0) Transmit Pointer Register +#define AT91C_SPI0_TCR ((AT91_REG *) 0xFFFE010C) // (PDC_SPI0) Transmit Counter Register +#define AT91C_SPI0_RCR ((AT91_REG *) 0xFFFE0104) // (PDC_SPI0) Receive Counter Register +#define AT91C_SPI0_PTSR ((AT91_REG *) 0xFFFE0124) // (PDC_SPI0) PDC Transfer Status Register +#define AT91C_SPI0_RNPR ((AT91_REG *) 0xFFFE0110) // (PDC_SPI0) Receive Next Pointer Register +#define AT91C_SPI0_RPR ((AT91_REG *) 0xFFFE0100) // (PDC_SPI0) Receive Pointer Register +#define AT91C_SPI0_TNCR ((AT91_REG *) 0xFFFE011C) // (PDC_SPI0) Transmit Next Counter Register +#define AT91C_SPI0_RNCR ((AT91_REG *) 0xFFFE0114) // (PDC_SPI0) Receive Next Counter Register +#define AT91C_SPI0_TNPR ((AT91_REG *) 0xFFFE0118) // (PDC_SPI0) Transmit Next Pointer Register +// ========== Register definition for SPI0 peripheral ========== +#define AT91C_SPI0_IER ((AT91_REG *) 0xFFFE0014) // (SPI0) Interrupt Enable Register +#define AT91C_SPI0_SR ((AT91_REG *) 0xFFFE0010) // (SPI0) Status Register +#define AT91C_SPI0_IDR ((AT91_REG *) 0xFFFE0018) // (SPI0) Interrupt Disable Register +#define AT91C_SPI0_CR ((AT91_REG *) 0xFFFE0000) // (SPI0) Control Register +#define AT91C_SPI0_MR ((AT91_REG *) 0xFFFE0004) // (SPI0) Mode Register +#define AT91C_SPI0_IMR ((AT91_REG *) 0xFFFE001C) // (SPI0) Interrupt Mask Register +#define AT91C_SPI0_TDR ((AT91_REG *) 0xFFFE000C) // (SPI0) Transmit Data Register +#define AT91C_SPI0_RDR ((AT91_REG *) 0xFFFE0008) // (SPI0) Receive Data Register +#define AT91C_SPI0_CSR ((AT91_REG *) 0xFFFE0030) // (SPI0) Chip Select Register +// ========== Register definition for PDC_US1 peripheral ========== +#define AT91C_US1_RNCR ((AT91_REG *) 0xFFFC4114) // (PDC_US1) Receive Next Counter Register +#define AT91C_US1_PTCR ((AT91_REG *) 0xFFFC4120) // (PDC_US1) PDC Transfer Control Register +#define AT91C_US1_TCR ((AT91_REG *) 0xFFFC410C) // (PDC_US1) Transmit Counter Register +#define AT91C_US1_PTSR ((AT91_REG *) 0xFFFC4124) // (PDC_US1) PDC Transfer Status Register +#define AT91C_US1_TNPR ((AT91_REG *) 0xFFFC4118) // (PDC_US1) Transmit Next Pointer Register +#define AT91C_US1_RCR ((AT91_REG *) 0xFFFC4104) // (PDC_US1) Receive Counter Register +#define AT91C_US1_RNPR ((AT91_REG *) 0xFFFC4110) // (PDC_US1) Receive Next Pointer Register +#define AT91C_US1_RPR ((AT91_REG *) 0xFFFC4100) // (PDC_US1) Receive Pointer Register +#define AT91C_US1_TNCR ((AT91_REG *) 0xFFFC411C) // (PDC_US1) Transmit Next Counter Register +#define AT91C_US1_TPR ((AT91_REG *) 0xFFFC4108) // (PDC_US1) Transmit Pointer Register +// ========== Register definition for US1 peripheral ========== +#define AT91C_US1_IF ((AT91_REG *) 0xFFFC404C) // (US1) IRDA_FILTER Register +#define AT91C_US1_NER ((AT91_REG *) 0xFFFC4044) // (US1) Nb Errors Register +#define AT91C_US1_RTOR ((AT91_REG *) 0xFFFC4024) // (US1) Receiver Time-out Register +#define AT91C_US1_CSR ((AT91_REG *) 0xFFFC4014) // (US1) Channel Status Register +#define AT91C_US1_IDR ((AT91_REG *) 0xFFFC400C) // (US1) Interrupt Disable Register +#define AT91C_US1_IER ((AT91_REG *) 0xFFFC4008) // (US1) Interrupt Enable Register +#define AT91C_US1_THR ((AT91_REG *) 0xFFFC401C) // (US1) Transmitter Holding Register +#define AT91C_US1_TTGR ((AT91_REG *) 0xFFFC4028) // (US1) Transmitter Time-guard Register +#define AT91C_US1_RHR ((AT91_REG *) 0xFFFC4018) // (US1) Receiver Holding Register +#define AT91C_US1_BRGR ((AT91_REG *) 0xFFFC4020) // (US1) Baud Rate Generator Register +#define AT91C_US1_IMR ((AT91_REG *) 0xFFFC4010) // (US1) Interrupt Mask Register +#define AT91C_US1_FIDI ((AT91_REG *) 0xFFFC4040) // (US1) FI_DI_Ratio Register +#define AT91C_US1_CR ((AT91_REG *) 0xFFFC4000) // (US1) Control Register +#define AT91C_US1_MR ((AT91_REG *) 0xFFFC4004) // (US1) Mode Register +// ========== Register definition for PDC_US0 peripheral ========== +#define AT91C_US0_TNPR ((AT91_REG *) 0xFFFC0118) // (PDC_US0) Transmit Next Pointer Register +#define AT91C_US0_RNPR ((AT91_REG *) 0xFFFC0110) // (PDC_US0) Receive Next Pointer Register +#define AT91C_US0_TCR ((AT91_REG *) 0xFFFC010C) // (PDC_US0) Transmit Counter Register +#define AT91C_US0_PTCR ((AT91_REG *) 0xFFFC0120) // (PDC_US0) PDC Transfer Control Register +#define AT91C_US0_PTSR ((AT91_REG *) 0xFFFC0124) // (PDC_US0) PDC Transfer Status Register +#define AT91C_US0_TNCR ((AT91_REG *) 0xFFFC011C) // (PDC_US0) Transmit Next Counter Register +#define AT91C_US0_TPR ((AT91_REG *) 0xFFFC0108) // (PDC_US0) Transmit Pointer Register +#define AT91C_US0_RCR ((AT91_REG *) 0xFFFC0104) // (PDC_US0) Receive Counter Register +#define AT91C_US0_RPR ((AT91_REG *) 0xFFFC0100) // (PDC_US0) Receive Pointer Register +#define AT91C_US0_RNCR ((AT91_REG *) 0xFFFC0114) // (PDC_US0) Receive Next Counter Register +// ========== Register definition for US0 peripheral ========== +#define AT91C_US0_BRGR ((AT91_REG *) 0xFFFC0020) // (US0) Baud Rate Generator Register +#define AT91C_US0_NER ((AT91_REG *) 0xFFFC0044) // (US0) Nb Errors Register +#define AT91C_US0_CR ((AT91_REG *) 0xFFFC0000) // (US0) Control Register +#define AT91C_US0_IMR ((AT91_REG *) 0xFFFC0010) // (US0) Interrupt Mask Register +#define AT91C_US0_FIDI ((AT91_REG *) 0xFFFC0040) // (US0) FI_DI_Ratio Register +#define AT91C_US0_TTGR ((AT91_REG *) 0xFFFC0028) // (US0) Transmitter Time-guard Register +#define AT91C_US0_MR ((AT91_REG *) 0xFFFC0004) // (US0) Mode Register +#define AT91C_US0_RTOR ((AT91_REG *) 0xFFFC0024) // (US0) Receiver Time-out Register +#define AT91C_US0_CSR ((AT91_REG *) 0xFFFC0014) // (US0) Channel Status Register +#define AT91C_US0_RHR ((AT91_REG *) 0xFFFC0018) // (US0) Receiver Holding Register +#define AT91C_US0_IDR ((AT91_REG *) 0xFFFC000C) // (US0) Interrupt Disable Register +#define AT91C_US0_THR ((AT91_REG *) 0xFFFC001C) // (US0) Transmitter Holding Register +#define AT91C_US0_IF ((AT91_REG *) 0xFFFC004C) // (US0) IRDA_FILTER Register +#define AT91C_US0_IER ((AT91_REG *) 0xFFFC0008) // (US0) Interrupt Enable Register +// ========== Register definition for PDC_SSC peripheral ========== +#define AT91C_SSC_TNCR ((AT91_REG *) 0xFFFD411C) // (PDC_SSC) Transmit Next Counter Register +#define AT91C_SSC_RPR ((AT91_REG *) 0xFFFD4100) // (PDC_SSC) Receive Pointer Register +#define AT91C_SSC_RNCR ((AT91_REG *) 0xFFFD4114) // (PDC_SSC) Receive Next Counter Register +#define AT91C_SSC_TPR ((AT91_REG *) 0xFFFD4108) // (PDC_SSC) Transmit Pointer Register +#define AT91C_SSC_PTCR ((AT91_REG *) 0xFFFD4120) // (PDC_SSC) PDC Transfer Control Register +#define AT91C_SSC_TCR ((AT91_REG *) 0xFFFD410C) // (PDC_SSC) Transmit Counter Register +#define AT91C_SSC_RCR ((AT91_REG *) 0xFFFD4104) // (PDC_SSC) Receive Counter Register +#define AT91C_SSC_RNPR ((AT91_REG *) 0xFFFD4110) // (PDC_SSC) Receive Next Pointer Register +#define AT91C_SSC_TNPR ((AT91_REG *) 0xFFFD4118) // (PDC_SSC) Transmit Next Pointer Register +#define AT91C_SSC_PTSR ((AT91_REG *) 0xFFFD4124) // (PDC_SSC) PDC Transfer Status Register +// ========== Register definition for SSC peripheral ========== +#define AT91C_SSC_RHR ((AT91_REG *) 0xFFFD4020) // (SSC) Receive Holding Register +#define AT91C_SSC_RSHR ((AT91_REG *) 0xFFFD4030) // (SSC) Receive Sync Holding Register +#define AT91C_SSC_TFMR ((AT91_REG *) 0xFFFD401C) // (SSC) Transmit Frame Mode Register +#define AT91C_SSC_IDR ((AT91_REG *) 0xFFFD4048) // (SSC) Interrupt Disable Register +#define AT91C_SSC_THR ((AT91_REG *) 0xFFFD4024) // (SSC) Transmit Holding Register +#define AT91C_SSC_RCMR ((AT91_REG *) 0xFFFD4010) // (SSC) Receive Clock ModeRegister +#define AT91C_SSC_IER ((AT91_REG *) 0xFFFD4044) // (SSC) Interrupt Enable Register +#define AT91C_SSC_TSHR ((AT91_REG *) 0xFFFD4034) // (SSC) Transmit Sync Holding Register +#define AT91C_SSC_SR ((AT91_REG *) 0xFFFD4040) // (SSC) Status Register +#define AT91C_SSC_CMR ((AT91_REG *) 0xFFFD4004) // (SSC) Clock Mode Register +#define AT91C_SSC_TCMR ((AT91_REG *) 0xFFFD4018) // (SSC) Transmit Clock Mode Register +#define AT91C_SSC_CR ((AT91_REG *) 0xFFFD4000) // (SSC) Control Register +#define AT91C_SSC_IMR ((AT91_REG *) 0xFFFD404C) // (SSC) Interrupt Mask Register +#define AT91C_SSC_RFMR ((AT91_REG *) 0xFFFD4014) // (SSC) Receive Frame Mode Register +// ========== Register definition for TWI peripheral ========== +#define AT91C_TWI_IER ((AT91_REG *) 0xFFFB8024) // (TWI) Interrupt Enable Register +#define AT91C_TWI_CR ((AT91_REG *) 0xFFFB8000) // (TWI) Control Register +#define AT91C_TWI_SR ((AT91_REG *) 0xFFFB8020) // (TWI) Status Register +#define AT91C_TWI_IMR ((AT91_REG *) 0xFFFB802C) // (TWI) Interrupt Mask Register +#define AT91C_TWI_THR ((AT91_REG *) 0xFFFB8034) // (TWI) Transmit Holding Register +#define AT91C_TWI_IDR ((AT91_REG *) 0xFFFB8028) // (TWI) Interrupt Disable Register +#define AT91C_TWI_IADR ((AT91_REG *) 0xFFFB800C) // (TWI) Internal Address Register +#define AT91C_TWI_MMR ((AT91_REG *) 0xFFFB8004) // (TWI) Master Mode Register +#define AT91C_TWI_CWGR ((AT91_REG *) 0xFFFB8010) // (TWI) Clock Waveform Generator Register +#define AT91C_TWI_RHR ((AT91_REG *) 0xFFFB8030) // (TWI) Receive Holding Register +// ========== Register definition for PWMC_CH3 peripheral ========== +#define AT91C_PWMC_CH3_CUPDR ((AT91_REG *) 0xFFFCC270) // (PWMC_CH3) Channel Update Register +#define AT91C_PWMC_CH3_Reserved ((AT91_REG *) 0xFFFCC274) // (PWMC_CH3) Reserved +#define AT91C_PWMC_CH3_CPRDR ((AT91_REG *) 0xFFFCC268) // (PWMC_CH3) Channel Period Register +#define AT91C_PWMC_CH3_CDTYR ((AT91_REG *) 0xFFFCC264) // (PWMC_CH3) Channel Duty Cycle Register +#define AT91C_PWMC_CH3_CCNTR ((AT91_REG *) 0xFFFCC26C) // (PWMC_CH3) Channel Counter Register +#define AT91C_PWMC_CH3_CMR ((AT91_REG *) 0xFFFCC260) // (PWMC_CH3) Channel Mode Register +// ========== Register definition for PWMC_CH2 peripheral ========== +#define AT91C_PWMC_CH2_Reserved ((AT91_REG *) 0xFFFCC254) // (PWMC_CH2) Reserved +#define AT91C_PWMC_CH2_CMR ((AT91_REG *) 0xFFFCC240) // (PWMC_CH2) Channel Mode Register +#define AT91C_PWMC_CH2_CCNTR ((AT91_REG *) 0xFFFCC24C) // (PWMC_CH2) Channel Counter Register +#define AT91C_PWMC_CH2_CPRDR ((AT91_REG *) 0xFFFCC248) // (PWMC_CH2) Channel Period Register +#define AT91C_PWMC_CH2_CUPDR ((AT91_REG *) 0xFFFCC250) // (PWMC_CH2) Channel Update Register +#define AT91C_PWMC_CH2_CDTYR ((AT91_REG *) 0xFFFCC244) // (PWMC_CH2) Channel Duty Cycle Register +// ========== Register definition for PWMC_CH1 peripheral ========== +#define AT91C_PWMC_CH1_Reserved ((AT91_REG *) 0xFFFCC234) // (PWMC_CH1) Reserved +#define AT91C_PWMC_CH1_CUPDR ((AT91_REG *) 0xFFFCC230) // (PWMC_CH1) Channel Update Register +#define AT91C_PWMC_CH1_CPRDR ((AT91_REG *) 0xFFFCC228) // (PWMC_CH1) Channel Period Register +#define AT91C_PWMC_CH1_CCNTR ((AT91_REG *) 0xFFFCC22C) // (PWMC_CH1) Channel Counter Register +#define AT91C_PWMC_CH1_CDTYR ((AT91_REG *) 0xFFFCC224) // (PWMC_CH1) Channel Duty Cycle Register +#define AT91C_PWMC_CH1_CMR ((AT91_REG *) 0xFFFCC220) // (PWMC_CH1) Channel Mode Register +// ========== Register definition for PWMC_CH0 peripheral ========== +#define AT91C_PWMC_CH0_Reserved ((AT91_REG *) 0xFFFCC214) // (PWMC_CH0) Reserved +#define AT91C_PWMC_CH0_CPRDR ((AT91_REG *) 0xFFFCC208) // (PWMC_CH0) Channel Period Register +#define AT91C_PWMC_CH0_CDTYR ((AT91_REG *) 0xFFFCC204) // (PWMC_CH0) Channel Duty Cycle Register +#define AT91C_PWMC_CH0_CMR ((AT91_REG *) 0xFFFCC200) // (PWMC_CH0) Channel Mode Register +#define AT91C_PWMC_CH0_CUPDR ((AT91_REG *) 0xFFFCC210) // (PWMC_CH0) Channel Update Register +#define AT91C_PWMC_CH0_CCNTR ((AT91_REG *) 0xFFFCC20C) // (PWMC_CH0) Channel Counter Register +// ========== Register definition for PWMC peripheral ========== +#define AT91C_PWMC_IDR ((AT91_REG *) 0xFFFCC014) // (PWMC) PWMC Interrupt Disable Register +#define AT91C_PWMC_DIS ((AT91_REG *) 0xFFFCC008) // (PWMC) PWMC Disable Register +#define AT91C_PWMC_IER ((AT91_REG *) 0xFFFCC010) // (PWMC) PWMC Interrupt Enable Register +#define AT91C_PWMC_VR ((AT91_REG *) 0xFFFCC0FC) // (PWMC) PWMC Version Register +#define AT91C_PWMC_ISR ((AT91_REG *) 0xFFFCC01C) // (PWMC) PWMC Interrupt Status Register +#define AT91C_PWMC_SR ((AT91_REG *) 0xFFFCC00C) // (PWMC) PWMC Status Register +#define AT91C_PWMC_IMR ((AT91_REG *) 0xFFFCC018) // (PWMC) PWMC Interrupt Mask Register +#define AT91C_PWMC_MR ((AT91_REG *) 0xFFFCC000) // (PWMC) PWMC Mode Register +#define AT91C_PWMC_ENA ((AT91_REG *) 0xFFFCC004) // (PWMC) PWMC Enable Register +// ========== Register definition for UDP peripheral ========== +#define AT91C_UDP_IMR ((AT91_REG *) 0xFFFB0018) // (UDP) Interrupt Mask Register +#define AT91C_UDP_FADDR ((AT91_REG *) 0xFFFB0008) // (UDP) Function Address Register +#define AT91C_UDP_NUM ((AT91_REG *) 0xFFFB0000) // (UDP) Frame Number Register +#define AT91C_UDP_FDR ((AT91_REG *) 0xFFFB0050) // (UDP) Endpoint FIFO Data Register +#define AT91C_UDP_ISR ((AT91_REG *) 0xFFFB001C) // (UDP) Interrupt Status Register +#define AT91C_UDP_CSR ((AT91_REG *) 0xFFFB0030) // (UDP) Endpoint Control and Status Register +#define AT91C_UDP_IDR ((AT91_REG *) 0xFFFB0014) // (UDP) Interrupt Disable Register +#define AT91C_UDP_ICR ((AT91_REG *) 0xFFFB0020) // (UDP) Interrupt Clear Register +#define AT91C_UDP_RSTEP ((AT91_REG *) 0xFFFB0028) // (UDP) Reset Endpoint Register +#define AT91C_UDP_TXVC ((AT91_REG *) 0xFFFB0074) // (UDP) Transceiver Control Register +#define AT91C_UDP_GLBSTATE ((AT91_REG *) 0xFFFB0004) // (UDP) Global State Register +#define AT91C_UDP_IER ((AT91_REG *) 0xFFFB0010) // (UDP) Interrupt Enable Register +// ========== Register definition for TC0 peripheral ========== +#define AT91C_TC0_SR ((AT91_REG *) 0xFFFA0020) // (TC0) Status Register +#define AT91C_TC0_RC ((AT91_REG *) 0xFFFA001C) // (TC0) Register C +#define AT91C_TC0_RB ((AT91_REG *) 0xFFFA0018) // (TC0) Register B +#define AT91C_TC0_CCR ((AT91_REG *) 0xFFFA0000) // (TC0) Channel Control Register +#define AT91C_TC0_CMR ((AT91_REG *) 0xFFFA0004) // (TC0) Channel Mode Register (Capture Mode / Waveform Mode) +#define AT91C_TC0_IER ((AT91_REG *) 0xFFFA0024) // (TC0) Interrupt Enable Register +#define AT91C_TC0_RA ((AT91_REG *) 0xFFFA0014) // (TC0) Register A +#define AT91C_TC0_IDR ((AT91_REG *) 0xFFFA0028) // (TC0) Interrupt Disable Register +#define AT91C_TC0_CV ((AT91_REG *) 0xFFFA0010) // (TC0) Counter Value +#define AT91C_TC0_IMR ((AT91_REG *) 0xFFFA002C) // (TC0) Interrupt Mask Register +// ========== Register definition for TC1 peripheral ========== +#define AT91C_TC1_RB ((AT91_REG *) 0xFFFA0058) // (TC1) Register B +#define AT91C_TC1_CCR ((AT91_REG *) 0xFFFA0040) // (TC1) Channel Control Register +#define AT91C_TC1_IER ((AT91_REG *) 0xFFFA0064) // (TC1) Interrupt Enable Register +#define AT91C_TC1_IDR ((AT91_REG *) 0xFFFA0068) // (TC1) Interrupt Disable Register +#define AT91C_TC1_SR ((AT91_REG *) 0xFFFA0060) // (TC1) Status Register +#define AT91C_TC1_CMR ((AT91_REG *) 0xFFFA0044) // (TC1) Channel Mode Register (Capture Mode / Waveform Mode) +#define AT91C_TC1_RA ((AT91_REG *) 0xFFFA0054) // (TC1) Register A +#define AT91C_TC1_RC ((AT91_REG *) 0xFFFA005C) // (TC1) Register C +#define AT91C_TC1_IMR ((AT91_REG *) 0xFFFA006C) // (TC1) Interrupt Mask Register +#define AT91C_TC1_CV ((AT91_REG *) 0xFFFA0050) // (TC1) Counter Value +// ========== Register definition for TC2 peripheral ========== +#define AT91C_TC2_CMR ((AT91_REG *) 0xFFFA0084) // (TC2) Channel Mode Register (Capture Mode / Waveform Mode) +#define AT91C_TC2_CCR ((AT91_REG *) 0xFFFA0080) // (TC2) Channel Control Register +#define AT91C_TC2_CV ((AT91_REG *) 0xFFFA0090) // (TC2) Counter Value +#define AT91C_TC2_RA ((AT91_REG *) 0xFFFA0094) // (TC2) Register A +#define AT91C_TC2_RB ((AT91_REG *) 0xFFFA0098) // (TC2) Register B +#define AT91C_TC2_IDR ((AT91_REG *) 0xFFFA00A8) // (TC2) Interrupt Disable Register +#define AT91C_TC2_IMR ((AT91_REG *) 0xFFFA00AC) // (TC2) Interrupt Mask Register +#define AT91C_TC2_RC ((AT91_REG *) 0xFFFA009C) // (TC2) Register C +#define AT91C_TC2_IER ((AT91_REG *) 0xFFFA00A4) // (TC2) Interrupt Enable Register +#define AT91C_TC2_SR ((AT91_REG *) 0xFFFA00A0) // (TC2) Status Register +// ========== Register definition for TCB peripheral ========== +#define AT91C_TCB_BMR ((AT91_REG *) 0xFFFA00C4) // (TCB) TC Block Mode Register +#define AT91C_TCB_BCR ((AT91_REG *) 0xFFFA00C0) // (TCB) TC Block Control Register +// ========== Register definition for CAN_MB0 peripheral ========== +#define AT91C_CAN_MB0_MDL ((AT91_REG *) 0xFFFD0214) // (CAN_MB0) MailBox Data Low Register +#define AT91C_CAN_MB0_MAM ((AT91_REG *) 0xFFFD0204) // (CAN_MB0) MailBox Acceptance Mask Register +#define AT91C_CAN_MB0_MCR ((AT91_REG *) 0xFFFD021C) // (CAN_MB0) MailBox Control Register +#define AT91C_CAN_MB0_MID ((AT91_REG *) 0xFFFD0208) // (CAN_MB0) MailBox ID Register +#define AT91C_CAN_MB0_MSR ((AT91_REG *) 0xFFFD0210) // (CAN_MB0) MailBox Status Register +#define AT91C_CAN_MB0_MFID ((AT91_REG *) 0xFFFD020C) // (CAN_MB0) MailBox Family ID Register +#define AT91C_CAN_MB0_MDH ((AT91_REG *) 0xFFFD0218) // (CAN_MB0) MailBox Data High Register +#define AT91C_CAN_MB0_MMR ((AT91_REG *) 0xFFFD0200) // (CAN_MB0) MailBox Mode Register +// ========== Register definition for CAN_MB1 peripheral ========== +#define AT91C_CAN_MB1_MDL ((AT91_REG *) 0xFFFD0234) // (CAN_MB1) MailBox Data Low Register +#define AT91C_CAN_MB1_MID ((AT91_REG *) 0xFFFD0228) // (CAN_MB1) MailBox ID Register +#define AT91C_CAN_MB1_MMR ((AT91_REG *) 0xFFFD0220) // (CAN_MB1) MailBox Mode Register +#define AT91C_CAN_MB1_MSR ((AT91_REG *) 0xFFFD0230) // (CAN_MB1) MailBox Status Register +#define AT91C_CAN_MB1_MAM ((AT91_REG *) 0xFFFD0224) // (CAN_MB1) MailBox Acceptance Mask Register +#define AT91C_CAN_MB1_MDH ((AT91_REG *) 0xFFFD0238) // (CAN_MB1) MailBox Data High Register +#define AT91C_CAN_MB1_MCR ((AT91_REG *) 0xFFFD023C) // (CAN_MB1) MailBox Control Register +#define AT91C_CAN_MB1_MFID ((AT91_REG *) 0xFFFD022C) // (CAN_MB1) MailBox Family ID Register +// ========== Register definition for CAN_MB2 peripheral ========== +#define AT91C_CAN_MB2_MCR ((AT91_REG *) 0xFFFD025C) // (CAN_MB2) MailBox Control Register +#define AT91C_CAN_MB2_MDH ((AT91_REG *) 0xFFFD0258) // (CAN_MB2) MailBox Data High Register +#define AT91C_CAN_MB2_MID ((AT91_REG *) 0xFFFD0248) // (CAN_MB2) MailBox ID Register +#define AT91C_CAN_MB2_MDL ((AT91_REG *) 0xFFFD0254) // (CAN_MB2) MailBox Data Low Register +#define AT91C_CAN_MB2_MMR ((AT91_REG *) 0xFFFD0240) // (CAN_MB2) MailBox Mode Register +#define AT91C_CAN_MB2_MAM ((AT91_REG *) 0xFFFD0244) // (CAN_MB2) MailBox Acceptance Mask Register +#define AT91C_CAN_MB2_MFID ((AT91_REG *) 0xFFFD024C) // (CAN_MB2) MailBox Family ID Register +#define AT91C_CAN_MB2_MSR ((AT91_REG *) 0xFFFD0250) // (CAN_MB2) MailBox Status Register +// ========== Register definition for CAN_MB3 peripheral ========== +#define AT91C_CAN_MB3_MFID ((AT91_REG *) 0xFFFD026C) // (CAN_MB3) MailBox Family ID Register +#define AT91C_CAN_MB3_MAM ((AT91_REG *) 0xFFFD0264) // (CAN_MB3) MailBox Acceptance Mask Register +#define AT91C_CAN_MB3_MID ((AT91_REG *) 0xFFFD0268) // (CAN_MB3) MailBox ID Register +#define AT91C_CAN_MB3_MCR ((AT91_REG *) 0xFFFD027C) // (CAN_MB3) MailBox Control Register +#define AT91C_CAN_MB3_MMR ((AT91_REG *) 0xFFFD0260) // (CAN_MB3) MailBox Mode Register +#define AT91C_CAN_MB3_MSR ((AT91_REG *) 0xFFFD0270) // (CAN_MB3) MailBox Status Register +#define AT91C_CAN_MB3_MDL ((AT91_REG *) 0xFFFD0274) // (CAN_MB3) MailBox Data Low Register +#define AT91C_CAN_MB3_MDH ((AT91_REG *) 0xFFFD0278) // (CAN_MB3) MailBox Data High Register +// ========== Register definition for CAN_MB4 peripheral ========== +#define AT91C_CAN_MB4_MID ((AT91_REG *) 0xFFFD0288) // (CAN_MB4) MailBox ID Register +#define AT91C_CAN_MB4_MMR ((AT91_REG *) 0xFFFD0280) // (CAN_MB4) MailBox Mode Register +#define AT91C_CAN_MB4_MDH ((AT91_REG *) 0xFFFD0298) // (CAN_MB4) MailBox Data High Register +#define AT91C_CAN_MB4_MFID ((AT91_REG *) 0xFFFD028C) // (CAN_MB4) MailBox Family ID Register +#define AT91C_CAN_MB4_MSR ((AT91_REG *) 0xFFFD0290) // (CAN_MB4) MailBox Status Register +#define AT91C_CAN_MB4_MCR ((AT91_REG *) 0xFFFD029C) // (CAN_MB4) MailBox Control Register +#define AT91C_CAN_MB4_MDL ((AT91_REG *) 0xFFFD0294) // (CAN_MB4) MailBox Data Low Register +#define AT91C_CAN_MB4_MAM ((AT91_REG *) 0xFFFD0284) // (CAN_MB4) MailBox Acceptance Mask Register +// ========== Register definition for CAN_MB5 peripheral ========== +#define AT91C_CAN_MB5_MSR ((AT91_REG *) 0xFFFD02B0) // (CAN_MB5) MailBox Status Register +#define AT91C_CAN_MB5_MCR ((AT91_REG *) 0xFFFD02BC) // (CAN_MB5) MailBox Control Register +#define AT91C_CAN_MB5_MFID ((AT91_REG *) 0xFFFD02AC) // (CAN_MB5) MailBox Family ID Register +#define AT91C_CAN_MB5_MDH ((AT91_REG *) 0xFFFD02B8) // (CAN_MB5) MailBox Data High Register +#define AT91C_CAN_MB5_MID ((AT91_REG *) 0xFFFD02A8) // (CAN_MB5) MailBox ID Register +#define AT91C_CAN_MB5_MMR ((AT91_REG *) 0xFFFD02A0) // (CAN_MB5) MailBox Mode Register +#define AT91C_CAN_MB5_MDL ((AT91_REG *) 0xFFFD02B4) // (CAN_MB5) MailBox Data Low Register +#define AT91C_CAN_MB5_MAM ((AT91_REG *) 0xFFFD02A4) // (CAN_MB5) MailBox Acceptance Mask Register +// ========== Register definition for CAN_MB6 peripheral ========== +#define AT91C_CAN_MB6_MFID ((AT91_REG *) 0xFFFD02CC) // (CAN_MB6) MailBox Family ID Register +#define AT91C_CAN_MB6_MID ((AT91_REG *) 0xFFFD02C8) // (CAN_MB6) MailBox ID Register +#define AT91C_CAN_MB6_MAM ((AT91_REG *) 0xFFFD02C4) // (CAN_MB6) MailBox Acceptance Mask Register +#define AT91C_CAN_MB6_MSR ((AT91_REG *) 0xFFFD02D0) // (CAN_MB6) MailBox Status Register +#define AT91C_CAN_MB6_MDL ((AT91_REG *) 0xFFFD02D4) // (CAN_MB6) MailBox Data Low Register +#define AT91C_CAN_MB6_MCR ((AT91_REG *) 0xFFFD02DC) // (CAN_MB6) MailBox Control Register +#define AT91C_CAN_MB6_MDH ((AT91_REG *) 0xFFFD02D8) // (CAN_MB6) MailBox Data High Register +#define AT91C_CAN_MB6_MMR ((AT91_REG *) 0xFFFD02C0) // (CAN_MB6) MailBox Mode Register +// ========== Register definition for CAN_MB7 peripheral ========== +#define AT91C_CAN_MB7_MCR ((AT91_REG *) 0xFFFD02FC) // (CAN_MB7) MailBox Control Register +#define AT91C_CAN_MB7_MDH ((AT91_REG *) 0xFFFD02F8) // (CAN_MB7) MailBox Data High Register +#define AT91C_CAN_MB7_MFID ((AT91_REG *) 0xFFFD02EC) // (CAN_MB7) MailBox Family ID Register +#define AT91C_CAN_MB7_MDL ((AT91_REG *) 0xFFFD02F4) // (CAN_MB7) MailBox Data Low Register +#define AT91C_CAN_MB7_MID ((AT91_REG *) 0xFFFD02E8) // (CAN_MB7) MailBox ID Register +#define AT91C_CAN_MB7_MMR ((AT91_REG *) 0xFFFD02E0) // (CAN_MB7) MailBox Mode Register +#define AT91C_CAN_MB7_MAM ((AT91_REG *) 0xFFFD02E4) // (CAN_MB7) MailBox Acceptance Mask Register +#define AT91C_CAN_MB7_MSR ((AT91_REG *) 0xFFFD02F0) // (CAN_MB7) MailBox Status Register +// ========== Register definition for CAN peripheral ========== +#define AT91C_CAN_TCR ((AT91_REG *) 0xFFFD0024) // (CAN) Transfer Command Register +#define AT91C_CAN_IMR ((AT91_REG *) 0xFFFD000C) // (CAN) Interrupt Mask Register +#define AT91C_CAN_IER ((AT91_REG *) 0xFFFD0004) // (CAN) Interrupt Enable Register +#define AT91C_CAN_ECR ((AT91_REG *) 0xFFFD0020) // (CAN) Error Counter Register +#define AT91C_CAN_TIMESTP ((AT91_REG *) 0xFFFD001C) // (CAN) Time Stamp Register +#define AT91C_CAN_MR ((AT91_REG *) 0xFFFD0000) // (CAN) Mode Register +#define AT91C_CAN_IDR ((AT91_REG *) 0xFFFD0008) // (CAN) Interrupt Disable Register +#define AT91C_CAN_ACR ((AT91_REG *) 0xFFFD0028) // (CAN) Abort Command Register +#define AT91C_CAN_TIM ((AT91_REG *) 0xFFFD0018) // (CAN) Timer Register +#define AT91C_CAN_SR ((AT91_REG *) 0xFFFD0010) // (CAN) Status Register +#define AT91C_CAN_BR ((AT91_REG *) 0xFFFD0014) // (CAN) Baudrate Register +#define AT91C_CAN_VR ((AT91_REG *) 0xFFFD00FC) // (CAN) Version Register +// ========== Register definition for EMAC peripheral ========== +#define AT91C_EMAC_ISR ((AT91_REG *) 0xFFFDC024) // (EMAC) Interrupt Status Register +#define AT91C_EMAC_SA4H ((AT91_REG *) 0xFFFDC0B4) // (EMAC) Specific Address 4 Top, Last 2 bytes +#define AT91C_EMAC_SA1L ((AT91_REG *) 0xFFFDC098) // (EMAC) Specific Address 1 Bottom, First 4 bytes +#define AT91C_EMAC_ELE ((AT91_REG *) 0xFFFDC078) // (EMAC) Excessive Length Errors Register +#define AT91C_EMAC_LCOL ((AT91_REG *) 0xFFFDC05C) // (EMAC) Late Collision Register +#define AT91C_EMAC_RLE ((AT91_REG *) 0xFFFDC088) // (EMAC) Receive Length Field Mismatch Register +#define AT91C_EMAC_WOL ((AT91_REG *) 0xFFFDC0C4) // (EMAC) Wake On LAN Register +#define AT91C_EMAC_DTF ((AT91_REG *) 0xFFFDC058) // (EMAC) Deferred Transmission Frame Register +#define AT91C_EMAC_TUND ((AT91_REG *) 0xFFFDC064) // (EMAC) Transmit Underrun Error Register +#define AT91C_EMAC_NCR ((AT91_REG *) 0xFFFDC000) // (EMAC) Network Control Register +#define AT91C_EMAC_SA4L ((AT91_REG *) 0xFFFDC0B0) // (EMAC) Specific Address 4 Bottom, First 4 bytes +#define AT91C_EMAC_RSR ((AT91_REG *) 0xFFFDC020) // (EMAC) Receive Status Register +#define AT91C_EMAC_SA3L ((AT91_REG *) 0xFFFDC0A8) // (EMAC) Specific Address 3 Bottom, First 4 bytes +#define AT91C_EMAC_TSR ((AT91_REG *) 0xFFFDC014) // (EMAC) Transmit Status Register +#define AT91C_EMAC_IDR ((AT91_REG *) 0xFFFDC02C) // (EMAC) Interrupt Disable Register +#define AT91C_EMAC_RSE ((AT91_REG *) 0xFFFDC074) // (EMAC) Receive Symbol Errors Register +#define AT91C_EMAC_ECOL ((AT91_REG *) 0xFFFDC060) // (EMAC) Excessive Collision Register +#define AT91C_EMAC_TID ((AT91_REG *) 0xFFFDC0B8) // (EMAC) Type ID Checking Register +#define AT91C_EMAC_HRB ((AT91_REG *) 0xFFFDC090) // (EMAC) Hash Address Bottom[31:0] +#define AT91C_EMAC_TBQP ((AT91_REG *) 0xFFFDC01C) // (EMAC) Transmit Buffer Queue Pointer +#define AT91C_EMAC_USRIO ((AT91_REG *) 0xFFFDC0C0) // (EMAC) USER Input/Output Register +#define AT91C_EMAC_PTR ((AT91_REG *) 0xFFFDC038) // (EMAC) Pause Time Register +#define AT91C_EMAC_SA2H ((AT91_REG *) 0xFFFDC0A4) // (EMAC) Specific Address 2 Top, Last 2 bytes +#define AT91C_EMAC_ROV ((AT91_REG *) 0xFFFDC070) // (EMAC) Receive Overrun Errors Register +#define AT91C_EMAC_ALE ((AT91_REG *) 0xFFFDC054) // (EMAC) Alignment Error Register +#define AT91C_EMAC_RJA ((AT91_REG *) 0xFFFDC07C) // (EMAC) Receive Jabbers Register +#define AT91C_EMAC_RBQP ((AT91_REG *) 0xFFFDC018) // (EMAC) Receive Buffer Queue Pointer +#define AT91C_EMAC_TPF ((AT91_REG *) 0xFFFDC08C) // (EMAC) Transmitted Pause Frames Register +#define AT91C_EMAC_NCFGR ((AT91_REG *) 0xFFFDC004) // (EMAC) Network Configuration Register +#define AT91C_EMAC_HRT ((AT91_REG *) 0xFFFDC094) // (EMAC) Hash Address Top[63:32] +#define AT91C_EMAC_USF ((AT91_REG *) 0xFFFDC080) // (EMAC) Undersize Frames Register +#define AT91C_EMAC_FCSE ((AT91_REG *) 0xFFFDC050) // (EMAC) Frame Check Sequence Error Register +#define AT91C_EMAC_TPQ ((AT91_REG *) 0xFFFDC0BC) // (EMAC) Transmit Pause Quantum Register +#define AT91C_EMAC_MAN ((AT91_REG *) 0xFFFDC034) // (EMAC) PHY Maintenance Register +#define AT91C_EMAC_FTO ((AT91_REG *) 0xFFFDC040) // (EMAC) Frames Transmitted OK Register +#define AT91C_EMAC_REV ((AT91_REG *) 0xFFFDC0FC) // (EMAC) Revision Register +#define AT91C_EMAC_IMR ((AT91_REG *) 0xFFFDC030) // (EMAC) Interrupt Mask Register +#define AT91C_EMAC_SCF ((AT91_REG *) 0xFFFDC044) // (EMAC) Single Collision Frame Register +#define AT91C_EMAC_PFR ((AT91_REG *) 0xFFFDC03C) // (EMAC) Pause Frames received Register +#define AT91C_EMAC_MCF ((AT91_REG *) 0xFFFDC048) // (EMAC) Multiple Collision Frame Register +#define AT91C_EMAC_NSR ((AT91_REG *) 0xFFFDC008) // (EMAC) Network Status Register +#define AT91C_EMAC_SA2L ((AT91_REG *) 0xFFFDC0A0) // (EMAC) Specific Address 2 Bottom, First 4 bytes +#define AT91C_EMAC_FRO ((AT91_REG *) 0xFFFDC04C) // (EMAC) Frames Received OK Register +#define AT91C_EMAC_IER ((AT91_REG *) 0xFFFDC028) // (EMAC) Interrupt Enable Register +#define AT91C_EMAC_SA1H ((AT91_REG *) 0xFFFDC09C) // (EMAC) Specific Address 1 Top, Last 2 bytes +#define AT91C_EMAC_CSE ((AT91_REG *) 0xFFFDC068) // (EMAC) Carrier Sense Error Register +#define AT91C_EMAC_SA3H ((AT91_REG *) 0xFFFDC0AC) // (EMAC) Specific Address 3 Top, Last 2 bytes +#define AT91C_EMAC_RRE ((AT91_REG *) 0xFFFDC06C) // (EMAC) Receive Ressource Error Register +#define AT91C_EMAC_STE ((AT91_REG *) 0xFFFDC084) // (EMAC) SQE Test Error Register +// ========== Register definition for PDC_ADC peripheral ========== +#define AT91C_ADC_PTSR ((AT91_REG *) 0xFFFD8124) // (PDC_ADC) PDC Transfer Status Register +#define AT91C_ADC_PTCR ((AT91_REG *) 0xFFFD8120) // (PDC_ADC) PDC Transfer Control Register +#define AT91C_ADC_TNPR ((AT91_REG *) 0xFFFD8118) // (PDC_ADC) Transmit Next Pointer Register +#define AT91C_ADC_TNCR ((AT91_REG *) 0xFFFD811C) // (PDC_ADC) Transmit Next Counter Register +#define AT91C_ADC_RNPR ((AT91_REG *) 0xFFFD8110) // (PDC_ADC) Receive Next Pointer Register +#define AT91C_ADC_RNCR ((AT91_REG *) 0xFFFD8114) // (PDC_ADC) Receive Next Counter Register +#define AT91C_ADC_RPR ((AT91_REG *) 0xFFFD8100) // (PDC_ADC) Receive Pointer Register +#define AT91C_ADC_TCR ((AT91_REG *) 0xFFFD810C) // (PDC_ADC) Transmit Counter Register +#define AT91C_ADC_TPR ((AT91_REG *) 0xFFFD8108) // (PDC_ADC) Transmit Pointer Register +#define AT91C_ADC_RCR ((AT91_REG *) 0xFFFD8104) // (PDC_ADC) Receive Counter Register +// ========== Register definition for ADC peripheral ========== +#define AT91C_ADC_CDR2 ((AT91_REG *) 0xFFFD8038) // (ADC) ADC Channel Data Register 2 +#define AT91C_ADC_CDR3 ((AT91_REG *) 0xFFFD803C) // (ADC) ADC Channel Data Register 3 +#define AT91C_ADC_CDR0 ((AT91_REG *) 0xFFFD8030) // (ADC) ADC Channel Data Register 0 +#define AT91C_ADC_CDR5 ((AT91_REG *) 0xFFFD8044) // (ADC) ADC Channel Data Register 5 +#define AT91C_ADC_CHDR ((AT91_REG *) 0xFFFD8014) // (ADC) ADC Channel Disable Register +#define AT91C_ADC_SR ((AT91_REG *) 0xFFFD801C) // (ADC) ADC Status Register +#define AT91C_ADC_CDR4 ((AT91_REG *) 0xFFFD8040) // (ADC) ADC Channel Data Register 4 +#define AT91C_ADC_CDR1 ((AT91_REG *) 0xFFFD8034) // (ADC) ADC Channel Data Register 1 +#define AT91C_ADC_LCDR ((AT91_REG *) 0xFFFD8020) // (ADC) ADC Last Converted Data Register +#define AT91C_ADC_IDR ((AT91_REG *) 0xFFFD8028) // (ADC) ADC Interrupt Disable Register +#define AT91C_ADC_CR ((AT91_REG *) 0xFFFD8000) // (ADC) ADC Control Register +#define AT91C_ADC_CDR7 ((AT91_REG *) 0xFFFD804C) // (ADC) ADC Channel Data Register 7 +#define AT91C_ADC_CDR6 ((AT91_REG *) 0xFFFD8048) // (ADC) ADC Channel Data Register 6 +#define AT91C_ADC_IER ((AT91_REG *) 0xFFFD8024) // (ADC) ADC Interrupt Enable Register +#define AT91C_ADC_CHER ((AT91_REG *) 0xFFFD8010) // (ADC) ADC Channel Enable Register +#define AT91C_ADC_CHSR ((AT91_REG *) 0xFFFD8018) // (ADC) ADC Channel Status Register +#define AT91C_ADC_MR ((AT91_REG *) 0xFFFD8004) // (ADC) ADC Mode Register +#define AT91C_ADC_IMR ((AT91_REG *) 0xFFFD802C) // (ADC) ADC Interrupt Mask Register + +// ***************************************************************************** +// PIO DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** +#define AT91C_PIO_PA0 ((unsigned int) 1 << 0) // Pin Controlled by PA0 +#define AT91C_PA0_RXD0 ((unsigned int) AT91C_PIO_PA0) // USART 0 Receive Data +#define AT91C_PIO_PA1 ((unsigned int) 1 << 1) // Pin Controlled by PA1 +#define AT91C_PA1_TXD0 ((unsigned int) AT91C_PIO_PA1) // USART 0 Transmit Data +#define AT91C_PIO_PA10 ((unsigned int) 1 << 10) // Pin Controlled by PA10 +#define AT91C_PA10_TWD ((unsigned int) AT91C_PIO_PA10) // TWI Two-wire Serial Data +#define AT91C_PIO_PA11 ((unsigned int) 1 << 11) // Pin Controlled by PA11 +#define AT91C_PA11_TWCK ((unsigned int) AT91C_PIO_PA11) // TWI Two-wire Serial Clock +#define AT91C_PIO_PA12 ((unsigned int) 1 << 12) // Pin Controlled by PA12 +#define AT91C_PA12_SPI0_NPCS0 ((unsigned int) AT91C_PIO_PA12) // SPI 0 Peripheral Chip Select 0 +#define AT91C_PIO_PA13 ((unsigned int) 1 << 13) // Pin Controlled by PA13 +#define AT91C_PA13_SPI0_NPCS1 ((unsigned int) AT91C_PIO_PA13) // SPI 0 Peripheral Chip Select 1 +#define AT91C_PA13_PCK1 ((unsigned int) AT91C_PIO_PA13) // PMC Programmable Clock Output 1 +#define AT91C_PIO_PA14 ((unsigned int) 1 << 14) // Pin Controlled by PA14 +#define AT91C_PA14_SPI0_NPCS2 ((unsigned int) AT91C_PIO_PA14) // SPI 0 Peripheral Chip Select 2 +#define AT91C_PA14_IRQ1 ((unsigned int) AT91C_PIO_PA14) // External Interrupt 1 +#define AT91C_PIO_PA15 ((unsigned int) 1 << 15) // Pin Controlled by PA15 +#define AT91C_PA15_SPI0_NPCS3 ((unsigned int) AT91C_PIO_PA15) // SPI 0 Peripheral Chip Select 3 +#define AT91C_PA15_TCLK2 ((unsigned int) AT91C_PIO_PA15) // Timer Counter 2 external clock input +#define AT91C_PIO_PA16 ((unsigned int) 1 << 16) // Pin Controlled by PA16 +#define AT91C_PA16_SPI0_MISO ((unsigned int) AT91C_PIO_PA16) // SPI 0 Master In Slave +#define AT91C_PIO_PA17 ((unsigned int) 1 << 17) // Pin Controlled by PA17 +#define AT91C_PA17_SPI0_MOSI ((unsigned int) AT91C_PIO_PA17) // SPI 0 Master Out Slave +#define AT91C_PIO_PA18 ((unsigned int) 1 << 18) // Pin Controlled by PA18 +#define AT91C_PA18_SPI0_SPCK ((unsigned int) AT91C_PIO_PA18) // SPI 0 Serial Clock +#define AT91C_PIO_PA19 ((unsigned int) 1 << 19) // Pin Controlled by PA19 +#define AT91C_PA19_CANRX ((unsigned int) AT91C_PIO_PA19) // CAN Receive +#define AT91C_PIO_PA2 ((unsigned int) 1 << 2) // Pin Controlled by PA2 +#define AT91C_PA2_SCK0 ((unsigned int) AT91C_PIO_PA2) // USART 0 Serial Clock +#define AT91C_PA2_SPI1_NPCS1 ((unsigned int) AT91C_PIO_PA2) // SPI 1 Peripheral Chip Select 1 +#define AT91C_PIO_PA20 ((unsigned int) 1 << 20) // Pin Controlled by PA20 +#define AT91C_PA20_CANTX ((unsigned int) AT91C_PIO_PA20) // CAN Transmit +#define AT91C_PIO_PA21 ((unsigned int) 1 << 21) // Pin Controlled by PA21 +#define AT91C_PA21_TF ((unsigned int) AT91C_PIO_PA21) // SSC Transmit Frame Sync +#define AT91C_PA21_SPI1_NPCS0 ((unsigned int) AT91C_PIO_PA21) // SPI 1 Peripheral Chip Select 0 +#define AT91C_PIO_PA22 ((unsigned int) 1 << 22) // Pin Controlled by PA22 +#define AT91C_PA22_TK ((unsigned int) AT91C_PIO_PA22) // SSC Transmit Clock +#define AT91C_PA22_SPI1_SPCK ((unsigned int) AT91C_PIO_PA22) // SPI 1 Serial Clock +#define AT91C_PIO_PA23 ((unsigned int) 1 << 23) // Pin Controlled by PA23 +#define AT91C_PA23_TD ((unsigned int) AT91C_PIO_PA23) // SSC Transmit data +#define AT91C_PA23_SPI1_MOSI ((unsigned int) AT91C_PIO_PA23) // SPI 1 Master Out Slave +#define AT91C_PIO_PA24 ((unsigned int) 1 << 24) // Pin Controlled by PA24 +#define AT91C_PA24_RD ((unsigned int) AT91C_PIO_PA24) // SSC Receive Data +#define AT91C_PA24_SPI1_MISO ((unsigned int) AT91C_PIO_PA24) // SPI 1 Master In Slave +#define AT91C_PIO_PA25 ((unsigned int) 1 << 25) // Pin Controlled by PA25 +#define AT91C_PA25_RK ((unsigned int) AT91C_PIO_PA25) // SSC Receive Clock +#define AT91C_PA25_SPI1_NPCS1 ((unsigned int) AT91C_PIO_PA25) // SPI 1 Peripheral Chip Select 1 +#define AT91C_PIO_PA26 ((unsigned int) 1 << 26) // Pin Controlled by PA26 +#define AT91C_PA26_RF ((unsigned int) AT91C_PIO_PA26) // SSC Receive Frame Sync +#define AT91C_PA26_SPI1_NPCS2 ((unsigned int) AT91C_PIO_PA26) // SPI 1 Peripheral Chip Select 2 +#define AT91C_PIO_PA27 ((unsigned int) 1 << 27) // Pin Controlled by PA27 +#define AT91C_PA27_DRXD ((unsigned int) AT91C_PIO_PA27) // DBGU Debug Receive Data +#define AT91C_PA27_PCK3 ((unsigned int) AT91C_PIO_PA27) // PMC Programmable Clock Output 3 +#define AT91C_PIO_PA28 ((unsigned int) 1 << 28) // Pin Controlled by PA28 +#define AT91C_PA28_DTXD ((unsigned int) AT91C_PIO_PA28) // DBGU Debug Transmit Data +#define AT91C_PIO_PA29 ((unsigned int) 1 << 29) // Pin Controlled by PA29 +#define AT91C_PA29_FIQ ((unsigned int) AT91C_PIO_PA29) // AIC Fast Interrupt Input +#define AT91C_PA29_SPI1_NPCS3 ((unsigned int) AT91C_PIO_PA29) // SPI 1 Peripheral Chip Select 3 +#define AT91C_PIO_PA3 ((unsigned int) 1 << 3) // Pin Controlled by PA3 +#define AT91C_PA3_RTS0 ((unsigned int) AT91C_PIO_PA3) // USART 0 Ready To Send +#define AT91C_PA3_SPI1_NPCS2 ((unsigned int) AT91C_PIO_PA3) // SPI 1 Peripheral Chip Select 2 +#define AT91C_PIO_PA30 ((unsigned int) 1 << 30) // Pin Controlled by PA30 +#define AT91C_PA30_IRQ0 ((unsigned int) AT91C_PIO_PA30) // External Interrupt 0 +#define AT91C_PA30_PCK2 ((unsigned int) AT91C_PIO_PA30) // PMC Programmable Clock Output 2 +#define AT91C_PIO_PA4 ((unsigned int) 1 << 4) // Pin Controlled by PA4 +#define AT91C_PA4_CTS0 ((unsigned int) AT91C_PIO_PA4) // USART 0 Clear To Send +#define AT91C_PA4_SPI1_NPCS3 ((unsigned int) AT91C_PIO_PA4) // SPI 1 Peripheral Chip Select 3 +#define AT91C_PIO_PA5 ((unsigned int) 1 << 5) // Pin Controlled by PA5 +#define AT91C_PA5_RXD1 ((unsigned int) AT91C_PIO_PA5) // USART 1 Receive Data +#define AT91C_PIO_PA6 ((unsigned int) 1 << 6) // Pin Controlled by PA6 +#define AT91C_PA6_TXD1 ((unsigned int) AT91C_PIO_PA6) // USART 1 Transmit Data +#define AT91C_PIO_PA7 ((unsigned int) 1 << 7) // Pin Controlled by PA7 +#define AT91C_PA7_SCK1 ((unsigned int) AT91C_PIO_PA7) // USART 1 Serial Clock +#define AT91C_PA7_SPI0_NPCS1 ((unsigned int) AT91C_PIO_PA7) // SPI 0 Peripheral Chip Select 1 +#define AT91C_PIO_PA8 ((unsigned int) 1 << 8) // Pin Controlled by PA8 +#define AT91C_PA8_RTS1 ((unsigned int) AT91C_PIO_PA8) // USART 1 Ready To Send +#define AT91C_PA8_SPI0_NPCS2 ((unsigned int) AT91C_PIO_PA8) // SPI 0 Peripheral Chip Select 2 +#define AT91C_PIO_PA9 ((unsigned int) 1 << 9) // Pin Controlled by PA9 +#define AT91C_PA9_CTS1 ((unsigned int) AT91C_PIO_PA9) // USART 1 Clear To Send +#define AT91C_PA9_SPI0_NPCS3 ((unsigned int) AT91C_PIO_PA9) // SPI 0 Peripheral Chip Select 3 +#define AT91C_PIO_PB0 ((unsigned int) 1 << 0) // Pin Controlled by PB0 +#define AT91C_PB0_ETXCK_EREFCK ((unsigned int) AT91C_PIO_PB0) // Ethernet MAC Transmit Clock/Reference Clock +#define AT91C_PB0_PCK0 ((unsigned int) AT91C_PIO_PB0) // PMC Programmable Clock Output 0 +#define AT91C_PIO_PB1 ((unsigned int) 1 << 1) // Pin Controlled by PB1 +#define AT91C_PB1_ETXEN ((unsigned int) AT91C_PIO_PB1) // Ethernet MAC Transmit Enable +#define AT91C_PIO_PB10 ((unsigned int) 1 << 10) // Pin Controlled by PB10 +#define AT91C_PB10_ETX2 ((unsigned int) AT91C_PIO_PB10) // Ethernet MAC Transmit Data 2 +#define AT91C_PB10_SPI1_NPCS1 ((unsigned int) AT91C_PIO_PB10) // SPI 1 Peripheral Chip Select 1 +#define AT91C_PIO_PB11 ((unsigned int) 1 << 11) // Pin Controlled by PB11 +#define AT91C_PB11_ETX3 ((unsigned int) AT91C_PIO_PB11) // Ethernet MAC Transmit Data 3 +#define AT91C_PB11_SPI1_NPCS2 ((unsigned int) AT91C_PIO_PB11) // SPI 1 Peripheral Chip Select 2 +#define AT91C_PIO_PB12 ((unsigned int) 1 << 12) // Pin Controlled by PB12 +#define AT91C_PB12_ETXER ((unsigned int) AT91C_PIO_PB12) // Ethernet MAC Transmikt Coding Error +#define AT91C_PB12_TCLK0 ((unsigned int) AT91C_PIO_PB12) // Timer Counter 0 external clock input +#define AT91C_PIO_PB13 ((unsigned int) 1 << 13) // Pin Controlled by PB13 +#define AT91C_PB13_ERX2 ((unsigned int) AT91C_PIO_PB13) // Ethernet MAC Receive Data 2 +#define AT91C_PB13_SPI0_NPCS1 ((unsigned int) AT91C_PIO_PB13) // SPI 0 Peripheral Chip Select 1 +#define AT91C_PIO_PB14 ((unsigned int) 1 << 14) // Pin Controlled by PB14 +#define AT91C_PB14_ERX3 ((unsigned int) AT91C_PIO_PB14) // Ethernet MAC Receive Data 3 +#define AT91C_PB14_SPI0_NPCS2 ((unsigned int) AT91C_PIO_PB14) // SPI 0 Peripheral Chip Select 2 +#define AT91C_PIO_PB15 ((unsigned int) 1 << 15) // Pin Controlled by PB15 +#define AT91C_PB15_ERXDV_ECRSDV ((unsigned int) AT91C_PIO_PB15) // Ethernet MAC Receive Data Valid +#define AT91C_PIO_PB16 ((unsigned int) 1 << 16) // Pin Controlled by PB16 +#define AT91C_PB16_ECOL ((unsigned int) AT91C_PIO_PB16) // Ethernet MAC Collision Detected +#define AT91C_PB16_SPI1_NPCS3 ((unsigned int) AT91C_PIO_PB16) // SPI 1 Peripheral Chip Select 3 +#define AT91C_PIO_PB17 ((unsigned int) 1 << 17) // Pin Controlled by PB17 +#define AT91C_PB17_ERXCK ((unsigned int) AT91C_PIO_PB17) // Ethernet MAC Receive Clock +#define AT91C_PB17_SPI0_NPCS3 ((unsigned int) AT91C_PIO_PB17) // SPI 0 Peripheral Chip Select 3 +#define AT91C_PIO_PB18 ((unsigned int) 1 << 18) // Pin Controlled by PB18 +#define AT91C_PB18_EF100 ((unsigned int) AT91C_PIO_PB18) // Ethernet MAC Force 100 Mbits/sec +#define AT91C_PB18_ADTRG ((unsigned int) AT91C_PIO_PB18) // ADC External Trigger +#define AT91C_PIO_PB19 ((unsigned int) 1 << 19) // Pin Controlled by PB19 +#define AT91C_PB19_PWM0 ((unsigned int) AT91C_PIO_PB19) // PWM Channel 0 +#define AT91C_PB19_TCLK1 ((unsigned int) AT91C_PIO_PB19) // Timer Counter 1 external clock input +#define AT91C_PIO_PB2 ((unsigned int) 1 << 2) // Pin Controlled by PB2 +#define AT91C_PB2_ETX0 ((unsigned int) AT91C_PIO_PB2) // Ethernet MAC Transmit Data 0 +#define AT91C_PIO_PB20 ((unsigned int) 1 << 20) // Pin Controlled by PB20 +#define AT91C_PB20_PWM1 ((unsigned int) AT91C_PIO_PB20) // PWM Channel 1 +#define AT91C_PB20_PCK0 ((unsigned int) AT91C_PIO_PB20) // PMC Programmable Clock Output 0 +#define AT91C_PIO_PB21 ((unsigned int) 1 << 21) // Pin Controlled by PB21 +#define AT91C_PB21_PWM2 ((unsigned int) AT91C_PIO_PB21) // PWM Channel 2 +#define AT91C_PB21_PCK1 ((unsigned int) AT91C_PIO_PB21) // PMC Programmable Clock Output 1 +#define AT91C_PIO_PB22 ((unsigned int) 1 << 22) // Pin Controlled by PB22 +#define AT91C_PB22_PWM3 ((unsigned int) AT91C_PIO_PB22) // PWM Channel 3 +#define AT91C_PB22_PCK2 ((unsigned int) AT91C_PIO_PB22) // PMC Programmable Clock Output 2 +#define AT91C_PIO_PB23 ((unsigned int) 1 << 23) // Pin Controlled by PB23 +#define AT91C_PB23_TIOA0 ((unsigned int) AT91C_PIO_PB23) // Timer Counter 0 Multipurpose Timer I/O Pin A +#define AT91C_PB23_DCD1 ((unsigned int) AT91C_PIO_PB23) // USART 1 Data Carrier Detect +#define AT91C_PIO_PB24 ((unsigned int) 1 << 24) // Pin Controlled by PB24 +#define AT91C_PB24_TIOB0 ((unsigned int) AT91C_PIO_PB24) // Timer Counter 0 Multipurpose Timer I/O Pin B +#define AT91C_PB24_DSR1 ((unsigned int) AT91C_PIO_PB24) // USART 1 Data Set ready +#define AT91C_PIO_PB25 ((unsigned int) 1 << 25) // Pin Controlled by PB25 +#define AT91C_PB25_TIOA1 ((unsigned int) AT91C_PIO_PB25) // Timer Counter 1 Multipurpose Timer I/O Pin A +#define AT91C_PB25_DTR1 ((unsigned int) AT91C_PIO_PB25) // USART 1 Data Terminal ready +#define AT91C_PIO_PB26 ((unsigned int) 1 << 26) // Pin Controlled by PB26 +#define AT91C_PB26_TIOB1 ((unsigned int) AT91C_PIO_PB26) // Timer Counter 1 Multipurpose Timer I/O Pin B +#define AT91C_PB26_RI1 ((unsigned int) AT91C_PIO_PB26) // USART 1 Ring Indicator +#define AT91C_PIO_PB27 ((unsigned int) 1 << 27) // Pin Controlled by PB27 +#define AT91C_PB27_TIOA2 ((unsigned int) AT91C_PIO_PB27) // Timer Counter 2 Multipurpose Timer I/O Pin A +#define AT91C_PB27_PWM0 ((unsigned int) AT91C_PIO_PB27) // PWM Channel 0 +#define AT91C_PIO_PB28 ((unsigned int) 1 << 28) // Pin Controlled by PB28 +#define AT91C_PB28_TIOB2 ((unsigned int) AT91C_PIO_PB28) // Timer Counter 2 Multipurpose Timer I/O Pin B +#define AT91C_PB28_PWM1 ((unsigned int) AT91C_PIO_PB28) // PWM Channel 1 +#define AT91C_PIO_PB29 ((unsigned int) 1 << 29) // Pin Controlled by PB29 +#define AT91C_PB29_PCK1 ((unsigned int) AT91C_PIO_PB29) // PMC Programmable Clock Output 1 +#define AT91C_PB29_PWM2 ((unsigned int) AT91C_PIO_PB29) // PWM Channel 2 +#define AT91C_PIO_PB3 ((unsigned int) 1 << 3) // Pin Controlled by PB3 +#define AT91C_PB3_ETX1 ((unsigned int) AT91C_PIO_PB3) // Ethernet MAC Transmit Data 1 +#define AT91C_PIO_PB30 ((unsigned int) 1 << 30) // Pin Controlled by PB30 +#define AT91C_PB30_PCK2 ((unsigned int) AT91C_PIO_PB30) // PMC Programmable Clock Output 2 +#define AT91C_PB30_PWM3 ((unsigned int) AT91C_PIO_PB30) // PWM Channel 3 +#define AT91C_PIO_PB4 ((unsigned int) 1 << 4) // Pin Controlled by PB4 +#define AT91C_PB4_ECRS ((unsigned int) AT91C_PIO_PB4) // Ethernet MAC Carrier Sense/Carrier Sense and Data Valid +#define AT91C_PIO_PB5 ((unsigned int) 1 << 5) // Pin Controlled by PB5 +#define AT91C_PB5_ERX0 ((unsigned int) AT91C_PIO_PB5) // Ethernet MAC Receive Data 0 +#define AT91C_PIO_PB6 ((unsigned int) 1 << 6) // Pin Controlled by PB6 +#define AT91C_PB6_ERX1 ((unsigned int) AT91C_PIO_PB6) // Ethernet MAC Receive Data 1 +#define AT91C_PIO_PB7 ((unsigned int) 1 << 7) // Pin Controlled by PB7 +#define AT91C_PB7_ERXER ((unsigned int) AT91C_PIO_PB7) // Ethernet MAC Receive Error +#define AT91C_PIO_PB8 ((unsigned int) 1 << 8) // Pin Controlled by PB8 +#define AT91C_PB8_EMDC ((unsigned int) AT91C_PIO_PB8) // Ethernet MAC Management Data Clock +#define AT91C_PIO_PB9 ((unsigned int) 1 << 9) // Pin Controlled by PB9 +#define AT91C_PB9_EMDIO ((unsigned int) AT91C_PIO_PB9) // Ethernet MAC Management Data Input/Output + +// ***************************************************************************** +// PERIPHERAL ID DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** +#define AT91C_ID_FIQ ((unsigned int) 0) // Advanced Interrupt Controller (FIQ) +#define AT91C_ID_SYS ((unsigned int) 1) // System Peripheral +#define AT91C_ID_PIOA ((unsigned int) 2) // Parallel IO Controller A +#define AT91C_ID_PIOB ((unsigned int) 3) // Parallel IO Controller B +#define AT91C_ID_SPI0 ((unsigned int) 4) // Serial Peripheral Interface 0 +#define AT91C_ID_SPI1 ((unsigned int) 5) // Serial Peripheral Interface 1 +#define AT91C_ID_US0 ((unsigned int) 6) // USART 0 +#define AT91C_ID_US1 ((unsigned int) 7) // USART 1 +#define AT91C_ID_SSC ((unsigned int) 8) // Serial Synchronous Controller +#define AT91C_ID_TWI ((unsigned int) 9) // Two-Wire Interface +#define AT91C_ID_PWMC ((unsigned int) 10) // PWM Controller +#define AT91C_ID_UDP ((unsigned int) 11) // USB Device Port +#define AT91C_ID_TC0 ((unsigned int) 12) // Timer Counter 0 +#define AT91C_ID_TC1 ((unsigned int) 13) // Timer Counter 1 +#define AT91C_ID_TC2 ((unsigned int) 14) // Timer Counter 2 +#define AT91C_ID_CAN ((unsigned int) 15) // Control Area Network Controller +#define AT91C_ID_EMAC ((unsigned int) 16) // Ethernet MAC +#define AT91C_ID_ADC ((unsigned int) 17) // Analog-to-Digital Converter +#define AT91C_ID_18_Reserved ((unsigned int) 18) // Reserved +#define AT91C_ID_19_Reserved ((unsigned int) 19) // Reserved +#define AT91C_ID_20_Reserved ((unsigned int) 20) // Reserved +#define AT91C_ID_21_Reserved ((unsigned int) 21) // Reserved +#define AT91C_ID_22_Reserved ((unsigned int) 22) // Reserved +#define AT91C_ID_23_Reserved ((unsigned int) 23) // Reserved +#define AT91C_ID_24_Reserved ((unsigned int) 24) // Reserved +#define AT91C_ID_25_Reserved ((unsigned int) 25) // Reserved +#define AT91C_ID_26_Reserved ((unsigned int) 26) // Reserved +#define AT91C_ID_27_Reserved ((unsigned int) 27) // Reserved +#define AT91C_ID_28_Reserved ((unsigned int) 28) // Reserved +#define AT91C_ID_29_Reserved ((unsigned int) 29) // Reserved +#define AT91C_ID_IRQ0 ((unsigned int) 30) // Advanced Interrupt Controller (IRQ0) +#define AT91C_ID_IRQ1 ((unsigned int) 31) // Advanced Interrupt Controller (IRQ1) +#define AT91C_ALL_INT ((unsigned int) 0xC003FFFF) // ALL VALID INTERRUPTS + +// ***************************************************************************** +// BASE ADDRESS DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** +#define AT91C_BASE_SYS ((AT91PS_SYS) 0xFFFFF000) // (SYS) Base Address +#define AT91C_BASE_AIC ((AT91PS_AIC) 0xFFFFF000) // (AIC) Base Address +#define AT91C_BASE_PDC_DBGU ((AT91PS_PDC) 0xFFFFF300) // (PDC_DBGU) Base Address +#define AT91C_BASE_DBGU ((AT91PS_DBGU) 0xFFFFF200) // (DBGU) Base Address +#define AT91C_BASE_PIOA ((AT91PS_PIO) 0xFFFFF400) // (PIOA) Base Address +#define AT91C_BASE_PIOB ((AT91PS_PIO) 0xFFFFF600) // (PIOB) Base Address +#define AT91C_BASE_CKGR ((AT91PS_CKGR) 0xFFFFFC20) // (CKGR) Base Address +#define AT91C_BASE_PMC ((AT91PS_PMC) 0xFFFFFC00) // (PMC) Base Address +#define AT91C_BASE_RSTC ((AT91PS_RSTC) 0xFFFFFD00) // (RSTC) Base Address +#define AT91C_BASE_RTTC ((AT91PS_RTTC) 0xFFFFFD20) // (RTTC) Base Address +#define AT91C_BASE_PITC ((AT91PS_PITC) 0xFFFFFD30) // (PITC) Base Address +#define AT91C_BASE_WDTC ((AT91PS_WDTC) 0xFFFFFD40) // (WDTC) Base Address +#define AT91C_BASE_VREG ((AT91PS_VREG) 0xFFFFFD60) // (VREG) Base Address +#define AT91C_BASE_MC ((AT91PS_MC) 0xFFFFFF00) // (MC) Base Address +#define AT91C_BASE_PDC_SPI1 ((AT91PS_PDC) 0xFFFE4100) // (PDC_SPI1) Base Address +#define AT91C_BASE_SPI1 ((AT91PS_SPI) 0xFFFE4000) // (SPI1) Base Address +#define AT91C_BASE_PDC_SPI0 ((AT91PS_PDC) 0xFFFE0100) // (PDC_SPI0) Base Address +#define AT91C_BASE_SPI0 ((AT91PS_SPI) 0xFFFE0000) // (SPI0) Base Address +#define AT91C_BASE_PDC_US1 ((AT91PS_PDC) 0xFFFC4100) // (PDC_US1) Base Address +#define AT91C_BASE_US1 ((AT91PS_USART) 0xFFFC4000) // (US1) Base Address +#define AT91C_BASE_PDC_US0 ((AT91PS_PDC) 0xFFFC0100) // (PDC_US0) Base Address +#define AT91C_BASE_US0 ((AT91PS_USART) 0xFFFC0000) // (US0) Base Address +#define AT91C_BASE_PDC_SSC ((AT91PS_PDC) 0xFFFD4100) // (PDC_SSC) Base Address +#define AT91C_BASE_SSC ((AT91PS_SSC) 0xFFFD4000) // (SSC) Base Address +#define AT91C_BASE_TWI ((AT91PS_TWI) 0xFFFB8000) // (TWI) Base Address +#define AT91C_BASE_PWMC_CH3 ((AT91PS_PWMC_CH) 0xFFFCC260) // (PWMC_CH3) Base Address +#define AT91C_BASE_PWMC_CH2 ((AT91PS_PWMC_CH) 0xFFFCC240) // (PWMC_CH2) Base Address +#define AT91C_BASE_PWMC_CH1 ((AT91PS_PWMC_CH) 0xFFFCC220) // (PWMC_CH1) Base Address +#define AT91C_BASE_PWMC_CH0 ((AT91PS_PWMC_CH) 0xFFFCC200) // (PWMC_CH0) Base Address +#define AT91C_BASE_PWMC ((AT91PS_PWMC) 0xFFFCC000) // (PWMC) Base Address +#define AT91C_BASE_UDP ((AT91PS_UDP) 0xFFFB0000) // (UDP) Base Address +#define AT91C_BASE_TC0 ((AT91PS_TC) 0xFFFA0000) // (TC0) Base Address +#define AT91C_BASE_TC1 ((AT91PS_TC) 0xFFFA0040) // (TC1) Base Address +#define AT91C_BASE_TC2 ((AT91PS_TC) 0xFFFA0080) // (TC2) Base Address +#define AT91C_BASE_TCB ((AT91PS_TCB) 0xFFFA0000) // (TCB) Base Address +#define AT91C_BASE_CAN_MB0 ((AT91PS_CAN_MB) 0xFFFD0200) // (CAN_MB0) Base Address +#define AT91C_BASE_CAN_MB1 ((AT91PS_CAN_MB) 0xFFFD0220) // (CAN_MB1) Base Address +#define AT91C_BASE_CAN_MB2 ((AT91PS_CAN_MB) 0xFFFD0240) // (CAN_MB2) Base Address +#define AT91C_BASE_CAN_MB3 ((AT91PS_CAN_MB) 0xFFFD0260) // (CAN_MB3) Base Address +#define AT91C_BASE_CAN_MB4 ((AT91PS_CAN_MB) 0xFFFD0280) // (CAN_MB4) Base Address +#define AT91C_BASE_CAN_MB5 ((AT91PS_CAN_MB) 0xFFFD02A0) // (CAN_MB5) Base Address +#define AT91C_BASE_CAN_MB6 ((AT91PS_CAN_MB) 0xFFFD02C0) // (CAN_MB6) Base Address +#define AT91C_BASE_CAN_MB7 ((AT91PS_CAN_MB) 0xFFFD02E0) // (CAN_MB7) Base Address +#define AT91C_BASE_CAN ((AT91PS_CAN) 0xFFFD0000) // (CAN) Base Address +#define AT91C_BASE_EMAC ((AT91PS_EMAC) 0xFFFDC000) // (EMAC) Base Address +#define AT91C_BASE_PDC_ADC ((AT91PS_PDC) 0xFFFD8100) // (PDC_ADC) Base Address +#define AT91C_BASE_ADC ((AT91PS_ADC) 0xFFFD8000) // (ADC) Base Address + +// ***************************************************************************** +// MEMORY MAPPING DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** +// ISRAM +#define AT91C_ISRAM ((char *) 0x00200000) // Internal SRAM base address +#define AT91C_ISRAM_SIZE ((unsigned int) 0x00010000) // Internal SRAM size in byte (64 Kbytes) +// IFLASH +#define AT91C_IFLASH ((char *) 0x00100000) // Internal FLASH base address +#define AT91C_IFLASH_SIZE ((unsigned int) 0x00040000) // Internal FLASH size in byte (256 Kbytes) +#define AT91C_IFLASH_PAGE_SIZE ((unsigned int) 256) // Internal FLASH Page Size: 256 bytes +#define AT91C_IFLASH_LOCK_REGION_SIZE ((unsigned int) 16384) // Internal FLASH Lock Region Size: 16 Kbytes +#define AT91C_IFLASH_NB_OF_PAGES ((unsigned int) 1024) // Internal FLASH Number of Pages: 1024 bytes +#define AT91C_IFLASH_NB_OF_LOCK_BITS ((unsigned int) 16) // Internal FLASH Number of Lock Bits: 16 bytes +#endif /* __IAR_SYSTEMS_ICC__ */ + +#ifdef __IAR_SYSTEMS_ASM__ + +// - Hardware register definition + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR System Peripherals +// - ***************************************************************************** + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Advanced Interrupt Controller +// - ***************************************************************************** +// - -------- AIC_SMR : (AIC Offset: 0x0) Control Register -------- +AT91C_AIC_PRIOR EQU (0x7 << 0) ;- (AIC) Priority Level +AT91C_AIC_PRIOR_LOWEST EQU (0x0) ;- (AIC) Lowest priority level +AT91C_AIC_PRIOR_HIGHEST EQU (0x7) ;- (AIC) Highest priority level +AT91C_AIC_SRCTYPE EQU (0x3 << 5) ;- (AIC) Interrupt Source Type +AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL EQU (0x0 << 5) ;- (AIC) Internal Sources Code Label High-level Sensitive +AT91C_AIC_SRCTYPE_EXT_LOW_LEVEL EQU (0x0 << 5) ;- (AIC) External Sources Code Label Low-level Sensitive +AT91C_AIC_SRCTYPE_INT_POSITIVE_EDGE EQU (0x1 << 5) ;- (AIC) Internal Sources Code Label Positive Edge triggered +AT91C_AIC_SRCTYPE_EXT_NEGATIVE_EDGE EQU (0x1 << 5) ;- (AIC) External Sources Code Label Negative Edge triggered +AT91C_AIC_SRCTYPE_HIGH_LEVEL EQU (0x2 << 5) ;- (AIC) Internal Or External Sources Code Label High-level Sensitive +AT91C_AIC_SRCTYPE_POSITIVE_EDGE EQU (0x3 << 5) ;- (AIC) Internal Or External Sources Code Label Positive Edge triggered +// - -------- AIC_CISR : (AIC Offset: 0x114) AIC Core Interrupt Status Register -------- +AT91C_AIC_NFIQ EQU (0x1 << 0) ;- (AIC) NFIQ Status +AT91C_AIC_NIRQ EQU (0x1 << 1) ;- (AIC) NIRQ Status +// - -------- AIC_DCR : (AIC Offset: 0x138) AIC Debug Control Register (Protect) -------- +AT91C_AIC_DCR_PROT EQU (0x1 << 0) ;- (AIC) Protection Mode +AT91C_AIC_DCR_GMSK EQU (0x1 << 1) ;- (AIC) General Mask + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Peripheral DMA Controller +// - ***************************************************************************** +// - -------- PDC_PTCR : (PDC Offset: 0x20) PDC Transfer Control Register -------- +AT91C_PDC_RXTEN EQU (0x1 << 0) ;- (PDC) Receiver Transfer Enable +AT91C_PDC_RXTDIS EQU (0x1 << 1) ;- (PDC) Receiver Transfer Disable +AT91C_PDC_TXTEN EQU (0x1 << 8) ;- (PDC) Transmitter Transfer Enable +AT91C_PDC_TXTDIS EQU (0x1 << 9) ;- (PDC) Transmitter Transfer Disable +// - -------- PDC_PTSR : (PDC Offset: 0x24) PDC Transfer Status Register -------- + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Debug Unit +// - ***************************************************************************** +// - -------- DBGU_CR : (DBGU Offset: 0x0) Debug Unit Control Register -------- +AT91C_US_RSTRX EQU (0x1 << 2) ;- (DBGU) Reset Receiver +AT91C_US_RSTTX EQU (0x1 << 3) ;- (DBGU) Reset Transmitter +AT91C_US_RXEN EQU (0x1 << 4) ;- (DBGU) Receiver Enable +AT91C_US_RXDIS EQU (0x1 << 5) ;- (DBGU) Receiver Disable +AT91C_US_TXEN EQU (0x1 << 6) ;- (DBGU) Transmitter Enable +AT91C_US_TXDIS EQU (0x1 << 7) ;- (DBGU) Transmitter Disable +AT91C_US_RSTSTA EQU (0x1 << 8) ;- (DBGU) Reset Status Bits +// - -------- DBGU_MR : (DBGU Offset: 0x4) Debug Unit Mode Register -------- +AT91C_US_PAR EQU (0x7 << 9) ;- (DBGU) Parity type +AT91C_US_PAR_EVEN EQU (0x0 << 9) ;- (DBGU) Even Parity +AT91C_US_PAR_ODD EQU (0x1 << 9) ;- (DBGU) Odd Parity +AT91C_US_PAR_SPACE EQU (0x2 << 9) ;- (DBGU) Parity forced to 0 (Space) +AT91C_US_PAR_MARK EQU (0x3 << 9) ;- (DBGU) Parity forced to 1 (Mark) +AT91C_US_PAR_NONE EQU (0x4 << 9) ;- (DBGU) No Parity +AT91C_US_PAR_MULTI_DROP EQU (0x6 << 9) ;- (DBGU) Multi-drop mode +AT91C_US_CHMODE EQU (0x3 << 14) ;- (DBGU) Channel Mode +AT91C_US_CHMODE_NORMAL EQU (0x0 << 14) ;- (DBGU) Normal Mode: The USART channel operates as an RX/TX USART. +AT91C_US_CHMODE_AUTO EQU (0x1 << 14) ;- (DBGU) Automatic Echo: Receiver Data Input is connected to the TXD pin. +AT91C_US_CHMODE_LOCAL EQU (0x2 << 14) ;- (DBGU) Local Loopback: Transmitter Output Signal is connected to Receiver Input Signal. +AT91C_US_CHMODE_REMOTE EQU (0x3 << 14) ;- (DBGU) Remote Loopback: RXD pin is internally connected to TXD pin. +// - -------- DBGU_IER : (DBGU Offset: 0x8) Debug Unit Interrupt Enable Register -------- +AT91C_US_RXRDY EQU (0x1 << 0) ;- (DBGU) RXRDY Interrupt +AT91C_US_TXRDY EQU (0x1 << 1) ;- (DBGU) TXRDY Interrupt +AT91C_US_ENDRX EQU (0x1 << 3) ;- (DBGU) End of Receive Transfer Interrupt +AT91C_US_ENDTX EQU (0x1 << 4) ;- (DBGU) End of Transmit Interrupt +AT91C_US_OVRE EQU (0x1 << 5) ;- (DBGU) Overrun Interrupt +AT91C_US_FRAME EQU (0x1 << 6) ;- (DBGU) Framing Error Interrupt +AT91C_US_PARE EQU (0x1 << 7) ;- (DBGU) Parity Error Interrupt +AT91C_US_TXEMPTY EQU (0x1 << 9) ;- (DBGU) TXEMPTY Interrupt +AT91C_US_TXBUFE EQU (0x1 << 11) ;- (DBGU) TXBUFE Interrupt +AT91C_US_RXBUFF EQU (0x1 << 12) ;- (DBGU) RXBUFF Interrupt +AT91C_US_COMM_TX EQU (0x1 << 30) ;- (DBGU) COMM_TX Interrupt +AT91C_US_COMM_RX EQU (0x1 << 31) ;- (DBGU) COMM_RX Interrupt +// - -------- DBGU_IDR : (DBGU Offset: 0xc) Debug Unit Interrupt Disable Register -------- +// - -------- DBGU_IMR : (DBGU Offset: 0x10) Debug Unit Interrupt Mask Register -------- +// - -------- DBGU_CSR : (DBGU Offset: 0x14) Debug Unit Channel Status Register -------- +// - -------- DBGU_FNTR : (DBGU Offset: 0x48) Debug Unit FORCE_NTRST Register -------- +AT91C_US_FORCE_NTRST EQU (0x1 << 0) ;- (DBGU) Force NTRST in JTAG + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Parallel Input Output Controler +// - ***************************************************************************** + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Clock Generator Controler +// - ***************************************************************************** +// - -------- CKGR_MOR : (CKGR Offset: 0x0) Main Oscillator Register -------- +AT91C_CKGR_MOSCEN EQU (0x1 << 0) ;- (CKGR) Main Oscillator Enable +AT91C_CKGR_OSCBYPASS EQU (0x1 << 1) ;- (CKGR) Main Oscillator Bypass +AT91C_CKGR_OSCOUNT EQU (0xFF << 8) ;- (CKGR) Main Oscillator Start-up Time +// - -------- CKGR_MCFR : (CKGR Offset: 0x4) Main Clock Frequency Register -------- +AT91C_CKGR_MAINF EQU (0xFFFF << 0) ;- (CKGR) Main Clock Frequency +AT91C_CKGR_MAINRDY EQU (0x1 << 16) ;- (CKGR) Main Clock Ready +// - -------- CKGR_PLLR : (CKGR Offset: 0xc) PLL B Register -------- +AT91C_CKGR_DIV EQU (0xFF << 0) ;- (CKGR) Divider Selected +AT91C_CKGR_DIV_0 EQU (0x0) ;- (CKGR) Divider output is 0 +AT91C_CKGR_DIV_BYPASS EQU (0x1) ;- (CKGR) Divider is bypassed +AT91C_CKGR_PLLCOUNT EQU (0x3F << 8) ;- (CKGR) PLL Counter +AT91C_CKGR_OUT EQU (0x3 << 14) ;- (CKGR) PLL Output Frequency Range +AT91C_CKGR_OUT_0 EQU (0x0 << 14) ;- (CKGR) Please refer to the PLL datasheet +AT91C_CKGR_OUT_1 EQU (0x1 << 14) ;- (CKGR) Please refer to the PLL datasheet +AT91C_CKGR_OUT_2 EQU (0x2 << 14) ;- (CKGR) Please refer to the PLL datasheet +AT91C_CKGR_OUT_3 EQU (0x3 << 14) ;- (CKGR) Please refer to the PLL datasheet +AT91C_CKGR_MUL EQU (0x7FF << 16) ;- (CKGR) PLL Multiplier +AT91C_CKGR_USBDIV EQU (0x3 << 28) ;- (CKGR) Divider for USB Clocks +AT91C_CKGR_USBDIV_0 EQU (0x0 << 28) ;- (CKGR) Divider output is PLL clock output +AT91C_CKGR_USBDIV_1 EQU (0x1 << 28) ;- (CKGR) Divider output is PLL clock output divided by 2 +AT91C_CKGR_USBDIV_2 EQU (0x2 << 28) ;- (CKGR) Divider output is PLL clock output divided by 4 + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Power Management Controler +// - ***************************************************************************** +// - -------- PMC_SCER : (PMC Offset: 0x0) System Clock Enable Register -------- +AT91C_PMC_PCK EQU (0x1 << 0) ;- (PMC) Processor Clock +AT91C_PMC_UDP EQU (0x1 << 7) ;- (PMC) USB Device Port Clock +AT91C_PMC_PCK0 EQU (0x1 << 8) ;- (PMC) Programmable Clock Output +AT91C_PMC_PCK1 EQU (0x1 << 9) ;- (PMC) Programmable Clock Output +AT91C_PMC_PCK2 EQU (0x1 << 10) ;- (PMC) Programmable Clock Output +AT91C_PMC_PCK3 EQU (0x1 << 11) ;- (PMC) Programmable Clock Output +// - -------- PMC_SCDR : (PMC Offset: 0x4) System Clock Disable Register -------- +// - -------- PMC_SCSR : (PMC Offset: 0x8) System Clock Status Register -------- +// - -------- CKGR_MOR : (PMC Offset: 0x20) Main Oscillator Register -------- +// - -------- CKGR_MCFR : (PMC Offset: 0x24) Main Clock Frequency Register -------- +// - -------- CKGR_PLLR : (PMC Offset: 0x2c) PLL B Register -------- +// - -------- PMC_MCKR : (PMC Offset: 0x30) Master Clock Register -------- +AT91C_PMC_CSS EQU (0x3 << 0) ;- (PMC) Programmable Clock Selection +AT91C_PMC_CSS_SLOW_CLK EQU (0x0) ;- (PMC) Slow Clock is selected +AT91C_PMC_CSS_MAIN_CLK EQU (0x1) ;- (PMC) Main Clock is selected +AT91C_PMC_CSS_PLL_CLK EQU (0x3) ;- (PMC) Clock from PLL is selected +AT91C_PMC_PRES EQU (0x7 << 2) ;- (PMC) Programmable Clock Prescaler +AT91C_PMC_PRES_CLK EQU (0x0 << 2) ;- (PMC) Selected clock +AT91C_PMC_PRES_CLK_2 EQU (0x1 << 2) ;- (PMC) Selected clock divided by 2 +AT91C_PMC_PRES_CLK_4 EQU (0x2 << 2) ;- (PMC) Selected clock divided by 4 +AT91C_PMC_PRES_CLK_8 EQU (0x3 << 2) ;- (PMC) Selected clock divided by 8 +AT91C_PMC_PRES_CLK_16 EQU (0x4 << 2) ;- (PMC) Selected clock divided by 16 +AT91C_PMC_PRES_CLK_32 EQU (0x5 << 2) ;- (PMC) Selected clock divided by 32 +AT91C_PMC_PRES_CLK_64 EQU (0x6 << 2) ;- (PMC) Selected clock divided by 64 +// - -------- PMC_PCKR : (PMC Offset: 0x40) Programmable Clock Register -------- +// - -------- PMC_IER : (PMC Offset: 0x60) PMC Interrupt Enable Register -------- +AT91C_PMC_MOSCS EQU (0x1 << 0) ;- (PMC) MOSC Status/Enable/Disable/Mask +AT91C_PMC_LOCK EQU (0x1 << 2) ;- (PMC) PLL Status/Enable/Disable/Mask +AT91C_PMC_MCKRDY EQU (0x1 << 3) ;- (PMC) MCK_RDY Status/Enable/Disable/Mask +AT91C_PMC_PCK0RDY EQU (0x1 << 8) ;- (PMC) PCK0_RDY Status/Enable/Disable/Mask +AT91C_PMC_PCK1RDY EQU (0x1 << 9) ;- (PMC) PCK1_RDY Status/Enable/Disable/Mask +AT91C_PMC_PCK2RDY EQU (0x1 << 10) ;- (PMC) PCK2_RDY Status/Enable/Disable/Mask +AT91C_PMC_PCK3RDY EQU (0x1 << 11) ;- (PMC) PCK3_RDY Status/Enable/Disable/Mask +// - -------- PMC_IDR : (PMC Offset: 0x64) PMC Interrupt Disable Register -------- +// - -------- PMC_SR : (PMC Offset: 0x68) PMC Status Register -------- +// - -------- PMC_IMR : (PMC Offset: 0x6c) PMC Interrupt Mask Register -------- + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Reset Controller Interface +// - ***************************************************************************** +// - -------- RSTC_RCR : (RSTC Offset: 0x0) Reset Control Register -------- +AT91C_RSTC_PROCRST EQU (0x1 << 0) ;- (RSTC) Processor Reset +AT91C_RSTC_PERRST EQU (0x1 << 2) ;- (RSTC) Peripheral Reset +AT91C_RSTC_EXTRST EQU (0x1 << 3) ;- (RSTC) External Reset +AT91C_RSTC_KEY EQU (0xFF << 24) ;- (RSTC) Password +// - -------- RSTC_RSR : (RSTC Offset: 0x4) Reset Status Register -------- +AT91C_RSTC_URSTS EQU (0x1 << 0) ;- (RSTC) User Reset Status +AT91C_RSTC_BODSTS EQU (0x1 << 1) ;- (RSTC) Brownout Detection Status +AT91C_RSTC_RSTTYP EQU (0x7 << 8) ;- (RSTC) Reset Type +AT91C_RSTC_RSTTYP_POWERUP EQU (0x0 << 8) ;- (RSTC) Power-up Reset. VDDCORE rising. +AT91C_RSTC_RSTTYP_WAKEUP EQU (0x1 << 8) ;- (RSTC) WakeUp Reset. VDDCORE rising. +AT91C_RSTC_RSTTYP_WATCHDOG EQU (0x2 << 8) ;- (RSTC) Watchdog Reset. Watchdog overflow occured. +AT91C_RSTC_RSTTYP_SOFTWARE EQU (0x3 << 8) ;- (RSTC) Software Reset. Processor reset required by the software. +AT91C_RSTC_RSTTYP_USER EQU (0x4 << 8) ;- (RSTC) User Reset. NRST pin detected low. +AT91C_RSTC_RSTTYP_BROWNOUT EQU (0x5 << 8) ;- (RSTC) Brownout Reset occured. +AT91C_RSTC_NRSTL EQU (0x1 << 16) ;- (RSTC) NRST pin level +AT91C_RSTC_SRCMP EQU (0x1 << 17) ;- (RSTC) Software Reset Command in Progress. +// - -------- RSTC_RMR : (RSTC Offset: 0x8) Reset Mode Register -------- +AT91C_RSTC_URSTEN EQU (0x1 << 0) ;- (RSTC) User Reset Enable +AT91C_RSTC_URSTIEN EQU (0x1 << 4) ;- (RSTC) User Reset Interrupt Enable +AT91C_RSTC_ERSTL EQU (0xF << 8) ;- (RSTC) User Reset Length +AT91C_RSTC_BODIEN EQU (0x1 << 16) ;- (RSTC) Brownout Detection Interrupt Enable + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Real Time Timer Controller Interface +// - ***************************************************************************** +// - -------- RTTC_RTMR : (RTTC Offset: 0x0) Real-time Mode Register -------- +AT91C_RTTC_RTPRES EQU (0xFFFF << 0) ;- (RTTC) Real-time Timer Prescaler Value +AT91C_RTTC_ALMIEN EQU (0x1 << 16) ;- (RTTC) Alarm Interrupt Enable +AT91C_RTTC_RTTINCIEN EQU (0x1 << 17) ;- (RTTC) Real Time Timer Increment Interrupt Enable +AT91C_RTTC_RTTRST EQU (0x1 << 18) ;- (RTTC) Real Time Timer Restart +// - -------- RTTC_RTAR : (RTTC Offset: 0x4) Real-time Alarm Register -------- +AT91C_RTTC_ALMV EQU (0x0 << 0) ;- (RTTC) Alarm Value +// - -------- RTTC_RTVR : (RTTC Offset: 0x8) Current Real-time Value Register -------- +AT91C_RTTC_CRTV EQU (0x0 << 0) ;- (RTTC) Current Real-time Value +// - -------- RTTC_RTSR : (RTTC Offset: 0xc) Real-time Status Register -------- +AT91C_RTTC_ALMS EQU (0x1 << 0) ;- (RTTC) Real-time Alarm Status +AT91C_RTTC_RTTINC EQU (0x1 << 1) ;- (RTTC) Real-time Timer Increment + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Periodic Interval Timer Controller Interface +// - ***************************************************************************** +// - -------- PITC_PIMR : (PITC Offset: 0x0) Periodic Interval Mode Register -------- +AT91C_PITC_PIV EQU (0xFFFFF << 0) ;- (PITC) Periodic Interval Value +AT91C_PITC_PITEN EQU (0x1 << 24) ;- (PITC) Periodic Interval Timer Enabled +AT91C_PITC_PITIEN EQU (0x1 << 25) ;- (PITC) Periodic Interval Timer Interrupt Enable +// - -------- PITC_PISR : (PITC Offset: 0x4) Periodic Interval Status Register -------- +AT91C_PITC_PITS EQU (0x1 << 0) ;- (PITC) Periodic Interval Timer Status +// - -------- PITC_PIVR : (PITC Offset: 0x8) Periodic Interval Value Register -------- +AT91C_PITC_CPIV EQU (0xFFFFF << 0) ;- (PITC) Current Periodic Interval Value +AT91C_PITC_PICNT EQU (0xFFF << 20) ;- (PITC) Periodic Interval Counter +// - -------- PITC_PIIR : (PITC Offset: 0xc) Periodic Interval Image Register -------- + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Watchdog Timer Controller Interface +// - ***************************************************************************** +// - -------- WDTC_WDCR : (WDTC Offset: 0x0) Periodic Interval Image Register -------- +AT91C_WDTC_WDRSTT EQU (0x1 << 0) ;- (WDTC) Watchdog Restart +AT91C_WDTC_KEY EQU (0xFF << 24) ;- (WDTC) Watchdog KEY Password +// - -------- WDTC_WDMR : (WDTC Offset: 0x4) Watchdog Mode Register -------- +AT91C_WDTC_WDV EQU (0xFFF << 0) ;- (WDTC) Watchdog Timer Restart +AT91C_WDTC_WDFIEN EQU (0x1 << 12) ;- (WDTC) Watchdog Fault Interrupt Enable +AT91C_WDTC_WDRSTEN EQU (0x1 << 13) ;- (WDTC) Watchdog Reset Enable +AT91C_WDTC_WDRPROC EQU (0x1 << 14) ;- (WDTC) Watchdog Timer Restart +AT91C_WDTC_WDDIS EQU (0x1 << 15) ;- (WDTC) Watchdog Disable +AT91C_WDTC_WDD EQU (0xFFF << 16) ;- (WDTC) Watchdog Delta Value +AT91C_WDTC_WDDBGHLT EQU (0x1 << 28) ;- (WDTC) Watchdog Debug Halt +AT91C_WDTC_WDIDLEHLT EQU (0x1 << 29) ;- (WDTC) Watchdog Idle Halt +// - -------- WDTC_WDSR : (WDTC Offset: 0x8) Watchdog Status Register -------- +AT91C_WDTC_WDUNF EQU (0x1 << 0) ;- (WDTC) Watchdog Underflow +AT91C_WDTC_WDERR EQU (0x1 << 1) ;- (WDTC) Watchdog Error + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Voltage Regulator Mode Controller Interface +// - ***************************************************************************** +// - -------- VREG_MR : (VREG Offset: 0x0) Voltage Regulator Mode Register -------- +AT91C_VREG_PSTDBY EQU (0x1 << 0) ;- (VREG) Voltage Regulator Power Standby Mode + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Memory Controller Interface +// - ***************************************************************************** +// - -------- MC_RCR : (MC Offset: 0x0) MC Remap Control Register -------- +AT91C_MC_RCB EQU (0x1 << 0) ;- (MC) Remap Command Bit +// - -------- MC_ASR : (MC Offset: 0x4) MC Abort Status Register -------- +AT91C_MC_UNDADD EQU (0x1 << 0) ;- (MC) Undefined Addess Abort Status +AT91C_MC_MISADD EQU (0x1 << 1) ;- (MC) Misaligned Addess Abort Status +AT91C_MC_ABTSZ EQU (0x3 << 8) ;- (MC) Abort Size Status +AT91C_MC_ABTSZ_BYTE EQU (0x0 << 8) ;- (MC) Byte +AT91C_MC_ABTSZ_HWORD EQU (0x1 << 8) ;- (MC) Half-word +AT91C_MC_ABTSZ_WORD EQU (0x2 << 8) ;- (MC) Word +AT91C_MC_ABTTYP EQU (0x3 << 10) ;- (MC) Abort Type Status +AT91C_MC_ABTTYP_DATAR EQU (0x0 << 10) ;- (MC) Data Read +AT91C_MC_ABTTYP_DATAW EQU (0x1 << 10) ;- (MC) Data Write +AT91C_MC_ABTTYP_FETCH EQU (0x2 << 10) ;- (MC) Code Fetch +AT91C_MC_MST0 EQU (0x1 << 16) ;- (MC) Master 0 Abort Source +AT91C_MC_MST1 EQU (0x1 << 17) ;- (MC) Master 1 Abort Source +AT91C_MC_SVMST0 EQU (0x1 << 24) ;- (MC) Saved Master 0 Abort Source +AT91C_MC_SVMST1 EQU (0x1 << 25) ;- (MC) Saved Master 1 Abort Source +// - -------- MC_FMR : (MC Offset: 0x60) MC Flash Mode Register -------- +AT91C_MC_FRDY EQU (0x1 << 0) ;- (MC) Flash Ready +AT91C_MC_LOCKE EQU (0x1 << 2) ;- (MC) Lock Error +AT91C_MC_PROGE EQU (0x1 << 3) ;- (MC) Programming Error +AT91C_MC_NEBP EQU (0x1 << 7) ;- (MC) No Erase Before Programming +AT91C_MC_FWS EQU (0x3 << 8) ;- (MC) Flash Wait State +AT91C_MC_FWS_0FWS EQU (0x0 << 8) ;- (MC) 1 cycle for Read, 2 for Write operations +AT91C_MC_FWS_1FWS EQU (0x1 << 8) ;- (MC) 2 cycles for Read, 3 for Write operations +AT91C_MC_FWS_2FWS EQU (0x2 << 8) ;- (MC) 3 cycles for Read, 4 for Write operations +AT91C_MC_FWS_3FWS EQU (0x3 << 8) ;- (MC) 4 cycles for Read, 4 for Write operations +AT91C_MC_FMCN EQU (0xFF << 16) ;- (MC) Flash Microsecond Cycle Number +// - -------- MC_FCR : (MC Offset: 0x64) MC Flash Command Register -------- +AT91C_MC_FCMD EQU (0xF << 0) ;- (MC) Flash Command +AT91C_MC_FCMD_START_PROG EQU (0x1) ;- (MC) Starts the programming of th epage specified by PAGEN. +AT91C_MC_FCMD_LOCK EQU (0x2) ;- (MC) Starts a lock sequence of the sector defined by the bits 4 to 7 of the field PAGEN. +AT91C_MC_FCMD_PROG_AND_LOCK EQU (0x3) ;- (MC) The lock sequence automatically happens after the programming sequence is completed. +AT91C_MC_FCMD_UNLOCK EQU (0x4) ;- (MC) Starts an unlock sequence of the sector defined by the bits 4 to 7 of the field PAGEN. +AT91C_MC_FCMD_ERASE_ALL EQU (0x8) ;- (MC) Starts the erase of the entire flash.If at least a page is locked, the command is cancelled. +AT91C_MC_FCMD_SET_GP_NVM EQU (0xB) ;- (MC) Set General Purpose NVM bits. +AT91C_MC_FCMD_CLR_GP_NVM EQU (0xD) ;- (MC) Clear General Purpose NVM bits. +AT91C_MC_FCMD_SET_SECURITY EQU (0xF) ;- (MC) Set Security Bit. +AT91C_MC_PAGEN EQU (0x3FF << 8) ;- (MC) Page Number +AT91C_MC_KEY EQU (0xFF << 24) ;- (MC) Writing Protect Key +// - -------- MC_FSR : (MC Offset: 0x68) MC Flash Command Register -------- +AT91C_MC_SECURITY EQU (0x1 << 4) ;- (MC) Security Bit Status +AT91C_MC_GPNVM0 EQU (0x1 << 8) ;- (MC) Sector 0 Lock Status +AT91C_MC_GPNVM1 EQU (0x1 << 9) ;- (MC) Sector 1 Lock Status +AT91C_MC_GPNVM2 EQU (0x1 << 10) ;- (MC) Sector 2 Lock Status +AT91C_MC_GPNVM3 EQU (0x1 << 11) ;- (MC) Sector 3 Lock Status +AT91C_MC_GPNVM4 EQU (0x1 << 12) ;- (MC) Sector 4 Lock Status +AT91C_MC_GPNVM5 EQU (0x1 << 13) ;- (MC) Sector 5 Lock Status +AT91C_MC_GPNVM6 EQU (0x1 << 14) ;- (MC) Sector 6 Lock Status +AT91C_MC_GPNVM7 EQU (0x1 << 15) ;- (MC) Sector 7 Lock Status +AT91C_MC_LOCKS0 EQU (0x1 << 16) ;- (MC) Sector 0 Lock Status +AT91C_MC_LOCKS1 EQU (0x1 << 17) ;- (MC) Sector 1 Lock Status +AT91C_MC_LOCKS2 EQU (0x1 << 18) ;- (MC) Sector 2 Lock Status +AT91C_MC_LOCKS3 EQU (0x1 << 19) ;- (MC) Sector 3 Lock Status +AT91C_MC_LOCKS4 EQU (0x1 << 20) ;- (MC) Sector 4 Lock Status +AT91C_MC_LOCKS5 EQU (0x1 << 21) ;- (MC) Sector 5 Lock Status +AT91C_MC_LOCKS6 EQU (0x1 << 22) ;- (MC) Sector 6 Lock Status +AT91C_MC_LOCKS7 EQU (0x1 << 23) ;- (MC) Sector 7 Lock Status +AT91C_MC_LOCKS8 EQU (0x1 << 24) ;- (MC) Sector 8 Lock Status +AT91C_MC_LOCKS9 EQU (0x1 << 25) ;- (MC) Sector 9 Lock Status +AT91C_MC_LOCKS10 EQU (0x1 << 26) ;- (MC) Sector 10 Lock Status +AT91C_MC_LOCKS11 EQU (0x1 << 27) ;- (MC) Sector 11 Lock Status +AT91C_MC_LOCKS12 EQU (0x1 << 28) ;- (MC) Sector 12 Lock Status +AT91C_MC_LOCKS13 EQU (0x1 << 29) ;- (MC) Sector 13 Lock Status +AT91C_MC_LOCKS14 EQU (0x1 << 30) ;- (MC) Sector 14 Lock Status +AT91C_MC_LOCKS15 EQU (0x1 << 31) ;- (MC) Sector 15 Lock Status + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Serial Parallel Interface +// - ***************************************************************************** +// - -------- SPI_CR : (SPI Offset: 0x0) SPI Control Register -------- +AT91C_SPI_SPIEN EQU (0x1 << 0) ;- (SPI) SPI Enable +AT91C_SPI_SPIDIS EQU (0x1 << 1) ;- (SPI) SPI Disable +AT91C_SPI_SWRST EQU (0x1 << 7) ;- (SPI) SPI Software reset +AT91C_SPI_LASTXFER EQU (0x1 << 24) ;- (SPI) SPI Last Transfer +// - -------- SPI_MR : (SPI Offset: 0x4) SPI Mode Register -------- +AT91C_SPI_MSTR EQU (0x1 << 0) ;- (SPI) Master/Slave Mode +AT91C_SPI_PS EQU (0x1 << 1) ;- (SPI) Peripheral Select +AT91C_SPI_PS_FIXED EQU (0x0 << 1) ;- (SPI) Fixed Peripheral Select +AT91C_SPI_PS_VARIABLE EQU (0x1 << 1) ;- (SPI) Variable Peripheral Select +AT91C_SPI_PCSDEC EQU (0x1 << 2) ;- (SPI) Chip Select Decode +AT91C_SPI_FDIV EQU (0x1 << 3) ;- (SPI) Clock Selection +AT91C_SPI_MODFDIS EQU (0x1 << 4) ;- (SPI) Mode Fault Detection +AT91C_SPI_LLB EQU (0x1 << 7) ;- (SPI) Clock Selection +AT91C_SPI_PCS EQU (0xF << 16) ;- (SPI) Peripheral Chip Select +AT91C_SPI_DLYBCS EQU (0xFF << 24) ;- (SPI) Delay Between Chip Selects +// - -------- SPI_RDR : (SPI Offset: 0x8) Receive Data Register -------- +AT91C_SPI_RD EQU (0xFFFF << 0) ;- (SPI) Receive Data +AT91C_SPI_RPCS EQU (0xF << 16) ;- (SPI) Peripheral Chip Select Status +// - -------- SPI_TDR : (SPI Offset: 0xc) Transmit Data Register -------- +AT91C_SPI_TD EQU (0xFFFF << 0) ;- (SPI) Transmit Data +AT91C_SPI_TPCS EQU (0xF << 16) ;- (SPI) Peripheral Chip Select Status +// - -------- SPI_SR : (SPI Offset: 0x10) Status Register -------- +AT91C_SPI_RDRF EQU (0x1 << 0) ;- (SPI) Receive Data Register Full +AT91C_SPI_TDRE EQU (0x1 << 1) ;- (SPI) Transmit Data Register Empty +AT91C_SPI_MODF EQU (0x1 << 2) ;- (SPI) Mode Fault Error +AT91C_SPI_OVRES EQU (0x1 << 3) ;- (SPI) Overrun Error Status +AT91C_SPI_ENDRX EQU (0x1 << 4) ;- (SPI) End of Receiver Transfer +AT91C_SPI_ENDTX EQU (0x1 << 5) ;- (SPI) End of Receiver Transfer +AT91C_SPI_RXBUFF EQU (0x1 << 6) ;- (SPI) RXBUFF Interrupt +AT91C_SPI_TXBUFE EQU (0x1 << 7) ;- (SPI) TXBUFE Interrupt +AT91C_SPI_NSSR EQU (0x1 << 8) ;- (SPI) NSSR Interrupt +AT91C_SPI_TXEMPTY EQU (0x1 << 9) ;- (SPI) TXEMPTY Interrupt +AT91C_SPI_SPIENS EQU (0x1 << 16) ;- (SPI) Enable Status +// - -------- SPI_IER : (SPI Offset: 0x14) Interrupt Enable Register -------- +// - -------- SPI_IDR : (SPI Offset: 0x18) Interrupt Disable Register -------- +// - -------- SPI_IMR : (SPI Offset: 0x1c) Interrupt Mask Register -------- +// - -------- SPI_CSR : (SPI Offset: 0x30) Chip Select Register -------- +AT91C_SPI_CPOL EQU (0x1 << 0) ;- (SPI) Clock Polarity +AT91C_SPI_NCPHA EQU (0x1 << 1) ;- (SPI) Clock Phase +AT91C_SPI_CSAAT EQU (0x1 << 3) ;- (SPI) Chip Select Active After Transfer +AT91C_SPI_BITS EQU (0xF << 4) ;- (SPI) Bits Per Transfer +AT91C_SPI_BITS_8 EQU (0x0 << 4) ;- (SPI) 8 Bits Per transfer +AT91C_SPI_BITS_9 EQU (0x1 << 4) ;- (SPI) 9 Bits Per transfer +AT91C_SPI_BITS_10 EQU (0x2 << 4) ;- (SPI) 10 Bits Per transfer +AT91C_SPI_BITS_11 EQU (0x3 << 4) ;- (SPI) 11 Bits Per transfer +AT91C_SPI_BITS_12 EQU (0x4 << 4) ;- (SPI) 12 Bits Per transfer +AT91C_SPI_BITS_13 EQU (0x5 << 4) ;- (SPI) 13 Bits Per transfer +AT91C_SPI_BITS_14 EQU (0x6 << 4) ;- (SPI) 14 Bits Per transfer +AT91C_SPI_BITS_15 EQU (0x7 << 4) ;- (SPI) 15 Bits Per transfer +AT91C_SPI_BITS_16 EQU (0x8 << 4) ;- (SPI) 16 Bits Per transfer +AT91C_SPI_SCBR EQU (0xFF << 8) ;- (SPI) Serial Clock Baud Rate +AT91C_SPI_DLYBS EQU (0xFF << 16) ;- (SPI) Delay Before SPCK +AT91C_SPI_DLYBCT EQU (0xFF << 24) ;- (SPI) Delay Between Consecutive Transfers + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Usart +// - ***************************************************************************** +// - -------- US_CR : (USART Offset: 0x0) Debug Unit Control Register -------- +AT91C_US_STTBRK EQU (0x1 << 9) ;- (USART) Start Break +AT91C_US_STPBRK EQU (0x1 << 10) ;- (USART) Stop Break +AT91C_US_STTTO EQU (0x1 << 11) ;- (USART) Start Time-out +AT91C_US_SENDA EQU (0x1 << 12) ;- (USART) Send Address +AT91C_US_RSTIT EQU (0x1 << 13) ;- (USART) Reset Iterations +AT91C_US_RSTNACK EQU (0x1 << 14) ;- (USART) Reset Non Acknowledge +AT91C_US_RETTO EQU (0x1 << 15) ;- (USART) Rearm Time-out +AT91C_US_DTREN EQU (0x1 << 16) ;- (USART) Data Terminal ready Enable +AT91C_US_DTRDIS EQU (0x1 << 17) ;- (USART) Data Terminal ready Disable +AT91C_US_RTSEN EQU (0x1 << 18) ;- (USART) Request to Send enable +AT91C_US_RTSDIS EQU (0x1 << 19) ;- (USART) Request to Send Disable +// - -------- US_MR : (USART Offset: 0x4) Debug Unit Mode Register -------- +AT91C_US_USMODE EQU (0xF << 0) ;- (USART) Usart mode +AT91C_US_USMODE_NORMAL EQU (0x0) ;- (USART) Normal +AT91C_US_USMODE_RS485 EQU (0x1) ;- (USART) RS485 +AT91C_US_USMODE_HWHSH EQU (0x2) ;- (USART) Hardware Handshaking +AT91C_US_USMODE_MODEM EQU (0x3) ;- (USART) Modem +AT91C_US_USMODE_ISO7816_0 EQU (0x4) ;- (USART) ISO7816 protocol: T = 0 +AT91C_US_USMODE_ISO7816_1 EQU (0x6) ;- (USART) ISO7816 protocol: T = 1 +AT91C_US_USMODE_IRDA EQU (0x8) ;- (USART) IrDA +AT91C_US_USMODE_SWHSH EQU (0xC) ;- (USART) Software Handshaking +AT91C_US_CLKS EQU (0x3 << 4) ;- (USART) Clock Selection (Baud Rate generator Input Clock +AT91C_US_CLKS_CLOCK EQU (0x0 << 4) ;- (USART) Clock +AT91C_US_CLKS_FDIV1 EQU (0x1 << 4) ;- (USART) fdiv1 +AT91C_US_CLKS_SLOW EQU (0x2 << 4) ;- (USART) slow_clock (ARM) +AT91C_US_CLKS_EXT EQU (0x3 << 4) ;- (USART) External (SCK) +AT91C_US_CHRL EQU (0x3 << 6) ;- (USART) Clock Selection (Baud Rate generator Input Clock +AT91C_US_CHRL_5_BITS EQU (0x0 << 6) ;- (USART) Character Length: 5 bits +AT91C_US_CHRL_6_BITS EQU (0x1 << 6) ;- (USART) Character Length: 6 bits +AT91C_US_CHRL_7_BITS EQU (0x2 << 6) ;- (USART) Character Length: 7 bits +AT91C_US_CHRL_8_BITS EQU (0x3 << 6) ;- (USART) Character Length: 8 bits +AT91C_US_SYNC EQU (0x1 << 8) ;- (USART) Synchronous Mode Select +AT91C_US_NBSTOP EQU (0x3 << 12) ;- (USART) Number of Stop bits +AT91C_US_NBSTOP_1_BIT EQU (0x0 << 12) ;- (USART) 1 stop bit +AT91C_US_NBSTOP_15_BIT EQU (0x1 << 12) ;- (USART) Asynchronous (SYNC=0) 2 stop bits Synchronous (SYNC=1) 2 stop bits +AT91C_US_NBSTOP_2_BIT EQU (0x2 << 12) ;- (USART) 2 stop bits +AT91C_US_MSBF EQU (0x1 << 16) ;- (USART) Bit Order +AT91C_US_MODE9 EQU (0x1 << 17) ;- (USART) 9-bit Character length +AT91C_US_CKLO EQU (0x1 << 18) ;- (USART) Clock Output Select +AT91C_US_OVER EQU (0x1 << 19) ;- (USART) Over Sampling Mode +AT91C_US_INACK EQU (0x1 << 20) ;- (USART) Inhibit Non Acknowledge +AT91C_US_DSNACK EQU (0x1 << 21) ;- (USART) Disable Successive NACK +AT91C_US_MAX_ITER EQU (0x1 << 24) ;- (USART) Number of Repetitions +AT91C_US_FILTER EQU (0x1 << 28) ;- (USART) Receive Line Filter +// - -------- US_IER : (USART Offset: 0x8) Debug Unit Interrupt Enable Register -------- +AT91C_US_RXBRK EQU (0x1 << 2) ;- (USART) Break Received/End of Break +AT91C_US_TIMEOUT EQU (0x1 << 8) ;- (USART) Receiver Time-out +AT91C_US_ITERATION EQU (0x1 << 10) ;- (USART) Max number of Repetitions Reached +AT91C_US_NACK EQU (0x1 << 13) ;- (USART) Non Acknowledge +AT91C_US_RIIC EQU (0x1 << 16) ;- (USART) Ring INdicator Input Change Flag +AT91C_US_DSRIC EQU (0x1 << 17) ;- (USART) Data Set Ready Input Change Flag +AT91C_US_DCDIC EQU (0x1 << 18) ;- (USART) Data Carrier Flag +AT91C_US_CTSIC EQU (0x1 << 19) ;- (USART) Clear To Send Input Change Flag +// - -------- US_IDR : (USART Offset: 0xc) Debug Unit Interrupt Disable Register -------- +// - -------- US_IMR : (USART Offset: 0x10) Debug Unit Interrupt Mask Register -------- +// - -------- US_CSR : (USART Offset: 0x14) Debug Unit Channel Status Register -------- +AT91C_US_RI EQU (0x1 << 20) ;- (USART) Image of RI Input +AT91C_US_DSR EQU (0x1 << 21) ;- (USART) Image of DSR Input +AT91C_US_DCD EQU (0x1 << 22) ;- (USART) Image of DCD Input +AT91C_US_CTS EQU (0x1 << 23) ;- (USART) Image of CTS Input + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Synchronous Serial Controller Interface +// - ***************************************************************************** +// - -------- SSC_CR : (SSC Offset: 0x0) SSC Control Register -------- +AT91C_SSC_RXEN EQU (0x1 << 0) ;- (SSC) Receive Enable +AT91C_SSC_RXDIS EQU (0x1 << 1) ;- (SSC) Receive Disable +AT91C_SSC_TXEN EQU (0x1 << 8) ;- (SSC) Transmit Enable +AT91C_SSC_TXDIS EQU (0x1 << 9) ;- (SSC) Transmit Disable +AT91C_SSC_SWRST EQU (0x1 << 15) ;- (SSC) Software Reset +// - -------- SSC_RCMR : (SSC Offset: 0x10) SSC Receive Clock Mode Register -------- +AT91C_SSC_CKS EQU (0x3 << 0) ;- (SSC) Receive/Transmit Clock Selection +AT91C_SSC_CKS_DIV EQU (0x0) ;- (SSC) Divided Clock +AT91C_SSC_CKS_TK EQU (0x1) ;- (SSC) TK Clock signal +AT91C_SSC_CKS_RK EQU (0x2) ;- (SSC) RK pin +AT91C_SSC_CKO EQU (0x7 << 2) ;- (SSC) Receive/Transmit Clock Output Mode Selection +AT91C_SSC_CKO_NONE EQU (0x0 << 2) ;- (SSC) Receive/Transmit Clock Output Mode: None RK pin: Input-only +AT91C_SSC_CKO_CONTINOUS EQU (0x1 << 2) ;- (SSC) Continuous Receive/Transmit Clock RK pin: Output +AT91C_SSC_CKO_DATA_TX EQU (0x2 << 2) ;- (SSC) Receive/Transmit Clock only during data transfers RK pin: Output +AT91C_SSC_CKI EQU (0x1 << 5) ;- (SSC) Receive/Transmit Clock Inversion +AT91C_SSC_CKG EQU (0x3 << 6) ;- (SSC) Receive/Transmit Clock Gating Selection +AT91C_SSC_CKG_NONE EQU (0x0 << 6) ;- (SSC) Receive/Transmit Clock Gating: None, continuous clock +AT91C_SSC_CKG_LOW EQU (0x1 << 6) ;- (SSC) Receive/Transmit Clock enabled only if RF Low +AT91C_SSC_CKG_HIGH EQU (0x2 << 6) ;- (SSC) Receive/Transmit Clock enabled only if RF High +AT91C_SSC_START EQU (0xF << 8) ;- (SSC) Receive/Transmit Start Selection +AT91C_SSC_START_CONTINOUS EQU (0x0 << 8) ;- (SSC) Continuous, as soon as the receiver is enabled, and immediately after the end of transfer of the previous data. +AT91C_SSC_START_TX EQU (0x1 << 8) ;- (SSC) Transmit/Receive start +AT91C_SSC_START_LOW_RF EQU (0x2 << 8) ;- (SSC) Detection of a low level on RF input +AT91C_SSC_START_HIGH_RF EQU (0x3 << 8) ;- (SSC) Detection of a high level on RF input +AT91C_SSC_START_FALL_RF EQU (0x4 << 8) ;- (SSC) Detection of a falling edge on RF input +AT91C_SSC_START_RISE_RF EQU (0x5 << 8) ;- (SSC) Detection of a rising edge on RF input +AT91C_SSC_START_LEVEL_RF EQU (0x6 << 8) ;- (SSC) Detection of any level change on RF input +AT91C_SSC_START_EDGE_RF EQU (0x7 << 8) ;- (SSC) Detection of any edge on RF input +AT91C_SSC_START_0 EQU (0x8 << 8) ;- (SSC) Compare 0 +AT91C_SSC_STOP EQU (0x1 << 12) ;- (SSC) Receive Stop Selection +AT91C_SSC_STTDLY EQU (0xFF << 16) ;- (SSC) Receive/Transmit Start Delay +AT91C_SSC_PERIOD EQU (0xFF << 24) ;- (SSC) Receive/Transmit Period Divider Selection +// - -------- SSC_RFMR : (SSC Offset: 0x14) SSC Receive Frame Mode Register -------- +AT91C_SSC_DATLEN EQU (0x1F << 0) ;- (SSC) Data Length +AT91C_SSC_LOOP EQU (0x1 << 5) ;- (SSC) Loop Mode +AT91C_SSC_MSBF EQU (0x1 << 7) ;- (SSC) Most Significant Bit First +AT91C_SSC_DATNB EQU (0xF << 8) ;- (SSC) Data Number per Frame +AT91C_SSC_FSLEN EQU (0xF << 16) ;- (SSC) Receive/Transmit Frame Sync length +AT91C_SSC_FSOS EQU (0x7 << 20) ;- (SSC) Receive/Transmit Frame Sync Output Selection +AT91C_SSC_FSOS_NONE EQU (0x0 << 20) ;- (SSC) Selected Receive/Transmit Frame Sync Signal: None RK pin Input-only +AT91C_SSC_FSOS_NEGATIVE EQU (0x1 << 20) ;- (SSC) Selected Receive/Transmit Frame Sync Signal: Negative Pulse +AT91C_SSC_FSOS_POSITIVE EQU (0x2 << 20) ;- (SSC) Selected Receive/Transmit Frame Sync Signal: Positive Pulse +AT91C_SSC_FSOS_LOW EQU (0x3 << 20) ;- (SSC) Selected Receive/Transmit Frame Sync Signal: Driver Low during data transfer +AT91C_SSC_FSOS_HIGH EQU (0x4 << 20) ;- (SSC) Selected Receive/Transmit Frame Sync Signal: Driver High during data transfer +AT91C_SSC_FSOS_TOGGLE EQU (0x5 << 20) ;- (SSC) Selected Receive/Transmit Frame Sync Signal: Toggling at each start of data transfer +AT91C_SSC_FSEDGE EQU (0x1 << 24) ;- (SSC) Frame Sync Edge Detection +// - -------- SSC_TCMR : (SSC Offset: 0x18) SSC Transmit Clock Mode Register -------- +// - -------- SSC_TFMR : (SSC Offset: 0x1c) SSC Transmit Frame Mode Register -------- +AT91C_SSC_DATDEF EQU (0x1 << 5) ;- (SSC) Data Default Value +AT91C_SSC_FSDEN EQU (0x1 << 23) ;- (SSC) Frame Sync Data Enable +// - -------- SSC_SR : (SSC Offset: 0x40) SSC Status Register -------- +AT91C_SSC_TXRDY EQU (0x1 << 0) ;- (SSC) Transmit Ready +AT91C_SSC_TXEMPTY EQU (0x1 << 1) ;- (SSC) Transmit Empty +AT91C_SSC_ENDTX EQU (0x1 << 2) ;- (SSC) End Of Transmission +AT91C_SSC_TXBUFE EQU (0x1 << 3) ;- (SSC) Transmit Buffer Empty +AT91C_SSC_RXRDY EQU (0x1 << 4) ;- (SSC) Receive Ready +AT91C_SSC_OVRUN EQU (0x1 << 5) ;- (SSC) Receive Overrun +AT91C_SSC_ENDRX EQU (0x1 << 6) ;- (SSC) End of Reception +AT91C_SSC_RXBUFF EQU (0x1 << 7) ;- (SSC) Receive Buffer Full +AT91C_SSC_CP0 EQU (0x1 << 8) ;- (SSC) Compare 0 +AT91C_SSC_CP1 EQU (0x1 << 9) ;- (SSC) Compare 1 +AT91C_SSC_TXSYN EQU (0x1 << 10) ;- (SSC) Transmit Sync +AT91C_SSC_RXSYN EQU (0x1 << 11) ;- (SSC) Receive Sync +AT91C_SSC_TXENA EQU (0x1 << 16) ;- (SSC) Transmit Enable +AT91C_SSC_RXENA EQU (0x1 << 17) ;- (SSC) Receive Enable +// - -------- SSC_IER : (SSC Offset: 0x44) SSC Interrupt Enable Register -------- +// - -------- SSC_IDR : (SSC Offset: 0x48) SSC Interrupt Disable Register -------- +// - -------- SSC_IMR : (SSC Offset: 0x4c) SSC Interrupt Mask Register -------- + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Two-wire Interface +// - ***************************************************************************** +// - -------- TWI_CR : (TWI Offset: 0x0) TWI Control Register -------- +AT91C_TWI_START EQU (0x1 << 0) ;- (TWI) Send a START Condition +AT91C_TWI_STOP EQU (0x1 << 1) ;- (TWI) Send a STOP Condition +AT91C_TWI_MSEN EQU (0x1 << 2) ;- (TWI) TWI Master Transfer Enabled +AT91C_TWI_MSDIS EQU (0x1 << 3) ;- (TWI) TWI Master Transfer Disabled +AT91C_TWI_SWRST EQU (0x1 << 7) ;- (TWI) Software Reset +// - -------- TWI_MMR : (TWI Offset: 0x4) TWI Master Mode Register -------- +AT91C_TWI_IADRSZ EQU (0x3 << 8) ;- (TWI) Internal Device Address Size +AT91C_TWI_IADRSZ_NO EQU (0x0 << 8) ;- (TWI) No internal device address +AT91C_TWI_IADRSZ_1_BYTE EQU (0x1 << 8) ;- (TWI) One-byte internal device address +AT91C_TWI_IADRSZ_2_BYTE EQU (0x2 << 8) ;- (TWI) Two-byte internal device address +AT91C_TWI_IADRSZ_3_BYTE EQU (0x3 << 8) ;- (TWI) Three-byte internal device address +AT91C_TWI_MREAD EQU (0x1 << 12) ;- (TWI) Master Read Direction +AT91C_TWI_DADR EQU (0x7F << 16) ;- (TWI) Device Address +// - -------- TWI_CWGR : (TWI Offset: 0x10) TWI Clock Waveform Generator Register -------- +AT91C_TWI_CLDIV EQU (0xFF << 0) ;- (TWI) Clock Low Divider +AT91C_TWI_CHDIV EQU (0xFF << 8) ;- (TWI) Clock High Divider +AT91C_TWI_CKDIV EQU (0x7 << 16) ;- (TWI) Clock Divider +// - -------- TWI_SR : (TWI Offset: 0x20) TWI Status Register -------- +AT91C_TWI_TXCOMP EQU (0x1 << 0) ;- (TWI) Transmission Completed +AT91C_TWI_RXRDY EQU (0x1 << 1) ;- (TWI) Receive holding register ReaDY +AT91C_TWI_TXRDY EQU (0x1 << 2) ;- (TWI) Transmit holding register ReaDY +AT91C_TWI_OVRE EQU (0x1 << 6) ;- (TWI) Overrun Error +AT91C_TWI_UNRE EQU (0x1 << 7) ;- (TWI) Underrun Error +AT91C_TWI_NACK EQU (0x1 << 8) ;- (TWI) Not Acknowledged +// - -------- TWI_IER : (TWI Offset: 0x24) TWI Interrupt Enable Register -------- +// - -------- TWI_IDR : (TWI Offset: 0x28) TWI Interrupt Disable Register -------- +// - -------- TWI_IMR : (TWI Offset: 0x2c) TWI Interrupt Mask Register -------- + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR PWMC Channel Interface +// - ***************************************************************************** +// - -------- PWMC_CMR : (PWMC_CH Offset: 0x0) PWMC Channel Mode Register -------- +AT91C_PWMC_CPRE EQU (0xF << 0) ;- (PWMC_CH) Channel Pre-scaler : PWMC_CLKx +AT91C_PWMC_CPRE_MCK EQU (0x0) ;- (PWMC_CH) +AT91C_PWMC_CPRE_MCKA EQU (0xB) ;- (PWMC_CH) +AT91C_PWMC_CPRE_MCKB EQU (0xC) ;- (PWMC_CH) +AT91C_PWMC_CALG EQU (0x1 << 8) ;- (PWMC_CH) Channel Alignment +AT91C_PWMC_CPOL EQU (0x1 << 9) ;- (PWMC_CH) Channel Polarity +AT91C_PWMC_CPD EQU (0x1 << 10) ;- (PWMC_CH) Channel Update Period +// - -------- PWMC_CDTYR : (PWMC_CH Offset: 0x4) PWMC Channel Duty Cycle Register -------- +AT91C_PWMC_CDTY EQU (0x0 << 0) ;- (PWMC_CH) Channel Duty Cycle +// - -------- PWMC_CPRDR : (PWMC_CH Offset: 0x8) PWMC Channel Period Register -------- +AT91C_PWMC_CPRD EQU (0x0 << 0) ;- (PWMC_CH) Channel Period +// - -------- PWMC_CCNTR : (PWMC_CH Offset: 0xc) PWMC Channel Counter Register -------- +AT91C_PWMC_CCNT EQU (0x0 << 0) ;- (PWMC_CH) Channel Counter +// - -------- PWMC_CUPDR : (PWMC_CH Offset: 0x10) PWMC Channel Update Register -------- +AT91C_PWMC_CUPD EQU (0x0 << 0) ;- (PWMC_CH) Channel Update + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Pulse Width Modulation Controller Interface +// - ***************************************************************************** +// - -------- PWMC_MR : (PWMC Offset: 0x0) PWMC Mode Register -------- +AT91C_PWMC_DIVA EQU (0xFF << 0) ;- (PWMC) CLKA divide factor. +AT91C_PWMC_PREA EQU (0xF << 8) ;- (PWMC) Divider Input Clock Prescaler A +AT91C_PWMC_PREA_MCK EQU (0x0 << 8) ;- (PWMC) +AT91C_PWMC_DIVB EQU (0xFF << 16) ;- (PWMC) CLKB divide factor. +AT91C_PWMC_PREB EQU (0xF << 24) ;- (PWMC) Divider Input Clock Prescaler B +AT91C_PWMC_PREB_MCK EQU (0x0 << 24) ;- (PWMC) +// - -------- PWMC_ENA : (PWMC Offset: 0x4) PWMC Enable Register -------- +AT91C_PWMC_CHID0 EQU (0x1 << 0) ;- (PWMC) Channel ID 0 +AT91C_PWMC_CHID1 EQU (0x1 << 1) ;- (PWMC) Channel ID 1 +AT91C_PWMC_CHID2 EQU (0x1 << 2) ;- (PWMC) Channel ID 2 +AT91C_PWMC_CHID3 EQU (0x1 << 3) ;- (PWMC) Channel ID 3 +// - -------- PWMC_DIS : (PWMC Offset: 0x8) PWMC Disable Register -------- +// - -------- PWMC_SR : (PWMC Offset: 0xc) PWMC Status Register -------- +// - -------- PWMC_IER : (PWMC Offset: 0x10) PWMC Interrupt Enable Register -------- +// - -------- PWMC_IDR : (PWMC Offset: 0x14) PWMC Interrupt Disable Register -------- +// - -------- PWMC_IMR : (PWMC Offset: 0x18) PWMC Interrupt Mask Register -------- +// - -------- PWMC_ISR : (PWMC Offset: 0x1c) PWMC Interrupt Status Register -------- + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR USB Device Interface +// - ***************************************************************************** +// - -------- UDP_FRM_NUM : (UDP Offset: 0x0) USB Frame Number Register -------- +AT91C_UDP_FRM_NUM EQU (0x7FF << 0) ;- (UDP) Frame Number as Defined in the Packet Field Formats +AT91C_UDP_FRM_ERR EQU (0x1 << 16) ;- (UDP) Frame Error +AT91C_UDP_FRM_OK EQU (0x1 << 17) ;- (UDP) Frame OK +// - -------- UDP_GLB_STATE : (UDP Offset: 0x4) USB Global State Register -------- +AT91C_UDP_FADDEN EQU (0x1 << 0) ;- (UDP) Function Address Enable +AT91C_UDP_CONFG EQU (0x1 << 1) ;- (UDP) Configured +AT91C_UDP_ESR EQU (0x1 << 2) ;- (UDP) Enable Send Resume +AT91C_UDP_RSMINPR EQU (0x1 << 3) ;- (UDP) A Resume Has Been Sent to the Host +AT91C_UDP_RMWUPE EQU (0x1 << 4) ;- (UDP) Remote Wake Up Enable +// - -------- UDP_FADDR : (UDP Offset: 0x8) USB Function Address Register -------- +AT91C_UDP_FADD EQU (0xFF << 0) ;- (UDP) Function Address Value +AT91C_UDP_FEN EQU (0x1 << 8) ;- (UDP) Function Enable +// - -------- UDP_IER : (UDP Offset: 0x10) USB Interrupt Enable Register -------- +AT91C_UDP_EPINT0 EQU (0x1 << 0) ;- (UDP) Endpoint 0 Interrupt +AT91C_UDP_EPINT1 EQU (0x1 << 1) ;- (UDP) Endpoint 0 Interrupt +AT91C_UDP_EPINT2 EQU (0x1 << 2) ;- (UDP) Endpoint 2 Interrupt +AT91C_UDP_EPINT3 EQU (0x1 << 3) ;- (UDP) Endpoint 3 Interrupt +AT91C_UDP_EPINT4 EQU (0x1 << 4) ;- (UDP) Endpoint 4 Interrupt +AT91C_UDP_EPINT5 EQU (0x1 << 5) ;- (UDP) Endpoint 5 Interrupt +AT91C_UDP_RXSUSP EQU (0x1 << 8) ;- (UDP) USB Suspend Interrupt +AT91C_UDP_RXRSM EQU (0x1 << 9) ;- (UDP) USB Resume Interrupt +AT91C_UDP_EXTRSM EQU (0x1 << 10) ;- (UDP) USB External Resume Interrupt +AT91C_UDP_SOFINT EQU (0x1 << 11) ;- (UDP) USB Start Of frame Interrupt +AT91C_UDP_WAKEUP EQU (0x1 << 13) ;- (UDP) USB Resume Interrupt +// - -------- UDP_IDR : (UDP Offset: 0x14) USB Interrupt Disable Register -------- +// - -------- UDP_IMR : (UDP Offset: 0x18) USB Interrupt Mask Register -------- +// - -------- UDP_ISR : (UDP Offset: 0x1c) USB Interrupt Status Register -------- +AT91C_UDP_ENDBUSRES EQU (0x1 << 12) ;- (UDP) USB End Of Bus Reset Interrupt +// - -------- UDP_ICR : (UDP Offset: 0x20) USB Interrupt Clear Register -------- +// - -------- UDP_RST_EP : (UDP Offset: 0x28) USB Reset Endpoint Register -------- +AT91C_UDP_EP0 EQU (0x1 << 0) ;- (UDP) Reset Endpoint 0 +AT91C_UDP_EP1 EQU (0x1 << 1) ;- (UDP) Reset Endpoint 1 +AT91C_UDP_EP2 EQU (0x1 << 2) ;- (UDP) Reset Endpoint 2 +AT91C_UDP_EP3 EQU (0x1 << 3) ;- (UDP) Reset Endpoint 3 +AT91C_UDP_EP4 EQU (0x1 << 4) ;- (UDP) Reset Endpoint 4 +AT91C_UDP_EP5 EQU (0x1 << 5) ;- (UDP) Reset Endpoint 5 +// - -------- UDP_CSR : (UDP Offset: 0x30) USB Endpoint Control and Status Register -------- +AT91C_UDP_TXCOMP EQU (0x1 << 0) ;- (UDP) Generates an IN packet with data previously written in the DPR +AT91C_UDP_RX_DATA_BK0 EQU (0x1 << 1) ;- (UDP) Receive Data Bank 0 +AT91C_UDP_RXSETUP EQU (0x1 << 2) ;- (UDP) Sends STALL to the Host (Control endpoints) +AT91C_UDP_ISOERROR EQU (0x1 << 3) ;- (UDP) Isochronous error (Isochronous endpoints) +AT91C_UDP_TXPKTRDY EQU (0x1 << 4) ;- (UDP) Transmit Packet Ready +AT91C_UDP_FORCESTALL EQU (0x1 << 5) ;- (UDP) Force Stall (used by Control, Bulk and Isochronous endpoints). +AT91C_UDP_RX_DATA_BK1 EQU (0x1 << 6) ;- (UDP) Receive Data Bank 1 (only used by endpoints with ping-pong attributes). +AT91C_UDP_DIR EQU (0x1 << 7) ;- (UDP) Transfer Direction +AT91C_UDP_EPTYPE EQU (0x7 << 8) ;- (UDP) Endpoint type +AT91C_UDP_EPTYPE_CTRL EQU (0x0 << 8) ;- (UDP) Control +AT91C_UDP_EPTYPE_ISO_OUT EQU (0x1 << 8) ;- (UDP) Isochronous OUT +AT91C_UDP_EPTYPE_BULK_OUT EQU (0x2 << 8) ;- (UDP) Bulk OUT +AT91C_UDP_EPTYPE_INT_OUT EQU (0x3 << 8) ;- (UDP) Interrupt OUT +AT91C_UDP_EPTYPE_ISO_IN EQU (0x5 << 8) ;- (UDP) Isochronous IN +AT91C_UDP_EPTYPE_BULK_IN EQU (0x6 << 8) ;- (UDP) Bulk IN +AT91C_UDP_EPTYPE_INT_IN EQU (0x7 << 8) ;- (UDP) Interrupt IN +AT91C_UDP_DTGLE EQU (0x1 << 11) ;- (UDP) Data Toggle +AT91C_UDP_EPEDS EQU (0x1 << 15) ;- (UDP) Endpoint Enable Disable +AT91C_UDP_RXBYTECNT EQU (0x7FF << 16) ;- (UDP) Number Of Bytes Available in the FIFO +// - -------- UDP_TXVC : (UDP Offset: 0x74) Transceiver Control Register -------- +AT91C_UDP_TXVDIS EQU (0x1 << 8) ;- (UDP) +AT91C_UDP_PUON EQU (0x1 << 9) ;- (UDP) Pull-up ON + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Timer Counter Channel Interface +// - ***************************************************************************** +// - -------- TC_CCR : (TC Offset: 0x0) TC Channel Control Register -------- +AT91C_TC_CLKEN EQU (0x1 << 0) ;- (TC) Counter Clock Enable Command +AT91C_TC_CLKDIS EQU (0x1 << 1) ;- (TC) Counter Clock Disable Command +AT91C_TC_SWTRG EQU (0x1 << 2) ;- (TC) Software Trigger Command +// - -------- TC_CMR : (TC Offset: 0x4) TC Channel Mode Register: Capture Mode / Waveform Mode -------- +AT91C_TC_CLKS EQU (0x7 << 0) ;- (TC) Clock Selection +AT91C_TC_CLKS_TIMER_DIV1_CLOCK EQU (0x0) ;- (TC) Clock selected: TIMER_DIV1_CLOCK +AT91C_TC_CLKS_TIMER_DIV2_CLOCK EQU (0x1) ;- (TC) Clock selected: TIMER_DIV2_CLOCK +AT91C_TC_CLKS_TIMER_DIV3_CLOCK EQU (0x2) ;- (TC) Clock selected: TIMER_DIV3_CLOCK +AT91C_TC_CLKS_TIMER_DIV4_CLOCK EQU (0x3) ;- (TC) Clock selected: TIMER_DIV4_CLOCK +AT91C_TC_CLKS_TIMER_DIV5_CLOCK EQU (0x4) ;- (TC) Clock selected: TIMER_DIV5_CLOCK +AT91C_TC_CLKS_XC0 EQU (0x5) ;- (TC) Clock selected: XC0 +AT91C_TC_CLKS_XC1 EQU (0x6) ;- (TC) Clock selected: XC1 +AT91C_TC_CLKS_XC2 EQU (0x7) ;- (TC) Clock selected: XC2 +AT91C_TC_CLKI EQU (0x1 << 3) ;- (TC) Clock Invert +AT91C_TC_BURST EQU (0x3 << 4) ;- (TC) Burst Signal Selection +AT91C_TC_BURST_NONE EQU (0x0 << 4) ;- (TC) The clock is not gated by an external signal +AT91C_TC_BURST_XC0 EQU (0x1 << 4) ;- (TC) XC0 is ANDed with the selected clock +AT91C_TC_BURST_XC1 EQU (0x2 << 4) ;- (TC) XC1 is ANDed with the selected clock +AT91C_TC_BURST_XC2 EQU (0x3 << 4) ;- (TC) XC2 is ANDed with the selected clock +AT91C_TC_CPCSTOP EQU (0x1 << 6) ;- (TC) Counter Clock Stopped with RC Compare +AT91C_TC_LDBSTOP EQU (0x1 << 6) ;- (TC) Counter Clock Stopped with RB Loading +AT91C_TC_CPCDIS EQU (0x1 << 7) ;- (TC) Counter Clock Disable with RC Compare +AT91C_TC_LDBDIS EQU (0x1 << 7) ;- (TC) Counter Clock Disabled with RB Loading +AT91C_TC_ETRGEDG EQU (0x3 << 8) ;- (TC) External Trigger Edge Selection +AT91C_TC_ETRGEDG_NONE EQU (0x0 << 8) ;- (TC) Edge: None +AT91C_TC_ETRGEDG_RISING EQU (0x1 << 8) ;- (TC) Edge: rising edge +AT91C_TC_ETRGEDG_FALLING EQU (0x2 << 8) ;- (TC) Edge: falling edge +AT91C_TC_ETRGEDG_BOTH EQU (0x3 << 8) ;- (TC) Edge: each edge +AT91C_TC_EEVTEDG EQU (0x3 << 8) ;- (TC) External Event Edge Selection +AT91C_TC_EEVTEDG_NONE EQU (0x0 << 8) ;- (TC) Edge: None +AT91C_TC_EEVTEDG_RISING EQU (0x1 << 8) ;- (TC) Edge: rising edge +AT91C_TC_EEVTEDG_FALLING EQU (0x2 << 8) ;- (TC) Edge: falling edge +AT91C_TC_EEVTEDG_BOTH EQU (0x3 << 8) ;- (TC) Edge: each edge +AT91C_TC_EEVT EQU (0x3 << 10) ;- (TC) External Event Selection +AT91C_TC_EEVT_TIOB EQU (0x0 << 10) ;- (TC) Signal selected as external event: TIOB TIOB direction: input +AT91C_TC_EEVT_XC0 EQU (0x1 << 10) ;- (TC) Signal selected as external event: XC0 TIOB direction: output +AT91C_TC_EEVT_XC1 EQU (0x2 << 10) ;- (TC) Signal selected as external event: XC1 TIOB direction: output +AT91C_TC_EEVT_XC2 EQU (0x3 << 10) ;- (TC) Signal selected as external event: XC2 TIOB direction: output +AT91C_TC_ABETRG EQU (0x1 << 10) ;- (TC) TIOA or TIOB External Trigger Selection +AT91C_TC_ENETRG EQU (0x1 << 12) ;- (TC) External Event Trigger enable +AT91C_TC_WAVESEL EQU (0x3 << 13) ;- (TC) Waveform Selection +AT91C_TC_WAVESEL_UP EQU (0x0 << 13) ;- (TC) UP mode without atomatic trigger on RC Compare +AT91C_TC_WAVESEL_UPDOWN EQU (0x1 << 13) ;- (TC) UPDOWN mode without automatic trigger on RC Compare +AT91C_TC_WAVESEL_UP_AUTO EQU (0x2 << 13) ;- (TC) UP mode with automatic trigger on RC Compare +AT91C_TC_WAVESEL_UPDOWN_AUTO EQU (0x3 << 13) ;- (TC) UPDOWN mode with automatic trigger on RC Compare +AT91C_TC_CPCTRG EQU (0x1 << 14) ;- (TC) RC Compare Trigger Enable +AT91C_TC_WAVE EQU (0x1 << 15) ;- (TC) +AT91C_TC_ACPA EQU (0x3 << 16) ;- (TC) RA Compare Effect on TIOA +AT91C_TC_ACPA_NONE EQU (0x0 << 16) ;- (TC) Effect: none +AT91C_TC_ACPA_SET EQU (0x1 << 16) ;- (TC) Effect: set +AT91C_TC_ACPA_CLEAR EQU (0x2 << 16) ;- (TC) Effect: clear +AT91C_TC_ACPA_TOGGLE EQU (0x3 << 16) ;- (TC) Effect: toggle +AT91C_TC_LDRA EQU (0x3 << 16) ;- (TC) RA Loading Selection +AT91C_TC_LDRA_NONE EQU (0x0 << 16) ;- (TC) Edge: None +AT91C_TC_LDRA_RISING EQU (0x1 << 16) ;- (TC) Edge: rising edge of TIOA +AT91C_TC_LDRA_FALLING EQU (0x2 << 16) ;- (TC) Edge: falling edge of TIOA +AT91C_TC_LDRA_BOTH EQU (0x3 << 16) ;- (TC) Edge: each edge of TIOA +AT91C_TC_ACPC EQU (0x3 << 18) ;- (TC) RC Compare Effect on TIOA +AT91C_TC_ACPC_NONE EQU (0x0 << 18) ;- (TC) Effect: none +AT91C_TC_ACPC_SET EQU (0x1 << 18) ;- (TC) Effect: set +AT91C_TC_ACPC_CLEAR EQU (0x2 << 18) ;- (TC) Effect: clear +AT91C_TC_ACPC_TOGGLE EQU (0x3 << 18) ;- (TC) Effect: toggle +AT91C_TC_LDRB EQU (0x3 << 18) ;- (TC) RB Loading Selection +AT91C_TC_LDRB_NONE EQU (0x0 << 18) ;- (TC) Edge: None +AT91C_TC_LDRB_RISING EQU (0x1 << 18) ;- (TC) Edge: rising edge of TIOA +AT91C_TC_LDRB_FALLING EQU (0x2 << 18) ;- (TC) Edge: falling edge of TIOA +AT91C_TC_LDRB_BOTH EQU (0x3 << 18) ;- (TC) Edge: each edge of TIOA +AT91C_TC_AEEVT EQU (0x3 << 20) ;- (TC) External Event Effect on TIOA +AT91C_TC_AEEVT_NONE EQU (0x0 << 20) ;- (TC) Effect: none +AT91C_TC_AEEVT_SET EQU (0x1 << 20) ;- (TC) Effect: set +AT91C_TC_AEEVT_CLEAR EQU (0x2 << 20) ;- (TC) Effect: clear +AT91C_TC_AEEVT_TOGGLE EQU (0x3 << 20) ;- (TC) Effect: toggle +AT91C_TC_ASWTRG EQU (0x3 << 22) ;- (TC) Software Trigger Effect on TIOA +AT91C_TC_ASWTRG_NONE EQU (0x0 << 22) ;- (TC) Effect: none +AT91C_TC_ASWTRG_SET EQU (0x1 << 22) ;- (TC) Effect: set +AT91C_TC_ASWTRG_CLEAR EQU (0x2 << 22) ;- (TC) Effect: clear +AT91C_TC_ASWTRG_TOGGLE EQU (0x3 << 22) ;- (TC) Effect: toggle +AT91C_TC_BCPB EQU (0x3 << 24) ;- (TC) RB Compare Effect on TIOB +AT91C_TC_BCPB_NONE EQU (0x0 << 24) ;- (TC) Effect: none +AT91C_TC_BCPB_SET EQU (0x1 << 24) ;- (TC) Effect: set +AT91C_TC_BCPB_CLEAR EQU (0x2 << 24) ;- (TC) Effect: clear +AT91C_TC_BCPB_TOGGLE EQU (0x3 << 24) ;- (TC) Effect: toggle +AT91C_TC_BCPC EQU (0x3 << 26) ;- (TC) RC Compare Effect on TIOB +AT91C_TC_BCPC_NONE EQU (0x0 << 26) ;- (TC) Effect: none +AT91C_TC_BCPC_SET EQU (0x1 << 26) ;- (TC) Effect: set +AT91C_TC_BCPC_CLEAR EQU (0x2 << 26) ;- (TC) Effect: clear +AT91C_TC_BCPC_TOGGLE EQU (0x3 << 26) ;- (TC) Effect: toggle +AT91C_TC_BEEVT EQU (0x3 << 28) ;- (TC) External Event Effect on TIOB +AT91C_TC_BEEVT_NONE EQU (0x0 << 28) ;- (TC) Effect: none +AT91C_TC_BEEVT_SET EQU (0x1 << 28) ;- (TC) Effect: set +AT91C_TC_BEEVT_CLEAR EQU (0x2 << 28) ;- (TC) Effect: clear +AT91C_TC_BEEVT_TOGGLE EQU (0x3 << 28) ;- (TC) Effect: toggle +AT91C_TC_BSWTRG EQU (0x3 << 30) ;- (TC) Software Trigger Effect on TIOB +AT91C_TC_BSWTRG_NONE EQU (0x0 << 30) ;- (TC) Effect: none +AT91C_TC_BSWTRG_SET EQU (0x1 << 30) ;- (TC) Effect: set +AT91C_TC_BSWTRG_CLEAR EQU (0x2 << 30) ;- (TC) Effect: clear +AT91C_TC_BSWTRG_TOGGLE EQU (0x3 << 30) ;- (TC) Effect: toggle +// - -------- TC_SR : (TC Offset: 0x20) TC Channel Status Register -------- +AT91C_TC_COVFS EQU (0x1 << 0) ;- (TC) Counter Overflow +AT91C_TC_LOVRS EQU (0x1 << 1) ;- (TC) Load Overrun +AT91C_TC_CPAS EQU (0x1 << 2) ;- (TC) RA Compare +AT91C_TC_CPBS EQU (0x1 << 3) ;- (TC) RB Compare +AT91C_TC_CPCS EQU (0x1 << 4) ;- (TC) RC Compare +AT91C_TC_LDRAS EQU (0x1 << 5) ;- (TC) RA Loading +AT91C_TC_LDRBS EQU (0x1 << 6) ;- (TC) RB Loading +AT91C_TC_ETRGS EQU (0x1 << 7) ;- (TC) External Trigger +AT91C_TC_CLKSTA EQU (0x1 << 16) ;- (TC) Clock Enabling +AT91C_TC_MTIOA EQU (0x1 << 17) ;- (TC) TIOA Mirror +AT91C_TC_MTIOB EQU (0x1 << 18) ;- (TC) TIOA Mirror +// - -------- TC_IER : (TC Offset: 0x24) TC Channel Interrupt Enable Register -------- +// - -------- TC_IDR : (TC Offset: 0x28) TC Channel Interrupt Disable Register -------- +// - -------- TC_IMR : (TC Offset: 0x2c) TC Channel Interrupt Mask Register -------- + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Timer Counter Interface +// - ***************************************************************************** +// - -------- TCB_BCR : (TCB Offset: 0xc0) TC Block Control Register -------- +AT91C_TCB_SYNC EQU (0x1 << 0) ;- (TCB) Synchro Command +// - -------- TCB_BMR : (TCB Offset: 0xc4) TC Block Mode Register -------- +AT91C_TCB_TC0XC0S EQU (0x3 << 0) ;- (TCB) External Clock Signal 0 Selection +AT91C_TCB_TC0XC0S_TCLK0 EQU (0x0) ;- (TCB) TCLK0 connected to XC0 +AT91C_TCB_TC0XC0S_NONE EQU (0x1) ;- (TCB) None signal connected to XC0 +AT91C_TCB_TC0XC0S_TIOA1 EQU (0x2) ;- (TCB) TIOA1 connected to XC0 +AT91C_TCB_TC0XC0S_TIOA2 EQU (0x3) ;- (TCB) TIOA2 connected to XC0 +AT91C_TCB_TC1XC1S EQU (0x3 << 2) ;- (TCB) External Clock Signal 1 Selection +AT91C_TCB_TC1XC1S_TCLK1 EQU (0x0 << 2) ;- (TCB) TCLK1 connected to XC1 +AT91C_TCB_TC1XC1S_NONE EQU (0x1 << 2) ;- (TCB) None signal connected to XC1 +AT91C_TCB_TC1XC1S_TIOA0 EQU (0x2 << 2) ;- (TCB) TIOA0 connected to XC1 +AT91C_TCB_TC1XC1S_TIOA2 EQU (0x3 << 2) ;- (TCB) TIOA2 connected to XC1 +AT91C_TCB_TC2XC2S EQU (0x3 << 4) ;- (TCB) External Clock Signal 2 Selection +AT91C_TCB_TC2XC2S_TCLK2 EQU (0x0 << 4) ;- (TCB) TCLK2 connected to XC2 +AT91C_TCB_TC2XC2S_NONE EQU (0x1 << 4) ;- (TCB) None signal connected to XC2 +AT91C_TCB_TC2XC2S_TIOA0 EQU (0x2 << 4) ;- (TCB) TIOA0 connected to XC2 +AT91C_TCB_TC2XC2S_TIOA1 EQU (0x3 << 4) ;- (TCB) TIOA2 connected to XC2 + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Control Area Network MailBox Interface +// - ***************************************************************************** +// - -------- CAN_MMR : (CAN_MB Offset: 0x0) CAN Message Mode Register -------- +AT91C_CAN_MTIMEMARK EQU (0xFFFF << 0) ;- (CAN_MB) Mailbox Timemark +AT91C_CAN_PRIOR EQU (0xF << 16) ;- (CAN_MB) Mailbox Priority +AT91C_CAN_MOT EQU (0x7 << 24) ;- (CAN_MB) Mailbox Object Type +AT91C_CAN_MOT_DIS EQU (0x0 << 24) ;- (CAN_MB) +AT91C_CAN_MOT_RX EQU (0x1 << 24) ;- (CAN_MB) +AT91C_CAN_MOT_RXOVERWRITE EQU (0x2 << 24) ;- (CAN_MB) +AT91C_CAN_MOT_TX EQU (0x3 << 24) ;- (CAN_MB) +AT91C_CAN_MOT_CONSUMER EQU (0x4 << 24) ;- (CAN_MB) +AT91C_CAN_MOT_PRODUCER EQU (0x5 << 24) ;- (CAN_MB) +// - -------- CAN_MAM : (CAN_MB Offset: 0x4) CAN Message Acceptance Mask Register -------- +AT91C_CAN_MIDvB EQU (0x3FFFF << 0) ;- (CAN_MB) Complementary bits for identifier in extended mode +AT91C_CAN_MIDvA EQU (0x7FF << 18) ;- (CAN_MB) Identifier for standard frame mode +AT91C_CAN_MIDE EQU (0x1 << 29) ;- (CAN_MB) Identifier Version +// - -------- CAN_MID : (CAN_MB Offset: 0x8) CAN Message ID Register -------- +// - -------- CAN_MFID : (CAN_MB Offset: 0xc) CAN Message Family ID Register -------- +// - -------- CAN_MSR : (CAN_MB Offset: 0x10) CAN Message Status Register -------- +AT91C_CAN_MTIMESTAMP EQU (0xFFFF << 0) ;- (CAN_MB) Timer Value +AT91C_CAN_MDLC EQU (0xF << 16) ;- (CAN_MB) Mailbox Data Length Code +AT91C_CAN_MRTR EQU (0x1 << 20) ;- (CAN_MB) Mailbox Remote Transmission Request +AT91C_CAN_MABT EQU (0x1 << 22) ;- (CAN_MB) Mailbox Message Abort +AT91C_CAN_MRDY EQU (0x1 << 23) ;- (CAN_MB) Mailbox Ready +AT91C_CAN_MMI EQU (0x1 << 24) ;- (CAN_MB) Mailbox Message Ignored +// - -------- CAN_MDL : (CAN_MB Offset: 0x14) CAN Message Data Low Register -------- +// - -------- CAN_MDH : (CAN_MB Offset: 0x18) CAN Message Data High Register -------- +// - -------- CAN_MCR : (CAN_MB Offset: 0x1c) CAN Message Control Register -------- +AT91C_CAN_MACR EQU (0x1 << 22) ;- (CAN_MB) Abort Request for Mailbox +AT91C_CAN_MTCR EQU (0x1 << 23) ;- (CAN_MB) Mailbox Transfer Command + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Control Area Network Interface +// - ***************************************************************************** +// - -------- CAN_MR : (CAN Offset: 0x0) CAN Mode Register -------- +AT91C_CAN_CANEN EQU (0x1 << 0) ;- (CAN) CAN Controller Enable +AT91C_CAN_LPM EQU (0x1 << 1) ;- (CAN) Disable/Enable Low Power Mode +AT91C_CAN_ABM EQU (0x1 << 2) ;- (CAN) Disable/Enable Autobaud/Listen Mode +AT91C_CAN_OVL EQU (0x1 << 3) ;- (CAN) Disable/Enable Overload Frame +AT91C_CAN_TEOF EQU (0x1 << 4) ;- (CAN) Time Stamp messages at each end of Frame +AT91C_CAN_TTM EQU (0x1 << 5) ;- (CAN) Disable/Enable Time Trigger Mode +AT91C_CAN_TIMFRZ EQU (0x1 << 6) ;- (CAN) Enable Timer Freeze +AT91C_CAN_DRPT EQU (0x1 << 7) ;- (CAN) Disable Repeat +// - -------- CAN_IER : (CAN Offset: 0x4) CAN Interrupt Enable Register -------- +AT91C_CAN_MB0 EQU (0x1 << 0) ;- (CAN) Mailbox 0 Flag +AT91C_CAN_MB1 EQU (0x1 << 1) ;- (CAN) Mailbox 1 Flag +AT91C_CAN_MB2 EQU (0x1 << 2) ;- (CAN) Mailbox 2 Flag +AT91C_CAN_MB3 EQU (0x1 << 3) ;- (CAN) Mailbox 3 Flag +AT91C_CAN_MB4 EQU (0x1 << 4) ;- (CAN) Mailbox 4 Flag +AT91C_CAN_MB5 EQU (0x1 << 5) ;- (CAN) Mailbox 5 Flag +AT91C_CAN_MB6 EQU (0x1 << 6) ;- (CAN) Mailbox 6 Flag +AT91C_CAN_MB7 EQU (0x1 << 7) ;- (CAN) Mailbox 7 Flag +AT91C_CAN_MB8 EQU (0x1 << 8) ;- (CAN) Mailbox 8 Flag +AT91C_CAN_MB9 EQU (0x1 << 9) ;- (CAN) Mailbox 9 Flag +AT91C_CAN_MB10 EQU (0x1 << 10) ;- (CAN) Mailbox 10 Flag +AT91C_CAN_MB11 EQU (0x1 << 11) ;- (CAN) Mailbox 11 Flag +AT91C_CAN_MB12 EQU (0x1 << 12) ;- (CAN) Mailbox 12 Flag +AT91C_CAN_MB13 EQU (0x1 << 13) ;- (CAN) Mailbox 13 Flag +AT91C_CAN_MB14 EQU (0x1 << 14) ;- (CAN) Mailbox 14 Flag +AT91C_CAN_MB15 EQU (0x1 << 15) ;- (CAN) Mailbox 15 Flag +AT91C_CAN_ERRA EQU (0x1 << 16) ;- (CAN) Error Active Mode Flag +AT91C_CAN_WARN EQU (0x1 << 17) ;- (CAN) Warning Limit Flag +AT91C_CAN_ERRP EQU (0x1 << 18) ;- (CAN) Error Passive Mode Flag +AT91C_CAN_BOFF EQU (0x1 << 19) ;- (CAN) Bus Off Mode Flag +AT91C_CAN_SLEEP EQU (0x1 << 20) ;- (CAN) Sleep Flag +AT91C_CAN_WAKEUP EQU (0x1 << 21) ;- (CAN) Wakeup Flag +AT91C_CAN_TOVF EQU (0x1 << 22) ;- (CAN) Timer Overflow Flag +AT91C_CAN_TSTP EQU (0x1 << 23) ;- (CAN) Timestamp Flag +AT91C_CAN_CERR EQU (0x1 << 24) ;- (CAN) CRC Error +AT91C_CAN_SERR EQU (0x1 << 25) ;- (CAN) Stuffing Error +AT91C_CAN_AERR EQU (0x1 << 26) ;- (CAN) Acknowledgment Error +AT91C_CAN_FERR EQU (0x1 << 27) ;- (CAN) Form Error +AT91C_CAN_BERR EQU (0x1 << 28) ;- (CAN) Bit Error +// - -------- CAN_IDR : (CAN Offset: 0x8) CAN Interrupt Disable Register -------- +// - -------- CAN_IMR : (CAN Offset: 0xc) CAN Interrupt Mask Register -------- +// - -------- CAN_SR : (CAN Offset: 0x10) CAN Status Register -------- +AT91C_CAN_RBSY EQU (0x1 << 29) ;- (CAN) Receiver Busy +AT91C_CAN_TBSY EQU (0x1 << 30) ;- (CAN) Transmitter Busy +AT91C_CAN_OVLY EQU (0x1 << 31) ;- (CAN) Overload Busy +// - -------- CAN_BR : (CAN Offset: 0x14) CAN Baudrate Register -------- +AT91C_CAN_PHASE2 EQU (0x7 << 0) ;- (CAN) Phase 2 segment +AT91C_CAN_PHASE1 EQU (0x7 << 4) ;- (CAN) Phase 1 segment +AT91C_CAN_PROPAG EQU (0x7 << 8) ;- (CAN) Programmation time segment +AT91C_CAN_SYNC EQU (0x3 << 12) ;- (CAN) Re-synchronization jump width segment +AT91C_CAN_BRP EQU (0x7F << 16) ;- (CAN) Baudrate Prescaler +AT91C_CAN_SMP EQU (0x1 << 24) ;- (CAN) Sampling mode +// - -------- CAN_TIM : (CAN Offset: 0x18) CAN Timer Register -------- +AT91C_CAN_TIMER EQU (0xFFFF << 0) ;- (CAN) Timer field +// - -------- CAN_TIMESTP : (CAN Offset: 0x1c) CAN Timestamp Register -------- +// - -------- CAN_ECR : (CAN Offset: 0x20) CAN Error Counter Register -------- +AT91C_CAN_REC EQU (0xFF << 0) ;- (CAN) Receive Error Counter +AT91C_CAN_TEC EQU (0xFF << 16) ;- (CAN) Transmit Error Counter +// - -------- CAN_TCR : (CAN Offset: 0x24) CAN Transfer Command Register -------- +AT91C_CAN_TIMRST EQU (0x1 << 31) ;- (CAN) Timer Reset Field +// - -------- CAN_ACR : (CAN Offset: 0x28) CAN Abort Command Register -------- + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Ethernet MAC 10/100 +// - ***************************************************************************** +// - -------- EMAC_NCR : (EMAC Offset: 0x0) -------- +AT91C_EMAC_LB EQU (0x1 << 0) ;- (EMAC) Loopback. Optional. When set, loopback signal is at high level. +AT91C_EMAC_LLB EQU (0x1 << 1) ;- (EMAC) Loopback local. +AT91C_EMAC_RE EQU (0x1 << 2) ;- (EMAC) Receive enable. +AT91C_EMAC_TE EQU (0x1 << 3) ;- (EMAC) Transmit enable. +AT91C_EMAC_MPE EQU (0x1 << 4) ;- (EMAC) Management port enable. +AT91C_EMAC_CLRSTAT EQU (0x1 << 5) ;- (EMAC) Clear statistics registers. +AT91C_EMAC_INCSTAT EQU (0x1 << 6) ;- (EMAC) Increment statistics registers. +AT91C_EMAC_WESTAT EQU (0x1 << 7) ;- (EMAC) Write enable for statistics registers. +AT91C_EMAC_BP EQU (0x1 << 8) ;- (EMAC) Back pressure. +AT91C_EMAC_TSTART EQU (0x1 << 9) ;- (EMAC) Start Transmission. +AT91C_EMAC_THALT EQU (0x1 << 10) ;- (EMAC) Transmission Halt. +AT91C_EMAC_TPFR EQU (0x1 << 11) ;- (EMAC) Transmit pause frame +AT91C_EMAC_TZQ EQU (0x1 << 12) ;- (EMAC) Transmit zero quantum pause frame +// - -------- EMAC_NCFGR : (EMAC Offset: 0x4) Network Configuration Register -------- +AT91C_EMAC_SPD EQU (0x1 << 0) ;- (EMAC) Speed. +AT91C_EMAC_FD EQU (0x1 << 1) ;- (EMAC) Full duplex. +AT91C_EMAC_JFRAME EQU (0x1 << 3) ;- (EMAC) Jumbo Frames. +AT91C_EMAC_CAF EQU (0x1 << 4) ;- (EMAC) Copy all frames. +AT91C_EMAC_NBC EQU (0x1 << 5) ;- (EMAC) No broadcast. +AT91C_EMAC_MTI EQU (0x1 << 6) ;- (EMAC) Multicast hash event enable +AT91C_EMAC_UNI EQU (0x1 << 7) ;- (EMAC) Unicast hash enable. +AT91C_EMAC_BIG EQU (0x1 << 8) ;- (EMAC) Receive 1522 bytes. +AT91C_EMAC_EAE EQU (0x1 << 9) ;- (EMAC) External address match enable. +AT91C_EMAC_CLK EQU (0x3 << 10) ;- (EMAC) +AT91C_EMAC_CLK_HCLK_8 EQU (0x0 << 10) ;- (EMAC) HCLK divided by 8 +AT91C_EMAC_CLK_HCLK_16 EQU (0x1 << 10) ;- (EMAC) HCLK divided by 16 +AT91C_EMAC_CLK_HCLK_32 EQU (0x2 << 10) ;- (EMAC) HCLK divided by 32 +AT91C_EMAC_CLK_HCLK_64 EQU (0x3 << 10) ;- (EMAC) HCLK divided by 64 +AT91C_EMAC_RTY EQU (0x1 << 12) ;- (EMAC) +AT91C_EMAC_PAE EQU (0x1 << 13) ;- (EMAC) +AT91C_EMAC_RBOF EQU (0x3 << 14) ;- (EMAC) +AT91C_EMAC_RBOF_OFFSET_0 EQU (0x0 << 14) ;- (EMAC) no offset from start of receive buffer +AT91C_EMAC_RBOF_OFFSET_1 EQU (0x1 << 14) ;- (EMAC) one byte offset from start of receive buffer +AT91C_EMAC_RBOF_OFFSET_2 EQU (0x2 << 14) ;- (EMAC) two bytes offset from start of receive buffer +AT91C_EMAC_RBOF_OFFSET_3 EQU (0x3 << 14) ;- (EMAC) three bytes offset from start of receive buffer +AT91C_EMAC_RLCE EQU (0x1 << 16) ;- (EMAC) Receive Length field Checking Enable +AT91C_EMAC_DRFCS EQU (0x1 << 17) ;- (EMAC) Discard Receive FCS +AT91C_EMAC_EFRHD EQU (0x1 << 18) ;- (EMAC) +AT91C_EMAC_IRXFCS EQU (0x1 << 19) ;- (EMAC) Ignore RX FCS +// - -------- EMAC_NSR : (EMAC Offset: 0x8) Network Status Register -------- +AT91C_EMAC_LINKR EQU (0x1 << 0) ;- (EMAC) +AT91C_EMAC_MDIO EQU (0x1 << 1) ;- (EMAC) +AT91C_EMAC_IDLE EQU (0x1 << 2) ;- (EMAC) +// - -------- EMAC_TSR : (EMAC Offset: 0x14) Transmit Status Register -------- +AT91C_EMAC_UBR EQU (0x1 << 0) ;- (EMAC) +AT91C_EMAC_COL EQU (0x1 << 1) ;- (EMAC) +AT91C_EMAC_RLES EQU (0x1 << 2) ;- (EMAC) +AT91C_EMAC_TGO EQU (0x1 << 3) ;- (EMAC) Transmit Go +AT91C_EMAC_BEX EQU (0x1 << 4) ;- (EMAC) Buffers exhausted mid frame +AT91C_EMAC_COMP EQU (0x1 << 5) ;- (EMAC) +AT91C_EMAC_UND EQU (0x1 << 6) ;- (EMAC) +// - -------- EMAC_RSR : (EMAC Offset: 0x20) Receive Status Register -------- +AT91C_EMAC_BNA EQU (0x1 << 0) ;- (EMAC) +AT91C_EMAC_REC EQU (0x1 << 1) ;- (EMAC) +AT91C_EMAC_OVR EQU (0x1 << 2) ;- (EMAC) +// - -------- EMAC_ISR : (EMAC Offset: 0x24) Interrupt Status Register -------- +AT91C_EMAC_MFD EQU (0x1 << 0) ;- (EMAC) +AT91C_EMAC_RCOMP EQU (0x1 << 1) ;- (EMAC) +AT91C_EMAC_RXUBR EQU (0x1 << 2) ;- (EMAC) +AT91C_EMAC_TXUBR EQU (0x1 << 3) ;- (EMAC) +AT91C_EMAC_TUNDR EQU (0x1 << 4) ;- (EMAC) +AT91C_EMAC_RLEX EQU (0x1 << 5) ;- (EMAC) +AT91C_EMAC_TXERR EQU (0x1 << 6) ;- (EMAC) +AT91C_EMAC_TCOMP EQU (0x1 << 7) ;- (EMAC) +AT91C_EMAC_LINK EQU (0x1 << 9) ;- (EMAC) +AT91C_EMAC_ROVR EQU (0x1 << 10) ;- (EMAC) +AT91C_EMAC_HRESP EQU (0x1 << 11) ;- (EMAC) +AT91C_EMAC_PFRE EQU (0x1 << 12) ;- (EMAC) +AT91C_EMAC_PTZ EQU (0x1 << 13) ;- (EMAC) +// - -------- EMAC_IER : (EMAC Offset: 0x28) Interrupt Enable Register -------- +// - -------- EMAC_IDR : (EMAC Offset: 0x2c) Interrupt Disable Register -------- +// - -------- EMAC_IMR : (EMAC Offset: 0x30) Interrupt Mask Register -------- +// - -------- EMAC_MAN : (EMAC Offset: 0x34) PHY Maintenance Register -------- +AT91C_EMAC_DATA EQU (0xFFFF << 0) ;- (EMAC) +AT91C_EMAC_CODE EQU (0x3 << 16) ;- (EMAC) +AT91C_EMAC_REGA EQU (0x1F << 18) ;- (EMAC) +AT91C_EMAC_PHYA EQU (0x1F << 23) ;- (EMAC) +AT91C_EMAC_RW EQU (0x3 << 28) ;- (EMAC) +AT91C_EMAC_SOF EQU (0x3 << 30) ;- (EMAC) +// - -------- EMAC_USRIO : (EMAC Offset: 0xc0) USER Input Output Register -------- +AT91C_EMAC_RMII EQU (0x1 << 0) ;- (EMAC) Reduce MII +AT91C_EMAC_CLKEN EQU (0x1 << 1) ;- (EMAC) Clock Enable +// - -------- EMAC_WOL : (EMAC Offset: 0xc4) Wake On LAN Register -------- +AT91C_EMAC_IP EQU (0xFFFF << 0) ;- (EMAC) ARP request IP address +AT91C_EMAC_MAG EQU (0x1 << 16) ;- (EMAC) Magic packet event enable +AT91C_EMAC_ARP EQU (0x1 << 17) ;- (EMAC) ARP request event enable +AT91C_EMAC_SA1 EQU (0x1 << 18) ;- (EMAC) Specific address register 1 event enable +// - -------- EMAC_REV : (EMAC Offset: 0xfc) Revision Register -------- +AT91C_EMAC_REVREF EQU (0xFFFF << 0) ;- (EMAC) +AT91C_EMAC_PARTREF EQU (0xFFFF << 16) ;- (EMAC) + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Analog to Digital Convertor +// - ***************************************************************************** +// - -------- ADC_CR : (ADC Offset: 0x0) ADC Control Register -------- +AT91C_ADC_SWRST EQU (0x1 << 0) ;- (ADC) Software Reset +AT91C_ADC_START EQU (0x1 << 1) ;- (ADC) Start Conversion +// - -------- ADC_MR : (ADC Offset: 0x4) ADC Mode Register -------- +AT91C_ADC_TRGEN EQU (0x1 << 0) ;- (ADC) Trigger Enable +AT91C_ADC_TRGEN_DIS EQU (0x0) ;- (ADC) Hradware triggers are disabled. Starting a conversion is only possible by software +AT91C_ADC_TRGEN_EN EQU (0x1) ;- (ADC) Hardware trigger selected by TRGSEL field is enabled. +AT91C_ADC_TRGSEL EQU (0x7 << 1) ;- (ADC) Trigger Selection +AT91C_ADC_TRGSEL_TIOA0 EQU (0x0 << 1) ;- (ADC) Selected TRGSEL = TIAO0 +AT91C_ADC_TRGSEL_TIOA1 EQU (0x1 << 1) ;- (ADC) Selected TRGSEL = TIAO1 +AT91C_ADC_TRGSEL_TIOA2 EQU (0x2 << 1) ;- (ADC) Selected TRGSEL = TIAO2 +AT91C_ADC_TRGSEL_TIOA3 EQU (0x3 << 1) ;- (ADC) Selected TRGSEL = TIAO3 +AT91C_ADC_TRGSEL_TIOA4 EQU (0x4 << 1) ;- (ADC) Selected TRGSEL = TIAO4 +AT91C_ADC_TRGSEL_TIOA5 EQU (0x5 << 1) ;- (ADC) Selected TRGSEL = TIAO5 +AT91C_ADC_TRGSEL_EXT EQU (0x6 << 1) ;- (ADC) Selected TRGSEL = External Trigger +AT91C_ADC_LOWRES EQU (0x1 << 4) ;- (ADC) Resolution. +AT91C_ADC_LOWRES_10_BIT EQU (0x0 << 4) ;- (ADC) 10-bit resolution +AT91C_ADC_LOWRES_8_BIT EQU (0x1 << 4) ;- (ADC) 8-bit resolution +AT91C_ADC_SLEEP EQU (0x1 << 5) ;- (ADC) Sleep Mode +AT91C_ADC_SLEEP_NORMAL_MODE EQU (0x0 << 5) ;- (ADC) Normal Mode +AT91C_ADC_SLEEP_MODE EQU (0x1 << 5) ;- (ADC) Sleep Mode +AT91C_ADC_PRESCAL EQU (0x3F << 8) ;- (ADC) Prescaler rate selection +AT91C_ADC_STARTUP EQU (0x1F << 16) ;- (ADC) Startup Time +AT91C_ADC_SHTIM EQU (0xF << 24) ;- (ADC) Sample & Hold Time +// - -------- ADC_CHER : (ADC Offset: 0x10) ADC Channel Enable Register -------- +AT91C_ADC_CH0 EQU (0x1 << 0) ;- (ADC) Channel 0 +AT91C_ADC_CH1 EQU (0x1 << 1) ;- (ADC) Channel 1 +AT91C_ADC_CH2 EQU (0x1 << 2) ;- (ADC) Channel 2 +AT91C_ADC_CH3 EQU (0x1 << 3) ;- (ADC) Channel 3 +AT91C_ADC_CH4 EQU (0x1 << 4) ;- (ADC) Channel 4 +AT91C_ADC_CH5 EQU (0x1 << 5) ;- (ADC) Channel 5 +AT91C_ADC_CH6 EQU (0x1 << 6) ;- (ADC) Channel 6 +AT91C_ADC_CH7 EQU (0x1 << 7) ;- (ADC) Channel 7 +// - -------- ADC_CHDR : (ADC Offset: 0x14) ADC Channel Disable Register -------- +// - -------- ADC_CHSR : (ADC Offset: 0x18) ADC Channel Status Register -------- +// - -------- ADC_SR : (ADC Offset: 0x1c) ADC Status Register -------- +AT91C_ADC_EOC0 EQU (0x1 << 0) ;- (ADC) End of Conversion +AT91C_ADC_EOC1 EQU (0x1 << 1) ;- (ADC) End of Conversion +AT91C_ADC_EOC2 EQU (0x1 << 2) ;- (ADC) End of Conversion +AT91C_ADC_EOC3 EQU (0x1 << 3) ;- (ADC) End of Conversion +AT91C_ADC_EOC4 EQU (0x1 << 4) ;- (ADC) End of Conversion +AT91C_ADC_EOC5 EQU (0x1 << 5) ;- (ADC) End of Conversion +AT91C_ADC_EOC6 EQU (0x1 << 6) ;- (ADC) End of Conversion +AT91C_ADC_EOC7 EQU (0x1 << 7) ;- (ADC) End of Conversion +AT91C_ADC_OVRE0 EQU (0x1 << 8) ;- (ADC) Overrun Error +AT91C_ADC_OVRE1 EQU (0x1 << 9) ;- (ADC) Overrun Error +AT91C_ADC_OVRE2 EQU (0x1 << 10) ;- (ADC) Overrun Error +AT91C_ADC_OVRE3 EQU (0x1 << 11) ;- (ADC) Overrun Error +AT91C_ADC_OVRE4 EQU (0x1 << 12) ;- (ADC) Overrun Error +AT91C_ADC_OVRE5 EQU (0x1 << 13) ;- (ADC) Overrun Error +AT91C_ADC_OVRE6 EQU (0x1 << 14) ;- (ADC) Overrun Error +AT91C_ADC_OVRE7 EQU (0x1 << 15) ;- (ADC) Overrun Error +AT91C_ADC_DRDY EQU (0x1 << 16) ;- (ADC) Data Ready +AT91C_ADC_GOVRE EQU (0x1 << 17) ;- (ADC) General Overrun +AT91C_ADC_ENDRX EQU (0x1 << 18) ;- (ADC) End of Receiver Transfer +AT91C_ADC_RXBUFF EQU (0x1 << 19) ;- (ADC) RXBUFF Interrupt +// - -------- ADC_LCDR : (ADC Offset: 0x20) ADC Last Converted Data Register -------- +AT91C_ADC_LDATA EQU (0x3FF << 0) ;- (ADC) Last Data Converted +// - -------- ADC_IER : (ADC Offset: 0x24) ADC Interrupt Enable Register -------- +// - -------- ADC_IDR : (ADC Offset: 0x28) ADC Interrupt Disable Register -------- +// - -------- ADC_IMR : (ADC Offset: 0x2c) ADC Interrupt Mask Register -------- +// - -------- ADC_CDR0 : (ADC Offset: 0x30) ADC Channel Data Register 0 -------- +AT91C_ADC_DATA EQU (0x3FF << 0) ;- (ADC) Converted Data +// - -------- ADC_CDR1 : (ADC Offset: 0x34) ADC Channel Data Register 1 -------- +// - -------- ADC_CDR2 : (ADC Offset: 0x38) ADC Channel Data Register 2 -------- +// - -------- ADC_CDR3 : (ADC Offset: 0x3c) ADC Channel Data Register 3 -------- +// - -------- ADC_CDR4 : (ADC Offset: 0x40) ADC Channel Data Register 4 -------- +// - -------- ADC_CDR5 : (ADC Offset: 0x44) ADC Channel Data Register 5 -------- +// - -------- ADC_CDR6 : (ADC Offset: 0x48) ADC Channel Data Register 6 -------- +// - -------- ADC_CDR7 : (ADC Offset: 0x4c) ADC Channel Data Register 7 -------- + +// - ***************************************************************************** +// - REGISTER ADDRESS DEFINITION FOR AT91SAM7X256 +// - ***************************************************************************** +// - ========== Register definition for SYS peripheral ========== +// - ========== Register definition for AIC peripheral ========== +AT91C_AIC_IVR EQU (0xFFFFF100) ;- (AIC) IRQ Vector Register +AT91C_AIC_SMR EQU (0xFFFFF000) ;- (AIC) Source Mode Register +AT91C_AIC_FVR EQU (0xFFFFF104) ;- (AIC) FIQ Vector Register +AT91C_AIC_DCR EQU (0xFFFFF138) ;- (AIC) Debug Control Register (Protect) +AT91C_AIC_EOICR EQU (0xFFFFF130) ;- (AIC) End of Interrupt Command Register +AT91C_AIC_SVR EQU (0xFFFFF080) ;- (AIC) Source Vector Register +AT91C_AIC_FFSR EQU (0xFFFFF148) ;- (AIC) Fast Forcing Status Register +AT91C_AIC_ICCR EQU (0xFFFFF128) ;- (AIC) Interrupt Clear Command Register +AT91C_AIC_ISR EQU (0xFFFFF108) ;- (AIC) Interrupt Status Register +AT91C_AIC_IMR EQU (0xFFFFF110) ;- (AIC) Interrupt Mask Register +AT91C_AIC_IPR EQU (0xFFFFF10C) ;- (AIC) Interrupt Pending Register +AT91C_AIC_FFER EQU (0xFFFFF140) ;- (AIC) Fast Forcing Enable Register +AT91C_AIC_IECR EQU (0xFFFFF120) ;- (AIC) Interrupt Enable Command Register +AT91C_AIC_ISCR EQU (0xFFFFF12C) ;- (AIC) Interrupt Set Command Register +AT91C_AIC_FFDR EQU (0xFFFFF144) ;- (AIC) Fast Forcing Disable Register +AT91C_AIC_CISR EQU (0xFFFFF114) ;- (AIC) Core Interrupt Status Register +AT91C_AIC_IDCR EQU (0xFFFFF124) ;- (AIC) Interrupt Disable Command Register +AT91C_AIC_SPU EQU (0xFFFFF134) ;- (AIC) Spurious Vector Register +// - ========== Register definition for PDC_DBGU peripheral ========== +AT91C_DBGU_TCR EQU (0xFFFFF30C) ;- (PDC_DBGU) Transmit Counter Register +AT91C_DBGU_RNPR EQU (0xFFFFF310) ;- (PDC_DBGU) Receive Next Pointer Register +AT91C_DBGU_TNPR EQU (0xFFFFF318) ;- (PDC_DBGU) Transmit Next Pointer Register +AT91C_DBGU_TPR EQU (0xFFFFF308) ;- (PDC_DBGU) Transmit Pointer Register +AT91C_DBGU_RPR EQU (0xFFFFF300) ;- (PDC_DBGU) Receive Pointer Register +AT91C_DBGU_RCR EQU (0xFFFFF304) ;- (PDC_DBGU) Receive Counter Register +AT91C_DBGU_RNCR EQU (0xFFFFF314) ;- (PDC_DBGU) Receive Next Counter Register +AT91C_DBGU_PTCR EQU (0xFFFFF320) ;- (PDC_DBGU) PDC Transfer Control Register +AT91C_DBGU_PTSR EQU (0xFFFFF324) ;- (PDC_DBGU) PDC Transfer Status Register +AT91C_DBGU_TNCR EQU (0xFFFFF31C) ;- (PDC_DBGU) Transmit Next Counter Register +// - ========== Register definition for DBGU peripheral ========== +AT91C_DBGU_EXID EQU (0xFFFFF244) ;- (DBGU) Chip ID Extension Register +AT91C_DBGU_BRGR EQU (0xFFFFF220) ;- (DBGU) Baud Rate Generator Register +AT91C_DBGU_IDR EQU (0xFFFFF20C) ;- (DBGU) Interrupt Disable Register +AT91C_DBGU_CSR EQU (0xFFFFF214) ;- (DBGU) Channel Status Register +AT91C_DBGU_CIDR EQU (0xFFFFF240) ;- (DBGU) Chip ID Register +AT91C_DBGU_MR EQU (0xFFFFF204) ;- (DBGU) Mode Register +AT91C_DBGU_IMR EQU (0xFFFFF210) ;- (DBGU) Interrupt Mask Register +AT91C_DBGU_CR EQU (0xFFFFF200) ;- (DBGU) Control Register +AT91C_DBGU_FNTR EQU (0xFFFFF248) ;- (DBGU) Force NTRST Register +AT91C_DBGU_THR EQU (0xFFFFF21C) ;- (DBGU) Transmitter Holding Register +AT91C_DBGU_RHR EQU (0xFFFFF218) ;- (DBGU) Receiver Holding Register +AT91C_DBGU_IER EQU (0xFFFFF208) ;- (DBGU) Interrupt Enable Register +// - ========== Register definition for PIOA peripheral ========== +AT91C_PIOA_ODR EQU (0xFFFFF414) ;- (PIOA) Output Disable Registerr +AT91C_PIOA_SODR EQU (0xFFFFF430) ;- (PIOA) Set Output Data Register +AT91C_PIOA_ISR EQU (0xFFFFF44C) ;- (PIOA) Interrupt Status Register +AT91C_PIOA_ABSR EQU (0xFFFFF478) ;- (PIOA) AB Select Status Register +AT91C_PIOA_IER EQU (0xFFFFF440) ;- (PIOA) Interrupt Enable Register +AT91C_PIOA_PPUDR EQU (0xFFFFF460) ;- (PIOA) Pull-up Disable Register +AT91C_PIOA_IMR EQU (0xFFFFF448) ;- (PIOA) Interrupt Mask Register +AT91C_PIOA_PER EQU (0xFFFFF400) ;- (PIOA) PIO Enable Register +AT91C_PIOA_IFDR EQU (0xFFFFF424) ;- (PIOA) Input Filter Disable Register +AT91C_PIOA_OWDR EQU (0xFFFFF4A4) ;- (PIOA) Output Write Disable Register +AT91C_PIOA_MDSR EQU (0xFFFFF458) ;- (PIOA) Multi-driver Status Register +AT91C_PIOA_IDR EQU (0xFFFFF444) ;- (PIOA) Interrupt Disable Register +AT91C_PIOA_ODSR EQU (0xFFFFF438) ;- (PIOA) Output Data Status Register +AT91C_PIOA_PPUSR EQU (0xFFFFF468) ;- (PIOA) Pull-up Status Register +AT91C_PIOA_OWSR EQU (0xFFFFF4A8) ;- (PIOA) Output Write Status Register +AT91C_PIOA_BSR EQU (0xFFFFF474) ;- (PIOA) Select B Register +AT91C_PIOA_OWER EQU (0xFFFFF4A0) ;- (PIOA) Output Write Enable Register +AT91C_PIOA_IFER EQU (0xFFFFF420) ;- (PIOA) Input Filter Enable Register +AT91C_PIOA_PDSR EQU (0xFFFFF43C) ;- (PIOA) Pin Data Status Register +AT91C_PIOA_PPUER EQU (0xFFFFF464) ;- (PIOA) Pull-up Enable Register +AT91C_PIOA_OSR EQU (0xFFFFF418) ;- (PIOA) Output Status Register +AT91C_PIOA_ASR EQU (0xFFFFF470) ;- (PIOA) Select A Register +AT91C_PIOA_MDDR EQU (0xFFFFF454) ;- (PIOA) Multi-driver Disable Register +AT91C_PIOA_CODR EQU (0xFFFFF434) ;- (PIOA) Clear Output Data Register +AT91C_PIOA_MDER EQU (0xFFFFF450) ;- (PIOA) Multi-driver Enable Register +AT91C_PIOA_PDR EQU (0xFFFFF404) ;- (PIOA) PIO Disable Register +AT91C_PIOA_IFSR EQU (0xFFFFF428) ;- (PIOA) Input Filter Status Register +AT91C_PIOA_OER EQU (0xFFFFF410) ;- (PIOA) Output Enable Register +AT91C_PIOA_PSR EQU (0xFFFFF408) ;- (PIOA) PIO Status Register +// - ========== Register definition for PIOB peripheral ========== +AT91C_PIOB_OWDR EQU (0xFFFFF6A4) ;- (PIOB) Output Write Disable Register +AT91C_PIOB_MDER EQU (0xFFFFF650) ;- (PIOB) Multi-driver Enable Register +AT91C_PIOB_PPUSR EQU (0xFFFFF668) ;- (PIOB) Pull-up Status Register +AT91C_PIOB_IMR EQU (0xFFFFF648) ;- (PIOB) Interrupt Mask Register +AT91C_PIOB_ASR EQU (0xFFFFF670) ;- (PIOB) Select A Register +AT91C_PIOB_PPUDR EQU (0xFFFFF660) ;- (PIOB) Pull-up Disable Register +AT91C_PIOB_PSR EQU (0xFFFFF608) ;- (PIOB) PIO Status Register +AT91C_PIOB_IER EQU (0xFFFFF640) ;- (PIOB) Interrupt Enable Register +AT91C_PIOB_CODR EQU (0xFFFFF634) ;- (PIOB) Clear Output Data Register +AT91C_PIOB_OWER EQU (0xFFFFF6A0) ;- (PIOB) Output Write Enable Register +AT91C_PIOB_ABSR EQU (0xFFFFF678) ;- (PIOB) AB Select Status Register +AT91C_PIOB_IFDR EQU (0xFFFFF624) ;- (PIOB) Input Filter Disable Register +AT91C_PIOB_PDSR EQU (0xFFFFF63C) ;- (PIOB) Pin Data Status Register +AT91C_PIOB_IDR EQU (0xFFFFF644) ;- (PIOB) Interrupt Disable Register +AT91C_PIOB_OWSR EQU (0xFFFFF6A8) ;- (PIOB) Output Write Status Register +AT91C_PIOB_PDR EQU (0xFFFFF604) ;- (PIOB) PIO Disable Register +AT91C_PIOB_ODR EQU (0xFFFFF614) ;- (PIOB) Output Disable Registerr +AT91C_PIOB_IFSR EQU (0xFFFFF628) ;- (PIOB) Input Filter Status Register +AT91C_PIOB_PPUER EQU (0xFFFFF664) ;- (PIOB) Pull-up Enable Register +AT91C_PIOB_SODR EQU (0xFFFFF630) ;- (PIOB) Set Output Data Register +AT91C_PIOB_ISR EQU (0xFFFFF64C) ;- (PIOB) Interrupt Status Register +AT91C_PIOB_ODSR EQU (0xFFFFF638) ;- (PIOB) Output Data Status Register +AT91C_PIOB_OSR EQU (0xFFFFF618) ;- (PIOB) Output Status Register +AT91C_PIOB_MDSR EQU (0xFFFFF658) ;- (PIOB) Multi-driver Status Register +AT91C_PIOB_IFER EQU (0xFFFFF620) ;- (PIOB) Input Filter Enable Register +AT91C_PIOB_BSR EQU (0xFFFFF674) ;- (PIOB) Select B Register +AT91C_PIOB_MDDR EQU (0xFFFFF654) ;- (PIOB) Multi-driver Disable Register +AT91C_PIOB_OER EQU (0xFFFFF610) ;- (PIOB) Output Enable Register +AT91C_PIOB_PER EQU (0xFFFFF600) ;- (PIOB) PIO Enable Register +// - ========== Register definition for CKGR peripheral ========== +AT91C_CKGR_MOR EQU (0xFFFFFC20) ;- (CKGR) Main Oscillator Register +AT91C_CKGR_PLLR EQU (0xFFFFFC2C) ;- (CKGR) PLL Register +AT91C_CKGR_MCFR EQU (0xFFFFFC24) ;- (CKGR) Main Clock Frequency Register +// - ========== Register definition for PMC peripheral ========== +AT91C_PMC_IDR EQU (0xFFFFFC64) ;- (PMC) Interrupt Disable Register +AT91C_PMC_MOR EQU (0xFFFFFC20) ;- (PMC) Main Oscillator Register +AT91C_PMC_PLLR EQU (0xFFFFFC2C) ;- (PMC) PLL Register +AT91C_PMC_PCER EQU (0xFFFFFC10) ;- (PMC) Peripheral Clock Enable Register +AT91C_PMC_PCKR EQU (0xFFFFFC40) ;- (PMC) Programmable Clock Register +AT91C_PMC_MCKR EQU (0xFFFFFC30) ;- (PMC) Master Clock Register +AT91C_PMC_SCDR EQU (0xFFFFFC04) ;- (PMC) System Clock Disable Register +AT91C_PMC_PCDR EQU (0xFFFFFC14) ;- (PMC) Peripheral Clock Disable Register +AT91C_PMC_SCSR EQU (0xFFFFFC08) ;- (PMC) System Clock Status Register +AT91C_PMC_PCSR EQU (0xFFFFFC18) ;- (PMC) Peripheral Clock Status Register +AT91C_PMC_MCFR EQU (0xFFFFFC24) ;- (PMC) Main Clock Frequency Register +AT91C_PMC_SCER EQU (0xFFFFFC00) ;- (PMC) System Clock Enable Register +AT91C_PMC_IMR EQU (0xFFFFFC6C) ;- (PMC) Interrupt Mask Register +AT91C_PMC_IER EQU (0xFFFFFC60) ;- (PMC) Interrupt Enable Register +AT91C_PMC_SR EQU (0xFFFFFC68) ;- (PMC) Status Register +// - ========== Register definition for RSTC peripheral ========== +AT91C_RSTC_RCR EQU (0xFFFFFD00) ;- (RSTC) Reset Control Register +AT91C_RSTC_RMR EQU (0xFFFFFD08) ;- (RSTC) Reset Mode Register +AT91C_RSTC_RSR EQU (0xFFFFFD04) ;- (RSTC) Reset Status Register +// - ========== Register definition for RTTC peripheral ========== +AT91C_RTTC_RTSR EQU (0xFFFFFD2C) ;- (RTTC) Real-time Status Register +AT91C_RTTC_RTMR EQU (0xFFFFFD20) ;- (RTTC) Real-time Mode Register +AT91C_RTTC_RTVR EQU (0xFFFFFD28) ;- (RTTC) Real-time Value Register +AT91C_RTTC_RTAR EQU (0xFFFFFD24) ;- (RTTC) Real-time Alarm Register +// - ========== Register definition for PITC peripheral ========== +AT91C_PITC_PIVR EQU (0xFFFFFD38) ;- (PITC) Period Interval Value Register +AT91C_PITC_PISR EQU (0xFFFFFD34) ;- (PITC) Period Interval Status Register +AT91C_PITC_PIIR EQU (0xFFFFFD3C) ;- (PITC) Period Interval Image Register +AT91C_PITC_PIMR EQU (0xFFFFFD30) ;- (PITC) Period Interval Mode Register +// - ========== Register definition for WDTC peripheral ========== +AT91C_WDTC_WDCR EQU (0xFFFFFD40) ;- (WDTC) Watchdog Control Register +AT91C_WDTC_WDSR EQU (0xFFFFFD48) ;- (WDTC) Watchdog Status Register +AT91C_WDTC_WDMR EQU (0xFFFFFD44) ;- (WDTC) Watchdog Mode Register +// - ========== Register definition for VREG peripheral ========== +AT91C_VREG_MR EQU (0xFFFFFD60) ;- (VREG) Voltage Regulator Mode Register +// - ========== Register definition for MC peripheral ========== +AT91C_MC_ASR EQU (0xFFFFFF04) ;- (MC) MC Abort Status Register +AT91C_MC_RCR EQU (0xFFFFFF00) ;- (MC) MC Remap Control Register +AT91C_MC_FCR EQU (0xFFFFFF64) ;- (MC) MC Flash Command Register +AT91C_MC_AASR EQU (0xFFFFFF08) ;- (MC) MC Abort Address Status Register +AT91C_MC_FSR EQU (0xFFFFFF68) ;- (MC) MC Flash Status Register +AT91C_MC_FMR EQU (0xFFFFFF60) ;- (MC) MC Flash Mode Register +// - ========== Register definition for PDC_SPI1 peripheral ========== +AT91C_SPI1_PTCR EQU (0xFFFE4120) ;- (PDC_SPI1) PDC Transfer Control Register +AT91C_SPI1_RPR EQU (0xFFFE4100) ;- (PDC_SPI1) Receive Pointer Register +AT91C_SPI1_TNCR EQU (0xFFFE411C) ;- (PDC_SPI1) Transmit Next Counter Register +AT91C_SPI1_TPR EQU (0xFFFE4108) ;- (PDC_SPI1) Transmit Pointer Register +AT91C_SPI1_TNPR EQU (0xFFFE4118) ;- (PDC_SPI1) Transmit Next Pointer Register +AT91C_SPI1_TCR EQU (0xFFFE410C) ;- (PDC_SPI1) Transmit Counter Register +AT91C_SPI1_RCR EQU (0xFFFE4104) ;- (PDC_SPI1) Receive Counter Register +AT91C_SPI1_RNPR EQU (0xFFFE4110) ;- (PDC_SPI1) Receive Next Pointer Register +AT91C_SPI1_RNCR EQU (0xFFFE4114) ;- (PDC_SPI1) Receive Next Counter Register +AT91C_SPI1_PTSR EQU (0xFFFE4124) ;- (PDC_SPI1) PDC Transfer Status Register +// - ========== Register definition for SPI1 peripheral ========== +AT91C_SPI1_IMR EQU (0xFFFE401C) ;- (SPI1) Interrupt Mask Register +AT91C_SPI1_IER EQU (0xFFFE4014) ;- (SPI1) Interrupt Enable Register +AT91C_SPI1_MR EQU (0xFFFE4004) ;- (SPI1) Mode Register +AT91C_SPI1_RDR EQU (0xFFFE4008) ;- (SPI1) Receive Data Register +AT91C_SPI1_IDR EQU (0xFFFE4018) ;- (SPI1) Interrupt Disable Register +AT91C_SPI1_SR EQU (0xFFFE4010) ;- (SPI1) Status Register +AT91C_SPI1_TDR EQU (0xFFFE400C) ;- (SPI1) Transmit Data Register +AT91C_SPI1_CR EQU (0xFFFE4000) ;- (SPI1) Control Register +AT91C_SPI1_CSR EQU (0xFFFE4030) ;- (SPI1) Chip Select Register +// - ========== Register definition for PDC_SPI0 peripheral ========== +AT91C_SPI0_PTCR EQU (0xFFFE0120) ;- (PDC_SPI0) PDC Transfer Control Register +AT91C_SPI0_TPR EQU (0xFFFE0108) ;- (PDC_SPI0) Transmit Pointer Register +AT91C_SPI0_TCR EQU (0xFFFE010C) ;- (PDC_SPI0) Transmit Counter Register +AT91C_SPI0_RCR EQU (0xFFFE0104) ;- (PDC_SPI0) Receive Counter Register +AT91C_SPI0_PTSR EQU (0xFFFE0124) ;- (PDC_SPI0) PDC Transfer Status Register +AT91C_SPI0_RNPR EQU (0xFFFE0110) ;- (PDC_SPI0) Receive Next Pointer Register +AT91C_SPI0_RPR EQU (0xFFFE0100) ;- (PDC_SPI0) Receive Pointer Register +AT91C_SPI0_TNCR EQU (0xFFFE011C) ;- (PDC_SPI0) Transmit Next Counter Register +AT91C_SPI0_RNCR EQU (0xFFFE0114) ;- (PDC_SPI0) Receive Next Counter Register +AT91C_SPI0_TNPR EQU (0xFFFE0118) ;- (PDC_SPI0) Transmit Next Pointer Register +// - ========== Register definition for SPI0 peripheral ========== +AT91C_SPI0_IER EQU (0xFFFE0014) ;- (SPI0) Interrupt Enable Register +AT91C_SPI0_SR EQU (0xFFFE0010) ;- (SPI0) Status Register +AT91C_SPI0_IDR EQU (0xFFFE0018) ;- (SPI0) Interrupt Disable Register +AT91C_SPI0_CR EQU (0xFFFE0000) ;- (SPI0) Control Register +AT91C_SPI0_MR EQU (0xFFFE0004) ;- (SPI0) Mode Register +AT91C_SPI0_IMR EQU (0xFFFE001C) ;- (SPI0) Interrupt Mask Register +AT91C_SPI0_TDR EQU (0xFFFE000C) ;- (SPI0) Transmit Data Register +AT91C_SPI0_RDR EQU (0xFFFE0008) ;- (SPI0) Receive Data Register +AT91C_SPI0_CSR EQU (0xFFFE0030) ;- (SPI0) Chip Select Register +// - ========== Register definition for PDC_US1 peripheral ========== +AT91C_US1_RNCR EQU (0xFFFC4114) ;- (PDC_US1) Receive Next Counter Register +AT91C_US1_PTCR EQU (0xFFFC4120) ;- (PDC_US1) PDC Transfer Control Register +AT91C_US1_TCR EQU (0xFFFC410C) ;- (PDC_US1) Transmit Counter Register +AT91C_US1_PTSR EQU (0xFFFC4124) ;- (PDC_US1) PDC Transfer Status Register +AT91C_US1_TNPR EQU (0xFFFC4118) ;- (PDC_US1) Transmit Next Pointer Register +AT91C_US1_RCR EQU (0xFFFC4104) ;- (PDC_US1) Receive Counter Register +AT91C_US1_RNPR EQU (0xFFFC4110) ;- (PDC_US1) Receive Next Pointer Register +AT91C_US1_RPR EQU (0xFFFC4100) ;- (PDC_US1) Receive Pointer Register +AT91C_US1_TNCR EQU (0xFFFC411C) ;- (PDC_US1) Transmit Next Counter Register +AT91C_US1_TPR EQU (0xFFFC4108) ;- (PDC_US1) Transmit Pointer Register +// - ========== Register definition for US1 peripheral ========== +AT91C_US1_IF EQU (0xFFFC404C) ;- (US1) IRDA_FILTER Register +AT91C_US1_NER EQU (0xFFFC4044) ;- (US1) Nb Errors Register +AT91C_US1_RTOR EQU (0xFFFC4024) ;- (US1) Receiver Time-out Register +AT91C_US1_CSR EQU (0xFFFC4014) ;- (US1) Channel Status Register +AT91C_US1_IDR EQU (0xFFFC400C) ;- (US1) Interrupt Disable Register +AT91C_US1_IER EQU (0xFFFC4008) ;- (US1) Interrupt Enable Register +AT91C_US1_THR EQU (0xFFFC401C) ;- (US1) Transmitter Holding Register +AT91C_US1_TTGR EQU (0xFFFC4028) ;- (US1) Transmitter Time-guard Register +AT91C_US1_RHR EQU (0xFFFC4018) ;- (US1) Receiver Holding Register +AT91C_US1_BRGR EQU (0xFFFC4020) ;- (US1) Baud Rate Generator Register +AT91C_US1_IMR EQU (0xFFFC4010) ;- (US1) Interrupt Mask Register +AT91C_US1_FIDI EQU (0xFFFC4040) ;- (US1) FI_DI_Ratio Register +AT91C_US1_CR EQU (0xFFFC4000) ;- (US1) Control Register +AT91C_US1_MR EQU (0xFFFC4004) ;- (US1) Mode Register +// - ========== Register definition for PDC_US0 peripheral ========== +AT91C_US0_TNPR EQU (0xFFFC0118) ;- (PDC_US0) Transmit Next Pointer Register +AT91C_US0_RNPR EQU (0xFFFC0110) ;- (PDC_US0) Receive Next Pointer Register +AT91C_US0_TCR EQU (0xFFFC010C) ;- (PDC_US0) Transmit Counter Register +AT91C_US0_PTCR EQU (0xFFFC0120) ;- (PDC_US0) PDC Transfer Control Register +AT91C_US0_PTSR EQU (0xFFFC0124) ;- (PDC_US0) PDC Transfer Status Register +AT91C_US0_TNCR EQU (0xFFFC011C) ;- (PDC_US0) Transmit Next Counter Register +AT91C_US0_TPR EQU (0xFFFC0108) ;- (PDC_US0) Transmit Pointer Register +AT91C_US0_RCR EQU (0xFFFC0104) ;- (PDC_US0) Receive Counter Register +AT91C_US0_RPR EQU (0xFFFC0100) ;- (PDC_US0) Receive Pointer Register +AT91C_US0_RNCR EQU (0xFFFC0114) ;- (PDC_US0) Receive Next Counter Register +// - ========== Register definition for US0 peripheral ========== +AT91C_US0_BRGR EQU (0xFFFC0020) ;- (US0) Baud Rate Generator Register +AT91C_US0_NER EQU (0xFFFC0044) ;- (US0) Nb Errors Register +AT91C_US0_CR EQU (0xFFFC0000) ;- (US0) Control Register +AT91C_US0_IMR EQU (0xFFFC0010) ;- (US0) Interrupt Mask Register +AT91C_US0_FIDI EQU (0xFFFC0040) ;- (US0) FI_DI_Ratio Register +AT91C_US0_TTGR EQU (0xFFFC0028) ;- (US0) Transmitter Time-guard Register +AT91C_US0_MR EQU (0xFFFC0004) ;- (US0) Mode Register +AT91C_US0_RTOR EQU (0xFFFC0024) ;- (US0) Receiver Time-out Register +AT91C_US0_CSR EQU (0xFFFC0014) ;- (US0) Channel Status Register +AT91C_US0_RHR EQU (0xFFFC0018) ;- (US0) Receiver Holding Register +AT91C_US0_IDR EQU (0xFFFC000C) ;- (US0) Interrupt Disable Register +AT91C_US0_THR EQU (0xFFFC001C) ;- (US0) Transmitter Holding Register +AT91C_US0_IF EQU (0xFFFC004C) ;- (US0) IRDA_FILTER Register +AT91C_US0_IER EQU (0xFFFC0008) ;- (US0) Interrupt Enable Register +// - ========== Register definition for PDC_SSC peripheral ========== +AT91C_SSC_TNCR EQU (0xFFFD411C) ;- (PDC_SSC) Transmit Next Counter Register +AT91C_SSC_RPR EQU (0xFFFD4100) ;- (PDC_SSC) Receive Pointer Register +AT91C_SSC_RNCR EQU (0xFFFD4114) ;- (PDC_SSC) Receive Next Counter Register +AT91C_SSC_TPR EQU (0xFFFD4108) ;- (PDC_SSC) Transmit Pointer Register +AT91C_SSC_PTCR EQU (0xFFFD4120) ;- (PDC_SSC) PDC Transfer Control Register +AT91C_SSC_TCR EQU (0xFFFD410C) ;- (PDC_SSC) Transmit Counter Register +AT91C_SSC_RCR EQU (0xFFFD4104) ;- (PDC_SSC) Receive Counter Register +AT91C_SSC_RNPR EQU (0xFFFD4110) ;- (PDC_SSC) Receive Next Pointer Register +AT91C_SSC_TNPR EQU (0xFFFD4118) ;- (PDC_SSC) Transmit Next Pointer Register +AT91C_SSC_PTSR EQU (0xFFFD4124) ;- (PDC_SSC) PDC Transfer Status Register +// - ========== Register definition for SSC peripheral ========== +AT91C_SSC_RHR EQU (0xFFFD4020) ;- (SSC) Receive Holding Register +AT91C_SSC_RSHR EQU (0xFFFD4030) ;- (SSC) Receive Sync Holding Register +AT91C_SSC_TFMR EQU (0xFFFD401C) ;- (SSC) Transmit Frame Mode Register +AT91C_SSC_IDR EQU (0xFFFD4048) ;- (SSC) Interrupt Disable Register +AT91C_SSC_THR EQU (0xFFFD4024) ;- (SSC) Transmit Holding Register +AT91C_SSC_RCMR EQU (0xFFFD4010) ;- (SSC) Receive Clock ModeRegister +AT91C_SSC_IER EQU (0xFFFD4044) ;- (SSC) Interrupt Enable Register +AT91C_SSC_TSHR EQU (0xFFFD4034) ;- (SSC) Transmit Sync Holding Register +AT91C_SSC_SR EQU (0xFFFD4040) ;- (SSC) Status Register +AT91C_SSC_CMR EQU (0xFFFD4004) ;- (SSC) Clock Mode Register +AT91C_SSC_TCMR EQU (0xFFFD4018) ;- (SSC) Transmit Clock Mode Register +AT91C_SSC_CR EQU (0xFFFD4000) ;- (SSC) Control Register +AT91C_SSC_IMR EQU (0xFFFD404C) ;- (SSC) Interrupt Mask Register +AT91C_SSC_RFMR EQU (0xFFFD4014) ;- (SSC) Receive Frame Mode Register +// - ========== Register definition for TWI peripheral ========== +AT91C_TWI_IER EQU (0xFFFB8024) ;- (TWI) Interrupt Enable Register +AT91C_TWI_CR EQU (0xFFFB8000) ;- (TWI) Control Register +AT91C_TWI_SR EQU (0xFFFB8020) ;- (TWI) Status Register +AT91C_TWI_IMR EQU (0xFFFB802C) ;- (TWI) Interrupt Mask Register +AT91C_TWI_THR EQU (0xFFFB8034) ;- (TWI) Transmit Holding Register +AT91C_TWI_IDR EQU (0xFFFB8028) ;- (TWI) Interrupt Disable Register +AT91C_TWI_IADR EQU (0xFFFB800C) ;- (TWI) Internal Address Register +AT91C_TWI_MMR EQU (0xFFFB8004) ;- (TWI) Master Mode Register +AT91C_TWI_CWGR EQU (0xFFFB8010) ;- (TWI) Clock Waveform Generator Register +AT91C_TWI_RHR EQU (0xFFFB8030) ;- (TWI) Receive Holding Register +// - ========== Register definition for PWMC_CH3 peripheral ========== +AT91C_PWMC_CH3_CUPDR EQU (0xFFFCC270) ;- (PWMC_CH3) Channel Update Register +AT91C_PWMC_CH3_Reserved EQU (0xFFFCC274) ;- (PWMC_CH3) Reserved +AT91C_PWMC_CH3_CPRDR EQU (0xFFFCC268) ;- (PWMC_CH3) Channel Period Register +AT91C_PWMC_CH3_CDTYR EQU (0xFFFCC264) ;- (PWMC_CH3) Channel Duty Cycle Register +AT91C_PWMC_CH3_CCNTR EQU (0xFFFCC26C) ;- (PWMC_CH3) Channel Counter Register +AT91C_PWMC_CH3_CMR EQU (0xFFFCC260) ;- (PWMC_CH3) Channel Mode Register +// - ========== Register definition for PWMC_CH2 peripheral ========== +AT91C_PWMC_CH2_Reserved EQU (0xFFFCC254) ;- (PWMC_CH2) Reserved +AT91C_PWMC_CH2_CMR EQU (0xFFFCC240) ;- (PWMC_CH2) Channel Mode Register +AT91C_PWMC_CH2_CCNTR EQU (0xFFFCC24C) ;- (PWMC_CH2) Channel Counter Register +AT91C_PWMC_CH2_CPRDR EQU (0xFFFCC248) ;- (PWMC_CH2) Channel Period Register +AT91C_PWMC_CH2_CUPDR EQU (0xFFFCC250) ;- (PWMC_CH2) Channel Update Register +AT91C_PWMC_CH2_CDTYR EQU (0xFFFCC244) ;- (PWMC_CH2) Channel Duty Cycle Register +// - ========== Register definition for PWMC_CH1 peripheral ========== +AT91C_PWMC_CH1_Reserved EQU (0xFFFCC234) ;- (PWMC_CH1) Reserved +AT91C_PWMC_CH1_CUPDR EQU (0xFFFCC230) ;- (PWMC_CH1) Channel Update Register +AT91C_PWMC_CH1_CPRDR EQU (0xFFFCC228) ;- (PWMC_CH1) Channel Period Register +AT91C_PWMC_CH1_CCNTR EQU (0xFFFCC22C) ;- (PWMC_CH1) Channel Counter Register +AT91C_PWMC_CH1_CDTYR EQU (0xFFFCC224) ;- (PWMC_CH1) Channel Duty Cycle Register +AT91C_PWMC_CH1_CMR EQU (0xFFFCC220) ;- (PWMC_CH1) Channel Mode Register +// - ========== Register definition for PWMC_CH0 peripheral ========== +AT91C_PWMC_CH0_Reserved EQU (0xFFFCC214) ;- (PWMC_CH0) Reserved +AT91C_PWMC_CH0_CPRDR EQU (0xFFFCC208) ;- (PWMC_CH0) Channel Period Register +AT91C_PWMC_CH0_CDTYR EQU (0xFFFCC204) ;- (PWMC_CH0) Channel Duty Cycle Register +AT91C_PWMC_CH0_CMR EQU (0xFFFCC200) ;- (PWMC_CH0) Channel Mode Register +AT91C_PWMC_CH0_CUPDR EQU (0xFFFCC210) ;- (PWMC_CH0) Channel Update Register +AT91C_PWMC_CH0_CCNTR EQU (0xFFFCC20C) ;- (PWMC_CH0) Channel Counter Register +// - ========== Register definition for PWMC peripheral ========== +AT91C_PWMC_IDR EQU (0xFFFCC014) ;- (PWMC) PWMC Interrupt Disable Register +AT91C_PWMC_DIS EQU (0xFFFCC008) ;- (PWMC) PWMC Disable Register +AT91C_PWMC_IER EQU (0xFFFCC010) ;- (PWMC) PWMC Interrupt Enable Register +AT91C_PWMC_VR EQU (0xFFFCC0FC) ;- (PWMC) PWMC Version Register +AT91C_PWMC_ISR EQU (0xFFFCC01C) ;- (PWMC) PWMC Interrupt Status Register +AT91C_PWMC_SR EQU (0xFFFCC00C) ;- (PWMC) PWMC Status Register +AT91C_PWMC_IMR EQU (0xFFFCC018) ;- (PWMC) PWMC Interrupt Mask Register +AT91C_PWMC_MR EQU (0xFFFCC000) ;- (PWMC) PWMC Mode Register +AT91C_PWMC_ENA EQU (0xFFFCC004) ;- (PWMC) PWMC Enable Register +// - ========== Register definition for UDP peripheral ========== +AT91C_UDP_IMR EQU (0xFFFB0018) ;- (UDP) Interrupt Mask Register +AT91C_UDP_FADDR EQU (0xFFFB0008) ;- (UDP) Function Address Register +AT91C_UDP_NUM EQU (0xFFFB0000) ;- (UDP) Frame Number Register +AT91C_UDP_FDR EQU (0xFFFB0050) ;- (UDP) Endpoint FIFO Data Register +AT91C_UDP_ISR EQU (0xFFFB001C) ;- (UDP) Interrupt Status Register +AT91C_UDP_CSR EQU (0xFFFB0030) ;- (UDP) Endpoint Control and Status Register +AT91C_UDP_IDR EQU (0xFFFB0014) ;- (UDP) Interrupt Disable Register +AT91C_UDP_ICR EQU (0xFFFB0020) ;- (UDP) Interrupt Clear Register +AT91C_UDP_RSTEP EQU (0xFFFB0028) ;- (UDP) Reset Endpoint Register +AT91C_UDP_TXVC EQU (0xFFFB0074) ;- (UDP) Transceiver Control Register +AT91C_UDP_GLBSTATE EQU (0xFFFB0004) ;- (UDP) Global State Register +AT91C_UDP_IER EQU (0xFFFB0010) ;- (UDP) Interrupt Enable Register +// - ========== Register definition for TC0 peripheral ========== +AT91C_TC0_SR EQU (0xFFFA0020) ;- (TC0) Status Register +AT91C_TC0_RC EQU (0xFFFA001C) ;- (TC0) Register C +AT91C_TC0_RB EQU (0xFFFA0018) ;- (TC0) Register B +AT91C_TC0_CCR EQU (0xFFFA0000) ;- (TC0) Channel Control Register +AT91C_TC0_CMR EQU (0xFFFA0004) ;- (TC0) Channel Mode Register (Capture Mode / Waveform Mode) +AT91C_TC0_IER EQU (0xFFFA0024) ;- (TC0) Interrupt Enable Register +AT91C_TC0_RA EQU (0xFFFA0014) ;- (TC0) Register A +AT91C_TC0_IDR EQU (0xFFFA0028) ;- (TC0) Interrupt Disable Register +AT91C_TC0_CV EQU (0xFFFA0010) ;- (TC0) Counter Value +AT91C_TC0_IMR EQU (0xFFFA002C) ;- (TC0) Interrupt Mask Register +// - ========== Register definition for TC1 peripheral ========== +AT91C_TC1_RB EQU (0xFFFA0058) ;- (TC1) Register B +AT91C_TC1_CCR EQU (0xFFFA0040) ;- (TC1) Channel Control Register +AT91C_TC1_IER EQU (0xFFFA0064) ;- (TC1) Interrupt Enable Register +AT91C_TC1_IDR EQU (0xFFFA0068) ;- (TC1) Interrupt Disable Register +AT91C_TC1_SR EQU (0xFFFA0060) ;- (TC1) Status Register +AT91C_TC1_CMR EQU (0xFFFA0044) ;- (TC1) Channel Mode Register (Capture Mode / Waveform Mode) +AT91C_TC1_RA EQU (0xFFFA0054) ;- (TC1) Register A +AT91C_TC1_RC EQU (0xFFFA005C) ;- (TC1) Register C +AT91C_TC1_IMR EQU (0xFFFA006C) ;- (TC1) Interrupt Mask Register +AT91C_TC1_CV EQU (0xFFFA0050) ;- (TC1) Counter Value +// - ========== Register definition for TC2 peripheral ========== +AT91C_TC2_CMR EQU (0xFFFA0084) ;- (TC2) Channel Mode Register (Capture Mode / Waveform Mode) +AT91C_TC2_CCR EQU (0xFFFA0080) ;- (TC2) Channel Control Register +AT91C_TC2_CV EQU (0xFFFA0090) ;- (TC2) Counter Value +AT91C_TC2_RA EQU (0xFFFA0094) ;- (TC2) Register A +AT91C_TC2_RB EQU (0xFFFA0098) ;- (TC2) Register B +AT91C_TC2_IDR EQU (0xFFFA00A8) ;- (TC2) Interrupt Disable Register +AT91C_TC2_IMR EQU (0xFFFA00AC) ;- (TC2) Interrupt Mask Register +AT91C_TC2_RC EQU (0xFFFA009C) ;- (TC2) Register C +AT91C_TC2_IER EQU (0xFFFA00A4) ;- (TC2) Interrupt Enable Register +AT91C_TC2_SR EQU (0xFFFA00A0) ;- (TC2) Status Register +// - ========== Register definition for TCB peripheral ========== +AT91C_TCB_BMR EQU (0xFFFA00C4) ;- (TCB) TC Block Mode Register +AT91C_TCB_BCR EQU (0xFFFA00C0) ;- (TCB) TC Block Control Register +// - ========== Register definition for CAN_MB0 peripheral ========== +AT91C_CAN_MB0_MDL EQU (0xFFFD0214) ;- (CAN_MB0) MailBox Data Low Register +AT91C_CAN_MB0_MAM EQU (0xFFFD0204) ;- (CAN_MB0) MailBox Acceptance Mask Register +AT91C_CAN_MB0_MCR EQU (0xFFFD021C) ;- (CAN_MB0) MailBox Control Register +AT91C_CAN_MB0_MID EQU (0xFFFD0208) ;- (CAN_MB0) MailBox ID Register +AT91C_CAN_MB0_MSR EQU (0xFFFD0210) ;- (CAN_MB0) MailBox Status Register +AT91C_CAN_MB0_MFID EQU (0xFFFD020C) ;- (CAN_MB0) MailBox Family ID Register +AT91C_CAN_MB0_MDH EQU (0xFFFD0218) ;- (CAN_MB0) MailBox Data High Register +AT91C_CAN_MB0_MMR EQU (0xFFFD0200) ;- (CAN_MB0) MailBox Mode Register +// - ========== Register definition for CAN_MB1 peripheral ========== +AT91C_CAN_MB1_MDL EQU (0xFFFD0234) ;- (CAN_MB1) MailBox Data Low Register +AT91C_CAN_MB1_MID EQU (0xFFFD0228) ;- (CAN_MB1) MailBox ID Register +AT91C_CAN_MB1_MMR EQU (0xFFFD0220) ;- (CAN_MB1) MailBox Mode Register +AT91C_CAN_MB1_MSR EQU (0xFFFD0230) ;- (CAN_MB1) MailBox Status Register +AT91C_CAN_MB1_MAM EQU (0xFFFD0224) ;- (CAN_MB1) MailBox Acceptance Mask Register +AT91C_CAN_MB1_MDH EQU (0xFFFD0238) ;- (CAN_MB1) MailBox Data High Register +AT91C_CAN_MB1_MCR EQU (0xFFFD023C) ;- (CAN_MB1) MailBox Control Register +AT91C_CAN_MB1_MFID EQU (0xFFFD022C) ;- (CAN_MB1) MailBox Family ID Register +// - ========== Register definition for CAN_MB2 peripheral ========== +AT91C_CAN_MB2_MCR EQU (0xFFFD025C) ;- (CAN_MB2) MailBox Control Register +AT91C_CAN_MB2_MDH EQU (0xFFFD0258) ;- (CAN_MB2) MailBox Data High Register +AT91C_CAN_MB2_MID EQU (0xFFFD0248) ;- (CAN_MB2) MailBox ID Register +AT91C_CAN_MB2_MDL EQU (0xFFFD0254) ;- (CAN_MB2) MailBox Data Low Register +AT91C_CAN_MB2_MMR EQU (0xFFFD0240) ;- (CAN_MB2) MailBox Mode Register +AT91C_CAN_MB2_MAM EQU (0xFFFD0244) ;- (CAN_MB2) MailBox Acceptance Mask Register +AT91C_CAN_MB2_MFID EQU (0xFFFD024C) ;- (CAN_MB2) MailBox Family ID Register +AT91C_CAN_MB2_MSR EQU (0xFFFD0250) ;- (CAN_MB2) MailBox Status Register +// - ========== Register definition for CAN_MB3 peripheral ========== +AT91C_CAN_MB3_MFID EQU (0xFFFD026C) ;- (CAN_MB3) MailBox Family ID Register +AT91C_CAN_MB3_MAM EQU (0xFFFD0264) ;- (CAN_MB3) MailBox Acceptance Mask Register +AT91C_CAN_MB3_MID EQU (0xFFFD0268) ;- (CAN_MB3) MailBox ID Register +AT91C_CAN_MB3_MCR EQU (0xFFFD027C) ;- (CAN_MB3) MailBox Control Register +AT91C_CAN_MB3_MMR EQU (0xFFFD0260) ;- (CAN_MB3) MailBox Mode Register +AT91C_CAN_MB3_MSR EQU (0xFFFD0270) ;- (CAN_MB3) MailBox Status Register +AT91C_CAN_MB3_MDL EQU (0xFFFD0274) ;- (CAN_MB3) MailBox Data Low Register +AT91C_CAN_MB3_MDH EQU (0xFFFD0278) ;- (CAN_MB3) MailBox Data High Register +// - ========== Register definition for CAN_MB4 peripheral ========== +AT91C_CAN_MB4_MID EQU (0xFFFD0288) ;- (CAN_MB4) MailBox ID Register +AT91C_CAN_MB4_MMR EQU (0xFFFD0280) ;- (CAN_MB4) MailBox Mode Register +AT91C_CAN_MB4_MDH EQU (0xFFFD0298) ;- (CAN_MB4) MailBox Data High Register +AT91C_CAN_MB4_MFID EQU (0xFFFD028C) ;- (CAN_MB4) MailBox Family ID Register +AT91C_CAN_MB4_MSR EQU (0xFFFD0290) ;- (CAN_MB4) MailBox Status Register +AT91C_CAN_MB4_MCR EQU (0xFFFD029C) ;- (CAN_MB4) MailBox Control Register +AT91C_CAN_MB4_MDL EQU (0xFFFD0294) ;- (CAN_MB4) MailBox Data Low Register +AT91C_CAN_MB4_MAM EQU (0xFFFD0284) ;- (CAN_MB4) MailBox Acceptance Mask Register +// - ========== Register definition for CAN_MB5 peripheral ========== +AT91C_CAN_MB5_MSR EQU (0xFFFD02B0) ;- (CAN_MB5) MailBox Status Register +AT91C_CAN_MB5_MCR EQU (0xFFFD02BC) ;- (CAN_MB5) MailBox Control Register +AT91C_CAN_MB5_MFID EQU (0xFFFD02AC) ;- (CAN_MB5) MailBox Family ID Register +AT91C_CAN_MB5_MDH EQU (0xFFFD02B8) ;- (CAN_MB5) MailBox Data High Register +AT91C_CAN_MB5_MID EQU (0xFFFD02A8) ;- (CAN_MB5) MailBox ID Register +AT91C_CAN_MB5_MMR EQU (0xFFFD02A0) ;- (CAN_MB5) MailBox Mode Register +AT91C_CAN_MB5_MDL EQU (0xFFFD02B4) ;- (CAN_MB5) MailBox Data Low Register +AT91C_CAN_MB5_MAM EQU (0xFFFD02A4) ;- (CAN_MB5) MailBox Acceptance Mask Register +// - ========== Register definition for CAN_MB6 peripheral ========== +AT91C_CAN_MB6_MFID EQU (0xFFFD02CC) ;- (CAN_MB6) MailBox Family ID Register +AT91C_CAN_MB6_MID EQU (0xFFFD02C8) ;- (CAN_MB6) MailBox ID Register +AT91C_CAN_MB6_MAM EQU (0xFFFD02C4) ;- (CAN_MB6) MailBox Acceptance Mask Register +AT91C_CAN_MB6_MSR EQU (0xFFFD02D0) ;- (CAN_MB6) MailBox Status Register +AT91C_CAN_MB6_MDL EQU (0xFFFD02D4) ;- (CAN_MB6) MailBox Data Low Register +AT91C_CAN_MB6_MCR EQU (0xFFFD02DC) ;- (CAN_MB6) MailBox Control Register +AT91C_CAN_MB6_MDH EQU (0xFFFD02D8) ;- (CAN_MB6) MailBox Data High Register +AT91C_CAN_MB6_MMR EQU (0xFFFD02C0) ;- (CAN_MB6) MailBox Mode Register +// - ========== Register definition for CAN_MB7 peripheral ========== +AT91C_CAN_MB7_MCR EQU (0xFFFD02FC) ;- (CAN_MB7) MailBox Control Register +AT91C_CAN_MB7_MDH EQU (0xFFFD02F8) ;- (CAN_MB7) MailBox Data High Register +AT91C_CAN_MB7_MFID EQU (0xFFFD02EC) ;- (CAN_MB7) MailBox Family ID Register +AT91C_CAN_MB7_MDL EQU (0xFFFD02F4) ;- (CAN_MB7) MailBox Data Low Register +AT91C_CAN_MB7_MID EQU (0xFFFD02E8) ;- (CAN_MB7) MailBox ID Register +AT91C_CAN_MB7_MMR EQU (0xFFFD02E0) ;- (CAN_MB7) MailBox Mode Register +AT91C_CAN_MB7_MAM EQU (0xFFFD02E4) ;- (CAN_MB7) MailBox Acceptance Mask Register +AT91C_CAN_MB7_MSR EQU (0xFFFD02F0) ;- (CAN_MB7) MailBox Status Register +// - ========== Register definition for CAN peripheral ========== +AT91C_CAN_TCR EQU (0xFFFD0024) ;- (CAN) Transfer Command Register +AT91C_CAN_IMR EQU (0xFFFD000C) ;- (CAN) Interrupt Mask Register +AT91C_CAN_IER EQU (0xFFFD0004) ;- (CAN) Interrupt Enable Register +AT91C_CAN_ECR EQU (0xFFFD0020) ;- (CAN) Error Counter Register +AT91C_CAN_TIMESTP EQU (0xFFFD001C) ;- (CAN) Time Stamp Register +AT91C_CAN_MR EQU (0xFFFD0000) ;- (CAN) Mode Register +AT91C_CAN_IDR EQU (0xFFFD0008) ;- (CAN) Interrupt Disable Register +AT91C_CAN_ACR EQU (0xFFFD0028) ;- (CAN) Abort Command Register +AT91C_CAN_TIM EQU (0xFFFD0018) ;- (CAN) Timer Register +AT91C_CAN_SR EQU (0xFFFD0010) ;- (CAN) Status Register +AT91C_CAN_BR EQU (0xFFFD0014) ;- (CAN) Baudrate Register +AT91C_CAN_VR EQU (0xFFFD00FC) ;- (CAN) Version Register +// - ========== Register definition for EMAC peripheral ========== +AT91C_EMAC_ISR EQU (0xFFFDC024) ;- (EMAC) Interrupt Status Register +AT91C_EMAC_SA4H EQU (0xFFFDC0B4) ;- (EMAC) Specific Address 4 Top, Last 2 bytes +AT91C_EMAC_SA1L EQU (0xFFFDC098) ;- (EMAC) Specific Address 1 Bottom, First 4 bytes +AT91C_EMAC_ELE EQU (0xFFFDC078) ;- (EMAC) Excessive Length Errors Register +AT91C_EMAC_LCOL EQU (0xFFFDC05C) ;- (EMAC) Late Collision Register +AT91C_EMAC_RLE EQU (0xFFFDC088) ;- (EMAC) Receive Length Field Mismatch Register +AT91C_EMAC_WOL EQU (0xFFFDC0C4) ;- (EMAC) Wake On LAN Register +AT91C_EMAC_DTF EQU (0xFFFDC058) ;- (EMAC) Deferred Transmission Frame Register +AT91C_EMAC_TUND EQU (0xFFFDC064) ;- (EMAC) Transmit Underrun Error Register +AT91C_EMAC_NCR EQU (0xFFFDC000) ;- (EMAC) Network Control Register +AT91C_EMAC_SA4L EQU (0xFFFDC0B0) ;- (EMAC) Specific Address 4 Bottom, First 4 bytes +AT91C_EMAC_RSR EQU (0xFFFDC020) ;- (EMAC) Receive Status Register +AT91C_EMAC_SA3L EQU (0xFFFDC0A8) ;- (EMAC) Specific Address 3 Bottom, First 4 bytes +AT91C_EMAC_TSR EQU (0xFFFDC014) ;- (EMAC) Transmit Status Register +AT91C_EMAC_IDR EQU (0xFFFDC02C) ;- (EMAC) Interrupt Disable Register +AT91C_EMAC_RSE EQU (0xFFFDC074) ;- (EMAC) Receive Symbol Errors Register +AT91C_EMAC_ECOL EQU (0xFFFDC060) ;- (EMAC) Excessive Collision Register +AT91C_EMAC_TID EQU (0xFFFDC0B8) ;- (EMAC) Type ID Checking Register +AT91C_EMAC_HRB EQU (0xFFFDC090) ;- (EMAC) Hash Address Bottom[31:0] +AT91C_EMAC_TBQP EQU (0xFFFDC01C) ;- (EMAC) Transmit Buffer Queue Pointer +AT91C_EMAC_USRIO EQU (0xFFFDC0C0) ;- (EMAC) USER Input/Output Register +AT91C_EMAC_PTR EQU (0xFFFDC038) ;- (EMAC) Pause Time Register +AT91C_EMAC_SA2H EQU (0xFFFDC0A4) ;- (EMAC) Specific Address 2 Top, Last 2 bytes +AT91C_EMAC_ROV EQU (0xFFFDC070) ;- (EMAC) Receive Overrun Errors Register +AT91C_EMAC_ALE EQU (0xFFFDC054) ;- (EMAC) Alignment Error Register +AT91C_EMAC_RJA EQU (0xFFFDC07C) ;- (EMAC) Receive Jabbers Register +AT91C_EMAC_RBQP EQU (0xFFFDC018) ;- (EMAC) Receive Buffer Queue Pointer +AT91C_EMAC_TPF EQU (0xFFFDC08C) ;- (EMAC) Transmitted Pause Frames Register +AT91C_EMAC_NCFGR EQU (0xFFFDC004) ;- (EMAC) Network Configuration Register +AT91C_EMAC_HRT EQU (0xFFFDC094) ;- (EMAC) Hash Address Top[63:32] +AT91C_EMAC_USF EQU (0xFFFDC080) ;- (EMAC) Undersize Frames Register +AT91C_EMAC_FCSE EQU (0xFFFDC050) ;- (EMAC) Frame Check Sequence Error Register +AT91C_EMAC_TPQ EQU (0xFFFDC0BC) ;- (EMAC) Transmit Pause Quantum Register +AT91C_EMAC_MAN EQU (0xFFFDC034) ;- (EMAC) PHY Maintenance Register +AT91C_EMAC_FTO EQU (0xFFFDC040) ;- (EMAC) Frames Transmitted OK Register +AT91C_EMAC_REV EQU (0xFFFDC0FC) ;- (EMAC) Revision Register +AT91C_EMAC_IMR EQU (0xFFFDC030) ;- (EMAC) Interrupt Mask Register +AT91C_EMAC_SCF EQU (0xFFFDC044) ;- (EMAC) Single Collision Frame Register +AT91C_EMAC_PFR EQU (0xFFFDC03C) ;- (EMAC) Pause Frames received Register +AT91C_EMAC_MCF EQU (0xFFFDC048) ;- (EMAC) Multiple Collision Frame Register +AT91C_EMAC_NSR EQU (0xFFFDC008) ;- (EMAC) Network Status Register +AT91C_EMAC_SA2L EQU (0xFFFDC0A0) ;- (EMAC) Specific Address 2 Bottom, First 4 bytes +AT91C_EMAC_FRO EQU (0xFFFDC04C) ;- (EMAC) Frames Received OK Register +AT91C_EMAC_IER EQU (0xFFFDC028) ;- (EMAC) Interrupt Enable Register +AT91C_EMAC_SA1H EQU (0xFFFDC09C) ;- (EMAC) Specific Address 1 Top, Last 2 bytes +AT91C_EMAC_CSE EQU (0xFFFDC068) ;- (EMAC) Carrier Sense Error Register +AT91C_EMAC_SA3H EQU (0xFFFDC0AC) ;- (EMAC) Specific Address 3 Top, Last 2 bytes +AT91C_EMAC_RRE EQU (0xFFFDC06C) ;- (EMAC) Receive Ressource Error Register +AT91C_EMAC_STE EQU (0xFFFDC084) ;- (EMAC) SQE Test Error Register +// - ========== Register definition for PDC_ADC peripheral ========== +AT91C_ADC_PTSR EQU (0xFFFD8124) ;- (PDC_ADC) PDC Transfer Status Register +AT91C_ADC_PTCR EQU (0xFFFD8120) ;- (PDC_ADC) PDC Transfer Control Register +AT91C_ADC_TNPR EQU (0xFFFD8118) ;- (PDC_ADC) Transmit Next Pointer Register +AT91C_ADC_TNCR EQU (0xFFFD811C) ;- (PDC_ADC) Transmit Next Counter Register +AT91C_ADC_RNPR EQU (0xFFFD8110) ;- (PDC_ADC) Receive Next Pointer Register +AT91C_ADC_RNCR EQU (0xFFFD8114) ;- (PDC_ADC) Receive Next Counter Register +AT91C_ADC_RPR EQU (0xFFFD8100) ;- (PDC_ADC) Receive Pointer Register +AT91C_ADC_TCR EQU (0xFFFD810C) ;- (PDC_ADC) Transmit Counter Register +AT91C_ADC_TPR EQU (0xFFFD8108) ;- (PDC_ADC) Transmit Pointer Register +AT91C_ADC_RCR EQU (0xFFFD8104) ;- (PDC_ADC) Receive Counter Register +// - ========== Register definition for ADC peripheral ========== +AT91C_ADC_CDR2 EQU (0xFFFD8038) ;- (ADC) ADC Channel Data Register 2 +AT91C_ADC_CDR3 EQU (0xFFFD803C) ;- (ADC) ADC Channel Data Register 3 +AT91C_ADC_CDR0 EQU (0xFFFD8030) ;- (ADC) ADC Channel Data Register 0 +AT91C_ADC_CDR5 EQU (0xFFFD8044) ;- (ADC) ADC Channel Data Register 5 +AT91C_ADC_CHDR EQU (0xFFFD8014) ;- (ADC) ADC Channel Disable Register +AT91C_ADC_SR EQU (0xFFFD801C) ;- (ADC) ADC Status Register +AT91C_ADC_CDR4 EQU (0xFFFD8040) ;- (ADC) ADC Channel Data Register 4 +AT91C_ADC_CDR1 EQU (0xFFFD8034) ;- (ADC) ADC Channel Data Register 1 +AT91C_ADC_LCDR EQU (0xFFFD8020) ;- (ADC) ADC Last Converted Data Register +AT91C_ADC_IDR EQU (0xFFFD8028) ;- (ADC) ADC Interrupt Disable Register +AT91C_ADC_CR EQU (0xFFFD8000) ;- (ADC) ADC Control Register +AT91C_ADC_CDR7 EQU (0xFFFD804C) ;- (ADC) ADC Channel Data Register 7 +AT91C_ADC_CDR6 EQU (0xFFFD8048) ;- (ADC) ADC Channel Data Register 6 +AT91C_ADC_IER EQU (0xFFFD8024) ;- (ADC) ADC Interrupt Enable Register +AT91C_ADC_CHER EQU (0xFFFD8010) ;- (ADC) ADC Channel Enable Register +AT91C_ADC_CHSR EQU (0xFFFD8018) ;- (ADC) ADC Channel Status Register +AT91C_ADC_MR EQU (0xFFFD8004) ;- (ADC) ADC Mode Register +AT91C_ADC_IMR EQU (0xFFFD802C) ;- (ADC) ADC Interrupt Mask Register + +// - ***************************************************************************** +// - PIO DEFINITIONS FOR AT91SAM7X256 +// - ***************************************************************************** +AT91C_PIO_PA0 EQU (1 << 0) ;- Pin Controlled by PA0 +AT91C_PA0_RXD0 EQU (AT91C_PIO_PA0) ;- USART 0 Receive Data +AT91C_PIO_PA1 EQU (1 << 1) ;- Pin Controlled by PA1 +AT91C_PA1_TXD0 EQU (AT91C_PIO_PA1) ;- USART 0 Transmit Data +AT91C_PIO_PA10 EQU (1 << 10) ;- Pin Controlled by PA10 +AT91C_PA10_TWD EQU (AT91C_PIO_PA10) ;- TWI Two-wire Serial Data +AT91C_PIO_PA11 EQU (1 << 11) ;- Pin Controlled by PA11 +AT91C_PA11_TWCK EQU (AT91C_PIO_PA11) ;- TWI Two-wire Serial Clock +AT91C_PIO_PA12 EQU (1 << 12) ;- Pin Controlled by PA12 +AT91C_PA12_SPI0_NPCS0 EQU (AT91C_PIO_PA12) ;- SPI 0 Peripheral Chip Select 0 +AT91C_PIO_PA13 EQU (1 << 13) ;- Pin Controlled by PA13 +AT91C_PA13_SPI0_NPCS1 EQU (AT91C_PIO_PA13) ;- SPI 0 Peripheral Chip Select 1 +AT91C_PA13_PCK1 EQU (AT91C_PIO_PA13) ;- PMC Programmable Clock Output 1 +AT91C_PIO_PA14 EQU (1 << 14) ;- Pin Controlled by PA14 +AT91C_PA14_SPI0_NPCS2 EQU (AT91C_PIO_PA14) ;- SPI 0 Peripheral Chip Select 2 +AT91C_PA14_IRQ1 EQU (AT91C_PIO_PA14) ;- External Interrupt 1 +AT91C_PIO_PA15 EQU (1 << 15) ;- Pin Controlled by PA15 +AT91C_PA15_SPI0_NPCS3 EQU (AT91C_PIO_PA15) ;- SPI 0 Peripheral Chip Select 3 +AT91C_PA15_TCLK2 EQU (AT91C_PIO_PA15) ;- Timer Counter 2 external clock input +AT91C_PIO_PA16 EQU (1 << 16) ;- Pin Controlled by PA16 +AT91C_PA16_SPI0_MISO EQU (AT91C_PIO_PA16) ;- SPI 0 Master In Slave +AT91C_PIO_PA17 EQU (1 << 17) ;- Pin Controlled by PA17 +AT91C_PA17_SPI0_MOSI EQU (AT91C_PIO_PA17) ;- SPI 0 Master Out Slave +AT91C_PIO_PA18 EQU (1 << 18) ;- Pin Controlled by PA18 +AT91C_PA18_SPI0_SPCK EQU (AT91C_PIO_PA18) ;- SPI 0 Serial Clock +AT91C_PIO_PA19 EQU (1 << 19) ;- Pin Controlled by PA19 +AT91C_PA19_CANRX EQU (AT91C_PIO_PA19) ;- CAN Receive +AT91C_PIO_PA2 EQU (1 << 2) ;- Pin Controlled by PA2 +AT91C_PA2_SCK0 EQU (AT91C_PIO_PA2) ;- USART 0 Serial Clock +AT91C_PA2_SPI1_NPCS1 EQU (AT91C_PIO_PA2) ;- SPI 1 Peripheral Chip Select 1 +AT91C_PIO_PA20 EQU (1 << 20) ;- Pin Controlled by PA20 +AT91C_PA20_CANTX EQU (AT91C_PIO_PA20) ;- CAN Transmit +AT91C_PIO_PA21 EQU (1 << 21) ;- Pin Controlled by PA21 +AT91C_PA21_TF EQU (AT91C_PIO_PA21) ;- SSC Transmit Frame Sync +AT91C_PA21_SPI1_NPCS0 EQU (AT91C_PIO_PA21) ;- SPI 1 Peripheral Chip Select 0 +AT91C_PIO_PA22 EQU (1 << 22) ;- Pin Controlled by PA22 +AT91C_PA22_TK EQU (AT91C_PIO_PA22) ;- SSC Transmit Clock +AT91C_PA22_SPI1_SPCK EQU (AT91C_PIO_PA22) ;- SPI 1 Serial Clock +AT91C_PIO_PA23 EQU (1 << 23) ;- Pin Controlled by PA23 +AT91C_PA23_TD EQU (AT91C_PIO_PA23) ;- SSC Transmit data +AT91C_PA23_SPI1_MOSI EQU (AT91C_PIO_PA23) ;- SPI 1 Master Out Slave +AT91C_PIO_PA24 EQU (1 << 24) ;- Pin Controlled by PA24 +AT91C_PA24_RD EQU (AT91C_PIO_PA24) ;- SSC Receive Data +AT91C_PA24_SPI1_MISO EQU (AT91C_PIO_PA24) ;- SPI 1 Master In Slave +AT91C_PIO_PA25 EQU (1 << 25) ;- Pin Controlled by PA25 +AT91C_PA25_RK EQU (AT91C_PIO_PA25) ;- SSC Receive Clock +AT91C_PA25_SPI1_NPCS1 EQU (AT91C_PIO_PA25) ;- SPI 1 Peripheral Chip Select 1 +AT91C_PIO_PA26 EQU (1 << 26) ;- Pin Controlled by PA26 +AT91C_PA26_RF EQU (AT91C_PIO_PA26) ;- SSC Receive Frame Sync +AT91C_PA26_SPI1_NPCS2 EQU (AT91C_PIO_PA26) ;- SPI 1 Peripheral Chip Select 2 +AT91C_PIO_PA27 EQU (1 << 27) ;- Pin Controlled by PA27 +AT91C_PA27_DRXD EQU (AT91C_PIO_PA27) ;- DBGU Debug Receive Data +AT91C_PA27_PCK3 EQU (AT91C_PIO_PA27) ;- PMC Programmable Clock Output 3 +AT91C_PIO_PA28 EQU (1 << 28) ;- Pin Controlled by PA28 +AT91C_PA28_DTXD EQU (AT91C_PIO_PA28) ;- DBGU Debug Transmit Data +AT91C_PIO_PA29 EQU (1 << 29) ;- Pin Controlled by PA29 +AT91C_PA29_FIQ EQU (AT91C_PIO_PA29) ;- AIC Fast Interrupt Input +AT91C_PA29_SPI1_NPCS3 EQU (AT91C_PIO_PA29) ;- SPI 1 Peripheral Chip Select 3 +AT91C_PIO_PA3 EQU (1 << 3) ;- Pin Controlled by PA3 +AT91C_PA3_RTS0 EQU (AT91C_PIO_PA3) ;- USART 0 Ready To Send +AT91C_PA3_SPI1_NPCS2 EQU (AT91C_PIO_PA3) ;- SPI 1 Peripheral Chip Select 2 +AT91C_PIO_PA30 EQU (1 << 30) ;- Pin Controlled by PA30 +AT91C_PA30_IRQ0 EQU (AT91C_PIO_PA30) ;- External Interrupt 0 +AT91C_PA30_PCK2 EQU (AT91C_PIO_PA30) ;- PMC Programmable Clock Output 2 +AT91C_PIO_PA4 EQU (1 << 4) ;- Pin Controlled by PA4 +AT91C_PA4_CTS0 EQU (AT91C_PIO_PA4) ;- USART 0 Clear To Send +AT91C_PA4_SPI1_NPCS3 EQU (AT91C_PIO_PA4) ;- SPI 1 Peripheral Chip Select 3 +AT91C_PIO_PA5 EQU (1 << 5) ;- Pin Controlled by PA5 +AT91C_PA5_RXD1 EQU (AT91C_PIO_PA5) ;- USART 1 Receive Data +AT91C_PIO_PA6 EQU (1 << 6) ;- Pin Controlled by PA6 +AT91C_PA6_TXD1 EQU (AT91C_PIO_PA6) ;- USART 1 Transmit Data +AT91C_PIO_PA7 EQU (1 << 7) ;- Pin Controlled by PA7 +AT91C_PA7_SCK1 EQU (AT91C_PIO_PA7) ;- USART 1 Serial Clock +AT91C_PA7_SPI0_NPCS1 EQU (AT91C_PIO_PA7) ;- SPI 0 Peripheral Chip Select 1 +AT91C_PIO_PA8 EQU (1 << 8) ;- Pin Controlled by PA8 +AT91C_PA8_RTS1 EQU (AT91C_PIO_PA8) ;- USART 1 Ready To Send +AT91C_PA8_SPI0_NPCS2 EQU (AT91C_PIO_PA8) ;- SPI 0 Peripheral Chip Select 2 +AT91C_PIO_PA9 EQU (1 << 9) ;- Pin Controlled by PA9 +AT91C_PA9_CTS1 EQU (AT91C_PIO_PA9) ;- USART 1 Clear To Send +AT91C_PA9_SPI0_NPCS3 EQU (AT91C_PIO_PA9) ;- SPI 0 Peripheral Chip Select 3 +AT91C_PIO_PB0 EQU (1 << 0) ;- Pin Controlled by PB0 +AT91C_PB0_ETXCK_EREFCK EQU (AT91C_PIO_PB0) ;- Ethernet MAC Transmit Clock/Reference Clock +AT91C_PB0_PCK0 EQU (AT91C_PIO_PB0) ;- PMC Programmable Clock Output 0 +AT91C_PIO_PB1 EQU (1 << 1) ;- Pin Controlled by PB1 +AT91C_PB1_ETXEN EQU (AT91C_PIO_PB1) ;- Ethernet MAC Transmit Enable +AT91C_PIO_PB10 EQU (1 << 10) ;- Pin Controlled by PB10 +AT91C_PB10_ETX2 EQU (AT91C_PIO_PB10) ;- Ethernet MAC Transmit Data 2 +AT91C_PB10_SPI1_NPCS1 EQU (AT91C_PIO_PB10) ;- SPI 1 Peripheral Chip Select 1 +AT91C_PIO_PB11 EQU (1 << 11) ;- Pin Controlled by PB11 +AT91C_PB11_ETX3 EQU (AT91C_PIO_PB11) ;- Ethernet MAC Transmit Data 3 +AT91C_PB11_SPI1_NPCS2 EQU (AT91C_PIO_PB11) ;- SPI 1 Peripheral Chip Select 2 +AT91C_PIO_PB12 EQU (1 << 12) ;- Pin Controlled by PB12 +AT91C_PB12_ETXER EQU (AT91C_PIO_PB12) ;- Ethernet MAC Transmikt Coding Error +AT91C_PB12_TCLK0 EQU (AT91C_PIO_PB12) ;- Timer Counter 0 external clock input +AT91C_PIO_PB13 EQU (1 << 13) ;- Pin Controlled by PB13 +AT91C_PB13_ERX2 EQU (AT91C_PIO_PB13) ;- Ethernet MAC Receive Data 2 +AT91C_PB13_SPI0_NPCS1 EQU (AT91C_PIO_PB13) ;- SPI 0 Peripheral Chip Select 1 +AT91C_PIO_PB14 EQU (1 << 14) ;- Pin Controlled by PB14 +AT91C_PB14_ERX3 EQU (AT91C_PIO_PB14) ;- Ethernet MAC Receive Data 3 +AT91C_PB14_SPI0_NPCS2 EQU (AT91C_PIO_PB14) ;- SPI 0 Peripheral Chip Select 2 +AT91C_PIO_PB15 EQU (1 << 15) ;- Pin Controlled by PB15 +AT91C_PB15_ERXDV_ECRSDV EQU (AT91C_PIO_PB15) ;- Ethernet MAC Receive Data Valid +AT91C_PIO_PB16 EQU (1 << 16) ;- Pin Controlled by PB16 +AT91C_PB16_ECOL EQU (AT91C_PIO_PB16) ;- Ethernet MAC Collision Detected +AT91C_PB16_SPI1_NPCS3 EQU (AT91C_PIO_PB16) ;- SPI 1 Peripheral Chip Select 3 +AT91C_PIO_PB17 EQU (1 << 17) ;- Pin Controlled by PB17 +AT91C_PB17_ERXCK EQU (AT91C_PIO_PB17) ;- Ethernet MAC Receive Clock +AT91C_PB17_SPI0_NPCS3 EQU (AT91C_PIO_PB17) ;- SPI 0 Peripheral Chip Select 3 +AT91C_PIO_PB18 EQU (1 << 18) ;- Pin Controlled by PB18 +AT91C_PB18_EF100 EQU (AT91C_PIO_PB18) ;- Ethernet MAC Force 100 Mbits/sec +AT91C_PB18_ADTRG EQU (AT91C_PIO_PB18) ;- ADC External Trigger +AT91C_PIO_PB19 EQU (1 << 19) ;- Pin Controlled by PB19 +AT91C_PB19_PWM0 EQU (AT91C_PIO_PB19) ;- PWM Channel 0 +AT91C_PB19_TCLK1 EQU (AT91C_PIO_PB19) ;- Timer Counter 1 external clock input +AT91C_PIO_PB2 EQU (1 << 2) ;- Pin Controlled by PB2 +AT91C_PB2_ETX0 EQU (AT91C_PIO_PB2) ;- Ethernet MAC Transmit Data 0 +AT91C_PIO_PB20 EQU (1 << 20) ;- Pin Controlled by PB20 +AT91C_PB20_PWM1 EQU (AT91C_PIO_PB20) ;- PWM Channel 1 +AT91C_PB20_PCK0 EQU (AT91C_PIO_PB20) ;- PMC Programmable Clock Output 0 +AT91C_PIO_PB21 EQU (1 << 21) ;- Pin Controlled by PB21 +AT91C_PB21_PWM2 EQU (AT91C_PIO_PB21) ;- PWM Channel 2 +AT91C_PB21_PCK1 EQU (AT91C_PIO_PB21) ;- PMC Programmable Clock Output 1 +AT91C_PIO_PB22 EQU (1 << 22) ;- Pin Controlled by PB22 +AT91C_PB22_PWM3 EQU (AT91C_PIO_PB22) ;- PWM Channel 3 +AT91C_PB22_PCK2 EQU (AT91C_PIO_PB22) ;- PMC Programmable Clock Output 2 +AT91C_PIO_PB23 EQU (1 << 23) ;- Pin Controlled by PB23 +AT91C_PB23_TIOA0 EQU (AT91C_PIO_PB23) ;- Timer Counter 0 Multipurpose Timer I/O Pin A +AT91C_PB23_DCD1 EQU (AT91C_PIO_PB23) ;- USART 1 Data Carrier Detect +AT91C_PIO_PB24 EQU (1 << 24) ;- Pin Controlled by PB24 +AT91C_PB24_TIOB0 EQU (AT91C_PIO_PB24) ;- Timer Counter 0 Multipurpose Timer I/O Pin B +AT91C_PB24_DSR1 EQU (AT91C_PIO_PB24) ;- USART 1 Data Set ready +AT91C_PIO_PB25 EQU (1 << 25) ;- Pin Controlled by PB25 +AT91C_PB25_TIOA1 EQU (AT91C_PIO_PB25) ;- Timer Counter 1 Multipurpose Timer I/O Pin A +AT91C_PB25_DTR1 EQU (AT91C_PIO_PB25) ;- USART 1 Data Terminal ready +AT91C_PIO_PB26 EQU (1 << 26) ;- Pin Controlled by PB26 +AT91C_PB26_TIOB1 EQU (AT91C_PIO_PB26) ;- Timer Counter 1 Multipurpose Timer I/O Pin B +AT91C_PB26_RI1 EQU (AT91C_PIO_PB26) ;- USART 1 Ring Indicator +AT91C_PIO_PB27 EQU (1 << 27) ;- Pin Controlled by PB27 +AT91C_PB27_TIOA2 EQU (AT91C_PIO_PB27) ;- Timer Counter 2 Multipurpose Timer I/O Pin A +AT91C_PB27_PWM0 EQU (AT91C_PIO_PB27) ;- PWM Channel 0 +AT91C_PIO_PB28 EQU (1 << 28) ;- Pin Controlled by PB28 +AT91C_PB28_TIOB2 EQU (AT91C_PIO_PB28) ;- Timer Counter 2 Multipurpose Timer I/O Pin B +AT91C_PB28_PWM1 EQU (AT91C_PIO_PB28) ;- PWM Channel 1 +AT91C_PIO_PB29 EQU (1 << 29) ;- Pin Controlled by PB29 +AT91C_PB29_PCK1 EQU (AT91C_PIO_PB29) ;- PMC Programmable Clock Output 1 +AT91C_PB29_PWM2 EQU (AT91C_PIO_PB29) ;- PWM Channel 2 +AT91C_PIO_PB3 EQU (1 << 3) ;- Pin Controlled by PB3 +AT91C_PB3_ETX1 EQU (AT91C_PIO_PB3) ;- Ethernet MAC Transmit Data 1 +AT91C_PIO_PB30 EQU (1 << 30) ;- Pin Controlled by PB30 +AT91C_PB30_PCK2 EQU (AT91C_PIO_PB30) ;- PMC Programmable Clock Output 2 +AT91C_PB30_PWM3 EQU (AT91C_PIO_PB30) ;- PWM Channel 3 +AT91C_PIO_PB4 EQU (1 << 4) ;- Pin Controlled by PB4 +AT91C_PB4_ECRS EQU (AT91C_PIO_PB4) ;- Ethernet MAC Carrier Sense/Carrier Sense and Data Valid +AT91C_PIO_PB5 EQU (1 << 5) ;- Pin Controlled by PB5 +AT91C_PB5_ERX0 EQU (AT91C_PIO_PB5) ;- Ethernet MAC Receive Data 0 +AT91C_PIO_PB6 EQU (1 << 6) ;- Pin Controlled by PB6 +AT91C_PB6_ERX1 EQU (AT91C_PIO_PB6) ;- Ethernet MAC Receive Data 1 +AT91C_PIO_PB7 EQU (1 << 7) ;- Pin Controlled by PB7 +AT91C_PB7_ERXER EQU (AT91C_PIO_PB7) ;- Ethernet MAC Receive Error +AT91C_PIO_PB8 EQU (1 << 8) ;- Pin Controlled by PB8 +AT91C_PB8_EMDC EQU (AT91C_PIO_PB8) ;- Ethernet MAC Management Data Clock +AT91C_PIO_PB9 EQU (1 << 9) ;- Pin Controlled by PB9 +AT91C_PB9_EMDIO EQU (AT91C_PIO_PB9) ;- Ethernet MAC Management Data Input/Output + +// - ***************************************************************************** +// - PERIPHERAL ID DEFINITIONS FOR AT91SAM7X256 +// - ***************************************************************************** +AT91C_ID_FIQ EQU ( 0) ;- Advanced Interrupt Controller (FIQ) +AT91C_ID_SYS EQU ( 1) ;- System Peripheral +AT91C_ID_PIOA EQU ( 2) ;- Parallel IO Controller A +AT91C_ID_PIOB EQU ( 3) ;- Parallel IO Controller B +AT91C_ID_SPI0 EQU ( 4) ;- Serial Peripheral Interface 0 +AT91C_ID_SPI1 EQU ( 5) ;- Serial Peripheral Interface 1 +AT91C_ID_US0 EQU ( 6) ;- USART 0 +AT91C_ID_US1 EQU ( 7) ;- USART 1 +AT91C_ID_SSC EQU ( 8) ;- Serial Synchronous Controller +AT91C_ID_TWI EQU ( 9) ;- Two-Wire Interface +AT91C_ID_PWMC EQU (10) ;- PWM Controller +AT91C_ID_UDP EQU (11) ;- USB Device Port +AT91C_ID_TC0 EQU (12) ;- Timer Counter 0 +AT91C_ID_TC1 EQU (13) ;- Timer Counter 1 +AT91C_ID_TC2 EQU (14) ;- Timer Counter 2 +AT91C_ID_CAN EQU (15) ;- Control Area Network Controller +AT91C_ID_EMAC EQU (16) ;- Ethernet MAC +AT91C_ID_ADC EQU (17) ;- Analog-to-Digital Converter +AT91C_ID_18_Reserved EQU (18) ;- Reserved +AT91C_ID_19_Reserved EQU (19) ;- Reserved +AT91C_ID_20_Reserved EQU (20) ;- Reserved +AT91C_ID_21_Reserved EQU (21) ;- Reserved +AT91C_ID_22_Reserved EQU (22) ;- Reserved +AT91C_ID_23_Reserved EQU (23) ;- Reserved +AT91C_ID_24_Reserved EQU (24) ;- Reserved +AT91C_ID_25_Reserved EQU (25) ;- Reserved +AT91C_ID_26_Reserved EQU (26) ;- Reserved +AT91C_ID_27_Reserved EQU (27) ;- Reserved +AT91C_ID_28_Reserved EQU (28) ;- Reserved +AT91C_ID_29_Reserved EQU (29) ;- Reserved +AT91C_ID_IRQ0 EQU (30) ;- Advanced Interrupt Controller (IRQ0) +AT91C_ID_IRQ1 EQU (31) ;- Advanced Interrupt Controller (IRQ1) +AT91C_ALL_INT EQU (0xC003FFFF) ;- ALL VALID INTERRUPTS + +// - ***************************************************************************** +// - BASE ADDRESS DEFINITIONS FOR AT91SAM7X256 +// - ***************************************************************************** +AT91C_BASE_SYS EQU (0xFFFFF000) ;- (SYS) Base Address +AT91C_BASE_AIC EQU (0xFFFFF000) ;- (AIC) Base Address +AT91C_BASE_PDC_DBGU EQU (0xFFFFF300) ;- (PDC_DBGU) Base Address +AT91C_BASE_DBGU EQU (0xFFFFF200) ;- (DBGU) Base Address +AT91C_BASE_PIOA EQU (0xFFFFF400) ;- (PIOA) Base Address +AT91C_BASE_PIOB EQU (0xFFFFF600) ;- (PIOB) Base Address +AT91C_BASE_CKGR EQU (0xFFFFFC20) ;- (CKGR) Base Address +AT91C_BASE_PMC EQU (0xFFFFFC00) ;- (PMC) Base Address +AT91C_BASE_RSTC EQU (0xFFFFFD00) ;- (RSTC) Base Address +AT91C_BASE_RTTC EQU (0xFFFFFD20) ;- (RTTC) Base Address +AT91C_BASE_PITC EQU (0xFFFFFD30) ;- (PITC) Base Address +AT91C_BASE_WDTC EQU (0xFFFFFD40) ;- (WDTC) Base Address +AT91C_BASE_VREG EQU (0xFFFFFD60) ;- (VREG) Base Address +AT91C_BASE_MC EQU (0xFFFFFF00) ;- (MC) Base Address +AT91C_BASE_PDC_SPI1 EQU (0xFFFE4100) ;- (PDC_SPI1) Base Address +AT91C_BASE_SPI1 EQU (0xFFFE4000) ;- (SPI1) Base Address +AT91C_BASE_PDC_SPI0 EQU (0xFFFE0100) ;- (PDC_SPI0) Base Address +AT91C_BASE_SPI0 EQU (0xFFFE0000) ;- (SPI0) Base Address +AT91C_BASE_PDC_US1 EQU (0xFFFC4100) ;- (PDC_US1) Base Address +AT91C_BASE_US1 EQU (0xFFFC4000) ;- (US1) Base Address +AT91C_BASE_PDC_US0 EQU (0xFFFC0100) ;- (PDC_US0) Base Address +AT91C_BASE_US0 EQU (0xFFFC0000) ;- (US0) Base Address +AT91C_BASE_PDC_SSC EQU (0xFFFD4100) ;- (PDC_SSC) Base Address +AT91C_BASE_SSC EQU (0xFFFD4000) ;- (SSC) Base Address +AT91C_BASE_TWI EQU (0xFFFB8000) ;- (TWI) Base Address +AT91C_BASE_PWMC_CH3 EQU (0xFFFCC260) ;- (PWMC_CH3) Base Address +AT91C_BASE_PWMC_CH2 EQU (0xFFFCC240) ;- (PWMC_CH2) Base Address +AT91C_BASE_PWMC_CH1 EQU (0xFFFCC220) ;- (PWMC_CH1) Base Address +AT91C_BASE_PWMC_CH0 EQU (0xFFFCC200) ;- (PWMC_CH0) Base Address +AT91C_BASE_PWMC EQU (0xFFFCC000) ;- (PWMC) Base Address +AT91C_BASE_UDP EQU (0xFFFB0000) ;- (UDP) Base Address +AT91C_BASE_TC0 EQU (0xFFFA0000) ;- (TC0) Base Address +AT91C_BASE_TC1 EQU (0xFFFA0040) ;- (TC1) Base Address +AT91C_BASE_TC2 EQU (0xFFFA0080) ;- (TC2) Base Address +AT91C_BASE_TCB EQU (0xFFFA0000) ;- (TCB) Base Address +AT91C_BASE_CAN_MB0 EQU (0xFFFD0200) ;- (CAN_MB0) Base Address +AT91C_BASE_CAN_MB1 EQU (0xFFFD0220) ;- (CAN_MB1) Base Address +AT91C_BASE_CAN_MB2 EQU (0xFFFD0240) ;- (CAN_MB2) Base Address +AT91C_BASE_CAN_MB3 EQU (0xFFFD0260) ;- (CAN_MB3) Base Address +AT91C_BASE_CAN_MB4 EQU (0xFFFD0280) ;- (CAN_MB4) Base Address +AT91C_BASE_CAN_MB5 EQU (0xFFFD02A0) ;- (CAN_MB5) Base Address +AT91C_BASE_CAN_MB6 EQU (0xFFFD02C0) ;- (CAN_MB6) Base Address +AT91C_BASE_CAN_MB7 EQU (0xFFFD02E0) ;- (CAN_MB7) Base Address +AT91C_BASE_CAN EQU (0xFFFD0000) ;- (CAN) Base Address +AT91C_BASE_EMAC EQU (0xFFFDC000) ;- (EMAC) Base Address +AT91C_BASE_PDC_ADC EQU (0xFFFD8100) ;- (PDC_ADC) Base Address +AT91C_BASE_ADC EQU (0xFFFD8000) ;- (ADC) Base Address + +// - ***************************************************************************** +// - MEMORY MAPPING DEFINITIONS FOR AT91SAM7X256 +// - ***************************************************************************** +// - ISRAM +AT91C_ISRAM EQU (0x00200000) ;- Internal SRAM base address +AT91C_ISRAM_SIZE EQU (0x00010000) ;- Internal SRAM size in byte (64 Kbytes) +// - IFLASH +AT91C_IFLASH EQU (0x00100000) ;- Internal FLASH base address +AT91C_IFLASH_SIZE EQU (0x00040000) ;- Internal FLASH size in byte (256 Kbytes) +AT91C_IFLASH_PAGE_SIZE EQU (256) ;- Internal FLASH Page Size: 256 bytes +AT91C_IFLASH_LOCK_REGION_SIZE EQU (16384) ;- Internal FLASH Lock Region Size: 16 Kbytes +AT91C_IFLASH_NB_OF_PAGES EQU (1024) ;- Internal FLASH Number of Pages: 1024 bytes +AT91C_IFLASH_NB_OF_LOCK_BITS EQU (16) ;- Internal FLASH Number of Lock Bits: 16 bytes +#endif /* __IAR_SYSTEMS_ASM__ */ + + +#endif /* AT91SAM7X256_H */ diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/lib_AT91SAM7X256.h b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/lib_AT91SAM7X256.h new file mode 100644 index 0000000..95492d0 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/lib_AT91SAM7X256.h @@ -0,0 +1,4211 @@ +//* ---------------------------------------------------------------------------- +//* ATMEL Microcontroller Software Support - ROUSSET - +//* ---------------------------------------------------------------------------- +//* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +//* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +//* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +//* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +//* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +//* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +//* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +//* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +//* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +//* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +//* ---------------------------------------------------------------------------- +//* File Name : lib_AT91SAM7X256.h +//* Object : AT91SAM7X256 inlined functions +//* Generated : AT91 SW Application Group 11/02/2005 (15:17:24) +//* +//* CVS Reference : /lib_dbgu.h/1.1/Thu Aug 25 12:56:22 2005// +//* CVS Reference : /lib_pmc_SAM7X.h/1.4/Tue Aug 30 13:00:36 2005// +//* CVS Reference : /lib_VREG_6085B.h/1.1/Tue Feb 1 16:20:47 2005// +//* CVS Reference : /lib_rstc_6098A.h/1.1/Wed Oct 6 10:39:20 2004// +//* CVS Reference : /lib_ssc.h/1.4/Fri Jan 31 12:19:20 2003// +//* CVS Reference : /lib_wdtc_6080A.h/1.1/Wed Oct 6 10:38:30 2004// +//* CVS Reference : /lib_usart.h/1.5/Thu Nov 21 16:01:54 2002// +//* CVS Reference : /lib_spi2.h/1.2/Tue Aug 23 15:37:28 2005// +//* CVS Reference : /lib_pitc_6079A.h/1.2/Tue Nov 9 14:43:56 2004// +//* CVS Reference : /lib_aic_6075b.h/1.2/Thu Jul 7 07:48:22 2005// +//* CVS Reference : /lib_twi.h/1.3/Mon Jul 19 14:27:58 2004// +//* CVS Reference : /lib_adc.h/1.6/Fri Oct 17 09:12:38 2003// +//* CVS Reference : /lib_rttc_6081A.h/1.1/Wed Oct 6 10:39:38 2004// +//* CVS Reference : /lib_udp.h/1.5/Tue Aug 30 12:13:47 2005// +//* CVS Reference : /lib_tc_1753b.h/1.1/Fri Jan 31 12:20:02 2003// +//* CVS Reference : /lib_MC_SAM7X.h/1.1/Thu Mar 25 15:19:14 2004// +//* CVS Reference : /lib_pio.h/1.3/Fri Jan 31 12:18:56 2003// +//* CVS Reference : /lib_can_AT91.h/1.5/Tue Aug 23 15:37:07 2005// +//* CVS Reference : /lib_PWM_SAM.h/1.3/Thu Jan 22 10:10:50 2004// +//* CVS Reference : /lib_pdc.h/1.2/Tue Jul 2 13:29:40 2002// +//* ---------------------------------------------------------------------------- + +#ifndef lib_AT91SAM7X256_H +#define lib_AT91SAM7X256_H + +/* ***************************************************************************** + SOFTWARE API FOR AIC + ***************************************************************************** */ +#define AT91C_AIC_BRANCH_OPCODE ((void (*) ()) 0xE51FFF20) // ldr, pc, [pc, #-&F20] + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_ConfigureIt +//* \brief Interrupt Handler Initialization +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_AIC_ConfigureIt ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id, // \arg interrupt number to initialize + unsigned int priority, // \arg priority to give to the interrupt + unsigned int src_type, // \arg activation and sense of activation + void (*newHandler) () ) // \arg address of the interrupt handler +{ + unsigned int oldHandler; + unsigned int mask ; + + oldHandler = pAic->AIC_SVR[irq_id]; + + mask = 0x1 << irq_id ; + //* Disable the interrupt on the interrupt controller + pAic->AIC_IDCR = mask ; + //* Save the interrupt handler routine pointer and the interrupt priority + pAic->AIC_SVR[irq_id] = (unsigned int) newHandler ; + //* Store the Source Mode Register + pAic->AIC_SMR[irq_id] = src_type | priority ; + //* Clear the interrupt on the interrupt controller + pAic->AIC_ICCR = mask ; + + return oldHandler; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_EnableIt +//* \brief Enable corresponding IT number +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_EnableIt ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id ) // \arg interrupt number to initialize +{ + //* Enable the interrupt on the interrupt controller + pAic->AIC_IECR = 0x1 << irq_id ; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_DisableIt +//* \brief Disable corresponding IT number +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_DisableIt ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id ) // \arg interrupt number to initialize +{ + unsigned int mask = 0x1 << irq_id; + //* Disable the interrupt on the interrupt controller + pAic->AIC_IDCR = mask ; + //* Clear the interrupt on the Interrupt Controller ( if one is pending ) + pAic->AIC_ICCR = mask ; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_ClearIt +//* \brief Clear corresponding IT number +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_ClearIt ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id) // \arg interrupt number to initialize +{ + //* Clear the interrupt on the Interrupt Controller ( if one is pending ) + pAic->AIC_ICCR = (0x1 << irq_id); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_AcknowledgeIt +//* \brief Acknowledge corresponding IT number +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_AcknowledgeIt ( + AT91PS_AIC pAic) // \arg pointer to the AIC registers +{ + pAic->AIC_EOICR = pAic->AIC_EOICR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_SetExceptionVector +//* \brief Configure vector handler +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_AIC_SetExceptionVector ( + unsigned int *pVector, // \arg pointer to the AIC registers + void (*Handler) () ) // \arg Interrupt Handler +{ + unsigned int oldVector = *pVector; + + if ((unsigned int) Handler == (unsigned int) AT91C_AIC_BRANCH_OPCODE) + *pVector = (unsigned int) AT91C_AIC_BRANCH_OPCODE; + else + *pVector = (((((unsigned int) Handler) - ((unsigned int) pVector) - 0x8) >> 2) & 0x00FFFFFF) | 0xEA000000; + + return oldVector; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_Trig +//* \brief Trig an IT +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_Trig ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id) // \arg interrupt number +{ + pAic->AIC_ISCR = (0x1 << irq_id) ; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_IsActive +//* \brief Test if an IT is active +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_AIC_IsActive ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id) // \arg Interrupt Number +{ + return (pAic->AIC_ISR & (0x1 << irq_id)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_IsPending +//* \brief Test if an IT is pending +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_AIC_IsPending ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id) // \arg Interrupt Number +{ + return (pAic->AIC_IPR & (0x1 << irq_id)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_Open +//* \brief Set exception vectors and AIC registers to default values +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_Open( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + void (*IrqHandler) (), // \arg Default IRQ vector exception + void (*FiqHandler) (), // \arg Default FIQ vector exception + void (*DefaultHandler) (), // \arg Default Handler set in ISR + void (*SpuriousHandler) (), // \arg Default Spurious Handler + unsigned int protectMode) // \arg Debug Control Register +{ + int i; + + // Disable all interrupts and set IVR to the default handler + for (i = 0; i < 32; ++i) { + AT91F_AIC_DisableIt(pAic, i); + AT91F_AIC_ConfigureIt(pAic, i, AT91C_AIC_PRIOR_LOWEST, AT91C_AIC_SRCTYPE_HIGH_LEVEL, DefaultHandler); + } + + // Set the IRQ exception vector + AT91F_AIC_SetExceptionVector((unsigned int *) 0x18, IrqHandler); + // Set the Fast Interrupt exception vector + AT91F_AIC_SetExceptionVector((unsigned int *) 0x1C, FiqHandler); + + pAic->AIC_SPU = (unsigned int) SpuriousHandler; + pAic->AIC_DCR = protectMode; +} +/* ***************************************************************************** + SOFTWARE API FOR PDC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_SetNextRx +//* \brief Set the next receive transfer descriptor +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_SetNextRx ( + AT91PS_PDC pPDC, // \arg pointer to a PDC controller + char *address, // \arg address to the next bloc to be received + unsigned int bytes) // \arg number of bytes to be received +{ + pPDC->PDC_RNPR = (unsigned int) address; + pPDC->PDC_RNCR = bytes; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_SetNextTx +//* \brief Set the next transmit transfer descriptor +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_SetNextTx ( + AT91PS_PDC pPDC, // \arg pointer to a PDC controller + char *address, // \arg address to the next bloc to be transmitted + unsigned int bytes) // \arg number of bytes to be transmitted +{ + pPDC->PDC_TNPR = (unsigned int) address; + pPDC->PDC_TNCR = bytes; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_SetRx +//* \brief Set the receive transfer descriptor +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_SetRx ( + AT91PS_PDC pPDC, // \arg pointer to a PDC controller + char *address, // \arg address to the next bloc to be received + unsigned int bytes) // \arg number of bytes to be received +{ + pPDC->PDC_RPR = (unsigned int) address; + pPDC->PDC_RCR = bytes; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_SetTx +//* \brief Set the transmit transfer descriptor +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_SetTx ( + AT91PS_PDC pPDC, // \arg pointer to a PDC controller + char *address, // \arg address to the next bloc to be transmitted + unsigned int bytes) // \arg number of bytes to be transmitted +{ + pPDC->PDC_TPR = (unsigned int) address; + pPDC->PDC_TCR = bytes; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_EnableTx +//* \brief Enable transmit +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_EnableTx ( + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + pPDC->PDC_PTCR = AT91C_PDC_TXTEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_EnableRx +//* \brief Enable receive +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_EnableRx ( + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + pPDC->PDC_PTCR = AT91C_PDC_RXTEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_DisableTx +//* \brief Disable transmit +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_DisableTx ( + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + pPDC->PDC_PTCR = AT91C_PDC_TXTDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_DisableRx +//* \brief Disable receive +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_DisableRx ( + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + pPDC->PDC_PTCR = AT91C_PDC_RXTDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_IsTxEmpty +//* \brief Test if the current transfer descriptor has been sent +//*---------------------------------------------------------------------------- +__inline int AT91F_PDC_IsTxEmpty ( // \return return 1 if transfer is complete + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + return !(pPDC->PDC_TCR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_IsNextTxEmpty +//* \brief Test if the next transfer descriptor has been moved to the current td +//*---------------------------------------------------------------------------- +__inline int AT91F_PDC_IsNextTxEmpty ( // \return return 1 if transfer is complete + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + return !(pPDC->PDC_TNCR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_IsRxEmpty +//* \brief Test if the current transfer descriptor has been filled +//*---------------------------------------------------------------------------- +__inline int AT91F_PDC_IsRxEmpty ( // \return return 1 if transfer is complete + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + return !(pPDC->PDC_RCR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_IsNextRxEmpty +//* \brief Test if the next transfer descriptor has been moved to the current td +//*---------------------------------------------------------------------------- +__inline int AT91F_PDC_IsNextRxEmpty ( // \return return 1 if transfer is complete + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + return !(pPDC->PDC_RNCR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_Open +//* \brief Open PDC: disable TX and RX reset transfer descriptors, re-enable RX and TX +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_Open ( + AT91PS_PDC pPDC) // \arg pointer to a PDC controller +{ + //* Disable the RX and TX PDC transfer requests + AT91F_PDC_DisableRx(pPDC); + AT91F_PDC_DisableTx(pPDC); + + //* Reset all Counter register Next buffer first + AT91F_PDC_SetNextTx(pPDC, (char *) 0, 0); + AT91F_PDC_SetNextRx(pPDC, (char *) 0, 0); + AT91F_PDC_SetTx(pPDC, (char *) 0, 0); + AT91F_PDC_SetRx(pPDC, (char *) 0, 0); + + //* Enable the RX and TX PDC transfer requests + AT91F_PDC_EnableRx(pPDC); + AT91F_PDC_EnableTx(pPDC); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_Close +//* \brief Close PDC: disable TX and RX reset transfer descriptors +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_Close ( + AT91PS_PDC pPDC) // \arg pointer to a PDC controller +{ + //* Disable the RX and TX PDC transfer requests + AT91F_PDC_DisableRx(pPDC); + AT91F_PDC_DisableTx(pPDC); + + //* Reset all Counter register Next buffer first + AT91F_PDC_SetNextTx(pPDC, (char *) 0, 0); + AT91F_PDC_SetNextRx(pPDC, (char *) 0, 0); + AT91F_PDC_SetTx(pPDC, (char *) 0, 0); + AT91F_PDC_SetRx(pPDC, (char *) 0, 0); + +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_SendFrame +//* \brief Close PDC: disable TX and RX reset transfer descriptors +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PDC_SendFrame( + AT91PS_PDC pPDC, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + if (AT91F_PDC_IsTxEmpty(pPDC)) { + //* Buffer and next buffer can be initialized + AT91F_PDC_SetTx(pPDC, pBuffer, szBuffer); + AT91F_PDC_SetNextTx(pPDC, pNextBuffer, szNextBuffer); + return 2; + } + else if (AT91F_PDC_IsNextTxEmpty(pPDC)) { + //* Only one buffer can be initialized + AT91F_PDC_SetNextTx(pPDC, pBuffer, szBuffer); + return 1; + } + else { + //* All buffer are in use... + return 0; + } +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_ReceiveFrame +//* \brief Close PDC: disable TX and RX reset transfer descriptors +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PDC_ReceiveFrame ( + AT91PS_PDC pPDC, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + if (AT91F_PDC_IsRxEmpty(pPDC)) { + //* Buffer and next buffer can be initialized + AT91F_PDC_SetRx(pPDC, pBuffer, szBuffer); + AT91F_PDC_SetNextRx(pPDC, pNextBuffer, szNextBuffer); + return 2; + } + else if (AT91F_PDC_IsNextRxEmpty(pPDC)) { + //* Only one buffer can be initialized + AT91F_PDC_SetNextRx(pPDC, pBuffer, szBuffer); + return 1; + } + else { + //* All buffer are in use... + return 0; + } +} +/* ***************************************************************************** + SOFTWARE API FOR DBGU + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_DBGU_InterruptEnable +//* \brief Enable DBGU Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_DBGU_InterruptEnable( + AT91PS_DBGU pDbgu, // \arg pointer to a DBGU controller + unsigned int flag) // \arg dbgu interrupt to be enabled +{ + pDbgu->DBGU_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_DBGU_InterruptDisable +//* \brief Disable DBGU Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_DBGU_InterruptDisable( + AT91PS_DBGU pDbgu, // \arg pointer to a DBGU controller + unsigned int flag) // \arg dbgu interrupt to be disabled +{ + pDbgu->DBGU_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_DBGU_GetInterruptMaskStatus +//* \brief Return DBGU Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_DBGU_GetInterruptMaskStatus( // \return DBGU Interrupt Mask Status + AT91PS_DBGU pDbgu) // \arg pointer to a DBGU controller +{ + return pDbgu->DBGU_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_DBGU_IsInterruptMasked +//* \brief Test if DBGU Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_DBGU_IsInterruptMasked( + AT91PS_DBGU pDbgu, // \arg pointer to a DBGU controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_DBGU_GetInterruptMaskStatus(pDbgu) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR PIO + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgPeriph +//* \brief Enable pins to be drived by peripheral +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgPeriph( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int periphAEnable, // \arg PERIPH A to enable + unsigned int periphBEnable) // \arg PERIPH B to enable + +{ + pPio->PIO_ASR = periphAEnable; + pPio->PIO_BSR = periphBEnable; + pPio->PIO_PDR = (periphAEnable | periphBEnable); // Set in Periph mode +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgOutput +//* \brief Enable PIO in output mode +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgOutput( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int pioEnable) // \arg PIO to be enabled +{ + pPio->PIO_PER = pioEnable; // Set in PIO mode + pPio->PIO_OER = pioEnable; // Configure in Output +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgInput +//* \brief Enable PIO in input mode +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgInput( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int inputEnable) // \arg PIO to be enabled +{ + // Disable output + pPio->PIO_ODR = inputEnable; + pPio->PIO_PER = inputEnable; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgOpendrain +//* \brief Configure PIO in open drain +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgOpendrain( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int multiDrvEnable) // \arg pio to be configured in open drain +{ + // Configure the multi-drive option + pPio->PIO_MDDR = ~multiDrvEnable; + pPio->PIO_MDER = multiDrvEnable; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgPullup +//* \brief Enable pullup on PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgPullup( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int pullupEnable) // \arg enable pullup on PIO +{ + // Connect or not Pullup + pPio->PIO_PPUDR = ~pullupEnable; + pPio->PIO_PPUER = pullupEnable; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgDirectDrive +//* \brief Enable direct drive on PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgDirectDrive( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int directDrive) // \arg PIO to be configured with direct drive + +{ + // Configure the Direct Drive + pPio->PIO_OWDR = ~directDrive; + pPio->PIO_OWER = directDrive; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgInputFilter +//* \brief Enable input filter on input PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgInputFilter( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int inputFilter) // \arg PIO to be configured with input filter + +{ + // Configure the Direct Drive + pPio->PIO_IFDR = ~inputFilter; + pPio->PIO_IFER = inputFilter; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetInput +//* \brief Return PIO input value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetInput( // \return PIO input + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_PDSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsInputSet +//* \brief Test if PIO is input flag is active +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsInputSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetInput(pPio) & flag); +} + + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_SetOutput +//* \brief Set to 1 output PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_SetOutput( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg output to be set +{ + pPio->PIO_SODR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_ClearOutput +//* \brief Set to 0 output PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_ClearOutput( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg output to be cleared +{ + pPio->PIO_CODR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_ForceOutput +//* \brief Force output when Direct drive option is enabled +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_ForceOutput( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg output to be forced +{ + pPio->PIO_ODSR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_Enable +//* \brief Enable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_Enable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio to be enabled +{ + pPio->PIO_PER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_Disable +//* \brief Disable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_Disable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio to be disabled +{ + pPio->PIO_PDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetStatus +//* \brief Return PIO Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetStatus( // \return PIO Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_PSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsSet +//* \brief Test if PIO is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_OutputEnable +//* \brief Output Enable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_OutputEnable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio output to be enabled +{ + pPio->PIO_OER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_OutputDisable +//* \brief Output Enable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_OutputDisable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio output to be disabled +{ + pPio->PIO_ODR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetOutputStatus +//* \brief Return PIO Output Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetOutputStatus( // \return PIO Output Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_OSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsOuputSet +//* \brief Test if PIO Output is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsOutputSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetOutputStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_InputFilterEnable +//* \brief Input Filter Enable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_InputFilterEnable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio input filter to be enabled +{ + pPio->PIO_IFER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_InputFilterDisable +//* \brief Input Filter Disable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_InputFilterDisable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio input filter to be disabled +{ + pPio->PIO_IFDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetInputFilterStatus +//* \brief Return PIO Input Filter Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetInputFilterStatus( // \return PIO Input Filter Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_IFSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsInputFilterSet +//* \brief Test if PIO Input filter is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsInputFilterSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetInputFilterStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetOutputDataStatus +//* \brief Return PIO Output Data Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetOutputDataStatus( // \return PIO Output Data Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_ODSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_InterruptEnable +//* \brief Enable PIO Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_InterruptEnable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio interrupt to be enabled +{ + pPio->PIO_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_InterruptDisable +//* \brief Disable PIO Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_InterruptDisable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio interrupt to be disabled +{ + pPio->PIO_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetInterruptMaskStatus +//* \brief Return PIO Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetInterruptMaskStatus( // \return PIO Interrupt Mask Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetInterruptStatus +//* \brief Return PIO Interrupt Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetInterruptStatus( // \return PIO Interrupt Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_ISR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsInterruptMasked +//* \brief Test if PIO Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsInterruptMasked( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetInterruptMaskStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsInterruptSet +//* \brief Test if PIO Interrupt is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsInterruptSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetInterruptStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_MultiDriverEnable +//* \brief Multi Driver Enable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_MultiDriverEnable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio to be enabled +{ + pPio->PIO_MDER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_MultiDriverDisable +//* \brief Multi Driver Disable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_MultiDriverDisable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio to be disabled +{ + pPio->PIO_MDDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetMultiDriverStatus +//* \brief Return PIO Multi Driver Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetMultiDriverStatus( // \return PIO Multi Driver Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_MDSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsMultiDriverSet +//* \brief Test if PIO MultiDriver is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsMultiDriverSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetMultiDriverStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_A_RegisterSelection +//* \brief PIO A Register Selection +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_A_RegisterSelection( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio A register selection +{ + pPio->PIO_ASR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_B_RegisterSelection +//* \brief PIO B Register Selection +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_B_RegisterSelection( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio B register selection +{ + pPio->PIO_BSR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_Get_AB_RegisterStatus +//* \brief Return PIO Interrupt Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_Get_AB_RegisterStatus( // \return PIO AB Register Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_ABSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsAB_RegisterSet +//* \brief Test if PIO AB Register is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsAB_RegisterSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_Get_AB_RegisterStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_OutputWriteEnable +//* \brief Output Write Enable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_OutputWriteEnable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio output write to be enabled +{ + pPio->PIO_OWER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_OutputWriteDisable +//* \brief Output Write Disable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_OutputWriteDisable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio output write to be disabled +{ + pPio->PIO_OWDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetOutputWriteStatus +//* \brief Return PIO Output Write Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetOutputWriteStatus( // \return PIO Output Write Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_OWSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsOutputWriteSet +//* \brief Test if PIO OutputWrite is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsOutputWriteSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetOutputWriteStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetCfgPullup +//* \brief Return PIO Configuration Pullup +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetCfgPullup( // \return PIO Configuration Pullup + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_PPUSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsOutputDataStatusSet +//* \brief Test if PIO Output Data Status is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsOutputDataStatusSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetOutputDataStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsCfgPullupStatusSet +//* \brief Test if PIO Configuration Pullup Status is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsCfgPullupStatusSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (~AT91F_PIO_GetCfgPullup(pPio) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR PMC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_CfgSysClkEnableReg +//* \brief Configure the System Clock Enable Register of the PMC controller +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_CfgSysClkEnableReg ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int mode) +{ + //* Write to the SCER register + pPMC->PMC_SCER = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_CfgSysClkDisableReg +//* \brief Configure the System Clock Disable Register of the PMC controller +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_CfgSysClkDisableReg ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int mode) +{ + //* Write to the SCDR register + pPMC->PMC_SCDR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_GetSysClkStatusReg +//* \brief Return the System Clock Status Register of the PMC controller +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_GetSysClkStatusReg ( + AT91PS_PMC pPMC // pointer to a CAN controller + ) +{ + return pPMC->PMC_SCSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_EnablePeriphClock +//* \brief Enable peripheral clock +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_EnablePeriphClock ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int periphIds) // \arg IDs of peripherals to enable +{ + pPMC->PMC_PCER = periphIds; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_DisablePeriphClock +//* \brief Disable peripheral clock +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_DisablePeriphClock ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int periphIds) // \arg IDs of peripherals to enable +{ + pPMC->PMC_PCDR = periphIds; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_GetPeriphClock +//* \brief Get peripheral clock status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_GetPeriphClock ( + AT91PS_PMC pPMC) // \arg pointer to PMC controller +{ + return pPMC->PMC_PCSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_CfgMainOscillatorReg +//* \brief Cfg the main oscillator +//*---------------------------------------------------------------------------- +__inline void AT91F_CKGR_CfgMainOscillatorReg ( + AT91PS_CKGR pCKGR, // \arg pointer to CKGR controller + unsigned int mode) +{ + pCKGR->CKGR_MOR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_GetMainOscillatorReg +//* \brief Cfg the main oscillator +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CKGR_GetMainOscillatorReg ( + AT91PS_CKGR pCKGR) // \arg pointer to CKGR controller +{ + return pCKGR->CKGR_MOR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_EnableMainOscillator +//* \brief Enable the main oscillator +//*---------------------------------------------------------------------------- +__inline void AT91F_CKGR_EnableMainOscillator( + AT91PS_CKGR pCKGR) // \arg pointer to CKGR controller +{ + pCKGR->CKGR_MOR |= AT91C_CKGR_MOSCEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_DisableMainOscillator +//* \brief Disable the main oscillator +//*---------------------------------------------------------------------------- +__inline void AT91F_CKGR_DisableMainOscillator ( + AT91PS_CKGR pCKGR) // \arg pointer to CKGR controller +{ + pCKGR->CKGR_MOR &= ~AT91C_CKGR_MOSCEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_CfgMainOscStartUpTime +//* \brief Cfg MOR Register according to the main osc startup time +//*---------------------------------------------------------------------------- +__inline void AT91F_CKGR_CfgMainOscStartUpTime ( + AT91PS_CKGR pCKGR, // \arg pointer to CKGR controller + unsigned int startup_time, // \arg main osc startup time in microsecond (us) + unsigned int slowClock) // \arg slowClock in Hz +{ + pCKGR->CKGR_MOR &= ~AT91C_CKGR_OSCOUNT; + pCKGR->CKGR_MOR |= ((slowClock * startup_time)/(8*1000000)) << 8; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_GetMainClockFreqReg +//* \brief Cfg the main oscillator +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CKGR_GetMainClockFreqReg ( + AT91PS_CKGR pCKGR) // \arg pointer to CKGR controller +{ + return pCKGR->CKGR_MCFR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_GetMainClock +//* \brief Return Main clock in Hz +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CKGR_GetMainClock ( + AT91PS_CKGR pCKGR, // \arg pointer to CKGR controller + unsigned int slowClock) // \arg slowClock in Hz +{ + return ((pCKGR->CKGR_MCFR & AT91C_CKGR_MAINF) * slowClock) >> 4; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_CfgMCKReg +//* \brief Cfg Master Clock Register +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_CfgMCKReg ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int mode) +{ + pPMC->PMC_MCKR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_GetMCKReg +//* \brief Return Master Clock Register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_GetMCKReg( + AT91PS_PMC pPMC) // \arg pointer to PMC controller +{ + return pPMC->PMC_MCKR; +} + +//*------------------------------------------------------------------------------ +//* \fn AT91F_PMC_GetMasterClock +//* \brief Return master clock in Hz which correponds to processor clock for ARM7 +//*------------------------------------------------------------------------------ +__inline unsigned int AT91F_PMC_GetMasterClock ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + AT91PS_CKGR pCKGR, // \arg pointer to CKGR controller + unsigned int slowClock) // \arg slowClock in Hz +{ + unsigned int reg = pPMC->PMC_MCKR; + unsigned int prescaler = (1 << ((reg & AT91C_PMC_PRES) >> 2)); + unsigned int pllDivider, pllMultiplier; + + switch (reg & AT91C_PMC_CSS) { + case AT91C_PMC_CSS_SLOW_CLK: // Slow clock selected + return slowClock / prescaler; + case AT91C_PMC_CSS_MAIN_CLK: // Main clock is selected + return AT91F_CKGR_GetMainClock(pCKGR, slowClock) / prescaler; + case AT91C_PMC_CSS_PLL_CLK: // PLLB clock is selected + reg = pCKGR->CKGR_PLLR; + pllDivider = (reg & AT91C_CKGR_DIV); + pllMultiplier = ((reg & AT91C_CKGR_MUL) >> 16) + 1; + return AT91F_CKGR_GetMainClock(pCKGR, slowClock) / pllDivider * pllMultiplier / prescaler; + } + return 0; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_EnablePCK +//* \brief Enable peripheral clock +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_EnablePCK ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int pck, // \arg Peripheral clock identifier 0 .. 7 + unsigned int mode) +{ + pPMC->PMC_PCKR[pck] = mode; + pPMC->PMC_SCER = (1 << pck) << 8; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_DisablePCK +//* \brief Enable peripheral clock +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_DisablePCK ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int pck) // \arg Peripheral clock identifier 0 .. 7 +{ + pPMC->PMC_SCDR = (1 << pck) << 8; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_EnableIt +//* \brief Enable PMC interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_EnableIt ( + AT91PS_PMC pPMC, // pointer to a PMC controller + unsigned int flag) // IT to be enabled +{ + //* Write to the IER register + pPMC->PMC_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_DisableIt +//* \brief Disable PMC interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_DisableIt ( + AT91PS_PMC pPMC, // pointer to a PMC controller + unsigned int flag) // IT to be disabled +{ + //* Write to the IDR register + pPMC->PMC_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_GetStatus +//* \brief Return PMC Interrupt Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_GetStatus( // \return PMC Interrupt Status + AT91PS_PMC pPMC) // pointer to a PMC controller +{ + return pPMC->PMC_SR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_GetInterruptMaskStatus +//* \brief Return PMC Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_GetInterruptMaskStatus( // \return PMC Interrupt Mask Status + AT91PS_PMC pPMC) // pointer to a PMC controller +{ + return pPMC->PMC_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_IsInterruptMasked +//* \brief Test if PMC Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_IsInterruptMasked( + AT91PS_PMC pPMC, // \arg pointer to a PMC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PMC_GetInterruptMaskStatus(pPMC) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_IsStatusSet +//* \brief Test if PMC Status is Set +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_IsStatusSet( + AT91PS_PMC pPMC, // \arg pointer to a PMC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PMC_GetStatus(pPMC) & flag); +} + +// ---------------------------------------------------------------------------- +// \fn AT91F_CKGR_CfgPLLReg +// \brief Cfg the PLL Register +// ---------------------------------------------------------------------------- +__inline void AT91F_CKGR_CfgPLLReg ( + AT91PS_CKGR pCKGR, // \arg pointer to CKGR controller + unsigned int mode) +{ + pCKGR->CKGR_PLLR = mode; +} + +// ---------------------------------------------------------------------------- +// \fn AT91F_CKGR_GetPLLReg +// \brief Get the PLL Register +// ---------------------------------------------------------------------------- +__inline unsigned int AT91F_CKGR_GetPLLReg ( + AT91PS_CKGR pCKGR) // \arg pointer to CKGR controller +{ + return pCKGR->CKGR_PLLR; +} + + +/* ***************************************************************************** + SOFTWARE API FOR RSTC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_RSTSoftReset +//* \brief Start Software Reset +//*---------------------------------------------------------------------------- +__inline void AT91F_RSTSoftReset( + AT91PS_RSTC pRSTC, + unsigned int reset) +{ + pRSTC->RSTC_RCR = (0xA5000000 | reset); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_RSTSetMode +//* \brief Set Reset Mode +//*---------------------------------------------------------------------------- +__inline void AT91F_RSTSetMode( + AT91PS_RSTC pRSTC, + unsigned int mode) +{ + pRSTC->RSTC_RMR = (0xA5000000 | mode); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_RSTGetMode +//* \brief Get Reset Mode +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_RSTGetMode( + AT91PS_RSTC pRSTC) +{ + return (pRSTC->RSTC_RMR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_RSTGetStatus +//* \brief Get Reset Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_RSTGetStatus( + AT91PS_RSTC pRSTC) +{ + return (pRSTC->RSTC_RSR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_RSTIsSoftRstActive +//* \brief Return !=0 if software reset is still not completed +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_RSTIsSoftRstActive( + AT91PS_RSTC pRSTC) +{ + return ((pRSTC->RSTC_RSR) & AT91C_RSTC_SRCMP); +} +/* ***************************************************************************** + SOFTWARE API FOR RTTC + ***************************************************************************** */ +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_SetRTT_TimeBase() +//* \brief Set the RTT prescaler according to the TimeBase in ms +//*-------------------------------------------------------------------------------------- +__inline unsigned int AT91F_RTTSetTimeBase( + AT91PS_RTTC pRTTC, + unsigned int ms) +{ + if (ms > 2000) + return 1; // AT91C_TIME_OUT_OF_RANGE + pRTTC->RTTC_RTMR &= ~0xFFFF; + pRTTC->RTTC_RTMR |= (((ms << 15) /1000) & 0xFFFF); + return 0; +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTTSetPrescaler() +//* \brief Set the new prescaler value +//*-------------------------------------------------------------------------------------- +__inline unsigned int AT91F_RTTSetPrescaler( + AT91PS_RTTC pRTTC, + unsigned int rtpres) +{ + pRTTC->RTTC_RTMR &= ~0xFFFF; + pRTTC->RTTC_RTMR |= (rtpres & 0xFFFF); + return (pRTTC->RTTC_RTMR); +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTTRestart() +//* \brief Restart the RTT prescaler +//*-------------------------------------------------------------------------------------- +__inline void AT91F_RTTRestart( + AT91PS_RTTC pRTTC) +{ + pRTTC->RTTC_RTMR |= AT91C_RTTC_RTTRST; +} + + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_SetAlarmINT() +//* \brief Enable RTT Alarm Interrupt +//*-------------------------------------------------------------------------------------- +__inline void AT91F_RTTSetAlarmINT( + AT91PS_RTTC pRTTC) +{ + pRTTC->RTTC_RTMR |= AT91C_RTTC_ALMIEN; +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_ClearAlarmINT() +//* \brief Disable RTT Alarm Interrupt +//*-------------------------------------------------------------------------------------- +__inline void AT91F_RTTClearAlarmINT( + AT91PS_RTTC pRTTC) +{ + pRTTC->RTTC_RTMR &= ~AT91C_RTTC_ALMIEN; +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_SetRttIncINT() +//* \brief Enable RTT INC Interrupt +//*-------------------------------------------------------------------------------------- +__inline void AT91F_RTTSetRttIncINT( + AT91PS_RTTC pRTTC) +{ + pRTTC->RTTC_RTMR |= AT91C_RTTC_RTTINCIEN; +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_ClearRttIncINT() +//* \brief Disable RTT INC Interrupt +//*-------------------------------------------------------------------------------------- +__inline void AT91F_RTTClearRttIncINT( + AT91PS_RTTC pRTTC) +{ + pRTTC->RTTC_RTMR &= ~AT91C_RTTC_RTTINCIEN; +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_SetAlarmValue() +//* \brief Set RTT Alarm Value +//*-------------------------------------------------------------------------------------- +__inline void AT91F_RTTSetAlarmValue( + AT91PS_RTTC pRTTC, unsigned int alarm) +{ + pRTTC->RTTC_RTAR = alarm; +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_GetAlarmValue() +//* \brief Get RTT Alarm Value +//*-------------------------------------------------------------------------------------- +__inline unsigned int AT91F_RTTGetAlarmValue( + AT91PS_RTTC pRTTC) +{ + return(pRTTC->RTTC_RTAR); +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTTGetStatus() +//* \brief Read the RTT status +//*-------------------------------------------------------------------------------------- +__inline unsigned int AT91F_RTTGetStatus( + AT91PS_RTTC pRTTC) +{ + return(pRTTC->RTTC_RTSR); +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_ReadValue() +//* \brief Read the RTT value +//*-------------------------------------------------------------------------------------- +__inline unsigned int AT91F_RTTReadValue( + AT91PS_RTTC pRTTC) +{ + register volatile unsigned int val1,val2; + do + { + val1 = pRTTC->RTTC_RTVR; + val2 = pRTTC->RTTC_RTVR; + } + while(val1 != val2); + return(val1); +} +/* ***************************************************************************** + SOFTWARE API FOR PITC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITInit +//* \brief System timer init : period in µsecond, system clock freq in MHz +//*---------------------------------------------------------------------------- +__inline void AT91F_PITInit( + AT91PS_PITC pPITC, + unsigned int period, + unsigned int pit_frequency) +{ + pPITC->PITC_PIMR = period? (period * pit_frequency + 8) >> 4 : 0; // +8 to avoid %10 and /10 + pPITC->PITC_PIMR |= AT91C_PITC_PITEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITSetPIV +//* \brief Set the PIT Periodic Interval Value +//*---------------------------------------------------------------------------- +__inline void AT91F_PITSetPIV( + AT91PS_PITC pPITC, + unsigned int piv) +{ + pPITC->PITC_PIMR = piv | (pPITC->PITC_PIMR & (AT91C_PITC_PITEN | AT91C_PITC_PITIEN)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITEnableInt +//* \brief Enable PIT periodic interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PITEnableInt( + AT91PS_PITC pPITC) +{ + pPITC->PITC_PIMR |= AT91C_PITC_PITIEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITDisableInt +//* \brief Disable PIT periodic interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PITDisableInt( + AT91PS_PITC pPITC) +{ + pPITC->PITC_PIMR &= ~AT91C_PITC_PITIEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITGetMode +//* \brief Read PIT mode register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PITGetMode( + AT91PS_PITC pPITC) +{ + return(pPITC->PITC_PIMR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITGetStatus +//* \brief Read PIT status register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PITGetStatus( + AT91PS_PITC pPITC) +{ + return(pPITC->PITC_PISR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITGetPIIR +//* \brief Read PIT CPIV and PICNT without ressetting the counters +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PITGetPIIR( + AT91PS_PITC pPITC) +{ + return(pPITC->PITC_PIIR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITGetPIVR +//* \brief Read System timer CPIV and PICNT without ressetting the counters +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PITGetPIVR( + AT91PS_PITC pPITC) +{ + return(pPITC->PITC_PIVR); +} +/* ***************************************************************************** + SOFTWARE API FOR WDTC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_WDTSetMode +//* \brief Set Watchdog Mode Register +//*---------------------------------------------------------------------------- +__inline void AT91F_WDTSetMode( + AT91PS_WDTC pWDTC, + unsigned int Mode) +{ + pWDTC->WDTC_WDMR = Mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_WDTRestart +//* \brief Restart Watchdog +//*---------------------------------------------------------------------------- +__inline void AT91F_WDTRestart( + AT91PS_WDTC pWDTC) +{ + pWDTC->WDTC_WDCR = 0xA5000001; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_WDTSGettatus +//* \brief Get Watchdog Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_WDTSGettatus( + AT91PS_WDTC pWDTC) +{ + return(pWDTC->WDTC_WDSR & 0x3); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_WDTGetPeriod +//* \brief Translate ms into Watchdog Compatible value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_WDTGetPeriod(unsigned int ms) +{ + if ((ms < 4) || (ms > 16000)) + return 0; + return((ms << 8) / 1000); +} +/* ***************************************************************************** + SOFTWARE API FOR VREG + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_VREG_Enable_LowPowerMode +//* \brief Enable VREG Low Power Mode +//*---------------------------------------------------------------------------- +__inline void AT91F_VREG_Enable_LowPowerMode( + AT91PS_VREG pVREG) +{ + pVREG->VREG_MR |= AT91C_VREG_PSTDBY; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_VREG_Disable_LowPowerMode +//* \brief Disable VREG Low Power Mode +//*---------------------------------------------------------------------------- +__inline void AT91F_VREG_Disable_LowPowerMode( + AT91PS_VREG pVREG) +{ + pVREG->VREG_MR &= ~AT91C_VREG_PSTDBY; +}/* ***************************************************************************** + SOFTWARE API FOR MC + ***************************************************************************** */ + +#define AT91C_MC_CORRECT_KEY ((unsigned int) 0x5A << 24) // (MC) Correct Protect Key + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_Remap +//* \brief Make Remap +//*---------------------------------------------------------------------------- +__inline void AT91F_MC_Remap (void) // +{ + AT91PS_MC pMC = (AT91PS_MC) AT91C_BASE_MC; + + pMC->MC_RCR = AT91C_MC_RCB; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_CfgModeReg +//* \brief Configure the EFC Mode Register of the MC controller +//*---------------------------------------------------------------------------- +__inline void AT91F_MC_EFC_CfgModeReg ( + AT91PS_MC pMC, // pointer to a MC controller + unsigned int mode) // mode register +{ + // Write to the FMR register + pMC->MC_FMR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_GetModeReg +//* \brief Return MC EFC Mode Regsiter +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_MC_EFC_GetModeReg( + AT91PS_MC pMC) // pointer to a MC controller +{ + return pMC->MC_FMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_ComputeFMCN +//* \brief Return MC EFC Mode Regsiter +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_MC_EFC_ComputeFMCN( + int master_clock) // master clock in Hz +{ + return (master_clock/1000000 +2); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_PerformCmd +//* \brief Perform EFC Command +//*---------------------------------------------------------------------------- +__inline void AT91F_MC_EFC_PerformCmd ( + AT91PS_MC pMC, // pointer to a MC controller + unsigned int transfer_cmd) +{ + pMC->MC_FCR = transfer_cmd; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_GetStatus +//* \brief Return MC EFC Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_MC_EFC_GetStatus( + AT91PS_MC pMC) // pointer to a MC controller +{ + return pMC->MC_FSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_IsInterruptMasked +//* \brief Test if EFC MC Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_MC_EFC_IsInterruptMasked( + AT91PS_MC pMC, // \arg pointer to a MC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_MC_EFC_GetModeReg(pMC) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_IsInterruptSet +//* \brief Test if EFC MC Interrupt is Set +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_MC_EFC_IsInterruptSet( + AT91PS_MC pMC, // \arg pointer to a MC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_MC_EFC_GetStatus(pMC) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR SPI + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_CfgCs +//* \brief Configure SPI chip select register +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_CfgCs ( + AT91PS_SPI pSPI, // pointer to a SPI controller + int cs, // SPI cs number (0 to 3) + int val) // chip select register +{ + //* Write to the CSR register + *(pSPI->SPI_CSR + cs) = val; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_EnableIt +//* \brief Enable SPI interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_EnableIt ( + AT91PS_SPI pSPI, // pointer to a SPI controller + unsigned int flag) // IT to be enabled +{ + //* Write to the IER register + pSPI->SPI_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_DisableIt +//* \brief Disable SPI interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_DisableIt ( + AT91PS_SPI pSPI, // pointer to a SPI controller + unsigned int flag) // IT to be disabled +{ + //* Write to the IDR register + pSPI->SPI_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_Reset +//* \brief Reset the SPI controller +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_Reset ( + AT91PS_SPI pSPI // pointer to a SPI controller + ) +{ + //* Write to the CR register + pSPI->SPI_CR = AT91C_SPI_SWRST; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_Enable +//* \brief Enable the SPI controller +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_Enable ( + AT91PS_SPI pSPI // pointer to a SPI controller + ) +{ + //* Write to the CR register + pSPI->SPI_CR = AT91C_SPI_SPIEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_Disable +//* \brief Disable the SPI controller +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_Disable ( + AT91PS_SPI pSPI // pointer to a SPI controller + ) +{ + //* Write to the CR register + pSPI->SPI_CR = AT91C_SPI_SPIDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_CfgMode +//* \brief Enable the SPI controller +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_CfgMode ( + AT91PS_SPI pSPI, // pointer to a SPI controller + int mode) // mode register +{ + //* Write to the MR register + pSPI->SPI_MR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_CfgPCS +//* \brief Switch to the correct PCS of SPI Mode Register : Fixed Peripheral Selected +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_CfgPCS ( + AT91PS_SPI pSPI, // pointer to a SPI controller + char PCS_Device) // PCS of the Device +{ + //* Write to the MR register + pSPI->SPI_MR &= 0xFFF0FFFF; + pSPI->SPI_MR |= ( (PCS_Device<<16) & AT91C_SPI_PCS ); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_ReceiveFrame +//* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initializaed with Next Buffer, 0 if PDC is busy +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_SPI_ReceiveFrame ( + AT91PS_SPI pSPI, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + return AT91F_PDC_ReceiveFrame( + (AT91PS_PDC) &(pSPI->SPI_RPR), + pBuffer, + szBuffer, + pNextBuffer, + szNextBuffer); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_SendFrame +//* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initializaed with Next Buffer, 0 if PDC is bSPIy +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_SPI_SendFrame( + AT91PS_SPI pSPI, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + return AT91F_PDC_SendFrame( + (AT91PS_PDC) &(pSPI->SPI_RPR), + pBuffer, + szBuffer, + pNextBuffer, + szNextBuffer); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_Close +//* \brief Close SPI: disable IT disable transfert, close PDC +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_Close ( + AT91PS_SPI pSPI) // \arg pointer to a SPI controller +{ + //* Reset all the Chip Select register + pSPI->SPI_CSR[0] = 0 ; + pSPI->SPI_CSR[1] = 0 ; + pSPI->SPI_CSR[2] = 0 ; + pSPI->SPI_CSR[3] = 0 ; + + //* Reset the SPI mode + pSPI->SPI_MR = 0 ; + + //* Disable all interrupts + pSPI->SPI_IDR = 0xFFFFFFFF ; + + //* Abort the Peripheral Data Transfers + AT91F_PDC_Close((AT91PS_PDC) &(pSPI->SPI_RPR)); + + //* Disable receiver and transmitter and stop any activity immediately + pSPI->SPI_CR = AT91C_SPI_SPIDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_PutChar +//* \brief Send a character,does not check if ready to send +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_PutChar ( + AT91PS_SPI pSPI, + unsigned int character, + unsigned int cs_number ) +{ + unsigned int value_for_cs; + value_for_cs = (~(1 << cs_number)) & 0xF; //Place a zero among a 4 ONEs number + pSPI->SPI_TDR = (character & 0xFFFF) | (value_for_cs << 16); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_GetChar +//* \brief Receive a character,does not check if a character is available +//*---------------------------------------------------------------------------- +__inline int AT91F_SPI_GetChar ( + const AT91PS_SPI pSPI) +{ + return((pSPI->SPI_RDR) & 0xFFFF); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_GetInterruptMaskStatus +//* \brief Return SPI Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_SPI_GetInterruptMaskStatus( // \return SPI Interrupt Mask Status + AT91PS_SPI pSpi) // \arg pointer to a SPI controller +{ + return pSpi->SPI_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_IsInterruptMasked +//* \brief Test if SPI Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_SPI_IsInterruptMasked( + AT91PS_SPI pSpi, // \arg pointer to a SPI controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_SPI_GetInterruptMaskStatus(pSpi) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR USART + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_Baudrate +//* \brief Calculate the baudrate +//* Standard Asynchronous Mode : 8 bits , 1 stop , no parity +#define AT91C_US_ASYNC_MODE ( AT91C_US_USMODE_NORMAL + \ + AT91C_US_NBSTOP_1_BIT + \ + AT91C_US_PAR_NONE + \ + AT91C_US_CHRL_8_BITS + \ + AT91C_US_CLKS_CLOCK ) + +//* Standard External Asynchronous Mode : 8 bits , 1 stop , no parity +#define AT91C_US_ASYNC_SCK_MODE ( AT91C_US_USMODE_NORMAL + \ + AT91C_US_NBSTOP_1_BIT + \ + AT91C_US_PAR_NONE + \ + AT91C_US_CHRL_8_BITS + \ + AT91C_US_CLKS_EXT ) + +//* Standard Synchronous Mode : 8 bits , 1 stop , no parity +#define AT91C_US_SYNC_MODE ( AT91C_US_SYNC + \ + AT91C_US_USMODE_NORMAL + \ + AT91C_US_NBSTOP_1_BIT + \ + AT91C_US_PAR_NONE + \ + AT91C_US_CHRL_8_BITS + \ + AT91C_US_CLKS_CLOCK ) + +//* SCK used Label +#define AT91C_US_SCK_USED (AT91C_US_CKLO | AT91C_US_CLKS_EXT) + +//* Standard ISO T=0 Mode : 8 bits , 1 stop , parity +#define AT91C_US_ISO_READER_MODE ( AT91C_US_USMODE_ISO7816_0 + \ + AT91C_US_CLKS_CLOCK +\ + AT91C_US_NBSTOP_1_BIT + \ + AT91C_US_PAR_EVEN + \ + AT91C_US_CHRL_8_BITS + \ + AT91C_US_CKLO +\ + AT91C_US_OVER) + +//* Standard IRDA mode +#define AT91C_US_ASYNC_IRDA_MODE ( AT91C_US_USMODE_IRDA + \ + AT91C_US_NBSTOP_1_BIT + \ + AT91C_US_PAR_NONE + \ + AT91C_US_CHRL_8_BITS + \ + AT91C_US_CLKS_CLOCK ) + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_Baudrate +//* \brief Caluculate baud_value according to the main clock and the baud rate +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_US_Baudrate ( + const unsigned int main_clock, // \arg peripheral clock + const unsigned int baud_rate) // \arg UART baudrate +{ + unsigned int baud_value = ((main_clock*10)/(baud_rate * 16)); + if ((baud_value % 10) >= 5) + baud_value = (baud_value / 10) + 1; + else + baud_value /= 10; + return baud_value; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_SetBaudrate +//* \brief Set the baudrate according to the CPU clock +//*---------------------------------------------------------------------------- +__inline void AT91F_US_SetBaudrate ( + AT91PS_USART pUSART, // \arg pointer to a USART controller + unsigned int mainClock, // \arg peripheral clock + unsigned int speed) // \arg UART baudrate +{ + //* Define the baud rate divisor register + pUSART->US_BRGR = AT91F_US_Baudrate(mainClock, speed); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_SetTimeguard +//* \brief Set USART timeguard +//*---------------------------------------------------------------------------- +__inline void AT91F_US_SetTimeguard ( + AT91PS_USART pUSART, // \arg pointer to a USART controller + unsigned int timeguard) // \arg timeguard value +{ + //* Write the Timeguard Register + pUSART->US_TTGR = timeguard ; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_EnableIt +//* \brief Enable USART IT +//*---------------------------------------------------------------------------- +__inline void AT91F_US_EnableIt ( + AT91PS_USART pUSART, // \arg pointer to a USART controller + unsigned int flag) // \arg IT to be enabled +{ + //* Write to the IER register + pUSART->US_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_DisableIt +//* \brief Disable USART IT +//*---------------------------------------------------------------------------- +__inline void AT91F_US_DisableIt ( + AT91PS_USART pUSART, // \arg pointer to a USART controller + unsigned int flag) // \arg IT to be disabled +{ + //* Write to the IER register + pUSART->US_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_Configure +//* \brief Configure USART +//*---------------------------------------------------------------------------- +__inline void AT91F_US_Configure ( + AT91PS_USART pUSART, // \arg pointer to a USART controller + unsigned int mainClock, // \arg peripheral clock + unsigned int mode , // \arg mode Register to be programmed + unsigned int baudRate , // \arg baudrate to be programmed + unsigned int timeguard ) // \arg timeguard to be programmed +{ + //* Disable interrupts + pUSART->US_IDR = (unsigned int) -1; + + //* Reset receiver and transmitter + pUSART->US_CR = AT91C_US_RSTRX | AT91C_US_RSTTX | AT91C_US_RXDIS | AT91C_US_TXDIS ; + + //* Define the baud rate divisor register + AT91F_US_SetBaudrate(pUSART, mainClock, baudRate); + + //* Write the Timeguard Register + AT91F_US_SetTimeguard(pUSART, timeguard); + + //* Clear Transmit and Receive Counters + AT91F_PDC_Open((AT91PS_PDC) &(pUSART->US_RPR)); + + //* Define the USART mode + pUSART->US_MR = mode ; + +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_EnableRx +//* \brief Enable receiving characters +//*---------------------------------------------------------------------------- +__inline void AT91F_US_EnableRx ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Enable receiver + pUSART->US_CR = AT91C_US_RXEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_EnableTx +//* \brief Enable sending characters +//*---------------------------------------------------------------------------- +__inline void AT91F_US_EnableTx ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Enable transmitter + pUSART->US_CR = AT91C_US_TXEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_ResetRx +//* \brief Reset Receiver and re-enable it +//*---------------------------------------------------------------------------- +__inline void AT91F_US_ResetRx ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Reset receiver + pUSART->US_CR = AT91C_US_RSTRX; + //* Re-Enable receiver + pUSART->US_CR = AT91C_US_RXEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_ResetTx +//* \brief Reset Transmitter and re-enable it +//*---------------------------------------------------------------------------- +__inline void AT91F_US_ResetTx ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Reset transmitter + pUSART->US_CR = AT91C_US_RSTTX; + //* Enable transmitter + pUSART->US_CR = AT91C_US_TXEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_DisableRx +//* \brief Disable Receiver +//*---------------------------------------------------------------------------- +__inline void AT91F_US_DisableRx ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Disable receiver + pUSART->US_CR = AT91C_US_RXDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_DisableTx +//* \brief Disable Transmitter +//*---------------------------------------------------------------------------- +__inline void AT91F_US_DisableTx ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Disable transmitter + pUSART->US_CR = AT91C_US_TXDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_Close +//* \brief Close USART: disable IT disable receiver and transmitter, close PDC +//*---------------------------------------------------------------------------- +__inline void AT91F_US_Close ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Reset the baud rate divisor register + pUSART->US_BRGR = 0 ; + + //* Reset the USART mode + pUSART->US_MR = 0 ; + + //* Reset the Timeguard Register + pUSART->US_TTGR = 0; + + //* Disable all interrupts + pUSART->US_IDR = 0xFFFFFFFF ; + + //* Abort the Peripheral Data Transfers + AT91F_PDC_Close((AT91PS_PDC) &(pUSART->US_RPR)); + + //* Disable receiver and transmitter and stop any activity immediately + pUSART->US_CR = AT91C_US_TXDIS | AT91C_US_RXDIS | AT91C_US_RSTTX | AT91C_US_RSTRX ; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_TxReady +//* \brief Return 1 if a character can be written in US_THR +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_US_TxReady ( + AT91PS_USART pUSART ) // \arg pointer to a USART controller +{ + return (pUSART->US_CSR & AT91C_US_TXRDY); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_RxReady +//* \brief Return 1 if a character can be read in US_RHR +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_US_RxReady ( + AT91PS_USART pUSART ) // \arg pointer to a USART controller +{ + return (pUSART->US_CSR & AT91C_US_RXRDY); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_Error +//* \brief Return the error flag +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_US_Error ( + AT91PS_USART pUSART ) // \arg pointer to a USART controller +{ + return (pUSART->US_CSR & + (AT91C_US_OVRE | // Overrun error + AT91C_US_FRAME | // Framing error + AT91C_US_PARE)); // Parity error +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_PutChar +//* \brief Send a character,does not check if ready to send +//*---------------------------------------------------------------------------- +__inline void AT91F_US_PutChar ( + AT91PS_USART pUSART, + int character ) +{ + pUSART->US_THR = (character & 0x1FF); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_GetChar +//* \brief Receive a character,does not check if a character is available +//*---------------------------------------------------------------------------- +__inline int AT91F_US_GetChar ( + const AT91PS_USART pUSART) +{ + return((pUSART->US_RHR) & 0x1FF); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_SendFrame +//* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initializaed with Next Buffer, 0 if PDC is busy +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_US_SendFrame( + AT91PS_USART pUSART, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + return AT91F_PDC_SendFrame( + (AT91PS_PDC) &(pUSART->US_RPR), + pBuffer, + szBuffer, + pNextBuffer, + szNextBuffer); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_ReceiveFrame +//* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initializaed with Next Buffer, 0 if PDC is busy +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_US_ReceiveFrame ( + AT91PS_USART pUSART, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + return AT91F_PDC_ReceiveFrame( + (AT91PS_PDC) &(pUSART->US_RPR), + pBuffer, + szBuffer, + pNextBuffer, + szNextBuffer); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_SetIrdaFilter +//* \brief Set the value of IrDa filter tregister +//*---------------------------------------------------------------------------- +__inline void AT91F_US_SetIrdaFilter ( + AT91PS_USART pUSART, + unsigned char value +) +{ + pUSART->US_IF = value; +} + +/* ***************************************************************************** + SOFTWARE API FOR SSC + ***************************************************************************** */ +//* Define the standard I2S mode configuration + +//* Configuration to set in the SSC Transmit Clock Mode Register +//* Parameters : nb_bit_by_slot : 8, 16 or 32 bits +//* nb_slot_by_frame : number of channels +#define AT91C_I2S_ASY_MASTER_TX_SETTING(nb_bit_by_slot, nb_slot_by_frame)( +\ + AT91C_SSC_CKS_DIV +\ + AT91C_SSC_CKO_CONTINOUS +\ + AT91C_SSC_CKG_NONE +\ + AT91C_SSC_START_FALL_RF +\ + AT91C_SSC_STTOUT +\ + ((1<<16) & AT91C_SSC_STTDLY) +\ + ((((nb_bit_by_slot*nb_slot_by_frame)/2)-1) <<24)) + + +//* Configuration to set in the SSC Transmit Frame Mode Register +//* Parameters : nb_bit_by_slot : 8, 16 or 32 bits +//* nb_slot_by_frame : number of channels +#define AT91C_I2S_ASY_TX_FRAME_SETTING(nb_bit_by_slot, nb_slot_by_frame)( +\ + (nb_bit_by_slot-1) +\ + AT91C_SSC_MSBF +\ + (((nb_slot_by_frame-1)<<8) & AT91C_SSC_DATNB) +\ + (((nb_bit_by_slot-1)<<16) & AT91C_SSC_FSLEN) +\ + AT91C_SSC_FSOS_NEGATIVE) + + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_SetBaudrate +//* \brief Set the baudrate according to the CPU clock +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_SetBaudrate ( + AT91PS_SSC pSSC, // \arg pointer to a SSC controller + unsigned int mainClock, // \arg peripheral clock + unsigned int speed) // \arg SSC baudrate +{ + unsigned int baud_value; + //* Define the baud rate divisor register + if (speed == 0) + baud_value = 0; + else + { + baud_value = (unsigned int) (mainClock * 10)/(2*speed); + if ((baud_value % 10) >= 5) + baud_value = (baud_value / 10) + 1; + else + baud_value /= 10; + } + + pSSC->SSC_CMR = baud_value; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_Configure +//* \brief Configure SSC +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_Configure ( + AT91PS_SSC pSSC, // \arg pointer to a SSC controller + unsigned int syst_clock, // \arg System Clock Frequency + unsigned int baud_rate, // \arg Expected Baud Rate Frequency + unsigned int clock_rx, // \arg Receiver Clock Parameters + unsigned int mode_rx, // \arg mode Register to be programmed + unsigned int clock_tx, // \arg Transmitter Clock Parameters + unsigned int mode_tx) // \arg mode Register to be programmed +{ + //* Disable interrupts + pSSC->SSC_IDR = (unsigned int) -1; + + //* Reset receiver and transmitter + pSSC->SSC_CR = AT91C_SSC_SWRST | AT91C_SSC_RXDIS | AT91C_SSC_TXDIS ; + + //* Define the Clock Mode Register + AT91F_SSC_SetBaudrate(pSSC, syst_clock, baud_rate); + + //* Write the Receive Clock Mode Register + pSSC->SSC_RCMR = clock_rx; + + //* Write the Transmit Clock Mode Register + pSSC->SSC_TCMR = clock_tx; + + //* Write the Receive Frame Mode Register + pSSC->SSC_RFMR = mode_rx; + + //* Write the Transmit Frame Mode Register + pSSC->SSC_TFMR = mode_tx; + + //* Clear Transmit and Receive Counters + AT91F_PDC_Open((AT91PS_PDC) &(pSSC->SSC_RPR)); + + +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_EnableRx +//* \brief Enable receiving datas +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_EnableRx ( + AT91PS_SSC pSSC) // \arg pointer to a SSC controller +{ + //* Enable receiver + pSSC->SSC_CR = AT91C_SSC_RXEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_DisableRx +//* \brief Disable receiving datas +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_DisableRx ( + AT91PS_SSC pSSC) // \arg pointer to a SSC controller +{ + //* Disable receiver + pSSC->SSC_CR = AT91C_SSC_RXDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_EnableTx +//* \brief Enable sending datas +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_EnableTx ( + AT91PS_SSC pSSC) // \arg pointer to a SSC controller +{ + //* Enable transmitter + pSSC->SSC_CR = AT91C_SSC_TXEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_DisableTx +//* \brief Disable sending datas +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_DisableTx ( + AT91PS_SSC pSSC) // \arg pointer to a SSC controller +{ + //* Disable transmitter + pSSC->SSC_CR = AT91C_SSC_TXDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_EnableIt +//* \brief Enable SSC IT +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_EnableIt ( + AT91PS_SSC pSSC, // \arg pointer to a SSC controller + unsigned int flag) // \arg IT to be enabled +{ + //* Write to the IER register + pSSC->SSC_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_DisableIt +//* \brief Disable SSC IT +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_DisableIt ( + AT91PS_SSC pSSC, // \arg pointer to a SSC controller + unsigned int flag) // \arg IT to be disabled +{ + //* Write to the IDR register + pSSC->SSC_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_ReceiveFrame +//* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initialized with Next Buffer, 0 if PDC is busy +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_SSC_ReceiveFrame ( + AT91PS_SSC pSSC, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + return AT91F_PDC_ReceiveFrame( + (AT91PS_PDC) &(pSSC->SSC_RPR), + pBuffer, + szBuffer, + pNextBuffer, + szNextBuffer); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_SendFrame +//* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initialized with Next Buffer, 0 if PDC is busy +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_SSC_SendFrame( + AT91PS_SSC pSSC, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + return AT91F_PDC_SendFrame( + (AT91PS_PDC) &(pSSC->SSC_RPR), + pBuffer, + szBuffer, + pNextBuffer, + szNextBuffer); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_GetInterruptMaskStatus +//* \brief Return SSC Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_SSC_GetInterruptMaskStatus( // \return SSC Interrupt Mask Status + AT91PS_SSC pSsc) // \arg pointer to a SSC controller +{ + return pSsc->SSC_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_IsInterruptMasked +//* \brief Test if SSC Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_SSC_IsInterruptMasked( + AT91PS_SSC pSsc, // \arg pointer to a SSC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_SSC_GetInterruptMaskStatus(pSsc) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR TWI + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_EnableIt +//* \brief Enable TWI IT +//*---------------------------------------------------------------------------- +__inline void AT91F_TWI_EnableIt ( + AT91PS_TWI pTWI, // \arg pointer to a TWI controller + unsigned int flag) // \arg IT to be enabled +{ + //* Write to the IER register + pTWI->TWI_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_DisableIt +//* \brief Disable TWI IT +//*---------------------------------------------------------------------------- +__inline void AT91F_TWI_DisableIt ( + AT91PS_TWI pTWI, // \arg pointer to a TWI controller + unsigned int flag) // \arg IT to be disabled +{ + //* Write to the IDR register + pTWI->TWI_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_Configure +//* \brief Configure TWI in master mode +//*---------------------------------------------------------------------------- +__inline void AT91F_TWI_Configure ( AT91PS_TWI pTWI ) // \arg pointer to a TWI controller +{ + //* Disable interrupts + pTWI->TWI_IDR = (unsigned int) -1; + + //* Reset peripheral + pTWI->TWI_CR = AT91C_TWI_SWRST; + + //* Set Master mode + pTWI->TWI_CR = AT91C_TWI_MSEN; + +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_GetInterruptMaskStatus +//* \brief Return TWI Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_TWI_GetInterruptMaskStatus( // \return TWI Interrupt Mask Status + AT91PS_TWI pTwi) // \arg pointer to a TWI controller +{ + return pTwi->TWI_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_IsInterruptMasked +//* \brief Test if TWI Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_TWI_IsInterruptMasked( + AT91PS_TWI pTwi, // \arg pointer to a TWI controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_TWI_GetInterruptMaskStatus(pTwi) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR PWMC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_GetStatus +//* \brief Return PWM Interrupt Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PWMC_GetStatus( // \return PWM Interrupt Status + AT91PS_PWMC pPWM) // pointer to a PWM controller +{ + return pPWM->PWMC_SR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_InterruptEnable +//* \brief Enable PWM Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_InterruptEnable( + AT91PS_PWMC pPwm, // \arg pointer to a PWM controller + unsigned int flag) // \arg PWM interrupt to be enabled +{ + pPwm->PWMC_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_InterruptDisable +//* \brief Disable PWM Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_InterruptDisable( + AT91PS_PWMC pPwm, // \arg pointer to a PWM controller + unsigned int flag) // \arg PWM interrupt to be disabled +{ + pPwm->PWMC_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_GetInterruptMaskStatus +//* \brief Return PWM Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PWMC_GetInterruptMaskStatus( // \return PWM Interrupt Mask Status + AT91PS_PWMC pPwm) // \arg pointer to a PWM controller +{ + return pPwm->PWMC_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_IsInterruptMasked +//* \brief Test if PWM Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PWMC_IsInterruptMasked( + AT91PS_PWMC pPWM, // \arg pointer to a PWM controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PWMC_GetInterruptMaskStatus(pPWM) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_IsStatusSet +//* \brief Test if PWM Interrupt is Set +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PWMC_IsStatusSet( + AT91PS_PWMC pPWM, // \arg pointer to a PWM controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PWMC_GetStatus(pPWM) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_CfgChannel +//* \brief Test if PWM Interrupt is Set +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_CfgChannel( + AT91PS_PWMC pPWM, // \arg pointer to a PWM controller + unsigned int channelId, // \arg PWM channel ID + unsigned int mode, // \arg PWM mode + unsigned int period, // \arg PWM period + unsigned int duty) // \arg PWM duty cycle +{ + pPWM->PWMC_CH[channelId].PWMC_CMR = mode; + pPWM->PWMC_CH[channelId].PWMC_CDTYR = duty; + pPWM->PWMC_CH[channelId].PWMC_CPRDR = period; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_StartChannel +//* \brief Enable channel +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_StartChannel( + AT91PS_PWMC pPWM, // \arg pointer to a PWM controller + unsigned int flag) // \arg Channels IDs to be enabled +{ + pPWM->PWMC_ENA = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_StopChannel +//* \brief Disable channel +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_StopChannel( + AT91PS_PWMC pPWM, // \arg pointer to a PWM controller + unsigned int flag) // \arg Channels IDs to be enabled +{ + pPWM->PWMC_DIS = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_UpdateChannel +//* \brief Update Period or Duty Cycle +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_UpdateChannel( + AT91PS_PWMC pPWM, // \arg pointer to a PWM controller + unsigned int channelId, // \arg PWM channel ID + unsigned int update) // \arg Channels IDs to be enabled +{ + pPWM->PWMC_CH[channelId].PWMC_CUPDR = update; +} + +/* ***************************************************************************** + SOFTWARE API FOR UDP + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EnableIt +//* \brief Enable UDP IT +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EnableIt ( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned int flag) // \arg IT to be enabled +{ + //* Write to the IER register + pUDP->UDP_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_DisableIt +//* \brief Disable UDP IT +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_DisableIt ( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned int flag) // \arg IT to be disabled +{ + //* Write to the IDR register + pUDP->UDP_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_SetAddress +//* \brief Set UDP functional address +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_SetAddress ( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char address) // \arg new UDP address +{ + pUDP->UDP_FADDR = (AT91C_UDP_FEN | address); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EnableEp +//* \brief Enable Endpoint +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EnableEp ( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint) // \arg endpoint number +{ + pUDP->UDP_CSR[endpoint] |= AT91C_UDP_EPEDS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_DisableEp +//* \brief Enable Endpoint +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_DisableEp ( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint) // \arg endpoint number +{ + pUDP->UDP_CSR[endpoint] &= ~AT91C_UDP_EPEDS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_SetState +//* \brief Set UDP Device state +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_SetState ( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned int flag) // \arg new UDP address +{ + pUDP->UDP_GLBSTATE &= ~(AT91C_UDP_FADDEN | AT91C_UDP_CONFG); + pUDP->UDP_GLBSTATE |= flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_GetState +//* \brief return UDP Device state +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_UDP_GetState ( // \return the UDP device state + AT91PS_UDP pUDP) // \arg pointer to a UDP controller +{ + return (pUDP->UDP_GLBSTATE & (AT91C_UDP_FADDEN | AT91C_UDP_CONFG)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_ResetEp +//* \brief Reset UDP endpoint +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_ResetEp ( // \return the UDP device state + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned int flag) // \arg Endpoints to be reset +{ + pUDP->UDP_RSTEP = flag; + pUDP->UDP_RSTEP = 0; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpStall +//* \brief Endpoint will STALL requests +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EpStall( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint) // \arg endpoint number +{ + pUDP->UDP_CSR[endpoint] |= AT91C_UDP_FORCESTALL; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpWrite +//* \brief Write value in the DPR +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EpWrite( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint, // \arg endpoint number + unsigned char value) // \arg value to be written in the DPR +{ + pUDP->UDP_FDR[endpoint] = value; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpRead +//* \brief Return value from the DPR +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_UDP_EpRead( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint) // \arg endpoint number +{ + return pUDP->UDP_FDR[endpoint]; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpEndOfWr +//* \brief Notify the UDP that values in DPR are ready to be sent +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EpEndOfWr( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint) // \arg endpoint number +{ + pUDP->UDP_CSR[endpoint] |= AT91C_UDP_TXPKTRDY; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpClear +//* \brief Clear flag in the endpoint CSR register +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EpClear( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint, // \arg endpoint number + unsigned int flag) // \arg flag to be cleared +{ + pUDP->UDP_CSR[endpoint] &= ~(flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpSet +//* \brief Set flag in the endpoint CSR register +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EpSet( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint, // \arg endpoint number + unsigned int flag) // \arg flag to be cleared +{ + pUDP->UDP_CSR[endpoint] |= flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpStatus +//* \brief Return the endpoint CSR register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_UDP_EpStatus( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint) // \arg endpoint number +{ + return pUDP->UDP_CSR[endpoint]; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_GetInterruptMaskStatus +//* \brief Return UDP Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_UDP_GetInterruptMaskStatus( + AT91PS_UDP pUdp) // \arg pointer to a UDP controller +{ + return pUdp->UDP_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_IsInterruptMasked +//* \brief Test if UDP Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_UDP_IsInterruptMasked( + AT91PS_UDP pUdp, // \arg pointer to a UDP controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_UDP_GetInterruptMaskStatus(pUdp) & flag); +} + +// ---------------------------------------------------------------------------- +// \fn AT91F_UDP_InterruptStatusRegister +// \brief Return the Interrupt Status Register +// ---------------------------------------------------------------------------- +__inline unsigned int AT91F_UDP_InterruptStatusRegister( + AT91PS_UDP pUDP ) // \arg pointer to a UDP controller +{ + return pUDP->UDP_ISR; +} + +// ---------------------------------------------------------------------------- +// \fn AT91F_UDP_InterruptClearRegister +// \brief Clear Interrupt Register +// ---------------------------------------------------------------------------- +__inline void AT91F_UDP_InterruptClearRegister ( + AT91PS_UDP pUDP, // \arg pointer to UDP controller + unsigned int flag) // \arg IT to be cleat +{ + pUDP->UDP_ICR = flag; +} + +// ---------------------------------------------------------------------------- +// \fn AT91F_UDP_EnableTransceiver +// \brief Enable transceiver +// ---------------------------------------------------------------------------- +__inline void AT91F_UDP_EnableTransceiver( + AT91PS_UDP pUDP ) // \arg pointer to a UDP controller +{ + pUDP->UDP_TXVC &= ~AT91C_UDP_TXVDIS; +} + +// ---------------------------------------------------------------------------- +// \fn AT91F_UDP_DisableTransceiver +// \brief Disable transceiver +// ---------------------------------------------------------------------------- +__inline void AT91F_UDP_DisableTransceiver( + AT91PS_UDP pUDP ) // \arg pointer to a UDP controller +{ + pUDP->UDP_TXVC = AT91C_UDP_TXVDIS; +} + +/* ***************************************************************************** + SOFTWARE API FOR TC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC_InterruptEnable +//* \brief Enable TC Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_TC_InterruptEnable( + AT91PS_TC pTc, // \arg pointer to a TC controller + unsigned int flag) // \arg TC interrupt to be enabled +{ + pTc->TC_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC_InterruptDisable +//* \brief Disable TC Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_TC_InterruptDisable( + AT91PS_TC pTc, // \arg pointer to a TC controller + unsigned int flag) // \arg TC interrupt to be disabled +{ + pTc->TC_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC_GetInterruptMaskStatus +//* \brief Return TC Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_TC_GetInterruptMaskStatus( // \return TC Interrupt Mask Status + AT91PS_TC pTc) // \arg pointer to a TC controller +{ + return pTc->TC_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC_IsInterruptMasked +//* \brief Test if TC Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_TC_IsInterruptMasked( + AT91PS_TC pTc, // \arg pointer to a TC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_TC_GetInterruptMaskStatus(pTc) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR CAN + ***************************************************************************** */ +#define STANDARD_FORMAT 0 +#define EXTENDED_FORMAT 1 + +//*---------------------------------------------------------------------------- +//* \fn AT91F_InitMailboxRegisters() +//* \brief Configure the corresponding mailbox +//*---------------------------------------------------------------------------- +__inline void AT91F_InitMailboxRegisters(AT91PS_CAN_MB CAN_Mailbox, + int mode_reg, + int acceptance_mask_reg, + int id_reg, + int data_low_reg, + int data_high_reg, + int control_reg) +{ + CAN_Mailbox->CAN_MB_MCR = 0x0; + CAN_Mailbox->CAN_MB_MMR = mode_reg; + CAN_Mailbox->CAN_MB_MAM = acceptance_mask_reg; + CAN_Mailbox->CAN_MB_MID = id_reg; + CAN_Mailbox->CAN_MB_MDL = data_low_reg; + CAN_Mailbox->CAN_MB_MDH = data_high_reg; + CAN_Mailbox->CAN_MB_MCR = control_reg; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_EnableCAN() +//* \brief +//*---------------------------------------------------------------------------- +__inline void AT91F_EnableCAN( + AT91PS_CAN pCAN) // pointer to a CAN controller +{ + pCAN->CAN_MR |= AT91C_CAN_CANEN; + + // Wait for WAKEUP flag raising <=> 11-recessive-bit were scanned by the transceiver + while( (pCAN->CAN_SR & AT91C_CAN_WAKEUP) != AT91C_CAN_WAKEUP ); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_DisableCAN() +//* \brief +//*---------------------------------------------------------------------------- +__inline void AT91F_DisableCAN( + AT91PS_CAN pCAN) // pointer to a CAN controller +{ + pCAN->CAN_MR &= ~AT91C_CAN_CANEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_EnableIt +//* \brief Enable CAN interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_EnableIt ( + AT91PS_CAN pCAN, // pointer to a CAN controller + unsigned int flag) // IT to be enabled +{ + //* Write to the IER register + pCAN->CAN_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_DisableIt +//* \brief Disable CAN interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_DisableIt ( + AT91PS_CAN pCAN, // pointer to a CAN controller + unsigned int flag) // IT to be disabled +{ + //* Write to the IDR register + pCAN->CAN_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetStatus +//* \brief Return CAN Interrupt Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetStatus( // \return CAN Interrupt Status + AT91PS_CAN pCAN) // pointer to a CAN controller +{ + return pCAN->CAN_SR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetInterruptMaskStatus +//* \brief Return CAN Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetInterruptMaskStatus( // \return CAN Interrupt Mask Status + AT91PS_CAN pCAN) // pointer to a CAN controller +{ + return pCAN->CAN_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_IsInterruptMasked +//* \brief Test if CAN Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_IsInterruptMasked( + AT91PS_CAN pCAN, // \arg pointer to a CAN controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_CAN_GetInterruptMaskStatus(pCAN) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_IsStatusSet +//* \brief Test if CAN Interrupt is Set +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_IsStatusSet( + AT91PS_CAN pCAN, // \arg pointer to a CAN controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_CAN_GetStatus(pCAN) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgModeReg +//* \brief Configure the Mode Register of the CAN controller +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgModeReg ( + AT91PS_CAN pCAN, // pointer to a CAN controller + unsigned int mode) // mode register +{ + //* Write to the MR register + pCAN->CAN_MR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetModeReg +//* \brief Return the Mode Register of the CAN controller value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetModeReg ( + AT91PS_CAN pCAN // pointer to a CAN controller + ) +{ + return pCAN->CAN_MR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgBaudrateReg +//* \brief Configure the Baudrate of the CAN controller for the network +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgBaudrateReg ( + AT91PS_CAN pCAN, // pointer to a CAN controller + unsigned int baudrate_cfg) +{ + //* Write to the BR register + pCAN->CAN_BR = baudrate_cfg; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetBaudrate +//* \brief Return the Baudrate of the CAN controller for the network value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetBaudrate ( + AT91PS_CAN pCAN // pointer to a CAN controller + ) +{ + return pCAN->CAN_BR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetInternalCounter +//* \brief Return CAN Timer Regsiter Value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetInternalCounter ( + AT91PS_CAN pCAN // pointer to a CAN controller + ) +{ + return pCAN->CAN_TIM; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetTimestamp +//* \brief Return CAN Timestamp Register Value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetTimestamp ( + AT91PS_CAN pCAN // pointer to a CAN controller + ) +{ + return pCAN->CAN_TIMESTP; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetErrorCounter +//* \brief Return CAN Error Counter Register Value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetErrorCounter ( + AT91PS_CAN pCAN // pointer to a CAN controller + ) +{ + return pCAN->CAN_ECR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_InitTransferRequest +//* \brief Request for a transfer on the corresponding mailboxes +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_InitTransferRequest ( + AT91PS_CAN pCAN, // pointer to a CAN controller + unsigned int transfer_cmd) +{ + pCAN->CAN_TCR = transfer_cmd; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_InitAbortRequest +//* \brief Abort the corresponding mailboxes +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_InitAbortRequest ( + AT91PS_CAN pCAN, // pointer to a CAN controller + unsigned int abort_cmd) +{ + pCAN->CAN_ACR = abort_cmd; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgMessageModeReg +//* \brief Program the Message Mode Register +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgMessageModeReg ( + AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox + unsigned int mode) +{ + CAN_Mailbox->CAN_MB_MMR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetMessageModeReg +//* \brief Return the Message Mode Register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetMessageModeReg ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgMessageIDReg +//* \brief Program the Message ID Register +//* \brief Version == 0 for Standard messsage, Version == 1 for Extended +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgMessageIDReg ( + AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox + unsigned int id, + unsigned char version) +{ + if(version==0) // IDvA Standard Format + CAN_Mailbox->CAN_MB_MID = id<<18; + else // IDvB Extended Format + CAN_Mailbox->CAN_MB_MID = id | (1<<29); // set MIDE bit +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetMessageIDReg +//* \brief Return the Message ID Register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetMessageIDReg ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MID; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgMessageAcceptanceMaskReg +//* \brief Program the Message Acceptance Mask Register +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgMessageAcceptanceMaskReg ( + AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox + unsigned int mask) +{ + CAN_Mailbox->CAN_MB_MAM = mask; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetMessageAcceptanceMaskReg +//* \brief Return the Message Acceptance Mask Register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetMessageAcceptanceMaskReg ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MAM; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetFamilyID +//* \brief Return the Message ID Register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetFamilyID ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MFID; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgMessageCtrl +//* \brief Request and config for a transfer on the corresponding mailbox +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgMessageCtrlReg ( + AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox + unsigned int message_ctrl_cmd) +{ + CAN_Mailbox->CAN_MB_MCR = message_ctrl_cmd; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetMessageStatus +//* \brief Return CAN Mailbox Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetMessageStatus ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgMessageDataLow +//* \brief Program data low value +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgMessageDataLow ( + AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox + unsigned int data) +{ + CAN_Mailbox->CAN_MB_MDL = data; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetMessageDataLow +//* \brief Return data low value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetMessageDataLow ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MDL; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgMessageDataHigh +//* \brief Program data high value +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgMessageDataHigh ( + AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox + unsigned int data) +{ + CAN_Mailbox->CAN_MB_MDH = data; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetMessageDataHigh +//* \brief Return data high value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetMessageDataHigh ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MDH; +} + +/* ***************************************************************************** + SOFTWARE API FOR ADC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_EnableIt +//* \brief Enable ADC interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_EnableIt ( + AT91PS_ADC pADC, // pointer to a ADC controller + unsigned int flag) // IT to be enabled +{ + //* Write to the IER register + pADC->ADC_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_DisableIt +//* \brief Disable ADC interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_DisableIt ( + AT91PS_ADC pADC, // pointer to a ADC controller + unsigned int flag) // IT to be disabled +{ + //* Write to the IDR register + pADC->ADC_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetStatus +//* \brief Return ADC Interrupt Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetStatus( // \return ADC Interrupt Status + AT91PS_ADC pADC) // pointer to a ADC controller +{ + return pADC->ADC_SR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetInterruptMaskStatus +//* \brief Return ADC Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetInterruptMaskStatus( // \return ADC Interrupt Mask Status + AT91PS_ADC pADC) // pointer to a ADC controller +{ + return pADC->ADC_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_IsInterruptMasked +//* \brief Test if ADC Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_IsInterruptMasked( + AT91PS_ADC pADC, // \arg pointer to a ADC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_ADC_GetInterruptMaskStatus(pADC) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_IsStatusSet +//* \brief Test if ADC Status is Set +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_IsStatusSet( + AT91PS_ADC pADC, // \arg pointer to a ADC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_ADC_GetStatus(pADC) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_CfgModeReg +//* \brief Configure the Mode Register of the ADC controller +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_CfgModeReg ( + AT91PS_ADC pADC, // pointer to a ADC controller + unsigned int mode) // mode register +{ + //* Write to the MR register + pADC->ADC_MR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetModeReg +//* \brief Return the Mode Register of the ADC controller value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetModeReg ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_MR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_CfgTimings +//* \brief Configure the different necessary timings of the ADC controller +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_CfgTimings ( + AT91PS_ADC pADC, // pointer to a ADC controller + unsigned int mck_clock, // in MHz + unsigned int adc_clock, // in MHz + unsigned int startup_time, // in us + unsigned int sample_and_hold_time) // in ns +{ + unsigned int prescal,startup,shtim; + + prescal = mck_clock/(2*adc_clock) - 1; + startup = adc_clock*startup_time/8 - 1; + shtim = adc_clock*sample_and_hold_time/1000 - 1; + + //* Write to the MR register + pADC->ADC_MR = ( (prescal<<8) & AT91C_ADC_PRESCAL) | ( (startup<<16) & AT91C_ADC_STARTUP) | ( (shtim<<24) & AT91C_ADC_SHTIM); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_EnableChannel +//* \brief Return ADC Timer Register Value +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_EnableChannel ( + AT91PS_ADC pADC, // pointer to a ADC controller + unsigned int channel) // mode register +{ + //* Write to the CHER register + pADC->ADC_CHER = channel; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_DisableChannel +//* \brief Return ADC Timer Register Value +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_DisableChannel ( + AT91PS_ADC pADC, // pointer to a ADC controller + unsigned int channel) // mode register +{ + //* Write to the CHDR register + pADC->ADC_CHDR = channel; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetChannelStatus +//* \brief Return ADC Timer Register Value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetChannelStatus ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CHSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_StartConversion +//* \brief Software request for a analog to digital conversion +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_StartConversion ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + pADC->ADC_CR = AT91C_ADC_START; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_SoftReset +//* \brief Software reset +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_SoftReset ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + pADC->ADC_CR = AT91C_ADC_SWRST; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetLastConvertedData +//* \brief Return the Last Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetLastConvertedData ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_LCDR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH0 +//* \brief Return the Channel 0 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH0 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR0; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH1 +//* \brief Return the Channel 1 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH1 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR1; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH2 +//* \brief Return the Channel 2 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH2 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR2; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH3 +//* \brief Return the Channel 3 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH3 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR3; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH4 +//* \brief Return the Channel 4 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH4 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR4; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH5 +//* \brief Return the Channel 5 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH5 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR5; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH6 +//* \brief Return the Channel 6 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH6 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR6; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH7 +//* \brief Return the Channel 7 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH7 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR7; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_DBGU_CfgPMC +//* \brief Enable Peripheral clock in PMC for DBGU +//*---------------------------------------------------------------------------- +__inline void AT91F_DBGU_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_DBGU_CfgPIO +//* \brief Configure PIO controllers to drive DBGU signals +//*---------------------------------------------------------------------------- +__inline void AT91F_DBGU_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA27_DRXD ) | + ((unsigned int) AT91C_PA28_DTXD ), // Peripheral A + 0); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_CfgPMC +//* \brief Enable Peripheral clock in PMC for PMC +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_CfgPIO +//* \brief Configure PIO controllers to drive PMC signals +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB30_PCK2 ) | + ((unsigned int) AT91C_PB29_PCK1 ), // Peripheral A + ((unsigned int) AT91C_PB20_PCK0 ) | + ((unsigned int) AT91C_PB0_PCK0 ) | + ((unsigned int) AT91C_PB22_PCK2 ) | + ((unsigned int) AT91C_PB21_PCK1 )); // Peripheral B + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PA30_PCK2 ) | + ((unsigned int) AT91C_PA13_PCK1 ) | + ((unsigned int) AT91C_PA27_PCK3 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_VREG_CfgPMC +//* \brief Enable Peripheral clock in PMC for VREG +//*---------------------------------------------------------------------------- +__inline void AT91F_VREG_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_RSTC_CfgPMC +//* \brief Enable Peripheral clock in PMC for RSTC +//*---------------------------------------------------------------------------- +__inline void AT91F_RSTC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_CfgPMC +//* \brief Enable Peripheral clock in PMC for SSC +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SSC)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_CfgPIO +//* \brief Configure PIO controllers to drive SSC signals +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA25_RK ) | + ((unsigned int) AT91C_PA22_TK ) | + ((unsigned int) AT91C_PA21_TF ) | + ((unsigned int) AT91C_PA24_RD ) | + ((unsigned int) AT91C_PA26_RF ) | + ((unsigned int) AT91C_PA23_TD ), // Peripheral A + 0); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_WDTC_CfgPMC +//* \brief Enable Peripheral clock in PMC for WDTC +//*---------------------------------------------------------------------------- +__inline void AT91F_WDTC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US1_CfgPMC +//* \brief Enable Peripheral clock in PMC for US1 +//*---------------------------------------------------------------------------- +__inline void AT91F_US1_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_US1)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US1_CfgPIO +//* \brief Configure PIO controllers to drive US1 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_US1_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PB26_RI1 ) | + ((unsigned int) AT91C_PB24_DSR1 ) | + ((unsigned int) AT91C_PB23_DCD1 ) | + ((unsigned int) AT91C_PB25_DTR1 )); // Peripheral B + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA7_SCK1 ) | + ((unsigned int) AT91C_PA8_RTS1 ) | + ((unsigned int) AT91C_PA6_TXD1 ) | + ((unsigned int) AT91C_PA5_RXD1 ) | + ((unsigned int) AT91C_PA9_CTS1 ), // Peripheral A + 0); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US0_CfgPMC +//* \brief Enable Peripheral clock in PMC for US0 +//*---------------------------------------------------------------------------- +__inline void AT91F_US0_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_US0)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US0_CfgPIO +//* \brief Configure PIO controllers to drive US0 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_US0_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA0_RXD0 ) | + ((unsigned int) AT91C_PA4_CTS0 ) | + ((unsigned int) AT91C_PA3_RTS0 ) | + ((unsigned int) AT91C_PA2_SCK0 ) | + ((unsigned int) AT91C_PA1_TXD0 ), // Peripheral A + 0); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI1_CfgPMC +//* \brief Enable Peripheral clock in PMC for SPI1 +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI1_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SPI1)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI1_CfgPIO +//* \brief Configure PIO controllers to drive SPI1 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI1_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PB11_SPI1_NPCS2) | + ((unsigned int) AT91C_PB10_SPI1_NPCS1) | + ((unsigned int) AT91C_PB16_SPI1_NPCS3)); // Peripheral B + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PA22_SPI1_SPCK) | + ((unsigned int) AT91C_PA3_SPI1_NPCS2) | + ((unsigned int) AT91C_PA26_SPI1_NPCS2) | + ((unsigned int) AT91C_PA25_SPI1_NPCS1) | + ((unsigned int) AT91C_PA2_SPI1_NPCS1) | + ((unsigned int) AT91C_PA24_SPI1_MISO) | + ((unsigned int) AT91C_PA4_SPI1_NPCS3) | + ((unsigned int) AT91C_PA29_SPI1_NPCS3) | + ((unsigned int) AT91C_PA21_SPI1_NPCS0) | + ((unsigned int) AT91C_PA23_SPI1_MOSI)); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI0_CfgPMC +//* \brief Enable Peripheral clock in PMC for SPI0 +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI0_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SPI0)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI0_CfgPIO +//* \brief Configure PIO controllers to drive SPI0 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI0_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PB13_SPI0_NPCS1) | + ((unsigned int) AT91C_PB14_SPI0_NPCS2) | + ((unsigned int) AT91C_PB17_SPI0_NPCS3)); // Peripheral B + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA16_SPI0_MISO) | + ((unsigned int) AT91C_PA13_SPI0_NPCS1) | + ((unsigned int) AT91C_PA14_SPI0_NPCS2) | + ((unsigned int) AT91C_PA12_SPI0_NPCS0) | + ((unsigned int) AT91C_PA17_SPI0_MOSI) | + ((unsigned int) AT91C_PA15_SPI0_NPCS3) | + ((unsigned int) AT91C_PA18_SPI0_SPCK), // Peripheral A + ((unsigned int) AT91C_PA7_SPI0_NPCS1) | + ((unsigned int) AT91C_PA8_SPI0_NPCS2) | + ((unsigned int) AT91C_PA9_SPI0_NPCS3)); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITC_CfgPMC +//* \brief Enable Peripheral clock in PMC for PITC +//*---------------------------------------------------------------------------- +__inline void AT91F_PITC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_CfgPMC +//* \brief Enable Peripheral clock in PMC for AIC +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_FIQ) | + ((unsigned int) 1 << AT91C_ID_IRQ0) | + ((unsigned int) 1 << AT91C_ID_IRQ1)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_CfgPIO +//* \brief Configure PIO controllers to drive AIC signals +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA30_IRQ0 ) | + ((unsigned int) AT91C_PA29_FIQ ), // Peripheral A + ((unsigned int) AT91C_PA14_IRQ1 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_CfgPMC +//* \brief Enable Peripheral clock in PMC for TWI +//*---------------------------------------------------------------------------- +__inline void AT91F_TWI_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_TWI)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_CfgPIO +//* \brief Configure PIO controllers to drive TWI signals +//*---------------------------------------------------------------------------- +__inline void AT91F_TWI_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA11_TWCK ) | + ((unsigned int) AT91C_PA10_TWD ), // Peripheral A + 0); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_CfgPMC +//* \brief Enable Peripheral clock in PMC for ADC +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_ADC)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_CfgPIO +//* \brief Configure PIO controllers to drive ADC signals +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PB18_ADTRG )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWMC_CH3_CfgPIO +//* \brief Configure PIO controllers to drive PWMC_CH3 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_CH3_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB22_PWM3 ), // Peripheral A + ((unsigned int) AT91C_PB30_PWM3 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWMC_CH2_CfgPIO +//* \brief Configure PIO controllers to drive PWMC_CH2 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_CH2_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB21_PWM2 ), // Peripheral A + ((unsigned int) AT91C_PB29_PWM2 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWMC_CH1_CfgPIO +//* \brief Configure PIO controllers to drive PWMC_CH1 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_CH1_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB20_PWM1 ), // Peripheral A + ((unsigned int) AT91C_PB28_PWM1 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWMC_CH0_CfgPIO +//* \brief Configure PIO controllers to drive PWMC_CH0 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_CH0_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB19_PWM0 ), // Peripheral A + ((unsigned int) AT91C_PB27_PWM0 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_RTTC_CfgPMC +//* \brief Enable Peripheral clock in PMC for RTTC +//*---------------------------------------------------------------------------- +__inline void AT91F_RTTC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_CfgPMC +//* \brief Enable Peripheral clock in PMC for UDP +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_UDP)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_EMAC_CfgPMC +//* \brief Enable Peripheral clock in PMC for EMAC +//*---------------------------------------------------------------------------- +__inline void AT91F_EMAC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_EMAC)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_EMAC_CfgPIO +//* \brief Configure PIO controllers to drive EMAC signals +//*---------------------------------------------------------------------------- +__inline void AT91F_EMAC_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB2_ETX0 ) | + ((unsigned int) AT91C_PB12_ETXER ) | + ((unsigned int) AT91C_PB16_ECOL ) | + ((unsigned int) AT91C_PB15_ERXDV_ECRSDV) | + ((unsigned int) AT91C_PB11_ETX3 ) | + ((unsigned int) AT91C_PB6_ERX1 ) | + ((unsigned int) AT91C_PB13_ERX2 ) | + ((unsigned int) AT91C_PB3_ETX1 ) | + ((unsigned int) AT91C_PB4_ECRS ) | + ((unsigned int) AT91C_PB8_EMDC ) | + ((unsigned int) AT91C_PB5_ERX0 ) | + ((unsigned int) AT91C_PB18_EF100 ) | + ((unsigned int) AT91C_PB14_ERX3 ) | + ((unsigned int) AT91C_PB1_ETXEN ) | + ((unsigned int) AT91C_PB10_ETX2 ) | + ((unsigned int) AT91C_PB0_ETXCK_EREFCK) | + ((unsigned int) AT91C_PB9_EMDIO ) | + ((unsigned int) AT91C_PB7_ERXER ) | + ((unsigned int) AT91C_PB17_ERXCK ), // Peripheral A + 0); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC0_CfgPMC +//* \brief Enable Peripheral clock in PMC for TC0 +//*---------------------------------------------------------------------------- +__inline void AT91F_TC0_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_TC0)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC0_CfgPIO +//* \brief Configure PIO controllers to drive TC0 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_TC0_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB23_TIOA0 ) | + ((unsigned int) AT91C_PB24_TIOB0 ), // Peripheral A + ((unsigned int) AT91C_PB12_TCLK0 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC1_CfgPMC +//* \brief Enable Peripheral clock in PMC for TC1 +//*---------------------------------------------------------------------------- +__inline void AT91F_TC1_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_TC1)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC1_CfgPIO +//* \brief Configure PIO controllers to drive TC1 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_TC1_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB25_TIOA1 ) | + ((unsigned int) AT91C_PB26_TIOB1 ), // Peripheral A + ((unsigned int) AT91C_PB19_TCLK1 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC2_CfgPMC +//* \brief Enable Peripheral clock in PMC for TC2 +//*---------------------------------------------------------------------------- +__inline void AT91F_TC2_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_TC2)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC2_CfgPIO +//* \brief Configure PIO controllers to drive TC2 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_TC2_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB28_TIOB2 ) | + ((unsigned int) AT91C_PB27_TIOA2 ), // Peripheral A + 0); // Peripheral B + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PA15_TCLK2 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_CfgPMC +//* \brief Enable Peripheral clock in PMC for MC +//*---------------------------------------------------------------------------- +__inline void AT91F_MC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIOA_CfgPMC +//* \brief Enable Peripheral clock in PMC for PIOA +//*---------------------------------------------------------------------------- +__inline void AT91F_PIOA_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_PIOA)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIOB_CfgPMC +//* \brief Enable Peripheral clock in PMC for PIOB +//*---------------------------------------------------------------------------- +__inline void AT91F_PIOB_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_PIOB)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgPMC +//* \brief Enable Peripheral clock in PMC for CAN +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_CAN)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgPIO +//* \brief Configure PIO controllers to drive CAN signals +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA20_CANTX ) | + ((unsigned int) AT91C_PA19_CANRX ), // Peripheral A + 0); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWMC_CfgPMC +//* \brief Enable Peripheral clock in PMC for PWMC +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_PWMC)); +} + +#endif // lib_AT91SAM7X256_H diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/settings/cmock_demo.cspy.bat b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/settings/cmock_demo.cspy.bat new file mode 100644 index 0000000..46433e0 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/settings/cmock_demo.cspy.bat @@ -0,0 +1,32 @@ +@REM This bat file has been generated by the IAR Embeddded Workbench +@REM C-SPY interactive debugger,as an aid to preparing a command +@REM line for running the cspybat command line utility with the +@REM appropriate settings. +@REM +@REM After making some adjustments to this file, you can launch cspybat +@REM by typing the name of this file followed by the name of the debug +@REM file (usually an ubrof file). Note that this file is generated +@REM every time a new debug session is initialized, so you may want to +@REM move or rename the file before making changes. +@REM +@REM Note: some command line arguments cannot be properly generated +@REM by this process. Specifically, the plugin which is responsible +@REM for the Terminal I/O window (and other C runtime functionality) +@REM comes in a special version for cspybat, and the name of that +@REM plugin dll is not known when generating this file. It resides in +@REM the $TOOLKIT_DIR$\bin folder and is usually called XXXbat.dll or +@REM XXXlibsupportbat.dll, where XXX is the name of the corresponding +@REM tool chain. Replace the '' parameter +@REM below with the appropriate file name. Other plugins loaded by +@REM C-SPY are usually not needed by, or will not work in, cspybat +@REM but they are listed at the end of this file for reference. + + +"C:\Program Files\IAR Systems\Embedded Workbench 4.0\common\bin\cspybat" "C:\Program Files\IAR Systems\Embedded Workbench 4.0\ARM\bin\armproc.dll" "C:\Program Files\IAR Systems\Embedded Workbench 4.0\ARM\bin\armjlink.dll" %1 --plugin "C:\Program Files\IAR Systems\Embedded Workbench 4.0\ARM\bin\" --macro "C:\svn\cmock\iar\iar_v4\Resource\SAM7_FLASH.mac" --backend -B "--endian" "little" "--cpu" "ARM7TDMI" "--fpu" "None" "--proc_device_desc_file" "C:\Program Files\IAR Systems\Embedded Workbench 4.0\ARM\CONFIG\ioAT91SAM7X256.ddf" "--drv_verify_download" "all" "--proc_driver" "jlink" "--jlink_connection" "USB:0" "--jlink_initial_speed" "32" + + +@REM loaded plugins: +@REM armlibsupport.dll +@REM C:\Program Files\IAR Systems\Embedded Workbench 4.0\common\plugins\CodeCoverage\CodeCoverage.dll +@REM C:\Program Files\IAR Systems\Embedded Workbench 4.0\common\plugins\Profiling\Profiling.dll +@REM C:\Program Files\IAR Systems\Embedded Workbench 4.0\common\plugins\stack\stack.dll diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/settings/cmock_demo.dbgdt b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/settings/cmock_demo.dbgdt new file mode 100644 index 0000000..5e79c26 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/settings/cmock_demo.dbgdt @@ -0,0 +1,86 @@ + + + + + + + + + + + + + 185272727 + + + + + + 100 + + 20 + 1115 + 297 + 74 + + 110$PROJ_DIR$\TermIOInput.txt10 + + + + + + + + TabID-23656-3537 + Debug Log + Debug-Log + + + + TabID-22088-3567 + Build + Build + + + TabID-16970-5692Terminal I/OTerminalIO + + 0 + + + TabID-1637-3541 + Workspace + Workspace + + + cmock_democmock_demo/source + + + + 0 + + + TabID-12385-3544 + Disassembly + Disassembly + + + + + 0 + + + + + + TextEditorC:\svn\cmock\examples\src\Main.c02780680600100000010000001 + + + + + + + iaridepm1debuggergui1-2-2509276-2-2179148129149173302200577598361-2-2509177-2-2179148129149173302129149598361-2-22771388-2-213902791002886326698129149173302 + + + + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/settings/cmock_demo.dni b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/settings/cmock_demo.dni new file mode 100644 index 0000000..b187569 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/settings/cmock_demo.dni @@ -0,0 +1,42 @@ +[JLinkDriver] +WatchCond=_ 0 +Watch0=_ 0 "" 0 "" 0 "" 0 "" 0 0 0 0 +Watch1=_ 0 "" 0 "" 0 "" 0 "" 0 0 0 0 +[DisAssemblyWindow] +NumStates=_ 1 +State 1=_ 1 +[StackPlugin] +Enabled=1 +OverflowWarningsEnabled=1 +WarningThreshold=90 +SpWarningsEnabled=1 +WarnHow=0 +UseTrigger=1 +TriggerName=main +LimitSize=0 +ByteLimit=50 +[Log file] +LoggingEnabled=_ 0 +LogFile=_ "" +Category=_ 0 +[TermIOLog] +LoggingEnabled=_ 0 +LogFile=_ "" +[Interrupts] +Enabled=1 +Irq0=_ 0 480549 0 480549 0 0 0 100 0 1 "IRQ 1 0x18 CPSR.I" +Count=1 +[MemoryMap] +Enabled=0 +Base=0 +UseAuto=0 +TypeViolation=1 +UnspecRange=1 +ActionState=1 +[Disassemble mode] +mode=0 +[Breakpoints] +Count=0 +[TraceHelper] +Enabled=0 +ShowSource=1 diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/settings/cmock_demo.wsdt b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/settings/cmock_demo.wsdt new file mode 100644 index 0000000..33a5635 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/settings/cmock_demo.wsdt @@ -0,0 +1,76 @@ + + + + + + cmock_demo/Debug + + + + + + + + + 237272727 + + + + + + + 20111529774 + + + + + 100 + + + + + + + TabID-20770-112 + Workspace + Workspace + + + cmock_democmock_demo/Sourcecmock_demo/source + + + + 0 + + + TabID-10733-1323 + Build + Build + + + + TabID-27316-3469 + Debug Log + Debug-Log + + + + + 0 + + + + + + TextEditorC:\svn\cmock\examples\src\Main.c0056856800100000010000001 + + + + + + + iaridepm1-2-2554328-2-2179148129149173302238095651054-2-22561388-2-213902581002886302108129149173302 + + + + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/srcIAR/Cstartup.s79 b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/srcIAR/Cstartup.s79 new file mode 100644 index 0000000..73a53fc --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/srcIAR/Cstartup.s79 @@ -0,0 +1,266 @@ +;- ---------------------------------------------------------------------------- +;- ATMEL Microcontroller Software Support - ROUSSET - +;- ---------------------------------------------------------------------------- +;- DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +;- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +;- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +;- DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +;- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +;- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +;- OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +;- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +;- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +;- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +;- ---------------------------------------------------------------------------- +;- File source : Cstartup.s79 +;- Object : Generic CStartup +;- 1.0 01/Sep/05 FBr : Creation +;- 1.1 09/Sep/05 JPP : Change Interrupt management +;------------------------------------------------------------------------------ + +;------------------------------------------------------------------------------ +; Include your AT91 Library files +;------------------------------------------------------------------------------ +#include "AT91SAM7X256_inc.h" +;------------------------------------------------------------------------------ + +;------------------------------------------------------------------------------ +; ?RESET +; Reset Vector. +; Normally, segment INTVEC is linked at address 0. +; For debugging purposes, INTVEC may be placed at other addresses. +; A debugger that honors the entry point will start the +; program in a normal way even if INTVEC is not at address 0. +;------------------------------------------------------------------------------ + + PROGRAM ?RESET ;- Begins a program module + RSEG INTRAMEND_REMAP ;- Begins a relocatable segment + RSEG ICODE:CODE (2) ;- Begins a relocatable segment : corresponding address is 32-bit aligned + CODE32 ;- Always ARM mode after reset + ORG 0 ;- Sets the location counter: corresponds to the RESET vector address + +;------------------------------------------------------------------------------ +;- Exception vectors +;------------------------------------------------------------------------------ +;- These vectors can be read at address 0 or at RAM address +;- They ABSOLUTELY requires to be in relative addresssing mode in order to +;- guarantee a valid jump. For the moment, all are just looping. +;- If an exception occurs before remap, this would result in an infinite loop. +;- To ensure if a exeption occurs before start application to infinite loop. +;------------------------------------------------------------------------------ + +reset + B InitReset ; 0x00 Reset handler +undefvec: + B undefvec ; 0x04 Undefined Instruction +swivec: + B swivec ; 0x08 Software Interrupt +pabtvec: + B pabtvec ; 0x0C Prefetch Abort +dabtvec: + B dabtvec ; 0x10 Data Abort +rsvdvec: + B rsvdvec ; 0x14 reserved +irqvec: + B IRQ_Handler_Entry ; 0x18 IRQ + +fiqvec: ; 0x1c FIQ +;------------------------------------------------------------------------------ +;- Function : FIQ_Handler_Entry +;- Treatments : FIQ Controller Interrupt Handler. +;- Called Functions : AIC_FVR[interrupt] +;------------------------------------------------------------------------------ + +FIQ_Handler_Entry: + +;- Switch in SVC/User Mode to allow User Stack access for C code +; because the FIQ is not yet acknowledged + +;- Save and r0 in FIQ_Register + mov r9,r0 + ldr r0 , [r8, #AIC_FVR] + msr CPSR_c,#I_BIT | F_BIT | ARM_MODE_SVC +;- Save scratch/used registers and LR in User Stack + stmfd sp!, { r1-r3, r12, lr} + +;- Branch to the routine pointed by the AIC_FVR + mov r14, pc + bx r0 + +;- Restore scratch/used registers and LR from User Stack + ldmia sp!, { r1-r3, r12, lr} + +;- Leave Interrupts disabled and switch back in FIQ mode + msr CPSR_c, #I_BIT | F_BIT | ARM_MODE_FIQ + +;- Restore the R0 ARM_MODE_SVC register + mov r0,r9 + +;- Restore the Program Counter using the LR_fiq directly in the PC + subs pc,lr,#4 + +;------------------------------------------------------------------------------ +;- Manage exception: The exception must be ensure in ARM mode +;------------------------------------------------------------------------------ +;------------------------------------------------------------------------------ +;- Function : IRQ_Handler_Entry +;- Treatments : IRQ Controller Interrupt Handler. +;- Called Functions : AIC_IVR[interrupt] +;------------------------------------------------------------------------------ +IRQ_Handler_Entry: + +;------------------------- +;- Manage Exception Entry +;------------------------- +;- Adjust and save LR_irq in IRQ stack + sub lr, lr, #4 + stmfd sp!, {lr} + +;- Save r0 and SPSR (need to be saved for nested interrupt) + mrs r14, SPSR + stmfd sp!, {r0,r14} + +;- Write in the IVR to support Protect Mode +;- No effect in Normal Mode +;- De-assert the NIRQ and clear the source in Protect Mode + ldr r14, =AT91C_BASE_AIC + ldr r0 , [r14, #AIC_IVR] + str r14, [r14, #AIC_IVR] + +;- Enable Interrupt and Switch in Supervisor Mode + msr CPSR_c, #ARM_MODE_SVC + +;- Save scratch/used registers and LR in User Stack + stmfd sp!, { r1-r3, r12, r14} + +;---------------------------------------------- +;- Branch to the routine pointed by the AIC_IVR +;---------------------------------------------- + mov r14, pc + bx r0 + +;---------------------------------------------- +;- Manage Exception Exit +;---------------------------------------------- +;- Restore scratch/used registers and LR from User Stack + ldmia sp!, { r1-r3, r12, r14} + +;- Disable Interrupt and switch back in IRQ mode + msr CPSR_c, #I_BIT | ARM_MODE_IRQ + +;- Mark the End of Interrupt on the AIC + ldr r14, =AT91C_BASE_AIC + str r14, [r14, #AIC_EOICR] + +;- Restore SPSR_irq and r0 from IRQ stack + ldmia sp!, {r0,r14} + msr SPSR_cxsf, r14 + +;- Restore adjusted LR_irq from IRQ stack directly in the PC + ldmia sp!, {pc}^ + + + +InitReset: + +;------------------------------------------------------------------------------ +;- Low level Init is performed in a C function: AT91F_LowLevelInit +;- Init Stack Pointer to a valid memory area before calling AT91F_LowLevelInit +;------------------------------------------------------------------------------ + +;- Retrieve end of RAM address +__iramend EQU SFB(INTRAMEND_REMAP) ;- Segment begin + + EXTERN AT91F_LowLevelInit + ldr r13,=__iramend ;- Temporary stack in internal RAM for Low Level Init execution + ldr r0,=AT91F_LowLevelInit + mov lr, pc + bx r0 ;- Branch on C function (with interworking) + +;------------------------------------------------------------------------------ +;- Top of Stack Definition +;------------------------------------------------------------------------------ +;- Interrupt and Supervisor Stack are located at the top of internal memory in +;- order to speed the exception handling context saving and restoring. +;- ARM_MODE_SVC (Application, C) Stack is located at the top of the external memory. +;------------------------------------------------------------------------------ + +IRQ_STACK_SIZE EQU (3*8*4) ; 3 words to be saved per interrupt priority level +ARM_MODE_FIQ EQU 0x11 +ARM_MODE_IRQ EQU 0x12 +ARM_MODE_SVC EQU 0x13 +I_BIT EQU 0x80 +F_BIT EQU 0x40 + +;------------------------------------------------------------------------------ +;- Setup the stack for each mode +;------------------------------------------------------------------------------ + ldr r0, =__iramend + +;- Set up Fast Interrupt Mode and set FIQ Mode Stack + msr CPSR_c, #ARM_MODE_FIQ | I_BIT | F_BIT +;- Init the FIQ register + ldr r8, =AT91C_BASE_AIC + +;- Set up Interrupt Mode and set IRQ Mode Stack + msr CPSR_c, #ARM_MODE_IRQ | I_BIT | F_BIT + mov r13, r0 ; Init stack IRQ + sub r0, r0, #IRQ_STACK_SIZE + +;- Enable interrupt & Set up Supervisor Mode and set Supervisor Mode Stack + msr CPSR_c, #ARM_MODE_SVC + mov r13, r0 + +;------------------------------------------------------------------------------ +; Initialize segments. +;------------------------------------------------------------------------------ +; __segment_init is assumed to use +; instruction set and to be reachable by BL from the ICODE segment +; (it is safest to link them in segment ICODE). +;------------------------------------------------------------------------------ + EXTERN __segment_init + ldr r0,=__segment_init + mov lr, pc + bx r0 + +;------------------------------------------------------------------------------ +;- Branch on C code Main function (with interworking) +;------------------------------------------------------------------------------ + EXTERN main + PUBLIC __main +?jump_to_main: + ldr lr,=?call_exit + ldr r0,=main +__main: + bx r0 + +;------------------------------------------------------------------------------ +;- Loop for ever +;------------------------------------------------------------------------------ +;- End of application. Normally, never occur. +;- Could jump on Software Reset ( B 0x0 ). +;------------------------------------------------------------------------------ +?call_exit: +End + b End + +;------------------------------------------------------------------------------ +;- Exception Vectors +;------------------------------------------------------------------------------ + PUBLIC AT91F_Default_FIQ_handler + PUBLIC AT91F_Default_IRQ_handler + PUBLIC AT91F_Spurious_handler + + CODE32 ; Always ARM mode after exeption + +AT91F_Default_FIQ_handler + b AT91F_Default_FIQ_handler + +AT91F_Default_IRQ_handler + b AT91F_Default_IRQ_handler + +AT91F_Spurious_handler + b AT91F_Spurious_handler + + ENDMOD ;- Terminates the assembly of the current module + END ;- Terminates the assembly of the last module in a file \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/srcIAR/Cstartup_SAM7.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/srcIAR/Cstartup_SAM7.c new file mode 100644 index 0000000..0913da3 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v4/srcIAR/Cstartup_SAM7.c @@ -0,0 +1,98 @@ +// ---------------------------------------------------------------------------- +// ATMEL Microcontroller Software Support - ROUSSET - +// ---------------------------------------------------------------------------- +// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// ---------------------------------------------------------------------------- +// File Name : Cstartup_SAM7.c +// Object : Low level initialisations written in C for IAR Tools +// Creation : FBr 01-Sep-2005 +// 1.0 08-Sep-2005 JPP : Suppress Reset +// ---------------------------------------------------------------------------- + +#include "AT91SAM7X256.h" + +// The following functions must be write in ARM mode this function called directly by exception vector +extern void AT91F_Spurious_handler(void); +extern void AT91F_Default_IRQ_handler(void); +extern void AT91F_Default_FIQ_handler(void); + +//*---------------------------------------------------------------------------- +//* \fn AT91F_LowLevelInit +//* \brief This function performs very low level HW initialization +//* this function can use a Stack, depending the compilation +//* optimization mode +//*---------------------------------------------------------------------------- +void AT91F_LowLevelInit(void) +{ + unsigned char i; + ///////////////////////////////////////////////////////////////////////////////////////////////////// + // EFC Init + ///////////////////////////////////////////////////////////////////////////////////////////////////// + AT91C_BASE_MC->MC_FMR = AT91C_MC_FWS_1FWS; // 1 Wait State necessary to work at 48MHz + + ///////////////////////////////////////////////////////////////////////////////////////////////////// + // Init PMC Step 1. Enable Main Oscillator + // Main Oscillator startup time is board specific: + // Main Oscillator Startup Time worst case (3MHz) corresponds to 15ms (0x40 for AT91C_CKGR_OSCOUNT field) + ///////////////////////////////////////////////////////////////////////////////////////////////////// + AT91C_BASE_PMC->PMC_MOR = (( AT91C_CKGR_OSCOUNT & (0x40 <<8) | AT91C_CKGR_MOSCEN )); +#ifndef SIMULATE + // Wait Main Oscillator stabilization + while(!(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MOSCS)); +#endif + + ///////////////////////////////////////////////////////////////////////////////////////////////////// + // Init PMC Step 2. + // Set PLL to 96MHz (96,109MHz) and UDP Clock to 48MHz + // PLL Startup time depends on PLL RC filter: worst case is choosen + // UDP Clock (48,058MHz) is compliant with the Universal Serial Bus Specification (+/- 0.25% for full speed) + ///////////////////////////////////////////////////////////////////////////////////////////////////// + AT91C_BASE_PMC->PMC_PLLR = AT91C_CKGR_USBDIV_1 | AT91C_CKGR_OUT_0 | AT91C_CKGR_PLLCOUNT | + (AT91C_CKGR_MUL & (72 << 16)) | (AT91C_CKGR_DIV & 14); +#ifndef SIMULATE + // Wait for PLL stabilization + while( !(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_LOCK) ); + // Wait until the master clock is established for the case we already turn on the PLL + while( !(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MCKRDY) ); +#endif + + ///////////////////////////////////////////////////////////////////////////////////////////////////// + // Init PMC Step 3. + // Selection of Master Clock MCK (equal to Processor Clock PCK) equal to PLL/2 = 48MHz + // The PMC_MCKR register must not be programmed in a single write operation (see. Product Errata Sheet) + ///////////////////////////////////////////////////////////////////////////////////////////////////// + AT91C_BASE_PMC->PMC_MCKR = AT91C_PMC_PRES_CLK_2; +#ifndef SIMULATE + // Wait until the master clock is established + while( !(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MCKRDY) ); +#endif + + AT91C_BASE_PMC->PMC_MCKR |= AT91C_PMC_CSS_PLL_CLK; +#ifndef SIMULATE + // Wait until the master clock is established + while( !(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MCKRDY) ); +#endif + + ///////////////////////////////////////////////////////////////////////////////////////////////////// + // Disable Watchdog (write once register) + ///////////////////////////////////////////////////////////////////////////////////////////////////// + AT91C_BASE_WDTC->WDTC_WDMR = AT91C_WDTC_WDDIS; + + //////////////////////////////////////////////////////////////////////////////////////////////////// + // Init AIC: assign corresponding handler for each interrupt source + ///////////////////////////////////////////////////////////////////////////////////////////////////// + AT91C_BASE_AIC->AIC_SVR[0] = (int) AT91F_Default_FIQ_handler ; + for (i = 1; i < 31; i++) { + AT91C_BASE_AIC->AIC_SVR[i] = (int) AT91F_Default_IRQ_handler ; + } + AT91C_BASE_AIC->AIC_SPU = (unsigned int) AT91F_Spurious_handler; +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/SAM7_FLASH.mac b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/SAM7_FLASH.mac new file mode 100644 index 0000000..407acb2 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/SAM7_FLASH.mac @@ -0,0 +1,71 @@ +// ---------------------------------------------------------------------------- +// ATMEL Microcontroller Software Support - ROUSSET - +// ---------------------------------------------------------------------------- +// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// ---------------------------------------------------------------------------- +// File Name : SAM7_FLASH.mac +// Object : Generic Macro File for IAR +// 1.0 17/Aug/05 FBr : Creation +// ---------------------------------------------------------------------------- + +/********************************************************************* +* +* _InitRSTC() +* +* Function description +* Initializes the RSTC (Reset controller). +* This makes sense since the default is to not allow user resets, which makes it impossible to +* apply a second RESET via J-Link +*/ +_InitRSTC() { + __writeMemory32(0xA5000001, 0xFFFFFD08,"Memory"); // Allow user reset +} + +/********************************************************************* +* +* _InitPLL() +* Function description +* Initializes the PMC. +* 1. Enable the Main Oscillator +* 2. Configure PLL to 96MHz +* 3. Switch Master Clock (MCK) on PLL/2 = 48MHz +*/ + _InitPLL() { + + __message "Enable Main Oscillator"; + __writeMemory32(0x00000601,0xFFFFFc20,"Memory"); // MOSC + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x1) ); + + __message "Set PLL to 96MHz"; + __writeMemory32(0x10191c05,0xFFFFFc2c,"Memory"); // LOCK + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x4) ); + + __message "Set Master Clock to 48MHz"; + __writeMemory32(0x00000004,0xFFFFFc30,"Memory"); // MCKRDY + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x8) ); + __writeMemory32(0x00000007,0xFFFFFc30,"Memory"); // MCKRDY + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x8) ); +} + +/********************************************************************* +* +* execUserReset() : JTAG set initially to Full Speed +*/ +execUserReset() { + __message "execUserReset()"; + __emulatorSpeed(30000); // Set JTAG speed to 30kHz to make a hardware reset + __hwReset(0); // Hardware Reset: CPU is automatically halted after the reset (JTAG is already configured to 32kHz) + _InitPLL(); // Allow to debug at JTAG Full Speed + _InitRSTC(); // Enable User Reset to allow execUserReset() execution + __emulatorSpeed(0); // Set JTAG speed to full speed +} + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/SAM7_RAM.mac b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/SAM7_RAM.mac new file mode 100644 index 0000000..a2b8a01 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/SAM7_RAM.mac @@ -0,0 +1,94 @@ +// ---------------------------------------------------------------------------- +// ATMEL Microcontroller Software Support - ROUSSET - +// ---------------------------------------------------------------------------- +// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// ---------------------------------------------------------------------------- +// File Name : SAM7_RAM.mac +// Object : Generic Macro File for IAR +// 1.0 17/Aug/05 FBr : Creation +// ---------------------------------------------------------------------------- + +/********************************************************************* +* +* _MapRAMAt0() +* +* Function description +* Maps RAM at 0. +*/ +_MapRAMAt0(){ + __message "Changing mapping: RAM mapped to 0"; + __writeMemory32(0x00000001,0xFFFFFF00,"Memory"); +} + +/********************************************************************* +* +* _InitRSTC() +* +* Function description +* Initializes the RSTC (Reset controller). +* This makes sense since the default is to not allow user resets, which makes it impossible to +* apply a second RESET via J-Link +*/ +_InitRSTC() { + __writeMemory32(0xA5000001, 0xFFFFFD08,"Memory"); // Allow user reset +} + +/********************************************************************* +* +* _InitPLL() +* Function description +* Initializes the PMC. +* 1. Enable the Main Oscillator +* 2. Configure PLL to 96MHz +* 3. Switch Master Clock (MCK) on PLL/2 = 48MHz +*/ + _InitPLL() { + + __message "Set Main Oscillator"; + __writeMemory32(0x00004001,0xFFFFFc20,"Memory"); // MOSC + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x1) ); + + __message "Set PLL to 96MHz"; + __writeMemory32(0x10483f0e,0xFFFFFc2c,"Memory"); // LOCK + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x4) ); + + __message "Set Master Clock to 48MHz"; + __writeMemory32(0x00000004,0xFFFFFc30,"Memory"); // MCKRDY + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x8) ); + __writeMemory32(0x00000007,0xFFFFFc30,"Memory"); // MCKRDY + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x8) ); +} + +/********************************************************************* +* +* execUserReset() : JTAG set initially to Full Speed +*/ +execUserReset() { + __message "execUserReset()"; + __emulatorSpeed(30000); // Set JTAG speed to 30kHz to make a hardware reset + __hwReset(0); // Hardware Reset: CPU is automatically halted after the reset + _InitPLL(); // Allow to debug at JTAG Full Speed + _MapRAMAt0(); // Remap RAM to address 0 + __emulatorSpeed(0); // Set JTAG speed to full speed +} + +/********************************************************************* +* +* execUserPreload() : JTAG set initially to 32kHz +*/ +execUserPreload() { + __message "execUserPreload()"; + __hwReset(0); // Hardware Reset: CPU is automatically halted after the reset (JTAG is already configured to 32kHz) + _InitPLL(); // Allow to load Code at JTAG Full Speed + _MapRAMAt0(); // Remap RAM to address 0 + _InitRSTC(); // Enable User Reset to allow execUserReset() execution +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/SAM7_SIM.mac b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/SAM7_SIM.mac new file mode 100644 index 0000000..418a2c3 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/SAM7_SIM.mac @@ -0,0 +1,67 @@ +//========================================================= +// Simulation setup file for esc07_demo project +//========================================================= + +__var _timer0_interrupt_ID; + +irqBreak() +{ + __var __AIC_SMR; + __var __AIC_IECR; + __var __AIC_IVR; + + // read AIC_IECR instead, since not fully supported by simulator + __AIC_IECR = __readMemory32(0xFFFFF120, "Memory"); + if(__AIC_IECR & 0x1000) + { + __AIC_SMR = __readMemory32(0xFFFFF060, "Memory"); + __AIC_IVR = __readMemory32(0xFFFFF0B0, "Memory"); //AIC_IVR = AIC_SVR[x] + __writeMemory32(__AIC_IVR, 0xFFFFF100, "Memory"); //AIC_IVR + __writeMemory32(0x1000, 0xFFFFF10C, "Memory"); //AIC_IPR + __writeMemory32(0x2, 0xFFFFF114, "Memory"); //AIC_CISR + } + + return 0; +} + +setupProcessorRegisters() +{ + // Write TC0_SR.CPCS with correct status for ISR (Clock enabled; RC Compare Flag = TRUE) + __writeMemory32(0x00010010, 0xfffa0020, "Memory"); + + // Set TX ready flag in USART0 status register + // USART0_BASE->US_CSR = AT91C_US_TXRDY + __writeMemory32(0x00000002, 0xfffc0014, "Memory"); +} + +configureTimer0Interrupt() +{ + __var _master_clock_frequency; + __var _timer0_period_cycles; + + // Calculate timer0 frequency in master clock cycles + _master_clock_frequency = 48054857; + _timer0_period_cycles = _master_clock_frequency / 100; + if((_master_clock_frequency % 100) >= 50) + { + _timer0_period_cycles++; + } + + __cancelAllInterrupts(); + __enableInterrupts(); + + _timer0_interrupt_ID = __orderInterrupt("IRQ", _timer0_period_cycles, _timer0_period_cycles, 0, 0, 0, 100); + + if(-1 == _timer0_interrupt_ID) + { + __message "ERROR: failed to order timer 0 interrupt"; + } + + __setCodeBreak("0x18", 0, "irqBreak()", "TRUE", ""); +} + +execUserReset() +{ + setupProcessorRegisters(); + configureTimer0Interrupt(); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/at91SAM7X256_FLASH.icf b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/at91SAM7X256_FLASH.icf new file mode 100644 index 0000000..ab842a2 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/at91SAM7X256_FLASH.icf @@ -0,0 +1,43 @@ +/*###ICF### Section handled by ICF editor, don't touch! ****/ +/*-Editor annotation file-*/ +/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\a_v1_0.xml" */ +/*-Specials-*/ +define symbol __ICFEDIT_intvec_start__ = 0x00000000; +/*-Memory Regions-*/ +define symbol __ICFEDIT_region_ROM_start__ = 0x00000100; +define symbol __ICFEDIT_region_ROM_end__ = 0x0003FFFF; +define symbol __ICFEDIT_region_RAM_start__ = 0x00200000; +define symbol __ICFEDIT_region_RAM_end__ = 0x0020FFFF; +/*-Sizes-*/ +define symbol __ICFEDIT_size_cstack__ = 0x400; +define symbol __ICFEDIT_size_svcstack__ = 0x100; +define symbol __ICFEDIT_size_irqstack__ = 0x100; +define symbol __ICFEDIT_size_fiqstack__ = 0x40; +define symbol __ICFEDIT_size_undstack__ = 0x40; +define symbol __ICFEDIT_size_abtstack__ = 0x40; +define symbol __ICFEDIT_size_heap__ = 0x400; +/**** End of ICF editor section. ###ICF###*/ + + +define memory mem with size = 4G; +define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__]; +define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; + +define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; +define block SVC_STACK with alignment = 8, size = __ICFEDIT_size_svcstack__ { }; +define block IRQ_STACK with alignment = 8, size = __ICFEDIT_size_irqstack__ { }; +define block FIQ_STACK with alignment = 8, size = __ICFEDIT_size_fiqstack__ { }; +define block UND_STACK with alignment = 8, size = __ICFEDIT_size_undstack__ { }; +define block ABT_STACK with alignment = 8, size = __ICFEDIT_size_abtstack__ { }; +define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; + +initialize by copy { readwrite }; +do not initialize { section .noinit }; + +place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; + +place in ROM_region { readonly }; +place in RAM_region { readwrite, + block CSTACK, block SVC_STACK, block IRQ_STACK, block FIQ_STACK, + block UND_STACK, block ABT_STACK, block HEAP }; + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/at91SAM7X256_RAM.icf b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/at91SAM7X256_RAM.icf new file mode 100644 index 0000000..cc79cda --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/at91SAM7X256_RAM.icf @@ -0,0 +1,42 @@ +/*###ICF### Section handled by ICF editor, don't touch! ****/ +/*-Editor annotation file-*/ +/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\a_v1_0.xml" */ +/*-Specials-*/ +define symbol __ICFEDIT_intvec_start__ = 0x00000000; +/*-Memory Regions-*/ +define symbol __ICFEDIT_region_ROM_start__ = 0x00; +define symbol __ICFEDIT_region_ROM_end__ = 0x00; +define symbol __ICFEDIT_region_RAM_start__ = 0x00000100; +define symbol __ICFEDIT_region_RAM_end__ = 0x0000FFFF; +/*-Sizes-*/ +define symbol __ICFEDIT_size_cstack__ = 0x400; +define symbol __ICFEDIT_size_svcstack__ = 0x100; +define symbol __ICFEDIT_size_irqstack__ = 0x100; +define symbol __ICFEDIT_size_fiqstack__ = 0x40; +define symbol __ICFEDIT_size_undstack__ = 0x40; +define symbol __ICFEDIT_size_abtstack__ = 0x40; +define symbol __ICFEDIT_size_heap__ = 0x800; +/**** End of ICF editor section. ###ICF###*/ + + +define memory mem with size = 4G; +define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; + +define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; +define block SVC_STACK with alignment = 8, size = __ICFEDIT_size_svcstack__ { }; +define block IRQ_STACK with alignment = 8, size = __ICFEDIT_size_irqstack__ { }; +define block FIQ_STACK with alignment = 8, size = __ICFEDIT_size_fiqstack__ { }; +define block UND_STACK with alignment = 8, size = __ICFEDIT_size_undstack__ { }; +define block ABT_STACK with alignment = 8, size = __ICFEDIT_size_abtstack__ { }; +define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; + +initialize by copy { readwrite }; +do not initialize { section .noinit }; + +place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; + +place in RAM_region { readonly }; +place in RAM_region { readwrite, + block CSTACK, block SVC_STACK, block IRQ_STACK, block FIQ_STACK, + block UND_STACK, block ABT_STACK, block HEAP }; + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/cmock_demo.dep b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/cmock_demo.dep new file mode 100644 index 0000000..456f4db --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/cmock_demo.dep @@ -0,0 +1,4204 @@ + + + + 2 + 3270150602 + + Binary + + $PROJ_DIR$\Binary\Obj\TimerConductor.o + $TOOLKIT_DIR$\inc\DLib_Defaults.h + $TOOLKIT_DIR$\inc\DLib_Threads.h + $PROJ_DIR$\Binary\Obj\TimerConductor.pbi + $PROJ_DIR$\Binary\List\TimerInterruptConfigurator.lst + $PROJ_DIR$\Binary\Obj\AdcTemperatureSensor.o + $PROJ_DIR$\..\..\test\system\src\TimerInterruptConfigurator.h + $PROJ_DIR$\..\..\test\system\src\TimerModel.h + $TOOLKIT_DIR$\inc\ymath.h + $PROJ_DIR$\Binary\Obj\Cstartup_SAM7.o + $TOOLKIT_DIR$\inc\DLib_Product.h + $TOOLKIT_DIR$\inc\math.h + $PROJ_DIR$\Binary\Exe\cmock_demo.hex + $PROJ_DIR$\Binary\Obj\UsartPutChar.pbi + $PROJ_DIR$\..\..\test\system\src\TimerInterruptHandler.h + $PROJ_DIR$\Binary\Obj\AdcConductor.pbi + $PROJ_DIR$\Binary\List\TimerConfigurator.lst + $PROJ_DIR$\Binary\List\TaskScheduler.lst + $PROJ_DIR$\Binary\List\TemperatureCalculator.lst + $PROJ_DIR$\Binary\List\UsartConductor.lst + $PROJ_DIR$\Binary\Obj\UsartConductor.o + $PROJ_DIR$\Binary\Obj\TimerModel.o + $PROJ_DIR$\Binary\Obj\UsartConfigurator.pbi + $PROJ_DIR$\Binary\Obj\TimerInterruptConfigurator.o + $PROJ_DIR$\Binary\List\Cstartup.lst + $PROJ_DIR$\..\..\test\system\src\Executor.h + $PROJ_DIR$\incIAR\project.h + $PROJ_DIR$\Binary\Obj\Executor.pbi + $PROJ_DIR$\Binary\List\TimerConductor.lst + $PROJ_DIR$\Binary\Obj\TimerModel.pbi + $TOOLKIT_DIR$\inc\intrinsics.h + $PROJ_DIR$\Binary\Obj\Model.pbi + $PROJ_DIR$\Binary\Obj\UsartBaudRateRegisterCalculator.o + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.h + $PROJ_DIR$\..\..\examples\src\UsartModel.h + $PROJ_DIR$\Binary\Obj\TaskScheduler.pbi + $PROJ_DIR$\Binary\Obj\Executor.o + $PROJ_DIR$\Binary\Obj\TemperatureCalculator.o + $PROJ_DIR$\Binary\Obj\Cstartup_SAM7.pbi + $PROJ_DIR$\..\..\test\system\src\AT91SAM7X256.h + $PROJ_DIR$\Binary\Obj\IntrinsicsWrapper.pbi + $PROJ_DIR$\..\..\examples\src\UsartHardware.h + $PROJ_DIR$\Binary\List\Main.lst + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.h + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.h + $PROJ_DIR$\Binary\List\TimerHardware.lst + $PROJ_DIR$\..\..\test\system\src\UsartBaudRateRegisterCalculator.h + $PROJ_DIR$\..\..\test\system\src\TemperatureCalculator.h + $PROJ_DIR$\..\..\test\system\src\UsartPutChar.h + $PROJ_DIR$\..\..\test\system\src\TaskScheduler.h + $PROJ_DIR$\Binary\List\UsartTransmitBufferStatus.lst + $PROJ_DIR$\Binary\Obj\AdcTemperatureSensor.pbi + $PROJ_DIR$\Binary\Obj\Main.pbi + $PROJ_DIR$\Binary\List\UsartModel.lst + $PROJ_DIR$\Binary\Obj\TemperatureFilter.pbi + $PROJ_DIR$\Binary\List\AdcHardware.lst + $PROJ_DIR$\Binary\List\AdcTemperatureSensor.lst + $PROJ_DIR$\Binary\Obj\UsartTransmitBufferStatus.pbi + $PROJ_DIR$\Binary\Obj\AdcHardware.pbi + $PROJ_DIR$\Binary\Obj\TemperatureCalculator.pbi + $TOOLKIT_DIR$\lib\dl4t_tl_in.a + $TOOLKIT_DIR$\inc\ycheck.h + $PROJ_DIR$\..\..\test\system\src\ModelConfig.h + $PROJ_DIR$\Binary\List\AdcConductor.lst + $PROJ_DIR$\Binary\List\AdcHardwareConfigurator.lst + $PROJ_DIR$\Binary\Obj\TimerHardware.o + $PROJ_DIR$\Binary\Obj\TimerInterruptHandler.o + $TOOLKIT_DIR$\inc\stdio.h + $PROJ_DIR$\Binary\Obj\UsartHardware.o + $PROJ_DIR$\Binary\Obj\TimerInterruptHandler.pbi + $PROJ_DIR$\Binary\Obj\UsartModel.o + $TOOLKIT_DIR$\inc\DLib_Config_Normal.h + $PROJ_DIR$\Binary\List\TemperatureFilter.lst + $PROJ_DIR$\Binary\List\UsartPutChar.lst + $PROJ_DIR$\Binary\Obj\UsartConfigurator.o + $PROJ_DIR$\..\..\test\system\src\UsartConductor.h + $PROJ_DIR$\Binary\List\AdcModel.lst + $PROJ_DIR$\..\..\test\system\src\TemperatureFilter.h + $PROJ_DIR$\..\..\test\system\src\Types.h + $PROJ_DIR$\..\..\test\system\src\TimerConfigurator.h + $TOOLKIT_DIR$\inc\yvals.h + $PROJ_DIR$\..\..\test\system\src\UsartModel.h + $PROJ_DIR$\Binary\Obj\UsartTransmitBufferStatus.o + $TOOLKIT_DIR$\lib\rt4t_al.a + $PROJ_DIR$\Binary\List\UsartHardware.lst + $TOOLKIT_DIR$\inc\ysizet.h + $PROJ_DIR$\Binary\Obj\AdcModel.o + $PROJ_DIR$\Binary\Obj\AdcConductor.o + $PROJ_DIR$\Binary\Exe\cmock_demo.out + $PROJ_DIR$\..\..\test\system\src\AdcConductor.h + $PROJ_DIR$\..\..\test\system\src\AdcTemperatureSensor.h + $PROJ_DIR$\Binary\Obj\UsartModel.pbi + $PROJ_DIR$\..\..\test\system\src\TimerHardware.h + $PROJ_DIR$\..\..\test\system\src\AdcModel.h + $PROJ_DIR$\..\..\test\system\src\AdcHardware.h + $PROJ_DIR$\Binary\List\UsartBaudRateRegisterCalculator.lst + $PROJ_DIR$\..\..\test\system\src\Model.h + $TOOLKIT_DIR$\lib\shs_l.a + $PROJ_DIR$\..\..\test\system\src\UsartConfigurator.h + $PROJ_DIR$\Binary\Obj\TimerInterruptConfigurator.pbi + $PROJ_DIR$\Binary\List\UsartConfigurator.lst + $PROJ_DIR$\Binary\List\TimerModel.lst + $PROJ_DIR$\..\..\examples\src\Executor.h + $PROJ_DIR$\Binary\Obj\IntrinsicsWrapper.o + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.h + $PROJ_DIR$\..\..\examples\src\UsartConductor.h + $PROJ_DIR$\..\..\test\system\src\AdcTemperatureSensor.c + $PROJ_DIR$\..\..\examples\src\TimerConductor.h + $PROJ_DIR$\Binary\Obj\AdcHardwareConfigurator.o + $TOOLKIT_DIR$\inc\xencoding_limits.h + $PROJ_DIR$\..\..\test\system\src\Main.c + $PROJ_DIR$\..\..\test\system\src\AdcHardwareConfigurator.c + $PROJ_DIR$\..\..\test\system\src\AdcConductor.c + $PROJ_DIR$\..\..\test\system\src\AdcHardware.c + $PROJ_DIR$\..\..\examples\src\TimerModel.h + $PROJ_DIR$\..\..\test\system\src\AdcModel.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.h + $PROJ_DIR$\..\..\test\system\src\Executor.c + $PROJ_DIR$\..\..\examples\src\Model.h + $PROJ_DIR$\..\..\test\system\src\Model.c + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.h + $PROJ_DIR$\..\..\examples\src\UsartPutChar.h + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.h + $PROJ_DIR$\..\..\test\system\src\TemperatureFilter.c + $PROJ_DIR$\..\..\test\system\src\TimerConfigurator.c + $PROJ_DIR$\..\..\test\system\src\TemperatureCalculator.c + $PROJ_DIR$\..\..\test\system\src\TaskScheduler.c + $PROJ_DIR$\..\..\test\system\src\TimerInterruptConfigurator.c + $PROJ_DIR$\Binary\Obj\AdcModel.pbi + $PROJ_DIR$\..\..\test\system\src\TimerConductor.c + $PROJ_DIR$\..\..\test\system\src\TimerInterruptHandler.c + $PROJ_DIR$\Binary\Obj\AdcHardware.o + $PROJ_DIR$\..\..\test\system\src\UsartConfigurator.c + $PROJ_DIR$\..\..\test\system\src\TimerHardware.c + $PROJ_DIR$\..\..\test\system\src\UsartTransmitBufferStatus.c + $PROJ_DIR$\..\..\examples\src\AdcModel.h + $PROJ_DIR$\..\..\test\system\src\TimerModel.c + $PROJ_DIR$\..\..\test\system\src\UsartBaudRateRegisterCalculator.c + $PROJ_DIR$\..\..\test\system\src\UsartConductor.c + $PROJ_DIR$\..\..\examples\src\AdcHardware.h + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.h + $PROJ_DIR$\..\..\test\system\src\UsartHardware.c + $PROJ_DIR$\..\..\test\system\src\UsartModel.c + $PROJ_DIR$\..\..\test\system\src\UsartPutChar.c + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.h + $PROJ_DIR$\..\..\examples\src\ModelConfig.h + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.h + $PROJ_DIR$\..\..\examples\src\Types.h + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.h + $PROJ_DIR$\..\..\examples\src\AdcConductor.h + $PROJ_DIR$\..\..\examples\src\AT91SAM7X256.h + $PROJ_DIR$\..\..\examples\src\TaskScheduler.h + $PROJ_DIR$\..\..\examples\src\TimerHardware.h + $PROJ_DIR$\Binary\Obj\TimerHardware.pbi + $PROJ_DIR$\Binary\Obj\TimerConfigurator.o + $PROJ_DIR$\Binary\List\Model.lst + $PROJ_DIR$\Binary\Obj\Cstartup.o + $PROJ_DIR$\Binary\Obj\TaskScheduler.o + $PROJ_DIR$\Binary\Obj\TemperatureFilter.o + $PROJ_DIR$\..\..\test\system\src\TimerConductor.h + $PROJ_DIR$\Binary\Obj\Model.o + $PROJ_DIR$\..\..\test\system\src\UsartTransmitBufferStatus.h + $PROJ_DIR$\Binary\Obj\UsartHardware.pbi + $PROJ_DIR$\Binary\List\TimerInterruptHandler.lst + $PROJ_DIR$\Binary\Obj\cmock_demo.pbd + $PROJ_DIR$\..\..\test\system\src\UsartHardware.h + $PROJ_DIR$\..\..\test\system\src\AdcHardwareConfigurator.h + $PROJ_DIR$\Binary\Obj\UsartConductor.pbi + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + $PROJ_DIR$\..\..\examples\src\AdcModel.c + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + $PROJ_DIR$\..\..\examples\src\Executor.c + $PROJ_DIR$\..\..\examples\src\Main.c + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + $PROJ_DIR$\..\..\examples\src\Model.c + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + $PROJ_DIR$\Resource\at91SAM7X256_FLASH.icf + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + $PROJ_DIR$\..\..\examples\src\TimerModel.c + $PROJ_DIR$\..\..\examples\src\UsartModel.c + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + $PROJ_DIR$\srcIAR\Cstartup.s + $PROJ_DIR$\Binary\Obj\UsartPutChar.o + $PROJ_DIR$\Binary\Obj\TimerConfigurator.pbi + $PROJ_DIR$\Binary\Obj\Main.o + $PROJ_DIR$\Binary\List\Executor.lst + $PROJ_DIR$\incIAR\AT91SAM7X-EK.h + $PROJ_DIR$\incIAR\lib_AT91SAM7X256.h + $PROJ_DIR$\incIAR\AT91SAM7X256_inc.h + $PROJ_DIR$\Binary\Obj\AdcHardwareConfigurator.pbi + $PROJ_DIR$\Binary\Obj\UsartBaudRateRegisterCalculator.pbi + + + [ROOT_NODE] + + + ILINK + 88 + + + + + $PROJ_DIR$\Binary\Exe\cmock_demo.out + + + OBJCOPY + 12 + + + + + ILINK + 179 87 131 108 86 5 156 9 36 103 198 160 157 37 158 0 154 65 23 66 21 32 20 74 68 70 196 82 97 83 60 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcTemperatureSensor.c + + + BICOMP + 51 + + + ICCARM + 56 5 + + + + + BICOMP + 78 39 90 + + + ICCARM + 78 39 90 + + + + + $PROJ_DIR$\..\..\test\system\src\Main.c + + + BICOMP + 52 + + + ICCARM + 42 198 + + + + + BICOMP + 78 39 25 96 49 47 77 75 165 98 48 81 46 161 159 92 79 6 14 7 89 94 166 90 93 + + + ICCARM + 78 39 25 96 49 47 77 75 165 98 48 81 46 161 159 92 79 6 14 7 89 94 166 90 93 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcHardwareConfigurator.c + + + BICOMP + 203 + + + ICCARM + 64 108 + + + + + BICOMP + 78 39 166 62 + + + ICCARM + 78 39 166 62 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcConductor.c + + + BICOMP + 15 + + + ICCARM + 63 87 + + + + + BICOMP + 78 39 89 93 94 + + + ICCARM + 78 39 89 93 94 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcHardware.c + + + BICOMP + 58 + + + ICCARM + 55 131 + + + + + BICOMP + 78 39 94 166 90 + + + ICCARM + 78 39 94 166 90 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcModel.c + + + BICOMP + 128 + + + ICCARM + 76 86 + + + + + BICOMP + 78 39 93 49 47 77 + + + ICCARM + 78 39 93 49 47 77 + + + + + $PROJ_DIR$\..\..\test\system\src\Executor.c + + + BICOMP + 27 + + + ICCARM + 199 36 + + + + + BICOMP + 78 39 25 96 75 159 89 30 61 + + + ICCARM + 78 39 25 96 75 159 89 30 61 + + + + + $PROJ_DIR$\..\..\test\system\src\Model.c + + + BICOMP + 31 + + + ICCARM + 155 160 + + + + + BICOMP + 96 78 39 49 77 + + + ICCARM + 96 78 39 49 77 + + + + + $PROJ_DIR$\..\..\test\system\src\TemperatureFilter.c + + + BICOMP + 54 + + + ICCARM + 72 158 + + + + + BICOMP + 78 39 77 11 61 8 80 1 10 109 2 + + + ICCARM + 78 39 77 11 61 8 80 1 71 10 109 2 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerConfigurator.c + + + BICOMP + 197 + + + ICCARM + 16 154 + + + + + BICOMP + 78 39 79 6 + + + ICCARM + 78 39 79 6 + + + + + $PROJ_DIR$\..\..\test\system\src\TemperatureCalculator.c + + + BICOMP + 59 + + + ICCARM + 18 37 + + + + + BICOMP + 78 39 47 11 61 8 80 1 10 109 2 + + + ICCARM + 78 39 47 11 61 8 80 1 71 10 109 2 + + + + + $PROJ_DIR$\..\..\test\system\src\TaskScheduler.c + + + BICOMP + 35 + + + ICCARM + 17 157 + + + + + BICOMP + 78 39 49 + + + ICCARM + 78 39 49 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerInterruptConfigurator.c + + + BICOMP + 99 + + + ICCARM + 4 23 + + + + + BICOMP + 78 39 6 14 + + + ICCARM + 78 39 6 14 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerConductor.c + + + BICOMP + 3 + + + ICCARM + 28 0 + + + + + BICOMP + 78 39 159 7 92 14 + + + ICCARM + 78 39 159 7 92 14 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerInterruptHandler.c + + + BICOMP + 69 + + + ICCARM + 163 66 + + + + + BICOMP + 78 39 14 6 + + + ICCARM + 78 39 14 6 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartConfigurator.c + + + BICOMP + 22 + + + ICCARM + 100 74 + + + + + BICOMP + 78 39 98 + + + ICCARM + 78 39 98 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerHardware.c + + + BICOMP + 153 + + + ICCARM + 45 65 + + + + + BICOMP + 78 39 92 79 + + + ICCARM + 78 39 92 79 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartTransmitBufferStatus.c + + + BICOMP + 57 + + + ICCARM + 50 82 + + + + + BICOMP + 78 39 161 + + + ICCARM + 78 39 161 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerModel.c + + + BICOMP + 29 + + + ICCARM + 101 21 + + + + + BICOMP + 78 39 7 49 + + + ICCARM + 78 39 7 49 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartBaudRateRegisterCalculator.c + + + BICOMP + 204 + + + ICCARM + 95 32 + + + + + BICOMP + 78 39 46 + + + ICCARM + 78 39 46 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartConductor.c + + + BICOMP + 167 + + + ICCARM + 19 20 + + + + + BICOMP + 78 39 75 165 81 49 + + + ICCARM + 78 39 75 165 81 49 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartHardware.c + + + BICOMP + 162 + + + ICCARM + 84 68 + + + + + BICOMP + 78 39 165 98 48 + + + ICCARM + 78 39 165 98 48 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartModel.c + + + BICOMP + 91 + + + ICCARM + 53 70 + + + + + BICOMP + 78 39 81 62 46 77 67 61 80 1 10 109 2 85 11 8 + + + ICCARM + 78 39 81 62 46 77 67 61 80 1 71 10 109 2 85 11 8 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartPutChar.c + + + BICOMP + 13 + + + ICCARM + 73 196 + + + + + BICOMP + 78 39 48 161 + + + ICCARM + 78 39 48 161 + + + + + $PROJ_DIR$\Binary\Obj\cmock_demo.pbd + + + BILINK + 15 58 203 128 51 38 27 40 52 31 35 59 54 3 197 153 99 69 29 204 167 22 162 91 13 57 + + + + + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + + + BICOMP + 38 + + + + + BICOMP + 26 30 61 200 150 201 + + + + + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + + + BICOMP + 203 + + + + + BICOMP + 147 150 146 145 + + + + + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + + + BICOMP + 15 + + + ICCARM + 63 87 131 108 86 5 36 103 198 160 157 37 158 0 154 65 23 66 21 32 20 74 68 70 196 82 9 + + + + + BICOMP + 147 150 149 135 139 + + + ICCARM + 147 150 149 135 139 146 144 145 151 148 140 102 118 105 107 120 30 61 41 43 121 34 33 44 152 104 122 116 114 11 8 80 1 71 10 109 2 67 85 26 200 201 + + + + + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + + + BICOMP + 58 + + + + + BICOMP + 147 150 139 146 144 + + + + + $PROJ_DIR$\..\..\examples\src\AdcModel.c + + + BICOMP + 128 + + + + + BICOMP + 147 150 135 151 148 140 + + + + + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + + + BICOMP + 51 + + + + + BICOMP + 147 150 144 + + + + + $PROJ_DIR$\..\..\examples\src\Executor.c + + + BICOMP + 27 + + + + + BICOMP + 147 150 102 118 105 107 149 120 + + + + + $PROJ_DIR$\..\..\examples\src\Main.c + + + BICOMP + 52 + + + + + BICOMP + 147 150 120 102 118 151 148 140 105 41 43 121 34 33 44 107 152 104 122 116 114 149 139 146 144 135 + + + + + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + + + BICOMP + 40 + + + + + BICOMP + 120 30 61 + + + + + $PROJ_DIR$\..\..\examples\src\Model.c + + + BICOMP + 31 + + + + + BICOMP + 118 147 150 151 140 + + + + + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + + + BICOMP + 59 + + + + + BICOMP + 147 150 148 11 61 8 80 1 10 109 2 + + + + + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + + + BICOMP + 35 + + + + + BICOMP + 147 150 151 + + + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + + + BICOMP + 99 + + + + + BICOMP + 147 150 122 116 + + + + + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + + + BICOMP + 54 + + + + + BICOMP + 147 150 140 11 61 8 80 1 10 109 2 + + + + + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + + + BICOMP + 3 + + + + + BICOMP + 147 150 107 114 152 116 + + + + + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + + + BICOMP + 197 + + + + + BICOMP + 147 150 104 122 + + + + + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + + + BICOMP + 153 + + + + + BICOMP + 147 150 152 104 + + + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + + + BICOMP + 69 + + + + + BICOMP + 147 150 116 122 + + + + + $PROJ_DIR$\..\..\examples\src\TimerModel.c + + + BICOMP + 29 + + + + + BICOMP + 147 150 114 151 + + + + + $PROJ_DIR$\..\..\examples\src\UsartModel.c + + + BICOMP + 91 + + + + + BICOMP + 147 150 34 145 33 140 67 61 80 1 10 109 2 85 11 8 + + + + + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + + + BICOMP + 204 + + + + + BICOMP + 147 150 33 + + + + + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + + + BICOMP + 167 + + + + + BICOMP + 147 150 105 41 34 151 + + + + + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + + + BICOMP + 22 + + + + + BICOMP + 147 150 43 + + + + + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + + + BICOMP + 162 + + + + + BICOMP + 147 150 41 43 121 + + + + + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + + + BICOMP + 57 + + + + + BICOMP + 147 150 44 + + + + + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + + + BICOMP + 13 + + + + + BICOMP + 147 150 121 44 + + + + + $PROJ_DIR$\srcIAR\Cstartup.s + + + AARM + 156 24 + + + + + AARM + 202 + + + + + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\AdcModel.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\Executor.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\Main.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\Model.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\TimerModel.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\UsartModel.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + ICCARM + + + + FLASH_Debug + + $TOOLKIT_DIR$\inc\DLib_Defaults.h + $TOOLKIT_DIR$\inc\DLib_Threads.h + $PROJ_DIR$\..\..\test\system\src\TimerInterruptConfigurator.h + $PROJ_DIR$\..\..\test\system\src\TimerModel.h + $TOOLKIT_DIR$\inc\ymath.h + $TOOLKIT_DIR$\inc\DLib_Product.h + $TOOLKIT_DIR$\inc\math.h + $PROJ_DIR$\..\..\test\system\src\TimerInterruptHandler.h + $PROJ_DIR$\..\..\test\system\src\Executor.h + $PROJ_DIR$\incIAR\project.h + $TOOLKIT_DIR$\inc\intrinsics.h + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.h + $PROJ_DIR$\..\..\examples\src\UsartModel.h + $PROJ_DIR$\..\..\test\system\src\AT91SAM7X256.h + $PROJ_DIR$\..\..\examples\src\UsartHardware.h + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.h + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.h + $PROJ_DIR$\..\..\test\system\src\UsartBaudRateRegisterCalculator.h + $PROJ_DIR$\..\..\test\system\src\TemperatureCalculator.h + $PROJ_DIR$\..\..\test\system\src\UsartPutChar.h + $PROJ_DIR$\..\..\test\system\src\TaskScheduler.h + $TOOLKIT_DIR$\lib\dl4t_tl_in.a + $TOOLKIT_DIR$\inc\ycheck.h + $PROJ_DIR$\..\..\test\system\src\ModelConfig.h + $TOOLKIT_DIR$\inc\stdio.h + $TOOLKIT_DIR$\inc\DLib_Config_Normal.h + $PROJ_DIR$\..\..\test\system\src\UsartConductor.h + $PROJ_DIR$\..\..\test\system\src\TemperatureFilter.h + $PROJ_DIR$\..\..\test\system\src\Types.h + $PROJ_DIR$\..\..\test\system\src\TimerConfigurator.h + $TOOLKIT_DIR$\inc\yvals.h + $PROJ_DIR$\..\..\test\system\src\UsartModel.h + $TOOLKIT_DIR$\lib\rt4t_al.a + $TOOLKIT_DIR$\inc\ysizet.h + $PROJ_DIR$\..\..\test\system\src\AdcConductor.h + $PROJ_DIR$\..\..\test\system\src\AdcTemperatureSensor.h + $PROJ_DIR$\..\..\test\system\src\TimerHardware.h + $PROJ_DIR$\..\..\test\system\src\AdcModel.h + $PROJ_DIR$\..\..\test\system\src\AdcHardware.h + $PROJ_DIR$\..\..\test\system\src\Model.h + $TOOLKIT_DIR$\lib\shs_l.a + $PROJ_DIR$\..\..\test\system\src\UsartConfigurator.h + $PROJ_DIR$\..\..\examples\src\Executor.h + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.h + $PROJ_DIR$\..\..\examples\src\UsartConductor.h + $PROJ_DIR$\..\..\test\system\src\AdcTemperatureSensor.c + $PROJ_DIR$\..\..\examples\src\TimerConductor.h + $TOOLKIT_DIR$\inc\xencoding_limits.h + $PROJ_DIR$\FLASH_Debug\Obj\cmock_demo.pbd + $PROJ_DIR$\..\..\test\system\src\Main.c + $PROJ_DIR$\..\..\test\system\src\AdcHardwareConfigurator.c + $PROJ_DIR$\..\..\test\system\src\AdcConductor.c + $PROJ_DIR$\..\..\test\system\src\AdcHardware.c + $PROJ_DIR$\..\..\examples\src\TimerModel.h + $PROJ_DIR$\..\..\test\system\src\AdcModel.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.h + $PROJ_DIR$\..\..\test\system\src\Executor.c + $PROJ_DIR$\..\..\examples\src\Model.h + $PROJ_DIR$\..\..\test\system\src\Model.c + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.h + $PROJ_DIR$\..\..\examples\src\UsartPutChar.h + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.h + $PROJ_DIR$\..\..\test\system\src\TemperatureFilter.c + $PROJ_DIR$\..\..\test\system\src\TimerConfigurator.c + $PROJ_DIR$\..\..\test\system\src\TemperatureCalculator.c + $PROJ_DIR$\..\..\test\system\src\TaskScheduler.c + $PROJ_DIR$\..\..\test\system\src\TimerInterruptConfigurator.c + $PROJ_DIR$\..\..\test\system\src\TimerConductor.c + $PROJ_DIR$\..\..\test\system\src\TimerInterruptHandler.c + $PROJ_DIR$\..\..\test\system\src\UsartConfigurator.c + $PROJ_DIR$\..\..\test\system\src\TimerHardware.c + $PROJ_DIR$\..\..\test\system\src\UsartTransmitBufferStatus.c + $PROJ_DIR$\..\..\examples\src\AdcModel.h + $PROJ_DIR$\..\..\test\system\src\TimerModel.c + $PROJ_DIR$\..\..\test\system\src\UsartBaudRateRegisterCalculator.c + $PROJ_DIR$\..\..\test\system\src\UsartConductor.c + $PROJ_DIR$\..\..\examples\src\AdcHardware.h + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.h + $PROJ_DIR$\..\..\test\system\src\UsartHardware.c + $PROJ_DIR$\..\..\test\system\src\UsartModel.c + $PROJ_DIR$\..\..\test\system\src\UsartPutChar.c + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.h + $PROJ_DIR$\..\..\examples\src\ModelConfig.h + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.h + $PROJ_DIR$\..\..\examples\src\Types.h + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.h + $PROJ_DIR$\..\..\examples\src\AdcConductor.h + $PROJ_DIR$\..\..\examples\src\AT91SAM7X256.h + $PROJ_DIR$\..\..\examples\src\TaskScheduler.h + $PROJ_DIR$\..\..\examples\src\TimerHardware.h + $PROJ_DIR$\..\..\test\system\src\TimerConductor.h + $PROJ_DIR$\..\..\test\system\src\UsartTransmitBufferStatus.h + $PROJ_DIR$\..\..\test\system\src\UsartHardware.h + $PROJ_DIR$\FLASH_Debug\Obj\Main.o + $PROJ_DIR$\..\..\test\system\src\AdcHardwareConfigurator.h + $PROJ_DIR$\FLASH_Debug\List\TimerHardware.lst + $PROJ_DIR$\FLASH_Debug\List\ext_irq.lst + $PROJ_DIR$\FLASH_Debug\Obj\Cstartup.o + $PROJ_DIR$\FLASH_Debug\Obj\TimerConfigurator.pbi + $PROJ_DIR$\FLASH_Debug\List\UsartHardware.lst + $PROJ_DIR$\..\src\ext_irq.c + $PROJ_DIR$\FLASH_Debug\Obj\interrupt_Usart.o + $PROJ_DIR$\FLASH_Debug\Obj\interrupt_Usart.pbi + $PROJ_DIR$\FLASH_Debug\Obj\TimerModel.o + $PROJ_DIR$\FLASH_Debug\Obj\main.pbi + $PROJ_DIR$\FLASH_Debug\List\Model.lst + $PROJ_DIR$\FLASH_Debug\Obj\AdcModel.o + $PROJ_DIR$\FLASH_Debug\Obj\UsartHardware.o + $PROJ_DIR$\FLASH_Debug\Obj\UsartPutChar.o + $PROJ_DIR$\FLASH_Debug\Obj\TemperatureCalculator.pbi + $PROJ_DIR$\FLASH_Debug\List\AdcConductor.lst + $PROJ_DIR$\FLASH_Debug\Obj\UsartTransmitBufferStatus.pbi + $PROJ_DIR$\FLASH_Debug\Obj\AdcConductor.pbi + $PROJ_DIR$\FLASH_Debug\Obj\Model.pbi + $PROJ_DIR$\FLASH_Debug\Obj\Cstartup_SAM7.o + $PROJ_DIR$\FLASH_Debug\Obj\IntrinsicsWrapper.o + $PROJ_DIR$\FLASH_Debug\Obj\IntrinsicsWrapper.pbi + $PROJ_DIR$\FLASH_Debug\Obj\AdcHardware.o + $PROJ_DIR$\FLASH_Debug\Obj\UsartPutChar.pbi + $PROJ_DIR$\FLASH_Debug\Obj\UsartBaudRateRegisterCalculator.pbi + $PROJ_DIR$\FLASH_Debug\List\interrupt_timer.lst + $PROJ_DIR$\FLASH_Debug\List\Cstartup_SAM7.lst + $PROJ_DIR$\FLASH_Debug\Obj\AdcHardwareConfigurator.o + $PROJ_DIR$\FLASH_Debug\List\AdcHardwareConfigurator.lst + $PROJ_DIR$\FLASH_Debug\Obj\TemperatureFilter.pbi + $PROJ_DIR$\FLASH_Debug\Obj\TimerConductor.pbi + $PROJ_DIR$\..\..\include\lib_AT91SAM7X256.h + $PROJ_DIR$\FLASH_Debug\Obj\TaskScheduler.o + $PROJ_DIR$\FLASH_Debug\Obj\TemperatureFilter.o + $PROJ_DIR$\FLASH_Debug\Obj\ext_irq.pbi + $PROJ_DIR$\..\..\include\AT91SAM7X256.h + $PROJ_DIR$\FLASH_Debug\Obj\AdcModel.pbi + $PROJ_DIR$\FLASH_Debug\Obj\TimerInterruptConfigurator.o + $PROJ_DIR$\FLASH_Debug\List\AdcModel.lst + $PROJ_DIR$\FLASH_Debug\List\interrupt_Usart.lst + $PROJ_DIR$\FLASH_Debug\List\Cstartup.lst + $PROJ_DIR$\FLASH_Debug\Obj\UsartHardware.pbi + $PROJ_DIR$\FLASH_Debug\List\TimerModel.lst + $PROJ_DIR$\FLASH_Debug\Obj\UsartConductor.o + $PROJ_DIR$\FLASH_Debug\Obj\UsartConfigurator.o + $PROJ_DIR$\FLASH_Debug\List\UsartPutChar.lst + $PROJ_DIR$\FLASH_Debug\List\TemperatureFilter.lst + $PROJ_DIR$\FLASH_Debug\Obj\TimerInterruptHandler.pbi + $PROJ_DIR$\FLASH_Debug\List\TemperatureCalculator.lst + $PROJ_DIR$\FLASH_Debug\List\UsartTransmitBufferStatus.lst + $PROJ_DIR$\FLASH_Debug\Obj\UsartModel.pbi + $PROJ_DIR$\FLASH_Debug\List\UsartConductor.lst + $PROJ_DIR$\FLASH_Debug\List\TimerConfigurator.lst + $PROJ_DIR$\FLASH_Debug\Obj\Model.o + $PROJ_DIR$\FLASH_Debug\List\Executor.lst + $PROJ_DIR$\FLASH_Debug\List\UsartModel.lst + $PROJ_DIR$\FLASH_Debug\List\TimerInterruptHandler.lst + $PROJ_DIR$\FLASH_Debug\List\Main.lst + $PROJ_DIR$\FLASH_Debug\List\TimerInterruptConfigurator.lst + $PROJ_DIR$\FLASH_Debug\Exe\cmock_demo.out + $PROJ_DIR$\FLASH_Debug\Obj\TimerHardware.pbi + $PROJ_DIR$\FLASH_Debug\Obj\TaskScheduler.pbi + $PROJ_DIR$\FLASH_Debug\Obj\TimerModel.pbi + $PROJ_DIR$\FLASH_Debug\Obj\AdcConductor.o + $PROJ_DIR$\FLASH_Debug\Obj\AdcTemperatureSensor.o + $PROJ_DIR$\..\src\AT91SAM7X-EK.h + $PROJ_DIR$\FLASH_Debug\Obj\UsartTransmitBufferStatus.o + $PROJ_DIR$\FLASH_Debug\Obj\AdcHardware.pbi + $PROJ_DIR$\FLASH_Debug\Obj\UsartBaudRateRegisterCalculator.o + $PROJ_DIR$\FLASH_Debug\Obj\ext_irq.o + $PROJ_DIR$\FLASH_Debug\Obj\AdcTemperatureSensor.pbi + $PROJ_DIR$\FLASH_Debug\Obj\TemperatureCalculator.o + $PROJ_DIR$\FLASH_Debug\Obj\TimerHardware.o + $PROJ_DIR$\FLASH_Debug\Obj\UsartModel.o + $PROJ_DIR$\FLASH_Debug\List\UsartConfigurator.lst + $PROJ_DIR$\FLASH_Debug\Obj\TimerConductor.o + $PROJ_DIR$\srcIAR\project.h + $PROJ_DIR$\FLASH_Debug\List\UsartBaudRateRegisterCalculator.lst + $PROJ_DIR$\FLASH_Debug\Obj\AdcHardwareConfigurator.pbi + $PROJ_DIR$\FLASH_Debug\Obj\TimerInterruptHandler.o + $PROJ_DIR$\FLASH_Debug\List\TimerConductor.lst + $PROJ_DIR$\FLASH_Debug\Obj\Cstartup_SAM7.pbi + $PROJ_DIR$\FLASH_Debug\Obj\UsartConductor.pbi + $PROJ_DIR$\FLASH_Debug\Obj\UsartConfigurator.pbi + $PROJ_DIR$\FLASH_Debug\Obj\Executor.o + $PROJ_DIR$\FLASH_Debug\List\AdcHardware.lst + $PROJ_DIR$\FLASH_Debug\Obj\Executor.pbi + $PROJ_DIR$\..\src\interrupt_timer.c + $PROJ_DIR$\..\src\interrupt_Usart.c + $PROJ_DIR$\FLASH_Debug\Obj\TimerInterruptConfigurator.pbi + $PROJ_DIR$\..\src\main.c + $PROJ_DIR$\FLASH_Debug\Obj\TimerConfigurator.o + $PROJ_DIR$\FLASH_Debug\List\AdcTemperatureSensor.lst + $PROJ_DIR$\FLASH_Debug\List\TaskScheduler.lst + $PROJ_DIR$\FLASH_Debug\Obj\interrupt_timer.o + $PROJ_DIR$\FLASH_Debug\List\IntrinsicsWrapper.lst + $PROJ_DIR$\FLASH_Debug\Obj\interrupt_timer.pbi + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + $PROJ_DIR$\..\..\examples\src\AdcModel.c + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + $PROJ_DIR$\..\..\examples\src\Executor.c + $PROJ_DIR$\..\..\examples\src\Main.c + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + $PROJ_DIR$\..\..\examples\src\Model.c + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + $PROJ_DIR$\Resource\at91SAM7X256_FLASH.icf + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + $PROJ_DIR$\..\..\examples\src\TimerModel.c + $PROJ_DIR$\..\..\examples\src\UsartModel.c + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + $PROJ_DIR$\srcIAR\Cstartup.s + $PROJ_DIR$\incIAR\AT91SAM7X-EK.h + $PROJ_DIR$\incIAR\lib_AT91SAM7X256.h + $PROJ_DIR$\incIAR\AT91SAM7X256_inc.h + + + [ROOT_NODE] + + + ILINK + 154 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcTemperatureSensor.c + + + BICOMP + 165 + + + ICCARM + 187 159 + + + + + ICCARM + 28 13 35 + + + + + $PROJ_DIR$\FLASH_Debug\Obj\cmock_demo.pbd + + + BILINK + 112 162 173 131 165 176 181 116 113 156 109 124 125 98 155 184 142 157 119 177 178 136 145 118 111 104 + + + + + $PROJ_DIR$\..\..\test\system\src\Main.c + + + BICOMP + 104 + + + ICCARM + 152 93 + + + + + ICCARM + 28 13 8 39 20 18 27 26 92 41 19 31 17 91 90 36 29 2 7 3 34 38 94 35 37 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcHardwareConfigurator.c + + + BICOMP + 173 + + + ICCARM + 123 122 + + + + + ICCARM + 28 13 94 23 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcConductor.c + + + BICOMP + 112 + + + ICCARM + 110 158 + + + + + ICCARM + 28 13 34 37 38 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcHardware.c + + + BICOMP + 162 + + + ICCARM + 180 117 + + + + + ICCARM + 28 13 38 94 35 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcModel.c + + + BICOMP + 131 + + + ICCARM + 133 106 + + + + + ICCARM + 28 13 37 20 18 27 + + + + + $PROJ_DIR$\..\..\test\system\src\Executor.c + + + BICOMP + 181 + + + ICCARM + 149 179 + + + + + ICCARM + 28 13 8 39 26 90 34 10 22 + + + + + $PROJ_DIR$\..\..\test\system\src\Model.c + + + BICOMP + 113 + + + ICCARM + 105 148 + + + + + ICCARM + 39 28 13 20 27 + + + + + $PROJ_DIR$\..\..\test\system\src\TemperatureFilter.c + + + BICOMP + 124 + + + ICCARM + 141 128 + + + + + ICCARM + 28 13 27 6 22 4 30 0 25 5 47 1 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerConfigurator.c + + + BICOMP + 98 + + + ICCARM + 147 186 + + + + + ICCARM + 28 13 29 2 + + + + + $PROJ_DIR$\..\..\test\system\src\TemperatureCalculator.c + + + BICOMP + 109 + + + ICCARM + 143 166 + + + + + ICCARM + 28 13 18 6 22 4 30 0 25 5 47 1 + + + + + $PROJ_DIR$\..\..\test\system\src\TaskScheduler.c + + + BICOMP + 156 + + + ICCARM + 188 127 + + + + + ICCARM + 28 13 20 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerInterruptConfigurator.c + + + BICOMP + 184 + + + ICCARM + 153 132 + + + + + ICCARM + 28 13 2 7 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerConductor.c + + + BICOMP + 125 + + + ICCARM + 175 170 + + + + + ICCARM + 28 13 90 3 36 7 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerInterruptHandler.c + + + BICOMP + 142 + + + ICCARM + 151 174 + + + + + ICCARM + 28 13 7 2 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartConfigurator.c + + + BICOMP + 178 + + + ICCARM + 169 139 + + + + + ICCARM + 28 13 41 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerHardware.c + + + BICOMP + 155 + + + ICCARM + 95 167 + + + + + ICCARM + 28 13 36 29 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartTransmitBufferStatus.c + + + BICOMP + 111 + + + ICCARM + 144 161 + + + + + ICCARM + 28 13 91 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerModel.c + + + BICOMP + 157 + + + ICCARM + 137 103 + + + + + ICCARM + 28 13 3 20 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartBaudRateRegisterCalculator.c + + + BICOMP + 119 + + + ICCARM + 172 163 + + + + + ICCARM + 28 13 17 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartConductor.c + + + BICOMP + 177 + + + ICCARM + 146 138 + + + + + ICCARM + 28 13 26 92 31 20 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartHardware.c + + + BICOMP + 136 + + + ICCARM + 99 107 + + + + + ICCARM + 28 13 92 41 19 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartModel.c + + + BICOMP + 145 + + + ICCARM + 150 168 + + + + + ICCARM + 28 13 31 23 17 27 24 22 30 0 25 5 47 1 33 6 4 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartPutChar.c + + + BICOMP + 118 + + + ICCARM + 140 108 + + + + + ICCARM + 28 13 19 91 + + + + + $PROJ_DIR$\..\src\ext_irq.c + + + BICOMP + 129 + + + ICCARM + 96 164 + + + + + BICOMP + 171 10 22 160 130 126 + + + ICCARM + 171 10 22 160 130 126 + + + + + $PROJ_DIR$\FLASH_Debug\Exe\cmock_demo.out + + + ILINK + 203 158 117 122 106 159 97 114 179 115 93 148 127 166 128 170 186 167 132 174 103 163 138 139 107 168 108 161 40 32 21 + + + + + $PROJ_DIR$\..\src\interrupt_timer.c + + + BICOMP + 191 + + + ICCARM + 120 189 + + + + + BICOMP + 171 10 22 160 130 126 + + + ICCARM + 171 10 22 160 130 126 + + + + + $PROJ_DIR$\..\src\interrupt_Usart.c + + + BICOMP + 102 + + + ICCARM + 134 101 + + + + + BICOMP + 171 10 22 160 130 126 + + + ICCARM + 171 10 22 160 130 126 + + + + + $PROJ_DIR$\..\src\main.c + + + BICOMP + 104 + + + ICCARM + 152 93 + + + + + BICOMP + 171 10 22 160 130 126 + + + ICCARM + 171 10 22 160 130 126 + + + + + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + + + BICOMP + 176 + + + ICCARM + 121 114 + + + + + BICOMP + 9 10 22 220 221 + + + ICCARM + 9 10 22 220 87 221 + + + + + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + + + BICOMP + 173 + + + ICCARM + 123 122 + + + + + BICOMP + 84 87 83 82 + + + ICCARM + 84 87 83 82 + + + + + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + + + BICOMP + 112 + + + ICCARM + 110 158 + + + + + BICOMP + 84 87 86 72 76 + + + ICCARM + 84 87 86 72 76 + + + + + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + + + BICOMP + 162 + + + ICCARM + 180 117 + + + + + BICOMP + 84 87 76 83 81 + + + ICCARM + 84 87 76 83 81 + + + + + $PROJ_DIR$\..\..\examples\src\AdcModel.c + + + BICOMP + 131 + + + ICCARM + 133 106 + + + + + BICOMP + 84 87 72 88 85 77 + + + ICCARM + 84 87 72 88 85 77 + + + + + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + + + BICOMP + 165 + + + ICCARM + 187 159 + + + + + BICOMP + 84 87 81 + + + ICCARM + 84 87 81 + + + + + $PROJ_DIR$\..\..\examples\src\Executor.c + + + BICOMP + 181 + + + ICCARM + 149 179 + + + + + BICOMP + 84 87 42 57 44 46 86 59 + + + ICCARM + 84 87 42 57 44 46 86 59 + + + + + $PROJ_DIR$\..\..\examples\src\Main.c + + + BICOMP + 104 + + + ICCARM + 152 93 + + + + + BICOMP + 84 87 59 42 57 88 85 77 44 14 15 60 12 11 16 46 89 43 61 55 53 86 76 83 81 72 + + + ICCARM + 84 87 59 42 57 88 85 77 44 14 15 60 12 11 16 46 89 43 61 55 53 86 76 83 81 72 + + + + + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + + + BICOMP + 116 + + + ICCARM + 190 115 + + + + + BICOMP + 59 10 22 + + + ICCARM + 59 10 22 + + + + + $PROJ_DIR$\..\..\examples\src\Model.c + + + BICOMP + 113 + + + ICCARM + 105 148 + + + + + BICOMP + 57 84 87 88 77 + + + ICCARM + 57 84 87 88 77 + + + + + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + + + BICOMP + 109 + + + ICCARM + 143 166 + + + + + BICOMP + 84 87 85 6 22 4 30 0 5 47 1 + + + ICCARM + 84 87 85 6 22 4 30 0 25 5 47 1 + + + + + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + + + BICOMP + 156 + + + ICCARM + 188 127 + + + + + BICOMP + 84 87 88 + + + ICCARM + 84 87 88 + + + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + + + BICOMP + 184 + + + ICCARM + 153 132 + + + + + BICOMP + 84 87 61 55 + + + ICCARM + 84 87 61 55 + + + + + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + + + BICOMP + 124 + + + ICCARM + 141 128 + + + + + BICOMP + 84 87 77 6 22 4 30 0 5 47 1 + + + ICCARM + 84 87 77 6 22 4 30 0 25 5 47 1 + + + + + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + + + BICOMP + 125 + + + ICCARM + 175 170 + + + + + BICOMP + 84 87 46 53 89 55 + + + ICCARM + 84 87 46 53 89 55 + + + + + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + + + BICOMP + 98 + + + ICCARM + 147 186 + + + + + BICOMP + 84 87 43 61 + + + ICCARM + 84 87 43 61 + + + + + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + + + BICOMP + 155 + + + ICCARM + 95 167 + + + + + BICOMP + 84 87 89 43 + + + ICCARM + 84 87 89 43 + + + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + + + BICOMP + 142 + + + ICCARM + 151 174 + + + + + BICOMP + 84 87 55 61 + + + ICCARM + 84 87 55 61 + + + + + $PROJ_DIR$\..\..\examples\src\TimerModel.c + + + BICOMP + 157 + + + ICCARM + 137 103 + + + + + BICOMP + 84 87 53 88 + + + ICCARM + 84 87 53 88 + + + + + $PROJ_DIR$\..\..\examples\src\UsartModel.c + + + BICOMP + 145 + + + ICCARM + 150 168 + + + + + ICCARM + 84 87 12 82 11 77 24 22 30 0 25 5 47 1 33 6 4 + + + + + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + + + BICOMP + 119 + + + ICCARM + 172 163 + + + + + BICOMP + 84 87 11 + + + ICCARM + 84 87 11 + + + + + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + + + BICOMP + 177 + + + ICCARM + 146 138 + + + + + BICOMP + 84 87 44 14 12 88 + + + ICCARM + 84 87 44 14 12 88 + + + + + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + + + BICOMP + 178 + + + ICCARM + 169 139 + + + + + BICOMP + 84 87 15 + + + ICCARM + 84 87 15 + + + + + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + + + BICOMP + 136 + + + ICCARM + 99 107 + + + + + BICOMP + 84 87 14 15 60 + + + ICCARM + 84 87 14 15 60 + + + + + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + + + BICOMP + 111 + + + ICCARM + 144 161 + + + + + ICCARM + 84 87 16 + + + + + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + + + BICOMP + 118 + + + ICCARM + 140 108 + + + + + ICCARM + 84 87 60 16 + + + + + $PROJ_DIR$\srcIAR\Cstartup.s + + + AARM + 97 135 + + + + + AARM + 222 + + + + + + RAM_Debug + + $PROJ_DIR$\Resource\SAM7_FLASH.mac + $TOOLKIT_DIR$\inc\DLib_Defaults.h + $TOOLKIT_DIR$\inc\DLib_Threads.h + $PROJ_DIR$\..\..\test\system\src\TimerInterruptConfigurator.h + $PROJ_DIR$\..\..\test\system\src\TimerModel.h + $TOOLKIT_DIR$\inc\ymath.h + $TOOLKIT_DIR$\inc\DLib_Product.h + $TOOLKIT_DIR$\inc\math.h + $PROJ_DIR$\..\..\test\system\src\TimerInterruptHandler.h + $PROJ_DIR$\..\..\test\system\src\Executor.h + $PROJ_DIR$\incIAR\project.h + $TOOLKIT_DIR$\inc\intrinsics.h + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.h + $PROJ_DIR$\..\..\examples\src\UsartModel.h + $PROJ_DIR$\..\..\test\system\src\AT91SAM7X256.h + $PROJ_DIR$\..\..\examples\src\UsartHardware.h + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.h + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.h + $PROJ_DIR$\..\..\test\system\src\UsartBaudRateRegisterCalculator.h + $PROJ_DIR$\..\..\test\system\src\TemperatureCalculator.h + $PROJ_DIR$\..\..\test\system\src\UsartPutChar.h + $PROJ_DIR$\..\..\test\system\src\TaskScheduler.h + $TOOLKIT_DIR$\lib\dl4t_tl_in.a + $TOOLKIT_DIR$\inc\ycheck.h + $PROJ_DIR$\..\..\test\system\src\ModelConfig.h + $TOOLKIT_DIR$\inc\stdio.h + $TOOLKIT_DIR$\inc\DLib_Config_Normal.h + $PROJ_DIR$\..\..\test\system\src\UsartConductor.h + $PROJ_DIR$\..\..\test\system\src\TemperatureFilter.h + $PROJ_DIR$\..\..\test\system\src\Types.h + $PROJ_DIR$\..\..\test\system\src\TimerConfigurator.h + $TOOLKIT_DIR$\inc\yvals.h + $PROJ_DIR$\..\..\test\system\src\UsartModel.h + $TOOLKIT_DIR$\lib\rt4t_al.a + $TOOLKIT_DIR$\inc\ysizet.h + $PROJ_DIR$\..\..\test\system\src\AdcConductor.h + $PROJ_DIR$\..\..\test\system\src\AdcTemperatureSensor.h + $PROJ_DIR$\..\..\test\system\src\TimerHardware.h + $PROJ_DIR$\..\..\test\system\src\AdcModel.h + $PROJ_DIR$\..\..\test\system\src\AdcHardware.h + $PROJ_DIR$\..\..\test\system\src\Model.h + $TOOLKIT_DIR$\lib\shs_l.a + $PROJ_DIR$\..\..\test\system\src\UsartConfigurator.h + $PROJ_DIR$\..\..\examples\src\Executor.h + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.h + $PROJ_DIR$\..\..\examples\src\UsartConductor.h + $PROJ_DIR$\..\..\test\system\src\AdcTemperatureSensor.c + $PROJ_DIR$\..\..\examples\src\TimerConductor.h + $TOOLKIT_DIR$\inc\xencoding_limits.h + $PROJ_DIR$\..\..\test\system\src\Main.c + $PROJ_DIR$\..\..\test\system\src\AdcHardwareConfigurator.c + $PROJ_DIR$\..\..\test\system\src\AdcConductor.c + $PROJ_DIR$\..\..\test\system\src\AdcHardware.c + $PROJ_DIR$\..\..\examples\src\TimerModel.h + $PROJ_DIR$\..\..\test\system\src\AdcModel.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.h + $PROJ_DIR$\..\..\test\system\src\Executor.c + $PROJ_DIR$\..\..\examples\src\Model.h + $PROJ_DIR$\..\..\test\system\src\Model.c + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.h + $PROJ_DIR$\..\..\examples\src\UsartPutChar.h + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.h + $PROJ_DIR$\..\..\test\system\src\TemperatureFilter.c + $PROJ_DIR$\..\..\test\system\src\TimerConfigurator.c + $PROJ_DIR$\..\..\test\system\src\TemperatureCalculator.c + $PROJ_DIR$\..\..\test\system\src\TaskScheduler.c + $PROJ_DIR$\..\..\test\system\src\TimerInterruptConfigurator.c + $PROJ_DIR$\..\..\test\system\src\TimerConductor.c + $PROJ_DIR$\..\..\test\system\src\TimerInterruptHandler.c + $PROJ_DIR$\..\..\test\system\src\UsartConfigurator.c + $PROJ_DIR$\..\..\test\system\src\TimerHardware.c + $PROJ_DIR$\..\..\test\system\src\UsartTransmitBufferStatus.c + $PROJ_DIR$\..\..\examples\src\AdcModel.h + $PROJ_DIR$\..\..\test\system\src\TimerModel.c + $PROJ_DIR$\..\..\test\system\src\UsartBaudRateRegisterCalculator.c + $PROJ_DIR$\..\..\test\system\src\UsartConductor.c + $PROJ_DIR$\..\..\examples\src\AdcHardware.h + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.h + $PROJ_DIR$\..\..\test\system\src\UsartHardware.c + $PROJ_DIR$\..\..\test\system\src\UsartModel.c + $PROJ_DIR$\..\..\test\system\src\UsartPutChar.c + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.h + $PROJ_DIR$\..\..\examples\src\ModelConfig.h + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.h + $PROJ_DIR$\..\..\examples\src\Types.h + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.h + $PROJ_DIR$\..\..\examples\src\AdcConductor.h + $PROJ_DIR$\..\..\examples\src\AT91SAM7X256.h + $PROJ_DIR$\..\..\examples\src\TaskScheduler.h + $PROJ_DIR$\..\..\examples\src\TimerHardware.h + $PROJ_DIR$\..\..\test\system\src\TimerConductor.h + $PROJ_DIR$\..\..\test\system\src\UsartTransmitBufferStatus.h + $PROJ_DIR$\..\..\test\system\src\UsartHardware.h + $PROJ_DIR$\..\..\test\system\src\AdcHardwareConfigurator.h + $PROJ_DIR$\..\src\ext_irq.c + $PROJ_DIR$\..\src\interrupt_timer.c + $PROJ_DIR$\..\src\interrupt_Usart.c + $PROJ_DIR$\..\src\main.c + $PROJ_DIR$\RAM_Debug\Obj\UsartConductor.o + $PROJ_DIR$\RAM_Debug\List\AdcConductor.lst + $PROJ_DIR$\RAM_Debug\List\TimerInterruptHandler.lst + $PROJ_DIR$\RAM_Debug\List\AdcHardwareConfigurator.lst + $PROJ_DIR$\RAM_Debug\Obj\TimerHardware.pbi + $PROJ_DIR$\RAM_Debug\Obj\UsartHardware.pbi + $PROJ_DIR$\RAM_Debug\Obj\UsartConductor.pbi + $PROJ_DIR$\RAM_Debug\List\TimerConfigurator.lst + $PROJ_DIR$\RAM_Debug\List\UsartPutChar.lst + $PROJ_DIR$\RAM_Debug\Obj\TimerConductor.o + $PROJ_DIR$\RAM_Debug\Obj\TimerConfigurator.o + $PROJ_DIR$\RAM_Debug\Obj\UsartBaudRateRegisterCalculator.pbi + $PROJ_DIR$\RAM_Debug\Obj\AdcHardwareConfigurator.o + $PROJ_DIR$\RAM_Debug\List\AdcModel.lst + $PROJ_DIR$\RAM_Debug\List\TimerConductor.lst + $PROJ_DIR$\RAM_Debug\List\TimerHardware.lst + $PROJ_DIR$\RAM_Debug\Obj\AdcHardware.o + $PROJ_DIR$\RAM_Debug\List\TemperatureFilter.lst + $PROJ_DIR$\RAM_Debug\Obj\AdcModel.pbi + $PROJ_DIR$\RAM_Debug\List\IntrinsicsWrapper.lst + $PROJ_DIR$\RAM_Debug\Obj\Cstartup.o + $PROJ_DIR$\RAM_Debug\Obj\interrupt_Usart.o + $PROJ_DIR$\RAM_Debug\Obj\AdcHardwareConfigurator.pbi + $PROJ_DIR$\RAM_Debug\Obj\main.pbi + $PROJ_DIR$\RAM_Debug\List\AdcTemperatureSensor.lst + $PROJ_DIR$\RAM_Debug\Obj\TimerInterruptHandler.pbi + $PROJ_DIR$\RAM_Debug\List\Model.lst + $PROJ_DIR$\RAM_Debug\Obj\Model.pbi + $PROJ_DIR$\RAM_Debug\Obj\AdcHardware.pbi + $PROJ_DIR$\RAM_Debug\List\UsartBaudRateRegisterCalculator.lst + $PROJ_DIR$\RAM_Debug\Obj\ext_irq.o + $PROJ_DIR$\RAM_Debug\Obj\TimerInterruptHandler.o + $PROJ_DIR$\RAM_Debug\List\Cstartup.lst + $PROJ_DIR$\RAM_Debug\Obj\TimerConfigurator.pbi + $PROJ_DIR$\RAM_Debug\Obj\Cstartup_SAM7.o + $PROJ_DIR$\RAM_Debug\Obj\AdcTemperatureSensor.pbi + $PROJ_DIR$\RAM_Debug\List\UsartConfigurator.lst + $PROJ_DIR$\RAM_Debug\List\UsartTransmitBufferStatus.lst + $PROJ_DIR$\RAM_Debug\Obj\UsartPutChar.pbi + $PROJ_DIR$\RAM_Debug\List\TaskScheduler.lst + $PROJ_DIR$\RAM_Debug\Obj\interrupt_timer.pbi + $PROJ_DIR$\RAM_Debug\List\UsartHardware.lst + $PROJ_DIR$\RAM_Debug\Obj\TaskScheduler.pbi + $PROJ_DIR$\RAM_Debug\Obj\Cstartup_SAM7.pbi + $PROJ_DIR$\RAM_Debug\List\Cstartup_SAM7.lst + $PROJ_DIR$\RAM_Debug\Obj\UsartTransmitBufferStatus.o + $PROJ_DIR$\RAM_Debug\Obj\TimerModel.pbi + $PROJ_DIR$\RAM_Debug\List\UsartConductor.lst + $PROJ_DIR$\RAM_Debug\Obj\UsartPutChar.o + $PROJ_DIR$\RAM_Debug\Obj\TimerInterruptConfigurator.pbi + $PROJ_DIR$\RAM_Debug\Obj\TimerHardware.o + $PROJ_DIR$\RAM_Debug\Obj\AdcTemperatureSensor.o + $PROJ_DIR$\RAM_Debug\Obj\AdcModel.o + $PROJ_DIR$\RAM_Debug\Obj\Executor.pbi + $PROJ_DIR$\RAM_Debug\Obj\TemperatureFilter.o + $PROJ_DIR$\RAM_Debug\Obj\AdcConductor.pbi + $PROJ_DIR$\RAM_Debug\List\TimerInterruptConfigurator.lst + $PROJ_DIR$\RAM_Debug\List\UsartModel.lst + $PROJ_DIR$\RAM_Debug\Obj\UsartConfigurator.o + $PROJ_DIR$\RAM_Debug\Obj\cmock_demo.pbd + $PROJ_DIR$\RAM_Debug\Exe\cmock_demo.out + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + $PROJ_DIR$\RAM_Debug\List\TemperatureCalculator.lst + $PROJ_DIR$\RAM_Debug\List\AdcHardware.lst + $PROJ_DIR$\RAM_Debug\List\Executor.lst + $PROJ_DIR$\RAM_Debug\Obj\UsartModel.pbi + $PROJ_DIR$\RAM_Debug\Obj\TimerConductor.pbi + $PROJ_DIR$\RAM_Debug\Obj\UsartConfigurator.pbi + $PROJ_DIR$\RAM_Debug\Obj\UsartHardware.o + $PROJ_DIR$\RAM_Debug\Obj\TemperatureCalculator.o + $PROJ_DIR$\RAM_Debug\Obj\AdcConductor.o + $PROJ_DIR$\RAM_Debug\Obj\IntrinsicsWrapper.o + $PROJ_DIR$\RAM_Debug\Obj\Model.o + $PROJ_DIR$\RAM_Debug\Obj\UsartTransmitBufferStatus.pbi + $PROJ_DIR$\RAM_Debug\Obj\TimerModel.o + $PROJ_DIR$\RAM_Debug\Obj\Executor.o + $PROJ_DIR$\RAM_Debug\Obj\TemperatureCalculator.pbi + $PROJ_DIR$\RAM_Debug\Obj\UsartBaudRateRegisterCalculator.o + $PROJ_DIR$\RAM_Debug\Obj\TimerInterruptConfigurator.o + $PROJ_DIR$\RAM_Debug\Obj\interrupt_Usart.pbi + $PROJ_DIR$\RAM_Debug\Obj\TaskScheduler.o + $PROJ_DIR$\RAM_Debug\Obj\Main.o + $PROJ_DIR$\RAM_Debug\Obj\ext_irq.pbi + $PROJ_DIR$\RAM_Debug\List\Main.lst + $PROJ_DIR$\RAM_Debug\List\TimerModel.lst + $PROJ_DIR$\RAM_Debug\Obj\interrupt_timer.o + $PROJ_DIR$\RAM_Debug\Obj\UsartModel.o + $PROJ_DIR$\RAM_Debug\Obj\TemperatureFilter.pbi + $PROJ_DIR$\RAM_Debug\Obj\IntrinsicsWrapper.pbi + $PROJ_DIR$\Resource\at91SAM7X256_RAM.icf + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + $PROJ_DIR$\..\..\examples\src\AdcModel.c + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + $PROJ_DIR$\..\..\examples\src\Executor.c + $PROJ_DIR$\..\..\examples\src\Main.c + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + $PROJ_DIR$\..\..\examples\src\Model.c + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + $PROJ_DIR$\Resource\SAM7_RAM.mac + $PROJ_DIR$\Resource\at91SAM7X256_FLASH.icf + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + $PROJ_DIR$\..\..\examples\src\TimerModel.c + $PROJ_DIR$\..\..\examples\src\UsartModel.c + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + $PROJ_DIR$\srcIAR\Cstartup.s + $PROJ_DIR$\incIAR\AT91SAM7X-EK.h + $PROJ_DIR$\incIAR\lib_AT91SAM7X256.h + $PROJ_DIR$\incIAR\AT91SAM7X256_inc.h + + + [ROOT_NODE] + + + ILINK + 158 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcTemperatureSensor.c + + + BICOMP + 133 + + + ICCARM + 122 149 + + + + + BICOMP + 29 14 36 + + + ICCARM + 29 14 36 + + + + + $PROJ_DIR$\..\..\test\system\src\Main.c + + + BICOMP + 121 + + + ICCARM + 181 179 + + + + + BICOMP + 29 14 9 40 21 19 28 27 92 42 20 32 18 91 90 37 30 3 8 4 35 39 93 36 38 + + + ICCARM + 29 14 9 40 21 19 28 27 92 42 20 32 18 91 90 37 30 3 8 4 35 39 93 36 38 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcHardwareConfigurator.c + + + BICOMP + 120 + + + ICCARM + 101 110 + + + + + BICOMP + 29 14 93 24 + + + ICCARM + 29 14 93 24 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcConductor.c + + + BICOMP + 153 + + + ICCARM + 99 168 + + + + + BICOMP + 29 14 35 38 39 + + + ICCARM + 29 14 35 38 39 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcHardware.c + + + BICOMP + 126 + + + ICCARM + 161 114 + + + + + BICOMP + 29 14 39 93 36 + + + ICCARM + 29 14 39 93 36 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcModel.c + + + BICOMP + 116 + + + ICCARM + 111 150 + + + + + BICOMP + 29 14 38 21 19 28 + + + ICCARM + 29 14 38 21 19 28 + + + + + $PROJ_DIR$\..\..\test\system\src\Executor.c + + + BICOMP + 151 + + + ICCARM + 162 173 + + + + + BICOMP + 29 14 9 40 27 90 35 11 23 + + + ICCARM + 29 14 9 40 27 90 35 11 23 + + + + + $PROJ_DIR$\..\..\test\system\src\Model.c + + + BICOMP + 125 + + + ICCARM + 124 170 + + + + + BICOMP + 40 29 14 21 28 + + + ICCARM + 40 29 14 21 28 + + + + + $PROJ_DIR$\..\..\test\system\src\TemperatureFilter.c + + + BICOMP + 185 + + + ICCARM + 115 152 + + + + + BICOMP + 29 14 28 7 23 5 31 1 6 48 2 + + + ICCARM + 29 14 28 7 23 5 31 1 26 6 48 2 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerConfigurator.c + + + BICOMP + 131 + + + ICCARM + 105 108 + + + + + BICOMP + 29 14 30 3 + + + ICCARM + 29 14 30 3 + + + + + $PROJ_DIR$\..\..\test\system\src\TemperatureCalculator.c + + + BICOMP + 174 + + + ICCARM + 160 167 + + + + + BICOMP + 29 14 19 7 23 5 31 1 6 48 2 + + + ICCARM + 29 14 19 7 23 5 31 1 26 6 48 2 + + + + + $PROJ_DIR$\..\..\test\system\src\TaskScheduler.c + + + BICOMP + 140 + + + ICCARM + 137 178 + + + + + BICOMP + 29 14 21 + + + ICCARM + 29 14 21 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerInterruptConfigurator.c + + + BICOMP + 147 + + + ICCARM + 154 176 + + + + + BICOMP + 29 14 3 8 + + + ICCARM + 29 14 3 8 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerConductor.c + + + BICOMP + 164 + + + ICCARM + 112 107 + + + + + BICOMP + 29 14 90 4 37 8 + + + ICCARM + 29 14 90 4 37 8 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerInterruptHandler.c + + + BICOMP + 123 + + + ICCARM + 100 129 + + + + + BICOMP + 29 14 8 3 + + + ICCARM + 29 14 8 3 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartConfigurator.c + + + BICOMP + 165 + + + ICCARM + 134 156 + + + + + BICOMP + 29 14 42 + + + ICCARM + 29 14 42 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerHardware.c + + + BICOMP + 102 + + + ICCARM + 113 148 + + + + + BICOMP + 29 14 37 30 + + + ICCARM + 29 14 37 30 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartTransmitBufferStatus.c + + + BICOMP + 171 + + + ICCARM + 135 143 + + + + + BICOMP + 29 14 91 + + + ICCARM + 29 14 91 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerModel.c + + + BICOMP + 144 + + + ICCARM + 182 172 + + + + + BICOMP + 29 14 4 21 + + + ICCARM + 29 14 4 21 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartBaudRateRegisterCalculator.c + + + BICOMP + 109 + + + ICCARM + 127 175 + + + + + BICOMP + 29 14 18 + + + ICCARM + 29 14 18 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartConductor.c + + + BICOMP + 104 + + + ICCARM + 145 98 + + + + + BICOMP + 29 14 27 92 32 21 + + + ICCARM + 29 14 27 92 32 21 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartHardware.c + + + BICOMP + 103 + + + ICCARM + 139 166 + + + + + BICOMP + 29 14 92 42 20 + + + ICCARM + 29 14 92 42 20 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartModel.c + + + BICOMP + 163 + + + ICCARM + 155 184 + + + + + BICOMP + 29 14 32 24 18 28 25 23 31 1 6 48 2 34 7 5 + + + ICCARM + 29 14 32 24 18 28 25 23 31 1 26 6 48 2 34 7 5 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartPutChar.c + + + BICOMP + 136 + + + ICCARM + 106 146 + + + + + BICOMP + 29 14 20 91 + + + ICCARM + 29 14 20 91 + + + + + $PROJ_DIR$\..\src\ext_irq.c + + + BICOMP + 180 + + + ICCARM + 128 + + + + + $PROJ_DIR$\..\src\interrupt_timer.c + + + BICOMP + 138 + + + ICCARM + 183 + + + + + $PROJ_DIR$\..\src\interrupt_Usart.c + + + BICOMP + 177 + + + ICCARM + 119 + + + + + $PROJ_DIR$\..\src\main.c + + + BICOMP + 121 + + + ICCARM + 179 + + + + + $PROJ_DIR$\RAM_Debug\Obj\cmock_demo.pbd + + + BILINK + 153 126 120 116 133 141 151 186 125 140 174 185 164 131 102 147 123 144 109 104 165 103 163 136 171 121 + + + + + $PROJ_DIR$\RAM_Debug\Exe\cmock_demo.out + + + ILINK + 187 168 114 110 150 149 118 132 173 169 179 170 178 167 152 107 108 148 176 129 172 175 98 156 166 184 146 143 41 33 22 + + + + + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + + + BICOMP + 141 + + + ICCARM + 142 132 + + + + + BICOMP + 10 11 23 216 87 217 + + + ICCARM + 10 11 23 216 87 217 + + + + + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + + + BICOMP + 120 + + + ICCARM + 101 110 + + + + + BICOMP + 84 87 83 82 + + + ICCARM + 84 87 83 82 + + + + + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + + + BICOMP + 153 + + + ICCARM + 99 168 + + + + + BICOMP + 84 87 86 72 76 + + + ICCARM + 84 87 86 72 76 + + + + + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + + + BICOMP + 126 + + + ICCARM + 161 114 + + + + + BICOMP + 84 87 76 83 81 + + + ICCARM + 84 87 76 83 81 + + + + + $PROJ_DIR$\..\..\examples\src\AdcModel.c + + + BICOMP + 116 + + + ICCARM + 111 150 + + + + + BICOMP + 84 87 72 88 85 77 + + + ICCARM + 84 87 72 88 85 77 + + + + + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + + + BICOMP + 133 + + + ICCARM + 122 149 + + + + + BICOMP + 84 87 81 + + + ICCARM + 84 87 81 + + + + + $PROJ_DIR$\..\..\examples\src\Executor.c + + + BICOMP + 151 + + + ICCARM + 162 173 + + + + + BICOMP + 84 87 43 57 45 47 86 59 + + + ICCARM + 84 87 43 57 45 47 86 59 + + + + + $PROJ_DIR$\..\..\examples\src\Main.c + + + BICOMP + 121 + + + ICCARM + 181 179 + + + + + BICOMP + 84 87 59 43 57 88 85 77 45 15 16 60 13 12 17 47 89 44 61 55 53 86 76 83 81 72 + + + ICCARM + 84 87 59 43 57 88 85 77 45 15 16 60 13 12 17 47 89 44 61 55 53 86 76 83 81 72 + + + + + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + + + BICOMP + 186 + + + ICCARM + 117 169 + + + + + BICOMP + 59 11 23 + + + ICCARM + 59 11 23 + + + + + $PROJ_DIR$\..\..\examples\src\Model.c + + + BICOMP + 125 + + + ICCARM + 124 170 + + + + + BICOMP + 57 84 87 88 77 + + + ICCARM + 57 84 87 88 77 + + + + + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + + + BICOMP + 174 + + + ICCARM + 160 167 + + + + + BICOMP + 84 87 85 7 23 5 31 1 6 48 2 + + + ICCARM + 84 87 85 7 23 5 31 1 26 6 48 2 + + + + + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + + + BICOMP + 140 + + + ICCARM + 137 178 + + + + + BICOMP + 84 87 88 + + + ICCARM + 84 87 88 + + + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + + + BICOMP + 147 + + + ICCARM + 154 176 + + + + + BICOMP + 84 87 61 55 + + + ICCARM + 84 87 61 55 + + + + + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + + + BICOMP + 185 + + + ICCARM + 115 152 + + + + + BICOMP + 84 87 77 7 23 5 31 1 6 48 2 + + + ICCARM + 84 87 77 7 23 5 31 1 26 6 48 2 + + + + + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + + + BICOMP + 164 + + + ICCARM + 112 107 + + + + + BICOMP + 84 87 47 53 89 55 + + + ICCARM + 84 87 47 53 89 55 + + + + + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + + + BICOMP + 131 + + + ICCARM + 105 108 + + + + + BICOMP + 84 87 44 61 + + + ICCARM + 84 87 44 61 + + + + + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + + + BICOMP + 102 + + + ICCARM + 113 148 + + + + + BICOMP + 84 87 89 44 + + + ICCARM + 84 87 89 44 + + + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + + + BICOMP + 123 + + + ICCARM + 100 129 + + + + + BICOMP + 84 87 55 61 + + + ICCARM + 84 87 55 61 + + + + + $PROJ_DIR$\..\..\examples\src\TimerModel.c + + + BICOMP + 144 + + + ICCARM + 182 172 + + + + + BICOMP + 84 87 53 88 + + + ICCARM + 84 87 53 88 + + + + + $PROJ_DIR$\..\..\examples\src\UsartModel.c + + + BICOMP + 163 + + + ICCARM + 155 184 + + + + + BICOMP + 84 87 13 82 12 77 25 23 31 1 6 48 2 34 7 5 + + + ICCARM + 84 87 13 82 12 77 25 23 31 1 26 6 48 2 34 7 5 + + + + + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + + + BICOMP + 109 + + + ICCARM + 127 175 + + + + + BICOMP + 84 87 12 + + + ICCARM + 84 87 12 + + + + + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + + + BICOMP + 104 + + + ICCARM + 145 98 + + + + + BICOMP + 84 87 45 15 13 88 + + + ICCARM + 84 87 45 15 13 88 + + + + + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + + + BICOMP + 165 + + + ICCARM + 134 156 + + + + + BICOMP + 84 87 16 + + + ICCARM + 84 87 16 + + + + + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + + + BICOMP + 103 + + + ICCARM + 139 166 + + + + + BICOMP + 84 87 15 16 60 + + + ICCARM + 84 87 15 16 60 + + + + + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + + + BICOMP + 171 + + + ICCARM + 135 143 + + + + + BICOMP + 84 87 17 + + + ICCARM + 84 87 17 + + + + + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + + + BICOMP + 136 + + + ICCARM + 106 146 + + + + + BICOMP + 84 87 60 17 + + + ICCARM + 84 87 60 17 + + + + + $PROJ_DIR$\srcIAR\Cstartup.s + + + AARM + 118 130 + + + + + AARM + 218 + + + + + $PROJ_DIR$\..\src\ext_irq.c + ICCARM + + + $PROJ_DIR$\..\src\interrupt_timer.c + ICCARM + + + $PROJ_DIR$\..\src\interrupt_Usart.c + ICCARM + + + $PROJ_DIR$\..\src\main.c + ICCARM + + + + + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/cmock_demo.ewd b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/cmock_demo.ewd new file mode 100644 index 0000000..27cc8e9 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/cmock_demo.ewd @@ -0,0 +1,1906 @@ + + + + 2 + + RAM_Debug + + ARM + + 1 + + C-SPY + 2 + + 18 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 1 + + + + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + JLINK_ID + 2 + + 10 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + MACRAIGOR_ID + 2 + + 3 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin + 1 + + + + + FLASH_Debug + + ARM + + 1 + + C-SPY + 2 + + 18 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 1 + + + + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + JLINK_ID + 2 + + 10 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + MACRAIGOR_ID + 2 + + 3 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin + 1 + + + + + Binary + + ARM + + 1 + + C-SPY + 2 + + 18 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 1 + + + + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + JLINK_ID + 2 + + 10 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + MACRAIGOR_ID + 2 + + 3 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin + 1 + + + + + + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/cmock_demo.ewp b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/cmock_demo.ewp new file mode 100644 index 0000000..4524d91 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/cmock_demo.ewp @@ -0,0 +1,2426 @@ + + + + 2 + + RAM_Debug + + ARM + + 1 + + General + 3 + + 16 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 20 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + ILINK + 0 + + 6 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + FLASH_Debug + + ARM + + 1 + + General + 3 + + 16 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 20 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + ILINK + 0 + + 6 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + Binary + + ARM + + 1 + + General + 3 + + 16 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 20 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + ILINK + 0 + + 6 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + Binary + + + Resource + + $PROJ_DIR$\Resource\at91SAM7X256_FLASH.icf + + + $PROJ_DIR$\Resource\at91SAM7X256_RAM.icf + + + $PROJ_DIR$\Resource\SAM7_FLASH.mac + + + $PROJ_DIR$\Resource\SAM7_RAM.mac + + + + Source + + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + + + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + + + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + + + $PROJ_DIR$\..\..\examples\src\AdcModel.c + + + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + + + $PROJ_DIR$\..\..\examples\src\Executor.c + + + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + + + $PROJ_DIR$\..\..\examples\src\Main.c + + + $PROJ_DIR$\..\..\examples\src\Model.c + + + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + + + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + + + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + + + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + + + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + + + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + + + $PROJ_DIR$\..\..\examples\src\TimerModel.c + + + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + + + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + + + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + + + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + + + $PROJ_DIR$\..\..\examples\src\UsartModel.c + + + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + + + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + + + + Startup + + $PROJ_DIR$\srcIAR\Cstartup.s + + + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + + + + + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/cmock_demo.eww b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/cmock_demo.eww new file mode 100644 index 0000000..a299a5d --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/cmock_demo.eww @@ -0,0 +1,26 @@ + + + + + $WS_DIR$\cmock_demo.ewp + + + + All + + cmock_demo + Binary + + + cmock_demo + FLASH_Debug + + + cmock_demo + RAM_Debug + + + + + + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/incIAR/AT91SAM7X-EK.h b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/incIAR/AT91SAM7X-EK.h new file mode 100644 index 0000000..9834675 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/incIAR/AT91SAM7X-EK.h @@ -0,0 +1,61 @@ +// ---------------------------------------------------------------------------- +// ATMEL Microcontroller Software Support - ROUSSET - +// ---------------------------------------------------------------------------- +// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// ---------------------------------------------------------------------------- +// File Name : AT91SAM7X-EK.h +// Object : AT91SAM7X-EK Evaluation Board Features Definition File +// +// ---------------------------------------------------------------------------- + +#ifndef AT91SAM7X_EK_H +#define AT91SAM7X_EK_H + +/*-----------------*/ +/* LEDs Definition */ +/*-----------------*/ +#define AT91B_LED1 (1<<19) // AT91C_PIO_PB19 AT91C_PB19_PWM0 AT91C_PB19_TCLK1 +#define AT91B_LED2 (1<<20) // AT91C_PIO_PB20 AT91C_PB20_PWM1 AT91C_PB20_PWM1 +#define AT91B_LED3 (AT91C_PIO_PB21) // AT91C_PIO_PB21 AT91C_PB21_PWM2 AT91C_PB21_PCK1 +#define AT91B_LED4 (AT91C_PIO_PB22) // AT91C_PIO_PB22 AT91C_PB22_PWM3 AT91C_PB22_PCK2 +#define AT91B_NB_LEB 4 +#define AT91B_LED_MASK (AT91B_LED1|AT91B_LED2|AT91B_LED3|AT91B_LED4) +#define AT91D_BASE_PIO_LED (AT91C_BASE_PIOB) + +#define AT91B_POWERLED (1<<25) // PB25 + + +/*-------------------------------*/ +/* JOYSTICK Position Definition */ +/*-------------------------------*/ +#define AT91B_SW1 (1<<21) // PA21 Up Button AT91C_PA21_TF AT91C_PA21_NPCS10 +#define AT91B_SW2 (1<<22) // PA22 Down Button AT91C_PA22_TK AT91C_PA22_SPCK1 +#define AT91B_SW3 (1<<23) // PA23 Left Button AT91C_PA23_TD AT91C_PA23_MOSI1 +#define AT91B_SW4 (1<<24) // PA24 Right Button AT91C_PA24_RD AT91C_PA24_MISO1 +#define AT91B_SW5 (1<<25) // PA25 Push Button AT91C_PA25_RK AT91C_PA25_NPCS11 +#define AT91B_SW_MASK (AT91B_SW1|AT91B_SW2|AT91B_SW3|AT91B_SW4|AT91B_SW5) + + +#define AT91D_BASE_PIO_SW (AT91C_BASE_PIOA) + +/*------------------*/ +/* CAN Definition */ +/*------------------*/ +#define AT91B_CAN_TRANSCEIVER_RS (1<<2) // PA2 + +/*--------------*/ +/* Clocks */ +/*--------------*/ +#define AT91B_MAIN_OSC 18432000 // Main Oscillator MAINCK +#define AT91B_MCK ((18432000*73/14)/2) // Output PLL Clock + +#endif /* AT91SAM7X-EK_H */ diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/incIAR/AT91SAM7X256_inc.h b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/incIAR/AT91SAM7X256_inc.h new file mode 100644 index 0000000..18e58d4 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/incIAR/AT91SAM7X256_inc.h @@ -0,0 +1,2268 @@ +// ---------------------------------------------------------------------------- +// ATMEL Microcontroller Software Support - ROUSSET - +// ---------------------------------------------------------------------------- +// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// ---------------------------------------------------------------------------- +// File Name : AT91SAM7X256.h +// Object : AT91SAM7X256 definitions +// Generated : AT91 SW Application Group 01/16/2006 (16:36:22) +// +// CVS Reference : /AT91SAM7X256.pl/1.15/Wed Nov 2 13:56:49 2005// +// CVS Reference : /SYS_SAM7X.pl/1.3/Tue Feb 1 17:01:43 2005// +// CVS Reference : /MC_SAM7X.pl/1.2/Fri May 20 14:13:04 2005// +// CVS Reference : /PMC_SAM7X.pl/1.4/Tue Feb 8 13:58:10 2005// +// CVS Reference : /RSTC_SAM7X.pl/1.2/Wed Jul 13 14:57:50 2005// +// CVS Reference : /UDP_SAM7X.pl/1.1/Tue May 10 11:35:35 2005// +// CVS Reference : /PWM_SAM7X.pl/1.1/Tue May 10 11:53:07 2005// +// CVS Reference : /AIC_6075B.pl/1.3/Fri May 20 14:01:30 2005// +// CVS Reference : /PIO_6057A.pl/1.2/Thu Feb 3 10:18:28 2005// +// CVS Reference : /RTTC_6081A.pl/1.2/Tue Nov 9 14:43:58 2004// +// CVS Reference : /PITC_6079A.pl/1.2/Tue Nov 9 14:43:56 2004// +// CVS Reference : /WDTC_6080A.pl/1.3/Tue Nov 9 14:44:00 2004// +// CVS Reference : /VREG_6085B.pl/1.1/Tue Feb 1 16:05:48 2005// +// CVS Reference : /PDC_6074C.pl/1.2/Thu Feb 3 08:48:54 2005// +// CVS Reference : /DBGU_6059D.pl/1.1/Mon Jan 31 13:15:32 2005// +// CVS Reference : /SPI_6088D.pl/1.3/Fri May 20 14:08:59 2005// +// CVS Reference : /US_6089C.pl/1.1/Mon Jul 12 18:23:26 2004// +// CVS Reference : /SSC_6078B.pl/1.1/Wed Jul 13 15:19:19 2005// +// CVS Reference : /TWI_6061A.pl/1.1/Tue Jul 13 07:38:06 2004// +// CVS Reference : /TC_6082A.pl/1.7/Fri Mar 11 12:52:17 2005// +// CVS Reference : /CAN_6019B.pl/1.1/Tue Mar 8 12:42:22 2005// +// CVS Reference : /EMACB_6119A.pl/1.6/Wed Jul 13 15:05:35 2005// +// CVS Reference : /ADC_6051C.pl/1.1/Fri Oct 17 09:12:38 2003// +// ---------------------------------------------------------------------------- + +// Hardware register definition + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR System Peripherals +// ***************************************************************************** + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Advanced Interrupt Controller +// ***************************************************************************** +// *** Register offset in AT91S_AIC structure *** +#define AIC_SMR ( 0) // Source Mode Register +#define AIC_SVR (128) // Source Vector Register +#define AIC_IVR (256) // IRQ Vector Register +#define AIC_FVR (260) // FIQ Vector Register +#define AIC_ISR (264) // Interrupt Status Register +#define AIC_IPR (268) // Interrupt Pending Register +#define AIC_IMR (272) // Interrupt Mask Register +#define AIC_CISR (276) // Core Interrupt Status Register +#define AIC_IECR (288) // Interrupt Enable Command Register +#define AIC_IDCR (292) // Interrupt Disable Command Register +#define AIC_ICCR (296) // Interrupt Clear Command Register +#define AIC_ISCR (300) // Interrupt Set Command Register +#define AIC_EOICR (304) // End of Interrupt Command Register +#define AIC_SPU (308) // Spurious Vector Register +#define AIC_DCR (312) // Debug Control Register (Protect) +#define AIC_FFER (320) // Fast Forcing Enable Register +#define AIC_FFDR (324) // Fast Forcing Disable Register +#define AIC_FFSR (328) // Fast Forcing Status Register +// -------- AIC_SMR : (AIC Offset: 0x0) Control Register -------- +#define AT91C_AIC_PRIOR (0x7 << 0) // (AIC) Priority Level +#define AT91C_AIC_PRIOR_LOWEST (0x0) // (AIC) Lowest priority level +#define AT91C_AIC_PRIOR_HIGHEST (0x7) // (AIC) Highest priority level +#define AT91C_AIC_SRCTYPE (0x3 << 5) // (AIC) Interrupt Source Type +#define AT91C_AIC_SRCTYPE_EXT_LOW_LEVEL (0x0 << 5) // (AIC) External Sources Code Label Low-level Sensitive +#define AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL (0x0 << 5) // (AIC) Internal Sources Code Label High-level Sensitive +#define AT91C_AIC_SRCTYPE_INT_POSITIVE_EDGE (0x1 << 5) // (AIC) Internal Sources Code Label Positive Edge triggered +#define AT91C_AIC_SRCTYPE_EXT_NEGATIVE_EDGE (0x1 << 5) // (AIC) External Sources Code Label Negative Edge triggered +#define AT91C_AIC_SRCTYPE_HIGH_LEVEL (0x2 << 5) // (AIC) Internal Or External Sources Code Label High-level Sensitive +#define AT91C_AIC_SRCTYPE_POSITIVE_EDGE (0x3 << 5) // (AIC) Internal Or External Sources Code Label Positive Edge triggered +// -------- AIC_CISR : (AIC Offset: 0x114) AIC Core Interrupt Status Register -------- +#define AT91C_AIC_NFIQ (0x1 << 0) // (AIC) NFIQ Status +#define AT91C_AIC_NIRQ (0x1 << 1) // (AIC) NIRQ Status +// -------- AIC_DCR : (AIC Offset: 0x138) AIC Debug Control Register (Protect) -------- +#define AT91C_AIC_DCR_PROT (0x1 << 0) // (AIC) Protection Mode +#define AT91C_AIC_DCR_GMSK (0x1 << 1) // (AIC) General Mask + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Peripheral DMA Controller +// ***************************************************************************** +// *** Register offset in AT91S_PDC structure *** +#define PDC_RPR ( 0) // Receive Pointer Register +#define PDC_RCR ( 4) // Receive Counter Register +#define PDC_TPR ( 8) // Transmit Pointer Register +#define PDC_TCR (12) // Transmit Counter Register +#define PDC_RNPR (16) // Receive Next Pointer Register +#define PDC_RNCR (20) // Receive Next Counter Register +#define PDC_TNPR (24) // Transmit Next Pointer Register +#define PDC_TNCR (28) // Transmit Next Counter Register +#define PDC_PTCR (32) // PDC Transfer Control Register +#define PDC_PTSR (36) // PDC Transfer Status Register +// -------- PDC_PTCR : (PDC Offset: 0x20) PDC Transfer Control Register -------- +#define AT91C_PDC_RXTEN (0x1 << 0) // (PDC) Receiver Transfer Enable +#define AT91C_PDC_RXTDIS (0x1 << 1) // (PDC) Receiver Transfer Disable +#define AT91C_PDC_TXTEN (0x1 << 8) // (PDC) Transmitter Transfer Enable +#define AT91C_PDC_TXTDIS (0x1 << 9) // (PDC) Transmitter Transfer Disable +// -------- PDC_PTSR : (PDC Offset: 0x24) PDC Transfer Status Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Debug Unit +// ***************************************************************************** +// *** Register offset in AT91S_DBGU structure *** +#define DBGU_CR ( 0) // Control Register +#define DBGU_MR ( 4) // Mode Register +#define DBGU_IER ( 8) // Interrupt Enable Register +#define DBGU_IDR (12) // Interrupt Disable Register +#define DBGU_IMR (16) // Interrupt Mask Register +#define DBGU_CSR (20) // Channel Status Register +#define DBGU_RHR (24) // Receiver Holding Register +#define DBGU_THR (28) // Transmitter Holding Register +#define DBGU_BRGR (32) // Baud Rate Generator Register +#define DBGU_CIDR (64) // Chip ID Register +#define DBGU_EXID (68) // Chip ID Extension Register +#define DBGU_FNTR (72) // Force NTRST Register +#define DBGU_RPR (256) // Receive Pointer Register +#define DBGU_RCR (260) // Receive Counter Register +#define DBGU_TPR (264) // Transmit Pointer Register +#define DBGU_TCR (268) // Transmit Counter Register +#define DBGU_RNPR (272) // Receive Next Pointer Register +#define DBGU_RNCR (276) // Receive Next Counter Register +#define DBGU_TNPR (280) // Transmit Next Pointer Register +#define DBGU_TNCR (284) // Transmit Next Counter Register +#define DBGU_PTCR (288) // PDC Transfer Control Register +#define DBGU_PTSR (292) // PDC Transfer Status Register +// -------- DBGU_CR : (DBGU Offset: 0x0) Debug Unit Control Register -------- +#define AT91C_US_RSTRX (0x1 << 2) // (DBGU) Reset Receiver +#define AT91C_US_RSTTX (0x1 << 3) // (DBGU) Reset Transmitter +#define AT91C_US_RXEN (0x1 << 4) // (DBGU) Receiver Enable +#define AT91C_US_RXDIS (0x1 << 5) // (DBGU) Receiver Disable +#define AT91C_US_TXEN (0x1 << 6) // (DBGU) Transmitter Enable +#define AT91C_US_TXDIS (0x1 << 7) // (DBGU) Transmitter Disable +#define AT91C_US_RSTSTA (0x1 << 8) // (DBGU) Reset Status Bits +// -------- DBGU_MR : (DBGU Offset: 0x4) Debug Unit Mode Register -------- +#define AT91C_US_PAR (0x7 << 9) // (DBGU) Parity type +#define AT91C_US_PAR_EVEN (0x0 << 9) // (DBGU) Even Parity +#define AT91C_US_PAR_ODD (0x1 << 9) // (DBGU) Odd Parity +#define AT91C_US_PAR_SPACE (0x2 << 9) // (DBGU) Parity forced to 0 (Space) +#define AT91C_US_PAR_MARK (0x3 << 9) // (DBGU) Parity forced to 1 (Mark) +#define AT91C_US_PAR_NONE (0x4 << 9) // (DBGU) No Parity +#define AT91C_US_PAR_MULTI_DROP (0x6 << 9) // (DBGU) Multi-drop mode +#define AT91C_US_CHMODE (0x3 << 14) // (DBGU) Channel Mode +#define AT91C_US_CHMODE_NORMAL (0x0 << 14) // (DBGU) Normal Mode: The USART channel operates as an RX/TX USART. +#define AT91C_US_CHMODE_AUTO (0x1 << 14) // (DBGU) Automatic Echo: Receiver Data Input is connected to the TXD pin. +#define AT91C_US_CHMODE_LOCAL (0x2 << 14) // (DBGU) Local Loopback: Transmitter Output Signal is connected to Receiver Input Signal. +#define AT91C_US_CHMODE_REMOTE (0x3 << 14) // (DBGU) Remote Loopback: RXD pin is internally connected to TXD pin. +// -------- DBGU_IER : (DBGU Offset: 0x8) Debug Unit Interrupt Enable Register -------- +#define AT91C_US_RXRDY (0x1 << 0) // (DBGU) RXRDY Interrupt +#define AT91C_US_TXRDY (0x1 << 1) // (DBGU) TXRDY Interrupt +#define AT91C_US_ENDRX (0x1 << 3) // (DBGU) End of Receive Transfer Interrupt +#define AT91C_US_ENDTX (0x1 << 4) // (DBGU) End of Transmit Interrupt +#define AT91C_US_OVRE (0x1 << 5) // (DBGU) Overrun Interrupt +#define AT91C_US_FRAME (0x1 << 6) // (DBGU) Framing Error Interrupt +#define AT91C_US_PARE (0x1 << 7) // (DBGU) Parity Error Interrupt +#define AT91C_US_TXEMPTY (0x1 << 9) // (DBGU) TXEMPTY Interrupt +#define AT91C_US_TXBUFE (0x1 << 11) // (DBGU) TXBUFE Interrupt +#define AT91C_US_RXBUFF (0x1 << 12) // (DBGU) RXBUFF Interrupt +#define AT91C_US_COMM_TX (0x1 << 30) // (DBGU) COMM_TX Interrupt +#define AT91C_US_COMM_RX (0x1 << 31) // (DBGU) COMM_RX Interrupt +// -------- DBGU_IDR : (DBGU Offset: 0xc) Debug Unit Interrupt Disable Register -------- +// -------- DBGU_IMR : (DBGU Offset: 0x10) Debug Unit Interrupt Mask Register -------- +// -------- DBGU_CSR : (DBGU Offset: 0x14) Debug Unit Channel Status Register -------- +// -------- DBGU_FNTR : (DBGU Offset: 0x48) Debug Unit FORCE_NTRST Register -------- +#define AT91C_US_FORCE_NTRST (0x1 << 0) // (DBGU) Force NTRST in JTAG + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Parallel Input Output Controler +// ***************************************************************************** +// *** Register offset in AT91S_PIO structure *** +#define PIO_PER ( 0) // PIO Enable Register +#define PIO_PDR ( 4) // PIO Disable Register +#define PIO_PSR ( 8) // PIO Status Register +#define PIO_OER (16) // Output Enable Register +#define PIO_ODR (20) // Output Disable Registerr +#define PIO_OSR (24) // Output Status Register +#define PIO_IFER (32) // Input Filter Enable Register +#define PIO_IFDR (36) // Input Filter Disable Register +#define PIO_IFSR (40) // Input Filter Status Register +#define PIO_SODR (48) // Set Output Data Register +#define PIO_CODR (52) // Clear Output Data Register +#define PIO_ODSR (56) // Output Data Status Register +#define PIO_PDSR (60) // Pin Data Status Register +#define PIO_IER (64) // Interrupt Enable Register +#define PIO_IDR (68) // Interrupt Disable Register +#define PIO_IMR (72) // Interrupt Mask Register +#define PIO_ISR (76) // Interrupt Status Register +#define PIO_MDER (80) // Multi-driver Enable Register +#define PIO_MDDR (84) // Multi-driver Disable Register +#define PIO_MDSR (88) // Multi-driver Status Register +#define PIO_PPUDR (96) // Pull-up Disable Register +#define PIO_PPUER (100) // Pull-up Enable Register +#define PIO_PPUSR (104) // Pull-up Status Register +#define PIO_ASR (112) // Select A Register +#define PIO_BSR (116) // Select B Register +#define PIO_ABSR (120) // AB Select Status Register +#define PIO_OWER (160) // Output Write Enable Register +#define PIO_OWDR (164) // Output Write Disable Register +#define PIO_OWSR (168) // Output Write Status Register + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Clock Generator Controler +// ***************************************************************************** +// *** Register offset in AT91S_CKGR structure *** +#define CKGR_MOR ( 0) // Main Oscillator Register +#define CKGR_MCFR ( 4) // Main Clock Frequency Register +#define CKGR_PLLR (12) // PLL Register +// -------- CKGR_MOR : (CKGR Offset: 0x0) Main Oscillator Register -------- +#define AT91C_CKGR_MOSCEN (0x1 << 0) // (CKGR) Main Oscillator Enable +#define AT91C_CKGR_OSCBYPASS (0x1 << 1) // (CKGR) Main Oscillator Bypass +#define AT91C_CKGR_OSCOUNT (0xFF << 8) // (CKGR) Main Oscillator Start-up Time +// -------- CKGR_MCFR : (CKGR Offset: 0x4) Main Clock Frequency Register -------- +#define AT91C_CKGR_MAINF (0xFFFF << 0) // (CKGR) Main Clock Frequency +#define AT91C_CKGR_MAINRDY (0x1 << 16) // (CKGR) Main Clock Ready +// -------- CKGR_PLLR : (CKGR Offset: 0xc) PLL B Register -------- +#define AT91C_CKGR_DIV (0xFF << 0) // (CKGR) Divider Selected +#define AT91C_CKGR_DIV_0 (0x0) // (CKGR) Divider output is 0 +#define AT91C_CKGR_DIV_BYPASS (0x1) // (CKGR) Divider is bypassed +#define AT91C_CKGR_PLLCOUNT (0x3F << 8) // (CKGR) PLL Counter +#define AT91C_CKGR_OUT (0x3 << 14) // (CKGR) PLL Output Frequency Range +#define AT91C_CKGR_OUT_0 (0x0 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_OUT_1 (0x1 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_OUT_2 (0x2 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_OUT_3 (0x3 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_MUL (0x7FF << 16) // (CKGR) PLL Multiplier +#define AT91C_CKGR_USBDIV (0x3 << 28) // (CKGR) Divider for USB Clocks +#define AT91C_CKGR_USBDIV_0 (0x0 << 28) // (CKGR) Divider output is PLL clock output +#define AT91C_CKGR_USBDIV_1 (0x1 << 28) // (CKGR) Divider output is PLL clock output divided by 2 +#define AT91C_CKGR_USBDIV_2 (0x2 << 28) // (CKGR) Divider output is PLL clock output divided by 4 + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Power Management Controler +// ***************************************************************************** +// *** Register offset in AT91S_PMC structure *** +#define PMC_SCER ( 0) // System Clock Enable Register +#define PMC_SCDR ( 4) // System Clock Disable Register +#define PMC_SCSR ( 8) // System Clock Status Register +#define PMC_PCER (16) // Peripheral Clock Enable Register +#define PMC_PCDR (20) // Peripheral Clock Disable Register +#define PMC_PCSR (24) // Peripheral Clock Status Register +#define PMC_MOR (32) // Main Oscillator Register +#define PMC_MCFR (36) // Main Clock Frequency Register +#define PMC_PLLR (44) // PLL Register +#define PMC_MCKR (48) // Master Clock Register +#define PMC_PCKR (64) // Programmable Clock Register +#define PMC_IER (96) // Interrupt Enable Register +#define PMC_IDR (100) // Interrupt Disable Register +#define PMC_SR (104) // Status Register +#define PMC_IMR (108) // Interrupt Mask Register +// -------- PMC_SCER : (PMC Offset: 0x0) System Clock Enable Register -------- +#define AT91C_PMC_PCK (0x1 << 0) // (PMC) Processor Clock +#define AT91C_PMC_UDP (0x1 << 7) // (PMC) USB Device Port Clock +#define AT91C_PMC_PCK0 (0x1 << 8) // (PMC) Programmable Clock Output +#define AT91C_PMC_PCK1 (0x1 << 9) // (PMC) Programmable Clock Output +#define AT91C_PMC_PCK2 (0x1 << 10) // (PMC) Programmable Clock Output +#define AT91C_PMC_PCK3 (0x1 << 11) // (PMC) Programmable Clock Output +// -------- PMC_SCDR : (PMC Offset: 0x4) System Clock Disable Register -------- +// -------- PMC_SCSR : (PMC Offset: 0x8) System Clock Status Register -------- +// -------- CKGR_MOR : (PMC Offset: 0x20) Main Oscillator Register -------- +// -------- CKGR_MCFR : (PMC Offset: 0x24) Main Clock Frequency Register -------- +// -------- CKGR_PLLR : (PMC Offset: 0x2c) PLL B Register -------- +// -------- PMC_MCKR : (PMC Offset: 0x30) Master Clock Register -------- +#define AT91C_PMC_CSS (0x3 << 0) // (PMC) Programmable Clock Selection +#define AT91C_PMC_CSS_SLOW_CLK (0x0) // (PMC) Slow Clock is selected +#define AT91C_PMC_CSS_MAIN_CLK (0x1) // (PMC) Main Clock is selected +#define AT91C_PMC_CSS_PLL_CLK (0x3) // (PMC) Clock from PLL is selected +#define AT91C_PMC_PRES (0x7 << 2) // (PMC) Programmable Clock Prescaler +#define AT91C_PMC_PRES_CLK (0x0 << 2) // (PMC) Selected clock +#define AT91C_PMC_PRES_CLK_2 (0x1 << 2) // (PMC) Selected clock divided by 2 +#define AT91C_PMC_PRES_CLK_4 (0x2 << 2) // (PMC) Selected clock divided by 4 +#define AT91C_PMC_PRES_CLK_8 (0x3 << 2) // (PMC) Selected clock divided by 8 +#define AT91C_PMC_PRES_CLK_16 (0x4 << 2) // (PMC) Selected clock divided by 16 +#define AT91C_PMC_PRES_CLK_32 (0x5 << 2) // (PMC) Selected clock divided by 32 +#define AT91C_PMC_PRES_CLK_64 (0x6 << 2) // (PMC) Selected clock divided by 64 +// -------- PMC_PCKR : (PMC Offset: 0x40) Programmable Clock Register -------- +// -------- PMC_IER : (PMC Offset: 0x60) PMC Interrupt Enable Register -------- +#define AT91C_PMC_MOSCS (0x1 << 0) // (PMC) MOSC Status/Enable/Disable/Mask +#define AT91C_PMC_LOCK (0x1 << 2) // (PMC) PLL Status/Enable/Disable/Mask +#define AT91C_PMC_MCKRDY (0x1 << 3) // (PMC) MCK_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK0RDY (0x1 << 8) // (PMC) PCK0_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK1RDY (0x1 << 9) // (PMC) PCK1_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK2RDY (0x1 << 10) // (PMC) PCK2_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK3RDY (0x1 << 11) // (PMC) PCK3_RDY Status/Enable/Disable/Mask +// -------- PMC_IDR : (PMC Offset: 0x64) PMC Interrupt Disable Register -------- +// -------- PMC_SR : (PMC Offset: 0x68) PMC Status Register -------- +// -------- PMC_IMR : (PMC Offset: 0x6c) PMC Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Reset Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_RSTC structure *** +#define RSTC_RCR ( 0) // Reset Control Register +#define RSTC_RSR ( 4) // Reset Status Register +#define RSTC_RMR ( 8) // Reset Mode Register +// -------- RSTC_RCR : (RSTC Offset: 0x0) Reset Control Register -------- +#define AT91C_RSTC_PROCRST (0x1 << 0) // (RSTC) Processor Reset +#define AT91C_RSTC_PERRST (0x1 << 2) // (RSTC) Peripheral Reset +#define AT91C_RSTC_EXTRST (0x1 << 3) // (RSTC) External Reset +#define AT91C_RSTC_KEY (0xFF << 24) // (RSTC) Password +// -------- RSTC_RSR : (RSTC Offset: 0x4) Reset Status Register -------- +#define AT91C_RSTC_URSTS (0x1 << 0) // (RSTC) User Reset Status +#define AT91C_RSTC_BODSTS (0x1 << 1) // (RSTC) Brownout Detection Status +#define AT91C_RSTC_RSTTYP (0x7 << 8) // (RSTC) Reset Type +#define AT91C_RSTC_RSTTYP_POWERUP (0x0 << 8) // (RSTC) Power-up Reset. VDDCORE rising. +#define AT91C_RSTC_RSTTYP_WAKEUP (0x1 << 8) // (RSTC) WakeUp Reset. VDDCORE rising. +#define AT91C_RSTC_RSTTYP_WATCHDOG (0x2 << 8) // (RSTC) Watchdog Reset. Watchdog overflow occured. +#define AT91C_RSTC_RSTTYP_SOFTWARE (0x3 << 8) // (RSTC) Software Reset. Processor reset required by the software. +#define AT91C_RSTC_RSTTYP_USER (0x4 << 8) // (RSTC) User Reset. NRST pin detected low. +#define AT91C_RSTC_RSTTYP_BROWNOUT (0x5 << 8) // (RSTC) Brownout Reset occured. +#define AT91C_RSTC_NRSTL (0x1 << 16) // (RSTC) NRST pin level +#define AT91C_RSTC_SRCMP (0x1 << 17) // (RSTC) Software Reset Command in Progress. +// -------- RSTC_RMR : (RSTC Offset: 0x8) Reset Mode Register -------- +#define AT91C_RSTC_URSTEN (0x1 << 0) // (RSTC) User Reset Enable +#define AT91C_RSTC_URSTIEN (0x1 << 4) // (RSTC) User Reset Interrupt Enable +#define AT91C_RSTC_ERSTL (0xF << 8) // (RSTC) User Reset Length +#define AT91C_RSTC_BODIEN (0x1 << 16) // (RSTC) Brownout Detection Interrupt Enable + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Real Time Timer Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_RTTC structure *** +#define RTTC_RTMR ( 0) // Real-time Mode Register +#define RTTC_RTAR ( 4) // Real-time Alarm Register +#define RTTC_RTVR ( 8) // Real-time Value Register +#define RTTC_RTSR (12) // Real-time Status Register +// -------- RTTC_RTMR : (RTTC Offset: 0x0) Real-time Mode Register -------- +#define AT91C_RTTC_RTPRES (0xFFFF << 0) // (RTTC) Real-time Timer Prescaler Value +#define AT91C_RTTC_ALMIEN (0x1 << 16) // (RTTC) Alarm Interrupt Enable +#define AT91C_RTTC_RTTINCIEN (0x1 << 17) // (RTTC) Real Time Timer Increment Interrupt Enable +#define AT91C_RTTC_RTTRST (0x1 << 18) // (RTTC) Real Time Timer Restart +// -------- RTTC_RTAR : (RTTC Offset: 0x4) Real-time Alarm Register -------- +#define AT91C_RTTC_ALMV (0x0 << 0) // (RTTC) Alarm Value +// -------- RTTC_RTVR : (RTTC Offset: 0x8) Current Real-time Value Register -------- +#define AT91C_RTTC_CRTV (0x0 << 0) // (RTTC) Current Real-time Value +// -------- RTTC_RTSR : (RTTC Offset: 0xc) Real-time Status Register -------- +#define AT91C_RTTC_ALMS (0x1 << 0) // (RTTC) Real-time Alarm Status +#define AT91C_RTTC_RTTINC (0x1 << 1) // (RTTC) Real-time Timer Increment + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Periodic Interval Timer Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_PITC structure *** +#define PITC_PIMR ( 0) // Period Interval Mode Register +#define PITC_PISR ( 4) // Period Interval Status Register +#define PITC_PIVR ( 8) // Period Interval Value Register +#define PITC_PIIR (12) // Period Interval Image Register +// -------- PITC_PIMR : (PITC Offset: 0x0) Periodic Interval Mode Register -------- +#define AT91C_PITC_PIV (0xFFFFF << 0) // (PITC) Periodic Interval Value +#define AT91C_PITC_PITEN (0x1 << 24) // (PITC) Periodic Interval Timer Enabled +#define AT91C_PITC_PITIEN (0x1 << 25) // (PITC) Periodic Interval Timer Interrupt Enable +// -------- PITC_PISR : (PITC Offset: 0x4) Periodic Interval Status Register -------- +#define AT91C_PITC_PITS (0x1 << 0) // (PITC) Periodic Interval Timer Status +// -------- PITC_PIVR : (PITC Offset: 0x8) Periodic Interval Value Register -------- +#define AT91C_PITC_CPIV (0xFFFFF << 0) // (PITC) Current Periodic Interval Value +#define AT91C_PITC_PICNT (0xFFF << 20) // (PITC) Periodic Interval Counter +// -------- PITC_PIIR : (PITC Offset: 0xc) Periodic Interval Image Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Watchdog Timer Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_WDTC structure *** +#define WDTC_WDCR ( 0) // Watchdog Control Register +#define WDTC_WDMR ( 4) // Watchdog Mode Register +#define WDTC_WDSR ( 8) // Watchdog Status Register +// -------- WDTC_WDCR : (WDTC Offset: 0x0) Periodic Interval Image Register -------- +#define AT91C_WDTC_WDRSTT (0x1 << 0) // (WDTC) Watchdog Restart +#define AT91C_WDTC_KEY (0xFF << 24) // (WDTC) Watchdog KEY Password +// -------- WDTC_WDMR : (WDTC Offset: 0x4) Watchdog Mode Register -------- +#define AT91C_WDTC_WDV (0xFFF << 0) // (WDTC) Watchdog Timer Restart +#define AT91C_WDTC_WDFIEN (0x1 << 12) // (WDTC) Watchdog Fault Interrupt Enable +#define AT91C_WDTC_WDRSTEN (0x1 << 13) // (WDTC) Watchdog Reset Enable +#define AT91C_WDTC_WDRPROC (0x1 << 14) // (WDTC) Watchdog Timer Restart +#define AT91C_WDTC_WDDIS (0x1 << 15) // (WDTC) Watchdog Disable +#define AT91C_WDTC_WDD (0xFFF << 16) // (WDTC) Watchdog Delta Value +#define AT91C_WDTC_WDDBGHLT (0x1 << 28) // (WDTC) Watchdog Debug Halt +#define AT91C_WDTC_WDIDLEHLT (0x1 << 29) // (WDTC) Watchdog Idle Halt +// -------- WDTC_WDSR : (WDTC Offset: 0x8) Watchdog Status Register -------- +#define AT91C_WDTC_WDUNF (0x1 << 0) // (WDTC) Watchdog Underflow +#define AT91C_WDTC_WDERR (0x1 << 1) // (WDTC) Watchdog Error + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Voltage Regulator Mode Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_VREG structure *** +#define VREG_MR ( 0) // Voltage Regulator Mode Register +// -------- VREG_MR : (VREG Offset: 0x0) Voltage Regulator Mode Register -------- +#define AT91C_VREG_PSTDBY (0x1 << 0) // (VREG) Voltage Regulator Power Standby Mode + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Memory Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_MC structure *** +#define MC_RCR ( 0) // MC Remap Control Register +#define MC_ASR ( 4) // MC Abort Status Register +#define MC_AASR ( 8) // MC Abort Address Status Register +#define MC_FMR (96) // MC Flash Mode Register +#define MC_FCR (100) // MC Flash Command Register +#define MC_FSR (104) // MC Flash Status Register +// -------- MC_RCR : (MC Offset: 0x0) MC Remap Control Register -------- +#define AT91C_MC_RCB (0x1 << 0) // (MC) Remap Command Bit +// -------- MC_ASR : (MC Offset: 0x4) MC Abort Status Register -------- +#define AT91C_MC_UNDADD (0x1 << 0) // (MC) Undefined Addess Abort Status +#define AT91C_MC_MISADD (0x1 << 1) // (MC) Misaligned Addess Abort Status +#define AT91C_MC_ABTSZ (0x3 << 8) // (MC) Abort Size Status +#define AT91C_MC_ABTSZ_BYTE (0x0 << 8) // (MC) Byte +#define AT91C_MC_ABTSZ_HWORD (0x1 << 8) // (MC) Half-word +#define AT91C_MC_ABTSZ_WORD (0x2 << 8) // (MC) Word +#define AT91C_MC_ABTTYP (0x3 << 10) // (MC) Abort Type Status +#define AT91C_MC_ABTTYP_DATAR (0x0 << 10) // (MC) Data Read +#define AT91C_MC_ABTTYP_DATAW (0x1 << 10) // (MC) Data Write +#define AT91C_MC_ABTTYP_FETCH (0x2 << 10) // (MC) Code Fetch +#define AT91C_MC_MST0 (0x1 << 16) // (MC) Master 0 Abort Source +#define AT91C_MC_MST1 (0x1 << 17) // (MC) Master 1 Abort Source +#define AT91C_MC_SVMST0 (0x1 << 24) // (MC) Saved Master 0 Abort Source +#define AT91C_MC_SVMST1 (0x1 << 25) // (MC) Saved Master 1 Abort Source +// -------- MC_FMR : (MC Offset: 0x60) MC Flash Mode Register -------- +#define AT91C_MC_FRDY (0x1 << 0) // (MC) Flash Ready +#define AT91C_MC_LOCKE (0x1 << 2) // (MC) Lock Error +#define AT91C_MC_PROGE (0x1 << 3) // (MC) Programming Error +#define AT91C_MC_NEBP (0x1 << 7) // (MC) No Erase Before Programming +#define AT91C_MC_FWS (0x3 << 8) // (MC) Flash Wait State +#define AT91C_MC_FWS_0FWS (0x0 << 8) // (MC) 1 cycle for Read, 2 for Write operations +#define AT91C_MC_FWS_1FWS (0x1 << 8) // (MC) 2 cycles for Read, 3 for Write operations +#define AT91C_MC_FWS_2FWS (0x2 << 8) // (MC) 3 cycles for Read, 4 for Write operations +#define AT91C_MC_FWS_3FWS (0x3 << 8) // (MC) 4 cycles for Read, 4 for Write operations +#define AT91C_MC_FMCN (0xFF << 16) // (MC) Flash Microsecond Cycle Number +// -------- MC_FCR : (MC Offset: 0x64) MC Flash Command Register -------- +#define AT91C_MC_FCMD (0xF << 0) // (MC) Flash Command +#define AT91C_MC_FCMD_START_PROG (0x1) // (MC) Starts the programming of th epage specified by PAGEN. +#define AT91C_MC_FCMD_LOCK (0x2) // (MC) Starts a lock sequence of the sector defined by the bits 4 to 7 of the field PAGEN. +#define AT91C_MC_FCMD_PROG_AND_LOCK (0x3) // (MC) The lock sequence automatically happens after the programming sequence is completed. +#define AT91C_MC_FCMD_UNLOCK (0x4) // (MC) Starts an unlock sequence of the sector defined by the bits 4 to 7 of the field PAGEN. +#define AT91C_MC_FCMD_ERASE_ALL (0x8) // (MC) Starts the erase of the entire flash.If at least a page is locked, the command is cancelled. +#define AT91C_MC_FCMD_SET_GP_NVM (0xB) // (MC) Set General Purpose NVM bits. +#define AT91C_MC_FCMD_CLR_GP_NVM (0xD) // (MC) Clear General Purpose NVM bits. +#define AT91C_MC_FCMD_SET_SECURITY (0xF) // (MC) Set Security Bit. +#define AT91C_MC_PAGEN (0x3FF << 8) // (MC) Page Number +#define AT91C_MC_KEY (0xFF << 24) // (MC) Writing Protect Key +// -------- MC_FSR : (MC Offset: 0x68) MC Flash Command Register -------- +#define AT91C_MC_SECURITY (0x1 << 4) // (MC) Security Bit Status +#define AT91C_MC_GPNVM0 (0x1 << 8) // (MC) Sector 0 Lock Status +#define AT91C_MC_GPNVM1 (0x1 << 9) // (MC) Sector 1 Lock Status +#define AT91C_MC_GPNVM2 (0x1 << 10) // (MC) Sector 2 Lock Status +#define AT91C_MC_GPNVM3 (0x1 << 11) // (MC) Sector 3 Lock Status +#define AT91C_MC_GPNVM4 (0x1 << 12) // (MC) Sector 4 Lock Status +#define AT91C_MC_GPNVM5 (0x1 << 13) // (MC) Sector 5 Lock Status +#define AT91C_MC_GPNVM6 (0x1 << 14) // (MC) Sector 6 Lock Status +#define AT91C_MC_GPNVM7 (0x1 << 15) // (MC) Sector 7 Lock Status +#define AT91C_MC_LOCKS0 (0x1 << 16) // (MC) Sector 0 Lock Status +#define AT91C_MC_LOCKS1 (0x1 << 17) // (MC) Sector 1 Lock Status +#define AT91C_MC_LOCKS2 (0x1 << 18) // (MC) Sector 2 Lock Status +#define AT91C_MC_LOCKS3 (0x1 << 19) // (MC) Sector 3 Lock Status +#define AT91C_MC_LOCKS4 (0x1 << 20) // (MC) Sector 4 Lock Status +#define AT91C_MC_LOCKS5 (0x1 << 21) // (MC) Sector 5 Lock Status +#define AT91C_MC_LOCKS6 (0x1 << 22) // (MC) Sector 6 Lock Status +#define AT91C_MC_LOCKS7 (0x1 << 23) // (MC) Sector 7 Lock Status +#define AT91C_MC_LOCKS8 (0x1 << 24) // (MC) Sector 8 Lock Status +#define AT91C_MC_LOCKS9 (0x1 << 25) // (MC) Sector 9 Lock Status +#define AT91C_MC_LOCKS10 (0x1 << 26) // (MC) Sector 10 Lock Status +#define AT91C_MC_LOCKS11 (0x1 << 27) // (MC) Sector 11 Lock Status +#define AT91C_MC_LOCKS12 (0x1 << 28) // (MC) Sector 12 Lock Status +#define AT91C_MC_LOCKS13 (0x1 << 29) // (MC) Sector 13 Lock Status +#define AT91C_MC_LOCKS14 (0x1 << 30) // (MC) Sector 14 Lock Status +#define AT91C_MC_LOCKS15 (0x1 << 31) // (MC) Sector 15 Lock Status + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Serial Parallel Interface +// ***************************************************************************** +// *** Register offset in AT91S_SPI structure *** +#define SPI_CR ( 0) // Control Register +#define SPI_MR ( 4) // Mode Register +#define SPI_RDR ( 8) // Receive Data Register +#define SPI_TDR (12) // Transmit Data Register +#define SPI_SR (16) // Status Register +#define SPI_IER (20) // Interrupt Enable Register +#define SPI_IDR (24) // Interrupt Disable Register +#define SPI_IMR (28) // Interrupt Mask Register +#define SPI_CSR (48) // Chip Select Register +#define SPI_RPR (256) // Receive Pointer Register +#define SPI_RCR (260) // Receive Counter Register +#define SPI_TPR (264) // Transmit Pointer Register +#define SPI_TCR (268) // Transmit Counter Register +#define SPI_RNPR (272) // Receive Next Pointer Register +#define SPI_RNCR (276) // Receive Next Counter Register +#define SPI_TNPR (280) // Transmit Next Pointer Register +#define SPI_TNCR (284) // Transmit Next Counter Register +#define SPI_PTCR (288) // PDC Transfer Control Register +#define SPI_PTSR (292) // PDC Transfer Status Register +// -------- SPI_CR : (SPI Offset: 0x0) SPI Control Register -------- +#define AT91C_SPI_SPIEN (0x1 << 0) // (SPI) SPI Enable +#define AT91C_SPI_SPIDIS (0x1 << 1) // (SPI) SPI Disable +#define AT91C_SPI_SWRST (0x1 << 7) // (SPI) SPI Software reset +#define AT91C_SPI_LASTXFER (0x1 << 24) // (SPI) SPI Last Transfer +// -------- SPI_MR : (SPI Offset: 0x4) SPI Mode Register -------- +#define AT91C_SPI_MSTR (0x1 << 0) // (SPI) Master/Slave Mode +#define AT91C_SPI_PS (0x1 << 1) // (SPI) Peripheral Select +#define AT91C_SPI_PS_FIXED (0x0 << 1) // (SPI) Fixed Peripheral Select +#define AT91C_SPI_PS_VARIABLE (0x1 << 1) // (SPI) Variable Peripheral Select +#define AT91C_SPI_PCSDEC (0x1 << 2) // (SPI) Chip Select Decode +#define AT91C_SPI_FDIV (0x1 << 3) // (SPI) Clock Selection +#define AT91C_SPI_MODFDIS (0x1 << 4) // (SPI) Mode Fault Detection +#define AT91C_SPI_LLB (0x1 << 7) // (SPI) Clock Selection +#define AT91C_SPI_PCS (0xF << 16) // (SPI) Peripheral Chip Select +#define AT91C_SPI_DLYBCS (0xFF << 24) // (SPI) Delay Between Chip Selects +// -------- SPI_RDR : (SPI Offset: 0x8) Receive Data Register -------- +#define AT91C_SPI_RD (0xFFFF << 0) // (SPI) Receive Data +#define AT91C_SPI_RPCS (0xF << 16) // (SPI) Peripheral Chip Select Status +// -------- SPI_TDR : (SPI Offset: 0xc) Transmit Data Register -------- +#define AT91C_SPI_TD (0xFFFF << 0) // (SPI) Transmit Data +#define AT91C_SPI_TPCS (0xF << 16) // (SPI) Peripheral Chip Select Status +// -------- SPI_SR : (SPI Offset: 0x10) Status Register -------- +#define AT91C_SPI_RDRF (0x1 << 0) // (SPI) Receive Data Register Full +#define AT91C_SPI_TDRE (0x1 << 1) // (SPI) Transmit Data Register Empty +#define AT91C_SPI_MODF (0x1 << 2) // (SPI) Mode Fault Error +#define AT91C_SPI_OVRES (0x1 << 3) // (SPI) Overrun Error Status +#define AT91C_SPI_ENDRX (0x1 << 4) // (SPI) End of Receiver Transfer +#define AT91C_SPI_ENDTX (0x1 << 5) // (SPI) End of Receiver Transfer +#define AT91C_SPI_RXBUFF (0x1 << 6) // (SPI) RXBUFF Interrupt +#define AT91C_SPI_TXBUFE (0x1 << 7) // (SPI) TXBUFE Interrupt +#define AT91C_SPI_NSSR (0x1 << 8) // (SPI) NSSR Interrupt +#define AT91C_SPI_TXEMPTY (0x1 << 9) // (SPI) TXEMPTY Interrupt +#define AT91C_SPI_SPIENS (0x1 << 16) // (SPI) Enable Status +// -------- SPI_IER : (SPI Offset: 0x14) Interrupt Enable Register -------- +// -------- SPI_IDR : (SPI Offset: 0x18) Interrupt Disable Register -------- +// -------- SPI_IMR : (SPI Offset: 0x1c) Interrupt Mask Register -------- +// -------- SPI_CSR : (SPI Offset: 0x30) Chip Select Register -------- +#define AT91C_SPI_CPOL (0x1 << 0) // (SPI) Clock Polarity +#define AT91C_SPI_NCPHA (0x1 << 1) // (SPI) Clock Phase +#define AT91C_SPI_CSAAT (0x1 << 3) // (SPI) Chip Select Active After Transfer +#define AT91C_SPI_BITS (0xF << 4) // (SPI) Bits Per Transfer +#define AT91C_SPI_BITS_8 (0x0 << 4) // (SPI) 8 Bits Per transfer +#define AT91C_SPI_BITS_9 (0x1 << 4) // (SPI) 9 Bits Per transfer +#define AT91C_SPI_BITS_10 (0x2 << 4) // (SPI) 10 Bits Per transfer +#define AT91C_SPI_BITS_11 (0x3 << 4) // (SPI) 11 Bits Per transfer +#define AT91C_SPI_BITS_12 (0x4 << 4) // (SPI) 12 Bits Per transfer +#define AT91C_SPI_BITS_13 (0x5 << 4) // (SPI) 13 Bits Per transfer +#define AT91C_SPI_BITS_14 (0x6 << 4) // (SPI) 14 Bits Per transfer +#define AT91C_SPI_BITS_15 (0x7 << 4) // (SPI) 15 Bits Per transfer +#define AT91C_SPI_BITS_16 (0x8 << 4) // (SPI) 16 Bits Per transfer +#define AT91C_SPI_SCBR (0xFF << 8) // (SPI) Serial Clock Baud Rate +#define AT91C_SPI_DLYBS (0xFF << 16) // (SPI) Delay Before SPCK +#define AT91C_SPI_DLYBCT (0xFF << 24) // (SPI) Delay Between Consecutive Transfers + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Usart +// ***************************************************************************** +// *** Register offset in AT91S_USART structure *** +#define US_CR ( 0) // Control Register +#define US_MR ( 4) // Mode Register +#define US_IER ( 8) // Interrupt Enable Register +#define US_IDR (12) // Interrupt Disable Register +#define US_IMR (16) // Interrupt Mask Register +#define US_CSR (20) // Channel Status Register +#define US_RHR (24) // Receiver Holding Register +#define US_THR (28) // Transmitter Holding Register +#define US_BRGR (32) // Baud Rate Generator Register +#define US_RTOR (36) // Receiver Time-out Register +#define US_TTGR (40) // Transmitter Time-guard Register +#define US_FIDI (64) // FI_DI_Ratio Register +#define US_NER (68) // Nb Errors Register +#define US_IF (76) // IRDA_FILTER Register +#define US_RPR (256) // Receive Pointer Register +#define US_RCR (260) // Receive Counter Register +#define US_TPR (264) // Transmit Pointer Register +#define US_TCR (268) // Transmit Counter Register +#define US_RNPR (272) // Receive Next Pointer Register +#define US_RNCR (276) // Receive Next Counter Register +#define US_TNPR (280) // Transmit Next Pointer Register +#define US_TNCR (284) // Transmit Next Counter Register +#define US_PTCR (288) // PDC Transfer Control Register +#define US_PTSR (292) // PDC Transfer Status Register +// -------- US_CR : (USART Offset: 0x0) Debug Unit Control Register -------- +#define AT91C_US_STTBRK (0x1 << 9) // (USART) Start Break +#define AT91C_US_STPBRK (0x1 << 10) // (USART) Stop Break +#define AT91C_US_STTTO (0x1 << 11) // (USART) Start Time-out +#define AT91C_US_SENDA (0x1 << 12) // (USART) Send Address +#define AT91C_US_RSTIT (0x1 << 13) // (USART) Reset Iterations +#define AT91C_US_RSTNACK (0x1 << 14) // (USART) Reset Non Acknowledge +#define AT91C_US_RETTO (0x1 << 15) // (USART) Rearm Time-out +#define AT91C_US_DTREN (0x1 << 16) // (USART) Data Terminal ready Enable +#define AT91C_US_DTRDIS (0x1 << 17) // (USART) Data Terminal ready Disable +#define AT91C_US_RTSEN (0x1 << 18) // (USART) Request to Send enable +#define AT91C_US_RTSDIS (0x1 << 19) // (USART) Request to Send Disable +// -------- US_MR : (USART Offset: 0x4) Debug Unit Mode Register -------- +#define AT91C_US_USMODE (0xF << 0) // (USART) Usart mode +#define AT91C_US_USMODE_NORMAL (0x0) // (USART) Normal +#define AT91C_US_USMODE_RS485 (0x1) // (USART) RS485 +#define AT91C_US_USMODE_HWHSH (0x2) // (USART) Hardware Handshaking +#define AT91C_US_USMODE_MODEM (0x3) // (USART) Modem +#define AT91C_US_USMODE_ISO7816_0 (0x4) // (USART) ISO7816 protocol: T = 0 +#define AT91C_US_USMODE_ISO7816_1 (0x6) // (USART) ISO7816 protocol: T = 1 +#define AT91C_US_USMODE_IRDA (0x8) // (USART) IrDA +#define AT91C_US_USMODE_SWHSH (0xC) // (USART) Software Handshaking +#define AT91C_US_CLKS (0x3 << 4) // (USART) Clock Selection (Baud Rate generator Input Clock +#define AT91C_US_CLKS_CLOCK (0x0 << 4) // (USART) Clock +#define AT91C_US_CLKS_FDIV1 (0x1 << 4) // (USART) fdiv1 +#define AT91C_US_CLKS_SLOW (0x2 << 4) // (USART) slow_clock (ARM) +#define AT91C_US_CLKS_EXT (0x3 << 4) // (USART) External (SCK) +#define AT91C_US_CHRL (0x3 << 6) // (USART) Clock Selection (Baud Rate generator Input Clock +#define AT91C_US_CHRL_5_BITS (0x0 << 6) // (USART) Character Length: 5 bits +#define AT91C_US_CHRL_6_BITS (0x1 << 6) // (USART) Character Length: 6 bits +#define AT91C_US_CHRL_7_BITS (0x2 << 6) // (USART) Character Length: 7 bits +#define AT91C_US_CHRL_8_BITS (0x3 << 6) // (USART) Character Length: 8 bits +#define AT91C_US_SYNC (0x1 << 8) // (USART) Synchronous Mode Select +#define AT91C_US_NBSTOP (0x3 << 12) // (USART) Number of Stop bits +#define AT91C_US_NBSTOP_1_BIT (0x0 << 12) // (USART) 1 stop bit +#define AT91C_US_NBSTOP_15_BIT (0x1 << 12) // (USART) Asynchronous (SYNC=0) 2 stop bits Synchronous (SYNC=1) 2 stop bits +#define AT91C_US_NBSTOP_2_BIT (0x2 << 12) // (USART) 2 stop bits +#define AT91C_US_MSBF (0x1 << 16) // (USART) Bit Order +#define AT91C_US_MODE9 (0x1 << 17) // (USART) 9-bit Character length +#define AT91C_US_CKLO (0x1 << 18) // (USART) Clock Output Select +#define AT91C_US_OVER (0x1 << 19) // (USART) Over Sampling Mode +#define AT91C_US_INACK (0x1 << 20) // (USART) Inhibit Non Acknowledge +#define AT91C_US_DSNACK (0x1 << 21) // (USART) Disable Successive NACK +#define AT91C_US_MAX_ITER (0x1 << 24) // (USART) Number of Repetitions +#define AT91C_US_FILTER (0x1 << 28) // (USART) Receive Line Filter +// -------- US_IER : (USART Offset: 0x8) Debug Unit Interrupt Enable Register -------- +#define AT91C_US_RXBRK (0x1 << 2) // (USART) Break Received/End of Break +#define AT91C_US_TIMEOUT (0x1 << 8) // (USART) Receiver Time-out +#define AT91C_US_ITERATION (0x1 << 10) // (USART) Max number of Repetitions Reached +#define AT91C_US_NACK (0x1 << 13) // (USART) Non Acknowledge +#define AT91C_US_RIIC (0x1 << 16) // (USART) Ring INdicator Input Change Flag +#define AT91C_US_DSRIC (0x1 << 17) // (USART) Data Set Ready Input Change Flag +#define AT91C_US_DCDIC (0x1 << 18) // (USART) Data Carrier Flag +#define AT91C_US_CTSIC (0x1 << 19) // (USART) Clear To Send Input Change Flag +// -------- US_IDR : (USART Offset: 0xc) Debug Unit Interrupt Disable Register -------- +// -------- US_IMR : (USART Offset: 0x10) Debug Unit Interrupt Mask Register -------- +// -------- US_CSR : (USART Offset: 0x14) Debug Unit Channel Status Register -------- +#define AT91C_US_RI (0x1 << 20) // (USART) Image of RI Input +#define AT91C_US_DSR (0x1 << 21) // (USART) Image of DSR Input +#define AT91C_US_DCD (0x1 << 22) // (USART) Image of DCD Input +#define AT91C_US_CTS (0x1 << 23) // (USART) Image of CTS Input + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Synchronous Serial Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_SSC structure *** +#define SSC_CR ( 0) // Control Register +#define SSC_CMR ( 4) // Clock Mode Register +#define SSC_RCMR (16) // Receive Clock ModeRegister +#define SSC_RFMR (20) // Receive Frame Mode Register +#define SSC_TCMR (24) // Transmit Clock Mode Register +#define SSC_TFMR (28) // Transmit Frame Mode Register +#define SSC_RHR (32) // Receive Holding Register +#define SSC_THR (36) // Transmit Holding Register +#define SSC_RSHR (48) // Receive Sync Holding Register +#define SSC_TSHR (52) // Transmit Sync Holding Register +#define SSC_SR (64) // Status Register +#define SSC_IER (68) // Interrupt Enable Register +#define SSC_IDR (72) // Interrupt Disable Register +#define SSC_IMR (76) // Interrupt Mask Register +#define SSC_RPR (256) // Receive Pointer Register +#define SSC_RCR (260) // Receive Counter Register +#define SSC_TPR (264) // Transmit Pointer Register +#define SSC_TCR (268) // Transmit Counter Register +#define SSC_RNPR (272) // Receive Next Pointer Register +#define SSC_RNCR (276) // Receive Next Counter Register +#define SSC_TNPR (280) // Transmit Next Pointer Register +#define SSC_TNCR (284) // Transmit Next Counter Register +#define SSC_PTCR (288) // PDC Transfer Control Register +#define SSC_PTSR (292) // PDC Transfer Status Register +// -------- SSC_CR : (SSC Offset: 0x0) SSC Control Register -------- +#define AT91C_SSC_RXEN (0x1 << 0) // (SSC) Receive Enable +#define AT91C_SSC_RXDIS (0x1 << 1) // (SSC) Receive Disable +#define AT91C_SSC_TXEN (0x1 << 8) // (SSC) Transmit Enable +#define AT91C_SSC_TXDIS (0x1 << 9) // (SSC) Transmit Disable +#define AT91C_SSC_SWRST (0x1 << 15) // (SSC) Software Reset +// -------- SSC_RCMR : (SSC Offset: 0x10) SSC Receive Clock Mode Register -------- +#define AT91C_SSC_CKS (0x3 << 0) // (SSC) Receive/Transmit Clock Selection +#define AT91C_SSC_CKS_DIV (0x0) // (SSC) Divided Clock +#define AT91C_SSC_CKS_TK (0x1) // (SSC) TK Clock signal +#define AT91C_SSC_CKS_RK (0x2) // (SSC) RK pin +#define AT91C_SSC_CKO (0x7 << 2) // (SSC) Receive/Transmit Clock Output Mode Selection +#define AT91C_SSC_CKO_NONE (0x0 << 2) // (SSC) Receive/Transmit Clock Output Mode: None RK pin: Input-only +#define AT91C_SSC_CKO_CONTINOUS (0x1 << 2) // (SSC) Continuous Receive/Transmit Clock RK pin: Output +#define AT91C_SSC_CKO_DATA_TX (0x2 << 2) // (SSC) Receive/Transmit Clock only during data transfers RK pin: Output +#define AT91C_SSC_CKI (0x1 << 5) // (SSC) Receive/Transmit Clock Inversion +#define AT91C_SSC_CKG (0x3 << 6) // (SSC) Receive/Transmit Clock Gating Selection +#define AT91C_SSC_CKG_NONE (0x0 << 6) // (SSC) Receive/Transmit Clock Gating: None, continuous clock +#define AT91C_SSC_CKG_LOW (0x1 << 6) // (SSC) Receive/Transmit Clock enabled only if RF Low +#define AT91C_SSC_CKG_HIGH (0x2 << 6) // (SSC) Receive/Transmit Clock enabled only if RF High +#define AT91C_SSC_START (0xF << 8) // (SSC) Receive/Transmit Start Selection +#define AT91C_SSC_START_CONTINOUS (0x0 << 8) // (SSC) Continuous, as soon as the receiver is enabled, and immediately after the end of transfer of the previous data. +#define AT91C_SSC_START_TX (0x1 << 8) // (SSC) Transmit/Receive start +#define AT91C_SSC_START_LOW_RF (0x2 << 8) // (SSC) Detection of a low level on RF input +#define AT91C_SSC_START_HIGH_RF (0x3 << 8) // (SSC) Detection of a high level on RF input +#define AT91C_SSC_START_FALL_RF (0x4 << 8) // (SSC) Detection of a falling edge on RF input +#define AT91C_SSC_START_RISE_RF (0x5 << 8) // (SSC) Detection of a rising edge on RF input +#define AT91C_SSC_START_LEVEL_RF (0x6 << 8) // (SSC) Detection of any level change on RF input +#define AT91C_SSC_START_EDGE_RF (0x7 << 8) // (SSC) Detection of any edge on RF input +#define AT91C_SSC_START_0 (0x8 << 8) // (SSC) Compare 0 +#define AT91C_SSC_STOP (0x1 << 12) // (SSC) Receive Stop Selection +#define AT91C_SSC_STTDLY (0xFF << 16) // (SSC) Receive/Transmit Start Delay +#define AT91C_SSC_PERIOD (0xFF << 24) // (SSC) Receive/Transmit Period Divider Selection +// -------- SSC_RFMR : (SSC Offset: 0x14) SSC Receive Frame Mode Register -------- +#define AT91C_SSC_DATLEN (0x1F << 0) // (SSC) Data Length +#define AT91C_SSC_LOOP (0x1 << 5) // (SSC) Loop Mode +#define AT91C_SSC_MSBF (0x1 << 7) // (SSC) Most Significant Bit First +#define AT91C_SSC_DATNB (0xF << 8) // (SSC) Data Number per Frame +#define AT91C_SSC_FSLEN (0xF << 16) // (SSC) Receive/Transmit Frame Sync length +#define AT91C_SSC_FSOS (0x7 << 20) // (SSC) Receive/Transmit Frame Sync Output Selection +#define AT91C_SSC_FSOS_NONE (0x0 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: None RK pin Input-only +#define AT91C_SSC_FSOS_NEGATIVE (0x1 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Negative Pulse +#define AT91C_SSC_FSOS_POSITIVE (0x2 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Positive Pulse +#define AT91C_SSC_FSOS_LOW (0x3 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Driver Low during data transfer +#define AT91C_SSC_FSOS_HIGH (0x4 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Driver High during data transfer +#define AT91C_SSC_FSOS_TOGGLE (0x5 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Toggling at each start of data transfer +#define AT91C_SSC_FSEDGE (0x1 << 24) // (SSC) Frame Sync Edge Detection +// -------- SSC_TCMR : (SSC Offset: 0x18) SSC Transmit Clock Mode Register -------- +// -------- SSC_TFMR : (SSC Offset: 0x1c) SSC Transmit Frame Mode Register -------- +#define AT91C_SSC_DATDEF (0x1 << 5) // (SSC) Data Default Value +#define AT91C_SSC_FSDEN (0x1 << 23) // (SSC) Frame Sync Data Enable +// -------- SSC_SR : (SSC Offset: 0x40) SSC Status Register -------- +#define AT91C_SSC_TXRDY (0x1 << 0) // (SSC) Transmit Ready +#define AT91C_SSC_TXEMPTY (0x1 << 1) // (SSC) Transmit Empty +#define AT91C_SSC_ENDTX (0x1 << 2) // (SSC) End Of Transmission +#define AT91C_SSC_TXBUFE (0x1 << 3) // (SSC) Transmit Buffer Empty +#define AT91C_SSC_RXRDY (0x1 << 4) // (SSC) Receive Ready +#define AT91C_SSC_OVRUN (0x1 << 5) // (SSC) Receive Overrun +#define AT91C_SSC_ENDRX (0x1 << 6) // (SSC) End of Reception +#define AT91C_SSC_RXBUFF (0x1 << 7) // (SSC) Receive Buffer Full +#define AT91C_SSC_CP0 (0x1 << 8) // (SSC) Compare 0 +#define AT91C_SSC_CP1 (0x1 << 9) // (SSC) Compare 1 +#define AT91C_SSC_TXSYN (0x1 << 10) // (SSC) Transmit Sync +#define AT91C_SSC_RXSYN (0x1 << 11) // (SSC) Receive Sync +#define AT91C_SSC_TXENA (0x1 << 16) // (SSC) Transmit Enable +#define AT91C_SSC_RXENA (0x1 << 17) // (SSC) Receive Enable +// -------- SSC_IER : (SSC Offset: 0x44) SSC Interrupt Enable Register -------- +// -------- SSC_IDR : (SSC Offset: 0x48) SSC Interrupt Disable Register -------- +// -------- SSC_IMR : (SSC Offset: 0x4c) SSC Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Two-wire Interface +// ***************************************************************************** +// *** Register offset in AT91S_TWI structure *** +#define TWI_CR ( 0) // Control Register +#define TWI_MMR ( 4) // Master Mode Register +#define TWI_IADR (12) // Internal Address Register +#define TWI_CWGR (16) // Clock Waveform Generator Register +#define TWI_SR (32) // Status Register +#define TWI_IER (36) // Interrupt Enable Register +#define TWI_IDR (40) // Interrupt Disable Register +#define TWI_IMR (44) // Interrupt Mask Register +#define TWI_RHR (48) // Receive Holding Register +#define TWI_THR (52) // Transmit Holding Register +// -------- TWI_CR : (TWI Offset: 0x0) TWI Control Register -------- +#define AT91C_TWI_START (0x1 << 0) // (TWI) Send a START Condition +#define AT91C_TWI_STOP (0x1 << 1) // (TWI) Send a STOP Condition +#define AT91C_TWI_MSEN (0x1 << 2) // (TWI) TWI Master Transfer Enabled +#define AT91C_TWI_MSDIS (0x1 << 3) // (TWI) TWI Master Transfer Disabled +#define AT91C_TWI_SWRST (0x1 << 7) // (TWI) Software Reset +// -------- TWI_MMR : (TWI Offset: 0x4) TWI Master Mode Register -------- +#define AT91C_TWI_IADRSZ (0x3 << 8) // (TWI) Internal Device Address Size +#define AT91C_TWI_IADRSZ_NO (0x0 << 8) // (TWI) No internal device address +#define AT91C_TWI_IADRSZ_1_BYTE (0x1 << 8) // (TWI) One-byte internal device address +#define AT91C_TWI_IADRSZ_2_BYTE (0x2 << 8) // (TWI) Two-byte internal device address +#define AT91C_TWI_IADRSZ_3_BYTE (0x3 << 8) // (TWI) Three-byte internal device address +#define AT91C_TWI_MREAD (0x1 << 12) // (TWI) Master Read Direction +#define AT91C_TWI_DADR (0x7F << 16) // (TWI) Device Address +// -------- TWI_CWGR : (TWI Offset: 0x10) TWI Clock Waveform Generator Register -------- +#define AT91C_TWI_CLDIV (0xFF << 0) // (TWI) Clock Low Divider +#define AT91C_TWI_CHDIV (0xFF << 8) // (TWI) Clock High Divider +#define AT91C_TWI_CKDIV (0x7 << 16) // (TWI) Clock Divider +// -------- TWI_SR : (TWI Offset: 0x20) TWI Status Register -------- +#define AT91C_TWI_TXCOMP (0x1 << 0) // (TWI) Transmission Completed +#define AT91C_TWI_RXRDY (0x1 << 1) // (TWI) Receive holding register ReaDY +#define AT91C_TWI_TXRDY (0x1 << 2) // (TWI) Transmit holding register ReaDY +#define AT91C_TWI_OVRE (0x1 << 6) // (TWI) Overrun Error +#define AT91C_TWI_UNRE (0x1 << 7) // (TWI) Underrun Error +#define AT91C_TWI_NACK (0x1 << 8) // (TWI) Not Acknowledged +// -------- TWI_IER : (TWI Offset: 0x24) TWI Interrupt Enable Register -------- +// -------- TWI_IDR : (TWI Offset: 0x28) TWI Interrupt Disable Register -------- +// -------- TWI_IMR : (TWI Offset: 0x2c) TWI Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR PWMC Channel Interface +// ***************************************************************************** +// *** Register offset in AT91S_PWMC_CH structure *** +#define PWMC_CMR ( 0) // Channel Mode Register +#define PWMC_CDTYR ( 4) // Channel Duty Cycle Register +#define PWMC_CPRDR ( 8) // Channel Period Register +#define PWMC_CCNTR (12) // Channel Counter Register +#define PWMC_CUPDR (16) // Channel Update Register +#define PWMC_Reserved (20) // Reserved +// -------- PWMC_CMR : (PWMC_CH Offset: 0x0) PWMC Channel Mode Register -------- +#define AT91C_PWMC_CPRE (0xF << 0) // (PWMC_CH) Channel Pre-scaler : PWMC_CLKx +#define AT91C_PWMC_CPRE_MCK (0x0) // (PWMC_CH) +#define AT91C_PWMC_CPRE_MCKA (0xB) // (PWMC_CH) +#define AT91C_PWMC_CPRE_MCKB (0xC) // (PWMC_CH) +#define AT91C_PWMC_CALG (0x1 << 8) // (PWMC_CH) Channel Alignment +#define AT91C_PWMC_CPOL (0x1 << 9) // (PWMC_CH) Channel Polarity +#define AT91C_PWMC_CPD (0x1 << 10) // (PWMC_CH) Channel Update Period +// -------- PWMC_CDTYR : (PWMC_CH Offset: 0x4) PWMC Channel Duty Cycle Register -------- +#define AT91C_PWMC_CDTY (0x0 << 0) // (PWMC_CH) Channel Duty Cycle +// -------- PWMC_CPRDR : (PWMC_CH Offset: 0x8) PWMC Channel Period Register -------- +#define AT91C_PWMC_CPRD (0x0 << 0) // (PWMC_CH) Channel Period +// -------- PWMC_CCNTR : (PWMC_CH Offset: 0xc) PWMC Channel Counter Register -------- +#define AT91C_PWMC_CCNT (0x0 << 0) // (PWMC_CH) Channel Counter +// -------- PWMC_CUPDR : (PWMC_CH Offset: 0x10) PWMC Channel Update Register -------- +#define AT91C_PWMC_CUPD (0x0 << 0) // (PWMC_CH) Channel Update + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Pulse Width Modulation Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_PWMC structure *** +#define PWMC_MR ( 0) // PWMC Mode Register +#define PWMC_ENA ( 4) // PWMC Enable Register +#define PWMC_DIS ( 8) // PWMC Disable Register +#define PWMC_SR (12) // PWMC Status Register +#define PWMC_IER (16) // PWMC Interrupt Enable Register +#define PWMC_IDR (20) // PWMC Interrupt Disable Register +#define PWMC_IMR (24) // PWMC Interrupt Mask Register +#define PWMC_ISR (28) // PWMC Interrupt Status Register +#define PWMC_VR (252) // PWMC Version Register +#define PWMC_CH (512) // PWMC Channel +// -------- PWMC_MR : (PWMC Offset: 0x0) PWMC Mode Register -------- +#define AT91C_PWMC_DIVA (0xFF << 0) // (PWMC) CLKA divide factor. +#define AT91C_PWMC_PREA (0xF << 8) // (PWMC) Divider Input Clock Prescaler A +#define AT91C_PWMC_PREA_MCK (0x0 << 8) // (PWMC) +#define AT91C_PWMC_DIVB (0xFF << 16) // (PWMC) CLKB divide factor. +#define AT91C_PWMC_PREB (0xF << 24) // (PWMC) Divider Input Clock Prescaler B +#define AT91C_PWMC_PREB_MCK (0x0 << 24) // (PWMC) +// -------- PWMC_ENA : (PWMC Offset: 0x4) PWMC Enable Register -------- +#define AT91C_PWMC_CHID0 (0x1 << 0) // (PWMC) Channel ID 0 +#define AT91C_PWMC_CHID1 (0x1 << 1) // (PWMC) Channel ID 1 +#define AT91C_PWMC_CHID2 (0x1 << 2) // (PWMC) Channel ID 2 +#define AT91C_PWMC_CHID3 (0x1 << 3) // (PWMC) Channel ID 3 +// -------- PWMC_DIS : (PWMC Offset: 0x8) PWMC Disable Register -------- +// -------- PWMC_SR : (PWMC Offset: 0xc) PWMC Status Register -------- +// -------- PWMC_IER : (PWMC Offset: 0x10) PWMC Interrupt Enable Register -------- +// -------- PWMC_IDR : (PWMC Offset: 0x14) PWMC Interrupt Disable Register -------- +// -------- PWMC_IMR : (PWMC Offset: 0x18) PWMC Interrupt Mask Register -------- +// -------- PWMC_ISR : (PWMC Offset: 0x1c) PWMC Interrupt Status Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR USB Device Interface +// ***************************************************************************** +// *** Register offset in AT91S_UDP structure *** +#define UDP_NUM ( 0) // Frame Number Register +#define UDP_GLBSTATE ( 4) // Global State Register +#define UDP_FADDR ( 8) // Function Address Register +#define UDP_IER (16) // Interrupt Enable Register +#define UDP_IDR (20) // Interrupt Disable Register +#define UDP_IMR (24) // Interrupt Mask Register +#define UDP_ISR (28) // Interrupt Status Register +#define UDP_ICR (32) // Interrupt Clear Register +#define UDP_RSTEP (40) // Reset Endpoint Register +#define UDP_CSR (48) // Endpoint Control and Status Register +#define UDP_FDR (80) // Endpoint FIFO Data Register +#define UDP_TXVC (116) // Transceiver Control Register +// -------- UDP_FRM_NUM : (UDP Offset: 0x0) USB Frame Number Register -------- +#define AT91C_UDP_FRM_NUM (0x7FF << 0) // (UDP) Frame Number as Defined in the Packet Field Formats +#define AT91C_UDP_FRM_ERR (0x1 << 16) // (UDP) Frame Error +#define AT91C_UDP_FRM_OK (0x1 << 17) // (UDP) Frame OK +// -------- UDP_GLB_STATE : (UDP Offset: 0x4) USB Global State Register -------- +#define AT91C_UDP_FADDEN (0x1 << 0) // (UDP) Function Address Enable +#define AT91C_UDP_CONFG (0x1 << 1) // (UDP) Configured +#define AT91C_UDP_ESR (0x1 << 2) // (UDP) Enable Send Resume +#define AT91C_UDP_RSMINPR (0x1 << 3) // (UDP) A Resume Has Been Sent to the Host +#define AT91C_UDP_RMWUPE (0x1 << 4) // (UDP) Remote Wake Up Enable +// -------- UDP_FADDR : (UDP Offset: 0x8) USB Function Address Register -------- +#define AT91C_UDP_FADD (0xFF << 0) // (UDP) Function Address Value +#define AT91C_UDP_FEN (0x1 << 8) // (UDP) Function Enable +// -------- UDP_IER : (UDP Offset: 0x10) USB Interrupt Enable Register -------- +#define AT91C_UDP_EPINT0 (0x1 << 0) // (UDP) Endpoint 0 Interrupt +#define AT91C_UDP_EPINT1 (0x1 << 1) // (UDP) Endpoint 0 Interrupt +#define AT91C_UDP_EPINT2 (0x1 << 2) // (UDP) Endpoint 2 Interrupt +#define AT91C_UDP_EPINT3 (0x1 << 3) // (UDP) Endpoint 3 Interrupt +#define AT91C_UDP_EPINT4 (0x1 << 4) // (UDP) Endpoint 4 Interrupt +#define AT91C_UDP_EPINT5 (0x1 << 5) // (UDP) Endpoint 5 Interrupt +#define AT91C_UDP_RXSUSP (0x1 << 8) // (UDP) USB Suspend Interrupt +#define AT91C_UDP_RXRSM (0x1 << 9) // (UDP) USB Resume Interrupt +#define AT91C_UDP_EXTRSM (0x1 << 10) // (UDP) USB External Resume Interrupt +#define AT91C_UDP_SOFINT (0x1 << 11) // (UDP) USB Start Of frame Interrupt +#define AT91C_UDP_WAKEUP (0x1 << 13) // (UDP) USB Resume Interrupt +// -------- UDP_IDR : (UDP Offset: 0x14) USB Interrupt Disable Register -------- +// -------- UDP_IMR : (UDP Offset: 0x18) USB Interrupt Mask Register -------- +// -------- UDP_ISR : (UDP Offset: 0x1c) USB Interrupt Status Register -------- +#define AT91C_UDP_ENDBUSRES (0x1 << 12) // (UDP) USB End Of Bus Reset Interrupt +// -------- UDP_ICR : (UDP Offset: 0x20) USB Interrupt Clear Register -------- +// -------- UDP_RST_EP : (UDP Offset: 0x28) USB Reset Endpoint Register -------- +#define AT91C_UDP_EP0 (0x1 << 0) // (UDP) Reset Endpoint 0 +#define AT91C_UDP_EP1 (0x1 << 1) // (UDP) Reset Endpoint 1 +#define AT91C_UDP_EP2 (0x1 << 2) // (UDP) Reset Endpoint 2 +#define AT91C_UDP_EP3 (0x1 << 3) // (UDP) Reset Endpoint 3 +#define AT91C_UDP_EP4 (0x1 << 4) // (UDP) Reset Endpoint 4 +#define AT91C_UDP_EP5 (0x1 << 5) // (UDP) Reset Endpoint 5 +// -------- UDP_CSR : (UDP Offset: 0x30) USB Endpoint Control and Status Register -------- +#define AT91C_UDP_TXCOMP (0x1 << 0) // (UDP) Generates an IN packet with data previously written in the DPR +#define AT91C_UDP_RX_DATA_BK0 (0x1 << 1) // (UDP) Receive Data Bank 0 +#define AT91C_UDP_RXSETUP (0x1 << 2) // (UDP) Sends STALL to the Host (Control endpoints) +#define AT91C_UDP_ISOERROR (0x1 << 3) // (UDP) Isochronous error (Isochronous endpoints) +#define AT91C_UDP_TXPKTRDY (0x1 << 4) // (UDP) Transmit Packet Ready +#define AT91C_UDP_FORCESTALL (0x1 << 5) // (UDP) Force Stall (used by Control, Bulk and Isochronous endpoints). +#define AT91C_UDP_RX_DATA_BK1 (0x1 << 6) // (UDP) Receive Data Bank 1 (only used by endpoints with ping-pong attributes). +#define AT91C_UDP_DIR (0x1 << 7) // (UDP) Transfer Direction +#define AT91C_UDP_EPTYPE (0x7 << 8) // (UDP) Endpoint type +#define AT91C_UDP_EPTYPE_CTRL (0x0 << 8) // (UDP) Control +#define AT91C_UDP_EPTYPE_ISO_OUT (0x1 << 8) // (UDP) Isochronous OUT +#define AT91C_UDP_EPTYPE_BULK_OUT (0x2 << 8) // (UDP) Bulk OUT +#define AT91C_UDP_EPTYPE_INT_OUT (0x3 << 8) // (UDP) Interrupt OUT +#define AT91C_UDP_EPTYPE_ISO_IN (0x5 << 8) // (UDP) Isochronous IN +#define AT91C_UDP_EPTYPE_BULK_IN (0x6 << 8) // (UDP) Bulk IN +#define AT91C_UDP_EPTYPE_INT_IN (0x7 << 8) // (UDP) Interrupt IN +#define AT91C_UDP_DTGLE (0x1 << 11) // (UDP) Data Toggle +#define AT91C_UDP_EPEDS (0x1 << 15) // (UDP) Endpoint Enable Disable +#define AT91C_UDP_RXBYTECNT (0x7FF << 16) // (UDP) Number Of Bytes Available in the FIFO +// -------- UDP_TXVC : (UDP Offset: 0x74) Transceiver Control Register -------- +#define AT91C_UDP_TXVDIS (0x1 << 8) // (UDP) +#define AT91C_UDP_PUON (0x1 << 9) // (UDP) Pull-up ON + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Timer Counter Channel Interface +// ***************************************************************************** +// *** Register offset in AT91S_TC structure *** +#define TC_CCR ( 0) // Channel Control Register +#define TC_CMR ( 4) // Channel Mode Register (Capture Mode / Waveform Mode) +#define TC_CV (16) // Counter Value +#define TC_RA (20) // Register A +#define TC_RB (24) // Register B +#define TC_RC (28) // Register C +#define TC_SR (32) // Status Register +#define TC_IER (36) // Interrupt Enable Register +#define TC_IDR (40) // Interrupt Disable Register +#define TC_IMR (44) // Interrupt Mask Register +// -------- TC_CCR : (TC Offset: 0x0) TC Channel Control Register -------- +#define AT91C_TC_CLKEN (0x1 << 0) // (TC) Counter Clock Enable Command +#define AT91C_TC_CLKDIS (0x1 << 1) // (TC) Counter Clock Disable Command +#define AT91C_TC_SWTRG (0x1 << 2) // (TC) Software Trigger Command +// -------- TC_CMR : (TC Offset: 0x4) TC Channel Mode Register: Capture Mode / Waveform Mode -------- +#define AT91C_TC_CLKS (0x7 << 0) // (TC) Clock Selection +#define AT91C_TC_CLKS_TIMER_DIV1_CLOCK (0x0) // (TC) Clock selected: TIMER_DIV1_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV2_CLOCK (0x1) // (TC) Clock selected: TIMER_DIV2_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV3_CLOCK (0x2) // (TC) Clock selected: TIMER_DIV3_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV4_CLOCK (0x3) // (TC) Clock selected: TIMER_DIV4_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV5_CLOCK (0x4) // (TC) Clock selected: TIMER_DIV5_CLOCK +#define AT91C_TC_CLKS_XC0 (0x5) // (TC) Clock selected: XC0 +#define AT91C_TC_CLKS_XC1 (0x6) // (TC) Clock selected: XC1 +#define AT91C_TC_CLKS_XC2 (0x7) // (TC) Clock selected: XC2 +#define AT91C_TC_CLKI (0x1 << 3) // (TC) Clock Invert +#define AT91C_TC_BURST (0x3 << 4) // (TC) Burst Signal Selection +#define AT91C_TC_BURST_NONE (0x0 << 4) // (TC) The clock is not gated by an external signal +#define AT91C_TC_BURST_XC0 (0x1 << 4) // (TC) XC0 is ANDed with the selected clock +#define AT91C_TC_BURST_XC1 (0x2 << 4) // (TC) XC1 is ANDed with the selected clock +#define AT91C_TC_BURST_XC2 (0x3 << 4) // (TC) XC2 is ANDed with the selected clock +#define AT91C_TC_CPCSTOP (0x1 << 6) // (TC) Counter Clock Stopped with RC Compare +#define AT91C_TC_LDBSTOP (0x1 << 6) // (TC) Counter Clock Stopped with RB Loading +#define AT91C_TC_LDBDIS (0x1 << 7) // (TC) Counter Clock Disabled with RB Loading +#define AT91C_TC_CPCDIS (0x1 << 7) // (TC) Counter Clock Disable with RC Compare +#define AT91C_TC_ETRGEDG (0x3 << 8) // (TC) External Trigger Edge Selection +#define AT91C_TC_ETRGEDG_NONE (0x0 << 8) // (TC) Edge: None +#define AT91C_TC_ETRGEDG_RISING (0x1 << 8) // (TC) Edge: rising edge +#define AT91C_TC_ETRGEDG_FALLING (0x2 << 8) // (TC) Edge: falling edge +#define AT91C_TC_ETRGEDG_BOTH (0x3 << 8) // (TC) Edge: each edge +#define AT91C_TC_EEVTEDG (0x3 << 8) // (TC) External Event Edge Selection +#define AT91C_TC_EEVTEDG_NONE (0x0 << 8) // (TC) Edge: None +#define AT91C_TC_EEVTEDG_RISING (0x1 << 8) // (TC) Edge: rising edge +#define AT91C_TC_EEVTEDG_FALLING (0x2 << 8) // (TC) Edge: falling edge +#define AT91C_TC_EEVTEDG_BOTH (0x3 << 8) // (TC) Edge: each edge +#define AT91C_TC_ABETRG (0x1 << 10) // (TC) TIOA or TIOB External Trigger Selection +#define AT91C_TC_EEVT (0x3 << 10) // (TC) External Event Selection +#define AT91C_TC_EEVT_TIOB (0x0 << 10) // (TC) Signal selected as external event: TIOB TIOB direction: input +#define AT91C_TC_EEVT_XC0 (0x1 << 10) // (TC) Signal selected as external event: XC0 TIOB direction: output +#define AT91C_TC_EEVT_XC1 (0x2 << 10) // (TC) Signal selected as external event: XC1 TIOB direction: output +#define AT91C_TC_EEVT_XC2 (0x3 << 10) // (TC) Signal selected as external event: XC2 TIOB direction: output +#define AT91C_TC_ENETRG (0x1 << 12) // (TC) External Event Trigger enable +#define AT91C_TC_WAVESEL (0x3 << 13) // (TC) Waveform Selection +#define AT91C_TC_WAVESEL_UP (0x0 << 13) // (TC) UP mode without atomatic trigger on RC Compare +#define AT91C_TC_WAVESEL_UPDOWN (0x1 << 13) // (TC) UPDOWN mode without automatic trigger on RC Compare +#define AT91C_TC_WAVESEL_UP_AUTO (0x2 << 13) // (TC) UP mode with automatic trigger on RC Compare +#define AT91C_TC_WAVESEL_UPDOWN_AUTO (0x3 << 13) // (TC) UPDOWN mode with automatic trigger on RC Compare +#define AT91C_TC_CPCTRG (0x1 << 14) // (TC) RC Compare Trigger Enable +#define AT91C_TC_WAVE (0x1 << 15) // (TC) +#define AT91C_TC_LDRA (0x3 << 16) // (TC) RA Loading Selection +#define AT91C_TC_LDRA_NONE (0x0 << 16) // (TC) Edge: None +#define AT91C_TC_LDRA_RISING (0x1 << 16) // (TC) Edge: rising edge of TIOA +#define AT91C_TC_LDRA_FALLING (0x2 << 16) // (TC) Edge: falling edge of TIOA +#define AT91C_TC_LDRA_BOTH (0x3 << 16) // (TC) Edge: each edge of TIOA +#define AT91C_TC_ACPA (0x3 << 16) // (TC) RA Compare Effect on TIOA +#define AT91C_TC_ACPA_NONE (0x0 << 16) // (TC) Effect: none +#define AT91C_TC_ACPA_SET (0x1 << 16) // (TC) Effect: set +#define AT91C_TC_ACPA_CLEAR (0x2 << 16) // (TC) Effect: clear +#define AT91C_TC_ACPA_TOGGLE (0x3 << 16) // (TC) Effect: toggle +#define AT91C_TC_LDRB (0x3 << 18) // (TC) RB Loading Selection +#define AT91C_TC_LDRB_NONE (0x0 << 18) // (TC) Edge: None +#define AT91C_TC_LDRB_RISING (0x1 << 18) // (TC) Edge: rising edge of TIOA +#define AT91C_TC_LDRB_FALLING (0x2 << 18) // (TC) Edge: falling edge of TIOA +#define AT91C_TC_LDRB_BOTH (0x3 << 18) // (TC) Edge: each edge of TIOA +#define AT91C_TC_ACPC (0x3 << 18) // (TC) RC Compare Effect on TIOA +#define AT91C_TC_ACPC_NONE (0x0 << 18) // (TC) Effect: none +#define AT91C_TC_ACPC_SET (0x1 << 18) // (TC) Effect: set +#define AT91C_TC_ACPC_CLEAR (0x2 << 18) // (TC) Effect: clear +#define AT91C_TC_ACPC_TOGGLE (0x3 << 18) // (TC) Effect: toggle +#define AT91C_TC_AEEVT (0x3 << 20) // (TC) External Event Effect on TIOA +#define AT91C_TC_AEEVT_NONE (0x0 << 20) // (TC) Effect: none +#define AT91C_TC_AEEVT_SET (0x1 << 20) // (TC) Effect: set +#define AT91C_TC_AEEVT_CLEAR (0x2 << 20) // (TC) Effect: clear +#define AT91C_TC_AEEVT_TOGGLE (0x3 << 20) // (TC) Effect: toggle +#define AT91C_TC_ASWTRG (0x3 << 22) // (TC) Software Trigger Effect on TIOA +#define AT91C_TC_ASWTRG_NONE (0x0 << 22) // (TC) Effect: none +#define AT91C_TC_ASWTRG_SET (0x1 << 22) // (TC) Effect: set +#define AT91C_TC_ASWTRG_CLEAR (0x2 << 22) // (TC) Effect: clear +#define AT91C_TC_ASWTRG_TOGGLE (0x3 << 22) // (TC) Effect: toggle +#define AT91C_TC_BCPB (0x3 << 24) // (TC) RB Compare Effect on TIOB +#define AT91C_TC_BCPB_NONE (0x0 << 24) // (TC) Effect: none +#define AT91C_TC_BCPB_SET (0x1 << 24) // (TC) Effect: set +#define AT91C_TC_BCPB_CLEAR (0x2 << 24) // (TC) Effect: clear +#define AT91C_TC_BCPB_TOGGLE (0x3 << 24) // (TC) Effect: toggle +#define AT91C_TC_BCPC (0x3 << 26) // (TC) RC Compare Effect on TIOB +#define AT91C_TC_BCPC_NONE (0x0 << 26) // (TC) Effect: none +#define AT91C_TC_BCPC_SET (0x1 << 26) // (TC) Effect: set +#define AT91C_TC_BCPC_CLEAR (0x2 << 26) // (TC) Effect: clear +#define AT91C_TC_BCPC_TOGGLE (0x3 << 26) // (TC) Effect: toggle +#define AT91C_TC_BEEVT (0x3 << 28) // (TC) External Event Effect on TIOB +#define AT91C_TC_BEEVT_NONE (0x0 << 28) // (TC) Effect: none +#define AT91C_TC_BEEVT_SET (0x1 << 28) // (TC) Effect: set +#define AT91C_TC_BEEVT_CLEAR (0x2 << 28) // (TC) Effect: clear +#define AT91C_TC_BEEVT_TOGGLE (0x3 << 28) // (TC) Effect: toggle +#define AT91C_TC_BSWTRG (0x3 << 30) // (TC) Software Trigger Effect on TIOB +#define AT91C_TC_BSWTRG_NONE (0x0 << 30) // (TC) Effect: none +#define AT91C_TC_BSWTRG_SET (0x1 << 30) // (TC) Effect: set +#define AT91C_TC_BSWTRG_CLEAR (0x2 << 30) // (TC) Effect: clear +#define AT91C_TC_BSWTRG_TOGGLE (0x3 << 30) // (TC) Effect: toggle +// -------- TC_SR : (TC Offset: 0x20) TC Channel Status Register -------- +#define AT91C_TC_COVFS (0x1 << 0) // (TC) Counter Overflow +#define AT91C_TC_LOVRS (0x1 << 1) // (TC) Load Overrun +#define AT91C_TC_CPAS (0x1 << 2) // (TC) RA Compare +#define AT91C_TC_CPBS (0x1 << 3) // (TC) RB Compare +#define AT91C_TC_CPCS (0x1 << 4) // (TC) RC Compare +#define AT91C_TC_LDRAS (0x1 << 5) // (TC) RA Loading +#define AT91C_TC_LDRBS (0x1 << 6) // (TC) RB Loading +#define AT91C_TC_ETRGS (0x1 << 7) // (TC) External Trigger +#define AT91C_TC_CLKSTA (0x1 << 16) // (TC) Clock Enabling +#define AT91C_TC_MTIOA (0x1 << 17) // (TC) TIOA Mirror +#define AT91C_TC_MTIOB (0x1 << 18) // (TC) TIOA Mirror +// -------- TC_IER : (TC Offset: 0x24) TC Channel Interrupt Enable Register -------- +// -------- TC_IDR : (TC Offset: 0x28) TC Channel Interrupt Disable Register -------- +// -------- TC_IMR : (TC Offset: 0x2c) TC Channel Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Timer Counter Interface +// ***************************************************************************** +// *** Register offset in AT91S_TCB structure *** +#define TCB_TC0 ( 0) // TC Channel 0 +#define TCB_TC1 (64) // TC Channel 1 +#define TCB_TC2 (128) // TC Channel 2 +#define TCB_BCR (192) // TC Block Control Register +#define TCB_BMR (196) // TC Block Mode Register +// -------- TCB_BCR : (TCB Offset: 0xc0) TC Block Control Register -------- +#define AT91C_TCB_SYNC (0x1 << 0) // (TCB) Synchro Command +// -------- TCB_BMR : (TCB Offset: 0xc4) TC Block Mode Register -------- +#define AT91C_TCB_TC0XC0S (0x3 << 0) // (TCB) External Clock Signal 0 Selection +#define AT91C_TCB_TC0XC0S_TCLK0 (0x0) // (TCB) TCLK0 connected to XC0 +#define AT91C_TCB_TC0XC0S_NONE (0x1) // (TCB) None signal connected to XC0 +#define AT91C_TCB_TC0XC0S_TIOA1 (0x2) // (TCB) TIOA1 connected to XC0 +#define AT91C_TCB_TC0XC0S_TIOA2 (0x3) // (TCB) TIOA2 connected to XC0 +#define AT91C_TCB_TC1XC1S (0x3 << 2) // (TCB) External Clock Signal 1 Selection +#define AT91C_TCB_TC1XC1S_TCLK1 (0x0 << 2) // (TCB) TCLK1 connected to XC1 +#define AT91C_TCB_TC1XC1S_NONE (0x1 << 2) // (TCB) None signal connected to XC1 +#define AT91C_TCB_TC1XC1S_TIOA0 (0x2 << 2) // (TCB) TIOA0 connected to XC1 +#define AT91C_TCB_TC1XC1S_TIOA2 (0x3 << 2) // (TCB) TIOA2 connected to XC1 +#define AT91C_TCB_TC2XC2S (0x3 << 4) // (TCB) External Clock Signal 2 Selection +#define AT91C_TCB_TC2XC2S_TCLK2 (0x0 << 4) // (TCB) TCLK2 connected to XC2 +#define AT91C_TCB_TC2XC2S_NONE (0x1 << 4) // (TCB) None signal connected to XC2 +#define AT91C_TCB_TC2XC2S_TIOA0 (0x2 << 4) // (TCB) TIOA0 connected to XC2 +#define AT91C_TCB_TC2XC2S_TIOA1 (0x3 << 4) // (TCB) TIOA2 connected to XC2 + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Control Area Network MailBox Interface +// ***************************************************************************** +// *** Register offset in AT91S_CAN_MB structure *** +#define CAN_MB_MMR ( 0) // MailBox Mode Register +#define CAN_MB_MAM ( 4) // MailBox Acceptance Mask Register +#define CAN_MB_MID ( 8) // MailBox ID Register +#define CAN_MB_MFID (12) // MailBox Family ID Register +#define CAN_MB_MSR (16) // MailBox Status Register +#define CAN_MB_MDL (20) // MailBox Data Low Register +#define CAN_MB_MDH (24) // MailBox Data High Register +#define CAN_MB_MCR (28) // MailBox Control Register +// -------- CAN_MMR : (CAN_MB Offset: 0x0) CAN Message Mode Register -------- +#define AT91C_CAN_MTIMEMARK (0xFFFF << 0) // (CAN_MB) Mailbox Timemark +#define AT91C_CAN_PRIOR (0xF << 16) // (CAN_MB) Mailbox Priority +#define AT91C_CAN_MOT (0x7 << 24) // (CAN_MB) Mailbox Object Type +#define AT91C_CAN_MOT_DIS (0x0 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_RX (0x1 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_RXOVERWRITE (0x2 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_TX (0x3 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_CONSUMER (0x4 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_PRODUCER (0x5 << 24) // (CAN_MB) +// -------- CAN_MAM : (CAN_MB Offset: 0x4) CAN Message Acceptance Mask Register -------- +#define AT91C_CAN_MIDvB (0x3FFFF << 0) // (CAN_MB) Complementary bits for identifier in extended mode +#define AT91C_CAN_MIDvA (0x7FF << 18) // (CAN_MB) Identifier for standard frame mode +#define AT91C_CAN_MIDE (0x1 << 29) // (CAN_MB) Identifier Version +// -------- CAN_MID : (CAN_MB Offset: 0x8) CAN Message ID Register -------- +// -------- CAN_MFID : (CAN_MB Offset: 0xc) CAN Message Family ID Register -------- +// -------- CAN_MSR : (CAN_MB Offset: 0x10) CAN Message Status Register -------- +#define AT91C_CAN_MTIMESTAMP (0xFFFF << 0) // (CAN_MB) Timer Value +#define AT91C_CAN_MDLC (0xF << 16) // (CAN_MB) Mailbox Data Length Code +#define AT91C_CAN_MRTR (0x1 << 20) // (CAN_MB) Mailbox Remote Transmission Request +#define AT91C_CAN_MABT (0x1 << 22) // (CAN_MB) Mailbox Message Abort +#define AT91C_CAN_MRDY (0x1 << 23) // (CAN_MB) Mailbox Ready +#define AT91C_CAN_MMI (0x1 << 24) // (CAN_MB) Mailbox Message Ignored +// -------- CAN_MDL : (CAN_MB Offset: 0x14) CAN Message Data Low Register -------- +// -------- CAN_MDH : (CAN_MB Offset: 0x18) CAN Message Data High Register -------- +// -------- CAN_MCR : (CAN_MB Offset: 0x1c) CAN Message Control Register -------- +#define AT91C_CAN_MACR (0x1 << 22) // (CAN_MB) Abort Request for Mailbox +#define AT91C_CAN_MTCR (0x1 << 23) // (CAN_MB) Mailbox Transfer Command + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Control Area Network Interface +// ***************************************************************************** +// *** Register offset in AT91S_CAN structure *** +#define CAN_MR ( 0) // Mode Register +#define CAN_IER ( 4) // Interrupt Enable Register +#define CAN_IDR ( 8) // Interrupt Disable Register +#define CAN_IMR (12) // Interrupt Mask Register +#define CAN_SR (16) // Status Register +#define CAN_BR (20) // Baudrate Register +#define CAN_TIM (24) // Timer Register +#define CAN_TIMESTP (28) // Time Stamp Register +#define CAN_ECR (32) // Error Counter Register +#define CAN_TCR (36) // Transfer Command Register +#define CAN_ACR (40) // Abort Command Register +#define CAN_VR (252) // Version Register +#define CAN_MB0 (512) // CAN Mailbox 0 +#define CAN_MB1 (544) // CAN Mailbox 1 +#define CAN_MB2 (576) // CAN Mailbox 2 +#define CAN_MB3 (608) // CAN Mailbox 3 +#define CAN_MB4 (640) // CAN Mailbox 4 +#define CAN_MB5 (672) // CAN Mailbox 5 +#define CAN_MB6 (704) // CAN Mailbox 6 +#define CAN_MB7 (736) // CAN Mailbox 7 +#define CAN_MB8 (768) // CAN Mailbox 8 +#define CAN_MB9 (800) // CAN Mailbox 9 +#define CAN_MB10 (832) // CAN Mailbox 10 +#define CAN_MB11 (864) // CAN Mailbox 11 +#define CAN_MB12 (896) // CAN Mailbox 12 +#define CAN_MB13 (928) // CAN Mailbox 13 +#define CAN_MB14 (960) // CAN Mailbox 14 +#define CAN_MB15 (992) // CAN Mailbox 15 +// -------- CAN_MR : (CAN Offset: 0x0) CAN Mode Register -------- +#define AT91C_CAN_CANEN (0x1 << 0) // (CAN) CAN Controller Enable +#define AT91C_CAN_LPM (0x1 << 1) // (CAN) Disable/Enable Low Power Mode +#define AT91C_CAN_ABM (0x1 << 2) // (CAN) Disable/Enable Autobaud/Listen Mode +#define AT91C_CAN_OVL (0x1 << 3) // (CAN) Disable/Enable Overload Frame +#define AT91C_CAN_TEOF (0x1 << 4) // (CAN) Time Stamp messages at each end of Frame +#define AT91C_CAN_TTM (0x1 << 5) // (CAN) Disable/Enable Time Trigger Mode +#define AT91C_CAN_TIMFRZ (0x1 << 6) // (CAN) Enable Timer Freeze +#define AT91C_CAN_DRPT (0x1 << 7) // (CAN) Disable Repeat +// -------- CAN_IER : (CAN Offset: 0x4) CAN Interrupt Enable Register -------- +#define AT91C_CAN_MB0 (0x1 << 0) // (CAN) Mailbox 0 Flag +#define AT91C_CAN_MB1 (0x1 << 1) // (CAN) Mailbox 1 Flag +#define AT91C_CAN_MB2 (0x1 << 2) // (CAN) Mailbox 2 Flag +#define AT91C_CAN_MB3 (0x1 << 3) // (CAN) Mailbox 3 Flag +#define AT91C_CAN_MB4 (0x1 << 4) // (CAN) Mailbox 4 Flag +#define AT91C_CAN_MB5 (0x1 << 5) // (CAN) Mailbox 5 Flag +#define AT91C_CAN_MB6 (0x1 << 6) // (CAN) Mailbox 6 Flag +#define AT91C_CAN_MB7 (0x1 << 7) // (CAN) Mailbox 7 Flag +#define AT91C_CAN_MB8 (0x1 << 8) // (CAN) Mailbox 8 Flag +#define AT91C_CAN_MB9 (0x1 << 9) // (CAN) Mailbox 9 Flag +#define AT91C_CAN_MB10 (0x1 << 10) // (CAN) Mailbox 10 Flag +#define AT91C_CAN_MB11 (0x1 << 11) // (CAN) Mailbox 11 Flag +#define AT91C_CAN_MB12 (0x1 << 12) // (CAN) Mailbox 12 Flag +#define AT91C_CAN_MB13 (0x1 << 13) // (CAN) Mailbox 13 Flag +#define AT91C_CAN_MB14 (0x1 << 14) // (CAN) Mailbox 14 Flag +#define AT91C_CAN_MB15 (0x1 << 15) // (CAN) Mailbox 15 Flag +#define AT91C_CAN_ERRA (0x1 << 16) // (CAN) Error Active Mode Flag +#define AT91C_CAN_WARN (0x1 << 17) // (CAN) Warning Limit Flag +#define AT91C_CAN_ERRP (0x1 << 18) // (CAN) Error Passive Mode Flag +#define AT91C_CAN_BOFF (0x1 << 19) // (CAN) Bus Off Mode Flag +#define AT91C_CAN_SLEEP (0x1 << 20) // (CAN) Sleep Flag +#define AT91C_CAN_WAKEUP (0x1 << 21) // (CAN) Wakeup Flag +#define AT91C_CAN_TOVF (0x1 << 22) // (CAN) Timer Overflow Flag +#define AT91C_CAN_TSTP (0x1 << 23) // (CAN) Timestamp Flag +#define AT91C_CAN_CERR (0x1 << 24) // (CAN) CRC Error +#define AT91C_CAN_SERR (0x1 << 25) // (CAN) Stuffing Error +#define AT91C_CAN_AERR (0x1 << 26) // (CAN) Acknowledgment Error +#define AT91C_CAN_FERR (0x1 << 27) // (CAN) Form Error +#define AT91C_CAN_BERR (0x1 << 28) // (CAN) Bit Error +// -------- CAN_IDR : (CAN Offset: 0x8) CAN Interrupt Disable Register -------- +// -------- CAN_IMR : (CAN Offset: 0xc) CAN Interrupt Mask Register -------- +// -------- CAN_SR : (CAN Offset: 0x10) CAN Status Register -------- +#define AT91C_CAN_RBSY (0x1 << 29) // (CAN) Receiver Busy +#define AT91C_CAN_TBSY (0x1 << 30) // (CAN) Transmitter Busy +#define AT91C_CAN_OVLY (0x1 << 31) // (CAN) Overload Busy +// -------- CAN_BR : (CAN Offset: 0x14) CAN Baudrate Register -------- +#define AT91C_CAN_PHASE2 (0x7 << 0) // (CAN) Phase 2 segment +#define AT91C_CAN_PHASE1 (0x7 << 4) // (CAN) Phase 1 segment +#define AT91C_CAN_PROPAG (0x7 << 8) // (CAN) Programmation time segment +#define AT91C_CAN_SYNC (0x3 << 12) // (CAN) Re-synchronization jump width segment +#define AT91C_CAN_BRP (0x7F << 16) // (CAN) Baudrate Prescaler +#define AT91C_CAN_SMP (0x1 << 24) // (CAN) Sampling mode +// -------- CAN_TIM : (CAN Offset: 0x18) CAN Timer Register -------- +#define AT91C_CAN_TIMER (0xFFFF << 0) // (CAN) Timer field +// -------- CAN_TIMESTP : (CAN Offset: 0x1c) CAN Timestamp Register -------- +// -------- CAN_ECR : (CAN Offset: 0x20) CAN Error Counter Register -------- +#define AT91C_CAN_REC (0xFF << 0) // (CAN) Receive Error Counter +#define AT91C_CAN_TEC (0xFF << 16) // (CAN) Transmit Error Counter +// -------- CAN_TCR : (CAN Offset: 0x24) CAN Transfer Command Register -------- +#define AT91C_CAN_TIMRST (0x1 << 31) // (CAN) Timer Reset Field +// -------- CAN_ACR : (CAN Offset: 0x28) CAN Abort Command Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Ethernet MAC 10/100 +// ***************************************************************************** +// *** Register offset in AT91S_EMAC structure *** +#define EMAC_NCR ( 0) // Network Control Register +#define EMAC_NCFGR ( 4) // Network Configuration Register +#define EMAC_NSR ( 8) // Network Status Register +#define EMAC_TSR (20) // Transmit Status Register +#define EMAC_RBQP (24) // Receive Buffer Queue Pointer +#define EMAC_TBQP (28) // Transmit Buffer Queue Pointer +#define EMAC_RSR (32) // Receive Status Register +#define EMAC_ISR (36) // Interrupt Status Register +#define EMAC_IER (40) // Interrupt Enable Register +#define EMAC_IDR (44) // Interrupt Disable Register +#define EMAC_IMR (48) // Interrupt Mask Register +#define EMAC_MAN (52) // PHY Maintenance Register +#define EMAC_PTR (56) // Pause Time Register +#define EMAC_PFR (60) // Pause Frames received Register +#define EMAC_FTO (64) // Frames Transmitted OK Register +#define EMAC_SCF (68) // Single Collision Frame Register +#define EMAC_MCF (72) // Multiple Collision Frame Register +#define EMAC_FRO (76) // Frames Received OK Register +#define EMAC_FCSE (80) // Frame Check Sequence Error Register +#define EMAC_ALE (84) // Alignment Error Register +#define EMAC_DTF (88) // Deferred Transmission Frame Register +#define EMAC_LCOL (92) // Late Collision Register +#define EMAC_ECOL (96) // Excessive Collision Register +#define EMAC_TUND (100) // Transmit Underrun Error Register +#define EMAC_CSE (104) // Carrier Sense Error Register +#define EMAC_RRE (108) // Receive Ressource Error Register +#define EMAC_ROV (112) // Receive Overrun Errors Register +#define EMAC_RSE (116) // Receive Symbol Errors Register +#define EMAC_ELE (120) // Excessive Length Errors Register +#define EMAC_RJA (124) // Receive Jabbers Register +#define EMAC_USF (128) // Undersize Frames Register +#define EMAC_STE (132) // SQE Test Error Register +#define EMAC_RLE (136) // Receive Length Field Mismatch Register +#define EMAC_TPF (140) // Transmitted Pause Frames Register +#define EMAC_HRB (144) // Hash Address Bottom[31:0] +#define EMAC_HRT (148) // Hash Address Top[63:32] +#define EMAC_SA1L (152) // Specific Address 1 Bottom, First 4 bytes +#define EMAC_SA1H (156) // Specific Address 1 Top, Last 2 bytes +#define EMAC_SA2L (160) // Specific Address 2 Bottom, First 4 bytes +#define EMAC_SA2H (164) // Specific Address 2 Top, Last 2 bytes +#define EMAC_SA3L (168) // Specific Address 3 Bottom, First 4 bytes +#define EMAC_SA3H (172) // Specific Address 3 Top, Last 2 bytes +#define EMAC_SA4L (176) // Specific Address 4 Bottom, First 4 bytes +#define EMAC_SA4H (180) // Specific Address 4 Top, Last 2 bytes +#define EMAC_TID (184) // Type ID Checking Register +#define EMAC_TPQ (188) // Transmit Pause Quantum Register +#define EMAC_USRIO (192) // USER Input/Output Register +#define EMAC_WOL (196) // Wake On LAN Register +#define EMAC_REV (252) // Revision Register +// -------- EMAC_NCR : (EMAC Offset: 0x0) -------- +#define AT91C_EMAC_LB (0x1 << 0) // (EMAC) Loopback. Optional. When set, loopback signal is at high level. +#define AT91C_EMAC_LLB (0x1 << 1) // (EMAC) Loopback local. +#define AT91C_EMAC_RE (0x1 << 2) // (EMAC) Receive enable. +#define AT91C_EMAC_TE (0x1 << 3) // (EMAC) Transmit enable. +#define AT91C_EMAC_MPE (0x1 << 4) // (EMAC) Management port enable. +#define AT91C_EMAC_CLRSTAT (0x1 << 5) // (EMAC) Clear statistics registers. +#define AT91C_EMAC_INCSTAT (0x1 << 6) // (EMAC) Increment statistics registers. +#define AT91C_EMAC_WESTAT (0x1 << 7) // (EMAC) Write enable for statistics registers. +#define AT91C_EMAC_BP (0x1 << 8) // (EMAC) Back pressure. +#define AT91C_EMAC_TSTART (0x1 << 9) // (EMAC) Start Transmission. +#define AT91C_EMAC_THALT (0x1 << 10) // (EMAC) Transmission Halt. +#define AT91C_EMAC_TPFR (0x1 << 11) // (EMAC) Transmit pause frame +#define AT91C_EMAC_TZQ (0x1 << 12) // (EMAC) Transmit zero quantum pause frame +// -------- EMAC_NCFGR : (EMAC Offset: 0x4) Network Configuration Register -------- +#define AT91C_EMAC_SPD (0x1 << 0) // (EMAC) Speed. +#define AT91C_EMAC_FD (0x1 << 1) // (EMAC) Full duplex. +#define AT91C_EMAC_JFRAME (0x1 << 3) // (EMAC) Jumbo Frames. +#define AT91C_EMAC_CAF (0x1 << 4) // (EMAC) Copy all frames. +#define AT91C_EMAC_NBC (0x1 << 5) // (EMAC) No broadcast. +#define AT91C_EMAC_MTI (0x1 << 6) // (EMAC) Multicast hash event enable +#define AT91C_EMAC_UNI (0x1 << 7) // (EMAC) Unicast hash enable. +#define AT91C_EMAC_BIG (0x1 << 8) // (EMAC) Receive 1522 bytes. +#define AT91C_EMAC_EAE (0x1 << 9) // (EMAC) External address match enable. +#define AT91C_EMAC_CLK (0x3 << 10) // (EMAC) +#define AT91C_EMAC_CLK_HCLK_8 (0x0 << 10) // (EMAC) HCLK divided by 8 +#define AT91C_EMAC_CLK_HCLK_16 (0x1 << 10) // (EMAC) HCLK divided by 16 +#define AT91C_EMAC_CLK_HCLK_32 (0x2 << 10) // (EMAC) HCLK divided by 32 +#define AT91C_EMAC_CLK_HCLK_64 (0x3 << 10) // (EMAC) HCLK divided by 64 +#define AT91C_EMAC_RTY (0x1 << 12) // (EMAC) +#define AT91C_EMAC_PAE (0x1 << 13) // (EMAC) +#define AT91C_EMAC_RBOF (0x3 << 14) // (EMAC) +#define AT91C_EMAC_RBOF_OFFSET_0 (0x0 << 14) // (EMAC) no offset from start of receive buffer +#define AT91C_EMAC_RBOF_OFFSET_1 (0x1 << 14) // (EMAC) one byte offset from start of receive buffer +#define AT91C_EMAC_RBOF_OFFSET_2 (0x2 << 14) // (EMAC) two bytes offset from start of receive buffer +#define AT91C_EMAC_RBOF_OFFSET_3 (0x3 << 14) // (EMAC) three bytes offset from start of receive buffer +#define AT91C_EMAC_RLCE (0x1 << 16) // (EMAC) Receive Length field Checking Enable +#define AT91C_EMAC_DRFCS (0x1 << 17) // (EMAC) Discard Receive FCS +#define AT91C_EMAC_EFRHD (0x1 << 18) // (EMAC) +#define AT91C_EMAC_IRXFCS (0x1 << 19) // (EMAC) Ignore RX FCS +// -------- EMAC_NSR : (EMAC Offset: 0x8) Network Status Register -------- +#define AT91C_EMAC_LINKR (0x1 << 0) // (EMAC) +#define AT91C_EMAC_MDIO (0x1 << 1) // (EMAC) +#define AT91C_EMAC_IDLE (0x1 << 2) // (EMAC) +// -------- EMAC_TSR : (EMAC Offset: 0x14) Transmit Status Register -------- +#define AT91C_EMAC_UBR (0x1 << 0) // (EMAC) +#define AT91C_EMAC_COL (0x1 << 1) // (EMAC) +#define AT91C_EMAC_RLES (0x1 << 2) // (EMAC) +#define AT91C_EMAC_TGO (0x1 << 3) // (EMAC) Transmit Go +#define AT91C_EMAC_BEX (0x1 << 4) // (EMAC) Buffers exhausted mid frame +#define AT91C_EMAC_COMP (0x1 << 5) // (EMAC) +#define AT91C_EMAC_UND (0x1 << 6) // (EMAC) +// -------- EMAC_RSR : (EMAC Offset: 0x20) Receive Status Register -------- +#define AT91C_EMAC_BNA (0x1 << 0) // (EMAC) +#define AT91C_EMAC_REC (0x1 << 1) // (EMAC) +#define AT91C_EMAC_OVR (0x1 << 2) // (EMAC) +// -------- EMAC_ISR : (EMAC Offset: 0x24) Interrupt Status Register -------- +#define AT91C_EMAC_MFD (0x1 << 0) // (EMAC) +#define AT91C_EMAC_RCOMP (0x1 << 1) // (EMAC) +#define AT91C_EMAC_RXUBR (0x1 << 2) // (EMAC) +#define AT91C_EMAC_TXUBR (0x1 << 3) // (EMAC) +#define AT91C_EMAC_TUNDR (0x1 << 4) // (EMAC) +#define AT91C_EMAC_RLEX (0x1 << 5) // (EMAC) +#define AT91C_EMAC_TXERR (0x1 << 6) // (EMAC) +#define AT91C_EMAC_TCOMP (0x1 << 7) // (EMAC) +#define AT91C_EMAC_LINK (0x1 << 9) // (EMAC) +#define AT91C_EMAC_ROVR (0x1 << 10) // (EMAC) +#define AT91C_EMAC_HRESP (0x1 << 11) // (EMAC) +#define AT91C_EMAC_PFRE (0x1 << 12) // (EMAC) +#define AT91C_EMAC_PTZ (0x1 << 13) // (EMAC) +// -------- EMAC_IER : (EMAC Offset: 0x28) Interrupt Enable Register -------- +// -------- EMAC_IDR : (EMAC Offset: 0x2c) Interrupt Disable Register -------- +// -------- EMAC_IMR : (EMAC Offset: 0x30) Interrupt Mask Register -------- +// -------- EMAC_MAN : (EMAC Offset: 0x34) PHY Maintenance Register -------- +#define AT91C_EMAC_DATA (0xFFFF << 0) // (EMAC) +#define AT91C_EMAC_CODE (0x3 << 16) // (EMAC) +#define AT91C_EMAC_REGA (0x1F << 18) // (EMAC) +#define AT91C_EMAC_PHYA (0x1F << 23) // (EMAC) +#define AT91C_EMAC_RW (0x3 << 28) // (EMAC) +#define AT91C_EMAC_SOF (0x3 << 30) // (EMAC) +// -------- EMAC_USRIO : (EMAC Offset: 0xc0) USER Input Output Register -------- +#define AT91C_EMAC_RMII (0x1 << 0) // (EMAC) Reduce MII +#define AT91C_EMAC_CLKEN (0x1 << 1) // (EMAC) Clock Enable +// -------- EMAC_WOL : (EMAC Offset: 0xc4) Wake On LAN Register -------- +#define AT91C_EMAC_IP (0xFFFF << 0) // (EMAC) ARP request IP address +#define AT91C_EMAC_MAG (0x1 << 16) // (EMAC) Magic packet event enable +#define AT91C_EMAC_ARP (0x1 << 17) // (EMAC) ARP request event enable +#define AT91C_EMAC_SA1 (0x1 << 18) // (EMAC) Specific address register 1 event enable +// -------- EMAC_REV : (EMAC Offset: 0xfc) Revision Register -------- +#define AT91C_EMAC_REVREF (0xFFFF << 0) // (EMAC) +#define AT91C_EMAC_PARTREF (0xFFFF << 16) // (EMAC) + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Analog to Digital Convertor +// ***************************************************************************** +// *** Register offset in AT91S_ADC structure *** +#define ADC_CR ( 0) // ADC Control Register +#define ADC_MR ( 4) // ADC Mode Register +#define ADC_CHER (16) // ADC Channel Enable Register +#define ADC_CHDR (20) // ADC Channel Disable Register +#define ADC_CHSR (24) // ADC Channel Status Register +#define ADC_SR (28) // ADC Status Register +#define ADC_LCDR (32) // ADC Last Converted Data Register +#define ADC_IER (36) // ADC Interrupt Enable Register +#define ADC_IDR (40) // ADC Interrupt Disable Register +#define ADC_IMR (44) // ADC Interrupt Mask Register +#define ADC_CDR0 (48) // ADC Channel Data Register 0 +#define ADC_CDR1 (52) // ADC Channel Data Register 1 +#define ADC_CDR2 (56) // ADC Channel Data Register 2 +#define ADC_CDR3 (60) // ADC Channel Data Register 3 +#define ADC_CDR4 (64) // ADC Channel Data Register 4 +#define ADC_CDR5 (68) // ADC Channel Data Register 5 +#define ADC_CDR6 (72) // ADC Channel Data Register 6 +#define ADC_CDR7 (76) // ADC Channel Data Register 7 +#define ADC_RPR (256) // Receive Pointer Register +#define ADC_RCR (260) // Receive Counter Register +#define ADC_TPR (264) // Transmit Pointer Register +#define ADC_TCR (268) // Transmit Counter Register +#define ADC_RNPR (272) // Receive Next Pointer Register +#define ADC_RNCR (276) // Receive Next Counter Register +#define ADC_TNPR (280) // Transmit Next Pointer Register +#define ADC_TNCR (284) // Transmit Next Counter Register +#define ADC_PTCR (288) // PDC Transfer Control Register +#define ADC_PTSR (292) // PDC Transfer Status Register +// -------- ADC_CR : (ADC Offset: 0x0) ADC Control Register -------- +#define AT91C_ADC_SWRST (0x1 << 0) // (ADC) Software Reset +#define AT91C_ADC_START (0x1 << 1) // (ADC) Start Conversion +// -------- ADC_MR : (ADC Offset: 0x4) ADC Mode Register -------- +#define AT91C_ADC_TRGEN (0x1 << 0) // (ADC) Trigger Enable +#define AT91C_ADC_TRGEN_DIS (0x0) // (ADC) Hradware triggers are disabled. Starting a conversion is only possible by software +#define AT91C_ADC_TRGEN_EN (0x1) // (ADC) Hardware trigger selected by TRGSEL field is enabled. +#define AT91C_ADC_TRGSEL (0x7 << 1) // (ADC) Trigger Selection +#define AT91C_ADC_TRGSEL_TIOA0 (0x0 << 1) // (ADC) Selected TRGSEL = TIAO0 +#define AT91C_ADC_TRGSEL_TIOA1 (0x1 << 1) // (ADC) Selected TRGSEL = TIAO1 +#define AT91C_ADC_TRGSEL_TIOA2 (0x2 << 1) // (ADC) Selected TRGSEL = TIAO2 +#define AT91C_ADC_TRGSEL_TIOA3 (0x3 << 1) // (ADC) Selected TRGSEL = TIAO3 +#define AT91C_ADC_TRGSEL_TIOA4 (0x4 << 1) // (ADC) Selected TRGSEL = TIAO4 +#define AT91C_ADC_TRGSEL_TIOA5 (0x5 << 1) // (ADC) Selected TRGSEL = TIAO5 +#define AT91C_ADC_TRGSEL_EXT (0x6 << 1) // (ADC) Selected TRGSEL = External Trigger +#define AT91C_ADC_LOWRES (0x1 << 4) // (ADC) Resolution. +#define AT91C_ADC_LOWRES_10_BIT (0x0 << 4) // (ADC) 10-bit resolution +#define AT91C_ADC_LOWRES_8_BIT (0x1 << 4) // (ADC) 8-bit resolution +#define AT91C_ADC_SLEEP (0x1 << 5) // (ADC) Sleep Mode +#define AT91C_ADC_SLEEP_NORMAL_MODE (0x0 << 5) // (ADC) Normal Mode +#define AT91C_ADC_SLEEP_MODE (0x1 << 5) // (ADC) Sleep Mode +#define AT91C_ADC_PRESCAL (0x3F << 8) // (ADC) Prescaler rate selection +#define AT91C_ADC_STARTUP (0x1F << 16) // (ADC) Startup Time +#define AT91C_ADC_SHTIM (0xF << 24) // (ADC) Sample & Hold Time +// -------- ADC_CHER : (ADC Offset: 0x10) ADC Channel Enable Register -------- +#define AT91C_ADC_CH0 (0x1 << 0) // (ADC) Channel 0 +#define AT91C_ADC_CH1 (0x1 << 1) // (ADC) Channel 1 +#define AT91C_ADC_CH2 (0x1 << 2) // (ADC) Channel 2 +#define AT91C_ADC_CH3 (0x1 << 3) // (ADC) Channel 3 +#define AT91C_ADC_CH4 (0x1 << 4) // (ADC) Channel 4 +#define AT91C_ADC_CH5 (0x1 << 5) // (ADC) Channel 5 +#define AT91C_ADC_CH6 (0x1 << 6) // (ADC) Channel 6 +#define AT91C_ADC_CH7 (0x1 << 7) // (ADC) Channel 7 +// -------- ADC_CHDR : (ADC Offset: 0x14) ADC Channel Disable Register -------- +// -------- ADC_CHSR : (ADC Offset: 0x18) ADC Channel Status Register -------- +// -------- ADC_SR : (ADC Offset: 0x1c) ADC Status Register -------- +#define AT91C_ADC_EOC0 (0x1 << 0) // (ADC) End of Conversion +#define AT91C_ADC_EOC1 (0x1 << 1) // (ADC) End of Conversion +#define AT91C_ADC_EOC2 (0x1 << 2) // (ADC) End of Conversion +#define AT91C_ADC_EOC3 (0x1 << 3) // (ADC) End of Conversion +#define AT91C_ADC_EOC4 (0x1 << 4) // (ADC) End of Conversion +#define AT91C_ADC_EOC5 (0x1 << 5) // (ADC) End of Conversion +#define AT91C_ADC_EOC6 (0x1 << 6) // (ADC) End of Conversion +#define AT91C_ADC_EOC7 (0x1 << 7) // (ADC) End of Conversion +#define AT91C_ADC_OVRE0 (0x1 << 8) // (ADC) Overrun Error +#define AT91C_ADC_OVRE1 (0x1 << 9) // (ADC) Overrun Error +#define AT91C_ADC_OVRE2 (0x1 << 10) // (ADC) Overrun Error +#define AT91C_ADC_OVRE3 (0x1 << 11) // (ADC) Overrun Error +#define AT91C_ADC_OVRE4 (0x1 << 12) // (ADC) Overrun Error +#define AT91C_ADC_OVRE5 (0x1 << 13) // (ADC) Overrun Error +#define AT91C_ADC_OVRE6 (0x1 << 14) // (ADC) Overrun Error +#define AT91C_ADC_OVRE7 (0x1 << 15) // (ADC) Overrun Error +#define AT91C_ADC_DRDY (0x1 << 16) // (ADC) Data Ready +#define AT91C_ADC_GOVRE (0x1 << 17) // (ADC) General Overrun +#define AT91C_ADC_ENDRX (0x1 << 18) // (ADC) End of Receiver Transfer +#define AT91C_ADC_RXBUFF (0x1 << 19) // (ADC) RXBUFF Interrupt +// -------- ADC_LCDR : (ADC Offset: 0x20) ADC Last Converted Data Register -------- +#define AT91C_ADC_LDATA (0x3FF << 0) // (ADC) Last Data Converted +// -------- ADC_IER : (ADC Offset: 0x24) ADC Interrupt Enable Register -------- +// -------- ADC_IDR : (ADC Offset: 0x28) ADC Interrupt Disable Register -------- +// -------- ADC_IMR : (ADC Offset: 0x2c) ADC Interrupt Mask Register -------- +// -------- ADC_CDR0 : (ADC Offset: 0x30) ADC Channel Data Register 0 -------- +#define AT91C_ADC_DATA (0x3FF << 0) // (ADC) Converted Data +// -------- ADC_CDR1 : (ADC Offset: 0x34) ADC Channel Data Register 1 -------- +// -------- ADC_CDR2 : (ADC Offset: 0x38) ADC Channel Data Register 2 -------- +// -------- ADC_CDR3 : (ADC Offset: 0x3c) ADC Channel Data Register 3 -------- +// -------- ADC_CDR4 : (ADC Offset: 0x40) ADC Channel Data Register 4 -------- +// -------- ADC_CDR5 : (ADC Offset: 0x44) ADC Channel Data Register 5 -------- +// -------- ADC_CDR6 : (ADC Offset: 0x48) ADC Channel Data Register 6 -------- +// -------- ADC_CDR7 : (ADC Offset: 0x4c) ADC Channel Data Register 7 -------- + +// ***************************************************************************** +// REGISTER ADDRESS DEFINITION FOR AT91SAM7X256 +// ***************************************************************************** +// ========== Register definition for SYS peripheral ========== +// ========== Register definition for AIC peripheral ========== +#define AT91C_AIC_ICCR (0xFFFFF128) // (AIC) Interrupt Clear Command Register +#define AT91C_AIC_IECR (0xFFFFF120) // (AIC) Interrupt Enable Command Register +#define AT91C_AIC_SMR (0xFFFFF000) // (AIC) Source Mode Register +#define AT91C_AIC_ISCR (0xFFFFF12C) // (AIC) Interrupt Set Command Register +#define AT91C_AIC_EOICR (0xFFFFF130) // (AIC) End of Interrupt Command Register +#define AT91C_AIC_DCR (0xFFFFF138) // (AIC) Debug Control Register (Protect) +#define AT91C_AIC_FFER (0xFFFFF140) // (AIC) Fast Forcing Enable Register +#define AT91C_AIC_SVR (0xFFFFF080) // (AIC) Source Vector Register +#define AT91C_AIC_SPU (0xFFFFF134) // (AIC) Spurious Vector Register +#define AT91C_AIC_FFDR (0xFFFFF144) // (AIC) Fast Forcing Disable Register +#define AT91C_AIC_FVR (0xFFFFF104) // (AIC) FIQ Vector Register +#define AT91C_AIC_FFSR (0xFFFFF148) // (AIC) Fast Forcing Status Register +#define AT91C_AIC_IMR (0xFFFFF110) // (AIC) Interrupt Mask Register +#define AT91C_AIC_ISR (0xFFFFF108) // (AIC) Interrupt Status Register +#define AT91C_AIC_IVR (0xFFFFF100) // (AIC) IRQ Vector Register +#define AT91C_AIC_IDCR (0xFFFFF124) // (AIC) Interrupt Disable Command Register +#define AT91C_AIC_CISR (0xFFFFF114) // (AIC) Core Interrupt Status Register +#define AT91C_AIC_IPR (0xFFFFF10C) // (AIC) Interrupt Pending Register +// ========== Register definition for PDC_DBGU peripheral ========== +#define AT91C_DBGU_TNCR (0xFFFFF31C) // (PDC_DBGU) Transmit Next Counter Register +#define AT91C_DBGU_RNCR (0xFFFFF314) // (PDC_DBGU) Receive Next Counter Register +#define AT91C_DBGU_PTCR (0xFFFFF320) // (PDC_DBGU) PDC Transfer Control Register +#define AT91C_DBGU_PTSR (0xFFFFF324) // (PDC_DBGU) PDC Transfer Status Register +#define AT91C_DBGU_RCR (0xFFFFF304) // (PDC_DBGU) Receive Counter Register +#define AT91C_DBGU_TCR (0xFFFFF30C) // (PDC_DBGU) Transmit Counter Register +#define AT91C_DBGU_RPR (0xFFFFF300) // (PDC_DBGU) Receive Pointer Register +#define AT91C_DBGU_TPR (0xFFFFF308) // (PDC_DBGU) Transmit Pointer Register +#define AT91C_DBGU_RNPR (0xFFFFF310) // (PDC_DBGU) Receive Next Pointer Register +#define AT91C_DBGU_TNPR (0xFFFFF318) // (PDC_DBGU) Transmit Next Pointer Register +// ========== Register definition for DBGU peripheral ========== +#define AT91C_DBGU_EXID (0xFFFFF244) // (DBGU) Chip ID Extension Register +#define AT91C_DBGU_THR (0xFFFFF21C) // (DBGU) Transmitter Holding Register +#define AT91C_DBGU_CSR (0xFFFFF214) // (DBGU) Channel Status Register +#define AT91C_DBGU_IDR (0xFFFFF20C) // (DBGU) Interrupt Disable Register +#define AT91C_DBGU_MR (0xFFFFF204) // (DBGU) Mode Register +#define AT91C_DBGU_FNTR (0xFFFFF248) // (DBGU) Force NTRST Register +#define AT91C_DBGU_CIDR (0xFFFFF240) // (DBGU) Chip ID Register +#define AT91C_DBGU_BRGR (0xFFFFF220) // (DBGU) Baud Rate Generator Register +#define AT91C_DBGU_RHR (0xFFFFF218) // (DBGU) Receiver Holding Register +#define AT91C_DBGU_IMR (0xFFFFF210) // (DBGU) Interrupt Mask Register +#define AT91C_DBGU_IER (0xFFFFF208) // (DBGU) Interrupt Enable Register +#define AT91C_DBGU_CR (0xFFFFF200) // (DBGU) Control Register +// ========== Register definition for PIOA peripheral ========== +#define AT91C_PIOA_IMR (0xFFFFF448) // (PIOA) Interrupt Mask Register +#define AT91C_PIOA_IER (0xFFFFF440) // (PIOA) Interrupt Enable Register +#define AT91C_PIOA_OWDR (0xFFFFF4A4) // (PIOA) Output Write Disable Register +#define AT91C_PIOA_ISR (0xFFFFF44C) // (PIOA) Interrupt Status Register +#define AT91C_PIOA_PPUDR (0xFFFFF460) // (PIOA) Pull-up Disable Register +#define AT91C_PIOA_MDSR (0xFFFFF458) // (PIOA) Multi-driver Status Register +#define AT91C_PIOA_MDER (0xFFFFF450) // (PIOA) Multi-driver Enable Register +#define AT91C_PIOA_PER (0xFFFFF400) // (PIOA) PIO Enable Register +#define AT91C_PIOA_PSR (0xFFFFF408) // (PIOA) PIO Status Register +#define AT91C_PIOA_OER (0xFFFFF410) // (PIOA) Output Enable Register +#define AT91C_PIOA_BSR (0xFFFFF474) // (PIOA) Select B Register +#define AT91C_PIOA_PPUER (0xFFFFF464) // (PIOA) Pull-up Enable Register +#define AT91C_PIOA_MDDR (0xFFFFF454) // (PIOA) Multi-driver Disable Register +#define AT91C_PIOA_PDR (0xFFFFF404) // (PIOA) PIO Disable Register +#define AT91C_PIOA_ODR (0xFFFFF414) // (PIOA) Output Disable Registerr +#define AT91C_PIOA_IFDR (0xFFFFF424) // (PIOA) Input Filter Disable Register +#define AT91C_PIOA_ABSR (0xFFFFF478) // (PIOA) AB Select Status Register +#define AT91C_PIOA_ASR (0xFFFFF470) // (PIOA) Select A Register +#define AT91C_PIOA_PPUSR (0xFFFFF468) // (PIOA) Pull-up Status Register +#define AT91C_PIOA_ODSR (0xFFFFF438) // (PIOA) Output Data Status Register +#define AT91C_PIOA_SODR (0xFFFFF430) // (PIOA) Set Output Data Register +#define AT91C_PIOA_IFSR (0xFFFFF428) // (PIOA) Input Filter Status Register +#define AT91C_PIOA_IFER (0xFFFFF420) // (PIOA) Input Filter Enable Register +#define AT91C_PIOA_OSR (0xFFFFF418) // (PIOA) Output Status Register +#define AT91C_PIOA_IDR (0xFFFFF444) // (PIOA) Interrupt Disable Register +#define AT91C_PIOA_PDSR (0xFFFFF43C) // (PIOA) Pin Data Status Register +#define AT91C_PIOA_CODR (0xFFFFF434) // (PIOA) Clear Output Data Register +#define AT91C_PIOA_OWSR (0xFFFFF4A8) // (PIOA) Output Write Status Register +#define AT91C_PIOA_OWER (0xFFFFF4A0) // (PIOA) Output Write Enable Register +// ========== Register definition for PIOB peripheral ========== +#define AT91C_PIOB_OWSR (0xFFFFF6A8) // (PIOB) Output Write Status Register +#define AT91C_PIOB_PPUSR (0xFFFFF668) // (PIOB) Pull-up Status Register +#define AT91C_PIOB_PPUDR (0xFFFFF660) // (PIOB) Pull-up Disable Register +#define AT91C_PIOB_MDSR (0xFFFFF658) // (PIOB) Multi-driver Status Register +#define AT91C_PIOB_MDER (0xFFFFF650) // (PIOB) Multi-driver Enable Register +#define AT91C_PIOB_IMR (0xFFFFF648) // (PIOB) Interrupt Mask Register +#define AT91C_PIOB_OSR (0xFFFFF618) // (PIOB) Output Status Register +#define AT91C_PIOB_OER (0xFFFFF610) // (PIOB) Output Enable Register +#define AT91C_PIOB_PSR (0xFFFFF608) // (PIOB) PIO Status Register +#define AT91C_PIOB_PER (0xFFFFF600) // (PIOB) PIO Enable Register +#define AT91C_PIOB_BSR (0xFFFFF674) // (PIOB) Select B Register +#define AT91C_PIOB_PPUER (0xFFFFF664) // (PIOB) Pull-up Enable Register +#define AT91C_PIOB_IFDR (0xFFFFF624) // (PIOB) Input Filter Disable Register +#define AT91C_PIOB_ODR (0xFFFFF614) // (PIOB) Output Disable Registerr +#define AT91C_PIOB_ABSR (0xFFFFF678) // (PIOB) AB Select Status Register +#define AT91C_PIOB_ASR (0xFFFFF670) // (PIOB) Select A Register +#define AT91C_PIOB_IFER (0xFFFFF620) // (PIOB) Input Filter Enable Register +#define AT91C_PIOB_IFSR (0xFFFFF628) // (PIOB) Input Filter Status Register +#define AT91C_PIOB_SODR (0xFFFFF630) // (PIOB) Set Output Data Register +#define AT91C_PIOB_ODSR (0xFFFFF638) // (PIOB) Output Data Status Register +#define AT91C_PIOB_CODR (0xFFFFF634) // (PIOB) Clear Output Data Register +#define AT91C_PIOB_PDSR (0xFFFFF63C) // (PIOB) Pin Data Status Register +#define AT91C_PIOB_OWER (0xFFFFF6A0) // (PIOB) Output Write Enable Register +#define AT91C_PIOB_IER (0xFFFFF640) // (PIOB) Interrupt Enable Register +#define AT91C_PIOB_OWDR (0xFFFFF6A4) // (PIOB) Output Write Disable Register +#define AT91C_PIOB_MDDR (0xFFFFF654) // (PIOB) Multi-driver Disable Register +#define AT91C_PIOB_ISR (0xFFFFF64C) // (PIOB) Interrupt Status Register +#define AT91C_PIOB_IDR (0xFFFFF644) // (PIOB) Interrupt Disable Register +#define AT91C_PIOB_PDR (0xFFFFF604) // (PIOB) PIO Disable Register +// ========== Register definition for CKGR peripheral ========== +#define AT91C_CKGR_PLLR (0xFFFFFC2C) // (CKGR) PLL Register +#define AT91C_CKGR_MCFR (0xFFFFFC24) // (CKGR) Main Clock Frequency Register +#define AT91C_CKGR_MOR (0xFFFFFC20) // (CKGR) Main Oscillator Register +// ========== Register definition for PMC peripheral ========== +#define AT91C_PMC_SCSR (0xFFFFFC08) // (PMC) System Clock Status Register +#define AT91C_PMC_SCER (0xFFFFFC00) // (PMC) System Clock Enable Register +#define AT91C_PMC_IMR (0xFFFFFC6C) // (PMC) Interrupt Mask Register +#define AT91C_PMC_IDR (0xFFFFFC64) // (PMC) Interrupt Disable Register +#define AT91C_PMC_PCDR (0xFFFFFC14) // (PMC) Peripheral Clock Disable Register +#define AT91C_PMC_SCDR (0xFFFFFC04) // (PMC) System Clock Disable Register +#define AT91C_PMC_SR (0xFFFFFC68) // (PMC) Status Register +#define AT91C_PMC_IER (0xFFFFFC60) // (PMC) Interrupt Enable Register +#define AT91C_PMC_MCKR (0xFFFFFC30) // (PMC) Master Clock Register +#define AT91C_PMC_MOR (0xFFFFFC20) // (PMC) Main Oscillator Register +#define AT91C_PMC_PCER (0xFFFFFC10) // (PMC) Peripheral Clock Enable Register +#define AT91C_PMC_PCSR (0xFFFFFC18) // (PMC) Peripheral Clock Status Register +#define AT91C_PMC_PLLR (0xFFFFFC2C) // (PMC) PLL Register +#define AT91C_PMC_MCFR (0xFFFFFC24) // (PMC) Main Clock Frequency Register +#define AT91C_PMC_PCKR (0xFFFFFC40) // (PMC) Programmable Clock Register +// ========== Register definition for RSTC peripheral ========== +#define AT91C_RSTC_RSR (0xFFFFFD04) // (RSTC) Reset Status Register +#define AT91C_RSTC_RMR (0xFFFFFD08) // (RSTC) Reset Mode Register +#define AT91C_RSTC_RCR (0xFFFFFD00) // (RSTC) Reset Control Register +// ========== Register definition for RTTC peripheral ========== +#define AT91C_RTTC_RTSR (0xFFFFFD2C) // (RTTC) Real-time Status Register +#define AT91C_RTTC_RTAR (0xFFFFFD24) // (RTTC) Real-time Alarm Register +#define AT91C_RTTC_RTVR (0xFFFFFD28) // (RTTC) Real-time Value Register +#define AT91C_RTTC_RTMR (0xFFFFFD20) // (RTTC) Real-time Mode Register +// ========== Register definition for PITC peripheral ========== +#define AT91C_PITC_PIIR (0xFFFFFD3C) // (PITC) Period Interval Image Register +#define AT91C_PITC_PISR (0xFFFFFD34) // (PITC) Period Interval Status Register +#define AT91C_PITC_PIVR (0xFFFFFD38) // (PITC) Period Interval Value Register +#define AT91C_PITC_PIMR (0xFFFFFD30) // (PITC) Period Interval Mode Register +// ========== Register definition for WDTC peripheral ========== +#define AT91C_WDTC_WDMR (0xFFFFFD44) // (WDTC) Watchdog Mode Register +#define AT91C_WDTC_WDSR (0xFFFFFD48) // (WDTC) Watchdog Status Register +#define AT91C_WDTC_WDCR (0xFFFFFD40) // (WDTC) Watchdog Control Register +// ========== Register definition for VREG peripheral ========== +#define AT91C_VREG_MR (0xFFFFFD60) // (VREG) Voltage Regulator Mode Register +// ========== Register definition for MC peripheral ========== +#define AT91C_MC_FCR (0xFFFFFF64) // (MC) MC Flash Command Register +#define AT91C_MC_ASR (0xFFFFFF04) // (MC) MC Abort Status Register +#define AT91C_MC_FSR (0xFFFFFF68) // (MC) MC Flash Status Register +#define AT91C_MC_FMR (0xFFFFFF60) // (MC) MC Flash Mode Register +#define AT91C_MC_AASR (0xFFFFFF08) // (MC) MC Abort Address Status Register +#define AT91C_MC_RCR (0xFFFFFF00) // (MC) MC Remap Control Register +// ========== Register definition for PDC_SPI1 peripheral ========== +#define AT91C_SPI1_RNPR (0xFFFE4110) // (PDC_SPI1) Receive Next Pointer Register +#define AT91C_SPI1_TPR (0xFFFE4108) // (PDC_SPI1) Transmit Pointer Register +#define AT91C_SPI1_RPR (0xFFFE4100) // (PDC_SPI1) Receive Pointer Register +#define AT91C_SPI1_PTSR (0xFFFE4124) // (PDC_SPI1) PDC Transfer Status Register +#define AT91C_SPI1_RCR (0xFFFE4104) // (PDC_SPI1) Receive Counter Register +#define AT91C_SPI1_TCR (0xFFFE410C) // (PDC_SPI1) Transmit Counter Register +#define AT91C_SPI1_RNCR (0xFFFE4114) // (PDC_SPI1) Receive Next Counter Register +#define AT91C_SPI1_TNCR (0xFFFE411C) // (PDC_SPI1) Transmit Next Counter Register +#define AT91C_SPI1_TNPR (0xFFFE4118) // (PDC_SPI1) Transmit Next Pointer Register +#define AT91C_SPI1_PTCR (0xFFFE4120) // (PDC_SPI1) PDC Transfer Control Register +// ========== Register definition for SPI1 peripheral ========== +#define AT91C_SPI1_CSR (0xFFFE4030) // (SPI1) Chip Select Register +#define AT91C_SPI1_IDR (0xFFFE4018) // (SPI1) Interrupt Disable Register +#define AT91C_SPI1_SR (0xFFFE4010) // (SPI1) Status Register +#define AT91C_SPI1_RDR (0xFFFE4008) // (SPI1) Receive Data Register +#define AT91C_SPI1_CR (0xFFFE4000) // (SPI1) Control Register +#define AT91C_SPI1_IMR (0xFFFE401C) // (SPI1) Interrupt Mask Register +#define AT91C_SPI1_IER (0xFFFE4014) // (SPI1) Interrupt Enable Register +#define AT91C_SPI1_TDR (0xFFFE400C) // (SPI1) Transmit Data Register +#define AT91C_SPI1_MR (0xFFFE4004) // (SPI1) Mode Register +// ========== Register definition for PDC_SPI0 peripheral ========== +#define AT91C_SPI0_PTCR (0xFFFE0120) // (PDC_SPI0) PDC Transfer Control Register +#define AT91C_SPI0_TNPR (0xFFFE0118) // (PDC_SPI0) Transmit Next Pointer Register +#define AT91C_SPI0_RNPR (0xFFFE0110) // (PDC_SPI0) Receive Next Pointer Register +#define AT91C_SPI0_TPR (0xFFFE0108) // (PDC_SPI0) Transmit Pointer Register +#define AT91C_SPI0_RPR (0xFFFE0100) // (PDC_SPI0) Receive Pointer Register +#define AT91C_SPI0_PTSR (0xFFFE0124) // (PDC_SPI0) PDC Transfer Status Register +#define AT91C_SPI0_TNCR (0xFFFE011C) // (PDC_SPI0) Transmit Next Counter Register +#define AT91C_SPI0_RNCR (0xFFFE0114) // (PDC_SPI0) Receive Next Counter Register +#define AT91C_SPI0_TCR (0xFFFE010C) // (PDC_SPI0) Transmit Counter Register +#define AT91C_SPI0_RCR (0xFFFE0104) // (PDC_SPI0) Receive Counter Register +// ========== Register definition for SPI0 peripheral ========== +#define AT91C_SPI0_CSR (0xFFFE0030) // (SPI0) Chip Select Register +#define AT91C_SPI0_IDR (0xFFFE0018) // (SPI0) Interrupt Disable Register +#define AT91C_SPI0_SR (0xFFFE0010) // (SPI0) Status Register +#define AT91C_SPI0_RDR (0xFFFE0008) // (SPI0) Receive Data Register +#define AT91C_SPI0_CR (0xFFFE0000) // (SPI0) Control Register +#define AT91C_SPI0_IMR (0xFFFE001C) // (SPI0) Interrupt Mask Register +#define AT91C_SPI0_IER (0xFFFE0014) // (SPI0) Interrupt Enable Register +#define AT91C_SPI0_TDR (0xFFFE000C) // (SPI0) Transmit Data Register +#define AT91C_SPI0_MR (0xFFFE0004) // (SPI0) Mode Register +// ========== Register definition for PDC_US1 peripheral ========== +#define AT91C_US1_PTSR (0xFFFC4124) // (PDC_US1) PDC Transfer Status Register +#define AT91C_US1_TNCR (0xFFFC411C) // (PDC_US1) Transmit Next Counter Register +#define AT91C_US1_RNCR (0xFFFC4114) // (PDC_US1) Receive Next Counter Register +#define AT91C_US1_TCR (0xFFFC410C) // (PDC_US1) Transmit Counter Register +#define AT91C_US1_RCR (0xFFFC4104) // (PDC_US1) Receive Counter Register +#define AT91C_US1_PTCR (0xFFFC4120) // (PDC_US1) PDC Transfer Control Register +#define AT91C_US1_TNPR (0xFFFC4118) // (PDC_US1) Transmit Next Pointer Register +#define AT91C_US1_RNPR (0xFFFC4110) // (PDC_US1) Receive Next Pointer Register +#define AT91C_US1_TPR (0xFFFC4108) // (PDC_US1) Transmit Pointer Register +#define AT91C_US1_RPR (0xFFFC4100) // (PDC_US1) Receive Pointer Register +// ========== Register definition for US1 peripheral ========== +#define AT91C_US1_RHR (0xFFFC4018) // (US1) Receiver Holding Register +#define AT91C_US1_IMR (0xFFFC4010) // (US1) Interrupt Mask Register +#define AT91C_US1_IER (0xFFFC4008) // (US1) Interrupt Enable Register +#define AT91C_US1_CR (0xFFFC4000) // (US1) Control Register +#define AT91C_US1_RTOR (0xFFFC4024) // (US1) Receiver Time-out Register +#define AT91C_US1_THR (0xFFFC401C) // (US1) Transmitter Holding Register +#define AT91C_US1_CSR (0xFFFC4014) // (US1) Channel Status Register +#define AT91C_US1_IDR (0xFFFC400C) // (US1) Interrupt Disable Register +#define AT91C_US1_FIDI (0xFFFC4040) // (US1) FI_DI_Ratio Register +#define AT91C_US1_BRGR (0xFFFC4020) // (US1) Baud Rate Generator Register +#define AT91C_US1_TTGR (0xFFFC4028) // (US1) Transmitter Time-guard Register +#define AT91C_US1_IF (0xFFFC404C) // (US1) IRDA_FILTER Register +#define AT91C_US1_NER (0xFFFC4044) // (US1) Nb Errors Register +#define AT91C_US1_MR (0xFFFC4004) // (US1) Mode Register +// ========== Register definition for PDC_US0 peripheral ========== +#define AT91C_US0_PTCR (0xFFFC0120) // (PDC_US0) PDC Transfer Control Register +#define AT91C_US0_TNPR (0xFFFC0118) // (PDC_US0) Transmit Next Pointer Register +#define AT91C_US0_RNPR (0xFFFC0110) // (PDC_US0) Receive Next Pointer Register +#define AT91C_US0_TPR (0xFFFC0108) // (PDC_US0) Transmit Pointer Register +#define AT91C_US0_RPR (0xFFFC0100) // (PDC_US0) Receive Pointer Register +#define AT91C_US0_PTSR (0xFFFC0124) // (PDC_US0) PDC Transfer Status Register +#define AT91C_US0_TNCR (0xFFFC011C) // (PDC_US0) Transmit Next Counter Register +#define AT91C_US0_RNCR (0xFFFC0114) // (PDC_US0) Receive Next Counter Register +#define AT91C_US0_TCR (0xFFFC010C) // (PDC_US0) Transmit Counter Register +#define AT91C_US0_RCR (0xFFFC0104) // (PDC_US0) Receive Counter Register +// ========== Register definition for US0 peripheral ========== +#define AT91C_US0_TTGR (0xFFFC0028) // (US0) Transmitter Time-guard Register +#define AT91C_US0_BRGR (0xFFFC0020) // (US0) Baud Rate Generator Register +#define AT91C_US0_RHR (0xFFFC0018) // (US0) Receiver Holding Register +#define AT91C_US0_IMR (0xFFFC0010) // (US0) Interrupt Mask Register +#define AT91C_US0_NER (0xFFFC0044) // (US0) Nb Errors Register +#define AT91C_US0_RTOR (0xFFFC0024) // (US0) Receiver Time-out Register +#define AT91C_US0_FIDI (0xFFFC0040) // (US0) FI_DI_Ratio Register +#define AT91C_US0_CR (0xFFFC0000) // (US0) Control Register +#define AT91C_US0_IER (0xFFFC0008) // (US0) Interrupt Enable Register +#define AT91C_US0_IF (0xFFFC004C) // (US0) IRDA_FILTER Register +#define AT91C_US0_MR (0xFFFC0004) // (US0) Mode Register +#define AT91C_US0_IDR (0xFFFC000C) // (US0) Interrupt Disable Register +#define AT91C_US0_CSR (0xFFFC0014) // (US0) Channel Status Register +#define AT91C_US0_THR (0xFFFC001C) // (US0) Transmitter Holding Register +// ========== Register definition for PDC_SSC peripheral ========== +#define AT91C_SSC_PTCR (0xFFFD4120) // (PDC_SSC) PDC Transfer Control Register +#define AT91C_SSC_TNPR (0xFFFD4118) // (PDC_SSC) Transmit Next Pointer Register +#define AT91C_SSC_RNPR (0xFFFD4110) // (PDC_SSC) Receive Next Pointer Register +#define AT91C_SSC_TPR (0xFFFD4108) // (PDC_SSC) Transmit Pointer Register +#define AT91C_SSC_RPR (0xFFFD4100) // (PDC_SSC) Receive Pointer Register +#define AT91C_SSC_PTSR (0xFFFD4124) // (PDC_SSC) PDC Transfer Status Register +#define AT91C_SSC_TNCR (0xFFFD411C) // (PDC_SSC) Transmit Next Counter Register +#define AT91C_SSC_RNCR (0xFFFD4114) // (PDC_SSC) Receive Next Counter Register +#define AT91C_SSC_TCR (0xFFFD410C) // (PDC_SSC) Transmit Counter Register +#define AT91C_SSC_RCR (0xFFFD4104) // (PDC_SSC) Receive Counter Register +// ========== Register definition for SSC peripheral ========== +#define AT91C_SSC_RFMR (0xFFFD4014) // (SSC) Receive Frame Mode Register +#define AT91C_SSC_CMR (0xFFFD4004) // (SSC) Clock Mode Register +#define AT91C_SSC_IDR (0xFFFD4048) // (SSC) Interrupt Disable Register +#define AT91C_SSC_SR (0xFFFD4040) // (SSC) Status Register +#define AT91C_SSC_RSHR (0xFFFD4030) // (SSC) Receive Sync Holding Register +#define AT91C_SSC_RHR (0xFFFD4020) // (SSC) Receive Holding Register +#define AT91C_SSC_TCMR (0xFFFD4018) // (SSC) Transmit Clock Mode Register +#define AT91C_SSC_RCMR (0xFFFD4010) // (SSC) Receive Clock ModeRegister +#define AT91C_SSC_CR (0xFFFD4000) // (SSC) Control Register +#define AT91C_SSC_IMR (0xFFFD404C) // (SSC) Interrupt Mask Register +#define AT91C_SSC_IER (0xFFFD4044) // (SSC) Interrupt Enable Register +#define AT91C_SSC_TSHR (0xFFFD4034) // (SSC) Transmit Sync Holding Register +#define AT91C_SSC_THR (0xFFFD4024) // (SSC) Transmit Holding Register +#define AT91C_SSC_TFMR (0xFFFD401C) // (SSC) Transmit Frame Mode Register +// ========== Register definition for TWI peripheral ========== +#define AT91C_TWI_RHR (0xFFFB8030) // (TWI) Receive Holding Register +#define AT91C_TWI_IDR (0xFFFB8028) // (TWI) Interrupt Disable Register +#define AT91C_TWI_SR (0xFFFB8020) // (TWI) Status Register +#define AT91C_TWI_CWGR (0xFFFB8010) // (TWI) Clock Waveform Generator Register +#define AT91C_TWI_CR (0xFFFB8000) // (TWI) Control Register +#define AT91C_TWI_THR (0xFFFB8034) // (TWI) Transmit Holding Register +#define AT91C_TWI_IMR (0xFFFB802C) // (TWI) Interrupt Mask Register +#define AT91C_TWI_IER (0xFFFB8024) // (TWI) Interrupt Enable Register +#define AT91C_TWI_IADR (0xFFFB800C) // (TWI) Internal Address Register +#define AT91C_TWI_MMR (0xFFFB8004) // (TWI) Master Mode Register +// ========== Register definition for PWMC_CH3 peripheral ========== +#define AT91C_PWMC_CH3_CUPDR (0xFFFCC270) // (PWMC_CH3) Channel Update Register +#define AT91C_PWMC_CH3_CPRDR (0xFFFCC268) // (PWMC_CH3) Channel Period Register +#define AT91C_PWMC_CH3_CMR (0xFFFCC260) // (PWMC_CH3) Channel Mode Register +#define AT91C_PWMC_CH3_Reserved (0xFFFCC274) // (PWMC_CH3) Reserved +#define AT91C_PWMC_CH3_CCNTR (0xFFFCC26C) // (PWMC_CH3) Channel Counter Register +#define AT91C_PWMC_CH3_CDTYR (0xFFFCC264) // (PWMC_CH3) Channel Duty Cycle Register +// ========== Register definition for PWMC_CH2 peripheral ========== +#define AT91C_PWMC_CH2_CUPDR (0xFFFCC250) // (PWMC_CH2) Channel Update Register +#define AT91C_PWMC_CH2_CPRDR (0xFFFCC248) // (PWMC_CH2) Channel Period Register +#define AT91C_PWMC_CH2_CMR (0xFFFCC240) // (PWMC_CH2) Channel Mode Register +#define AT91C_PWMC_CH2_Reserved (0xFFFCC254) // (PWMC_CH2) Reserved +#define AT91C_PWMC_CH2_CCNTR (0xFFFCC24C) // (PWMC_CH2) Channel Counter Register +#define AT91C_PWMC_CH2_CDTYR (0xFFFCC244) // (PWMC_CH2) Channel Duty Cycle Register +// ========== Register definition for PWMC_CH1 peripheral ========== +#define AT91C_PWMC_CH1_CUPDR (0xFFFCC230) // (PWMC_CH1) Channel Update Register +#define AT91C_PWMC_CH1_CPRDR (0xFFFCC228) // (PWMC_CH1) Channel Period Register +#define AT91C_PWMC_CH1_CMR (0xFFFCC220) // (PWMC_CH1) Channel Mode Register +#define AT91C_PWMC_CH1_Reserved (0xFFFCC234) // (PWMC_CH1) Reserved +#define AT91C_PWMC_CH1_CCNTR (0xFFFCC22C) // (PWMC_CH1) Channel Counter Register +#define AT91C_PWMC_CH1_CDTYR (0xFFFCC224) // (PWMC_CH1) Channel Duty Cycle Register +// ========== Register definition for PWMC_CH0 peripheral ========== +#define AT91C_PWMC_CH0_CUPDR (0xFFFCC210) // (PWMC_CH0) Channel Update Register +#define AT91C_PWMC_CH0_CPRDR (0xFFFCC208) // (PWMC_CH0) Channel Period Register +#define AT91C_PWMC_CH0_CMR (0xFFFCC200) // (PWMC_CH0) Channel Mode Register +#define AT91C_PWMC_CH0_Reserved (0xFFFCC214) // (PWMC_CH0) Reserved +#define AT91C_PWMC_CH0_CCNTR (0xFFFCC20C) // (PWMC_CH0) Channel Counter Register +#define AT91C_PWMC_CH0_CDTYR (0xFFFCC204) // (PWMC_CH0) Channel Duty Cycle Register +// ========== Register definition for PWMC peripheral ========== +#define AT91C_PWMC_VR (0xFFFCC0FC) // (PWMC) PWMC Version Register +#define AT91C_PWMC_ISR (0xFFFCC01C) // (PWMC) PWMC Interrupt Status Register +#define AT91C_PWMC_IDR (0xFFFCC014) // (PWMC) PWMC Interrupt Disable Register +#define AT91C_PWMC_SR (0xFFFCC00C) // (PWMC) PWMC Status Register +#define AT91C_PWMC_ENA (0xFFFCC004) // (PWMC) PWMC Enable Register +#define AT91C_PWMC_IMR (0xFFFCC018) // (PWMC) PWMC Interrupt Mask Register +#define AT91C_PWMC_MR (0xFFFCC000) // (PWMC) PWMC Mode Register +#define AT91C_PWMC_DIS (0xFFFCC008) // (PWMC) PWMC Disable Register +#define AT91C_PWMC_IER (0xFFFCC010) // (PWMC) PWMC Interrupt Enable Register +// ========== Register definition for UDP peripheral ========== +#define AT91C_UDP_TXVC (0xFFFB0074) // (UDP) Transceiver Control Register +#define AT91C_UDP_ISR (0xFFFB001C) // (UDP) Interrupt Status Register +#define AT91C_UDP_IDR (0xFFFB0014) // (UDP) Interrupt Disable Register +#define AT91C_UDP_CSR (0xFFFB0030) // (UDP) Endpoint Control and Status Register +#define AT91C_UDP_RSTEP (0xFFFB0028) // (UDP) Reset Endpoint Register +#define AT91C_UDP_ICR (0xFFFB0020) // (UDP) Interrupt Clear Register +#define AT91C_UDP_GLBSTATE (0xFFFB0004) // (UDP) Global State Register +#define AT91C_UDP_NUM (0xFFFB0000) // (UDP) Frame Number Register +#define AT91C_UDP_FADDR (0xFFFB0008) // (UDP) Function Address Register +#define AT91C_UDP_IER (0xFFFB0010) // (UDP) Interrupt Enable Register +#define AT91C_UDP_IMR (0xFFFB0018) // (UDP) Interrupt Mask Register +#define AT91C_UDP_FDR (0xFFFB0050) // (UDP) Endpoint FIFO Data Register +// ========== Register definition for TC0 peripheral ========== +#define AT91C_TC0_IMR (0xFFFA002C) // (TC0) Interrupt Mask Register +#define AT91C_TC0_IER (0xFFFA0024) // (TC0) Interrupt Enable Register +#define AT91C_TC0_RC (0xFFFA001C) // (TC0) Register C +#define AT91C_TC0_RA (0xFFFA0014) // (TC0) Register A +#define AT91C_TC0_CMR (0xFFFA0004) // (TC0) Channel Mode Register (Capture Mode / Waveform Mode) +#define AT91C_TC0_IDR (0xFFFA0028) // (TC0) Interrupt Disable Register +#define AT91C_TC0_SR (0xFFFA0020) // (TC0) Status Register +#define AT91C_TC0_RB (0xFFFA0018) // (TC0) Register B +#define AT91C_TC0_CV (0xFFFA0010) // (TC0) Counter Value +#define AT91C_TC0_CCR (0xFFFA0000) // (TC0) Channel Control Register +// ========== Register definition for TC1 peripheral ========== +#define AT91C_TC1_IMR (0xFFFA006C) // (TC1) Interrupt Mask Register +#define AT91C_TC1_IER (0xFFFA0064) // (TC1) Interrupt Enable Register +#define AT91C_TC1_RC (0xFFFA005C) // (TC1) Register C +#define AT91C_TC1_RA (0xFFFA0054) // (TC1) Register A +#define AT91C_TC1_CMR (0xFFFA0044) // (TC1) Channel Mode Register (Capture Mode / Waveform Mode) +#define AT91C_TC1_IDR (0xFFFA0068) // (TC1) Interrupt Disable Register +#define AT91C_TC1_SR (0xFFFA0060) // (TC1) Status Register +#define AT91C_TC1_RB (0xFFFA0058) // (TC1) Register B +#define AT91C_TC1_CV (0xFFFA0050) // (TC1) Counter Value +#define AT91C_TC1_CCR (0xFFFA0040) // (TC1) Channel Control Register +// ========== Register definition for TC2 peripheral ========== +#define AT91C_TC2_IMR (0xFFFA00AC) // (TC2) Interrupt Mask Register +#define AT91C_TC2_IER (0xFFFA00A4) // (TC2) Interrupt Enable Register +#define AT91C_TC2_RC (0xFFFA009C) // (TC2) Register C +#define AT91C_TC2_RA (0xFFFA0094) // (TC2) Register A +#define AT91C_TC2_CMR (0xFFFA0084) // (TC2) Channel Mode Register (Capture Mode / Waveform Mode) +#define AT91C_TC2_IDR (0xFFFA00A8) // (TC2) Interrupt Disable Register +#define AT91C_TC2_SR (0xFFFA00A0) // (TC2) Status Register +#define AT91C_TC2_RB (0xFFFA0098) // (TC2) Register B +#define AT91C_TC2_CV (0xFFFA0090) // (TC2) Counter Value +#define AT91C_TC2_CCR (0xFFFA0080) // (TC2) Channel Control Register +// ========== Register definition for TCB peripheral ========== +#define AT91C_TCB_BMR (0xFFFA00C4) // (TCB) TC Block Mode Register +#define AT91C_TCB_BCR (0xFFFA00C0) // (TCB) TC Block Control Register +// ========== Register definition for CAN_MB0 peripheral ========== +#define AT91C_CAN_MB0_MCR (0xFFFD021C) // (CAN_MB0) MailBox Control Register +#define AT91C_CAN_MB0_MDL (0xFFFD0214) // (CAN_MB0) MailBox Data Low Register +#define AT91C_CAN_MB0_MFID (0xFFFD020C) // (CAN_MB0) MailBox Family ID Register +#define AT91C_CAN_MB0_MAM (0xFFFD0204) // (CAN_MB0) MailBox Acceptance Mask Register +#define AT91C_CAN_MB0_MDH (0xFFFD0218) // (CAN_MB0) MailBox Data High Register +#define AT91C_CAN_MB0_MSR (0xFFFD0210) // (CAN_MB0) MailBox Status Register +#define AT91C_CAN_MB0_MID (0xFFFD0208) // (CAN_MB0) MailBox ID Register +#define AT91C_CAN_MB0_MMR (0xFFFD0200) // (CAN_MB0) MailBox Mode Register +// ========== Register definition for CAN_MB1 peripheral ========== +#define AT91C_CAN_MB1_MCR (0xFFFD023C) // (CAN_MB1) MailBox Control Register +#define AT91C_CAN_MB1_MDL (0xFFFD0234) // (CAN_MB1) MailBox Data Low Register +#define AT91C_CAN_MB1_MFID (0xFFFD022C) // (CAN_MB1) MailBox Family ID Register +#define AT91C_CAN_MB1_MAM (0xFFFD0224) // (CAN_MB1) MailBox Acceptance Mask Register +#define AT91C_CAN_MB1_MDH (0xFFFD0238) // (CAN_MB1) MailBox Data High Register +#define AT91C_CAN_MB1_MSR (0xFFFD0230) // (CAN_MB1) MailBox Status Register +#define AT91C_CAN_MB1_MID (0xFFFD0228) // (CAN_MB1) MailBox ID Register +#define AT91C_CAN_MB1_MMR (0xFFFD0220) // (CAN_MB1) MailBox Mode Register +// ========== Register definition for CAN_MB2 peripheral ========== +#define AT91C_CAN_MB2_MCR (0xFFFD025C) // (CAN_MB2) MailBox Control Register +#define AT91C_CAN_MB2_MDL (0xFFFD0254) // (CAN_MB2) MailBox Data Low Register +#define AT91C_CAN_MB2_MFID (0xFFFD024C) // (CAN_MB2) MailBox Family ID Register +#define AT91C_CAN_MB2_MAM (0xFFFD0244) // (CAN_MB2) MailBox Acceptance Mask Register +#define AT91C_CAN_MB2_MDH (0xFFFD0258) // (CAN_MB2) MailBox Data High Register +#define AT91C_CAN_MB2_MSR (0xFFFD0250) // (CAN_MB2) MailBox Status Register +#define AT91C_CAN_MB2_MID (0xFFFD0248) // (CAN_MB2) MailBox ID Register +#define AT91C_CAN_MB2_MMR (0xFFFD0240) // (CAN_MB2) MailBox Mode Register +// ========== Register definition for CAN_MB3 peripheral ========== +#define AT91C_CAN_MB3_MCR (0xFFFD027C) // (CAN_MB3) MailBox Control Register +#define AT91C_CAN_MB3_MDL (0xFFFD0274) // (CAN_MB3) MailBox Data Low Register +#define AT91C_CAN_MB3_MFID (0xFFFD026C) // (CAN_MB3) MailBox Family ID Register +#define AT91C_CAN_MB3_MAM (0xFFFD0264) // (CAN_MB3) MailBox Acceptance Mask Register +#define AT91C_CAN_MB3_MDH (0xFFFD0278) // (CAN_MB3) MailBox Data High Register +#define AT91C_CAN_MB3_MSR (0xFFFD0270) // (CAN_MB3) MailBox Status Register +#define AT91C_CAN_MB3_MID (0xFFFD0268) // (CAN_MB3) MailBox ID Register +#define AT91C_CAN_MB3_MMR (0xFFFD0260) // (CAN_MB3) MailBox Mode Register +// ========== Register definition for CAN_MB4 peripheral ========== +#define AT91C_CAN_MB4_MCR (0xFFFD029C) // (CAN_MB4) MailBox Control Register +#define AT91C_CAN_MB4_MDL (0xFFFD0294) // (CAN_MB4) MailBox Data Low Register +#define AT91C_CAN_MB4_MFID (0xFFFD028C) // (CAN_MB4) MailBox Family ID Register +#define AT91C_CAN_MB4_MAM (0xFFFD0284) // (CAN_MB4) MailBox Acceptance Mask Register +#define AT91C_CAN_MB4_MDH (0xFFFD0298) // (CAN_MB4) MailBox Data High Register +#define AT91C_CAN_MB4_MSR (0xFFFD0290) // (CAN_MB4) MailBox Status Register +#define AT91C_CAN_MB4_MID (0xFFFD0288) // (CAN_MB4) MailBox ID Register +#define AT91C_CAN_MB4_MMR (0xFFFD0280) // (CAN_MB4) MailBox Mode Register +// ========== Register definition for CAN_MB5 peripheral ========== +#define AT91C_CAN_MB5_MCR (0xFFFD02BC) // (CAN_MB5) MailBox Control Register +#define AT91C_CAN_MB5_MDL (0xFFFD02B4) // (CAN_MB5) MailBox Data Low Register +#define AT91C_CAN_MB5_MFID (0xFFFD02AC) // (CAN_MB5) MailBox Family ID Register +#define AT91C_CAN_MB5_MAM (0xFFFD02A4) // (CAN_MB5) MailBox Acceptance Mask Register +#define AT91C_CAN_MB5_MDH (0xFFFD02B8) // (CAN_MB5) MailBox Data High Register +#define AT91C_CAN_MB5_MSR (0xFFFD02B0) // (CAN_MB5) MailBox Status Register +#define AT91C_CAN_MB5_MID (0xFFFD02A8) // (CAN_MB5) MailBox ID Register +#define AT91C_CAN_MB5_MMR (0xFFFD02A0) // (CAN_MB5) MailBox Mode Register +// ========== Register definition for CAN_MB6 peripheral ========== +#define AT91C_CAN_MB6_MAM (0xFFFD02C4) // (CAN_MB6) MailBox Acceptance Mask Register +#define AT91C_CAN_MB6_MDH (0xFFFD02D8) // (CAN_MB6) MailBox Data High Register +#define AT91C_CAN_MB6_MSR (0xFFFD02D0) // (CAN_MB6) MailBox Status Register +#define AT91C_CAN_MB6_MID (0xFFFD02C8) // (CAN_MB6) MailBox ID Register +#define AT91C_CAN_MB6_MMR (0xFFFD02C0) // (CAN_MB6) MailBox Mode Register +#define AT91C_CAN_MB6_MCR (0xFFFD02DC) // (CAN_MB6) MailBox Control Register +#define AT91C_CAN_MB6_MDL (0xFFFD02D4) // (CAN_MB6) MailBox Data Low Register +#define AT91C_CAN_MB6_MFID (0xFFFD02CC) // (CAN_MB6) MailBox Family ID Register +// ========== Register definition for CAN_MB7 peripheral ========== +#define AT91C_CAN_MB7_MDH (0xFFFD02F8) // (CAN_MB7) MailBox Data High Register +#define AT91C_CAN_MB7_MSR (0xFFFD02F0) // (CAN_MB7) MailBox Status Register +#define AT91C_CAN_MB7_MID (0xFFFD02E8) // (CAN_MB7) MailBox ID Register +#define AT91C_CAN_MB7_MMR (0xFFFD02E0) // (CAN_MB7) MailBox Mode Register +#define AT91C_CAN_MB7_MCR (0xFFFD02FC) // (CAN_MB7) MailBox Control Register +#define AT91C_CAN_MB7_MDL (0xFFFD02F4) // (CAN_MB7) MailBox Data Low Register +#define AT91C_CAN_MB7_MFID (0xFFFD02EC) // (CAN_MB7) MailBox Family ID Register +#define AT91C_CAN_MB7_MAM (0xFFFD02E4) // (CAN_MB7) MailBox Acceptance Mask Register +// ========== Register definition for CAN peripheral ========== +#define AT91C_CAN_IMR (0xFFFD000C) // (CAN) Interrupt Mask Register +#define AT91C_CAN_IER (0xFFFD0004) // (CAN) Interrupt Enable Register +#define AT91C_CAN_ECR (0xFFFD0020) // (CAN) Error Counter Register +#define AT91C_CAN_TIM (0xFFFD0018) // (CAN) Timer Register +#define AT91C_CAN_SR (0xFFFD0010) // (CAN) Status Register +#define AT91C_CAN_IDR (0xFFFD0008) // (CAN) Interrupt Disable Register +#define AT91C_CAN_MR (0xFFFD0000) // (CAN) Mode Register +#define AT91C_CAN_BR (0xFFFD0014) // (CAN) Baudrate Register +#define AT91C_CAN_TIMESTP (0xFFFD001C) // (CAN) Time Stamp Register +#define AT91C_CAN_TCR (0xFFFD0024) // (CAN) Transfer Command Register +#define AT91C_CAN_ACR (0xFFFD0028) // (CAN) Abort Command Register +#define AT91C_CAN_VR (0xFFFD00FC) // (CAN) Version Register +// ========== Register definition for EMAC peripheral ========== +#define AT91C_EMAC_TID (0xFFFDC0B8) // (EMAC) Type ID Checking Register +#define AT91C_EMAC_SA3L (0xFFFDC0A8) // (EMAC) Specific Address 3 Bottom, First 4 bytes +#define AT91C_EMAC_STE (0xFFFDC084) // (EMAC) SQE Test Error Register +#define AT91C_EMAC_RSE (0xFFFDC074) // (EMAC) Receive Symbol Errors Register +#define AT91C_EMAC_IDR (0xFFFDC02C) // (EMAC) Interrupt Disable Register +#define AT91C_EMAC_TBQP (0xFFFDC01C) // (EMAC) Transmit Buffer Queue Pointer +#define AT91C_EMAC_TPQ (0xFFFDC0BC) // (EMAC) Transmit Pause Quantum Register +#define AT91C_EMAC_SA1L (0xFFFDC098) // (EMAC) Specific Address 1 Bottom, First 4 bytes +#define AT91C_EMAC_RLE (0xFFFDC088) // (EMAC) Receive Length Field Mismatch Register +#define AT91C_EMAC_IMR (0xFFFDC030) // (EMAC) Interrupt Mask Register +#define AT91C_EMAC_SA1H (0xFFFDC09C) // (EMAC) Specific Address 1 Top, Last 2 bytes +#define AT91C_EMAC_PFR (0xFFFDC03C) // (EMAC) Pause Frames received Register +#define AT91C_EMAC_FCSE (0xFFFDC050) // (EMAC) Frame Check Sequence Error Register +#define AT91C_EMAC_FTO (0xFFFDC040) // (EMAC) Frames Transmitted OK Register +#define AT91C_EMAC_TUND (0xFFFDC064) // (EMAC) Transmit Underrun Error Register +#define AT91C_EMAC_ALE (0xFFFDC054) // (EMAC) Alignment Error Register +#define AT91C_EMAC_SCF (0xFFFDC044) // (EMAC) Single Collision Frame Register +#define AT91C_EMAC_SA3H (0xFFFDC0AC) // (EMAC) Specific Address 3 Top, Last 2 bytes +#define AT91C_EMAC_ELE (0xFFFDC078) // (EMAC) Excessive Length Errors Register +#define AT91C_EMAC_CSE (0xFFFDC068) // (EMAC) Carrier Sense Error Register +#define AT91C_EMAC_DTF (0xFFFDC058) // (EMAC) Deferred Transmission Frame Register +#define AT91C_EMAC_RSR (0xFFFDC020) // (EMAC) Receive Status Register +#define AT91C_EMAC_USRIO (0xFFFDC0C0) // (EMAC) USER Input/Output Register +#define AT91C_EMAC_SA4L (0xFFFDC0B0) // (EMAC) Specific Address 4 Bottom, First 4 bytes +#define AT91C_EMAC_RRE (0xFFFDC06C) // (EMAC) Receive Ressource Error Register +#define AT91C_EMAC_RJA (0xFFFDC07C) // (EMAC) Receive Jabbers Register +#define AT91C_EMAC_TPF (0xFFFDC08C) // (EMAC) Transmitted Pause Frames Register +#define AT91C_EMAC_ISR (0xFFFDC024) // (EMAC) Interrupt Status Register +#define AT91C_EMAC_MAN (0xFFFDC034) // (EMAC) PHY Maintenance Register +#define AT91C_EMAC_WOL (0xFFFDC0C4) // (EMAC) Wake On LAN Register +#define AT91C_EMAC_USF (0xFFFDC080) // (EMAC) Undersize Frames Register +#define AT91C_EMAC_HRB (0xFFFDC090) // (EMAC) Hash Address Bottom[31:0] +#define AT91C_EMAC_PTR (0xFFFDC038) // (EMAC) Pause Time Register +#define AT91C_EMAC_HRT (0xFFFDC094) // (EMAC) Hash Address Top[63:32] +#define AT91C_EMAC_REV (0xFFFDC0FC) // (EMAC) Revision Register +#define AT91C_EMAC_MCF (0xFFFDC048) // (EMAC) Multiple Collision Frame Register +#define AT91C_EMAC_SA2L (0xFFFDC0A0) // (EMAC) Specific Address 2 Bottom, First 4 bytes +#define AT91C_EMAC_NCR (0xFFFDC000) // (EMAC) Network Control Register +#define AT91C_EMAC_FRO (0xFFFDC04C) // (EMAC) Frames Received OK Register +#define AT91C_EMAC_LCOL (0xFFFDC05C) // (EMAC) Late Collision Register +#define AT91C_EMAC_SA4H (0xFFFDC0B4) // (EMAC) Specific Address 4 Top, Last 2 bytes +#define AT91C_EMAC_NCFGR (0xFFFDC004) // (EMAC) Network Configuration Register +#define AT91C_EMAC_TSR (0xFFFDC014) // (EMAC) Transmit Status Register +#define AT91C_EMAC_SA2H (0xFFFDC0A4) // (EMAC) Specific Address 2 Top, Last 2 bytes +#define AT91C_EMAC_ECOL (0xFFFDC060) // (EMAC) Excessive Collision Register +#define AT91C_EMAC_ROV (0xFFFDC070) // (EMAC) Receive Overrun Errors Register +#define AT91C_EMAC_NSR (0xFFFDC008) // (EMAC) Network Status Register +#define AT91C_EMAC_RBQP (0xFFFDC018) // (EMAC) Receive Buffer Queue Pointer +#define AT91C_EMAC_IER (0xFFFDC028) // (EMAC) Interrupt Enable Register +// ========== Register definition for PDC_ADC peripheral ========== +#define AT91C_ADC_PTCR (0xFFFD8120) // (PDC_ADC) PDC Transfer Control Register +#define AT91C_ADC_TNPR (0xFFFD8118) // (PDC_ADC) Transmit Next Pointer Register +#define AT91C_ADC_RNPR (0xFFFD8110) // (PDC_ADC) Receive Next Pointer Register +#define AT91C_ADC_TPR (0xFFFD8108) // (PDC_ADC) Transmit Pointer Register +#define AT91C_ADC_RPR (0xFFFD8100) // (PDC_ADC) Receive Pointer Register +#define AT91C_ADC_PTSR (0xFFFD8124) // (PDC_ADC) PDC Transfer Status Register +#define AT91C_ADC_TNCR (0xFFFD811C) // (PDC_ADC) Transmit Next Counter Register +#define AT91C_ADC_RNCR (0xFFFD8114) // (PDC_ADC) Receive Next Counter Register +#define AT91C_ADC_TCR (0xFFFD810C) // (PDC_ADC) Transmit Counter Register +#define AT91C_ADC_RCR (0xFFFD8104) // (PDC_ADC) Receive Counter Register +// ========== Register definition for ADC peripheral ========== +#define AT91C_ADC_IMR (0xFFFD802C) // (ADC) ADC Interrupt Mask Register +#define AT91C_ADC_CDR4 (0xFFFD8040) // (ADC) ADC Channel Data Register 4 +#define AT91C_ADC_CDR2 (0xFFFD8038) // (ADC) ADC Channel Data Register 2 +#define AT91C_ADC_CDR0 (0xFFFD8030) // (ADC) ADC Channel Data Register 0 +#define AT91C_ADC_CDR7 (0xFFFD804C) // (ADC) ADC Channel Data Register 7 +#define AT91C_ADC_CDR1 (0xFFFD8034) // (ADC) ADC Channel Data Register 1 +#define AT91C_ADC_CDR3 (0xFFFD803C) // (ADC) ADC Channel Data Register 3 +#define AT91C_ADC_CDR5 (0xFFFD8044) // (ADC) ADC Channel Data Register 5 +#define AT91C_ADC_MR (0xFFFD8004) // (ADC) ADC Mode Register +#define AT91C_ADC_CDR6 (0xFFFD8048) // (ADC) ADC Channel Data Register 6 +#define AT91C_ADC_CR (0xFFFD8000) // (ADC) ADC Control Register +#define AT91C_ADC_CHER (0xFFFD8010) // (ADC) ADC Channel Enable Register +#define AT91C_ADC_CHSR (0xFFFD8018) // (ADC) ADC Channel Status Register +#define AT91C_ADC_IER (0xFFFD8024) // (ADC) ADC Interrupt Enable Register +#define AT91C_ADC_SR (0xFFFD801C) // (ADC) ADC Status Register +#define AT91C_ADC_CHDR (0xFFFD8014) // (ADC) ADC Channel Disable Register +#define AT91C_ADC_IDR (0xFFFD8028) // (ADC) ADC Interrupt Disable Register +#define AT91C_ADC_LCDR (0xFFFD8020) // (ADC) ADC Last Converted Data Register + +// ***************************************************************************** +// PIO DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** +#define AT91C_PIO_PA0 (1 << 0) // Pin Controlled by PA0 +#define AT91C_PA0_RXD0 (AT91C_PIO_PA0) // USART 0 Receive Data +#define AT91C_PIO_PA1 (1 << 1) // Pin Controlled by PA1 +#define AT91C_PA1_TXD0 (AT91C_PIO_PA1) // USART 0 Transmit Data +#define AT91C_PIO_PA10 (1 << 10) // Pin Controlled by PA10 +#define AT91C_PA10_TWD (AT91C_PIO_PA10) // TWI Two-wire Serial Data +#define AT91C_PIO_PA11 (1 << 11) // Pin Controlled by PA11 +#define AT91C_PA11_TWCK (AT91C_PIO_PA11) // TWI Two-wire Serial Clock +#define AT91C_PIO_PA12 (1 << 12) // Pin Controlled by PA12 +#define AT91C_PA12_SPI0_NPCS0 (AT91C_PIO_PA12) // SPI 0 Peripheral Chip Select 0 +#define AT91C_PIO_PA13 (1 << 13) // Pin Controlled by PA13 +#define AT91C_PA13_SPI0_NPCS1 (AT91C_PIO_PA13) // SPI 0 Peripheral Chip Select 1 +#define AT91C_PA13_PCK1 (AT91C_PIO_PA13) // PMC Programmable Clock Output 1 +#define AT91C_PIO_PA14 (1 << 14) // Pin Controlled by PA14 +#define AT91C_PA14_SPI0_NPCS2 (AT91C_PIO_PA14) // SPI 0 Peripheral Chip Select 2 +#define AT91C_PA14_IRQ1 (AT91C_PIO_PA14) // External Interrupt 1 +#define AT91C_PIO_PA15 (1 << 15) // Pin Controlled by PA15 +#define AT91C_PA15_SPI0_NPCS3 (AT91C_PIO_PA15) // SPI 0 Peripheral Chip Select 3 +#define AT91C_PA15_TCLK2 (AT91C_PIO_PA15) // Timer Counter 2 external clock input +#define AT91C_PIO_PA16 (1 << 16) // Pin Controlled by PA16 +#define AT91C_PA16_SPI0_MISO (AT91C_PIO_PA16) // SPI 0 Master In Slave +#define AT91C_PIO_PA17 (1 << 17) // Pin Controlled by PA17 +#define AT91C_PA17_SPI0_MOSI (AT91C_PIO_PA17) // SPI 0 Master Out Slave +#define AT91C_PIO_PA18 (1 << 18) // Pin Controlled by PA18 +#define AT91C_PA18_SPI0_SPCK (AT91C_PIO_PA18) // SPI 0 Serial Clock +#define AT91C_PIO_PA19 (1 << 19) // Pin Controlled by PA19 +#define AT91C_PA19_CANRX (AT91C_PIO_PA19) // CAN Receive +#define AT91C_PIO_PA2 (1 << 2) // Pin Controlled by PA2 +#define AT91C_PA2_SCK0 (AT91C_PIO_PA2) // USART 0 Serial Clock +#define AT91C_PA2_SPI1_NPCS1 (AT91C_PIO_PA2) // SPI 1 Peripheral Chip Select 1 +#define AT91C_PIO_PA20 (1 << 20) // Pin Controlled by PA20 +#define AT91C_PA20_CANTX (AT91C_PIO_PA20) // CAN Transmit +#define AT91C_PIO_PA21 (1 << 21) // Pin Controlled by PA21 +#define AT91C_PA21_TF (AT91C_PIO_PA21) // SSC Transmit Frame Sync +#define AT91C_PA21_SPI1_NPCS0 (AT91C_PIO_PA21) // SPI 1 Peripheral Chip Select 0 +#define AT91C_PIO_PA22 (1 << 22) // Pin Controlled by PA22 +#define AT91C_PA22_TK (AT91C_PIO_PA22) // SSC Transmit Clock +#define AT91C_PA22_SPI1_SPCK (AT91C_PIO_PA22) // SPI 1 Serial Clock +#define AT91C_PIO_PA23 (1 << 23) // Pin Controlled by PA23 +#define AT91C_PA23_TD (AT91C_PIO_PA23) // SSC Transmit data +#define AT91C_PA23_SPI1_MOSI (AT91C_PIO_PA23) // SPI 1 Master Out Slave +#define AT91C_PIO_PA24 (1 << 24) // Pin Controlled by PA24 +#define AT91C_PA24_RD (AT91C_PIO_PA24) // SSC Receive Data +#define AT91C_PA24_SPI1_MISO (AT91C_PIO_PA24) // SPI 1 Master In Slave +#define AT91C_PIO_PA25 (1 << 25) // Pin Controlled by PA25 +#define AT91C_PA25_RK (AT91C_PIO_PA25) // SSC Receive Clock +#define AT91C_PA25_SPI1_NPCS1 (AT91C_PIO_PA25) // SPI 1 Peripheral Chip Select 1 +#define AT91C_PIO_PA26 (1 << 26) // Pin Controlled by PA26 +#define AT91C_PA26_RF (AT91C_PIO_PA26) // SSC Receive Frame Sync +#define AT91C_PA26_SPI1_NPCS2 (AT91C_PIO_PA26) // SPI 1 Peripheral Chip Select 2 +#define AT91C_PIO_PA27 (1 << 27) // Pin Controlled by PA27 +#define AT91C_PA27_DRXD (AT91C_PIO_PA27) // DBGU Debug Receive Data +#define AT91C_PA27_PCK3 (AT91C_PIO_PA27) // PMC Programmable Clock Output 3 +#define AT91C_PIO_PA28 (1 << 28) // Pin Controlled by PA28 +#define AT91C_PA28_DTXD (AT91C_PIO_PA28) // DBGU Debug Transmit Data +#define AT91C_PIO_PA29 (1 << 29) // Pin Controlled by PA29 +#define AT91C_PA29_FIQ (AT91C_PIO_PA29) // AIC Fast Interrupt Input +#define AT91C_PA29_SPI1_NPCS3 (AT91C_PIO_PA29) // SPI 1 Peripheral Chip Select 3 +#define AT91C_PIO_PA3 (1 << 3) // Pin Controlled by PA3 +#define AT91C_PA3_RTS0 (AT91C_PIO_PA3) // USART 0 Ready To Send +#define AT91C_PA3_SPI1_NPCS2 (AT91C_PIO_PA3) // SPI 1 Peripheral Chip Select 2 +#define AT91C_PIO_PA30 (1 << 30) // Pin Controlled by PA30 +#define AT91C_PA30_IRQ0 (AT91C_PIO_PA30) // External Interrupt 0 +#define AT91C_PA30_PCK2 (AT91C_PIO_PA30) // PMC Programmable Clock Output 2 +#define AT91C_PIO_PA4 (1 << 4) // Pin Controlled by PA4 +#define AT91C_PA4_CTS0 (AT91C_PIO_PA4) // USART 0 Clear To Send +#define AT91C_PA4_SPI1_NPCS3 (AT91C_PIO_PA4) // SPI 1 Peripheral Chip Select 3 +#define AT91C_PIO_PA5 (1 << 5) // Pin Controlled by PA5 +#define AT91C_PA5_RXD1 (AT91C_PIO_PA5) // USART 1 Receive Data +#define AT91C_PIO_PA6 (1 << 6) // Pin Controlled by PA6 +#define AT91C_PA6_TXD1 (AT91C_PIO_PA6) // USART 1 Transmit Data +#define AT91C_PIO_PA7 (1 << 7) // Pin Controlled by PA7 +#define AT91C_PA7_SCK1 (AT91C_PIO_PA7) // USART 1 Serial Clock +#define AT91C_PA7_SPI0_NPCS1 (AT91C_PIO_PA7) // SPI 0 Peripheral Chip Select 1 +#define AT91C_PIO_PA8 (1 << 8) // Pin Controlled by PA8 +#define AT91C_PA8_RTS1 (AT91C_PIO_PA8) // USART 1 Ready To Send +#define AT91C_PA8_SPI0_NPCS2 (AT91C_PIO_PA8) // SPI 0 Peripheral Chip Select 2 +#define AT91C_PIO_PA9 (1 << 9) // Pin Controlled by PA9 +#define AT91C_PA9_CTS1 (AT91C_PIO_PA9) // USART 1 Clear To Send +#define AT91C_PA9_SPI0_NPCS3 (AT91C_PIO_PA9) // SPI 0 Peripheral Chip Select 3 +#define AT91C_PIO_PB0 (1 << 0) // Pin Controlled by PB0 +#define AT91C_PB0_ETXCK_EREFCK (AT91C_PIO_PB0) // Ethernet MAC Transmit Clock/Reference Clock +#define AT91C_PB0_PCK0 (AT91C_PIO_PB0) // PMC Programmable Clock Output 0 +#define AT91C_PIO_PB1 (1 << 1) // Pin Controlled by PB1 +#define AT91C_PB1_ETXEN (AT91C_PIO_PB1) // Ethernet MAC Transmit Enable +#define AT91C_PIO_PB10 (1 << 10) // Pin Controlled by PB10 +#define AT91C_PB10_ETX2 (AT91C_PIO_PB10) // Ethernet MAC Transmit Data 2 +#define AT91C_PB10_SPI1_NPCS1 (AT91C_PIO_PB10) // SPI 1 Peripheral Chip Select 1 +#define AT91C_PIO_PB11 (1 << 11) // Pin Controlled by PB11 +#define AT91C_PB11_ETX3 (AT91C_PIO_PB11) // Ethernet MAC Transmit Data 3 +#define AT91C_PB11_SPI1_NPCS2 (AT91C_PIO_PB11) // SPI 1 Peripheral Chip Select 2 +#define AT91C_PIO_PB12 (1 << 12) // Pin Controlled by PB12 +#define AT91C_PB12_ETXER (AT91C_PIO_PB12) // Ethernet MAC Transmikt Coding Error +#define AT91C_PB12_TCLK0 (AT91C_PIO_PB12) // Timer Counter 0 external clock input +#define AT91C_PIO_PB13 (1 << 13) // Pin Controlled by PB13 +#define AT91C_PB13_ERX2 (AT91C_PIO_PB13) // Ethernet MAC Receive Data 2 +#define AT91C_PB13_SPI0_NPCS1 (AT91C_PIO_PB13) // SPI 0 Peripheral Chip Select 1 +#define AT91C_PIO_PB14 (1 << 14) // Pin Controlled by PB14 +#define AT91C_PB14_ERX3 (AT91C_PIO_PB14) // Ethernet MAC Receive Data 3 +#define AT91C_PB14_SPI0_NPCS2 (AT91C_PIO_PB14) // SPI 0 Peripheral Chip Select 2 +#define AT91C_PIO_PB15 (1 << 15) // Pin Controlled by PB15 +#define AT91C_PB15_ERXDV_ECRSDV (AT91C_PIO_PB15) // Ethernet MAC Receive Data Valid +#define AT91C_PIO_PB16 (1 << 16) // Pin Controlled by PB16 +#define AT91C_PB16_ECOL (AT91C_PIO_PB16) // Ethernet MAC Collision Detected +#define AT91C_PB16_SPI1_NPCS3 (AT91C_PIO_PB16) // SPI 1 Peripheral Chip Select 3 +#define AT91C_PIO_PB17 (1 << 17) // Pin Controlled by PB17 +#define AT91C_PB17_ERXCK (AT91C_PIO_PB17) // Ethernet MAC Receive Clock +#define AT91C_PB17_SPI0_NPCS3 (AT91C_PIO_PB17) // SPI 0 Peripheral Chip Select 3 +#define AT91C_PIO_PB18 (1 << 18) // Pin Controlled by PB18 +#define AT91C_PB18_EF100 (AT91C_PIO_PB18) // Ethernet MAC Force 100 Mbits/sec +#define AT91C_PB18_ADTRG (AT91C_PIO_PB18) // ADC External Trigger +#define AT91C_PIO_PB19 (1 << 19) // Pin Controlled by PB19 +#define AT91C_PB19_PWM0 (AT91C_PIO_PB19) // PWM Channel 0 +#define AT91C_PB19_TCLK1 (AT91C_PIO_PB19) // Timer Counter 1 external clock input +#define AT91C_PIO_PB2 (1 << 2) // Pin Controlled by PB2 +#define AT91C_PB2_ETX0 (AT91C_PIO_PB2) // Ethernet MAC Transmit Data 0 +#define AT91C_PIO_PB20 (1 << 20) // Pin Controlled by PB20 +#define AT91C_PB20_PWM1 (AT91C_PIO_PB20) // PWM Channel 1 +#define AT91C_PB20_PCK0 (AT91C_PIO_PB20) // PMC Programmable Clock Output 0 +#define AT91C_PIO_PB21 (1 << 21) // Pin Controlled by PB21 +#define AT91C_PB21_PWM2 (AT91C_PIO_PB21) // PWM Channel 2 +#define AT91C_PB21_PCK1 (AT91C_PIO_PB21) // PMC Programmable Clock Output 1 +#define AT91C_PIO_PB22 (1 << 22) // Pin Controlled by PB22 +#define AT91C_PB22_PWM3 (AT91C_PIO_PB22) // PWM Channel 3 +#define AT91C_PB22_PCK2 (AT91C_PIO_PB22) // PMC Programmable Clock Output 2 +#define AT91C_PIO_PB23 (1 << 23) // Pin Controlled by PB23 +#define AT91C_PB23_TIOA0 (AT91C_PIO_PB23) // Timer Counter 0 Multipurpose Timer I/O Pin A +#define AT91C_PB23_DCD1 (AT91C_PIO_PB23) // USART 1 Data Carrier Detect +#define AT91C_PIO_PB24 (1 << 24) // Pin Controlled by PB24 +#define AT91C_PB24_TIOB0 (AT91C_PIO_PB24) // Timer Counter 0 Multipurpose Timer I/O Pin B +#define AT91C_PB24_DSR1 (AT91C_PIO_PB24) // USART 1 Data Set ready +#define AT91C_PIO_PB25 (1 << 25) // Pin Controlled by PB25 +#define AT91C_PB25_TIOA1 (AT91C_PIO_PB25) // Timer Counter 1 Multipurpose Timer I/O Pin A +#define AT91C_PB25_DTR1 (AT91C_PIO_PB25) // USART 1 Data Terminal ready +#define AT91C_PIO_PB26 (1 << 26) // Pin Controlled by PB26 +#define AT91C_PB26_TIOB1 (AT91C_PIO_PB26) // Timer Counter 1 Multipurpose Timer I/O Pin B +#define AT91C_PB26_RI1 (AT91C_PIO_PB26) // USART 1 Ring Indicator +#define AT91C_PIO_PB27 (1 << 27) // Pin Controlled by PB27 +#define AT91C_PB27_TIOA2 (AT91C_PIO_PB27) // Timer Counter 2 Multipurpose Timer I/O Pin A +#define AT91C_PB27_PWM0 (AT91C_PIO_PB27) // PWM Channel 0 +#define AT91C_PIO_PB28 (1 << 28) // Pin Controlled by PB28 +#define AT91C_PB28_TIOB2 (AT91C_PIO_PB28) // Timer Counter 2 Multipurpose Timer I/O Pin B +#define AT91C_PB28_PWM1 (AT91C_PIO_PB28) // PWM Channel 1 +#define AT91C_PIO_PB29 (1 << 29) // Pin Controlled by PB29 +#define AT91C_PB29_PCK1 (AT91C_PIO_PB29) // PMC Programmable Clock Output 1 +#define AT91C_PB29_PWM2 (AT91C_PIO_PB29) // PWM Channel 2 +#define AT91C_PIO_PB3 (1 << 3) // Pin Controlled by PB3 +#define AT91C_PB3_ETX1 (AT91C_PIO_PB3) // Ethernet MAC Transmit Data 1 +#define AT91C_PIO_PB30 (1 << 30) // Pin Controlled by PB30 +#define AT91C_PB30_PCK2 (AT91C_PIO_PB30) // PMC Programmable Clock Output 2 +#define AT91C_PB30_PWM3 (AT91C_PIO_PB30) // PWM Channel 3 +#define AT91C_PIO_PB4 (1 << 4) // Pin Controlled by PB4 +#define AT91C_PB4_ECRS (AT91C_PIO_PB4) // Ethernet MAC Carrier Sense/Carrier Sense and Data Valid +#define AT91C_PIO_PB5 (1 << 5) // Pin Controlled by PB5 +#define AT91C_PB5_ERX0 (AT91C_PIO_PB5) // Ethernet MAC Receive Data 0 +#define AT91C_PIO_PB6 (1 << 6) // Pin Controlled by PB6 +#define AT91C_PB6_ERX1 (AT91C_PIO_PB6) // Ethernet MAC Receive Data 1 +#define AT91C_PIO_PB7 (1 << 7) // Pin Controlled by PB7 +#define AT91C_PB7_ERXER (AT91C_PIO_PB7) // Ethernet MAC Receive Error +#define AT91C_PIO_PB8 (1 << 8) // Pin Controlled by PB8 +#define AT91C_PB8_EMDC (AT91C_PIO_PB8) // Ethernet MAC Management Data Clock +#define AT91C_PIO_PB9 (1 << 9) // Pin Controlled by PB9 +#define AT91C_PB9_EMDIO (AT91C_PIO_PB9) // Ethernet MAC Management Data Input/Output + +// ***************************************************************************** +// PERIPHERAL ID DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** +#define AT91C_ID_FIQ ( 0) // Advanced Interrupt Controller (FIQ) +#define AT91C_ID_SYS ( 1) // System Peripheral +#define AT91C_ID_PIOA ( 2) // Parallel IO Controller A +#define AT91C_ID_PIOB ( 3) // Parallel IO Controller B +#define AT91C_ID_SPI0 ( 4) // Serial Peripheral Interface 0 +#define AT91C_ID_SPI1 ( 5) // Serial Peripheral Interface 1 +#define AT91C_ID_US0 ( 6) // USART 0 +#define AT91C_ID_US1 ( 7) // USART 1 +#define AT91C_ID_SSC ( 8) // Serial Synchronous Controller +#define AT91C_ID_TWI ( 9) // Two-Wire Interface +#define AT91C_ID_PWMC (10) // PWM Controller +#define AT91C_ID_UDP (11) // USB Device Port +#define AT91C_ID_TC0 (12) // Timer Counter 0 +#define AT91C_ID_TC1 (13) // Timer Counter 1 +#define AT91C_ID_TC2 (14) // Timer Counter 2 +#define AT91C_ID_CAN (15) // Control Area Network Controller +#define AT91C_ID_EMAC (16) // Ethernet MAC +#define AT91C_ID_ADC (17) // Analog-to-Digital Converter +#define AT91C_ID_18_Reserved (18) // Reserved +#define AT91C_ID_19_Reserved (19) // Reserved +#define AT91C_ID_20_Reserved (20) // Reserved +#define AT91C_ID_21_Reserved (21) // Reserved +#define AT91C_ID_22_Reserved (22) // Reserved +#define AT91C_ID_23_Reserved (23) // Reserved +#define AT91C_ID_24_Reserved (24) // Reserved +#define AT91C_ID_25_Reserved (25) // Reserved +#define AT91C_ID_26_Reserved (26) // Reserved +#define AT91C_ID_27_Reserved (27) // Reserved +#define AT91C_ID_28_Reserved (28) // Reserved +#define AT91C_ID_29_Reserved (29) // Reserved +#define AT91C_ID_IRQ0 (30) // Advanced Interrupt Controller (IRQ0) +#define AT91C_ID_IRQ1 (31) // Advanced Interrupt Controller (IRQ1) +#define AT91C_ALL_INT (0xC003FFFF) // ALL VALID INTERRUPTS + +// ***************************************************************************** +// BASE ADDRESS DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** +#define AT91C_BASE_SYS (0xFFFFF000) // (SYS) Base Address +#define AT91C_BASE_AIC (0xFFFFF000) // (AIC) Base Address +#define AT91C_BASE_PDC_DBGU (0xFFFFF300) // (PDC_DBGU) Base Address +#define AT91C_BASE_DBGU (0xFFFFF200) // (DBGU) Base Address +#define AT91C_BASE_PIOA (0xFFFFF400) // (PIOA) Base Address +#define AT91C_BASE_PIOB (0xFFFFF600) // (PIOB) Base Address +#define AT91C_BASE_CKGR (0xFFFFFC20) // (CKGR) Base Address +#define AT91C_BASE_PMC (0xFFFFFC00) // (PMC) Base Address +#define AT91C_BASE_RSTC (0xFFFFFD00) // (RSTC) Base Address +#define AT91C_BASE_RTTC (0xFFFFFD20) // (RTTC) Base Address +#define AT91C_BASE_PITC (0xFFFFFD30) // (PITC) Base Address +#define AT91C_BASE_WDTC (0xFFFFFD40) // (WDTC) Base Address +#define AT91C_BASE_VREG (0xFFFFFD60) // (VREG) Base Address +#define AT91C_BASE_MC (0xFFFFFF00) // (MC) Base Address +#define AT91C_BASE_PDC_SPI1 (0xFFFE4100) // (PDC_SPI1) Base Address +#define AT91C_BASE_SPI1 (0xFFFE4000) // (SPI1) Base Address +#define AT91C_BASE_PDC_SPI0 (0xFFFE0100) // (PDC_SPI0) Base Address +#define AT91C_BASE_SPI0 (0xFFFE0000) // (SPI0) Base Address +#define AT91C_BASE_PDC_US1 (0xFFFC4100) // (PDC_US1) Base Address +#define AT91C_BASE_US1 (0xFFFC4000) // (US1) Base Address +#define AT91C_BASE_PDC_US0 (0xFFFC0100) // (PDC_US0) Base Address +#define AT91C_BASE_US0 (0xFFFC0000) // (US0) Base Address +#define AT91C_BASE_PDC_SSC (0xFFFD4100) // (PDC_SSC) Base Address +#define AT91C_BASE_SSC (0xFFFD4000) // (SSC) Base Address +#define AT91C_BASE_TWI (0xFFFB8000) // (TWI) Base Address +#define AT91C_BASE_PWMC_CH3 (0xFFFCC260) // (PWMC_CH3) Base Address +#define AT91C_BASE_PWMC_CH2 (0xFFFCC240) // (PWMC_CH2) Base Address +#define AT91C_BASE_PWMC_CH1 (0xFFFCC220) // (PWMC_CH1) Base Address +#define AT91C_BASE_PWMC_CH0 (0xFFFCC200) // (PWMC_CH0) Base Address +#define AT91C_BASE_PWMC (0xFFFCC000) // (PWMC) Base Address +#define AT91C_BASE_UDP (0xFFFB0000) // (UDP) Base Address +#define AT91C_BASE_TC0 (0xFFFA0000) // (TC0) Base Address +#define AT91C_BASE_TC1 (0xFFFA0040) // (TC1) Base Address +#define AT91C_BASE_TC2 (0xFFFA0080) // (TC2) Base Address +#define AT91C_BASE_TCB (0xFFFA0000) // (TCB) Base Address +#define AT91C_BASE_CAN_MB0 (0xFFFD0200) // (CAN_MB0) Base Address +#define AT91C_BASE_CAN_MB1 (0xFFFD0220) // (CAN_MB1) Base Address +#define AT91C_BASE_CAN_MB2 (0xFFFD0240) // (CAN_MB2) Base Address +#define AT91C_BASE_CAN_MB3 (0xFFFD0260) // (CAN_MB3) Base Address +#define AT91C_BASE_CAN_MB4 (0xFFFD0280) // (CAN_MB4) Base Address +#define AT91C_BASE_CAN_MB5 (0xFFFD02A0) // (CAN_MB5) Base Address +#define AT91C_BASE_CAN_MB6 (0xFFFD02C0) // (CAN_MB6) Base Address +#define AT91C_BASE_CAN_MB7 (0xFFFD02E0) // (CAN_MB7) Base Address +#define AT91C_BASE_CAN (0xFFFD0000) // (CAN) Base Address +#define AT91C_BASE_EMAC (0xFFFDC000) // (EMAC) Base Address +#define AT91C_BASE_PDC_ADC (0xFFFD8100) // (PDC_ADC) Base Address +#define AT91C_BASE_ADC (0xFFFD8000) // (ADC) Base Address + +// ***************************************************************************** +// MEMORY MAPPING DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** +// ISRAM +#define AT91C_ISRAM (0x00200000) // Internal SRAM base address +#define AT91C_ISRAM_SIZE (0x00010000) // Internal SRAM size in byte (64 Kbytes) +// IFLASH +#define AT91C_IFLASH (0x00100000) // Internal FLASH base address +#define AT91C_IFLASH_SIZE (0x00040000) // Internal FLASH size in byte (256 Kbytes) +#define AT91C_IFLASH_PAGE_SIZE (256) // Internal FLASH Page Size: 256 bytes +#define AT91C_IFLASH_LOCK_REGION_SIZE (16384) // Internal FLASH Lock Region Size: 16 Kbytes +#define AT91C_IFLASH_NB_OF_PAGES (1024) // Internal FLASH Number of Pages: 1024 bytes +#define AT91C_IFLASH_NB_OF_LOCK_BITS (16) // Internal FLASH Number of Lock Bits: 16 bytes + + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/incIAR/lib_AT91SAM7X256.h b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/incIAR/lib_AT91SAM7X256.h new file mode 100644 index 0000000..8bd8f04 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/incIAR/lib_AT91SAM7X256.h @@ -0,0 +1,4211 @@ +//* ---------------------------------------------------------------------------- +//* ATMEL Microcontroller Software Support - ROUSSET - +//* ---------------------------------------------------------------------------- +//* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +//* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +//* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +//* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +//* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +//* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +//* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +//* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +//* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +//* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +//* ---------------------------------------------------------------------------- +//* File Name : lib_AT91SAM7X256.h +//* Object : AT91SAM7X256 inlined functions +//* Generated : AT91 SW Application Group 01/16/2006 (16:36:21) +//* +//* CVS Reference : /lib_MC_SAM7X.h/1.1/Thu Mar 25 15:19:14 2004// +//* CVS Reference : /lib_pdc.h/1.2/Tue Jul 2 13:29:40 2002// +//* CVS Reference : /lib_dbgu.h/1.1/Thu Aug 25 12:56:22 2005// +//* CVS Reference : /lib_VREG_6085B.h/1.1/Tue Feb 1 16:20:47 2005// +//* CVS Reference : /lib_ssc.h/1.4/Fri Jan 31 12:19:20 2003// +//* CVS Reference : /lib_spi2.h/1.2/Tue Aug 23 15:37:28 2005// +//* CVS Reference : /lib_PWM_SAM.h/1.3/Thu Jan 22 10:10:50 2004// +//* CVS Reference : /lib_tc_1753b.h/1.1/Fri Jan 31 12:20:02 2003// +//* CVS Reference : /lib_pitc_6079A.h/1.2/Tue Nov 9 14:43:56 2004// +//* CVS Reference : /lib_adc.h/1.6/Fri Oct 17 09:12:38 2003// +//* CVS Reference : /lib_pmc_SAM7X.h/1.5/Fri Nov 4 09:41:32 2005// +//* CVS Reference : /lib_rstc_6098A.h/1.1/Wed Oct 6 10:39:20 2004// +//* CVS Reference : /lib_rttc_6081A.h/1.1/Wed Oct 6 10:39:38 2004// +//* CVS Reference : /lib_pio.h/1.3/Fri Jan 31 12:18:56 2003// +//* CVS Reference : /lib_twi.h/1.3/Mon Jul 19 14:27:58 2004// +//* CVS Reference : /lib_wdtc_6080A.h/1.1/Wed Oct 6 10:38:30 2004// +//* CVS Reference : /lib_usart.h/1.5/Thu Nov 21 16:01:54 2002// +//* CVS Reference : /lib_udp.h/1.5/Tue Aug 30 12:13:47 2005// +//* CVS Reference : /lib_aic_6075b.h/1.2/Thu Jul 7 07:48:22 2005// +//* CVS Reference : /lib_can_AT91.h/1.5/Tue Aug 23 15:37:07 2005// +//* ---------------------------------------------------------------------------- + +#ifndef lib_AT91SAM7X256_H +#define lib_AT91SAM7X256_H + +/* ***************************************************************************** + SOFTWARE API FOR AIC + ***************************************************************************** */ +#define AT91C_AIC_BRANCH_OPCODE ((void (*) ()) 0xE51FFF20) // ldr, pc, [pc, #-&F20] + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_ConfigureIt +//* \brief Interrupt Handler Initialization +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_AIC_ConfigureIt ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id, // \arg interrupt number to initialize + unsigned int priority, // \arg priority to give to the interrupt + unsigned int src_type, // \arg activation and sense of activation + void (*newHandler) () ) // \arg address of the interrupt handler +{ + unsigned int oldHandler; + unsigned int mask ; + + oldHandler = pAic->AIC_SVR[irq_id]; + + mask = 0x1 << irq_id ; + //* Disable the interrupt on the interrupt controller + pAic->AIC_IDCR = mask ; + //* Save the interrupt handler routine pointer and the interrupt priority + pAic->AIC_SVR[irq_id] = (unsigned int) newHandler ; + //* Store the Source Mode Register + pAic->AIC_SMR[irq_id] = src_type | priority ; + //* Clear the interrupt on the interrupt controller + pAic->AIC_ICCR = mask ; + + return oldHandler; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_EnableIt +//* \brief Enable corresponding IT number +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_EnableIt ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id ) // \arg interrupt number to initialize +{ + //* Enable the interrupt on the interrupt controller + pAic->AIC_IECR = 0x1 << irq_id ; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_DisableIt +//* \brief Disable corresponding IT number +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_DisableIt ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id ) // \arg interrupt number to initialize +{ + unsigned int mask = 0x1 << irq_id; + //* Disable the interrupt on the interrupt controller + pAic->AIC_IDCR = mask ; + //* Clear the interrupt on the Interrupt Controller ( if one is pending ) + pAic->AIC_ICCR = mask ; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_ClearIt +//* \brief Clear corresponding IT number +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_ClearIt ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id) // \arg interrupt number to initialize +{ + //* Clear the interrupt on the Interrupt Controller ( if one is pending ) + pAic->AIC_ICCR = (0x1 << irq_id); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_AcknowledgeIt +//* \brief Acknowledge corresponding IT number +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_AcknowledgeIt ( + AT91PS_AIC pAic) // \arg pointer to the AIC registers +{ + pAic->AIC_EOICR = pAic->AIC_EOICR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_SetExceptionVector +//* \brief Configure vector handler +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_AIC_SetExceptionVector ( + unsigned int *pVector, // \arg pointer to the AIC registers + void (*Handler) () ) // \arg Interrupt Handler +{ + unsigned int oldVector = *pVector; + + if ((unsigned int) Handler == (unsigned int) AT91C_AIC_BRANCH_OPCODE) + *pVector = (unsigned int) AT91C_AIC_BRANCH_OPCODE; + else + *pVector = (((((unsigned int) Handler) - ((unsigned int) pVector) - 0x8) >> 2) & 0x00FFFFFF) | 0xEA000000; + + return oldVector; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_Trig +//* \brief Trig an IT +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_Trig ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id) // \arg interrupt number +{ + pAic->AIC_ISCR = (0x1 << irq_id) ; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_IsActive +//* \brief Test if an IT is active +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_AIC_IsActive ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id) // \arg Interrupt Number +{ + return (pAic->AIC_ISR & (0x1 << irq_id)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_IsPending +//* \brief Test if an IT is pending +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_AIC_IsPending ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id) // \arg Interrupt Number +{ + return (pAic->AIC_IPR & (0x1 << irq_id)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_Open +//* \brief Set exception vectors and AIC registers to default values +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_Open( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + void (*IrqHandler) (), // \arg Default IRQ vector exception + void (*FiqHandler) (), // \arg Default FIQ vector exception + void (*DefaultHandler) (), // \arg Default Handler set in ISR + void (*SpuriousHandler) (), // \arg Default Spurious Handler + unsigned int protectMode) // \arg Debug Control Register +{ + int i; + + // Disable all interrupts and set IVR to the default handler + for (i = 0; i < 32; ++i) { + AT91F_AIC_DisableIt(pAic, i); + AT91F_AIC_ConfigureIt(pAic, i, AT91C_AIC_PRIOR_LOWEST, AT91C_AIC_SRCTYPE_HIGH_LEVEL, DefaultHandler); + } + + // Set the IRQ exception vector + AT91F_AIC_SetExceptionVector((unsigned int *) 0x18, IrqHandler); + // Set the Fast Interrupt exception vector + AT91F_AIC_SetExceptionVector((unsigned int *) 0x1C, FiqHandler); + + pAic->AIC_SPU = (unsigned int) SpuriousHandler; + pAic->AIC_DCR = protectMode; +} +/* ***************************************************************************** + SOFTWARE API FOR PDC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_SetNextRx +//* \brief Set the next receive transfer descriptor +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_SetNextRx ( + AT91PS_PDC pPDC, // \arg pointer to a PDC controller + char *address, // \arg address to the next bloc to be received + unsigned int bytes) // \arg number of bytes to be received +{ + pPDC->PDC_RNPR = (unsigned int) address; + pPDC->PDC_RNCR = bytes; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_SetNextTx +//* \brief Set the next transmit transfer descriptor +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_SetNextTx ( + AT91PS_PDC pPDC, // \arg pointer to a PDC controller + char *address, // \arg address to the next bloc to be transmitted + unsigned int bytes) // \arg number of bytes to be transmitted +{ + pPDC->PDC_TNPR = (unsigned int) address; + pPDC->PDC_TNCR = bytes; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_SetRx +//* \brief Set the receive transfer descriptor +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_SetRx ( + AT91PS_PDC pPDC, // \arg pointer to a PDC controller + char *address, // \arg address to the next bloc to be received + unsigned int bytes) // \arg number of bytes to be received +{ + pPDC->PDC_RPR = (unsigned int) address; + pPDC->PDC_RCR = bytes; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_SetTx +//* \brief Set the transmit transfer descriptor +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_SetTx ( + AT91PS_PDC pPDC, // \arg pointer to a PDC controller + char *address, // \arg address to the next bloc to be transmitted + unsigned int bytes) // \arg number of bytes to be transmitted +{ + pPDC->PDC_TPR = (unsigned int) address; + pPDC->PDC_TCR = bytes; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_EnableTx +//* \brief Enable transmit +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_EnableTx ( + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + pPDC->PDC_PTCR = AT91C_PDC_TXTEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_EnableRx +//* \brief Enable receive +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_EnableRx ( + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + pPDC->PDC_PTCR = AT91C_PDC_RXTEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_DisableTx +//* \brief Disable transmit +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_DisableTx ( + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + pPDC->PDC_PTCR = AT91C_PDC_TXTDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_DisableRx +//* \brief Disable receive +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_DisableRx ( + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + pPDC->PDC_PTCR = AT91C_PDC_RXTDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_IsTxEmpty +//* \brief Test if the current transfer descriptor has been sent +//*---------------------------------------------------------------------------- +__inline int AT91F_PDC_IsTxEmpty ( // \return return 1 if transfer is complete + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + return !(pPDC->PDC_TCR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_IsNextTxEmpty +//* \brief Test if the next transfer descriptor has been moved to the current td +//*---------------------------------------------------------------------------- +__inline int AT91F_PDC_IsNextTxEmpty ( // \return return 1 if transfer is complete + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + return !(pPDC->PDC_TNCR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_IsRxEmpty +//* \brief Test if the current transfer descriptor has been filled +//*---------------------------------------------------------------------------- +__inline int AT91F_PDC_IsRxEmpty ( // \return return 1 if transfer is complete + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + return !(pPDC->PDC_RCR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_IsNextRxEmpty +//* \brief Test if the next transfer descriptor has been moved to the current td +//*---------------------------------------------------------------------------- +__inline int AT91F_PDC_IsNextRxEmpty ( // \return return 1 if transfer is complete + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + return !(pPDC->PDC_RNCR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_Open +//* \brief Open PDC: disable TX and RX reset transfer descriptors, re-enable RX and TX +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_Open ( + AT91PS_PDC pPDC) // \arg pointer to a PDC controller +{ + //* Disable the RX and TX PDC transfer requests + AT91F_PDC_DisableRx(pPDC); + AT91F_PDC_DisableTx(pPDC); + + //* Reset all Counter register Next buffer first + AT91F_PDC_SetNextTx(pPDC, (char *) 0, 0); + AT91F_PDC_SetNextRx(pPDC, (char *) 0, 0); + AT91F_PDC_SetTx(pPDC, (char *) 0, 0); + AT91F_PDC_SetRx(pPDC, (char *) 0, 0); + + //* Enable the RX and TX PDC transfer requests + AT91F_PDC_EnableRx(pPDC); + AT91F_PDC_EnableTx(pPDC); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_Close +//* \brief Close PDC: disable TX and RX reset transfer descriptors +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_Close ( + AT91PS_PDC pPDC) // \arg pointer to a PDC controller +{ + //* Disable the RX and TX PDC transfer requests + AT91F_PDC_DisableRx(pPDC); + AT91F_PDC_DisableTx(pPDC); + + //* Reset all Counter register Next buffer first + AT91F_PDC_SetNextTx(pPDC, (char *) 0, 0); + AT91F_PDC_SetNextRx(pPDC, (char *) 0, 0); + AT91F_PDC_SetTx(pPDC, (char *) 0, 0); + AT91F_PDC_SetRx(pPDC, (char *) 0, 0); + +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_SendFrame +//* \brief Close PDC: disable TX and RX reset transfer descriptors +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PDC_SendFrame( + AT91PS_PDC pPDC, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + if (AT91F_PDC_IsTxEmpty(pPDC)) { + //* Buffer and next buffer can be initialized + AT91F_PDC_SetTx(pPDC, pBuffer, szBuffer); + AT91F_PDC_SetNextTx(pPDC, pNextBuffer, szNextBuffer); + return 2; + } + else if (AT91F_PDC_IsNextTxEmpty(pPDC)) { + //* Only one buffer can be initialized + AT91F_PDC_SetNextTx(pPDC, pBuffer, szBuffer); + return 1; + } + else { + //* All buffer are in use... + return 0; + } +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_ReceiveFrame +//* \brief Close PDC: disable TX and RX reset transfer descriptors +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PDC_ReceiveFrame ( + AT91PS_PDC pPDC, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + if (AT91F_PDC_IsRxEmpty(pPDC)) { + //* Buffer and next buffer can be initialized + AT91F_PDC_SetRx(pPDC, pBuffer, szBuffer); + AT91F_PDC_SetNextRx(pPDC, pNextBuffer, szNextBuffer); + return 2; + } + else if (AT91F_PDC_IsNextRxEmpty(pPDC)) { + //* Only one buffer can be initialized + AT91F_PDC_SetNextRx(pPDC, pBuffer, szBuffer); + return 1; + } + else { + //* All buffer are in use... + return 0; + } +} +/* ***************************************************************************** + SOFTWARE API FOR DBGU + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_DBGU_InterruptEnable +//* \brief Enable DBGU Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_DBGU_InterruptEnable( + AT91PS_DBGU pDbgu, // \arg pointer to a DBGU controller + unsigned int flag) // \arg dbgu interrupt to be enabled +{ + pDbgu->DBGU_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_DBGU_InterruptDisable +//* \brief Disable DBGU Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_DBGU_InterruptDisable( + AT91PS_DBGU pDbgu, // \arg pointer to a DBGU controller + unsigned int flag) // \arg dbgu interrupt to be disabled +{ + pDbgu->DBGU_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_DBGU_GetInterruptMaskStatus +//* \brief Return DBGU Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_DBGU_GetInterruptMaskStatus( // \return DBGU Interrupt Mask Status + AT91PS_DBGU pDbgu) // \arg pointer to a DBGU controller +{ + return pDbgu->DBGU_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_DBGU_IsInterruptMasked +//* \brief Test if DBGU Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_DBGU_IsInterruptMasked( + AT91PS_DBGU pDbgu, // \arg pointer to a DBGU controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_DBGU_GetInterruptMaskStatus(pDbgu) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR PIO + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgPeriph +//* \brief Enable pins to be drived by peripheral +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgPeriph( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int periphAEnable, // \arg PERIPH A to enable + unsigned int periphBEnable) // \arg PERIPH B to enable + +{ + pPio->PIO_ASR = periphAEnable; + pPio->PIO_BSR = periphBEnable; + pPio->PIO_PDR = (periphAEnable | periphBEnable); // Set in Periph mode +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgOutput +//* \brief Enable PIO in output mode +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgOutput( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int pioEnable) // \arg PIO to be enabled +{ + pPio->PIO_PER = pioEnable; // Set in PIO mode + pPio->PIO_OER = pioEnable; // Configure in Output +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgInput +//* \brief Enable PIO in input mode +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgInput( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int inputEnable) // \arg PIO to be enabled +{ + // Disable output + pPio->PIO_ODR = inputEnable; + pPio->PIO_PER = inputEnable; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgOpendrain +//* \brief Configure PIO in open drain +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgOpendrain( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int multiDrvEnable) // \arg pio to be configured in open drain +{ + // Configure the multi-drive option + pPio->PIO_MDDR = ~multiDrvEnable; + pPio->PIO_MDER = multiDrvEnable; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgPullup +//* \brief Enable pullup on PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgPullup( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int pullupEnable) // \arg enable pullup on PIO +{ + // Connect or not Pullup + pPio->PIO_PPUDR = ~pullupEnable; + pPio->PIO_PPUER = pullupEnable; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgDirectDrive +//* \brief Enable direct drive on PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgDirectDrive( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int directDrive) // \arg PIO to be configured with direct drive + +{ + // Configure the Direct Drive + pPio->PIO_OWDR = ~directDrive; + pPio->PIO_OWER = directDrive; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgInputFilter +//* \brief Enable input filter on input PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgInputFilter( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int inputFilter) // \arg PIO to be configured with input filter + +{ + // Configure the Direct Drive + pPio->PIO_IFDR = ~inputFilter; + pPio->PIO_IFER = inputFilter; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetInput +//* \brief Return PIO input value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetInput( // \return PIO input + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_PDSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsInputSet +//* \brief Test if PIO is input flag is active +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsInputSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetInput(pPio) & flag); +} + + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_SetOutput +//* \brief Set to 1 output PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_SetOutput( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg output to be set +{ + pPio->PIO_SODR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_ClearOutput +//* \brief Set to 0 output PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_ClearOutput( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg output to be cleared +{ + pPio->PIO_CODR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_ForceOutput +//* \brief Force output when Direct drive option is enabled +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_ForceOutput( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg output to be forced +{ + pPio->PIO_ODSR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_Enable +//* \brief Enable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_Enable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio to be enabled +{ + pPio->PIO_PER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_Disable +//* \brief Disable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_Disable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio to be disabled +{ + pPio->PIO_PDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetStatus +//* \brief Return PIO Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetStatus( // \return PIO Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_PSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsSet +//* \brief Test if PIO is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_OutputEnable +//* \brief Output Enable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_OutputEnable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio output to be enabled +{ + pPio->PIO_OER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_OutputDisable +//* \brief Output Enable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_OutputDisable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio output to be disabled +{ + pPio->PIO_ODR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetOutputStatus +//* \brief Return PIO Output Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetOutputStatus( // \return PIO Output Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_OSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsOuputSet +//* \brief Test if PIO Output is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsOutputSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetOutputStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_InputFilterEnable +//* \brief Input Filter Enable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_InputFilterEnable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio input filter to be enabled +{ + pPio->PIO_IFER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_InputFilterDisable +//* \brief Input Filter Disable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_InputFilterDisable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio input filter to be disabled +{ + pPio->PIO_IFDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetInputFilterStatus +//* \brief Return PIO Input Filter Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetInputFilterStatus( // \return PIO Input Filter Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_IFSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsInputFilterSet +//* \brief Test if PIO Input filter is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsInputFilterSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetInputFilterStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetOutputDataStatus +//* \brief Return PIO Output Data Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetOutputDataStatus( // \return PIO Output Data Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_ODSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_InterruptEnable +//* \brief Enable PIO Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_InterruptEnable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio interrupt to be enabled +{ + pPio->PIO_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_InterruptDisable +//* \brief Disable PIO Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_InterruptDisable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio interrupt to be disabled +{ + pPio->PIO_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetInterruptMaskStatus +//* \brief Return PIO Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetInterruptMaskStatus( // \return PIO Interrupt Mask Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetInterruptStatus +//* \brief Return PIO Interrupt Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetInterruptStatus( // \return PIO Interrupt Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_ISR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsInterruptMasked +//* \brief Test if PIO Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsInterruptMasked( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetInterruptMaskStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsInterruptSet +//* \brief Test if PIO Interrupt is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsInterruptSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetInterruptStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_MultiDriverEnable +//* \brief Multi Driver Enable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_MultiDriverEnable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio to be enabled +{ + pPio->PIO_MDER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_MultiDriverDisable +//* \brief Multi Driver Disable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_MultiDriverDisable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio to be disabled +{ + pPio->PIO_MDDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetMultiDriverStatus +//* \brief Return PIO Multi Driver Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetMultiDriverStatus( // \return PIO Multi Driver Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_MDSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsMultiDriverSet +//* \brief Test if PIO MultiDriver is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsMultiDriverSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetMultiDriverStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_A_RegisterSelection +//* \brief PIO A Register Selection +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_A_RegisterSelection( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio A register selection +{ + pPio->PIO_ASR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_B_RegisterSelection +//* \brief PIO B Register Selection +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_B_RegisterSelection( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio B register selection +{ + pPio->PIO_BSR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_Get_AB_RegisterStatus +//* \brief Return PIO Interrupt Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_Get_AB_RegisterStatus( // \return PIO AB Register Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_ABSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsAB_RegisterSet +//* \brief Test if PIO AB Register is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsAB_RegisterSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_Get_AB_RegisterStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_OutputWriteEnable +//* \brief Output Write Enable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_OutputWriteEnable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio output write to be enabled +{ + pPio->PIO_OWER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_OutputWriteDisable +//* \brief Output Write Disable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_OutputWriteDisable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio output write to be disabled +{ + pPio->PIO_OWDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetOutputWriteStatus +//* \brief Return PIO Output Write Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetOutputWriteStatus( // \return PIO Output Write Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_OWSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsOutputWriteSet +//* \brief Test if PIO OutputWrite is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsOutputWriteSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetOutputWriteStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetCfgPullup +//* \brief Return PIO Configuration Pullup +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetCfgPullup( // \return PIO Configuration Pullup + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_PPUSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsOutputDataStatusSet +//* \brief Test if PIO Output Data Status is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsOutputDataStatusSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetOutputDataStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsCfgPullupStatusSet +//* \brief Test if PIO Configuration Pullup Status is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsCfgPullupStatusSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (~AT91F_PIO_GetCfgPullup(pPio) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR PMC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_CfgSysClkEnableReg +//* \brief Configure the System Clock Enable Register of the PMC controller +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_CfgSysClkEnableReg ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int mode) +{ + //* Write to the SCER register + pPMC->PMC_SCER = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_CfgSysClkDisableReg +//* \brief Configure the System Clock Disable Register of the PMC controller +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_CfgSysClkDisableReg ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int mode) +{ + //* Write to the SCDR register + pPMC->PMC_SCDR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_GetSysClkStatusReg +//* \brief Return the System Clock Status Register of the PMC controller +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_GetSysClkStatusReg ( + AT91PS_PMC pPMC // pointer to a CAN controller + ) +{ + return pPMC->PMC_SCSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_EnablePeriphClock +//* \brief Enable peripheral clock +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_EnablePeriphClock ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int periphIds) // \arg IDs of peripherals +{ + pPMC->PMC_PCER = periphIds; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_DisablePeriphClock +//* \brief Disable peripheral clock +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_DisablePeriphClock ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int periphIds) // \arg IDs of peripherals +{ + pPMC->PMC_PCDR = periphIds; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_GetPeriphClock +//* \brief Get peripheral clock status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_GetPeriphClock ( + AT91PS_PMC pPMC) // \arg pointer to PMC controller +{ + return pPMC->PMC_PCSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_CfgMainOscillatorReg +//* \brief Cfg the main oscillator +//*---------------------------------------------------------------------------- +__inline void AT91F_CKGR_CfgMainOscillatorReg ( + AT91PS_CKGR pCKGR, // \arg pointer to CKGR controller + unsigned int mode) +{ + pCKGR->CKGR_MOR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_GetMainOscillatorReg +//* \brief Cfg the main oscillator +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CKGR_GetMainOscillatorReg ( + AT91PS_CKGR pCKGR) // \arg pointer to CKGR controller +{ + return pCKGR->CKGR_MOR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_EnableMainOscillator +//* \brief Enable the main oscillator +//*---------------------------------------------------------------------------- +__inline void AT91F_CKGR_EnableMainOscillator( + AT91PS_CKGR pCKGR) // \arg pointer to CKGR controller +{ + pCKGR->CKGR_MOR |= AT91C_CKGR_MOSCEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_DisableMainOscillator +//* \brief Disable the main oscillator +//*---------------------------------------------------------------------------- +__inline void AT91F_CKGR_DisableMainOscillator ( + AT91PS_CKGR pCKGR) // \arg pointer to CKGR controller +{ + pCKGR->CKGR_MOR &= ~AT91C_CKGR_MOSCEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_CfgMainOscStartUpTime +//* \brief Cfg MOR Register according to the main osc startup time +//*---------------------------------------------------------------------------- +__inline void AT91F_CKGR_CfgMainOscStartUpTime ( + AT91PS_CKGR pCKGR, // \arg pointer to CKGR controller + unsigned int startup_time, // \arg main osc startup time in microsecond (us) + unsigned int slowClock) // \arg slowClock in Hz +{ + pCKGR->CKGR_MOR &= ~AT91C_CKGR_OSCOUNT; + pCKGR->CKGR_MOR |= ((slowClock * startup_time)/(8*1000000)) << 8; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_GetMainClockFreqReg +//* \brief Cfg the main oscillator +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CKGR_GetMainClockFreqReg ( + AT91PS_CKGR pCKGR) // \arg pointer to CKGR controller +{ + return pCKGR->CKGR_MCFR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_GetMainClock +//* \brief Return Main clock in Hz +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CKGR_GetMainClock ( + AT91PS_CKGR pCKGR, // \arg pointer to CKGR controller + unsigned int slowClock) // \arg slowClock in Hz +{ + return ((pCKGR->CKGR_MCFR & AT91C_CKGR_MAINF) * slowClock) >> 4; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_CfgMCKReg +//* \brief Cfg Master Clock Register +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_CfgMCKReg ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int mode) +{ + pPMC->PMC_MCKR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_GetMCKReg +//* \brief Return Master Clock Register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_GetMCKReg( + AT91PS_PMC pPMC) // \arg pointer to PMC controller +{ + return pPMC->PMC_MCKR; +} + +//*------------------------------------------------------------------------------ +//* \fn AT91F_PMC_GetMasterClock +//* \brief Return master clock in Hz which correponds to processor clock for ARM7 +//*------------------------------------------------------------------------------ +__inline unsigned int AT91F_PMC_GetMasterClock ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + AT91PS_CKGR pCKGR, // \arg pointer to CKGR controller + unsigned int slowClock) // \arg slowClock in Hz +{ + unsigned int reg = pPMC->PMC_MCKR; + unsigned int prescaler = (1 << ((reg & AT91C_PMC_PRES) >> 2)); + unsigned int pllDivider, pllMultiplier; + + switch (reg & AT91C_PMC_CSS) { + case AT91C_PMC_CSS_SLOW_CLK: // Slow clock selected + return slowClock / prescaler; + case AT91C_PMC_CSS_MAIN_CLK: // Main clock is selected + return AT91F_CKGR_GetMainClock(pCKGR, slowClock) / prescaler; + case AT91C_PMC_CSS_PLL_CLK: // PLLB clock is selected + reg = pCKGR->CKGR_PLLR; + pllDivider = (reg & AT91C_CKGR_DIV); + pllMultiplier = ((reg & AT91C_CKGR_MUL) >> 16) + 1; + return AT91F_CKGR_GetMainClock(pCKGR, slowClock) / pllDivider * pllMultiplier / prescaler; + } + return 0; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_EnablePCK +//* \brief Enable Programmable Clock x Output +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_EnablePCK ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int pck, // \arg Programmable Clock x Output + unsigned int mode) +{ + pPMC->PMC_PCKR[pck] = mode; + pPMC->PMC_SCER = (1 << pck) << 8; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_DisablePCK +//* \brief Disable Programmable Clock x Output +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_DisablePCK ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int pck) // \arg Programmable Clock x Output +{ + pPMC->PMC_SCDR = (1 << pck) << 8; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_EnableIt +//* \brief Enable PMC interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_EnableIt ( + AT91PS_PMC pPMC, // pointer to a PMC controller + unsigned int flag) // IT to be enabled +{ + //* Write to the IER register + pPMC->PMC_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_DisableIt +//* \brief Disable PMC interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_DisableIt ( + AT91PS_PMC pPMC, // pointer to a PMC controller + unsigned int flag) // IT to be disabled +{ + //* Write to the IDR register + pPMC->PMC_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_GetStatus +//* \brief Return PMC Interrupt Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_GetStatus( // \return PMC Interrupt Status + AT91PS_PMC pPMC) // pointer to a PMC controller +{ + return pPMC->PMC_SR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_GetInterruptMaskStatus +//* \brief Return PMC Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_GetInterruptMaskStatus( // \return PMC Interrupt Mask Status + AT91PS_PMC pPMC) // pointer to a PMC controller +{ + return pPMC->PMC_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_IsInterruptMasked +//* \brief Test if PMC Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_IsInterruptMasked( + AT91PS_PMC pPMC, // \arg pointer to a PMC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PMC_GetInterruptMaskStatus(pPMC) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_IsStatusSet +//* \brief Test if PMC Status is Set +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_IsStatusSet( + AT91PS_PMC pPMC, // \arg pointer to a PMC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PMC_GetStatus(pPMC) & flag); +} + +// ---------------------------------------------------------------------------- +// \fn AT91F_CKGR_CfgPLLReg +// \brief Cfg the PLL Register +// ---------------------------------------------------------------------------- +__inline void AT91F_CKGR_CfgPLLReg ( + AT91PS_CKGR pCKGR, // \arg pointer to CKGR controller + unsigned int mode) +{ + pCKGR->CKGR_PLLR = mode; +} + +// ---------------------------------------------------------------------------- +// \fn AT91F_CKGR_GetPLLReg +// \brief Get the PLL Register +// ---------------------------------------------------------------------------- +__inline unsigned int AT91F_CKGR_GetPLLReg ( + AT91PS_CKGR pCKGR) // \arg pointer to CKGR controller +{ + return pCKGR->CKGR_PLLR; +} + + +/* ***************************************************************************** + SOFTWARE API FOR RSTC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_RSTSoftReset +//* \brief Start Software Reset +//*---------------------------------------------------------------------------- +__inline void AT91F_RSTSoftReset( + AT91PS_RSTC pRSTC, + unsigned int reset) +{ + pRSTC->RSTC_RCR = (0xA5000000 | reset); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_RSTSetMode +//* \brief Set Reset Mode +//*---------------------------------------------------------------------------- +__inline void AT91F_RSTSetMode( + AT91PS_RSTC pRSTC, + unsigned int mode) +{ + pRSTC->RSTC_RMR = (0xA5000000 | mode); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_RSTGetMode +//* \brief Get Reset Mode +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_RSTGetMode( + AT91PS_RSTC pRSTC) +{ + return (pRSTC->RSTC_RMR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_RSTGetStatus +//* \brief Get Reset Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_RSTGetStatus( + AT91PS_RSTC pRSTC) +{ + return (pRSTC->RSTC_RSR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_RSTIsSoftRstActive +//* \brief Return !=0 if software reset is still not completed +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_RSTIsSoftRstActive( + AT91PS_RSTC pRSTC) +{ + return ((pRSTC->RSTC_RSR) & AT91C_RSTC_SRCMP); +} +/* ***************************************************************************** + SOFTWARE API FOR RTTC + ***************************************************************************** */ +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_SetRTT_TimeBase() +//* \brief Set the RTT prescaler according to the TimeBase in ms +//*-------------------------------------------------------------------------------------- +__inline unsigned int AT91F_RTTSetTimeBase( + AT91PS_RTTC pRTTC, + unsigned int ms) +{ + if (ms > 2000) + return 1; // AT91C_TIME_OUT_OF_RANGE + pRTTC->RTTC_RTMR &= ~0xFFFF; + pRTTC->RTTC_RTMR |= (((ms << 15) /1000) & 0xFFFF); + return 0; +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTTSetPrescaler() +//* \brief Set the new prescaler value +//*-------------------------------------------------------------------------------------- +__inline unsigned int AT91F_RTTSetPrescaler( + AT91PS_RTTC pRTTC, + unsigned int rtpres) +{ + pRTTC->RTTC_RTMR &= ~0xFFFF; + pRTTC->RTTC_RTMR |= (rtpres & 0xFFFF); + return (pRTTC->RTTC_RTMR); +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTTRestart() +//* \brief Restart the RTT prescaler +//*-------------------------------------------------------------------------------------- +__inline void AT91F_RTTRestart( + AT91PS_RTTC pRTTC) +{ + pRTTC->RTTC_RTMR |= AT91C_RTTC_RTTRST; +} + + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_SetAlarmINT() +//* \brief Enable RTT Alarm Interrupt +//*-------------------------------------------------------------------------------------- +__inline void AT91F_RTTSetAlarmINT( + AT91PS_RTTC pRTTC) +{ + pRTTC->RTTC_RTMR |= AT91C_RTTC_ALMIEN; +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_ClearAlarmINT() +//* \brief Disable RTT Alarm Interrupt +//*-------------------------------------------------------------------------------------- +__inline void AT91F_RTTClearAlarmINT( + AT91PS_RTTC pRTTC) +{ + pRTTC->RTTC_RTMR &= ~AT91C_RTTC_ALMIEN; +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_SetRttIncINT() +//* \brief Enable RTT INC Interrupt +//*-------------------------------------------------------------------------------------- +__inline void AT91F_RTTSetRttIncINT( + AT91PS_RTTC pRTTC) +{ + pRTTC->RTTC_RTMR |= AT91C_RTTC_RTTINCIEN; +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_ClearRttIncINT() +//* \brief Disable RTT INC Interrupt +//*-------------------------------------------------------------------------------------- +__inline void AT91F_RTTClearRttIncINT( + AT91PS_RTTC pRTTC) +{ + pRTTC->RTTC_RTMR &= ~AT91C_RTTC_RTTINCIEN; +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_SetAlarmValue() +//* \brief Set RTT Alarm Value +//*-------------------------------------------------------------------------------------- +__inline void AT91F_RTTSetAlarmValue( + AT91PS_RTTC pRTTC, unsigned int alarm) +{ + pRTTC->RTTC_RTAR = alarm; +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_GetAlarmValue() +//* \brief Get RTT Alarm Value +//*-------------------------------------------------------------------------------------- +__inline unsigned int AT91F_RTTGetAlarmValue( + AT91PS_RTTC pRTTC) +{ + return(pRTTC->RTTC_RTAR); +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTTGetStatus() +//* \brief Read the RTT status +//*-------------------------------------------------------------------------------------- +__inline unsigned int AT91F_RTTGetStatus( + AT91PS_RTTC pRTTC) +{ + return(pRTTC->RTTC_RTSR); +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_ReadValue() +//* \brief Read the RTT value +//*-------------------------------------------------------------------------------------- +__inline unsigned int AT91F_RTTReadValue( + AT91PS_RTTC pRTTC) +{ + register volatile unsigned int val1,val2; + do + { + val1 = pRTTC->RTTC_RTVR; + val2 = pRTTC->RTTC_RTVR; + } + while(val1 != val2); + return(val1); +} +/* ***************************************************************************** + SOFTWARE API FOR PITC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITInit +//* \brief System timer init : period in µsecond, system clock freq in MHz +//*---------------------------------------------------------------------------- +__inline void AT91F_PITInit( + AT91PS_PITC pPITC, + unsigned int period, + unsigned int pit_frequency) +{ + pPITC->PITC_PIMR = period? (period * pit_frequency + 8) >> 4 : 0; // +8 to avoid %10 and /10 + pPITC->PITC_PIMR |= AT91C_PITC_PITEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITSetPIV +//* \brief Set the PIT Periodic Interval Value +//*---------------------------------------------------------------------------- +__inline void AT91F_PITSetPIV( + AT91PS_PITC pPITC, + unsigned int piv) +{ + pPITC->PITC_PIMR = piv | (pPITC->PITC_PIMR & (AT91C_PITC_PITEN | AT91C_PITC_PITIEN)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITEnableInt +//* \brief Enable PIT periodic interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PITEnableInt( + AT91PS_PITC pPITC) +{ + pPITC->PITC_PIMR |= AT91C_PITC_PITIEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITDisableInt +//* \brief Disable PIT periodic interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PITDisableInt( + AT91PS_PITC pPITC) +{ + pPITC->PITC_PIMR &= ~AT91C_PITC_PITIEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITGetMode +//* \brief Read PIT mode register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PITGetMode( + AT91PS_PITC pPITC) +{ + return(pPITC->PITC_PIMR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITGetStatus +//* \brief Read PIT status register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PITGetStatus( + AT91PS_PITC pPITC) +{ + return(pPITC->PITC_PISR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITGetPIIR +//* \brief Read PIT CPIV and PICNT without ressetting the counters +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PITGetPIIR( + AT91PS_PITC pPITC) +{ + return(pPITC->PITC_PIIR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITGetPIVR +//* \brief Read System timer CPIV and PICNT without ressetting the counters +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PITGetPIVR( + AT91PS_PITC pPITC) +{ + return(pPITC->PITC_PIVR); +} +/* ***************************************************************************** + SOFTWARE API FOR WDTC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_WDTSetMode +//* \brief Set Watchdog Mode Register +//*---------------------------------------------------------------------------- +__inline void AT91F_WDTSetMode( + AT91PS_WDTC pWDTC, + unsigned int Mode) +{ + pWDTC->WDTC_WDMR = Mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_WDTRestart +//* \brief Restart Watchdog +//*---------------------------------------------------------------------------- +__inline void AT91F_WDTRestart( + AT91PS_WDTC pWDTC) +{ + pWDTC->WDTC_WDCR = 0xA5000001; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_WDTSGettatus +//* \brief Get Watchdog Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_WDTSGettatus( + AT91PS_WDTC pWDTC) +{ + return(pWDTC->WDTC_WDSR & 0x3); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_WDTGetPeriod +//* \brief Translate ms into Watchdog Compatible value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_WDTGetPeriod(unsigned int ms) +{ + if ((ms < 4) || (ms > 16000)) + return 0; + return((ms << 8) / 1000); +} +/* ***************************************************************************** + SOFTWARE API FOR VREG + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_VREG_Enable_LowPowerMode +//* \brief Enable VREG Low Power Mode +//*---------------------------------------------------------------------------- +__inline void AT91F_VREG_Enable_LowPowerMode( + AT91PS_VREG pVREG) +{ + pVREG->VREG_MR |= AT91C_VREG_PSTDBY; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_VREG_Disable_LowPowerMode +//* \brief Disable VREG Low Power Mode +//*---------------------------------------------------------------------------- +__inline void AT91F_VREG_Disable_LowPowerMode( + AT91PS_VREG pVREG) +{ + pVREG->VREG_MR &= ~AT91C_VREG_PSTDBY; +}/* ***************************************************************************** + SOFTWARE API FOR MC + ***************************************************************************** */ + +#define AT91C_MC_CORRECT_KEY ((unsigned int) 0x5A << 24) // (MC) Correct Protect Key + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_Remap +//* \brief Make Remap +//*---------------------------------------------------------------------------- +__inline void AT91F_MC_Remap (void) // +{ + AT91PS_MC pMC = (AT91PS_MC) AT91C_BASE_MC; + + pMC->MC_RCR = AT91C_MC_RCB; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_CfgModeReg +//* \brief Configure the EFC Mode Register of the MC controller +//*---------------------------------------------------------------------------- +__inline void AT91F_MC_EFC_CfgModeReg ( + AT91PS_MC pMC, // pointer to a MC controller + unsigned int mode) // mode register +{ + // Write to the FMR register + pMC->MC_FMR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_GetModeReg +//* \brief Return MC EFC Mode Regsiter +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_MC_EFC_GetModeReg( + AT91PS_MC pMC) // pointer to a MC controller +{ + return pMC->MC_FMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_ComputeFMCN +//* \brief Return MC EFC Mode Regsiter +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_MC_EFC_ComputeFMCN( + int master_clock) // master clock in Hz +{ + return (master_clock/1000000 +2); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_PerformCmd +//* \brief Perform EFC Command +//*---------------------------------------------------------------------------- +__inline void AT91F_MC_EFC_PerformCmd ( + AT91PS_MC pMC, // pointer to a MC controller + unsigned int transfer_cmd) +{ + pMC->MC_FCR = transfer_cmd; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_GetStatus +//* \brief Return MC EFC Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_MC_EFC_GetStatus( + AT91PS_MC pMC) // pointer to a MC controller +{ + return pMC->MC_FSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_IsInterruptMasked +//* \brief Test if EFC MC Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_MC_EFC_IsInterruptMasked( + AT91PS_MC pMC, // \arg pointer to a MC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_MC_EFC_GetModeReg(pMC) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_IsInterruptSet +//* \brief Test if EFC MC Interrupt is Set +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_MC_EFC_IsInterruptSet( + AT91PS_MC pMC, // \arg pointer to a MC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_MC_EFC_GetStatus(pMC) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR SPI + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_CfgCs +//* \brief Configure SPI chip select register +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_CfgCs ( + AT91PS_SPI pSPI, // pointer to a SPI controller + int cs, // SPI cs number (0 to 3) + int val) // chip select register +{ + //* Write to the CSR register + *(pSPI->SPI_CSR + cs) = val; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_EnableIt +//* \brief Enable SPI interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_EnableIt ( + AT91PS_SPI pSPI, // pointer to a SPI controller + unsigned int flag) // IT to be enabled +{ + //* Write to the IER register + pSPI->SPI_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_DisableIt +//* \brief Disable SPI interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_DisableIt ( + AT91PS_SPI pSPI, // pointer to a SPI controller + unsigned int flag) // IT to be disabled +{ + //* Write to the IDR register + pSPI->SPI_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_Reset +//* \brief Reset the SPI controller +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_Reset ( + AT91PS_SPI pSPI // pointer to a SPI controller + ) +{ + //* Write to the CR register + pSPI->SPI_CR = AT91C_SPI_SWRST; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_Enable +//* \brief Enable the SPI controller +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_Enable ( + AT91PS_SPI pSPI // pointer to a SPI controller + ) +{ + //* Write to the CR register + pSPI->SPI_CR = AT91C_SPI_SPIEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_Disable +//* \brief Disable the SPI controller +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_Disable ( + AT91PS_SPI pSPI // pointer to a SPI controller + ) +{ + //* Write to the CR register + pSPI->SPI_CR = AT91C_SPI_SPIDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_CfgMode +//* \brief Enable the SPI controller +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_CfgMode ( + AT91PS_SPI pSPI, // pointer to a SPI controller + int mode) // mode register +{ + //* Write to the MR register + pSPI->SPI_MR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_CfgPCS +//* \brief Switch to the correct PCS of SPI Mode Register : Fixed Peripheral Selected +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_CfgPCS ( + AT91PS_SPI pSPI, // pointer to a SPI controller + char PCS_Device) // PCS of the Device +{ + //* Write to the MR register + pSPI->SPI_MR &= 0xFFF0FFFF; + pSPI->SPI_MR |= ( (PCS_Device<<16) & AT91C_SPI_PCS ); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_ReceiveFrame +//* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initializaed with Next Buffer, 0 if PDC is busy +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_SPI_ReceiveFrame ( + AT91PS_SPI pSPI, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + return AT91F_PDC_ReceiveFrame( + (AT91PS_PDC) &(pSPI->SPI_RPR), + pBuffer, + szBuffer, + pNextBuffer, + szNextBuffer); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_SendFrame +//* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initializaed with Next Buffer, 0 if PDC is bSPIy +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_SPI_SendFrame( + AT91PS_SPI pSPI, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + return AT91F_PDC_SendFrame( + (AT91PS_PDC) &(pSPI->SPI_RPR), + pBuffer, + szBuffer, + pNextBuffer, + szNextBuffer); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_Close +//* \brief Close SPI: disable IT disable transfert, close PDC +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_Close ( + AT91PS_SPI pSPI) // \arg pointer to a SPI controller +{ + //* Reset all the Chip Select register + pSPI->SPI_CSR[0] = 0 ; + pSPI->SPI_CSR[1] = 0 ; + pSPI->SPI_CSR[2] = 0 ; + pSPI->SPI_CSR[3] = 0 ; + + //* Reset the SPI mode + pSPI->SPI_MR = 0 ; + + //* Disable all interrupts + pSPI->SPI_IDR = 0xFFFFFFFF ; + + //* Abort the Peripheral Data Transfers + AT91F_PDC_Close((AT91PS_PDC) &(pSPI->SPI_RPR)); + + //* Disable receiver and transmitter and stop any activity immediately + pSPI->SPI_CR = AT91C_SPI_SPIDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_PutChar +//* \brief Send a character,does not check if ready to send +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_PutChar ( + AT91PS_SPI pSPI, + unsigned int character, + unsigned int cs_number ) +{ + unsigned int value_for_cs; + value_for_cs = (~(1 << cs_number)) & 0xF; //Place a zero among a 4 ONEs number + pSPI->SPI_TDR = (character & 0xFFFF) | (value_for_cs << 16); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_GetChar +//* \brief Receive a character,does not check if a character is available +//*---------------------------------------------------------------------------- +__inline int AT91F_SPI_GetChar ( + const AT91PS_SPI pSPI) +{ + return((pSPI->SPI_RDR) & 0xFFFF); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_GetInterruptMaskStatus +//* \brief Return SPI Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_SPI_GetInterruptMaskStatus( // \return SPI Interrupt Mask Status + AT91PS_SPI pSpi) // \arg pointer to a SPI controller +{ + return pSpi->SPI_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_IsInterruptMasked +//* \brief Test if SPI Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_SPI_IsInterruptMasked( + AT91PS_SPI pSpi, // \arg pointer to a SPI controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_SPI_GetInterruptMaskStatus(pSpi) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR USART + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_Baudrate +//* \brief Calculate the baudrate +//* Standard Asynchronous Mode : 8 bits , 1 stop , no parity +#define AT91C_US_ASYNC_MODE ( AT91C_US_USMODE_NORMAL + \ + AT91C_US_NBSTOP_1_BIT + \ + AT91C_US_PAR_NONE + \ + AT91C_US_CHRL_8_BITS + \ + AT91C_US_CLKS_CLOCK ) + +//* Standard External Asynchronous Mode : 8 bits , 1 stop , no parity +#define AT91C_US_ASYNC_SCK_MODE ( AT91C_US_USMODE_NORMAL + \ + AT91C_US_NBSTOP_1_BIT + \ + AT91C_US_PAR_NONE + \ + AT91C_US_CHRL_8_BITS + \ + AT91C_US_CLKS_EXT ) + +//* Standard Synchronous Mode : 8 bits , 1 stop , no parity +#define AT91C_US_SYNC_MODE ( AT91C_US_SYNC + \ + AT91C_US_USMODE_NORMAL + \ + AT91C_US_NBSTOP_1_BIT + \ + AT91C_US_PAR_NONE + \ + AT91C_US_CHRL_8_BITS + \ + AT91C_US_CLKS_CLOCK ) + +//* SCK used Label +#define AT91C_US_SCK_USED (AT91C_US_CKLO | AT91C_US_CLKS_EXT) + +//* Standard ISO T=0 Mode : 8 bits , 1 stop , parity +#define AT91C_US_ISO_READER_MODE ( AT91C_US_USMODE_ISO7816_0 + \ + AT91C_US_CLKS_CLOCK +\ + AT91C_US_NBSTOP_1_BIT + \ + AT91C_US_PAR_EVEN + \ + AT91C_US_CHRL_8_BITS + \ + AT91C_US_CKLO +\ + AT91C_US_OVER) + +//* Standard IRDA mode +#define AT91C_US_ASYNC_IRDA_MODE ( AT91C_US_USMODE_IRDA + \ + AT91C_US_NBSTOP_1_BIT + \ + AT91C_US_PAR_NONE + \ + AT91C_US_CHRL_8_BITS + \ + AT91C_US_CLKS_CLOCK ) + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_Baudrate +//* \brief Caluculate baud_value according to the main clock and the baud rate +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_US_Baudrate ( + const unsigned int main_clock, // \arg peripheral clock + const unsigned int baud_rate) // \arg UART baudrate +{ + unsigned int baud_value = ((main_clock*10)/(baud_rate * 16)); + if ((baud_value % 10) >= 5) + baud_value = (baud_value / 10) + 1; + else + baud_value /= 10; + return baud_value; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_SetBaudrate +//* \brief Set the baudrate according to the CPU clock +//*---------------------------------------------------------------------------- +__inline void AT91F_US_SetBaudrate ( + AT91PS_USART pUSART, // \arg pointer to a USART controller + unsigned int mainClock, // \arg peripheral clock + unsigned int speed) // \arg UART baudrate +{ + //* Define the baud rate divisor register + pUSART->US_BRGR = AT91F_US_Baudrate(mainClock, speed); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_SetTimeguard +//* \brief Set USART timeguard +//*---------------------------------------------------------------------------- +__inline void AT91F_US_SetTimeguard ( + AT91PS_USART pUSART, // \arg pointer to a USART controller + unsigned int timeguard) // \arg timeguard value +{ + //* Write the Timeguard Register + pUSART->US_TTGR = timeguard ; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_EnableIt +//* \brief Enable USART IT +//*---------------------------------------------------------------------------- +__inline void AT91F_US_EnableIt ( + AT91PS_USART pUSART, // \arg pointer to a USART controller + unsigned int flag) // \arg IT to be enabled +{ + //* Write to the IER register + pUSART->US_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_DisableIt +//* \brief Disable USART IT +//*---------------------------------------------------------------------------- +__inline void AT91F_US_DisableIt ( + AT91PS_USART pUSART, // \arg pointer to a USART controller + unsigned int flag) // \arg IT to be disabled +{ + //* Write to the IER register + pUSART->US_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_Configure +//* \brief Configure USART +//*---------------------------------------------------------------------------- +__inline void AT91F_US_Configure ( + AT91PS_USART pUSART, // \arg pointer to a USART controller + unsigned int mainClock, // \arg peripheral clock + unsigned int mode , // \arg mode Register to be programmed + unsigned int baudRate , // \arg baudrate to be programmed + unsigned int timeguard ) // \arg timeguard to be programmed +{ + //* Disable interrupts + pUSART->US_IDR = (unsigned int) -1; + + //* Reset receiver and transmitter + pUSART->US_CR = AT91C_US_RSTRX | AT91C_US_RSTTX | AT91C_US_RXDIS | AT91C_US_TXDIS ; + + //* Define the baud rate divisor register + AT91F_US_SetBaudrate(pUSART, mainClock, baudRate); + + //* Write the Timeguard Register + AT91F_US_SetTimeguard(pUSART, timeguard); + + //* Clear Transmit and Receive Counters + AT91F_PDC_Open((AT91PS_PDC) &(pUSART->US_RPR)); + + //* Define the USART mode + pUSART->US_MR = mode ; + +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_EnableRx +//* \brief Enable receiving characters +//*---------------------------------------------------------------------------- +__inline void AT91F_US_EnableRx ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Enable receiver + pUSART->US_CR = AT91C_US_RXEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_EnableTx +//* \brief Enable sending characters +//*---------------------------------------------------------------------------- +__inline void AT91F_US_EnableTx ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Enable transmitter + pUSART->US_CR = AT91C_US_TXEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_ResetRx +//* \brief Reset Receiver and re-enable it +//*---------------------------------------------------------------------------- +__inline void AT91F_US_ResetRx ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Reset receiver + pUSART->US_CR = AT91C_US_RSTRX; + //* Re-Enable receiver + pUSART->US_CR = AT91C_US_RXEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_ResetTx +//* \brief Reset Transmitter and re-enable it +//*---------------------------------------------------------------------------- +__inline void AT91F_US_ResetTx ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Reset transmitter + pUSART->US_CR = AT91C_US_RSTTX; + //* Enable transmitter + pUSART->US_CR = AT91C_US_TXEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_DisableRx +//* \brief Disable Receiver +//*---------------------------------------------------------------------------- +__inline void AT91F_US_DisableRx ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Disable receiver + pUSART->US_CR = AT91C_US_RXDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_DisableTx +//* \brief Disable Transmitter +//*---------------------------------------------------------------------------- +__inline void AT91F_US_DisableTx ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Disable transmitter + pUSART->US_CR = AT91C_US_TXDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_Close +//* \brief Close USART: disable IT disable receiver and transmitter, close PDC +//*---------------------------------------------------------------------------- +__inline void AT91F_US_Close ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Reset the baud rate divisor register + pUSART->US_BRGR = 0 ; + + //* Reset the USART mode + pUSART->US_MR = 0 ; + + //* Reset the Timeguard Register + pUSART->US_TTGR = 0; + + //* Disable all interrupts + pUSART->US_IDR = 0xFFFFFFFF ; + + //* Abort the Peripheral Data Transfers + AT91F_PDC_Close((AT91PS_PDC) &(pUSART->US_RPR)); + + //* Disable receiver and transmitter and stop any activity immediately + pUSART->US_CR = AT91C_US_TXDIS | AT91C_US_RXDIS | AT91C_US_RSTTX | AT91C_US_RSTRX ; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_TxReady +//* \brief Return 1 if a character can be written in US_THR +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_US_TxReady ( + AT91PS_USART pUSART ) // \arg pointer to a USART controller +{ + return (pUSART->US_CSR & AT91C_US_TXRDY); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_RxReady +//* \brief Return 1 if a character can be read in US_RHR +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_US_RxReady ( + AT91PS_USART pUSART ) // \arg pointer to a USART controller +{ + return (pUSART->US_CSR & AT91C_US_RXRDY); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_Error +//* \brief Return the error flag +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_US_Error ( + AT91PS_USART pUSART ) // \arg pointer to a USART controller +{ + return (pUSART->US_CSR & + (AT91C_US_OVRE | // Overrun error + AT91C_US_FRAME | // Framing error + AT91C_US_PARE)); // Parity error +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_PutChar +//* \brief Send a character,does not check if ready to send +//*---------------------------------------------------------------------------- +__inline void AT91F_US_PutChar ( + AT91PS_USART pUSART, + int character ) +{ + pUSART->US_THR = (character & 0x1FF); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_GetChar +//* \brief Receive a character,does not check if a character is available +//*---------------------------------------------------------------------------- +__inline int AT91F_US_GetChar ( + const AT91PS_USART pUSART) +{ + return((pUSART->US_RHR) & 0x1FF); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_SendFrame +//* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initializaed with Next Buffer, 0 if PDC is busy +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_US_SendFrame( + AT91PS_USART pUSART, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + return AT91F_PDC_SendFrame( + (AT91PS_PDC) &(pUSART->US_RPR), + pBuffer, + szBuffer, + pNextBuffer, + szNextBuffer); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_ReceiveFrame +//* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initializaed with Next Buffer, 0 if PDC is busy +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_US_ReceiveFrame ( + AT91PS_USART pUSART, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + return AT91F_PDC_ReceiveFrame( + (AT91PS_PDC) &(pUSART->US_RPR), + pBuffer, + szBuffer, + pNextBuffer, + szNextBuffer); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_SetIrdaFilter +//* \brief Set the value of IrDa filter tregister +//*---------------------------------------------------------------------------- +__inline void AT91F_US_SetIrdaFilter ( + AT91PS_USART pUSART, + unsigned char value +) +{ + pUSART->US_IF = value; +} + +/* ***************************************************************************** + SOFTWARE API FOR SSC + ***************************************************************************** */ +//* Define the standard I2S mode configuration + +//* Configuration to set in the SSC Transmit Clock Mode Register +//* Parameters : nb_bit_by_slot : 8, 16 or 32 bits +//* nb_slot_by_frame : number of channels +#define AT91C_I2S_ASY_MASTER_TX_SETTING(nb_bit_by_slot, nb_slot_by_frame)( +\ + AT91C_SSC_CKS_DIV +\ + AT91C_SSC_CKO_CONTINOUS +\ + AT91C_SSC_CKG_NONE +\ + AT91C_SSC_START_FALL_RF +\ + AT91C_SSC_STTOUT +\ + ((1<<16) & AT91C_SSC_STTDLY) +\ + ((((nb_bit_by_slot*nb_slot_by_frame)/2)-1) <<24)) + + +//* Configuration to set in the SSC Transmit Frame Mode Register +//* Parameters : nb_bit_by_slot : 8, 16 or 32 bits +//* nb_slot_by_frame : number of channels +#define AT91C_I2S_ASY_TX_FRAME_SETTING(nb_bit_by_slot, nb_slot_by_frame)( +\ + (nb_bit_by_slot-1) +\ + AT91C_SSC_MSBF +\ + (((nb_slot_by_frame-1)<<8) & AT91C_SSC_DATNB) +\ + (((nb_bit_by_slot-1)<<16) & AT91C_SSC_FSLEN) +\ + AT91C_SSC_FSOS_NEGATIVE) + + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_SetBaudrate +//* \brief Set the baudrate according to the CPU clock +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_SetBaudrate ( + AT91PS_SSC pSSC, // \arg pointer to a SSC controller + unsigned int mainClock, // \arg peripheral clock + unsigned int speed) // \arg SSC baudrate +{ + unsigned int baud_value; + //* Define the baud rate divisor register + if (speed == 0) + baud_value = 0; + else + { + baud_value = (unsigned int) (mainClock * 10)/(2*speed); + if ((baud_value % 10) >= 5) + baud_value = (baud_value / 10) + 1; + else + baud_value /= 10; + } + + pSSC->SSC_CMR = baud_value; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_Configure +//* \brief Configure SSC +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_Configure ( + AT91PS_SSC pSSC, // \arg pointer to a SSC controller + unsigned int syst_clock, // \arg System Clock Frequency + unsigned int baud_rate, // \arg Expected Baud Rate Frequency + unsigned int clock_rx, // \arg Receiver Clock Parameters + unsigned int mode_rx, // \arg mode Register to be programmed + unsigned int clock_tx, // \arg Transmitter Clock Parameters + unsigned int mode_tx) // \arg mode Register to be programmed +{ + //* Disable interrupts + pSSC->SSC_IDR = (unsigned int) -1; + + //* Reset receiver and transmitter + pSSC->SSC_CR = AT91C_SSC_SWRST | AT91C_SSC_RXDIS | AT91C_SSC_TXDIS ; + + //* Define the Clock Mode Register + AT91F_SSC_SetBaudrate(pSSC, syst_clock, baud_rate); + + //* Write the Receive Clock Mode Register + pSSC->SSC_RCMR = clock_rx; + + //* Write the Transmit Clock Mode Register + pSSC->SSC_TCMR = clock_tx; + + //* Write the Receive Frame Mode Register + pSSC->SSC_RFMR = mode_rx; + + //* Write the Transmit Frame Mode Register + pSSC->SSC_TFMR = mode_tx; + + //* Clear Transmit and Receive Counters + AT91F_PDC_Open((AT91PS_PDC) &(pSSC->SSC_RPR)); + + +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_EnableRx +//* \brief Enable receiving datas +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_EnableRx ( + AT91PS_SSC pSSC) // \arg pointer to a SSC controller +{ + //* Enable receiver + pSSC->SSC_CR = AT91C_SSC_RXEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_DisableRx +//* \brief Disable receiving datas +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_DisableRx ( + AT91PS_SSC pSSC) // \arg pointer to a SSC controller +{ + //* Disable receiver + pSSC->SSC_CR = AT91C_SSC_RXDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_EnableTx +//* \brief Enable sending datas +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_EnableTx ( + AT91PS_SSC pSSC) // \arg pointer to a SSC controller +{ + //* Enable transmitter + pSSC->SSC_CR = AT91C_SSC_TXEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_DisableTx +//* \brief Disable sending datas +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_DisableTx ( + AT91PS_SSC pSSC) // \arg pointer to a SSC controller +{ + //* Disable transmitter + pSSC->SSC_CR = AT91C_SSC_TXDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_EnableIt +//* \brief Enable SSC IT +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_EnableIt ( + AT91PS_SSC pSSC, // \arg pointer to a SSC controller + unsigned int flag) // \arg IT to be enabled +{ + //* Write to the IER register + pSSC->SSC_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_DisableIt +//* \brief Disable SSC IT +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_DisableIt ( + AT91PS_SSC pSSC, // \arg pointer to a SSC controller + unsigned int flag) // \arg IT to be disabled +{ + //* Write to the IDR register + pSSC->SSC_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_ReceiveFrame +//* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initialized with Next Buffer, 0 if PDC is busy +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_SSC_ReceiveFrame ( + AT91PS_SSC pSSC, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + return AT91F_PDC_ReceiveFrame( + (AT91PS_PDC) &(pSSC->SSC_RPR), + pBuffer, + szBuffer, + pNextBuffer, + szNextBuffer); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_SendFrame +//* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initialized with Next Buffer, 0 if PDC is busy +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_SSC_SendFrame( + AT91PS_SSC pSSC, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + return AT91F_PDC_SendFrame( + (AT91PS_PDC) &(pSSC->SSC_RPR), + pBuffer, + szBuffer, + pNextBuffer, + szNextBuffer); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_GetInterruptMaskStatus +//* \brief Return SSC Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_SSC_GetInterruptMaskStatus( // \return SSC Interrupt Mask Status + AT91PS_SSC pSsc) // \arg pointer to a SSC controller +{ + return pSsc->SSC_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_IsInterruptMasked +//* \brief Test if SSC Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_SSC_IsInterruptMasked( + AT91PS_SSC pSsc, // \arg pointer to a SSC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_SSC_GetInterruptMaskStatus(pSsc) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR TWI + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_EnableIt +//* \brief Enable TWI IT +//*---------------------------------------------------------------------------- +__inline void AT91F_TWI_EnableIt ( + AT91PS_TWI pTWI, // \arg pointer to a TWI controller + unsigned int flag) // \arg IT to be enabled +{ + //* Write to the IER register + pTWI->TWI_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_DisableIt +//* \brief Disable TWI IT +//*---------------------------------------------------------------------------- +__inline void AT91F_TWI_DisableIt ( + AT91PS_TWI pTWI, // \arg pointer to a TWI controller + unsigned int flag) // \arg IT to be disabled +{ + //* Write to the IDR register + pTWI->TWI_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_Configure +//* \brief Configure TWI in master mode +//*---------------------------------------------------------------------------- +__inline void AT91F_TWI_Configure ( AT91PS_TWI pTWI ) // \arg pointer to a TWI controller +{ + //* Disable interrupts + pTWI->TWI_IDR = (unsigned int) -1; + + //* Reset peripheral + pTWI->TWI_CR = AT91C_TWI_SWRST; + + //* Set Master mode + pTWI->TWI_CR = AT91C_TWI_MSEN; + +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_GetInterruptMaskStatus +//* \brief Return TWI Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_TWI_GetInterruptMaskStatus( // \return TWI Interrupt Mask Status + AT91PS_TWI pTwi) // \arg pointer to a TWI controller +{ + return pTwi->TWI_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_IsInterruptMasked +//* \brief Test if TWI Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_TWI_IsInterruptMasked( + AT91PS_TWI pTwi, // \arg pointer to a TWI controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_TWI_GetInterruptMaskStatus(pTwi) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR PWMC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_GetStatus +//* \brief Return PWM Interrupt Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PWMC_GetStatus( // \return PWM Interrupt Status + AT91PS_PWMC pPWM) // pointer to a PWM controller +{ + return pPWM->PWMC_SR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_InterruptEnable +//* \brief Enable PWM Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_InterruptEnable( + AT91PS_PWMC pPwm, // \arg pointer to a PWM controller + unsigned int flag) // \arg PWM interrupt to be enabled +{ + pPwm->PWMC_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_InterruptDisable +//* \brief Disable PWM Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_InterruptDisable( + AT91PS_PWMC pPwm, // \arg pointer to a PWM controller + unsigned int flag) // \arg PWM interrupt to be disabled +{ + pPwm->PWMC_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_GetInterruptMaskStatus +//* \brief Return PWM Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PWMC_GetInterruptMaskStatus( // \return PWM Interrupt Mask Status + AT91PS_PWMC pPwm) // \arg pointer to a PWM controller +{ + return pPwm->PWMC_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_IsInterruptMasked +//* \brief Test if PWM Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PWMC_IsInterruptMasked( + AT91PS_PWMC pPWM, // \arg pointer to a PWM controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PWMC_GetInterruptMaskStatus(pPWM) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_IsStatusSet +//* \brief Test if PWM Interrupt is Set +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PWMC_IsStatusSet( + AT91PS_PWMC pPWM, // \arg pointer to a PWM controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PWMC_GetStatus(pPWM) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_CfgChannel +//* \brief Test if PWM Interrupt is Set +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_CfgChannel( + AT91PS_PWMC pPWM, // \arg pointer to a PWM controller + unsigned int channelId, // \arg PWM channel ID + unsigned int mode, // \arg PWM mode + unsigned int period, // \arg PWM period + unsigned int duty) // \arg PWM duty cycle +{ + pPWM->PWMC_CH[channelId].PWMC_CMR = mode; + pPWM->PWMC_CH[channelId].PWMC_CDTYR = duty; + pPWM->PWMC_CH[channelId].PWMC_CPRDR = period; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_StartChannel +//* \brief Enable channel +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_StartChannel( + AT91PS_PWMC pPWM, // \arg pointer to a PWM controller + unsigned int flag) // \arg Channels IDs to be enabled +{ + pPWM->PWMC_ENA = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_StopChannel +//* \brief Disable channel +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_StopChannel( + AT91PS_PWMC pPWM, // \arg pointer to a PWM controller + unsigned int flag) // \arg Channels IDs to be enabled +{ + pPWM->PWMC_DIS = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_UpdateChannel +//* \brief Update Period or Duty Cycle +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_UpdateChannel( + AT91PS_PWMC pPWM, // \arg pointer to a PWM controller + unsigned int channelId, // \arg PWM channel ID + unsigned int update) // \arg Channels IDs to be enabled +{ + pPWM->PWMC_CH[channelId].PWMC_CUPDR = update; +} + +/* ***************************************************************************** + SOFTWARE API FOR UDP + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EnableIt +//* \brief Enable UDP IT +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EnableIt ( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned int flag) // \arg IT to be enabled +{ + //* Write to the IER register + pUDP->UDP_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_DisableIt +//* \brief Disable UDP IT +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_DisableIt ( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned int flag) // \arg IT to be disabled +{ + //* Write to the IDR register + pUDP->UDP_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_SetAddress +//* \brief Set UDP functional address +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_SetAddress ( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char address) // \arg new UDP address +{ + pUDP->UDP_FADDR = (AT91C_UDP_FEN | address); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EnableEp +//* \brief Enable Endpoint +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EnableEp ( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint) // \arg endpoint number +{ + pUDP->UDP_CSR[endpoint] |= AT91C_UDP_EPEDS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_DisableEp +//* \brief Enable Endpoint +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_DisableEp ( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint) // \arg endpoint number +{ + pUDP->UDP_CSR[endpoint] &= ~AT91C_UDP_EPEDS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_SetState +//* \brief Set UDP Device state +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_SetState ( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned int flag) // \arg new UDP address +{ + pUDP->UDP_GLBSTATE &= ~(AT91C_UDP_FADDEN | AT91C_UDP_CONFG); + pUDP->UDP_GLBSTATE |= flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_GetState +//* \brief return UDP Device state +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_UDP_GetState ( // \return the UDP device state + AT91PS_UDP pUDP) // \arg pointer to a UDP controller +{ + return (pUDP->UDP_GLBSTATE & (AT91C_UDP_FADDEN | AT91C_UDP_CONFG)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_ResetEp +//* \brief Reset UDP endpoint +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_ResetEp ( // \return the UDP device state + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned int flag) // \arg Endpoints to be reset +{ + pUDP->UDP_RSTEP = flag; + pUDP->UDP_RSTEP = 0; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpStall +//* \brief Endpoint will STALL requests +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EpStall( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint) // \arg endpoint number +{ + pUDP->UDP_CSR[endpoint] |= AT91C_UDP_FORCESTALL; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpWrite +//* \brief Write value in the DPR +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EpWrite( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint, // \arg endpoint number + unsigned char value) // \arg value to be written in the DPR +{ + pUDP->UDP_FDR[endpoint] = value; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpRead +//* \brief Return value from the DPR +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_UDP_EpRead( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint) // \arg endpoint number +{ + return pUDP->UDP_FDR[endpoint]; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpEndOfWr +//* \brief Notify the UDP that values in DPR are ready to be sent +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EpEndOfWr( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint) // \arg endpoint number +{ + pUDP->UDP_CSR[endpoint] |= AT91C_UDP_TXPKTRDY; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpClear +//* \brief Clear flag in the endpoint CSR register +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EpClear( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint, // \arg endpoint number + unsigned int flag) // \arg flag to be cleared +{ + pUDP->UDP_CSR[endpoint] &= ~(flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpSet +//* \brief Set flag in the endpoint CSR register +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EpSet( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint, // \arg endpoint number + unsigned int flag) // \arg flag to be cleared +{ + pUDP->UDP_CSR[endpoint] |= flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpStatus +//* \brief Return the endpoint CSR register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_UDP_EpStatus( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint) // \arg endpoint number +{ + return pUDP->UDP_CSR[endpoint]; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_GetInterruptMaskStatus +//* \brief Return UDP Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_UDP_GetInterruptMaskStatus( + AT91PS_UDP pUdp) // \arg pointer to a UDP controller +{ + return pUdp->UDP_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_IsInterruptMasked +//* \brief Test if UDP Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_UDP_IsInterruptMasked( + AT91PS_UDP pUdp, // \arg pointer to a UDP controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_UDP_GetInterruptMaskStatus(pUdp) & flag); +} + +// ---------------------------------------------------------------------------- +// \fn AT91F_UDP_InterruptStatusRegister +// \brief Return the Interrupt Status Register +// ---------------------------------------------------------------------------- +__inline unsigned int AT91F_UDP_InterruptStatusRegister( + AT91PS_UDP pUDP ) // \arg pointer to a UDP controller +{ + return pUDP->UDP_ISR; +} + +// ---------------------------------------------------------------------------- +// \fn AT91F_UDP_InterruptClearRegister +// \brief Clear Interrupt Register +// ---------------------------------------------------------------------------- +__inline void AT91F_UDP_InterruptClearRegister ( + AT91PS_UDP pUDP, // \arg pointer to UDP controller + unsigned int flag) // \arg IT to be cleat +{ + pUDP->UDP_ICR = flag; +} + +// ---------------------------------------------------------------------------- +// \fn AT91F_UDP_EnableTransceiver +// \brief Enable transceiver +// ---------------------------------------------------------------------------- +__inline void AT91F_UDP_EnableTransceiver( + AT91PS_UDP pUDP ) // \arg pointer to a UDP controller +{ + pUDP->UDP_TXVC &= ~AT91C_UDP_TXVDIS; +} + +// ---------------------------------------------------------------------------- +// \fn AT91F_UDP_DisableTransceiver +// \brief Disable transceiver +// ---------------------------------------------------------------------------- +__inline void AT91F_UDP_DisableTransceiver( + AT91PS_UDP pUDP ) // \arg pointer to a UDP controller +{ + pUDP->UDP_TXVC = AT91C_UDP_TXVDIS; +} + +/* ***************************************************************************** + SOFTWARE API FOR TC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC_InterruptEnable +//* \brief Enable TC Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_TC_InterruptEnable( + AT91PS_TC pTc, // \arg pointer to a TC controller + unsigned int flag) // \arg TC interrupt to be enabled +{ + pTc->TC_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC_InterruptDisable +//* \brief Disable TC Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_TC_InterruptDisable( + AT91PS_TC pTc, // \arg pointer to a TC controller + unsigned int flag) // \arg TC interrupt to be disabled +{ + pTc->TC_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC_GetInterruptMaskStatus +//* \brief Return TC Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_TC_GetInterruptMaskStatus( // \return TC Interrupt Mask Status + AT91PS_TC pTc) // \arg pointer to a TC controller +{ + return pTc->TC_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC_IsInterruptMasked +//* \brief Test if TC Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_TC_IsInterruptMasked( + AT91PS_TC pTc, // \arg pointer to a TC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_TC_GetInterruptMaskStatus(pTc) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR CAN + ***************************************************************************** */ +#define STANDARD_FORMAT 0 +#define EXTENDED_FORMAT 1 + +//*---------------------------------------------------------------------------- +//* \fn AT91F_InitMailboxRegisters() +//* \brief Configure the corresponding mailbox +//*---------------------------------------------------------------------------- +__inline void AT91F_InitMailboxRegisters(AT91PS_CAN_MB CAN_Mailbox, + int mode_reg, + int acceptance_mask_reg, + int id_reg, + int data_low_reg, + int data_high_reg, + int control_reg) +{ + CAN_Mailbox->CAN_MB_MCR = 0x0; + CAN_Mailbox->CAN_MB_MMR = mode_reg; + CAN_Mailbox->CAN_MB_MAM = acceptance_mask_reg; + CAN_Mailbox->CAN_MB_MID = id_reg; + CAN_Mailbox->CAN_MB_MDL = data_low_reg; + CAN_Mailbox->CAN_MB_MDH = data_high_reg; + CAN_Mailbox->CAN_MB_MCR = control_reg; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_EnableCAN() +//* \brief +//*---------------------------------------------------------------------------- +__inline void AT91F_EnableCAN( + AT91PS_CAN pCAN) // pointer to a CAN controller +{ + pCAN->CAN_MR |= AT91C_CAN_CANEN; + + // Wait for WAKEUP flag raising <=> 11-recessive-bit were scanned by the transceiver + while( (pCAN->CAN_SR & AT91C_CAN_WAKEUP) != AT91C_CAN_WAKEUP ); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_DisableCAN() +//* \brief +//*---------------------------------------------------------------------------- +__inline void AT91F_DisableCAN( + AT91PS_CAN pCAN) // pointer to a CAN controller +{ + pCAN->CAN_MR &= ~AT91C_CAN_CANEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_EnableIt +//* \brief Enable CAN interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_EnableIt ( + AT91PS_CAN pCAN, // pointer to a CAN controller + unsigned int flag) // IT to be enabled +{ + //* Write to the IER register + pCAN->CAN_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_DisableIt +//* \brief Disable CAN interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_DisableIt ( + AT91PS_CAN pCAN, // pointer to a CAN controller + unsigned int flag) // IT to be disabled +{ + //* Write to the IDR register + pCAN->CAN_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetStatus +//* \brief Return CAN Interrupt Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetStatus( // \return CAN Interrupt Status + AT91PS_CAN pCAN) // pointer to a CAN controller +{ + return pCAN->CAN_SR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetInterruptMaskStatus +//* \brief Return CAN Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetInterruptMaskStatus( // \return CAN Interrupt Mask Status + AT91PS_CAN pCAN) // pointer to a CAN controller +{ + return pCAN->CAN_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_IsInterruptMasked +//* \brief Test if CAN Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_IsInterruptMasked( + AT91PS_CAN pCAN, // \arg pointer to a CAN controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_CAN_GetInterruptMaskStatus(pCAN) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_IsStatusSet +//* \brief Test if CAN Interrupt is Set +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_IsStatusSet( + AT91PS_CAN pCAN, // \arg pointer to a CAN controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_CAN_GetStatus(pCAN) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgModeReg +//* \brief Configure the Mode Register of the CAN controller +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgModeReg ( + AT91PS_CAN pCAN, // pointer to a CAN controller + unsigned int mode) // mode register +{ + //* Write to the MR register + pCAN->CAN_MR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetModeReg +//* \brief Return the Mode Register of the CAN controller value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetModeReg ( + AT91PS_CAN pCAN // pointer to a CAN controller + ) +{ + return pCAN->CAN_MR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgBaudrateReg +//* \brief Configure the Baudrate of the CAN controller for the network +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgBaudrateReg ( + AT91PS_CAN pCAN, // pointer to a CAN controller + unsigned int baudrate_cfg) +{ + //* Write to the BR register + pCAN->CAN_BR = baudrate_cfg; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetBaudrate +//* \brief Return the Baudrate of the CAN controller for the network value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetBaudrate ( + AT91PS_CAN pCAN // pointer to a CAN controller + ) +{ + return pCAN->CAN_BR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetInternalCounter +//* \brief Return CAN Timer Regsiter Value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetInternalCounter ( + AT91PS_CAN pCAN // pointer to a CAN controller + ) +{ + return pCAN->CAN_TIM; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetTimestamp +//* \brief Return CAN Timestamp Register Value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetTimestamp ( + AT91PS_CAN pCAN // pointer to a CAN controller + ) +{ + return pCAN->CAN_TIMESTP; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetErrorCounter +//* \brief Return CAN Error Counter Register Value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetErrorCounter ( + AT91PS_CAN pCAN // pointer to a CAN controller + ) +{ + return pCAN->CAN_ECR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_InitTransferRequest +//* \brief Request for a transfer on the corresponding mailboxes +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_InitTransferRequest ( + AT91PS_CAN pCAN, // pointer to a CAN controller + unsigned int transfer_cmd) +{ + pCAN->CAN_TCR = transfer_cmd; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_InitAbortRequest +//* \brief Abort the corresponding mailboxes +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_InitAbortRequest ( + AT91PS_CAN pCAN, // pointer to a CAN controller + unsigned int abort_cmd) +{ + pCAN->CAN_ACR = abort_cmd; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgMessageModeReg +//* \brief Program the Message Mode Register +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgMessageModeReg ( + AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox + unsigned int mode) +{ + CAN_Mailbox->CAN_MB_MMR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetMessageModeReg +//* \brief Return the Message Mode Register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetMessageModeReg ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgMessageIDReg +//* \brief Program the Message ID Register +//* \brief Version == 0 for Standard messsage, Version == 1 for Extended +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgMessageIDReg ( + AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox + unsigned int id, + unsigned char version) +{ + if(version==0) // IDvA Standard Format + CAN_Mailbox->CAN_MB_MID = id<<18; + else // IDvB Extended Format + CAN_Mailbox->CAN_MB_MID = id | (1<<29); // set MIDE bit +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetMessageIDReg +//* \brief Return the Message ID Register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetMessageIDReg ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MID; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgMessageAcceptanceMaskReg +//* \brief Program the Message Acceptance Mask Register +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgMessageAcceptanceMaskReg ( + AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox + unsigned int mask) +{ + CAN_Mailbox->CAN_MB_MAM = mask; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetMessageAcceptanceMaskReg +//* \brief Return the Message Acceptance Mask Register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetMessageAcceptanceMaskReg ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MAM; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetFamilyID +//* \brief Return the Message ID Register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetFamilyID ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MFID; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgMessageCtrl +//* \brief Request and config for a transfer on the corresponding mailbox +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgMessageCtrlReg ( + AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox + unsigned int message_ctrl_cmd) +{ + CAN_Mailbox->CAN_MB_MCR = message_ctrl_cmd; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetMessageStatus +//* \brief Return CAN Mailbox Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetMessageStatus ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgMessageDataLow +//* \brief Program data low value +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgMessageDataLow ( + AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox + unsigned int data) +{ + CAN_Mailbox->CAN_MB_MDL = data; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetMessageDataLow +//* \brief Return data low value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetMessageDataLow ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MDL; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgMessageDataHigh +//* \brief Program data high value +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgMessageDataHigh ( + AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox + unsigned int data) +{ + CAN_Mailbox->CAN_MB_MDH = data; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetMessageDataHigh +//* \brief Return data high value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetMessageDataHigh ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MDH; +} + +/* ***************************************************************************** + SOFTWARE API FOR ADC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_EnableIt +//* \brief Enable ADC interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_EnableIt ( + AT91PS_ADC pADC, // pointer to a ADC controller + unsigned int flag) // IT to be enabled +{ + //* Write to the IER register + pADC->ADC_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_DisableIt +//* \brief Disable ADC interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_DisableIt ( + AT91PS_ADC pADC, // pointer to a ADC controller + unsigned int flag) // IT to be disabled +{ + //* Write to the IDR register + pADC->ADC_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetStatus +//* \brief Return ADC Interrupt Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetStatus( // \return ADC Interrupt Status + AT91PS_ADC pADC) // pointer to a ADC controller +{ + return pADC->ADC_SR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetInterruptMaskStatus +//* \brief Return ADC Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetInterruptMaskStatus( // \return ADC Interrupt Mask Status + AT91PS_ADC pADC) // pointer to a ADC controller +{ + return pADC->ADC_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_IsInterruptMasked +//* \brief Test if ADC Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_IsInterruptMasked( + AT91PS_ADC pADC, // \arg pointer to a ADC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_ADC_GetInterruptMaskStatus(pADC) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_IsStatusSet +//* \brief Test if ADC Status is Set +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_IsStatusSet( + AT91PS_ADC pADC, // \arg pointer to a ADC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_ADC_GetStatus(pADC) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_CfgModeReg +//* \brief Configure the Mode Register of the ADC controller +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_CfgModeReg ( + AT91PS_ADC pADC, // pointer to a ADC controller + unsigned int mode) // mode register +{ + //* Write to the MR register + pADC->ADC_MR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetModeReg +//* \brief Return the Mode Register of the ADC controller value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetModeReg ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_MR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_CfgTimings +//* \brief Configure the different necessary timings of the ADC controller +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_CfgTimings ( + AT91PS_ADC pADC, // pointer to a ADC controller + unsigned int mck_clock, // in MHz + unsigned int adc_clock, // in MHz + unsigned int startup_time, // in us + unsigned int sample_and_hold_time) // in ns +{ + unsigned int prescal,startup,shtim; + + prescal = mck_clock/(2*adc_clock) - 1; + startup = adc_clock*startup_time/8 - 1; + shtim = adc_clock*sample_and_hold_time/1000 - 1; + + //* Write to the MR register + pADC->ADC_MR = ( (prescal<<8) & AT91C_ADC_PRESCAL) | ( (startup<<16) & AT91C_ADC_STARTUP) | ( (shtim<<24) & AT91C_ADC_SHTIM); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_EnableChannel +//* \brief Return ADC Timer Register Value +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_EnableChannel ( + AT91PS_ADC pADC, // pointer to a ADC controller + unsigned int channel) // mode register +{ + //* Write to the CHER register + pADC->ADC_CHER = channel; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_DisableChannel +//* \brief Return ADC Timer Register Value +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_DisableChannel ( + AT91PS_ADC pADC, // pointer to a ADC controller + unsigned int channel) // mode register +{ + //* Write to the CHDR register + pADC->ADC_CHDR = channel; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetChannelStatus +//* \brief Return ADC Timer Register Value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetChannelStatus ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CHSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_StartConversion +//* \brief Software request for a analog to digital conversion +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_StartConversion ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + pADC->ADC_CR = AT91C_ADC_START; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_SoftReset +//* \brief Software reset +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_SoftReset ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + pADC->ADC_CR = AT91C_ADC_SWRST; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetLastConvertedData +//* \brief Return the Last Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetLastConvertedData ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_LCDR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH0 +//* \brief Return the Channel 0 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH0 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR0; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH1 +//* \brief Return the Channel 1 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH1 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR1; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH2 +//* \brief Return the Channel 2 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH2 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR2; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH3 +//* \brief Return the Channel 3 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH3 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR3; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH4 +//* \brief Return the Channel 4 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH4 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR4; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH5 +//* \brief Return the Channel 5 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH5 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR5; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH6 +//* \brief Return the Channel 6 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH6 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR6; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH7 +//* \brief Return the Channel 7 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH7 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR7; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_CfgPMC +//* \brief Enable Peripheral clock in PMC for MC +//*---------------------------------------------------------------------------- +__inline void AT91F_MC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_DBGU_CfgPMC +//* \brief Enable Peripheral clock in PMC for DBGU +//*---------------------------------------------------------------------------- +__inline void AT91F_DBGU_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_DBGU_CfgPIO +//* \brief Configure PIO controllers to drive DBGU signals +//*---------------------------------------------------------------------------- +__inline void AT91F_DBGU_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA28_DTXD ) | + ((unsigned int) AT91C_PA27_DRXD ), // Peripheral A + 0); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWMC_CH3_CfgPIO +//* \brief Configure PIO controllers to drive PWMC_CH3 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_CH3_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB22_PWM3 ), // Peripheral A + ((unsigned int) AT91C_PB30_PWM3 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWMC_CH2_CfgPIO +//* \brief Configure PIO controllers to drive PWMC_CH2 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_CH2_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB21_PWM2 ), // Peripheral A + ((unsigned int) AT91C_PB29_PWM2 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWMC_CH1_CfgPIO +//* \brief Configure PIO controllers to drive PWMC_CH1 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_CH1_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB20_PWM1 ), // Peripheral A + ((unsigned int) AT91C_PB28_PWM1 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWMC_CH0_CfgPIO +//* \brief Configure PIO controllers to drive PWMC_CH0 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_CH0_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB19_PWM0 ), // Peripheral A + ((unsigned int) AT91C_PB27_PWM0 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_EMAC_CfgPMC +//* \brief Enable Peripheral clock in PMC for EMAC +//*---------------------------------------------------------------------------- +__inline void AT91F_EMAC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_EMAC)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_EMAC_CfgPIO +//* \brief Configure PIO controllers to drive EMAC signals +//*---------------------------------------------------------------------------- +__inline void AT91F_EMAC_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB9_EMDIO ) | + ((unsigned int) AT91C_PB17_ERXCK ) | + ((unsigned int) AT91C_PB15_ERXDV_ECRSDV) | + ((unsigned int) AT91C_PB8_EMDC ) | + ((unsigned int) AT91C_PB16_ECOL ) | + ((unsigned int) AT91C_PB7_ERXER ) | + ((unsigned int) AT91C_PB5_ERX0 ) | + ((unsigned int) AT91C_PB6_ERX1 ) | + ((unsigned int) AT91C_PB13_ERX2 ) | + ((unsigned int) AT91C_PB1_ETXEN ) | + ((unsigned int) AT91C_PB14_ERX3 ) | + ((unsigned int) AT91C_PB12_ETXER ) | + ((unsigned int) AT91C_PB2_ETX0 ) | + ((unsigned int) AT91C_PB3_ETX1 ) | + ((unsigned int) AT91C_PB10_ETX2 ) | + ((unsigned int) AT91C_PB18_EF100 ) | + ((unsigned int) AT91C_PB11_ETX3 ) | + ((unsigned int) AT91C_PB4_ECRS ) | + ((unsigned int) AT91C_PB0_ETXCK_EREFCK), // Peripheral A + 0); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_VREG_CfgPMC +//* \brief Enable Peripheral clock in PMC for VREG +//*---------------------------------------------------------------------------- +__inline void AT91F_VREG_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_CfgPMC +//* \brief Enable Peripheral clock in PMC for SSC +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SSC)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_CfgPIO +//* \brief Configure PIO controllers to drive SSC signals +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA23_TD ) | + ((unsigned int) AT91C_PA21_TF ) | + ((unsigned int) AT91C_PA25_RK ) | + ((unsigned int) AT91C_PA24_RD ) | + ((unsigned int) AT91C_PA26_RF ) | + ((unsigned int) AT91C_PA22_TK ), // Peripheral A + 0); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI1_CfgPMC +//* \brief Enable Peripheral clock in PMC for SPI1 +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI1_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SPI1)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI1_CfgPIO +//* \brief Configure PIO controllers to drive SPI1 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI1_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PA23_SPI1_MOSI) | + ((unsigned int) AT91C_PA21_SPI1_NPCS0) | + ((unsigned int) AT91C_PA25_SPI1_NPCS1) | + ((unsigned int) AT91C_PA2_SPI1_NPCS1) | + ((unsigned int) AT91C_PA24_SPI1_MISO) | + ((unsigned int) AT91C_PA22_SPI1_SPCK) | + ((unsigned int) AT91C_PA26_SPI1_NPCS2) | + ((unsigned int) AT91C_PA3_SPI1_NPCS2) | + ((unsigned int) AT91C_PA29_SPI1_NPCS3) | + ((unsigned int) AT91C_PA4_SPI1_NPCS3)); // Peripheral B + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PB10_SPI1_NPCS1) | + ((unsigned int) AT91C_PB11_SPI1_NPCS2) | + ((unsigned int) AT91C_PB16_SPI1_NPCS3)); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI0_CfgPMC +//* \brief Enable Peripheral clock in PMC for SPI0 +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI0_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SPI0)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI0_CfgPIO +//* \brief Configure PIO controllers to drive SPI0 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI0_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA17_SPI0_MOSI) | + ((unsigned int) AT91C_PA12_SPI0_NPCS0) | + ((unsigned int) AT91C_PA13_SPI0_NPCS1) | + ((unsigned int) AT91C_PA16_SPI0_MISO) | + ((unsigned int) AT91C_PA14_SPI0_NPCS2) | + ((unsigned int) AT91C_PA18_SPI0_SPCK) | + ((unsigned int) AT91C_PA15_SPI0_NPCS3), // Peripheral A + ((unsigned int) AT91C_PA7_SPI0_NPCS1) | + ((unsigned int) AT91C_PA8_SPI0_NPCS2) | + ((unsigned int) AT91C_PA9_SPI0_NPCS3)); // Peripheral B + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PB13_SPI0_NPCS1) | + ((unsigned int) AT91C_PB14_SPI0_NPCS2) | + ((unsigned int) AT91C_PB17_SPI0_NPCS3)); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWMC_CfgPMC +//* \brief Enable Peripheral clock in PMC for PWMC +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_PWMC)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC0_CfgPMC +//* \brief Enable Peripheral clock in PMC for TC0 +//*---------------------------------------------------------------------------- +__inline void AT91F_TC0_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_TC0)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC0_CfgPIO +//* \brief Configure PIO controllers to drive TC0 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_TC0_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB23_TIOA0 ) | + ((unsigned int) AT91C_PB24_TIOB0 ), // Peripheral A + ((unsigned int) AT91C_PB12_TCLK0 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC1_CfgPMC +//* \brief Enable Peripheral clock in PMC for TC1 +//*---------------------------------------------------------------------------- +__inline void AT91F_TC1_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_TC1)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC1_CfgPIO +//* \brief Configure PIO controllers to drive TC1 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_TC1_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB25_TIOA1 ) | + ((unsigned int) AT91C_PB26_TIOB1 ), // Peripheral A + ((unsigned int) AT91C_PB19_TCLK1 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC2_CfgPMC +//* \brief Enable Peripheral clock in PMC for TC2 +//*---------------------------------------------------------------------------- +__inline void AT91F_TC2_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_TC2)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC2_CfgPIO +//* \brief Configure PIO controllers to drive TC2 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_TC2_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PA15_TCLK2 )); // Peripheral B + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB27_TIOA2 ) | + ((unsigned int) AT91C_PB28_TIOB2 ), // Peripheral A + 0); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITC_CfgPMC +//* \brief Enable Peripheral clock in PMC for PITC +//*---------------------------------------------------------------------------- +__inline void AT91F_PITC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_CfgPMC +//* \brief Enable Peripheral clock in PMC for ADC +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_ADC)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_CfgPIO +//* \brief Configure PIO controllers to drive ADC signals +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PB18_ADTRG )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_CfgPMC +//* \brief Enable Peripheral clock in PMC for PMC +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_CfgPIO +//* \brief Configure PIO controllers to drive PMC signals +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PA13_PCK1 ) | + ((unsigned int) AT91C_PA30_PCK2 ) | + ((unsigned int) AT91C_PA27_PCK3 )); // Peripheral B + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB29_PCK1 ) | + ((unsigned int) AT91C_PB30_PCK2 ), // Peripheral A + ((unsigned int) AT91C_PB21_PCK1 ) | + ((unsigned int) AT91C_PB22_PCK2 ) | + ((unsigned int) AT91C_PB20_PCK0 ) | + ((unsigned int) AT91C_PB0_PCK0 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_RSTC_CfgPMC +//* \brief Enable Peripheral clock in PMC for RSTC +//*---------------------------------------------------------------------------- +__inline void AT91F_RSTC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_RTTC_CfgPMC +//* \brief Enable Peripheral clock in PMC for RTTC +//*---------------------------------------------------------------------------- +__inline void AT91F_RTTC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIOA_CfgPMC +//* \brief Enable Peripheral clock in PMC for PIOA +//*---------------------------------------------------------------------------- +__inline void AT91F_PIOA_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_PIOA)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIOB_CfgPMC +//* \brief Enable Peripheral clock in PMC for PIOB +//*---------------------------------------------------------------------------- +__inline void AT91F_PIOB_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_PIOB)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_CfgPMC +//* \brief Enable Peripheral clock in PMC for TWI +//*---------------------------------------------------------------------------- +__inline void AT91F_TWI_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_TWI)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_CfgPIO +//* \brief Configure PIO controllers to drive TWI signals +//*---------------------------------------------------------------------------- +__inline void AT91F_TWI_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA10_TWD ) | + ((unsigned int) AT91C_PA11_TWCK ), // Peripheral A + 0); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_WDTC_CfgPMC +//* \brief Enable Peripheral clock in PMC for WDTC +//*---------------------------------------------------------------------------- +__inline void AT91F_WDTC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US1_CfgPMC +//* \brief Enable Peripheral clock in PMC for US1 +//*---------------------------------------------------------------------------- +__inline void AT91F_US1_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_US1)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US1_CfgPIO +//* \brief Configure PIO controllers to drive US1 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_US1_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA5_RXD1 ) | + ((unsigned int) AT91C_PA6_TXD1 ) | + ((unsigned int) AT91C_PA8_RTS1 ) | + ((unsigned int) AT91C_PA7_SCK1 ) | + ((unsigned int) AT91C_PA9_CTS1 ), // Peripheral A + 0); // Peripheral B + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PB25_DTR1 ) | + ((unsigned int) AT91C_PB23_DCD1 ) | + ((unsigned int) AT91C_PB24_DSR1 ) | + ((unsigned int) AT91C_PB26_RI1 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US0_CfgPMC +//* \brief Enable Peripheral clock in PMC for US0 +//*---------------------------------------------------------------------------- +__inline void AT91F_US0_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_US0)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US0_CfgPIO +//* \brief Configure PIO controllers to drive US0 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_US0_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA0_RXD0 ) | + ((unsigned int) AT91C_PA1_TXD0 ) | + ((unsigned int) AT91C_PA3_RTS0 ) | + ((unsigned int) AT91C_PA2_SCK0 ) | + ((unsigned int) AT91C_PA4_CTS0 ), // Peripheral A + 0); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_CfgPMC +//* \brief Enable Peripheral clock in PMC for UDP +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_UDP)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_CfgPMC +//* \brief Enable Peripheral clock in PMC for AIC +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_IRQ0) | + ((unsigned int) 1 << AT91C_ID_FIQ) | + ((unsigned int) 1 << AT91C_ID_IRQ1)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_CfgPIO +//* \brief Configure PIO controllers to drive AIC signals +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA30_IRQ0 ) | + ((unsigned int) AT91C_PA29_FIQ ), // Peripheral A + ((unsigned int) AT91C_PA14_IRQ1 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgPMC +//* \brief Enable Peripheral clock in PMC for CAN +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_CAN)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgPIO +//* \brief Configure PIO controllers to drive CAN signals +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA20_CANTX ) | + ((unsigned int) AT91C_PA19_CANRX ), // Peripheral A + 0); // Peripheral B +} + +#endif // lib_AT91SAM7X256_H diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/incIAR/project.h b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/incIAR/project.h new file mode 100644 index 0000000..24fb698 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/incIAR/project.h @@ -0,0 +1,30 @@ +//----------------------------------------------------------------------------- +// ATMEL Microcontroller Software Support - ROUSSET - +//----------------------------------------------------------------------------- +// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +//----------------------------------------------------------------------------- +// File Name : project.h +// Object : project specific include file to AT91SAM7X256 +// Creation : JPP 14-Sep-2006 +//----------------------------------------------------------------------------- +#ifndef _PROJECT_H +#define _PROJECT_H + +/// Include your AT91 Library files and specific compiler definitions + +#include +#include "AT91SAM7X-EK.h" +#include "AT91SAM7X256.h" +#define __inline inline +#include "lib_AT91SAM7X256.h" + +#endif // _PROJECT_H diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.cspy.bat b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.cspy.bat new file mode 100644 index 0000000..aa07e50 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.cspy.bat @@ -0,0 +1,33 @@ +@REM This bat file has been generated by the IAR Embeddded Workbench +@REM C-SPY interactive debugger,as an aid to preparing a command +@REM line for running the cspybat command line utility with the +@REM appropriate settings. +@REM +@REM After making some adjustments to this file, you can launch cspybat +@REM by typing the name of this file followed by the name of the debug +@REM file (usually an ubrof file). Note that this file is generated +@REM every time a new debug session is initialized, so you may want to +@REM move or rename the file before making changes. +@REM +@REM Note: some command line arguments cannot be properly generated +@REM by this process. Specifically, the plugin which is responsible +@REM for the Terminal I/O window (and other C runtime functionality) +@REM comes in a special version for cspybat, and the name of that +@REM plugin dll is not known when generating this file. It resides in +@REM the $TOOLKIT_DIR$\bin folder and is usually called XXXbat.dll or +@REM XXXlibsupportbat.dll, where XXX is the name of the corresponding +@REM tool chain. Replace the '' parameter +@REM below with the appropriate file name. Other plugins loaded by +@REM C-SPY are usually not needed by, or will not work in, cspybat +@REM but they are listed at the end of this file for reference. + + +"C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\bin\cspybat" "C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\bin\armproc.dll" "C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\bin\armjlink.dll" %1 --plugin "C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\bin\" --macro "C:\Documents and Settings\Greg\Desktop\SAM7X256\AT91SAM7X-Interrupt_SAM7X\Compil\resource\SAM7_FLASH.mac" --backend -B "--endian=little" "--cpu=ARM7TDMI" "--fpu=None" "-p" "C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\CONFIG\debugger\Atmel\ioAT91SAM7X256.ddf" "--drv_verify_download" "--semihosting" "--device=AT91SAM7X256" "-d" "jlink" "--drv_communication=USB0" "--jlink_speed=adaptive" + + +@REM Loaded plugins: +@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\bin\armlibsupport.dll +@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\plugins\CodeCoverage\CodeCoverage.dll +@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\plugins\Profiling\Profiling.dll +@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\plugins\stack\stack.dll +@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\plugins\SymList\SymList.dll diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.dbgdt b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.dbgdt new file mode 100644 index 0000000..e068f91 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.dbgdt @@ -0,0 +1,5 @@ + + + + + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.dni b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.dni new file mode 100644 index 0000000..a4e49ac --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.dni @@ -0,0 +1,18 @@ +[JLinkDriver] +WatchCond=_ 0 +Watch0=_ 0 "" 0 "" 0 "" 0 "" 0 0 0 0 +Watch1=_ 0 "" 0 "" 0 "" 0 "" 0 0 0 0 +[TermIOLog] +LoggingEnabled=_ 0 +LogFile=_ "" +[Log file] +LoggingEnabled=_ 0 +LogFile=_ "" +Category=_ 0 +[Disassemble mode] +mode=0 +[Breakpoints] +Count=0 +[TraceHelper] +Enabled=0 +ShowSource=1 diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.wsdt b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.wsdt new file mode 100644 index 0000000..f9f15e9 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.wsdt @@ -0,0 +1,74 @@ + + + + + + BasicInterrupt_SAM7X/FLASH_Debug + + + + + + + + + 271272727 + + + 20 + 995 + 265 + 66 + + + + + + + + + + + TabID-26686-579 + Workspace + Workspace + + + BasicInterrupt_SAM7X + + + + 0 + + + TabID-13847-615 + Build + Build + + + + TabID-20936-687 + Debug Log + Debug-Log + + + + + 1 + + + + + + 0100000010000001 + + + + + + + iaridepm.enu1-2-2612345-2-2200200144300234192250361718970-2-21981388-2-213902001002886234192144300234192 + + + + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X_FLASH_Debug.jlink b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X_FLASH_Debug.jlink new file mode 100644 index 0000000..ecbb0a8 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X_FLASH_Debug.jlink @@ -0,0 +1,12 @@ +[FLASH] +SkipProgOnCRCMatch = 1 +VerifyDownload = 1 +AllowCaching = 1 +EnableFlashDL = 2 +Override = 0 +Device="ADUC7020X62" +[BREAKPOINTS] +ShowInfoWin = 1 +EnableFlashBP = 2 +[CPU] +AllowSimulation = 1 diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo.cspy.bat b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo.cspy.bat new file mode 100644 index 0000000..0e4d177 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo.cspy.bat @@ -0,0 +1,33 @@ +@REM This bat file has been generated by the IAR Embeddded Workbench +@REM C-SPY interactive debugger,as an aid to preparing a command +@REM line for running the cspybat command line utility with the +@REM appropriate settings. +@REM +@REM After making some adjustments to this file, you can launch cspybat +@REM by typing the name of this file followed by the name of the debug +@REM file (usually an ubrof file). Note that this file is generated +@REM every time a new debug session is initialized, so you may want to +@REM move or rename the file before making changes. +@REM +@REM Note: some command line arguments cannot be properly generated +@REM by this process. Specifically, the plugin which is responsible +@REM for the Terminal I/O window (and other C runtime functionality) +@REM comes in a special version for cspybat, and the name of that +@REM plugin dll is not known when generating this file. It resides in +@REM the $TOOLKIT_DIR$\bin folder and is usually called XXXbat.dll or +@REM XXXlibsupportbat.dll, where XXX is the name of the corresponding +@REM tool chain. Replace the '' parameter +@REM below with the appropriate file name. Other plugins loaded by +@REM C-SPY are usually not needed by, or will not work in, cspybat +@REM but they are listed at the end of this file for reference. + + +"C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\bin\cspybat" "C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\bin\armproc.dll" "C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\bin\armjlink.dll" %1 --plugin "C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\bin\" --macro "C:\svn\cmock\iar\iar_v5\Resource\SAM7_RAM.mac" --backend -B "--endian=little" "--cpu=ARM7TDMI" "--fpu=None" "-p" "C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\CONFIG\debugger\Atmel\ioAT91SAM7X256.ddf" "--drv_verify_download" "--semihosting" "--device=AT91SAM7X256" "-d" "jlink" "--drv_communication=USB0" "--jlink_speed=adaptive" + + +@REM Loaded plugins: +@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\bin\armlibsupport.dll +@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\plugins\CodeCoverage\CodeCoverage.dll +@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\plugins\Profiling\Profiling.dll +@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\plugins\stack\stack.dll +@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\plugins\SymList\SymList.dll diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo.dbgdt b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo.dbgdt new file mode 100644 index 0000000..b521f67 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo.dbgdt @@ -0,0 +1,85 @@ + + + + + + + + 20 + 995 + 265 + 66 + + + + + + + + 124272727 + + + + + 10 + + + + + + + + + TabID-27249-27051 + Debug Log + Debug-Log + + + + TabID-4707-27064 + Build + Build + + + + + 0 + + + TabID-5230-27054 + Workspace + Workspace + + + cmock_demo + + + + 0 + + + TabID-15978-27058 + Disassembly + Disassembly + + + + + 0 + + + + + + TextEditorC:\svn\cmock\examples\src\Main.c0258358350TextEditorC:\svn\cmock\examples\src\TaskScheduler.c0439819810100000010000001 + + + + + + + iaridepm.enu1debuggergui.enu1-2-2588198-2-2200200144300234192144300690867-2-2588198-2-2200200144300234192144300690867-2-21981388-2-213902001002886234192144300234192 + + + + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo.dni b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo.dni new file mode 100644 index 0000000..84237e1 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo.dni @@ -0,0 +1,44 @@ +[JLinkDriver] +WatchCond=_ 0 +Watch0=_ 0 "" 0 "" 0 "" 0 "" 0 0 0 0 +Watch1=_ 0 "" 0 "" 0 "" 0 "" 0 0 0 0 +[DisAssemblyWindow] +NumStates=_ 1 +State 1=_ 1 +[CodeCoverage] +Enabled=_ 0 +[Profiling] +Enabled=0 +[StackPlugin] +Enabled=1 +OverflowWarningsEnabled=1 +WarningThreshold=90 +SpWarningsEnabled=1 +WarnHow=0 +UseTrigger=1 +TriggerName=main +LimitSize=0 +ByteLimit=50 +[Interrupts] +Enabled=1 +[MemoryMap] +Enabled=0 +Base=0 +UseAuto=0 +TypeViolation=1 +UnspecRange=1 +ActionState=1 +[Log file] +LoggingEnabled=_ 0 +LogFile=_ "" +Category=_ 0 +[TermIOLog] +LoggingEnabled=_ 0 +LogFile=_ "" +[Disassemble mode] +mode=0 +[Breakpoints] +Count=0 +[TraceHelper] +Enabled=0 +ShowSource=1 diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo.wsdt b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo.wsdt new file mode 100644 index 0000000..c1a7704 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo.wsdt @@ -0,0 +1,73 @@ + + + + + + cmock_demo/RAM_Debug + + + + + + + + 2099526566 + + + + + + + 216272727 + + + + + + + + + + TabID-7530-24964 + Build + Build + + + + TabID-25388-26881 + Debug Log + Debug-Log + + + + + 0 + + + TabID-18278-24968 + Workspace + Workspace + + + cmock_democmock_demo/Sourcecmock_demo/srccmock_demo/srcIAR + + + + 0 + + + + + + TextEditorC:\svn\cmock\examples\src\Main.c02582082000100000010000001 + + + + + + + iaridepm.enu1-2-2513307-2-2200200144300234192222944603044-2-22971388-2-213902991002886350117144300234192 + + + + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo_Binary.jlink b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo_Binary.jlink new file mode 100644 index 0000000..ecbb0a8 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo_Binary.jlink @@ -0,0 +1,12 @@ +[FLASH] +SkipProgOnCRCMatch = 1 +VerifyDownload = 1 +AllowCaching = 1 +EnableFlashDL = 2 +Override = 0 +Device="ADUC7020X62" +[BREAKPOINTS] +ShowInfoWin = 1 +EnableFlashBP = 2 +[CPU] +AllowSimulation = 1 diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo_FLASH_Debug.jlink b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo_FLASH_Debug.jlink new file mode 100644 index 0000000..ecbb0a8 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo_FLASH_Debug.jlink @@ -0,0 +1,12 @@ +[FLASH] +SkipProgOnCRCMatch = 1 +VerifyDownload = 1 +AllowCaching = 1 +EnableFlashDL = 2 +Override = 0 +Device="ADUC7020X62" +[BREAKPOINTS] +ShowInfoWin = 1 +EnableFlashBP = 2 +[CPU] +AllowSimulation = 1 diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo_RAM_Debug.jlink b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo_RAM_Debug.jlink new file mode 100644 index 0000000..ecbb0a8 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo_RAM_Debug.jlink @@ -0,0 +1,12 @@ +[FLASH] +SkipProgOnCRCMatch = 1 +VerifyDownload = 1 +AllowCaching = 1 +EnableFlashDL = 2 +Override = 0 +Device="ADUC7020X62" +[BREAKPOINTS] +ShowInfoWin = 1 +EnableFlashBP = 2 +[CPU] +AllowSimulation = 1 diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/srcIAR/Cstartup.s b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/srcIAR/Cstartup.s new file mode 100644 index 0000000..7113c80 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/srcIAR/Cstartup.s @@ -0,0 +1,299 @@ +;* ---------------------------------------------------------------------------- +;* ATMEL Microcontroller Software Support - ROUSSET - +;* ---------------------------------------------------------------------------- +;* Copyright (c) 2006, Atmel Corporation +; +;* All rights reserved. +;* +;* Redistribution and use in source and binary forms, with or without +;* modification, are permitted provided that the following conditions are met: +;* +;* - Redistributions of source code must retain the above copyright notice, +;* this list of conditions and the disclaimer below. +;* +;* - Redistributions in binary form must reproduce the above copyright notice, +;* this list of conditions and the disclaimer below in the documentation and/or +;* other materials provided with the distribution. +;* +;* Atmel's name may not be used to endorse or promote products derived from +;* this software without specific prior written permission. +;* +;* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +;* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +;* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +;* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +;* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +;* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +;* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +;* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +;* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +;* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +;* ---------------------------------------------------------------------------- + +;------------------------------------------------------------------------------ +; Include your AT91 Library files +;------------------------------------------------------------------------------ +#include "AT91SAM7X256_inc.h" +;------------------------------------------------------------------------------ + +#define TOP_OF_MEMORY (AT91C_ISRAM + AT91C_ISRAM_SIZE) +#define IRQ_STACK_SIZE (3*8*4) + ; 3 words to be saved per interrupt priority level + +; Mode, correspords to bits 0-5 in CPSR +MODE_BITS DEFINE 0x1F ; Bit mask for mode bits in CPSR +USR_MODE DEFINE 0x10 ; User mode +FIQ_MODE DEFINE 0x11 ; Fast Interrupt Request mode +IRQ_MODE DEFINE 0x12 ; Interrupt Request mode +SVC_MODE DEFINE 0x13 ; Supervisor mode +ABT_MODE DEFINE 0x17 ; Abort mode +UND_MODE DEFINE 0x1B ; Undefined Instruction mode +SYS_MODE DEFINE 0x1F ; System mode + +I_BIT DEFINE 0x80 +F_BIT DEFINE 0x40 + +;------------------------------------------------------------------------------ +; ?RESET +; Reset Vector. +; Normally, segment INTVEC is linked at address 0. +; For debugging purposes, INTVEC may be placed at other addresses. +; A debugger that honors the entry point will start the +; program in a normal way even if INTVEC is not at address 0. +;------------------------------------------------------------------------------ + SECTION .intvec:CODE:NOROOT(2) + PUBLIC __vector + PUBLIC __iar_program_start + + ARM +__vector: + ldr pc,[pc,#+24] ;; Reset +__und_handler: + ldr pc,[pc,#+24] ;; Undefined instructions +__swi_handler: + ldr pc,[pc,#+24] ;; Software interrupt (SWI/SVC) +__prefetch_handler: + ldr pc,[pc,#+24] ;; Prefetch abort +__data_handler: + ldr pc,[pc,#+24] ;; Data abort + DC32 0xFFFFFFFF ;; RESERVED +__irq_handler: + ldr pc,[pc,#+24] ;; IRQ +__fiq_handler: + ldr pc,[pc,#+24] ;; FIQ + + DC32 __iar_program_start + DC32 __und_handler + DC32 __swi_handler + DC32 __prefetch_handler + DC32 __data_handler + B . + DC32 IRQ_Handler_Entry + DC32 FIQ_Handler_Entry + +;------------------------------------------------------------------------------ +;- Manage exception: The exception must be ensure in ARM mode +;------------------------------------------------------------------------------ + SECTION text:CODE:NOROOT(2) + ARM +;------------------------------------------------------------------------------ +;- Function : FIQ_Handler_Entry +;- Treatments : FIQ Controller Interrupt Handler. +;- R8 is initialize in Cstartup +;- Called Functions : None only by FIQ +;------------------------------------------------------------------------------ +FIQ_Handler_Entry: + +;- Switch in SVC/User Mode to allow User Stack access for C code +; because the FIQ is not yet acknowledged + +;- Save and r0 in FIQ_Register + mov r9,r0 + ldr r0 , [r8, #AIC_FVR] + msr CPSR_c,#I_BIT | F_BIT | SVC_MODE +;- Save scratch/used registers and LR in User Stack + stmfd sp!, { r1-r3, r12, lr} + +;- Branch to the routine pointed by the AIC_FVR + mov r14, pc + bx r0 + +;- Restore scratch/used registers and LR from User Stack + ldmia sp!, { r1-r3, r12, lr} + +;- Leave Interrupts disabled and switch back in FIQ mode + msr CPSR_c, #I_BIT | F_BIT | FIQ_MODE + +;- Restore the R0 ARM_MODE_SVC register + mov r0,r9 + +;- Restore the Program Counter using the LR_fiq directly in the PC + subs pc,lr,#4 +;------------------------------------------------------------------------------ +;- Function : IRQ_Handler_Entry +;- Treatments : IRQ Controller Interrupt Handler. +;- Called Functions : AIC_IVR[interrupt] +;------------------------------------------------------------------------------ +IRQ_Handler_Entry: +;------------------------- +;- Manage Exception Entry +;------------------------- +;- Adjust and save LR_irq in IRQ stack + sub lr, lr, #4 + stmfd sp!, {lr} + +;- Save r0 and SPSR (need to be saved for nested interrupt) + mrs r14, SPSR + stmfd sp!, {r0,r14} + +;- Write in the IVR to support Protect Mode +;- No effect in Normal Mode +;- De-assert the NIRQ and clear the source in Protect Mode + ldr r14, =AT91C_BASE_AIC + ldr r0 , [r14, #AIC_IVR] + str r14, [r14, #AIC_IVR] + +;- Enable Interrupt and Switch in Supervisor Mode + msr CPSR_c, #SVC_MODE + +;- Save scratch/used registers and LR in User Stack + stmfd sp!, { r1-r3, r12, r14} + +;---------------------------------------------- +;- Branch to the routine pointed by the AIC_IVR +;---------------------------------------------- + mov r14, pc + bx r0 + +;---------------------------------------------- +;- Manage Exception Exit +;---------------------------------------------- +;- Restore scratch/used registers and LR from User Stack + ldmia sp!, { r1-r3, r12, r14} + +;- Disable Interrupt and switch back in IRQ mode + msr CPSR_c, #I_BIT | IRQ_MODE + +;- Mark the End of Interrupt on the AIC + ldr r14, =AT91C_BASE_AIC + str r14, [r14, #AIC_EOICR] + +;- Restore SPSR_irq and r0 from IRQ stack + ldmia sp!, {r0,r14} + msr SPSR_cxsf, r14 + +;- Restore adjusted LR_irq from IRQ stack directly in the PC + ldmia sp!, {pc}^ + +;------------------------------------------------------------------------------ +;- Exception Vectors +;------------------------------------------------------------------------------ + PUBLIC AT91F_Default_FIQ_handler + PUBLIC AT91F_Default_IRQ_handler + PUBLIC AT91F_Spurious_handler + + ARM ; Always ARM mode after exeption + +AT91F_Default_FIQ_handler + b AT91F_Default_FIQ_handler + +AT91F_Default_IRQ_handler + b AT91F_Default_IRQ_handler + +AT91F_Spurious_handler + b AT91F_Spurious_handler + + +;------------------------------------------------------------------------------ +; ?INIT +; Program entry. +;------------------------------------------------------------------------------ + + SECTION FIQ_STACK:DATA:NOROOT(3) + SECTION IRQ_STACK:DATA:NOROOT(3) + SECTION SVC_STACK:DATA:NOROOT(3) + SECTION ABT_STACK:DATA:NOROOT(3) + SECTION UND_STACK:DATA:NOROOT(3) + SECTION CSTACK:DATA:NOROOT(3) + SECTION text:CODE:NOROOT(2) + REQUIRE __vector + EXTERN ?main + PUBLIC __iar_program_start + EXTERN AT91F_LowLevelInit + + +__iar_program_start: + +;------------------------------------------------------------------------------ +;- Low level Init is performed in a C function: AT91F_LowLevelInit +;- Init Stack Pointer to a valid memory area before calling AT91F_LowLevelInit +;------------------------------------------------------------------------------ + +;- Retrieve end of RAM address + + ldr r13,=TOP_OF_MEMORY ;- Temporary stack in internal RAM for Low Level Init execution + ldr r0,=AT91F_LowLevelInit + mov lr, pc + bx r0 ;- Branch on C function (with interworking) + +; Initialize the stack pointers. +; The pattern below can be used for any of the exception stacks: +; FIQ, IRQ, SVC, ABT, UND, SYS. +; The USR mode uses the same stack as SYS. +; The stack segments must be defined in the linker command file, +; and be declared above. + + mrs r0,cpsr ; Original PSR value + bic r0,r0,#MODE_BITS ; Clear the mode bits + orr r0,r0,#SVC_MODE ; Set SVC mode bits + msr cpsr_c,r0 ; Change the mode + ldr sp,=SFE(SVC_STACK) ; End of SVC_STACK + + bic r0,r0,#MODE_BITS ; Clear the mode bits + orr r0,r0,#UND_MODE ; Set UND mode bits + msr cpsr_c,r0 ; Change the mode + ldr sp,=SFE(UND_STACK) ; End of UND_STACK + + bic r0,r0,#MODE_BITS ; Clear the mode bits + orr r0,r0,#ABT_MODE ; Set ABT mode bits + msr cpsr_c,r0 ; Change the mode + ldr sp,=SFE(ABT_STACK) ; End of ABT_STACK + + bic r0,r0,#MODE_BITS ; Clear the mode bits + orr r0,r0,#FIQ_MODE ; Set FIQ mode bits + msr cpsr_c,r0 ; Change the mode + ldr sp,=SFE(FIQ_STACK) ; End of FIQ_STACK + ;- Init the FIQ register + ldr r8, =AT91C_BASE_AIC + + bic r0,r0,#MODE_BITS ; Clear the mode bits + orr r0,r0,#IRQ_MODE ; Set IRQ mode bits + msr cpsr_c,r0 ; Change the mode + ldr sp,=SFE(IRQ_STACK) ; End of IRQ_STACK + + bic r0,r0,#MODE_BITS ; Clear the mode bits + orr r0,r0,#SYS_MODE ; Set System mode bits + msr cpsr_c,r0 ; Change the mode + ldr sp,=SFE(CSTACK) ; End of CSTACK + +#ifdef __ARMVFP__ +; Enable the VFP coprocessor. + mov r0, #0x40000000 ; Set EN bit in VFP + fmxr fpexc, r0 ; FPEXC, clear others. + +; Disable underflow exceptions by setting flush to zero mode. +; For full IEEE 754 underflow compliance this code should be removed +; and the appropriate exception handler installed. + mov r0, #0x01000000 ; Set FZ bit in VFP + fmxr fpscr, r0 ; FPSCR, clear others. +#endif + +; Add more initialization here + + +; Continue to ?main for more IAR specific system startup + + ldr r0,=?main + bx r0 + + END ;- Terminates the assembly of the last module in a file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/srcIAR/Cstartup_SAM7.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/srcIAR/Cstartup_SAM7.c new file mode 100644 index 0000000..a7c72b9 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/iar/iar_v5/srcIAR/Cstartup_SAM7.c @@ -0,0 +1,98 @@ +//----------------------------------------------------------------------------- +// ATMEL Microcontroller Software Support - ROUSSET - +//----------------------------------------------------------------------------- +// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +//----------------------------------------------------------------------------- +// File Name : Cstartup_SAM7.c +// Object : Low level initialisations written in C for Tools +// For AT91SAM7X256 with 2 flash plane +// Creation : JPP 14-Sep-2006 +//----------------------------------------------------------------------------- + +#include "project.h" + + +// The following functions must be write in ARM mode this function called +// directly by exception vector +extern void AT91F_Spurious_handler(void); +extern void AT91F_Default_IRQ_handler(void); +extern void AT91F_Default_FIQ_handler(void); + +//*---------------------------------------------------------------------------- +//* \fn AT91F_LowLevelInit +//* \brief This function performs very low level HW initialization +//* this function can use a Stack, depending the compilation +//* optimization mode +//*---------------------------------------------------------------------------- +void AT91F_LowLevelInit(void) @ "ICODE" +{ + unsigned char i; + /////////////////////////////////////////////////////////////////////////// + // EFC Init + /////////////////////////////////////////////////////////////////////////// + AT91C_BASE_MC->MC_FMR = AT91C_MC_FWS_1FWS ; + + /////////////////////////////////////////////////////////////////////////// + // Init PMC Step 1. Enable Main Oscillator + // Main Oscillator startup time is board specific: + // Main Oscillator Startup Time worst case (3MHz) corresponds to 15ms + // (0x40 for AT91C_CKGR_OSCOUNT field) + /////////////////////////////////////////////////////////////////////////// + AT91C_BASE_PMC->PMC_MOR = (( AT91C_CKGR_OSCOUNT & (0x40 <<8) | AT91C_CKGR_MOSCEN )); + // Wait Main Oscillator stabilization + while(!(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MOSCS)); + + /////////////////////////////////////////////////////////////////////////// + // Init PMC Step 2. + // Set PLL to 96MHz (96,109MHz) and UDP Clock to 48MHz + // PLL Startup time depends on PLL RC filter: worst case is choosen + // UDP Clock (48,058MHz) is compliant with the Universal Serial Bus + // Specification (+/- 0.25% for full speed) + /////////////////////////////////////////////////////////////////////////// + AT91C_BASE_PMC->PMC_PLLR = AT91C_CKGR_USBDIV_1 | + (16 << 8) | + (AT91C_CKGR_MUL & (72 << 16)) | + (AT91C_CKGR_DIV & 14); + // Wait for PLL stabilization + while( !(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_LOCK) ); + // Wait until the master clock is established for the case we already + // turn on the PLL + while( !(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MCKRDY) ); + + /////////////////////////////////////////////////////////////////////////// + // Init PMC Step 3. + // Selection of Master Clock MCK equal to (Processor Clock PCK) PLL/2=48MHz + // The PMC_MCKR register must not be programmed in a single write operation + // (see. Product Errata Sheet) + /////////////////////////////////////////////////////////////////////////// + AT91C_BASE_PMC->PMC_MCKR = AT91C_PMC_PRES_CLK_2; + // Wait until the master clock is established + while( !(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MCKRDY) ); + + AT91C_BASE_PMC->PMC_MCKR |= AT91C_PMC_CSS_PLL_CLK; + // Wait until the master clock is established + while( !(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MCKRDY) ); + + /////////////////////////////////////////////////////////////////////////// + // Disable Watchdog (write once register) + /////////////////////////////////////////////////////////////////////////// + AT91C_BASE_WDTC->WDTC_WDMR = AT91C_WDTC_WDDIS; + + /////////////////////////////////////////////////////////////////////////// + // Init AIC: assign corresponding handler for each interrupt source + /////////////////////////////////////////////////////////////////////////// + AT91C_BASE_AIC->AIC_SVR[0] = (int) AT91F_Default_FIQ_handler ; + for (i = 1; i < 31; i++) { + AT91C_BASE_AIC->AIC_SVR[i] = (int) AT91F_Default_IRQ_handler ; + } + AT91C_BASE_AIC->AIC_SPU = (unsigned int) AT91F_Spurious_handler; +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/lib/cmock.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/lib/cmock.rb new file mode 100644 index 0000000..e332351 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/lib/cmock.rb @@ -0,0 +1,65 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +[ "../config/production_environment", + "cmock_header_parser", + "cmock_generator", + "cmock_file_writer", + "cmock_config", + "cmock_plugin_manager", + "cmock_generator_utils", + "cmock_unityhelper_parser"].each {|req| require "#{File.expand_path(File.dirname(__FILE__))}/#{req}"} + +class CMock + + def initialize(options=nil) + cm_config = CMockConfig.new(options) + cm_unityhelper = CMockUnityHelperParser.new(cm_config) + cm_writer = CMockFileWriter.new(cm_config) + cm_gen_utils = CMockGeneratorUtils.new(cm_config, {:unity_helper => cm_unityhelper}) + cm_gen_plugins = CMockPluginManager.new(cm_config, cm_gen_utils) + @cm_parser = CMockHeaderParser.new(cm_config) + @cm_generator = CMockGenerator.new(cm_config, cm_writer, cm_gen_utils, cm_gen_plugins) + @silent = (cm_config.verbosity < 2) + end + + def setup_mocks(files) + [files].flatten.each do |src| + generate_mock src + end + end + + private ############################### + + def generate_mock(src) + name = File.basename(src, '.h') + puts "Creating mock for #{name}..." unless @silent + @cm_generator.create_mock(name, @cm_parser.parse(name, File.read(src))) + end +end + + # Command Line Support ############################### + +if ($0 == __FILE__) + usage = "usage: ruby #{__FILE__} (-oOptionsFile) File(s)ToMock" + + if (!ARGV[0]) + puts usage + exit 1 + end + + options = nil + filelist = [] + ARGV.each do |arg| + if (arg =~ /^-o(\w*)/) + options = arg.gsub(/^-o/,'') + else + filelist << arg + end + end + + CMock.new(options).setup_mocks(filelist) +end \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/lib/cmock_config.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/lib/cmock_config.rb new file mode 100644 index 0000000..d574a70 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/lib/cmock_config.rb @@ -0,0 +1,123 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +class CMockConfig + + CMockDefaultOptions = + { + :framework => :unity, + :mock_path => 'mocks', + :mock_prefix => 'Mock', + :plugins => [], + :strippables => ['(?:__attribute__\s*\(+.*?\)+)'], + :attributes => ['__ramfunc', '__irq', '__fiq', 'register', 'extern'], + :enforce_strict_ordering => false, + :unity_helper => false, + :treat_as => {}, + :treat_as_void => [], + :memcmp_if_unknown => true, + :when_no_prototypes => :warn, #the options being :ignore, :warn, or :error + :when_ptr => :compare_data, #the options being :compare_ptr, :compare_data, or :smart + :verbosity => 2, #the options being 0 errors only, 1 warnings and errors, 2 normal info, 3 verbose + :treat_externs => :exclude, #the options being :include or :exclude + :ignore => :args_and_calls, #the options being :args_and_calls or :args_only + :callback_include_count => true, + :callback_after_arg_check => false, + :includes => nil, + :includes_h_pre_orig_header => nil, + :includes_h_post_orig_header => nil, + :includes_c_pre_header => nil, + :includes_c_post_header => nil, + } + + def initialize(options=nil) + case(options) + when NilClass then options = CMockDefaultOptions.clone + when String then options = CMockDefaultOptions.clone.merge(load_config_file_from_yaml(options)) + when Hash then options = CMockDefaultOptions.clone.merge(options) + else raise "If you specify arguments, it should be a filename or a hash of options" + end + + #do some quick type verification + [:plugins, :attributes, :treat_as_void].each do |opt| + unless (options[opt].class == Array) + options[opt] = [] + puts "WARNING: :#{opt.to_s} should be an array." unless (options[:verbosity] < 1) + end + end + [:includes, :includes_h_pre_orig_header, :includes_h_post_orig_header, :includes_c_pre_header, :includes_c_post_header].each do |opt| + unless (options[opt].nil? or (options[opt].class == Array)) + options[opt] = [] + puts "WARNING: :#{opt.to_s} should be an array." unless (options[:verbosity] < 1) + end + end + options[:plugins].compact! + options[:plugins].map! {|p| p.to_sym} + @options = options + @options[:treat_as].merge!(standard_treat_as_map) + @options.each_key { |key| eval("def #{key.to_s}() return @options[:#{key.to_s}] end") } + end + + def load_config_file_from_yaml yaml_filename + require 'yaml' + require 'fileutils' + YAML.load_file(yaml_filename)[:cmock] + end + + def set_path(path) + @src_path = path + end + + def load_unity_helper + return File.new(@options[:unity_helper]).read if (@options[:unity_helper]) + return nil + end + + def standard_treat_as_map + { + 'int' => 'INT', + 'char' => 'INT8', + 'short' => 'INT16', + 'long' => 'INT', + 'int8' => 'INT8', + 'int16' => 'INT16', + 'int32' => 'INT', + 'int8_t' => 'INT8', + 'int16_t' => 'INT16', + 'int32_t' => 'INT', + 'INT8_T' => 'INT8', + 'INT16_T' => 'INT16', + 'INT32_T' => 'INT', + 'bool' => 'INT', + 'bool_t' => 'INT', + 'BOOL' => 'INT', + 'BOOL_T' => 'INT', + 'unsigned int' => 'HEX32', + 'unsigned long' => 'HEX32', + 'uint32' => 'HEX32', + 'uint32_t' => 'HEX32', + 'UINT32' => 'HEX32', + 'UINT32_T' => 'HEX32', + 'void*' => 'PTR', + 'unsigned short' => 'HEX16', + 'uint16' => 'HEX16', + 'uint16_t' => 'HEX16', + 'UINT16' => 'HEX16', + 'UINT16_T' => 'HEX16', + 'unsigned char' => 'HEX8', + 'uint8' => 'HEX8', + 'uint8_t' => 'HEX8', + 'UINT8' => 'HEX8', + 'UINT8_T' => 'HEX8', + 'char*' => 'STRING', + 'pCHAR' => 'STRING', + 'cstring' => 'STRING', + 'CSTRING' => 'STRING', + 'float' => 'FLOAT', + 'double' => 'FLOAT', + } + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/lib/cmock_file_writer.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/lib/cmock_file_writer.rb new file mode 100644 index 0000000..63faee5 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/lib/cmock_file_writer.rb @@ -0,0 +1,33 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +class CMockFileWriter + + attr_reader :config + + def initialize(config) + @config = config + end + + def create_file(filename) + raise "Where's the block of data to create?" unless block_given? + full_file_name_temp = "#{@config.mock_path}/#{filename}.new" + full_file_name_done = "#{@config.mock_path}/#{filename}" + File.open(full_file_name_temp, 'w') do |file| + yield(file, filename) + end + update_file(full_file_name_done, full_file_name_temp) + end + + private ################################### + + def update_file(dest, src) + require 'fileutils' + FileUtils.rm(dest) if (File.exist?(dest)) + FileUtils.cp(src, dest) + FileUtils.rm(src) + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/lib/cmock_generator.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/lib/cmock_generator.rb new file mode 100644 index 0000000..5f483ba --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/lib/cmock_generator.rb @@ -0,0 +1,196 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +$here = File.dirname __FILE__ + +class CMockGenerator + + attr_accessor :config, :file_writer, :module_name, :mock_name, :utils, :plugins, :ordered + + def initialize(config, file_writer, utils, plugins) + @file_writer = file_writer + @utils = utils + @plugins = plugins + @config = config + @prefix = @config.mock_prefix + @ordered = @config.enforce_strict_ordering + @framework = @config.framework.to_s + + @includes_h_pre_orig_header = (@config.includes || @config.includes_h_pre_orig_header || []).map{|h| h =~ /\n" + file << "#include \n" + file << "#include \n" + file << "#include \"#{@framework}.h\"\n" + file << "#include \"cmock.h\"\n" + @includes_c_pre_header.each {|inc| file << "#include #{inc}\n"} + file << "#include \"#{header_file}\"\n" + @includes_c_post_header.each {|inc| file << "#include #{inc}\n"} + file << "\n" + end + + def create_instance_structure(file, functions) + functions.each do |function| + file << "typedef struct _CMOCK_#{function[:name]}_CALL_INSTANCE\n{\n" + file << " UNITY_LINE_TYPE LineNumber;\n" + file << @plugins.run(:instance_typedefs, function) + file << "\n} CMOCK_#{function[:name]}_CALL_INSTANCE;\n\n" + end + file << "static struct #{@mock_name}Instance\n{\n" + if (functions.size == 0) + file << " unsigned char placeHolder;\n" + end + functions.each do |function| + file << @plugins.run(:instance_structure, function) + file << " CMOCK_MEM_INDEX_TYPE #{function[:name]}_CallInstance;\n" + end + file << "} Mock;\n\n" + end + + def create_extern_declarations(file) + file << "extern jmp_buf AbortFrame;\n" + if (@ordered) + file << "extern int GlobalExpectCount;\n" + file << "extern int GlobalVerifyOrder;\n" + end + file << "\n" + end + + def create_mock_verify_function(file, functions) + file << "void #{@mock_name}_Verify(void)\n{\n" + verifications = functions.collect {|function| @plugins.run(:mock_verify, function)}.join + file << " UNITY_LINE_TYPE cmock_line = TEST_LINE_NUM;\n" unless verifications.empty? + file << verifications + file << "}\n\n" + end + + def create_mock_init_function(file) + file << "void #{@mock_name}_Init(void)\n{\n" + file << " #{@mock_name}_Destroy();\n" + file << "}\n\n" + end + + def create_mock_destroy_function(file, functions) + file << "void #{@mock_name}_Destroy(void)\n{\n" + file << " CMock_Guts_MemFreeAll();\n" + file << " memset(&Mock, 0, sizeof(Mock));\n" + file << functions.collect {|function| @plugins.run(:mock_destroy, function)}.join + if (@ordered) + file << " GlobalExpectCount = 0;\n" + file << " GlobalVerifyOrder = 0;\n" + end + file << "}\n\n" + end + + def create_mock_implementation(file, function) + # prepare return value and arguments + if (function[:modifier].empty?) + function_mod_and_rettype = function[:return][:type] + else + function_mod_and_rettype = function[:modifier] + ' ' + function[:return][:type] + end + args_string = function[:args_string] + args_string += (", " + function[:var_arg]) unless (function[:var_arg].nil?) + + # Create mock function + file << "#{function_mod_and_rettype} #{function[:name]}(#{args_string})\n" + file << "{\n" + file << " UNITY_LINE_TYPE cmock_line = TEST_LINE_NUM;\n" + file << " CMOCK_#{function[:name]}_CALL_INSTANCE* cmock_call_instance = (CMOCK_#{function[:name]}_CALL_INSTANCE*)CMock_Guts_GetAddressFor(Mock.#{function[:name]}_CallInstance);\n" + file << " Mock.#{function[:name]}_CallInstance = CMock_Guts_MemNext(Mock.#{function[:name]}_CallInstance);\n" + file << @plugins.run(:mock_implementation_precheck, function) + file << " UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, \"Function '#{function[:name]}' called more times than expected.\");\n" + file << " cmock_line = cmock_call_instance->LineNumber;\n" + if (@ordered) + file << " if (cmock_call_instance->CallOrder > ++GlobalVerifyOrder)\n" + file << " UNITY_TEST_FAIL(cmock_line, \"Function '#{function[:name]}' called earlier than expected.\");" + file << " if (cmock_call_instance->CallOrder < GlobalVerifyOrder)\n" + file << " UNITY_TEST_FAIL(cmock_line, \"Function '#{function[:name]}' called later than expected.\");" + # file << " UNITY_TEST_ASSERT((cmock_call_instance->CallOrder == ++GlobalVerifyOrder), cmock_line, \"Out of order function calls. Function '#{function[:name]}'\");\n" + end + file << @plugins.run(:mock_implementation, function) + file << " return cmock_call_instance->ReturnVal;\n" unless (function[:return][:void?]) + file << "}\n\n" + end + + def create_mock_interfaces(file, function) + file << @utils.code_add_argument_loader(function) + file << @plugins.run(:mock_interfaces, function) + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_array.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_array.rb new file mode 100644 index 0000000..25045a2 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_array.rb @@ -0,0 +1,57 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +class CMockGeneratorPluginArray + + attr_reader :priority + attr_accessor :config, :utils, :unity_helper, :ordered + def initialize(config, utils) + @config = config + @ptr_handling = @config.when_ptr + @ordered = @config.enforce_strict_ordering + @utils = utils + @unity_helper = @utils.helpers[:unity_helper] + @priority = 8 + end + + def instance_typedefs(function) + function[:args].inject("") do |all, arg| + (arg[:ptr?]) ? all + " int Expected_#{arg[:name]}_Depth;\n" : all + end + end + + def mock_function_declarations(function) + return nil unless function[:contains_ptr?] + args_call = function[:args].map{|m| m[:ptr?] ? "#{m[:name]}, #{m[:name]}_Depth" : "#{m[:name]}"}.join(', ') + args_string = function[:args].map{|m| m[:ptr?] ? "#{m[:type]} #{m[:name]}, int #{m[:name]}_Depth" : "#{m[:type]} #{m[:name]}"}.join(', ') + if (function[:return][:void?]) + return "#define #{function[:name]}_ExpectWithArray(#{args_call}) #{function[:name]}_CMockExpectWithArray(__LINE__, #{args_call})\n" + + "void #{function[:name]}_CMockExpectWithArray(UNITY_LINE_TYPE cmock_line, #{args_string});\n" + else + return "#define #{function[:name]}_ExpectWithArrayAndReturn(#{args_call}, cmock_retval) #{function[:name]}_CMockExpectWithArrayAndReturn(__LINE__, #{args_call}, cmock_retval)\n" + + "void #{function[:name]}_CMockExpectWithArrayAndReturn(UNITY_LINE_TYPE cmock_line, #{args_string}, #{function[:return][:str]});\n" + end + end + + def mock_interfaces(function) + return nil unless function[:contains_ptr?] + lines = [] + func_name = function[:name] + args_string = function[:args].map{|m| m[:ptr?] ? "#{m[:type]} #{m[:name]}, int #{m[:name]}_Depth" : "#{m[:type]} #{m[:name]}"}.join(', ') + call_string = function[:args].map{|m| m[:ptr?] ? "#{m[:name]}, #{m[:name]}_Depth" : m[:name]}.join(', ') + if (function[:return][:void?]) + lines << "void #{func_name}_CMockExpectWithArray(UNITY_LINE_TYPE cmock_line, #{args_string})\n" + else + lines << "void #{func_name}_CMockExpectWithArrayAndReturn(UNITY_LINE_TYPE cmock_line, #{args_string}, #{function[:return][:str]})\n" + end + lines << "{\n" + lines << @utils.code_add_base_expectation(func_name) + lines << " CMockExpectParameters_#{func_name}(cmock_call_instance, #{call_string});\n" + lines << " cmock_call_instance->ReturnVal = cmock_to_return;\n" unless (function[:return][:void?]) + lines << "}\n\n" + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_callback.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_callback.rb new file mode 100644 index 0000000..0db9b36 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_callback.rb @@ -0,0 +1,78 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +class CMockGeneratorPluginCallback + + attr_accessor :include_count + attr_reader :priority + attr_reader :config, :utils + + def initialize(config, utils) + @config = config + @utils = utils + @priority = 6 + + @include_count = @config.callback_include_count + if (@config.callback_after_arg_check) + alias :mock_implementation :mock_implementation_for_callbacks + alias :mock_implementation_precheck :nothing + else + alias :mock_implementation_precheck :mock_implementation_for_callbacks + alias :mock_implementation :nothing + end + end + + def instance_structure(function) + func_name = function[:name] + " CMOCK_#{func_name}_CALLBACK #{func_name}_CallbackFunctionPointer;\n" + + " int #{func_name}_CallbackCalls;\n" + end + + def mock_function_declarations(function) + func_name = function[:name] + return_type = function[:return][:const?] ? "const #{function[:return][:type]}" : function[:return][:type] + style = (@include_count ? 1 : 0) | (function[:args].empty? ? 0 : 2) + styles = [ "void", "int cmock_num_calls", function[:args_string], "#{function[:args_string]}, int cmock_num_calls" ] + "typedef #{return_type} (* CMOCK_#{func_name}_CALLBACK)(#{styles[style]});\nvoid #{func_name}_StubWithCallback(CMOCK_#{func_name}_CALLBACK Callback);\n" + end + + def mock_implementation_for_callbacks(function) + func_name = function[:name] + style = (@include_count ? 1 : 0) | (function[:args].empty? ? 0 : 2) | (function[:return][:void?] ? 0 : 4) + " if (Mock.#{func_name}_CallbackFunctionPointer != NULL)\n {\n" + + case(style) + when 0 then " Mock.#{func_name}_CallbackFunctionPointer();\n return;\n }\n" + when 1 then " Mock.#{func_name}_CallbackFunctionPointer(Mock.#{func_name}_CallbackCalls++);\n return;\n }\n" + when 2 then " Mock.#{func_name}_CallbackFunctionPointer(#{function[:args].map{|m| m[:name]}.join(', ')});\n return;\n }\n" + when 3 then " Mock.#{func_name}_CallbackFunctionPointer(#{function[:args].map{|m| m[:name]}.join(', ')}, Mock.#{func_name}_CallbackCalls++);\n return;\n }\n" + when 4 then " return Mock.#{func_name}_CallbackFunctionPointer(void);\n }\n" + when 5 then " return Mock.#{func_name}_CallbackFunctionPointer(Mock.#{func_name}_CallbackCalls++);\n }\n" + when 6 then " return Mock.#{func_name}_CallbackFunctionPointer(#{function[:args].map{|m| m[:name]}.join(', ')});\n }\n" + when 7 then " return Mock.#{func_name}_CallbackFunctionPointer(#{function[:args].map{|m| m[:name]}.join(', ')}, Mock.#{func_name}_CallbackCalls++);\n }\n" + end + end + + def nothing(function) + return "" + end + + def mock_interfaces(function) + func_name = function[:name] + "void #{func_name}_StubWithCallback(CMOCK_#{func_name}_CALLBACK Callback)\n{\n" + + " Mock.#{func_name}_CallbackFunctionPointer = Callback;\n}\n\n" + end + + def mock_destroy(function) + " Mock.#{function[:name]}_CallbackFunctionPointer = NULL;\n" + + " Mock.#{function[:name]}_CallbackCalls = 0;\n" + end + + def mock_verify(function) + func_name = function[:name] + " if (Mock.#{func_name}_CallbackFunctionPointer != NULL)\n Mock.#{func_name}_CallInstance = CMOCK_GUTS_NONE;\n" + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_cexception.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_cexception.rb new file mode 100644 index 0000000..fdf31db --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_cexception.rb @@ -0,0 +1,51 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +class CMockGeneratorPluginCexception + + attr_reader :priority + attr_reader :config, :utils + + def initialize(config, utils) + @config = config + @utils = utils + @priority = 7 + end + + def include_files + return "#include \"CException.h\"\n" + end + + def instance_typedefs(function) + " CEXCEPTION_T ExceptionToThrow;\n" + end + + def mock_function_declarations(function) + if (function[:args_string] == "void") + return "#define #{function[:name]}_ExpectAndThrow(cmock_to_throw) #{function[:name]}_CMockExpectAndThrow(__LINE__, cmock_to_throw)\n" + + "void #{function[:name]}_CMockExpectAndThrow(UNITY_LINE_TYPE cmock_line, CEXCEPTION_T cmock_to_throw);\n" + else + return "#define #{function[:name]}_ExpectAndThrow(#{function[:args_call]}, cmock_to_throw) #{function[:name]}_CMockExpectAndThrow(__LINE__, #{function[:args_call]}, cmock_to_throw)\n" + + "void #{function[:name]}_CMockExpectAndThrow(UNITY_LINE_TYPE cmock_line, #{function[:args_string]}, CEXCEPTION_T cmock_to_throw);\n" + end + end + + def mock_implementation(function) + " if (cmock_call_instance->ExceptionToThrow != CEXCEPTION_NONE)\n {\n" + + " Throw(cmock_call_instance->ExceptionToThrow);\n }\n" + end + + def mock_interfaces(function) + arg_insert = (function[:args_string] == "void") ? "" : "#{function[:args_string]}, " + call_string = function[:args].map{|m| m[:name]}.join(', ') + [ "void #{function[:name]}_CMockExpectAndThrow(UNITY_LINE_TYPE cmock_line, #{arg_insert}CEXCEPTION_T cmock_to_throw)\n{\n", + @utils.code_add_base_expectation(function[:name]), + @utils.code_call_argument_loader(function), + " cmock_call_instance->ExceptionToThrow = cmock_to_throw;\n", + "}\n\n" ].join + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_expect.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_expect.rb new file mode 100644 index 0000000..5651cd9 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_expect.rb @@ -0,0 +1,86 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +class CMockGeneratorPluginExpect + + attr_reader :priority + attr_accessor :config, :utils, :unity_helper, :ordered + + def initialize(config, utils) + @config = config + @ptr_handling = @config.when_ptr + @ordered = @config.enforce_strict_ordering + @utils = utils + @unity_helper = @utils.helpers[:unity_helper] + @priority = 5 + end + + def instance_typedefs(function) + lines = "" + lines << " #{function[:return][:type]} ReturnVal;\n" unless (function[:return][:void?]) + lines << " int CallOrder;\n" if (@ordered) + function[:args].each do |arg| + lines << " #{arg[:type]} Expected_#{arg[:name]};\n" + end + lines + end + + def mock_function_declarations(function) + if (function[:args].empty?) + if (function[:return][:void?]) + return "#define #{function[:name]}_Expect() #{function[:name]}_CMockExpect(__LINE__)\n" + + "void #{function[:name]}_CMockExpect(UNITY_LINE_TYPE cmock_line);\n" + else + return "#define #{function[:name]}_ExpectAndReturn(cmock_retval) #{function[:name]}_CMockExpectAndReturn(__LINE__, cmock_retval)\n" + + "void #{function[:name]}_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, #{function[:return][:str]});\n" + end + else + if (function[:return][:void?]) + return "#define #{function[:name]}_Expect(#{function[:args_call]}) #{function[:name]}_CMockExpect(__LINE__, #{function[:args_call]})\n" + + "void #{function[:name]}_CMockExpect(UNITY_LINE_TYPE cmock_line, #{function[:args_string]});\n" + else + return "#define #{function[:name]}_ExpectAndReturn(#{function[:args_call]}, cmock_retval) #{function[:name]}_CMockExpectAndReturn(__LINE__, #{function[:args_call]}, cmock_retval)\n" + + "void #{function[:name]}_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, #{function[:args_string]}, #{function[:return][:str]});\n" + end + end + end + + def mock_implementation(function) + lines = "" + function[:args].each do |arg| + lines << @utils.code_verify_an_arg_expectation(function, arg) + end + lines + end + + def mock_interfaces(function) + lines = "" + func_name = function[:name] + if (function[:return][:void?]) + if (function[:args_string] == "void") + lines << "void #{func_name}_CMockExpect(UNITY_LINE_TYPE cmock_line)\n{\n" + else + lines << "void #{func_name}_CMockExpect(UNITY_LINE_TYPE cmock_line, #{function[:args_string]})\n{\n" + end + else + if (function[:args_string] == "void") + lines << "void #{func_name}_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, #{function[:return][:str]})\n{\n" + else + lines << "void #{func_name}_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, #{function[:args_string]}, #{function[:return][:str]})\n{\n" + end + end + lines << @utils.code_add_base_expectation(func_name) + lines << @utils.code_call_argument_loader(function) + lines << @utils.code_assign_argument_quickly("cmock_call_instance->ReturnVal", function[:return]) unless (function[:return][:void?]) + lines << "}\n\n" + end + + def mock_verify(function) + func_name = function[:name] + " UNITY_TEST_ASSERT(CMOCK_GUTS_NONE == Mock.#{func_name}_CallInstance, cmock_line, \"Function '#{func_name}' called less times than expected.\");\n" + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_ignore.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_ignore.rb new file mode 100644 index 0000000..a81933d --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_ignore.rb @@ -0,0 +1,85 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +class CMockGeneratorPluginIgnore + + attr_reader :priority + attr_reader :config, :utils + + def initialize(config, utils) + @config = config + if (@config.ignore == :args_and_calls) + alias :mock_implementation_precheck :mock_implementation_for_ignores + alias :mock_implementation :nothing + alias :mock_verify :mock_conditionally_verify_counts + else + alias :mock_implementation :mock_implementation_for_ignores + alias :mock_implementation_precheck :nothing + alias :mock_verify :nothing + end + @utils = utils + @priority = 2 + end + + def instance_structure(function) + if (function[:return][:void?]) + " int #{function[:name]}_IgnoreBool;\n" + else + " int #{function[:name]}_IgnoreBool;\n #{function[:return][:type]} #{function[:name]}_FinalReturn;\n" + end + end + + def mock_function_declarations(function) + if (function[:return][:void?]) + return "#define #{function[:name]}_Ignore() #{function[:name]}_CMockIgnore(__LINE__)\n" + + "void #{function[:name]}_CMockIgnore(UNITY_LINE_TYPE cmock_line);\n" + else + return "#define #{function[:name]}_IgnoreAndReturn(cmock_retval) #{function[:name]}_CMockIgnoreAndReturn(__LINE__, cmock_retval)\n" + + "void #{function[:name]}_CMockIgnoreAndReturn(UNITY_LINE_TYPE cmock_line, #{function[:return][:str]});\n" + end + end + + def mock_implementation_for_ignores(function) + lines = " if (Mock.#{function[:name]}_IgnoreBool)\n {\n" + if (function[:return][:void?]) + lines << " return;\n }\n" + else + retval = function[:return].merge( { :name => "cmock_call_instance->ReturnVal"} ) + lines << " if (cmock_call_instance == NULL)\n return Mock.#{function[:name]}_FinalReturn;\n" + lines << " " + @utils.code_assign_argument_quickly("Mock.#{function[:name]}_FinalReturn", retval) unless (retval[:void?]) + lines << " return cmock_call_instance->ReturnVal;\n }\n" + end + lines + end + + def mock_interfaces(function) + lines = "" + if (function[:return][:void?]) + lines << "void #{function[:name]}_CMockIgnore(UNITY_LINE_TYPE cmock_line)\n{\n" + else + lines << "void #{function[:name]}_CMockIgnoreAndReturn(UNITY_LINE_TYPE cmock_line, #{function[:return][:str]})\n{\n" + end + if (@config.ignore == :args_only) + lines << @utils.code_add_base_expectation(function[:name], true) + elsif (!function[:return][:void?]) + lines << @utils.code_add_base_expectation(function[:name], false) + end + unless (function[:return][:void?]) + lines << " cmock_call_instance->ReturnVal = cmock_to_return;\n" + end + lines << " Mock.#{function[:name]}_IgnoreBool = (int)1;\n" + lines << "}\n\n" + end + + def mock_conditionally_verify_counts(function) + func_name = function[:name] + " if (Mock.#{func_name}_IgnoreBool)\n Mock.#{func_name}_CallInstance = CMOCK_GUTS_NONE;\n" + end + + def nothing(function) + return "" + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/lib/cmock_generator_utils.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/lib/cmock_generator_utils.rb new file mode 100644 index 0000000..4444979 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/lib/cmock_generator_utils.rb @@ -0,0 +1,177 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +class CMockGeneratorUtils + + attr_accessor :config, :helpers, :ordered, :ptr_handling, :arrays, :cexception + + def initialize(config, helpers={}) + @config = config + @ptr_handling = @config.when_ptr + @ordered = @config.enforce_strict_ordering + @arrays = @config.plugins.include? :array + @cexception = @config.plugins.include? :cexception + @treat_as = @config.treat_as + @helpers = helpers + + if (@arrays) + case(@ptr_handling) + when :smart then alias :code_verify_an_arg_expectation :code_verify_an_arg_expectation_with_smart_arrays + when :compare_data then alias :code_verify_an_arg_expectation :code_verify_an_arg_expectation_with_normal_arrays + when :compare_ptr then raise "ERROR: the array plugin doesn't enjoy working with :compare_ptr only. Disable one option." + end + else + alias :code_verify_an_arg_expectation :code_verify_an_arg_expectation_with_no_arrays + end + end + + def code_add_base_expectation(func_name, global_ordering_supported=true) + lines = " CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_#{func_name}_CALL_INSTANCE));\n" + lines << " CMOCK_#{func_name}_CALL_INSTANCE* cmock_call_instance = (CMOCK_#{func_name}_CALL_INSTANCE*)CMock_Guts_GetAddressFor(cmock_guts_index);\n" + lines << " UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, \"CMock has run out of memory. Please allocate more.\");\n" + lines << " Mock.#{func_name}_CallInstance = CMock_Guts_MemChain(Mock.#{func_name}_CallInstance, cmock_guts_index);\n" + lines << " cmock_call_instance->LineNumber = cmock_line;\n" + lines << " cmock_call_instance->CallOrder = ++GlobalExpectCount;\n" if (@ordered and global_ordering_supported) + lines << " cmock_call_instance->ExceptionToThrow = CEXCEPTION_NONE;\n" if (@cexception) + lines + end + + def code_add_an_arg_expectation(arg, depth=1) + lines = code_assign_argument_quickly("cmock_call_instance->Expected_#{arg[:name]}", arg) + lines << " cmock_call_instance->Expected_#{arg[:name]}_Depth = #{arg[:name]}_Depth;\n" if (@arrays and (depth.class == String)) + lines + end + + def code_assign_argument_quickly(dest, arg) + if (arg[:ptr?] or @treat_as.include?(arg[:type])) + " #{dest} = #{arg[:const?] ? "(#{arg[:type]})" : ''}#{arg[:name]};\n" + else + " memcpy(&#{dest}, &#{arg[:name]}, sizeof(#{arg[:type]}));\n" + end + end + + def code_add_argument_loader(function) + if (function[:args_string] != "void") + if (@arrays) + args_string = function[:args].map do |m| + const_str = m[ :const? ] ? 'const ' : '' + m[:ptr?] ? "#{const_str}#{m[:type]} #{m[:name]}, int #{m[:name]}_Depth" : "#{const_str}#{m[:type]} #{m[:name]}" + end.join(', ') + "void CMockExpectParameters_#{function[:name]}(CMOCK_#{function[:name]}_CALL_INSTANCE* cmock_call_instance, #{args_string})\n{\n" + + function[:args].inject("") { |all, arg| all + code_add_an_arg_expectation(arg, (arg[:ptr?] ? "#{arg[:name]}_Depth" : 1) ) } + + "}\n\n" + else + "void CMockExpectParameters_#{function[:name]}(CMOCK_#{function[:name]}_CALL_INSTANCE* cmock_call_instance, #{function[:args_string]})\n{\n" + + function[:args].inject("") { |all, arg| all + code_add_an_arg_expectation(arg) } + + "}\n\n" + end + else + "" + end + end + + def code_call_argument_loader(function) + if (function[:args_string] != "void") + args = function[:args].map do |m| + (@arrays and m[:ptr?]) ? "#{m[:name]}, 1" : m[:name] + end + " CMockExpectParameters_#{function[:name]}(cmock_call_instance, #{args.join(', ')});\n" + else + "" + end + end + + #private ###################### + + def lookup_expect_type(function, arg) + c_type = arg[:type] + arg_name = arg[:name] + expected = "cmock_call_instance->Expected_#{arg_name}" + unity_func = if ((arg[:ptr?]) and ((c_type =~ /\*\*/) or (@ptr_handling == :compare_ptr))) + ['UNITY_TEST_ASSERT_EQUAL_PTR', ''] + else + (@helpers.nil? or @helpers[:unity_helper].nil?) ? ["UNITY_TEST_ASSERT_EQUAL",''] : @helpers[:unity_helper].get_helper(c_type) + end + unity_msg = "Function '#{function[:name]}' called with unexpected value for argument '#{arg_name}'." + return c_type, arg_name, expected, unity_func[0], unity_func[1], unity_msg + end + + def code_verify_an_arg_expectation_with_no_arrays(function, arg) + c_type, arg_name, expected, unity_func, pre, unity_msg = lookup_expect_type(function, arg) + case(unity_func) + when "UNITY_TEST_ASSERT_EQUAL_MEMORY" + c_type_local = c_type.gsub(/\*$/,'') + return " UNITY_TEST_ASSERT_EQUAL_MEMORY((void*)(#{pre}#{expected}), (void*)(#{pre}#{arg_name}), sizeof(#{c_type_local}), cmock_line, \"#{unity_msg}\");\n" + when "UNITY_TEST_ASSERT_EQUAL_MEMORY" + [ " if (#{pre}#{expected} == NULL)", + " { UNITY_TEST_ASSERT_NULL(#{pre}#{arg_name}, cmock_line, \"Expected NULL. #{unity_msg}\"); }", + " else", + " { UNITY_TEST_ASSERT_EQUAL_MEMORY((void*)(#{pre}#{expected}), (void*)(#{pre}#{arg_name}), sizeof(#{c_type.sub('*','')}), cmock_line, \"#{unity_msg}\"); }\n"].join("\n") + when /_ARRAY/ + [ " if (#{pre}#{expected} == NULL)", + " { UNITY_TEST_ASSERT_NULL(#{pre}#{arg_name}, cmock_line, \"Expected NULL. #{unity_msg}\"); }", + " else", + " { #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, 1, cmock_line, \"#{unity_msg}\"); }\n"].join("\n") + else + return " #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, cmock_line, \"#{unity_msg}\");\n" + end + end + + def code_verify_an_arg_expectation_with_normal_arrays(function, arg) + c_type, arg_name, expected, unity_func, pre, unity_msg = lookup_expect_type(function, arg) + depth_name = (arg[:ptr?]) ? "cmock_call_instance->Expected_#{arg_name}_Depth" : 1 + case(unity_func) + when "UNITY_TEST_ASSERT_EQUAL_MEMORY" + c_type_local = c_type.gsub(/\*$/,'') + return " UNITY_TEST_ASSERT_EQUAL_MEMORY((void*)(#{pre}#{expected}), (void*)(#{pre}#{arg_name}), sizeof(#{c_type_local}), cmock_line, \"#{unity_msg}\");\n" + when "UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY" + [ " if (#{pre}#{expected} == NULL)", + " { UNITY_TEST_ASSERT_NULL(#{pre}#{arg_name}, cmock_line, \"Expected NULL. #{unity_msg}\"); }", + " else", + " { UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY((void*)(#{pre}#{expected}), (void*)(#{pre}#{arg_name}), sizeof(#{c_type.sub('*','')}), #{depth_name}, cmock_line, \"#{unity_msg}\"); }\n"].compact.join("\n") + when /_ARRAY/ + if (pre == '&') + " #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, #{depth_name}, cmock_line, \"#{unity_msg}\");\n" + else + [ " if (#{pre}#{expected} == NULL)", + " { UNITY_TEST_ASSERT_NULL(#{pre}#{arg_name}, cmock_line, \"Expected NULL. #{unity_msg}\"); }", + " else", + " { #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, #{depth_name}, cmock_line, \"#{unity_msg}\"); }\n"].compact.join("\n") + end + else + return " #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, cmock_line, \"#{unity_msg}\");\n" + end + end + + def code_verify_an_arg_expectation_with_smart_arrays(function, arg) + c_type, arg_name, expected, unity_func, pre, unity_msg = lookup_expect_type(function, arg) + depth_name = (arg[:ptr?]) ? "cmock_call_instance->Expected_#{arg_name}_Depth" : 1 + case(unity_func) + when "UNITY_TEST_ASSERT_EQUAL_MEMORY" + c_type_local = c_type.gsub(/\*$/,'') + return " UNITY_TEST_ASSERT_EQUAL_MEMORY((void*)(#{pre}#{expected}), (void*)(#{pre}#{arg_name}), sizeof(#{c_type_local}), cmock_line, \"#{unity_msg}\");\n" + when "UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY" + [ " if (#{pre}#{expected} == NULL)", + " { UNITY_TEST_ASSERT_NULL(#{arg_name}, cmock_line, \"Expected NULL. #{unity_msg}\"); }", + ((depth_name != 1) ? " else if (#{depth_name} == 0)\n { UNITY_TEST_ASSERT_EQUAL_PTR(#{pre}#{expected}, #{pre}#{arg_name}, cmock_line, \"#{unity_msg}\"); }" : nil), + " else", + " { UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY((void*)(#{pre}#{expected}), (void*)(#{pre}#{arg_name}), sizeof(#{c_type.sub('*','')}), #{depth_name}, cmock_line, \"#{unity_msg}\"); }\n"].compact.join("\n") + when /_ARRAY/ + if (pre == '&') + " #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, #{depth_name}, cmock_line, \"#{unity_msg}\");\n" + else + [ " if (#{pre}#{expected} == NULL)", + " { UNITY_TEST_ASSERT_NULL(#{pre}#{arg_name}, cmock_line, \"Expected NULL. #{unity_msg}\"); }", + ((depth_name != 1) ? " else if (#{depth_name} == 0)\n { UNITY_TEST_ASSERT_EQUAL_PTR(#{pre}#{expected}, #{pre}#{arg_name}, cmock_line, \"#{unity_msg}\"); }" : nil), + " else", + " { #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, #{depth_name}, cmock_line, \"#{unity_msg}\"); }\n"].compact.join("\n") + end + else + return " #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, cmock_line, \"#{unity_msg}\");\n" + end + end + +end \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/lib/cmock_header_parser.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/lib/cmock_header_parser.rb new file mode 100644 index 0000000..4ea9966 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/lib/cmock_header_parser.rb @@ -0,0 +1,270 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +class CMockHeaderParser + + attr_accessor :funcs, :c_attributes, :treat_as_void, :treat_externs + + def initialize(cfg) + @funcs = [] + @c_strippables = cfg.strippables + @c_attributes = (['const'] + cfg.attributes).uniq + @treat_as_void = (['void'] + cfg.treat_as_void).uniq + @declaration_parse_matcher = /([\d\w\s\*\(\),\[\]]+??)\(([\d\w\s\*\(\),\.\[\]+-]*)\)$/m + @standards = (['int','short','char','long','unsigned','signed'] + cfg.treat_as.keys).uniq + @when_no_prototypes = cfg.when_no_prototypes + @local_as_void = @treat_as_void + @verbosity = cfg.verbosity + @treat_externs = cfg.treat_externs + @c_strippables += ['extern'] if (@treat_externs == :include) #we'll need to remove the attribute if we're allowing externs + end + + def parse(name, source) + @module_name = name + @typedefs = [] + @funcs = [] + function_names = [] + + parse_functions( import_source(source) ).map do |decl| + func = parse_declaration(decl) + unless (function_names.include? func[:name]) + @funcs << func + function_names << func[:name] + end + end + + { :includes => nil, + :functions => @funcs, + :typedefs => @typedefs + } + end + + private if $ThisIsOnlyATest.nil? ################ + + def import_source(source) + + # void must be void for cmock _ExpectAndReturn calls to process properly, not some weird typedef which equates to void + # to a certain extent, this action assumes we're chewing on pre-processed header files, otherwise we'll most likely just get stuff from @treat_as_void + @local_as_void = @treat_as_void + void_types = source.scan(/typedef\s+(?:\(\s*)?void(?:\s*\))?\s+([\w\d]+)\s*;/) + if void_types + @local_as_void += void_types.flatten.uniq.compact + end + + # smush multiline macros into single line (checking for continuation character at end of line '\') + source.gsub!(/\s*\\\s*/m, ' ') + + #remove comments (block and line, in three steps to ensure correct precedence) + source.gsub!(/\/\/(?:.+\/\*|\*(?:$|[^\/])).*$/, '') # remove line comments that comment out the start of blocks + source.gsub!(/\/\*.*?\*\//m, '') # remove block comments + source.gsub!(/\/\/.*$/, '') # remove line comments (all that remain) + + # remove assembler pragma sections + source.gsub!(/^\s*#\s*pragma\s+asm\s+.*?#\s*pragma\s+endasm/m, '') + + # remove preprocessor statements and extern "C" + source.gsub!(/^\s*#.*/, '') + source.gsub!(/extern\s+\"C\"\s+\{/, '') + + # enums, unions, structs, and typedefs can all contain things (e.g. function pointers) that parse like function prototypes, so yank them + # forward declared structs are removed before struct definitions so they don't mess up real thing later. we leave structs keywords in function prototypes + source.gsub!(/^[\w\s]*struct[^;\{\}\(\)]+;/m, '') # remove forward declared structs + source.gsub!(/^[\w\s]*(enum|union|struct|typepdef)[\w\s]*\{[^\}]+\}[\w\s\*\,]*;/m, '') # remove struct, union, and enum definitions and typedefs with braces + source.gsub!(/(\W)(?:register|auto|static|restrict)(\W)/, '\1\2') # remove problem keywords + source.gsub!(/\s*=\s*['"a-zA-Z0-9_\.]+\s*/, '') # remove default value statements from argument lists + source.gsub!(/^(?:[\w\s]*\W)?typedef\W.*/, '') # remove typedef statements + source.gsub!(/(^|\W+)(?:#{@c_strippables.join('|')})(?=$|\W+)/,'\1') unless @c_strippables.empty? # remove known attributes slated to be stripped + + #scan for functions which return function pointers, because they are a pain + source.gsub!(/([\w\s\*]+)\(*\(\s*\*([\w\s\*]+)\s*\(([\w\s\*,]*)\)\)\s*\(([\w\s\*,]*)\)\)*/) do |m| + functype = "cmock_#{@module_name}_func_ptr#{@typedefs.size + 1}" + @typedefs << "typedef #{$1.strip}(*#{functype})(#{$4});" + "#{functype} #{$2.strip}(#{$3});" + end + + #drop extra white space to make the rest go faster + source.gsub!(/^\s+/, '') # remove extra white space from beginning of line + source.gsub!(/\s+$/, '') # remove extra white space from end of line + source.gsub!(/\s*\(\s*/, '(') # remove extra white space from before left parens + source.gsub!(/\s*\)\s*/, ')') # remove extra white space from before right parens + source.gsub!(/\s+/, ' ') # remove remaining extra white space + + #split lines on semicolons and remove things that are obviously not what we are looking for + src_lines = source.split(/\s*;\s*/) + src_lines.delete_if {|line| line.strip.length == 0} # remove blank lines + src_lines.delete_if {|line| !(line =~ /\(\s*\*(?:.*\[\d*\])??\s*\)/).nil?} #remove function pointer arrays + if (@treat_externs == :include) + src_lines.delete_if {|line| !(line =~ /(?:^|\s+)(?:inline)\s+/).nil?} #remove inline functions + else + src_lines.delete_if {|line| !(line =~ /(?:^|\s+)(?:extern|inline)\s+/).nil?} #remove inline and extern functions + end + end + + def parse_functions(source) + funcs = [] + source.each {|line| funcs << line.strip.gsub(/\s+/, ' ') if (line =~ @declaration_parse_matcher)} + if funcs.empty? + case @when_no_prototypes + when :error + raise "ERROR: No function prototypes found!" + when :warn + puts "WARNING: No function prototypes found!" unless (@verbosity < 1) + end + end + return funcs + end + + def parse_args(arg_list) + args = [] + arg_list.split(',').each do |arg| + arg.strip! + return args if (arg =~ /^\s*((\.\.\.)|(void))\s*$/) # we're done if we reach void by itself or ... + arg_array = arg.split + arg_elements = arg_array - @c_attributes # split up words and remove known attributes + args << { :type => (arg_type =arg_elements[0..-2].join(' ')), + :name => arg_elements[-1], + :ptr? => divine_ptr(arg_type), + :const? => arg_array.include?('const') + } + end + return args + end + + def divine_ptr(arg_type) + return false unless arg_type.include? '*' + return false if arg_type.gsub(/(const|char|\*|\s)+/,'').empty? + return true + end + + def clean_args(arg_list) + if ((@local_as_void.include?(arg_list.strip)) or (arg_list.empty?)) + return 'void' + else + c=0 + arg_list.gsub!(/(\w+)(?:\s*\[[\s\d\w+-]*\])+/,'*\1') # magically turn brackets into asterisks + arg_list.gsub!(/\s+\*/,'*') # remove space to place asterisks with type (where they belong) + arg_list.gsub!(/\*(\w)/,'* \1') # pull asterisks away from arg to place asterisks with type (where they belong) + + #scan argument list for function pointers and replace them with custom types + arg_list.gsub!(/([\w\s]+)\(*\(\s*\*([\w\s\*]+)\)\s*\(([\w\s\*,]*)\)\)*/) do |m| + functype = "cmock_#{@module_name}_func_ptr#{@typedefs.size + 1}" + funcret = $1.strip + funcname = $2.strip + funcargs = $3.strip + funconst = '' + if (funcname.include? 'const') + funcname.gsub!('const','').strip! + funconst = 'const ' + end + @typedefs << "typedef #{funcret}(*#{functype})(#{funcargs});" + funcname = "cmock_arg#{c+=1}" if (funcname.empty?) + "#{functype} #{funconst}#{funcname}" + end + + #automatically name unnamed arguments (those that only had a type) + arg_list.split(/\s*,\s*/).map { |arg| + parts = (arg.split - ['struct', 'union', 'enum', 'const', 'const*']) + if ((parts.size < 2) or (parts[-1][-1].chr == '*') or (@standards.include?(parts[-1]))) + "#{arg} cmock_arg#{c+=1}" + else + arg + end + }.join(', ') + end + end + + def parse_declaration(declaration) + decl = {} + + regex_match = @declaration_parse_matcher.match(declaration) + raise "Failed parsing function declaration: '#{declaration}'" if regex_match.nil? + + #grab argument list + args = regex_match[2].strip + + #process function attributes, return type, and name + descriptors = regex_match[1] + descriptors.gsub!(/\s+\*/,'*') #remove space to place asterisks with return type (where they belong) + descriptors.gsub!(/\*(\w)/,'* \1') #pull asterisks away from function name to place asterisks with return type (where they belong) + descriptors = descriptors.split #array of all descriptor strings + + #grab name + decl[:name] = descriptors[-1] #snag name as last array item + + #build attribute and return type strings + decl[:modifier] = [] + rettype = [] + descriptors[0..-2].each do |word| + if @c_attributes.include?(word) + decl[:modifier] << word + else + rettype << word + end + end + decl[:modifier] = decl[:modifier].join(' ') + rettype = rettype.join(' ') + rettype = 'void' if (@local_as_void.include?(rettype.strip)) + decl[:return] = { :type => rettype, + :name => 'cmock_to_return', + :ptr? => divine_ptr(rettype), + :const? => rettype.split(/\s/).include?('const'), + :str => "#{rettype} cmock_to_return", + :void? => (rettype == 'void') + } + + #remove default argument statements from mock definitions + args.gsub!(/=\s*[a-zA-Z0-9_\.]+\s*/, ' ') + + #check for var args + if (args =~ /\.\.\./) + decl[:var_arg] = args.match( /[\w\s]*\.\.\./ ).to_s.strip + if (args =~ /\,[\w\s]*\.\.\./) + args = args.gsub!(/\,[\w\s]*\.\.\./,'') + else + args = 'void' + end + else + decl[:var_arg] = nil + end + args = clean_args(args) + decl[:args_string] = args + decl[:args] = parse_args(args) + decl[:args_call] = decl[:args].map{|a| a[:name]}.join(', ') + decl[:contains_ptr?] = decl[:args].inject(false) {|ptr, arg| arg[:ptr?] ? true : ptr } + + if (decl[:return][:type].nil? or decl[:name].nil? or decl[:args].nil? or + decl[:return][:type].empty? or decl[:name].empty?) + raise "Failed Parsing Declaration Prototype!\n" + + " declaration: '#{declaration}'\n" + + " modifier: '#{decl[:modifier]}'\n" + + " return: #{prototype_inspect_hash(decl[:return])}\n" + + " function: '#{decl[:name]}'\n" + + " args: #{prototype_inspect_array_of_hashes(decl[:args])}\n" + end + + return decl + end + + def prototype_inspect_hash(hash) + pairs = [] + hash.each_pair { |name, value| pairs << ":#{name} => #{"'" if (value.class == String)}#{value}#{"'" if (value.class == String)}" } + return "{#{pairs.join(', ')}}" + end + + def prototype_inspect_array_of_hashes(array) + hashes = [] + array.each { |hash| hashes << prototype_inspect_hash(hash) } + case (array.size) + when 0 + return "[]" + when 1 + return "[#{hashes[0]}]" + else + return "[\n #{hashes.join("\n ")}\n ]\n" + end + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/lib/cmock_plugin_manager.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/lib/cmock_plugin_manager.rb new file mode 100644 index 0000000..eb8f9e8 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/lib/cmock_plugin_manager.rb @@ -0,0 +1,40 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +class CMockPluginManager + + attr_accessor :plugins + + def initialize(config, utils) + @plugins = [] + plugins_to_load = [:expect, config.plugins].flatten.uniq.compact + plugins_to_load.each do |plugin| + plugin_name = plugin.to_s + object_name = "CMockGeneratorPlugin" + camelize(plugin_name) + begin + unless (Object.const_defined? object_name) + require "#{File.expand_path(File.dirname(__FILE__))}/cmock_generator_plugin_#{plugin_name.downcase}.rb" + end + @plugins << eval("#{object_name}.new(config, utils)") + rescue + raise "ERROR: CMock unable to load plugin '#{plugin_name}'" + end + end + @plugins.sort! {|a,b| a.priority <=> b.priority } + end + + def run(method, args=nil) + if args.nil? + return @plugins.collect{ |plugin| plugin.send(method) if plugin.respond_to?(method) }.flatten.join + else + return @plugins.collect{ |plugin| plugin.send(method, args) if plugin.respond_to?(method) }.flatten.join + end + end + + def camelize(lower_case_and_underscored_word) + lower_case_and_underscored_word.gsub(/\/(.?)/) { "::" + $1.upcase }.gsub(/(^|_)(.)/) { $2.upcase } + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/lib/cmock_unityhelper_parser.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/lib/cmock_unityhelper_parser.rb new file mode 100644 index 0000000..3ddffb3 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/lib/cmock_unityhelper_parser.rb @@ -0,0 +1,74 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +class CMockUnityHelperParser + + attr_accessor :c_types + + def initialize(config) + @config = config + @fallback = @config.plugins.include?(:array) ? 'UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY' : 'UNITY_TEST_ASSERT_EQUAL_MEMORY' + @c_types = map_C_types.merge(import_source) + end + + def get_helper(ctype) + lookup = ctype.gsub(/(?:^|(\S?)(\s*)|(\W))const(?:$|(\s*)(\S)|(\W))/,'\1\3\5\6').strip.gsub(/\s+/,'_') + return [@c_types[lookup], ''] if (@c_types[lookup]) + if (lookup =~ /\*$/) + lookup = lookup.gsub(/\*$/,'') + return [@c_types[lookup], '*'] if (@c_types[lookup]) + else + lookup = lookup + '*' + return [@c_types[lookup], '&'] if (@c_types[lookup]) + end + return ['UNITY_TEST_ASSERT_EQUAL_PTR', ''] if (ctype =~ /cmock_\w+_ptr\d+/) + raise("Don't know how to test #{ctype} and memory tests are disabled!") unless @config.memcmp_if_unknown + return (lookup =~ /\*$/) ? [@fallback, '&'] : [@fallback, ''] + end + + private ########################### + + def map_C_types + c_types = {} + @config.treat_as.each_pair do |ctype, expecttype| + if (expecttype =~ /\*/) + c_types[ctype.gsub(/\s+/,'_')] = "UNITY_TEST_ASSERT_EQUAL_#{expecttype.gsub(/\*/,'')}_ARRAY" + else + c_types[ctype.gsub(/\s+/,'_')] = "UNITY_TEST_ASSERT_EQUAL_#{expecttype}" + c_types[ctype.gsub(/\s+/,'_')+'*'] = "UNITY_TEST_ASSERT_EQUAL_#{expecttype}_ARRAY" + end + end + c_types + end + + def import_source + source = @config.load_unity_helper + return {} if source.nil? + c_types = {} + source = source.gsub(/\/\/.*$/, '') #remove line comments + source = source.gsub(/\/\*.*?\*\//m, '') #remove block comments + + #scan for comparison helpers + match_regex = Regexp.new('^\s*#define\s+(UNITY_TEST_ASSERT_EQUAL_(\w+))\s*\(' + Array.new(4,'\s*\w+\s*').join(',') + '\)') + pairs = source.scan(match_regex).flatten.compact + (pairs.size/2).times do |i| + expect = pairs[i*2] + ctype = pairs[(i*2)+1] + c_types[ctype] = expect unless expect.include?("_ARRAY") + end + + #scan for array variants of those helpers + match_regex = Regexp.new('^\s*#define\s+(UNITY_TEST_ASSERT_EQUAL_(\w+_ARRAY))\s*\(' + Array.new(5,'\s*\w+\s*').join(',') + '\)') + pairs = source.scan(match_regex).flatten.compact + (pairs.size/2).times do |i| + expect = pairs[i*2] + ctype = pairs[(i*2)+1] + c_types[ctype.gsub('_ARRAY','*')] = expect + end + + c_types + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/rakefile.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/rakefile.rb new file mode 100644 index 0000000..1ea3ef2 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/rakefile.rb @@ -0,0 +1,89 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require './config/test_environment' +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require './rakefile_helper' + +include RakefileHelpers + +DEFAULT_CONFIG_FILE = 'gcc.yml' + +configure_clean +configure_toolchain(DEFAULT_CONFIG_FILE) + +task :default => ['test:all'] +task :cruise => [:no_color, :default] + +desc "Load configuration" +task :config, :config_file do |t, args| + args = {:config_file => DEFAULT_CONFIG_FILE} if args[:config_file].nil? + args = {:config_file => args[:config_file] + '.yml'} unless args[:config_file] =~ /\.yml$/i + configure_toolchain(args[:config_file]) +end + +namespace :test do + desc "Run all unit and system tests" + task :all => [:clobber, 'test:units', 'test:c', 'test:system'] + + desc "Run Unit Tests" + Rake::TestTask.new('units') do |t| + t.pattern = 'test/unit/*_test.rb' + t.verbose = true + end + + #individual unit tests + FileList['test/unit/*_test.rb'].each do |test| + Rake::TestTask.new(File.basename(test,'.*')) do |t| + t.pattern = test + t.verbose = true + end + end + + desc "Run C Unit Tests" + task :c do + build_and_test_c_files + end + + desc "Run System Tests" + task :system => [:clobber] do + #get a list of all system tests, removing unsupported tests for this compiler + sys_unsupported = $cfg['unsupported'].map {|a| 'test/system/test_interactions/'+a+'.yml'} + sys_tests_to_run = FileList['test/system/test_interactions/*.yml'] - sys_unsupported + compile_unsupported = $cfg['unsupported'].map {|a| SYSTEST_COMPILE_MOCKABLES_PATH+a+'.h'} + compile_tests_to_run = FileList[SYSTEST_COMPILE_MOCKABLES_PATH + '*.h'] - compile_unsupported + unless (sys_unsupported.empty? and compile_unsupported.empty?) + report "\nIgnoring these system tests..." + sys_unsupported.each {|a| report a} + compile_unsupported.each {|a| report a} + end + report "\nRunning system tests..." + tests_failed = run_system_test_interactions(sys_tests_to_run) + raise "System tests failed." if (tests_failed > 0) + + run_system_test_compilations(compile_tests_to_run) + end + + #individual system tests + FileList['test/system/test_interactions/*.yml'].each do |test| + desc "Run system test #{File.basename(test,'.*')}" + task "test:#{File.basename(test,'.*')}" do + run_system_test_interactions([test]) + end + end + + desc "Profile Mock Generation" + task :profile => [:clobber] do + run_system_test_profiles(FileList[SYSTEST_COMPILE_MOCKABLES_PATH + '*.h']) + end +end + +task :no_color do + $colour_output = false +end + \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/rakefile_helper.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/rakefile_helper.rb new file mode 100644 index 0000000..c7103b7 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/rakefile_helper.rb @@ -0,0 +1,383 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require 'yaml' +require 'fileutils' +require './vendor/unity/auto/generate_test_runner' +require './vendor/unity/auto/unity_test_summary' +require './test/system/systest_generator' +require './vendor/unity/auto/colour_reporter.rb' + +module RakefileHelpers + + SYSTEST_GENERATED_FILES_PATH = 'test/system/generated/' + SYSTEST_BUILD_FILES_PATH = 'test/system/build/' + SYSTEST_COMPILE_MOCKABLES_PATH = 'test/system/test_compilation/' + C_EXTENSION = '.c' + RESULT_EXTENSION = '.result' + + def load_configuration(config_file) + $cfg_file = config_file + $cfg = YAML.load(File.read('./targets/' + $cfg_file)) + $colour_output = false unless $cfg['colour'] + end + + def configure_clean + CLEAN.include(SYSTEST_GENERATED_FILES_PATH + '*.*') + CLEAN.include(SYSTEST_BUILD_FILES_PATH + '*.*') + end + + def configure_toolchain(config_file) + load_configuration(config_file) + configure_clean + end + + def get_local_include_dirs + include_dirs = $cfg['compiler']['includes']['items'].dup + include_dirs.delete_if {|dir| dir.is_a?(Array)} + return include_dirs + end + + def extract_headers(filename) + includes = [] + lines = File.readlines(filename) + lines.each do |line| + m = line.match(/^\s*#include\s+\"\s*(.+\.[hH])\s*\"/) + if not m.nil? + includes << m[1] + end + end + return includes + end + + def find_source_file(header, paths) + paths.each do |dir| + src_file = dir + header.ext(C_EXTENSION) + if (File.exists?(src_file)) + return src_file + end + end + return nil + end + + def squash(prefix, items) + result = '' + items.each { |item| result += " #{prefix}#{tackit(item)}" } + return result + end + + def build_compiler_fields + command = tackit($cfg['compiler']['path']) + if $cfg['compiler']['defines']['items'].nil? + defines = '' + else + defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items']) + end + options = squash('', $cfg['compiler']['options']) + includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :defines => defines, :options => options, :includes => includes} + end + + def compile(file, defines=[]) + compiler = build_compiler_fields + cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{defines.inject(''){|all, a| ' -D'+a+all }}#{compiler[:options]}#{compiler[:includes]} #{file} " + + "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" + + "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" + execute(cmd_str) + end + + def build_linker_fields + command = tackit($cfg['linker']['path']) + if $cfg['linker']['options'].nil? + options = '' + else + options = squash('', $cfg['linker']['options']) + end + if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?) + includes = '' + else + includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) + end + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :options => options, :includes => includes} + end + + def link(exe_name, obj_list) + linker = build_linker_fields + cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + + (obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).uniq.join + + $cfg['linker']['bin_files']['prefix'] + ' ' + + $cfg['linker']['bin_files']['destination'] + + exe_name + $cfg['linker']['bin_files']['extension'] + execute(cmd_str) + end + + def build_simulator_fields + return nil if $cfg['simulator'].nil? + if $cfg['simulator']['path'].nil? + command = '' + else + command = (tackit($cfg['simulator']['path']) + ' ') + end + if $cfg['simulator']['pre_support'].nil? + pre_support = '' + else + pre_support = squash('', $cfg['simulator']['pre_support']) + end + if $cfg['simulator']['post_support'].nil? + post_support = '' + else + post_support = squash('', $cfg['simulator']['post_support']) + end + return {:command => command, :pre_support => pre_support, :post_support => post_support} + end + + def execute(command_string, verbose=true, raise_on_failure=true) + #report command_string + output = `#{command_string}`.chomp + report(output) if (verbose && !output.nil? && (output.length > 0)) + if ($?.exitstatus != 0) and (raise_on_failure) + raise "#{command_string} failed. (Returned #{$?.exitstatus})" + end + return output + end + + def tackit(strings) + case(strings) + when Array + "\"#{strings.join}\"" + when /^-/ + strings + when /\s/ + "\"#{strings}\"" + else + strings + end + end + + def report_summary + summary = UnityTestSummary.new + summary.set_root_path(File.expand_path(File.dirname(__FILE__)) + '/') + results_glob = "#{$cfg['compiler']['build_path']}*.test*" + results_glob.gsub!(/\\/, '/') + results = Dir[results_glob] + summary.set_targets(results) + summary.run + fail_out "FAIL: There were failures" if (summary.failures > 0) + end + + def run_system_test_interactions(test_case_files) + load './lib/cmock.rb' + + SystemTestGenerator.new.generate_files(test_case_files) + test_files = FileList.new(SYSTEST_GENERATED_FILES_PATH + 'test*.c') + + load_configuration($cfg_file) + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + + include_dirs = get_local_include_dirs + + # Build and execute each unit test + test_files.each do |test| + + obj_list = [] + + test_base = File.basename(test, C_EXTENSION) + cmock_config = test_base.gsub(/test_/, '') + '_cmock.yml' + + report "Executing system tests in #{File.basename(test)}..." + + # Detect dependencies and build required required modules + extract_headers(test).each do |header| + + # Generate any needed mocks + if header =~ /^mock_(.*)\.h/i + module_name = $1 + cmock = CMock.new(SYSTEST_GENERATED_FILES_PATH + cmock_config) + cmock.setup_mocks("#{$cfg['compiler']['source_path']}#{module_name}.h") + end + # Compile corresponding source file if it exists + src_file = find_source_file(header, include_dirs) + if !src_file.nil? + compile(src_file) + obj_list << header.ext($cfg['compiler']['object_files']['extension']) + end + end + + # Generate and build the test suite runner + runner_name = test_base + '_runner.c' + runner_path = $cfg['compiler']['source_path'] + runner_name + UnityTestRunnerGenerator.new(SYSTEST_GENERATED_FILES_PATH + cmock_config).run(test, runner_path) + compile(runner_path) + obj_list << runner_name.ext($cfg['compiler']['object_files']['extension']) + + # Build the test module + compile(test) + obj_list << test_base.ext($cfg['compiler']['object_files']['extension']) + + # Link the test executable + link(test_base, obj_list) + + # Execute unit test and generate results file + simulator = build_simulator_fields + executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] + if simulator.nil? + cmd_str = executable + else + cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" + end + output = execute(cmd_str, false, false) + test_results = $cfg['compiler']['build_path'] + test_base + RESULT_EXTENSION + File.open(test_results, 'w') { |f| f.print output } + end + + # Parse and report test results + total_tests = 0 + total_failures = 0 + failure_messages = [] + + test_case_files.each do |test_case| + tests = (YAML.load_file(test_case))[:systest][:tests][:units] + total_tests += tests.size + + test_file = 'test_' + File.basename(test_case).ext(C_EXTENSION) + result_file = test_file.ext(RESULT_EXTENSION) + test_results = File.readlines(SYSTEST_BUILD_FILES_PATH + result_file) + tests.each_with_index do |test, index| + # compare test's intended pass/fail state with pass/fail state in actual results; + # if they don't match, the system test has failed + this_failed = case(test[:pass]) + when :ignore + (test_results[index] =~ /:IGNORE/).nil? + when true + (test_results[index] =~ /:PASS/).nil? + when false + (test_results[index] =~ /:FAIL/).nil? + end + if (this_failed) + total_failures += 1 + test_results[index] =~ /test#{index+1}:(.+)/ + failure_messages << "#{test_file}:test#{index+1}:should #{test[:should]}:#{$1}" + end + # some tests have additional requirements to check for (checking the actual output message) + if (test[:verify_error]) and not (test_results[index] =~ /test#{index+1}:.*#{test[:verify_error]}/) + total_failures += 1 + failure_messages << "#{test_file}:test#{index+1}:should #{test[:should]}:should have output matching '#{test[:verify_error]}'" + end + end + end + + report "\n" + report "------------------------------------\n" + report "SYSTEM TEST MOCK INTERACTION SUMMARY\n" + report "------------------------------------\n" + report "#{total_tests} Tests #{total_failures} Failures 0 Ignored\n" + report "\n" + + if (failure_messages.size > 0) + report 'System test failures:' + failure_messages.each do |failure| + report failure + end + end + + report '' + + return total_failures + end + + def profile_this(filename) + profile = true + begin + require 'ruby-prof' + RubyProf.start + rescue + profile = false + end + + yield + + if (profile) + profile_result = RubyProf.stop + File.open("Profile_#{filename}.html", 'w') do |f| + RubyProf::GraphHtmlPrinter.new(profile_result).print(f) + end + end + end + + def run_system_test_compilations(mockables) + load './lib/cmock.rb' + + load_configuration($cfg_file) + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + + report "\n" + report "------------------------------------\n" + report "SYSTEM TEST MOCK COMPILATION SUMMARY\n" + report "------------------------------------\n" + mockables.each do |header| + mock_filename = 'mock_' + File.basename(header).ext('.c') + CMock.new(SYSTEST_COMPILE_MOCKABLES_PATH + 'config.yml').setup_mocks(header) + report "Compiling #{mock_filename}..." + compile(SYSTEST_GENERATED_FILES_PATH + mock_filename) + end + end + + def run_system_test_profiles(mockables) + load './lib/cmock.rb' + + load_configuration($cfg_file) + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + + report "\n" + report "--------------------------\n" + report "SYSTEM TEST MOCK PROFILING\n" + report "--------------------------\n" + mockables.each do |header| + mock_filename = 'mock_' + File.basename(header).ext('.c') + profile_this(mock_filename.gsub('.c','')) do + 10.times do + CMock.new(SYSTEST_COMPILE_MOCKABLES_PATH + 'config.yml').setup_mocks(header) + end + end + report "Compiling #{mock_filename}..." + compile(SYSTEST_GENERATED_FILES_PATH + mock_filename) + end + end + + def build_and_test_c_files + report "\n" + report "----------------\n" + report "UNIT TEST C CODE\n" + report "----------------\n" + errors = false + FileList.new("test/c/*.yml").each do |yaml_file| + test = YAML.load(File.read(yaml_file)) + report "\nTesting #{yaml_file.sub('.yml','')}" + report "(#{test[:options].join(', ')})" + test[:files].each { |f| compile(f, test[:options]) } + obj_files = test[:files].map { |f| f.gsub!(/.*\//,'').gsub!(C_EXTENSION, $cfg['compiler']['object_files']['extension']) } + link('TestCMockC', obj_files) + if $cfg['simulator'].nil? + execute($cfg['linker']['bin_files']['destination'] + 'TestCMockC' + $cfg['linker']['bin_files']['extension']) + else + execute(tackit($cfg['simulator']['path'].join) + ' ' + + $cfg['simulator']['pre_support'].map{|o| tackit(o)}.join(' ') + ' ' + + $cfg['linker']['bin_files']['destination'] + + 'TestCMockC' + + $cfg['linker']['bin_files']['extension'] + ' ' + + $cfg['simulator']['post_support'].map{|o| tackit(o)}.join(' ') ) + end + end + end + + def fail_out(msg) + puts msg + exit(-1) + end +end + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/release/build.info b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/release/build.info new file mode 100644 index 0000000..360b9e4 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/release/build.info @@ -0,0 +1,2 @@ +209 + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/release/version.info b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/release/version.info new file mode 100644 index 0000000..0d71c08 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/release/version.info @@ -0,0 +1,2 @@ +2.0 + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/src/cmock.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/src/cmock.c new file mode 100644 index 0000000..558e19a --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/src/cmock.c @@ -0,0 +1,186 @@ +/* ========================================== + CMock Project - Automatic Mock Generation for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity.h" +#include "cmock.h" + +//define CMOCK_MEM_DYNAMIC to grab memory as needed with malloc +//when you do that, CMOCK_MEM_SIZE is used for incremental size instead of total +#ifdef CMOCK_MEM_STATIC +#undef CMOCK_MEM_DYNAMIC +#endif + +#ifdef CMOCK_MEM_DYNAMIC +#include +#endif + +//this is used internally during pointer arithmetic. make sure this type is the same size as the target's pointer type +#ifndef CMOCK_MEM_PTR_AS_INT +#define CMOCK_MEM_PTR_AS_INT unsigned long +#endif + +//0 for no alignment, 1 for 16-bit, 2 for 32-bit, 3 for 64-bit +#ifndef CMOCK_MEM_ALIGN +#define CMOCK_MEM_ALIGN (2) +#endif + +//amount of memory to allow cmock to use in its internal heap +#ifndef CMOCK_MEM_SIZE +#define CMOCK_MEM_SIZE (32768) +#endif + +//automatically calculated defs for easier reading +#define CMOCK_MEM_ALIGN_SIZE (1u << CMOCK_MEM_ALIGN) +#define CMOCK_MEM_ALIGN_MASK (CMOCK_MEM_ALIGN_SIZE - 1) +#define CMOCK_MEM_INDEX_SIZE ((sizeof(CMOCK_MEM_INDEX_TYPE) > CMOCK_MEM_ALIGN_SIZE) ? sizeof(CMOCK_MEM_INDEX_TYPE) : CMOCK_MEM_ALIGN_SIZE) + +//private variables +#ifdef CMOCK_MEM_DYNAMIC +static unsigned char* CMock_Guts_Buffer = NULL; +static CMOCK_MEM_INDEX_TYPE CMock_Guts_BufferSize = CMOCK_MEM_ALIGN_SIZE; +static CMOCK_MEM_INDEX_TYPE CMock_Guts_FreePtr; +#else +static unsigned char CMock_Guts_Buffer[CMOCK_MEM_SIZE + CMOCK_MEM_ALIGN_SIZE]; +static CMOCK_MEM_INDEX_TYPE CMock_Guts_BufferSize = CMOCK_MEM_SIZE + CMOCK_MEM_ALIGN_SIZE; +static CMOCK_MEM_INDEX_TYPE CMock_Guts_FreePtr; +#endif +//------------------------------------------------------- +// CMock_Guts_MemNew +//------------------------------------------------------- +CMOCK_MEM_INDEX_TYPE CMock_Guts_MemNew(CMOCK_MEM_INDEX_TYPE size) +{ + CMOCK_MEM_INDEX_TYPE index; + + //verify arguments valid (we must be allocating space for at least 1 byte, and the existing chain must be in memory somewhere) + if (size < 1) + return CMOCK_GUTS_NONE; + + //verify we have enough room + size = size + CMOCK_MEM_INDEX_SIZE; + if (size & CMOCK_MEM_ALIGN_MASK) + size = (size + CMOCK_MEM_ALIGN_MASK) & ~CMOCK_MEM_ALIGN_MASK; + if ((CMock_Guts_BufferSize - CMock_Guts_FreePtr) < size) + { +#ifdef CMOCK_MEM_DYNAMIC + CMock_Guts_BufferSize += CMOCK_MEM_SIZE + size; + CMock_Guts_Buffer = realloc(CMock_Guts_Buffer, CMock_Guts_BufferSize); + if (CMock_Guts_Buffer == NULL) +#endif //yes that if will continue to the return below if TRUE + return CMOCK_GUTS_NONE; + } + + //determine where we're putting this new block, and init its pointer to be the end of the line + index = CMock_Guts_FreePtr + CMOCK_MEM_INDEX_SIZE; + *(CMOCK_MEM_INDEX_TYPE*)(&CMock_Guts_Buffer[CMock_Guts_FreePtr]) = CMOCK_GUTS_NONE; + CMock_Guts_FreePtr += size; + + return index; +} + +//------------------------------------------------------- +// CMock_Guts_MemChain +//------------------------------------------------------- +CMOCK_MEM_INDEX_TYPE CMock_Guts_MemChain(CMOCK_MEM_INDEX_TYPE root_index, CMOCK_MEM_INDEX_TYPE obj_index) +{ + CMOCK_MEM_INDEX_TYPE index; + void* root; + void* obj; + void* next; + + if (root_index == CMOCK_GUTS_NONE) + { + //if there is no root currently, we return this object as the root of the chain + return obj_index; + } + else + { + //reject illegal nodes + if ((root_index < CMOCK_MEM_ALIGN_SIZE) || (root_index >= CMock_Guts_FreePtr)) + { + return CMOCK_GUTS_NONE; + } + if ((obj_index < CMOCK_MEM_ALIGN_SIZE) || (obj_index >= CMock_Guts_FreePtr)) + { + return CMOCK_GUTS_NONE; + } + + root = (void*)(&CMock_Guts_Buffer[root_index]); + obj = (void*)(&CMock_Guts_Buffer[obj_index]); + + //find the end of the existing chain and add us + next = root; + do { + index = *(CMOCK_MEM_INDEX_TYPE*)((CMOCK_MEM_PTR_AS_INT)next - CMOCK_MEM_INDEX_SIZE); + if (index >= CMock_Guts_FreePtr) + return CMOCK_GUTS_NONE; + if (index > 0) + next = (void*)(&CMock_Guts_Buffer[index]); + } while (index > 0); + *(CMOCK_MEM_INDEX_TYPE*)((CMOCK_MEM_PTR_AS_INT)next - CMOCK_MEM_INDEX_SIZE) = ((CMOCK_MEM_PTR_AS_INT)obj - (CMOCK_MEM_PTR_AS_INT)CMock_Guts_Buffer); + return root_index; + } +} + +//------------------------------------------------------- +// CMock_Guts_MemNext +//------------------------------------------------------- +CMOCK_MEM_INDEX_TYPE CMock_Guts_MemNext(CMOCK_MEM_INDEX_TYPE previous_item_index) +{ + CMOCK_MEM_INDEX_TYPE index; + void* previous_item; + + //There is nothing "next" if the pointer isn't from our buffer + if ((previous_item_index < CMOCK_MEM_ALIGN_SIZE) || (previous_item_index >= CMock_Guts_FreePtr)) + return CMOCK_GUTS_NONE; + previous_item = (void*)(&CMock_Guts_Buffer[previous_item_index]); + + //if the pointer is good, then use it to look up the next index + //(we know the first element always goes in zero, so NEXT must always be > 1) + index = *(CMOCK_MEM_INDEX_TYPE*)((CMOCK_MEM_PTR_AS_INT)previous_item - CMOCK_MEM_INDEX_SIZE); + if ((index > 1) && (index < CMock_Guts_FreePtr)) + return index; + else + return CMOCK_GUTS_NONE; +} + +//------------------------------------------------------- +// CMock_GetAddressFor +//------------------------------------------------------- +void* CMock_Guts_GetAddressFor(CMOCK_MEM_INDEX_TYPE index) +{ + if ((index >= CMOCK_MEM_ALIGN_SIZE) && (index < CMock_Guts_FreePtr)) + { + return (void*)(&CMock_Guts_Buffer[index]); + } + else + { + return NULL; + } +} + +//------------------------------------------------------- +// CMock_Guts_MemBytesFree +//------------------------------------------------------- +CMOCK_MEM_INDEX_TYPE CMock_Guts_MemBytesFree(void) +{ + return CMock_Guts_BufferSize - CMock_Guts_FreePtr; +} + +//------------------------------------------------------- +// CMock_Guts_MemBytesUsed +//------------------------------------------------------- +CMOCK_MEM_INDEX_TYPE CMock_Guts_MemBytesUsed(void) +{ + return CMock_Guts_FreePtr - CMOCK_MEM_ALIGN_SIZE; +} + +//------------------------------------------------------- +// CMock_Guts_MemFreeAll +//------------------------------------------------------- +void CMock_Guts_MemFreeAll(void) +{ + CMock_Guts_FreePtr = CMOCK_MEM_ALIGN_SIZE; //skip the very beginning +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/src/cmock.h b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/src/cmock.h new file mode 100644 index 0000000..a43e9e0 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/src/cmock.h @@ -0,0 +1,30 @@ +/* ========================================== + CMock Project - Automatic Mock Generation for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef CMOCK_FRAMEWORK_H +#define CMOCK_FRAMEWORK_H + +//should be big enough to index full range of CMOCK_MEM_MAX +#ifndef CMOCK_MEM_INDEX_TYPE +#define CMOCK_MEM_INDEX_TYPE unsigned int +#endif + +#define CMOCK_GUTS_NONE (0) + +//------------------------------------------------------- +// Memory API +//------------------------------------------------------- +CMOCK_MEM_INDEX_TYPE CMock_Guts_MemNew(CMOCK_MEM_INDEX_TYPE size); +CMOCK_MEM_INDEX_TYPE CMock_Guts_MemChain(CMOCK_MEM_INDEX_TYPE root_index, CMOCK_MEM_INDEX_TYPE obj_index); +CMOCK_MEM_INDEX_TYPE CMock_Guts_MemNext(CMOCK_MEM_INDEX_TYPE previous_item_index); + +void* CMock_Guts_GetAddressFor(CMOCK_MEM_INDEX_TYPE index); + +CMOCK_MEM_INDEX_TYPE CMock_Guts_MemBytesFree(void); +CMOCK_MEM_INDEX_TYPE CMock_Guts_MemBytesUsed(void); +void CMock_Guts_MemFreeAll(void); + +#endif //CMOCK_FRAMEWORK diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/targets/gcc.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/targets/gcc.yml new file mode 100644 index 0000000..e46aec5 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/targets/gcc.yml @@ -0,0 +1,50 @@ +--- +compiler: + path: gcc + source_path: &systest_generated_path 'test/system/generated/' + unit_tests_path: &unit_tests_path 'examples/test/' + mocks_path: &systest_mocks_path 'test/system/generated/' + build_path: &systest_build_path 'test/system/build/' + options: + - '-c' + - '-Wall' + - '-Wno-address' + - '-std=c99' + - '-pedantic' + includes: + prefix: '-I' + items: + - *systest_generated_path + - *unit_tests_path + - *systest_mocks_path + - 'src/' + - 'vendor/unity/src/' + - 'vendor/c_exception/lib/' + - 'test/system/test_compilation/' + - 'test/' + defines: + prefix: '-D' + items: + object_files: + prefix: '-o' + extension: '.o' + destination: *systest_build_path + +linker: + path: gcc + options: + - -lm + includes: + prefix: '-I' + object_files: + path: *systest_build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.exe' + destination: *systest_build_path + +unsupported: + - unity_64bit_support + +colour: true diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/targets/gcc_32_with_64_support.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/targets/gcc_32_with_64_support.yml new file mode 100644 index 0000000..2decb69 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/targets/gcc_32_with_64_support.yml @@ -0,0 +1,52 @@ +--- +compiler: + path: gcc + source_path: &systest_generated_path 'test/system/generated/' + unit_tests_path: &unit_tests_path 'examples/test/' + mocks_path: &systest_mocks_path 'test/system/generated/' + build_path: &systest_build_path 'test/system/build/' + options: + - '-c' + - '-Wall' + - '-Wno-address' + - '-std=c99' + - '-pedantic' + includes: + prefix: '-I' + items: + - *systest_generated_path + - *unit_tests_path + - *systest_mocks_path + - 'src/' + - 'vendor/unity/src/' + - 'vendor/c_exception/lib/' + - 'test/system/test_compilation/' + - 'test/' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - UNITY_LONG_WIDTH=32 + - 'CMOCK_MEM_PTR_AS_INT=long' + object_files: + prefix: '-o' + extension: '.o' + destination: *systest_build_path + +linker: + path: gcc + options: + - -lm + includes: + prefix: '-I' + object_files: + path: *systest_build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.exe' + destination: *systest_build_path + +unsupported: [] + +colour: true diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/targets/gcc_64.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/targets/gcc_64.yml new file mode 100644 index 0000000..2296537 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/targets/gcc_64.yml @@ -0,0 +1,53 @@ +--- +compiler: + path: gcc + source_path: &systest_generated_path 'test/system/generated/' + unit_tests_path: &unit_tests_path 'examples/test/' + mocks_path: &systest_mocks_path 'test/system/generated/' + build_path: &systest_build_path 'test/system/build/' + options: + - '-c' + - '-Wall' + - '-std=c99' + - '-Wno-address' + - '-pedantic-errors' + includes: + prefix: '-I' + items: + - *systest_generated_path + - *unit_tests_path + - *systest_mocks_path + - 'src/' + - 'vendor/unity/src/' + - 'vendor/c_exception/lib/' + - 'test/system/test_compilation/' + - 'test/' + defines: + prefix: '-D' + items: + - 'UNITY_SUPPORT_64' + - 'UNITY_LONG_WIDTH=64' + - 'UNITY_POINTER_WIDTH=64' + - 'CMOCK_MEM_PTR_AS_INT=long' + object_files: + prefix: '-o' + extension: '.o' + destination: *systest_build_path + +linker: + path: gcc + options: + - -lm + includes: + prefix: '-I' + object_files: + path: *systest_build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.exe' + destination: *systest_build_path + +unsupported: [] + +colour: true diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/targets/iar_arm_v4.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/targets/iar_arm_v4.yml new file mode 100644 index 0000000..574814b --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/targets/iar_arm_v4.yml @@ -0,0 +1,107 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 4.0\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: &systest_generated_path 'test/system/generated/' + unit_tests_path: &unit_tests_path 'examples/test/' + mocks_path: &systest_mocks_path 'test/system/generated/' + build_path: &systest_build_path 'test/system/build/' + options: + - --dlib_config + - [*tools_root, 'arm\lib\dl4tptinl8n.h'] + - -z3 + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian little + - --cpu ARM7TDMI + - --stack_align 4 + - --interwork + - -e + - --silent + - --warnings_are_errors + - --fpu None + #We are supressing some warnings here because we test CMock against some questionable code to make sure it still works + - --diag_suppress Pa050 + - --diag_suppress Pe191 + - --diag_suppress=Pe494 + - --diag_suppress=Pe083 + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - *systest_generated_path + - *unit_tests_path + - *systest_mocks_path + - 'src/' + - 'vendor/unity/src/' + - 'vendor/c_exception/lib/' + - 'test/system/test_compilation/' + - 'test\' + defines: + prefix: '-D' + items: + object_files: + prefix: '-o' + extension: '.r79' + destination: *systest_build_path + +linker: + path: [*tools_root, 'common\bin\xlink.exe'] + options: + - -rt + - [*tools_root, 'arm\lib\dl4tptinl8n.r79'] + - -D_L_EXTMEM_START=0 + - -D_L_EXTMEM_SIZE=0 + - -D_L_HEAP_SIZE=120 + - -D_L_STACK_SIZE=32 + - -e_small_write=_formatted_write + - -s + - __program_start + - '-f iar\iar_v4\Resource\at91SAM7X256_FLASH.xcl' + includes: + prefix: '-I' + items: + - *systest_generated_path + - *unit_tests_path + - *systest_mocks_path + - 'vendor/unity/src/' + - [*tools_root, 'arm\config\'] + - [*tools_root, 'arm\lib\'] + object_files: + path: *systest_build_path + extension: '.r79' + bin_files: + prefix: '-o' + extension: '.d79' + destination: *systest_build_path + +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --macro + - 'iar\iar_v4\Resource\SAM7_SIM.mac' + - --backend + - -B + - -p + - [*tools_root, 'arm\config\ioat91sam7X256.ddf'] + - -d + - sim + +unsupported: + - nonstandard_parsed_stuff_1 + - const + - unity_64bit_support + +colour: true diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/targets/iar_arm_v5.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/targets/iar_arm_v5.yml new file mode 100644 index 0000000..fc4e4c4 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/targets/iar_arm_v5.yml @@ -0,0 +1,92 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: &systest_generated_path 'test/system/generated/' + unit_tests_path: &unit_tests_path 'examples/test/' + mocks_path: &systest_mocks_path 'test/system/generated/' + build_path: &systest_build_path 'test/system/build/' + options: + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian=little + - --cpu=ARM7TDMI + - --interwork + - --warnings_are_errors + - --fpu=None + - -e + - -On + #We are supressing some warnings here because we test CMock against some questionable code to make sure it still works + - --diag_suppress=Pa050 + - --diag_suppress=Pe191 + - --diag_suppress=Pe494 + - --diag_suppress=Pe083 + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - *systest_generated_path + - *unit_tests_path + - *systest_mocks_path + - 'src/' + - 'vendor/unity/src/' + - 'vendor/c_exception/lib/' + - 'iar\iar_v5\incIAR\' + - 'test\system\test_compilation\' + - 'test\' + defines: + prefix: '-D' + items: + object_files: + prefix: '-o' + extension: '.r79' + destination: *systest_build_path + +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config iar\iar_v5\Resource\at91SAM7X256_RAM.icf + object_files: + path: *systest_build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *systest_build_path + +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --macro + - 'iar\iar_v5\Resource\SAM7_SIM.mac' + - --backend + - -B + - -p + - [*tools_root, 'arm\config\debugger\Atmel\ioat91sam7X256.ddf'] + - -d + - sim + +unsupported: + - nonstandard_parsed_stuff_1 + - const + - unity_64bit_support + +colour: true diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/c/TestCMockC.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/c/TestCMockC.c new file mode 100644 index 0000000..9a61b39 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/c/TestCMockC.c @@ -0,0 +1,280 @@ +/* ========================================== + CMock Project - Automatic Mock Generation for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity.h" +#include "cmock.h" + +#define TEST_MEM_INDEX_SIZE (sizeof(CMOCK_MEM_INDEX_TYPE)) + +void setUp(void) +{ + CMock_Guts_MemFreeAll(); +} + +void tearDown(void) +{ +} + +void test_MemNewWillReturnNullIfGivenIllegalSizes(void) +{ + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemNew(0) ); + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemNew(CMOCK_MEM_SIZE - TEST_MEM_INDEX_SIZE + 1) ); + TEST_ASSERT_NULL( CMock_Guts_GetAddressFor(CMOCK_GUTS_NONE) ); + + //verify we're cleared still + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE, CMock_Guts_MemBytesFree()); +} + +void test_MemChainWillReturnNullAndDoNothingIfGivenIllegalInformation(void) +{ + CMOCK_MEM_INDEX_TYPE next = CMock_Guts_MemNew(4); + TEST_ASSERT_EQUAL(4 + TEST_MEM_INDEX_SIZE, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - 4 - TEST_MEM_INDEX_SIZE, CMock_Guts_MemBytesFree()); + + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemChain(next + CMOCK_MEM_SIZE, next) ); + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemChain(next, next + CMOCK_MEM_SIZE) ); + + //verify we're still the same + TEST_ASSERT_EQUAL(4 + TEST_MEM_INDEX_SIZE, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - 4 - TEST_MEM_INDEX_SIZE, CMock_Guts_MemBytesFree()); +} + +void test_MemNextWillReturnNullIfGivenABadRoot(void) +{ + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemNext(0) ); + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemNext(2) ); + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemNext(CMOCK_MEM_SIZE - 4) ); + + //verify we're cleared still + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE, CMock_Guts_MemBytesFree()); +} + +void test_ThatWeCanClaimAndChainAFewElementsTogether(void) +{ + unsigned int i; + CMOCK_MEM_INDEX_TYPE next; + CMOCK_MEM_INDEX_TYPE first = CMOCK_GUTS_NONE; + CMOCK_MEM_INDEX_TYPE element[4]; + + //verify we're cleared first + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE, CMock_Guts_MemBytesFree()); + + //first element + element[0] = CMock_Guts_MemNew(sizeof(unsigned int)); + TEST_ASSERT_MESSAGE(element[0] != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + first = CMock_Guts_MemChain(first, element[0]); + TEST_ASSERT_EQUAL(element[0], first); + *((unsigned int*)CMock_Guts_GetAddressFor(element[0])) = 0; + + //verify we're using the right amount of memory + TEST_ASSERT_EQUAL(1 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - 1 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesFree()); + + //second element + element[1] = CMock_Guts_MemNew(sizeof(unsigned int)); + TEST_ASSERT_MESSAGE(element[1] != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + TEST_ASSERT_NOT_EQUAL(element[0], element[1]); + TEST_ASSERT_EQUAL(first, CMock_Guts_MemChain(first, element[1])); + *((unsigned int*)CMock_Guts_GetAddressFor(element[1])) = 1; + + //verify we're using the right amount of memory + TEST_ASSERT_EQUAL(2 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - 2 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesFree()); + + //third element + element[2] = CMock_Guts_MemNew(sizeof(unsigned int)); + TEST_ASSERT_MESSAGE(element[2] != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + TEST_ASSERT_NOT_EQUAL(element[0], element[2]); + TEST_ASSERT_NOT_EQUAL(element[1], element[2]); + TEST_ASSERT_EQUAL(first, CMock_Guts_MemChain(first, element[2])); + *((unsigned int*)CMock_Guts_GetAddressFor(element[2])) = 2; + + //verify we're using the right amount of memory + TEST_ASSERT_EQUAL(3 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - 3 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesFree()); + + //fourth element + element[3] = CMock_Guts_MemNew(sizeof(unsigned int)); + TEST_ASSERT_MESSAGE(element[3] != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + TEST_ASSERT_NOT_EQUAL(element[0], element[3]); + TEST_ASSERT_NOT_EQUAL(element[1], element[3]); + TEST_ASSERT_NOT_EQUAL(element[2], element[3]); + TEST_ASSERT_EQUAL(first, CMock_Guts_MemChain(first, element[3])); + *((unsigned int*)CMock_Guts_GetAddressFor(element[3])) = 3; + + //verify we're using the right amount of memory + TEST_ASSERT_EQUAL(4 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - 4 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesFree()); + + //traverse list + next = first; + for (i = 0; i < 4; i++) + { + TEST_ASSERT_EQUAL(element[i], next); + TEST_ASSERT_EQUAL(i, *((unsigned int*)CMock_Guts_GetAddressFor(element[i]))); + next = CMock_Guts_MemNext(next); + } + + //verify we get a null at the end of the list + TEST_ASSERT_EQUAL_HEX(CMOCK_GUTS_NONE, next); + + //verify we're using the right amount of memory + TEST_ASSERT_EQUAL(4 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - 4 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesFree()); + + //Free it all + CMock_Guts_MemFreeAll(); + + //verify we're cleared + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE, CMock_Guts_MemBytesFree()); +} + +void test_ThatCMockStopsReturningMoreDataWhenItRunsOutOfMemory(void) +{ + unsigned int i; + CMOCK_MEM_INDEX_TYPE first = CMOCK_GUTS_NONE; + CMOCK_MEM_INDEX_TYPE next; + + //even though we are asking for one byte, we've told it to align to closest 4 bytes, therefore it will waste a byte each time + //so each call will use 8 bytes (4 for the index, 1 for the data, and 3 wasted). + //therefore we can safely allocated total/8 times. + for (i = 0; i < (CMOCK_MEM_SIZE / 8); i++) + { + TEST_ASSERT_EQUAL(i*8, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - i*8, CMock_Guts_MemBytesFree()); + + next = CMock_Guts_MemNew(1); + TEST_ASSERT_MESSAGE(next != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + + first = CMock_Guts_MemChain(first, next); + TEST_ASSERT_MESSAGE(first != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + } + + //verify we're at top of memory + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesFree()); + + //The very next call will return a NULL, and any after that + TEST_ASSERT_EQUAL_HEX(CMOCK_GUTS_NONE, CMock_Guts_MemNew(1)); + TEST_ASSERT_EQUAL_HEX(CMOCK_GUTS_NONE, CMock_Guts_MemNew(1)); + TEST_ASSERT_EQUAL_HEX(CMOCK_GUTS_NONE, CMock_Guts_MemNew(1)); + + //verify nothing has changed + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesFree()); + + //verify we can still walk through the elements allocated + next = first; + for (i = 0; i < (CMOCK_MEM_SIZE / 8); i++) + { + TEST_ASSERT_MESSAGE(next != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + next = CMock_Guts_MemNext(next); + } + + //there aren't any after that + TEST_ASSERT_EQUAL_HEX(CMOCK_GUTS_NONE, next); +} + +void test_ThatCMockStopsReturningMoreDataWhenAskForMoreThanItHasLeftEvenIfNotAtExactEnd(void) +{ + unsigned int i; + CMOCK_MEM_INDEX_TYPE first = CMOCK_GUTS_NONE; + CMOCK_MEM_INDEX_TYPE next; + + //we're asking for 12 bytes each time now (4 for index, 8 for data). + //10 requests will give us 120 bytes used, which isn't enough for another 12 bytes if total memory is 128 + for (i = 0; i < 10; i++) + { + TEST_ASSERT_EQUAL(i*12, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - i*12, CMock_Guts_MemBytesFree()); + + next = CMock_Guts_MemNew(8); + TEST_ASSERT_MESSAGE(next != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + + first = CMock_Guts_MemChain(first, next); + TEST_ASSERT_MESSAGE(first != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + + //verify writing data won't screw us up + *((unsigned int*)CMock_Guts_GetAddressFor(next)) = i; + } + + //verify we're at top of memory + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - 8, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(8, CMock_Guts_MemBytesFree()); + + //The very next call will return a NONE, and any after that + TEST_ASSERT_EQUAL_HEX(CMOCK_GUTS_NONE, CMock_Guts_MemNew(8)); + TEST_ASSERT_EQUAL_HEX(CMOCK_GUTS_NONE, CMock_Guts_MemNew(5)); + + //verify nothing has changed + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - 8, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(8, CMock_Guts_MemBytesFree()); + + //verify we can still walk through the elements allocated + next = first; + for (i = 0; i < 10; i++) + { + TEST_ASSERT_MESSAGE(next != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + TEST_ASSERT_EQUAL(i, *((unsigned int*)CMock_Guts_GetAddressFor(next))); + next = CMock_Guts_MemNext(next); + } + + //there aren't any after that + TEST_ASSERT_EQUAL_HEX(CMOCK_GUTS_NONE, next); +} + +void test_ThatWeCanAskForAllSortsOfSizes(void) +{ + unsigned int i; + CMOCK_MEM_INDEX_TYPE first = CMOCK_GUTS_NONE; + CMOCK_MEM_INDEX_TYPE next; + unsigned int sizes[5] = {3, 1, 80, 5, 4}; + unsigned int sizes_buffered[5] = {4, 4, 80, 8, 4}; + unsigned int sum = 0; + + for (i = 0; i < 5; i++) + { + next = CMock_Guts_MemNew(sizes[i]); + TEST_ASSERT_MESSAGE(next != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + + first = CMock_Guts_MemChain(first, next); + TEST_ASSERT_MESSAGE(first != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + + sum += sizes_buffered[i] + 4; + TEST_ASSERT_EQUAL(sum, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - sum, CMock_Guts_MemBytesFree()); + } + + //show that we can't ask for too much memory + TEST_ASSERT_EQUAL_HEX(CMOCK_GUTS_NONE, CMock_Guts_MemNew(12)); + TEST_ASSERT_EQUAL_HEX(CMOCK_GUTS_NONE, CMock_Guts_MemNew(5)); + + //but we CAN ask for something that will still fit + next = CMock_Guts_MemNew(4); + TEST_ASSERT_MESSAGE(next != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + + first = CMock_Guts_MemChain(first, next); + TEST_ASSERT_MESSAGE(first != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + + //verify we're used up now + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesFree()); + + //verify we can still walk through the elements allocated + next = first; + for (i = 0; i < 6; i++) + { + TEST_ASSERT_MESSAGE(next != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + next = CMock_Guts_MemNext(next); + } + + //there aren't any after that + TEST_ASSERT_EQUAL_HEX(CMOCK_GUTS_NONE, next); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/c/TestCMockC.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/c/TestCMockC.yml new file mode 100644 index 0000000..cd76154 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/c/TestCMockC.yml @@ -0,0 +1,12 @@ +--- +:files: + - 'src/cmock.c' + - 'test/c/TestCMockC.c' + - 'test/c/TestCMockC_Runner.c' + - 'vendor/unity/src/unity.c' +:options: + - 'TEST' + - 'CMOCK_MEM_SIZE=128' + - 'CMOCK_MEM_ALIGN=2' + - 'CMOCK_MEM_INDEX_TYPE=int' + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/c/TestCMockCDynamic.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/c/TestCMockCDynamic.c new file mode 100644 index 0000000..bd699a8 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/c/TestCMockCDynamic.c @@ -0,0 +1,186 @@ +/* ========================================== + CMock Project - Automatic Mock Generation for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity.h" +#include "cmock.h" + +#define TEST_MEM_INDEX_SIZE (sizeof(CMOCK_MEM_INDEX_TYPE)) +#define TEST_MEM_INDEX_PAD ((sizeof(CMOCK_MEM_INDEX_TYPE) + 7) & ~7) //round up to nearest 4 byte boundary + +unsigned int StartingSize; + +void setUp(void) +{ + CMock_Guts_MemFreeAll(); + StartingSize = CMock_Guts_MemBytesFree(); + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesUsed()); +} + +void tearDown(void) +{ +} + +void test_MemNewWillReturnNullIfGivenIllegalSizes(void) +{ + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemNew(0) ); + + //verify we're cleared still + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesFree()); +} + +void test_MemNewWillNowSupportSizesGreaterThanTheDefinesCMockSize(void) +{ + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesFree()); + + TEST_ASSERT_MESSAGE(CMock_Guts_MemNew(CMOCK_MEM_SIZE - TEST_MEM_INDEX_SIZE + 1) != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE + TEST_MEM_INDEX_PAD, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE, CMock_Guts_MemBytesFree()); +} + +void test_MemChainWillReturnNullAndDoNothingIfGivenIllegalInformation(void) +{ + CMOCK_MEM_INDEX_TYPE next = CMock_Guts_MemNew(8); + TEST_ASSERT_EQUAL(8 + TEST_MEM_INDEX_PAD, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(StartingSize - 8 - TEST_MEM_INDEX_PAD, CMock_Guts_MemBytesFree()); + + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemChain(next + CMOCK_MEM_SIZE, next) ); + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemChain(next, next + CMOCK_MEM_SIZE) ); + + //verify we're still the same + TEST_ASSERT_EQUAL(8 + TEST_MEM_INDEX_PAD, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(StartingSize - 8 - TEST_MEM_INDEX_PAD, CMock_Guts_MemBytesFree()); +} + +void test_MemNextWillReturnNullIfGivenABadRoot(void) +{ + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemNext(0) ); + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemNext(2) ); + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemNext( CMOCK_MEM_SIZE - 4 ) ); + + //verify we're cleared still + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(StartingSize, CMock_Guts_MemBytesFree()); +} + +void test_ThatWeCanClaimAndChainAFewElementsTogether(void) +{ + unsigned int i; + CMOCK_MEM_INDEX_TYPE first = CMOCK_GUTS_NONE; + CMOCK_MEM_INDEX_TYPE next; + CMOCK_MEM_INDEX_TYPE element[4]; + + //verify we're cleared first + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(StartingSize, CMock_Guts_MemBytesFree()); + + //first element + element[0] = CMock_Guts_MemNew(sizeof(unsigned int)); + TEST_ASSERT_MESSAGE(element[0] != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + first = CMock_Guts_MemChain(first, element[0]); + TEST_ASSERT_EQUAL(element[0], first); + *((unsigned int*)CMock_Guts_GetAddressFor(element[0])) = 0; + + //verify we're using the right amount of memory + TEST_ASSERT_EQUAL(1 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(StartingSize - 1 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesFree()); + + //second element + element[1] = CMock_Guts_MemNew(sizeof(unsigned int)); + TEST_ASSERT_MESSAGE(element[1] != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + TEST_ASSERT_NOT_EQUAL(element[0], element[1]); + TEST_ASSERT_EQUAL(first, CMock_Guts_MemChain(first, element[1])); + *((unsigned int*)CMock_Guts_GetAddressFor(element[1])) = 1; + + //verify we're using the right amount of memory + TEST_ASSERT_EQUAL(2 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(StartingSize - 2 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesFree()); + + //third element + element[2] = CMock_Guts_MemNew(sizeof(unsigned int)); + TEST_ASSERT_MESSAGE(element[2] != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + TEST_ASSERT_NOT_EQUAL(element[0], element[2]); + TEST_ASSERT_NOT_EQUAL(element[1], element[2]); + TEST_ASSERT_EQUAL(first, CMock_Guts_MemChain(first, element[2])); + *((unsigned int*)CMock_Guts_GetAddressFor(element[2])) = 2; + + //verify we're using the right amount of memory + TEST_ASSERT_EQUAL(3 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(StartingSize - 3 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesFree()); + + //fourth element + element[3] = CMock_Guts_MemNew(sizeof(unsigned int)); + TEST_ASSERT_MESSAGE(element[3] != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + TEST_ASSERT_NOT_EQUAL(element[0], element[3]); + TEST_ASSERT_NOT_EQUAL(element[1], element[3]); + TEST_ASSERT_NOT_EQUAL(element[2], element[3]); + TEST_ASSERT_EQUAL(first, CMock_Guts_MemChain(first, element[3])); + *((unsigned int*)CMock_Guts_GetAddressFor(element[3])) = 3; + + //verify we're using the right amount of memory + TEST_ASSERT_EQUAL(4 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(StartingSize - 4 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesFree()); + + //traverse list + next = first; + for (i = 0; i < 4; i++) + { + TEST_ASSERT_EQUAL(element[i], next); + TEST_ASSERT_EQUAL(i, *((unsigned int*)CMock_Guts_GetAddressFor(element[i]))); + next = CMock_Guts_MemNext(next); + } + + //verify we get a null at the end of the list + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, next); + + //verify we're using the right amount of memory + TEST_ASSERT_EQUAL(4 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(StartingSize - 4 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesFree()); + + //Free it all + CMock_Guts_MemFreeAll(); + + //verify we're cleared + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(StartingSize, CMock_Guts_MemBytesFree()); +} + +void test_ThatWeCanAskForAllSortsOfSizes(void) +{ + unsigned int i; + CMOCK_MEM_INDEX_TYPE first = CMOCK_GUTS_NONE; + CMOCK_MEM_INDEX_TYPE next; + unsigned int sizes[10] = {3, 1, 80, 5, 8, 31, 7, 911, 2, 80}; + unsigned int sizes_buffered[10] = {16, 16, 88, 16, 16, 40, 16, 920, 16, 88}; //includes counter + unsigned int sum = 0; + unsigned int cap; + + for (i = 0; i < 10; i++) + { + next = CMock_Guts_MemNew(sizes[i]); + TEST_ASSERT_MESSAGE(next != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + + first = CMock_Guts_MemChain(first, next); + TEST_ASSERT_MESSAGE(first != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + + sum += sizes_buffered[i]; + cap = (StartingSize > (sum + CMOCK_MEM_SIZE)) ? StartingSize : (sum + CMOCK_MEM_SIZE); + TEST_ASSERT_EQUAL(sum, CMock_Guts_MemBytesUsed()); + TEST_ASSERT(cap >= CMock_Guts_MemBytesFree()); + } + + //verify we can still walk through the elements allocated + next = first; + for (i = 0; i < 10; i++) + { + TEST_ASSERT_MESSAGE(next != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + next = CMock_Guts_MemNext(next); + } + + //there aren't any after that + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, next); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/c/TestCMockCDynamic.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/c/TestCMockCDynamic.yml new file mode 100644 index 0000000..7776c89 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/c/TestCMockCDynamic.yml @@ -0,0 +1,12 @@ +--- +:files: + - 'src/cmock.c' + - 'test/c/TestCMockCDynamic.c' + - 'test/c/TestCMockCDynamic_Runner.c' + - 'vendor/unity/src/unity.c' +:options: + - 'TEST' + - 'CMOCK_MEM_DYNAMIC' + - 'CMOCK_MEM_SIZE=64' + - 'CMOCK_MEM_ALIGN=3' + - 'CMOCK_MEM_INDEX_TYPE=short' diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/c/TestCMockCDynamic_Runner.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/c/TestCMockCDynamic_Runner.c new file mode 100644 index 0000000..e161625 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/c/TestCMockCDynamic_Runner.c @@ -0,0 +1,35 @@ +/* ========================================== + CMock Project - Automatic Mock Generation for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity.h" +#include +#include + +extern void setUp(void); +extern void tearDown(void); + +extern void test_MemNewWillReturnNullIfGivenIllegalSizes(void); +extern void test_MemNewWillNowSupportSizesGreaterThanTheDefinesCMockSize(void); +extern void test_MemChainWillReturnNullAndDoNothingIfGivenIllegalInformation(void); +extern void test_MemNextWillReturnNullIfGivenABadRoot(void); +extern void test_ThatWeCanClaimAndChainAFewElementsTogether(void); +extern void test_ThatWeCanAskForAllSortsOfSizes(void); + +int main(void) +{ + Unity.TestFile = "TestCMockDynamic.c"; + UnityBegin(); + + RUN_TEST(test_MemNewWillReturnNullIfGivenIllegalSizes, 26); + RUN_TEST(test_MemNewWillNowSupportSizesGreaterThanTheDefinesCMockSize, 35); + RUN_TEST(test_MemChainWillReturnNullAndDoNothingIfGivenIllegalInformation, 45); + RUN_TEST(test_MemNextWillReturnNullIfGivenABadRoot, 59); + RUN_TEST(test_ThatWeCanClaimAndChainAFewElementsTogether, 70); + RUN_TEST(test_ThatWeCanAskForAllSortsOfSizes, 152); + + UnityEnd(); + return 0; +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/c/TestCMockC_Runner.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/c/TestCMockC_Runner.c new file mode 100644 index 0000000..93d8e1f --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/c/TestCMockC_Runner.c @@ -0,0 +1,37 @@ +/* ========================================== + CMock Project - Automatic Mock Generation for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity.h" +#include +#include + +extern void setUp(void); +extern void tearDown(void); + +extern void test_MemNewWillReturnNullIfGivenIllegalSizes(void); +extern void test_MemChainWillReturnNullAndDoNothingIfGivenIllegalInformation(void); +extern void test_MemNextWillReturnNullIfGivenABadRoot(void); +extern void test_ThatWeCanClaimAndChainAFewElementsTogether(void); +extern void test_ThatCMockStopsReturningMoreDataWhenItRunsOutOfMemory(void); +extern void test_ThatCMockStopsReturningMoreDataWhenAskForMoreThanItHasLeftEvenIfNotAtExactEnd(void); +extern void test_ThatWeCanAskForAllSortsOfSizes(void); + +int main(void) +{ + Unity.TestFile = "TestCMock.c"; + UnityBegin(); + + RUN_TEST(test_MemNewWillReturnNullIfGivenIllegalSizes, 21); + RUN_TEST(test_MemChainWillReturnNullAndDoNothingIfGivenIllegalInformation, 32); + RUN_TEST(test_MemNextWillReturnNullIfGivenABadRoot, 46); + RUN_TEST(test_ThatWeCanClaimAndChainAFewElementsTogether, 57); + RUN_TEST(test_ThatCMockStopsReturningMoreDataWhenItRunsOutOfMemory, 139); + RUN_TEST(test_ThatCMockStopsReturningMoreDataWhenAskForMoreThanItHasLeftEvenIfNotAtExactEnd, 185); + RUN_TEST(test_ThatWeCanAskForAllSortsOfSizes, 233); + + UnityEnd(); + return 0; +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/systest_generator.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/systest_generator.rb new file mode 100644 index 0000000..368b039 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/systest_generator.rb @@ -0,0 +1,178 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require 'yaml' + +SYS_TEST_GEN_ROOT = File.expand_path( File.dirname( __FILE__ ) ) + '/' +GENERATED_PATH = SYS_TEST_GEN_ROOT + 'generated/' +BUILD_PATH = SYS_TEST_GEN_ROOT + 'build/' +CASES_PATH = SYS_TEST_GEN_ROOT + 'cases/' + +TYPES_H = 'types.h' +UNITY_H = 'unity.h' +CMOCK_H = 'cmock.h' +UNITY_HELPER_H = 'unity_helper.h' +UNITY_HELPER_C = 'unity_helper.c' +MOCKABLE_H = 'mockable.h' + +YAML_EXTENSION = '.yml' +TEST_PREFIX = 'test_' +MOCK_PREFIX = 'mock_' +H_EXTENSION = '.h' +C_EXTENSION = '.c' + + +class SystemTestGenerator + + def generate_files(test_cases) + test_cases.each do |filename| + yaml_hash = YAML.load_file(filename) + + name = File.basename(filename, YAML_EXTENSION) + namix = "#{name}_" + + generate_cmock_config(yaml_hash, namix) + generate_code(yaml_hash, namix, name) + end + end + + private + + def generate_cmock_config(yaml_hash, namix) + cmock_yaml = yaml_hash.clone + cmock_yaml.delete(:systest) + cmock = cmock_yaml[:cmock] + + cmock[:mock_path] = GENERATED_PATH + cmock[:includes] = (cmock[:includes] || []) + [namix + TYPES_H] + cmock[:mock_prefix] = MOCK_PREFIX + if not yaml_hash[:systest][:unity_helper].nil? + cmock[:includes] << namix + UNITY_HELPER_H + cmock[:unity_helper] = GENERATED_PATH + namix + UNITY_HELPER_H + end + + File.open(GENERATED_PATH + namix + 'cmock' + YAML_EXTENSION, 'w') do |out| + YAML.dump(cmock_yaml, out) + end + end + + def generate_code(yaml_hash, namix, name) + generate_types_file(yaml_hash, namix) + generate_mockable_file(yaml_hash, namix) + generate_unity_helper_files(yaml_hash, namix) + + generate_test_file(yaml_hash, namix, name) + generate_source_file(yaml_hash, namix, name) + end + + def generate_types_file(yaml_hash, namix) + types = yaml_hash[:systest][:types] + return if types.nil? + + write_header_file(GENERATED_PATH + namix + TYPES_H, namix.upcase + 'TYPES_H') do |out| + out.puts(types) + end + end + + def generate_mockable_file(yaml_hash, namix) + mockable = yaml_hash[:systest][:mockable] + return if mockable.nil? + + write_header_file(GENERATED_PATH + namix + MOCKABLE_H, namix.upcase + 'MOCKABLE_H', [namix + TYPES_H]) do |out| + out.puts(mockable) + end + end + + def generate_unity_helper_files(yaml_hash, namix) + unity_helper = yaml_hash[:systest][:unity_helper] + return if unity_helper.nil? + + write_header_file(GENERATED_PATH + namix + UNITY_HELPER_H, namix.upcase + 'UNITY_HELPER_H', [namix + TYPES_H]) do |out| + out.puts(unity_helper[:header]) + end + + write_source_file(GENERATED_PATH + namix + UNITY_HELPER_C, ["unity.h", namix + UNITY_HELPER_H]) do |out| + out.puts(unity_helper[:code]) + end + end + + def generate_test_file(yaml_hash, namix, name) + tests = yaml_hash[:systest][:tests] + return if tests.nil? + + includes = [UNITY_H, CMOCK_H] + includes << (namix + UNITY_HELPER_H) if not yaml_hash[:systest][:unity_helper].nil? + includes << [MOCK_PREFIX + namix + MOCKABLE_H] + includes << [name + H_EXTENSION] + + write_source_file(GENERATED_PATH + TEST_PREFIX + name + C_EXTENSION, includes.flatten) do |out| + out.puts(tests[:common]) + out.puts('') + + tests[:units].each_with_index do |test, index| + out.puts('// should ' + test[:should]) + out.puts(test[:code].gsub!(/test\(\)/, "void test#{index+1}(void)")) + out.puts('') + end + end + end + + def generate_source_file(yaml_hash, namix, name) + source = yaml_hash[:systest][:source] + return if source.nil? + + header_file = name + H_EXTENSION + + includes = yaml_hash[:systest][:types].nil? ? [] : [(namix + TYPES_H)] + + write_header_file(GENERATED_PATH + header_file, name.upcase, includes) do |out| + out.puts(source[:header]) + end + + includes = [] + includes << (namix + TYPES_H) if not yaml_hash[:systest][:types].nil? + includes << (namix + MOCKABLE_H) if not yaml_hash[:systest][:mockable].nil? + includes << header_file + + write_source_file(GENERATED_PATH + name + C_EXTENSION, includes.flatten) do |out| + out.puts(source[:code]) + end + end + + def write_header_file(filename, upcase_name, include_list=[]) + File.open(filename, 'w') do |out| + out.puts("#ifndef _#{upcase_name}") + out.puts("#define _#{upcase_name}") + out.puts('') + include_list.each do |include| + out.puts("#include \"#{include}\"") + end + out.puts('') + yield(out) + out.puts('') + out.puts("#endif // _#{upcase_name}") + out.puts('') + end + end + + def write_source_file(filename, include_list=[]) + File.open(filename, 'w') do |out| + include_list.each do |include| + out.puts("#include \"#{include}\"") + end + out.puts('') + yield(out) + out.puts('') + end + end + +end + + +if ($0 == __FILE__) + SystemTestGenerator.new.generate_files(Dir[CASES_PATH + "*#{YAML_EXTENSION}"]) +end + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_compilation/config.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_compilation/config.yml new file mode 100644 index 0000000..7726699 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_compilation/config.yml @@ -0,0 +1,9 @@ +--- +:cmock: + :plugins: [] + :includes: [] + :mock_path: test/system/generated/ + :mock_prefix: mock_ + :treat_as_void: + - OSEK_TASK + - VOID_TYPE_CRAZINESS diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_compilation/const.h b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_compilation/const.h new file mode 100644 index 0000000..e17c465 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_compilation/const.h @@ -0,0 +1,15 @@ +/* ========================================== + CMock Project - Automatic Mock Generation for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +struct _DUMMY_T { unsigned int a; float b; }; + +void const_variants1( const char* a, int const, unsigned short const * c ); + +void const_variants2( + struct _DUMMY_T const * const param1, + const unsigned long int const * const param2, + const struct _DUMMY_T const * param3 ); + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_compilation/osek.h b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_compilation/osek.h new file mode 100644 index 0000000..f3abe7b --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_compilation/osek.h @@ -0,0 +1,275 @@ +/* ========================================== + CMock Project - Automatic Mock Generation for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +typedef unsigned char OSServiceIdType; +typedef void (*OSEKOS_VOIDFUNCPTR)(void); + +typedef unsigned char StatusType; +typedef unsigned char OSEK_U8; +typedef unsigned short OSEK_U16; +typedef unsigned long OSEK_U32; + +void OSEKOSDisableAll(void); +void OSEKOSEnableAll(void); + +typedef unsigned long * OSEKOSSaveType; +typedef void OSEK_TASK; +typedef OSEK_U8 OSEKOSPrioType; + +enum { +Task_DbgCAN +, +Task_ALS +, +CalibrateMagTask +, +Task_IAQ +, +SmartBeam +, +Task_QbertTestImage +, +Task_TestQbertMem +, +Task_Cyclic1000 +, +ProcessMagForCompass +, +ReadMag +, +Task_Cyclic10 +, +Task_Wdm +, +BackgroundTask +, +Task_Cyclic20 +, +Task_Cyclic2 +}; + +OSEK_TASK OSEKOS_T_Task_DbgCAN(void); +OSEK_TASK OSEKOS_T_Task_ALS(void); +OSEK_TASK OSEKOS_T_CalibrateMagTask(void); +OSEK_TASK OSEKOS_T_Task_IAQ(void); +OSEK_TASK OSEKOS_T_SmartBeam(void); +OSEK_TASK OSEKOS_T_Task_QbertTestImage(void); +OSEK_TASK OSEKOS_T_Task_TestQbertMem(void); +OSEK_TASK OSEKOS_T_Task_Cyclic1000(void); +OSEK_TASK OSEKOS_T_ProcessMagForCompass(void); +OSEK_TASK OSEKOS_T_ReadMag(void); +OSEK_TASK OSEKOS_T_Task_Cyclic10(void); +OSEK_TASK OSEKOS_T_Task_Wdm(void); +OSEK_TASK OSEKOS_T_BackgroundTask(void); +OSEK_TASK OSEKOS_T_Task_Cyclic20(void); +OSEK_TASK OSEKOS_T_Task_Cyclic2(void); +OSEK_TASK OSEKOS_Twrap_Task_DbgCAN(void); +OSEK_TASK OSEKOS_Twrap_Task_ALS(void); +OSEK_TASK OSEKOS_Twrap_CalibrateMagTask(void); +OSEK_TASK OSEKOS_Twrap_Task_IAQ(void); +OSEK_TASK OSEKOS_Twrap_SmartBeam(void); +OSEK_TASK OSEKOS_Twrap_Task_QbertTestImage(void); +OSEK_TASK OSEKOS_Twrap_Task_TestQbertMem(void); +OSEK_TASK OSEKOS_Twrap_Task_Cyclic1000(void); +OSEK_TASK OSEKOS_Twrap_ProcessMagForCompass(void); +OSEK_TASK OSEKOS_Twrap_ReadMag(void); +OSEK_TASK OSEKOS_Twrap_Task_Cyclic10(void); +OSEK_TASK OSEKOS_Twrap_Task_Wdm(void); +OSEK_TASK OSEKOS_Twrap_BackgroundTask(void); +OSEK_TASK OSEKOS_Twrap_Task_Cyclic20(void); +OSEK_TASK OSEKOS_Twrap_Task_Cyclic2(void); + +typedef OSEK_U8 TaskType; +typedef OSEK_U8 TaskStateType; +typedef OSEK_U16 EventMaskType; +typedef OSEK_U8 ResourceType; + +void OSEKOSEnableSystemTimers(void); + +typedef OSEK_U8 CounterType; +typedef OSEK_U32 TickType; +typedef OSEK_U8 AlarmType; + +void OSEKOS_ISR_CanTxInterrupt(void); +void OSEKOS_ISR_CanRxInterrupt(void); +void OSEKOS_ISR_CanErrInterrupt(void); +void OSEKOS_ISR_SCIRxInterrupt(void); +void OSEKOS_ISR_SCITxInterrupt(void); +void OSEKOS_ISR_UP_DMA_Interrupt_0(void); +void OSEKOS_ISR_UP_DMA_Interrupt_1(void); +void OSEKOS_ISR_UP_DMA_Interrupt_2(void); +void OSEKOS_ISR_UP_DMA_Interrupt_3(void); +void OSEKOS_ISR_CompFreqHandler(void); +void OSEKOS_ISR_AmbientReturnInt(void); +void OSEKOS_ISR_GlareReturnInt(void); +void OSEKOS_ISR_ALSTimeoutInt(void); +void OSEKOS_ISR_LINTimerInt(void); +void OSEKOS_ISR_LINDelayInt(void); +void OSEKOS_ISR_TimerMExpire(void); +void OSEKOS_ISR_LINRxTx_SCI1(void); +void OSEKOS_ISR_CanRxInterrupt_1(void); +void OSEKOS_ISR_LINError_SCI1(void); +void OSEKOS_ISR_SysCounter(void); + + +// defined multiple times (slightly different forms) These should be ignored because they are externed +extern void OSEKOS_ISR_CanTxInterrupt( void ); +extern void OSEKOS_ISR_CanRxInterrupt( void ); + + +unsigned long OSEKOSrtcGetSeconds ( void ); +void OSEKOSrtcIncrement ( unsigned long nsec ); + +enum +{ + E_OS_ACCESS = 1, + E_OS_CALLEVEL = 2, + E_OS_ID = 3, + E_OS_LIMIT = 4, + E_OS_NOFUNC = 5, + E_OS_RESOURCE = 6, + E_OS_STATE = 7, + E_OS_VALUE = 8, + E_OS_SYS_StackOverflow = 20, + E_OS_SYS_StackUnderflow = 21, + E_OS_SYS_INIT = 22, + E_OS_SYS_CONFIG = 23, + E_OS_SYS_CODE = 24, + E_OS_SYS_TOOL = 25, + E_OS_SYS_TimerRange = 26 +}; + +enum +{ + SUSPENDED = 0x00, + READY = 0x01, + RUNNING = 0x02, + WAITING = 0x03, + INTSTART = 0x08, + SETSTART = 0x10, + NPRTASK = 0x20, + USEFP = 0x40 +}; + +typedef struct +{ + TickType maxallowedvalue; + TickType ticksperbase; +} AlarmBaseType; + +typedef TaskType *TaskRefType; +typedef TaskStateType *TaskStateRefType; +typedef EventMaskType *EventMaskRefType; +typedef TickType *TickRefType; +typedef AlarmBaseType *AlarmBaseRefType; +typedef OSEK_U8 AppModeType; +typedef OSEK_U8 OSEKOSTaskActCntType; + +TaskType OSEKOStidact; +OSEKOSPrioType OSEKOSrunprio; + +StatusType OSEKOSError ( register StatusType ); +void ErrorHook ( StatusType ); +void StartupHook ( void ); +void ShutdownHook ( StatusType ); + +int getUsedTaskStack ( TaskType ); +int getUnusedTaskStack ( TaskType ); +int getUsedIsrStack ( void ); +int getUnusedIsrStack ( void ); +void OSEKOStaskStackCheckInit ( void ); +signed char OSEKOStaskStackCheck ( OSEK_U8 * ); +signed char OSEKOSisrStackCheck ( OSEK_U8 * ); +void OSEKOStaskStackCheckFatal ( OSEK_U8 * ); +void OSEKOSisrStackCheckFatal ( OSEK_U8 * ); +OSEK_U8 * OSEKOSgetStackPointer ( void ); +void OSEKOSTaskSwitch ( void ); +StatusType OSEKOSReturn ( StatusType ); +StatusType OSEKOSActivateTask ( register TaskType ); +void OSEKOSTerminateTask ( TaskType, TaskType ); + + extern void OSEKOSGetResource ( ResourceType ); + extern void OSEKOSReleaseResource ( ResourceType ); + +int OSEKOSSetEvent ( TaskType, EventMaskType ); +int OSEKOSWaitEvent ( EventMaskType ); +TickType OSEKOSGetAlarm(register AlarmType); +void OSEKOSSetAlarm ( AlarmType, TickType, TickType ); +StatusType OSEKOSSetAbsAlarm ( AlarmType a, TickType b, TickType c ); + +StatusType OSEKOSCancelAlarm ( register AlarmType ); +void OSEKOSAdvCntr ( void ); +AppModeType GetActiveApplicationMode ( void ); + +void StartOS ( AppModeType ); + +void OSEKOSShutdownOS ( StatusType ); + +StatusType ActivateTask ( TaskType A ); +StatusType TerminateTask ( void ); +StatusType ChainTask ( TaskType A ); +StatusType GetTaskState ( TaskType A, TaskStateRefType B ); +StatusType GetTaskID ( TaskRefType A ); +StatusType Schedule ( void ); +StatusType GetResource ( ResourceType A ); +StatusType ReleaseResource ( ResourceType A ); +StatusType SetEvent ( TaskType A, EventMaskType B ); +StatusType ClearEvent ( EventMaskType A ); +StatusType WaitEvent ( EventMaskType A ); +StatusType GetEvent ( TaskType A, EventMaskRefType B ); +StatusType GetAlarm ( AlarmType A, TickRefType B ); +StatusType GetAlarmBase ( AlarmType A, AlarmBaseRefType B ); +StatusType SetRelAlarm ( AlarmType A, TickType B, TickType C ); +StatusType SetAbsAlarm ( AlarmType A, TickType B, TickType C ); +StatusType CancelAlarm ( AlarmType A ); +StatusType AdvCntr ( CounterType A ); +StatusType IAdvCntr ( CounterType A ); +void SuspendOSInterrupts ( void ); +void ResumeOSInterrupts ( void ); +void SuspendAllInterrupts ( void ); +void ResumeAllInterrupts ( void ); +void DisableAllInterrupts ( void ); +void EnableAllInterrupts ( void ); + +void OSEKOSDisable(void); +void OSEKOSEnable(void); +void OSEKOSAsmIDispatch(unsigned long *); +void OSEKOSAsmDispatch(OSEKOSPrioType p); +void OSEKOSStartupEnable(void); +void OSEKOSNop(void); +unsigned int OSEKOSV850CheckIsrSwitch(void); +void OSEKOSV850InitInterrupts(void); +void OSEKOSV850SetupInterrupts(); +void OSEKOSV850SyncContextLoad(OSEKOSSaveType); +void OSEKOSV850SyncContextLoadFromIRQ(OSEKOSSaveType); +void OSEKOSV850ASyncContextLoad(OSEKOSSaveType); +void OSEKOSV850ASyncContextLoadFromIRQ(OSEKOSSaveType); + +// arrays of function pointers - they look like function prototypes +void ( ( * const OSEKOStaskStartAddress [10] ) ( void ) ); +StatusType (* OSEKOStaskStatuses [10][5]) ( void ); + +void OSEKOSV850StartContext +( + OSEK_TASK (( * const ) ( void )), + OSEK_U8 * const +); +void OSEKOSV850StartContextFromIRQ +( + OSEK_TASK (( * const ) ( void )), + OSEK_U8 * const +); + +void OSEKOSSuspendOSInterrupts(void); +void OSEKOSResumeOSInterrupts(void); +void OSEKOSSuspendAllInterrupts(void); +void OSEKOSResumeAllInterrupts(void); +void OSEKOScheckSuspendResumeNesting(void); + + +void OSEKOSgetSR(void); +void OSEKOSEnableInterrupt_intern(int nr); +void OSEKOSDisableInterrupt_intern(int nr); diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_compilation/parsing.h b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_compilation/parsing.h new file mode 100644 index 0000000..e1bcb8b --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_compilation/parsing.h @@ -0,0 +1,47 @@ +/* ========================================== + CMock Project - Automatic Mock Generation for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +typedef unsigned short U16; +typedef signed int int32_t; + +typedef struct _POINT_T +{ + int x; + int y; +} POINT_T; + +// typedef edge case; +// not ANSI C but it has been done and will break cmock if not handled +typedef void VOID_TYPE_CRAZINESS; + +/* fun parsing & mock generation cases */ + +void var_args1(int a, ...); +void var_args2(int a, int b, ...); + +VOID_TYPE_CRAZINESS void_type_craziness1(int, float, double, char, short, long, long int, long long, void*); +int void_type_craziness2( VOID_TYPE_CRAZINESS ); + + void crazy_whitespace ( int lint, double shot , short stack ) ; + +char + crazy_multiline +( + int a, + unsigned int b); + +U16 *ptr_return1(int a); +U16* ptr_return2(int a); +U16 * ptr_return3(int a); + +unsigned int** ptr_ptr_return1(unsigned int** a); +unsigned int* *ptr_ptr_return2(unsigned int* *a); +unsigned int **ptr_ptr_return3(unsigned int **a); +unsigned int ** ptr_ptr_return4(unsigned int ** a); + +extern unsigned long int incredible_descriptors(register const unsigned short a); + +int32_t example_c99_type(int32_t param1); diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/all_plugins_but_other_limits.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/all_plugins_but_other_limits.yml new file mode 100644 index 0000000..052f883 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/all_plugins_but_other_limits.yml @@ -0,0 +1,340 @@ +--- +#this test is different than all_plugins_coexist primarily because of these options +:cmock: + :enforce_strict_ordering: 1 + :treat_externs: :include + :ignore: :args_only + :plugins: + - :array + - :cexception + - :ignore + - :callback + +:systest: + :types: | + typedef struct _POINT_T { + int x; + int y; + } POINT_T; + + :mockable: | + #include "CException.h" + void foo(POINT_T* a); + POINT_T* bar(void); + void fooa(POINT_T a[]); + void foos(const char * a); + extern const char * bars(void); + void no_pointers(int a, char* b); + int mixed(int a, int* b, int c); + + :source: + :header: | + #include "CException.h" + void function_a(void); + void function_b(void); + void function_c(void); + int function_d(void); + void function_e(void); + + :code: | + void function_a(void) + { + foo(bar()); + } + + void function_b(void) { + fooa(bar()); + } + + void function_c(void) { + CEXCEPTION_T e; + Try { + foos(bars()); + } Catch(e) { foos("err"); } + } + + int function_d(void) { + int test_list[] = { 1, 2, 3, 4, 5 }; + no_pointers(1, "silly"); + return mixed(6, test_list, 7); + } + + void function_e(void) { + foos("Hello"); + foos("Tuna"); + foos("Oranges"); + } + + :tests: + :common: | + #include "CException.h" + void setUp(void) {} + void tearDown(void) {} + + :units: + - :pass: TRUE + :should: 'handle the situation where we pass nulls to pointers' + :code: | + test() + { + bar_ExpectAndReturn(NULL); + foo_Expect(NULL); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we expected nulls to pointers but did not get that' + :code: | + test() + { + POINT_T pt = {1, 2}; + bar_ExpectAndReturn(&pt); + foo_Expect(NULL); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we did not expect nulls to pointers but got null' + :code: | + test() + { + POINT_T ex = {1, 2}; + bar_ExpectAndReturn(NULL); + foo_Expect(&ex); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass single object with expect and it is wrong' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 3}; + bar_ExpectAndReturn(&pt); + foo_Expect(&ex); + + function_a(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass single object with expect and use array handler' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 2}; + bar_ExpectAndReturn(&pt); + foo_ExpectWithArray(&ex, 1); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass single object with expect and use array handler and it is wrong' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 3}; + bar_ExpectAndReturn(&pt); + foo_ExpectWithArray(&ex, 1); + + function_a(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass multiple objects with expect and use array handler' + :code: | + test() + { + POINT_T pt[] = {{1, 2}, {3, 4}, {5, 6}}; + POINT_T ex[] = {{1, 2}, {3, 4}, {5, 6}}; + bar_ExpectAndReturn(pt); + foo_ExpectWithArray(ex, 3); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass multiple objects with expect and use array handler and it is wrong at end' + :code: | + test() + { + POINT_T pt[] = {{1, 2}, {3, 4}, {5, 6}}; + POINT_T ex[] = {{1, 2}, {3, 4}, {5, 9}}; + bar_ExpectAndReturn(pt); + foo_ExpectWithArray(ex, 3); + + function_a(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass single array element with expect' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 2}; + bar_ExpectAndReturn(&pt); + fooa_Expect(&ex); + + function_b(); + } + + - :pass: TRUE + :should: 'handle standard c string as null terminated on not do crappy memory compares of a byte, passing' + :code: | + test() + { + bars_ExpectAndReturn("This is a\0 silly string"); + foos_Expect("This is a\0 wacky string"); + + function_c(); + } + + - :pass: FALSE + :should: 'handle standard c string as null terminated on not do crappy memory compares of a byte, finding failures' + :code: | + test() + { + bars_ExpectAndReturn("This is a silly string"); + foos_Expect("This is a wacky string"); + + function_c(); + } + + - :pass: TRUE + :should: 'handle creating array expects when we have mixed arguments for single object' + :code: | + test() + { + int expect_list[] = { 1, 9 }; + no_pointers_Expect(1, "silly"); + mixed_ExpectAndReturn(6, expect_list, 7, 13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: FALSE + :should: 'handle creating array expects when we have mixed arguments and handle failures for single object' + :code: | + test() + { + int expect_list[] = { 9, 1 }; + no_pointers_Expect(1, "silly"); + mixed_ExpectAndReturn(6, expect_list, 7, 13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: TRUE + :should: 'handle creating array expects when we have mixed arguments for multiple objects' + :code: | + test() + { + int expect_list[] = { 1, 2, 3, 4, 6 }; + no_pointers_Expect(1, "silly"); + mixed_ExpectWithArrayAndReturn(6, expect_list, 4, 7, 13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: FALSE + :should: 'handle creating array expects when we have mixed arguments and handle failures for multiple objects' + :code: | + test() + { + int expect_list[] = { 1, 2, 3, 4, 6 }; + no_pointers_Expect(1, "silly"); + mixed_ExpectWithArrayAndReturn(6, expect_list, 5, 7, 13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: TRUE + :should: 'handle an exception being caught' + :code: | + test() + { + bars_ExpectAndReturn("This is a\0 silly string"); + foos_ExpectAndThrow("This is a\0 wacky string", 55); + foos_Expect("err"); + + function_c(); + } + + - :pass: FALSE + :should: 'handle an exception being caught but still catch following errors' + :code: | + test() + { + bars_ExpectAndReturn("This is a\0 silly string"); + foos_ExpectAndThrow("This is a\0 wacky string", 55); + foos_Expect("wrong error"); + + function_c(); + } + + - :pass: FALSE + :should: 'fail strict ordering problems even though we would otherwise have passed' + :code: | + test() + { + int expect_list[] = { 1, 2, 3, 4, 6 }; + mixed_ExpectWithArrayAndReturn(6, expect_list, 4, 7, 13); + no_pointers_Expect(1, "silly"); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: TRUE + :should: 'properly ignore first function but the other will work properly' + :code: | + test() + { + int expect_list[] = { 1, 2, 3, 4, 6 }; + no_pointers_Ignore(); + mixed_ExpectWithArrayAndReturn(6, expect_list, 4, 7, 13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: TRUE + :should: 'properly ignore last function but the other will work properly' + :code: | + test() + { + no_pointers_Expect(1, "silly"); + mixed_IgnoreAndReturn(13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: TRUE + :should: 'be ok if we ignore a call each because we are counting calls' + :code: | + test() + { + foos_Ignore(); + foos_Ignore(); + foos_Ignore(); + + function_e(); + } + + - :pass: FALSE + :should: 'fail if we do not ignore a call once because we are counting calls' + :code: | + test() + { + foos_Ignore(); + foos_Ignore(); + + function_e(); + } + +... diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/all_plugins_coexist.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/all_plugins_coexist.yml new file mode 100644 index 0000000..b76859f --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/all_plugins_coexist.yml @@ -0,0 +1,381 @@ +--- +:cmock: + :enforce_strict_ordering: 1 + :plugins: + - :array + - :cexception + - :ignore + - :callback + :callback_after_arg_check: true + #:callback_include_count: false + :treat_externs: :include + +:systest: + :types: | + typedef struct _POINT_T { + int x; + int y; + } POINT_T; + + :mockable: | + #include "CException.h" + extern void foo(POINT_T* a); + POINT_T* bar(void); + void fooa(POINT_T a[]); + void foos(const char * a); + const char * bars(void); + void no_pointers(int a, char* b); + int mixed(int a, int* b, int c); + + :source: + :header: | + #include "CException.h" + void function_a(void); + void function_b(void); + void function_c(void); + int function_d(void); + void function_e(void); + + :code: | + void function_a(void) + { + foo(bar()); + } + + void function_b(void) { + fooa(bar()); + } + + void function_c(void) { + CEXCEPTION_T e; + Try { + foos(bars()); + } Catch(e) { foos("err"); } + } + + int function_d(void) { + int test_list[] = { 1, 2, 3, 4, 5 }; + no_pointers(1, "silly"); + return mixed(6, test_list, 7); + } + + void function_e(void) { + foos("Hello"); + foos("Tuna"); + foos("Oranges"); + } + + :tests: + :common: | + #include "CException.h" + void setUp(void) {} + void tearDown(void) {} + void my_foo_callback(POINT_T* a) { TEST_ASSERT_EQUAL_INT(2, a->x); } + + :units: + - :pass: TRUE + :should: 'handle the situation where we pass nulls to pointers' + :code: | + test() + { + bar_ExpectAndReturn(NULL); + foo_Expect(NULL); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we expected nulls to pointers but did not get that' + :code: | + test() + { + POINT_T pt = {1, 2}; + bar_ExpectAndReturn(&pt); + foo_Expect(NULL); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we did not expect nulls to pointers but got null' + :code: | + test() + { + POINT_T ex = {1, 2}; + bar_ExpectAndReturn(NULL); + foo_Expect(&ex); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass single object with expect and it is wrong' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 3}; + bar_ExpectAndReturn(&pt); + foo_Expect(&ex); + + function_a(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass single object with expect and use array handler' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 2}; + bar_ExpectAndReturn(&pt); + foo_ExpectWithArray(&ex, 1); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass single object with expect and use array handler and it is wrong' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 3}; + bar_ExpectAndReturn(&pt); + foo_ExpectWithArray(&ex, 1); + + function_a(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass multiple objects with expect and use array handler' + :code: | + test() + { + POINT_T pt[] = {{1, 2}, {3, 4}, {5, 6}}; + POINT_T ex[] = {{1, 2}, {3, 4}, {5, 6}}; + bar_ExpectAndReturn(pt); + foo_ExpectWithArray(ex, 3); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass multiple objects with expect and use array handler and it is wrong at end' + :code: | + test() + { + POINT_T pt[] = {{1, 2}, {3, 4}, {5, 6}}; + POINT_T ex[] = {{1, 2}, {3, 4}, {5, 9}}; + bar_ExpectAndReturn(pt); + foo_ExpectWithArray(ex, 3); + + function_a(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass single array element with expect' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 2}; + bar_ExpectAndReturn(&pt); + fooa_Expect(&ex); + + function_b(); + } + + - :pass: TRUE + :should: 'handle standard c string as null terminated on not do crappy memory compares of a byte, passing' + :code: | + test() + { + bars_ExpectAndReturn("This is a\0 silly string"); + foos_Expect("This is a\0 wacky string"); + + function_c(); + } + + - :pass: FALSE + :should: 'handle standard c string as null terminated on not do crappy memory compares of a byte, finding failures' + :code: | + test() + { + bars_ExpectAndReturn("This is a silly string"); + foos_Expect("This is a wacky string"); + + function_c(); + } + + - :pass: TRUE + :should: 'handle creating array expects when we have mixed arguments for single object' + :code: | + test() + { + int expect_list[] = { 1, 9 }; + no_pointers_Expect(1, "silly"); + mixed_ExpectAndReturn(6, expect_list, 7, 13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: FALSE + :should: 'handle creating array expects when we have mixed arguments and handle failures for single object' + :code: | + test() + { + int expect_list[] = { 9, 1 }; + no_pointers_Expect(1, "silly"); + mixed_ExpectAndReturn(6, expect_list, 7, 13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: TRUE + :should: 'handle creating array expects when we have mixed arguments for multiple objects' + :code: | + test() + { + int expect_list[] = { 1, 2, 3, 4, 6 }; + no_pointers_Expect(1, "silly"); + mixed_ExpectWithArrayAndReturn(6, expect_list, 4, 7, 13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: FALSE + :should: 'handle creating array expects when we have mixed arguments and handle failures for multiple objects' + :code: | + test() + { + int expect_list[] = { 1, 2, 3, 4, 6 }; + no_pointers_Expect(1, "silly"); + mixed_ExpectWithArrayAndReturn(6, expect_list, 5, 7, 13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: TRUE + :should: 'handle an exception being caught' + :code: | + test() + { + bars_ExpectAndReturn("This is a\0 silly string"); + foos_ExpectAndThrow("This is a\0 wacky string", 55); + foos_Expect("err"); + + function_c(); + } + + - :pass: FALSE + :should: 'handle an exception being caught but still catch following errors' + :code: | + test() + { + bars_ExpectAndReturn("This is a\0 silly string"); + foos_ExpectAndThrow("This is a\0 wacky string", 55); + foos_Expect("wrong error"); + + function_c(); + } + + - :pass: FALSE + :should: 'fail strict ordering problems even though we would otherwise have passed' + :code: | + test() + { + int expect_list[] = { 1, 2, 3, 4, 6 }; + mixed_ExpectWithArrayAndReturn(6, expect_list, 4, 7, 13); + no_pointers_Expect(1, "silly"); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: TRUE + :should: 'that we can properly ignore last function but the other will work properly' + :code: | + test() + { + int expect_list[] = { 1, 2, 3, 4, 6 }; + mixed_ExpectWithArrayAndReturn(6, expect_list, 4, 7, 13); + no_pointers_Ignore(); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: TRUE + :should: 'that we can properly ignore first function but the other will work properly' + :code: | + test() + { + mixed_IgnoreAndReturn(13); + no_pointers_Expect(1, "silly"); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: TRUE + :should: 'that we just have to ignore a call once because we are not counting calls' + :code: | + test() + { + foos_Ignore(); + + function_e(); + } + + - :pass: TRUE + :should: 'that we can use a callback and an expect' + :code: | + test() + { + POINT_T pt1 = {2, 3}; + POINT_T pt2 = {2, 3}; + bar_ExpectAndReturn(&pt1); + foo_Expect(&pt2); + foo_StubWithCallback((CMOCK_foo_CALLBACK)my_foo_callback); + + function_a(); + } + + - :pass: FALSE + :should: 'that we can fail even when using a callback if we want to expect call but did not and we are checking that' + :code: | + test() + { + POINT_T pt = {2, 3}; + bar_ExpectAndReturn(&pt); + foo_StubWithCallback((CMOCK_foo_CALLBACK)my_foo_callback); + + function_a(); + } + + - :pass: FALSE + :should: 'that we can fail even when using a callback if args are wrong and we are checking those' + :code: | + test() + { + POINT_T pt1 = {2, 3}; + POINT_T pt2 = {1, 3}; + bar_ExpectAndReturn(&pt1); + foo_Expect(&pt2); + foo_StubWithCallback((CMOCK_foo_CALLBACK)my_foo_callback); + + function_a(); + } + + - :pass: FALSE + :should: 'that we can fail from the callback itself' + :code: | + test() + { + POINT_T pt = {3, 3}; + bar_ExpectAndReturn(&pt); + foo_Expect(&pt); + foo_StubWithCallback((CMOCK_foo_CALLBACK)my_foo_callback); + + function_a(); + } + +... diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/array_and_pointer_handling.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/array_and_pointer_handling.yml new file mode 100644 index 0000000..dfa7d10 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/array_and_pointer_handling.yml @@ -0,0 +1,382 @@ +--- +:cmock: + :when_ptr: :smart + :plugins: + - :array + +:systest: + :types: | + typedef struct _POINT_T { + int x; + int y; + } POINT_T; + #define ARRAY_A_SIZE (5) + + :mockable: | + void foo(POINT_T* a); + POINT_T* bar(void); + void fooa(POINT_T a[ARRAY_A_SIZE+1-1]); + void foos(const char * a); + const char * bars(void); + void no_pointers(int a, char* b); + int mixed(int a, int* b, int c); + void potential_packing_problem(short *a); + + :source: + :header: | + void function_a(void); + void function_b(void); + void function_c(void); + int function_d(void); + void function_e(void); + + :code: | + void function_a(void) + { + foo(bar()); + } + + void function_b(void) { + fooa(bar()); + } + + void function_c(void) { + foos(bars()); + } + + int function_d(void) { + int test_list[] = { 1, 2, 3, 4, 5 }; + no_pointers(1, "silly"); + return mixed(6, test_list, 7); + } + + void function_e(void) { + short test_list[] = {-1, -2, -3, -4}; + potential_packing_problem(&test_list[1]); + } + + :tests: + :common: | + void setUp(void) {} + void tearDown(void) {} + + :units: + - :pass: TRUE + :should: 'handle the situation where we pass nulls to pointers' + :code: | + test() + { + bar_ExpectAndReturn(NULL); + foo_Expect(NULL); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we expected nulls to pointers but did not get that' + :code: | + test() + { + POINT_T pt = {1, 2}; + bar_ExpectAndReturn(&pt); + foo_Expect(NULL); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we did not expect nulls to pointers but got null' + :code: | + test() + { + POINT_T ex = {1, 2}; + bar_ExpectAndReturn(NULL); + foo_Expect(&ex); + + function_a(); + } + + - :pass: TRUE + :should: 'handle the situation where it falls back to pointers because you asked it to compare 0 elements' + :code: | + test() + { + POINT_T ex = {1, 2}; + bar_ExpectAndReturn(&ex); + foo_ExpectWithArray(&ex, 0); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where it fails because you asked it to compare zero elements and the pointers do not match' + :code: | + test() + { + POINT_T ex = {1, 2}; + POINT_T pt = {1, 2}; + bar_ExpectAndReturn(&pt); + foo_ExpectWithArray(&ex, 0); + + function_a(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass single object with expect' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 2}; + bar_ExpectAndReturn(&pt); + foo_Expect(&ex); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass single object with expect and it is wrong' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 3}; + bar_ExpectAndReturn(&pt); + foo_Expect(&ex); + + function_a(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass single object with expect and use array handler' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 2}; + bar_ExpectAndReturn(&pt); + foo_ExpectWithArray(&ex, 1); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass single object with expect and use array handler and it is wrong' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 3}; + bar_ExpectAndReturn(&pt); + foo_ExpectWithArray(&ex, 1); + + function_a(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass multiple objects with expect and use array handler' + :code: | + test() + { + POINT_T pt[] = {{1, 2}, {3, 4}, {5, 6}}; + POINT_T ex[] = {{1, 2}, {3, 4}, {5, 6}}; + bar_ExpectAndReturn(pt); + foo_ExpectWithArray(ex, 3); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass multiple objects with expect and use array handler and it is wrong at start' + :code: | + test() + { + POINT_T pt[] = {{1, 2}, {3, 4}, {5, 6}}; + POINT_T ex[] = {{9, 2}, {3, 4}, {5, 6}}; + bar_ExpectAndReturn(pt); + foo_ExpectWithArray(ex, 3); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass multiple objects with expect and use array handler and it is wrong at end' + :code: | + test() + { + POINT_T pt[] = {{1, 2}, {3, 4}, {5, 6}}; + POINT_T ex[] = {{1, 2}, {3, 4}, {5, 9}}; + bar_ExpectAndReturn(pt); + foo_ExpectWithArray(ex, 3); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass multiple objects with expect and use array handler and it is wrong in middle' + :code: | + test() + { + POINT_T pt[] = {{1, 2}, {3, 4}, {5, 6}}; + POINT_T ex[] = {{1, 2}, {3, 9}, {5, 6}}; + bar_ExpectAndReturn(pt); + foo_ExpectWithArray(ex, 3); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass nulls to pointers and fail' + :code: | + test() + { + POINT_T pt = {1, 2}; + bar_ExpectAndReturn(&pt); + foo_Expect(NULL); + + function_a(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass nulls to arrays' + :code: | + test() + { + bar_ExpectAndReturn(NULL); + fooa_Expect(NULL); + + function_b(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass single array element with expect' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 2}; + bar_ExpectAndReturn(&pt); + fooa_Expect(&ex); + + function_b(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass single array element with expect and it is wrong' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 3}; + bar_ExpectAndReturn(&pt); + fooa_Expect(&ex); + + function_b(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass nulls to arrays and fail' + :code: | + test() + { + POINT_T pt = {1, 2}; + bar_ExpectAndReturn(&pt); + fooa_Expect(NULL); + + function_b(); + } + + - :pass: TRUE + :should: 'handle standard c string as null terminated on not do crappy memory compares of a byte, passing' + :code: | + test() + { + bars_ExpectAndReturn("This is a\0 silly string"); + foos_Expect("This is a\0 wacky string"); + + function_c(); + } + + - :pass: FALSE + :should: 'handle standard c string as null terminated on not do crappy memory compares of a byte, finding failures' + :code: | + test() + { + bars_ExpectAndReturn("This is a silly string"); + foos_Expect("This is a wacky string"); + + function_c(); + } + + - :pass: TRUE + :should: 'handle creating array expects when we have mixed arguments for single object' + :code: | + test() + { + int expect_list[] = { 1, 9 }; + no_pointers_Expect(1, "silly"); + mixed_ExpectAndReturn(6, expect_list, 7, 13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: FALSE + :should: 'handle creating array expects when we have mixed arguments and handle failures for single object' + :code: | + test() + { + int expect_list[] = { 9, 1 }; + no_pointers_Expect(1, "silly"); + mixed_ExpectAndReturn(6, expect_list, 7, 13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: TRUE + :should: 'handle creating array expects when we have mixed arguments for multiple objects' + :code: | + test() + { + int expect_list[] = { 1, 2, 3, 4, 6 }; + no_pointers_Expect(1, "silly"); + mixed_ExpectWithArrayAndReturn(6, expect_list, 4, 7, 13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: FALSE + :should: 'handle creating array expects when we have mixed arguments and handle failures for multiple objects' + :code: | + test() + { + int expect_list[] = { 1, 2, 3, 4, 6 }; + no_pointers_Expect(1, "silly"); + mixed_ExpectWithArrayAndReturn(6, expect_list, 5, 7, 13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: TRUE + :should: 'handle a passing version of a potential packing problem (particularly try with ARM simulators)' + :code: | + test() + { + short expect_list[] = { -2, -3, -4 }; + potential_packing_problem_ExpectWithArray(expect_list, 3); + + function_e(); + } + + - :pass: FALSE + :should: 'handle a failing version of a potential packing problem (particularly try with ARM simulators)' + :code: | + test() + { + short expect_list[] = { -2, -3, 4 }; + potential_packing_problem_ExpectWithArray(expect_list, 3); + + function_e(); + } + + +... diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/basic_expect_and_return.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/basic_expect_and_return.yml new file mode 100644 index 0000000..ecd6b2c --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/basic_expect_and_return.yml @@ -0,0 +1,123 @@ +--- +:cmock: + :plugins: + - # none + +:systest: + :types: | + #define UINT32 unsigned int + + typedef signed int custom_type; + + :mockable: | + UINT32 foo(custom_type a); + UINT32 bar(custom_type b); + UINT32 foo_varargs(custom_type a, ...); + char* foo_char_strings(char a[], char* b); + + :source: + :header: | + UINT32 function_a(int a, int b); + void function_b(void); + UINT32 function_c(int a); + char* function_d(char a[], char* b); + + :code: | + UINT32 function_a(int a, int b) + { + return foo((custom_type)a) + bar((custom_type)b); + } + + void function_b(void) { } + + UINT32 function_c(int a) + { + return foo_varargs((custom_type)a, "ignored", 5); + } + + char* function_d(char a[], char* b) + { + return foo_char_strings(a, b); + } + + :tests: + :common: | + void setUp(void) {} + void tearDown(void) {} + + :units: + - :pass: TRUE + :should: 'successfully exercise two simple ExpectAndReturn mock calls' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + bar_ExpectAndReturn((custom_type)2, 20); + TEST_ASSERT_EQUAL(30, function_a(1, 2)); + } + + - :pass: FALSE + :should: 'fail because bar() is not called but is expected' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + TEST_ASSERT_EQUAL(30, function_a(1, 2)); + } + + - :pass: FALSE + :should: 'fail because bar() is called but is not expected' + :code: | + test() + { + bar_ExpectAndReturn((custom_type)1, 10); + function_b(); + } + + - :pass: TRUE + :should: 'consume var args passed to mocked function' + :code: | + test() + { + foo_varargs_ExpectAndReturn((custom_type)3, 10); + TEST_ASSERT_EQUAL(10, function_c(3)); + } + + - :pass: TRUE + :should: 'handle char strings' + :code: | + test() + { + foo_char_strings_ExpectAndReturn("larry", "curly", "moe"); + TEST_ASSERT_EQUAL_STRING("moe", function_d("larry", "curly")); + } + + - :pass: TRUE + :should: 'successfully exercise multiple cycles of expecting and mocking and pass' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + bar_ExpectAndReturn((custom_type)2, 20); + TEST_ASSERT_EQUAL(30, function_a(1, 2)); + + foo_ExpectAndReturn((custom_type)3, 30); + bar_ExpectAndReturn((custom_type)4, 40); + TEST_ASSERT_EQUAL(70, function_a(3, 4)); + } + + - :pass: FALSE + :should: 'successfully exercise multiple cycles of expecting and mocking and fail' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + bar_ExpectAndReturn((custom_type)2, 20); + TEST_ASSERT_EQUAL(30, function_a(1, 2)); + + foo_ExpectAndReturn((custom_type)3, 30); + bar_ExpectAndReturn((custom_type)4, 40); + TEST_ASSERT_EQUAL(70, function_a(3, 5)); + } + +... diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/const_primitives_handling.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/const_primitives_handling.yml new file mode 100644 index 0000000..2fc1b21 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/const_primitives_handling.yml @@ -0,0 +1,87 @@ +--- +:cmock: + :plugins: + - # none + +:systest: + :types: | + + :mockable: | + // no argument names + void foo(char const*, char* const, const char*); + + // argument names + void bar(char const* param1, char* const param2, const char* param3); + + :source: + :header: | + void exercise_const1(char const* param1, char* const param2, const char* param3); + void exercise_const2(char const* param1, char* const param2, const char* param3); + + :code: | + char value1 = '1'; + char value2 = '2'; + + const char* A = &value1; + char* const B = &value2; + const char* C = "C"; + const char* D = "D"; + + void exercise_const1(char const* param1, char* const param2, const char* param3) + { + foo(param1, param2, param3); + } + + void exercise_const2(char const* param1, char* const param2, const char* param3) + { + bar(param1, param2, param3); + } + + :tests: + :common: | + extern const char* A; + extern char* const B; + extern const char* C; + extern const char* D; + + void setUp(void) {} + void tearDown(void) {} + :units: + - :pass: TRUE + :should: 'successfully pass several const parameters' + :code: | + test() + { + foo_Expect( A, B, C ); + exercise_const1( A, B, C ); + } + + - :pass: FALSE + :should: 'should fail upon wrong const arguments passed' + :code: | + test() + { + foo_Expect( A, B, C ); + exercise_const1( (const char*)B, (char * const)A, C ); + } + + - :pass: FALSE + :should: 'should fail upon wrong const arguments passed' + :code: | + test() + { + foo_Expect( A, B, C ); + exercise_const1( A, B, D ); + } + + - :pass: FALSE + :should: 'should fail upon wrong const arguments passed' + :code: | + test() + { + bar_Expect( A, B, C ); + exercise_const2( A, (char * const)C, (const char *)B ); + } + + +... diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/enforce_strict_ordering.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/enforce_strict_ordering.yml new file mode 100644 index 0000000..61e2999 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/enforce_strict_ordering.yml @@ -0,0 +1,247 @@ +--- +:cmock: + :enforce_strict_ordering: 1 + :plugins: + - :ignore + - :cexception + +:systest: + :types: | + #define UINT32 unsigned int + + typedef signed int custom_type; + + :mockable: | + #include "CException.h" + UINT32 foo(custom_type a); + UINT32 bar(custom_type b); + void baz(custom_type c); + + :source: + :header: | + #include "CException.h" + UINT32 function_a(int a, int b); + void function_b(void); + void function_c(void); + void function_d(void); + + :code: | + UINT32 function_a(int a, int b) + { + return foo((custom_type)a) + bar((custom_type)b); + } + + void function_b(void) + { + baz((custom_type)1); + foo((custom_type)2); + bar((custom_type)3); + baz((custom_type)4); + foo((custom_type)5); + bar((custom_type)6); + baz((custom_type)7); + } + + void function_c(void) + { + foo((custom_type)1); + foo((custom_type)2); + bar((custom_type)3); + bar((custom_type)4); + foo((custom_type)5); + } + + void function_d(void) + { + CEXCEPTION_T e; + Try + { + foo((custom_type)1); + } + Catch(e) {} + Try + { + bar((custom_type)2); + } + Catch(e) {} + Try + { + foo((custom_type)3); + } + Catch(e) {} + } + + :tests: + :common: | + #include "CException.h" + void setUp(void) {} + void tearDown(void) {} + + :units: + - :pass: TRUE + :should: 'successfully exercise two simple ExpectAndReturn mock calls' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + bar_ExpectAndReturn((custom_type)2, 20); + TEST_ASSERT_EQUAL(30, function_a(1, 2)); + } + + - :pass: FALSE + :should: 'fail because bar() is called but is not expected' + :verify_error: 'called more times than expected' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + TEST_ASSERT_EQUAL(30, function_a(1, 2)); + } + + - :pass: FALSE + :should: 'fail because bar() is called twice but is expected once' + :verify_error: 'called less times than expected' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + bar_ExpectAndReturn((custom_type)2, 20); + bar_ExpectAndReturn((custom_type)3, 30); + TEST_ASSERT_EQUAL(30, function_a(1, 2)); + } + + - :pass: FALSE + :should: 'fail because bar and foo called in reverse order' + :verify_error: 'called earlier than expected' + :code: | + test() + { + bar_ExpectAndReturn((custom_type)2, 20); + foo_ExpectAndReturn((custom_type)1, 10); + TEST_ASSERT_EQUAL(30, function_a(1, 2)); + } + + - :pass: TRUE + :should: 'pass because bar and foo called in order with multiple params' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + foo_ExpectAndReturn((custom_type)2, 10); + bar_ExpectAndReturn((custom_type)3, 20); + bar_ExpectAndReturn((custom_type)4, 10); + foo_ExpectAndReturn((custom_type)5, 10); + function_c(); + } + + - :pass: FALSE + :should: 'fail because bar and foo called out of order at end' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + foo_ExpectAndReturn((custom_type)2, 10); + bar_ExpectAndReturn((custom_type)3, 20); + foo_ExpectAndReturn((custom_type)5, 10); + bar_ExpectAndReturn((custom_type)4, 10); + function_c(); + } + + - :pass: FALSE + :should: 'fail because bar and foo called out of order at start' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)2, 10); + foo_ExpectAndReturn((custom_type)1, 10); + bar_ExpectAndReturn((custom_type)3, 20); + bar_ExpectAndReturn((custom_type)4, 10); + foo_ExpectAndReturn((custom_type)5, 10); + function_c(); + } + + - :pass: TRUE + :should: 'pass because we are properly ignoring baz' + :code: | + test() + { + baz_Ignore(); + foo_ExpectAndReturn((custom_type)2, 10); + bar_ExpectAndReturn((custom_type)3, 20); + foo_ExpectAndReturn((custom_type)5, 10); + bar_ExpectAndReturn((custom_type)6, 10); + function_b(); + } + + - :pass: FALSE + :should: 'fail because bar and foo out of order, even though baz is ignored' + :code: | + test() + { + baz_Ignore(); + foo_ExpectAndReturn((custom_type)2, 10); + foo_ExpectAndReturn((custom_type)5, 10); + bar_ExpectAndReturn((custom_type)3, 20); + bar_ExpectAndReturn((custom_type)6, 10); + function_b(); + } + + - :pass: TRUE + :should: 'pass when using cexception, as long as the order is right' + :code: | + test() + { + foo_ExpectAndThrow((custom_type)1, 10); + bar_ExpectAndReturn((custom_type)2, 20); + foo_ExpectAndReturn((custom_type)3, 10); + function_d(); + } + + - :pass: FALSE + :should: 'fail when an throw call is made out of order' + :code: | + test() + { + bar_ExpectAndReturn((custom_type)2, 20); + foo_ExpectAndThrow((custom_type)1, 10); + foo_ExpectAndReturn((custom_type)3, 10); + function_d(); + } + + - :pass: TRUE + :should: 'successfully handle back to back ExpectAndReturn setup and mock calls' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + bar_ExpectAndReturn((custom_type)2, 20); + TEST_ASSERT_EQUAL(30, function_a(1, 2)); + + foo_ExpectAndReturn((custom_type)3, 30); + bar_ExpectAndReturn((custom_type)4, 40); + TEST_ASSERT_EQUAL(70, function_a(3, 4)); + + foo_ExpectAndReturn((custom_type)1, 50); + bar_ExpectAndReturn((custom_type)9, 60); + TEST_ASSERT_EQUAL(110, function_a(1, 9)); + } + + - :pass: FALSE + :should: 'successfully catch errors during back to back ExpectAndReturn setup and mock calls' + :verify_error: 'called earlier than expected' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + bar_ExpectAndReturn((custom_type)2, 20); + TEST_ASSERT_EQUAL(30, function_a(1, 2)); + + foo_ExpectAndReturn((custom_type)3, 30); + bar_ExpectAndReturn((custom_type)4, 40); + TEST_ASSERT_EQUAL(70, function_a(3, 4)); + + bar_ExpectAndReturn((custom_type)9, 60); + foo_ExpectAndReturn((custom_type)1, 50); + TEST_ASSERT_EQUAL(110, function_a(1, 9)); + } +... diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/expect_and_return_custom_types.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/expect_and_return_custom_types.yml new file mode 100644 index 0000000..f5b13a3 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/expect_and_return_custom_types.yml @@ -0,0 +1,108 @@ +--- +:cmock: + :plugins: + - # none + :memcmp_if_unknown: false + +:systest: + :types: | + typedef struct _EXAMPLE_STRUCT_T { int x; int y; } EXAMPLE_STRUCT_T; + + :mockable: | + EXAMPLE_STRUCT_T foo(EXAMPLE_STRUCT_T a); + + :source: + :header: | + EXAMPLE_STRUCT_T function_a(EXAMPLE_STRUCT_T a, EXAMPLE_STRUCT_T b); + EXAMPLE_STRUCT_T function_b(EXAMPLE_STRUCT_T a, EXAMPLE_STRUCT_T b); + + :code: | + EXAMPLE_STRUCT_T function_a(EXAMPLE_STRUCT_T a, EXAMPLE_STRUCT_T b) + { + EXAMPLE_STRUCT_T retval = foo(a); + retval.x += b.x; + retval.y += b.y; + return retval; + } + + EXAMPLE_STRUCT_T function_b(EXAMPLE_STRUCT_T a, EXAMPLE_STRUCT_T b) + { + EXAMPLE_STRUCT_T retval = foo(b); + retval.x *= a.x; + retval.y *= a.y; + return retval; + } + + :tests: + :common: | + #include "expect_and_return_custom_types_unity_helper.h" + void setUp(void) {} + void tearDown(void) {} + + :units: + - :pass: TRUE + :should: 'successfully exercise simple ExpectAndReturn mock calls' + :code: | + test() + { + EXAMPLE_STRUCT_T c = {1,2}; + EXAMPLE_STRUCT_T d = {3,4}; + EXAMPLE_STRUCT_T e = {2,4}; + EXAMPLE_STRUCT_T f = {5,8}; + foo_ExpectAndReturn(c, e); + TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(f, function_a(c,d)); + } + + - :pass: FALSE + :should: 'fail because it is expecting to call foo with c not d' + :code: | + test() + { + EXAMPLE_STRUCT_T c = {1,2}; + EXAMPLE_STRUCT_T d = {3,4}; + EXAMPLE_STRUCT_T e = {2,4}; + EXAMPLE_STRUCT_T f = {5,8}; + foo_ExpectAndReturn(d, e); + TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(f, function_a(c,d)); + } + + - :pass: TRUE + :should: 'successfully exercise simple ExpectAndReturn mock calls on other function' + :code: | + test() + { + EXAMPLE_STRUCT_T c = {1,2}; + EXAMPLE_STRUCT_T d = {3,4}; + EXAMPLE_STRUCT_T e = {2,4}; + EXAMPLE_STRUCT_T f = {2,8}; + foo_ExpectAndReturn(d, e); + TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(f, function_b(c,d)); + } + + - :pass: FALSE + :should: 'fail because it is expecting to call foo with d not c' + :code: | + test() + { + EXAMPLE_STRUCT_T c = {1,2}; + EXAMPLE_STRUCT_T d = {3,4}; + EXAMPLE_STRUCT_T e = {2,4}; + EXAMPLE_STRUCT_T f = {2,8}; + foo_ExpectAndReturn(c, e); + TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(f, function_b(c,d)); + } + + :unity_helper: + :header: | + void AssertEqualExampleStruct(EXAMPLE_STRUCT_T expected, EXAMPLE_STRUCT_T actual, unsigned short line); + #define UNITY_TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(expected, actual, line, message) {AssertEqualExampleStruct(expected, actual, line);} + #define TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(expected, actual) UNITY_TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(expected, actual, __LINE__, NULL); + + :code: | + void AssertEqualExampleStruct(EXAMPLE_STRUCT_T expected, EXAMPLE_STRUCT_T actual, unsigned short line) + { + UNITY_TEST_ASSERT_EQUAL_INT(expected.x, actual.x, line, "Example Struct Failed For Field x"); + UNITY_TEST_ASSERT_EQUAL_INT(expected.y, actual.y, line, "Example Struct Failed For Field y"); + } + +... diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/expect_and_return_treat_as.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/expect_and_return_treat_as.yml new file mode 100644 index 0000000..2a73273 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/expect_and_return_treat_as.yml @@ -0,0 +1,173 @@ +--- +:cmock: + :plugins: + - # none + :treat_as: + MY_STRING: STRING + MY_INT: INT + PTR_INT: INT* + MY_HEX: HEX32 + +:systest: + :types: | + typedef char* MY_STRING; + typedef int MY_INT; + typedef unsigned int MY_HEX; + typedef int* PTR_INT; + + :mockable: | + MY_INT foo(MY_HEX a); + MY_INT bar(MY_HEX b); + MY_STRING foo_char_strings(MY_STRING a, MY_STRING b); + float float_adder(float a, float b); + MY_INT* pointer_foo(MY_HEX* a); + void pointer_bar(PTR_INT a); + + :source: + :header: | + MY_INT function_a(MY_INT a, MY_INT b); + MY_STRING function_b(MY_STRING a, MY_STRING b); + float function_c(float a, float b); + MY_INT function_d(MY_HEX a); + void function_e(PTR_INT a); + + :code: | + MY_INT function_a(MY_INT a, MY_INT b) + { + return foo((MY_HEX)a) + bar((MY_HEX)b); + } + + MY_STRING function_b(MY_STRING a, MY_STRING b) + { + return foo_char_strings(a, b); + } + + float function_c(float a, float b) + { + return float_adder(b, a); + } + + MY_INT function_d(MY_HEX a) + { + MY_HEX b = a; + MY_INT* c = pointer_foo(&b); + return *c; + } + + void function_e(PTR_INT a) + { + pointer_bar(a); + } + + :tests: + :common: | + void setUp(void) {} + void tearDown(void) {} + + :units: + - :pass: TRUE + :should: 'successfully exercise two simple ExpectAndReturn mock calls' + :code: | + test() + { + foo_ExpectAndReturn((MY_HEX)1, 10); + bar_ExpectAndReturn((MY_HEX)2, 20); + TEST_ASSERT_EQUAL(30, function_a(1, 2)); + } + + - :pass: FALSE + :should: 'fail because bar() is expected but not called' + :code: | + test() + { + foo_ExpectAndReturn((MY_HEX)1, 10); + TEST_ASSERT_EQUAL(30, function_a(1, 2)); + } + + - :pass: FALSE + :should: 'fail because foo_char_strings() is called but is not expected' + :code: | + test() + { + foo_char_strings_ExpectAndReturn((MY_STRING)"jello", (MY_STRING)"jiggle", (MY_STRING)"boing!"); + function_a(1,2); + } + + - :pass: TRUE + :should: 'handle char strings' + :code: | + test() + { + foo_char_strings_ExpectAndReturn((MY_STRING)"jello", (MY_STRING)"jiggle", (MY_STRING)"boing!"); + TEST_ASSERT_EQUAL_STRING("boing!", function_b((MY_STRING)"jello", (MY_STRING)"jiggle")); + } + + - :pass: TRUE + :should: 'handle floating point numbers with Unity support: pass' + :code: | + test() + { + float_adder_ExpectAndReturn(1.2345, 6.7890, 8.0235); + TEST_ASSERT_EQUAL_FLOAT(8.0235, function_c(6.7890, 1.2345)); + } + + - :pass: FALSE + :should: 'handle floating point numbers with Unity support: fail' + :code: | + test() + { + float_adder_ExpectAndReturn(1.2345, 6.7892, 8.0235); + TEST_ASSERT_EQUAL_FLOAT(8.0235, function_c(6.7890, 1.2345)); + } + + - :pass: TRUE + :should: 'handle pointers to treat_as values just as cleanly as the treat_as itself for passes' + :code: | + test() + { + MY_HEX TestHex = (MY_HEX)45; + MY_INT TestInt = (MY_INT)33; + pointer_foo_ExpectAndReturn(&TestHex, &TestInt); + TEST_ASSERT_EQUAL_INT(33, function_d(45)); + } + + - :pass: FALSE + :should: 'handle pointers to treat_as values just as cleanly as the treat_as itself for failures' + :verify_error: 'Element 0 Expected 0x0000002D Was 0x0000002B' + :code: | + test() + { + MY_HEX TestHex = (MY_HEX)45; + MY_INT TestInt = (MY_INT)33; + pointer_foo_ExpectAndReturn(&TestHex, &TestInt); + TEST_ASSERT_EQUAL_INT(33, function_d(43)); + } + + - :pass: TRUE + :should: 'handle treat_as values containing pointers for passes' + :code: | + test() + { + MY_INT ExpInt = (MY_INT)33; + PTR_INT ExpPtr = (PTR_INT)(&ExpInt); + MY_INT ActInt = (MY_INT)33; + PTR_INT ActPtr = (PTR_INT)(&ActInt); + pointer_bar_Expect(ExpPtr); + function_e(ActPtr); + } + + - :pass: FALSE + :should: 'handle treat_as values containing pointers for failures' + :verify_error: 'Element 0 Expected 33 Was 45' + :code: | + test() + { + MY_INT ExpInt = (MY_INT)33; + PTR_INT ExpPtr = (PTR_INT)(&ExpInt); + MY_INT ActInt = (MY_INT)45; + PTR_INT ActPtr = (PTR_INT)(&ActInt); + pointer_bar_Expect(ExpPtr); + function_e(ActPtr); + } + +... diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/expect_and_throw.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/expect_and_throw.yml new file mode 100644 index 0000000..c22524c --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/expect_and_throw.yml @@ -0,0 +1,170 @@ +--- +:cmock: + :plugins: + - :cexception + +:systest: + :types: | + #define UINT32 unsigned int + typedef signed int custom_type; + + :mockable: | + #include "CException.h" + UINT32 foo(custom_type a); + UINT32 bar(custom_type b); + UINT32 foo_varargs(custom_type a, ...); + + :source: + :header: | + #include "CException.h" + UINT32 function_a(int a); + void function_b(char a); + + :code: | + UINT32 function_a(int a) + { + UINT32 r = 0; + CEXCEPTION_T e; + + Try + { + r = (UINT32)foo((custom_type)a); + } + Catch(e) + { + r = (UINT32)e*2; + } + return r; + } + + void function_b(char a) + { + if (a) + { + Throw((CEXCEPTION_T)a); + } + } + + :tests: + :common: | + #include "CException.h" + void setUp(void) {} + void tearDown(void) {} + + :units: + - :pass: TRUE + :should: 'successfully exercise a simple ExpectAndReturn mock calls' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + TEST_ASSERT_EQUAL(10, function_a(1)); + } + + - :pass: TRUE + :should: 'successfully throw an error on first call' + :code: | + test() + { + foo_ExpectAndThrow((custom_type)1, 55); + TEST_ASSERT_EQUAL(110, function_a(1)); + } + + - :pass: TRUE + :should: 'successfully throw an error on later calls' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + foo_ExpectAndReturn((custom_type)2, 20); + foo_ExpectAndThrow((custom_type)3, 15); + foo_ExpectAndReturn((custom_type)4, 40); + TEST_ASSERT_EQUAL(10, function_a(1)); + TEST_ASSERT_EQUAL(20, function_a(2)); + TEST_ASSERT_EQUAL(30, function_a(3)); + TEST_ASSERT_EQUAL(40, function_a(4)); + } + + - :pass: TRUE + :should: 'pass because we nothing happens' + :code: | + test() + { + function_b(0); + } + + - :pass: FALSE + :should: 'fail because we did not expect function B to throw' + :code: | + test() + { + function_b(1); + } + + - :pass: TRUE + :should: 'fail because we expect function B to throw' + :code: | + test() + { + CEXCEPTION_T e; + Try + { + function_b(3); + TEST_FAIL_MESSAGE("Should Have Thrown"); + } + Catch(e) + { + TEST_ASSERT_EQUAL(3, e); + } + } + + - :pass: TRUE + :should: 'successfully throw an error on consecutive calls' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + foo_ExpectAndReturn((custom_type)1, 20); + foo_ExpectAndThrow((custom_type)1, 15); + foo_ExpectAndThrow((custom_type)3, 40); + TEST_ASSERT_EQUAL(10, function_a(1)); + TEST_ASSERT_EQUAL(20, function_a(1)); + TEST_ASSERT_EQUAL(30, function_a(1)); + TEST_ASSERT_EQUAL(80, function_a(3)); + } + + - :pass: TRUE + :should: 'successfully throw an error on later calls and after a previous mock call' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + foo_ExpectAndReturn((custom_type)1, 20); + foo_ExpectAndThrow((custom_type)1, 15); + TEST_ASSERT_EQUAL(10, function_a(1)); + TEST_ASSERT_EQUAL(20, function_a(1)); + TEST_ASSERT_EQUAL(30, function_a(1)); + + foo_ExpectAndReturn((custom_type)2, 20); + foo_ExpectAndThrow((custom_type)3, 40); + TEST_ASSERT_EQUAL(20, function_a(2)); + TEST_ASSERT_EQUAL(80, function_a(3)); + } + + - :pass: TRUE + :should: 'successfully throw an error if expects and mocks called before it' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + foo_ExpectAndReturn((custom_type)1, 20); + TEST_ASSERT_EQUAL(10, function_a(1)); + TEST_ASSERT_EQUAL(20, function_a(1)); + + foo_ExpectAndReturn((custom_type)2, 20); + foo_ExpectAndThrow((custom_type)3, 40); + TEST_ASSERT_EQUAL(20, function_a(2)); + TEST_ASSERT_EQUAL(80, function_a(3)); + } + +... diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/fancy_pointer_handling.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/fancy_pointer_handling.yml new file mode 100644 index 0000000..e6e75e5 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/fancy_pointer_handling.yml @@ -0,0 +1,208 @@ +--- +:cmock: + :plugins: + - # none + :treat_as: + INT_PTR: INT* + +:systest: + :types: | + typedef struct _POINT_T { + int x; + int y; + } POINT_T; + typedef int* INT_PTR; + + :mockable: | + void foo(POINT_T* a); + POINT_T* bar(void); + void fooa(POINT_T a[]); + void foos(const char *a); + const char* bars(void); + INT_PTR zoink(INT_PTR a); + + :source: + :header: | + void function_a(void); + void function_b(void); + void function_c(void); + int function_d(void); + + :code: | + void function_a(void) + { + foo(bar()); + } + + void function_b(void) { + fooa(bar()); + } + + void function_c(void) { + foos(bars()); + } + + int function_d(void) { + int i = 456; + INT_PTR ptr = (INT_PTR)(&i); + return (int)(*(zoink(ptr))); + } + + :tests: + :common: | + void setUp(void) {} + void tearDown(void) {} + + :units: + - :pass: TRUE + :should: 'handle the situation where we pass nulls to pointers' + :code: | + test() + { + bar_ExpectAndReturn(NULL); + foo_Expect(NULL); + + function_a(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass single object with expect' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 2}; + bar_ExpectAndReturn(&pt); + foo_Expect(&ex); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass single object with expect and it is wrong' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 3}; + bar_ExpectAndReturn(&pt); + foo_Expect(&ex); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass nulls to pointers and fail' + :code: | + test() + { + POINT_T pt = {1, 2}; + bar_ExpectAndReturn(&pt); + foo_Expect(NULL); + + function_a(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass nulls to arrays' + :code: | + test() + { + bar_ExpectAndReturn(NULL); + fooa_Expect(NULL); + + function_b(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass single array element with expect' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 2}; + bar_ExpectAndReturn(&pt); + fooa_Expect(&ex); + + function_b(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass single array element with expect and it is wrong' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 3}; + bar_ExpectAndReturn(&pt); + fooa_Expect(&ex); + + function_b(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass nulls to arrays and fail' + :code: | + test() + { + POINT_T pt = {1, 2}; + bar_ExpectAndReturn(&pt); + fooa_Expect(NULL); + + function_b(); + } + + - :pass: TRUE + :should: 'handle standard c string as null terminated on not do crappy memory compares of a byte, passing' + :code: | + test() + { + bars_ExpectAndReturn("This is a\0 silly string"); + foos_Expect("This is a\0 wacky string"); + + function_c(); + } + + - :pass: FALSE + :should: 'handle standard c string as null terminated on not do crappy memory compares of a byte, finding failures' + :code: | + test() + { + bars_ExpectAndReturn("This is a silly string"); + foos_Expect("This is a wacky string"); + + function_c(); + } + + - :pass: TRUE + :should: 'handle handle typedefs that ARE pointers by using treat_as' + :code: | + test() + { + int e = 456; + int r = 789; + INT_PTR ptr_e = (INT_PTR)(&e); + INT_PTR ptr_r = (INT_PTR)(&r); + + zoink_ExpectAndReturn(ptr_e, ptr_r); + + TEST_ASSERT_EQUAL(r, function_d()); + } + + - :pass: FALSE + :should: 'handle handle typedefs that ARE pointers by using treat_as and catch failures' + :code: | + test() + { + int e = 457; + int r = 789; + INT_PTR ptr_e = (INT_PTR)(&e); + INT_PTR ptr_r = (INT_PTR)(&r); + + zoink_ExpectAndReturn(ptr_e, ptr_r); + + TEST_ASSERT_EQUAL(r, function_d()); + } + + +... diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/function_pointer_handling.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/function_pointer_handling.yml new file mode 100644 index 0000000..9462bdd --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/function_pointer_handling.yml @@ -0,0 +1,82 @@ +--- +:cmock: + :plugins: + - # none + :treat_as: + FUNCTION_T: PTR + +:systest: + :types: | + typedef void (*FUNCTION_T)(void); + + :mockable: | + void takes_function_type( FUNCTION_T myfunc ); + void takes_function_ptr( unsigned int (*func_ptr)(int, char) ); + void takes_const_function_ptr( unsigned int (* const)(int, char) ); + unsigned short (*returns_function_ptr( const char op_code ))( int, long int ); + + :source: + :header: | + void exercise_function_pointer_param(void); + unsigned short (*exercise_function_pointer_return( const char op_code ))( int, long int ); + + // functions for function pointer tests + unsigned int dummy_function1(int a, char b); + unsigned short dummy_function2(int a, long int b); + + :code: | + /* + * functions used in tests + */ + + unsigned int dummy_function1(int a, char b) + { + // prevent compiler warnings by using everything + return (unsigned int)a + (unsigned int)b; + } + + unsigned short dummy_function2(int a, long int b) + { + // prevent compiler warnings by using everything + return (unsigned short)a + (unsigned short)b; + } + + /* + * functions executed by tests + */ + + void exercise_function_pointer_param(void) + { + takes_function_ptr(dummy_function1); + } + + unsigned short (*exercise_function_pointer_return( const char op_code ))( int, long int ) + { + return returns_function_ptr(op_code); + } + + :tests: + :common: | + void setUp(void) {} + void tearDown(void) {} + :units: + - :pass: TRUE + :should: 'expect a function pointer param' + :code: | + test() + { + takes_function_ptr_Expect(dummy_function1); + exercise_function_pointer_param(); + } + + - :pass: TRUE + :should: 'return a function pointer' + :code: | + test() + { + returns_function_ptr_ExpectAndReturn('z', dummy_function2); + TEST_ASSERT_EQUAL_PTR(dummy_function2, exercise_function_pointer_return('z')); + } + + +... diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/ignore_and_return.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/ignore_and_return.yml new file mode 100644 index 0000000..281efd0 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/ignore_and_return.yml @@ -0,0 +1,153 @@ +--- +:cmock: + :plugins: + - 'ignore' + +:systest: + :types: | + + :mockable: | + int foo(int a); + void bar(int b); + + :source: + :header: | + int function(int a, int b, int c); + :code: | + int function(int a, int b, int c) + { + bar(b); + return foo(a) + foo(b) + foo(c); + } + + :tests: + :common: | + void setUp(void) {} + void tearDown(void) {} + :units: + - :pass: TRUE + :should: 'successfully exercise simple ExpectAndReturn mock calls' + :code: | + test() + { + bar_Expect(2); + foo_ExpectAndReturn(1, 10); + foo_ExpectAndReturn(2, 20); + foo_ExpectAndReturn(3, 30); + TEST_ASSERT_EQUAL(60, function(1, 2, 3)); + } + + - :pass: TRUE + :should: 'ignore foo() calls' + :code: | + test() + { + bar_Expect(4); + foo_IgnoreAndReturn(10); + foo_IgnoreAndReturn(40); + foo_IgnoreAndReturn(80); + TEST_ASSERT_EQUAL(130, function(3, 4, 3)); + } + + - :pass: TRUE + :should: 'ignore foo() calls and always return last item if we run out' + :code: | + test() + { + bar_Expect(4); + foo_IgnoreAndReturn(20); + foo_IgnoreAndReturn(30); + TEST_ASSERT_EQUAL(80, function(3, 4, 9)); + } + + - :pass: TRUE + :should: 'ignore foo() calls and always return only item if only one specified' + :code: | + test() + { + bar_Expect(4); + foo_IgnoreAndReturn(20); + TEST_ASSERT_EQUAL(60, function(3, 4, 9)); + } + + - :pass: TRUE + :should: 'ignore bar() and foo() calls' + :code: | + test() + { + bar_Ignore(); + foo_IgnoreAndReturn(50); + TEST_ASSERT_EQUAL(150, function(0, 0, 0)); + } + + - :pass: TRUE + :should: 'ignore foo() calls over multiple mock calls' + :code: | + test() + { + bar_Ignore(); + foo_IgnoreAndReturn(50); + foo_IgnoreAndReturn(60); + foo_IgnoreAndReturn(70); + TEST_ASSERT_EQUAL(180, function(0, 0, 0)); + + bar_Ignore(); + foo_IgnoreAndReturn(30); + foo_IgnoreAndReturn(80); + foo_IgnoreAndReturn(10); + TEST_ASSERT_EQUAL(120, function(0, 0, 0)); + + foo_IgnoreAndReturn(70); + foo_IgnoreAndReturn(20); + TEST_ASSERT_EQUAL(110, function(0, 0, 0)); + } + + - :pass: TRUE + :should: 'multiple cycles of expects still pass when ignores enabled' + :code: | + test() + { + bar_Expect(2); + foo_ExpectAndReturn(1, 50); + foo_ExpectAndReturn(2, 60); + foo_ExpectAndReturn(3, 70); + TEST_ASSERT_EQUAL(180, function(1, 2, 3)); + + bar_Expect(5); + foo_ExpectAndReturn(4, 30); + foo_ExpectAndReturn(5, 80); + foo_ExpectAndReturn(6, 10); + TEST_ASSERT_EQUAL(120, function(4, 5, 6)); + + bar_Expect(8); + foo_ExpectAndReturn(7, 70); + foo_ExpectAndReturn(8, 20); + foo_ExpectAndReturn(9, 20); + TEST_ASSERT_EQUAL(110, function(7, 8, 9)); + } + + - :pass: FALSE + :should: 'multiple cycles of expects still fail when ignores enabled' + :code: | + test() + { + bar_Expect(2); + foo_ExpectAndReturn(1, 50); + foo_ExpectAndReturn(2, 60); + foo_ExpectAndReturn(3, 70); + TEST_ASSERT_EQUAL(180, function(1, 2, 3)); + + bar_Expect(5); + foo_ExpectAndReturn(4, 30); + foo_ExpectAndReturn(5, 80); + foo_ExpectAndReturn(6, 10); + TEST_ASSERT_EQUAL(120, function(4, 5, 6)); + + bar_Expect(8); + foo_ExpectAndReturn(7, 70); + foo_ExpectAndReturn(8, 20); + foo_ExpectAndReturn(9, 20); + TEST_ASSERT_EQUAL(110, function(0, 8, 9)); + } + +... diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/newer_standards_stuff1.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/newer_standards_stuff1.yml new file mode 100644 index 0000000..6843eae --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/newer_standards_stuff1.yml @@ -0,0 +1,52 @@ +--- +#The purpose of this test is to pull in some standard library stuff from C99 +:cmock: + :includes: + - "" + - "" + +:systest: + :types: | + #include + #include + + + :mockable: | + int32_t foo(int32_t a); + + :source: + :header: | + int8_t function_a(void); + + :code: | + int8_t function_a(void) { + return (int8_t)(INT_MIN == foo(INT_MAX)); + } + + :tests: + :common: | + void setUp(void) {} + void tearDown(void) {} + + :units: + - :pass: TRUE + :should: 'handle handle a simple comparison of C99 types which pass' + :code: | + test() + { + foo_ExpectAndReturn(INT_MAX, INT_MIN); + + TEST_ASSERT_TRUE(function_a()); + } + + - :pass: FALSE + :should: 'handle handle a simple comparison of C99 types which fail' + :code: | + test() + { + foo_ExpectAndReturn(INT_MIN, INT_MIN); + + TEST_ASSERT_TRUE(function_a()); + } + +... diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/nonstandard_parsed_stuff_1.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/nonstandard_parsed_stuff_1.yml new file mode 100644 index 0000000..01538ea --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/nonstandard_parsed_stuff_1.yml @@ -0,0 +1,91 @@ +--- +#The purpose of this test is to play with things like "const char const *" which isn't supported by some compilers +:cmock: + :enforce_strict_ordering: 1 + :plugins: + - :array + - :cexception + - :ignore + +:systest: + :types: | + typedef struct _POINT_T { + int x; + int y; + } POINT_T; + + :mockable: | + #include "CException.h" + void foos(const char const * a); + const char const * bars(void); + + :source: + :header: | + #include "CException.h" + void function_a(void); + void function_b(void); + void function_c(void); + int function_d(void); + + :code: | + void function_c(void) { + CEXCEPTION_T e; + Try { + foos(bars()); + } Catch(e) { foos("err"); } + } + + :tests: + :common: | + #include "CException.h" + void setUp(void) {} + void tearDown(void) {} + + :units: + - :pass: TRUE + :should: 'handle standard c string as null terminated on not do crappy memory compares of a byte, passing' + :code: | + test() + { + bars_ExpectAndReturn("This is a\0 silly string"); + foos_Expect("This is a\0 wacky string"); + + function_c(); + } + + - :pass: FALSE + :should: 'handle standard c string as null terminated on not do crappy memory compares of a byte, finding failures' + :code: | + test() + { + bars_ExpectAndReturn("This is a silly string"); + foos_Expect("This is a wacky string"); + + function_c(); + } + + - :pass: TRUE + :should: 'handle an exception being caught' + :code: | + test() + { + bars_ExpectAndReturn("This is a\0 silly string"); + foos_ExpectAndThrow("This is a\0 wacky string", 55); + foos_Expect("err"); + + function_c(); + } + + - :pass: FALSE + :should: 'handle an exception being caught but still catch following errors' + :code: | + test() + { + bars_ExpectAndReturn("This is a\0 silly string"); + foos_ExpectAndThrow("This is a\0 wacky string", 55); + foos_Expect("wrong error"); + + function_c(); + } + +... diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/nonstandard_parsed_stuff_2.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/nonstandard_parsed_stuff_2.yml new file mode 100644 index 0000000..f9c9538 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/nonstandard_parsed_stuff_2.yml @@ -0,0 +1,59 @@ +--- +#The purpose of this test is to play with our really rough multidimensional array support, which involves an implicit cast not supported everywhere +:cmock: + :plugins: + - :array + +:systest: + :types: | + + + :mockable: | + void foo(unsigned char** a); + unsigned char** bar(void); + + :source: + :header: | + void function_a(void); + + :code: | + void function_a(void) { + foo(bar()); + } + + :tests: + :common: | + void setUp(void) {} + void tearDown(void) {} + + :units: + - :pass: TRUE + :should: 'handle two dimensional array of unsigned characters just like we would handle a single dimensional array in expect (where we really only care about first element)' + :code: | + test() + { + unsigned char a[] = { 1, 2, 3, 4, 5, 6 }; + unsigned char** pa = (unsigned char**)(&a); + + bar_ExpectAndReturn(pa); + foo_Expect(pa); + + function_a(); + } + + - :pass: FALSE + :should: 'handle two dimensional array of unsigned characters just like we would handle a single dimensional array in expect as failures (where we really only care about first element)' + :code: | + test() + { + unsigned char a[] = { 1, 2, 3, 4, 5, 6 }; + unsigned char b[] = { 5, 6, 7, 8, 9, 0 }; + unsigned char** pa = (unsigned char**)(&a); + unsigned char** pb = (unsigned char**)(&b); + + bar_ExpectAndReturn(pa); + foo_Expect(pb); + + function_a(); + } +... diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/parsing_challenges.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/parsing_challenges.yml new file mode 100644 index 0000000..835e1fa --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/parsing_challenges.yml @@ -0,0 +1,222 @@ +--- +:cmock: + :plugins: + - # no plugins + :treat_as_void: + - VOID_TYPE_CRAZINESS_CFG + :treat_as: + TypeDefInt: HEX8 + +:systest: + :types: | + typedef unsigned short U16; + typedef struct _POINT_T + { + int x; + int y; + } POINT_T; + typedef void VOID_TYPE_CRAZINESS_CFG; + typedef int TypeDefInt; + + :mockable: | + /* Make sure we ignore the following + #include "NonExistantFile.h + */ + //#include "AndIgnoreThisToo.h" + #ifdef __cplusplus + extern "C" { + #endif + #define SHOULD_IGNORE_NEXT_FUNC_DEF_AS_PART_OF_MACRO \ + void IgnoredFunction(NotAValidType ToMakeItFailIfWeActuallyMockedThis); + + // typedef edge case; must be in mockable.h for test to compile + // not ANSI C but it has been done and will break cmock if not handled + typedef void VOID_TYPE_CRAZINESS_LCL; + + VOID_TYPE_CRAZINESS_LCL void_type_craziness1(int * a, int *b, int* c); + void void_type_craziness2(VOID_TYPE_CRAZINESS_CFG); + + // pointer parsing exercise + U16 *ptr_return1(int a); + U16* ptr_return2(int a); + U16 * ptr_return3(int a); + + unsigned int** ptr_ptr_return1(unsigned int** a); + unsigned int* *ptr_ptr_return2(unsigned int* *a); + unsigned int **ptr_ptr_return3(unsigned int **a); + unsigned int ** ptr_ptr_return4(unsigned int ** a); + + // variable argument lists + void var_args1(int a, ...); + void var_args2(int a, int b, ...); + + // parsing "stress tests" + char + crazy_multiline( + int a, + unsigned int b); + + unsigned long int incredible_descriptors(register const unsigned short a); + + TypeDefInt uses_typedef_like_names(TypeDefInt typedefvar); + + void oh_brackets1(int fudge[5]); + void oh_brackets2(int caramel[]); + #ifdef __cplusplus + } + #endif + + :source: + :header: | + U16* exercise_return_pointers(int a); + void exercise_var_args(int a, int b); + void exercise_arglist_pointers(void); + char exercise_multiline_declarations(int a, unsigned int b); + void exercise_double_pointers(unsigned int** a); + int exercise_many_descriptors(int a); + TypeDefInt exercise_typedef_like_names(TypeDefInt a); + + :code: | + int A, B, C; + unsigned int *pA, *pB, *pC; + + U16* exercise_return_pointers(int a) + { + ptr_return1(a); + ptr_return2(a); + return ptr_return3(a); + } + + void exercise_var_args(int a, int b) + { + var_args1(a, 3); + var_args2(a, b, 'c'); + } + + void exercise_arglist_pointers(void) + { + void_type_craziness1(&A, &B, &C); + void_type_craziness2(); + } + + char exercise_multiline_declarations(int a, unsigned int b) + { + return crazy_multiline(a, b); + } + + void exercise_double_pointers(unsigned int** a) + { + ptr_ptr_return1((unsigned int**)a); + ptr_ptr_return2((unsigned int**)a); + ptr_ptr_return3((unsigned int**)a); + ptr_ptr_return4((unsigned int**)a); + } + + int exercise_many_descriptors(int a) + { + return (int)incredible_descriptors((unsigned short)a); + } + + TypeDefInt exercise_typedef_like_names(TypeDefInt a) + { + return uses_typedef_like_names(a); + } + + :tests: + :common: | + extern int A, B, C; + extern unsigned int *pA, *pB, *pC; + + void setUp(void) + { + A = 100; + B = 200; + C = 300; + pA = (unsigned int*)(&A); + pB = (unsigned int*)(&B); + pC = (unsigned int*)(&C); + } + void tearDown(void) {} + :units: + - :pass: TRUE + :should: 'execute simple pointer return value check' + :code: | + test() + { + U16 retval; + ptr_return1_ExpectAndReturn(2, NULL); + ptr_return2_ExpectAndReturn(2, NULL); + ptr_return3_ExpectAndReturn(2, &retval); + TEST_ASSERT_EQUAL_PTR(&retval, exercise_return_pointers(2)); + } + + - :pass: TRUE + :should: 'ignore var args in expect prototype generation' + :code: | + test() + { + var_args1_Expect(2); + var_args2_Expect(2, 3); + exercise_var_args(2, 3); + } + + - :pass: TRUE + :should: "not process a typedef'd void as anything other than void" + :code: | + test() + { + void_type_craziness1_Expect(&A, &B, &C); + void_type_craziness2_Expect(); + exercise_arglist_pointers(); + } + + - :pass: TRUE + :should: 'successfully mock crazy multline function prototypes' + :code: | + test() + { + crazy_multiline_ExpectAndReturn(-10, 11, 'z'); + TEST_ASSERT_EQUAL('z', exercise_multiline_declarations(-10, 11)); + } + + - :pass: TRUE + :should: 'mock double pointers just fine' + :code: | + test() + { + ptr_ptr_return1_ExpectAndReturn(&pA, &pB); + ptr_ptr_return2_ExpectAndReturn(&pA, &pB); + ptr_ptr_return3_ExpectAndReturn(&pA, &pB); + ptr_ptr_return4_ExpectAndReturn(&pA, &pB); + exercise_double_pointers((unsigned int**)(&pA)); + } + + - :pass: TRUE + :should: 'mock prototypes with long lists of return and parameter type descriptors' + :code: | + test() + { + incredible_descriptors_ExpectAndReturn(888, 777); + TEST_ASSERT_EQUAL(777, exercise_many_descriptors(888)); + } + + - :pass: TRUE + :should: 'handle words like typdef as PART of a variable or type' + :code: | + test() + { + uses_typedef_like_names_ExpectAndReturn((TypeDefInt)54, (TypeDefInt)53); + TEST_ASSERT_EQUAL(53, exercise_typedef_like_names((TypeDefInt)54)); + } + + - :pass: FALSE + :should: 'handle words like typdef as PART of a variable or type during failing tests' + :code: | + test() + { + uses_typedef_like_names_ExpectAndReturn((TypeDefInt)52, (TypeDefInt)53); + TEST_ASSERT_EQUAL(53, exercise_typedef_like_names((TypeDefInt)54)); + } + + +... diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/struct_union_enum_expect_and_return.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/struct_union_enum_expect_and_return.yml new file mode 100644 index 0000000..d4cf6af --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/struct_union_enum_expect_and_return.yml @@ -0,0 +1,277 @@ +--- +:cmock: + :plugins: + - # none + +:systest: + :types: | + struct THING { int a; int b; }; + + union STARS_AND_STRIPES { int a; char b; }; + + enum HOKEY_POKEY { IN, OUT, SHAKE_IT_ALL_ABOUT }; + + :mockable: | + void foo_struct(struct THING*, struct THING); + struct THING foobar_struct(void); + + void foo_union(union STARS_AND_STRIPES*, union STARS_AND_STRIPES); + union STARS_AND_STRIPES foobar_union(void); + + void foo_enum(enum HOKEY_POKEY a, enum HOKEY_POKEY * b); + enum HOKEY_POKEY foobar_enum(void); + + :source: + :header: | + void exercise_struct(struct THING* a, struct THING b); + struct THING return_struct(void); + + void exercise_union(union STARS_AND_STRIPES* a, union STARS_AND_STRIPES b); + union STARS_AND_STRIPES return_union(void); + + void exercise_enum(enum HOKEY_POKEY a, enum HOKEY_POKEY * b); + enum HOKEY_POKEY return_enum(void); + + :code: | + void exercise_struct(struct THING* a, struct THING b) + { + foo_struct(a, b); + } + + struct THING return_struct(void) + { + return foobar_struct(); + } + + void exercise_union(union STARS_AND_STRIPES* a, union STARS_AND_STRIPES b) + { + foo_union(a, b); + } + + union STARS_AND_STRIPES return_union(void) + { + return foobar_union(); + } + + void exercise_enum(enum HOKEY_POKEY a, enum HOKEY_POKEY * b) + { + foo_enum(a, b); + } + + enum HOKEY_POKEY return_enum(void) + { + return foobar_enum(); + } + + + :tests: + :common: | + struct THING struct1; + struct THING struct2; + struct THING struct3; + struct THING struct4; + struct THING struct5; + struct THING struct6; + + union STARS_AND_STRIPES union1; + union STARS_AND_STRIPES union2; + union STARS_AND_STRIPES union3; + union STARS_AND_STRIPES union4; + union STARS_AND_STRIPES union5; + union STARS_AND_STRIPES union6; + + enum HOKEY_POKEY enum1; + enum HOKEY_POKEY enum2; + + void setUp(void) + { + struct1.a = 1; + struct1.b = 2; + + struct2.a = 3; + struct2.b = 4; + + struct3.a = 5; + struct3.b = 6; + + struct4.a = 7; + struct4.b = 8; + + struct5.a = 9; + struct5.b = 10; + + struct6.a = 9; + struct6.b = 10; + + union1.a = 1; + union2.a = 2; + union3.a = 3; + union4.a = 4; + union5.a = 5; + union6.a = 5; + + enum1 = OUT; + enum2 = IN; + } + + void tearDown(void) {} + + :units: + - :pass: TRUE + :should: 'successfully compare structs' + :code: | + test() + { + foo_struct_Expect(&struct1, struct2); + exercise_struct(&struct1, struct2); + } + + - :pass: FALSE + :should: 'blow up on bad struct pointer comparison' + :code: | + test() + { + foo_struct_Expect(&struct1, struct2); + exercise_struct(&struct3, struct2); + } + + - :pass: FALSE + :should: 'blow up on bad structure comparison' + :code: | + test() + { + foo_struct_Expect(&struct1, struct2); + exercise_struct(&struct1, struct4); + } + + - :pass: TRUE + :should: 'compare returned structs as equal' + :code: | + test() + { + foobar_struct_ExpectAndReturn(struct5); + TEST_ASSERT_EQUAL_THING(struct6, return_struct()); + } + + - :pass: FALSE + :should: 'compare returned structs as unequal' + :code: | + test() + { + foobar_struct_ExpectAndReturn(struct4); + TEST_ASSERT_EQUAL_THING(struct5, return_struct()); + } + + - :pass: TRUE + :should: 'successfully compare unions' + :code: | + test() + { + foo_union_Expect(&union1, union2); + exercise_union(&union1, union2); + } + + - :pass: FALSE + :should: 'blow up on bad union pointer comparison' + :code: | + test() + { + foo_union_Expect(&union1, union2); + exercise_union(&union3, union2); + } + + - :pass: FALSE + :should: 'blow up on bad union comparison' + :code: | + test() + { + foo_union_Expect(&union1, union2); + exercise_union(&union1, union4); + } + + - :pass: TRUE + :should: 'compare returned unions as equal' + :code: | + test() + { + foobar_union_ExpectAndReturn(union5); + TEST_ASSERT_EQUAL_STARS_AND_STRIPES(union6, return_union()); + } + + - :pass: FALSE + :should: 'compare returned unions as unequal' + :code: | + test() + { + foobar_union_ExpectAndReturn(union4); + TEST_ASSERT_EQUAL_STARS_AND_STRIPES(union5, return_union()); + } + + - :pass: TRUE + :should: 'successfully pass enum values' + :code: | + test() + { + foo_enum_Expect(OUT, &enum1); + exercise_enum(OUT, &enum1); + } + + - :pass: FALSE + :should: 'blow up on bad enum pointer comparison' + :code: | + test() + { + foo_enum_Expect(IN, &enum1); + exercise_enum(IN, &enum2); + } + + - :pass: FALSE + :should: 'blow up on bad enum comparison' + :code: | + test() + { + foo_enum_Expect(IN, &enum1); + exercise_enum(SHAKE_IT_ALL_ABOUT, &enum1); + } + + - :pass: TRUE + :should: 'compare returned enums as equal' + :code: | + test() + { + foobar_enum_ExpectAndReturn(OUT); + TEST_ASSERT_EQUAL(OUT, return_enum()); + } + + - :pass: FALSE + :should: 'compare returned unions as unequal' + :code: | + test() + { + foobar_enum_ExpectAndReturn(OUT); + TEST_ASSERT_EQUAL(IN, return_enum()); + } + + + :unity_helper: + :header: | + void AssertEqualTHINGStruct(struct THING expected, struct THING actual); + void AssertEqualSTARS_AND_STRIPESUnion(union STARS_AND_STRIPES expected, union STARS_AND_STRIPES actual); + + #define TEST_ASSERT_EQUAL_THING(expected, actual) {AssertEqualTHINGStruct(expected, actual);} + #define TEST_ASSERT_EQUAL_STARS_AND_STRIPES(expected, actual) {AssertEqualSTARS_AND_STRIPESUnion(expected, actual);} + + :code: | + void AssertEqualTHINGStruct(struct THING expected, struct THING actual) + { + TEST_ASSERT_EQUAL_INT_MESSAGE(expected.a, actual.a, "actual struct member \"a\" does not equal expected"); + TEST_ASSERT_EQUAL_INT_MESSAGE(expected.b, actual.b, "actual struct member \"b\" does not equal expected"); + } + + void AssertEqualSTARS_AND_STRIPESUnion(union STARS_AND_STRIPES expected, union STARS_AND_STRIPES actual) + { + TEST_ASSERT_EQUAL_INT_MESSAGE(expected.a, actual.a, "actual union member \"a\" does not equal expected"); + TEST_ASSERT_EQUAL_MESSAGE(expected.b, actual.b, "actual union member \"b\" does not equal expected"); + } + +... diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/stubs_with_callbacks.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/stubs_with_callbacks.yml new file mode 100644 index 0000000..fcae12c --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/stubs_with_callbacks.yml @@ -0,0 +1,221 @@ +--- +:cmock: + :plugins: + - :callback + :treat_as: + custom_type: INT + +:systest: + :types: | + #define UINT32 unsigned int + + typedef signed int custom_type; + + :mockable: | + UINT32 foo(custom_type* a); + UINT32 bar(custom_type* b); + int baz(void); + void fuz(int* args, int num); + + :source: + :header: | + void function_a(int a, int b); + UINT32 function_b(void); + int function_c(void); + + :code: | + void function_a(int a, int b) + { + int args[6] = {0, 1, 2, 3, 5, 5}; + args[0] = a; + fuz(args, b); + } + + UINT32 function_b(void) + { + UINT32 sum = 0; + custom_type a = 0; + custom_type b = 0; + sum = foo(&a) + bar(&b); + return sum + a + b; + } + + int function_c(void) + { + return (baz() + baz() + baz()); + } + + :tests: + :common: | + void setUp(void) {} + void tearDown(void) {} + + UINT32 FooAndBarHelper(custom_type* data, int num) + { + num++; + *data = (custom_type)(num * 2); + return (*data * 2); + } + + int BazCallbackPointless(int num) + { + return num; + } + + int BazCallbackComplainsIfCalledMoreThanTwice(int num) + { + TEST_ASSERT_MESSAGE(num < 2, "Do Not Call Baz More Than Twice"); + return num; + } + + void FuzVerifier(int* args, int num_args, int num_calls) + { + int i; + TEST_ASSERT_MESSAGE(num_args < 5, "No More Than 5 Args Allowed"); + for (i = 0; i < num_args; i++) + { + TEST_ASSERT_EQUAL(num_calls + i, args[i]); + } + } + + :units: + - :pass: TRUE + :should: 'successfully exercise two simple ExpectAndReturn mock calls the normal way' + :code: | + test() + { + custom_type exp = 0; + foo_ExpectAndReturn(&exp, 10); + bar_ExpectAndReturn(&exp, 20); + TEST_ASSERT_EQUAL(30, function_b()); + } + + - :pass: FALSE + :should: 'successfully exercise two simple ExpectAndReturn mock calls and catch failure the normal way' + :code: | + test() + { + custom_type exp = 1; + foo_ExpectAndReturn(&exp, 10); + bar_ExpectAndReturn(&exp, 20); + TEST_ASSERT_EQUAL(30, function_b()); + } + + - :pass: TRUE + :should: 'successfully exercise using some basic callbacks' + :code: | + test() + { + foo_StubWithCallback((CMOCK_foo_CALLBACK)FooAndBarHelper); + bar_StubWithCallback((CMOCK_bar_CALLBACK)FooAndBarHelper); + TEST_ASSERT_EQUAL(12, function_b()); + } + + - :pass: TRUE + :should: 'successfully exercise using some basic callbacks even if there were expects' + :code: | + test() + { + custom_type exp = 500; + foo_ExpectAndReturn(&exp, 10); + foo_StubWithCallback((CMOCK_foo_CALLBACK)FooAndBarHelper); + bar_StubWithCallback((CMOCK_bar_CALLBACK)FooAndBarHelper); + TEST_ASSERT_EQUAL(12, function_b()); + } + + - :pass: FALSE + :should: 'successfully exercise using some basic callbacks and notice failures' + :code: | + test() + { + foo_StubWithCallback((CMOCK_foo_CALLBACK)FooAndBarHelper); + bar_StubWithCallback((CMOCK_bar_CALLBACK)FooAndBarHelper); + TEST_ASSERT_EQUAL(10, function_b()); + } + + - :pass: TRUE + :should: 'successfully exercise a callback with no arguments' + :code: | + test() + { + baz_StubWithCallback((CMOCK_baz_CALLBACK)BazCallbackPointless); + TEST_ASSERT_EQUAL(3, function_c()); + } + + - :pass: FALSE + :should: 'successfully throw a failure from within a callback function' + :code: | + test() + { + baz_StubWithCallback((CMOCK_baz_CALLBACK)BazCallbackComplainsIfCalledMoreThanTwice); + function_c(); + } + + - :pass: TRUE + :should: 'be usable for things like dynamically sized memory checking for passing conditions' + :code: | + test() + { + fuz_StubWithCallback((CMOCK_fuz_CALLBACK)FuzVerifier); + function_a(0, 4); + } + + - :pass: FALSE + :should: 'be usable for things like dynamically sized memory checking for failing conditions' + :code: | + test() + { + fuz_StubWithCallback((CMOCK_fuz_CALLBACK)FuzVerifier); + function_a(0, 5); + } + + - :pass: FALSE + :should: 'be usable for things like dynamically sized memory checking for failing conditions 2' + :code: | + test() + { + fuz_StubWithCallback((CMOCK_fuz_CALLBACK)FuzVerifier); + function_a(1, 4); + } + + - :pass: TRUE + :should: 'run them interlaced' + :code: | + test() + { + custom_type exp = 0; + foo_ExpectAndReturn(&exp, 10); + foo_ExpectAndReturn(&exp, 15); + bar_ExpectAndReturn(&exp, 20); + bar_ExpectAndReturn(&exp, 40); + fuz_StubWithCallback((CMOCK_fuz_CALLBACK)FuzVerifier); + baz_StubWithCallback((CMOCK_baz_CALLBACK)BazCallbackPointless); + + TEST_ASSERT_EQUAL(30, function_b()); + TEST_ASSERT_EQUAL(55, function_b()); + function_a(0, 4); + TEST_ASSERT_EQUAL(3, function_c()); + } + + - :pass: TRUE + :should: 'run them back to back' + :code: | + test() + { + custom_type exp = 0; + foo_ExpectAndReturn(&exp, 10); + bar_ExpectAndReturn(&exp, 20); + TEST_ASSERT_EQUAL(30, function_b()); + + foo_ExpectAndReturn(&exp, 15); + bar_ExpectAndReturn(&exp, 40); + TEST_ASSERT_EQUAL(55, function_b()); + + fuz_StubWithCallback((CMOCK_fuz_CALLBACK)FuzVerifier); + function_a(0, 4); + + baz_StubWithCallback((CMOCK_baz_CALLBACK)BazCallbackPointless); + TEST_ASSERT_EQUAL(3, function_c()); + } + +... diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/unity_64bit_support.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/unity_64bit_support.yml new file mode 100644 index 0000000..c34bb1c --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/unity_64bit_support.yml @@ -0,0 +1,82 @@ +--- +#The purpose of this test is to play with things 64-bit integers, which aren't supported by all compilers +:cmock: + :plugins: + - :array + - :ignore + +:systest: + :types: | + #if (UNITY_LONG_WIDTH == 32) + typedef unsigned long long TEST64; + #elif (UNITY_LONG_WIDTH == 64) + typedef unsigned long TEST64; + #else + #error This Test Should Not Be Run Unless You Have 64 Bit Support Enabled + #endif + + :mockable: | + TEST64 foo(TEST64 a); + TEST64* bar(TEST64* b); + + :source: + :header: | + TEST64 function_a(void); + + :code: | + TEST64 function_a(void) { + TEST64 a = 0x1234567890123456; + TEST64 b; + TEST64* c; + + b = foo(a); + c = bar(&b); + return *c; + } + + :tests: + :common: | + void setUp(void) {} + void tearDown(void) {} + + :units: + - :pass: TRUE + :should: 'handle a straightforward 64-bit series of calls' + :code: | + test() + { + TEST64 a = 0x0987654321543210; + TEST64 b = 0x5a5a5a5a5a5a5a5a; + foo_ExpectAndReturn(0x1234567890123456, 0x0987654321543210); + bar_ExpectAndReturn(&a, &b); + + TEST_ASSERT_EQUAL_HEX64(b, function_a()); + } + + - :pass: FALSE + :should: 'handle a straightforward 64-bit series of calls with a failure' + :code: | + test() + { + TEST64 a = 0x0987654321543210; + TEST64 b = 0x5a5a5a5a5a5a5a5a; + foo_ExpectAndReturn(0x1234567890123456, 0x0987654321543211); + bar_ExpectAndReturn(&a, &b); + + TEST_ASSERT_EQUAL_HEX64(b, function_a()); + } + + - :pass: FALSE + :should: 'handle a straightforward 64-bit series of calls returning a failure' + :code: | + test() + { + TEST64 a = 0x0987654321543210; + TEST64 b = 0x5a5a5a5a5a5a5a5a; + foo_ExpectAndReturn(0x1234567890123456, 0x0987654321543210); + bar_ExpectAndReturn(&a, &b); + + TEST_ASSERT_EQUAL_HEX64(b+1, function_a()); + } + +... diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/unity_ignores.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/unity_ignores.yml new file mode 100644 index 0000000..c6f8574 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/system/test_interactions/unity_ignores.yml @@ -0,0 +1,139 @@ +--- +:cmock: + :plugins: + - # none + +:systest: + :types: | + #define UINT32 unsigned int + + :mockable: | + UINT32 foo(UINT32 a); + void bar(void); + + :source: + :header: | + UINT32 function_a(int a); + void function_b(void); + + :code: | + UINT32 function_a(int a) + { + bar(); + return foo((UINT32)a); + } + + void function_b(void) + { + bar(); + } + + :tests: + :common: | + void setUp(void) {} + void tearDown(void) {} + + :units: + - :pass: :ignore + :should: 'ignore incorrect expects after the TEST_IGNORE call' + :code: | + test() + { + TEST_IGNORE(); + bar_Expect(); + foo_ExpectAndReturn(10, 20); + TEST_ASSERT_EQUAL(40, function_a(30)); + } + + - :pass: :ignore + :should: 'ignore missing expects after the TEST_IGNORE call' + :code: | + test() + { + TEST_IGNORE(); + foo_ExpectAndReturn(10, 20); + TEST_ASSERT_EQUAL(20, function_a(10)); + } + + - :pass: :ignore + :should: 'ignore extra expects after the TEST_IGNORE call' + :code: | + test() + { + TEST_IGNORE(); + bar_Expect(); + bar_Expect(); + foo_ExpectAndReturn(10, 20); + foo_ExpectAndReturn(10, 20); + foo_ExpectAndReturn(10, 20); + TEST_ASSERT_EQUAL(20, function_a(10)); + } + + - :pass: :ignore + :should: 'ignore no expects after the TEST_IGNORE call' + :code: | + test() + { + TEST_IGNORE(); + TEST_ASSERT_EQUAL(20, function_a(10)); + } + + - :pass: :ignore + :should: 'ignore extra expects after the TEST_IGNORE call even if it happens later' + :code: | + test() + { + bar_Expect(); + foo_ExpectAndReturn(10, 20); + function_a(10); + + TEST_IGNORE(); + bar_Expect(); + foo_ExpectAndReturn(10, 20); + TEST_ASSERT_EQUAL(40, function_a(30)); + } + + - :pass: false + :should: 'still fail if there are expect problems before the TEST_IGNORE' + :code: | + test() + { + bar_Expect(); + foo_ExpectAndReturn(10, 20); + function_a(30); + + TEST_IGNORE(); + bar_Expect(); + foo_ExpectAndReturn(10, 20); + TEST_ASSERT_EQUAL(40, function_a(30)); + } + + - :pass: false + :should: 'still fail if there are missing expect problems before the TEST_IGNORE' + :code: | + test() + { + bar_Expect(); + function_a(10); + + TEST_IGNORE(); + bar_Expect(); + foo_ExpectAndReturn(10, 20); + TEST_ASSERT_EQUAL(40, function_a(30)); + } + + - :pass: :ignore + :should: 'ignore if extra expects before the TEST_IGNORE because it ignored the rest of the test that might have made calls to it' + :code: | + test() + { + bar_Expect(); + bar_Expect(); + foo_ExpectAndReturn(10, 20); + function_a(10); + + TEST_IGNORE(); + foo_ExpectAndReturn(10, 20); + TEST_ASSERT_EQUAL(40, function_a(30)); + } +... diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/test_helper.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/test_helper.rb new file mode 100644 index 0000000..7dd33fb --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/test_helper.rb @@ -0,0 +1,44 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== +[ "/../config/test_environment", + "/../vendor/behaviors/lib/behaviors" +].each do |req| + require File.expand_path(File.dirname(__FILE__)) + req +end + +#gem install test-unit -v 1.2.3 +ruby_version = RUBY_VERSION.split('.') +if (ruby_version[1].to_i == 9) and (ruby_version[2].to_i > 1) + require 'rubygems' + gem 'test-unit' +end +require 'test/unit' +require 'hardmock' + +class Test::Unit::TestCase + extend Behaviors + + #these are helpful test structures which can be used during tests + + def test_return + { + :int => {:type => "int", :name => 'cmock_to_return', :ptr? => false, :const? => false, :void? => false, :str => 'int cmock_to_return'}, + :int_ptr => {:type => "int*", :name => 'cmock_to_return', :ptr? => true, :const? => false, :void? => false, :str => 'int* cmock_to_return'}, + :void => {:type => "void", :name => 'cmock_to_return', :ptr? => false, :const? => false, :void? => true, :str => 'void cmock_to_return'}, + :string => {:type => "char*", :name => 'cmock_to_return', :ptr? => false, :const? => true, :void? => false, :str => 'const char* cmock_to_return'}, + } + end + + def test_arg + { + :int => {:type => "int", :name => 'MyInt', :ptr? => false, :const? => false}, + :int_ptr => {:type => "int*", :name => 'MyIntPtr', :ptr? => true, :const? => false}, + :mytype => {:type => "MY_TYPE", :name => 'MyMyType', :ptr? => false, :const? => true}, + :mytype_ptr => {:type => "MY_TYPE*", :name => 'MyMyTypePtr', :ptr? => true, :const? => false}, + :string => {:type => "char*", :name => 'MyStr', :ptr? => false, :const? => true}, + } + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/unit/cmock_config_test.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/unit/cmock_config_test.rb new file mode 100644 index 0000000..cfdfc41 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/unit/cmock_config_test.rb @@ -0,0 +1,45 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require File.expand_path(File.dirname(__FILE__)) + "/../test_helper" +require 'cmock_config' + +class CMockConfigTest < Test::Unit::TestCase + def setup + end + + def teardown + end + + should "use default settings when no parameters are specified" do + config = CMockConfig.new + assert_equal(CMockConfig::CMockDefaultOptions[:mock_path], config.mock_path) + assert_equal(CMockConfig::CMockDefaultOptions[:includes], config.includes) + assert_equal(CMockConfig::CMockDefaultOptions[:attributes], config.attributes) + assert_equal(CMockConfig::CMockDefaultOptions[:plugins], config.plugins) + assert_equal(CMockConfig::CMockDefaultOptions[:treat_externs], config.treat_externs) + end + + should "replace only options specified in a hash" do + test_includes = ['hello'] + test_attributes = ['blah', 'bleh'] + config = CMockConfig.new(:includes => test_includes, :attributes => test_attributes) + assert_equal(CMockConfig::CMockDefaultOptions[:mock_path], config.mock_path) + assert_equal(test_includes, config.includes) + assert_equal(test_attributes, config.attributes) + assert_equal(CMockConfig::CMockDefaultOptions[:plugins], config.plugins) + assert_equal(CMockConfig::CMockDefaultOptions[:treat_externs], config.treat_externs) + end + + should "replace only options specified in a yaml file" do + test_plugins = [:soda, :pizza] + config = CMockConfig.new("#{File.expand_path(File.dirname(__FILE__))}/cmock_config_test.yml") + assert_equal(CMockConfig::CMockDefaultOptions[:mock_path], config.mock_path) + assert_equal(CMockConfig::CMockDefaultOptions[:includes], config.includes) + assert_equal(test_plugins, config.plugins) + assert_equal(:include, config.treat_externs) + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/unit/cmock_config_test.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/unit/cmock_config_test.yml new file mode 100644 index 0000000..b2444f8 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/unit/cmock_config_test.yml @@ -0,0 +1,5 @@ +:cmock: + :plugins: + - 'soda' + - 'pizza' + :treat_externs: :include diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/unit/cmock_file_writer_test.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/unit/cmock_file_writer_test.rb new file mode 100644 index 0000000..13c2631 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/unit/cmock_file_writer_test.rb @@ -0,0 +1,30 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require File.expand_path(File.dirname(__FILE__)) + "/../test_helper" +require 'cmock_file_writer' + +class CMockFileWriterTest < Test::Unit::TestCase + def setup + create_mocks :config + @cmock_file_writer = CMockFileWriter.new(@config) + end + + def teardown + end + + should "have set up internal accessors correctly on init" do + assert_equal(@config, @cmock_file_writer.config) + end + + should "complain if a block was not specified when calling create" do + begin + @cmock_file_writer.create_file("test.txt") + assert false, "Should Have Thrown An Error When Calling Without A Block" + rescue + end + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/unit/cmock_generator_main_test.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/unit/cmock_generator_main_test.rb new file mode 100644 index 0000000..f743d84 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/unit/cmock_generator_main_test.rb @@ -0,0 +1,412 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +$ThisIsOnlyATest = true + +require File.expand_path(File.dirname(__FILE__)) + "/../test_helper" +require 'cmock_generator' + +class MockedPluginHelper + def initialize return_this + @return_this = return_this + end + + def include_files + return @return_this + end + + def instance_structure( name, args, rettype ) + return " #{@return_this}_#{name}(#{args}, #{rettype})" + end + + def mock_verify( name ) + return " #{@return_this}_#{name}" + end + + def mock_destroy( name, args, rettype ) + return " #{@return_this}_#{name}(#{args}, #{rettype})" + end + + def mock_implementation(name, args) + return " Mock#{name}#{@return_this}(#{args.join(", ")})" + end +end + +class CMockGeneratorTest < Test::Unit::TestCase + def setup + create_mocks :config, :file_writer, :utils, :plugins + @module_name = "PoutPoutFish" + + #no strict handling + @config.expect.mock_prefix.returns("Mock") + @config.expect.enforce_strict_ordering.returns(nil) + @config.expect.framework.returns(:unity) + @config.expect.includes.returns(["ConfigRequiredHeader1.h","ConfigRequiredHeader2.h"]) + #@config.expect.includes_h_pre_orig_header.returns(nil) #not called because includes called + @config.expect.includes_h_post_orig_header.returns(nil) + @config.expect.includes_c_pre_header.returns(nil) + @config.expect.includes_c_post_header.returns(nil) + @cmock_generator = CMockGenerator.new(@config, @file_writer, @utils, @plugins) + @cmock_generator.module_name = @module_name + @cmock_generator.mock_name = "Mock#{@module_name}" + + #strict handling + @config.expect.mock_prefix.returns("Mock") + @config.expect.enforce_strict_ordering.returns(true) + @config.expect.framework.returns(:unity) + @config.expect.includes.returns(nil) + @config.expect.includes_h_pre_orig_header.returns(nil) + @config.expect.includes_h_post_orig_header.returns(nil) + @config.expect.includes_c_pre_header.returns(nil) + @config.expect.includes_c_post_header.returns(nil) + @cmock_generator_strict = CMockGenerator.new(@config, @file_writer, @utils, @plugins) + @cmock_generator_strict.module_name = @module_name + @cmock_generator_strict.mock_name = "Mock#{@module_name}" + end + + def teardown + end + + should "have set up internal accessors correctly on init" do + assert_equal(@config, @cmock_generator.config) + assert_equal(@file_writer, @cmock_generator.file_writer) + assert_equal(@utils, @cmock_generator.utils) + assert_equal(@plugins, @cmock_generator.plugins) + end + + should "create the top of a header file with optional include files from config and include file from plugin" do + @config.expect.mock_prefix.returns("Mock") + orig_filename = "PoutPoutFish.h" + define_name = "MOCKPOUTPOUTFISH_H" + mock_name = "MockPoutPoutFish" + output = [] + expected = [ "/* AUTOGENERATED FILE. DO NOT EDIT. */\n", + "#ifndef _#{define_name}\n", + "#define _#{define_name}\n\n", + "#include \"ConfigRequiredHeader1.h\"\n", + "#include \"ConfigRequiredHeader2.h\"\n", + "#include \"#{orig_filename}\"\n", + "#include \"PluginRequiredHeader.h\"\n", + "\n" + ] + + @plugins.expect.run(:include_files).returns("#include \"PluginRequiredHeader.h\"\n") + + @cmock_generator.create_mock_header_header(output, "MockPoutPoutFish.h") + + assert_equal(expected, output) + end + + should "create the top of a header file with optional include files from config" do + @config.expect.mock_prefix.returns("Mock") + orig_filename = "PoutPoutFish.h" + define_name = "MOCKPOUTPOUTFISH_H" + mock_name = "MockPoutPoutFish" + output = [] + expected = [ "/* AUTOGENERATED FILE. DO NOT EDIT. */\n", + "#ifndef _#{define_name}\n", + "#define _#{define_name}\n\n", + "#include \"ConfigRequiredHeader1.h\"\n", + "#include \"ConfigRequiredHeader2.h\"\n", + "#include \"#{orig_filename}\"\n", + "\n" + ] + + @plugins.expect.run(:include_files).returns('') + + @cmock_generator.create_mock_header_header(output, "MockPoutPoutFish.h") + + assert_equal(expected, output) + end + + should "create the top of a header file with include file from plugin" do + @config.expect.mock_prefix.returns("Mock") + orig_filename = "PoutPoutFish.h" + define_name = "MOCKPOUTPOUTFISH_H" + mock_name = "MockPoutPoutFish" + output = [] + expected = [ "/* AUTOGENERATED FILE. DO NOT EDIT. */\n", + "#ifndef _#{define_name}\n", + "#define _#{define_name}\n\n", + "#include \"ConfigRequiredHeader1.h\"\n", + "#include \"ConfigRequiredHeader2.h\"\n", + "#include \"#{orig_filename}\"\n", + "#include \"PluginRequiredHeader.h\"\n", + "\n" + ] + + @plugins.expect.run(:include_files).returns("#include \"PluginRequiredHeader.h\"\n") + + @cmock_generator.create_mock_header_header(output, "MockPoutPoutFish.h") + + assert_equal(expected, output) + end + + should "write typedefs" do + typedefs = [ 'typedef unsigned char U8;', + 'typedef char S8;', + 'typedef unsigned long U32;' + ] + output = [] + expected = [ "\n", + "typedef unsigned char U8;\n", + "typedef char S8;\n", + "typedef unsigned long U32;\n", + "\n\n" + ] + + @cmock_generator.create_typedefs(output, typedefs) + + assert_equal(expected, output.flatten) + end + + should "create the header file service call declarations" do + mock_name = "MockPoutPoutFish" + + output = [] + expected = [ "void #{mock_name}_Init(void);\n", + "void #{mock_name}_Destroy(void);\n", + "void #{mock_name}_Verify(void);\n\n" + ] + + @cmock_generator.create_mock_header_service_call_declarations(output) + + assert_equal(expected, output) + end + + should "append the proper footer to the header file" do + output = [] + expected = ["\n#endif\n"] + + @cmock_generator.create_mock_header_footer(output) + + assert_equal(expected, output) + end + + should "create a proper heading for a source file" do + output = [] + expected = [ "/* AUTOGENERATED FILE. DO NOT EDIT. */\n", + "#include \n", + "#include \n", + "#include \n", + "#include \"unity.h\"\n", + "#include \"cmock.h\"\n", + "#include \"MockPoutPoutFish.h\"\n", + "\n" + ] + + @cmock_generator.create_source_header_section(output, "MockPoutPoutFish.c") + + assert_equal(expected, output) + end + + should "create the instance structure where it is needed when no functions" do + output = [] + functions = [] + expected = [ "static struct MockPoutPoutFishInstance\n", + "{\n", + " unsigned char placeHolder;\n", + "} Mock;\n\n" + ].join + + @cmock_generator.create_instance_structure(output, functions) + + assert_equal(expected, output.join) + end + + should "create the instance structure where it is needed when functions required" do + output = [] + functions = [ { :name => "First", :args => "int Candy", :return => test_return[:int] }, + { :name => "Second", :args => "bool Smarty", :return => test_return[:string] } + ] + expected = [ "typedef struct _CMOCK_First_CALL_INSTANCE\n{\n", + " UNITY_LINE_TYPE LineNumber;\n", + " b1 b2", + "\n} CMOCK_First_CALL_INSTANCE;\n\n", + "typedef struct _CMOCK_Second_CALL_INSTANCE\n{\n", + " UNITY_LINE_TYPE LineNumber;\n", + "\n} CMOCK_Second_CALL_INSTANCE;\n\n", + "static struct MockPoutPoutFishInstance\n{\n", + " d1", + " CMOCK_MEM_INDEX_TYPE First_CallInstance;\n", + " e1 e2 e3", + " CMOCK_MEM_INDEX_TYPE Second_CallInstance;\n", + "} Mock;\n\n" + ].join + @plugins.expect.run(:instance_typedefs, functions[0]).returns([" b1"," b2"]) + @plugins.expect.run(:instance_typedefs, functions[1]).returns([]) + + @plugins.expect.run(:instance_structure, functions[0]).returns([" d1"]) + @plugins.expect.run(:instance_structure, functions[1]).returns([" e1"," e2"," e3"]) + + @cmock_generator.create_instance_structure(output, functions) + + assert_equal(expected, output.join) + end + + should "create extern declarations for source file" do + output = [] + expected = [ "extern jmp_buf AbortFrame;\n", + "\n" ] + + @cmock_generator.create_extern_declarations(output) + + assert_equal(expected, output.flatten) + end + + should "create extern declarations for source file when using strict ordering" do + output = [] + expected = [ "extern jmp_buf AbortFrame;\n", + "extern int GlobalExpectCount;\n", + "extern int GlobalVerifyOrder;\n", + "\n" ] + + @cmock_generator_strict.create_extern_declarations(output) + + assert_equal(expected, output.flatten) + end + + should "create mock verify functions in source file when no functions specified" do + functions = [] + output = [] + expected = "void MockPoutPoutFish_Verify(void)\n{\n}\n\n" + + @cmock_generator.create_mock_verify_function(output, functions) + + assert_equal(expected, output.join) + end + + should "create mock verify functions in source file when extra functions specified" do + functions = [ { :name => "First", :args => "int Candy", :return => test_return[:int] }, + { :name => "Second", :args => "bool Smarty", :return => test_return[:string] } + ] + output = [] + expected = [ "void MockPoutPoutFish_Verify(void)\n{\n", + " UNITY_LINE_TYPE cmock_line = TEST_LINE_NUM;\n", + " Uno_First" + + " Dos_First" + + " Uno_Second" + + " Dos_Second", + "}\n\n" + ] + @plugins.expect.run(:mock_verify, functions[0]).returns([" Uno_First"," Dos_First"]) + @plugins.expect.run(:mock_verify, functions[1]).returns([" Uno_Second"," Dos_Second"]) + + @cmock_generator.ordered = true + @cmock_generator.create_mock_verify_function(output, functions) + + assert_equal(expected, output.flatten) + end + + should "create mock init functions in source file" do + output = [] + expected = [ "void MockPoutPoutFish_Init(void)\n{\n", + " MockPoutPoutFish_Destroy();\n", + "}\n\n" + ] + + @cmock_generator.create_mock_init_function(output) + + assert_equal(expected.join, output.join) + end + + should "create mock destroy functions in source file" do + functions = [] + output = [] + expected = [ "void MockPoutPoutFish_Destroy(void)\n{\n", + " CMock_Guts_MemFreeAll();\n", + " memset(&Mock, 0, sizeof(Mock));\n", + "}\n\n" + ] + + @cmock_generator.create_mock_destroy_function(output, functions) + + assert_equal(expected.join, output.join) + end + + should "create mock destroy functions in source file when specified with strict ordering" do + functions = [ { :name => "First", :args => "int Candy", :return => test_return[:int] }, + { :name => "Second", :args => "bool Smarty", :return => test_return[:string] } + ] + output = [] + expected = [ "void MockPoutPoutFish_Destroy(void)\n{\n", + " CMock_Guts_MemFreeAll();\n", + " memset(&Mock, 0, sizeof(Mock));\n", + " uno", + " GlobalExpectCount = 0;\n", + " GlobalVerifyOrder = 0;\n", + "}\n\n" + ] + @plugins.expect.run(:mock_destroy, functions[0]).returns([]) + @plugins.expect.run(:mock_destroy, functions[1]).returns([" uno"]) + + @cmock_generator_strict.create_mock_destroy_function(output, functions) + + assert_equal(expected.join, output.join) + end + + should "create mock implementation functions in source file" do + function = { :modifier => "static", + :return => test_return[:int], + :args_string => "uint32 sandwiches, const char* named", + :args => ["uint32 sandwiches", "const char* named"], + :var_arg => nil, + :name => "SupaFunction", + :attributes => "__inline" + } + output = [] + expected = [ "static int SupaFunction(uint32 sandwiches, const char* named)\n", + "{\n", + " UNITY_LINE_TYPE cmock_line = TEST_LINE_NUM;\n", + " CMOCK_SupaFunction_CALL_INSTANCE* cmock_call_instance = (CMOCK_SupaFunction_CALL_INSTANCE*)CMock_Guts_GetAddressFor(Mock.SupaFunction_CallInstance);\n", + " Mock.SupaFunction_CallInstance = CMock_Guts_MemNext(Mock.SupaFunction_CallInstance);\n", + " uno", + " UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, \"Function 'SupaFunction' called more times than expected.\");\n", + " cmock_line = cmock_call_instance->LineNumber;\n", + " dos", + " tres", + " return cmock_call_instance->ReturnVal;\n", + "}\n\n" + ] + @plugins.expect.run(:mock_implementation_precheck, function).returns([" uno"]) + @plugins.expect.run(:mock_implementation, function).returns([" dos"," tres"]) + + @cmock_generator.create_mock_implementation(output, function) + + assert_equal(expected.join, output.join) + end + + should "create mock implementation functions in source file with different options" do + function = { :modifier => "", + :return => test_return[:int], + :args_string => "uint32 sandwiches", + :args => ["uint32 sandwiches"], + :var_arg => "corn ...", + :name => "SupaFunction", + :attributes => nil + } + output = [] + expected = [ "int SupaFunction(uint32 sandwiches, corn ...)\n", + "{\n", + " UNITY_LINE_TYPE cmock_line = TEST_LINE_NUM;\n", + " CMOCK_SupaFunction_CALL_INSTANCE* cmock_call_instance = (CMOCK_SupaFunction_CALL_INSTANCE*)CMock_Guts_GetAddressFor(Mock.SupaFunction_CallInstance);\n", + " Mock.SupaFunction_CallInstance = CMock_Guts_MemNext(Mock.SupaFunction_CallInstance);\n", + " uno", + " UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, \"Function 'SupaFunction' called more times than expected.\");\n", + " cmock_line = cmock_call_instance->LineNumber;\n", + " dos", + " tres", + " return cmock_call_instance->ReturnVal;\n", + "}\n\n" + ] + @plugins.expect.run(:mock_implementation_precheck, function).returns([" uno"]) + @plugins.expect.run(:mock_implementation, function).returns([" dos"," tres"]) + + @cmock_generator.create_mock_implementation(output, function) + + assert_equal(expected.join, output.join) + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_array_test.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_array_test.rb new file mode 100644 index 0000000..959a8e0 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_array_test.rb @@ -0,0 +1,114 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require File.expand_path(File.dirname(__FILE__)) + "/../test_helper" +require 'cmock_generator_plugin_array' + +class CMockGeneratorPluginArrayTest < Test::Unit::TestCase + def setup + create_mocks :config, :utils + + #no strict ordering + @config.expect.when_ptr.returns(:compare_data) + @config.expect.enforce_strict_ordering.returns(false) + @config.stubs!(:respond_to?).returns(true) + @utils.expect.helpers.returns({}) + @cmock_generator_plugin_array = CMockGeneratorPluginArray.new(@config, @utils) + end + + def teardown + end + + should "have set up internal accessors correctly on init" do + assert_equal(@config, @cmock_generator_plugin_array.config) + assert_equal(@utils, @cmock_generator_plugin_array.utils) + assert_equal(nil, @cmock_generator_plugin_array.unity_helper) + assert_equal(8, @cmock_generator_plugin_array.priority) + end + + should "not include any additional include files" do + assert(!@cmock_generator_plugin_array.respond_to?(:include_files)) + end + + should "not add to typedef structure for functions of style 'int* func(void)'" do + function = {:name => "Oak", :args => [], :return => test_return[:int_ptr]} + returned = @cmock_generator_plugin_array.instance_typedefs(function) + assert_equal("", returned) + end + + should "add to tyepdef structure mock needs of functions of style 'void func(int chicken, int* pork)'" do + function = {:name => "Cedar", :args => [{ :name => "chicken", :type => "int", :ptr? => false}, { :name => "pork", :type => "int*", :ptr? => true}], :return => test_return[:void]} + expected = " int Expected_pork_Depth;\n" + returned = @cmock_generator_plugin_array.instance_typedefs(function) + assert_equal(expected, returned) + end + + should "not add an additional mock interface for functions not containing pointers" do + function = {:name => "Maple", :args_string => "int blah", :return => test_return[:string], :contains_ptr? => false} + returned = @cmock_generator_plugin_array.mock_function_declarations(function) + assert_nil(returned) + end + + should "add another mock function declaration for functions of style 'void func(int* tofu)'" do + function = {:name => "Pine", + :args => [{ :type => "int*", + :name => "tofu", + :ptr? => true, + }], + :return => test_return[:void], + :contains_ptr? => true } + + expected = "#define #{function[:name]}_ExpectWithArray(tofu, tofu_Depth) #{function[:name]}_CMockExpectWithArray(__LINE__, tofu, tofu_Depth)\n" + + "void #{function[:name]}_CMockExpectWithArray(UNITY_LINE_TYPE cmock_line, int* tofu, int tofu_Depth);\n" + returned = @cmock_generator_plugin_array.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "add another mock function declaration for functions of style 'const char* func(int* tofu)'" do + function = {:name => "Pine", + :args => [{ :type => "int*", + :name => "tofu", + :ptr? => true, + }], + :return => test_return[:string], + :contains_ptr? => true } + + expected = "#define #{function[:name]}_ExpectWithArrayAndReturn(tofu, tofu_Depth, cmock_retval) #{function[:name]}_CMockExpectWithArrayAndReturn(__LINE__, tofu, tofu_Depth, cmock_retval)\n" + + "void #{function[:name]}_CMockExpectWithArrayAndReturn(UNITY_LINE_TYPE cmock_line, int* tofu, int tofu_Depth, const char* cmock_to_return);\n" + returned = @cmock_generator_plugin_array.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "not have a mock function implementation" do + assert(!@cmock_generator_plugin_array.respond_to?(:mock_implementation)) + end + + should "not have a mock interfaces for functions of style 'int* func(void)'" do + function = {:name => "Pear", :args => [], :args_string => "void", :return => test_return[:int_ptr]} + returned = @cmock_generator_plugin_array.mock_interfaces(function) + assert_nil(returned) + end + + should "add mock interfaces for functions of style 'int* func(int* pescado, int pes)'" do + function = {:name => "Lemon", + :args => [{ :type => "int*", :name => "pescado", :ptr? => true}, { :type => "int", :name => "pes", :ptr? => false}], + :args_string => "int* pescado, int pes", + :return => test_return[:int_ptr], + :contains_ptr? => true } + @utils.expect.code_add_base_expectation("Lemon").returns("mock_retval_0") + + expected = ["void Lemon_CMockExpectWithArrayAndReturn(UNITY_LINE_TYPE cmock_line, int* pescado, int pescado_Depth, int pes, int* cmock_to_return)\n", + "{\n", + "mock_retval_0", + " CMockExpectParameters_Lemon(cmock_call_instance, pescado, pescado_Depth, pes);\n", + " cmock_call_instance->ReturnVal = cmock_to_return;\n", + "}\n\n" + ].join + returned = @cmock_generator_plugin_array.mock_interfaces(function).join + assert_equal(expected, returned) + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_callback_test.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_callback_test.rb new file mode 100644 index 0000000..8542fc6 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_callback_test.rb @@ -0,0 +1,190 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require File.expand_path(File.dirname(__FILE__)) + "/../test_helper" +require 'cmock_generator_plugin_callback' + +class CMockGeneratorPluginCallbackTest < Test::Unit::TestCase + def setup + create_mocks :config, :utils + + @config.expect.callback_include_count.returns(true) + @config.expect.callback_after_arg_check.returns(false) + + @cmock_generator_plugin_callback = CMockGeneratorPluginCallback.new(@config, @utils) + end + + def teardown + end + + should "have set up internal accessors correctly on init" do + assert_equal(@config, @cmock_generator_plugin_callback.config) + assert_equal(@utils, @cmock_generator_plugin_callback.utils) + assert_equal(6, @cmock_generator_plugin_callback.priority) + end + + should "not include any additional include files" do + assert(!@cmock_generator_plugin_callback.respond_to?(:include_files)) + end + + should "add to instance structure" do + function = {:name => "Oak", :args => [:type => "int*", :name => "blah", :ptr? => true], :return => test_return[:int_ptr]} + expected = " CMOCK_Oak_CALLBACK Oak_CallbackFunctionPointer;\n" + + " int Oak_CallbackCalls;\n" + returned = @cmock_generator_plugin_callback.instance_structure(function) + assert_equal(expected, returned) + end + + should "add mock function declaration for function without arguments" do + function = {:name => "Maple", :args_string => "void", :args => [], :return => test_return[:void]} + expected = [ "typedef void (* CMOCK_Maple_CALLBACK)(int cmock_num_calls);\n", + "void Maple_StubWithCallback(CMOCK_Maple_CALLBACK Callback);\n" ].join + returned = @cmock_generator_plugin_callback.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "add mock function declaration for function without arguments when count is also turned off" do + function = {:name => "Maple", :args_string => "void", :args => [], :return => test_return[:void]} + expected = [ "typedef void (* CMOCK_Maple_CALLBACK)(void);\n", + "void Maple_StubWithCallback(CMOCK_Maple_CALLBACK Callback);\n" ].join + @cmock_generator_plugin_callback.include_count = false + returned = @cmock_generator_plugin_callback.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "add mock function declaration for function with arguments" do + function = {:name => "Maple", :args_string => "int* tofu", :args => [1], :return => test_return[:void]} + expected = [ "typedef void (* CMOCK_Maple_CALLBACK)(int* tofu, int cmock_num_calls);\n", + "void Maple_StubWithCallback(CMOCK_Maple_CALLBACK Callback);\n" ].join + returned = @cmock_generator_plugin_callback.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "add mock function declaration for function with return values" do + function = {:name => "Maple", :args_string => "int* tofu", :args => [1], :return => test_return[:string]} + expected = [ "typedef const char* (* CMOCK_Maple_CALLBACK)(int* tofu, int cmock_num_calls);\n", + "void Maple_StubWithCallback(CMOCK_Maple_CALLBACK Callback);\n" ].join + returned = @cmock_generator_plugin_callback.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "add mock function declaration for function with return values and count is turned off" do + function = {:name => "Maple", :args_string => "int* tofu", :args => [1], :return => test_return[:string]} + expected = [ "typedef const char* (* CMOCK_Maple_CALLBACK)(int* tofu);\n", + "void Maple_StubWithCallback(CMOCK_Maple_CALLBACK Callback);\n" ].join + @cmock_generator_plugin_callback.include_count = false + returned = @cmock_generator_plugin_callback.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "add mock function implementation for functions of style 'void func(void)'" do + function = {:name => "Apple", :args => [], :args_string => "void", :return => test_return[:void]} + expected = [" if (Mock.Apple_CallbackFunctionPointer != NULL)\n", + " {\n", + " Mock.Apple_CallbackFunctionPointer(Mock.Apple_CallbackCalls++);\n", + " return;\n", + " }\n" + ].join + returned = @cmock_generator_plugin_callback.mock_implementation_precheck(function) + assert_equal(expected, returned) + end + + should "add mock function implementation for functions of style 'void func(void)' when count turned off" do + function = {:name => "Apple", :args => [], :args_string => "void", :return => test_return[:void]} + expected = [" if (Mock.Apple_CallbackFunctionPointer != NULL)\n", + " {\n", + " Mock.Apple_CallbackFunctionPointer();\n", + " return;\n", + " }\n" + ].join + @cmock_generator_plugin_callback.include_count = false + returned = @cmock_generator_plugin_callback.mock_implementation_precheck(function) + assert_equal(expected, returned) + end + + should "add mock function implementation for functions of style 'int func(void)'" do + function = {:name => "Apple", :args => [], :args_string => "void", :return => test_return[:int]} + expected = [" if (Mock.Apple_CallbackFunctionPointer != NULL)\n", + " {\n", + " return Mock.Apple_CallbackFunctionPointer(Mock.Apple_CallbackCalls++);\n", + " }\n" + ].join + returned = @cmock_generator_plugin_callback.mock_implementation_precheck(function) + assert_equal(expected, returned) + end + + should "add mock function implementation for functions of style 'void func(int* steak, uint8_t flag)'" do + function = {:name => "Apple", + :args => [ { :type => 'int*', :name => 'steak', :ptr? => true}, + { :type => 'uint8_t', :name => 'flag', :ptr? => false} ], + :args_string => "int* steak, uint8_t flag", + :return=> test_return[:void]} + expected = [" if (Mock.Apple_CallbackFunctionPointer != NULL)\n", + " {\n", + " Mock.Apple_CallbackFunctionPointer(steak, flag, Mock.Apple_CallbackCalls++);\n", + " return;\n", + " }\n" + ].join + returned = @cmock_generator_plugin_callback.mock_implementation_precheck(function) + assert_equal(expected, returned) + end + + should "add mock function implementation for functions of style 'void func(int* steak, uint8_t flag)' when count turned off" do + function = {:name => "Apple", + :args => [ { :type => 'int*', :name => 'steak', :ptr? => true}, + { :type => 'uint8_t', :name => 'flag', :ptr? => false} ], + :args_string => "int* steak, uint8_t flag", + :return=> test_return[:void]} + expected = [" if (Mock.Apple_CallbackFunctionPointer != NULL)\n", + " {\n", + " Mock.Apple_CallbackFunctionPointer(steak, flag);\n", + " return;\n", + " }\n" + ].join + @cmock_generator_plugin_callback.include_count = false + returned = @cmock_generator_plugin_callback.mock_implementation_precheck(function) + assert_equal(expected, returned) + end + + should "add mock function implementation for functions of style 'int16_t func(int* steak, uint8_t flag)'" do + function = {:name => "Apple", + :args => [ { :type => 'int*', :name => 'steak', :ptr? => true}, + { :type => 'uint8_t', :name => 'flag', :ptr? => false} ], + :args_string => "int* steak, uint8_t flag", + :return => test_return[:int]} + expected = [" if (Mock.Apple_CallbackFunctionPointer != NULL)\n", + " {\n", + " return Mock.Apple_CallbackFunctionPointer(steak, flag, Mock.Apple_CallbackCalls++);\n", + " }\n" + ].join + returned = @cmock_generator_plugin_callback.mock_implementation_precheck(function) + assert_equal(expected, returned) + end + + should "add mock interfaces for functions " do + function = {:name => "Lemon", + :args => [{ :type => "char*", :name => "pescado"}], + :args_string => "char* pescado", + :return => test_return[:int] + } + + expected = ["void Lemon_StubWithCallback(CMOCK_Lemon_CALLBACK Callback)\n", + "{\n", + " Mock.Lemon_CallbackFunctionPointer = Callback;\n", + "}\n\n" + ].join + returned = @cmock_generator_plugin_callback.mock_interfaces(function) + assert_equal(expected, returned) + end + + should "add mock destroy for functions" do + function = {:name => "Peach", :args => [], :return => test_return[:void] } + expected = " Mock.Peach_CallbackFunctionPointer = NULL;\n" + + " Mock.Peach_CallbackCalls = 0;\n" + returned = @cmock_generator_plugin_callback.mock_destroy(function) + assert_equal(expected, returned) + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_cexception_test.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_cexception_test.rb new file mode 100644 index 0000000..ac64f30 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_cexception_test.rb @@ -0,0 +1,94 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require File.expand_path(File.dirname(__FILE__)) + "/../test_helper" +require 'cmock_generator_plugin_cexception' + +class CMockGeneratorPluginCexceptionTest < Test::Unit::TestCase + def setup + create_mocks :config, :utils + @cmock_generator_plugin_cexception = CMockGeneratorPluginCexception.new(@config, @utils) + end + + def teardown + end + + should "have set up internal accessors correctly on init" do + assert_equal(@config, @cmock_generator_plugin_cexception.config) + assert_equal(@utils, @cmock_generator_plugin_cexception.utils) + assert_equal(7, @cmock_generator_plugin_cexception.priority) + end + + should "include the cexception library" do + expected = "#include \"CException.h\"\n" + returned = @cmock_generator_plugin_cexception.include_files + assert_equal(expected, returned) + end + + should "add to typedef structure mock needs" do + function = { :name => "Oak", :args => [], :return => test_return[:void] } + expected = " CEXCEPTION_T ExceptionToThrow;\n" + returned = @cmock_generator_plugin_cexception.instance_typedefs(function) + assert_equal(expected, returned) + end + + should "add mock function declarations for functions without arguments" do + function = { :name => "Spruce", :args_string => "void", :return => test_return[:void] } + expected = "#define Spruce_ExpectAndThrow(cmock_to_throw) Spruce_CMockExpectAndThrow(__LINE__, cmock_to_throw)\n"+ + "void Spruce_CMockExpectAndThrow(UNITY_LINE_TYPE cmock_line, CEXCEPTION_T cmock_to_throw);\n" + returned = @cmock_generator_plugin_cexception.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "add mock function declarations for functions with arguments" do + function = { :name => "Spruce", :args_string => "const char* Petunia, uint32_t Lily", :args_call => "Petunia, Lily", :return => test_return[:void] } + expected = "#define Spruce_ExpectAndThrow(Petunia, Lily, cmock_to_throw) Spruce_CMockExpectAndThrow(__LINE__, Petunia, Lily, cmock_to_throw)\n" + + "void Spruce_CMockExpectAndThrow(UNITY_LINE_TYPE cmock_line, const char* Petunia, uint32_t Lily, CEXCEPTION_T cmock_to_throw);\n" + returned = @cmock_generator_plugin_cexception.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "add a mock implementation" do + function = {:name => "Cherry", :args => [], :return => test_return[:void]} + expected = " if (cmock_call_instance->ExceptionToThrow != CEXCEPTION_NONE)\n {\n" + + " Throw(cmock_call_instance->ExceptionToThrow);\n }\n" + returned = @cmock_generator_plugin_cexception.mock_implementation(function) + assert_equal(expected, returned) + end + + should "add mock interfaces for functions without arguments" do + function = {:name => "Pear", :args_string => "void", :args => [], :return => test_return[:void]} + @utils.expect.code_add_base_expectation("Pear").returns("mock_retval_0") + @utils.expect.code_call_argument_loader(function).returns("") + + expected = ["void Pear_CMockExpectAndThrow(UNITY_LINE_TYPE cmock_line, CEXCEPTION_T cmock_to_throw)\n", + "{\n", + "mock_retval_0", + "", + " cmock_call_instance->ExceptionToThrow = cmock_to_throw;\n", + "}\n\n" + ].join + returned = @cmock_generator_plugin_cexception.mock_interfaces(function) + assert_equal(expected, returned) + end + + should "add a mock interfaces for functions with arguments" do + function = {:name => "Pear", :args_string => "int blah", :args => [{ :type => "int", :name => "blah" }], :return => test_return[:void]} + @utils.expect.code_add_base_expectation("Pear").returns("mock_retval_0") + @utils.expect.code_call_argument_loader(function).returns("mock_return_1") + + expected = ["void Pear_CMockExpectAndThrow(UNITY_LINE_TYPE cmock_line, int blah, CEXCEPTION_T cmock_to_throw)\n", + "{\n", + "mock_retval_0", + "mock_return_1", + " cmock_call_instance->ExceptionToThrow = cmock_to_throw;\n", + "}\n\n" + ].join + returned = @cmock_generator_plugin_cexception.mock_interfaces(function) + assert_equal(expected, returned) + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_expect_test.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_expect_test.rb new file mode 100644 index 0000000..fa85936 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_expect_test.rb @@ -0,0 +1,206 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require File.expand_path(File.dirname(__FILE__)) + "/../test_helper" +require 'cmock_generator_plugin_expect' + +class CMockGeneratorPluginExpectTest < Test::Unit::TestCase + def setup + create_mocks :config, :utils + + #no strict ordering and args_and_calls + @config.expect.when_ptr.returns(:compare_data) + @config.expect.enforce_strict_ordering.returns(false) + @config.stubs!(:respond_to?).returns(true) + # @config.expect.ignore.returns(:args_and_calls) + @utils.expect.helpers.returns({}) + @cmock_generator_plugin_expect = CMockGeneratorPluginExpect.new(@config, @utils) + + #strict ordering and args_only + @config.expect.when_ptr.returns(:compare_data) + @config.expect.enforce_strict_ordering.returns(true) + @config.stubs!(:respond_to?).returns(true) + # @config.expect.ignore.returns(:args_only) + @utils.expect.helpers.returns({}) + @cmock_generator_plugin_expect_strict = CMockGeneratorPluginExpect.new(@config, @utils) + end + + def teardown + end + + should "have set up internal accessors correctly on init" do + assert_equal(@config, @cmock_generator_plugin_expect.config) + assert_equal(@utils, @cmock_generator_plugin_expect.utils) + assert_equal(nil, @cmock_generator_plugin_expect.unity_helper) + assert_equal(5, @cmock_generator_plugin_expect.priority) + end + + should "not include any additional include files" do + assert(!@cmock_generator_plugin_expect.respond_to?(:include_files)) + end + + should "add to typedef structure mock needs of functions of style 'void func(void)'" do + function = {:name => "Oak", :args => [], :return => test_return[:void]} + expected = "" + returned = @cmock_generator_plugin_expect.instance_typedefs(function) + assert_equal(expected, returned) + end + + should "add to typedef structure mock needs of functions of style 'int func(void)'" do + function = {:name => "Elm", :args => [], :return => test_return[:int]} + expected = " int ReturnVal;\n" + returned = @cmock_generator_plugin_expect.instance_typedefs(function) + assert_equal(expected, returned) + end + + should "add to typedef structure mock needs of functions of style 'void func(int chicken, char* pork)'" do + function = {:name => "Cedar", :args => [{ :name => "chicken", :type => "int"}, { :name => "pork", :type => "char*"}], :return => test_return[:void]} + expected = " int Expected_chicken;\n char* Expected_pork;\n" + returned = @cmock_generator_plugin_expect.instance_typedefs(function) + assert_equal(expected, returned) + end + + should "add to typedef structure mock needs of functions of style 'int func(float beef)'" do + function = {:name => "Birch", :args => [{ :name => "beef", :type => "float"}], :return => test_return[:int]} + expected = " int ReturnVal;\n float Expected_beef;\n" + returned = @cmock_generator_plugin_expect.instance_typedefs(function) + assert_equal(expected, returned) + end + + should "add to typedef structure mock needs of functions of style 'void func(void)' and global ordering" do + function = {:name => "Oak", :args => [], :return => test_return[:void]} + expected = " int CallOrder;\n" + returned = @cmock_generator_plugin_expect_strict.instance_typedefs(function) + assert_equal(expected, returned) + end + + should "add mock function declaration for functions of style 'void func(void)'" do + function = {:name => "Maple", :args => [], :return => test_return[:void]} + expected = "#define Maple_Expect() Maple_CMockExpect(__LINE__)\n" + + "void Maple_CMockExpect(UNITY_LINE_TYPE cmock_line);\n" + returned = @cmock_generator_plugin_expect.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "add mock function declaration for functions of style 'int func(void)'" do + function = {:name => "Spruce", :args => [], :return => test_return[:int]} + expected = "#define Spruce_ExpectAndReturn(cmock_retval) Spruce_CMockExpectAndReturn(__LINE__, cmock_retval)\n" + + "void Spruce_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, int cmock_to_return);\n" + returned = @cmock_generator_plugin_expect.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "add mock function declaration for functions of style 'const char* func(int tofu)'" do + function = {:name => "Pine", :args => ["int tofu"], :args_string => "int tofu", :args_call => 'tofu', :return => test_return[:string]} + expected = "#define Pine_ExpectAndReturn(tofu, cmock_retval) Pine_CMockExpectAndReturn(__LINE__, tofu, cmock_retval)\n" + + "void Pine_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, int tofu, const char* cmock_to_return);\n" + returned = @cmock_generator_plugin_expect.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "add mock function implementation for functions of style 'void func(void)'" do + function = {:name => "Apple", :args => [], :return => test_return[:void]} + expected = "" + returned = @cmock_generator_plugin_expect.mock_implementation(function) + assert_equal(expected, returned) + end + + should "add mock function implementation for functions of style 'int func(int veal, unsigned int sushi)'" do + function = {:name => "Cherry", :args => [ { :type => "int", :name => "veal" }, { :type => "unsigned int", :name => "sushi" } ], :return => test_return[:int]} + + @utils.expect.code_verify_an_arg_expectation(function, function[:args][0]).returns(" mocked_retval_1") + @utils.expect.code_verify_an_arg_expectation(function, function[:args][1]).returns(" mocked_retval_2") + expected = " mocked_retval_1 mocked_retval_2" + returned = @cmock_generator_plugin_expect.mock_implementation(function) + assert_equal(expected, returned) + end + + should "add mock function implementation using ordering if needed" do + function = {:name => "Apple", :args => [], :return => test_return[:void]} + expected = "" + @cmock_generator_plugin_expect.ordered = true + returned = @cmock_generator_plugin_expect.mock_implementation(function) + assert_equal(expected, returned) + end + + should "add mock function implementation for functions of style 'void func(int worm)' and strict ordering" do + function = {:name => "Apple", :args => [{ :type => "int", :name => "worm" }], :return => test_return[:void]} + @utils.expect.code_verify_an_arg_expectation(function, function[:args][0]).returns("mocked_retval_0") + expected = "mocked_retval_0" + @cmock_generator_plugin_expect.ordered = true + returned = @cmock_generator_plugin_expect_strict.mock_implementation(function) + assert_equal(expected, returned) + end + + should "add mock interfaces for functions of style 'void func(void)'" do + function = {:name => "Pear", :args => [], :args_string => "void", :return => test_return[:void]} + @utils.expect.code_add_base_expectation("Pear").returns("mock_retval_0 ") + @utils.expect.code_call_argument_loader(function).returns("mock_retval_1 ") + expected = ["void Pear_CMockExpect(UNITY_LINE_TYPE cmock_line)\n", + "{\n", + "mock_retval_0 ", + "mock_retval_1 ", + "}\n\n" + ].join + returned = @cmock_generator_plugin_expect.mock_interfaces(function) + assert_equal(expected, returned) + end + + should "add mock interfaces for functions of style 'int func(void)'" do + function = {:name => "Orange", :args => [], :args_string => "void", :return => test_return[:int]} + @utils.expect.code_add_base_expectation("Orange").returns("mock_retval_0 ") + @utils.expect.code_call_argument_loader(function).returns("mock_retval_1 ") + @utils.expect.code_assign_argument_quickly("cmock_call_instance->ReturnVal", function[:return]).returns("mock_retval_2") + expected = ["void Orange_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, int cmock_to_return)\n", + "{\n", + "mock_retval_0 ", + "mock_retval_1 ", + "mock_retval_2", + "}\n\n" + ].join + returned = @cmock_generator_plugin_expect.mock_interfaces(function) + assert_equal(expected, returned) + end + + should "add mock interfaces for functions of style 'int func(char* pescado)'" do + function = {:name => "Lemon", :args => [{ :type => "char*", :name => "pescado"}], :args_string => "char* pescado", :return => test_return[:int]} + @utils.expect.code_add_base_expectation("Lemon").returns("mock_retval_0 ") + @utils.expect.code_call_argument_loader(function).returns("mock_retval_1 ") + @utils.expect.code_assign_argument_quickly("cmock_call_instance->ReturnVal", function[:return]).returns("mock_retval_2") + expected = ["void Lemon_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, char* pescado, int cmock_to_return)\n", + "{\n", + "mock_retval_0 ", + "mock_retval_1 ", + "mock_retval_2", + "}\n\n" + ].join + returned = @cmock_generator_plugin_expect.mock_interfaces(function) + assert_equal(expected, returned) + end + + should "add mock interfaces for functions when using ordering" do + function = {:name => "Pear", :args => [], :args_string => "void", :return => test_return[:void]} + @utils.expect.code_add_base_expectation("Pear").returns("mock_retval_0 ") + @utils.expect.code_call_argument_loader(function).returns("mock_retval_1 ") + expected = ["void Pear_CMockExpect(UNITY_LINE_TYPE cmock_line)\n", + "{\n", + "mock_retval_0 ", + "mock_retval_1 ", + "}\n\n" + ].join + @cmock_generator_plugin_expect.ordered = true + returned = @cmock_generator_plugin_expect.mock_interfaces(function) + assert_equal(expected, returned) + end + + should "add mock verify lines" do + function = {:name => "Banana" } + expected = " UNITY_TEST_ASSERT(CMOCK_GUTS_NONE == Mock.Banana_CallInstance, cmock_line, \"Function 'Banana' called less times than expected.\");\n" + returned = @cmock_generator_plugin_expect.mock_verify(function) + assert_equal(expected, returned) + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_ignore_test.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_ignore_test.rb new file mode 100644 index 0000000..15f72cc --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_ignore_test.rb @@ -0,0 +1,159 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require File.expand_path(File.dirname(__FILE__)) + "/../test_helper" +require 'cmock_generator_plugin_ignore' + +class CMockGeneratorPluginIgnoreTest < Test::Unit::TestCase + def setup + create_mocks :config, :utils + @config.expect.ignore.returns(:args_and_calls) + @config.stubs!(:respond_to?).returns(true) + @cmock_generator_plugin_ignore = CMockGeneratorPluginIgnore.new(@config, @utils) + + @config.expect.ignore.returns(:args_only) + @cmock_generator_plugin_ignore_just_args = CMockGeneratorPluginIgnore.new(@config, @utils) + end + + def teardown + end + + should "have set up internal accessors correctly on init" do + assert_equal(@config, @cmock_generator_plugin_ignore.config) + assert_equal(@utils, @cmock_generator_plugin_ignore.utils) + assert_equal(2, @cmock_generator_plugin_ignore.priority) + end + + should "not have any additional include file requirements" do + assert(!@cmock_generator_plugin_ignore.respond_to?(:include_files)) + end + + should "add a required variable to the instance structure" do + function = {:name => "Grass", :args => [], :return => test_return[:void]} + expected = " int Grass_IgnoreBool;\n" + returned = @cmock_generator_plugin_ignore.instance_structure(function) + assert_equal(expected, returned) + end + + should "handle function declarations for functions without return values" do + function = {:name => "Mold", :args_string => "void", :return => test_return[:void]} + expected = "#define Mold_Ignore() Mold_CMockIgnore(__LINE__)\nvoid Mold_CMockIgnore(UNITY_LINE_TYPE cmock_line);\n" + returned = @cmock_generator_plugin_ignore.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "handle function declarations for functions that returns something" do + function = {:name => "Fungus", :args_string => "void", :return => test_return[:string]} + expected = "#define Fungus_IgnoreAndReturn(cmock_retval) Fungus_CMockIgnoreAndReturn(__LINE__, cmock_retval)\n"+ + "void Fungus_CMockIgnoreAndReturn(UNITY_LINE_TYPE cmock_line, const char* cmock_to_return);\n" + returned = @cmock_generator_plugin_ignore.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "add required code to implementation precheck with void function (when :args_and_calls)" do + function = {:name => "Mold", :args_string => "void", :return => test_return[:void]} + expected = [" if (Mock.Mold_IgnoreBool)\n", + " {\n", + " return;\n", + " }\n" + ].join + returned = @cmock_generator_plugin_ignore.mock_implementation_for_ignores(function) + assert_equal(expected, returned) + end + + should "add required code to implementation precheck with return functions (when :args_and_calls)" do + function = {:name => "Fungus", :args_string => "void", :return => test_return[:int]} + retval = test_return[:int].merge({ :name => "cmock_call_instance->ReturnVal"}) + @utils.expect.code_assign_argument_quickly("Mock.Fungus_FinalReturn", retval).returns(' mock_retval_0') + expected = [" if (Mock.Fungus_IgnoreBool)\n", + " {\n", + " if (cmock_call_instance == NULL)\n", + " return Mock.Fungus_FinalReturn;\n", + " mock_retval_0", + " return cmock_call_instance->ReturnVal;\n", + " }\n" + ].join + returned = @cmock_generator_plugin_ignore.mock_implementation_for_ignores(function) + assert_equal(expected, returned) + end + + should "not add code to implementation prefix (when :args_only)" do + function = {:name => "Fungus", :args_string => "void", :return => test_return[:int]} + retval = test_return[:int].merge({ :name => "cmock_call_instance->ReturnVal"}) + expected = "" + returned = @cmock_generator_plugin_ignore.mock_implementation_precheck(function) + assert_equal(expected, returned) + end + + should "add required code to implementation with void function (when :args_only)" do + function = {:name => "Mold", :args_string => "void", :return => test_return[:void]} + expected = [" if (Mock.Mold_IgnoreBool)\n", + " {\n", + " return;\n", + " }\n" + ].join + returned = @cmock_generator_plugin_ignore_just_args.mock_implementation(function) + assert_equal(expected, returned) + end + + should "add required code to implementation with return functions (when :args_only)" do + function = {:name => "Fungus", :args_string => "void", :return => test_return[:int]} + retval = test_return[:int].merge({ :name => "cmock_call_instance->ReturnVal"}) + @utils.expect.code_assign_argument_quickly("Mock.Fungus_FinalReturn", retval).returns(' mock_retval_0') + expected = [" if (Mock.Fungus_IgnoreBool)\n", + " {\n", + " if (cmock_call_instance == NULL)\n", + " return Mock.Fungus_FinalReturn;\n", + " mock_retval_0", + " return cmock_call_instance->ReturnVal;\n", + " }\n" + ].join + returned = @cmock_generator_plugin_ignore_just_args.mock_implementation(function) + assert_equal(expected, returned) + end + + should "add a new mock interface for ignoring when function had no return value" do + function = {:name => "Slime", :args => [], :args_string => "void", :return => test_return[:void]} + expected = ["void Slime_CMockIgnore(UNITY_LINE_TYPE cmock_line)\n", + "{\n", + " Mock.Slime_IgnoreBool = (int)1;\n", + "}\n\n" + ].join + @config.expect.ignore.returns(:args_and_calls) + returned = @cmock_generator_plugin_ignore.mock_interfaces(function) + assert_equal(expected, returned) + end + + should "add a new mock interface for ignoring when function had no return value and we are checking args only" do + function = {:name => "Slime", :args => [], :args_string => "void", :return => test_return[:void]} + expected = ["void Slime_CMockIgnore(UNITY_LINE_TYPE cmock_line)\n", + "{\n", + "mock_return_1", + " Mock.Slime_IgnoreBool = (int)1;\n", + "}\n\n" + ].join + @config.expect.ignore.returns(:args_only) + @utils.expect.code_add_base_expectation("Slime", true).returns("mock_return_1") + returned = @cmock_generator_plugin_ignore.mock_interfaces(function) + assert_equal(expected, returned) + end + + should "add a new mock interface for ignoring when function has return value" do + function = {:name => "Slime", :args => [], :args_string => "void", :return => test_return[:int]} + @config.expect.ignore.returns(:args_and_calls) + @utils.expect.code_add_base_expectation("Slime", false).returns("mock_return_1") + expected = ["void Slime_CMockIgnoreAndReturn(UNITY_LINE_TYPE cmock_line, int cmock_to_return)\n", + "{\n", + "mock_return_1", + " cmock_call_instance->ReturnVal = cmock_to_return;\n", + " Mock.Slime_IgnoreBool = (int)1;\n", + "}\n\n" + ].join + returned = @cmock_generator_plugin_ignore.mock_interfaces(function) + assert_equal(expected, returned) + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/unit/cmock_generator_utils_test.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/unit/cmock_generator_utils_test.rb new file mode 100644 index 0000000..7b24fe3 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/unit/cmock_generator_utils_test.rb @@ -0,0 +1,291 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require File.expand_path(File.dirname(__FILE__)) + "/../test_helper" +require 'cmock_generator_utils' + +class CMockGeneratorUtilsTest < Test::Unit::TestCase + def setup + create_mocks :config, :unity_helper, :unity_helper + + @config.expect.when_ptr.returns(:compare_ptr) + @config.expect.enforce_strict_ordering.returns(false) + @config.expect.plugins.returns([]) + @config.expect.plugins.returns([]) + @config.expect.treat_as.returns(['int','short','long','char','char*']) + @cmock_generator_utils_simple = CMockGeneratorUtils.new(@config, {:unity_helper => @unity_helper}) + + @config.expect.when_ptr.returns(:smart) + @config.expect.enforce_strict_ordering.returns(true) + @config.expect.plugins.returns([:array, :cexception]) + @config.expect.plugins.returns([:array, :cexception]) + @config.expect.treat_as.returns(['int','short','long','char','uint32_t','char*']) + @cmock_generator_utils_complex = CMockGeneratorUtils.new(@config, {:unity_helper => @unity_helper, :A=>1, :B=>2}) + end + + def teardown + end + + should "have set up internal accessors correctly on init" do + assert_equal(@config, @cmock_generator_utils_simple.config) + assert_equal({:unity_helper => @unity_helper}, @cmock_generator_utils_simple.helpers) + assert_equal(false, @cmock_generator_utils_simple.arrays) + assert_equal(false, @cmock_generator_utils_simple.cexception) + end + + should "have set up internal accessors correctly on init, complete with passed helpers" do + assert_equal(@config, @cmock_generator_utils_complex.config) + assert_equal({:unity_helper => @unity_helper, :A=>1, :B=>2},@cmock_generator_utils_complex.helpers) + assert_equal(true, @cmock_generator_utils_complex.arrays) + assert_equal(true, @cmock_generator_utils_complex.cexception) + end + + should "add code for a base expectation with no plugins" do + expected = + " CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_Apple_CALL_INSTANCE));\n" + + " CMOCK_Apple_CALL_INSTANCE* cmock_call_instance = (CMOCK_Apple_CALL_INSTANCE*)CMock_Guts_GetAddressFor(cmock_guts_index);\n" + + " UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, \"CMock has run out of memory. Please allocate more.\");\n" + + " Mock.Apple_CallInstance = CMock_Guts_MemChain(Mock.Apple_CallInstance, cmock_guts_index);\n" + + " cmock_call_instance->LineNumber = cmock_line;\n" + output = @cmock_generator_utils_simple.code_add_base_expectation("Apple") + assert_equal(expected, output) + end + + should "add code for a base expectation with all plugins" do + expected = + " CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_Apple_CALL_INSTANCE));\n" + + " CMOCK_Apple_CALL_INSTANCE* cmock_call_instance = (CMOCK_Apple_CALL_INSTANCE*)CMock_Guts_GetAddressFor(cmock_guts_index);\n" + + " UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, \"CMock has run out of memory. Please allocate more.\");\n" + + " Mock.Apple_CallInstance = CMock_Guts_MemChain(Mock.Apple_CallInstance, cmock_guts_index);\n" + + " cmock_call_instance->LineNumber = cmock_line;\n" + + " cmock_call_instance->CallOrder = ++GlobalExpectCount;\n" + + " cmock_call_instance->ExceptionToThrow = CEXCEPTION_NONE;\n" + output = @cmock_generator_utils_complex.code_add_base_expectation("Apple", true) + assert_equal(expected, output) + end + + should "add code for a base expectation with all plugins and ordering not supported" do + expected = + " CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_Apple_CALL_INSTANCE));\n" + + " CMOCK_Apple_CALL_INSTANCE* cmock_call_instance = (CMOCK_Apple_CALL_INSTANCE*)CMock_Guts_GetAddressFor(cmock_guts_index);\n" + + " UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, \"CMock has run out of memory. Please allocate more.\");\n" + + " Mock.Apple_CallInstance = CMock_Guts_MemChain(Mock.Apple_CallInstance, cmock_guts_index);\n" + + " cmock_call_instance->LineNumber = cmock_line;\n" + + " cmock_call_instance->ExceptionToThrow = CEXCEPTION_NONE;\n" + output = @cmock_generator_utils_complex.code_add_base_expectation("Apple", false) + assert_equal(expected, output) + end + + should "add argument expectations for values when no array plugin" do + arg1 = { :name => "Orange", :const? => false, :type => 'int', :ptr? => false } + expected1 = " cmock_call_instance->Expected_Orange = Orange;\n" + + arg2 = { :name => "Lemon", :const? => true, :type => 'const char*', :ptr? => true } + expected2 = " cmock_call_instance->Expected_Lemon = (const char*)Lemon;\n" + + arg3 = { :name => "Kiwi", :const? => false, :type => 'KIWI_T*', :ptr? => true } + expected3 = " cmock_call_instance->Expected_Kiwi = Kiwi;\n" + + arg4 = { :name => "Lime", :const? => false, :type => 'LIME_T', :ptr? => false } + expected4 = " memcpy(&cmock_call_instance->Expected_Lime, &Lime, sizeof(LIME_T));\n" + + assert_equal(expected1, @cmock_generator_utils_simple.code_add_an_arg_expectation(arg1)) + assert_equal(expected2, @cmock_generator_utils_simple.code_add_an_arg_expectation(arg2)) + assert_equal(expected3, @cmock_generator_utils_simple.code_add_an_arg_expectation(arg3)) + assert_equal(expected4, @cmock_generator_utils_simple.code_add_an_arg_expectation(arg4)) + end + + should "add argument expectations for values when array plugin enabled" do + arg1 = { :name => "Orange", :const? => false, :type => 'int', :ptr? => false } + expected1 = " cmock_call_instance->Expected_Orange = Orange;\n" + + arg2 = { :name => "Lemon", :const? => true, :type => 'const char*', :ptr? => true } + expected2 = " cmock_call_instance->Expected_Lemon = (const char*)Lemon;\n" + + " cmock_call_instance->Expected_Lemon_Depth = Lemon_Depth;\n" + + arg3 = { :name => "Kiwi", :const? => false, :type => 'KIWI_T*', :ptr? => true } + expected3 = " cmock_call_instance->Expected_Kiwi = Kiwi;\n" + + " cmock_call_instance->Expected_Kiwi_Depth = Kiwi_Depth;\n" + + arg4 = { :name => "Lime", :const? => false, :type => 'LIME_T', :ptr? => false } + expected4 = " memcpy(&cmock_call_instance->Expected_Lime, &Lime, sizeof(LIME_T));\n" + + assert_equal(expected1, @cmock_generator_utils_complex.code_add_an_arg_expectation(arg1)) + assert_equal(expected2, @cmock_generator_utils_complex.code_add_an_arg_expectation(arg2, 'Lemon_Depth')) + assert_equal(expected3, @cmock_generator_utils_complex.code_add_an_arg_expectation(arg3, 'Lemon_Depth')) + assert_equal(expected4, @cmock_generator_utils_complex.code_add_an_arg_expectation(arg4)) + end + + should 'not have an argument loader when the function has no arguments' do + function = { :name => "Melon", :args_string => "void" } + + assert_equal("", @cmock_generator_utils_complex.code_add_argument_loader(function)) + end + + should 'create an argument loader when the function has arguments' do + function = { :name => "Melon", + :args_string => "stuff", + :args => [test_arg[:int_ptr], test_arg[:mytype], test_arg[:string]] + } + expected = "void CMockExpectParameters_Melon(CMOCK_Melon_CALL_INSTANCE* cmock_call_instance, stuff)\n{\n" + + " cmock_call_instance->Expected_MyIntPtr = MyIntPtr;\n" + + " memcpy(&cmock_call_instance->Expected_MyMyType, &MyMyType, sizeof(MY_TYPE));\n" + + " cmock_call_instance->Expected_MyStr = (char*)MyStr;\n" + + "}\n\n" + assert_equal(expected, @cmock_generator_utils_simple.code_add_argument_loader(function)) + end + + should 'create an argument loader when the function has arguments supporting arrays' do + function = { :name => "Melon", + :args_string => "stuff", + :args => [test_arg[:int_ptr], test_arg[:mytype], test_arg[:string]] + } + expected = "void CMockExpectParameters_Melon(CMOCK_Melon_CALL_INSTANCE* cmock_call_instance, int* MyIntPtr, int MyIntPtr_Depth, const MY_TYPE MyMyType, const char* MyStr)\n{\n" + + " cmock_call_instance->Expected_MyIntPtr = MyIntPtr;\n" + + " cmock_call_instance->Expected_MyIntPtr_Depth = MyIntPtr_Depth;\n" + + " memcpy(&cmock_call_instance->Expected_MyMyType, &MyMyType, sizeof(MY_TYPE));\n" + + " cmock_call_instance->Expected_MyStr = (char*)MyStr;\n" + + "}\n\n" + assert_equal(expected, @cmock_generator_utils_complex.code_add_argument_loader(function)) + end + + should "not call argument loader if there are no arguments to actually use for this function" do + function = { :name => "Pineapple", :args_string => "void" } + + assert_equal("", @cmock_generator_utils_complex.code_call_argument_loader(function)) + end + + should 'call an argument loader when the function has arguments' do + function = { :name => "Pineapple", + :args_string => "stuff", + :args => [test_arg[:int_ptr], test_arg[:mytype], test_arg[:string]] + } + expected = " CMockExpectParameters_Pineapple(cmock_call_instance, MyIntPtr, MyMyType, MyStr);\n" + assert_equal(expected, @cmock_generator_utils_simple.code_call_argument_loader(function)) + end + + should 'call an argument loader when the function has arguments with arrays' do + function = { :name => "Pineapple", + :args_string => "stuff", + :args => [test_arg[:int_ptr], test_arg[:mytype], test_arg[:string]] + } + expected = " CMockExpectParameters_Pineapple(cmock_call_instance, MyIntPtr, 1, MyMyType, MyStr);\n" + assert_equal(expected, @cmock_generator_utils_complex.code_call_argument_loader(function)) + end + + should 'handle a simple assert when requested' do + function = { :name => 'Pear' } + arg = test_arg[:int] + expected = " UNITY_TEST_ASSERT_EQUAL_INT(cmock_call_instance->Expected_MyInt, MyInt, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyInt'.\");\n" + @unity_helper.expect.get_helper('int').returns(['UNITY_TEST_ASSERT_EQUAL_INT','']) + assert_equal(expected, @cmock_generator_utils_simple.code_verify_an_arg_expectation(function, arg)) + end + + should 'handle a pointer comparison when configured to do so' do + function = { :name => 'Pear' } + arg = test_arg[:int_ptr] + expected = " UNITY_TEST_ASSERT_EQUAL_PTR(cmock_call_instance->Expected_MyIntPtr, MyIntPtr, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyIntPtr'.\");\n" + assert_equal(expected, @cmock_generator_utils_simple.code_verify_an_arg_expectation(function, arg)) + end + + should 'handle const char as string compares ' do + function = { :name => 'Pear' } + arg = test_arg[:string] + expected = " UNITY_TEST_ASSERT_EQUAL_STRING(cmock_call_instance->Expected_MyStr, MyStr, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyStr'.\");\n" + @unity_helper.expect.get_helper('char*').returns(['UNITY_TEST_ASSERT_EQUAL_STRING','']) + assert_equal(expected, @cmock_generator_utils_simple.code_verify_an_arg_expectation(function, arg)) + end + + should 'handle custom types as memory compares when we have no better way to do it' do + function = { :name => 'Pear' } + arg = test_arg[:mytype] + expected = " UNITY_TEST_ASSERT_EQUAL_MEMORY((void*)(&cmock_call_instance->Expected_MyMyType), (void*)(&MyMyType), sizeof(MY_TYPE), cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyMyType'.\");\n" + @unity_helper.expect.get_helper('MY_TYPE').returns(['UNITY_TEST_ASSERT_EQUAL_MEMORY','&']) + assert_equal(expected, @cmock_generator_utils_simple.code_verify_an_arg_expectation(function, arg)) + end + + should 'handle custom types with custom handlers when available, even if they do not support the extra message' do + function = { :name => 'Pear' } + arg = test_arg[:mytype] + expected = " UNITY_TEST_ASSERT_EQUAL_MY_TYPE(cmock_call_instance->Expected_MyMyType, MyMyType, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyMyType'.\");\n" + @unity_helper.expect.get_helper('MY_TYPE').returns(['UNITY_TEST_ASSERT_EQUAL_MY_TYPE','']) + assert_equal(expected, @cmock_generator_utils_simple.code_verify_an_arg_expectation(function, arg)) + end + + should 'handle pointers to custom types with array handlers, even if the array extension is turned off' do + function = { :name => 'Pear' } + arg = test_arg[:mytype] + expected = " UNITY_TEST_ASSERT_EQUAL_MY_TYPE_ARRAY(&cmock_call_instance->Expected_MyMyType, &MyMyType, 1, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyMyType'.\");\n" + @unity_helper.expect.get_helper('MY_TYPE').returns(['UNITY_TEST_ASSERT_EQUAL_MY_TYPE_ARRAY','&']) + assert_equal(expected, @cmock_generator_utils_simple.code_verify_an_arg_expectation(function, arg)) + end + + should 'handle a simple assert when requested with array plugin enabled' do + function = { :name => 'Pear' } + arg = test_arg[:int] + expected = " UNITY_TEST_ASSERT_EQUAL_INT(cmock_call_instance->Expected_MyInt, MyInt, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyInt'.\");\n" + @unity_helper.expect.get_helper('int').returns(['UNITY_TEST_ASSERT_EQUAL_INT','']) + assert_equal(expected, @cmock_generator_utils_complex.code_verify_an_arg_expectation(function, arg)) + end + + should 'handle an array comparison with array plugin enabled' do + function = { :name => 'Pear' } + arg = test_arg[:int_ptr] + expected = " if (cmock_call_instance->Expected_MyIntPtr == NULL)\n" + + " { UNITY_TEST_ASSERT_NULL(MyIntPtr, cmock_line, \"Expected NULL. Function 'Pear' called with unexpected value for argument 'MyIntPtr'.\"); }\n" + + " else if (cmock_call_instance->Expected_MyIntPtr_Depth == 0)\n" + + " { UNITY_TEST_ASSERT_EQUAL_PTR(cmock_call_instance->Expected_MyIntPtr, MyIntPtr, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyIntPtr'.\"); }\n" + + " else\n" + + " { UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(cmock_call_instance->Expected_MyIntPtr, MyIntPtr, cmock_call_instance->Expected_MyIntPtr_Depth, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyIntPtr'.\"); }\n" + @unity_helper.expect.get_helper('int*').returns(['UNITY_TEST_ASSERT_EQUAL_INT_ARRAY','']) + assert_equal(expected, @cmock_generator_utils_complex.code_verify_an_arg_expectation(function, arg)) + end + + should 'handle const char as string compares with array plugin enabled' do + function = { :name => 'Pear' } + arg = test_arg[:string] + expected = " UNITY_TEST_ASSERT_EQUAL_STRING(cmock_call_instance->Expected_MyStr, MyStr, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyStr'.\");\n" + @unity_helper.expect.get_helper('char*').returns(['UNITY_TEST_ASSERT_EQUAL_STRING','']) + assert_equal(expected, @cmock_generator_utils_complex.code_verify_an_arg_expectation(function, arg)) + end + + should 'handle custom types as memory compares when we have no better way to do it with array plugin enabled' do + function = { :name => 'Pear' } + arg = test_arg[:mytype] + expected = " UNITY_TEST_ASSERT_EQUAL_MEMORY((void*)(&cmock_call_instance->Expected_MyMyType), (void*)(&MyMyType), sizeof(MY_TYPE), cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyMyType'.\");\n" + @unity_helper.expect.get_helper('MY_TYPE').returns(['UNITY_TEST_ASSERT_EQUAL_MEMORY','&']) + assert_equal(expected, @cmock_generator_utils_complex.code_verify_an_arg_expectation(function, arg)) + end + + should 'handle custom types with custom handlers when available, even if they do not support the extra message with array plugin enabled' do + function = { :name => 'Pear' } + arg = test_arg[:mytype] + expected = " UNITY_TEST_ASSERT_EQUAL_MY_TYPE(cmock_call_instance->Expected_MyMyType, MyMyType, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyMyType'.\");\n" + @unity_helper.expect.get_helper('MY_TYPE').returns(['UNITY_TEST_ASSERT_EQUAL_MY_TYPE','']) + assert_equal(expected, @cmock_generator_utils_complex.code_verify_an_arg_expectation(function, arg)) + end + + should 'handle custom types with array handlers when array plugin is enabled' do + function = { :name => 'Pear' } + arg = test_arg[:mytype_ptr] + expected = " if (cmock_call_instance->Expected_MyMyTypePtr == NULL)\n" + + " { UNITY_TEST_ASSERT_NULL(MyMyTypePtr, cmock_line, \"Expected NULL. Function 'Pear' called with unexpected value for argument 'MyMyTypePtr'.\"); }\n" + + " else if (cmock_call_instance->Expected_MyMyTypePtr_Depth == 0)\n" + + " { UNITY_TEST_ASSERT_EQUAL_PTR(cmock_call_instance->Expected_MyMyTypePtr, MyMyTypePtr, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyMyTypePtr'.\"); }\n" + + " else\n" + + " { UNITY_TEST_ASSERT_EQUAL_MY_TYPE_ARRAY(cmock_call_instance->Expected_MyMyTypePtr, MyMyTypePtr, cmock_call_instance->Expected_MyMyTypePtr_Depth, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyMyTypePtr'.\"); }\n" + @unity_helper.expect.get_helper('MY_TYPE*').returns(['UNITY_TEST_ASSERT_EQUAL_MY_TYPE_ARRAY','']) + assert_equal(expected, @cmock_generator_utils_complex.code_verify_an_arg_expectation(function, arg)) + end + + should 'handle custom types with array handlers when array plugin is enabled for non-array types' do + function = { :name => 'Pear' } + arg = test_arg[:mytype] + expected = " UNITY_TEST_ASSERT_EQUAL_MY_TYPE_ARRAY(&cmock_call_instance->Expected_MyMyType, &MyMyType, 1, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyMyType'.\");\n" + @unity_helper.expect.get_helper('MY_TYPE').returns(['UNITY_TEST_ASSERT_EQUAL_MY_TYPE_ARRAY','&']) + assert_equal(expected, @cmock_generator_utils_complex.code_verify_an_arg_expectation(function, arg)) + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/unit/cmock_header_parser_test.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/unit/cmock_header_parser_test.rb new file mode 100644 index 0000000..6517abd --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/unit/cmock_header_parser_test.rb @@ -0,0 +1,1170 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +$ThisIsOnlyATest = true + +require File.expand_path(File.dirname(__FILE__)) + "/../test_helper" +require 'cmock_header_parser' + +class CMockHeaderParserTest < Test::Unit::TestCase + + def setup + create_mocks :config + @test_name = 'test_file.h' + @config.expect.strippables.returns(['(?:__attribute__\s*\(+.*?\)+)']) + @config.expect.attributes.returns(['__ramfunc', 'funky_attrib']) + @config.expect.treat_as_void.returns(['MY_FUNKY_VOID']) + @config.expect.treat_as.returns({ "BANJOS" => "INT", "TUBAS" => "HEX16"} ) + @config.expect.when_no_prototypes.returns(:error) + @config.expect.verbosity.returns(1) + @config.expect.treat_externs.returns(:exclude) + + @parser = CMockHeaderParser.new(@config) + end + + def teardown + end + + should "create and initialize variables to defaults appropriately" do + assert_equal([], @parser.funcs) + assert_equal(['const', '__ramfunc', 'funky_attrib'], @parser.c_attributes) + assert_equal(['void','MY_FUNKY_VOID'], @parser.treat_as_void) + end + + should "strip out line comments" do + source = + " abcd;\n" + + "// hello;\n" + + "who // is you\n" + + expected = + [ + "abcd", + "who" + ] + + assert_equal(expected, @parser.import_source(source).map!{|s|s.strip}) + end + + + should "remove block comments" do + source = + " no_comments;\n" + + "// basic_line_comment;\n" + + "/* basic_block_comment;*/\n" + + "pre_block; /* start_of_block_comment;\n" + + "// embedded_line_comment_in_block_comment; */\n" + + "// /* commented_out_block_comment_line\n" + + "shown_because_block_comment_invalid_from_line_comment;\n" + + "// */\n" + + "//* shorter_commented_out_block_comment_line; \n" + + "shown_because_block_comment_invalid_from_shorter_line_comment;\n" + + "/*/\n" + + "not_shown_because_line_above_started_comment;\n" + + "//*/\n" + + "/* \n" + + "not_shown_because_block_comment_started_this_time;\n" + + "/*/\n" + + "shown_because_line_above_ended_comment_this_time;\n" + + "//*/\n" + + expected = + [ + "no_comments", + "pre_block", + "shown_because_block_comment_invalid_from_line_comment", + "shown_because_block_comment_invalid_from_shorter_line_comment", + "shown_because_line_above_ended_comment_this_time" + ] + + assert_equal(expected, @parser.import_source(source).map!{|s|s.strip}) + end + + + should "remove preprocessor directives" do + source = + "#when stuff_happens\n" + + "#ifdef _TEST\n" + + "#pragma stack_switch" + + expected = [] + + assert_equal(expected, @parser.import_source(source)) + end + + + should "remove assembler pragma sections" do + source = + " #pragma\tasm\n" + + " .foo\n" + + " lda %m\n" + + " nop\n" + + "# pragma endasm \n" + + "foo" + + expected = ["foo"] + + assert_equal(expected, @parser.import_source(source)) + end + + + should "smush lines together that contain continuation characters" do + source = + "hoo hah \\\n" + + "when \\ \n" + + expected = + [ + "hoo hah when" + ] + + assert_equal(expected, @parser.import_source(source).map!{|s|s.strip}) + end + + + should "remove C macro definitions" do + source = + "#define this is the first line\\\n" + + "and the second\\\n" + + "and the third that should be removed\n" + + "but I'm here\n" + + expected = ["but I'm here"] + + assert_equal(expected, @parser.import_source(source)) + end + + + should "remove typedef statements" do + source = + "typedef uint32 (unsigned int);\n" + + "const typedef int INT;\n" + + "int notatypedef;\n" + + "int typedef_isnt_me;\n" + + " typedef who cares what really comes here \\\n" + # exercise multiline typedef + " continuation;\n" + + "this should remain!;\n" + + "typedef blah bleh;\n" + + "typedef struct shell_command_struct {\n" + + " char_ptr COMMAND;\n" + + " int_32 (*SHELL_FUNC)(int_32 argc);\n" + + "} SHELL_COMMAND_STRUCT, * SHELL_COMMAND_PTR;\n" + + "typedef struct shell_command_struct {\n" + + " char_ptr COMMAND;\n" + + " int_32 (*SHELL_FUNC)(int_32 argc, char_ptr argv[]);\n" + + "} SHELL_COMMAND_STRUCT, * SHELL_COMMAND_PTR;\n" + + "typedef struct shell_command_struct {\n" + + " char_ptr COMMAND;\n" + + " int_32 (*SHELL_FUNC)(int_32 argc);\n" + + "};\n" + + expected = + [ + "int notatypedef", + "int typedef_isnt_me", + "this should remain!" + ] + + assert_equal(expected, @parser.import_source(source).map!{|s|s.strip}) + end + + + should "remove enum statements" do + source = + "enum _NamedEnum {\n" + + " THING1 = (0x0001),\n" + + " THING2 = (0x0001 << 5),\n" + + "}ListOValues;\n\n" + + "don't delete me!!\n" + + " modifier_str enum _NamedEnum {THING1 = (0x0001), THING2 = (0x0001 << 5)} ListOValues;\n\n" + + "typedef enum {\n" + + " THING1,\n" + + " THING2,\n" + + "} Thinger;\n" + + "or me!!\n" + + assert_equal(["don't delete me!! or me!!"], @parser.import_source(source).map!{|s|s.strip}) + end + + + should "remove union statements" do + source = + "union _NamedDoohicky {\n" + + " unsigned int a;\n" + + " char b;\n" + + "} Doohicky;\n\n" + + "I want to live!!\n" + + "some_modifier union { unsigned int a; char b;} Whatever;\n" + + "typedef union {\n" + + " unsigned int a;\n" + + " char b;\n" + + "} Whatever;\n" + + "me too!!\n" + + assert_equal(["I want to live!! me too!!"], @parser.import_source(source).map!{|s|s.strip}) + end + + + should "remove struct statements" do + source = + "struct _NamedStruct1 {\n" + + " unsigned int a;\n" + + " signed long int b;\n" + + "} Thing ;\n\n" + + "extern struct ForwardDeclared_t TestDataType1;\n" + + "void foo(void);\n" + + "struct\n"+ + " MultilineForwardDeclared_t\n" + + " TestDataType2;\n" + + "struct THINGER foo(void);\n" + + "typedef struct {\n" + + " unsigned int a;\n" + + " signed char b;\n" + + "}Thinger;\n" + + "I want to live!!\n" + + assert_equal(["void foo(void)", "struct THINGER foo(void)", "I want to live!!"], + @parser.import_source(source).map!{|s|s.strip}) + end + + should "remove externed and inline functions" do + source = + " extern uint32 foobar(unsigned int);\n" + + "uint32 extern_name_func(unsigned int);\n" + + "uint32 funcinline(unsigned int);\n" + + "extern void bar(unsigned int);\n" + + "inline void bar(unsigned int);\n" + + "extern\n" + + "void kinda_ugly_on_the_next_line(unsigned int);\n" + + expected = + [ + "uint32 extern_name_func(unsigned int)", + "uint32 funcinline(unsigned int)" + ] + + assert_equal(expected, @parser.import_source(source).map!{|s|s.strip}) + end + + should "remove a fully defined inline function" do + source = + "inline void foo(unsigned int a) { oranges = a; }\n" + + "inline void bar(unsigned int a) { apples = a; };\n" + + "inline void bar(unsigned int a)\n" + + "{" + + " bananas = a;\n" + + "}" + + # ensure it's expected type of exception + assert_raise RuntimeError do + @parser.parse("module", source) + end + + assert_equal([], @parser.funcs) + + # verify exception message + begin + @parser.parse("module", source) + rescue RuntimeError => e + assert_equal("ERROR: No function prototypes found!", e.message) + end + end + + should "remove just inline functions if externs to be included" do + source = + " extern uint32 foobar(unsigned int);\n" + + "uint32 extern_name_func(unsigned int);\n" + + "uint32 funcinline(unsigned int);\n" + + "extern void bar(unsigned int);\n" + + "inline void bar(unsigned int);\n" + + "extern\n" + + "void kinda_ugly_on_the_next_line(unsigned int);\n" + + expected = + [ "extern uint32 foobar(unsigned int)", + "uint32 extern_name_func(unsigned int)", + "uint32 funcinline(unsigned int)", + "extern void bar(unsigned int)", + "extern void kinda_ugly_on_the_next_line(unsigned int)" + ] + + @parser.treat_externs = :include + assert_equal(expected, @parser.import_source(source).map!{|s|s.strip}) + end + + + should "remove defines" do + source = + "#define whatever you feel like defining\n" + + "void hello(void);\n" + + "#DEFINE I JUST DON'T CARE\n" + + "#deFINE\n" + + "#define get_foo() \\\n ((Thing)foo.bar)" # exercise multiline define + + expected = + [ + "void hello(void)", + ] + + assert_equal(expected, @parser.import_source(source).map!{|s|s.strip}) + end + + + should "remove keywords that would keep things from going smoothly in the future" do + source = + "const int TheMatrix(register int Trinity, unsigned int *restrict Neo)" + + expected = + [ + "const int TheMatrix(int Trinity, unsigned int * Neo)", + ] + + assert_equal(expected, @parser.import_source(source).map!{|s|s.strip}) + end + + + # some code actually typedef's void even though it's not ANSI C and is, frankly, weird + # since cmock treats void specially, we can't let void be obfuscated + should "handle odd case of typedef'd void returned" do + source = "MY_FUNKY_VOID FunkyVoidReturned(int a)" + expected = { :var_arg=>nil, + :name=>"FunkyVoidReturned", + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :modifier=>"", + :contains_ptr? => false, + :args=>[{:type=>"int", :name=>"a", :ptr? => false, :const? => false}], + :args_string=>"int a", + :args_call=>"a"} + assert_equal(expected, @parser.parse_declaration(source)) + end + + should "handle odd case of typedef'd void as arg" do + source = "int FunkyVoidAsArg(MY_FUNKY_VOID)" + expected = { :var_arg=>nil, + :name=>"FunkyVoidAsArg", + :return=>{ :type => "int", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "int cmock_to_return", + :void? => false + }, + :modifier=>"", + :contains_ptr? => false, + :args=>[], + :args_string=>"void", + :args_call=>"" } + assert_equal(expected, @parser.parse_declaration(source)) + end + + should "handle odd case of typedef'd void as arg pointer" do + source = "char FunkyVoidPointer(MY_FUNKY_VOID* bluh)" + expected = { :var_arg=>nil, + :name=>"FunkyVoidPointer", + :return=>{ :type => "char", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "char cmock_to_return", + :void? => false + }, + :modifier=>"", + :contains_ptr? => true, + :args=>[{:type=>"MY_FUNKY_VOID*", :name=>"bluh", :ptr? => true, :const? => false}], + :args_string=>"MY_FUNKY_VOID* bluh", + :args_call=>"bluh" } + assert_equal(expected, @parser.parse_declaration(source)) + end + + + should "strip default values from function parameter lists" do + source = + "void Foo(int a = 57, float b=37.52, char c= 'd', char* e=\"junk\");\n" + + expected = + [ + "void Foo(int a, float b, char c, char* e)" + ] + + assert_equal(expected, @parser.import_source(source).map!{|s|s.strip}) + end + + + should "raise upon empty file" do + source = '' + + # ensure it's expected type of exception + assert_raise RuntimeError do + @parser.parse("module", "") + end + + assert_equal([], @parser.funcs) + + # verify exception message + begin + @parser.parse("module", "") + rescue RuntimeError => e + assert_equal("ERROR: No function prototypes found!", e.message) + end + end + + + should "raise upon no function prototypes found in file" do + source = + "typedef void SILLY_VOID_TYPE1;\n" + + "typedef (void) SILLY_VOID_TYPE2 ;\n" + + "typedef ( void ) (*FUNCPTR)(void);\n\n" + + "#define get_foo() \\\n ((Thing)foo.bar)" + + # ensure it's expected type of exception + assert_raise(RuntimeError) do + @parser.parse("module", source) + end + + assert_equal([], @parser.funcs) + + # verify exception message + begin + @parser.parse("module", source) + rescue RuntimeError => e + assert_equal("ERROR: No function prototypes found!", e.message) + end + end + + + should "raise upon prototype parsing failure" do + source = "void (int, )" + + # ensure it's expected type of exception + assert_raise(RuntimeError) do + @parser.parse("module", source) + end + + # verify exception message + begin + @parser.parse("module", source) + rescue RuntimeError => e + assert(e.message.include?("Failed Parsing Declaration Prototype!")) + end + end + + should "extract and return function declarations with retval and args" do + + source = "int Foo(int a, unsigned int b)" + expected = { :var_arg=>nil, + :name=>"Foo", + :return=>{ :type => "int", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "int cmock_to_return", + :void? => false + }, + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"int", :name=>"a", :ptr? => false, :const? => false}, + {:type=>"unsigned int", :name=>"b", :ptr? => false, :const? => false} + ], + :args_string=>"int a, unsigned int b", + :args_call=>"a, b" } + assert_equal(expected, @parser.parse_declaration(source)) + end + + should "extract and return function declarations with no retval" do + + source = "void FunkyChicken( uint la, int de, bool da)" + expected = { :var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"FunkyChicken", + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"uint", :name=>"la", :ptr? => false, :const? => false}, + {:type=>"int", :name=>"de", :ptr? => false, :const? => false}, + {:type=>"bool", :name=>"da", :ptr? => false, :const? => false} + ], + :args_string=>"uint la, int de, bool da", + :args_call=>"la, de, da" } + assert_equal(expected, @parser.parse_declaration(source)) + end + + should "extract and return function declarations with implied voids" do + + source = "void tat()" + expected = { :var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"tat", + :modifier=>"", + :contains_ptr? => false, + :args=>[ ], + :args_string=>"void", + :args_call=>"" } + assert_equal(expected, @parser.parse_declaration(source)) + end + + should "extract modifiers properly" do + + source = "const int TheMatrix(int Trinity, unsigned int * Neo)" + expected = { :var_arg=>nil, + :return=>{ :type => "int", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "int cmock_to_return", + :void? => false + }, + :name=>"TheMatrix", + :modifier=>"const", + :contains_ptr? => true, + :args=>[ {:type=>"int", :name=>"Trinity", :ptr? => false, :const? => false}, + {:type=>"unsigned int*", :name=>"Neo", :ptr? => true, :const? => false} + ], + :args_string=>"int Trinity, unsigned int* Neo", + :args_call=>"Trinity, Neo" } + assert_equal(expected, @parser.parse_declaration(source)) + end + + should "fully parse multiple prototypes" do + + source = "const int TheMatrix(int Trinity, unsigned int * Neo);\n" + + "int Morpheus(int, unsigned int*);\n" + + expected = [{ :var_arg=>nil, + :return=> { :type => "int", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "int cmock_to_return", + :void? => false + }, + :name=>"TheMatrix", + :modifier=>"const", + :contains_ptr? => true, + :args=>[ {:type=>"int", :name=>"Trinity", :ptr? => false, :const? => false}, + {:type=>"unsigned int*", :name=>"Neo", :ptr? => true, :const? => false} + ], + :args_string=>"int Trinity, unsigned int* Neo", + :args_call=>"Trinity, Neo" }, + { :var_arg=>nil, + :return=> { :type => "int", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "int cmock_to_return", + :void? => false + }, + :name=>"Morpheus", + :modifier=>"", + :contains_ptr? => true, + :args=>[ {:type=>"int", :name=>"cmock_arg1", :ptr? => false, :const? => false}, + {:type=>"unsigned int*", :name=>"cmock_arg2", :ptr? => true, :const? => false} + ], + :args_string=>"int cmock_arg1, unsigned int* cmock_arg2", + :args_call=>"cmock_arg1, cmock_arg2" + }] + assert_equal(expected, @parser.parse("module", source)[:functions]) + end + + should "not extract for mocking multiply defined prototypes" do + + source = "const int TheMatrix(int Trinity, unsigned int * Neo);\n" + + "const int TheMatrix(int, unsigned int*);\n" + + expected = [{ :var_arg=>nil, + :name=>"TheMatrix", + :return=> { :type => "int", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "int cmock_to_return", + :void? => false + }, + :modifier=>"const", + :contains_ptr? => true, + :args=>[ {:type=>"int", :name=>"Trinity", :ptr? => false, :const? => false}, + {:type=>"unsigned int*", :name=>"Neo", :ptr? => true, :const? => false} + ], + :args_string=>"int Trinity, unsigned int* Neo", + :args_call=>"Trinity, Neo" + }] + assert_equal(expected, @parser.parse("module", source)[:functions]) + end + + should "properly detect typedef'd variants of void and use those" do + + source = "typedef (void) FUNKY_VOID_T;\n" + + "typedef void CHUNKY_VOID_T;\n" + + "FUNKY_VOID_T DrHorrible(int SingAlong);\n" + + "int CaptainHammer(CHUNKY_VOID_T);\n" + + expected = [{ :var_arg=>nil, + :name=>"DrHorrible", + :return => { :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"int", :name=>"SingAlong", :ptr? => false, :const? => false} ], + :args_string=>"int SingAlong", + :args_call=>"SingAlong" + }, + { :var_arg=>nil, + :return=> { :type => "int", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "int cmock_to_return", + :void? => false + }, + :name=>"CaptainHammer", + :modifier=>"", + :contains_ptr? => false, + :args=>[ ], + :args_string=>"void", + :args_call=>"" + }] + assert_equal(expected, @parser.parse("module", source)[:functions]) + end + + should "be ok with structs inside of function declarations" do + + source = "int DrHorrible(struct SingAlong Blog);\n" + + "void Penny(struct const _KeepYourHeadUp_ * const BillyBuddy);\n" + + "struct TheseArentTheHammer CaptainHammer(void);\n" + + expected = [{ :var_arg=>nil, + :return =>{ :type => "int", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "int cmock_to_return", + :void? => false + }, + :name=>"DrHorrible", + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"struct SingAlong", :name=>"Blog", :ptr? => false, :const? => false} ], + :args_string=>"struct SingAlong Blog", + :args_call=>"Blog" + }, + { :var_arg=>nil, + :return=> { :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"Penny", + :modifier=>"", + :contains_ptr? => true, + :args=>[ {:type=>"struct _KeepYourHeadUp_*", :name=>"BillyBuddy", :ptr? => true, :const? => true} ], + :args_string=>"struct const _KeepYourHeadUp_* const BillyBuddy", + :args_call=>"BillyBuddy" + }, + { :var_arg=>nil, + :return=> { :type => "struct TheseArentTheHammer", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "struct TheseArentTheHammer cmock_to_return", + :void? => false + }, + :name=>"CaptainHammer", + :modifier=>"", + :contains_ptr? => false, + :args=>[ ], + :args_string=>"void", + :args_call=>"" + }] + assert_equal(expected, @parser.parse("module", source)[:functions]) + end + + should "extract functions containing unions with union specifier" do + source = "void OrangePeel(union STARS_AND_STRIPES * a, union AFL_CIO b)" + expected = [{ :var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"OrangePeel", + :modifier=>"", + :contains_ptr? => true, + :args=>[ {:type=>"union STARS_AND_STRIPES*", :name=>"a", :ptr? => true, :const? => false}, + {:type=>"union AFL_CIO", :name=>"b", :ptr? => false, :const? => false} + ], + :args_string=>"union STARS_AND_STRIPES* a, union AFL_CIO b", + :args_call=>"a, b" }] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + end + + should "not be thwarted by variables named with primitive types as part of the name" do + source = "void ApplePeel(const unsigned int const_param, int int_param, int integer, char character, int* const constant)" + expected = [{ :var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"ApplePeel", + :modifier=>"", + :contains_ptr? => true, + :args=>[ {:type=> "unsigned int", :name=>"const_param", :ptr? => false, :const? => true}, + {:type=>"int", :name=>"int_param", :ptr? => false, :const? => false}, + {:type=>"int", :name=>"integer", :ptr? => false, :const? => false}, + {:type=>"char", :name=>"character", :ptr? => false, :const? => false}, + {:type=>"int*", :name=>"constant", :ptr? => true, :const? => true} + ], + :args_string=>"const unsigned int const_param, int int_param, int integer, char character, int* const constant", + :args_call=>"const_param, int_param, integer, character, constant" }] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + end + + should "not be thwarted by custom types named similarly to primitive types" do + source = "void LemonPeel(integer param, character thing, longint * junk, constant value, int32_t const number)" + expected = [{:var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"LemonPeel", + :modifier=>"", + :contains_ptr? => true, + :args=>[ {:type=>"integer", :name=>"param", :ptr? => false, :const? => false}, + {:type=>"character", :name=>"thing", :ptr? => false, :const? => false}, + {:type=>"longint*", :name=>"junk", :ptr? => true, :const? => false}, + {:type=>"constant", :name=>"value", :ptr? => false, :const? => false}, + {:type=>"int32_t", :name=>"number", :ptr? => false, :const? => true} + ], + :args_string=>"integer param, character thing, longint* junk, constant value, int32_t const number", + :args_call=>"param, thing, junk, value, number" }] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + end + + should "handle some of those chains of C name specifiers naturally" do + source = "void CoinOperated(signed char abc, const unsigned long int xyz_123, unsigned int const abc_123, long long arm_of_the_law)" + expected = [{:var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"CoinOperated", + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"signed char", :name=>"abc", :ptr? => false, :const? => false}, + {:type=>"unsigned long int", :name=>"xyz_123", :ptr? => false, :const? => true}, + {:type=>"unsigned int", :name=>"abc_123", :ptr? => false, :const? => true}, + {:type=>"long long", :name=>"arm_of_the_law", :ptr? => false, :const? => false} + ], + :args_string=>"signed char abc, const unsigned long int xyz_123, unsigned int const abc_123, long long arm_of_the_law", + :args_call=>"abc, xyz_123, abc_123, arm_of_the_law" }] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + end + + should "handle custom types of various formats" do + source = "void CardOperated(CUSTOM_TYPE abc, CUSTOM_TYPE* xyz_123, CUSTOM_TYPE const abcxyz, struct CUSTOM_TYPE const * const abc123)" + expected = [{:var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"CardOperated", + :modifier=>"", + :contains_ptr? => true, + :args=>[ {:type=>"CUSTOM_TYPE", :name=>"abc", :ptr? => false, :const? => false}, + {:type=>"CUSTOM_TYPE*", :name=>"xyz_123", :ptr? => true, :const? => false}, + {:type=>"CUSTOM_TYPE", :name=>"abcxyz", :ptr? => false, :const? => true}, + {:type=>"struct CUSTOM_TYPE const*", :name=>"abc123", :ptr? => true, :const? => true} + ], + :args_string=>"CUSTOM_TYPE abc, CUSTOM_TYPE* xyz_123, CUSTOM_TYPE const abcxyz, struct CUSTOM_TYPE const* const abc123", + :args_call=>"abc, xyz_123, abcxyz, abc123" }] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + end + + should "handle arrays and treat them as pointers" do + source = "void KeyOperated(CUSTOM_TYPE thing1[], int thing2 [ ], char thing3 [][2 ][ 3], int* thing4[4])" + expected = [{:var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"KeyOperated", + :modifier=>"", + :contains_ptr? => true, + :args=>[ {:type=>"CUSTOM_TYPE*", :name=>"thing1", :ptr? => true, :const? => false}, + {:type=>"int*", :name=>"thing2", :ptr? => true, :const? => false}, + {:type=>"char*", :name=>"thing3", :ptr? => false, :const? => false}, #THIS one will likely change in the future when we improve multidimensional array support + {:type=>"int**", :name=>"thing4", :ptr? => true, :const? => false} #THIS one will likely change in the future when we improve multidimensional array support + ], + :args_string=>"CUSTOM_TYPE* thing1, int* thing2, char* thing3, int** thing4", + :args_call=>"thing1, thing2, thing3, thing4" }] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + end + + should "give a reasonable guess when dealing with weird combinations of custom types and modifiers" do + source = "void Cheese(unsigned CUSTOM_TYPE abc, unsigned xyz, CUSTOM_TYPE1 CUSTOM_TYPE2 pdq)" + expected = [{:var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"Cheese", + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"unsigned CUSTOM_TYPE", :name=>"abc", :ptr? => false, :const? => false}, + {:type=>"unsigned", :name=>"xyz", :ptr? => false, :const? => false}, + {:type=>"CUSTOM_TYPE1 CUSTOM_TYPE2", :name=>"pdq", :ptr? => false, :const? => false} + ], + :args_string=>"unsigned CUSTOM_TYPE abc, unsigned xyz, CUSTOM_TYPE1 CUSTOM_TYPE2 pdq", + :args_call=>"abc, xyz, pdq" }] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + end + + should "extract functions containing a function pointer" do + source = "void FunkyTurkey(unsigned int (*func_ptr)(int, char))" + expected = [{ :var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"FunkyTurkey", + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"cmock_module_func_ptr1", :name=>"func_ptr", :ptr? => false, :const? => false} + ], + :args_string=>"cmock_module_func_ptr1 func_ptr", + :args_call=>"func_ptr" }] + typedefs = ["typedef unsigned int(*cmock_module_func_ptr1)(int, char);"] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + assert_equal(typedefs, result[:typedefs]) + end + + should "extract functions containing a function pointer with an implied void" do + source = "void FunkyTurkey(unsigned int (*func_ptr)())" + expected = [{ :var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"FunkyTurkey", + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"cmock_module_func_ptr1", :name=>"func_ptr", :ptr? => false, :const? => false} + ], + :args_string=>"cmock_module_func_ptr1 func_ptr", + :args_call=>"func_ptr" }] + typedefs = ["typedef unsigned int(*cmock_module_func_ptr1)();"] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + assert_equal(typedefs, result[:typedefs]) + end + + should "extract functions containing a constant function pointer and a pointer in the nested arg list" do + source = "void FunkyChicken(unsigned int (* const func_ptr)(unsigned long int * , char))" + expected = [{ :var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"FunkyChicken", + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"cmock_module_func_ptr1", :name=>"func_ptr", :ptr? => false, :const? => true} + ], + :args_string=>"cmock_module_func_ptr1 const func_ptr", + :args_call=>"func_ptr" }] + typedefs = ["typedef unsigned int(*cmock_module_func_ptr1)(unsigned long int* , char);"] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + assert_equal(typedefs, result[:typedefs]) + end + + # should "extract functions containing a function pointer taking a vararg" do + # source = "void FunkyParrot(unsigned int (*func_ptr)(int, char, ...))" + # expected = [{ :var_arg=>nil, + # :return=>{ :type => "void", + # :name => 'cmock_to_return', + # :ptr? => false, + # :const? => false, + # :str => "void cmock_to_return", + # :void? => true + # }, + # :name=>"FunkyParrot", + # :modifier=>"", + # :contains_ptr? => false, + # :args=>[ {:type=>"cmock_module_func_ptr1", :name=>"func_ptr", :ptr? => false, :const? => false} + # ], + # :args_string=>"cmock_module_func_ptr1 func_ptr", + # :args_call=>"func_ptr" }] + # typedefs = ["typedef unsigned int(*cmock_module_func_ptr1)(int, char, ...);"] + # result = @parser.parse("module", source) + # assert_equal(expected, result[:functions]) + # assert_equal(typedefs, result[:typedefs]) + # end + + should "extract functions containing a function pointer with extra parenthesis and two sets" do + source = "void FunkyBudgie(int (((* func_ptr1)(int, char))), void (*func_ptr2)(void))" + expected = [{ :var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"FunkyBudgie", + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"cmock_module_func_ptr1", :name=>"func_ptr1", :ptr? => false, :const? => false}, + {:type=>"cmock_module_func_ptr2", :name=>"func_ptr2", :ptr? => false, :const? => false} + ], + :args_string=>"cmock_module_func_ptr1 func_ptr1, cmock_module_func_ptr2 func_ptr2", + :args_call=>"func_ptr1, func_ptr2" }] + typedefs = ["typedef int(*cmock_module_func_ptr1)(int, char);", "typedef void(*cmock_module_func_ptr2)(void);"] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + assert_equal(typedefs, result[:typedefs]) + end + + should "extract functions containing an anonymous function pointer" do + source = "void FunkyFowl(unsigned int (* const)(int, char))" + expected = [{ :var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"FunkyFowl", + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"cmock_module_func_ptr1", :name=>"cmock_arg1", :ptr? => false, :const? => true} + ], + :args_string=>"cmock_module_func_ptr1 const cmock_arg1", + :args_call=>"cmock_arg1" }] + typedefs = ["typedef unsigned int(*cmock_module_func_ptr1)(int, char);"] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + assert_equal(typedefs, result[:typedefs]) + end + + should "extract functions returning a function pointer" do + source = "unsigned short (*FunkyPidgeon( const char op_code ))( int, long int )" + expected = [{ :var_arg=>nil, + :return=>{ :type => "cmock_module_func_ptr1", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "cmock_module_func_ptr1 cmock_to_return", + :void? => false + }, + :name=>"FunkyPidgeon", + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"char", :name=>"op_code", :ptr? => false, :const? => true} + ], + :args_string=>"const char op_code", + :args_call=>"op_code" }] + typedefs = ["typedef unsigned short(*cmock_module_func_ptr1)( int, long int );"] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + assert_equal(typedefs, result[:typedefs]) + end + + should "extract functions returning a function pointer with implied void" do + source = "unsigned short (*FunkyTweetie())()" + expected = [{ :var_arg=>nil, + :return=>{ :type => "cmock_module_func_ptr1", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "cmock_module_func_ptr1 cmock_to_return", + :void? => false + }, + :name=>"FunkyTweetie", + :modifier=>"", + :contains_ptr? => false, + :args=>[], + :args_string=>"void", + :args_call=>"" }] + typedefs = ["typedef unsigned short(*cmock_module_func_ptr1)();"] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + assert_equal(typedefs, result[:typedefs]) + end + + should "extract functions returning a function pointer where everything is a void" do + source = "void (* FunkySeaGull(void))(void)" + expected = [{ :var_arg=>nil, + :return=>{ :type => "cmock_module_func_ptr1", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "cmock_module_func_ptr1 cmock_to_return", + :void? => false + }, + :name=>"FunkySeaGull", + :modifier=>"", + :contains_ptr? => false, + :args=>[], + :args_string=>"void", + :args_call=>"" }] + typedefs = ["typedef void(*cmock_module_func_ptr1)(void);"] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + assert_equal(typedefs, result[:typedefs]) + end + + should "extract functions returning a function pointer with some pointer nonsense" do + source = "unsigned int * (* FunkyMacaw(double* foo, THING *bar))(unsigned int)" + expected = [{ :var_arg=>nil, + :return=>{ :type => "cmock_module_func_ptr1", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "cmock_module_func_ptr1 cmock_to_return", + :void? => false + }, + :name=>"FunkyMacaw", + :modifier=>"", + :contains_ptr? => true, + :args=>[ {:type=>"double*", :name=>"foo", :ptr? => true, :const? => false}, + {:type=>"THING*", :name=>"bar", :ptr? => true, :const? => false} + ], + :args_string=>"double* foo, THING* bar", + :args_call=>"foo, bar" }] + typedefs = ["typedef unsigned int *(*cmock_module_func_ptr1)(unsigned int);"] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + assert_equal(typedefs, result[:typedefs]) + end + + should "extract functions with varargs" do + source = "int XFiles(int Scully, int Mulder, ...);\n" + expected = [{ :var_arg=>"...", + :return=> { :type => "int", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "int cmock_to_return", + :void? => false + }, + :name=>"XFiles", + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"int", :name=>"Scully", :ptr? => false, :const? => false}, + {:type=>"int", :name=>"Mulder", :ptr? => false, :const? => false} + ], + :args_string=>"int Scully, int Mulder", + :args_call=>"Scully, Mulder" + }] + assert_equal(expected, @parser.parse("module", source)[:functions]) + end + + should "extract functions with strippable confusing junk like gcc attributes" do + source = "int LaverneAndShirley(int Lenny, int Squiggy) __attribute__((weak)) __attribute__ ((deprecated));\n" + expected = [{ :var_arg=>nil, + :return=> { :type => "int", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "int cmock_to_return", + :void? => false + }, + :name=>"LaverneAndShirley", + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"int", :name=>"Lenny", :ptr? => false, :const? => false}, + {:type=>"int", :name=>"Squiggy", :ptr? => false, :const? => false} + ], + :args_string=>"int Lenny, int Squiggy", + :args_call=>"Lenny, Squiggy" + }] + assert_equal(expected, @parser.parse("module", source)[:functions]) + end + + should "extract functions with strippable confusing junk like gcc attributes with parenthesis" do + source = "int TheCosbyShow(int Cliff, int Claire) __attribute__((weak, alias (\"__f\"));\n" + expected = [{ :var_arg=>nil, + :return=> { :type => "int", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "int cmock_to_return", + :void? => false + }, + :name=>"TheCosbyShow", + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"int", :name=>"Cliff", :ptr? => false, :const? => false}, + {:type=>"int", :name=>"Claire", :ptr? => false, :const? => false} + ], + :args_string=>"int Cliff, int Claire", + :args_call=>"Cliff, Claire" + }] + assert_equal(expected, @parser.parse("module", source)[:functions]) + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/unit/cmock_plugin_manager_test.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/unit/cmock_plugin_manager_test.rb new file mode 100644 index 0000000..88b4e6b --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/unit/cmock_plugin_manager_test.rb @@ -0,0 +1,85 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require File.expand_path(File.dirname(__FILE__)) + "/../test_helper" +require 'cmock_plugin_manager' + +class CMockPluginManagerTest < Test::Unit::TestCase + def setup + create_mocks :config, :utils, :pluginA, :pluginB + @config.stubs!(:respond_to?).returns(true) + @config.stubs!(:when_ptr).returns(:compare_data) + @config.stubs!(:enforce_strict_ordering).returns(false) + @config.stubs!(:ignore).returns(:args_and_calls) + end + + def teardown + end + + should "return all plugins by default" do + @config.expect.plugins.returns(['cexception','ignore']) + @utils.expect.helpers.returns({}) + + @cmock_plugins = CMockPluginManager.new(@config, @utils) + + test_plugins = @cmock_plugins.plugins + contained = { :expect => false, :ignore => false, :cexception => false } + test_plugins.each do |plugin| + contained[:expect] = true if plugin.instance_of?(CMockGeneratorPluginExpect) + contained[:ignore] = true if plugin.instance_of?(CMockGeneratorPluginIgnore) + contained[:cexception] = true if plugin.instance_of?(CMockGeneratorPluginCexception) + end + assert_equal(true, contained[:expect]) + assert_equal(true, contained[:ignore]) + assert_equal(true, contained[:cexception]) + end + + should "return restricted plugins based on config" do + @config.expect.plugins.returns([]) + @utils.expect.helpers.returns({}) + + @cmock_plugins = CMockPluginManager.new(@config, @utils) + + test_plugins = @cmock_plugins.plugins + contained = { :expect => false, :ignore => false, :cexception => false } + test_plugins.each do |plugin| + contained[:expect] = true if plugin.instance_of?(CMockGeneratorPluginExpect) + contained[:ignore] = true if plugin.instance_of?(CMockGeneratorPluginIgnore) + contained[:cexception] = true if plugin.instance_of?(CMockGeneratorPluginCexception) + end + assert_equal(true, contained[:expect]) + assert_equal(false,contained[:ignore]) + assert_equal(false,contained[:cexception]) + end + + should "run a desired method over each plugin requested and return the results" do + @config.expect.plugins.returns([]) + @utils.expect.helpers.returns({}) + @cmock_plugins = CMockPluginManager.new(@config, @utils) + + @cmock_plugins.plugins = [@pluginA, @pluginB] + @pluginA.stubs!(:test_method).returns(["This Is An Awesome Test-"]) + @pluginB.stubs!(:test_method).returns(["And This is Part 2-","Of An Awesome Test"]) + + expected = "This Is An Awesome Test-And This is Part 2-Of An Awesome Test" + output = @cmock_plugins.run(:test_method) + assert_equal(expected, output) + end + + should "run a desired method and arg list over each plugin requested and return the results" do + @config.expect.plugins.returns([]) + @utils.expect.helpers.returns({}) + @cmock_plugins = CMockPluginManager.new(@config, @utils) + + @cmock_plugins.plugins = [@pluginA, @pluginB] + @pluginA.stubs!(:test_method).returns(["This Is An Awesome Test-"]) + @pluginB.stubs!(:test_method).returns(["And This is Part 2-","Of An Awesome Test"]) + + expected = "This Is An Awesome Test-And This is Part 2-Of An Awesome Test" + output = @cmock_plugins.run(:test_method, "chickenpotpie") + assert_equal(expected, output) + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/unit/cmock_unityhelper_parser_test.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/unit/cmock_unityhelper_parser_test.rb new file mode 100644 index 0000000..3af5762 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/test/unit/cmock_unityhelper_parser_test.rb @@ -0,0 +1,223 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require File.expand_path(File.dirname(__FILE__)) + "/../test_helper" +require 'cmock_unityhelper_parser' + +class CMockUnityHelperParserTest < Test::Unit::TestCase + + def setup + create_mocks :config + end + + def teardown + end + + should "ignore lines that are commented out" do + source = + " abcd;\n" + + "// #define UNITY_TEST_ASSERT_EQUAL_CHICKENS(a,b,line,msg) {...};\n" + + "or maybe // #define UNITY_TEST_ASSERT_EQUAL_CHICKENS(a,b,line,msg) {...};\n\n" + @config.expects.plugins.returns([]) #not :array + @config.expects.treat_as.returns({}) + @config.expects.load_unity_helper.returns(source) + @parser = CMockUnityHelperParser.new(@config) + expected = {} + + assert_equal(expected, @parser.c_types) + end + + should "ignore stuff in block comments" do + source = + " abcd; /*\n" + + "#define UNITY_TEST_ASSERT_EQUAL_CHICKENS(a,b,line,msg) {...};\n" + + "#define UNITY_TEST_ASSERT_EQUAL_CHICKENS(a,b,line,msg) {...};\n */\n" + @config.expects.plugins.returns([]) #not :array + @config.expects.treat_as.returns({}) + @config.expect.load_unity_helper.returns(source) + @parser = CMockUnityHelperParser.new(@config) + expected = {} + + assert_equal(expected, @parser.c_types) + end + + should "notice equal helpers in the proper form and ignore others" do + source = + "abcd;\n" + + "#define UNITY_TEST_ASSERT_EQUAL_TURKEYS_T(a,b,line,msg) {...};\n" + + "abcd;\n" + + "#define UNITY_TEST_ASSERT_EQUAL_WRONG_NUM_ARGS(a,b,c,d,e) {...};\n" + + "#define UNITY_TEST_ASSERT_WRONG_NAME_EQUAL(a,b,c,d) {...};\n" + + "#define UNITY_TEST_ASSERT_EQUAL_unsigned_funky_rabbits(a,b,c,d) {...};\n" + + "abcd;\n" + @config.expects.plugins.returns([]) #not :array + @config.expects.treat_as.returns({}) + @config.expect.load_unity_helper.returns(source) + @parser = CMockUnityHelperParser.new(@config) + expected = { + 'TURKEYS_T' => "UNITY_TEST_ASSERT_EQUAL_TURKEYS_T", + 'unsigned_funky_rabbits' => "UNITY_TEST_ASSERT_EQUAL_unsigned_funky_rabbits" + } + + assert_equal(expected, @parser.c_types) + end + + should "notice equal helpers that contain arrays" do + source = + "abcd;\n" + + "#define UNITY_TEST_ASSERT_EQUAL_TURKEYS_ARRAY(a,b,c,d,e) {...};\n" + + "abcd;\n" + + "#define UNITY_TEST_ASSERT_EQUAL_WRONG_NUM_ARGS_ARRAY(a,b,c,d,e,f) {...};\n" + + "#define UNITY_TEST_ASSERT_WRONG_NAME_EQUAL_ARRAY(a,b,c,d,e) {...};\n" + + "#define UNITY_TEST_ASSERT_EQUAL_unsigned_funky_rabbits_ARRAY(a,b,c,d,e) {...};\n" + + "abcd;\n" + @config.expects.plugins.returns([]) #not :array + @config.expects.treat_as.returns({}) + @config.expect.load_unity_helper.returns(source) + @parser = CMockUnityHelperParser.new(@config) + expected = { + 'TURKEYS*' => "UNITY_TEST_ASSERT_EQUAL_TURKEYS_ARRAY", + 'unsigned_funky_rabbits*' => "UNITY_TEST_ASSERT_EQUAL_unsigned_funky_rabbits_ARRAY" + } + + assert_equal(expected, @parser.c_types) + end + + should "pull in the standard set of helpers and add them to my list" do + pairs = { + "UINT" => "HEX32", + "unsigned long" => "HEX64", + } + expected = { + "UINT" => "UNITY_TEST_ASSERT_EQUAL_HEX32", + "unsigned_long" => "UNITY_TEST_ASSERT_EQUAL_HEX64", + "UINT*" => "UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY", + "unsigned_long*"=> "UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY", + } + @config.expects.plugins.returns([]) #not :array + @config.expects.treat_as.returns(pairs) + @config.expect.load_unity_helper.returns(nil) + @parser = CMockUnityHelperParser.new(@config) + + assert_equal(expected, @parser.c_types) + end + + should "pull in the user specified set of helpers and add them to my list" do + pairs = { + "char*" => "STRING", + "unsigned int" => "HEX32", + } + expected = { + "char*" => "UNITY_TEST_ASSERT_EQUAL_STRING", + "unsigned_int" => "UNITY_TEST_ASSERT_EQUAL_HEX32", + "char**" => "UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY", + "unsigned_int*" => "UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY", + } + @config.expects.plugins.returns([]) #not :array + @config.expects.treat_as.returns(pairs) + @config.expect.load_unity_helper.returns(nil) + @parser = CMockUnityHelperParser.new(@config) + + assert_equal(expected, @parser.c_types) + end + + should "be able to fetch helpers on my list" do + @config.expects.plugins.returns([]) #not :array + @config.expects.treat_as.returns({}) + @config.expect.load_unity_helper.returns("") + @parser = CMockUnityHelperParser.new(@config) + @parser.c_types = { + 'UINT8' => "UNITY_TEST_ASSERT_EQUAL_UINT8", + 'UINT16*' => "UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY", + 'SPINACH' => "UNITY_TEST_ASSERT_EQUAL_SPINACH", + 'LONG_LONG' => "UNITY_TEST_ASSERT_EQUAL_LONG_LONG" + } + + [["UINT8","UINT8"], + ["UINT16*","UINT16_ARRAY"], + ["const SPINACH","SPINACH"], + ["LONG LONG","LONG_LONG"] ].each do |ctype, exptype| + assert_equal(["UNITY_TEST_ASSERT_EQUAL_#{exptype}",''], @parser.get_helper(ctype)) + end + end + + should "return memory comparison when asked to fetch helper of types not on my list" do + @config.expects.plugins.returns([]) #not :array + @config.expects.treat_as.returns({}) + @config.expects.load_unity_helper.returns("") + @parser = CMockUnityHelperParser.new(@config) + @parser.c_types = { + 'UINT8' => "UNITY_TEST_ASSERT_EQUAL_UINT8", + 'UINT16*' => "UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY", + 'SPINACH' => "UNITY_TEST_ASSERT_EQUAL_SPINACH", + } + + ["UINT32","SPINACH_T","SALAD","PINEAPPLE"].each do |ctype| + @config.expect.memcmp_if_unknown.returns(true) + assert_equal(["UNITY_TEST_ASSERT_EQUAL_MEMORY",'&'], @parser.get_helper(ctype)) + end + end + + should "return memory array comparison when asked to fetch helper of types not on my list" do + @config.expects.plugins.returns([:array]) + @config.expects.treat_as.returns({}) + @config.expects.load_unity_helper.returns("") + @parser = CMockUnityHelperParser.new(@config) + @parser.c_types = { + 'UINT8' => "UNITY_TEST_ASSERT_EQUAL_UINT8", + 'UINT16*' => "UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY", + 'SPINACH' => "UNITY_TEST_ASSERT_EQUAL_SPINACH", + } + + ["UINT32*","SPINACH_T*"].each do |ctype| + @config.expect.memcmp_if_unknown.returns(true) + assert_equal(["UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY",''], @parser.get_helper(ctype)) + end + end + + should "return the array handler if we cannot find the normal handler" do + @config.expects.plugins.returns([]) #not :array + @config.expects.treat_as.returns({}) + @config.expect.load_unity_helper.returns("") + @parser = CMockUnityHelperParser.new(@config) + @parser.c_types = { + 'UINT8' => "UNITY_TEST_ASSERT_EQUAL_UINT8", + 'UINT16*' => "UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY", + 'SPINACH' => "UNITY_TEST_ASSERT_EQUAL_SPINACH", + } + + assert_equal(["UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY",'&'], @parser.get_helper("UINT16")) + end + + should "return the normal handler if we cannot find the array handler" do + @config.expects.plugins.returns([]) #not :array + @config.expects.treat_as.returns({}) + @config.expect.load_unity_helper.returns("") + @parser = CMockUnityHelperParser.new(@config) + @parser.c_types = { + 'UINT8' => "UNITY_TEST_ASSERT_EQUAL_UINT8", + 'UINT16' => "UNITY_TEST_ASSERT_EQUAL_UINT16", + 'SPINACH' => "UNITY_TEST_ASSERT_EQUAL_SPINACH", + } + + assert_equal(["UNITY_TEST_ASSERT_EQUAL_UINT8",'*'], @parser.get_helper("UINT8*")) + end + + should "raise error when asked to fetch helper of type not on my list and not allowed to mem check" do + @config.expects.plugins.returns([]) #not :array + @config.expects.treat_as.returns({}) + @config.expect.load_unity_helper.returns("") + @config.expect.memcmp_if_unknown.returns(false) + @parser = CMockUnityHelperParser.new(@config) + @parser.c_types = { + 'UINT8' => "UNITY_TEST_ASSERT_EQUAL_UINT8", + 'UINT32*' => "UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY", + 'SPINACH' => "UNITY_TEST_ASSERT_EQUAL_SPINACH", + } + + assert_raise(RuntimeError) { @parser.get_helper("UINT16") } + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/behaviors/Manifest.txt b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/behaviors/Manifest.txt new file mode 100644 index 0000000..6c954ec --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/behaviors/Manifest.txt @@ -0,0 +1,9 @@ +Manifest.txt +Rakefile +lib/behaviors.rb +lib/behaviors/reporttask.rb +test/behaviors_tasks_test.rb +test/behaviors_test.rb +test/tasks_test/lib/user.rb +test/tasks_test/Rakefile +test/tasks_test/test/user_test.rb diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/behaviors/Rakefile b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/behaviors/Rakefile new file mode 100644 index 0000000..d4d68b9 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/behaviors/Rakefile @@ -0,0 +1,19 @@ +require 'rake' +require 'rubygems' +require 'hoe' + +Hoe.new('behaviors','1.0.3') do |p| + p.author = "Atomic Object LLC" + p.email = "dev@atomicobject.com" + p.url = "http://behaviors.rubyforge.org" + p.summary = "behavior-driven unit test helper" + p.description = <<-EOS +Behaviors allows for Test::Unit test case methods to be defined as +human-readable descriptions of program behavior. It also provides +Rake tasks to list the behaviors of your project. + EOS + p.test_globs = ['test/*_test.rb'] + + p.changes = <<-EOS + EOS +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/behaviors/lib/behaviors.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/behaviors/lib/behaviors.rb new file mode 100644 index 0000000..d8d70f7 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/behaviors/lib/behaviors.rb @@ -0,0 +1,76 @@ +=begin rdoc += Usage +Behaviors provides a single method: should. + +Instead of naming test methods like: + + def test_something + end + +You declare test methods like: + + should "perform action" do + end + +You may omit the body of a should method to describe unimplemented behavior. + + should "perform other action" + +When you run your unit tests, empty should methods will appear as an 'UNIMPLEMENTED CASE' along with the described behavior. +This is useful for sketching out planned behavior quickly. + +Simply extend Behaviors in your TestCase to start using behaviors. + + require 'test/unit' + require 'behaviors' + require 'user' + + class UserTest < Test::Unit::TestCase + extend Behaviors + ... + end + += Motivation +Test methods typically focus on the name of the method under test instead of its behavior. +Creating test methods with should statements focuses on the behavior of an object. +This helps you to think about the role of the object under test. + +Using a behavior-driven approach prevents the danger in assuming a one-to-one mapping of method names to +test method names. +As always, you get the most value by writing the tests first. + +For a more complete BDD framework, try RSpec http://rspec.rubyforge.org/ + += Rake tasks + +You can define a Behaviors::ReportTask in your Rakefile to generate rake tasks that +summarize the behavior of your project. + +These tasks are named behaviors and behaviors_html. They will output to the +console or an html file in the doc directory with a list all of your should tests. + Behaviors::ReportTask.new do |t| + t.pattern = 'test/**/*_test.rb' + end + +You may also initialize the ReportTask with a custom name to associate with a particular suite of tests. + Behaviors::ReportTask.new(:widget_subsystem) do |t| + t.pattern = 'test/widgets/*_test.rb' + end + +The html report will be placed in the doc directory by default. +You can override this default by setting the html_dir in the ReportTask. + Behaviors::ReportTask.new do |t| + t.pattern = 'test/**/*_test.rb' + t.html_dir = 'behaviors_html_reports' + end +=end +module Behaviors + def should(behave,&block) + mname = "test_should_#{behave}" + if block + define_method mname, &block + else + puts ">>> UNIMPLEMENTED CASE: #{name.sub(/Test$/,'')} should #{behave}" + end + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/behaviors/lib/behaviors/reporttask.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/behaviors/lib/behaviors/reporttask.rb new file mode 100644 index 0000000..51c0eca --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/behaviors/lib/behaviors/reporttask.rb @@ -0,0 +1,158 @@ +require 'rake' +require 'rake/tasklib' + +module Behaviors +include Rake + + class ReportTask < TaskLib + attr_accessor :pattern + attr_accessor :html_dir + + def initialize(name=:behaviors) + @name = name + @html_dir = 'doc' + yield self if block_given? + define + end + + def define + desc "List behavioral definitions for the classes specified (use for= to further limit files included in report)" + task @name do + specifications.each do |spec| + puts "#{spec.name} should:\n" + spec.requirements.each do |req| + puts " - #{req}" + end + end + end + + desc "Generate html report of behavioral definitions for the classes specified (use for= to further limit files included in report)" + task "#{@name}_html" do + require 'erb' + txt =<<-EOS + + + + + +
Specifications
+<% specifications.each do |spec| %> +
+<%= spec.name %> should: +
    +<% spec.requirements.each do |req| %> +
  • <%= req %>
  • +<% end %> +
+
+<% end %> + + + EOS + output_dir = File.expand_path(@html_dir) + mkdir_p output_dir + output_filename = output_dir + "/behaviors.html" + File.open(output_filename,"w") do |f| + f.write ERB.new(txt).result(binding) + end + puts "(Wrote #{output_filename})" + end + end + + private + def test_files + test_list = FileList[@pattern] + if ENV['for'] + test_list = test_list.grep(/#{ENV['for']}/i) + end + test_list + end + + def specifications + test_files.map do |file| + spec = OpenStruct.new + m = %r".*/([^/].*)_test.rb".match(file) + class_name = titleize(m[1]) if m[1] + spec.name = class_name + spec.requirements = [] + File::readlines(file).each do |line| + if line =~ /^\s*should\s+\(?\s*["'](.*)["']/ + spec.requirements << $1 + end + end + spec + end + end + + ############################################################ + # STOLEN FROM inflector.rb + ############################################################ + #-- + # Copyright (c) 2005 David Heinemeier Hansson + # + # Permission is hereby granted, free of charge, to any person obtaining + # a copy of this software and associated documentation files (the + # "Software"), to deal in the Software without restriction, including + # without limitation the rights to use, copy, modify, merge, publish, + # distribute, sublicense, and/or sell copies of the Software, and to + # permit persons to whom the Software is furnished to do so, subject to + # the following conditions: + # + # The above copyright notice and this permission notice shall be + # included in all copies or substantial portions of the Software. + # + # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + #++ + def titleize(word) + humanize(underscore(word)).gsub(/\b([a-z])/) { $1.capitalize } + end + + def underscore(camel_cased_word) camel_cased_word.to_s.gsub(/::/, '/'). + gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').gsub(/([a-z\d])([A-Z])/,'\1_\2').tr("-", "_").downcase + end + + def humanize(lower_case_and_underscored_word) + lower_case_and_underscored_word.to_s.gsub(/_id$/, "").gsub(/_/, " ").capitalize + end + + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/behaviors/test/behaviors_tasks_test.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/behaviors/test/behaviors_tasks_test.rb new file mode 100644 index 0000000..9382e07 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/behaviors/test/behaviors_tasks_test.rb @@ -0,0 +1,73 @@ +require 'test/unit' +require 'fileutils' + +class BehaviorsTasksTest < Test::Unit::TestCase + include FileUtils + + def setup + @here = File.expand_path(File.dirname(__FILE__)) + @base_cmd = RUBY_PLATFORM[/mswin/] ? 'rake.cmd ' : 'rake ' + end + + # + # HELPERS + # + def run_behaviors_task + run_cmd "behaviors" + end + + def run_behaviors_html_task + run_cmd "behaviors_html" + end + + def run_cmd(cmd) + cd "#{@here}/tasks_test" do + @report = %x[ #{@base_cmd} #{cmd} ] + end + end + + def see_html_task_output_message + @html_output_filename = "#{@here}/tasks_test/behaviors_doc/behaviors.html" + assert_match(/Wrote #{@html_output_filename}/, @report) + end + + def see_that_html_report_file_exits + assert File.exists?(@html_output_filename), "html output file should exist" + end + + def html_report_file_should_contain(user_behaviors) + file_contents = File.read(@html_output_filename) + user_behaviors.each do |line| + assert_match(/#{line}/, file_contents) + end + rm_rf File.dirname(@html_output_filename) + end + + # + # TESTS + # + def test_that_behaviors_tasks_should_list_behavioral_definitions_for_the_classes_under_test + run_behaviors_task + user_behaviors = [ + "User should:", + " - be able set user name and age during construction", + " - be able to get user name and age", + " - be able to ask if a user is an adult" + ] + assert_match(/#{user_behaviors.join("\n")}/, @report) + end + + def test_that_behaviors_tasks_should_list_behavioral_definitions_for_the_classes_under_test_in_html_output + run_behaviors_html_task + see_html_task_output_message + see_that_html_report_file_exits + user_behaviors = [ + "User should:", + "be able set user name and age during construction", + "be able to get user name and age", + "be able to ask if a user is an adult" + ] + html_report_file_should_contain user_behaviors + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/behaviors/test/behaviors_test.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/behaviors/test/behaviors_test.rb new file mode 100644 index 0000000..fd0a77f --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/behaviors/test/behaviors_test.rb @@ -0,0 +1,50 @@ +require 'test/unit' +require File.expand_path(File.dirname(__FILE__)) + '/../lib/behaviors' +require 'stringio' + +loading_developer_test_class_stdout = StringIO.new +saved_stdout = $stdout.dup +$stdout = loading_developer_test_class_stdout + +class DeveloperTest + extend Behaviors + attr_accessor :flunk_msg, :tested_code + + should "test their code" do + @tested_code = true + end + should "go to meetings" +end + +$stdout = saved_stdout +loading_developer_test_class_stdout.rewind +$loading_developer_test_class_output = loading_developer_test_class_stdout.read + +class BehaviorsTest < Test::Unit::TestCase + + + def setup + @target = DeveloperTest.new + assert_nil @target.tested_code, "block called too early" + end + + # + # TESTS + # + def test_should_called_with_a_block_defines_a_test + assert @target.methods.include?("test_should_test their code"), "Missing test method" + + @target.send("test_should_test their code") + + assert @target.tested_code, "block not called" + end + + def test_should_called_without_a_block_does_not_create_a_test_method + assert !@target.methods.include?("test_should_go to meetings"), "Should not have method" + end + + def test_should_called_without_a_block_will_give_unimplemented_output_when_class_loads + unimplemented_output = "UNIMPLEMENTED CASE: Developer should go to meetings" + assert_match(/#{unimplemented_output}/, $loading_developer_test_class_output) + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/behaviors/test/tasks_test/Rakefile b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/behaviors/test/tasks_test/Rakefile new file mode 100644 index 0000000..ba71f71 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/behaviors/test/tasks_test/Rakefile @@ -0,0 +1,19 @@ +require 'rake' +require 'rake/testtask' + +here = File.expand_path(File.dirname(__FILE__)) +require "#{here}/../../lib/behaviors/reporttask" + +desc 'Default: run unit tests.' +task :default => :test + +Rake::TestTask.new(:test) do |t| + t.libs << "#{here}/../../lib" + t.pattern = 'test/**/*_test.rb' + t.verbose = true +end + +Behaviors::ReportTask.new(:behaviors) do |t| + t.pattern = 'test/**/*_test.rb' + t.html_dir = 'behaviors_doc' +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/behaviors/test/tasks_test/lib/user.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/behaviors/test/tasks_test/lib/user.rb new file mode 100644 index 0000000..40bc07c --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/behaviors/test/tasks_test/lib/user.rb @@ -0,0 +1,2 @@ +class User +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/behaviors/test/tasks_test/test/user_test.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/behaviors/test/tasks_test/test/user_test.rb new file mode 100644 index 0000000..ad3cd1b --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/behaviors/test/tasks_test/test/user_test.rb @@ -0,0 +1,17 @@ +require 'test/unit' +require 'behaviors' + +require 'user' + +class UserTest < Test::Unit::TestCase + extend Behaviors + + def setup + end + + should "be able set user name and age during construction" + should "be able to get user name and age" + should "be able to ask if a user is an adult" + def test_DELETEME + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/docs/CExceptionSummary.odt b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/docs/CExceptionSummary.odt new file mode 100644 index 0000000..ea852a0 Binary files /dev/null and b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/docs/CExceptionSummary.odt differ diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/docs/CExceptionSummary.pdf b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/docs/CExceptionSummary.pdf new file mode 100644 index 0000000..a838337 Binary files /dev/null and b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/docs/CExceptionSummary.pdf differ diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/docs/license.txt b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/docs/license.txt new file mode 100644 index 0000000..561e5f2 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/docs/license.txt @@ -0,0 +1,30 @@ + Copyright (c) 2007 Mark VanderVoord + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + The end-user documentation included with the redistribution, if + any, must include the following acknowledgment: "This product + includes software developed for the CEXCeption Project, by Mark + VanderVoord and other contributors", in the same place and form + as other third-party acknowledgments. Alternately, this + acknowledgment may appear in the software itself, in the same + form and location as other such third-party acknowledgments. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/docs/readme.txt b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/docs/readme.txt new file mode 100644 index 0000000..92cac38 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/docs/readme.txt @@ -0,0 +1,236 @@ +==================================================================== +CException +==================================================================== + +CException is a basic exception framework for C, suitable for use in +embedded applications. It provides an exception framework similar in +use to C++, but with much less overhead. + +CException uses C standard library functions setjmp and longjmp to +operate. As long as the target system has these two functions defined, +this library should be useable with very little configuration. It +even supports environments where multiple program flows are in use, +such as real-time operating systems. + +There are about a gabillion exception frameworks using a similar +setjmp/longjmp method out there... and there will probably be more +in the future. Unfortunately, when we started our last embedded +project, all those that existed either (a) did not support multiple +tasks (therefore multiple stacks) or (b) were way more complex than +we really wanted. CException was born. + +Why use CException? + +0. It's ANSI C, and it beats passing error codes around. + +1. You want something simple... CException throws a single id. You can + define those ID's to be whatever you like. You might even choose which + type that number is for your project. But that's as far as it goes. + We weren't interested in passing objects or structs or strings... + just simple error codes. + +2. Performance... CException can be configured for single tasking or + multitasking. In single tasking, there is very little overhead past + the setjmp/longjmp calls (which are already fast). In multitasking, + your only additional overhead is the time it takes you to determine + a unique task id 0 - num_tasks. + +For the latest version, go to http://cexception.sourceforge.net + +-------------------------------------------------------------------- +CONTENTS OF THIS DOCUMENT +-------------------------------------------------------------------- + +Usage +Limitations +API +Configuration +Testing +License + +-------------------------------------------------------------------- +Usage +-------------------------------------------------------------------- + +Code that is to be protected are wrapped in Try { } Catch { } blocks. +The code directly following the Try call is "protected", meaning that +if any Throws occur, program control is directly transferred to the +start of the Catch block. + +A numerical exception ID is included with Throw, and is made accessible +from the Catch block. + +Throws can occur from within function calls (nested as deeply as you +like) or directly from within the function itself. + +-------------------------------------------------------------------- +Limitations +-------------------------------------------------------------------- + +This library was made to be as fast as possible, and provide basic +exception handling. It is not a full-blown exception library. Because +of this, there are a few limitations that should be observed in order +to successfully utilize this library: + +1. Do not directly "return" from within a Try block, nor "goto" + into or out of a Try block. + + Why? + + The "Try" macro allocates some local memory and alters a global + pointer. These are cleaned up at the top of the "Catch" macro. + Gotos and returns would bypass some of these steps, resulting in + memory leaks or unpredictable behavior. + +2. If (a) you change local (stack) variables within your Try block, + AND (b) wish to make use of the updated values after an exception + is thrown, those variables should be made volatile. Note that this + is ONLY for locals and ONLY when you need access to them after a + throw. + + Why? + + Compilers optimize. There is no way to guarantee that the actual + memory location was updated and not just a register unless the + variable is marked volatile. + +3. Memory which is malloc'd or new'd is not automatically released + when an error is thrown. This will sometimes be desirable, and + othertimes may not. It will be the responsibility of the Catch + block to perform this kind of cleanup. + + Why? + + There's just no easy way to track malloc'd memory, etc., without + replacing or wrapping malloc calls or something like that. This + is a light framework, so these options were not desirable. + +-------------------------------------------------------------------- +API +-------------------------------------------------------------------- + +Try +--- + +Try is a macro which starts a protected block. It MUST be followed by +a pair of braces or a single protected line (similar to an 'if'), +enclosing the data that is to be protected. It MUST be followed by a +Catch block (don't worry, you'll get compiler errors to let you know if +you mess any of that up). + +Catch(e) +-------- + +Catch is a macro which ends the Try block and starts the error handling +block. The catch block is called if and only if an exception was thrown +while within the Try block. This error was thrown by a Throw call +somewhere within Try (or within a function called within Try, or a function +called by a function called within Try, etc). + +The single parameter 'e' is filled with the error code which was thrown. +This can be used for reporting, conditional cleanup, etc. (or you can just +ignore it if you really want... people ignore return codes all the time, +right?). 'e' should be of type EXCEPTION_T; + +Throw(e) +-------- + +The method of throwing an error. Throws should only occur from within a +protected (Try...Catch) block, though it may easily be nested many function +calls deep without an impact on performance or functionality. Throw takes +a single argument, which is an exception id which will be passed to Catch +as the reason for the error. + +If you wish to Rethrow an error, this can be done by calling Throw(e) with +the error code you just caught. It IS valid to throw from a catch block. + +-------------------------------------------------------------------- +CONFIGURATION +-------------------------------------------------------------------- + +CException is a mostly portable library. It has one universal +dependency, and some macros which are required if working in a +multi-tasking environment. + +1. The standard C library setjmp must be available. Since this is part + of the standard library, chances are good that you'll be fine. + +2. If working in a multitasking environment, methods for obtaining an + index into an array of frames and to get the overall number of + id's are required. If the OS supports a method to retrieve Task + ID's, and those Tasks are number 0, 1, 2... you are in an ideal + situation. Otherwise, a more creative mapping function may be + required. Note that this function is likely to be called twice + for each protected block and once during a throw. This is the + only overhead in the system. + +Exception.h +----------------- +By convention, most projects include Exception.h which defines any +further requirements, then calls CException.h to do the gruntwork. All +of these are optional. You could directly include CException.h if +you wanted and just use the defaults provided. + +EXCEPTION_T - Set this to the type you want your exception id's + to be. Defaults to 'unsigned int'. + +EXCEPTION_NONE - Set this to a number which will never be an + exception id in your system. Defaults to 0x5a5a5a5a. + +EXCEPTION_GET_ID - If in a multi-tasking environment, this should be + set to be a call to the function described in #2 above. + Defaults to just return 0 all the time (good for + single tasking environments) + +EXCEPTION_NUM_ID - If in a multi-tasking environment, this should be set + to the number of ID's required (usually the number of + tasks in the system). Defaults to 1 (for single + tasking environments). + +You may also want to include any header files which will commonly be +needed by the rest of your application where it uses exception handling +here. For example, OS header files or exception codes would be useful. + +-------------------------------------------------------------------- +TESTING +-------------------------------------------------------------------- + +If you want to validate that CException works with your tools or that +it works with your custom configuration, you may want to run the test +suite. + +The test suite included makes use of the Unity Test Framework. It will +require a native C compiler. The example makefile uses MinGW's gcc. +Modify the makefile to include the proper paths to tools, then run 'make' +to compile and run the test application. + +C_COMPILER - The C compiler to use to perform the tests +C_LIBS - The path to the C libraries (including setjmp) +UNITY_DIR - The path to the Unity framework (required to run tests) + (get it at http://embunity.sourceforge.net) + +-------------------------------------------------------------------- +LICENSE +-------------------------------------------------------------------- + +This software is licensed under the MIT License + +Copyright (c) 2007 Mark VanderVoord + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/lib/CException.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/lib/CException.c new file mode 100644 index 0000000..57f5353 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/lib/CException.c @@ -0,0 +1,39 @@ +#include "CException.h" + +volatile CEXCEPTION_FRAME_T CExceptionFrames[CEXCEPTION_NUM_ID]; + +//------------------------------------------------------------------------------------------ +// Throw +//------------------------------------------------------------------------------------------ +void Throw(CEXCEPTION_T ExceptionID) +{ + unsigned int MY_ID = CEXCEPTION_GET_ID; + CExceptionFrames[MY_ID].Exception = ExceptionID; + longjmp(*CExceptionFrames[MY_ID].pFrame, 1); +} + +//------------------------------------------------------------------------------------------ +// Explaination of what it's all for: +//------------------------------------------------------------------------------------------ +/* +#define Try + { <- give us some local scope. most compilers are happy with this + jmp_buf *PrevFrame, NewFrame; <- prev frame points to the last try block's frame. new frame gets created on stack for this Try block + unsigned int MY_ID = CEXCEPTION_GET_ID; <- look up this task's id for use in frame array. always 0 if single-tasking + PrevFrame = CExceptionFrames[CEXCEPTION_GET_ID].pFrame; <- set pointer to point at old frame (which array is currently pointing at) + CExceptionFrames[MY_ID].pFrame = &NewFrame; <- set array to point at my new frame instead, now + CExceptionFrames[MY_ID].Exception = CEXCEPTION_NONE; <- initialize my exception id to be NONE + if (setjmp(NewFrame) == 0) { <- do setjmp. it returns 1 if longjump called, otherwise 0 + if (&PrevFrame) <- this is here to force proper scoping. it requires braces or a single line to be but after Try, otherwise won't compile. This is always true at this point. + +#define Catch(e) + else { } <- this also forces proper scoping. Without this they could stick their own 'else' in and it would get ugly + CExceptionFrames[MY_ID].Exception = CEXCEPTION_NONE; <- no errors happened, so just set the exception id to NONE (in case it was corrupted) + } + else <- an exception occurred + { e = CExceptionFrames[MY_ID].Exception; e=e;} <- assign the caught exception id to the variable passed in. + CExceptionFrames[MY_ID].pFrame = PrevFrame; <- make the pointer in the array point at the previous frame again, as if NewFrame never existed. + } <- finish off that local scope we created to have our own variables + if (CExceptionFrames[CEXCEPTION_GET_ID].Exception != CEXCEPTION_NONE) <- start the actual 'catch' processing if we have an exception id saved away + */ + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/lib/CException.h b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/lib/CException.h new file mode 100644 index 0000000..40c6fc7 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/lib/CException.h @@ -0,0 +1,70 @@ +#ifndef _CEXCEPTION_H +#define _CEXCEPTION_H + +#include + +//To Use CException, you have a number of options: +//1. Just include it and run with the defaults +//2. Define any of the following symbols at the command line to override them +//3. Include a header file before CException.h everywhere which defines any of these +//4. Create an Exception.h in your path, and just define EXCEPTION_USE_CONFIG_FILE first + +#ifdef CEXCEPTION_USE_CONFIG_FILE +#include "CExceptionConfig.h" +#endif + +//This is the value to assign when there isn't an exception +#ifndef CEXCEPTION_NONE +#define CEXCEPTION_NONE (0x5A5A5A5A) +#endif + +//This is number of exception stacks to keep track of (one per task) +#ifndef CEXCEPTION_NUM_ID +#define CEXCEPTION_NUM_ID (1) //there is only the one stack by default +#endif + +//This is the method of getting the current exception stack index (0 if only one stack) +#ifndef CEXCEPTION_GET_ID +#define CEXCEPTION_GET_ID (0) //use the first index always because there is only one anyway +#endif + +//The type to use to store the exception values. +#ifndef CEXCEPTION_T +#define CEXCEPTION_T unsigned int +#endif + +//exception frame structures +typedef struct { + jmp_buf* pFrame; + volatile CEXCEPTION_T Exception; +} CEXCEPTION_FRAME_T; + +//actual root frame storage (only one if single-tasking) +extern volatile CEXCEPTION_FRAME_T CExceptionFrames[]; + +//Try (see C file for explanation) +#define Try \ + { \ + jmp_buf *PrevFrame, NewFrame; \ + unsigned int MY_ID = CEXCEPTION_GET_ID; \ + PrevFrame = CExceptionFrames[CEXCEPTION_GET_ID].pFrame; \ + CExceptionFrames[MY_ID].pFrame = (jmp_buf*)(&NewFrame); \ + CExceptionFrames[MY_ID].Exception = CEXCEPTION_NONE; \ + if (setjmp(NewFrame) == 0) { \ + if (&PrevFrame) + +//Catch (see C file for explanation) +#define Catch(e) \ + else { } \ + CExceptionFrames[MY_ID].Exception = CEXCEPTION_NONE; \ + } \ + else \ + { e = CExceptionFrames[MY_ID].Exception; e=e; } \ + CExceptionFrames[MY_ID].pFrame = PrevFrame; \ + } \ + if (CExceptionFrames[CEXCEPTION_GET_ID].Exception != CEXCEPTION_NONE) + +//Throw an Error +void Throw(CEXCEPTION_T ExceptionID); + +#endif // _CEXCEPTION_H diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/makefile b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/makefile new file mode 100644 index 0000000..c168a41 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/makefile @@ -0,0 +1,24 @@ +#Tool and Lib Locations +C_COMPILER=gcc +C_LIBS=C:/MinGW/lib +UNITY_DIR=vendor/unity/src + +#Test File To Be Created +OUT_FILE=test_cexceptions +ifeq ($(OS),Windows_NT) +OUT_EXTENSION=.exe +else +OUT_EXTENSION=.out +endif + +#Options +SRC_FILES=lib/CException.c test/TestException.c test/TestException_Runner.c $(UNITY_DIR)/unity.c +INC_DIRS=-Ilib -Itest -I$(UNITY_DIR) +LIB_DIRS=-L$(C_LIBS) +SYMBOLS=-DTEST -DEXCEPTION_USE_CONFIG_FILE + +#Default Task: Compile And Run Tests +default: + $(C_COMPILER) $(INC_DIRS) $(LIB_DIRS) $(SYMBOLS) $(SRC_FILES) -o $(OUT_FILE)$(OUT_EXTENSION) + $(OUT_FILE)$(OUT_EXTENSION) + \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/rakefile.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/rakefile.rb new file mode 100644 index 0000000..2458c6f --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/rakefile.rb @@ -0,0 +1,41 @@ +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require HERE+'vendor/unity/auto/colour_reporter.rb' + +#Tool and Lib Locations +C_COMPILER = 'gcc' +C_LIBS = '' +UNITY_DIR = 'vendor/unity/src' + +#Test File To Be Created +OUT_FILE = 'test_cexceptions' +OUT_EXTENSION = '.out' + +#Options +SRC_FILES = "lib/CException.c test/TestException.c test/TestException_Runner.c #{UNITY_DIR}/unity.c" +INC_DIRS = "-Ilib -Itest -I#{UNITY_DIR}" +LIB_DIRS = C_LIBS.empty? ? '' : "-L#{C_LIBS}" +SYMBOLS = '-DTEST -DEXCEPTION_USE_CONFIG_FILE' + +CLEAN.include("#{HERE}*.out") + +task :default => [:clobber, :test] +task :cruise => [:no_color, :default] + +desc "performs a quick set of unit tests to confirm you're ready to go" +task :test do + report "#{C_COMPILER} #{INC_DIRS} #{LIB_DIRS} #{SYMBOLS} #{SRC_FILES} -o #{OUT_FILE}#{OUT_EXTENSION}" + output = `#{C_COMPILER} #{INC_DIRS} #{LIB_DIRS} #{SYMBOLS} #{SRC_FILES} -o #{OUT_FILE}#{OUT_EXTENSION}` + report output + + report "#{HERE}#{OUT_FILE}#{OUT_EXTENSION}" + output = `#{HERE}#{OUT_FILE}#{OUT_EXTENSION}` + report output +end + +task :no_color do + $colour_output = false +end \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/release/build.info b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/release/build.info new file mode 100644 index 0000000..b5794c5 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/release/build.info @@ -0,0 +1,2 @@ +16 + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/release/version.info b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/release/version.info new file mode 100644 index 0000000..cb7e5f6 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/release/version.info @@ -0,0 +1,2 @@ +1.2.0 + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/test/CExceptionConfig.h b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/test/CExceptionConfig.h new file mode 100644 index 0000000..79b085d --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/test/CExceptionConfig.h @@ -0,0 +1,27 @@ +#ifndef _EXCEPTION_H +#define _EXCEPTION_H + +//Optionally define the exception type (something like an int which can be directly assigned) +#define CEXCEPTION_T int + +// Optionally define the reserved value representing NO EXCEPTION +#define CEXCEPTION_NONE (1234) + +// Multi-Tasking environments will need a couple of macros defined to make this library +// properly handle multiple exception stacks. You will need to include and required +// definitions, then define the following macros: +// EXCEPTION_GET_ID - returns the id of the current task indexed 0 to (numtasks - 1) +// EXCEPTION_NUM_ID - returns the number of tasks that might be returned +// +// For example, Quadros might include the following implementation: +#ifndef TEST +#include "OSAPI.h" +#define CEXCEPTION_GET_ID (KS_GetTaskID()) +#define CEXCEPTION_NUM_ID (NTASKS + 1) +#endif + +//This could be a good place to define/include some error ID's: +#define ERROR_ID_EVERYTHING_IS_BROKEN (0x88) +#define ERROR_ID_ONLY_THIS_IS_BROKEN (0x77) + +#endif // _EXCEPTION_H diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/test/TestException.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/test/TestException.c new file mode 100644 index 0000000..704cfdb --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/test/TestException.c @@ -0,0 +1,291 @@ +#include "unity.h" +#include "CException.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void test_BasicTryDoesNothingIfNoThrow(void) +{ + int i; + CEXCEPTION_T e = 0x5a; + + Try + { + i += 1; + } + Catch(e) + { + TEST_FAIL_MESSAGE("Should Not Enter Catch If Not Thrown") + } + + //verify that e was untouched + TEST_ASSERT_EQUAL(0x5a, e); +} + +void test_BasicThrowAndCatch(void) +{ + CEXCEPTION_T e; + + Try + { + Throw(0xBE); + TEST_FAIL_MESSAGE("Should Have Thrown An Error") + } + Catch(e) + { + //verify that e has the right data + TEST_ASSERT_EQUAL(0xBE, e); + } + + //verify that e STILL has the right data + TEST_ASSERT_EQUAL(0xBE, e); +} + +void test_BasicThrowAndCatch_WithMiniSyntax(void) +{ + CEXCEPTION_T e; + + //Mini Throw and Catch + Try + Throw(0xEF); + Catch(e) + TEST_ASSERT_EQUAL(0xEF, e); + TEST_ASSERT_EQUAL(0xEF, e); + + //Mini Passthrough + Try + e = 0; + Catch(e) + TEST_FAIL_MESSAGE("I shouldn't be caught because there was no throw"); + + TEST_ASSERT_EQUAL(0, e); +} + +void test_VerifyVolatilesSurviveThrowAndCatch(void) +{ + volatile unsigned int VolVal = 0; + CEXCEPTION_T e; + + Try + { + VolVal = 2; + Throw(0xBF); + TEST_FAIL_MESSAGE("Should Have Thrown An Error") + } + Catch(e) + { + VolVal += 2; + TEST_ASSERT_EQUAL(0xBF, e); + } + + TEST_ASSERT_EQUAL(4, VolVal); + TEST_ASSERT_EQUAL(0xBF, e); +} + +void HappyExceptionThrower(unsigned int ID) +{ + if (ID != 0) + { + Throw(ID); + } +} + +void test_ThrowFromASubFunctionAndCatchInRootFunc(void) +{ + volatile unsigned int ID = 0; + CEXCEPTION_T e; + + Try + { + + HappyExceptionThrower(0xBA); + TEST_FAIL_MESSAGE("Should Have Thrown An Exception"); + } + Catch(e) + { + ID = e; + } + + //verify that I can pass that value to something else + TEST_ASSERT_EQUAL(0xBA, e); +} + +void HappyExceptionRethrower(unsigned int ID) +{ + CEXCEPTION_T e; + + Try + { + Throw(ID); + } + Catch(e) + { + switch (e) + { + case 0xBD: + Throw(0xBF); + break; + default: + break; + } + } +} + +void test_ThrowAndCatchFromASubFunctionAndRethrowToCatchInRootFunc(void) +{ + volatile unsigned int ID = 0; + CEXCEPTION_T e; + + Try + { + HappyExceptionRethrower(0xBD); + TEST_FAIL_MESSAGE("Should Have Rethrown Exception"); + } + Catch(e) + { + ID = 1; + } + + TEST_ASSERT_EQUAL(0xBF, e); + TEST_ASSERT_EQUAL(1, ID); +} + +void test_ThrowAndCatchFromASubFunctionAndNoRethrowToCatchInRootFunc(void) +{ + CEXCEPTION_T e = 3; + + Try + { + HappyExceptionRethrower(0xBF); + } + Catch(e) + { + TEST_FAIL_MESSAGE("Should Not Have Re-thrown Error (it should have already been caught)"); + } + + //verify that THIS e is still untouched, even though subfunction was touched + TEST_ASSERT_EQUAL(3, e); +} + +void test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThisDoesntCorruptExceptionId(void) +{ + CEXCEPTION_T e; + + Try + { + HappyExceptionThrower(0xBF); + TEST_FAIL_MESSAGE("Should Have Thrown Exception"); + } + Catch(e) + { + TEST_ASSERT_EQUAL(0xBF, e); + HappyExceptionRethrower(0x12); + TEST_ASSERT_EQUAL(0xBF, e); + } + TEST_ASSERT_EQUAL(0xBF, e); +} + +void test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThatEachExceptionIdIndependent(void) +{ + CEXCEPTION_T e1, e2; + + Try + { + HappyExceptionThrower(0xBF); + TEST_FAIL_MESSAGE("Should Have Thrown Exception"); + } + Catch(e1) + { + TEST_ASSERT_EQUAL(0xBF, e1); + Try + { + HappyExceptionThrower(0x12); + } + Catch(e2) + { + TEST_ASSERT_EQUAL(0x12, e2); + } + TEST_ASSERT_EQUAL(0x12, e2); + TEST_ASSERT_EQUAL(0xBF, e1); + } + TEST_ASSERT_EQUAL(0x12, e2); + TEST_ASSERT_EQUAL(0xBF, e1); +} + +void test_CanHaveMultipleTryBlocksInASingleFunction(void) +{ + CEXCEPTION_T e; + + Try + { + HappyExceptionThrower(0x01); + TEST_FAIL_MESSAGE("Should Have Thrown Exception"); + } + Catch(e) + { + TEST_ASSERT_EQUAL(0x01, e); + } + + Try + { + HappyExceptionThrower(0xF0); + TEST_FAIL_MESSAGE("Should Have Thrown Exception"); + } + Catch(e) + { + TEST_ASSERT_EQUAL(0xF0, e); + } +} + +void test_CanHaveNestedTryBlocksInASingleFunction_ThrowInside(void) +{ + int i = 0; + CEXCEPTION_T e; + + Try + { + Try + { + HappyExceptionThrower(0x01); + i = 1; + TEST_FAIL_MESSAGE("Should Have Rethrown Exception"); + } + Catch(e) + { + TEST_ASSERT_EQUAL(0x01, e); + } + } + Catch(e) + { + TEST_FAIL_MESSAGE("Should Have Been Caught By Inside Catch"); + } +} + +void test_CanHaveNestedTryBlocksInASingleFunction_ThrowOutside(void) +{ + int i = 0; + CEXCEPTION_T e; + + Try + { + Try + { + i = 2; + } + Catch(e) + { + TEST_FAIL_MESSAGE("Should NotBe Caught Here"); + } + HappyExceptionThrower(0x01); + TEST_FAIL_MESSAGE("Should Have Rethrown Exception"); + } + Catch(e) + { + TEST_ASSERT_EQUAL(0x01, e); + } +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/test/TestException_Runner.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/test/TestException_Runner.c new file mode 100644 index 0000000..1697a0e --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/test/TestException_Runner.c @@ -0,0 +1,62 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ +#include "unity.h" +#include "CException.h" + +extern void setUp(void); +extern void tearDown(void); + +extern void test_BasicTryDoesNothingIfNoThrow(void); +extern void test_BasicThrowAndCatch(void); +extern void test_BasicThrowAndCatch_WithMiniSyntax(void); +extern void test_VerifyVolatilesSurviveThrowAndCatch(void); +extern void test_ThrowFromASubFunctionAndCatchInRootFunc(void); +extern void test_ThrowAndCatchFromASubFunctionAndRethrowToCatchInRootFunc(void); +extern void test_ThrowAndCatchFromASubFunctionAndNoRethrowToCatchInRootFunc(void); +extern void test_CanHaveMultipleTryBlocksInASingleFunction(void); +extern void test_CanHaveNestedTryBlocksInASingleFunction_ThrowInside(void); +extern void test_CanHaveNestedTryBlocksInASingleFunction_ThrowOutside(void); +extern void test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThisDoesntCorruptExceptionId(void); +extern void test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThatEachExceptionIdIndependent(void); + +static void runTest(UnityTestFunction test) +{ + CEXCEPTION_T e; + if (TEST_PROTECT()) + { + setUp(); + Try + { + test(); + } + Catch(e) + { + TEST_FAIL_MESSAGE("Unexpected exception!") + } + } + tearDown(); +} + + +int main(void) +{ + Unity.TestFile = __FILE__; + UnityBegin(); + + // RUN_TEST calls runTest + RUN_TEST(test_BasicTryDoesNothingIfNoThrow, 12); + RUN_TEST(test_BasicThrowAndCatch, 30); + RUN_TEST(test_BasicThrowAndCatch_WithMiniSyntax, 49); + RUN_TEST(test_VerifyVolatilesSurviveThrowAndCatch, 69); + RUN_TEST(test_ThrowFromASubFunctionAndCatchInRootFunc, 98); + RUN_TEST(test_ThrowAndCatchFromASubFunctionAndRethrowToCatchInRootFunc, 139); + RUN_TEST(test_ThrowAndCatchFromASubFunctionAndNoRethrowToCatchInRootFunc, 158); + RUN_TEST(test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThisDoesntCorruptExceptionId, 175); + RUN_TEST(test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThatEachExceptionIdIndependent, 193); + RUN_TEST(test_CanHaveMultipleTryBlocksInASingleFunction, 220); + RUN_TEST(test_CanHaveNestedTryBlocksInASingleFunction_ThrowInside, 245); + RUN_TEST(test_CanHaveNestedTryBlocksInASingleFunction_ThrowOutside, 269); + + UnityEnd(); + + return 0; +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/colour_prompt.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/colour_prompt.rb new file mode 100644 index 0000000..81003dd --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/colour_prompt.rb @@ -0,0 +1,94 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +if RUBY_PLATFORM =~/(win|w)32$/ + begin + require 'Win32API' + rescue LoadError + puts "ERROR! \"Win32API\" library not found" + puts "\"Win32API\" is required for colour on a windows machine" + puts " try => \"gem install Win32API\" on the command line" + puts + end + # puts + # puts 'Windows Environment Detected...' + # puts 'Win32API Library Found.' + # puts +end + +class ColourCommandLine + def initialize + if RUBY_PLATFORM =~/(win|w)32$/ + get_std_handle = Win32API.new("kernel32", "GetStdHandle", ['L'], 'L') + @set_console_txt_attrb = + Win32API.new("kernel32","SetConsoleTextAttribute",['L','N'], 'I') + @hout = get_std_handle.call(-11) + end + end + + def change_to(new_colour) + if RUBY_PLATFORM =~/(win|w)32$/ + @set_console_txt_attrb.call(@hout,self.win32_colour(new_colour)) + else + "\033[30;#{posix_colour(new_colour)};22m" + end + end + + def win32_colour(colour) + case colour + when :black then 0 + when :dark_blue then 1 + when :dark_green then 2 + when :dark_cyan then 3 + when :dark_red then 4 + when :dark_purple then 5 + when :dark_yellow, :narrative then 6 + when :default_white, :default, :dark_white then 7 + when :silver then 8 + when :blue then 9 + when :green, :success then 10 + when :cyan, :output then 11 + when :red, :failure then 12 + when :purple then 13 + when :yellow then 14 + when :white then 15 + else + 0 + end + end + + def posix_colour(colour) + case colour + when :black then 30 + when :red, :failure then 31 + when :green, :success then 32 + when :yellow then 33 + when :blue, :narrative then 34 + when :purple, :magenta then 35 + when :cyan, :output then 36 + when :white, :default_white, :default then 37 + else + 30 + end + end + + def out_c(mode, colour, str) + case RUBY_PLATFORM + when /(win|w)32$/ + change_to(colour) + $stdout.puts str if mode == :puts + $stdout.print str if mode == :print + change_to(:default_white) + else + $stdout.puts("#{change_to(colour)}#{str}\033[0m") if mode == :puts + $stdout.print("#{change_to(colour)}#{str}\033[0m") if mode == :print + end + end +end # ColourCommandLine + +def colour_puts(role,str) ColourCommandLine.new.out_c(:puts, role, str) end +def colour_print(role,str) ColourCommandLine.new.out_c(:print, role, str) end + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/colour_reporter.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/colour_reporter.rb new file mode 100644 index 0000000..5aa1d27 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/colour_reporter.rb @@ -0,0 +1,39 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require "#{File.expand_path(File.dirname(__FILE__))}/colour_prompt" + +$colour_output = true + +def report(message) + if not $colour_output + $stdout.puts(message) + else + message = message.join('\n') if (message.class == Array) + message.each_line do |line| + line.chomp! + colour = case(line) + when /(?:total\s+)?tests:?\s+(\d+)\s+(?:total\s+)?failures:?\s+\d+\s+Ignored:?/i + ($1.to_i == 0) ? :green : :red + when /PASS/ + :green + when /^OK$/ + :green + when /(?:FAIL|ERROR)/ + :red + when /IGNORE/ + :yellow + when /^(?:Creating|Compiling|Linking)/ + :white + else + :silver + end + colour_puts(colour, line) + end + end + $stdout.flush + $stderr.flush +end \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_config.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_config.yml new file mode 100644 index 0000000..4a5e474 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_config.yml @@ -0,0 +1,36 @@ +#this is a sample configuration file for generate_module +#you would use it by calling generate_module with the -ygenerate_config.yml option +#files like this are useful for customizing generate_module to your environment +:generate_module: + :defaults: + #these defaults are used in place of any missing options at the command line + :path_src: ../src/ + :path_inc: ../src/ + :path_tst: ../test/ + :update_svn: true + :includes: + #use [] for no additional includes, otherwise list the includes on separate lines + :src: + - Defs.h + - Board.h + :inc: [] + :tst: + - Defs.h + - Board.h + - Exception.h + :boilerplates: + #these are inserted at the top of generated files. + #just comment out or remove if not desired. + #use %1$s where you would like the file name to appear (path/extension not included) + :src: | + //------------------------------------------- + // %1$s.c + //------------------------------------------- + :inc: | + //------------------------------------------- + // %1$s.h + //------------------------------------------- + :tst: | + //------------------------------------------- + // Test%1$s.c : Units tests for %1$s.c + //------------------------------------------- diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_module.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_module.rb new file mode 100644 index 0000000..3db1a98 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_module.rb @@ -0,0 +1,202 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +# This script creates all the files with start code necessary for a new module. +# A simple module only requires a source file, header file, and test file. +# Triad modules require a source, header, and test file for each triad type (like model, conductor, and hardware). + +require 'rubygems' +require 'fileutils' + +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +#help text when requested +HELP_TEXT = [ "\nGENERATE MODULE\n-------- ------", + "\nUsage: ruby generate_module [options] module_name", + " -i\"include\" sets the path to output headers to 'include' (DEFAULT ../src)", + " -s\"../src\" sets the path to output source to '../src' (DEFAULT ../src)", + " -t\"C:/test\" sets the path to output source to 'C:/test' (DEFAULT ../test)", + " -p\"MCH\" sets the output pattern to MCH.", + " dh - driver hardware.", + " dih - driver interrupt hardware.", + " mch - model conductor hardware.", + " mvp - model view presenter.", + " src - just a single source module. (DEFAULT)", + " -d destroy module instead of creating it.", + " -u update subversion too (requires subversion command line)", + " -y\"my.yml\" selects a different yaml config file for module generation", + "" ].join("\n") + +#Built in patterns +PATTERNS = { 'src' => {'' => { :inc => [] } }, + 'dh' => {'Driver' => { :inc => ['%1$sHardware.h'] }, + 'Hardware' => { :inc => [] } + }, + 'dih' => {'Driver' => { :inc => ['%1$sHardware.h', '%1$sInterrupt.h'] }, + 'Interrupt'=> { :inc => ['%1$sHardware.h'] }, + 'Hardware' => { :inc => [] } + }, + 'mch' => {'Model' => { :inc => [] }, + 'Conductor'=> { :inc => ['%1$sModel.h', '%1$sHardware.h'] }, + 'Hardware' => { :inc => [] } + }, + 'mvp' => {'Model' => { :inc => [] }, + 'Presenter'=> { :inc => ['%1$sModel.h', '%1$sView.h'] }, + 'View' => { :inc => [] } + } + } + +#TEMPLATE_TST +TEMPLATE_TST = %q[#include "unity.h" +%2$s#include "%1$s.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void test_%1$s_NeedToImplement(void) +{ + TEST_IGNORE(); +} +] + +#TEMPLATE_SRC +TEMPLATE_SRC = %q[%2$s#include "%1$s.h" +] + +#TEMPLATE_INC +TEMPLATE_INC = %q[#ifndef _%3$s_H +#define _%3$s_H%2$s + +#endif // _%3$s_H +] + +# Parse the command line parameters. +ARGV.each do |arg| + case(arg) + when /^-d/ then @destroy = true + when /^-u/ then @update_svn = true + when /^-p(\w+)/ then @pattern = $1 + when /^-s(.+)/ then @path_src = $1 + when /^-i(.+)/ then @path_inc = $1 + when /^-t(.+)/ then @path_tst = $1 + when /^-y(.+)/ then @yaml_config = $1 + when /^(\w+)/ + raise "ERROR: You can't have more than one Module name specified!" unless @module_name.nil? + @module_name = arg + when /^-(h|-help)/ + puts HELP_TEXT + exit + else + raise "ERROR: Unknown option specified '#{arg}'" + end +end +raise "ERROR: You must have a Module name specified! (use option -h for help)" if @module_name.nil? + +#load yaml file if one was requested +if @yaml_config + require 'yaml' + cfg = YAML.load_file(HERE + @yaml_config)[:generate_module] + @path_src = cfg[:defaults][:path_src] if @path_src.nil? + @path_inc = cfg[:defaults][:path_inc] if @path_inc.nil? + @path_tst = cfg[:defaults][:path_tst] if @path_tst.nil? + @update_svn = cfg[:defaults][:update_svn] if @update_svn.nil? + @extra_inc = cfg[:includes] + @boilerplates = cfg[:boilerplates] +else + @boilerplates = {} +end + +# Create default file paths if none were provided +@path_src = HERE + "../src/" if @path_src.nil? +@path_inc = @path_src if @path_inc.nil? +@path_tst = HERE + "../test/" if @path_tst.nil? +@path_src += '/' unless (@path_src[-1] == 47) +@path_inc += '/' unless (@path_inc[-1] == 47) +@path_tst += '/' unless (@path_tst[-1] == 47) +@pattern = 'src' if @pattern.nil? +@includes = { :src => [], :inc => [], :tst => [] } +@includes.merge!(@extra_inc) unless @extra_inc.nil? + +#create triad definition +TRIAD = [ { :ext => '.c', :path => @path_src, :template => TEMPLATE_SRC, :inc => :src, :boilerplate => @boilerplates[:src] }, + { :ext => '.h', :path => @path_inc, :template => TEMPLATE_INC, :inc => :inc, :boilerplate => @boilerplates[:inc] }, + { :ext => '.c', :path => @path_tst+'Test', :template => TEMPLATE_TST, :inc => :tst, :boilerplate => @boilerplates[:tst] }, + ] + +#prepare the pattern for use +@patterns = PATTERNS[@pattern.downcase] +raise "ERROR: The design pattern specified isn't one that I recognize!" if @patterns.nil? + +# Assemble the path/names of the files we need to work with. +files = [] +TRIAD.each do |triad| + @patterns.each_pair do |pattern_file, pattern_traits| + files << { + :path => "#{triad[:path]}#{@module_name}#{pattern_file}#{triad[:ext]}", + :name => "#{@module_name}#{pattern_file}", + :template => triad[:template], + :boilerplate => triad[:boilerplate], + :includes => case(triad[:inc]) + when :src then @includes[:src] | pattern_traits[:inc].map{|f| f % [@module_name]} + when :inc then @includes[:inc] + when :tst then @includes[:tst] | pattern_traits[:inc].map{|f| "Mock#{f}"% [@module_name]} + end + } + end +end + +# destroy files if that was what was requested +if @destroy + files.each do |filespec| + file = filespec[:path] + if File.exist?(file) + if @update_svn + `svn delete \"#{file}\" --force` + puts "File #{file} deleted and removed from source control" + else + FileUtils.remove(file) + puts "File #{file} deleted" + end + else + puts "File #{file} does not exist so cannot be removed." + end + end + puts "Destroy Complete" + exit +end + +#Abort if any module already exists +files.each do |file| + raise "ERROR: File #{file[:name]} already exists. Exiting." if File.exist?(file[:path]) +end + +# Create Source Modules +files.each_with_index do |file, i| + File.open(file[:path], 'w') do |f| + f.write(file[:boilerplate] % [file[:name]]) unless file[:boilerplate].nil? + f.write(file[:template] % [ file[:name], + file[:includes].map{|f| "#include \"#{f}\"\n"}.join, + file[:name].upcase ] + ) + end + if (@update_svn) + `svn add \"#{file[:path]}\"` + if $?.exitstatus == 0 + puts "File #{file[:path]} created and added to source control" + else + puts "File #{file[:path]} created but FAILED adding to source control!" + end + else + puts "File #{file[:path]} created" + end +end + +puts 'Generate Complete' diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb new file mode 100644 index 0000000..aff5053 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb @@ -0,0 +1,303 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +File.expand_path(File.join(File.dirname(__FILE__),'colour_prompt')) + +class UnityTestRunnerGenerator + + def initialize(options = nil) + @options = { :includes => [], :plugins => [], :framework => :unity } + case(options) + when NilClass then @options + when String then @options.merge!(UnityTestRunnerGenerator.grab_config(options)) + when Hash then @options.merge!(options) + else raise "If you specify arguments, it should be a filename or a hash of options" + end + end + + def self.grab_config(config_file) + options = { :includes => [], :plugins => [], :framework => :unity } + unless (config_file.nil? or config_file.empty?) + require 'yaml' + yaml_guts = YAML.load_file(config_file) + options.merge!(yaml_guts[:unity] ? yaml_guts[:unity] : yaml_guts[:cmock]) + raise "No :unity or :cmock section found in #{config_file}" unless options + end + return(options) + end + + def run(input_file, output_file, options=nil) + tests = [] + includes = [] + used_mocks = [] + + @options.merge!(options) unless options.nil? + module_name = File.basename(input_file) + + #pull required data from source file + File.open(input_file, 'r') do |input| + tests = find_tests(input) + includes = find_includes(input) + used_mocks = find_mocks(includes) + end + + #build runner file + File.open(output_file, 'w') do |output| + create_header(output, used_mocks) + create_externs(output, tests, used_mocks) + create_mock_management(output, used_mocks) + create_suite_setup_and_teardown(output) + create_reset(output, used_mocks) + create_main(output, input_file, tests) + end + + all_files_used = [input_file, output_file] + all_files_used += includes.map {|filename| filename + '.c'} unless includes.empty? + all_files_used += @options[:includes] unless @options[:includes].empty? + return all_files_used.uniq + end + + def find_tests(input_file) + tests_raw = [] + tests_args = [] + tests_and_line_numbers = [] + + input_file.rewind + source_raw = input_file.read + source_scrubbed = source_raw.gsub(/\/\/.*$/, '') # remove line comments + source_scrubbed = source_scrubbed.gsub(/\/\*.*?\*\//m, '') # remove block comments + lines = source_scrubbed.split(/(^\s*\#.*$) # Treat preprocessor directives as a logical line + | (;|\{|\}) /x) # Match ;, {, and } as end of lines + + lines.each_with_index do |line, index| + #find tests + if line =~ /^((?:\s*TEST_CASE\s*\(.*?\)\s*)*)\s*void\s+(test.*?)\s*\(\s*(.*)\s*\)/ + arguments = $1 + name = $2 + call = $3 + args = nil + if (@options[:use_param_tests] and !arguments.empty?) + args = [] + arguments.scan(/\s*TEST_CASE\s*\((.*)\)\s*$/) {|a| args << a[0]} + end + tests_and_line_numbers << { :name => name, :args => args, :call => call, :line_number => 0 } + tests_args = [] + end + end + + #determine line numbers and create tests to run + source_lines = source_raw.split("\n") + source_index = 0; + tests_and_line_numbers.size.times do |i| + source_lines[source_index..-1].each_with_index do |line, index| + if (line =~ /#{tests_and_line_numbers[i][:name]}/) + source_index += index + tests_and_line_numbers[i][:line_number] = source_index + 1 + break + end + end + end + + return tests_and_line_numbers + end + + def find_includes(input_file) + input_file.rewind + includes = [] + input_file.readlines.each do |line| + scan_results = line.scan(/^\s*#include\s+\"\s*(.+)\.[hH]\s*\"/) + includes << scan_results[0][0] if (scan_results.size > 0) + end + return includes + end + + def find_mocks(includes) + mock_headers = [] + includes.each do |include_file| + mock_headers << File.basename(include_file) if (include_file =~ /^mock/i) + end + return mock_headers + end + + def create_header(output, mocks) + output.puts('/* AUTOGENERATED FILE. DO NOT EDIT. */') + create_runtest(output, mocks) + output.puts("\n//=======Automagically Detected Files To Include=====") + output.puts("#include \"#{@options[:framework].to_s}.h\"") + output.puts('#include "cmock.h"') unless (mocks.empty?) + @options[:includes].flatten.uniq.compact.each do |inc| + output.puts("#include #{inc.include?('<') ? inc : "\"#{inc.gsub('.h','')}.h\""}") + end + output.puts('#include ') + output.puts('#include ') + output.puts('#include "CException.h"') if @options[:plugins].include?(:cexception) + mocks.each do |mock| + output.puts("#include \"#{mock.gsub('.h','')}.h\"") + end + if @options[:enforce_strict_ordering] + output.puts('') + output.puts('int GlobalExpectCount;') + output.puts('int GlobalVerifyOrder;') + output.puts('char* GlobalOrderError;') + end + end + + def create_externs(output, tests, mocks) + output.puts("\n//=======External Functions This Runner Calls=====") + output.puts("extern void setUp(void);") + output.puts("extern void tearDown(void);") + tests.each do |test| + output.puts("extern void #{test[:name]}(#{test[:call]});") + end + output.puts('') + end + + def create_mock_management(output, mocks) + unless (mocks.empty?) + output.puts("\n//=======Mock Management=====") + output.puts("static void CMock_Init(void)") + output.puts("{") + if @options[:enforce_strict_ordering] + output.puts(" GlobalExpectCount = 0;") + output.puts(" GlobalVerifyOrder = 0;") + output.puts(" GlobalOrderError = NULL;") + end + mocks.each do |mock| + output.puts(" #{mock}_Init();") + end + output.puts("}\n") + + output.puts("static void CMock_Verify(void)") + output.puts("{") + mocks.each do |mock| + output.puts(" #{mock}_Verify();") + end + output.puts("}\n") + + output.puts("static void CMock_Destroy(void)") + output.puts("{") + mocks.each do |mock| + output.puts(" #{mock}_Destroy();") + end + output.puts("}\n") + end + end + + def create_suite_setup_and_teardown(output) + unless (@options[:suite_setup].nil?) + output.puts("\n//=======Suite Setup=====") + output.puts("static int suite_setup(void)") + output.puts("{") + output.puts(@options[:suite_setup]) + output.puts("}") + end + unless (@options[:suite_teardown].nil?) + output.puts("\n//=======Suite Teardown=====") + output.puts("static int suite_teardown(int num_failures)") + output.puts("{") + output.puts(@options[:suite_teardown]) + output.puts("}") + end + end + + def create_runtest(output, used_mocks) + cexception = @options[:plugins].include? :cexception + va_args1 = @options[:use_param_tests] ? ', ...' : '' + va_args2 = @options[:use_param_tests] ? '__VA_ARGS__' : '' + output.puts("\n//=======Test Runner Used To Run Each Test Below=====") + output.puts("#define RUN_TEST_NO_ARGS") if @options[:use_param_tests] + output.puts("#define RUN_TEST(TestFunc, TestLineNum#{va_args1}) \\") + output.puts("{ \\") + output.puts(" Unity.CurrentTestName = #TestFunc#{va_args2.empty? ? '' : " \"(\" ##{va_args2} \")\""}; \\") + output.puts(" Unity.CurrentTestLineNumber = TestLineNum; \\") + output.puts(" Unity.NumberOfTests++; \\") + output.puts(" if (TEST_PROTECT()) \\") + output.puts(" { \\") + output.puts(" CEXCEPTION_T e; \\") if cexception + output.puts(" Try { \\") if cexception + output.puts(" CMock_Init(); \\") unless (used_mocks.empty?) + output.puts(" setUp(); \\") + output.puts(" TestFunc(#{va_args2}); \\") + output.puts(" CMock_Verify(); \\") unless (used_mocks.empty?) + output.puts(" } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, \"Unhandled Exception!\"); } \\") if cexception + output.puts(" } \\") + output.puts(" CMock_Destroy(); \\") unless (used_mocks.empty?) + output.puts(" if (TEST_PROTECT() && !TEST_IS_IGNORED) \\") + output.puts(" { \\") + output.puts(" tearDown(); \\") + output.puts(" } \\") + output.puts(" UnityConcludeTest(); \\") + output.puts("}\n") + end + + def create_reset(output, used_mocks) + output.puts("\n//=======Test Reset Option=====") + output.puts("void resetTest()") + output.puts("{") + output.puts(" CMock_Verify();") unless (used_mocks.empty?) + output.puts(" CMock_Destroy();") unless (used_mocks.empty?) + output.puts(" tearDown();") + output.puts(" CMock_Init();") unless (used_mocks.empty?) + output.puts(" setUp();") + output.puts("}") + end + + def create_main(output, filename, tests) + output.puts("\n\n//=======MAIN=====") + output.puts("int main(void)") + output.puts("{") + output.puts(" suite_setup();") unless @options[:suite_setup].nil? + output.puts(" Unity.TestFile = \"#{filename}\";") + output.puts(" UnityBegin();") + if (@options[:use_param_tests]) + tests.each do |test| + if ((test[:args].nil?) or (test[:args].empty?)) + output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]}, RUN_TEST_NO_ARGS);") + else + test[:args].each {|args| output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]}, #{args});")} + end + end + else + tests.each { |test| output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]});") } + end + output.puts() + output.puts(" return #{@options[:suite_teardown].nil? ? "" : "suite_teardown"}(UnityEnd());") + output.puts("}") + end +end + + +if ($0 == __FILE__) + options = { :includes => [] } + yaml_file = nil + + #parse out all the options first + ARGV.reject! do |arg| + case(arg) + when '-cexception' + options[:plugins] = [:cexception]; true + when /\.*\.yml/ + options = UnityTestRunnerGenerator.grab_config(arg); true + else false + end + end + + #make sure there is at least one parameter left (the input file) + if !ARGV[0] + puts ["usage: ruby #{__FILE__} (yaml) (options) input_test_file output_test_runner (includes)", + " blah.yml - will use config options in the yml file (see docs)", + " -cexception - include cexception support"].join("\n") + exit 1 + end + + #create the default test runner name if not specified + ARGV[1] = ARGV[0].gsub(".c","_Runner.c") if (!ARGV[1]) + + #everything else is an include file + options[:includes] ||= (ARGV.slice(2..-1).flatten.compact) if (ARGV.size > 2) + + UnityTestRunnerGenerator.new(options).run(ARGV[0], ARGV[1]) +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/test_file_filter.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/test_file_filter.rb new file mode 100644 index 0000000..3dbc26a --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/test_file_filter.rb @@ -0,0 +1,23 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require'yaml' + +module RakefileHelpers + class TestFileFilter + def initialize(all_files = false) + @all_files = all_files + if not @all_files == true + if File.exist?('test_file_filter.yml') + filters = YAML.load_file( 'test_file_filter.yml' ) + @all_files, @only_files, @exclude_files = + filters[:all_files], filters[:only_files], filters[:exclude_files] + end + end + end + attr_accessor :all_files, :only_files, :exclude_files + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/unity_test_summary.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/unity_test_summary.rb new file mode 100644 index 0000000..69ec2e8 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/unity_test_summary.rb @@ -0,0 +1,126 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +#!/usr/bin/ruby +# +# unity_test_summary.rb +# +require 'fileutils' +require 'set' + +class UnityTestSummary + include FileUtils::Verbose + + attr_reader :report, :total_tests, :failures, :ignored + + def initialize + @report = '' + @total_tests = 0 + @failures = 0 + @ignored = 0 + end + + def run + # Clean up result file names + results = @targets.map {|target| target.gsub(/\\/,'/')} + + # Dig through each result file, looking for details on pass/fail: + failure_output = [] + ignore_output = [] + + results.each do |result_file| + lines = File.readlines(result_file).map { |line| line.chomp } + if lines.length == 0 + raise "Empty test result file: #{result_file}" + else + output = get_details(result_file, lines) + failure_output << output[:failures] unless output[:failures].empty? + ignore_output << output[:ignores] unless output[:ignores].empty? + tests,failures,ignored = parse_test_summary(lines) + @total_tests += tests + @failures += failures + @ignored += ignored + end + end + + if @ignored > 0 + @report += "\n" + @report += "--------------------------\n" + @report += "UNITY IGNORED TEST SUMMARY\n" + @report += "--------------------------\n" + @report += ignore_output.flatten.join("\n") + end + + if @failures > 0 + @report += "\n" + @report += "--------------------------\n" + @report += "UNITY FAILED TEST SUMMARY\n" + @report += "--------------------------\n" + @report += failure_output.flatten.join("\n") + end + + @report += "\n" + @report += "--------------------------\n" + @report += "OVERALL UNITY TEST SUMMARY\n" + @report += "--------------------------\n" + @report += "#{@total_tests} TOTAL TESTS #{@failures} TOTAL FAILURES #{@ignored} IGNORED\n" + @report += "\n" + end + + def set_targets(target_array) + @targets = target_array + end + + def set_root_path(path) + @root = path + end + + def usage(err_msg=nil) + puts err_msg if err_msg + puts "Usage: unity_test_summary.rb" + exit 1 + end + + protected + + @@targets=nil + @@path=nil + @@root=nil + + def get_details(result_file, lines) + results = { :failures => [], :ignores => [], :successes => [] } + lines.each do |line| + src_file,src_line,test_name,status,msg = line.split(/:/) + line_out = ((@root and (@root != 0)) ? "#{@root}#{line}" : line ).gsub(/\//, "\\") + case(status) + when 'IGNORE' then results[:ignores] << line_out + when 'FAIL' then results[:failures] << line_out + when 'PASS' then results[:successes] << line_out + end + end + return results + end + + def parse_test_summary(summary) + if summary[-3..-1].join("\n") =~ /(\d+) Tests (\d+) Failures (\d+) Ignored/ + [$1.to_i,$2.to_i,$3.to_i] + else + raise "Couldn't parse test results: #{summary}" + end + end + + def here; File.expand_path(File.dirname(__FILE__)); end + +end + +if $0 == __FILE__ + script = UnityTestSummary.new + begin + script.run + rescue Exception => e + script.usage e.message + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/docs/Unity Summary.odt b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/docs/Unity Summary.odt new file mode 100644 index 0000000..f699661 Binary files /dev/null and b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/docs/Unity Summary.odt differ diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/docs/Unity Summary.pdf b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/docs/Unity Summary.pdf new file mode 100644 index 0000000..ad1a956 Binary files /dev/null and b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/docs/Unity Summary.pdf differ diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/docs/Unity Summary.txt b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/docs/Unity Summary.txt new file mode 100644 index 0000000..e0b179d --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/docs/Unity Summary.txt @@ -0,0 +1,217 @@ +============== +Unity Test API +============== + +[Copyright (c) 2007 - Unity Project by Mike Karlesky, Mark VanderVoord, and Greg Williams] + +------------- +Running Tests +------------- + +RUN_TEST(func, linenum) + +Each Test is run within the macro RUN_TEST. This macro performs necessary setup before the test is called and handles cleanup and result tabulation afterwards. + +-------------- +Ignoring Tests +-------------- + +There are times when a test is incomplete or not valid for some reason. At these times, TEST_IGNORE can be called. Control will immediately be returned to the caller of the test, and no failures will be returned. + +TEST_IGNORE() + +Ignore this test and return immediately + +TEST_IGNORE_MESSAGE (message) + +Ignore this test and return immediately. Output a message stating why the test was ignored. + +-------------- +Aborting Tests +-------------- + +There are times when a test will contain an infinite loop on error conditions, or there may be reason to escape from the test early without executing the rest of the test. A pair of macros support this functionality in Unity. The first (TEST_PROTECT) sets up the feature, and handles emergency abort cases. TEST_ABORT can then be used at any time within the tests to return to the last TEST_PROTECT call. + +TEST_PROTECT() + +Setup and Catch macro + +TEST_ABORT() + +Abort Test macro + +Example: + +main() +{ + if (TEST_PROTECT() == 0) + { + MyTest(); + } +} + +If MyTest calls TEST_ABORT, program control will immediately return to TEST_PROTECT with a non-zero return value. + + +======================= +Unity Assertion Summary +======================= + +-------------------- +Basic Validity Tests +-------------------- + +TEST_ASSERT_TRUE(condition) + +Evaluates whatever code is in condition and fails if it evaluates to false + +TEST_ASSERT_FALSE(condition) + +Evaluates whatever code is in condition and fails if it evaluates to true + +TEST_ASSERT(condition) + +Another way of calling TEST_ASSERT_TRUE + +TEST_ASSERT_UNLESS(condition) + +Another way of calling TEST_ASSERT_FALSE + +TEST_FAIL() +TEST_FAIL_MESSAGE(message) + +This test is automatically marked as a failure. The message is output stating why. + +------------------------------ +Numerical Assertions: Integers +------------------------------ + +TEST_ASSERT_EQUAL_INT(expected, actual) +TEST_ASSERT_EQUAL_INT8(expected, actual) +TEST_ASSERT_EQUAL_INT16(expected, actual) +TEST_ASSERT_EQUAL_INT32(expected, actual) +TEST_ASSERT_EQUAL_INT64(expected, actual) + +Compare two integers for equality and display errors as signed integers. A cast will be performed +to your natural integer size so often this can just be used. When you need to specify the exact size, +like when comparing arrays, you can use a specific version: + + + +TEST_ASSERT_EQUAL_UINT(expected, actual) + +Compare two integers for equality and display errors as unsigned integers. Like INT, there are +variants for different sizes also. + + + +TEST_ASSERT_EQUAL_HEX(expected, actual) + +Compares two integers for equality and display errors as hexadecimal. Like the other integer comparisons, +you can specify the size... here the size will also effect how many nibbles are shown (for example, HEX16 +will show 4 nibbles). + +_ARRAY + +You can append _ARRAY to any of these macros to make an array comparison of that type. Here you will +need to care a bit more about the actual size of the value being checked. You will also specify an +additional argument which is the number of elements to compare. For example: + +TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, elements) + + +TEST_ASSERT_EQUAL(expected, actual) + +Another way of calling TEST_ASSERT_EQUAL_INT + + + +TEST_ASSERT_INT_WITHIN(delta, expected, actual) + +Asserts that the actual value is within plus or minus delta of the expected value. This also comes in +size specific variants. + + +----------------------------- +Numerical Assertions: Bitwise +----------------------------- + +TEST_ASSERT_BITS(mask, expected, actual) + +Use an integer mask to specify which bits should be compared between two other integers. High bits in the mask are compared, low bits ignored. + +TEST_ASSERT_BITS_HIGH(mask, actual) + +Use an integer mask to specify which bits should be inspected to determine if they are all set high. High bits in the mask are compared, low bits ignored. + +TEST_ASSERT_BITS_LOW(mask, actual) + +Use an integer mask to specify which bits should be inspected to determine if they are all set low. High bits in the mask are compared, low bits ignored. + +TEST_ASSERT_BIT_HIGH(bit, actual) + +Test a single bit and verify that it is high. The bit is specified 0-31 for a 32-bit integer. + +TEST_ASSERT_BIT_LOW(bit, actual) + +Test a single bit and verify that it is low. The bit is specified 0-31 for a 32-bit integer. + +---------------------------- +Numerical Assertions: Floats +---------------------------- + +TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual) + +Asserts that the actual value is within plus or minus delta of the expected value. + +TEST_ASSERT_EQUAL_FLOAT(expected, actual) + +Asserts that two floating point values are "equal" within a small % delta of the expected value. + +----------------- +String Assertions +----------------- + +TEST_ASSERT_EQUAL_STRING(expected, actual) + +Compare two null-terminate strings. Fail if any character is different or if the lengths are different. + +TEST_ASSERT_EQUAL_STRING_MESSAGE(expected, actual, message) + +Compare two null-terminate strings. Fail if any character is different or if the lengths are different. Output a custom message on failure. + +------------------ +Pointer Assertions +------------------ + +Most pointer operations can be performed by simply using the integer comparisons above. However, a couple of special cases are added for clarity. + +TEST_ASSERT_NULL(pointer) + +Fails if the pointer is not equal to NULL + +TEST_ASSERT_NOT_NULL(pointer) + +Fails if the pointer is equal to NULL + + +----------------- +Memory Assertions +----------------- + +TEST_ASSERT_EQUAL_MEMORY(expected, actual, len) + +Compare two blocks of memory. This is a good generic assertion for types that can't be coerced into acting like +standard types... but since it's a memory compare, you have to be careful that your data types are packed. + +-------- +_MESSAGE +-------- + +you can append _MESSAGE to any of the macros to make them take an additional argument. This argument +is a string that will be printed at the end of the failure strings. This is useful for specifying more +information about the problem. + + + + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/docs/license.txt b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/docs/license.txt new file mode 100644 index 0000000..c42e330 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/docs/license.txt @@ -0,0 +1,31 @@ + Copyright (c) 2007-2010 Mike Karlesky, Mark VanderVoord, Greg Williams + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + The end-user documentation included with the redistribution, if + any, must include the following acknowledgment: "This product + includes software developed for the Unity Project, by Mike Karlesky, + Mark VanderVoord, and Greg Williams and other contributors", in + the same place and form as other third-party acknowledgments. + Alternately, this acknowledgment may appear in the software + itself, in the same form and location as other such third-party + acknowledgments. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.c new file mode 100644 index 0000000..9cf42c6 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.c @@ -0,0 +1,10 @@ +#include "unity.h" +#include "UnityHelper.h" +#include +#include + +void AssertEqualExampleStruct(const EXAMPLE_STRUCT_T expected, const EXAMPLE_STRUCT_T actual, const unsigned short line) +{ + UNITY_TEST_ASSERT_EQUAL_INT(expected.x, actual.x, line, "Example Struct Failed For Field x"); + UNITY_TEST_ASSERT_EQUAL_INT(expected.y, actual.y, line, "Example Struct Failed For Field y"); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.h b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.h new file mode 100644 index 0000000..1516111 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.h @@ -0,0 +1,12 @@ +#ifndef _TESTHELPER_H +#define _TESTHELPER_H + +#include "Types.h" + +void AssertEqualExampleStruct(const EXAMPLE_STRUCT_T expected, const EXAMPLE_STRUCT_T actual, const unsigned short line); + +#define UNITY_TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(expected, actual, line, message) AssertEqualExampleStruct(expected, actual, line); + +#define TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(expected, actual) UNITY_TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(expected, actual, __LINE__, NULL); + +#endif // _TESTHELPER_H diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/makefile b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/makefile new file mode 100644 index 0000000..723d390 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/makefile @@ -0,0 +1,40 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +C_COMPILER=gcc +TARGET_BASE1=test1 +TARGET_BASE2=test2 +ifeq ($(OS),Windows_NT) + TARGET_EXTENSION=.exe +else + TARGET_EXTENSION=.out +endif +TARGET1 = $(TARGET_BASE1)$(TARGET_EXTENSION) +TARGET2 = $(TARGET_BASE2)$(TARGET_EXTENSION) +SRC_FILES1=../src/unity.c src/ProductionCode.c test/TestProductionCode.c test/no_ruby/TestProductionCode_Runner.c +SRC_FILES2=../src/unity.c src/ProductionCode2.c test/TestProductionCode2.c test/no_ruby/TestProductionCode2_Runner.c +INC_DIRS=-Isrc -I../src +SYMBOLS=-DTEST + +ifeq ($(OS),Windows_NT) + CLEANUP = del /F /Q build\* && del /F /Q $(TARGET1) && del /F /Q $(TARGET2) +else + CLEANUP = rm -f build/*.o ; rm -f $(TARGET1) ; rm -f $(TARGET2) +endif + +all: clean default + +default: +# ruby auto/generate_test_runner.rb test/TestProductionCode.c test/no_ruby/TestProductionCode_Runner.c +# ruby auto/generate_test_runner.rb test/TestProductionCode2.c test/no_ruby/TestProductionCode2_Runner.c + $(C_COMPILER) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES1) -o $(TARGET1) + $(C_COMPILER) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES2) -o $(TARGET2) + $(TARGET1) + $(TARGET2) + +clean: + $(CLEANUP) + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/rakefile.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/rakefile.rb new file mode 100644 index 0000000..0905b4b --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/rakefile.rb @@ -0,0 +1,32 @@ +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require HERE+'rakefile_helper' + +include RakefileHelpers + +# Load default configuration, for now +DEFAULT_CONFIG_FILE = 'gcc.yml' +configure_toolchain(DEFAULT_CONFIG_FILE) + +task :unit do + run_tests get_unit_test_files +end + +desc "Generate test summary" +task :summary do + report_summary +end + +desc "Build and test Unity" +task :all => [:clean, :unit, :summary] +task :default => [:clobber, :all] +task :ci => [:default] +task :cruise => [:default] + +desc "Load configuration" +task :config, :config_file do |t, args| + configure_toolchain(args[:config_file]) +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/rakefile_helper.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/rakefile_helper.rb new file mode 100644 index 0000000..0127d69 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/rakefile_helper.rb @@ -0,0 +1,260 @@ +require 'yaml' +require 'fileutils' +require HERE+'../auto/unity_test_summary' +require HERE+'../auto/generate_test_runner' +require HERE+'../auto/colour_reporter' + +module RakefileHelpers + + C_EXTENSION = '.c' + + def load_configuration(config_file) + $cfg_file = "../targets/#{config_file}" + $cfg = YAML.load(File.read($cfg_file)) + end + + def configure_clean + CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil? + end + + def configure_toolchain(config_file=DEFAULT_CONFIG_FILE) + config_file += '.yml' unless config_file =~ /\.yml$/ + load_configuration('../targets/'+config_file) + configure_clean + end + + def get_unit_test_files + path = $cfg['compiler']['unit_tests_path'] + 'Test*' + C_EXTENSION + path.gsub!(/\\/, '/') + FileList.new(path) + end + + def get_local_include_dirs + include_dirs = $cfg['compiler']['includes']['items'].dup + include_dirs.delete_if {|dir| dir.is_a?(Array)} + return include_dirs + end + + def extract_headers(filename) + includes = [] + lines = File.readlines(filename) + lines.each do |line| + m = line.match(/^\s*#include\s+\"\s*(.+\.[hH])\s*\"/) + if not m.nil? + includes << m[1] + end + end + return includes + end + + def find_source_file(header, paths) + paths.each do |dir| + src_file = dir + header.ext(C_EXTENSION) + if (File.exists?(src_file)) + return src_file + end + end + return nil + end + + def tackit(strings) + if strings.is_a?(Array) + result = "\"#{strings.join}\"" + else + result = strings + end + return result + end + + def squash(prefix, items) + result = '' + items.each { |item| result += " #{prefix}#{tackit(item)}" } + return result + end + + def build_compiler_fields + command = tackit($cfg['compiler']['path']) + if $cfg['compiler']['defines']['items'].nil? + defines = '' + else + defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items']) + end + options = squash('', $cfg['compiler']['options']) + includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :defines => defines, :options => options, :includes => includes} + end + + def compile(file, defines=[]) + compiler = build_compiler_fields + cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{file} " + + "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" + + "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" + execute(cmd_str) + end + + def build_linker_fields + command = tackit($cfg['linker']['path']) + if $cfg['linker']['options'].nil? + options = '' + else + options = squash('', $cfg['linker']['options']) + end + if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?) + includes = '' + else + includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) + end + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :options => options, :includes => includes} + end + + def link(exe_name, obj_list) + linker = build_linker_fields + cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + + (obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).join + + $cfg['linker']['bin_files']['prefix'] + ' ' + + $cfg['linker']['bin_files']['destination'] + + exe_name + $cfg['linker']['bin_files']['extension'] + execute(cmd_str) + end + + def build_simulator_fields + return nil if $cfg['simulator'].nil? + if $cfg['simulator']['path'].nil? + command = '' + else + command = (tackit($cfg['simulator']['path']) + ' ') + end + if $cfg['simulator']['pre_support'].nil? + pre_support = '' + else + pre_support = squash('', $cfg['simulator']['pre_support']) + end + if $cfg['simulator']['post_support'].nil? + post_support = '' + else + post_support = squash('', $cfg['simulator']['post_support']) + end + return {:command => command, :pre_support => pre_support, :post_support => post_support} + end + + def execute(command_string, verbose=true, raise_on_fail=true) + report command_string + output = `#{command_string}`.chomp + report(output) if (verbose && !output.nil? && (output.length > 0)) + if (($?.exitstatus != 0) and (raise_on_fail)) + raise "Command failed. (Returned #{$?.exitstatus})" + end + return output + end + + def report_summary + summary = UnityTestSummary.new + summary.set_root_path(HERE) + results_glob = "#{$cfg['compiler']['build_path']}*.test*" + results_glob.gsub!(/\\/, '/') + results = Dir[results_glob] + summary.set_targets(results) + summary.run + fail_out "FAIL: There were failures" if (summary.failures > 0) + end + + def run_tests(test_files) + + report 'Running system tests...' + + # Tack on TEST define for compiling unit tests + load_configuration($cfg_file) + test_defines = ['TEST'] + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + $cfg['compiler']['defines']['items'] << 'TEST' + + include_dirs = get_local_include_dirs + + # Build and execute each unit test + test_files.each do |test| + obj_list = [] + + # Detect dependencies and build required required modules + extract_headers(test).each do |header| + # Compile corresponding source file if it exists + src_file = find_source_file(header, include_dirs) + if !src_file.nil? + compile(src_file, test_defines) + obj_list << header.ext($cfg['compiler']['object_files']['extension']) + end + end + + # Build the test runner (generate if configured to do so) + test_base = File.basename(test, C_EXTENSION) + runner_name = test_base + '_Runner.c' + if $cfg['compiler']['runner_path'].nil? + runner_path = $cfg['compiler']['build_path'] + runner_name + test_gen = UnityTestRunnerGenerator.new($cfg_file) + test_gen.run(test, runner_path) + else + runner_path = $cfg['compiler']['runner_path'] + runner_name + end + + compile(runner_path, test_defines) + obj_list << runner_name.ext($cfg['compiler']['object_files']['extension']) + + # Build the test module + compile(test, test_defines) + obj_list << test_base.ext($cfg['compiler']['object_files']['extension']) + + # Link the test executable + link(test_base, obj_list) + + # Execute unit test and generate results file + simulator = build_simulator_fields + executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] + if simulator.nil? + cmd_str = executable + else + cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" + end + output = execute(cmd_str, true, false) + test_results = $cfg['compiler']['build_path'] + test_base + if output.match(/OK$/m).nil? + test_results += '.testfail' + else + test_results += '.testpass' + end + File.open(test_results, 'w') { |f| f.print output } + end + end + + def build_application(main) + + report "Building application..." + + obj_list = [] + load_configuration($cfg_file) + main_path = $cfg['compiler']['source_path'] + main + C_EXTENSION + + # Detect dependencies and build required required modules + include_dirs = get_local_include_dirs + extract_headers(main_path).each do |header| + src_file = find_source_file(header, include_dirs) + if !src_file.nil? + compile(src_file) + obj_list << header.ext($cfg['compiler']['object_files']['extension']) + end + end + + # Build the main source file + main_base = File.basename(main_path, C_EXTENSION) + compile(main_path) + obj_list << main_base.ext($cfg['compiler']['object_files']['extension']) + + # Create the executable + link(main_base, obj_list) + end + + def fail_out(msg) + puts msg + exit(-1) + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/readme.txt b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/readme.txt new file mode 100644 index 0000000..6c7780e --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/readme.txt @@ -0,0 +1,18 @@ +Example Project + +This example project gives an example of some passing, ignored, and failing tests. +It's simple and meant for you to look over and get an idea for what all of this stuff does. + +You can build and test using the makefile if you have gcc installed (you may need to tweak +the locations of some tools in the makefile). Otherwise, the rake version will let you +test with gcc or a couple versions of IAR. You can tweak the yaml files to get those versions +running. + +Ruby is required if you're using the rake version (obviously). This version shows off most of +Unity's advanced features (automatically creating test runners, fancy summaries, etc.) + +The makefile version doesn't require anything outside of your normal build tools, but won't do the +extras for you. So that you can test right away, we've written the test runners for you and +put them in the test\no_ruby subdirectory. If you make changes to the tests or source, you might +need to update these (like when you add or remove tests). Do that for a while and you'll learn +why you really want to start using the Ruby tools. \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/src/ProductionCode.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/src/ProductionCode.c new file mode 100644 index 0000000..500b44b --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/src/ProductionCode.c @@ -0,0 +1,24 @@ + +#include "ProductionCode.h" + +int Counter = 0; +int NumbersToFind[9] = { 0, 34, 55, 66, 32, 11, 1, 77, 888 }; //some obnoxious array to search that is 1-based indexing instead of 0. + +// This function is supposed to search through NumbersToFind and find a particular number. +// If it finds it, the index is returned. Otherwise 0 is returned which sorta makes sense since +// NumbersToFind is indexed from 1. Unfortunately it's broken +// (and should therefore be caught by our tests) +int FindFunction_WhichIsBroken(int NumberToFind) +{ + int i = 0; + while (i <= 8) //Notice I should have been in braces + i++; + if (NumbersToFind[i] == NumberToFind) //Yikes! I'm getting run after the loop finishes instead of during it! + return i; + return 0; +} + +int FunctionWhichReturnsLocalVariable(void) +{ + return Counter; +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/src/ProductionCode.h b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/src/ProductionCode.h new file mode 100644 index 0000000..250ca0d --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/src/ProductionCode.h @@ -0,0 +1,3 @@ + +int FindFunction_WhichIsBroken(int NumberToFind); +int FunctionWhichReturnsLocalVariable(void); diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/src/ProductionCode2.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/src/ProductionCode2.c new file mode 100644 index 0000000..a8c72e1 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/src/ProductionCode2.c @@ -0,0 +1,9 @@ + +#include "ProductionCode2.h" + +char* ThisFunctionHasNotBeenTested(int Poor, char* LittleFunction) +{ + //Since There Are No Tests Yet, This Function Could Be Empty For All We Know. + // Which isn't terribly useful... but at least we put in a TEST_IGNORE so we won't forget + return (char*)0; +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/src/ProductionCode2.h b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/src/ProductionCode2.h new file mode 100644 index 0000000..34ae980 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/src/ProductionCode2.h @@ -0,0 +1,2 @@ + +char* ThisFunctionHasNotBeenTested(int Poor, char* LittleFunction); diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/test/TestProductionCode.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/test/TestProductionCode.c new file mode 100644 index 0000000..28a5581 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/test/TestProductionCode.c @@ -0,0 +1,62 @@ + +#include "ProductionCode.h" +#include "unity.h" + +//sometimes you may want to get at local data in a module. +//for example: If you plan to pass by reference, this could be useful +//however, it should often be avoided +extern int Counter; + +void setUp(void) +{ + //This is run before EACH TEST + Counter = 0x5a5a; +} + +void tearDown(void) +{ +} + +void test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode(void) +{ + //All of these should pass + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(78)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(1)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(33)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(999)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(-1)); +} + +void test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken(void) +{ + // You should see this line fail in your test summary + TEST_ASSERT_EQUAL(1, FindFunction_WhichIsBroken(34)); + + // Notice the rest of these didn't get a chance to run because the line above failed. + // Unit tests abort each test function on the first sign of trouble. + // Then NEXT test function runs as normal. + TEST_ASSERT_EQUAL(8, FindFunction_WhichIsBroken(8888)); +} + +void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue(void) +{ + //This should be true because setUp set this up for us before this test + TEST_ASSERT_EQUAL_HEX(0x5a5a, FunctionWhichReturnsLocalVariable()); + + //This should be true because we can still change our answer + Counter = 0x1234; + TEST_ASSERT_EQUAL_HEX(0x1234, FunctionWhichReturnsLocalVariable()); +} + +void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain(void) +{ + //This should be true again because setup was rerun before this test (and after we changed it to 0x1234) + TEST_ASSERT_EQUAL_HEX(0x5a5a, FunctionWhichReturnsLocalVariable()); +} + +void test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed(void) +{ + //Sometimes you get the test wrong. When that happens, you get a failure too... and a quick look should tell + // you what actually happened...which in this case was a failure to setup the initial condition. + TEST_ASSERT_EQUAL_HEX(0x1234, FunctionWhichReturnsLocalVariable()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/test/TestProductionCode2.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/test/TestProductionCode2.c new file mode 100644 index 0000000..20c9251 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/test/TestProductionCode2.c @@ -0,0 +1,26 @@ + +#include "ProductionCode2.h" +#include "unity.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void test_IgnoredTest(void) +{ + TEST_IGNORE_MESSAGE("This Test Was Ignored On Purpose"); +} + +void test_AnotherIgnoredTest(void) +{ + TEST_IGNORE_MESSAGE("These Can Be Useful For Leaving Yourself Notes On What You Need To Do Yet"); +} + +void test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented(void) +{ + TEST_IGNORE(); //Like This +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode2_Runner.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode2_Runner.c new file mode 100644 index 0000000..56515ae --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode2_Runner.c @@ -0,0 +1,46 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ +#include "unity.h" +#include +#include + +char MessageBuffer[50]; + +extern void setUp(void); +extern void tearDown(void); + +extern void test_IgnoredTest(void); +extern void test_AnotherIgnoredTest(void); +extern void test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented(void); + +static void runTest(UnityTestFunction test) +{ + if (TEST_PROTECT()) + { + setUp(); + test(); + } + if (TEST_PROTECT() && !TEST_IS_IGNORED) + { + tearDown(); + } +} +void resetTest() +{ + tearDown(); + setUp(); +} + + +int main(void) +{ + Unity.TestFile = "test/TestProductionCode2.c"; + UnityBegin(); + + // RUN_TEST calls runTest + RUN_TEST(test_IgnoredTest, 13); + RUN_TEST(test_AnotherIgnoredTest, 18); + RUN_TEST(test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented, 23); + + UnityEnd(); + return 0; +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode_Runner.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode_Runner.c new file mode 100644 index 0000000..64112f3 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode_Runner.c @@ -0,0 +1,50 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ +#include "unity.h" +#include +#include + +char MessageBuffer[50]; + +extern void setUp(void); +extern void tearDown(void); + +extern void test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode(void); +extern void test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken(void); +extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue(void); +extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain(void); +extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed(void); + +static void runTest(UnityTestFunction test) +{ + if (TEST_PROTECT()) + { + setUp(); + test(); + } + if (TEST_PROTECT() && !TEST_IS_IGNORED) + { + tearDown(); + } +} +void resetTest() +{ + tearDown(); + setUp(); +} + + +int main(void) +{ + Unity.TestFile = "test/TestProductionCode.c"; + UnityBegin(); + + // RUN_TEST calls runTest + RUN_TEST(test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode, 20); + RUN_TEST(test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken, 30); + RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue, 41); + RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain, 51); + RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed, 57); + + UnityEnd(); + return 0; +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/build/MakefileWorker.mk b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/build/MakefileWorker.mk new file mode 100644 index 0000000..9948751 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/build/MakefileWorker.mk @@ -0,0 +1,331 @@ +#--------- +# +# MakefileWorker.mk +# +# Include this helper file in your makefile +# It makes +# A static library holding the application objs +# A test executable +# +# See this example for parameter settings +# examples/Makefile +# +#---------- +# Inputs - these variables describe what to build +# +# INCLUDE_DIRS - Directories used to search for include files. +# This generates a -I for each directory +# SRC_DIRS - Directories containing source file to built into the library +# SRC_FILES - Specific source files to build into library. Helpful when not all code +# in a directory can be built for test (hopefully a temporary situation) +# TEST_SRC_DIRS - Directories containing unit test code build into the unit test runner +# These do not go in a library. They are explicitly included in the test runner +# MOCKS_SRC_DIRS - Directories containing mock source files to build into the test runner +# These do not go in a library. They are explicitly included in the test runner +#---------- +# You can adjust these variables to influence how to build the test target +# and where to put and name outputs +# See below to determine defaults +# COMPONENT_NAME - the name of the thing being built +# UNITY_HOME - where Unity home dir found +# UNITY_BUILD_HOME - place for scripts +# UNITY_OBJS_DIR - a directory where o and d files go +# UNITY_LIB_DIR - a directory where libs go +# UNITY_ENABLE_DEBUG - build for debug +# UNITY_USE_MEM_LEAK_DETECTION - Links with overridden new and delete +# UNITY_USE_STD_CPP_LIB - Set to N to keep the standard C++ library out +# of the test harness +# UNITY_USE_GCOV - Turn on coverage analysis +# Clean then build with this flag set to Y, then 'make gcov' +# UNITY_TEST_RUNNER_FLAGS +# None by default +# UNITY_MAPFILE - generate a map file +# UNITY_WARNINGFLAGS - overly picky by default +# OTHER_MAKEFILE_TO_INCLUDE - a hook to use this makefile to make +# other targets. Like CSlim, which is part of fitnesse +#---------- +# +# Other flags users can initialize to sneak in their settings +# UNITY_CFLAGS - C complier +# UNITY_LDFLAGS - Linker flags +#---------- + + +ifndef COMPONENT_NAME + COMPONENT_NAME = name_this_in_the_makefile +endif + +# Debug on by default +ifndef UNITY_ENABLE_DEBUG + UNITY_ENABLE_DEBUG = Y +endif + +# new and delete for memory leak detection on by default +ifndef UNITY_USE_MEM_LEAK_DETECTION + UNITY_USE_MEM_LEAK_DETECTION = Y +endif + +# Use gcov, off by default +ifndef UNITY_USE_GCOV + UNITY_USE_GCOV = N +endif + +# Default warnings +ifndef UNITY_WARNINGFLAGS + UNITY_WARNINGFLAGS = -Wall -Werror -Wshadow -Wswitch-default +endif + +# Default dir for temporary files (d, o) +ifndef UNITY_OBJS_DIR + UNITY_OBJS_DIR = objs +endif + +# Default dir for the outout library +ifndef UNITY_LIB_DIR + UNITY_LIB_DIR = lib +endif + +# No map by default +ifndef UNITY_MAP_FILE + UNITY_MAP_FILE = N +endif + +#Not verbose by deafult +ifdef VERBOSE + UNITY_TEST_RUNNER_FLAGS += -v +endif + +ifdef GROUP + UNITY_TEST_RUNNER_FLAGS += -g $(GROUP) +endif + +ifdef NAME + UNITY_TEST_RUNNER_FLAGS += -n $(NAME) +endif + +ifdef REPEAT + UNITY_TEST_RUNNER_FLAGS += -r $(REPEAT) +endif + + +# -------------------------------------- +# derived flags in the following area +# -------------------------------------- +ifeq ($(UNITY_USE_MEM_LEAK_DETECTION), N) + UNITY_CFLAGS += -DUNITY_MEM_LEAK_DETECTION_DISABLED +else + UNITY_MEMLEAK_DETECTOR_MALLOC_MACRO_FILE = -include $(UNITY_HOME)/extras/fixture/src/unity_fixture_malloc_overrides.h +endif + +ifeq ($(UNITY_ENABLE_DEBUG), Y) + UNITY_CFLAGS += -g +endif + +ifeq ($(UNITY_USE_GCOV), Y) + UNITY_CFLAGS += -fprofile-arcs -ftest-coverage +endif + +UNITY_CFLAGS += $(UNITY_MEMLEAK_DETECTOR_MALLOC_MACRO_FILE) + +TARGET_MAP = $(COMPONENT_NAME).map.txt +ifeq ($(UNITY_MAP_FILE), Y) + UNITY_LDFLAGS += -Wl,-map,$(TARGET_MAP) +endif + +LD_LIBRARIES += -lgcov + +TARGET_LIB = \ + $(UNITY_LIB_DIR)/lib$(COMPONENT_NAME).a + +TEST_TARGET = \ + $(COMPONENT_NAME)_tests + +#Helper Functions +get_src_from_dir = $(wildcard $1/*.cpp) $(wildcard $1/*.c) +get_dirs_from_dirspec = $(wildcard $1) +get_src_from_dir_list = $(foreach dir, $1, $(call get_src_from_dir,$(dir))) +__src_to = $(subst .c,$1, $(subst .cpp,$1,$2)) +src_to = $(addprefix $(UNITY_OBJS_DIR)/,$(call __src_to,$1,$2)) +src_to_o = $(call src_to,.o,$1) +src_to_d = $(call src_to,.d,$1) +src_to_gcda = $(call src_to,.gcda,$1) +src_to_gcno = $(call src_to,.gcno,$1) +make_dotdot_a_subdir = $(subst ..,_dot_dot, $1) +time = $(shell date +%s) +delta_t = $(eval minus, $1, $2) +debug_print_list = $(foreach word,$1,echo " $(word)";) echo; + +#Derived +STUFF_TO_CLEAN += $(TEST_TARGET) $(TEST_TARGET).exe $(TARGET_LIB) $(TARGET_MAP) + +SRC += $(call get_src_from_dir_list, $(SRC_DIRS)) $(SRC_FILES) +OBJ = $(call src_to_o,$(SRC)) +OBJ2 = $(call make_dotdot_a_subdir. $(OBJ)) + +STUFF_TO_CLEAN += $(OBJ) + +TEST_SRC = $(call get_src_from_dir_list, $(TEST_SRC_DIRS)) +TEST_OBJS = $(call src_to_o,$(TEST_SRC)) +STUFF_TO_CLEAN += $(TEST_OBJS) + + +MOCKS_SRC = $(call get_src_from_dir_list, $(MOCKS_SRC_DIRS)) +MOCKS_OBJS = $(call src_to_o,$(MOCKS_SRC)) +STUFF_TO_CLEAN += $(MOCKS_OBJS) + +ALL_SRC = $(SRC) $(TEST_SRC) $(MOCKS_SRC) + +#Test coverage with gcov +GCOV_OUTPUT = gcov_output.txt +GCOV_REPORT = gcov_report.txt +GCOV_ERROR = gcov_error.txt +GCOV_GCDA_FILES = $(call src_to_gcda, $(ALL_SRC)) +GCOV_GCNO_FILES = $(call src_to_gcno, $(ALL_SRC)) +TEST_OUTPUT = $(TEST_TARGET).txt +STUFF_TO_CLEAN += \ + $(GCOV_OUTPUT)\ + $(GCOV_REPORT)\ + $(GCOV_REPORT).html\ + $(GCOV_ERROR)\ + $(GCOV_GCDA_FILES)\ + $(GCOV_GCNO_FILES)\ + $(TEST_OUTPUT) + + +#The gcda files for gcov need to be deleted before each run +#To avoid annoying messages. +GCOV_CLEAN = $(SILENCE)rm -f $(GCOV_GCDA_FILES) $(GCOV_OUTPUT) $(GCOV_REPORT) $(GCOV_ERROR) +RUN_TEST_TARGET = $(SILENCE) $(GCOV_CLEAN) ; echo "Running $(TEST_TARGET)"; ./$(TEST_TARGET) $(UNITY_TEST_RUNNER_FLAGS) + +INCLUDES_DIRS_EXPANDED = $(call get_dirs_from_dirspec, $(INCLUDE_DIRS)) +INCLUDES += $(foreach dir, $(INCLUDES_DIRS_EXPANDED), -I$(dir)) +MOCK_DIRS_EXPANDED = $(call get_dirs_from_dirspec, $(MOCKS_SRC_DIRS)) +INCLUDES += $(foreach dir, $(MOCK_DIRS_EXPANDED), -I$(dir)) + + +DEP_FILES = $(call src_to_d, $(ALL_SRC)) +STUFF_TO_CLEAN += $(DEP_FILES) $(PRODUCTION_CODE_START) $(PRODUCTION_CODE_END) +STUFF_TO_CLEAN += $(STDLIB_CODE_START) $(MAP_FILE) cpputest_*.xml junit_run_output + +# We'll use the UNITY_CFLAGS etc so that you can override AND add to the CppUTest flags +CFLAGS = $(UNITY_CFLAGS) $(UNITY_ADDITIONAL_CFLAGS) $(INCLUDES) $(UNITY_WARNINGFLAGS) +LDFLAGS = $(UNITY_LDFLAGS) $(UNITY_ADDITIONAL_LDFLAGS) + +# Targets + +.PHONY: all +all: start $(TEST_TARGET) + $(RUN_TEST_TARGET) + +.PHONY: start +start: $(TEST_TARGET) + $(SILENCE)START_TIME=$(call time) + +.PHONY: all_no_tests +all_no_tests: $(TEST_TARGET) + +.PHONY: flags +flags: + @echo + @echo "Compile C source with CFLAGS:" + @$(call debug_print_list,$(CFLAGS)) + @echo "Link with LDFLAGS:" + @$(call debug_print_list,$(LDFLAGS)) + @echo "Link with LD_LIBRARIES:" + @$(call debug_print_list,$(LD_LIBRARIES)) + @echo "Create libraries with ARFLAGS:" + @$(call debug_print_list,$(ARFLAGS)) + @echo "OBJ files:" + @$(call debug_print_list,$(OBJ2)) + + +$(TEST_TARGET): $(TEST_OBJS) $(MOCKS_OBJS) $(PRODUCTION_CODE_START) $(TARGET_LIB) $(USER_LIBS) $(PRODUCTION_CODE_END) $(STDLIB_CODE_START) + $(SILENCE)echo Linking $@ + $(SILENCE)$(LINK.o) -o $@ $^ $(LD_LIBRARIES) + +$(TARGET_LIB): $(OBJ) + $(SILENCE)echo Building archive $@ + $(SILENCE)mkdir -p lib + $(SILENCE)$(AR) $(ARFLAGS) $@ $^ + $(SILENCE)ranlib $@ + +test: $(TEST_TARGET) + $(RUN_TEST_TARGET) | tee $(TEST_OUTPUT) + +vtest: $(TEST_TARGET) + $(RUN_TEST_TARGET) -v | tee $(TEST_OUTPUT) + +$(UNITY_OBJS_DIR)/%.o: %.cpp + @echo compiling $(notdir $<) + $(SILENCE)mkdir -p $(dir $@) + $(SILENCE)$(COMPILE.cpp) -MMD -MP $(OUTPUT_OPTION) $< + +$(UNITY_OBJS_DIR)/%.o: %.c + @echo compiling $(notdir $<) + $(SILENCE)mkdir -p $(dir $@) + $(SILENCE)$(COMPILE.c) -MMD -MP $(OUTPUT_OPTION) $< + +ifneq "$(MAKECMDGOALS)" "clean" +-include $(DEP_FILES) +endif + +.PHONY: clean +clean: + $(SILENCE)echo Making clean + $(SILENCE)$(RM) $(STUFF_TO_CLEAN) + $(SILENCE)rm -rf gcov $(UNITY_OBJS_DIR) + $(SILENCE)find . -name "*.gcno" | xargs rm -f + $(SILENCE)find . -name "*.gcda" | xargs rm -f + +#realclean gets rid of all gcov, o and d files in the directory tree +#not just the ones made by this makefile +.PHONY: realclean +realclean: clean + $(SILENCE)rm -rf gcov + $(SILENCE)find . -name "*.gdcno" | xargs rm -f + $(SILENCE)find . -name "*.[do]" | xargs rm -f + +gcov: test + $(SILENCE)for d in $(SRC_DIRS) ; do \ + gcov --object-directory $(UNITY_OBJS_DIR)/$$d $$d/*.c $$d/*.cpp >> $(GCOV_OUTPUT) 2>>$(GCOV_ERROR) ; \ + done + $(SILENCE)for f in $(SRC_FILES) ; do \ + gcov --object-directory $(UNITY_OBJS_DIR)/$$f $$f >> $(GCOV_OUTPUT) 2>>$(GCOV_ERROR) ; \ + done + $(UNITY_BUILD_HOME)/filterGcov.sh $(GCOV_OUTPUT) $(GCOV_ERROR) $(GCOV_REPORT) $(TEST_OUTPUT) + $(SILENCE)cat $(GCOV_REPORT) + $(SILENCE)mkdir -p gcov + $(SILENCE)mv *.gcov gcov + $(SILENCE)mv gcov_* gcov + $(SILENCE)echo "See gcov directory for details" + +debug: + @echo + @echo "Target Source files:" + @$(call debug_print_list,$(SRC)) + @echo "Target Object files:" + @$(call debug_print_list,$(OBJ)) + @echo "Test Source files:" + @$(call debug_print_list,$(TEST_SRC)) + @echo "Test Object files:" + @$(call debug_print_list,$(TEST_OBJS)) + @echo "Mock Source files:" + @$(call debug_print_list,$(MOCKS_SRC)) + @echo "Mock Object files:" + @$(call debug_print_list,$(MOCKS_OBJS)) + @echo "All Input Dependency files:" + @$(call debug_print_list,$(DEP_FILES)) + @echo Stuff to clean: + @$(call debug_print_list,$(STUFF_TO_CLEAN)) + @echo Includes: + @$(call debug_print_list,$(INCLUDES)) + +ifneq "$(OTHER_MAKEFILE_TO_INCLUDE)" "" +-include $(OTHER_MAKEFILE_TO_INCLUDE) +endif + + + +st,$(TEST_SRC)) + @echo "Test Object files:" + @$(call debug_print \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/build/filterGcov.sh b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/build/filterGcov.sh new file mode 100644 index 0000000..a861cf6 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/build/filterGcov.sh @@ -0,0 +1,61 @@ +#!/bin/bash +INPUT_FILE=$1 +TEMP_FILE1=${INPUT_FILE}1.tmp +TEMP_FILE2=${INPUT_FILE}2.tmp +TEMP_FILE3=${INPUT_FILE}3.tmp +ERROR_FILE=$2 +OUTPUT_FILE=$3 +HTML_OUTPUT_FILE=$3.html +TEST_RESULTS=$4 + +flattenGcovOutput() { +while read line1 +do + read line2 + echo $line2 " " $line1 + read junk + read junk +done < ${INPUT_FILE} +} + +getRidOfCruft() { +sed '-e s/^Lines.*://g' \ + '-e s/^[0-9]\./ &/g' \ + '-e s/^[0-9][0-9]\./ &/g' \ + '-e s/of.*File/ /g' \ + "-e s/'//g" \ + '-e s/^.*\/usr\/.*$//g' \ + '-e s/^.*\.$//g' +} + +getFileNameRootFromErrorFile() { +sed '-e s/gc..:cannot open .* file//g' ${ERROR_FILE} +} + +writeEachNoTestCoverageFile() { +while read line +do + echo " 0.00% " ${line} +done +} + +createHtmlOutput() { + echo "" + echo "" + sed "-e s/.*% /
CoverageFile
&<\/td>/" \ + "-e s/[a-zA-Z0-9_]*\.[ch][a-z]*/&<\/a><\/td><\/tr>/" + echo "
" + sed "-e s/.*/&
/g" < ${TEST_RESULTS} +} + + +flattenGcovOutput | getRidOfCruft > ${TEMP_FILE1} +getFileNameRootFromErrorFile | writeEachNoTestCoverageFile > ${TEMP_FILE2} +cat ${TEMP_FILE1} ${TEMP_FILE2} | sort | uniq > ${OUTPUT_FILE} +createHtmlOutput < ${OUTPUT_FILE} > ${HTML_OUTPUT_FILE} +rm -f ${TEMP_FILE1} ${TEMP_FILE2} +erageFile" + sed "-e s/.*% /&<\/td>/" \ + "-e s/[a-zA-Z0-9_]*\.[ch][a-z]*/
&<\/a><\/td><\/tr>/" + echo "" + sed "-e s/.*/&
/g" < ${TEST_RESULTS \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/rakefile.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/rakefile.rb new file mode 100644 index 0000000..6181707 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/rakefile.rb @@ -0,0 +1,37 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require HERE + 'rakefile_helper' + +include RakefileHelpers + +# Load default configuration, for now +DEFAULT_CONFIG_FILE = 'gcc.yml' +configure_toolchain(DEFAULT_CONFIG_FILE) + +task :unit do + run_tests +end + +desc "Build and test Unity Framework" +task :all => [:clean, :unit] +task :default => [:clobber, :all] +task :ci => [:no_color, :default] +task :cruise => [:no_color, :default] + +desc "Load configuration" +task :config, :config_file do |t, args| + configure_toolchain(args[:config_file]) +end + +task :no_color do + $colour_output = false +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/rakefile_helper.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/rakefile_helper.rb new file mode 100644 index 0000000..a7f6a28 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/rakefile_helper.rb @@ -0,0 +1,178 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require 'yaml' +require 'fileutils' +require HERE+'../../auto/unity_test_summary' +require HERE+'../../auto/generate_test_runner' +require HERE+'../../auto/colour_reporter' + +module RakefileHelpers + + C_EXTENSION = '.c' + + def load_configuration(config_file) + unless ($configured) + $cfg_file = HERE+"../../targets/#{config_file}" unless (config_file =~ /[\\|\/]/) + $cfg = YAML.load(File.read($cfg_file)) + $colour_output = false unless $cfg['colour'] + $configured = true if (config_file != DEFAULT_CONFIG_FILE) + end + end + + def configure_clean + CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil? + end + + def configure_toolchain(config_file=DEFAULT_CONFIG_FILE) + config_file += '.yml' unless config_file =~ /\.yml$/ + config_file = config_file unless config_file =~ /[\\|\/]/ + load_configuration(config_file) + configure_clean + end + + def tackit(strings) + if strings.is_a?(Array) + result = "\"#{strings.join}\"" + else + result = strings + end + return result + end + + def squash(prefix, items) + result = '' + items.each { |item| result += " #{prefix}#{tackit(item)}" } + return result + end + + def build_compiler_fields + command = tackit($cfg['compiler']['path']) + if $cfg['compiler']['defines']['items'].nil? + defines = '' + else + defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items'] + ['UNITY_OUTPUT_CHAR=UnityOutputCharSpy_OutputChar']) + end + options = squash('', $cfg['compiler']['options']) + includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :defines => defines, :options => options, :includes => includes} + end + + def compile(file, defines=[]) + compiler = build_compiler_fields + unity_include = $cfg['compiler']['includes']['prefix']+'../../src' + cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{unity_include} #{file} " + + "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" + + "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" + execute(cmd_str) + end + + def build_linker_fields + command = tackit($cfg['linker']['path']) + if $cfg['linker']['options'].nil? + options = '' + else + options = squash('', $cfg['linker']['options']) + end + if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?) + includes = '' + else + includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) + end + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :options => options, :includes => includes} + end + + def link(exe_name, obj_list) + linker = build_linker_fields + cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + + (obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).join + + $cfg['linker']['bin_files']['prefix'] + ' ' + + $cfg['linker']['bin_files']['destination'] + + exe_name + $cfg['linker']['bin_files']['extension'] + execute(cmd_str) + end + + def build_simulator_fields + return nil if $cfg['simulator'].nil? + if $cfg['simulator']['path'].nil? + command = '' + else + command = (tackit($cfg['simulator']['path']) + ' ') + end + if $cfg['simulator']['pre_support'].nil? + pre_support = '' + else + pre_support = squash('', $cfg['simulator']['pre_support']) + end + if $cfg['simulator']['post_support'].nil? + post_support = '' + else + post_support = squash('', $cfg['simulator']['post_support']) + end + return {:command => command, :pre_support => pre_support, :post_support => post_support} + end + + def execute(command_string, verbose=true) + report command_string + output = `#{command_string}`.chomp + report(output) if (verbose && !output.nil? && (output.length > 0)) + if ($?.exitstatus != 0) + raise "Command failed. (Returned #{$?.exitstatus})" + end + return output + end + + def report_summary + summary = UnityTestSummary.new + summary.set_root_path(HERE) + results_glob = "#{$cfg['compiler']['build_path']}*.test*" + results_glob.gsub!(/\\/, '/') + results = Dir[results_glob] + summary.set_targets(results) + summary.run + end + + def run_tests + report 'Running Unity system tests...' + + # Tack on TEST define for compiling unit tests + load_configuration($cfg_file) + test_defines = ['TEST'] + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + + # Get a list of all source files needed + src_files = Dir[HERE+'src/*.c'] + src_files += Dir[HERE+'test/*.c'] + src_files << '../../src/Unity.c' + + # Build object files + src_files.each { |f| compile(f, test_defines) } + obj_list = src_files.map {|f| File.basename(f.ext($cfg['compiler']['object_files']['extension'])) } + + # Link the test executable + test_base = "framework_test" + link(test_base, obj_list) + + # Execute unit test and generate results file + simulator = build_simulator_fields + executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] + if simulator.nil? + cmd_str = executable + " -v -r" + else + cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" + end + output = execute(cmd_str) + test_results = $cfg['compiler']['build_path'] + test_base + if output.match(/OK$/m).nil? + test_results += '.testfail' + else + test_results += '.testpass' + end + File.open(test_results, 'w') { |f| f.print output } + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/readme.txt b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/readme.txt new file mode 100644 index 0000000..6b9a78c --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/readme.txt @@ -0,0 +1,9 @@ +Copyright (c) 2010 James Grenning and Contributed to Unity Project + +Unity Project - A Test Framework for C +Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +[Released under MIT License. Please refer to license.txt for details] + +This Framework is an optional add-on to Unity. By including unity_framework.h in place of unity.h, +you may now work with Unity in a manner similar to CppUTest. This framework adds the concepts of +test groups and gives finer control of your tests over the command line. \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c new file mode 100644 index 0000000..1ba3e9a --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c @@ -0,0 +1,381 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" +#include "unity_internals.h" +#include + +UNITY_FIXTURE_T UnityFixture; + +//If you decide to use the function pointer approach. +int (*outputChar)(int) = putchar; + +int verbose = 0; + +void setUp(void) { /*does nothing*/ } +void tearDown(void) { /*does nothing*/ } + +void announceTestRun(int runNumber) +{ + UnityPrint("Unity test run "); + UnityPrintNumber(runNumber+1); + UnityPrint(" of "); + UnityPrintNumber(UnityFixture.RepeatCount); + UNITY_OUTPUT_CHAR('\n'); +} + +int UnityMain(int argc, char* argv[], void (*runAllTests)()) +{ + int result = UnityGetCommandLineOptions(argc, argv); + int r; + if (result != 0) + return result; + + for (r = 0; r < UnityFixture.RepeatCount; r++) + { + announceTestRun(r); + UnityBegin(); + runAllTests(); + UNITY_OUTPUT_CHAR('\n'); + UnityEnd(); + } + + return UnityFailureCount(); +} + +static int selected(const char * filter, const char * name) +{ + if (filter == 0) + return 1; + return strstr(name, filter) ? 1 : 0; +} + +static int testSelected(const char* test) +{ + return selected(UnityFixture.NameFilter, test); +} + +static int groupSelected(const char* group) +{ + return selected(UnityFixture.GroupFilter, group); +} + +static void runTestCase() +{ + +} + +void UnityTestRunner(unityfunction* setup, + unityfunction* testBody, + unityfunction* teardown, + const char * printableName, + const char * group, + const char * name, + const char * file, int line) +{ + if (testSelected(name) && groupSelected(group)) + { + Unity.CurrentTestFailed = 0; + Unity.TestFile = file; + Unity.CurrentTestName = printableName; + Unity.CurrentTestLineNumber = line; + if (!UnityFixture.Verbose) + UNITY_OUTPUT_CHAR('.'); + else + UnityPrint(printableName); + + Unity.NumberOfTests++; + UnityMalloc_StartTest(); + UnityPointer_Init(); + + runTestCase(); + if (TEST_PROTECT()) + { + setup(); + testBody(); + } + if (TEST_PROTECT()) + { + teardown(); + } + if (TEST_PROTECT()) + { + UnityPointer_UndoAllSets(); + if (!Unity.CurrentTestFailed) + UnityMalloc_EndTest(); + UnityConcludeFixtureTest(); + } + else + { + //aborting - jwg - di i need these for the other TEST_PROTECTS? + } + } +} + +void UnityIgnoreTest() +{ + Unity.NumberOfTests++; + Unity.CurrentTestIgnored = 1; + UNITY_OUTPUT_CHAR('!'); +} + + +//------------------------------------------------- +//Malloc and free stuff +// +#define MALLOC_DONT_FAIL -1 +static int malloc_count; +static int malloc_fail_countdown = MALLOC_DONT_FAIL; + +void UnityMalloc_StartTest() +{ + malloc_count = 0; + malloc_fail_countdown = MALLOC_DONT_FAIL; +} + +void UnityMalloc_EndTest() +{ + malloc_fail_countdown = MALLOC_DONT_FAIL; + if (malloc_count != 0) + { + TEST_FAIL_MESSAGE("This test leaks!"); + } +} + +void UnityMalloc_MakeMallocFailAfterCount(int countdown) +{ + malloc_fail_countdown = countdown; +} + +#ifdef malloc +#undef malloc +#endif + +#ifdef free +#undef free +#endif + +#include +#include + +typedef struct GuardBytes +{ + int size; + char guard[sizeof(int)]; +} Guard; + + +static const char * end = "END"; + +void * unity_malloc(size_t size) +{ + char* mem; + Guard* guard; + + if (malloc_fail_countdown != MALLOC_DONT_FAIL) + { + if (malloc_fail_countdown == 0) + return 0; + malloc_fail_countdown--; + } + + malloc_count++; + + guard = (Guard*)malloc(size + sizeof(Guard) + 4); + guard->size = size; + mem = (char*)&(guard[1]); + memcpy(&mem[size], end, strlen(end) + 1); + + return (void*)mem; +} + +static int isOverrun(void * mem) +{ + Guard* guard = (Guard*)mem; + char* memAsChar = (char*)mem; + guard--; + + return strcmp(&memAsChar[guard->size], end) != 0; +} + +static void release_memory(void * mem) +{ + Guard* guard = (Guard*)mem; + guard--; + + malloc_count--; + free(guard); +} + +void unity_free(void * mem) +{ + int overrun = isOverrun(mem);//strcmp(&memAsChar[guard->size], end) != 0; + release_memory(mem); + if (overrun) + { + TEST_FAIL_MESSAGE("Buffer overrun detected during free()"); + } +} + +void* unity_calloc(size_t num, size_t size) +{ + void* mem = unity_malloc(num * size); + memset(mem, 0, num*size); + return mem; +} + +void* unity_realloc(void * oldMem, size_t size) +{ + Guard* guard = (Guard*)oldMem; +// char* memAsChar = (char*)oldMem; + void* newMem; + + if (oldMem == 0) + return unity_malloc(size); + + guard--; + if (isOverrun(oldMem)) + { + release_memory(oldMem); + TEST_FAIL_MESSAGE("Buffer overrun detected during realloc()"); + } + + if (size == 0) + { + release_memory(oldMem); + return 0; + } + + if (guard->size >= size) + return oldMem; + + newMem = unity_malloc(size); + memcpy(newMem, oldMem, size); + unity_free(oldMem); + return newMem; +} + + +//-------------------------------------------------------- +//Automatic pointer restoration functions +typedef struct _PointerPair +{ + struct _PointerPair * next; + void ** pointer; + void * old_value; +} PointerPair; + +enum {MAX_POINTERS=50}; +static PointerPair pointer_store[MAX_POINTERS]; +static int pointer_index = 0; + +void UnityPointer_Init() +{ + pointer_index = 0; +} + +void UnityPointer_Set(void ** pointer, void * newValue) +{ + if (pointer_index >= MAX_POINTERS) + TEST_FAIL_MESSAGE("Too many pointers set"); + + pointer_store[pointer_index].pointer = pointer; + pointer_store[pointer_index].old_value = *pointer; + *pointer = newValue; + pointer_index++; +} + +void UnityPointer_UndoAllSets() +{ + while (pointer_index > 0) + { + pointer_index--; + *(pointer_store[pointer_index].pointer) = + pointer_store[pointer_index].old_value; + + } +} + +int UnityFailureCount() +{ + return Unity.TestFailures; +} + +int UnityGetCommandLineOptions(int argc, char* argv[]) +{ + int i; + UnityFixture.Verbose = 0; + UnityFixture.GroupFilter = 0; + UnityFixture.NameFilter = 0; + UnityFixture.RepeatCount = 1; + + if (argc == 1) + return 0; + + for (i = 1; i < argc; ) + { + if (strcmp(argv[i], "-v") == 0) + { + UnityFixture.Verbose = 1; + i++; + } + else if (strcmp(argv[i], "-g") == 0) + { + i++; + if (i >= argc) + return 1; + UnityFixture.GroupFilter = argv[i]; + i++; + } + else if (strcmp(argv[i], "-n") == 0) + { + i++; + if (i >= argc) + return 1; + UnityFixture.NameFilter = argv[i]; + i++; + } + else if (strcmp(argv[i], "-r") == 0) + { + UnityFixture.RepeatCount = 2; + i++; + if (i < argc) + { + if (*(argv[i]) >= '0' && *(argv[i]) <= '9') + { + UnityFixture.RepeatCount = atoi(argv[i]); + i++; + } + } + } + } + return 0; +} + +void UnityConcludeFixtureTest() +{ + if (Unity.CurrentTestIgnored) + { + Unity.TestIgnores++; + } + else if (!Unity.CurrentTestFailed) + { + if (UnityFixture.Verbose) + { + UnityPrint(" PASS"); + UNITY_OUTPUT_CHAR('\n'); + } + } + else if (Unity.CurrentTestFailed) + { + Unity.TestFailures++; + } + + Unity.CurrentTestFailed = 0; + Unity.CurrentTestIgnored = 0; +} + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.h b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.h new file mode 100644 index 0000000..da1f871 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.h @@ -0,0 +1,81 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FIXTURE_H_ +#define UNITY_FIXTURE_H_ + +#include "unity.h" +#include "unity_internals.h" +#include "unity_fixture_malloc_overrides.h" +#include "unity_fixture_internals.h" + +int UnityMain(int argc, char* argv[], void (*runAllTests)()); + + +#define TEST_GROUP(group)\ + int TEST_GROUP_##group = 0 + +#define TEST_SETUP(group) void TEST_##group##_SETUP() + +#define TEST_TEAR_DOWN(group) void TEST_##group##_TEAR_DOWN() + + +#define TEST(group, name) \ + void TEST_##group##_##name##_();\ + void TEST_##group##_##name##_run()\ + {\ + UnityTestRunner(TEST_##group##_SETUP,\ + TEST_##group##_##name##_,\ + TEST_##group##_TEAR_DOWN,\ + "TEST(" #group ", " #name ")",\ + #group, #name,\ + __FILE__, __LINE__);\ + }\ + void TEST_##group##_##name##_() + +#define IGNORE_TEST(group, name) \ + void TEST_##group##_##name##_();\ + void TEST_##group##_##name##_run()\ + {\ + UnityIgnoreTest();\ + }\ + void TEST_##group##_##name##_() + +#define DECLARE_TEST_CASE(group, name) \ + void TEST_##group##_##name##_run() + +#define RUN_TEST_CASE(group, name) \ + DECLARE_TEST_CASE(group, name);\ + TEST_##group##_##name##_run(); + +//This goes at the bottom of each test file or in a separate c file +#define TEST_GROUP_RUNNER(group)\ + void TEST_##group##_GROUP_RUNNER_runAll();\ + void TEST_##group##_GROUP_RUNNER()\ + {\ + TEST_##group##_GROUP_RUNNER_runAll();\ + }\ + void TEST_##group##_GROUP_RUNNER_runAll() + +//Call this from main +#define RUN_TEST_GROUP(group)\ + void TEST_##group##_GROUP_RUNNER();\ + TEST_##group##_GROUP_RUNNER(); + +//CppUTest Compatibility Macros +#define UT_PTR_SET(ptr, newPointerValue) UnityPointer_Set((void**)&ptr, (void*)newPointerValue) +#define TEST_ASSERT_POINTERS_EQUAL(expected, actual) TEST_ASSERT_EQUAL_PTR(expected, actual) +#define TEST_ASSERT_BYTES_EQUAL(expected, actual) TEST_ASSERT_EQUAL_HEX8(0xff & (expected), 0xff & (actual)) +#define FAIL(message) TEST_FAIL((message)) +#define CHECK(condition) TEST_ASSERT_TRUE((condition)) +#define LONGS_EQUAL(expected, actual) TEST_ASSERT_EQUAL_INT((expected), (actual)) +#define STRCMP_EQUAL(expected, actual) TEST_ASSERT_EQUAL_STRING((expected), (actual)) +#define DOUBLES_EQUAL(expected, actual, delta) TEST_ASSERT_FLOAT_WITHIN(((expected), (actual), (delta)) + +void UnityMalloc_MakeMallocFailAfterCount(int count); + +#endif /* UNITY_FIXTURE_H_ */ diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h new file mode 100644 index 0000000..db23f67 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h @@ -0,0 +1,44 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FIXTURE_INTERNALS_H_ +#define UNITY_FIXTURE_INTERNALS_H_ + +typedef struct _UNITY_FIXTURE_T +{ + int Verbose; + unsigned int RepeatCount; + const char* NameFilter; + const char* GroupFilter; +} UNITY_FIXTURE_T; + +typedef void unityfunction(); +void UnityTestRunner(unityfunction * setup, + unityfunction * body, + unityfunction * teardown, + const char * printableName, + const char * group, + const char * name, + const char * file, int line); + +void UnityIgnoreTest(); +void UnityMalloc_StartTest(); +void UnityMalloc_EndTest(); +int UnityFailureCount(); +int UnityGetCommandLineOptions(int argc, char* argv[]); +void UnityConcludeFixtureTest(); + +void UnityPointer_Set(void ** ptr, void * newValue); +void UnityPointer_UndoAllSets(); +void UnityPointer_Init(); + +void UnityAssertEqualPointer(const void * expected, + const void * actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +#endif /* UNITY_FIXTURE_INTERNALS_H_ */ diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h new file mode 100644 index 0000000..38f8e34 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h @@ -0,0 +1,16 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FIXTURE_MALLOC_OVERRIDES_H_ +#define UNITY_FIXTURE_MALLOC_OVERRIDES_H_ + +#define malloc unity_malloc +#define calloc unity_calloc +#define realloc unity_realloc +#define free unity_free + +#endif /* UNITY_FIXTURE_MALLOC_OVERRIDES_H_ */ diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/main/AllTests.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/main/AllTests.c new file mode 100644 index 0000000..ccb775b --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/main/AllTests.c @@ -0,0 +1,21 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" + +static void runAllTests() +{ + RUN_TEST_GROUP(UnityFixture); + RUN_TEST_GROUP(UnityCommandOptions); + RUN_TEST_GROUP(LeakDetection) +} + +int main(int argc, char* argv[]) +{ + return UnityMain(argc, argv, runAllTests); +} + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/testunity_fixture.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/testunity_fixture.c new file mode 100644 index 0000000..de0c04c --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/testunity_fixture.c @@ -0,0 +1,39 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" + +static int data = -1; + +TEST_GROUP(mygroup); + +TEST_SETUP(mygroup) +{ + data = 0; +} + +TEST_TEAR_DOWN(mygroup) +{ + data = -1; +} + +TEST(mygroup, test1) +{ + TEST_ASSERT_EQUAL_INT(0, data); +} + +TEST(mygroup, test2) +{ + TEST_ASSERT_EQUAL_INT(0, data); + data = 5; +} + +TEST(mygroup, test3) +{ + data = 7; + TEST_ASSERT_EQUAL_INT(7, data); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c new file mode 100644 index 0000000..b8b4524 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c @@ -0,0 +1,321 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" +#include "unity_output_Spy.h" +#include +#include + +extern UNITY_FIXTURE_T UnityFixture; + +TEST_GROUP(UnityFixture); + +TEST_SETUP(UnityFixture) +{ +} + +TEST_TEAR_DOWN(UnityFixture) +{ +} + +int my_int; +int* pointer1 = 0; +int* pointer2 = (int*)2; +int* pointer3 = (int*)3; +int int1; +int int2; +int int3; +int int4; + +TEST(UnityFixture, PointerSetting) +{ + TEST_ASSERT_POINTERS_EQUAL(pointer1, 0); + UT_PTR_SET(pointer1, &int1); + UT_PTR_SET(pointer2, &int2); + UT_PTR_SET(pointer3, &int3); + TEST_ASSERT_POINTERS_EQUAL(pointer1, &int1); + TEST_ASSERT_POINTERS_EQUAL(pointer2, &int2); + TEST_ASSERT_POINTERS_EQUAL(pointer3, &int3); + UT_PTR_SET(pointer1, &int4); + UnityPointer_UndoAllSets(); + TEST_ASSERT_POINTERS_EQUAL(pointer1, 0); + TEST_ASSERT_POINTERS_EQUAL(pointer2, (int*)2); + TEST_ASSERT_POINTERS_EQUAL(pointer3, (int*)3); +} + +TEST(UnityFixture, ForceMallocFail) +{ + UnityMalloc_MakeMallocFailAfterCount(1); + void* m = malloc(10); + CHECK(m); + void* mfails = malloc(10); + TEST_ASSERT_POINTERS_EQUAL(0, mfails); + free(m); +} + +TEST(UnityFixture, ReallocSmallerIsUnchanged) +{ + void* m1 = malloc(10); + void* m2 = realloc(m1, 5); + TEST_ASSERT_POINTERS_EQUAL(m1, m2); + free(m2); +} + +TEST(UnityFixture, ReallocSameIsUnchanged) +{ + void* m1 = malloc(10); + void* m2 = realloc(m1, 10); + TEST_ASSERT_POINTERS_EQUAL(m1, m2); + free(m2); +} + +TEST(UnityFixture, ReallocLargerNeeded) +{ + void* m1 = malloc(10); + strcpy((char*)m1, "123456789"); + void* m2 = realloc(m1, 15); + CHECK(m1 != m2); + STRCMP_EQUAL("123456789", m2); + free(m2); +} + +TEST(UnityFixture, ReallocNullPointerIsLikeMalloc) +{ + void* m = realloc(0, 15); + CHECK(m != 0); + free(m); +} + +TEST(UnityFixture, ReallocSizeZeroFreesMemAndReturnsNullPointer) +{ + void* m1 = malloc(10); + void* m2 = realloc(m1, 0); + TEST_ASSERT_POINTERS_EQUAL(0, m2); +} + +TEST(UnityFixture, CallocFillsWithZero) +{ + void* m = calloc(3, sizeof(char)); + char* s = (char*)m; + TEST_ASSERT_BYTES_EQUAL(0, s[0]); + TEST_ASSERT_BYTES_EQUAL(0, s[1]); + TEST_ASSERT_BYTES_EQUAL(0, s[2]); + free(m); +} + +char *p1; +char *p2; + +TEST(UnityFixture, PointerSet) +{ + char c1; + char c2; + char newC1; + char newC2; + p1 = &c1; + p2 = &c2; + + UnityPointer_Init(10); + UT_PTR_SET(p1, &newC1); + UT_PTR_SET(p2, &newC2); + TEST_ASSERT_POINTERS_EQUAL(&newC1, p1); + TEST_ASSERT_POINTERS_EQUAL(&newC2, p2); + UnityPointer_UndoAllSets(); + TEST_ASSERT_POINTERS_EQUAL(&c1, p1); + TEST_ASSERT_POINTERS_EQUAL(&c2, p2); +} + +//------------------------------------------------------------ + +TEST_GROUP(UnityCommandOptions); + +int savedVerbose; +int savedRepeat; +const char* savedName; +const char* savedGroup; + +TEST_SETUP(UnityCommandOptions) +{ + savedVerbose = UnityFixture.Verbose; + savedRepeat = UnityFixture.RepeatCount; + savedName = UnityFixture.NameFilter; + savedGroup = UnityFixture.GroupFilter; +} + +TEST_TEAR_DOWN(UnityCommandOptions) +{ + UnityFixture.Verbose = savedVerbose; + UnityFixture.RepeatCount= savedRepeat; + UnityFixture.NameFilter = savedName; + UnityFixture.GroupFilter = savedGroup; +} + + +static char* noOptions[] = { + "testrunner.exe" +}; + +TEST(UnityCommandOptions, DefaultOptions) +{ + UnityGetCommandLineOptions(1, noOptions); + TEST_ASSERT_EQUAL(0, UnityFixture.Verbose); + TEST_ASSERT_POINTERS_EQUAL(0, UnityFixture.GroupFilter); + TEST_ASSERT_POINTERS_EQUAL(0, UnityFixture.NameFilter); + TEST_ASSERT_EQUAL(1, UnityFixture.RepeatCount); +} + +static char* verbose[] = { + "testrunner.exe", + "-v" +}; + +TEST(UnityCommandOptions, OptionVerbose) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(2, verbose)); + TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); +} + +static char* group[] = { + "testrunner.exe", + "-g", "groupname" +}; + +TEST(UnityCommandOptions, OptionSelectTestByGroup) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, group)); + STRCMP_EQUAL("groupname", UnityFixture.GroupFilter); +} + +static char* name[] = { + "testrunner.exe", + "-n", "testname" +}; + +TEST(UnityCommandOptions, OptionSelectTestByName) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, name)); + STRCMP_EQUAL("testname", UnityFixture.NameFilter); +} + +static char* repeat[] = { + "testrunner.exe", + "-r", "99" +}; + +TEST(UnityCommandOptions, OptionSelectRepeatTestsDefaultCount) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(2, repeat)); + TEST_ASSERT_EQUAL(2, UnityFixture.RepeatCount); +} + +TEST(UnityCommandOptions, OptionSelectRepeatTestsSpecificCount) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, repeat)); + TEST_ASSERT_EQUAL(99, UnityFixture.RepeatCount); +} + +static char* multiple[] = { + "testrunner.exe", + "-v", + "-g", "groupname", + "-n", "testname", + "-r", "98" +}; + +TEST(UnityCommandOptions, MultipleOptions) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(8, multiple)); + TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); + STRCMP_EQUAL("groupname", UnityFixture.GroupFilter); + STRCMP_EQUAL("testname", UnityFixture.NameFilter); + TEST_ASSERT_EQUAL(98, UnityFixture.RepeatCount); +} + +static char* dashRNotLast[] = { + "testrunner.exe", + "-v", + "-g", "gggg", + "-r", + "-n", "tttt", +}; + +TEST(UnityCommandOptions, MultipleOptionsDashRNotLastAndNoValueSpecified) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(7, dashRNotLast)); + TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); + STRCMP_EQUAL("gggg", UnityFixture.GroupFilter); + STRCMP_EQUAL("tttt", UnityFixture.NameFilter); + TEST_ASSERT_EQUAL(2, UnityFixture.RepeatCount); +} + + +//------------------------------------------------------------ + +TEST_GROUP(LeakDetection); + +TEST_SETUP(LeakDetection) +{ + UnityOutputCharSpy_Create(1000); +} + +TEST_TEAR_DOWN(LeakDetection) +{ + UnityOutputCharSpy_Destroy(); +} + +#define EXPECT_ABORT_BEGIN \ + { \ + jmp_buf TestAbortFrame; \ + memcpy(TestAbortFrame, Unity.AbortFrame, sizeof(jmp_buf)); \ + if (TEST_PROTECT()) \ + { + +#define EXPECT_ABORT_END \ + } \ + memcpy(Unity.AbortFrame, TestAbortFrame, sizeof(jmp_buf)); \ + } + +TEST(LeakDetection, DetectsLeak) +{ + void* m = malloc(10); + UnityOutputCharSpy_Enable(1); + EXPECT_ABORT_BEGIN + UnityMalloc_EndTest(); + EXPECT_ABORT_END + UnityOutputCharSpy_Enable(0); + CHECK(strstr(UnityOutputCharSpy_Get(), "This test leaks!")); + free(m); + Unity.CurrentTestFailed = 0; +} + +TEST(LeakDetection, BufferOverrunFoundDuringFree) +{ + void* m = malloc(10); + char* s = (char*)m; + s[10] = (char)0xFF; + UnityOutputCharSpy_Enable(1); + EXPECT_ABORT_BEGIN + free(m); + EXPECT_ABORT_END + UnityOutputCharSpy_Enable(0); + CHECK(strstr(UnityOutputCharSpy_Get(), "Buffer overrun detected during free()")); + Unity.CurrentTestFailed = 0; +} + +TEST(LeakDetection, BufferOverrunFoundDuringRealloc) +{ + void* m = malloc(10); + char* s = (char*)m; + s[10] = (char)0xFF; + UnityOutputCharSpy_Enable(1); + EXPECT_ABORT_BEGIN + m = realloc(m, 100); + EXPECT_ABORT_END + UnityOutputCharSpy_Enable(0); + CHECK(strstr(UnityOutputCharSpy_Get(), "Buffer overrun detected during realloc()")); + Unity.CurrentTestFailed = 0; +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c new file mode 100644 index 0000000..80fec09 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c @@ -0,0 +1,40 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" + +TEST_GROUP_RUNNER(UnityFixture) +{ + RUN_TEST_CASE(UnityFixture, PointerSetting); + RUN_TEST_CASE(UnityFixture, ForceMallocFail); + RUN_TEST_CASE(UnityFixture, ReallocSmallerIsUnchanged); + RUN_TEST_CASE(UnityFixture, ReallocSameIsUnchanged); + RUN_TEST_CASE(UnityFixture, ReallocLargerNeeded); + RUN_TEST_CASE(UnityFixture, ReallocNullPointerIsLikeMalloc); + RUN_TEST_CASE(UnityFixture, ReallocSizeZeroFreesMemAndReturnsNullPointer); + RUN_TEST_CASE(UnityFixture, CallocFillsWithZero); + RUN_TEST_CASE(UnityFixture, PointerSet); +} + +TEST_GROUP_RUNNER(UnityCommandOptions) +{ + RUN_TEST_CASE(UnityCommandOptions, DefaultOptions); + RUN_TEST_CASE(UnityCommandOptions, OptionVerbose); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectTestByGroup); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectTestByName); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectRepeatTestsDefaultCount); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectRepeatTestsSpecificCount); + RUN_TEST_CASE(UnityCommandOptions, MultipleOptions); + RUN_TEST_CASE(UnityCommandOptions, MultipleOptionsDashRNotLastAndNoValueSpecified); +} + +TEST_GROUP_RUNNER(LeakDetection) +{ + RUN_TEST_CASE(LeakDetection, DetectsLeak); + RUN_TEST_CASE(LeakDetection, BufferOverrunFoundDuringFree); + RUN_TEST_CASE(LeakDetection, BufferOverrunFoundDuringRealloc); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.c new file mode 100644 index 0000000..16faefa --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.c @@ -0,0 +1,56 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + + +#include "unity_output_Spy.h" +#include +#include +#include + +static int size; +static int count; +static char* buffer; +static int spy_enable; + +void UnityOutputCharSpy_Create(int s) +{ + size = s; + count = 0; + spy_enable = 0; + buffer = malloc(size); + memset(buffer, 0, size); +} + +void UnityOutputCharSpy_Destroy() +{ + size = 0; + free(buffer); +} + +int UnityOutputCharSpy_OutputChar(int c) +{ + if (spy_enable) + { + if (count < (size-1)) + buffer[count++] = c; + } + else + { + putchar(c); + } + return c; +} + +const char * UnityOutputCharSpy_Get() +{ + return buffer; +} + +void UnityOutputCharSpy_Enable(int enable) +{ + spy_enable = enable; +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.h b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.h new file mode 100644 index 0000000..7c1590e --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.h @@ -0,0 +1,17 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef D_unity_output_Spy_H +#define D_unity_output_Spy_H + +void UnityOutputCharSpy_Create(int s); +void UnityOutputCharSpy_Destroy(); +int UnityOutputCharSpy_OutputChar(int c); +const char * UnityOutputCharSpy_Get(); +void UnityOutputCharSpy_Enable(int enable); + +#endif diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/makefile b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/makefile new file mode 100644 index 0000000..8c8444b --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/makefile @@ -0,0 +1,35 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +C_COMPILER=gcc +TARGET_BASE = testunity +ifeq ($(OS),Windows_NT) + TARGET_EXTENSION=.exe +else + TARGET_EXTENSION=.out +endif +TARGET = $(TARGET_BASE)$(TARGET_EXTENSION) +OUT_FILE=-o $(TARGET) +SRC_FILES=src/unity.c test/testunity.c build/testunity_Runner.c +INC_DIRS=-Isrc +SYMBOLS=-DTEST -DUNITY_SUPPORT_64 + +ifeq ($(OS),Windows_NT) + CLEANUP = del /F /Q build\* && del /F /Q $(TARGET) +else + CLEANUP = rm -f build/*.o ; rm -f $(TARGET) +endif + +all: clean default + +default: + ruby auto/generate_test_runner.rb test/testunity.c build/testunity_Runner.c + $(C_COMPILER) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES) $(OUT_FILE) + $(TARGET) + +clean: + $(CLEANUP) + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/rakefile.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/rakefile.rb new file mode 100644 index 0000000..3ec5d5a --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/rakefile.rb @@ -0,0 +1,48 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require HERE + 'rakefile_helper' + +include RakefileHelpers + +# Load default configuration, for now +DEFAULT_CONFIG_FILE = 'gcc.yml' +configure_toolchain(DEFAULT_CONFIG_FILE) + +desc "Test unity with its own unit tests" +task :unit do + run_tests get_unit_test_files +end + +Rake::TestTask.new(:scripts) do |t| + t.pattern = 'test/test_*.rb' + t.verbose = true +end + +desc "Generate test summary" +task :summary do + report_summary +end + +desc "Build and test Unity" +task :all => [:clean, :scripts, :unit, :summary] +task :default => [:clobber, :all] +task :ci => [:no_color, :default] +task :cruise => [:no_color, :default] + +desc "Load configuration" +task :config, :config_file do |t, args| + configure_toolchain(args[:config_file]) +end + +task :no_color do + $colour_output = false +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/rakefile_helper.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/rakefile_helper.rb new file mode 100644 index 0000000..218fcaa --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/rakefile_helper.rb @@ -0,0 +1,243 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require 'yaml' +require 'fileutils' +require HERE+'auto/unity_test_summary' +require HERE+'auto/generate_test_runner' +require HERE+'auto/colour_reporter' + +module RakefileHelpers + + C_EXTENSION = '.c' + + def load_configuration(config_file) + unless ($configured) + $cfg_file = "targets/#{config_file}" unless (config_file =~ /[\\|\/]/) + $cfg = YAML.load(File.read($cfg_file)) + $colour_output = false unless $cfg['colour'] + $configured = true if (config_file != DEFAULT_CONFIG_FILE) + end + end + + def configure_clean + CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil? + end + + def configure_toolchain(config_file=DEFAULT_CONFIG_FILE) + config_file += '.yml' unless config_file =~ /\.yml$/ + config_file = config_file unless config_file =~ /[\\|\/]/ + load_configuration(config_file) + configure_clean + end + + def get_unit_test_files + path = $cfg['compiler']['unit_tests_path'] + 'test*' + C_EXTENSION + path.gsub!(/\\/, '/') + FileList.new(path) + end + + def get_local_include_dirs + include_dirs = $cfg['compiler']['includes']['items'].dup + include_dirs.delete_if {|dir| dir.is_a?(Array)} + return include_dirs + end + + def extract_headers(filename) + includes = [] + lines = File.readlines(filename) + lines.each do |line| + m = line.match(/^\s*#include\s+\"\s*(.+\.[hH])\s*\"/) + if not m.nil? + includes << m[1] + end + end + return includes + end + + def find_source_file(header, paths) + paths.each do |dir| + src_file = dir + header.ext(C_EXTENSION) + if (File.exists?(src_file)) + return src_file + end + end + return nil + end + + def tackit(strings) + if strings.is_a?(Array) + result = "\"#{strings.join}\"" + else + result = strings + end + return result + end + + def squash(prefix, items) + result = '' + items.each { |item| result += " #{prefix}#{tackit(item)}" } + return result + end + + def build_compiler_fields + command = tackit($cfg['compiler']['path']) + if $cfg['compiler']['defines']['items'].nil? + defines = '' + else + defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items']) + end + options = squash('', $cfg['compiler']['options']) + includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :defines => defines, :options => options, :includes => includes} + end + + def compile(file, defines=[]) + compiler = build_compiler_fields + cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{file} " + + "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" + + "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" + execute(cmd_str) + end + + def build_linker_fields + command = tackit($cfg['linker']['path']) + if $cfg['linker']['options'].nil? + options = '' + else + options = squash('', $cfg['linker']['options']) + end + if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?) + includes = '' + else + includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) + end + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :options => options, :includes => includes} + end + + def link(exe_name, obj_list) + linker = build_linker_fields + cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + + (obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).join + + $cfg['linker']['bin_files']['prefix'] + ' ' + + $cfg['linker']['bin_files']['destination'] + + exe_name + $cfg['linker']['bin_files']['extension'] + execute(cmd_str) + end + + def build_simulator_fields + return nil if $cfg['simulator'].nil? + if $cfg['simulator']['path'].nil? + command = '' + else + command = (tackit($cfg['simulator']['path']) + ' ') + end + if $cfg['simulator']['pre_support'].nil? + pre_support = '' + else + pre_support = squash('', $cfg['simulator']['pre_support']) + end + if $cfg['simulator']['post_support'].nil? + post_support = '' + else + post_support = squash('', $cfg['simulator']['post_support']) + end + return {:command => command, :pre_support => pre_support, :post_support => post_support} + end + + def execute(command_string, verbose=true) + report command_string + output = `#{command_string}`.chomp + report(output) if (verbose && !output.nil? && (output.length > 0)) + if $?.exitstatus != 0 + raise "Command failed. (Returned #{$?.exitstatus})" + end + return output + end + + def report_summary + summary = UnityTestSummary.new + summary.set_root_path(HERE) + results_glob = "#{$cfg['compiler']['build_path']}*.test*" + results_glob.gsub!(/\\/, '/') + results = Dir[results_glob] + summary.set_targets(results) + summary.run + end + + def run_tests(test_files) + report 'Running Unity system tests...' + + # Tack on TEST define for compiling unit tests + load_configuration($cfg_file) + test_defines = ['TEST'] + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + $cfg['compiler']['defines']['items'] << 'TEST' + + include_dirs = get_local_include_dirs + + # Build and execute each unit test + test_files.each do |test| + obj_list = [] + + # Detect dependencies and build required modules + extract_headers(test).each do |header| + # Compile corresponding source file if it exists + src_file = find_source_file(header, include_dirs) + if !src_file.nil? + compile(src_file, test_defines) + obj_list << header.ext($cfg['compiler']['object_files']['extension']) + end + end + + # Build the test runner (generate if configured to do so) + test_base = File.basename(test, C_EXTENSION) + + runner_name = test_base + '_Runner.c' + runner_path = '' + + if $cfg['compiler']['runner_path'].nil? + runner_path = $cfg['compiler']['build_path'] + runner_name + else + runner_path = $cfg['compiler']['runner_path'] + runner_name + end + + options = $cfg[:unity] + options[:use_param_tests] = (test =~ /parameterized/) ? true : false + UnityTestRunnerGenerator.new(options).run(test, runner_path) + + compile(runner_path, test_defines) + obj_list << runner_name.ext($cfg['compiler']['object_files']['extension']) + + # Build the test module + compile(test, test_defines) + obj_list << test_base.ext($cfg['compiler']['object_files']['extension']) + + # Link the test executable + link(test_base, obj_list) + + # Execute unit test and generate results file + simulator = build_simulator_fields + executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] + if simulator.nil? + cmd_str = executable + else + cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" + end + output = execute(cmd_str) + test_results = $cfg['compiler']['build_path'] + test_base + if output.match(/OK$/m).nil? + test_results += '.testfail' + else + test_results += '.testpass' + end + File.open(test_results, 'w') { |f| f.print output } + + end + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/release/build.info b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/release/build.info new file mode 100644 index 0000000..7871b21 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/release/build.info @@ -0,0 +1,2 @@ +118 + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/release/version.info b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/release/version.info new file mode 100644 index 0000000..0d71c08 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/release/version.info @@ -0,0 +1,2 @@ +2.0 + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/src/unity.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/src/unity.c new file mode 100644 index 0000000..d85b880 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/src/unity.c @@ -0,0 +1,855 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity.h" +#include +#include + +#define UNITY_FAIL_AND_BAIL { Unity.CurrentTestFailed = 1; UNITY_OUTPUT_CHAR('\n'); longjmp(Unity.AbortFrame, 1); } +#define UNITY_IGNORE_AND_BAIL { Unity.CurrentTestIgnored = 1; UNITY_OUTPUT_CHAR('\n'); longjmp(Unity.AbortFrame, 1); } +/// return prematurely if we are already in failure or ignore state +#define UNITY_SKIP_EXECUTION { if ((Unity.CurrentTestFailed != 0) || (Unity.CurrentTestIgnored != 0)) {return;} } +#define UNITY_PRINT_EOL { UNITY_OUTPUT_CHAR('\n'); } + +struct _Unity Unity = { 0 }; + +const char* UnityStrNull = "NULL"; +const char* UnityStrSpacer = ". "; +const char* UnityStrExpected = " Expected "; +const char* UnityStrWas = " Was "; +const char* UnityStrTo = " To "; +const char* UnityStrElement = " Element "; +const char* UnityStrMemory = " Memory Mismatch"; +const char* UnityStrDelta = " Values Not Within Delta "; +const char* UnityStrPointless= " You Asked Me To Compare Nothing, Which Was Pointless."; +const char* UnityStrNullPointerForExpected= " Expected pointer to be NULL"; +const char* UnityStrNullPointerForActual = " Actual pointer was NULL"; + +const _U_UINT UnitySizeMask[] = +{ + 255, + 65535, + 65535, + 4294967295, + 4294967295, + 4294967295, + 4294967295 +#ifdef UNITY_SUPPORT_64 + ,0xFFFFFFFFFFFFFFFF +#endif +}; + +//----------------------------------------------- +// Pretty Printers & Test Result Output Handlers +//----------------------------------------------- + +void UnityPrint(const char* string) +{ + const char* pch = string; + + if (pch != NULL) + { + while (*pch) + { + // printable characters plus CR & LF are printed + if ((*pch <= 126) && (*pch >= 32)) + { + UNITY_OUTPUT_CHAR(*pch); + } + //write escaped carriage returns + else if (*pch == 13) + { + UNITY_OUTPUT_CHAR('\\'); + UNITY_OUTPUT_CHAR('r'); + } + //write escaped line feeds + else if (*pch == 10) + { + UNITY_OUTPUT_CHAR('\\'); + UNITY_OUTPUT_CHAR('n'); + } + // unprintable characters are shown as codes + else + { + UNITY_OUTPUT_CHAR('\\'); + UnityPrintNumberHex((_U_SINT)*pch, 2); + } + pch++; + } + } +} + +//----------------------------------------------- +void UnityPrintNumberByStyle(const _U_SINT number, const UNITY_DISPLAY_STYLE_T style) +{ + if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT) + { + UnityPrintNumber(number); + } + else if ((style & UNITY_DISPLAY_RANGE_UINT) == UNITY_DISPLAY_RANGE_UINT) + { + UnityPrintNumberUnsigned( (_U_UINT)number & UnitySizeMask[((_U_UINT)style & (_U_UINT)0x0F) - 1] ); + } + else + { + UnityPrintNumberHex((_U_UINT)number, (style & 0x000F) << 1); + } +} + +//----------------------------------------------- +/// basically do an itoa using as little ram as possible +void UnityPrintNumber(const _U_SINT number_to_print) +{ + _U_SINT divisor = 1; + _U_SINT next_divisor; + _U_SINT number = number_to_print; + + if (number < 0) + { + UNITY_OUTPUT_CHAR('-'); + number = -number; + } + + // figure out initial divisor + while (number / divisor > 9) + { + next_divisor = divisor * 10; + if (next_divisor > divisor) + divisor = next_divisor; + else + break; + } + + // now mod and print, then divide divisor + do + { + UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10))); + divisor /= 10; + } + while (divisor > 0); +} + +//----------------------------------------------- +/// basically do an itoa using as little ram as possible +void UnityPrintNumberUnsigned(const _U_UINT number) +{ + _U_UINT divisor = 1; + _U_UINT next_divisor; + + // figure out initial divisor + while (number / divisor > 9) + { + next_divisor = divisor * 10; + if (next_divisor > divisor) + divisor = next_divisor; + else + break; + } + + // now mod and print, then divide divisor + do + { + UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10))); + divisor /= 10; + } + while (divisor > 0); +} + +//----------------------------------------------- +void UnityPrintNumberHex(const _U_UINT number, const char nibbles_to_print) +{ + _U_UINT nibble; + char nibbles = nibbles_to_print; + UNITY_OUTPUT_CHAR('0'); + UNITY_OUTPUT_CHAR('x'); + + while (nibbles > 0) + { + nibble = (number >> (--nibbles << 2)) & 0x0000000F; + if (nibble <= 9) + { + UNITY_OUTPUT_CHAR((char)('0' + nibble)); + } + else + { + UNITY_OUTPUT_CHAR((char)('A' - 10 + nibble)); + } + } +} + +//----------------------------------------------- +void UnityPrintMask(const _U_UINT mask, const _U_UINT number) +{ + _U_UINT current_bit = (_U_UINT)1 << (UNITY_INT_WIDTH - 1); + _US32 i; + + for (i = 0; i < UNITY_INT_WIDTH; i++) + { + if (current_bit & mask) + { + if (current_bit & number) + { + UNITY_OUTPUT_CHAR('1'); + } + else + { + UNITY_OUTPUT_CHAR('0'); + } + } + else + { + UNITY_OUTPUT_CHAR('X'); + } + current_bit = current_bit >> 1; + } +} + +//----------------------------------------------- +#ifdef UNITY_FLOAT_VERBOSE +void UnityPrintFloat(_UF number) +{ + char TempBuffer[32]; + sprintf(TempBuffer, "%.6f", number); + UnityPrint(TempBuffer); +} +#endif + +//----------------------------------------------- +void UnityTestResultsBegin(const char* file, const UNITY_LINE_TYPE line) +{ + UnityPrint(file); + UNITY_OUTPUT_CHAR(':'); + UnityPrintNumber(line); + UNITY_OUTPUT_CHAR(':'); + UnityPrint(Unity.CurrentTestName); + UNITY_OUTPUT_CHAR(':'); +} + +//----------------------------------------------- +void UnityTestResultsFailBegin(const UNITY_LINE_TYPE line) +{ + UnityTestResultsBegin(Unity.TestFile, line); + UnityPrint("FAIL:"); +} + +//----------------------------------------------- +void UnityConcludeTest(void) +{ + if (Unity.CurrentTestIgnored) + { + Unity.TestIgnores++; + } + else if (!Unity.CurrentTestFailed) + { + UnityTestResultsBegin(Unity.TestFile, Unity.CurrentTestLineNumber); + UnityPrint("PASS"); + UNITY_PRINT_EOL; + } + else + { + Unity.TestFailures++; + } + + Unity.CurrentTestFailed = 0; + Unity.CurrentTestIgnored = 0; +} + +//----------------------------------------------- +void UnityAddMsgIfSpecified(const char* msg) +{ + if (msg) + { + UnityPrint(UnityStrSpacer); + UnityPrint(msg); + } +} + +//----------------------------------------------- +void UnityPrintExpectedAndActualStrings(const char* expected, const char* actual) +{ + UnityPrint(UnityStrExpected); + if (expected != NULL) + { + UNITY_OUTPUT_CHAR('\''); + UnityPrint(expected); + UNITY_OUTPUT_CHAR('\''); + } + else + { + UnityPrint(UnityStrNull); + } + UnityPrint(UnityStrWas); + if (actual != NULL) + { + UNITY_OUTPUT_CHAR('\''); + UnityPrint(actual); + UNITY_OUTPUT_CHAR('\''); + } + else + { + UnityPrint(UnityStrNull); + } +} + +//----------------------------------------------- +// Assertion & Control Helpers +//----------------------------------------------- + +int UnityCheckArraysForNull(const void* expected, const void* actual, const UNITY_LINE_TYPE lineNumber, const char* msg) +{ + //return true if they are both NULL + if ((expected == NULL) && (actual == NULL)) + return 1; + + //throw error if just expected is NULL + if (expected == NULL) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrNullPointerForExpected); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + //throw error if just actual is NULL + if (actual == NULL) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrNullPointerForActual); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + //return false if neither is NULL + return 0; +} + +//----------------------------------------------- +// Assertion Functions +//----------------------------------------------- + +void UnityAssertBits(const _U_SINT mask, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + UNITY_SKIP_EXECUTION; + + if ((mask & expected) != (mask & actual)) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrExpected); + UnityPrintMask(mask, expected); + UnityPrint(UnityStrWas); + UnityPrintMask(mask, actual); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualNumber(const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style) +{ + UNITY_SKIP_EXECUTION; + + if (expected != actual) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(expected, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(actual, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualIntArray(const _U_SINT* expected, + const _U_SINT* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style) +{ + _UU32 elements = num_elements; + const _US8* ptr_exp = (_US8*)expected; + const _US8* ptr_act = (_US8*)actual; + + UNITY_SKIP_EXECUTION; + + if (elements == 0) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + switch(style) + { + case UNITY_DISPLAY_STYLE_HEX8: + case UNITY_DISPLAY_STYLE_INT8: + case UNITY_DISPLAY_STYLE_UINT8: + while (elements--) + { + if (*ptr_exp != *ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 1; + ptr_act += 1; + } + break; + case UNITY_DISPLAY_STYLE_HEX16: + case UNITY_DISPLAY_STYLE_INT16: + case UNITY_DISPLAY_STYLE_UINT16: + while (elements--) + { + if (*(_US16*)ptr_exp != *(_US16*)ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*(_US16*)ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*(_US16*)ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 2; + ptr_act += 2; + } + break; +#ifdef UNITY_SUPPORT_64 + case UNITY_DISPLAY_STYLE_HEX64: + case UNITY_DISPLAY_STYLE_INT64: + case UNITY_DISPLAY_STYLE_UINT64: + while (elements--) + { + if (*(_US64*)ptr_exp != *(_US64*)ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*(_US64*)ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*(_US64*)ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 8; + ptr_act += 8; + } + break; +#endif + default: + while (elements--) + { + if (*(_US32*)ptr_exp != *(_US32*)ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*(_US32*)ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*(_US32*)ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 4; + ptr_act += 4; + } + break; + } +} + +//----------------------------------------------- +#ifndef UNITY_EXCLUDE_FLOAT +void UnityAssertEqualFloatArray(const _UF* expected, + const _UF* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UU32 elements = num_elements; + const _UF* ptr_expected = expected; + const _UF* ptr_actual = actual; + _UF diff, tol; + + UNITY_SKIP_EXECUTION; + + if (elements == 0) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + while (elements--) + { + diff = *ptr_expected - *ptr_actual; + if (diff < 0.0) + diff = 0.0 - diff; + tol = UNITY_FLOAT_PRECISION * *ptr_expected; + if (tol < 0.0) + tol = 0.0 - tol; + if (diff > tol) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); +#ifdef UNITY_FLOAT_VERBOSE + UnityPrint(UnityStrExpected); + UnityPrintFloat(*ptr_expected); + UnityPrint(UnityStrWas); + UnityPrintFloat(*ptr_actual); +#else + UnityPrint(UnityStrDelta); +#endif + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_expected++; + ptr_actual++; + } +} + +//----------------------------------------------- +void UnityAssertFloatsWithin(const _UF delta, + const _UF expected, + const _UF actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UF diff = actual - expected; + _UF pos_delta = delta; + + UNITY_SKIP_EXECUTION; + + if (diff < 0) + { + diff = 0.0f - diff; + } + if (pos_delta < 0) + { + pos_delta = 0.0f - pos_delta; + } + + if (pos_delta < diff) + { + UnityTestResultsFailBegin(lineNumber); +#ifdef UNITY_FLOAT_VERBOSE + UnityPrint(UnityStrExpected); + UnityPrintFloat(expected); + UnityPrint(UnityStrWas); + UnityPrintFloat(actual); +#else + UnityPrint(UnityStrDelta); +#endif + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} +#endif + +//----------------------------------------------- +void UnityAssertNumbersWithin( const _U_SINT delta, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style) +{ + UNITY_SKIP_EXECUTION; + + if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT) + { + if (actual > expected) + Unity.CurrentTestFailed = ((actual - expected) > delta); + else + Unity.CurrentTestFailed = ((expected - actual) > delta); + } + else + { + if ((_U_UINT)actual > (_U_UINT)expected) + Unity.CurrentTestFailed = ((_U_UINT)(actual - expected) > (_U_UINT)delta); + else + Unity.CurrentTestFailed = ((_U_UINT)(expected - actual) > (_U_UINT)delta); + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrDelta); + UnityPrintNumberByStyle(delta, style); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(expected, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(actual, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualString(const char* expected, + const char* actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UU32 i; + + UNITY_SKIP_EXECUTION; + + // if both pointers not null compare the strings + if (expected && actual) + { + for (i = 0; expected[i] || actual[i]; i++) + { + if (expected[i] != actual[i]) + { + Unity.CurrentTestFailed = 1; + break; + } + } + } + else + { // handle case of one pointers being null (if both null, test should pass) + if (expected != actual) + { + Unity.CurrentTestFailed = 1; + } + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrintExpectedAndActualStrings(expected, actual); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualStringArray( const char** expected, + const char** actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UU32 i, j = 0; + + UNITY_SKIP_EXECUTION; + + // if no elements, it's an error + if (num_elements == 0) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + do + { + // if both pointers not null compare the strings + if (expected[j] && actual[j]) + { + for (i = 0; expected[j][i] || actual[j][i]; i++) + { + if (expected[j][i] != actual[j][i]) + { + Unity.CurrentTestFailed = 1; + break; + } + } + } + else + { // handle case of one pointers being null (if both null, test should pass) + if (expected[j] != actual[j]) + { + Unity.CurrentTestFailed = 1; + } + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + if (num_elements > 1) + { + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - j - 1), UNITY_DISPLAY_STYLE_UINT); + } + UnityPrintExpectedAndActualStrings((const char*)(expected[j]), (const char*)(actual[j])); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + } while (++j < num_elements); +} + +//----------------------------------------------- +void UnityAssertEqualMemory( const void* expected, + const void* actual, + _UU32 length, + _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + unsigned char* expected_ptr = (unsigned char*)expected; + unsigned char* actual_ptr = (unsigned char*)actual; + _UU32 elements = num_elements; + + UNITY_SKIP_EXECUTION; + + if ((elements == 0) || (length == 0)) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + while (elements--) + { + if (memcmp((const void*)expected_ptr, (const void*)actual_ptr, length) != 0) + { + Unity.CurrentTestFailed = 1; + break; + } + expected_ptr += length; + actual_ptr += length; + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + if (num_elements > 1) + { + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + } + UnityPrint(UnityStrMemory); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +// Control Functions +//----------------------------------------------- + +void UnityFail(const char* msg, const UNITY_LINE_TYPE line) +{ + UNITY_SKIP_EXECUTION; + + UnityTestResultsBegin(Unity.TestFile, line); + UnityPrint("FAIL"); + if (msg != NULL) + { + UNITY_OUTPUT_CHAR(':'); + if (msg[0] != ' ') + { + UNITY_OUTPUT_CHAR(' '); + } + UnityPrint(msg); + } + UNITY_FAIL_AND_BAIL; +} + +//----------------------------------------------- +void UnityIgnore(const char* msg, const UNITY_LINE_TYPE line) +{ + UNITY_SKIP_EXECUTION; + + UnityTestResultsBegin(Unity.TestFile, line); + UnityPrint("IGNORE"); + if (msg != NULL) + { + UNITY_OUTPUT_CHAR(':'); + UNITY_OUTPUT_CHAR(' '); + UnityPrint(msg); + } + UNITY_IGNORE_AND_BAIL; +} + +//----------------------------------------------- +void setUp(void); +void tearDown(void); +void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum) +{ + Unity.CurrentTestName = FuncName; + Unity.CurrentTestLineNumber = FuncLineNum; + Unity.NumberOfTests++; + if (TEST_PROTECT()) + { + setUp(); + Func(); + } + if (TEST_PROTECT() && !(Unity.CurrentTestIgnored)) + { + tearDown(); + } + UnityConcludeTest(); +} + +//----------------------------------------------- +void UnityBegin(void) +{ + Unity.NumberOfTests = 0; +} + +//----------------------------------------------- +int UnityEnd(void) +{ + UnityPrint("-----------------------"); + UNITY_PRINT_EOL; + UnityPrintNumber(Unity.NumberOfTests); + UnityPrint(" Tests "); + UnityPrintNumber(Unity.TestFailures); + UnityPrint(" Failures "); + UnityPrintNumber(Unity.TestIgnores); + UnityPrint(" Ignored"); + UNITY_PRINT_EOL; + if (Unity.TestFailures == 0U) + { + UnityPrint("OK"); + } + else + { + UnityPrint("FAIL"); + } + UNITY_PRINT_EOL; + return Unity.TestFailures; +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/src/unity.h b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/src/unity.h new file mode 100644 index 0000000..0b1b187 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/src/unity.h @@ -0,0 +1,213 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FRAMEWORK_H +#define UNITY_FRAMEWORK_H + +#define UNITY + +#include "unity_internals.h" + +//------------------------------------------------------- +// Configuration Options +//------------------------------------------------------- + +// Integers +// - Unity assumes 32 bit integers by default +// - If your compiler treats ints of a different size, define UNITY_INT_WIDTH + +// Floats +// - define UNITY_EXCLUDE_FLOAT to disallow floating point comparisons +// - define UNITY_FLOAT_PRECISION to specify the precision to use when doing TEST_ASSERT_EQUAL_FLOAT +// - define UNITY_FLOAT_TYPE to specify doubles instead of single precision floats +// - define UNITY_FLOAT_VERBOSE to print floating point values in errors (uses sprintf) + +// Output +// - by default, Unity prints to standard out with putchar. define UNITY_OUTPUT_CHAR(a) with a different function if desired + +// Optimization +// - by default, line numbers are stored in unsigned shorts. Define UNITY_LINE_TYPE with a different type if your files are huge +// - by default, test and failure counters are unsigned shorts. Define UNITY_COUNTER_TYPE with a different type if you want to save space or have more than 65535 Tests. + +// Test Cases +// - define UNITY_SUPPORT_TEST_CASES to include the TEST_CASE macro, though really it's mostly about the runner generator script + +// Parameterized Tests +// - you'll want to create a define of TEST_CASE(...) which basically evaluates to nothing + +//------------------------------------------------------- +// Test Running Macros +//------------------------------------------------------- + +#define TEST_PROTECT() (setjmp(Unity.AbortFrame) == 0) + +#define TEST_ABORT() {longjmp(Unity.AbortFrame, 1);} + +#ifndef RUN_TEST +#define RUN_TEST(func, line_num) UnityDefaultTestRun(func, #func, line_num) +#endif + +#define TEST_LINE_NUM (Unity.CurrentTestLineNumber) +#define TEST_IS_IGNORED (Unity.CurrentTestIgnored) + +//------------------------------------------------------- +// Basic Fail and Ignore +//------------------------------------------------------- + +#define TEST_FAIL_MESSAGE(message) UNITY_TEST_FAIL(__LINE__, message) +#define TEST_FAIL() UNITY_TEST_FAIL(__LINE__, NULL) +#define TEST_IGNORE_MESSAGE(message) UNITY_TEST_IGNORE(__LINE__, message) +#define TEST_IGNORE() UNITY_TEST_IGNORE(__LINE__, NULL) +#define TEST_ONLY() + +//------------------------------------------------------- +// Test Asserts (simple) +//------------------------------------------------------- + +//Boolean +#define TEST_ASSERT(condition) UNITY_TEST_ASSERT( (condition), __LINE__, " Expression Evaluated To FALSE") +#define TEST_ASSERT_TRUE(condition) UNITY_TEST_ASSERT( (condition), __LINE__, " Expected TRUE Was FALSE") +#define TEST_ASSERT_UNLESS(condition) UNITY_TEST_ASSERT( !(condition), __LINE__, " Expression Evaluated To TRUE") +#define TEST_ASSERT_FALSE(condition) UNITY_TEST_ASSERT( !(condition), __LINE__, " Expected FALSE Was TRUE") +#define TEST_ASSERT_NULL(pointer) UNITY_TEST_ASSERT_NULL( (pointer), __LINE__, " Expected NULL") +#define TEST_ASSERT_NOT_NULL(pointer) UNITY_TEST_ASSERT_NOT_NULL((pointer), __LINE__, " Expected Non-NULL") + +//Integers (of all sizes) +#define TEST_ASSERT_EQUAL_INT(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT8(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT8((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT16(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT16((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT32(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT32((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT64(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT64((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_NOT_EQUAL(expected, actual) UNITY_TEST_ASSERT(((expected) != (actual)), __LINE__, " Expected Not-Equal") +#define TEST_ASSERT_EQUAL_UINT(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT8(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT8( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT16(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT16( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT32(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT32( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT64(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT64( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX8(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX8( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX16(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX16((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX32(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX64(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX64((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_BITS(mask, expected, actual) UNITY_TEST_ASSERT_BITS((mask), (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_BITS_HIGH(mask, actual) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(-1), (actual), __LINE__, NULL) +#define TEST_ASSERT_BITS_LOW(mask, actual) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(0), (actual), __LINE__, NULL) +#define TEST_ASSERT_BIT_HIGH(bit, actual) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(-1), (actual), __LINE__, NULL) +#define TEST_ASSERT_BIT_LOW(bit, actual) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(0), (actual), __LINE__, NULL) + +//Integer Ranges (of all sizes) +#define TEST_ASSERT_INT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_UINT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX8_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX16_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX32_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX64_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, __LINE__, NULL) + +//Structs and Strings +#define TEST_ASSERT_EQUAL_PTR(expected, actual) UNITY_TEST_ASSERT_EQUAL_PTR((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_STRING(expected, actual) UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_MEMORY(expected, actual, len) UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, __LINE__, NULL) + +//Arrays +#define TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements) UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, __LINE__, NULL) + +//Floating Point (If Enabled) +#define TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_FLOAT(expected, actual) UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, __LINE__, NULL) + +//------------------------------------------------------- +// Test Asserts (with additional messages) +//------------------------------------------------------- + +//Boolean +#define TEST_ASSERT_MESSAGE(condition, message) UNITY_TEST_ASSERT( (condition), __LINE__, message) +#define TEST_ASSERT_TRUE_MESSAGE(condition, message) UNITY_TEST_ASSERT( (condition), __LINE__, message) +#define TEST_ASSERT_UNLESS_MESSAGE(condition, message) UNITY_TEST_ASSERT( !(condition), __LINE__, message) +#define TEST_ASSERT_FALSE_MESSAGE(condition, message) UNITY_TEST_ASSERT( !(condition), __LINE__, message) +#define TEST_ASSERT_NULL_MESSAGE(pointer, message) UNITY_TEST_ASSERT_NULL( (pointer), __LINE__, message) +#define TEST_ASSERT_NOT_NULL_MESSAGE(pointer, message) UNITY_TEST_ASSERT_NOT_NULL((pointer), __LINE__, message) + +//Integers (of all sizes) +#define TEST_ASSERT_EQUAL_INT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT8((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT16((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT32((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT64((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, message) +#define TEST_ASSERT_NOT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT(((expected) != (actual)), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT8( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT16( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT32( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT64( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX8( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX16((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX64((expected), (actual), __LINE__, message) +#define TEST_ASSERT_BITS_MESSAGE(mask, expected, actual, message) UNITY_TEST_ASSERT_BITS((mask), (expected), (actual), __LINE__, message) +#define TEST_ASSERT_BITS_HIGH_MESSAGE(mask, actual, message) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(-1), (actual), __LINE__, message) +#define TEST_ASSERT_BITS_LOW_MESSAGE(mask, actual, message) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(0), (actual), __LINE__, message) +#define TEST_ASSERT_BIT_HIGH_MESSAGE(bit, actual, message) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(-1), (actual), __LINE__, message) +#define TEST_ASSERT_BIT_LOW_MESSAGE(bit, actual, message) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(0), (actual), __LINE__, message) + +//Integer Ranges (of all sizes) +#define TEST_ASSERT_INT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_UINT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX8_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX16_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX32_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX64_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, __LINE__, message) + +//Structs and Strings +#define TEST_ASSERT_EQUAL_PTR_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_PTR(expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_STRING_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_MEMORY_MESSAGE(expected, actual, len, message) UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, __LINE__, message) + +//Arrays +#define TEST_ASSERT_EQUAL_INT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_STRING_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_MEMORY_ARRAY_MESSAGE(expected, actual, len, num_elements, message) UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, __LINE__, message) + +//Floating Point (If Enabled) +#define TEST_ASSERT_FLOAT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_FLOAT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_FLOAT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, __LINE__, message) +#endif diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/src/unity_internals.h b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/src/unity_internals.h new file mode 100644 index 0000000..29c9d1d --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/src/unity_internals.h @@ -0,0 +1,355 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_INTERNALS_H +#define UNITY_INTERNALS_H + +#include +#include + +//------------------------------------------------------- +// Int Support +//------------------------------------------------------- + +#ifndef UNITY_INT_WIDTH +#define UNITY_INT_WIDTH (32) +#endif + +#ifndef UNITY_LONG_WIDTH +#define UNITY_LONG_WIDTH (32) +#endif + +#if (UNITY_INT_WIDTH == 32) + typedef unsigned char _UU8; + typedef unsigned short _UU16; + typedef unsigned int _UU32; + typedef signed char _US8; + typedef signed short _US16; + typedef signed int _US32; +#elif (UNITY_INT_WIDTH == 16) + typedef unsigned char _UU8; + typedef unsigned int _UU16; + typedef unsigned long _UU32; + typedef signed char _US8; + typedef signed int _US16; + typedef signed long _US32; +#else + #error Invalid UNITY_INT_WIDTH specified! (16 or 32 are supported) +#endif + +//------------------------------------------------------- +// 64-bit Support +//------------------------------------------------------- + +#ifndef UNITY_SUPPORT_64 + +//No 64-bit Support +typedef _UU32 _U_UINT; +typedef _US32 _U_SINT; + +#else + +//64-bit Support +#if (UNITY_LONG_WIDTH == 32) + typedef unsigned long long _UU64; + typedef signed long long _US64; +#elif (UNITY_LONG_WIDTH == 64) + typedef unsigned long _UU64; + typedef signed long _US64; +#else + #error Invalid UNITY_LONG_WIDTH specified! (32 or 64 are supported) +#endif +typedef _UU64 _U_UINT; +typedef _US64 _U_SINT; + +#endif + +//------------------------------------------------------- +// Pointer Support +//------------------------------------------------------- + +#ifndef UNITY_POINTER_WIDTH +#define UNITY_POINTER_WIDTH (32) +#endif + +#if (UNITY_POINTER_WIDTH == 32) + typedef _UU32 _UP; +#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX32 +#elif (UNITY_POINTER_WIDTH == 64) + typedef _UU64 _UP; +#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX64 +#elif (UNITY_POINTER_WIDTH == 16) + typedef _UU16 _UP; +#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX16 +#else + #error Invalid UNITY_POINTER_WIDTH specified! (16, 32 or 64 are supported) +#endif + +//------------------------------------------------------- +// Float Support +//------------------------------------------------------- + +#ifdef UNITY_EXCLUDE_FLOAT + +//No Floating Point Support +#undef UNITY_FLOAT_PRECISION +#undef UNITY_FLOAT_TYPE +#undef UNITY_FLOAT_VERBOSE + +#else + +//Floating Point Support +#ifndef UNITY_FLOAT_PRECISION +#define UNITY_FLOAT_PRECISION (0.00001f) +#endif +#ifndef UNITY_FLOAT_TYPE +#define UNITY_FLOAT_TYPE float +#endif +typedef UNITY_FLOAT_TYPE _UF; + +#endif + +//------------------------------------------------------- +// Output Method +//------------------------------------------------------- + +#ifndef UNITY_OUTPUT_CHAR +//Default to using putchar, which is defined in stdio.h above +#define UNITY_OUTPUT_CHAR(a) putchar(a) +#else +//If defined as something else, make sure we declare it here so it's ready for use +extern int UNITY_OUTPUT_CHAR(int); +#endif + +//------------------------------------------------------- +// Footprint +//------------------------------------------------------- + +#ifndef UNITY_LINE_TYPE +#define UNITY_LINE_TYPE unsigned short +#endif + +#ifndef UNITY_COUNTER_TYPE +#define UNITY_COUNTER_TYPE unsigned short +#endif + +//------------------------------------------------------- +// Internal Structs Needed +//------------------------------------------------------- + +typedef void (*UnityTestFunction)(void); + +#define UNITY_DISPLAY_RANGE_INT (0x10) +#define UNITY_DISPLAY_RANGE_UINT (0x20) +#define UNITY_DISPLAY_RANGE_HEX (0x40) +#define UNITY_DISPLAY_RANGE_AUTO (0x80) + +typedef enum +{ + UNITY_DISPLAY_STYLE_INT = 4 + UNITY_DISPLAY_RANGE_INT + UNITY_DISPLAY_RANGE_AUTO, + UNITY_DISPLAY_STYLE_INT8 = 1 + UNITY_DISPLAY_RANGE_INT, + UNITY_DISPLAY_STYLE_INT16 = 2 + UNITY_DISPLAY_RANGE_INT, + UNITY_DISPLAY_STYLE_INT32 = 4 + UNITY_DISPLAY_RANGE_INT, +#ifdef UNITY_SUPPORT_64 + UNITY_DISPLAY_STYLE_INT64 = 8 + UNITY_DISPLAY_RANGE_INT, +#endif + UNITY_DISPLAY_STYLE_UINT = 4 + UNITY_DISPLAY_RANGE_UINT + UNITY_DISPLAY_RANGE_AUTO, + UNITY_DISPLAY_STYLE_UINT8 = 1 + UNITY_DISPLAY_RANGE_UINT, + UNITY_DISPLAY_STYLE_UINT16 = 2 + UNITY_DISPLAY_RANGE_UINT, + UNITY_DISPLAY_STYLE_UINT32 = 4 + UNITY_DISPLAY_RANGE_UINT, +#ifdef UNITY_SUPPORT_64 + UNITY_DISPLAY_STYLE_UINT64 = 8 + UNITY_DISPLAY_RANGE_UINT, +#endif + UNITY_DISPLAY_STYLE_HEX8 = 1 + UNITY_DISPLAY_RANGE_HEX, + UNITY_DISPLAY_STYLE_HEX16 = 2 + UNITY_DISPLAY_RANGE_HEX, + UNITY_DISPLAY_STYLE_HEX32 = 4 + UNITY_DISPLAY_RANGE_HEX, +#ifdef UNITY_SUPPORT_64 + UNITY_DISPLAY_STYLE_HEX64 = 8 + UNITY_DISPLAY_RANGE_HEX, +#endif +} UNITY_DISPLAY_STYLE_T; + +struct _Unity +{ + const char* TestFile; + const char* CurrentTestName; + _UU32 CurrentTestLineNumber; + UNITY_COUNTER_TYPE NumberOfTests; + UNITY_COUNTER_TYPE TestFailures; + UNITY_COUNTER_TYPE TestIgnores; + UNITY_COUNTER_TYPE CurrentTestFailed; + UNITY_COUNTER_TYPE CurrentTestIgnored; + jmp_buf AbortFrame; +}; + +extern struct _Unity Unity; + +//------------------------------------------------------- +// Test Suite Management +//------------------------------------------------------- + +void UnityBegin(void); +int UnityEnd(void); +void UnityConcludeTest(void); +void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum); + +//------------------------------------------------------- +// Test Output +//------------------------------------------------------- + +void UnityPrint(const char* string); +void UnityPrintMask(const _U_UINT mask, const _U_UINT number); +void UnityPrintNumberByStyle(const _U_SINT number, const UNITY_DISPLAY_STYLE_T style); +void UnityPrintNumber(const _U_SINT number); +void UnityPrintNumberUnsigned(const _U_UINT number); +void UnityPrintNumberHex(const _U_UINT number, const char nibbles); + +#ifdef UNITY_FLOAT_VERBOSE +void UnityPrintFloat(const _UF number); +#endif + +//------------------------------------------------------- +// Test Assertion Fuctions +//------------------------------------------------------- +// Use the macros below this section instead of calling +// these directly. The macros have a consistent naming +// convention and will pull in file and line information +// for you. + +void UnityAssertEqualNumber(const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style); + +void UnityAssertEqualIntArray(const _U_SINT* expected, + const _U_SINT* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style); + +void UnityAssertBits(const _U_SINT mask, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualString(const char* expected, + const char* actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualStringArray( const char** expected, + const char** actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualMemory( const void* expected, + const void* actual, + const _UU32 length, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertNumbersWithin(const _U_SINT delta, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style); + +void UnityFail(const char* message, const UNITY_LINE_TYPE line); + +void UnityIgnore(const char* message, const UNITY_LINE_TYPE line); + +#ifndef UNITY_EXCLUDE_FLOAT +void UnityAssertFloatsWithin(const _UF delta, + const _UF expected, + const _UF actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualFloatArray(const _UF* expected, + const _UF* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber); +#endif + +//------------------------------------------------------- +// Basic Fail and Ignore +//------------------------------------------------------- + +#define UNITY_TEST_FAIL(line, message) UnityFail( (message), (UNITY_LINE_TYPE)line); +#define UNITY_TEST_IGNORE(line, message) UnityIgnore( (message), (UNITY_LINE_TYPE)line); + +//------------------------------------------------------- +// Test Asserts +//------------------------------------------------------- + +#define UNITY_TEST_ASSERT(condition, line, message) if (condition) {} else {UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, message);} +#define UNITY_TEST_ASSERT_NULL(pointer, line, message) UNITY_TEST_ASSERT(((pointer) == NULL), (UNITY_LINE_TYPE)line, message) +#define UNITY_TEST_ASSERT_NOT_NULL(pointer, line, message) UNITY_TEST_ASSERT(((pointer) != NULL), (UNITY_LINE_TYPE)line, message) + +#define UNITY_TEST_ASSERT_EQUAL_INT(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_UINT(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_HEX8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX8) +#define UNITY_TEST_ASSERT_EQUAL_HEX16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX16) +#define UNITY_TEST_ASSERT_EQUAL_HEX32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX32) +#define UNITY_TEST_ASSERT_BITS(mask, expected, actual, line, message) UnityAssertBits((_U_SINT)(mask), (_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line) + +#define UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX8) +#define UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX16) +#define UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX32) +#define UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64) + +#define UNITY_TEST_ASSERT_EQUAL_PTR(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(_UP)(expected), (_U_SINT)(_UP)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_POINTER) +#define UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, line, message) UnityAssertEqualString((const char*)(expected), (const char*)(actual), (message), (UNITY_LINE_TYPE)line) +#define UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, line, message) UnityAssertEqualMemory((void*)(expected), (void*)(actual), (_UU32)(len), 1, (message), (UNITY_LINE_TYPE)line) + +#define UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT8) +#define UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT16) +#define UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT32) +#define UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT8) +#define UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT16) +#define UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT32) +#define UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX8) +#define UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX16) +#define UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX32) +#define UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualStringArray((const char**)(expected), (const char**)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line) +#define UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, line, message) UnityAssertEqualMemory((void*)(expected), (void*)(actual), (_UU32)(len), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line) + +#ifdef UNITY_SUPPORT_64 +#define UNITY_TEST_ASSERT_EQUAL_INT64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT64) +#define UNITY_TEST_ASSERT_EQUAL_UINT64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT64) +#define UNITY_TEST_ASSERT_EQUAL_HEX64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64) +#define UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT64) +#define UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT64) +#define UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64) +#endif + +#ifdef UNITY_EXCLUDE_FLOAT +#define UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled") +#define UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled") +#define UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled") +#else +#define UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, line, message) UnityAssertFloatsWithin((_UF)(delta), (_UF)(expected), (_UF)(actual), (message), (UNITY_LINE_TYPE)line) +#define UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, line, message) UNITY_TEST_ASSERT_FLOAT_WITHIN((_UF)(expected) * (_UF)UNITY_FLOAT_PRECISION, (_UF)expected, (_UF)actual, (UNITY_LINE_TYPE)line, message) +#define UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualFloatArray((_UF*)(expected), (_UF*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line) +#endif + +#endif diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/gcc.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/gcc.yml new file mode 100644 index 0000000..0f18c6c --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/gcc.yml @@ -0,0 +1,42 @@ +compiler: + path: gcc + source_path: 'src/' + unit_tests_path: &unit_tests_path 'test/' + build_path: &build_path 'build/' + options: + - '-c' + - '-Wall' + - '-Wno-address' + - '-std=c99' + - '-pedantic' + includes: + prefix: '-I' + items: + - 'src/' + - '../src/' + - *unit_tests_path + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - UNITY_SUPPORT_TEST_CASES + object_files: + prefix: '-o' + extension: '.o' + destination: *build_path +linker: + path: gcc + options: + - -lm + includes: + prefix: '-I' + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.exe' + destination: *build_path +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/gcc_64.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/gcc_64.yml new file mode 100644 index 0000000..97cb958 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/gcc_64.yml @@ -0,0 +1,43 @@ +compiler: + path: gcc + source_path: 'src/' + unit_tests_path: &unit_tests_path 'test/' + build_path: &build_path 'build/' + options: + - '-c' + - '-Wall' + - '-Wno-address' + - '-std=c99' + - '-pedantic' + includes: + prefix: '-I' + items: + - 'src/' + - '../src/' + - *unit_tests_path + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - UNITY_SUPPORT_TEST_CASES + - 'UNITY_POINTER_WIDTH=64' + object_files: + prefix: '-o' + extension: '.o' + destination: *build_path +linker: + path: gcc + options: + - -lm + includes: + prefix: '-I' + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.exe' + destination: *build_path +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/hitech_picc18.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/hitech_picc18.yml new file mode 100644 index 0000000..210d944 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/hitech_picc18.yml @@ -0,0 +1,101 @@ +# rumor has it that this yaml file works for the standard edition of the +# hitech PICC18 compiler, but not the pro version. +# +compiler: + path: cd build && picc18 + source_path: 'c:\Projects\NexGen\Prototypes\CMockTest\src\' + unit_tests_path: &unit_tests_path 'c:\Projects\NexGen\Prototypes\CMockTest\test\' + build_path: &build_path 'c:\Projects\NexGen\Prototypes\CMockTest\build\' + options: + - --chip=18F87J10 + - --ide=hitide + - --q #quiet please + - --asmlist + - --codeoffset=0 + - --emi=wordwrite # External memory interface protocol + - --warn=0 # allow all normal warning messages + - --errors=10 # Number of errors before aborting compile + - --char=unsigned + - -Bl # Large memory model + - -G # generate symbol file + - --cp=16 # 16-bit pointers + - --double=24 + - -N255 # 255-char symbol names + - --opt=none # Do not use any compiler optimziations + - -c # compile only + - -M + includes: + prefix: '-I' + items: + - 'c:/Projects/NexGen/Prototypes/CMockTest/src/' + - 'c:/Projects/NexGen/Prototypes/CMockTest/mocks/' + - 'c:/CMock/src/' + - 'c:/CMock/examples/src/' + - 'c:/CMock/vendor/unity/src/' + - 'c:/CMock/vendor/unity/examples/helper/' + - *unit_tests_path + defines: + prefix: '-D' + items: + - UNITY_INT_WIDTH=16 + - UNITY_POINTER_WIDTH=16 + - CMOCK_MEM_STATIC + - CMOCK_MEM_SIZE=3000 + - UNITY_SUPPORT_TEST_CASES + - _PICC18 + object_files: + # prefix: '-O' # Hi-Tech doesn't want a prefix. They key off of filename .extensions, instead + extension: '.obj' + destination: *build_path + +linker: + path: cd build && picc18 + options: + - --chip=18F87J10 + - --ide=hitide + - --cp=24 # 24-bit pointers. Is this needed for linker?? + - --double=24 # Is this needed for linker?? + - -Lw # Scan the pic87*w.lib in the lib/ of the compiler installation directory + - --summary=mem,file # info listing + - --summary=+psect + - --summary=+hex + - --output=+intel + - --output=+mcof + - --runtime=+init # Directs startup code to copy idata, ibigdata and ifardata psects from ROM to RAM. + - --runtime=+clear # Directs startup code to clear bss, bigbss, rbss and farbss psects + - --runtime=+clib # link in the c-runtime + - --runtime=+keep # Keep the generated startup src after its obj is linked + - -G # Generate src-level symbol file + - -MIWasTheLastToBuild.map + - --warn=0 # allow all normal warning messages + - -Bl # Large memory model (probably not needed for linking) + includes: + prefix: '-I' + object_files: + path: *build_path + extension: '.obj' + bin_files: + prefix: '-O' + extension: '.hex' + destination: *build_path + +simulator: + path: + pre_support: + - 'java -client -jar ' # note space + - ['C:\Program Files\HI-TECH Software\HI-TIDE\3.15\lib\', 'simpic18.jar'] + - 18F87J10 + post_support: + +:cmock: + :plugins: [] + :includes: + - Types.h + :suite_teardown: | + if (num_failures) + _FAILED_TEST(); + else + _PASSED_TESTS(); + return 0; + +colour: true \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_arm_v4.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_arm_v4.yml new file mode 100644 index 0000000..c2e7f18 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_arm_v4.yml @@ -0,0 +1,89 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 4.0 Kickstart\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\lib\dl4tptinl8n.h'] + - -z3 + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian little + - --cpu ARM7TDMI + - --stack_align 4 + - --interwork + - -e + - --silent + - --warnings_are_errors + - --fpu None + - --diag_suppress Pa050 + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'common\bin\xlink.exe'] + options: + - -rt + - [*tools_root, 'arm\lib\dl4tptinl8n.r79'] + - -D_L_EXTMEM_START=0 + - -D_L_EXTMEM_SIZE=0 + - -D_L_HEAP_SIZE=120 + - -D_L_STACK_SIZE=32 + - -e_small_write=_formatted_write + - -s + - __program_start + - -f + - [*tools_root, '\arm\config\lnkarm.xcl'] + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\config\'] + - [*tools_root, 'arm\lib\'] + object_files: + path: *build_path + extension: '.r79' + bin_files: + prefix: '-o' + extension: '.d79' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\ioat91sam7X256.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_arm_v5.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_arm_v5.yml new file mode 100644 index 0000000..0549d8e --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_arm_v5.yml @@ -0,0 +1,79 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian=little + - --cpu=ARM7TDMI + - --interwork + - --warnings_are_errors + - --fpu=None + - --diag_suppress=Pa050 + - --diag_suppress=Pe111 + - -e + - -On + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\debugger\atmel\ioat91sam7X256.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_arm_v5_3.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_arm_v5_3.yml new file mode 100644 index 0000000..0549d8e --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_arm_v5_3.yml @@ -0,0 +1,79 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian=little + - --cpu=ARM7TDMI + - --interwork + - --warnings_are_errors + - --fpu=None + - --diag_suppress=Pa050 + - --diag_suppress=Pe111 + - -e + - -On + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\debugger\atmel\ioat91sam7X256.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml new file mode 100644 index 0000000..eb0785c --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml @@ -0,0 +1,93 @@ +#Default tool path for IAR 5.4 on Windows XP 64bit +tools_root: &tools_root 'C:\Program Files (x86)\IAR Systems\Embedded Workbench 5.4 Kickstart\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --diag_suppress=Pa050 + #- --diag_suppress=Pe111 + - --debug + - --endian=little + - --cpu=Cortex-M3 + - --no_path_in_file_macros + - -e + - --fpu=None + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + #- --preinclude --preinclude C:\Vss\T2 Working\common\system.h + - --interwork + - --warnings_are_errors +# - Ohz + - -Oh +# - --no_cse +# - --no_unroll +# - --no_inline +# - --no_code_motion +# - --no_tbaa +# - --no_clustering +# - --no_scheduling + + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - ewarm + - PART_LM3S9B92 + - TARGET_IS_TEMPEST_RB1 + - USE_ROM_DRIVERS + - UART_BUFFERED + - UNITY_SUPPORT_64 + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic.icf'] +# - ['C:\Temp\lm3s9b92.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + #- --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim2.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - --endian=little + - --cpu=Cortex-M3 + - --fpu=None + - -p + - [*tools_root, 'arm\config\debugger\TexasInstruments\iolm3sxxxx.ddf'] + - --semihosting + - --device=LM3SxBxx + #- -d + #- sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_cortexm3_v5.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_cortexm3_v5.yml new file mode 100644 index 0000000..cf0d1d0 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_cortexm3_v5.yml @@ -0,0 +1,83 @@ +# unit testing under iar compiler / simulator for STM32 Cortex-M3 + +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.4\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian=little + - --cpu=Cortex-M3 + - --interwork + - --warnings_are_errors + - --fpu=None + - --diag_suppress=Pa050 + - --diag_suppress=Pe111 + - -e + - -On + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - 'IAR' + - 'UNITY_SUPPORT_64' + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic_cortex.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\debugger\ST\iostm32f107xx.ddf'] + - --cpu=Cortex-M3 + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_msp430.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_msp430.yml new file mode 100644 index 0000000..e022647 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_msp430.yml @@ -0,0 +1,94 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3 MSP430\' +core_root: &core_root [*tools_root, '430\'] +core_bin: &core_bin [*core_root, 'bin\'] +core_config: &core_config [*core_root, 'config\'] +core_lib: &core_lib [*core_root, 'lib\'] +core_inc: &core_inc [*core_root, 'inc\'] +core_config: &core_config [*core_root, 'config\'] + +compiler: + path: [*core_bin, 'icc430.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*core_lib, 'dlib\dl430fn.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --debug + - -e + - -Ol + - --multiplier=16 + - --double=32 + - --diag_suppress Pa050 + - --diag_suppress Pe111 + includes: + prefix: '-I' + items: + - *core_inc + - [*core_inc, 'dlib'] + - [*core_lib, 'dlib'] + - 'src\' + - '../src/' + - *unit_tests_path + - 'vendor\unity\src' + defines: + prefix: '-D' + items: + - '__MSP430F149__' + - 'INT_WIDTH=16' + - 'UNITY_EXCLUDE_FLOAT' + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r43' + destination: *build_path +linker: + path: [*core_bin, 'xlink.exe'] + options: + - -rt + - [*core_lib, 'dlib\dl430fn.r43'] + - -e_PrintfTiny=_Printf + - -e_ScanfSmall=_Scanf + - -s __program_start + - -D_STACK_SIZE=50 + - -D_DATA16_HEAP_SIZE=50 + - -D_DATA20_HEAP_SIZE=50 + - -f + - [*core_config, 'lnk430f5438.xcl'] + - -f + - [*core_config, 'multiplier.xcl'] + includes: + prefix: '-I' + items: + - *core_config + - *core_lib + - [*core_lib, 'dlib'] + object_files: + path: *build_path + extension: '.r79' + bin_files: + prefix: '-o' + extension: '.d79' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*core_bin, '430proc.dll'] + - [*core_bin, '430sim.dll'] + post_support: + - --plugin + - [*core_bin, '430bat.dll'] + - --backend -B + - --cpu MSP430F5438 + - -p + - [*core_config, 'MSP430F5438.ddf'] + - -d sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_sh2a_v6.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_sh2a_v6.yml new file mode 100644 index 0000000..ddc5603 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_sh2a_v6.yml @@ -0,0 +1,85 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 6.0\' +compiler: + path: [*tools_root, 'sh\bin\iccsh.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - -e + - --char_is_signed + - -Ol + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_scheduling + - --no_clustering + - --debug + - --dlib_config + - [*tools_root, 'sh\inc\DLib_Product.h'] + - --double=32 + - --code_model=huge + - --data_model=huge + - --core=sh2afpu + - --warnings_affect_exit_code + - --warnings_are_errors + - --mfc + - --use_unix_directory_separators + - --diag_suppress=Pe161 + includes: + prefix: '-I' + items: + - [*tools_root, 'sh\inc\'] + - [*tools_root, 'sh\inc\c'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.o' + destination: *build_path +linker: + path: [*tools_root, 'sh\bin\ilinksh.exe'] + options: + - --redirect __Printf=__PrintfSmall + - --redirect __Scanf=__ScanfSmall + - --config + - [*tools_root, 'sh\config\generic.icf'] + - --config_def _CSTACK_SIZE=0x800 + - --config_def _HEAP_SIZE=0x800 + - --config_def _INT_TABLE=0x10 + - --entry __iar_program_start + - --debug_lib + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'sh\bin\shproc.dll'] + - [*tools_root, 'sh\bin\shsim.dll'] + post_support: + - --plugin + - [*tools_root, 'sh\bin\shbat.dll'] + - --backend + - -B + - --core sh2afpu + - -p + - [*tools_root, 'sh\config\debugger\io7264.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_cmd.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_cmd.c new file mode 100644 index 0000000..42841d8 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_cmd.c @@ -0,0 +1,54 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include +#include "CException.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_def.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_def.c new file mode 100644 index 0000000..8280804 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_def.c @@ -0,0 +1,50 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_cmd.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_cmd.c new file mode 100644 index 0000000..e47b31c --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_cmd.c @@ -0,0 +1,76 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_def.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_def.c new file mode 100644 index 0000000..3ca9dba --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_def.c @@ -0,0 +1,72 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new1.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new1.c new file mode 100644 index 0000000..a7cbcd8 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new1.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + GlobalExpectCount = 0; + GlobalVerifyOrder = 0; + GlobalOrderError = NULL; + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new2.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new2.c new file mode 100644 index 0000000..2c76bf2 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new2.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_param.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_param.c new file mode 100644 index 0000000..23c04f4 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_param.c @@ -0,0 +1,73 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST_NO_ARGS +#define RUN_TEST(TestFunc, TestLineNum, ...) \ +{ \ + Unity.CurrentTestName = #TestFunc "(" #__VA_ARGS__ ")"; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(__VA_ARGS__); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21, RUN_TEST_NO_ARGS); + RUN_TEST(test_TheSecondThingToTest, 43, RUN_TEST_NO_ARGS); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run1.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run1.c new file mode 100644 index 0000000..a7cbcd8 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run1.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + GlobalExpectCount = 0; + GlobalVerifyOrder = 0; + GlobalOrderError = NULL; + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run2.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run2.c new file mode 100644 index 0000000..2c76bf2 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run2.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_yaml.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_yaml.c new file mode 100644 index 0000000..68b545a --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_yaml.c @@ -0,0 +1,86 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include "two.h" +#include "three.h" +#include +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_yaml_setup(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_new1.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_new1.c new file mode 100644 index 0000000..e5bcac2 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_new1.c @@ -0,0 +1,60 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_new2.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_new2.c new file mode 100644 index 0000000..b7c7e5b --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_new2.c @@ -0,0 +1,63 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_param.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_param.c new file mode 100644 index 0000000..4157007 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_param.c @@ -0,0 +1,51 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST_NO_ARGS +#define RUN_TEST(TestFunc, TestLineNum, ...) \ +{ \ + Unity.CurrentTestName = #TestFunc "(" #__VA_ARGS__ ")"; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(__VA_ARGS__); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21, RUN_TEST_NO_ARGS); + RUN_TEST(test_TheSecondThingToTest, 43, RUN_TEST_NO_ARGS); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_run1.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_run1.c new file mode 100644 index 0000000..e5bcac2 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_run1.c @@ -0,0 +1,60 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_run2.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_run2.c new file mode 100644 index 0000000..b7c7e5b --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_run2.c @@ -0,0 +1,63 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_yaml.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_yaml.c new file mode 100644 index 0000000..d109287 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_yaml.c @@ -0,0 +1,64 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "two.h" +#include "three.h" +#include +#include +#include +#include "CException.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_yaml_setup(); +} + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/test_generate_test_runner.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/test_generate_test_runner.rb new file mode 100644 index 0000000..61c8df9 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/test_generate_test_runner.rb @@ -0,0 +1,94 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +ruby_version = RUBY_VERSION.split('.') +if (ruby_version[1].to_i == 9) and (ruby_version[2].to_i > 1) + require 'rubygems' + gem 'test-unit' +end +require 'test/unit' +require './auto/generate_test_runner.rb' + +TEST_FILE = 'test/testdata/testsample.c' +TEST_MOCK = 'test/testdata/mocksample.c' +OUT_FILE = 'build/testsample_' +EXP_FILE = 'test/expectdata/testsample_' + +class TestGenerateTestRunner < Test::Unit::TestCase + def setup + end + + def teardown + end + + def verify_output_equal(subtest) + expected = File.read(EXP_FILE + subtest + '.c').gsub(/\r\n/,"\n") + actual = File.read(OUT_FILE + subtest + '.c').gsub(/\r\n/,"\n") + assert_equal(expected, actual, "Generated File Sub-Test '#{subtest}' Failed") + end + + def test_ShouldGenerateARunnerByCreatingRunnerWithOptions + sets = { 'def' => nil, + 'new1' => { :plugins => [:cexception], :includes => ['one.h', 'two.h'], :enforce_strict_ordering => true }, + 'new2' => { :plugins => [:ignore], :suite_setup => "a_custom_setup();", :suite_teardown => "a_custom_teardown();" } + } + + sets.each_pair do |subtest, options| + UnityTestRunnerGenerator.new(options).run(TEST_FILE, OUT_FILE + subtest + '.c') + verify_output_equal(subtest) + UnityTestRunnerGenerator.new(options).run(TEST_MOCK, OUT_FILE + 'mock_' + subtest + '.c') + verify_output_equal('mock_' + subtest) + end + end + + def test_ShouldGenerateARunnerByRunningRunnerWithOptions + sets = { 'run1' => { :plugins => [:cexception], :includes => ['one.h', 'two.h'], :enforce_strict_ordering => true }, + 'run2' => { :plugins => [:ignore], :suite_setup => "a_custom_setup();", :suite_teardown => "a_custom_teardown();" } + } + + sets.each_pair do |subtest, options| + UnityTestRunnerGenerator.new.run(TEST_FILE, OUT_FILE + subtest + '.c', options) + verify_output_equal(subtest) + UnityTestRunnerGenerator.new.run(TEST_MOCK, OUT_FILE + 'mock_' + subtest + '.c', options) + verify_output_equal('mock_' + subtest) + end + end + + def test_ShouldGenerateARunnerByPullingYamlOptions + subtest = 'yaml' + cmdstr = "ruby auto/generate_test_runner.rb test/testdata/sample.yml \"#{TEST_FILE}\" \"#{OUT_FILE + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal(subtest) + + cmdstr = "ruby auto/generate_test_runner.rb test/testdata/sample.yml \"#{TEST_MOCK}\" \"#{OUT_FILE + 'mock_' + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal('mock_' + subtest) + end + + def test_ShouldGenerateARunnerByPullingCommandlineOptions + subtest = 'cmd' + cmdstr = "ruby auto/generate_test_runner.rb -cexception \"#{TEST_FILE}\" \"#{OUT_FILE + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal(subtest) + + cmdstr = "ruby auto/generate_test_runner.rb -cexception \"#{TEST_MOCK}\" \"#{OUT_FILE + 'mock_' + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal('mock_' + subtest) + end + + def test_ShouldGenerateARunnerThatUsesParameterizedTests + sets = { 'param' => { :plugins => [:ignore], :use_param_tests => true } + } + + sets.each_pair do |subtest, options| + UnityTestRunnerGenerator.new(options).run(TEST_FILE, OUT_FILE + subtest + '.c') + verify_output_equal(subtest) + UnityTestRunnerGenerator.new(options).run(TEST_MOCK, OUT_FILE + 'mock_' + subtest + '.c') + verify_output_equal('mock_' + subtest) + end + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/mocksample.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/mocksample.c new file mode 100644 index 0000000..b709438 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/mocksample.c @@ -0,0 +1,51 @@ +// This is just a sample test file to be used to test the generator script +#ifndef TEST_SAMPLE_H +#define TEST_SAMPLE_H + +#include +#include "unity.h" +#include "funky.h" +#include "Mockstanky.h" + +void setUp(void) +{ + CustomSetupStuff(); +} + +void tearDown(void) +{ + CustomTeardownStuff +} + +//Yup, nice comment +void test_TheFirstThingToTest(void) +{ + TEST_ASSERT(1); + + TEST_ASSERT_TRUE(1); +} + +/* +void test_ShouldBeIgnored(void) +{ + DoesStuff(); +} +*/ + +//void test_ShouldAlsoNotBeTested(void) +//{ +// Call_An_Expect(); +// +// CallAFunction(); +// test_CallAFunctionThatLooksLikeATest(); +//} + +void test_TheSecondThingToTest(void) +{ + Call_An_Expect(); + + CallAFunction(); + test_CallAFunctionThatLooksLikeATest(); +} + +#endif //TEST_SAMPLE_H diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/sample.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/sample.yml new file mode 100644 index 0000000..9e5eece --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/sample.yml @@ -0,0 +1,9 @@ +:unity: + :includes: + - two.h + - three.h + - + :plugins: + - :cexception + :suite_setup: | + a_yaml_setup(); \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/testsample.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/testsample.c new file mode 100644 index 0000000..4f30ec7 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/testsample.c @@ -0,0 +1,51 @@ +// This is just a sample test file to be used to test the generator script +#ifndef TEST_SAMPLE_H +#define TEST_SAMPLE_H + +#include +#include "unity.h" +#include "funky.h" +#include "stanky.h" + +void setUp(void) +{ + CustomSetupStuff(); +} + +void tearDown(void) +{ + CustomTeardownStuff +} + +//Yup, nice comment +void test_TheFirstThingToTest(void) +{ + TEST_ASSERT(1); + + TEST_ASSERT_TRUE(1); +} + +/* +void test_ShouldBeIgnored(void) +{ + DoesStuff(); +} +*/ + +//void test_ShouldAlsoNotBeTested(void) +//{ +// Call_An_Expect(); +// +// CallAFunction(); +// test_CallAFunctionThatLooksLikeATest(); +//} + +void test_TheSecondThingToTest(void) +{ + Call_An_Expect(); + + CallAFunction(); + test_CallAFunctionThatLooksLikeATest(); +} + +#endif //TEST_SAMPLE_H diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testparameterized.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testparameterized.c new file mode 100644 index 0000000..037cd21 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testparameterized.c @@ -0,0 +1,101 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include +#include "unity.h" + +#define TEST_CASE(...) + +#define EXPECT_ABORT_BEGIN \ + if (TEST_PROTECT()) \ + { + +#define VERIFY_FAILS_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestFailed == 1) ? 0 : 1; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Failed But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +#define VERIFY_IGNORES_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestIgnored == 1) ? 0 : 1; \ + Unity.CurrentTestIgnored = 0; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Ignored But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +int SetToOneToFailInTearDown; +int SetToOneMeanWeAlreadyCheckedThisGuy; + +void setUp(void) +{ + SetToOneToFailInTearDown = 0; + SetToOneMeanWeAlreadyCheckedThisGuy = 0; +} + +void tearDown(void) +{ + if (SetToOneToFailInTearDown == 1) + TEST_FAIL_MESSAGE("<= Failed in tearDown"); + if ((SetToOneMeanWeAlreadyCheckedThisGuy == 0) && (Unity.CurrentTestFailed > 0)) + { + UnityPrint("[[[[ Previous Test Should Have Passed But Did Not ]]]]"); + UNITY_OUTPUT_CHAR('\n'); + } +} + +TEST_CASE(0) +TEST_CASE(44) +TEST_CASE((90)+9) +void test_TheseShouldAllPass(int Num) +{ + TEST_ASSERT_TRUE(Num < 100); +} + +TEST_CASE(3) +TEST_CASE(77) +TEST_CASE( (99) + 1 - (1)) +void test_TheseShouldAllFail(int Num) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(Num > 100); + VERIFY_FAILS_END +} + +TEST_CASE(1) +TEST_CASE(44) +TEST_CASE(99) +TEST_CASE(98) +void test_TheseAreEveryOther(int Num) +{ + if (Num & 1) + { + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(Num > 100); + VERIFY_FAILS_END + } + else + { + TEST_ASSERT_TRUE(Num < 100); + } +} + +void test_NormalPassesStillWork(void) +{ + TEST_ASSERT_TRUE(1); +} + +void test_NormalFailsStillWork(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(0); + VERIFY_FAILS_END +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testunity.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testunity.c new file mode 100644 index 0000000..9f826dc --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testunity.c @@ -0,0 +1,1510 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include +#include "unity.h" + +#define EXPECT_ABORT_BEGIN \ + if (TEST_PROTECT()) \ + { + +#define VERIFY_FAILS_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestFailed == 1) ? 0 : 1; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Failed But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +#define VERIFY_IGNORES_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestIgnored == 1) ? 0 : 1; \ + Unity.CurrentTestIgnored = 0; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Ignored But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +int SetToOneToFailInTearDown; +int SetToOneMeanWeAlreadyCheckedThisGuy; + +void setUp(void) +{ + SetToOneToFailInTearDown = 0; + SetToOneMeanWeAlreadyCheckedThisGuy = 0; +} + +void tearDown(void) +{ + if (SetToOneToFailInTearDown == 1) + TEST_FAIL_MESSAGE("<= Failed in tearDown"); + if ((SetToOneMeanWeAlreadyCheckedThisGuy == 0) && (Unity.CurrentTestFailed > 0)) + { + UnityPrint("[[[[ Previous Test Should Have Passed But Did Not ]]]]"); + UNITY_OUTPUT_CHAR('\n'); + } +} + +void testTrue(void) +{ + TEST_ASSERT(1); + + TEST_ASSERT_TRUE(1); +} + +void testFalse(void) +{ + TEST_ASSERT_FALSE(0); + + TEST_ASSERT_UNLESS(0); +} + +void testPreviousPass(void) +{ + TEST_ASSERT_EQUAL_INT(0U, Unity.TestFailures); +} + +void testNotVanilla(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT(0); + VERIFY_FAILS_END +} + +void testNotTrue(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(0); + VERIFY_FAILS_END +} + +void testNotFalse(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_FALSE(1); + VERIFY_FAILS_END +} + +void testNotUnless(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UNLESS(1); + VERIFY_FAILS_END +} + +void testNotNotEqual(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_NOT_EQUAL(10, 10); + VERIFY_FAILS_END +} + +void testFail(void) +{ + EXPECT_ABORT_BEGIN + TEST_FAIL_MESSAGE("Expected for testing"); + VERIFY_FAILS_END +} + +void testIsNull(void) +{ + char* ptr1 = NULL; + char* ptr2 = "hello"; + + TEST_ASSERT_NULL(ptr1); + TEST_ASSERT_NOT_NULL(ptr2); +} + +void testIsNullShouldFailIfNot(void) +{ + char* ptr1 = "hello"; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_NULL(ptr1); + VERIFY_FAILS_END +} + +void testNotNullShouldFailIfNULL(void) +{ + char* ptr1 = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_NOT_NULL(ptr1); + VERIFY_FAILS_END +} + +void testIgnore(void) +{ + EXPECT_ABORT_BEGIN + TEST_IGNORE(); + TEST_FAIL_MESSAGE("This should not be reached"); + VERIFY_IGNORES_END +} + +void testIgnoreMessage(void) +{ + EXPECT_ABORT_BEGIN + TEST_IGNORE_MESSAGE("This is an expected TEST_IGNORE_MESSAGE string!"); + TEST_FAIL_MESSAGE("This should not be reached"); + VERIFY_IGNORES_END +} + +void testNotEqualInts(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT(3982, 3983); + VERIFY_FAILS_END +} + +void testNotEqualInt8s(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT8(-127, -126); + VERIFY_FAILS_END +} + +void testNotEqualInt16s(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT16(-16383, -16382); + VERIFY_FAILS_END +} + +void testNotEqualInt32s(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT32(-2147483647, -2147483646); + VERIFY_FAILS_END +} + +void testNotEqualBits(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_BITS(0xFF00, 0x5555, 0x5A55); + VERIFY_FAILS_END +} + +void testNotEqualUInts(void) +{ + _UU16 v0, v1; + + v0 = 9000; + v1 = 9001; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualUInt8s(void) +{ + _UU8 v0, v1; + + v0 = 254; + v1 = 255; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT8(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualUInt16s(void) +{ + _UU16 v0, v1; + + v0 = 65535; + v1 = 65534; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualUInt32s(void) +{ + _UU32 v0, v1; + + v0 = 4294967295; + v1 = 4294967294; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT32(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex8s(void) +{ + _UU8 v0, v1; + + v0 = 0x23; + v1 = 0x22; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex8sIfSigned(void) +{ + _US8 v0, v1; + + v0 = -2; + v1 = 2; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex16s(void) +{ + _UU16 v0, v1; + + v0 = 0x1234; + v1 = 0x1235; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex16sIfSigned(void) +{ + _US16 v0, v1; + + v0 = -1024; + v1 = -1028; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex32s(void) +{ + _UU32 v0, v1; + + v0 = 900000; + v1 = 900001; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex32sIfSigned(void) +{ + _US32 v0, v1; + + v0 = -900000; + v1 = 900001; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32(v0, v1); + VERIFY_FAILS_END +} + +void testEqualInts(void) +{ + int v0, v1; + int *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(1837, 1837); + TEST_ASSERT_EQUAL_INT(-27365, -27365); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(19467, v1); + TEST_ASSERT_EQUAL_INT(v0, 19467); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 19467); +} + +void testEqualUints(void) +{ + unsigned int v0, v1; + unsigned int *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_UINT(1837, 1837); + TEST_ASSERT_EQUAL_UINT(v0, v1); + TEST_ASSERT_EQUAL_UINT(19467, v1); + TEST_ASSERT_EQUAL_UINT(v0, 19467); + TEST_ASSERT_EQUAL_UINT(*p0, v1); + TEST_ASSERT_EQUAL_UINT(*p0, *p1); + TEST_ASSERT_EQUAL_UINT(*p0, 19467); + TEST_ASSERT_EQUAL_UINT(60872u, 60872u); +} + +void testNotEqual(void) +{ + TEST_ASSERT_NOT_EQUAL(0, 1); + TEST_ASSERT_NOT_EQUAL(1, 0); + TEST_ASSERT_NOT_EQUAL(100, 101); + TEST_ASSERT_NOT_EQUAL(0, -1); + TEST_ASSERT_NOT_EQUAL(65535, -65535); + TEST_ASSERT_NOT_EQUAL(75, 900); + TEST_ASSERT_NOT_EQUAL(-100, -101); +} + +void testEqualHex8s(void) +{ + _UU8 v0, v1; + _UU8 *p0, *p1; + + v0 = 0x22; + v1 = 0x22; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX8(0x22, 0x22); + TEST_ASSERT_EQUAL_HEX8(v0, v1); + TEST_ASSERT_EQUAL_HEX8(0x22, v1); + TEST_ASSERT_EQUAL_HEX8(v0, 0x22); + TEST_ASSERT_EQUAL_HEX8(*p0, v1); + TEST_ASSERT_EQUAL_HEX8(*p0, *p1); + TEST_ASSERT_EQUAL_HEX8(*p0, 0x22); +} + +void testEqualHex8sNegatives(void) +{ + _UU8 v0, v1; + _UU8 *p0, *p1; + + v0 = 0xDD; + v1 = 0xDD; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX8(0xDD, 0xDD); + TEST_ASSERT_EQUAL_HEX8(v0, v1); + TEST_ASSERT_EQUAL_HEX8(0xDD, v1); + TEST_ASSERT_EQUAL_HEX8(v0, 0xDD); + TEST_ASSERT_EQUAL_HEX8(*p0, v1); + TEST_ASSERT_EQUAL_HEX8(*p0, *p1); + TEST_ASSERT_EQUAL_HEX8(*p0, 0xDD); +} + +void testEqualHex16s(void) +{ + _UU16 v0, v1; + _UU16 *p0, *p1; + + v0 = 0x9876; + v1 = 0x9876; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX16(0x9876, 0x9876); + TEST_ASSERT_EQUAL_HEX16(v0, v1); + TEST_ASSERT_EQUAL_HEX16(0x9876, v1); + TEST_ASSERT_EQUAL_HEX16(v0, 0x9876); + TEST_ASSERT_EQUAL_HEX16(*p0, v1); + TEST_ASSERT_EQUAL_HEX16(*p0, *p1); + TEST_ASSERT_EQUAL_HEX16(*p0, 0x9876); +} + +void testEqualHex32s(void) +{ + _UU32 v0, v1; + _UU32 *p0, *p1; + + v0 = 0x98765432ul; + v1 = 0x98765432ul; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX32(0x98765432ul, 0x98765432ul); + TEST_ASSERT_EQUAL_HEX32(v0, v1); + TEST_ASSERT_EQUAL_HEX32(0x98765432ul, v1); + TEST_ASSERT_EQUAL_HEX32(v0, 0x98765432ul); + TEST_ASSERT_EQUAL_HEX32(*p0, v1); + TEST_ASSERT_EQUAL_HEX32(*p0, *p1); + TEST_ASSERT_EQUAL_HEX32(*p0, 0x98765432ul); +} + +void testEqualBits(void) +{ + _UU32 v0 = 0xFF55AA00; + _UU32 v1 = 0x55550000; + + TEST_ASSERT_BITS(v1, v0, 0x55550000); + TEST_ASSERT_BITS(v1, v0, 0xFF55CC00); + TEST_ASSERT_BITS(0xFFFFFFFF, v0, 0xFF55AA00); + TEST_ASSERT_BITS(0xFFFFFFFF, v0, v0); + TEST_ASSERT_BITS(0xF0F0F0F0, v0, 0xFC5DAE0F); + TEST_ASSERT_BITS_HIGH(v1, v0); + TEST_ASSERT_BITS_LOW(0x000055FF, v0); + TEST_ASSERT_BIT_HIGH(30, v0); + TEST_ASSERT_BIT_LOW(5, v0); +} + +void testEqualShorts(void) +{ + short v0, v1; + short *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(1837, 1837); + TEST_ASSERT_EQUAL_INT(-2987, -2987); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(19467, v1); + TEST_ASSERT_EQUAL_INT(v0, 19467); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 19467); +} + +void testEqualUShorts(void) +{ + unsigned short v0, v1; + unsigned short *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_UINT(1837, 1837); + TEST_ASSERT_EQUAL_UINT(2987, 2987); + TEST_ASSERT_EQUAL_UINT(v0, v1); + TEST_ASSERT_EQUAL_UINT(19467, v1); + TEST_ASSERT_EQUAL_UINT(v0, 19467); + TEST_ASSERT_EQUAL_UINT(*p0, v1); + TEST_ASSERT_EQUAL_UINT(*p0, *p1); + TEST_ASSERT_EQUAL_UINT(*p0, 19467); +} + +void testEqualChars(void) +{ + signed char v0, v1; + signed char *p0, *p1; + + v0 = 109; + v1 = 109; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(42, 42); + TEST_ASSERT_EQUAL_INT(-116, -116); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(109, v1); + TEST_ASSERT_EQUAL_INT(v0, 109); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 109); +} + +void testEqualUChars(void) +{ + unsigned char v0, v1; + unsigned char *p0, *p1; + + v0 = 251; + v1 = 251; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(42, 42); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(251, v1); + TEST_ASSERT_EQUAL_INT(v0, 251); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 251); +} + +void testEqualPointers(void) +{ + int v0, v1; + int *p0, *p1, *p2; + + v0 = 19467; + v1 = 18271; + p0 = &v0; + p1 = &v1; + p2 = &v1; + + TEST_ASSERT_EQUAL_PTR(p0, &v0); + TEST_ASSERT_EQUAL_PTR(&v1, p1); + TEST_ASSERT_EQUAL_PTR(p2, p1); + TEST_ASSERT_EQUAL_PTR(&v0, &v0); +} + +void testNotEqualPointers(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_PTR(0x12345678, 0x12345677); + VERIFY_FAILS_END +} + +void testIntsWithinDelta(void) +{ + TEST_ASSERT_INT_WITHIN(1, 5000, 5001); + TEST_ASSERT_INT_WITHIN(5, 5000, 4996); + TEST_ASSERT_INT_WITHIN(5, 5000, 5005); + TEST_ASSERT_INT_WITHIN(500, 50, -440); + + TEST_ASSERT_INT_WITHIN(2, -1, -1); + TEST_ASSERT_INT_WITHIN(5, 1, -1); + TEST_ASSERT_INT_WITHIN(5, -1, 1); +} + +void testIntsNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_INT_WITHIN(5, 5000, 5006); + VERIFY_FAILS_END +} + +void testUIntsWithinDelta(void) +{ + TEST_ASSERT_UINT_WITHIN(1, 5000, 5001); + TEST_ASSERT_UINT_WITHIN(5, 5000, 4996); + TEST_ASSERT_UINT_WITHIN(5, 5000, 5005); +} + +void testUIntsNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UINT_WITHIN(1, 2147483647u, 2147483649u); + VERIFY_FAILS_END +} + +void testUIntsNotWithinDeltaEvenThoughASignedIntWouldPassSmallFirst(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UINT_WITHIN(5, 1, -1); + VERIFY_FAILS_END +} + +void testUIntsNotWithinDeltaEvenThoughASignedIntWouldPassBigFirst(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UINT_WITHIN(5, -1, 1); + VERIFY_FAILS_END +} + +void testHEX32sWithinDelta(void) +{ + TEST_ASSERT_HEX32_WITHIN(1, 5000, 5001); + TEST_ASSERT_HEX32_WITHIN(5, 5000, 4996); + TEST_ASSERT_HEX32_WITHIN(5, 5000, 5005); +} + +void testHEX32sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX32_WITHIN(1, 2147483647u, 2147483649u); + VERIFY_FAILS_END +} + +void testHEX32sNotWithinDeltaEvenThoughASignedIntWouldPass(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX32_WITHIN(5, 1, -1); + VERIFY_FAILS_END +} + +void testHEX16sWithinDelta(void) +{ + TEST_ASSERT_HEX16_WITHIN(1, 5000, 5001); + TEST_ASSERT_HEX16_WITHIN(5, 5000, 4996); + TEST_ASSERT_HEX16_WITHIN(5, 5000, 5005); +} + +void testHEX16sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX16_WITHIN(2, 65535, 0); + VERIFY_FAILS_END +} + +void testHEX8sWithinDelta(void) +{ + TEST_ASSERT_HEX8_WITHIN(1, 254, 255); + TEST_ASSERT_HEX8_WITHIN(5, 251, 255); + TEST_ASSERT_HEX8_WITHIN(5, 1, 4); +} + +void testHEX8sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX8_WITHIN(2, 255, 0); + VERIFY_FAILS_END +} + +void testEqualStrings(void) +{ + const char *testString = "foo"; + + TEST_ASSERT_EQUAL_STRING(testString, testString); + TEST_ASSERT_EQUAL_STRING("foo", "foo"); + TEST_ASSERT_EQUAL_STRING("foo", testString); + TEST_ASSERT_EQUAL_STRING(testString, "foo"); + TEST_ASSERT_EQUAL_STRING("", ""); +} + +void testEqualStringsWithCarriageReturnsAndLineFeeds(void) +{ + const char *testString = "foo\r\nbar"; + + TEST_ASSERT_EQUAL_STRING(testString, testString); + TEST_ASSERT_EQUAL_STRING("foo\r\nbar", "foo\r\nbar"); + TEST_ASSERT_EQUAL_STRING("foo\r\nbar", testString); + TEST_ASSERT_EQUAL_STRING(testString, "foo\r\nbar"); + TEST_ASSERT_EQUAL_STRING("", ""); +} + +void testNotEqualString1(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("foo", "bar"); + VERIFY_FAILS_END +} + +void testNotEqualString2(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("foo", ""); + VERIFY_FAILS_END +} + +void testNotEqualString3(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("", "bar"); + VERIFY_FAILS_END +} + +void testNotEqualString4(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("bar\r", "bar\n"); + VERIFY_FAILS_END +} + +void testNotEqualString5(void) +{ + const char str1[] = { 0x41, 0x42, 0x03, 0x00 }; + const char str2[] = { 0x41, 0x42, 0x04, 0x00 }; + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING(str1, str2); + VERIFY_FAILS_END +} + +void testNotEqualString_ExpectedStringIsNull(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING(NULL, "bar"); + VERIFY_FAILS_END +} + +void testNotEqualString_ActualStringIsNull(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("foo", NULL); + VERIFY_FAILS_END +} + +void testEqualStringArrays(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, expStrings, 3); + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 3); + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 2); + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 1); +} + +void testNotEqualStringArray1(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray2(void) +{ + const char *testStrings[] = { "zoo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", "boo", "woo", "moo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray3(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", NULL }; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray4(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", NULL, "woo", "moo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray5(void) +{ + const char **testStrings = NULL; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray6(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "zoo" }; + const char **expStrings = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testEqualStringArrayIfBothNulls(void) +{ + const char **testStrings = NULL; + const char **expStrings = NULL; + + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); +} + +void testEqualMemory(void) +{ + const char *testString = "whatever"; + + TEST_ASSERT_EQUAL_MEMORY(testString, testString, 8); + TEST_ASSERT_EQUAL_MEMORY("whatever", "whatever", 8); + TEST_ASSERT_EQUAL_MEMORY("whatever", testString, 8); + TEST_ASSERT_EQUAL_MEMORY(testString, "whatever", 8); + TEST_ASSERT_EQUAL_MEMORY(testString, "whatever", 2); + TEST_ASSERT_EQUAL_MEMORY(NULL, NULL, 1); +} + +void testNotEqualMemory1(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY("foo", "bar", 3); + VERIFY_FAILS_END +} + +void testNotEqualMemory2(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY("fool", "food", 4); + VERIFY_FAILS_END +} + +void testNotEqualMemory3(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY(NULL, "food", 4); + VERIFY_FAILS_END +} + +void testNotEqualMemory4(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY("fool", NULL, 4); + VERIFY_FAILS_END +} + +void testEqualIntArrays(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, -2}; + int p2[] = {1, 8, 987, 2}; + int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p3, 1); +} + +void testNotEqualIntArraysNullExpected(void) +{ + int* p0 = NULL; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArraysNullActual(void) +{ + int* p1 = NULL; + int p0[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArrays1(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArrays2(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {2, 8, 987, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArrays3(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 986, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualInt8Arrays(void) +{ + _US8 p0[] = {1, 8, 117, -2}; + _US8 p1[] = {1, 8, 117, -2}; + _US8 p2[] = {1, 8, 117, 2}; + _US8 p3[] = {1, 50, 60, 70}; + + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p3, 1); +} + +void testNotEqualInt8Arrays(void) +{ + _US8 p0[] = {1, 8, 127, -2}; + _US8 p1[] = {1, 8, 127, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualUIntArrays(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65132u}; + unsigned int p2[] = {1, 8, 987, 2}; + unsigned int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p3, 1); +} + +void testNotEqualUIntArrays1(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUIntArrays2(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUIntArrays3(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualInt16Arrays(void) +{ + _UU16 p0[] = {1, 8, 117, 3}; + _UU16 p1[] = {1, 8, 117, 3}; + _UU16 p2[] = {1, 8, 117, 2}; + _UU16 p3[] = {1, 50, 60, 70}; + + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p3, 1); +} + +void testNotEqualInt16Arrays(void) +{ + _UU16 p0[] = {1, 8, 127, 3}; + _UU16 p1[] = {1, 8, 127, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualUINT16Arrays(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65132u}; + unsigned short p2[] = {1, 8, 987, 2}; + unsigned short p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p3, 1); +} + +void testNotEqualUINT16Arrays1(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUINT16Arrays2(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUINT16Arrays3(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualHEXArrays(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65132u}; + unsigned int p2[] = {1, 8, 987, 2}; + unsigned int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p3, 1); +} + +void testNotEqualHEXArrays1(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEXArrays2(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEXArrays3(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualHEX16Arrays(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65132u}; + unsigned short p2[] = {1, 8, 987, 2}; + unsigned short p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p3, 1); +} + +void testNotEqualHEX16Arrays1(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX16Arrays2(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX16Arrays3(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualHEX8Arrays(void) +{ + unsigned short p0[] = {1, 8, 254u, 123}; + unsigned short p1[] = {1, 8, 254u, 123}; + unsigned short p2[] = {1, 8, 254u, 2}; + unsigned short p3[] = {1, 23, 25, 26}; + + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p3, 1); +} + +void testNotEqualHEX8Arrays1(void) +{ + unsigned char p0[] = {1, 8, 254u, 253u}; + unsigned char p1[] = {1, 8, 254u, 252u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX8Arrays2(void) +{ + unsigned char p0[] = {1, 8, 254u, 253u}; + unsigned char p1[] = {2, 8, 254u, 253u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX8Arrays3(void) +{ + unsigned char p0[] = {1, 8, 254u, 253u}; + unsigned char p1[] = {1, 8, 255u, 253u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualMemoryArrays(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, -2}; + int p2[] = {1, 8, 987, 2}; + int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p0, 4, 1); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p0, 4, 4); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p2, 4, 3); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p3, 4, 1); +} + +void testNotEqualMemoryArraysExpectedNull(void) +{ + int* p0 = NULL; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArraysActualNull(void) +{ + int p0[] = {1, 8, 987, -2}; + int* p1 = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArrays1(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArrays2(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {2, 8, 987, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArrays3(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 986, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testProtection(void) +{ + volatile int mask = 0; + + if (TEST_PROTECT()) + { + mask |= 1; + TEST_ABORT(); + } + else + { + Unity.CurrentTestFailed = 0; + mask |= 2; + } + + TEST_ASSERT_EQUAL(3, mask); +} + +void testIgnoredAndThenFailInTearDown(void) +{ + SetToOneToFailInTearDown = 1; + TEST_IGNORE(); +} + +// ===================== THESE TEST WILL RUN IF YOUR CONFIG INCLUDES 64 BIT SUPPORT ================== +#ifdef UNITY_SUPPORT_64 + +void testEqualHex64s(void) +{ + _UU64 v0, v1; + _UU64 *p0, *p1; + + v0 = 0x9876543201234567; + v1 = 0x9876543201234567; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX64(0x9876543201234567, 0x9876543201234567); + TEST_ASSERT_EQUAL_HEX64(v0, v1); + TEST_ASSERT_EQUAL_HEX64(0x9876543201234567, v1); + TEST_ASSERT_EQUAL_HEX64(v0, 0x9876543201234567); + TEST_ASSERT_EQUAL_HEX64(*p0, v1); + TEST_ASSERT_EQUAL_HEX64(*p0, *p1); + TEST_ASSERT_EQUAL_HEX64(*p0, 0x9876543201234567); +} + +void testNotEqualHex64s(void) +{ + _UU64 v0, v1; + + v0 = 9000000000; + v1 = 9100000000; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex64sIfSigned(void) +{ + _US64 v0, v1; + + v0 = -9000000000; + v1 = 9000000000; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64(v0, v1); + VERIFY_FAILS_END +} + +void testHEX64sWithinDelta(void) +{ + TEST_ASSERT_HEX64_WITHIN(1, 0x7FFFFFFFFFFFFFFF,0x7FFFFFFFFFFFFFFE); + TEST_ASSERT_HEX64_WITHIN(5, 5000, 4996); + TEST_ASSERT_HEX64_WITHIN(5, 5000, 5005); +} + +void testHEX64sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX64_WITHIN(1, 0x7FFFFFFFFFFFFFFF, 0x7FFFFFFFFFFFFFFC); + VERIFY_FAILS_END +} + +void testHEX64sNotWithinDeltaEvenThoughASignedIntWouldPass(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX64_WITHIN(5, 1, -1); + VERIFY_FAILS_END +} + +void testEqualHEX64Arrays(void) +{ + _UU64 p0[] = {1, 8, 987, 65132u}; + _UU64 p1[] = {1, 8, 987, 65132u}; + _UU64 p2[] = {1, 8, 987, 2}; + _UU64 p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p3, 1); +} + +void testNotEqualHEX64Arrays1(void) +{ + _UU64 p0[] = {1, 8, 987, 65132u}; + _UU64 p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX64Arrays2(void) +{ + _UU64 p0[] = {1, 8, 987, 65132u}; + _UU64 p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +#endif //64-bit SUPPORT + +// ===================== THESE TEST WILL RUN IF YOUR CONFIG INCLUDES FLOAT SUPPORT ================== +#ifndef UNITY_EXCLUDE_FLOAT + +void testFloatsWithinDelta(void) +{ + TEST_ASSERT_FLOAT_WITHIN(0.00003f, 187245.03485f, 187245.03488f); + TEST_ASSERT_FLOAT_WITHIN(1.0f, 187245.0f, 187246.0f); + TEST_ASSERT_FLOAT_WITHIN(0.05f, 9273.2549f, 9273.2049f); + TEST_ASSERT_FLOAT_WITHIN(0.007f, -726.93724f, -726.94424f); +} + +void testFloatsNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_FLOAT_WITHIN(0.05f, 9273.2649f, 9273.2049f); + VERIFY_FAILS_END +} + +void testFloatsEqual(void) +{ + TEST_ASSERT_EQUAL_FLOAT(187245.0f, 187246.0f); + TEST_ASSERT_EQUAL_FLOAT(18724.5f, 18724.6f); + TEST_ASSERT_EQUAL_FLOAT(9273.2549f, 9273.2599f); + TEST_ASSERT_EQUAL_FLOAT(-726.93724f, -726.9374f); +} + +void testFloatsNotEqual(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT(9273.9649f, 9273.0049f); + VERIFY_FAILS_END +} + +void testFloatsNotEqualNegative1(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT(-9273.9649f, -9273.0049f); + VERIFY_FAILS_END +} + +void testFloatsNotEqualNegative2(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT(-9273.0049f, -9273.9649f); + VERIFY_FAILS_END +} + +void testEqualFloatArrays(void) +{ + float p0[] = {1.0, -8.0, 25.4, -0.123}; + float p1[] = {1.0, -8.0, 25.4, -0.123}; + float p2[] = {1.0, -8.0, 25.4, -0.2}; + float p3[] = {1.0, -23.0, 25.0, -0.26}; + + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p3, 1); +} + +void testNotEqualFloatArraysExpectedNull(void) +{ + float* p0 = NULL; + float p1[] = {1.0, 8.0, 25.4, 0.252}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysActualNull(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float* p1 = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArrays1(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float p1[] = {1.0, 8.0, 25.4, 0.252}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArrays2(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float p1[] = {2.0, 8.0, 25.4, 0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArrays3(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float p1[] = {1.0, 8.0, 25.5, 0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysNegative1(void) +{ + float p0[] = {-1.0, -8.0, -25.4, -0.253}; + float p1[] = {-1.0, -8.0, -25.4, -0.252}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysNegative2(void) +{ + float p0[] = {-1.0, -8.0, -25.4, -0.253}; + float p1[] = {-2.0, -8.0, -25.4, -0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysNegative3(void) +{ + float p0[] = {-1.0, -8.0, -25.4, -0.253}; + float p1[] = {-1.0, -8.0, -25.5, -0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +#endif //FLOAT SUPPORT diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/CHANGES b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/CHANGES new file mode 100644 index 0000000..4b5184c --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/CHANGES @@ -0,0 +1,78 @@ +Hardmock 1.3.7 + +* BUG FIX: expects! could not setup expectations for more than one concrete method on an object, since the method aliasing and rewriting was only taking place when the background mock instance was first created. This logic has been updated and now you can do all the things you'd expect. + +Hardmock 1.3.6 + +* BUG FIX: In Rails apps (and others) Hardmock and Fixtures battled viciously over "setup" and "teardown" and "method_added" (and any other clever test enhancement tool, namely Mocha) causing unpredictable results, notably failure to auto-verify mocks after teardown (leading to false positive tests). + * The newly-added TestUnitBeforeAfter provides TestCase.before_setup and TestCase.after_teardown -- formal test wrapping hooks -- lets Hardmock provide its preparation and auto-verify behavior without contending for setup/teardown supremacy. + +Hardmock 1.3.5 + +* Aliased should_receive => expects and and_return => returns for easier transition from rspec mock and flexmock users. + +Hardmock 1.3.4 + +* Prevents accidental stubbing and mocking on NilClasses + +Hardmock 1.3.3 + +* stubs! and expects! no longer require that their target methods exist in reality (this used to prevent you from stubbing methods that "exist" by virtue of "method_missing" +* Tweaked inner metaclass code to avoid collisions with rspec's "metaid" stuff +* Moved this project's Rake tasks into rake_tasks... otherwise Rails will load them, if Hardmock is installed as a Rails plugin +* Alias added: 'verify_hardmocks' is now an alias for 'verify_mocks' (some internal projects were using this modified method name as a means of cooexisting with mocha) + +Hardmock 1.3.2 + +November 2007 + +* adds 'with' as an alternate syntax for specifying argument expectations. + +Hardmock 1.3.1 + +October 2007 + +* Can use stubs! on a mock object +* expects! now generates mocked methods that can safely transfer runtime blocks to the mock instance itself +* No longer need to call "prepare_hardmock_control" when using stubs in the absence of mocks +* Stubs of concrete class or instance methods are restored to original state in teardown + +Hardmock 1.3.0 + +October 2007 + +* Adds stubs! and expects! method to all objects and classes to support concrete stubbing/mocking. + +Hardmock 1.2.3 + +Sat Apr 28 01:16:15 EDT 2007 + +* Re-release of 1.2.2 (which was canceled)... tasks moved to lib/tasks + +Hardmock 1.2.2 + +Sat Apr 28 00:41:30 EDT 2007 + +* assert_error has been broken out into its own lib file +* Gem package can now run all tests successfully +* Internal code refactoring; a number of classes that were defined in hardmock.rb are now in their own files + +Hardmock 1.2.1 + +Sat Apr 28 00:41:30 EDT 2007 + +* (botched release, see 1.2.2) + +Hardmock 1.2.0 + +* You can now use "expect" in place of "expects" if you must. +* "inspect" has been added to the list of methods NOT erased by MethodCleanout. + +Hardmock 1.1.0 + +* "expects" replaces "expect" ("expect" now raises Hardmock::DeprecationError) +* "verify_mocks" is now implicit in teardown, you needn't call it anymore +* Mocking methods that Mock would otherwise inherit from Object (eg, to_s) is now possible +* require 'hardmock' is all that's required to use the library now; no need to include in TestCase + +(previously called CMock, translated to Hardmock on 2006-12-10) diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/LICENSE b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/LICENSE new file mode 100644 index 0000000..396211e --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/LICENSE @@ -0,0 +1,7 @@ +Copyright (c) 2006,2007 David Crosby at Atomic Object, LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/README b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/README new file mode 100644 index 0000000..4650a2a --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/README @@ -0,0 +1,70 @@ +== Hardmock + +Strict, ordered mock objects using very lightweight syntax in your tests. + +== How + +The basic procedure for using Hardmock in your tests is: + +* require 'hardmock' (this happens automatically when being used as a Rails plugin) +* Create some mocks +* Setup some expectations +* Execute the target code +* Verification of calls is automatic in =teardown= + +The expectations you set when using mocks are strict and ordered. +Expectations you declare by creating and using mocks are all considered together. + +* Hardmock::Mock#expects will show you more examples +* Hardmock::SimpleExpectation will teach you more about expectation methods + +== Example + + create_mocks :garage, :car + + # Set some expectations + @garage.expects.open_door + @car.expects.start(:choke) + @car.expects.drive(:reverse, 5.mph) + + # Execute the code (this code is usually, obviously, in your class under test) + @garage.open_door + @car.start :choke + @car.drive :reverse, 5.mph + + verify_mocks # OPTIONAL, teardown will do this for you + +Expects @garage.open_door, @car.start(:choke) and @car.drive(:reverse, 5.mph) to be called in that order, with those specific arguments. +* Violations of expectations, such as mis-ordered calls, calls on wrong objects, or incorrect methods result in Hardmock::ExpectationError +* verify_mocks will raise VerifyError if not all expectations have been met. + +== Download and Install + +* Homepage: http://hardmock.rubyforge.org +* GEM or TGZ or ZIP: http://rubyforge.org/frs/?group_id=2742 +* Rails plugin: script/plugin install +* SVN access: svn co svn://rubyforge.org/var/svn/hardmock/trunk +* Developer SVN access: svn co svn://developername@rubyforge.org/var/svn/hardmock/trunk + +== Setup for Test::Unit + + require 'hardmock' + require 'assert_error' # OPTIONAL: this adds the TestUnit extension 'assert_error' + +NOTE: If installed as a Rails plugin, init.rb does this for you... nothing else is needed. + +== Setup for RSpec + +Get this into your spec helper or environment or Rakefile or wherever you prefer: + + Spec::Runner.configure do |configuration| + configuration.include Hardmock + configuration.after(:each) {verify_mocks} + end + +This puts the implicit conveniences into your spec context, like "create_mocks" etc, and also provides for automatic +"verify_mocks" after each Example is run. + +== Author +* David Crosby crosby at http://atomicobject.com +* (c) 2006,2007 Atomic Object LLC diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/Rakefile b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/Rakefile new file mode 100644 index 0000000..aff126c --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/Rakefile @@ -0,0 +1,8 @@ +require 'rake' +require 'rubygems' + +HARDMOCK_VERSION = "1.3.7" + +Dir["rake_tasks/*.rake"].each { |f| load f } + +task :default => [ 'test:all' ] diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/config/environment.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/config/environment.rb new file mode 100644 index 0000000..a15e598 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/config/environment.rb @@ -0,0 +1,12 @@ +# The path to the root directory of your application. +APP_ROOT = File.join(File.dirname(__FILE__), '..') + +ADDITIONAL_LOAD_PATHS = [] +ADDITIONAL_LOAD_PATHS.concat %w( + lib +).map { |dir| "#{APP_ROOT}/#{dir}" }.select { |dir| File.directory?(dir) } + +# Prepend to $LOAD_PATH +ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) } + +# Require any additional libraries needed diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/lib/assert_error.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/lib/assert_error.rb new file mode 100644 index 0000000..6da61de --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/lib/assert_error.rb @@ -0,0 +1,23 @@ +require 'test/unit/assertions' + +module Test::Unit #:nodoc:# + module Assertions #:nodoc:# + # A better 'assert_raise'. +patterns+ can be one or more Regexps, or a literal String that + # must match the entire error message. + def assert_error(err_type,*patterns,&block) + assert_not_nil block, "assert_error requires a block" + assert((err_type and err_type.kind_of?(Class)), "First argument to assert_error has to be an error type") + err = assert_raise(err_type) do + block.call + end + patterns.each do |pattern| + case pattern + when Regexp + assert_match(pattern, err.message) + else + assert_equal pattern, err.message + end + end + end + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/lib/extend_test_unit.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/lib/extend_test_unit.rb new file mode 100644 index 0000000..3d7ef9d --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/lib/extend_test_unit.rb @@ -0,0 +1,14 @@ + +require 'test/unit/testcase' +class Test::Unit::TestCase + include Hardmock +end + +require 'test_unit_before_after' +Test::Unit::TestCase.before_setup do |test| + test.prepare_hardmock_control +end + +Test::Unit::TestCase.after_teardown do |test| + test.verify_mocks +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock.rb new file mode 100644 index 0000000..50f9a94 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock.rb @@ -0,0 +1,86 @@ +require 'hardmock/method_cleanout' +require 'hardmock/mock' +require 'hardmock/mock_control' +require 'hardmock/utils' +require 'hardmock/errors' +require 'hardmock/trapper' +require 'hardmock/expector' +require 'hardmock/expectation' +require 'hardmock/expectation_builder' +require 'hardmock/stubbing' + +module Hardmock + + # Create one or more new Mock instances in your test suite. + # Once created, the Mocks are accessible as instance variables in your test. + # Newly built Mocks are added to the full set of Mocks for this test, which will + # be verified when you call verify_mocks. + # + # create_mocks :donkey, :cat # Your test now has @donkey and @cat + # create_mock :dog # Test now has @donkey, @cat and @dog + # + # The first call returned a hash { :donkey => @donkey, :cat => @cat } + # and the second call returned { :dog => @dog } + # + # For more info on how to use your mocks, see Mock and Expectation + # + def create_mocks(*mock_names) + prepare_hardmock_control unless @main_mock_control + + mocks = {} + mock_names.each do |mock_name| + raise ArgumentError, "'nil' is not a valid name for a mock" if mock_name.nil? + mock_name = mock_name.to_s + mock_object = Mock.new(mock_name, @main_mock_control) + mocks[mock_name.to_sym] = mock_object + self.instance_variable_set "@#{mock_name}", mock_object + end + @all_mocks ||= {} + @all_mocks.merge! mocks + + return mocks.clone + end + + def prepare_hardmock_control + if @main_mock_control.nil? + @main_mock_control = MockControl.new + $main_mock_control = @main_mock_control + else + raise "@main_mock_control is already setup for this test!" + end + end + + alias :create_mock :create_mocks + + # Ensures that all expectations have been met. If not, VerifyException is + # raised. + # + # You normally won't need to call this yourself. Within Test::Unit::TestCase, this will be done automatically at teardown time. + # + # * +force+ -- if +false+, and a VerifyError or ExpectationError has already occurred, this method will not raise. This is to help you suppress repeated errors when if you're calling #verify_mocks in the teardown method of your test suite. BE WARNED - only use this if you're sure you aren't obscuring useful information. Eg, if your code handles exceptions internally, and an ExpectationError gets gobbled up by your +rescue+ block, the cause of failure for your test may be hidden from you. For this reason, #verify_mocks defaults to force=true as of Hardmock 1.0.1 + def verify_mocks(force=true) + return unless @main_mock_control + return if @main_mock_control.disappointed? and !force + @main_mock_control.verify + ensure + @main_mock_control.clear_expectations if @main_mock_control + $main_mock_control = nil + reset_stubs + end + + alias :verify_hardmocks :verify_mocks + + # Purge the main MockControl of all expectations, restore all concrete stubbed/mocked methods + def clear_expectations + @main_mock_control.clear_expectations if @main_mock_control + reset_stubs + $main_mock_control = nil + end + + def reset_stubs + Hardmock.restore_all_replaced_methods + end + +end + +require 'extend_test_unit' diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/errors.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/errors.rb new file mode 100644 index 0000000..48698a6 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/errors.rb @@ -0,0 +1,22 @@ +module Hardmock + # Raised when: + # * Unexpected method is called on a mock object + # * Bad arguments passed to an expected call + class ExpectationError < StandardError #:nodoc:# + end + + # Raised for methods that should no longer be called. Hopefully, the exception message contains helpful alternatives. + class DeprecationError < StandardError #:nodoc:# + end + + # Raised when stubbing fails + class StubbingError < StandardError #:nodoc:# + end + + # Raised when it is discovered that an expected method call was never made. + class VerifyError < StandardError #:nodoc:# + def initialize(msg,unmet_expectations) + super("#{msg}:" + unmet_expectations.map { |ex| "\n * #{ex.to_s}" }.join) + end + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/expectation.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/expectation.rb new file mode 100644 index 0000000..4d1db92 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/expectation.rb @@ -0,0 +1,229 @@ +require 'hardmock/utils' + +module Hardmock + class Expectation + include Utils + attr_reader :block_value + + def initialize(options) #:nodoc: + @options = options + end + + def apply_method_call(mock,mname,args,block) #:nodoc: + unless @options[:mock].equal?(mock) + raise anger("Wrong object", mock,mname,args) + end + unless @options[:method] == mname + raise anger("Wrong method",mock,mname,args) + end + + # Tester-defined block to invoke at method-call-time: + expectation_block = @options[:block] + + expected_args = @options[:arguments] + # if we have a block, we can skip the argument check if none were specified + unless (expected_args.nil? || expected_args.empty?) && expectation_block && !@options[:suppress_arguments_to_block] + unless expected_args == args + raise anger("Wrong arguments",mock,mname,args) + end + end + + relayed_args = args.dup + if block + if expectation_block.nil? + # Can't handle a runtime block without an expectation block + raise ExpectationError.new("Unexpected block provided to #{to_s}") + else + # Runtime blocks are passed as final argument to the expectation block + unless @options[:suppress_arguments_to_block] + relayed_args << block + else + # Arguments suppressed; send only the block + relayed_args = [block] + end + end + end + + # Run the expectation block: + @block_value = expectation_block.call(*relayed_args) if expectation_block + + raise @options[:raises] unless @options[:raises].nil? + + return_value = @options[:returns] + if return_value.nil? + return @block_value + else + return return_value + end + end + + # Set the return value for an expected method call. + # Eg, + # @cash_machine.expects.withdraw(20,:dollars).returns(20.00) + def returns(val) + @options[:returns] = val + self + end + alias_method :and_return, :returns + + # Set the arguments for an expected method call. + # Eg, + # @cash_machine.expects.deposit.with(20, "dollars").returns(:balance => "20") + def with(*args) + @options[:arguments] = args + self + end + + # Rig an expected method to raise an exception when the mock is invoked. + # + # Eg, + # @cash_machine.expects.withdraw(20,:dollars).raises "Insufficient funds" + # + # The argument can be: + # * an Exception -- will be used directly + # * a String -- will be used as the message for a RuntimeError + # * nothing -- RuntimeError.new("An Error") will be raised + def raises(err=nil) + case err + when Exception + @options[:raises] = err + when String + @options[:raises] = RuntimeError.new(err) + else + @options[:raises] = RuntimeError.new("An Error") + end + self + end + + # Convenience method: assumes +block_value+ is set, and is set to a Proc + # (or anything that responds to 'call') + # + # light_event = @traffic_light.trap.subscribe(:light_changes) + # + # # This code will meet the expectation: + # @traffic_light.subscribe :light_changes do |color| + # puts color + # end + # + # The color-handling block is now stored in light_event.block_value + # + # The block can be invoked like this: + # + # light_event.trigger :red + # + # See Mock#trap and Mock#expects for information on using expectation objects + # after they are set. + # + def trigger(*block_arguments) + unless block_value + raise ExpectationError.new("No block value is currently set for expectation #{to_s}") + end + unless block_value.respond_to?(:call) + raise ExpectationError.new("Can't apply trigger to #{block_value} for expectation #{to_s}") + end + block_value.call *block_arguments + end + + # Used when an expected method accepts a block at runtime. + # When the expected method is invoked, the block passed to + # that method will be invoked as well. + # + # NOTE: ExpectationError will be thrown upon running the expected method + # if the arguments you set up in +yields+ do not properly match up with + # the actual block that ends up getting passed. + # + # == Examples + # Single invocation: The block passed to +lock_down+ gets invoked + # once with no arguments: + # + # @safe_zone.expects.lock_down.yields + # + # # (works on code that looks like:) + # @safe_zone.lock_down do + # # ... this block invoked once + # end + # + # Multi-parameter blocks: The block passed to +each_item+ gets + # invoked twice, with :item1 the first time, and with + # :item2 the second time: + # + # @fruit_basket.expects.each_with_index.yields [:apple,1], [:orange,2] + # + # # (works on code that looks like:) + # @fruit_basket.each_with_index do |fruit,index| + # # ... this block invoked with fruit=:apple, index=1, + # # ... and then with fruit=:orange, index=2 + # end + # + # Arrays can be passed as arguments too... if the block + # takes a single argument and you want to pass a series of arrays into it, + # that will work as well: + # + # @list_provider.expects.each_list.yields [1,2,3], [4,5,6] + # + # # (works on code that looks like:) + # @list_provider.each_list do |list| + # # ... list is [1,2,3] the first time + # # ... list is [4,5,6] the second time + # end + # + # Return value: You can set the return value for the method that + # accepts the block like so: + # + # @cruncher.expects.do_things.yields(:bean1,:bean2).returns("The Results") + # + # Raising errors: You can set the raised exception for the method that + # accepts the block. NOTE: the error will be raised _after_ the block has + # been invoked. + # + # # :bean1 and :bean2 will be passed to the block, then an error is raised: + # @cruncher.expects.do_things.yields(:bean1,:bean2).raises("Too crunchy") + # + def yields(*items) + @options[:suppress_arguments_to_block] = true + if items.empty? + # Yield once + @options[:block] = lambda do |block| + if block.arity != 0 and block.arity != -1 + raise ExpectationError.new("The given block was expected to have no parameter count; instead, got #{block.arity} to <#{to_s}>") + end + block.call + end + else + # Yield one or more specific items + @options[:block] = lambda do |block| + items.each do |item| + if item.kind_of?(Array) + if block.arity == item.size + # Unfold the array into the block's arguments: + block.call *item + elsif block.arity == 1 + # Just pass the array in + block.call item + else + # Size mismatch + raise ExpectationError.new("Can't pass #{item.inspect} to block with arity #{block.arity} to <#{to_s}>") + end + else + if block.arity != 1 + # Size mismatch + raise ExpectationError.new("Can't pass #{item.inspect} to block with arity #{block.arity} to <#{to_s}>") + end + block.call item + end + end + end + end + self + end + + def to_s # :nodoc: + format_method_call_string(@options[:mock],@options[:method],@options[:arguments]) + end + + private + def anger(msg, mock,mname,args) + ExpectationError.new("#{msg}: expected call <#{to_s}> but was <#{format_method_call_string(mock,mname,args)}>") + end + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/expectation_builder.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/expectation_builder.rb new file mode 100644 index 0000000..7445fb1 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/expectation_builder.rb @@ -0,0 +1,9 @@ +require 'hardmock/expectation' + +module Hardmock + class ExpectationBuilder #:nodoc: + def build_expectation(options) + Expectation.new(options) + end + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/expector.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/expector.rb new file mode 100644 index 0000000..8055460 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/expector.rb @@ -0,0 +1,26 @@ +require 'hardmock/method_cleanout' +require 'hardmock/errors' + +module Hardmock + class Expector #:nodoc: + include MethodCleanout + + def initialize(mock,mock_control,expectation_builder) + @mock = mock + @mock_control = mock_control + @expectation_builder = expectation_builder + end + + def method_missing(mname, *args, &block) + expectation = @expectation_builder.build_expectation( + :mock => @mock, + :method => mname, + :arguments => args, + :block => block) + + @mock_control.add_expectation expectation + expectation + end + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/method_cleanout.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/method_cleanout.rb new file mode 100644 index 0000000..51797e6 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/method_cleanout.rb @@ -0,0 +1,33 @@ + +module Hardmock #:nodoc: + module MethodCleanout #:nodoc: + SACRED_METHODS = %w{ + __id__ + __send__ + equal? + object_id + send + nil? + class + kind_of? + respond_to? + inspect + method + to_s + instance_variables + instance_eval + == + hm_metaclass + hm_meta_eval + hm_meta_def + } + + def self.included(base) #:nodoc: + base.class_eval do + instance_methods.each do |m| + undef_method m unless SACRED_METHODS.include?(m.to_s) + end + end + end + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/mock.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/mock.rb new file mode 100644 index 0000000..928c432 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/mock.rb @@ -0,0 +1,180 @@ + +module Hardmock + # Mock is used to set expectations in your test. Most of the time you'll use + # #expects to create expectations. + # + # Aside from the scant few control methods (like +expects+, +trap+ and +_verify+) + # all calls made on a Mock instance will be immediately applied to the internal + # expectation mechanism. + # + # * If the method call was expected and all the parameters match properly, execution continues + # * If the expectation was configured with an expectation block, the block is invoked + # * If the expectation was set up to raise an error, the error is raised now + # * If the expectation was set up to return a value, it is returned + # * If the method call was _not_ expected, or the parameter values are wrong, an ExpectationError is raised. + class Mock + include Hardmock::MethodCleanout + + # Create a new Mock instance with a name and a MockControl to support it. + # If not given, a MockControl is made implicitly for this Mock alone; this means + # expectations for this mock are not tied to other expectations in your test. + # + # It's not recommended to use a Mock directly; see Hardmock and + # Hardmock#create_mocks for the more wholistic approach. + def initialize(name, mock_control=nil) + @name = name + @control = mock_control || MockControl.new + @expectation_builder = ExpectationBuilder.new + end + + def inspect + "" + end + + # Begin declaring an expectation for this Mock. + # + # == Simple Examples + # Expect the +customer+ to be queried for +account+, and return "The + # Account": + # @customer.expects.account.returns "The Account" + # + # Expect the +withdraw+ method to be called, and raise an exception when it + # is (see Expectation#raises for more info): + # @cash_machine.expects.withdraw(20,:dollars).raises("not enough money") + # + # Expect +customer+ to have its +user_name+ set + # @customer.expects.user_name = 'Big Boss' + # + # Expect +customer+ to have its +user_name+ set, and raise a RuntimeException when + # that happens: + # @customer.expects('user_name=', "Big Boss").raises "lost connection" + # + # Expect +evaluate+ to be passed a block, and when that happens, pass a value + # to the block (see Expectation#yields for more info): + # @cruncher.expects.evaluate.yields("some data").returns("some results") + # + # + # == Expectation Blocks + # To do special handling of expected method calls when they occur, you + # may pass a block to your expectation, like: + # @page_scraper.expects.handle_content do |address,request,status| + # assert_not_nil address, "Can't abide nil addresses" + # assert_equal "http-get", request.method, "Can only handle GET" + # assert status > 200 and status < 300, status, "Failed status" + # "Simulated results #{request.content.downcase}" + # end + # In this example, when page_scraper.handle_content is called, its + # three arguments are passed to the expectation block and evaluated + # using the above assertions. The last value in the block will be used + # as the return value for +handle_content+ + # + # You may specify arguments to the expected method call, just like any normal + # expectation, and those arguments will be pre-validated before being passed + # to the expectation block. This is useful when you know all of the + # expected values but still need to do something programmatic. + # + # If the method being invoked on the mock accepts a block, that block will be + # passed to your expectation block as the last (or only) argument. Eg, the + # convenience method +yields+ can be replaced with the more explicit: + # @cruncher.expects.evaluate do |block| + # block.call "some data" + # "some results" + # end + # + # The result value of the expectation block becomes the return value for the + # expected method call. This can be overidden by using the +returns+ method: + # @cruncher.expects.evaluate do |block| + # block.call "some data" + # "some results" + # end.returns("the actual value") + # + # Additionally, the resulting value of the expectation block is stored + # in the +block_value+ field on the expectation. If you've saved a reference + # to your expectation, you may retrieve the block value once the expectation + # has been met. + # + # evaluation_event = @cruncher.expects.evaluate do |block| + # block.call "some data" + # "some results" + # end.returns("the actual value") + # + # result = @cruncher.evaluate do |input| + # puts input # => 'some data' + # end + # # result is 'the actual value' + # + # evaluation_event.block_value # => 'some results' + # + def expects(*args, &block) + expector = Expector.new(self,@control,@expectation_builder) + # If there are no args, we return the Expector + return expector if args.empty? + # If there ARE args, we set up the expectation right here and return it + expector.send(args.shift.to_sym, *args, &block) + end + alias_method :expect, :expects + alias_method :should_receive, :expects + + # Special-case convenience: #trap sets up an expectation for a method + # that will take a block. That block, when sent to the expected method, will + # be trapped and stored in the expectation's +block_value+ field. + # The Expectation#trigger method may then be used to invoke that block. + # + # Like +expects+, the +trap+ mechanism can be followed by +raises+ or +returns+. + # + # _Unlike_ +expects+, you may not use an expectation block with +trap+. If + # the expected method takes arguments in addition to the block, they must + # be specified in the arguments to the +trap+ call itself. + # + # == Example + # + # create_mocks :address_book, :editor_form + # + # # Expect a subscription on the :person_added event for @address_book: + # person_event = @address_book.trap.subscribe(:person_added) + # + # # The runtime code would look like: + # @address_book.subscribe :person_added do |person_name| + # @editor_form.name = person_name + # end + # + # # At this point, the expectation for 'subscribe' is met and the + # # block has been captured. But we're not done: + # @editor_form.expects.name = "David" + # + # # Now invoke the block we trapped earlier: + # person_event.trigger "David" + # + # verify_mocks + def trap(*args) + Trapper.new(self,@control,ExpectationBuilder.new) + end + + def method_missing(mname,*args) #:nodoc: + block = nil + block = Proc.new if block_given? + @control.apply_method_call(self,mname,args,block) + end + + + def _control #:nodoc: + @control + end + + def _name #:nodoc: + @name + end + + # Verify that all expectations are fulfilled. NOTE: this method triggers + # validation on the _control_ for this mock, so all Mocks that share the + # MockControl with this instance will be included in the verification. + # + # Only use this method if you are managing your own Mocks and their controls. + # + # Normal usage of Hardmock doesn't require you to call this; let + # Hardmock#verify_mocks do it for you. + def _verify + @control.verify + end + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/mock_control.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/mock_control.rb new file mode 100644 index 0000000..302ebce --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/mock_control.rb @@ -0,0 +1,53 @@ +require 'hardmock/utils' + +module Hardmock + class MockControl #:nodoc: + include Utils + attr_accessor :name + + def initialize + clear_expectations + end + + def happy? + @expectations.empty? + end + + def disappointed? + @disappointed + end + + def add_expectation(expectation) +# puts "MockControl #{self.object_id.to_s(16)} adding expectation: #{expectation}" + @expectations << expectation + end + + def apply_method_call(mock,mname,args,block) + # Are we even expecting any sort of call? + if happy? + @disappointed = true + raise ExpectationError.new("Surprise call to #{format_method_call_string(mock,mname,args)}") + end + + begin + @expectations.shift.apply_method_call(mock,mname,args,block) + rescue Exception => ouch + @disappointed = true + raise ouch + end + end + + def verify +# puts "MockControl #{self.object_id.to_s(16)} verify: happy? #{happy?}" + @disappointed = !happy? + raise VerifyError.new("Unmet expectations", @expectations) unless happy? + end + + def clear_expectations + @expectations = [] + @disappointed = false + end + + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/stubbing.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/stubbing.rb new file mode 100644 index 0000000..0f8a293 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/stubbing.rb @@ -0,0 +1,210 @@ + + +# Stubbing support +# +# Stubs methods on classes and instances +# + +# Why's "metaid.rb" stuff crunched down: +class Object #:nodoc:# + def hm_metaclass #:nodoc:# + class << self + self + end + end + + def hm_meta_eval(&blk) #:nodoc:# + hm_metaclass.instance_eval(&blk) + end + + def hm_meta_def(name, &blk) #:nodoc:# + hm_meta_eval { define_method name, &blk } + end +end + + + +module Hardmock + + # == Hardmock: Stubbing and Mocking Concrete Methods + # + # Hardmock lets you stub and/or mock methods on concrete classes or objects. + # + # * To "stub" a concrete method is to rig it to return the same thing always, disregarding any arguments. + # * To "mock" a concrete method is to surplant its funcionality by delegating to a mock object who will cover this behavior. + # + # Mocked methods have their expectations considered along with all other mock object expectations. + # + # If you use stubbing or concrete mocking in the absence (or before creation) of other mocks, you need to invoke prepare_hardmock_control. + # Once verify_mocks or clear_expectaions is called, the overriden behavior in the target objects is restored. + # + # == Examples + # + # River.stubs!(:sounds_like).returns("gurgle") + # + # River.expects!(:jump).returns("splash") + # + # rogue.stubs!(:sounds_like).returns("pshshsh") + # + # rogue.expects!(:rawhide_tanning_solvents).returns("giant snapping turtles") + # + module Stubbing + # Exists only for documentation + end + + class ReplacedMethod #:nodoc:# + attr_reader :target, :method_name + + def initialize(target, method_name) + @target = target + @method_name = method_name + + Hardmock.track_replaced_method self + end + end + + class StubbedMethod < ReplacedMethod #:nodoc:# + def invoke(args) + raise @raises if @raises + @return_value + end + + def returns(stubbed_return) + @return_value = stubbed_return + end + + def raises(err) + err = RuntimeError.new(err) unless err.kind_of?(Exception) + @raises = err + end + end + + class ::Object + def stubs!(method_name) + method_name = method_name.to_s + already_stubbed = Hardmock.has_replaced_method?(self, method_name) + + stubbed_method = Hardmock::StubbedMethod.new(self, method_name) + + + unless _is_mock? or already_stubbed + if methods.include?(method_name.to_s) + hm_meta_eval do + alias_method "_hardmock_original_#{method_name}".to_sym, method_name.to_sym + end + end + end + + hm_meta_def method_name do |*args| + stubbed_method.invoke(args) + end + + stubbed_method + end + + def expects!(method_name, *args, &block) + if self._is_mock? + raise Hardmock::StubbingError, "Cannot use 'expects!(:#{method_name})' on a Mock object; try 'expects' instead" + end + + method_name = method_name.to_s + + @_my_mock = Mock.new(_my_name, $main_mock_control) if @_my_mock.nil? + + unless Hardmock.has_replaced_method?(self, method_name) + # Track the method as replaced + Hardmock::ReplacedMethod.new(self, method_name) + + # Preserver original implementation of the method by aliasing it away + if methods.include?(method_name) + hm_meta_eval do + alias_method "_hardmock_original_#{method_name}".to_sym, method_name.to_sym + end + end + + # Re-define the method to utilize our patron mock instance. + # (This global-temp-var thing is hokey but I was having difficulty generating + # code for the meta class.) + begin + $method_text_temp = %{ + def #{method_name}(*args,&block) + @_my_mock.__send__(:#{method_name}, *args, &block) + end + } + class << self + eval $method_text_temp + end + ensure + $method_text_temp = nil + end + end + + return @_my_mock.expects(method_name, *args, &block) + end + + def _is_mock? + self.kind_of?(Mock) + end + + def _my_name + self.kind_of?(Class) ? self.name : self.class.name + end + + def _clear_mock + @_my_mock = nil + end + + end + + class ::NilClass + # Use this only if you really mean it + alias_method :intentionally_stubs!, :stubs! + + # Use this only if you really mean it + alias_method :intentionally_expects!, :expects! + + # Overridden to protect against accidental nil reference self delusion + def stubs!(mname) + raise StubbingError, "Cannot stub #{mname} method on nil. (If you really mean to, try 'intentionally_stubs!')" + end + + # Overridden to protect against accidental nil reference self delusion + def expects!(mname, *args) + raise StubbingError, "Cannot mock #{mname} method on nil. (If you really mean to, try 'intentionally_expects!')" + end + end + + class << self + def track_replaced_method(replaced_method) + all_replaced_methods << replaced_method + end + + def all_replaced_methods + $all_replaced_methods ||= [] + end + + def has_replaced_method?(obj, method_name) + hits = all_replaced_methods.select do |replaced| + (replaced.target.object_id == obj.object_id) and (replaced.method_name.to_s == method_name.to_s) + end + return !hits.empty? + end + + def restore_all_replaced_methods + all_replaced_methods.each do |replaced| + unless replaced.target._is_mock? + backed_up = "_hardmock_original_#{replaced.method_name}" + if replaced.target.methods.include?(backed_up) + replaced.target.hm_meta_eval do + alias_method replaced.method_name.to_sym, backed_up.to_sym + end + end + replaced.target._clear_mock + end + end + all_replaced_methods.clear + end + end + +end + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/trapper.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/trapper.rb new file mode 100644 index 0000000..6aab176 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/trapper.rb @@ -0,0 +1,31 @@ +require 'test/unit/assertions' +require 'hardmock/errors' + +module Hardmock + class Trapper #:nodoc: + include Hardmock::MethodCleanout + + def initialize(mock,mock_control,expectation_builder) + @mock = mock + @mock_control = mock_control + @expectation_builder = expectation_builder + end + + def method_missing(mname, *args) + if block_given? + raise ExpectationError.new("Don't pass blocks when using 'trap' (setting exepectations for '#{mname}')") + end + + the_block = lambda { |target_block| target_block } + expectation = @expectation_builder.build_expectation( + :mock => @mock, + :method => mname, + :arguments => args, + :suppress_arguments_to_block => true, + :block => the_block) + + @mock_control.add_expectation expectation + expectation + end + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/utils.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/utils.rb new file mode 100644 index 0000000..1740577 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/utils.rb @@ -0,0 +1,9 @@ + +module Hardmock + module Utils #:nodoc: + def format_method_call_string(mock,mname,args) + arg_string = args.map { |a| a.inspect }.join(', ') + call_text = "#{mock._name}.#{mname}(#{arg_string})" + end + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/lib/test_unit_before_after.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/lib/test_unit_before_after.rb new file mode 100644 index 0000000..0499e39 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/lib/test_unit_before_after.rb @@ -0,0 +1,169 @@ +require 'test/unit' +require 'test/unit/testcase' +require 'test/unit/assertions' + +module Test #:nodoc:# + module Unit #:nodoc:# + + # == TestCase Modifications + # + # Monkey-patch to provide a formal mechanism for appending actions to be executed after teardown. + # Use after_teardown to define one or more actions to be executed after teardown for ALL tests. + # + # COMING SOON? + # * (maybe?) Hooks for before_teardown, after_setup, on_error + # * (maybe?) Options for positional control, eg, after_teardown :before_other_actions + # * (maybe?) Provide tagging/filtering so action execution can be controlled specifically? + # + # == Usage + # + # Invoke TestCase.after_teardown with optional parameter, which will be invoked with a reference + # to the test instance that has just been torn down. + # + # Example: + # + # Test::Unit::TestCase.after_teardown do |test| + # test.verify_mocks + # end + # + # == Justification + # + # There are a number of tools and libraries that play fast-n-loose with setup and teardown by + # wrapping them, and by overriding method_added as a means of upholding special setup/teardown + # behavior, usually by re-wrapping newly defined user-level setup/teardown methods. + # mocha and active_record/fixtures (and previously, hardmock) will fight for this + # territory with often unpredictable results. + # + # We wouldn't have to battle if Test::Unit provided a formal pre- and post- hook mechanism. + # + class TestCase + + class << self + + # Define an action to be run after teardown. Subsequent calls result in + # multiple actions. The block will be given a reference to the test + # being executed. + # + # Example: + # + # Test::Unit::TestCase.after_teardown do |test| + # test.verify_mocks + # end + def after_teardown(&block) + post_teardown_actions << block + end + + # Used internally. Access the list of post teardown actions for to be + # used by all tests. + def post_teardown_actions + @@post_teardown_actions ||= [] + end + + # Define an action to be run before setup. Subsequent calls result in + # multiple actions, EACH BEING PREPENDED TO THE PREVIOUS. + # The block will be given a reference to the test being executed. + # + # Example: + # + # Test::Unit::TestCase.before_setup do |test| + # test.prepare_hardmock_control + # end + def before_setup(&block) + pre_setup_actions.unshift block + end + + # Used internally. Access the list of post teardown actions for to be + # used by all tests. + def pre_setup_actions + @@pre_setup_actions ||= [] + end + end + + # OVERRIDE: This is a reimplementation of the default "run", updated to + # execute actions after teardown. + def run(result) + yield(STARTED, name) + @_result = result + begin + execute_pre_setup_actions(self) + setup + __send__(@method_name) + rescue Test::Unit::AssertionFailedError => e + add_failure(e.message, auxiliary_backtrace_filter(e.backtrace)) + rescue Exception + raise if should_passthru_exception($!) # See implementation; this is for pre-1.8.6 compat + add_error($!) + ensure + begin + teardown + rescue Test::Unit::AssertionFailedError => e + add_failure(e.message, auxiliary_backtrace_filter(e.backtrace)) + rescue Exception + raise if should_passthru_exception($!) # See implementation; this is for pre-1.8.6 compat + add_error($!) + ensure + execute_post_teardown_actions(self) + end + end + result.add_run + yield(FINISHED, name) + end + + private + + # Run through the after_teardown actions, treating failures and errors + # in the same way that "run" does: they are reported, and the remaining + # actions are executed. + def execute_post_teardown_actions(test_instance) + self.class.post_teardown_actions.each do |action| + begin + action.call test_instance + rescue Test::Unit::AssertionFailedError => e + add_failure(e.message, auxiliary_backtrace_filter(e.backtrace)) + rescue Exception + raise if should_passthru_exception($!) + add_error($!) + end + end + end + + # Run through the before_setup actions. + # Failures or errors cause execution to stop. + def execute_pre_setup_actions(test_instance) + self.class.pre_setup_actions.each do |action| +# begin + action.call test_instance +# rescue Test::Unit::AssertionFailedError => e +# add_failure(e.message, auxiliary_backtrace_filter(e.backtrace)) +# rescue Exception +# raise if should_passthru_exception($!) +# add_error($!) +# end + end + end + + # Make sure that this extension doesn't show up in failure backtraces + def auxiliary_backtrace_filter(trace) + trace.reject { |x| x =~ /test_unit_before_after/ } + end + + # Is the given error of the type that we allow to fly out (rather than catching it)? + def should_passthru_exception(ex) + return passthrough_exception_types.include?($!.class) + end + + # Provide a list of exception types that are to be allowed to explode out. + # Pre-ruby-1.8.6 doesn't use this functionality, so the PASSTHROUGH_EXCEPTIONS + # constant won't be defined. This methods defends against that and returns + # an empty list instead. + def passthrough_exception_types + begin + return PASSTHROUGH_EXCEPTIONS + rescue NameError + # older versions of test/unit do not have PASSTHROUGH_EXCEPTIONS constant + return [] + end + end + end + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/rake_tasks/rdoc.rake b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/rake_tasks/rdoc.rake new file mode 100644 index 0000000..6a6d79f --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/rake_tasks/rdoc.rake @@ -0,0 +1,19 @@ +require 'rake/rdoctask' +require File.expand_path(File.dirname(__FILE__) + "/rdoc_options.rb") + +namespace :doc do + + desc "Generate RDoc documentation" + Rake::RDocTask.new { |rdoc| + rdoc.rdoc_dir = 'doc' + rdoc.title = "Hardmock: Strict expectation-based mock object library " + add_rdoc_options(rdoc.options) + rdoc.rdoc_files.include('lib/**/*.rb', 'README','CHANGES','LICENSE') + } + + task :show => [ 'doc:rerdoc' ] do + sh "open doc/index.html" + end + +end + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/rake_tasks/rdoc_options.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/rake_tasks/rdoc_options.rb new file mode 100644 index 0000000..85bf4ce --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/rake_tasks/rdoc_options.rb @@ -0,0 +1,4 @@ + +def add_rdoc_options(options) + options << '--line-numbers' << '--inline-source' << '--main' << 'README' << '--title' << 'Hardmock' +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/rake_tasks/test.rake b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/rake_tasks/test.rake new file mode 100644 index 0000000..85a3753 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/rake_tasks/test.rake @@ -0,0 +1,22 @@ +require 'rake/testtask' + +namespace :test do + + desc "Run unit tests" + Rake::TestTask.new("units") { |t| + t.libs << "test" + t.pattern = 'test/unit/*_test.rb' + t.verbose = true + } + + desc "Run functional tests" + Rake::TestTask.new("functional") { |t| + t.libs << "test" + t.pattern = 'test/functional/*_test.rb' + t.verbose = true + } + + desc "Run all the tests" + task :all => [ 'test:units', 'test:functional' ] + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/assert_error_test.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/assert_error_test.rb new file mode 100644 index 0000000..e4b35cf --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/assert_error_test.rb @@ -0,0 +1,52 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'assert_error' + +class AssertErrorTest < Test::Unit::TestCase + + it "specfies an error type and message that should be raised" do + assert_error RuntimeError, "Too funky" do + raise RuntimeError.new("Too funky") + end + end + + it "flunks if the error message is wrong" do + err = assert_raise Test::Unit::AssertionFailedError do + assert_error RuntimeError, "not good" do + raise RuntimeError.new("Too funky") + end + end + assert_match(/not good/i, err.message) + assert_match(/too funky/i, err.message) + end + + it "flunks if the error type is wrong" do + err = assert_raise Test::Unit::AssertionFailedError do + assert_error StandardError, "Too funky" do + raise RuntimeError.new("Too funky") + end + end + assert_match(/StandardError/i, err.message) + assert_match(/RuntimeError/i, err.message) + end + + it "can match error message text using a series of Regexps" do + assert_error StandardError, /too/i, /funky/i do + raise StandardError.new("Too funky") + end + end + + it "flunks if the error message doesn't match all the Regexps" do + err = assert_raise Test::Unit::AssertionFailedError do + assert_error StandardError, /way/i, /too/i, /funky/i do + raise StandardError.new("Too funky") + end + end + assert_match(/way/i, err.message) + end + + it "can operate without any message specification" do + assert_error StandardError do + raise StandardError.new("ooof") + end + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/auto_verify_test.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/auto_verify_test.rb new file mode 100644 index 0000000..1b005bd --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/auto_verify_test.rb @@ -0,0 +1,178 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'fileutils' + +class AutoVerifyTest < Test::Unit::TestCase + + def setup + @expect_unmet_expectations = true + end + + def teardown + remove_temp_test_file + end + + # + # TESTS + # + + it "auto-verifies all mocks in teardown" do + write_and_execute_test + end + + it "auto-verifies even if user defines own teardown" do + @teardown_code =<<-EOM + def teardown + # just in the way + end + EOM + write_and_execute_test + end + + should "not obscure normal failures when verification fails" do + @test_code =<<-EOM + def test_setup_doomed_expectation + create_mock :automobile + @automobile.expects.start + flunk "natural failure" + end + EOM + @expect_failures = 1 + write_and_execute_test + end + + should "not skip user-defined teardown when verification fails" do + @teardown_code =<<-EOM + def teardown + puts "User teardown" + end + EOM + write_and_execute_test + assert_output_contains(/User teardown/) + end + + it "is quiet when verification is ok" do + @test_code =<<-EOM + def test_ok + create_mock :automobile + @automobile.expects.start + @automobile.start + end + EOM + @teardown_code =<<-EOM + def teardown + puts "User teardown" + end + EOM + @expect_unmet_expectations = false + @expect_failures = 0 + @expect_errors = 0 + write_and_execute_test + assert_output_contains(/User teardown/) + end + + should "auto-verify even if user teardown explodes" do + @teardown_code =<<-EOM + def teardown + raise "self destruct" + end + EOM + @expect_errors = 2 + write_and_execute_test + assert_output_contains(/self destruct/) + end + + it "plays nice with inherited teardown methods" do + @full_code ||=<<-EOTEST + require File.expand_path(File.dirname(__FILE__) + "/../test_helper") + require 'hardmock' + class Test::Unit::TestCase + def teardown + puts "Test helper teardown" + end + end + class DummyTest < Test::Unit::TestCase + def test_prepare_to_die + create_mock :automobile + @automobile.expects.start + end + end + EOTEST + write_and_execute_test + assert_output_contains(/Test helper teardown/) + end + + # + # HELPERS + # + + def temp_test_file + File.expand_path(File.dirname(__FILE__) + "/tear_down_verification_test.rb") + end + + def run_test(tbody) + File.open(temp_test_file,"w") { |f| f.print(tbody) } + @test_output = `ruby #{temp_test_file} 2>&1` + end + + def formatted_test_output + if @test_output + @test_output.split(/\n/).map { |line| "> #{line}" }.join("\n") + else + "(NO TEST OUTPUT!)" + end + end + + def remove_temp_test_file + FileUtils::rm_f temp_test_file + end + + def assert_results(h) + if @test_output !~ /#{h[:tests]} tests, [0-9]+ assertions, #{h[:failures]} failures, #{h[:errors]} errors/ + flunk "Test results didn't match #{h.inspect}:\n#{formatted_test_output}" + end + end + + def assert_output_contains(*patterns) + patterns.each do |pattern| + if @test_output !~ pattern + flunk "Test output didn't match #{pattern.inspect}:\n#{formatted_test_output}" + end + end + end + + def assert_output_doesnt_contain(*patterns) + patterns.each do |pattern| + assert @test_output !~ pattern, "Output shouldn't match #{pattern.inspect} but it does." + end + end + + def write_and_execute_test + @test_code ||=<<-EOM + def test_setup_doomed_expectation + create_mock :automobile + @automobile.expects.start + end + EOM + @full_code ||=<<-EOTEST + require File.expand_path(File.dirname(__FILE__) + "/../test_helper") + require 'hardmock' + class DummyTest < Test::Unit::TestCase + #{@teardown_code} + #{@test_code} + end + EOTEST + run_test @full_code + + if @expect_unmet_expectations + assert_output_contains(/unmet expectations/i, /automobile/, /start/) + else + assert_output_doesnt_contain(/unmet expectations/i, /automobile/, /start/) + end + + @expect_tests ||= 1 + @expect_failures ||= 0 + @expect_errors ||= 1 + assert_results :tests => @expect_tests, :failures => @expect_failures, :errors => @expect_errors + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/direct_mock_usage_test.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/direct_mock_usage_test.rb new file mode 100644 index 0000000..dcf2b2a --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/direct_mock_usage_test.rb @@ -0,0 +1,396 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock' + +class DirectMockUsageTest < Test::Unit::TestCase + + def setup + @bird = Mock.new('bird') + end + + def teardown + end + + # + # TESTS + # + + it "raises VerifyError if expected method not called" do + @bird.expects.flap_flap + + err = assert_raise VerifyError do + @bird._verify + end + assert_match(/unmet expectations/i, err.message) + end + + should "not raise when expected calls are made in order" do + @bird.expects.flap_flap + @bird.expects.bang + @bird.expects.plop + + @bird.flap_flap + @bird.bang + @bird.plop + + @bird._verify + end + + it "raises ExpectationError when unexpected method are called" do + @bird.expects.flap_flap + + err = assert_raise ExpectationError do + @bird.shoot + end + assert_match(/wrong method/i, err.message) + end + + it "raises ExpectationError on bad arguments" do + @bird.expects.flap_flap(:swoosh) + + err = assert_raise ExpectationError do + @bird.flap_flap(:rip) + end + assert_match(/wrong arguments/i, err.message) + end + + it "raises VerifyError when not all expected methods are called" do + @bird.expects.flap_flap + @bird.expects.bang + @bird.expects.plop + + @bird.flap_flap + + err = assert_raise VerifyError do + @bird._verify + end + assert_match(/unmet expectations/i, err.message) + end + + it "raises ExpectationError when calls are made out of order" do + @bird.expects.flap_flap + @bird.expects.bang + @bird.expects.plop + + @bird.flap_flap + err = assert_raise ExpectationError do + @bird.plop + end + assert_match(/wrong method/i, err.message) + end + + it "returns the configured value" do + @bird.expects.plop.returns(':P') + assert_equal ':P', @bird.plop + @bird._verify + + @bird.expects.plop.returns(':x') + assert_equal ':x', @bird.plop + @bird._verify + end + + it "returns nil when no return is specified" do + @bird.expects.plop + assert_nil @bird.plop + @bird._verify + end + + it "raises the configured exception" do + err = RuntimeError.new('shaq') + @bird.expects.plop.raises(err) + actual_err = assert_raise RuntimeError do + @bird.plop + end + assert_same err, actual_err, 'should be the same error' + @bird._verify + end + + it "raises a RuntimeError when told to 'raise' a string" do + @bird.expects.plop.raises('shaq') + err = assert_raise RuntimeError do + @bird.plop + end + assert_match(/shaq/i, err.message) + @bird._verify + end + + it "raises a default RuntimeError" do + @bird.expects.plop.raises + err = assert_raise RuntimeError do + @bird.plop + end + assert_match(/error/i, err.message) + @bird._verify + end + + it "is quiet when correct arguments given" do + thing = Object.new + @bird.expects.plop(:big,'one',thing) + @bird.plop(:big,'one',thing) + @bird._verify + end + + it "raises ExpectationError when wrong number of arguments specified" do + thing = Object.new + @bird.expects.plop(:big,'one',thing) + err = assert_raise ExpectationError do + # more + @bird.plop(:big,'one',thing,:other) + end + assert_match(/wrong arguments/i, err.message) + @bird._verify + + @bird.expects.plop(:big,'one',thing) + err = assert_raise ExpectationError do + # less + @bird.plop(:big,'one') + end + assert_match(/wrong arguments/i, err.message) + @bird._verify + + @bird.expects.plop + err = assert_raise ExpectationError do + # less + @bird.plop(:big) + end + assert_match(/wrong arguments/i, err.message) + @bird._verify + end + + it "raises ExpectationError when arguments don't match" do + thing = Object.new + @bird.expects.plop(:big,'one',thing) + err = assert_raise ExpectationError do + @bird.plop(:big,'two',thing,:other) + end + assert_match(/wrong arguments/i, err.message) + @bird._verify + end + + it "can use a block for custom reactions" do + mitt = nil + @bird.expects.plop { mitt = :ball } + assert_nil mitt + @bird.plop + assert_equal :ball, mitt, 'didnt catch the ball' + @bird._verify + + @bird.expects.plop { raise 'ball' } + err = assert_raise RuntimeError do + @bird.plop + end + assert_match(/ball/i, err.message) + @bird._verify + end + + it "passes mock-call arguments to the expectation block" do + ball = nil + mitt = nil + @bird.expects.plop {|arg1,arg2| + ball = arg1 + mitt = arg2 + } + assert_nil ball + assert_nil mitt + @bird.plop(:ball,:mitt) + assert_equal :ball, ball + assert_equal :mitt, mitt + @bird._verify + end + + it "validates arguments if specified in addition to a block" do + ball = nil + mitt = nil + @bird.expects.plop(:ball,:mitt) {|arg1,arg2| + ball = arg1 + mitt = arg2 + } + assert_nil ball + assert_nil mitt + @bird.plop(:ball,:mitt) + assert_equal :ball, ball + assert_equal :mitt, mitt + @bird._verify + + ball = nil + mitt = nil + @bird.expects.plop(:bad,:stupid) {|arg1,arg2| + ball = arg1 + mitt = arg2 + } + assert_nil ball + assert_nil mitt + err = assert_raise ExpectationError do + @bird.plop(:ball,:mitt) + end + assert_match(/wrong arguments/i, err.message) + assert_nil ball + assert_nil mitt + @bird._verify + + ball = nil + mitt = nil + @bird.expects.plop(:ball,:mitt) {|arg1,arg2| + ball = arg1 + mitt = arg2 + } + assert_nil ball + assert_nil mitt + err = assert_raise ExpectationError do + @bird.plop(:ball) + end + assert_match(/wrong arguments/i, err.message) + assert_nil ball + assert_nil mitt + @bird._verify + end + + it "passes runtime blocks to the expectation block as the final argument" do + runtime_block_called = false + got_arg = nil + + # Eg, bird expects someone to subscribe to :tweet using the 'when' method + @bird.expects.when(:tweet) { |arg1, block| + got_arg = arg1 + block.call + } + + @bird.when(:tweet) do + runtime_block_called = true + end + + assert_equal :tweet, got_arg, "Wrong arg" + assert runtime_block_called, "The runtime block should have been invoked by the user block" + + @bird.expects.when(:warnk) { |e,blk| } + + err = assert_raise ExpectationError do + @bird.when(:honk) { } + end + assert_match(/wrong arguments/i, err.message) + + @bird._verify + end + + it "passes the runtime block to the expectation block as sole argument if no other args come into play" do + runtime_block_called = false + @bird.expects.subscribe { |block| block.call } + @bird.subscribe do + runtime_block_called = true + end + assert runtime_block_called, "The runtime block should have been invoked by the user block" + end + + it "provides nil as final argument if expectation block seems to want a block" do + invoked = false + @bird.expects.kablam(:scatter) { |shot,block| + assert_equal :scatter, shot, "Wrong shot" + assert_nil block, "The expectation block should get a nil block when user neglects to pass one" + invoked = true + } + @bird.kablam :scatter + assert invoked, "Expectation block not invoked" + + @bird._verify + end + + it "can set explicit return after an expectation block" do + got = nil + @bird.expects.kablam(:scatter) { |shot| + got = shot + }.returns(:death) + + val = @bird.kablam :scatter + assert_equal :death, val, "Wrong return value" + assert_equal :scatter, got, "Wrong argument" + @bird._verify + end + + it "can raise after an expectation block" do + got = nil + @bird.expects.kablam(:scatter) do |shot| + got = shot + end.raises "hell" + + err = assert_raise RuntimeError do + @bird.kablam :scatter + end + assert_match(/hell/i, err.message) + + @bird._verify + end + + it "stores the semantic value of the expectation block after it executes" do + expectation = @bird.expects.kablam(:slug) { |shot| + "The shot was #{shot}" + } + + assert_not_nil expectation, "Expectation nil" + assert_nil expectation.block_value, "Block value should start out nil" + + ret_val = @bird.kablam :slug + + assert_equal "The shot was slug", expectation.block_value + assert_equal "The shot was slug", ret_val, "Block value should also be used for return" + + @bird._verify + end + + + it "uses the value of the expectation block as the default return value" do + @bird.expects.kablam(:scatter) { |shot| + "The shot was #{shot}" + } + val = @bird.kablam :scatter + assert_equal "The shot was scatter", val, "Wrong return value" + @bird._verify + end + + it "returns the Expectation even if 'returns' is used" do + expectation = @bird.expects.kablam(:slug) { |shot| + "The shot was #{shot}" + }.returns :hosed + + assert_not_nil expectation, "Expectation nil" + assert_nil expectation.block_value, "Block value should start out nil" + + ret_val = @bird.kablam :slug + + assert_equal "The shot was slug", expectation.block_value + assert_equal :hosed, ret_val, "Block value should also be used for return" + + @bird._verify + end + + it "returns the Expectation even if 'raises' is used" do + expectation = @bird.expects.kablam(:slug) { |shot| + "The shot was #{shot}" + }.raises "aiee!" + + assert_not_nil expectation, "Expectation nil" + assert_nil expectation.block_value, "Block value should start out nil" + + err = assert_raise RuntimeError do + @bird.kablam :slug + end + assert_match(/aiee!/i, err.message) + assert_equal "The shot was slug", expectation.block_value + @bird._verify + end + + + it "supports assignment-style methods" do + @bird.expects.size = "large" + @bird.size = "large" + @bird._verify + end + + it "supports assignments and raising (using explicit-method syntax)" do + @bird.expects('size=','large').raises "boom" + + err = assert_raise RuntimeError do + @bird.size = "large" + end + assert_match(/boom/i, err.message) + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/hardmock_test.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/hardmock_test.rb new file mode 100644 index 0000000..159d369 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/hardmock_test.rb @@ -0,0 +1,434 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock' +require 'assert_error' + +class HardmockTest < Test::Unit::TestCase + + # + # TESTS + # + + it "conveniently creates mocks using create_mock and create_mocks" do + + h = create_mock :donkey + assert_equal [ :donkey ], h.keys + + assert_mock_exists :donkey + assert_same @donkey, h[:donkey] + + assert_equal [ :donkey ], @all_mocks.keys, "Wrong keyset for @all_mocks" + + h2 = create_mocks :cat, 'dog' # symbol/string indifference at this level + assert_equal [:cat,:dog].to_set, h2.keys.to_set, "Wrong keyset for second hash" + assert_equal [:cat,:dog,:donkey].to_set, @all_mocks.keys.to_set, "@all_mocks wrong" + + assert_mock_exists :cat + assert_same @cat, h2[:cat] + assert_mock_exists :dog + assert_same @dog, h2[:dog] + + assert_mock_exists :donkey + end + + it "provides literal 'expects' syntax" do + assert_nil @order, "Should be no @order yet" + create_mock :order + assert_not_nil @order, "@order should be built" + + # Setup an expectation + @order.expects.update_stuff :key1 => 'val1', :key2 => 'val2' + + # Use the mock + @order.update_stuff :key1 => 'val1', :key2 => 'val2' + + # Verify + verify_mocks + + # See that it's ok to do it again + verify_mocks + end + + it "supports 'with' for specifying argument expectations" do + create_mocks :car + @car.expects(:fill).with('gas','booze') + @car.fill('gas', 'booze') + verify_mocks + end + + it "supports several mocks at once" do + create_mocks :order_builder, :order, :customer + + @order_builder.expects.create_new_order.returns @order + @customer.expects.account_number.returns(1234) + @order.expects.account_no = 1234 + @order.expects.save! + + # Run "the code" + o = @order_builder.create_new_order + o.account_no = @customer.account_number + o.save! + + verify_mocks + end + + it "enforces inter-mock call ordering" do + create_mocks :order_builder, :order, :customer + + @order_builder.expects.create_new_order.returns @order + @customer.expects.account_number.returns(1234) + @order.expects.account_no = 1234 + @order.expects.save! + + # Run "the code" + o = @order_builder.create_new_order + err = assert_raise ExpectationError do + o.save! + end + assert_match(/wrong object/i, err.message) + assert_match(/order.save!/i, err.message) + assert_match(/customer.account_number/i, err.message) + + assert_error VerifyError, /unmet expectations/i do + verify_mocks + end + end + + class UserPresenter + def initialize(args) + view = args[:view] + model = args[:model] + model.when :data_changes do + view.user_name = model.user_name + end + view.when :user_edited do + model.user_name = view.user_name + end + end + end + + it "makes MVP testing simple" do + mox = create_mocks :model, :view + + data_change = @model.expects.when(:data_changes) { |evt,block| block } + user_edit = @view.expects.when(:user_edited) { |evt,block| block } + + UserPresenter.new mox + + # Expect user name transfer from model to view + @model.expects.user_name.returns 'Da Croz' + @view.expects.user_name = 'Da Croz' + # Trigger data change event in model + data_change.block_value.call + + # Expect user name transfer from view to model + @view.expects.user_name.returns '6:8' + @model.expects.user_name = '6:8' + # Trigger edit event in view + user_edit.block_value.call + + verify_mocks + end + + it "continues to function after verify, if verification error is controlled" do + mox = create_mocks :model, :view + data_change = @model.expects.when(:data_changes) { |evt,block| block } + user_edit = @view.expects.when(:user_edited) { |evt,block| block } + UserPresenter.new mox + + # Expect user name transfer from model to view + @model.expects.user_name.returns 'Da Croz' + @view.expects.user_name = 'Da Croz' + + assert_error ExpectationError, /model.monkey_wrench/i do + @model.monkey_wrench + end + + # This should raise because of unmet expectations + assert_error VerifyError, /unmet expectations/i, /user_name/i do + verify_mocks + end + + # See that the non-forced verification remains quiet + assert_nothing_raised VerifyError do + verify_mocks(false) + end + + @model.expects.never_gonna_happen + + assert_error VerifyError, /unmet expectations/i, /never_gonna_happen/i do + verify_mocks + end + end + + class UserPresenterBroken + def initialize(args) + view = args[:view] + model = args[:model] + model.when :data_changes do + view.user_name = model.user_name + end + # no view stuff, will break appropriately + end + end + + it "flunks for typical Presenter constructor wiring failure" do + mox = create_mocks :model, :view + + data_change = @model.expects.when(:data_changes) { |evt,block| block } + user_edit = @view.expects.when(:user_edited) { |evt,block| block } + + UserPresenterBroken.new mox + + err = assert_raise VerifyError do + verify_mocks + end + assert_match(/unmet expectations/i, err.message) + assert_match(/view.when\(:user_edited\)/i, err.message) + + end + + it "provides convenient event-subscription trap syntax for MVP testing" do + mox = create_mocks :model, :view + + data_change = @model.trap.when(:data_changes) + user_edit = @view.trap.when(:user_edited) + + UserPresenter.new mox + + # Expect user name transfer from model to view + @model.expects.user_name.returns 'Da Croz' + @view.expects.user_name = 'Da Croz' + # Trigger data change event in model + data_change.trigger + + # Expect user name transfer from view to model + @view.expects.user_name.returns '6:8' + @model.expects.user_name = '6:8' + # Trigger edit event in view + user_edit.trigger + + verify_mocks + end + + it "raises if you try to pass an expectation block to 'trap'" do + create_mock :model + assert_error Hardmock::ExpectationError, /blocks/i, /trap/i do + @model.trap.when(:some_event) do raise "huh?" end + end + end + + class Grinder + def initialize(objects) + @chute = objects[:chute] + @bucket = objects[:bucket] + @blade = objects[:blade] + end + + def grind(slot) + @chute.each_bean(slot) do |bean| + @bucket << @blade.chop(bean) + end + end + end + + it "lets you write clear iteration-oriented expectations" do + grinder = Grinder.new create_mocks(:blade, :chute, :bucket) + + # Style 1: assertions on method args is done explicitly in block + @chute.expects.each_bean { |slot,block| + assert_equal :side_slot, slot, "Wrong slot" + block.call :bean1 + block.call :bean2 + } + + @blade.expects.chop(:bean1).returns(:grounds1) + @bucket.expects('<<', :grounds1) + + @blade.expects.chop(:bean2).returns(:grounds2) + @bucket.expects('<<', :grounds2) + + # Run "the code" + grinder.grind(:side_slot) + + verify_mocks + + # Style 2: assertions on method arguments done implicitly in the expectation code + @chute.expects.each_bean(:main_slot) { |slot,block| + block.call :bean3 + } + @blade.expects.chop(:bean3).returns(:grounds3) + @bucket.expects('<<', :grounds3) + grinder.grind :main_slot + verify_mocks + end + + it "further supports iteration testing using 'yield'" do + grinder = Grinder.new create_mocks(:blade, :chute, :bucket) + + @chute.expects.each_bean(:side_slot).yields :bean1, :bean2 + + @blade.expects.chop(:bean1).returns(:grounds1) + @bucket.expects('<<', :grounds1) + + @blade.expects.chop(:bean2).returns(:grounds2) + @bucket.expects('<<', :grounds2) + + grinder.grind :side_slot + + verify_mocks + end + + class HurtLocker + attr_reader :caught + def initialize(opts) + @locker = opts[:locker] + @store = opts[:store] + end + + def do_the_thing(area,data) + @locker.with_lock(area) do + @store.eat(data) + end + rescue => oops + @caught = oops + end + end + + it "makes mutex-style locking scenarios easy to test" do + hurt = HurtLocker.new create_mocks(:locker, :store) + + @locker.expects.with_lock(:main).yields + @store.expects.eat("some info") + + hurt.do_the_thing(:main, "some info") + + verify_mocks + end + + it "makes it easy to simulate error in mutex-style locking scenarios" do + hurt = HurtLocker.new create_mocks(:locker, :store) + err = StandardError.new('fmshooop') + @locker.expects.with_lock(:main).yields + @store.expects.eat("some info").raises(err) + + hurt.do_the_thing(:main, "some info") + + assert_same err, hurt.caught, "Expected that error to be handled internally" + verify_mocks + end + + it "actually returns 'false' instead of nil when mocking boolean return values" do + create_mock :car + @car.expects.ignition_on?.returns(true) + assert_equal true, @car.ignition_on?, "Should be true" + @car.expects.ignition_on?.returns(false) + assert_equal false, @car.ignition_on?, "Should be false" + end + + it "can mock most methods inherited from object using literal syntax" do + target_methods = %w|id clone display dup eql? ==| + create_mock :foo + target_methods.each do |m| + eval %{@foo.expects(m, "some stuff")} + eval %{@foo.#{m} "some stuff"} + end + end + + it "provides 'expect' as an alias for 'expects'" do + create_mock :foo + @foo.expect.boomboom + @foo.boomboom + verify_mocks + end + + it "provides 'should_receive' as an alias for 'expects'" do + create_mock :foo + @foo.should_receive.boomboom + @foo.boomboom + verify_mocks + end + + it "provides 'and_return' as an alias for 'returns'" do + create_mock :foo + @foo.expects(:boomboom).and_return :brick + assert_equal :brick, @foo.boomboom + verify_mocks + end + + it "does not interfere with a core subset of Object methods" do + create_mock :foo + @foo.method(:inspect) + @foo.inspect + @foo.to_s + @foo.instance_variables + @foo.instance_eval("") + verify_mocks + end + + it "can raise errors from within an expectation block" do + create_mock :cat + @cat.expects.meow do |arg| + assert_equal "mix", arg + raise 'HAIRBALL' + end + assert_error RuntimeError, 'HAIRBALL' do + @cat.meow("mix") + end + end + + it "can raise errors AFTER an expectation block" do + create_mock :cat + @cat.expects.meow do |arg| + assert_equal "mix", arg + end.raises('HAIRBALL') + assert_error RuntimeError, 'HAIRBALL' do + @cat.meow("mix") + end + end + + it "raises an immediate error if a mock is created with a nil name (common mistake: create_mock @cat)" do + # I make this mistake all the time: Typing in an instance var name instead of a symbol in create_mocks. + # When you do that, you're effectively passing nil(s) in as mock names. + assert_error ArgumentError, /'nil' is not a valid name for a mock/ do + create_mocks @apples, @oranges + end + end + + it "overrides 'inspect' to make nice output" do + create_mock :hay_bailer + assert_equal "", @hay_bailer.inspect, "Wrong output from 'inspect'" + end + + it "raises if prepare_hardmock_control is invoked after create_mocks, or more than once" do + create_mock :hi_there + create_mocks :another, :one + assert_error RuntimeError, /already setup/ do + prepare_hardmock_control + end + end + + should "support alias verify_hardmocks" do + create_mock :tree + @tree.expects(:grow) + assert_error VerifyError, /unmet/i do + verify_hardmocks + end + end + + # + # HELPERS + # + + def assert_mock_exists(name) + assert_not_nil @all_mocks, "@all_mocks not here yet" + mo = @all_mocks[name] + assert_not_nil mo, "Mock '#{name}' not in @all_mocks" + assert_kind_of Mock, mo, "Wrong type of object, wanted a Mock" + assert_equal name.to_s, mo._name, "Mock '#{name}' had wrong name" + ivar = self.instance_variable_get("@#{name}") + assert_not_nil ivar, "Mock '#{name}' not set as ivar" + assert_same mo, ivar, "Mock '#{name}' ivar not same as instance in @all_mocks" + assert_same @main_mock_control, mo._control, "Mock '#{name}' doesn't share the main mock control" + end +end + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/stubbing_test.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/stubbing_test.rb new file mode 100644 index 0000000..f07a670 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/stubbing_test.rb @@ -0,0 +1,479 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock' +require 'assert_error' + +class StubbingTest < Test::Unit::TestCase + + # + # TESTS + # + + it "stubs a class method (and un-stubs after reset_stubs)" do + assert_equal "stones and gravel", Concrete.pour + assert_equal "glug glug", Jug.pour + + Concrete.stubs!(:pour).returns("dust and plaster") + + 3.times do + assert_equal "dust and plaster", Concrete.pour + end + + assert_equal "glug glug", Jug.pour, "Jug's 'pour' method broken" + assert_equal "stones and gravel", Concrete._hardmock_original_pour, "Original 'pour' method not aliased" + + assert_equal "For roads", Concrete.describe, "'describe' method broken" + + reset_stubs + + assert_equal "stones and gravel", Concrete.pour, "'pour' method not restored" + assert_equal "For roads", Concrete.describe, "'describe' method broken after verify" + + end + + it "stubs several class methods" do + Concrete.stubs!(:pour).returns("sludge") + Concrete.stubs!(:describe).returns("awful") + Jug.stubs!(:pour).returns("milk") + + assert_equal "sludge", Concrete.pour + assert_equal "awful", Concrete.describe + assert_equal "milk", Jug.pour + + reset_stubs + + assert_equal "stones and gravel", Concrete.pour + assert_equal "For roads", Concrete.describe + assert_equal "glug glug", Jug.pour + end + + it "stubs instance methods" do + slab = Concrete.new + assert_equal "bonk", slab.hit + + slab.stubs!(:hit).returns("slap") + assert_equal "slap", slab.hit, "'hit' not stubbed" + + reset_stubs + + assert_equal "bonk", slab.hit, "'hit' not restored" + end + + it "stubs instance methods without breaking class methods or other instances" do + slab = Concrete.new + scrape = Concrete.new + assert_equal "an instance", slab.describe + assert_equal "an instance", scrape.describe + assert_equal "For roads", Concrete.describe + + slab.stubs!(:describe).returns("new instance describe") + assert_equal "new instance describe", slab.describe, "'describe' on instance not stubbed" + assert_equal "an instance", scrape.describe, "'describe' on 'scrape' instance broken" + assert_equal "For roads", Concrete.describe, "'describe' class method broken" + + reset_stubs + + assert_equal "an instance", slab.describe, "'describe' instance method not restored" + assert_equal "an instance", scrape.describe, "'describe' on 'scrape' instance broken after restore" + assert_equal "For roads", Concrete.describe, "'describe' class method broken after restore" + end + + should "allow stubbing of nonexistant class methods" do + Concrete.stubs!(:funky).returns('juice') + assert_equal 'juice', Concrete.funky + end + + should "allow stubbing of nonexistant instance methods" do + chunk = Concrete.new + chunk.stubs!(:shark).returns('bite') + assert_equal 'bite', chunk.shark + end + + should "allow re-stubbing" do + Concrete.stubs!(:pour).returns("one") + assert_equal "one", Concrete.pour + + Concrete.stubs!(:pour).raises("hell") + assert_error RuntimeError, /hell/ do + Concrete.pour + end + + Concrete.stubs!(:pour).returns("two") + assert_equal "two", Concrete.pour + + reset_stubs + + assert_equal "stones and gravel", Concrete.pour + end + + it "does nothing with a runtime block when simply stubbing" do + slab = Concrete.new + slab.stubs!(:hit) do |nothing| + raise "BOOOMM!" + end + slab.hit + reset_stubs + end + + it "can raise errors from a stubbed method" do + Concrete.stubs!(:pour).raises(StandardError.new("no!")) + assert_error StandardError, /no!/ do + Concrete.pour + end + end + + it "provides string syntax for convenient raising of RuntimeErrors" do + Concrete.stubs!(:pour).raises("never!") + assert_error RuntimeError, /never!/ do + Concrete.pour + end + end + + + # + # Per-method mocking on classes or instances + # + + it "mocks specific methods on existing classes, and returns the class method to normal after verification" do + + assert_equal "stones and gravel", Concrete.pour, "Concrete.pour is already messed up" + + Concrete.expects!(:pour).returns("ALIGATORS") + assert_equal "ALIGATORS", Concrete.pour + + verify_mocks + assert_equal "stones and gravel", Concrete.pour, "Concrete.pour not restored" + end + + it "flunks if expected class method is not invoked" do + + Concrete.expects!(:pour).returns("ALIGATORS") + assert_error(Hardmock::VerifyError, /Concrete.pour/, /unmet expectations/i) do + verify_mocks + end + clear_expectations + end + + it "supports all normal mock functionality for class methods" do + + Concrete.expects!(:pour, "two tons").returns("mice") + Concrete.expects!(:pour, "three tons").returns("cats") + Concrete.expects!(:pour, "four tons").raises("Can't do it") + Concrete.expects!(:pour) do |some, args| + "==#{some}+#{args}==" + end + + assert_equal "mice", Concrete.pour("two tons") + assert_equal "cats", Concrete.pour("three tons") + assert_error(RuntimeError, /Can't do it/) do + Concrete.pour("four tons") + end + assert_equal "==first+second==", Concrete.pour("first","second") + end + + + it "enforces inter-mock ordering when mocking class methods" do + create_mocks :truck, :foreman + + @truck.expects.backup + Concrete.expects!(:pour, "something") + @foreman.expects.shout + + @truck.backup + assert_error Hardmock::ExpectationError, /wrong/i, /expected call/i, /Concrete.pour/ do + @foreman.shout + end + assert_error Hardmock::VerifyError, /unmet expectations/i, /foreman.shout/ do + verify_mocks + end + clear_expectations + end + + should "allow mocking non-existant class methods" do + Concrete.expects!(:something).returns("else") + assert_equal "else", Concrete.something + end + + it "mocks specific methods on existing instances, then restore them after verify" do + + slab = Concrete.new + assert_equal "bonk", slab.hit + + slab.expects!(:hit).returns("slap") + assert_equal "slap", slab.hit, "'hit' not stubbed" + + verify_mocks + assert_equal "bonk", slab.hit, "'hit' not restored" + end + + it "flunks if expected instance method is not invoked" do + + slab = Concrete.new + slab.expects!(:hit) + + assert_error Hardmock::VerifyError, /unmet expectations/i, /Concrete.hit/ do + verify_mocks + end + clear_expectations + end + + it "supports all normal mock functionality for instance methods" do + + slab = Concrete.new + + slab.expects!(:hit, "soft").returns("hey") + slab.expects!(:hit, "hard").returns("OOF") + slab.expects!(:hit).raises("stoppit") + slab.expects!(:hit) do |some, args| + "==#{some}+#{args}==" + end + + assert_equal "hey", slab.hit("soft") + assert_equal "OOF", slab.hit("hard") + assert_error(RuntimeError, /stoppit/) do + slab.hit + end + assert_equal "==first+second==", slab.hit("first","second") + + end + + it "enforces inter-mock ordering when mocking instance methods" do + create_mocks :truck, :foreman + slab1 = Concrete.new + slab2 = Concrete.new + + @truck.expects.backup + slab1.expects!(:hit) + @foreman.expects.shout + slab2.expects!(:hit) + @foreman.expects.whatever + + @truck.backup + slab1.hit + @foreman.shout + assert_error Hardmock::ExpectationError, /wrong/i, /expected call/i, /Concrete.hit/ do + @foreman.whatever + end + assert_error Hardmock::VerifyError, /unmet expectations/i, /foreman.whatever/ do + verify_mocks + end + clear_expectations + end + + should "allow mocking non-existant instance methods" do + slab = Concrete.new + slab.expects!(:wholly).returns('happy') + assert_equal 'happy', slab.wholly + end + + should "support concrete expectations that deal with runtime blocks" do + + Concrete.expects!(:pour, "a lot") do |how_much, block| + assert_equal "a lot", how_much, "Wrong how_much arg" + assert_not_nil block, "nil runtime block" + assert_equal "the block value", block.call, "Wrong runtime block value" + end + + Concrete.pour("a lot") do + "the block value" + end + + end + + it "can stub methods on mock objects" do + create_mock :horse + @horse.stubs!(:speak).returns("silence") + @horse.stubs!(:hello).returns("nothing") + @horse.expects(:canter).returns("clip clop") + + assert_equal "silence", @horse.speak + assert_equal "clip clop", @horse.canter + assert_equal "silence", @horse.speak + assert_equal "silence", @horse.speak + assert_equal "nothing", @horse.hello + assert_equal "nothing", @horse.hello + + verify_mocks + reset_stubs + end + + it "can stub the new method and return values" do + Concrete.stubs!(:new).returns("this value") + assert_equal "this value", Concrete.new, "did not properly stub new class method" + reset_stubs + end + + it "can mock the new method and return values" do + Concrete.expects!(:new).with("foo").returns("hello") + Concrete.expects!(:new).with("bar").returns("world") + + assert_equal "hello", Concrete.new("foo"), "did not properly mock out new class method" + assert_equal "world", Concrete.new("bar"), "did not properly mock out new class method" + + verify_mocks + reset_stubs + end + + it "can mock several different class methods at once" do + sim_code = lambda do |input| + record = Multitool.find_record(input) + report = Multitool.generate_report(record) + Multitool.format_output(report) + end + + @identifier = "the id" + @record = "the record" + @report = "the report" + @output = "the output" + + Multitool.expects!(:find_record).with(@identifier).returns(@record) + Multitool.expects!(:generate_report).with(@record).returns(@report) + Multitool.expects!(:format_output).with(@report).returns(@output) + + result = sim_code.call(@identifier) + assert_equal @output, result, "Wrong output" + end + + it "can handle a mix of different and repeat class method mock calls" do + prep = lambda { + Multitool.expects!(:find_record).with("A").returns("1") + Multitool.expects!(:generate_report).with("1") + Multitool.expects!(:find_record).with("B").returns("2") + Multitool.expects!(:generate_report).with("2") + } + + prep[] + Multitool.generate_report(Multitool.find_record("A")) + Multitool.generate_report(Multitool.find_record("B")) + + prep[] + Multitool.generate_report(Multitool.find_record("A")) + assert_error Hardmock::ExpectationError, /Wrong arguments/, /find_record\("B"\)/, /find_record\("C"\)/ do + Multitool.generate_report(Multitool.find_record("C")) + end + clear_expectations + end + + it "can mock several concrete instance methods at once" do + inst = OtherMultitool.new + sim_code = lambda do |input| + record = inst.find_record(input) + report = inst.generate_report(record) + inst.format_output(report) + end + + @identifier = "the id" + @record = "the record" + @report = "the report" + @output = "the output" + + inst.expects!(:find_record).with(@identifier).returns(@record) + inst.expects!(:generate_report).with(@record).returns(@report) + inst.expects!(:format_output).with(@report).returns(@output) + + result = sim_code.call(@identifier) + assert_equal @output, result, "Wrong output" + end + + it "verifies all concrete expects! from several different expectations" do + Multitool.expects!(:find_record) + Multitool.expects!(:generate_report) + Multitool.expects!(:format_output) + + Multitool.find_record + Multitool.generate_report + + assert_error Hardmock::VerifyError, /unmet expectations/i, /format_output/i do + verify_mocks + end + end + + it "will not allow expects! to be used on a mock object" do + create_mock :cow + assert_error Hardmock::StubbingError, /expects!/, /mock/i, /something/ do + @cow.expects!(:something) + end + end + + it "does not allow stubbing on nil objects" do + [ nil, @this_is_nil ].each do |nil_obj| + assert_error Hardmock::StubbingError, /cannot/i, /nil/i, /intentionally/ do + nil_obj.stubs!(:wont_work) + end + end + end + + it "does not allow concrete method mocking on nil objects" do + [ nil, @this_is_nil ].each do |nil_obj| + assert_error Hardmock::StubbingError, /cannot/i, /nil/i, /intentionally/ do + nil_obj.expects!(:wont_work) + end + end + end + + it "provides an alternate method for stubbing on nil objects" do + @this_is_nil.intentionally_stubs!(:bogus).returns('output') + assert_equal 'output', @this_is_nil.bogus + end + + it "provides an alternate method for mocking concreate methods on nil objects" do + @this_is_nil.intentionally_expects!(:bogus).returns('output') + assert_error Hardmock::VerifyError, /unmet expectations/i, /NilClass.bogus/ do + verify_mocks + end + end + + # + # HELPERS + # + + class Concrete + def initialize; end + def self.pour + "stones and gravel" + end + + def self.describe + "For roads" + end + + def hit + "bonk" + end + + def describe + "an instance" + end + end + + class Jug + def self.pour + "glug glug" + end + end + + class Multitool + def self.find_record(*a) + raise "The real Multitool.find_record was called with #{a.inspect}" + end + def self.generate_report(*a) + raise "The real Multitool.generate_report was called with #{a.inspect}" + end + def self.format_output(*a) + raise "The real Multitool.format_output was called with #{a.inspect}" + end + end + + class OtherMultitool + def find_record(*a) + raise "The real OtherMultitool#find_record was called with #{a.inspect}" + end + def generate_report(*a) + raise "The real OtherMultitool#generate_report was called with #{a.inspect}" + end + def format_output(*a) + raise "The real OtherMultitool#format_output was called with #{a.inspect}" + end + end + +end + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/test/test_helper.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/test/test_helper.rb new file mode 100644 index 0000000..af159a4 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/test/test_helper.rb @@ -0,0 +1,43 @@ +here = File.expand_path(File.dirname(__FILE__)) +$: << here + +require "#{here}/../config/environment" +require 'test/unit' +require 'fileutils' +require 'logger' +require 'find' +require 'yaml' +require 'set' +require 'ostruct' + +class Test::Unit::TestCase + include FileUtils + + def poll(time_limit) + (time_limit * 10).to_i.times do + return true if yield + sleep 0.1 + end + return false + end + + def self.it(str, &block) + make_test_case "it", str, &block + end + + def self.should(str, &block) + make_test_case "should", str, &block + end + + def self.make_test_case(prefix, str, &block) + tname = self.name.sub(/Test$/,'') + if block + define_method "test #{prefix} #{str}" do + instance_eval &block + end + else + puts ">>> UNIMPLEMENTED CASE: #{tname}: #{str}" + end + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/expectation_builder_test.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/expectation_builder_test.rb new file mode 100644 index 0000000..f689f98 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/expectation_builder_test.rb @@ -0,0 +1,19 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/expectation_builder' + +class ExpectationBuilderTest < Test::Unit::TestCase + include Hardmock + + def test_build_expectation + builder = ExpectationBuilder.new + + ex = builder.build_expectation( :stuff => 'inside' ) + assert_not_nil ex, "Didn't build an expectation" + assert_kind_of Expectation, ex, "Wrong type!" + + # Shhhh... fragile, yes, whatever. The functional tests do the + # real testing of this anyway + assert_equal({:stuff => 'inside'}, ex.instance_variable_get('@options'), "Hash not sent to SimpleExpectation constructor") + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/expectation_test.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/expectation_test.rb new file mode 100644 index 0000000..54bd204 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/expectation_test.rb @@ -0,0 +1,372 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/expectation' +require 'hardmock/errors' +require 'assert_error' + +class ExpectationTest < Test::Unit::TestCase + include Hardmock + + def setup + @mock = TheMock.new + end + # + # HELPERS + # + + class TheMock + def _name; 'the_mock'; end + end + class OtherMock + def _name; 'other_mock'; end + end + + # + # TESTS + # + + def test_to_s + ex = Expectation.new( :mock => @mock, :method => 'a_func', :arguments => [1, "two", :three, { :four => 4 }] ) + assert_equal %|the_mock.a_func(1, "two", :three, {:four=>4})|, ex.to_s + end + + def test_apply_method_call + se = Expectation.new(:mock => @mock, :method => 'some_func', + :arguments => [1,'two',:three] ) + + # Try it good: + assert_nothing_raised ExpectationError do + se.apply_method_call( @mock, 'some_func', [1,'two',:three], nil ) + end + + # Bad func name: + err = assert_raise ExpectationError do + se.apply_method_call( @mock, 'wrong_func', [1,'two',:three], nil ) + end + assert_match(/wrong method/i, err.message) + assert_match(/wrong_func/i, err.message) + assert_match(/[1, "two", :three]/i, err.message) + assert_match(/some_func/i, err.message) + assert_match(/the_mock/i, err.message) + + # Wrong mock + err = assert_raise ExpectationError do + se.apply_method_call( OtherMock.new, 'some_func', [1,'two',:three], nil ) + end + assert_match(/[1, "two", :three]/i, err.message) + assert_match(/some_func/i, err.message) + assert_match(/the_mock/i, err.message) + assert_match(/other_mock/i, err.message) + + # Wrong args + err = assert_raise ExpectationError do + se.apply_method_call( @mock, 'some_func', [1,'two',:four], nil) + end + assert_match(/[1, "two", :three]/i, err.message) + assert_match(/[1, "two", :four]/i, err.message) + assert_match(/wrong arguments/i, err.message) + assert_match(/some_func/i, err.message) + end + + def test_apply_method_call_should_call_proc_when_given + # now with a proc + thinger = nil + the_proc = Proc.new { thinger = :shaq } + se = Expectation.new(:mock => @mock, :method => 'some_func', + :block => the_proc) + + # Try it good: + assert_nil thinger + assert_nothing_raised ExpectationError do + se.apply_method_call(@mock, 'some_func', [], nil) + end + assert_equal :shaq, thinger, 'wheres shaq??' + end + + def test_apply_method_call_passes_runtime_block_as_last_argument_to_expectation_block + + passed_block = nil + exp_block_called = false + exp_block = Proc.new { |blk| + exp_block_called = true + passed_block = blk + } + + se = Expectation.new(:mock => @mock, :method => 'some_func', :block => exp_block, + :arguments => []) + + set_flag = false + runtime_block = Proc.new { set_flag = true } + + assert_nil passed_block, "Passed block should be nil" + assert !set_flag, "set_flag should be off" + + # Go + se.apply_method_call( @mock, 'some_func', [], runtime_block) + + # Examine the passed block + assert exp_block_called, "Expectation block not called" + assert_not_nil passed_block, "Should have been passed a block" + assert !set_flag, "set_flag should still be off" + passed_block.call + assert set_flag, "set_flag should be on" + end + + def test_apply_method_call_fails_when_theres_no_expectation_block_to_handle_the_runtime_block + se = Expectation.new(:mock => @mock, :method => 'some_func', :arguments => []) + runtime_block = Proc.new { set_flag = true } + err = assert_raise ExpectationError do + se.apply_method_call( @mock, 'some_func', [], runtime_block) + end + assert_match(/unexpected block/i, err.message) + assert_match(/the_mock.some_func()/i, err.message) + end + + def test_returns + se = Expectation.new(:mock => @mock, :method => 'some_func', + :arguments => [1,'two',:three]) + + se.returns "A value" + + assert_equal "A value", se.apply_method_call(@mock, 'some_func', [1,'two',:three], nil) + end + + def test_apply_method_call_captures_block_value + the_proc = lambda { "in the block" } + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => [], :block => the_proc) + + assert_nil se.block_value, "Block value starts out nil" + + se.apply_method_call(@mock, 'do_it', [], nil) + + assert_equal "in the block", se.block_value, "Block value not captured" + end + + def test_trigger + # convenience method for block_value.call + target = false + inner_proc = lambda { target = true } + the_proc = lambda { inner_proc } + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => [], :block => the_proc) + + assert_nil se.block_value, "Block value starts out nil" + se.apply_method_call(@mock, 'do_it', [], nil) + assert_not_nil se.block_value, "Block value not set" + + assert !target, "Target should still be false" + se.trigger + assert target, "Target not true!" + end + + def test_trigger_with_arguments + # convenience method for block_value.call + target = nil + inner_proc = lambda { |one,two| target = [one,two] } + the_proc = lambda { inner_proc } + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => [], :block => the_proc) + + assert_nil se.block_value, "Block value starts out nil" + se.apply_method_call(@mock, 'do_it', [], nil) + assert_not_nil se.block_value, "Block value not set" + + assert_nil target, "target should still be nil" + se.trigger 'cat','dog' + assert_equal ['cat','dog'], target + end + + def test_trigger_nil_block_value + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => []) + + assert_nil se.block_value, "Block value starts out nil" + se.apply_method_call(@mock, 'do_it', [], nil) + assert_nil se.block_value, "Block value should still be nil" + + err = assert_raise ExpectationError do + se.trigger + end + assert_match(/do_it/i, err.message) + assert_match(/block value/i, err.message) + end + + def test_trigger_non_proc_block_value + the_block = lambda { "woops" } + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => [], :block => the_block) + + se.apply_method_call(@mock, 'do_it', [], nil) + assert_equal "woops", se.block_value + + err = assert_raise ExpectationError do + se.trigger + end + assert_match(/do_it/i, err.message) + assert_match(/trigger/i, err.message) + assert_match(/woops/i, err.message) + end + + + + def test_proc_used_for_return + the_proc = lambda { "in the block" } + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => [], :block => the_proc) + + assert_equal "in the block", se.apply_method_call(@mock, 'do_it', [], nil) + assert_equal "in the block", se.block_value, "Captured block value affected wrongly" + end + + def test_explicit_return_overrides_proc_return + the_proc = lambda { "in the block" } + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => [], :block => the_proc) + se.returns "the override" + assert_equal "the override", se.apply_method_call(@mock, 'do_it', [], nil) + assert_equal "in the block", se.block_value, "Captured block value affected wrongly" + end + + def test_yields + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] ) + se.yields :bean1, :bean2 + + things = [] + a_block = lambda { |thinger| things << thinger } + + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + assert_equal [:bean1,:bean2], things, "Wrong things" + end + + def test_yields_block_takes_no_arguments + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] ) + se.yields + + things = [] + a_block = lambda { things << 'OOF' } + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + assert_equal ['OOF'], things + end + + def test_yields_params_to_block_takes_no_arguments + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] ) + se.yields :wont_fit + + things = [] + a_block = lambda { things << 'WUP' } + + err = assert_raise ExpectationError do + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + end + assert_match(/wont_fit/i, err.message) + assert_match(/arity -1/i, err.message) + assert_equal [], things, "Wrong things" + end + + def test_yields_with_returns + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] , + :returns => 'the results') + + exp = se.yields :bean1, :bean2 + assert_same se, exp, "'yields' needs to return a reference to the expectation" + things = [] + a_block = lambda { |thinger| things << thinger } + returned = se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + assert_equal [:bean1,:bean2], things, "Wrong things" + assert_equal 'the results', returned, "Wrong return value" + end + + def test_yields_with_raises + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot], + :raises => RuntimeError.new("kerboom")) + + exp = se.yields :bean1, :bean2 + assert_same se, exp, "'yields' needs to return a reference to the expectation" + things = [] + a_block = lambda { |thinger| things << thinger } + err = assert_raise RuntimeError do + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + end + assert_match(/kerboom/i, err.message) + assert_equal [:bean1,:bean2], things, "Wrong things" + end + + def test_yields_and_inner_block_explodes + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot]) + + exp = se.yields :bean1, :bean2 + assert_same se, exp, "'yields' needs to return a reference to the expectation" + things = [] + a_block = lambda { |thinger| + things << thinger + raise "nasty" + } + err = assert_raise RuntimeError do + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + end + assert_match(/nasty/i, err.message) + assert_equal [:bean1], things, "Wrong things" + end + + def test_yields_with_several_arrays + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] ) + se.yields ['a','b'], ['c','d'] + + things = [] + a_block = lambda { |thinger| things << thinger } + + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + assert_equal [ ['a','b'], ['c','d'] ], things, "Wrong things" + end + + def test_yields_tuples + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] ) + se.yields ['a','b','c'], ['d','e','f'] + + things = [] + a_block = lambda { |left,mid,right| + things << { :left => left, :mid => mid, :right => right } + } + + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + assert_equal [ + {:left => 'a', :mid => 'b', :right => 'c' }, + {:left => 'd', :mid => 'e', :right => 'f' }, + ], things, "Wrong things" + end + + def test_yields_tuples_size_mismatch + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] ) + se.yields ['a','b','c'], ['d','e','f'] + + things = [] + a_block = lambda { |left,mid| + things << { :left => left, :mid => mid } + } + + err = assert_raise ExpectationError do + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + end + assert_match(/arity/i, err.message) + assert_match(/the_mock.each_bean/i, err.message) + assert_match(/"a", "b", "c"/i, err.message) + assert_equal [], things, "Wrong things" + end + + def test_yields_bad_block_arity + se = Expectation.new(:mock => @mock, :method => 'do_later', :arguments => [] ) + se.yields + + assert_error Hardmock::ExpectationError, /block/i, /expected/i, /no param/i, /got 2/i do + se.apply_method_call(@mock,'do_later',[],lambda { |doesnt,match| raise "Surprise!" } ) + end + end + + def test_that_arguments_can_be_added_to_expectation + expectation = Expectation.new(:mock => @mock, :method => "each_bean") + assert_same expectation, expectation.with("jello", "for", "cosby"), "should have returned the same expectation" + + err = assert_raise ExpectationError do + expectation.apply_method_call(@mock, 'each_bean', [], nil) + end + assert_match(/wrong arguments/i, err.message) + + assert_nothing_raised(ExpectationError) do + expectation.apply_method_call(@mock, 'each_bean', ["jello", "for", "cosby"], nil) + end + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/expector_test.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/expector_test.rb new file mode 100644 index 0000000..f420db2 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/expector_test.rb @@ -0,0 +1,57 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/expector' + +class ExpectorTest < Test::Unit::TestCase + include Hardmock + + class MyControl + attr_reader :added + def add_expectation(expectation) + @added ||= [] + @added << expectation + end + end + + class ExpBuilder + attr_reader :options + def build_expectation(options) + @options = options + "dummy expectation" + end + end + + def try_it_with(method_name) + mock = Object.new + mock_control = MyControl.new + builder = ExpBuilder.new + + exp = Expector.new(mock, mock_control, builder) + output = exp.send(method_name,:with, 1, 'sauce') + + assert_same mock, builder.options[:mock] + assert_equal method_name, builder.options[:method].to_s + assert_equal [:with,1,'sauce'], builder.options[:arguments] + assert_nil builder.options[:block] + assert_equal [ "dummy expectation" ], mock_control.added, + "Wrong expectation added to control" + + assert_equal "dummy expectation", output, "Expectation should have been returned" + end + + # + # TESTS + # + def test_method_missing + try_it_with 'wonder_bread' + try_it_with 'whatever' + end + + def test_methods_that_wont_trigger_method_missing + mock = Object.new + mock_control = MyControl.new + builder = ExpBuilder.new + + exp = Expector.new(mock, mock_control, builder) + assert_equal mock, exp.instance_eval("@mock") + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/method_cleanout_test.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/method_cleanout_test.rb new file mode 100644 index 0000000..7aa6293 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/method_cleanout_test.rb @@ -0,0 +1,36 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/method_cleanout' + +class MethodCleanoutTest < Test::Unit::TestCase + class Victim + OriginalMethods = instance_methods + include Hardmock::MethodCleanout + end + + def setup + @victim = Victim.new + end + + def test_should_remove_most_methods_from_a_class + expect_removed = Victim::OriginalMethods.reject { |m| + Hardmock::MethodCleanout::SACRED_METHODS.include?(m) + } + expect_removed.each do |m| + assert !@victim.respond_to?(m), "should not have method #{m}" + end + end + + def test_should_leave_the_sacred_methods_defined + Hardmock::MethodCleanout::SACRED_METHODS.each do |m| + next if m =~ /^hm_/ + assert @victim.respond_to?(m), "Sacred method '#{m}' was removed unexpectedly" + end + end + + def test_should_include_certain_important_methods_in_the_sacred_methods_list + %w|__id__ __send__ equal? object_id send nil? class kind_of? respond_to? inspect method to_s instance_variables instance_eval|.each do |m| + assert Hardmock::MethodCleanout::SACRED_METHODS.include?(m), "important method #{m} is not included in SACRED_METHODS" + end + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/mock_control_test.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/mock_control_test.rb new file mode 100644 index 0000000..3c52db6 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/mock_control_test.rb @@ -0,0 +1,175 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/utils' +require 'hardmock/errors' +require 'hardmock/mock_control' + +class MockControlTest < Test::Unit::TestCase + include Hardmock + + def setup + @unmock = OpenStruct.new( :_name => 'fakemock' ) + + @control = MockControl.new + assert @control.happy?, "Control should start out happy" + end + + def teardown + end + + # + # HELPERS + # + + class MyExp + attr_reader :mock, :mname, :args, :block + def apply_method_call(mock, mname, args, block) + @mock = mock + @mname = mname + @args = args + @block = block + end + end + + class BoomExp < MyExp + def apply_method_call(mock, mname, args, block) + super + raise "BOOM" + end + end + + # + # TESTS + # + + def test_add_exepectation_and_apply_method_call + e1 = MyExp.new + + @control.add_expectation e1 + assert !@control.happy? + + @control.apply_method_call @unmock, 'some_func', [ 'the', :args ], nil + assert @control.happy? + + assert_same @unmock, e1.mock, "Wrong mock" + assert_equal 'some_func', e1.mname, "Wrong method" + assert_equal [ 'the', :args ], e1.args, "Wrong args" + + @control.verify + end + + def test_add_exepectation_and_apply_method_call_with_block + e1 = MyExp.new + + @control.add_expectation e1 + assert !@control.happy? + + runtime_block = Proc.new { "hello" } + @control.apply_method_call @unmock, 'some_func', [ 'the', :args ], runtime_block + assert @control.happy? + + assert_same @unmock, e1.mock, "Wrong mock" + assert_equal 'some_func', e1.mname, "Wrong method" + assert_equal [ 'the', :args ], e1.args, "Wrong args" + assert_equal "hello", e1.block.call, "Wrong block in expectation" + + @control.verify + end + + def test_add_expectation_then_verify + e1 = MyExp.new + + @control.add_expectation e1 + assert !@control.happy?, "Shoudn't be happy" + err = assert_raise VerifyError do + @control.verify + end + assert_match(/unmet expectations/i, err.message) + + @control.apply_method_call @unmock, 'some_func', [ 'the', :args ], nil + assert @control.happy? + + assert_same @unmock, e1.mock, "Wrong mock" + assert_equal 'some_func', e1.mname, "Wrong method" + assert_equal [ 'the', :args ], e1.args, "Wrong args" + + @control.verify + end + + def test_expectation_explosion + be1 = BoomExp.new + + @control.add_expectation be1 + + err = assert_raise RuntimeError do + @control.apply_method_call @unmock, 'a func', [:arg], nil + end + assert_match(/BOOM/i, err.message) + + assert_same @unmock, be1.mock + assert_equal 'a func', be1.mname + assert_equal [:arg], be1.args + end + + def test_disappointment_on_bad_verify + @control.add_expectation MyExp.new + assert !@control.happy?, "Shouldn't be happy" + assert !@control.disappointed?, "too early to be disappointed" + + # See verify fails + err = assert_raise VerifyError do + @control.verify + end + assert_match(/unmet expectations/i, err.message) + + assert !@control.happy?, "Still have unmet expectation" + assert @control.disappointed?, "We should be disappointed following that failure" + + @control.apply_method_call @unmock, 'something', [], nil + assert @control.happy?, "Should be happy" + assert @control.disappointed?, "We should be skeptical" + + @control.verify + + assert !@control.disappointed?, "Should be non-disappointed" + end + + def test_disappointment_from_surprise_calls + assert @control.happy?, "Should be happy" + assert !@control.disappointed?, "too early to be disappointed" + + # See verify fails + err = assert_raise ExpectationError do + @control.apply_method_call @unmock, "something", [], nil + end + assert_match(/surprise/i, err.message) + + assert @control.happy?, "Happiness is an empty list of expectations" + assert @control.disappointed?, "We should be disappointed following that failure" + + @control.verify + assert !@control.disappointed?, "Disappointment should be gone" + end + + def test_disappointment_from_bad_calls + be1 = BoomExp.new + assert !@control.disappointed?, "Shouldn't be disappointed" + @control.add_expectation be1 + assert !@control.disappointed?, "Shouldn't be disappointed" + + err = assert_raise RuntimeError do + @control.apply_method_call @unmock, 'a func', [:arg], nil + end + assert_match(/BOOM/i, err.message) + assert @control.disappointed?, "Should be disappointed" + + assert_same @unmock, be1.mock + assert_equal 'a func', be1.mname + assert_equal [:arg], be1.args + + assert @control.happy?, "Happiness is an empty list of expectations" + @control.verify + assert !@control.disappointed?, "Disappointment should be gone" + end + + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/mock_test.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/mock_test.rb new file mode 100644 index 0000000..2579bcc --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/mock_test.rb @@ -0,0 +1,279 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/method_cleanout' +require 'hardmock/mock' +require 'hardmock/mock_control' +require 'hardmock/expectation_builder' +require 'hardmock/expector' +require 'hardmock/trapper' + +class MockTest < Test::Unit::TestCase + include Hardmock + + def test_build_with_control + mc1 = MockControl.new + mock = Mock.new('hi', mc1) + assert_equal 'hi', mock._name, "Wrong name" + assert_same mc1, mock._control, "Wrong contol" + end + + def test_basics + mock = Mock.new('a name') + assert_equal 'a name', mock._name, "Wrong name for mock" + assert_not_nil mock._control, "Nil control in mock" + end + + def test_expects + mock = Mock.new('order') + control = mock._control + assert control.happy?, "Mock should start out satisfied" + + mock.expects.absorb_something(:location, 'garbage') + assert !control.happy?, "mock control should be unhappy" + + # Do the call + mock.absorb_something(:location, 'garbage') + assert control.happy?, "mock control should be happy again" + + # Verify + assert_nothing_raised Exception do + mock._verify + end + end + + def test_expects_using_arguments_for_method_and_arguments + mock = Mock.new('order') + mock.expects(:absorb_something, :location, 'garbage') + mock.absorb_something(:location, 'garbage') + mock._verify + end + + def test_expects_using_arguments_for_method_and_arguments_with_block + mock = Mock.new('order') + mock.expects(:absorb_something, :location, 'garbage') { |a,b,block| + assert_equal :location, a, "Wrong 'a' argument" + assert_equal 'garbage', b, "Wrong 'b' argument" + assert_equal 'innards', block.call, "Wrong block" + } + mock.absorb_something(:location, 'garbage') do "innards" end + mock._verify + end + + def test_expects_using_string_method_name + mock = Mock.new('order') + mock.expects('absorb_something', :location, 'garbage') + mock.absorb_something(:location, 'garbage') + mock._verify + end + + + def test_expects_assignment + mock = Mock.new('order') + mock.expects.account_number = 1234 + + mock.account_number = 1234 + + mock._verify + end + + def test_expects_assigment_using_arguments_for_method_and_arguments + mock = Mock.new('order') + mock.expects(:account_number=, 1234) + mock.account_number = 1234 + mock._verify + end + + def test_expects_assigment_using_string_method_name + mock = Mock.new('order') + mock.expects('account_number=', 1234) + mock.account_number = 1234 + mock._verify + end + + def test_expects_assignment_and_return_is_overruled_by_ruby_syntax + # Prove that we can set up a return but that it doesn't mean much, + # because ruby's parser will 'do the right thing' as regards semantic + # values for assignment. (That is, the rvalue of the assignment) + mock = Mock.new('order') + mock.expects(:account_number=, 1234).returns "gold" + got = mock.account_number = 1234 + mock._verify + assert_equal 1234, got, "Expected rvalue" + end + + def test_expects_assignment_and_raise + mock = Mock.new('order') + mock.expects(:account_number=, 1234).raises StandardError.new("kaboom") + err = assert_raise StandardError do + mock.account_number = 1234 + end + assert_match(/kaboom/i, err.message) + mock._verify + end + + + def test_expects_multiple + mock = Mock.new('order') + control = mock._control + + assert control.happy? + + mock.expects.one_thing :hi, { :goose => 'neck' } + mock.expects.another 5,6,7 + assert !control.happy? + + mock.one_thing :hi, { :goose => 'neck' } + assert !control.happy? + + mock.another 5,6,7 + assert control.happy? + end + + def test_surprise_call + mock = Mock.new('order') + err = assert_raise ExpectationError do + mock.uh_oh + end + assert_match(/surprise/i, err.message) + assert_match(/uh_oh/i, err.message) + + err = assert_raise ExpectationError do + mock.whoa :horse + end + assert_match(/surprise/i, err.message) + assert_match(/order\.whoa\(:horse\)/i, err.message) + end + + def test_wrong_call + mock = Mock.new('order') + mock.expects.pig 'arse' + err = assert_raise ExpectationError do + mock.whoa :horse + end + assert_match(/wrong method/i, err.message) + assert_match(/order\.whoa\(:horse\)/i, err.message) + assert_match(/order\.pig\("arse"\)/i, err.message) + end + + def test_wrong_arguments + mock = Mock.new('order') + mock.expects.go_fast(:a, 1, 'three') + + err = assert_raise ExpectationError do + mock.go_fast :a, 1, 'not right' + end + assert_match(/wrong argument/i, err.message) + assert_match(/order\.go_fast\(:a, 1, "three"\)/i, err.message) + assert_match(/order\.go_fast\(:a, 1, "not right"\)/i, err.message) + end + + def test_expects_and_return + mock = Mock.new('order') + mock.expects.delivery_date.returns Date.today + assert_equal Date.today, mock.delivery_date + mock._verify + end + + def test_expects_and_return_with_arguments + mock = Mock.new('order') + mock.expects.delivery_date(:arf,14).returns(Date.today) + assert_equal Date.today, mock.delivery_date(:arf,14) + mock._verify + end + + def test_expects_and_raise + mock = Mock.new('order') + mock.expects.delivery_date.raises StandardError.new("bloof") + + err = assert_raise StandardError do + mock.delivery_date + end + assert_match(/bloof/i, err.message) + + mock._verify + + # Try convenience argument String + mock.expects.pow.raises "hell" + err = assert_raise RuntimeError do + mock.pow + end + assert_match(/hell/i, err.message) + + mock._verify + + # Try convenience argument nothing + mock.expects.pow.raises + err = assert_raise RuntimeError do + mock.pow + end + assert_match(/an error/i, err.message) + + mock._verify + end + + def test_expects_a_runtime_block + mock = Mock.new('order') + got_val = nil + + mock.expects.when(:something) { |e,block| + got_val = block.call + } + + mock.when :something do "hi there" end + + assert_equal "hi there", got_val, "Expectation block not invoked" + mock._verify + end + + def test_trap_block + mock = Mock.new('order') + exp = mock.trap.observe + + # use it + mock.observe { "burp" } + + assert_equal "burp", exp.block_value.call + end + + def test_trap_arguments_and_block + mock = Mock.new('order') + exp = mock.trap.subscribe(:data_changed) + + # use it + mock.subscribe(:data_changed) { "burp" } + assert_equal "burp", exp.block_value.call + mock._verify + end + + def test_trap_arguments_and_block_wrong_num_args + mock = Mock.new('order') + exp = mock.trap.subscribe(:data_changed) + + assert_raise ExpectationError do + mock.subscribe(:data_changed,1) { "burp" } + end + mock._verify + end + + def test_trap_arguments_and_block_wrong_args + mock = Mock.new('order') + exp = mock.trap.subscribe(:data_changed) + + assert_raise ExpectationError do + mock.subscribe("no good") { "burp" } + end + + mock._verify + end + + def test_trap_is_not_leniant_about_arguments + mock = Mock.new('order') + exp = mock.trap.subscribe + + assert_raise ExpectationError do + mock.subscribe("no good") { "burp" } + end + + mock._verify + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/test_unit_before_after_test.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/test_unit_before_after_test.rb new file mode 100644 index 0000000..172f527 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/test_unit_before_after_test.rb @@ -0,0 +1,452 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") + +class TestUnitBeforeAfter < Test::Unit::TestCase + + # + # after_teardown + # + + it "adds TestCase.after_teardown hook for appending post-teardown actions" do + write_and_run_test :use_after_teardown => true + + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "THE TEARDOWN", + "1st after_teardown", + "2nd after_teardown", + "Finished in" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 0 + end + + should "execute all after_teardowns, even if the main teardown flunks" do + write_and_run_test :use_after_teardown => true, :flunk_in_teardown => true + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "F", + "1st after_teardown", + "2nd after_teardown", + "Finished in", + "1) Failure:", + "test_something(MyExampleTest) [_test_file_temp.rb:20]:", + "FLUNK IN TEARDOWN" + see_results :tests => 1, :assertions => 1, :failures => 1, :errors => 0 + end + + should "execute all after_teardowns, even if the main teardown explodes" do + write_and_run_test :use_after_teardown => true, :raise_in_teardown => true + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "E", + "1st after_teardown", + "2nd after_teardown", + "Finished in", + "RuntimeError: ERROR IN TEARDOWN" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 1 + end + + should "execute all after_teardowns, even if some of them flunk" do + write_and_run_test :use_after_teardown => true, :flunk_in_after_teardown => true + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "THE TEARDOWN", + "1st after_teardown", + "F", + "2nd after_teardown", + "Finished in", + "1) Failure:", + "test_something(MyExampleTest) [_test_file_temp.rb:7]:", + "Flunk in first after_teardown", + "2) Failure:", + "test_something(MyExampleTest) [_test_file_temp.rb:10]:", + "Flunk in second after_teardown" + see_results :tests => 1, :assertions => 2, :failures => 2, :errors => 0 + end + + should "execute all after_teardowns, even if some of them explode" do + write_and_run_test :use_after_teardown => true, :raise_in_after_teardown => true + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "THE TEARDOWN", + "1st after_teardown", + "E", + "2nd after_teardown", + "Finished in", + "RuntimeError: Error in first after_teardown", + "RuntimeError: Error in second after_teardown" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 2 + end + + it "will run after_teardowns in the absence of a regular teardown" do + write_and_run_test :omit_teardown => true, :use_after_teardown => true + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "1st after_teardown", + "2nd after_teardown", + "Finished in" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 0 + end + + should "not interfere with normal test writing" do + write_and_run_test + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "THE TEARDOWN", + "Finished in" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 0 + end + + it "provides a cleaned-up backtrace" do + write_and_run_test :with_failure => true + see_in_order "Loaded suite", + "THE SETUP", + "A FAILING TEST", + "F", "THE TEARDOWN", + "Finished in", + "1) Failure:", + "test_something(MyExampleTest) [_test_file_temp.rb:17]:", + "Instrumented failure.", + " is not true." + see_results :tests => 1, :assertions => 1, :failures => 1, :errors => 0 + end + + it "provides a cleaned-up backtrace, but not TOO cleaned up" do + write_and_run_test :with_failure => true, :use_helpers => true + see_in_order "Loaded suite", + "THE SETUP", + "A FAILING TEST", + "F", "THE TEARDOWN", + "Finished in", + "1) Failure:", + "test_something(MyExampleTest)\n", + "[_test_file_temp.rb:25:in `tripwire'", + "_test_file_temp.rb:21:in `my_helper'", + "_test_file_temp.rb:17:in `test_something']:", + "Instrumented failure.", + " is not true." + see_results :tests => 1, :assertions => 1, :failures => 1, :errors => 0 + end + + should "not interfere with passthrough exception types" do + if is_modern_test_unit? + write_and_run_test :raise_nasty_in_test => true + see_in_no_particular_order "Loaded suite", + "THE TEARDOWN", + "_test_file_temp.rb:16:in `test_something': NASTY ERROR (NoMemoryError)" + see_no_results + end + end + + # + # before_setup + # + + it "adds TestCase.before_setup hook for prepending pre-setup actions" do + write_and_run_test :use_before_setup => true + see_in_order "Loaded suite", + "3rd before_setup", + "2nd before_setup", + "1st before_setup", + "THE SETUP", + "A TEST", + "THE TEARDOWN", + "Finished in" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 0 + end + + should "stop executing the test on the first failure withing a before_setup action" do + write_and_run_test :use_before_setup => true, :flunk_in_before_setup => true + see_in_order "Loaded suite", + "3rd before_setup", + "2nd before_setup", + "FTHE TEARDOWN", + "1) Failure:", + "test_something(MyExampleTest) [_test_file_temp.rb:10]:", + "Flunk in 2nd before_setup." + see_results :tests => 1, :assertions => 1, :failures => 1, :errors => 0 + end + + should "stop executing the test on the first error within a before_setup action" do + write_and_run_test :use_before_setup => true, :raise_in_before_setup => true + see_in_order "Loaded suite", + "3rd before_setup", + "2nd before_setup", + "ETHE TEARDOWN", + "Finished in", + "test_something(MyExampleTest):", + "RuntimeError: Error in 2nd before_setup", + "_test_file_temp.rb:10", + "/hardmock/lib/test_unit_before_after.rb:", ":in `call'" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 1 + end + + it "will run before_setup actions in the absence of a regular setup" do + write_and_run_test :omit_setup => true, :use_before_setup => true + see_in_order "Loaded suite", + "3rd before_setup", + "2nd before_setup", + "1st before_setup", + "A TEST", + "THE TEARDOWN", + "Finished in" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 0 + end + + it "allows before_setup and after_teardown to be used at the same time" do + write_and_run_test :use_before_setup => true, :use_after_teardown => true + see_in_order "Loaded suite", + "3rd before_setup", + "2nd before_setup", + "1st before_setup", + "A TEST", + "THE TEARDOWN", + "1st after_teardown", + "2nd after_teardown", + "Finished in" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 0 + end + + # + # HELPERS + # + + def teardown + remove_test + end + + def test_filename + "_test_file_temp.rb" + end + + def remove_test + rm_f test_filename + end + + def write_and_run_test(opts={}) + write(test_filename, generate_test_code(opts)) + run_test + end + + def run_test + @output = `ruby #{test_filename} 2>&1` + end + + + def write(fname, code) + File.open(fname,"w") do |f| + f.print code + end + end + + def show_output + puts "-- BEGIN TEST OUTPUT" + puts @output + puts "-- END TEST OUTPUT" + end + + def see_in_order(*phrases) + idx = 0 + phrases.each do |txt| + idx = @output.index(txt, idx) + if idx.nil? + if @output.index(txt) + flunk "Phrase '#{txt}' is out-of-order in test output:\n#{@output}" + else + flunk "Phrase '#{txt}' not found in test output:\n#{@output}" + end + end + end + end + + def see_in_no_particular_order(*phrases) + phrases.each do |txt| + assert_not_nil @output.index(txt), "Didn't see '#{txt}' in test output:\n#{@output}" + end + end + + def see_results(opts) + if @output =~ /(\d+) tests, (\d+) assertions, (\d+) failures, (\d+) errors/ + tests, assertions, failures, errors = [ $1, $2, $3, $4 ] + [:tests, :assertions, :failures, :errors].each do |key| + eval %{assert_equal(opts[:#{key}].to_s, #{key}, "Wrong number of #{key} in report") if opts[:#{key}]} + end + else + flunk "Didn't see the test results report line" + end + end + + def see_no_results + if @output =~ /\d+ tests, \d+ assertions, \d+ failures, \d+ errors/ + flunk "Should not have had a results line:\n#{@output}" + end + end + + def lib_dir + File.expand_path(File.dirname(__FILE__) + "/../../lib") + end + + def generate_test_code(opts={}) + + if opts[:with_failure] or opts[:raise_nasty_in_test] + test_method_code = generate_failing_test("test_something", opts) + else + test_method_code = generate_passing_test("test_something") + end + + + requires_for_ext = '' + if opts[:use_before_setup] or opts[:use_after_teardown] + requires_for_ext =<<-RFE + $: << "#{lib_dir}" + require 'test_unit_before_after' + RFE + end + + before_setups = '' + if opts[:use_before_setup] + add_on_two = "" + if opts[:flunk_in_before_setup] + add_on_two = %{; test.flunk "Flunk in 2nd before_setup"} + elsif opts[:raise_in_before_setup] + add_on_two = %{; raise "Error in 2nd before_setup"} + end + before_setups =<<-BSTS + Test::Unit::TestCase.before_setup do |test| + puts "1st before_setup" + end + Test::Unit::TestCase.before_setup do |test| + puts "2nd before_setup" #{add_on_two} + end + Test::Unit::TestCase.before_setup do |test| + puts "3rd before_setup" + end + + BSTS + end + + + setup_code =<<-SC + def setup + puts "THE SETUP" + end + SC + if opts[:omit_setup] + setup_code = "" + end + + after_teardowns = '' + if opts[:use_after_teardown] + add_on_one = "" + add_on_two = "" + if opts[:flunk_in_after_teardown] + add_on_one = %{; test.flunk "Flunk in first after_teardown"} + add_on_two = %{; test.flunk "Flunk in second after_teardown"} + elsif opts[:raise_in_after_teardown] + add_on_one = %{; raise "Error in first after_teardown"} + add_on_two = %{; raise "Error in second after_teardown"} + end + after_teardowns =<<-ATDS + Test::Unit::TestCase.after_teardown do |test| + puts "1st after_teardown" #{add_on_one} + end + Test::Unit::TestCase.after_teardown do |test| + puts "2nd after_teardown" #{add_on_two} + end + ATDS + end + + teardown_code =<<-TDC + def teardown + puts "THE TEARDOWN" + end + TDC + if opts[:flunk_in_teardown] + teardown_code =<<-TDC + def teardown + flunk "FLUNK IN TEARDOWN" + end + TDC + elsif opts[:raise_in_teardown] + teardown_code =<<-TDC + def teardown + raise "ERROR IN TEARDOWN" + end + TDC + end + if opts[:omit_teardown] + teardown_code = "" + end + + str = <<-TCODE + require 'test/unit' + #{requires_for_ext} + + #{before_setups} #{after_teardowns} + + class MyExampleTest < Test::Unit::TestCase + #{setup_code} + #{teardown_code} + #{test_method_code} + end + TCODE + end + + def generate_passing_test(tname) + str = <<-TMETH + def #{tname} + puts "A TEST" + end + TMETH + end + + def generate_failing_test(tname, opts={}) + str = "NOT DEFINED?" + if opts[:raise_nasty_in_test] + str = <<-TMETH + def #{tname} + raise NoMemoryError, "NASTY ERROR" + end + TMETH + + elsif opts[:use_helpers] + str = <<-TMETH + def #{tname} + puts "A FAILING TEST" + my_helper + end + + def my_helper + tripwire + end + + def tripwire + assert false, "Instrumented failure" + end + TMETH + else + str = <<-TMETH + def #{tname} + puts "A FAILING TEST" + assert false, "Instrumented failure" + end + TMETH + end + return str + end + + def is_modern_test_unit? + begin + Test::Unit::TestCase::PASSTHROUGH_EXCEPTIONS + return true + rescue NameError + return false + end + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/trapper_test.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/trapper_test.rb new file mode 100644 index 0000000..f7d4114 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/trapper_test.rb @@ -0,0 +1,62 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/method_cleanout' +require 'hardmock/trapper' + +class TrapperTest < Test::Unit::TestCase + include Hardmock + + def setup + @mock = Object.new + @mock_control = MyControl.new + @builder = ExpBuilder.new + @trapper = Trapper.new(@mock, @mock_control, @builder) + end + + # + # HELPERS + # + + class MyControl + attr_reader :added + def add_expectation(expectation) + @added ||= [] + @added << expectation + end + end + + class ExpBuilder + attr_reader :options + def build_expectation(options) + @options = options + "dummy expectation" + end + end + + # + # TESTS + # + + def test_method_missing + + output = @trapper.change(:less) + + assert_same @mock, @builder.options[:mock] + assert_equal :change, @builder.options[:method] + assert_equal [:less], @builder.options[:arguments] + assert_not_nil @builder.options[:block] + assert @builder.options[:suppress_arguments_to_block], ":suppress_arguments_to_block should be set" + assert_equal [ "dummy expectation" ], @mock_control.added, + "Wrong expectation added to control" + + assert_equal "dummy expectation", output, "Expectation should have been returned" + + # Examine the block. It should take one argument and simply return + # that argument. because of the 'suppress arguments to block' + # setting, the argument can only end up being a block, in practice. + trapper_block = @builder.options[:block] + assert_equal "the argument", trapper_block.call("the argument"), + "The block should merely return the passed argument" + end + + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/verify_error_test.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/verify_error_test.rb new file mode 100644 index 0000000..ecd23fd --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/verify_error_test.rb @@ -0,0 +1,40 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/method_cleanout' +require 'hardmock/mock_control' +require 'hardmock/errors' +require 'hardmock/expectation_builder' +require 'hardmock/expectation' +require 'hardmock/mock' + +class VerifyErrorTest < Test::Unit::TestCase + include Hardmock + + # + # TESTS + # + + def test_formatted_list_of_unmet_expectations + mock1 = Mock.new('mock1') + mock2 = Mock.new('mock2') + exp1 = Expectation.new( :mock => mock1, :method => 'send_parts', :arguments => [1,2,:a] ) + exp2 = Expectation.new( :mock => mock2, :method => 'grind_it', :arguments => [] ) + + exp_list = [ exp1, exp2 ] + + err = VerifyError.new("This is the error", exp_list) + assert_equal "This is the error:\n * #{exp1.to_s}\n * #{exp2.to_s}", err.message + end + + def test_empty_list_of_expectations + # this is not a normal case; not spending a lot of time to make this better + exp_list = [] + err = VerifyError.new("This is the error:\n", exp_list) + end + + def test_nil_expectation_list + # this is not a normal case; not spending a lot of time to make this better + exp_list = [] + err = VerifyError.new("This is the error:\n", exp_list) + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/auto/colour_prompt.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/auto/colour_prompt.rb new file mode 100644 index 0000000..81003dd --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/auto/colour_prompt.rb @@ -0,0 +1,94 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +if RUBY_PLATFORM =~/(win|w)32$/ + begin + require 'Win32API' + rescue LoadError + puts "ERROR! \"Win32API\" library not found" + puts "\"Win32API\" is required for colour on a windows machine" + puts " try => \"gem install Win32API\" on the command line" + puts + end + # puts + # puts 'Windows Environment Detected...' + # puts 'Win32API Library Found.' + # puts +end + +class ColourCommandLine + def initialize + if RUBY_PLATFORM =~/(win|w)32$/ + get_std_handle = Win32API.new("kernel32", "GetStdHandle", ['L'], 'L') + @set_console_txt_attrb = + Win32API.new("kernel32","SetConsoleTextAttribute",['L','N'], 'I') + @hout = get_std_handle.call(-11) + end + end + + def change_to(new_colour) + if RUBY_PLATFORM =~/(win|w)32$/ + @set_console_txt_attrb.call(@hout,self.win32_colour(new_colour)) + else + "\033[30;#{posix_colour(new_colour)};22m" + end + end + + def win32_colour(colour) + case colour + when :black then 0 + when :dark_blue then 1 + when :dark_green then 2 + when :dark_cyan then 3 + when :dark_red then 4 + when :dark_purple then 5 + when :dark_yellow, :narrative then 6 + when :default_white, :default, :dark_white then 7 + when :silver then 8 + when :blue then 9 + when :green, :success then 10 + when :cyan, :output then 11 + when :red, :failure then 12 + when :purple then 13 + when :yellow then 14 + when :white then 15 + else + 0 + end + end + + def posix_colour(colour) + case colour + when :black then 30 + when :red, :failure then 31 + when :green, :success then 32 + when :yellow then 33 + when :blue, :narrative then 34 + when :purple, :magenta then 35 + when :cyan, :output then 36 + when :white, :default_white, :default then 37 + else + 30 + end + end + + def out_c(mode, colour, str) + case RUBY_PLATFORM + when /(win|w)32$/ + change_to(colour) + $stdout.puts str if mode == :puts + $stdout.print str if mode == :print + change_to(:default_white) + else + $stdout.puts("#{change_to(colour)}#{str}\033[0m") if mode == :puts + $stdout.print("#{change_to(colour)}#{str}\033[0m") if mode == :print + end + end +end # ColourCommandLine + +def colour_puts(role,str) ColourCommandLine.new.out_c(:puts, role, str) end +def colour_print(role,str) ColourCommandLine.new.out_c(:print, role, str) end + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/auto/colour_reporter.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/auto/colour_reporter.rb new file mode 100644 index 0000000..5aa1d27 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/auto/colour_reporter.rb @@ -0,0 +1,39 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require "#{File.expand_path(File.dirname(__FILE__))}/colour_prompt" + +$colour_output = true + +def report(message) + if not $colour_output + $stdout.puts(message) + else + message = message.join('\n') if (message.class == Array) + message.each_line do |line| + line.chomp! + colour = case(line) + when /(?:total\s+)?tests:?\s+(\d+)\s+(?:total\s+)?failures:?\s+\d+\s+Ignored:?/i + ($1.to_i == 0) ? :green : :red + when /PASS/ + :green + when /^OK$/ + :green + when /(?:FAIL|ERROR)/ + :red + when /IGNORE/ + :yellow + when /^(?:Creating|Compiling|Linking)/ + :white + else + :silver + end + colour_puts(colour, line) + end + end + $stdout.flush + $stderr.flush +end \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/auto/generate_config.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/auto/generate_config.yml new file mode 100644 index 0000000..4a5e474 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/auto/generate_config.yml @@ -0,0 +1,36 @@ +#this is a sample configuration file for generate_module +#you would use it by calling generate_module with the -ygenerate_config.yml option +#files like this are useful for customizing generate_module to your environment +:generate_module: + :defaults: + #these defaults are used in place of any missing options at the command line + :path_src: ../src/ + :path_inc: ../src/ + :path_tst: ../test/ + :update_svn: true + :includes: + #use [] for no additional includes, otherwise list the includes on separate lines + :src: + - Defs.h + - Board.h + :inc: [] + :tst: + - Defs.h + - Board.h + - Exception.h + :boilerplates: + #these are inserted at the top of generated files. + #just comment out or remove if not desired. + #use %1$s where you would like the file name to appear (path/extension not included) + :src: | + //------------------------------------------- + // %1$s.c + //------------------------------------------- + :inc: | + //------------------------------------------- + // %1$s.h + //------------------------------------------- + :tst: | + //------------------------------------------- + // Test%1$s.c : Units tests for %1$s.c + //------------------------------------------- diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/auto/generate_module.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/auto/generate_module.rb new file mode 100644 index 0000000..3db1a98 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/auto/generate_module.rb @@ -0,0 +1,202 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +# This script creates all the files with start code necessary for a new module. +# A simple module only requires a source file, header file, and test file. +# Triad modules require a source, header, and test file for each triad type (like model, conductor, and hardware). + +require 'rubygems' +require 'fileutils' + +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +#help text when requested +HELP_TEXT = [ "\nGENERATE MODULE\n-------- ------", + "\nUsage: ruby generate_module [options] module_name", + " -i\"include\" sets the path to output headers to 'include' (DEFAULT ../src)", + " -s\"../src\" sets the path to output source to '../src' (DEFAULT ../src)", + " -t\"C:/test\" sets the path to output source to 'C:/test' (DEFAULT ../test)", + " -p\"MCH\" sets the output pattern to MCH.", + " dh - driver hardware.", + " dih - driver interrupt hardware.", + " mch - model conductor hardware.", + " mvp - model view presenter.", + " src - just a single source module. (DEFAULT)", + " -d destroy module instead of creating it.", + " -u update subversion too (requires subversion command line)", + " -y\"my.yml\" selects a different yaml config file for module generation", + "" ].join("\n") + +#Built in patterns +PATTERNS = { 'src' => {'' => { :inc => [] } }, + 'dh' => {'Driver' => { :inc => ['%1$sHardware.h'] }, + 'Hardware' => { :inc => [] } + }, + 'dih' => {'Driver' => { :inc => ['%1$sHardware.h', '%1$sInterrupt.h'] }, + 'Interrupt'=> { :inc => ['%1$sHardware.h'] }, + 'Hardware' => { :inc => [] } + }, + 'mch' => {'Model' => { :inc => [] }, + 'Conductor'=> { :inc => ['%1$sModel.h', '%1$sHardware.h'] }, + 'Hardware' => { :inc => [] } + }, + 'mvp' => {'Model' => { :inc => [] }, + 'Presenter'=> { :inc => ['%1$sModel.h', '%1$sView.h'] }, + 'View' => { :inc => [] } + } + } + +#TEMPLATE_TST +TEMPLATE_TST = %q[#include "unity.h" +%2$s#include "%1$s.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void test_%1$s_NeedToImplement(void) +{ + TEST_IGNORE(); +} +] + +#TEMPLATE_SRC +TEMPLATE_SRC = %q[%2$s#include "%1$s.h" +] + +#TEMPLATE_INC +TEMPLATE_INC = %q[#ifndef _%3$s_H +#define _%3$s_H%2$s + +#endif // _%3$s_H +] + +# Parse the command line parameters. +ARGV.each do |arg| + case(arg) + when /^-d/ then @destroy = true + when /^-u/ then @update_svn = true + when /^-p(\w+)/ then @pattern = $1 + when /^-s(.+)/ then @path_src = $1 + when /^-i(.+)/ then @path_inc = $1 + when /^-t(.+)/ then @path_tst = $1 + when /^-y(.+)/ then @yaml_config = $1 + when /^(\w+)/ + raise "ERROR: You can't have more than one Module name specified!" unless @module_name.nil? + @module_name = arg + when /^-(h|-help)/ + puts HELP_TEXT + exit + else + raise "ERROR: Unknown option specified '#{arg}'" + end +end +raise "ERROR: You must have a Module name specified! (use option -h for help)" if @module_name.nil? + +#load yaml file if one was requested +if @yaml_config + require 'yaml' + cfg = YAML.load_file(HERE + @yaml_config)[:generate_module] + @path_src = cfg[:defaults][:path_src] if @path_src.nil? + @path_inc = cfg[:defaults][:path_inc] if @path_inc.nil? + @path_tst = cfg[:defaults][:path_tst] if @path_tst.nil? + @update_svn = cfg[:defaults][:update_svn] if @update_svn.nil? + @extra_inc = cfg[:includes] + @boilerplates = cfg[:boilerplates] +else + @boilerplates = {} +end + +# Create default file paths if none were provided +@path_src = HERE + "../src/" if @path_src.nil? +@path_inc = @path_src if @path_inc.nil? +@path_tst = HERE + "../test/" if @path_tst.nil? +@path_src += '/' unless (@path_src[-1] == 47) +@path_inc += '/' unless (@path_inc[-1] == 47) +@path_tst += '/' unless (@path_tst[-1] == 47) +@pattern = 'src' if @pattern.nil? +@includes = { :src => [], :inc => [], :tst => [] } +@includes.merge!(@extra_inc) unless @extra_inc.nil? + +#create triad definition +TRIAD = [ { :ext => '.c', :path => @path_src, :template => TEMPLATE_SRC, :inc => :src, :boilerplate => @boilerplates[:src] }, + { :ext => '.h', :path => @path_inc, :template => TEMPLATE_INC, :inc => :inc, :boilerplate => @boilerplates[:inc] }, + { :ext => '.c', :path => @path_tst+'Test', :template => TEMPLATE_TST, :inc => :tst, :boilerplate => @boilerplates[:tst] }, + ] + +#prepare the pattern for use +@patterns = PATTERNS[@pattern.downcase] +raise "ERROR: The design pattern specified isn't one that I recognize!" if @patterns.nil? + +# Assemble the path/names of the files we need to work with. +files = [] +TRIAD.each do |triad| + @patterns.each_pair do |pattern_file, pattern_traits| + files << { + :path => "#{triad[:path]}#{@module_name}#{pattern_file}#{triad[:ext]}", + :name => "#{@module_name}#{pattern_file}", + :template => triad[:template], + :boilerplate => triad[:boilerplate], + :includes => case(triad[:inc]) + when :src then @includes[:src] | pattern_traits[:inc].map{|f| f % [@module_name]} + when :inc then @includes[:inc] + when :tst then @includes[:tst] | pattern_traits[:inc].map{|f| "Mock#{f}"% [@module_name]} + end + } + end +end + +# destroy files if that was what was requested +if @destroy + files.each do |filespec| + file = filespec[:path] + if File.exist?(file) + if @update_svn + `svn delete \"#{file}\" --force` + puts "File #{file} deleted and removed from source control" + else + FileUtils.remove(file) + puts "File #{file} deleted" + end + else + puts "File #{file} does not exist so cannot be removed." + end + end + puts "Destroy Complete" + exit +end + +#Abort if any module already exists +files.each do |file| + raise "ERROR: File #{file[:name]} already exists. Exiting." if File.exist?(file[:path]) +end + +# Create Source Modules +files.each_with_index do |file, i| + File.open(file[:path], 'w') do |f| + f.write(file[:boilerplate] % [file[:name]]) unless file[:boilerplate].nil? + f.write(file[:template] % [ file[:name], + file[:includes].map{|f| "#include \"#{f}\"\n"}.join, + file[:name].upcase ] + ) + end + if (@update_svn) + `svn add \"#{file[:path]}\"` + if $?.exitstatus == 0 + puts "File #{file[:path]} created and added to source control" + else + puts "File #{file[:path]} created but FAILED adding to source control!" + end + else + puts "File #{file[:path]} created" + end +end + +puts 'Generate Complete' diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/auto/generate_test_runner.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/auto/generate_test_runner.rb new file mode 100644 index 0000000..aff5053 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/auto/generate_test_runner.rb @@ -0,0 +1,303 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +File.expand_path(File.join(File.dirname(__FILE__),'colour_prompt')) + +class UnityTestRunnerGenerator + + def initialize(options = nil) + @options = { :includes => [], :plugins => [], :framework => :unity } + case(options) + when NilClass then @options + when String then @options.merge!(UnityTestRunnerGenerator.grab_config(options)) + when Hash then @options.merge!(options) + else raise "If you specify arguments, it should be a filename or a hash of options" + end + end + + def self.grab_config(config_file) + options = { :includes => [], :plugins => [], :framework => :unity } + unless (config_file.nil? or config_file.empty?) + require 'yaml' + yaml_guts = YAML.load_file(config_file) + options.merge!(yaml_guts[:unity] ? yaml_guts[:unity] : yaml_guts[:cmock]) + raise "No :unity or :cmock section found in #{config_file}" unless options + end + return(options) + end + + def run(input_file, output_file, options=nil) + tests = [] + includes = [] + used_mocks = [] + + @options.merge!(options) unless options.nil? + module_name = File.basename(input_file) + + #pull required data from source file + File.open(input_file, 'r') do |input| + tests = find_tests(input) + includes = find_includes(input) + used_mocks = find_mocks(includes) + end + + #build runner file + File.open(output_file, 'w') do |output| + create_header(output, used_mocks) + create_externs(output, tests, used_mocks) + create_mock_management(output, used_mocks) + create_suite_setup_and_teardown(output) + create_reset(output, used_mocks) + create_main(output, input_file, tests) + end + + all_files_used = [input_file, output_file] + all_files_used += includes.map {|filename| filename + '.c'} unless includes.empty? + all_files_used += @options[:includes] unless @options[:includes].empty? + return all_files_used.uniq + end + + def find_tests(input_file) + tests_raw = [] + tests_args = [] + tests_and_line_numbers = [] + + input_file.rewind + source_raw = input_file.read + source_scrubbed = source_raw.gsub(/\/\/.*$/, '') # remove line comments + source_scrubbed = source_scrubbed.gsub(/\/\*.*?\*\//m, '') # remove block comments + lines = source_scrubbed.split(/(^\s*\#.*$) # Treat preprocessor directives as a logical line + | (;|\{|\}) /x) # Match ;, {, and } as end of lines + + lines.each_with_index do |line, index| + #find tests + if line =~ /^((?:\s*TEST_CASE\s*\(.*?\)\s*)*)\s*void\s+(test.*?)\s*\(\s*(.*)\s*\)/ + arguments = $1 + name = $2 + call = $3 + args = nil + if (@options[:use_param_tests] and !arguments.empty?) + args = [] + arguments.scan(/\s*TEST_CASE\s*\((.*)\)\s*$/) {|a| args << a[0]} + end + tests_and_line_numbers << { :name => name, :args => args, :call => call, :line_number => 0 } + tests_args = [] + end + end + + #determine line numbers and create tests to run + source_lines = source_raw.split("\n") + source_index = 0; + tests_and_line_numbers.size.times do |i| + source_lines[source_index..-1].each_with_index do |line, index| + if (line =~ /#{tests_and_line_numbers[i][:name]}/) + source_index += index + tests_and_line_numbers[i][:line_number] = source_index + 1 + break + end + end + end + + return tests_and_line_numbers + end + + def find_includes(input_file) + input_file.rewind + includes = [] + input_file.readlines.each do |line| + scan_results = line.scan(/^\s*#include\s+\"\s*(.+)\.[hH]\s*\"/) + includes << scan_results[0][0] if (scan_results.size > 0) + end + return includes + end + + def find_mocks(includes) + mock_headers = [] + includes.each do |include_file| + mock_headers << File.basename(include_file) if (include_file =~ /^mock/i) + end + return mock_headers + end + + def create_header(output, mocks) + output.puts('/* AUTOGENERATED FILE. DO NOT EDIT. */') + create_runtest(output, mocks) + output.puts("\n//=======Automagically Detected Files To Include=====") + output.puts("#include \"#{@options[:framework].to_s}.h\"") + output.puts('#include "cmock.h"') unless (mocks.empty?) + @options[:includes].flatten.uniq.compact.each do |inc| + output.puts("#include #{inc.include?('<') ? inc : "\"#{inc.gsub('.h','')}.h\""}") + end + output.puts('#include ') + output.puts('#include ') + output.puts('#include "CException.h"') if @options[:plugins].include?(:cexception) + mocks.each do |mock| + output.puts("#include \"#{mock.gsub('.h','')}.h\"") + end + if @options[:enforce_strict_ordering] + output.puts('') + output.puts('int GlobalExpectCount;') + output.puts('int GlobalVerifyOrder;') + output.puts('char* GlobalOrderError;') + end + end + + def create_externs(output, tests, mocks) + output.puts("\n//=======External Functions This Runner Calls=====") + output.puts("extern void setUp(void);") + output.puts("extern void tearDown(void);") + tests.each do |test| + output.puts("extern void #{test[:name]}(#{test[:call]});") + end + output.puts('') + end + + def create_mock_management(output, mocks) + unless (mocks.empty?) + output.puts("\n//=======Mock Management=====") + output.puts("static void CMock_Init(void)") + output.puts("{") + if @options[:enforce_strict_ordering] + output.puts(" GlobalExpectCount = 0;") + output.puts(" GlobalVerifyOrder = 0;") + output.puts(" GlobalOrderError = NULL;") + end + mocks.each do |mock| + output.puts(" #{mock}_Init();") + end + output.puts("}\n") + + output.puts("static void CMock_Verify(void)") + output.puts("{") + mocks.each do |mock| + output.puts(" #{mock}_Verify();") + end + output.puts("}\n") + + output.puts("static void CMock_Destroy(void)") + output.puts("{") + mocks.each do |mock| + output.puts(" #{mock}_Destroy();") + end + output.puts("}\n") + end + end + + def create_suite_setup_and_teardown(output) + unless (@options[:suite_setup].nil?) + output.puts("\n//=======Suite Setup=====") + output.puts("static int suite_setup(void)") + output.puts("{") + output.puts(@options[:suite_setup]) + output.puts("}") + end + unless (@options[:suite_teardown].nil?) + output.puts("\n//=======Suite Teardown=====") + output.puts("static int suite_teardown(int num_failures)") + output.puts("{") + output.puts(@options[:suite_teardown]) + output.puts("}") + end + end + + def create_runtest(output, used_mocks) + cexception = @options[:plugins].include? :cexception + va_args1 = @options[:use_param_tests] ? ', ...' : '' + va_args2 = @options[:use_param_tests] ? '__VA_ARGS__' : '' + output.puts("\n//=======Test Runner Used To Run Each Test Below=====") + output.puts("#define RUN_TEST_NO_ARGS") if @options[:use_param_tests] + output.puts("#define RUN_TEST(TestFunc, TestLineNum#{va_args1}) \\") + output.puts("{ \\") + output.puts(" Unity.CurrentTestName = #TestFunc#{va_args2.empty? ? '' : " \"(\" ##{va_args2} \")\""}; \\") + output.puts(" Unity.CurrentTestLineNumber = TestLineNum; \\") + output.puts(" Unity.NumberOfTests++; \\") + output.puts(" if (TEST_PROTECT()) \\") + output.puts(" { \\") + output.puts(" CEXCEPTION_T e; \\") if cexception + output.puts(" Try { \\") if cexception + output.puts(" CMock_Init(); \\") unless (used_mocks.empty?) + output.puts(" setUp(); \\") + output.puts(" TestFunc(#{va_args2}); \\") + output.puts(" CMock_Verify(); \\") unless (used_mocks.empty?) + output.puts(" } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, \"Unhandled Exception!\"); } \\") if cexception + output.puts(" } \\") + output.puts(" CMock_Destroy(); \\") unless (used_mocks.empty?) + output.puts(" if (TEST_PROTECT() && !TEST_IS_IGNORED) \\") + output.puts(" { \\") + output.puts(" tearDown(); \\") + output.puts(" } \\") + output.puts(" UnityConcludeTest(); \\") + output.puts("}\n") + end + + def create_reset(output, used_mocks) + output.puts("\n//=======Test Reset Option=====") + output.puts("void resetTest()") + output.puts("{") + output.puts(" CMock_Verify();") unless (used_mocks.empty?) + output.puts(" CMock_Destroy();") unless (used_mocks.empty?) + output.puts(" tearDown();") + output.puts(" CMock_Init();") unless (used_mocks.empty?) + output.puts(" setUp();") + output.puts("}") + end + + def create_main(output, filename, tests) + output.puts("\n\n//=======MAIN=====") + output.puts("int main(void)") + output.puts("{") + output.puts(" suite_setup();") unless @options[:suite_setup].nil? + output.puts(" Unity.TestFile = \"#{filename}\";") + output.puts(" UnityBegin();") + if (@options[:use_param_tests]) + tests.each do |test| + if ((test[:args].nil?) or (test[:args].empty?)) + output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]}, RUN_TEST_NO_ARGS);") + else + test[:args].each {|args| output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]}, #{args});")} + end + end + else + tests.each { |test| output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]});") } + end + output.puts() + output.puts(" return #{@options[:suite_teardown].nil? ? "" : "suite_teardown"}(UnityEnd());") + output.puts("}") + end +end + + +if ($0 == __FILE__) + options = { :includes => [] } + yaml_file = nil + + #parse out all the options first + ARGV.reject! do |arg| + case(arg) + when '-cexception' + options[:plugins] = [:cexception]; true + when /\.*\.yml/ + options = UnityTestRunnerGenerator.grab_config(arg); true + else false + end + end + + #make sure there is at least one parameter left (the input file) + if !ARGV[0] + puts ["usage: ruby #{__FILE__} (yaml) (options) input_test_file output_test_runner (includes)", + " blah.yml - will use config options in the yml file (see docs)", + " -cexception - include cexception support"].join("\n") + exit 1 + end + + #create the default test runner name if not specified + ARGV[1] = ARGV[0].gsub(".c","_Runner.c") if (!ARGV[1]) + + #everything else is an include file + options[:includes] ||= (ARGV.slice(2..-1).flatten.compact) if (ARGV.size > 2) + + UnityTestRunnerGenerator.new(options).run(ARGV[0], ARGV[1]) +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/auto/test_file_filter.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/auto/test_file_filter.rb new file mode 100644 index 0000000..3dbc26a --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/auto/test_file_filter.rb @@ -0,0 +1,23 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require'yaml' + +module RakefileHelpers + class TestFileFilter + def initialize(all_files = false) + @all_files = all_files + if not @all_files == true + if File.exist?('test_file_filter.yml') + filters = YAML.load_file( 'test_file_filter.yml' ) + @all_files, @only_files, @exclude_files = + filters[:all_files], filters[:only_files], filters[:exclude_files] + end + end + end + attr_accessor :all_files, :only_files, :exclude_files + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/auto/unity_test_summary.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/auto/unity_test_summary.rb new file mode 100644 index 0000000..69ec2e8 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/auto/unity_test_summary.rb @@ -0,0 +1,126 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +#!/usr/bin/ruby +# +# unity_test_summary.rb +# +require 'fileutils' +require 'set' + +class UnityTestSummary + include FileUtils::Verbose + + attr_reader :report, :total_tests, :failures, :ignored + + def initialize + @report = '' + @total_tests = 0 + @failures = 0 + @ignored = 0 + end + + def run + # Clean up result file names + results = @targets.map {|target| target.gsub(/\\/,'/')} + + # Dig through each result file, looking for details on pass/fail: + failure_output = [] + ignore_output = [] + + results.each do |result_file| + lines = File.readlines(result_file).map { |line| line.chomp } + if lines.length == 0 + raise "Empty test result file: #{result_file}" + else + output = get_details(result_file, lines) + failure_output << output[:failures] unless output[:failures].empty? + ignore_output << output[:ignores] unless output[:ignores].empty? + tests,failures,ignored = parse_test_summary(lines) + @total_tests += tests + @failures += failures + @ignored += ignored + end + end + + if @ignored > 0 + @report += "\n" + @report += "--------------------------\n" + @report += "UNITY IGNORED TEST SUMMARY\n" + @report += "--------------------------\n" + @report += ignore_output.flatten.join("\n") + end + + if @failures > 0 + @report += "\n" + @report += "--------------------------\n" + @report += "UNITY FAILED TEST SUMMARY\n" + @report += "--------------------------\n" + @report += failure_output.flatten.join("\n") + end + + @report += "\n" + @report += "--------------------------\n" + @report += "OVERALL UNITY TEST SUMMARY\n" + @report += "--------------------------\n" + @report += "#{@total_tests} TOTAL TESTS #{@failures} TOTAL FAILURES #{@ignored} IGNORED\n" + @report += "\n" + end + + def set_targets(target_array) + @targets = target_array + end + + def set_root_path(path) + @root = path + end + + def usage(err_msg=nil) + puts err_msg if err_msg + puts "Usage: unity_test_summary.rb" + exit 1 + end + + protected + + @@targets=nil + @@path=nil + @@root=nil + + def get_details(result_file, lines) + results = { :failures => [], :ignores => [], :successes => [] } + lines.each do |line| + src_file,src_line,test_name,status,msg = line.split(/:/) + line_out = ((@root and (@root != 0)) ? "#{@root}#{line}" : line ).gsub(/\//, "\\") + case(status) + when 'IGNORE' then results[:ignores] << line_out + when 'FAIL' then results[:failures] << line_out + when 'PASS' then results[:successes] << line_out + end + end + return results + end + + def parse_test_summary(summary) + if summary[-3..-1].join("\n") =~ /(\d+) Tests (\d+) Failures (\d+) Ignored/ + [$1.to_i,$2.to_i,$3.to_i] + else + raise "Couldn't parse test results: #{summary}" + end + end + + def here; File.expand_path(File.dirname(__FILE__)); end + +end + +if $0 == __FILE__ + script = UnityTestSummary.new + begin + script.run + rescue Exception => e + script.usage e.message + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/docs/Unity Summary.odt b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/docs/Unity Summary.odt new file mode 100644 index 0000000..f699661 Binary files /dev/null and b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/docs/Unity Summary.odt differ diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/docs/Unity Summary.pdf b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/docs/Unity Summary.pdf new file mode 100644 index 0000000..ad1a956 Binary files /dev/null and b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/docs/Unity Summary.pdf differ diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/docs/Unity Summary.txt b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/docs/Unity Summary.txt new file mode 100644 index 0000000..e0b179d --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/docs/Unity Summary.txt @@ -0,0 +1,217 @@ +============== +Unity Test API +============== + +[Copyright (c) 2007 - Unity Project by Mike Karlesky, Mark VanderVoord, and Greg Williams] + +------------- +Running Tests +------------- + +RUN_TEST(func, linenum) + +Each Test is run within the macro RUN_TEST. This macro performs necessary setup before the test is called and handles cleanup and result tabulation afterwards. + +-------------- +Ignoring Tests +-------------- + +There are times when a test is incomplete or not valid for some reason. At these times, TEST_IGNORE can be called. Control will immediately be returned to the caller of the test, and no failures will be returned. + +TEST_IGNORE() + +Ignore this test and return immediately + +TEST_IGNORE_MESSAGE (message) + +Ignore this test and return immediately. Output a message stating why the test was ignored. + +-------------- +Aborting Tests +-------------- + +There are times when a test will contain an infinite loop on error conditions, or there may be reason to escape from the test early without executing the rest of the test. A pair of macros support this functionality in Unity. The first (TEST_PROTECT) sets up the feature, and handles emergency abort cases. TEST_ABORT can then be used at any time within the tests to return to the last TEST_PROTECT call. + +TEST_PROTECT() + +Setup and Catch macro + +TEST_ABORT() + +Abort Test macro + +Example: + +main() +{ + if (TEST_PROTECT() == 0) + { + MyTest(); + } +} + +If MyTest calls TEST_ABORT, program control will immediately return to TEST_PROTECT with a non-zero return value. + + +======================= +Unity Assertion Summary +======================= + +-------------------- +Basic Validity Tests +-------------------- + +TEST_ASSERT_TRUE(condition) + +Evaluates whatever code is in condition and fails if it evaluates to false + +TEST_ASSERT_FALSE(condition) + +Evaluates whatever code is in condition and fails if it evaluates to true + +TEST_ASSERT(condition) + +Another way of calling TEST_ASSERT_TRUE + +TEST_ASSERT_UNLESS(condition) + +Another way of calling TEST_ASSERT_FALSE + +TEST_FAIL() +TEST_FAIL_MESSAGE(message) + +This test is automatically marked as a failure. The message is output stating why. + +------------------------------ +Numerical Assertions: Integers +------------------------------ + +TEST_ASSERT_EQUAL_INT(expected, actual) +TEST_ASSERT_EQUAL_INT8(expected, actual) +TEST_ASSERT_EQUAL_INT16(expected, actual) +TEST_ASSERT_EQUAL_INT32(expected, actual) +TEST_ASSERT_EQUAL_INT64(expected, actual) + +Compare two integers for equality and display errors as signed integers. A cast will be performed +to your natural integer size so often this can just be used. When you need to specify the exact size, +like when comparing arrays, you can use a specific version: + + + +TEST_ASSERT_EQUAL_UINT(expected, actual) + +Compare two integers for equality and display errors as unsigned integers. Like INT, there are +variants for different sizes also. + + + +TEST_ASSERT_EQUAL_HEX(expected, actual) + +Compares two integers for equality and display errors as hexadecimal. Like the other integer comparisons, +you can specify the size... here the size will also effect how many nibbles are shown (for example, HEX16 +will show 4 nibbles). + +_ARRAY + +You can append _ARRAY to any of these macros to make an array comparison of that type. Here you will +need to care a bit more about the actual size of the value being checked. You will also specify an +additional argument which is the number of elements to compare. For example: + +TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, elements) + + +TEST_ASSERT_EQUAL(expected, actual) + +Another way of calling TEST_ASSERT_EQUAL_INT + + + +TEST_ASSERT_INT_WITHIN(delta, expected, actual) + +Asserts that the actual value is within plus or minus delta of the expected value. This also comes in +size specific variants. + + +----------------------------- +Numerical Assertions: Bitwise +----------------------------- + +TEST_ASSERT_BITS(mask, expected, actual) + +Use an integer mask to specify which bits should be compared between two other integers. High bits in the mask are compared, low bits ignored. + +TEST_ASSERT_BITS_HIGH(mask, actual) + +Use an integer mask to specify which bits should be inspected to determine if they are all set high. High bits in the mask are compared, low bits ignored. + +TEST_ASSERT_BITS_LOW(mask, actual) + +Use an integer mask to specify which bits should be inspected to determine if they are all set low. High bits in the mask are compared, low bits ignored. + +TEST_ASSERT_BIT_HIGH(bit, actual) + +Test a single bit and verify that it is high. The bit is specified 0-31 for a 32-bit integer. + +TEST_ASSERT_BIT_LOW(bit, actual) + +Test a single bit and verify that it is low. The bit is specified 0-31 for a 32-bit integer. + +---------------------------- +Numerical Assertions: Floats +---------------------------- + +TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual) + +Asserts that the actual value is within plus or minus delta of the expected value. + +TEST_ASSERT_EQUAL_FLOAT(expected, actual) + +Asserts that two floating point values are "equal" within a small % delta of the expected value. + +----------------- +String Assertions +----------------- + +TEST_ASSERT_EQUAL_STRING(expected, actual) + +Compare two null-terminate strings. Fail if any character is different or if the lengths are different. + +TEST_ASSERT_EQUAL_STRING_MESSAGE(expected, actual, message) + +Compare two null-terminate strings. Fail if any character is different or if the lengths are different. Output a custom message on failure. + +------------------ +Pointer Assertions +------------------ + +Most pointer operations can be performed by simply using the integer comparisons above. However, a couple of special cases are added for clarity. + +TEST_ASSERT_NULL(pointer) + +Fails if the pointer is not equal to NULL + +TEST_ASSERT_NOT_NULL(pointer) + +Fails if the pointer is equal to NULL + + +----------------- +Memory Assertions +----------------- + +TEST_ASSERT_EQUAL_MEMORY(expected, actual, len) + +Compare two blocks of memory. This is a good generic assertion for types that can't be coerced into acting like +standard types... but since it's a memory compare, you have to be careful that your data types are packed. + +-------- +_MESSAGE +-------- + +you can append _MESSAGE to any of the macros to make them take an additional argument. This argument +is a string that will be printed at the end of the failure strings. This is useful for specifying more +information about the problem. + + + + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/docs/license.txt b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/docs/license.txt new file mode 100644 index 0000000..c42e330 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/docs/license.txt @@ -0,0 +1,31 @@ + Copyright (c) 2007-2010 Mike Karlesky, Mark VanderVoord, Greg Williams + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + The end-user documentation included with the redistribution, if + any, must include the following acknowledgment: "This product + includes software developed for the Unity Project, by Mike Karlesky, + Mark VanderVoord, and Greg Williams and other contributors", in + the same place and form as other third-party acknowledgments. + Alternately, this acknowledgment may appear in the software + itself, in the same form and location as other such third-party + acknowledgments. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/examples/helper/UnityHelper.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/examples/helper/UnityHelper.c new file mode 100644 index 0000000..9cf42c6 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/examples/helper/UnityHelper.c @@ -0,0 +1,10 @@ +#include "unity.h" +#include "UnityHelper.h" +#include +#include + +void AssertEqualExampleStruct(const EXAMPLE_STRUCT_T expected, const EXAMPLE_STRUCT_T actual, const unsigned short line) +{ + UNITY_TEST_ASSERT_EQUAL_INT(expected.x, actual.x, line, "Example Struct Failed For Field x"); + UNITY_TEST_ASSERT_EQUAL_INT(expected.y, actual.y, line, "Example Struct Failed For Field y"); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/examples/helper/UnityHelper.h b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/examples/helper/UnityHelper.h new file mode 100644 index 0000000..1516111 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/examples/helper/UnityHelper.h @@ -0,0 +1,12 @@ +#ifndef _TESTHELPER_H +#define _TESTHELPER_H + +#include "Types.h" + +void AssertEqualExampleStruct(const EXAMPLE_STRUCT_T expected, const EXAMPLE_STRUCT_T actual, const unsigned short line); + +#define UNITY_TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(expected, actual, line, message) AssertEqualExampleStruct(expected, actual, line); + +#define TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(expected, actual) UNITY_TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(expected, actual, __LINE__, NULL); + +#endif // _TESTHELPER_H diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/examples/makefile b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/examples/makefile new file mode 100644 index 0000000..723d390 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/examples/makefile @@ -0,0 +1,40 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +C_COMPILER=gcc +TARGET_BASE1=test1 +TARGET_BASE2=test2 +ifeq ($(OS),Windows_NT) + TARGET_EXTENSION=.exe +else + TARGET_EXTENSION=.out +endif +TARGET1 = $(TARGET_BASE1)$(TARGET_EXTENSION) +TARGET2 = $(TARGET_BASE2)$(TARGET_EXTENSION) +SRC_FILES1=../src/unity.c src/ProductionCode.c test/TestProductionCode.c test/no_ruby/TestProductionCode_Runner.c +SRC_FILES2=../src/unity.c src/ProductionCode2.c test/TestProductionCode2.c test/no_ruby/TestProductionCode2_Runner.c +INC_DIRS=-Isrc -I../src +SYMBOLS=-DTEST + +ifeq ($(OS),Windows_NT) + CLEANUP = del /F /Q build\* && del /F /Q $(TARGET1) && del /F /Q $(TARGET2) +else + CLEANUP = rm -f build/*.o ; rm -f $(TARGET1) ; rm -f $(TARGET2) +endif + +all: clean default + +default: +# ruby auto/generate_test_runner.rb test/TestProductionCode.c test/no_ruby/TestProductionCode_Runner.c +# ruby auto/generate_test_runner.rb test/TestProductionCode2.c test/no_ruby/TestProductionCode2_Runner.c + $(C_COMPILER) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES1) -o $(TARGET1) + $(C_COMPILER) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES2) -o $(TARGET2) + $(TARGET1) + $(TARGET2) + +clean: + $(CLEANUP) + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/examples/rakefile.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/examples/rakefile.rb new file mode 100644 index 0000000..0905b4b --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/examples/rakefile.rb @@ -0,0 +1,32 @@ +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require HERE+'rakefile_helper' + +include RakefileHelpers + +# Load default configuration, for now +DEFAULT_CONFIG_FILE = 'gcc.yml' +configure_toolchain(DEFAULT_CONFIG_FILE) + +task :unit do + run_tests get_unit_test_files +end + +desc "Generate test summary" +task :summary do + report_summary +end + +desc "Build and test Unity" +task :all => [:clean, :unit, :summary] +task :default => [:clobber, :all] +task :ci => [:default] +task :cruise => [:default] + +desc "Load configuration" +task :config, :config_file do |t, args| + configure_toolchain(args[:config_file]) +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/examples/rakefile_helper.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/examples/rakefile_helper.rb new file mode 100644 index 0000000..0127d69 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/examples/rakefile_helper.rb @@ -0,0 +1,260 @@ +require 'yaml' +require 'fileutils' +require HERE+'../auto/unity_test_summary' +require HERE+'../auto/generate_test_runner' +require HERE+'../auto/colour_reporter' + +module RakefileHelpers + + C_EXTENSION = '.c' + + def load_configuration(config_file) + $cfg_file = "../targets/#{config_file}" + $cfg = YAML.load(File.read($cfg_file)) + end + + def configure_clean + CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil? + end + + def configure_toolchain(config_file=DEFAULT_CONFIG_FILE) + config_file += '.yml' unless config_file =~ /\.yml$/ + load_configuration('../targets/'+config_file) + configure_clean + end + + def get_unit_test_files + path = $cfg['compiler']['unit_tests_path'] + 'Test*' + C_EXTENSION + path.gsub!(/\\/, '/') + FileList.new(path) + end + + def get_local_include_dirs + include_dirs = $cfg['compiler']['includes']['items'].dup + include_dirs.delete_if {|dir| dir.is_a?(Array)} + return include_dirs + end + + def extract_headers(filename) + includes = [] + lines = File.readlines(filename) + lines.each do |line| + m = line.match(/^\s*#include\s+\"\s*(.+\.[hH])\s*\"/) + if not m.nil? + includes << m[1] + end + end + return includes + end + + def find_source_file(header, paths) + paths.each do |dir| + src_file = dir + header.ext(C_EXTENSION) + if (File.exists?(src_file)) + return src_file + end + end + return nil + end + + def tackit(strings) + if strings.is_a?(Array) + result = "\"#{strings.join}\"" + else + result = strings + end + return result + end + + def squash(prefix, items) + result = '' + items.each { |item| result += " #{prefix}#{tackit(item)}" } + return result + end + + def build_compiler_fields + command = tackit($cfg['compiler']['path']) + if $cfg['compiler']['defines']['items'].nil? + defines = '' + else + defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items']) + end + options = squash('', $cfg['compiler']['options']) + includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :defines => defines, :options => options, :includes => includes} + end + + def compile(file, defines=[]) + compiler = build_compiler_fields + cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{file} " + + "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" + + "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" + execute(cmd_str) + end + + def build_linker_fields + command = tackit($cfg['linker']['path']) + if $cfg['linker']['options'].nil? + options = '' + else + options = squash('', $cfg['linker']['options']) + end + if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?) + includes = '' + else + includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) + end + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :options => options, :includes => includes} + end + + def link(exe_name, obj_list) + linker = build_linker_fields + cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + + (obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).join + + $cfg['linker']['bin_files']['prefix'] + ' ' + + $cfg['linker']['bin_files']['destination'] + + exe_name + $cfg['linker']['bin_files']['extension'] + execute(cmd_str) + end + + def build_simulator_fields + return nil if $cfg['simulator'].nil? + if $cfg['simulator']['path'].nil? + command = '' + else + command = (tackit($cfg['simulator']['path']) + ' ') + end + if $cfg['simulator']['pre_support'].nil? + pre_support = '' + else + pre_support = squash('', $cfg['simulator']['pre_support']) + end + if $cfg['simulator']['post_support'].nil? + post_support = '' + else + post_support = squash('', $cfg['simulator']['post_support']) + end + return {:command => command, :pre_support => pre_support, :post_support => post_support} + end + + def execute(command_string, verbose=true, raise_on_fail=true) + report command_string + output = `#{command_string}`.chomp + report(output) if (verbose && !output.nil? && (output.length > 0)) + if (($?.exitstatus != 0) and (raise_on_fail)) + raise "Command failed. (Returned #{$?.exitstatus})" + end + return output + end + + def report_summary + summary = UnityTestSummary.new + summary.set_root_path(HERE) + results_glob = "#{$cfg['compiler']['build_path']}*.test*" + results_glob.gsub!(/\\/, '/') + results = Dir[results_glob] + summary.set_targets(results) + summary.run + fail_out "FAIL: There were failures" if (summary.failures > 0) + end + + def run_tests(test_files) + + report 'Running system tests...' + + # Tack on TEST define for compiling unit tests + load_configuration($cfg_file) + test_defines = ['TEST'] + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + $cfg['compiler']['defines']['items'] << 'TEST' + + include_dirs = get_local_include_dirs + + # Build and execute each unit test + test_files.each do |test| + obj_list = [] + + # Detect dependencies and build required required modules + extract_headers(test).each do |header| + # Compile corresponding source file if it exists + src_file = find_source_file(header, include_dirs) + if !src_file.nil? + compile(src_file, test_defines) + obj_list << header.ext($cfg['compiler']['object_files']['extension']) + end + end + + # Build the test runner (generate if configured to do so) + test_base = File.basename(test, C_EXTENSION) + runner_name = test_base + '_Runner.c' + if $cfg['compiler']['runner_path'].nil? + runner_path = $cfg['compiler']['build_path'] + runner_name + test_gen = UnityTestRunnerGenerator.new($cfg_file) + test_gen.run(test, runner_path) + else + runner_path = $cfg['compiler']['runner_path'] + runner_name + end + + compile(runner_path, test_defines) + obj_list << runner_name.ext($cfg['compiler']['object_files']['extension']) + + # Build the test module + compile(test, test_defines) + obj_list << test_base.ext($cfg['compiler']['object_files']['extension']) + + # Link the test executable + link(test_base, obj_list) + + # Execute unit test and generate results file + simulator = build_simulator_fields + executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] + if simulator.nil? + cmd_str = executable + else + cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" + end + output = execute(cmd_str, true, false) + test_results = $cfg['compiler']['build_path'] + test_base + if output.match(/OK$/m).nil? + test_results += '.testfail' + else + test_results += '.testpass' + end + File.open(test_results, 'w') { |f| f.print output } + end + end + + def build_application(main) + + report "Building application..." + + obj_list = [] + load_configuration($cfg_file) + main_path = $cfg['compiler']['source_path'] + main + C_EXTENSION + + # Detect dependencies and build required required modules + include_dirs = get_local_include_dirs + extract_headers(main_path).each do |header| + src_file = find_source_file(header, include_dirs) + if !src_file.nil? + compile(src_file) + obj_list << header.ext($cfg['compiler']['object_files']['extension']) + end + end + + # Build the main source file + main_base = File.basename(main_path, C_EXTENSION) + compile(main_path) + obj_list << main_base.ext($cfg['compiler']['object_files']['extension']) + + # Create the executable + link(main_base, obj_list) + end + + def fail_out(msg) + puts msg + exit(-1) + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/examples/readme.txt b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/examples/readme.txt new file mode 100644 index 0000000..6c7780e --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/examples/readme.txt @@ -0,0 +1,18 @@ +Example Project + +This example project gives an example of some passing, ignored, and failing tests. +It's simple and meant for you to look over and get an idea for what all of this stuff does. + +You can build and test using the makefile if you have gcc installed (you may need to tweak +the locations of some tools in the makefile). Otherwise, the rake version will let you +test with gcc or a couple versions of IAR. You can tweak the yaml files to get those versions +running. + +Ruby is required if you're using the rake version (obviously). This version shows off most of +Unity's advanced features (automatically creating test runners, fancy summaries, etc.) + +The makefile version doesn't require anything outside of your normal build tools, but won't do the +extras for you. So that you can test right away, we've written the test runners for you and +put them in the test\no_ruby subdirectory. If you make changes to the tests or source, you might +need to update these (like when you add or remove tests). Do that for a while and you'll learn +why you really want to start using the Ruby tools. \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/examples/src/ProductionCode.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/examples/src/ProductionCode.c new file mode 100644 index 0000000..500b44b --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/examples/src/ProductionCode.c @@ -0,0 +1,24 @@ + +#include "ProductionCode.h" + +int Counter = 0; +int NumbersToFind[9] = { 0, 34, 55, 66, 32, 11, 1, 77, 888 }; //some obnoxious array to search that is 1-based indexing instead of 0. + +// This function is supposed to search through NumbersToFind and find a particular number. +// If it finds it, the index is returned. Otherwise 0 is returned which sorta makes sense since +// NumbersToFind is indexed from 1. Unfortunately it's broken +// (and should therefore be caught by our tests) +int FindFunction_WhichIsBroken(int NumberToFind) +{ + int i = 0; + while (i <= 8) //Notice I should have been in braces + i++; + if (NumbersToFind[i] == NumberToFind) //Yikes! I'm getting run after the loop finishes instead of during it! + return i; + return 0; +} + +int FunctionWhichReturnsLocalVariable(void) +{ + return Counter; +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/examples/src/ProductionCode.h b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/examples/src/ProductionCode.h new file mode 100644 index 0000000..250ca0d --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/examples/src/ProductionCode.h @@ -0,0 +1,3 @@ + +int FindFunction_WhichIsBroken(int NumberToFind); +int FunctionWhichReturnsLocalVariable(void); diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/examples/src/ProductionCode2.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/examples/src/ProductionCode2.c new file mode 100644 index 0000000..a8c72e1 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/examples/src/ProductionCode2.c @@ -0,0 +1,9 @@ + +#include "ProductionCode2.h" + +char* ThisFunctionHasNotBeenTested(int Poor, char* LittleFunction) +{ + //Since There Are No Tests Yet, This Function Could Be Empty For All We Know. + // Which isn't terribly useful... but at least we put in a TEST_IGNORE so we won't forget + return (char*)0; +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/examples/src/ProductionCode2.h b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/examples/src/ProductionCode2.h new file mode 100644 index 0000000..34ae980 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/examples/src/ProductionCode2.h @@ -0,0 +1,2 @@ + +char* ThisFunctionHasNotBeenTested(int Poor, char* LittleFunction); diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/examples/test/TestProductionCode.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/examples/test/TestProductionCode.c new file mode 100644 index 0000000..28a5581 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/examples/test/TestProductionCode.c @@ -0,0 +1,62 @@ + +#include "ProductionCode.h" +#include "unity.h" + +//sometimes you may want to get at local data in a module. +//for example: If you plan to pass by reference, this could be useful +//however, it should often be avoided +extern int Counter; + +void setUp(void) +{ + //This is run before EACH TEST + Counter = 0x5a5a; +} + +void tearDown(void) +{ +} + +void test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode(void) +{ + //All of these should pass + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(78)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(1)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(33)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(999)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(-1)); +} + +void test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken(void) +{ + // You should see this line fail in your test summary + TEST_ASSERT_EQUAL(1, FindFunction_WhichIsBroken(34)); + + // Notice the rest of these didn't get a chance to run because the line above failed. + // Unit tests abort each test function on the first sign of trouble. + // Then NEXT test function runs as normal. + TEST_ASSERT_EQUAL(8, FindFunction_WhichIsBroken(8888)); +} + +void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue(void) +{ + //This should be true because setUp set this up for us before this test + TEST_ASSERT_EQUAL_HEX(0x5a5a, FunctionWhichReturnsLocalVariable()); + + //This should be true because we can still change our answer + Counter = 0x1234; + TEST_ASSERT_EQUAL_HEX(0x1234, FunctionWhichReturnsLocalVariable()); +} + +void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain(void) +{ + //This should be true again because setup was rerun before this test (and after we changed it to 0x1234) + TEST_ASSERT_EQUAL_HEX(0x5a5a, FunctionWhichReturnsLocalVariable()); +} + +void test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed(void) +{ + //Sometimes you get the test wrong. When that happens, you get a failure too... and a quick look should tell + // you what actually happened...which in this case was a failure to setup the initial condition. + TEST_ASSERT_EQUAL_HEX(0x1234, FunctionWhichReturnsLocalVariable()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/examples/test/TestProductionCode2.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/examples/test/TestProductionCode2.c new file mode 100644 index 0000000..20c9251 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/examples/test/TestProductionCode2.c @@ -0,0 +1,26 @@ + +#include "ProductionCode2.h" +#include "unity.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void test_IgnoredTest(void) +{ + TEST_IGNORE_MESSAGE("This Test Was Ignored On Purpose"); +} + +void test_AnotherIgnoredTest(void) +{ + TEST_IGNORE_MESSAGE("These Can Be Useful For Leaving Yourself Notes On What You Need To Do Yet"); +} + +void test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented(void) +{ + TEST_IGNORE(); //Like This +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/examples/test/no_ruby/TestProductionCode2_Runner.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/examples/test/no_ruby/TestProductionCode2_Runner.c new file mode 100644 index 0000000..56515ae --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/examples/test/no_ruby/TestProductionCode2_Runner.c @@ -0,0 +1,46 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ +#include "unity.h" +#include +#include + +char MessageBuffer[50]; + +extern void setUp(void); +extern void tearDown(void); + +extern void test_IgnoredTest(void); +extern void test_AnotherIgnoredTest(void); +extern void test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented(void); + +static void runTest(UnityTestFunction test) +{ + if (TEST_PROTECT()) + { + setUp(); + test(); + } + if (TEST_PROTECT() && !TEST_IS_IGNORED) + { + tearDown(); + } +} +void resetTest() +{ + tearDown(); + setUp(); +} + + +int main(void) +{ + Unity.TestFile = "test/TestProductionCode2.c"; + UnityBegin(); + + // RUN_TEST calls runTest + RUN_TEST(test_IgnoredTest, 13); + RUN_TEST(test_AnotherIgnoredTest, 18); + RUN_TEST(test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented, 23); + + UnityEnd(); + return 0; +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/examples/test/no_ruby/TestProductionCode_Runner.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/examples/test/no_ruby/TestProductionCode_Runner.c new file mode 100644 index 0000000..64112f3 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/examples/test/no_ruby/TestProductionCode_Runner.c @@ -0,0 +1,50 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ +#include "unity.h" +#include +#include + +char MessageBuffer[50]; + +extern void setUp(void); +extern void tearDown(void); + +extern void test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode(void); +extern void test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken(void); +extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue(void); +extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain(void); +extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed(void); + +static void runTest(UnityTestFunction test) +{ + if (TEST_PROTECT()) + { + setUp(); + test(); + } + if (TEST_PROTECT() && !TEST_IS_IGNORED) + { + tearDown(); + } +} +void resetTest() +{ + tearDown(); + setUp(); +} + + +int main(void) +{ + Unity.TestFile = "test/TestProductionCode.c"; + UnityBegin(); + + // RUN_TEST calls runTest + RUN_TEST(test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode, 20); + RUN_TEST(test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken, 30); + RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue, 41); + RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain, 51); + RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed, 57); + + UnityEnd(); + return 0; +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/build/MakefileWorker.mk b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/build/MakefileWorker.mk new file mode 100644 index 0000000..9948751 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/build/MakefileWorker.mk @@ -0,0 +1,331 @@ +#--------- +# +# MakefileWorker.mk +# +# Include this helper file in your makefile +# It makes +# A static library holding the application objs +# A test executable +# +# See this example for parameter settings +# examples/Makefile +# +#---------- +# Inputs - these variables describe what to build +# +# INCLUDE_DIRS - Directories used to search for include files. +# This generates a -I for each directory +# SRC_DIRS - Directories containing source file to built into the library +# SRC_FILES - Specific source files to build into library. Helpful when not all code +# in a directory can be built for test (hopefully a temporary situation) +# TEST_SRC_DIRS - Directories containing unit test code build into the unit test runner +# These do not go in a library. They are explicitly included in the test runner +# MOCKS_SRC_DIRS - Directories containing mock source files to build into the test runner +# These do not go in a library. They are explicitly included in the test runner +#---------- +# You can adjust these variables to influence how to build the test target +# and where to put and name outputs +# See below to determine defaults +# COMPONENT_NAME - the name of the thing being built +# UNITY_HOME - where Unity home dir found +# UNITY_BUILD_HOME - place for scripts +# UNITY_OBJS_DIR - a directory where o and d files go +# UNITY_LIB_DIR - a directory where libs go +# UNITY_ENABLE_DEBUG - build for debug +# UNITY_USE_MEM_LEAK_DETECTION - Links with overridden new and delete +# UNITY_USE_STD_CPP_LIB - Set to N to keep the standard C++ library out +# of the test harness +# UNITY_USE_GCOV - Turn on coverage analysis +# Clean then build with this flag set to Y, then 'make gcov' +# UNITY_TEST_RUNNER_FLAGS +# None by default +# UNITY_MAPFILE - generate a map file +# UNITY_WARNINGFLAGS - overly picky by default +# OTHER_MAKEFILE_TO_INCLUDE - a hook to use this makefile to make +# other targets. Like CSlim, which is part of fitnesse +#---------- +# +# Other flags users can initialize to sneak in their settings +# UNITY_CFLAGS - C complier +# UNITY_LDFLAGS - Linker flags +#---------- + + +ifndef COMPONENT_NAME + COMPONENT_NAME = name_this_in_the_makefile +endif + +# Debug on by default +ifndef UNITY_ENABLE_DEBUG + UNITY_ENABLE_DEBUG = Y +endif + +# new and delete for memory leak detection on by default +ifndef UNITY_USE_MEM_LEAK_DETECTION + UNITY_USE_MEM_LEAK_DETECTION = Y +endif + +# Use gcov, off by default +ifndef UNITY_USE_GCOV + UNITY_USE_GCOV = N +endif + +# Default warnings +ifndef UNITY_WARNINGFLAGS + UNITY_WARNINGFLAGS = -Wall -Werror -Wshadow -Wswitch-default +endif + +# Default dir for temporary files (d, o) +ifndef UNITY_OBJS_DIR + UNITY_OBJS_DIR = objs +endif + +# Default dir for the outout library +ifndef UNITY_LIB_DIR + UNITY_LIB_DIR = lib +endif + +# No map by default +ifndef UNITY_MAP_FILE + UNITY_MAP_FILE = N +endif + +#Not verbose by deafult +ifdef VERBOSE + UNITY_TEST_RUNNER_FLAGS += -v +endif + +ifdef GROUP + UNITY_TEST_RUNNER_FLAGS += -g $(GROUP) +endif + +ifdef NAME + UNITY_TEST_RUNNER_FLAGS += -n $(NAME) +endif + +ifdef REPEAT + UNITY_TEST_RUNNER_FLAGS += -r $(REPEAT) +endif + + +# -------------------------------------- +# derived flags in the following area +# -------------------------------------- +ifeq ($(UNITY_USE_MEM_LEAK_DETECTION), N) + UNITY_CFLAGS += -DUNITY_MEM_LEAK_DETECTION_DISABLED +else + UNITY_MEMLEAK_DETECTOR_MALLOC_MACRO_FILE = -include $(UNITY_HOME)/extras/fixture/src/unity_fixture_malloc_overrides.h +endif + +ifeq ($(UNITY_ENABLE_DEBUG), Y) + UNITY_CFLAGS += -g +endif + +ifeq ($(UNITY_USE_GCOV), Y) + UNITY_CFLAGS += -fprofile-arcs -ftest-coverage +endif + +UNITY_CFLAGS += $(UNITY_MEMLEAK_DETECTOR_MALLOC_MACRO_FILE) + +TARGET_MAP = $(COMPONENT_NAME).map.txt +ifeq ($(UNITY_MAP_FILE), Y) + UNITY_LDFLAGS += -Wl,-map,$(TARGET_MAP) +endif + +LD_LIBRARIES += -lgcov + +TARGET_LIB = \ + $(UNITY_LIB_DIR)/lib$(COMPONENT_NAME).a + +TEST_TARGET = \ + $(COMPONENT_NAME)_tests + +#Helper Functions +get_src_from_dir = $(wildcard $1/*.cpp) $(wildcard $1/*.c) +get_dirs_from_dirspec = $(wildcard $1) +get_src_from_dir_list = $(foreach dir, $1, $(call get_src_from_dir,$(dir))) +__src_to = $(subst .c,$1, $(subst .cpp,$1,$2)) +src_to = $(addprefix $(UNITY_OBJS_DIR)/,$(call __src_to,$1,$2)) +src_to_o = $(call src_to,.o,$1) +src_to_d = $(call src_to,.d,$1) +src_to_gcda = $(call src_to,.gcda,$1) +src_to_gcno = $(call src_to,.gcno,$1) +make_dotdot_a_subdir = $(subst ..,_dot_dot, $1) +time = $(shell date +%s) +delta_t = $(eval minus, $1, $2) +debug_print_list = $(foreach word,$1,echo " $(word)";) echo; + +#Derived +STUFF_TO_CLEAN += $(TEST_TARGET) $(TEST_TARGET).exe $(TARGET_LIB) $(TARGET_MAP) + +SRC += $(call get_src_from_dir_list, $(SRC_DIRS)) $(SRC_FILES) +OBJ = $(call src_to_o,$(SRC)) +OBJ2 = $(call make_dotdot_a_subdir. $(OBJ)) + +STUFF_TO_CLEAN += $(OBJ) + +TEST_SRC = $(call get_src_from_dir_list, $(TEST_SRC_DIRS)) +TEST_OBJS = $(call src_to_o,$(TEST_SRC)) +STUFF_TO_CLEAN += $(TEST_OBJS) + + +MOCKS_SRC = $(call get_src_from_dir_list, $(MOCKS_SRC_DIRS)) +MOCKS_OBJS = $(call src_to_o,$(MOCKS_SRC)) +STUFF_TO_CLEAN += $(MOCKS_OBJS) + +ALL_SRC = $(SRC) $(TEST_SRC) $(MOCKS_SRC) + +#Test coverage with gcov +GCOV_OUTPUT = gcov_output.txt +GCOV_REPORT = gcov_report.txt +GCOV_ERROR = gcov_error.txt +GCOV_GCDA_FILES = $(call src_to_gcda, $(ALL_SRC)) +GCOV_GCNO_FILES = $(call src_to_gcno, $(ALL_SRC)) +TEST_OUTPUT = $(TEST_TARGET).txt +STUFF_TO_CLEAN += \ + $(GCOV_OUTPUT)\ + $(GCOV_REPORT)\ + $(GCOV_REPORT).html\ + $(GCOV_ERROR)\ + $(GCOV_GCDA_FILES)\ + $(GCOV_GCNO_FILES)\ + $(TEST_OUTPUT) + + +#The gcda files for gcov need to be deleted before each run +#To avoid annoying messages. +GCOV_CLEAN = $(SILENCE)rm -f $(GCOV_GCDA_FILES) $(GCOV_OUTPUT) $(GCOV_REPORT) $(GCOV_ERROR) +RUN_TEST_TARGET = $(SILENCE) $(GCOV_CLEAN) ; echo "Running $(TEST_TARGET)"; ./$(TEST_TARGET) $(UNITY_TEST_RUNNER_FLAGS) + +INCLUDES_DIRS_EXPANDED = $(call get_dirs_from_dirspec, $(INCLUDE_DIRS)) +INCLUDES += $(foreach dir, $(INCLUDES_DIRS_EXPANDED), -I$(dir)) +MOCK_DIRS_EXPANDED = $(call get_dirs_from_dirspec, $(MOCKS_SRC_DIRS)) +INCLUDES += $(foreach dir, $(MOCK_DIRS_EXPANDED), -I$(dir)) + + +DEP_FILES = $(call src_to_d, $(ALL_SRC)) +STUFF_TO_CLEAN += $(DEP_FILES) $(PRODUCTION_CODE_START) $(PRODUCTION_CODE_END) +STUFF_TO_CLEAN += $(STDLIB_CODE_START) $(MAP_FILE) cpputest_*.xml junit_run_output + +# We'll use the UNITY_CFLAGS etc so that you can override AND add to the CppUTest flags +CFLAGS = $(UNITY_CFLAGS) $(UNITY_ADDITIONAL_CFLAGS) $(INCLUDES) $(UNITY_WARNINGFLAGS) +LDFLAGS = $(UNITY_LDFLAGS) $(UNITY_ADDITIONAL_LDFLAGS) + +# Targets + +.PHONY: all +all: start $(TEST_TARGET) + $(RUN_TEST_TARGET) + +.PHONY: start +start: $(TEST_TARGET) + $(SILENCE)START_TIME=$(call time) + +.PHONY: all_no_tests +all_no_tests: $(TEST_TARGET) + +.PHONY: flags +flags: + @echo + @echo "Compile C source with CFLAGS:" + @$(call debug_print_list,$(CFLAGS)) + @echo "Link with LDFLAGS:" + @$(call debug_print_list,$(LDFLAGS)) + @echo "Link with LD_LIBRARIES:" + @$(call debug_print_list,$(LD_LIBRARIES)) + @echo "Create libraries with ARFLAGS:" + @$(call debug_print_list,$(ARFLAGS)) + @echo "OBJ files:" + @$(call debug_print_list,$(OBJ2)) + + +$(TEST_TARGET): $(TEST_OBJS) $(MOCKS_OBJS) $(PRODUCTION_CODE_START) $(TARGET_LIB) $(USER_LIBS) $(PRODUCTION_CODE_END) $(STDLIB_CODE_START) + $(SILENCE)echo Linking $@ + $(SILENCE)$(LINK.o) -o $@ $^ $(LD_LIBRARIES) + +$(TARGET_LIB): $(OBJ) + $(SILENCE)echo Building archive $@ + $(SILENCE)mkdir -p lib + $(SILENCE)$(AR) $(ARFLAGS) $@ $^ + $(SILENCE)ranlib $@ + +test: $(TEST_TARGET) + $(RUN_TEST_TARGET) | tee $(TEST_OUTPUT) + +vtest: $(TEST_TARGET) + $(RUN_TEST_TARGET) -v | tee $(TEST_OUTPUT) + +$(UNITY_OBJS_DIR)/%.o: %.cpp + @echo compiling $(notdir $<) + $(SILENCE)mkdir -p $(dir $@) + $(SILENCE)$(COMPILE.cpp) -MMD -MP $(OUTPUT_OPTION) $< + +$(UNITY_OBJS_DIR)/%.o: %.c + @echo compiling $(notdir $<) + $(SILENCE)mkdir -p $(dir $@) + $(SILENCE)$(COMPILE.c) -MMD -MP $(OUTPUT_OPTION) $< + +ifneq "$(MAKECMDGOALS)" "clean" +-include $(DEP_FILES) +endif + +.PHONY: clean +clean: + $(SILENCE)echo Making clean + $(SILENCE)$(RM) $(STUFF_TO_CLEAN) + $(SILENCE)rm -rf gcov $(UNITY_OBJS_DIR) + $(SILENCE)find . -name "*.gcno" | xargs rm -f + $(SILENCE)find . -name "*.gcda" | xargs rm -f + +#realclean gets rid of all gcov, o and d files in the directory tree +#not just the ones made by this makefile +.PHONY: realclean +realclean: clean + $(SILENCE)rm -rf gcov + $(SILENCE)find . -name "*.gdcno" | xargs rm -f + $(SILENCE)find . -name "*.[do]" | xargs rm -f + +gcov: test + $(SILENCE)for d in $(SRC_DIRS) ; do \ + gcov --object-directory $(UNITY_OBJS_DIR)/$$d $$d/*.c $$d/*.cpp >> $(GCOV_OUTPUT) 2>>$(GCOV_ERROR) ; \ + done + $(SILENCE)for f in $(SRC_FILES) ; do \ + gcov --object-directory $(UNITY_OBJS_DIR)/$$f $$f >> $(GCOV_OUTPUT) 2>>$(GCOV_ERROR) ; \ + done + $(UNITY_BUILD_HOME)/filterGcov.sh $(GCOV_OUTPUT) $(GCOV_ERROR) $(GCOV_REPORT) $(TEST_OUTPUT) + $(SILENCE)cat $(GCOV_REPORT) + $(SILENCE)mkdir -p gcov + $(SILENCE)mv *.gcov gcov + $(SILENCE)mv gcov_* gcov + $(SILENCE)echo "See gcov directory for details" + +debug: + @echo + @echo "Target Source files:" + @$(call debug_print_list,$(SRC)) + @echo "Target Object files:" + @$(call debug_print_list,$(OBJ)) + @echo "Test Source files:" + @$(call debug_print_list,$(TEST_SRC)) + @echo "Test Object files:" + @$(call debug_print_list,$(TEST_OBJS)) + @echo "Mock Source files:" + @$(call debug_print_list,$(MOCKS_SRC)) + @echo "Mock Object files:" + @$(call debug_print_list,$(MOCKS_OBJS)) + @echo "All Input Dependency files:" + @$(call debug_print_list,$(DEP_FILES)) + @echo Stuff to clean: + @$(call debug_print_list,$(STUFF_TO_CLEAN)) + @echo Includes: + @$(call debug_print_list,$(INCLUDES)) + +ifneq "$(OTHER_MAKEFILE_TO_INCLUDE)" "" +-include $(OTHER_MAKEFILE_TO_INCLUDE) +endif + + + +st,$(TEST_SRC)) + @echo "Test Object files:" + @$(call debug_print \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/build/filterGcov.sh b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/build/filterGcov.sh new file mode 100644 index 0000000..a861cf6 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/build/filterGcov.sh @@ -0,0 +1,61 @@ +#!/bin/bash +INPUT_FILE=$1 +TEMP_FILE1=${INPUT_FILE}1.tmp +TEMP_FILE2=${INPUT_FILE}2.tmp +TEMP_FILE3=${INPUT_FILE}3.tmp +ERROR_FILE=$2 +OUTPUT_FILE=$3 +HTML_OUTPUT_FILE=$3.html +TEST_RESULTS=$4 + +flattenGcovOutput() { +while read line1 +do + read line2 + echo $line2 " " $line1 + read junk + read junk +done < ${INPUT_FILE} +} + +getRidOfCruft() { +sed '-e s/^Lines.*://g' \ + '-e s/^[0-9]\./ &/g' \ + '-e s/^[0-9][0-9]\./ &/g' \ + '-e s/of.*File/ /g' \ + "-e s/'//g" \ + '-e s/^.*\/usr\/.*$//g' \ + '-e s/^.*\.$//g' +} + +getFileNameRootFromErrorFile() { +sed '-e s/gc..:cannot open .* file//g' ${ERROR_FILE} +} + +writeEachNoTestCoverageFile() { +while read line +do + echo " 0.00% " ${line} +done +} + +createHtmlOutput() { + echo "" + echo "" + sed "-e s/.*% /
CoverageFile
&<\/td>/" \ + "-e s/[a-zA-Z0-9_]*\.[ch][a-z]*/&<\/a><\/td><\/tr>/" + echo "
" + sed "-e s/.*/&
/g" < ${TEST_RESULTS} +} + + +flattenGcovOutput | getRidOfCruft > ${TEMP_FILE1} +getFileNameRootFromErrorFile | writeEachNoTestCoverageFile > ${TEMP_FILE2} +cat ${TEMP_FILE1} ${TEMP_FILE2} | sort | uniq > ${OUTPUT_FILE} +createHtmlOutput < ${OUTPUT_FILE} > ${HTML_OUTPUT_FILE} +rm -f ${TEMP_FILE1} ${TEMP_FILE2} +erageFile" + sed "-e s/.*% /&<\/td>/" \ + "-e s/[a-zA-Z0-9_]*\.[ch][a-z]*/
&<\/a><\/td><\/tr>/" + echo "" + sed "-e s/.*/&
/g" < ${TEST_RESULTS \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/rakefile.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/rakefile.rb new file mode 100644 index 0000000..6181707 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/rakefile.rb @@ -0,0 +1,37 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require HERE + 'rakefile_helper' + +include RakefileHelpers + +# Load default configuration, for now +DEFAULT_CONFIG_FILE = 'gcc.yml' +configure_toolchain(DEFAULT_CONFIG_FILE) + +task :unit do + run_tests +end + +desc "Build and test Unity Framework" +task :all => [:clean, :unit] +task :default => [:clobber, :all] +task :ci => [:no_color, :default] +task :cruise => [:no_color, :default] + +desc "Load configuration" +task :config, :config_file do |t, args| + configure_toolchain(args[:config_file]) +end + +task :no_color do + $colour_output = false +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/rakefile_helper.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/rakefile_helper.rb new file mode 100644 index 0000000..a7f6a28 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/rakefile_helper.rb @@ -0,0 +1,178 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require 'yaml' +require 'fileutils' +require HERE+'../../auto/unity_test_summary' +require HERE+'../../auto/generate_test_runner' +require HERE+'../../auto/colour_reporter' + +module RakefileHelpers + + C_EXTENSION = '.c' + + def load_configuration(config_file) + unless ($configured) + $cfg_file = HERE+"../../targets/#{config_file}" unless (config_file =~ /[\\|\/]/) + $cfg = YAML.load(File.read($cfg_file)) + $colour_output = false unless $cfg['colour'] + $configured = true if (config_file != DEFAULT_CONFIG_FILE) + end + end + + def configure_clean + CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil? + end + + def configure_toolchain(config_file=DEFAULT_CONFIG_FILE) + config_file += '.yml' unless config_file =~ /\.yml$/ + config_file = config_file unless config_file =~ /[\\|\/]/ + load_configuration(config_file) + configure_clean + end + + def tackit(strings) + if strings.is_a?(Array) + result = "\"#{strings.join}\"" + else + result = strings + end + return result + end + + def squash(prefix, items) + result = '' + items.each { |item| result += " #{prefix}#{tackit(item)}" } + return result + end + + def build_compiler_fields + command = tackit($cfg['compiler']['path']) + if $cfg['compiler']['defines']['items'].nil? + defines = '' + else + defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items'] + ['UNITY_OUTPUT_CHAR=UnityOutputCharSpy_OutputChar']) + end + options = squash('', $cfg['compiler']['options']) + includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :defines => defines, :options => options, :includes => includes} + end + + def compile(file, defines=[]) + compiler = build_compiler_fields + unity_include = $cfg['compiler']['includes']['prefix']+'../../src' + cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{unity_include} #{file} " + + "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" + + "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" + execute(cmd_str) + end + + def build_linker_fields + command = tackit($cfg['linker']['path']) + if $cfg['linker']['options'].nil? + options = '' + else + options = squash('', $cfg['linker']['options']) + end + if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?) + includes = '' + else + includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) + end + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :options => options, :includes => includes} + end + + def link(exe_name, obj_list) + linker = build_linker_fields + cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + + (obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).join + + $cfg['linker']['bin_files']['prefix'] + ' ' + + $cfg['linker']['bin_files']['destination'] + + exe_name + $cfg['linker']['bin_files']['extension'] + execute(cmd_str) + end + + def build_simulator_fields + return nil if $cfg['simulator'].nil? + if $cfg['simulator']['path'].nil? + command = '' + else + command = (tackit($cfg['simulator']['path']) + ' ') + end + if $cfg['simulator']['pre_support'].nil? + pre_support = '' + else + pre_support = squash('', $cfg['simulator']['pre_support']) + end + if $cfg['simulator']['post_support'].nil? + post_support = '' + else + post_support = squash('', $cfg['simulator']['post_support']) + end + return {:command => command, :pre_support => pre_support, :post_support => post_support} + end + + def execute(command_string, verbose=true) + report command_string + output = `#{command_string}`.chomp + report(output) if (verbose && !output.nil? && (output.length > 0)) + if ($?.exitstatus != 0) + raise "Command failed. (Returned #{$?.exitstatus})" + end + return output + end + + def report_summary + summary = UnityTestSummary.new + summary.set_root_path(HERE) + results_glob = "#{$cfg['compiler']['build_path']}*.test*" + results_glob.gsub!(/\\/, '/') + results = Dir[results_glob] + summary.set_targets(results) + summary.run + end + + def run_tests + report 'Running Unity system tests...' + + # Tack on TEST define for compiling unit tests + load_configuration($cfg_file) + test_defines = ['TEST'] + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + + # Get a list of all source files needed + src_files = Dir[HERE+'src/*.c'] + src_files += Dir[HERE+'test/*.c'] + src_files << '../../src/Unity.c' + + # Build object files + src_files.each { |f| compile(f, test_defines) } + obj_list = src_files.map {|f| File.basename(f.ext($cfg['compiler']['object_files']['extension'])) } + + # Link the test executable + test_base = "framework_test" + link(test_base, obj_list) + + # Execute unit test and generate results file + simulator = build_simulator_fields + executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] + if simulator.nil? + cmd_str = executable + " -v -r" + else + cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" + end + output = execute(cmd_str) + test_results = $cfg['compiler']['build_path'] + test_base + if output.match(/OK$/m).nil? + test_results += '.testfail' + else + test_results += '.testpass' + end + File.open(test_results, 'w') { |f| f.print output } + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/readme.txt b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/readme.txt new file mode 100644 index 0000000..6b9a78c --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/readme.txt @@ -0,0 +1,9 @@ +Copyright (c) 2010 James Grenning and Contributed to Unity Project + +Unity Project - A Test Framework for C +Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +[Released under MIT License. Please refer to license.txt for details] + +This Framework is an optional add-on to Unity. By including unity_framework.h in place of unity.h, +you may now work with Unity in a manner similar to CppUTest. This framework adds the concepts of +test groups and gives finer control of your tests over the command line. \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.c new file mode 100644 index 0000000..1ba3e9a --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.c @@ -0,0 +1,381 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" +#include "unity_internals.h" +#include + +UNITY_FIXTURE_T UnityFixture; + +//If you decide to use the function pointer approach. +int (*outputChar)(int) = putchar; + +int verbose = 0; + +void setUp(void) { /*does nothing*/ } +void tearDown(void) { /*does nothing*/ } + +void announceTestRun(int runNumber) +{ + UnityPrint("Unity test run "); + UnityPrintNumber(runNumber+1); + UnityPrint(" of "); + UnityPrintNumber(UnityFixture.RepeatCount); + UNITY_OUTPUT_CHAR('\n'); +} + +int UnityMain(int argc, char* argv[], void (*runAllTests)()) +{ + int result = UnityGetCommandLineOptions(argc, argv); + int r; + if (result != 0) + return result; + + for (r = 0; r < UnityFixture.RepeatCount; r++) + { + announceTestRun(r); + UnityBegin(); + runAllTests(); + UNITY_OUTPUT_CHAR('\n'); + UnityEnd(); + } + + return UnityFailureCount(); +} + +static int selected(const char * filter, const char * name) +{ + if (filter == 0) + return 1; + return strstr(name, filter) ? 1 : 0; +} + +static int testSelected(const char* test) +{ + return selected(UnityFixture.NameFilter, test); +} + +static int groupSelected(const char* group) +{ + return selected(UnityFixture.GroupFilter, group); +} + +static void runTestCase() +{ + +} + +void UnityTestRunner(unityfunction* setup, + unityfunction* testBody, + unityfunction* teardown, + const char * printableName, + const char * group, + const char * name, + const char * file, int line) +{ + if (testSelected(name) && groupSelected(group)) + { + Unity.CurrentTestFailed = 0; + Unity.TestFile = file; + Unity.CurrentTestName = printableName; + Unity.CurrentTestLineNumber = line; + if (!UnityFixture.Verbose) + UNITY_OUTPUT_CHAR('.'); + else + UnityPrint(printableName); + + Unity.NumberOfTests++; + UnityMalloc_StartTest(); + UnityPointer_Init(); + + runTestCase(); + if (TEST_PROTECT()) + { + setup(); + testBody(); + } + if (TEST_PROTECT()) + { + teardown(); + } + if (TEST_PROTECT()) + { + UnityPointer_UndoAllSets(); + if (!Unity.CurrentTestFailed) + UnityMalloc_EndTest(); + UnityConcludeFixtureTest(); + } + else + { + //aborting - jwg - di i need these for the other TEST_PROTECTS? + } + } +} + +void UnityIgnoreTest() +{ + Unity.NumberOfTests++; + Unity.CurrentTestIgnored = 1; + UNITY_OUTPUT_CHAR('!'); +} + + +//------------------------------------------------- +//Malloc and free stuff +// +#define MALLOC_DONT_FAIL -1 +static int malloc_count; +static int malloc_fail_countdown = MALLOC_DONT_FAIL; + +void UnityMalloc_StartTest() +{ + malloc_count = 0; + malloc_fail_countdown = MALLOC_DONT_FAIL; +} + +void UnityMalloc_EndTest() +{ + malloc_fail_countdown = MALLOC_DONT_FAIL; + if (malloc_count != 0) + { + TEST_FAIL_MESSAGE("This test leaks!"); + } +} + +void UnityMalloc_MakeMallocFailAfterCount(int countdown) +{ + malloc_fail_countdown = countdown; +} + +#ifdef malloc +#undef malloc +#endif + +#ifdef free +#undef free +#endif + +#include +#include + +typedef struct GuardBytes +{ + int size; + char guard[sizeof(int)]; +} Guard; + + +static const char * end = "END"; + +void * unity_malloc(size_t size) +{ + char* mem; + Guard* guard; + + if (malloc_fail_countdown != MALLOC_DONT_FAIL) + { + if (malloc_fail_countdown == 0) + return 0; + malloc_fail_countdown--; + } + + malloc_count++; + + guard = (Guard*)malloc(size + sizeof(Guard) + 4); + guard->size = size; + mem = (char*)&(guard[1]); + memcpy(&mem[size], end, strlen(end) + 1); + + return (void*)mem; +} + +static int isOverrun(void * mem) +{ + Guard* guard = (Guard*)mem; + char* memAsChar = (char*)mem; + guard--; + + return strcmp(&memAsChar[guard->size], end) != 0; +} + +static void release_memory(void * mem) +{ + Guard* guard = (Guard*)mem; + guard--; + + malloc_count--; + free(guard); +} + +void unity_free(void * mem) +{ + int overrun = isOverrun(mem);//strcmp(&memAsChar[guard->size], end) != 0; + release_memory(mem); + if (overrun) + { + TEST_FAIL_MESSAGE("Buffer overrun detected during free()"); + } +} + +void* unity_calloc(size_t num, size_t size) +{ + void* mem = unity_malloc(num * size); + memset(mem, 0, num*size); + return mem; +} + +void* unity_realloc(void * oldMem, size_t size) +{ + Guard* guard = (Guard*)oldMem; +// char* memAsChar = (char*)oldMem; + void* newMem; + + if (oldMem == 0) + return unity_malloc(size); + + guard--; + if (isOverrun(oldMem)) + { + release_memory(oldMem); + TEST_FAIL_MESSAGE("Buffer overrun detected during realloc()"); + } + + if (size == 0) + { + release_memory(oldMem); + return 0; + } + + if (guard->size >= size) + return oldMem; + + newMem = unity_malloc(size); + memcpy(newMem, oldMem, size); + unity_free(oldMem); + return newMem; +} + + +//-------------------------------------------------------- +//Automatic pointer restoration functions +typedef struct _PointerPair +{ + struct _PointerPair * next; + void ** pointer; + void * old_value; +} PointerPair; + +enum {MAX_POINTERS=50}; +static PointerPair pointer_store[MAX_POINTERS]; +static int pointer_index = 0; + +void UnityPointer_Init() +{ + pointer_index = 0; +} + +void UnityPointer_Set(void ** pointer, void * newValue) +{ + if (pointer_index >= MAX_POINTERS) + TEST_FAIL_MESSAGE("Too many pointers set"); + + pointer_store[pointer_index].pointer = pointer; + pointer_store[pointer_index].old_value = *pointer; + *pointer = newValue; + pointer_index++; +} + +void UnityPointer_UndoAllSets() +{ + while (pointer_index > 0) + { + pointer_index--; + *(pointer_store[pointer_index].pointer) = + pointer_store[pointer_index].old_value; + + } +} + +int UnityFailureCount() +{ + return Unity.TestFailures; +} + +int UnityGetCommandLineOptions(int argc, char* argv[]) +{ + int i; + UnityFixture.Verbose = 0; + UnityFixture.GroupFilter = 0; + UnityFixture.NameFilter = 0; + UnityFixture.RepeatCount = 1; + + if (argc == 1) + return 0; + + for (i = 1; i < argc; ) + { + if (strcmp(argv[i], "-v") == 0) + { + UnityFixture.Verbose = 1; + i++; + } + else if (strcmp(argv[i], "-g") == 0) + { + i++; + if (i >= argc) + return 1; + UnityFixture.GroupFilter = argv[i]; + i++; + } + else if (strcmp(argv[i], "-n") == 0) + { + i++; + if (i >= argc) + return 1; + UnityFixture.NameFilter = argv[i]; + i++; + } + else if (strcmp(argv[i], "-r") == 0) + { + UnityFixture.RepeatCount = 2; + i++; + if (i < argc) + { + if (*(argv[i]) >= '0' && *(argv[i]) <= '9') + { + UnityFixture.RepeatCount = atoi(argv[i]); + i++; + } + } + } + } + return 0; +} + +void UnityConcludeFixtureTest() +{ + if (Unity.CurrentTestIgnored) + { + Unity.TestIgnores++; + } + else if (!Unity.CurrentTestFailed) + { + if (UnityFixture.Verbose) + { + UnityPrint(" PASS"); + UNITY_OUTPUT_CHAR('\n'); + } + } + else if (Unity.CurrentTestFailed) + { + Unity.TestFailures++; + } + + Unity.CurrentTestFailed = 0; + Unity.CurrentTestIgnored = 0; +} + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.h b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.h new file mode 100644 index 0000000..da1f871 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.h @@ -0,0 +1,81 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FIXTURE_H_ +#define UNITY_FIXTURE_H_ + +#include "unity.h" +#include "unity_internals.h" +#include "unity_fixture_malloc_overrides.h" +#include "unity_fixture_internals.h" + +int UnityMain(int argc, char* argv[], void (*runAllTests)()); + + +#define TEST_GROUP(group)\ + int TEST_GROUP_##group = 0 + +#define TEST_SETUP(group) void TEST_##group##_SETUP() + +#define TEST_TEAR_DOWN(group) void TEST_##group##_TEAR_DOWN() + + +#define TEST(group, name) \ + void TEST_##group##_##name##_();\ + void TEST_##group##_##name##_run()\ + {\ + UnityTestRunner(TEST_##group##_SETUP,\ + TEST_##group##_##name##_,\ + TEST_##group##_TEAR_DOWN,\ + "TEST(" #group ", " #name ")",\ + #group, #name,\ + __FILE__, __LINE__);\ + }\ + void TEST_##group##_##name##_() + +#define IGNORE_TEST(group, name) \ + void TEST_##group##_##name##_();\ + void TEST_##group##_##name##_run()\ + {\ + UnityIgnoreTest();\ + }\ + void TEST_##group##_##name##_() + +#define DECLARE_TEST_CASE(group, name) \ + void TEST_##group##_##name##_run() + +#define RUN_TEST_CASE(group, name) \ + DECLARE_TEST_CASE(group, name);\ + TEST_##group##_##name##_run(); + +//This goes at the bottom of each test file or in a separate c file +#define TEST_GROUP_RUNNER(group)\ + void TEST_##group##_GROUP_RUNNER_runAll();\ + void TEST_##group##_GROUP_RUNNER()\ + {\ + TEST_##group##_GROUP_RUNNER_runAll();\ + }\ + void TEST_##group##_GROUP_RUNNER_runAll() + +//Call this from main +#define RUN_TEST_GROUP(group)\ + void TEST_##group##_GROUP_RUNNER();\ + TEST_##group##_GROUP_RUNNER(); + +//CppUTest Compatibility Macros +#define UT_PTR_SET(ptr, newPointerValue) UnityPointer_Set((void**)&ptr, (void*)newPointerValue) +#define TEST_ASSERT_POINTERS_EQUAL(expected, actual) TEST_ASSERT_EQUAL_PTR(expected, actual) +#define TEST_ASSERT_BYTES_EQUAL(expected, actual) TEST_ASSERT_EQUAL_HEX8(0xff & (expected), 0xff & (actual)) +#define FAIL(message) TEST_FAIL((message)) +#define CHECK(condition) TEST_ASSERT_TRUE((condition)) +#define LONGS_EQUAL(expected, actual) TEST_ASSERT_EQUAL_INT((expected), (actual)) +#define STRCMP_EQUAL(expected, actual) TEST_ASSERT_EQUAL_STRING((expected), (actual)) +#define DOUBLES_EQUAL(expected, actual, delta) TEST_ASSERT_FLOAT_WITHIN(((expected), (actual), (delta)) + +void UnityMalloc_MakeMallocFailAfterCount(int count); + +#endif /* UNITY_FIXTURE_H_ */ diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_internals.h b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_internals.h new file mode 100644 index 0000000..db23f67 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_internals.h @@ -0,0 +1,44 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FIXTURE_INTERNALS_H_ +#define UNITY_FIXTURE_INTERNALS_H_ + +typedef struct _UNITY_FIXTURE_T +{ + int Verbose; + unsigned int RepeatCount; + const char* NameFilter; + const char* GroupFilter; +} UNITY_FIXTURE_T; + +typedef void unityfunction(); +void UnityTestRunner(unityfunction * setup, + unityfunction * body, + unityfunction * teardown, + const char * printableName, + const char * group, + const char * name, + const char * file, int line); + +void UnityIgnoreTest(); +void UnityMalloc_StartTest(); +void UnityMalloc_EndTest(); +int UnityFailureCount(); +int UnityGetCommandLineOptions(int argc, char* argv[]); +void UnityConcludeFixtureTest(); + +void UnityPointer_Set(void ** ptr, void * newValue); +void UnityPointer_UndoAllSets(); +void UnityPointer_Init(); + +void UnityAssertEqualPointer(const void * expected, + const void * actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +#endif /* UNITY_FIXTURE_INTERNALS_H_ */ diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h new file mode 100644 index 0000000..38f8e34 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h @@ -0,0 +1,16 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FIXTURE_MALLOC_OVERRIDES_H_ +#define UNITY_FIXTURE_MALLOC_OVERRIDES_H_ + +#define malloc unity_malloc +#define calloc unity_calloc +#define realloc unity_realloc +#define free unity_free + +#endif /* UNITY_FIXTURE_MALLOC_OVERRIDES_H_ */ diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/main/AllTests.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/main/AllTests.c new file mode 100644 index 0000000..ccb775b --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/main/AllTests.c @@ -0,0 +1,21 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" + +static void runAllTests() +{ + RUN_TEST_GROUP(UnityFixture); + RUN_TEST_GROUP(UnityCommandOptions); + RUN_TEST_GROUP(LeakDetection) +} + +int main(int argc, char* argv[]) +{ + return UnityMain(argc, argv, runAllTests); +} + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/testunity_fixture.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/testunity_fixture.c new file mode 100644 index 0000000..de0c04c --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/testunity_fixture.c @@ -0,0 +1,39 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" + +static int data = -1; + +TEST_GROUP(mygroup); + +TEST_SETUP(mygroup) +{ + data = 0; +} + +TEST_TEAR_DOWN(mygroup) +{ + data = -1; +} + +TEST(mygroup, test1) +{ + TEST_ASSERT_EQUAL_INT(0, data); +} + +TEST(mygroup, test2) +{ + TEST_ASSERT_EQUAL_INT(0, data); + data = 5; +} + +TEST(mygroup, test3) +{ + data = 7; + TEST_ASSERT_EQUAL_INT(7, data); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_Test.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_Test.c new file mode 100644 index 0000000..b8b4524 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_Test.c @@ -0,0 +1,321 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" +#include "unity_output_Spy.h" +#include +#include + +extern UNITY_FIXTURE_T UnityFixture; + +TEST_GROUP(UnityFixture); + +TEST_SETUP(UnityFixture) +{ +} + +TEST_TEAR_DOWN(UnityFixture) +{ +} + +int my_int; +int* pointer1 = 0; +int* pointer2 = (int*)2; +int* pointer3 = (int*)3; +int int1; +int int2; +int int3; +int int4; + +TEST(UnityFixture, PointerSetting) +{ + TEST_ASSERT_POINTERS_EQUAL(pointer1, 0); + UT_PTR_SET(pointer1, &int1); + UT_PTR_SET(pointer2, &int2); + UT_PTR_SET(pointer3, &int3); + TEST_ASSERT_POINTERS_EQUAL(pointer1, &int1); + TEST_ASSERT_POINTERS_EQUAL(pointer2, &int2); + TEST_ASSERT_POINTERS_EQUAL(pointer3, &int3); + UT_PTR_SET(pointer1, &int4); + UnityPointer_UndoAllSets(); + TEST_ASSERT_POINTERS_EQUAL(pointer1, 0); + TEST_ASSERT_POINTERS_EQUAL(pointer2, (int*)2); + TEST_ASSERT_POINTERS_EQUAL(pointer3, (int*)3); +} + +TEST(UnityFixture, ForceMallocFail) +{ + UnityMalloc_MakeMallocFailAfterCount(1); + void* m = malloc(10); + CHECK(m); + void* mfails = malloc(10); + TEST_ASSERT_POINTERS_EQUAL(0, mfails); + free(m); +} + +TEST(UnityFixture, ReallocSmallerIsUnchanged) +{ + void* m1 = malloc(10); + void* m2 = realloc(m1, 5); + TEST_ASSERT_POINTERS_EQUAL(m1, m2); + free(m2); +} + +TEST(UnityFixture, ReallocSameIsUnchanged) +{ + void* m1 = malloc(10); + void* m2 = realloc(m1, 10); + TEST_ASSERT_POINTERS_EQUAL(m1, m2); + free(m2); +} + +TEST(UnityFixture, ReallocLargerNeeded) +{ + void* m1 = malloc(10); + strcpy((char*)m1, "123456789"); + void* m2 = realloc(m1, 15); + CHECK(m1 != m2); + STRCMP_EQUAL("123456789", m2); + free(m2); +} + +TEST(UnityFixture, ReallocNullPointerIsLikeMalloc) +{ + void* m = realloc(0, 15); + CHECK(m != 0); + free(m); +} + +TEST(UnityFixture, ReallocSizeZeroFreesMemAndReturnsNullPointer) +{ + void* m1 = malloc(10); + void* m2 = realloc(m1, 0); + TEST_ASSERT_POINTERS_EQUAL(0, m2); +} + +TEST(UnityFixture, CallocFillsWithZero) +{ + void* m = calloc(3, sizeof(char)); + char* s = (char*)m; + TEST_ASSERT_BYTES_EQUAL(0, s[0]); + TEST_ASSERT_BYTES_EQUAL(0, s[1]); + TEST_ASSERT_BYTES_EQUAL(0, s[2]); + free(m); +} + +char *p1; +char *p2; + +TEST(UnityFixture, PointerSet) +{ + char c1; + char c2; + char newC1; + char newC2; + p1 = &c1; + p2 = &c2; + + UnityPointer_Init(10); + UT_PTR_SET(p1, &newC1); + UT_PTR_SET(p2, &newC2); + TEST_ASSERT_POINTERS_EQUAL(&newC1, p1); + TEST_ASSERT_POINTERS_EQUAL(&newC2, p2); + UnityPointer_UndoAllSets(); + TEST_ASSERT_POINTERS_EQUAL(&c1, p1); + TEST_ASSERT_POINTERS_EQUAL(&c2, p2); +} + +//------------------------------------------------------------ + +TEST_GROUP(UnityCommandOptions); + +int savedVerbose; +int savedRepeat; +const char* savedName; +const char* savedGroup; + +TEST_SETUP(UnityCommandOptions) +{ + savedVerbose = UnityFixture.Verbose; + savedRepeat = UnityFixture.RepeatCount; + savedName = UnityFixture.NameFilter; + savedGroup = UnityFixture.GroupFilter; +} + +TEST_TEAR_DOWN(UnityCommandOptions) +{ + UnityFixture.Verbose = savedVerbose; + UnityFixture.RepeatCount= savedRepeat; + UnityFixture.NameFilter = savedName; + UnityFixture.GroupFilter = savedGroup; +} + + +static char* noOptions[] = { + "testrunner.exe" +}; + +TEST(UnityCommandOptions, DefaultOptions) +{ + UnityGetCommandLineOptions(1, noOptions); + TEST_ASSERT_EQUAL(0, UnityFixture.Verbose); + TEST_ASSERT_POINTERS_EQUAL(0, UnityFixture.GroupFilter); + TEST_ASSERT_POINTERS_EQUAL(0, UnityFixture.NameFilter); + TEST_ASSERT_EQUAL(1, UnityFixture.RepeatCount); +} + +static char* verbose[] = { + "testrunner.exe", + "-v" +}; + +TEST(UnityCommandOptions, OptionVerbose) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(2, verbose)); + TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); +} + +static char* group[] = { + "testrunner.exe", + "-g", "groupname" +}; + +TEST(UnityCommandOptions, OptionSelectTestByGroup) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, group)); + STRCMP_EQUAL("groupname", UnityFixture.GroupFilter); +} + +static char* name[] = { + "testrunner.exe", + "-n", "testname" +}; + +TEST(UnityCommandOptions, OptionSelectTestByName) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, name)); + STRCMP_EQUAL("testname", UnityFixture.NameFilter); +} + +static char* repeat[] = { + "testrunner.exe", + "-r", "99" +}; + +TEST(UnityCommandOptions, OptionSelectRepeatTestsDefaultCount) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(2, repeat)); + TEST_ASSERT_EQUAL(2, UnityFixture.RepeatCount); +} + +TEST(UnityCommandOptions, OptionSelectRepeatTestsSpecificCount) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, repeat)); + TEST_ASSERT_EQUAL(99, UnityFixture.RepeatCount); +} + +static char* multiple[] = { + "testrunner.exe", + "-v", + "-g", "groupname", + "-n", "testname", + "-r", "98" +}; + +TEST(UnityCommandOptions, MultipleOptions) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(8, multiple)); + TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); + STRCMP_EQUAL("groupname", UnityFixture.GroupFilter); + STRCMP_EQUAL("testname", UnityFixture.NameFilter); + TEST_ASSERT_EQUAL(98, UnityFixture.RepeatCount); +} + +static char* dashRNotLast[] = { + "testrunner.exe", + "-v", + "-g", "gggg", + "-r", + "-n", "tttt", +}; + +TEST(UnityCommandOptions, MultipleOptionsDashRNotLastAndNoValueSpecified) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(7, dashRNotLast)); + TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); + STRCMP_EQUAL("gggg", UnityFixture.GroupFilter); + STRCMP_EQUAL("tttt", UnityFixture.NameFilter); + TEST_ASSERT_EQUAL(2, UnityFixture.RepeatCount); +} + + +//------------------------------------------------------------ + +TEST_GROUP(LeakDetection); + +TEST_SETUP(LeakDetection) +{ + UnityOutputCharSpy_Create(1000); +} + +TEST_TEAR_DOWN(LeakDetection) +{ + UnityOutputCharSpy_Destroy(); +} + +#define EXPECT_ABORT_BEGIN \ + { \ + jmp_buf TestAbortFrame; \ + memcpy(TestAbortFrame, Unity.AbortFrame, sizeof(jmp_buf)); \ + if (TEST_PROTECT()) \ + { + +#define EXPECT_ABORT_END \ + } \ + memcpy(Unity.AbortFrame, TestAbortFrame, sizeof(jmp_buf)); \ + } + +TEST(LeakDetection, DetectsLeak) +{ + void* m = malloc(10); + UnityOutputCharSpy_Enable(1); + EXPECT_ABORT_BEGIN + UnityMalloc_EndTest(); + EXPECT_ABORT_END + UnityOutputCharSpy_Enable(0); + CHECK(strstr(UnityOutputCharSpy_Get(), "This test leaks!")); + free(m); + Unity.CurrentTestFailed = 0; +} + +TEST(LeakDetection, BufferOverrunFoundDuringFree) +{ + void* m = malloc(10); + char* s = (char*)m; + s[10] = (char)0xFF; + UnityOutputCharSpy_Enable(1); + EXPECT_ABORT_BEGIN + free(m); + EXPECT_ABORT_END + UnityOutputCharSpy_Enable(0); + CHECK(strstr(UnityOutputCharSpy_Get(), "Buffer overrun detected during free()")); + Unity.CurrentTestFailed = 0; +} + +TEST(LeakDetection, BufferOverrunFoundDuringRealloc) +{ + void* m = malloc(10); + char* s = (char*)m; + s[10] = (char)0xFF; + UnityOutputCharSpy_Enable(1); + EXPECT_ABORT_BEGIN + m = realloc(m, 100); + EXPECT_ABORT_END + UnityOutputCharSpy_Enable(0); + CHECK(strstr(UnityOutputCharSpy_Get(), "Buffer overrun detected during realloc()")); + Unity.CurrentTestFailed = 0; +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c new file mode 100644 index 0000000..80fec09 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c @@ -0,0 +1,40 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" + +TEST_GROUP_RUNNER(UnityFixture) +{ + RUN_TEST_CASE(UnityFixture, PointerSetting); + RUN_TEST_CASE(UnityFixture, ForceMallocFail); + RUN_TEST_CASE(UnityFixture, ReallocSmallerIsUnchanged); + RUN_TEST_CASE(UnityFixture, ReallocSameIsUnchanged); + RUN_TEST_CASE(UnityFixture, ReallocLargerNeeded); + RUN_TEST_CASE(UnityFixture, ReallocNullPointerIsLikeMalloc); + RUN_TEST_CASE(UnityFixture, ReallocSizeZeroFreesMemAndReturnsNullPointer); + RUN_TEST_CASE(UnityFixture, CallocFillsWithZero); + RUN_TEST_CASE(UnityFixture, PointerSet); +} + +TEST_GROUP_RUNNER(UnityCommandOptions) +{ + RUN_TEST_CASE(UnityCommandOptions, DefaultOptions); + RUN_TEST_CASE(UnityCommandOptions, OptionVerbose); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectTestByGroup); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectTestByName); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectRepeatTestsDefaultCount); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectRepeatTestsSpecificCount); + RUN_TEST_CASE(UnityCommandOptions, MultipleOptions); + RUN_TEST_CASE(UnityCommandOptions, MultipleOptionsDashRNotLastAndNoValueSpecified); +} + +TEST_GROUP_RUNNER(LeakDetection) +{ + RUN_TEST_CASE(LeakDetection, DetectsLeak); + RUN_TEST_CASE(LeakDetection, BufferOverrunFoundDuringFree); + RUN_TEST_CASE(LeakDetection, BufferOverrunFoundDuringRealloc); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/unity_output_Spy.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/unity_output_Spy.c new file mode 100644 index 0000000..16faefa --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/unity_output_Spy.c @@ -0,0 +1,56 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + + +#include "unity_output_Spy.h" +#include +#include +#include + +static int size; +static int count; +static char* buffer; +static int spy_enable; + +void UnityOutputCharSpy_Create(int s) +{ + size = s; + count = 0; + spy_enable = 0; + buffer = malloc(size); + memset(buffer, 0, size); +} + +void UnityOutputCharSpy_Destroy() +{ + size = 0; + free(buffer); +} + +int UnityOutputCharSpy_OutputChar(int c) +{ + if (spy_enable) + { + if (count < (size-1)) + buffer[count++] = c; + } + else + { + putchar(c); + } + return c; +} + +const char * UnityOutputCharSpy_Get() +{ + return buffer; +} + +void UnityOutputCharSpy_Enable(int enable) +{ + spy_enable = enable; +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/unity_output_Spy.h b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/unity_output_Spy.h new file mode 100644 index 0000000..7c1590e --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/unity_output_Spy.h @@ -0,0 +1,17 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef D_unity_output_Spy_H +#define D_unity_output_Spy_H + +void UnityOutputCharSpy_Create(int s); +void UnityOutputCharSpy_Destroy(); +int UnityOutputCharSpy_OutputChar(int c); +const char * UnityOutputCharSpy_Get(); +void UnityOutputCharSpy_Enable(int enable); + +#endif diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/makefile b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/makefile new file mode 100644 index 0000000..8c8444b --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/makefile @@ -0,0 +1,35 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +C_COMPILER=gcc +TARGET_BASE = testunity +ifeq ($(OS),Windows_NT) + TARGET_EXTENSION=.exe +else + TARGET_EXTENSION=.out +endif +TARGET = $(TARGET_BASE)$(TARGET_EXTENSION) +OUT_FILE=-o $(TARGET) +SRC_FILES=src/unity.c test/testunity.c build/testunity_Runner.c +INC_DIRS=-Isrc +SYMBOLS=-DTEST -DUNITY_SUPPORT_64 + +ifeq ($(OS),Windows_NT) + CLEANUP = del /F /Q build\* && del /F /Q $(TARGET) +else + CLEANUP = rm -f build/*.o ; rm -f $(TARGET) +endif + +all: clean default + +default: + ruby auto/generate_test_runner.rb test/testunity.c build/testunity_Runner.c + $(C_COMPILER) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES) $(OUT_FILE) + $(TARGET) + +clean: + $(CLEANUP) + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/rakefile.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/rakefile.rb new file mode 100644 index 0000000..3ec5d5a --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/rakefile.rb @@ -0,0 +1,48 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require HERE + 'rakefile_helper' + +include RakefileHelpers + +# Load default configuration, for now +DEFAULT_CONFIG_FILE = 'gcc.yml' +configure_toolchain(DEFAULT_CONFIG_FILE) + +desc "Test unity with its own unit tests" +task :unit do + run_tests get_unit_test_files +end + +Rake::TestTask.new(:scripts) do |t| + t.pattern = 'test/test_*.rb' + t.verbose = true +end + +desc "Generate test summary" +task :summary do + report_summary +end + +desc "Build and test Unity" +task :all => [:clean, :scripts, :unit, :summary] +task :default => [:clobber, :all] +task :ci => [:no_color, :default] +task :cruise => [:no_color, :default] + +desc "Load configuration" +task :config, :config_file do |t, args| + configure_toolchain(args[:config_file]) +end + +task :no_color do + $colour_output = false +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/rakefile_helper.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/rakefile_helper.rb new file mode 100644 index 0000000..218fcaa --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/rakefile_helper.rb @@ -0,0 +1,243 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require 'yaml' +require 'fileutils' +require HERE+'auto/unity_test_summary' +require HERE+'auto/generate_test_runner' +require HERE+'auto/colour_reporter' + +module RakefileHelpers + + C_EXTENSION = '.c' + + def load_configuration(config_file) + unless ($configured) + $cfg_file = "targets/#{config_file}" unless (config_file =~ /[\\|\/]/) + $cfg = YAML.load(File.read($cfg_file)) + $colour_output = false unless $cfg['colour'] + $configured = true if (config_file != DEFAULT_CONFIG_FILE) + end + end + + def configure_clean + CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil? + end + + def configure_toolchain(config_file=DEFAULT_CONFIG_FILE) + config_file += '.yml' unless config_file =~ /\.yml$/ + config_file = config_file unless config_file =~ /[\\|\/]/ + load_configuration(config_file) + configure_clean + end + + def get_unit_test_files + path = $cfg['compiler']['unit_tests_path'] + 'test*' + C_EXTENSION + path.gsub!(/\\/, '/') + FileList.new(path) + end + + def get_local_include_dirs + include_dirs = $cfg['compiler']['includes']['items'].dup + include_dirs.delete_if {|dir| dir.is_a?(Array)} + return include_dirs + end + + def extract_headers(filename) + includes = [] + lines = File.readlines(filename) + lines.each do |line| + m = line.match(/^\s*#include\s+\"\s*(.+\.[hH])\s*\"/) + if not m.nil? + includes << m[1] + end + end + return includes + end + + def find_source_file(header, paths) + paths.each do |dir| + src_file = dir + header.ext(C_EXTENSION) + if (File.exists?(src_file)) + return src_file + end + end + return nil + end + + def tackit(strings) + if strings.is_a?(Array) + result = "\"#{strings.join}\"" + else + result = strings + end + return result + end + + def squash(prefix, items) + result = '' + items.each { |item| result += " #{prefix}#{tackit(item)}" } + return result + end + + def build_compiler_fields + command = tackit($cfg['compiler']['path']) + if $cfg['compiler']['defines']['items'].nil? + defines = '' + else + defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items']) + end + options = squash('', $cfg['compiler']['options']) + includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :defines => defines, :options => options, :includes => includes} + end + + def compile(file, defines=[]) + compiler = build_compiler_fields + cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{file} " + + "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" + + "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" + execute(cmd_str) + end + + def build_linker_fields + command = tackit($cfg['linker']['path']) + if $cfg['linker']['options'].nil? + options = '' + else + options = squash('', $cfg['linker']['options']) + end + if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?) + includes = '' + else + includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) + end + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :options => options, :includes => includes} + end + + def link(exe_name, obj_list) + linker = build_linker_fields + cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + + (obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).join + + $cfg['linker']['bin_files']['prefix'] + ' ' + + $cfg['linker']['bin_files']['destination'] + + exe_name + $cfg['linker']['bin_files']['extension'] + execute(cmd_str) + end + + def build_simulator_fields + return nil if $cfg['simulator'].nil? + if $cfg['simulator']['path'].nil? + command = '' + else + command = (tackit($cfg['simulator']['path']) + ' ') + end + if $cfg['simulator']['pre_support'].nil? + pre_support = '' + else + pre_support = squash('', $cfg['simulator']['pre_support']) + end + if $cfg['simulator']['post_support'].nil? + post_support = '' + else + post_support = squash('', $cfg['simulator']['post_support']) + end + return {:command => command, :pre_support => pre_support, :post_support => post_support} + end + + def execute(command_string, verbose=true) + report command_string + output = `#{command_string}`.chomp + report(output) if (verbose && !output.nil? && (output.length > 0)) + if $?.exitstatus != 0 + raise "Command failed. (Returned #{$?.exitstatus})" + end + return output + end + + def report_summary + summary = UnityTestSummary.new + summary.set_root_path(HERE) + results_glob = "#{$cfg['compiler']['build_path']}*.test*" + results_glob.gsub!(/\\/, '/') + results = Dir[results_glob] + summary.set_targets(results) + summary.run + end + + def run_tests(test_files) + report 'Running Unity system tests...' + + # Tack on TEST define for compiling unit tests + load_configuration($cfg_file) + test_defines = ['TEST'] + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + $cfg['compiler']['defines']['items'] << 'TEST' + + include_dirs = get_local_include_dirs + + # Build and execute each unit test + test_files.each do |test| + obj_list = [] + + # Detect dependencies and build required modules + extract_headers(test).each do |header| + # Compile corresponding source file if it exists + src_file = find_source_file(header, include_dirs) + if !src_file.nil? + compile(src_file, test_defines) + obj_list << header.ext($cfg['compiler']['object_files']['extension']) + end + end + + # Build the test runner (generate if configured to do so) + test_base = File.basename(test, C_EXTENSION) + + runner_name = test_base + '_Runner.c' + runner_path = '' + + if $cfg['compiler']['runner_path'].nil? + runner_path = $cfg['compiler']['build_path'] + runner_name + else + runner_path = $cfg['compiler']['runner_path'] + runner_name + end + + options = $cfg[:unity] + options[:use_param_tests] = (test =~ /parameterized/) ? true : false + UnityTestRunnerGenerator.new(options).run(test, runner_path) + + compile(runner_path, test_defines) + obj_list << runner_name.ext($cfg['compiler']['object_files']['extension']) + + # Build the test module + compile(test, test_defines) + obj_list << test_base.ext($cfg['compiler']['object_files']['extension']) + + # Link the test executable + link(test_base, obj_list) + + # Execute unit test and generate results file + simulator = build_simulator_fields + executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] + if simulator.nil? + cmd_str = executable + else + cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" + end + output = execute(cmd_str) + test_results = $cfg['compiler']['build_path'] + test_base + if output.match(/OK$/m).nil? + test_results += '.testfail' + else + test_results += '.testpass' + end + File.open(test_results, 'w') { |f| f.print output } + + end + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/release/build.info b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/release/build.info new file mode 100644 index 0000000..7871b21 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/release/build.info @@ -0,0 +1,2 @@ +118 + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/release/version.info b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/release/version.info new file mode 100644 index 0000000..0d71c08 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/release/version.info @@ -0,0 +1,2 @@ +2.0 + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/src/unity.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/src/unity.c new file mode 100644 index 0000000..d85b880 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/src/unity.c @@ -0,0 +1,855 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity.h" +#include +#include + +#define UNITY_FAIL_AND_BAIL { Unity.CurrentTestFailed = 1; UNITY_OUTPUT_CHAR('\n'); longjmp(Unity.AbortFrame, 1); } +#define UNITY_IGNORE_AND_BAIL { Unity.CurrentTestIgnored = 1; UNITY_OUTPUT_CHAR('\n'); longjmp(Unity.AbortFrame, 1); } +/// return prematurely if we are already in failure or ignore state +#define UNITY_SKIP_EXECUTION { if ((Unity.CurrentTestFailed != 0) || (Unity.CurrentTestIgnored != 0)) {return;} } +#define UNITY_PRINT_EOL { UNITY_OUTPUT_CHAR('\n'); } + +struct _Unity Unity = { 0 }; + +const char* UnityStrNull = "NULL"; +const char* UnityStrSpacer = ". "; +const char* UnityStrExpected = " Expected "; +const char* UnityStrWas = " Was "; +const char* UnityStrTo = " To "; +const char* UnityStrElement = " Element "; +const char* UnityStrMemory = " Memory Mismatch"; +const char* UnityStrDelta = " Values Not Within Delta "; +const char* UnityStrPointless= " You Asked Me To Compare Nothing, Which Was Pointless."; +const char* UnityStrNullPointerForExpected= " Expected pointer to be NULL"; +const char* UnityStrNullPointerForActual = " Actual pointer was NULL"; + +const _U_UINT UnitySizeMask[] = +{ + 255, + 65535, + 65535, + 4294967295, + 4294967295, + 4294967295, + 4294967295 +#ifdef UNITY_SUPPORT_64 + ,0xFFFFFFFFFFFFFFFF +#endif +}; + +//----------------------------------------------- +// Pretty Printers & Test Result Output Handlers +//----------------------------------------------- + +void UnityPrint(const char* string) +{ + const char* pch = string; + + if (pch != NULL) + { + while (*pch) + { + // printable characters plus CR & LF are printed + if ((*pch <= 126) && (*pch >= 32)) + { + UNITY_OUTPUT_CHAR(*pch); + } + //write escaped carriage returns + else if (*pch == 13) + { + UNITY_OUTPUT_CHAR('\\'); + UNITY_OUTPUT_CHAR('r'); + } + //write escaped line feeds + else if (*pch == 10) + { + UNITY_OUTPUT_CHAR('\\'); + UNITY_OUTPUT_CHAR('n'); + } + // unprintable characters are shown as codes + else + { + UNITY_OUTPUT_CHAR('\\'); + UnityPrintNumberHex((_U_SINT)*pch, 2); + } + pch++; + } + } +} + +//----------------------------------------------- +void UnityPrintNumberByStyle(const _U_SINT number, const UNITY_DISPLAY_STYLE_T style) +{ + if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT) + { + UnityPrintNumber(number); + } + else if ((style & UNITY_DISPLAY_RANGE_UINT) == UNITY_DISPLAY_RANGE_UINT) + { + UnityPrintNumberUnsigned( (_U_UINT)number & UnitySizeMask[((_U_UINT)style & (_U_UINT)0x0F) - 1] ); + } + else + { + UnityPrintNumberHex((_U_UINT)number, (style & 0x000F) << 1); + } +} + +//----------------------------------------------- +/// basically do an itoa using as little ram as possible +void UnityPrintNumber(const _U_SINT number_to_print) +{ + _U_SINT divisor = 1; + _U_SINT next_divisor; + _U_SINT number = number_to_print; + + if (number < 0) + { + UNITY_OUTPUT_CHAR('-'); + number = -number; + } + + // figure out initial divisor + while (number / divisor > 9) + { + next_divisor = divisor * 10; + if (next_divisor > divisor) + divisor = next_divisor; + else + break; + } + + // now mod and print, then divide divisor + do + { + UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10))); + divisor /= 10; + } + while (divisor > 0); +} + +//----------------------------------------------- +/// basically do an itoa using as little ram as possible +void UnityPrintNumberUnsigned(const _U_UINT number) +{ + _U_UINT divisor = 1; + _U_UINT next_divisor; + + // figure out initial divisor + while (number / divisor > 9) + { + next_divisor = divisor * 10; + if (next_divisor > divisor) + divisor = next_divisor; + else + break; + } + + // now mod and print, then divide divisor + do + { + UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10))); + divisor /= 10; + } + while (divisor > 0); +} + +//----------------------------------------------- +void UnityPrintNumberHex(const _U_UINT number, const char nibbles_to_print) +{ + _U_UINT nibble; + char nibbles = nibbles_to_print; + UNITY_OUTPUT_CHAR('0'); + UNITY_OUTPUT_CHAR('x'); + + while (nibbles > 0) + { + nibble = (number >> (--nibbles << 2)) & 0x0000000F; + if (nibble <= 9) + { + UNITY_OUTPUT_CHAR((char)('0' + nibble)); + } + else + { + UNITY_OUTPUT_CHAR((char)('A' - 10 + nibble)); + } + } +} + +//----------------------------------------------- +void UnityPrintMask(const _U_UINT mask, const _U_UINT number) +{ + _U_UINT current_bit = (_U_UINT)1 << (UNITY_INT_WIDTH - 1); + _US32 i; + + for (i = 0; i < UNITY_INT_WIDTH; i++) + { + if (current_bit & mask) + { + if (current_bit & number) + { + UNITY_OUTPUT_CHAR('1'); + } + else + { + UNITY_OUTPUT_CHAR('0'); + } + } + else + { + UNITY_OUTPUT_CHAR('X'); + } + current_bit = current_bit >> 1; + } +} + +//----------------------------------------------- +#ifdef UNITY_FLOAT_VERBOSE +void UnityPrintFloat(_UF number) +{ + char TempBuffer[32]; + sprintf(TempBuffer, "%.6f", number); + UnityPrint(TempBuffer); +} +#endif + +//----------------------------------------------- +void UnityTestResultsBegin(const char* file, const UNITY_LINE_TYPE line) +{ + UnityPrint(file); + UNITY_OUTPUT_CHAR(':'); + UnityPrintNumber(line); + UNITY_OUTPUT_CHAR(':'); + UnityPrint(Unity.CurrentTestName); + UNITY_OUTPUT_CHAR(':'); +} + +//----------------------------------------------- +void UnityTestResultsFailBegin(const UNITY_LINE_TYPE line) +{ + UnityTestResultsBegin(Unity.TestFile, line); + UnityPrint("FAIL:"); +} + +//----------------------------------------------- +void UnityConcludeTest(void) +{ + if (Unity.CurrentTestIgnored) + { + Unity.TestIgnores++; + } + else if (!Unity.CurrentTestFailed) + { + UnityTestResultsBegin(Unity.TestFile, Unity.CurrentTestLineNumber); + UnityPrint("PASS"); + UNITY_PRINT_EOL; + } + else + { + Unity.TestFailures++; + } + + Unity.CurrentTestFailed = 0; + Unity.CurrentTestIgnored = 0; +} + +//----------------------------------------------- +void UnityAddMsgIfSpecified(const char* msg) +{ + if (msg) + { + UnityPrint(UnityStrSpacer); + UnityPrint(msg); + } +} + +//----------------------------------------------- +void UnityPrintExpectedAndActualStrings(const char* expected, const char* actual) +{ + UnityPrint(UnityStrExpected); + if (expected != NULL) + { + UNITY_OUTPUT_CHAR('\''); + UnityPrint(expected); + UNITY_OUTPUT_CHAR('\''); + } + else + { + UnityPrint(UnityStrNull); + } + UnityPrint(UnityStrWas); + if (actual != NULL) + { + UNITY_OUTPUT_CHAR('\''); + UnityPrint(actual); + UNITY_OUTPUT_CHAR('\''); + } + else + { + UnityPrint(UnityStrNull); + } +} + +//----------------------------------------------- +// Assertion & Control Helpers +//----------------------------------------------- + +int UnityCheckArraysForNull(const void* expected, const void* actual, const UNITY_LINE_TYPE lineNumber, const char* msg) +{ + //return true if they are both NULL + if ((expected == NULL) && (actual == NULL)) + return 1; + + //throw error if just expected is NULL + if (expected == NULL) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrNullPointerForExpected); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + //throw error if just actual is NULL + if (actual == NULL) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrNullPointerForActual); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + //return false if neither is NULL + return 0; +} + +//----------------------------------------------- +// Assertion Functions +//----------------------------------------------- + +void UnityAssertBits(const _U_SINT mask, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + UNITY_SKIP_EXECUTION; + + if ((mask & expected) != (mask & actual)) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrExpected); + UnityPrintMask(mask, expected); + UnityPrint(UnityStrWas); + UnityPrintMask(mask, actual); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualNumber(const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style) +{ + UNITY_SKIP_EXECUTION; + + if (expected != actual) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(expected, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(actual, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualIntArray(const _U_SINT* expected, + const _U_SINT* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style) +{ + _UU32 elements = num_elements; + const _US8* ptr_exp = (_US8*)expected; + const _US8* ptr_act = (_US8*)actual; + + UNITY_SKIP_EXECUTION; + + if (elements == 0) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + switch(style) + { + case UNITY_DISPLAY_STYLE_HEX8: + case UNITY_DISPLAY_STYLE_INT8: + case UNITY_DISPLAY_STYLE_UINT8: + while (elements--) + { + if (*ptr_exp != *ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 1; + ptr_act += 1; + } + break; + case UNITY_DISPLAY_STYLE_HEX16: + case UNITY_DISPLAY_STYLE_INT16: + case UNITY_DISPLAY_STYLE_UINT16: + while (elements--) + { + if (*(_US16*)ptr_exp != *(_US16*)ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*(_US16*)ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*(_US16*)ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 2; + ptr_act += 2; + } + break; +#ifdef UNITY_SUPPORT_64 + case UNITY_DISPLAY_STYLE_HEX64: + case UNITY_DISPLAY_STYLE_INT64: + case UNITY_DISPLAY_STYLE_UINT64: + while (elements--) + { + if (*(_US64*)ptr_exp != *(_US64*)ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*(_US64*)ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*(_US64*)ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 8; + ptr_act += 8; + } + break; +#endif + default: + while (elements--) + { + if (*(_US32*)ptr_exp != *(_US32*)ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*(_US32*)ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*(_US32*)ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 4; + ptr_act += 4; + } + break; + } +} + +//----------------------------------------------- +#ifndef UNITY_EXCLUDE_FLOAT +void UnityAssertEqualFloatArray(const _UF* expected, + const _UF* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UU32 elements = num_elements; + const _UF* ptr_expected = expected; + const _UF* ptr_actual = actual; + _UF diff, tol; + + UNITY_SKIP_EXECUTION; + + if (elements == 0) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + while (elements--) + { + diff = *ptr_expected - *ptr_actual; + if (diff < 0.0) + diff = 0.0 - diff; + tol = UNITY_FLOAT_PRECISION * *ptr_expected; + if (tol < 0.0) + tol = 0.0 - tol; + if (diff > tol) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); +#ifdef UNITY_FLOAT_VERBOSE + UnityPrint(UnityStrExpected); + UnityPrintFloat(*ptr_expected); + UnityPrint(UnityStrWas); + UnityPrintFloat(*ptr_actual); +#else + UnityPrint(UnityStrDelta); +#endif + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_expected++; + ptr_actual++; + } +} + +//----------------------------------------------- +void UnityAssertFloatsWithin(const _UF delta, + const _UF expected, + const _UF actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UF diff = actual - expected; + _UF pos_delta = delta; + + UNITY_SKIP_EXECUTION; + + if (diff < 0) + { + diff = 0.0f - diff; + } + if (pos_delta < 0) + { + pos_delta = 0.0f - pos_delta; + } + + if (pos_delta < diff) + { + UnityTestResultsFailBegin(lineNumber); +#ifdef UNITY_FLOAT_VERBOSE + UnityPrint(UnityStrExpected); + UnityPrintFloat(expected); + UnityPrint(UnityStrWas); + UnityPrintFloat(actual); +#else + UnityPrint(UnityStrDelta); +#endif + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} +#endif + +//----------------------------------------------- +void UnityAssertNumbersWithin( const _U_SINT delta, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style) +{ + UNITY_SKIP_EXECUTION; + + if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT) + { + if (actual > expected) + Unity.CurrentTestFailed = ((actual - expected) > delta); + else + Unity.CurrentTestFailed = ((expected - actual) > delta); + } + else + { + if ((_U_UINT)actual > (_U_UINT)expected) + Unity.CurrentTestFailed = ((_U_UINT)(actual - expected) > (_U_UINT)delta); + else + Unity.CurrentTestFailed = ((_U_UINT)(expected - actual) > (_U_UINT)delta); + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrDelta); + UnityPrintNumberByStyle(delta, style); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(expected, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(actual, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualString(const char* expected, + const char* actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UU32 i; + + UNITY_SKIP_EXECUTION; + + // if both pointers not null compare the strings + if (expected && actual) + { + for (i = 0; expected[i] || actual[i]; i++) + { + if (expected[i] != actual[i]) + { + Unity.CurrentTestFailed = 1; + break; + } + } + } + else + { // handle case of one pointers being null (if both null, test should pass) + if (expected != actual) + { + Unity.CurrentTestFailed = 1; + } + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrintExpectedAndActualStrings(expected, actual); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualStringArray( const char** expected, + const char** actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UU32 i, j = 0; + + UNITY_SKIP_EXECUTION; + + // if no elements, it's an error + if (num_elements == 0) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + do + { + // if both pointers not null compare the strings + if (expected[j] && actual[j]) + { + for (i = 0; expected[j][i] || actual[j][i]; i++) + { + if (expected[j][i] != actual[j][i]) + { + Unity.CurrentTestFailed = 1; + break; + } + } + } + else + { // handle case of one pointers being null (if both null, test should pass) + if (expected[j] != actual[j]) + { + Unity.CurrentTestFailed = 1; + } + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + if (num_elements > 1) + { + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - j - 1), UNITY_DISPLAY_STYLE_UINT); + } + UnityPrintExpectedAndActualStrings((const char*)(expected[j]), (const char*)(actual[j])); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + } while (++j < num_elements); +} + +//----------------------------------------------- +void UnityAssertEqualMemory( const void* expected, + const void* actual, + _UU32 length, + _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + unsigned char* expected_ptr = (unsigned char*)expected; + unsigned char* actual_ptr = (unsigned char*)actual; + _UU32 elements = num_elements; + + UNITY_SKIP_EXECUTION; + + if ((elements == 0) || (length == 0)) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + while (elements--) + { + if (memcmp((const void*)expected_ptr, (const void*)actual_ptr, length) != 0) + { + Unity.CurrentTestFailed = 1; + break; + } + expected_ptr += length; + actual_ptr += length; + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + if (num_elements > 1) + { + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + } + UnityPrint(UnityStrMemory); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +// Control Functions +//----------------------------------------------- + +void UnityFail(const char* msg, const UNITY_LINE_TYPE line) +{ + UNITY_SKIP_EXECUTION; + + UnityTestResultsBegin(Unity.TestFile, line); + UnityPrint("FAIL"); + if (msg != NULL) + { + UNITY_OUTPUT_CHAR(':'); + if (msg[0] != ' ') + { + UNITY_OUTPUT_CHAR(' '); + } + UnityPrint(msg); + } + UNITY_FAIL_AND_BAIL; +} + +//----------------------------------------------- +void UnityIgnore(const char* msg, const UNITY_LINE_TYPE line) +{ + UNITY_SKIP_EXECUTION; + + UnityTestResultsBegin(Unity.TestFile, line); + UnityPrint("IGNORE"); + if (msg != NULL) + { + UNITY_OUTPUT_CHAR(':'); + UNITY_OUTPUT_CHAR(' '); + UnityPrint(msg); + } + UNITY_IGNORE_AND_BAIL; +} + +//----------------------------------------------- +void setUp(void); +void tearDown(void); +void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum) +{ + Unity.CurrentTestName = FuncName; + Unity.CurrentTestLineNumber = FuncLineNum; + Unity.NumberOfTests++; + if (TEST_PROTECT()) + { + setUp(); + Func(); + } + if (TEST_PROTECT() && !(Unity.CurrentTestIgnored)) + { + tearDown(); + } + UnityConcludeTest(); +} + +//----------------------------------------------- +void UnityBegin(void) +{ + Unity.NumberOfTests = 0; +} + +//----------------------------------------------- +int UnityEnd(void) +{ + UnityPrint("-----------------------"); + UNITY_PRINT_EOL; + UnityPrintNumber(Unity.NumberOfTests); + UnityPrint(" Tests "); + UnityPrintNumber(Unity.TestFailures); + UnityPrint(" Failures "); + UnityPrintNumber(Unity.TestIgnores); + UnityPrint(" Ignored"); + UNITY_PRINT_EOL; + if (Unity.TestFailures == 0U) + { + UnityPrint("OK"); + } + else + { + UnityPrint("FAIL"); + } + UNITY_PRINT_EOL; + return Unity.TestFailures; +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/src/unity.h b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/src/unity.h new file mode 100644 index 0000000..0b1b187 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/src/unity.h @@ -0,0 +1,213 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FRAMEWORK_H +#define UNITY_FRAMEWORK_H + +#define UNITY + +#include "unity_internals.h" + +//------------------------------------------------------- +// Configuration Options +//------------------------------------------------------- + +// Integers +// - Unity assumes 32 bit integers by default +// - If your compiler treats ints of a different size, define UNITY_INT_WIDTH + +// Floats +// - define UNITY_EXCLUDE_FLOAT to disallow floating point comparisons +// - define UNITY_FLOAT_PRECISION to specify the precision to use when doing TEST_ASSERT_EQUAL_FLOAT +// - define UNITY_FLOAT_TYPE to specify doubles instead of single precision floats +// - define UNITY_FLOAT_VERBOSE to print floating point values in errors (uses sprintf) + +// Output +// - by default, Unity prints to standard out with putchar. define UNITY_OUTPUT_CHAR(a) with a different function if desired + +// Optimization +// - by default, line numbers are stored in unsigned shorts. Define UNITY_LINE_TYPE with a different type if your files are huge +// - by default, test and failure counters are unsigned shorts. Define UNITY_COUNTER_TYPE with a different type if you want to save space or have more than 65535 Tests. + +// Test Cases +// - define UNITY_SUPPORT_TEST_CASES to include the TEST_CASE macro, though really it's mostly about the runner generator script + +// Parameterized Tests +// - you'll want to create a define of TEST_CASE(...) which basically evaluates to nothing + +//------------------------------------------------------- +// Test Running Macros +//------------------------------------------------------- + +#define TEST_PROTECT() (setjmp(Unity.AbortFrame) == 0) + +#define TEST_ABORT() {longjmp(Unity.AbortFrame, 1);} + +#ifndef RUN_TEST +#define RUN_TEST(func, line_num) UnityDefaultTestRun(func, #func, line_num) +#endif + +#define TEST_LINE_NUM (Unity.CurrentTestLineNumber) +#define TEST_IS_IGNORED (Unity.CurrentTestIgnored) + +//------------------------------------------------------- +// Basic Fail and Ignore +//------------------------------------------------------- + +#define TEST_FAIL_MESSAGE(message) UNITY_TEST_FAIL(__LINE__, message) +#define TEST_FAIL() UNITY_TEST_FAIL(__LINE__, NULL) +#define TEST_IGNORE_MESSAGE(message) UNITY_TEST_IGNORE(__LINE__, message) +#define TEST_IGNORE() UNITY_TEST_IGNORE(__LINE__, NULL) +#define TEST_ONLY() + +//------------------------------------------------------- +// Test Asserts (simple) +//------------------------------------------------------- + +//Boolean +#define TEST_ASSERT(condition) UNITY_TEST_ASSERT( (condition), __LINE__, " Expression Evaluated To FALSE") +#define TEST_ASSERT_TRUE(condition) UNITY_TEST_ASSERT( (condition), __LINE__, " Expected TRUE Was FALSE") +#define TEST_ASSERT_UNLESS(condition) UNITY_TEST_ASSERT( !(condition), __LINE__, " Expression Evaluated To TRUE") +#define TEST_ASSERT_FALSE(condition) UNITY_TEST_ASSERT( !(condition), __LINE__, " Expected FALSE Was TRUE") +#define TEST_ASSERT_NULL(pointer) UNITY_TEST_ASSERT_NULL( (pointer), __LINE__, " Expected NULL") +#define TEST_ASSERT_NOT_NULL(pointer) UNITY_TEST_ASSERT_NOT_NULL((pointer), __LINE__, " Expected Non-NULL") + +//Integers (of all sizes) +#define TEST_ASSERT_EQUAL_INT(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT8(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT8((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT16(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT16((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT32(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT32((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT64(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT64((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_NOT_EQUAL(expected, actual) UNITY_TEST_ASSERT(((expected) != (actual)), __LINE__, " Expected Not-Equal") +#define TEST_ASSERT_EQUAL_UINT(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT8(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT8( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT16(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT16( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT32(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT32( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT64(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT64( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX8(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX8( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX16(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX16((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX32(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX64(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX64((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_BITS(mask, expected, actual) UNITY_TEST_ASSERT_BITS((mask), (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_BITS_HIGH(mask, actual) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(-1), (actual), __LINE__, NULL) +#define TEST_ASSERT_BITS_LOW(mask, actual) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(0), (actual), __LINE__, NULL) +#define TEST_ASSERT_BIT_HIGH(bit, actual) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(-1), (actual), __LINE__, NULL) +#define TEST_ASSERT_BIT_LOW(bit, actual) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(0), (actual), __LINE__, NULL) + +//Integer Ranges (of all sizes) +#define TEST_ASSERT_INT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_UINT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX8_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX16_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX32_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX64_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, __LINE__, NULL) + +//Structs and Strings +#define TEST_ASSERT_EQUAL_PTR(expected, actual) UNITY_TEST_ASSERT_EQUAL_PTR((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_STRING(expected, actual) UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_MEMORY(expected, actual, len) UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, __LINE__, NULL) + +//Arrays +#define TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements) UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, __LINE__, NULL) + +//Floating Point (If Enabled) +#define TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_FLOAT(expected, actual) UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, __LINE__, NULL) + +//------------------------------------------------------- +// Test Asserts (with additional messages) +//------------------------------------------------------- + +//Boolean +#define TEST_ASSERT_MESSAGE(condition, message) UNITY_TEST_ASSERT( (condition), __LINE__, message) +#define TEST_ASSERT_TRUE_MESSAGE(condition, message) UNITY_TEST_ASSERT( (condition), __LINE__, message) +#define TEST_ASSERT_UNLESS_MESSAGE(condition, message) UNITY_TEST_ASSERT( !(condition), __LINE__, message) +#define TEST_ASSERT_FALSE_MESSAGE(condition, message) UNITY_TEST_ASSERT( !(condition), __LINE__, message) +#define TEST_ASSERT_NULL_MESSAGE(pointer, message) UNITY_TEST_ASSERT_NULL( (pointer), __LINE__, message) +#define TEST_ASSERT_NOT_NULL_MESSAGE(pointer, message) UNITY_TEST_ASSERT_NOT_NULL((pointer), __LINE__, message) + +//Integers (of all sizes) +#define TEST_ASSERT_EQUAL_INT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT8((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT16((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT32((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT64((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, message) +#define TEST_ASSERT_NOT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT(((expected) != (actual)), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT8( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT16( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT32( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT64( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX8( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX16((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX64((expected), (actual), __LINE__, message) +#define TEST_ASSERT_BITS_MESSAGE(mask, expected, actual, message) UNITY_TEST_ASSERT_BITS((mask), (expected), (actual), __LINE__, message) +#define TEST_ASSERT_BITS_HIGH_MESSAGE(mask, actual, message) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(-1), (actual), __LINE__, message) +#define TEST_ASSERT_BITS_LOW_MESSAGE(mask, actual, message) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(0), (actual), __LINE__, message) +#define TEST_ASSERT_BIT_HIGH_MESSAGE(bit, actual, message) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(-1), (actual), __LINE__, message) +#define TEST_ASSERT_BIT_LOW_MESSAGE(bit, actual, message) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(0), (actual), __LINE__, message) + +//Integer Ranges (of all sizes) +#define TEST_ASSERT_INT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_UINT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX8_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX16_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX32_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX64_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, __LINE__, message) + +//Structs and Strings +#define TEST_ASSERT_EQUAL_PTR_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_PTR(expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_STRING_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_MEMORY_MESSAGE(expected, actual, len, message) UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, __LINE__, message) + +//Arrays +#define TEST_ASSERT_EQUAL_INT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_STRING_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_MEMORY_ARRAY_MESSAGE(expected, actual, len, num_elements, message) UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, __LINE__, message) + +//Floating Point (If Enabled) +#define TEST_ASSERT_FLOAT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_FLOAT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_FLOAT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, __LINE__, message) +#endif diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/src/unity_internals.h b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/src/unity_internals.h new file mode 100644 index 0000000..29c9d1d --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/src/unity_internals.h @@ -0,0 +1,355 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_INTERNALS_H +#define UNITY_INTERNALS_H + +#include +#include + +//------------------------------------------------------- +// Int Support +//------------------------------------------------------- + +#ifndef UNITY_INT_WIDTH +#define UNITY_INT_WIDTH (32) +#endif + +#ifndef UNITY_LONG_WIDTH +#define UNITY_LONG_WIDTH (32) +#endif + +#if (UNITY_INT_WIDTH == 32) + typedef unsigned char _UU8; + typedef unsigned short _UU16; + typedef unsigned int _UU32; + typedef signed char _US8; + typedef signed short _US16; + typedef signed int _US32; +#elif (UNITY_INT_WIDTH == 16) + typedef unsigned char _UU8; + typedef unsigned int _UU16; + typedef unsigned long _UU32; + typedef signed char _US8; + typedef signed int _US16; + typedef signed long _US32; +#else + #error Invalid UNITY_INT_WIDTH specified! (16 or 32 are supported) +#endif + +//------------------------------------------------------- +// 64-bit Support +//------------------------------------------------------- + +#ifndef UNITY_SUPPORT_64 + +//No 64-bit Support +typedef _UU32 _U_UINT; +typedef _US32 _U_SINT; + +#else + +//64-bit Support +#if (UNITY_LONG_WIDTH == 32) + typedef unsigned long long _UU64; + typedef signed long long _US64; +#elif (UNITY_LONG_WIDTH == 64) + typedef unsigned long _UU64; + typedef signed long _US64; +#else + #error Invalid UNITY_LONG_WIDTH specified! (32 or 64 are supported) +#endif +typedef _UU64 _U_UINT; +typedef _US64 _U_SINT; + +#endif + +//------------------------------------------------------- +// Pointer Support +//------------------------------------------------------- + +#ifndef UNITY_POINTER_WIDTH +#define UNITY_POINTER_WIDTH (32) +#endif + +#if (UNITY_POINTER_WIDTH == 32) + typedef _UU32 _UP; +#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX32 +#elif (UNITY_POINTER_WIDTH == 64) + typedef _UU64 _UP; +#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX64 +#elif (UNITY_POINTER_WIDTH == 16) + typedef _UU16 _UP; +#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX16 +#else + #error Invalid UNITY_POINTER_WIDTH specified! (16, 32 or 64 are supported) +#endif + +//------------------------------------------------------- +// Float Support +//------------------------------------------------------- + +#ifdef UNITY_EXCLUDE_FLOAT + +//No Floating Point Support +#undef UNITY_FLOAT_PRECISION +#undef UNITY_FLOAT_TYPE +#undef UNITY_FLOAT_VERBOSE + +#else + +//Floating Point Support +#ifndef UNITY_FLOAT_PRECISION +#define UNITY_FLOAT_PRECISION (0.00001f) +#endif +#ifndef UNITY_FLOAT_TYPE +#define UNITY_FLOAT_TYPE float +#endif +typedef UNITY_FLOAT_TYPE _UF; + +#endif + +//------------------------------------------------------- +// Output Method +//------------------------------------------------------- + +#ifndef UNITY_OUTPUT_CHAR +//Default to using putchar, which is defined in stdio.h above +#define UNITY_OUTPUT_CHAR(a) putchar(a) +#else +//If defined as something else, make sure we declare it here so it's ready for use +extern int UNITY_OUTPUT_CHAR(int); +#endif + +//------------------------------------------------------- +// Footprint +//------------------------------------------------------- + +#ifndef UNITY_LINE_TYPE +#define UNITY_LINE_TYPE unsigned short +#endif + +#ifndef UNITY_COUNTER_TYPE +#define UNITY_COUNTER_TYPE unsigned short +#endif + +//------------------------------------------------------- +// Internal Structs Needed +//------------------------------------------------------- + +typedef void (*UnityTestFunction)(void); + +#define UNITY_DISPLAY_RANGE_INT (0x10) +#define UNITY_DISPLAY_RANGE_UINT (0x20) +#define UNITY_DISPLAY_RANGE_HEX (0x40) +#define UNITY_DISPLAY_RANGE_AUTO (0x80) + +typedef enum +{ + UNITY_DISPLAY_STYLE_INT = 4 + UNITY_DISPLAY_RANGE_INT + UNITY_DISPLAY_RANGE_AUTO, + UNITY_DISPLAY_STYLE_INT8 = 1 + UNITY_DISPLAY_RANGE_INT, + UNITY_DISPLAY_STYLE_INT16 = 2 + UNITY_DISPLAY_RANGE_INT, + UNITY_DISPLAY_STYLE_INT32 = 4 + UNITY_DISPLAY_RANGE_INT, +#ifdef UNITY_SUPPORT_64 + UNITY_DISPLAY_STYLE_INT64 = 8 + UNITY_DISPLAY_RANGE_INT, +#endif + UNITY_DISPLAY_STYLE_UINT = 4 + UNITY_DISPLAY_RANGE_UINT + UNITY_DISPLAY_RANGE_AUTO, + UNITY_DISPLAY_STYLE_UINT8 = 1 + UNITY_DISPLAY_RANGE_UINT, + UNITY_DISPLAY_STYLE_UINT16 = 2 + UNITY_DISPLAY_RANGE_UINT, + UNITY_DISPLAY_STYLE_UINT32 = 4 + UNITY_DISPLAY_RANGE_UINT, +#ifdef UNITY_SUPPORT_64 + UNITY_DISPLAY_STYLE_UINT64 = 8 + UNITY_DISPLAY_RANGE_UINT, +#endif + UNITY_DISPLAY_STYLE_HEX8 = 1 + UNITY_DISPLAY_RANGE_HEX, + UNITY_DISPLAY_STYLE_HEX16 = 2 + UNITY_DISPLAY_RANGE_HEX, + UNITY_DISPLAY_STYLE_HEX32 = 4 + UNITY_DISPLAY_RANGE_HEX, +#ifdef UNITY_SUPPORT_64 + UNITY_DISPLAY_STYLE_HEX64 = 8 + UNITY_DISPLAY_RANGE_HEX, +#endif +} UNITY_DISPLAY_STYLE_T; + +struct _Unity +{ + const char* TestFile; + const char* CurrentTestName; + _UU32 CurrentTestLineNumber; + UNITY_COUNTER_TYPE NumberOfTests; + UNITY_COUNTER_TYPE TestFailures; + UNITY_COUNTER_TYPE TestIgnores; + UNITY_COUNTER_TYPE CurrentTestFailed; + UNITY_COUNTER_TYPE CurrentTestIgnored; + jmp_buf AbortFrame; +}; + +extern struct _Unity Unity; + +//------------------------------------------------------- +// Test Suite Management +//------------------------------------------------------- + +void UnityBegin(void); +int UnityEnd(void); +void UnityConcludeTest(void); +void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum); + +//------------------------------------------------------- +// Test Output +//------------------------------------------------------- + +void UnityPrint(const char* string); +void UnityPrintMask(const _U_UINT mask, const _U_UINT number); +void UnityPrintNumberByStyle(const _U_SINT number, const UNITY_DISPLAY_STYLE_T style); +void UnityPrintNumber(const _U_SINT number); +void UnityPrintNumberUnsigned(const _U_UINT number); +void UnityPrintNumberHex(const _U_UINT number, const char nibbles); + +#ifdef UNITY_FLOAT_VERBOSE +void UnityPrintFloat(const _UF number); +#endif + +//------------------------------------------------------- +// Test Assertion Fuctions +//------------------------------------------------------- +// Use the macros below this section instead of calling +// these directly. The macros have a consistent naming +// convention and will pull in file and line information +// for you. + +void UnityAssertEqualNumber(const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style); + +void UnityAssertEqualIntArray(const _U_SINT* expected, + const _U_SINT* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style); + +void UnityAssertBits(const _U_SINT mask, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualString(const char* expected, + const char* actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualStringArray( const char** expected, + const char** actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualMemory( const void* expected, + const void* actual, + const _UU32 length, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertNumbersWithin(const _U_SINT delta, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style); + +void UnityFail(const char* message, const UNITY_LINE_TYPE line); + +void UnityIgnore(const char* message, const UNITY_LINE_TYPE line); + +#ifndef UNITY_EXCLUDE_FLOAT +void UnityAssertFloatsWithin(const _UF delta, + const _UF expected, + const _UF actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualFloatArray(const _UF* expected, + const _UF* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber); +#endif + +//------------------------------------------------------- +// Basic Fail and Ignore +//------------------------------------------------------- + +#define UNITY_TEST_FAIL(line, message) UnityFail( (message), (UNITY_LINE_TYPE)line); +#define UNITY_TEST_IGNORE(line, message) UnityIgnore( (message), (UNITY_LINE_TYPE)line); + +//------------------------------------------------------- +// Test Asserts +//------------------------------------------------------- + +#define UNITY_TEST_ASSERT(condition, line, message) if (condition) {} else {UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, message);} +#define UNITY_TEST_ASSERT_NULL(pointer, line, message) UNITY_TEST_ASSERT(((pointer) == NULL), (UNITY_LINE_TYPE)line, message) +#define UNITY_TEST_ASSERT_NOT_NULL(pointer, line, message) UNITY_TEST_ASSERT(((pointer) != NULL), (UNITY_LINE_TYPE)line, message) + +#define UNITY_TEST_ASSERT_EQUAL_INT(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_UINT(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_HEX8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX8) +#define UNITY_TEST_ASSERT_EQUAL_HEX16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX16) +#define UNITY_TEST_ASSERT_EQUAL_HEX32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX32) +#define UNITY_TEST_ASSERT_BITS(mask, expected, actual, line, message) UnityAssertBits((_U_SINT)(mask), (_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line) + +#define UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX8) +#define UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX16) +#define UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX32) +#define UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64) + +#define UNITY_TEST_ASSERT_EQUAL_PTR(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(_UP)(expected), (_U_SINT)(_UP)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_POINTER) +#define UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, line, message) UnityAssertEqualString((const char*)(expected), (const char*)(actual), (message), (UNITY_LINE_TYPE)line) +#define UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, line, message) UnityAssertEqualMemory((void*)(expected), (void*)(actual), (_UU32)(len), 1, (message), (UNITY_LINE_TYPE)line) + +#define UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT8) +#define UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT16) +#define UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT32) +#define UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT8) +#define UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT16) +#define UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT32) +#define UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX8) +#define UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX16) +#define UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX32) +#define UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualStringArray((const char**)(expected), (const char**)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line) +#define UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, line, message) UnityAssertEqualMemory((void*)(expected), (void*)(actual), (_UU32)(len), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line) + +#ifdef UNITY_SUPPORT_64 +#define UNITY_TEST_ASSERT_EQUAL_INT64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT64) +#define UNITY_TEST_ASSERT_EQUAL_UINT64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT64) +#define UNITY_TEST_ASSERT_EQUAL_HEX64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64) +#define UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT64) +#define UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT64) +#define UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64) +#endif + +#ifdef UNITY_EXCLUDE_FLOAT +#define UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled") +#define UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled") +#define UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled") +#else +#define UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, line, message) UnityAssertFloatsWithin((_UF)(delta), (_UF)(expected), (_UF)(actual), (message), (UNITY_LINE_TYPE)line) +#define UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, line, message) UNITY_TEST_ASSERT_FLOAT_WITHIN((_UF)(expected) * (_UF)UNITY_FLOAT_PRECISION, (_UF)expected, (_UF)actual, (UNITY_LINE_TYPE)line, message) +#define UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualFloatArray((_UF*)(expected), (_UF*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line) +#endif + +#endif diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/targets/gcc.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/targets/gcc.yml new file mode 100644 index 0000000..0f18c6c --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/targets/gcc.yml @@ -0,0 +1,42 @@ +compiler: + path: gcc + source_path: 'src/' + unit_tests_path: &unit_tests_path 'test/' + build_path: &build_path 'build/' + options: + - '-c' + - '-Wall' + - '-Wno-address' + - '-std=c99' + - '-pedantic' + includes: + prefix: '-I' + items: + - 'src/' + - '../src/' + - *unit_tests_path + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - UNITY_SUPPORT_TEST_CASES + object_files: + prefix: '-o' + extension: '.o' + destination: *build_path +linker: + path: gcc + options: + - -lm + includes: + prefix: '-I' + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.exe' + destination: *build_path +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/targets/gcc_64.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/targets/gcc_64.yml new file mode 100644 index 0000000..97cb958 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/targets/gcc_64.yml @@ -0,0 +1,43 @@ +compiler: + path: gcc + source_path: 'src/' + unit_tests_path: &unit_tests_path 'test/' + build_path: &build_path 'build/' + options: + - '-c' + - '-Wall' + - '-Wno-address' + - '-std=c99' + - '-pedantic' + includes: + prefix: '-I' + items: + - 'src/' + - '../src/' + - *unit_tests_path + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - UNITY_SUPPORT_TEST_CASES + - 'UNITY_POINTER_WIDTH=64' + object_files: + prefix: '-o' + extension: '.o' + destination: *build_path +linker: + path: gcc + options: + - -lm + includes: + prefix: '-I' + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.exe' + destination: *build_path +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/targets/hitech_picc18.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/targets/hitech_picc18.yml new file mode 100644 index 0000000..210d944 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/targets/hitech_picc18.yml @@ -0,0 +1,101 @@ +# rumor has it that this yaml file works for the standard edition of the +# hitech PICC18 compiler, but not the pro version. +# +compiler: + path: cd build && picc18 + source_path: 'c:\Projects\NexGen\Prototypes\CMockTest\src\' + unit_tests_path: &unit_tests_path 'c:\Projects\NexGen\Prototypes\CMockTest\test\' + build_path: &build_path 'c:\Projects\NexGen\Prototypes\CMockTest\build\' + options: + - --chip=18F87J10 + - --ide=hitide + - --q #quiet please + - --asmlist + - --codeoffset=0 + - --emi=wordwrite # External memory interface protocol + - --warn=0 # allow all normal warning messages + - --errors=10 # Number of errors before aborting compile + - --char=unsigned + - -Bl # Large memory model + - -G # generate symbol file + - --cp=16 # 16-bit pointers + - --double=24 + - -N255 # 255-char symbol names + - --opt=none # Do not use any compiler optimziations + - -c # compile only + - -M + includes: + prefix: '-I' + items: + - 'c:/Projects/NexGen/Prototypes/CMockTest/src/' + - 'c:/Projects/NexGen/Prototypes/CMockTest/mocks/' + - 'c:/CMock/src/' + - 'c:/CMock/examples/src/' + - 'c:/CMock/vendor/unity/src/' + - 'c:/CMock/vendor/unity/examples/helper/' + - *unit_tests_path + defines: + prefix: '-D' + items: + - UNITY_INT_WIDTH=16 + - UNITY_POINTER_WIDTH=16 + - CMOCK_MEM_STATIC + - CMOCK_MEM_SIZE=3000 + - UNITY_SUPPORT_TEST_CASES + - _PICC18 + object_files: + # prefix: '-O' # Hi-Tech doesn't want a prefix. They key off of filename .extensions, instead + extension: '.obj' + destination: *build_path + +linker: + path: cd build && picc18 + options: + - --chip=18F87J10 + - --ide=hitide + - --cp=24 # 24-bit pointers. Is this needed for linker?? + - --double=24 # Is this needed for linker?? + - -Lw # Scan the pic87*w.lib in the lib/ of the compiler installation directory + - --summary=mem,file # info listing + - --summary=+psect + - --summary=+hex + - --output=+intel + - --output=+mcof + - --runtime=+init # Directs startup code to copy idata, ibigdata and ifardata psects from ROM to RAM. + - --runtime=+clear # Directs startup code to clear bss, bigbss, rbss and farbss psects + - --runtime=+clib # link in the c-runtime + - --runtime=+keep # Keep the generated startup src after its obj is linked + - -G # Generate src-level symbol file + - -MIWasTheLastToBuild.map + - --warn=0 # allow all normal warning messages + - -Bl # Large memory model (probably not needed for linking) + includes: + prefix: '-I' + object_files: + path: *build_path + extension: '.obj' + bin_files: + prefix: '-O' + extension: '.hex' + destination: *build_path + +simulator: + path: + pre_support: + - 'java -client -jar ' # note space + - ['C:\Program Files\HI-TECH Software\HI-TIDE\3.15\lib\', 'simpic18.jar'] + - 18F87J10 + post_support: + +:cmock: + :plugins: [] + :includes: + - Types.h + :suite_teardown: | + if (num_failures) + _FAILED_TEST(); + else + _PASSED_TESTS(); + return 0; + +colour: true \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_arm_v4.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_arm_v4.yml new file mode 100644 index 0000000..c2e7f18 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_arm_v4.yml @@ -0,0 +1,89 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 4.0 Kickstart\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\lib\dl4tptinl8n.h'] + - -z3 + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian little + - --cpu ARM7TDMI + - --stack_align 4 + - --interwork + - -e + - --silent + - --warnings_are_errors + - --fpu None + - --diag_suppress Pa050 + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'common\bin\xlink.exe'] + options: + - -rt + - [*tools_root, 'arm\lib\dl4tptinl8n.r79'] + - -D_L_EXTMEM_START=0 + - -D_L_EXTMEM_SIZE=0 + - -D_L_HEAP_SIZE=120 + - -D_L_STACK_SIZE=32 + - -e_small_write=_formatted_write + - -s + - __program_start + - -f + - [*tools_root, '\arm\config\lnkarm.xcl'] + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\config\'] + - [*tools_root, 'arm\lib\'] + object_files: + path: *build_path + extension: '.r79' + bin_files: + prefix: '-o' + extension: '.d79' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\ioat91sam7X256.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_arm_v5.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_arm_v5.yml new file mode 100644 index 0000000..0549d8e --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_arm_v5.yml @@ -0,0 +1,79 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian=little + - --cpu=ARM7TDMI + - --interwork + - --warnings_are_errors + - --fpu=None + - --diag_suppress=Pa050 + - --diag_suppress=Pe111 + - -e + - -On + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\debugger\atmel\ioat91sam7X256.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_arm_v5_3.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_arm_v5_3.yml new file mode 100644 index 0000000..0549d8e --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_arm_v5_3.yml @@ -0,0 +1,79 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian=little + - --cpu=ARM7TDMI + - --interwork + - --warnings_are_errors + - --fpu=None + - --diag_suppress=Pa050 + - --diag_suppress=Pe111 + - -e + - -On + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\debugger\atmel\ioat91sam7X256.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml new file mode 100644 index 0000000..eb0785c --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml @@ -0,0 +1,93 @@ +#Default tool path for IAR 5.4 on Windows XP 64bit +tools_root: &tools_root 'C:\Program Files (x86)\IAR Systems\Embedded Workbench 5.4 Kickstart\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --diag_suppress=Pa050 + #- --diag_suppress=Pe111 + - --debug + - --endian=little + - --cpu=Cortex-M3 + - --no_path_in_file_macros + - -e + - --fpu=None + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + #- --preinclude --preinclude C:\Vss\T2 Working\common\system.h + - --interwork + - --warnings_are_errors +# - Ohz + - -Oh +# - --no_cse +# - --no_unroll +# - --no_inline +# - --no_code_motion +# - --no_tbaa +# - --no_clustering +# - --no_scheduling + + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - ewarm + - PART_LM3S9B92 + - TARGET_IS_TEMPEST_RB1 + - USE_ROM_DRIVERS + - UART_BUFFERED + - UNITY_SUPPORT_64 + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic.icf'] +# - ['C:\Temp\lm3s9b92.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + #- --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim2.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - --endian=little + - --cpu=Cortex-M3 + - --fpu=None + - -p + - [*tools_root, 'arm\config\debugger\TexasInstruments\iolm3sxxxx.ddf'] + - --semihosting + - --device=LM3SxBxx + #- -d + #- sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_cortexm3_v5.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_cortexm3_v5.yml new file mode 100644 index 0000000..cf0d1d0 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_cortexm3_v5.yml @@ -0,0 +1,83 @@ +# unit testing under iar compiler / simulator for STM32 Cortex-M3 + +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.4\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian=little + - --cpu=Cortex-M3 + - --interwork + - --warnings_are_errors + - --fpu=None + - --diag_suppress=Pa050 + - --diag_suppress=Pe111 + - -e + - -On + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - 'IAR' + - 'UNITY_SUPPORT_64' + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic_cortex.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\debugger\ST\iostm32f107xx.ddf'] + - --cpu=Cortex-M3 + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_msp430.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_msp430.yml new file mode 100644 index 0000000..e022647 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_msp430.yml @@ -0,0 +1,94 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3 MSP430\' +core_root: &core_root [*tools_root, '430\'] +core_bin: &core_bin [*core_root, 'bin\'] +core_config: &core_config [*core_root, 'config\'] +core_lib: &core_lib [*core_root, 'lib\'] +core_inc: &core_inc [*core_root, 'inc\'] +core_config: &core_config [*core_root, 'config\'] + +compiler: + path: [*core_bin, 'icc430.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*core_lib, 'dlib\dl430fn.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --debug + - -e + - -Ol + - --multiplier=16 + - --double=32 + - --diag_suppress Pa050 + - --diag_suppress Pe111 + includes: + prefix: '-I' + items: + - *core_inc + - [*core_inc, 'dlib'] + - [*core_lib, 'dlib'] + - 'src\' + - '../src/' + - *unit_tests_path + - 'vendor\unity\src' + defines: + prefix: '-D' + items: + - '__MSP430F149__' + - 'INT_WIDTH=16' + - 'UNITY_EXCLUDE_FLOAT' + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r43' + destination: *build_path +linker: + path: [*core_bin, 'xlink.exe'] + options: + - -rt + - [*core_lib, 'dlib\dl430fn.r43'] + - -e_PrintfTiny=_Printf + - -e_ScanfSmall=_Scanf + - -s __program_start + - -D_STACK_SIZE=50 + - -D_DATA16_HEAP_SIZE=50 + - -D_DATA20_HEAP_SIZE=50 + - -f + - [*core_config, 'lnk430f5438.xcl'] + - -f + - [*core_config, 'multiplier.xcl'] + includes: + prefix: '-I' + items: + - *core_config + - *core_lib + - [*core_lib, 'dlib'] + object_files: + path: *build_path + extension: '.r79' + bin_files: + prefix: '-o' + extension: '.d79' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*core_bin, '430proc.dll'] + - [*core_bin, '430sim.dll'] + post_support: + - --plugin + - [*core_bin, '430bat.dll'] + - --backend -B + - --cpu MSP430F5438 + - -p + - [*core_config, 'MSP430F5438.ddf'] + - -d sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_sh2a_v6.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_sh2a_v6.yml new file mode 100644 index 0000000..ddc5603 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_sh2a_v6.yml @@ -0,0 +1,85 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 6.0\' +compiler: + path: [*tools_root, 'sh\bin\iccsh.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - -e + - --char_is_signed + - -Ol + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_scheduling + - --no_clustering + - --debug + - --dlib_config + - [*tools_root, 'sh\inc\DLib_Product.h'] + - --double=32 + - --code_model=huge + - --data_model=huge + - --core=sh2afpu + - --warnings_affect_exit_code + - --warnings_are_errors + - --mfc + - --use_unix_directory_separators + - --diag_suppress=Pe161 + includes: + prefix: '-I' + items: + - [*tools_root, 'sh\inc\'] + - [*tools_root, 'sh\inc\c'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.o' + destination: *build_path +linker: + path: [*tools_root, 'sh\bin\ilinksh.exe'] + options: + - --redirect __Printf=__PrintfSmall + - --redirect __Scanf=__ScanfSmall + - --config + - [*tools_root, 'sh\config\generic.icf'] + - --config_def _CSTACK_SIZE=0x800 + - --config_def _HEAP_SIZE=0x800 + - --config_def _INT_TABLE=0x10 + - --entry __iar_program_start + - --debug_lib + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'sh\bin\shproc.dll'] + - [*tools_root, 'sh\bin\shsim.dll'] + post_support: + - --plugin + - [*tools_root, 'sh\bin\shbat.dll'] + - --backend + - -B + - --core sh2afpu + - -p + - [*tools_root, 'sh\config\debugger\io7264.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_cmd.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_cmd.c new file mode 100644 index 0000000..42841d8 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_cmd.c @@ -0,0 +1,54 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include +#include "CException.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_def.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_def.c new file mode 100644 index 0000000..8280804 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_def.c @@ -0,0 +1,50 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_cmd.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_cmd.c new file mode 100644 index 0000000..e47b31c --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_cmd.c @@ -0,0 +1,76 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_def.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_def.c new file mode 100644 index 0000000..3ca9dba --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_def.c @@ -0,0 +1,72 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new1.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new1.c new file mode 100644 index 0000000..a7cbcd8 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new1.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + GlobalExpectCount = 0; + GlobalVerifyOrder = 0; + GlobalOrderError = NULL; + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new2.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new2.c new file mode 100644 index 0000000..2c76bf2 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new2.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_param.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_param.c new file mode 100644 index 0000000..23c04f4 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_param.c @@ -0,0 +1,73 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST_NO_ARGS +#define RUN_TEST(TestFunc, TestLineNum, ...) \ +{ \ + Unity.CurrentTestName = #TestFunc "(" #__VA_ARGS__ ")"; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(__VA_ARGS__); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21, RUN_TEST_NO_ARGS); + RUN_TEST(test_TheSecondThingToTest, 43, RUN_TEST_NO_ARGS); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run1.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run1.c new file mode 100644 index 0000000..a7cbcd8 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run1.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + GlobalExpectCount = 0; + GlobalVerifyOrder = 0; + GlobalOrderError = NULL; + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run2.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run2.c new file mode 100644 index 0000000..2c76bf2 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run2.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_yaml.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_yaml.c new file mode 100644 index 0000000..68b545a --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_yaml.c @@ -0,0 +1,86 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include "two.h" +#include "three.h" +#include +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_yaml_setup(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_new1.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_new1.c new file mode 100644 index 0000000..e5bcac2 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_new1.c @@ -0,0 +1,60 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_new2.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_new2.c new file mode 100644 index 0000000..b7c7e5b --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_new2.c @@ -0,0 +1,63 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_param.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_param.c new file mode 100644 index 0000000..4157007 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_param.c @@ -0,0 +1,51 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST_NO_ARGS +#define RUN_TEST(TestFunc, TestLineNum, ...) \ +{ \ + Unity.CurrentTestName = #TestFunc "(" #__VA_ARGS__ ")"; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(__VA_ARGS__); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21, RUN_TEST_NO_ARGS); + RUN_TEST(test_TheSecondThingToTest, 43, RUN_TEST_NO_ARGS); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_run1.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_run1.c new file mode 100644 index 0000000..e5bcac2 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_run1.c @@ -0,0 +1,60 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_run2.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_run2.c new file mode 100644 index 0000000..b7c7e5b --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_run2.c @@ -0,0 +1,63 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_yaml.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_yaml.c new file mode 100644 index 0000000..d109287 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_yaml.c @@ -0,0 +1,64 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "two.h" +#include "three.h" +#include +#include +#include +#include "CException.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_yaml_setup(); +} + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/test_generate_test_runner.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/test_generate_test_runner.rb new file mode 100644 index 0000000..61c8df9 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/test_generate_test_runner.rb @@ -0,0 +1,94 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +ruby_version = RUBY_VERSION.split('.') +if (ruby_version[1].to_i == 9) and (ruby_version[2].to_i > 1) + require 'rubygems' + gem 'test-unit' +end +require 'test/unit' +require './auto/generate_test_runner.rb' + +TEST_FILE = 'test/testdata/testsample.c' +TEST_MOCK = 'test/testdata/mocksample.c' +OUT_FILE = 'build/testsample_' +EXP_FILE = 'test/expectdata/testsample_' + +class TestGenerateTestRunner < Test::Unit::TestCase + def setup + end + + def teardown + end + + def verify_output_equal(subtest) + expected = File.read(EXP_FILE + subtest + '.c').gsub(/\r\n/,"\n") + actual = File.read(OUT_FILE + subtest + '.c').gsub(/\r\n/,"\n") + assert_equal(expected, actual, "Generated File Sub-Test '#{subtest}' Failed") + end + + def test_ShouldGenerateARunnerByCreatingRunnerWithOptions + sets = { 'def' => nil, + 'new1' => { :plugins => [:cexception], :includes => ['one.h', 'two.h'], :enforce_strict_ordering => true }, + 'new2' => { :plugins => [:ignore], :suite_setup => "a_custom_setup();", :suite_teardown => "a_custom_teardown();" } + } + + sets.each_pair do |subtest, options| + UnityTestRunnerGenerator.new(options).run(TEST_FILE, OUT_FILE + subtest + '.c') + verify_output_equal(subtest) + UnityTestRunnerGenerator.new(options).run(TEST_MOCK, OUT_FILE + 'mock_' + subtest + '.c') + verify_output_equal('mock_' + subtest) + end + end + + def test_ShouldGenerateARunnerByRunningRunnerWithOptions + sets = { 'run1' => { :plugins => [:cexception], :includes => ['one.h', 'two.h'], :enforce_strict_ordering => true }, + 'run2' => { :plugins => [:ignore], :suite_setup => "a_custom_setup();", :suite_teardown => "a_custom_teardown();" } + } + + sets.each_pair do |subtest, options| + UnityTestRunnerGenerator.new.run(TEST_FILE, OUT_FILE + subtest + '.c', options) + verify_output_equal(subtest) + UnityTestRunnerGenerator.new.run(TEST_MOCK, OUT_FILE + 'mock_' + subtest + '.c', options) + verify_output_equal('mock_' + subtest) + end + end + + def test_ShouldGenerateARunnerByPullingYamlOptions + subtest = 'yaml' + cmdstr = "ruby auto/generate_test_runner.rb test/testdata/sample.yml \"#{TEST_FILE}\" \"#{OUT_FILE + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal(subtest) + + cmdstr = "ruby auto/generate_test_runner.rb test/testdata/sample.yml \"#{TEST_MOCK}\" \"#{OUT_FILE + 'mock_' + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal('mock_' + subtest) + end + + def test_ShouldGenerateARunnerByPullingCommandlineOptions + subtest = 'cmd' + cmdstr = "ruby auto/generate_test_runner.rb -cexception \"#{TEST_FILE}\" \"#{OUT_FILE + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal(subtest) + + cmdstr = "ruby auto/generate_test_runner.rb -cexception \"#{TEST_MOCK}\" \"#{OUT_FILE + 'mock_' + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal('mock_' + subtest) + end + + def test_ShouldGenerateARunnerThatUsesParameterizedTests + sets = { 'param' => { :plugins => [:ignore], :use_param_tests => true } + } + + sets.each_pair do |subtest, options| + UnityTestRunnerGenerator.new(options).run(TEST_FILE, OUT_FILE + subtest + '.c') + verify_output_equal(subtest) + UnityTestRunnerGenerator.new(options).run(TEST_MOCK, OUT_FILE + 'mock_' + subtest + '.c') + verify_output_equal('mock_' + subtest) + end + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/testdata/mocksample.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/testdata/mocksample.c new file mode 100644 index 0000000..b709438 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/testdata/mocksample.c @@ -0,0 +1,51 @@ +// This is just a sample test file to be used to test the generator script +#ifndef TEST_SAMPLE_H +#define TEST_SAMPLE_H + +#include +#include "unity.h" +#include "funky.h" +#include "Mockstanky.h" + +void setUp(void) +{ + CustomSetupStuff(); +} + +void tearDown(void) +{ + CustomTeardownStuff +} + +//Yup, nice comment +void test_TheFirstThingToTest(void) +{ + TEST_ASSERT(1); + + TEST_ASSERT_TRUE(1); +} + +/* +void test_ShouldBeIgnored(void) +{ + DoesStuff(); +} +*/ + +//void test_ShouldAlsoNotBeTested(void) +//{ +// Call_An_Expect(); +// +// CallAFunction(); +// test_CallAFunctionThatLooksLikeATest(); +//} + +void test_TheSecondThingToTest(void) +{ + Call_An_Expect(); + + CallAFunction(); + test_CallAFunctionThatLooksLikeATest(); +} + +#endif //TEST_SAMPLE_H diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/testdata/sample.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/testdata/sample.yml new file mode 100644 index 0000000..9e5eece --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/testdata/sample.yml @@ -0,0 +1,9 @@ +:unity: + :includes: + - two.h + - three.h + - + :plugins: + - :cexception + :suite_setup: | + a_yaml_setup(); \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/testdata/testsample.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/testdata/testsample.c new file mode 100644 index 0000000..4f30ec7 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/testdata/testsample.c @@ -0,0 +1,51 @@ +// This is just a sample test file to be used to test the generator script +#ifndef TEST_SAMPLE_H +#define TEST_SAMPLE_H + +#include +#include "unity.h" +#include "funky.h" +#include "stanky.h" + +void setUp(void) +{ + CustomSetupStuff(); +} + +void tearDown(void) +{ + CustomTeardownStuff +} + +//Yup, nice comment +void test_TheFirstThingToTest(void) +{ + TEST_ASSERT(1); + + TEST_ASSERT_TRUE(1); +} + +/* +void test_ShouldBeIgnored(void) +{ + DoesStuff(); +} +*/ + +//void test_ShouldAlsoNotBeTested(void) +//{ +// Call_An_Expect(); +// +// CallAFunction(); +// test_CallAFunctionThatLooksLikeATest(); +//} + +void test_TheSecondThingToTest(void) +{ + Call_An_Expect(); + + CallAFunction(); + test_CallAFunctionThatLooksLikeATest(); +} + +#endif //TEST_SAMPLE_H diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/testparameterized.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/testparameterized.c new file mode 100644 index 0000000..037cd21 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/testparameterized.c @@ -0,0 +1,101 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include +#include "unity.h" + +#define TEST_CASE(...) + +#define EXPECT_ABORT_BEGIN \ + if (TEST_PROTECT()) \ + { + +#define VERIFY_FAILS_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestFailed == 1) ? 0 : 1; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Failed But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +#define VERIFY_IGNORES_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestIgnored == 1) ? 0 : 1; \ + Unity.CurrentTestIgnored = 0; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Ignored But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +int SetToOneToFailInTearDown; +int SetToOneMeanWeAlreadyCheckedThisGuy; + +void setUp(void) +{ + SetToOneToFailInTearDown = 0; + SetToOneMeanWeAlreadyCheckedThisGuy = 0; +} + +void tearDown(void) +{ + if (SetToOneToFailInTearDown == 1) + TEST_FAIL_MESSAGE("<= Failed in tearDown"); + if ((SetToOneMeanWeAlreadyCheckedThisGuy == 0) && (Unity.CurrentTestFailed > 0)) + { + UnityPrint("[[[[ Previous Test Should Have Passed But Did Not ]]]]"); + UNITY_OUTPUT_CHAR('\n'); + } +} + +TEST_CASE(0) +TEST_CASE(44) +TEST_CASE((90)+9) +void test_TheseShouldAllPass(int Num) +{ + TEST_ASSERT_TRUE(Num < 100); +} + +TEST_CASE(3) +TEST_CASE(77) +TEST_CASE( (99) + 1 - (1)) +void test_TheseShouldAllFail(int Num) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(Num > 100); + VERIFY_FAILS_END +} + +TEST_CASE(1) +TEST_CASE(44) +TEST_CASE(99) +TEST_CASE(98) +void test_TheseAreEveryOther(int Num) +{ + if (Num & 1) + { + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(Num > 100); + VERIFY_FAILS_END + } + else + { + TEST_ASSERT_TRUE(Num < 100); + } +} + +void test_NormalPassesStillWork(void) +{ + TEST_ASSERT_TRUE(1); +} + +void test_NormalFailsStillWork(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(0); + VERIFY_FAILS_END +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/testunity.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/testunity.c new file mode 100644 index 0000000..9f826dc --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/cmock/vendor/unity/test/testunity.c @@ -0,0 +1,1510 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include +#include "unity.h" + +#define EXPECT_ABORT_BEGIN \ + if (TEST_PROTECT()) \ + { + +#define VERIFY_FAILS_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestFailed == 1) ? 0 : 1; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Failed But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +#define VERIFY_IGNORES_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestIgnored == 1) ? 0 : 1; \ + Unity.CurrentTestIgnored = 0; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Ignored But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +int SetToOneToFailInTearDown; +int SetToOneMeanWeAlreadyCheckedThisGuy; + +void setUp(void) +{ + SetToOneToFailInTearDown = 0; + SetToOneMeanWeAlreadyCheckedThisGuy = 0; +} + +void tearDown(void) +{ + if (SetToOneToFailInTearDown == 1) + TEST_FAIL_MESSAGE("<= Failed in tearDown"); + if ((SetToOneMeanWeAlreadyCheckedThisGuy == 0) && (Unity.CurrentTestFailed > 0)) + { + UnityPrint("[[[[ Previous Test Should Have Passed But Did Not ]]]]"); + UNITY_OUTPUT_CHAR('\n'); + } +} + +void testTrue(void) +{ + TEST_ASSERT(1); + + TEST_ASSERT_TRUE(1); +} + +void testFalse(void) +{ + TEST_ASSERT_FALSE(0); + + TEST_ASSERT_UNLESS(0); +} + +void testPreviousPass(void) +{ + TEST_ASSERT_EQUAL_INT(0U, Unity.TestFailures); +} + +void testNotVanilla(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT(0); + VERIFY_FAILS_END +} + +void testNotTrue(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(0); + VERIFY_FAILS_END +} + +void testNotFalse(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_FALSE(1); + VERIFY_FAILS_END +} + +void testNotUnless(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UNLESS(1); + VERIFY_FAILS_END +} + +void testNotNotEqual(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_NOT_EQUAL(10, 10); + VERIFY_FAILS_END +} + +void testFail(void) +{ + EXPECT_ABORT_BEGIN + TEST_FAIL_MESSAGE("Expected for testing"); + VERIFY_FAILS_END +} + +void testIsNull(void) +{ + char* ptr1 = NULL; + char* ptr2 = "hello"; + + TEST_ASSERT_NULL(ptr1); + TEST_ASSERT_NOT_NULL(ptr2); +} + +void testIsNullShouldFailIfNot(void) +{ + char* ptr1 = "hello"; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_NULL(ptr1); + VERIFY_FAILS_END +} + +void testNotNullShouldFailIfNULL(void) +{ + char* ptr1 = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_NOT_NULL(ptr1); + VERIFY_FAILS_END +} + +void testIgnore(void) +{ + EXPECT_ABORT_BEGIN + TEST_IGNORE(); + TEST_FAIL_MESSAGE("This should not be reached"); + VERIFY_IGNORES_END +} + +void testIgnoreMessage(void) +{ + EXPECT_ABORT_BEGIN + TEST_IGNORE_MESSAGE("This is an expected TEST_IGNORE_MESSAGE string!"); + TEST_FAIL_MESSAGE("This should not be reached"); + VERIFY_IGNORES_END +} + +void testNotEqualInts(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT(3982, 3983); + VERIFY_FAILS_END +} + +void testNotEqualInt8s(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT8(-127, -126); + VERIFY_FAILS_END +} + +void testNotEqualInt16s(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT16(-16383, -16382); + VERIFY_FAILS_END +} + +void testNotEqualInt32s(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT32(-2147483647, -2147483646); + VERIFY_FAILS_END +} + +void testNotEqualBits(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_BITS(0xFF00, 0x5555, 0x5A55); + VERIFY_FAILS_END +} + +void testNotEqualUInts(void) +{ + _UU16 v0, v1; + + v0 = 9000; + v1 = 9001; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualUInt8s(void) +{ + _UU8 v0, v1; + + v0 = 254; + v1 = 255; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT8(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualUInt16s(void) +{ + _UU16 v0, v1; + + v0 = 65535; + v1 = 65534; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualUInt32s(void) +{ + _UU32 v0, v1; + + v0 = 4294967295; + v1 = 4294967294; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT32(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex8s(void) +{ + _UU8 v0, v1; + + v0 = 0x23; + v1 = 0x22; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex8sIfSigned(void) +{ + _US8 v0, v1; + + v0 = -2; + v1 = 2; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex16s(void) +{ + _UU16 v0, v1; + + v0 = 0x1234; + v1 = 0x1235; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex16sIfSigned(void) +{ + _US16 v0, v1; + + v0 = -1024; + v1 = -1028; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex32s(void) +{ + _UU32 v0, v1; + + v0 = 900000; + v1 = 900001; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex32sIfSigned(void) +{ + _US32 v0, v1; + + v0 = -900000; + v1 = 900001; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32(v0, v1); + VERIFY_FAILS_END +} + +void testEqualInts(void) +{ + int v0, v1; + int *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(1837, 1837); + TEST_ASSERT_EQUAL_INT(-27365, -27365); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(19467, v1); + TEST_ASSERT_EQUAL_INT(v0, 19467); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 19467); +} + +void testEqualUints(void) +{ + unsigned int v0, v1; + unsigned int *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_UINT(1837, 1837); + TEST_ASSERT_EQUAL_UINT(v0, v1); + TEST_ASSERT_EQUAL_UINT(19467, v1); + TEST_ASSERT_EQUAL_UINT(v0, 19467); + TEST_ASSERT_EQUAL_UINT(*p0, v1); + TEST_ASSERT_EQUAL_UINT(*p0, *p1); + TEST_ASSERT_EQUAL_UINT(*p0, 19467); + TEST_ASSERT_EQUAL_UINT(60872u, 60872u); +} + +void testNotEqual(void) +{ + TEST_ASSERT_NOT_EQUAL(0, 1); + TEST_ASSERT_NOT_EQUAL(1, 0); + TEST_ASSERT_NOT_EQUAL(100, 101); + TEST_ASSERT_NOT_EQUAL(0, -1); + TEST_ASSERT_NOT_EQUAL(65535, -65535); + TEST_ASSERT_NOT_EQUAL(75, 900); + TEST_ASSERT_NOT_EQUAL(-100, -101); +} + +void testEqualHex8s(void) +{ + _UU8 v0, v1; + _UU8 *p0, *p1; + + v0 = 0x22; + v1 = 0x22; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX8(0x22, 0x22); + TEST_ASSERT_EQUAL_HEX8(v0, v1); + TEST_ASSERT_EQUAL_HEX8(0x22, v1); + TEST_ASSERT_EQUAL_HEX8(v0, 0x22); + TEST_ASSERT_EQUAL_HEX8(*p0, v1); + TEST_ASSERT_EQUAL_HEX8(*p0, *p1); + TEST_ASSERT_EQUAL_HEX8(*p0, 0x22); +} + +void testEqualHex8sNegatives(void) +{ + _UU8 v0, v1; + _UU8 *p0, *p1; + + v0 = 0xDD; + v1 = 0xDD; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX8(0xDD, 0xDD); + TEST_ASSERT_EQUAL_HEX8(v0, v1); + TEST_ASSERT_EQUAL_HEX8(0xDD, v1); + TEST_ASSERT_EQUAL_HEX8(v0, 0xDD); + TEST_ASSERT_EQUAL_HEX8(*p0, v1); + TEST_ASSERT_EQUAL_HEX8(*p0, *p1); + TEST_ASSERT_EQUAL_HEX8(*p0, 0xDD); +} + +void testEqualHex16s(void) +{ + _UU16 v0, v1; + _UU16 *p0, *p1; + + v0 = 0x9876; + v1 = 0x9876; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX16(0x9876, 0x9876); + TEST_ASSERT_EQUAL_HEX16(v0, v1); + TEST_ASSERT_EQUAL_HEX16(0x9876, v1); + TEST_ASSERT_EQUAL_HEX16(v0, 0x9876); + TEST_ASSERT_EQUAL_HEX16(*p0, v1); + TEST_ASSERT_EQUAL_HEX16(*p0, *p1); + TEST_ASSERT_EQUAL_HEX16(*p0, 0x9876); +} + +void testEqualHex32s(void) +{ + _UU32 v0, v1; + _UU32 *p0, *p1; + + v0 = 0x98765432ul; + v1 = 0x98765432ul; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX32(0x98765432ul, 0x98765432ul); + TEST_ASSERT_EQUAL_HEX32(v0, v1); + TEST_ASSERT_EQUAL_HEX32(0x98765432ul, v1); + TEST_ASSERT_EQUAL_HEX32(v0, 0x98765432ul); + TEST_ASSERT_EQUAL_HEX32(*p0, v1); + TEST_ASSERT_EQUAL_HEX32(*p0, *p1); + TEST_ASSERT_EQUAL_HEX32(*p0, 0x98765432ul); +} + +void testEqualBits(void) +{ + _UU32 v0 = 0xFF55AA00; + _UU32 v1 = 0x55550000; + + TEST_ASSERT_BITS(v1, v0, 0x55550000); + TEST_ASSERT_BITS(v1, v0, 0xFF55CC00); + TEST_ASSERT_BITS(0xFFFFFFFF, v0, 0xFF55AA00); + TEST_ASSERT_BITS(0xFFFFFFFF, v0, v0); + TEST_ASSERT_BITS(0xF0F0F0F0, v0, 0xFC5DAE0F); + TEST_ASSERT_BITS_HIGH(v1, v0); + TEST_ASSERT_BITS_LOW(0x000055FF, v0); + TEST_ASSERT_BIT_HIGH(30, v0); + TEST_ASSERT_BIT_LOW(5, v0); +} + +void testEqualShorts(void) +{ + short v0, v1; + short *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(1837, 1837); + TEST_ASSERT_EQUAL_INT(-2987, -2987); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(19467, v1); + TEST_ASSERT_EQUAL_INT(v0, 19467); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 19467); +} + +void testEqualUShorts(void) +{ + unsigned short v0, v1; + unsigned short *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_UINT(1837, 1837); + TEST_ASSERT_EQUAL_UINT(2987, 2987); + TEST_ASSERT_EQUAL_UINT(v0, v1); + TEST_ASSERT_EQUAL_UINT(19467, v1); + TEST_ASSERT_EQUAL_UINT(v0, 19467); + TEST_ASSERT_EQUAL_UINT(*p0, v1); + TEST_ASSERT_EQUAL_UINT(*p0, *p1); + TEST_ASSERT_EQUAL_UINT(*p0, 19467); +} + +void testEqualChars(void) +{ + signed char v0, v1; + signed char *p0, *p1; + + v0 = 109; + v1 = 109; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(42, 42); + TEST_ASSERT_EQUAL_INT(-116, -116); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(109, v1); + TEST_ASSERT_EQUAL_INT(v0, 109); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 109); +} + +void testEqualUChars(void) +{ + unsigned char v0, v1; + unsigned char *p0, *p1; + + v0 = 251; + v1 = 251; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(42, 42); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(251, v1); + TEST_ASSERT_EQUAL_INT(v0, 251); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 251); +} + +void testEqualPointers(void) +{ + int v0, v1; + int *p0, *p1, *p2; + + v0 = 19467; + v1 = 18271; + p0 = &v0; + p1 = &v1; + p2 = &v1; + + TEST_ASSERT_EQUAL_PTR(p0, &v0); + TEST_ASSERT_EQUAL_PTR(&v1, p1); + TEST_ASSERT_EQUAL_PTR(p2, p1); + TEST_ASSERT_EQUAL_PTR(&v0, &v0); +} + +void testNotEqualPointers(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_PTR(0x12345678, 0x12345677); + VERIFY_FAILS_END +} + +void testIntsWithinDelta(void) +{ + TEST_ASSERT_INT_WITHIN(1, 5000, 5001); + TEST_ASSERT_INT_WITHIN(5, 5000, 4996); + TEST_ASSERT_INT_WITHIN(5, 5000, 5005); + TEST_ASSERT_INT_WITHIN(500, 50, -440); + + TEST_ASSERT_INT_WITHIN(2, -1, -1); + TEST_ASSERT_INT_WITHIN(5, 1, -1); + TEST_ASSERT_INT_WITHIN(5, -1, 1); +} + +void testIntsNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_INT_WITHIN(5, 5000, 5006); + VERIFY_FAILS_END +} + +void testUIntsWithinDelta(void) +{ + TEST_ASSERT_UINT_WITHIN(1, 5000, 5001); + TEST_ASSERT_UINT_WITHIN(5, 5000, 4996); + TEST_ASSERT_UINT_WITHIN(5, 5000, 5005); +} + +void testUIntsNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UINT_WITHIN(1, 2147483647u, 2147483649u); + VERIFY_FAILS_END +} + +void testUIntsNotWithinDeltaEvenThoughASignedIntWouldPassSmallFirst(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UINT_WITHIN(5, 1, -1); + VERIFY_FAILS_END +} + +void testUIntsNotWithinDeltaEvenThoughASignedIntWouldPassBigFirst(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UINT_WITHIN(5, -1, 1); + VERIFY_FAILS_END +} + +void testHEX32sWithinDelta(void) +{ + TEST_ASSERT_HEX32_WITHIN(1, 5000, 5001); + TEST_ASSERT_HEX32_WITHIN(5, 5000, 4996); + TEST_ASSERT_HEX32_WITHIN(5, 5000, 5005); +} + +void testHEX32sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX32_WITHIN(1, 2147483647u, 2147483649u); + VERIFY_FAILS_END +} + +void testHEX32sNotWithinDeltaEvenThoughASignedIntWouldPass(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX32_WITHIN(5, 1, -1); + VERIFY_FAILS_END +} + +void testHEX16sWithinDelta(void) +{ + TEST_ASSERT_HEX16_WITHIN(1, 5000, 5001); + TEST_ASSERT_HEX16_WITHIN(5, 5000, 4996); + TEST_ASSERT_HEX16_WITHIN(5, 5000, 5005); +} + +void testHEX16sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX16_WITHIN(2, 65535, 0); + VERIFY_FAILS_END +} + +void testHEX8sWithinDelta(void) +{ + TEST_ASSERT_HEX8_WITHIN(1, 254, 255); + TEST_ASSERT_HEX8_WITHIN(5, 251, 255); + TEST_ASSERT_HEX8_WITHIN(5, 1, 4); +} + +void testHEX8sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX8_WITHIN(2, 255, 0); + VERIFY_FAILS_END +} + +void testEqualStrings(void) +{ + const char *testString = "foo"; + + TEST_ASSERT_EQUAL_STRING(testString, testString); + TEST_ASSERT_EQUAL_STRING("foo", "foo"); + TEST_ASSERT_EQUAL_STRING("foo", testString); + TEST_ASSERT_EQUAL_STRING(testString, "foo"); + TEST_ASSERT_EQUAL_STRING("", ""); +} + +void testEqualStringsWithCarriageReturnsAndLineFeeds(void) +{ + const char *testString = "foo\r\nbar"; + + TEST_ASSERT_EQUAL_STRING(testString, testString); + TEST_ASSERT_EQUAL_STRING("foo\r\nbar", "foo\r\nbar"); + TEST_ASSERT_EQUAL_STRING("foo\r\nbar", testString); + TEST_ASSERT_EQUAL_STRING(testString, "foo\r\nbar"); + TEST_ASSERT_EQUAL_STRING("", ""); +} + +void testNotEqualString1(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("foo", "bar"); + VERIFY_FAILS_END +} + +void testNotEqualString2(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("foo", ""); + VERIFY_FAILS_END +} + +void testNotEqualString3(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("", "bar"); + VERIFY_FAILS_END +} + +void testNotEqualString4(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("bar\r", "bar\n"); + VERIFY_FAILS_END +} + +void testNotEqualString5(void) +{ + const char str1[] = { 0x41, 0x42, 0x03, 0x00 }; + const char str2[] = { 0x41, 0x42, 0x04, 0x00 }; + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING(str1, str2); + VERIFY_FAILS_END +} + +void testNotEqualString_ExpectedStringIsNull(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING(NULL, "bar"); + VERIFY_FAILS_END +} + +void testNotEqualString_ActualStringIsNull(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("foo", NULL); + VERIFY_FAILS_END +} + +void testEqualStringArrays(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, expStrings, 3); + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 3); + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 2); + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 1); +} + +void testNotEqualStringArray1(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray2(void) +{ + const char *testStrings[] = { "zoo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", "boo", "woo", "moo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray3(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", NULL }; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray4(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", NULL, "woo", "moo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray5(void) +{ + const char **testStrings = NULL; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray6(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "zoo" }; + const char **expStrings = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testEqualStringArrayIfBothNulls(void) +{ + const char **testStrings = NULL; + const char **expStrings = NULL; + + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); +} + +void testEqualMemory(void) +{ + const char *testString = "whatever"; + + TEST_ASSERT_EQUAL_MEMORY(testString, testString, 8); + TEST_ASSERT_EQUAL_MEMORY("whatever", "whatever", 8); + TEST_ASSERT_EQUAL_MEMORY("whatever", testString, 8); + TEST_ASSERT_EQUAL_MEMORY(testString, "whatever", 8); + TEST_ASSERT_EQUAL_MEMORY(testString, "whatever", 2); + TEST_ASSERT_EQUAL_MEMORY(NULL, NULL, 1); +} + +void testNotEqualMemory1(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY("foo", "bar", 3); + VERIFY_FAILS_END +} + +void testNotEqualMemory2(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY("fool", "food", 4); + VERIFY_FAILS_END +} + +void testNotEqualMemory3(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY(NULL, "food", 4); + VERIFY_FAILS_END +} + +void testNotEqualMemory4(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY("fool", NULL, 4); + VERIFY_FAILS_END +} + +void testEqualIntArrays(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, -2}; + int p2[] = {1, 8, 987, 2}; + int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p3, 1); +} + +void testNotEqualIntArraysNullExpected(void) +{ + int* p0 = NULL; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArraysNullActual(void) +{ + int* p1 = NULL; + int p0[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArrays1(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArrays2(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {2, 8, 987, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArrays3(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 986, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualInt8Arrays(void) +{ + _US8 p0[] = {1, 8, 117, -2}; + _US8 p1[] = {1, 8, 117, -2}; + _US8 p2[] = {1, 8, 117, 2}; + _US8 p3[] = {1, 50, 60, 70}; + + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p3, 1); +} + +void testNotEqualInt8Arrays(void) +{ + _US8 p0[] = {1, 8, 127, -2}; + _US8 p1[] = {1, 8, 127, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualUIntArrays(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65132u}; + unsigned int p2[] = {1, 8, 987, 2}; + unsigned int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p3, 1); +} + +void testNotEqualUIntArrays1(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUIntArrays2(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUIntArrays3(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualInt16Arrays(void) +{ + _UU16 p0[] = {1, 8, 117, 3}; + _UU16 p1[] = {1, 8, 117, 3}; + _UU16 p2[] = {1, 8, 117, 2}; + _UU16 p3[] = {1, 50, 60, 70}; + + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p3, 1); +} + +void testNotEqualInt16Arrays(void) +{ + _UU16 p0[] = {1, 8, 127, 3}; + _UU16 p1[] = {1, 8, 127, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualUINT16Arrays(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65132u}; + unsigned short p2[] = {1, 8, 987, 2}; + unsigned short p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p3, 1); +} + +void testNotEqualUINT16Arrays1(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUINT16Arrays2(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUINT16Arrays3(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualHEXArrays(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65132u}; + unsigned int p2[] = {1, 8, 987, 2}; + unsigned int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p3, 1); +} + +void testNotEqualHEXArrays1(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEXArrays2(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEXArrays3(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualHEX16Arrays(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65132u}; + unsigned short p2[] = {1, 8, 987, 2}; + unsigned short p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p3, 1); +} + +void testNotEqualHEX16Arrays1(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX16Arrays2(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX16Arrays3(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualHEX8Arrays(void) +{ + unsigned short p0[] = {1, 8, 254u, 123}; + unsigned short p1[] = {1, 8, 254u, 123}; + unsigned short p2[] = {1, 8, 254u, 2}; + unsigned short p3[] = {1, 23, 25, 26}; + + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p3, 1); +} + +void testNotEqualHEX8Arrays1(void) +{ + unsigned char p0[] = {1, 8, 254u, 253u}; + unsigned char p1[] = {1, 8, 254u, 252u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX8Arrays2(void) +{ + unsigned char p0[] = {1, 8, 254u, 253u}; + unsigned char p1[] = {2, 8, 254u, 253u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX8Arrays3(void) +{ + unsigned char p0[] = {1, 8, 254u, 253u}; + unsigned char p1[] = {1, 8, 255u, 253u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualMemoryArrays(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, -2}; + int p2[] = {1, 8, 987, 2}; + int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p0, 4, 1); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p0, 4, 4); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p2, 4, 3); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p3, 4, 1); +} + +void testNotEqualMemoryArraysExpectedNull(void) +{ + int* p0 = NULL; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArraysActualNull(void) +{ + int p0[] = {1, 8, 987, -2}; + int* p1 = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArrays1(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArrays2(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {2, 8, 987, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArrays3(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 986, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testProtection(void) +{ + volatile int mask = 0; + + if (TEST_PROTECT()) + { + mask |= 1; + TEST_ABORT(); + } + else + { + Unity.CurrentTestFailed = 0; + mask |= 2; + } + + TEST_ASSERT_EQUAL(3, mask); +} + +void testIgnoredAndThenFailInTearDown(void) +{ + SetToOneToFailInTearDown = 1; + TEST_IGNORE(); +} + +// ===================== THESE TEST WILL RUN IF YOUR CONFIG INCLUDES 64 BIT SUPPORT ================== +#ifdef UNITY_SUPPORT_64 + +void testEqualHex64s(void) +{ + _UU64 v0, v1; + _UU64 *p0, *p1; + + v0 = 0x9876543201234567; + v1 = 0x9876543201234567; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX64(0x9876543201234567, 0x9876543201234567); + TEST_ASSERT_EQUAL_HEX64(v0, v1); + TEST_ASSERT_EQUAL_HEX64(0x9876543201234567, v1); + TEST_ASSERT_EQUAL_HEX64(v0, 0x9876543201234567); + TEST_ASSERT_EQUAL_HEX64(*p0, v1); + TEST_ASSERT_EQUAL_HEX64(*p0, *p1); + TEST_ASSERT_EQUAL_HEX64(*p0, 0x9876543201234567); +} + +void testNotEqualHex64s(void) +{ + _UU64 v0, v1; + + v0 = 9000000000; + v1 = 9100000000; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex64sIfSigned(void) +{ + _US64 v0, v1; + + v0 = -9000000000; + v1 = 9000000000; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64(v0, v1); + VERIFY_FAILS_END +} + +void testHEX64sWithinDelta(void) +{ + TEST_ASSERT_HEX64_WITHIN(1, 0x7FFFFFFFFFFFFFFF,0x7FFFFFFFFFFFFFFE); + TEST_ASSERT_HEX64_WITHIN(5, 5000, 4996); + TEST_ASSERT_HEX64_WITHIN(5, 5000, 5005); +} + +void testHEX64sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX64_WITHIN(1, 0x7FFFFFFFFFFFFFFF, 0x7FFFFFFFFFFFFFFC); + VERIFY_FAILS_END +} + +void testHEX64sNotWithinDeltaEvenThoughASignedIntWouldPass(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX64_WITHIN(5, 1, -1); + VERIFY_FAILS_END +} + +void testEqualHEX64Arrays(void) +{ + _UU64 p0[] = {1, 8, 987, 65132u}; + _UU64 p1[] = {1, 8, 987, 65132u}; + _UU64 p2[] = {1, 8, 987, 2}; + _UU64 p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p3, 1); +} + +void testNotEqualHEX64Arrays1(void) +{ + _UU64 p0[] = {1, 8, 987, 65132u}; + _UU64 p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX64Arrays2(void) +{ + _UU64 p0[] = {1, 8, 987, 65132u}; + _UU64 p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +#endif //64-bit SUPPORT + +// ===================== THESE TEST WILL RUN IF YOUR CONFIG INCLUDES FLOAT SUPPORT ================== +#ifndef UNITY_EXCLUDE_FLOAT + +void testFloatsWithinDelta(void) +{ + TEST_ASSERT_FLOAT_WITHIN(0.00003f, 187245.03485f, 187245.03488f); + TEST_ASSERT_FLOAT_WITHIN(1.0f, 187245.0f, 187246.0f); + TEST_ASSERT_FLOAT_WITHIN(0.05f, 9273.2549f, 9273.2049f); + TEST_ASSERT_FLOAT_WITHIN(0.007f, -726.93724f, -726.94424f); +} + +void testFloatsNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_FLOAT_WITHIN(0.05f, 9273.2649f, 9273.2049f); + VERIFY_FAILS_END +} + +void testFloatsEqual(void) +{ + TEST_ASSERT_EQUAL_FLOAT(187245.0f, 187246.0f); + TEST_ASSERT_EQUAL_FLOAT(18724.5f, 18724.6f); + TEST_ASSERT_EQUAL_FLOAT(9273.2549f, 9273.2599f); + TEST_ASSERT_EQUAL_FLOAT(-726.93724f, -726.9374f); +} + +void testFloatsNotEqual(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT(9273.9649f, 9273.0049f); + VERIFY_FAILS_END +} + +void testFloatsNotEqualNegative1(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT(-9273.9649f, -9273.0049f); + VERIFY_FAILS_END +} + +void testFloatsNotEqualNegative2(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT(-9273.0049f, -9273.9649f); + VERIFY_FAILS_END +} + +void testEqualFloatArrays(void) +{ + float p0[] = {1.0, -8.0, 25.4, -0.123}; + float p1[] = {1.0, -8.0, 25.4, -0.123}; + float p2[] = {1.0, -8.0, 25.4, -0.2}; + float p3[] = {1.0, -23.0, 25.0, -0.26}; + + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p3, 1); +} + +void testNotEqualFloatArraysExpectedNull(void) +{ + float* p0 = NULL; + float p1[] = {1.0, 8.0, 25.4, 0.252}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysActualNull(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float* p1 = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArrays1(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float p1[] = {1.0, 8.0, 25.4, 0.252}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArrays2(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float p1[] = {2.0, 8.0, 25.4, 0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArrays3(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float p1[] = {1.0, 8.0, 25.5, 0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysNegative1(void) +{ + float p0[] = {-1.0, -8.0, -25.4, -0.253}; + float p1[] = {-1.0, -8.0, -25.4, -0.252}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysNegative2(void) +{ + float p0[] = {-1.0, -8.0, -25.4, -0.253}; + float p1[] = {-2.0, -8.0, -25.4, -0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysNegative3(void) +{ + float p0[] = {-1.0, -8.0, -25.4, -0.253}; + float p1[] = {-1.0, -8.0, -25.5, -0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +#endif //FLOAT SUPPORT diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/constructor/History.rdoc b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/constructor/History.rdoc new file mode 100644 index 0000000..b220b1d --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/constructor/History.rdoc @@ -0,0 +1,19 @@ +== 1.0.4 / 2009-12-01 + + * Building is now done with Jeweler. + +== 1.0.3 / 2009-11-30 + + * Quick release to include ConstructorStruct. + +== 1.0.2 / 2008-05-07 + + * An error is raised when constructor keys are passed in that already exist in the super class + +== 1.0.1 / 2007-12-21 + +* You can now pass a block to your constructor call; it gets executed after all the ivars get assigned. (This lets you write some initializer code if you need to.) + +== 1.0.0 / 2007-11-18 + +* Released! diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/constructor/README.rdoc b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/constructor/README.rdoc new file mode 100644 index 0000000..e6177de --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/constructor/README.rdoc @@ -0,0 +1,72 @@ +== Constructor + +* http://atomicobject.github.com/constructor + +== DESCRIPTION: + +Declarative means to define object properties by passing a hash +to the constructor, which will set the corresponding ivars. + +== SYNOPSIS: + + require 'constructor' + + class Horse + constructor :name, :breed, :weight + end + Horse.new :name => 'Ed', :breed => 'Mustang', :weight => 342 + +By default the ivars do not get accessors defined. +But you can get them auto-made if you want: + + class Horse + constructor :name, :breed, :weight, :accessors => true + end + ... + puts my_horse.weight + +Arguments specified are required by default. You can disable +strict argument checking with :strict option. This means that +the constructor will not raise an error if you pass more or +fewer arguments than declared. + + class Donkey + constructor :age, :odor, :strict => false + end + +... this allows you to pass either an age or odor key (or neither) +to the Donkey constructor. + + +== REQUIREMENTS: + +* rubygems + +== INSTALL: + +* sudo gem install constructor + +== LICENSE: + +(The MIT License) + +Copyright (c) 2007 Atomic Object + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/constructor/Rakefile b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/constructor/Rakefile new file mode 100644 index 0000000..e1c3536 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/constructor/Rakefile @@ -0,0 +1,33 @@ +require 'rubygems' + +desc 'Default: run specs' +task :default => :spec + +require 'spec/rake/spectask' +desc 'Run constructor specs' +Spec::Rake::SpecTask.new(:spec) do |t| + t.spec_files = FileList['specs/*_spec.rb'] + t.spec_opts << '-c -f s' +end + +begin + require 'jeweler' + Jeweler::Tasks.new do |gemspec| + $: << "lib" + require 'constructor.rb' + gemspec.name = 'constructor' + gemspec.version = CONSTRUCTOR_VERSION + gemspec.summary = 'Declarative named-argument object initialization.' + gemspec.description = 'Declarative means to define object properties by passing a hash to the constructor, which will set the corresponding ivars.' + gemspec.homepage = 'http://atomicobject.github.com/constructor' + gemspec.authors = 'Atomic Object' + gemspec.email = 'github@atomicobject.com' + gemspec.test_files = FileList['specs/*_spec.rb'] + end + + Jeweler::GemcutterTasks.new + +rescue LoadError + puts "(jeweler not installed)" +end + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/constructor/homepage/Notes.txt b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/constructor/homepage/Notes.txt new file mode 100644 index 0000000..258d959 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/constructor/homepage/Notes.txt @@ -0,0 +1,27 @@ +Wed Nov 21 21:49:27 EST 2007 +crosby + +1. Edit page_header.graffle +2. Export as HTML imagemap +3. Open ../sample_code/synopsis.rb +4. Screen shot, save as sample_code.png +5. rake (rewrites index.html) +6. cd .. +7. rake publish_docs + +page_header.graffle + Export-as-HTML-Imagemap + Use png + Use 125% scale + Remember to use the style inspector to assign actions to things that should be links. + +rake index + Rewrites index.html using index.erb and page_header.html (and some values in the Rakefile) + +The code sample screenshot: + Taken with Snapz Pro X (this is important, as Snapz is providing the + dropshadow and about 28 extra pixels widthwise) + + Should be 650 px wide to line up with the page header. + + Transparency: be conscious of WHAT'S IN THE BACKGROUND diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/constructor/homepage/Rakefile b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/constructor/homepage/Rakefile new file mode 100644 index 0000000..c2bca7a --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/constructor/homepage/Rakefile @@ -0,0 +1,15 @@ +desc "Rewrite index.html using index.erb and publisher_homepage.html" +task :index do + require 'erb' + @title = "Constructor - atomicobject.rb" + @plugin_install = "$ script/plugin install svn://rubyforge.org/var/svn/atomicobjectrb/tags/constructor" + @header_html = File.read("page_header.html") + html = ERB.new(File.read("index.erb")).result(binding) + fname = "index.html" + File.open(fname,"w") do |f| + f.print html + end + puts "Wrote #{fname}" +end + +task :default => :index diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/constructor/homepage/index.erb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/constructor/homepage/index.erb new file mode 100644 index 0000000..9af27c1 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/constructor/homepage/index.erb @@ -0,0 +1,27 @@ + + + <%= @title %> + + + + + +
+ + + + + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/constructor/homepage/index.html b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/constructor/homepage/index.html new file mode 100644 index 0000000..c2f8e64 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/constructor/homepage/index.html @@ -0,0 +1,36 @@ + + + Constructor - atomicobject.rb + + + + + +
+ + + + + + + + + + + + +
$ script/plugin install svn://rubyforge.org/var/svn/atomicobjectrb/tags/constructor
+ + +
+ + + + + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/constructor/homepage/page_header.graffle b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/constructor/homepage/page_header.graffle new file mode 100644 index 0000000..a910021 Binary files /dev/null and b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/constructor/homepage/page_header.graffle differ diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/constructor/homepage/page_header.html b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/constructor/homepage/page_header.html new file mode 100644 index 0000000..1530968 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/constructor/homepage/page_header.html @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/constructor/homepage/page_header.png b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/constructor/homepage/page_header.png new file mode 100644 index 0000000..82b3aae Binary files /dev/null and b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/constructor/homepage/page_header.png differ diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/constructor/homepage/sample_code.png b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/constructor/homepage/sample_code.png new file mode 100644 index 0000000..6084202 Binary files /dev/null and b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/constructor/homepage/sample_code.png differ diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/constructor/homepage/sample_code.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/constructor/homepage/sample_code.rb new file mode 100644 index 0000000..2b6dc21 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/constructor/homepage/sample_code.rb @@ -0,0 +1,12 @@ +require 'rubygems' +require 'constructor' + +class Horse + constructor :name, :breed, :weight, :accessors => true +end + +ed = Horse.new(:name => 'Ed', :breed => 'Mustang', :weight => 342) +puts ed.name +puts ed.breed +puts ed.weight + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/constructor/lib/constructor.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/constructor/lib/constructor.rb new file mode 100644 index 0000000..87eb6dd --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/constructor/lib/constructor.rb @@ -0,0 +1,127 @@ +CONSTRUCTOR_VERSION = '1.0.4' #:nodoc:# + +class Class #:nodoc:# + def constructor(*attrs, &block) + call_block = '' + if block_given? + @constructor_block = block + call_block = 'self.instance_eval(&self.class.constructor_block)' + end + # Look for embedded options in the listing: + opts = attrs.find { |a| a.kind_of?(Hash) and attrs.delete(a) } + do_acc = opts.nil? ? false : opts[:accessors] == true + do_reader = opts.nil? ? false : opts[:readers] == true + require_args = opts.nil? ? true : opts[:strict] != false + super_args = opts.nil? ? nil : opts[:super] + + # Incorporate superclass's constructor keys, if our superclass + if superclass.constructor_keys + similar_keys = superclass.constructor_keys & attrs + raise "Base class already has keys #{similar_keys.inspect}" unless similar_keys.empty? + attrs = [attrs,superclass.constructor_keys].flatten + end + # Generate ivar assigner code lines + assigns = '' + attrs.each do |k| + assigns += "@#{k.to_s} = args[:#{k.to_s}]\n" + end + + # If accessors option is on, declare accessors for the attributes: + if do_acc + add_accessors = "attr_accessor " + attrs.reject {|x| superclass.constructor_keys.include?(x.to_sym)}.map {|x| ":#{x.to_s}"}.join(',') + #add_accessors = "attr_accessor " + attrs.map {|x| ":#{x.to_s}"}.join(',') + self.class_eval add_accessors + end + + # If readers option is on, declare readers for the attributes: + if do_reader + self.class_eval "attr_reader " + attrs.reject {|x| superclass.constructor_keys.include?(x.to_sym)}.map {|x| ":#{x.to_s}"}.join(',') + end + + # If user supplied super-constructor hints: + super_call = '' + if super_args + list = super_args.map do |a| + case a + when String + %|"#{a}"| + when Symbol + %|:#{a}| + end + end + super_call = %|super(#{list.join(',')})| + end + + # If strict is on, define the constructor argument validator method, + # and setup the initializer to invoke the validator method. + # Otherwise, insert lax code into the initializer. + validation_code = "return if args.nil?" + if require_args + self.class_eval do + def _validate_constructor_args(args) + # First, make sure we've got args of some kind + unless args and args.keys and args.keys.size > 0 + raise ConstructorArgumentError.new(self.class.constructor_keys) + end + # Scan for missing keys in the argument hash + a_keys = args.keys + missing = [] + self.class.constructor_keys.each do |ck| + unless a_keys.member?(ck) + missing << ck + end + a_keys.delete(ck) # Delete inbound keys as we address them + end + if missing.size > 0 || a_keys.size > 0 + raise ConstructorArgumentError.new(missing,a_keys) + end + end + end + # Setup the code to insert into the initializer: + validation_code = "_validate_constructor_args args " + end + + # Generate the initializer code + self.class_eval %{ + def initialize(args=nil) + #{super_call} + #{validation_code} + #{assigns} + setup if respond_to?(:setup) + #{call_block} + end + } + + # Remember our constructor keys + @_ctor_keys = attrs + end + + # Access the constructor keys for this class + def constructor_keys; @_ctor_keys ||=[]; end + + def constructor_block #:nodoc:# + @constructor_block + end + +end + +# Fancy validation exception, based on missing and extraneous keys. +class ConstructorArgumentError < RuntimeError #:nodoc:# + def initialize(missing,rejected=[]) + err_msg = '' + if missing.size > 0 + err_msg = "Missing constructor args [#{missing.join(',')}]" + end + if rejected.size > 0 + # Some inbound keys were not addressed earlier; this means they're unwanted + if err_msg + err_msg << "; " # Appending to earlier message about missing items + else + err_msg = '' + end + # Enumerate the rejected key names + err_msg << "Rejected constructor args [#{rejected.join(',')}]" + end + super err_msg + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/constructor/lib/constructor_struct.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/constructor/lib/constructor_struct.rb new file mode 100644 index 0000000..e97ff62 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/constructor/lib/constructor_struct.rb @@ -0,0 +1,33 @@ +class ConstructorStruct + def self.new(*accessors, &block) + defaults = {:accessors => true, :strict => false} + + accessor_names = accessors.dup + if accessors.last.is_a? Hash + accessor_names.pop + user_opts = accessors.last + user_opts.delete(:accessors) + defaults.each do |k,v| + user_opts[k] ||= v + end + else + accessors << defaults + end + + Class.new do + constructor *accessors + + class_eval(&block) if block + + comparator_code = accessor_names.map { |fname| "self.#{fname} == o.#{fname}" }.join(" && ") + eval %| + def ==(o) + (self.class == o.class) && #{comparator_code} + end + def eql?(o) + (self.class == o.class) && #{comparator_code} + end + | + end + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/constructor/specs/constructor_spec.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/constructor/specs/constructor_spec.rb new file mode 100644 index 0000000..80345ae --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/constructor/specs/constructor_spec.rb @@ -0,0 +1,407 @@ +require File.expand_path(File.dirname(__FILE__) + '/../lib/constructor') + +describe 'standard constructor usage' do + it 'allows for object construction using a hash of named arguments' do + fuh = TestingClass.new( + :foo => 'my foo', + :bar => 'my bar', + :qux => 'my qux', + :why => 'lucky' + ) + + fuh.foo.should eql('my foo') + fuh.bar.should eql('my bar') + fuh.qux.should eql('my qux') + fuh.why.should eql('lucky') + fuh.to_pretty_pretty.should eql('my foo my bar') + end + + it 'calls setup method if defined' do + ralph = Llamma.new :hair => 'red' + ralph.hungry.should be_true + ralph.hair.should eql('red') + end +end + +describe "constructor's accessor option" do + it 'provides accessors for constructor arguments when accessor option is true' do + fuh = TestingAutoAccessors.new( + :foo => 'my foo', + :bar => 'my bar', + :qux => 'my qux', + :why => 'lucky' + ) + fuh.foo.should eql('my foo') + fuh.bar.should eql('my bar') + fuh.qux.should eql('my qux') + fuh.why.should eql('lucky') + fuh.to_pretty_pretty.should eql('my foo my bar') + end + + it 'does not provide accessors for constructor arguments when accessor option is false' do + fuh = TestingBlockedAccessors.new :foo => 'my foo', :bar => 'my bar' + lambda {fuh.foo}.should raise_error(NoMethodError) + lambda {fuh.bar}.should raise_error(NoMethodError) + fuh.to_pretty_pretty.should eql('my foo my bar') + end +end + +describe "constructor's reader option" do + it 'provides readers for constructor arguments when reader option is true' do + fuh = TestingAutoReaders.new( + :foo => 'my foo', + :why => 'lucky' + ) + fuh.foo.should eql('my foo') + fuh.why.should eql('lucky') + fuh.to_pretty_pretty.should eql('my foo lucky') + + lambda {fuh.why = 'no way'}.should raise_error(NoMethodError) + lambda {fuh.foo = 'uh uh'}.should raise_error(NoMethodError) + end + + it 'does not provide reader for constructor arguments when reader option is false' do + fuh = TestingBlockedReaders.new :foo => 'my foo', :why => 'my why' + lambda {fuh.foo}.should raise_error(NoMethodError) + lambda {fuh.bar}.should raise_error(NoMethodError) + fuh.to_pretty_pretty.should eql('my foo my why') + + lambda {fuh.why = 'no way'}.should raise_error(NoMethodError) + lambda {fuh.foo = 'uh uh'}.should raise_error(NoMethodError) + end +end + +describe 'using constructor with inheritance' do + it 'allows for inheritance of constructor arguments using a non-constructor defined subclass' do + fuh = SubclassOfTestingClass.new :foo => 'whu?' + fuh.foo.should eql('whu?') + fuh.bar.should be_nil + fuh.qux.should be_nil + fuh.why.should be_nil + end + + it 'allows for standard construction of a non-constructor subclass of a non-strict constuctor superclass' do + fuh = SubclassOfTestingClass2.new + fuh.foo.should be_nil + end + + it 'runs initialize method of a sublcass' do + fuh = SubclassOfTestingClass3.new + fuh.my_new_var.should eql('something') + fuh.foo.should be_nil + fuh.bar.should be_nil + fuh.qux.should be_nil + fuh.why.should be_nil + end + + it 'passes named constructor args to superclass when subclass calls super' do + fuh = SubclassOfTestingClass3.new :foo => 12 + fuh.my_new_var.should eql('something') + fuh.foo.should eql(12) + fuh.bar.should be_nil + fuh.qux.should be_nil + fuh.why.should be_nil + end + + it 'allows for inheritance of constructor arguments using a constructor defined subclass' do + s = Sonny.new :car => 'Nissan', :saw => 'Dewalt', :computer => 'Dell' + s.computer.should eql('Dell') + s.saw.should eql('Dewalt') + s.car.should eql('Nissan') + end + + it 'calls the setup method on superclass if subclass does not define a setup method' do + baby = Baby.new :cuteness => 'little', :age => 1 + baby.fat.should eql('much') + end + + it 'calls parent class setup when super is called from subclass setup' do + m = Mama.new :age => 55 + m.age.should eql(55) + m.fat.should eql('much') + + s = Sissy.new :age => 19, :beauty => 'medium', :fat => 'yeah' + s.age.should eql(19) + s.beauty.should eql('medium') + s.fat.should eql('much') + s.friends.should eql('many') + end + + it 'passes arguments given in the super option to the initializer of a non-constructor defined superclass' do + tsc = TestingSuperConstructor.new(:far => 'oo', :away => 'kk') + tsc.far.should eql('oo') + tsc.away.should eql('kk') + tsc.a.should eql("once") + tsc.b.should eql(:twice) + end + + it 'calls non-constructor defined superclass constructor when the super option is an empty array' do + tsc = TestingSuperConstructor2.new(:some => 'thing') + tsc.some.should eql('thing') + tsc.c.should eql('what a') + tsc.d.should eql('day for') + end + + it "raises an error if subclass tries to build a constructor with the keys as its parents" do + class1 = constructor_class(Object, :star, :wars) + class2 = constructor_class(class1, :space, :balls) + lambda { constructor_class(class2, :star, :space, :chewy) }.should raise_error("Base class already has keys [:space, :star]") + end + + it 'does not create accessors for superclass constructor arguments' do + tas = TestingAccessorSubclass.new(:far => 'thing') + tas.respond_to?(:cuteness).should be_false + end + + it 'does not create a reader for superclass constructor arguments' do + t1 = TestingReaderSubclass.new(:foo => 'thing') + t1.respond_to?(:foo).should be_false + end +end + +describe 'stict mode usage' do + it 'allows omission of arguments when strict is off' do + fuh = TestingClass.new :foo => 'my foo' + + fuh.foo.should eql('my foo') + fuh.bar.should be_nil + fuh.qux.should be_nil + fuh.why.should be_nil + end + + it 'allows no arguments to a constructor when strict is off' do + fuh = TestingClass.new + fuh.foo.should be_nil + fuh.bar.should be_nil + fuh.qux.should be_nil + fuh.why.should be_nil + end + + it 'does not interfere with normal object construction' do + require 'rexml/document' + d = REXML::Document.new '' + d.should_not be_nil + d.root.name.should eql('base') + end + + def see_strict_args_in_effect_for(clazz) + fuh = clazz.new :foo => 'my foo', :bar => 'my bar' + fuh.to_pretty_pretty.should eql('my foo my bar') + + # Omit foo + lambda { + TestingStrictArgsDefault.new :bar => 'ok,yeah' + }.should raise_error(ConstructorArgumentError, /foo/) + + # Omit bar + lambda { + TestingStrictArgsDefault.new :foo => 'ok,yeah' + }.should raise_error(ConstructorArgumentError, /bar/) + end + + it 'defaults to strict argument enforcement' do + see_strict_args_in_effect_for TestingStrictArgsDefault + end + + it 'enforces strict arguments when strict option is true' do + see_strict_args_in_effect_for TestingStrictArgs + end + + it 'does not allow empty constructor arguments when strict option is true' do + lambda {TestingStrictArgs.new {}}.should raise_error(ConstructorArgumentError,/foo,bar/) + lambda {TestingStrictArgs.new}.should raise_error(ConstructorArgumentError,/foo,bar/) + lambda {TestingStrictArgs.new nil}.should raise_error(ConstructorArgumentError,/foo,bar/) + end + + it 'does not allow extraneous arguments when strict option is true' do + [ /thing/, /other/ ].each do |rejected_arg| + lambda { + TestingStrictArgs.new(:foo => 1, :bar => 2, :other => 3, :thing => 4) + }.should raise_error(ConstructorArgumentError, rejected_arg) + end + end + + it 'allows for setting accessors option while in strict mode' do + t2 = TestingStrictArgs2.new :foo => 1, :bar => 2 + + # See that accessors work + t2.foo.should eql(1) + t2.bar.should eql(2) + + # See that strictness still applies + lambda {TestingStrictArgs2.new :no => 'good'}.should raise_error(ConstructorArgumentError) + end +end + +describe 'catching ConstructorArgumentError' do + it 'allows for generic rescuing of constructor argument errors' do + begin + TestingStrictArgs.new :broken => 'yoobetcha' + rescue => bad_news + bad_news.should be_kind_of(ConstructorArgumentError) + end + end +end + +describe 'block yielding' do + it 'executes a specified block after instantiating' do + TestingBlockYield.new(:a => false).a.should == true + end +end + +def constructor_class(base, *keys) + Class.new(base) do + constructor *keys + end +end + +class TestingClass + attr_accessor :foo, :bar, :why, :qux + constructor :foo, :bar, :why, :qux, :strict => false + + def to_pretty_pretty + "#{@foo} #{@bar}" + end + +end + +class Mama + attr_accessor :fat, :age + constructor :age, :strict => false + def setup + @fat = "much" + end +end + +class Baby < Mama + constructor :cuteness +end + +class Sissy < Mama + attr_accessor :friends, :beauty + constructor :beauty, :strict => false + def setup + super #IMPORTANT! + @friends = "many" + end +end + +class TestingStrictArgsDefault + constructor :foo, :bar + def to_pretty_pretty + "#{@foo} #{@bar}" + end +end + +class TestingStrictArgs + constructor :foo, :bar, :strict => true + def to_pretty_pretty + "#{@foo} #{@bar}" + end +end + +class TestingStrictArgs2 + constructor :foo, :bar, :accessors => true +end + +class SubclassOfTestingClass < TestingClass +end + +class SubclassOfTestingClass2 < TestingClass + def initialize; end +end + +class SubclassOfTestingClass3 < TestingClass + attr_reader :my_new_var + def initialize(hash = nil) + super + @my_new_var = "something" + end +end + +class TestingAutoAccessors + constructor :foo, :bar, :why, :qux, :accessors => true, :strict => false + def to_pretty_pretty + "#{@foo} #{@bar}" + end +end + +class TestingAutoReaders + constructor :foo, :why, :readers => true, :strict => false + def to_pretty_pretty + "#{@foo} #{@why}" + end +end + +class TestingReaderSuperclass + constructor :foo +end + +class TestingReaderSubclass < TestingReaderSuperclass + constructor :bar, :readers => true, :strict => false +end + +class TestingSuperConstructorBase + attr_reader :a, :b + def initialize(a,b) + @a = a + @b = b + end +end + +class TestingSuperConstructor < TestingSuperConstructorBase + constructor :far, :away, :accessors => true, :super => ["once", :twice], :strict => false +end + +class TestingSuperConstructorBase2 + attr_reader :c, :d + def initialize + @c = 'what a' + @d = 'day for' + end +end + +class TestingSuperConstructor2 < TestingSuperConstructorBase2 + constructor :some, :accessors => true, :super => [], :strict => false +end + +class TestingAccessorSubclass < Baby + constructor :foo, :accessors => true, :strict => false +end + +class TestingBlockedAccessors + constructor :foo, :bar, :accessors => false + def to_pretty_pretty + "#{@foo} #{@bar}" + end +end + +class TestingBlockedReaders + constructor :foo, :why, :readers => false + def to_pretty_pretty + "#{@foo} #{@why}" + end +end + +class Papa + constructor :car, :saw +end + +class Sonny < Papa + attr_accessor :car, :saw, :computer + constructor :computer +end + +class Llamma + attr_accessor :hungry, :hair + constructor :hair + def setup + @hungry = true + end +end + +class TestingBlockYield + constructor :a, :accessors => true do + @a = true + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/constructor/specs/constructor_struct_spec.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/constructor/specs/constructor_struct_spec.rb new file mode 100644 index 0000000..2442da3 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/constructor/specs/constructor_struct_spec.rb @@ -0,0 +1,84 @@ +require File.dirname(__FILE__) + '/../lib/constructor_struct' + +describe ConstructorStruct, "#new" do + def struct(*accessors) + ConstructorStruct.new(*accessors) + end + + def instance_of(clazz, args=nil) + args = [args] || [] + clazz.new(*args) + end + + before do + AClass = struct(:hello, :world) unless defined?(AClass) + end + + it "creates a new class with accessors given a set of symbols or strings" do + instance_of(AClass, {:hello => "foo", :world => "bar"}).hello.should == "foo" + instance_of(AClass, {:hello => "foo", :world => "bar"}).world.should == "bar" + end + + it "creates a real class" do + instance_of(AClass).class.should == AClass + end + + it "has the option of creating a strict accessors" do + lambda { instance_of(struct(:foo, :strict => true)) }.should raise_error + end + + it "does not have the option of not creating accessors" do + instance_of(struct(:foo, :accessors => false), :foo => "bar").foo.should == "bar" + end + + describe "equivalence" do + before do + @hello = "Hello" + @world = "World" + @args = { :hello => @hello, :world => @world } + @target = AClass.new(@args) + end + + it "uses all accessors" do + [ nil, :hello, :world ].each do |field_to_alter| + alt = AClass.new(:hello => @hello, :world => @world) + + unless field_to_alter + # Base case: they should be equal + @target.should == alt + @target.eql?(alt).should be_true #should eql(alt) + else + # Change 1 field and see not equal + alt.send("#{field_to_alter}=", "other data") + @target.should_not == alt + @target.should_not eql(alt) + end + end + end + + it "will not compare to another class with same fields" do + BClass = ConstructorStruct.new(:hello, :world) + alt = BClass.new(:hello => @hello, :world => @world) + @target.should_not == alt + @target.should_not eql(alt) + end + end + + describe "extra method definitions" do + NightTrain = ConstructorStruct.new(:beer, :conductor) do + def setup + @conductor ||= "Bill" + end + end + + it "lets you declare instance methods within a block" do + night_train = NightTrain.new(:beer => "Founders") + night_train.beer.should == "Founders" + night_train.conductor.should == "Bill" + + other_train = NightTrain.new(:beer => "Bells", :conductor => "Dave") + other_train.conductor.should == "Dave" + end + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/deep_merge/MIT-LICENSE b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/deep_merge/MIT-LICENSE new file mode 100644 index 0000000..8eaf6db --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/deep_merge/MIT-LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2008 [name of plugin creator] + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/deep_merge/README b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/deep_merge/README new file mode 100644 index 0000000..0302735 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/deep_merge/README @@ -0,0 +1,94 @@ +DeepMerge Overview +================== + +Deep Merge is a simple set of utility functions for Hash. It permits +you to merge elements inside a hash together recursively. The manner +by which it does this is somewhat arbitrary (since there is no defining +standard for this) but it should end up being pretty intuitive and do what +you expect. + +You can learn a lot more about this by reading the test file. It's pretty +well documented and has many examples of various merges from very simple +to pretty complex. + +The primary need that caused me to write this library is the merging of elements +coming from HTTP parameters and related stored parameters in session. This lets +a user build up a set of parameters over time, modifying individual items. + +Deep Merge Core Documentation +============================= + There are three key methods that are added to Hash when you require deep_merge: + + deep_merge!(new_hash[, opts]) -- merges and new_hash wins unmergeable situations + deep_merge(new_hash[, opts]) -- merges and "self" hash wins unmergeable situations + ko_deep_merge!(new_hash[, opts]) -- same as deep_merge! but "--" provides "knockout" functions + + deep_merge! method permits merging of arbitrary child elements. The two top level + elements must be hashes. These hashes can contain unlimited (to stack limit) levels + of child elements. These child elements to not have to be of the same types. + Where child elements are of the same type, deep_merge will attempt to merge them together. + Where child elements are not of the same type, deep_merge will skip or optionally overwrite + the destination element with the contents of the source element at that level. + So if you have two hashes like this: + source = {:x => [1,2,3], :y => 2} + dest = {:x => [4,5,'6'], :y => [7,8,9]} + dest.deep_merge!(source) + Results: {:x => [1,2,3,4,5,'6'], :y => 2} + By default, "deep_merge!" will overwrite any unmergeables and merge everything else. + To avoid this, use "deep_merge" (no bang/exclamation mark) + + Options: + Options are specified in the last parameter passed, which should be in hash format: + hash.deep_merge!({:x => [1,2]}, {:knockout_prefix => '--'}) + :preserve_unmergeables DEFAULT: false + Set to true to skip any unmergeable elements from source + :knockout_prefix DEFAULT: nil + Set to string value to signify prefix which deletes elements from existing element + :sort_merged_arrays DEFAULT: false + Set to true to sort all arrays that are merged together + :unpack_arrays DEFAULT: nil + Set to string value to run "Array::join" then "String::split" against all arrays + :merge_debug DEFAULT: false + Set to true to get console output of merge process for debugging + + Selected Options Details: + :knockout_prefix => The purpose of this is to provide a way to remove elements + from existing Hash by specifying them in a special way in incoming hash + source = {:x => ['--1', '2']} + dest = {:x => ['1', '3']} + dest.ko_deep_merge!(source) + Results: {:x => ['2','3']} + Additionally, if the knockout_prefix is passed alone as a string, it will cause + the entire element to be removed: + source = {:x => '--'} + dest = {:x => [1,2,3]} + dest.ko_deep_merge!(source) + Results: {:x => ""} + :unpack_arrays => The purpose of this is to permit compound elements to be passed + in as strings and to be converted into discrete array elements + irsource = {:x => ['1,2,3', '4']} + dest = {:x => ['5','6','7,8']} + dest.deep_merge!(source, {:unpack_arrays => ','}) + Results: {:x => ['1','2','3','4','5','6','7','8'} + Why: If receiving data from an HTML form, this makes it easy for a checkbox + to pass multiple values from within a single HTML element + + There are many tests for this library - and you can learn more about the features + and usages of deep_merge! by just browsing the test examples + + +Simple Example Code +=================== + +require 'deep_merge' +x = {:x => [3,4,5]} +y = {:x => [1,2,3]} +y.deep_merge!(x) +# results: y = {:x => [1,2,3,4,5]} + +Availablility +============= +SVN Repo here: http://trac.misuse.org/science/wiki/DeepMerge +Contact author: http://www.misuse.org/science + +Copyright (c) 2008 Steve Midgley, released under the MIT license diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/deep_merge/Rakefile b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/deep_merge/Rakefile new file mode 100644 index 0000000..82e43b3 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/deep_merge/Rakefile @@ -0,0 +1,28 @@ +require 'rubygems' +require 'lib/deep_merge' +Gem::manage_gems +require 'rake/gempackagetask' + +spec = Gem::Specification.new do |s| + s.platform = Gem::Platform::RUBY + s.name = "deep_merge" + s.version = DeepMerge::VERSION + s.author = "Steve Midgley" + s.email = "public@misuse.org" + s.summary = "Permits recursive/deep merges of arrays and hashes." + s.files = FileList['lib/*.rb', 'test/*'].to_a + s.require_path = "lib" + s.autorequire = "deep_merge" + s.test_files = Dir.glob('tests/*.rb') + s.has_rdoc = true + s.extra_rdoc_files = ["README"] +end + +Rake::GemPackageTask.new(spec) do |pkg| + pkg.need_tar = true +end + +task :default => "pkg/#{spec.name}-#{spec.version}.gem" do + puts "generated latest version" +end + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/deep_merge/lib/deep_merge.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/deep_merge/lib/deep_merge.rb new file mode 100644 index 0000000..4c4b761 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/deep_merge/lib/deep_merge.rb @@ -0,0 +1,211 @@ +module DeepMerge + + MAJOR_VERSION = 0 + MINOR_VERSION = 1 + FIX_VERSION = 0 + VERSION = "#{MAJOR_VERSION}.#{MINOR_VERSION}.#{FIX_VERSION}" + + class InvalidParameter < StandardError; end + + DEFAULT_FIELD_KNOCKOUT_PREFIX = '--' + + module DeepMergeHash + # ko_hash_merge! will merge and knockout elements prefixed with DEFAULT_FIELD_KNOCKOUT_PREFIX + def ko_deep_merge!(source, options = {}) + default_opts = {:knockout_prefix => "--", :preserve_unmergeables => false} + DeepMerge::deep_merge!(source, self, default_opts.merge(options)) + end + + # deep_merge! will merge and overwrite any unmergeables in destination hash + def deep_merge!(source, options = {}) + default_opts = {:preserve_unmergeables => false} + DeepMerge::deep_merge!(source, self, default_opts.merge(options)) + end + + # deep_merge will merge and skip any unmergeables in destination hash + def deep_merge(source, options = {}) + default_opts = {:preserve_unmergeables => true} + DeepMerge::deep_merge!(source, self, default_opts.merge(options)) + end + + end # DeepMergeHashExt + + # Deep Merge core documentation. + # deep_merge! method permits merging of arbitrary child elements. The two top level + # elements must be hashes. These hashes can contain unlimited (to stack limit) levels + # of child elements. These child elements to not have to be of the same types. + # Where child elements are of the same type, deep_merge will attempt to merge them together. + # Where child elements are not of the same type, deep_merge will skip or optionally overwrite + # the destination element with the contents of the source element at that level. + # So if you have two hashes like this: + # source = {:x => [1,2,3], :y => 2} + # dest = {:x => [4,5,'6'], :y => [7,8,9]} + # dest.deep_merge!(source) + # Results: {:x => [1,2,3,4,5,'6'], :y => 2} + # By default, "deep_merge!" will overwrite any unmergeables and merge everything else. + # To avoid this, use "deep_merge" (no bang/exclamation mark) + # + # Options: + # Options are specified in the last parameter passed, which should be in hash format: + # hash.deep_merge!({:x => [1,2]}, {:knockout_prefix => '--'}) + # :preserve_unmergeables DEFAULT: false + # Set to true to skip any unmergeable elements from source + # :knockout_prefix DEFAULT: nil + # Set to string value to signify prefix which deletes elements from existing element + # :sort_merged_arrays DEFAULT: false + # Set to true to sort all arrays that are merged together + # :unpack_arrays DEFAULT: nil + # Set to string value to run "Array::join" then "String::split" against all arrays + # :merge_debug DEFAULT: false + # Set to true to get console output of merge process for debugging + # + # Selected Options Details: + # :knockout_prefix => The purpose of this is to provide a way to remove elements + # from existing Hash by specifying them in a special way in incoming hash + # source = {:x => ['--1', '2']} + # dest = {:x => ['1', '3']} + # dest.ko_deep_merge!(source) + # Results: {:x => ['2','3']} + # Additionally, if the knockout_prefix is passed alone as a string, it will cause + # the entire element to be removed: + # source = {:x => '--'} + # dest = {:x => [1,2,3]} + # dest.ko_deep_merge!(source) + # Results: {:x => ""} + # :unpack_arrays => The purpose of this is to permit compound elements to be passed + # in as strings and to be converted into discrete array elements + # irsource = {:x => ['1,2,3', '4']} + # dest = {:x => ['5','6','7,8']} + # dest.deep_merge!(source, {:unpack_arrays => ','}) + # Results: {:x => ['1','2','3','4','5','6','7','8'} + # Why: If receiving data from an HTML form, this makes it easy for a checkbox + # to pass multiple values from within a single HTML element + # + # There are many tests for this library - and you can learn more about the features + # and usages of deep_merge! by just browsing the test examples + def DeepMerge.deep_merge!(source, dest, options = {}) + # turn on this line for stdout debugging text + merge_debug = options[:merge_debug] || false + overwrite_unmergeable = !options[:preserve_unmergeables] + knockout_prefix = options[:knockout_prefix] || nil + if knockout_prefix == "" then raise InvalidParameter, "knockout_prefix cannot be an empty string in deep_merge!"; end + if knockout_prefix && !overwrite_unmergeable then raise InvalidParameter, "overwrite_unmergeable must be true if knockout_prefix is specified in deep_merge!"; end + # if present: we will split and join arrays on this char before merging + array_split_char = options[:unpack_arrays] || false + # request that we sort together any arrays when they are merged + sort_merged_arrays = options[:sort_merged_arrays] || false + di = options[:debug_indent] || '' + # do nothing if source is nil + if source.nil? || (source.respond_to?(:blank?) && source.blank?) then return dest; end + # if dest doesn't exist, then simply copy source to it + if dest.nil? && overwrite_unmergeable then dest = source; return dest; end + + puts "#{di}Source class: #{source.class.inspect} :: Dest class: #{dest.class.inspect}" if merge_debug + if source.kind_of?(Hash) + puts "#{di}Hashes: #{source.inspect} :: #{dest.inspect}" if merge_debug + source.each do |src_key, src_value| + if dest.kind_of?(Hash) + puts "#{di} looping: #{src_key.inspect} => #{src_value.inspect} :: #{dest.inspect}" if merge_debug + if not dest[src_key].nil? + puts "#{di} ==>merging: #{src_key.inspect} => #{src_value.inspect} :: #{dest[src_key].inspect}" if merge_debug + dest[src_key] = deep_merge!(src_value, dest[src_key], options.merge(:debug_indent => di + ' ')) + else # dest[src_key] doesn't exist so we want to create and overwrite it (but we do this via deep_merge!) + puts "#{di} ==>merging over: #{src_key.inspect} => #{src_value.inspect}" if merge_debug + # note: we rescue here b/c some classes respond to "dup" but don't implement it (Numeric, TrueClass, FalseClass, NilClass among maybe others) + begin + src_dup = src_value.dup # we dup src_value if possible because we're going to merge into it (since dest is empty) + rescue TypeError + src_dup = src_value + end + dest[src_key] = deep_merge!(src_value, src_dup, options.merge(:debug_indent => di + ' ')) + end + else # dest isn't a hash, so we overwrite it completely (if permitted) + if overwrite_unmergeable + puts "#{di} overwriting dest: #{src_key.inspect} => #{src_value.inspect} -over-> #{dest.inspect}" if merge_debug + dest = overwrite_unmergeables(source, dest, options) + end + end + end + elsif source.kind_of?(Array) + puts "#{di}Arrays: #{source.inspect} :: #{dest.inspect}" if merge_debug + # if we are instructed, join/split any source arrays before processing + if array_split_char + puts "#{di} split/join on source: #{source.inspect}" if merge_debug + source = source.join(array_split_char).split(array_split_char) + if dest.kind_of?(Array) then dest = dest.join(array_split_char).split(array_split_char); end + end + # if there's a naked knockout_prefix in source, that means we are to truncate dest + if source.index(knockout_prefix) then dest = clear_or_nil(dest); source.delete(knockout_prefix); end + if dest.kind_of?(Array) + if knockout_prefix + print "#{di} knocking out: " if merge_debug + # remove knockout prefix items from both source and dest + source.delete_if do |ko_item| + retval = false + item = ko_item.respond_to?(:gsub) ? ko_item.gsub(%r{^#{knockout_prefix}}, "") : ko_item + if item != ko_item + print "#{ko_item} - " if merge_debug + dest.delete(item) + dest.delete(ko_item) + retval = true + end + retval + end + puts if merge_debug + end + puts "#{di} merging arrays: #{source.inspect} :: #{dest.inspect}" if merge_debug + dest = dest | source + if sort_merged_arrays then dest.sort!; end + elsif overwrite_unmergeable + puts "#{di} overwriting dest: #{source.inspect} -over-> #{dest.inspect}" if merge_debug + dest = overwrite_unmergeables(source, dest, options) + end + else # src_hash is not an array or hash, so we'll have to overwrite dest + puts "#{di}Others: #{source.inspect} :: #{dest.inspect}" if merge_debug + dest = overwrite_unmergeables(source, dest, options) + end + puts "#{di}Returning #{dest.inspect}" if merge_debug + dest + end # deep_merge! + + # allows deep_merge! to uniformly handle overwriting of unmergeable entities + def DeepMerge::overwrite_unmergeables(source, dest, options) + merge_debug = options[:merge_debug] || false + overwrite_unmergeable = !options[:preserve_unmergeables] + knockout_prefix = options[:knockout_prefix] || false + di = options[:debug_indent] || '' + if knockout_prefix && overwrite_unmergeable + if source.kind_of?(String) # remove knockout string from source before overwriting dest + src_tmp = source.gsub(%r{^#{knockout_prefix}},"") + elsif source.kind_of?(Array) # remove all knockout elements before overwriting dest + src_tmp = source.delete_if {|ko_item| ko_item.kind_of?(String) && ko_item.match(%r{^#{knockout_prefix}}) } + else + src_tmp = source + end + if src_tmp == source # if we didn't find a knockout_prefix then we just overwrite dest + puts "#{di}#{src_tmp.inspect} -over-> #{dest.inspect}" if merge_debug + dest = src_tmp + else # if we do find a knockout_prefix, then we just delete dest + puts "#{di}\"\" -over-> #{dest.inspect}" if merge_debug + dest = "" + end + elsif overwrite_unmergeable + dest = source + end + dest + end + + def DeepMerge::clear_or_nil(obj) + if obj.respond_to?(:clear) + obj.clear + else + obj = nil + end + obj + end + +end # module DeepMerge + +class Hash + include DeepMerge::DeepMergeHash +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/deep_merge/pkg/deep_merge-0.1.0.gem b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/deep_merge/pkg/deep_merge-0.1.0.gem new file mode 100644 index 0000000..ffd2448 Binary files /dev/null and b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/deep_merge/pkg/deep_merge-0.1.0.gem differ diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/deep_merge/test/test_deep_merge.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/deep_merge/test/test_deep_merge.rb new file mode 100644 index 0000000..7ebd918 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/deep_merge/test/test_deep_merge.rb @@ -0,0 +1,553 @@ +require 'test/unit' +require '../lib/deep_merge.rb' + +class TestDeepMerge < Test::Unit::TestCase + + def setup + end + + # show that Hash object has deep merge capabilities in form of three methods: + # ko_deep_merge! # uses '--' knockout and overwrites unmergeable + # deep_merge! # overwrites unmergeable + # deep_merge # skips unmergeable + def test_hash_deep_merge + x = {} + assert x.respond_to?('deep_merge!'.to_sym) + hash_src = {'id' => [3,4,5]} + hash_dest = {'id' => [1,2,3]} + assert hash_dest.ko_deep_merge!(hash_src) + assert_equal({'id' => [1,2,3,4,5]}, hash_dest) + + hash_src = {'id' => [3,4,5]} + hash_dest = {'id' => [1,2,3]} + assert hash_dest.deep_merge!(hash_src) + assert_equal({'id' => [1,2,3,4,5]}, hash_dest) + + hash_src = {'id' => 'xxx'} + hash_dest = {'id' => [1,2,3]} + assert hash_dest.deep_merge(hash_src) + assert_equal({'id' => [1,2,3]}, hash_dest) + end + + FIELD_KNOCKOUT_PREFIX = DeepMerge::DEFAULT_FIELD_KNOCKOUT_PREFIX + + # tests DeepMerge::deep_merge! function + def test_deep_merge + # merge tests (moving from basic to more complex) + + # test merging an hash w/array into blank hash + hash_src = {'id' => '2'} + hash_dst = {} + DeepMerge::deep_merge!(hash_src.dup, hash_dst, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal hash_src, hash_dst + + # test merging an hash w/array into blank hash + hash_src = {'region' => {'id' => ['227', '2']}} + hash_dst = {} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal hash_src, hash_dst + + # merge from empty hash + hash_src = {} + hash_dst = {"property" => ["2","4"]} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => ["2","4"]}, hash_dst) + + # merge to empty hash + hash_src = {"property" => ["2","4"]} + hash_dst = {} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => ["2","4"]}, hash_dst) + + # simple string overwrite + hash_src = {"name" => "value"} + hash_dst = {"name" => "value1"} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"name" => "value"}, hash_dst) + + # simple string overwrite of empty hash + hash_src = {"name" => "value"} + hash_dst = {} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal(hash_src, hash_dst) + + # hashes holding array + hash_src = {"property" => ["1","3"]} + hash_dst = {"property" => ["2","4"]} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal(["2","4","1","3"], hash_dst['property']) + + # hashes holding array (sorted) + hash_src = {"property" => ["1","3"]} + hash_dst = {"property" => ["2","4"]} + DeepMerge::deep_merge!(hash_src, hash_dst, {:sort_merged_arrays => true}) + assert_equal(["1","2","3","4"].sort, hash_dst['property']) + + # hashes holding hashes holding arrays (array with duplicate elements is merged with dest then src + hash_src = {"property" => {"bedroom_count" => ["1", "2"], "bathroom_count" => ["1", "4+"]}} + hash_dst = {"property" => {"bedroom_count" => ["3", "2"], "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => {"bedroom_count" => ["3","2","1"], "bathroom_count" => ["2", "1", "4+"]}}, hash_dst) + + # hash holding hash holding array v string (string is overwritten by array) + hash_src = {"property" => {"bedroom_count" => ["1", "2"], "bathroom_count" => ["1", "4+"]}} + hash_dst = {"property" => {"bedroom_count" => "3", "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => {"bedroom_count" => ["1", "2"], "bathroom_count" => ["2","1","4+"]}}, hash_dst) + + # hash holding hash holding array v string (string is NOT overwritten by array) + hash_src = {"property" => {"bedroom_count" => ["1", "2"], "bathroom_count" => ["1", "4+"]}} + hash_dst = {"property" => {"bedroom_count" => "3", "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst, {:preserve_unmergeables => true}) + assert_equal({"property" => {"bedroom_count" => "3", "bathroom_count" => ["2","1","4+"]}}, hash_dst) + + # hash holding hash holding string v array (array is overwritten by string) + hash_src = {"property" => {"bedroom_count" => "3", "bathroom_count" => ["1", "4+"]}} + hash_dst = {"property" => {"bedroom_count" => ["1", "2"], "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => {"bedroom_count" => "3", "bathroom_count" => ["2","1","4+"]}}, hash_dst) + + # hash holding hash holding string v array (array does NOT overwrite string) + hash_src = {"property" => {"bedroom_count" => "3", "bathroom_count" => ["1", "4+"]}} + hash_dst = {"property" => {"bedroom_count" => ["1", "2"], "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst, {:preserve_unmergeables => true}) + assert_equal({"property" => {"bedroom_count" => ["1", "2"], "bathroom_count" => ["2","1","4+"]}}, hash_dst) + + # hash holding hash holding hash v array (array is overwritten by hash) + hash_src = {"property" => {"bedroom_count" => {"king_bed" => 3, "queen_bed" => 1}, "bathroom_count" => ["1", "4+"]}} + hash_dst = {"property" => {"bedroom_count" => ["1", "2"], "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => {"bedroom_count" => {"king_bed" => 3, "queen_bed" => 1}, "bathroom_count" => ["2","1","4+"]}}, hash_dst) + + # hash holding hash holding hash v array (array is NOT overwritten by hash) + hash_src = {"property" => {"bedroom_count" => {"king_bed" => 3, "queen_bed" => 1}, "bathroom_count" => ["1", "4+"]}} + hash_dst = {"property" => {"bedroom_count" => ["1", "2"], "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst, {:preserve_unmergeables => true}) + assert_equal({"property" => {"bedroom_count" => ["1", "2"], "bathroom_count" => ["2","1","4+"]}}, hash_dst) + + # 3 hash layers holding integers (integers are overwritten by source) + hash_src = {"property" => {"bedroom_count" => {"king_bed" => 3, "queen_bed" => 1}, "bathroom_count" => ["1", "4+"]}} + hash_dst = {"property" => {"bedroom_count" => {"king_bed" => 2, "queen_bed" => 4}, "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => {"bedroom_count" => {"king_bed" => 3, "queen_bed" => 1}, "bathroom_count" => ["2","1","4+"]}}, hash_dst) + + # 3 hash layers holding arrays of int (arrays are merged) + hash_src = {"property" => {"bedroom_count" => {"king_bed" => [3], "queen_bed" => [1]}, "bathroom_count" => ["1", "4+"]}} + hash_dst = {"property" => {"bedroom_count" => {"king_bed" => [2], "queen_bed" => [4]}, "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => {"bedroom_count" => {"king_bed" => [2,3], "queen_bed" => [4,1]}, "bathroom_count" => ["2","1","4+"]}}, hash_dst) + + # 1 hash overwriting 3 hash layers holding arrays of int + hash_src = {"property" => "1"} + hash_dst = {"property" => {"bedroom_count" => {"king_bed" => [2], "queen_bed" => [4]}, "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => "1"}, hash_dst) + + # 1 hash NOT overwriting 3 hash layers holding arrays of int + hash_src = {"property" => "1"} + hash_dst = {"property" => {"bedroom_count" => {"king_bed" => [2], "queen_bed" => [4]}, "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst, {:preserve_unmergeables => true}) + assert_equal({"property" => {"bedroom_count" => {"king_bed" => [2], "queen_bed" => [4]}, "bathroom_count" => ["2"]}}, hash_dst) + + # 3 hash layers holding arrays of int (arrays are merged) but second hash's array is overwritten + hash_src = {"property" => {"bedroom_count" => {"king_bed" => [3], "queen_bed" => [1]}, "bathroom_count" => "1"}} + hash_dst = {"property" => {"bedroom_count" => {"king_bed" => [2], "queen_bed" => [4]}, "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => {"bedroom_count" => {"king_bed" => [2,3], "queen_bed" => [4,1]}, "bathroom_count" => "1"}}, hash_dst) + + # 3 hash layers holding arrays of int (arrays are merged) but second hash's array is NOT overwritten + hash_src = {"property" => {"bedroom_count" => {"king_bed" => [3], "queen_bed" => [1]}, "bathroom_count" => "1"}} + hash_dst = {"property" => {"bedroom_count" => {"king_bed" => [2], "queen_bed" => [4]}, "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst, {:preserve_unmergeables => true}) + assert_equal({"property" => {"bedroom_count" => {"king_bed" => [2,3], "queen_bed" => [4,1]}, "bathroom_count" => ["2"]}}, hash_dst) + + # 3 hash layers holding arrays of int, but one holds int. This one overwrites, but the rest merge + hash_src = {"property" => {"bedroom_count" => {"king_bed" => 3, "queen_bed" => [1]}, "bathroom_count" => ["1"]}} + hash_dst = {"property" => {"bedroom_count" => {"king_bed" => [2], "queen_bed" => [4]}, "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => {"bedroom_count" => {"king_bed" => 3, "queen_bed" => [4,1]}, "bathroom_count" => ["2","1"]}}, hash_dst) + + # 3 hash layers holding arrays of int, but source is incomplete. + hash_src = {"property" => {"bedroom_count" => {"king_bed" => [3]}, "bathroom_count" => ["1"]}} + hash_dst = {"property" => {"bedroom_count" => {"king_bed" => [2], "queen_bed" => [4]}, "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => {"bedroom_count" => {"king_bed" => [2,3], "queen_bed" => [4]}, "bathroom_count" => ["2","1"]}}, hash_dst) + + # 3 hash layers holding arrays of int, but source is shorter and has new 2nd level ints. + hash_src = {"property" => {"bedroom_count" => {2=>3, "king_bed" => [3]}, "bathroom_count" => ["1"]}} + hash_dst = {"property" => {"bedroom_count" => {"king_bed" => [2], "queen_bed" => [4]}, "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => {"bedroom_count" => {2=>3, "king_bed" => [2,3], "queen_bed" => [4]}, "bathroom_count" => ["2","1"]}}, hash_dst) + + # 3 hash layers holding arrays of int, but source is empty + hash_src = {} + hash_dst = {"property" => {"bedroom_count" => {"king_bed" => [2], "queen_bed" => [4]}, "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => {"bedroom_count" => {"king_bed" => [2], "queen_bed" => [4]}, "bathroom_count" => ["2"]}}, hash_dst) + + # 3 hash layers holding arrays of int, but dest is empty + hash_src = {"property" => {"bedroom_count" => {2=>3, "king_bed" => [3]}, "bathroom_count" => ["1"]}} + hash_dst = {} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => {"bedroom_count" => {2=>3, "king_bed" => [3]}, "bathroom_count" => ["1"]}}, hash_dst) + + # test parameter management for knockout_prefix and overwrite unmergable + assert_raise(DeepMerge::InvalidParameter) {DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => ""})} + assert_raise(DeepMerge::InvalidParameter) {DeepMerge::deep_merge!(hash_src, hash_dst, {:preserve_unmergeables => true, :knockout_prefix => ""})} + assert_raise(DeepMerge::InvalidParameter) {DeepMerge::deep_merge!(hash_src, hash_dst, {:preserve_unmergeables => true, :knockout_prefix => "--"})} + assert_nothing_raised(DeepMerge::InvalidParameter) {DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => "--"})} + assert_nothing_raised(DeepMerge::InvalidParameter) {DeepMerge::deep_merge!(hash_src, hash_dst)} + assert_nothing_raised(DeepMerge::InvalidParameter) {DeepMerge::deep_merge!(hash_src, hash_dst, {:preserve_unmergeables => true})} + + # hash holding arrays of arrays + hash_src = {["1", "2", "3"] => ["1", "2"]} + hash_dst = {["4", "5"] => ["3"]} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({["1","2","3"] => ["1", "2"], ["4", "5"] => ["3"]}, hash_dst) + + # test merging of hash with blank hash, and make sure that source array split still functions + hash_src = {'property' => {'bedroom_count' => ["1","2,3"]}} + hash_dst = {} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({'property' => {'bedroom_count' => ["1","2","3"]}}, hash_dst) + + # test merging of hash with blank hash, and make sure that source array split does not function when turned off + hash_src = {'property' => {'bedroom_count' => ["1","2,3"]}} + hash_dst = {} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX}) + assert_equal({'property' => {'bedroom_count' => ["1","2,3"]}}, hash_dst) + + # test merging into a blank hash with overwrite_unmergeables turned on + hash_src = {"action"=>"browse", "controller"=>"results"} + hash_dst = {} + DeepMerge::deep_merge!(hash_src, hash_dst, {:overwrite_unmergeables => true, :knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal hash_src, hash_dst + + # KNOCKOUT_PREFIX testing + # the next few tests are looking for correct behavior from specific real-world params/session merges + # using the custom modifiers built for param/session merges + + [nil, ","].each do |ko_split| + # typical params/session style hash with knockout_merge elements + hash_params = {"property"=>{"bedroom_count"=>[FIELD_KNOCKOUT_PREFIX+"1", "2", "3"]}} + hash_session = {"property"=>{"bedroom_count"=>["1", "2", "3"]}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ko_split}) + assert_equal({"property"=>{"bedroom_count"=>["2", "3"]}}, hash_session) + + # typical params/session style hash with knockout_merge elements + hash_params = {"property"=>{"bedroom_count"=>[FIELD_KNOCKOUT_PREFIX+"1", "2", "3"]}} + hash_session = {"property"=>{"bedroom_count"=>["3"]}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ko_split}) + assert_equal({"property"=>{"bedroom_count"=>["3","2"]}}, hash_session) + + # typical params/session style hash with knockout_merge elements + hash_params = {"property"=>{"bedroom_count"=>[FIELD_KNOCKOUT_PREFIX+"1", "2", "3"]}} + hash_session = {"property"=>{"bedroom_count"=>["4"]}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ko_split}) + assert_equal({"property"=>{"bedroom_count"=>["4","2","3"]}}, hash_session) + + # typical params/session style hash with knockout_merge elements + hash_params = {"property"=>{"bedroom_count"=>[FIELD_KNOCKOUT_PREFIX+"1", "2", "3"]}} + hash_session = {"property"=>{"bedroom_count"=>[FIELD_KNOCKOUT_PREFIX+"1", "4"]}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ko_split}) + assert_equal({"property"=>{"bedroom_count"=>["4","2","3"]}}, hash_session) + + # typical params/session style hash with knockout_merge elements + hash_params = {"amenity"=>{"id"=>[FIELD_KNOCKOUT_PREFIX+"1", FIELD_KNOCKOUT_PREFIX+"2", "3", "4"]}} + hash_session = {"amenity"=>{"id"=>["1", "2"]}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ko_split}) + assert_equal({"amenity"=>{"id"=>["3","4"]}}, hash_session) + end + + # special params/session style hash with knockout_merge elements in form src: ["1","2"] dest:["--1,--2", "3,4"] + hash_params = {"amenity"=>{"id"=>[FIELD_KNOCKOUT_PREFIX+"1,"+FIELD_KNOCKOUT_PREFIX+"2", "3,4"]}} + hash_session = {"amenity"=>{"id"=>["1", "2"]}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"amenity"=>{"id"=>["3","4"]}}, hash_session) + + # same as previous but without ko_split value, this merge should fail + hash_params = {"amenity"=>{"id"=>[FIELD_KNOCKOUT_PREFIX+"1,"+FIELD_KNOCKOUT_PREFIX+"2", "3,4"]}} + hash_session = {"amenity"=>{"id"=>["1", "2"]}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX}) + assert_equal({"amenity"=>{"id"=>["1","2","3,4"]}}, hash_session) + + # special params/session style hash with knockout_merge elements in form src: ["1","2"] dest:["--1,--2", "3,4"] + hash_params = {"amenity"=>{"id"=>[FIELD_KNOCKOUT_PREFIX+"1,2", "3,4", "--5", "6"]}} + hash_session = {"amenity"=>{"id"=>["1", "2"]}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"amenity"=>{"id"=>["2","3","4","6"]}}, hash_session) + + # special params/session style hash with knockout_merge elements in form src: ["--1,--2", "3,4", "--5", "6"] dest:["1,2", "3,4"] + hash_params = {"amenity"=>{"id"=>["#{FIELD_KNOCKOUT_PREFIX}1,#{FIELD_KNOCKOUT_PREFIX}2", "3,4", "#{FIELD_KNOCKOUT_PREFIX}5", "6"]}} + hash_session = {"amenity"=>{"id"=>["1", "2", "3", "4"]}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"amenity"=>{"id"=>["3","4","6"]}}, hash_session) + + + hash_src = {"url_regions"=>[], "region"=>{"ids"=>["227,233"]}, "action"=>"browse", "task"=>"browse", "controller"=>"results"} + hash_dst = {"region"=>{"ids"=>["227"]}} + DeepMerge::deep_merge!(hash_src.dup, hash_dst, {:overwrite_unmergeables => true, :knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"url_regions"=>[], "region"=>{"ids"=>["227","233"]}, "action"=>"browse", "task"=>"browse", "controller"=>"results"}, hash_dst) + + hash_src = {"region"=>{"ids"=>["--","227"], "id"=>"230"}} + hash_dst = {"region"=>{"ids"=>["227", "233", "324", "230", "230"], "id"=>"230"}} + DeepMerge::deep_merge!(hash_src, hash_dst, {:overwrite_unmergeables => true, :knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"region"=>{"ids"=>["227"], "id"=>"230"}}, hash_dst) + + hash_src = {"region"=>{"ids"=>["--","227", "232", "233"], "id"=>"232"}} + hash_dst = {"region"=>{"ids"=>["227", "233", "324", "230", "230"], "id"=>"230"}} + DeepMerge::deep_merge!(hash_src, hash_dst, {:overwrite_unmergeables => true, :knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"region"=>{"ids"=>["227", "232", "233"], "id"=>"232"}}, hash_dst) + + hash_src = {"region"=>{"ids"=>["--,227,232,233"], "id"=>"232"}} + hash_dst = {"region"=>{"ids"=>["227", "233", "324", "230", "230"], "id"=>"230"}} + DeepMerge::deep_merge!(hash_src, hash_dst, {:overwrite_unmergeables => true, :knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"region"=>{"ids"=>["227", "232", "233"], "id"=>"232"}}, hash_dst) + + hash_src = {"region"=>{"ids"=>["--,227,232","233"], "id"=>"232"}} + hash_dst = {"region"=>{"ids"=>["227", "233", "324", "230", "230"], "id"=>"230"}} + DeepMerge::deep_merge!(hash_src, hash_dst, {:overwrite_unmergeables => true, :knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"region"=>{"ids"=>["227", "232", "233"], "id"=>"232"}}, hash_dst) + + hash_src = {"region"=>{"ids"=>["--,227"], "id"=>"230"}} + hash_dst = {"region"=>{"ids"=>["227", "233", "324", "230", "230"], "id"=>"230"}} + DeepMerge::deep_merge!(hash_src, hash_dst, {:overwrite_unmergeables => true, :knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"region"=>{"ids"=>["227"], "id"=>"230"}}, hash_dst) + + hash_src = {"region"=>{"ids"=>["--,227"], "id"=>"230"}} + hash_dst = {"region"=>{"ids"=>["227", "233", "324", "230", "230"], "id"=>"230"}, "action"=>"browse", "task"=>"browse", "controller"=>"results", "property_order_by"=>"property_type.descr"} + DeepMerge::deep_merge!(hash_src, hash_dst, {:overwrite_unmergeables => true, :knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"region"=>{"ids"=>["227"], "id"=>"230"}, "action"=>"browse", "task"=>"browse", + "controller"=>"results", "property_order_by"=>"property_type.descr"}, hash_dst) + + hash_src = {"query_uuid"=>"6386333d-389b-ab5c-8943-6f3a2aa914d7", "region"=>{"ids"=>["--,227"], "id"=>"230"}} + hash_dst = {"query_uuid"=>"6386333d-389b-ab5c-8943-6f3a2aa914d7", "url_regions"=>[], "region"=>{"ids"=>["227", "233", "324", "230", "230"], "id"=>"230"}, "action"=>"browse", "task"=>"browse", "controller"=>"results", "property_order_by"=>"property_type.descr"} + DeepMerge::deep_merge!(hash_src, hash_dst, {:overwrite_unmergeables => true, :knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"query_uuid" => "6386333d-389b-ab5c-8943-6f3a2aa914d7", "url_regions"=>[], + "region"=>{"ids"=>["227"], "id"=>"230"}, "action"=>"browse", "task"=>"browse", + "controller"=>"results", "property_order_by"=>"property_type.descr"}, hash_dst) + + # knock out entire dest hash if "--" is passed for source + hash_params = {'amenity' => "--"} + hash_session = {"amenity" => "1"} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => "--", :unpack_arrays => ","}) + assert_equal({'amenity' => ""}, hash_session) + + # knock out entire dest hash if "--" is passed for source + hash_params = {'amenity' => ["--"]} + hash_session = {"amenity" => "1"} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => "--", :unpack_arrays => ","}) + assert_equal({'amenity' => []}, hash_session) + + # knock out entire dest hash if "--" is passed for source + hash_params = {'amenity' => "--"} + hash_session = {"amenity" => ["1"]} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => "--", :unpack_arrays => ","}) + assert_equal({'amenity' => ""}, hash_session) + + # knock out entire dest hash if "--" is passed for source + hash_params = {'amenity' => ["--"]} + hash_session = {"amenity" => ["1"]} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => "--", :unpack_arrays => ","}) + assert_equal({'amenity' => []}, hash_session) + + # knock out entire dest hash if "--" is passed for source + hash_params = {'amenity' => ["--"]} + hash_session = {"amenity" => "1"} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => "--", :unpack_arrays => ","}) + assert_equal({'amenity' => []}, hash_session) + + # knock out entire dest hash if "--" is passed for source + hash_params = {'amenity' => ["--", "2"]} + hash_session = {'amenity' => ["1", "3", "7+"]} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => "--", :unpack_arrays => ","}) + assert_equal({'amenity' => ["2"]}, hash_session) + + # knock out entire dest hash if "--" is passed for source + hash_params = {'amenity' => ["--", "2"]} + hash_session = {'amenity' => "5"} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => "--", :unpack_arrays => ","}) + assert_equal({'amenity' => ['2']}, hash_session) + + # knock out entire dest hash if "--" is passed for source + hash_params = {'amenity' => "--"} + hash_session = {"amenity"=>{"id"=>["1", "2", "3", "4"]}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => "--", :unpack_arrays => ","}) + assert_equal({'amenity' => ""}, hash_session) + + # knock out entire dest hash if "--" is passed for source + hash_params = {'amenity' => ["--"]} + hash_session = {"amenity"=>{"id"=>["1", "2", "3", "4"]}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => "--", :unpack_arrays => ","}) + assert_equal({'amenity' => []}, hash_session) + + # knock out dest array if "--" is passed for source + hash_params = {"region" => {'ids' => FIELD_KNOCKOUT_PREFIX}} + hash_session = {"region"=>{"ids"=>["1", "2", "3", "4"]}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({'region' => {'ids' => ""}}, hash_session) + + # knock out dest array but leave other elements of hash intact + hash_params = {"region" => {'ids' => FIELD_KNOCKOUT_PREFIX}} + hash_session = {"region"=>{"ids"=>["1", "2", "3", "4"], 'id'=>'11'}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({'region' => {'ids' => "", 'id'=>'11'}}, hash_session) + + # knock out entire tree of dest hash + hash_params = {"region" => FIELD_KNOCKOUT_PREFIX} + hash_session = {"region"=>{"ids"=>["1", "2", "3", "4"], 'id'=>'11'}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({'region' => ""}, hash_session) + + # knock out entire tree of dest hash - retaining array format + hash_params = {"region" => {'ids' => [FIELD_KNOCKOUT_PREFIX]}} + hash_session = {"region"=>{"ids"=>["1", "2", "3", "4"], 'id'=>'11'}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({'region' => {'ids' => [], 'id'=>'11'}}, hash_session) + + # knock out entire tree of dest hash & replace with new content + hash_params = {"region" => {'ids' => ["2", FIELD_KNOCKOUT_PREFIX, "6"]}} + hash_session = {"region"=>{"ids"=>["1", "2", "3", "4"], 'id'=>'11'}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({'region' => {'ids' => ["2", "6"], 'id'=>'11'}}, hash_session) + + # knock out entire tree of dest hash & replace with new content + hash_params = {"region" => {'ids' => ["7", FIELD_KNOCKOUT_PREFIX, "6"]}} + hash_session = {"region"=>{"ids"=>["1", "2", "3", "4"], 'id'=>'11'}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({'region' => {'ids' => ["7", "6"], 'id'=>'11'}}, hash_session) + + # edge test: make sure that when we turn off knockout_prefix that all values are processed correctly + hash_params = {"region" => {'ids' => ["7", "--", "2", "6,8"]}} + hash_session = {"region"=>{"ids"=>["1", "2", "3", "4"], 'id'=>'11'}} + DeepMerge::deep_merge!(hash_params, hash_session, {:unpack_arrays => ","}) + assert_equal({'region' => {'ids' => ["1", "2", "3", "4", "7", "--", "6", "8"], 'id'=>'11'}}, hash_session) + + # edge test 2: make sure that when we turn off source array split that all values are processed correctly + hash_params = {"region" => {'ids' => ["7", "3", "--", "6,8"]}} + hash_session = {"region"=>{"ids"=>["1", "2", "3", "4"], 'id'=>'11'}} + DeepMerge::deep_merge!(hash_params, hash_session) + assert_equal({'region' => {'ids' => ["1", "2", "3", "4", "7", "--", "6,8"], 'id'=>'11'}}, hash_session) + + # Example: src = {'key' => "--1"}, dst = {'key' => "1"} -> merges to {'key' => ""} + hash_params = {"amenity"=>"--1"} + hash_session = {"amenity"=>"1"} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX}) + assert_equal({"amenity"=>""}, hash_session) + + # Example: src = {'key' => "--1"}, dst = {'key' => "2"} -> merges to {'key' => ""} + hash_params = {"amenity"=>"--1"} + hash_session = {"amenity"=>"2"} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX}) + assert_equal({"amenity"=>""}, hash_session) + + # Example: src = {'key' => "--1"}, dst = {'key' => "1"} -> merges to {'key' => ""} + hash_params = {"amenity"=>["--1"]} + hash_session = {"amenity"=>"1"} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX}) + assert_equal({"amenity"=>[]}, hash_session) + + # Example: src = {'key' => "--1"}, dst = {'key' => "1"} -> merges to {'key' => ""} + hash_params = {"amenity"=>["--1"]} + hash_session = {"amenity"=>["1"]} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX}) + assert_equal({"amenity"=>[]}, hash_session) + + # Example: src = {'key' => "--1"}, dst = {'key' => "1"} -> merges to {'key' => ""} + hash_params = {"amenity"=>"--1"} + hash_session = {} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX}) + assert_equal({"amenity"=>""}, hash_session) + + + # Example: src = {'key' => "--1"}, dst = {'key' => "1"} -> merges to {'key' => ""} + hash_params = {"amenity"=>"--1"} + hash_session = {"amenity"=>["1"]} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX}) + assert_equal({"amenity"=>""}, hash_session) + + #are unmerged hashes passed unmodified w/out :unpack_arrays? + hash_params = {"amenity"=>{"id"=>["26,27"]}} + hash_session = {} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX}) + assert_equal({"amenity"=>{"id"=>["26,27"]}}, hash_session) + + #hash should be merged + hash_params = {"amenity"=>{"id"=>["26,27"]}} + hash_session = {} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"amenity"=>{"id"=>["26","27"]}}, hash_session) + + # second merge of same values should result in no change in output + hash_params = {"amenity"=>{"id"=>["26,27"]}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"amenity"=>{"id"=>["26","27"]}}, hash_session) + + #hashes with knockout values are suppressed + hash_params = {"amenity"=>{"id"=>["#{FIELD_KNOCKOUT_PREFIX}26,#{FIELD_KNOCKOUT_PREFIX}27,28"]}} + hash_session = {} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"amenity"=>{"id"=>["28"]}}, hash_session) + + hash_src= {'region' =>{'ids'=>['--']}, 'query_uuid' => 'zzz'} + hash_dst= {'region' =>{'ids'=>['227','2','3','3']}, 'query_uuid' => 'zzz'} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => '--', :unpack_arrays => ","}) + assert_equal({'region' =>{'ids'=>[]}, 'query_uuid' => 'zzz'}, hash_dst) + + hash_src= {'region' =>{'ids'=>['--']}, 'query_uuid' => 'zzz'} + hash_dst= {'region' =>{'ids'=>['227','2','3','3'], 'id' => '3'}, 'query_uuid' => 'zzz'} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => '--', :unpack_arrays => ","}) + assert_equal({'region' =>{'ids'=>[], 'id'=>'3'}, 'query_uuid' => 'zzz'}, hash_dst) + + hash_src= {'region' =>{'ids'=>['--']}, 'query_uuid' => 'zzz'} + hash_dst= {'region' =>{'muni_city_id' => '2244', 'ids'=>['227','2','3','3'], 'id'=>'3'}, 'query_uuid' => 'zzz'} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => '--', :unpack_arrays => ","}) + assert_equal({'region' =>{'muni_city_id' => '2244', 'ids'=>[], 'id'=>'3'}, 'query_uuid' => 'zzz'}, hash_dst) + + hash_src= {'region' =>{'ids'=>['--'], 'id' => '5'}, 'query_uuid' => 'zzz'} + hash_dst= {'region' =>{'muni_city_id' => '2244', 'ids'=>['227','2','3','3'], 'id'=>'3'}, 'query_uuid' => 'zzz'} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => '--', :unpack_arrays => ","}) + assert_equal({'region' =>{'muni_city_id' => '2244', 'ids'=>[], 'id'=>'5'}, 'query_uuid' => 'zzz'}, hash_dst) + + hash_src= {'region' =>{'ids'=>['--', '227'], 'id' => '5'}, 'query_uuid' => 'zzz'} + hash_dst= {'region' =>{'muni_city_id' => '2244', 'ids'=>['227','2','3','3'], 'id'=>'3'}, 'query_uuid' => 'zzz'} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => '--', :unpack_arrays => ","}) + assert_equal({'region' =>{'muni_city_id' => '2244', 'ids'=>['227'], 'id'=>'5'}, 'query_uuid' => 'zzz'}, hash_dst) + + hash_src= {'region' =>{'muni_city_id' => '--', 'ids'=>'--', 'id'=>'5'}, 'query_uuid' => 'zzz'} + hash_dst= {'region' =>{'muni_city_id' => '2244', 'ids'=>['227','2','3','3'], 'id'=>'3'}, 'query_uuid' => 'zzz'} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => '--', :unpack_arrays => ","}) + assert_equal({'region' =>{'muni_city_id' => '', 'ids'=>'', 'id'=>'5'}, 'query_uuid' => 'zzz'}, hash_dst) + + hash_src= {'region' =>{'muni_city_id' => '--', 'ids'=>['--'], 'id'=>'5'}, 'query_uuid' => 'zzz'} + hash_dst= {'region' =>{'muni_city_id' => '2244', 'ids'=>['227','2','3','3'], 'id'=>'3'}, 'query_uuid' => 'zzz'} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => '--', :unpack_arrays => ","}) + assert_equal({'region' =>{'muni_city_id' => '', 'ids'=>[], 'id'=>'5'}, 'query_uuid' => 'zzz'}, hash_dst) + + hash_src= {'region' =>{'muni_city_id' => '--', 'ids'=>['--','227'], 'id'=>'5'}, 'query_uuid' => 'zzz'} + hash_dst= {'region' =>{'muni_city_id' => '2244', 'ids'=>['227','2','3','3'], 'id'=>'3'}, 'query_uuid' => 'zzz'} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => '--', :unpack_arrays => ","}) + assert_equal({'region' =>{'muni_city_id' => '', 'ids'=>['227'], 'id'=>'5'}, 'query_uuid' => 'zzz'}, hash_dst) + + hash_src = {"muni_city_id"=>"--", "id"=>""} + hash_dst = {"muni_city_id"=>"", "id"=>""} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => '--', :unpack_arrays => ","}) + assert_equal({"muni_city_id"=>"", "id"=>""}, hash_dst) + + hash_src = {"region"=>{"muni_city_id"=>"--", "id"=>""}} + hash_dst = {"region"=>{"muni_city_id"=>"", "id"=>""}} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => '--', :unpack_arrays => ","}) + assert_equal({"region"=>{"muni_city_id"=>"", "id"=>""}}, hash_dst) + + hash_src = {"query_uuid"=>"a0dc3c84-ec7f-6756-bdb0-fff9157438ab", "url_regions"=>[], "region"=>{"muni_city_id"=>"--", "id"=>""}, "property"=>{"property_type_id"=>"", "search_rate_min"=>"", "search_rate_max"=>""}, "task"=>"search", "run_query"=>"Search"} + hash_dst = {"query_uuid"=>"a0dc3c84-ec7f-6756-bdb0-fff9157438ab", "url_regions"=>[], "region"=>{"muni_city_id"=>"", "id"=>""}, "property"=>{"property_type_id"=>"", "search_rate_min"=>"", "search_rate_max"=>""}, "task"=>"search", "run_query"=>"Search"} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => '--', :unpack_arrays => ","}) + assert_equal({"query_uuid"=>"a0dc3c84-ec7f-6756-bdb0-fff9157438ab", "url_regions"=>[], "region"=>{"muni_city_id"=>"", "id"=>""}, "property"=>{"property_type_id"=>"", "search_rate_min"=>"", "search_rate_max"=>""}, "task"=>"search", "run_query"=>"Search"}, hash_dst) + + # hash of array of hashes + hash_src = {"item" => [{"1" => "3"}, {"2" => "4"}]} + hash_dst = {"item" => [{"3" => "5"}]} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"item" => [{"3" => "5"}, {"1" => "3"}, {"2" => "4"}]}, hash_dst) + end # test_deep_merge +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/History.txt b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/History.txt new file mode 100644 index 0000000..9833fd1 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/History.txt @@ -0,0 +1,28 @@ +== 1.1.2 / 2009-11-30 + * Converted to Jeweler for gem packaging + * diy/factory.rb was somehow missing from the 1.1.1 gem on gemcutter. This has been fixed as part of the Jeweler changeover. + * Rebuilt homepage http://atomicobject.github.com/diy + +== 1.1.1 / 2008-05-21 + * Fixed bug that did not allow a method to be properly injected into an object + +== 1.1 / 2008-05-20 + * Added 'method' directive for building a bounded method from an object defined in diy + +== 1.0.3 / 2007-12-11 + +* The 1.0.1 release had a load-path search in it that resulted in requiring files with full path names (rooted in loadpath entries). This is unintuitive, and will almost always result in a double "require" if the application code ever requires a library. The "require" for library loading now relies implicitly on the load path (just like normal human-coded requires.) + +== 1.0.1 / 2007-12-02 + +* Added 'using_namespace' directive for assuming a module for a group of object defs +* Added 'use_class_directly' option for configuring an ObjectDef. Instead of instantiating an instance + of the specified class, the class itself is referenced. (Good for injecting ActiveRecord classes into + other components in the guise of factories. +* Added DIY::Context.auto_require boolean setting. When false, the library of a + class is not autoloaded ahead of object construction. Is true by default. +* 'auto_require' can, if neccessary, be set in the YAML config for an individual object. + +== 1.0.0 / 2007-11-19 + +* Released! diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/README.rdoc b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/README.rdoc new file mode 100644 index 0000000..6dfef2e --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/README.rdoc @@ -0,0 +1,233 @@ +== DIY + +* http://atomicobject.github.com/diy + +== DESCRIPTION: + +DIY (Dependency Injection in YAML) is a simple dependency injection library +which focuses on declarative composition of objects through constructor injection. + +== INSTALL: + +* gem install diy + +== SYNOPSIS: + +=== Common Usage + +Author a YAML file that describes your objects and how they fit together. +This means you're building a Hash whose keys are the object names, and whose +values are Hashes that define the object. + +The following context defines an automobile engine: + +context.yml: + --- + engine: + compose: throttle, block + throttle: + compose: cable, pedal + block: + cable: + pedal: + +In your code, use DIY to load the YAML, then access its parts: + + context = DIY::Context.from_file('context.yml') + context[:engine] => + +This approach assumes: + +* You've got classes for Engine, Throttle, Block, Cable and Pedal +* They're defined in engine.rb, throttle.rb, etc +* The library files are in your load-path +* Engine and Throttle both have a constructor that accepts a Hash. The Hash + will contain keys 'throttle', 'block' (for Engine) and 'cable, 'pedal' (for Throttle) + and the values will be references to their respective objects. +* Block, Cable and Pedal all have default constructors that accept no arguments + +Sample code for Engine's constructor: + + class Engine + def initialize(components) + @throttle = components['throttle'] + @block = components['block'] + end + end + +Writing code like that is repetetive; that's why we created the Constructor gem, which lets you +specify object components using the "constructor" class method: + +Using constructor, you can write Engine like this: + + class Engine + constructor :throttle, :block + end + +=== Special Cases + +If your object has a lot of components (or they have big names) you can specify an array of component names +as opposed to a comma-separated list: + + engine: + compose: + - throttle + - block + +Sometimes you won't be able to rely on DIY's basic assumptions about class names and library files. + +* You can specify the 'class' option +* You can specify the 'library' option. If you do not, the library is inferred from the class name. + (Eg, My::Train::Station will be sought in "my/train/station.rb" + + engine: + class: FourHorse::Base + library: general_engines/base + compose: throttle, block + +If the Hash coming into your constructor needs to have some keys that do not exactly match the official +object names, you can specify them one-by-one: + + engine: + the_throttle: throttle + the_block: block + +=== Non-singleton objects + +Non-singletons are named objects that provide a new instance every time you ask for them. +By default, DIY considers all objects to be singletons. To override, use the "singleton" setting and +set it to false: + + foo: + singleton: false + +=== Sub-Contexts + +Sub-contexts are useful for creating isolated object networks that may need to be instantiated +zero or many times in your application. Objects defined in subcontexts can reference "upward" to +their surroundings, as well as objects in the subcontext itself. + +If you wanted to be able to make more than one Engine from the preceding examples, you might try: + + --- + epa_regulations: + + +automotive_plant: + engine: + compose: block, throttle, epa_regulations + block: + throttle: + +Each time you delve into the automotive_plant, you get a solar system of the defined objects. +In this context, the objects are singleton-like. The next time you invoke the subcontext, however, +you'll be working with a fresh set of objects... another solar system with the same layout, so to speak. + +Subcontexts are not initialized until you call upon them, which you do using the "within" method: + + context = DIY::Context.from_file('context.yml') + context.within('automotive_plant') do |plant| + puts plant[:engine] + end + +=== Direct Class References + +Occasionally you will have a class at your disposal that you'd like to provide directly as components +to other objects (as opposed to getting _instances_ of that class, you want to reference the class itself, eg, +to use its factory methods). Enter the "use_class_directly" flag: + + --- + customer_order_finder: + class: CustomerOrder + use_class_directly: true + +This can be handy in Rails when you'd like to use some of class methods on an ActiveRecord subclass, but +you'd like to avoid direct ActiveRecord class usage in your code. In this case, the customer_order_finder +is actually the CustomerOrder class, and so, it has methods like "find" and "destroy_all". + +=== Namespace Convenience + +If you find yourself writing context entries like this: + + --- + engine: + class: Car::Parts::Engine + throttle: + class: Car::Parts::Block + cable: + class: Car::Parts::Cable + +You can set the "assumed" module for a group of objects like this: + + --- + using_namespace Car Parts: + engine: + + throttle: + + block: + +=== Preventing auto-requiring of library files + +Normally, DIY will "require" the library for an object just before it instantiates the object. +If this is not desired (in Rails, auto-require can lead to library double-load issues), you +can deactivate auto-require. There is a global default setting (handled in code) and +a per-object override (handled in the context YAML): + + DIY::Context.auto_require = false + + --- + engine: + auto_require: false + +=== Factories + +It is possible to create factories automatically with DIY: + + --- + car_dealer: + compose: car_factory + + car_factory: + builds: car + +Then you can use the factory to easily build objects: + + context = DIY::Context.from_file('context.yml') + context[:car_factory].create => + +=== Method Directive + +This introduces the concept of first class methods. An object can now be constructed with a method object +bound to a particular object in the diy context. + + --- + trinket_builder: + + method build_trinket: + object: trinket_builder + method: build + +== LICENSE: + +(The MIT License) + +Copyright (c) 2007 Atomic Object + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/Rakefile b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/Rakefile new file mode 100644 index 0000000..0fb9c44 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/Rakefile @@ -0,0 +1,33 @@ +require 'rubygems' + +task :default => [ :test ] + +require 'rake/testtask' +Rake::TestTask.new do |t| + t.libs << "test" + t.test_files = FileList['test/**/*_test.rb'] + t.verbose = true +end + + +begin + require 'jeweler' + Jeweler::Tasks.new do |gemspec| + $: << "lib" + require 'diy.rb' + gemspec.name = 'diy' + gemspec.version = DIY::VERSION + gemspec.summary = 'Constructor-based dependency injection container using YAML input.' + gemspec.description = 'Constructor-based dependency injection container using YAML input.' + gemspec.homepage = 'http://atomicobject.github.com/diy' + gemspec.authors = 'Atomic Object' + gemspec.email = 'github@atomicobject.com' + gemspec.test_files = FileList['test/*_test.rb'] + gemspec.add_dependency 'constructor', '>= 1.0.0' + end + + Jeweler::GemcutterTasks.new + +rescue LoadError + puts "(jeweler not installed)" +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/TODO.txt b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/TODO.txt new file mode 100644 index 0000000..8533234 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/TODO.txt @@ -0,0 +1,9 @@ +Sun Dec 2 19:59:16 EST 2007 +crosby + +Features from FRE's rogue diy.rb (inside Injection) that need to be +incorporated into trunk: + +* auto_require +* use_class_directly + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/diy.gemspec b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/diy.gemspec new file mode 100644 index 0000000..fe9ac19 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/diy.gemspec @@ -0,0 +1,131 @@ +# Generated by jeweler +# DO NOT EDIT THIS FILE DIRECTLY +# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command +# -*- encoding: utf-8 -*- + +Gem::Specification.new do |s| + s.name = %q{diy} + s.version = "1.1.2" + + s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= + s.authors = ["Atomic Object"] + s.date = %q{2009-12-01} + s.description = %q{Constructor-based dependency injection container using YAML input.} + s.email = %q{github@atomicobject.com} + s.extra_rdoc_files = [ + "README.rdoc" + ] + s.files = [ + "History.txt", + "README.rdoc", + "Rakefile", + "TODO.txt", + "diy.gemspec", + "lib/diy.rb", + "lib/diy/factory.rb", + "sample_code/car.rb", + "sample_code/chassis.rb", + "sample_code/diy_example.rb", + "sample_code/engine.rb", + "sample_code/objects.yml", + "test/constructor.rb", + "test/diy_test.rb", + "test/factory_test.rb", + "test/files/broken_construction.yml", + "test/files/cat/cat.rb", + "test/files/cat/extra_conflict.yml", + "test/files/cat/heritage.rb", + "test/files/cat/needs_input.yml", + "test/files/cat/the_cat_lineage.rb", + "test/files/dog/dog_model.rb", + "test/files/dog/dog_presenter.rb", + "test/files/dog/dog_view.rb", + "test/files/dog/file_resolver.rb", + "test/files/dog/other_thing.rb", + "test/files/dog/simple.yml", + "test/files/donkey/foo.rb", + "test/files/donkey/foo/bar/qux.rb", + "test/files/factory/beef.rb", + "test/files/factory/dog.rb", + "test/files/factory/factory.yml", + "test/files/factory/farm/llama.rb", + "test/files/factory/farm/pork.rb", + "test/files/factory/kitten.rb", + "test/files/fud/objects.yml", + "test/files/fud/toy.rb", + "test/files/functions/attached_things_builder.rb", + "test/files/functions/invalid_method.yml", + "test/files/functions/method_extractor.rb", + "test/files/functions/nonsingleton_objects.yml", + "test/files/functions/objects.yml", + "test/files/functions/thing.rb", + "test/files/functions/thing_builder.rb", + "test/files/functions/things_builder.rb", + "test/files/gnu/objects.yml", + "test/files/gnu/thinger.rb", + "test/files/goat/base.rb", + "test/files/goat/can.rb", + "test/files/goat/goat.rb", + "test/files/goat/objects.yml", + "test/files/goat/paper.rb", + "test/files/goat/plane.rb", + "test/files/goat/shirt.rb", + "test/files/goat/wings.rb", + "test/files/horse/holder_thing.rb", + "test/files/horse/objects.yml", + "test/files/namespace/animal/bird.rb", + "test/files/namespace/animal/cat.rb", + "test/files/namespace/animal/reptile/hardshell/turtle.rb", + "test/files/namespace/animal/reptile/lizard.rb", + "test/files/namespace/bad_module_specified.yml", + "test/files/namespace/class_name_combine.yml", + "test/files/namespace/hello.txt", + "test/files/namespace/no_module_specified.yml", + "test/files/namespace/objects.yml", + "test/files/namespace/road.rb", + "test/files/namespace/sky.rb", + "test/files/namespace/subcontext.yml", + "test/files/non_singleton/air.rb", + "test/files/non_singleton/fat_cat.rb", + "test/files/non_singleton/objects.yml", + "test/files/non_singleton/pig.rb", + "test/files/non_singleton/thread_spinner.rb", + "test/files/non_singleton/tick.rb", + "test/files/non_singleton/yard.rb", + "test/files/yak/core_model.rb", + "test/files/yak/core_presenter.rb", + "test/files/yak/core_view.rb", + "test/files/yak/data_source.rb", + "test/files/yak/fringe_model.rb", + "test/files/yak/fringe_presenter.rb", + "test/files/yak/fringe_view.rb", + "test/files/yak/giant_squid.rb", + "test/files/yak/krill.rb", + "test/files/yak/my_objects.yml", + "test/files/yak/sub_sub_context_test.yml", + "test/test_helper.rb" + ] + s.homepage = %q{http://atomicobject.github.com/diy} + s.rdoc_options = ["--charset=UTF-8"] + s.require_paths = ["lib"] + s.rubygems_version = %q{1.3.5} + s.summary = %q{Constructor-based dependency injection container using YAML input.} + s.test_files = [ + "test/diy_test.rb", + "test/factory_test.rb" + ] + + if s.respond_to? :specification_version then + current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION + s.specification_version = 3 + + if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then + s.add_runtime_dependency(%q, [">= 1.0.0"]) + else + s.add_dependency(%q, [">= 1.0.0"]) + end + else + s.add_dependency(%q, [">= 1.0.0"]) + end +end + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/lib/diy.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/lib/diy.rb new file mode 100644 index 0000000..581afc7 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/lib/diy.rb @@ -0,0 +1,403 @@ +require 'diy/factory.rb' +require 'yaml' +require 'set' + +module DIY #:nodoc:# + VERSION = '1.1.2' + class Context + + class << self + # Enable / disable automatic requiring of libraries. Default: true + attr_accessor :auto_require + end + @auto_require = true + + # Accepts a Hash defining the object context (usually loaded from objects.yml), and an additional + # Hash containing objects to inject into the context. + def initialize(context_hash, extra_inputs={}) + raise "Nil context hash" unless context_hash + raise "Need a hash" unless context_hash.kind_of?(Hash) + [ "[]", "keys" ].each do |mname| + unless extra_inputs.respond_to?(mname) + raise "Extra inputs must respond to hash-like [] operator and methods #keys and #each" + end + end + + # store extra inputs + if extra_inputs.kind_of?(Hash) + @extra_inputs= {} + extra_inputs.each { |k,v| @extra_inputs[k.to_s] = v } # smooth out the names + else + @extra_inputs = extra_inputs + end + + collect_object_and_subcontext_defs context_hash + + # init the cache + @cache = {} + @cache['this_context'] = self + end + + + # Convenience: create a new DIY::Context by loading from a String (or open file handle.) + def self.from_yaml(io_or_string, extra_inputs={}) + raise "nil input to YAML" unless io_or_string + Context.new(YAML.load(io_or_string), extra_inputs) + end + + # Convenience: create a new DIY::Context by loading from the named file. + def self.from_file(fname, extra_inputs={}) + raise "nil file name" unless fname + self.from_yaml(File.read(fname), extra_inputs) + end + + # Return a reference to the object named. If necessary, the object will + # be instantiated on first use. If the object is non-singleton, a new + # object will be produced each time. + def get_object(obj_name) + key = obj_name.to_s + obj = @cache[key] + unless obj + if extra_inputs_has(key) + obj = @extra_inputs[key] + else + case @defs[key] + when MethodDef + obj = construct_method(key) + when FactoryDef + obj = construct_factory(key) + @cache[key] = obj + else + obj = construct_object(key) + @cache[key] = obj if @defs[key].singleton? + end + end + end + obj + end + alias :[] :get_object + + # Inject a named object into the Context. This must be done before the Context has instantiated the + # object in question. + def set_object(obj_name,obj) + key = obj_name.to_s + raise "object '#{key}' already exists in context" if @cache.keys.include?(key) + @cache[key] = obj + end + alias :[]= :set_object + + # Provide a listing of object names + def keys + (@defs.keys.to_set + @extra_inputs.keys.to_set).to_a + end + + # Instantiate and yield the named subcontext + def within(sub_context_name) + # Find the subcontext definitaion: + context_def = @sub_context_defs[sub_context_name.to_s] + raise "No sub-context named #{sub_context_name}" unless context_def + # Instantiate a new context using self as parent: + context = Context.new( context_def, self ) + + yield context + end + + # Returns true if the context contains an object with the given name + def contains_object(obj_name) + key = obj_name.to_s + @defs.keys.member?(key) or extra_inputs_has(key) + end + + # Every top level object in the Context is instantiated. This is especially useful for + # systems that have "floating observers"... objects that are never directly accessed, who + # would thus never be instantiated by coincedence. This does not build any subcontexts + # that may exist. + def build_everything + @defs.keys.each { |k| self[k] } + end + alias :build_all :build_everything + alias :preinstantiate_singletons :build_everything + + private + + def collect_object_and_subcontext_defs(context_hash) + @defs = {} + @sub_context_defs = {} + get_defs_from context_hash + end + + def get_defs_from(hash, namespace=nil) + hash.each do |name,info| + # we modify the info hash below so it's important to have a new + # instance to play with + info = info.dup if info + + # see if we are building a factory + if info and info.has_key?('builds') + unless info.has_key?('auto_require') + info['auto_require'] = self.class.auto_require + end + + if namespace + info['builds'] = namespace.build_classname(info['builds']) + end + @defs[name] = FactoryDef.new({:name => name, + :target => info['builds'], + :library => info['library'], + :auto_require => info['auto_require']}) + next + end + + name = name.to_s + case name + when /^\+/ + # subcontext + @sub_context_defs[name.gsub(/^\+/,'')] = info + + when /^using_namespace/ + # namespace: use a module(s) prefix for the classname of contained object defs + # NOTE: namespacing is NOT scope... it's just a convenient way to setup class names for a group of objects. + get_defs_from info, parse_namespace(name) + when /^method\s/ + key_name = name.gsub(/^method\s/, "") + @defs[key_name] = MethodDef.new(:name => key_name, + :object => info['object'], + :method => info['method'], + :attach => info['attach']) + else + # Normal object def + info ||= {} + if extra_inputs_has(name) + raise ConstructionError.new(name, "Object definition conflicts with parent context") + end + unless info.has_key?('auto_require') + info['auto_require'] = self.class.auto_require + end + if namespace + if info['class'] + info['class'] = namespace.build_classname(info['class']) + else + info['class'] = namespace.build_classname(name) + end + end + + @defs[name] = ObjectDef.new(:name => name, :info => info) + + end + end + end + + def construct_method(key) + method_definition = @defs[key] + object = get_object(method_definition.object) + method = object.method(method_definition.method) + + unless method_definition.attach.nil? + instance_var_name = "@__diy_#{method_definition.object}" + + method_definition.attach.each do |object_key| + get_object(object_key).instance_eval do + instance_variable_set(instance_var_name, object) + eval %|def #{key}(*args) + #{instance_var_name}.#{method_definition.method}(*args) + end| + end + end + end + + return method + rescue Exception => oops + build_and_raise_construction_error(key, oops) + end + + def construct_object(key) + # Find the object definition + obj_def = @defs[key] + raise "No object definition for '#{key}'" unless obj_def + # If object def mentions a library, load it + require obj_def.library if obj_def.library + + # Resolve all components for the object + arg_hash = {} + obj_def.components.each do |name,value| + case value + when Lookup + arg_hash[name.to_sym] = get_object(value.name) + when StringValue + arg_hash[name.to_sym] = value.literal_value + else + raise "Cannot cope with component definition '#{value.inspect}'" + end + end + # Get a reference to the class for the object + big_c = get_class_for_name_with_module_delimeters(obj_def.class_name) + # Make and return the instance + if obj_def.use_class_directly? + return big_c + elsif arg_hash.keys.size > 0 + return big_c.new(arg_hash) + else + return big_c.new + end + rescue Exception => oops + build_and_raise_construction_error(key, oops) + end + + def build_and_raise_construction_error(key, oops) + cerr = ConstructionError.new(key,oops) + cerr.set_backtrace(oops.backtrace) + raise cerr + end + + def get_class_for_name_with_module_delimeters(class_name) + class_name.split(/::/).inject(Object) do |mod,const_name| mod.const_get(const_name) end + end + + def extra_inputs_has(key) + if key.nil? or key.strip == '' + raise ArgumentError.new("Cannot lookup objects with nil keys") + end + @extra_inputs.keys.member?(key) or @extra_inputs.keys.member?(key.to_sym) + end + + def parse_namespace(str) + Namespace.new(str) + end + end + + class Namespace #:nodoc:# + def initialize(str) + # 'using_namespace Animal Reptile' + parts = str.split(/\s+/) + raise "Namespace definitions must begin with 'using_namespace'" unless parts[0] == 'using_namespace' + parts.shift + + if parts.length > 0 and parts[0] =~ /::/ + parts = parts[0].split(/::/) + end + + raise NamespaceError, "Namespace needs to indicate a module" if parts.empty? + + @module_nest = parts + end + + def build_classname(name) + [ @module_nest, Infl.camelize(name) ].flatten.join("::") + end + end + + class Lookup #:nodoc: + attr_reader :name + def initialize(obj_name) + @name = obj_name + end + end + + class MethodDef #:nodoc: + attr_accessor :name, :object, :method, :attach + + def initialize(opts) + @name, @object, @method, @attach = opts[:name], opts[:object], opts[:method], opts[:attach] + end + end + + class ObjectDef #:nodoc: + attr_accessor :name, :class_name, :library, :components + def initialize(opts) + name = opts[:name] + raise "Can't make an ObjectDef without a name" if name.nil? + + info = opts[:info] || {} + info = info.clone + + @components = {} + + # Object name + @name = name + + # Class name + @class_name = info.delete 'class' + @class_name ||= info.delete 'type' + @class_name ||= Infl.camelize(@name) + + # Auto Require + @auto_require = info.delete 'auto_require' + + # Library + @library = info.delete 'library' + @library ||= info.delete 'lib' + @library ||= Infl.underscore(@class_name) if @auto_require + + # Use Class Directly + @use_class_directly = info.delete 'use_class_directly' + + # Auto-compose + compose = info.delete 'compose' + if compose + case compose + when Array + auto_names = compose.map { |x| x.to_s } + when String + auto_names = compose.split(',').map { |x| x.to_s.strip } + when Symbol + auto_names = [ compose.to_s ] + else + raise "Cannot auto compose object #{@name}, bad 'compose' format: #{compose.inspect}" + end + end + auto_names ||= [] + auto_names.each do |cname| + @components[cname] = Lookup.new(cname) + end + + # Singleton status + if info['singleton'].nil? + @singleton = true + else + @singleton = info['singleton'] + end + info.delete 'singleton' + + # Remaining keys + info.each do |key,val| + @components[key.to_s] = Lookup.new(val.to_s) + end + + end + + def singleton? + @singleton + end + + def use_class_directly? + @use_class_directly == true + end + + end + + class ConstructionError < RuntimeError #:nodoc:# + def initialize(object_name, cause=nil) + object_name = object_name + cause = cause + m = "Failed to construct '#{object_name}'" + if cause + m << "\n ...caused by:\n >>> #{cause}" + end + super m + end + end + + class NamespaceError < RuntimeError #:nodoc:# + end + + module Infl #:nodoc:# + # Ganked this from Inflector: + def self.camelize(lower_case_and_underscored_word) + lower_case_and_underscored_word.to_s.gsub(/\/(.?)/) { "::" + $1.upcase }.gsub(/(^|_)(.)/) { $2.upcase } + end + # Ganked this from Inflector: + def self.underscore(camel_cased_word) + camel_cased_word.to_s.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z])/,'\1_\2').gsub(/([a-z\d])([A-Z])/,'\1_\2').downcase + end + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/lib/diy/factory.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/lib/diy/factory.rb new file mode 100644 index 0000000..d2566c5 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/lib/diy/factory.rb @@ -0,0 +1,36 @@ +module DIY #:nodoc:# + class FactoryDef #:nodoc: + attr_accessor :name, :target, :class_name, :library + + def initialize(opts) + @name, @target, @library, @auto_require = + opts[:name], opts[:target], opts[:library], opts[:auto_require] + + @class_name = Infl.camelize(@target) + @library ||= Infl.underscore(@class_name) if @auto_require + end + end + + class Context + def construct_factory(key) + factory_def = @defs[key] +# puts "requiring #{factory_def.library}" + require factory_def.library if factory_def.library + + big_c = get_class_for_name_with_module_delimeters(factory_def.class_name) + + FactoryFactory.new(big_c) + end + end + + class FactoryFactory + def initialize(clazz) + @class_to_create = clazz + end + + def create(*args) + @class_to_create.new(*args) + end + end +end + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/sample_code/car.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/sample_code/car.rb new file mode 100644 index 0000000..9a6a8ed --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/sample_code/car.rb @@ -0,0 +1,7 @@ +class Car + attr_reader :engine, :chassis + def initialize(arg_hash) + @engine = arg_hash[:engine] + @chassis = arg_hash[:chassis] + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/sample_code/chassis.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/sample_code/chassis.rb new file mode 100644 index 0000000..b745b0b --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/sample_code/chassis.rb @@ -0,0 +1,5 @@ +class Chassis + def to_s + "Chassis" + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/sample_code/diy_example.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/sample_code/diy_example.rb new file mode 100644 index 0000000..88d5b7e --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/sample_code/diy_example.rb @@ -0,0 +1,26 @@ +require "rubygems" +require "diy" + +class Car + attr_reader :engine, :chassis + def initialize(arg_hash) + @engine = arg_hash[:engine] + @chassis = arg_hash[:chassis] + end +end + +class Chassis + def to_s + "Chassis" + end +end + +class Engine + def to_s + "Engine" + end +end + +context = DIY::Context.from_file("objects.yml") +car = context['car'] +puts "Car is made of: #{car.engine} and #{car.chassis}" diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/sample_code/engine.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/sample_code/engine.rb new file mode 100644 index 0000000..65c2dd5 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/sample_code/engine.rb @@ -0,0 +1,5 @@ +class Engine + def to_s + "Engine" + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/sample_code/objects.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/sample_code/objects.yml new file mode 100644 index 0000000..6deb100 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/sample_code/objects.yml @@ -0,0 +1,10 @@ +--- +car: + compose: + - engine + - chassis + +engine: + +chassis: + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/constructor.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/constructor.rb new file mode 100644 index 0000000..5fe8f3a --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/constructor.rb @@ -0,0 +1,119 @@ +CONSTRUCTOR_VERSION = '1.0.2' #:nodoc:# + +class Class #:nodoc:# + def constructor(*attrs, &block) + call_block = '' + if block_given? + @constructor_block = block + call_block = 'self.instance_eval(&self.class.constructor_block)' + end + # Look for embedded options in the listing: + opts = attrs.find { |a| a.kind_of?(Hash) and attrs.delete(a) } + do_acc = opts.nil? ? false : opts[:accessors] == true + require_args = opts.nil? ? true : opts[:strict] != false + super_args = opts.nil? ? nil : opts[:super] + + # Incorporate superclass's constructor keys, if our superclass + if superclass.constructor_keys + similar_keys = superclass.constructor_keys & attrs + raise "Base class already has keys #{similar_keys.inspect}" unless similar_keys.empty? + attrs = [attrs,superclass.constructor_keys].flatten + end + # Generate ivar assigner code lines + assigns = '' + attrs.each do |k| + assigns += "@#{k.to_s} = args[:#{k.to_s}]\n" + end + + # If accessors option is on, declare accessors for the attributes: + if do_acc + self.class_eval "attr_accessor " + attrs.map {|x| ":#{x.to_s}"}.join(',') + end + + # If user supplied super-constructor hints: + super_call = '' + if super_args + list = super_args.map do |a| + case a + when String + %|"#{a}"| + when Symbol + %|:#{a}| + end + end + super_call = %|super(#{list.join(',')})| + end + + # If strict is on, define the constructor argument validator method, + # and setup the initializer to invoke the validator method. + # Otherwise, insert lax code into the initializer. + validation_code = "return if args.nil?" + if require_args + self.class_eval do + def _validate_constructor_args(args) + # First, make sure we've got args of some kind + unless args and args.keys and args.keys.size > 0 + raise ConstructorArgumentError.new(self.class.constructor_keys) + end + # Scan for missing keys in the argument hash + a_keys = args.keys + missing = [] + self.class.constructor_keys.each do |ck| + unless a_keys.member?(ck) + missing << ck + end + a_keys.delete(ck) # Delete inbound keys as we address them + end + if missing.size > 0 || a_keys.size > 0 + raise ConstructorArgumentError.new(missing,a_keys) + end + end + end + # Setup the code to insert into the initializer: + validation_code = "_validate_constructor_args args " + end + + # Generate the initializer code + self.class_eval %{ + def initialize(args=nil) + #{super_call} + #{validation_code} + #{assigns} + setup if respond_to?(:setup) + #{call_block} + end + } + + # Remember our constructor keys + @_ctor_keys = attrs + end + + # Access the constructor keys for this class + def constructor_keys; @_ctor_keys ||=[]; end + + def constructor_block #:nodoc:# + @constructor_block + end + +end + +# Fancy validation exception, based on missing and extraneous keys. +class ConstructorArgumentError < RuntimeError #:nodoc:# + def initialize(missing,rejected=[]) + err_msg = '' + if missing.size > 0 + err_msg = "Missing constructor args [#{missing.join(',')}]" + end + if rejected.size > 0 + # Some inbound keys were not addressed earlier; this means they're unwanted + if err_msg + err_msg << "; " # Appending to earlier message about missing items + else + err_msg = '' + end + # Enumerate the rejected key names + err_msg << "Rejected constructor args [#{rejected.join(',')}]" + end + super err_msg + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/diy_test.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/diy_test.rb new file mode 100644 index 0000000..3540200 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/diy_test.rb @@ -0,0 +1,608 @@ +require File.dirname(__FILE__) + "/test_helper" +require 'diy' +require 'fileutils' +include FileUtils + +class DIYTest < Test::Unit::TestCase + + def setup + # Add load paths: + %w|gnu dog cat yak donkey goat horse fud non_singleton namespace functions|.each do |p| + libdir = path_to_test_file(p) + $: << libdir unless $:.member?(libdir) + end + DIY::Context.auto_require = true # Restore default + end + + + # + # TESTS + # + + def test_essential_use_case + load_context "dog/simple.yml" + + # Check object defs + check_dog_objects @diy + + # Tweak the load-path + $: << path_to_test_file("dog") + + # Get the objects, use reference comparison to check composition + presenter = @diy.get_object('dog_presenter') + assert_not_nil presenter, 'nil dog_presenter' + + model = @diy.get_object('dog_model') + assert_not_nil model, 'nil dog_model' + assert_same presenter.model, model, "Different model came from context than found in presenter" + + view = @diy.get_object('dog_view') + assert_not_nil view, 'nil dog_view' + assert_same presenter.view, view, "Different view came from context than found in presenter" + + resolver = @diy.get_object('file_resolver') + assert_not_nil resolver, 'nil file_resolver' + assert_same model.file_resolver, resolver, "File resolver in model is different than one in context" + + # Check repeat access: + assert_same model, @diy.get_object('dog_model'), "Second access of model yielded different result" + assert_same view, @diy.get_object('dog_view'), "Second access of view yielded different result" + assert_same presenter, @diy.get_object('dog_presenter'), "Second access of presenter got difrnt result" + end + + def test_classname_inside_a_module + load_hash 'thinger' => {'class' => "DiyTesting::Bar::Foo", 'lib' => 'foo'} + @diy.build_everything + assert_not_nil @diy['thinger'], "Should have got my thinger (which is hiding in a couple modules)" + end + + def test_classname_inside_a_module_loads_from_directories_named_after_the_underscored_module_names + load_hash 'thinger' => {'class' => "Foo::Bar::Qux"} + # expect it to be loaded from: foo/bar/qux.rb + @diy.build_everything + assert_not_nil @diy['thinger'], "Should have got my thinger (which is hiding in a couple modules)" + end + + def test_use_class_directly + load_hash 'thinger' => {'class' => "DiyTesting::Bar::Foo", 'lib' => 'foo', 'use_class_directly' => true} + @diy.build_everything + assert_equal DiyTesting::Bar::Foo, @diy['thinger'], "Should be the class 'object'" + end + + def test_classname_inside_a_module_derives_the_namespaced_classname_from_the_underscored_object_def_key + load_hash 'foo/bar/qux' => nil + @diy.build_everything + assert_not_nil @diy['foo/bar/qux'], "Should have got my qux (which is hiding in a couple modules)" + end + + def test_keys + load_context "dog/simple.yml" + assert_equal %w|dog_model dog_presenter dog_view file_resolver other_thing|, @diy.keys.sort + end + + def test_subcontext_keys_should_include_parent_context_keys + load_context 'yak/sub_sub_context_test.yml' + main_keys = %w|core_presenter core_model core_view data_source|.sort + assert_equal main_keys, @diy.keys.sort, "Wrong keys in main context" + @diy.within :fringe_context do |fcontext| + fringe_keys = [main_keys, %w|fringe_model fringe_view fringe_presenter|].flatten.sort + assert_equal fringe_keys, fcontext.keys.sort, "Wrong keys in fringe context" + fcontext.within :deep_context do |dcontext| + deep_keys = [fringe_keys, %w|krill giant_squid|].flatten.sort + assert_equal deep_keys, dcontext.keys.sort + end + end + end + + def test_constructor_no_hash + assert_raise RuntimeError do DIY::Context.new(nil) end + end + + def test_constructor_bad_extra_inputs + err = assert_raise RuntimeError do + DIY::Context.new({}, Object.new) + end + assert_match(/extra inputs/i, err.message) + end + + def test_from_yaml + text = File.read(path_to_test_file("dog/simple.yml")) + diy = DIY::Context.from_yaml(text) + check_dog_objects diy + end + + def test_from_yaml_extra_inputs + extra = { 'the_cat_lineage' => 'siamese', :some_meat => 'horse' } + diy = DIY::Context.from_yaml(File.read(path_to_test_file('cat/needs_input.yml')), extra) + cat = diy['cat'] + assert_equal 'siamese', cat.heritage + assert_equal 'horse', cat.food + end + + def test_from_file + diy = DIY::Context.from_file(path_to_test_file("dog/simple.yml")) + check_dog_objects diy + end + + def test_from_file_bad + assert_raise RuntimeError do + DIY::Context.from_file(nil) + end + assert_raise Errno::ENOENT do + DIY::Context.from_file("bad file name") + end + end + + def test_from_file_extra_inputs + extra = { 'the_cat_lineage' => 'siamese', :some_meat => 'horse' } + diy = DIY::Context.from_file(path_to_test_file('cat/needs_input.yml'), extra) + cat = diy['cat'] + assert_equal 'siamese', cat.heritage + assert_equal 'horse', cat.food + end + + def test_contains_object + load_context "dog/simple.yml" + assert @diy.contains_object('dog_presenter'), "Should be true for dog_presenter" + assert !@diy.contains_object('woops'), "Should return false for 'woops'" + err = assert_raise ArgumentError do + @diy.contains_object(nil) + end + end + + def test_contains_object_extra_inputs + extra = { 'the_cat_lineage' => 'siamese', :some_meat => 'horse' } + main = YAML.load(File.read(path_to_test_file('cat/needs_input.yml'))) + diy = DIY::Context.new(main, extra) + + assert diy.contains_object('cat') + assert diy.contains_object('the_cat_lineage') + assert diy.contains_object('some_meat') + end + + def test_get_object + load_context "dog/simple.yml" + assert_not_nil @diy.get_object('file_resolver'), "nil resolver?" + assert_raise ArgumentError do + @diy.get_object(nil) + end + assert_raise DIY::ConstructionError do + @diy.get_object("no such object") + end + end + + def test_hash_style_access + load_context "dog/simple.yml" + assert_not_nil @diy['file_resolver'], "nil resolver?" + assert_raise ArgumentError do + @diy[nil] + end + assert_raise DIY::ConstructionError do + @diy["no such object"] + end + end + + def test_get_object_construction_error + load_context "broken_construction.yml" + err = assert_raise DIY::ConstructionError do + @diy.get_object 'dog_presenter' + end + assert_match(/dog_presenter/, err.message) + end + + def test_context_with_extra_inputs + extra = { 'the_cat_lineage' => 'siamese', :some_meat => 'horse' } + main = YAML.load(File.read(path_to_test_file('cat/needs_input.yml'))) + diy = DIY::Context.new(main, extra) + cat = diy['cat'] + assert_equal 'siamese', cat.heritage + assert_equal 'horse', cat.food + end + + def test_conflicting_extra_inputs + extra = { 'the_cat_lineage' => 'siamese', :some_meat => 'horse' } + main = YAML.load(File.read(path_to_test_file('cat/extra_conflict.yml'))) + + DIY::Context.new(main,extra) + flunk "Should have raised err" + rescue Exception => err + assert_match(/conflict/i, err.message) + end + + def test_sub_context + load_context 'yak/my_objects.yml' + + core_model = @diy['core_model'] + assert_not_nil core_model, "no core model in main context?" + + fmodel1 = nil + fview1 = nil + @diy.within('fringe_context') do |fc| + assert_not_nil fc["fringe_presenter"], "no fringe presenter" + fmodel1 = fc["fringe_model"] + fmodel1a = fc["fringe_model"] + assert_same fmodel1, fmodel1a, "Second fring model in fringe_context came out different" + assert_not_nil fmodel1, "no fringe_model" + fview1 = fc["fringe_view"] + assert_not_nil fview1, "no fringe_view" + assert_same core_model, fmodel1.connected + end + + fmodel2 = nil + fview2 = nil + @diy.within('fringe_context') do |fc| + assert_not_nil fc["fringe_presenter"], "2: no fringe presenter" + fmodel2 = fc["fringe_model"] + fmodel2a = fc["fringe_model"] + assert_same fmodel2, fmodel2a, "Second fringe model in fringe_context came out different" + assert_not_nil fmodel2, "2: no fringe_model" + fview2 = fc["fringe_view"] + assert_not_nil fview2, "2: no fringe_view" + assert_same core_model, fmodel2.connected + + assert fmodel1.object_id != fmodel2.object_id, "fringe models 1 and 2 are same!" + assert fview1.object_id != fview2.object_id, "fringe views 1 and 2 are same!" + end + end + + def test_sub_sub_context + load_context 'yak/sub_sub_context_test.yml' + + core_model = @diy['core_model'] + assert_not_nil core_model, "no core model in main context?" + + fmodel1 = nil + fview1 = nil + @diy.within('fringe_context') do |fc| + assert_not_nil fc["fringe_presenter"], "no fringe presenter" + fmodel1 = fc["fringe_model"] + fmodel1a = fc["fringe_model"] + assert_same fmodel1, fmodel1a, "Second fring model in fringe_context came out different" + assert_not_nil fmodel1, "no fringe_model" + fview1 = fc["fringe_view"] + assert_not_nil fview1, "no fringe_view" + assert_same core_model, fmodel1.connected + + fc.within :deep_context do |dc| + krill = dc['krill'] + assert_not_nil krill, "nil krill" + assert_same krill, dc['krill'], "krill was different second time" + giant_squid = dc['giant_squid'] + assert_same fview1, giant_squid.fringe_view, "wrong view in squid" + assert_same core_model, giant_squid.core_model, "wrong model in squid" + assert_same krill, giant_squid.krill, "wrong krill in squid" + end + end + + end + + def test_build_everything + # Singletons in the goat context will generate test output in their constructors. + # We just gotta tell em where: + ofile = path_to_test_file('goat/output.tmp') + $goat_test_output_file = ofile + + # Reusable setup for this test + prep_output = proc do + remove ofile if File.exist?(ofile) + end + + # Reusable assertion set and cleanup + examine_output = proc do + # Examine output file for expected construction + assert File.exist?(ofile), "no goat output created" + lines = File.readlines(ofile).map { |x| x.strip } + %w|can paper shirt goat|.each do |object| + assert lines.member?("#{object} built"), "Didn't see constructor output for #{object}" + end + assert_equal 4, lines.size, "wrong number of entries in output file" + + # Make sure the subcontext was not built + assert !lines.member?("plane built"), "plane should not have been built -- it's in the subcontext" + assert !lines.member?("wings built"), "wings should not have been built -- it's in the subcontext" + + # Check the objects in the context + %w|can paper shirt goat|.each do |object| + assert_same @diy[object], @diy[object], "Multiple accesses on #{object} yielded different refs" + end + + # Try the subcontext + @diy.within('the_sub_context') do |tsc| + %w|plane wings|.each do |object| + assert_same tsc[object], tsc[object], "Multiple accesses on #{object} (in subcontext) yielded different refs" + end + end + # cleanup + remove ofile if File.exist?(ofile) + end + + # Test all three methods + [:build_everything, :build_all, :preinstantiate_singletons].each do |method_name| + prep_output.call + load_context 'goat/objects.yml' + # go + @diy.send method_name + examine_output.call + end + ensure + # cleanup + remove ofile if File.exist?(ofile) + end + + # See that the current object factory context can be referenced within the yaml + def test_this_context + load_context 'horse/objects.yml' + + assert_same @diy, @diy['this_context'], "basic self-reference failed" + assert_same @diy, @diy['holder_thing'].thing_held, "composition self-reference failed" + end + + def test_this_context_works_for_subcontexts + load_context 'horse/objects.yml' + + @diy.within('repeater') do |ctx| + assert_same ctx, ctx['this_context'], "self-ref inside a subcontext doesn't work" + end + end + + def test_multiple_classes_in_one_file + load_context 'fud/objects.yml' + + toy = @diy['toy'] + widget = @diy['widget'] + thing = @diy['thing_ama_jack'] + trinket = @diy['trinket'] + + assert_same widget, toy.widget, "wrong widget in toy" + assert_same trinket, toy.trinket, "wrong trinket in toy" + assert_same thing, trinket.thing_ama_jack, "wrong thing_ama_jack in trinket" + end + + def test_objects_can_be_set_in_a_context_and_diy_will_not_attempt_to_build_it_as_a_dependency + load_context 'gnu/objects.yml' + + injected = 'boom' + @diy[:injected] = injected + thinger = @diy[:thinger] + assert_not_nil thinger + assert_same injected, thinger.injected + assert_same injected, @diy[:injected] + + inner_injected = 'slam' + @diy.within :inny do |sub| + sub.set_object :inner_injected, inner_injected + inner_thinger = sub[:inner_thinger] + assert_not_nil inner_thinger + assert_same inner_injected, inner_thinger.injected + assert_same inner_injected, sub[:inner_injected] + end + end + + def test_should_not_allow_setting_of_an_object_which_has_already_been_loaded + load_context 'gnu/objects.yml' + + injected = 'boom' + @diy[:injected] = injected + err = assert_raise RuntimeError do + @diy[:injected] = injected + end + assert_match(/object 'injected' already exists/i, err.message) + assert_same injected, @diy[:injected] + + thinger = @diy[:thinger] + err = assert_raise RuntimeError do + @diy[:thinger] = 'sdf' + end + assert_match(/object 'thinger' already exists/i, err.message) + assert_same thinger, @diy[:thinger] + end + + def test_should_be_able_to_turn_off_auto_require_for_all_objects + DIY::Context.auto_require = false + load_context 'horse/objects.yml' + + exception = assert_raise(DIY::ConstructionError) { @diy['holder_thing'] } + assert_match(/uninitialized constant/, exception.message) + end + + def test_should_cause_non_singletons_to_be_rebuilt_every_time_they_are_accessed + load_context 'non_singleton/objects.yml' + + air = @diy['air'] + assert_not_nil air, "No air" + assert_same air, @diy['air'], "Air should be a singleton" + + yard = @diy['yard'] + assert_not_nil yard, "No yard" + assert_same yard, @diy['yard'], "yard should be a singleton" + + pig = @diy['pig'] + assert_not_nil pig, "No pig" + assert_same pig, @diy['pig'], "Pig should be a singleton" + + thread_spinner1 = @diy['thread_spinner'] + assert_not_nil thread_spinner1, "Couldn't get thread spinner" + thread_spinner2 = @diy['thread_spinner'] + assert_not_nil thread_spinner2, "Couldn't get second thread spinner" + assert thread_spinner1.object_id != thread_spinner2.object_id, "Thread spinners should be different instances" + thread_spinner3 = pig.thread_spinner + assert_not_nil thread_spinner3, "Didn't get a spinner from the pig" + assert thread_spinner2.object_id != thread_spinner3.object_id, "Thread spinner from pig should be different instance than the others" + assert thread_spinner1.object_id != thread_spinner3.object_id, "Thread spinner from pig should be different instance than the others" + + assert_same air, thread_spinner1.air, "spinner 1 air should be singleton reference" + assert_same air, thread_spinner2.air, "spinner 2 air should be singleton reference" + assert_same air, thread_spinner3.air, "spinner 3 air should be singleton reference" + end + + def test_should_handle_nonsingletons_in_sub_contexts + load_context 'non_singleton/objects.yml' + + yard = @diy['yard'] + assert_not_nil yard, "No yard" + assert_same yard, @diy['yard'], "yard should be a singleton" + + thread_spinner1 = @diy['thread_spinner'] + assert_not_nil thread_spinner1, "Couldn't get thread spinner" + + air = @diy['air'] + assert_not_nil air, "No air" + assert_same air, @diy['air'], "Air should be a singleton" + + @diy.within :inner_sanctum do |sanct| + tick1 = sanct['tick'] + assert_not_nil tick1, "Couldn't get tick1 from inner sanctum" + tick2 = sanct['tick'] + assert_not_nil tick2, "Couldn't get tick2 from inner sanctum" + assert tick1.object_id != tick2.object_id, "Tick should not be a singleton" + + cat = sanct['fat_cat'] + assert_not_nil cat, "Couldn't get cat from sanctum" + assert_same cat, sanct['fat_cat'], "Cat SHOULD be singleton" + + tick3 = cat.tick + assert_not_nil tick3, "Couldn't get tick from cat" + assert tick1.object_id != tick3.object_id, "tick from cat matched an earlier tick; should not be so" + + assert_same yard, cat.yard, "Cat's yard should be same as other yard" + assert_not_nil cat.thread_spinner, "No thread spinner in cat?" + + assert_same air, cat.thread_spinner.air, "spinner 1 air should be singleton reference" + assert thread_spinner1.object_id != cat.thread_spinner.object_id, "cat's thread spinner matched the other spinner; should not be so" + end + end + + def test_should_provide_syntax_for_using_namespace + # This test exercises single and triple-level namespaces for nested + # modules, and their interaction with other namespaced-objects. + load_context "namespace/objects.yml" + + %w{road sky cat bird lizard turtle}.each do |obj| + assert @diy.contains_object(obj), "Context had no object '#{obj}'" + end + + road = @diy['road'] + sky = @diy['sky'] + cat = @diy['cat'] + bird = @diy['bird'] + lizard = @diy['lizard'] + turtle = @diy['turtle'] + + assert_same road, cat.road, "Cat has wrong Road" + assert_same sky, bird.sky, "Bird has wrong Sky" + assert_same bird, lizard.bird, "Lizard has wrong Bird" + end + + def test_should_combine_a_given_class_name_with_the_namespace + load_context "namespace/class_name_combine.yml" + assert_not_nil @diy['garfield'], "No garfield" + assert_kind_of Animal::Cat, @diy['garfield'], "Garfield wrong" + end + + def test_should_let_you_use_namespaces_in_subcontexts + load_context "namespace/subcontext.yml" + @diy.build_everything + %w{road sky cat turtle}.each do |obj| + assert @diy.contains_object(obj), "Main context had no object '#{obj}'" + end + sky = @diy['sky'] + + @diy.within("aviary") do |subc| + assert subc.contains_object("bird"), "Sub context didn't have 'bird'" + assert subc.contains_object("lizard"), "Sub context didn't have 'lizard'" + bird = subc['bird'] + lizard = subc['lizard'] + assert_same sky, bird.sky, "Bird has wrong Sky" + assert_same bird, lizard.bird, "Lizard has wrong Bird" + end + end + + def test_should_raise_for_namespace_w_no_modules_named + ex = assert_raises DIY::NamespaceError do + load_context "namespace/no_module_specified.yml" + end + assert_equal "Namespace needs to indicate a module", ex.message + end + + def test_should_raise_for_namespace_whose_modules_dont_exist + load_context "namespace/bad_module_specified.yml" + ex = assert_raises DIY::ConstructionError do + @diy['bird'] + end + assert_match(/failed to construct/i, ex.message) + assert_match(/no such file to load -- fuzzy_creature\/bird/, ex.message) + end + + def test_should_be_able_define_and_access_bounded_methods + load_context "functions/objects.yml" + @diy.build_everything + build_thing = @diy['build_thing'] + + assert_not_nil build_thing, "should not be nil" + assert_kind_of(Method, build_thing) + assert_equal(build_thing, @diy['build_thing']) + end + + def test_bounded_method_can_be_used + load_context "functions/objects.yml" + @diy.build_everything + build_thing = @diy['build_thing'] + + thing = build_thing["the name", "flying"] + + assert_equal("the name", thing.name) + assert_equal("flying", thing.ability) + end + + def test_building_bounded_method_uses_object_in_diy_context_correctly + load_context "functions/objects.yml" + @diy.build_everything + assert_equal(@diy['build_thing'], @diy['thing_builder'].method(:build)) + + load_context "functions/nonsingleton_objects.yml" + @diy.build_everything + assert_not_equal(@diy['build_thing'], @diy['thing_builder'].method(:build)) + end + + def test_composing_bounded_methods_into_other_objects + load_context "functions/objects.yml" + @diy.build_everything + assert_equal(@diy['build_thing'], @diy['things_builder'].build_thing) + end + + def test_raises_construction_error_if_invalid_method_specified + load_context "functions/invalid_method.yml" + assert_raises DIY::ConstructionError do + @diy.build_everything + end + end + + def test_can_optionally_attach_method_to_other_objects_in_context + load_context "functions/objects.yml" + @diy.build_everything + + thing = @diy['attached_things_builder'].build_thing("the name", "flying") + assert_kind_of(Thing, thing) + assert_equal("the name", thing.name) + assert_equal("flying", thing.ability) + + ["attached_things_builder", "things_builder"].each do |key| + thing = @diy[key].build_default_thing + assert_kind_of(Thing, thing) + assert_equal("Thing", thing.name) + assert_equal("nothing", thing.ability) + end + end + + # + # HELPERS + # + def check_dog_objects(context) + assert_not_nil context, "nil context" + names = %w|dog_presenter dog_model dog_view file_resolver| + names.each do |n| + assert context.contains_object(n), "Context had no object '#{n}'" + end + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/factory_test.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/factory_test.rb new file mode 100644 index 0000000..ed02f01 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/factory_test.rb @@ -0,0 +1,79 @@ +require File.dirname(__FILE__) + "/test_helper" +require 'diy' +require 'fileutils' +include FileUtils + +class FactoryTest < Test::Unit::TestCase + + def setup + # Add load paths: + %w|factory|.each do |p| + libdir = path_to_test_file(p) + $: << libdir unless $:.member?(libdir) + end + DIY::Context.auto_require = true # Restore default + end + + + # + # TESTS + # + + def test_creates_factory + load_context "factory/factory.yml" + + cat_factory = @diy.get_object(:cat_factory) + assert_not_nil cat_factory + + cat = cat_factory.create('a', 'b') + + assert cat.is_a?(Kitten) + assert_equal "meow", cat.meow + assert_equal 'a', cat.a + assert_equal 'b', cat.b + end + + def test_creates_factory_with_autorequire + load_context "factory/factory.yml" + + dog_factory = @diy.get_object(:dog_factory) + assert_not_nil dog_factory + + dog = dog_factory.create + + assert dog.is_a?(Dog) + assert_equal "woof", dog.woof + end + + def test_creates_factory_with_subcontext + load_context "factory/factory.yml" + + @diy.within :inny do |context| + bull_factory = context.get_object(:bull_factory) + beef = bull_factory.create + end + end + + def test_creates_factory_with_subcontext_and_namespace + load_context "factory/factory.yml" + + @diy.within :congress do |context| + politician = context.get_object(:politician) + pork = politician.create + assert pork.is_a?(Farm::Pork) + assert_equal "money!", pork.oink + end + end + + def test_creates_factory_with_namespace + load_context "factory/factory.yml" + + llama_factory = @diy.get_object(:llama_factory) + assert_not_nil llama_factory + + llama = llama_factory.create + + assert llama.is_a?(Farm::Llama) + assert_equal "?", llama.make_llama_noise + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/broken_construction.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/broken_construction.yml new file mode 100644 index 0000000..1dacb01 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/broken_construction.yml @@ -0,0 +1,7 @@ + +dog_presenter: + model: dog_model + view: dog_view + +dog_model: +# VIEW IS MISSING, PRESENTER SHOULD CRASH diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/cat/cat.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/cat/cat.rb new file mode 100644 index 0000000..2d17514 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/cat/cat.rb @@ -0,0 +1,3 @@ +class Cat + constructor :heritage, :food, :strict => true, :accessors => true +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/cat/extra_conflict.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/cat/extra_conflict.yml new file mode 100644 index 0000000..9c6b375 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/cat/extra_conflict.yml @@ -0,0 +1,5 @@ +the_cat_lineage: + +cat: + heritage: the_cat_lineage + food: some_meat diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/cat/heritage.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/cat/heritage.rb new file mode 100644 index 0000000..617d47a --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/cat/heritage.rb @@ -0,0 +1,2 @@ +class Heritage +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/cat/needs_input.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/cat/needs_input.yml new file mode 100644 index 0000000..9f622f2 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/cat/needs_input.yml @@ -0,0 +1,3 @@ +cat: + heritage: the_cat_lineage + food: some_meat diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/cat/the_cat_lineage.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/cat/the_cat_lineage.rb new file mode 100644 index 0000000..b0f4308 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/cat/the_cat_lineage.rb @@ -0,0 +1 @@ +class TheCatLineage; end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/dog/dog_model.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/dog/dog_model.rb new file mode 100644 index 0000000..51e7df0 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/dog/dog_model.rb @@ -0,0 +1,3 @@ +class DogModel + constructor :file_resolver, :other_thing, :strict => true, :accessors => true +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/dog/dog_presenter.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/dog/dog_presenter.rb new file mode 100644 index 0000000..786977d --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/dog/dog_presenter.rb @@ -0,0 +1,3 @@ +class DogPresenter + constructor :model, :view, :strict => true, :accessors => true +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/dog/dog_view.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/dog/dog_view.rb new file mode 100644 index 0000000..aae86bc --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/dog/dog_view.rb @@ -0,0 +1,2 @@ +class DogView +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/dog/file_resolver.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/dog/file_resolver.rb new file mode 100644 index 0000000..09cf18a --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/dog/file_resolver.rb @@ -0,0 +1,2 @@ +class FileResolver +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/dog/other_thing.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/dog/other_thing.rb new file mode 100644 index 0000000..48e6a95 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/dog/other_thing.rb @@ -0,0 +1,2 @@ +class OtherThing +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/dog/simple.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/dog/simple.yml new file mode 100644 index 0000000..7737236 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/dog/simple.yml @@ -0,0 +1,11 @@ +dog_presenter: + model: dog_model + view: dog_view + +file_resolver: +other_thing: + +dog_model: + compose: file_resolver, other_thing + +dog_view: diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/donkey/foo.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/donkey/foo.rb new file mode 100644 index 0000000..5182cf3 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/donkey/foo.rb @@ -0,0 +1,8 @@ + +module DiyTesting + module Bar + class Foo + end + end +end + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/donkey/foo/bar/qux.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/donkey/foo/bar/qux.rb new file mode 100644 index 0000000..bb05a02 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/donkey/foo/bar/qux.rb @@ -0,0 +1,7 @@ + +module Foo + module Bar + class Qux + end + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/factory/beef.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/factory/beef.rb new file mode 100644 index 0000000..2cd31a0 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/factory/beef.rb @@ -0,0 +1,5 @@ +class Beef + def cook + return "rare" + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/factory/dog.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/factory/dog.rb new file mode 100644 index 0000000..06b9daf --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/factory/dog.rb @@ -0,0 +1,6 @@ +class Dog + def woof + "woof" + end +end + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/factory/factory.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/factory/factory.yml new file mode 100644 index 0000000..8264d37 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/factory/factory.yml @@ -0,0 +1,19 @@ +cat_factory: + builds: kitten + library: kitten + +dog_factory: + builds: dog + +using_namespace Farm: + llama_factory: + builds: llama + ++inny: + bull_factory: + builds: beef + ++congress: + using_namespace Farm: + politician: + builds: pork diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/factory/farm/llama.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/factory/farm/llama.rb new file mode 100644 index 0000000..40e9fa2 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/factory/farm/llama.rb @@ -0,0 +1,7 @@ +module Farm + class Llama + def make_llama_noise + "?" + end + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/factory/farm/pork.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/factory/farm/pork.rb new file mode 100644 index 0000000..a5aa4e5 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/factory/farm/pork.rb @@ -0,0 +1,7 @@ +module Farm + class Pork + def oink + "money!" + end + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/factory/kitten.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/factory/kitten.rb new file mode 100644 index 0000000..f27a3ef --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/factory/kitten.rb @@ -0,0 +1,13 @@ +class Kitten + attr_accessor :a,:b + + def initialize(a, b) + @a = a + @b = b + end + + def meow + "meow" + end +end + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/fud/objects.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/fud/objects.yml new file mode 100644 index 0000000..1a152b9 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/fud/objects.yml @@ -0,0 +1,13 @@ +widget: + lib: toy + +trinket: + lib: toy + compose: thing_ama_jack + +thing_ama_jack: + lib: toy + +toy: + lib: toy + compose: widget, trinket diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/fud/toy.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/fud/toy.rb new file mode 100644 index 0000000..937b71d --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/fud/toy.rb @@ -0,0 +1,14 @@ + +class Toy + constructor :widget, :trinket, :accessors => true, :strict => true +end + +class Widget +end + +class ThingAmaJack +end + +class Trinket + constructor :thing_ama_jack, :accessors => true, :strict => true +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/functions/attached_things_builder.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/functions/attached_things_builder.rb new file mode 100644 index 0000000..f67888a --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/functions/attached_things_builder.rb @@ -0,0 +1,2 @@ +class AttachedThingsBuilder +end \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/functions/invalid_method.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/functions/invalid_method.yml new file mode 100644 index 0000000..96690c3 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/functions/invalid_method.yml @@ -0,0 +1,5 @@ +thing_builder: + +method build_thing: + object: thing_builder + method: no_exist \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/functions/method_extractor.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/functions/method_extractor.rb new file mode 100644 index 0000000..55daf46 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/functions/method_extractor.rb @@ -0,0 +1,3 @@ +class MethodExtractor + +end \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/functions/nonsingleton_objects.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/functions/nonsingleton_objects.yml new file mode 100644 index 0000000..39b6fd6 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/functions/nonsingleton_objects.yml @@ -0,0 +1,6 @@ +thing_builder: + singleton: false + +method build_thing: + object: thing_builder + method: build \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/functions/objects.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/functions/objects.yml new file mode 100644 index 0000000..4d0a05a --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/functions/objects.yml @@ -0,0 +1,22 @@ +thing_builder: + +method_extractor: + +attached_things_builder: + +method build_thing: + object: thing_builder + method: build + attach: + - attached_things_builder + +method build_default_thing: + object: thing_builder + method: build_default + attach: + - attached_things_builder + - things_builder + +things_builder: + compose: + - build_thing \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/functions/thing.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/functions/thing.rb new file mode 100644 index 0000000..4bc652d --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/functions/thing.rb @@ -0,0 +1,3 @@ +class Thing + constructor :name, :ability, :accessors => true +end \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/functions/thing_builder.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/functions/thing_builder.rb new file mode 100644 index 0000000..288bab4 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/functions/thing_builder.rb @@ -0,0 +1,25 @@ +require 'thing' + +class ThingBuilder + @@builder_count = 0 + + def self.reset_builder_count + @@builder_count = 0 + end + + def self.builder_count + @@builder_count + end + + def initialize + @@builder_count += 1 + end + + def build(name, ability) + Thing.new(:name => name, :ability => ability) + end + + def build_default + Thing.new(:name => "Thing", :ability => "nothing") + end +end \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/functions/things_builder.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/functions/things_builder.rb new file mode 100644 index 0000000..198c85a --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/functions/things_builder.rb @@ -0,0 +1,3 @@ +class ThingsBuilder + constructor :build_thing, :accessors => true +end \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/gnu/objects.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/gnu/objects.yml new file mode 100644 index 0000000..39581ef --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/gnu/objects.yml @@ -0,0 +1,14 @@ + +injected: + +thinger: + compose: injected + ++inny: + inner_injected: + + inner_thinger: + injected: inner_injected + lib: thinger + class: Thinger + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/gnu/thinger.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/gnu/thinger.rb new file mode 100644 index 0000000..1d332f6 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/gnu/thinger.rb @@ -0,0 +1,7 @@ + + +class Thinger + constructor :injected + attr_reader :injected +end + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/goat/base.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/goat/base.rb new file mode 100644 index 0000000..a4f5d0e --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/goat/base.rb @@ -0,0 +1,8 @@ +class Base + def test_output(name) + # See diy_context_test.rb + File.open($goat_test_output_file, "a") do |f| + f.puts "#{name} built" + end + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/goat/can.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/goat/can.rb new file mode 100644 index 0000000..0bd1eeb --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/goat/can.rb @@ -0,0 +1,6 @@ +require 'base' +class Can < Base + def initialize + test_output "can" + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/goat/goat.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/goat/goat.rb new file mode 100644 index 0000000..ad084d3 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/goat/goat.rb @@ -0,0 +1,6 @@ +require 'base' +class Goat < Base + def initialize + test_output "goat" + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/goat/objects.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/goat/objects.yml new file mode 100644 index 0000000..a31123e --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/goat/objects.yml @@ -0,0 +1,12 @@ +can: + +paper: + +shirt: + +goat: + ++the_sub_context: + plane: + compose: wings + wings: diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/goat/paper.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/goat/paper.rb new file mode 100644 index 0000000..2068e41 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/goat/paper.rb @@ -0,0 +1,6 @@ +require 'base' +class Paper < Base + def initialize + test_output "paper" + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/goat/plane.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/goat/plane.rb new file mode 100644 index 0000000..712e904 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/goat/plane.rb @@ -0,0 +1,7 @@ +require 'base' +class Plane < Base + constructor :wings, :strict => true + def setup + test_output "plane" + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/goat/shirt.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/goat/shirt.rb new file mode 100644 index 0000000..7b28bec --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/goat/shirt.rb @@ -0,0 +1,6 @@ +require 'base' +class Shirt < Base + def initialize + test_output "shirt" + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/goat/wings.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/goat/wings.rb new file mode 100644 index 0000000..dc0e70c --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/goat/wings.rb @@ -0,0 +1,8 @@ +require 'base' +class Wings < Base + def initialize + test_output "wings" + end + def stay_on; end + def fall_off; end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/horse/holder_thing.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/horse/holder_thing.rb new file mode 100644 index 0000000..5480216 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/horse/holder_thing.rb @@ -0,0 +1,3 @@ +class HolderThing + constructor :thing_held, :strict => true, :accessors => true +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/horse/objects.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/horse/objects.yml new file mode 100644 index 0000000..54a0e9c --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/horse/objects.yml @@ -0,0 +1,7 @@ +holder_thing: + thing_held: this_context + ++repeater: + other_thing: + class: HolderThing + thing_held: this_context diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/namespace/animal/bird.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/namespace/animal/bird.rb new file mode 100644 index 0000000..27be474 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/namespace/animal/bird.rb @@ -0,0 +1,5 @@ +module Animal + class Bird + constructor :sky, :accessors => true + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/namespace/animal/cat.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/namespace/animal/cat.rb new file mode 100644 index 0000000..632257e --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/namespace/animal/cat.rb @@ -0,0 +1,5 @@ +module Animal + class Cat + constructor :road, :accessors => true + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/namespace/animal/reptile/hardshell/turtle.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/namespace/animal/reptile/hardshell/turtle.rb new file mode 100644 index 0000000..fd05feb --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/namespace/animal/reptile/hardshell/turtle.rb @@ -0,0 +1,8 @@ +module Animal + module Reptile + module Hardshell + class Turtle + end + end + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/namespace/animal/reptile/lizard.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/namespace/animal/reptile/lizard.rb new file mode 100644 index 0000000..d2c6c96 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/namespace/animal/reptile/lizard.rb @@ -0,0 +1,7 @@ +module Animal + module Reptile + class Lizard + constructor :bird, :accessors => true + end + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/namespace/bad_module_specified.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/namespace/bad_module_specified.yml new file mode 100644 index 0000000..7befcac --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/namespace/bad_module_specified.yml @@ -0,0 +1,8 @@ + +sky: + +using_namespace FuzzyCreature: + + bird: + compose: sky + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/namespace/class_name_combine.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/namespace/class_name_combine.yml new file mode 100644 index 0000000..77f66fc --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/namespace/class_name_combine.yml @@ -0,0 +1,8 @@ +road: + +using_namespace Animal: + + garfield: + class: Cat + compose: road + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/namespace/hello.txt b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/namespace/hello.txt new file mode 100644 index 0000000..f6bfc02 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/namespace/hello.txt @@ -0,0 +1 @@ +this is the info \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/namespace/no_module_specified.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/namespace/no_module_specified.yml new file mode 100644 index 0000000..065e83f --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/namespace/no_module_specified.yml @@ -0,0 +1,8 @@ + +sky: + +using_namespace: + + bird: + compose: sky + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/namespace/objects.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/namespace/objects.yml new file mode 100644 index 0000000..55511be --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/namespace/objects.yml @@ -0,0 +1,21 @@ +road: + +sky: + +using_namespace Animal: + + cat: + compose: road + + bird: + compose: sky + +using_namespace Animal Reptile: + + lizard: + compose: bird + +using_namespace Animal::Reptile::Hardshell: + + turtle: + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/namespace/road.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/namespace/road.rb new file mode 100644 index 0000000..bb050fb --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/namespace/road.rb @@ -0,0 +1,2 @@ +class Road +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/namespace/sky.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/namespace/sky.rb new file mode 100644 index 0000000..fc1e2bb --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/namespace/sky.rb @@ -0,0 +1,2 @@ +class Sky +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/namespace/subcontext.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/namespace/subcontext.yml new file mode 100644 index 0000000..da63311 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/namespace/subcontext.yml @@ -0,0 +1,22 @@ +road: + +sky: + +using_namespace Animal: + + cat: + compose: road + + ++aviary: + using_namespace Animal: + bird: + compose: sky + + using_namespace Animal Reptile: + lizard: + compose: bird + +using_namespace Animal::Reptile::Hardshell: + turtle: + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/non_singleton/air.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/non_singleton/air.rb new file mode 100644 index 0000000..63414af --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/non_singleton/air.rb @@ -0,0 +1,2 @@ +class Air +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/non_singleton/fat_cat.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/non_singleton/fat_cat.rb new file mode 100644 index 0000000..54c195c --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/non_singleton/fat_cat.rb @@ -0,0 +1,3 @@ +class FatCat + constructor :thread_spinner, :tick, :yard, :accessors => true +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/non_singleton/objects.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/non_singleton/objects.yml new file mode 100644 index 0000000..77b4505 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/non_singleton/objects.yml @@ -0,0 +1,19 @@ +air: + +thread_spinner: + compose: air + singleton: false + +yard: + +pig: + compose: thread_spinner, yard + ++inner_sanctum: + tick: + compose: thread_spinner + singleton: false + + fat_cat: + compose: thread_spinner, tick, yard + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/non_singleton/pig.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/non_singleton/pig.rb new file mode 100644 index 0000000..9d75013 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/non_singleton/pig.rb @@ -0,0 +1,3 @@ +class Pig + constructor :thread_spinner, :yard, :accessors => true +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/non_singleton/thread_spinner.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/non_singleton/thread_spinner.rb new file mode 100644 index 0000000..384cd11 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/non_singleton/thread_spinner.rb @@ -0,0 +1,3 @@ +class ThreadSpinner + constructor :air, :accessors => true +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/non_singleton/tick.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/non_singleton/tick.rb new file mode 100644 index 0000000..e243c16 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/non_singleton/tick.rb @@ -0,0 +1,3 @@ +class Tick + constructor :thread_spinner, :accessors => true +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/non_singleton/yard.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/non_singleton/yard.rb new file mode 100644 index 0000000..43936a7 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/non_singleton/yard.rb @@ -0,0 +1,2 @@ +class Yard +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/yak/core_model.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/yak/core_model.rb new file mode 100644 index 0000000..539b56b --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/yak/core_model.rb @@ -0,0 +1,3 @@ +class CoreModel + constructor :data_source, :strict => true +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/yak/core_presenter.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/yak/core_presenter.rb new file mode 100644 index 0000000..6caca4d --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/yak/core_presenter.rb @@ -0,0 +1,3 @@ +class CorePresenter + constructor :model, :view, :strict => true +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/yak/core_view.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/yak/core_view.rb new file mode 100644 index 0000000..7e606da --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/yak/core_view.rb @@ -0,0 +1 @@ +class CoreView; end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/yak/data_source.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/yak/data_source.rb new file mode 100644 index 0000000..772d3f4 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/yak/data_source.rb @@ -0,0 +1 @@ +class DataSource; end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/yak/fringe_model.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/yak/fringe_model.rb new file mode 100644 index 0000000..255a22e --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/yak/fringe_model.rb @@ -0,0 +1,3 @@ +class FringeModel + constructor :connected, :accessors => true, :strict => true +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/yak/fringe_presenter.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/yak/fringe_presenter.rb new file mode 100644 index 0000000..e404435 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/yak/fringe_presenter.rb @@ -0,0 +1,3 @@ +class FringePresenter + constructor :fringe_model, :fringe_view, :strict => true +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/yak/fringe_view.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/yak/fringe_view.rb new file mode 100644 index 0000000..d406d3d --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/yak/fringe_view.rb @@ -0,0 +1 @@ +class FringeView; end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/yak/giant_squid.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/yak/giant_squid.rb new file mode 100644 index 0000000..2ddc2cc --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/yak/giant_squid.rb @@ -0,0 +1,3 @@ +class GiantSquid + constructor :fringe_view, :core_model, :krill, :accessors => true +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/yak/krill.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/yak/krill.rb new file mode 100644 index 0000000..5e79f91 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/yak/krill.rb @@ -0,0 +1,2 @@ +class Krill +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/yak/my_objects.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/yak/my_objects.yml new file mode 100644 index 0000000..ddc8264 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/yak/my_objects.yml @@ -0,0 +1,21 @@ + +core_model: + compose: data_source + +core_view: + +core_presenter: + model: core_model + view: core_view + +data_source: + ++fringe_context: + + fringe_model: + connected: core_model + + fringe_view: + + fringe_presenter: + compose: fringe_model, fringe_view diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/yak/sub_sub_context_test.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/yak/sub_sub_context_test.yml new file mode 100644 index 0000000..465418a --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/files/yak/sub_sub_context_test.yml @@ -0,0 +1,27 @@ + +core_model: + compose: data_source + +core_view: + +core_presenter: + model: core_model + view: core_view + +data_source: + ++fringe_context: + + fringe_model: + connected: core_model + + fringe_view: + + fringe_presenter: + compose: fringe_model, fringe_view + + +deep_context: + krill: + + giant_squid: + compose: fringe_view, core_model, krill diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/test_helper.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/test_helper.rb new file mode 100644 index 0000000..90089f0 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/diy/test/test_helper.rb @@ -0,0 +1,55 @@ +here = File.expand_path(File.dirname(__FILE__)) +PROJ_ROOT = File.expand_path("#{here}/..") +$: << "#{PROJ_ROOT}/lib" +require 'test/unit' +require 'fileutils' +require 'find' +require 'yaml' +require 'ostruct' +require "#{here}/constructor" + +class Test::Unit::TestCase + include FileUtils + + def path_to(file) + File.expand_path(File.dirname(__FILE__)) + file + end + + def not_done + flunk "IMPLEMENT ME" + end + alias :implement_me :not_done + + def poll(time_limit) + (time_limit * 10).to_i.times do + return true if yield + sleep 0.1 + end + return false + end + + def self.method_added(msym) + # Prevent duplicate test methods + if msym.to_s =~ /^test_/ + @_tracked_tests ||= {} + raise "Duplicate test #{msym}" if @_tracked_tests[msym] + @_tracked_tests[msym] = true + end + end + + # + # HELPERS + # + def path_to_test_file(fname) + path_to("/files/#{fname}") + end + + def load_context(file_name) + hash = YAML.load(File.read(path_to_test_file(file_name))) + load_hash(hash) + end + + def load_hash(hash) + @diy = DIY::Context.new(hash) + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/CHANGES b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/CHANGES new file mode 100644 index 0000000..4b5184c --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/CHANGES @@ -0,0 +1,78 @@ +Hardmock 1.3.7 + +* BUG FIX: expects! could not setup expectations for more than one concrete method on an object, since the method aliasing and rewriting was only taking place when the background mock instance was first created. This logic has been updated and now you can do all the things you'd expect. + +Hardmock 1.3.6 + +* BUG FIX: In Rails apps (and others) Hardmock and Fixtures battled viciously over "setup" and "teardown" and "method_added" (and any other clever test enhancement tool, namely Mocha) causing unpredictable results, notably failure to auto-verify mocks after teardown (leading to false positive tests). + * The newly-added TestUnitBeforeAfter provides TestCase.before_setup and TestCase.after_teardown -- formal test wrapping hooks -- lets Hardmock provide its preparation and auto-verify behavior without contending for setup/teardown supremacy. + +Hardmock 1.3.5 + +* Aliased should_receive => expects and and_return => returns for easier transition from rspec mock and flexmock users. + +Hardmock 1.3.4 + +* Prevents accidental stubbing and mocking on NilClasses + +Hardmock 1.3.3 + +* stubs! and expects! no longer require that their target methods exist in reality (this used to prevent you from stubbing methods that "exist" by virtue of "method_missing" +* Tweaked inner metaclass code to avoid collisions with rspec's "metaid" stuff +* Moved this project's Rake tasks into rake_tasks... otherwise Rails will load them, if Hardmock is installed as a Rails plugin +* Alias added: 'verify_hardmocks' is now an alias for 'verify_mocks' (some internal projects were using this modified method name as a means of cooexisting with mocha) + +Hardmock 1.3.2 + +November 2007 + +* adds 'with' as an alternate syntax for specifying argument expectations. + +Hardmock 1.3.1 + +October 2007 + +* Can use stubs! on a mock object +* expects! now generates mocked methods that can safely transfer runtime blocks to the mock instance itself +* No longer need to call "prepare_hardmock_control" when using stubs in the absence of mocks +* Stubs of concrete class or instance methods are restored to original state in teardown + +Hardmock 1.3.0 + +October 2007 + +* Adds stubs! and expects! method to all objects and classes to support concrete stubbing/mocking. + +Hardmock 1.2.3 + +Sat Apr 28 01:16:15 EDT 2007 + +* Re-release of 1.2.2 (which was canceled)... tasks moved to lib/tasks + +Hardmock 1.2.2 + +Sat Apr 28 00:41:30 EDT 2007 + +* assert_error has been broken out into its own lib file +* Gem package can now run all tests successfully +* Internal code refactoring; a number of classes that were defined in hardmock.rb are now in their own files + +Hardmock 1.2.1 + +Sat Apr 28 00:41:30 EDT 2007 + +* (botched release, see 1.2.2) + +Hardmock 1.2.0 + +* You can now use "expect" in place of "expects" if you must. +* "inspect" has been added to the list of methods NOT erased by MethodCleanout. + +Hardmock 1.1.0 + +* "expects" replaces "expect" ("expect" now raises Hardmock::DeprecationError) +* "verify_mocks" is now implicit in teardown, you needn't call it anymore +* Mocking methods that Mock would otherwise inherit from Object (eg, to_s) is now possible +* require 'hardmock' is all that's required to use the library now; no need to include in TestCase + +(previously called CMock, translated to Hardmock on 2006-12-10) diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/LICENSE b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/LICENSE new file mode 100644 index 0000000..396211e --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/LICENSE @@ -0,0 +1,7 @@ +Copyright (c) 2006,2007 David Crosby at Atomic Object, LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/README b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/README new file mode 100644 index 0000000..4650a2a --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/README @@ -0,0 +1,70 @@ +== Hardmock + +Strict, ordered mock objects using very lightweight syntax in your tests. + +== How + +The basic procedure for using Hardmock in your tests is: + +* require 'hardmock' (this happens automatically when being used as a Rails plugin) +* Create some mocks +* Setup some expectations +* Execute the target code +* Verification of calls is automatic in =teardown= + +The expectations you set when using mocks are strict and ordered. +Expectations you declare by creating and using mocks are all considered together. + +* Hardmock::Mock#expects will show you more examples +* Hardmock::SimpleExpectation will teach you more about expectation methods + +== Example + + create_mocks :garage, :car + + # Set some expectations + @garage.expects.open_door + @car.expects.start(:choke) + @car.expects.drive(:reverse, 5.mph) + + # Execute the code (this code is usually, obviously, in your class under test) + @garage.open_door + @car.start :choke + @car.drive :reverse, 5.mph + + verify_mocks # OPTIONAL, teardown will do this for you + +Expects @garage.open_door, @car.start(:choke) and @car.drive(:reverse, 5.mph) to be called in that order, with those specific arguments. +* Violations of expectations, such as mis-ordered calls, calls on wrong objects, or incorrect methods result in Hardmock::ExpectationError +* verify_mocks will raise VerifyError if not all expectations have been met. + +== Download and Install + +* Homepage: http://hardmock.rubyforge.org +* GEM or TGZ or ZIP: http://rubyforge.org/frs/?group_id=2742 +* Rails plugin: script/plugin install +* SVN access: svn co svn://rubyforge.org/var/svn/hardmock/trunk +* Developer SVN access: svn co svn://developername@rubyforge.org/var/svn/hardmock/trunk + +== Setup for Test::Unit + + require 'hardmock' + require 'assert_error' # OPTIONAL: this adds the TestUnit extension 'assert_error' + +NOTE: If installed as a Rails plugin, init.rb does this for you... nothing else is needed. + +== Setup for RSpec + +Get this into your spec helper or environment or Rakefile or wherever you prefer: + + Spec::Runner.configure do |configuration| + configuration.include Hardmock + configuration.after(:each) {verify_mocks} + end + +This puts the implicit conveniences into your spec context, like "create_mocks" etc, and also provides for automatic +"verify_mocks" after each Example is run. + +== Author +* David Crosby crosby at http://atomicobject.com +* (c) 2006,2007 Atomic Object LLC diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/Rakefile b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/Rakefile new file mode 100644 index 0000000..aff126c --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/Rakefile @@ -0,0 +1,8 @@ +require 'rake' +require 'rubygems' + +HARDMOCK_VERSION = "1.3.7" + +Dir["rake_tasks/*.rake"].each { |f| load f } + +task :default => [ 'test:all' ] diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/config/environment.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/config/environment.rb new file mode 100644 index 0000000..a15e598 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/config/environment.rb @@ -0,0 +1,12 @@ +# The path to the root directory of your application. +APP_ROOT = File.join(File.dirname(__FILE__), '..') + +ADDITIONAL_LOAD_PATHS = [] +ADDITIONAL_LOAD_PATHS.concat %w( + lib +).map { |dir| "#{APP_ROOT}/#{dir}" }.select { |dir| File.directory?(dir) } + +# Prepend to $LOAD_PATH +ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) } + +# Require any additional libraries needed diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/lib/assert_error.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/lib/assert_error.rb new file mode 100644 index 0000000..6da61de --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/lib/assert_error.rb @@ -0,0 +1,23 @@ +require 'test/unit/assertions' + +module Test::Unit #:nodoc:# + module Assertions #:nodoc:# + # A better 'assert_raise'. +patterns+ can be one or more Regexps, or a literal String that + # must match the entire error message. + def assert_error(err_type,*patterns,&block) + assert_not_nil block, "assert_error requires a block" + assert((err_type and err_type.kind_of?(Class)), "First argument to assert_error has to be an error type") + err = assert_raise(err_type) do + block.call + end + patterns.each do |pattern| + case pattern + when Regexp + assert_match(pattern, err.message) + else + assert_equal pattern, err.message + end + end + end + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/lib/extend_test_unit.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/lib/extend_test_unit.rb new file mode 100644 index 0000000..3d7ef9d --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/lib/extend_test_unit.rb @@ -0,0 +1,14 @@ + +require 'test/unit/testcase' +class Test::Unit::TestCase + include Hardmock +end + +require 'test_unit_before_after' +Test::Unit::TestCase.before_setup do |test| + test.prepare_hardmock_control +end + +Test::Unit::TestCase.after_teardown do |test| + test.verify_mocks +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/lib/hardmock.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/lib/hardmock.rb new file mode 100644 index 0000000..50f9a94 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/lib/hardmock.rb @@ -0,0 +1,86 @@ +require 'hardmock/method_cleanout' +require 'hardmock/mock' +require 'hardmock/mock_control' +require 'hardmock/utils' +require 'hardmock/errors' +require 'hardmock/trapper' +require 'hardmock/expector' +require 'hardmock/expectation' +require 'hardmock/expectation_builder' +require 'hardmock/stubbing' + +module Hardmock + + # Create one or more new Mock instances in your test suite. + # Once created, the Mocks are accessible as instance variables in your test. + # Newly built Mocks are added to the full set of Mocks for this test, which will + # be verified when you call verify_mocks. + # + # create_mocks :donkey, :cat # Your test now has @donkey and @cat + # create_mock :dog # Test now has @donkey, @cat and @dog + # + # The first call returned a hash { :donkey => @donkey, :cat => @cat } + # and the second call returned { :dog => @dog } + # + # For more info on how to use your mocks, see Mock and Expectation + # + def create_mocks(*mock_names) + prepare_hardmock_control unless @main_mock_control + + mocks = {} + mock_names.each do |mock_name| + raise ArgumentError, "'nil' is not a valid name for a mock" if mock_name.nil? + mock_name = mock_name.to_s + mock_object = Mock.new(mock_name, @main_mock_control) + mocks[mock_name.to_sym] = mock_object + self.instance_variable_set "@#{mock_name}", mock_object + end + @all_mocks ||= {} + @all_mocks.merge! mocks + + return mocks.clone + end + + def prepare_hardmock_control + if @main_mock_control.nil? + @main_mock_control = MockControl.new + $main_mock_control = @main_mock_control + else + raise "@main_mock_control is already setup for this test!" + end + end + + alias :create_mock :create_mocks + + # Ensures that all expectations have been met. If not, VerifyException is + # raised. + # + # You normally won't need to call this yourself. Within Test::Unit::TestCase, this will be done automatically at teardown time. + # + # * +force+ -- if +false+, and a VerifyError or ExpectationError has already occurred, this method will not raise. This is to help you suppress repeated errors when if you're calling #verify_mocks in the teardown method of your test suite. BE WARNED - only use this if you're sure you aren't obscuring useful information. Eg, if your code handles exceptions internally, and an ExpectationError gets gobbled up by your +rescue+ block, the cause of failure for your test may be hidden from you. For this reason, #verify_mocks defaults to force=true as of Hardmock 1.0.1 + def verify_mocks(force=true) + return unless @main_mock_control + return if @main_mock_control.disappointed? and !force + @main_mock_control.verify + ensure + @main_mock_control.clear_expectations if @main_mock_control + $main_mock_control = nil + reset_stubs + end + + alias :verify_hardmocks :verify_mocks + + # Purge the main MockControl of all expectations, restore all concrete stubbed/mocked methods + def clear_expectations + @main_mock_control.clear_expectations if @main_mock_control + reset_stubs + $main_mock_control = nil + end + + def reset_stubs + Hardmock.restore_all_replaced_methods + end + +end + +require 'extend_test_unit' diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/lib/hardmock/errors.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/lib/hardmock/errors.rb new file mode 100644 index 0000000..48698a6 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/lib/hardmock/errors.rb @@ -0,0 +1,22 @@ +module Hardmock + # Raised when: + # * Unexpected method is called on a mock object + # * Bad arguments passed to an expected call + class ExpectationError < StandardError #:nodoc:# + end + + # Raised for methods that should no longer be called. Hopefully, the exception message contains helpful alternatives. + class DeprecationError < StandardError #:nodoc:# + end + + # Raised when stubbing fails + class StubbingError < StandardError #:nodoc:# + end + + # Raised when it is discovered that an expected method call was never made. + class VerifyError < StandardError #:nodoc:# + def initialize(msg,unmet_expectations) + super("#{msg}:" + unmet_expectations.map { |ex| "\n * #{ex.to_s}" }.join) + end + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/lib/hardmock/expectation.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/lib/hardmock/expectation.rb new file mode 100644 index 0000000..4d1db92 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/lib/hardmock/expectation.rb @@ -0,0 +1,229 @@ +require 'hardmock/utils' + +module Hardmock + class Expectation + include Utils + attr_reader :block_value + + def initialize(options) #:nodoc: + @options = options + end + + def apply_method_call(mock,mname,args,block) #:nodoc: + unless @options[:mock].equal?(mock) + raise anger("Wrong object", mock,mname,args) + end + unless @options[:method] == mname + raise anger("Wrong method",mock,mname,args) + end + + # Tester-defined block to invoke at method-call-time: + expectation_block = @options[:block] + + expected_args = @options[:arguments] + # if we have a block, we can skip the argument check if none were specified + unless (expected_args.nil? || expected_args.empty?) && expectation_block && !@options[:suppress_arguments_to_block] + unless expected_args == args + raise anger("Wrong arguments",mock,mname,args) + end + end + + relayed_args = args.dup + if block + if expectation_block.nil? + # Can't handle a runtime block without an expectation block + raise ExpectationError.new("Unexpected block provided to #{to_s}") + else + # Runtime blocks are passed as final argument to the expectation block + unless @options[:suppress_arguments_to_block] + relayed_args << block + else + # Arguments suppressed; send only the block + relayed_args = [block] + end + end + end + + # Run the expectation block: + @block_value = expectation_block.call(*relayed_args) if expectation_block + + raise @options[:raises] unless @options[:raises].nil? + + return_value = @options[:returns] + if return_value.nil? + return @block_value + else + return return_value + end + end + + # Set the return value for an expected method call. + # Eg, + # @cash_machine.expects.withdraw(20,:dollars).returns(20.00) + def returns(val) + @options[:returns] = val + self + end + alias_method :and_return, :returns + + # Set the arguments for an expected method call. + # Eg, + # @cash_machine.expects.deposit.with(20, "dollars").returns(:balance => "20") + def with(*args) + @options[:arguments] = args + self + end + + # Rig an expected method to raise an exception when the mock is invoked. + # + # Eg, + # @cash_machine.expects.withdraw(20,:dollars).raises "Insufficient funds" + # + # The argument can be: + # * an Exception -- will be used directly + # * a String -- will be used as the message for a RuntimeError + # * nothing -- RuntimeError.new("An Error") will be raised + def raises(err=nil) + case err + when Exception + @options[:raises] = err + when String + @options[:raises] = RuntimeError.new(err) + else + @options[:raises] = RuntimeError.new("An Error") + end + self + end + + # Convenience method: assumes +block_value+ is set, and is set to a Proc + # (or anything that responds to 'call') + # + # light_event = @traffic_light.trap.subscribe(:light_changes) + # + # # This code will meet the expectation: + # @traffic_light.subscribe :light_changes do |color| + # puts color + # end + # + # The color-handling block is now stored in light_event.block_value + # + # The block can be invoked like this: + # + # light_event.trigger :red + # + # See Mock#trap and Mock#expects for information on using expectation objects + # after they are set. + # + def trigger(*block_arguments) + unless block_value + raise ExpectationError.new("No block value is currently set for expectation #{to_s}") + end + unless block_value.respond_to?(:call) + raise ExpectationError.new("Can't apply trigger to #{block_value} for expectation #{to_s}") + end + block_value.call *block_arguments + end + + # Used when an expected method accepts a block at runtime. + # When the expected method is invoked, the block passed to + # that method will be invoked as well. + # + # NOTE: ExpectationError will be thrown upon running the expected method + # if the arguments you set up in +yields+ do not properly match up with + # the actual block that ends up getting passed. + # + # == Examples + # Single invocation: The block passed to +lock_down+ gets invoked + # once with no arguments: + # + # @safe_zone.expects.lock_down.yields + # + # # (works on code that looks like:) + # @safe_zone.lock_down do + # # ... this block invoked once + # end + # + # Multi-parameter blocks: The block passed to +each_item+ gets + # invoked twice, with :item1 the first time, and with + # :item2 the second time: + # + # @fruit_basket.expects.each_with_index.yields [:apple,1], [:orange,2] + # + # # (works on code that looks like:) + # @fruit_basket.each_with_index do |fruit,index| + # # ... this block invoked with fruit=:apple, index=1, + # # ... and then with fruit=:orange, index=2 + # end + # + # Arrays can be passed as arguments too... if the block + # takes a single argument and you want to pass a series of arrays into it, + # that will work as well: + # + # @list_provider.expects.each_list.yields [1,2,3], [4,5,6] + # + # # (works on code that looks like:) + # @list_provider.each_list do |list| + # # ... list is [1,2,3] the first time + # # ... list is [4,5,6] the second time + # end + # + # Return value: You can set the return value for the method that + # accepts the block like so: + # + # @cruncher.expects.do_things.yields(:bean1,:bean2).returns("The Results") + # + # Raising errors: You can set the raised exception for the method that + # accepts the block. NOTE: the error will be raised _after_ the block has + # been invoked. + # + # # :bean1 and :bean2 will be passed to the block, then an error is raised: + # @cruncher.expects.do_things.yields(:bean1,:bean2).raises("Too crunchy") + # + def yields(*items) + @options[:suppress_arguments_to_block] = true + if items.empty? + # Yield once + @options[:block] = lambda do |block| + if block.arity != 0 and block.arity != -1 + raise ExpectationError.new("The given block was expected to have no parameter count; instead, got #{block.arity} to <#{to_s}>") + end + block.call + end + else + # Yield one or more specific items + @options[:block] = lambda do |block| + items.each do |item| + if item.kind_of?(Array) + if block.arity == item.size + # Unfold the array into the block's arguments: + block.call *item + elsif block.arity == 1 + # Just pass the array in + block.call item + else + # Size mismatch + raise ExpectationError.new("Can't pass #{item.inspect} to block with arity #{block.arity} to <#{to_s}>") + end + else + if block.arity != 1 + # Size mismatch + raise ExpectationError.new("Can't pass #{item.inspect} to block with arity #{block.arity} to <#{to_s}>") + end + block.call item + end + end + end + end + self + end + + def to_s # :nodoc: + format_method_call_string(@options[:mock],@options[:method],@options[:arguments]) + end + + private + def anger(msg, mock,mname,args) + ExpectationError.new("#{msg}: expected call <#{to_s}> but was <#{format_method_call_string(mock,mname,args)}>") + end + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/lib/hardmock/expectation_builder.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/lib/hardmock/expectation_builder.rb new file mode 100644 index 0000000..7445fb1 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/lib/hardmock/expectation_builder.rb @@ -0,0 +1,9 @@ +require 'hardmock/expectation' + +module Hardmock + class ExpectationBuilder #:nodoc: + def build_expectation(options) + Expectation.new(options) + end + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/lib/hardmock/expector.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/lib/hardmock/expector.rb new file mode 100644 index 0000000..8055460 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/lib/hardmock/expector.rb @@ -0,0 +1,26 @@ +require 'hardmock/method_cleanout' +require 'hardmock/errors' + +module Hardmock + class Expector #:nodoc: + include MethodCleanout + + def initialize(mock,mock_control,expectation_builder) + @mock = mock + @mock_control = mock_control + @expectation_builder = expectation_builder + end + + def method_missing(mname, *args, &block) + expectation = @expectation_builder.build_expectation( + :mock => @mock, + :method => mname, + :arguments => args, + :block => block) + + @mock_control.add_expectation expectation + expectation + end + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/lib/hardmock/method_cleanout.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/lib/hardmock/method_cleanout.rb new file mode 100644 index 0000000..51797e6 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/lib/hardmock/method_cleanout.rb @@ -0,0 +1,33 @@ + +module Hardmock #:nodoc: + module MethodCleanout #:nodoc: + SACRED_METHODS = %w{ + __id__ + __send__ + equal? + object_id + send + nil? + class + kind_of? + respond_to? + inspect + method + to_s + instance_variables + instance_eval + == + hm_metaclass + hm_meta_eval + hm_meta_def + } + + def self.included(base) #:nodoc: + base.class_eval do + instance_methods.each do |m| + undef_method m unless SACRED_METHODS.include?(m.to_s) + end + end + end + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/lib/hardmock/mock.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/lib/hardmock/mock.rb new file mode 100644 index 0000000..928c432 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/lib/hardmock/mock.rb @@ -0,0 +1,180 @@ + +module Hardmock + # Mock is used to set expectations in your test. Most of the time you'll use + # #expects to create expectations. + # + # Aside from the scant few control methods (like +expects+, +trap+ and +_verify+) + # all calls made on a Mock instance will be immediately applied to the internal + # expectation mechanism. + # + # * If the method call was expected and all the parameters match properly, execution continues + # * If the expectation was configured with an expectation block, the block is invoked + # * If the expectation was set up to raise an error, the error is raised now + # * If the expectation was set up to return a value, it is returned + # * If the method call was _not_ expected, or the parameter values are wrong, an ExpectationError is raised. + class Mock + include Hardmock::MethodCleanout + + # Create a new Mock instance with a name and a MockControl to support it. + # If not given, a MockControl is made implicitly for this Mock alone; this means + # expectations for this mock are not tied to other expectations in your test. + # + # It's not recommended to use a Mock directly; see Hardmock and + # Hardmock#create_mocks for the more wholistic approach. + def initialize(name, mock_control=nil) + @name = name + @control = mock_control || MockControl.new + @expectation_builder = ExpectationBuilder.new + end + + def inspect + "" + end + + # Begin declaring an expectation for this Mock. + # + # == Simple Examples + # Expect the +customer+ to be queried for +account+, and return "The + # Account": + # @customer.expects.account.returns "The Account" + # + # Expect the +withdraw+ method to be called, and raise an exception when it + # is (see Expectation#raises for more info): + # @cash_machine.expects.withdraw(20,:dollars).raises("not enough money") + # + # Expect +customer+ to have its +user_name+ set + # @customer.expects.user_name = 'Big Boss' + # + # Expect +customer+ to have its +user_name+ set, and raise a RuntimeException when + # that happens: + # @customer.expects('user_name=', "Big Boss").raises "lost connection" + # + # Expect +evaluate+ to be passed a block, and when that happens, pass a value + # to the block (see Expectation#yields for more info): + # @cruncher.expects.evaluate.yields("some data").returns("some results") + # + # + # == Expectation Blocks + # To do special handling of expected method calls when they occur, you + # may pass a block to your expectation, like: + # @page_scraper.expects.handle_content do |address,request,status| + # assert_not_nil address, "Can't abide nil addresses" + # assert_equal "http-get", request.method, "Can only handle GET" + # assert status > 200 and status < 300, status, "Failed status" + # "Simulated results #{request.content.downcase}" + # end + # In this example, when page_scraper.handle_content is called, its + # three arguments are passed to the expectation block and evaluated + # using the above assertions. The last value in the block will be used + # as the return value for +handle_content+ + # + # You may specify arguments to the expected method call, just like any normal + # expectation, and those arguments will be pre-validated before being passed + # to the expectation block. This is useful when you know all of the + # expected values but still need to do something programmatic. + # + # If the method being invoked on the mock accepts a block, that block will be + # passed to your expectation block as the last (or only) argument. Eg, the + # convenience method +yields+ can be replaced with the more explicit: + # @cruncher.expects.evaluate do |block| + # block.call "some data" + # "some results" + # end + # + # The result value of the expectation block becomes the return value for the + # expected method call. This can be overidden by using the +returns+ method: + # @cruncher.expects.evaluate do |block| + # block.call "some data" + # "some results" + # end.returns("the actual value") + # + # Additionally, the resulting value of the expectation block is stored + # in the +block_value+ field on the expectation. If you've saved a reference + # to your expectation, you may retrieve the block value once the expectation + # has been met. + # + # evaluation_event = @cruncher.expects.evaluate do |block| + # block.call "some data" + # "some results" + # end.returns("the actual value") + # + # result = @cruncher.evaluate do |input| + # puts input # => 'some data' + # end + # # result is 'the actual value' + # + # evaluation_event.block_value # => 'some results' + # + def expects(*args, &block) + expector = Expector.new(self,@control,@expectation_builder) + # If there are no args, we return the Expector + return expector if args.empty? + # If there ARE args, we set up the expectation right here and return it + expector.send(args.shift.to_sym, *args, &block) + end + alias_method :expect, :expects + alias_method :should_receive, :expects + + # Special-case convenience: #trap sets up an expectation for a method + # that will take a block. That block, when sent to the expected method, will + # be trapped and stored in the expectation's +block_value+ field. + # The Expectation#trigger method may then be used to invoke that block. + # + # Like +expects+, the +trap+ mechanism can be followed by +raises+ or +returns+. + # + # _Unlike_ +expects+, you may not use an expectation block with +trap+. If + # the expected method takes arguments in addition to the block, they must + # be specified in the arguments to the +trap+ call itself. + # + # == Example + # + # create_mocks :address_book, :editor_form + # + # # Expect a subscription on the :person_added event for @address_book: + # person_event = @address_book.trap.subscribe(:person_added) + # + # # The runtime code would look like: + # @address_book.subscribe :person_added do |person_name| + # @editor_form.name = person_name + # end + # + # # At this point, the expectation for 'subscribe' is met and the + # # block has been captured. But we're not done: + # @editor_form.expects.name = "David" + # + # # Now invoke the block we trapped earlier: + # person_event.trigger "David" + # + # verify_mocks + def trap(*args) + Trapper.new(self,@control,ExpectationBuilder.new) + end + + def method_missing(mname,*args) #:nodoc: + block = nil + block = Proc.new if block_given? + @control.apply_method_call(self,mname,args,block) + end + + + def _control #:nodoc: + @control + end + + def _name #:nodoc: + @name + end + + # Verify that all expectations are fulfilled. NOTE: this method triggers + # validation on the _control_ for this mock, so all Mocks that share the + # MockControl with this instance will be included in the verification. + # + # Only use this method if you are managing your own Mocks and their controls. + # + # Normal usage of Hardmock doesn't require you to call this; let + # Hardmock#verify_mocks do it for you. + def _verify + @control.verify + end + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/lib/hardmock/mock_control.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/lib/hardmock/mock_control.rb new file mode 100644 index 0000000..302ebce --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/lib/hardmock/mock_control.rb @@ -0,0 +1,53 @@ +require 'hardmock/utils' + +module Hardmock + class MockControl #:nodoc: + include Utils + attr_accessor :name + + def initialize + clear_expectations + end + + def happy? + @expectations.empty? + end + + def disappointed? + @disappointed + end + + def add_expectation(expectation) +# puts "MockControl #{self.object_id.to_s(16)} adding expectation: #{expectation}" + @expectations << expectation + end + + def apply_method_call(mock,mname,args,block) + # Are we even expecting any sort of call? + if happy? + @disappointed = true + raise ExpectationError.new("Surprise call to #{format_method_call_string(mock,mname,args)}") + end + + begin + @expectations.shift.apply_method_call(mock,mname,args,block) + rescue Exception => ouch + @disappointed = true + raise ouch + end + end + + def verify +# puts "MockControl #{self.object_id.to_s(16)} verify: happy? #{happy?}" + @disappointed = !happy? + raise VerifyError.new("Unmet expectations", @expectations) unless happy? + end + + def clear_expectations + @expectations = [] + @disappointed = false + end + + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/lib/hardmock/stubbing.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/lib/hardmock/stubbing.rb new file mode 100644 index 0000000..0f8a293 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/lib/hardmock/stubbing.rb @@ -0,0 +1,210 @@ + + +# Stubbing support +# +# Stubs methods on classes and instances +# + +# Why's "metaid.rb" stuff crunched down: +class Object #:nodoc:# + def hm_metaclass #:nodoc:# + class << self + self + end + end + + def hm_meta_eval(&blk) #:nodoc:# + hm_metaclass.instance_eval(&blk) + end + + def hm_meta_def(name, &blk) #:nodoc:# + hm_meta_eval { define_method name, &blk } + end +end + + + +module Hardmock + + # == Hardmock: Stubbing and Mocking Concrete Methods + # + # Hardmock lets you stub and/or mock methods on concrete classes or objects. + # + # * To "stub" a concrete method is to rig it to return the same thing always, disregarding any arguments. + # * To "mock" a concrete method is to surplant its funcionality by delegating to a mock object who will cover this behavior. + # + # Mocked methods have their expectations considered along with all other mock object expectations. + # + # If you use stubbing or concrete mocking in the absence (or before creation) of other mocks, you need to invoke prepare_hardmock_control. + # Once verify_mocks or clear_expectaions is called, the overriden behavior in the target objects is restored. + # + # == Examples + # + # River.stubs!(:sounds_like).returns("gurgle") + # + # River.expects!(:jump).returns("splash") + # + # rogue.stubs!(:sounds_like).returns("pshshsh") + # + # rogue.expects!(:rawhide_tanning_solvents).returns("giant snapping turtles") + # + module Stubbing + # Exists only for documentation + end + + class ReplacedMethod #:nodoc:# + attr_reader :target, :method_name + + def initialize(target, method_name) + @target = target + @method_name = method_name + + Hardmock.track_replaced_method self + end + end + + class StubbedMethod < ReplacedMethod #:nodoc:# + def invoke(args) + raise @raises if @raises + @return_value + end + + def returns(stubbed_return) + @return_value = stubbed_return + end + + def raises(err) + err = RuntimeError.new(err) unless err.kind_of?(Exception) + @raises = err + end + end + + class ::Object + def stubs!(method_name) + method_name = method_name.to_s + already_stubbed = Hardmock.has_replaced_method?(self, method_name) + + stubbed_method = Hardmock::StubbedMethod.new(self, method_name) + + + unless _is_mock? or already_stubbed + if methods.include?(method_name.to_s) + hm_meta_eval do + alias_method "_hardmock_original_#{method_name}".to_sym, method_name.to_sym + end + end + end + + hm_meta_def method_name do |*args| + stubbed_method.invoke(args) + end + + stubbed_method + end + + def expects!(method_name, *args, &block) + if self._is_mock? + raise Hardmock::StubbingError, "Cannot use 'expects!(:#{method_name})' on a Mock object; try 'expects' instead" + end + + method_name = method_name.to_s + + @_my_mock = Mock.new(_my_name, $main_mock_control) if @_my_mock.nil? + + unless Hardmock.has_replaced_method?(self, method_name) + # Track the method as replaced + Hardmock::ReplacedMethod.new(self, method_name) + + # Preserver original implementation of the method by aliasing it away + if methods.include?(method_name) + hm_meta_eval do + alias_method "_hardmock_original_#{method_name}".to_sym, method_name.to_sym + end + end + + # Re-define the method to utilize our patron mock instance. + # (This global-temp-var thing is hokey but I was having difficulty generating + # code for the meta class.) + begin + $method_text_temp = %{ + def #{method_name}(*args,&block) + @_my_mock.__send__(:#{method_name}, *args, &block) + end + } + class << self + eval $method_text_temp + end + ensure + $method_text_temp = nil + end + end + + return @_my_mock.expects(method_name, *args, &block) + end + + def _is_mock? + self.kind_of?(Mock) + end + + def _my_name + self.kind_of?(Class) ? self.name : self.class.name + end + + def _clear_mock + @_my_mock = nil + end + + end + + class ::NilClass + # Use this only if you really mean it + alias_method :intentionally_stubs!, :stubs! + + # Use this only if you really mean it + alias_method :intentionally_expects!, :expects! + + # Overridden to protect against accidental nil reference self delusion + def stubs!(mname) + raise StubbingError, "Cannot stub #{mname} method on nil. (If you really mean to, try 'intentionally_stubs!')" + end + + # Overridden to protect against accidental nil reference self delusion + def expects!(mname, *args) + raise StubbingError, "Cannot mock #{mname} method on nil. (If you really mean to, try 'intentionally_expects!')" + end + end + + class << self + def track_replaced_method(replaced_method) + all_replaced_methods << replaced_method + end + + def all_replaced_methods + $all_replaced_methods ||= [] + end + + def has_replaced_method?(obj, method_name) + hits = all_replaced_methods.select do |replaced| + (replaced.target.object_id == obj.object_id) and (replaced.method_name.to_s == method_name.to_s) + end + return !hits.empty? + end + + def restore_all_replaced_methods + all_replaced_methods.each do |replaced| + unless replaced.target._is_mock? + backed_up = "_hardmock_original_#{replaced.method_name}" + if replaced.target.methods.include?(backed_up) + replaced.target.hm_meta_eval do + alias_method replaced.method_name.to_sym, backed_up.to_sym + end + end + replaced.target._clear_mock + end + end + all_replaced_methods.clear + end + end + +end + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/lib/hardmock/trapper.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/lib/hardmock/trapper.rb new file mode 100644 index 0000000..6aab176 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/lib/hardmock/trapper.rb @@ -0,0 +1,31 @@ +require 'test/unit/assertions' +require 'hardmock/errors' + +module Hardmock + class Trapper #:nodoc: + include Hardmock::MethodCleanout + + def initialize(mock,mock_control,expectation_builder) + @mock = mock + @mock_control = mock_control + @expectation_builder = expectation_builder + end + + def method_missing(mname, *args) + if block_given? + raise ExpectationError.new("Don't pass blocks when using 'trap' (setting exepectations for '#{mname}')") + end + + the_block = lambda { |target_block| target_block } + expectation = @expectation_builder.build_expectation( + :mock => @mock, + :method => mname, + :arguments => args, + :suppress_arguments_to_block => true, + :block => the_block) + + @mock_control.add_expectation expectation + expectation + end + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/lib/hardmock/utils.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/lib/hardmock/utils.rb new file mode 100644 index 0000000..1740577 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/lib/hardmock/utils.rb @@ -0,0 +1,9 @@ + +module Hardmock + module Utils #:nodoc: + def format_method_call_string(mock,mname,args) + arg_string = args.map { |a| a.inspect }.join(', ') + call_text = "#{mock._name}.#{mname}(#{arg_string})" + end + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/lib/test_unit_before_after.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/lib/test_unit_before_after.rb new file mode 100644 index 0000000..0499e39 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/lib/test_unit_before_after.rb @@ -0,0 +1,169 @@ +require 'test/unit' +require 'test/unit/testcase' +require 'test/unit/assertions' + +module Test #:nodoc:# + module Unit #:nodoc:# + + # == TestCase Modifications + # + # Monkey-patch to provide a formal mechanism for appending actions to be executed after teardown. + # Use after_teardown to define one or more actions to be executed after teardown for ALL tests. + # + # COMING SOON? + # * (maybe?) Hooks for before_teardown, after_setup, on_error + # * (maybe?) Options for positional control, eg, after_teardown :before_other_actions + # * (maybe?) Provide tagging/filtering so action execution can be controlled specifically? + # + # == Usage + # + # Invoke TestCase.after_teardown with optional parameter, which will be invoked with a reference + # to the test instance that has just been torn down. + # + # Example: + # + # Test::Unit::TestCase.after_teardown do |test| + # test.verify_mocks + # end + # + # == Justification + # + # There are a number of tools and libraries that play fast-n-loose with setup and teardown by + # wrapping them, and by overriding method_added as a means of upholding special setup/teardown + # behavior, usually by re-wrapping newly defined user-level setup/teardown methods. + # mocha and active_record/fixtures (and previously, hardmock) will fight for this + # territory with often unpredictable results. + # + # We wouldn't have to battle if Test::Unit provided a formal pre- and post- hook mechanism. + # + class TestCase + + class << self + + # Define an action to be run after teardown. Subsequent calls result in + # multiple actions. The block will be given a reference to the test + # being executed. + # + # Example: + # + # Test::Unit::TestCase.after_teardown do |test| + # test.verify_mocks + # end + def after_teardown(&block) + post_teardown_actions << block + end + + # Used internally. Access the list of post teardown actions for to be + # used by all tests. + def post_teardown_actions + @@post_teardown_actions ||= [] + end + + # Define an action to be run before setup. Subsequent calls result in + # multiple actions, EACH BEING PREPENDED TO THE PREVIOUS. + # The block will be given a reference to the test being executed. + # + # Example: + # + # Test::Unit::TestCase.before_setup do |test| + # test.prepare_hardmock_control + # end + def before_setup(&block) + pre_setup_actions.unshift block + end + + # Used internally. Access the list of post teardown actions for to be + # used by all tests. + def pre_setup_actions + @@pre_setup_actions ||= [] + end + end + + # OVERRIDE: This is a reimplementation of the default "run", updated to + # execute actions after teardown. + def run(result) + yield(STARTED, name) + @_result = result + begin + execute_pre_setup_actions(self) + setup + __send__(@method_name) + rescue Test::Unit::AssertionFailedError => e + add_failure(e.message, auxiliary_backtrace_filter(e.backtrace)) + rescue Exception + raise if should_passthru_exception($!) # See implementation; this is for pre-1.8.6 compat + add_error($!) + ensure + begin + teardown + rescue Test::Unit::AssertionFailedError => e + add_failure(e.message, auxiliary_backtrace_filter(e.backtrace)) + rescue Exception + raise if should_passthru_exception($!) # See implementation; this is for pre-1.8.6 compat + add_error($!) + ensure + execute_post_teardown_actions(self) + end + end + result.add_run + yield(FINISHED, name) + end + + private + + # Run through the after_teardown actions, treating failures and errors + # in the same way that "run" does: they are reported, and the remaining + # actions are executed. + def execute_post_teardown_actions(test_instance) + self.class.post_teardown_actions.each do |action| + begin + action.call test_instance + rescue Test::Unit::AssertionFailedError => e + add_failure(e.message, auxiliary_backtrace_filter(e.backtrace)) + rescue Exception + raise if should_passthru_exception($!) + add_error($!) + end + end + end + + # Run through the before_setup actions. + # Failures or errors cause execution to stop. + def execute_pre_setup_actions(test_instance) + self.class.pre_setup_actions.each do |action| +# begin + action.call test_instance +# rescue Test::Unit::AssertionFailedError => e +# add_failure(e.message, auxiliary_backtrace_filter(e.backtrace)) +# rescue Exception +# raise if should_passthru_exception($!) +# add_error($!) +# end + end + end + + # Make sure that this extension doesn't show up in failure backtraces + def auxiliary_backtrace_filter(trace) + trace.reject { |x| x =~ /test_unit_before_after/ } + end + + # Is the given error of the type that we allow to fly out (rather than catching it)? + def should_passthru_exception(ex) + return passthrough_exception_types.include?($!.class) + end + + # Provide a list of exception types that are to be allowed to explode out. + # Pre-ruby-1.8.6 doesn't use this functionality, so the PASSTHROUGH_EXCEPTIONS + # constant won't be defined. This methods defends against that and returns + # an empty list instead. + def passthrough_exception_types + begin + return PASSTHROUGH_EXCEPTIONS + rescue NameError + # older versions of test/unit do not have PASSTHROUGH_EXCEPTIONS constant + return [] + end + end + end + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/rake_tasks/rdoc.rake b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/rake_tasks/rdoc.rake new file mode 100644 index 0000000..6a6d79f --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/rake_tasks/rdoc.rake @@ -0,0 +1,19 @@ +require 'rake/rdoctask' +require File.expand_path(File.dirname(__FILE__) + "/rdoc_options.rb") + +namespace :doc do + + desc "Generate RDoc documentation" + Rake::RDocTask.new { |rdoc| + rdoc.rdoc_dir = 'doc' + rdoc.title = "Hardmock: Strict expectation-based mock object library " + add_rdoc_options(rdoc.options) + rdoc.rdoc_files.include('lib/**/*.rb', 'README','CHANGES','LICENSE') + } + + task :show => [ 'doc:rerdoc' ] do + sh "open doc/index.html" + end + +end + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/rake_tasks/rdoc_options.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/rake_tasks/rdoc_options.rb new file mode 100644 index 0000000..85bf4ce --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/rake_tasks/rdoc_options.rb @@ -0,0 +1,4 @@ + +def add_rdoc_options(options) + options << '--line-numbers' << '--inline-source' << '--main' << 'README' << '--title' << 'Hardmock' +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/rake_tasks/test.rake b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/rake_tasks/test.rake new file mode 100644 index 0000000..85a3753 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/rake_tasks/test.rake @@ -0,0 +1,22 @@ +require 'rake/testtask' + +namespace :test do + + desc "Run unit tests" + Rake::TestTask.new("units") { |t| + t.libs << "test" + t.pattern = 'test/unit/*_test.rb' + t.verbose = true + } + + desc "Run functional tests" + Rake::TestTask.new("functional") { |t| + t.libs << "test" + t.pattern = 'test/functional/*_test.rb' + t.verbose = true + } + + desc "Run all the tests" + task :all => [ 'test:units', 'test:functional' ] + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/test/functional/assert_error_test.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/test/functional/assert_error_test.rb new file mode 100644 index 0000000..e4b35cf --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/test/functional/assert_error_test.rb @@ -0,0 +1,52 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'assert_error' + +class AssertErrorTest < Test::Unit::TestCase + + it "specfies an error type and message that should be raised" do + assert_error RuntimeError, "Too funky" do + raise RuntimeError.new("Too funky") + end + end + + it "flunks if the error message is wrong" do + err = assert_raise Test::Unit::AssertionFailedError do + assert_error RuntimeError, "not good" do + raise RuntimeError.new("Too funky") + end + end + assert_match(/not good/i, err.message) + assert_match(/too funky/i, err.message) + end + + it "flunks if the error type is wrong" do + err = assert_raise Test::Unit::AssertionFailedError do + assert_error StandardError, "Too funky" do + raise RuntimeError.new("Too funky") + end + end + assert_match(/StandardError/i, err.message) + assert_match(/RuntimeError/i, err.message) + end + + it "can match error message text using a series of Regexps" do + assert_error StandardError, /too/i, /funky/i do + raise StandardError.new("Too funky") + end + end + + it "flunks if the error message doesn't match all the Regexps" do + err = assert_raise Test::Unit::AssertionFailedError do + assert_error StandardError, /way/i, /too/i, /funky/i do + raise StandardError.new("Too funky") + end + end + assert_match(/way/i, err.message) + end + + it "can operate without any message specification" do + assert_error StandardError do + raise StandardError.new("ooof") + end + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/test/functional/auto_verify_test.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/test/functional/auto_verify_test.rb new file mode 100644 index 0000000..1b005bd --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/test/functional/auto_verify_test.rb @@ -0,0 +1,178 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'fileutils' + +class AutoVerifyTest < Test::Unit::TestCase + + def setup + @expect_unmet_expectations = true + end + + def teardown + remove_temp_test_file + end + + # + # TESTS + # + + it "auto-verifies all mocks in teardown" do + write_and_execute_test + end + + it "auto-verifies even if user defines own teardown" do + @teardown_code =<<-EOM + def teardown + # just in the way + end + EOM + write_and_execute_test + end + + should "not obscure normal failures when verification fails" do + @test_code =<<-EOM + def test_setup_doomed_expectation + create_mock :automobile + @automobile.expects.start + flunk "natural failure" + end + EOM + @expect_failures = 1 + write_and_execute_test + end + + should "not skip user-defined teardown when verification fails" do + @teardown_code =<<-EOM + def teardown + puts "User teardown" + end + EOM + write_and_execute_test + assert_output_contains(/User teardown/) + end + + it "is quiet when verification is ok" do + @test_code =<<-EOM + def test_ok + create_mock :automobile + @automobile.expects.start + @automobile.start + end + EOM + @teardown_code =<<-EOM + def teardown + puts "User teardown" + end + EOM + @expect_unmet_expectations = false + @expect_failures = 0 + @expect_errors = 0 + write_and_execute_test + assert_output_contains(/User teardown/) + end + + should "auto-verify even if user teardown explodes" do + @teardown_code =<<-EOM + def teardown + raise "self destruct" + end + EOM + @expect_errors = 2 + write_and_execute_test + assert_output_contains(/self destruct/) + end + + it "plays nice with inherited teardown methods" do + @full_code ||=<<-EOTEST + require File.expand_path(File.dirname(__FILE__) + "/../test_helper") + require 'hardmock' + class Test::Unit::TestCase + def teardown + puts "Test helper teardown" + end + end + class DummyTest < Test::Unit::TestCase + def test_prepare_to_die + create_mock :automobile + @automobile.expects.start + end + end + EOTEST + write_and_execute_test + assert_output_contains(/Test helper teardown/) + end + + # + # HELPERS + # + + def temp_test_file + File.expand_path(File.dirname(__FILE__) + "/tear_down_verification_test.rb") + end + + def run_test(tbody) + File.open(temp_test_file,"w") { |f| f.print(tbody) } + @test_output = `ruby #{temp_test_file} 2>&1` + end + + def formatted_test_output + if @test_output + @test_output.split(/\n/).map { |line| "> #{line}" }.join("\n") + else + "(NO TEST OUTPUT!)" + end + end + + def remove_temp_test_file + FileUtils::rm_f temp_test_file + end + + def assert_results(h) + if @test_output !~ /#{h[:tests]} tests, [0-9]+ assertions, #{h[:failures]} failures, #{h[:errors]} errors/ + flunk "Test results didn't match #{h.inspect}:\n#{formatted_test_output}" + end + end + + def assert_output_contains(*patterns) + patterns.each do |pattern| + if @test_output !~ pattern + flunk "Test output didn't match #{pattern.inspect}:\n#{formatted_test_output}" + end + end + end + + def assert_output_doesnt_contain(*patterns) + patterns.each do |pattern| + assert @test_output !~ pattern, "Output shouldn't match #{pattern.inspect} but it does." + end + end + + def write_and_execute_test + @test_code ||=<<-EOM + def test_setup_doomed_expectation + create_mock :automobile + @automobile.expects.start + end + EOM + @full_code ||=<<-EOTEST + require File.expand_path(File.dirname(__FILE__) + "/../test_helper") + require 'hardmock' + class DummyTest < Test::Unit::TestCase + #{@teardown_code} + #{@test_code} + end + EOTEST + run_test @full_code + + if @expect_unmet_expectations + assert_output_contains(/unmet expectations/i, /automobile/, /start/) + else + assert_output_doesnt_contain(/unmet expectations/i, /automobile/, /start/) + end + + @expect_tests ||= 1 + @expect_failures ||= 0 + @expect_errors ||= 1 + assert_results :tests => @expect_tests, :failures => @expect_failures, :errors => @expect_errors + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/test/functional/direct_mock_usage_test.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/test/functional/direct_mock_usage_test.rb new file mode 100644 index 0000000..dcf2b2a --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/test/functional/direct_mock_usage_test.rb @@ -0,0 +1,396 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock' + +class DirectMockUsageTest < Test::Unit::TestCase + + def setup + @bird = Mock.new('bird') + end + + def teardown + end + + # + # TESTS + # + + it "raises VerifyError if expected method not called" do + @bird.expects.flap_flap + + err = assert_raise VerifyError do + @bird._verify + end + assert_match(/unmet expectations/i, err.message) + end + + should "not raise when expected calls are made in order" do + @bird.expects.flap_flap + @bird.expects.bang + @bird.expects.plop + + @bird.flap_flap + @bird.bang + @bird.plop + + @bird._verify + end + + it "raises ExpectationError when unexpected method are called" do + @bird.expects.flap_flap + + err = assert_raise ExpectationError do + @bird.shoot + end + assert_match(/wrong method/i, err.message) + end + + it "raises ExpectationError on bad arguments" do + @bird.expects.flap_flap(:swoosh) + + err = assert_raise ExpectationError do + @bird.flap_flap(:rip) + end + assert_match(/wrong arguments/i, err.message) + end + + it "raises VerifyError when not all expected methods are called" do + @bird.expects.flap_flap + @bird.expects.bang + @bird.expects.plop + + @bird.flap_flap + + err = assert_raise VerifyError do + @bird._verify + end + assert_match(/unmet expectations/i, err.message) + end + + it "raises ExpectationError when calls are made out of order" do + @bird.expects.flap_flap + @bird.expects.bang + @bird.expects.plop + + @bird.flap_flap + err = assert_raise ExpectationError do + @bird.plop + end + assert_match(/wrong method/i, err.message) + end + + it "returns the configured value" do + @bird.expects.plop.returns(':P') + assert_equal ':P', @bird.plop + @bird._verify + + @bird.expects.plop.returns(':x') + assert_equal ':x', @bird.plop + @bird._verify + end + + it "returns nil when no return is specified" do + @bird.expects.plop + assert_nil @bird.plop + @bird._verify + end + + it "raises the configured exception" do + err = RuntimeError.new('shaq') + @bird.expects.plop.raises(err) + actual_err = assert_raise RuntimeError do + @bird.plop + end + assert_same err, actual_err, 'should be the same error' + @bird._verify + end + + it "raises a RuntimeError when told to 'raise' a string" do + @bird.expects.plop.raises('shaq') + err = assert_raise RuntimeError do + @bird.plop + end + assert_match(/shaq/i, err.message) + @bird._verify + end + + it "raises a default RuntimeError" do + @bird.expects.plop.raises + err = assert_raise RuntimeError do + @bird.plop + end + assert_match(/error/i, err.message) + @bird._verify + end + + it "is quiet when correct arguments given" do + thing = Object.new + @bird.expects.plop(:big,'one',thing) + @bird.plop(:big,'one',thing) + @bird._verify + end + + it "raises ExpectationError when wrong number of arguments specified" do + thing = Object.new + @bird.expects.plop(:big,'one',thing) + err = assert_raise ExpectationError do + # more + @bird.plop(:big,'one',thing,:other) + end + assert_match(/wrong arguments/i, err.message) + @bird._verify + + @bird.expects.plop(:big,'one',thing) + err = assert_raise ExpectationError do + # less + @bird.plop(:big,'one') + end + assert_match(/wrong arguments/i, err.message) + @bird._verify + + @bird.expects.plop + err = assert_raise ExpectationError do + # less + @bird.plop(:big) + end + assert_match(/wrong arguments/i, err.message) + @bird._verify + end + + it "raises ExpectationError when arguments don't match" do + thing = Object.new + @bird.expects.plop(:big,'one',thing) + err = assert_raise ExpectationError do + @bird.plop(:big,'two',thing,:other) + end + assert_match(/wrong arguments/i, err.message) + @bird._verify + end + + it "can use a block for custom reactions" do + mitt = nil + @bird.expects.plop { mitt = :ball } + assert_nil mitt + @bird.plop + assert_equal :ball, mitt, 'didnt catch the ball' + @bird._verify + + @bird.expects.plop { raise 'ball' } + err = assert_raise RuntimeError do + @bird.plop + end + assert_match(/ball/i, err.message) + @bird._verify + end + + it "passes mock-call arguments to the expectation block" do + ball = nil + mitt = nil + @bird.expects.plop {|arg1,arg2| + ball = arg1 + mitt = arg2 + } + assert_nil ball + assert_nil mitt + @bird.plop(:ball,:mitt) + assert_equal :ball, ball + assert_equal :mitt, mitt + @bird._verify + end + + it "validates arguments if specified in addition to a block" do + ball = nil + mitt = nil + @bird.expects.plop(:ball,:mitt) {|arg1,arg2| + ball = arg1 + mitt = arg2 + } + assert_nil ball + assert_nil mitt + @bird.plop(:ball,:mitt) + assert_equal :ball, ball + assert_equal :mitt, mitt + @bird._verify + + ball = nil + mitt = nil + @bird.expects.plop(:bad,:stupid) {|arg1,arg2| + ball = arg1 + mitt = arg2 + } + assert_nil ball + assert_nil mitt + err = assert_raise ExpectationError do + @bird.plop(:ball,:mitt) + end + assert_match(/wrong arguments/i, err.message) + assert_nil ball + assert_nil mitt + @bird._verify + + ball = nil + mitt = nil + @bird.expects.plop(:ball,:mitt) {|arg1,arg2| + ball = arg1 + mitt = arg2 + } + assert_nil ball + assert_nil mitt + err = assert_raise ExpectationError do + @bird.plop(:ball) + end + assert_match(/wrong arguments/i, err.message) + assert_nil ball + assert_nil mitt + @bird._verify + end + + it "passes runtime blocks to the expectation block as the final argument" do + runtime_block_called = false + got_arg = nil + + # Eg, bird expects someone to subscribe to :tweet using the 'when' method + @bird.expects.when(:tweet) { |arg1, block| + got_arg = arg1 + block.call + } + + @bird.when(:tweet) do + runtime_block_called = true + end + + assert_equal :tweet, got_arg, "Wrong arg" + assert runtime_block_called, "The runtime block should have been invoked by the user block" + + @bird.expects.when(:warnk) { |e,blk| } + + err = assert_raise ExpectationError do + @bird.when(:honk) { } + end + assert_match(/wrong arguments/i, err.message) + + @bird._verify + end + + it "passes the runtime block to the expectation block as sole argument if no other args come into play" do + runtime_block_called = false + @bird.expects.subscribe { |block| block.call } + @bird.subscribe do + runtime_block_called = true + end + assert runtime_block_called, "The runtime block should have been invoked by the user block" + end + + it "provides nil as final argument if expectation block seems to want a block" do + invoked = false + @bird.expects.kablam(:scatter) { |shot,block| + assert_equal :scatter, shot, "Wrong shot" + assert_nil block, "The expectation block should get a nil block when user neglects to pass one" + invoked = true + } + @bird.kablam :scatter + assert invoked, "Expectation block not invoked" + + @bird._verify + end + + it "can set explicit return after an expectation block" do + got = nil + @bird.expects.kablam(:scatter) { |shot| + got = shot + }.returns(:death) + + val = @bird.kablam :scatter + assert_equal :death, val, "Wrong return value" + assert_equal :scatter, got, "Wrong argument" + @bird._verify + end + + it "can raise after an expectation block" do + got = nil + @bird.expects.kablam(:scatter) do |shot| + got = shot + end.raises "hell" + + err = assert_raise RuntimeError do + @bird.kablam :scatter + end + assert_match(/hell/i, err.message) + + @bird._verify + end + + it "stores the semantic value of the expectation block after it executes" do + expectation = @bird.expects.kablam(:slug) { |shot| + "The shot was #{shot}" + } + + assert_not_nil expectation, "Expectation nil" + assert_nil expectation.block_value, "Block value should start out nil" + + ret_val = @bird.kablam :slug + + assert_equal "The shot was slug", expectation.block_value + assert_equal "The shot was slug", ret_val, "Block value should also be used for return" + + @bird._verify + end + + + it "uses the value of the expectation block as the default return value" do + @bird.expects.kablam(:scatter) { |shot| + "The shot was #{shot}" + } + val = @bird.kablam :scatter + assert_equal "The shot was scatter", val, "Wrong return value" + @bird._verify + end + + it "returns the Expectation even if 'returns' is used" do + expectation = @bird.expects.kablam(:slug) { |shot| + "The shot was #{shot}" + }.returns :hosed + + assert_not_nil expectation, "Expectation nil" + assert_nil expectation.block_value, "Block value should start out nil" + + ret_val = @bird.kablam :slug + + assert_equal "The shot was slug", expectation.block_value + assert_equal :hosed, ret_val, "Block value should also be used for return" + + @bird._verify + end + + it "returns the Expectation even if 'raises' is used" do + expectation = @bird.expects.kablam(:slug) { |shot| + "The shot was #{shot}" + }.raises "aiee!" + + assert_not_nil expectation, "Expectation nil" + assert_nil expectation.block_value, "Block value should start out nil" + + err = assert_raise RuntimeError do + @bird.kablam :slug + end + assert_match(/aiee!/i, err.message) + assert_equal "The shot was slug", expectation.block_value + @bird._verify + end + + + it "supports assignment-style methods" do + @bird.expects.size = "large" + @bird.size = "large" + @bird._verify + end + + it "supports assignments and raising (using explicit-method syntax)" do + @bird.expects('size=','large').raises "boom" + + err = assert_raise RuntimeError do + @bird.size = "large" + end + assert_match(/boom/i, err.message) + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/test/functional/hardmock_test.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/test/functional/hardmock_test.rb new file mode 100644 index 0000000..159d369 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/test/functional/hardmock_test.rb @@ -0,0 +1,434 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock' +require 'assert_error' + +class HardmockTest < Test::Unit::TestCase + + # + # TESTS + # + + it "conveniently creates mocks using create_mock and create_mocks" do + + h = create_mock :donkey + assert_equal [ :donkey ], h.keys + + assert_mock_exists :donkey + assert_same @donkey, h[:donkey] + + assert_equal [ :donkey ], @all_mocks.keys, "Wrong keyset for @all_mocks" + + h2 = create_mocks :cat, 'dog' # symbol/string indifference at this level + assert_equal [:cat,:dog].to_set, h2.keys.to_set, "Wrong keyset for second hash" + assert_equal [:cat,:dog,:donkey].to_set, @all_mocks.keys.to_set, "@all_mocks wrong" + + assert_mock_exists :cat + assert_same @cat, h2[:cat] + assert_mock_exists :dog + assert_same @dog, h2[:dog] + + assert_mock_exists :donkey + end + + it "provides literal 'expects' syntax" do + assert_nil @order, "Should be no @order yet" + create_mock :order + assert_not_nil @order, "@order should be built" + + # Setup an expectation + @order.expects.update_stuff :key1 => 'val1', :key2 => 'val2' + + # Use the mock + @order.update_stuff :key1 => 'val1', :key2 => 'val2' + + # Verify + verify_mocks + + # See that it's ok to do it again + verify_mocks + end + + it "supports 'with' for specifying argument expectations" do + create_mocks :car + @car.expects(:fill).with('gas','booze') + @car.fill('gas', 'booze') + verify_mocks + end + + it "supports several mocks at once" do + create_mocks :order_builder, :order, :customer + + @order_builder.expects.create_new_order.returns @order + @customer.expects.account_number.returns(1234) + @order.expects.account_no = 1234 + @order.expects.save! + + # Run "the code" + o = @order_builder.create_new_order + o.account_no = @customer.account_number + o.save! + + verify_mocks + end + + it "enforces inter-mock call ordering" do + create_mocks :order_builder, :order, :customer + + @order_builder.expects.create_new_order.returns @order + @customer.expects.account_number.returns(1234) + @order.expects.account_no = 1234 + @order.expects.save! + + # Run "the code" + o = @order_builder.create_new_order + err = assert_raise ExpectationError do + o.save! + end + assert_match(/wrong object/i, err.message) + assert_match(/order.save!/i, err.message) + assert_match(/customer.account_number/i, err.message) + + assert_error VerifyError, /unmet expectations/i do + verify_mocks + end + end + + class UserPresenter + def initialize(args) + view = args[:view] + model = args[:model] + model.when :data_changes do + view.user_name = model.user_name + end + view.when :user_edited do + model.user_name = view.user_name + end + end + end + + it "makes MVP testing simple" do + mox = create_mocks :model, :view + + data_change = @model.expects.when(:data_changes) { |evt,block| block } + user_edit = @view.expects.when(:user_edited) { |evt,block| block } + + UserPresenter.new mox + + # Expect user name transfer from model to view + @model.expects.user_name.returns 'Da Croz' + @view.expects.user_name = 'Da Croz' + # Trigger data change event in model + data_change.block_value.call + + # Expect user name transfer from view to model + @view.expects.user_name.returns '6:8' + @model.expects.user_name = '6:8' + # Trigger edit event in view + user_edit.block_value.call + + verify_mocks + end + + it "continues to function after verify, if verification error is controlled" do + mox = create_mocks :model, :view + data_change = @model.expects.when(:data_changes) { |evt,block| block } + user_edit = @view.expects.when(:user_edited) { |evt,block| block } + UserPresenter.new mox + + # Expect user name transfer from model to view + @model.expects.user_name.returns 'Da Croz' + @view.expects.user_name = 'Da Croz' + + assert_error ExpectationError, /model.monkey_wrench/i do + @model.monkey_wrench + end + + # This should raise because of unmet expectations + assert_error VerifyError, /unmet expectations/i, /user_name/i do + verify_mocks + end + + # See that the non-forced verification remains quiet + assert_nothing_raised VerifyError do + verify_mocks(false) + end + + @model.expects.never_gonna_happen + + assert_error VerifyError, /unmet expectations/i, /never_gonna_happen/i do + verify_mocks + end + end + + class UserPresenterBroken + def initialize(args) + view = args[:view] + model = args[:model] + model.when :data_changes do + view.user_name = model.user_name + end + # no view stuff, will break appropriately + end + end + + it "flunks for typical Presenter constructor wiring failure" do + mox = create_mocks :model, :view + + data_change = @model.expects.when(:data_changes) { |evt,block| block } + user_edit = @view.expects.when(:user_edited) { |evt,block| block } + + UserPresenterBroken.new mox + + err = assert_raise VerifyError do + verify_mocks + end + assert_match(/unmet expectations/i, err.message) + assert_match(/view.when\(:user_edited\)/i, err.message) + + end + + it "provides convenient event-subscription trap syntax for MVP testing" do + mox = create_mocks :model, :view + + data_change = @model.trap.when(:data_changes) + user_edit = @view.trap.when(:user_edited) + + UserPresenter.new mox + + # Expect user name transfer from model to view + @model.expects.user_name.returns 'Da Croz' + @view.expects.user_name = 'Da Croz' + # Trigger data change event in model + data_change.trigger + + # Expect user name transfer from view to model + @view.expects.user_name.returns '6:8' + @model.expects.user_name = '6:8' + # Trigger edit event in view + user_edit.trigger + + verify_mocks + end + + it "raises if you try to pass an expectation block to 'trap'" do + create_mock :model + assert_error Hardmock::ExpectationError, /blocks/i, /trap/i do + @model.trap.when(:some_event) do raise "huh?" end + end + end + + class Grinder + def initialize(objects) + @chute = objects[:chute] + @bucket = objects[:bucket] + @blade = objects[:blade] + end + + def grind(slot) + @chute.each_bean(slot) do |bean| + @bucket << @blade.chop(bean) + end + end + end + + it "lets you write clear iteration-oriented expectations" do + grinder = Grinder.new create_mocks(:blade, :chute, :bucket) + + # Style 1: assertions on method args is done explicitly in block + @chute.expects.each_bean { |slot,block| + assert_equal :side_slot, slot, "Wrong slot" + block.call :bean1 + block.call :bean2 + } + + @blade.expects.chop(:bean1).returns(:grounds1) + @bucket.expects('<<', :grounds1) + + @blade.expects.chop(:bean2).returns(:grounds2) + @bucket.expects('<<', :grounds2) + + # Run "the code" + grinder.grind(:side_slot) + + verify_mocks + + # Style 2: assertions on method arguments done implicitly in the expectation code + @chute.expects.each_bean(:main_slot) { |slot,block| + block.call :bean3 + } + @blade.expects.chop(:bean3).returns(:grounds3) + @bucket.expects('<<', :grounds3) + grinder.grind :main_slot + verify_mocks + end + + it "further supports iteration testing using 'yield'" do + grinder = Grinder.new create_mocks(:blade, :chute, :bucket) + + @chute.expects.each_bean(:side_slot).yields :bean1, :bean2 + + @blade.expects.chop(:bean1).returns(:grounds1) + @bucket.expects('<<', :grounds1) + + @blade.expects.chop(:bean2).returns(:grounds2) + @bucket.expects('<<', :grounds2) + + grinder.grind :side_slot + + verify_mocks + end + + class HurtLocker + attr_reader :caught + def initialize(opts) + @locker = opts[:locker] + @store = opts[:store] + end + + def do_the_thing(area,data) + @locker.with_lock(area) do + @store.eat(data) + end + rescue => oops + @caught = oops + end + end + + it "makes mutex-style locking scenarios easy to test" do + hurt = HurtLocker.new create_mocks(:locker, :store) + + @locker.expects.with_lock(:main).yields + @store.expects.eat("some info") + + hurt.do_the_thing(:main, "some info") + + verify_mocks + end + + it "makes it easy to simulate error in mutex-style locking scenarios" do + hurt = HurtLocker.new create_mocks(:locker, :store) + err = StandardError.new('fmshooop') + @locker.expects.with_lock(:main).yields + @store.expects.eat("some info").raises(err) + + hurt.do_the_thing(:main, "some info") + + assert_same err, hurt.caught, "Expected that error to be handled internally" + verify_mocks + end + + it "actually returns 'false' instead of nil when mocking boolean return values" do + create_mock :car + @car.expects.ignition_on?.returns(true) + assert_equal true, @car.ignition_on?, "Should be true" + @car.expects.ignition_on?.returns(false) + assert_equal false, @car.ignition_on?, "Should be false" + end + + it "can mock most methods inherited from object using literal syntax" do + target_methods = %w|id clone display dup eql? ==| + create_mock :foo + target_methods.each do |m| + eval %{@foo.expects(m, "some stuff")} + eval %{@foo.#{m} "some stuff"} + end + end + + it "provides 'expect' as an alias for 'expects'" do + create_mock :foo + @foo.expect.boomboom + @foo.boomboom + verify_mocks + end + + it "provides 'should_receive' as an alias for 'expects'" do + create_mock :foo + @foo.should_receive.boomboom + @foo.boomboom + verify_mocks + end + + it "provides 'and_return' as an alias for 'returns'" do + create_mock :foo + @foo.expects(:boomboom).and_return :brick + assert_equal :brick, @foo.boomboom + verify_mocks + end + + it "does not interfere with a core subset of Object methods" do + create_mock :foo + @foo.method(:inspect) + @foo.inspect + @foo.to_s + @foo.instance_variables + @foo.instance_eval("") + verify_mocks + end + + it "can raise errors from within an expectation block" do + create_mock :cat + @cat.expects.meow do |arg| + assert_equal "mix", arg + raise 'HAIRBALL' + end + assert_error RuntimeError, 'HAIRBALL' do + @cat.meow("mix") + end + end + + it "can raise errors AFTER an expectation block" do + create_mock :cat + @cat.expects.meow do |arg| + assert_equal "mix", arg + end.raises('HAIRBALL') + assert_error RuntimeError, 'HAIRBALL' do + @cat.meow("mix") + end + end + + it "raises an immediate error if a mock is created with a nil name (common mistake: create_mock @cat)" do + # I make this mistake all the time: Typing in an instance var name instead of a symbol in create_mocks. + # When you do that, you're effectively passing nil(s) in as mock names. + assert_error ArgumentError, /'nil' is not a valid name for a mock/ do + create_mocks @apples, @oranges + end + end + + it "overrides 'inspect' to make nice output" do + create_mock :hay_bailer + assert_equal "", @hay_bailer.inspect, "Wrong output from 'inspect'" + end + + it "raises if prepare_hardmock_control is invoked after create_mocks, or more than once" do + create_mock :hi_there + create_mocks :another, :one + assert_error RuntimeError, /already setup/ do + prepare_hardmock_control + end + end + + should "support alias verify_hardmocks" do + create_mock :tree + @tree.expects(:grow) + assert_error VerifyError, /unmet/i do + verify_hardmocks + end + end + + # + # HELPERS + # + + def assert_mock_exists(name) + assert_not_nil @all_mocks, "@all_mocks not here yet" + mo = @all_mocks[name] + assert_not_nil mo, "Mock '#{name}' not in @all_mocks" + assert_kind_of Mock, mo, "Wrong type of object, wanted a Mock" + assert_equal name.to_s, mo._name, "Mock '#{name}' had wrong name" + ivar = self.instance_variable_get("@#{name}") + assert_not_nil ivar, "Mock '#{name}' not set as ivar" + assert_same mo, ivar, "Mock '#{name}' ivar not same as instance in @all_mocks" + assert_same @main_mock_control, mo._control, "Mock '#{name}' doesn't share the main mock control" + end +end + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/test/functional/stubbing_test.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/test/functional/stubbing_test.rb new file mode 100644 index 0000000..f07a670 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/test/functional/stubbing_test.rb @@ -0,0 +1,479 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock' +require 'assert_error' + +class StubbingTest < Test::Unit::TestCase + + # + # TESTS + # + + it "stubs a class method (and un-stubs after reset_stubs)" do + assert_equal "stones and gravel", Concrete.pour + assert_equal "glug glug", Jug.pour + + Concrete.stubs!(:pour).returns("dust and plaster") + + 3.times do + assert_equal "dust and plaster", Concrete.pour + end + + assert_equal "glug glug", Jug.pour, "Jug's 'pour' method broken" + assert_equal "stones and gravel", Concrete._hardmock_original_pour, "Original 'pour' method not aliased" + + assert_equal "For roads", Concrete.describe, "'describe' method broken" + + reset_stubs + + assert_equal "stones and gravel", Concrete.pour, "'pour' method not restored" + assert_equal "For roads", Concrete.describe, "'describe' method broken after verify" + + end + + it "stubs several class methods" do + Concrete.stubs!(:pour).returns("sludge") + Concrete.stubs!(:describe).returns("awful") + Jug.stubs!(:pour).returns("milk") + + assert_equal "sludge", Concrete.pour + assert_equal "awful", Concrete.describe + assert_equal "milk", Jug.pour + + reset_stubs + + assert_equal "stones and gravel", Concrete.pour + assert_equal "For roads", Concrete.describe + assert_equal "glug glug", Jug.pour + end + + it "stubs instance methods" do + slab = Concrete.new + assert_equal "bonk", slab.hit + + slab.stubs!(:hit).returns("slap") + assert_equal "slap", slab.hit, "'hit' not stubbed" + + reset_stubs + + assert_equal "bonk", slab.hit, "'hit' not restored" + end + + it "stubs instance methods without breaking class methods or other instances" do + slab = Concrete.new + scrape = Concrete.new + assert_equal "an instance", slab.describe + assert_equal "an instance", scrape.describe + assert_equal "For roads", Concrete.describe + + slab.stubs!(:describe).returns("new instance describe") + assert_equal "new instance describe", slab.describe, "'describe' on instance not stubbed" + assert_equal "an instance", scrape.describe, "'describe' on 'scrape' instance broken" + assert_equal "For roads", Concrete.describe, "'describe' class method broken" + + reset_stubs + + assert_equal "an instance", slab.describe, "'describe' instance method not restored" + assert_equal "an instance", scrape.describe, "'describe' on 'scrape' instance broken after restore" + assert_equal "For roads", Concrete.describe, "'describe' class method broken after restore" + end + + should "allow stubbing of nonexistant class methods" do + Concrete.stubs!(:funky).returns('juice') + assert_equal 'juice', Concrete.funky + end + + should "allow stubbing of nonexistant instance methods" do + chunk = Concrete.new + chunk.stubs!(:shark).returns('bite') + assert_equal 'bite', chunk.shark + end + + should "allow re-stubbing" do + Concrete.stubs!(:pour).returns("one") + assert_equal "one", Concrete.pour + + Concrete.stubs!(:pour).raises("hell") + assert_error RuntimeError, /hell/ do + Concrete.pour + end + + Concrete.stubs!(:pour).returns("two") + assert_equal "two", Concrete.pour + + reset_stubs + + assert_equal "stones and gravel", Concrete.pour + end + + it "does nothing with a runtime block when simply stubbing" do + slab = Concrete.new + slab.stubs!(:hit) do |nothing| + raise "BOOOMM!" + end + slab.hit + reset_stubs + end + + it "can raise errors from a stubbed method" do + Concrete.stubs!(:pour).raises(StandardError.new("no!")) + assert_error StandardError, /no!/ do + Concrete.pour + end + end + + it "provides string syntax for convenient raising of RuntimeErrors" do + Concrete.stubs!(:pour).raises("never!") + assert_error RuntimeError, /never!/ do + Concrete.pour + end + end + + + # + # Per-method mocking on classes or instances + # + + it "mocks specific methods on existing classes, and returns the class method to normal after verification" do + + assert_equal "stones and gravel", Concrete.pour, "Concrete.pour is already messed up" + + Concrete.expects!(:pour).returns("ALIGATORS") + assert_equal "ALIGATORS", Concrete.pour + + verify_mocks + assert_equal "stones and gravel", Concrete.pour, "Concrete.pour not restored" + end + + it "flunks if expected class method is not invoked" do + + Concrete.expects!(:pour).returns("ALIGATORS") + assert_error(Hardmock::VerifyError, /Concrete.pour/, /unmet expectations/i) do + verify_mocks + end + clear_expectations + end + + it "supports all normal mock functionality for class methods" do + + Concrete.expects!(:pour, "two tons").returns("mice") + Concrete.expects!(:pour, "three tons").returns("cats") + Concrete.expects!(:pour, "four tons").raises("Can't do it") + Concrete.expects!(:pour) do |some, args| + "==#{some}+#{args}==" + end + + assert_equal "mice", Concrete.pour("two tons") + assert_equal "cats", Concrete.pour("three tons") + assert_error(RuntimeError, /Can't do it/) do + Concrete.pour("four tons") + end + assert_equal "==first+second==", Concrete.pour("first","second") + end + + + it "enforces inter-mock ordering when mocking class methods" do + create_mocks :truck, :foreman + + @truck.expects.backup + Concrete.expects!(:pour, "something") + @foreman.expects.shout + + @truck.backup + assert_error Hardmock::ExpectationError, /wrong/i, /expected call/i, /Concrete.pour/ do + @foreman.shout + end + assert_error Hardmock::VerifyError, /unmet expectations/i, /foreman.shout/ do + verify_mocks + end + clear_expectations + end + + should "allow mocking non-existant class methods" do + Concrete.expects!(:something).returns("else") + assert_equal "else", Concrete.something + end + + it "mocks specific methods on existing instances, then restore them after verify" do + + slab = Concrete.new + assert_equal "bonk", slab.hit + + slab.expects!(:hit).returns("slap") + assert_equal "slap", slab.hit, "'hit' not stubbed" + + verify_mocks + assert_equal "bonk", slab.hit, "'hit' not restored" + end + + it "flunks if expected instance method is not invoked" do + + slab = Concrete.new + slab.expects!(:hit) + + assert_error Hardmock::VerifyError, /unmet expectations/i, /Concrete.hit/ do + verify_mocks + end + clear_expectations + end + + it "supports all normal mock functionality for instance methods" do + + slab = Concrete.new + + slab.expects!(:hit, "soft").returns("hey") + slab.expects!(:hit, "hard").returns("OOF") + slab.expects!(:hit).raises("stoppit") + slab.expects!(:hit) do |some, args| + "==#{some}+#{args}==" + end + + assert_equal "hey", slab.hit("soft") + assert_equal "OOF", slab.hit("hard") + assert_error(RuntimeError, /stoppit/) do + slab.hit + end + assert_equal "==first+second==", slab.hit("first","second") + + end + + it "enforces inter-mock ordering when mocking instance methods" do + create_mocks :truck, :foreman + slab1 = Concrete.new + slab2 = Concrete.new + + @truck.expects.backup + slab1.expects!(:hit) + @foreman.expects.shout + slab2.expects!(:hit) + @foreman.expects.whatever + + @truck.backup + slab1.hit + @foreman.shout + assert_error Hardmock::ExpectationError, /wrong/i, /expected call/i, /Concrete.hit/ do + @foreman.whatever + end + assert_error Hardmock::VerifyError, /unmet expectations/i, /foreman.whatever/ do + verify_mocks + end + clear_expectations + end + + should "allow mocking non-existant instance methods" do + slab = Concrete.new + slab.expects!(:wholly).returns('happy') + assert_equal 'happy', slab.wholly + end + + should "support concrete expectations that deal with runtime blocks" do + + Concrete.expects!(:pour, "a lot") do |how_much, block| + assert_equal "a lot", how_much, "Wrong how_much arg" + assert_not_nil block, "nil runtime block" + assert_equal "the block value", block.call, "Wrong runtime block value" + end + + Concrete.pour("a lot") do + "the block value" + end + + end + + it "can stub methods on mock objects" do + create_mock :horse + @horse.stubs!(:speak).returns("silence") + @horse.stubs!(:hello).returns("nothing") + @horse.expects(:canter).returns("clip clop") + + assert_equal "silence", @horse.speak + assert_equal "clip clop", @horse.canter + assert_equal "silence", @horse.speak + assert_equal "silence", @horse.speak + assert_equal "nothing", @horse.hello + assert_equal "nothing", @horse.hello + + verify_mocks + reset_stubs + end + + it "can stub the new method and return values" do + Concrete.stubs!(:new).returns("this value") + assert_equal "this value", Concrete.new, "did not properly stub new class method" + reset_stubs + end + + it "can mock the new method and return values" do + Concrete.expects!(:new).with("foo").returns("hello") + Concrete.expects!(:new).with("bar").returns("world") + + assert_equal "hello", Concrete.new("foo"), "did not properly mock out new class method" + assert_equal "world", Concrete.new("bar"), "did not properly mock out new class method" + + verify_mocks + reset_stubs + end + + it "can mock several different class methods at once" do + sim_code = lambda do |input| + record = Multitool.find_record(input) + report = Multitool.generate_report(record) + Multitool.format_output(report) + end + + @identifier = "the id" + @record = "the record" + @report = "the report" + @output = "the output" + + Multitool.expects!(:find_record).with(@identifier).returns(@record) + Multitool.expects!(:generate_report).with(@record).returns(@report) + Multitool.expects!(:format_output).with(@report).returns(@output) + + result = sim_code.call(@identifier) + assert_equal @output, result, "Wrong output" + end + + it "can handle a mix of different and repeat class method mock calls" do + prep = lambda { + Multitool.expects!(:find_record).with("A").returns("1") + Multitool.expects!(:generate_report).with("1") + Multitool.expects!(:find_record).with("B").returns("2") + Multitool.expects!(:generate_report).with("2") + } + + prep[] + Multitool.generate_report(Multitool.find_record("A")) + Multitool.generate_report(Multitool.find_record("B")) + + prep[] + Multitool.generate_report(Multitool.find_record("A")) + assert_error Hardmock::ExpectationError, /Wrong arguments/, /find_record\("B"\)/, /find_record\("C"\)/ do + Multitool.generate_report(Multitool.find_record("C")) + end + clear_expectations + end + + it "can mock several concrete instance methods at once" do + inst = OtherMultitool.new + sim_code = lambda do |input| + record = inst.find_record(input) + report = inst.generate_report(record) + inst.format_output(report) + end + + @identifier = "the id" + @record = "the record" + @report = "the report" + @output = "the output" + + inst.expects!(:find_record).with(@identifier).returns(@record) + inst.expects!(:generate_report).with(@record).returns(@report) + inst.expects!(:format_output).with(@report).returns(@output) + + result = sim_code.call(@identifier) + assert_equal @output, result, "Wrong output" + end + + it "verifies all concrete expects! from several different expectations" do + Multitool.expects!(:find_record) + Multitool.expects!(:generate_report) + Multitool.expects!(:format_output) + + Multitool.find_record + Multitool.generate_report + + assert_error Hardmock::VerifyError, /unmet expectations/i, /format_output/i do + verify_mocks + end + end + + it "will not allow expects! to be used on a mock object" do + create_mock :cow + assert_error Hardmock::StubbingError, /expects!/, /mock/i, /something/ do + @cow.expects!(:something) + end + end + + it "does not allow stubbing on nil objects" do + [ nil, @this_is_nil ].each do |nil_obj| + assert_error Hardmock::StubbingError, /cannot/i, /nil/i, /intentionally/ do + nil_obj.stubs!(:wont_work) + end + end + end + + it "does not allow concrete method mocking on nil objects" do + [ nil, @this_is_nil ].each do |nil_obj| + assert_error Hardmock::StubbingError, /cannot/i, /nil/i, /intentionally/ do + nil_obj.expects!(:wont_work) + end + end + end + + it "provides an alternate method for stubbing on nil objects" do + @this_is_nil.intentionally_stubs!(:bogus).returns('output') + assert_equal 'output', @this_is_nil.bogus + end + + it "provides an alternate method for mocking concreate methods on nil objects" do + @this_is_nil.intentionally_expects!(:bogus).returns('output') + assert_error Hardmock::VerifyError, /unmet expectations/i, /NilClass.bogus/ do + verify_mocks + end + end + + # + # HELPERS + # + + class Concrete + def initialize; end + def self.pour + "stones and gravel" + end + + def self.describe + "For roads" + end + + def hit + "bonk" + end + + def describe + "an instance" + end + end + + class Jug + def self.pour + "glug glug" + end + end + + class Multitool + def self.find_record(*a) + raise "The real Multitool.find_record was called with #{a.inspect}" + end + def self.generate_report(*a) + raise "The real Multitool.generate_report was called with #{a.inspect}" + end + def self.format_output(*a) + raise "The real Multitool.format_output was called with #{a.inspect}" + end + end + + class OtherMultitool + def find_record(*a) + raise "The real OtherMultitool#find_record was called with #{a.inspect}" + end + def generate_report(*a) + raise "The real OtherMultitool#generate_report was called with #{a.inspect}" + end + def format_output(*a) + raise "The real OtherMultitool#format_output was called with #{a.inspect}" + end + end + +end + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/test/test_helper.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/test/test_helper.rb new file mode 100644 index 0000000..af159a4 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/test/test_helper.rb @@ -0,0 +1,43 @@ +here = File.expand_path(File.dirname(__FILE__)) +$: << here + +require "#{here}/../config/environment" +require 'test/unit' +require 'fileutils' +require 'logger' +require 'find' +require 'yaml' +require 'set' +require 'ostruct' + +class Test::Unit::TestCase + include FileUtils + + def poll(time_limit) + (time_limit * 10).to_i.times do + return true if yield + sleep 0.1 + end + return false + end + + def self.it(str, &block) + make_test_case "it", str, &block + end + + def self.should(str, &block) + make_test_case "should", str, &block + end + + def self.make_test_case(prefix, str, &block) + tname = self.name.sub(/Test$/,'') + if block + define_method "test #{prefix} #{str}" do + instance_eval &block + end + else + puts ">>> UNIMPLEMENTED CASE: #{tname}: #{str}" + end + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/test/unit/expectation_builder_test.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/test/unit/expectation_builder_test.rb new file mode 100644 index 0000000..f689f98 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/test/unit/expectation_builder_test.rb @@ -0,0 +1,19 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/expectation_builder' + +class ExpectationBuilderTest < Test::Unit::TestCase + include Hardmock + + def test_build_expectation + builder = ExpectationBuilder.new + + ex = builder.build_expectation( :stuff => 'inside' ) + assert_not_nil ex, "Didn't build an expectation" + assert_kind_of Expectation, ex, "Wrong type!" + + # Shhhh... fragile, yes, whatever. The functional tests do the + # real testing of this anyway + assert_equal({:stuff => 'inside'}, ex.instance_variable_get('@options'), "Hash not sent to SimpleExpectation constructor") + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/test/unit/expectation_test.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/test/unit/expectation_test.rb new file mode 100644 index 0000000..54bd204 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/test/unit/expectation_test.rb @@ -0,0 +1,372 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/expectation' +require 'hardmock/errors' +require 'assert_error' + +class ExpectationTest < Test::Unit::TestCase + include Hardmock + + def setup + @mock = TheMock.new + end + # + # HELPERS + # + + class TheMock + def _name; 'the_mock'; end + end + class OtherMock + def _name; 'other_mock'; end + end + + # + # TESTS + # + + def test_to_s + ex = Expectation.new( :mock => @mock, :method => 'a_func', :arguments => [1, "two", :three, { :four => 4 }] ) + assert_equal %|the_mock.a_func(1, "two", :three, {:four=>4})|, ex.to_s + end + + def test_apply_method_call + se = Expectation.new(:mock => @mock, :method => 'some_func', + :arguments => [1,'two',:three] ) + + # Try it good: + assert_nothing_raised ExpectationError do + se.apply_method_call( @mock, 'some_func', [1,'two',:three], nil ) + end + + # Bad func name: + err = assert_raise ExpectationError do + se.apply_method_call( @mock, 'wrong_func', [1,'two',:three], nil ) + end + assert_match(/wrong method/i, err.message) + assert_match(/wrong_func/i, err.message) + assert_match(/[1, "two", :three]/i, err.message) + assert_match(/some_func/i, err.message) + assert_match(/the_mock/i, err.message) + + # Wrong mock + err = assert_raise ExpectationError do + se.apply_method_call( OtherMock.new, 'some_func', [1,'two',:three], nil ) + end + assert_match(/[1, "two", :three]/i, err.message) + assert_match(/some_func/i, err.message) + assert_match(/the_mock/i, err.message) + assert_match(/other_mock/i, err.message) + + # Wrong args + err = assert_raise ExpectationError do + se.apply_method_call( @mock, 'some_func', [1,'two',:four], nil) + end + assert_match(/[1, "two", :three]/i, err.message) + assert_match(/[1, "two", :four]/i, err.message) + assert_match(/wrong arguments/i, err.message) + assert_match(/some_func/i, err.message) + end + + def test_apply_method_call_should_call_proc_when_given + # now with a proc + thinger = nil + the_proc = Proc.new { thinger = :shaq } + se = Expectation.new(:mock => @mock, :method => 'some_func', + :block => the_proc) + + # Try it good: + assert_nil thinger + assert_nothing_raised ExpectationError do + se.apply_method_call(@mock, 'some_func', [], nil) + end + assert_equal :shaq, thinger, 'wheres shaq??' + end + + def test_apply_method_call_passes_runtime_block_as_last_argument_to_expectation_block + + passed_block = nil + exp_block_called = false + exp_block = Proc.new { |blk| + exp_block_called = true + passed_block = blk + } + + se = Expectation.new(:mock => @mock, :method => 'some_func', :block => exp_block, + :arguments => []) + + set_flag = false + runtime_block = Proc.new { set_flag = true } + + assert_nil passed_block, "Passed block should be nil" + assert !set_flag, "set_flag should be off" + + # Go + se.apply_method_call( @mock, 'some_func', [], runtime_block) + + # Examine the passed block + assert exp_block_called, "Expectation block not called" + assert_not_nil passed_block, "Should have been passed a block" + assert !set_flag, "set_flag should still be off" + passed_block.call + assert set_flag, "set_flag should be on" + end + + def test_apply_method_call_fails_when_theres_no_expectation_block_to_handle_the_runtime_block + se = Expectation.new(:mock => @mock, :method => 'some_func', :arguments => []) + runtime_block = Proc.new { set_flag = true } + err = assert_raise ExpectationError do + se.apply_method_call( @mock, 'some_func', [], runtime_block) + end + assert_match(/unexpected block/i, err.message) + assert_match(/the_mock.some_func()/i, err.message) + end + + def test_returns + se = Expectation.new(:mock => @mock, :method => 'some_func', + :arguments => [1,'two',:three]) + + se.returns "A value" + + assert_equal "A value", se.apply_method_call(@mock, 'some_func', [1,'two',:three], nil) + end + + def test_apply_method_call_captures_block_value + the_proc = lambda { "in the block" } + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => [], :block => the_proc) + + assert_nil se.block_value, "Block value starts out nil" + + se.apply_method_call(@mock, 'do_it', [], nil) + + assert_equal "in the block", se.block_value, "Block value not captured" + end + + def test_trigger + # convenience method for block_value.call + target = false + inner_proc = lambda { target = true } + the_proc = lambda { inner_proc } + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => [], :block => the_proc) + + assert_nil se.block_value, "Block value starts out nil" + se.apply_method_call(@mock, 'do_it', [], nil) + assert_not_nil se.block_value, "Block value not set" + + assert !target, "Target should still be false" + se.trigger + assert target, "Target not true!" + end + + def test_trigger_with_arguments + # convenience method for block_value.call + target = nil + inner_proc = lambda { |one,two| target = [one,two] } + the_proc = lambda { inner_proc } + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => [], :block => the_proc) + + assert_nil se.block_value, "Block value starts out nil" + se.apply_method_call(@mock, 'do_it', [], nil) + assert_not_nil se.block_value, "Block value not set" + + assert_nil target, "target should still be nil" + se.trigger 'cat','dog' + assert_equal ['cat','dog'], target + end + + def test_trigger_nil_block_value + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => []) + + assert_nil se.block_value, "Block value starts out nil" + se.apply_method_call(@mock, 'do_it', [], nil) + assert_nil se.block_value, "Block value should still be nil" + + err = assert_raise ExpectationError do + se.trigger + end + assert_match(/do_it/i, err.message) + assert_match(/block value/i, err.message) + end + + def test_trigger_non_proc_block_value + the_block = lambda { "woops" } + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => [], :block => the_block) + + se.apply_method_call(@mock, 'do_it', [], nil) + assert_equal "woops", se.block_value + + err = assert_raise ExpectationError do + se.trigger + end + assert_match(/do_it/i, err.message) + assert_match(/trigger/i, err.message) + assert_match(/woops/i, err.message) + end + + + + def test_proc_used_for_return + the_proc = lambda { "in the block" } + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => [], :block => the_proc) + + assert_equal "in the block", se.apply_method_call(@mock, 'do_it', [], nil) + assert_equal "in the block", se.block_value, "Captured block value affected wrongly" + end + + def test_explicit_return_overrides_proc_return + the_proc = lambda { "in the block" } + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => [], :block => the_proc) + se.returns "the override" + assert_equal "the override", se.apply_method_call(@mock, 'do_it', [], nil) + assert_equal "in the block", se.block_value, "Captured block value affected wrongly" + end + + def test_yields + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] ) + se.yields :bean1, :bean2 + + things = [] + a_block = lambda { |thinger| things << thinger } + + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + assert_equal [:bean1,:bean2], things, "Wrong things" + end + + def test_yields_block_takes_no_arguments + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] ) + se.yields + + things = [] + a_block = lambda { things << 'OOF' } + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + assert_equal ['OOF'], things + end + + def test_yields_params_to_block_takes_no_arguments + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] ) + se.yields :wont_fit + + things = [] + a_block = lambda { things << 'WUP' } + + err = assert_raise ExpectationError do + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + end + assert_match(/wont_fit/i, err.message) + assert_match(/arity -1/i, err.message) + assert_equal [], things, "Wrong things" + end + + def test_yields_with_returns + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] , + :returns => 'the results') + + exp = se.yields :bean1, :bean2 + assert_same se, exp, "'yields' needs to return a reference to the expectation" + things = [] + a_block = lambda { |thinger| things << thinger } + returned = se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + assert_equal [:bean1,:bean2], things, "Wrong things" + assert_equal 'the results', returned, "Wrong return value" + end + + def test_yields_with_raises + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot], + :raises => RuntimeError.new("kerboom")) + + exp = se.yields :bean1, :bean2 + assert_same se, exp, "'yields' needs to return a reference to the expectation" + things = [] + a_block = lambda { |thinger| things << thinger } + err = assert_raise RuntimeError do + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + end + assert_match(/kerboom/i, err.message) + assert_equal [:bean1,:bean2], things, "Wrong things" + end + + def test_yields_and_inner_block_explodes + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot]) + + exp = se.yields :bean1, :bean2 + assert_same se, exp, "'yields' needs to return a reference to the expectation" + things = [] + a_block = lambda { |thinger| + things << thinger + raise "nasty" + } + err = assert_raise RuntimeError do + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + end + assert_match(/nasty/i, err.message) + assert_equal [:bean1], things, "Wrong things" + end + + def test_yields_with_several_arrays + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] ) + se.yields ['a','b'], ['c','d'] + + things = [] + a_block = lambda { |thinger| things << thinger } + + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + assert_equal [ ['a','b'], ['c','d'] ], things, "Wrong things" + end + + def test_yields_tuples + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] ) + se.yields ['a','b','c'], ['d','e','f'] + + things = [] + a_block = lambda { |left,mid,right| + things << { :left => left, :mid => mid, :right => right } + } + + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + assert_equal [ + {:left => 'a', :mid => 'b', :right => 'c' }, + {:left => 'd', :mid => 'e', :right => 'f' }, + ], things, "Wrong things" + end + + def test_yields_tuples_size_mismatch + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] ) + se.yields ['a','b','c'], ['d','e','f'] + + things = [] + a_block = lambda { |left,mid| + things << { :left => left, :mid => mid } + } + + err = assert_raise ExpectationError do + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + end + assert_match(/arity/i, err.message) + assert_match(/the_mock.each_bean/i, err.message) + assert_match(/"a", "b", "c"/i, err.message) + assert_equal [], things, "Wrong things" + end + + def test_yields_bad_block_arity + se = Expectation.new(:mock => @mock, :method => 'do_later', :arguments => [] ) + se.yields + + assert_error Hardmock::ExpectationError, /block/i, /expected/i, /no param/i, /got 2/i do + se.apply_method_call(@mock,'do_later',[],lambda { |doesnt,match| raise "Surprise!" } ) + end + end + + def test_that_arguments_can_be_added_to_expectation + expectation = Expectation.new(:mock => @mock, :method => "each_bean") + assert_same expectation, expectation.with("jello", "for", "cosby"), "should have returned the same expectation" + + err = assert_raise ExpectationError do + expectation.apply_method_call(@mock, 'each_bean', [], nil) + end + assert_match(/wrong arguments/i, err.message) + + assert_nothing_raised(ExpectationError) do + expectation.apply_method_call(@mock, 'each_bean', ["jello", "for", "cosby"], nil) + end + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/test/unit/expector_test.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/test/unit/expector_test.rb new file mode 100644 index 0000000..f420db2 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/test/unit/expector_test.rb @@ -0,0 +1,57 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/expector' + +class ExpectorTest < Test::Unit::TestCase + include Hardmock + + class MyControl + attr_reader :added + def add_expectation(expectation) + @added ||= [] + @added << expectation + end + end + + class ExpBuilder + attr_reader :options + def build_expectation(options) + @options = options + "dummy expectation" + end + end + + def try_it_with(method_name) + mock = Object.new + mock_control = MyControl.new + builder = ExpBuilder.new + + exp = Expector.new(mock, mock_control, builder) + output = exp.send(method_name,:with, 1, 'sauce') + + assert_same mock, builder.options[:mock] + assert_equal method_name, builder.options[:method].to_s + assert_equal [:with,1,'sauce'], builder.options[:arguments] + assert_nil builder.options[:block] + assert_equal [ "dummy expectation" ], mock_control.added, + "Wrong expectation added to control" + + assert_equal "dummy expectation", output, "Expectation should have been returned" + end + + # + # TESTS + # + def test_method_missing + try_it_with 'wonder_bread' + try_it_with 'whatever' + end + + def test_methods_that_wont_trigger_method_missing + mock = Object.new + mock_control = MyControl.new + builder = ExpBuilder.new + + exp = Expector.new(mock, mock_control, builder) + assert_equal mock, exp.instance_eval("@mock") + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/test/unit/method_cleanout_test.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/test/unit/method_cleanout_test.rb new file mode 100644 index 0000000..7aa6293 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/test/unit/method_cleanout_test.rb @@ -0,0 +1,36 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/method_cleanout' + +class MethodCleanoutTest < Test::Unit::TestCase + class Victim + OriginalMethods = instance_methods + include Hardmock::MethodCleanout + end + + def setup + @victim = Victim.new + end + + def test_should_remove_most_methods_from_a_class + expect_removed = Victim::OriginalMethods.reject { |m| + Hardmock::MethodCleanout::SACRED_METHODS.include?(m) + } + expect_removed.each do |m| + assert !@victim.respond_to?(m), "should not have method #{m}" + end + end + + def test_should_leave_the_sacred_methods_defined + Hardmock::MethodCleanout::SACRED_METHODS.each do |m| + next if m =~ /^hm_/ + assert @victim.respond_to?(m), "Sacred method '#{m}' was removed unexpectedly" + end + end + + def test_should_include_certain_important_methods_in_the_sacred_methods_list + %w|__id__ __send__ equal? object_id send nil? class kind_of? respond_to? inspect method to_s instance_variables instance_eval|.each do |m| + assert Hardmock::MethodCleanout::SACRED_METHODS.include?(m), "important method #{m} is not included in SACRED_METHODS" + end + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/test/unit/mock_control_test.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/test/unit/mock_control_test.rb new file mode 100644 index 0000000..3c52db6 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/test/unit/mock_control_test.rb @@ -0,0 +1,175 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/utils' +require 'hardmock/errors' +require 'hardmock/mock_control' + +class MockControlTest < Test::Unit::TestCase + include Hardmock + + def setup + @unmock = OpenStruct.new( :_name => 'fakemock' ) + + @control = MockControl.new + assert @control.happy?, "Control should start out happy" + end + + def teardown + end + + # + # HELPERS + # + + class MyExp + attr_reader :mock, :mname, :args, :block + def apply_method_call(mock, mname, args, block) + @mock = mock + @mname = mname + @args = args + @block = block + end + end + + class BoomExp < MyExp + def apply_method_call(mock, mname, args, block) + super + raise "BOOM" + end + end + + # + # TESTS + # + + def test_add_exepectation_and_apply_method_call + e1 = MyExp.new + + @control.add_expectation e1 + assert !@control.happy? + + @control.apply_method_call @unmock, 'some_func', [ 'the', :args ], nil + assert @control.happy? + + assert_same @unmock, e1.mock, "Wrong mock" + assert_equal 'some_func', e1.mname, "Wrong method" + assert_equal [ 'the', :args ], e1.args, "Wrong args" + + @control.verify + end + + def test_add_exepectation_and_apply_method_call_with_block + e1 = MyExp.new + + @control.add_expectation e1 + assert !@control.happy? + + runtime_block = Proc.new { "hello" } + @control.apply_method_call @unmock, 'some_func', [ 'the', :args ], runtime_block + assert @control.happy? + + assert_same @unmock, e1.mock, "Wrong mock" + assert_equal 'some_func', e1.mname, "Wrong method" + assert_equal [ 'the', :args ], e1.args, "Wrong args" + assert_equal "hello", e1.block.call, "Wrong block in expectation" + + @control.verify + end + + def test_add_expectation_then_verify + e1 = MyExp.new + + @control.add_expectation e1 + assert !@control.happy?, "Shoudn't be happy" + err = assert_raise VerifyError do + @control.verify + end + assert_match(/unmet expectations/i, err.message) + + @control.apply_method_call @unmock, 'some_func', [ 'the', :args ], nil + assert @control.happy? + + assert_same @unmock, e1.mock, "Wrong mock" + assert_equal 'some_func', e1.mname, "Wrong method" + assert_equal [ 'the', :args ], e1.args, "Wrong args" + + @control.verify + end + + def test_expectation_explosion + be1 = BoomExp.new + + @control.add_expectation be1 + + err = assert_raise RuntimeError do + @control.apply_method_call @unmock, 'a func', [:arg], nil + end + assert_match(/BOOM/i, err.message) + + assert_same @unmock, be1.mock + assert_equal 'a func', be1.mname + assert_equal [:arg], be1.args + end + + def test_disappointment_on_bad_verify + @control.add_expectation MyExp.new + assert !@control.happy?, "Shouldn't be happy" + assert !@control.disappointed?, "too early to be disappointed" + + # See verify fails + err = assert_raise VerifyError do + @control.verify + end + assert_match(/unmet expectations/i, err.message) + + assert !@control.happy?, "Still have unmet expectation" + assert @control.disappointed?, "We should be disappointed following that failure" + + @control.apply_method_call @unmock, 'something', [], nil + assert @control.happy?, "Should be happy" + assert @control.disappointed?, "We should be skeptical" + + @control.verify + + assert !@control.disappointed?, "Should be non-disappointed" + end + + def test_disappointment_from_surprise_calls + assert @control.happy?, "Should be happy" + assert !@control.disappointed?, "too early to be disappointed" + + # See verify fails + err = assert_raise ExpectationError do + @control.apply_method_call @unmock, "something", [], nil + end + assert_match(/surprise/i, err.message) + + assert @control.happy?, "Happiness is an empty list of expectations" + assert @control.disappointed?, "We should be disappointed following that failure" + + @control.verify + assert !@control.disappointed?, "Disappointment should be gone" + end + + def test_disappointment_from_bad_calls + be1 = BoomExp.new + assert !@control.disappointed?, "Shouldn't be disappointed" + @control.add_expectation be1 + assert !@control.disappointed?, "Shouldn't be disappointed" + + err = assert_raise RuntimeError do + @control.apply_method_call @unmock, 'a func', [:arg], nil + end + assert_match(/BOOM/i, err.message) + assert @control.disappointed?, "Should be disappointed" + + assert_same @unmock, be1.mock + assert_equal 'a func', be1.mname + assert_equal [:arg], be1.args + + assert @control.happy?, "Happiness is an empty list of expectations" + @control.verify + assert !@control.disappointed?, "Disappointment should be gone" + end + + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/test/unit/mock_test.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/test/unit/mock_test.rb new file mode 100644 index 0000000..2579bcc --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/test/unit/mock_test.rb @@ -0,0 +1,279 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/method_cleanout' +require 'hardmock/mock' +require 'hardmock/mock_control' +require 'hardmock/expectation_builder' +require 'hardmock/expector' +require 'hardmock/trapper' + +class MockTest < Test::Unit::TestCase + include Hardmock + + def test_build_with_control + mc1 = MockControl.new + mock = Mock.new('hi', mc1) + assert_equal 'hi', mock._name, "Wrong name" + assert_same mc1, mock._control, "Wrong contol" + end + + def test_basics + mock = Mock.new('a name') + assert_equal 'a name', mock._name, "Wrong name for mock" + assert_not_nil mock._control, "Nil control in mock" + end + + def test_expects + mock = Mock.new('order') + control = mock._control + assert control.happy?, "Mock should start out satisfied" + + mock.expects.absorb_something(:location, 'garbage') + assert !control.happy?, "mock control should be unhappy" + + # Do the call + mock.absorb_something(:location, 'garbage') + assert control.happy?, "mock control should be happy again" + + # Verify + assert_nothing_raised Exception do + mock._verify + end + end + + def test_expects_using_arguments_for_method_and_arguments + mock = Mock.new('order') + mock.expects(:absorb_something, :location, 'garbage') + mock.absorb_something(:location, 'garbage') + mock._verify + end + + def test_expects_using_arguments_for_method_and_arguments_with_block + mock = Mock.new('order') + mock.expects(:absorb_something, :location, 'garbage') { |a,b,block| + assert_equal :location, a, "Wrong 'a' argument" + assert_equal 'garbage', b, "Wrong 'b' argument" + assert_equal 'innards', block.call, "Wrong block" + } + mock.absorb_something(:location, 'garbage') do "innards" end + mock._verify + end + + def test_expects_using_string_method_name + mock = Mock.new('order') + mock.expects('absorb_something', :location, 'garbage') + mock.absorb_something(:location, 'garbage') + mock._verify + end + + + def test_expects_assignment + mock = Mock.new('order') + mock.expects.account_number = 1234 + + mock.account_number = 1234 + + mock._verify + end + + def test_expects_assigment_using_arguments_for_method_and_arguments + mock = Mock.new('order') + mock.expects(:account_number=, 1234) + mock.account_number = 1234 + mock._verify + end + + def test_expects_assigment_using_string_method_name + mock = Mock.new('order') + mock.expects('account_number=', 1234) + mock.account_number = 1234 + mock._verify + end + + def test_expects_assignment_and_return_is_overruled_by_ruby_syntax + # Prove that we can set up a return but that it doesn't mean much, + # because ruby's parser will 'do the right thing' as regards semantic + # values for assignment. (That is, the rvalue of the assignment) + mock = Mock.new('order') + mock.expects(:account_number=, 1234).returns "gold" + got = mock.account_number = 1234 + mock._verify + assert_equal 1234, got, "Expected rvalue" + end + + def test_expects_assignment_and_raise + mock = Mock.new('order') + mock.expects(:account_number=, 1234).raises StandardError.new("kaboom") + err = assert_raise StandardError do + mock.account_number = 1234 + end + assert_match(/kaboom/i, err.message) + mock._verify + end + + + def test_expects_multiple + mock = Mock.new('order') + control = mock._control + + assert control.happy? + + mock.expects.one_thing :hi, { :goose => 'neck' } + mock.expects.another 5,6,7 + assert !control.happy? + + mock.one_thing :hi, { :goose => 'neck' } + assert !control.happy? + + mock.another 5,6,7 + assert control.happy? + end + + def test_surprise_call + mock = Mock.new('order') + err = assert_raise ExpectationError do + mock.uh_oh + end + assert_match(/surprise/i, err.message) + assert_match(/uh_oh/i, err.message) + + err = assert_raise ExpectationError do + mock.whoa :horse + end + assert_match(/surprise/i, err.message) + assert_match(/order\.whoa\(:horse\)/i, err.message) + end + + def test_wrong_call + mock = Mock.new('order') + mock.expects.pig 'arse' + err = assert_raise ExpectationError do + mock.whoa :horse + end + assert_match(/wrong method/i, err.message) + assert_match(/order\.whoa\(:horse\)/i, err.message) + assert_match(/order\.pig\("arse"\)/i, err.message) + end + + def test_wrong_arguments + mock = Mock.new('order') + mock.expects.go_fast(:a, 1, 'three') + + err = assert_raise ExpectationError do + mock.go_fast :a, 1, 'not right' + end + assert_match(/wrong argument/i, err.message) + assert_match(/order\.go_fast\(:a, 1, "three"\)/i, err.message) + assert_match(/order\.go_fast\(:a, 1, "not right"\)/i, err.message) + end + + def test_expects_and_return + mock = Mock.new('order') + mock.expects.delivery_date.returns Date.today + assert_equal Date.today, mock.delivery_date + mock._verify + end + + def test_expects_and_return_with_arguments + mock = Mock.new('order') + mock.expects.delivery_date(:arf,14).returns(Date.today) + assert_equal Date.today, mock.delivery_date(:arf,14) + mock._verify + end + + def test_expects_and_raise + mock = Mock.new('order') + mock.expects.delivery_date.raises StandardError.new("bloof") + + err = assert_raise StandardError do + mock.delivery_date + end + assert_match(/bloof/i, err.message) + + mock._verify + + # Try convenience argument String + mock.expects.pow.raises "hell" + err = assert_raise RuntimeError do + mock.pow + end + assert_match(/hell/i, err.message) + + mock._verify + + # Try convenience argument nothing + mock.expects.pow.raises + err = assert_raise RuntimeError do + mock.pow + end + assert_match(/an error/i, err.message) + + mock._verify + end + + def test_expects_a_runtime_block + mock = Mock.new('order') + got_val = nil + + mock.expects.when(:something) { |e,block| + got_val = block.call + } + + mock.when :something do "hi there" end + + assert_equal "hi there", got_val, "Expectation block not invoked" + mock._verify + end + + def test_trap_block + mock = Mock.new('order') + exp = mock.trap.observe + + # use it + mock.observe { "burp" } + + assert_equal "burp", exp.block_value.call + end + + def test_trap_arguments_and_block + mock = Mock.new('order') + exp = mock.trap.subscribe(:data_changed) + + # use it + mock.subscribe(:data_changed) { "burp" } + assert_equal "burp", exp.block_value.call + mock._verify + end + + def test_trap_arguments_and_block_wrong_num_args + mock = Mock.new('order') + exp = mock.trap.subscribe(:data_changed) + + assert_raise ExpectationError do + mock.subscribe(:data_changed,1) { "burp" } + end + mock._verify + end + + def test_trap_arguments_and_block_wrong_args + mock = Mock.new('order') + exp = mock.trap.subscribe(:data_changed) + + assert_raise ExpectationError do + mock.subscribe("no good") { "burp" } + end + + mock._verify + end + + def test_trap_is_not_leniant_about_arguments + mock = Mock.new('order') + exp = mock.trap.subscribe + + assert_raise ExpectationError do + mock.subscribe("no good") { "burp" } + end + + mock._verify + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/test/unit/test_unit_before_after_test.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/test/unit/test_unit_before_after_test.rb new file mode 100644 index 0000000..172f527 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/test/unit/test_unit_before_after_test.rb @@ -0,0 +1,452 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") + +class TestUnitBeforeAfter < Test::Unit::TestCase + + # + # after_teardown + # + + it "adds TestCase.after_teardown hook for appending post-teardown actions" do + write_and_run_test :use_after_teardown => true + + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "THE TEARDOWN", + "1st after_teardown", + "2nd after_teardown", + "Finished in" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 0 + end + + should "execute all after_teardowns, even if the main teardown flunks" do + write_and_run_test :use_after_teardown => true, :flunk_in_teardown => true + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "F", + "1st after_teardown", + "2nd after_teardown", + "Finished in", + "1) Failure:", + "test_something(MyExampleTest) [_test_file_temp.rb:20]:", + "FLUNK IN TEARDOWN" + see_results :tests => 1, :assertions => 1, :failures => 1, :errors => 0 + end + + should "execute all after_teardowns, even if the main teardown explodes" do + write_and_run_test :use_after_teardown => true, :raise_in_teardown => true + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "E", + "1st after_teardown", + "2nd after_teardown", + "Finished in", + "RuntimeError: ERROR IN TEARDOWN" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 1 + end + + should "execute all after_teardowns, even if some of them flunk" do + write_and_run_test :use_after_teardown => true, :flunk_in_after_teardown => true + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "THE TEARDOWN", + "1st after_teardown", + "F", + "2nd after_teardown", + "Finished in", + "1) Failure:", + "test_something(MyExampleTest) [_test_file_temp.rb:7]:", + "Flunk in first after_teardown", + "2) Failure:", + "test_something(MyExampleTest) [_test_file_temp.rb:10]:", + "Flunk in second after_teardown" + see_results :tests => 1, :assertions => 2, :failures => 2, :errors => 0 + end + + should "execute all after_teardowns, even if some of them explode" do + write_and_run_test :use_after_teardown => true, :raise_in_after_teardown => true + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "THE TEARDOWN", + "1st after_teardown", + "E", + "2nd after_teardown", + "Finished in", + "RuntimeError: Error in first after_teardown", + "RuntimeError: Error in second after_teardown" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 2 + end + + it "will run after_teardowns in the absence of a regular teardown" do + write_and_run_test :omit_teardown => true, :use_after_teardown => true + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "1st after_teardown", + "2nd after_teardown", + "Finished in" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 0 + end + + should "not interfere with normal test writing" do + write_and_run_test + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "THE TEARDOWN", + "Finished in" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 0 + end + + it "provides a cleaned-up backtrace" do + write_and_run_test :with_failure => true + see_in_order "Loaded suite", + "THE SETUP", + "A FAILING TEST", + "F", "THE TEARDOWN", + "Finished in", + "1) Failure:", + "test_something(MyExampleTest) [_test_file_temp.rb:17]:", + "Instrumented failure.", + " is not true." + see_results :tests => 1, :assertions => 1, :failures => 1, :errors => 0 + end + + it "provides a cleaned-up backtrace, but not TOO cleaned up" do + write_and_run_test :with_failure => true, :use_helpers => true + see_in_order "Loaded suite", + "THE SETUP", + "A FAILING TEST", + "F", "THE TEARDOWN", + "Finished in", + "1) Failure:", + "test_something(MyExampleTest)\n", + "[_test_file_temp.rb:25:in `tripwire'", + "_test_file_temp.rb:21:in `my_helper'", + "_test_file_temp.rb:17:in `test_something']:", + "Instrumented failure.", + " is not true." + see_results :tests => 1, :assertions => 1, :failures => 1, :errors => 0 + end + + should "not interfere with passthrough exception types" do + if is_modern_test_unit? + write_and_run_test :raise_nasty_in_test => true + see_in_no_particular_order "Loaded suite", + "THE TEARDOWN", + "_test_file_temp.rb:16:in `test_something': NASTY ERROR (NoMemoryError)" + see_no_results + end + end + + # + # before_setup + # + + it "adds TestCase.before_setup hook for prepending pre-setup actions" do + write_and_run_test :use_before_setup => true + see_in_order "Loaded suite", + "3rd before_setup", + "2nd before_setup", + "1st before_setup", + "THE SETUP", + "A TEST", + "THE TEARDOWN", + "Finished in" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 0 + end + + should "stop executing the test on the first failure withing a before_setup action" do + write_and_run_test :use_before_setup => true, :flunk_in_before_setup => true + see_in_order "Loaded suite", + "3rd before_setup", + "2nd before_setup", + "FTHE TEARDOWN", + "1) Failure:", + "test_something(MyExampleTest) [_test_file_temp.rb:10]:", + "Flunk in 2nd before_setup." + see_results :tests => 1, :assertions => 1, :failures => 1, :errors => 0 + end + + should "stop executing the test on the first error within a before_setup action" do + write_and_run_test :use_before_setup => true, :raise_in_before_setup => true + see_in_order "Loaded suite", + "3rd before_setup", + "2nd before_setup", + "ETHE TEARDOWN", + "Finished in", + "test_something(MyExampleTest):", + "RuntimeError: Error in 2nd before_setup", + "_test_file_temp.rb:10", + "/hardmock/lib/test_unit_before_after.rb:", ":in `call'" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 1 + end + + it "will run before_setup actions in the absence of a regular setup" do + write_and_run_test :omit_setup => true, :use_before_setup => true + see_in_order "Loaded suite", + "3rd before_setup", + "2nd before_setup", + "1st before_setup", + "A TEST", + "THE TEARDOWN", + "Finished in" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 0 + end + + it "allows before_setup and after_teardown to be used at the same time" do + write_and_run_test :use_before_setup => true, :use_after_teardown => true + see_in_order "Loaded suite", + "3rd before_setup", + "2nd before_setup", + "1st before_setup", + "A TEST", + "THE TEARDOWN", + "1st after_teardown", + "2nd after_teardown", + "Finished in" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 0 + end + + # + # HELPERS + # + + def teardown + remove_test + end + + def test_filename + "_test_file_temp.rb" + end + + def remove_test + rm_f test_filename + end + + def write_and_run_test(opts={}) + write(test_filename, generate_test_code(opts)) + run_test + end + + def run_test + @output = `ruby #{test_filename} 2>&1` + end + + + def write(fname, code) + File.open(fname,"w") do |f| + f.print code + end + end + + def show_output + puts "-- BEGIN TEST OUTPUT" + puts @output + puts "-- END TEST OUTPUT" + end + + def see_in_order(*phrases) + idx = 0 + phrases.each do |txt| + idx = @output.index(txt, idx) + if idx.nil? + if @output.index(txt) + flunk "Phrase '#{txt}' is out-of-order in test output:\n#{@output}" + else + flunk "Phrase '#{txt}' not found in test output:\n#{@output}" + end + end + end + end + + def see_in_no_particular_order(*phrases) + phrases.each do |txt| + assert_not_nil @output.index(txt), "Didn't see '#{txt}' in test output:\n#{@output}" + end + end + + def see_results(opts) + if @output =~ /(\d+) tests, (\d+) assertions, (\d+) failures, (\d+) errors/ + tests, assertions, failures, errors = [ $1, $2, $3, $4 ] + [:tests, :assertions, :failures, :errors].each do |key| + eval %{assert_equal(opts[:#{key}].to_s, #{key}, "Wrong number of #{key} in report") if opts[:#{key}]} + end + else + flunk "Didn't see the test results report line" + end + end + + def see_no_results + if @output =~ /\d+ tests, \d+ assertions, \d+ failures, \d+ errors/ + flunk "Should not have had a results line:\n#{@output}" + end + end + + def lib_dir + File.expand_path(File.dirname(__FILE__) + "/../../lib") + end + + def generate_test_code(opts={}) + + if opts[:with_failure] or opts[:raise_nasty_in_test] + test_method_code = generate_failing_test("test_something", opts) + else + test_method_code = generate_passing_test("test_something") + end + + + requires_for_ext = '' + if opts[:use_before_setup] or opts[:use_after_teardown] + requires_for_ext =<<-RFE + $: << "#{lib_dir}" + require 'test_unit_before_after' + RFE + end + + before_setups = '' + if opts[:use_before_setup] + add_on_two = "" + if opts[:flunk_in_before_setup] + add_on_two = %{; test.flunk "Flunk in 2nd before_setup"} + elsif opts[:raise_in_before_setup] + add_on_two = %{; raise "Error in 2nd before_setup"} + end + before_setups =<<-BSTS + Test::Unit::TestCase.before_setup do |test| + puts "1st before_setup" + end + Test::Unit::TestCase.before_setup do |test| + puts "2nd before_setup" #{add_on_two} + end + Test::Unit::TestCase.before_setup do |test| + puts "3rd before_setup" + end + + BSTS + end + + + setup_code =<<-SC + def setup + puts "THE SETUP" + end + SC + if opts[:omit_setup] + setup_code = "" + end + + after_teardowns = '' + if opts[:use_after_teardown] + add_on_one = "" + add_on_two = "" + if opts[:flunk_in_after_teardown] + add_on_one = %{; test.flunk "Flunk in first after_teardown"} + add_on_two = %{; test.flunk "Flunk in second after_teardown"} + elsif opts[:raise_in_after_teardown] + add_on_one = %{; raise "Error in first after_teardown"} + add_on_two = %{; raise "Error in second after_teardown"} + end + after_teardowns =<<-ATDS + Test::Unit::TestCase.after_teardown do |test| + puts "1st after_teardown" #{add_on_one} + end + Test::Unit::TestCase.after_teardown do |test| + puts "2nd after_teardown" #{add_on_two} + end + ATDS + end + + teardown_code =<<-TDC + def teardown + puts "THE TEARDOWN" + end + TDC + if opts[:flunk_in_teardown] + teardown_code =<<-TDC + def teardown + flunk "FLUNK IN TEARDOWN" + end + TDC + elsif opts[:raise_in_teardown] + teardown_code =<<-TDC + def teardown + raise "ERROR IN TEARDOWN" + end + TDC + end + if opts[:omit_teardown] + teardown_code = "" + end + + str = <<-TCODE + require 'test/unit' + #{requires_for_ext} + + #{before_setups} #{after_teardowns} + + class MyExampleTest < Test::Unit::TestCase + #{setup_code} + #{teardown_code} + #{test_method_code} + end + TCODE + end + + def generate_passing_test(tname) + str = <<-TMETH + def #{tname} + puts "A TEST" + end + TMETH + end + + def generate_failing_test(tname, opts={}) + str = "NOT DEFINED?" + if opts[:raise_nasty_in_test] + str = <<-TMETH + def #{tname} + raise NoMemoryError, "NASTY ERROR" + end + TMETH + + elsif opts[:use_helpers] + str = <<-TMETH + def #{tname} + puts "A FAILING TEST" + my_helper + end + + def my_helper + tripwire + end + + def tripwire + assert false, "Instrumented failure" + end + TMETH + else + str = <<-TMETH + def #{tname} + puts "A FAILING TEST" + assert false, "Instrumented failure" + end + TMETH + end + return str + end + + def is_modern_test_unit? + begin + Test::Unit::TestCase::PASSTHROUGH_EXCEPTIONS + return true + rescue NameError + return false + end + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/test/unit/trapper_test.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/test/unit/trapper_test.rb new file mode 100644 index 0000000..f7d4114 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/test/unit/trapper_test.rb @@ -0,0 +1,62 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/method_cleanout' +require 'hardmock/trapper' + +class TrapperTest < Test::Unit::TestCase + include Hardmock + + def setup + @mock = Object.new + @mock_control = MyControl.new + @builder = ExpBuilder.new + @trapper = Trapper.new(@mock, @mock_control, @builder) + end + + # + # HELPERS + # + + class MyControl + attr_reader :added + def add_expectation(expectation) + @added ||= [] + @added << expectation + end + end + + class ExpBuilder + attr_reader :options + def build_expectation(options) + @options = options + "dummy expectation" + end + end + + # + # TESTS + # + + def test_method_missing + + output = @trapper.change(:less) + + assert_same @mock, @builder.options[:mock] + assert_equal :change, @builder.options[:method] + assert_equal [:less], @builder.options[:arguments] + assert_not_nil @builder.options[:block] + assert @builder.options[:suppress_arguments_to_block], ":suppress_arguments_to_block should be set" + assert_equal [ "dummy expectation" ], @mock_control.added, + "Wrong expectation added to control" + + assert_equal "dummy expectation", output, "Expectation should have been returned" + + # Examine the block. It should take one argument and simply return + # that argument. because of the 'suppress arguments to block' + # setting, the argument can only end up being a block, in practice. + trapper_block = @builder.options[:block] + assert_equal "the argument", trapper_block.call("the argument"), + "The block should merely return the passed argument" + end + + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/test/unit/verify_error_test.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/test/unit/verify_error_test.rb new file mode 100644 index 0000000..ecd23fd --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/hardmock/test/unit/verify_error_test.rb @@ -0,0 +1,40 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/method_cleanout' +require 'hardmock/mock_control' +require 'hardmock/errors' +require 'hardmock/expectation_builder' +require 'hardmock/expectation' +require 'hardmock/mock' + +class VerifyErrorTest < Test::Unit::TestCase + include Hardmock + + # + # TESTS + # + + def test_formatted_list_of_unmet_expectations + mock1 = Mock.new('mock1') + mock2 = Mock.new('mock2') + exp1 = Expectation.new( :mock => mock1, :method => 'send_parts', :arguments => [1,2,:a] ) + exp2 = Expectation.new( :mock => mock2, :method => 'grind_it', :arguments => [] ) + + exp_list = [ exp1, exp2 ] + + err = VerifyError.new("This is the error", exp_list) + assert_equal "This is the error:\n * #{exp1.to_s}\n * #{exp2.to_s}", err.message + end + + def test_empty_list_of_expectations + # this is not a normal case; not spending a lot of time to make this better + exp_list = [] + err = VerifyError.new("This is the error:\n", exp_list) + end + + def test_nil_expectation_list + # this is not a normal case; not spending a lot of time to make this better + exp_list = [] + err = VerifyError.new("This is the error:\n", exp_list) + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/auto/colour_prompt.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/auto/colour_prompt.rb new file mode 100644 index 0000000..81003dd --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/auto/colour_prompt.rb @@ -0,0 +1,94 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +if RUBY_PLATFORM =~/(win|w)32$/ + begin + require 'Win32API' + rescue LoadError + puts "ERROR! \"Win32API\" library not found" + puts "\"Win32API\" is required for colour on a windows machine" + puts " try => \"gem install Win32API\" on the command line" + puts + end + # puts + # puts 'Windows Environment Detected...' + # puts 'Win32API Library Found.' + # puts +end + +class ColourCommandLine + def initialize + if RUBY_PLATFORM =~/(win|w)32$/ + get_std_handle = Win32API.new("kernel32", "GetStdHandle", ['L'], 'L') + @set_console_txt_attrb = + Win32API.new("kernel32","SetConsoleTextAttribute",['L','N'], 'I') + @hout = get_std_handle.call(-11) + end + end + + def change_to(new_colour) + if RUBY_PLATFORM =~/(win|w)32$/ + @set_console_txt_attrb.call(@hout,self.win32_colour(new_colour)) + else + "\033[30;#{posix_colour(new_colour)};22m" + end + end + + def win32_colour(colour) + case colour + when :black then 0 + when :dark_blue then 1 + when :dark_green then 2 + when :dark_cyan then 3 + when :dark_red then 4 + when :dark_purple then 5 + when :dark_yellow, :narrative then 6 + when :default_white, :default, :dark_white then 7 + when :silver then 8 + when :blue then 9 + when :green, :success then 10 + when :cyan, :output then 11 + when :red, :failure then 12 + when :purple then 13 + when :yellow then 14 + when :white then 15 + else + 0 + end + end + + def posix_colour(colour) + case colour + when :black then 30 + when :red, :failure then 31 + when :green, :success then 32 + when :yellow then 33 + when :blue, :narrative then 34 + when :purple, :magenta then 35 + when :cyan, :output then 36 + when :white, :default_white, :default then 37 + else + 30 + end + end + + def out_c(mode, colour, str) + case RUBY_PLATFORM + when /(win|w)32$/ + change_to(colour) + $stdout.puts str if mode == :puts + $stdout.print str if mode == :print + change_to(:default_white) + else + $stdout.puts("#{change_to(colour)}#{str}\033[0m") if mode == :puts + $stdout.print("#{change_to(colour)}#{str}\033[0m") if mode == :print + end + end +end # ColourCommandLine + +def colour_puts(role,str) ColourCommandLine.new.out_c(:puts, role, str) end +def colour_print(role,str) ColourCommandLine.new.out_c(:print, role, str) end + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/auto/colour_reporter.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/auto/colour_reporter.rb new file mode 100644 index 0000000..5aa1d27 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/auto/colour_reporter.rb @@ -0,0 +1,39 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require "#{File.expand_path(File.dirname(__FILE__))}/colour_prompt" + +$colour_output = true + +def report(message) + if not $colour_output + $stdout.puts(message) + else + message = message.join('\n') if (message.class == Array) + message.each_line do |line| + line.chomp! + colour = case(line) + when /(?:total\s+)?tests:?\s+(\d+)\s+(?:total\s+)?failures:?\s+\d+\s+Ignored:?/i + ($1.to_i == 0) ? :green : :red + when /PASS/ + :green + when /^OK$/ + :green + when /(?:FAIL|ERROR)/ + :red + when /IGNORE/ + :yellow + when /^(?:Creating|Compiling|Linking)/ + :white + else + :silver + end + colour_puts(colour, line) + end + end + $stdout.flush + $stderr.flush +end \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/auto/generate_config.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/auto/generate_config.yml new file mode 100644 index 0000000..4a5e474 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/auto/generate_config.yml @@ -0,0 +1,36 @@ +#this is a sample configuration file for generate_module +#you would use it by calling generate_module with the -ygenerate_config.yml option +#files like this are useful for customizing generate_module to your environment +:generate_module: + :defaults: + #these defaults are used in place of any missing options at the command line + :path_src: ../src/ + :path_inc: ../src/ + :path_tst: ../test/ + :update_svn: true + :includes: + #use [] for no additional includes, otherwise list the includes on separate lines + :src: + - Defs.h + - Board.h + :inc: [] + :tst: + - Defs.h + - Board.h + - Exception.h + :boilerplates: + #these are inserted at the top of generated files. + #just comment out or remove if not desired. + #use %1$s where you would like the file name to appear (path/extension not included) + :src: | + //------------------------------------------- + // %1$s.c + //------------------------------------------- + :inc: | + //------------------------------------------- + // %1$s.h + //------------------------------------------- + :tst: | + //------------------------------------------- + // Test%1$s.c : Units tests for %1$s.c + //------------------------------------------- diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/auto/generate_module.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/auto/generate_module.rb new file mode 100644 index 0000000..3db1a98 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/auto/generate_module.rb @@ -0,0 +1,202 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +# This script creates all the files with start code necessary for a new module. +# A simple module only requires a source file, header file, and test file. +# Triad modules require a source, header, and test file for each triad type (like model, conductor, and hardware). + +require 'rubygems' +require 'fileutils' + +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +#help text when requested +HELP_TEXT = [ "\nGENERATE MODULE\n-------- ------", + "\nUsage: ruby generate_module [options] module_name", + " -i\"include\" sets the path to output headers to 'include' (DEFAULT ../src)", + " -s\"../src\" sets the path to output source to '../src' (DEFAULT ../src)", + " -t\"C:/test\" sets the path to output source to 'C:/test' (DEFAULT ../test)", + " -p\"MCH\" sets the output pattern to MCH.", + " dh - driver hardware.", + " dih - driver interrupt hardware.", + " mch - model conductor hardware.", + " mvp - model view presenter.", + " src - just a single source module. (DEFAULT)", + " -d destroy module instead of creating it.", + " -u update subversion too (requires subversion command line)", + " -y\"my.yml\" selects a different yaml config file for module generation", + "" ].join("\n") + +#Built in patterns +PATTERNS = { 'src' => {'' => { :inc => [] } }, + 'dh' => {'Driver' => { :inc => ['%1$sHardware.h'] }, + 'Hardware' => { :inc => [] } + }, + 'dih' => {'Driver' => { :inc => ['%1$sHardware.h', '%1$sInterrupt.h'] }, + 'Interrupt'=> { :inc => ['%1$sHardware.h'] }, + 'Hardware' => { :inc => [] } + }, + 'mch' => {'Model' => { :inc => [] }, + 'Conductor'=> { :inc => ['%1$sModel.h', '%1$sHardware.h'] }, + 'Hardware' => { :inc => [] } + }, + 'mvp' => {'Model' => { :inc => [] }, + 'Presenter'=> { :inc => ['%1$sModel.h', '%1$sView.h'] }, + 'View' => { :inc => [] } + } + } + +#TEMPLATE_TST +TEMPLATE_TST = %q[#include "unity.h" +%2$s#include "%1$s.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void test_%1$s_NeedToImplement(void) +{ + TEST_IGNORE(); +} +] + +#TEMPLATE_SRC +TEMPLATE_SRC = %q[%2$s#include "%1$s.h" +] + +#TEMPLATE_INC +TEMPLATE_INC = %q[#ifndef _%3$s_H +#define _%3$s_H%2$s + +#endif // _%3$s_H +] + +# Parse the command line parameters. +ARGV.each do |arg| + case(arg) + when /^-d/ then @destroy = true + when /^-u/ then @update_svn = true + when /^-p(\w+)/ then @pattern = $1 + when /^-s(.+)/ then @path_src = $1 + when /^-i(.+)/ then @path_inc = $1 + when /^-t(.+)/ then @path_tst = $1 + when /^-y(.+)/ then @yaml_config = $1 + when /^(\w+)/ + raise "ERROR: You can't have more than one Module name specified!" unless @module_name.nil? + @module_name = arg + when /^-(h|-help)/ + puts HELP_TEXT + exit + else + raise "ERROR: Unknown option specified '#{arg}'" + end +end +raise "ERROR: You must have a Module name specified! (use option -h for help)" if @module_name.nil? + +#load yaml file if one was requested +if @yaml_config + require 'yaml' + cfg = YAML.load_file(HERE + @yaml_config)[:generate_module] + @path_src = cfg[:defaults][:path_src] if @path_src.nil? + @path_inc = cfg[:defaults][:path_inc] if @path_inc.nil? + @path_tst = cfg[:defaults][:path_tst] if @path_tst.nil? + @update_svn = cfg[:defaults][:update_svn] if @update_svn.nil? + @extra_inc = cfg[:includes] + @boilerplates = cfg[:boilerplates] +else + @boilerplates = {} +end + +# Create default file paths if none were provided +@path_src = HERE + "../src/" if @path_src.nil? +@path_inc = @path_src if @path_inc.nil? +@path_tst = HERE + "../test/" if @path_tst.nil? +@path_src += '/' unless (@path_src[-1] == 47) +@path_inc += '/' unless (@path_inc[-1] == 47) +@path_tst += '/' unless (@path_tst[-1] == 47) +@pattern = 'src' if @pattern.nil? +@includes = { :src => [], :inc => [], :tst => [] } +@includes.merge!(@extra_inc) unless @extra_inc.nil? + +#create triad definition +TRIAD = [ { :ext => '.c', :path => @path_src, :template => TEMPLATE_SRC, :inc => :src, :boilerplate => @boilerplates[:src] }, + { :ext => '.h', :path => @path_inc, :template => TEMPLATE_INC, :inc => :inc, :boilerplate => @boilerplates[:inc] }, + { :ext => '.c', :path => @path_tst+'Test', :template => TEMPLATE_TST, :inc => :tst, :boilerplate => @boilerplates[:tst] }, + ] + +#prepare the pattern for use +@patterns = PATTERNS[@pattern.downcase] +raise "ERROR: The design pattern specified isn't one that I recognize!" if @patterns.nil? + +# Assemble the path/names of the files we need to work with. +files = [] +TRIAD.each do |triad| + @patterns.each_pair do |pattern_file, pattern_traits| + files << { + :path => "#{triad[:path]}#{@module_name}#{pattern_file}#{triad[:ext]}", + :name => "#{@module_name}#{pattern_file}", + :template => triad[:template], + :boilerplate => triad[:boilerplate], + :includes => case(triad[:inc]) + when :src then @includes[:src] | pattern_traits[:inc].map{|f| f % [@module_name]} + when :inc then @includes[:inc] + when :tst then @includes[:tst] | pattern_traits[:inc].map{|f| "Mock#{f}"% [@module_name]} + end + } + end +end + +# destroy files if that was what was requested +if @destroy + files.each do |filespec| + file = filespec[:path] + if File.exist?(file) + if @update_svn + `svn delete \"#{file}\" --force` + puts "File #{file} deleted and removed from source control" + else + FileUtils.remove(file) + puts "File #{file} deleted" + end + else + puts "File #{file} does not exist so cannot be removed." + end + end + puts "Destroy Complete" + exit +end + +#Abort if any module already exists +files.each do |file| + raise "ERROR: File #{file[:name]} already exists. Exiting." if File.exist?(file[:path]) +end + +# Create Source Modules +files.each_with_index do |file, i| + File.open(file[:path], 'w') do |f| + f.write(file[:boilerplate] % [file[:name]]) unless file[:boilerplate].nil? + f.write(file[:template] % [ file[:name], + file[:includes].map{|f| "#include \"#{f}\"\n"}.join, + file[:name].upcase ] + ) + end + if (@update_svn) + `svn add \"#{file[:path]}\"` + if $?.exitstatus == 0 + puts "File #{file[:path]} created and added to source control" + else + puts "File #{file[:path]} created but FAILED adding to source control!" + end + else + puts "File #{file[:path]} created" + end +end + +puts 'Generate Complete' diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/auto/generate_test_runner.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/auto/generate_test_runner.rb new file mode 100644 index 0000000..aff5053 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/auto/generate_test_runner.rb @@ -0,0 +1,303 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +File.expand_path(File.join(File.dirname(__FILE__),'colour_prompt')) + +class UnityTestRunnerGenerator + + def initialize(options = nil) + @options = { :includes => [], :plugins => [], :framework => :unity } + case(options) + when NilClass then @options + when String then @options.merge!(UnityTestRunnerGenerator.grab_config(options)) + when Hash then @options.merge!(options) + else raise "If you specify arguments, it should be a filename or a hash of options" + end + end + + def self.grab_config(config_file) + options = { :includes => [], :plugins => [], :framework => :unity } + unless (config_file.nil? or config_file.empty?) + require 'yaml' + yaml_guts = YAML.load_file(config_file) + options.merge!(yaml_guts[:unity] ? yaml_guts[:unity] : yaml_guts[:cmock]) + raise "No :unity or :cmock section found in #{config_file}" unless options + end + return(options) + end + + def run(input_file, output_file, options=nil) + tests = [] + includes = [] + used_mocks = [] + + @options.merge!(options) unless options.nil? + module_name = File.basename(input_file) + + #pull required data from source file + File.open(input_file, 'r') do |input| + tests = find_tests(input) + includes = find_includes(input) + used_mocks = find_mocks(includes) + end + + #build runner file + File.open(output_file, 'w') do |output| + create_header(output, used_mocks) + create_externs(output, tests, used_mocks) + create_mock_management(output, used_mocks) + create_suite_setup_and_teardown(output) + create_reset(output, used_mocks) + create_main(output, input_file, tests) + end + + all_files_used = [input_file, output_file] + all_files_used += includes.map {|filename| filename + '.c'} unless includes.empty? + all_files_used += @options[:includes] unless @options[:includes].empty? + return all_files_used.uniq + end + + def find_tests(input_file) + tests_raw = [] + tests_args = [] + tests_and_line_numbers = [] + + input_file.rewind + source_raw = input_file.read + source_scrubbed = source_raw.gsub(/\/\/.*$/, '') # remove line comments + source_scrubbed = source_scrubbed.gsub(/\/\*.*?\*\//m, '') # remove block comments + lines = source_scrubbed.split(/(^\s*\#.*$) # Treat preprocessor directives as a logical line + | (;|\{|\}) /x) # Match ;, {, and } as end of lines + + lines.each_with_index do |line, index| + #find tests + if line =~ /^((?:\s*TEST_CASE\s*\(.*?\)\s*)*)\s*void\s+(test.*?)\s*\(\s*(.*)\s*\)/ + arguments = $1 + name = $2 + call = $3 + args = nil + if (@options[:use_param_tests] and !arguments.empty?) + args = [] + arguments.scan(/\s*TEST_CASE\s*\((.*)\)\s*$/) {|a| args << a[0]} + end + tests_and_line_numbers << { :name => name, :args => args, :call => call, :line_number => 0 } + tests_args = [] + end + end + + #determine line numbers and create tests to run + source_lines = source_raw.split("\n") + source_index = 0; + tests_and_line_numbers.size.times do |i| + source_lines[source_index..-1].each_with_index do |line, index| + if (line =~ /#{tests_and_line_numbers[i][:name]}/) + source_index += index + tests_and_line_numbers[i][:line_number] = source_index + 1 + break + end + end + end + + return tests_and_line_numbers + end + + def find_includes(input_file) + input_file.rewind + includes = [] + input_file.readlines.each do |line| + scan_results = line.scan(/^\s*#include\s+\"\s*(.+)\.[hH]\s*\"/) + includes << scan_results[0][0] if (scan_results.size > 0) + end + return includes + end + + def find_mocks(includes) + mock_headers = [] + includes.each do |include_file| + mock_headers << File.basename(include_file) if (include_file =~ /^mock/i) + end + return mock_headers + end + + def create_header(output, mocks) + output.puts('/* AUTOGENERATED FILE. DO NOT EDIT. */') + create_runtest(output, mocks) + output.puts("\n//=======Automagically Detected Files To Include=====") + output.puts("#include \"#{@options[:framework].to_s}.h\"") + output.puts('#include "cmock.h"') unless (mocks.empty?) + @options[:includes].flatten.uniq.compact.each do |inc| + output.puts("#include #{inc.include?('<') ? inc : "\"#{inc.gsub('.h','')}.h\""}") + end + output.puts('#include ') + output.puts('#include ') + output.puts('#include "CException.h"') if @options[:plugins].include?(:cexception) + mocks.each do |mock| + output.puts("#include \"#{mock.gsub('.h','')}.h\"") + end + if @options[:enforce_strict_ordering] + output.puts('') + output.puts('int GlobalExpectCount;') + output.puts('int GlobalVerifyOrder;') + output.puts('char* GlobalOrderError;') + end + end + + def create_externs(output, tests, mocks) + output.puts("\n//=======External Functions This Runner Calls=====") + output.puts("extern void setUp(void);") + output.puts("extern void tearDown(void);") + tests.each do |test| + output.puts("extern void #{test[:name]}(#{test[:call]});") + end + output.puts('') + end + + def create_mock_management(output, mocks) + unless (mocks.empty?) + output.puts("\n//=======Mock Management=====") + output.puts("static void CMock_Init(void)") + output.puts("{") + if @options[:enforce_strict_ordering] + output.puts(" GlobalExpectCount = 0;") + output.puts(" GlobalVerifyOrder = 0;") + output.puts(" GlobalOrderError = NULL;") + end + mocks.each do |mock| + output.puts(" #{mock}_Init();") + end + output.puts("}\n") + + output.puts("static void CMock_Verify(void)") + output.puts("{") + mocks.each do |mock| + output.puts(" #{mock}_Verify();") + end + output.puts("}\n") + + output.puts("static void CMock_Destroy(void)") + output.puts("{") + mocks.each do |mock| + output.puts(" #{mock}_Destroy();") + end + output.puts("}\n") + end + end + + def create_suite_setup_and_teardown(output) + unless (@options[:suite_setup].nil?) + output.puts("\n//=======Suite Setup=====") + output.puts("static int suite_setup(void)") + output.puts("{") + output.puts(@options[:suite_setup]) + output.puts("}") + end + unless (@options[:suite_teardown].nil?) + output.puts("\n//=======Suite Teardown=====") + output.puts("static int suite_teardown(int num_failures)") + output.puts("{") + output.puts(@options[:suite_teardown]) + output.puts("}") + end + end + + def create_runtest(output, used_mocks) + cexception = @options[:plugins].include? :cexception + va_args1 = @options[:use_param_tests] ? ', ...' : '' + va_args2 = @options[:use_param_tests] ? '__VA_ARGS__' : '' + output.puts("\n//=======Test Runner Used To Run Each Test Below=====") + output.puts("#define RUN_TEST_NO_ARGS") if @options[:use_param_tests] + output.puts("#define RUN_TEST(TestFunc, TestLineNum#{va_args1}) \\") + output.puts("{ \\") + output.puts(" Unity.CurrentTestName = #TestFunc#{va_args2.empty? ? '' : " \"(\" ##{va_args2} \")\""}; \\") + output.puts(" Unity.CurrentTestLineNumber = TestLineNum; \\") + output.puts(" Unity.NumberOfTests++; \\") + output.puts(" if (TEST_PROTECT()) \\") + output.puts(" { \\") + output.puts(" CEXCEPTION_T e; \\") if cexception + output.puts(" Try { \\") if cexception + output.puts(" CMock_Init(); \\") unless (used_mocks.empty?) + output.puts(" setUp(); \\") + output.puts(" TestFunc(#{va_args2}); \\") + output.puts(" CMock_Verify(); \\") unless (used_mocks.empty?) + output.puts(" } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, \"Unhandled Exception!\"); } \\") if cexception + output.puts(" } \\") + output.puts(" CMock_Destroy(); \\") unless (used_mocks.empty?) + output.puts(" if (TEST_PROTECT() && !TEST_IS_IGNORED) \\") + output.puts(" { \\") + output.puts(" tearDown(); \\") + output.puts(" } \\") + output.puts(" UnityConcludeTest(); \\") + output.puts("}\n") + end + + def create_reset(output, used_mocks) + output.puts("\n//=======Test Reset Option=====") + output.puts("void resetTest()") + output.puts("{") + output.puts(" CMock_Verify();") unless (used_mocks.empty?) + output.puts(" CMock_Destroy();") unless (used_mocks.empty?) + output.puts(" tearDown();") + output.puts(" CMock_Init();") unless (used_mocks.empty?) + output.puts(" setUp();") + output.puts("}") + end + + def create_main(output, filename, tests) + output.puts("\n\n//=======MAIN=====") + output.puts("int main(void)") + output.puts("{") + output.puts(" suite_setup();") unless @options[:suite_setup].nil? + output.puts(" Unity.TestFile = \"#{filename}\";") + output.puts(" UnityBegin();") + if (@options[:use_param_tests]) + tests.each do |test| + if ((test[:args].nil?) or (test[:args].empty?)) + output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]}, RUN_TEST_NO_ARGS);") + else + test[:args].each {|args| output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]}, #{args});")} + end + end + else + tests.each { |test| output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]});") } + end + output.puts() + output.puts(" return #{@options[:suite_teardown].nil? ? "" : "suite_teardown"}(UnityEnd());") + output.puts("}") + end +end + + +if ($0 == __FILE__) + options = { :includes => [] } + yaml_file = nil + + #parse out all the options first + ARGV.reject! do |arg| + case(arg) + when '-cexception' + options[:plugins] = [:cexception]; true + when /\.*\.yml/ + options = UnityTestRunnerGenerator.grab_config(arg); true + else false + end + end + + #make sure there is at least one parameter left (the input file) + if !ARGV[0] + puts ["usage: ruby #{__FILE__} (yaml) (options) input_test_file output_test_runner (includes)", + " blah.yml - will use config options in the yml file (see docs)", + " -cexception - include cexception support"].join("\n") + exit 1 + end + + #create the default test runner name if not specified + ARGV[1] = ARGV[0].gsub(".c","_Runner.c") if (!ARGV[1]) + + #everything else is an include file + options[:includes] ||= (ARGV.slice(2..-1).flatten.compact) if (ARGV.size > 2) + + UnityTestRunnerGenerator.new(options).run(ARGV[0], ARGV[1]) +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/auto/test_file_filter.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/auto/test_file_filter.rb new file mode 100644 index 0000000..3dbc26a --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/auto/test_file_filter.rb @@ -0,0 +1,23 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require'yaml' + +module RakefileHelpers + class TestFileFilter + def initialize(all_files = false) + @all_files = all_files + if not @all_files == true + if File.exist?('test_file_filter.yml') + filters = YAML.load_file( 'test_file_filter.yml' ) + @all_files, @only_files, @exclude_files = + filters[:all_files], filters[:only_files], filters[:exclude_files] + end + end + end + attr_accessor :all_files, :only_files, :exclude_files + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/auto/unity_test_summary.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/auto/unity_test_summary.rb new file mode 100644 index 0000000..69ec2e8 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/auto/unity_test_summary.rb @@ -0,0 +1,126 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +#!/usr/bin/ruby +# +# unity_test_summary.rb +# +require 'fileutils' +require 'set' + +class UnityTestSummary + include FileUtils::Verbose + + attr_reader :report, :total_tests, :failures, :ignored + + def initialize + @report = '' + @total_tests = 0 + @failures = 0 + @ignored = 0 + end + + def run + # Clean up result file names + results = @targets.map {|target| target.gsub(/\\/,'/')} + + # Dig through each result file, looking for details on pass/fail: + failure_output = [] + ignore_output = [] + + results.each do |result_file| + lines = File.readlines(result_file).map { |line| line.chomp } + if lines.length == 0 + raise "Empty test result file: #{result_file}" + else + output = get_details(result_file, lines) + failure_output << output[:failures] unless output[:failures].empty? + ignore_output << output[:ignores] unless output[:ignores].empty? + tests,failures,ignored = parse_test_summary(lines) + @total_tests += tests + @failures += failures + @ignored += ignored + end + end + + if @ignored > 0 + @report += "\n" + @report += "--------------------------\n" + @report += "UNITY IGNORED TEST SUMMARY\n" + @report += "--------------------------\n" + @report += ignore_output.flatten.join("\n") + end + + if @failures > 0 + @report += "\n" + @report += "--------------------------\n" + @report += "UNITY FAILED TEST SUMMARY\n" + @report += "--------------------------\n" + @report += failure_output.flatten.join("\n") + end + + @report += "\n" + @report += "--------------------------\n" + @report += "OVERALL UNITY TEST SUMMARY\n" + @report += "--------------------------\n" + @report += "#{@total_tests} TOTAL TESTS #{@failures} TOTAL FAILURES #{@ignored} IGNORED\n" + @report += "\n" + end + + def set_targets(target_array) + @targets = target_array + end + + def set_root_path(path) + @root = path + end + + def usage(err_msg=nil) + puts err_msg if err_msg + puts "Usage: unity_test_summary.rb" + exit 1 + end + + protected + + @@targets=nil + @@path=nil + @@root=nil + + def get_details(result_file, lines) + results = { :failures => [], :ignores => [], :successes => [] } + lines.each do |line| + src_file,src_line,test_name,status,msg = line.split(/:/) + line_out = ((@root and (@root != 0)) ? "#{@root}#{line}" : line ).gsub(/\//, "\\") + case(status) + when 'IGNORE' then results[:ignores] << line_out + when 'FAIL' then results[:failures] << line_out + when 'PASS' then results[:successes] << line_out + end + end + return results + end + + def parse_test_summary(summary) + if summary[-3..-1].join("\n") =~ /(\d+) Tests (\d+) Failures (\d+) Ignored/ + [$1.to_i,$2.to_i,$3.to_i] + else + raise "Couldn't parse test results: #{summary}" + end + end + + def here; File.expand_path(File.dirname(__FILE__)); end + +end + +if $0 == __FILE__ + script = UnityTestSummary.new + begin + script.run + rescue Exception => e + script.usage e.message + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/docs/Unity Summary.odt b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/docs/Unity Summary.odt new file mode 100644 index 0000000..f699661 Binary files /dev/null and b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/docs/Unity Summary.odt differ diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/docs/Unity Summary.pdf b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/docs/Unity Summary.pdf new file mode 100644 index 0000000..ad1a956 Binary files /dev/null and b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/docs/Unity Summary.pdf differ diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/docs/Unity Summary.txt b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/docs/Unity Summary.txt new file mode 100644 index 0000000..e0b179d --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/docs/Unity Summary.txt @@ -0,0 +1,217 @@ +============== +Unity Test API +============== + +[Copyright (c) 2007 - Unity Project by Mike Karlesky, Mark VanderVoord, and Greg Williams] + +------------- +Running Tests +------------- + +RUN_TEST(func, linenum) + +Each Test is run within the macro RUN_TEST. This macro performs necessary setup before the test is called and handles cleanup and result tabulation afterwards. + +-------------- +Ignoring Tests +-------------- + +There are times when a test is incomplete or not valid for some reason. At these times, TEST_IGNORE can be called. Control will immediately be returned to the caller of the test, and no failures will be returned. + +TEST_IGNORE() + +Ignore this test and return immediately + +TEST_IGNORE_MESSAGE (message) + +Ignore this test and return immediately. Output a message stating why the test was ignored. + +-------------- +Aborting Tests +-------------- + +There are times when a test will contain an infinite loop on error conditions, or there may be reason to escape from the test early without executing the rest of the test. A pair of macros support this functionality in Unity. The first (TEST_PROTECT) sets up the feature, and handles emergency abort cases. TEST_ABORT can then be used at any time within the tests to return to the last TEST_PROTECT call. + +TEST_PROTECT() + +Setup and Catch macro + +TEST_ABORT() + +Abort Test macro + +Example: + +main() +{ + if (TEST_PROTECT() == 0) + { + MyTest(); + } +} + +If MyTest calls TEST_ABORT, program control will immediately return to TEST_PROTECT with a non-zero return value. + + +======================= +Unity Assertion Summary +======================= + +-------------------- +Basic Validity Tests +-------------------- + +TEST_ASSERT_TRUE(condition) + +Evaluates whatever code is in condition and fails if it evaluates to false + +TEST_ASSERT_FALSE(condition) + +Evaluates whatever code is in condition and fails if it evaluates to true + +TEST_ASSERT(condition) + +Another way of calling TEST_ASSERT_TRUE + +TEST_ASSERT_UNLESS(condition) + +Another way of calling TEST_ASSERT_FALSE + +TEST_FAIL() +TEST_FAIL_MESSAGE(message) + +This test is automatically marked as a failure. The message is output stating why. + +------------------------------ +Numerical Assertions: Integers +------------------------------ + +TEST_ASSERT_EQUAL_INT(expected, actual) +TEST_ASSERT_EQUAL_INT8(expected, actual) +TEST_ASSERT_EQUAL_INT16(expected, actual) +TEST_ASSERT_EQUAL_INT32(expected, actual) +TEST_ASSERT_EQUAL_INT64(expected, actual) + +Compare two integers for equality and display errors as signed integers. A cast will be performed +to your natural integer size so often this can just be used. When you need to specify the exact size, +like when comparing arrays, you can use a specific version: + + + +TEST_ASSERT_EQUAL_UINT(expected, actual) + +Compare two integers for equality and display errors as unsigned integers. Like INT, there are +variants for different sizes also. + + + +TEST_ASSERT_EQUAL_HEX(expected, actual) + +Compares two integers for equality and display errors as hexadecimal. Like the other integer comparisons, +you can specify the size... here the size will also effect how many nibbles are shown (for example, HEX16 +will show 4 nibbles). + +_ARRAY + +You can append _ARRAY to any of these macros to make an array comparison of that type. Here you will +need to care a bit more about the actual size of the value being checked. You will also specify an +additional argument which is the number of elements to compare. For example: + +TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, elements) + + +TEST_ASSERT_EQUAL(expected, actual) + +Another way of calling TEST_ASSERT_EQUAL_INT + + + +TEST_ASSERT_INT_WITHIN(delta, expected, actual) + +Asserts that the actual value is within plus or minus delta of the expected value. This also comes in +size specific variants. + + +----------------------------- +Numerical Assertions: Bitwise +----------------------------- + +TEST_ASSERT_BITS(mask, expected, actual) + +Use an integer mask to specify which bits should be compared between two other integers. High bits in the mask are compared, low bits ignored. + +TEST_ASSERT_BITS_HIGH(mask, actual) + +Use an integer mask to specify which bits should be inspected to determine if they are all set high. High bits in the mask are compared, low bits ignored. + +TEST_ASSERT_BITS_LOW(mask, actual) + +Use an integer mask to specify which bits should be inspected to determine if they are all set low. High bits in the mask are compared, low bits ignored. + +TEST_ASSERT_BIT_HIGH(bit, actual) + +Test a single bit and verify that it is high. The bit is specified 0-31 for a 32-bit integer. + +TEST_ASSERT_BIT_LOW(bit, actual) + +Test a single bit and verify that it is low. The bit is specified 0-31 for a 32-bit integer. + +---------------------------- +Numerical Assertions: Floats +---------------------------- + +TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual) + +Asserts that the actual value is within plus or minus delta of the expected value. + +TEST_ASSERT_EQUAL_FLOAT(expected, actual) + +Asserts that two floating point values are "equal" within a small % delta of the expected value. + +----------------- +String Assertions +----------------- + +TEST_ASSERT_EQUAL_STRING(expected, actual) + +Compare two null-terminate strings. Fail if any character is different or if the lengths are different. + +TEST_ASSERT_EQUAL_STRING_MESSAGE(expected, actual, message) + +Compare two null-terminate strings. Fail if any character is different or if the lengths are different. Output a custom message on failure. + +------------------ +Pointer Assertions +------------------ + +Most pointer operations can be performed by simply using the integer comparisons above. However, a couple of special cases are added for clarity. + +TEST_ASSERT_NULL(pointer) + +Fails if the pointer is not equal to NULL + +TEST_ASSERT_NOT_NULL(pointer) + +Fails if the pointer is equal to NULL + + +----------------- +Memory Assertions +----------------- + +TEST_ASSERT_EQUAL_MEMORY(expected, actual, len) + +Compare two blocks of memory. This is a good generic assertion for types that can't be coerced into acting like +standard types... but since it's a memory compare, you have to be careful that your data types are packed. + +-------- +_MESSAGE +-------- + +you can append _MESSAGE to any of the macros to make them take an additional argument. This argument +is a string that will be printed at the end of the failure strings. This is useful for specifying more +information about the problem. + + + + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/docs/license.txt b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/docs/license.txt new file mode 100644 index 0000000..c42e330 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/docs/license.txt @@ -0,0 +1,31 @@ + Copyright (c) 2007-2010 Mike Karlesky, Mark VanderVoord, Greg Williams + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + The end-user documentation included with the redistribution, if + any, must include the following acknowledgment: "This product + includes software developed for the Unity Project, by Mike Karlesky, + Mark VanderVoord, and Greg Williams and other contributors", in + the same place and form as other third-party acknowledgments. + Alternately, this acknowledgment may appear in the software + itself, in the same form and location as other such third-party + acknowledgments. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/extras/fixture/build/MakefileWorker.mk b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/extras/fixture/build/MakefileWorker.mk new file mode 100644 index 0000000..9948751 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/extras/fixture/build/MakefileWorker.mk @@ -0,0 +1,331 @@ +#--------- +# +# MakefileWorker.mk +# +# Include this helper file in your makefile +# It makes +# A static library holding the application objs +# A test executable +# +# See this example for parameter settings +# examples/Makefile +# +#---------- +# Inputs - these variables describe what to build +# +# INCLUDE_DIRS - Directories used to search for include files. +# This generates a -I for each directory +# SRC_DIRS - Directories containing source file to built into the library +# SRC_FILES - Specific source files to build into library. Helpful when not all code +# in a directory can be built for test (hopefully a temporary situation) +# TEST_SRC_DIRS - Directories containing unit test code build into the unit test runner +# These do not go in a library. They are explicitly included in the test runner +# MOCKS_SRC_DIRS - Directories containing mock source files to build into the test runner +# These do not go in a library. They are explicitly included in the test runner +#---------- +# You can adjust these variables to influence how to build the test target +# and where to put and name outputs +# See below to determine defaults +# COMPONENT_NAME - the name of the thing being built +# UNITY_HOME - where Unity home dir found +# UNITY_BUILD_HOME - place for scripts +# UNITY_OBJS_DIR - a directory where o and d files go +# UNITY_LIB_DIR - a directory where libs go +# UNITY_ENABLE_DEBUG - build for debug +# UNITY_USE_MEM_LEAK_DETECTION - Links with overridden new and delete +# UNITY_USE_STD_CPP_LIB - Set to N to keep the standard C++ library out +# of the test harness +# UNITY_USE_GCOV - Turn on coverage analysis +# Clean then build with this flag set to Y, then 'make gcov' +# UNITY_TEST_RUNNER_FLAGS +# None by default +# UNITY_MAPFILE - generate a map file +# UNITY_WARNINGFLAGS - overly picky by default +# OTHER_MAKEFILE_TO_INCLUDE - a hook to use this makefile to make +# other targets. Like CSlim, which is part of fitnesse +#---------- +# +# Other flags users can initialize to sneak in their settings +# UNITY_CFLAGS - C complier +# UNITY_LDFLAGS - Linker flags +#---------- + + +ifndef COMPONENT_NAME + COMPONENT_NAME = name_this_in_the_makefile +endif + +# Debug on by default +ifndef UNITY_ENABLE_DEBUG + UNITY_ENABLE_DEBUG = Y +endif + +# new and delete for memory leak detection on by default +ifndef UNITY_USE_MEM_LEAK_DETECTION + UNITY_USE_MEM_LEAK_DETECTION = Y +endif + +# Use gcov, off by default +ifndef UNITY_USE_GCOV + UNITY_USE_GCOV = N +endif + +# Default warnings +ifndef UNITY_WARNINGFLAGS + UNITY_WARNINGFLAGS = -Wall -Werror -Wshadow -Wswitch-default +endif + +# Default dir for temporary files (d, o) +ifndef UNITY_OBJS_DIR + UNITY_OBJS_DIR = objs +endif + +# Default dir for the outout library +ifndef UNITY_LIB_DIR + UNITY_LIB_DIR = lib +endif + +# No map by default +ifndef UNITY_MAP_FILE + UNITY_MAP_FILE = N +endif + +#Not verbose by deafult +ifdef VERBOSE + UNITY_TEST_RUNNER_FLAGS += -v +endif + +ifdef GROUP + UNITY_TEST_RUNNER_FLAGS += -g $(GROUP) +endif + +ifdef NAME + UNITY_TEST_RUNNER_FLAGS += -n $(NAME) +endif + +ifdef REPEAT + UNITY_TEST_RUNNER_FLAGS += -r $(REPEAT) +endif + + +# -------------------------------------- +# derived flags in the following area +# -------------------------------------- +ifeq ($(UNITY_USE_MEM_LEAK_DETECTION), N) + UNITY_CFLAGS += -DUNITY_MEM_LEAK_DETECTION_DISABLED +else + UNITY_MEMLEAK_DETECTOR_MALLOC_MACRO_FILE = -include $(UNITY_HOME)/extras/fixture/src/unity_fixture_malloc_overrides.h +endif + +ifeq ($(UNITY_ENABLE_DEBUG), Y) + UNITY_CFLAGS += -g +endif + +ifeq ($(UNITY_USE_GCOV), Y) + UNITY_CFLAGS += -fprofile-arcs -ftest-coverage +endif + +UNITY_CFLAGS += $(UNITY_MEMLEAK_DETECTOR_MALLOC_MACRO_FILE) + +TARGET_MAP = $(COMPONENT_NAME).map.txt +ifeq ($(UNITY_MAP_FILE), Y) + UNITY_LDFLAGS += -Wl,-map,$(TARGET_MAP) +endif + +LD_LIBRARIES += -lgcov + +TARGET_LIB = \ + $(UNITY_LIB_DIR)/lib$(COMPONENT_NAME).a + +TEST_TARGET = \ + $(COMPONENT_NAME)_tests + +#Helper Functions +get_src_from_dir = $(wildcard $1/*.cpp) $(wildcard $1/*.c) +get_dirs_from_dirspec = $(wildcard $1) +get_src_from_dir_list = $(foreach dir, $1, $(call get_src_from_dir,$(dir))) +__src_to = $(subst .c,$1, $(subst .cpp,$1,$2)) +src_to = $(addprefix $(UNITY_OBJS_DIR)/,$(call __src_to,$1,$2)) +src_to_o = $(call src_to,.o,$1) +src_to_d = $(call src_to,.d,$1) +src_to_gcda = $(call src_to,.gcda,$1) +src_to_gcno = $(call src_to,.gcno,$1) +make_dotdot_a_subdir = $(subst ..,_dot_dot, $1) +time = $(shell date +%s) +delta_t = $(eval minus, $1, $2) +debug_print_list = $(foreach word,$1,echo " $(word)";) echo; + +#Derived +STUFF_TO_CLEAN += $(TEST_TARGET) $(TEST_TARGET).exe $(TARGET_LIB) $(TARGET_MAP) + +SRC += $(call get_src_from_dir_list, $(SRC_DIRS)) $(SRC_FILES) +OBJ = $(call src_to_o,$(SRC)) +OBJ2 = $(call make_dotdot_a_subdir. $(OBJ)) + +STUFF_TO_CLEAN += $(OBJ) + +TEST_SRC = $(call get_src_from_dir_list, $(TEST_SRC_DIRS)) +TEST_OBJS = $(call src_to_o,$(TEST_SRC)) +STUFF_TO_CLEAN += $(TEST_OBJS) + + +MOCKS_SRC = $(call get_src_from_dir_list, $(MOCKS_SRC_DIRS)) +MOCKS_OBJS = $(call src_to_o,$(MOCKS_SRC)) +STUFF_TO_CLEAN += $(MOCKS_OBJS) + +ALL_SRC = $(SRC) $(TEST_SRC) $(MOCKS_SRC) + +#Test coverage with gcov +GCOV_OUTPUT = gcov_output.txt +GCOV_REPORT = gcov_report.txt +GCOV_ERROR = gcov_error.txt +GCOV_GCDA_FILES = $(call src_to_gcda, $(ALL_SRC)) +GCOV_GCNO_FILES = $(call src_to_gcno, $(ALL_SRC)) +TEST_OUTPUT = $(TEST_TARGET).txt +STUFF_TO_CLEAN += \ + $(GCOV_OUTPUT)\ + $(GCOV_REPORT)\ + $(GCOV_REPORT).html\ + $(GCOV_ERROR)\ + $(GCOV_GCDA_FILES)\ + $(GCOV_GCNO_FILES)\ + $(TEST_OUTPUT) + + +#The gcda files for gcov need to be deleted before each run +#To avoid annoying messages. +GCOV_CLEAN = $(SILENCE)rm -f $(GCOV_GCDA_FILES) $(GCOV_OUTPUT) $(GCOV_REPORT) $(GCOV_ERROR) +RUN_TEST_TARGET = $(SILENCE) $(GCOV_CLEAN) ; echo "Running $(TEST_TARGET)"; ./$(TEST_TARGET) $(UNITY_TEST_RUNNER_FLAGS) + +INCLUDES_DIRS_EXPANDED = $(call get_dirs_from_dirspec, $(INCLUDE_DIRS)) +INCLUDES += $(foreach dir, $(INCLUDES_DIRS_EXPANDED), -I$(dir)) +MOCK_DIRS_EXPANDED = $(call get_dirs_from_dirspec, $(MOCKS_SRC_DIRS)) +INCLUDES += $(foreach dir, $(MOCK_DIRS_EXPANDED), -I$(dir)) + + +DEP_FILES = $(call src_to_d, $(ALL_SRC)) +STUFF_TO_CLEAN += $(DEP_FILES) $(PRODUCTION_CODE_START) $(PRODUCTION_CODE_END) +STUFF_TO_CLEAN += $(STDLIB_CODE_START) $(MAP_FILE) cpputest_*.xml junit_run_output + +# We'll use the UNITY_CFLAGS etc so that you can override AND add to the CppUTest flags +CFLAGS = $(UNITY_CFLAGS) $(UNITY_ADDITIONAL_CFLAGS) $(INCLUDES) $(UNITY_WARNINGFLAGS) +LDFLAGS = $(UNITY_LDFLAGS) $(UNITY_ADDITIONAL_LDFLAGS) + +# Targets + +.PHONY: all +all: start $(TEST_TARGET) + $(RUN_TEST_TARGET) + +.PHONY: start +start: $(TEST_TARGET) + $(SILENCE)START_TIME=$(call time) + +.PHONY: all_no_tests +all_no_tests: $(TEST_TARGET) + +.PHONY: flags +flags: + @echo + @echo "Compile C source with CFLAGS:" + @$(call debug_print_list,$(CFLAGS)) + @echo "Link with LDFLAGS:" + @$(call debug_print_list,$(LDFLAGS)) + @echo "Link with LD_LIBRARIES:" + @$(call debug_print_list,$(LD_LIBRARIES)) + @echo "Create libraries with ARFLAGS:" + @$(call debug_print_list,$(ARFLAGS)) + @echo "OBJ files:" + @$(call debug_print_list,$(OBJ2)) + + +$(TEST_TARGET): $(TEST_OBJS) $(MOCKS_OBJS) $(PRODUCTION_CODE_START) $(TARGET_LIB) $(USER_LIBS) $(PRODUCTION_CODE_END) $(STDLIB_CODE_START) + $(SILENCE)echo Linking $@ + $(SILENCE)$(LINK.o) -o $@ $^ $(LD_LIBRARIES) + +$(TARGET_LIB): $(OBJ) + $(SILENCE)echo Building archive $@ + $(SILENCE)mkdir -p lib + $(SILENCE)$(AR) $(ARFLAGS) $@ $^ + $(SILENCE)ranlib $@ + +test: $(TEST_TARGET) + $(RUN_TEST_TARGET) | tee $(TEST_OUTPUT) + +vtest: $(TEST_TARGET) + $(RUN_TEST_TARGET) -v | tee $(TEST_OUTPUT) + +$(UNITY_OBJS_DIR)/%.o: %.cpp + @echo compiling $(notdir $<) + $(SILENCE)mkdir -p $(dir $@) + $(SILENCE)$(COMPILE.cpp) -MMD -MP $(OUTPUT_OPTION) $< + +$(UNITY_OBJS_DIR)/%.o: %.c + @echo compiling $(notdir $<) + $(SILENCE)mkdir -p $(dir $@) + $(SILENCE)$(COMPILE.c) -MMD -MP $(OUTPUT_OPTION) $< + +ifneq "$(MAKECMDGOALS)" "clean" +-include $(DEP_FILES) +endif + +.PHONY: clean +clean: + $(SILENCE)echo Making clean + $(SILENCE)$(RM) $(STUFF_TO_CLEAN) + $(SILENCE)rm -rf gcov $(UNITY_OBJS_DIR) + $(SILENCE)find . -name "*.gcno" | xargs rm -f + $(SILENCE)find . -name "*.gcda" | xargs rm -f + +#realclean gets rid of all gcov, o and d files in the directory tree +#not just the ones made by this makefile +.PHONY: realclean +realclean: clean + $(SILENCE)rm -rf gcov + $(SILENCE)find . -name "*.gdcno" | xargs rm -f + $(SILENCE)find . -name "*.[do]" | xargs rm -f + +gcov: test + $(SILENCE)for d in $(SRC_DIRS) ; do \ + gcov --object-directory $(UNITY_OBJS_DIR)/$$d $$d/*.c $$d/*.cpp >> $(GCOV_OUTPUT) 2>>$(GCOV_ERROR) ; \ + done + $(SILENCE)for f in $(SRC_FILES) ; do \ + gcov --object-directory $(UNITY_OBJS_DIR)/$$f $$f >> $(GCOV_OUTPUT) 2>>$(GCOV_ERROR) ; \ + done + $(UNITY_BUILD_HOME)/filterGcov.sh $(GCOV_OUTPUT) $(GCOV_ERROR) $(GCOV_REPORT) $(TEST_OUTPUT) + $(SILENCE)cat $(GCOV_REPORT) + $(SILENCE)mkdir -p gcov + $(SILENCE)mv *.gcov gcov + $(SILENCE)mv gcov_* gcov + $(SILENCE)echo "See gcov directory for details" + +debug: + @echo + @echo "Target Source files:" + @$(call debug_print_list,$(SRC)) + @echo "Target Object files:" + @$(call debug_print_list,$(OBJ)) + @echo "Test Source files:" + @$(call debug_print_list,$(TEST_SRC)) + @echo "Test Object files:" + @$(call debug_print_list,$(TEST_OBJS)) + @echo "Mock Source files:" + @$(call debug_print_list,$(MOCKS_SRC)) + @echo "Mock Object files:" + @$(call debug_print_list,$(MOCKS_OBJS)) + @echo "All Input Dependency files:" + @$(call debug_print_list,$(DEP_FILES)) + @echo Stuff to clean: + @$(call debug_print_list,$(STUFF_TO_CLEAN)) + @echo Includes: + @$(call debug_print_list,$(INCLUDES)) + +ifneq "$(OTHER_MAKEFILE_TO_INCLUDE)" "" +-include $(OTHER_MAKEFILE_TO_INCLUDE) +endif + + + +st,$(TEST_SRC)) + @echo "Test Object files:" + @$(call debug_print \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/extras/fixture/build/filterGcov.sh b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/extras/fixture/build/filterGcov.sh new file mode 100644 index 0000000..a861cf6 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/extras/fixture/build/filterGcov.sh @@ -0,0 +1,61 @@ +#!/bin/bash +INPUT_FILE=$1 +TEMP_FILE1=${INPUT_FILE}1.tmp +TEMP_FILE2=${INPUT_FILE}2.tmp +TEMP_FILE3=${INPUT_FILE}3.tmp +ERROR_FILE=$2 +OUTPUT_FILE=$3 +HTML_OUTPUT_FILE=$3.html +TEST_RESULTS=$4 + +flattenGcovOutput() { +while read line1 +do + read line2 + echo $line2 " " $line1 + read junk + read junk +done < ${INPUT_FILE} +} + +getRidOfCruft() { +sed '-e s/^Lines.*://g' \ + '-e s/^[0-9]\./ &/g' \ + '-e s/^[0-9][0-9]\./ &/g' \ + '-e s/of.*File/ /g' \ + "-e s/'//g" \ + '-e s/^.*\/usr\/.*$//g' \ + '-e s/^.*\.$//g' +} + +getFileNameRootFromErrorFile() { +sed '-e s/gc..:cannot open .* file//g' ${ERROR_FILE} +} + +writeEachNoTestCoverageFile() { +while read line +do + echo " 0.00% " ${line} +done +} + +createHtmlOutput() { + echo "" + echo "" + sed "-e s/.*% /
CoverageFile
&<\/td>/" \ + "-e s/[a-zA-Z0-9_]*\.[ch][a-z]*/&<\/a><\/td><\/tr>/" + echo "
" + sed "-e s/.*/&
/g" < ${TEST_RESULTS} +} + + +flattenGcovOutput | getRidOfCruft > ${TEMP_FILE1} +getFileNameRootFromErrorFile | writeEachNoTestCoverageFile > ${TEMP_FILE2} +cat ${TEMP_FILE1} ${TEMP_FILE2} | sort | uniq > ${OUTPUT_FILE} +createHtmlOutput < ${OUTPUT_FILE} > ${HTML_OUTPUT_FILE} +rm -f ${TEMP_FILE1} ${TEMP_FILE2} +erageFile" + sed "-e s/.*% /&<\/td>/" \ + "-e s/[a-zA-Z0-9_]*\.[ch][a-z]*/&<\/a><\/td><\/tr>/" + echo "" + sed "-e s/.*/&
/g" < ${TEST_RESULTS \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/extras/fixture/rakefile.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/extras/fixture/rakefile.rb new file mode 100644 index 0000000..6181707 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/extras/fixture/rakefile.rb @@ -0,0 +1,37 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require HERE + 'rakefile_helper' + +include RakefileHelpers + +# Load default configuration, for now +DEFAULT_CONFIG_FILE = 'gcc.yml' +configure_toolchain(DEFAULT_CONFIG_FILE) + +task :unit do + run_tests +end + +desc "Build and test Unity Framework" +task :all => [:clean, :unit] +task :default => [:clobber, :all] +task :ci => [:no_color, :default] +task :cruise => [:no_color, :default] + +desc "Load configuration" +task :config, :config_file do |t, args| + configure_toolchain(args[:config_file]) +end + +task :no_color do + $colour_output = false +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/extras/fixture/rakefile_helper.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/extras/fixture/rakefile_helper.rb new file mode 100644 index 0000000..a7f6a28 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/extras/fixture/rakefile_helper.rb @@ -0,0 +1,178 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require 'yaml' +require 'fileutils' +require HERE+'../../auto/unity_test_summary' +require HERE+'../../auto/generate_test_runner' +require HERE+'../../auto/colour_reporter' + +module RakefileHelpers + + C_EXTENSION = '.c' + + def load_configuration(config_file) + unless ($configured) + $cfg_file = HERE+"../../targets/#{config_file}" unless (config_file =~ /[\\|\/]/) + $cfg = YAML.load(File.read($cfg_file)) + $colour_output = false unless $cfg['colour'] + $configured = true if (config_file != DEFAULT_CONFIG_FILE) + end + end + + def configure_clean + CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil? + end + + def configure_toolchain(config_file=DEFAULT_CONFIG_FILE) + config_file += '.yml' unless config_file =~ /\.yml$/ + config_file = config_file unless config_file =~ /[\\|\/]/ + load_configuration(config_file) + configure_clean + end + + def tackit(strings) + if strings.is_a?(Array) + result = "\"#{strings.join}\"" + else + result = strings + end + return result + end + + def squash(prefix, items) + result = '' + items.each { |item| result += " #{prefix}#{tackit(item)}" } + return result + end + + def build_compiler_fields + command = tackit($cfg['compiler']['path']) + if $cfg['compiler']['defines']['items'].nil? + defines = '' + else + defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items'] + ['UNITY_OUTPUT_CHAR=UnityOutputCharSpy_OutputChar']) + end + options = squash('', $cfg['compiler']['options']) + includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :defines => defines, :options => options, :includes => includes} + end + + def compile(file, defines=[]) + compiler = build_compiler_fields + unity_include = $cfg['compiler']['includes']['prefix']+'../../src' + cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{unity_include} #{file} " + + "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" + + "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" + execute(cmd_str) + end + + def build_linker_fields + command = tackit($cfg['linker']['path']) + if $cfg['linker']['options'].nil? + options = '' + else + options = squash('', $cfg['linker']['options']) + end + if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?) + includes = '' + else + includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) + end + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :options => options, :includes => includes} + end + + def link(exe_name, obj_list) + linker = build_linker_fields + cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + + (obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).join + + $cfg['linker']['bin_files']['prefix'] + ' ' + + $cfg['linker']['bin_files']['destination'] + + exe_name + $cfg['linker']['bin_files']['extension'] + execute(cmd_str) + end + + def build_simulator_fields + return nil if $cfg['simulator'].nil? + if $cfg['simulator']['path'].nil? + command = '' + else + command = (tackit($cfg['simulator']['path']) + ' ') + end + if $cfg['simulator']['pre_support'].nil? + pre_support = '' + else + pre_support = squash('', $cfg['simulator']['pre_support']) + end + if $cfg['simulator']['post_support'].nil? + post_support = '' + else + post_support = squash('', $cfg['simulator']['post_support']) + end + return {:command => command, :pre_support => pre_support, :post_support => post_support} + end + + def execute(command_string, verbose=true) + report command_string + output = `#{command_string}`.chomp + report(output) if (verbose && !output.nil? && (output.length > 0)) + if ($?.exitstatus != 0) + raise "Command failed. (Returned #{$?.exitstatus})" + end + return output + end + + def report_summary + summary = UnityTestSummary.new + summary.set_root_path(HERE) + results_glob = "#{$cfg['compiler']['build_path']}*.test*" + results_glob.gsub!(/\\/, '/') + results = Dir[results_glob] + summary.set_targets(results) + summary.run + end + + def run_tests + report 'Running Unity system tests...' + + # Tack on TEST define for compiling unit tests + load_configuration($cfg_file) + test_defines = ['TEST'] + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + + # Get a list of all source files needed + src_files = Dir[HERE+'src/*.c'] + src_files += Dir[HERE+'test/*.c'] + src_files << '../../src/Unity.c' + + # Build object files + src_files.each { |f| compile(f, test_defines) } + obj_list = src_files.map {|f| File.basename(f.ext($cfg['compiler']['object_files']['extension'])) } + + # Link the test executable + test_base = "framework_test" + link(test_base, obj_list) + + # Execute unit test and generate results file + simulator = build_simulator_fields + executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] + if simulator.nil? + cmd_str = executable + " -v -r" + else + cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" + end + output = execute(cmd_str) + test_results = $cfg['compiler']['build_path'] + test_base + if output.match(/OK$/m).nil? + test_results += '.testfail' + else + test_results += '.testpass' + end + File.open(test_results, 'w') { |f| f.print output } + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/extras/fixture/readme.txt b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/extras/fixture/readme.txt new file mode 100644 index 0000000..6b9a78c --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/extras/fixture/readme.txt @@ -0,0 +1,9 @@ +Copyright (c) 2010 James Grenning and Contributed to Unity Project + +Unity Project - A Test Framework for C +Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +[Released under MIT License. Please refer to license.txt for details] + +This Framework is an optional add-on to Unity. By including unity_framework.h in place of unity.h, +you may now work with Unity in a manner similar to CppUTest. This framework adds the concepts of +test groups and gives finer control of your tests over the command line. \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/extras/fixture/src/unity_fixture.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/extras/fixture/src/unity_fixture.c new file mode 100644 index 0000000..1ba3e9a --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/extras/fixture/src/unity_fixture.c @@ -0,0 +1,381 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" +#include "unity_internals.h" +#include + +UNITY_FIXTURE_T UnityFixture; + +//If you decide to use the function pointer approach. +int (*outputChar)(int) = putchar; + +int verbose = 0; + +void setUp(void) { /*does nothing*/ } +void tearDown(void) { /*does nothing*/ } + +void announceTestRun(int runNumber) +{ + UnityPrint("Unity test run "); + UnityPrintNumber(runNumber+1); + UnityPrint(" of "); + UnityPrintNumber(UnityFixture.RepeatCount); + UNITY_OUTPUT_CHAR('\n'); +} + +int UnityMain(int argc, char* argv[], void (*runAllTests)()) +{ + int result = UnityGetCommandLineOptions(argc, argv); + int r; + if (result != 0) + return result; + + for (r = 0; r < UnityFixture.RepeatCount; r++) + { + announceTestRun(r); + UnityBegin(); + runAllTests(); + UNITY_OUTPUT_CHAR('\n'); + UnityEnd(); + } + + return UnityFailureCount(); +} + +static int selected(const char * filter, const char * name) +{ + if (filter == 0) + return 1; + return strstr(name, filter) ? 1 : 0; +} + +static int testSelected(const char* test) +{ + return selected(UnityFixture.NameFilter, test); +} + +static int groupSelected(const char* group) +{ + return selected(UnityFixture.GroupFilter, group); +} + +static void runTestCase() +{ + +} + +void UnityTestRunner(unityfunction* setup, + unityfunction* testBody, + unityfunction* teardown, + const char * printableName, + const char * group, + const char * name, + const char * file, int line) +{ + if (testSelected(name) && groupSelected(group)) + { + Unity.CurrentTestFailed = 0; + Unity.TestFile = file; + Unity.CurrentTestName = printableName; + Unity.CurrentTestLineNumber = line; + if (!UnityFixture.Verbose) + UNITY_OUTPUT_CHAR('.'); + else + UnityPrint(printableName); + + Unity.NumberOfTests++; + UnityMalloc_StartTest(); + UnityPointer_Init(); + + runTestCase(); + if (TEST_PROTECT()) + { + setup(); + testBody(); + } + if (TEST_PROTECT()) + { + teardown(); + } + if (TEST_PROTECT()) + { + UnityPointer_UndoAllSets(); + if (!Unity.CurrentTestFailed) + UnityMalloc_EndTest(); + UnityConcludeFixtureTest(); + } + else + { + //aborting - jwg - di i need these for the other TEST_PROTECTS? + } + } +} + +void UnityIgnoreTest() +{ + Unity.NumberOfTests++; + Unity.CurrentTestIgnored = 1; + UNITY_OUTPUT_CHAR('!'); +} + + +//------------------------------------------------- +//Malloc and free stuff +// +#define MALLOC_DONT_FAIL -1 +static int malloc_count; +static int malloc_fail_countdown = MALLOC_DONT_FAIL; + +void UnityMalloc_StartTest() +{ + malloc_count = 0; + malloc_fail_countdown = MALLOC_DONT_FAIL; +} + +void UnityMalloc_EndTest() +{ + malloc_fail_countdown = MALLOC_DONT_FAIL; + if (malloc_count != 0) + { + TEST_FAIL_MESSAGE("This test leaks!"); + } +} + +void UnityMalloc_MakeMallocFailAfterCount(int countdown) +{ + malloc_fail_countdown = countdown; +} + +#ifdef malloc +#undef malloc +#endif + +#ifdef free +#undef free +#endif + +#include +#include + +typedef struct GuardBytes +{ + int size; + char guard[sizeof(int)]; +} Guard; + + +static const char * end = "END"; + +void * unity_malloc(size_t size) +{ + char* mem; + Guard* guard; + + if (malloc_fail_countdown != MALLOC_DONT_FAIL) + { + if (malloc_fail_countdown == 0) + return 0; + malloc_fail_countdown--; + } + + malloc_count++; + + guard = (Guard*)malloc(size + sizeof(Guard) + 4); + guard->size = size; + mem = (char*)&(guard[1]); + memcpy(&mem[size], end, strlen(end) + 1); + + return (void*)mem; +} + +static int isOverrun(void * mem) +{ + Guard* guard = (Guard*)mem; + char* memAsChar = (char*)mem; + guard--; + + return strcmp(&memAsChar[guard->size], end) != 0; +} + +static void release_memory(void * mem) +{ + Guard* guard = (Guard*)mem; + guard--; + + malloc_count--; + free(guard); +} + +void unity_free(void * mem) +{ + int overrun = isOverrun(mem);//strcmp(&memAsChar[guard->size], end) != 0; + release_memory(mem); + if (overrun) + { + TEST_FAIL_MESSAGE("Buffer overrun detected during free()"); + } +} + +void* unity_calloc(size_t num, size_t size) +{ + void* mem = unity_malloc(num * size); + memset(mem, 0, num*size); + return mem; +} + +void* unity_realloc(void * oldMem, size_t size) +{ + Guard* guard = (Guard*)oldMem; +// char* memAsChar = (char*)oldMem; + void* newMem; + + if (oldMem == 0) + return unity_malloc(size); + + guard--; + if (isOverrun(oldMem)) + { + release_memory(oldMem); + TEST_FAIL_MESSAGE("Buffer overrun detected during realloc()"); + } + + if (size == 0) + { + release_memory(oldMem); + return 0; + } + + if (guard->size >= size) + return oldMem; + + newMem = unity_malloc(size); + memcpy(newMem, oldMem, size); + unity_free(oldMem); + return newMem; +} + + +//-------------------------------------------------------- +//Automatic pointer restoration functions +typedef struct _PointerPair +{ + struct _PointerPair * next; + void ** pointer; + void * old_value; +} PointerPair; + +enum {MAX_POINTERS=50}; +static PointerPair pointer_store[MAX_POINTERS]; +static int pointer_index = 0; + +void UnityPointer_Init() +{ + pointer_index = 0; +} + +void UnityPointer_Set(void ** pointer, void * newValue) +{ + if (pointer_index >= MAX_POINTERS) + TEST_FAIL_MESSAGE("Too many pointers set"); + + pointer_store[pointer_index].pointer = pointer; + pointer_store[pointer_index].old_value = *pointer; + *pointer = newValue; + pointer_index++; +} + +void UnityPointer_UndoAllSets() +{ + while (pointer_index > 0) + { + pointer_index--; + *(pointer_store[pointer_index].pointer) = + pointer_store[pointer_index].old_value; + + } +} + +int UnityFailureCount() +{ + return Unity.TestFailures; +} + +int UnityGetCommandLineOptions(int argc, char* argv[]) +{ + int i; + UnityFixture.Verbose = 0; + UnityFixture.GroupFilter = 0; + UnityFixture.NameFilter = 0; + UnityFixture.RepeatCount = 1; + + if (argc == 1) + return 0; + + for (i = 1; i < argc; ) + { + if (strcmp(argv[i], "-v") == 0) + { + UnityFixture.Verbose = 1; + i++; + } + else if (strcmp(argv[i], "-g") == 0) + { + i++; + if (i >= argc) + return 1; + UnityFixture.GroupFilter = argv[i]; + i++; + } + else if (strcmp(argv[i], "-n") == 0) + { + i++; + if (i >= argc) + return 1; + UnityFixture.NameFilter = argv[i]; + i++; + } + else if (strcmp(argv[i], "-r") == 0) + { + UnityFixture.RepeatCount = 2; + i++; + if (i < argc) + { + if (*(argv[i]) >= '0' && *(argv[i]) <= '9') + { + UnityFixture.RepeatCount = atoi(argv[i]); + i++; + } + } + } + } + return 0; +} + +void UnityConcludeFixtureTest() +{ + if (Unity.CurrentTestIgnored) + { + Unity.TestIgnores++; + } + else if (!Unity.CurrentTestFailed) + { + if (UnityFixture.Verbose) + { + UnityPrint(" PASS"); + UNITY_OUTPUT_CHAR('\n'); + } + } + else if (Unity.CurrentTestFailed) + { + Unity.TestFailures++; + } + + Unity.CurrentTestFailed = 0; + Unity.CurrentTestIgnored = 0; +} + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/extras/fixture/src/unity_fixture.h b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/extras/fixture/src/unity_fixture.h new file mode 100644 index 0000000..da1f871 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/extras/fixture/src/unity_fixture.h @@ -0,0 +1,81 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FIXTURE_H_ +#define UNITY_FIXTURE_H_ + +#include "unity.h" +#include "unity_internals.h" +#include "unity_fixture_malloc_overrides.h" +#include "unity_fixture_internals.h" + +int UnityMain(int argc, char* argv[], void (*runAllTests)()); + + +#define TEST_GROUP(group)\ + int TEST_GROUP_##group = 0 + +#define TEST_SETUP(group) void TEST_##group##_SETUP() + +#define TEST_TEAR_DOWN(group) void TEST_##group##_TEAR_DOWN() + + +#define TEST(group, name) \ + void TEST_##group##_##name##_();\ + void TEST_##group##_##name##_run()\ + {\ + UnityTestRunner(TEST_##group##_SETUP,\ + TEST_##group##_##name##_,\ + TEST_##group##_TEAR_DOWN,\ + "TEST(" #group ", " #name ")",\ + #group, #name,\ + __FILE__, __LINE__);\ + }\ + void TEST_##group##_##name##_() + +#define IGNORE_TEST(group, name) \ + void TEST_##group##_##name##_();\ + void TEST_##group##_##name##_run()\ + {\ + UnityIgnoreTest();\ + }\ + void TEST_##group##_##name##_() + +#define DECLARE_TEST_CASE(group, name) \ + void TEST_##group##_##name##_run() + +#define RUN_TEST_CASE(group, name) \ + DECLARE_TEST_CASE(group, name);\ + TEST_##group##_##name##_run(); + +//This goes at the bottom of each test file or in a separate c file +#define TEST_GROUP_RUNNER(group)\ + void TEST_##group##_GROUP_RUNNER_runAll();\ + void TEST_##group##_GROUP_RUNNER()\ + {\ + TEST_##group##_GROUP_RUNNER_runAll();\ + }\ + void TEST_##group##_GROUP_RUNNER_runAll() + +//Call this from main +#define RUN_TEST_GROUP(group)\ + void TEST_##group##_GROUP_RUNNER();\ + TEST_##group##_GROUP_RUNNER(); + +//CppUTest Compatibility Macros +#define UT_PTR_SET(ptr, newPointerValue) UnityPointer_Set((void**)&ptr, (void*)newPointerValue) +#define TEST_ASSERT_POINTERS_EQUAL(expected, actual) TEST_ASSERT_EQUAL_PTR(expected, actual) +#define TEST_ASSERT_BYTES_EQUAL(expected, actual) TEST_ASSERT_EQUAL_HEX8(0xff & (expected), 0xff & (actual)) +#define FAIL(message) TEST_FAIL((message)) +#define CHECK(condition) TEST_ASSERT_TRUE((condition)) +#define LONGS_EQUAL(expected, actual) TEST_ASSERT_EQUAL_INT((expected), (actual)) +#define STRCMP_EQUAL(expected, actual) TEST_ASSERT_EQUAL_STRING((expected), (actual)) +#define DOUBLES_EQUAL(expected, actual, delta) TEST_ASSERT_FLOAT_WITHIN(((expected), (actual), (delta)) + +void UnityMalloc_MakeMallocFailAfterCount(int count); + +#endif /* UNITY_FIXTURE_H_ */ diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/extras/fixture/src/unity_fixture_internals.h b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/extras/fixture/src/unity_fixture_internals.h new file mode 100644 index 0000000..db23f67 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/extras/fixture/src/unity_fixture_internals.h @@ -0,0 +1,44 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FIXTURE_INTERNALS_H_ +#define UNITY_FIXTURE_INTERNALS_H_ + +typedef struct _UNITY_FIXTURE_T +{ + int Verbose; + unsigned int RepeatCount; + const char* NameFilter; + const char* GroupFilter; +} UNITY_FIXTURE_T; + +typedef void unityfunction(); +void UnityTestRunner(unityfunction * setup, + unityfunction * body, + unityfunction * teardown, + const char * printableName, + const char * group, + const char * name, + const char * file, int line); + +void UnityIgnoreTest(); +void UnityMalloc_StartTest(); +void UnityMalloc_EndTest(); +int UnityFailureCount(); +int UnityGetCommandLineOptions(int argc, char* argv[]); +void UnityConcludeFixtureTest(); + +void UnityPointer_Set(void ** ptr, void * newValue); +void UnityPointer_UndoAllSets(); +void UnityPointer_Init(); + +void UnityAssertEqualPointer(const void * expected, + const void * actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +#endif /* UNITY_FIXTURE_INTERNALS_H_ */ diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h new file mode 100644 index 0000000..38f8e34 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h @@ -0,0 +1,16 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FIXTURE_MALLOC_OVERRIDES_H_ +#define UNITY_FIXTURE_MALLOC_OVERRIDES_H_ + +#define malloc unity_malloc +#define calloc unity_calloc +#define realloc unity_realloc +#define free unity_free + +#endif /* UNITY_FIXTURE_MALLOC_OVERRIDES_H_ */ diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/extras/fixture/test/main/AllTests.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/extras/fixture/test/main/AllTests.c new file mode 100644 index 0000000..ccb775b --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/extras/fixture/test/main/AllTests.c @@ -0,0 +1,21 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" + +static void runAllTests() +{ + RUN_TEST_GROUP(UnityFixture); + RUN_TEST_GROUP(UnityCommandOptions); + RUN_TEST_GROUP(LeakDetection) +} + +int main(int argc, char* argv[]) +{ + return UnityMain(argc, argv, runAllTests); +} + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/extras/fixture/test/testunity_fixture.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/extras/fixture/test/testunity_fixture.c new file mode 100644 index 0000000..de0c04c --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/extras/fixture/test/testunity_fixture.c @@ -0,0 +1,39 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" + +static int data = -1; + +TEST_GROUP(mygroup); + +TEST_SETUP(mygroup) +{ + data = 0; +} + +TEST_TEAR_DOWN(mygroup) +{ + data = -1; +} + +TEST(mygroup, test1) +{ + TEST_ASSERT_EQUAL_INT(0, data); +} + +TEST(mygroup, test2) +{ + TEST_ASSERT_EQUAL_INT(0, data); + data = 5; +} + +TEST(mygroup, test3) +{ + data = 7; + TEST_ASSERT_EQUAL_INT(7, data); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/extras/fixture/test/unity_fixture_Test.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/extras/fixture/test/unity_fixture_Test.c new file mode 100644 index 0000000..b8b4524 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/extras/fixture/test/unity_fixture_Test.c @@ -0,0 +1,321 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" +#include "unity_output_Spy.h" +#include +#include + +extern UNITY_FIXTURE_T UnityFixture; + +TEST_GROUP(UnityFixture); + +TEST_SETUP(UnityFixture) +{ +} + +TEST_TEAR_DOWN(UnityFixture) +{ +} + +int my_int; +int* pointer1 = 0; +int* pointer2 = (int*)2; +int* pointer3 = (int*)3; +int int1; +int int2; +int int3; +int int4; + +TEST(UnityFixture, PointerSetting) +{ + TEST_ASSERT_POINTERS_EQUAL(pointer1, 0); + UT_PTR_SET(pointer1, &int1); + UT_PTR_SET(pointer2, &int2); + UT_PTR_SET(pointer3, &int3); + TEST_ASSERT_POINTERS_EQUAL(pointer1, &int1); + TEST_ASSERT_POINTERS_EQUAL(pointer2, &int2); + TEST_ASSERT_POINTERS_EQUAL(pointer3, &int3); + UT_PTR_SET(pointer1, &int4); + UnityPointer_UndoAllSets(); + TEST_ASSERT_POINTERS_EQUAL(pointer1, 0); + TEST_ASSERT_POINTERS_EQUAL(pointer2, (int*)2); + TEST_ASSERT_POINTERS_EQUAL(pointer3, (int*)3); +} + +TEST(UnityFixture, ForceMallocFail) +{ + UnityMalloc_MakeMallocFailAfterCount(1); + void* m = malloc(10); + CHECK(m); + void* mfails = malloc(10); + TEST_ASSERT_POINTERS_EQUAL(0, mfails); + free(m); +} + +TEST(UnityFixture, ReallocSmallerIsUnchanged) +{ + void* m1 = malloc(10); + void* m2 = realloc(m1, 5); + TEST_ASSERT_POINTERS_EQUAL(m1, m2); + free(m2); +} + +TEST(UnityFixture, ReallocSameIsUnchanged) +{ + void* m1 = malloc(10); + void* m2 = realloc(m1, 10); + TEST_ASSERT_POINTERS_EQUAL(m1, m2); + free(m2); +} + +TEST(UnityFixture, ReallocLargerNeeded) +{ + void* m1 = malloc(10); + strcpy((char*)m1, "123456789"); + void* m2 = realloc(m1, 15); + CHECK(m1 != m2); + STRCMP_EQUAL("123456789", m2); + free(m2); +} + +TEST(UnityFixture, ReallocNullPointerIsLikeMalloc) +{ + void* m = realloc(0, 15); + CHECK(m != 0); + free(m); +} + +TEST(UnityFixture, ReallocSizeZeroFreesMemAndReturnsNullPointer) +{ + void* m1 = malloc(10); + void* m2 = realloc(m1, 0); + TEST_ASSERT_POINTERS_EQUAL(0, m2); +} + +TEST(UnityFixture, CallocFillsWithZero) +{ + void* m = calloc(3, sizeof(char)); + char* s = (char*)m; + TEST_ASSERT_BYTES_EQUAL(0, s[0]); + TEST_ASSERT_BYTES_EQUAL(0, s[1]); + TEST_ASSERT_BYTES_EQUAL(0, s[2]); + free(m); +} + +char *p1; +char *p2; + +TEST(UnityFixture, PointerSet) +{ + char c1; + char c2; + char newC1; + char newC2; + p1 = &c1; + p2 = &c2; + + UnityPointer_Init(10); + UT_PTR_SET(p1, &newC1); + UT_PTR_SET(p2, &newC2); + TEST_ASSERT_POINTERS_EQUAL(&newC1, p1); + TEST_ASSERT_POINTERS_EQUAL(&newC2, p2); + UnityPointer_UndoAllSets(); + TEST_ASSERT_POINTERS_EQUAL(&c1, p1); + TEST_ASSERT_POINTERS_EQUAL(&c2, p2); +} + +//------------------------------------------------------------ + +TEST_GROUP(UnityCommandOptions); + +int savedVerbose; +int savedRepeat; +const char* savedName; +const char* savedGroup; + +TEST_SETUP(UnityCommandOptions) +{ + savedVerbose = UnityFixture.Verbose; + savedRepeat = UnityFixture.RepeatCount; + savedName = UnityFixture.NameFilter; + savedGroup = UnityFixture.GroupFilter; +} + +TEST_TEAR_DOWN(UnityCommandOptions) +{ + UnityFixture.Verbose = savedVerbose; + UnityFixture.RepeatCount= savedRepeat; + UnityFixture.NameFilter = savedName; + UnityFixture.GroupFilter = savedGroup; +} + + +static char* noOptions[] = { + "testrunner.exe" +}; + +TEST(UnityCommandOptions, DefaultOptions) +{ + UnityGetCommandLineOptions(1, noOptions); + TEST_ASSERT_EQUAL(0, UnityFixture.Verbose); + TEST_ASSERT_POINTERS_EQUAL(0, UnityFixture.GroupFilter); + TEST_ASSERT_POINTERS_EQUAL(0, UnityFixture.NameFilter); + TEST_ASSERT_EQUAL(1, UnityFixture.RepeatCount); +} + +static char* verbose[] = { + "testrunner.exe", + "-v" +}; + +TEST(UnityCommandOptions, OptionVerbose) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(2, verbose)); + TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); +} + +static char* group[] = { + "testrunner.exe", + "-g", "groupname" +}; + +TEST(UnityCommandOptions, OptionSelectTestByGroup) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, group)); + STRCMP_EQUAL("groupname", UnityFixture.GroupFilter); +} + +static char* name[] = { + "testrunner.exe", + "-n", "testname" +}; + +TEST(UnityCommandOptions, OptionSelectTestByName) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, name)); + STRCMP_EQUAL("testname", UnityFixture.NameFilter); +} + +static char* repeat[] = { + "testrunner.exe", + "-r", "99" +}; + +TEST(UnityCommandOptions, OptionSelectRepeatTestsDefaultCount) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(2, repeat)); + TEST_ASSERT_EQUAL(2, UnityFixture.RepeatCount); +} + +TEST(UnityCommandOptions, OptionSelectRepeatTestsSpecificCount) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, repeat)); + TEST_ASSERT_EQUAL(99, UnityFixture.RepeatCount); +} + +static char* multiple[] = { + "testrunner.exe", + "-v", + "-g", "groupname", + "-n", "testname", + "-r", "98" +}; + +TEST(UnityCommandOptions, MultipleOptions) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(8, multiple)); + TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); + STRCMP_EQUAL("groupname", UnityFixture.GroupFilter); + STRCMP_EQUAL("testname", UnityFixture.NameFilter); + TEST_ASSERT_EQUAL(98, UnityFixture.RepeatCount); +} + +static char* dashRNotLast[] = { + "testrunner.exe", + "-v", + "-g", "gggg", + "-r", + "-n", "tttt", +}; + +TEST(UnityCommandOptions, MultipleOptionsDashRNotLastAndNoValueSpecified) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(7, dashRNotLast)); + TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); + STRCMP_EQUAL("gggg", UnityFixture.GroupFilter); + STRCMP_EQUAL("tttt", UnityFixture.NameFilter); + TEST_ASSERT_EQUAL(2, UnityFixture.RepeatCount); +} + + +//------------------------------------------------------------ + +TEST_GROUP(LeakDetection); + +TEST_SETUP(LeakDetection) +{ + UnityOutputCharSpy_Create(1000); +} + +TEST_TEAR_DOWN(LeakDetection) +{ + UnityOutputCharSpy_Destroy(); +} + +#define EXPECT_ABORT_BEGIN \ + { \ + jmp_buf TestAbortFrame; \ + memcpy(TestAbortFrame, Unity.AbortFrame, sizeof(jmp_buf)); \ + if (TEST_PROTECT()) \ + { + +#define EXPECT_ABORT_END \ + } \ + memcpy(Unity.AbortFrame, TestAbortFrame, sizeof(jmp_buf)); \ + } + +TEST(LeakDetection, DetectsLeak) +{ + void* m = malloc(10); + UnityOutputCharSpy_Enable(1); + EXPECT_ABORT_BEGIN + UnityMalloc_EndTest(); + EXPECT_ABORT_END + UnityOutputCharSpy_Enable(0); + CHECK(strstr(UnityOutputCharSpy_Get(), "This test leaks!")); + free(m); + Unity.CurrentTestFailed = 0; +} + +TEST(LeakDetection, BufferOverrunFoundDuringFree) +{ + void* m = malloc(10); + char* s = (char*)m; + s[10] = (char)0xFF; + UnityOutputCharSpy_Enable(1); + EXPECT_ABORT_BEGIN + free(m); + EXPECT_ABORT_END + UnityOutputCharSpy_Enable(0); + CHECK(strstr(UnityOutputCharSpy_Get(), "Buffer overrun detected during free()")); + Unity.CurrentTestFailed = 0; +} + +TEST(LeakDetection, BufferOverrunFoundDuringRealloc) +{ + void* m = malloc(10); + char* s = (char*)m; + s[10] = (char)0xFF; + UnityOutputCharSpy_Enable(1); + EXPECT_ABORT_BEGIN + m = realloc(m, 100); + EXPECT_ABORT_END + UnityOutputCharSpy_Enable(0); + CHECK(strstr(UnityOutputCharSpy_Get(), "Buffer overrun detected during realloc()")); + Unity.CurrentTestFailed = 0; +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c new file mode 100644 index 0000000..80fec09 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c @@ -0,0 +1,40 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" + +TEST_GROUP_RUNNER(UnityFixture) +{ + RUN_TEST_CASE(UnityFixture, PointerSetting); + RUN_TEST_CASE(UnityFixture, ForceMallocFail); + RUN_TEST_CASE(UnityFixture, ReallocSmallerIsUnchanged); + RUN_TEST_CASE(UnityFixture, ReallocSameIsUnchanged); + RUN_TEST_CASE(UnityFixture, ReallocLargerNeeded); + RUN_TEST_CASE(UnityFixture, ReallocNullPointerIsLikeMalloc); + RUN_TEST_CASE(UnityFixture, ReallocSizeZeroFreesMemAndReturnsNullPointer); + RUN_TEST_CASE(UnityFixture, CallocFillsWithZero); + RUN_TEST_CASE(UnityFixture, PointerSet); +} + +TEST_GROUP_RUNNER(UnityCommandOptions) +{ + RUN_TEST_CASE(UnityCommandOptions, DefaultOptions); + RUN_TEST_CASE(UnityCommandOptions, OptionVerbose); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectTestByGroup); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectTestByName); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectRepeatTestsDefaultCount); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectRepeatTestsSpecificCount); + RUN_TEST_CASE(UnityCommandOptions, MultipleOptions); + RUN_TEST_CASE(UnityCommandOptions, MultipleOptionsDashRNotLastAndNoValueSpecified); +} + +TEST_GROUP_RUNNER(LeakDetection) +{ + RUN_TEST_CASE(LeakDetection, DetectsLeak); + RUN_TEST_CASE(LeakDetection, BufferOverrunFoundDuringFree); + RUN_TEST_CASE(LeakDetection, BufferOverrunFoundDuringRealloc); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/extras/fixture/test/unity_output_Spy.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/extras/fixture/test/unity_output_Spy.c new file mode 100644 index 0000000..16faefa --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/extras/fixture/test/unity_output_Spy.c @@ -0,0 +1,56 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + + +#include "unity_output_Spy.h" +#include +#include +#include + +static int size; +static int count; +static char* buffer; +static int spy_enable; + +void UnityOutputCharSpy_Create(int s) +{ + size = s; + count = 0; + spy_enable = 0; + buffer = malloc(size); + memset(buffer, 0, size); +} + +void UnityOutputCharSpy_Destroy() +{ + size = 0; + free(buffer); +} + +int UnityOutputCharSpy_OutputChar(int c) +{ + if (spy_enable) + { + if (count < (size-1)) + buffer[count++] = c; + } + else + { + putchar(c); + } + return c; +} + +const char * UnityOutputCharSpy_Get() +{ + return buffer; +} + +void UnityOutputCharSpy_Enable(int enable) +{ + spy_enable = enable; +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/extras/fixture/test/unity_output_Spy.h b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/extras/fixture/test/unity_output_Spy.h new file mode 100644 index 0000000..7c1590e --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/extras/fixture/test/unity_output_Spy.h @@ -0,0 +1,17 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef D_unity_output_Spy_H +#define D_unity_output_Spy_H + +void UnityOutputCharSpy_Create(int s); +void UnityOutputCharSpy_Destroy(); +int UnityOutputCharSpy_OutputChar(int c); +const char * UnityOutputCharSpy_Get(); +void UnityOutputCharSpy_Enable(int enable); + +#endif diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/makefile b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/makefile new file mode 100644 index 0000000..8c8444b --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/makefile @@ -0,0 +1,35 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +C_COMPILER=gcc +TARGET_BASE = testunity +ifeq ($(OS),Windows_NT) + TARGET_EXTENSION=.exe +else + TARGET_EXTENSION=.out +endif +TARGET = $(TARGET_BASE)$(TARGET_EXTENSION) +OUT_FILE=-o $(TARGET) +SRC_FILES=src/unity.c test/testunity.c build/testunity_Runner.c +INC_DIRS=-Isrc +SYMBOLS=-DTEST -DUNITY_SUPPORT_64 + +ifeq ($(OS),Windows_NT) + CLEANUP = del /F /Q build\* && del /F /Q $(TARGET) +else + CLEANUP = rm -f build/*.o ; rm -f $(TARGET) +endif + +all: clean default + +default: + ruby auto/generate_test_runner.rb test/testunity.c build/testunity_Runner.c + $(C_COMPILER) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES) $(OUT_FILE) + $(TARGET) + +clean: + $(CLEANUP) + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/rakefile.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/rakefile.rb new file mode 100644 index 0000000..3ec5d5a --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/rakefile.rb @@ -0,0 +1,48 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require HERE + 'rakefile_helper' + +include RakefileHelpers + +# Load default configuration, for now +DEFAULT_CONFIG_FILE = 'gcc.yml' +configure_toolchain(DEFAULT_CONFIG_FILE) + +desc "Test unity with its own unit tests" +task :unit do + run_tests get_unit_test_files +end + +Rake::TestTask.new(:scripts) do |t| + t.pattern = 'test/test_*.rb' + t.verbose = true +end + +desc "Generate test summary" +task :summary do + report_summary +end + +desc "Build and test Unity" +task :all => [:clean, :scripts, :unit, :summary] +task :default => [:clobber, :all] +task :ci => [:no_color, :default] +task :cruise => [:no_color, :default] + +desc "Load configuration" +task :config, :config_file do |t, args| + configure_toolchain(args[:config_file]) +end + +task :no_color do + $colour_output = false +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/rakefile_helper.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/rakefile_helper.rb new file mode 100644 index 0000000..218fcaa --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/rakefile_helper.rb @@ -0,0 +1,243 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require 'yaml' +require 'fileutils' +require HERE+'auto/unity_test_summary' +require HERE+'auto/generate_test_runner' +require HERE+'auto/colour_reporter' + +module RakefileHelpers + + C_EXTENSION = '.c' + + def load_configuration(config_file) + unless ($configured) + $cfg_file = "targets/#{config_file}" unless (config_file =~ /[\\|\/]/) + $cfg = YAML.load(File.read($cfg_file)) + $colour_output = false unless $cfg['colour'] + $configured = true if (config_file != DEFAULT_CONFIG_FILE) + end + end + + def configure_clean + CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil? + end + + def configure_toolchain(config_file=DEFAULT_CONFIG_FILE) + config_file += '.yml' unless config_file =~ /\.yml$/ + config_file = config_file unless config_file =~ /[\\|\/]/ + load_configuration(config_file) + configure_clean + end + + def get_unit_test_files + path = $cfg['compiler']['unit_tests_path'] + 'test*' + C_EXTENSION + path.gsub!(/\\/, '/') + FileList.new(path) + end + + def get_local_include_dirs + include_dirs = $cfg['compiler']['includes']['items'].dup + include_dirs.delete_if {|dir| dir.is_a?(Array)} + return include_dirs + end + + def extract_headers(filename) + includes = [] + lines = File.readlines(filename) + lines.each do |line| + m = line.match(/^\s*#include\s+\"\s*(.+\.[hH])\s*\"/) + if not m.nil? + includes << m[1] + end + end + return includes + end + + def find_source_file(header, paths) + paths.each do |dir| + src_file = dir + header.ext(C_EXTENSION) + if (File.exists?(src_file)) + return src_file + end + end + return nil + end + + def tackit(strings) + if strings.is_a?(Array) + result = "\"#{strings.join}\"" + else + result = strings + end + return result + end + + def squash(prefix, items) + result = '' + items.each { |item| result += " #{prefix}#{tackit(item)}" } + return result + end + + def build_compiler_fields + command = tackit($cfg['compiler']['path']) + if $cfg['compiler']['defines']['items'].nil? + defines = '' + else + defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items']) + end + options = squash('', $cfg['compiler']['options']) + includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :defines => defines, :options => options, :includes => includes} + end + + def compile(file, defines=[]) + compiler = build_compiler_fields + cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{file} " + + "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" + + "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" + execute(cmd_str) + end + + def build_linker_fields + command = tackit($cfg['linker']['path']) + if $cfg['linker']['options'].nil? + options = '' + else + options = squash('', $cfg['linker']['options']) + end + if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?) + includes = '' + else + includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) + end + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :options => options, :includes => includes} + end + + def link(exe_name, obj_list) + linker = build_linker_fields + cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + + (obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).join + + $cfg['linker']['bin_files']['prefix'] + ' ' + + $cfg['linker']['bin_files']['destination'] + + exe_name + $cfg['linker']['bin_files']['extension'] + execute(cmd_str) + end + + def build_simulator_fields + return nil if $cfg['simulator'].nil? + if $cfg['simulator']['path'].nil? + command = '' + else + command = (tackit($cfg['simulator']['path']) + ' ') + end + if $cfg['simulator']['pre_support'].nil? + pre_support = '' + else + pre_support = squash('', $cfg['simulator']['pre_support']) + end + if $cfg['simulator']['post_support'].nil? + post_support = '' + else + post_support = squash('', $cfg['simulator']['post_support']) + end + return {:command => command, :pre_support => pre_support, :post_support => post_support} + end + + def execute(command_string, verbose=true) + report command_string + output = `#{command_string}`.chomp + report(output) if (verbose && !output.nil? && (output.length > 0)) + if $?.exitstatus != 0 + raise "Command failed. (Returned #{$?.exitstatus})" + end + return output + end + + def report_summary + summary = UnityTestSummary.new + summary.set_root_path(HERE) + results_glob = "#{$cfg['compiler']['build_path']}*.test*" + results_glob.gsub!(/\\/, '/') + results = Dir[results_glob] + summary.set_targets(results) + summary.run + end + + def run_tests(test_files) + report 'Running Unity system tests...' + + # Tack on TEST define for compiling unit tests + load_configuration($cfg_file) + test_defines = ['TEST'] + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + $cfg['compiler']['defines']['items'] << 'TEST' + + include_dirs = get_local_include_dirs + + # Build and execute each unit test + test_files.each do |test| + obj_list = [] + + # Detect dependencies and build required modules + extract_headers(test).each do |header| + # Compile corresponding source file if it exists + src_file = find_source_file(header, include_dirs) + if !src_file.nil? + compile(src_file, test_defines) + obj_list << header.ext($cfg['compiler']['object_files']['extension']) + end + end + + # Build the test runner (generate if configured to do so) + test_base = File.basename(test, C_EXTENSION) + + runner_name = test_base + '_Runner.c' + runner_path = '' + + if $cfg['compiler']['runner_path'].nil? + runner_path = $cfg['compiler']['build_path'] + runner_name + else + runner_path = $cfg['compiler']['runner_path'] + runner_name + end + + options = $cfg[:unity] + options[:use_param_tests] = (test =~ /parameterized/) ? true : false + UnityTestRunnerGenerator.new(options).run(test, runner_path) + + compile(runner_path, test_defines) + obj_list << runner_name.ext($cfg['compiler']['object_files']['extension']) + + # Build the test module + compile(test, test_defines) + obj_list << test_base.ext($cfg['compiler']['object_files']['extension']) + + # Link the test executable + link(test_base, obj_list) + + # Execute unit test and generate results file + simulator = build_simulator_fields + executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] + if simulator.nil? + cmd_str = executable + else + cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" + end + output = execute(cmd_str) + test_results = $cfg['compiler']['build_path'] + test_base + if output.match(/OK$/m).nil? + test_results += '.testfail' + else + test_results += '.testpass' + end + File.open(test_results, 'w') { |f| f.print output } + + end + end +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/release/build.info b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/release/build.info new file mode 100644 index 0000000..7871b21 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/release/build.info @@ -0,0 +1,2 @@ +118 + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/release/version.info b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/release/version.info new file mode 100644 index 0000000..0d71c08 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/release/version.info @@ -0,0 +1,2 @@ +2.0 + diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/src/unity.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/src/unity.c new file mode 100644 index 0000000..fa712c7 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/src/unity.c @@ -0,0 +1,855 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity.h" +#include +#include + +#define UNITY_FAIL_AND_BAIL { Unity.CurrentTestFailed = 1; UNITY_OUTPUT_CHAR('\n'); longjmp(Unity.AbortFrame, 1); } +#define UNITY_IGNORE_AND_BAIL { Unity.CurrentTestIgnored = 1; UNITY_OUTPUT_CHAR('\n'); longjmp(Unity.AbortFrame, 1); } +/// return prematurely if we are already in failure or ignore state +#define UNITY_SKIP_EXECUTION { if ((Unity.CurrentTestFailed != 0) || (Unity.CurrentTestIgnored != 0)) {return;} } +#define UNITY_PRINT_EOL { UNITY_OUTPUT_CHAR('\n'); } + +struct _Unity Unity = { 0 }; + +const char* UnityStrNull = "NULL"; +const char* UnityStrSpacer = ". "; +const char* UnityStrExpected = " Expected "; +const char* UnityStrWas = " Was "; +const char* UnityStrTo = " To "; +const char* UnityStrElement = " Element "; +const char* UnityStrMemory = " Memory Mismatch"; +const char* UnityStrDelta = " Values Not Within Delta "; +const char* UnityStrPointless= " You Asked Me To Compare Nothing, Which Was Pointless."; +const char* UnityStrNullPointerForExpected= " Expected pointer to be NULL"; +const char* UnityStrNullPointerForActual = " Actual pointer was NULL"; + +const _U_UINT UnitySizeMask[] = +{ + 255, + 65535, + 65535, + 4294967295u, + 4294967295u, + 4294967295u, + 4294967295u +#ifdef UNITY_SUPPORT_64 + ,0xFFFFFFFFFFFFFFFF +#endif +}; + +//----------------------------------------------- +// Pretty Printers & Test Result Output Handlers +//----------------------------------------------- + +void UnityPrint(const char* string) +{ + const char* pch = string; + + if (pch != NULL) + { + while (*pch) + { + // printable characters plus CR & LF are printed + if ((*pch <= 126) && (*pch >= 32)) + { + UNITY_OUTPUT_CHAR(*pch); + } + //write escaped carriage returns + else if (*pch == 13) + { + UNITY_OUTPUT_CHAR('\\'); + UNITY_OUTPUT_CHAR('r'); + } + //write escaped line feeds + else if (*pch == 10) + { + UNITY_OUTPUT_CHAR('\\'); + UNITY_OUTPUT_CHAR('n'); + } + // unprintable characters are shown as codes + else + { + UNITY_OUTPUT_CHAR('\\'); + UnityPrintNumberHex((_U_SINT)*pch, 2); + } + pch++; + } + } +} + +//----------------------------------------------- +void UnityPrintNumberByStyle(const _U_SINT number, const UNITY_DISPLAY_STYLE_T style) +{ + if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT) + { + UnityPrintNumber(number); + } + else if ((style & UNITY_DISPLAY_RANGE_UINT) == UNITY_DISPLAY_RANGE_UINT) + { + UnityPrintNumberUnsigned( (_U_UINT)number & UnitySizeMask[((_U_UINT)style & (_U_UINT)0x0F) - 1] ); + } + else + { + UnityPrintNumberHex((_U_UINT)number, (style & 0x000F) << 1); + } +} + +//----------------------------------------------- +/// basically do an itoa using as little ram as possible +void UnityPrintNumber(const _U_SINT number_to_print) +{ + _U_SINT divisor = 1; + _U_SINT next_divisor; + _U_SINT number = number_to_print; + + if (number < 0) + { + UNITY_OUTPUT_CHAR('-'); + number = -number; + } + + // figure out initial divisor + while (number / divisor > 9) + { + next_divisor = divisor * 10; + if (next_divisor > divisor) + divisor = next_divisor; + else + break; + } + + // now mod and print, then divide divisor + do + { + UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10))); + divisor /= 10; + } + while (divisor > 0); +} + +//----------------------------------------------- +/// basically do an itoa using as little ram as possible +void UnityPrintNumberUnsigned(const _U_UINT number) +{ + _U_UINT divisor = 1; + _U_UINT next_divisor; + + // figure out initial divisor + while (number / divisor > 9) + { + next_divisor = divisor * 10; + if (next_divisor > divisor) + divisor = next_divisor; + else + break; + } + + // now mod and print, then divide divisor + do + { + UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10))); + divisor /= 10; + } + while (divisor > 0); +} + +//----------------------------------------------- +void UnityPrintNumberHex(const _U_UINT number, const char nibbles_to_print) +{ + _U_UINT nibble; + char nibbles = nibbles_to_print; + UNITY_OUTPUT_CHAR('0'); + UNITY_OUTPUT_CHAR('x'); + + while (nibbles > 0) + { + nibble = (number >> (--nibbles << 2)) & 0x0000000F; + if (nibble <= 9) + { + UNITY_OUTPUT_CHAR((char)('0' + nibble)); + } + else + { + UNITY_OUTPUT_CHAR((char)('A' - 10 + nibble)); + } + } +} + +//----------------------------------------------- +void UnityPrintMask(const _U_UINT mask, const _U_UINT number) +{ + _U_UINT current_bit = (_U_UINT)1 << (UNITY_INT_WIDTH - 1); + _US32 i; + + for (i = 0; i < UNITY_INT_WIDTH; i++) + { + if (current_bit & mask) + { + if (current_bit & number) + { + UNITY_OUTPUT_CHAR('1'); + } + else + { + UNITY_OUTPUT_CHAR('0'); + } + } + else + { + UNITY_OUTPUT_CHAR('X'); + } + current_bit = current_bit >> 1; + } +} + +//----------------------------------------------- +#ifdef UNITY_FLOAT_VERBOSE +void UnityPrintFloat(_UF number) +{ + char TempBuffer[32]; + sprintf(TempBuffer, "%.6f", number); + UnityPrint(TempBuffer); +} +#endif + +//----------------------------------------------- +void UnityTestResultsBegin(const char* file, const UNITY_LINE_TYPE line) +{ + UnityPrint(file); + UNITY_OUTPUT_CHAR(':'); + UnityPrintNumber(line); + UNITY_OUTPUT_CHAR(':'); + UnityPrint(Unity.CurrentTestName); + UNITY_OUTPUT_CHAR(':'); +} + +//----------------------------------------------- +void UnityTestResultsFailBegin(const UNITY_LINE_TYPE line) +{ + UnityTestResultsBegin(Unity.TestFile, line); + UnityPrint("FAIL:"); +} + +//----------------------------------------------- +void UnityConcludeTest(void) +{ + if (Unity.CurrentTestIgnored) + { + Unity.TestIgnores++; + } + else if (!Unity.CurrentTestFailed) + { + UnityTestResultsBegin(Unity.TestFile, Unity.CurrentTestLineNumber); + UnityPrint("PASS"); + UNITY_PRINT_EOL; + } + else + { + Unity.TestFailures++; + } + + Unity.CurrentTestFailed = 0; + Unity.CurrentTestIgnored = 0; +} + +//----------------------------------------------- +void UnityAddMsgIfSpecified(const char* msg) +{ + if (msg) + { + UnityPrint(UnityStrSpacer); + UnityPrint(msg); + } +} + +//----------------------------------------------- +void UnityPrintExpectedAndActualStrings(const char* expected, const char* actual) +{ + UnityPrint(UnityStrExpected); + if (expected != NULL) + { + UNITY_OUTPUT_CHAR('\''); + UnityPrint(expected); + UNITY_OUTPUT_CHAR('\''); + } + else + { + UnityPrint(UnityStrNull); + } + UnityPrint(UnityStrWas); + if (actual != NULL) + { + UNITY_OUTPUT_CHAR('\''); + UnityPrint(actual); + UNITY_OUTPUT_CHAR('\''); + } + else + { + UnityPrint(UnityStrNull); + } +} + +//----------------------------------------------- +// Assertion & Control Helpers +//----------------------------------------------- + +int UnityCheckArraysForNull(const void* expected, const void* actual, const UNITY_LINE_TYPE lineNumber, const char* msg) +{ + //return true if they are both NULL + if ((expected == NULL) && (actual == NULL)) + return 1; + + //throw error if just expected is NULL + if (expected == NULL) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrNullPointerForExpected); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + //throw error if just actual is NULL + if (actual == NULL) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrNullPointerForActual); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + //return false if neither is NULL + return 0; +} + +//----------------------------------------------- +// Assertion Functions +//----------------------------------------------- + +void UnityAssertBits(const _U_SINT mask, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + UNITY_SKIP_EXECUTION; + + if ((mask & expected) != (mask & actual)) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrExpected); + UnityPrintMask(mask, expected); + UnityPrint(UnityStrWas); + UnityPrintMask(mask, actual); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualNumber(const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style) +{ + UNITY_SKIP_EXECUTION; + + if (expected != actual) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(expected, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(actual, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualIntArray(const _U_SINT* expected, + const _U_SINT* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style) +{ + _UU32 elements = num_elements; + const _US8* ptr_exp = (_US8*)expected; + const _US8* ptr_act = (_US8*)actual; + + UNITY_SKIP_EXECUTION; + + if (elements == 0) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + switch(style) + { + case UNITY_DISPLAY_STYLE_HEX8: + case UNITY_DISPLAY_STYLE_INT8: + case UNITY_DISPLAY_STYLE_UINT8: + while (elements--) + { + if (*ptr_exp != *ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 1; + ptr_act += 1; + } + break; + case UNITY_DISPLAY_STYLE_HEX16: + case UNITY_DISPLAY_STYLE_INT16: + case UNITY_DISPLAY_STYLE_UINT16: + while (elements--) + { + if (*(_US16*)ptr_exp != *(_US16*)ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*(_US16*)ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*(_US16*)ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 2; + ptr_act += 2; + } + break; +#ifdef UNITY_SUPPORT_64 + case UNITY_DISPLAY_STYLE_HEX64: + case UNITY_DISPLAY_STYLE_INT64: + case UNITY_DISPLAY_STYLE_UINT64: + while (elements--) + { + if (*(_US64*)ptr_exp != *(_US64*)ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*(_US64*)ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*(_US64*)ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 8; + ptr_act += 8; + } + break; +#endif + default: + while (elements--) + { + if (*(_US32*)ptr_exp != *(_US32*)ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*(_US32*)ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*(_US32*)ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 4; + ptr_act += 4; + } + break; + } +} + +//----------------------------------------------- +#ifndef UNITY_EXCLUDE_FLOAT +void UnityAssertEqualFloatArray(const _UF* expected, + const _UF* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UU32 elements = num_elements; + const _UF* ptr_expected = expected; + const _UF* ptr_actual = actual; + _UF diff, tol; + + UNITY_SKIP_EXECUTION; + + if (elements == 0) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + while (elements--) + { + diff = *ptr_expected - *ptr_actual; + if (diff < 0.0) + diff = 0.0 - diff; + tol = UNITY_FLOAT_PRECISION * *ptr_expected; + if (tol < 0.0) + tol = 0.0 - tol; + if (diff > tol) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); +#ifdef UNITY_FLOAT_VERBOSE + UnityPrint(UnityStrExpected); + UnityPrintFloat(*ptr_expected); + UnityPrint(UnityStrWas); + UnityPrintFloat(*ptr_actual); +#else + UnityPrint(UnityStrDelta); +#endif + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_expected++; + ptr_actual++; + } +} + +//----------------------------------------------- +void UnityAssertFloatsWithin(const _UF delta, + const _UF expected, + const _UF actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UF diff = actual - expected; + _UF pos_delta = delta; + + UNITY_SKIP_EXECUTION; + + if (diff < 0) + { + diff = 0.0f - diff; + } + if (pos_delta < 0) + { + pos_delta = 0.0f - pos_delta; + } + + if (pos_delta < diff) + { + UnityTestResultsFailBegin(lineNumber); +#ifdef UNITY_FLOAT_VERBOSE + UnityPrint(UnityStrExpected); + UnityPrintFloat(expected); + UnityPrint(UnityStrWas); + UnityPrintFloat(actual); +#else + UnityPrint(UnityStrDelta); +#endif + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} +#endif + +//----------------------------------------------- +void UnityAssertNumbersWithin( const _U_SINT delta, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style) +{ + UNITY_SKIP_EXECUTION; + + if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT) + { + if (actual > expected) + Unity.CurrentTestFailed = ((actual - expected) > delta); + else + Unity.CurrentTestFailed = ((expected - actual) > delta); + } + else + { + if ((_U_UINT)actual > (_U_UINT)expected) + Unity.CurrentTestFailed = ((_U_UINT)(actual - expected) > (_U_UINT)delta); + else + Unity.CurrentTestFailed = ((_U_UINT)(expected - actual) > (_U_UINT)delta); + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrDelta); + UnityPrintNumberByStyle(delta, style); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(expected, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(actual, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualString(const char* expected, + const char* actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UU32 i; + + UNITY_SKIP_EXECUTION; + + // if both pointers not null compare the strings + if (expected && actual) + { + for (i = 0; expected[i] || actual[i]; i++) + { + if (expected[i] != actual[i]) + { + Unity.CurrentTestFailed = 1; + break; + } + } + } + else + { // handle case of one pointers being null (if both null, test should pass) + if (expected != actual) + { + Unity.CurrentTestFailed = 1; + } + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrintExpectedAndActualStrings(expected, actual); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualStringArray( const char** expected, + const char** actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UU32 i, j = 0; + + UNITY_SKIP_EXECUTION; + + // if no elements, it's an error + if (num_elements == 0) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + do + { + // if both pointers not null compare the strings + if (expected[j] && actual[j]) + { + for (i = 0; expected[j][i] || actual[j][i]; i++) + { + if (expected[j][i] != actual[j][i]) + { + Unity.CurrentTestFailed = 1; + break; + } + } + } + else + { // handle case of one pointers being null (if both null, test should pass) + if (expected[j] != actual[j]) + { + Unity.CurrentTestFailed = 1; + } + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + if (num_elements > 1) + { + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - j - 1), UNITY_DISPLAY_STYLE_UINT); + } + UnityPrintExpectedAndActualStrings((const char*)(expected[j]), (const char*)(actual[j])); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + } while (++j < num_elements); +} + +//----------------------------------------------- +void UnityAssertEqualMemory( const void* expected, + const void* actual, + _UU32 length, + _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + unsigned char* expected_ptr = (unsigned char*)expected; + unsigned char* actual_ptr = (unsigned char*)actual; + _UU32 elements = num_elements; + + UNITY_SKIP_EXECUTION; + + if ((elements == 0) || (length == 0)) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + while (elements--) + { + if (memcmp((const void*)expected_ptr, (const void*)actual_ptr, length) != 0) + { + Unity.CurrentTestFailed = 1; + break; + } + expected_ptr += length; + actual_ptr += length; + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + if (num_elements > 1) + { + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + } + UnityPrint(UnityStrMemory); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +// Control Functions +//----------------------------------------------- + +void UnityFail(const char* msg, const UNITY_LINE_TYPE line) +{ + UNITY_SKIP_EXECUTION; + + UnityTestResultsBegin(Unity.TestFile, line); + UnityPrint("FAIL"); + if (msg != NULL) + { + UNITY_OUTPUT_CHAR(':'); + if (msg[0] != ' ') + { + UNITY_OUTPUT_CHAR(' '); + } + UnityPrint(msg); + } + UNITY_FAIL_AND_BAIL; +} + +//----------------------------------------------- +void UnityIgnore(const char* msg, const UNITY_LINE_TYPE line) +{ + UNITY_SKIP_EXECUTION; + + UnityTestResultsBegin(Unity.TestFile, line); + UnityPrint("IGNORE"); + if (msg != NULL) + { + UNITY_OUTPUT_CHAR(':'); + UNITY_OUTPUT_CHAR(' '); + UnityPrint(msg); + } + UNITY_IGNORE_AND_BAIL; +} + +//----------------------------------------------- +void setUp(void); +void tearDown(void); +void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum) +{ + Unity.CurrentTestName = FuncName; + Unity.CurrentTestLineNumber = FuncLineNum; + Unity.NumberOfTests++; + if (TEST_PROTECT()) + { + setUp(); + Func(); + } + if (TEST_PROTECT() && !(Unity.CurrentTestIgnored)) + { + tearDown(); + } + UnityConcludeTest(); +} + +//----------------------------------------------- +void UnityBegin(void) +{ + Unity.NumberOfTests = 0; +} + +//----------------------------------------------- +int UnityEnd(void) +{ + UnityPrint("-----------------------"); + UNITY_PRINT_EOL; + UnityPrintNumber(Unity.NumberOfTests); + UnityPrint(" Tests "); + UnityPrintNumber(Unity.TestFailures); + UnityPrint(" Failures "); + UnityPrintNumber(Unity.TestIgnores); + UnityPrint(" Ignored"); + UNITY_PRINT_EOL; + if (Unity.TestFailures == 0U) + { + UnityPrint("OK"); + } + else + { + UnityPrint("FAIL"); + } + UNITY_PRINT_EOL; + return Unity.TestFailures; +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/src/unity.h b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/src/unity.h new file mode 100644 index 0000000..0b1b187 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/src/unity.h @@ -0,0 +1,213 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FRAMEWORK_H +#define UNITY_FRAMEWORK_H + +#define UNITY + +#include "unity_internals.h" + +//------------------------------------------------------- +// Configuration Options +//------------------------------------------------------- + +// Integers +// - Unity assumes 32 bit integers by default +// - If your compiler treats ints of a different size, define UNITY_INT_WIDTH + +// Floats +// - define UNITY_EXCLUDE_FLOAT to disallow floating point comparisons +// - define UNITY_FLOAT_PRECISION to specify the precision to use when doing TEST_ASSERT_EQUAL_FLOAT +// - define UNITY_FLOAT_TYPE to specify doubles instead of single precision floats +// - define UNITY_FLOAT_VERBOSE to print floating point values in errors (uses sprintf) + +// Output +// - by default, Unity prints to standard out with putchar. define UNITY_OUTPUT_CHAR(a) with a different function if desired + +// Optimization +// - by default, line numbers are stored in unsigned shorts. Define UNITY_LINE_TYPE with a different type if your files are huge +// - by default, test and failure counters are unsigned shorts. Define UNITY_COUNTER_TYPE with a different type if you want to save space or have more than 65535 Tests. + +// Test Cases +// - define UNITY_SUPPORT_TEST_CASES to include the TEST_CASE macro, though really it's mostly about the runner generator script + +// Parameterized Tests +// - you'll want to create a define of TEST_CASE(...) which basically evaluates to nothing + +//------------------------------------------------------- +// Test Running Macros +//------------------------------------------------------- + +#define TEST_PROTECT() (setjmp(Unity.AbortFrame) == 0) + +#define TEST_ABORT() {longjmp(Unity.AbortFrame, 1);} + +#ifndef RUN_TEST +#define RUN_TEST(func, line_num) UnityDefaultTestRun(func, #func, line_num) +#endif + +#define TEST_LINE_NUM (Unity.CurrentTestLineNumber) +#define TEST_IS_IGNORED (Unity.CurrentTestIgnored) + +//------------------------------------------------------- +// Basic Fail and Ignore +//------------------------------------------------------- + +#define TEST_FAIL_MESSAGE(message) UNITY_TEST_FAIL(__LINE__, message) +#define TEST_FAIL() UNITY_TEST_FAIL(__LINE__, NULL) +#define TEST_IGNORE_MESSAGE(message) UNITY_TEST_IGNORE(__LINE__, message) +#define TEST_IGNORE() UNITY_TEST_IGNORE(__LINE__, NULL) +#define TEST_ONLY() + +//------------------------------------------------------- +// Test Asserts (simple) +//------------------------------------------------------- + +//Boolean +#define TEST_ASSERT(condition) UNITY_TEST_ASSERT( (condition), __LINE__, " Expression Evaluated To FALSE") +#define TEST_ASSERT_TRUE(condition) UNITY_TEST_ASSERT( (condition), __LINE__, " Expected TRUE Was FALSE") +#define TEST_ASSERT_UNLESS(condition) UNITY_TEST_ASSERT( !(condition), __LINE__, " Expression Evaluated To TRUE") +#define TEST_ASSERT_FALSE(condition) UNITY_TEST_ASSERT( !(condition), __LINE__, " Expected FALSE Was TRUE") +#define TEST_ASSERT_NULL(pointer) UNITY_TEST_ASSERT_NULL( (pointer), __LINE__, " Expected NULL") +#define TEST_ASSERT_NOT_NULL(pointer) UNITY_TEST_ASSERT_NOT_NULL((pointer), __LINE__, " Expected Non-NULL") + +//Integers (of all sizes) +#define TEST_ASSERT_EQUAL_INT(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT8(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT8((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT16(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT16((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT32(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT32((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT64(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT64((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_NOT_EQUAL(expected, actual) UNITY_TEST_ASSERT(((expected) != (actual)), __LINE__, " Expected Not-Equal") +#define TEST_ASSERT_EQUAL_UINT(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT8(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT8( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT16(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT16( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT32(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT32( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT64(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT64( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX8(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX8( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX16(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX16((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX32(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX64(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX64((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_BITS(mask, expected, actual) UNITY_TEST_ASSERT_BITS((mask), (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_BITS_HIGH(mask, actual) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(-1), (actual), __LINE__, NULL) +#define TEST_ASSERT_BITS_LOW(mask, actual) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(0), (actual), __LINE__, NULL) +#define TEST_ASSERT_BIT_HIGH(bit, actual) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(-1), (actual), __LINE__, NULL) +#define TEST_ASSERT_BIT_LOW(bit, actual) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(0), (actual), __LINE__, NULL) + +//Integer Ranges (of all sizes) +#define TEST_ASSERT_INT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_UINT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX8_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX16_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX32_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX64_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, __LINE__, NULL) + +//Structs and Strings +#define TEST_ASSERT_EQUAL_PTR(expected, actual) UNITY_TEST_ASSERT_EQUAL_PTR((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_STRING(expected, actual) UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_MEMORY(expected, actual, len) UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, __LINE__, NULL) + +//Arrays +#define TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements) UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, __LINE__, NULL) + +//Floating Point (If Enabled) +#define TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_FLOAT(expected, actual) UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, __LINE__, NULL) + +//------------------------------------------------------- +// Test Asserts (with additional messages) +//------------------------------------------------------- + +//Boolean +#define TEST_ASSERT_MESSAGE(condition, message) UNITY_TEST_ASSERT( (condition), __LINE__, message) +#define TEST_ASSERT_TRUE_MESSAGE(condition, message) UNITY_TEST_ASSERT( (condition), __LINE__, message) +#define TEST_ASSERT_UNLESS_MESSAGE(condition, message) UNITY_TEST_ASSERT( !(condition), __LINE__, message) +#define TEST_ASSERT_FALSE_MESSAGE(condition, message) UNITY_TEST_ASSERT( !(condition), __LINE__, message) +#define TEST_ASSERT_NULL_MESSAGE(pointer, message) UNITY_TEST_ASSERT_NULL( (pointer), __LINE__, message) +#define TEST_ASSERT_NOT_NULL_MESSAGE(pointer, message) UNITY_TEST_ASSERT_NOT_NULL((pointer), __LINE__, message) + +//Integers (of all sizes) +#define TEST_ASSERT_EQUAL_INT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT8((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT16((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT32((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT64((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, message) +#define TEST_ASSERT_NOT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT(((expected) != (actual)), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT8( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT16( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT32( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT64( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX8( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX16((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX64((expected), (actual), __LINE__, message) +#define TEST_ASSERT_BITS_MESSAGE(mask, expected, actual, message) UNITY_TEST_ASSERT_BITS((mask), (expected), (actual), __LINE__, message) +#define TEST_ASSERT_BITS_HIGH_MESSAGE(mask, actual, message) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(-1), (actual), __LINE__, message) +#define TEST_ASSERT_BITS_LOW_MESSAGE(mask, actual, message) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(0), (actual), __LINE__, message) +#define TEST_ASSERT_BIT_HIGH_MESSAGE(bit, actual, message) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(-1), (actual), __LINE__, message) +#define TEST_ASSERT_BIT_LOW_MESSAGE(bit, actual, message) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(0), (actual), __LINE__, message) + +//Integer Ranges (of all sizes) +#define TEST_ASSERT_INT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_UINT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX8_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX16_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX32_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX64_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, __LINE__, message) + +//Structs and Strings +#define TEST_ASSERT_EQUAL_PTR_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_PTR(expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_STRING_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_MEMORY_MESSAGE(expected, actual, len, message) UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, __LINE__, message) + +//Arrays +#define TEST_ASSERT_EQUAL_INT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_STRING_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_MEMORY_ARRAY_MESSAGE(expected, actual, len, num_elements, message) UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, __LINE__, message) + +//Floating Point (If Enabled) +#define TEST_ASSERT_FLOAT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_FLOAT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_FLOAT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, __LINE__, message) +#endif diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/src/unity_internals.h b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/src/unity_internals.h new file mode 100644 index 0000000..29c9d1d --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/src/unity_internals.h @@ -0,0 +1,355 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_INTERNALS_H +#define UNITY_INTERNALS_H + +#include +#include + +//------------------------------------------------------- +// Int Support +//------------------------------------------------------- + +#ifndef UNITY_INT_WIDTH +#define UNITY_INT_WIDTH (32) +#endif + +#ifndef UNITY_LONG_WIDTH +#define UNITY_LONG_WIDTH (32) +#endif + +#if (UNITY_INT_WIDTH == 32) + typedef unsigned char _UU8; + typedef unsigned short _UU16; + typedef unsigned int _UU32; + typedef signed char _US8; + typedef signed short _US16; + typedef signed int _US32; +#elif (UNITY_INT_WIDTH == 16) + typedef unsigned char _UU8; + typedef unsigned int _UU16; + typedef unsigned long _UU32; + typedef signed char _US8; + typedef signed int _US16; + typedef signed long _US32; +#else + #error Invalid UNITY_INT_WIDTH specified! (16 or 32 are supported) +#endif + +//------------------------------------------------------- +// 64-bit Support +//------------------------------------------------------- + +#ifndef UNITY_SUPPORT_64 + +//No 64-bit Support +typedef _UU32 _U_UINT; +typedef _US32 _U_SINT; + +#else + +//64-bit Support +#if (UNITY_LONG_WIDTH == 32) + typedef unsigned long long _UU64; + typedef signed long long _US64; +#elif (UNITY_LONG_WIDTH == 64) + typedef unsigned long _UU64; + typedef signed long _US64; +#else + #error Invalid UNITY_LONG_WIDTH specified! (32 or 64 are supported) +#endif +typedef _UU64 _U_UINT; +typedef _US64 _U_SINT; + +#endif + +//------------------------------------------------------- +// Pointer Support +//------------------------------------------------------- + +#ifndef UNITY_POINTER_WIDTH +#define UNITY_POINTER_WIDTH (32) +#endif + +#if (UNITY_POINTER_WIDTH == 32) + typedef _UU32 _UP; +#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX32 +#elif (UNITY_POINTER_WIDTH == 64) + typedef _UU64 _UP; +#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX64 +#elif (UNITY_POINTER_WIDTH == 16) + typedef _UU16 _UP; +#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX16 +#else + #error Invalid UNITY_POINTER_WIDTH specified! (16, 32 or 64 are supported) +#endif + +//------------------------------------------------------- +// Float Support +//------------------------------------------------------- + +#ifdef UNITY_EXCLUDE_FLOAT + +//No Floating Point Support +#undef UNITY_FLOAT_PRECISION +#undef UNITY_FLOAT_TYPE +#undef UNITY_FLOAT_VERBOSE + +#else + +//Floating Point Support +#ifndef UNITY_FLOAT_PRECISION +#define UNITY_FLOAT_PRECISION (0.00001f) +#endif +#ifndef UNITY_FLOAT_TYPE +#define UNITY_FLOAT_TYPE float +#endif +typedef UNITY_FLOAT_TYPE _UF; + +#endif + +//------------------------------------------------------- +// Output Method +//------------------------------------------------------- + +#ifndef UNITY_OUTPUT_CHAR +//Default to using putchar, which is defined in stdio.h above +#define UNITY_OUTPUT_CHAR(a) putchar(a) +#else +//If defined as something else, make sure we declare it here so it's ready for use +extern int UNITY_OUTPUT_CHAR(int); +#endif + +//------------------------------------------------------- +// Footprint +//------------------------------------------------------- + +#ifndef UNITY_LINE_TYPE +#define UNITY_LINE_TYPE unsigned short +#endif + +#ifndef UNITY_COUNTER_TYPE +#define UNITY_COUNTER_TYPE unsigned short +#endif + +//------------------------------------------------------- +// Internal Structs Needed +//------------------------------------------------------- + +typedef void (*UnityTestFunction)(void); + +#define UNITY_DISPLAY_RANGE_INT (0x10) +#define UNITY_DISPLAY_RANGE_UINT (0x20) +#define UNITY_DISPLAY_RANGE_HEX (0x40) +#define UNITY_DISPLAY_RANGE_AUTO (0x80) + +typedef enum +{ + UNITY_DISPLAY_STYLE_INT = 4 + UNITY_DISPLAY_RANGE_INT + UNITY_DISPLAY_RANGE_AUTO, + UNITY_DISPLAY_STYLE_INT8 = 1 + UNITY_DISPLAY_RANGE_INT, + UNITY_DISPLAY_STYLE_INT16 = 2 + UNITY_DISPLAY_RANGE_INT, + UNITY_DISPLAY_STYLE_INT32 = 4 + UNITY_DISPLAY_RANGE_INT, +#ifdef UNITY_SUPPORT_64 + UNITY_DISPLAY_STYLE_INT64 = 8 + UNITY_DISPLAY_RANGE_INT, +#endif + UNITY_DISPLAY_STYLE_UINT = 4 + UNITY_DISPLAY_RANGE_UINT + UNITY_DISPLAY_RANGE_AUTO, + UNITY_DISPLAY_STYLE_UINT8 = 1 + UNITY_DISPLAY_RANGE_UINT, + UNITY_DISPLAY_STYLE_UINT16 = 2 + UNITY_DISPLAY_RANGE_UINT, + UNITY_DISPLAY_STYLE_UINT32 = 4 + UNITY_DISPLAY_RANGE_UINT, +#ifdef UNITY_SUPPORT_64 + UNITY_DISPLAY_STYLE_UINT64 = 8 + UNITY_DISPLAY_RANGE_UINT, +#endif + UNITY_DISPLAY_STYLE_HEX8 = 1 + UNITY_DISPLAY_RANGE_HEX, + UNITY_DISPLAY_STYLE_HEX16 = 2 + UNITY_DISPLAY_RANGE_HEX, + UNITY_DISPLAY_STYLE_HEX32 = 4 + UNITY_DISPLAY_RANGE_HEX, +#ifdef UNITY_SUPPORT_64 + UNITY_DISPLAY_STYLE_HEX64 = 8 + UNITY_DISPLAY_RANGE_HEX, +#endif +} UNITY_DISPLAY_STYLE_T; + +struct _Unity +{ + const char* TestFile; + const char* CurrentTestName; + _UU32 CurrentTestLineNumber; + UNITY_COUNTER_TYPE NumberOfTests; + UNITY_COUNTER_TYPE TestFailures; + UNITY_COUNTER_TYPE TestIgnores; + UNITY_COUNTER_TYPE CurrentTestFailed; + UNITY_COUNTER_TYPE CurrentTestIgnored; + jmp_buf AbortFrame; +}; + +extern struct _Unity Unity; + +//------------------------------------------------------- +// Test Suite Management +//------------------------------------------------------- + +void UnityBegin(void); +int UnityEnd(void); +void UnityConcludeTest(void); +void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum); + +//------------------------------------------------------- +// Test Output +//------------------------------------------------------- + +void UnityPrint(const char* string); +void UnityPrintMask(const _U_UINT mask, const _U_UINT number); +void UnityPrintNumberByStyle(const _U_SINT number, const UNITY_DISPLAY_STYLE_T style); +void UnityPrintNumber(const _U_SINT number); +void UnityPrintNumberUnsigned(const _U_UINT number); +void UnityPrintNumberHex(const _U_UINT number, const char nibbles); + +#ifdef UNITY_FLOAT_VERBOSE +void UnityPrintFloat(const _UF number); +#endif + +//------------------------------------------------------- +// Test Assertion Fuctions +//------------------------------------------------------- +// Use the macros below this section instead of calling +// these directly. The macros have a consistent naming +// convention and will pull in file and line information +// for you. + +void UnityAssertEqualNumber(const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style); + +void UnityAssertEqualIntArray(const _U_SINT* expected, + const _U_SINT* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style); + +void UnityAssertBits(const _U_SINT mask, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualString(const char* expected, + const char* actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualStringArray( const char** expected, + const char** actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualMemory( const void* expected, + const void* actual, + const _UU32 length, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertNumbersWithin(const _U_SINT delta, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style); + +void UnityFail(const char* message, const UNITY_LINE_TYPE line); + +void UnityIgnore(const char* message, const UNITY_LINE_TYPE line); + +#ifndef UNITY_EXCLUDE_FLOAT +void UnityAssertFloatsWithin(const _UF delta, + const _UF expected, + const _UF actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualFloatArray(const _UF* expected, + const _UF* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber); +#endif + +//------------------------------------------------------- +// Basic Fail and Ignore +//------------------------------------------------------- + +#define UNITY_TEST_FAIL(line, message) UnityFail( (message), (UNITY_LINE_TYPE)line); +#define UNITY_TEST_IGNORE(line, message) UnityIgnore( (message), (UNITY_LINE_TYPE)line); + +//------------------------------------------------------- +// Test Asserts +//------------------------------------------------------- + +#define UNITY_TEST_ASSERT(condition, line, message) if (condition) {} else {UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, message);} +#define UNITY_TEST_ASSERT_NULL(pointer, line, message) UNITY_TEST_ASSERT(((pointer) == NULL), (UNITY_LINE_TYPE)line, message) +#define UNITY_TEST_ASSERT_NOT_NULL(pointer, line, message) UNITY_TEST_ASSERT(((pointer) != NULL), (UNITY_LINE_TYPE)line, message) + +#define UNITY_TEST_ASSERT_EQUAL_INT(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_UINT(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_HEX8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX8) +#define UNITY_TEST_ASSERT_EQUAL_HEX16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX16) +#define UNITY_TEST_ASSERT_EQUAL_HEX32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX32) +#define UNITY_TEST_ASSERT_BITS(mask, expected, actual, line, message) UnityAssertBits((_U_SINT)(mask), (_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line) + +#define UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX8) +#define UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX16) +#define UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX32) +#define UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64) + +#define UNITY_TEST_ASSERT_EQUAL_PTR(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(_UP)(expected), (_U_SINT)(_UP)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_POINTER) +#define UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, line, message) UnityAssertEqualString((const char*)(expected), (const char*)(actual), (message), (UNITY_LINE_TYPE)line) +#define UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, line, message) UnityAssertEqualMemory((void*)(expected), (void*)(actual), (_UU32)(len), 1, (message), (UNITY_LINE_TYPE)line) + +#define UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT8) +#define UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT16) +#define UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT32) +#define UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT8) +#define UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT16) +#define UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT32) +#define UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX8) +#define UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX16) +#define UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX32) +#define UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualStringArray((const char**)(expected), (const char**)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line) +#define UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, line, message) UnityAssertEqualMemory((void*)(expected), (void*)(actual), (_UU32)(len), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line) + +#ifdef UNITY_SUPPORT_64 +#define UNITY_TEST_ASSERT_EQUAL_INT64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT64) +#define UNITY_TEST_ASSERT_EQUAL_UINT64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT64) +#define UNITY_TEST_ASSERT_EQUAL_HEX64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64) +#define UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT64) +#define UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT64) +#define UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64) +#endif + +#ifdef UNITY_EXCLUDE_FLOAT +#define UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled") +#define UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled") +#define UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled") +#else +#define UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, line, message) UnityAssertFloatsWithin((_UF)(delta), (_UF)(expected), (_UF)(actual), (message), (UNITY_LINE_TYPE)line) +#define UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, line, message) UNITY_TEST_ASSERT_FLOAT_WITHIN((_UF)(expected) * (_UF)UNITY_FLOAT_PRECISION, (_UF)expected, (_UF)actual, (UNITY_LINE_TYPE)line, message) +#define UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualFloatArray((_UF*)(expected), (_UF*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line) +#endif + +#endif diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/targets/gcc.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/targets/gcc.yml new file mode 100644 index 0000000..0f18c6c --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/targets/gcc.yml @@ -0,0 +1,42 @@ +compiler: + path: gcc + source_path: 'src/' + unit_tests_path: &unit_tests_path 'test/' + build_path: &build_path 'build/' + options: + - '-c' + - '-Wall' + - '-Wno-address' + - '-std=c99' + - '-pedantic' + includes: + prefix: '-I' + items: + - 'src/' + - '../src/' + - *unit_tests_path + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - UNITY_SUPPORT_TEST_CASES + object_files: + prefix: '-o' + extension: '.o' + destination: *build_path +linker: + path: gcc + options: + - -lm + includes: + prefix: '-I' + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.exe' + destination: *build_path +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/targets/gcc_64.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/targets/gcc_64.yml new file mode 100644 index 0000000..97cb958 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/targets/gcc_64.yml @@ -0,0 +1,43 @@ +compiler: + path: gcc + source_path: 'src/' + unit_tests_path: &unit_tests_path 'test/' + build_path: &build_path 'build/' + options: + - '-c' + - '-Wall' + - '-Wno-address' + - '-std=c99' + - '-pedantic' + includes: + prefix: '-I' + items: + - 'src/' + - '../src/' + - *unit_tests_path + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - UNITY_SUPPORT_TEST_CASES + - 'UNITY_POINTER_WIDTH=64' + object_files: + prefix: '-o' + extension: '.o' + destination: *build_path +linker: + path: gcc + options: + - -lm + includes: + prefix: '-I' + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.exe' + destination: *build_path +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/targets/hitech_picc18.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/targets/hitech_picc18.yml new file mode 100644 index 0000000..210d944 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/targets/hitech_picc18.yml @@ -0,0 +1,101 @@ +# rumor has it that this yaml file works for the standard edition of the +# hitech PICC18 compiler, but not the pro version. +# +compiler: + path: cd build && picc18 + source_path: 'c:\Projects\NexGen\Prototypes\CMockTest\src\' + unit_tests_path: &unit_tests_path 'c:\Projects\NexGen\Prototypes\CMockTest\test\' + build_path: &build_path 'c:\Projects\NexGen\Prototypes\CMockTest\build\' + options: + - --chip=18F87J10 + - --ide=hitide + - --q #quiet please + - --asmlist + - --codeoffset=0 + - --emi=wordwrite # External memory interface protocol + - --warn=0 # allow all normal warning messages + - --errors=10 # Number of errors before aborting compile + - --char=unsigned + - -Bl # Large memory model + - -G # generate symbol file + - --cp=16 # 16-bit pointers + - --double=24 + - -N255 # 255-char symbol names + - --opt=none # Do not use any compiler optimziations + - -c # compile only + - -M + includes: + prefix: '-I' + items: + - 'c:/Projects/NexGen/Prototypes/CMockTest/src/' + - 'c:/Projects/NexGen/Prototypes/CMockTest/mocks/' + - 'c:/CMock/src/' + - 'c:/CMock/examples/src/' + - 'c:/CMock/vendor/unity/src/' + - 'c:/CMock/vendor/unity/examples/helper/' + - *unit_tests_path + defines: + prefix: '-D' + items: + - UNITY_INT_WIDTH=16 + - UNITY_POINTER_WIDTH=16 + - CMOCK_MEM_STATIC + - CMOCK_MEM_SIZE=3000 + - UNITY_SUPPORT_TEST_CASES + - _PICC18 + object_files: + # prefix: '-O' # Hi-Tech doesn't want a prefix. They key off of filename .extensions, instead + extension: '.obj' + destination: *build_path + +linker: + path: cd build && picc18 + options: + - --chip=18F87J10 + - --ide=hitide + - --cp=24 # 24-bit pointers. Is this needed for linker?? + - --double=24 # Is this needed for linker?? + - -Lw # Scan the pic87*w.lib in the lib/ of the compiler installation directory + - --summary=mem,file # info listing + - --summary=+psect + - --summary=+hex + - --output=+intel + - --output=+mcof + - --runtime=+init # Directs startup code to copy idata, ibigdata and ifardata psects from ROM to RAM. + - --runtime=+clear # Directs startup code to clear bss, bigbss, rbss and farbss psects + - --runtime=+clib # link in the c-runtime + - --runtime=+keep # Keep the generated startup src after its obj is linked + - -G # Generate src-level symbol file + - -MIWasTheLastToBuild.map + - --warn=0 # allow all normal warning messages + - -Bl # Large memory model (probably not needed for linking) + includes: + prefix: '-I' + object_files: + path: *build_path + extension: '.obj' + bin_files: + prefix: '-O' + extension: '.hex' + destination: *build_path + +simulator: + path: + pre_support: + - 'java -client -jar ' # note space + - ['C:\Program Files\HI-TECH Software\HI-TIDE\3.15\lib\', 'simpic18.jar'] + - 18F87J10 + post_support: + +:cmock: + :plugins: [] + :includes: + - Types.h + :suite_teardown: | + if (num_failures) + _FAILED_TEST(); + else + _PASSED_TESTS(); + return 0; + +colour: true \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/targets/iar_arm_v4.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/targets/iar_arm_v4.yml new file mode 100644 index 0000000..c2e7f18 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/targets/iar_arm_v4.yml @@ -0,0 +1,89 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 4.0 Kickstart\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\lib\dl4tptinl8n.h'] + - -z3 + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian little + - --cpu ARM7TDMI + - --stack_align 4 + - --interwork + - -e + - --silent + - --warnings_are_errors + - --fpu None + - --diag_suppress Pa050 + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'common\bin\xlink.exe'] + options: + - -rt + - [*tools_root, 'arm\lib\dl4tptinl8n.r79'] + - -D_L_EXTMEM_START=0 + - -D_L_EXTMEM_SIZE=0 + - -D_L_HEAP_SIZE=120 + - -D_L_STACK_SIZE=32 + - -e_small_write=_formatted_write + - -s + - __program_start + - -f + - [*tools_root, '\arm\config\lnkarm.xcl'] + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\config\'] + - [*tools_root, 'arm\lib\'] + object_files: + path: *build_path + extension: '.r79' + bin_files: + prefix: '-o' + extension: '.d79' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\ioat91sam7X256.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/targets/iar_arm_v5.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/targets/iar_arm_v5.yml new file mode 100644 index 0000000..0549d8e --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/targets/iar_arm_v5.yml @@ -0,0 +1,79 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian=little + - --cpu=ARM7TDMI + - --interwork + - --warnings_are_errors + - --fpu=None + - --diag_suppress=Pa050 + - --diag_suppress=Pe111 + - -e + - -On + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\debugger\atmel\ioat91sam7X256.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/targets/iar_arm_v5_3.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/targets/iar_arm_v5_3.yml new file mode 100644 index 0000000..0549d8e --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/targets/iar_arm_v5_3.yml @@ -0,0 +1,79 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian=little + - --cpu=ARM7TDMI + - --interwork + - --warnings_are_errors + - --fpu=None + - --diag_suppress=Pa050 + - --diag_suppress=Pe111 + - -e + - -On + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\debugger\atmel\ioat91sam7X256.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml new file mode 100644 index 0000000..eb0785c --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml @@ -0,0 +1,93 @@ +#Default tool path for IAR 5.4 on Windows XP 64bit +tools_root: &tools_root 'C:\Program Files (x86)\IAR Systems\Embedded Workbench 5.4 Kickstart\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --diag_suppress=Pa050 + #- --diag_suppress=Pe111 + - --debug + - --endian=little + - --cpu=Cortex-M3 + - --no_path_in_file_macros + - -e + - --fpu=None + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + #- --preinclude --preinclude C:\Vss\T2 Working\common\system.h + - --interwork + - --warnings_are_errors +# - Ohz + - -Oh +# - --no_cse +# - --no_unroll +# - --no_inline +# - --no_code_motion +# - --no_tbaa +# - --no_clustering +# - --no_scheduling + + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - ewarm + - PART_LM3S9B92 + - TARGET_IS_TEMPEST_RB1 + - USE_ROM_DRIVERS + - UART_BUFFERED + - UNITY_SUPPORT_64 + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic.icf'] +# - ['C:\Temp\lm3s9b92.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + #- --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim2.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - --endian=little + - --cpu=Cortex-M3 + - --fpu=None + - -p + - [*tools_root, 'arm\config\debugger\TexasInstruments\iolm3sxxxx.ddf'] + - --semihosting + - --device=LM3SxBxx + #- -d + #- sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/targets/iar_cortexm3_v5.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/targets/iar_cortexm3_v5.yml new file mode 100644 index 0000000..cf0d1d0 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/targets/iar_cortexm3_v5.yml @@ -0,0 +1,83 @@ +# unit testing under iar compiler / simulator for STM32 Cortex-M3 + +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.4\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian=little + - --cpu=Cortex-M3 + - --interwork + - --warnings_are_errors + - --fpu=None + - --diag_suppress=Pa050 + - --diag_suppress=Pe111 + - -e + - -On + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - 'IAR' + - 'UNITY_SUPPORT_64' + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic_cortex.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\debugger\ST\iostm32f107xx.ddf'] + - --cpu=Cortex-M3 + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/targets/iar_msp430.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/targets/iar_msp430.yml new file mode 100644 index 0000000..e022647 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/targets/iar_msp430.yml @@ -0,0 +1,94 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3 MSP430\' +core_root: &core_root [*tools_root, '430\'] +core_bin: &core_bin [*core_root, 'bin\'] +core_config: &core_config [*core_root, 'config\'] +core_lib: &core_lib [*core_root, 'lib\'] +core_inc: &core_inc [*core_root, 'inc\'] +core_config: &core_config [*core_root, 'config\'] + +compiler: + path: [*core_bin, 'icc430.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*core_lib, 'dlib\dl430fn.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --debug + - -e + - -Ol + - --multiplier=16 + - --double=32 + - --diag_suppress Pa050 + - --diag_suppress Pe111 + includes: + prefix: '-I' + items: + - *core_inc + - [*core_inc, 'dlib'] + - [*core_lib, 'dlib'] + - 'src\' + - '../src/' + - *unit_tests_path + - 'vendor\unity\src' + defines: + prefix: '-D' + items: + - '__MSP430F149__' + - 'INT_WIDTH=16' + - 'UNITY_EXCLUDE_FLOAT' + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r43' + destination: *build_path +linker: + path: [*core_bin, 'xlink.exe'] + options: + - -rt + - [*core_lib, 'dlib\dl430fn.r43'] + - -e_PrintfTiny=_Printf + - -e_ScanfSmall=_Scanf + - -s __program_start + - -D_STACK_SIZE=50 + - -D_DATA16_HEAP_SIZE=50 + - -D_DATA20_HEAP_SIZE=50 + - -f + - [*core_config, 'lnk430f5438.xcl'] + - -f + - [*core_config, 'multiplier.xcl'] + includes: + prefix: '-I' + items: + - *core_config + - *core_lib + - [*core_lib, 'dlib'] + object_files: + path: *build_path + extension: '.r79' + bin_files: + prefix: '-o' + extension: '.d79' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*core_bin, '430proc.dll'] + - [*core_bin, '430sim.dll'] + post_support: + - --plugin + - [*core_bin, '430bat.dll'] + - --backend -B + - --cpu MSP430F5438 + - -p + - [*core_config, 'MSP430F5438.ddf'] + - -d sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/targets/iar_sh2a_v6.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/targets/iar_sh2a_v6.yml new file mode 100644 index 0000000..ddc5603 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/targets/iar_sh2a_v6.yml @@ -0,0 +1,85 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 6.0\' +compiler: + path: [*tools_root, 'sh\bin\iccsh.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - -e + - --char_is_signed + - -Ol + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_scheduling + - --no_clustering + - --debug + - --dlib_config + - [*tools_root, 'sh\inc\DLib_Product.h'] + - --double=32 + - --code_model=huge + - --data_model=huge + - --core=sh2afpu + - --warnings_affect_exit_code + - --warnings_are_errors + - --mfc + - --use_unix_directory_separators + - --diag_suppress=Pe161 + includes: + prefix: '-I' + items: + - [*tools_root, 'sh\inc\'] + - [*tools_root, 'sh\inc\c'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.o' + destination: *build_path +linker: + path: [*tools_root, 'sh\bin\ilinksh.exe'] + options: + - --redirect __Printf=__PrintfSmall + - --redirect __Scanf=__ScanfSmall + - --config + - [*tools_root, 'sh\config\generic.icf'] + - --config_def _CSTACK_SIZE=0x800 + - --config_def _HEAP_SIZE=0x800 + - --config_def _INT_TABLE=0x10 + - --entry __iar_program_start + - --debug_lib + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'sh\bin\shproc.dll'] + - [*tools_root, 'sh\bin\shsim.dll'] + post_support: + - --plugin + - [*tools_root, 'sh\bin\shbat.dll'] + - --backend + - -B + - --core sh2afpu + - -p + - [*tools_root, 'sh\config\debugger\io7264.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/expectdata/testsample_cmd.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/expectdata/testsample_cmd.c new file mode 100644 index 0000000..42841d8 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/expectdata/testsample_cmd.c @@ -0,0 +1,54 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include +#include "CException.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/expectdata/testsample_def.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/expectdata/testsample_def.c new file mode 100644 index 0000000..8280804 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/expectdata/testsample_def.c @@ -0,0 +1,50 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_cmd.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_cmd.c new file mode 100644 index 0000000..e47b31c --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_cmd.c @@ -0,0 +1,76 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_def.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_def.c new file mode 100644 index 0000000..3ca9dba --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_def.c @@ -0,0 +1,72 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_new1.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_new1.c new file mode 100644 index 0000000..a7cbcd8 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_new1.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + GlobalExpectCount = 0; + GlobalVerifyOrder = 0; + GlobalOrderError = NULL; + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_new2.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_new2.c new file mode 100644 index 0000000..2c76bf2 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_new2.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_param.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_param.c new file mode 100644 index 0000000..23c04f4 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_param.c @@ -0,0 +1,73 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST_NO_ARGS +#define RUN_TEST(TestFunc, TestLineNum, ...) \ +{ \ + Unity.CurrentTestName = #TestFunc "(" #__VA_ARGS__ ")"; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(__VA_ARGS__); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21, RUN_TEST_NO_ARGS); + RUN_TEST(test_TheSecondThingToTest, 43, RUN_TEST_NO_ARGS); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_run1.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_run1.c new file mode 100644 index 0000000..a7cbcd8 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_run1.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + GlobalExpectCount = 0; + GlobalVerifyOrder = 0; + GlobalOrderError = NULL; + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_run2.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_run2.c new file mode 100644 index 0000000..2c76bf2 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_run2.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_yaml.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_yaml.c new file mode 100644 index 0000000..68b545a --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_yaml.c @@ -0,0 +1,86 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include "two.h" +#include "three.h" +#include +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_yaml_setup(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/expectdata/testsample_new1.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/expectdata/testsample_new1.c new file mode 100644 index 0000000..e5bcac2 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/expectdata/testsample_new1.c @@ -0,0 +1,60 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/expectdata/testsample_new2.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/expectdata/testsample_new2.c new file mode 100644 index 0000000..b7c7e5b --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/expectdata/testsample_new2.c @@ -0,0 +1,63 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/expectdata/testsample_param.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/expectdata/testsample_param.c new file mode 100644 index 0000000..4157007 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/expectdata/testsample_param.c @@ -0,0 +1,51 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST_NO_ARGS +#define RUN_TEST(TestFunc, TestLineNum, ...) \ +{ \ + Unity.CurrentTestName = #TestFunc "(" #__VA_ARGS__ ")"; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(__VA_ARGS__); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21, RUN_TEST_NO_ARGS); + RUN_TEST(test_TheSecondThingToTest, 43, RUN_TEST_NO_ARGS); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/expectdata/testsample_run1.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/expectdata/testsample_run1.c new file mode 100644 index 0000000..e5bcac2 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/expectdata/testsample_run1.c @@ -0,0 +1,60 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/expectdata/testsample_run2.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/expectdata/testsample_run2.c new file mode 100644 index 0000000..b7c7e5b --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/expectdata/testsample_run2.c @@ -0,0 +1,63 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/expectdata/testsample_yaml.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/expectdata/testsample_yaml.c new file mode 100644 index 0000000..d109287 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/expectdata/testsample_yaml.c @@ -0,0 +1,64 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "two.h" +#include "three.h" +#include +#include +#include +#include "CException.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_yaml_setup(); +} + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/test_generate_test_runner.rb b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/test_generate_test_runner.rb new file mode 100644 index 0000000..61c8df9 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/test_generate_test_runner.rb @@ -0,0 +1,94 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +ruby_version = RUBY_VERSION.split('.') +if (ruby_version[1].to_i == 9) and (ruby_version[2].to_i > 1) + require 'rubygems' + gem 'test-unit' +end +require 'test/unit' +require './auto/generate_test_runner.rb' + +TEST_FILE = 'test/testdata/testsample.c' +TEST_MOCK = 'test/testdata/mocksample.c' +OUT_FILE = 'build/testsample_' +EXP_FILE = 'test/expectdata/testsample_' + +class TestGenerateTestRunner < Test::Unit::TestCase + def setup + end + + def teardown + end + + def verify_output_equal(subtest) + expected = File.read(EXP_FILE + subtest + '.c').gsub(/\r\n/,"\n") + actual = File.read(OUT_FILE + subtest + '.c').gsub(/\r\n/,"\n") + assert_equal(expected, actual, "Generated File Sub-Test '#{subtest}' Failed") + end + + def test_ShouldGenerateARunnerByCreatingRunnerWithOptions + sets = { 'def' => nil, + 'new1' => { :plugins => [:cexception], :includes => ['one.h', 'two.h'], :enforce_strict_ordering => true }, + 'new2' => { :plugins => [:ignore], :suite_setup => "a_custom_setup();", :suite_teardown => "a_custom_teardown();" } + } + + sets.each_pair do |subtest, options| + UnityTestRunnerGenerator.new(options).run(TEST_FILE, OUT_FILE + subtest + '.c') + verify_output_equal(subtest) + UnityTestRunnerGenerator.new(options).run(TEST_MOCK, OUT_FILE + 'mock_' + subtest + '.c') + verify_output_equal('mock_' + subtest) + end + end + + def test_ShouldGenerateARunnerByRunningRunnerWithOptions + sets = { 'run1' => { :plugins => [:cexception], :includes => ['one.h', 'two.h'], :enforce_strict_ordering => true }, + 'run2' => { :plugins => [:ignore], :suite_setup => "a_custom_setup();", :suite_teardown => "a_custom_teardown();" } + } + + sets.each_pair do |subtest, options| + UnityTestRunnerGenerator.new.run(TEST_FILE, OUT_FILE + subtest + '.c', options) + verify_output_equal(subtest) + UnityTestRunnerGenerator.new.run(TEST_MOCK, OUT_FILE + 'mock_' + subtest + '.c', options) + verify_output_equal('mock_' + subtest) + end + end + + def test_ShouldGenerateARunnerByPullingYamlOptions + subtest = 'yaml' + cmdstr = "ruby auto/generate_test_runner.rb test/testdata/sample.yml \"#{TEST_FILE}\" \"#{OUT_FILE + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal(subtest) + + cmdstr = "ruby auto/generate_test_runner.rb test/testdata/sample.yml \"#{TEST_MOCK}\" \"#{OUT_FILE + 'mock_' + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal('mock_' + subtest) + end + + def test_ShouldGenerateARunnerByPullingCommandlineOptions + subtest = 'cmd' + cmdstr = "ruby auto/generate_test_runner.rb -cexception \"#{TEST_FILE}\" \"#{OUT_FILE + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal(subtest) + + cmdstr = "ruby auto/generate_test_runner.rb -cexception \"#{TEST_MOCK}\" \"#{OUT_FILE + 'mock_' + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal('mock_' + subtest) + end + + def test_ShouldGenerateARunnerThatUsesParameterizedTests + sets = { 'param' => { :plugins => [:ignore], :use_param_tests => true } + } + + sets.each_pair do |subtest, options| + UnityTestRunnerGenerator.new(options).run(TEST_FILE, OUT_FILE + subtest + '.c') + verify_output_equal(subtest) + UnityTestRunnerGenerator.new(options).run(TEST_MOCK, OUT_FILE + 'mock_' + subtest + '.c') + verify_output_equal('mock_' + subtest) + end + end + +end diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/testdata/mocksample.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/testdata/mocksample.c new file mode 100644 index 0000000..b709438 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/testdata/mocksample.c @@ -0,0 +1,51 @@ +// This is just a sample test file to be used to test the generator script +#ifndef TEST_SAMPLE_H +#define TEST_SAMPLE_H + +#include +#include "unity.h" +#include "funky.h" +#include "Mockstanky.h" + +void setUp(void) +{ + CustomSetupStuff(); +} + +void tearDown(void) +{ + CustomTeardownStuff +} + +//Yup, nice comment +void test_TheFirstThingToTest(void) +{ + TEST_ASSERT(1); + + TEST_ASSERT_TRUE(1); +} + +/* +void test_ShouldBeIgnored(void) +{ + DoesStuff(); +} +*/ + +//void test_ShouldAlsoNotBeTested(void) +//{ +// Call_An_Expect(); +// +// CallAFunction(); +// test_CallAFunctionThatLooksLikeATest(); +//} + +void test_TheSecondThingToTest(void) +{ + Call_An_Expect(); + + CallAFunction(); + test_CallAFunctionThatLooksLikeATest(); +} + +#endif //TEST_SAMPLE_H diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/testdata/sample.yml b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/testdata/sample.yml new file mode 100644 index 0000000..9e5eece --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/testdata/sample.yml @@ -0,0 +1,9 @@ +:unity: + :includes: + - two.h + - three.h + - + :plugins: + - :cexception + :suite_setup: | + a_yaml_setup(); \ No newline at end of file diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/testdata/testsample.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/testdata/testsample.c new file mode 100644 index 0000000..4f30ec7 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/testdata/testsample.c @@ -0,0 +1,51 @@ +// This is just a sample test file to be used to test the generator script +#ifndef TEST_SAMPLE_H +#define TEST_SAMPLE_H + +#include +#include "unity.h" +#include "funky.h" +#include "stanky.h" + +void setUp(void) +{ + CustomSetupStuff(); +} + +void tearDown(void) +{ + CustomTeardownStuff +} + +//Yup, nice comment +void test_TheFirstThingToTest(void) +{ + TEST_ASSERT(1); + + TEST_ASSERT_TRUE(1); +} + +/* +void test_ShouldBeIgnored(void) +{ + DoesStuff(); +} +*/ + +//void test_ShouldAlsoNotBeTested(void) +//{ +// Call_An_Expect(); +// +// CallAFunction(); +// test_CallAFunctionThatLooksLikeATest(); +//} + +void test_TheSecondThingToTest(void) +{ + Call_An_Expect(); + + CallAFunction(); + test_CallAFunctionThatLooksLikeATest(); +} + +#endif //TEST_SAMPLE_H diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/testparameterized.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/testparameterized.c new file mode 100644 index 0000000..037cd21 --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/testparameterized.c @@ -0,0 +1,101 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include +#include "unity.h" + +#define TEST_CASE(...) + +#define EXPECT_ABORT_BEGIN \ + if (TEST_PROTECT()) \ + { + +#define VERIFY_FAILS_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestFailed == 1) ? 0 : 1; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Failed But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +#define VERIFY_IGNORES_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestIgnored == 1) ? 0 : 1; \ + Unity.CurrentTestIgnored = 0; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Ignored But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +int SetToOneToFailInTearDown; +int SetToOneMeanWeAlreadyCheckedThisGuy; + +void setUp(void) +{ + SetToOneToFailInTearDown = 0; + SetToOneMeanWeAlreadyCheckedThisGuy = 0; +} + +void tearDown(void) +{ + if (SetToOneToFailInTearDown == 1) + TEST_FAIL_MESSAGE("<= Failed in tearDown"); + if ((SetToOneMeanWeAlreadyCheckedThisGuy == 0) && (Unity.CurrentTestFailed > 0)) + { + UnityPrint("[[[[ Previous Test Should Have Passed But Did Not ]]]]"); + UNITY_OUTPUT_CHAR('\n'); + } +} + +TEST_CASE(0) +TEST_CASE(44) +TEST_CASE((90)+9) +void test_TheseShouldAllPass(int Num) +{ + TEST_ASSERT_TRUE(Num < 100); +} + +TEST_CASE(3) +TEST_CASE(77) +TEST_CASE( (99) + 1 - (1)) +void test_TheseShouldAllFail(int Num) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(Num > 100); + VERIFY_FAILS_END +} + +TEST_CASE(1) +TEST_CASE(44) +TEST_CASE(99) +TEST_CASE(98) +void test_TheseAreEveryOther(int Num) +{ + if (Num & 1) + { + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(Num > 100); + VERIFY_FAILS_END + } + else + { + TEST_ASSERT_TRUE(Num < 100); + } +} + +void test_NormalPassesStillWork(void) +{ + TEST_ASSERT_TRUE(1); +} + +void test_NormalFailsStillWork(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(0); + VERIFY_FAILS_END +} diff --git a/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/testunity.c b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/testunity.c new file mode 100644 index 0000000..9f826dc --- /dev/null +++ b/flex-bison/clcalc/modules/data-structures/tools/ceedling/vendor/unity/test/testunity.c @@ -0,0 +1,1510 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include +#include "unity.h" + +#define EXPECT_ABORT_BEGIN \ + if (TEST_PROTECT()) \ + { + +#define VERIFY_FAILS_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestFailed == 1) ? 0 : 1; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Failed But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +#define VERIFY_IGNORES_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestIgnored == 1) ? 0 : 1; \ + Unity.CurrentTestIgnored = 0; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Ignored But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +int SetToOneToFailInTearDown; +int SetToOneMeanWeAlreadyCheckedThisGuy; + +void setUp(void) +{ + SetToOneToFailInTearDown = 0; + SetToOneMeanWeAlreadyCheckedThisGuy = 0; +} + +void tearDown(void) +{ + if (SetToOneToFailInTearDown == 1) + TEST_FAIL_MESSAGE("<= Failed in tearDown"); + if ((SetToOneMeanWeAlreadyCheckedThisGuy == 0) && (Unity.CurrentTestFailed > 0)) + { + UnityPrint("[[[[ Previous Test Should Have Passed But Did Not ]]]]"); + UNITY_OUTPUT_CHAR('\n'); + } +} + +void testTrue(void) +{ + TEST_ASSERT(1); + + TEST_ASSERT_TRUE(1); +} + +void testFalse(void) +{ + TEST_ASSERT_FALSE(0); + + TEST_ASSERT_UNLESS(0); +} + +void testPreviousPass(void) +{ + TEST_ASSERT_EQUAL_INT(0U, Unity.TestFailures); +} + +void testNotVanilla(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT(0); + VERIFY_FAILS_END +} + +void testNotTrue(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(0); + VERIFY_FAILS_END +} + +void testNotFalse(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_FALSE(1); + VERIFY_FAILS_END +} + +void testNotUnless(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UNLESS(1); + VERIFY_FAILS_END +} + +void testNotNotEqual(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_NOT_EQUAL(10, 10); + VERIFY_FAILS_END +} + +void testFail(void) +{ + EXPECT_ABORT_BEGIN + TEST_FAIL_MESSAGE("Expected for testing"); + VERIFY_FAILS_END +} + +void testIsNull(void) +{ + char* ptr1 = NULL; + char* ptr2 = "hello"; + + TEST_ASSERT_NULL(ptr1); + TEST_ASSERT_NOT_NULL(ptr2); +} + +void testIsNullShouldFailIfNot(void) +{ + char* ptr1 = "hello"; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_NULL(ptr1); + VERIFY_FAILS_END +} + +void testNotNullShouldFailIfNULL(void) +{ + char* ptr1 = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_NOT_NULL(ptr1); + VERIFY_FAILS_END +} + +void testIgnore(void) +{ + EXPECT_ABORT_BEGIN + TEST_IGNORE(); + TEST_FAIL_MESSAGE("This should not be reached"); + VERIFY_IGNORES_END +} + +void testIgnoreMessage(void) +{ + EXPECT_ABORT_BEGIN + TEST_IGNORE_MESSAGE("This is an expected TEST_IGNORE_MESSAGE string!"); + TEST_FAIL_MESSAGE("This should not be reached"); + VERIFY_IGNORES_END +} + +void testNotEqualInts(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT(3982, 3983); + VERIFY_FAILS_END +} + +void testNotEqualInt8s(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT8(-127, -126); + VERIFY_FAILS_END +} + +void testNotEqualInt16s(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT16(-16383, -16382); + VERIFY_FAILS_END +} + +void testNotEqualInt32s(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT32(-2147483647, -2147483646); + VERIFY_FAILS_END +} + +void testNotEqualBits(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_BITS(0xFF00, 0x5555, 0x5A55); + VERIFY_FAILS_END +} + +void testNotEqualUInts(void) +{ + _UU16 v0, v1; + + v0 = 9000; + v1 = 9001; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualUInt8s(void) +{ + _UU8 v0, v1; + + v0 = 254; + v1 = 255; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT8(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualUInt16s(void) +{ + _UU16 v0, v1; + + v0 = 65535; + v1 = 65534; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualUInt32s(void) +{ + _UU32 v0, v1; + + v0 = 4294967295; + v1 = 4294967294; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT32(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex8s(void) +{ + _UU8 v0, v1; + + v0 = 0x23; + v1 = 0x22; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex8sIfSigned(void) +{ + _US8 v0, v1; + + v0 = -2; + v1 = 2; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex16s(void) +{ + _UU16 v0, v1; + + v0 = 0x1234; + v1 = 0x1235; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex16sIfSigned(void) +{ + _US16 v0, v1; + + v0 = -1024; + v1 = -1028; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex32s(void) +{ + _UU32 v0, v1; + + v0 = 900000; + v1 = 900001; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex32sIfSigned(void) +{ + _US32 v0, v1; + + v0 = -900000; + v1 = 900001; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32(v0, v1); + VERIFY_FAILS_END +} + +void testEqualInts(void) +{ + int v0, v1; + int *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(1837, 1837); + TEST_ASSERT_EQUAL_INT(-27365, -27365); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(19467, v1); + TEST_ASSERT_EQUAL_INT(v0, 19467); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 19467); +} + +void testEqualUints(void) +{ + unsigned int v0, v1; + unsigned int *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_UINT(1837, 1837); + TEST_ASSERT_EQUAL_UINT(v0, v1); + TEST_ASSERT_EQUAL_UINT(19467, v1); + TEST_ASSERT_EQUAL_UINT(v0, 19467); + TEST_ASSERT_EQUAL_UINT(*p0, v1); + TEST_ASSERT_EQUAL_UINT(*p0, *p1); + TEST_ASSERT_EQUAL_UINT(*p0, 19467); + TEST_ASSERT_EQUAL_UINT(60872u, 60872u); +} + +void testNotEqual(void) +{ + TEST_ASSERT_NOT_EQUAL(0, 1); + TEST_ASSERT_NOT_EQUAL(1, 0); + TEST_ASSERT_NOT_EQUAL(100, 101); + TEST_ASSERT_NOT_EQUAL(0, -1); + TEST_ASSERT_NOT_EQUAL(65535, -65535); + TEST_ASSERT_NOT_EQUAL(75, 900); + TEST_ASSERT_NOT_EQUAL(-100, -101); +} + +void testEqualHex8s(void) +{ + _UU8 v0, v1; + _UU8 *p0, *p1; + + v0 = 0x22; + v1 = 0x22; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX8(0x22, 0x22); + TEST_ASSERT_EQUAL_HEX8(v0, v1); + TEST_ASSERT_EQUAL_HEX8(0x22, v1); + TEST_ASSERT_EQUAL_HEX8(v0, 0x22); + TEST_ASSERT_EQUAL_HEX8(*p0, v1); + TEST_ASSERT_EQUAL_HEX8(*p0, *p1); + TEST_ASSERT_EQUAL_HEX8(*p0, 0x22); +} + +void testEqualHex8sNegatives(void) +{ + _UU8 v0, v1; + _UU8 *p0, *p1; + + v0 = 0xDD; + v1 = 0xDD; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX8(0xDD, 0xDD); + TEST_ASSERT_EQUAL_HEX8(v0, v1); + TEST_ASSERT_EQUAL_HEX8(0xDD, v1); + TEST_ASSERT_EQUAL_HEX8(v0, 0xDD); + TEST_ASSERT_EQUAL_HEX8(*p0, v1); + TEST_ASSERT_EQUAL_HEX8(*p0, *p1); + TEST_ASSERT_EQUAL_HEX8(*p0, 0xDD); +} + +void testEqualHex16s(void) +{ + _UU16 v0, v1; + _UU16 *p0, *p1; + + v0 = 0x9876; + v1 = 0x9876; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX16(0x9876, 0x9876); + TEST_ASSERT_EQUAL_HEX16(v0, v1); + TEST_ASSERT_EQUAL_HEX16(0x9876, v1); + TEST_ASSERT_EQUAL_HEX16(v0, 0x9876); + TEST_ASSERT_EQUAL_HEX16(*p0, v1); + TEST_ASSERT_EQUAL_HEX16(*p0, *p1); + TEST_ASSERT_EQUAL_HEX16(*p0, 0x9876); +} + +void testEqualHex32s(void) +{ + _UU32 v0, v1; + _UU32 *p0, *p1; + + v0 = 0x98765432ul; + v1 = 0x98765432ul; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX32(0x98765432ul, 0x98765432ul); + TEST_ASSERT_EQUAL_HEX32(v0, v1); + TEST_ASSERT_EQUAL_HEX32(0x98765432ul, v1); + TEST_ASSERT_EQUAL_HEX32(v0, 0x98765432ul); + TEST_ASSERT_EQUAL_HEX32(*p0, v1); + TEST_ASSERT_EQUAL_HEX32(*p0, *p1); + TEST_ASSERT_EQUAL_HEX32(*p0, 0x98765432ul); +} + +void testEqualBits(void) +{ + _UU32 v0 = 0xFF55AA00; + _UU32 v1 = 0x55550000; + + TEST_ASSERT_BITS(v1, v0, 0x55550000); + TEST_ASSERT_BITS(v1, v0, 0xFF55CC00); + TEST_ASSERT_BITS(0xFFFFFFFF, v0, 0xFF55AA00); + TEST_ASSERT_BITS(0xFFFFFFFF, v0, v0); + TEST_ASSERT_BITS(0xF0F0F0F0, v0, 0xFC5DAE0F); + TEST_ASSERT_BITS_HIGH(v1, v0); + TEST_ASSERT_BITS_LOW(0x000055FF, v0); + TEST_ASSERT_BIT_HIGH(30, v0); + TEST_ASSERT_BIT_LOW(5, v0); +} + +void testEqualShorts(void) +{ + short v0, v1; + short *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(1837, 1837); + TEST_ASSERT_EQUAL_INT(-2987, -2987); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(19467, v1); + TEST_ASSERT_EQUAL_INT(v0, 19467); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 19467); +} + +void testEqualUShorts(void) +{ + unsigned short v0, v1; + unsigned short *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_UINT(1837, 1837); + TEST_ASSERT_EQUAL_UINT(2987, 2987); + TEST_ASSERT_EQUAL_UINT(v0, v1); + TEST_ASSERT_EQUAL_UINT(19467, v1); + TEST_ASSERT_EQUAL_UINT(v0, 19467); + TEST_ASSERT_EQUAL_UINT(*p0, v1); + TEST_ASSERT_EQUAL_UINT(*p0, *p1); + TEST_ASSERT_EQUAL_UINT(*p0, 19467); +} + +void testEqualChars(void) +{ + signed char v0, v1; + signed char *p0, *p1; + + v0 = 109; + v1 = 109; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(42, 42); + TEST_ASSERT_EQUAL_INT(-116, -116); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(109, v1); + TEST_ASSERT_EQUAL_INT(v0, 109); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 109); +} + +void testEqualUChars(void) +{ + unsigned char v0, v1; + unsigned char *p0, *p1; + + v0 = 251; + v1 = 251; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(42, 42); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(251, v1); + TEST_ASSERT_EQUAL_INT(v0, 251); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 251); +} + +void testEqualPointers(void) +{ + int v0, v1; + int *p0, *p1, *p2; + + v0 = 19467; + v1 = 18271; + p0 = &v0; + p1 = &v1; + p2 = &v1; + + TEST_ASSERT_EQUAL_PTR(p0, &v0); + TEST_ASSERT_EQUAL_PTR(&v1, p1); + TEST_ASSERT_EQUAL_PTR(p2, p1); + TEST_ASSERT_EQUAL_PTR(&v0, &v0); +} + +void testNotEqualPointers(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_PTR(0x12345678, 0x12345677); + VERIFY_FAILS_END +} + +void testIntsWithinDelta(void) +{ + TEST_ASSERT_INT_WITHIN(1, 5000, 5001); + TEST_ASSERT_INT_WITHIN(5, 5000, 4996); + TEST_ASSERT_INT_WITHIN(5, 5000, 5005); + TEST_ASSERT_INT_WITHIN(500, 50, -440); + + TEST_ASSERT_INT_WITHIN(2, -1, -1); + TEST_ASSERT_INT_WITHIN(5, 1, -1); + TEST_ASSERT_INT_WITHIN(5, -1, 1); +} + +void testIntsNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_INT_WITHIN(5, 5000, 5006); + VERIFY_FAILS_END +} + +void testUIntsWithinDelta(void) +{ + TEST_ASSERT_UINT_WITHIN(1, 5000, 5001); + TEST_ASSERT_UINT_WITHIN(5, 5000, 4996); + TEST_ASSERT_UINT_WITHIN(5, 5000, 5005); +} + +void testUIntsNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UINT_WITHIN(1, 2147483647u, 2147483649u); + VERIFY_FAILS_END +} + +void testUIntsNotWithinDeltaEvenThoughASignedIntWouldPassSmallFirst(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UINT_WITHIN(5, 1, -1); + VERIFY_FAILS_END +} + +void testUIntsNotWithinDeltaEvenThoughASignedIntWouldPassBigFirst(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UINT_WITHIN(5, -1, 1); + VERIFY_FAILS_END +} + +void testHEX32sWithinDelta(void) +{ + TEST_ASSERT_HEX32_WITHIN(1, 5000, 5001); + TEST_ASSERT_HEX32_WITHIN(5, 5000, 4996); + TEST_ASSERT_HEX32_WITHIN(5, 5000, 5005); +} + +void testHEX32sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX32_WITHIN(1, 2147483647u, 2147483649u); + VERIFY_FAILS_END +} + +void testHEX32sNotWithinDeltaEvenThoughASignedIntWouldPass(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX32_WITHIN(5, 1, -1); + VERIFY_FAILS_END +} + +void testHEX16sWithinDelta(void) +{ + TEST_ASSERT_HEX16_WITHIN(1, 5000, 5001); + TEST_ASSERT_HEX16_WITHIN(5, 5000, 4996); + TEST_ASSERT_HEX16_WITHIN(5, 5000, 5005); +} + +void testHEX16sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX16_WITHIN(2, 65535, 0); + VERIFY_FAILS_END +} + +void testHEX8sWithinDelta(void) +{ + TEST_ASSERT_HEX8_WITHIN(1, 254, 255); + TEST_ASSERT_HEX8_WITHIN(5, 251, 255); + TEST_ASSERT_HEX8_WITHIN(5, 1, 4); +} + +void testHEX8sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX8_WITHIN(2, 255, 0); + VERIFY_FAILS_END +} + +void testEqualStrings(void) +{ + const char *testString = "foo"; + + TEST_ASSERT_EQUAL_STRING(testString, testString); + TEST_ASSERT_EQUAL_STRING("foo", "foo"); + TEST_ASSERT_EQUAL_STRING("foo", testString); + TEST_ASSERT_EQUAL_STRING(testString, "foo"); + TEST_ASSERT_EQUAL_STRING("", ""); +} + +void testEqualStringsWithCarriageReturnsAndLineFeeds(void) +{ + const char *testString = "foo\r\nbar"; + + TEST_ASSERT_EQUAL_STRING(testString, testString); + TEST_ASSERT_EQUAL_STRING("foo\r\nbar", "foo\r\nbar"); + TEST_ASSERT_EQUAL_STRING("foo\r\nbar", testString); + TEST_ASSERT_EQUAL_STRING(testString, "foo\r\nbar"); + TEST_ASSERT_EQUAL_STRING("", ""); +} + +void testNotEqualString1(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("foo", "bar"); + VERIFY_FAILS_END +} + +void testNotEqualString2(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("foo", ""); + VERIFY_FAILS_END +} + +void testNotEqualString3(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("", "bar"); + VERIFY_FAILS_END +} + +void testNotEqualString4(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("bar\r", "bar\n"); + VERIFY_FAILS_END +} + +void testNotEqualString5(void) +{ + const char str1[] = { 0x41, 0x42, 0x03, 0x00 }; + const char str2[] = { 0x41, 0x42, 0x04, 0x00 }; + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING(str1, str2); + VERIFY_FAILS_END +} + +void testNotEqualString_ExpectedStringIsNull(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING(NULL, "bar"); + VERIFY_FAILS_END +} + +void testNotEqualString_ActualStringIsNull(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("foo", NULL); + VERIFY_FAILS_END +} + +void testEqualStringArrays(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, expStrings, 3); + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 3); + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 2); + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 1); +} + +void testNotEqualStringArray1(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray2(void) +{ + const char *testStrings[] = { "zoo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", "boo", "woo", "moo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray3(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", NULL }; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray4(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", NULL, "woo", "moo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray5(void) +{ + const char **testStrings = NULL; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray6(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "zoo" }; + const char **expStrings = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testEqualStringArrayIfBothNulls(void) +{ + const char **testStrings = NULL; + const char **expStrings = NULL; + + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); +} + +void testEqualMemory(void) +{ + const char *testString = "whatever"; + + TEST_ASSERT_EQUAL_MEMORY(testString, testString, 8); + TEST_ASSERT_EQUAL_MEMORY("whatever", "whatever", 8); + TEST_ASSERT_EQUAL_MEMORY("whatever", testString, 8); + TEST_ASSERT_EQUAL_MEMORY(testString, "whatever", 8); + TEST_ASSERT_EQUAL_MEMORY(testString, "whatever", 2); + TEST_ASSERT_EQUAL_MEMORY(NULL, NULL, 1); +} + +void testNotEqualMemory1(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY("foo", "bar", 3); + VERIFY_FAILS_END +} + +void testNotEqualMemory2(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY("fool", "food", 4); + VERIFY_FAILS_END +} + +void testNotEqualMemory3(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY(NULL, "food", 4); + VERIFY_FAILS_END +} + +void testNotEqualMemory4(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY("fool", NULL, 4); + VERIFY_FAILS_END +} + +void testEqualIntArrays(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, -2}; + int p2[] = {1, 8, 987, 2}; + int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p3, 1); +} + +void testNotEqualIntArraysNullExpected(void) +{ + int* p0 = NULL; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArraysNullActual(void) +{ + int* p1 = NULL; + int p0[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArrays1(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArrays2(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {2, 8, 987, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArrays3(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 986, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualInt8Arrays(void) +{ + _US8 p0[] = {1, 8, 117, -2}; + _US8 p1[] = {1, 8, 117, -2}; + _US8 p2[] = {1, 8, 117, 2}; + _US8 p3[] = {1, 50, 60, 70}; + + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p3, 1); +} + +void testNotEqualInt8Arrays(void) +{ + _US8 p0[] = {1, 8, 127, -2}; + _US8 p1[] = {1, 8, 127, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualUIntArrays(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65132u}; + unsigned int p2[] = {1, 8, 987, 2}; + unsigned int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p3, 1); +} + +void testNotEqualUIntArrays1(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUIntArrays2(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUIntArrays3(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualInt16Arrays(void) +{ + _UU16 p0[] = {1, 8, 117, 3}; + _UU16 p1[] = {1, 8, 117, 3}; + _UU16 p2[] = {1, 8, 117, 2}; + _UU16 p3[] = {1, 50, 60, 70}; + + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p3, 1); +} + +void testNotEqualInt16Arrays(void) +{ + _UU16 p0[] = {1, 8, 127, 3}; + _UU16 p1[] = {1, 8, 127, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualUINT16Arrays(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65132u}; + unsigned short p2[] = {1, 8, 987, 2}; + unsigned short p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p3, 1); +} + +void testNotEqualUINT16Arrays1(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUINT16Arrays2(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUINT16Arrays3(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualHEXArrays(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65132u}; + unsigned int p2[] = {1, 8, 987, 2}; + unsigned int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p3, 1); +} + +void testNotEqualHEXArrays1(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEXArrays2(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEXArrays3(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualHEX16Arrays(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65132u}; + unsigned short p2[] = {1, 8, 987, 2}; + unsigned short p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p3, 1); +} + +void testNotEqualHEX16Arrays1(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX16Arrays2(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX16Arrays3(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualHEX8Arrays(void) +{ + unsigned short p0[] = {1, 8, 254u, 123}; + unsigned short p1[] = {1, 8, 254u, 123}; + unsigned short p2[] = {1, 8, 254u, 2}; + unsigned short p3[] = {1, 23, 25, 26}; + + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p3, 1); +} + +void testNotEqualHEX8Arrays1(void) +{ + unsigned char p0[] = {1, 8, 254u, 253u}; + unsigned char p1[] = {1, 8, 254u, 252u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX8Arrays2(void) +{ + unsigned char p0[] = {1, 8, 254u, 253u}; + unsigned char p1[] = {2, 8, 254u, 253u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX8Arrays3(void) +{ + unsigned char p0[] = {1, 8, 254u, 253u}; + unsigned char p1[] = {1, 8, 255u, 253u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualMemoryArrays(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, -2}; + int p2[] = {1, 8, 987, 2}; + int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p0, 4, 1); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p0, 4, 4); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p2, 4, 3); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p3, 4, 1); +} + +void testNotEqualMemoryArraysExpectedNull(void) +{ + int* p0 = NULL; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArraysActualNull(void) +{ + int p0[] = {1, 8, 987, -2}; + int* p1 = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArrays1(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArrays2(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {2, 8, 987, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArrays3(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 986, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testProtection(void) +{ + volatile int mask = 0; + + if (TEST_PROTECT()) + { + mask |= 1; + TEST_ABORT(); + } + else + { + Unity.CurrentTestFailed = 0; + mask |= 2; + } + + TEST_ASSERT_EQUAL(3, mask); +} + +void testIgnoredAndThenFailInTearDown(void) +{ + SetToOneToFailInTearDown = 1; + TEST_IGNORE(); +} + +// ===================== THESE TEST WILL RUN IF YOUR CONFIG INCLUDES 64 BIT SUPPORT ================== +#ifdef UNITY_SUPPORT_64 + +void testEqualHex64s(void) +{ + _UU64 v0, v1; + _UU64 *p0, *p1; + + v0 = 0x9876543201234567; + v1 = 0x9876543201234567; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX64(0x9876543201234567, 0x9876543201234567); + TEST_ASSERT_EQUAL_HEX64(v0, v1); + TEST_ASSERT_EQUAL_HEX64(0x9876543201234567, v1); + TEST_ASSERT_EQUAL_HEX64(v0, 0x9876543201234567); + TEST_ASSERT_EQUAL_HEX64(*p0, v1); + TEST_ASSERT_EQUAL_HEX64(*p0, *p1); + TEST_ASSERT_EQUAL_HEX64(*p0, 0x9876543201234567); +} + +void testNotEqualHex64s(void) +{ + _UU64 v0, v1; + + v0 = 9000000000; + v1 = 9100000000; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex64sIfSigned(void) +{ + _US64 v0, v1; + + v0 = -9000000000; + v1 = 9000000000; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64(v0, v1); + VERIFY_FAILS_END +} + +void testHEX64sWithinDelta(void) +{ + TEST_ASSERT_HEX64_WITHIN(1, 0x7FFFFFFFFFFFFFFF,0x7FFFFFFFFFFFFFFE); + TEST_ASSERT_HEX64_WITHIN(5, 5000, 4996); + TEST_ASSERT_HEX64_WITHIN(5, 5000, 5005); +} + +void testHEX64sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX64_WITHIN(1, 0x7FFFFFFFFFFFFFFF, 0x7FFFFFFFFFFFFFFC); + VERIFY_FAILS_END +} + +void testHEX64sNotWithinDeltaEvenThoughASignedIntWouldPass(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX64_WITHIN(5, 1, -1); + VERIFY_FAILS_END +} + +void testEqualHEX64Arrays(void) +{ + _UU64 p0[] = {1, 8, 987, 65132u}; + _UU64 p1[] = {1, 8, 987, 65132u}; + _UU64 p2[] = {1, 8, 987, 2}; + _UU64 p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p3, 1); +} + +void testNotEqualHEX64Arrays1(void) +{ + _UU64 p0[] = {1, 8, 987, 65132u}; + _UU64 p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX64Arrays2(void) +{ + _UU64 p0[] = {1, 8, 987, 65132u}; + _UU64 p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +#endif //64-bit SUPPORT + +// ===================== THESE TEST WILL RUN IF YOUR CONFIG INCLUDES FLOAT SUPPORT ================== +#ifndef UNITY_EXCLUDE_FLOAT + +void testFloatsWithinDelta(void) +{ + TEST_ASSERT_FLOAT_WITHIN(0.00003f, 187245.03485f, 187245.03488f); + TEST_ASSERT_FLOAT_WITHIN(1.0f, 187245.0f, 187246.0f); + TEST_ASSERT_FLOAT_WITHIN(0.05f, 9273.2549f, 9273.2049f); + TEST_ASSERT_FLOAT_WITHIN(0.007f, -726.93724f, -726.94424f); +} + +void testFloatsNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_FLOAT_WITHIN(0.05f, 9273.2649f, 9273.2049f); + VERIFY_FAILS_END +} + +void testFloatsEqual(void) +{ + TEST_ASSERT_EQUAL_FLOAT(187245.0f, 187246.0f); + TEST_ASSERT_EQUAL_FLOAT(18724.5f, 18724.6f); + TEST_ASSERT_EQUAL_FLOAT(9273.2549f, 9273.2599f); + TEST_ASSERT_EQUAL_FLOAT(-726.93724f, -726.9374f); +} + +void testFloatsNotEqual(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT(9273.9649f, 9273.0049f); + VERIFY_FAILS_END +} + +void testFloatsNotEqualNegative1(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT(-9273.9649f, -9273.0049f); + VERIFY_FAILS_END +} + +void testFloatsNotEqualNegative2(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT(-9273.0049f, -9273.9649f); + VERIFY_FAILS_END +} + +void testEqualFloatArrays(void) +{ + float p0[] = {1.0, -8.0, 25.4, -0.123}; + float p1[] = {1.0, -8.0, 25.4, -0.123}; + float p2[] = {1.0, -8.0, 25.4, -0.2}; + float p3[] = {1.0, -23.0, 25.0, -0.26}; + + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p3, 1); +} + +void testNotEqualFloatArraysExpectedNull(void) +{ + float* p0 = NULL; + float p1[] = {1.0, 8.0, 25.4, 0.252}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysActualNull(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float* p1 = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArrays1(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float p1[] = {1.0, 8.0, 25.4, 0.252}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArrays2(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float p1[] = {2.0, 8.0, 25.4, 0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArrays3(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float p1[] = {1.0, 8.0, 25.5, 0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysNegative1(void) +{ + float p0[] = {-1.0, -8.0, -25.4, -0.253}; + float p1[] = {-1.0, -8.0, -25.4, -0.252}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysNegative2(void) +{ + float p0[] = {-1.0, -8.0, -25.4, -0.253}; + float p1[] = {-2.0, -8.0, -25.4, -0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysNegative3(void) +{ + float p0[] = {-1.0, -8.0, -25.4, -0.253}; + float p1[] = {-1.0, -8.0, -25.5, -0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +#endif //FLOAT SUPPORT diff --git a/flex-bison/clcalc/project.yml b/flex-bison/clcalc/project.yml new file mode 100644 index 0000000..7a1508b --- /dev/null +++ b/flex-bison/clcalc/project.yml @@ -0,0 +1,40 @@ +--- + +:project: + :use_exceptions: FALSE + :use_test_preprocessor: TRUE + :use_auxiliary_dependencies: TRUE + :build_root: build + :test_file_prefix: test_ + +:paths: + :test: + - tests/** + :source: + - src/** + - modules/data-structures/src/** + - modules/common-includes/src/** + +:defines: + :commmon: &common_defines + :test: + - *common_defines + - TEST + :test_preprocess: + - *common_defines + - TEST + +:cmock: + :mock_prefix: mock_ + :when_no_prototypes: :warn + :enforce_strict_ordering: TRUE + :plugins: + - :ignore + +:plugins: + :load_paths: + - tools/ceedling/plugins + :enabled: + - stdout_pretty_tests_report + +... diff --git a/flex-bison/clcalc/rakefile.rb b/flex-bison/clcalc/rakefile.rb new file mode 100644 index 0000000..cd436b3 --- /dev/null +++ b/flex-bison/clcalc/rakefile.rb @@ -0,0 +1,87 @@ +require 'rake' + +PROJECT_ROOT = File.expand_path(File.dirname(__FILE__)) + +APP_NAME = 'mark1' +APP_EXT = '.exe' +APP_OUT = "#{APP_NAME}#{APP_EXT}" + +FLEX_BIN = 'flex' +FLEX_OPTS = '--header-file=src/control/parse/lexer/lex.yy.h' +FLEX_IN = 'src/control/parse/lexer/lexer.l' +FLEX_OUT = 'src/control/parse/lexer/lex.yy.c' + +BISON_BIN = 'bison' +BISON_OPTS = '-d' +BISON_IN = 'src/control/parse/grammar/grammar.y' +BISON_OUT = 'src/control/parse/grammar/grammar.tab.c' + +COMPILER_BIN = 'gcc' +COMPILER_OPTS = '-c -Wall -Werror' + +LINKER_BIN = 'gcc' +LINKER_OPTS = '' + +SRC_FILES = (FileList[ + 'src/**/*.c', + 'modules/data-structures/src/**/*.c', + 'modules/common-includes/src/**/*.c' +] + [ BISON_OUT, FLEX_OUT ]).uniq +INCLUDE_DIRS = FileList[ + 'src/**/', + 'modules/data-structures/src/**', + 'modules/common-includes/src/**' +] +OBJ_FILES = SRC_FILES.collect{|src| "build/#{File.basename(src).ext('o')}" } + +#------------------------------------------------------------------------------ + +load 'tools/ceedling/lib/rakefile.rb' + +def FindSourceByObj(obj) + puts obj + return SRC_FILES.find { |s| File.basename(s, '.c') == File.basename(obj, '.o') } +end + +task :default => [:clobber, 'build:all'] + +namespace :build do + includes = INCLUDE_DIRS.collect{|x| "-I#{x} "} + + desc "Run all tasks in the 'build' namespace" + task :all => [ :generated, :test, :bin, :docs] + + desc "Run all unit tests" + task :test => [ :generated, 'test:all' ] + + desc "Generate all auto-generated source files" + task :generated => [ BISON_IN, FLEX_IN ] do + sh "#{BISON_BIN} #{BISON_OPTS} -o#{BISON_OUT} #{BISON_IN}" + sh "#{FLEX_BIN} #{FLEX_OPTS} -o#{FLEX_OUT} #{FLEX_IN}" + end + + desc "Link object files to build application" + task :bin => [:generated, APP_OUT] + task APP_OUT => OBJ_FILES do + puts "Linking #{APP_OUT}..." + sh "#{LINKER_BIN} #{LINKER_OPTS} #{includes} -o #{APP_NAME} #{OBJ_FILES.collect{|x| x + ' '}}" + end + + rule '.o' => lambda{|obj| FindSourceByObj(obj) } do |t| + sh "#{COMPILER_BIN} #{COMPILER_OPTS} #{includes} -o #{t.name} #{t.source}" + end + + desc "Generate doxygen documentation" + task :docs => [:generated] do + sh 'doxygen' + end +end + +# Clean Task +CLEAN.include( BISON_OUT ) +CLEAN.include( BISON_OUT.ext('h') ) +CLEAN.include( FLEX_OUT ) +CLEAN.include( FLEX_OUT.ext('h') ) +CLEAN.include( 'build/*.o' ) +CLEAN.include( APP_OUT ) + diff --git a/flex-bison/clcalc/src/cl_options/cl_options.c b/flex-bison/clcalc/src/cl_options/cl_options.c new file mode 100644 index 0000000..f8e02f1 --- /dev/null +++ b/flex-bison/clcalc/src/cl_options/cl_options.c @@ -0,0 +1,179 @@ +/****************************************************************************** + * Copyright (C) 2011 Michael D. Lowis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ +/****************************************************************************** + * Includes and Prototypes + *****************************************************************************/ +#include +#include +#include +#include "cl_options.h" +#include "linked_list.h" + +STATIC void HandleLongOption(U8 opt_index); +STATIC void HandleShortOption(U8 opt); +STATIC void BuildFileList(U32 argc, String* argv); + +/****************************************************************************** + * Globals + *****************************************************************************/ +const String Help_String = +"Usage: mark1 [options] file...\n" +"Options:\n" +" --help Prints available options\n" +" --debug-ast Enables debug printing of the abstract syntax tree.\n" +" --debug-tac Enables debug printing of the intermediat three address code.\n" +" --debug-asm Enables debug printing of the generated assembly code.\n" +; + +// Short Options List +const String Short_Options = ""; + +// Long Options List +const struct option Long_Options[] = { + {"help", 0, 0, 0}, + {"debug-ast", 0, 0, 0}, + {"debug-tac", 0, 0, 0}, + {"debug-asm", 0, 0, 0}, + {0,0,0,0} +}; +#define IDX_HELP ((U8)0) +#define IDX_DEBUG_AST ((U8)1) +#define IDX_DEBUG_TAC ((U8)2) +#define IDX_DEBUG_ASM ((U8)3) + +// Option Variables +STATIC BOOL DebugAST = FALSE; +STATIC BOOL DebugTAC = FALSE; +STATIC BOOL DebugASM = FALSE; +STATIC LinkedList_T* FileList = NULL; + +/****************************************************************************** + * Private Functions + *****************************************************************************/ +void HandleLongOption(U8 opt_index) +{ + switch( opt_index ) + { + case IDX_HELP: + printf("%s",Help_String); + exit(0); + break; + case IDX_DEBUG_AST: + CLO_SetDebugAST( TRUE ); + break; + case IDX_DEBUG_TAC: + CLO_SetDebugTAC( TRUE ); + break; + case IDX_DEBUG_ASM: + CLO_SetDebugASM( TRUE ); + break; + default: + break; + } +} + +void HandleShortOption(U8 opt) +{ + switch( opt ) + { + default: + break; + } +} + +void BuildFileList(U32 argc, String* argv) +{ + while (optind < argc) + { + if (FileList == NULL) + { + FileList = LL_New( argv[optind++] ); + } + else + { + LL_Add( FileList, argv[optind++] ); + } + } +} + +/****************************************************************************** + * Public Functions + *****************************************************************************/ +void CLO_ParseOptions(U32 argc, String* argv) +{ + S8 opt = 0; + U8 opt_index = 0; + while(1) + { + opt = getopt_long(argc, argv, Short_Options, Long_Options, (int*)&opt_index); + if (opt == -1) + { + break; + } + + if(opt == 0) + { + HandleLongOption(opt_index); + } + else + { + HandleShortOption(opt); + } + } + BuildFileList(argc,argv); +} + +LinkedList_T* CLO_GetFileList(void) +{ + return FileList; +} + +void CLO_SetDebugAST(BOOL enabled) +{ + DebugAST = enabled; +} + +BOOL CLO_GetDebugAST() +{ + return DebugAST; +} + + +void CLO_SetDebugTAC(BOOL enabled) +{ + DebugTAC = enabled; +} + + +BOOL CLO_GetDebugTAC() +{ + return DebugTAC; +} + + +void CLO_SetDebugASM(BOOL enabled) +{ + DebugASM = enabled; +} + + +BOOL CLO_GetDebugASM() +{ + return DebugASM; +} + + diff --git a/flex-bison/clcalc/src/cl_options/cl_options.h b/flex-bison/clcalc/src/cl_options/cl_options.h new file mode 100644 index 0000000..6974aba --- /dev/null +++ b/flex-bison/clcalc/src/cl_options/cl_options.h @@ -0,0 +1,32 @@ +/****************************************************************************** + * Copyright (C) 2011 Michael D. Lowis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ +#ifndef CL_OPTIONS_H +#define CL_OPTIONS_H + +#include "common.h" +#include "linked_list.h" + +void CLO_ParseOptions(U32 argc, String* argv); +LinkedList_T* CLO_GetFileList(void); +void CLO_SetDebugAST(BOOL enabled); +BOOL CLO_GetDebugAST(void); +void CLO_SetDebugTAC(BOOL enabled); +BOOL CLO_GetDebugTAC(void); +void CLO_SetDebugASM(BOOL enabled); +BOOL CLO_GetDebugASM(void); + +#endif diff --git a/flex-bison/clcalc/src/control/control.c b/flex-bison/clcalc/src/control/control.c new file mode 100644 index 0000000..61c1eb5 --- /dev/null +++ b/flex-bison/clcalc/src/control/control.c @@ -0,0 +1,53 @@ +/****************************************************************************** + * Copyright (C) 2011 Michael D. Lowis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ +#include "control.h" +#include "parse.h" +#include "ast_debug.h" +#include "cl_options.h" +#include "eval.h" + +/****************************************************************************** + * Public Functions + *****************************************************************************/ +void Control_StartInterpreter(HashTable_T* symbols, FILE* input) +{ + Control_DisplayPrompt(); + Parse_ParseInput(symbols, input); +} + +void Control_EvalStmnt(HashTable_T* symbols, Node_T* ast) +{ + if( CLO_GetDebugAST() ) + { + PrintAST(ast); + } + + Eval_EvalStmnt(symbols,ast); + // Free AST + Control_DisplayPrompt(); +} + +void Control_DisplayPrompt(void) +{ + printf(">> "); +} + +void Control_InterpretFile(HashTable_T* symbols, String filename) +{ + Parse_ParseFile(symbols, filename); +} + diff --git a/flex-bison/clcalc/src/control/control.h b/flex-bison/clcalc/src/control/control.h new file mode 100644 index 0000000..3a7bb15 --- /dev/null +++ b/flex-bison/clcalc/src/control/control.h @@ -0,0 +1,31 @@ +/****************************************************************************** + * Copyright (C) 2011 Michael D. Lowis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ + #ifndef PHASES_H + #define PHASES_H + +#include "common.h" +#include "linked_list.h" +#include "hashtable.h" +#include "ast.h" +#include + +void Control_StartInterpreter(HashTable_T* symbols, FILE* input); +void Control_EvalStmnt(HashTable_T* symbols, Node_T* ast); +void Control_DisplayPrompt(void); +void Control_InterpretFile(HashTable_T* symbols, String filename); + + #endif diff --git a/flex-bison/clcalc/src/control/eval/eval.c b/flex-bison/clcalc/src/control/eval/eval.c new file mode 100644 index 0000000..ef88112 --- /dev/null +++ b/flex-bison/clcalc/src/control/eval/eval.c @@ -0,0 +1,140 @@ +/****************************************************************************** + * Copyright (C) 2011 Michael D. Lowis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ +#include "eval.h" +#include "linked_list.h" +#include +#include + +STATIC void Eval_PrintSymbol(Symbol_T* symbol); +STATIC Symbol_T* Eval_EvalExpression(HashTable_T* symbols, Node_T* ast); +STATIC Symbol_T* Eval_EvalSymbol(HashTable_T* symbols, Node_T* ast); +STATIC Symbol_T* Eval_EvalOperation(HashTable_T* symbols, Node_T* ast); +STATIC Symbol_T* Eval_EvalBinaryOperation(HashTable_T* symbols, Node_T* ast); + +/****************************************************************************** + * Public Functions + *****************************************************************************/ +void Eval_EvalStmnt(HashTable_T* symbols, Node_T* ast) +{ + Symbol_T* symbol = Eval_EvalExpression(symbols,ast); + Eval_PrintSymbol(symbol); +} + +/****************************************************************************** + * Private Functions + *****************************************************************************/ +STATIC void Eval_PrintSymbol(Symbol_T* symbol) +{ + if (symbol != NULL) + { + printf("\t=>\t"); + switch (symbol->type) + { + case EVAL_FLOAT: + printf("%g\n", symbol->value.Float); + break; + + default: + break; + } + } +} + + +STATIC Symbol_T* Eval_EvalExpression(HashTable_T* symbols, Node_T* ast) +{ + Symbol_T* symbol = (Symbol_T*)malloc( sizeof(Symbol_T) ); + if (ast->node_type > 250) // Is a value node + { + symbol = Eval_EvalSymbol(symbols, ast); + } + else // Is an operation node + { + symbol = Eval_EvalOperation(symbols, ast); + } + + return symbol; +} + +STATIC Symbol_T* Eval_EvalSymbol(HashTable_T* symbols, Node_T* ast) +{ + Symbol_T* symbol = (Symbol_T*) malloc( sizeof(Symbol_T) ); + switch (ast->node_type) + { + case FLOAT: + symbol->type = EVAL_FLOAT; + symbol->value.Float = ((ValueNode_T*)ast)->value.Float; + break; + + default: + free(symbol); + symbol = NULL; + break; + } + return symbol; +} + +STATIC Symbol_T* Eval_EvalOperation(HashTable_T* symbols, Node_T* ast) +{ + Symbol_T* symbol = NULL; + U32 num_children = LL_Length( ast->children ); + if ( num_children == 2 ) + { + symbol = Eval_EvalBinaryOperation(symbols,ast); + } + else + { + // Do more complex operations + } + return symbol; +} + +STATIC Symbol_T* Eval_EvalBinaryOperation(HashTable_T* symbols, Node_T* ast) +{ + Symbol_T* symbol = (Symbol_T*)malloc( sizeof(Symbol_T) ); + LinkedList_T* child1 = LL_Get(ast->children, 0); + LinkedList_T* child2 = LL_Get(ast->children, 1); + Symbol_T* param1 = Eval_EvalExpression( symbols, child1->contents ); + Symbol_T* param2 = Eval_EvalExpression( symbols, child2->contents ); + switch ( ast->node_type ) + { + case ADD: + symbol->type = EVAL_FLOAT; + symbol->value.Float = param1->value.Float + param2->value.Float; + break; + + case SUB: + symbol->type = EVAL_FLOAT; + symbol->value.Float = param1->value.Float - param2->value.Float; + break; + + case MUL: + symbol->type = EVAL_FLOAT; + symbol->value.Float = param1->value.Float * param2->value.Float; + break; + + case DIV: + symbol->type = EVAL_FLOAT; + symbol->value.Float = param1->value.Float / param2->value.Float; + break; + + default: + break; + } + return symbol; +} + diff --git a/flex-bison/clcalc/src/control/eval/eval.h b/flex-bison/clcalc/src/control/eval/eval.h new file mode 100644 index 0000000..72434d8 --- /dev/null +++ b/flex-bison/clcalc/src/control/eval/eval.h @@ -0,0 +1,27 @@ +#ifndef EVAL_H +#define EVAL_H + +#include "ast.h" +#include "hashtable.h" + +typedef enum +{ + EVAL_INT, + EVAL_FLOAT +} SymbolType_T; + +typedef union +{ + int Integer; + double Float; +} SymbolValue_T; + +typedef struct _Symbol_T +{ + SymbolType_T type; + SymbolValue_T value; +} Symbol_T; + +void Eval_EvalStmnt(HashTable_T* symbols, Node_T* ast); + +#endif diff --git a/flex-bison/clcalc/src/control/parse/grammar/grammar.y b/flex-bison/clcalc/src/control/parse/grammar/grammar.y new file mode 100644 index 0000000..a3dcc4d --- /dev/null +++ b/flex-bison/clcalc/src/control/parse/grammar/grammar.y @@ -0,0 +1,119 @@ +%{ + +#include +#include "ast.h" +#include "ast_debug.h" +#include "parse.h" +#include "lex.yy.h" +#include "control.h" + +#define YYLEX_PARAM context->lexinfo + +%} + +/****************************************************************************** +* Parser Options +******************************************************************************/ +%define api.pure +%parse-param { ParseContext_T* context } + +/****************************************************************************** +* Syntax Tree Values +******************************************************************************/ +%union +{ + void * Node; +} + +/****************************************************************************** +* Tokens +******************************************************************************/ +/* Literal Types */ +%token tBOOL +%token tFLOAT +%token tSTRING +%token tID + +/* Math Operators */ +%token '+' '-' '*' '/' '%' + +/* Logical Operators */ +%token tAND tOR tNOT + +/* Comparison Operators */ +%token tEQ tNE tGT tLT tGTE tLTE + +/* Statement Operators */ +%token '=' ',' ';' ':' '?' + +/* Braces and Parens */ +%token '(' ')' '[' ']' '{' '}' + +/****************************************************************************** +* Rule Return Types +******************************************************************************/ +%type stmnt +%type exp +%type literal + +/****************************************************************************** +* Operator Precedence +******************************************************************************/ +/*%nonassoc tEQ tNE tGT tLT tGTE tLTE*/ +%left '+' '-' +%left '*' '/' /*'%'*/ +/*%nonassoc tNOT*/ +/*%left tAND tOR*/ +/*%left '?' ':'*/ + +/****************************************************************************** +* Starting Rule +******************************************************************************/ +%start program + +%% + +program: + /* Nothing */ + | program stmnt { Control_EvalStmnt(context->symbols, $2); } + ; + +stmnt: + /*tID '=' exp ';' { $$ = NODE(ASSIGN, 2, $1, $3 ); }*/ + /*|*/ exp ';' { $$ = $1; } + ; +exp: + /* Mathematical Operators */ + exp '+' exp { $$ = NODE(ADD, 2, $1, $3); } + | exp '-' exp { $$ = NODE(SUB, 2, $1, $3); } + | exp '*' exp { $$ = NODE(MUL, 2, $1, $3); } + | exp '/' exp { $$ = NODE(DIV, 2, $1, $3); } + /*| exp '%' exp { $$ = NODE(MOD, 2, $1, $3); }*/ + + /*[> Logical Operators <]*/ + /*| exp tAND exp { $$ = NODE(AND, 2, $1, $3); }*/ + /*| exp tOR exp { $$ = NODE(OR, 2, $1, $3); }*/ + /*| tNOT exp { $$ = NODE(NOT, 1, $2); }*/ + + /*[> Comparison Operators <]*/ + /*| exp tEQ exp { $$ = NODE(EQ, 2, $1, $3); }*/ + /*| exp tNE exp { $$ = NODE(NE, 2, $1, $3); }*/ + /*| exp tLT exp { $$ = NODE(LT, 2, $1, $3); }*/ + /*| exp tGT exp { $$ = NODE(GT, 2, $1, $3); }*/ + /*| exp tLTE exp { $$ = NODE(LTE, 2, $1, $3); }*/ + /*| exp tGTE exp { $$ = NODE(GTE, 2, $1, $3); }*/ + + /*[> Misc <]*/ + /*| '(' exp ')' { $$ = $2; }*/ + /*| tID { $$ = $1; }*/ + /*| exp '?' exp ':' exp { $$ = NODE(TERN, 3, $1, $3, $5); }*/ + | literal { $$ = $1; } + ; + +literal: + tBOOL { $$ = $1; } + | tFLOAT { $$ = $1; } + ; + +%% + diff --git a/flex-bison/clcalc/src/control/parse/lexer/lexer.l b/flex-bison/clcalc/src/control/parse/lexer/lexer.l new file mode 100644 index 0000000..4a3a46c --- /dev/null +++ b/flex-bison/clcalc/src/control/parse/lexer/lexer.l @@ -0,0 +1,44 @@ +/* Pattern Macros */ +NUM [0-9] +AL [a-zA-Z] +HEX [a-fA-F0-9] +ALNUM [a-zA-Z0-9] +S [ \n\t] + +%{ + +/* Includes */ +#include "ast.h" +#include "parse.h" +#include + +%} + +%option reentrant +%option bison-bridge +%option noyywrap +%option nounput +%option noinput + +%% + + /* Math Operators*/ +"+" | +"-" | +"*" | +"/" | +";" | + /* Braces and Parens */ +"(" | +")" { return yytext[0]; } + +{NUM}+(\.{NUM}{NUM}*)? { yylval->Node = VAL_FLOAT( yytext ); return tFLOAT; } + +\/{2}.*\n ;/* Ignore Comments */ +{S} ;/* Ignore Whitespace */ +. { yyerror(yyscanner, yytext); } + +%% + + + diff --git a/flex-bison/clcalc/src/control/parse/parse.c b/flex-bison/clcalc/src/control/parse/parse.c new file mode 100644 index 0000000..90eab1c --- /dev/null +++ b/flex-bison/clcalc/src/control/parse/parse.c @@ -0,0 +1,49 @@ +/****************************************************************************** + * Copyright (C) 2001 Michael D. Lowis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ +/****************************************************************************** + * Includes and Prototypes + *****************************************************************************/ +#include +#include "parse.h" +#include "lex.yy.h" + +/****************************************************************************** + * Public Functions + *****************************************************************************/ +void Parse_ParseInput(HashTable_T* symbols, FILE* in_file) +{ + if ( in_file != NULL ) + { + ParseContext_T context = { NULL, symbols}; + context.symbols = symbols; + yylex_init( &(context.lexinfo) ); + yyset_in( in_file, context.lexinfo ); + yyparse( &context ); + } +} + +void Parse_ParseFile(HashTable_T* symbols, String in_file) +{ + FILE* input_file = fopen( in_file ,"r"); + Parse_ParseInput( symbols, input_file ); +} + +void yyerror(ParseContext_T* context, String s) +{ + fprintf(stderr,"Error: %s\n",s); +} + diff --git a/flex-bison/clcalc/src/control/parse/parse.h b/flex-bison/clcalc/src/control/parse/parse.h new file mode 100644 index 0000000..4d95dae --- /dev/null +++ b/flex-bison/clcalc/src/control/parse/parse.h @@ -0,0 +1,38 @@ +/****************************************************************************** + * Copyright (C) 2001 Michael D. Lowis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ +#ifndef PARSER_H +#define PARSER_H + +#include "common.h" +#include "grammar.tab.h" +#include "ast.h" +#include "dbg.h" +#include "hashtable.h" + +typedef struct +{ + void* lexinfo; + HashTable_T* symbols; +} ParseContext_T; + +void Parse_ParseFile(HashTable_T* symbols, String in_file); +void Parse_ParseInput(HashTable_T* symbols, FILE* in_file); +void yyerror(ParseContext_T* context, String s); + +extern int yyparse(ParseContext_T* context); + +#endif diff --git a/flex-bison/clcalc/src/data_structures/ast/ast.c b/flex-bison/clcalc/src/data_structures/ast/ast.c new file mode 100644 index 0000000..1db56e4 --- /dev/null +++ b/flex-bison/clcalc/src/data_structures/ast/ast.c @@ -0,0 +1,107 @@ +/****************************************************************************** + * Copyright (C) 2011 Michael D. Lowis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ +/****************************************************************************** + * Includes and Prototypes + ******************************************************************************/ + +#include "ast.h" +#include +#include + +static Node_T* New_ASTValNode(NodeType_T type, Value_T value); + +/****************************************************************************** + * Private Functions + ******************************************************************************/ +static Node_T* New_ASTValNode(NodeType_T type, Value_T value) +{ + ValueNode_T* node = (ValueNode_T*) malloc( sizeof(ValueNode_T) ); + node->node_type = type; + node->value = value; + return (Node_T *) node; +} + +/****************************************************************************** + * Public Functions + ******************************************************************************/ +Node_T* NODE(NodeType_T type, int child_count, ...) +{ + va_list arg_list; + int i = 0; + Node_T* node = (Node_T*) malloc( sizeof(Node_T) ); + node->node_type = type; + node->children = NULL; + + va_start (arg_list, child_count); + for (i = 0; i < child_count ; i++) + { + if (node->children == NULL) + { + node->children = LL_New( va_arg(arg_list, Node_T*) ); + } + else + { + LL_Add(node->children, va_arg(arg_list, Node_T*)); + } + } + va_end(arg_list); + + return (Node_T*) node; +} + +Node_T* NODE_APPEND(Node_T* node, Node_T* child) +{ + if (node->children == NULL) + { + node->children = LL_New( child ); + } + else + { + LL_Add(node->children, child); + } + return node; +} + +Node_T* VAL_BOOL(char* value) +{ + Value_T val; + val.Boolean = (strcmp(value,"true") == 0) ? TRUE : FALSE; + return New_ASTValNode(FLOAT, val); +} + +/*Node_T* VAL_INT(char* value)*/ +/*{*/ + /*Value_T val;*/ + /*val.Integer = atoi(value);*/ + /*return New_ASTValNode(INT, val);*/ +/*}*/ + +Node_T* VAL_FLOAT(char* value) +{ + Value_T val; + val.Float = atof(value); + return New_ASTValNode(FLOAT, val); +} + +/*Node_T* VAL_STRING(char* value)*/ +/*{*/ + /*Value_T val;*/ + /*val.String = (char *) malloc( strlen( value ) );*/ + /*strcpy( val.String, value );*/ + /*return New_ASTValNode(STRING, val);*/ +/*}*/ + diff --git a/flex-bison/clcalc/src/data_structures/ast/ast.h b/flex-bison/clcalc/src/data_structures/ast/ast.h new file mode 100644 index 0000000..b3c4800 --- /dev/null +++ b/flex-bison/clcalc/src/data_structures/ast/ast.h @@ -0,0 +1,116 @@ +/****************************************************************************** + * Copyright (C) 2011 Michael D. Lowis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ +#ifndef AST_H +#define AST_H + +#include +#include "common.h" +#include "il_opcodes.h" +#include "linked_list.h" + + +/// Definition of the node type. +typedef Opcode_T NodeType_T; + +/// The value portion of a node in the tree. +typedef union +{ + BOOL Boolean; + int Integer; + double Float; + char* String; +} Value_T; + +/// A parent node that contains an operator. +typedef struct +{ + NodeType_T node_type; + LinkedList_T* children; +} Node_T; + +/// A child node that contains a value. +typedef struct +{ + NodeType_T node_type; + Value_T value; +} ValueNode_T; + +/** + * @brief Creates a new operator node with the specified number of children. + * + * This is a variadic function that takes a node type, a number of children, + * and a variable number of NODE_T pointers representing the children of the + * newly created node. + * + * @param type The type of node to create. + * @param child_count The number of children you are passing in. + * @param ... A variable number of NODE_T pointers representing children. + * + * @return Returns a pointer to the newly created node. + **/ +Node_T* NODE(NodeType_T type, int child_count, ...); + +/** + * + **/ +Node_T* NODE_APPEND(Node_T* node, Node_T* child); + +/** + * @brief Creates and returns a new Boolean value node. + * + * This function takes the input string and converts it into a boolean value. + * The boolean value is then stored as the contents of the newly created node. + * A pointer to the newly created node is then returned to the caller. + * + * @param value String containing that data to use for this node. + **/ +Node_T* VAL_BOOL(char* value); + +/** + * @brief Creates and returns a new Integer value node. + * + * This function takes the input string and converts it to a float using atoi(). + * The integer value is then used as the value of the newly created node. A + * pointer to the newly created node is then returned to the caller. + * + * @param value String containing that data to use for this node. + **/ +//Node_T* VAL_INT(char* value); + +/** + * @brief Creates and returns a new Float value node. + * + * This function takes the input string and converts it to a float using atof(). + * The floating point value is then used as the value of the newly created node. + * A pointer to the newly created node is then returned to the caller. + * + * @param value String containing that data to use for this node. + **/ +Node_T* VAL_FLOAT(char* value); + +/** + * @brief Creates and returns a new String value node. + * + * This function takes the input string and uses it as the value of the newly + * created node. A pointer to the newly created node is then returned to the + * caller. + * + * @param value String containing that data to use for this node. + **/ +//Node_T* VAL_STRING(char* value); + +#endif diff --git a/flex-bison/clcalc/src/data_structures/ast/ast_debug.c b/flex-bison/clcalc/src/data_structures/ast/ast_debug.c new file mode 100644 index 0000000..31c3b98 --- /dev/null +++ b/flex-bison/clcalc/src/data_structures/ast/ast_debug.c @@ -0,0 +1,90 @@ +/****************************************************************************** + * Copyright (C) 2011 Michael D. Lowis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ +/****************************************************************************** + * Includes and Prototypes + ******************************************************************************/ + +#include "ast_debug.h" +#include + +STATIC void PrintNodeDefinition(Node_T* tree); +STATIC BOOL HasChildren(Node_T* tree); +STATIC void PrintChildNode(Node_T* tree, int parent); +STATIC void PrintNode(Node_T* tree, int parent); + +/****************************************************************************** + * Globals + ******************************************************************************/ +static int Node_Count = 0; + +/****************************************************************************** + * Public Functions + ******************************************************************************/ +void PrintAST(Node_T* tree) +{ + Node_Count = 0; + printf("digraph {\n"); + PrintNode(tree, 0); + printf("}\n"); +} + +/****************************************************************************** + * Private Functions + ******************************************************************************/ +void PrintNodeDefinition(Node_T* tree) +{ + switch(tree->node_type) + { + case FLOAT: + printf("\t%d [label=\"%f\"]\n", Node_Count, ((ValueNode_T*)tree)->value.Float); + break; + + default: + printf("\t%d [label=\"%d\"]\n", Node_Count, tree->node_type); + break; + } +} + +BOOL HasChildren(Node_T* tree) +{ + return (tree->node_type < 240) ? TRUE : FALSE; +} + +void PrintChildNode(Node_T* tree, int parent) +{ + if (tree != NULL) + { + printf("\t%d->%d\n", parent, ++Node_Count); + PrintNode( tree, parent); + } +} + +void PrintNode(Node_T* tree, int parent) +{ + int current_node = Node_Count; + PrintNodeDefinition(tree); + if ( HasChildren(tree) ) + { + LinkedList_T* child = tree->children; + while (child != NULL) + { + PrintChildNode( (Node_T*)child->contents, current_node ); + child = child->next; + } + } +} + diff --git a/flex-bison/clcalc/src/data_structures/ast/ast_debug.h b/flex-bison/clcalc/src/data_structures/ast/ast_debug.h new file mode 100644 index 0000000..96c40e4 --- /dev/null +++ b/flex-bison/clcalc/src/data_structures/ast/ast_debug.h @@ -0,0 +1,24 @@ +/****************************************************************************** + * Copyright (C) 2011 Michael D. Lowis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ +#ifndef AST_DEBUG_H +#define AST_DEBUG_H + +#include "ast.h" + +void PrintAST(Node_T* tree); + +#endif diff --git a/flex-bison/clcalc/src/il_opcodes/il_opcodes.c b/flex-bison/clcalc/src/il_opcodes/il_opcodes.c new file mode 100644 index 0000000..e69de29 diff --git a/flex-bison/clcalc/src/il_opcodes/il_opcodes.h b/flex-bison/clcalc/src/il_opcodes/il_opcodes.h new file mode 100644 index 0000000..76f0619 --- /dev/null +++ b/flex-bison/clcalc/src/il_opcodes/il_opcodes.h @@ -0,0 +1,32 @@ +/****************************************************************************** + * Copyright (C) 2011 Michael D. Lowis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ +#ifndef IL_OPCODES_H +#define IL_OPCODES_H + +#include "common.h" + +typedef enum +{ + ADD = 1, + SUB = 2, + MUL = 3, + DIV = 4, + + FLOAT = 255 +} Opcode_T; + +#endif diff --git a/flex-bison/clcalc/src/main.c b/flex-bison/clcalc/src/main.c new file mode 100644 index 0000000..3637129 --- /dev/null +++ b/flex-bison/clcalc/src/main.c @@ -0,0 +1,30 @@ +/****************************************************************************** + * Copyright (C) 2011 Michael D. Lowis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ +#include +#include "cl_options.h" +#include "control.h" +#include "hashtable.h" + +int main(int argc, char** argv) +{ + U8 ret = 0; + HashTable_T* table = Hash_New(128,NULL); + CLO_ParseOptions(argc,argv); + Control_StartInterpreter(table, stdin); + return (int)ret; +} + diff --git a/flex-bison/clcalc/tests/src/ast/test_ast.c b/flex-bison/clcalc/tests/src/ast/test_ast.c new file mode 100644 index 0000000..db11e38 --- /dev/null +++ b/flex-bison/clcalc/tests/src/ast/test_ast.c @@ -0,0 +1,16 @@ +#include "unity.h" + +#include "ast.h" + +#include "mock_linked_list.h" + +void setUp(void) +{ + +} + +void tearDown(void) +{ + +} + diff --git a/flex-bison/clcalc/tests/src/ast/test_ast_debug.c b/flex-bison/clcalc/tests/src/ast/test_ast_debug.c new file mode 100644 index 0000000..8fdc24d --- /dev/null +++ b/flex-bison/clcalc/tests/src/ast/test_ast_debug.c @@ -0,0 +1,14 @@ +#include "unity.h" + +#include "ast_debug.h" + +void setUp(void) +{ + +} + +void tearDown(void) +{ + +} + diff --git a/flex-bison/clcalc/tests/src/linked_list/test_linked_list.c b/flex-bison/clcalc/tests/src/linked_list/test_linked_list.c new file mode 100644 index 0000000..9116130 --- /dev/null +++ b/flex-bison/clcalc/tests/src/linked_list/test_linked_list.c @@ -0,0 +1,194 @@ +#include "unity.h" +#include + +// File to Test +#include "linked_list.h" + +//----------------------------------------------------------------------------- + +int* num1; +int* num2; +int* num3; +LinkedList_T* node1; +LinkedList_T* node2; +LinkedList_T* node3; + +//----------------------------------------------------------------------------- + +void setUp(void) +{ + num1 = (int*) malloc( sizeof(int) ); + num2 = (int*) malloc( sizeof(int) ); + num3 = (int*) malloc( sizeof(int) ); + *num1 = 0; + *num2 = 1; + *num3 = 2; + node1 = (LinkedList_T*) malloc( sizeof(LinkedList_T) ); + node2 = (LinkedList_T*) malloc( sizeof(LinkedList_T) ); + node3 = (LinkedList_T*) malloc( sizeof(LinkedList_T) ); + node1->next = node2; + node1->contents = num1; + node2->next = node3; + node2->contents = num2; + node3->next = NULL; + node3->contents = num3; +} + +void tearDown(void) +{ + if( num1 != NULL ) free( num1 ); + if( num2 != NULL ) free( num2 ); + if( num3 != NULL ) free( num3 ); + if( node1 != NULL ) free( node1 ); + if( node2 != NULL ) free( node2 ); + if( node3 != NULL ) free( node3 ); +} + +//----------------------------------------------------------------------------- +void test_LL_New_should_return_a_new_linked_list_with_the_supplied_contents(void) +{ +// Setup + int num = 42; +// Expected Function Calls +// Function to Test + LinkedList_T* list = LL_New(&num); +// Asserts + TEST_ASSERT_NOT_EQUAL(NULL, list); + TEST_ASSERT_EQUAL(&num, list->contents); + TEST_ASSERT_EQUAL(NULL, list->next); +} + +//----------------------------------------------------------------------------- +void test_LL_Last_should_return_a_pointer_to_the_last_element_in_the_linked_list_for_a_NULL_list(void) +{ +// Setup +// Expected Function Calls +// Function to Test + LinkedList_T* node = LL_Last(NULL); +// Asserts + TEST_ASSERT_EQUAL( NULL, node ); +} + +void test_LL_Last_should_return_a_pointer_to_the_last_element_in_the_linked_list_for_a_list_of_length_1(void) +{ +// Setup +// Expected Function Calls +// Function to Test + LinkedList_T* node = LL_Last(node3); +// Asserts + TEST_ASSERT_EQUAL(num3,node->contents); +} + +void test_LL_Last_should_return_a_pointer_to_the_last_element_in_the_linked_list_for_a_list_of_length_2(void) +{ +// Setup +// Expected Function Calls +// Function to Test + LinkedList_T* node = LL_Last(node2); +// Asserts + TEST_ASSERT_EQUAL(num3,node->contents); +} + +void test_LL_Last_should_return_a_pointer_to_the_last_element_in_the_linked_list_for_a_list_of_length_3(void) +{ +// Setup +// Expected Function Calls +// Function to Test + LinkedList_T* node = LL_Last(node1); +// Asserts + TEST_ASSERT_EQUAL(num3,node->contents); +} + +//----------------------------------------------------------------------------- +void test_LL_Get_should_return_a_pointer_to_the_item_at_the_supplied_index_within_a_list_of_size_1(void) +{ +// Setup +// Expected Function Calls +// Function to Test + LinkedList_T* node = LL_Get(node3,0); +// Asserts + /*TEST_ASSERT_EQUAL(num3,node->contents);*/ +} + +void test_LL_Get_should_return_a_pointer_to_the_item_at_the_supplied_index_within_a_list_of_size_3(void) +{ +// Setup +// Expected Function Calls +// Function to Test + LinkedList_T* node = LL_Get(node1,1); +// Asserts + TEST_ASSERT_EQUAL(num2,node->contents); +} + +void test_LL_Get_should_return_NULL_if_the_supplied_index_is_out_of_range(void) +{ +// Setup +// Expected Function Calls +// Function to Test + LinkedList_T* node = LL_Get(node1,6); +// Asserts + TEST_ASSERT_EQUAL(NULL,node); +} + +void test_LL_Get_should_return_NULL_if_a_null_list_is_supplied(void) +{ +// Setup +// Expected Function Calls +// Function to Test + LinkedList_T* node = LL_Get(NULL,6); +// Asserts + TEST_ASSERT_EQUAL(NULL,node); +} + +//----------------------------------------------------------------------------- +void test_LL_Add_should_add_a_new_node_containing_the_specified_pointer_to_the_end_of_the_supplied_list(void) +{ +// Setup +// Expected Function Calls +// Function to Test + LL_Add(node1,num2); +// Asserts + TEST_ASSERT_NOT_EQUAL( NULL, node1->next ); + TEST_ASSERT_EQUAL( num2, (node1->next)->contents ); +} + +//----------------------------------------------------------------------------- +void test_LL_Insert(void) +{ +// Setup +// Expected Function Calls +// Function to Test + LinkedList_T* node = LL_Insert(node1,1,num3); +// Asserts + TEST_ASSERT_NOT_EQUAL( NULL, node ); + TEST_ASSERT_EQUAL( node, node1->next ); + TEST_ASSERT_EQUAL( num3, node->contents ); +} + +//----------------------------------------------------------------------------- +void test_Delete_should_remove_and_free_the_first_element_in_the_linked_list(void) +{ +// Setup +// Expected Function Calls + +// Function to Test + LL_Delete(node1,0); +// Asserts + /*TEST_ASSERT_EQUAL( NULL, node1 );*/ +} + +//----------------------------------------------------------------------------- +void test_Free(void) +{ +// Setup + +// Expected Function Calls + +// Function to Test + +// Asserts + +} + +//----------------------------------------------------------------------------- + diff --git a/flex-bison/clcalc/tests/src/test_main.c b/flex-bison/clcalc/tests/src/test_main.c new file mode 100644 index 0000000..1effaa5 --- /dev/null +++ b/flex-bison/clcalc/tests/src/test_main.c @@ -0,0 +1,12 @@ +#include "unity.h" + +void setUp(void) +{ + +} + +void tearDown(void) +{ + +} + diff --git a/flex-bison/clcalc/tools/ceedling/config/test_environment.rb b/flex-bison/clcalc/tools/ceedling/config/test_environment.rb new file mode 100644 index 0000000..2290f29 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/config/test_environment.rb @@ -0,0 +1,12 @@ + +# Setup our load path: +[ + 'lib', + 'test', + 'vendor/behaviors/lib', + 'vendor/hardmock/lib', + 'vendor/constructor/lib', + 'vendor/deep_merge/lib', +].each do |dir| + $LOAD_PATH.unshift( File.join( File.expand_path(File.dirname(__FILE__) + "/../"), dir) ) +end diff --git a/flex-bison/clcalc/tools/ceedling/docs/Ceedling Packet.odt b/flex-bison/clcalc/tools/ceedling/docs/Ceedling Packet.odt new file mode 100644 index 0000000..3e9902d Binary files /dev/null and b/flex-bison/clcalc/tools/ceedling/docs/Ceedling Packet.odt differ diff --git a/flex-bison/clcalc/tools/ceedling/docs/Ceedling Packet.pdf b/flex-bison/clcalc/tools/ceedling/docs/Ceedling Packet.pdf new file mode 100644 index 0000000..1c9cce8 Binary files /dev/null and b/flex-bison/clcalc/tools/ceedling/docs/Ceedling Packet.pdf differ diff --git a/flex-bison/clcalc/tools/ceedling/docs/CeedlingLogo.png b/flex-bison/clcalc/tools/ceedling/docs/CeedlingLogo.png new file mode 100644 index 0000000..52f1ce6 Binary files /dev/null and b/flex-bison/clcalc/tools/ceedling/docs/CeedlingLogo.png differ diff --git a/flex-bison/clcalc/tools/ceedling/lib/cacheinator.rb b/flex-bison/clcalc/tools/ceedling/lib/cacheinator.rb new file mode 100644 index 0000000..47953dd --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/cacheinator.rb @@ -0,0 +1,42 @@ + +class Cacheinator + + constructor :cacheinator_helper, :file_path_utils, :file_wrapper, :yaml_wrapper + + def cache_test_config(hash) + @yaml_wrapper.dump( @file_path_utils.form_test_build_cache_path( INPUT_CONFIGURATION_CACHE_FILE), hash ) + end + + def cache_release_config(hash) + @yaml_wrapper.dump( @file_path_utils.form_release_build_cache_path( INPUT_CONFIGURATION_CACHE_FILE ), hash ) + end + + + def diff_cached_test_file( filepath ) + cached_filepath = @file_path_utils.form_test_build_cache_path( filepath ) + + if (@file_wrapper.exist?( cached_filepath ) and (!@file_wrapper.compare( filepath, cached_filepath ))) + @file_wrapper.cp(filepath, cached_filepath, {:preserve => false}) + return filepath + elsif (!@file_wrapper.exist?( cached_filepath )) + @file_wrapper.cp(filepath, cached_filepath, {:preserve => false}) + return filepath + end + + return cached_filepath + end + + + def diff_cached_test_config?(hash) + cached_filepath = @file_path_utils.form_test_build_cache_path(INPUT_CONFIGURATION_CACHE_FILE) + + return @cacheinator_helper.diff_cached_config?( cached_filepath, hash ) + end + + def diff_cached_release_config?(hash) + cached_filepath = @file_path_utils.form_release_build_cache_path(INPUT_CONFIGURATION_CACHE_FILE) + + return @cacheinator_helper.diff_cached_config?( cached_filepath, hash ) + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/lib/cacheinator_helper.rb b/flex-bison/clcalc/tools/ceedling/lib/cacheinator_helper.rb new file mode 100644 index 0000000..cb0ef78 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/cacheinator_helper.rb @@ -0,0 +1,12 @@ + +class CacheinatorHelper + + constructor :file_wrapper, :yaml_wrapper + + def diff_cached_config?(cached_filepath, hash) + return true if ( not @file_wrapper.exist?(cached_filepath) ) + return true if ( (@file_wrapper.exist?(cached_filepath)) and (!(@yaml_wrapper.load(cached_filepath) == hash)) ) + return false + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/lib/cmock_builder.rb b/flex-bison/clcalc/tools/ceedling/lib/cmock_builder.rb new file mode 100644 index 0000000..4a74aa8 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/cmock_builder.rb @@ -0,0 +1,15 @@ +require 'cmock' + +class CmockBuilder + + attr_accessor :cmock + + def setup + @cmock = nil + end + + def manufacture(cmock_config) + @cmock = CMock.new(cmock_config) + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/lib/configurator.rb b/flex-bison/clcalc/tools/ceedling/lib/configurator.rb new file mode 100644 index 0000000..82b1e61 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/configurator.rb @@ -0,0 +1,248 @@ +require 'defaults' +require 'constants' +require 'file_path_utils' +require 'deep_merge' + + + +class Configurator + + attr_reader :project_config_hash, :environment, :script_plugins, :rake_plugins + attr_accessor :project_logging, :project_debug, :project_verbosity, :sanity_checks + + constructor(:configurator_setup, :configurator_builder, :configurator_plugins, :cmock_builder, :yaml_wrapper, :system_wrapper) do + @project_logging = false + @project_debug = false + @project_verbosity = Verbosity::NORMAL + @sanity_checks = TestResultsSanityChecks::NORMAL + end + + + def setup + # special copy of cmock config to provide to cmock for construction + @cmock_config_hash = {} + + # capture our source config for later merge operations + @source_config_hash = {} + + # note: project_config_hash is an instance variable so constants and accessors created + # in eval() statements in build() have something of proper scope and persistence to reference + @project_config_hash = {} + @project_config_hash_backup = {} + + @script_plugins = [] + @rake_plugins = [] + end + + + def replace_flattened_config(config) + @project_config_hash.merge!(config) + @configurator_setup.build_constants_and_accessors(@project_config_hash, binding()) + end + + + def store_config + @project_config_hash_backup = @project_config_hash.clone + end + + + def restore_config + @project_config_hash = @project_config_hash_backup + @configurator_setup.build_constants_and_accessors(@project_config_hash, binding()) + end + + + def reset_defaults(config) + [:test_compiler, + :test_linker, + :test_fixture, + :test_includes_preprocessor, + :test_file_preprocessor, + :test_dependencies_generator, + :release_compiler, + :release_assembler, + :release_linker, + :release_dependencies_generator].each do |tool| + config[:tools].delete(tool) if (not (config[:tools][tool].nil?)) + end + end + + + def populate_defaults(config) + new_config = DEFAULT_CEEDLING_CONFIG.clone + new_config.deep_merge!(config) + config.replace(new_config) + + @configurator_builder.populate_defaults( config, DEFAULT_TOOLS_TEST ) + @configurator_builder.populate_defaults( config, DEFAULT_TOOLS_TEST_PREPROCESSORS ) if (config[:project][:use_test_preprocessor]) + @configurator_builder.populate_defaults( config, DEFAULT_TOOLS_TEST_DEPENDENCIES ) if (config[:project][:use_auxiliary_dependencies]) + + @configurator_builder.populate_defaults( config, DEFAULT_TOOLS_RELEASE ) if (config[:project][:release_build]) + @configurator_builder.populate_defaults( config, DEFAULT_TOOLS_RELEASE_ASSEMBLER ) if (config[:project][:release_build] and config[:release_build][:use_assembly]) + @configurator_builder.populate_defaults( config, DEFAULT_TOOLS_RELEASE_DEPENDENCIES ) if (config[:project][:release_build] and config[:project][:use_auxiliary_dependencies]) + end + + + def populate_unity_defines(config) + run_test = true + + config[:unity][:defines].each do |define| + if (define =~ /RUN_TEST\s*\(.+\)\s*=/) + run_test = false + break + end + end + + if (run_test) + config[:unity][:defines] << "\"RUN_TEST(func, line_num)=TestRun(func, #func, line_num)\"" + end + end + + + def populate_cmock_defaults(config) + # cmock has its own internal defaults handling, but we need to set these specific values + # so they're present for the build environment to access; + # note: these need to end up in the hash given to initialize cmock for this to be successful + cmock = config[:cmock] + + # yes, we're duplicating the default mock_prefix in cmock, but it's because we need CMOCK_MOCK_PREFIX always available in Ceedling's environment + cmock[:mock_prefix] = 'Mock' if (cmock[:mock_prefix].nil?) + + # just because strict ordering is the way to go + cmock[:enforce_strict_ordering] = true if (cmock[:enforce_strict_ordering].nil?) + + cmock[:mock_path] = File.join(config[:project][:build_root], TESTS_BASE_PATH, 'mocks') if (cmock[:mock_path].nil?) + cmock[:verbosity] = @project_verbosity if (cmock[:verbosity].nil?) + + cmock[:plugins] = [] if (cmock[:plugins].nil?) + cmock[:plugins].map! { |plugin| plugin.to_sym } + cmock[:plugins] << (:cexception) if (!cmock[:plugins].include?(:cexception) and (config[:project][:use_exceptions])) + cmock[:plugins].uniq! + + cmock[:unity_helper] = false if (cmock[:unity_helper].nil?) + + if (cmock[:unity_helper]) + cmock[:includes] << File.basename(cmock[:unity_helper]) + cmock[:includes].uniq! + end + + @cmock_builder.manufacture(cmock) + end + + + # grab tool names from yaml and insert into tool structures so available for error messages + def populate_tool_names_and_stderr_redirect(config) + config[:tools].each_key do |name| + tool = config[:tools][name] + + # populate name if not given + tool[:name] = name.to_s if (tool[:name].nil?) + + # populate stderr redirect option + tool[:stderr_redirect] = StdErrRedirect::NONE if (tool[:stderr_redirect].nil?) + end + end + + + def find_and_merge_plugins(config) + @configurator_plugins.add_load_paths(config) + + @rake_plugins = @configurator_plugins.find_rake_plugins(config) + @script_plugins = @configurator_plugins.find_script_plugins(config) + config_plugins = @configurator_plugins.find_config_plugins(config) + plugin_defaults = @configurator_plugins.find_plugin_defaults(config) + + config_plugins.each do |plugin| + config.deep_merge( @yaml_wrapper.load(plugin) ) + end + + plugin_defaults.each do |defaults| + @configurator_builder.populate_defaults( config, @yaml_wrapper.load(defaults) ) + end + + # special plugin setting for results printing + config[:plugins][:display_raw_test_results] = true if (config[:plugins][:display_raw_test_results].nil?) + end + + + def eval_environment_variables(config) + config[:environment].each do |hash| + key = hash.keys[0] + value_string = hash[key].to_s + if (value_string =~ RUBY_STRING_REPLACEMENT_PATTERN) + value_string.replace(@system_wrapper.module_eval(value_string)) + end + @system_wrapper.env_set(key.to_s.upcase, value_string) + end + end + + + def eval_paths(config) + individual_paths = [ + config[:project][:build_root], + config[:project][:options_paths], + config[:plugins][:load_paths]] + + individual_paths.flatten.each do |path| + path.replace(@system_wrapper.module_eval(path)) if (path =~ RUBY_STRING_REPLACEMENT_PATTERN) + end + + config[:paths].each_pair do |key, list| + list.each { |path_entry| path_entry.replace(@system_wrapper.module_eval(path_entry)) if (path_entry =~ RUBY_STRING_REPLACEMENT_PATTERN) } + end + end + + + def standardize_paths(config) + individual_paths = [ + config[:project][:build_root], + config[:project][:options_paths], + config[:plugins][:load_paths], + config[:cmock][:mock_path]] # cmock path in case it was explicitly set in config + + individual_paths.flatten.each { |path| FilePathUtils::standardize(path) } + + config[:paths].each_pair do |key, list| + list.each{|path| FilePathUtils::standardize(path)} + # ensure that list is an array (i.e. handle case of list being a single string) + config[:paths][key] = [list].flatten + end + + config[:tools].each_pair do |key, tool_config| + FilePathUtils::standardize(tool_config[:executable]) + end + end + + + def validate(config) + # collect felonies and go straight to jail + raise if (not @configurator_setup.validate_required_sections(config)) + + # collect all misdemeanors, everybody on probation + blotter = [] + blotter << @configurator_setup.validate_required_section_values(config) + blotter << @configurator_setup.validate_paths(config) + blotter << @configurator_setup.validate_tools(config) + + raise if (blotter.include?(false)) + end + + + def build(config) + built_config = @configurator_setup.build_project_config(config) + + @source_config_hash = config.clone + @project_config_hash = built_config.clone + store_config() + + @configurator_setup.build_constants_and_accessors(built_config, binding()) + end + + + def insert_rake_plugins(plugins) + plugins.each do |plugin| + @project_config_hash[:project_rakefile_component_files] << plugin + end + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/lib/configurator_builder.rb b/flex-bison/clcalc/tools/ceedling/lib/configurator_builder.rb new file mode 100644 index 0000000..48d99eb --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/configurator_builder.rb @@ -0,0 +1,408 @@ +require 'rubygems' +require 'rake' # for ext() method +require 'file_path_utils' # for class methods +require 'defaults' +require 'constants' # for Verbosity constants class & base file paths + + + +class ConfiguratorBuilder + + constructor :file_system_utils, :file_wrapper, :system_wrapper + + + def build_global_constants(config) + config.each_pair do |key, value| + formatted_key = key.to_s.upcase + # undefine global constant if it already exists + Object.send(:remove_const, formatted_key.to_sym) if @system_wrapper.constants_include?(formatted_key) + # create global constant + Object.module_eval("#{formatted_key} = value") + end + end + + + def build_accessor_methods(config, context) + config.each_pair do |key, value| + # fill configurator object with accessor methods + eval("def #{key.to_s.downcase}() return @project_config_hash[:#{key.to_s}] end", context) + end + end + + + # create a flattened hash from the original configuration structure + def flattenify(config) + new_hash = {} + + config.each_key do | parent | + + # gracefully handle empty top-level entries + next if (config[parent].nil?) + + case config[parent] + when Array + config[parent].each do |hash| + key = "#{parent.to_s.downcase}_#{hash.keys[0].to_s.downcase}".to_sym + new_hash[key] = hash[hash.keys[0]] + end + when Hash + config[parent].each_pair do | child, value | + key = "#{parent.to_s.downcase}_#{child.to_s.downcase}".to_sym + new_hash[key] = value + end + # handle entries with no children, only values + else + new_hash["#{parent.to_s.downcase}".to_sym] = config[parent] + end + + end + + return new_hash + end + + + def populate_defaults(config, defaults) + defaults.keys.sort.each do |section| + defaults[section].keys.sort.each do |entry| + config[section][entry] = defaults[section][entry] if (config[section].nil? or config[section][entry].nil?) + end + end + end + + + def clean(in_hash) + # ensure that include files inserted into test runners have file extensions & proper ones at that + in_hash[:test_runner_includes].map!{|include| include.ext(in_hash[:extension_header])} + end + + + def set_build_paths(in_hash) + out_hash = {} + + project_build_artifacts_root = File.join(in_hash[:project_build_root], 'artifacts') + project_build_tests_root = File.join(in_hash[:project_build_root], TESTS_BASE_PATH) + project_build_release_root = File.join(in_hash[:project_build_root], RELEASE_BASE_PATH) + + paths = [ + [:project_build_artifacts_root, project_build_artifacts_root, true ], + [:project_build_tests_root, project_build_tests_root, true ], + [:project_build_release_root, project_build_release_root, in_hash[:project_release_build] ], + + [:project_test_artifacts_path, File.join(project_build_artifacts_root, TESTS_BASE_PATH), true ], + [:project_test_runners_path, File.join(project_build_tests_root, 'runners'), true ], + [:project_test_results_path, File.join(project_build_tests_root, 'results'), true ], + [:project_test_build_output_path, File.join(project_build_tests_root, 'out'), true ], + [:project_test_build_cache_path, File.join(project_build_tests_root, 'cache'), true ], + [:project_test_dependencies_path, File.join(project_build_tests_root, 'dependencies'), true ], + + [:project_release_artifacts_path, File.join(project_build_artifacts_root, RELEASE_BASE_PATH), in_hash[:project_release_build] ], + [:project_release_build_cache_path, File.join(project_build_release_root, 'cache'), in_hash[:project_release_build] ], + [:project_release_build_output_path, File.join(project_build_release_root, 'out'), in_hash[:project_release_build] ], + [:project_release_build_output_asm_path, File.join(project_build_release_root, 'out', 'asm'), in_hash[:project_release_build] ], + [:project_release_build_output_c_path, File.join(project_build_release_root, 'out', 'c'), in_hash[:project_release_build] ], + [:project_release_dependencies_path, File.join(project_build_release_root, 'dependencies'), in_hash[:project_release_build] ], + + [:project_log_path, File.join(in_hash[:project_build_root], 'logs'), true ], + [:project_temp_path, File.join(in_hash[:project_build_root], 'temp'), true ], + + [:project_test_preprocess_includes_path, File.join(project_build_tests_root, 'preprocess/includes'), in_hash[:project_use_test_preprocessor] ], + [:project_test_preprocess_files_path, File.join(project_build_tests_root, 'preprocess/files'), in_hash[:project_use_test_preprocessor] ], + ] + + out_hash[:project_build_paths] = [] + + # fetch already set mock path + out_hash[:project_build_paths] << in_hash[:cmock_mock_path] if (in_hash[:project_use_mocks]) + + paths.each do |path| + build_path_name = path[0] + build_path = path[1] + build_path_add_condition = path[2] + + # insert path into build paths if associated with true condition + out_hash[:project_build_paths] << build_path if build_path_add_condition + # set path symbol name and path for each entry in paths array + out_hash[build_path_name] = build_path + end + + return out_hash + end + + + def set_force_build_filepaths(in_hash) + out_hash = {} + + out_hash[:project_test_force_rebuild_filepath] = File.join( in_hash[:project_test_dependencies_path], 'force_build' ) + out_hash[:project_release_force_rebuild_filepath] = File.join( in_hash[:project_release_dependencies_path], 'force_build' ) if (in_hash[:project_release_build]) + + return out_hash + end + + + def set_rakefile_components(in_hash) + out_hash = { + :project_rakefile_component_files => + [File.join(CEEDLING_LIB, 'tasks_base.rake'), + File.join(CEEDLING_LIB, 'tasks_filesystem.rake'), + File.join(CEEDLING_LIB, 'tasks_tests.rake'), + File.join(CEEDLING_LIB, 'tasks_vendor.rake'), + File.join(CEEDLING_LIB, 'rules_tests.rake')]} + + out_hash[:project_rakefile_component_files] << File.join(CEEDLING_LIB, 'rules_cmock.rake') if (in_hash[:project_use_mocks]) + out_hash[:project_rakefile_component_files] << File.join(CEEDLING_LIB, 'rules_preprocess.rake') if (in_hash[:project_use_test_preprocessor]) + out_hash[:project_rakefile_component_files] << File.join(CEEDLING_LIB, 'rules_tests_aux_dependencies.rake') if (in_hash[:project_use_auxiliary_dependencies]) + + out_hash[:project_rakefile_component_files] << File.join(CEEDLING_LIB, 'rules_release_aux_dependencies.rake') if (in_hash[:project_release_build] and in_hash[:project_use_auxiliary_dependencies]) + out_hash[:project_rakefile_component_files] << File.join(CEEDLING_LIB, 'rules_release.rake') if (in_hash[:project_release_build]) + out_hash[:project_rakefile_component_files] << File.join(CEEDLING_LIB, 'tasks_release.rake') if (in_hash[:project_release_build]) + + return out_hash + end + + + def set_library_build_info_filepaths(hash) + + # Notes: + # - Dependency on a change to our input configuration hash is handled elsewhere as it is + # dynamically formed during ceedling's execution + # - Compiled vendor dependencies like cmock.o, unity.o, cexception.o are handled below; + # here we're interested only in ceedling-based code generation dependencies + + ceedling_build_info_filepath = File.join(CEEDLING_RELEASE, 'build.info') + cmock_build_info_filepath = FilePathUtils::form_ceedling_vendor_path('cmock/release', 'build.info') + + out_hash = { + :ceedling_build_info_filepath => ceedling_build_info_filepath, + :cmock_build_info_filepath => cmock_build_info_filepath + } + + return out_hash + end + + + def set_release_target(in_hash) + return {} if (not in_hash[:project_release_build]) + + release_target_file = ((in_hash[:release_build_output].nil?) ? (DEFAULT_RELEASE_TARGET_NAME.ext(in_hash[:extension_executable])) : in_hash[:release_build_output]) + + return { + # tempted to make a helper method in file_path_utils? stop right there, pal. you'll introduce a cyclical dependency + :project_release_build_target => File.join(in_hash[:project_release_artifacts_path], release_target_file) + } + end + + + def collect_environment_variables(in_hash) + return { + :collection_environment => in_hash[:environment] + } + end + + + def collect_project_options(in_hash) + options = [] + + in_hash[:project_options_paths].each do |path| + options << @file_wrapper.directory_listing( File.join(path, '*.yml') ) + end + + return { + :collection_project_options => options.flatten + } + end + + + def expand_all_path_globs(in_hash) + out_hash = {} + path_keys = [] + + in_hash.each_key do |key| + next if (not key.to_s[0..4] == 'paths') + path_keys << key + end + + # sorted to provide assured order of traversal in test calls on mocks + path_keys.sort.each do |key| + out_hash["collection_#{key.to_s}".to_sym] = @file_system_utils.collect_paths( in_hash[key] ) + end + + return out_hash + end + + + def collect_source_and_include_paths(in_hash) + return { + :collection_paths_source_and_include => + in_hash[:collection_paths_source] + + in_hash[:collection_paths_include] + } + end + + + def collect_source_include_vendor_paths(in_hash) + extra_paths = [] + extra_paths << FilePathUtils::form_ceedling_vendor_path(CEXCEPTION_LIB_PATH) if (in_hash[:project_use_exceptions]) + + return { + :collection_paths_source_include_vendor => + in_hash[:collection_paths_source_and_include] + + extra_paths + } + end + + + def collect_test_support_source_include_paths(in_hash) + return { + :collection_paths_test_support_source_include => + in_hash[:collection_paths_test] + + in_hash[:collection_paths_support] + + in_hash[:collection_paths_source] + + in_hash[:collection_paths_include] + } + end + + + def collect_test_support_source_include_vendor_paths(in_hash) + extra_paths = [] + extra_paths << FilePathUtils::form_ceedling_vendor_path(UNITY_LIB_PATH) + extra_paths << FilePathUtils::form_ceedling_vendor_path(CEXCEPTION_LIB_PATH) if (in_hash[:project_use_exceptions]) + extra_paths << FilePathUtils::form_ceedling_vendor_path(CMOCK_LIB_PATH) if (in_hash[:project_use_mocks]) + extra_paths << in_hash[:cmock_mock_path] if (in_hash[:project_use_mocks]) + + return { + :collection_paths_test_support_source_include_vendor => + in_hash[:collection_paths_test_support_source_include] + + extra_paths + } + end + + + def collect_tests(in_hash) + all_tests = @file_wrapper.instantiate_file_list + + in_hash[:collection_paths_test].each do |path| + all_tests.include( File.join(path, "#{in_hash[:project_test_file_prefix]}*#{in_hash[:extension_source]}") ) + end + + return {:collection_all_tests => all_tests} + end + + + def collect_assembly(in_hash) + all_assembly = @file_wrapper.instantiate_file_list + + return {:collection_all_assembly => all_assembly} if (not in_hash[:release_build_use_assembly]) + + in_hash[:collection_paths_source].each do |path| + all_assembly.include( File.join(path, "*#{in_hash[:extension_assembly]}") ) + end + + return {:collection_all_assembly => all_assembly} + end + + + def collect_source(in_hash) + all_source = @file_wrapper.instantiate_file_list + + in_hash[:collection_paths_source].each do |path| + all_source.include( File.join(path, "*#{in_hash[:extension_source]}") ) + end + + return {:collection_all_source => all_source} + end + + + def collect_headers(in_hash) + all_headers = @file_wrapper.instantiate_file_list + + paths = + in_hash[:collection_paths_test] + + in_hash[:collection_paths_support] + + in_hash[:collection_paths_source] + + in_hash[:collection_paths_include] + + (paths).each do |path| + all_headers.include( File.join(path, "*#{in_hash[:extension_header]}") ) + end + + return {:collection_all_headers => all_headers} + end + + + def collect_all_existing_compilation_input(in_hash) + all_input = @file_wrapper.instantiate_file_list + + paths = + in_hash[:collection_paths_test] + + in_hash[:collection_paths_support] + + in_hash[:collection_paths_source] + + in_hash[:collection_paths_include] + + [FilePathUtils::form_ceedling_vendor_path(UNITY_LIB_PATH)] + + paths << FilePathUtils::form_ceedling_vendor_path(CEXCEPTION_LIB_PATH) if (in_hash[:project_use_exceptions]) + paths << FilePathUtils::form_ceedling_vendor_path(CMOCK_LIB_PATH) if (in_hash[:project_use_mocks]) + + (paths).each do |path| + all_input.include( File.join(path, "*#{in_hash[:extension_header]}") ) + all_input.include( File.join(path, "*#{in_hash[:extension_source]}") ) + end + + return {:collection_all_existing_compilation_input => all_input} + end + + + def collect_test_and_vendor_defines(in_hash) + test_defines = in_hash[:defines_test].clone + + test_defines.concat(in_hash[:unity_defines]) + test_defines.concat(in_hash[:cmock_defines]) if (in_hash[:project_use_mocks]) + test_defines.concat(in_hash[:cexception_defines]) if (in_hash[:project_use_exceptions]) + + return {:collection_defines_test_and_vendor => test_defines} + end + + + def collect_release_and_vendor_defines(in_hash) + release_defines = in_hash[:defines_release].clone + + release_defines.concat(in_hash[:cexception_defines]) if (in_hash[:project_use_exceptions]) + + return {:collection_defines_release_and_vendor => release_defines} + end + + + def collect_release_artifact_extra_link_objects(in_hash) + objects = [] + + # no build paths here so plugins can remap if necessary (i.e. path mapping happens at runtime) + objects << CEXCEPTION_C_FILE.ext( in_hash[:extension_object] ) if (in_hash[:project_use_exceptions]) + + return {:collection_release_artifact_extra_link_objects => objects} + end + + + def collect_test_fixture_extra_link_objects(in_hash) + # Note: Symbols passed to compiler at command line can change Unity and CException behavior / configuration; + # we also handle those dependencies elsewhere in compilation dependencies + + objects = [UNITY_C_FILE] + + # we don't include paths here because use of plugins or mixing different compilers may require different build paths + objects << CEXCEPTION_C_FILE if (in_hash[:project_use_exceptions]) + objects << CMOCK_C_FILE if (in_hash[:project_use_mocks]) + + # if we're using mocks & a unity helper is defined & that unity helper includes a source file component (not only a header of macros), + # then link in the unity_helper object file too + if ( in_hash[:project_use_mocks] and + in_hash[:cmock_unity_helper] and + @file_wrapper.exist?(in_hash[:cmock_unity_helper].ext(in_hash[:extension_source])) ) + objects << File.basename(in_hash[:cmock_unity_helper]) + end + + # no build paths here so plugins can remap if necessary (i.e. path mapping happens at runtime) + objects.map! { |object| object.ext(in_hash[:extension_object]) } + + return { :collection_test_fixture_extra_link_objects => objects } + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/lib/configurator_plugins.rb b/flex-bison/clcalc/tools/ceedling/lib/configurator_plugins.rb new file mode 100644 index 0000000..4a65579 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/configurator_plugins.rb @@ -0,0 +1,96 @@ +require 'constants' + +class ConfiguratorPlugins + + constructor :stream_wrapper, :file_wrapper, :system_wrapper + + def setup + @rake_plugins = [] + @script_plugins = [] + end + + + def add_load_paths(config) + config[:plugins][:load_paths].each do |root| + @system_wrapper.add_load_path( root ) if ( not @file_wrapper.directory_listing( File.join( root, '*.rb' ) ).empty? ) + + config[:plugins][:enabled].each do |plugin| + path = File.join( root, plugin ) + @system_wrapper.add_load_path( path ) if ( not @file_wrapper.directory_listing( File.join( path, '*.rb' ) ).empty? ) + end + end + end + + + # gather up and return .rake filepaths that exist on-disk + def find_rake_plugins(config) + plugins_with_path = [] + + config[:plugins][:load_paths].each do |root| + config[:plugins][:enabled].each do |plugin| + rake_plugin_path = File.join(root, plugin, "#{plugin}.rake") + if (@file_wrapper.exist?(rake_plugin_path)) + plugins_with_path << rake_plugin_path + @rake_plugins << plugin + end + end + end + + return plugins_with_path + end + + + # gather up and return just names of .rb classes that exist on-disk + def find_script_plugins(config) + config[:plugins][:load_paths].each do |root| + config[:plugins][:enabled].each do |plugin| + script_plugin_path = File.join(root, plugin, "#{plugin}.rb") + @script_plugins << plugin if @file_wrapper.exist?(script_plugin_path) + end + end + + return @script_plugins + end + + + # gather up and return configuration .yml filepaths that exist on-disk + def find_config_plugins(config) + plugins_with_path = [] + + config[:plugins][:load_paths].each do |root| + config[:plugins][:enabled].each do |plugin| + config_plugin_path = File.join(root, plugin, "#{plugin}.yml") + plugins_with_path << config_plugin_path if @file_wrapper.exist?(config_plugin_path) + end + end + + return plugins_with_path + end + + + # gather up and return default .yml filepaths that exist on-disk + def find_plugin_defaults(config) + defaults_with_path = [] + + config[:plugins][:load_paths].each do |root| + config[:plugins][:enabled].each do |plugin| + default_path = File.join(root, plugin, 'defaults.yml') + defaults_with_path << default_path if @file_wrapper.exist?(default_path) + end + end + + return defaults_with_path + end + + + def validate_plugins(enabled_plugins) + missing_plugins = Set.new(enabled_plugins) - Set.new(@rake_plugins) - Set.new(@script_plugins) + + missing_plugins.each do |plugin| + @stream_wrapper.stdout_puts.stderr_puts("ERROR: Ceedling plugin '#{plugin}' contains no rake or ruby class entry point. (Misspelled or missing files?)") + end + + raise if (missing_plugins.size > 0) + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/lib/configurator_setup.rb b/flex-bison/clcalc/tools/ceedling/lib/configurator_setup.rb new file mode 100644 index 0000000..e404727 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/configurator_setup.rb @@ -0,0 +1,114 @@ + +# add sort-ability to symbol so we can order keys array in hash for test-ability +class Symbol + include Comparable + + def <=>(other) + self.to_s <=> other.to_s + end +end + + +class ConfiguratorSetup + + constructor :configurator_builder, :configurator_validator + + + def build_project_config(config) + # convert config object to flattened hash + new_config = @configurator_builder.flattenify(config) + + # flesh out config + @configurator_builder.clean(new_config) + + # add to hash values we build up from configuration & file system contents + new_config.merge!(@configurator_builder.set_build_paths(new_config)) + new_config.merge!(@configurator_builder.set_force_build_filepaths(new_config)) + new_config.merge!(@configurator_builder.set_rakefile_components(new_config)) + new_config.merge!(@configurator_builder.set_library_build_info_filepaths(new_config)) + new_config.merge!(@configurator_builder.set_release_target(new_config)) + new_config.merge!(@configurator_builder.collect_project_options(new_config)) + new_config.merge!(@configurator_builder.collect_environment_variables(config)) + + # iterate through all entries in paths section and expand any & all globs to actual paths + new_config.merge!(@configurator_builder.expand_all_path_globs(new_config)) + + new_config.merge!(@configurator_builder.collect_source_and_include_paths(new_config)) + new_config.merge!(@configurator_builder.collect_source_include_vendor_paths(new_config)) + new_config.merge!(@configurator_builder.collect_test_support_source_include_paths(new_config)) + new_config.merge!(@configurator_builder.collect_test_support_source_include_vendor_paths(new_config)) + new_config.merge!(@configurator_builder.collect_tests(new_config)) + new_config.merge!(@configurator_builder.collect_assembly(new_config)) + new_config.merge!(@configurator_builder.collect_source(new_config)) + new_config.merge!(@configurator_builder.collect_headers(new_config)) + new_config.merge!(@configurator_builder.collect_all_existing_compilation_input(new_config)) + new_config.merge!(@configurator_builder.collect_test_and_vendor_defines(new_config)) + new_config.merge!(@configurator_builder.collect_release_and_vendor_defines(new_config)) + new_config.merge!(@configurator_builder.collect_release_artifact_extra_link_objects(new_config)) + new_config.merge!(@configurator_builder.collect_test_fixture_extra_link_objects(new_config)) + + return new_config + end + + + def build_constants_and_accessors(config, context) + @configurator_builder.build_global_constants(config) + @configurator_builder.build_accessor_methods(config, context) + end + + + def validate_required_sections(config) + validation = [] + validation << @configurator_validator.exists?(config, :project) + validation << @configurator_validator.exists?(config, :paths) + + return false if (validation.include?(false)) + return true + end + + def validate_required_section_values(config) + validation = [] + validation << @configurator_validator.exists?(config, :project, :build_root) + validation << @configurator_validator.exists?(config, :paths, :test) + validation << @configurator_validator.exists?(config, :paths, :source) + + return false if (validation.include?(false)) + return true + end + + def validate_paths(config) + validation = [] + + validation << @configurator_validator.validate_filepath(config, {:search_system_path => false}, :project, :build_root) + validation << @configurator_validator.validate_filepath(config, {:search_system_path => false}, :cmock, :unity_helper) if config[:cmock][:unity_helper] + + config[:project][:options_paths].each do |path| + validation << @configurator_validator.validate_filepath_simple( path, :project, :options_paths ) + end + + config[:plugins][:load_paths].each do |path| + validation << @configurator_validator.validate_filepath_simple( path, :plugins, :load_paths ) + end + + config[:paths].keys.sort.each do |key| + validation << @configurator_validator.validate_path_list(config, :paths, key) + end + + return false if (validation.include?(false)) + return true + end + + def validate_tools(config) + validation = [] + + config[:tools].keys.sort.each do |key| + validation << @configurator_validator.exists?(config, :tools, key, :executable) + validation << @configurator_validator.validate_filepath(config, {:search_system_path => true}, :tools, key, :executable) + validation << @configurator_validator.validate_tool_stderr_redirect(config, :tools, key) + end + + return false if (validation.include?(false)) + return true + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/lib/configurator_validator.rb b/flex-bison/clcalc/tools/ceedling/lib/configurator_validator.rb new file mode 100644 index 0000000..e50c0d4 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/configurator_validator.rb @@ -0,0 +1,154 @@ +require 'constants' +require 'tool_executor' # for argument replacement pattern +require 'file_path_utils' # for glob handling class methods + + +class ConfiguratorValidator + + constructor :file_wrapper, :stream_wrapper, :system_wrapper + + # walk into config hash verify existence of data at key depth + def exists?(config, *keys) + hash = retrieve_value(config, keys) + exist = !hash[:value].nil? + + if (not exist) + # no verbosity checking since this is lowest level anyhow & verbosity checking depends on configurator + @stream_wrapper.stderr_puts("ERROR: Required config file entry #{format_key_sequence(keys, hash[:depth])} does not exist.") + end + + return exist + end + + + # walk into config hash. verify directory path(s) at given key depth + def validate_path_list(config, *keys) + hash = retrieve_value(config, keys) + list = hash[:value] + + # return early if we couldn't walk into hash and find a value + return false if (list.nil?) + + path_list = [] + exist = true + + case list + when String then path_list << list + when Array then path_list = list + end + + path_list.each do |path| + base_path = FilePathUtils::extract_path(path) # lop off add/subtract notation & glob specifiers + + if (not @file_wrapper.exist?(base_path)) + # no verbosity checking since this is lowest level anyhow & verbosity checking depends on configurator + @stream_wrapper.stderr_puts("ERROR: Config path #{format_key_sequence(keys, hash[:depth])}['#{base_path}'] does not exist on disk.") + exist = false + end + end + + return exist + end + + + # simple path verification + def validate_filepath_simple(path, *keys) + validate_path = path + + if (not @file_wrapper.exist?(validate_path)) + # no verbosity checking since this is lowest level anyhow & verbosity checking depends on configurator + @stream_wrapper.stderr_puts("ERROR: Config path '#{validate_path}' associated with #{format_key_sequence(keys, keys.size)} does not exist on disk.") + return false + end + + return true + end + + + # walk into config hash. verify specified file exists. + def validate_filepath(config, options, *keys) + hash = retrieve_value(config, keys) + filepath = hash[:value] + + # return early if we couldn't walk into hash and find a value + return false if (filepath.nil?) + + # skip everything if we've got an argument replacement pattern + return true if (filepath =~ TOOL_EXECUTOR_ARGUMENT_REPLACEMENT_PATTERN) + + # if there's no path included, verify file exists somewhere in system search paths + if (not filepath.include?('/') and options[:search_system_path]) + exists = false + + @system_wrapper.search_paths.each do |path| + if (@file_wrapper.exist?(File.join(path, filepath))) + exists = true + break + end + end + + if (not exists) + # no verbosity checking since this is lowest level anyhow & verbosity checking depends on configurator + @stream_wrapper.stderr_puts("ERROR: Config filepath #{format_key_sequence(keys, hash[:depth])}['#{filepath}'] does not exist in system search paths.") + return false + end + + # if there is a path included, check that explicit filepath exists + else + if (not @file_wrapper.exist?(filepath)) + # no verbosity checking since this is lowest level anyhow & verbosity checking depends on configurator + @stream_wrapper.stderr_puts("ERROR: Config filepath #{format_key_sequence(keys, hash[:depth])}['#{filepath}'] does not exist on disk.") + return false + end + end + + return true + end + + def validate_tool_stderr_redirect(config, tools, tool) + redirect = config[tools][tool][:stderr_redirect] + if (redirect.class == Symbol) + # map constants and force to array of strings for runtime universality across ruby versions + if (not StdErrRedirect.constants.map{|constant| constant.to_s}.include?(redirect.to_s.upcase)) + error = "ERROR: [:#{tools}][:#{tool}][:stderr_redirect][:#{redirect}] is not a recognized option " + + "{#{StdErrRedirect.constants.map{|constant| ':' + constant.to_s.downcase}.join(', ')}}." + @stream_wrapper.stderr_puts(error) + return false + end + end + + return true + end + + private ######################################### + + + def retrieve_value(config, keys) + value = nil + hash = config + depth = 0 + + # walk into hash & extract value at requested key sequence + keys.each do |symbol| + depth += 1 + if (not hash[symbol].nil?) + hash = hash[symbol] + value = hash + else + value = nil + break + end + end + + return {:value => value, :depth => depth} + end + + + def format_key_sequence(keys, depth) + walked_keys = keys.slice(0, depth) + formatted_keys = walked_keys.map{|key| "[:#{key.to_s}]"} + + return formatted_keys.join + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/lib/constants.rb b/flex-bison/clcalc/tools/ceedling/lib/constants.rb new file mode 100644 index 0000000..634a7e4 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/constants.rb @@ -0,0 +1,62 @@ + +class Verbosity + SILENT = 0 # as silent as possible (though there are some messages that must be spit out) + ERRORS = 1 # only errors + COMPLAIN = 2 # spit out errors and warnings/notices + NORMAL = 3 # errors, warnings/notices, standard status messages + OBNOXIOUS = 4 # all messages including extra verbose output (used for lite debugging / verification) + DEBUG = 5 # special extra verbose output for hardcore debugging +end + + +class TestResultsSanityChecks + NONE = 0 # no sanity checking of test results + NORMAL = 1 # perform non-problematic checks + THOROUGH = 2 # perform checks that require inside knowledge of system workings +end + + +class StdErrRedirect + NONE = :none + AUTO = :auto + WIN = :win + UNIX = :unix + TCSH = :tcsh +end + +CEXCEPTION_ROOT_PATH = 'c_exception' +CEXCEPTION_LIB_PATH = "#{CEXCEPTION_ROOT_PATH}/lib" +CEXCEPTION_C_FILE = 'CException.c' +CEXCEPTION_H_FILE = 'CException.h' + +UNITY_ROOT_PATH = 'unity' +UNITY_LIB_PATH = "#{UNITY_ROOT_PATH}/src" +UNITY_C_FILE = 'unity.c' +UNITY_H_FILE = 'unity.h' +UNITY_INTERNALS_H_FILE = 'unity_internals.h' + +CMOCK_ROOT_PATH = 'cmock' +CMOCK_LIB_PATH = "#{CMOCK_ROOT_PATH}/src" +CMOCK_C_FILE = 'cmock.c' +CMOCK_H_FILE = 'cmock.h' + + +DEFAULT_CEEDLING_MAIN_PROJECT_FILE = 'project.yml' # main project file +DEFAULT_CEEDLING_USER_PROJECT_FILE = 'user.yml' # supplemental user config file + +INPUT_CONFIGURATION_CACHE_FILE = 'input.yml' # input configuration file dump + + +TEST_ROOT_NAME = 'test' +TEST_TASK_ROOT = TEST_ROOT_NAME + ':' +TEST_CONTEXT = TEST_ROOT_NAME.to_sym +RELEASE_ROOT_NAME = 'release' + +RUBY_STRING_REPLACEMENT_PATTERN = /#\{.+\}/ +RUBY_EVAL_REPLACEMENT_PATTERN = /^\{(.+)\}$/ +TOOL_EXECUTOR_ARGUMENT_REPLACEMENT_PATTERN = /(\$\{(\d+)\})/ + +NULL_FILE_PATH = '/dev/null' + +TESTS_BASE_PATH = 'tests' +RELEASE_BASE_PATH = 'release' diff --git a/flex-bison/clcalc/tools/ceedling/lib/defaults.rb b/flex-bison/clcalc/tools/ceedling/lib/defaults.rb new file mode 100644 index 0000000..78cbcbd --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/defaults.rb @@ -0,0 +1,349 @@ +require 'constants' +require 'system_wrapper' +require 'file_path_utils' + + +DEFAULT_TEST_COMPILER_TOOL = { + :executable => FilePathUtils.os_executable_ext('gcc'), + :name => 'default_test_compiler', + :stderr_redirect => StdErrRedirect::NONE, + :arguments => [ + {"-I\"$\"" => 'COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR'}, + {"-I\"$\"" => 'COLLECTION_PATHS_TEST_TOOLCHAIN_INCLUDE'}, + {"-D$" => 'COLLECTION_DEFINES_TEST_AND_VENDOR'}, + "-DGNU_COMPILER", + {"$" => 'TEST_COMPILER_ARGUMENTS'}, + "-c \"${1}\"", + "-o \"${2}\"", + ] + } + +DEFAULT_TEST_LINKER_TOOL = { + :executable => FilePathUtils.os_executable_ext('gcc'), + :name => 'default_test_linker', + :stderr_redirect => StdErrRedirect::NONE, + :arguments => [ + {"$" => 'TEST_LINKER_ARGUMENTS'}, + "\"${1}\"", + "-o \"${2}\"", + ] + } + +DEFAULT_TEST_FIXTURE_TOOL = { + :executable => '${1}', + :name => 'default_test_fixture', + :stderr_redirect => StdErrRedirect::AUTO, + :arguments => [ + {"$" => 'TEST_FIXTURE_ARGUMENTS'}, + ] + } + + + +DEFAULT_TEST_INCLUDES_PREPROCESSOR_TOOL = { + :executable => FilePathUtils.os_executable_ext('cpp'), + :name => 'default_test_includes_preprocessor', + :stderr_redirect => StdErrRedirect::NONE, + :arguments => [ + '-MM', '-MG', + # avoid some possibility of deep system lib header file complications by omitting vendor paths + # if cpp is run on *nix system, escape spaces in paths; if cpp on windows just use the paths collection as is + {"-I\"$\"" => "{SystemWrapper.is_windows? ? COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE : COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE.map{|path| path.gsub(\/ \/, \'\\\\ \') }}"}, + {"-D$" => 'COLLECTION_DEFINES_TEST_AND_VENDOR'}, + {"-D$" => 'DEFINES_TEST_PREPROCESS'}, + "-DGNU_PREPROCESSOR", + {"$" => 'TEST_INCLUDES_PREPROCESSOR_ARGUMENTS'}, + '-w', + '-nostdinc', + "\"${1}\"" + ] + } + +DEFAULT_TEST_FILE_PREPROCESSOR_TOOL = { + :executable => FilePathUtils.os_executable_ext('gcc'), + :name => 'default_test_file_preprocessor', + :stderr_redirect => StdErrRedirect::NONE, + :arguments => [ + '-E', + {"-I\"$\"" => 'COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR'}, + {"-I\"$\"" => 'PATHS_TEST_TOOLCHAIN_INCLUDE'}, + {"-D$" => 'COLLECTION_DEFINES_TEST_AND_VENDOR'}, + {"-D$" => 'DEFINES_TEST_PREPROCESS'}, + "-DGNU_PREPROCESSOR", + {"$" => 'TEST_FILE_PREPROCESSOR_ARGUMENTS'}, + "\"${1}\"", + "-o \"${2}\"" + ] + } + +DEFAULT_TEST_DEPENDENCIES_GENERATOR_TOOL = { + :executable => FilePathUtils.os_executable_ext('gcc'), + :name => 'default_test_dependencies_generator', + :stderr_redirect => StdErrRedirect::NONE, + :arguments => [ + {"-I\"$\"" => 'COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR'}, + {"-I\"$\"" => 'COLLECTION_PATHS_TEST_TOOLCHAIN_INCLUDE'}, + {"-D$" => 'COLLECTION_DEFINES_TEST_AND_VENDOR'}, + {"-D$" => 'DEFINES_TEST_PREPROCESS'}, + "-DGNU_PREPROCESSOR", + "-MT \"${3}\"", + '-MM', '-MD', '-MG', + "-MF \"${2}\"", + {"$" => 'TEST_DEPENDENCIES_GENERATOR_ARGUMENTS'}, + "-c \"${1}\"", + ] + } + +DEFAULT_RELEASE_DEPENDENCIES_GENERATOR_TOOL = { + :executable => FilePathUtils.os_executable_ext('gcc'), + :name => 'default_release_dependencies_generator', + :stderr_redirect => StdErrRedirect::NONE, + :arguments => [ + {"-I\"$\"" => 'COLLECTION_PATHS_SOURCE_AND_INCLUDE'}, + {"-I\"$\"" => 'COLLECTION_PATHS_RELEASE_TOOLCHAIN_INCLUDE'}, + {"-D$" => 'COLLECTION_DEFINES_RELEASE_AND_VENDOR'}, + {"-D$" => 'DEFINES_RELEASE_PREPROCESS'}, + "-DGNU_PREPROCESSOR", + "-MT \"${3}\"", + '-MM', '-MD', '-MG', + "-MF \"${2}\"", + {"$" => 'RELEASE_DEPENDENCIES_GENERATOR_ARGUMENTS'}, + "-c \"${1}\"", + ] + } + + +DEFAULT_RELEASE_COMPILER_TOOL = { + :executable => FilePathUtils.os_executable_ext('gcc'), + :name => 'default_release_compiler', + :stderr_redirect => StdErrRedirect::NONE, + :arguments => [ + {"-I\"$\"" => 'COLLECTION_PATHS_SOURCE_INCLUDE_VENDOR'}, + {"-I\"$\"" => 'COLLECTION_PATHS_RELEASE_TOOLCHAIN_INCLUDE'}, + {"-D$" => 'COLLECTION_DEFINES_RELEASE_AND_VENDOR'}, + "-DGNU_COMPILER", + {"$" => 'RELEASE_COMPILER_ARGUMENTS'}, + "-c \"${1}\"", + "-o \"${2}\"", + ] + } + +DEFAULT_RELEASE_ASSEMBLER_TOOL = { + :executable => FilePathUtils.os_executable_ext('as'), + :name => 'default_release_assembler', + :stderr_redirect => StdErrRedirect::NONE, + :arguments => [ + {"-I\"$\"" => 'COLLECTION_PATHS_SOURCE_AND_INCLUDE'}, + {"$" => 'RELEASE_ASSEMBLER_ARGUMENTS'}, + "\"${1}\"", + "-o \"${2}\"", + ] + } + +DEFAULT_RELEASE_LINKER_TOOL = { + :executable => FilePathUtils.os_executable_ext('gcc'), + :name => 'default_release_linker', + :stderr_redirect => StdErrRedirect::NONE, + :arguments => [ + {"$" => 'RELEASE_LINKER_ARGUMENTS'}, + "\"${1}\"", + "-o \"${2}\"", + ] + } + + +DEFAULT_TOOLS_TEST = { + :tools => { + :test_compiler => DEFAULT_TEST_COMPILER_TOOL, + :test_linker => DEFAULT_TEST_LINKER_TOOL, + :test_fixture => DEFAULT_TEST_FIXTURE_TOOL, + } + } + +DEFAULT_TOOLS_TEST_PREPROCESSORS = { + :tools => { + :test_includes_preprocessor => DEFAULT_TEST_INCLUDES_PREPROCESSOR_TOOL, + :test_file_preprocessor => DEFAULT_TEST_FILE_PREPROCESSOR_TOOL, + } + } + +DEFAULT_TOOLS_TEST_DEPENDENCIES = { + :tools => { + :test_dependencies_generator => DEFAULT_TEST_DEPENDENCIES_GENERATOR_TOOL, + } + } + + +DEFAULT_TOOLS_RELEASE = { + :tools => { + :release_compiler => DEFAULT_RELEASE_COMPILER_TOOL, + :release_linker => DEFAULT_RELEASE_LINKER_TOOL, + } + } + +DEFAULT_TOOLS_RELEASE_ASSEMBLER = { + :tools => { + :release_assembler => DEFAULT_RELEASE_ASSEMBLER_TOOL, + } + } + +DEFAULT_TOOLS_RELEASE_DEPENDENCIES = { + :tools => { + :release_dependencies_generator => DEFAULT_RELEASE_DEPENDENCIES_GENERATOR_TOOL, + } + } + + +DEFAULT_RELEASE_TARGET_NAME = 'project' + +DEFAULT_CEEDLING_CONFIG = { + :project => { + # :build_root must be set by user + :use_exceptions => true, + :use_mocks => true, + :use_test_preprocessor => false, + :use_auxiliary_dependencies => false, + :test_file_prefix => 'test_', + :options_paths => [], + :release_build => false, + }, + + :release_build => { + # :output is set while building configuration -- allows smart default system-dependent file extension handling + :use_assembly => false, + }, + + :paths => { + :test => [], # must be populated by user + :source => [], # must be populated by user + :support => [], + :include => [], + :test_toolchain_include => [], + :release_toolchain_include => [], + }, + + # unlike other top-level entries, environment's value is an array to preserve order + :environment => [ + # when evaluated, this provides wider text field for rake task comments + {:rake_columns => '120'}, + ], + + :defines => { + :test => [], + :test_preprocess => [], + :release => [], + :release_preprocess => [], + }, + + :extension => { + :header => '.h', + :source => '.c', + :assembly => '.s', + :object => '.o', + :executable => ( SystemWrapper.is_windows? ? '.exe' : '.out' ), + :testpass => '.pass', + :testfail => '.fail', + :dependencies => '.d', + }, + + :unity => { + :defines => [] + }, + + :cmock => { + :defines => [] + }, + + :cexception => { + :defines => [] + }, + + :test_runner => { + :includes => [], + :file_suffix => '_runner', + }, + + # all tools populated while building up config structure + :tools => {}, + + # empty argument lists for default tools + # (these can be overridden in project file to add arguments to tools without totally redefining tools) + :test_compiler => { :arguments => [] }, + :test_linker => { :arguments => [] }, + :test_fixture => { + :arguments => [], + :link_objects => [], # compiled object files to always be linked in (e.g. cmock.o if using mocks) + }, + :test_includes_preprocessor => { :arguments => [] }, + :test_file_preprocessor => { :arguments => [] }, + :test_dependencies_generator => { :arguments => [] }, + :release_compiler => { :arguments => [] }, + :release_linker => { :arguments => [] }, + :release_assembler => { :arguments => [] }, + :release_dependencies_generator => { :arguments => [] }, + + :plugins => { + :load_paths => [], + :enabled => [], + } + } + + +DEFAULT_TESTS_RESULTS_REPORT_TEMPLATE = %q{ +% ignored = hash[:results][:counts][:ignored] +% failed = hash[:results][:counts][:failed] +% stdout_count = hash[:results][:counts][:stdout] +% header_prepend = ((hash[:header].length > 0) ? "#{hash[:header]}: " : '') +% banner_width = 25 + header_prepend.length # widest message + +% if (ignored > 0) +<%=@ceedling[:plugin_reportinator].generate_banner(header_prepend + 'IGNORED UNIT TEST SUMMARY')%> +% hash[:results][:ignores].each do |ignore| +% ignore[:collection].each do |item| +<%=ignore[:source][:path]%><%=File::SEPARATOR%><%=ignore[:source][:file]%>:<%=item[:line]%>:<%=item[:test]%> +% if (item[:message].length > 0) +: "<%=item[:message]%>" +% else +<%="\n"%> +% end +% end +% end + +% end +% if (failed > 0) +<%=@ceedling[:plugin_reportinator].generate_banner(header_prepend + 'FAILED UNIT TEST SUMMARY')%> +% hash[:results][:failures].each do |failure| +% failure[:collection].each do |item| +<%=failure[:source][:path]%><%=File::SEPARATOR%><%=failure[:source][:file]%>:<%=item[:line]%>:<%=item[:test]%> +% if (item[:message].length > 0) +: "<%=item[:message]%>" +% else +<%="\n"%> +% end +% end +% end + +% end +% if (stdout_count > 0) +<%=@ceedling[:plugin_reportinator].generate_banner(header_prepend + 'UNIT TEST OTHER OUTPUT')%> +% hash[:results][:stdout].each do |string| +% string[:collection].each do |item| +<%=string[:source][:path]%><%=File::SEPARATOR%><%=string[:source][:file]%>: "<%=item%>" +% end +% end + +% end +% total_string = hash[:results][:counts][:total].to_s +% format_string = "%#{total_string.length}i" +<%=@ceedling[:plugin_reportinator].generate_banner(header_prepend + 'OVERALL UNIT TEST SUMMARY')%> +% if (hash[:results][:counts][:total] > 0) +TESTED: <%=hash[:results][:counts][:total].to_s%> +PASSED: <%=sprintf(format_string, hash[:results][:counts][:passed])%> +FAILED: <%=sprintf(format_string, failed)%> +IGNORED: <%=sprintf(format_string, ignored)%> +% else + +No tests executed. +% end + +} diff --git a/flex-bison/clcalc/tools/ceedling/lib/dependinator.rb b/flex-bison/clcalc/tools/ceedling/lib/dependinator.rb new file mode 100644 index 0000000..061caee --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/dependinator.rb @@ -0,0 +1,92 @@ + +class Dependinator + + constructor :configurator, :project_config_manager, :test_includes_extractor, :file_path_utils, :rake_wrapper, :file_wrapper + + def touch_force_rebuild_files + @file_wrapper.touch( @configurator.project_test_force_rebuild_filepath ) + @file_wrapper.touch( @configurator.project_release_force_rebuild_filepath ) if (@configurator.project_release_build) + end + + + + def load_release_object_deep_dependencies(dependencies_list) + dependencies_list.each { |dependencies_file| @rake_wrapper.load_dependencies( dependencies_file ) } + end + + + def enhance_release_file_dependencies(files) + files.each do |filepath| + @rake_wrapper[filepath].enhance( [@configurator.project_release_force_rebuild_filepath] ) if (@project_config_manager.release_config_changed) + @rake_wrapper[filepath].enhance( [@configurator.ceedling_build_info_filepath] ) + end + end + + + + def load_test_object_deep_dependencies(files_list) + dependencies_list = @file_path_utils.form_test_dependencies_filelist(files_list) + dependencies_list.each { |dependencies_file| @rake_wrapper.load_dependencies(dependencies_file) } + end + + + def enhance_runner_dependencies(runner_filepath) + @rake_wrapper[runner_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed) + @rake_wrapper[runner_filepath].enhance( [@configurator.ceedling_build_info_filepath] ) + end + + + def enhance_shallow_include_lists_dependencies(include_lists) + include_lists.each do |include_list_filepath| + @rake_wrapper[include_list_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed) + @rake_wrapper[include_list_filepath].enhance( [@configurator.ceedling_build_info_filepath] ) + end + end + + + def enhance_preprocesed_file_dependencies(files) + files.each do |filepath| + @rake_wrapper[filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed) + @rake_wrapper[filepath].enhance( [@configurator.ceedling_build_info_filepath] ) + end + end + + + def enhance_mock_dependencies(mocks_list) + # if input configuration or ceedling changes, make sure these guys get rebuilt + mocks_list.each do |mock_filepath| + @rake_wrapper[mock_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed) + @rake_wrapper[mock_filepath].enhance( [@configurator.cmock_unity_helper] ) if (@configurator.cmock_unity_helper) + @rake_wrapper[mock_filepath].enhance( [@configurator.ceedling_build_info_filepath] ) + @rake_wrapper[mock_filepath].enhance( [@configurator.cmock_build_info_filepath] ) + end + end + + + def enhance_dependencies_dependencies(dependencies) + dependencies.each do |dependencies_filepath| + @rake_wrapper[dependencies_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed) + @rake_wrapper[dependencies_filepath].enhance( [@configurator.ceedling_build_info_filepath] ) + end + end + + + def enhance_test_build_object_dependencies(objects) + objects.each do |object_filepath| + @rake_wrapper[object_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed) + @rake_wrapper[object_filepath].enhance( [@configurator.ceedling_build_info_filepath] ) + end + end + + + def enhance_results_dependencies(result_filepath) + @rake_wrapper[result_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed) + @rake_wrapper[result_filepath].enhance( [@configurator.ceedling_build_info_filepath] ) + end + + + def setup_test_executable_dependencies(test, objects) + @rake_wrapper.create_file_task( @file_path_utils.form_test_executable_filepath(test), objects) + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/lib/file_finder.rb b/flex-bison/clcalc/tools/ceedling/lib/file_finder.rb new file mode 100644 index 0000000..752d6bd --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/file_finder.rb @@ -0,0 +1,132 @@ +require 'rubygems' +require 'rake' # for adding ext() method to string + +class FileFinder + + constructor :configurator, :file_finder_helper, :cacheinator, :file_path_utils, :file_wrapper, :yaml_wrapper + + def prepare_search_sources + @all_test_source_and_header_file_collection = + @configurator.collection_all_tests + + @configurator.collection_all_source + + @configurator.collection_all_headers + end + + + def find_header_file(mock_file) + header = File.basename(mock_file).sub(/#{@configurator.cmock_mock_prefix}/, '').ext(@configurator.extension_header) + + found_path = @file_finder_helper.find_file_in_collection(header, @configurator.collection_all_headers, :error) + + return found_path + end + + + def find_header_input_for_mock_file(mock_file) + found_path = find_header_file(mock_file) + mock_input = found_path + + if (@configurator.project_use_test_preprocessor) + mock_input = @cacheinator.diff_cached_test_file( @file_path_utils.form_preprocessed_file_filepath( found_path ) ) + end + + return mock_input + end + + + def find_source_from_test(test, complain) + test_prefix = @configurator.project_test_file_prefix + source_paths = @configurator.collection_all_source + + source = File.basename(test).sub(/#{test_prefix}/, '') + + # we don't blow up if a test file has no corresponding source file + return @file_finder_helper.find_file_in_collection(source, source_paths, complain) + end + + + def find_test_from_runner_path(runner_path) + extension_source = @configurator.extension_source + + test_file = File.basename(runner_path).sub(/#{@configurator.test_runner_file_suffix}#{'\\'+extension_source}/, extension_source) + + found_path = @file_finder_helper.find_file_in_collection(test_file, @configurator.collection_all_tests, :error) + + return found_path + end + + + def find_test_input_for_runner_file(runner_path) + found_path = find_test_from_runner_path(runner_path) + runner_input = found_path + + if (@configurator.project_use_test_preprocessor) + runner_input = @cacheinator.diff_cached_test_file( @file_path_utils.form_preprocessed_file_filepath( found_path ) ) + end + + return runner_input + end + + + def find_test_from_file_path(file_path) + test_file = File.basename(file_path).ext(@configurator.extension_source) + + found_path = @file_finder_helper.find_file_in_collection(test_file, @configurator.collection_all_tests, :error) + + return found_path + end + + + def find_test_or_source_or_header_file(file_path) + file = File.basename(file_path) + return @file_finder_helper.find_file_in_collection(file, @all_test_source_and_header_file_collection, :error) + end + + + def find_compilation_input_file(file_path) + found_file = '' + + source_file = File.basename(file_path).ext(@configurator.extension_source) + + # We only collect files that already exist when we start up. + # FileLists can produce undesired results for dynamically generated files depending on when they're accessed. + # So collect mocks and runners separately and right now. + if (source_file =~ /#{@configurator.test_runner_file_suffix}/) + found_file = + @file_finder_helper.find_file_in_collection( + source_file, + @file_wrapper.directory_listing( File.join(@configurator.project_test_runners_path, '*') ), + :error) + + elsif (@configurator.project_use_mocks and (source_file =~ /#{@configurator.cmock_mock_prefix}/)) + found_file = + @file_finder_helper.find_file_in_collection( + source_file, + @file_wrapper.directory_listing( File.join(@configurator.cmock_mock_path, '*') ), + :error) + + else + found_file = + @file_finder_helper.find_file_in_collection( + source_file, + @configurator.collection_all_existing_compilation_input, + :error) + end + + return found_file + end + + + def find_source_file(file_path, complain) + source_file = File.basename(file_path).ext(@configurator.extension_source) + return @file_finder_helper.find_file_in_collection(source_file, @configurator.collection_all_source, complain) + end + + + def find_assembly_file(file_path) + assembly_file = File.basename(file_path).ext(@configurator.extension_assembly) + return @file_finder_helper.find_file_in_collection(assembly_file, @configurator.collection_all_assembly, :error) + end + +end + diff --git a/flex-bison/clcalc/tools/ceedling/lib/file_finder_helper.rb b/flex-bison/clcalc/tools/ceedling/lib/file_finder_helper.rb new file mode 100644 index 0000000..487f0fe --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/file_finder_helper.rb @@ -0,0 +1,54 @@ +require 'fileutils' +require 'constants' # for Verbosity enumeration + +class FileFinderHelper + + constructor :streaminator + + + def find_file_in_collection(file_name, file_list, complain, extra_message="") + file_to_find = nil + + file_list.each do |item| + base_file = File.basename(item) + + # case insensitive comparison + if (base_file.casecmp(file_name) == 0) + # case sensitive check + if (base_file == file_name) + file_to_find = item + break + else + blow_up(file_name, "However, a filename having different capitalization was found: '#{item}'.") + end + end + + end + + case (complain) + when :error then blow_up(file_name, extra_message) if (file_to_find.nil?) + when :warn then gripe(file_name, extra_message) if (file_to_find.nil?) + #when :ignore then + end + + return file_to_find + end + + private + + def blow_up(file_name, extra_message="") + error = "ERROR: Found no file '#{file_name}' in search paths." + error += ' ' if (extra_message.length > 0) + @streaminator.stderr_puts(error + extra_message, Verbosity::ERRORS) + raise + end + + def gripe(file_name, extra_message="") + warning = "WARNING: Found no file '#{file_name}' in search paths." + warning += ' ' if (extra_message.length > 0) + @streaminator.stderr_puts(warning + extra_message, Verbosity::COMPLAIN) + end + +end + + diff --git a/flex-bison/clcalc/tools/ceedling/lib/file_path_utils.rb b/flex-bison/clcalc/tools/ceedling/lib/file_path_utils.rb new file mode 100644 index 0000000..cb029f9 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/file_path_utils.rb @@ -0,0 +1,177 @@ +require 'rubygems' +require 'rake' # for ext() +require 'fileutils' +require 'system_wrapper' + +# global utility methods (for plugins, project files, etc.) +def ceedling_form_filepath(destination_path, original_filepath, new_extension=nil) + filename = File.basename(original_filepath) + filename.replace(filename.ext(new_extension)) if (!new_extension.nil?) + return File.join( destination_path.gsub(/\\/, '/'), filename ) +end + +class FilePathUtils + + GLOB_MATCHER = /[\*\?\{\}\[\]]/ + + constructor :configurator, :file_wrapper + + + ######### class methods ########## + + # standardize path to use '/' path separator & begin with './' & have no trailing path separator + def self.standardize(path) + path.strip! + path.gsub!(/\\/, '/') + path.gsub!(/^((\+|-):)?\.\//, '') + path.chomp!('/') + return path + end + + def self.os_executable_ext(executable) + return executable.ext('.exe') if SystemWrapper.is_windows? + return executable + end + + # extract directory path from between optional add/subtract aggregation modifiers and up to glob specifiers + # note: slightly different than File.dirname in that /files/foo remains /files/foo and does not become /files + def self.extract_path(path) + path = path.sub(/^(\+|-):/, '') + + # find first occurrence of path separator followed by directory glob specifier: *, ?, {, }, [, ] + find_index = (path =~ GLOB_MATCHER) + + # no changes needed (lop off final path separator) + return path.chomp('/') if (find_index.nil?) + + # extract up to first glob specifier + path = path[0..(find_index-1)] + + # lop off everything up to and including final path separator + find_index = path.rindex('/') + return path[0..(find_index-1)] if (not find_index.nil?) + + # return string up to first glob specifier if no path separator found + return path + end + + # return whether the given path is to be aggregated (no aggregation modifier defaults to same as +:) + def self.add_path?(path) + return (path =~ /^-:/).nil? + end + + # get path (and glob) lopping off optional +: / -: prefixed aggregation modifiers + def self.extract_path_no_aggregation_operators(path) + return path.sub(/^(\+|-):/, '') + end + + # all the globs that may be in a path string work fine with one exception; + # to recurse through all subdirectories, the glob is dir/**/** but our paths use + # convention of only dir/** + def self.reform_glob(path) + return path if (path =~ /\/\*\*$/).nil? + return path + '/**' + end + + def self.form_ceedling_vendor_path(*filepaths) + return File.join( CEEDLING_VENDOR, filepaths ) + end + + ######### instance methods ########## + + def form_temp_path(filepath, prefix='') + return File.join( @configurator.project_temp_path, prefix + File.basename(filepath) ) + end + + ### release ### + def form_release_build_cache_path(filepath) + return File.join( @configurator.project_release_build_cache_path, File.basename(filepath) ) + end + + def form_release_dependencies_filepath(filepath) + return File.join( @configurator.project_release_dependencies_path, File.basename(filepath).ext(@configurator.extension_dependencies) ) + end + + def form_release_build_c_object_filepath(filepath) + return File.join( @configurator.project_release_build_output_c_path, File.basename(filepath).ext(@configurator.extension_object) ) + end + + def form_release_build_asm_object_filepath(filepath) + return File.join( @configurator.project_release_build_output_asm_path, File.basename(filepath).ext(@configurator.extension_object) ) + end + + def form_release_build_c_objects_filelist(files) + return (@file_wrapper.instantiate_file_list(files)).pathmap("#{@configurator.project_release_build_output_c_path}/%n#{@configurator.extension_object}") + end + + def form_release_build_asm_objects_filelist(files) + return (@file_wrapper.instantiate_file_list(files)).pathmap("#{@configurator.project_release_build_output_asm_path}/%n#{@configurator.extension_object}") + end + + def form_release_dependencies_filelist(files) + return (@file_wrapper.instantiate_file_list(files)).pathmap("#{@configurator.project_release_dependencies_path}/%n#{@configurator.extension_dependencies}") + end + + ### tests ### + def form_test_build_cache_path(filepath) + return File.join( @configurator.project_test_build_cache_path, File.basename(filepath) ) + end + + def form_pass_results_filepath(filepath) + return File.join( @configurator.project_test_results_path, File.basename(filepath).ext(@configurator.extension_testpass) ) + end + + def form_fail_results_filepath(filepath) + return File.join( @configurator.project_test_results_path, File.basename(filepath).ext(@configurator.extension_testfail) ) + end + + def form_runner_filepath_from_test(filepath) + return File.join( @configurator.project_test_runners_path, File.basename(filepath, @configurator.extension_source)) + @configurator.test_runner_file_suffix + @configurator.extension_source + end + + def form_test_filepath_from_runner(filepath) + return filepath.sub(/#{TEST_RUNNER_FILE_SUFFIX}/, '') + end + + def form_runner_object_filepath_from_test(filepath) + return (form_test_build_object_filepath(filepath)).sub(/(#{@configurator.extension_object})$/, "#{@configurator.test_runner_file_suffix}\\1") + end + + def form_test_build_object_filepath(filepath) + return File.join( @configurator.project_test_build_output_path, File.basename(filepath).ext(@configurator.extension_object) ) + end + + def form_test_executable_filepath(filepath) + return File.join( @configurator.project_test_build_output_path, File.basename(filepath).ext(@configurator.extension_executable) ) + end + + def form_preprocessed_file_filepath(filepath) + return File.join( @configurator.project_test_preprocess_files_path, File.basename(filepath) ) + end + + def form_preprocessed_includes_list_filepath(filepath) + return File.join( @configurator.project_test_preprocess_includes_path, File.basename(filepath) ) + end + + def form_test_build_objects_filelist(sources) + return (@file_wrapper.instantiate_file_list(sources)).pathmap("#{@configurator.project_test_build_output_path}/%n#{@configurator.extension_object}") + end + + def form_preprocessed_mockable_headers_filelist(mocks) + # pathmapping note: "%{#{@configurator.cmock_mock_prefix},}n" replaces mock_prefix with nothing (signified by absence of anything after comma inside replacement brackets) + return (@file_wrapper.instantiate_file_list(mocks)).pathmap("#{@configurator.project_test_preprocess_files_path}/%{#{@configurator.cmock_mock_prefix},}n#{@configurator.extension_header}") + end + + def form_mocks_source_filelist(mocks) + return (@file_wrapper.instantiate_file_list(mocks)).pathmap("#{@configurator.cmock_mock_path}/%n#{@configurator.extension_source}") + end + + def form_test_dependencies_filelist(files) + return (@file_wrapper.instantiate_file_list(files)).pathmap("#{@configurator.project_test_dependencies_path}/%n#{@configurator.extension_dependencies}") + end + + def form_pass_results_filelist(path, files) + return (@file_wrapper.instantiate_file_list(files)).pathmap("#{path}/%n#{@configurator.extension_testpass}") + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/lib/file_system_utils.rb b/flex-bison/clcalc/tools/ceedling/lib/file_system_utils.rb new file mode 100644 index 0000000..2c286ca --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/file_system_utils.rb @@ -0,0 +1,59 @@ +require 'rubygems' +require 'rake' +require 'set' +require 'fileutils' +require 'file_path_utils.rb' + + +class FileSystemUtils + + constructor :file_wrapper + + # build up path list from input of one or more strings or arrays of (+/-) paths & globs + def collect_paths(*paths) + raw = [] # all paths and globs + plus = Set.new # all paths to expand and add + minus = Set.new # all paths to remove from plus set + + # assemble all globs and simple paths, reforming our glob notation to ruby globs + paths.each do |paths_container| + case (paths_container) + when String then raw << (FilePathUtils::reform_glob(paths_container)) + when Array then paths_container.each {|path| raw << (FilePathUtils::reform_glob(path))} + else raise "Don't know how to handle #{paths_container.class}" + end + end + + # iterate through each path and glob + raw.each do |path| + + dirs = [] # container for only (expanded) paths + + # if a glob, expand it and slurp up all non-file paths + if path.include?('*') + # grab base directory only if globs are snug up to final path separator + if (path =~ /\/\*+$/) + dirs << FilePathUtils.extract_path(path) + end + + # grab expanded sub-directory globs + expanded = @file_wrapper.directory_listing( FilePathUtils.extract_path_no_aggregation_operators(path) ) + expanded.each do |entry| + dirs << entry if @file_wrapper.directory?(entry) + end + + # else just grab simple path + # note: we could just run this through glob expansion but such an + # approach doesn't handle a path not yet on disk) + else + dirs << FilePathUtils.extract_path_no_aggregation_operators(path) + end + + # add dirs to the appropriate set based on path aggregation modifier if present + FilePathUtils.add_path?(path) ? plus.merge(dirs) : minus.merge(dirs) + end + + return (plus - minus).to_a.uniq + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/lib/file_wrapper.rb b/flex-bison/clcalc/tools/ceedling/lib/file_wrapper.rb new file mode 100644 index 0000000..04e1007 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/file_wrapper.rb @@ -0,0 +1,74 @@ +require 'rubygems' +require 'rake' # for FileList +require 'constants' +require 'fileutils' + + +class FileWrapper + + def get_expanded_path(path) + return File.expand_path(path) + end + + def exist?(filepath) + return true if (filepath == NULL_FILE_PATH) + return File.exist?(filepath) + end + + def directory?(path) + return File.directory?(path) + end + + def dirname(path) + return File.dirname(path) + end + + def directory_listing(glob) + return Dir.glob(glob) + end + + def rm_f(filepath, options={}) + FileUtils.rm_f(filepath, options) + end + + def rm_r(filepath, options={}) + FileUtils.rm_r(filepath, options={}) + end + + def cp(source, destination, options={}) + FileUtils.cp(source, destination, options) + end + + def compare(from, to) + return FileUtils.compare_file(from, to) + end + + def open(filepath, flags) + File.open(filepath, flags) do |file| + yield(file) + end + end + + def read(filepath) + return File.read(filepath) + end + + def touch(filepath, options={}) + FileUtils.touch(filepath, options) + end + + def write(filepath, contents, flags='w') + File.open(filepath, flags) do |file| + file.write(contents) + end + end + + def readlines(filepath) + return File.readlines(filepath) + end + + def instantiate_file_list(files=[]) + return FileList.new(files) + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/lib/generator.rb b/flex-bison/clcalc/tools/ceedling/lib/generator.rb new file mode 100644 index 0000000..f620ee4 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/generator.rb @@ -0,0 +1,131 @@ +require 'constants' # for Verbosity constants class + + +class Generator + + constructor :configurator, :preprocessinator, :cmock_builder, :generator_test_runner, :generator_test_results, :test_includes_extractor, :tool_executor, :file_finder, :file_path_utils, :streaminator, :plugin_manager, :file_wrapper + + + def generate_shallow_includes_list(context, file) + @preprocessinator.preprocess_shallow_includes(file) + end + + def generate_preprocessed_file(context, file) + @streaminator.stdout_puts("Preprocessing #{File.basename(file)}...", Verbosity::NORMAL) + @preprocessinator.preprocess_file(file) + end + + def generate_dependencies_file(tool, context, source, object, dependencies) + @streaminator.stdout_puts("Generating dependencies for #{File.basename(source)}...", Verbosity::NORMAL) + + command_line = + @tool_executor.build_command_line( + tool, + source, + dependencies, + object) + + @tool_executor.exec(command_line) + end + + def generate_mock(context, header_filepath) + arg_hash = {:header_file => header_filepath, :context => context} + @plugin_manager.pre_mock_execute(arg_hash) + + @cmock_builder.cmock.setup_mocks( arg_hash[:header_file] ) + + @plugin_manager.post_mock_execute(arg_hash) + end + + # test_filepath may be either preprocessed test file or original test file + def generate_test_runner(context, test_filepath, runner_filepath) + arg_hash = {:context => context, :test_file => test_filepath, :runner_file => runner_filepath} + + @plugin_manager.pre_runner_execute(arg_hash) + + # collect info we need + module_name = File.basename(arg_hash[:test_file]) + test_cases = @generator_test_runner.find_test_cases( @file_finder.find_test_from_runner_path(runner_filepath) ) + mock_list = @test_includes_extractor.lookup_raw_mock_list(arg_hash[:test_file]) + + @streaminator.stdout_puts("Generating runner for #{module_name}...", Verbosity::NORMAL) + + # build runner file + @file_wrapper.open(runner_filepath, 'w') do |output| + @generator_test_runner.create_header(output, mock_list) + @generator_test_runner.create_externs(output, test_cases) + @generator_test_runner.create_mock_management(output, mock_list) + @generator_test_runner.create_runtest(output, mock_list, test_cases) + @generator_test_runner.create_main(output, module_name, test_cases) + end + + @plugin_manager.post_runner_execute(arg_hash) + end + + def generate_object_file(tool, context, source, object) + arg_hash = {:tool => tool, :context => context, :source => source, :object => object} + @plugin_manager.pre_compile_execute(arg_hash) + + @streaminator.stdout_puts("Compiling #{File.basename(arg_hash[:source])}...", Verbosity::NORMAL) + shell_result = @tool_executor.exec( @tool_executor.build_command_line(arg_hash[:tool], arg_hash[:source], arg_hash[:object]) ) + + arg_hash[:shell_result] = shell_result + @plugin_manager.post_compile_execute(arg_hash) + end + + def generate_executable_file(tool, context, objects, executable) + shell_result = {} + arg_hash = {:tool => tool, :context => context, :objects => objects, :executable => executable} + @plugin_manager.pre_link_execute(arg_hash) + + @streaminator.stdout_puts("Linking #{File.basename(arg_hash[:executable])}...", Verbosity::NORMAL) + + begin + shell_result = @tool_executor.exec( @tool_executor.build_command_line(arg_hash[:tool], arg_hash[:objects], arg_hash[:executable]) ) + rescue + notice = "\n" + + "NOTICE: If the linker reports missing symbols, the following may be to blame:\n" + + " 1. Test lacks #include statements corresponding to needed source files.\n" + + " 2. Project search paths do not contain source files corresponding to #include statements in the test.\n" + + if (@configurator.project_use_mocks) + notice += " 3. Test does not #include needed mocks.\n\n" + else + notice += "\n" + end + + @streaminator.stderr_puts(notice, Verbosity::COMPLAIN) + raise + end + + arg_hash[:shell_result] = shell_result + @plugin_manager.post_link_execute(arg_hash) + end + + def generate_test_results(tool, context, executable, result) + arg_hash = {:tool => tool, :context => context, :executable => executable, :result_file => result} + @plugin_manager.pre_test_execute(arg_hash) + + @streaminator.stdout_puts("Running #{File.basename(arg_hash[:executable])}...", Verbosity::NORMAL) + + # Unity's exit code is equivalent to the number of failed tests, so we tell @tool_executor not to fail out if there are failures + # so that we can run all tests and collect all results + shell_result = @tool_executor.exec( @tool_executor.build_command_line(arg_hash[:tool], arg_hash[:executable]), [], {:boom => false} ) + + if (shell_result[:output].nil? or shell_result[:output].strip.empty?) + @streaminator.stderr_puts("ERROR: Test executable \"#{File.basename(executable)}\" did not produce any results.", Verbosity::ERRORS) + raise + end + + processed = @generator_test_results.process_and_write_results( shell_result, + arg_hash[:result_file], + @file_finder.find_test_from_file_path(arg_hash[:executable]) ) + + arg_hash[:result_file] = processed[:result_file] + arg_hash[:results] = processed[:results] + arg_hash[:shell_result] = shell_result # for raw output display if no plugins for formatted display + + @plugin_manager.post_test_execute(arg_hash) + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/lib/generator_test_results.rb b/flex-bison/clcalc/tools/ceedling/lib/generator_test_results.rb new file mode 100644 index 0000000..3ac79e2 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/generator_test_results.rb @@ -0,0 +1,90 @@ +require 'rubygems' +require 'rake' # for .ext() +require 'constants' + + +class GeneratorTestResults + TEST_STATISTICS_REGEX = /-+\s+(\d+)\s+Tests\s+(\d+)\s+Failures\s+(\d+)\s+Ignored\s+(OK|FAIL)\s*/i + + constructor :configurator, :generator_test_results_sanity_checker, :yaml_wrapper + + def process_and_write_results(unity_shell_result, results_file, test_file) + output_file = results_file + + results = get_results_structure + + results[:source][:path] = File.dirname(test_file) + results[:source][:file] = File.basename(test_file) + + # process test statistics + if (unity_shell_result[:output] =~ TEST_STATISTICS_REGEX) + results[:counts][:total] = $1.to_i + results[:counts][:failed] = $2.to_i + results[:counts][:ignored] = $3.to_i + results[:counts][:passed] = (results[:counts][:total] - results[:counts][:failed] - results[:counts][:ignored]) + end + + # remove test statistics lines + unity_shell_result[:output].sub!(TEST_STATISTICS_REGEX, '') + + # bust up the output into individual lines + raw_unity_lines = unity_shell_result[:output].split(/\n|\r\n/) + + raw_unity_lines.each do |line| + # process unity output + case line + when /(:IGNORE)/ + elements = extract_line_elements(line, results[:source][:file]) + results[:ignores] << elements[0] + results[:stdout] << elements[1] if (!elements[1].nil?) + when /(:PASS$)/ + elements = extract_line_elements(line, results[:source][:file]) + results[:successes] << elements[0] + results[:stdout] << elements[1] if (!elements[1].nil?) + when /(:FAIL)/ + elements = extract_line_elements(line, results[:source][:file]) + results[:failures] << elements[0] + results[:stdout] << elements[1] if (!elements[1].nil?) + else # collect up all other + results[:stdout] << line.chomp + end + end + + @generator_test_results_sanity_checker.verify(results, unity_shell_result[:exit_code]) + + output_file = results_file.ext(@configurator.extension_testfail) if (results[:counts][:failed] > 0) + + @yaml_wrapper.dump(output_file, results) + + return { :result_file => output_file, :result => results } + end + + private + + def get_results_structure + return { + :source => {:path => '', :file => ''}, + :successes => [], + :failures => [], + :ignores => [], + :counts => {:total => 0, :passed => 0, :failed => 0, :ignored => 0}, + :stdout => [], + } + end + + def extract_line_elements(line, filename) + # handle anything preceding filename in line as extra output to be collected + stdout = nil + stdout_regex = /(.+)#{Regexp.escape(filename)}.+/i + + if (line =~ stdout_regex) + stdout = $1.clone + line.sub!(/#{Regexp.escape(stdout)}/, '') + end + + # collect up test results minus and extra output + elements = (line.strip.split(':'))[1..-1] + return {:test => elements[1], :line => elements[0].to_i, :message => (elements[3..-1].join(':')).strip}, stdout + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/lib/generator_test_results_sanity_checker.rb b/flex-bison/clcalc/tools/ceedling/lib/generator_test_results_sanity_checker.rb new file mode 100644 index 0000000..9f1b65c --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/generator_test_results_sanity_checker.rb @@ -0,0 +1,62 @@ +require 'constants' +require 'rubygems' +require 'rake' # for ext() method + + +class GeneratorTestResultsSanityChecker + + constructor :configurator, :streaminator + + def verify(results, unity_exit_code) + + # do no sanity checking if it's disabled + return if (@configurator.sanity_checks == TestResultsSanityChecks::NONE) + + ceedling_ignores_count = results[:ignores].size + ceedling_failures_count = results[:failures].size + ceedling_tests_summation = (ceedling_ignores_count + ceedling_failures_count + results[:successes].size) + + # Exit code handling is not a sanity check that can always be performed because + # command line simulators may or may not pass through Unity's exit code + if (@configurator.sanity_checks >= TestResultsSanityChecks::THOROUGH) + # many platforms limit exit codes to a maximum of 255 + if ((ceedling_failures_count != unity_exit_code) and (unity_exit_code < 255)) + sanity_check_warning(results[:source][:file], "Unity's exit code (#{unity_exit_code}) does not match Ceedling's summation of failed test cases (#{ceedling_failures_count}).") + end + + if ((ceedling_failures_count < 255) and (unity_exit_code == 255)) + sanity_check_warning(results[:source][:file], "Ceedling's summation of failed test cases (#{ceedling_failures_count}) is less than Unity's exit code (255 or more).") + end + end + + if (ceedling_ignores_count != results[:counts][:ignored]) + sanity_check_warning(results[:source][:file], "Unity's final ignore count (#{results[:counts][:ignored]}) does not match Ceedling's summation of ignored test cases (#{ceedling_ignores_count}).") + end + + if (ceedling_failures_count != results[:counts][:failed]) + sanity_check_warning(results[:source][:file], "Unity's final fail count (#{results[:counts][:failed]}) does not match Ceedling's summation of failed test cases (#{ceedling_failures_count}).") + end + + if (ceedling_tests_summation != results[:counts][:total]) + sanity_check_warning(results[:source][:file], "Unity's final test count (#{results[:counts][:total]}) does not match Ceedling's summation of all test cases (#{ceedling_tests_summation}).") + end + + end + + private + + def sanity_check_warning(file, message) + notice = "\n" + + "ERROR: Internal sanity check for test fixture '#{file.ext(@configurator.extension_executable)}' finds that #{message}\n" + + " Possible causes:\n" + + " 1. Your test + source dereferenced a null pointer.\n" + + " 2. Your test + source indexed past the end of a buffer.\n" + + " 3. Your test + source committed a memory access violation.\n" + + " 4. Your test fixture produced an exit code of 0 despite execution ending prematurely.\n" + + " Sanity check failures of test results are usually a symptom of interrupted test execution.\n\n" + + @streaminator.stderr_puts( notice ) + raise + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/lib/generator_test_runner.rb b/flex-bison/clcalc/tools/ceedling/lib/generator_test_runner.rb new file mode 100644 index 0000000..361be61 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/generator_test_runner.rb @@ -0,0 +1,206 @@ + +class GeneratorTestRunner + + constructor :configurator, :file_path_utils, :file_wrapper + + + def find_test_cases(test_file) + tests = [] + tests_and_line_numbers = [] + lines = [] + + # if we don't have preprocessor assistance, do some basic preprocessing of our own + if (not @configurator.project_use_test_preprocessor) + source = @file_wrapper.read(test_file) + + # remove line comments + source = source.gsub(/\/\/.*$/, '') + # remove block comments + source = source.gsub(/\/\*.*?\*\//m, '') + + # treat preprocessor directives as a logical line + lines = source.split(/(^\s*\#.*$) | (;|\{|\}) /x) # match ;, {, and } as end of lines + # otherwise, read the preprocessed file raw + else + lines = @file_wrapper.read( @file_path_utils.form_preprocessed_file_filepath(test_file) ).split(/;|\{|\}/) + end + + # step 1. find test functions in (possibly preprocessed) file + # (note that lines are not broken up at end of lines) + lines.each do |line| + if (line =~ /^\s*void\s+((T|t)est.*)\s*\(\s*(void)?\s*\)/m) + tests << ($1.strip) + end + end + + # step 2. associate test functions with line numbers in (non-preprocessed) original file + # (note that this time we must scan file contents broken up by end of lines) + raw_lines = @file_wrapper.read(test_file).split("\n") + raw_index = 0 + + tests.each do |test| + raw_lines[raw_index..-1].each_with_index do |line, index| + # test function might be declared across lines; look for it by its name followed + # by a few tell-tale signs + if (line =~ /#{test}\s*($|\(|\()/) + raw_index += (index + 1) + tests_and_line_numbers << {:test => test, :line_number => raw_index} + break + end + end + end + + return tests_and_line_numbers + end + + + def create_header(output, mock_list) + output << "/* AUTOGENERATED FILE. DO NOT EDIT. */\n" + output << "#include \"unity.h\"\n" + + @configurator.test_runner_includes.each do |include| + output << "#include \"#{include}\"\n" + end + + output << "#include \n" + output << "#include \n" + + if (@configurator.project_use_exceptions == true) + output << "#include \"CException.h\"\n" + end + + unless (mock_list.empty?) + header_extension = @configurator.extension_header + mock_list.each do |mock| + output << "#include \"#{mock}#{header_extension}\"\n" + end + if (@configurator.cmock_enforce_strict_ordering == true) + output << "\n" + output << "int GlobalExpectCount;\n" + output << "int GlobalVerifyOrder;\n" + output << "char* GlobalOrderError;\n" + end + end + + output << "\n" + output << "char MessageBuffer[50];\n" + end + + + def create_externs(output, test_cases) + output << "\n" + output << "extern void setUp(void);\n" + output << "extern void tearDown(void);\n" + output << "\n" if not test_cases.empty? + + test_cases.each do |item| + output << "extern void #{item[:test]}(void);\n" + end + end + + + def create_mock_management(output, mock_list) + + unless (mock_list.empty?) + header_extension = @configurator.extension_header + + output << "\n" + output << "static void CMock_Init(void)\n" + output << "{\n" + + if (@configurator.cmock_enforce_strict_ordering == true) + output << " GlobalExpectCount = 0;\n" + output << " GlobalVerifyOrder = 0;\n" + output << " GlobalOrderError = NULL;\n" + end + + mock_list.each do |mock| + output << " #{mock.sub(/#{'\\'+header_extension}/, '')}_Init();\n" + end + output << "}\n" + output << "\n" + + output << "static void CMock_Verify(void)\n" + output << "{\n" + mock_list.each do |mock| + output << " #{mock.sub(/#{'\\'+header_extension}/, '')}_Verify();\n" + end + output << "}\n" + output << "\n" + + output << "static void CMock_Destroy(void)\n" + output << "{\n" + mock_list.each do |mock| + output << " #{mock.sub(/#{'\\'+header_extension}/, '')}_Destroy();\n" + end + output << "}\n" + output << "\n" + + output << "void CMock_VerifyAndReset(void)\n" + output << "{\n" + output << " CMock_Verify();\n" + output << " CMock_Destroy();\n" + output << " CMock_Init();\n" + output << "}\n" + output << "\n" + end + + end + + + def create_runtest(output, mock_list, test_cases) + + unless(test_cases.empty?) + use_exceptions = @configurator.project_use_exceptions + + tab = ' ' # default spacing + tab = ' ' if (use_exceptions) + + output << "\n" + output << "static void TestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum)\n" + output << "{\n" + output << " Unity.CurrentTestName = FuncName;\n" + output << " Unity.CurrentTestLineNumber = FuncLineNum;\n" + output << " Unity.NumberOfTests++;\n" + output << " if (TEST_PROTECT())\n" + output << " {\n" + output << " CEXCEPTION_T e;\n" if use_exceptions + output << " Try {\n" if use_exceptions + output << "#{tab}CMock_Init();\n" unless (mock_list.empty?) + output << "#{tab}setUp();\n" + output << "#{tab}Func();\n" + output << "#{tab}CMock_Verify();\n" unless (mock_list.empty?) + output << " } Catch(e) { TEST_FAIL_MESSAGE(\"Unhandled Exception!\"); }\n" if use_exceptions + output << " }\n" + output << " CMock_Destroy();\n" unless (mock_list.empty?) + output << " if (TEST_PROTECT() && !(Unity.CurrentTestIgnored))\n" + output << " {\n" + output << " tearDown();\n" + output << " }\n" + output << " UnityConcludeTest();\n" + output << "}\n" + end + + end + + + def create_main(output, module_name, test_cases) + output << "\n" + output << "int main(void)\n" + output << "{\n" + output << " UnityBegin();\n" + output << " Unity.TestFile = \"#{module_name}\";\n" + output << "\n" + + output << " // RUN_TEST calls runTest\n" unless (test_cases.empty?) + test_cases.each do |item| + output << " RUN_TEST(#{item[:test]}, #{item[:line_number]});\n" + end + + output << "\n" + output << " return UnityEnd();\n" + output << "}\n" + output << "\n" + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/lib/loginator.rb b/flex-bison/clcalc/tools/ceedling/lib/loginator.rb new file mode 100644 index 0000000..92276e1 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/loginator.rb @@ -0,0 +1,31 @@ + +class Loginator + + constructor :configurator, :project_file_loader, :project_config_manager, :file_wrapper, :system_wrapper + + + def setup_log_filepath + config_files = [] + config_files << @project_file_loader.main_file + config_files << @project_file_loader.user_file + config_files.concat( @project_config_manager.options_files ) + config_files.compact! + config_files.map! { |file| file.ext('') } + + log_name = config_files.join( '_' ) + + @project_log_filepath = File.join( @configurator.project_log_path, log_name.ext('.log') ) + end + + + def log(string, heading=nil) + return if (not @configurator.project_logging) + + output = "\n[#{@system_wrapper.time_now}]" + output += " :: #{heading}" if (not heading.nil?) + output += "\n#{string.strip}\n" + + @file_wrapper.write(@project_log_filepath, output, 'a') + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/lib/makefile.rb b/flex-bison/clcalc/tools/ceedling/lib/makefile.rb new file mode 100644 index 0000000..a1ff9bd --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/makefile.rb @@ -0,0 +1,44 @@ + +# modified version of Rake's provided make-style dependency loader +# customizations: (1) handles windows drives in paths -- colons don't confuse task demarcation (2) handles spaces in directory paths + +module Rake + + # Makefile loader to be used with the import file loader. + class MakefileLoader + + # Load the makefile dependencies in +fn+. + def load(fn) + open(fn) do |mf| + lines = mf.read + lines.gsub!(/#[^\n]*\n/m, "") # remove comments + lines.gsub!(/\\\n/, ' ') # string together line continuations into single line + lines.split("\n").each do |line| + process_line(line) + end + end + end + + private + + # Process one logical line of makefile data. + def process_line(line) + # split on presence of task demaractor followed by space (i.e don't get confused by a colon in a win path) + file_tasks, args = line.split(/:\s/) + + return if args.nil? + + # split at non-escaped space boundary between files (i.e. escaped spaces in paths are left alone) + dependents = args.split(/\b\s+/) + # replace escaped spaces and clean up any extra whitespace + dependents.map! { |path| path.gsub(/\\ /, ' ').strip } + + file_tasks.strip.split.each do |file_task| + file file_task => dependents + end + end + end + + # Install the handler + Rake.application.add_loader('mf', MakefileLoader.new) +end diff --git a/flex-bison/clcalc/tools/ceedling/lib/objects.yml b/flex-bison/clcalc/tools/ceedling/lib/objects.yml new file mode 100644 index 0000000..95a6d9b --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/objects.yml @@ -0,0 +1,278 @@ + +file_wrapper: + +stream_wrapper: + +rake_wrapper: + +yaml_wrapper: + +system_wrapper: + +cmock_builder: + +reportinator: + +rake_utils: + compose: + - rake_wrapper + +file_path_utils: + compose: + - configurator + - file_wrapper + +file_system_utils: + compose: file_wrapper + +project_file_loader: + compose: + - yaml_wrapper + - stream_wrapper + - system_wrapper + - file_wrapper + +project_config_manager: + compose: + - cacheinator + - yaml_wrapper + +cacheinator: + compose: + - cacheinator_helper + - file_path_utils + - file_wrapper + - yaml_wrapper + +cacheinator_helper: + compose: + - file_wrapper + - yaml_wrapper + +tool_executor: + compose: + - configurator + - tool_executor_helper + - streaminator + - system_wrapper + +tool_executor_helper: + compose: + - streaminator + - system_wrapper + +configurator: + compose: + - configurator_setup + - configurator_plugins + - configurator_builder + - cmock_builder + - yaml_wrapper + - system_wrapper + +configurator_setup: + compose: + - configurator_builder + - configurator_validator + +configurator_plugins: + compose: + - stream_wrapper + - file_wrapper + - system_wrapper + +configurator_validator: + compose: + - file_wrapper + - stream_wrapper + - system_wrapper + +configurator_builder: + compose: + - file_system_utils + - file_wrapper + - system_wrapper + +loginator: + compose: + - configurator + - project_file_loader + - project_config_manager + - file_wrapper + - system_wrapper + +streaminator: + compose: + - streaminator_helper + - verbosinator + - loginator + - stream_wrapper + +streaminator_helper: + +setupinator: + +plugin_manager: + compose: + - configurator + - plugin_manager_helper + - streaminator + - reportinator + - system_wrapper + +plugin_manager_helper: + +plugin_reportinator: + compose: + - plugin_reportinator_helper + - plugin_manager + - reportinator + +plugin_reportinator_helper: + compose: + - configurator + - streaminator + - yaml_wrapper + - file_wrapper + +verbosinator: + compose: configurator + +file_finder: + compose: + - configurator + - file_finder_helper + - cacheinator + - file_path_utils + - file_wrapper + - yaml_wrapper + +file_finder_helper: + compose: streaminator + +test_includes_extractor: + compose: + - configurator + - yaml_wrapper + - file_wrapper + +task_invoker: + compose: + - dependinator + - rake_utils + - rake_wrapper + +generator: + compose: + - configurator + - preprocessinator + - cmock_builder + - generator_test_runner + - generator_test_results + - test_includes_extractor + - tool_executor + - file_finder + - file_path_utils + - streaminator + - plugin_manager + - file_wrapper + +generator_test_results: + compose: + - configurator + - generator_test_results_sanity_checker + - yaml_wrapper + +generator_test_results_sanity_checker: + compose: + - configurator + - streaminator + +generator_test_runner: + compose: + - configurator + - file_path_utils + - file_wrapper + +dependinator: + compose: + - configurator + - project_config_manager + - test_includes_extractor + - file_path_utils + - rake_wrapper + - file_wrapper + +preprocessinator: + compose: + - preprocessinator_helper + - preprocessinator_includes_handler + - preprocessinator_file_handler + - task_invoker + - file_path_utils + - yaml_wrapper + +preprocessinator_helper: + compose: + - configurator + - test_includes_extractor + - task_invoker + - file_finder + - file_path_utils + +preprocessinator_includes_handler: + compose: + - configurator + - tool_executor + - task_invoker + - file_path_utils + - yaml_wrapper + - file_wrapper + +preprocessinator_file_handler: + compose: + - preprocessinator_extractor + - configurator + - tool_executor + - file_path_utils + - file_wrapper + +preprocessinator_extractor: + compose: + - file_wrapper + +test_invoker: + compose: + - configurator + - test_invoker_helper + - streaminator + - preprocessinator + - task_invoker + - dependinator + - project_config_manager + - file_path_utils + +test_invoker_helper: + compose: + - configurator + - task_invoker + - dependinator + - test_includes_extractor + - file_finder + - file_path_utils + - streaminator + - file_wrapper + +release_invoker: + compose: + - release_invoker_helper + - configurator + - dependinator + - task_invoker + - file_path_utils + +release_invoker_helper: + compose: + - configurator + - dependinator + - task_invoker diff --git a/flex-bison/clcalc/tools/ceedling/lib/plugin.rb b/flex-bison/clcalc/tools/ceedling/lib/plugin.rb new file mode 100644 index 0000000..a412555 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/plugin.rb @@ -0,0 +1,63 @@ + +class String + def left_margin(margin=0) + non_whitespace_column = 0 + new_lines = [] + + # find first line with non-whitespace and count left columns of whitespace + self.each_line do |line| + if (line =~ /^\s*\S/) + non_whitespace_column = $&.length - 1 + break + end + end + + # iterate through each line, chopping off leftmost whitespace columns and add back the desired whitespace margin + self.each_line do |line| + columns = [] + margin.times{columns << ' '} + # handle special case of line being narrower than width to be lopped off + if (non_whitespace_column < line.length) + new_lines << "#{columns.join}#{line[non_whitespace_column..-1]}" + else + new_lines << "\n" + end + end + + return new_lines.join + end +end + +class Plugin + attr_reader :name + + def initialize(system_objects, name) + @ceedling = system_objects + @name = name + self.setup + end + + def setup; end + + def pre_build; end + + def pre_mock_execute(arg_hash); end + def post_mock_execute(arg_hash); end + + def pre_runner_execute(arg_hash); end + def post_runner_execute(arg_hash); end + + def pre_compile_execute(arg_hash); end + def post_compile_execute(arg_hash); end + + def pre_link_execute(arg_hash); end + def post_link_execute(arg_hash); end + + def pre_test_execute(arg_hash); end + def post_test_execute(arg_hash); end + + def post_build; end + + def summary; end + +end diff --git a/flex-bison/clcalc/tools/ceedling/lib/plugin_manager.rb b/flex-bison/clcalc/tools/ceedling/lib/plugin_manager.rb new file mode 100644 index 0000000..0ec22ec --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/plugin_manager.rb @@ -0,0 +1,85 @@ +require 'constants' +require 'set' + +class PluginManager + + constructor :configurator, :plugin_manager_helper, :streaminator, :reportinator, :system_wrapper + + def setup + @build_fail_registry = [] + @plugin_objects = [] # so we can preserve order + end + + def load_plugin_scripts(script_plugins, system_objects) + script_plugins.each do |plugin| + # protect against instantiating object multiple times due to processing config multiple times (options, etc) + next if (@plugin_manager_helper.include?(@plugin_objects, plugin)) + @system_wrapper.require_file( "#{plugin}.rb" ) + object = @plugin_manager_helper.instantiate_plugin_script( camelize(plugin), system_objects, plugin ) + @plugin_objects << object + + # add plugins to hash of all system objects + system_objects[plugin.downcase.to_sym] = object + end + end + + def plugins_failed? + return (@build_fail_registry.size > 0) + end + + def print_plugin_failures + if (@build_fail_registry.size > 0) + report = @reportinator.generate_banner('BUILD FAILURE SUMMARY') + + @build_fail_registry.each do |failure| + report += "#{' - ' if (@build_fail_registry.size > 1)}#{failure}\n" + end + + report += "\n" + + @streaminator.stderr_puts(report, Verbosity::ERRORS) + end + end + + def register_build_failure(message) + @build_fail_registry << message if (message and not message.empty?) + end + + #### execute all plugin methods #### + + def pre_build; execute_plugins(:pre_build); end + + def pre_mock_execute(arg_hash); execute_plugins(:pre_mock_execute, arg_hash); end + def post_mock_execute(arg_hash); execute_plugins(:post_mock_execute, arg_hash); end + + def pre_runner_execute(arg_hash); execute_plugins(:pre_runner_execute, arg_hash); end + def post_runner_execute(arg_hash); execute_plugins(:post_runner_execute, arg_hash); end + + def pre_compile_execute(arg_hash); execute_plugins(:pre_compile_execute, arg_hash); end + def post_compile_execute(arg_hash); execute_plugins(:post_compile_execute, arg_hash); end + + def pre_link_execute(arg_hash); execute_plugins(:pre_link_execute, arg_hash); end + def post_link_execute(arg_hash); execute_plugins(:post_link_execute, arg_hash); end + + def pre_test_execute(arg_hash); execute_plugins(:pre_test_execute, arg_hash); end + def post_test_execute(arg_hash) + # special arbitration: raw test results are printed or taken over by plugins handling the job + @streaminator.stdout_puts(arg_hash[:shell_result][:output]) if (@configurator.plugins_display_raw_test_results) + execute_plugins(:post_test_execute, arg_hash) + end + + def post_build; execute_plugins(:post_build); end + + def summary; execute_plugins(:summary); end + + private #################################### + + def camelize(underscored_name) + return underscored_name.gsub(/(_|^)([a-z0-9])/) {$2.upcase} + end + + def execute_plugins(method, *args) + @plugin_objects.each {|plugin| plugin.send(method, *args) } + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/lib/plugin_manager_helper.rb b/flex-bison/clcalc/tools/ceedling/lib/plugin_manager_helper.rb new file mode 100644 index 0000000..b18248a --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/plugin_manager_helper.rb @@ -0,0 +1,19 @@ + +class PluginManagerHelper + + def include?(plugins, name) + include = false + plugins.each do |plugin| + if (plugin.name == name) + include = true + break + end + end + return include + end + + def instantiate_plugin_script(plugin, system_objects, name) + return eval("#{plugin}.new(system_objects, name)") + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/lib/plugin_reportinator.rb b/flex-bison/clcalc/tools/ceedling/lib/plugin_reportinator.rb new file mode 100644 index 0000000..b08801a --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/plugin_reportinator.rb @@ -0,0 +1,75 @@ +require 'constants' +require 'defaults' + +class PluginReportinator + + constructor :plugin_reportinator_helper, :plugin_manager, :reportinator + + def setup + @test_results_template = nil + end + + + def set_system_objects(system_objects) + @plugin_reportinator_helper.ceedling = system_objects + end + + + def fetch_results(results_path, test, options={:boom => false}) + return @plugin_reportinator_helper.fetch_results( File.join(results_path, test), options ) + end + + + def generate_banner(message) + return @reportinator.generate_banner(message) + end + + + def assemble_test_results(results_list, options={:boom => false}) + aggregated_results = get_results_structure + + results_list.each do |result_path| + results = @plugin_reportinator_helper.fetch_results( result_path, options ) + @plugin_reportinator_helper.process_results(aggregated_results, results) + end + + return aggregated_results + end + + + def register_test_results_template(template) + @test_results_template = template if (@test_results_template.nil?) + end + + + def run_test_results_report(hash, verbosity=Verbosity::NORMAL, &block) + run_report( $stdout, + ((@test_results_template.nil?) ? DEFAULT_TESTS_RESULTS_REPORT_TEMPLATE : @test_results_template), + hash, + verbosity, + &block ) + end + + + def run_report(stream, template, hash=nil, verbosity=Verbosity::NORMAL) + failure = nil + failure = yield() if block_given? + + @plugin_manager.register_build_failure( failure ) + + @plugin_reportinator_helper.run_report( stream, template, hash, verbosity ) + end + + private ############################### + + def get_results_structure + return { + :successes => [], + :failures => [], + :ignores => [], + :stdout => [], + :counts => {:total => 0, :passed => 0, :failed => 0, :ignored => 0, :stdout => 0} + } + end + +end \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/lib/plugin_reportinator_helper.rb b/flex-bison/clcalc/tools/ceedling/lib/plugin_reportinator_helper.rb new file mode 100644 index 0000000..c30a833 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/plugin_reportinator_helper.rb @@ -0,0 +1,52 @@ +require 'constants' +require 'erb' +require 'rubygems' +require 'rake' # for ext() + + +class PluginReportinatorHelper + + attr_writer :ceedling + + constructor :configurator, :streaminator, :yaml_wrapper, :file_wrapper + + def fetch_results(results_path, options) + pass_path = File.join(results_path.ext( @configurator.extension_testpass )) + fail_path = File.join(results_path.ext( @configurator.extension_testfail )) + + if (@file_wrapper.exist?(fail_path)) + return @yaml_wrapper.load(fail_path) + elsif (@file_wrapper.exist?(pass_path)) + return @yaml_wrapper.load(pass_path) + else + if (options[:boom]) + @streaminator.stderr_puts("Could find no test results for '#{File.basename(results_path).ext(@configurator.extension_source)}'", Verbosity::ERRORS) + raise + end + end + + return {} + end + + + def process_results(aggregate_results, results) + return if (results.empty?) + + aggregate_results[:successes] << { :source => results[:source].clone, :collection => results[:successes].clone } if (results[:successes].size > 0) + aggregate_results[:failures] << { :source => results[:source].clone, :collection => results[:failures].clone } if (results[:failures].size > 0) + aggregate_results[:ignores] << { :source => results[:source].clone, :collection => results[:ignores].clone } if (results[:ignores].size > 0) + aggregate_results[:stdout] << { :source => results[:source].clone, :collection => results[:stdout].clone } if (results[:stdout].size > 0) + aggregate_results[:counts][:total] += results[:counts][:total] + aggregate_results[:counts][:passed] += results[:counts][:passed] + aggregate_results[:counts][:failed] += results[:counts][:failed] + aggregate_results[:counts][:ignored] += results[:counts][:ignored] + aggregate_results[:counts][:stdout] += results[:stdout].size + end + + + def run_report(stream, template, hash, verbosity) + output = ERB.new(template, 0, "%<>") + @streaminator.stream_puts(stream, output.result(binding()), verbosity) + end + +end \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/lib/preprocessinator.rb b/flex-bison/clcalc/tools/ceedling/lib/preprocessinator.rb new file mode 100644 index 0000000..e5c46c3 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/preprocessinator.rb @@ -0,0 +1,43 @@ + +class Preprocessinator + + attr_reader :preprocess_file_proc + + constructor :preprocessinator_helper, :preprocessinator_includes_handler, :preprocessinator_file_handler, :task_invoker, :file_path_utils, :yaml_wrapper + + + def setup + # fashion ourselves callbacks @preprocessinator_helper can use + @preprocess_includes_proc = Proc.new { |filepath| self.preprocess_shallow_includes(filepath) } + @preprocess_file_proc = Proc.new { |filepath| self.preprocess_file(filepath) } + end + + + def preprocess_test_and_invoke_test_mocks(test) + @preprocessinator_helper.preprocess_includes(test, @preprocess_includes_proc) + + mocks_list = @preprocessinator_helper.assemble_mocks_list(test) + + @preprocessinator_helper.preprocess_mockable_headers(mocks_list, @preprocess_file_proc) + + @task_invoker.invoke_test_mocks(mocks_list) + + @preprocessinator_helper.preprocess_test_file(test, @preprocess_file_proc) + + return mocks_list + end + + def preprocess_shallow_includes(filepath) + dependencies_rule = @preprocessinator_includes_handler.form_shallow_dependencies_rule(filepath) + includes = @preprocessinator_includes_handler.extract_shallow_includes(dependencies_rule) + + @preprocessinator_includes_handler.write_shallow_includes_list( + @file_path_utils.form_preprocessed_includes_list_filepath(filepath), includes) + end + + def preprocess_file(filepath) + @preprocessinator_includes_handler.invoke_shallow_includes_list(filepath) + @preprocessinator_file_handler.preprocess_file( filepath, @yaml_wrapper.load(@file_path_utils.form_preprocessed_includes_list_filepath(filepath)) ) + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/lib/preprocessinator_extractor.rb b/flex-bison/clcalc/tools/ceedling/lib/preprocessinator_extractor.rb new file mode 100644 index 0000000..947d5af --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/preprocessinator_extractor.rb @@ -0,0 +1,27 @@ + + +class PreprocessinatorExtractor + + constructor :file_wrapper + + # extract from cpp-processed file only content of file we care about + def extract_base_file_from_preprocessed_expansion(filepath) + contents = [] + extract = false + + @file_wrapper.readlines(filepath).each do |line| + if (extract) + if (line =~ /^#/) + extract = false + else + contents << line + end + end + # extract = true if (line =~ /^#.*#{Regexp.escape(File.basename(filepath))}/) + extract = true if (line =~ /^#.*(\s|\/|\\|\")#{Regexp.escape(File.basename(filepath))}/) + end + + return contents + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/lib/preprocessinator_file_handler.rb b/flex-bison/clcalc/tools/ceedling/lib/preprocessinator_file_handler.rb new file mode 100644 index 0000000..cc84e7f --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/preprocessinator_file_handler.rb @@ -0,0 +1,21 @@ + + +class PreprocessinatorFileHandler + + constructor :preprocessinator_extractor, :configurator, :tool_executor, :file_path_utils, :file_wrapper + + + def preprocess_file(filepath, includes) + preprocessed_filepath = @file_path_utils.form_preprocessed_file_filepath(filepath) + + command_line = @tool_executor.build_command_line(@configurator.tools_test_file_preprocessor, filepath, preprocessed_filepath) + @tool_executor.exec(command_line) + + contents = @preprocessinator_extractor.extract_base_file_from_preprocessed_expansion(preprocessed_filepath) + + includes.each{|include| contents.unshift("#include \"#{include}\"")} + + @file_wrapper.write(preprocessed_filepath, contents.join("\n")) + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/lib/preprocessinator_helper.rb b/flex-bison/clcalc/tools/ceedling/lib/preprocessinator_helper.rb new file mode 100644 index 0000000..6175637 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/preprocessinator_helper.rb @@ -0,0 +1,46 @@ + + +class PreprocessinatorHelper + + constructor :configurator, :test_includes_extractor, :task_invoker, :file_finder, :file_path_utils + + + def preprocess_includes(test, preprocess_includes_proc) + if (@configurator.project_use_test_preprocessor) + preprocessed_includes_list = @file_path_utils.form_preprocessed_includes_list_filepath(test) + preprocess_includes_proc.call( @file_finder.find_test_from_file_path(preprocessed_includes_list) ) + @test_includes_extractor.parse_includes_list(preprocessed_includes_list) + else + @test_includes_extractor.parse_test_file(test) + end + end + + def assemble_mocks_list(test) + return @file_path_utils.form_mocks_source_filelist( @test_includes_extractor.lookup_raw_mock_list(test) ) + end + + def preprocess_mockable_headers(mock_list, preprocess_file_proc) + if (@configurator.project_use_test_preprocessor) + preprocess_files_smartly( + @file_path_utils.form_preprocessed_mockable_headers_filelist(mock_list), + preprocess_file_proc ) { |file| @file_finder.find_header_file(file) } + end + end + + def preprocess_test_file(test, preprocess_file_proc) + return if (!@configurator.project_use_test_preprocessor) + + preprocess_file_proc.call(test) + end + + private ############################ + + def preprocess_files_smartly(file_list, preprocess_file_proc) + if (@configurator.project_use_auxiliary_dependencies) + @task_invoker.invoke_test_preprocessed_files(file_list) + else + file_list.each { |file| preprocess_file_proc.call( yield(file) ) } + end + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/lib/preprocessinator_includes_handler.rb b/flex-bison/clcalc/tools/ceedling/lib/preprocessinator_includes_handler.rb new file mode 100644 index 0000000..3cca916 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/preprocessinator_includes_handler.rb @@ -0,0 +1,55 @@ + + +class PreprocessinatorIncludesHandler + + constructor :configurator, :tool_executor, :task_invoker, :file_path_utils, :yaml_wrapper, :file_wrapper + + # shallow includes: only those headers a source file explicitly includes + + def invoke_shallow_includes_list(filepath) + @task_invoker.invoke_test_shallow_include_lists( [@file_path_utils.form_preprocessed_includes_list_filepath(filepath)] ) + end + + # ask the preprocessor for a make-style dependency rule of only the headers the source file immediately includes + def form_shallow_dependencies_rule(filepath) + # change filename (prefix of '_') to prevent preprocessor from finding include files in temp directory containing file it's scanning + temp_filepath = @file_path_utils.form_temp_path(filepath, '_') + + # read the file and replace all include statements with a decorated version + # (decorating the names creates file names that don't exist, thus preventing the preprocessor + # from snaking out and discovering the entire include path that winds through the code) + contents = @file_wrapper.read(filepath) + contents.gsub!( /#include\s+\"\s*(\S+)\s*\"/, "#include \"\\1\"\n#include \"@@@@\\1\"" ) + @file_wrapper.write( temp_filepath, contents ) + + # extract the make-style dependency rule telling the preprocessor to + # ignore the fact that it can't find the included files + command_line = @tool_executor.build_command_line(@configurator.tools_test_includes_preprocessor, temp_filepath) + shell_result = @tool_executor.exec(command_line) + + return shell_result[:output] + end + + # headers only; ignore any crazy .c includes + def extract_shallow_includes(make_rule) + list = [] + header_extension = @configurator.extension_header + + headers = make_rule.scan(/(\S+#{'\\'+header_extension})/).flatten # escape slashes before dot file extension + headers.uniq! + headers.map! { |header| header.sub(/(@@@@)|(.+\/)/, '') } + headers.sort! + + headers.each_with_index do |header, index| + break if (headers.size == (index-1)) + list << header if (header == headers[index + 1]) + end + + return list + end + + def write_shallow_includes_list(filepath, list) + @yaml_wrapper.dump(filepath, list) + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/lib/project_config_manager.rb b/flex-bison/clcalc/tools/ceedling/lib/project_config_manager.rb new file mode 100644 index 0000000..3599689 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/project_config_manager.rb @@ -0,0 +1,38 @@ +require 'constants' + + +class ProjectConfigManager + + attr_reader :options_files, :release_config_changed, :test_config_changed + attr_accessor :config_hash + + constructor :cacheinator, :yaml_wrapper + + + def setup + @options_files = [] + @release_config_changed = false + @test_config_changed = false + end + + + def merge_options(config_hash, option_filepath) + @options_files << File.basename( option_filepath ) + config_hash.deep_merge( @yaml_wrapper.load( option_filepath ) ) + return config_hash + end + + + + def process_release_config_change + # has project configuration changed since last release build + @release_config_changed = @cacheinator.diff_cached_release_config?( @config_hash ) + end + + + def process_test_config_change + # has project configuration changed since last test build + @test_config_changed = @cacheinator.diff_cached_test_config?( @config_hash ) + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/lib/project_file_loader.rb b/flex-bison/clcalc/tools/ceedling/lib/project_file_loader.rb new file mode 100644 index 0000000..182d23a --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/project_file_loader.rb @@ -0,0 +1,64 @@ +require 'constants' + + +class ProjectFileLoader + + attr_reader :main_file, :user_file + + constructor :yaml_wrapper, :stream_wrapper, :system_wrapper, :file_wrapper + + def setup + @main_file = nil + @user_file = nil + + @main_project_filepath = '' + @user_project_filepath = '' + end + + + def find_project_files + # first go hunting for optional user project file by looking for environment variable and then default location on disk + user_filepath = @system_wrapper.env_get('CEEDLING_USER_PROJECT_FILE') + + if ( not user_filepath.nil? and @file_wrapper.exist?(user_filepath) ) + @user_project_filepath = user_filepath + elsif (@file_wrapper.exist?(DEFAULT_CEEDLING_USER_PROJECT_FILE)) + @user_project_filepath = DEFAULT_CEEDLING_USER_PROJECT_FILE + end + + # next check for main project file by looking for environment variable and then default location on disk; + # blow up if we don't find this guy -- like, he's so totally important + main_filepath = @system_wrapper.env_get('CEEDLING_MAIN_PROJECT_FILE') + + if ( not main_filepath.nil? and @file_wrapper.exist?(main_filepath) ) + @main_project_filepath = main_filepath + elsif (@file_wrapper.exist?(DEFAULT_CEEDLING_MAIN_PROJECT_FILE)) + @main_project_filepath = DEFAULT_CEEDLING_MAIN_PROJECT_FILE + else + # no verbosity checking since this is lowest level reporting anyhow & + # verbosity checking depends on configurator which in turns needs this class (circular dependency) + @stream_wrapper.stderr_puts('Found no Ceedling project file (*.yml)') + raise + end + + @main_file = File.basename( @main_project_filepath ) + @user_file = File.basename( @user_project_filepath ) if ( not @user_project_filepath.empty? ) + end + + + def load_project_config + config_hash = {} + + # if there's no user project file, then just provide hash from project file + if (@user_project_filepath.empty?) + config_hash = @yaml_wrapper.load(@main_project_filepath) + # if there is a user project file, load it too and merge it on top of the project file, + # superseding anything that's common between them + else + config_hash = (@yaml_wrapper.load(@main_project_filepath)).merge(@yaml_wrapper.load(@user_project_filepath)) + end + + return config_hash + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/lib/rake_utils.rb b/flex-bison/clcalc/tools/ceedling/lib/rake_utils.rb new file mode 100644 index 0000000..3f667c8 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/rake_utils.rb @@ -0,0 +1,17 @@ + +class RakeUtils + + constructor :rake_wrapper + + def task_invoked?(task_regex) + task_invoked = false + @rake_wrapper.task_list.each do |task| + if ((task.already_invoked) and (task.to_s =~ task_regex)) + task_invoked = true + break + end + end + return task_invoked + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/lib/rake_wrapper.rb b/flex-bison/clcalc/tools/ceedling/lib/rake_wrapper.rb new file mode 100644 index 0000000..d4d9e25 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/rake_wrapper.rb @@ -0,0 +1,31 @@ +require 'rubygems' +require 'rake' +require 'makefile' # our replacement for rake's make-style dependency loader + +class Rake::Task + attr_reader :already_invoked +end + +class RakeWrapper + + def initialize + @makefile_loader = Rake::MakefileLoader.new # use our custom replacement noted above + end + + def [](task) + return Rake::Task[task] + end + + def task_list + return Rake::Task.tasks + end + + def create_file_task(file_task, dependencies) + file(file_task => dependencies) + end + + def load_dependencies(dependencies_path) + @makefile_loader.load(dependencies_path) + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/lib/rakefile.rb b/flex-bison/clcalc/tools/ceedling/lib/rakefile.rb new file mode 100644 index 0000000..0c22e33 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/rakefile.rb @@ -0,0 +1,60 @@ +require 'fileutils' + +# get directory containing this here file, back up one directory, and expand to full path +CEEDLING_ROOT = File.expand_path(File.dirname(__FILE__) + '/..') +CEEDLING_LIB = File.join(CEEDLING_ROOT, 'lib') +CEEDLING_VENDOR = File.join(CEEDLING_ROOT, 'vendor') +CEEDLING_RELEASE = File.join(CEEDLING_ROOT, 'release') + +$LOAD_PATH.unshift( CEEDLING_LIB ) +$LOAD_PATH.unshift( File.join(CEEDLING_VENDOR, 'diy/lib') ) +$LOAD_PATH.unshift( File.join(CEEDLING_VENDOR, 'constructor/lib') ) +$LOAD_PATH.unshift( File.join(CEEDLING_VENDOR, 'cmock/lib') ) +$LOAD_PATH.unshift( File.join(CEEDLING_VENDOR, 'deep_merge/lib') ) + +require 'rake' + +require 'diy' +require 'constructor' + +require 'constants' + + +# construct all our objects +@ceedling = DIY::Context.from_yaml( File.read( File.join(CEEDLING_LIB, 'objects.yml') ) ) +@ceedling.build_everything + +# one-stop shopping for all our setup and such after construction +@ceedling[:setupinator].ceedling = @ceedling +@ceedling[:setupinator].do_setup( @ceedling[:setupinator].load_project_files ) + +# tell all our plugins we're about to do something +@ceedling[:plugin_manager].pre_build + +# load rakefile component files (*.rake) +PROJECT_RAKEFILE_COMPONENT_FILES.each { |component| load(component) } + +# tell rake to shut up by default (overridden in verbosity / debug tasks as appropriate) +verbose(false) + + +# end block always executed following rake run +END { + # cache our input configurations to use in comparison upon next execution + @ceedling[:cacheinator].cache_test_config( @ceedling[:setupinator].config_hash ) if (@ceedling[:task_invoker].test_invoked?) + @ceedling[:cacheinator].cache_release_config( @ceedling[:setupinator].config_hash ) if (@ceedling[:task_invoker].release_invoked?) + + # delete all temp files unless we're in debug mode + if (not @ceedling[:configurator].project_debug) + @ceedling[:file_wrapper].rm_f( @ceedling[:file_wrapper].directory_listing( File.join(@ceedling[:configurator].project_temp_path, '*') )) + end + + # only perform these final steps if we got here without runtime exceptions or errors + if (@ceedling[:system_wrapper].ruby_success) + + # tell all our plugins the build is done and process results + @ceedling[:plugin_manager].post_build + @ceedling[:plugin_manager].print_plugin_failures + exit(1) if (@ceedling[:plugin_manager].plugins_failed?) + end +} diff --git a/flex-bison/clcalc/tools/ceedling/lib/release_invoker.rb b/flex-bison/clcalc/tools/ceedling/lib/release_invoker.rb new file mode 100644 index 0000000..2df2e68 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/release_invoker.rb @@ -0,0 +1,29 @@ + + +class ReleaseInvoker + + constructor :configurator, :release_invoker_helper, :dependinator, :task_invoker, :file_path_utils + + + def setup_and_invoke_c_objects(c_files) + objects = ( @file_path_utils.form_release_build_c_objects_filelist( c_files ) ) + + @release_invoker_helper.process_auxiliary_dependencies( @file_path_utils.form_release_dependencies_filelist( c_files ) ) + + @dependinator.enhance_release_file_dependencies( objects ) + @task_invoker.invoke_release_objects( objects ) + + return objects + end + + + def setup_and_invoke_asm_objects(asm_files) + objects = @file_path_utils.form_release_build_asm_objects_filelist( asm_files ) + + @dependinator.enhance_release_file_dependencies( objects ) + @task_invoker.invoke_release_objects( objects ) + + return objects + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/lib/release_invoker_helper.rb b/flex-bison/clcalc/tools/ceedling/lib/release_invoker_helper.rb new file mode 100644 index 0000000..2843f2e --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/release_invoker_helper.rb @@ -0,0 +1,16 @@ + + +class ReleaseInvokerHelper + + constructor :configurator, :dependinator, :task_invoker + + + def process_auxiliary_dependencies(dependencies_list) + return if (not @configurator.project_use_auxiliary_dependencies) + + @dependinator.enhance_release_file_dependencies( dependencies_list ) + @task_invoker.invoke_release_dependencies_files( dependencies_list ) + @dependinator.load_release_object_deep_dependencies( dependencies_list ) + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/lib/reportinator.rb b/flex-bison/clcalc/tools/ceedling/lib/reportinator.rb new file mode 100644 index 0000000..a41e9a0 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/reportinator.rb @@ -0,0 +1,9 @@ + +class Reportinator + + def generate_banner(message, width=nil) + dash_count = ((width.nil?) ? message.strip.length : width) + return "#{'-' * dash_count}\n#{message}\n#{'-' * dash_count}\n" + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/lib/rules_cmock.rake b/flex-bison/clcalc/tools/ceedling/lib/rules_cmock.rake new file mode 100644 index 0000000..ab29e85 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/rules_cmock.rake @@ -0,0 +1,9 @@ + + +rule(/#{CMOCK_MOCK_PREFIX}.+#{'\\'+EXTENSION_SOURCE}$/ => [ + proc do |task_name| + @ceedling[:file_finder].find_header_input_for_mock_file(task_name) + end + ]) do |mock| + @ceedling[:generator].generate_mock(TEST_CONTEXT, mock.source) +end diff --git a/flex-bison/clcalc/tools/ceedling/lib/rules_preprocess.rake b/flex-bison/clcalc/tools/ceedling/lib/rules_preprocess.rake new file mode 100644 index 0000000..fda14dc --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/rules_preprocess.rake @@ -0,0 +1,26 @@ + + +# invocations against this rule should only happen when enhanced dependencies are enabled; +# otherwise, dependency tracking will be too shallow and preprocessed files could intermittently +# fail to be updated when they actually need to be. +rule(/#{PROJECT_TEST_PREPROCESS_FILES_PATH}\/.+/ => [ + proc do |task_name| + @ceedling[:file_finder].find_test_or_source_or_header_file(task_name) + end + ]) do |file| + if (not @ceedling[:configurator].project_use_auxiliary_dependencies) + raise 'ERROR: Ceedling preprocessing rule invoked though neccessary auxiliary dependency support not enabled.' + end + @ceedling[:generator].generate_preprocessed_file(TEST_CONTEXT, file.source) +end + + +# invocations against this rule can always happen as there are no deeper dependencies to consider +rule(/#{PROJECT_TEST_PREPROCESS_INCLUDES_PATH}\/.+/ => [ + proc do |task_name| + @ceedling[:file_finder].find_test_or_source_or_header_file(task_name) + end + ]) do |file| + @ceedling[:generator].generate_shallow_includes_list(TEST_CONTEXT, file.source) +end + diff --git a/flex-bison/clcalc/tools/ceedling/lib/rules_release.rake b/flex-bison/clcalc/tools/ceedling/lib/rules_release.rake new file mode 100644 index 0000000..f8dc29a --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/rules_release.rake @@ -0,0 +1,24 @@ + +rule(/#{PROJECT_RELEASE_BUILD_OUTPUT_ASM_PATH}\/#{'.+\\'+EXTENSION_OBJECT}$/ => [ + proc do |task_name| + @ceedling[:file_finder].find_assembly_file(task_name) + end + ]) do |object| + @ceedling[:generator].generate_object_file(TOOLS_RELEASE_ASSEMBLER, object.source, object.name) +end + + +rule(/#{PROJECT_RELEASE_BUILD_OUTPUT_C_PATH}\/#{'.+\\'+EXTENSION_OBJECT}$/ => [ + proc do |task_name| + @ceedling[:file_finder].find_compilation_input_file(task_name) + end + ]) do |object| + @ceedling[:generator].generate_object_file(TOOLS_RELEASE_COMPILER, object.source, object.name) +end + + +rule(/#{PROJECT_RELEASE_BUILD_TARGET}/) do |bin_file| + @ceedling[:generator].generate_executable_file(TOOLS_RELEASE_LINKER, bin_file.prerequisites, bin_file.name) +end + + diff --git a/flex-bison/clcalc/tools/ceedling/lib/rules_release_aux_dependencies.rake b/flex-bison/clcalc/tools/ceedling/lib/rules_release_aux_dependencies.rake new file mode 100644 index 0000000..485973f --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/rules_release_aux_dependencies.rake @@ -0,0 +1,14 @@ + + +rule(/#{PROJECT_RELEASE_DEPENDENCIES_PATH}\/#{'.+\\'+EXTENSION_DEPENDENCIES}$/ => [ + proc do |task_name| + @ceedling[:file_finder].find_compilation_input_file(task_name) + end + ]) do |dep| + @ceedling[:generator].generate_dependencies_file( + TOOLS_RELEASE_DEPENDENCIES_GENERATOR, + dep.source, + @ceedling[:file_path_utils].form_release_build_c_object_filepath(dep.source), + dep.name) +end + diff --git a/flex-bison/clcalc/tools/ceedling/lib/rules_tests.rake b/flex-bison/clcalc/tools/ceedling/lib/rules_tests.rake new file mode 100644 index 0000000..a3902b7 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/rules_tests.rake @@ -0,0 +1,49 @@ + + +rule(/#{PROJECT_TEST_FILE_PREFIX}#{'.+'+TEST_RUNNER_FILE_SUFFIX}#{'\\'+EXTENSION_SOURCE}$/ => [ + proc do |task_name| + @ceedling[:file_finder].find_test_input_for_runner_file(task_name) + end + ]) do |runner| + @ceedling[:generator].generate_test_runner(TEST_CONTEXT, runner.source, runner.name) +end + + +rule(/#{PROJECT_TEST_BUILD_OUTPUT_PATH}\/#{'.+\\'+EXTENSION_OBJECT}$/ => [ + proc do |task_name| + @ceedling[:file_finder].find_compilation_input_file(task_name) + end + ]) do |object| + @ceedling[:generator].generate_object_file(TOOLS_TEST_COMPILER, TEST_CONTEXT, object.source, object.name) +end + + +rule(/#{PROJECT_TEST_BUILD_OUTPUT_PATH}\/#{'.+\\'+EXTENSION_EXECUTABLE}$/) do |bin_file| + @ceedling[:generator].generate_executable_file(TOOLS_TEST_LINKER, TEST_CONTEXT, bin_file.prerequisites, bin_file.name) +end + + +rule(/#{PROJECT_TEST_RESULTS_PATH}\/#{'.+\\'+EXTENSION_TESTPASS}$/ => [ + proc do |task_name| + @ceedling[:file_path_utils].form_test_executable_filepath(task_name) + end + ]) do |test_result| + @ceedling[:generator].generate_test_results(TOOLS_TEST_FIXTURE, TEST_CONTEXT, test_result.source, test_result.name) +end + + +namespace TEST_CONTEXT do + # use a rule to increase efficiency for large projects + # test tasks by regex + rule(/^#{TEST_TASK_ROOT}\S+$/ => [ + proc do |task_name| + test = task_name.sub(/#{TEST_TASK_ROOT}/, '') + test = "#{PROJECT_TEST_FILE_PREFIX}#{test}" if not (test.start_with?(PROJECT_TEST_FILE_PREFIX)) + @ceedling[:file_finder].find_test_from_file_path(test) + end + ]) do |test| + @ceedling[:rake_wrapper][:directories].invoke + @ceedling[:test_invoker].setup_and_invoke([test.source]) + end +end + diff --git a/flex-bison/clcalc/tools/ceedling/lib/rules_tests_aux_dependencies.rake b/flex-bison/clcalc/tools/ceedling/lib/rules_tests_aux_dependencies.rake new file mode 100644 index 0000000..db9a92b --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/rules_tests_aux_dependencies.rake @@ -0,0 +1,15 @@ + + +rule(/#{PROJECT_TEST_DEPENDENCIES_PATH}\/#{'.+\\'+EXTENSION_DEPENDENCIES}$/ => [ + proc do |task_name| + @ceedling[:file_finder].find_compilation_input_file(task_name) + end + ]) do |dep| + @ceedling[:generator].generate_dependencies_file( + TOOLS_TEST_DEPENDENCIES_GENERATOR, + TEST_CONTEXT, + dep.source, + @ceedling[:file_path_utils].form_test_build_object_filepath(dep.source), + dep.name) +end + diff --git a/flex-bison/clcalc/tools/ceedling/lib/setupinator.rb b/flex-bison/clcalc/tools/ceedling/lib/setupinator.rb new file mode 100644 index 0000000..ffe141d --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/setupinator.rb @@ -0,0 +1,45 @@ + +class Setupinator + + attr_reader :config_hash + attr_writer :ceedling + + def setup + @ceedling = {} + @config_hash = {} + end + + def load_project_files + @ceedling[:project_file_loader].find_project_files + return @ceedling[:project_file_loader].load_project_config + end + + def do_setup(config_hash) + @config_hash = config_hash + + # load up all the constants and accessors our rake files, objects, & external scripts will need; + # note: configurator modifies the cmock section of the hash with a couple defaults to tie + # project together - the modified hash is used to build cmock object + @ceedling[:configurator].populate_defaults( config_hash ) + @ceedling[:configurator].populate_unity_defines( config_hash ) + @ceedling[:configurator].populate_cmock_defaults( config_hash ) + @ceedling[:configurator].find_and_merge_plugins( config_hash ) + @ceedling[:configurator].populate_tool_names_and_stderr_redirect( config_hash ) + @ceedling[:configurator].eval_environment_variables( config_hash ) + @ceedling[:configurator].eval_paths( config_hash ) + @ceedling[:configurator].standardize_paths( config_hash ) + @ceedling[:configurator].validate( config_hash ) + @ceedling[:configurator].build( config_hash ) + @ceedling[:configurator].insert_rake_plugins( @ceedling[:configurator].rake_plugins ) + + @ceedling[:plugin_manager].load_plugin_scripts( @ceedling[:configurator].script_plugins, @ceedling ) + @ceedling[:plugin_reportinator].set_system_objects( @ceedling ) + @ceedling[:file_finder].prepare_search_sources + @ceedling[:loginator].setup_log_filepath + @ceedling[:project_config_manager].config_hash = config_hash + end + + def reset_defaults(config_hash) + @ceedling[:configurator].reset_defaults( config_hash ) + end +end diff --git a/flex-bison/clcalc/tools/ceedling/lib/stream_wrapper.rb b/flex-bison/clcalc/tools/ceedling/lib/stream_wrapper.rb new file mode 100644 index 0000000..33d3c10 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/stream_wrapper.rb @@ -0,0 +1,20 @@ + +class StreamWrapper + + def stdout_puts(string) + $stdout.puts(string) + end + + def stdout_flush + $stdout.flush + end + + def stderr_puts(string) + $stderr.puts(string) + end + + def stderr_flush + $stderr.flush + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/lib/streaminator.rb b/flex-bison/clcalc/tools/ceedling/lib/streaminator.rb new file mode 100644 index 0000000..abbc9b8 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/streaminator.rb @@ -0,0 +1,41 @@ + +class Streaminator + + require 'constants' + + constructor :streaminator_helper, :verbosinator, :loginator, :stream_wrapper + + # for those objects for whom the configurator has already been instantiated, + # Streaminator is a convenience object for handling verbosity and writing to the std streams + + def stdout_puts(string, verbosity=Verbosity::NORMAL) + if (@verbosinator.should_output?(verbosity)) + @stream_wrapper.stdout_puts(string) + @stream_wrapper.stdout_flush + end + + # write to log as though Verbosity::OBNOXIOUS + @loginator.log( string, @streaminator_helper.extract_name($stdout) ) + end + + def stderr_puts(string, verbosity=Verbosity::NORMAL) + if (@verbosinator.should_output?(verbosity)) + @stream_wrapper.stderr_puts(string) + @stream_wrapper.stderr_flush + end + + # write to log as though Verbosity::OBNOXIOUS + @loginator.log( string, @streaminator_helper.extract_name($stderr) ) + end + + def stream_puts(stream, string, verbosity=Verbosity::NORMAL) + if (@verbosinator.should_output?(verbosity)) + stream.puts(string) + stream.flush + end + + # write to log as though Verbosity::OBNOXIOUS + @loginator.log( string, @streaminator_helper.extract_name(stream) ) + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/lib/streaminator_helper.rb b/flex-bison/clcalc/tools/ceedling/lib/streaminator_helper.rb new file mode 100644 index 0000000..9fb5cc0 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/streaminator_helper.rb @@ -0,0 +1,15 @@ + +class StreaminatorHelper + + def extract_name(stream) + name = case (stream.fileno) + when 0 then '#' + when 1 then '#' + when 2 then '#' + else stream.inspect + end + + return name + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/lib/system_wrapper.rb b/flex-bison/clcalc/tools/ceedling/lib/system_wrapper.rb new file mode 100644 index 0000000..631be36 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/system_wrapper.rb @@ -0,0 +1,67 @@ +require 'rbconfig' + +class SystemWrapper + + # static method for use in defaults + def self.is_windows? + return ((Config::CONFIG['host_os'] =~ /mswin|mingw/) ? true : false) + end + + # class method so as to be mockable for tests + def is_windows? + return SystemWrapper.is_windows? + end + + def module_eval(string) + return Object.module_eval("\"" + string + "\"") + end + + def eval(string) + return eval(string) + end + + def search_paths + return ENV['PATH'].split(File::PATH_SEPARATOR) + end + + def cmdline_args + return ARGV + end + + def env_set(name, value) + ENV[name] = value + end + + def env_get(name) + return ENV[name] + end + + def time_now + return Time.now.asctime + end + + def shell_execute(command) + return { + :output => `#{command}`, + :exit_code => ($?.exitstatus) + } + end + + def add_load_path(path) + $LOAD_PATH.unshift(path) + end + + def require_file(path) + require(path) + end + + def ruby_success + return ($!.nil? || $!.is_a?(SystemExit) && $!.success?) + end + + def constants_include?(item) + # forcing to strings provides consistency across Ruby versions + return Object.constants.map{|constant| constant.to_s}.include?(item.to_s) + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/lib/task_invoker.rb b/flex-bison/clcalc/tools/ceedling/lib/task_invoker.rb new file mode 100644 index 0000000..92f3854 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/task_invoker.rb @@ -0,0 +1,85 @@ + +class TaskInvoker + + constructor :dependinator, :rake_utils, :rake_wrapper + + def setup + @test_regexs = [/^#{TEST_ROOT_NAME}:/] + @release_regexs = [/^#{RELEASE_ROOT_NAME}(:|$)/] + end + + def add_test_task_regex(regex) + @test_regexs << regex + end + + def add_release_task_regex(regex) + @release_regexs << regex + end + + def test_invoked? + invoked = false + + @test_regexs.each do |regex| + invoked = true if (@rake_utils.task_invoked?(regex)) + break if invoked + end + + return invoked + end + + def release_invoked? + invoked = false + + @release_regexs.each do |regex| + invoked = true if (@rake_utils.task_invoked?(regex)) + break if invoked + end + + return invoked + end + + def invoked?(regex) + return @rake_utils.task_invoked?(regex) + end + + + def invoke_test_mocks(mocks) + @dependinator.enhance_mock_dependencies( mocks ) + mocks.each { |mock| @rake_wrapper[mock].invoke } + end + + def invoke_test_runner(runner) + @dependinator.enhance_runner_dependencies( runner ) + @rake_wrapper[runner].invoke + end + + def invoke_test_shallow_include_lists(files) + @dependinator.enhance_shallow_include_lists_dependencies( files ) + files.each { |file| @rake_wrapper[file].invoke } + end + + def invoke_test_preprocessed_files(files) + @dependinator.enhance_preprocesed_file_dependencies( files ) + files.each { |file| @rake_wrapper[file].invoke } + end + + def invoke_test_dependencies_files(files) + @dependinator.enhance_dependencies_dependencies( files ) + files.each { |file| @rake_wrapper[file].invoke } + end + + def invoke_test_results(result) + @dependinator.enhance_results_dependencies( result ) + @rake_wrapper[result].invoke + end + + + def invoke_release_dependencies_files(files) + files.each { |file| @rake_wrapper[file].invoke } + end + + def invoke_release_objects(objects) + objects.each { |object| @rake_wrapper[object].invoke } + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/lib/tasks_base.rake b/flex-bison/clcalc/tools/ceedling/lib/tasks_base.rake new file mode 100644 index 0000000..fbe4081 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/tasks_base.rake @@ -0,0 +1,104 @@ +require 'constants' +require 'file_path_utils' + + +desc "Display build environment version info." +task :version do + tools = [ + [' Ceedling', CEEDLING_ROOT], + ['CException', File.join( CEEDLING_VENDOR, CEXCEPTION_ROOT_PATH)], + [' CMock', File.join( CEEDLING_VENDOR, CMOCK_ROOT_PATH)], + [' Unity', File.join( CEEDLING_VENDOR, UNITY_ROOT_PATH)], + ] + + tools.each do |tool| + name = tool[0] + base_path = tool[1] + + version_string = @ceedling[:file_wrapper].read( File.join(base_path, 'release', 'version.info') ).strip + build_string = @ceedling[:file_wrapper].read( File.join(base_path, 'release', 'build.info') ).strip + puts "#{name}:: #{version_string.empty? ? '#.#.' : (version_string + '.')}#{build_string.empty? ? '?' : build_string}" + end +end + + +desc "Set verbose output (silent:[#{Verbosity::SILENT}] - obnoxious:[#{Verbosity::OBNOXIOUS}])." +task :verbosity, :level do |t, args| + verbosity_level = args.level.to_i + + if (PROJECT_USE_MOCKS) + # don't store verbosity level in setupinator's config hash, use a copy; + # otherwise, the input configuration will change and trigger entire project rebuilds + hash = @ceedling[:setupinator].config_hash[:cmock].clone + hash[:verbosity] = verbosity_level + + @ceedling[:cmock_builder].manufacture( hash ) + end + + @ceedling[:configurator].project_verbosity = verbosity_level + + # control rake's verbosity with new setting + verbose( ((verbosity_level >= Verbosity::OBNOXIOUS) ? true : false) ) +end + + +desc "Enable logging" +task :logging do + @ceedling[:configurator].project_logging = true +end + + +# non advertised debug task +task :debug do + Rake::Task[:verbosity].invoke(Verbosity::DEBUG) + Rake.application.options.trace = true + @ceedling[:configurator].project_debug = true +end + + +# non advertised sanity checking task +task :sanity_checks, :level do |t, args| + check_level = args.level.to_i + @ceedling[:configurator].sanity_checks = check_level +end + + +# list expanded environment variables +if (not COLLECTION_ENVIRONMENT.empty?) +desc "List all configured environment variables." +task :environment do + COLLECTION_ENVIRONMENT.each do |env| + env.each_key do |key| + name = key.to_s.upcase + puts " - #{name}: \"#{env[key]}\"" + end + end +end +end + + +namespace :options do + + COLLECTION_PROJECT_OPTIONS.each do |option_path| + option = File.basename(option_path, '.yml') + + desc "Merge #{option} project options." + task option.downcase.to_sym do + @ceedling[:setupinator].reset_defaults( @ceedling[:setupinator].config_hash ) + hash = @ceedling[:project_config_manager].merge_options( @ceedling[:setupinator].config_hash, option_path ) + @ceedling[:setupinator].do_setup( hash ) + end + end + +end + + +# do not present task if there's no plugins +if (not PLUGINS_ENABLED.empty?) +desc "Execute plugin result summaries (no build triggering)." +task :summary do + @ceedling[:plugin_manager].summary + puts "\nNOTE: Summaries may be out of date with project sources.\n\n" +end +end + diff --git a/flex-bison/clcalc/tools/ceedling/lib/tasks_filesystem.rake b/flex-bison/clcalc/tools/ceedling/lib/tasks_filesystem.rake new file mode 100644 index 0000000..e119d64 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/tasks_filesystem.rake @@ -0,0 +1,89 @@ + +# rather than require 'rake/clean' & try to override, we replicate for finer control +CLEAN = Rake::FileList["**/*~", "**/*.bak"] +CLOBBER = Rake::FileList.new + +CLEAN.clear_exclude.exclude { |fn| fn.pathmap("%f") == 'core' && File.directory?(fn) } + +CLEAN.include(File.join(PROJECT_TEST_BUILD_OUTPUT_PATH, '*')) +CLEAN.include(File.join(PROJECT_TEST_RESULTS_PATH, '*')) +CLEAN.include(File.join(PROJECT_TEST_DEPENDENCIES_PATH, '*')) +CLEAN.include(File.join(PROJECT_RELEASE_BUILD_OUTPUT_PATH, '*')) + +CLOBBER.include(File.join(PROJECT_BUILD_ARTIFACTS_ROOT, '**/*')) +CLOBBER.include(File.join(PROJECT_BUILD_TESTS_ROOT, '**/*')) +CLOBBER.include(File.join(PROJECT_BUILD_RELEASE_ROOT, '**/*')) +CLOBBER.include(File.join(PROJECT_LOG_PATH, '**/*')) +CLOBBER.include(File.join(PROJECT_TEMP_PATH, '**/*')) + +# because of cmock config, mock path can optionally exist apart from standard test build paths +CLOBBER.include(File.join(CMOCK_MOCK_PATH, '*')) + +REMOVE_FILE_PROC = Proc.new { |fn| rm_r fn rescue nil } + +# redefine clean so we can override how it advertises itself +desc "Delete all build artifacts and temporary products." +task(:clean) do + # because :clean is a prerequisite for :clobber, intelligently display the progress message + if (not @ceedling[:task_invoker].invoked?(/^clobber$/)) + @ceedling[:streaminator].stdout_puts("\nCleaning build artifacts...\n(For large projects, this task may take a long time to complete)\n\n") + end + CLEAN.each { |fn| REMOVE_FILE_PROC.call(fn) } +end + +# redefine clobber so we can override how it advertises itself +desc "Delete all generated files (and build artifacts)." +task(:clobber => [:clean]) do + @ceedling[:streaminator].stdout_puts("\nClobbering all generated files...\n(For large projects, this task may take a long time to complete)\n\n") + CLOBBER.each { |fn| REMOVE_FILE_PROC.call(fn) } +end + + +PROJECT_BUILD_PATHS.each { |path| directory(path) } + +# create directories that hold build output and generated files & touching rebuild dependency sources +task(:directories => PROJECT_BUILD_PATHS) { @ceedling[:dependinator].touch_force_rebuild_files } + + +# list paths discovered at load time +namespace :paths do + + paths = @ceedling[:setupinator].config_hash[:paths] + paths.each_key do |section| + name = section.to_s.downcase + path_list = Object.const_get("COLLECTION_PATHS_#{name.upcase}") + + if (path_list.size != 0) + desc "List all collected #{name} paths." + task(name.to_sym) { puts "#{name} paths:"; path_list.sort.each {|path| puts " - #{path}" } } + end + end + +end + + +# list files & file counts discovered at load time +namespace :files do + + categories = [ + ['test', COLLECTION_ALL_TESTS], + ['source', COLLECTION_ALL_SOURCE], + ['header', COLLECTION_ALL_HEADERS] + ] + categories << ['assembly', COLLECTION_ALL_ASSEMBLY] if (RELEASE_BUILD_USE_ASSEMBLY) + + categories.each do |category| + name = category[0] + collection = category[1] + + desc "List all collected #{name} files." + task(name.to_sym) do + puts "#{name} files:" + collection.sort.each { |filepath| puts " - #{filepath}" } + puts "file count: #{collection.size}" + end + end + +end + + diff --git a/flex-bison/clcalc/tools/ceedling/lib/tasks_release.rake b/flex-bison/clcalc/tools/ceedling/lib/tasks_release.rake new file mode 100644 index 0000000..88aa678 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/tasks_release.rake @@ -0,0 +1,44 @@ +require 'constants' +require 'file_path_utils' + + +desc "Build release target." +task :release => [:directories] do + header = "Release build '#{File.basename(PROJECT_RELEASE_BUILD_TARGET)}'" + @ceedling[:streaminator].stdout_puts("\n\n#{header}\n#{'-' * header.length}") + + core_objects = [] + extra_objects = @ceedling[:file_path_utils].form_release_build_c_objects_filelist( COLLECTION_RELEASE_ARTIFACT_EXTRA_LINK_OBJECTS ) + + @ceedling[:project_config_manager].process_release_config_change + core_objects.concat( @ceedling[:release_invoker].setup_and_invoke_c_objects( COLLECTION_ALL_SOURCE ) ) + core_objects.concat( @ceedling[:release_invoker].setup_and_invoke_asm_objects( COLLECTION_ALL_ASSEMBLY ) ) + + file( PROJECT_RELEASE_BUILD_TARGET => (core_objects + extra_objects) ) + Rake::Task[PROJECT_RELEASE_BUILD_TARGET].invoke +end + + +namespace :release do + + namespace :compile do + COLLECTION_ALL_SOURCE.each do |source| + name = File.basename( source ) + task name.to_sym => [:directories] do + @ceedling[:project_config_manager].process_release_config_change + @ceedling[:release_invoker].setup_and_invoke_c_objects( [source] ) + end + end + end + + namespace :assemble do + COLLECTION_ALL_ASSEMBLY.each do |source| + name = File.basename( source ) + task name.to_sym => [:directories] do + @ceedling[:project_config_manager].process_release_config_change + @ceedling[:release_invoker].setup_and_invoke_asm_objects( [source] ) + end + end + end + +end \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/lib/tasks_tests.rake b/flex-bison/clcalc/tools/ceedling/lib/tasks_tests.rake new file mode 100644 index 0000000..a1845ac --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/tasks_tests.rake @@ -0,0 +1,49 @@ + +namespace TEST_CONTEXT do + + desc "Run all unit tests." + task :all => [:directories] do + @ceedling[:test_invoker].setup_and_invoke(COLLECTION_ALL_TESTS) + end + + desc "Run single test ([*] real test or source file name, no path)." + task :* do + message = "\nOops! '#{TEST_ROOT_NAME}:*' isn't a real task. " + + "Use a real test or source file name (no path) in place of the wildcard.\n" + + "Example: rake #{TEST_ROOT_NAME}:foo.c\n\n" + + @ceedling[:streaminator].stdout_puts( message ) + end + + desc "Run tests for changed files." + task :delta => [:directories] do + @ceedling[:test_invoker].setup_and_invoke(COLLECTION_ALL_TESTS, {:force_run => false}) + end + + desc "Run tests by matching regular expression pattern." + task :pattern, [:regex] => [:directories] do |t, args| + matches = [] + + COLLECTION_ALL_TESTS.each { |test| matches << test if (test =~ /#{args.regex}/) } + + if (matches.size > 0) + @ceedling[:test_invoker].setup_and_invoke(matches, {:force_run => false}) + else + @ceedling[:streaminator].stdout_puts("\nFound no tests matching pattern /#{args.regex}/.") + end + end + + desc "Run tests whose test path contains [dir] or [dir] substring." + task :path, [:dir] => [:directories] do |t, args| + matches = [] + + COLLECTION_ALL_TESTS.each { |test| matches << test if File.dirname(test).include?(args.dir.gsub(/\\/, '/')) } + + if (matches.size > 0) + @ceedling[:test_invoker].setup_and_invoke(matches, {:force_run => false}) + else + @ceedling[:streaminator].stdout_puts("\nFound no tests including the given path or path component.") + end + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/lib/tasks_vendor.rake b/flex-bison/clcalc/tools/ceedling/lib/tasks_vendor.rake new file mode 100644 index 0000000..0d07154 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/tasks_vendor.rake @@ -0,0 +1,36 @@ +require 'constants' +require 'file_path_utils' + +# create file dependencies to ensure C-based components of vendor tools are recompiled when they are updated with new versions +# forming these explicitly rather than depend on auxiliary dependencies so all scenarios are explicitly covered + +file( @ceedling[:file_path_utils].form_test_build_object_filepath( UNITY_C_FILE ) => [ + FilePathUtils.form_ceedling_vendor_path( UNITY_LIB_PATH, UNITY_C_FILE ), + FilePathUtils.form_ceedling_vendor_path( UNITY_LIB_PATH, UNITY_H_FILE ), + FilePathUtils.form_ceedling_vendor_path( UNITY_LIB_PATH, UNITY_INTERNALS_H_FILE ) ] + ) + + +if (PROJECT_USE_MOCKS) +file( @ceedling[:file_path_utils].form_test_build_object_filepath( CMOCK_C_FILE ) => [ + FilePathUtils.form_ceedling_vendor_path( CMOCK_LIB_PATH, CMOCK_C_FILE ), + FilePathUtils.form_ceedling_vendor_path( CMOCK_LIB_PATH, CMOCK_H_FILE ) ] + ) +end + + +if (PROJECT_USE_EXCEPTIONS) +file( @ceedling[:file_path_utils].form_test_build_object_filepath( CEXCEPTION_C_FILE ) => [ + FilePathUtils.form_ceedling_vendor_path( CEXCEPTION_LIB_PATH, CEXCEPTION_C_FILE ), + FilePathUtils.form_ceedling_vendor_path( CEXCEPTION_LIB_PATH, CEXCEPTION_H_FILE ) ] + ) +end + + +if (PROJECT_USE_EXCEPTIONS and PROJECT_RELEASE_BUILD) +file( @ceedling[:file_path_utils].form_release_build_c_object_filepath( CEXCEPTION_C_FILE ) => [ + FilePathUtils.form_ceedling_vendor_path( CEXCEPTION_LIB_PATH, CEXCEPTION_C_FILE ), + FilePathUtils.form_ceedling_vendor_path( CEXCEPTION_LIB_PATH, CEXCEPTION_H_FILE ) ] + ) +end + diff --git a/flex-bison/clcalc/tools/ceedling/lib/test_includes_extractor.rb b/flex-bison/clcalc/tools/ceedling/lib/test_includes_extractor.rb new file mode 100644 index 0000000..35f7c53 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/test_includes_extractor.rb @@ -0,0 +1,81 @@ + +class TestIncludesExtractor + + constructor :configurator, :yaml_wrapper, :file_wrapper + + + def setup + @includes = {} + @mocks = {} + end + + + # for includes_list file, slurp up array from yaml file and sort & store includes + def parse_includes_list(includes_list) + gather_and_store_includes( includes_list, @yaml_wrapper.load(includes_list) ) + end + + # open, scan for, and sort & store includes of test file + def parse_test_file(test) + gather_and_store_includes( test, extract_from_file(test) ) + end + + # mocks with no file extension + def lookup_raw_mock_list(test) + file_key = form_file_key(test) + return [] if @mocks[file_key].nil? + return @mocks[file_key] + end + + # includes with file extension + def lookup_includes_list(file) + file_key = form_file_key(file) + return [] if (@includes[file_key]).nil? + return @includes[file_key] + end + + private ################################# + + def form_file_key(filepath) + return File.basename(filepath).to_sym + end + + def extract_from_file(file) + includes = [] + header_extension = @configurator.extension_header + + contents = @file_wrapper.read(file) + + # remove line comments + contents = contents.gsub(/\/\/.*$/, '') + # remove block comments + contents = contents.gsub(/\/\*.*?\*\//m, '') + + contents.split("\n").each do |line| + # look for include statement + scan_results = line.scan(/#include\s+\"\s*(.+#{'\\'+header_extension})\s*\"/) + + includes << scan_results[0][0] if (scan_results.size > 0) + end + + return includes.uniq + end + + def gather_and_store_includes(file, includes) + mock_prefix = @configurator.cmock_mock_prefix + header_extension = @configurator.extension_header + file_key = form_file_key(file) + @mocks[file_key] = [] + + # add includes to lookup hash + @includes[file_key] = includes + + includes.each do |include_file| + # check if include is a mock + scan_results = include_file.scan(/(#{mock_prefix}.+)#{'\\'+header_extension}/) + # add mock to lookup hash + @mocks[file_key] << scan_results[0][0] if (scan_results.size > 0) + end + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/lib/test_invoker.rb b/flex-bison/clcalc/tools/ceedling/lib/test_invoker.rb new file mode 100644 index 0000000..b80d91e --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/test_invoker.rb @@ -0,0 +1,72 @@ +require 'rubygems' +require 'rake' # for ext() + + +class TestInvoker + + attr_reader :sources, :tests, :mocks + + constructor :configurator, :test_invoker_helper, :streaminator, :preprocessinator, :task_invoker, :dependinator, :project_config_manager, :file_path_utils + + def setup + @sources = [] + @tests = [] + @mocks = [] + end + + def setup_and_invoke(tests, options={:force_run => true}) + + @tests = tests + + @project_config_manager.process_test_config_change + + @tests.each do |test| + # announce beginning of test run + header = "Test '#{File.basename(test)}'" + @streaminator.stdout_puts("\n\n#{header}\n#{'-' * header.length}") + + begin + # collect up test fixture pieces & parts + runner = @file_path_utils.form_runner_filepath_from_test( test ) + mock_list = @preprocessinator.preprocess_test_and_invoke_test_mocks( test ) + sources = @test_invoker_helper.extract_sources( test ) + extras = @configurator.collection_test_fixture_extra_link_objects + core = [test] + mock_list + sources + objects = @file_path_utils.form_test_build_objects_filelist( [runner] + core + extras ) + results_pass = @file_path_utils.form_pass_results_filepath( test ) + results_fail = @file_path_utils.form_fail_results_filepath( test ) + + # clean results files so we have a missing file with which to kick off rake's dependency rules + @test_invoker_helper.clean_results( {:pass => results_pass, :fail => results_fail}, options ) + + # load up auxiliary dependencies so deep changes cause rebuilding appropriately + @test_invoker_helper.process_auxiliary_dependencies( core ) + + # tell rake to create test runner if needed + @task_invoker.invoke_test_runner( runner ) + + # enhance object file dependencies to capture externalities influencing regeneration + @dependinator.enhance_test_build_object_dependencies( objects ) + + # associate object files with executable + @dependinator.setup_test_executable_dependencies( test, objects ) + + # 3, 2, 1... launch + @task_invoker.invoke_test_results( results_pass ) + rescue => e + @test_invoker_helper.process_exception(e) + end + + # store away what's been processed + @mocks.concat( mock_list ) + @sources.concat( sources ) + end + + # post-process collected mock list + @mocks.uniq! + + # post-process collected sources list + @sources.uniq! + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/lib/test_invoker_helper.rb b/flex-bison/clcalc/tools/ceedling/lib/test_invoker_helper.rb new file mode 100644 index 0000000..f7d848d --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/test_invoker_helper.rb @@ -0,0 +1,41 @@ +require 'rubygems' +require 'rake' # for ext() + + +class TestInvokerHelper + + constructor :configurator, :task_invoker, :dependinator, :test_includes_extractor, :file_finder, :file_path_utils, :streaminator, :file_wrapper + + def clean_results(results, options) + @file_wrapper.rm_f( results[:fail] ) + @file_wrapper.rm_f( results[:pass] ) if (options[:force_run]) + end + + def process_auxiliary_dependencies(files) + return if (not @configurator.project_use_auxiliary_dependencies) + + dependencies_list = @file_path_utils.form_test_dependencies_filelist( files ) + @task_invoker.invoke_test_dependencies_files( dependencies_list ) + @dependinator.load_test_object_deep_dependencies( dependencies_list ) + end + + def extract_sources(test) + sources = [] + includes = @test_includes_extractor.lookup_includes_list(test) + + includes.each { |include| sources << @file_finder.find_source_file(include, :ignore) } + + return sources.compact + end + + def process_exception(exception) + if (exception.message =~ /Don't know how to build task '(.+)'/i) + @streaminator.stderr_puts("ERROR: Rake could not find file referenced in source or test: '#{$1}'.") + @streaminator.stderr_puts("Possible stale dependency due to a file name change, etc. Execute 'clean' task and try again.") if (@configurator.project_use_auxiliary_dependencies) + raise '' + else + raise exception + end + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/lib/tool_executor.rb b/flex-bison/clcalc/tools/ceedling/lib/tool_executor.rb new file mode 100644 index 0000000..fcd4d42 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/tool_executor.rb @@ -0,0 +1,178 @@ +require 'constants' + + +class ToolExecutor + + constructor :configurator, :tool_executor_helper, :streaminator, :system_wrapper + + def setup + @tool_name = '' + @executable = '' + end + + # build up a command line from yaml provided config + def build_command_line(tool_config, *args) + @tool_name = tool_config[:name] + @executable = tool_config[:executable] + + # basic premise is to iterate top to bottom through arguments using '$' as + # a string replacement indicator to expand globals or inline yaml arrays + # into command line arguments via substitution strings + return [ + @tool_executor_helper.osify_path_separators( expandify_element(@executable, *args) ), + build_arguments(tool_config[:arguments], *args), + @tool_executor_helper.stderr_redirect_addendum(tool_config) ].compact.join(' ') + end + + + # shell out, execute command, and return response + def exec(command, args=[], options={:boom => true}) + command_str = "#{command} #{args.join(' ')}".strip + + shell_result = @system_wrapper.shell_execute(command_str) + + @tool_executor_helper.print_happy_results(command_str, shell_result) + @tool_executor_helper.print_error_results(command_str, shell_result) if (options[:boom]) + + raise if ((shell_result[:exit_code] != 0) and options[:boom]) + + return shell_result + end + + + private ############################# + + + def build_arguments(config, *args) + build_string = '' + + return nil if (config.nil?) + + # iterate through each argument + + # the yaml blob array needs to be flattened so that yaml substitution + # is handled correctly, since it creates a nested array when an anchor is + # dereferenced + config.flatten.each do |element| + argument = '' + + case(element) + # if we find a simple string then look for string replacement operators + # and expand with the parameters in this method's argument list + when String then argument = expandify_element(element, *args) + # if we find a hash, then we grab the key as a substitution string and expand the + # hash's value(s) within that substitution string + when Hash then argument = dehashify_argument_elements(element) + end + + build_string.concat("#{argument} ") if (argument.length > 0) + end + + build_string.strip! + return build_string if (build_string.length > 0) + return nil + end + + + # handle simple text string argument & argument array string replacement operators + def expandify_element(element, *args) + match = // + to_process = nil + args_index = 0 + + # handle ${#} input replacement + if (element =~ TOOL_EXECUTOR_ARGUMENT_REPLACEMENT_PATTERN) + args_index = ($2.to_i - 1) + + if (args.nil? or args[args_index].nil?) + @streaminator.stderr_puts("ERROR: Tool '#{@tool_name}' expected valid argument data to accompany replacement operator #{$1}.", Verbosity::ERRORS) + raise + end + + match = /#{Regexp.escape($1)}/ + to_process = args[args_index] + end + + # simple string argument: replace escaped '\$' and strip + element.sub!(/\\\$/, '$') + element.strip! + + # handle inline ruby execution + if (element =~ RUBY_EVAL_REPLACEMENT_PATTERN) + element.replace(eval($1)) + end + + build_string = '' + + # handle array or anything else passed into method to be expanded in place of replacement operators + case (to_process) + when Array then to_process.each {|value| build_string.concat( "#{element.sub(match, value.to_s)} " ) } if (to_process.size > 0) + else build_string.concat( element.sub(match, to_process.to_s) ) + end + + # handle inline ruby string substitution + if (build_string =~ RUBY_STRING_REPLACEMENT_PATTERN) + build_string.replace(@system_wrapper.module_eval(build_string)) + end + + return build_string.strip + end + + + # handle argument hash: keys are substitution strings, values are data to be expanded within substitution strings + def dehashify_argument_elements(hash) + build_string = '' + elements = [] + + # grab the substitution string (hash key) + substitution = hash.keys[0].to_s + # grab the string(s) to squirt into the substitution string (hash value) + expand = hash[hash.keys[0]] + + if (expand.nil?) + @streaminator.stderr_puts("ERROR: Tool '#{@tool_name}' could not expand nil elements for substitution string '#{substitution}'.", Verbosity::ERRORS) + raise + end + + # array-ify expansion input if only a single string + expansion = ((expand.class == String) ? [expand] : expand) + + expansion.each do |item| + # code eval substitution + if (item =~ RUBY_EVAL_REPLACEMENT_PATTERN) + elements << eval($1) + # string eval substitution + elsif (item =~ RUBY_STRING_REPLACEMENT_PATTERN) + elements << @system_wrapper.module_eval(item) + # global constants + elsif (@system_wrapper.constants_include?(item)) + const = Object.const_get(item) + if (const.nil?) + @streaminator.stderr_puts("ERROR: Tool '#{@tool_name}' found constant '#{item}' to be nil.", Verbosity::ERRORS) + raise + else + elements << const + end + elsif (item.class == Array) + elements << item + elsif (item.class == String) + @streaminator.stderr_puts("ERROR: Tool '#{@tool_name}' cannot expand nonexistent value '#{item}' for substitution string '#{substitution}'.", Verbosity::ERRORS) + raise + else + @streaminator.stderr_puts("ERROR: Tool '#{@tool_name}' cannot expand value having type '#{item.class}' for substitution string '#{substitution}'.", Verbosity::ERRORS) + raise + end + end + + # expand elements (whether string or array) into substitution string & replace escaped '\$' + elements.flatten! + elements.each do |element| + build_string.concat( substitution.sub(/([^\\]*)\$/, "\\1#{element}") ) # don't replace escaped '\$' but allow us to replace just a lonesome '$' + build_string.gsub!(/\\\$/, '$') + build_string.concat(' ') + end + + return build_string.strip + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/lib/tool_executor_helper.rb b/flex-bison/clcalc/tools/ceedling/lib/tool_executor_helper.rb new file mode 100644 index 0000000..c9f9ca2 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/tool_executor_helper.rb @@ -0,0 +1,57 @@ +require 'constants' # for Verbosity enumeration & $stderr redirect enumeration + +class ToolExecutorHelper + + constructor :streaminator, :system_wrapper + + def osify_path_separators(executable) + return executable.gsub(/\//, '\\') if (@system_wrapper.is_windows?) + return executable + end + + def stderr_redirect_addendum(tool_config) + return nil if (tool_config[:stderr_redirect].nil?) + + redirect = tool_config[:stderr_redirect] + + case redirect + # we may need more complicated processing after some learning with various environments + when StdErrRedirect::NONE then nil + when StdErrRedirect::AUTO then '2>&1' + when StdErrRedirect::WIN then '2>&1' + when StdErrRedirect::UNIX then '2>&1' + when StdErrRedirect::TCSH then '|&' + else redirect.to_s + end + end + + # if command succeeded and we have verbosity cranked up, spill our guts + def print_happy_results(command_str, shell_result) + if (shell_result[:exit_code] == 0) + output = "> Shell executed command:\n" + output += "#{command_str}\n" + output += "> Produced response:\n" if (not shell_result[:output].empty?) + output += "#{shell_result[:output].strip}\n" if (not shell_result[:output].empty?) + output += "\n" + + @streaminator.stdout_puts(output, Verbosity::OBNOXIOUS) + end + end + + # if command failed and we have verbosity set to minimum error level, spill our guts + def print_error_results(command_str, shell_result) + if (shell_result[:exit_code] != 0) + output = "ERROR: Shell command failed.\n" + output += "> Shell executed command:\n" + output += "'#{command_str}'\n" + output += "> Produced response:\n" if (not shell_result[:output].empty?) + output += "#{shell_result[:output].strip}\n" if (not shell_result[:output].empty?) + output += "> And exited with status: [#{shell_result[:exit_code]}].\n" if (shell_result[:exit_code] != nil) + output += "> And then likely crashed.\n" if (shell_result[:exit_code] == nil) + output += "\n" + + @streaminator.stderr_puts(output, Verbosity::ERRORS) + end + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/lib/verbosinator.rb b/flex-bison/clcalc/tools/ceedling/lib/verbosinator.rb new file mode 100644 index 0000000..e8ed38d --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/verbosinator.rb @@ -0,0 +1,10 @@ + +class Verbosinator + + constructor :configurator + + def should_output?(level) + return (level <= @configurator.project_verbosity) + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/lib/yaml_wrapper.rb b/flex-bison/clcalc/tools/ceedling/lib/yaml_wrapper.rb new file mode 100644 index 0000000..77cef59 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/lib/yaml_wrapper.rb @@ -0,0 +1,16 @@ +require 'yaml' + + +class YamlWrapper + + def load(filepath) + return YAML.load(File.read(filepath)) + end + + def dump(filepath, structure) + File.open(filepath, 'w') do |output| + YAML.dump(structure, output) + end + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/plugins/stdout_ide_tests_report/stdout_ide_tests_report.rb b/flex-bison/clcalc/tools/ceedling/plugins/stdout_ide_tests_report/stdout_ide_tests_report.rb new file mode 100644 index 0000000..f76ec14 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/plugins/stdout_ide_tests_report/stdout_ide_tests_report.rb @@ -0,0 +1,44 @@ +require 'plugin' +require 'defaults' + +class StdoutIdeTestsReport < Plugin + + def setup + @result_list = [] + end + + def post_test_execute(arg_hash) + return if not (arg_hash[:context] == TEST_CONTEXT) + + @result_list << arg_hash[:result_file] + end + + def post_build + return if (not @ceedling[:task_invoker].test_invoked?) + + results = @ceedling[:plugin_reportinator].assemble_test_results(@result_list) + hash = { + :header => '', + :results => results + } + + @ceedling[:plugin_reportinator].run_test_results_report(hash) do + message = '' + message = 'Unit test failures.' if (hash[:results[:counts][:failed] > 0) + message + end + end + + def summary + result_list = @ceedling[:file_path_utils].form_pass_results_filelist( PROJECT_TEST_RESULTS_PATH, COLLECTION_ALL_TESTS ) + + # get test results for only those tests in our configuration and of those only tests with results on disk + hash = { + :header => '', + :results => @ceedling[:plugin_reportinator].assemble_test_results(result_list, {:boom => false}) + } + + @ceedling[:plugin_reportinator].run_test_results_report(hash) + end + +end \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/plugins/stdout_ide_tests_report/stdout_ide_tests_report.yml b/flex-bison/clcalc/tools/ceedling/plugins/stdout_ide_tests_report/stdout_ide_tests_report.yml new file mode 100644 index 0000000..c25acf5 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/plugins/stdout_ide_tests_report/stdout_ide_tests_report.yml @@ -0,0 +1,4 @@ +--- +:plugins: + # tell Ceedling we got results display taken care of + :display_raw_test_results: FALSE diff --git a/flex-bison/clcalc/tools/ceedling/plugins/stdout_pretty_tests_report/stdout_pretty_tests_report.rb b/flex-bison/clcalc/tools/ceedling/plugins/stdout_pretty_tests_report/stdout_pretty_tests_report.rb new file mode 100644 index 0000000..1213a19 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/plugins/stdout_pretty_tests_report/stdout_pretty_tests_report.rb @@ -0,0 +1,108 @@ +require 'plugin' +require 'defaults' + +class StdoutPrettyTestsReport < Plugin + + def setup + @result_list = [] + + template = %q{ + % ignored = hash[:results][:counts][:ignored] + % failed = hash[:results][:counts][:failed] + % stdout_count = hash[:results][:counts][:stdout] + % header_prepend = ((hash[:header].length > 0) ? "#{hash[:header]}: " : '') + % banner_width = 25 + header_prepend.length # widest message + + % if (ignored > 0) + <%=@ceedling[:plugin_reportinator].generate_banner(header_prepend + 'IGNORED UNIT TEST SUMMARY')%> + % hash[:results][:ignores].each do |ignore| + [<%=ignore[:source][:file]%>] + % ignore[:collection].each do |item| + Test: <%=item[:test]%> + % if (not item[:message].empty?) + At line (<%=item[:line]%>): "<%=item[:message]%>" + % else + At line (<%=item[:line]%>) + % end + + % end + % end + % end + % if (failed > 0) + <%=@ceedling[:plugin_reportinator].generate_banner(header_prepend + 'FAILED UNIT TEST SUMMARY')%> + % hash[:results][:failures].each do |failure| + [<%=failure[:source][:file]%>] + % failure[:collection].each do |item| + Test: <%=item[:test]%> + % if (not item[:message].empty?) + At line (<%=item[:line]%>): "<%=item[:message]%>" + % else + At line (<%=item[:line]%>) + % end + + % end + % end + % end + % if (stdout_count > 0) + <%=@ceedling[:plugin_reportinator].generate_banner(header_prepend + 'UNIT TEST OTHER OUTPUT')%> + % hash[:results][:stdout].each do |string| + [<%=string[:source][:file]%>] + % string[:collection].each do |item| + - "<%=item%>" + % end + + % end + % end + % total_string = hash[:results][:counts][:total].to_s + % format_string = "%#{total_string.length}i" + <%=@ceedling[:plugin_reportinator].generate_banner(header_prepend + 'OVERALL UNIT TEST SUMMARY')%> + % if (hash[:results][:counts][:total] > 0) + TESTED: <%=hash[:results][:counts][:total].to_s%> + PASSED: <%=sprintf(format_string, hash[:results][:counts][:passed])%> + FAILED: <%=sprintf(format_string, failed)%> + IGNORED: <%=sprintf(format_string, ignored)%> + % else + + No tests executed. + % end + + }.left_margin + + @ceedling[:plugin_reportinator].register_test_results_template( template ) + end + + def post_test_execute(arg_hash) + return if not (arg_hash[:context] == TEST_CONTEXT) + + @result_list << arg_hash[:result_file] + end + + def post_build + return if not (@ceedling[:task_invoker].test_invoked?) + + results = @ceedling[:plugin_reportinator].assemble_test_results(@result_list) + hash = { + :header => '', + :results => results + } + + @ceedling[:plugin_reportinator].run_test_results_report(hash) do + message = '' + message = 'Unit test failures.' if (results[:counts][:failed] > 0) + message + end + end + + def summary + result_list = @ceedling[:file_path_utils].form_pass_results_filelist( PROJECT_TEST_RESULTS_PATH, COLLECTION_ALL_TESTS ) + + # get test results for only those tests in our configuration and of those only tests with results on disk + hash = { + :header => '', + :results => @ceedling[:plugin_reportinator].assemble_test_results(result_list, {:boom => false}) + } + + @ceedling[:plugin_reportinator].run_test_results_report(hash) + end + +end \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/plugins/stdout_pretty_tests_report/stdout_pretty_tests_report.yml b/flex-bison/clcalc/tools/ceedling/plugins/stdout_pretty_tests_report/stdout_pretty_tests_report.yml new file mode 100644 index 0000000..c25acf5 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/plugins/stdout_pretty_tests_report/stdout_pretty_tests_report.yml @@ -0,0 +1,4 @@ +--- +:plugins: + # tell Ceedling we got results display taken care of + :display_raw_test_results: FALSE diff --git a/flex-bison/clcalc/tools/ceedling/plugins/xml_tests_report/xml_tests_report.rb b/flex-bison/clcalc/tools/ceedling/plugins/xml_tests_report/xml_tests_report.rb new file mode 100644 index 0000000..4aa4f77 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/plugins/xml_tests_report/xml_tests_report.rb @@ -0,0 +1,106 @@ +require 'plugin' +require 'constants' + +class XmlTestsReport < Plugin + + def setup + @file_path = File.join( PROJECT_TEST_ARTIFACTS_PATH, 'report.xml' ) + @results_list = [] + @test_counter = 1 + end + + def post_test_execute(arg_hash) + return if not (arg_hash[:context] == TEST_TASKS_CONTEXT) + + @results_list << arg_hash[:result_file] + end + + def post_build + return if (not @ceedling[:task_invoker].test_invoked?) + + results = @ceedling[:plugin_reportinator].assemble_test_results(@results_list) + + @ceedling[:file_wrapper].open( @file_path, 'w' ) do |f| + write_results( results, f ) + end + end + + private + + def write_results( results, stream ) + write_header( stream ) + write_failures( results[:failures], stream ) + write_tests( results[:successes], stream, 'SuccessfulTests' ) + write_tests( results[:ignores], stream, 'IgnoredTests' ) + write_statistics( results[:counts], stream ) + write_footer( stream ) + end + + def write_header( stream ) + stream.puts "" + stream.puts "" + end + + def write_failures( results, stream ) + if (results.size == 0) + stream.puts "\t" + return + end + + stream.puts "\t" + + results.each do |result| + result[:collection].each do |item| + filename = File.join( result[:source][:path], result[:source][:file] ) + + stream.puts "\t\t" + stream.puts "\t\t\t#{filename}::#{item[:test]}" + stream.puts "\t\t\tAssertion" + stream.puts "\t\t\t" + stream.puts "\t\t\t\t#{filename}" + stream.puts "\t\t\t\t#{item[:line]}" + stream.puts "\t\t\t" + stream.puts "\t\t\t#{item[:message]}" + stream.puts "\t\t" + @test_counter += 1 + end + end + + stream.puts "\t" + end + + def write_tests( results, stream, tag ) + if (results.size == 0) + stream.puts "\t<#{tag}/>" + return + end + + stream.puts "\t<#{tag}>" + + results.each do |result| + result[:collection].each do |item| + stream.puts "\t\t" + stream.puts "\t\t\t#{File.join( result[:source][:path], result[:source][:file] )}::#{item[:test]}" + stream.puts "\t\t" + @test_counter += 1 + end + end + + stream.puts "\t" + end + + def write_statistics( counts, stream ) + stream.puts "\t" + stream.puts "\t\t#{counts[:total]}" + stream.puts "\t\t#{counts[:ignored]}" + stream.puts "\t\t#{counts[:failed]}" + stream.puts "\t\t0" + stream.puts "\t\t#{counts[:failed]}" + stream.puts "\t" + end + + def write_footer( stream ) + stream.puts "" + end + +end \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/release/build.info b/flex-bison/clcalc/tools/ceedling/release/build.info new file mode 100644 index 0000000..fa8f08c --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/release/build.info @@ -0,0 +1 @@ +150 diff --git a/flex-bison/clcalc/tools/ceedling/release/version.info b/flex-bison/clcalc/tools/ceedling/release/version.info new file mode 100644 index 0000000..9a7d84f --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/release/version.info @@ -0,0 +1 @@ +0.9 \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/behaviors/Manifest.txt b/flex-bison/clcalc/tools/ceedling/vendor/behaviors/Manifest.txt new file mode 100644 index 0000000..6c954ec --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/behaviors/Manifest.txt @@ -0,0 +1,9 @@ +Manifest.txt +Rakefile +lib/behaviors.rb +lib/behaviors/reporttask.rb +test/behaviors_tasks_test.rb +test/behaviors_test.rb +test/tasks_test/lib/user.rb +test/tasks_test/Rakefile +test/tasks_test/test/user_test.rb diff --git a/flex-bison/clcalc/tools/ceedling/vendor/behaviors/Rakefile b/flex-bison/clcalc/tools/ceedling/vendor/behaviors/Rakefile new file mode 100644 index 0000000..d4d68b9 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/behaviors/Rakefile @@ -0,0 +1,19 @@ +require 'rake' +require 'rubygems' +require 'hoe' + +Hoe.new('behaviors','1.0.3') do |p| + p.author = "Atomic Object LLC" + p.email = "dev@atomicobject.com" + p.url = "http://behaviors.rubyforge.org" + p.summary = "behavior-driven unit test helper" + p.description = <<-EOS +Behaviors allows for Test::Unit test case methods to be defined as +human-readable descriptions of program behavior. It also provides +Rake tasks to list the behaviors of your project. + EOS + p.test_globs = ['test/*_test.rb'] + + p.changes = <<-EOS + EOS +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/behaviors/lib/behaviors.rb b/flex-bison/clcalc/tools/ceedling/vendor/behaviors/lib/behaviors.rb new file mode 100644 index 0000000..d8d70f7 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/behaviors/lib/behaviors.rb @@ -0,0 +1,76 @@ +=begin rdoc += Usage +Behaviors provides a single method: should. + +Instead of naming test methods like: + + def test_something + end + +You declare test methods like: + + should "perform action" do + end + +You may omit the body of a should method to describe unimplemented behavior. + + should "perform other action" + +When you run your unit tests, empty should methods will appear as an 'UNIMPLEMENTED CASE' along with the described behavior. +This is useful for sketching out planned behavior quickly. + +Simply extend Behaviors in your TestCase to start using behaviors. + + require 'test/unit' + require 'behaviors' + require 'user' + + class UserTest < Test::Unit::TestCase + extend Behaviors + ... + end + += Motivation +Test methods typically focus on the name of the method under test instead of its behavior. +Creating test methods with should statements focuses on the behavior of an object. +This helps you to think about the role of the object under test. + +Using a behavior-driven approach prevents the danger in assuming a one-to-one mapping of method names to +test method names. +As always, you get the most value by writing the tests first. + +For a more complete BDD framework, try RSpec http://rspec.rubyforge.org/ + += Rake tasks + +You can define a Behaviors::ReportTask in your Rakefile to generate rake tasks that +summarize the behavior of your project. + +These tasks are named behaviors and behaviors_html. They will output to the +console or an html file in the doc directory with a list all of your should tests. + Behaviors::ReportTask.new do |t| + t.pattern = 'test/**/*_test.rb' + end + +You may also initialize the ReportTask with a custom name to associate with a particular suite of tests. + Behaviors::ReportTask.new(:widget_subsystem) do |t| + t.pattern = 'test/widgets/*_test.rb' + end + +The html report will be placed in the doc directory by default. +You can override this default by setting the html_dir in the ReportTask. + Behaviors::ReportTask.new do |t| + t.pattern = 'test/**/*_test.rb' + t.html_dir = 'behaviors_html_reports' + end +=end +module Behaviors + def should(behave,&block) + mname = "test_should_#{behave}" + if block + define_method mname, &block + else + puts ">>> UNIMPLEMENTED CASE: #{name.sub(/Test$/,'')} should #{behave}" + end + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/behaviors/lib/behaviors/reporttask.rb b/flex-bison/clcalc/tools/ceedling/vendor/behaviors/lib/behaviors/reporttask.rb new file mode 100644 index 0000000..51c0eca --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/behaviors/lib/behaviors/reporttask.rb @@ -0,0 +1,158 @@ +require 'rake' +require 'rake/tasklib' + +module Behaviors +include Rake + + class ReportTask < TaskLib + attr_accessor :pattern + attr_accessor :html_dir + + def initialize(name=:behaviors) + @name = name + @html_dir = 'doc' + yield self if block_given? + define + end + + def define + desc "List behavioral definitions for the classes specified (use for= to further limit files included in report)" + task @name do + specifications.each do |spec| + puts "#{spec.name} should:\n" + spec.requirements.each do |req| + puts " - #{req}" + end + end + end + + desc "Generate html report of behavioral definitions for the classes specified (use for= to further limit files included in report)" + task "#{@name}_html" do + require 'erb' + txt =<<-EOS + + + + + +
Specifications
+<% specifications.each do |spec| %> +
+<%= spec.name %> should: +
    +<% spec.requirements.each do |req| %> +
  • <%= req %>
  • +<% end %> +
+
+<% end %> + + + EOS + output_dir = File.expand_path(@html_dir) + mkdir_p output_dir + output_filename = output_dir + "/behaviors.html" + File.open(output_filename,"w") do |f| + f.write ERB.new(txt).result(binding) + end + puts "(Wrote #{output_filename})" + end + end + + private + def test_files + test_list = FileList[@pattern] + if ENV['for'] + test_list = test_list.grep(/#{ENV['for']}/i) + end + test_list + end + + def specifications + test_files.map do |file| + spec = OpenStruct.new + m = %r".*/([^/].*)_test.rb".match(file) + class_name = titleize(m[1]) if m[1] + spec.name = class_name + spec.requirements = [] + File::readlines(file).each do |line| + if line =~ /^\s*should\s+\(?\s*["'](.*)["']/ + spec.requirements << $1 + end + end + spec + end + end + + ############################################################ + # STOLEN FROM inflector.rb + ############################################################ + #-- + # Copyright (c) 2005 David Heinemeier Hansson + # + # Permission is hereby granted, free of charge, to any person obtaining + # a copy of this software and associated documentation files (the + # "Software"), to deal in the Software without restriction, including + # without limitation the rights to use, copy, modify, merge, publish, + # distribute, sublicense, and/or sell copies of the Software, and to + # permit persons to whom the Software is furnished to do so, subject to + # the following conditions: + # + # The above copyright notice and this permission notice shall be + # included in all copies or substantial portions of the Software. + # + # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + #++ + def titleize(word) + humanize(underscore(word)).gsub(/\b([a-z])/) { $1.capitalize } + end + + def underscore(camel_cased_word) camel_cased_word.to_s.gsub(/::/, '/'). + gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').gsub(/([a-z\d])([A-Z])/,'\1_\2').tr("-", "_").downcase + end + + def humanize(lower_case_and_underscored_word) + lower_case_and_underscored_word.to_s.gsub(/_id$/, "").gsub(/_/, " ").capitalize + end + + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/behaviors/test/behaviors_tasks_test.rb b/flex-bison/clcalc/tools/ceedling/vendor/behaviors/test/behaviors_tasks_test.rb new file mode 100644 index 0000000..9382e07 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/behaviors/test/behaviors_tasks_test.rb @@ -0,0 +1,73 @@ +require 'test/unit' +require 'fileutils' + +class BehaviorsTasksTest < Test::Unit::TestCase + include FileUtils + + def setup + @here = File.expand_path(File.dirname(__FILE__)) + @base_cmd = RUBY_PLATFORM[/mswin/] ? 'rake.cmd ' : 'rake ' + end + + # + # HELPERS + # + def run_behaviors_task + run_cmd "behaviors" + end + + def run_behaviors_html_task + run_cmd "behaviors_html" + end + + def run_cmd(cmd) + cd "#{@here}/tasks_test" do + @report = %x[ #{@base_cmd} #{cmd} ] + end + end + + def see_html_task_output_message + @html_output_filename = "#{@here}/tasks_test/behaviors_doc/behaviors.html" + assert_match(/Wrote #{@html_output_filename}/, @report) + end + + def see_that_html_report_file_exits + assert File.exists?(@html_output_filename), "html output file should exist" + end + + def html_report_file_should_contain(user_behaviors) + file_contents = File.read(@html_output_filename) + user_behaviors.each do |line| + assert_match(/#{line}/, file_contents) + end + rm_rf File.dirname(@html_output_filename) + end + + # + # TESTS + # + def test_that_behaviors_tasks_should_list_behavioral_definitions_for_the_classes_under_test + run_behaviors_task + user_behaviors = [ + "User should:", + " - be able set user name and age during construction", + " - be able to get user name and age", + " - be able to ask if a user is an adult" + ] + assert_match(/#{user_behaviors.join("\n")}/, @report) + end + + def test_that_behaviors_tasks_should_list_behavioral_definitions_for_the_classes_under_test_in_html_output + run_behaviors_html_task + see_html_task_output_message + see_that_html_report_file_exits + user_behaviors = [ + "User should:", + "be able set user name and age during construction", + "be able to get user name and age", + "be able to ask if a user is an adult" + ] + html_report_file_should_contain user_behaviors + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/behaviors/test/behaviors_test.rb b/flex-bison/clcalc/tools/ceedling/vendor/behaviors/test/behaviors_test.rb new file mode 100644 index 0000000..fd0a77f --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/behaviors/test/behaviors_test.rb @@ -0,0 +1,50 @@ +require 'test/unit' +require File.expand_path(File.dirname(__FILE__)) + '/../lib/behaviors' +require 'stringio' + +loading_developer_test_class_stdout = StringIO.new +saved_stdout = $stdout.dup +$stdout = loading_developer_test_class_stdout + +class DeveloperTest + extend Behaviors + attr_accessor :flunk_msg, :tested_code + + should "test their code" do + @tested_code = true + end + should "go to meetings" +end + +$stdout = saved_stdout +loading_developer_test_class_stdout.rewind +$loading_developer_test_class_output = loading_developer_test_class_stdout.read + +class BehaviorsTest < Test::Unit::TestCase + + + def setup + @target = DeveloperTest.new + assert_nil @target.tested_code, "block called too early" + end + + # + # TESTS + # + def test_should_called_with_a_block_defines_a_test + assert @target.methods.include?("test_should_test their code"), "Missing test method" + + @target.send("test_should_test their code") + + assert @target.tested_code, "block not called" + end + + def test_should_called_without_a_block_does_not_create_a_test_method + assert !@target.methods.include?("test_should_go to meetings"), "Should not have method" + end + + def test_should_called_without_a_block_will_give_unimplemented_output_when_class_loads + unimplemented_output = "UNIMPLEMENTED CASE: Developer should go to meetings" + assert_match(/#{unimplemented_output}/, $loading_developer_test_class_output) + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/behaviors/test/tasks_test/Rakefile b/flex-bison/clcalc/tools/ceedling/vendor/behaviors/test/tasks_test/Rakefile new file mode 100644 index 0000000..ba71f71 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/behaviors/test/tasks_test/Rakefile @@ -0,0 +1,19 @@ +require 'rake' +require 'rake/testtask' + +here = File.expand_path(File.dirname(__FILE__)) +require "#{here}/../../lib/behaviors/reporttask" + +desc 'Default: run unit tests.' +task :default => :test + +Rake::TestTask.new(:test) do |t| + t.libs << "#{here}/../../lib" + t.pattern = 'test/**/*_test.rb' + t.verbose = true +end + +Behaviors::ReportTask.new(:behaviors) do |t| + t.pattern = 'test/**/*_test.rb' + t.html_dir = 'behaviors_doc' +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/behaviors/test/tasks_test/lib/user.rb b/flex-bison/clcalc/tools/ceedling/vendor/behaviors/test/tasks_test/lib/user.rb new file mode 100644 index 0000000..40bc07c --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/behaviors/test/tasks_test/lib/user.rb @@ -0,0 +1,2 @@ +class User +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/behaviors/test/tasks_test/test/user_test.rb b/flex-bison/clcalc/tools/ceedling/vendor/behaviors/test/tasks_test/test/user_test.rb new file mode 100644 index 0000000..ad3cd1b --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/behaviors/test/tasks_test/test/user_test.rb @@ -0,0 +1,17 @@ +require 'test/unit' +require 'behaviors' + +require 'user' + +class UserTest < Test::Unit::TestCase + extend Behaviors + + def setup + end + + should "be able set user name and age during construction" + should "be able to get user name and age" + should "be able to ask if a user is an adult" + def test_DELETEME + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/docs/CExceptionSummary.odt b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/docs/CExceptionSummary.odt new file mode 100644 index 0000000..ea852a0 Binary files /dev/null and b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/docs/CExceptionSummary.odt differ diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/docs/CExceptionSummary.pdf b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/docs/CExceptionSummary.pdf new file mode 100644 index 0000000..a838337 Binary files /dev/null and b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/docs/CExceptionSummary.pdf differ diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/docs/license.txt b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/docs/license.txt new file mode 100644 index 0000000..561e5f2 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/docs/license.txt @@ -0,0 +1,30 @@ + Copyright (c) 2007 Mark VanderVoord + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + The end-user documentation included with the redistribution, if + any, must include the following acknowledgment: "This product + includes software developed for the CEXCeption Project, by Mark + VanderVoord and other contributors", in the same place and form + as other third-party acknowledgments. Alternately, this + acknowledgment may appear in the software itself, in the same + form and location as other such third-party acknowledgments. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/docs/readme.txt b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/docs/readme.txt new file mode 100644 index 0000000..92cac38 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/docs/readme.txt @@ -0,0 +1,236 @@ +==================================================================== +CException +==================================================================== + +CException is a basic exception framework for C, suitable for use in +embedded applications. It provides an exception framework similar in +use to C++, but with much less overhead. + +CException uses C standard library functions setjmp and longjmp to +operate. As long as the target system has these two functions defined, +this library should be useable with very little configuration. It +even supports environments where multiple program flows are in use, +such as real-time operating systems. + +There are about a gabillion exception frameworks using a similar +setjmp/longjmp method out there... and there will probably be more +in the future. Unfortunately, when we started our last embedded +project, all those that existed either (a) did not support multiple +tasks (therefore multiple stacks) or (b) were way more complex than +we really wanted. CException was born. + +Why use CException? + +0. It's ANSI C, and it beats passing error codes around. + +1. You want something simple... CException throws a single id. You can + define those ID's to be whatever you like. You might even choose which + type that number is for your project. But that's as far as it goes. + We weren't interested in passing objects or structs or strings... + just simple error codes. + +2. Performance... CException can be configured for single tasking or + multitasking. In single tasking, there is very little overhead past + the setjmp/longjmp calls (which are already fast). In multitasking, + your only additional overhead is the time it takes you to determine + a unique task id 0 - num_tasks. + +For the latest version, go to http://cexception.sourceforge.net + +-------------------------------------------------------------------- +CONTENTS OF THIS DOCUMENT +-------------------------------------------------------------------- + +Usage +Limitations +API +Configuration +Testing +License + +-------------------------------------------------------------------- +Usage +-------------------------------------------------------------------- + +Code that is to be protected are wrapped in Try { } Catch { } blocks. +The code directly following the Try call is "protected", meaning that +if any Throws occur, program control is directly transferred to the +start of the Catch block. + +A numerical exception ID is included with Throw, and is made accessible +from the Catch block. + +Throws can occur from within function calls (nested as deeply as you +like) or directly from within the function itself. + +-------------------------------------------------------------------- +Limitations +-------------------------------------------------------------------- + +This library was made to be as fast as possible, and provide basic +exception handling. It is not a full-blown exception library. Because +of this, there are a few limitations that should be observed in order +to successfully utilize this library: + +1. Do not directly "return" from within a Try block, nor "goto" + into or out of a Try block. + + Why? + + The "Try" macro allocates some local memory and alters a global + pointer. These are cleaned up at the top of the "Catch" macro. + Gotos and returns would bypass some of these steps, resulting in + memory leaks or unpredictable behavior. + +2. If (a) you change local (stack) variables within your Try block, + AND (b) wish to make use of the updated values after an exception + is thrown, those variables should be made volatile. Note that this + is ONLY for locals and ONLY when you need access to them after a + throw. + + Why? + + Compilers optimize. There is no way to guarantee that the actual + memory location was updated and not just a register unless the + variable is marked volatile. + +3. Memory which is malloc'd or new'd is not automatically released + when an error is thrown. This will sometimes be desirable, and + othertimes may not. It will be the responsibility of the Catch + block to perform this kind of cleanup. + + Why? + + There's just no easy way to track malloc'd memory, etc., without + replacing or wrapping malloc calls or something like that. This + is a light framework, so these options were not desirable. + +-------------------------------------------------------------------- +API +-------------------------------------------------------------------- + +Try +--- + +Try is a macro which starts a protected block. It MUST be followed by +a pair of braces or a single protected line (similar to an 'if'), +enclosing the data that is to be protected. It MUST be followed by a +Catch block (don't worry, you'll get compiler errors to let you know if +you mess any of that up). + +Catch(e) +-------- + +Catch is a macro which ends the Try block and starts the error handling +block. The catch block is called if and only if an exception was thrown +while within the Try block. This error was thrown by a Throw call +somewhere within Try (or within a function called within Try, or a function +called by a function called within Try, etc). + +The single parameter 'e' is filled with the error code which was thrown. +This can be used for reporting, conditional cleanup, etc. (or you can just +ignore it if you really want... people ignore return codes all the time, +right?). 'e' should be of type EXCEPTION_T; + +Throw(e) +-------- + +The method of throwing an error. Throws should only occur from within a +protected (Try...Catch) block, though it may easily be nested many function +calls deep without an impact on performance or functionality. Throw takes +a single argument, which is an exception id which will be passed to Catch +as the reason for the error. + +If you wish to Rethrow an error, this can be done by calling Throw(e) with +the error code you just caught. It IS valid to throw from a catch block. + +-------------------------------------------------------------------- +CONFIGURATION +-------------------------------------------------------------------- + +CException is a mostly portable library. It has one universal +dependency, and some macros which are required if working in a +multi-tasking environment. + +1. The standard C library setjmp must be available. Since this is part + of the standard library, chances are good that you'll be fine. + +2. If working in a multitasking environment, methods for obtaining an + index into an array of frames and to get the overall number of + id's are required. If the OS supports a method to retrieve Task + ID's, and those Tasks are number 0, 1, 2... you are in an ideal + situation. Otherwise, a more creative mapping function may be + required. Note that this function is likely to be called twice + for each protected block and once during a throw. This is the + only overhead in the system. + +Exception.h +----------------- +By convention, most projects include Exception.h which defines any +further requirements, then calls CException.h to do the gruntwork. All +of these are optional. You could directly include CException.h if +you wanted and just use the defaults provided. + +EXCEPTION_T - Set this to the type you want your exception id's + to be. Defaults to 'unsigned int'. + +EXCEPTION_NONE - Set this to a number which will never be an + exception id in your system. Defaults to 0x5a5a5a5a. + +EXCEPTION_GET_ID - If in a multi-tasking environment, this should be + set to be a call to the function described in #2 above. + Defaults to just return 0 all the time (good for + single tasking environments) + +EXCEPTION_NUM_ID - If in a multi-tasking environment, this should be set + to the number of ID's required (usually the number of + tasks in the system). Defaults to 1 (for single + tasking environments). + +You may also want to include any header files which will commonly be +needed by the rest of your application where it uses exception handling +here. For example, OS header files or exception codes would be useful. + +-------------------------------------------------------------------- +TESTING +-------------------------------------------------------------------- + +If you want to validate that CException works with your tools or that +it works with your custom configuration, you may want to run the test +suite. + +The test suite included makes use of the Unity Test Framework. It will +require a native C compiler. The example makefile uses MinGW's gcc. +Modify the makefile to include the proper paths to tools, then run 'make' +to compile and run the test application. + +C_COMPILER - The C compiler to use to perform the tests +C_LIBS - The path to the C libraries (including setjmp) +UNITY_DIR - The path to the Unity framework (required to run tests) + (get it at http://embunity.sourceforge.net) + +-------------------------------------------------------------------- +LICENSE +-------------------------------------------------------------------- + +This software is licensed under the MIT License + +Copyright (c) 2007 Mark VanderVoord + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/lib/CException.c b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/lib/CException.c new file mode 100644 index 0000000..57f5353 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/lib/CException.c @@ -0,0 +1,39 @@ +#include "CException.h" + +volatile CEXCEPTION_FRAME_T CExceptionFrames[CEXCEPTION_NUM_ID]; + +//------------------------------------------------------------------------------------------ +// Throw +//------------------------------------------------------------------------------------------ +void Throw(CEXCEPTION_T ExceptionID) +{ + unsigned int MY_ID = CEXCEPTION_GET_ID; + CExceptionFrames[MY_ID].Exception = ExceptionID; + longjmp(*CExceptionFrames[MY_ID].pFrame, 1); +} + +//------------------------------------------------------------------------------------------ +// Explaination of what it's all for: +//------------------------------------------------------------------------------------------ +/* +#define Try + { <- give us some local scope. most compilers are happy with this + jmp_buf *PrevFrame, NewFrame; <- prev frame points to the last try block's frame. new frame gets created on stack for this Try block + unsigned int MY_ID = CEXCEPTION_GET_ID; <- look up this task's id for use in frame array. always 0 if single-tasking + PrevFrame = CExceptionFrames[CEXCEPTION_GET_ID].pFrame; <- set pointer to point at old frame (which array is currently pointing at) + CExceptionFrames[MY_ID].pFrame = &NewFrame; <- set array to point at my new frame instead, now + CExceptionFrames[MY_ID].Exception = CEXCEPTION_NONE; <- initialize my exception id to be NONE + if (setjmp(NewFrame) == 0) { <- do setjmp. it returns 1 if longjump called, otherwise 0 + if (&PrevFrame) <- this is here to force proper scoping. it requires braces or a single line to be but after Try, otherwise won't compile. This is always true at this point. + +#define Catch(e) + else { } <- this also forces proper scoping. Without this they could stick their own 'else' in and it would get ugly + CExceptionFrames[MY_ID].Exception = CEXCEPTION_NONE; <- no errors happened, so just set the exception id to NONE (in case it was corrupted) + } + else <- an exception occurred + { e = CExceptionFrames[MY_ID].Exception; e=e;} <- assign the caught exception id to the variable passed in. + CExceptionFrames[MY_ID].pFrame = PrevFrame; <- make the pointer in the array point at the previous frame again, as if NewFrame never existed. + } <- finish off that local scope we created to have our own variables + if (CExceptionFrames[CEXCEPTION_GET_ID].Exception != CEXCEPTION_NONE) <- start the actual 'catch' processing if we have an exception id saved away + */ + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/lib/CException.h b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/lib/CException.h new file mode 100644 index 0000000..40c6fc7 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/lib/CException.h @@ -0,0 +1,70 @@ +#ifndef _CEXCEPTION_H +#define _CEXCEPTION_H + +#include + +//To Use CException, you have a number of options: +//1. Just include it and run with the defaults +//2. Define any of the following symbols at the command line to override them +//3. Include a header file before CException.h everywhere which defines any of these +//4. Create an Exception.h in your path, and just define EXCEPTION_USE_CONFIG_FILE first + +#ifdef CEXCEPTION_USE_CONFIG_FILE +#include "CExceptionConfig.h" +#endif + +//This is the value to assign when there isn't an exception +#ifndef CEXCEPTION_NONE +#define CEXCEPTION_NONE (0x5A5A5A5A) +#endif + +//This is number of exception stacks to keep track of (one per task) +#ifndef CEXCEPTION_NUM_ID +#define CEXCEPTION_NUM_ID (1) //there is only the one stack by default +#endif + +//This is the method of getting the current exception stack index (0 if only one stack) +#ifndef CEXCEPTION_GET_ID +#define CEXCEPTION_GET_ID (0) //use the first index always because there is only one anyway +#endif + +//The type to use to store the exception values. +#ifndef CEXCEPTION_T +#define CEXCEPTION_T unsigned int +#endif + +//exception frame structures +typedef struct { + jmp_buf* pFrame; + volatile CEXCEPTION_T Exception; +} CEXCEPTION_FRAME_T; + +//actual root frame storage (only one if single-tasking) +extern volatile CEXCEPTION_FRAME_T CExceptionFrames[]; + +//Try (see C file for explanation) +#define Try \ + { \ + jmp_buf *PrevFrame, NewFrame; \ + unsigned int MY_ID = CEXCEPTION_GET_ID; \ + PrevFrame = CExceptionFrames[CEXCEPTION_GET_ID].pFrame; \ + CExceptionFrames[MY_ID].pFrame = (jmp_buf*)(&NewFrame); \ + CExceptionFrames[MY_ID].Exception = CEXCEPTION_NONE; \ + if (setjmp(NewFrame) == 0) { \ + if (&PrevFrame) + +//Catch (see C file for explanation) +#define Catch(e) \ + else { } \ + CExceptionFrames[MY_ID].Exception = CEXCEPTION_NONE; \ + } \ + else \ + { e = CExceptionFrames[MY_ID].Exception; e=e; } \ + CExceptionFrames[MY_ID].pFrame = PrevFrame; \ + } \ + if (CExceptionFrames[CEXCEPTION_GET_ID].Exception != CEXCEPTION_NONE) + +//Throw an Error +void Throw(CEXCEPTION_T ExceptionID); + +#endif // _CEXCEPTION_H diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/makefile b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/makefile new file mode 100644 index 0000000..c168a41 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/makefile @@ -0,0 +1,24 @@ +#Tool and Lib Locations +C_COMPILER=gcc +C_LIBS=C:/MinGW/lib +UNITY_DIR=vendor/unity/src + +#Test File To Be Created +OUT_FILE=test_cexceptions +ifeq ($(OS),Windows_NT) +OUT_EXTENSION=.exe +else +OUT_EXTENSION=.out +endif + +#Options +SRC_FILES=lib/CException.c test/TestException.c test/TestException_Runner.c $(UNITY_DIR)/unity.c +INC_DIRS=-Ilib -Itest -I$(UNITY_DIR) +LIB_DIRS=-L$(C_LIBS) +SYMBOLS=-DTEST -DEXCEPTION_USE_CONFIG_FILE + +#Default Task: Compile And Run Tests +default: + $(C_COMPILER) $(INC_DIRS) $(LIB_DIRS) $(SYMBOLS) $(SRC_FILES) -o $(OUT_FILE)$(OUT_EXTENSION) + $(OUT_FILE)$(OUT_EXTENSION) + \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/rakefile.rb b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/rakefile.rb new file mode 100644 index 0000000..2458c6f --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/rakefile.rb @@ -0,0 +1,41 @@ +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require HERE+'vendor/unity/auto/colour_reporter.rb' + +#Tool and Lib Locations +C_COMPILER = 'gcc' +C_LIBS = '' +UNITY_DIR = 'vendor/unity/src' + +#Test File To Be Created +OUT_FILE = 'test_cexceptions' +OUT_EXTENSION = '.out' + +#Options +SRC_FILES = "lib/CException.c test/TestException.c test/TestException_Runner.c #{UNITY_DIR}/unity.c" +INC_DIRS = "-Ilib -Itest -I#{UNITY_DIR}" +LIB_DIRS = C_LIBS.empty? ? '' : "-L#{C_LIBS}" +SYMBOLS = '-DTEST -DEXCEPTION_USE_CONFIG_FILE' + +CLEAN.include("#{HERE}*.out") + +task :default => [:clobber, :test] +task :cruise => [:no_color, :default] + +desc "performs a quick set of unit tests to confirm you're ready to go" +task :test do + report "#{C_COMPILER} #{INC_DIRS} #{LIB_DIRS} #{SYMBOLS} #{SRC_FILES} -o #{OUT_FILE}#{OUT_EXTENSION}" + output = `#{C_COMPILER} #{INC_DIRS} #{LIB_DIRS} #{SYMBOLS} #{SRC_FILES} -o #{OUT_FILE}#{OUT_EXTENSION}` + report output + + report "#{HERE}#{OUT_FILE}#{OUT_EXTENSION}" + output = `#{HERE}#{OUT_FILE}#{OUT_EXTENSION}` + report output +end + +task :no_color do + $colour_output = false +end \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/release/build.info b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/release/build.info new file mode 100644 index 0000000..b5794c5 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/release/build.info @@ -0,0 +1,2 @@ +16 + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/release/version.info b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/release/version.info new file mode 100644 index 0000000..cb7e5f6 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/release/version.info @@ -0,0 +1,2 @@ +1.2.0 + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/test/CExceptionConfig.h b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/test/CExceptionConfig.h new file mode 100644 index 0000000..79b085d --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/test/CExceptionConfig.h @@ -0,0 +1,27 @@ +#ifndef _EXCEPTION_H +#define _EXCEPTION_H + +//Optionally define the exception type (something like an int which can be directly assigned) +#define CEXCEPTION_T int + +// Optionally define the reserved value representing NO EXCEPTION +#define CEXCEPTION_NONE (1234) + +// Multi-Tasking environments will need a couple of macros defined to make this library +// properly handle multiple exception stacks. You will need to include and required +// definitions, then define the following macros: +// EXCEPTION_GET_ID - returns the id of the current task indexed 0 to (numtasks - 1) +// EXCEPTION_NUM_ID - returns the number of tasks that might be returned +// +// For example, Quadros might include the following implementation: +#ifndef TEST +#include "OSAPI.h" +#define CEXCEPTION_GET_ID (KS_GetTaskID()) +#define CEXCEPTION_NUM_ID (NTASKS + 1) +#endif + +//This could be a good place to define/include some error ID's: +#define ERROR_ID_EVERYTHING_IS_BROKEN (0x88) +#define ERROR_ID_ONLY_THIS_IS_BROKEN (0x77) + +#endif // _EXCEPTION_H diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/test/TestException.c b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/test/TestException.c new file mode 100644 index 0000000..704cfdb --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/test/TestException.c @@ -0,0 +1,291 @@ +#include "unity.h" +#include "CException.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void test_BasicTryDoesNothingIfNoThrow(void) +{ + int i; + CEXCEPTION_T e = 0x5a; + + Try + { + i += 1; + } + Catch(e) + { + TEST_FAIL_MESSAGE("Should Not Enter Catch If Not Thrown") + } + + //verify that e was untouched + TEST_ASSERT_EQUAL(0x5a, e); +} + +void test_BasicThrowAndCatch(void) +{ + CEXCEPTION_T e; + + Try + { + Throw(0xBE); + TEST_FAIL_MESSAGE("Should Have Thrown An Error") + } + Catch(e) + { + //verify that e has the right data + TEST_ASSERT_EQUAL(0xBE, e); + } + + //verify that e STILL has the right data + TEST_ASSERT_EQUAL(0xBE, e); +} + +void test_BasicThrowAndCatch_WithMiniSyntax(void) +{ + CEXCEPTION_T e; + + //Mini Throw and Catch + Try + Throw(0xEF); + Catch(e) + TEST_ASSERT_EQUAL(0xEF, e); + TEST_ASSERT_EQUAL(0xEF, e); + + //Mini Passthrough + Try + e = 0; + Catch(e) + TEST_FAIL_MESSAGE("I shouldn't be caught because there was no throw"); + + TEST_ASSERT_EQUAL(0, e); +} + +void test_VerifyVolatilesSurviveThrowAndCatch(void) +{ + volatile unsigned int VolVal = 0; + CEXCEPTION_T e; + + Try + { + VolVal = 2; + Throw(0xBF); + TEST_FAIL_MESSAGE("Should Have Thrown An Error") + } + Catch(e) + { + VolVal += 2; + TEST_ASSERT_EQUAL(0xBF, e); + } + + TEST_ASSERT_EQUAL(4, VolVal); + TEST_ASSERT_EQUAL(0xBF, e); +} + +void HappyExceptionThrower(unsigned int ID) +{ + if (ID != 0) + { + Throw(ID); + } +} + +void test_ThrowFromASubFunctionAndCatchInRootFunc(void) +{ + volatile unsigned int ID = 0; + CEXCEPTION_T e; + + Try + { + + HappyExceptionThrower(0xBA); + TEST_FAIL_MESSAGE("Should Have Thrown An Exception"); + } + Catch(e) + { + ID = e; + } + + //verify that I can pass that value to something else + TEST_ASSERT_EQUAL(0xBA, e); +} + +void HappyExceptionRethrower(unsigned int ID) +{ + CEXCEPTION_T e; + + Try + { + Throw(ID); + } + Catch(e) + { + switch (e) + { + case 0xBD: + Throw(0xBF); + break; + default: + break; + } + } +} + +void test_ThrowAndCatchFromASubFunctionAndRethrowToCatchInRootFunc(void) +{ + volatile unsigned int ID = 0; + CEXCEPTION_T e; + + Try + { + HappyExceptionRethrower(0xBD); + TEST_FAIL_MESSAGE("Should Have Rethrown Exception"); + } + Catch(e) + { + ID = 1; + } + + TEST_ASSERT_EQUAL(0xBF, e); + TEST_ASSERT_EQUAL(1, ID); +} + +void test_ThrowAndCatchFromASubFunctionAndNoRethrowToCatchInRootFunc(void) +{ + CEXCEPTION_T e = 3; + + Try + { + HappyExceptionRethrower(0xBF); + } + Catch(e) + { + TEST_FAIL_MESSAGE("Should Not Have Re-thrown Error (it should have already been caught)"); + } + + //verify that THIS e is still untouched, even though subfunction was touched + TEST_ASSERT_EQUAL(3, e); +} + +void test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThisDoesntCorruptExceptionId(void) +{ + CEXCEPTION_T e; + + Try + { + HappyExceptionThrower(0xBF); + TEST_FAIL_MESSAGE("Should Have Thrown Exception"); + } + Catch(e) + { + TEST_ASSERT_EQUAL(0xBF, e); + HappyExceptionRethrower(0x12); + TEST_ASSERT_EQUAL(0xBF, e); + } + TEST_ASSERT_EQUAL(0xBF, e); +} + +void test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThatEachExceptionIdIndependent(void) +{ + CEXCEPTION_T e1, e2; + + Try + { + HappyExceptionThrower(0xBF); + TEST_FAIL_MESSAGE("Should Have Thrown Exception"); + } + Catch(e1) + { + TEST_ASSERT_EQUAL(0xBF, e1); + Try + { + HappyExceptionThrower(0x12); + } + Catch(e2) + { + TEST_ASSERT_EQUAL(0x12, e2); + } + TEST_ASSERT_EQUAL(0x12, e2); + TEST_ASSERT_EQUAL(0xBF, e1); + } + TEST_ASSERT_EQUAL(0x12, e2); + TEST_ASSERT_EQUAL(0xBF, e1); +} + +void test_CanHaveMultipleTryBlocksInASingleFunction(void) +{ + CEXCEPTION_T e; + + Try + { + HappyExceptionThrower(0x01); + TEST_FAIL_MESSAGE("Should Have Thrown Exception"); + } + Catch(e) + { + TEST_ASSERT_EQUAL(0x01, e); + } + + Try + { + HappyExceptionThrower(0xF0); + TEST_FAIL_MESSAGE("Should Have Thrown Exception"); + } + Catch(e) + { + TEST_ASSERT_EQUAL(0xF0, e); + } +} + +void test_CanHaveNestedTryBlocksInASingleFunction_ThrowInside(void) +{ + int i = 0; + CEXCEPTION_T e; + + Try + { + Try + { + HappyExceptionThrower(0x01); + i = 1; + TEST_FAIL_MESSAGE("Should Have Rethrown Exception"); + } + Catch(e) + { + TEST_ASSERT_EQUAL(0x01, e); + } + } + Catch(e) + { + TEST_FAIL_MESSAGE("Should Have Been Caught By Inside Catch"); + } +} + +void test_CanHaveNestedTryBlocksInASingleFunction_ThrowOutside(void) +{ + int i = 0; + CEXCEPTION_T e; + + Try + { + Try + { + i = 2; + } + Catch(e) + { + TEST_FAIL_MESSAGE("Should NotBe Caught Here"); + } + HappyExceptionThrower(0x01); + TEST_FAIL_MESSAGE("Should Have Rethrown Exception"); + } + Catch(e) + { + TEST_ASSERT_EQUAL(0x01, e); + } +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/test/TestException_Runner.c b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/test/TestException_Runner.c new file mode 100644 index 0000000..1697a0e --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/test/TestException_Runner.c @@ -0,0 +1,62 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ +#include "unity.h" +#include "CException.h" + +extern void setUp(void); +extern void tearDown(void); + +extern void test_BasicTryDoesNothingIfNoThrow(void); +extern void test_BasicThrowAndCatch(void); +extern void test_BasicThrowAndCatch_WithMiniSyntax(void); +extern void test_VerifyVolatilesSurviveThrowAndCatch(void); +extern void test_ThrowFromASubFunctionAndCatchInRootFunc(void); +extern void test_ThrowAndCatchFromASubFunctionAndRethrowToCatchInRootFunc(void); +extern void test_ThrowAndCatchFromASubFunctionAndNoRethrowToCatchInRootFunc(void); +extern void test_CanHaveMultipleTryBlocksInASingleFunction(void); +extern void test_CanHaveNestedTryBlocksInASingleFunction_ThrowInside(void); +extern void test_CanHaveNestedTryBlocksInASingleFunction_ThrowOutside(void); +extern void test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThisDoesntCorruptExceptionId(void); +extern void test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThatEachExceptionIdIndependent(void); + +static void runTest(UnityTestFunction test) +{ + CEXCEPTION_T e; + if (TEST_PROTECT()) + { + setUp(); + Try + { + test(); + } + Catch(e) + { + TEST_FAIL_MESSAGE("Unexpected exception!") + } + } + tearDown(); +} + + +int main(void) +{ + Unity.TestFile = __FILE__; + UnityBegin(); + + // RUN_TEST calls runTest + RUN_TEST(test_BasicTryDoesNothingIfNoThrow, 12); + RUN_TEST(test_BasicThrowAndCatch, 30); + RUN_TEST(test_BasicThrowAndCatch_WithMiniSyntax, 49); + RUN_TEST(test_VerifyVolatilesSurviveThrowAndCatch, 69); + RUN_TEST(test_ThrowFromASubFunctionAndCatchInRootFunc, 98); + RUN_TEST(test_ThrowAndCatchFromASubFunctionAndRethrowToCatchInRootFunc, 139); + RUN_TEST(test_ThrowAndCatchFromASubFunctionAndNoRethrowToCatchInRootFunc, 158); + RUN_TEST(test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThisDoesntCorruptExceptionId, 175); + RUN_TEST(test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThatEachExceptionIdIndependent, 193); + RUN_TEST(test_CanHaveMultipleTryBlocksInASingleFunction, 220); + RUN_TEST(test_CanHaveNestedTryBlocksInASingleFunction_ThrowInside, 245); + RUN_TEST(test_CanHaveNestedTryBlocksInASingleFunction_ThrowOutside, 269); + + UnityEnd(); + + return 0; +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/auto/colour_prompt.rb b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/auto/colour_prompt.rb new file mode 100644 index 0000000..81003dd --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/auto/colour_prompt.rb @@ -0,0 +1,94 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +if RUBY_PLATFORM =~/(win|w)32$/ + begin + require 'Win32API' + rescue LoadError + puts "ERROR! \"Win32API\" library not found" + puts "\"Win32API\" is required for colour on a windows machine" + puts " try => \"gem install Win32API\" on the command line" + puts + end + # puts + # puts 'Windows Environment Detected...' + # puts 'Win32API Library Found.' + # puts +end + +class ColourCommandLine + def initialize + if RUBY_PLATFORM =~/(win|w)32$/ + get_std_handle = Win32API.new("kernel32", "GetStdHandle", ['L'], 'L') + @set_console_txt_attrb = + Win32API.new("kernel32","SetConsoleTextAttribute",['L','N'], 'I') + @hout = get_std_handle.call(-11) + end + end + + def change_to(new_colour) + if RUBY_PLATFORM =~/(win|w)32$/ + @set_console_txt_attrb.call(@hout,self.win32_colour(new_colour)) + else + "\033[30;#{posix_colour(new_colour)};22m" + end + end + + def win32_colour(colour) + case colour + when :black then 0 + when :dark_blue then 1 + when :dark_green then 2 + when :dark_cyan then 3 + when :dark_red then 4 + when :dark_purple then 5 + when :dark_yellow, :narrative then 6 + when :default_white, :default, :dark_white then 7 + when :silver then 8 + when :blue then 9 + when :green, :success then 10 + when :cyan, :output then 11 + when :red, :failure then 12 + when :purple then 13 + when :yellow then 14 + when :white then 15 + else + 0 + end + end + + def posix_colour(colour) + case colour + when :black then 30 + when :red, :failure then 31 + when :green, :success then 32 + when :yellow then 33 + when :blue, :narrative then 34 + when :purple, :magenta then 35 + when :cyan, :output then 36 + when :white, :default_white, :default then 37 + else + 30 + end + end + + def out_c(mode, colour, str) + case RUBY_PLATFORM + when /(win|w)32$/ + change_to(colour) + $stdout.puts str if mode == :puts + $stdout.print str if mode == :print + change_to(:default_white) + else + $stdout.puts("#{change_to(colour)}#{str}\033[0m") if mode == :puts + $stdout.print("#{change_to(colour)}#{str}\033[0m") if mode == :print + end + end +end # ColourCommandLine + +def colour_puts(role,str) ColourCommandLine.new.out_c(:puts, role, str) end +def colour_print(role,str) ColourCommandLine.new.out_c(:print, role, str) end + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/auto/colour_reporter.rb b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/auto/colour_reporter.rb new file mode 100644 index 0000000..5aa1d27 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/auto/colour_reporter.rb @@ -0,0 +1,39 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require "#{File.expand_path(File.dirname(__FILE__))}/colour_prompt" + +$colour_output = true + +def report(message) + if not $colour_output + $stdout.puts(message) + else + message = message.join('\n') if (message.class == Array) + message.each_line do |line| + line.chomp! + colour = case(line) + when /(?:total\s+)?tests:?\s+(\d+)\s+(?:total\s+)?failures:?\s+\d+\s+Ignored:?/i + ($1.to_i == 0) ? :green : :red + when /PASS/ + :green + when /^OK$/ + :green + when /(?:FAIL|ERROR)/ + :red + when /IGNORE/ + :yellow + when /^(?:Creating|Compiling|Linking)/ + :white + else + :silver + end + colour_puts(colour, line) + end + end + $stdout.flush + $stderr.flush +end \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/auto/generate_config.yml b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/auto/generate_config.yml new file mode 100644 index 0000000..4a5e474 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/auto/generate_config.yml @@ -0,0 +1,36 @@ +#this is a sample configuration file for generate_module +#you would use it by calling generate_module with the -ygenerate_config.yml option +#files like this are useful for customizing generate_module to your environment +:generate_module: + :defaults: + #these defaults are used in place of any missing options at the command line + :path_src: ../src/ + :path_inc: ../src/ + :path_tst: ../test/ + :update_svn: true + :includes: + #use [] for no additional includes, otherwise list the includes on separate lines + :src: + - Defs.h + - Board.h + :inc: [] + :tst: + - Defs.h + - Board.h + - Exception.h + :boilerplates: + #these are inserted at the top of generated files. + #just comment out or remove if not desired. + #use %1$s where you would like the file name to appear (path/extension not included) + :src: | + //------------------------------------------- + // %1$s.c + //------------------------------------------- + :inc: | + //------------------------------------------- + // %1$s.h + //------------------------------------------- + :tst: | + //------------------------------------------- + // Test%1$s.c : Units tests for %1$s.c + //------------------------------------------- diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/auto/generate_module.rb b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/auto/generate_module.rb new file mode 100644 index 0000000..3db1a98 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/auto/generate_module.rb @@ -0,0 +1,202 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +# This script creates all the files with start code necessary for a new module. +# A simple module only requires a source file, header file, and test file. +# Triad modules require a source, header, and test file for each triad type (like model, conductor, and hardware). + +require 'rubygems' +require 'fileutils' + +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +#help text when requested +HELP_TEXT = [ "\nGENERATE MODULE\n-------- ------", + "\nUsage: ruby generate_module [options] module_name", + " -i\"include\" sets the path to output headers to 'include' (DEFAULT ../src)", + " -s\"../src\" sets the path to output source to '../src' (DEFAULT ../src)", + " -t\"C:/test\" sets the path to output source to 'C:/test' (DEFAULT ../test)", + " -p\"MCH\" sets the output pattern to MCH.", + " dh - driver hardware.", + " dih - driver interrupt hardware.", + " mch - model conductor hardware.", + " mvp - model view presenter.", + " src - just a single source module. (DEFAULT)", + " -d destroy module instead of creating it.", + " -u update subversion too (requires subversion command line)", + " -y\"my.yml\" selects a different yaml config file for module generation", + "" ].join("\n") + +#Built in patterns +PATTERNS = { 'src' => {'' => { :inc => [] } }, + 'dh' => {'Driver' => { :inc => ['%1$sHardware.h'] }, + 'Hardware' => { :inc => [] } + }, + 'dih' => {'Driver' => { :inc => ['%1$sHardware.h', '%1$sInterrupt.h'] }, + 'Interrupt'=> { :inc => ['%1$sHardware.h'] }, + 'Hardware' => { :inc => [] } + }, + 'mch' => {'Model' => { :inc => [] }, + 'Conductor'=> { :inc => ['%1$sModel.h', '%1$sHardware.h'] }, + 'Hardware' => { :inc => [] } + }, + 'mvp' => {'Model' => { :inc => [] }, + 'Presenter'=> { :inc => ['%1$sModel.h', '%1$sView.h'] }, + 'View' => { :inc => [] } + } + } + +#TEMPLATE_TST +TEMPLATE_TST = %q[#include "unity.h" +%2$s#include "%1$s.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void test_%1$s_NeedToImplement(void) +{ + TEST_IGNORE(); +} +] + +#TEMPLATE_SRC +TEMPLATE_SRC = %q[%2$s#include "%1$s.h" +] + +#TEMPLATE_INC +TEMPLATE_INC = %q[#ifndef _%3$s_H +#define _%3$s_H%2$s + +#endif // _%3$s_H +] + +# Parse the command line parameters. +ARGV.each do |arg| + case(arg) + when /^-d/ then @destroy = true + when /^-u/ then @update_svn = true + when /^-p(\w+)/ then @pattern = $1 + when /^-s(.+)/ then @path_src = $1 + when /^-i(.+)/ then @path_inc = $1 + when /^-t(.+)/ then @path_tst = $1 + when /^-y(.+)/ then @yaml_config = $1 + when /^(\w+)/ + raise "ERROR: You can't have more than one Module name specified!" unless @module_name.nil? + @module_name = arg + when /^-(h|-help)/ + puts HELP_TEXT + exit + else + raise "ERROR: Unknown option specified '#{arg}'" + end +end +raise "ERROR: You must have a Module name specified! (use option -h for help)" if @module_name.nil? + +#load yaml file if one was requested +if @yaml_config + require 'yaml' + cfg = YAML.load_file(HERE + @yaml_config)[:generate_module] + @path_src = cfg[:defaults][:path_src] if @path_src.nil? + @path_inc = cfg[:defaults][:path_inc] if @path_inc.nil? + @path_tst = cfg[:defaults][:path_tst] if @path_tst.nil? + @update_svn = cfg[:defaults][:update_svn] if @update_svn.nil? + @extra_inc = cfg[:includes] + @boilerplates = cfg[:boilerplates] +else + @boilerplates = {} +end + +# Create default file paths if none were provided +@path_src = HERE + "../src/" if @path_src.nil? +@path_inc = @path_src if @path_inc.nil? +@path_tst = HERE + "../test/" if @path_tst.nil? +@path_src += '/' unless (@path_src[-1] == 47) +@path_inc += '/' unless (@path_inc[-1] == 47) +@path_tst += '/' unless (@path_tst[-1] == 47) +@pattern = 'src' if @pattern.nil? +@includes = { :src => [], :inc => [], :tst => [] } +@includes.merge!(@extra_inc) unless @extra_inc.nil? + +#create triad definition +TRIAD = [ { :ext => '.c', :path => @path_src, :template => TEMPLATE_SRC, :inc => :src, :boilerplate => @boilerplates[:src] }, + { :ext => '.h', :path => @path_inc, :template => TEMPLATE_INC, :inc => :inc, :boilerplate => @boilerplates[:inc] }, + { :ext => '.c', :path => @path_tst+'Test', :template => TEMPLATE_TST, :inc => :tst, :boilerplate => @boilerplates[:tst] }, + ] + +#prepare the pattern for use +@patterns = PATTERNS[@pattern.downcase] +raise "ERROR: The design pattern specified isn't one that I recognize!" if @patterns.nil? + +# Assemble the path/names of the files we need to work with. +files = [] +TRIAD.each do |triad| + @patterns.each_pair do |pattern_file, pattern_traits| + files << { + :path => "#{triad[:path]}#{@module_name}#{pattern_file}#{triad[:ext]}", + :name => "#{@module_name}#{pattern_file}", + :template => triad[:template], + :boilerplate => triad[:boilerplate], + :includes => case(triad[:inc]) + when :src then @includes[:src] | pattern_traits[:inc].map{|f| f % [@module_name]} + when :inc then @includes[:inc] + when :tst then @includes[:tst] | pattern_traits[:inc].map{|f| "Mock#{f}"% [@module_name]} + end + } + end +end + +# destroy files if that was what was requested +if @destroy + files.each do |filespec| + file = filespec[:path] + if File.exist?(file) + if @update_svn + `svn delete \"#{file}\" --force` + puts "File #{file} deleted and removed from source control" + else + FileUtils.remove(file) + puts "File #{file} deleted" + end + else + puts "File #{file} does not exist so cannot be removed." + end + end + puts "Destroy Complete" + exit +end + +#Abort if any module already exists +files.each do |file| + raise "ERROR: File #{file[:name]} already exists. Exiting." if File.exist?(file[:path]) +end + +# Create Source Modules +files.each_with_index do |file, i| + File.open(file[:path], 'w') do |f| + f.write(file[:boilerplate] % [file[:name]]) unless file[:boilerplate].nil? + f.write(file[:template] % [ file[:name], + file[:includes].map{|f| "#include \"#{f}\"\n"}.join, + file[:name].upcase ] + ) + end + if (@update_svn) + `svn add \"#{file[:path]}\"` + if $?.exitstatus == 0 + puts "File #{file[:path]} created and added to source control" + else + puts "File #{file[:path]} created but FAILED adding to source control!" + end + else + puts "File #{file[:path]} created" + end +end + +puts 'Generate Complete' diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb new file mode 100644 index 0000000..aff5053 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb @@ -0,0 +1,303 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +File.expand_path(File.join(File.dirname(__FILE__),'colour_prompt')) + +class UnityTestRunnerGenerator + + def initialize(options = nil) + @options = { :includes => [], :plugins => [], :framework => :unity } + case(options) + when NilClass then @options + when String then @options.merge!(UnityTestRunnerGenerator.grab_config(options)) + when Hash then @options.merge!(options) + else raise "If you specify arguments, it should be a filename or a hash of options" + end + end + + def self.grab_config(config_file) + options = { :includes => [], :plugins => [], :framework => :unity } + unless (config_file.nil? or config_file.empty?) + require 'yaml' + yaml_guts = YAML.load_file(config_file) + options.merge!(yaml_guts[:unity] ? yaml_guts[:unity] : yaml_guts[:cmock]) + raise "No :unity or :cmock section found in #{config_file}" unless options + end + return(options) + end + + def run(input_file, output_file, options=nil) + tests = [] + includes = [] + used_mocks = [] + + @options.merge!(options) unless options.nil? + module_name = File.basename(input_file) + + #pull required data from source file + File.open(input_file, 'r') do |input| + tests = find_tests(input) + includes = find_includes(input) + used_mocks = find_mocks(includes) + end + + #build runner file + File.open(output_file, 'w') do |output| + create_header(output, used_mocks) + create_externs(output, tests, used_mocks) + create_mock_management(output, used_mocks) + create_suite_setup_and_teardown(output) + create_reset(output, used_mocks) + create_main(output, input_file, tests) + end + + all_files_used = [input_file, output_file] + all_files_used += includes.map {|filename| filename + '.c'} unless includes.empty? + all_files_used += @options[:includes] unless @options[:includes].empty? + return all_files_used.uniq + end + + def find_tests(input_file) + tests_raw = [] + tests_args = [] + tests_and_line_numbers = [] + + input_file.rewind + source_raw = input_file.read + source_scrubbed = source_raw.gsub(/\/\/.*$/, '') # remove line comments + source_scrubbed = source_scrubbed.gsub(/\/\*.*?\*\//m, '') # remove block comments + lines = source_scrubbed.split(/(^\s*\#.*$) # Treat preprocessor directives as a logical line + | (;|\{|\}) /x) # Match ;, {, and } as end of lines + + lines.each_with_index do |line, index| + #find tests + if line =~ /^((?:\s*TEST_CASE\s*\(.*?\)\s*)*)\s*void\s+(test.*?)\s*\(\s*(.*)\s*\)/ + arguments = $1 + name = $2 + call = $3 + args = nil + if (@options[:use_param_tests] and !arguments.empty?) + args = [] + arguments.scan(/\s*TEST_CASE\s*\((.*)\)\s*$/) {|a| args << a[0]} + end + tests_and_line_numbers << { :name => name, :args => args, :call => call, :line_number => 0 } + tests_args = [] + end + end + + #determine line numbers and create tests to run + source_lines = source_raw.split("\n") + source_index = 0; + tests_and_line_numbers.size.times do |i| + source_lines[source_index..-1].each_with_index do |line, index| + if (line =~ /#{tests_and_line_numbers[i][:name]}/) + source_index += index + tests_and_line_numbers[i][:line_number] = source_index + 1 + break + end + end + end + + return tests_and_line_numbers + end + + def find_includes(input_file) + input_file.rewind + includes = [] + input_file.readlines.each do |line| + scan_results = line.scan(/^\s*#include\s+\"\s*(.+)\.[hH]\s*\"/) + includes << scan_results[0][0] if (scan_results.size > 0) + end + return includes + end + + def find_mocks(includes) + mock_headers = [] + includes.each do |include_file| + mock_headers << File.basename(include_file) if (include_file =~ /^mock/i) + end + return mock_headers + end + + def create_header(output, mocks) + output.puts('/* AUTOGENERATED FILE. DO NOT EDIT. */') + create_runtest(output, mocks) + output.puts("\n//=======Automagically Detected Files To Include=====") + output.puts("#include \"#{@options[:framework].to_s}.h\"") + output.puts('#include "cmock.h"') unless (mocks.empty?) + @options[:includes].flatten.uniq.compact.each do |inc| + output.puts("#include #{inc.include?('<') ? inc : "\"#{inc.gsub('.h','')}.h\""}") + end + output.puts('#include ') + output.puts('#include ') + output.puts('#include "CException.h"') if @options[:plugins].include?(:cexception) + mocks.each do |mock| + output.puts("#include \"#{mock.gsub('.h','')}.h\"") + end + if @options[:enforce_strict_ordering] + output.puts('') + output.puts('int GlobalExpectCount;') + output.puts('int GlobalVerifyOrder;') + output.puts('char* GlobalOrderError;') + end + end + + def create_externs(output, tests, mocks) + output.puts("\n//=======External Functions This Runner Calls=====") + output.puts("extern void setUp(void);") + output.puts("extern void tearDown(void);") + tests.each do |test| + output.puts("extern void #{test[:name]}(#{test[:call]});") + end + output.puts('') + end + + def create_mock_management(output, mocks) + unless (mocks.empty?) + output.puts("\n//=======Mock Management=====") + output.puts("static void CMock_Init(void)") + output.puts("{") + if @options[:enforce_strict_ordering] + output.puts(" GlobalExpectCount = 0;") + output.puts(" GlobalVerifyOrder = 0;") + output.puts(" GlobalOrderError = NULL;") + end + mocks.each do |mock| + output.puts(" #{mock}_Init();") + end + output.puts("}\n") + + output.puts("static void CMock_Verify(void)") + output.puts("{") + mocks.each do |mock| + output.puts(" #{mock}_Verify();") + end + output.puts("}\n") + + output.puts("static void CMock_Destroy(void)") + output.puts("{") + mocks.each do |mock| + output.puts(" #{mock}_Destroy();") + end + output.puts("}\n") + end + end + + def create_suite_setup_and_teardown(output) + unless (@options[:suite_setup].nil?) + output.puts("\n//=======Suite Setup=====") + output.puts("static int suite_setup(void)") + output.puts("{") + output.puts(@options[:suite_setup]) + output.puts("}") + end + unless (@options[:suite_teardown].nil?) + output.puts("\n//=======Suite Teardown=====") + output.puts("static int suite_teardown(int num_failures)") + output.puts("{") + output.puts(@options[:suite_teardown]) + output.puts("}") + end + end + + def create_runtest(output, used_mocks) + cexception = @options[:plugins].include? :cexception + va_args1 = @options[:use_param_tests] ? ', ...' : '' + va_args2 = @options[:use_param_tests] ? '__VA_ARGS__' : '' + output.puts("\n//=======Test Runner Used To Run Each Test Below=====") + output.puts("#define RUN_TEST_NO_ARGS") if @options[:use_param_tests] + output.puts("#define RUN_TEST(TestFunc, TestLineNum#{va_args1}) \\") + output.puts("{ \\") + output.puts(" Unity.CurrentTestName = #TestFunc#{va_args2.empty? ? '' : " \"(\" ##{va_args2} \")\""}; \\") + output.puts(" Unity.CurrentTestLineNumber = TestLineNum; \\") + output.puts(" Unity.NumberOfTests++; \\") + output.puts(" if (TEST_PROTECT()) \\") + output.puts(" { \\") + output.puts(" CEXCEPTION_T e; \\") if cexception + output.puts(" Try { \\") if cexception + output.puts(" CMock_Init(); \\") unless (used_mocks.empty?) + output.puts(" setUp(); \\") + output.puts(" TestFunc(#{va_args2}); \\") + output.puts(" CMock_Verify(); \\") unless (used_mocks.empty?) + output.puts(" } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, \"Unhandled Exception!\"); } \\") if cexception + output.puts(" } \\") + output.puts(" CMock_Destroy(); \\") unless (used_mocks.empty?) + output.puts(" if (TEST_PROTECT() && !TEST_IS_IGNORED) \\") + output.puts(" { \\") + output.puts(" tearDown(); \\") + output.puts(" } \\") + output.puts(" UnityConcludeTest(); \\") + output.puts("}\n") + end + + def create_reset(output, used_mocks) + output.puts("\n//=======Test Reset Option=====") + output.puts("void resetTest()") + output.puts("{") + output.puts(" CMock_Verify();") unless (used_mocks.empty?) + output.puts(" CMock_Destroy();") unless (used_mocks.empty?) + output.puts(" tearDown();") + output.puts(" CMock_Init();") unless (used_mocks.empty?) + output.puts(" setUp();") + output.puts("}") + end + + def create_main(output, filename, tests) + output.puts("\n\n//=======MAIN=====") + output.puts("int main(void)") + output.puts("{") + output.puts(" suite_setup();") unless @options[:suite_setup].nil? + output.puts(" Unity.TestFile = \"#{filename}\";") + output.puts(" UnityBegin();") + if (@options[:use_param_tests]) + tests.each do |test| + if ((test[:args].nil?) or (test[:args].empty?)) + output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]}, RUN_TEST_NO_ARGS);") + else + test[:args].each {|args| output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]}, #{args});")} + end + end + else + tests.each { |test| output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]});") } + end + output.puts() + output.puts(" return #{@options[:suite_teardown].nil? ? "" : "suite_teardown"}(UnityEnd());") + output.puts("}") + end +end + + +if ($0 == __FILE__) + options = { :includes => [] } + yaml_file = nil + + #parse out all the options first + ARGV.reject! do |arg| + case(arg) + when '-cexception' + options[:plugins] = [:cexception]; true + when /\.*\.yml/ + options = UnityTestRunnerGenerator.grab_config(arg); true + else false + end + end + + #make sure there is at least one parameter left (the input file) + if !ARGV[0] + puts ["usage: ruby #{__FILE__} (yaml) (options) input_test_file output_test_runner (includes)", + " blah.yml - will use config options in the yml file (see docs)", + " -cexception - include cexception support"].join("\n") + exit 1 + end + + #create the default test runner name if not specified + ARGV[1] = ARGV[0].gsub(".c","_Runner.c") if (!ARGV[1]) + + #everything else is an include file + options[:includes] ||= (ARGV.slice(2..-1).flatten.compact) if (ARGV.size > 2) + + UnityTestRunnerGenerator.new(options).run(ARGV[0], ARGV[1]) +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/auto/test_file_filter.rb b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/auto/test_file_filter.rb new file mode 100644 index 0000000..3dbc26a --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/auto/test_file_filter.rb @@ -0,0 +1,23 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require'yaml' + +module RakefileHelpers + class TestFileFilter + def initialize(all_files = false) + @all_files = all_files + if not @all_files == true + if File.exist?('test_file_filter.yml') + filters = YAML.load_file( 'test_file_filter.yml' ) + @all_files, @only_files, @exclude_files = + filters[:all_files], filters[:only_files], filters[:exclude_files] + end + end + end + attr_accessor :all_files, :only_files, :exclude_files + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/auto/unity_test_summary.rb b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/auto/unity_test_summary.rb new file mode 100644 index 0000000..69ec2e8 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/auto/unity_test_summary.rb @@ -0,0 +1,126 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +#!/usr/bin/ruby +# +# unity_test_summary.rb +# +require 'fileutils' +require 'set' + +class UnityTestSummary + include FileUtils::Verbose + + attr_reader :report, :total_tests, :failures, :ignored + + def initialize + @report = '' + @total_tests = 0 + @failures = 0 + @ignored = 0 + end + + def run + # Clean up result file names + results = @targets.map {|target| target.gsub(/\\/,'/')} + + # Dig through each result file, looking for details on pass/fail: + failure_output = [] + ignore_output = [] + + results.each do |result_file| + lines = File.readlines(result_file).map { |line| line.chomp } + if lines.length == 0 + raise "Empty test result file: #{result_file}" + else + output = get_details(result_file, lines) + failure_output << output[:failures] unless output[:failures].empty? + ignore_output << output[:ignores] unless output[:ignores].empty? + tests,failures,ignored = parse_test_summary(lines) + @total_tests += tests + @failures += failures + @ignored += ignored + end + end + + if @ignored > 0 + @report += "\n" + @report += "--------------------------\n" + @report += "UNITY IGNORED TEST SUMMARY\n" + @report += "--------------------------\n" + @report += ignore_output.flatten.join("\n") + end + + if @failures > 0 + @report += "\n" + @report += "--------------------------\n" + @report += "UNITY FAILED TEST SUMMARY\n" + @report += "--------------------------\n" + @report += failure_output.flatten.join("\n") + end + + @report += "\n" + @report += "--------------------------\n" + @report += "OVERALL UNITY TEST SUMMARY\n" + @report += "--------------------------\n" + @report += "#{@total_tests} TOTAL TESTS #{@failures} TOTAL FAILURES #{@ignored} IGNORED\n" + @report += "\n" + end + + def set_targets(target_array) + @targets = target_array + end + + def set_root_path(path) + @root = path + end + + def usage(err_msg=nil) + puts err_msg if err_msg + puts "Usage: unity_test_summary.rb" + exit 1 + end + + protected + + @@targets=nil + @@path=nil + @@root=nil + + def get_details(result_file, lines) + results = { :failures => [], :ignores => [], :successes => [] } + lines.each do |line| + src_file,src_line,test_name,status,msg = line.split(/:/) + line_out = ((@root and (@root != 0)) ? "#{@root}#{line}" : line ).gsub(/\//, "\\") + case(status) + when 'IGNORE' then results[:ignores] << line_out + when 'FAIL' then results[:failures] << line_out + when 'PASS' then results[:successes] << line_out + end + end + return results + end + + def parse_test_summary(summary) + if summary[-3..-1].join("\n") =~ /(\d+) Tests (\d+) Failures (\d+) Ignored/ + [$1.to_i,$2.to_i,$3.to_i] + else + raise "Couldn't parse test results: #{summary}" + end + end + + def here; File.expand_path(File.dirname(__FILE__)); end + +end + +if $0 == __FILE__ + script = UnityTestSummary.new + begin + script.run + rescue Exception => e + script.usage e.message + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/docs/Unity Summary.odt b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/docs/Unity Summary.odt new file mode 100644 index 0000000..f699661 Binary files /dev/null and b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/docs/Unity Summary.odt differ diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/docs/Unity Summary.pdf b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/docs/Unity Summary.pdf new file mode 100644 index 0000000..ad1a956 Binary files /dev/null and b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/docs/Unity Summary.pdf differ diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/docs/Unity Summary.txt b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/docs/Unity Summary.txt new file mode 100644 index 0000000..e0b179d --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/docs/Unity Summary.txt @@ -0,0 +1,217 @@ +============== +Unity Test API +============== + +[Copyright (c) 2007 - Unity Project by Mike Karlesky, Mark VanderVoord, and Greg Williams] + +------------- +Running Tests +------------- + +RUN_TEST(func, linenum) + +Each Test is run within the macro RUN_TEST. This macro performs necessary setup before the test is called and handles cleanup and result tabulation afterwards. + +-------------- +Ignoring Tests +-------------- + +There are times when a test is incomplete or not valid for some reason. At these times, TEST_IGNORE can be called. Control will immediately be returned to the caller of the test, and no failures will be returned. + +TEST_IGNORE() + +Ignore this test and return immediately + +TEST_IGNORE_MESSAGE (message) + +Ignore this test and return immediately. Output a message stating why the test was ignored. + +-------------- +Aborting Tests +-------------- + +There are times when a test will contain an infinite loop on error conditions, or there may be reason to escape from the test early without executing the rest of the test. A pair of macros support this functionality in Unity. The first (TEST_PROTECT) sets up the feature, and handles emergency abort cases. TEST_ABORT can then be used at any time within the tests to return to the last TEST_PROTECT call. + +TEST_PROTECT() + +Setup and Catch macro + +TEST_ABORT() + +Abort Test macro + +Example: + +main() +{ + if (TEST_PROTECT() == 0) + { + MyTest(); + } +} + +If MyTest calls TEST_ABORT, program control will immediately return to TEST_PROTECT with a non-zero return value. + + +======================= +Unity Assertion Summary +======================= + +-------------------- +Basic Validity Tests +-------------------- + +TEST_ASSERT_TRUE(condition) + +Evaluates whatever code is in condition and fails if it evaluates to false + +TEST_ASSERT_FALSE(condition) + +Evaluates whatever code is in condition and fails if it evaluates to true + +TEST_ASSERT(condition) + +Another way of calling TEST_ASSERT_TRUE + +TEST_ASSERT_UNLESS(condition) + +Another way of calling TEST_ASSERT_FALSE + +TEST_FAIL() +TEST_FAIL_MESSAGE(message) + +This test is automatically marked as a failure. The message is output stating why. + +------------------------------ +Numerical Assertions: Integers +------------------------------ + +TEST_ASSERT_EQUAL_INT(expected, actual) +TEST_ASSERT_EQUAL_INT8(expected, actual) +TEST_ASSERT_EQUAL_INT16(expected, actual) +TEST_ASSERT_EQUAL_INT32(expected, actual) +TEST_ASSERT_EQUAL_INT64(expected, actual) + +Compare two integers for equality and display errors as signed integers. A cast will be performed +to your natural integer size so often this can just be used. When you need to specify the exact size, +like when comparing arrays, you can use a specific version: + + + +TEST_ASSERT_EQUAL_UINT(expected, actual) + +Compare two integers for equality and display errors as unsigned integers. Like INT, there are +variants for different sizes also. + + + +TEST_ASSERT_EQUAL_HEX(expected, actual) + +Compares two integers for equality and display errors as hexadecimal. Like the other integer comparisons, +you can specify the size... here the size will also effect how many nibbles are shown (for example, HEX16 +will show 4 nibbles). + +_ARRAY + +You can append _ARRAY to any of these macros to make an array comparison of that type. Here you will +need to care a bit more about the actual size of the value being checked. You will also specify an +additional argument which is the number of elements to compare. For example: + +TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, elements) + + +TEST_ASSERT_EQUAL(expected, actual) + +Another way of calling TEST_ASSERT_EQUAL_INT + + + +TEST_ASSERT_INT_WITHIN(delta, expected, actual) + +Asserts that the actual value is within plus or minus delta of the expected value. This also comes in +size specific variants. + + +----------------------------- +Numerical Assertions: Bitwise +----------------------------- + +TEST_ASSERT_BITS(mask, expected, actual) + +Use an integer mask to specify which bits should be compared between two other integers. High bits in the mask are compared, low bits ignored. + +TEST_ASSERT_BITS_HIGH(mask, actual) + +Use an integer mask to specify which bits should be inspected to determine if they are all set high. High bits in the mask are compared, low bits ignored. + +TEST_ASSERT_BITS_LOW(mask, actual) + +Use an integer mask to specify which bits should be inspected to determine if they are all set low. High bits in the mask are compared, low bits ignored. + +TEST_ASSERT_BIT_HIGH(bit, actual) + +Test a single bit and verify that it is high. The bit is specified 0-31 for a 32-bit integer. + +TEST_ASSERT_BIT_LOW(bit, actual) + +Test a single bit and verify that it is low. The bit is specified 0-31 for a 32-bit integer. + +---------------------------- +Numerical Assertions: Floats +---------------------------- + +TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual) + +Asserts that the actual value is within plus or minus delta of the expected value. + +TEST_ASSERT_EQUAL_FLOAT(expected, actual) + +Asserts that two floating point values are "equal" within a small % delta of the expected value. + +----------------- +String Assertions +----------------- + +TEST_ASSERT_EQUAL_STRING(expected, actual) + +Compare two null-terminate strings. Fail if any character is different or if the lengths are different. + +TEST_ASSERT_EQUAL_STRING_MESSAGE(expected, actual, message) + +Compare two null-terminate strings. Fail if any character is different or if the lengths are different. Output a custom message on failure. + +------------------ +Pointer Assertions +------------------ + +Most pointer operations can be performed by simply using the integer comparisons above. However, a couple of special cases are added for clarity. + +TEST_ASSERT_NULL(pointer) + +Fails if the pointer is not equal to NULL + +TEST_ASSERT_NOT_NULL(pointer) + +Fails if the pointer is equal to NULL + + +----------------- +Memory Assertions +----------------- + +TEST_ASSERT_EQUAL_MEMORY(expected, actual, len) + +Compare two blocks of memory. This is a good generic assertion for types that can't be coerced into acting like +standard types... but since it's a memory compare, you have to be careful that your data types are packed. + +-------- +_MESSAGE +-------- + +you can append _MESSAGE to any of the macros to make them take an additional argument. This argument +is a string that will be printed at the end of the failure strings. This is useful for specifying more +information about the problem. + + + + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/docs/license.txt b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/docs/license.txt new file mode 100644 index 0000000..c42e330 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/docs/license.txt @@ -0,0 +1,31 @@ + Copyright (c) 2007-2010 Mike Karlesky, Mark VanderVoord, Greg Williams + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + The end-user documentation included with the redistribution, if + any, must include the following acknowledgment: "This product + includes software developed for the Unity Project, by Mike Karlesky, + Mark VanderVoord, and Greg Williams and other contributors", in + the same place and form as other third-party acknowledgments. + Alternately, this acknowledgment may appear in the software + itself, in the same form and location as other such third-party + acknowledgments. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.c b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.c new file mode 100644 index 0000000..9cf42c6 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.c @@ -0,0 +1,10 @@ +#include "unity.h" +#include "UnityHelper.h" +#include +#include + +void AssertEqualExampleStruct(const EXAMPLE_STRUCT_T expected, const EXAMPLE_STRUCT_T actual, const unsigned short line) +{ + UNITY_TEST_ASSERT_EQUAL_INT(expected.x, actual.x, line, "Example Struct Failed For Field x"); + UNITY_TEST_ASSERT_EQUAL_INT(expected.y, actual.y, line, "Example Struct Failed For Field y"); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.h b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.h new file mode 100644 index 0000000..1516111 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.h @@ -0,0 +1,12 @@ +#ifndef _TESTHELPER_H +#define _TESTHELPER_H + +#include "Types.h" + +void AssertEqualExampleStruct(const EXAMPLE_STRUCT_T expected, const EXAMPLE_STRUCT_T actual, const unsigned short line); + +#define UNITY_TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(expected, actual, line, message) AssertEqualExampleStruct(expected, actual, line); + +#define TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(expected, actual) UNITY_TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(expected, actual, __LINE__, NULL); + +#endif // _TESTHELPER_H diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/examples/makefile b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/examples/makefile new file mode 100644 index 0000000..723d390 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/examples/makefile @@ -0,0 +1,40 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +C_COMPILER=gcc +TARGET_BASE1=test1 +TARGET_BASE2=test2 +ifeq ($(OS),Windows_NT) + TARGET_EXTENSION=.exe +else + TARGET_EXTENSION=.out +endif +TARGET1 = $(TARGET_BASE1)$(TARGET_EXTENSION) +TARGET2 = $(TARGET_BASE2)$(TARGET_EXTENSION) +SRC_FILES1=../src/unity.c src/ProductionCode.c test/TestProductionCode.c test/no_ruby/TestProductionCode_Runner.c +SRC_FILES2=../src/unity.c src/ProductionCode2.c test/TestProductionCode2.c test/no_ruby/TestProductionCode2_Runner.c +INC_DIRS=-Isrc -I../src +SYMBOLS=-DTEST + +ifeq ($(OS),Windows_NT) + CLEANUP = del /F /Q build\* && del /F /Q $(TARGET1) && del /F /Q $(TARGET2) +else + CLEANUP = rm -f build/*.o ; rm -f $(TARGET1) ; rm -f $(TARGET2) +endif + +all: clean default + +default: +# ruby auto/generate_test_runner.rb test/TestProductionCode.c test/no_ruby/TestProductionCode_Runner.c +# ruby auto/generate_test_runner.rb test/TestProductionCode2.c test/no_ruby/TestProductionCode2_Runner.c + $(C_COMPILER) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES1) -o $(TARGET1) + $(C_COMPILER) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES2) -o $(TARGET2) + $(TARGET1) + $(TARGET2) + +clean: + $(CLEANUP) + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/examples/rakefile.rb b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/examples/rakefile.rb new file mode 100644 index 0000000..0905b4b --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/examples/rakefile.rb @@ -0,0 +1,32 @@ +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require HERE+'rakefile_helper' + +include RakefileHelpers + +# Load default configuration, for now +DEFAULT_CONFIG_FILE = 'gcc.yml' +configure_toolchain(DEFAULT_CONFIG_FILE) + +task :unit do + run_tests get_unit_test_files +end + +desc "Generate test summary" +task :summary do + report_summary +end + +desc "Build and test Unity" +task :all => [:clean, :unit, :summary] +task :default => [:clobber, :all] +task :ci => [:default] +task :cruise => [:default] + +desc "Load configuration" +task :config, :config_file do |t, args| + configure_toolchain(args[:config_file]) +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/examples/rakefile_helper.rb b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/examples/rakefile_helper.rb new file mode 100644 index 0000000..0127d69 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/examples/rakefile_helper.rb @@ -0,0 +1,260 @@ +require 'yaml' +require 'fileutils' +require HERE+'../auto/unity_test_summary' +require HERE+'../auto/generate_test_runner' +require HERE+'../auto/colour_reporter' + +module RakefileHelpers + + C_EXTENSION = '.c' + + def load_configuration(config_file) + $cfg_file = "../targets/#{config_file}" + $cfg = YAML.load(File.read($cfg_file)) + end + + def configure_clean + CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil? + end + + def configure_toolchain(config_file=DEFAULT_CONFIG_FILE) + config_file += '.yml' unless config_file =~ /\.yml$/ + load_configuration('../targets/'+config_file) + configure_clean + end + + def get_unit_test_files + path = $cfg['compiler']['unit_tests_path'] + 'Test*' + C_EXTENSION + path.gsub!(/\\/, '/') + FileList.new(path) + end + + def get_local_include_dirs + include_dirs = $cfg['compiler']['includes']['items'].dup + include_dirs.delete_if {|dir| dir.is_a?(Array)} + return include_dirs + end + + def extract_headers(filename) + includes = [] + lines = File.readlines(filename) + lines.each do |line| + m = line.match(/^\s*#include\s+\"\s*(.+\.[hH])\s*\"/) + if not m.nil? + includes << m[1] + end + end + return includes + end + + def find_source_file(header, paths) + paths.each do |dir| + src_file = dir + header.ext(C_EXTENSION) + if (File.exists?(src_file)) + return src_file + end + end + return nil + end + + def tackit(strings) + if strings.is_a?(Array) + result = "\"#{strings.join}\"" + else + result = strings + end + return result + end + + def squash(prefix, items) + result = '' + items.each { |item| result += " #{prefix}#{tackit(item)}" } + return result + end + + def build_compiler_fields + command = tackit($cfg['compiler']['path']) + if $cfg['compiler']['defines']['items'].nil? + defines = '' + else + defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items']) + end + options = squash('', $cfg['compiler']['options']) + includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :defines => defines, :options => options, :includes => includes} + end + + def compile(file, defines=[]) + compiler = build_compiler_fields + cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{file} " + + "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" + + "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" + execute(cmd_str) + end + + def build_linker_fields + command = tackit($cfg['linker']['path']) + if $cfg['linker']['options'].nil? + options = '' + else + options = squash('', $cfg['linker']['options']) + end + if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?) + includes = '' + else + includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) + end + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :options => options, :includes => includes} + end + + def link(exe_name, obj_list) + linker = build_linker_fields + cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + + (obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).join + + $cfg['linker']['bin_files']['prefix'] + ' ' + + $cfg['linker']['bin_files']['destination'] + + exe_name + $cfg['linker']['bin_files']['extension'] + execute(cmd_str) + end + + def build_simulator_fields + return nil if $cfg['simulator'].nil? + if $cfg['simulator']['path'].nil? + command = '' + else + command = (tackit($cfg['simulator']['path']) + ' ') + end + if $cfg['simulator']['pre_support'].nil? + pre_support = '' + else + pre_support = squash('', $cfg['simulator']['pre_support']) + end + if $cfg['simulator']['post_support'].nil? + post_support = '' + else + post_support = squash('', $cfg['simulator']['post_support']) + end + return {:command => command, :pre_support => pre_support, :post_support => post_support} + end + + def execute(command_string, verbose=true, raise_on_fail=true) + report command_string + output = `#{command_string}`.chomp + report(output) if (verbose && !output.nil? && (output.length > 0)) + if (($?.exitstatus != 0) and (raise_on_fail)) + raise "Command failed. (Returned #{$?.exitstatus})" + end + return output + end + + def report_summary + summary = UnityTestSummary.new + summary.set_root_path(HERE) + results_glob = "#{$cfg['compiler']['build_path']}*.test*" + results_glob.gsub!(/\\/, '/') + results = Dir[results_glob] + summary.set_targets(results) + summary.run + fail_out "FAIL: There were failures" if (summary.failures > 0) + end + + def run_tests(test_files) + + report 'Running system tests...' + + # Tack on TEST define for compiling unit tests + load_configuration($cfg_file) + test_defines = ['TEST'] + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + $cfg['compiler']['defines']['items'] << 'TEST' + + include_dirs = get_local_include_dirs + + # Build and execute each unit test + test_files.each do |test| + obj_list = [] + + # Detect dependencies and build required required modules + extract_headers(test).each do |header| + # Compile corresponding source file if it exists + src_file = find_source_file(header, include_dirs) + if !src_file.nil? + compile(src_file, test_defines) + obj_list << header.ext($cfg['compiler']['object_files']['extension']) + end + end + + # Build the test runner (generate if configured to do so) + test_base = File.basename(test, C_EXTENSION) + runner_name = test_base + '_Runner.c' + if $cfg['compiler']['runner_path'].nil? + runner_path = $cfg['compiler']['build_path'] + runner_name + test_gen = UnityTestRunnerGenerator.new($cfg_file) + test_gen.run(test, runner_path) + else + runner_path = $cfg['compiler']['runner_path'] + runner_name + end + + compile(runner_path, test_defines) + obj_list << runner_name.ext($cfg['compiler']['object_files']['extension']) + + # Build the test module + compile(test, test_defines) + obj_list << test_base.ext($cfg['compiler']['object_files']['extension']) + + # Link the test executable + link(test_base, obj_list) + + # Execute unit test and generate results file + simulator = build_simulator_fields + executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] + if simulator.nil? + cmd_str = executable + else + cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" + end + output = execute(cmd_str, true, false) + test_results = $cfg['compiler']['build_path'] + test_base + if output.match(/OK$/m).nil? + test_results += '.testfail' + else + test_results += '.testpass' + end + File.open(test_results, 'w') { |f| f.print output } + end + end + + def build_application(main) + + report "Building application..." + + obj_list = [] + load_configuration($cfg_file) + main_path = $cfg['compiler']['source_path'] + main + C_EXTENSION + + # Detect dependencies and build required required modules + include_dirs = get_local_include_dirs + extract_headers(main_path).each do |header| + src_file = find_source_file(header, include_dirs) + if !src_file.nil? + compile(src_file) + obj_list << header.ext($cfg['compiler']['object_files']['extension']) + end + end + + # Build the main source file + main_base = File.basename(main_path, C_EXTENSION) + compile(main_path) + obj_list << main_base.ext($cfg['compiler']['object_files']['extension']) + + # Create the executable + link(main_base, obj_list) + end + + def fail_out(msg) + puts msg + exit(-1) + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/examples/readme.txt b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/examples/readme.txt new file mode 100644 index 0000000..6c7780e --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/examples/readme.txt @@ -0,0 +1,18 @@ +Example Project + +This example project gives an example of some passing, ignored, and failing tests. +It's simple and meant for you to look over and get an idea for what all of this stuff does. + +You can build and test using the makefile if you have gcc installed (you may need to tweak +the locations of some tools in the makefile). Otherwise, the rake version will let you +test with gcc or a couple versions of IAR. You can tweak the yaml files to get those versions +running. + +Ruby is required if you're using the rake version (obviously). This version shows off most of +Unity's advanced features (automatically creating test runners, fancy summaries, etc.) + +The makefile version doesn't require anything outside of your normal build tools, but won't do the +extras for you. So that you can test right away, we've written the test runners for you and +put them in the test\no_ruby subdirectory. If you make changes to the tests or source, you might +need to update these (like when you add or remove tests). Do that for a while and you'll learn +why you really want to start using the Ruby tools. \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/examples/src/ProductionCode.c b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/examples/src/ProductionCode.c new file mode 100644 index 0000000..500b44b --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/examples/src/ProductionCode.c @@ -0,0 +1,24 @@ + +#include "ProductionCode.h" + +int Counter = 0; +int NumbersToFind[9] = { 0, 34, 55, 66, 32, 11, 1, 77, 888 }; //some obnoxious array to search that is 1-based indexing instead of 0. + +// This function is supposed to search through NumbersToFind and find a particular number. +// If it finds it, the index is returned. Otherwise 0 is returned which sorta makes sense since +// NumbersToFind is indexed from 1. Unfortunately it's broken +// (and should therefore be caught by our tests) +int FindFunction_WhichIsBroken(int NumberToFind) +{ + int i = 0; + while (i <= 8) //Notice I should have been in braces + i++; + if (NumbersToFind[i] == NumberToFind) //Yikes! I'm getting run after the loop finishes instead of during it! + return i; + return 0; +} + +int FunctionWhichReturnsLocalVariable(void) +{ + return Counter; +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/examples/src/ProductionCode.h b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/examples/src/ProductionCode.h new file mode 100644 index 0000000..250ca0d --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/examples/src/ProductionCode.h @@ -0,0 +1,3 @@ + +int FindFunction_WhichIsBroken(int NumberToFind); +int FunctionWhichReturnsLocalVariable(void); diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/examples/src/ProductionCode2.c b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/examples/src/ProductionCode2.c new file mode 100644 index 0000000..a8c72e1 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/examples/src/ProductionCode2.c @@ -0,0 +1,9 @@ + +#include "ProductionCode2.h" + +char* ThisFunctionHasNotBeenTested(int Poor, char* LittleFunction) +{ + //Since There Are No Tests Yet, This Function Could Be Empty For All We Know. + // Which isn't terribly useful... but at least we put in a TEST_IGNORE so we won't forget + return (char*)0; +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/examples/src/ProductionCode2.h b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/examples/src/ProductionCode2.h new file mode 100644 index 0000000..34ae980 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/examples/src/ProductionCode2.h @@ -0,0 +1,2 @@ + +char* ThisFunctionHasNotBeenTested(int Poor, char* LittleFunction); diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/examples/test/TestProductionCode.c b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/examples/test/TestProductionCode.c new file mode 100644 index 0000000..28a5581 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/examples/test/TestProductionCode.c @@ -0,0 +1,62 @@ + +#include "ProductionCode.h" +#include "unity.h" + +//sometimes you may want to get at local data in a module. +//for example: If you plan to pass by reference, this could be useful +//however, it should often be avoided +extern int Counter; + +void setUp(void) +{ + //This is run before EACH TEST + Counter = 0x5a5a; +} + +void tearDown(void) +{ +} + +void test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode(void) +{ + //All of these should pass + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(78)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(1)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(33)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(999)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(-1)); +} + +void test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken(void) +{ + // You should see this line fail in your test summary + TEST_ASSERT_EQUAL(1, FindFunction_WhichIsBroken(34)); + + // Notice the rest of these didn't get a chance to run because the line above failed. + // Unit tests abort each test function on the first sign of trouble. + // Then NEXT test function runs as normal. + TEST_ASSERT_EQUAL(8, FindFunction_WhichIsBroken(8888)); +} + +void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue(void) +{ + //This should be true because setUp set this up for us before this test + TEST_ASSERT_EQUAL_HEX(0x5a5a, FunctionWhichReturnsLocalVariable()); + + //This should be true because we can still change our answer + Counter = 0x1234; + TEST_ASSERT_EQUAL_HEX(0x1234, FunctionWhichReturnsLocalVariable()); +} + +void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain(void) +{ + //This should be true again because setup was rerun before this test (and after we changed it to 0x1234) + TEST_ASSERT_EQUAL_HEX(0x5a5a, FunctionWhichReturnsLocalVariable()); +} + +void test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed(void) +{ + //Sometimes you get the test wrong. When that happens, you get a failure too... and a quick look should tell + // you what actually happened...which in this case was a failure to setup the initial condition. + TEST_ASSERT_EQUAL_HEX(0x1234, FunctionWhichReturnsLocalVariable()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/examples/test/TestProductionCode2.c b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/examples/test/TestProductionCode2.c new file mode 100644 index 0000000..20c9251 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/examples/test/TestProductionCode2.c @@ -0,0 +1,26 @@ + +#include "ProductionCode2.h" +#include "unity.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void test_IgnoredTest(void) +{ + TEST_IGNORE_MESSAGE("This Test Was Ignored On Purpose"); +} + +void test_AnotherIgnoredTest(void) +{ + TEST_IGNORE_MESSAGE("These Can Be Useful For Leaving Yourself Notes On What You Need To Do Yet"); +} + +void test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented(void) +{ + TEST_IGNORE(); //Like This +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode2_Runner.c b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode2_Runner.c new file mode 100644 index 0000000..56515ae --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode2_Runner.c @@ -0,0 +1,46 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ +#include "unity.h" +#include +#include + +char MessageBuffer[50]; + +extern void setUp(void); +extern void tearDown(void); + +extern void test_IgnoredTest(void); +extern void test_AnotherIgnoredTest(void); +extern void test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented(void); + +static void runTest(UnityTestFunction test) +{ + if (TEST_PROTECT()) + { + setUp(); + test(); + } + if (TEST_PROTECT() && !TEST_IS_IGNORED) + { + tearDown(); + } +} +void resetTest() +{ + tearDown(); + setUp(); +} + + +int main(void) +{ + Unity.TestFile = "test/TestProductionCode2.c"; + UnityBegin(); + + // RUN_TEST calls runTest + RUN_TEST(test_IgnoredTest, 13); + RUN_TEST(test_AnotherIgnoredTest, 18); + RUN_TEST(test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented, 23); + + UnityEnd(); + return 0; +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode_Runner.c b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode_Runner.c new file mode 100644 index 0000000..64112f3 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode_Runner.c @@ -0,0 +1,50 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ +#include "unity.h" +#include +#include + +char MessageBuffer[50]; + +extern void setUp(void); +extern void tearDown(void); + +extern void test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode(void); +extern void test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken(void); +extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue(void); +extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain(void); +extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed(void); + +static void runTest(UnityTestFunction test) +{ + if (TEST_PROTECT()) + { + setUp(); + test(); + } + if (TEST_PROTECT() && !TEST_IS_IGNORED) + { + tearDown(); + } +} +void resetTest() +{ + tearDown(); + setUp(); +} + + +int main(void) +{ + Unity.TestFile = "test/TestProductionCode.c"; + UnityBegin(); + + // RUN_TEST calls runTest + RUN_TEST(test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode, 20); + RUN_TEST(test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken, 30); + RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue, 41); + RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain, 51); + RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed, 57); + + UnityEnd(); + return 0; +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/build/MakefileWorker.mk b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/build/MakefileWorker.mk new file mode 100644 index 0000000..9948751 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/build/MakefileWorker.mk @@ -0,0 +1,331 @@ +#--------- +# +# MakefileWorker.mk +# +# Include this helper file in your makefile +# It makes +# A static library holding the application objs +# A test executable +# +# See this example for parameter settings +# examples/Makefile +# +#---------- +# Inputs - these variables describe what to build +# +# INCLUDE_DIRS - Directories used to search for include files. +# This generates a -I for each directory +# SRC_DIRS - Directories containing source file to built into the library +# SRC_FILES - Specific source files to build into library. Helpful when not all code +# in a directory can be built for test (hopefully a temporary situation) +# TEST_SRC_DIRS - Directories containing unit test code build into the unit test runner +# These do not go in a library. They are explicitly included in the test runner +# MOCKS_SRC_DIRS - Directories containing mock source files to build into the test runner +# These do not go in a library. They are explicitly included in the test runner +#---------- +# You can adjust these variables to influence how to build the test target +# and where to put and name outputs +# See below to determine defaults +# COMPONENT_NAME - the name of the thing being built +# UNITY_HOME - where Unity home dir found +# UNITY_BUILD_HOME - place for scripts +# UNITY_OBJS_DIR - a directory where o and d files go +# UNITY_LIB_DIR - a directory where libs go +# UNITY_ENABLE_DEBUG - build for debug +# UNITY_USE_MEM_LEAK_DETECTION - Links with overridden new and delete +# UNITY_USE_STD_CPP_LIB - Set to N to keep the standard C++ library out +# of the test harness +# UNITY_USE_GCOV - Turn on coverage analysis +# Clean then build with this flag set to Y, then 'make gcov' +# UNITY_TEST_RUNNER_FLAGS +# None by default +# UNITY_MAPFILE - generate a map file +# UNITY_WARNINGFLAGS - overly picky by default +# OTHER_MAKEFILE_TO_INCLUDE - a hook to use this makefile to make +# other targets. Like CSlim, which is part of fitnesse +#---------- +# +# Other flags users can initialize to sneak in their settings +# UNITY_CFLAGS - C complier +# UNITY_LDFLAGS - Linker flags +#---------- + + +ifndef COMPONENT_NAME + COMPONENT_NAME = name_this_in_the_makefile +endif + +# Debug on by default +ifndef UNITY_ENABLE_DEBUG + UNITY_ENABLE_DEBUG = Y +endif + +# new and delete for memory leak detection on by default +ifndef UNITY_USE_MEM_LEAK_DETECTION + UNITY_USE_MEM_LEAK_DETECTION = Y +endif + +# Use gcov, off by default +ifndef UNITY_USE_GCOV + UNITY_USE_GCOV = N +endif + +# Default warnings +ifndef UNITY_WARNINGFLAGS + UNITY_WARNINGFLAGS = -Wall -Werror -Wshadow -Wswitch-default +endif + +# Default dir for temporary files (d, o) +ifndef UNITY_OBJS_DIR + UNITY_OBJS_DIR = objs +endif + +# Default dir for the outout library +ifndef UNITY_LIB_DIR + UNITY_LIB_DIR = lib +endif + +# No map by default +ifndef UNITY_MAP_FILE + UNITY_MAP_FILE = N +endif + +#Not verbose by deafult +ifdef VERBOSE + UNITY_TEST_RUNNER_FLAGS += -v +endif + +ifdef GROUP + UNITY_TEST_RUNNER_FLAGS += -g $(GROUP) +endif + +ifdef NAME + UNITY_TEST_RUNNER_FLAGS += -n $(NAME) +endif + +ifdef REPEAT + UNITY_TEST_RUNNER_FLAGS += -r $(REPEAT) +endif + + +# -------------------------------------- +# derived flags in the following area +# -------------------------------------- +ifeq ($(UNITY_USE_MEM_LEAK_DETECTION), N) + UNITY_CFLAGS += -DUNITY_MEM_LEAK_DETECTION_DISABLED +else + UNITY_MEMLEAK_DETECTOR_MALLOC_MACRO_FILE = -include $(UNITY_HOME)/extras/fixture/src/unity_fixture_malloc_overrides.h +endif + +ifeq ($(UNITY_ENABLE_DEBUG), Y) + UNITY_CFLAGS += -g +endif + +ifeq ($(UNITY_USE_GCOV), Y) + UNITY_CFLAGS += -fprofile-arcs -ftest-coverage +endif + +UNITY_CFLAGS += $(UNITY_MEMLEAK_DETECTOR_MALLOC_MACRO_FILE) + +TARGET_MAP = $(COMPONENT_NAME).map.txt +ifeq ($(UNITY_MAP_FILE), Y) + UNITY_LDFLAGS += -Wl,-map,$(TARGET_MAP) +endif + +LD_LIBRARIES += -lgcov + +TARGET_LIB = \ + $(UNITY_LIB_DIR)/lib$(COMPONENT_NAME).a + +TEST_TARGET = \ + $(COMPONENT_NAME)_tests + +#Helper Functions +get_src_from_dir = $(wildcard $1/*.cpp) $(wildcard $1/*.c) +get_dirs_from_dirspec = $(wildcard $1) +get_src_from_dir_list = $(foreach dir, $1, $(call get_src_from_dir,$(dir))) +__src_to = $(subst .c,$1, $(subst .cpp,$1,$2)) +src_to = $(addprefix $(UNITY_OBJS_DIR)/,$(call __src_to,$1,$2)) +src_to_o = $(call src_to,.o,$1) +src_to_d = $(call src_to,.d,$1) +src_to_gcda = $(call src_to,.gcda,$1) +src_to_gcno = $(call src_to,.gcno,$1) +make_dotdot_a_subdir = $(subst ..,_dot_dot, $1) +time = $(shell date +%s) +delta_t = $(eval minus, $1, $2) +debug_print_list = $(foreach word,$1,echo " $(word)";) echo; + +#Derived +STUFF_TO_CLEAN += $(TEST_TARGET) $(TEST_TARGET).exe $(TARGET_LIB) $(TARGET_MAP) + +SRC += $(call get_src_from_dir_list, $(SRC_DIRS)) $(SRC_FILES) +OBJ = $(call src_to_o,$(SRC)) +OBJ2 = $(call make_dotdot_a_subdir. $(OBJ)) + +STUFF_TO_CLEAN += $(OBJ) + +TEST_SRC = $(call get_src_from_dir_list, $(TEST_SRC_DIRS)) +TEST_OBJS = $(call src_to_o,$(TEST_SRC)) +STUFF_TO_CLEAN += $(TEST_OBJS) + + +MOCKS_SRC = $(call get_src_from_dir_list, $(MOCKS_SRC_DIRS)) +MOCKS_OBJS = $(call src_to_o,$(MOCKS_SRC)) +STUFF_TO_CLEAN += $(MOCKS_OBJS) + +ALL_SRC = $(SRC) $(TEST_SRC) $(MOCKS_SRC) + +#Test coverage with gcov +GCOV_OUTPUT = gcov_output.txt +GCOV_REPORT = gcov_report.txt +GCOV_ERROR = gcov_error.txt +GCOV_GCDA_FILES = $(call src_to_gcda, $(ALL_SRC)) +GCOV_GCNO_FILES = $(call src_to_gcno, $(ALL_SRC)) +TEST_OUTPUT = $(TEST_TARGET).txt +STUFF_TO_CLEAN += \ + $(GCOV_OUTPUT)\ + $(GCOV_REPORT)\ + $(GCOV_REPORT).html\ + $(GCOV_ERROR)\ + $(GCOV_GCDA_FILES)\ + $(GCOV_GCNO_FILES)\ + $(TEST_OUTPUT) + + +#The gcda files for gcov need to be deleted before each run +#To avoid annoying messages. +GCOV_CLEAN = $(SILENCE)rm -f $(GCOV_GCDA_FILES) $(GCOV_OUTPUT) $(GCOV_REPORT) $(GCOV_ERROR) +RUN_TEST_TARGET = $(SILENCE) $(GCOV_CLEAN) ; echo "Running $(TEST_TARGET)"; ./$(TEST_TARGET) $(UNITY_TEST_RUNNER_FLAGS) + +INCLUDES_DIRS_EXPANDED = $(call get_dirs_from_dirspec, $(INCLUDE_DIRS)) +INCLUDES += $(foreach dir, $(INCLUDES_DIRS_EXPANDED), -I$(dir)) +MOCK_DIRS_EXPANDED = $(call get_dirs_from_dirspec, $(MOCKS_SRC_DIRS)) +INCLUDES += $(foreach dir, $(MOCK_DIRS_EXPANDED), -I$(dir)) + + +DEP_FILES = $(call src_to_d, $(ALL_SRC)) +STUFF_TO_CLEAN += $(DEP_FILES) $(PRODUCTION_CODE_START) $(PRODUCTION_CODE_END) +STUFF_TO_CLEAN += $(STDLIB_CODE_START) $(MAP_FILE) cpputest_*.xml junit_run_output + +# We'll use the UNITY_CFLAGS etc so that you can override AND add to the CppUTest flags +CFLAGS = $(UNITY_CFLAGS) $(UNITY_ADDITIONAL_CFLAGS) $(INCLUDES) $(UNITY_WARNINGFLAGS) +LDFLAGS = $(UNITY_LDFLAGS) $(UNITY_ADDITIONAL_LDFLAGS) + +# Targets + +.PHONY: all +all: start $(TEST_TARGET) + $(RUN_TEST_TARGET) + +.PHONY: start +start: $(TEST_TARGET) + $(SILENCE)START_TIME=$(call time) + +.PHONY: all_no_tests +all_no_tests: $(TEST_TARGET) + +.PHONY: flags +flags: + @echo + @echo "Compile C source with CFLAGS:" + @$(call debug_print_list,$(CFLAGS)) + @echo "Link with LDFLAGS:" + @$(call debug_print_list,$(LDFLAGS)) + @echo "Link with LD_LIBRARIES:" + @$(call debug_print_list,$(LD_LIBRARIES)) + @echo "Create libraries with ARFLAGS:" + @$(call debug_print_list,$(ARFLAGS)) + @echo "OBJ files:" + @$(call debug_print_list,$(OBJ2)) + + +$(TEST_TARGET): $(TEST_OBJS) $(MOCKS_OBJS) $(PRODUCTION_CODE_START) $(TARGET_LIB) $(USER_LIBS) $(PRODUCTION_CODE_END) $(STDLIB_CODE_START) + $(SILENCE)echo Linking $@ + $(SILENCE)$(LINK.o) -o $@ $^ $(LD_LIBRARIES) + +$(TARGET_LIB): $(OBJ) + $(SILENCE)echo Building archive $@ + $(SILENCE)mkdir -p lib + $(SILENCE)$(AR) $(ARFLAGS) $@ $^ + $(SILENCE)ranlib $@ + +test: $(TEST_TARGET) + $(RUN_TEST_TARGET) | tee $(TEST_OUTPUT) + +vtest: $(TEST_TARGET) + $(RUN_TEST_TARGET) -v | tee $(TEST_OUTPUT) + +$(UNITY_OBJS_DIR)/%.o: %.cpp + @echo compiling $(notdir $<) + $(SILENCE)mkdir -p $(dir $@) + $(SILENCE)$(COMPILE.cpp) -MMD -MP $(OUTPUT_OPTION) $< + +$(UNITY_OBJS_DIR)/%.o: %.c + @echo compiling $(notdir $<) + $(SILENCE)mkdir -p $(dir $@) + $(SILENCE)$(COMPILE.c) -MMD -MP $(OUTPUT_OPTION) $< + +ifneq "$(MAKECMDGOALS)" "clean" +-include $(DEP_FILES) +endif + +.PHONY: clean +clean: + $(SILENCE)echo Making clean + $(SILENCE)$(RM) $(STUFF_TO_CLEAN) + $(SILENCE)rm -rf gcov $(UNITY_OBJS_DIR) + $(SILENCE)find . -name "*.gcno" | xargs rm -f + $(SILENCE)find . -name "*.gcda" | xargs rm -f + +#realclean gets rid of all gcov, o and d files in the directory tree +#not just the ones made by this makefile +.PHONY: realclean +realclean: clean + $(SILENCE)rm -rf gcov + $(SILENCE)find . -name "*.gdcno" | xargs rm -f + $(SILENCE)find . -name "*.[do]" | xargs rm -f + +gcov: test + $(SILENCE)for d in $(SRC_DIRS) ; do \ + gcov --object-directory $(UNITY_OBJS_DIR)/$$d $$d/*.c $$d/*.cpp >> $(GCOV_OUTPUT) 2>>$(GCOV_ERROR) ; \ + done + $(SILENCE)for f in $(SRC_FILES) ; do \ + gcov --object-directory $(UNITY_OBJS_DIR)/$$f $$f >> $(GCOV_OUTPUT) 2>>$(GCOV_ERROR) ; \ + done + $(UNITY_BUILD_HOME)/filterGcov.sh $(GCOV_OUTPUT) $(GCOV_ERROR) $(GCOV_REPORT) $(TEST_OUTPUT) + $(SILENCE)cat $(GCOV_REPORT) + $(SILENCE)mkdir -p gcov + $(SILENCE)mv *.gcov gcov + $(SILENCE)mv gcov_* gcov + $(SILENCE)echo "See gcov directory for details" + +debug: + @echo + @echo "Target Source files:" + @$(call debug_print_list,$(SRC)) + @echo "Target Object files:" + @$(call debug_print_list,$(OBJ)) + @echo "Test Source files:" + @$(call debug_print_list,$(TEST_SRC)) + @echo "Test Object files:" + @$(call debug_print_list,$(TEST_OBJS)) + @echo "Mock Source files:" + @$(call debug_print_list,$(MOCKS_SRC)) + @echo "Mock Object files:" + @$(call debug_print_list,$(MOCKS_OBJS)) + @echo "All Input Dependency files:" + @$(call debug_print_list,$(DEP_FILES)) + @echo Stuff to clean: + @$(call debug_print_list,$(STUFF_TO_CLEAN)) + @echo Includes: + @$(call debug_print_list,$(INCLUDES)) + +ifneq "$(OTHER_MAKEFILE_TO_INCLUDE)" "" +-include $(OTHER_MAKEFILE_TO_INCLUDE) +endif + + + +st,$(TEST_SRC)) + @echo "Test Object files:" + @$(call debug_print \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/build/filterGcov.sh b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/build/filterGcov.sh new file mode 100644 index 0000000..a861cf6 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/build/filterGcov.sh @@ -0,0 +1,61 @@ +#!/bin/bash +INPUT_FILE=$1 +TEMP_FILE1=${INPUT_FILE}1.tmp +TEMP_FILE2=${INPUT_FILE}2.tmp +TEMP_FILE3=${INPUT_FILE}3.tmp +ERROR_FILE=$2 +OUTPUT_FILE=$3 +HTML_OUTPUT_FILE=$3.html +TEST_RESULTS=$4 + +flattenGcovOutput() { +while read line1 +do + read line2 + echo $line2 " " $line1 + read junk + read junk +done < ${INPUT_FILE} +} + +getRidOfCruft() { +sed '-e s/^Lines.*://g' \ + '-e s/^[0-9]\./ &/g' \ + '-e s/^[0-9][0-9]\./ &/g' \ + '-e s/of.*File/ /g' \ + "-e s/'//g" \ + '-e s/^.*\/usr\/.*$//g' \ + '-e s/^.*\.$//g' +} + +getFileNameRootFromErrorFile() { +sed '-e s/gc..:cannot open .* file//g' ${ERROR_FILE} +} + +writeEachNoTestCoverageFile() { +while read line +do + echo " 0.00% " ${line} +done +} + +createHtmlOutput() { + echo "" + echo "" + sed "-e s/.*% /
CoverageFile
&<\/td>/" \ + "-e s/[a-zA-Z0-9_]*\.[ch][a-z]*/&<\/a><\/td><\/tr>/" + echo "
" + sed "-e s/.*/&
/g" < ${TEST_RESULTS} +} + + +flattenGcovOutput | getRidOfCruft > ${TEMP_FILE1} +getFileNameRootFromErrorFile | writeEachNoTestCoverageFile > ${TEMP_FILE2} +cat ${TEMP_FILE1} ${TEMP_FILE2} | sort | uniq > ${OUTPUT_FILE} +createHtmlOutput < ${OUTPUT_FILE} > ${HTML_OUTPUT_FILE} +rm -f ${TEMP_FILE1} ${TEMP_FILE2} +erageFile" + sed "-e s/.*% /&<\/td>/" \ + "-e s/[a-zA-Z0-9_]*\.[ch][a-z]*/
&<\/a><\/td><\/tr>/" + echo "" + sed "-e s/.*/&
/g" < ${TEST_RESULTS \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/rakefile.rb b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/rakefile.rb new file mode 100644 index 0000000..6181707 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/rakefile.rb @@ -0,0 +1,37 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require HERE + 'rakefile_helper' + +include RakefileHelpers + +# Load default configuration, for now +DEFAULT_CONFIG_FILE = 'gcc.yml' +configure_toolchain(DEFAULT_CONFIG_FILE) + +task :unit do + run_tests +end + +desc "Build and test Unity Framework" +task :all => [:clean, :unit] +task :default => [:clobber, :all] +task :ci => [:no_color, :default] +task :cruise => [:no_color, :default] + +desc "Load configuration" +task :config, :config_file do |t, args| + configure_toolchain(args[:config_file]) +end + +task :no_color do + $colour_output = false +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/rakefile_helper.rb b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/rakefile_helper.rb new file mode 100644 index 0000000..a7f6a28 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/rakefile_helper.rb @@ -0,0 +1,178 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require 'yaml' +require 'fileutils' +require HERE+'../../auto/unity_test_summary' +require HERE+'../../auto/generate_test_runner' +require HERE+'../../auto/colour_reporter' + +module RakefileHelpers + + C_EXTENSION = '.c' + + def load_configuration(config_file) + unless ($configured) + $cfg_file = HERE+"../../targets/#{config_file}" unless (config_file =~ /[\\|\/]/) + $cfg = YAML.load(File.read($cfg_file)) + $colour_output = false unless $cfg['colour'] + $configured = true if (config_file != DEFAULT_CONFIG_FILE) + end + end + + def configure_clean + CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil? + end + + def configure_toolchain(config_file=DEFAULT_CONFIG_FILE) + config_file += '.yml' unless config_file =~ /\.yml$/ + config_file = config_file unless config_file =~ /[\\|\/]/ + load_configuration(config_file) + configure_clean + end + + def tackit(strings) + if strings.is_a?(Array) + result = "\"#{strings.join}\"" + else + result = strings + end + return result + end + + def squash(prefix, items) + result = '' + items.each { |item| result += " #{prefix}#{tackit(item)}" } + return result + end + + def build_compiler_fields + command = tackit($cfg['compiler']['path']) + if $cfg['compiler']['defines']['items'].nil? + defines = '' + else + defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items'] + ['UNITY_OUTPUT_CHAR=UnityOutputCharSpy_OutputChar']) + end + options = squash('', $cfg['compiler']['options']) + includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :defines => defines, :options => options, :includes => includes} + end + + def compile(file, defines=[]) + compiler = build_compiler_fields + unity_include = $cfg['compiler']['includes']['prefix']+'../../src' + cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{unity_include} #{file} " + + "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" + + "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" + execute(cmd_str) + end + + def build_linker_fields + command = tackit($cfg['linker']['path']) + if $cfg['linker']['options'].nil? + options = '' + else + options = squash('', $cfg['linker']['options']) + end + if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?) + includes = '' + else + includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) + end + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :options => options, :includes => includes} + end + + def link(exe_name, obj_list) + linker = build_linker_fields + cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + + (obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).join + + $cfg['linker']['bin_files']['prefix'] + ' ' + + $cfg['linker']['bin_files']['destination'] + + exe_name + $cfg['linker']['bin_files']['extension'] + execute(cmd_str) + end + + def build_simulator_fields + return nil if $cfg['simulator'].nil? + if $cfg['simulator']['path'].nil? + command = '' + else + command = (tackit($cfg['simulator']['path']) + ' ') + end + if $cfg['simulator']['pre_support'].nil? + pre_support = '' + else + pre_support = squash('', $cfg['simulator']['pre_support']) + end + if $cfg['simulator']['post_support'].nil? + post_support = '' + else + post_support = squash('', $cfg['simulator']['post_support']) + end + return {:command => command, :pre_support => pre_support, :post_support => post_support} + end + + def execute(command_string, verbose=true) + report command_string + output = `#{command_string}`.chomp + report(output) if (verbose && !output.nil? && (output.length > 0)) + if ($?.exitstatus != 0) + raise "Command failed. (Returned #{$?.exitstatus})" + end + return output + end + + def report_summary + summary = UnityTestSummary.new + summary.set_root_path(HERE) + results_glob = "#{$cfg['compiler']['build_path']}*.test*" + results_glob.gsub!(/\\/, '/') + results = Dir[results_glob] + summary.set_targets(results) + summary.run + end + + def run_tests + report 'Running Unity system tests...' + + # Tack on TEST define for compiling unit tests + load_configuration($cfg_file) + test_defines = ['TEST'] + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + + # Get a list of all source files needed + src_files = Dir[HERE+'src/*.c'] + src_files += Dir[HERE+'test/*.c'] + src_files << '../../src/Unity.c' + + # Build object files + src_files.each { |f| compile(f, test_defines) } + obj_list = src_files.map {|f| File.basename(f.ext($cfg['compiler']['object_files']['extension'])) } + + # Link the test executable + test_base = "framework_test" + link(test_base, obj_list) + + # Execute unit test and generate results file + simulator = build_simulator_fields + executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] + if simulator.nil? + cmd_str = executable + " -v -r" + else + cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" + end + output = execute(cmd_str) + test_results = $cfg['compiler']['build_path'] + test_base + if output.match(/OK$/m).nil? + test_results += '.testfail' + else + test_results += '.testpass' + end + File.open(test_results, 'w') { |f| f.print output } + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/readme.txt b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/readme.txt new file mode 100644 index 0000000..6b9a78c --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/readme.txt @@ -0,0 +1,9 @@ +Copyright (c) 2010 James Grenning and Contributed to Unity Project + +Unity Project - A Test Framework for C +Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +[Released under MIT License. Please refer to license.txt for details] + +This Framework is an optional add-on to Unity. By including unity_framework.h in place of unity.h, +you may now work with Unity in a manner similar to CppUTest. This framework adds the concepts of +test groups and gives finer control of your tests over the command line. \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c new file mode 100644 index 0000000..1ba3e9a --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c @@ -0,0 +1,381 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" +#include "unity_internals.h" +#include + +UNITY_FIXTURE_T UnityFixture; + +//If you decide to use the function pointer approach. +int (*outputChar)(int) = putchar; + +int verbose = 0; + +void setUp(void) { /*does nothing*/ } +void tearDown(void) { /*does nothing*/ } + +void announceTestRun(int runNumber) +{ + UnityPrint("Unity test run "); + UnityPrintNumber(runNumber+1); + UnityPrint(" of "); + UnityPrintNumber(UnityFixture.RepeatCount); + UNITY_OUTPUT_CHAR('\n'); +} + +int UnityMain(int argc, char* argv[], void (*runAllTests)()) +{ + int result = UnityGetCommandLineOptions(argc, argv); + int r; + if (result != 0) + return result; + + for (r = 0; r < UnityFixture.RepeatCount; r++) + { + announceTestRun(r); + UnityBegin(); + runAllTests(); + UNITY_OUTPUT_CHAR('\n'); + UnityEnd(); + } + + return UnityFailureCount(); +} + +static int selected(const char * filter, const char * name) +{ + if (filter == 0) + return 1; + return strstr(name, filter) ? 1 : 0; +} + +static int testSelected(const char* test) +{ + return selected(UnityFixture.NameFilter, test); +} + +static int groupSelected(const char* group) +{ + return selected(UnityFixture.GroupFilter, group); +} + +static void runTestCase() +{ + +} + +void UnityTestRunner(unityfunction* setup, + unityfunction* testBody, + unityfunction* teardown, + const char * printableName, + const char * group, + const char * name, + const char * file, int line) +{ + if (testSelected(name) && groupSelected(group)) + { + Unity.CurrentTestFailed = 0; + Unity.TestFile = file; + Unity.CurrentTestName = printableName; + Unity.CurrentTestLineNumber = line; + if (!UnityFixture.Verbose) + UNITY_OUTPUT_CHAR('.'); + else + UnityPrint(printableName); + + Unity.NumberOfTests++; + UnityMalloc_StartTest(); + UnityPointer_Init(); + + runTestCase(); + if (TEST_PROTECT()) + { + setup(); + testBody(); + } + if (TEST_PROTECT()) + { + teardown(); + } + if (TEST_PROTECT()) + { + UnityPointer_UndoAllSets(); + if (!Unity.CurrentTestFailed) + UnityMalloc_EndTest(); + UnityConcludeFixtureTest(); + } + else + { + //aborting - jwg - di i need these for the other TEST_PROTECTS? + } + } +} + +void UnityIgnoreTest() +{ + Unity.NumberOfTests++; + Unity.CurrentTestIgnored = 1; + UNITY_OUTPUT_CHAR('!'); +} + + +//------------------------------------------------- +//Malloc and free stuff +// +#define MALLOC_DONT_FAIL -1 +static int malloc_count; +static int malloc_fail_countdown = MALLOC_DONT_FAIL; + +void UnityMalloc_StartTest() +{ + malloc_count = 0; + malloc_fail_countdown = MALLOC_DONT_FAIL; +} + +void UnityMalloc_EndTest() +{ + malloc_fail_countdown = MALLOC_DONT_FAIL; + if (malloc_count != 0) + { + TEST_FAIL_MESSAGE("This test leaks!"); + } +} + +void UnityMalloc_MakeMallocFailAfterCount(int countdown) +{ + malloc_fail_countdown = countdown; +} + +#ifdef malloc +#undef malloc +#endif + +#ifdef free +#undef free +#endif + +#include +#include + +typedef struct GuardBytes +{ + int size; + char guard[sizeof(int)]; +} Guard; + + +static const char * end = "END"; + +void * unity_malloc(size_t size) +{ + char* mem; + Guard* guard; + + if (malloc_fail_countdown != MALLOC_DONT_FAIL) + { + if (malloc_fail_countdown == 0) + return 0; + malloc_fail_countdown--; + } + + malloc_count++; + + guard = (Guard*)malloc(size + sizeof(Guard) + 4); + guard->size = size; + mem = (char*)&(guard[1]); + memcpy(&mem[size], end, strlen(end) + 1); + + return (void*)mem; +} + +static int isOverrun(void * mem) +{ + Guard* guard = (Guard*)mem; + char* memAsChar = (char*)mem; + guard--; + + return strcmp(&memAsChar[guard->size], end) != 0; +} + +static void release_memory(void * mem) +{ + Guard* guard = (Guard*)mem; + guard--; + + malloc_count--; + free(guard); +} + +void unity_free(void * mem) +{ + int overrun = isOverrun(mem);//strcmp(&memAsChar[guard->size], end) != 0; + release_memory(mem); + if (overrun) + { + TEST_FAIL_MESSAGE("Buffer overrun detected during free()"); + } +} + +void* unity_calloc(size_t num, size_t size) +{ + void* mem = unity_malloc(num * size); + memset(mem, 0, num*size); + return mem; +} + +void* unity_realloc(void * oldMem, size_t size) +{ + Guard* guard = (Guard*)oldMem; +// char* memAsChar = (char*)oldMem; + void* newMem; + + if (oldMem == 0) + return unity_malloc(size); + + guard--; + if (isOverrun(oldMem)) + { + release_memory(oldMem); + TEST_FAIL_MESSAGE("Buffer overrun detected during realloc()"); + } + + if (size == 0) + { + release_memory(oldMem); + return 0; + } + + if (guard->size >= size) + return oldMem; + + newMem = unity_malloc(size); + memcpy(newMem, oldMem, size); + unity_free(oldMem); + return newMem; +} + + +//-------------------------------------------------------- +//Automatic pointer restoration functions +typedef struct _PointerPair +{ + struct _PointerPair * next; + void ** pointer; + void * old_value; +} PointerPair; + +enum {MAX_POINTERS=50}; +static PointerPair pointer_store[MAX_POINTERS]; +static int pointer_index = 0; + +void UnityPointer_Init() +{ + pointer_index = 0; +} + +void UnityPointer_Set(void ** pointer, void * newValue) +{ + if (pointer_index >= MAX_POINTERS) + TEST_FAIL_MESSAGE("Too many pointers set"); + + pointer_store[pointer_index].pointer = pointer; + pointer_store[pointer_index].old_value = *pointer; + *pointer = newValue; + pointer_index++; +} + +void UnityPointer_UndoAllSets() +{ + while (pointer_index > 0) + { + pointer_index--; + *(pointer_store[pointer_index].pointer) = + pointer_store[pointer_index].old_value; + + } +} + +int UnityFailureCount() +{ + return Unity.TestFailures; +} + +int UnityGetCommandLineOptions(int argc, char* argv[]) +{ + int i; + UnityFixture.Verbose = 0; + UnityFixture.GroupFilter = 0; + UnityFixture.NameFilter = 0; + UnityFixture.RepeatCount = 1; + + if (argc == 1) + return 0; + + for (i = 1; i < argc; ) + { + if (strcmp(argv[i], "-v") == 0) + { + UnityFixture.Verbose = 1; + i++; + } + else if (strcmp(argv[i], "-g") == 0) + { + i++; + if (i >= argc) + return 1; + UnityFixture.GroupFilter = argv[i]; + i++; + } + else if (strcmp(argv[i], "-n") == 0) + { + i++; + if (i >= argc) + return 1; + UnityFixture.NameFilter = argv[i]; + i++; + } + else if (strcmp(argv[i], "-r") == 0) + { + UnityFixture.RepeatCount = 2; + i++; + if (i < argc) + { + if (*(argv[i]) >= '0' && *(argv[i]) <= '9') + { + UnityFixture.RepeatCount = atoi(argv[i]); + i++; + } + } + } + } + return 0; +} + +void UnityConcludeFixtureTest() +{ + if (Unity.CurrentTestIgnored) + { + Unity.TestIgnores++; + } + else if (!Unity.CurrentTestFailed) + { + if (UnityFixture.Verbose) + { + UnityPrint(" PASS"); + UNITY_OUTPUT_CHAR('\n'); + } + } + else if (Unity.CurrentTestFailed) + { + Unity.TestFailures++; + } + + Unity.CurrentTestFailed = 0; + Unity.CurrentTestIgnored = 0; +} + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.h b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.h new file mode 100644 index 0000000..da1f871 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.h @@ -0,0 +1,81 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FIXTURE_H_ +#define UNITY_FIXTURE_H_ + +#include "unity.h" +#include "unity_internals.h" +#include "unity_fixture_malloc_overrides.h" +#include "unity_fixture_internals.h" + +int UnityMain(int argc, char* argv[], void (*runAllTests)()); + + +#define TEST_GROUP(group)\ + int TEST_GROUP_##group = 0 + +#define TEST_SETUP(group) void TEST_##group##_SETUP() + +#define TEST_TEAR_DOWN(group) void TEST_##group##_TEAR_DOWN() + + +#define TEST(group, name) \ + void TEST_##group##_##name##_();\ + void TEST_##group##_##name##_run()\ + {\ + UnityTestRunner(TEST_##group##_SETUP,\ + TEST_##group##_##name##_,\ + TEST_##group##_TEAR_DOWN,\ + "TEST(" #group ", " #name ")",\ + #group, #name,\ + __FILE__, __LINE__);\ + }\ + void TEST_##group##_##name##_() + +#define IGNORE_TEST(group, name) \ + void TEST_##group##_##name##_();\ + void TEST_##group##_##name##_run()\ + {\ + UnityIgnoreTest();\ + }\ + void TEST_##group##_##name##_() + +#define DECLARE_TEST_CASE(group, name) \ + void TEST_##group##_##name##_run() + +#define RUN_TEST_CASE(group, name) \ + DECLARE_TEST_CASE(group, name);\ + TEST_##group##_##name##_run(); + +//This goes at the bottom of each test file or in a separate c file +#define TEST_GROUP_RUNNER(group)\ + void TEST_##group##_GROUP_RUNNER_runAll();\ + void TEST_##group##_GROUP_RUNNER()\ + {\ + TEST_##group##_GROUP_RUNNER_runAll();\ + }\ + void TEST_##group##_GROUP_RUNNER_runAll() + +//Call this from main +#define RUN_TEST_GROUP(group)\ + void TEST_##group##_GROUP_RUNNER();\ + TEST_##group##_GROUP_RUNNER(); + +//CppUTest Compatibility Macros +#define UT_PTR_SET(ptr, newPointerValue) UnityPointer_Set((void**)&ptr, (void*)newPointerValue) +#define TEST_ASSERT_POINTERS_EQUAL(expected, actual) TEST_ASSERT_EQUAL_PTR(expected, actual) +#define TEST_ASSERT_BYTES_EQUAL(expected, actual) TEST_ASSERT_EQUAL_HEX8(0xff & (expected), 0xff & (actual)) +#define FAIL(message) TEST_FAIL((message)) +#define CHECK(condition) TEST_ASSERT_TRUE((condition)) +#define LONGS_EQUAL(expected, actual) TEST_ASSERT_EQUAL_INT((expected), (actual)) +#define STRCMP_EQUAL(expected, actual) TEST_ASSERT_EQUAL_STRING((expected), (actual)) +#define DOUBLES_EQUAL(expected, actual, delta) TEST_ASSERT_FLOAT_WITHIN(((expected), (actual), (delta)) + +void UnityMalloc_MakeMallocFailAfterCount(int count); + +#endif /* UNITY_FIXTURE_H_ */ diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h new file mode 100644 index 0000000..db23f67 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h @@ -0,0 +1,44 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FIXTURE_INTERNALS_H_ +#define UNITY_FIXTURE_INTERNALS_H_ + +typedef struct _UNITY_FIXTURE_T +{ + int Verbose; + unsigned int RepeatCount; + const char* NameFilter; + const char* GroupFilter; +} UNITY_FIXTURE_T; + +typedef void unityfunction(); +void UnityTestRunner(unityfunction * setup, + unityfunction * body, + unityfunction * teardown, + const char * printableName, + const char * group, + const char * name, + const char * file, int line); + +void UnityIgnoreTest(); +void UnityMalloc_StartTest(); +void UnityMalloc_EndTest(); +int UnityFailureCount(); +int UnityGetCommandLineOptions(int argc, char* argv[]); +void UnityConcludeFixtureTest(); + +void UnityPointer_Set(void ** ptr, void * newValue); +void UnityPointer_UndoAllSets(); +void UnityPointer_Init(); + +void UnityAssertEqualPointer(const void * expected, + const void * actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +#endif /* UNITY_FIXTURE_INTERNALS_H_ */ diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h new file mode 100644 index 0000000..38f8e34 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h @@ -0,0 +1,16 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FIXTURE_MALLOC_OVERRIDES_H_ +#define UNITY_FIXTURE_MALLOC_OVERRIDES_H_ + +#define malloc unity_malloc +#define calloc unity_calloc +#define realloc unity_realloc +#define free unity_free + +#endif /* UNITY_FIXTURE_MALLOC_OVERRIDES_H_ */ diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/main/AllTests.c b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/main/AllTests.c new file mode 100644 index 0000000..ccb775b --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/main/AllTests.c @@ -0,0 +1,21 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" + +static void runAllTests() +{ + RUN_TEST_GROUP(UnityFixture); + RUN_TEST_GROUP(UnityCommandOptions); + RUN_TEST_GROUP(LeakDetection) +} + +int main(int argc, char* argv[]) +{ + return UnityMain(argc, argv, runAllTests); +} + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/testunity_fixture.c b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/testunity_fixture.c new file mode 100644 index 0000000..de0c04c --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/testunity_fixture.c @@ -0,0 +1,39 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" + +static int data = -1; + +TEST_GROUP(mygroup); + +TEST_SETUP(mygroup) +{ + data = 0; +} + +TEST_TEAR_DOWN(mygroup) +{ + data = -1; +} + +TEST(mygroup, test1) +{ + TEST_ASSERT_EQUAL_INT(0, data); +} + +TEST(mygroup, test2) +{ + TEST_ASSERT_EQUAL_INT(0, data); + data = 5; +} + +TEST(mygroup, test3) +{ + data = 7; + TEST_ASSERT_EQUAL_INT(7, data); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c new file mode 100644 index 0000000..b8b4524 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c @@ -0,0 +1,321 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" +#include "unity_output_Spy.h" +#include +#include + +extern UNITY_FIXTURE_T UnityFixture; + +TEST_GROUP(UnityFixture); + +TEST_SETUP(UnityFixture) +{ +} + +TEST_TEAR_DOWN(UnityFixture) +{ +} + +int my_int; +int* pointer1 = 0; +int* pointer2 = (int*)2; +int* pointer3 = (int*)3; +int int1; +int int2; +int int3; +int int4; + +TEST(UnityFixture, PointerSetting) +{ + TEST_ASSERT_POINTERS_EQUAL(pointer1, 0); + UT_PTR_SET(pointer1, &int1); + UT_PTR_SET(pointer2, &int2); + UT_PTR_SET(pointer3, &int3); + TEST_ASSERT_POINTERS_EQUAL(pointer1, &int1); + TEST_ASSERT_POINTERS_EQUAL(pointer2, &int2); + TEST_ASSERT_POINTERS_EQUAL(pointer3, &int3); + UT_PTR_SET(pointer1, &int4); + UnityPointer_UndoAllSets(); + TEST_ASSERT_POINTERS_EQUAL(pointer1, 0); + TEST_ASSERT_POINTERS_EQUAL(pointer2, (int*)2); + TEST_ASSERT_POINTERS_EQUAL(pointer3, (int*)3); +} + +TEST(UnityFixture, ForceMallocFail) +{ + UnityMalloc_MakeMallocFailAfterCount(1); + void* m = malloc(10); + CHECK(m); + void* mfails = malloc(10); + TEST_ASSERT_POINTERS_EQUAL(0, mfails); + free(m); +} + +TEST(UnityFixture, ReallocSmallerIsUnchanged) +{ + void* m1 = malloc(10); + void* m2 = realloc(m1, 5); + TEST_ASSERT_POINTERS_EQUAL(m1, m2); + free(m2); +} + +TEST(UnityFixture, ReallocSameIsUnchanged) +{ + void* m1 = malloc(10); + void* m2 = realloc(m1, 10); + TEST_ASSERT_POINTERS_EQUAL(m1, m2); + free(m2); +} + +TEST(UnityFixture, ReallocLargerNeeded) +{ + void* m1 = malloc(10); + strcpy((char*)m1, "123456789"); + void* m2 = realloc(m1, 15); + CHECK(m1 != m2); + STRCMP_EQUAL("123456789", m2); + free(m2); +} + +TEST(UnityFixture, ReallocNullPointerIsLikeMalloc) +{ + void* m = realloc(0, 15); + CHECK(m != 0); + free(m); +} + +TEST(UnityFixture, ReallocSizeZeroFreesMemAndReturnsNullPointer) +{ + void* m1 = malloc(10); + void* m2 = realloc(m1, 0); + TEST_ASSERT_POINTERS_EQUAL(0, m2); +} + +TEST(UnityFixture, CallocFillsWithZero) +{ + void* m = calloc(3, sizeof(char)); + char* s = (char*)m; + TEST_ASSERT_BYTES_EQUAL(0, s[0]); + TEST_ASSERT_BYTES_EQUAL(0, s[1]); + TEST_ASSERT_BYTES_EQUAL(0, s[2]); + free(m); +} + +char *p1; +char *p2; + +TEST(UnityFixture, PointerSet) +{ + char c1; + char c2; + char newC1; + char newC2; + p1 = &c1; + p2 = &c2; + + UnityPointer_Init(10); + UT_PTR_SET(p1, &newC1); + UT_PTR_SET(p2, &newC2); + TEST_ASSERT_POINTERS_EQUAL(&newC1, p1); + TEST_ASSERT_POINTERS_EQUAL(&newC2, p2); + UnityPointer_UndoAllSets(); + TEST_ASSERT_POINTERS_EQUAL(&c1, p1); + TEST_ASSERT_POINTERS_EQUAL(&c2, p2); +} + +//------------------------------------------------------------ + +TEST_GROUP(UnityCommandOptions); + +int savedVerbose; +int savedRepeat; +const char* savedName; +const char* savedGroup; + +TEST_SETUP(UnityCommandOptions) +{ + savedVerbose = UnityFixture.Verbose; + savedRepeat = UnityFixture.RepeatCount; + savedName = UnityFixture.NameFilter; + savedGroup = UnityFixture.GroupFilter; +} + +TEST_TEAR_DOWN(UnityCommandOptions) +{ + UnityFixture.Verbose = savedVerbose; + UnityFixture.RepeatCount= savedRepeat; + UnityFixture.NameFilter = savedName; + UnityFixture.GroupFilter = savedGroup; +} + + +static char* noOptions[] = { + "testrunner.exe" +}; + +TEST(UnityCommandOptions, DefaultOptions) +{ + UnityGetCommandLineOptions(1, noOptions); + TEST_ASSERT_EQUAL(0, UnityFixture.Verbose); + TEST_ASSERT_POINTERS_EQUAL(0, UnityFixture.GroupFilter); + TEST_ASSERT_POINTERS_EQUAL(0, UnityFixture.NameFilter); + TEST_ASSERT_EQUAL(1, UnityFixture.RepeatCount); +} + +static char* verbose[] = { + "testrunner.exe", + "-v" +}; + +TEST(UnityCommandOptions, OptionVerbose) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(2, verbose)); + TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); +} + +static char* group[] = { + "testrunner.exe", + "-g", "groupname" +}; + +TEST(UnityCommandOptions, OptionSelectTestByGroup) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, group)); + STRCMP_EQUAL("groupname", UnityFixture.GroupFilter); +} + +static char* name[] = { + "testrunner.exe", + "-n", "testname" +}; + +TEST(UnityCommandOptions, OptionSelectTestByName) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, name)); + STRCMP_EQUAL("testname", UnityFixture.NameFilter); +} + +static char* repeat[] = { + "testrunner.exe", + "-r", "99" +}; + +TEST(UnityCommandOptions, OptionSelectRepeatTestsDefaultCount) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(2, repeat)); + TEST_ASSERT_EQUAL(2, UnityFixture.RepeatCount); +} + +TEST(UnityCommandOptions, OptionSelectRepeatTestsSpecificCount) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, repeat)); + TEST_ASSERT_EQUAL(99, UnityFixture.RepeatCount); +} + +static char* multiple[] = { + "testrunner.exe", + "-v", + "-g", "groupname", + "-n", "testname", + "-r", "98" +}; + +TEST(UnityCommandOptions, MultipleOptions) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(8, multiple)); + TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); + STRCMP_EQUAL("groupname", UnityFixture.GroupFilter); + STRCMP_EQUAL("testname", UnityFixture.NameFilter); + TEST_ASSERT_EQUAL(98, UnityFixture.RepeatCount); +} + +static char* dashRNotLast[] = { + "testrunner.exe", + "-v", + "-g", "gggg", + "-r", + "-n", "tttt", +}; + +TEST(UnityCommandOptions, MultipleOptionsDashRNotLastAndNoValueSpecified) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(7, dashRNotLast)); + TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); + STRCMP_EQUAL("gggg", UnityFixture.GroupFilter); + STRCMP_EQUAL("tttt", UnityFixture.NameFilter); + TEST_ASSERT_EQUAL(2, UnityFixture.RepeatCount); +} + + +//------------------------------------------------------------ + +TEST_GROUP(LeakDetection); + +TEST_SETUP(LeakDetection) +{ + UnityOutputCharSpy_Create(1000); +} + +TEST_TEAR_DOWN(LeakDetection) +{ + UnityOutputCharSpy_Destroy(); +} + +#define EXPECT_ABORT_BEGIN \ + { \ + jmp_buf TestAbortFrame; \ + memcpy(TestAbortFrame, Unity.AbortFrame, sizeof(jmp_buf)); \ + if (TEST_PROTECT()) \ + { + +#define EXPECT_ABORT_END \ + } \ + memcpy(Unity.AbortFrame, TestAbortFrame, sizeof(jmp_buf)); \ + } + +TEST(LeakDetection, DetectsLeak) +{ + void* m = malloc(10); + UnityOutputCharSpy_Enable(1); + EXPECT_ABORT_BEGIN + UnityMalloc_EndTest(); + EXPECT_ABORT_END + UnityOutputCharSpy_Enable(0); + CHECK(strstr(UnityOutputCharSpy_Get(), "This test leaks!")); + free(m); + Unity.CurrentTestFailed = 0; +} + +TEST(LeakDetection, BufferOverrunFoundDuringFree) +{ + void* m = malloc(10); + char* s = (char*)m; + s[10] = (char)0xFF; + UnityOutputCharSpy_Enable(1); + EXPECT_ABORT_BEGIN + free(m); + EXPECT_ABORT_END + UnityOutputCharSpy_Enable(0); + CHECK(strstr(UnityOutputCharSpy_Get(), "Buffer overrun detected during free()")); + Unity.CurrentTestFailed = 0; +} + +TEST(LeakDetection, BufferOverrunFoundDuringRealloc) +{ + void* m = malloc(10); + char* s = (char*)m; + s[10] = (char)0xFF; + UnityOutputCharSpy_Enable(1); + EXPECT_ABORT_BEGIN + m = realloc(m, 100); + EXPECT_ABORT_END + UnityOutputCharSpy_Enable(0); + CHECK(strstr(UnityOutputCharSpy_Get(), "Buffer overrun detected during realloc()")); + Unity.CurrentTestFailed = 0; +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c new file mode 100644 index 0000000..80fec09 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c @@ -0,0 +1,40 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" + +TEST_GROUP_RUNNER(UnityFixture) +{ + RUN_TEST_CASE(UnityFixture, PointerSetting); + RUN_TEST_CASE(UnityFixture, ForceMallocFail); + RUN_TEST_CASE(UnityFixture, ReallocSmallerIsUnchanged); + RUN_TEST_CASE(UnityFixture, ReallocSameIsUnchanged); + RUN_TEST_CASE(UnityFixture, ReallocLargerNeeded); + RUN_TEST_CASE(UnityFixture, ReallocNullPointerIsLikeMalloc); + RUN_TEST_CASE(UnityFixture, ReallocSizeZeroFreesMemAndReturnsNullPointer); + RUN_TEST_CASE(UnityFixture, CallocFillsWithZero); + RUN_TEST_CASE(UnityFixture, PointerSet); +} + +TEST_GROUP_RUNNER(UnityCommandOptions) +{ + RUN_TEST_CASE(UnityCommandOptions, DefaultOptions); + RUN_TEST_CASE(UnityCommandOptions, OptionVerbose); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectTestByGroup); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectTestByName); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectRepeatTestsDefaultCount); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectRepeatTestsSpecificCount); + RUN_TEST_CASE(UnityCommandOptions, MultipleOptions); + RUN_TEST_CASE(UnityCommandOptions, MultipleOptionsDashRNotLastAndNoValueSpecified); +} + +TEST_GROUP_RUNNER(LeakDetection) +{ + RUN_TEST_CASE(LeakDetection, DetectsLeak); + RUN_TEST_CASE(LeakDetection, BufferOverrunFoundDuringFree); + RUN_TEST_CASE(LeakDetection, BufferOverrunFoundDuringRealloc); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.c b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.c new file mode 100644 index 0000000..16faefa --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.c @@ -0,0 +1,56 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + + +#include "unity_output_Spy.h" +#include +#include +#include + +static int size; +static int count; +static char* buffer; +static int spy_enable; + +void UnityOutputCharSpy_Create(int s) +{ + size = s; + count = 0; + spy_enable = 0; + buffer = malloc(size); + memset(buffer, 0, size); +} + +void UnityOutputCharSpy_Destroy() +{ + size = 0; + free(buffer); +} + +int UnityOutputCharSpy_OutputChar(int c) +{ + if (spy_enable) + { + if (count < (size-1)) + buffer[count++] = c; + } + else + { + putchar(c); + } + return c; +} + +const char * UnityOutputCharSpy_Get() +{ + return buffer; +} + +void UnityOutputCharSpy_Enable(int enable) +{ + spy_enable = enable; +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.h b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.h new file mode 100644 index 0000000..7c1590e --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.h @@ -0,0 +1,17 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef D_unity_output_Spy_H +#define D_unity_output_Spy_H + +void UnityOutputCharSpy_Create(int s); +void UnityOutputCharSpy_Destroy(); +int UnityOutputCharSpy_OutputChar(int c); +const char * UnityOutputCharSpy_Get(); +void UnityOutputCharSpy_Enable(int enable); + +#endif diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/makefile b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/makefile new file mode 100644 index 0000000..8c8444b --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/makefile @@ -0,0 +1,35 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +C_COMPILER=gcc +TARGET_BASE = testunity +ifeq ($(OS),Windows_NT) + TARGET_EXTENSION=.exe +else + TARGET_EXTENSION=.out +endif +TARGET = $(TARGET_BASE)$(TARGET_EXTENSION) +OUT_FILE=-o $(TARGET) +SRC_FILES=src/unity.c test/testunity.c build/testunity_Runner.c +INC_DIRS=-Isrc +SYMBOLS=-DTEST -DUNITY_SUPPORT_64 + +ifeq ($(OS),Windows_NT) + CLEANUP = del /F /Q build\* && del /F /Q $(TARGET) +else + CLEANUP = rm -f build/*.o ; rm -f $(TARGET) +endif + +all: clean default + +default: + ruby auto/generate_test_runner.rb test/testunity.c build/testunity_Runner.c + $(C_COMPILER) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES) $(OUT_FILE) + $(TARGET) + +clean: + $(CLEANUP) + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/rakefile.rb b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/rakefile.rb new file mode 100644 index 0000000..3ec5d5a --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/rakefile.rb @@ -0,0 +1,48 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require HERE + 'rakefile_helper' + +include RakefileHelpers + +# Load default configuration, for now +DEFAULT_CONFIG_FILE = 'gcc.yml' +configure_toolchain(DEFAULT_CONFIG_FILE) + +desc "Test unity with its own unit tests" +task :unit do + run_tests get_unit_test_files +end + +Rake::TestTask.new(:scripts) do |t| + t.pattern = 'test/test_*.rb' + t.verbose = true +end + +desc "Generate test summary" +task :summary do + report_summary +end + +desc "Build and test Unity" +task :all => [:clean, :scripts, :unit, :summary] +task :default => [:clobber, :all] +task :ci => [:no_color, :default] +task :cruise => [:no_color, :default] + +desc "Load configuration" +task :config, :config_file do |t, args| + configure_toolchain(args[:config_file]) +end + +task :no_color do + $colour_output = false +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/rakefile_helper.rb b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/rakefile_helper.rb new file mode 100644 index 0000000..218fcaa --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/rakefile_helper.rb @@ -0,0 +1,243 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require 'yaml' +require 'fileutils' +require HERE+'auto/unity_test_summary' +require HERE+'auto/generate_test_runner' +require HERE+'auto/colour_reporter' + +module RakefileHelpers + + C_EXTENSION = '.c' + + def load_configuration(config_file) + unless ($configured) + $cfg_file = "targets/#{config_file}" unless (config_file =~ /[\\|\/]/) + $cfg = YAML.load(File.read($cfg_file)) + $colour_output = false unless $cfg['colour'] + $configured = true if (config_file != DEFAULT_CONFIG_FILE) + end + end + + def configure_clean + CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil? + end + + def configure_toolchain(config_file=DEFAULT_CONFIG_FILE) + config_file += '.yml' unless config_file =~ /\.yml$/ + config_file = config_file unless config_file =~ /[\\|\/]/ + load_configuration(config_file) + configure_clean + end + + def get_unit_test_files + path = $cfg['compiler']['unit_tests_path'] + 'test*' + C_EXTENSION + path.gsub!(/\\/, '/') + FileList.new(path) + end + + def get_local_include_dirs + include_dirs = $cfg['compiler']['includes']['items'].dup + include_dirs.delete_if {|dir| dir.is_a?(Array)} + return include_dirs + end + + def extract_headers(filename) + includes = [] + lines = File.readlines(filename) + lines.each do |line| + m = line.match(/^\s*#include\s+\"\s*(.+\.[hH])\s*\"/) + if not m.nil? + includes << m[1] + end + end + return includes + end + + def find_source_file(header, paths) + paths.each do |dir| + src_file = dir + header.ext(C_EXTENSION) + if (File.exists?(src_file)) + return src_file + end + end + return nil + end + + def tackit(strings) + if strings.is_a?(Array) + result = "\"#{strings.join}\"" + else + result = strings + end + return result + end + + def squash(prefix, items) + result = '' + items.each { |item| result += " #{prefix}#{tackit(item)}" } + return result + end + + def build_compiler_fields + command = tackit($cfg['compiler']['path']) + if $cfg['compiler']['defines']['items'].nil? + defines = '' + else + defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items']) + end + options = squash('', $cfg['compiler']['options']) + includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :defines => defines, :options => options, :includes => includes} + end + + def compile(file, defines=[]) + compiler = build_compiler_fields + cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{file} " + + "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" + + "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" + execute(cmd_str) + end + + def build_linker_fields + command = tackit($cfg['linker']['path']) + if $cfg['linker']['options'].nil? + options = '' + else + options = squash('', $cfg['linker']['options']) + end + if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?) + includes = '' + else + includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) + end + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :options => options, :includes => includes} + end + + def link(exe_name, obj_list) + linker = build_linker_fields + cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + + (obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).join + + $cfg['linker']['bin_files']['prefix'] + ' ' + + $cfg['linker']['bin_files']['destination'] + + exe_name + $cfg['linker']['bin_files']['extension'] + execute(cmd_str) + end + + def build_simulator_fields + return nil if $cfg['simulator'].nil? + if $cfg['simulator']['path'].nil? + command = '' + else + command = (tackit($cfg['simulator']['path']) + ' ') + end + if $cfg['simulator']['pre_support'].nil? + pre_support = '' + else + pre_support = squash('', $cfg['simulator']['pre_support']) + end + if $cfg['simulator']['post_support'].nil? + post_support = '' + else + post_support = squash('', $cfg['simulator']['post_support']) + end + return {:command => command, :pre_support => pre_support, :post_support => post_support} + end + + def execute(command_string, verbose=true) + report command_string + output = `#{command_string}`.chomp + report(output) if (verbose && !output.nil? && (output.length > 0)) + if $?.exitstatus != 0 + raise "Command failed. (Returned #{$?.exitstatus})" + end + return output + end + + def report_summary + summary = UnityTestSummary.new + summary.set_root_path(HERE) + results_glob = "#{$cfg['compiler']['build_path']}*.test*" + results_glob.gsub!(/\\/, '/') + results = Dir[results_glob] + summary.set_targets(results) + summary.run + end + + def run_tests(test_files) + report 'Running Unity system tests...' + + # Tack on TEST define for compiling unit tests + load_configuration($cfg_file) + test_defines = ['TEST'] + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + $cfg['compiler']['defines']['items'] << 'TEST' + + include_dirs = get_local_include_dirs + + # Build and execute each unit test + test_files.each do |test| + obj_list = [] + + # Detect dependencies and build required modules + extract_headers(test).each do |header| + # Compile corresponding source file if it exists + src_file = find_source_file(header, include_dirs) + if !src_file.nil? + compile(src_file, test_defines) + obj_list << header.ext($cfg['compiler']['object_files']['extension']) + end + end + + # Build the test runner (generate if configured to do so) + test_base = File.basename(test, C_EXTENSION) + + runner_name = test_base + '_Runner.c' + runner_path = '' + + if $cfg['compiler']['runner_path'].nil? + runner_path = $cfg['compiler']['build_path'] + runner_name + else + runner_path = $cfg['compiler']['runner_path'] + runner_name + end + + options = $cfg[:unity] + options[:use_param_tests] = (test =~ /parameterized/) ? true : false + UnityTestRunnerGenerator.new(options).run(test, runner_path) + + compile(runner_path, test_defines) + obj_list << runner_name.ext($cfg['compiler']['object_files']['extension']) + + # Build the test module + compile(test, test_defines) + obj_list << test_base.ext($cfg['compiler']['object_files']['extension']) + + # Link the test executable + link(test_base, obj_list) + + # Execute unit test and generate results file + simulator = build_simulator_fields + executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] + if simulator.nil? + cmd_str = executable + else + cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" + end + output = execute(cmd_str) + test_results = $cfg['compiler']['build_path'] + test_base + if output.match(/OK$/m).nil? + test_results += '.testfail' + else + test_results += '.testpass' + end + File.open(test_results, 'w') { |f| f.print output } + + end + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/release/build.info b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/release/build.info new file mode 100644 index 0000000..7871b21 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/release/build.info @@ -0,0 +1,2 @@ +118 + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/release/version.info b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/release/version.info new file mode 100644 index 0000000..0d71c08 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/release/version.info @@ -0,0 +1,2 @@ +2.0 + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/src/unity.c b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/src/unity.c new file mode 100644 index 0000000..d85b880 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/src/unity.c @@ -0,0 +1,855 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity.h" +#include +#include + +#define UNITY_FAIL_AND_BAIL { Unity.CurrentTestFailed = 1; UNITY_OUTPUT_CHAR('\n'); longjmp(Unity.AbortFrame, 1); } +#define UNITY_IGNORE_AND_BAIL { Unity.CurrentTestIgnored = 1; UNITY_OUTPUT_CHAR('\n'); longjmp(Unity.AbortFrame, 1); } +/// return prematurely if we are already in failure or ignore state +#define UNITY_SKIP_EXECUTION { if ((Unity.CurrentTestFailed != 0) || (Unity.CurrentTestIgnored != 0)) {return;} } +#define UNITY_PRINT_EOL { UNITY_OUTPUT_CHAR('\n'); } + +struct _Unity Unity = { 0 }; + +const char* UnityStrNull = "NULL"; +const char* UnityStrSpacer = ". "; +const char* UnityStrExpected = " Expected "; +const char* UnityStrWas = " Was "; +const char* UnityStrTo = " To "; +const char* UnityStrElement = " Element "; +const char* UnityStrMemory = " Memory Mismatch"; +const char* UnityStrDelta = " Values Not Within Delta "; +const char* UnityStrPointless= " You Asked Me To Compare Nothing, Which Was Pointless."; +const char* UnityStrNullPointerForExpected= " Expected pointer to be NULL"; +const char* UnityStrNullPointerForActual = " Actual pointer was NULL"; + +const _U_UINT UnitySizeMask[] = +{ + 255, + 65535, + 65535, + 4294967295, + 4294967295, + 4294967295, + 4294967295 +#ifdef UNITY_SUPPORT_64 + ,0xFFFFFFFFFFFFFFFF +#endif +}; + +//----------------------------------------------- +// Pretty Printers & Test Result Output Handlers +//----------------------------------------------- + +void UnityPrint(const char* string) +{ + const char* pch = string; + + if (pch != NULL) + { + while (*pch) + { + // printable characters plus CR & LF are printed + if ((*pch <= 126) && (*pch >= 32)) + { + UNITY_OUTPUT_CHAR(*pch); + } + //write escaped carriage returns + else if (*pch == 13) + { + UNITY_OUTPUT_CHAR('\\'); + UNITY_OUTPUT_CHAR('r'); + } + //write escaped line feeds + else if (*pch == 10) + { + UNITY_OUTPUT_CHAR('\\'); + UNITY_OUTPUT_CHAR('n'); + } + // unprintable characters are shown as codes + else + { + UNITY_OUTPUT_CHAR('\\'); + UnityPrintNumberHex((_U_SINT)*pch, 2); + } + pch++; + } + } +} + +//----------------------------------------------- +void UnityPrintNumberByStyle(const _U_SINT number, const UNITY_DISPLAY_STYLE_T style) +{ + if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT) + { + UnityPrintNumber(number); + } + else if ((style & UNITY_DISPLAY_RANGE_UINT) == UNITY_DISPLAY_RANGE_UINT) + { + UnityPrintNumberUnsigned( (_U_UINT)number & UnitySizeMask[((_U_UINT)style & (_U_UINT)0x0F) - 1] ); + } + else + { + UnityPrintNumberHex((_U_UINT)number, (style & 0x000F) << 1); + } +} + +//----------------------------------------------- +/// basically do an itoa using as little ram as possible +void UnityPrintNumber(const _U_SINT number_to_print) +{ + _U_SINT divisor = 1; + _U_SINT next_divisor; + _U_SINT number = number_to_print; + + if (number < 0) + { + UNITY_OUTPUT_CHAR('-'); + number = -number; + } + + // figure out initial divisor + while (number / divisor > 9) + { + next_divisor = divisor * 10; + if (next_divisor > divisor) + divisor = next_divisor; + else + break; + } + + // now mod and print, then divide divisor + do + { + UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10))); + divisor /= 10; + } + while (divisor > 0); +} + +//----------------------------------------------- +/// basically do an itoa using as little ram as possible +void UnityPrintNumberUnsigned(const _U_UINT number) +{ + _U_UINT divisor = 1; + _U_UINT next_divisor; + + // figure out initial divisor + while (number / divisor > 9) + { + next_divisor = divisor * 10; + if (next_divisor > divisor) + divisor = next_divisor; + else + break; + } + + // now mod and print, then divide divisor + do + { + UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10))); + divisor /= 10; + } + while (divisor > 0); +} + +//----------------------------------------------- +void UnityPrintNumberHex(const _U_UINT number, const char nibbles_to_print) +{ + _U_UINT nibble; + char nibbles = nibbles_to_print; + UNITY_OUTPUT_CHAR('0'); + UNITY_OUTPUT_CHAR('x'); + + while (nibbles > 0) + { + nibble = (number >> (--nibbles << 2)) & 0x0000000F; + if (nibble <= 9) + { + UNITY_OUTPUT_CHAR((char)('0' + nibble)); + } + else + { + UNITY_OUTPUT_CHAR((char)('A' - 10 + nibble)); + } + } +} + +//----------------------------------------------- +void UnityPrintMask(const _U_UINT mask, const _U_UINT number) +{ + _U_UINT current_bit = (_U_UINT)1 << (UNITY_INT_WIDTH - 1); + _US32 i; + + for (i = 0; i < UNITY_INT_WIDTH; i++) + { + if (current_bit & mask) + { + if (current_bit & number) + { + UNITY_OUTPUT_CHAR('1'); + } + else + { + UNITY_OUTPUT_CHAR('0'); + } + } + else + { + UNITY_OUTPUT_CHAR('X'); + } + current_bit = current_bit >> 1; + } +} + +//----------------------------------------------- +#ifdef UNITY_FLOAT_VERBOSE +void UnityPrintFloat(_UF number) +{ + char TempBuffer[32]; + sprintf(TempBuffer, "%.6f", number); + UnityPrint(TempBuffer); +} +#endif + +//----------------------------------------------- +void UnityTestResultsBegin(const char* file, const UNITY_LINE_TYPE line) +{ + UnityPrint(file); + UNITY_OUTPUT_CHAR(':'); + UnityPrintNumber(line); + UNITY_OUTPUT_CHAR(':'); + UnityPrint(Unity.CurrentTestName); + UNITY_OUTPUT_CHAR(':'); +} + +//----------------------------------------------- +void UnityTestResultsFailBegin(const UNITY_LINE_TYPE line) +{ + UnityTestResultsBegin(Unity.TestFile, line); + UnityPrint("FAIL:"); +} + +//----------------------------------------------- +void UnityConcludeTest(void) +{ + if (Unity.CurrentTestIgnored) + { + Unity.TestIgnores++; + } + else if (!Unity.CurrentTestFailed) + { + UnityTestResultsBegin(Unity.TestFile, Unity.CurrentTestLineNumber); + UnityPrint("PASS"); + UNITY_PRINT_EOL; + } + else + { + Unity.TestFailures++; + } + + Unity.CurrentTestFailed = 0; + Unity.CurrentTestIgnored = 0; +} + +//----------------------------------------------- +void UnityAddMsgIfSpecified(const char* msg) +{ + if (msg) + { + UnityPrint(UnityStrSpacer); + UnityPrint(msg); + } +} + +//----------------------------------------------- +void UnityPrintExpectedAndActualStrings(const char* expected, const char* actual) +{ + UnityPrint(UnityStrExpected); + if (expected != NULL) + { + UNITY_OUTPUT_CHAR('\''); + UnityPrint(expected); + UNITY_OUTPUT_CHAR('\''); + } + else + { + UnityPrint(UnityStrNull); + } + UnityPrint(UnityStrWas); + if (actual != NULL) + { + UNITY_OUTPUT_CHAR('\''); + UnityPrint(actual); + UNITY_OUTPUT_CHAR('\''); + } + else + { + UnityPrint(UnityStrNull); + } +} + +//----------------------------------------------- +// Assertion & Control Helpers +//----------------------------------------------- + +int UnityCheckArraysForNull(const void* expected, const void* actual, const UNITY_LINE_TYPE lineNumber, const char* msg) +{ + //return true if they are both NULL + if ((expected == NULL) && (actual == NULL)) + return 1; + + //throw error if just expected is NULL + if (expected == NULL) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrNullPointerForExpected); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + //throw error if just actual is NULL + if (actual == NULL) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrNullPointerForActual); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + //return false if neither is NULL + return 0; +} + +//----------------------------------------------- +// Assertion Functions +//----------------------------------------------- + +void UnityAssertBits(const _U_SINT mask, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + UNITY_SKIP_EXECUTION; + + if ((mask & expected) != (mask & actual)) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrExpected); + UnityPrintMask(mask, expected); + UnityPrint(UnityStrWas); + UnityPrintMask(mask, actual); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualNumber(const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style) +{ + UNITY_SKIP_EXECUTION; + + if (expected != actual) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(expected, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(actual, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualIntArray(const _U_SINT* expected, + const _U_SINT* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style) +{ + _UU32 elements = num_elements; + const _US8* ptr_exp = (_US8*)expected; + const _US8* ptr_act = (_US8*)actual; + + UNITY_SKIP_EXECUTION; + + if (elements == 0) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + switch(style) + { + case UNITY_DISPLAY_STYLE_HEX8: + case UNITY_DISPLAY_STYLE_INT8: + case UNITY_DISPLAY_STYLE_UINT8: + while (elements--) + { + if (*ptr_exp != *ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 1; + ptr_act += 1; + } + break; + case UNITY_DISPLAY_STYLE_HEX16: + case UNITY_DISPLAY_STYLE_INT16: + case UNITY_DISPLAY_STYLE_UINT16: + while (elements--) + { + if (*(_US16*)ptr_exp != *(_US16*)ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*(_US16*)ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*(_US16*)ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 2; + ptr_act += 2; + } + break; +#ifdef UNITY_SUPPORT_64 + case UNITY_DISPLAY_STYLE_HEX64: + case UNITY_DISPLAY_STYLE_INT64: + case UNITY_DISPLAY_STYLE_UINT64: + while (elements--) + { + if (*(_US64*)ptr_exp != *(_US64*)ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*(_US64*)ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*(_US64*)ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 8; + ptr_act += 8; + } + break; +#endif + default: + while (elements--) + { + if (*(_US32*)ptr_exp != *(_US32*)ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*(_US32*)ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*(_US32*)ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 4; + ptr_act += 4; + } + break; + } +} + +//----------------------------------------------- +#ifndef UNITY_EXCLUDE_FLOAT +void UnityAssertEqualFloatArray(const _UF* expected, + const _UF* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UU32 elements = num_elements; + const _UF* ptr_expected = expected; + const _UF* ptr_actual = actual; + _UF diff, tol; + + UNITY_SKIP_EXECUTION; + + if (elements == 0) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + while (elements--) + { + diff = *ptr_expected - *ptr_actual; + if (diff < 0.0) + diff = 0.0 - diff; + tol = UNITY_FLOAT_PRECISION * *ptr_expected; + if (tol < 0.0) + tol = 0.0 - tol; + if (diff > tol) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); +#ifdef UNITY_FLOAT_VERBOSE + UnityPrint(UnityStrExpected); + UnityPrintFloat(*ptr_expected); + UnityPrint(UnityStrWas); + UnityPrintFloat(*ptr_actual); +#else + UnityPrint(UnityStrDelta); +#endif + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_expected++; + ptr_actual++; + } +} + +//----------------------------------------------- +void UnityAssertFloatsWithin(const _UF delta, + const _UF expected, + const _UF actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UF diff = actual - expected; + _UF pos_delta = delta; + + UNITY_SKIP_EXECUTION; + + if (diff < 0) + { + diff = 0.0f - diff; + } + if (pos_delta < 0) + { + pos_delta = 0.0f - pos_delta; + } + + if (pos_delta < diff) + { + UnityTestResultsFailBegin(lineNumber); +#ifdef UNITY_FLOAT_VERBOSE + UnityPrint(UnityStrExpected); + UnityPrintFloat(expected); + UnityPrint(UnityStrWas); + UnityPrintFloat(actual); +#else + UnityPrint(UnityStrDelta); +#endif + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} +#endif + +//----------------------------------------------- +void UnityAssertNumbersWithin( const _U_SINT delta, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style) +{ + UNITY_SKIP_EXECUTION; + + if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT) + { + if (actual > expected) + Unity.CurrentTestFailed = ((actual - expected) > delta); + else + Unity.CurrentTestFailed = ((expected - actual) > delta); + } + else + { + if ((_U_UINT)actual > (_U_UINT)expected) + Unity.CurrentTestFailed = ((_U_UINT)(actual - expected) > (_U_UINT)delta); + else + Unity.CurrentTestFailed = ((_U_UINT)(expected - actual) > (_U_UINT)delta); + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrDelta); + UnityPrintNumberByStyle(delta, style); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(expected, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(actual, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualString(const char* expected, + const char* actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UU32 i; + + UNITY_SKIP_EXECUTION; + + // if both pointers not null compare the strings + if (expected && actual) + { + for (i = 0; expected[i] || actual[i]; i++) + { + if (expected[i] != actual[i]) + { + Unity.CurrentTestFailed = 1; + break; + } + } + } + else + { // handle case of one pointers being null (if both null, test should pass) + if (expected != actual) + { + Unity.CurrentTestFailed = 1; + } + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrintExpectedAndActualStrings(expected, actual); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualStringArray( const char** expected, + const char** actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UU32 i, j = 0; + + UNITY_SKIP_EXECUTION; + + // if no elements, it's an error + if (num_elements == 0) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + do + { + // if both pointers not null compare the strings + if (expected[j] && actual[j]) + { + for (i = 0; expected[j][i] || actual[j][i]; i++) + { + if (expected[j][i] != actual[j][i]) + { + Unity.CurrentTestFailed = 1; + break; + } + } + } + else + { // handle case of one pointers being null (if both null, test should pass) + if (expected[j] != actual[j]) + { + Unity.CurrentTestFailed = 1; + } + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + if (num_elements > 1) + { + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - j - 1), UNITY_DISPLAY_STYLE_UINT); + } + UnityPrintExpectedAndActualStrings((const char*)(expected[j]), (const char*)(actual[j])); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + } while (++j < num_elements); +} + +//----------------------------------------------- +void UnityAssertEqualMemory( const void* expected, + const void* actual, + _UU32 length, + _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + unsigned char* expected_ptr = (unsigned char*)expected; + unsigned char* actual_ptr = (unsigned char*)actual; + _UU32 elements = num_elements; + + UNITY_SKIP_EXECUTION; + + if ((elements == 0) || (length == 0)) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + while (elements--) + { + if (memcmp((const void*)expected_ptr, (const void*)actual_ptr, length) != 0) + { + Unity.CurrentTestFailed = 1; + break; + } + expected_ptr += length; + actual_ptr += length; + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + if (num_elements > 1) + { + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + } + UnityPrint(UnityStrMemory); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +// Control Functions +//----------------------------------------------- + +void UnityFail(const char* msg, const UNITY_LINE_TYPE line) +{ + UNITY_SKIP_EXECUTION; + + UnityTestResultsBegin(Unity.TestFile, line); + UnityPrint("FAIL"); + if (msg != NULL) + { + UNITY_OUTPUT_CHAR(':'); + if (msg[0] != ' ') + { + UNITY_OUTPUT_CHAR(' '); + } + UnityPrint(msg); + } + UNITY_FAIL_AND_BAIL; +} + +//----------------------------------------------- +void UnityIgnore(const char* msg, const UNITY_LINE_TYPE line) +{ + UNITY_SKIP_EXECUTION; + + UnityTestResultsBegin(Unity.TestFile, line); + UnityPrint("IGNORE"); + if (msg != NULL) + { + UNITY_OUTPUT_CHAR(':'); + UNITY_OUTPUT_CHAR(' '); + UnityPrint(msg); + } + UNITY_IGNORE_AND_BAIL; +} + +//----------------------------------------------- +void setUp(void); +void tearDown(void); +void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum) +{ + Unity.CurrentTestName = FuncName; + Unity.CurrentTestLineNumber = FuncLineNum; + Unity.NumberOfTests++; + if (TEST_PROTECT()) + { + setUp(); + Func(); + } + if (TEST_PROTECT() && !(Unity.CurrentTestIgnored)) + { + tearDown(); + } + UnityConcludeTest(); +} + +//----------------------------------------------- +void UnityBegin(void) +{ + Unity.NumberOfTests = 0; +} + +//----------------------------------------------- +int UnityEnd(void) +{ + UnityPrint("-----------------------"); + UNITY_PRINT_EOL; + UnityPrintNumber(Unity.NumberOfTests); + UnityPrint(" Tests "); + UnityPrintNumber(Unity.TestFailures); + UnityPrint(" Failures "); + UnityPrintNumber(Unity.TestIgnores); + UnityPrint(" Ignored"); + UNITY_PRINT_EOL; + if (Unity.TestFailures == 0U) + { + UnityPrint("OK"); + } + else + { + UnityPrint("FAIL"); + } + UNITY_PRINT_EOL; + return Unity.TestFailures; +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/src/unity.h b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/src/unity.h new file mode 100644 index 0000000..0b1b187 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/src/unity.h @@ -0,0 +1,213 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FRAMEWORK_H +#define UNITY_FRAMEWORK_H + +#define UNITY + +#include "unity_internals.h" + +//------------------------------------------------------- +// Configuration Options +//------------------------------------------------------- + +// Integers +// - Unity assumes 32 bit integers by default +// - If your compiler treats ints of a different size, define UNITY_INT_WIDTH + +// Floats +// - define UNITY_EXCLUDE_FLOAT to disallow floating point comparisons +// - define UNITY_FLOAT_PRECISION to specify the precision to use when doing TEST_ASSERT_EQUAL_FLOAT +// - define UNITY_FLOAT_TYPE to specify doubles instead of single precision floats +// - define UNITY_FLOAT_VERBOSE to print floating point values in errors (uses sprintf) + +// Output +// - by default, Unity prints to standard out with putchar. define UNITY_OUTPUT_CHAR(a) with a different function if desired + +// Optimization +// - by default, line numbers are stored in unsigned shorts. Define UNITY_LINE_TYPE with a different type if your files are huge +// - by default, test and failure counters are unsigned shorts. Define UNITY_COUNTER_TYPE with a different type if you want to save space or have more than 65535 Tests. + +// Test Cases +// - define UNITY_SUPPORT_TEST_CASES to include the TEST_CASE macro, though really it's mostly about the runner generator script + +// Parameterized Tests +// - you'll want to create a define of TEST_CASE(...) which basically evaluates to nothing + +//------------------------------------------------------- +// Test Running Macros +//------------------------------------------------------- + +#define TEST_PROTECT() (setjmp(Unity.AbortFrame) == 0) + +#define TEST_ABORT() {longjmp(Unity.AbortFrame, 1);} + +#ifndef RUN_TEST +#define RUN_TEST(func, line_num) UnityDefaultTestRun(func, #func, line_num) +#endif + +#define TEST_LINE_NUM (Unity.CurrentTestLineNumber) +#define TEST_IS_IGNORED (Unity.CurrentTestIgnored) + +//------------------------------------------------------- +// Basic Fail and Ignore +//------------------------------------------------------- + +#define TEST_FAIL_MESSAGE(message) UNITY_TEST_FAIL(__LINE__, message) +#define TEST_FAIL() UNITY_TEST_FAIL(__LINE__, NULL) +#define TEST_IGNORE_MESSAGE(message) UNITY_TEST_IGNORE(__LINE__, message) +#define TEST_IGNORE() UNITY_TEST_IGNORE(__LINE__, NULL) +#define TEST_ONLY() + +//------------------------------------------------------- +// Test Asserts (simple) +//------------------------------------------------------- + +//Boolean +#define TEST_ASSERT(condition) UNITY_TEST_ASSERT( (condition), __LINE__, " Expression Evaluated To FALSE") +#define TEST_ASSERT_TRUE(condition) UNITY_TEST_ASSERT( (condition), __LINE__, " Expected TRUE Was FALSE") +#define TEST_ASSERT_UNLESS(condition) UNITY_TEST_ASSERT( !(condition), __LINE__, " Expression Evaluated To TRUE") +#define TEST_ASSERT_FALSE(condition) UNITY_TEST_ASSERT( !(condition), __LINE__, " Expected FALSE Was TRUE") +#define TEST_ASSERT_NULL(pointer) UNITY_TEST_ASSERT_NULL( (pointer), __LINE__, " Expected NULL") +#define TEST_ASSERT_NOT_NULL(pointer) UNITY_TEST_ASSERT_NOT_NULL((pointer), __LINE__, " Expected Non-NULL") + +//Integers (of all sizes) +#define TEST_ASSERT_EQUAL_INT(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT8(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT8((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT16(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT16((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT32(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT32((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT64(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT64((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_NOT_EQUAL(expected, actual) UNITY_TEST_ASSERT(((expected) != (actual)), __LINE__, " Expected Not-Equal") +#define TEST_ASSERT_EQUAL_UINT(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT8(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT8( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT16(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT16( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT32(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT32( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT64(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT64( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX8(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX8( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX16(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX16((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX32(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX64(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX64((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_BITS(mask, expected, actual) UNITY_TEST_ASSERT_BITS((mask), (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_BITS_HIGH(mask, actual) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(-1), (actual), __LINE__, NULL) +#define TEST_ASSERT_BITS_LOW(mask, actual) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(0), (actual), __LINE__, NULL) +#define TEST_ASSERT_BIT_HIGH(bit, actual) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(-1), (actual), __LINE__, NULL) +#define TEST_ASSERT_BIT_LOW(bit, actual) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(0), (actual), __LINE__, NULL) + +//Integer Ranges (of all sizes) +#define TEST_ASSERT_INT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_UINT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX8_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX16_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX32_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX64_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, __LINE__, NULL) + +//Structs and Strings +#define TEST_ASSERT_EQUAL_PTR(expected, actual) UNITY_TEST_ASSERT_EQUAL_PTR((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_STRING(expected, actual) UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_MEMORY(expected, actual, len) UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, __LINE__, NULL) + +//Arrays +#define TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements) UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, __LINE__, NULL) + +//Floating Point (If Enabled) +#define TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_FLOAT(expected, actual) UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, __LINE__, NULL) + +//------------------------------------------------------- +// Test Asserts (with additional messages) +//------------------------------------------------------- + +//Boolean +#define TEST_ASSERT_MESSAGE(condition, message) UNITY_TEST_ASSERT( (condition), __LINE__, message) +#define TEST_ASSERT_TRUE_MESSAGE(condition, message) UNITY_TEST_ASSERT( (condition), __LINE__, message) +#define TEST_ASSERT_UNLESS_MESSAGE(condition, message) UNITY_TEST_ASSERT( !(condition), __LINE__, message) +#define TEST_ASSERT_FALSE_MESSAGE(condition, message) UNITY_TEST_ASSERT( !(condition), __LINE__, message) +#define TEST_ASSERT_NULL_MESSAGE(pointer, message) UNITY_TEST_ASSERT_NULL( (pointer), __LINE__, message) +#define TEST_ASSERT_NOT_NULL_MESSAGE(pointer, message) UNITY_TEST_ASSERT_NOT_NULL((pointer), __LINE__, message) + +//Integers (of all sizes) +#define TEST_ASSERT_EQUAL_INT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT8((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT16((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT32((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT64((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, message) +#define TEST_ASSERT_NOT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT(((expected) != (actual)), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT8( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT16( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT32( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT64( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX8( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX16((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX64((expected), (actual), __LINE__, message) +#define TEST_ASSERT_BITS_MESSAGE(mask, expected, actual, message) UNITY_TEST_ASSERT_BITS((mask), (expected), (actual), __LINE__, message) +#define TEST_ASSERT_BITS_HIGH_MESSAGE(mask, actual, message) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(-1), (actual), __LINE__, message) +#define TEST_ASSERT_BITS_LOW_MESSAGE(mask, actual, message) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(0), (actual), __LINE__, message) +#define TEST_ASSERT_BIT_HIGH_MESSAGE(bit, actual, message) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(-1), (actual), __LINE__, message) +#define TEST_ASSERT_BIT_LOW_MESSAGE(bit, actual, message) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(0), (actual), __LINE__, message) + +//Integer Ranges (of all sizes) +#define TEST_ASSERT_INT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_UINT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX8_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX16_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX32_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX64_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, __LINE__, message) + +//Structs and Strings +#define TEST_ASSERT_EQUAL_PTR_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_PTR(expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_STRING_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_MEMORY_MESSAGE(expected, actual, len, message) UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, __LINE__, message) + +//Arrays +#define TEST_ASSERT_EQUAL_INT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_STRING_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_MEMORY_ARRAY_MESSAGE(expected, actual, len, num_elements, message) UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, __LINE__, message) + +//Floating Point (If Enabled) +#define TEST_ASSERT_FLOAT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_FLOAT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_FLOAT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, __LINE__, message) +#endif diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/src/unity_internals.h b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/src/unity_internals.h new file mode 100644 index 0000000..29c9d1d --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/src/unity_internals.h @@ -0,0 +1,355 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_INTERNALS_H +#define UNITY_INTERNALS_H + +#include +#include + +//------------------------------------------------------- +// Int Support +//------------------------------------------------------- + +#ifndef UNITY_INT_WIDTH +#define UNITY_INT_WIDTH (32) +#endif + +#ifndef UNITY_LONG_WIDTH +#define UNITY_LONG_WIDTH (32) +#endif + +#if (UNITY_INT_WIDTH == 32) + typedef unsigned char _UU8; + typedef unsigned short _UU16; + typedef unsigned int _UU32; + typedef signed char _US8; + typedef signed short _US16; + typedef signed int _US32; +#elif (UNITY_INT_WIDTH == 16) + typedef unsigned char _UU8; + typedef unsigned int _UU16; + typedef unsigned long _UU32; + typedef signed char _US8; + typedef signed int _US16; + typedef signed long _US32; +#else + #error Invalid UNITY_INT_WIDTH specified! (16 or 32 are supported) +#endif + +//------------------------------------------------------- +// 64-bit Support +//------------------------------------------------------- + +#ifndef UNITY_SUPPORT_64 + +//No 64-bit Support +typedef _UU32 _U_UINT; +typedef _US32 _U_SINT; + +#else + +//64-bit Support +#if (UNITY_LONG_WIDTH == 32) + typedef unsigned long long _UU64; + typedef signed long long _US64; +#elif (UNITY_LONG_WIDTH == 64) + typedef unsigned long _UU64; + typedef signed long _US64; +#else + #error Invalid UNITY_LONG_WIDTH specified! (32 or 64 are supported) +#endif +typedef _UU64 _U_UINT; +typedef _US64 _U_SINT; + +#endif + +//------------------------------------------------------- +// Pointer Support +//------------------------------------------------------- + +#ifndef UNITY_POINTER_WIDTH +#define UNITY_POINTER_WIDTH (32) +#endif + +#if (UNITY_POINTER_WIDTH == 32) + typedef _UU32 _UP; +#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX32 +#elif (UNITY_POINTER_WIDTH == 64) + typedef _UU64 _UP; +#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX64 +#elif (UNITY_POINTER_WIDTH == 16) + typedef _UU16 _UP; +#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX16 +#else + #error Invalid UNITY_POINTER_WIDTH specified! (16, 32 or 64 are supported) +#endif + +//------------------------------------------------------- +// Float Support +//------------------------------------------------------- + +#ifdef UNITY_EXCLUDE_FLOAT + +//No Floating Point Support +#undef UNITY_FLOAT_PRECISION +#undef UNITY_FLOAT_TYPE +#undef UNITY_FLOAT_VERBOSE + +#else + +//Floating Point Support +#ifndef UNITY_FLOAT_PRECISION +#define UNITY_FLOAT_PRECISION (0.00001f) +#endif +#ifndef UNITY_FLOAT_TYPE +#define UNITY_FLOAT_TYPE float +#endif +typedef UNITY_FLOAT_TYPE _UF; + +#endif + +//------------------------------------------------------- +// Output Method +//------------------------------------------------------- + +#ifndef UNITY_OUTPUT_CHAR +//Default to using putchar, which is defined in stdio.h above +#define UNITY_OUTPUT_CHAR(a) putchar(a) +#else +//If defined as something else, make sure we declare it here so it's ready for use +extern int UNITY_OUTPUT_CHAR(int); +#endif + +//------------------------------------------------------- +// Footprint +//------------------------------------------------------- + +#ifndef UNITY_LINE_TYPE +#define UNITY_LINE_TYPE unsigned short +#endif + +#ifndef UNITY_COUNTER_TYPE +#define UNITY_COUNTER_TYPE unsigned short +#endif + +//------------------------------------------------------- +// Internal Structs Needed +//------------------------------------------------------- + +typedef void (*UnityTestFunction)(void); + +#define UNITY_DISPLAY_RANGE_INT (0x10) +#define UNITY_DISPLAY_RANGE_UINT (0x20) +#define UNITY_DISPLAY_RANGE_HEX (0x40) +#define UNITY_DISPLAY_RANGE_AUTO (0x80) + +typedef enum +{ + UNITY_DISPLAY_STYLE_INT = 4 + UNITY_DISPLAY_RANGE_INT + UNITY_DISPLAY_RANGE_AUTO, + UNITY_DISPLAY_STYLE_INT8 = 1 + UNITY_DISPLAY_RANGE_INT, + UNITY_DISPLAY_STYLE_INT16 = 2 + UNITY_DISPLAY_RANGE_INT, + UNITY_DISPLAY_STYLE_INT32 = 4 + UNITY_DISPLAY_RANGE_INT, +#ifdef UNITY_SUPPORT_64 + UNITY_DISPLAY_STYLE_INT64 = 8 + UNITY_DISPLAY_RANGE_INT, +#endif + UNITY_DISPLAY_STYLE_UINT = 4 + UNITY_DISPLAY_RANGE_UINT + UNITY_DISPLAY_RANGE_AUTO, + UNITY_DISPLAY_STYLE_UINT8 = 1 + UNITY_DISPLAY_RANGE_UINT, + UNITY_DISPLAY_STYLE_UINT16 = 2 + UNITY_DISPLAY_RANGE_UINT, + UNITY_DISPLAY_STYLE_UINT32 = 4 + UNITY_DISPLAY_RANGE_UINT, +#ifdef UNITY_SUPPORT_64 + UNITY_DISPLAY_STYLE_UINT64 = 8 + UNITY_DISPLAY_RANGE_UINT, +#endif + UNITY_DISPLAY_STYLE_HEX8 = 1 + UNITY_DISPLAY_RANGE_HEX, + UNITY_DISPLAY_STYLE_HEX16 = 2 + UNITY_DISPLAY_RANGE_HEX, + UNITY_DISPLAY_STYLE_HEX32 = 4 + UNITY_DISPLAY_RANGE_HEX, +#ifdef UNITY_SUPPORT_64 + UNITY_DISPLAY_STYLE_HEX64 = 8 + UNITY_DISPLAY_RANGE_HEX, +#endif +} UNITY_DISPLAY_STYLE_T; + +struct _Unity +{ + const char* TestFile; + const char* CurrentTestName; + _UU32 CurrentTestLineNumber; + UNITY_COUNTER_TYPE NumberOfTests; + UNITY_COUNTER_TYPE TestFailures; + UNITY_COUNTER_TYPE TestIgnores; + UNITY_COUNTER_TYPE CurrentTestFailed; + UNITY_COUNTER_TYPE CurrentTestIgnored; + jmp_buf AbortFrame; +}; + +extern struct _Unity Unity; + +//------------------------------------------------------- +// Test Suite Management +//------------------------------------------------------- + +void UnityBegin(void); +int UnityEnd(void); +void UnityConcludeTest(void); +void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum); + +//------------------------------------------------------- +// Test Output +//------------------------------------------------------- + +void UnityPrint(const char* string); +void UnityPrintMask(const _U_UINT mask, const _U_UINT number); +void UnityPrintNumberByStyle(const _U_SINT number, const UNITY_DISPLAY_STYLE_T style); +void UnityPrintNumber(const _U_SINT number); +void UnityPrintNumberUnsigned(const _U_UINT number); +void UnityPrintNumberHex(const _U_UINT number, const char nibbles); + +#ifdef UNITY_FLOAT_VERBOSE +void UnityPrintFloat(const _UF number); +#endif + +//------------------------------------------------------- +// Test Assertion Fuctions +//------------------------------------------------------- +// Use the macros below this section instead of calling +// these directly. The macros have a consistent naming +// convention and will pull in file and line information +// for you. + +void UnityAssertEqualNumber(const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style); + +void UnityAssertEqualIntArray(const _U_SINT* expected, + const _U_SINT* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style); + +void UnityAssertBits(const _U_SINT mask, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualString(const char* expected, + const char* actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualStringArray( const char** expected, + const char** actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualMemory( const void* expected, + const void* actual, + const _UU32 length, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertNumbersWithin(const _U_SINT delta, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style); + +void UnityFail(const char* message, const UNITY_LINE_TYPE line); + +void UnityIgnore(const char* message, const UNITY_LINE_TYPE line); + +#ifndef UNITY_EXCLUDE_FLOAT +void UnityAssertFloatsWithin(const _UF delta, + const _UF expected, + const _UF actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualFloatArray(const _UF* expected, + const _UF* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber); +#endif + +//------------------------------------------------------- +// Basic Fail and Ignore +//------------------------------------------------------- + +#define UNITY_TEST_FAIL(line, message) UnityFail( (message), (UNITY_LINE_TYPE)line); +#define UNITY_TEST_IGNORE(line, message) UnityIgnore( (message), (UNITY_LINE_TYPE)line); + +//------------------------------------------------------- +// Test Asserts +//------------------------------------------------------- + +#define UNITY_TEST_ASSERT(condition, line, message) if (condition) {} else {UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, message);} +#define UNITY_TEST_ASSERT_NULL(pointer, line, message) UNITY_TEST_ASSERT(((pointer) == NULL), (UNITY_LINE_TYPE)line, message) +#define UNITY_TEST_ASSERT_NOT_NULL(pointer, line, message) UNITY_TEST_ASSERT(((pointer) != NULL), (UNITY_LINE_TYPE)line, message) + +#define UNITY_TEST_ASSERT_EQUAL_INT(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_UINT(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_HEX8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX8) +#define UNITY_TEST_ASSERT_EQUAL_HEX16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX16) +#define UNITY_TEST_ASSERT_EQUAL_HEX32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX32) +#define UNITY_TEST_ASSERT_BITS(mask, expected, actual, line, message) UnityAssertBits((_U_SINT)(mask), (_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line) + +#define UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX8) +#define UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX16) +#define UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX32) +#define UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64) + +#define UNITY_TEST_ASSERT_EQUAL_PTR(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(_UP)(expected), (_U_SINT)(_UP)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_POINTER) +#define UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, line, message) UnityAssertEqualString((const char*)(expected), (const char*)(actual), (message), (UNITY_LINE_TYPE)line) +#define UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, line, message) UnityAssertEqualMemory((void*)(expected), (void*)(actual), (_UU32)(len), 1, (message), (UNITY_LINE_TYPE)line) + +#define UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT8) +#define UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT16) +#define UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT32) +#define UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT8) +#define UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT16) +#define UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT32) +#define UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX8) +#define UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX16) +#define UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX32) +#define UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualStringArray((const char**)(expected), (const char**)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line) +#define UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, line, message) UnityAssertEqualMemory((void*)(expected), (void*)(actual), (_UU32)(len), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line) + +#ifdef UNITY_SUPPORT_64 +#define UNITY_TEST_ASSERT_EQUAL_INT64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT64) +#define UNITY_TEST_ASSERT_EQUAL_UINT64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT64) +#define UNITY_TEST_ASSERT_EQUAL_HEX64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64) +#define UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT64) +#define UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT64) +#define UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64) +#endif + +#ifdef UNITY_EXCLUDE_FLOAT +#define UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled") +#define UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled") +#define UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled") +#else +#define UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, line, message) UnityAssertFloatsWithin((_UF)(delta), (_UF)(expected), (_UF)(actual), (message), (UNITY_LINE_TYPE)line) +#define UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, line, message) UNITY_TEST_ASSERT_FLOAT_WITHIN((_UF)(expected) * (_UF)UNITY_FLOAT_PRECISION, (_UF)expected, (_UF)actual, (UNITY_LINE_TYPE)line, message) +#define UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualFloatArray((_UF*)(expected), (_UF*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line) +#endif + +#endif diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/targets/gcc.yml b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/targets/gcc.yml new file mode 100644 index 0000000..0f18c6c --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/targets/gcc.yml @@ -0,0 +1,42 @@ +compiler: + path: gcc + source_path: 'src/' + unit_tests_path: &unit_tests_path 'test/' + build_path: &build_path 'build/' + options: + - '-c' + - '-Wall' + - '-Wno-address' + - '-std=c99' + - '-pedantic' + includes: + prefix: '-I' + items: + - 'src/' + - '../src/' + - *unit_tests_path + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - UNITY_SUPPORT_TEST_CASES + object_files: + prefix: '-o' + extension: '.o' + destination: *build_path +linker: + path: gcc + options: + - -lm + includes: + prefix: '-I' + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.exe' + destination: *build_path +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/targets/gcc_64.yml b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/targets/gcc_64.yml new file mode 100644 index 0000000..97cb958 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/targets/gcc_64.yml @@ -0,0 +1,43 @@ +compiler: + path: gcc + source_path: 'src/' + unit_tests_path: &unit_tests_path 'test/' + build_path: &build_path 'build/' + options: + - '-c' + - '-Wall' + - '-Wno-address' + - '-std=c99' + - '-pedantic' + includes: + prefix: '-I' + items: + - 'src/' + - '../src/' + - *unit_tests_path + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - UNITY_SUPPORT_TEST_CASES + - 'UNITY_POINTER_WIDTH=64' + object_files: + prefix: '-o' + extension: '.o' + destination: *build_path +linker: + path: gcc + options: + - -lm + includes: + prefix: '-I' + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.exe' + destination: *build_path +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/targets/hitech_picc18.yml b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/targets/hitech_picc18.yml new file mode 100644 index 0000000..210d944 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/targets/hitech_picc18.yml @@ -0,0 +1,101 @@ +# rumor has it that this yaml file works for the standard edition of the +# hitech PICC18 compiler, but not the pro version. +# +compiler: + path: cd build && picc18 + source_path: 'c:\Projects\NexGen\Prototypes\CMockTest\src\' + unit_tests_path: &unit_tests_path 'c:\Projects\NexGen\Prototypes\CMockTest\test\' + build_path: &build_path 'c:\Projects\NexGen\Prototypes\CMockTest\build\' + options: + - --chip=18F87J10 + - --ide=hitide + - --q #quiet please + - --asmlist + - --codeoffset=0 + - --emi=wordwrite # External memory interface protocol + - --warn=0 # allow all normal warning messages + - --errors=10 # Number of errors before aborting compile + - --char=unsigned + - -Bl # Large memory model + - -G # generate symbol file + - --cp=16 # 16-bit pointers + - --double=24 + - -N255 # 255-char symbol names + - --opt=none # Do not use any compiler optimziations + - -c # compile only + - -M + includes: + prefix: '-I' + items: + - 'c:/Projects/NexGen/Prototypes/CMockTest/src/' + - 'c:/Projects/NexGen/Prototypes/CMockTest/mocks/' + - 'c:/CMock/src/' + - 'c:/CMock/examples/src/' + - 'c:/CMock/vendor/unity/src/' + - 'c:/CMock/vendor/unity/examples/helper/' + - *unit_tests_path + defines: + prefix: '-D' + items: + - UNITY_INT_WIDTH=16 + - UNITY_POINTER_WIDTH=16 + - CMOCK_MEM_STATIC + - CMOCK_MEM_SIZE=3000 + - UNITY_SUPPORT_TEST_CASES + - _PICC18 + object_files: + # prefix: '-O' # Hi-Tech doesn't want a prefix. They key off of filename .extensions, instead + extension: '.obj' + destination: *build_path + +linker: + path: cd build && picc18 + options: + - --chip=18F87J10 + - --ide=hitide + - --cp=24 # 24-bit pointers. Is this needed for linker?? + - --double=24 # Is this needed for linker?? + - -Lw # Scan the pic87*w.lib in the lib/ of the compiler installation directory + - --summary=mem,file # info listing + - --summary=+psect + - --summary=+hex + - --output=+intel + - --output=+mcof + - --runtime=+init # Directs startup code to copy idata, ibigdata and ifardata psects from ROM to RAM. + - --runtime=+clear # Directs startup code to clear bss, bigbss, rbss and farbss psects + - --runtime=+clib # link in the c-runtime + - --runtime=+keep # Keep the generated startup src after its obj is linked + - -G # Generate src-level symbol file + - -MIWasTheLastToBuild.map + - --warn=0 # allow all normal warning messages + - -Bl # Large memory model (probably not needed for linking) + includes: + prefix: '-I' + object_files: + path: *build_path + extension: '.obj' + bin_files: + prefix: '-O' + extension: '.hex' + destination: *build_path + +simulator: + path: + pre_support: + - 'java -client -jar ' # note space + - ['C:\Program Files\HI-TECH Software\HI-TIDE\3.15\lib\', 'simpic18.jar'] + - 18F87J10 + post_support: + +:cmock: + :plugins: [] + :includes: + - Types.h + :suite_teardown: | + if (num_failures) + _FAILED_TEST(); + else + _PASSED_TESTS(); + return 0; + +colour: true \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_arm_v4.yml b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_arm_v4.yml new file mode 100644 index 0000000..c2e7f18 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_arm_v4.yml @@ -0,0 +1,89 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 4.0 Kickstart\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\lib\dl4tptinl8n.h'] + - -z3 + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian little + - --cpu ARM7TDMI + - --stack_align 4 + - --interwork + - -e + - --silent + - --warnings_are_errors + - --fpu None + - --diag_suppress Pa050 + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'common\bin\xlink.exe'] + options: + - -rt + - [*tools_root, 'arm\lib\dl4tptinl8n.r79'] + - -D_L_EXTMEM_START=0 + - -D_L_EXTMEM_SIZE=0 + - -D_L_HEAP_SIZE=120 + - -D_L_STACK_SIZE=32 + - -e_small_write=_formatted_write + - -s + - __program_start + - -f + - [*tools_root, '\arm\config\lnkarm.xcl'] + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\config\'] + - [*tools_root, 'arm\lib\'] + object_files: + path: *build_path + extension: '.r79' + bin_files: + prefix: '-o' + extension: '.d79' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\ioat91sam7X256.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_arm_v5.yml b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_arm_v5.yml new file mode 100644 index 0000000..0549d8e --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_arm_v5.yml @@ -0,0 +1,79 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian=little + - --cpu=ARM7TDMI + - --interwork + - --warnings_are_errors + - --fpu=None + - --diag_suppress=Pa050 + - --diag_suppress=Pe111 + - -e + - -On + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\debugger\atmel\ioat91sam7X256.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_arm_v5_3.yml b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_arm_v5_3.yml new file mode 100644 index 0000000..0549d8e --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_arm_v5_3.yml @@ -0,0 +1,79 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian=little + - --cpu=ARM7TDMI + - --interwork + - --warnings_are_errors + - --fpu=None + - --diag_suppress=Pa050 + - --diag_suppress=Pe111 + - -e + - -On + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\debugger\atmel\ioat91sam7X256.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml new file mode 100644 index 0000000..eb0785c --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml @@ -0,0 +1,93 @@ +#Default tool path for IAR 5.4 on Windows XP 64bit +tools_root: &tools_root 'C:\Program Files (x86)\IAR Systems\Embedded Workbench 5.4 Kickstart\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --diag_suppress=Pa050 + #- --diag_suppress=Pe111 + - --debug + - --endian=little + - --cpu=Cortex-M3 + - --no_path_in_file_macros + - -e + - --fpu=None + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + #- --preinclude --preinclude C:\Vss\T2 Working\common\system.h + - --interwork + - --warnings_are_errors +# - Ohz + - -Oh +# - --no_cse +# - --no_unroll +# - --no_inline +# - --no_code_motion +# - --no_tbaa +# - --no_clustering +# - --no_scheduling + + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - ewarm + - PART_LM3S9B92 + - TARGET_IS_TEMPEST_RB1 + - USE_ROM_DRIVERS + - UART_BUFFERED + - UNITY_SUPPORT_64 + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic.icf'] +# - ['C:\Temp\lm3s9b92.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + #- --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim2.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - --endian=little + - --cpu=Cortex-M3 + - --fpu=None + - -p + - [*tools_root, 'arm\config\debugger\TexasInstruments\iolm3sxxxx.ddf'] + - --semihosting + - --device=LM3SxBxx + #- -d + #- sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_cortexm3_v5.yml b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_cortexm3_v5.yml new file mode 100644 index 0000000..cf0d1d0 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_cortexm3_v5.yml @@ -0,0 +1,83 @@ +# unit testing under iar compiler / simulator for STM32 Cortex-M3 + +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.4\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian=little + - --cpu=Cortex-M3 + - --interwork + - --warnings_are_errors + - --fpu=None + - --diag_suppress=Pa050 + - --diag_suppress=Pe111 + - -e + - -On + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - 'IAR' + - 'UNITY_SUPPORT_64' + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic_cortex.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\debugger\ST\iostm32f107xx.ddf'] + - --cpu=Cortex-M3 + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_msp430.yml b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_msp430.yml new file mode 100644 index 0000000..e022647 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_msp430.yml @@ -0,0 +1,94 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3 MSP430\' +core_root: &core_root [*tools_root, '430\'] +core_bin: &core_bin [*core_root, 'bin\'] +core_config: &core_config [*core_root, 'config\'] +core_lib: &core_lib [*core_root, 'lib\'] +core_inc: &core_inc [*core_root, 'inc\'] +core_config: &core_config [*core_root, 'config\'] + +compiler: + path: [*core_bin, 'icc430.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*core_lib, 'dlib\dl430fn.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --debug + - -e + - -Ol + - --multiplier=16 + - --double=32 + - --diag_suppress Pa050 + - --diag_suppress Pe111 + includes: + prefix: '-I' + items: + - *core_inc + - [*core_inc, 'dlib'] + - [*core_lib, 'dlib'] + - 'src\' + - '../src/' + - *unit_tests_path + - 'vendor\unity\src' + defines: + prefix: '-D' + items: + - '__MSP430F149__' + - 'INT_WIDTH=16' + - 'UNITY_EXCLUDE_FLOAT' + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r43' + destination: *build_path +linker: + path: [*core_bin, 'xlink.exe'] + options: + - -rt + - [*core_lib, 'dlib\dl430fn.r43'] + - -e_PrintfTiny=_Printf + - -e_ScanfSmall=_Scanf + - -s __program_start + - -D_STACK_SIZE=50 + - -D_DATA16_HEAP_SIZE=50 + - -D_DATA20_HEAP_SIZE=50 + - -f + - [*core_config, 'lnk430f5438.xcl'] + - -f + - [*core_config, 'multiplier.xcl'] + includes: + prefix: '-I' + items: + - *core_config + - *core_lib + - [*core_lib, 'dlib'] + object_files: + path: *build_path + extension: '.r79' + bin_files: + prefix: '-o' + extension: '.d79' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*core_bin, '430proc.dll'] + - [*core_bin, '430sim.dll'] + post_support: + - --plugin + - [*core_bin, '430bat.dll'] + - --backend -B + - --cpu MSP430F5438 + - -p + - [*core_config, 'MSP430F5438.ddf'] + - -d sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_sh2a_v6.yml b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_sh2a_v6.yml new file mode 100644 index 0000000..ddc5603 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_sh2a_v6.yml @@ -0,0 +1,85 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 6.0\' +compiler: + path: [*tools_root, 'sh\bin\iccsh.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - -e + - --char_is_signed + - -Ol + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_scheduling + - --no_clustering + - --debug + - --dlib_config + - [*tools_root, 'sh\inc\DLib_Product.h'] + - --double=32 + - --code_model=huge + - --data_model=huge + - --core=sh2afpu + - --warnings_affect_exit_code + - --warnings_are_errors + - --mfc + - --use_unix_directory_separators + - --diag_suppress=Pe161 + includes: + prefix: '-I' + items: + - [*tools_root, 'sh\inc\'] + - [*tools_root, 'sh\inc\c'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.o' + destination: *build_path +linker: + path: [*tools_root, 'sh\bin\ilinksh.exe'] + options: + - --redirect __Printf=__PrintfSmall + - --redirect __Scanf=__ScanfSmall + - --config + - [*tools_root, 'sh\config\generic.icf'] + - --config_def _CSTACK_SIZE=0x800 + - --config_def _HEAP_SIZE=0x800 + - --config_def _INT_TABLE=0x10 + - --entry __iar_program_start + - --debug_lib + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'sh\bin\shproc.dll'] + - [*tools_root, 'sh\bin\shsim.dll'] + post_support: + - --plugin + - [*tools_root, 'sh\bin\shbat.dll'] + - --backend + - -B + - --core sh2afpu + - -p + - [*tools_root, 'sh\config\debugger\io7264.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_cmd.c b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_cmd.c new file mode 100644 index 0000000..42841d8 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_cmd.c @@ -0,0 +1,54 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include +#include "CException.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_def.c b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_def.c new file mode 100644 index 0000000..8280804 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_def.c @@ -0,0 +1,50 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_cmd.c b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_cmd.c new file mode 100644 index 0000000..e47b31c --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_cmd.c @@ -0,0 +1,76 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_def.c b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_def.c new file mode 100644 index 0000000..3ca9dba --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_def.c @@ -0,0 +1,72 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new1.c b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new1.c new file mode 100644 index 0000000..a7cbcd8 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new1.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + GlobalExpectCount = 0; + GlobalVerifyOrder = 0; + GlobalOrderError = NULL; + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new2.c b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new2.c new file mode 100644 index 0000000..2c76bf2 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new2.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_param.c b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_param.c new file mode 100644 index 0000000..23c04f4 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_param.c @@ -0,0 +1,73 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST_NO_ARGS +#define RUN_TEST(TestFunc, TestLineNum, ...) \ +{ \ + Unity.CurrentTestName = #TestFunc "(" #__VA_ARGS__ ")"; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(__VA_ARGS__); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21, RUN_TEST_NO_ARGS); + RUN_TEST(test_TheSecondThingToTest, 43, RUN_TEST_NO_ARGS); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run1.c b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run1.c new file mode 100644 index 0000000..a7cbcd8 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run1.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + GlobalExpectCount = 0; + GlobalVerifyOrder = 0; + GlobalOrderError = NULL; + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run2.c b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run2.c new file mode 100644 index 0000000..2c76bf2 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run2.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_yaml.c b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_yaml.c new file mode 100644 index 0000000..68b545a --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_yaml.c @@ -0,0 +1,86 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include "two.h" +#include "three.h" +#include +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_yaml_setup(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_new1.c b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_new1.c new file mode 100644 index 0000000..e5bcac2 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_new1.c @@ -0,0 +1,60 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_new2.c b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_new2.c new file mode 100644 index 0000000..b7c7e5b --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_new2.c @@ -0,0 +1,63 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_param.c b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_param.c new file mode 100644 index 0000000..4157007 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_param.c @@ -0,0 +1,51 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST_NO_ARGS +#define RUN_TEST(TestFunc, TestLineNum, ...) \ +{ \ + Unity.CurrentTestName = #TestFunc "(" #__VA_ARGS__ ")"; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(__VA_ARGS__); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21, RUN_TEST_NO_ARGS); + RUN_TEST(test_TheSecondThingToTest, 43, RUN_TEST_NO_ARGS); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_run1.c b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_run1.c new file mode 100644 index 0000000..e5bcac2 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_run1.c @@ -0,0 +1,60 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_run2.c b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_run2.c new file mode 100644 index 0000000..b7c7e5b --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_run2.c @@ -0,0 +1,63 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_yaml.c b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_yaml.c new file mode 100644 index 0000000..d109287 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_yaml.c @@ -0,0 +1,64 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "two.h" +#include "three.h" +#include +#include +#include +#include "CException.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_yaml_setup(); +} + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/test_generate_test_runner.rb b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/test_generate_test_runner.rb new file mode 100644 index 0000000..61c8df9 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/test_generate_test_runner.rb @@ -0,0 +1,94 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +ruby_version = RUBY_VERSION.split('.') +if (ruby_version[1].to_i == 9) and (ruby_version[2].to_i > 1) + require 'rubygems' + gem 'test-unit' +end +require 'test/unit' +require './auto/generate_test_runner.rb' + +TEST_FILE = 'test/testdata/testsample.c' +TEST_MOCK = 'test/testdata/mocksample.c' +OUT_FILE = 'build/testsample_' +EXP_FILE = 'test/expectdata/testsample_' + +class TestGenerateTestRunner < Test::Unit::TestCase + def setup + end + + def teardown + end + + def verify_output_equal(subtest) + expected = File.read(EXP_FILE + subtest + '.c').gsub(/\r\n/,"\n") + actual = File.read(OUT_FILE + subtest + '.c').gsub(/\r\n/,"\n") + assert_equal(expected, actual, "Generated File Sub-Test '#{subtest}' Failed") + end + + def test_ShouldGenerateARunnerByCreatingRunnerWithOptions + sets = { 'def' => nil, + 'new1' => { :plugins => [:cexception], :includes => ['one.h', 'two.h'], :enforce_strict_ordering => true }, + 'new2' => { :plugins => [:ignore], :suite_setup => "a_custom_setup();", :suite_teardown => "a_custom_teardown();" } + } + + sets.each_pair do |subtest, options| + UnityTestRunnerGenerator.new(options).run(TEST_FILE, OUT_FILE + subtest + '.c') + verify_output_equal(subtest) + UnityTestRunnerGenerator.new(options).run(TEST_MOCK, OUT_FILE + 'mock_' + subtest + '.c') + verify_output_equal('mock_' + subtest) + end + end + + def test_ShouldGenerateARunnerByRunningRunnerWithOptions + sets = { 'run1' => { :plugins => [:cexception], :includes => ['one.h', 'two.h'], :enforce_strict_ordering => true }, + 'run2' => { :plugins => [:ignore], :suite_setup => "a_custom_setup();", :suite_teardown => "a_custom_teardown();" } + } + + sets.each_pair do |subtest, options| + UnityTestRunnerGenerator.new.run(TEST_FILE, OUT_FILE + subtest + '.c', options) + verify_output_equal(subtest) + UnityTestRunnerGenerator.new.run(TEST_MOCK, OUT_FILE + 'mock_' + subtest + '.c', options) + verify_output_equal('mock_' + subtest) + end + end + + def test_ShouldGenerateARunnerByPullingYamlOptions + subtest = 'yaml' + cmdstr = "ruby auto/generate_test_runner.rb test/testdata/sample.yml \"#{TEST_FILE}\" \"#{OUT_FILE + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal(subtest) + + cmdstr = "ruby auto/generate_test_runner.rb test/testdata/sample.yml \"#{TEST_MOCK}\" \"#{OUT_FILE + 'mock_' + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal('mock_' + subtest) + end + + def test_ShouldGenerateARunnerByPullingCommandlineOptions + subtest = 'cmd' + cmdstr = "ruby auto/generate_test_runner.rb -cexception \"#{TEST_FILE}\" \"#{OUT_FILE + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal(subtest) + + cmdstr = "ruby auto/generate_test_runner.rb -cexception \"#{TEST_MOCK}\" \"#{OUT_FILE + 'mock_' + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal('mock_' + subtest) + end + + def test_ShouldGenerateARunnerThatUsesParameterizedTests + sets = { 'param' => { :plugins => [:ignore], :use_param_tests => true } + } + + sets.each_pair do |subtest, options| + UnityTestRunnerGenerator.new(options).run(TEST_FILE, OUT_FILE + subtest + '.c') + verify_output_equal(subtest) + UnityTestRunnerGenerator.new(options).run(TEST_MOCK, OUT_FILE + 'mock_' + subtest + '.c') + verify_output_equal('mock_' + subtest) + end + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/testdata/mocksample.c b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/testdata/mocksample.c new file mode 100644 index 0000000..b709438 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/testdata/mocksample.c @@ -0,0 +1,51 @@ +// This is just a sample test file to be used to test the generator script +#ifndef TEST_SAMPLE_H +#define TEST_SAMPLE_H + +#include +#include "unity.h" +#include "funky.h" +#include "Mockstanky.h" + +void setUp(void) +{ + CustomSetupStuff(); +} + +void tearDown(void) +{ + CustomTeardownStuff +} + +//Yup, nice comment +void test_TheFirstThingToTest(void) +{ + TEST_ASSERT(1); + + TEST_ASSERT_TRUE(1); +} + +/* +void test_ShouldBeIgnored(void) +{ + DoesStuff(); +} +*/ + +//void test_ShouldAlsoNotBeTested(void) +//{ +// Call_An_Expect(); +// +// CallAFunction(); +// test_CallAFunctionThatLooksLikeATest(); +//} + +void test_TheSecondThingToTest(void) +{ + Call_An_Expect(); + + CallAFunction(); + test_CallAFunctionThatLooksLikeATest(); +} + +#endif //TEST_SAMPLE_H diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/testdata/sample.yml b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/testdata/sample.yml new file mode 100644 index 0000000..9e5eece --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/testdata/sample.yml @@ -0,0 +1,9 @@ +:unity: + :includes: + - two.h + - three.h + - + :plugins: + - :cexception + :suite_setup: | + a_yaml_setup(); \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/testdata/testsample.c b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/testdata/testsample.c new file mode 100644 index 0000000..4f30ec7 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/testdata/testsample.c @@ -0,0 +1,51 @@ +// This is just a sample test file to be used to test the generator script +#ifndef TEST_SAMPLE_H +#define TEST_SAMPLE_H + +#include +#include "unity.h" +#include "funky.h" +#include "stanky.h" + +void setUp(void) +{ + CustomSetupStuff(); +} + +void tearDown(void) +{ + CustomTeardownStuff +} + +//Yup, nice comment +void test_TheFirstThingToTest(void) +{ + TEST_ASSERT(1); + + TEST_ASSERT_TRUE(1); +} + +/* +void test_ShouldBeIgnored(void) +{ + DoesStuff(); +} +*/ + +//void test_ShouldAlsoNotBeTested(void) +//{ +// Call_An_Expect(); +// +// CallAFunction(); +// test_CallAFunctionThatLooksLikeATest(); +//} + +void test_TheSecondThingToTest(void) +{ + Call_An_Expect(); + + CallAFunction(); + test_CallAFunctionThatLooksLikeATest(); +} + +#endif //TEST_SAMPLE_H diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/testparameterized.c b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/testparameterized.c new file mode 100644 index 0000000..037cd21 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/testparameterized.c @@ -0,0 +1,101 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include +#include "unity.h" + +#define TEST_CASE(...) + +#define EXPECT_ABORT_BEGIN \ + if (TEST_PROTECT()) \ + { + +#define VERIFY_FAILS_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestFailed == 1) ? 0 : 1; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Failed But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +#define VERIFY_IGNORES_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestIgnored == 1) ? 0 : 1; \ + Unity.CurrentTestIgnored = 0; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Ignored But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +int SetToOneToFailInTearDown; +int SetToOneMeanWeAlreadyCheckedThisGuy; + +void setUp(void) +{ + SetToOneToFailInTearDown = 0; + SetToOneMeanWeAlreadyCheckedThisGuy = 0; +} + +void tearDown(void) +{ + if (SetToOneToFailInTearDown == 1) + TEST_FAIL_MESSAGE("<= Failed in tearDown"); + if ((SetToOneMeanWeAlreadyCheckedThisGuy == 0) && (Unity.CurrentTestFailed > 0)) + { + UnityPrint("[[[[ Previous Test Should Have Passed But Did Not ]]]]"); + UNITY_OUTPUT_CHAR('\n'); + } +} + +TEST_CASE(0) +TEST_CASE(44) +TEST_CASE((90)+9) +void test_TheseShouldAllPass(int Num) +{ + TEST_ASSERT_TRUE(Num < 100); +} + +TEST_CASE(3) +TEST_CASE(77) +TEST_CASE( (99) + 1 - (1)) +void test_TheseShouldAllFail(int Num) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(Num > 100); + VERIFY_FAILS_END +} + +TEST_CASE(1) +TEST_CASE(44) +TEST_CASE(99) +TEST_CASE(98) +void test_TheseAreEveryOther(int Num) +{ + if (Num & 1) + { + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(Num > 100); + VERIFY_FAILS_END + } + else + { + TEST_ASSERT_TRUE(Num < 100); + } +} + +void test_NormalPassesStillWork(void) +{ + TEST_ASSERT_TRUE(1); +} + +void test_NormalFailsStillWork(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(0); + VERIFY_FAILS_END +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/testunity.c b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/testunity.c new file mode 100644 index 0000000..9f826dc --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/c_exception/vendor/unity/test/testunity.c @@ -0,0 +1,1510 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include +#include "unity.h" + +#define EXPECT_ABORT_BEGIN \ + if (TEST_PROTECT()) \ + { + +#define VERIFY_FAILS_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestFailed == 1) ? 0 : 1; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Failed But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +#define VERIFY_IGNORES_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestIgnored == 1) ? 0 : 1; \ + Unity.CurrentTestIgnored = 0; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Ignored But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +int SetToOneToFailInTearDown; +int SetToOneMeanWeAlreadyCheckedThisGuy; + +void setUp(void) +{ + SetToOneToFailInTearDown = 0; + SetToOneMeanWeAlreadyCheckedThisGuy = 0; +} + +void tearDown(void) +{ + if (SetToOneToFailInTearDown == 1) + TEST_FAIL_MESSAGE("<= Failed in tearDown"); + if ((SetToOneMeanWeAlreadyCheckedThisGuy == 0) && (Unity.CurrentTestFailed > 0)) + { + UnityPrint("[[[[ Previous Test Should Have Passed But Did Not ]]]]"); + UNITY_OUTPUT_CHAR('\n'); + } +} + +void testTrue(void) +{ + TEST_ASSERT(1); + + TEST_ASSERT_TRUE(1); +} + +void testFalse(void) +{ + TEST_ASSERT_FALSE(0); + + TEST_ASSERT_UNLESS(0); +} + +void testPreviousPass(void) +{ + TEST_ASSERT_EQUAL_INT(0U, Unity.TestFailures); +} + +void testNotVanilla(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT(0); + VERIFY_FAILS_END +} + +void testNotTrue(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(0); + VERIFY_FAILS_END +} + +void testNotFalse(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_FALSE(1); + VERIFY_FAILS_END +} + +void testNotUnless(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UNLESS(1); + VERIFY_FAILS_END +} + +void testNotNotEqual(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_NOT_EQUAL(10, 10); + VERIFY_FAILS_END +} + +void testFail(void) +{ + EXPECT_ABORT_BEGIN + TEST_FAIL_MESSAGE("Expected for testing"); + VERIFY_FAILS_END +} + +void testIsNull(void) +{ + char* ptr1 = NULL; + char* ptr2 = "hello"; + + TEST_ASSERT_NULL(ptr1); + TEST_ASSERT_NOT_NULL(ptr2); +} + +void testIsNullShouldFailIfNot(void) +{ + char* ptr1 = "hello"; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_NULL(ptr1); + VERIFY_FAILS_END +} + +void testNotNullShouldFailIfNULL(void) +{ + char* ptr1 = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_NOT_NULL(ptr1); + VERIFY_FAILS_END +} + +void testIgnore(void) +{ + EXPECT_ABORT_BEGIN + TEST_IGNORE(); + TEST_FAIL_MESSAGE("This should not be reached"); + VERIFY_IGNORES_END +} + +void testIgnoreMessage(void) +{ + EXPECT_ABORT_BEGIN + TEST_IGNORE_MESSAGE("This is an expected TEST_IGNORE_MESSAGE string!"); + TEST_FAIL_MESSAGE("This should not be reached"); + VERIFY_IGNORES_END +} + +void testNotEqualInts(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT(3982, 3983); + VERIFY_FAILS_END +} + +void testNotEqualInt8s(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT8(-127, -126); + VERIFY_FAILS_END +} + +void testNotEqualInt16s(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT16(-16383, -16382); + VERIFY_FAILS_END +} + +void testNotEqualInt32s(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT32(-2147483647, -2147483646); + VERIFY_FAILS_END +} + +void testNotEqualBits(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_BITS(0xFF00, 0x5555, 0x5A55); + VERIFY_FAILS_END +} + +void testNotEqualUInts(void) +{ + _UU16 v0, v1; + + v0 = 9000; + v1 = 9001; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualUInt8s(void) +{ + _UU8 v0, v1; + + v0 = 254; + v1 = 255; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT8(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualUInt16s(void) +{ + _UU16 v0, v1; + + v0 = 65535; + v1 = 65534; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualUInt32s(void) +{ + _UU32 v0, v1; + + v0 = 4294967295; + v1 = 4294967294; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT32(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex8s(void) +{ + _UU8 v0, v1; + + v0 = 0x23; + v1 = 0x22; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex8sIfSigned(void) +{ + _US8 v0, v1; + + v0 = -2; + v1 = 2; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex16s(void) +{ + _UU16 v0, v1; + + v0 = 0x1234; + v1 = 0x1235; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex16sIfSigned(void) +{ + _US16 v0, v1; + + v0 = -1024; + v1 = -1028; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex32s(void) +{ + _UU32 v0, v1; + + v0 = 900000; + v1 = 900001; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex32sIfSigned(void) +{ + _US32 v0, v1; + + v0 = -900000; + v1 = 900001; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32(v0, v1); + VERIFY_FAILS_END +} + +void testEqualInts(void) +{ + int v0, v1; + int *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(1837, 1837); + TEST_ASSERT_EQUAL_INT(-27365, -27365); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(19467, v1); + TEST_ASSERT_EQUAL_INT(v0, 19467); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 19467); +} + +void testEqualUints(void) +{ + unsigned int v0, v1; + unsigned int *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_UINT(1837, 1837); + TEST_ASSERT_EQUAL_UINT(v0, v1); + TEST_ASSERT_EQUAL_UINT(19467, v1); + TEST_ASSERT_EQUAL_UINT(v0, 19467); + TEST_ASSERT_EQUAL_UINT(*p0, v1); + TEST_ASSERT_EQUAL_UINT(*p0, *p1); + TEST_ASSERT_EQUAL_UINT(*p0, 19467); + TEST_ASSERT_EQUAL_UINT(60872u, 60872u); +} + +void testNotEqual(void) +{ + TEST_ASSERT_NOT_EQUAL(0, 1); + TEST_ASSERT_NOT_EQUAL(1, 0); + TEST_ASSERT_NOT_EQUAL(100, 101); + TEST_ASSERT_NOT_EQUAL(0, -1); + TEST_ASSERT_NOT_EQUAL(65535, -65535); + TEST_ASSERT_NOT_EQUAL(75, 900); + TEST_ASSERT_NOT_EQUAL(-100, -101); +} + +void testEqualHex8s(void) +{ + _UU8 v0, v1; + _UU8 *p0, *p1; + + v0 = 0x22; + v1 = 0x22; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX8(0x22, 0x22); + TEST_ASSERT_EQUAL_HEX8(v0, v1); + TEST_ASSERT_EQUAL_HEX8(0x22, v1); + TEST_ASSERT_EQUAL_HEX8(v0, 0x22); + TEST_ASSERT_EQUAL_HEX8(*p0, v1); + TEST_ASSERT_EQUAL_HEX8(*p0, *p1); + TEST_ASSERT_EQUAL_HEX8(*p0, 0x22); +} + +void testEqualHex8sNegatives(void) +{ + _UU8 v0, v1; + _UU8 *p0, *p1; + + v0 = 0xDD; + v1 = 0xDD; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX8(0xDD, 0xDD); + TEST_ASSERT_EQUAL_HEX8(v0, v1); + TEST_ASSERT_EQUAL_HEX8(0xDD, v1); + TEST_ASSERT_EQUAL_HEX8(v0, 0xDD); + TEST_ASSERT_EQUAL_HEX8(*p0, v1); + TEST_ASSERT_EQUAL_HEX8(*p0, *p1); + TEST_ASSERT_EQUAL_HEX8(*p0, 0xDD); +} + +void testEqualHex16s(void) +{ + _UU16 v0, v1; + _UU16 *p0, *p1; + + v0 = 0x9876; + v1 = 0x9876; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX16(0x9876, 0x9876); + TEST_ASSERT_EQUAL_HEX16(v0, v1); + TEST_ASSERT_EQUAL_HEX16(0x9876, v1); + TEST_ASSERT_EQUAL_HEX16(v0, 0x9876); + TEST_ASSERT_EQUAL_HEX16(*p0, v1); + TEST_ASSERT_EQUAL_HEX16(*p0, *p1); + TEST_ASSERT_EQUAL_HEX16(*p0, 0x9876); +} + +void testEqualHex32s(void) +{ + _UU32 v0, v1; + _UU32 *p0, *p1; + + v0 = 0x98765432ul; + v1 = 0x98765432ul; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX32(0x98765432ul, 0x98765432ul); + TEST_ASSERT_EQUAL_HEX32(v0, v1); + TEST_ASSERT_EQUAL_HEX32(0x98765432ul, v1); + TEST_ASSERT_EQUAL_HEX32(v0, 0x98765432ul); + TEST_ASSERT_EQUAL_HEX32(*p0, v1); + TEST_ASSERT_EQUAL_HEX32(*p0, *p1); + TEST_ASSERT_EQUAL_HEX32(*p0, 0x98765432ul); +} + +void testEqualBits(void) +{ + _UU32 v0 = 0xFF55AA00; + _UU32 v1 = 0x55550000; + + TEST_ASSERT_BITS(v1, v0, 0x55550000); + TEST_ASSERT_BITS(v1, v0, 0xFF55CC00); + TEST_ASSERT_BITS(0xFFFFFFFF, v0, 0xFF55AA00); + TEST_ASSERT_BITS(0xFFFFFFFF, v0, v0); + TEST_ASSERT_BITS(0xF0F0F0F0, v0, 0xFC5DAE0F); + TEST_ASSERT_BITS_HIGH(v1, v0); + TEST_ASSERT_BITS_LOW(0x000055FF, v0); + TEST_ASSERT_BIT_HIGH(30, v0); + TEST_ASSERT_BIT_LOW(5, v0); +} + +void testEqualShorts(void) +{ + short v0, v1; + short *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(1837, 1837); + TEST_ASSERT_EQUAL_INT(-2987, -2987); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(19467, v1); + TEST_ASSERT_EQUAL_INT(v0, 19467); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 19467); +} + +void testEqualUShorts(void) +{ + unsigned short v0, v1; + unsigned short *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_UINT(1837, 1837); + TEST_ASSERT_EQUAL_UINT(2987, 2987); + TEST_ASSERT_EQUAL_UINT(v0, v1); + TEST_ASSERT_EQUAL_UINT(19467, v1); + TEST_ASSERT_EQUAL_UINT(v0, 19467); + TEST_ASSERT_EQUAL_UINT(*p0, v1); + TEST_ASSERT_EQUAL_UINT(*p0, *p1); + TEST_ASSERT_EQUAL_UINT(*p0, 19467); +} + +void testEqualChars(void) +{ + signed char v0, v1; + signed char *p0, *p1; + + v0 = 109; + v1 = 109; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(42, 42); + TEST_ASSERT_EQUAL_INT(-116, -116); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(109, v1); + TEST_ASSERT_EQUAL_INT(v0, 109); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 109); +} + +void testEqualUChars(void) +{ + unsigned char v0, v1; + unsigned char *p0, *p1; + + v0 = 251; + v1 = 251; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(42, 42); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(251, v1); + TEST_ASSERT_EQUAL_INT(v0, 251); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 251); +} + +void testEqualPointers(void) +{ + int v0, v1; + int *p0, *p1, *p2; + + v0 = 19467; + v1 = 18271; + p0 = &v0; + p1 = &v1; + p2 = &v1; + + TEST_ASSERT_EQUAL_PTR(p0, &v0); + TEST_ASSERT_EQUAL_PTR(&v1, p1); + TEST_ASSERT_EQUAL_PTR(p2, p1); + TEST_ASSERT_EQUAL_PTR(&v0, &v0); +} + +void testNotEqualPointers(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_PTR(0x12345678, 0x12345677); + VERIFY_FAILS_END +} + +void testIntsWithinDelta(void) +{ + TEST_ASSERT_INT_WITHIN(1, 5000, 5001); + TEST_ASSERT_INT_WITHIN(5, 5000, 4996); + TEST_ASSERT_INT_WITHIN(5, 5000, 5005); + TEST_ASSERT_INT_WITHIN(500, 50, -440); + + TEST_ASSERT_INT_WITHIN(2, -1, -1); + TEST_ASSERT_INT_WITHIN(5, 1, -1); + TEST_ASSERT_INT_WITHIN(5, -1, 1); +} + +void testIntsNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_INT_WITHIN(5, 5000, 5006); + VERIFY_FAILS_END +} + +void testUIntsWithinDelta(void) +{ + TEST_ASSERT_UINT_WITHIN(1, 5000, 5001); + TEST_ASSERT_UINT_WITHIN(5, 5000, 4996); + TEST_ASSERT_UINT_WITHIN(5, 5000, 5005); +} + +void testUIntsNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UINT_WITHIN(1, 2147483647u, 2147483649u); + VERIFY_FAILS_END +} + +void testUIntsNotWithinDeltaEvenThoughASignedIntWouldPassSmallFirst(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UINT_WITHIN(5, 1, -1); + VERIFY_FAILS_END +} + +void testUIntsNotWithinDeltaEvenThoughASignedIntWouldPassBigFirst(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UINT_WITHIN(5, -1, 1); + VERIFY_FAILS_END +} + +void testHEX32sWithinDelta(void) +{ + TEST_ASSERT_HEX32_WITHIN(1, 5000, 5001); + TEST_ASSERT_HEX32_WITHIN(5, 5000, 4996); + TEST_ASSERT_HEX32_WITHIN(5, 5000, 5005); +} + +void testHEX32sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX32_WITHIN(1, 2147483647u, 2147483649u); + VERIFY_FAILS_END +} + +void testHEX32sNotWithinDeltaEvenThoughASignedIntWouldPass(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX32_WITHIN(5, 1, -1); + VERIFY_FAILS_END +} + +void testHEX16sWithinDelta(void) +{ + TEST_ASSERT_HEX16_WITHIN(1, 5000, 5001); + TEST_ASSERT_HEX16_WITHIN(5, 5000, 4996); + TEST_ASSERT_HEX16_WITHIN(5, 5000, 5005); +} + +void testHEX16sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX16_WITHIN(2, 65535, 0); + VERIFY_FAILS_END +} + +void testHEX8sWithinDelta(void) +{ + TEST_ASSERT_HEX8_WITHIN(1, 254, 255); + TEST_ASSERT_HEX8_WITHIN(5, 251, 255); + TEST_ASSERT_HEX8_WITHIN(5, 1, 4); +} + +void testHEX8sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX8_WITHIN(2, 255, 0); + VERIFY_FAILS_END +} + +void testEqualStrings(void) +{ + const char *testString = "foo"; + + TEST_ASSERT_EQUAL_STRING(testString, testString); + TEST_ASSERT_EQUAL_STRING("foo", "foo"); + TEST_ASSERT_EQUAL_STRING("foo", testString); + TEST_ASSERT_EQUAL_STRING(testString, "foo"); + TEST_ASSERT_EQUAL_STRING("", ""); +} + +void testEqualStringsWithCarriageReturnsAndLineFeeds(void) +{ + const char *testString = "foo\r\nbar"; + + TEST_ASSERT_EQUAL_STRING(testString, testString); + TEST_ASSERT_EQUAL_STRING("foo\r\nbar", "foo\r\nbar"); + TEST_ASSERT_EQUAL_STRING("foo\r\nbar", testString); + TEST_ASSERT_EQUAL_STRING(testString, "foo\r\nbar"); + TEST_ASSERT_EQUAL_STRING("", ""); +} + +void testNotEqualString1(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("foo", "bar"); + VERIFY_FAILS_END +} + +void testNotEqualString2(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("foo", ""); + VERIFY_FAILS_END +} + +void testNotEqualString3(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("", "bar"); + VERIFY_FAILS_END +} + +void testNotEqualString4(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("bar\r", "bar\n"); + VERIFY_FAILS_END +} + +void testNotEqualString5(void) +{ + const char str1[] = { 0x41, 0x42, 0x03, 0x00 }; + const char str2[] = { 0x41, 0x42, 0x04, 0x00 }; + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING(str1, str2); + VERIFY_FAILS_END +} + +void testNotEqualString_ExpectedStringIsNull(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING(NULL, "bar"); + VERIFY_FAILS_END +} + +void testNotEqualString_ActualStringIsNull(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("foo", NULL); + VERIFY_FAILS_END +} + +void testEqualStringArrays(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, expStrings, 3); + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 3); + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 2); + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 1); +} + +void testNotEqualStringArray1(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray2(void) +{ + const char *testStrings[] = { "zoo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", "boo", "woo", "moo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray3(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", NULL }; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray4(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", NULL, "woo", "moo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray5(void) +{ + const char **testStrings = NULL; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray6(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "zoo" }; + const char **expStrings = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testEqualStringArrayIfBothNulls(void) +{ + const char **testStrings = NULL; + const char **expStrings = NULL; + + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); +} + +void testEqualMemory(void) +{ + const char *testString = "whatever"; + + TEST_ASSERT_EQUAL_MEMORY(testString, testString, 8); + TEST_ASSERT_EQUAL_MEMORY("whatever", "whatever", 8); + TEST_ASSERT_EQUAL_MEMORY("whatever", testString, 8); + TEST_ASSERT_EQUAL_MEMORY(testString, "whatever", 8); + TEST_ASSERT_EQUAL_MEMORY(testString, "whatever", 2); + TEST_ASSERT_EQUAL_MEMORY(NULL, NULL, 1); +} + +void testNotEqualMemory1(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY("foo", "bar", 3); + VERIFY_FAILS_END +} + +void testNotEqualMemory2(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY("fool", "food", 4); + VERIFY_FAILS_END +} + +void testNotEqualMemory3(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY(NULL, "food", 4); + VERIFY_FAILS_END +} + +void testNotEqualMemory4(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY("fool", NULL, 4); + VERIFY_FAILS_END +} + +void testEqualIntArrays(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, -2}; + int p2[] = {1, 8, 987, 2}; + int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p3, 1); +} + +void testNotEqualIntArraysNullExpected(void) +{ + int* p0 = NULL; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArraysNullActual(void) +{ + int* p1 = NULL; + int p0[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArrays1(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArrays2(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {2, 8, 987, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArrays3(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 986, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualInt8Arrays(void) +{ + _US8 p0[] = {1, 8, 117, -2}; + _US8 p1[] = {1, 8, 117, -2}; + _US8 p2[] = {1, 8, 117, 2}; + _US8 p3[] = {1, 50, 60, 70}; + + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p3, 1); +} + +void testNotEqualInt8Arrays(void) +{ + _US8 p0[] = {1, 8, 127, -2}; + _US8 p1[] = {1, 8, 127, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualUIntArrays(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65132u}; + unsigned int p2[] = {1, 8, 987, 2}; + unsigned int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p3, 1); +} + +void testNotEqualUIntArrays1(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUIntArrays2(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUIntArrays3(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualInt16Arrays(void) +{ + _UU16 p0[] = {1, 8, 117, 3}; + _UU16 p1[] = {1, 8, 117, 3}; + _UU16 p2[] = {1, 8, 117, 2}; + _UU16 p3[] = {1, 50, 60, 70}; + + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p3, 1); +} + +void testNotEqualInt16Arrays(void) +{ + _UU16 p0[] = {1, 8, 127, 3}; + _UU16 p1[] = {1, 8, 127, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualUINT16Arrays(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65132u}; + unsigned short p2[] = {1, 8, 987, 2}; + unsigned short p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p3, 1); +} + +void testNotEqualUINT16Arrays1(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUINT16Arrays2(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUINT16Arrays3(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualHEXArrays(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65132u}; + unsigned int p2[] = {1, 8, 987, 2}; + unsigned int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p3, 1); +} + +void testNotEqualHEXArrays1(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEXArrays2(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEXArrays3(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualHEX16Arrays(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65132u}; + unsigned short p2[] = {1, 8, 987, 2}; + unsigned short p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p3, 1); +} + +void testNotEqualHEX16Arrays1(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX16Arrays2(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX16Arrays3(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualHEX8Arrays(void) +{ + unsigned short p0[] = {1, 8, 254u, 123}; + unsigned short p1[] = {1, 8, 254u, 123}; + unsigned short p2[] = {1, 8, 254u, 2}; + unsigned short p3[] = {1, 23, 25, 26}; + + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p3, 1); +} + +void testNotEqualHEX8Arrays1(void) +{ + unsigned char p0[] = {1, 8, 254u, 253u}; + unsigned char p1[] = {1, 8, 254u, 252u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX8Arrays2(void) +{ + unsigned char p0[] = {1, 8, 254u, 253u}; + unsigned char p1[] = {2, 8, 254u, 253u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX8Arrays3(void) +{ + unsigned char p0[] = {1, 8, 254u, 253u}; + unsigned char p1[] = {1, 8, 255u, 253u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualMemoryArrays(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, -2}; + int p2[] = {1, 8, 987, 2}; + int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p0, 4, 1); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p0, 4, 4); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p2, 4, 3); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p3, 4, 1); +} + +void testNotEqualMemoryArraysExpectedNull(void) +{ + int* p0 = NULL; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArraysActualNull(void) +{ + int p0[] = {1, 8, 987, -2}; + int* p1 = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArrays1(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArrays2(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {2, 8, 987, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArrays3(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 986, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testProtection(void) +{ + volatile int mask = 0; + + if (TEST_PROTECT()) + { + mask |= 1; + TEST_ABORT(); + } + else + { + Unity.CurrentTestFailed = 0; + mask |= 2; + } + + TEST_ASSERT_EQUAL(3, mask); +} + +void testIgnoredAndThenFailInTearDown(void) +{ + SetToOneToFailInTearDown = 1; + TEST_IGNORE(); +} + +// ===================== THESE TEST WILL RUN IF YOUR CONFIG INCLUDES 64 BIT SUPPORT ================== +#ifdef UNITY_SUPPORT_64 + +void testEqualHex64s(void) +{ + _UU64 v0, v1; + _UU64 *p0, *p1; + + v0 = 0x9876543201234567; + v1 = 0x9876543201234567; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX64(0x9876543201234567, 0x9876543201234567); + TEST_ASSERT_EQUAL_HEX64(v0, v1); + TEST_ASSERT_EQUAL_HEX64(0x9876543201234567, v1); + TEST_ASSERT_EQUAL_HEX64(v0, 0x9876543201234567); + TEST_ASSERT_EQUAL_HEX64(*p0, v1); + TEST_ASSERT_EQUAL_HEX64(*p0, *p1); + TEST_ASSERT_EQUAL_HEX64(*p0, 0x9876543201234567); +} + +void testNotEqualHex64s(void) +{ + _UU64 v0, v1; + + v0 = 9000000000; + v1 = 9100000000; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex64sIfSigned(void) +{ + _US64 v0, v1; + + v0 = -9000000000; + v1 = 9000000000; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64(v0, v1); + VERIFY_FAILS_END +} + +void testHEX64sWithinDelta(void) +{ + TEST_ASSERT_HEX64_WITHIN(1, 0x7FFFFFFFFFFFFFFF,0x7FFFFFFFFFFFFFFE); + TEST_ASSERT_HEX64_WITHIN(5, 5000, 4996); + TEST_ASSERT_HEX64_WITHIN(5, 5000, 5005); +} + +void testHEX64sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX64_WITHIN(1, 0x7FFFFFFFFFFFFFFF, 0x7FFFFFFFFFFFFFFC); + VERIFY_FAILS_END +} + +void testHEX64sNotWithinDeltaEvenThoughASignedIntWouldPass(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX64_WITHIN(5, 1, -1); + VERIFY_FAILS_END +} + +void testEqualHEX64Arrays(void) +{ + _UU64 p0[] = {1, 8, 987, 65132u}; + _UU64 p1[] = {1, 8, 987, 65132u}; + _UU64 p2[] = {1, 8, 987, 2}; + _UU64 p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p3, 1); +} + +void testNotEqualHEX64Arrays1(void) +{ + _UU64 p0[] = {1, 8, 987, 65132u}; + _UU64 p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX64Arrays2(void) +{ + _UU64 p0[] = {1, 8, 987, 65132u}; + _UU64 p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +#endif //64-bit SUPPORT + +// ===================== THESE TEST WILL RUN IF YOUR CONFIG INCLUDES FLOAT SUPPORT ================== +#ifndef UNITY_EXCLUDE_FLOAT + +void testFloatsWithinDelta(void) +{ + TEST_ASSERT_FLOAT_WITHIN(0.00003f, 187245.03485f, 187245.03488f); + TEST_ASSERT_FLOAT_WITHIN(1.0f, 187245.0f, 187246.0f); + TEST_ASSERT_FLOAT_WITHIN(0.05f, 9273.2549f, 9273.2049f); + TEST_ASSERT_FLOAT_WITHIN(0.007f, -726.93724f, -726.94424f); +} + +void testFloatsNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_FLOAT_WITHIN(0.05f, 9273.2649f, 9273.2049f); + VERIFY_FAILS_END +} + +void testFloatsEqual(void) +{ + TEST_ASSERT_EQUAL_FLOAT(187245.0f, 187246.0f); + TEST_ASSERT_EQUAL_FLOAT(18724.5f, 18724.6f); + TEST_ASSERT_EQUAL_FLOAT(9273.2549f, 9273.2599f); + TEST_ASSERT_EQUAL_FLOAT(-726.93724f, -726.9374f); +} + +void testFloatsNotEqual(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT(9273.9649f, 9273.0049f); + VERIFY_FAILS_END +} + +void testFloatsNotEqualNegative1(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT(-9273.9649f, -9273.0049f); + VERIFY_FAILS_END +} + +void testFloatsNotEqualNegative2(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT(-9273.0049f, -9273.9649f); + VERIFY_FAILS_END +} + +void testEqualFloatArrays(void) +{ + float p0[] = {1.0, -8.0, 25.4, -0.123}; + float p1[] = {1.0, -8.0, 25.4, -0.123}; + float p2[] = {1.0, -8.0, 25.4, -0.2}; + float p3[] = {1.0, -23.0, 25.0, -0.26}; + + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p3, 1); +} + +void testNotEqualFloatArraysExpectedNull(void) +{ + float* p0 = NULL; + float p1[] = {1.0, 8.0, 25.4, 0.252}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysActualNull(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float* p1 = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArrays1(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float p1[] = {1.0, 8.0, 25.4, 0.252}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArrays2(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float p1[] = {2.0, 8.0, 25.4, 0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArrays3(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float p1[] = {1.0, 8.0, 25.5, 0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysNegative1(void) +{ + float p0[] = {-1.0, -8.0, -25.4, -0.253}; + float p1[] = {-1.0, -8.0, -25.4, -0.252}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysNegative2(void) +{ + float p0[] = {-1.0, -8.0, -25.4, -0.253}; + float p1[] = {-2.0, -8.0, -25.4, -0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysNegative3(void) +{ + float p0[] = {-1.0, -8.0, -25.4, -0.253}; + float p1[] = {-1.0, -8.0, -25.5, -0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +#endif //FLOAT SUPPORT diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/config/production_environment.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/config/production_environment.rb new file mode 100644 index 0000000..915582b --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/config/production_environment.rb @@ -0,0 +1,14 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +# Setup our load path: +[ + 'lib', +].each do |dir| + $LOAD_PATH.unshift( File.join( File.expand_path(File.dirname(__FILE__)) + '/../', dir) ) +end + + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/config/test_environment.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/config/test_environment.rb new file mode 100644 index 0000000..442e110 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/config/test_environment.rb @@ -0,0 +1,16 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +# Setup our load path: +[ + 'lib', + 'vendor/behaviors/lib', + 'vendor/hardmock/lib', + 'vendor/unity/auto/', + 'test/system/' +].each do |dir| + $LOAD_PATH.unshift( File.join( File.expand_path(File.dirname(__FILE__) + "/../"), dir) ) +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/docs/CMock Summary.odt b/flex-bison/clcalc/tools/ceedling/vendor/cmock/docs/CMock Summary.odt new file mode 100644 index 0000000..6126075 Binary files /dev/null and b/flex-bison/clcalc/tools/ceedling/vendor/cmock/docs/CMock Summary.odt differ diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/docs/CMock Summary.pdf b/flex-bison/clcalc/tools/ceedling/vendor/cmock/docs/CMock Summary.pdf new file mode 100644 index 0000000..98f8ea1 Binary files /dev/null and b/flex-bison/clcalc/tools/ceedling/vendor/cmock/docs/CMock Summary.pdf differ diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/docs/license.txt b/flex-bison/clcalc/tools/ceedling/vendor/cmock/docs/license.txt new file mode 100644 index 0000000..8eb75ad --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/docs/license.txt @@ -0,0 +1,31 @@ + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + The end-user documentation included with the redistribution, if + any, must include the following acknowledgment: "This product + includes software developed for the CMock Project, by Mike Karlesky, + Mark VanderVoord, and Greg Williams and other contributors", in + the same place and form as other third-party acknowledgments. + Alternately, this acknowledgment may appear in the software + itself, in the same form and location as other such third-party + acknowledgments. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/gcc.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/gcc.yml new file mode 100644 index 0000000..07ecf9a --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/gcc.yml @@ -0,0 +1,43 @@ +compiler: + path: gcc + source_path: 'src/' + unit_tests_path: &unit_tests_path 'test/' + build_path: &build_path 'build/' + options: + - -c + includes: + prefix: '-I' + items: + - 'src/' + - '../src/' + - '../vendor/unity/src/' + - '../vendor/unity/examples/helper/' + - 'mocks/' + - *unit_tests_path + defines: + prefix: '-D' + items: + - __monitor + object_files: + prefix: '-o' + extension: '.o' + destination: *build_path +linker: + path: gcc + options: + - -lm + includes: + prefix: '-I' + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.exe' + destination: *build_path +:cmock: + :plugins: [] + :includes: + - Types.h + +colour: true \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/iar_v4.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/iar_v4.yml new file mode 100644 index 0000000..4c13425 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/iar_v4.yml @@ -0,0 +1,91 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 4.0 Kickstart\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\lib\dl4tptinl8n.h'] + - -z3 + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian little + - --cpu ARM7TDMI + - --stack_align 4 + - --interwork + - -e + - --silent + - --warnings_are_errors + - --fpu None + - --diag_suppress Pa050 + includes: + prefix: '-I' + items: + - 'src/' + - '../src/' + - '../vendor/unity/src/' + - '../vendor/unity/examples/helper/' + - 'mocks/' + - [*tools_root, 'arm\inc\'] + - *unit_tests_path + defines: + prefix: '-D' + items: + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'common\bin\xlink.exe'] + options: + - -rt + - [*tools_root, 'arm\lib\dl4tptinl8n.r79'] + - -D_L_EXTMEM_START=0 + - -D_L_EXTMEM_SIZE=0 + - -D_L_HEAP_SIZE=120 + - -D_L_STACK_SIZE=32 + - -e_small_write=_formatted_write + - -s + - __program_start + - -f + - [*tools_root, '\arm\config\lnkarm.xcl'] + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\config\'] + - [*tools_root, 'arm\lib\'] + object_files: + path: *build_path + extension: '.r79' + bin_files: + prefix: '-o' + extension: '.d79' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\ioat91sam7X256.ddf'] + - -d + - sim +:cmock: + :plugins: [] + :includes: + - Types.h + \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/iar_v5.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/iar_v5.yml new file mode 100644 index 0000000..839936b --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/iar_v5.yml @@ -0,0 +1,80 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian=little + - --cpu=ARM7TDMI + - --interwork + - --warnings_are_errors + - --fpu=None + - --diag_suppress=Pa050 + - --diag_suppress=Pe111 + - -e + - -On + includes: + prefix: '-I' + items: + - 'src/' + - '../src/' + - '../vendor/unity/src/' + - '../vendor/unity/examples/helper/' + - 'mocks/' + - [*tools_root, 'arm\inc\'] + - *unit_tests_path + defines: + prefix: '-D' + items: + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\debugger\atmel\ioat91sam7X256.ddf'] + - -d + - sim +:cmock: + :plugins: [] + :includes: + - Types.h + \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/rakefile.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/rakefile.rb new file mode 100644 index 0000000..0c6a7ca --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/rakefile.rb @@ -0,0 +1,32 @@ +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require './rakefile_helper' + +include RakefileHelpers + +# Load default configuration, for now +DEFAULT_CONFIG_FILE = 'gcc.yml' +configure_toolchain(DEFAULT_CONFIG_FILE) + +task :unit do + run_tests(get_unit_test_files) +end + +desc "Generate test summary" +task :summary do + report_summary +end + +desc "Build and test Unity" +task :all => [:clean, :unit, :summary] +task :default => [:clobber, :all] +task :ci => [:default] +task :cruise => [:default] + +desc "Load configuration" +task :config, :config_file do |t, args| + configure_toolchain(args[:config_file]) +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/rakefile_helper.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/rakefile_helper.rb new file mode 100644 index 0000000..b7626b3 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/rakefile_helper.rb @@ -0,0 +1,274 @@ +require 'yaml' +require 'fileutils' +require '../vendor/unity/auto/unity_test_summary' +require '../vendor/unity/auto/generate_test_runner' +require '../vendor/unity/auto/colour_reporter' + +module RakefileHelpers + + C_EXTENSION = '.c' + + def load_configuration(config_file) + $cfg_file = config_file + $cfg = YAML.load(File.read($cfg_file)) + $colour_output = false unless $cfg['colour'] + end + + def configure_clean + CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil? + end + + def configure_toolchain(config_file=DEFAULT_CONFIG_FILE) + config_file += '.yml' unless config_file =~ /\.yml$/ + load_configuration(config_file) + configure_clean + end + + def get_unit_test_files + path = $cfg['compiler']['unit_tests_path'] + 'Test*' + C_EXTENSION + path.gsub!(/\\/, '/') + FileList.new(path) + end + + def get_local_include_dirs + include_dirs = $cfg['compiler']['includes']['items'].dup + include_dirs.delete_if {|dir| dir.is_a?(Array)} + return include_dirs + end + + def extract_headers(filename) + includes = [] + lines = File.readlines(filename) + lines.each do |line| + m = line.match(/^\s*#include\s+\"\s*(.+\.[hH])\s*\"/) + if not m.nil? + includes << m[1] + end + end + return includes + end + + def find_source_file(header, paths) + paths.each do |dir| + src_file = dir + header.ext(C_EXTENSION) + if (File.exists?(src_file)) + return src_file + end + end + return nil + end + + def tackit(strings) + case(strings) + when Array + "\"#{strings.join}\"" + when /^-/ + strings + when /\s/ + "\"#{strings}\"" + else + strings + end + end + + def squash(prefix, items) + result = '' + items.each { |item| result += " #{prefix}#{tackit(item)}" } + return result + end + + def build_compiler_fields + command = tackit($cfg['compiler']['path']) + if $cfg['compiler']['defines']['items'].nil? + defines = '' + else + defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items']) + end + options = squash('', $cfg['compiler']['options']) + includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :defines => defines, :options => options, :includes => includes} + end + + def compile(file, defines=[]) + compiler = build_compiler_fields + cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{file} " + + "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" + + "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" + execute(cmd_str) + end + + def build_linker_fields + command = tackit($cfg['linker']['path']) + if $cfg['linker']['options'].nil? + options = '' + else + options = squash('', $cfg['linker']['options']) + end + if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?) + includes = '' + else + includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) + end + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :options => options, :includes => includes} + end + + def link(exe_name, obj_list) + linker = build_linker_fields + cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + + (obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).join + + $cfg['linker']['bin_files']['prefix'] + ' ' + + $cfg['linker']['bin_files']['destination'] + + exe_name + $cfg['linker']['bin_files']['extension'] + execute(cmd_str) + end + + def build_simulator_fields + return nil if $cfg['simulator'].nil? + if $cfg['simulator']['path'].nil? + command = '' + else + command = (tackit($cfg['simulator']['path']) + ' ') + end + if $cfg['simulator']['pre_support'].nil? + pre_support = '' + else + pre_support = squash('', $cfg['simulator']['pre_support']) + end + if $cfg['simulator']['post_support'].nil? + post_support = '' + else + post_support = squash('', $cfg['simulator']['post_support']) + end + return {:command => command, :pre_support => pre_support, :post_support => post_support} + end + + def execute(command_string, verbose=true) + report command_string + output = `#{command_string}`.chomp + report(output) if (verbose && !output.nil? && (output.length > 0)) + if $?.exitstatus != 0 + raise "Command failed. (Returned #{$?.exitstatus})" + end + return output + end + + def report_summary + summary = UnityTestSummary.new + summary.set_root_path(HERE) + results_glob = "#{$cfg['compiler']['build_path']}*.test*" + results_glob.gsub!(/\\/, '/') + results = Dir[results_glob] + summary.set_targets(results) + report summary.run + raise "There were failures" if (summary.failures > 0) + end + + def run_tests(test_files) + + report 'Running system tests...' + + # Tack on TEST define for compiling unit tests + load_configuration($cfg_file) + test_defines = ['TEST'] + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + $cfg['compiler']['defines']['items'] << 'TEST' + + include_dirs = get_local_include_dirs + + # Build and execute each unit test + test_files.each do |test| + obj_list = [] + + # Detect dependencies and build required required modules + header_list = extract_headers(test) + ['cmock.h'] + header_list.each do |header| + + #create mocks if needed + if (header =~ /Mock/) + require "../lib/cmock.rb" + @cmock ||= CMock.new($cfg_file) + @cmock.setup_mocks([$cfg['compiler']['source_path']+header.gsub('Mock','')]) + end + + end + + #compile all mocks + header_list.each do |header| + #compile source file header if it exists + src_file = find_source_file(header, include_dirs) + if !src_file.nil? + compile(src_file, test_defines) + obj_list << header.ext($cfg['compiler']['object_files']['extension']) + end + end + + # Build the test runner (generate if configured to do so) + test_base = File.basename(test, C_EXTENSION) + runner_name = test_base + '_Runner.c' + if $cfg['compiler']['runner_path'].nil? + runner_path = $cfg['compiler']['build_path'] + runner_name + test_gen = UnityTestRunnerGenerator.new($cfg_file) + test_gen.run(test, runner_path) + else + runner_path = $cfg['compiler']['runner_path'] + runner_name + end + + compile(runner_path, test_defines) + obj_list << runner_name.ext($cfg['compiler']['object_files']['extension']) + + # Build the test module + compile(test, test_defines) + obj_list << test_base.ext($cfg['compiler']['object_files']['extension']) + + # Link the test executable + link(test_base, obj_list) + + # Execute unit test and generate results file + simulator = build_simulator_fields + executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] + if simulator.nil? + cmd_str = executable + else + cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" + end + output = execute(cmd_str) + test_results = $cfg['compiler']['build_path'] + test_base + if output.match(/OK$/m).nil? + test_results += '.testfail' + else + test_results += '.testpass' + end + File.open(test_results, 'w') { |f| f.print output } + end + end + + def build_application(main) + + report "Building application..." + + obj_list = [] + load_configuration($cfg_file) + main_path = $cfg['compiler']['source_path'] + main + C_EXTENSION + + # Detect dependencies and build required required modules + include_dirs = get_local_include_dirs + extract_headers(main_path).each do |header| + src_file = find_source_file(header, include_dirs) + if !src_file.nil? + compile(src_file) + obj_list << header.ext($cfg['compiler']['object_files']['extension']) + end + end + + # Build the main source file + main_base = File.basename(main_path, C_EXTENSION) + compile(main_path) + obj_list << main_base.ext($cfg['compiler']['object_files']['extension']) + + # Create the executable + link(main_base, obj_list) + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/AT91SAM7X256.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/AT91SAM7X256.h new file mode 100644 index 0000000..baa0313 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/AT91SAM7X256.h @@ -0,0 +1,2556 @@ +// ---------------------------------------------------------------------------- +// ATMEL Microcontroller Software Support - ROUSSET - +// ---------------------------------------------------------------------------- +// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// ---------------------------------------------------------------------------- +// File Name : AT91SAM7X256.h +// Object : AT91SAM7X256 definitions +// Generated : AT91 SW Application Group 01/16/2006 (16:36:21) +// +// CVS Reference : /AT91SAM7X256.pl/1.15/Wed Nov 2 13:56:49 2005// +// CVS Reference : /SYS_SAM7X.pl/1.3/Tue Feb 1 17:01:43 2005// +// CVS Reference : /MC_SAM7X.pl/1.2/Fri May 20 14:13:04 2005// +// CVS Reference : /PMC_SAM7X.pl/1.4/Tue Feb 8 13:58:10 2005// +// CVS Reference : /RSTC_SAM7X.pl/1.2/Wed Jul 13 14:57:50 2005// +// CVS Reference : /UDP_SAM7X.pl/1.1/Tue May 10 11:35:35 2005// +// CVS Reference : /PWM_SAM7X.pl/1.1/Tue May 10 11:53:07 2005// +// CVS Reference : /AIC_6075B.pl/1.3/Fri May 20 14:01:30 2005// +// CVS Reference : /PIO_6057A.pl/1.2/Thu Feb 3 10:18:28 2005// +// CVS Reference : /RTTC_6081A.pl/1.2/Tue Nov 9 14:43:58 2004// +// CVS Reference : /PITC_6079A.pl/1.2/Tue Nov 9 14:43:56 2004// +// CVS Reference : /WDTC_6080A.pl/1.3/Tue Nov 9 14:44:00 2004// +// CVS Reference : /VREG_6085B.pl/1.1/Tue Feb 1 16:05:48 2005// +// CVS Reference : /PDC_6074C.pl/1.2/Thu Feb 3 08:48:54 2005// +// CVS Reference : /DBGU_6059D.pl/1.1/Mon Jan 31 13:15:32 2005// +// CVS Reference : /SPI_6088D.pl/1.3/Fri May 20 14:08:59 2005// +// CVS Reference : /US_6089C.pl/1.1/Mon Jul 12 18:23:26 2004// +// CVS Reference : /SSC_6078B.pl/1.1/Wed Jul 13 15:19:19 2005// +// CVS Reference : /TWI_6061A.pl/1.1/Tue Jul 13 07:38:06 2004// +// CVS Reference : /TC_6082A.pl/1.7/Fri Mar 11 12:52:17 2005// +// CVS Reference : /CAN_6019B.pl/1.1/Tue Mar 8 12:42:22 2005// +// CVS Reference : /EMACB_6119A.pl/1.6/Wed Jul 13 15:05:35 2005// +// CVS Reference : /ADC_6051C.pl/1.1/Fri Oct 17 09:12:38 2003// +// ---------------------------------------------------------------------------- + +#ifndef AT91SAM7X256_H +#define AT91SAM7X256_H + +typedef volatile unsigned int AT91_REG;// Hardware register definition + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR System Peripherals +// ***************************************************************************** +typedef struct _AT91S_SYS { + AT91_REG AIC_SMR[32]; // Source Mode Register + AT91_REG AIC_SVR[32]; // Source Vector Register + AT91_REG AIC_IVR; // IRQ Vector Register + AT91_REG AIC_FVR; // FIQ Vector Register + AT91_REG AIC_ISR; // Interrupt Status Register + AT91_REG AIC_IPR; // Interrupt Pending Register + AT91_REG AIC_IMR; // Interrupt Mask Register + AT91_REG AIC_CISR; // Core Interrupt Status Register + AT91_REG Reserved0[2]; // + AT91_REG AIC_IECR; // Interrupt Enable Command Register + AT91_REG AIC_IDCR; // Interrupt Disable Command Register + AT91_REG AIC_ICCR; // Interrupt Clear Command Register + AT91_REG AIC_ISCR; // Interrupt Set Command Register + AT91_REG AIC_EOICR; // End of Interrupt Command Register + AT91_REG AIC_SPU; // Spurious Vector Register + AT91_REG AIC_DCR; // Debug Control Register (Protect) + AT91_REG Reserved1[1]; // + AT91_REG AIC_FFER; // Fast Forcing Enable Register + AT91_REG AIC_FFDR; // Fast Forcing Disable Register + AT91_REG AIC_FFSR; // Fast Forcing Status Register + AT91_REG Reserved2[45]; // + AT91_REG DBGU_CR; // Control Register + AT91_REG DBGU_MR; // Mode Register + AT91_REG DBGU_IER; // Interrupt Enable Register + AT91_REG DBGU_IDR; // Interrupt Disable Register + AT91_REG DBGU_IMR; // Interrupt Mask Register + AT91_REG DBGU_CSR; // Channel Status Register + AT91_REG DBGU_RHR; // Receiver Holding Register + AT91_REG DBGU_THR; // Transmitter Holding Register + AT91_REG DBGU_BRGR; // Baud Rate Generator Register + AT91_REG Reserved3[7]; // + AT91_REG DBGU_CIDR; // Chip ID Register + AT91_REG DBGU_EXID; // Chip ID Extension Register + AT91_REG DBGU_FNTR; // Force NTRST Register + AT91_REG Reserved4[45]; // + AT91_REG DBGU_RPR; // Receive Pointer Register + AT91_REG DBGU_RCR; // Receive Counter Register + AT91_REG DBGU_TPR; // Transmit Pointer Register + AT91_REG DBGU_TCR; // Transmit Counter Register + AT91_REG DBGU_RNPR; // Receive Next Pointer Register + AT91_REG DBGU_RNCR; // Receive Next Counter Register + AT91_REG DBGU_TNPR; // Transmit Next Pointer Register + AT91_REG DBGU_TNCR; // Transmit Next Counter Register + AT91_REG DBGU_PTCR; // PDC Transfer Control Register + AT91_REG DBGU_PTSR; // PDC Transfer Status Register + AT91_REG Reserved5[54]; // + AT91_REG PIOA_PER; // PIO Enable Register + AT91_REG PIOA_PDR; // PIO Disable Register + AT91_REG PIOA_PSR; // PIO Status Register + AT91_REG Reserved6[1]; // + AT91_REG PIOA_OER; // Output Enable Register + AT91_REG PIOA_ODR; // Output Disable Registerr + AT91_REG PIOA_OSR; // Output Status Register + AT91_REG Reserved7[1]; // + AT91_REG PIOA_IFER; // Input Filter Enable Register + AT91_REG PIOA_IFDR; // Input Filter Disable Register + AT91_REG PIOA_IFSR; // Input Filter Status Register + AT91_REG Reserved8[1]; // + AT91_REG PIOA_SODR; // Set Output Data Register + AT91_REG PIOA_CODR; // Clear Output Data Register + AT91_REG PIOA_ODSR; // Output Data Status Register + AT91_REG PIOA_PDSR; // Pin Data Status Register + AT91_REG PIOA_IER; // Interrupt Enable Register + AT91_REG PIOA_IDR; // Interrupt Disable Register + AT91_REG PIOA_IMR; // Interrupt Mask Register + AT91_REG PIOA_ISR; // Interrupt Status Register + AT91_REG PIOA_MDER; // Multi-driver Enable Register + AT91_REG PIOA_MDDR; // Multi-driver Disable Register + AT91_REG PIOA_MDSR; // Multi-driver Status Register + AT91_REG Reserved9[1]; // + AT91_REG PIOA_PPUDR; // Pull-up Disable Register + AT91_REG PIOA_PPUER; // Pull-up Enable Register + AT91_REG PIOA_PPUSR; // Pull-up Status Register + AT91_REG Reserved10[1]; // + AT91_REG PIOA_ASR; // Select A Register + AT91_REG PIOA_BSR; // Select B Register + AT91_REG PIOA_ABSR; // AB Select Status Register + AT91_REG Reserved11[9]; // + AT91_REG PIOA_OWER; // Output Write Enable Register + AT91_REG PIOA_OWDR; // Output Write Disable Register + AT91_REG PIOA_OWSR; // Output Write Status Register + AT91_REG Reserved12[85]; // + AT91_REG PIOB_PER; // PIO Enable Register + AT91_REG PIOB_PDR; // PIO Disable Register + AT91_REG PIOB_PSR; // PIO Status Register + AT91_REG Reserved13[1]; // + AT91_REG PIOB_OER; // Output Enable Register + AT91_REG PIOB_ODR; // Output Disable Registerr + AT91_REG PIOB_OSR; // Output Status Register + AT91_REG Reserved14[1]; // + AT91_REG PIOB_IFER; // Input Filter Enable Register + AT91_REG PIOB_IFDR; // Input Filter Disable Register + AT91_REG PIOB_IFSR; // Input Filter Status Register + AT91_REG Reserved15[1]; // + AT91_REG PIOB_SODR; // Set Output Data Register + AT91_REG PIOB_CODR; // Clear Output Data Register + AT91_REG PIOB_ODSR; // Output Data Status Register + AT91_REG PIOB_PDSR; // Pin Data Status Register + AT91_REG PIOB_IER; // Interrupt Enable Register + AT91_REG PIOB_IDR; // Interrupt Disable Register + AT91_REG PIOB_IMR; // Interrupt Mask Register + AT91_REG PIOB_ISR; // Interrupt Status Register + AT91_REG PIOB_MDER; // Multi-driver Enable Register + AT91_REG PIOB_MDDR; // Multi-driver Disable Register + AT91_REG PIOB_MDSR; // Multi-driver Status Register + AT91_REG Reserved16[1]; // + AT91_REG PIOB_PPUDR; // Pull-up Disable Register + AT91_REG PIOB_PPUER; // Pull-up Enable Register + AT91_REG PIOB_PPUSR; // Pull-up Status Register + AT91_REG Reserved17[1]; // + AT91_REG PIOB_ASR; // Select A Register + AT91_REG PIOB_BSR; // Select B Register + AT91_REG PIOB_ABSR; // AB Select Status Register + AT91_REG Reserved18[9]; // + AT91_REG PIOB_OWER; // Output Write Enable Register + AT91_REG PIOB_OWDR; // Output Write Disable Register + AT91_REG PIOB_OWSR; // Output Write Status Register + AT91_REG Reserved19[341]; // + AT91_REG PMC_SCER; // System Clock Enable Register + AT91_REG PMC_SCDR; // System Clock Disable Register + AT91_REG PMC_SCSR; // System Clock Status Register + AT91_REG Reserved20[1]; // + AT91_REG PMC_PCER; // Peripheral Clock Enable Register + AT91_REG PMC_PCDR; // Peripheral Clock Disable Register + AT91_REG PMC_PCSR; // Peripheral Clock Status Register + AT91_REG Reserved21[1]; // + AT91_REG PMC_MOR; // Main Oscillator Register + AT91_REG PMC_MCFR; // Main Clock Frequency Register + AT91_REG Reserved22[1]; // + AT91_REG PMC_PLLR; // PLL Register + AT91_REG PMC_MCKR; // Master Clock Register + AT91_REG Reserved23[3]; // + AT91_REG PMC_PCKR[4]; // Programmable Clock Register + AT91_REG Reserved24[4]; // + AT91_REG PMC_IER; // Interrupt Enable Register + AT91_REG PMC_IDR; // Interrupt Disable Register + AT91_REG PMC_SR; // Status Register + AT91_REG PMC_IMR; // Interrupt Mask Register + AT91_REG Reserved25[36]; // + AT91_REG RSTC_RCR; // Reset Control Register + AT91_REG RSTC_RSR; // Reset Status Register + AT91_REG RSTC_RMR; // Reset Mode Register + AT91_REG Reserved26[5]; // + AT91_REG RTTC_RTMR; // Real-time Mode Register + AT91_REG RTTC_RTAR; // Real-time Alarm Register + AT91_REG RTTC_RTVR; // Real-time Value Register + AT91_REG RTTC_RTSR; // Real-time Status Register + AT91_REG PITC_PIMR; // Period Interval Mode Register + AT91_REG PITC_PISR; // Period Interval Status Register + AT91_REG PITC_PIVR; // Period Interval Value Register + AT91_REG PITC_PIIR; // Period Interval Image Register + AT91_REG WDTC_WDCR; // Watchdog Control Register + AT91_REG WDTC_WDMR; // Watchdog Mode Register + AT91_REG WDTC_WDSR; // Watchdog Status Register + AT91_REG Reserved27[5]; // + AT91_REG VREG_MR; // Voltage Regulator Mode Register +} AT91S_SYS, *AT91PS_SYS; + + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Advanced Interrupt Controller +// ***************************************************************************** +typedef struct _AT91S_AIC { + AT91_REG AIC_SMR[32]; // Source Mode Register + AT91_REG AIC_SVR[32]; // Source Vector Register + AT91_REG AIC_IVR; // IRQ Vector Register + AT91_REG AIC_FVR; // FIQ Vector Register + AT91_REG AIC_ISR; // Interrupt Status Register + AT91_REG AIC_IPR; // Interrupt Pending Register + AT91_REG AIC_IMR; // Interrupt Mask Register + AT91_REG AIC_CISR; // Core Interrupt Status Register + AT91_REG Reserved0[2]; // + AT91_REG AIC_IECR; // Interrupt Enable Command Register + AT91_REG AIC_IDCR; // Interrupt Disable Command Register + AT91_REG AIC_ICCR; // Interrupt Clear Command Register + AT91_REG AIC_ISCR; // Interrupt Set Command Register + AT91_REG AIC_EOICR; // End of Interrupt Command Register + AT91_REG AIC_SPU; // Spurious Vector Register + AT91_REG AIC_DCR; // Debug Control Register (Protect) + AT91_REG Reserved1[1]; // + AT91_REG AIC_FFER; // Fast Forcing Enable Register + AT91_REG AIC_FFDR; // Fast Forcing Disable Register + AT91_REG AIC_FFSR; // Fast Forcing Status Register +} AT91S_AIC, *AT91PS_AIC; + +// -------- AIC_SMR : (AIC Offset: 0x0) Control Register -------- +#define AT91C_AIC_PRIOR ((unsigned int) 0x7 << 0) // (AIC) Priority Level +#define AT91C_AIC_PRIOR_LOWEST ((unsigned int) 0x0) // (AIC) Lowest priority level +#define AT91C_AIC_PRIOR_HIGHEST ((unsigned int) 0x7) // (AIC) Highest priority level +#define AT91C_AIC_SRCTYPE ((unsigned int) 0x3 << 5) // (AIC) Interrupt Source Type +#define AT91C_AIC_SRCTYPE_EXT_LOW_LEVEL ((unsigned int) 0x0 << 5) // (AIC) External Sources Code Label Low-level Sensitive +#define AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL ((unsigned int) 0x0 << 5) // (AIC) Internal Sources Code Label High-level Sensitive +#define AT91C_AIC_SRCTYPE_INT_POSITIVE_EDGE ((unsigned int) 0x1 << 5) // (AIC) Internal Sources Code Label Positive Edge triggered +#define AT91C_AIC_SRCTYPE_EXT_NEGATIVE_EDGE ((unsigned int) 0x1 << 5) // (AIC) External Sources Code Label Negative Edge triggered +#define AT91C_AIC_SRCTYPE_HIGH_LEVEL ((unsigned int) 0x2 << 5) // (AIC) Internal Or External Sources Code Label High-level Sensitive +#define AT91C_AIC_SRCTYPE_POSITIVE_EDGE ((unsigned int) 0x3 << 5) // (AIC) Internal Or External Sources Code Label Positive Edge triggered +// -------- AIC_CISR : (AIC Offset: 0x114) AIC Core Interrupt Status Register -------- +#define AT91C_AIC_NFIQ ((unsigned int) 0x1 << 0) // (AIC) NFIQ Status +#define AT91C_AIC_NIRQ ((unsigned int) 0x1 << 1) // (AIC) NIRQ Status +// -------- AIC_DCR : (AIC Offset: 0x138) AIC Debug Control Register (Protect) -------- +#define AT91C_AIC_DCR_PROT ((unsigned int) 0x1 << 0) // (AIC) Protection Mode +#define AT91C_AIC_DCR_GMSK ((unsigned int) 0x1 << 1) // (AIC) General Mask + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Peripheral DMA Controller +// ***************************************************************************** +typedef struct _AT91S_PDC { + AT91_REG PDC_RPR; // Receive Pointer Register + AT91_REG PDC_RCR; // Receive Counter Register + AT91_REG PDC_TPR; // Transmit Pointer Register + AT91_REG PDC_TCR; // Transmit Counter Register + AT91_REG PDC_RNPR; // Receive Next Pointer Register + AT91_REG PDC_RNCR; // Receive Next Counter Register + AT91_REG PDC_TNPR; // Transmit Next Pointer Register + AT91_REG PDC_TNCR; // Transmit Next Counter Register + AT91_REG PDC_PTCR; // PDC Transfer Control Register + AT91_REG PDC_PTSR; // PDC Transfer Status Register +} AT91S_PDC, *AT91PS_PDC; + +// -------- PDC_PTCR : (PDC Offset: 0x20) PDC Transfer Control Register -------- +#define AT91C_PDC_RXTEN ((unsigned int) 0x1 << 0) // (PDC) Receiver Transfer Enable +#define AT91C_PDC_RXTDIS ((unsigned int) 0x1 << 1) // (PDC) Receiver Transfer Disable +#define AT91C_PDC_TXTEN ((unsigned int) 0x1 << 8) // (PDC) Transmitter Transfer Enable +#define AT91C_PDC_TXTDIS ((unsigned int) 0x1 << 9) // (PDC) Transmitter Transfer Disable +// -------- PDC_PTSR : (PDC Offset: 0x24) PDC Transfer Status Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Debug Unit +// ***************************************************************************** +typedef struct _AT91S_DBGU { + AT91_REG DBGU_CR; // Control Register + AT91_REG DBGU_MR; // Mode Register + AT91_REG DBGU_IER; // Interrupt Enable Register + AT91_REG DBGU_IDR; // Interrupt Disable Register + AT91_REG DBGU_IMR; // Interrupt Mask Register + AT91_REG DBGU_CSR; // Channel Status Register + AT91_REG DBGU_RHR; // Receiver Holding Register + AT91_REG DBGU_THR; // Transmitter Holding Register + AT91_REG DBGU_BRGR; // Baud Rate Generator Register + AT91_REG Reserved0[7]; // + AT91_REG DBGU_CIDR; // Chip ID Register + AT91_REG DBGU_EXID; // Chip ID Extension Register + AT91_REG DBGU_FNTR; // Force NTRST Register + AT91_REG Reserved1[45]; // + AT91_REG DBGU_RPR; // Receive Pointer Register + AT91_REG DBGU_RCR; // Receive Counter Register + AT91_REG DBGU_TPR; // Transmit Pointer Register + AT91_REG DBGU_TCR; // Transmit Counter Register + AT91_REG DBGU_RNPR; // Receive Next Pointer Register + AT91_REG DBGU_RNCR; // Receive Next Counter Register + AT91_REG DBGU_TNPR; // Transmit Next Pointer Register + AT91_REG DBGU_TNCR; // Transmit Next Counter Register + AT91_REG DBGU_PTCR; // PDC Transfer Control Register + AT91_REG DBGU_PTSR; // PDC Transfer Status Register +} AT91S_DBGU, *AT91PS_DBGU; + +// -------- DBGU_CR : (DBGU Offset: 0x0) Debug Unit Control Register -------- +#define AT91C_US_RSTRX ((unsigned int) 0x1 << 2) // (DBGU) Reset Receiver +#define AT91C_US_RSTTX ((unsigned int) 0x1 << 3) // (DBGU) Reset Transmitter +#define AT91C_US_RXEN ((unsigned int) 0x1 << 4) // (DBGU) Receiver Enable +#define AT91C_US_RXDIS ((unsigned int) 0x1 << 5) // (DBGU) Receiver Disable +#define AT91C_US_TXEN ((unsigned int) 0x1 << 6) // (DBGU) Transmitter Enable +#define AT91C_US_TXDIS ((unsigned int) 0x1 << 7) // (DBGU) Transmitter Disable +#define AT91C_US_RSTSTA ((unsigned int) 0x1 << 8) // (DBGU) Reset Status Bits +// -------- DBGU_MR : (DBGU Offset: 0x4) Debug Unit Mode Register -------- +#define AT91C_US_PAR ((unsigned int) 0x7 << 9) // (DBGU) Parity type +#define AT91C_US_PAR_EVEN ((unsigned int) 0x0 << 9) // (DBGU) Even Parity +#define AT91C_US_PAR_ODD ((unsigned int) 0x1 << 9) // (DBGU) Odd Parity +#define AT91C_US_PAR_SPACE ((unsigned int) 0x2 << 9) // (DBGU) Parity forced to 0 (Space) +#define AT91C_US_PAR_MARK ((unsigned int) 0x3 << 9) // (DBGU) Parity forced to 1 (Mark) +#define AT91C_US_PAR_NONE ((unsigned int) 0x4 << 9) // (DBGU) No Parity +#define AT91C_US_PAR_MULTI_DROP ((unsigned int) 0x6 << 9) // (DBGU) Multi-drop mode +#define AT91C_US_CHMODE ((unsigned int) 0x3 << 14) // (DBGU) Channel Mode +#define AT91C_US_CHMODE_NORMAL ((unsigned int) 0x0 << 14) // (DBGU) Normal Mode: The USART channel operates as an RX/TX USART. +#define AT91C_US_CHMODE_AUTO ((unsigned int) 0x1 << 14) // (DBGU) Automatic Echo: Receiver Data Input is connected to the TXD pin. +#define AT91C_US_CHMODE_LOCAL ((unsigned int) 0x2 << 14) // (DBGU) Local Loopback: Transmitter Output Signal is connected to Receiver Input Signal. +#define AT91C_US_CHMODE_REMOTE ((unsigned int) 0x3 << 14) // (DBGU) Remote Loopback: RXD pin is internally connected to TXD pin. +// -------- DBGU_IER : (DBGU Offset: 0x8) Debug Unit Interrupt Enable Register -------- +#define AT91C_US_RXRDY ((unsigned int) 0x1 << 0) // (DBGU) RXRDY Interrupt +#define AT91C_US_TXRDY ((unsigned int) 0x1 << 1) // (DBGU) TXRDY Interrupt +#define AT91C_US_ENDRX ((unsigned int) 0x1 << 3) // (DBGU) End of Receive Transfer Interrupt +#define AT91C_US_ENDTX ((unsigned int) 0x1 << 4) // (DBGU) End of Transmit Interrupt +#define AT91C_US_OVRE ((unsigned int) 0x1 << 5) // (DBGU) Overrun Interrupt +#define AT91C_US_FRAME ((unsigned int) 0x1 << 6) // (DBGU) Framing Error Interrupt +#define AT91C_US_PARE ((unsigned int) 0x1 << 7) // (DBGU) Parity Error Interrupt +#define AT91C_US_TXEMPTY ((unsigned int) 0x1 << 9) // (DBGU) TXEMPTY Interrupt +#define AT91C_US_TXBUFE ((unsigned int) 0x1 << 11) // (DBGU) TXBUFE Interrupt +#define AT91C_US_RXBUFF ((unsigned int) 0x1 << 12) // (DBGU) RXBUFF Interrupt +#define AT91C_US_COMM_TX ((unsigned int) 0x1 << 30) // (DBGU) COMM_TX Interrupt +#define AT91C_US_COMM_RX ((unsigned int) 0x1 << 31) // (DBGU) COMM_RX Interrupt +// -------- DBGU_IDR : (DBGU Offset: 0xc) Debug Unit Interrupt Disable Register -------- +// -------- DBGU_IMR : (DBGU Offset: 0x10) Debug Unit Interrupt Mask Register -------- +// -------- DBGU_CSR : (DBGU Offset: 0x14) Debug Unit Channel Status Register -------- +// -------- DBGU_FNTR : (DBGU Offset: 0x48) Debug Unit FORCE_NTRST Register -------- +#define AT91C_US_FORCE_NTRST ((unsigned int) 0x1 << 0) // (DBGU) Force NTRST in JTAG + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Parallel Input Output Controler +// ***************************************************************************** +typedef struct _AT91S_PIO { + AT91_REG PIO_PER; // PIO Enable Register + AT91_REG PIO_PDR; // PIO Disable Register + AT91_REG PIO_PSR; // PIO Status Register + AT91_REG Reserved0[1]; // + AT91_REG PIO_OER; // Output Enable Register + AT91_REG PIO_ODR; // Output Disable Registerr + AT91_REG PIO_OSR; // Output Status Register + AT91_REG Reserved1[1]; // + AT91_REG PIO_IFER; // Input Filter Enable Register + AT91_REG PIO_IFDR; // Input Filter Disable Register + AT91_REG PIO_IFSR; // Input Filter Status Register + AT91_REG Reserved2[1]; // + AT91_REG PIO_SODR; // Set Output Data Register + AT91_REG PIO_CODR; // Clear Output Data Register + AT91_REG PIO_ODSR; // Output Data Status Register + AT91_REG PIO_PDSR; // Pin Data Status Register + AT91_REG PIO_IER; // Interrupt Enable Register + AT91_REG PIO_IDR; // Interrupt Disable Register + AT91_REG PIO_IMR; // Interrupt Mask Register + AT91_REG PIO_ISR; // Interrupt Status Register + AT91_REG PIO_MDER; // Multi-driver Enable Register + AT91_REG PIO_MDDR; // Multi-driver Disable Register + AT91_REG PIO_MDSR; // Multi-driver Status Register + AT91_REG Reserved3[1]; // + AT91_REG PIO_PPUDR; // Pull-up Disable Register + AT91_REG PIO_PPUER; // Pull-up Enable Register + AT91_REG PIO_PPUSR; // Pull-up Status Register + AT91_REG Reserved4[1]; // + AT91_REG PIO_ASR; // Select A Register + AT91_REG PIO_BSR; // Select B Register + AT91_REG PIO_ABSR; // AB Select Status Register + AT91_REG Reserved5[9]; // + AT91_REG PIO_OWER; // Output Write Enable Register + AT91_REG PIO_OWDR; // Output Write Disable Register + AT91_REG PIO_OWSR; // Output Write Status Register +} AT91S_PIO, *AT91PS_PIO; + + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Clock Generator Controler +// ***************************************************************************** +typedef struct _AT91S_CKGR { + AT91_REG CKGR_MOR; // Main Oscillator Register + AT91_REG CKGR_MCFR; // Main Clock Frequency Register + AT91_REG Reserved0[1]; // + AT91_REG CKGR_PLLR; // PLL Register +} AT91S_CKGR, *AT91PS_CKGR; + +// -------- CKGR_MOR : (CKGR Offset: 0x0) Main Oscillator Register -------- +#define AT91C_CKGR_MOSCEN ((unsigned int) 0x1 << 0) // (CKGR) Main Oscillator Enable +#define AT91C_CKGR_OSCBYPASS ((unsigned int) 0x1 << 1) // (CKGR) Main Oscillator Bypass +#define AT91C_CKGR_OSCOUNT ((unsigned int) 0xFF << 8) // (CKGR) Main Oscillator Start-up Time +// -------- CKGR_MCFR : (CKGR Offset: 0x4) Main Clock Frequency Register -------- +#define AT91C_CKGR_MAINF ((unsigned int) 0xFFFF << 0) // (CKGR) Main Clock Frequency +#define AT91C_CKGR_MAINRDY ((unsigned int) 0x1 << 16) // (CKGR) Main Clock Ready +// -------- CKGR_PLLR : (CKGR Offset: 0xc) PLL B Register -------- +#define AT91C_CKGR_DIV ((unsigned int) 0xFF << 0) // (CKGR) Divider Selected +#define AT91C_CKGR_DIV_0 ((unsigned int) 0x0) // (CKGR) Divider output is 0 +#define AT91C_CKGR_DIV_BYPASS ((unsigned int) 0x1) // (CKGR) Divider is bypassed +#define AT91C_CKGR_PLLCOUNT ((unsigned int) 0x3F << 8) // (CKGR) PLL Counter +#define AT91C_CKGR_OUT ((unsigned int) 0x3 << 14) // (CKGR) PLL Output Frequency Range +#define AT91C_CKGR_OUT_0 ((unsigned int) 0x0 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_OUT_1 ((unsigned int) 0x1 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_OUT_2 ((unsigned int) 0x2 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_OUT_3 ((unsigned int) 0x3 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_MUL ((unsigned int) 0x7FF << 16) // (CKGR) PLL Multiplier +#define AT91C_CKGR_USBDIV ((unsigned int) 0x3 << 28) // (CKGR) Divider for USB Clocks +#define AT91C_CKGR_USBDIV_0 ((unsigned int) 0x0 << 28) // (CKGR) Divider output is PLL clock output +#define AT91C_CKGR_USBDIV_1 ((unsigned int) 0x1 << 28) // (CKGR) Divider output is PLL clock output divided by 2 +#define AT91C_CKGR_USBDIV_2 ((unsigned int) 0x2 << 28) // (CKGR) Divider output is PLL clock output divided by 4 + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Power Management Controler +// ***************************************************************************** +typedef struct _AT91S_PMC { + AT91_REG PMC_SCER; // System Clock Enable Register + AT91_REG PMC_SCDR; // System Clock Disable Register + AT91_REG PMC_SCSR; // System Clock Status Register + AT91_REG Reserved0[1]; // + AT91_REG PMC_PCER; // Peripheral Clock Enable Register + AT91_REG PMC_PCDR; // Peripheral Clock Disable Register + AT91_REG PMC_PCSR; // Peripheral Clock Status Register + AT91_REG Reserved1[1]; // + AT91_REG PMC_MOR; // Main Oscillator Register + AT91_REG PMC_MCFR; // Main Clock Frequency Register + AT91_REG Reserved2[1]; // + AT91_REG PMC_PLLR; // PLL Register + AT91_REG PMC_MCKR; // Master Clock Register + AT91_REG Reserved3[3]; // + AT91_REG PMC_PCKR[4]; // Programmable Clock Register + AT91_REG Reserved4[4]; // + AT91_REG PMC_IER; // Interrupt Enable Register + AT91_REG PMC_IDR; // Interrupt Disable Register + AT91_REG PMC_SR; // Status Register + AT91_REG PMC_IMR; // Interrupt Mask Register +} AT91S_PMC, *AT91PS_PMC; + +// -------- PMC_SCER : (PMC Offset: 0x0) System Clock Enable Register -------- +#define AT91C_PMC_PCK ((unsigned int) 0x1 << 0) // (PMC) Processor Clock +#define AT91C_PMC_UDP ((unsigned int) 0x1 << 7) // (PMC) USB Device Port Clock +#define AT91C_PMC_PCK0 ((unsigned int) 0x1 << 8) // (PMC) Programmable Clock Output +#define AT91C_PMC_PCK1 ((unsigned int) 0x1 << 9) // (PMC) Programmable Clock Output +#define AT91C_PMC_PCK2 ((unsigned int) 0x1 << 10) // (PMC) Programmable Clock Output +#define AT91C_PMC_PCK3 ((unsigned int) 0x1 << 11) // (PMC) Programmable Clock Output +// -------- PMC_SCDR : (PMC Offset: 0x4) System Clock Disable Register -------- +// -------- PMC_SCSR : (PMC Offset: 0x8) System Clock Status Register -------- +// -------- CKGR_MOR : (PMC Offset: 0x20) Main Oscillator Register -------- +// -------- CKGR_MCFR : (PMC Offset: 0x24) Main Clock Frequency Register -------- +// -------- CKGR_PLLR : (PMC Offset: 0x2c) PLL B Register -------- +// -------- PMC_MCKR : (PMC Offset: 0x30) Master Clock Register -------- +#define AT91C_PMC_CSS ((unsigned int) 0x3 << 0) // (PMC) Programmable Clock Selection +#define AT91C_PMC_CSS_SLOW_CLK ((unsigned int) 0x0) // (PMC) Slow Clock is selected +#define AT91C_PMC_CSS_MAIN_CLK ((unsigned int) 0x1) // (PMC) Main Clock is selected +#define AT91C_PMC_CSS_PLL_CLK ((unsigned int) 0x3) // (PMC) Clock from PLL is selected +#define AT91C_PMC_PRES ((unsigned int) 0x7 << 2) // (PMC) Programmable Clock Prescaler +#define AT91C_PMC_PRES_CLK ((unsigned int) 0x0 << 2) // (PMC) Selected clock +#define AT91C_PMC_PRES_CLK_2 ((unsigned int) 0x1 << 2) // (PMC) Selected clock divided by 2 +#define AT91C_PMC_PRES_CLK_4 ((unsigned int) 0x2 << 2) // (PMC) Selected clock divided by 4 +#define AT91C_PMC_PRES_CLK_8 ((unsigned int) 0x3 << 2) // (PMC) Selected clock divided by 8 +#define AT91C_PMC_PRES_CLK_16 ((unsigned int) 0x4 << 2) // (PMC) Selected clock divided by 16 +#define AT91C_PMC_PRES_CLK_32 ((unsigned int) 0x5 << 2) // (PMC) Selected clock divided by 32 +#define AT91C_PMC_PRES_CLK_64 ((unsigned int) 0x6 << 2) // (PMC) Selected clock divided by 64 +// -------- PMC_PCKR : (PMC Offset: 0x40) Programmable Clock Register -------- +// -------- PMC_IER : (PMC Offset: 0x60) PMC Interrupt Enable Register -------- +#define AT91C_PMC_MOSCS ((unsigned int) 0x1 << 0) // (PMC) MOSC Status/Enable/Disable/Mask +#define AT91C_PMC_LOCK ((unsigned int) 0x1 << 2) // (PMC) PLL Status/Enable/Disable/Mask +#define AT91C_PMC_MCKRDY ((unsigned int) 0x1 << 3) // (PMC) MCK_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK0RDY ((unsigned int) 0x1 << 8) // (PMC) PCK0_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK1RDY ((unsigned int) 0x1 << 9) // (PMC) PCK1_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK2RDY ((unsigned int) 0x1 << 10) // (PMC) PCK2_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK3RDY ((unsigned int) 0x1 << 11) // (PMC) PCK3_RDY Status/Enable/Disable/Mask +// -------- PMC_IDR : (PMC Offset: 0x64) PMC Interrupt Disable Register -------- +// -------- PMC_SR : (PMC Offset: 0x68) PMC Status Register -------- +// -------- PMC_IMR : (PMC Offset: 0x6c) PMC Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Reset Controller Interface +// ***************************************************************************** +typedef struct _AT91S_RSTC { + AT91_REG RSTC_RCR; // Reset Control Register + AT91_REG RSTC_RSR; // Reset Status Register + AT91_REG RSTC_RMR; // Reset Mode Register +} AT91S_RSTC, *AT91PS_RSTC; + +// -------- RSTC_RCR : (RSTC Offset: 0x0) Reset Control Register -------- +#define AT91C_RSTC_PROCRST ((unsigned int) 0x1 << 0) // (RSTC) Processor Reset +#define AT91C_RSTC_PERRST ((unsigned int) 0x1 << 2) // (RSTC) Peripheral Reset +#define AT91C_RSTC_EXTRST ((unsigned int) 0x1 << 3) // (RSTC) External Reset +#define AT91C_RSTC_KEY ((unsigned int) 0xFF << 24) // (RSTC) Password +// -------- RSTC_RSR : (RSTC Offset: 0x4) Reset Status Register -------- +#define AT91C_RSTC_URSTS ((unsigned int) 0x1 << 0) // (RSTC) User Reset Status +#define AT91C_RSTC_BODSTS ((unsigned int) 0x1 << 1) // (RSTC) Brownout Detection Status +#define AT91C_RSTC_RSTTYP ((unsigned int) 0x7 << 8) // (RSTC) Reset Type +#define AT91C_RSTC_RSTTYP_POWERUP ((unsigned int) 0x0 << 8) // (RSTC) Power-up Reset. VDDCORE rising. +#define AT91C_RSTC_RSTTYP_WAKEUP ((unsigned int) 0x1 << 8) // (RSTC) WakeUp Reset. VDDCORE rising. +#define AT91C_RSTC_RSTTYP_WATCHDOG ((unsigned int) 0x2 << 8) // (RSTC) Watchdog Reset. Watchdog overflow occured. +#define AT91C_RSTC_RSTTYP_SOFTWARE ((unsigned int) 0x3 << 8) // (RSTC) Software Reset. Processor reset required by the software. +#define AT91C_RSTC_RSTTYP_USER ((unsigned int) 0x4 << 8) // (RSTC) User Reset. NRST pin detected low. +#define AT91C_RSTC_RSTTYP_BROWNOUT ((unsigned int) 0x5 << 8) // (RSTC) Brownout Reset occured. +#define AT91C_RSTC_NRSTL ((unsigned int) 0x1 << 16) // (RSTC) NRST pin level +#define AT91C_RSTC_SRCMP ((unsigned int) 0x1 << 17) // (RSTC) Software Reset Command in Progress. +// -------- RSTC_RMR : (RSTC Offset: 0x8) Reset Mode Register -------- +#define AT91C_RSTC_URSTEN ((unsigned int) 0x1 << 0) // (RSTC) User Reset Enable +#define AT91C_RSTC_URSTIEN ((unsigned int) 0x1 << 4) // (RSTC) User Reset Interrupt Enable +#define AT91C_RSTC_ERSTL ((unsigned int) 0xF << 8) // (RSTC) User Reset Length +#define AT91C_RSTC_BODIEN ((unsigned int) 0x1 << 16) // (RSTC) Brownout Detection Interrupt Enable + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Real Time Timer Controller Interface +// ***************************************************************************** +typedef struct _AT91S_RTTC { + AT91_REG RTTC_RTMR; // Real-time Mode Register + AT91_REG RTTC_RTAR; // Real-time Alarm Register + AT91_REG RTTC_RTVR; // Real-time Value Register + AT91_REG RTTC_RTSR; // Real-time Status Register +} AT91S_RTTC, *AT91PS_RTTC; + +// -------- RTTC_RTMR : (RTTC Offset: 0x0) Real-time Mode Register -------- +#define AT91C_RTTC_RTPRES ((unsigned int) 0xFFFF << 0) // (RTTC) Real-time Timer Prescaler Value +#define AT91C_RTTC_ALMIEN ((unsigned int) 0x1 << 16) // (RTTC) Alarm Interrupt Enable +#define AT91C_RTTC_RTTINCIEN ((unsigned int) 0x1 << 17) // (RTTC) Real Time Timer Increment Interrupt Enable +#define AT91C_RTTC_RTTRST ((unsigned int) 0x1 << 18) // (RTTC) Real Time Timer Restart +// -------- RTTC_RTAR : (RTTC Offset: 0x4) Real-time Alarm Register -------- +#define AT91C_RTTC_ALMV ((unsigned int) 0x0 << 0) // (RTTC) Alarm Value +// -------- RTTC_RTVR : (RTTC Offset: 0x8) Current Real-time Value Register -------- +#define AT91C_RTTC_CRTV ((unsigned int) 0x0 << 0) // (RTTC) Current Real-time Value +// -------- RTTC_RTSR : (RTTC Offset: 0xc) Real-time Status Register -------- +#define AT91C_RTTC_ALMS ((unsigned int) 0x1 << 0) // (RTTC) Real-time Alarm Status +#define AT91C_RTTC_RTTINC ((unsigned int) 0x1 << 1) // (RTTC) Real-time Timer Increment + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Periodic Interval Timer Controller Interface +// ***************************************************************************** +typedef struct _AT91S_PITC { + AT91_REG PITC_PIMR; // Period Interval Mode Register + AT91_REG PITC_PISR; // Period Interval Status Register + AT91_REG PITC_PIVR; // Period Interval Value Register + AT91_REG PITC_PIIR; // Period Interval Image Register +} AT91S_PITC, *AT91PS_PITC; + +// -------- PITC_PIMR : (PITC Offset: 0x0) Periodic Interval Mode Register -------- +#define AT91C_PITC_PIV ((unsigned int) 0xFFFFF << 0) // (PITC) Periodic Interval Value +#define AT91C_PITC_PITEN ((unsigned int) 0x1 << 24) // (PITC) Periodic Interval Timer Enabled +#define AT91C_PITC_PITIEN ((unsigned int) 0x1 << 25) // (PITC) Periodic Interval Timer Interrupt Enable +// -------- PITC_PISR : (PITC Offset: 0x4) Periodic Interval Status Register -------- +#define AT91C_PITC_PITS ((unsigned int) 0x1 << 0) // (PITC) Periodic Interval Timer Status +// -------- PITC_PIVR : (PITC Offset: 0x8) Periodic Interval Value Register -------- +#define AT91C_PITC_CPIV ((unsigned int) 0xFFFFF << 0) // (PITC) Current Periodic Interval Value +#define AT91C_PITC_PICNT ((unsigned int) 0xFFF << 20) // (PITC) Periodic Interval Counter +// -------- PITC_PIIR : (PITC Offset: 0xc) Periodic Interval Image Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Watchdog Timer Controller Interface +// ***************************************************************************** +typedef struct _AT91S_WDTC { + AT91_REG WDTC_WDCR; // Watchdog Control Register + AT91_REG WDTC_WDMR; // Watchdog Mode Register + AT91_REG WDTC_WDSR; // Watchdog Status Register +} AT91S_WDTC, *AT91PS_WDTC; + +// -------- WDTC_WDCR : (WDTC Offset: 0x0) Periodic Interval Image Register -------- +#define AT91C_WDTC_WDRSTT ((unsigned int) 0x1 << 0) // (WDTC) Watchdog Restart +#define AT91C_WDTC_KEY ((unsigned int) 0xFF << 24) // (WDTC) Watchdog KEY Password +// -------- WDTC_WDMR : (WDTC Offset: 0x4) Watchdog Mode Register -------- +#define AT91C_WDTC_WDV ((unsigned int) 0xFFF << 0) // (WDTC) Watchdog Timer Restart +#define AT91C_WDTC_WDFIEN ((unsigned int) 0x1 << 12) // (WDTC) Watchdog Fault Interrupt Enable +#define AT91C_WDTC_WDRSTEN ((unsigned int) 0x1 << 13) // (WDTC) Watchdog Reset Enable +#define AT91C_WDTC_WDRPROC ((unsigned int) 0x1 << 14) // (WDTC) Watchdog Timer Restart +#define AT91C_WDTC_WDDIS ((unsigned int) 0x1 << 15) // (WDTC) Watchdog Disable +#define AT91C_WDTC_WDD ((unsigned int) 0xFFF << 16) // (WDTC) Watchdog Delta Value +#define AT91C_WDTC_WDDBGHLT ((unsigned int) 0x1 << 28) // (WDTC) Watchdog Debug Halt +#define AT91C_WDTC_WDIDLEHLT ((unsigned int) 0x1 << 29) // (WDTC) Watchdog Idle Halt +// -------- WDTC_WDSR : (WDTC Offset: 0x8) Watchdog Status Register -------- +#define AT91C_WDTC_WDUNF ((unsigned int) 0x1 << 0) // (WDTC) Watchdog Underflow +#define AT91C_WDTC_WDERR ((unsigned int) 0x1 << 1) // (WDTC) Watchdog Error + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Voltage Regulator Mode Controller Interface +// ***************************************************************************** +typedef struct _AT91S_VREG { + AT91_REG VREG_MR; // Voltage Regulator Mode Register +} AT91S_VREG, *AT91PS_VREG; + +// -------- VREG_MR : (VREG Offset: 0x0) Voltage Regulator Mode Register -------- +#define AT91C_VREG_PSTDBY ((unsigned int) 0x1 << 0) // (VREG) Voltage Regulator Power Standby Mode + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Memory Controller Interface +// ***************************************************************************** +typedef struct _AT91S_MC { + AT91_REG MC_RCR; // MC Remap Control Register + AT91_REG MC_ASR; // MC Abort Status Register + AT91_REG MC_AASR; // MC Abort Address Status Register + AT91_REG Reserved0[21]; // + AT91_REG MC_FMR; // MC Flash Mode Register + AT91_REG MC_FCR; // MC Flash Command Register + AT91_REG MC_FSR; // MC Flash Status Register +} AT91S_MC, *AT91PS_MC; + +// -------- MC_RCR : (MC Offset: 0x0) MC Remap Control Register -------- +#define AT91C_MC_RCB ((unsigned int) 0x1 << 0) // (MC) Remap Command Bit +// -------- MC_ASR : (MC Offset: 0x4) MC Abort Status Register -------- +#define AT91C_MC_UNDADD ((unsigned int) 0x1 << 0) // (MC) Undefined Addess Abort Status +#define AT91C_MC_MISADD ((unsigned int) 0x1 << 1) // (MC) Misaligned Addess Abort Status +#define AT91C_MC_ABTSZ ((unsigned int) 0x3 << 8) // (MC) Abort Size Status +#define AT91C_MC_ABTSZ_BYTE ((unsigned int) 0x0 << 8) // (MC) Byte +#define AT91C_MC_ABTSZ_HWORD ((unsigned int) 0x1 << 8) // (MC) Half-word +#define AT91C_MC_ABTSZ_WORD ((unsigned int) 0x2 << 8) // (MC) Word +#define AT91C_MC_ABTTYP ((unsigned int) 0x3 << 10) // (MC) Abort Type Status +#define AT91C_MC_ABTTYP_DATAR ((unsigned int) 0x0 << 10) // (MC) Data Read +#define AT91C_MC_ABTTYP_DATAW ((unsigned int) 0x1 << 10) // (MC) Data Write +#define AT91C_MC_ABTTYP_FETCH ((unsigned int) 0x2 << 10) // (MC) Code Fetch +#define AT91C_MC_MST0 ((unsigned int) 0x1 << 16) // (MC) Master 0 Abort Source +#define AT91C_MC_MST1 ((unsigned int) 0x1 << 17) // (MC) Master 1 Abort Source +#define AT91C_MC_SVMST0 ((unsigned int) 0x1 << 24) // (MC) Saved Master 0 Abort Source +#define AT91C_MC_SVMST1 ((unsigned int) 0x1 << 25) // (MC) Saved Master 1 Abort Source +// -------- MC_FMR : (MC Offset: 0x60) MC Flash Mode Register -------- +#define AT91C_MC_FRDY ((unsigned int) 0x1 << 0) // (MC) Flash Ready +#define AT91C_MC_LOCKE ((unsigned int) 0x1 << 2) // (MC) Lock Error +#define AT91C_MC_PROGE ((unsigned int) 0x1 << 3) // (MC) Programming Error +#define AT91C_MC_NEBP ((unsigned int) 0x1 << 7) // (MC) No Erase Before Programming +#define AT91C_MC_FWS ((unsigned int) 0x3 << 8) // (MC) Flash Wait State +#define AT91C_MC_FWS_0FWS ((unsigned int) 0x0 << 8) // (MC) 1 cycle for Read, 2 for Write operations +#define AT91C_MC_FWS_1FWS ((unsigned int) 0x1 << 8) // (MC) 2 cycles for Read, 3 for Write operations +#define AT91C_MC_FWS_2FWS ((unsigned int) 0x2 << 8) // (MC) 3 cycles for Read, 4 for Write operations +#define AT91C_MC_FWS_3FWS ((unsigned int) 0x3 << 8) // (MC) 4 cycles for Read, 4 for Write operations +#define AT91C_MC_FMCN ((unsigned int) 0xFF << 16) // (MC) Flash Microsecond Cycle Number +// -------- MC_FCR : (MC Offset: 0x64) MC Flash Command Register -------- +#define AT91C_MC_FCMD ((unsigned int) 0xF << 0) // (MC) Flash Command +#define AT91C_MC_FCMD_START_PROG ((unsigned int) 0x1) // (MC) Starts the programming of th epage specified by PAGEN. +#define AT91C_MC_FCMD_LOCK ((unsigned int) 0x2) // (MC) Starts a lock sequence of the sector defined by the bits 4 to 7 of the field PAGEN. +#define AT91C_MC_FCMD_PROG_AND_LOCK ((unsigned int) 0x3) // (MC) The lock sequence automatically happens after the programming sequence is completed. +#define AT91C_MC_FCMD_UNLOCK ((unsigned int) 0x4) // (MC) Starts an unlock sequence of the sector defined by the bits 4 to 7 of the field PAGEN. +#define AT91C_MC_FCMD_ERASE_ALL ((unsigned int) 0x8) // (MC) Starts the erase of the entire flash.If at least a page is locked, the command is cancelled. +#define AT91C_MC_FCMD_SET_GP_NVM ((unsigned int) 0xB) // (MC) Set General Purpose NVM bits. +#define AT91C_MC_FCMD_CLR_GP_NVM ((unsigned int) 0xD) // (MC) Clear General Purpose NVM bits. +#define AT91C_MC_FCMD_SET_SECURITY ((unsigned int) 0xF) // (MC) Set Security Bit. +#define AT91C_MC_PAGEN ((unsigned int) 0x3FF << 8) // (MC) Page Number +#define AT91C_MC_KEY ((unsigned int) 0xFF << 24) // (MC) Writing Protect Key +// -------- MC_FSR : (MC Offset: 0x68) MC Flash Command Register -------- +#define AT91C_MC_SECURITY ((unsigned int) 0x1 << 4) // (MC) Security Bit Status +#define AT91C_MC_GPNVM0 ((unsigned int) 0x1 << 8) // (MC) Sector 0 Lock Status +#define AT91C_MC_GPNVM1 ((unsigned int) 0x1 << 9) // (MC) Sector 1 Lock Status +#define AT91C_MC_GPNVM2 ((unsigned int) 0x1 << 10) // (MC) Sector 2 Lock Status +#define AT91C_MC_GPNVM3 ((unsigned int) 0x1 << 11) // (MC) Sector 3 Lock Status +#define AT91C_MC_GPNVM4 ((unsigned int) 0x1 << 12) // (MC) Sector 4 Lock Status +#define AT91C_MC_GPNVM5 ((unsigned int) 0x1 << 13) // (MC) Sector 5 Lock Status +#define AT91C_MC_GPNVM6 ((unsigned int) 0x1 << 14) // (MC) Sector 6 Lock Status +#define AT91C_MC_GPNVM7 ((unsigned int) 0x1 << 15) // (MC) Sector 7 Lock Status +#define AT91C_MC_LOCKS0 ((unsigned int) 0x1 << 16) // (MC) Sector 0 Lock Status +#define AT91C_MC_LOCKS1 ((unsigned int) 0x1 << 17) // (MC) Sector 1 Lock Status +#define AT91C_MC_LOCKS2 ((unsigned int) 0x1 << 18) // (MC) Sector 2 Lock Status +#define AT91C_MC_LOCKS3 ((unsigned int) 0x1 << 19) // (MC) Sector 3 Lock Status +#define AT91C_MC_LOCKS4 ((unsigned int) 0x1 << 20) // (MC) Sector 4 Lock Status +#define AT91C_MC_LOCKS5 ((unsigned int) 0x1 << 21) // (MC) Sector 5 Lock Status +#define AT91C_MC_LOCKS6 ((unsigned int) 0x1 << 22) // (MC) Sector 6 Lock Status +#define AT91C_MC_LOCKS7 ((unsigned int) 0x1 << 23) // (MC) Sector 7 Lock Status +#define AT91C_MC_LOCKS8 ((unsigned int) 0x1 << 24) // (MC) Sector 8 Lock Status +#define AT91C_MC_LOCKS9 ((unsigned int) 0x1 << 25) // (MC) Sector 9 Lock Status +#define AT91C_MC_LOCKS10 ((unsigned int) 0x1 << 26) // (MC) Sector 10 Lock Status +#define AT91C_MC_LOCKS11 ((unsigned int) 0x1 << 27) // (MC) Sector 11 Lock Status +#define AT91C_MC_LOCKS12 ((unsigned int) 0x1 << 28) // (MC) Sector 12 Lock Status +#define AT91C_MC_LOCKS13 ((unsigned int) 0x1 << 29) // (MC) Sector 13 Lock Status +#define AT91C_MC_LOCKS14 ((unsigned int) 0x1 << 30) // (MC) Sector 14 Lock Status +#define AT91C_MC_LOCKS15 ((unsigned int) 0x1 << 31) // (MC) Sector 15 Lock Status + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Serial Parallel Interface +// ***************************************************************************** +typedef struct _AT91S_SPI { + AT91_REG SPI_CR; // Control Register + AT91_REG SPI_MR; // Mode Register + AT91_REG SPI_RDR; // Receive Data Register + AT91_REG SPI_TDR; // Transmit Data Register + AT91_REG SPI_SR; // Status Register + AT91_REG SPI_IER; // Interrupt Enable Register + AT91_REG SPI_IDR; // Interrupt Disable Register + AT91_REG SPI_IMR; // Interrupt Mask Register + AT91_REG Reserved0[4]; // + AT91_REG SPI_CSR[4]; // Chip Select Register + AT91_REG Reserved1[48]; // + AT91_REG SPI_RPR; // Receive Pointer Register + AT91_REG SPI_RCR; // Receive Counter Register + AT91_REG SPI_TPR; // Transmit Pointer Register + AT91_REG SPI_TCR; // Transmit Counter Register + AT91_REG SPI_RNPR; // Receive Next Pointer Register + AT91_REG SPI_RNCR; // Receive Next Counter Register + AT91_REG SPI_TNPR; // Transmit Next Pointer Register + AT91_REG SPI_TNCR; // Transmit Next Counter Register + AT91_REG SPI_PTCR; // PDC Transfer Control Register + AT91_REG SPI_PTSR; // PDC Transfer Status Register +} AT91S_SPI, *AT91PS_SPI; + +// -------- SPI_CR : (SPI Offset: 0x0) SPI Control Register -------- +#define AT91C_SPI_SPIEN ((unsigned int) 0x1 << 0) // (SPI) SPI Enable +#define AT91C_SPI_SPIDIS ((unsigned int) 0x1 << 1) // (SPI) SPI Disable +#define AT91C_SPI_SWRST ((unsigned int) 0x1 << 7) // (SPI) SPI Software reset +#define AT91C_SPI_LASTXFER ((unsigned int) 0x1 << 24) // (SPI) SPI Last Transfer +// -------- SPI_MR : (SPI Offset: 0x4) SPI Mode Register -------- +#define AT91C_SPI_MSTR ((unsigned int) 0x1 << 0) // (SPI) Master/Slave Mode +#define AT91C_SPI_PS ((unsigned int) 0x1 << 1) // (SPI) Peripheral Select +#define AT91C_SPI_PS_FIXED ((unsigned int) 0x0 << 1) // (SPI) Fixed Peripheral Select +#define AT91C_SPI_PS_VARIABLE ((unsigned int) 0x1 << 1) // (SPI) Variable Peripheral Select +#define AT91C_SPI_PCSDEC ((unsigned int) 0x1 << 2) // (SPI) Chip Select Decode +#define AT91C_SPI_FDIV ((unsigned int) 0x1 << 3) // (SPI) Clock Selection +#define AT91C_SPI_MODFDIS ((unsigned int) 0x1 << 4) // (SPI) Mode Fault Detection +#define AT91C_SPI_LLB ((unsigned int) 0x1 << 7) // (SPI) Clock Selection +#define AT91C_SPI_PCS ((unsigned int) 0xF << 16) // (SPI) Peripheral Chip Select +#define AT91C_SPI_DLYBCS ((unsigned int) 0xFF << 24) // (SPI) Delay Between Chip Selects +// -------- SPI_RDR : (SPI Offset: 0x8) Receive Data Register -------- +#define AT91C_SPI_RD ((unsigned int) 0xFFFF << 0) // (SPI) Receive Data +#define AT91C_SPI_RPCS ((unsigned int) 0xF << 16) // (SPI) Peripheral Chip Select Status +// -------- SPI_TDR : (SPI Offset: 0xc) Transmit Data Register -------- +#define AT91C_SPI_TD ((unsigned int) 0xFFFF << 0) // (SPI) Transmit Data +#define AT91C_SPI_TPCS ((unsigned int) 0xF << 16) // (SPI) Peripheral Chip Select Status +// -------- SPI_SR : (SPI Offset: 0x10) Status Register -------- +#define AT91C_SPI_RDRF ((unsigned int) 0x1 << 0) // (SPI) Receive Data Register Full +#define AT91C_SPI_TDRE ((unsigned int) 0x1 << 1) // (SPI) Transmit Data Register Empty +#define AT91C_SPI_MODF ((unsigned int) 0x1 << 2) // (SPI) Mode Fault Error +#define AT91C_SPI_OVRES ((unsigned int) 0x1 << 3) // (SPI) Overrun Error Status +#define AT91C_SPI_ENDRX ((unsigned int) 0x1 << 4) // (SPI) End of Receiver Transfer +#define AT91C_SPI_ENDTX ((unsigned int) 0x1 << 5) // (SPI) End of Receiver Transfer +#define AT91C_SPI_RXBUFF ((unsigned int) 0x1 << 6) // (SPI) RXBUFF Interrupt +#define AT91C_SPI_TXBUFE ((unsigned int) 0x1 << 7) // (SPI) TXBUFE Interrupt +#define AT91C_SPI_NSSR ((unsigned int) 0x1 << 8) // (SPI) NSSR Interrupt +#define AT91C_SPI_TXEMPTY ((unsigned int) 0x1 << 9) // (SPI) TXEMPTY Interrupt +#define AT91C_SPI_SPIENS ((unsigned int) 0x1 << 16) // (SPI) Enable Status +// -------- SPI_IER : (SPI Offset: 0x14) Interrupt Enable Register -------- +// -------- SPI_IDR : (SPI Offset: 0x18) Interrupt Disable Register -------- +// -------- SPI_IMR : (SPI Offset: 0x1c) Interrupt Mask Register -------- +// -------- SPI_CSR : (SPI Offset: 0x30) Chip Select Register -------- +#define AT91C_SPI_CPOL ((unsigned int) 0x1 << 0) // (SPI) Clock Polarity +#define AT91C_SPI_NCPHA ((unsigned int) 0x1 << 1) // (SPI) Clock Phase +#define AT91C_SPI_CSAAT ((unsigned int) 0x1 << 3) // (SPI) Chip Select Active After Transfer +#define AT91C_SPI_BITS ((unsigned int) 0xF << 4) // (SPI) Bits Per Transfer +#define AT91C_SPI_BITS_8 ((unsigned int) 0x0 << 4) // (SPI) 8 Bits Per transfer +#define AT91C_SPI_BITS_9 ((unsigned int) 0x1 << 4) // (SPI) 9 Bits Per transfer +#define AT91C_SPI_BITS_10 ((unsigned int) 0x2 << 4) // (SPI) 10 Bits Per transfer +#define AT91C_SPI_BITS_11 ((unsigned int) 0x3 << 4) // (SPI) 11 Bits Per transfer +#define AT91C_SPI_BITS_12 ((unsigned int) 0x4 << 4) // (SPI) 12 Bits Per transfer +#define AT91C_SPI_BITS_13 ((unsigned int) 0x5 << 4) // (SPI) 13 Bits Per transfer +#define AT91C_SPI_BITS_14 ((unsigned int) 0x6 << 4) // (SPI) 14 Bits Per transfer +#define AT91C_SPI_BITS_15 ((unsigned int) 0x7 << 4) // (SPI) 15 Bits Per transfer +#define AT91C_SPI_BITS_16 ((unsigned int) 0x8 << 4) // (SPI) 16 Bits Per transfer +#define AT91C_SPI_SCBR ((unsigned int) 0xFF << 8) // (SPI) Serial Clock Baud Rate +#define AT91C_SPI_DLYBS ((unsigned int) 0xFF << 16) // (SPI) Delay Before SPCK +#define AT91C_SPI_DLYBCT ((unsigned int) 0xFF << 24) // (SPI) Delay Between Consecutive Transfers + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Usart +// ***************************************************************************** +typedef struct _AT91S_USART { + AT91_REG US_CR; // Control Register + AT91_REG US_MR; // Mode Register + AT91_REG US_IER; // Interrupt Enable Register + AT91_REG US_IDR; // Interrupt Disable Register + AT91_REG US_IMR; // Interrupt Mask Register + AT91_REG US_CSR; // Channel Status Register + AT91_REG US_RHR; // Receiver Holding Register + AT91_REG US_THR; // Transmitter Holding Register + AT91_REG US_BRGR; // Baud Rate Generator Register + AT91_REG US_RTOR; // Receiver Time-out Register + AT91_REG US_TTGR; // Transmitter Time-guard Register + AT91_REG Reserved0[5]; // + AT91_REG US_FIDI; // FI_DI_Ratio Register + AT91_REG US_NER; // Nb Errors Register + AT91_REG Reserved1[1]; // + AT91_REG US_IF; // IRDA_FILTER Register + AT91_REG Reserved2[44]; // + AT91_REG US_RPR; // Receive Pointer Register + AT91_REG US_RCR; // Receive Counter Register + AT91_REG US_TPR; // Transmit Pointer Register + AT91_REG US_TCR; // Transmit Counter Register + AT91_REG US_RNPR; // Receive Next Pointer Register + AT91_REG US_RNCR; // Receive Next Counter Register + AT91_REG US_TNPR; // Transmit Next Pointer Register + AT91_REG US_TNCR; // Transmit Next Counter Register + AT91_REG US_PTCR; // PDC Transfer Control Register + AT91_REG US_PTSR; // PDC Transfer Status Register +} AT91S_USART, *AT91PS_USART; + +// -------- US_CR : (USART Offset: 0x0) Debug Unit Control Register -------- +#define AT91C_US_STTBRK ((unsigned int) 0x1 << 9) // (USART) Start Break +#define AT91C_US_STPBRK ((unsigned int) 0x1 << 10) // (USART) Stop Break +#define AT91C_US_STTTO ((unsigned int) 0x1 << 11) // (USART) Start Time-out +#define AT91C_US_SENDA ((unsigned int) 0x1 << 12) // (USART) Send Address +#define AT91C_US_RSTIT ((unsigned int) 0x1 << 13) // (USART) Reset Iterations +#define AT91C_US_RSTNACK ((unsigned int) 0x1 << 14) // (USART) Reset Non Acknowledge +#define AT91C_US_RETTO ((unsigned int) 0x1 << 15) // (USART) Rearm Time-out +#define AT91C_US_DTREN ((unsigned int) 0x1 << 16) // (USART) Data Terminal ready Enable +#define AT91C_US_DTRDIS ((unsigned int) 0x1 << 17) // (USART) Data Terminal ready Disable +#define AT91C_US_RTSEN ((unsigned int) 0x1 << 18) // (USART) Request to Send enable +#define AT91C_US_RTSDIS ((unsigned int) 0x1 << 19) // (USART) Request to Send Disable +// -------- US_MR : (USART Offset: 0x4) Debug Unit Mode Register -------- +#define AT91C_US_USMODE ((unsigned int) 0xF << 0) // (USART) Usart mode +#define AT91C_US_USMODE_NORMAL ((unsigned int) 0x0) // (USART) Normal +#define AT91C_US_USMODE_RS485 ((unsigned int) 0x1) // (USART) RS485 +#define AT91C_US_USMODE_HWHSH ((unsigned int) 0x2) // (USART) Hardware Handshaking +#define AT91C_US_USMODE_MODEM ((unsigned int) 0x3) // (USART) Modem +#define AT91C_US_USMODE_ISO7816_0 ((unsigned int) 0x4) // (USART) ISO7816 protocol: T = 0 +#define AT91C_US_USMODE_ISO7816_1 ((unsigned int) 0x6) // (USART) ISO7816 protocol: T = 1 +#define AT91C_US_USMODE_IRDA ((unsigned int) 0x8) // (USART) IrDA +#define AT91C_US_USMODE_SWHSH ((unsigned int) 0xC) // (USART) Software Handshaking +#define AT91C_US_CLKS ((unsigned int) 0x3 << 4) // (USART) Clock Selection (Baud Rate generator Input Clock +#define AT91C_US_CLKS_CLOCK ((unsigned int) 0x0 << 4) // (USART) Clock +#define AT91C_US_CLKS_FDIV1 ((unsigned int) 0x1 << 4) // (USART) fdiv1 +#define AT91C_US_CLKS_SLOW ((unsigned int) 0x2 << 4) // (USART) slow_clock (ARM) +#define AT91C_US_CLKS_EXT ((unsigned int) 0x3 << 4) // (USART) External (SCK) +#define AT91C_US_CHRL ((unsigned int) 0x3 << 6) // (USART) Clock Selection (Baud Rate generator Input Clock +#define AT91C_US_CHRL_5_BITS ((unsigned int) 0x0 << 6) // (USART) Character Length: 5 bits +#define AT91C_US_CHRL_6_BITS ((unsigned int) 0x1 << 6) // (USART) Character Length: 6 bits +#define AT91C_US_CHRL_7_BITS ((unsigned int) 0x2 << 6) // (USART) Character Length: 7 bits +#define AT91C_US_CHRL_8_BITS ((unsigned int) 0x3 << 6) // (USART) Character Length: 8 bits +#define AT91C_US_SYNC ((unsigned int) 0x1 << 8) // (USART) Synchronous Mode Select +#define AT91C_US_NBSTOP ((unsigned int) 0x3 << 12) // (USART) Number of Stop bits +#define AT91C_US_NBSTOP_1_BIT ((unsigned int) 0x0 << 12) // (USART) 1 stop bit +#define AT91C_US_NBSTOP_15_BIT ((unsigned int) 0x1 << 12) // (USART) Asynchronous (SYNC=0) 2 stop bits Synchronous (SYNC=1) 2 stop bits +#define AT91C_US_NBSTOP_2_BIT ((unsigned int) 0x2 << 12) // (USART) 2 stop bits +#define AT91C_US_MSBF ((unsigned int) 0x1 << 16) // (USART) Bit Order +#define AT91C_US_MODE9 ((unsigned int) 0x1 << 17) // (USART) 9-bit Character length +#define AT91C_US_CKLO ((unsigned int) 0x1 << 18) // (USART) Clock Output Select +#define AT91C_US_OVER ((unsigned int) 0x1 << 19) // (USART) Over Sampling Mode +#define AT91C_US_INACK ((unsigned int) 0x1 << 20) // (USART) Inhibit Non Acknowledge +#define AT91C_US_DSNACK ((unsigned int) 0x1 << 21) // (USART) Disable Successive NACK +#define AT91C_US_MAX_ITER ((unsigned int) 0x1 << 24) // (USART) Number of Repetitions +#define AT91C_US_FILTER ((unsigned int) 0x1 << 28) // (USART) Receive Line Filter +// -------- US_IER : (USART Offset: 0x8) Debug Unit Interrupt Enable Register -------- +#define AT91C_US_RXBRK ((unsigned int) 0x1 << 2) // (USART) Break Received/End of Break +#define AT91C_US_TIMEOUT ((unsigned int) 0x1 << 8) // (USART) Receiver Time-out +#define AT91C_US_ITERATION ((unsigned int) 0x1 << 10) // (USART) Max number of Repetitions Reached +#define AT91C_US_NACK ((unsigned int) 0x1 << 13) // (USART) Non Acknowledge +#define AT91C_US_RIIC ((unsigned int) 0x1 << 16) // (USART) Ring INdicator Input Change Flag +#define AT91C_US_DSRIC ((unsigned int) 0x1 << 17) // (USART) Data Set Ready Input Change Flag +#define AT91C_US_DCDIC ((unsigned int) 0x1 << 18) // (USART) Data Carrier Flag +#define AT91C_US_CTSIC ((unsigned int) 0x1 << 19) // (USART) Clear To Send Input Change Flag +// -------- US_IDR : (USART Offset: 0xc) Debug Unit Interrupt Disable Register -------- +// -------- US_IMR : (USART Offset: 0x10) Debug Unit Interrupt Mask Register -------- +// -------- US_CSR : (USART Offset: 0x14) Debug Unit Channel Status Register -------- +#define AT91C_US_RI ((unsigned int) 0x1 << 20) // (USART) Image of RI Input +#define AT91C_US_DSR ((unsigned int) 0x1 << 21) // (USART) Image of DSR Input +#define AT91C_US_DCD ((unsigned int) 0x1 << 22) // (USART) Image of DCD Input +#define AT91C_US_CTS ((unsigned int) 0x1 << 23) // (USART) Image of CTS Input + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Synchronous Serial Controller Interface +// ***************************************************************************** +typedef struct _AT91S_SSC { + AT91_REG SSC_CR; // Control Register + AT91_REG SSC_CMR; // Clock Mode Register + AT91_REG Reserved0[2]; // + AT91_REG SSC_RCMR; // Receive Clock ModeRegister + AT91_REG SSC_RFMR; // Receive Frame Mode Register + AT91_REG SSC_TCMR; // Transmit Clock Mode Register + AT91_REG SSC_TFMR; // Transmit Frame Mode Register + AT91_REG SSC_RHR; // Receive Holding Register + AT91_REG SSC_THR; // Transmit Holding Register + AT91_REG Reserved1[2]; // + AT91_REG SSC_RSHR; // Receive Sync Holding Register + AT91_REG SSC_TSHR; // Transmit Sync Holding Register + AT91_REG Reserved2[2]; // + AT91_REG SSC_SR; // Status Register + AT91_REG SSC_IER; // Interrupt Enable Register + AT91_REG SSC_IDR; // Interrupt Disable Register + AT91_REG SSC_IMR; // Interrupt Mask Register + AT91_REG Reserved3[44]; // + AT91_REG SSC_RPR; // Receive Pointer Register + AT91_REG SSC_RCR; // Receive Counter Register + AT91_REG SSC_TPR; // Transmit Pointer Register + AT91_REG SSC_TCR; // Transmit Counter Register + AT91_REG SSC_RNPR; // Receive Next Pointer Register + AT91_REG SSC_RNCR; // Receive Next Counter Register + AT91_REG SSC_TNPR; // Transmit Next Pointer Register + AT91_REG SSC_TNCR; // Transmit Next Counter Register + AT91_REG SSC_PTCR; // PDC Transfer Control Register + AT91_REG SSC_PTSR; // PDC Transfer Status Register +} AT91S_SSC, *AT91PS_SSC; + +// -------- SSC_CR : (SSC Offset: 0x0) SSC Control Register -------- +#define AT91C_SSC_RXEN ((unsigned int) 0x1 << 0) // (SSC) Receive Enable +#define AT91C_SSC_RXDIS ((unsigned int) 0x1 << 1) // (SSC) Receive Disable +#define AT91C_SSC_TXEN ((unsigned int) 0x1 << 8) // (SSC) Transmit Enable +#define AT91C_SSC_TXDIS ((unsigned int) 0x1 << 9) // (SSC) Transmit Disable +#define AT91C_SSC_SWRST ((unsigned int) 0x1 << 15) // (SSC) Software Reset +// -------- SSC_RCMR : (SSC Offset: 0x10) SSC Receive Clock Mode Register -------- +#define AT91C_SSC_CKS ((unsigned int) 0x3 << 0) // (SSC) Receive/Transmit Clock Selection +#define AT91C_SSC_CKS_DIV ((unsigned int) 0x0) // (SSC) Divided Clock +#define AT91C_SSC_CKS_TK ((unsigned int) 0x1) // (SSC) TK Clock signal +#define AT91C_SSC_CKS_RK ((unsigned int) 0x2) // (SSC) RK pin +#define AT91C_SSC_CKO ((unsigned int) 0x7 << 2) // (SSC) Receive/Transmit Clock Output Mode Selection +#define AT91C_SSC_CKO_NONE ((unsigned int) 0x0 << 2) // (SSC) Receive/Transmit Clock Output Mode: None RK pin: Input-only +#define AT91C_SSC_CKO_CONTINOUS ((unsigned int) 0x1 << 2) // (SSC) Continuous Receive/Transmit Clock RK pin: Output +#define AT91C_SSC_CKO_DATA_TX ((unsigned int) 0x2 << 2) // (SSC) Receive/Transmit Clock only during data transfers RK pin: Output +#define AT91C_SSC_CKI ((unsigned int) 0x1 << 5) // (SSC) Receive/Transmit Clock Inversion +#define AT91C_SSC_CKG ((unsigned int) 0x3 << 6) // (SSC) Receive/Transmit Clock Gating Selection +#define AT91C_SSC_CKG_NONE ((unsigned int) 0x0 << 6) // (SSC) Receive/Transmit Clock Gating: None, continuous clock +#define AT91C_SSC_CKG_LOW ((unsigned int) 0x1 << 6) // (SSC) Receive/Transmit Clock enabled only if RF Low +#define AT91C_SSC_CKG_HIGH ((unsigned int) 0x2 << 6) // (SSC) Receive/Transmit Clock enabled only if RF High +#define AT91C_SSC_START ((unsigned int) 0xF << 8) // (SSC) Receive/Transmit Start Selection +#define AT91C_SSC_START_CONTINOUS ((unsigned int) 0x0 << 8) // (SSC) Continuous, as soon as the receiver is enabled, and immediately after the end of transfer of the previous data. +#define AT91C_SSC_START_TX ((unsigned int) 0x1 << 8) // (SSC) Transmit/Receive start +#define AT91C_SSC_START_LOW_RF ((unsigned int) 0x2 << 8) // (SSC) Detection of a low level on RF input +#define AT91C_SSC_START_HIGH_RF ((unsigned int) 0x3 << 8) // (SSC) Detection of a high level on RF input +#define AT91C_SSC_START_FALL_RF ((unsigned int) 0x4 << 8) // (SSC) Detection of a falling edge on RF input +#define AT91C_SSC_START_RISE_RF ((unsigned int) 0x5 << 8) // (SSC) Detection of a rising edge on RF input +#define AT91C_SSC_START_LEVEL_RF ((unsigned int) 0x6 << 8) // (SSC) Detection of any level change on RF input +#define AT91C_SSC_START_EDGE_RF ((unsigned int) 0x7 << 8) // (SSC) Detection of any edge on RF input +#define AT91C_SSC_START_0 ((unsigned int) 0x8 << 8) // (SSC) Compare 0 +#define AT91C_SSC_STOP ((unsigned int) 0x1 << 12) // (SSC) Receive Stop Selection +#define AT91C_SSC_STTDLY ((unsigned int) 0xFF << 16) // (SSC) Receive/Transmit Start Delay +#define AT91C_SSC_PERIOD ((unsigned int) 0xFF << 24) // (SSC) Receive/Transmit Period Divider Selection +// -------- SSC_RFMR : (SSC Offset: 0x14) SSC Receive Frame Mode Register -------- +#define AT91C_SSC_DATLEN ((unsigned int) 0x1F << 0) // (SSC) Data Length +#define AT91C_SSC_LOOP ((unsigned int) 0x1 << 5) // (SSC) Loop Mode +#define AT91C_SSC_MSBF ((unsigned int) 0x1 << 7) // (SSC) Most Significant Bit First +#define AT91C_SSC_DATNB ((unsigned int) 0xF << 8) // (SSC) Data Number per Frame +#define AT91C_SSC_FSLEN ((unsigned int) 0xF << 16) // (SSC) Receive/Transmit Frame Sync length +#define AT91C_SSC_FSOS ((unsigned int) 0x7 << 20) // (SSC) Receive/Transmit Frame Sync Output Selection +#define AT91C_SSC_FSOS_NONE ((unsigned int) 0x0 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: None RK pin Input-only +#define AT91C_SSC_FSOS_NEGATIVE ((unsigned int) 0x1 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Negative Pulse +#define AT91C_SSC_FSOS_POSITIVE ((unsigned int) 0x2 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Positive Pulse +#define AT91C_SSC_FSOS_LOW ((unsigned int) 0x3 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Driver Low during data transfer +#define AT91C_SSC_FSOS_HIGH ((unsigned int) 0x4 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Driver High during data transfer +#define AT91C_SSC_FSOS_TOGGLE ((unsigned int) 0x5 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Toggling at each start of data transfer +#define AT91C_SSC_FSEDGE ((unsigned int) 0x1 << 24) // (SSC) Frame Sync Edge Detection +// -------- SSC_TCMR : (SSC Offset: 0x18) SSC Transmit Clock Mode Register -------- +// -------- SSC_TFMR : (SSC Offset: 0x1c) SSC Transmit Frame Mode Register -------- +#define AT91C_SSC_DATDEF ((unsigned int) 0x1 << 5) // (SSC) Data Default Value +#define AT91C_SSC_FSDEN ((unsigned int) 0x1 << 23) // (SSC) Frame Sync Data Enable +// -------- SSC_SR : (SSC Offset: 0x40) SSC Status Register -------- +#define AT91C_SSC_TXRDY ((unsigned int) 0x1 << 0) // (SSC) Transmit Ready +#define AT91C_SSC_TXEMPTY ((unsigned int) 0x1 << 1) // (SSC) Transmit Empty +#define AT91C_SSC_ENDTX ((unsigned int) 0x1 << 2) // (SSC) End Of Transmission +#define AT91C_SSC_TXBUFE ((unsigned int) 0x1 << 3) // (SSC) Transmit Buffer Empty +#define AT91C_SSC_RXRDY ((unsigned int) 0x1 << 4) // (SSC) Receive Ready +#define AT91C_SSC_OVRUN ((unsigned int) 0x1 << 5) // (SSC) Receive Overrun +#define AT91C_SSC_ENDRX ((unsigned int) 0x1 << 6) // (SSC) End of Reception +#define AT91C_SSC_RXBUFF ((unsigned int) 0x1 << 7) // (SSC) Receive Buffer Full +#define AT91C_SSC_CP0 ((unsigned int) 0x1 << 8) // (SSC) Compare 0 +#define AT91C_SSC_CP1 ((unsigned int) 0x1 << 9) // (SSC) Compare 1 +#define AT91C_SSC_TXSYN ((unsigned int) 0x1 << 10) // (SSC) Transmit Sync +#define AT91C_SSC_RXSYN ((unsigned int) 0x1 << 11) // (SSC) Receive Sync +#define AT91C_SSC_TXENA ((unsigned int) 0x1 << 16) // (SSC) Transmit Enable +#define AT91C_SSC_RXENA ((unsigned int) 0x1 << 17) // (SSC) Receive Enable +// -------- SSC_IER : (SSC Offset: 0x44) SSC Interrupt Enable Register -------- +// -------- SSC_IDR : (SSC Offset: 0x48) SSC Interrupt Disable Register -------- +// -------- SSC_IMR : (SSC Offset: 0x4c) SSC Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Two-wire Interface +// ***************************************************************************** +typedef struct _AT91S_TWI { + AT91_REG TWI_CR; // Control Register + AT91_REG TWI_MMR; // Master Mode Register + AT91_REG Reserved0[1]; // + AT91_REG TWI_IADR; // Internal Address Register + AT91_REG TWI_CWGR; // Clock Waveform Generator Register + AT91_REG Reserved1[3]; // + AT91_REG TWI_SR; // Status Register + AT91_REG TWI_IER; // Interrupt Enable Register + AT91_REG TWI_IDR; // Interrupt Disable Register + AT91_REG TWI_IMR; // Interrupt Mask Register + AT91_REG TWI_RHR; // Receive Holding Register + AT91_REG TWI_THR; // Transmit Holding Register +} AT91S_TWI, *AT91PS_TWI; + +// -------- TWI_CR : (TWI Offset: 0x0) TWI Control Register -------- +#define AT91C_TWI_START ((unsigned int) 0x1 << 0) // (TWI) Send a START Condition +#define AT91C_TWI_STOP ((unsigned int) 0x1 << 1) // (TWI) Send a STOP Condition +#define AT91C_TWI_MSEN ((unsigned int) 0x1 << 2) // (TWI) TWI Master Transfer Enabled +#define AT91C_TWI_MSDIS ((unsigned int) 0x1 << 3) // (TWI) TWI Master Transfer Disabled +#define AT91C_TWI_SWRST ((unsigned int) 0x1 << 7) // (TWI) Software Reset +// -------- TWI_MMR : (TWI Offset: 0x4) TWI Master Mode Register -------- +#define AT91C_TWI_IADRSZ ((unsigned int) 0x3 << 8) // (TWI) Internal Device Address Size +#define AT91C_TWI_IADRSZ_NO ((unsigned int) 0x0 << 8) // (TWI) No internal device address +#define AT91C_TWI_IADRSZ_1_BYTE ((unsigned int) 0x1 << 8) // (TWI) One-byte internal device address +#define AT91C_TWI_IADRSZ_2_BYTE ((unsigned int) 0x2 << 8) // (TWI) Two-byte internal device address +#define AT91C_TWI_IADRSZ_3_BYTE ((unsigned int) 0x3 << 8) // (TWI) Three-byte internal device address +#define AT91C_TWI_MREAD ((unsigned int) 0x1 << 12) // (TWI) Master Read Direction +#define AT91C_TWI_DADR ((unsigned int) 0x7F << 16) // (TWI) Device Address +// -------- TWI_CWGR : (TWI Offset: 0x10) TWI Clock Waveform Generator Register -------- +#define AT91C_TWI_CLDIV ((unsigned int) 0xFF << 0) // (TWI) Clock Low Divider +#define AT91C_TWI_CHDIV ((unsigned int) 0xFF << 8) // (TWI) Clock High Divider +#define AT91C_TWI_CKDIV ((unsigned int) 0x7 << 16) // (TWI) Clock Divider +// -------- TWI_SR : (TWI Offset: 0x20) TWI Status Register -------- +#define AT91C_TWI_TXCOMP ((unsigned int) 0x1 << 0) // (TWI) Transmission Completed +#define AT91C_TWI_RXRDY ((unsigned int) 0x1 << 1) // (TWI) Receive holding register ReaDY +#define AT91C_TWI_TXRDY ((unsigned int) 0x1 << 2) // (TWI) Transmit holding register ReaDY +#define AT91C_TWI_OVRE ((unsigned int) 0x1 << 6) // (TWI) Overrun Error +#define AT91C_TWI_UNRE ((unsigned int) 0x1 << 7) // (TWI) Underrun Error +#define AT91C_TWI_NACK ((unsigned int) 0x1 << 8) // (TWI) Not Acknowledged +// -------- TWI_IER : (TWI Offset: 0x24) TWI Interrupt Enable Register -------- +// -------- TWI_IDR : (TWI Offset: 0x28) TWI Interrupt Disable Register -------- +// -------- TWI_IMR : (TWI Offset: 0x2c) TWI Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR PWMC Channel Interface +// ***************************************************************************** +typedef struct _AT91S_PWMC_CH { + AT91_REG PWMC_CMR; // Channel Mode Register + AT91_REG PWMC_CDTYR; // Channel Duty Cycle Register + AT91_REG PWMC_CPRDR; // Channel Period Register + AT91_REG PWMC_CCNTR; // Channel Counter Register + AT91_REG PWMC_CUPDR; // Channel Update Register + AT91_REG PWMC_Reserved[3]; // Reserved +} AT91S_PWMC_CH, *AT91PS_PWMC_CH; + +// -------- PWMC_CMR : (PWMC_CH Offset: 0x0) PWMC Channel Mode Register -------- +#define AT91C_PWMC_CPRE ((unsigned int) 0xF << 0) // (PWMC_CH) Channel Pre-scaler : PWMC_CLKx +#define AT91C_PWMC_CPRE_MCK ((unsigned int) 0x0) // (PWMC_CH) +#define AT91C_PWMC_CPRE_MCKA ((unsigned int) 0xB) // (PWMC_CH) +#define AT91C_PWMC_CPRE_MCKB ((unsigned int) 0xC) // (PWMC_CH) +#define AT91C_PWMC_CALG ((unsigned int) 0x1 << 8) // (PWMC_CH) Channel Alignment +#define AT91C_PWMC_CPOL ((unsigned int) 0x1 << 9) // (PWMC_CH) Channel Polarity +#define AT91C_PWMC_CPD ((unsigned int) 0x1 << 10) // (PWMC_CH) Channel Update Period +// -------- PWMC_CDTYR : (PWMC_CH Offset: 0x4) PWMC Channel Duty Cycle Register -------- +#define AT91C_PWMC_CDTY ((unsigned int) 0x0 << 0) // (PWMC_CH) Channel Duty Cycle +// -------- PWMC_CPRDR : (PWMC_CH Offset: 0x8) PWMC Channel Period Register -------- +#define AT91C_PWMC_CPRD ((unsigned int) 0x0 << 0) // (PWMC_CH) Channel Period +// -------- PWMC_CCNTR : (PWMC_CH Offset: 0xc) PWMC Channel Counter Register -------- +#define AT91C_PWMC_CCNT ((unsigned int) 0x0 << 0) // (PWMC_CH) Channel Counter +// -------- PWMC_CUPDR : (PWMC_CH Offset: 0x10) PWMC Channel Update Register -------- +#define AT91C_PWMC_CUPD ((unsigned int) 0x0 << 0) // (PWMC_CH) Channel Update + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Pulse Width Modulation Controller Interface +// ***************************************************************************** +typedef struct _AT91S_PWMC { + AT91_REG PWMC_MR; // PWMC Mode Register + AT91_REG PWMC_ENA; // PWMC Enable Register + AT91_REG PWMC_DIS; // PWMC Disable Register + AT91_REG PWMC_SR; // PWMC Status Register + AT91_REG PWMC_IER; // PWMC Interrupt Enable Register + AT91_REG PWMC_IDR; // PWMC Interrupt Disable Register + AT91_REG PWMC_IMR; // PWMC Interrupt Mask Register + AT91_REG PWMC_ISR; // PWMC Interrupt Status Register + AT91_REG Reserved0[55]; // + AT91_REG PWMC_VR; // PWMC Version Register + AT91_REG Reserved1[64]; // + AT91S_PWMC_CH PWMC_CH[4]; // PWMC Channel +} AT91S_PWMC, *AT91PS_PWMC; + +// -------- PWMC_MR : (PWMC Offset: 0x0) PWMC Mode Register -------- +#define AT91C_PWMC_DIVA ((unsigned int) 0xFF << 0) // (PWMC) CLKA divide factor. +#define AT91C_PWMC_PREA ((unsigned int) 0xF << 8) // (PWMC) Divider Input Clock Prescaler A +#define AT91C_PWMC_PREA_MCK ((unsigned int) 0x0 << 8) // (PWMC) +#define AT91C_PWMC_DIVB ((unsigned int) 0xFF << 16) // (PWMC) CLKB divide factor. +#define AT91C_PWMC_PREB ((unsigned int) 0xF << 24) // (PWMC) Divider Input Clock Prescaler B +#define AT91C_PWMC_PREB_MCK ((unsigned int) 0x0 << 24) // (PWMC) +// -------- PWMC_ENA : (PWMC Offset: 0x4) PWMC Enable Register -------- +#define AT91C_PWMC_CHID0 ((unsigned int) 0x1 << 0) // (PWMC) Channel ID 0 +#define AT91C_PWMC_CHID1 ((unsigned int) 0x1 << 1) // (PWMC) Channel ID 1 +#define AT91C_PWMC_CHID2 ((unsigned int) 0x1 << 2) // (PWMC) Channel ID 2 +#define AT91C_PWMC_CHID3 ((unsigned int) 0x1 << 3) // (PWMC) Channel ID 3 +// -------- PWMC_DIS : (PWMC Offset: 0x8) PWMC Disable Register -------- +// -------- PWMC_SR : (PWMC Offset: 0xc) PWMC Status Register -------- +// -------- PWMC_IER : (PWMC Offset: 0x10) PWMC Interrupt Enable Register -------- +// -------- PWMC_IDR : (PWMC Offset: 0x14) PWMC Interrupt Disable Register -------- +// -------- PWMC_IMR : (PWMC Offset: 0x18) PWMC Interrupt Mask Register -------- +// -------- PWMC_ISR : (PWMC Offset: 0x1c) PWMC Interrupt Status Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR USB Device Interface +// ***************************************************************************** +typedef struct _AT91S_UDP { + AT91_REG UDP_NUM; // Frame Number Register + AT91_REG UDP_GLBSTATE; // Global State Register + AT91_REG UDP_FADDR; // Function Address Register + AT91_REG Reserved0[1]; // + AT91_REG UDP_IER; // Interrupt Enable Register + AT91_REG UDP_IDR; // Interrupt Disable Register + AT91_REG UDP_IMR; // Interrupt Mask Register + AT91_REG UDP_ISR; // Interrupt Status Register + AT91_REG UDP_ICR; // Interrupt Clear Register + AT91_REG Reserved1[1]; // + AT91_REG UDP_RSTEP; // Reset Endpoint Register + AT91_REG Reserved2[1]; // + AT91_REG UDP_CSR[6]; // Endpoint Control and Status Register + AT91_REG Reserved3[2]; // + AT91_REG UDP_FDR[6]; // Endpoint FIFO Data Register + AT91_REG Reserved4[3]; // + AT91_REG UDP_TXVC; // Transceiver Control Register +} AT91S_UDP, *AT91PS_UDP; + +// -------- UDP_FRM_NUM : (UDP Offset: 0x0) USB Frame Number Register -------- +#define AT91C_UDP_FRM_NUM ((unsigned int) 0x7FF << 0) // (UDP) Frame Number as Defined in the Packet Field Formats +#define AT91C_UDP_FRM_ERR ((unsigned int) 0x1 << 16) // (UDP) Frame Error +#define AT91C_UDP_FRM_OK ((unsigned int) 0x1 << 17) // (UDP) Frame OK +// -------- UDP_GLB_STATE : (UDP Offset: 0x4) USB Global State Register -------- +#define AT91C_UDP_FADDEN ((unsigned int) 0x1 << 0) // (UDP) Function Address Enable +#define AT91C_UDP_CONFG ((unsigned int) 0x1 << 1) // (UDP) Configured +#define AT91C_UDP_ESR ((unsigned int) 0x1 << 2) // (UDP) Enable Send Resume +#define AT91C_UDP_RSMINPR ((unsigned int) 0x1 << 3) // (UDP) A Resume Has Been Sent to the Host +#define AT91C_UDP_RMWUPE ((unsigned int) 0x1 << 4) // (UDP) Remote Wake Up Enable +// -------- UDP_FADDR : (UDP Offset: 0x8) USB Function Address Register -------- +#define AT91C_UDP_FADD ((unsigned int) 0xFF << 0) // (UDP) Function Address Value +#define AT91C_UDP_FEN ((unsigned int) 0x1 << 8) // (UDP) Function Enable +// -------- UDP_IER : (UDP Offset: 0x10) USB Interrupt Enable Register -------- +#define AT91C_UDP_EPINT0 ((unsigned int) 0x1 << 0) // (UDP) Endpoint 0 Interrupt +#define AT91C_UDP_EPINT1 ((unsigned int) 0x1 << 1) // (UDP) Endpoint 0 Interrupt +#define AT91C_UDP_EPINT2 ((unsigned int) 0x1 << 2) // (UDP) Endpoint 2 Interrupt +#define AT91C_UDP_EPINT3 ((unsigned int) 0x1 << 3) // (UDP) Endpoint 3 Interrupt +#define AT91C_UDP_EPINT4 ((unsigned int) 0x1 << 4) // (UDP) Endpoint 4 Interrupt +#define AT91C_UDP_EPINT5 ((unsigned int) 0x1 << 5) // (UDP) Endpoint 5 Interrupt +#define AT91C_UDP_RXSUSP ((unsigned int) 0x1 << 8) // (UDP) USB Suspend Interrupt +#define AT91C_UDP_RXRSM ((unsigned int) 0x1 << 9) // (UDP) USB Resume Interrupt +#define AT91C_UDP_EXTRSM ((unsigned int) 0x1 << 10) // (UDP) USB External Resume Interrupt +#define AT91C_UDP_SOFINT ((unsigned int) 0x1 << 11) // (UDP) USB Start Of frame Interrupt +#define AT91C_UDP_WAKEUP ((unsigned int) 0x1 << 13) // (UDP) USB Resume Interrupt +// -------- UDP_IDR : (UDP Offset: 0x14) USB Interrupt Disable Register -------- +// -------- UDP_IMR : (UDP Offset: 0x18) USB Interrupt Mask Register -------- +// -------- UDP_ISR : (UDP Offset: 0x1c) USB Interrupt Status Register -------- +#define AT91C_UDP_ENDBUSRES ((unsigned int) 0x1 << 12) // (UDP) USB End Of Bus Reset Interrupt +// -------- UDP_ICR : (UDP Offset: 0x20) USB Interrupt Clear Register -------- +// -------- UDP_RST_EP : (UDP Offset: 0x28) USB Reset Endpoint Register -------- +#define AT91C_UDP_EP0 ((unsigned int) 0x1 << 0) // (UDP) Reset Endpoint 0 +#define AT91C_UDP_EP1 ((unsigned int) 0x1 << 1) // (UDP) Reset Endpoint 1 +#define AT91C_UDP_EP2 ((unsigned int) 0x1 << 2) // (UDP) Reset Endpoint 2 +#define AT91C_UDP_EP3 ((unsigned int) 0x1 << 3) // (UDP) Reset Endpoint 3 +#define AT91C_UDP_EP4 ((unsigned int) 0x1 << 4) // (UDP) Reset Endpoint 4 +#define AT91C_UDP_EP5 ((unsigned int) 0x1 << 5) // (UDP) Reset Endpoint 5 +// -------- UDP_CSR : (UDP Offset: 0x30) USB Endpoint Control and Status Register -------- +#define AT91C_UDP_TXCOMP ((unsigned int) 0x1 << 0) // (UDP) Generates an IN packet with data previously written in the DPR +#define AT91C_UDP_RX_DATA_BK0 ((unsigned int) 0x1 << 1) // (UDP) Receive Data Bank 0 +#define AT91C_UDP_RXSETUP ((unsigned int) 0x1 << 2) // (UDP) Sends STALL to the Host (Control endpoints) +#define AT91C_UDP_ISOERROR ((unsigned int) 0x1 << 3) // (UDP) Isochronous error (Isochronous endpoints) +#define AT91C_UDP_TXPKTRDY ((unsigned int) 0x1 << 4) // (UDP) Transmit Packet Ready +#define AT91C_UDP_FORCESTALL ((unsigned int) 0x1 << 5) // (UDP) Force Stall (used by Control, Bulk and Isochronous endpoints). +#define AT91C_UDP_RX_DATA_BK1 ((unsigned int) 0x1 << 6) // (UDP) Receive Data Bank 1 (only used by endpoints with ping-pong attributes). +#define AT91C_UDP_DIR ((unsigned int) 0x1 << 7) // (UDP) Transfer Direction +#define AT91C_UDP_EPTYPE ((unsigned int) 0x7 << 8) // (UDP) Endpoint type +#define AT91C_UDP_EPTYPE_CTRL ((unsigned int) 0x0 << 8) // (UDP) Control +#define AT91C_UDP_EPTYPE_ISO_OUT ((unsigned int) 0x1 << 8) // (UDP) Isochronous OUT +#define AT91C_UDP_EPTYPE_BULK_OUT ((unsigned int) 0x2 << 8) // (UDP) Bulk OUT +#define AT91C_UDP_EPTYPE_INT_OUT ((unsigned int) 0x3 << 8) // (UDP) Interrupt OUT +#define AT91C_UDP_EPTYPE_ISO_IN ((unsigned int) 0x5 << 8) // (UDP) Isochronous IN +#define AT91C_UDP_EPTYPE_BULK_IN ((unsigned int) 0x6 << 8) // (UDP) Bulk IN +#define AT91C_UDP_EPTYPE_INT_IN ((unsigned int) 0x7 << 8) // (UDP) Interrupt IN +#define AT91C_UDP_DTGLE ((unsigned int) 0x1 << 11) // (UDP) Data Toggle +#define AT91C_UDP_EPEDS ((unsigned int) 0x1 << 15) // (UDP) Endpoint Enable Disable +#define AT91C_UDP_RXBYTECNT ((unsigned int) 0x7FF << 16) // (UDP) Number Of Bytes Available in the FIFO +// -------- UDP_TXVC : (UDP Offset: 0x74) Transceiver Control Register -------- +#define AT91C_UDP_TXVDIS ((unsigned int) 0x1 << 8) // (UDP) +#define AT91C_UDP_PUON ((unsigned int) 0x1 << 9) // (UDP) Pull-up ON + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Timer Counter Channel Interface +// ***************************************************************************** +typedef struct _AT91S_TC { + AT91_REG TC_CCR; // Channel Control Register + AT91_REG TC_CMR; // Channel Mode Register (Capture Mode / Waveform Mode) + AT91_REG Reserved0[2]; // + AT91_REG TC_CV; // Counter Value + AT91_REG TC_RA; // Register A + AT91_REG TC_RB; // Register B + AT91_REG TC_RC; // Register C + AT91_REG TC_SR; // Status Register + AT91_REG TC_IER; // Interrupt Enable Register + AT91_REG TC_IDR; // Interrupt Disable Register + AT91_REG TC_IMR; // Interrupt Mask Register +} AT91S_TC, *AT91PS_TC; + +// -------- TC_CCR : (TC Offset: 0x0) TC Channel Control Register -------- +#define AT91C_TC_CLKEN ((unsigned int) 0x1 << 0) // (TC) Counter Clock Enable Command +#define AT91C_TC_CLKDIS ((unsigned int) 0x1 << 1) // (TC) Counter Clock Disable Command +#define AT91C_TC_SWTRG ((unsigned int) 0x1 << 2) // (TC) Software Trigger Command +// -------- TC_CMR : (TC Offset: 0x4) TC Channel Mode Register: Capture Mode / Waveform Mode -------- +#define AT91C_TC_CLKS ((unsigned int) 0x7 << 0) // (TC) Clock Selection +#define AT91C_TC_CLKS_TIMER_DIV1_CLOCK ((unsigned int) 0x0) // (TC) Clock selected: TIMER_DIV1_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV2_CLOCK ((unsigned int) 0x1) // (TC) Clock selected: TIMER_DIV2_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV3_CLOCK ((unsigned int) 0x2) // (TC) Clock selected: TIMER_DIV3_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV4_CLOCK ((unsigned int) 0x3) // (TC) Clock selected: TIMER_DIV4_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV5_CLOCK ((unsigned int) 0x4) // (TC) Clock selected: TIMER_DIV5_CLOCK +#define AT91C_TC_CLKS_XC0 ((unsigned int) 0x5) // (TC) Clock selected: XC0 +#define AT91C_TC_CLKS_XC1 ((unsigned int) 0x6) // (TC) Clock selected: XC1 +#define AT91C_TC_CLKS_XC2 ((unsigned int) 0x7) // (TC) Clock selected: XC2 +#define AT91C_TC_CLKI ((unsigned int) 0x1 << 3) // (TC) Clock Invert +#define AT91C_TC_BURST ((unsigned int) 0x3 << 4) // (TC) Burst Signal Selection +#define AT91C_TC_BURST_NONE ((unsigned int) 0x0 << 4) // (TC) The clock is not gated by an external signal +#define AT91C_TC_BURST_XC0 ((unsigned int) 0x1 << 4) // (TC) XC0 is ANDed with the selected clock +#define AT91C_TC_BURST_XC1 ((unsigned int) 0x2 << 4) // (TC) XC1 is ANDed with the selected clock +#define AT91C_TC_BURST_XC2 ((unsigned int) 0x3 << 4) // (TC) XC2 is ANDed with the selected clock +#define AT91C_TC_CPCSTOP ((unsigned int) 0x1 << 6) // (TC) Counter Clock Stopped with RC Compare +#define AT91C_TC_LDBSTOP ((unsigned int) 0x1 << 6) // (TC) Counter Clock Stopped with RB Loading +#define AT91C_TC_LDBDIS ((unsigned int) 0x1 << 7) // (TC) Counter Clock Disabled with RB Loading +#define AT91C_TC_CPCDIS ((unsigned int) 0x1 << 7) // (TC) Counter Clock Disable with RC Compare +#define AT91C_TC_ETRGEDG ((unsigned int) 0x3 << 8) // (TC) External Trigger Edge Selection +#define AT91C_TC_ETRGEDG_NONE ((unsigned int) 0x0 << 8) // (TC) Edge: None +#define AT91C_TC_ETRGEDG_RISING ((unsigned int) 0x1 << 8) // (TC) Edge: rising edge +#define AT91C_TC_ETRGEDG_FALLING ((unsigned int) 0x2 << 8) // (TC) Edge: falling edge +#define AT91C_TC_ETRGEDG_BOTH ((unsigned int) 0x3 << 8) // (TC) Edge: each edge +#define AT91C_TC_EEVTEDG ((unsigned int) 0x3 << 8) // (TC) External Event Edge Selection +#define AT91C_TC_EEVTEDG_NONE ((unsigned int) 0x0 << 8) // (TC) Edge: None +#define AT91C_TC_EEVTEDG_RISING ((unsigned int) 0x1 << 8) // (TC) Edge: rising edge +#define AT91C_TC_EEVTEDG_FALLING ((unsigned int) 0x2 << 8) // (TC) Edge: falling edge +#define AT91C_TC_EEVTEDG_BOTH ((unsigned int) 0x3 << 8) // (TC) Edge: each edge +#define AT91C_TC_ABETRG ((unsigned int) 0x1 << 10) // (TC) TIOA or TIOB External Trigger Selection +#define AT91C_TC_EEVT ((unsigned int) 0x3 << 10) // (TC) External Event Selection +#define AT91C_TC_EEVT_TIOB ((unsigned int) 0x0 << 10) // (TC) Signal selected as external event: TIOB TIOB direction: input +#define AT91C_TC_EEVT_XC0 ((unsigned int) 0x1 << 10) // (TC) Signal selected as external event: XC0 TIOB direction: output +#define AT91C_TC_EEVT_XC1 ((unsigned int) 0x2 << 10) // (TC) Signal selected as external event: XC1 TIOB direction: output +#define AT91C_TC_EEVT_XC2 ((unsigned int) 0x3 << 10) // (TC) Signal selected as external event: XC2 TIOB direction: output +#define AT91C_TC_ENETRG ((unsigned int) 0x1 << 12) // (TC) External Event Trigger enable +#define AT91C_TC_WAVESEL ((unsigned int) 0x3 << 13) // (TC) Waveform Selection +#define AT91C_TC_WAVESEL_UP ((unsigned int) 0x0 << 13) // (TC) UP mode without atomatic trigger on RC Compare +#define AT91C_TC_WAVESEL_UPDOWN ((unsigned int) 0x1 << 13) // (TC) UPDOWN mode without automatic trigger on RC Compare +#define AT91C_TC_WAVESEL_UP_AUTO ((unsigned int) 0x2 << 13) // (TC) UP mode with automatic trigger on RC Compare +#define AT91C_TC_WAVESEL_UPDOWN_AUTO ((unsigned int) 0x3 << 13) // (TC) UPDOWN mode with automatic trigger on RC Compare +#define AT91C_TC_CPCTRG ((unsigned int) 0x1 << 14) // (TC) RC Compare Trigger Enable +#define AT91C_TC_WAVE ((unsigned int) 0x1 << 15) // (TC) +#define AT91C_TC_LDRA ((unsigned int) 0x3 << 16) // (TC) RA Loading Selection +#define AT91C_TC_LDRA_NONE ((unsigned int) 0x0 << 16) // (TC) Edge: None +#define AT91C_TC_LDRA_RISING ((unsigned int) 0x1 << 16) // (TC) Edge: rising edge of TIOA +#define AT91C_TC_LDRA_FALLING ((unsigned int) 0x2 << 16) // (TC) Edge: falling edge of TIOA +#define AT91C_TC_LDRA_BOTH ((unsigned int) 0x3 << 16) // (TC) Edge: each edge of TIOA +#define AT91C_TC_ACPA ((unsigned int) 0x3 << 16) // (TC) RA Compare Effect on TIOA +#define AT91C_TC_ACPA_NONE ((unsigned int) 0x0 << 16) // (TC) Effect: none +#define AT91C_TC_ACPA_SET ((unsigned int) 0x1 << 16) // (TC) Effect: set +#define AT91C_TC_ACPA_CLEAR ((unsigned int) 0x2 << 16) // (TC) Effect: clear +#define AT91C_TC_ACPA_TOGGLE ((unsigned int) 0x3 << 16) // (TC) Effect: toggle +#define AT91C_TC_LDRB ((unsigned int) 0x3 << 18) // (TC) RB Loading Selection +#define AT91C_TC_LDRB_NONE ((unsigned int) 0x0 << 18) // (TC) Edge: None +#define AT91C_TC_LDRB_RISING ((unsigned int) 0x1 << 18) // (TC) Edge: rising edge of TIOA +#define AT91C_TC_LDRB_FALLING ((unsigned int) 0x2 << 18) // (TC) Edge: falling edge of TIOA +#define AT91C_TC_LDRB_BOTH ((unsigned int) 0x3 << 18) // (TC) Edge: each edge of TIOA +#define AT91C_TC_ACPC ((unsigned int) 0x3 << 18) // (TC) RC Compare Effect on TIOA +#define AT91C_TC_ACPC_NONE ((unsigned int) 0x0 << 18) // (TC) Effect: none +#define AT91C_TC_ACPC_SET ((unsigned int) 0x1 << 18) // (TC) Effect: set +#define AT91C_TC_ACPC_CLEAR ((unsigned int) 0x2 << 18) // (TC) Effect: clear +#define AT91C_TC_ACPC_TOGGLE ((unsigned int) 0x3 << 18) // (TC) Effect: toggle +#define AT91C_TC_AEEVT ((unsigned int) 0x3 << 20) // (TC) External Event Effect on TIOA +#define AT91C_TC_AEEVT_NONE ((unsigned int) 0x0 << 20) // (TC) Effect: none +#define AT91C_TC_AEEVT_SET ((unsigned int) 0x1 << 20) // (TC) Effect: set +#define AT91C_TC_AEEVT_CLEAR ((unsigned int) 0x2 << 20) // (TC) Effect: clear +#define AT91C_TC_AEEVT_TOGGLE ((unsigned int) 0x3 << 20) // (TC) Effect: toggle +#define AT91C_TC_ASWTRG ((unsigned int) 0x3 << 22) // (TC) Software Trigger Effect on TIOA +#define AT91C_TC_ASWTRG_NONE ((unsigned int) 0x0 << 22) // (TC) Effect: none +#define AT91C_TC_ASWTRG_SET ((unsigned int) 0x1 << 22) // (TC) Effect: set +#define AT91C_TC_ASWTRG_CLEAR ((unsigned int) 0x2 << 22) // (TC) Effect: clear +#define AT91C_TC_ASWTRG_TOGGLE ((unsigned int) 0x3 << 22) // (TC) Effect: toggle +#define AT91C_TC_BCPB ((unsigned int) 0x3 << 24) // (TC) RB Compare Effect on TIOB +#define AT91C_TC_BCPB_NONE ((unsigned int) 0x0 << 24) // (TC) Effect: none +#define AT91C_TC_BCPB_SET ((unsigned int) 0x1 << 24) // (TC) Effect: set +#define AT91C_TC_BCPB_CLEAR ((unsigned int) 0x2 << 24) // (TC) Effect: clear +#define AT91C_TC_BCPB_TOGGLE ((unsigned int) 0x3 << 24) // (TC) Effect: toggle +#define AT91C_TC_BCPC ((unsigned int) 0x3 << 26) // (TC) RC Compare Effect on TIOB +#define AT91C_TC_BCPC_NONE ((unsigned int) 0x0 << 26) // (TC) Effect: none +#define AT91C_TC_BCPC_SET ((unsigned int) 0x1 << 26) // (TC) Effect: set +#define AT91C_TC_BCPC_CLEAR ((unsigned int) 0x2 << 26) // (TC) Effect: clear +#define AT91C_TC_BCPC_TOGGLE ((unsigned int) 0x3 << 26) // (TC) Effect: toggle +#define AT91C_TC_BEEVT ((unsigned int) 0x3 << 28) // (TC) External Event Effect on TIOB +#define AT91C_TC_BEEVT_NONE ((unsigned int) 0x0 << 28) // (TC) Effect: none +#define AT91C_TC_BEEVT_SET ((unsigned int) 0x1 << 28) // (TC) Effect: set +#define AT91C_TC_BEEVT_CLEAR ((unsigned int) 0x2 << 28) // (TC) Effect: clear +#define AT91C_TC_BEEVT_TOGGLE ((unsigned int) 0x3 << 28) // (TC) Effect: toggle +#define AT91C_TC_BSWTRG ((unsigned int) 0x3 << 30) // (TC) Software Trigger Effect on TIOB +#define AT91C_TC_BSWTRG_NONE ((unsigned int) 0x0 << 30) // (TC) Effect: none +#define AT91C_TC_BSWTRG_SET ((unsigned int) 0x1 << 30) // (TC) Effect: set +#define AT91C_TC_BSWTRG_CLEAR ((unsigned int) 0x2 << 30) // (TC) Effect: clear +#define AT91C_TC_BSWTRG_TOGGLE ((unsigned int) 0x3 << 30) // (TC) Effect: toggle +// -------- TC_SR : (TC Offset: 0x20) TC Channel Status Register -------- +#define AT91C_TC_COVFS ((unsigned int) 0x1 << 0) // (TC) Counter Overflow +#define AT91C_TC_LOVRS ((unsigned int) 0x1 << 1) // (TC) Load Overrun +#define AT91C_TC_CPAS ((unsigned int) 0x1 << 2) // (TC) RA Compare +#define AT91C_TC_CPBS ((unsigned int) 0x1 << 3) // (TC) RB Compare +#define AT91C_TC_CPCS ((unsigned int) 0x1 << 4) // (TC) RC Compare +#define AT91C_TC_LDRAS ((unsigned int) 0x1 << 5) // (TC) RA Loading +#define AT91C_TC_LDRBS ((unsigned int) 0x1 << 6) // (TC) RB Loading +#define AT91C_TC_ETRGS ((unsigned int) 0x1 << 7) // (TC) External Trigger +#define AT91C_TC_CLKSTA ((unsigned int) 0x1 << 16) // (TC) Clock Enabling +#define AT91C_TC_MTIOA ((unsigned int) 0x1 << 17) // (TC) TIOA Mirror +#define AT91C_TC_MTIOB ((unsigned int) 0x1 << 18) // (TC) TIOA Mirror +// -------- TC_IER : (TC Offset: 0x24) TC Channel Interrupt Enable Register -------- +// -------- TC_IDR : (TC Offset: 0x28) TC Channel Interrupt Disable Register -------- +// -------- TC_IMR : (TC Offset: 0x2c) TC Channel Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Timer Counter Interface +// ***************************************************************************** +typedef struct _AT91S_TCB { + AT91S_TC TCB_TC0; // TC Channel 0 + AT91_REG Reserved0[4]; // + AT91S_TC TCB_TC1; // TC Channel 1 + AT91_REG Reserved1[4]; // + AT91S_TC TCB_TC2; // TC Channel 2 + AT91_REG Reserved2[4]; // + AT91_REG TCB_BCR; // TC Block Control Register + AT91_REG TCB_BMR; // TC Block Mode Register +} AT91S_TCB, *AT91PS_TCB; + +// -------- TCB_BCR : (TCB Offset: 0xc0) TC Block Control Register -------- +#define AT91C_TCB_SYNC ((unsigned int) 0x1 << 0) // (TCB) Synchro Command +// -------- TCB_BMR : (TCB Offset: 0xc4) TC Block Mode Register -------- +#define AT91C_TCB_TC0XC0S ((unsigned int) 0x3 << 0) // (TCB) External Clock Signal 0 Selection +#define AT91C_TCB_TC0XC0S_TCLK0 ((unsigned int) 0x0) // (TCB) TCLK0 connected to XC0 +#define AT91C_TCB_TC0XC0S_NONE ((unsigned int) 0x1) // (TCB) None signal connected to XC0 +#define AT91C_TCB_TC0XC0S_TIOA1 ((unsigned int) 0x2) // (TCB) TIOA1 connected to XC0 +#define AT91C_TCB_TC0XC0S_TIOA2 ((unsigned int) 0x3) // (TCB) TIOA2 connected to XC0 +#define AT91C_TCB_TC1XC1S ((unsigned int) 0x3 << 2) // (TCB) External Clock Signal 1 Selection +#define AT91C_TCB_TC1XC1S_TCLK1 ((unsigned int) 0x0 << 2) // (TCB) TCLK1 connected to XC1 +#define AT91C_TCB_TC1XC1S_NONE ((unsigned int) 0x1 << 2) // (TCB) None signal connected to XC1 +#define AT91C_TCB_TC1XC1S_TIOA0 ((unsigned int) 0x2 << 2) // (TCB) TIOA0 connected to XC1 +#define AT91C_TCB_TC1XC1S_TIOA2 ((unsigned int) 0x3 << 2) // (TCB) TIOA2 connected to XC1 +#define AT91C_TCB_TC2XC2S ((unsigned int) 0x3 << 4) // (TCB) External Clock Signal 2 Selection +#define AT91C_TCB_TC2XC2S_TCLK2 ((unsigned int) 0x0 << 4) // (TCB) TCLK2 connected to XC2 +#define AT91C_TCB_TC2XC2S_NONE ((unsigned int) 0x1 << 4) // (TCB) None signal connected to XC2 +#define AT91C_TCB_TC2XC2S_TIOA0 ((unsigned int) 0x2 << 4) // (TCB) TIOA0 connected to XC2 +#define AT91C_TCB_TC2XC2S_TIOA1 ((unsigned int) 0x3 << 4) // (TCB) TIOA2 connected to XC2 + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Control Area Network MailBox Interface +// ***************************************************************************** +typedef struct _AT91S_CAN_MB { + AT91_REG CAN_MB_MMR; // MailBox Mode Register + AT91_REG CAN_MB_MAM; // MailBox Acceptance Mask Register + AT91_REG CAN_MB_MID; // MailBox ID Register + AT91_REG CAN_MB_MFID; // MailBox Family ID Register + AT91_REG CAN_MB_MSR; // MailBox Status Register + AT91_REG CAN_MB_MDL; // MailBox Data Low Register + AT91_REG CAN_MB_MDH; // MailBox Data High Register + AT91_REG CAN_MB_MCR; // MailBox Control Register +} AT91S_CAN_MB, *AT91PS_CAN_MB; + +// -------- CAN_MMR : (CAN_MB Offset: 0x0) CAN Message Mode Register -------- +#define AT91C_CAN_MTIMEMARK ((unsigned int) 0xFFFF << 0) // (CAN_MB) Mailbox Timemark +#define AT91C_CAN_PRIOR ((unsigned int) 0xF << 16) // (CAN_MB) Mailbox Priority +#define AT91C_CAN_MOT ((unsigned int) 0x7 << 24) // (CAN_MB) Mailbox Object Type +#define AT91C_CAN_MOT_DIS ((unsigned int) 0x0 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_RX ((unsigned int) 0x1 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_RXOVERWRITE ((unsigned int) 0x2 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_TX ((unsigned int) 0x3 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_CONSUMER ((unsigned int) 0x4 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_PRODUCER ((unsigned int) 0x5 << 24) // (CAN_MB) +// -------- CAN_MAM : (CAN_MB Offset: 0x4) CAN Message Acceptance Mask Register -------- +#define AT91C_CAN_MIDvB ((unsigned int) 0x3FFFF << 0) // (CAN_MB) Complementary bits for identifier in extended mode +#define AT91C_CAN_MIDvA ((unsigned int) 0x7FF << 18) // (CAN_MB) Identifier for standard frame mode +#define AT91C_CAN_MIDE ((unsigned int) 0x1 << 29) // (CAN_MB) Identifier Version +// -------- CAN_MID : (CAN_MB Offset: 0x8) CAN Message ID Register -------- +// -------- CAN_MFID : (CAN_MB Offset: 0xc) CAN Message Family ID Register -------- +// -------- CAN_MSR : (CAN_MB Offset: 0x10) CAN Message Status Register -------- +#define AT91C_CAN_MTIMESTAMP ((unsigned int) 0xFFFF << 0) // (CAN_MB) Timer Value +#define AT91C_CAN_MDLC ((unsigned int) 0xF << 16) // (CAN_MB) Mailbox Data Length Code +#define AT91C_CAN_MRTR ((unsigned int) 0x1 << 20) // (CAN_MB) Mailbox Remote Transmission Request +#define AT91C_CAN_MABT ((unsigned int) 0x1 << 22) // (CAN_MB) Mailbox Message Abort +#define AT91C_CAN_MRDY ((unsigned int) 0x1 << 23) // (CAN_MB) Mailbox Ready +#define AT91C_CAN_MMI ((unsigned int) 0x1 << 24) // (CAN_MB) Mailbox Message Ignored +// -------- CAN_MDL : (CAN_MB Offset: 0x14) CAN Message Data Low Register -------- +// -------- CAN_MDH : (CAN_MB Offset: 0x18) CAN Message Data High Register -------- +// -------- CAN_MCR : (CAN_MB Offset: 0x1c) CAN Message Control Register -------- +#define AT91C_CAN_MACR ((unsigned int) 0x1 << 22) // (CAN_MB) Abort Request for Mailbox +#define AT91C_CAN_MTCR ((unsigned int) 0x1 << 23) // (CAN_MB) Mailbox Transfer Command + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Control Area Network Interface +// ***************************************************************************** +typedef struct _AT91S_CAN { + AT91_REG CAN_MR; // Mode Register + AT91_REG CAN_IER; // Interrupt Enable Register + AT91_REG CAN_IDR; // Interrupt Disable Register + AT91_REG CAN_IMR; // Interrupt Mask Register + AT91_REG CAN_SR; // Status Register + AT91_REG CAN_BR; // Baudrate Register + AT91_REG CAN_TIM; // Timer Register + AT91_REG CAN_TIMESTP; // Time Stamp Register + AT91_REG CAN_ECR; // Error Counter Register + AT91_REG CAN_TCR; // Transfer Command Register + AT91_REG CAN_ACR; // Abort Command Register + AT91_REG Reserved0[52]; // + AT91_REG CAN_VR; // Version Register + AT91_REG Reserved1[64]; // + AT91S_CAN_MB CAN_MB0; // CAN Mailbox 0 + AT91S_CAN_MB CAN_MB1; // CAN Mailbox 1 + AT91S_CAN_MB CAN_MB2; // CAN Mailbox 2 + AT91S_CAN_MB CAN_MB3; // CAN Mailbox 3 + AT91S_CAN_MB CAN_MB4; // CAN Mailbox 4 + AT91S_CAN_MB CAN_MB5; // CAN Mailbox 5 + AT91S_CAN_MB CAN_MB6; // CAN Mailbox 6 + AT91S_CAN_MB CAN_MB7; // CAN Mailbox 7 + AT91S_CAN_MB CAN_MB8; // CAN Mailbox 8 + AT91S_CAN_MB CAN_MB9; // CAN Mailbox 9 + AT91S_CAN_MB CAN_MB10; // CAN Mailbox 10 + AT91S_CAN_MB CAN_MB11; // CAN Mailbox 11 + AT91S_CAN_MB CAN_MB12; // CAN Mailbox 12 + AT91S_CAN_MB CAN_MB13; // CAN Mailbox 13 + AT91S_CAN_MB CAN_MB14; // CAN Mailbox 14 + AT91S_CAN_MB CAN_MB15; // CAN Mailbox 15 +} AT91S_CAN, *AT91PS_CAN; + +// -------- CAN_MR : (CAN Offset: 0x0) CAN Mode Register -------- +#define AT91C_CAN_CANEN ((unsigned int) 0x1 << 0) // (CAN) CAN Controller Enable +#define AT91C_CAN_LPM ((unsigned int) 0x1 << 1) // (CAN) Disable/Enable Low Power Mode +#define AT91C_CAN_ABM ((unsigned int) 0x1 << 2) // (CAN) Disable/Enable Autobaud/Listen Mode +#define AT91C_CAN_OVL ((unsigned int) 0x1 << 3) // (CAN) Disable/Enable Overload Frame +#define AT91C_CAN_TEOF ((unsigned int) 0x1 << 4) // (CAN) Time Stamp messages at each end of Frame +#define AT91C_CAN_TTM ((unsigned int) 0x1 << 5) // (CAN) Disable/Enable Time Trigger Mode +#define AT91C_CAN_TIMFRZ ((unsigned int) 0x1 << 6) // (CAN) Enable Timer Freeze +#define AT91C_CAN_DRPT ((unsigned int) 0x1 << 7) // (CAN) Disable Repeat +// -------- CAN_IER : (CAN Offset: 0x4) CAN Interrupt Enable Register -------- +#define AT91C_CAN_MB0 ((unsigned int) 0x1 << 0) // (CAN) Mailbox 0 Flag +#define AT91C_CAN_MB1 ((unsigned int) 0x1 << 1) // (CAN) Mailbox 1 Flag +#define AT91C_CAN_MB2 ((unsigned int) 0x1 << 2) // (CAN) Mailbox 2 Flag +#define AT91C_CAN_MB3 ((unsigned int) 0x1 << 3) // (CAN) Mailbox 3 Flag +#define AT91C_CAN_MB4 ((unsigned int) 0x1 << 4) // (CAN) Mailbox 4 Flag +#define AT91C_CAN_MB5 ((unsigned int) 0x1 << 5) // (CAN) Mailbox 5 Flag +#define AT91C_CAN_MB6 ((unsigned int) 0x1 << 6) // (CAN) Mailbox 6 Flag +#define AT91C_CAN_MB7 ((unsigned int) 0x1 << 7) // (CAN) Mailbox 7 Flag +#define AT91C_CAN_MB8 ((unsigned int) 0x1 << 8) // (CAN) Mailbox 8 Flag +#define AT91C_CAN_MB9 ((unsigned int) 0x1 << 9) // (CAN) Mailbox 9 Flag +#define AT91C_CAN_MB10 ((unsigned int) 0x1 << 10) // (CAN) Mailbox 10 Flag +#define AT91C_CAN_MB11 ((unsigned int) 0x1 << 11) // (CAN) Mailbox 11 Flag +#define AT91C_CAN_MB12 ((unsigned int) 0x1 << 12) // (CAN) Mailbox 12 Flag +#define AT91C_CAN_MB13 ((unsigned int) 0x1 << 13) // (CAN) Mailbox 13 Flag +#define AT91C_CAN_MB14 ((unsigned int) 0x1 << 14) // (CAN) Mailbox 14 Flag +#define AT91C_CAN_MB15 ((unsigned int) 0x1 << 15) // (CAN) Mailbox 15 Flag +#define AT91C_CAN_ERRA ((unsigned int) 0x1 << 16) // (CAN) Error Active Mode Flag +#define AT91C_CAN_WARN ((unsigned int) 0x1 << 17) // (CAN) Warning Limit Flag +#define AT91C_CAN_ERRP ((unsigned int) 0x1 << 18) // (CAN) Error Passive Mode Flag +#define AT91C_CAN_BOFF ((unsigned int) 0x1 << 19) // (CAN) Bus Off Mode Flag +#define AT91C_CAN_SLEEP ((unsigned int) 0x1 << 20) // (CAN) Sleep Flag +#define AT91C_CAN_WAKEUP ((unsigned int) 0x1 << 21) // (CAN) Wakeup Flag +#define AT91C_CAN_TOVF ((unsigned int) 0x1 << 22) // (CAN) Timer Overflow Flag +#define AT91C_CAN_TSTP ((unsigned int) 0x1 << 23) // (CAN) Timestamp Flag +#define AT91C_CAN_CERR ((unsigned int) 0x1 << 24) // (CAN) CRC Error +#define AT91C_CAN_SERR ((unsigned int) 0x1 << 25) // (CAN) Stuffing Error +#define AT91C_CAN_AERR ((unsigned int) 0x1 << 26) // (CAN) Acknowledgment Error +#define AT91C_CAN_FERR ((unsigned int) 0x1 << 27) // (CAN) Form Error +#define AT91C_CAN_BERR ((unsigned int) 0x1 << 28) // (CAN) Bit Error +// -------- CAN_IDR : (CAN Offset: 0x8) CAN Interrupt Disable Register -------- +// -------- CAN_IMR : (CAN Offset: 0xc) CAN Interrupt Mask Register -------- +// -------- CAN_SR : (CAN Offset: 0x10) CAN Status Register -------- +#define AT91C_CAN_RBSY ((unsigned int) 0x1 << 29) // (CAN) Receiver Busy +#define AT91C_CAN_TBSY ((unsigned int) 0x1 << 30) // (CAN) Transmitter Busy +#define AT91C_CAN_OVLY ((unsigned int) 0x1 << 31) // (CAN) Overload Busy +// -------- CAN_BR : (CAN Offset: 0x14) CAN Baudrate Register -------- +#define AT91C_CAN_PHASE2 ((unsigned int) 0x7 << 0) // (CAN) Phase 2 segment +#define AT91C_CAN_PHASE1 ((unsigned int) 0x7 << 4) // (CAN) Phase 1 segment +#define AT91C_CAN_PROPAG ((unsigned int) 0x7 << 8) // (CAN) Programmation time segment +#define AT91C_CAN_SYNC ((unsigned int) 0x3 << 12) // (CAN) Re-synchronization jump width segment +#define AT91C_CAN_BRP ((unsigned int) 0x7F << 16) // (CAN) Baudrate Prescaler +#define AT91C_CAN_SMP ((unsigned int) 0x1 << 24) // (CAN) Sampling mode +// -------- CAN_TIM : (CAN Offset: 0x18) CAN Timer Register -------- +#define AT91C_CAN_TIMER ((unsigned int) 0xFFFF << 0) // (CAN) Timer field +// -------- CAN_TIMESTP : (CAN Offset: 0x1c) CAN Timestamp Register -------- +// -------- CAN_ECR : (CAN Offset: 0x20) CAN Error Counter Register -------- +#define AT91C_CAN_REC ((unsigned int) 0xFF << 0) // (CAN) Receive Error Counter +#define AT91C_CAN_TEC ((unsigned int) 0xFF << 16) // (CAN) Transmit Error Counter +// -------- CAN_TCR : (CAN Offset: 0x24) CAN Transfer Command Register -------- +#define AT91C_CAN_TIMRST ((unsigned int) 0x1 << 31) // (CAN) Timer Reset Field +// -------- CAN_ACR : (CAN Offset: 0x28) CAN Abort Command Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Ethernet MAC 10/100 +// ***************************************************************************** +typedef struct _AT91S_EMAC { + AT91_REG EMAC_NCR; // Network Control Register + AT91_REG EMAC_NCFGR; // Network Configuration Register + AT91_REG EMAC_NSR; // Network Status Register + AT91_REG Reserved0[2]; // + AT91_REG EMAC_TSR; // Transmit Status Register + AT91_REG EMAC_RBQP; // Receive Buffer Queue Pointer + AT91_REG EMAC_TBQP; // Transmit Buffer Queue Pointer + AT91_REG EMAC_RSR; // Receive Status Register + AT91_REG EMAC_ISR; // Interrupt Status Register + AT91_REG EMAC_IER; // Interrupt Enable Register + AT91_REG EMAC_IDR; // Interrupt Disable Register + AT91_REG EMAC_IMR; // Interrupt Mask Register + AT91_REG EMAC_MAN; // PHY Maintenance Register + AT91_REG EMAC_PTR; // Pause Time Register + AT91_REG EMAC_PFR; // Pause Frames received Register + AT91_REG EMAC_FTO; // Frames Transmitted OK Register + AT91_REG EMAC_SCF; // Single Collision Frame Register + AT91_REG EMAC_MCF; // Multiple Collision Frame Register + AT91_REG EMAC_FRO; // Frames Received OK Register + AT91_REG EMAC_FCSE; // Frame Check Sequence Error Register + AT91_REG EMAC_ALE; // Alignment Error Register + AT91_REG EMAC_DTF; // Deferred Transmission Frame Register + AT91_REG EMAC_LCOL; // Late Collision Register + AT91_REG EMAC_ECOL; // Excessive Collision Register + AT91_REG EMAC_TUND; // Transmit Underrun Error Register + AT91_REG EMAC_CSE; // Carrier Sense Error Register + AT91_REG EMAC_RRE; // Receive Ressource Error Register + AT91_REG EMAC_ROV; // Receive Overrun Errors Register + AT91_REG EMAC_RSE; // Receive Symbol Errors Register + AT91_REG EMAC_ELE; // Excessive Length Errors Register + AT91_REG EMAC_RJA; // Receive Jabbers Register + AT91_REG EMAC_USF; // Undersize Frames Register + AT91_REG EMAC_STE; // SQE Test Error Register + AT91_REG EMAC_RLE; // Receive Length Field Mismatch Register + AT91_REG EMAC_TPF; // Transmitted Pause Frames Register + AT91_REG EMAC_HRB; // Hash Address Bottom[31:0] + AT91_REG EMAC_HRT; // Hash Address Top[63:32] + AT91_REG EMAC_SA1L; // Specific Address 1 Bottom, First 4 bytes + AT91_REG EMAC_SA1H; // Specific Address 1 Top, Last 2 bytes + AT91_REG EMAC_SA2L; // Specific Address 2 Bottom, First 4 bytes + AT91_REG EMAC_SA2H; // Specific Address 2 Top, Last 2 bytes + AT91_REG EMAC_SA3L; // Specific Address 3 Bottom, First 4 bytes + AT91_REG EMAC_SA3H; // Specific Address 3 Top, Last 2 bytes + AT91_REG EMAC_SA4L; // Specific Address 4 Bottom, First 4 bytes + AT91_REG EMAC_SA4H; // Specific Address 4 Top, Last 2 bytes + AT91_REG EMAC_TID; // Type ID Checking Register + AT91_REG EMAC_TPQ; // Transmit Pause Quantum Register + AT91_REG EMAC_USRIO; // USER Input/Output Register + AT91_REG EMAC_WOL; // Wake On LAN Register + AT91_REG Reserved1[13]; // + AT91_REG EMAC_REV; // Revision Register +} AT91S_EMAC, *AT91PS_EMAC; + +// -------- EMAC_NCR : (EMAC Offset: 0x0) -------- +#define AT91C_EMAC_LB ((unsigned int) 0x1 << 0) // (EMAC) Loopback. Optional. When set, loopback signal is at high level. +#define AT91C_EMAC_LLB ((unsigned int) 0x1 << 1) // (EMAC) Loopback local. +#define AT91C_EMAC_RE ((unsigned int) 0x1 << 2) // (EMAC) Receive enable. +#define AT91C_EMAC_TE ((unsigned int) 0x1 << 3) // (EMAC) Transmit enable. +#define AT91C_EMAC_MPE ((unsigned int) 0x1 << 4) // (EMAC) Management port enable. +#define AT91C_EMAC_CLRSTAT ((unsigned int) 0x1 << 5) // (EMAC) Clear statistics registers. +#define AT91C_EMAC_INCSTAT ((unsigned int) 0x1 << 6) // (EMAC) Increment statistics registers. +#define AT91C_EMAC_WESTAT ((unsigned int) 0x1 << 7) // (EMAC) Write enable for statistics registers. +#define AT91C_EMAC_BP ((unsigned int) 0x1 << 8) // (EMAC) Back pressure. +#define AT91C_EMAC_TSTART ((unsigned int) 0x1 << 9) // (EMAC) Start Transmission. +#define AT91C_EMAC_THALT ((unsigned int) 0x1 << 10) // (EMAC) Transmission Halt. +#define AT91C_EMAC_TPFR ((unsigned int) 0x1 << 11) // (EMAC) Transmit pause frame +#define AT91C_EMAC_TZQ ((unsigned int) 0x1 << 12) // (EMAC) Transmit zero quantum pause frame +// -------- EMAC_NCFGR : (EMAC Offset: 0x4) Network Configuration Register -------- +#define AT91C_EMAC_SPD ((unsigned int) 0x1 << 0) // (EMAC) Speed. +#define AT91C_EMAC_FD ((unsigned int) 0x1 << 1) // (EMAC) Full duplex. +#define AT91C_EMAC_JFRAME ((unsigned int) 0x1 << 3) // (EMAC) Jumbo Frames. +#define AT91C_EMAC_CAF ((unsigned int) 0x1 << 4) // (EMAC) Copy all frames. +#define AT91C_EMAC_NBC ((unsigned int) 0x1 << 5) // (EMAC) No broadcast. +#define AT91C_EMAC_MTI ((unsigned int) 0x1 << 6) // (EMAC) Multicast hash event enable +#define AT91C_EMAC_UNI ((unsigned int) 0x1 << 7) // (EMAC) Unicast hash enable. +#define AT91C_EMAC_BIG ((unsigned int) 0x1 << 8) // (EMAC) Receive 1522 bytes. +#define AT91C_EMAC_EAE ((unsigned int) 0x1 << 9) // (EMAC) External address match enable. +#define AT91C_EMAC_CLK ((unsigned int) 0x3 << 10) // (EMAC) +#define AT91C_EMAC_CLK_HCLK_8 ((unsigned int) 0x0 << 10) // (EMAC) HCLK divided by 8 +#define AT91C_EMAC_CLK_HCLK_16 ((unsigned int) 0x1 << 10) // (EMAC) HCLK divided by 16 +#define AT91C_EMAC_CLK_HCLK_32 ((unsigned int) 0x2 << 10) // (EMAC) HCLK divided by 32 +#define AT91C_EMAC_CLK_HCLK_64 ((unsigned int) 0x3 << 10) // (EMAC) HCLK divided by 64 +#define AT91C_EMAC_RTY ((unsigned int) 0x1 << 12) // (EMAC) +#define AT91C_EMAC_PAE ((unsigned int) 0x1 << 13) // (EMAC) +#define AT91C_EMAC_RBOF ((unsigned int) 0x3 << 14) // (EMAC) +#define AT91C_EMAC_RBOF_OFFSET_0 ((unsigned int) 0x0 << 14) // (EMAC) no offset from start of receive buffer +#define AT91C_EMAC_RBOF_OFFSET_1 ((unsigned int) 0x1 << 14) // (EMAC) one byte offset from start of receive buffer +#define AT91C_EMAC_RBOF_OFFSET_2 ((unsigned int) 0x2 << 14) // (EMAC) two bytes offset from start of receive buffer +#define AT91C_EMAC_RBOF_OFFSET_3 ((unsigned int) 0x3 << 14) // (EMAC) three bytes offset from start of receive buffer +#define AT91C_EMAC_RLCE ((unsigned int) 0x1 << 16) // (EMAC) Receive Length field Checking Enable +#define AT91C_EMAC_DRFCS ((unsigned int) 0x1 << 17) // (EMAC) Discard Receive FCS +#define AT91C_EMAC_EFRHD ((unsigned int) 0x1 << 18) // (EMAC) +#define AT91C_EMAC_IRXFCS ((unsigned int) 0x1 << 19) // (EMAC) Ignore RX FCS +// -------- EMAC_NSR : (EMAC Offset: 0x8) Network Status Register -------- +#define AT91C_EMAC_LINKR ((unsigned int) 0x1 << 0) // (EMAC) +#define AT91C_EMAC_MDIO ((unsigned int) 0x1 << 1) // (EMAC) +#define AT91C_EMAC_IDLE ((unsigned int) 0x1 << 2) // (EMAC) +// -------- EMAC_TSR : (EMAC Offset: 0x14) Transmit Status Register -------- +#define AT91C_EMAC_UBR ((unsigned int) 0x1 << 0) // (EMAC) +#define AT91C_EMAC_COL ((unsigned int) 0x1 << 1) // (EMAC) +#define AT91C_EMAC_RLES ((unsigned int) 0x1 << 2) // (EMAC) +#define AT91C_EMAC_TGO ((unsigned int) 0x1 << 3) // (EMAC) Transmit Go +#define AT91C_EMAC_BEX ((unsigned int) 0x1 << 4) // (EMAC) Buffers exhausted mid frame +#define AT91C_EMAC_COMP ((unsigned int) 0x1 << 5) // (EMAC) +#define AT91C_EMAC_UND ((unsigned int) 0x1 << 6) // (EMAC) +// -------- EMAC_RSR : (EMAC Offset: 0x20) Receive Status Register -------- +#define AT91C_EMAC_BNA ((unsigned int) 0x1 << 0) // (EMAC) +#define AT91C_EMAC_REC ((unsigned int) 0x1 << 1) // (EMAC) +#define AT91C_EMAC_OVR ((unsigned int) 0x1 << 2) // (EMAC) +// -------- EMAC_ISR : (EMAC Offset: 0x24) Interrupt Status Register -------- +#define AT91C_EMAC_MFD ((unsigned int) 0x1 << 0) // (EMAC) +#define AT91C_EMAC_RCOMP ((unsigned int) 0x1 << 1) // (EMAC) +#define AT91C_EMAC_RXUBR ((unsigned int) 0x1 << 2) // (EMAC) +#define AT91C_EMAC_TXUBR ((unsigned int) 0x1 << 3) // (EMAC) +#define AT91C_EMAC_TUNDR ((unsigned int) 0x1 << 4) // (EMAC) +#define AT91C_EMAC_RLEX ((unsigned int) 0x1 << 5) // (EMAC) +#define AT91C_EMAC_TXERR ((unsigned int) 0x1 << 6) // (EMAC) +#define AT91C_EMAC_TCOMP ((unsigned int) 0x1 << 7) // (EMAC) +#define AT91C_EMAC_LINK ((unsigned int) 0x1 << 9) // (EMAC) +#define AT91C_EMAC_ROVR ((unsigned int) 0x1 << 10) // (EMAC) +#define AT91C_EMAC_HRESP ((unsigned int) 0x1 << 11) // (EMAC) +#define AT91C_EMAC_PFRE ((unsigned int) 0x1 << 12) // (EMAC) +#define AT91C_EMAC_PTZ ((unsigned int) 0x1 << 13) // (EMAC) +// -------- EMAC_IER : (EMAC Offset: 0x28) Interrupt Enable Register -------- +// -------- EMAC_IDR : (EMAC Offset: 0x2c) Interrupt Disable Register -------- +// -------- EMAC_IMR : (EMAC Offset: 0x30) Interrupt Mask Register -------- +// -------- EMAC_MAN : (EMAC Offset: 0x34) PHY Maintenance Register -------- +#define AT91C_EMAC_DATA ((unsigned int) 0xFFFF << 0) // (EMAC) +#define AT91C_EMAC_CODE ((unsigned int) 0x3 << 16) // (EMAC) +#define AT91C_EMAC_REGA ((unsigned int) 0x1F << 18) // (EMAC) +#define AT91C_EMAC_PHYA ((unsigned int) 0x1F << 23) // (EMAC) +#define AT91C_EMAC_RW ((unsigned int) 0x3 << 28) // (EMAC) +#define AT91C_EMAC_SOF ((unsigned int) 0x3 << 30) // (EMAC) +// -------- EMAC_USRIO : (EMAC Offset: 0xc0) USER Input Output Register -------- +#define AT91C_EMAC_RMII ((unsigned int) 0x1 << 0) // (EMAC) Reduce MII +#define AT91C_EMAC_CLKEN ((unsigned int) 0x1 << 1) // (EMAC) Clock Enable +// -------- EMAC_WOL : (EMAC Offset: 0xc4) Wake On LAN Register -------- +#define AT91C_EMAC_IP ((unsigned int) 0xFFFF << 0) // (EMAC) ARP request IP address +#define AT91C_EMAC_MAG ((unsigned int) 0x1 << 16) // (EMAC) Magic packet event enable +#define AT91C_EMAC_ARP ((unsigned int) 0x1 << 17) // (EMAC) ARP request event enable +#define AT91C_EMAC_SA1 ((unsigned int) 0x1 << 18) // (EMAC) Specific address register 1 event enable +// -------- EMAC_REV : (EMAC Offset: 0xfc) Revision Register -------- +#define AT91C_EMAC_REVREF ((unsigned int) 0xFFFF << 0) // (EMAC) +#define AT91C_EMAC_PARTREF ((unsigned int) 0xFFFF << 16) // (EMAC) + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Analog to Digital Convertor +// ***************************************************************************** +typedef struct _AT91S_ADC { + AT91_REG ADC_CR; // ADC Control Register + AT91_REG ADC_MR; // ADC Mode Register + AT91_REG Reserved0[2]; // + AT91_REG ADC_CHER; // ADC Channel Enable Register + AT91_REG ADC_CHDR; // ADC Channel Disable Register + AT91_REG ADC_CHSR; // ADC Channel Status Register + AT91_REG ADC_SR; // ADC Status Register + AT91_REG ADC_LCDR; // ADC Last Converted Data Register + AT91_REG ADC_IER; // ADC Interrupt Enable Register + AT91_REG ADC_IDR; // ADC Interrupt Disable Register + AT91_REG ADC_IMR; // ADC Interrupt Mask Register + AT91_REG ADC_CDR0; // ADC Channel Data Register 0 + AT91_REG ADC_CDR1; // ADC Channel Data Register 1 + AT91_REG ADC_CDR2; // ADC Channel Data Register 2 + AT91_REG ADC_CDR3; // ADC Channel Data Register 3 + AT91_REG ADC_CDR4; // ADC Channel Data Register 4 + AT91_REG ADC_CDR5; // ADC Channel Data Register 5 + AT91_REG ADC_CDR6; // ADC Channel Data Register 6 + AT91_REG ADC_CDR7; // ADC Channel Data Register 7 + AT91_REG Reserved1[44]; // + AT91_REG ADC_RPR; // Receive Pointer Register + AT91_REG ADC_RCR; // Receive Counter Register + AT91_REG ADC_TPR; // Transmit Pointer Register + AT91_REG ADC_TCR; // Transmit Counter Register + AT91_REG ADC_RNPR; // Receive Next Pointer Register + AT91_REG ADC_RNCR; // Receive Next Counter Register + AT91_REG ADC_TNPR; // Transmit Next Pointer Register + AT91_REG ADC_TNCR; // Transmit Next Counter Register + AT91_REG ADC_PTCR; // PDC Transfer Control Register + AT91_REG ADC_PTSR; // PDC Transfer Status Register +} AT91S_ADC, *AT91PS_ADC; + +// -------- ADC_CR : (ADC Offset: 0x0) ADC Control Register -------- +#define AT91C_ADC_SWRST ((unsigned int) 0x1 << 0) // (ADC) Software Reset +#define AT91C_ADC_START ((unsigned int) 0x1 << 1) // (ADC) Start Conversion +// -------- ADC_MR : (ADC Offset: 0x4) ADC Mode Register -------- +#define AT91C_ADC_TRGEN ((unsigned int) 0x1 << 0) // (ADC) Trigger Enable +#define AT91C_ADC_TRGEN_DIS ((unsigned int) 0x0) // (ADC) Hradware triggers are disabled. Starting a conversion is only possible by software +#define AT91C_ADC_TRGEN_EN ((unsigned int) 0x1) // (ADC) Hardware trigger selected by TRGSEL field is enabled. +#define AT91C_ADC_TRGSEL ((unsigned int) 0x7 << 1) // (ADC) Trigger Selection +#define AT91C_ADC_TRGSEL_TIOA0 ((unsigned int) 0x0 << 1) // (ADC) Selected TRGSEL = TIAO0 +#define AT91C_ADC_TRGSEL_TIOA1 ((unsigned int) 0x1 << 1) // (ADC) Selected TRGSEL = TIAO1 +#define AT91C_ADC_TRGSEL_TIOA2 ((unsigned int) 0x2 << 1) // (ADC) Selected TRGSEL = TIAO2 +#define AT91C_ADC_TRGSEL_TIOA3 ((unsigned int) 0x3 << 1) // (ADC) Selected TRGSEL = TIAO3 +#define AT91C_ADC_TRGSEL_TIOA4 ((unsigned int) 0x4 << 1) // (ADC) Selected TRGSEL = TIAO4 +#define AT91C_ADC_TRGSEL_TIOA5 ((unsigned int) 0x5 << 1) // (ADC) Selected TRGSEL = TIAO5 +#define AT91C_ADC_TRGSEL_EXT ((unsigned int) 0x6 << 1) // (ADC) Selected TRGSEL = External Trigger +#define AT91C_ADC_LOWRES ((unsigned int) 0x1 << 4) // (ADC) Resolution. +#define AT91C_ADC_LOWRES_10_BIT ((unsigned int) 0x0 << 4) // (ADC) 10-bit resolution +#define AT91C_ADC_LOWRES_8_BIT ((unsigned int) 0x1 << 4) // (ADC) 8-bit resolution +#define AT91C_ADC_SLEEP ((unsigned int) 0x1 << 5) // (ADC) Sleep Mode +#define AT91C_ADC_SLEEP_NORMAL_MODE ((unsigned int) 0x0 << 5) // (ADC) Normal Mode +#define AT91C_ADC_SLEEP_MODE ((unsigned int) 0x1 << 5) // (ADC) Sleep Mode +#define AT91C_ADC_PRESCAL ((unsigned int) 0x3F << 8) // (ADC) Prescaler rate selection +#define AT91C_ADC_STARTUP ((unsigned int) 0x1F << 16) // (ADC) Startup Time +#define AT91C_ADC_SHTIM ((unsigned int) 0xF << 24) // (ADC) Sample & Hold Time +// -------- ADC_CHER : (ADC Offset: 0x10) ADC Channel Enable Register -------- +#define AT91C_ADC_CH0 ((unsigned int) 0x1 << 0) // (ADC) Channel 0 +#define AT91C_ADC_CH1 ((unsigned int) 0x1 << 1) // (ADC) Channel 1 +#define AT91C_ADC_CH2 ((unsigned int) 0x1 << 2) // (ADC) Channel 2 +#define AT91C_ADC_CH3 ((unsigned int) 0x1 << 3) // (ADC) Channel 3 +#define AT91C_ADC_CH4 ((unsigned int) 0x1 << 4) // (ADC) Channel 4 +#define AT91C_ADC_CH5 ((unsigned int) 0x1 << 5) // (ADC) Channel 5 +#define AT91C_ADC_CH6 ((unsigned int) 0x1 << 6) // (ADC) Channel 6 +#define AT91C_ADC_CH7 ((unsigned int) 0x1 << 7) // (ADC) Channel 7 +// -------- ADC_CHDR : (ADC Offset: 0x14) ADC Channel Disable Register -------- +// -------- ADC_CHSR : (ADC Offset: 0x18) ADC Channel Status Register -------- +// -------- ADC_SR : (ADC Offset: 0x1c) ADC Status Register -------- +#define AT91C_ADC_EOC0 ((unsigned int) 0x1 << 0) // (ADC) End of Conversion +#define AT91C_ADC_EOC1 ((unsigned int) 0x1 << 1) // (ADC) End of Conversion +#define AT91C_ADC_EOC2 ((unsigned int) 0x1 << 2) // (ADC) End of Conversion +#define AT91C_ADC_EOC3 ((unsigned int) 0x1 << 3) // (ADC) End of Conversion +#define AT91C_ADC_EOC4 ((unsigned int) 0x1 << 4) // (ADC) End of Conversion +#define AT91C_ADC_EOC5 ((unsigned int) 0x1 << 5) // (ADC) End of Conversion +#define AT91C_ADC_EOC6 ((unsigned int) 0x1 << 6) // (ADC) End of Conversion +#define AT91C_ADC_EOC7 ((unsigned int) 0x1 << 7) // (ADC) End of Conversion +#define AT91C_ADC_OVRE0 ((unsigned int) 0x1 << 8) // (ADC) Overrun Error +#define AT91C_ADC_OVRE1 ((unsigned int) 0x1 << 9) // (ADC) Overrun Error +#define AT91C_ADC_OVRE2 ((unsigned int) 0x1 << 10) // (ADC) Overrun Error +#define AT91C_ADC_OVRE3 ((unsigned int) 0x1 << 11) // (ADC) Overrun Error +#define AT91C_ADC_OVRE4 ((unsigned int) 0x1 << 12) // (ADC) Overrun Error +#define AT91C_ADC_OVRE5 ((unsigned int) 0x1 << 13) // (ADC) Overrun Error +#define AT91C_ADC_OVRE6 ((unsigned int) 0x1 << 14) // (ADC) Overrun Error +#define AT91C_ADC_OVRE7 ((unsigned int) 0x1 << 15) // (ADC) Overrun Error +#define AT91C_ADC_DRDY ((unsigned int) 0x1 << 16) // (ADC) Data Ready +#define AT91C_ADC_GOVRE ((unsigned int) 0x1 << 17) // (ADC) General Overrun +#define AT91C_ADC_ENDRX ((unsigned int) 0x1 << 18) // (ADC) End of Receiver Transfer +#define AT91C_ADC_RXBUFF ((unsigned int) 0x1 << 19) // (ADC) RXBUFF Interrupt +// -------- ADC_LCDR : (ADC Offset: 0x20) ADC Last Converted Data Register -------- +#define AT91C_ADC_LDATA ((unsigned int) 0x3FF << 0) // (ADC) Last Data Converted +// -------- ADC_IER : (ADC Offset: 0x24) ADC Interrupt Enable Register -------- +// -------- ADC_IDR : (ADC Offset: 0x28) ADC Interrupt Disable Register -------- +// -------- ADC_IMR : (ADC Offset: 0x2c) ADC Interrupt Mask Register -------- +// -------- ADC_CDR0 : (ADC Offset: 0x30) ADC Channel Data Register 0 -------- +#define AT91C_ADC_DATA ((unsigned int) 0x3FF << 0) // (ADC) Converted Data +// -------- ADC_CDR1 : (ADC Offset: 0x34) ADC Channel Data Register 1 -------- +// -------- ADC_CDR2 : (ADC Offset: 0x38) ADC Channel Data Register 2 -------- +// -------- ADC_CDR3 : (ADC Offset: 0x3c) ADC Channel Data Register 3 -------- +// -------- ADC_CDR4 : (ADC Offset: 0x40) ADC Channel Data Register 4 -------- +// -------- ADC_CDR5 : (ADC Offset: 0x44) ADC Channel Data Register 5 -------- +// -------- ADC_CDR6 : (ADC Offset: 0x48) ADC Channel Data Register 6 -------- +// -------- ADC_CDR7 : (ADC Offset: 0x4c) ADC Channel Data Register 7 -------- + +// ***************************************************************************** +// REGISTER ADDRESS DEFINITION FOR AT91SAM7X256 +// ***************************************************************************** +// ========== Register definition for SYS peripheral ========== +// ========== Register definition for AIC peripheral ========== +#define AT91C_AIC_ICCR ((AT91_REG *) 0xFFFFF128) // (AIC) Interrupt Clear Command Register +#define AT91C_AIC_IECR ((AT91_REG *) 0xFFFFF120) // (AIC) Interrupt Enable Command Register +#define AT91C_AIC_SMR ((AT91_REG *) 0xFFFFF000) // (AIC) Source Mode Register +#define AT91C_AIC_ISCR ((AT91_REG *) 0xFFFFF12C) // (AIC) Interrupt Set Command Register +#define AT91C_AIC_EOICR ((AT91_REG *) 0xFFFFF130) // (AIC) End of Interrupt Command Register +#define AT91C_AIC_DCR ((AT91_REG *) 0xFFFFF138) // (AIC) Debug Control Register (Protect) +#define AT91C_AIC_FFER ((AT91_REG *) 0xFFFFF140) // (AIC) Fast Forcing Enable Register +#define AT91C_AIC_SVR ((AT91_REG *) 0xFFFFF080) // (AIC) Source Vector Register +#define AT91C_AIC_SPU ((AT91_REG *) 0xFFFFF134) // (AIC) Spurious Vector Register +#define AT91C_AIC_FFDR ((AT91_REG *) 0xFFFFF144) // (AIC) Fast Forcing Disable Register +#define AT91C_AIC_FVR ((AT91_REG *) 0xFFFFF104) // (AIC) FIQ Vector Register +#define AT91C_AIC_FFSR ((AT91_REG *) 0xFFFFF148) // (AIC) Fast Forcing Status Register +#define AT91C_AIC_IMR ((AT91_REG *) 0xFFFFF110) // (AIC) Interrupt Mask Register +#define AT91C_AIC_ISR ((AT91_REG *) 0xFFFFF108) // (AIC) Interrupt Status Register +#define AT91C_AIC_IVR ((AT91_REG *) 0xFFFFF100) // (AIC) IRQ Vector Register +#define AT91C_AIC_IDCR ((AT91_REG *) 0xFFFFF124) // (AIC) Interrupt Disable Command Register +#define AT91C_AIC_CISR ((AT91_REG *) 0xFFFFF114) // (AIC) Core Interrupt Status Register +#define AT91C_AIC_IPR ((AT91_REG *) 0xFFFFF10C) // (AIC) Interrupt Pending Register +// ========== Register definition for PDC_DBGU peripheral ========== +#define AT91C_DBGU_TNCR ((AT91_REG *) 0xFFFFF31C) // (PDC_DBGU) Transmit Next Counter Register +#define AT91C_DBGU_RNCR ((AT91_REG *) 0xFFFFF314) // (PDC_DBGU) Receive Next Counter Register +#define AT91C_DBGU_PTCR ((AT91_REG *) 0xFFFFF320) // (PDC_DBGU) PDC Transfer Control Register +#define AT91C_DBGU_PTSR ((AT91_REG *) 0xFFFFF324) // (PDC_DBGU) PDC Transfer Status Register +#define AT91C_DBGU_RCR ((AT91_REG *) 0xFFFFF304) // (PDC_DBGU) Receive Counter Register +#define AT91C_DBGU_TCR ((AT91_REG *) 0xFFFFF30C) // (PDC_DBGU) Transmit Counter Register +#define AT91C_DBGU_RPR ((AT91_REG *) 0xFFFFF300) // (PDC_DBGU) Receive Pointer Register +#define AT91C_DBGU_TPR ((AT91_REG *) 0xFFFFF308) // (PDC_DBGU) Transmit Pointer Register +#define AT91C_DBGU_RNPR ((AT91_REG *) 0xFFFFF310) // (PDC_DBGU) Receive Next Pointer Register +#define AT91C_DBGU_TNPR ((AT91_REG *) 0xFFFFF318) // (PDC_DBGU) Transmit Next Pointer Register +// ========== Register definition for DBGU peripheral ========== +#define AT91C_DBGU_EXID ((AT91_REG *) 0xFFFFF244) // (DBGU) Chip ID Extension Register +#define AT91C_DBGU_THR ((AT91_REG *) 0xFFFFF21C) // (DBGU) Transmitter Holding Register +#define AT91C_DBGU_CSR ((AT91_REG *) 0xFFFFF214) // (DBGU) Channel Status Register +#define AT91C_DBGU_IDR ((AT91_REG *) 0xFFFFF20C) // (DBGU) Interrupt Disable Register +#define AT91C_DBGU_MR ((AT91_REG *) 0xFFFFF204) // (DBGU) Mode Register +#define AT91C_DBGU_FNTR ((AT91_REG *) 0xFFFFF248) // (DBGU) Force NTRST Register +#define AT91C_DBGU_CIDR ((AT91_REG *) 0xFFFFF240) // (DBGU) Chip ID Register +#define AT91C_DBGU_BRGR ((AT91_REG *) 0xFFFFF220) // (DBGU) Baud Rate Generator Register +#define AT91C_DBGU_RHR ((AT91_REG *) 0xFFFFF218) // (DBGU) Receiver Holding Register +#define AT91C_DBGU_IMR ((AT91_REG *) 0xFFFFF210) // (DBGU) Interrupt Mask Register +#define AT91C_DBGU_IER ((AT91_REG *) 0xFFFFF208) // (DBGU) Interrupt Enable Register +#define AT91C_DBGU_CR ((AT91_REG *) 0xFFFFF200) // (DBGU) Control Register +// ========== Register definition for PIOA peripheral ========== +#define AT91C_PIOA_IMR ((AT91_REG *) 0xFFFFF448) // (PIOA) Interrupt Mask Register +#define AT91C_PIOA_IER ((AT91_REG *) 0xFFFFF440) // (PIOA) Interrupt Enable Register +#define AT91C_PIOA_OWDR ((AT91_REG *) 0xFFFFF4A4) // (PIOA) Output Write Disable Register +#define AT91C_PIOA_ISR ((AT91_REG *) 0xFFFFF44C) // (PIOA) Interrupt Status Register +#define AT91C_PIOA_PPUDR ((AT91_REG *) 0xFFFFF460) // (PIOA) Pull-up Disable Register +#define AT91C_PIOA_MDSR ((AT91_REG *) 0xFFFFF458) // (PIOA) Multi-driver Status Register +#define AT91C_PIOA_MDER ((AT91_REG *) 0xFFFFF450) // (PIOA) Multi-driver Enable Register +#define AT91C_PIOA_PER ((AT91_REG *) 0xFFFFF400) // (PIOA) PIO Enable Register +#define AT91C_PIOA_PSR ((AT91_REG *) 0xFFFFF408) // (PIOA) PIO Status Register +#define AT91C_PIOA_OER ((AT91_REG *) 0xFFFFF410) // (PIOA) Output Enable Register +#define AT91C_PIOA_BSR ((AT91_REG *) 0xFFFFF474) // (PIOA) Select B Register +#define AT91C_PIOA_PPUER ((AT91_REG *) 0xFFFFF464) // (PIOA) Pull-up Enable Register +#define AT91C_PIOA_MDDR ((AT91_REG *) 0xFFFFF454) // (PIOA) Multi-driver Disable Register +#define AT91C_PIOA_PDR ((AT91_REG *) 0xFFFFF404) // (PIOA) PIO Disable Register +#define AT91C_PIOA_ODR ((AT91_REG *) 0xFFFFF414) // (PIOA) Output Disable Registerr +#define AT91C_PIOA_IFDR ((AT91_REG *) 0xFFFFF424) // (PIOA) Input Filter Disable Register +#define AT91C_PIOA_ABSR ((AT91_REG *) 0xFFFFF478) // (PIOA) AB Select Status Register +#define AT91C_PIOA_ASR ((AT91_REG *) 0xFFFFF470) // (PIOA) Select A Register +#define AT91C_PIOA_PPUSR ((AT91_REG *) 0xFFFFF468) // (PIOA) Pull-up Status Register +#define AT91C_PIOA_ODSR ((AT91_REG *) 0xFFFFF438) // (PIOA) Output Data Status Register +#define AT91C_PIOA_SODR ((AT91_REG *) 0xFFFFF430) // (PIOA) Set Output Data Register +#define AT91C_PIOA_IFSR ((AT91_REG *) 0xFFFFF428) // (PIOA) Input Filter Status Register +#define AT91C_PIOA_IFER ((AT91_REG *) 0xFFFFF420) // (PIOA) Input Filter Enable Register +#define AT91C_PIOA_OSR ((AT91_REG *) 0xFFFFF418) // (PIOA) Output Status Register +#define AT91C_PIOA_IDR ((AT91_REG *) 0xFFFFF444) // (PIOA) Interrupt Disable Register +#define AT91C_PIOA_PDSR ((AT91_REG *) 0xFFFFF43C) // (PIOA) Pin Data Status Register +#define AT91C_PIOA_CODR ((AT91_REG *) 0xFFFFF434) // (PIOA) Clear Output Data Register +#define AT91C_PIOA_OWSR ((AT91_REG *) 0xFFFFF4A8) // (PIOA) Output Write Status Register +#define AT91C_PIOA_OWER ((AT91_REG *) 0xFFFFF4A0) // (PIOA) Output Write Enable Register +// ========== Register definition for PIOB peripheral ========== +#define AT91C_PIOB_OWSR ((AT91_REG *) 0xFFFFF6A8) // (PIOB) Output Write Status Register +#define AT91C_PIOB_PPUSR ((AT91_REG *) 0xFFFFF668) // (PIOB) Pull-up Status Register +#define AT91C_PIOB_PPUDR ((AT91_REG *) 0xFFFFF660) // (PIOB) Pull-up Disable Register +#define AT91C_PIOB_MDSR ((AT91_REG *) 0xFFFFF658) // (PIOB) Multi-driver Status Register +#define AT91C_PIOB_MDER ((AT91_REG *) 0xFFFFF650) // (PIOB) Multi-driver Enable Register +#define AT91C_PIOB_IMR ((AT91_REG *) 0xFFFFF648) // (PIOB) Interrupt Mask Register +#define AT91C_PIOB_OSR ((AT91_REG *) 0xFFFFF618) // (PIOB) Output Status Register +#define AT91C_PIOB_OER ((AT91_REG *) 0xFFFFF610) // (PIOB) Output Enable Register +#define AT91C_PIOB_PSR ((AT91_REG *) 0xFFFFF608) // (PIOB) PIO Status Register +#define AT91C_PIOB_PER ((AT91_REG *) 0xFFFFF600) // (PIOB) PIO Enable Register +#define AT91C_PIOB_BSR ((AT91_REG *) 0xFFFFF674) // (PIOB) Select B Register +#define AT91C_PIOB_PPUER ((AT91_REG *) 0xFFFFF664) // (PIOB) Pull-up Enable Register +#define AT91C_PIOB_IFDR ((AT91_REG *) 0xFFFFF624) // (PIOB) Input Filter Disable Register +#define AT91C_PIOB_ODR ((AT91_REG *) 0xFFFFF614) // (PIOB) Output Disable Registerr +#define AT91C_PIOB_ABSR ((AT91_REG *) 0xFFFFF678) // (PIOB) AB Select Status Register +#define AT91C_PIOB_ASR ((AT91_REG *) 0xFFFFF670) // (PIOB) Select A Register +#define AT91C_PIOB_IFER ((AT91_REG *) 0xFFFFF620) // (PIOB) Input Filter Enable Register +#define AT91C_PIOB_IFSR ((AT91_REG *) 0xFFFFF628) // (PIOB) Input Filter Status Register +#define AT91C_PIOB_SODR ((AT91_REG *) 0xFFFFF630) // (PIOB) Set Output Data Register +#define AT91C_PIOB_ODSR ((AT91_REG *) 0xFFFFF638) // (PIOB) Output Data Status Register +#define AT91C_PIOB_CODR ((AT91_REG *) 0xFFFFF634) // (PIOB) Clear Output Data Register +#define AT91C_PIOB_PDSR ((AT91_REG *) 0xFFFFF63C) // (PIOB) Pin Data Status Register +#define AT91C_PIOB_OWER ((AT91_REG *) 0xFFFFF6A0) // (PIOB) Output Write Enable Register +#define AT91C_PIOB_IER ((AT91_REG *) 0xFFFFF640) // (PIOB) Interrupt Enable Register +#define AT91C_PIOB_OWDR ((AT91_REG *) 0xFFFFF6A4) // (PIOB) Output Write Disable Register +#define AT91C_PIOB_MDDR ((AT91_REG *) 0xFFFFF654) // (PIOB) Multi-driver Disable Register +#define AT91C_PIOB_ISR ((AT91_REG *) 0xFFFFF64C) // (PIOB) Interrupt Status Register +#define AT91C_PIOB_IDR ((AT91_REG *) 0xFFFFF644) // (PIOB) Interrupt Disable Register +#define AT91C_PIOB_PDR ((AT91_REG *) 0xFFFFF604) // (PIOB) PIO Disable Register +// ========== Register definition for CKGR peripheral ========== +#define AT91C_CKGR_PLLR ((AT91_REG *) 0xFFFFFC2C) // (CKGR) PLL Register +#define AT91C_CKGR_MCFR ((AT91_REG *) 0xFFFFFC24) // (CKGR) Main Clock Frequency Register +#define AT91C_CKGR_MOR ((AT91_REG *) 0xFFFFFC20) // (CKGR) Main Oscillator Register +// ========== Register definition for PMC peripheral ========== +#define AT91C_PMC_SCSR ((AT91_REG *) 0xFFFFFC08) // (PMC) System Clock Status Register +#define AT91C_PMC_SCER ((AT91_REG *) 0xFFFFFC00) // (PMC) System Clock Enable Register +#define AT91C_PMC_IMR ((AT91_REG *) 0xFFFFFC6C) // (PMC) Interrupt Mask Register +#define AT91C_PMC_IDR ((AT91_REG *) 0xFFFFFC64) // (PMC) Interrupt Disable Register +#define AT91C_PMC_PCDR ((AT91_REG *) 0xFFFFFC14) // (PMC) Peripheral Clock Disable Register +#define AT91C_PMC_SCDR ((AT91_REG *) 0xFFFFFC04) // (PMC) System Clock Disable Register +#define AT91C_PMC_SR ((AT91_REG *) 0xFFFFFC68) // (PMC) Status Register +#define AT91C_PMC_IER ((AT91_REG *) 0xFFFFFC60) // (PMC) Interrupt Enable Register +#define AT91C_PMC_MCKR ((AT91_REG *) 0xFFFFFC30) // (PMC) Master Clock Register +#define AT91C_PMC_MOR ((AT91_REG *) 0xFFFFFC20) // (PMC) Main Oscillator Register +#define AT91C_PMC_PCER ((AT91_REG *) 0xFFFFFC10) // (PMC) Peripheral Clock Enable Register +#define AT91C_PMC_PCSR ((AT91_REG *) 0xFFFFFC18) // (PMC) Peripheral Clock Status Register +#define AT91C_PMC_PLLR ((AT91_REG *) 0xFFFFFC2C) // (PMC) PLL Register +#define AT91C_PMC_MCFR ((AT91_REG *) 0xFFFFFC24) // (PMC) Main Clock Frequency Register +#define AT91C_PMC_PCKR ((AT91_REG *) 0xFFFFFC40) // (PMC) Programmable Clock Register +// ========== Register definition for RSTC peripheral ========== +#define AT91C_RSTC_RSR ((AT91_REG *) 0xFFFFFD04) // (RSTC) Reset Status Register +#define AT91C_RSTC_RMR ((AT91_REG *) 0xFFFFFD08) // (RSTC) Reset Mode Register +#define AT91C_RSTC_RCR ((AT91_REG *) 0xFFFFFD00) // (RSTC) Reset Control Register +// ========== Register definition for RTTC peripheral ========== +#define AT91C_RTTC_RTSR ((AT91_REG *) 0xFFFFFD2C) // (RTTC) Real-time Status Register +#define AT91C_RTTC_RTAR ((AT91_REG *) 0xFFFFFD24) // (RTTC) Real-time Alarm Register +#define AT91C_RTTC_RTVR ((AT91_REG *) 0xFFFFFD28) // (RTTC) Real-time Value Register +#define AT91C_RTTC_RTMR ((AT91_REG *) 0xFFFFFD20) // (RTTC) Real-time Mode Register +// ========== Register definition for PITC peripheral ========== +#define AT91C_PITC_PIIR ((AT91_REG *) 0xFFFFFD3C) // (PITC) Period Interval Image Register +#define AT91C_PITC_PISR ((AT91_REG *) 0xFFFFFD34) // (PITC) Period Interval Status Register +#define AT91C_PITC_PIVR ((AT91_REG *) 0xFFFFFD38) // (PITC) Period Interval Value Register +#define AT91C_PITC_PIMR ((AT91_REG *) 0xFFFFFD30) // (PITC) Period Interval Mode Register +// ========== Register definition for WDTC peripheral ========== +#define AT91C_WDTC_WDMR ((AT91_REG *) 0xFFFFFD44) // (WDTC) Watchdog Mode Register +#define AT91C_WDTC_WDSR ((AT91_REG *) 0xFFFFFD48) // (WDTC) Watchdog Status Register +#define AT91C_WDTC_WDCR ((AT91_REG *) 0xFFFFFD40) // (WDTC) Watchdog Control Register +// ========== Register definition for VREG peripheral ========== +#define AT91C_VREG_MR ((AT91_REG *) 0xFFFFFD60) // (VREG) Voltage Regulator Mode Register +// ========== Register definition for MC peripheral ========== +#define AT91C_MC_FCR ((AT91_REG *) 0xFFFFFF64) // (MC) MC Flash Command Register +#define AT91C_MC_ASR ((AT91_REG *) 0xFFFFFF04) // (MC) MC Abort Status Register +#define AT91C_MC_FSR ((AT91_REG *) 0xFFFFFF68) // (MC) MC Flash Status Register +#define AT91C_MC_FMR ((AT91_REG *) 0xFFFFFF60) // (MC) MC Flash Mode Register +#define AT91C_MC_AASR ((AT91_REG *) 0xFFFFFF08) // (MC) MC Abort Address Status Register +#define AT91C_MC_RCR ((AT91_REG *) 0xFFFFFF00) // (MC) MC Remap Control Register +// ========== Register definition for PDC_SPI1 peripheral ========== +#define AT91C_SPI1_RNPR ((AT91_REG *) 0xFFFE4110) // (PDC_SPI1) Receive Next Pointer Register +#define AT91C_SPI1_TPR ((AT91_REG *) 0xFFFE4108) // (PDC_SPI1) Transmit Pointer Register +#define AT91C_SPI1_RPR ((AT91_REG *) 0xFFFE4100) // (PDC_SPI1) Receive Pointer Register +#define AT91C_SPI1_PTSR ((AT91_REG *) 0xFFFE4124) // (PDC_SPI1) PDC Transfer Status Register +#define AT91C_SPI1_RCR ((AT91_REG *) 0xFFFE4104) // (PDC_SPI1) Receive Counter Register +#define AT91C_SPI1_TCR ((AT91_REG *) 0xFFFE410C) // (PDC_SPI1) Transmit Counter Register +#define AT91C_SPI1_RNCR ((AT91_REG *) 0xFFFE4114) // (PDC_SPI1) Receive Next Counter Register +#define AT91C_SPI1_TNCR ((AT91_REG *) 0xFFFE411C) // (PDC_SPI1) Transmit Next Counter Register +#define AT91C_SPI1_TNPR ((AT91_REG *) 0xFFFE4118) // (PDC_SPI1) Transmit Next Pointer Register +#define AT91C_SPI1_PTCR ((AT91_REG *) 0xFFFE4120) // (PDC_SPI1) PDC Transfer Control Register +// ========== Register definition for SPI1 peripheral ========== +#define AT91C_SPI1_CSR ((AT91_REG *) 0xFFFE4030) // (SPI1) Chip Select Register +#define AT91C_SPI1_IDR ((AT91_REG *) 0xFFFE4018) // (SPI1) Interrupt Disable Register +#define AT91C_SPI1_SR ((AT91_REG *) 0xFFFE4010) // (SPI1) Status Register +#define AT91C_SPI1_RDR ((AT91_REG *) 0xFFFE4008) // (SPI1) Receive Data Register +#define AT91C_SPI1_CR ((AT91_REG *) 0xFFFE4000) // (SPI1) Control Register +#define AT91C_SPI1_IMR ((AT91_REG *) 0xFFFE401C) // (SPI1) Interrupt Mask Register +#define AT91C_SPI1_IER ((AT91_REG *) 0xFFFE4014) // (SPI1) Interrupt Enable Register +#define AT91C_SPI1_TDR ((AT91_REG *) 0xFFFE400C) // (SPI1) Transmit Data Register +#define AT91C_SPI1_MR ((AT91_REG *) 0xFFFE4004) // (SPI1) Mode Register +// ========== Register definition for PDC_SPI0 peripheral ========== +#define AT91C_SPI0_PTCR ((AT91_REG *) 0xFFFE0120) // (PDC_SPI0) PDC Transfer Control Register +#define AT91C_SPI0_TNPR ((AT91_REG *) 0xFFFE0118) // (PDC_SPI0) Transmit Next Pointer Register +#define AT91C_SPI0_RNPR ((AT91_REG *) 0xFFFE0110) // (PDC_SPI0) Receive Next Pointer Register +#define AT91C_SPI0_TPR ((AT91_REG *) 0xFFFE0108) // (PDC_SPI0) Transmit Pointer Register +#define AT91C_SPI0_RPR ((AT91_REG *) 0xFFFE0100) // (PDC_SPI0) Receive Pointer Register +#define AT91C_SPI0_PTSR ((AT91_REG *) 0xFFFE0124) // (PDC_SPI0) PDC Transfer Status Register +#define AT91C_SPI0_TNCR ((AT91_REG *) 0xFFFE011C) // (PDC_SPI0) Transmit Next Counter Register +#define AT91C_SPI0_RNCR ((AT91_REG *) 0xFFFE0114) // (PDC_SPI0) Receive Next Counter Register +#define AT91C_SPI0_TCR ((AT91_REG *) 0xFFFE010C) // (PDC_SPI0) Transmit Counter Register +#define AT91C_SPI0_RCR ((AT91_REG *) 0xFFFE0104) // (PDC_SPI0) Receive Counter Register +// ========== Register definition for SPI0 peripheral ========== +#define AT91C_SPI0_CSR ((AT91_REG *) 0xFFFE0030) // (SPI0) Chip Select Register +#define AT91C_SPI0_IDR ((AT91_REG *) 0xFFFE0018) // (SPI0) Interrupt Disable Register +#define AT91C_SPI0_SR ((AT91_REG *) 0xFFFE0010) // (SPI0) Status Register +#define AT91C_SPI0_RDR ((AT91_REG *) 0xFFFE0008) // (SPI0) Receive Data Register +#define AT91C_SPI0_CR ((AT91_REG *) 0xFFFE0000) // (SPI0) Control Register +#define AT91C_SPI0_IMR ((AT91_REG *) 0xFFFE001C) // (SPI0) Interrupt Mask Register +#define AT91C_SPI0_IER ((AT91_REG *) 0xFFFE0014) // (SPI0) Interrupt Enable Register +#define AT91C_SPI0_TDR ((AT91_REG *) 0xFFFE000C) // (SPI0) Transmit Data Register +#define AT91C_SPI0_MR ((AT91_REG *) 0xFFFE0004) // (SPI0) Mode Register +// ========== Register definition for PDC_US1 peripheral ========== +#define AT91C_US1_PTSR ((AT91_REG *) 0xFFFC4124) // (PDC_US1) PDC Transfer Status Register +#define AT91C_US1_TNCR ((AT91_REG *) 0xFFFC411C) // (PDC_US1) Transmit Next Counter Register +#define AT91C_US1_RNCR ((AT91_REG *) 0xFFFC4114) // (PDC_US1) Receive Next Counter Register +#define AT91C_US1_TCR ((AT91_REG *) 0xFFFC410C) // (PDC_US1) Transmit Counter Register +#define AT91C_US1_RCR ((AT91_REG *) 0xFFFC4104) // (PDC_US1) Receive Counter Register +#define AT91C_US1_PTCR ((AT91_REG *) 0xFFFC4120) // (PDC_US1) PDC Transfer Control Register +#define AT91C_US1_TNPR ((AT91_REG *) 0xFFFC4118) // (PDC_US1) Transmit Next Pointer Register +#define AT91C_US1_RNPR ((AT91_REG *) 0xFFFC4110) // (PDC_US1) Receive Next Pointer Register +#define AT91C_US1_TPR ((AT91_REG *) 0xFFFC4108) // (PDC_US1) Transmit Pointer Register +#define AT91C_US1_RPR ((AT91_REG *) 0xFFFC4100) // (PDC_US1) Receive Pointer Register +// ========== Register definition for US1 peripheral ========== +#define AT91C_US1_RHR ((AT91_REG *) 0xFFFC4018) // (US1) Receiver Holding Register +#define AT91C_US1_IMR ((AT91_REG *) 0xFFFC4010) // (US1) Interrupt Mask Register +#define AT91C_US1_IER ((AT91_REG *) 0xFFFC4008) // (US1) Interrupt Enable Register +#define AT91C_US1_CR ((AT91_REG *) 0xFFFC4000) // (US1) Control Register +#define AT91C_US1_RTOR ((AT91_REG *) 0xFFFC4024) // (US1) Receiver Time-out Register +#define AT91C_US1_THR ((AT91_REG *) 0xFFFC401C) // (US1) Transmitter Holding Register +#define AT91C_US1_CSR ((AT91_REG *) 0xFFFC4014) // (US1) Channel Status Register +#define AT91C_US1_IDR ((AT91_REG *) 0xFFFC400C) // (US1) Interrupt Disable Register +#define AT91C_US1_FIDI ((AT91_REG *) 0xFFFC4040) // (US1) FI_DI_Ratio Register +#define AT91C_US1_BRGR ((AT91_REG *) 0xFFFC4020) // (US1) Baud Rate Generator Register +#define AT91C_US1_TTGR ((AT91_REG *) 0xFFFC4028) // (US1) Transmitter Time-guard Register +#define AT91C_US1_IF ((AT91_REG *) 0xFFFC404C) // (US1) IRDA_FILTER Register +#define AT91C_US1_NER ((AT91_REG *) 0xFFFC4044) // (US1) Nb Errors Register +#define AT91C_US1_MR ((AT91_REG *) 0xFFFC4004) // (US1) Mode Register +// ========== Register definition for PDC_US0 peripheral ========== +#define AT91C_US0_PTCR ((AT91_REG *) 0xFFFC0120) // (PDC_US0) PDC Transfer Control Register +#define AT91C_US0_TNPR ((AT91_REG *) 0xFFFC0118) // (PDC_US0) Transmit Next Pointer Register +#define AT91C_US0_RNPR ((AT91_REG *) 0xFFFC0110) // (PDC_US0) Receive Next Pointer Register +#define AT91C_US0_TPR ((AT91_REG *) 0xFFFC0108) // (PDC_US0) Transmit Pointer Register +#define AT91C_US0_RPR ((AT91_REG *) 0xFFFC0100) // (PDC_US0) Receive Pointer Register +#define AT91C_US0_PTSR ((AT91_REG *) 0xFFFC0124) // (PDC_US0) PDC Transfer Status Register +#define AT91C_US0_TNCR ((AT91_REG *) 0xFFFC011C) // (PDC_US0) Transmit Next Counter Register +#define AT91C_US0_RNCR ((AT91_REG *) 0xFFFC0114) // (PDC_US0) Receive Next Counter Register +#define AT91C_US0_TCR ((AT91_REG *) 0xFFFC010C) // (PDC_US0) Transmit Counter Register +#define AT91C_US0_RCR ((AT91_REG *) 0xFFFC0104) // (PDC_US0) Receive Counter Register +// ========== Register definition for US0 peripheral ========== +#define AT91C_US0_TTGR ((AT91_REG *) 0xFFFC0028) // (US0) Transmitter Time-guard Register +#define AT91C_US0_BRGR ((AT91_REG *) 0xFFFC0020) // (US0) Baud Rate Generator Register +#define AT91C_US0_RHR ((AT91_REG *) 0xFFFC0018) // (US0) Receiver Holding Register +#define AT91C_US0_IMR ((AT91_REG *) 0xFFFC0010) // (US0) Interrupt Mask Register +#define AT91C_US0_NER ((AT91_REG *) 0xFFFC0044) // (US0) Nb Errors Register +#define AT91C_US0_RTOR ((AT91_REG *) 0xFFFC0024) // (US0) Receiver Time-out Register +#define AT91C_US0_FIDI ((AT91_REG *) 0xFFFC0040) // (US0) FI_DI_Ratio Register +#define AT91C_US0_CR ((AT91_REG *) 0xFFFC0000) // (US0) Control Register +#define AT91C_US0_IER ((AT91_REG *) 0xFFFC0008) // (US0) Interrupt Enable Register +#define AT91C_US0_IF ((AT91_REG *) 0xFFFC004C) // (US0) IRDA_FILTER Register +#define AT91C_US0_MR ((AT91_REG *) 0xFFFC0004) // (US0) Mode Register +#define AT91C_US0_IDR ((AT91_REG *) 0xFFFC000C) // (US0) Interrupt Disable Register +#define AT91C_US0_CSR ((AT91_REG *) 0xFFFC0014) // (US0) Channel Status Register +#define AT91C_US0_THR ((AT91_REG *) 0xFFFC001C) // (US0) Transmitter Holding Register +// ========== Register definition for PDC_SSC peripheral ========== +#define AT91C_SSC_PTCR ((AT91_REG *) 0xFFFD4120) // (PDC_SSC) PDC Transfer Control Register +#define AT91C_SSC_TNPR ((AT91_REG *) 0xFFFD4118) // (PDC_SSC) Transmit Next Pointer Register +#define AT91C_SSC_RNPR ((AT91_REG *) 0xFFFD4110) // (PDC_SSC) Receive Next Pointer Register +#define AT91C_SSC_TPR ((AT91_REG *) 0xFFFD4108) // (PDC_SSC) Transmit Pointer Register +#define AT91C_SSC_RPR ((AT91_REG *) 0xFFFD4100) // (PDC_SSC) Receive Pointer Register +#define AT91C_SSC_PTSR ((AT91_REG *) 0xFFFD4124) // (PDC_SSC) PDC Transfer Status Register +#define AT91C_SSC_TNCR ((AT91_REG *) 0xFFFD411C) // (PDC_SSC) Transmit Next Counter Register +#define AT91C_SSC_RNCR ((AT91_REG *) 0xFFFD4114) // (PDC_SSC) Receive Next Counter Register +#define AT91C_SSC_TCR ((AT91_REG *) 0xFFFD410C) // (PDC_SSC) Transmit Counter Register +#define AT91C_SSC_RCR ((AT91_REG *) 0xFFFD4104) // (PDC_SSC) Receive Counter Register +// ========== Register definition for SSC peripheral ========== +#define AT91C_SSC_RFMR ((AT91_REG *) 0xFFFD4014) // (SSC) Receive Frame Mode Register +#define AT91C_SSC_CMR ((AT91_REG *) 0xFFFD4004) // (SSC) Clock Mode Register +#define AT91C_SSC_IDR ((AT91_REG *) 0xFFFD4048) // (SSC) Interrupt Disable Register +#define AT91C_SSC_SR ((AT91_REG *) 0xFFFD4040) // (SSC) Status Register +#define AT91C_SSC_RSHR ((AT91_REG *) 0xFFFD4030) // (SSC) Receive Sync Holding Register +#define AT91C_SSC_RHR ((AT91_REG *) 0xFFFD4020) // (SSC) Receive Holding Register +#define AT91C_SSC_TCMR ((AT91_REG *) 0xFFFD4018) // (SSC) Transmit Clock Mode Register +#define AT91C_SSC_RCMR ((AT91_REG *) 0xFFFD4010) // (SSC) Receive Clock ModeRegister +#define AT91C_SSC_CR ((AT91_REG *) 0xFFFD4000) // (SSC) Control Register +#define AT91C_SSC_IMR ((AT91_REG *) 0xFFFD404C) // (SSC) Interrupt Mask Register +#define AT91C_SSC_IER ((AT91_REG *) 0xFFFD4044) // (SSC) Interrupt Enable Register +#define AT91C_SSC_TSHR ((AT91_REG *) 0xFFFD4034) // (SSC) Transmit Sync Holding Register +#define AT91C_SSC_THR ((AT91_REG *) 0xFFFD4024) // (SSC) Transmit Holding Register +#define AT91C_SSC_TFMR ((AT91_REG *) 0xFFFD401C) // (SSC) Transmit Frame Mode Register +// ========== Register definition for TWI peripheral ========== +#define AT91C_TWI_RHR ((AT91_REG *) 0xFFFB8030) // (TWI) Receive Holding Register +#define AT91C_TWI_IDR ((AT91_REG *) 0xFFFB8028) // (TWI) Interrupt Disable Register +#define AT91C_TWI_SR ((AT91_REG *) 0xFFFB8020) // (TWI) Status Register +#define AT91C_TWI_CWGR ((AT91_REG *) 0xFFFB8010) // (TWI) Clock Waveform Generator Register +#define AT91C_TWI_CR ((AT91_REG *) 0xFFFB8000) // (TWI) Control Register +#define AT91C_TWI_THR ((AT91_REG *) 0xFFFB8034) // (TWI) Transmit Holding Register +#define AT91C_TWI_IMR ((AT91_REG *) 0xFFFB802C) // (TWI) Interrupt Mask Register +#define AT91C_TWI_IER ((AT91_REG *) 0xFFFB8024) // (TWI) Interrupt Enable Register +#define AT91C_TWI_IADR ((AT91_REG *) 0xFFFB800C) // (TWI) Internal Address Register +#define AT91C_TWI_MMR ((AT91_REG *) 0xFFFB8004) // (TWI) Master Mode Register +// ========== Register definition for PWMC_CH3 peripheral ========== +#define AT91C_PWMC_CH3_CUPDR ((AT91_REG *) 0xFFFCC270) // (PWMC_CH3) Channel Update Register +#define AT91C_PWMC_CH3_CPRDR ((AT91_REG *) 0xFFFCC268) // (PWMC_CH3) Channel Period Register +#define AT91C_PWMC_CH3_CMR ((AT91_REG *) 0xFFFCC260) // (PWMC_CH3) Channel Mode Register +#define AT91C_PWMC_CH3_Reserved ((AT91_REG *) 0xFFFCC274) // (PWMC_CH3) Reserved +#define AT91C_PWMC_CH3_CCNTR ((AT91_REG *) 0xFFFCC26C) // (PWMC_CH3) Channel Counter Register +#define AT91C_PWMC_CH3_CDTYR ((AT91_REG *) 0xFFFCC264) // (PWMC_CH3) Channel Duty Cycle Register +// ========== Register definition for PWMC_CH2 peripheral ========== +#define AT91C_PWMC_CH2_CUPDR ((AT91_REG *) 0xFFFCC250) // (PWMC_CH2) Channel Update Register +#define AT91C_PWMC_CH2_CPRDR ((AT91_REG *) 0xFFFCC248) // (PWMC_CH2) Channel Period Register +#define AT91C_PWMC_CH2_CMR ((AT91_REG *) 0xFFFCC240) // (PWMC_CH2) Channel Mode Register +#define AT91C_PWMC_CH2_Reserved ((AT91_REG *) 0xFFFCC254) // (PWMC_CH2) Reserved +#define AT91C_PWMC_CH2_CCNTR ((AT91_REG *) 0xFFFCC24C) // (PWMC_CH2) Channel Counter Register +#define AT91C_PWMC_CH2_CDTYR ((AT91_REG *) 0xFFFCC244) // (PWMC_CH2) Channel Duty Cycle Register +// ========== Register definition for PWMC_CH1 peripheral ========== +#define AT91C_PWMC_CH1_CUPDR ((AT91_REG *) 0xFFFCC230) // (PWMC_CH1) Channel Update Register +#define AT91C_PWMC_CH1_CPRDR ((AT91_REG *) 0xFFFCC228) // (PWMC_CH1) Channel Period Register +#define AT91C_PWMC_CH1_CMR ((AT91_REG *) 0xFFFCC220) // (PWMC_CH1) Channel Mode Register +#define AT91C_PWMC_CH1_Reserved ((AT91_REG *) 0xFFFCC234) // (PWMC_CH1) Reserved +#define AT91C_PWMC_CH1_CCNTR ((AT91_REG *) 0xFFFCC22C) // (PWMC_CH1) Channel Counter Register +#define AT91C_PWMC_CH1_CDTYR ((AT91_REG *) 0xFFFCC224) // (PWMC_CH1) Channel Duty Cycle Register +// ========== Register definition for PWMC_CH0 peripheral ========== +#define AT91C_PWMC_CH0_CUPDR ((AT91_REG *) 0xFFFCC210) // (PWMC_CH0) Channel Update Register +#define AT91C_PWMC_CH0_CPRDR ((AT91_REG *) 0xFFFCC208) // (PWMC_CH0) Channel Period Register +#define AT91C_PWMC_CH0_CMR ((AT91_REG *) 0xFFFCC200) // (PWMC_CH0) Channel Mode Register +#define AT91C_PWMC_CH0_Reserved ((AT91_REG *) 0xFFFCC214) // (PWMC_CH0) Reserved +#define AT91C_PWMC_CH0_CCNTR ((AT91_REG *) 0xFFFCC20C) // (PWMC_CH0) Channel Counter Register +#define AT91C_PWMC_CH0_CDTYR ((AT91_REG *) 0xFFFCC204) // (PWMC_CH0) Channel Duty Cycle Register +// ========== Register definition for PWMC peripheral ========== +#define AT91C_PWMC_VR ((AT91_REG *) 0xFFFCC0FC) // (PWMC) PWMC Version Register +#define AT91C_PWMC_ISR ((AT91_REG *) 0xFFFCC01C) // (PWMC) PWMC Interrupt Status Register +#define AT91C_PWMC_IDR ((AT91_REG *) 0xFFFCC014) // (PWMC) PWMC Interrupt Disable Register +#define AT91C_PWMC_SR ((AT91_REG *) 0xFFFCC00C) // (PWMC) PWMC Status Register +#define AT91C_PWMC_ENA ((AT91_REG *) 0xFFFCC004) // (PWMC) PWMC Enable Register +#define AT91C_PWMC_IMR ((AT91_REG *) 0xFFFCC018) // (PWMC) PWMC Interrupt Mask Register +#define AT91C_PWMC_MR ((AT91_REG *) 0xFFFCC000) // (PWMC) PWMC Mode Register +#define AT91C_PWMC_DIS ((AT91_REG *) 0xFFFCC008) // (PWMC) PWMC Disable Register +#define AT91C_PWMC_IER ((AT91_REG *) 0xFFFCC010) // (PWMC) PWMC Interrupt Enable Register +// ========== Register definition for UDP peripheral ========== +#define AT91C_UDP_TXVC ((AT91_REG *) 0xFFFB0074) // (UDP) Transceiver Control Register +#define AT91C_UDP_ISR ((AT91_REG *) 0xFFFB001C) // (UDP) Interrupt Status Register +#define AT91C_UDP_IDR ((AT91_REG *) 0xFFFB0014) // (UDP) Interrupt Disable Register +#define AT91C_UDP_CSR ((AT91_REG *) 0xFFFB0030) // (UDP) Endpoint Control and Status Register +#define AT91C_UDP_RSTEP ((AT91_REG *) 0xFFFB0028) // (UDP) Reset Endpoint Register +#define AT91C_UDP_ICR ((AT91_REG *) 0xFFFB0020) // (UDP) Interrupt Clear Register +#define AT91C_UDP_GLBSTATE ((AT91_REG *) 0xFFFB0004) // (UDP) Global State Register +#define AT91C_UDP_NUM ((AT91_REG *) 0xFFFB0000) // (UDP) Frame Number Register +#define AT91C_UDP_FADDR ((AT91_REG *) 0xFFFB0008) // (UDP) Function Address Register +#define AT91C_UDP_IER ((AT91_REG *) 0xFFFB0010) // (UDP) Interrupt Enable Register +#define AT91C_UDP_IMR ((AT91_REG *) 0xFFFB0018) // (UDP) Interrupt Mask Register +#define AT91C_UDP_FDR ((AT91_REG *) 0xFFFB0050) // (UDP) Endpoint FIFO Data Register +// ========== Register definition for TC0 peripheral ========== +#define AT91C_TC0_IMR ((AT91_REG *) 0xFFFA002C) // (TC0) Interrupt Mask Register +#define AT91C_TC0_IER ((AT91_REG *) 0xFFFA0024) // (TC0) Interrupt Enable Register +#define AT91C_TC0_RC ((AT91_REG *) 0xFFFA001C) // (TC0) Register C +#define AT91C_TC0_RA ((AT91_REG *) 0xFFFA0014) // (TC0) Register A +#define AT91C_TC0_CMR ((AT91_REG *) 0xFFFA0004) // (TC0) Channel Mode Register (Capture Mode / Waveform Mode) +#define AT91C_TC0_IDR ((AT91_REG *) 0xFFFA0028) // (TC0) Interrupt Disable Register +#define AT91C_TC0_SR ((AT91_REG *) 0xFFFA0020) // (TC0) Status Register +#define AT91C_TC0_RB ((AT91_REG *) 0xFFFA0018) // (TC0) Register B +#define AT91C_TC0_CV ((AT91_REG *) 0xFFFA0010) // (TC0) Counter Value +#define AT91C_TC0_CCR ((AT91_REG *) 0xFFFA0000) // (TC0) Channel Control Register +// ========== Register definition for TC1 peripheral ========== +#define AT91C_TC1_IMR ((AT91_REG *) 0xFFFA006C) // (TC1) Interrupt Mask Register +#define AT91C_TC1_IER ((AT91_REG *) 0xFFFA0064) // (TC1) Interrupt Enable Register +#define AT91C_TC1_RC ((AT91_REG *) 0xFFFA005C) // (TC1) Register C +#define AT91C_TC1_RA ((AT91_REG *) 0xFFFA0054) // (TC1) Register A +#define AT91C_TC1_CMR ((AT91_REG *) 0xFFFA0044) // (TC1) Channel Mode Register (Capture Mode / Waveform Mode) +#define AT91C_TC1_IDR ((AT91_REG *) 0xFFFA0068) // (TC1) Interrupt Disable Register +#define AT91C_TC1_SR ((AT91_REG *) 0xFFFA0060) // (TC1) Status Register +#define AT91C_TC1_RB ((AT91_REG *) 0xFFFA0058) // (TC1) Register B +#define AT91C_TC1_CV ((AT91_REG *) 0xFFFA0050) // (TC1) Counter Value +#define AT91C_TC1_CCR ((AT91_REG *) 0xFFFA0040) // (TC1) Channel Control Register +// ========== Register definition for TC2 peripheral ========== +#define AT91C_TC2_IMR ((AT91_REG *) 0xFFFA00AC) // (TC2) Interrupt Mask Register +#define AT91C_TC2_IER ((AT91_REG *) 0xFFFA00A4) // (TC2) Interrupt Enable Register +#define AT91C_TC2_RC ((AT91_REG *) 0xFFFA009C) // (TC2) Register C +#define AT91C_TC2_RA ((AT91_REG *) 0xFFFA0094) // (TC2) Register A +#define AT91C_TC2_CMR ((AT91_REG *) 0xFFFA0084) // (TC2) Channel Mode Register (Capture Mode / Waveform Mode) +#define AT91C_TC2_IDR ((AT91_REG *) 0xFFFA00A8) // (TC2) Interrupt Disable Register +#define AT91C_TC2_SR ((AT91_REG *) 0xFFFA00A0) // (TC2) Status Register +#define AT91C_TC2_RB ((AT91_REG *) 0xFFFA0098) // (TC2) Register B +#define AT91C_TC2_CV ((AT91_REG *) 0xFFFA0090) // (TC2) Counter Value +#define AT91C_TC2_CCR ((AT91_REG *) 0xFFFA0080) // (TC2) Channel Control Register +// ========== Register definition for TCB peripheral ========== +#define AT91C_TCB_BMR ((AT91_REG *) 0xFFFA00C4) // (TCB) TC Block Mode Register +#define AT91C_TCB_BCR ((AT91_REG *) 0xFFFA00C0) // (TCB) TC Block Control Register +// ========== Register definition for CAN_MB0 peripheral ========== +#define AT91C_CAN_MB0_MCR ((AT91_REG *) 0xFFFD021C) // (CAN_MB0) MailBox Control Register +#define AT91C_CAN_MB0_MDL ((AT91_REG *) 0xFFFD0214) // (CAN_MB0) MailBox Data Low Register +#define AT91C_CAN_MB0_MFID ((AT91_REG *) 0xFFFD020C) // (CAN_MB0) MailBox Family ID Register +#define AT91C_CAN_MB0_MAM ((AT91_REG *) 0xFFFD0204) // (CAN_MB0) MailBox Acceptance Mask Register +#define AT91C_CAN_MB0_MDH ((AT91_REG *) 0xFFFD0218) // (CAN_MB0) MailBox Data High Register +#define AT91C_CAN_MB0_MSR ((AT91_REG *) 0xFFFD0210) // (CAN_MB0) MailBox Status Register +#define AT91C_CAN_MB0_MID ((AT91_REG *) 0xFFFD0208) // (CAN_MB0) MailBox ID Register +#define AT91C_CAN_MB0_MMR ((AT91_REG *) 0xFFFD0200) // (CAN_MB0) MailBox Mode Register +// ========== Register definition for CAN_MB1 peripheral ========== +#define AT91C_CAN_MB1_MCR ((AT91_REG *) 0xFFFD023C) // (CAN_MB1) MailBox Control Register +#define AT91C_CAN_MB1_MDL ((AT91_REG *) 0xFFFD0234) // (CAN_MB1) MailBox Data Low Register +#define AT91C_CAN_MB1_MFID ((AT91_REG *) 0xFFFD022C) // (CAN_MB1) MailBox Family ID Register +#define AT91C_CAN_MB1_MAM ((AT91_REG *) 0xFFFD0224) // (CAN_MB1) MailBox Acceptance Mask Register +#define AT91C_CAN_MB1_MDH ((AT91_REG *) 0xFFFD0238) // (CAN_MB1) MailBox Data High Register +#define AT91C_CAN_MB1_MSR ((AT91_REG *) 0xFFFD0230) // (CAN_MB1) MailBox Status Register +#define AT91C_CAN_MB1_MID ((AT91_REG *) 0xFFFD0228) // (CAN_MB1) MailBox ID Register +#define AT91C_CAN_MB1_MMR ((AT91_REG *) 0xFFFD0220) // (CAN_MB1) MailBox Mode Register +// ========== Register definition for CAN_MB2 peripheral ========== +#define AT91C_CAN_MB2_MCR ((AT91_REG *) 0xFFFD025C) // (CAN_MB2) MailBox Control Register +#define AT91C_CAN_MB2_MDL ((AT91_REG *) 0xFFFD0254) // (CAN_MB2) MailBox Data Low Register +#define AT91C_CAN_MB2_MFID ((AT91_REG *) 0xFFFD024C) // (CAN_MB2) MailBox Family ID Register +#define AT91C_CAN_MB2_MAM ((AT91_REG *) 0xFFFD0244) // (CAN_MB2) MailBox Acceptance Mask Register +#define AT91C_CAN_MB2_MDH ((AT91_REG *) 0xFFFD0258) // (CAN_MB2) MailBox Data High Register +#define AT91C_CAN_MB2_MSR ((AT91_REG *) 0xFFFD0250) // (CAN_MB2) MailBox Status Register +#define AT91C_CAN_MB2_MID ((AT91_REG *) 0xFFFD0248) // (CAN_MB2) MailBox ID Register +#define AT91C_CAN_MB2_MMR ((AT91_REG *) 0xFFFD0240) // (CAN_MB2) MailBox Mode Register +// ========== Register definition for CAN_MB3 peripheral ========== +#define AT91C_CAN_MB3_MCR ((AT91_REG *) 0xFFFD027C) // (CAN_MB3) MailBox Control Register +#define AT91C_CAN_MB3_MDL ((AT91_REG *) 0xFFFD0274) // (CAN_MB3) MailBox Data Low Register +#define AT91C_CAN_MB3_MFID ((AT91_REG *) 0xFFFD026C) // (CAN_MB3) MailBox Family ID Register +#define AT91C_CAN_MB3_MAM ((AT91_REG *) 0xFFFD0264) // (CAN_MB3) MailBox Acceptance Mask Register +#define AT91C_CAN_MB3_MDH ((AT91_REG *) 0xFFFD0278) // (CAN_MB3) MailBox Data High Register +#define AT91C_CAN_MB3_MSR ((AT91_REG *) 0xFFFD0270) // (CAN_MB3) MailBox Status Register +#define AT91C_CAN_MB3_MID ((AT91_REG *) 0xFFFD0268) // (CAN_MB3) MailBox ID Register +#define AT91C_CAN_MB3_MMR ((AT91_REG *) 0xFFFD0260) // (CAN_MB3) MailBox Mode Register +// ========== Register definition for CAN_MB4 peripheral ========== +#define AT91C_CAN_MB4_MCR ((AT91_REG *) 0xFFFD029C) // (CAN_MB4) MailBox Control Register +#define AT91C_CAN_MB4_MDL ((AT91_REG *) 0xFFFD0294) // (CAN_MB4) MailBox Data Low Register +#define AT91C_CAN_MB4_MFID ((AT91_REG *) 0xFFFD028C) // (CAN_MB4) MailBox Family ID Register +#define AT91C_CAN_MB4_MAM ((AT91_REG *) 0xFFFD0284) // (CAN_MB4) MailBox Acceptance Mask Register +#define AT91C_CAN_MB4_MDH ((AT91_REG *) 0xFFFD0298) // (CAN_MB4) MailBox Data High Register +#define AT91C_CAN_MB4_MSR ((AT91_REG *) 0xFFFD0290) // (CAN_MB4) MailBox Status Register +#define AT91C_CAN_MB4_MID ((AT91_REG *) 0xFFFD0288) // (CAN_MB4) MailBox ID Register +#define AT91C_CAN_MB4_MMR ((AT91_REG *) 0xFFFD0280) // (CAN_MB4) MailBox Mode Register +// ========== Register definition for CAN_MB5 peripheral ========== +#define AT91C_CAN_MB5_MCR ((AT91_REG *) 0xFFFD02BC) // (CAN_MB5) MailBox Control Register +#define AT91C_CAN_MB5_MDL ((AT91_REG *) 0xFFFD02B4) // (CAN_MB5) MailBox Data Low Register +#define AT91C_CAN_MB5_MFID ((AT91_REG *) 0xFFFD02AC) // (CAN_MB5) MailBox Family ID Register +#define AT91C_CAN_MB5_MAM ((AT91_REG *) 0xFFFD02A4) // (CAN_MB5) MailBox Acceptance Mask Register +#define AT91C_CAN_MB5_MDH ((AT91_REG *) 0xFFFD02B8) // (CAN_MB5) MailBox Data High Register +#define AT91C_CAN_MB5_MSR ((AT91_REG *) 0xFFFD02B0) // (CAN_MB5) MailBox Status Register +#define AT91C_CAN_MB5_MID ((AT91_REG *) 0xFFFD02A8) // (CAN_MB5) MailBox ID Register +#define AT91C_CAN_MB5_MMR ((AT91_REG *) 0xFFFD02A0) // (CAN_MB5) MailBox Mode Register +// ========== Register definition for CAN_MB6 peripheral ========== +#define AT91C_CAN_MB6_MAM ((AT91_REG *) 0xFFFD02C4) // (CAN_MB6) MailBox Acceptance Mask Register +#define AT91C_CAN_MB6_MDH ((AT91_REG *) 0xFFFD02D8) // (CAN_MB6) MailBox Data High Register +#define AT91C_CAN_MB6_MSR ((AT91_REG *) 0xFFFD02D0) // (CAN_MB6) MailBox Status Register +#define AT91C_CAN_MB6_MID ((AT91_REG *) 0xFFFD02C8) // (CAN_MB6) MailBox ID Register +#define AT91C_CAN_MB6_MMR ((AT91_REG *) 0xFFFD02C0) // (CAN_MB6) MailBox Mode Register +#define AT91C_CAN_MB6_MCR ((AT91_REG *) 0xFFFD02DC) // (CAN_MB6) MailBox Control Register +#define AT91C_CAN_MB6_MDL ((AT91_REG *) 0xFFFD02D4) // (CAN_MB6) MailBox Data Low Register +#define AT91C_CAN_MB6_MFID ((AT91_REG *) 0xFFFD02CC) // (CAN_MB6) MailBox Family ID Register +// ========== Register definition for CAN_MB7 peripheral ========== +#define AT91C_CAN_MB7_MDH ((AT91_REG *) 0xFFFD02F8) // (CAN_MB7) MailBox Data High Register +#define AT91C_CAN_MB7_MSR ((AT91_REG *) 0xFFFD02F0) // (CAN_MB7) MailBox Status Register +#define AT91C_CAN_MB7_MID ((AT91_REG *) 0xFFFD02E8) // (CAN_MB7) MailBox ID Register +#define AT91C_CAN_MB7_MMR ((AT91_REG *) 0xFFFD02E0) // (CAN_MB7) MailBox Mode Register +#define AT91C_CAN_MB7_MCR ((AT91_REG *) 0xFFFD02FC) // (CAN_MB7) MailBox Control Register +#define AT91C_CAN_MB7_MDL ((AT91_REG *) 0xFFFD02F4) // (CAN_MB7) MailBox Data Low Register +#define AT91C_CAN_MB7_MFID ((AT91_REG *) 0xFFFD02EC) // (CAN_MB7) MailBox Family ID Register +#define AT91C_CAN_MB7_MAM ((AT91_REG *) 0xFFFD02E4) // (CAN_MB7) MailBox Acceptance Mask Register +// ========== Register definition for CAN peripheral ========== +#define AT91C_CAN_IMR ((AT91_REG *) 0xFFFD000C) // (CAN) Interrupt Mask Register +#define AT91C_CAN_IER ((AT91_REG *) 0xFFFD0004) // (CAN) Interrupt Enable Register +#define AT91C_CAN_ECR ((AT91_REG *) 0xFFFD0020) // (CAN) Error Counter Register +#define AT91C_CAN_TIM ((AT91_REG *) 0xFFFD0018) // (CAN) Timer Register +#define AT91C_CAN_SR ((AT91_REG *) 0xFFFD0010) // (CAN) Status Register +#define AT91C_CAN_IDR ((AT91_REG *) 0xFFFD0008) // (CAN) Interrupt Disable Register +#define AT91C_CAN_MR ((AT91_REG *) 0xFFFD0000) // (CAN) Mode Register +#define AT91C_CAN_BR ((AT91_REG *) 0xFFFD0014) // (CAN) Baudrate Register +#define AT91C_CAN_TIMESTP ((AT91_REG *) 0xFFFD001C) // (CAN) Time Stamp Register +#define AT91C_CAN_TCR ((AT91_REG *) 0xFFFD0024) // (CAN) Transfer Command Register +#define AT91C_CAN_ACR ((AT91_REG *) 0xFFFD0028) // (CAN) Abort Command Register +#define AT91C_CAN_VR ((AT91_REG *) 0xFFFD00FC) // (CAN) Version Register +// ========== Register definition for EMAC peripheral ========== +#define AT91C_EMAC_TID ((AT91_REG *) 0xFFFDC0B8) // (EMAC) Type ID Checking Register +#define AT91C_EMAC_SA3L ((AT91_REG *) 0xFFFDC0A8) // (EMAC) Specific Address 3 Bottom, First 4 bytes +#define AT91C_EMAC_STE ((AT91_REG *) 0xFFFDC084) // (EMAC) SQE Test Error Register +#define AT91C_EMAC_RSE ((AT91_REG *) 0xFFFDC074) // (EMAC) Receive Symbol Errors Register +#define AT91C_EMAC_IDR ((AT91_REG *) 0xFFFDC02C) // (EMAC) Interrupt Disable Register +#define AT91C_EMAC_TBQP ((AT91_REG *) 0xFFFDC01C) // (EMAC) Transmit Buffer Queue Pointer +#define AT91C_EMAC_TPQ ((AT91_REG *) 0xFFFDC0BC) // (EMAC) Transmit Pause Quantum Register +#define AT91C_EMAC_SA1L ((AT91_REG *) 0xFFFDC098) // (EMAC) Specific Address 1 Bottom, First 4 bytes +#define AT91C_EMAC_RLE ((AT91_REG *) 0xFFFDC088) // (EMAC) Receive Length Field Mismatch Register +#define AT91C_EMAC_IMR ((AT91_REG *) 0xFFFDC030) // (EMAC) Interrupt Mask Register +#define AT91C_EMAC_SA1H ((AT91_REG *) 0xFFFDC09C) // (EMAC) Specific Address 1 Top, Last 2 bytes +#define AT91C_EMAC_PFR ((AT91_REG *) 0xFFFDC03C) // (EMAC) Pause Frames received Register +#define AT91C_EMAC_FCSE ((AT91_REG *) 0xFFFDC050) // (EMAC) Frame Check Sequence Error Register +#define AT91C_EMAC_FTO ((AT91_REG *) 0xFFFDC040) // (EMAC) Frames Transmitted OK Register +#define AT91C_EMAC_TUND ((AT91_REG *) 0xFFFDC064) // (EMAC) Transmit Underrun Error Register +#define AT91C_EMAC_ALE ((AT91_REG *) 0xFFFDC054) // (EMAC) Alignment Error Register +#define AT91C_EMAC_SCF ((AT91_REG *) 0xFFFDC044) // (EMAC) Single Collision Frame Register +#define AT91C_EMAC_SA3H ((AT91_REG *) 0xFFFDC0AC) // (EMAC) Specific Address 3 Top, Last 2 bytes +#define AT91C_EMAC_ELE ((AT91_REG *) 0xFFFDC078) // (EMAC) Excessive Length Errors Register +#define AT91C_EMAC_CSE ((AT91_REG *) 0xFFFDC068) // (EMAC) Carrier Sense Error Register +#define AT91C_EMAC_DTF ((AT91_REG *) 0xFFFDC058) // (EMAC) Deferred Transmission Frame Register +#define AT91C_EMAC_RSR ((AT91_REG *) 0xFFFDC020) // (EMAC) Receive Status Register +#define AT91C_EMAC_USRIO ((AT91_REG *) 0xFFFDC0C0) // (EMAC) USER Input/Output Register +#define AT91C_EMAC_SA4L ((AT91_REG *) 0xFFFDC0B0) // (EMAC) Specific Address 4 Bottom, First 4 bytes +#define AT91C_EMAC_RRE ((AT91_REG *) 0xFFFDC06C) // (EMAC) Receive Ressource Error Register +#define AT91C_EMAC_RJA ((AT91_REG *) 0xFFFDC07C) // (EMAC) Receive Jabbers Register +#define AT91C_EMAC_TPF ((AT91_REG *) 0xFFFDC08C) // (EMAC) Transmitted Pause Frames Register +#define AT91C_EMAC_ISR ((AT91_REG *) 0xFFFDC024) // (EMAC) Interrupt Status Register +#define AT91C_EMAC_MAN ((AT91_REG *) 0xFFFDC034) // (EMAC) PHY Maintenance Register +#define AT91C_EMAC_WOL ((AT91_REG *) 0xFFFDC0C4) // (EMAC) Wake On LAN Register +#define AT91C_EMAC_USF ((AT91_REG *) 0xFFFDC080) // (EMAC) Undersize Frames Register +#define AT91C_EMAC_HRB ((AT91_REG *) 0xFFFDC090) // (EMAC) Hash Address Bottom[31:0] +#define AT91C_EMAC_PTR ((AT91_REG *) 0xFFFDC038) // (EMAC) Pause Time Register +#define AT91C_EMAC_HRT ((AT91_REG *) 0xFFFDC094) // (EMAC) Hash Address Top[63:32] +#define AT91C_EMAC_REV ((AT91_REG *) 0xFFFDC0FC) // (EMAC) Revision Register +#define AT91C_EMAC_MCF ((AT91_REG *) 0xFFFDC048) // (EMAC) Multiple Collision Frame Register +#define AT91C_EMAC_SA2L ((AT91_REG *) 0xFFFDC0A0) // (EMAC) Specific Address 2 Bottom, First 4 bytes +#define AT91C_EMAC_NCR ((AT91_REG *) 0xFFFDC000) // (EMAC) Network Control Register +#define AT91C_EMAC_FRO ((AT91_REG *) 0xFFFDC04C) // (EMAC) Frames Received OK Register +#define AT91C_EMAC_LCOL ((AT91_REG *) 0xFFFDC05C) // (EMAC) Late Collision Register +#define AT91C_EMAC_SA4H ((AT91_REG *) 0xFFFDC0B4) // (EMAC) Specific Address 4 Top, Last 2 bytes +#define AT91C_EMAC_NCFGR ((AT91_REG *) 0xFFFDC004) // (EMAC) Network Configuration Register +#define AT91C_EMAC_TSR ((AT91_REG *) 0xFFFDC014) // (EMAC) Transmit Status Register +#define AT91C_EMAC_SA2H ((AT91_REG *) 0xFFFDC0A4) // (EMAC) Specific Address 2 Top, Last 2 bytes +#define AT91C_EMAC_ECOL ((AT91_REG *) 0xFFFDC060) // (EMAC) Excessive Collision Register +#define AT91C_EMAC_ROV ((AT91_REG *) 0xFFFDC070) // (EMAC) Receive Overrun Errors Register +#define AT91C_EMAC_NSR ((AT91_REG *) 0xFFFDC008) // (EMAC) Network Status Register +#define AT91C_EMAC_RBQP ((AT91_REG *) 0xFFFDC018) // (EMAC) Receive Buffer Queue Pointer +#define AT91C_EMAC_IER ((AT91_REG *) 0xFFFDC028) // (EMAC) Interrupt Enable Register +// ========== Register definition for PDC_ADC peripheral ========== +#define AT91C_ADC_PTCR ((AT91_REG *) 0xFFFD8120) // (PDC_ADC) PDC Transfer Control Register +#define AT91C_ADC_TNPR ((AT91_REG *) 0xFFFD8118) // (PDC_ADC) Transmit Next Pointer Register +#define AT91C_ADC_RNPR ((AT91_REG *) 0xFFFD8110) // (PDC_ADC) Receive Next Pointer Register +#define AT91C_ADC_TPR ((AT91_REG *) 0xFFFD8108) // (PDC_ADC) Transmit Pointer Register +#define AT91C_ADC_RPR ((AT91_REG *) 0xFFFD8100) // (PDC_ADC) Receive Pointer Register +#define AT91C_ADC_PTSR ((AT91_REG *) 0xFFFD8124) // (PDC_ADC) PDC Transfer Status Register +#define AT91C_ADC_TNCR ((AT91_REG *) 0xFFFD811C) // (PDC_ADC) Transmit Next Counter Register +#define AT91C_ADC_RNCR ((AT91_REG *) 0xFFFD8114) // (PDC_ADC) Receive Next Counter Register +#define AT91C_ADC_TCR ((AT91_REG *) 0xFFFD810C) // (PDC_ADC) Transmit Counter Register +#define AT91C_ADC_RCR ((AT91_REG *) 0xFFFD8104) // (PDC_ADC) Receive Counter Register +// ========== Register definition for ADC peripheral ========== +#define AT91C_ADC_IMR ((AT91_REG *) 0xFFFD802C) // (ADC) ADC Interrupt Mask Register +#define AT91C_ADC_CDR4 ((AT91_REG *) 0xFFFD8040) // (ADC) ADC Channel Data Register 4 +#define AT91C_ADC_CDR2 ((AT91_REG *) 0xFFFD8038) // (ADC) ADC Channel Data Register 2 +#define AT91C_ADC_CDR0 ((AT91_REG *) 0xFFFD8030) // (ADC) ADC Channel Data Register 0 +#define AT91C_ADC_CDR7 ((AT91_REG *) 0xFFFD804C) // (ADC) ADC Channel Data Register 7 +#define AT91C_ADC_CDR1 ((AT91_REG *) 0xFFFD8034) // (ADC) ADC Channel Data Register 1 +#define AT91C_ADC_CDR3 ((AT91_REG *) 0xFFFD803C) // (ADC) ADC Channel Data Register 3 +#define AT91C_ADC_CDR5 ((AT91_REG *) 0xFFFD8044) // (ADC) ADC Channel Data Register 5 +#define AT91C_ADC_MR ((AT91_REG *) 0xFFFD8004) // (ADC) ADC Mode Register +#define AT91C_ADC_CDR6 ((AT91_REG *) 0xFFFD8048) // (ADC) ADC Channel Data Register 6 +#define AT91C_ADC_CR ((AT91_REG *) 0xFFFD8000) // (ADC) ADC Control Register +#define AT91C_ADC_CHER ((AT91_REG *) 0xFFFD8010) // (ADC) ADC Channel Enable Register +#define AT91C_ADC_CHSR ((AT91_REG *) 0xFFFD8018) // (ADC) ADC Channel Status Register +#define AT91C_ADC_IER ((AT91_REG *) 0xFFFD8024) // (ADC) ADC Interrupt Enable Register +#define AT91C_ADC_SR ((AT91_REG *) 0xFFFD801C) // (ADC) ADC Status Register +#define AT91C_ADC_CHDR ((AT91_REG *) 0xFFFD8014) // (ADC) ADC Channel Disable Register +#define AT91C_ADC_IDR ((AT91_REG *) 0xFFFD8028) // (ADC) ADC Interrupt Disable Register +#define AT91C_ADC_LCDR ((AT91_REG *) 0xFFFD8020) // (ADC) ADC Last Converted Data Register + +// ***************************************************************************** +// PIO DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** +#define AT91C_PIO_PA0 ((unsigned int) 1 << 0) // Pin Controlled by PA0 +#define AT91C_PA0_RXD0 ((unsigned int) AT91C_PIO_PA0) // USART 0 Receive Data +#define AT91C_PIO_PA1 ((unsigned int) 1 << 1) // Pin Controlled by PA1 +#define AT91C_PA1_TXD0 ((unsigned int) AT91C_PIO_PA1) // USART 0 Transmit Data +#define AT91C_PIO_PA10 ((unsigned int) 1 << 10) // Pin Controlled by PA10 +#define AT91C_PA10_TWD ((unsigned int) AT91C_PIO_PA10) // TWI Two-wire Serial Data +#define AT91C_PIO_PA11 ((unsigned int) 1 << 11) // Pin Controlled by PA11 +#define AT91C_PA11_TWCK ((unsigned int) AT91C_PIO_PA11) // TWI Two-wire Serial Clock +#define AT91C_PIO_PA12 ((unsigned int) 1 << 12) // Pin Controlled by PA12 +#define AT91C_PA12_SPI0_NPCS0 ((unsigned int) AT91C_PIO_PA12) // SPI 0 Peripheral Chip Select 0 +#define AT91C_PIO_PA13 ((unsigned int) 1 << 13) // Pin Controlled by PA13 +#define AT91C_PA13_SPI0_NPCS1 ((unsigned int) AT91C_PIO_PA13) // SPI 0 Peripheral Chip Select 1 +#define AT91C_PA13_PCK1 ((unsigned int) AT91C_PIO_PA13) // PMC Programmable Clock Output 1 +#define AT91C_PIO_PA14 ((unsigned int) 1 << 14) // Pin Controlled by PA14 +#define AT91C_PA14_SPI0_NPCS2 ((unsigned int) AT91C_PIO_PA14) // SPI 0 Peripheral Chip Select 2 +#define AT91C_PA14_IRQ1 ((unsigned int) AT91C_PIO_PA14) // External Interrupt 1 +#define AT91C_PIO_PA15 ((unsigned int) 1 << 15) // Pin Controlled by PA15 +#define AT91C_PA15_SPI0_NPCS3 ((unsigned int) AT91C_PIO_PA15) // SPI 0 Peripheral Chip Select 3 +#define AT91C_PA15_TCLK2 ((unsigned int) AT91C_PIO_PA15) // Timer Counter 2 external clock input +#define AT91C_PIO_PA16 ((unsigned int) 1 << 16) // Pin Controlled by PA16 +#define AT91C_PA16_SPI0_MISO ((unsigned int) AT91C_PIO_PA16) // SPI 0 Master In Slave +#define AT91C_PIO_PA17 ((unsigned int) 1 << 17) // Pin Controlled by PA17 +#define AT91C_PA17_SPI0_MOSI ((unsigned int) AT91C_PIO_PA17) // SPI 0 Master Out Slave +#define AT91C_PIO_PA18 ((unsigned int) 1 << 18) // Pin Controlled by PA18 +#define AT91C_PA18_SPI0_SPCK ((unsigned int) AT91C_PIO_PA18) // SPI 0 Serial Clock +#define AT91C_PIO_PA19 ((unsigned int) 1 << 19) // Pin Controlled by PA19 +#define AT91C_PA19_CANRX ((unsigned int) AT91C_PIO_PA19) // CAN Receive +#define AT91C_PIO_PA2 ((unsigned int) 1 << 2) // Pin Controlled by PA2 +#define AT91C_PA2_SCK0 ((unsigned int) AT91C_PIO_PA2) // USART 0 Serial Clock +#define AT91C_PA2_SPI1_NPCS1 ((unsigned int) AT91C_PIO_PA2) // SPI 1 Peripheral Chip Select 1 +#define AT91C_PIO_PA20 ((unsigned int) 1 << 20) // Pin Controlled by PA20 +#define AT91C_PA20_CANTX ((unsigned int) AT91C_PIO_PA20) // CAN Transmit +#define AT91C_PIO_PA21 ((unsigned int) 1 << 21) // Pin Controlled by PA21 +#define AT91C_PA21_TF ((unsigned int) AT91C_PIO_PA21) // SSC Transmit Frame Sync +#define AT91C_PA21_SPI1_NPCS0 ((unsigned int) AT91C_PIO_PA21) // SPI 1 Peripheral Chip Select 0 +#define AT91C_PIO_PA22 ((unsigned int) 1 << 22) // Pin Controlled by PA22 +#define AT91C_PA22_TK ((unsigned int) AT91C_PIO_PA22) // SSC Transmit Clock +#define AT91C_PA22_SPI1_SPCK ((unsigned int) AT91C_PIO_PA22) // SPI 1 Serial Clock +#define AT91C_PIO_PA23 ((unsigned int) 1 << 23) // Pin Controlled by PA23 +#define AT91C_PA23_TD ((unsigned int) AT91C_PIO_PA23) // SSC Transmit data +#define AT91C_PA23_SPI1_MOSI ((unsigned int) AT91C_PIO_PA23) // SPI 1 Master Out Slave +#define AT91C_PIO_PA24 ((unsigned int) 1 << 24) // Pin Controlled by PA24 +#define AT91C_PA24_RD ((unsigned int) AT91C_PIO_PA24) // SSC Receive Data +#define AT91C_PA24_SPI1_MISO ((unsigned int) AT91C_PIO_PA24) // SPI 1 Master In Slave +#define AT91C_PIO_PA25 ((unsigned int) 1 << 25) // Pin Controlled by PA25 +#define AT91C_PA25_RK ((unsigned int) AT91C_PIO_PA25) // SSC Receive Clock +#define AT91C_PA25_SPI1_NPCS1 ((unsigned int) AT91C_PIO_PA25) // SPI 1 Peripheral Chip Select 1 +#define AT91C_PIO_PA26 ((unsigned int) 1 << 26) // Pin Controlled by PA26 +#define AT91C_PA26_RF ((unsigned int) AT91C_PIO_PA26) // SSC Receive Frame Sync +#define AT91C_PA26_SPI1_NPCS2 ((unsigned int) AT91C_PIO_PA26) // SPI 1 Peripheral Chip Select 2 +#define AT91C_PIO_PA27 ((unsigned int) 1 << 27) // Pin Controlled by PA27 +#define AT91C_PA27_DRXD ((unsigned int) AT91C_PIO_PA27) // DBGU Debug Receive Data +#define AT91C_PA27_PCK3 ((unsigned int) AT91C_PIO_PA27) // PMC Programmable Clock Output 3 +#define AT91C_PIO_PA28 ((unsigned int) 1 << 28) // Pin Controlled by PA28 +#define AT91C_PA28_DTXD ((unsigned int) AT91C_PIO_PA28) // DBGU Debug Transmit Data +#define AT91C_PIO_PA29 ((unsigned int) 1 << 29) // Pin Controlled by PA29 +#define AT91C_PA29_FIQ ((unsigned int) AT91C_PIO_PA29) // AIC Fast Interrupt Input +#define AT91C_PA29_SPI1_NPCS3 ((unsigned int) AT91C_PIO_PA29) // SPI 1 Peripheral Chip Select 3 +#define AT91C_PIO_PA3 ((unsigned int) 1 << 3) // Pin Controlled by PA3 +#define AT91C_PA3_RTS0 ((unsigned int) AT91C_PIO_PA3) // USART 0 Ready To Send +#define AT91C_PA3_SPI1_NPCS2 ((unsigned int) AT91C_PIO_PA3) // SPI 1 Peripheral Chip Select 2 +#define AT91C_PIO_PA30 ((unsigned int) 1 << 30) // Pin Controlled by PA30 +#define AT91C_PA30_IRQ0 ((unsigned int) AT91C_PIO_PA30) // External Interrupt 0 +#define AT91C_PA30_PCK2 ((unsigned int) AT91C_PIO_PA30) // PMC Programmable Clock Output 2 +#define AT91C_PIO_PA4 ((unsigned int) 1 << 4) // Pin Controlled by PA4 +#define AT91C_PA4_CTS0 ((unsigned int) AT91C_PIO_PA4) // USART 0 Clear To Send +#define AT91C_PA4_SPI1_NPCS3 ((unsigned int) AT91C_PIO_PA4) // SPI 1 Peripheral Chip Select 3 +#define AT91C_PIO_PA5 ((unsigned int) 1 << 5) // Pin Controlled by PA5 +#define AT91C_PA5_RXD1 ((unsigned int) AT91C_PIO_PA5) // USART 1 Receive Data +#define AT91C_PIO_PA6 ((unsigned int) 1 << 6) // Pin Controlled by PA6 +#define AT91C_PA6_TXD1 ((unsigned int) AT91C_PIO_PA6) // USART 1 Transmit Data +#define AT91C_PIO_PA7 ((unsigned int) 1 << 7) // Pin Controlled by PA7 +#define AT91C_PA7_SCK1 ((unsigned int) AT91C_PIO_PA7) // USART 1 Serial Clock +#define AT91C_PA7_SPI0_NPCS1 ((unsigned int) AT91C_PIO_PA7) // SPI 0 Peripheral Chip Select 1 +#define AT91C_PIO_PA8 ((unsigned int) 1 << 8) // Pin Controlled by PA8 +#define AT91C_PA8_RTS1 ((unsigned int) AT91C_PIO_PA8) // USART 1 Ready To Send +#define AT91C_PA8_SPI0_NPCS2 ((unsigned int) AT91C_PIO_PA8) // SPI 0 Peripheral Chip Select 2 +#define AT91C_PIO_PA9 ((unsigned int) 1 << 9) // Pin Controlled by PA9 +#define AT91C_PA9_CTS1 ((unsigned int) AT91C_PIO_PA9) // USART 1 Clear To Send +#define AT91C_PA9_SPI0_NPCS3 ((unsigned int) AT91C_PIO_PA9) // SPI 0 Peripheral Chip Select 3 +#define AT91C_PIO_PB0 ((unsigned int) 1 << 0) // Pin Controlled by PB0 +#define AT91C_PB0_ETXCK_EREFCK ((unsigned int) AT91C_PIO_PB0) // Ethernet MAC Transmit Clock/Reference Clock +#define AT91C_PB0_PCK0 ((unsigned int) AT91C_PIO_PB0) // PMC Programmable Clock Output 0 +#define AT91C_PIO_PB1 ((unsigned int) 1 << 1) // Pin Controlled by PB1 +#define AT91C_PB1_ETXEN ((unsigned int) AT91C_PIO_PB1) // Ethernet MAC Transmit Enable +#define AT91C_PIO_PB10 ((unsigned int) 1 << 10) // Pin Controlled by PB10 +#define AT91C_PB10_ETX2 ((unsigned int) AT91C_PIO_PB10) // Ethernet MAC Transmit Data 2 +#define AT91C_PB10_SPI1_NPCS1 ((unsigned int) AT91C_PIO_PB10) // SPI 1 Peripheral Chip Select 1 +#define AT91C_PIO_PB11 ((unsigned int) 1 << 11) // Pin Controlled by PB11 +#define AT91C_PB11_ETX3 ((unsigned int) AT91C_PIO_PB11) // Ethernet MAC Transmit Data 3 +#define AT91C_PB11_SPI1_NPCS2 ((unsigned int) AT91C_PIO_PB11) // SPI 1 Peripheral Chip Select 2 +#define AT91C_PIO_PB12 ((unsigned int) 1 << 12) // Pin Controlled by PB12 +#define AT91C_PB12_ETXER ((unsigned int) AT91C_PIO_PB12) // Ethernet MAC Transmikt Coding Error +#define AT91C_PB12_TCLK0 ((unsigned int) AT91C_PIO_PB12) // Timer Counter 0 external clock input +#define AT91C_PIO_PB13 ((unsigned int) 1 << 13) // Pin Controlled by PB13 +#define AT91C_PB13_ERX2 ((unsigned int) AT91C_PIO_PB13) // Ethernet MAC Receive Data 2 +#define AT91C_PB13_SPI0_NPCS1 ((unsigned int) AT91C_PIO_PB13) // SPI 0 Peripheral Chip Select 1 +#define AT91C_PIO_PB14 ((unsigned int) 1 << 14) // Pin Controlled by PB14 +#define AT91C_PB14_ERX3 ((unsigned int) AT91C_PIO_PB14) // Ethernet MAC Receive Data 3 +#define AT91C_PB14_SPI0_NPCS2 ((unsigned int) AT91C_PIO_PB14) // SPI 0 Peripheral Chip Select 2 +#define AT91C_PIO_PB15 ((unsigned int) 1 << 15) // Pin Controlled by PB15 +#define AT91C_PB15_ERXDV_ECRSDV ((unsigned int) AT91C_PIO_PB15) // Ethernet MAC Receive Data Valid +#define AT91C_PIO_PB16 ((unsigned int) 1 << 16) // Pin Controlled by PB16 +#define AT91C_PB16_ECOL ((unsigned int) AT91C_PIO_PB16) // Ethernet MAC Collision Detected +#define AT91C_PB16_SPI1_NPCS3 ((unsigned int) AT91C_PIO_PB16) // SPI 1 Peripheral Chip Select 3 +#define AT91C_PIO_PB17 ((unsigned int) 1 << 17) // Pin Controlled by PB17 +#define AT91C_PB17_ERXCK ((unsigned int) AT91C_PIO_PB17) // Ethernet MAC Receive Clock +#define AT91C_PB17_SPI0_NPCS3 ((unsigned int) AT91C_PIO_PB17) // SPI 0 Peripheral Chip Select 3 +#define AT91C_PIO_PB18 ((unsigned int) 1 << 18) // Pin Controlled by PB18 +#define AT91C_PB18_EF100 ((unsigned int) AT91C_PIO_PB18) // Ethernet MAC Force 100 Mbits/sec +#define AT91C_PB18_ADTRG ((unsigned int) AT91C_PIO_PB18) // ADC External Trigger +#define AT91C_PIO_PB19 ((unsigned int) 1 << 19) // Pin Controlled by PB19 +#define AT91C_PB19_PWM0 ((unsigned int) AT91C_PIO_PB19) // PWM Channel 0 +#define AT91C_PB19_TCLK1 ((unsigned int) AT91C_PIO_PB19) // Timer Counter 1 external clock input +#define AT91C_PIO_PB2 ((unsigned int) 1 << 2) // Pin Controlled by PB2 +#define AT91C_PB2_ETX0 ((unsigned int) AT91C_PIO_PB2) // Ethernet MAC Transmit Data 0 +#define AT91C_PIO_PB20 ((unsigned int) 1 << 20) // Pin Controlled by PB20 +#define AT91C_PB20_PWM1 ((unsigned int) AT91C_PIO_PB20) // PWM Channel 1 +#define AT91C_PB20_PCK0 ((unsigned int) AT91C_PIO_PB20) // PMC Programmable Clock Output 0 +#define AT91C_PIO_PB21 ((unsigned int) 1 << 21) // Pin Controlled by PB21 +#define AT91C_PB21_PWM2 ((unsigned int) AT91C_PIO_PB21) // PWM Channel 2 +#define AT91C_PB21_PCK1 ((unsigned int) AT91C_PIO_PB21) // PMC Programmable Clock Output 1 +#define AT91C_PIO_PB22 ((unsigned int) 1 << 22) // Pin Controlled by PB22 +#define AT91C_PB22_PWM3 ((unsigned int) AT91C_PIO_PB22) // PWM Channel 3 +#define AT91C_PB22_PCK2 ((unsigned int) AT91C_PIO_PB22) // PMC Programmable Clock Output 2 +#define AT91C_PIO_PB23 ((unsigned int) 1 << 23) // Pin Controlled by PB23 +#define AT91C_PB23_TIOA0 ((unsigned int) AT91C_PIO_PB23) // Timer Counter 0 Multipurpose Timer I/O Pin A +#define AT91C_PB23_DCD1 ((unsigned int) AT91C_PIO_PB23) // USART 1 Data Carrier Detect +#define AT91C_PIO_PB24 ((unsigned int) 1 << 24) // Pin Controlled by PB24 +#define AT91C_PB24_TIOB0 ((unsigned int) AT91C_PIO_PB24) // Timer Counter 0 Multipurpose Timer I/O Pin B +#define AT91C_PB24_DSR1 ((unsigned int) AT91C_PIO_PB24) // USART 1 Data Set ready +#define AT91C_PIO_PB25 ((unsigned int) 1 << 25) // Pin Controlled by PB25 +#define AT91C_PB25_TIOA1 ((unsigned int) AT91C_PIO_PB25) // Timer Counter 1 Multipurpose Timer I/O Pin A +#define AT91C_PB25_DTR1 ((unsigned int) AT91C_PIO_PB25) // USART 1 Data Terminal ready +#define AT91C_PIO_PB26 ((unsigned int) 1 << 26) // Pin Controlled by PB26 +#define AT91C_PB26_TIOB1 ((unsigned int) AT91C_PIO_PB26) // Timer Counter 1 Multipurpose Timer I/O Pin B +#define AT91C_PB26_RI1 ((unsigned int) AT91C_PIO_PB26) // USART 1 Ring Indicator +#define AT91C_PIO_PB27 ((unsigned int) 1 << 27) // Pin Controlled by PB27 +#define AT91C_PB27_TIOA2 ((unsigned int) AT91C_PIO_PB27) // Timer Counter 2 Multipurpose Timer I/O Pin A +#define AT91C_PB27_PWM0 ((unsigned int) AT91C_PIO_PB27) // PWM Channel 0 +#define AT91C_PIO_PB28 ((unsigned int) 1 << 28) // Pin Controlled by PB28 +#define AT91C_PB28_TIOB2 ((unsigned int) AT91C_PIO_PB28) // Timer Counter 2 Multipurpose Timer I/O Pin B +#define AT91C_PB28_PWM1 ((unsigned int) AT91C_PIO_PB28) // PWM Channel 1 +#define AT91C_PIO_PB29 ((unsigned int) 1 << 29) // Pin Controlled by PB29 +#define AT91C_PB29_PCK1 ((unsigned int) AT91C_PIO_PB29) // PMC Programmable Clock Output 1 +#define AT91C_PB29_PWM2 ((unsigned int) AT91C_PIO_PB29) // PWM Channel 2 +#define AT91C_PIO_PB3 ((unsigned int) 1 << 3) // Pin Controlled by PB3 +#define AT91C_PB3_ETX1 ((unsigned int) AT91C_PIO_PB3) // Ethernet MAC Transmit Data 1 +#define AT91C_PIO_PB30 ((unsigned int) 1 << 30) // Pin Controlled by PB30 +#define AT91C_PB30_PCK2 ((unsigned int) AT91C_PIO_PB30) // PMC Programmable Clock Output 2 +#define AT91C_PB30_PWM3 ((unsigned int) AT91C_PIO_PB30) // PWM Channel 3 +#define AT91C_PIO_PB4 ((unsigned int) 1 << 4) // Pin Controlled by PB4 +#define AT91C_PB4_ECRS ((unsigned int) AT91C_PIO_PB4) // Ethernet MAC Carrier Sense/Carrier Sense and Data Valid +#define AT91C_PIO_PB5 ((unsigned int) 1 << 5) // Pin Controlled by PB5 +#define AT91C_PB5_ERX0 ((unsigned int) AT91C_PIO_PB5) // Ethernet MAC Receive Data 0 +#define AT91C_PIO_PB6 ((unsigned int) 1 << 6) // Pin Controlled by PB6 +#define AT91C_PB6_ERX1 ((unsigned int) AT91C_PIO_PB6) // Ethernet MAC Receive Data 1 +#define AT91C_PIO_PB7 ((unsigned int) 1 << 7) // Pin Controlled by PB7 +#define AT91C_PB7_ERXER ((unsigned int) AT91C_PIO_PB7) // Ethernet MAC Receive Error +#define AT91C_PIO_PB8 ((unsigned int) 1 << 8) // Pin Controlled by PB8 +#define AT91C_PB8_EMDC ((unsigned int) AT91C_PIO_PB8) // Ethernet MAC Management Data Clock +#define AT91C_PIO_PB9 ((unsigned int) 1 << 9) // Pin Controlled by PB9 +#define AT91C_PB9_EMDIO ((unsigned int) AT91C_PIO_PB9) // Ethernet MAC Management Data Input/Output + +// ***************************************************************************** +// PERIPHERAL ID DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** +#define AT91C_ID_FIQ ((unsigned int) 0) // Advanced Interrupt Controller (FIQ) +#define AT91C_ID_SYS ((unsigned int) 1) // System Peripheral +#define AT91C_ID_PIOA ((unsigned int) 2) // Parallel IO Controller A +#define AT91C_ID_PIOB ((unsigned int) 3) // Parallel IO Controller B +#define AT91C_ID_SPI0 ((unsigned int) 4) // Serial Peripheral Interface 0 +#define AT91C_ID_SPI1 ((unsigned int) 5) // Serial Peripheral Interface 1 +#define AT91C_ID_US0 ((unsigned int) 6) // USART 0 +#define AT91C_ID_US1 ((unsigned int) 7) // USART 1 +#define AT91C_ID_SSC ((unsigned int) 8) // Serial Synchronous Controller +#define AT91C_ID_TWI ((unsigned int) 9) // Two-Wire Interface +#define AT91C_ID_PWMC ((unsigned int) 10) // PWM Controller +#define AT91C_ID_UDP ((unsigned int) 11) // USB Device Port +#define AT91C_ID_TC0 ((unsigned int) 12) // Timer Counter 0 +#define AT91C_ID_TC1 ((unsigned int) 13) // Timer Counter 1 +#define AT91C_ID_TC2 ((unsigned int) 14) // Timer Counter 2 +#define AT91C_ID_CAN ((unsigned int) 15) // Control Area Network Controller +#define AT91C_ID_EMAC ((unsigned int) 16) // Ethernet MAC +#define AT91C_ID_ADC ((unsigned int) 17) // Analog-to-Digital Converter +#define AT91C_ID_18_Reserved ((unsigned int) 18) // Reserved +#define AT91C_ID_19_Reserved ((unsigned int) 19) // Reserved +#define AT91C_ID_20_Reserved ((unsigned int) 20) // Reserved +#define AT91C_ID_21_Reserved ((unsigned int) 21) // Reserved +#define AT91C_ID_22_Reserved ((unsigned int) 22) // Reserved +#define AT91C_ID_23_Reserved ((unsigned int) 23) // Reserved +#define AT91C_ID_24_Reserved ((unsigned int) 24) // Reserved +#define AT91C_ID_25_Reserved ((unsigned int) 25) // Reserved +#define AT91C_ID_26_Reserved ((unsigned int) 26) // Reserved +#define AT91C_ID_27_Reserved ((unsigned int) 27) // Reserved +#define AT91C_ID_28_Reserved ((unsigned int) 28) // Reserved +#define AT91C_ID_29_Reserved ((unsigned int) 29) // Reserved +#define AT91C_ID_IRQ0 ((unsigned int) 30) // Advanced Interrupt Controller (IRQ0) +#define AT91C_ID_IRQ1 ((unsigned int) 31) // Advanced Interrupt Controller (IRQ1) +#define AT91C_ALL_INT ((unsigned int) 0xC003FFFF) // ALL VALID INTERRUPTS + +// ***************************************************************************** +// BASE ADDRESS DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** + +#ifdef TEST + +extern AT91S_AIC AicPeripheral; +extern AT91S_PIO PioAPeripheral; +extern AT91S_PIO PioBPeripheral; +extern AT91S_PMC PmcPeripheral; +extern AT91S_USART Usart0Peripheral; +extern AT91S_TC TimerCounter0Peripheral; +extern AT91S_ADC AdcPeripheral; + +#define AIC_ADDR &AicPeripheral +#define PIOA_ADDR &PioAPeripheral +#define PIOB_ADDR &PioBPeripheral +#define PMC_ADDR &PmcPeripheral +#define US0_ADDR &Usart0Peripheral +#define TC0_ADDR &TimerCounter0Peripheral +#define ADC_ADDR &AdcPeripheral + +#else + +#define AIC_ADDR 0xFFFFF000 +#define PIOA_ADDR 0xFFFFF400 +#define PIOB_ADDR 0xFFFFF600 +#define PMC_ADDR 0xFFFFFC00 +#define US0_ADDR 0xFFFC0000 +#define TC0_ADDR 0xFFFA0000 +#define ADC_ADDR 0xFFFD8000 + +#endif // TEST + +#define AT91C_BASE_SYS ((AT91PS_SYS) 0xFFFFF000) // (SYS) Base Address +#define AT91C_BASE_AIC ((AT91PS_AIC) AIC_ADDR) // (AIC) Base Address +#define AT91C_BASE_PDC_DBGU ((AT91PS_PDC) 0xFFFFF300) // (PDC_DBGU) Base Address +#define AT91C_BASE_DBGU ((AT91PS_DBGU) 0xFFFFF200) // (DBGU) Base Address +#define AT91C_BASE_PIOA ((AT91PS_PIO) PIOA_ADDR) // (PIOA) Base Address +#define AT91C_BASE_PIOB ((AT91PS_PIO) PIOB_ADDR) // (PIOB) Base Address +#define AT91C_BASE_PMC ((AT91PS_PMC) PMC_ADDR) // (PMC) Base Address +#define AT91C_BASE_CKGR ((AT91PS_CKGR) 0xFFFFFC20) // (CKGR) Base Address +#define AT91C_BASE_RSTC ((AT91PS_RSTC) 0xFFFFFD00) // (RSTC) Base Address +#define AT91C_BASE_RTTC ((AT91PS_RTTC) 0xFFFFFD20) // (RTTC) Base Address +#define AT91C_BASE_PITC ((AT91PS_PITC) 0xFFFFFD30) // (PITC) Base Address +#define AT91C_BASE_WDTC ((AT91PS_WDTC) 0xFFFFFD40) // (WDTC) Base Address +#define AT91C_BASE_VREG ((AT91PS_VREG) 0xFFFFFD60) // (VREG) Base Address +#define AT91C_BASE_MC ((AT91PS_MC) 0xFFFFFF00) // (MC) Base Address +#define AT91C_BASE_PDC_SPI1 ((AT91PS_PDC) 0xFFFE4100) // (PDC_SPI1) Base Address +#define AT91C_BASE_SPI1 ((AT91PS_SPI) 0xFFFE4000) // (SPI1) Base Address +#define AT91C_BASE_PDC_SPI0 ((AT91PS_PDC) 0xFFFE0100) // (PDC_SPI0) Base Address +#define AT91C_BASE_SPI0 ((AT91PS_SPI) 0xFFFE0000) // (SPI0) Base Address +#define AT91C_BASE_PDC_US1 ((AT91PS_PDC) 0xFFFC4100) // (PDC_US1) Base Address +#define AT91C_BASE_US1 ((AT91PS_USART) 0xFFFC4000) // (US1) Base Address +#define AT91C_BASE_PDC_US0 ((AT91PS_PDC) 0xFFFC0100) // (PDC_US0) Base Address +#define AT91C_BASE_US0 ((AT91PS_USART) US0_ADDR) // (US0) Base Address +#define AT91C_BASE_PDC_SSC ((AT91PS_PDC) 0xFFFD4100) // (PDC_SSC) Base Address +#define AT91C_BASE_SSC ((AT91PS_SSC) 0xFFFD4000) // (SSC) Base Address +#define AT91C_BASE_TWI ((AT91PS_TWI) 0xFFFB8000) // (TWI) Base Address +#define AT91C_BASE_PWMC_CH3 ((AT91PS_PWMC_CH) 0xFFFCC260) // (PWMC_CH3) Base Address +#define AT91C_BASE_PWMC_CH2 ((AT91PS_PWMC_CH) 0xFFFCC240) // (PWMC_CH2) Base Address +#define AT91C_BASE_PWMC_CH1 ((AT91PS_PWMC_CH) 0xFFFCC220) // (PWMC_CH1) Base Address +#define AT91C_BASE_PWMC_CH0 ((AT91PS_PWMC_CH) 0xFFFCC200) // (PWMC_CH0) Base Address +#define AT91C_BASE_PWMC ((AT91PS_PWMC) 0xFFFCC000) // (PWMC) Base Address +#define AT91C_BASE_UDP ((AT91PS_UDP) 0xFFFB0000) // (UDP) Base Address +#define AT91C_BASE_TC0 ((AT91PS_TC) TC0_ADDR) // (TC0) Base Address +#define AT91C_BASE_TC1 ((AT91PS_TC) 0xFFFA0040) // (TC1) Base Address +#define AT91C_BASE_TC2 ((AT91PS_TC) 0xFFFA0080) // (TC2) Base Address +#define AT91C_BASE_TCB ((AT91PS_TCB) 0xFFFA0000) // (TCB) Base Address +#define AT91C_BASE_CAN_MB0 ((AT91PS_CAN_MB) 0xFFFD0200) // (CAN_MB0) Base Address +#define AT91C_BASE_CAN_MB1 ((AT91PS_CAN_MB) 0xFFFD0220) // (CAN_MB1) Base Address +#define AT91C_BASE_CAN_MB2 ((AT91PS_CAN_MB) 0xFFFD0240) // (CAN_MB2) Base Address +#define AT91C_BASE_CAN_MB3 ((AT91PS_CAN_MB) 0xFFFD0260) // (CAN_MB3) Base Address +#define AT91C_BASE_CAN_MB4 ((AT91PS_CAN_MB) 0xFFFD0280) // (CAN_MB4) Base Address +#define AT91C_BASE_CAN_MB5 ((AT91PS_CAN_MB) 0xFFFD02A0) // (CAN_MB5) Base Address +#define AT91C_BASE_CAN_MB6 ((AT91PS_CAN_MB) 0xFFFD02C0) // (CAN_MB6) Base Address +#define AT91C_BASE_CAN_MB7 ((AT91PS_CAN_MB) 0xFFFD02E0) // (CAN_MB7) Base Address +#define AT91C_BASE_CAN ((AT91PS_CAN) 0xFFFD0000) // (CAN) Base Address +#define AT91C_BASE_ADC ((AT91PS_ADC) ADC_ADDR) // (ADC) Base Address +#define AT91C_BASE_EMAC ((AT91PS_EMAC) 0xFFFDC000) // (EMAC) Base Address +#define AT91C_BASE_PDC_ADC ((AT91PS_PDC) 0xFFFD8100) // (PDC_ADC) Base Address + +// ***************************************************************************** +// MEMORY MAPPING DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** +// ISRAM +#define AT91C_ISRAM ((char *) 0x00200000) // Internal SRAM base address +#define AT91C_ISRAM_SIZE ((unsigned int) 0x00010000) // Internal SRAM size in byte (64 Kbytes) +// IFLASH +#define AT91C_IFLASH ((char *) 0x00100000) // Internal FLASH base address +#define AT91C_IFLASH_SIZE ((unsigned int) 0x00040000) // Internal FLASH size in byte (256 Kbytes) +#define AT91C_IFLASH_PAGE_SIZE ((unsigned int) 256) // Internal FLASH Page Size: 256 bytes +#define AT91C_IFLASH_LOCK_REGION_SIZE ((unsigned int) 16384) // Internal FLASH Lock Region Size: 16 Kbytes +#define AT91C_IFLASH_NB_OF_PAGES ((unsigned int) 1024) // Internal FLASH Number of Pages: 1024 bytes +#define AT91C_IFLASH_NB_OF_LOCK_BITS ((unsigned int) 16) // Internal FLASH Number of Lock Bits: 16 bytes + +#endif diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/AdcConductor.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/AdcConductor.c new file mode 100644 index 0000000..28d9d20 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/AdcConductor.c @@ -0,0 +1,42 @@ +#include "Types.h" +#include "AdcConductor.h" +#include "AdcModel.h" +#include "AdcHardware.h" + +void AdcConductor_Init(void) +{ + AdcHardware_Init(); +} + +void AdcConductor_Run(void) +{ + if (AdcModel_DoGetSample() && AdcHardware_GetSampleComplete()) + { + AdcModel_ProcessInput(AdcHardware_GetSample()); + AdcHardware_StartConversion(); + } +} + +bool AdcConductor_JustHereToTest(void) +{ + EXAMPLE_STRUCT_T ExampleStruct; + ExampleStruct.x = 5; + ExampleStruct.y = 7; + + return AdcModel_DoNothingExceptTestASpecialType(ExampleStruct); +} + +bool AdcConductor_AlsoHereToTest(void) +{ + EXAMPLE_STRUCT_T example = AdcModel_DoNothingExceptReturnASpecialType(); + + return ((example.x == 99) && (example.y == 1)); +} + +bool AdcConductor_YetAnotherTest(void) +{ + uint32 example = 3; + + return AdModel_DoNothingExceptTestPointers(&example); +} + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/AdcConductor.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/AdcConductor.h new file mode 100644 index 0000000..4280da3 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/AdcConductor.h @@ -0,0 +1,11 @@ +#ifndef _ADCCONDUCTOR_H +#define _ADCCONDUCTOR_H + +void AdcConductor_Init(void); +void AdcConductor_Run(void); + +bool AdcConductor_JustHereToTest(void); +bool AdcConductor_AlsoHereToTest(void); +bool AdcConductor_YetAnotherTest(void); + +#endif // _ADCCONDUCTOR_H diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/AdcHardware.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/AdcHardware.c new file mode 100644 index 0000000..9807641 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/AdcHardware.c @@ -0,0 +1,27 @@ +#include "Types.h" +#include "AdcHardware.h" +#include "AdcHardwareConfigurator.h" +#include "AdcTemperatureSensor.h" + +void AdcHardware_Init(void) +{ + Adc_Reset(); + Adc_ConfigureMode(); + Adc_EnableTemperatureChannel(); + Adc_StartTemperatureSensorConversion(); +} + +void AdcHardware_StartConversion(void) +{ + Adc_StartTemperatureSensorConversion(); +} + +bool AdcHardware_GetSampleComplete(void) +{ + return Adc_TemperatureSensorSampleReady(); +} + +uint16 AdcHardware_GetSample(void) +{ + return Adc_ReadTemperatureSensor(); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/AdcHardware.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/AdcHardware.h new file mode 100644 index 0000000..3209a4c --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/AdcHardware.h @@ -0,0 +1,9 @@ +#ifndef _ADCHARDWARE_H +#define _ADCHARDWARE_H + +void AdcHardware_Init(void); +void AdcHardware_StartConversion(void); +bool AdcHardware_GetSampleComplete(void); +uint16 AdcHardware_GetSample(void); + +#endif // _ADCHARDWARE_H diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/AdcHardwareConfigurator.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/AdcHardwareConfigurator.c new file mode 100644 index 0000000..f7e08a2 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/AdcHardwareConfigurator.c @@ -0,0 +1,18 @@ +#include "Types.h" +#include "AdcHardwareConfigurator.h" +#include "ModelConfig.h" + +void Adc_Reset(void) +{ + AT91C_BASE_ADC->ADC_CR = AT91C_ADC_SWRST; +} + +void Adc_ConfigureMode(void) +{ + AT91C_BASE_ADC->ADC_MR = (((uint32)11) << 8) | (((uint32)4) << 16); +} + +void Adc_EnableTemperatureChannel(void) +{ + AT91C_BASE_ADC->ADC_CHER = 0x10; +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/AdcHardwareConfigurator.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/AdcHardwareConfigurator.h new file mode 100644 index 0000000..78b9e9f --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/AdcHardwareConfigurator.h @@ -0,0 +1,10 @@ +#ifndef _ADCHARDWARECONFIGURATOR_H +#define _ADCHARDWARECONFIGURATOR_H + +#include "Types.h" + +void Adc_Reset(void); +void Adc_ConfigureMode(void); +void Adc_EnableTemperatureChannel(void); + +#endif // _ADCHARDWARECONFIGURATOR_H diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/AdcModel.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/AdcModel.c new file mode 100644 index 0000000..ad9111d --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/AdcModel.c @@ -0,0 +1,33 @@ +#include "AdcModel.h" +#include "TaskScheduler.h" +#include "TemperatureCalculator.h" +#include "TemperatureFilter.h" + +bool AdcModel_DoGetSample(void) +{ + return TaskScheduler_DoAdc(); +} + +void AdcModel_ProcessInput(uint16 millivolts) +{ + TemperatureFilter_ProcessInput(TemperatureCalculator_Calculate(millivolts)); +} + +bool AdcModel_DoNothingExceptTestASpecialType(EXAMPLE_STRUCT_T ExampleStruct) +{ + //This doesn't really do anything. it's only here to make sure I can compare a struct. + return FALSE; +} +bool AdModel_DoNothingExceptTestPointers(uint32* pExample) +{ + //This doesn't really do anything. it's only here to make sure I can compare a pointer value. + return FALSE; +} + +EXAMPLE_STRUCT_T AdcModel_DoNothingExceptReturnASpecialType(void) +{ + EXAMPLE_STRUCT_T example; //again, this just is here to test that I can return a struct + example.x = 99; + example.y = 1; + return example; +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/AdcModel.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/AdcModel.h new file mode 100644 index 0000000..6b871fd --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/AdcModel.h @@ -0,0 +1,13 @@ +#ifndef _ADCMODEL_H +#define _ADCMODEL_H + +#include "Types.h" + +bool AdcModel_DoGetSample(void); +void AdcModel_ProcessInput(uint16 millivolts); + +bool AdcModel_DoNothingExceptTestASpecialType(EXAMPLE_STRUCT_T ExampleStruct); +bool AdModel_DoNothingExceptTestPointers(uint32* pExample); +EXAMPLE_STRUCT_T AdcModel_DoNothingExceptReturnASpecialType(void); + +#endif // _ADCMODEL_H diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/AdcTemperatureSensor.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/AdcTemperatureSensor.c new file mode 100644 index 0000000..b2a3f2c --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/AdcTemperatureSensor.c @@ -0,0 +1,51 @@ +#include "Types.h" +#include "AdcTemperatureSensor.h" + +static inline uint32 ConvertAdcCountsToPicovolts(uint32 counts); +static inline uint16 ConvertPicovoltsToMillivolts(uint32 picovolts); + +// +// PUBLIC METHODS +// + +void Adc_StartTemperatureSensorConversion(void) +{ + AT91C_BASE_ADC->ADC_CR = AT91C_ADC_START; +} + +bool Adc_TemperatureSensorSampleReady(void) +{ + return ((AT91C_BASE_ADC->ADC_SR & AT91C_ADC_EOC4) == AT91C_ADC_EOC4); +} + +uint16 Adc_ReadTemperatureSensor(void) +{ + uint32 picovolts = ConvertAdcCountsToPicovolts(AT91C_BASE_ADC->ADC_CDR4); + return ConvertPicovoltsToMillivolts(picovolts); +} + +// +// PRIVATE HELPERS +// + +static inline uint32 ConvertAdcCountsToPicovolts(uint32 counts) +{ + // ADC bit weight at 10-bit resolution with 3.0V reference = 2.9296875 mV/LSB + uint32 picovoltsPerAdcCount = 2929688; + + // Shift decimal point by 6 places to preserve accuracy in fixed-point math + return counts * picovoltsPerAdcCount; +} + +static inline uint16 ConvertPicovoltsToMillivolts(uint32 picovolts) +{ + const uint32 halfMillivoltInPicovolts = 500000; + const uint32 picovoltsPerMillivolt = 1000000; + + // Add 0.5 mV to result so that truncation yields properly rounded result + picovolts += halfMillivoltInPicovolts; + + // Divide appropriately to convert to millivolts + return (uint16)(picovolts / picovoltsPerMillivolt); +} + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/AdcTemperatureSensor.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/AdcTemperatureSensor.h new file mode 100644 index 0000000..bf2cc5b --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/AdcTemperatureSensor.h @@ -0,0 +1,10 @@ +#ifndef _ADCTEMPERATURESENSOR_H +#define _ADCTEMPERATURESENSOR_H + +#include "Types.h" + +void Adc_StartTemperatureSensorConversion(void); +bool Adc_TemperatureSensorSampleReady(void); +uint16 Adc_ReadTemperatureSensor(void); + +#endif // _ADCTEMPERATURESENSOR_H diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/Executor.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/Executor.c new file mode 100644 index 0000000..7e45c3e --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/Executor.c @@ -0,0 +1,25 @@ +#include "Types.h" +#include "Executor.h" +#include "Model.h" +#include "UsartConductor.h" +#include "TimerConductor.h" +#include "AdcConductor.h" +#include "IntrinsicsWrapper.h" + + +void Executor_Init(void) +{ + Model_Init(); + UsartConductor_Init(); + AdcConductor_Init(); + TimerConductor_Init(); + Interrupt_Enable(); +} + +bool Executor_Run(void) +{ + UsartConductor_Run(); + TimerConductor_Run(); + AdcConductor_Run(); + return TRUE; +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/Executor.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/Executor.h new file mode 100644 index 0000000..51a61a9 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/Executor.h @@ -0,0 +1,9 @@ +#ifndef _EXECUTOR_H +#define _EXECUTOR_H + +#include "Types.h" + +void Executor_Init(void); +bool Executor_Run(void); + +#endif // _EXECUTOR_H diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/IntrinsicsWrapper.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/IntrinsicsWrapper.c new file mode 100644 index 0000000..8b082ae --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/IntrinsicsWrapper.c @@ -0,0 +1,18 @@ +#include "IntrinsicsWrapper.h" +#ifdef __ICCARM__ +#include +#endif + +void Interrupt_Enable(void) +{ +#ifdef __ICCARM__ + __enable_interrupt(); +#endif +} + +void Interrupt_Disable(void) +{ +#ifdef __ICCARM__ + __disable_interrupt(); +#endif +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/IntrinsicsWrapper.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/IntrinsicsWrapper.h new file mode 100644 index 0000000..9273317 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/IntrinsicsWrapper.h @@ -0,0 +1,7 @@ +#ifndef _INTRINSICS_WRAPPER_H +#define _INTRINSICS_WRAPPER_H + +void Interrupt_Enable(void); +void Interrupt_Disable(void); + +#endif // _INTRINSICS_WRAPPER_H diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/Main.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/Main.c new file mode 100644 index 0000000..a784f47 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/Main.c @@ -0,0 +1,46 @@ +#include "Types.h" + +#include "IntrinsicsWrapper.h" +#include "Executor.h" + +#include "Model.h" +#include "TaskScheduler.h" +#include "TemperatureCalculator.h" +#include "TemperatureFilter.h" + +#include "UsartConductor.h" +#include "UsartHardware.h" +#include "UsartConfigurator.h" +#include "UsartPutChar.h" +#include "UsartModel.h" +#include "UsartBaudRateRegisterCalculator.h" +#include "UsartTransmitBufferStatus.h" + +#include "TimerConductor.h" +#include "TimerHardware.h" +#include "TimerConfigurator.h" +#include "TimerInterruptConfigurator.h" +#include "TimerInterruptHandler.h" +#include "TimerModel.h" + +#include "AdcConductor.h" +#include "AdcHardware.h" +#include "AdcHardwareConfigurator.h" +#include "AdcTemperatureSensor.h" +#include "AdcModel.h" + +int AppMain(void) +{ + Executor_Init(); + + while(Executor_Run()); + + return 0; +} + +#ifndef TEST +int main(void) +{ + return AppMain(); +} +#endif // TEST diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/Main.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/Main.h new file mode 100644 index 0000000..6cbe5f4 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/Main.h @@ -0,0 +1,7 @@ +#ifndef _MAIN_H_ +#define _MAIN_H_ + +int AppMain(void); +int main(void); + +#endif // _MAIN_H_ diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/Model.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/Model.c new file mode 100644 index 0000000..5b34c40 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/Model.c @@ -0,0 +1,10 @@ +#include "Model.h" +#include "TaskScheduler.h" +#include "TemperatureFilter.h" + +void Model_Init(void) +{ + TaskScheduler_Init(); + TemperatureFilter_Init(); +} + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/Model.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/Model.h new file mode 100644 index 0000000..d130938 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/Model.h @@ -0,0 +1,8 @@ +#ifndef _MODEL_H +#define _MODEL_H + +#include "Types.h" + +void Model_Init(void); + +#endif // _MODEL_H diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/ModelConfig.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/ModelConfig.h new file mode 100644 index 0000000..edc8e8d --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/ModelConfig.h @@ -0,0 +1,7 @@ +#ifndef _MODELCONFIG_H +#define _MODELCONFIG_H + +#define MASTER_CLOCK 48054857 // Master Clock +#define USART0_BAUDRATE 115200 // USART Baudrate + +#endif // _MODELCONFIG_H diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/TaskScheduler.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/TaskScheduler.c new file mode 100644 index 0000000..bcc0e64 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/TaskScheduler.c @@ -0,0 +1,72 @@ +#include "Types.h" +#include "TaskScheduler.h" + +typedef struct _Task +{ + bool doIt; + uint32 period; + uint32 startTime; +} Task; + +typedef struct _TaskSchedulerInstance +{ + Task usart; + Task adc; +} TaskSchedulerInstance; + +static TaskSchedulerInstance this; + +void TaskScheduler_Init(void) +{ + this.usart.doIt = FALSE; + this.usart.startTime = 0; + + //The correct period + this.usart.period = 1000; + + this.adc.doIt = FALSE; + this.adc.startTime = 0; + this.adc.period = 100; +} + +void TaskScheduler_Update(uint32 time) +{ + if ((time - this.usart.startTime) >= this.usart.period) + { + this.usart.doIt = TRUE; + this.usart.startTime = time - (time % this.usart.period); + } + + if ((time - this.adc.startTime) >= this.adc.period) + { + this.adc.doIt = TRUE; + this.adc.startTime = time - (time % this.adc.period); + } +} + +bool TaskScheduler_DoUsart(void) +{ + bool doIt = FALSE; + + if (this.usart.doIt) + { + doIt = TRUE; + this.usart.doIt = FALSE; + } + + return doIt; +} + +bool TaskScheduler_DoAdc(void) +{ + bool doIt = FALSE; + + if (this.adc.doIt) + { + doIt = TRUE; + this.adc.doIt = FALSE; + } + + return doIt; +} + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/TaskScheduler.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/TaskScheduler.h new file mode 100644 index 0000000..cc58342 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/TaskScheduler.h @@ -0,0 +1,11 @@ +#ifndef _TASKSCHEDULER_H +#define _TASKSCHEDULER_H + +#include "Types.h" + +void TaskScheduler_Init(void); +void TaskScheduler_Update(uint32 time); +bool TaskScheduler_DoUsart(void); +bool TaskScheduler_DoAdc(void); + +#endif // _TASKSCHEDULER_H diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/TemperatureCalculator.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/TemperatureCalculator.c new file mode 100644 index 0000000..04cec59 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/TemperatureCalculator.c @@ -0,0 +1,27 @@ +#include "Types.h" +#include "TemperatureCalculator.h" +#include + +#ifndef logl +#define logl log +#endif + +float TemperatureCalculator_Calculate(uint16 millivolts) +{ + const double supply_voltage = 3.0; + const double series_resistance = 5000; + const double coefficient_A = 316589.698; + const double coefficient_B = -0.1382009; + double sensor_voltage = ((double)millivolts / 1000); + double resistance; + + if (millivolts == 0) + { + return -INFINITY; + } + + // Series resistor is 5k Ohms; Reference voltage is 3.0V + // R(t) = A * e^(B*t); R is resistance of thermisor; t is temperature in C + resistance = ((supply_voltage * series_resistance) / sensor_voltage) - series_resistance; + return (float)(logl(resistance / coefficient_A) / coefficient_B); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/TemperatureCalculator.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/TemperatureCalculator.h new file mode 100644 index 0000000..b606c2d --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/TemperatureCalculator.h @@ -0,0 +1,6 @@ +#ifndef _TEMPERATURECALCULATOR_H +#define _TEMPERATURECALCULATOR_H + +float TemperatureCalculator_Calculate(uint16 millivolts); + +#endif // _TEMPERATURECALCULATOR_H diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/TemperatureFilter.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/TemperatureFilter.c new file mode 100644 index 0000000..02fc045 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/TemperatureFilter.c @@ -0,0 +1,39 @@ +#include "Types.h" +#include "TemperatureFilter.h" +#include + +static bool initialized; +static float temperatureInCelcius; + +void TemperatureFilter_Init(void) +{ + initialized = FALSE; + temperatureInCelcius = -INFINITY; +} + +float TemperatureFilter_GetTemperatureInCelcius(void) +{ + return temperatureInCelcius; +} + +void TemperatureFilter_ProcessInput(float temperature) +{ + if (!initialized) + { + temperatureInCelcius = temperature; + initialized = TRUE; + } + else + { + if (temperature == +INFINITY || + temperature == -INFINITY || + temperature == +NAN || + temperature == -NAN) + { + initialized = FALSE; + temperature = -INFINITY; + } + + temperatureInCelcius = (temperatureInCelcius * 0.75f) + (temperature * 0.25); + } +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/TemperatureFilter.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/TemperatureFilter.h new file mode 100644 index 0000000..31413f4 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/TemperatureFilter.h @@ -0,0 +1,10 @@ +#ifndef _TEMPERATUREFILTER_H +#define _TEMPERATUREFILTER_H + +#include "Types.h" + +void TemperatureFilter_Init(void); +float TemperatureFilter_GetTemperatureInCelcius(void); +void TemperatureFilter_ProcessInput(float temperature); + +#endif // _TEMPERATUREFILTER_H diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/TimerConductor.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/TimerConductor.c new file mode 100644 index 0000000..569b489 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/TimerConductor.c @@ -0,0 +1,15 @@ +#include "Types.h" +#include "TimerConductor.h" +#include "TimerModel.h" +#include "TimerHardware.h" +#include "TimerInterruptHandler.h" + +void TimerConductor_Init(void) +{ + TimerHardware_Init(); +} + +void TimerConductor_Run(void) +{ + TimerModel_UpdateTime(Timer_GetSystemTime()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/TimerConductor.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/TimerConductor.h new file mode 100644 index 0000000..7cd4109 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/TimerConductor.h @@ -0,0 +1,9 @@ +#ifndef _TIMERCONDUCTOR_H +#define _TIMERCONDUCTOR_H + +#include "Types.h" + +void TimerConductor_Init(void); +void TimerConductor_Run(void); + +#endif // _TIMERCONDUCTOR_H diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/TimerConfigurator.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/TimerConfigurator.c new file mode 100644 index 0000000..996cede --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/TimerConfigurator.c @@ -0,0 +1,51 @@ +#include "Types.h" +#include "TimerConfigurator.h" +#include "TimerInterruptConfigurator.h" + +void Timer_EnablePeripheralClocks(void) +{ + AT91C_BASE_PMC->PMC_PCER = TIMER0_CLOCK_ENABLE | PIOB_CLOCK_ENABLE; +} + +void Timer_Reset(void) +{ + uint32 dummy; + AT91C_BASE_TC0->TC_CCR = AT91C_TC_CLKDIS; + AT91C_BASE_TC0->TC_IDR = 0xffffffff; + dummy = AT91C_BASE_TC0->TC_SR; + dummy = dummy; +} + +void Timer_ConfigureMode(void) +{ + AT91C_BASE_TC0->TC_CMR = 0x000CC004; // ACPC=toggle TIOA on RC compare; mode=WAVE; WAVE_SEL=UP w/auto-trigger on RC compare; clock=MCK/1024 +} + +void Timer_ConfigurePeriod(void) +{ + AT91C_BASE_TC0->TC_RC = 469; // 10ms period for timer clock source of MCK/1024 with MCK=48054857 +} + +void Timer_EnableOutputPin(void) +{ + AT91C_BASE_PIOB->PIO_PDR = TIOA0_PIN_MASK; +} + +void Timer_Enable(void) +{ + AT91C_BASE_TC0->TC_CCR = AT91C_TC_CLKEN; +} + +void Timer_ConfigureInterruptHandler(void) +{ + Timer_DisableInterrupt(); + Timer_ResetSystemTime(); + Timer_ConfigureInterrupt(); + Timer_EnableInterrupt(); +} + +void Timer_Start(void) +{ + AT91C_BASE_TC0->TC_CCR = AT91C_TC_SWTRG; +} + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/TimerConfigurator.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/TimerConfigurator.h new file mode 100644 index 0000000..d078c54 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/TimerConfigurator.h @@ -0,0 +1,15 @@ +#ifndef _TIMERCONFIGURATOR_H +#define _TIMERCONFIGURATOR_H + +#include "Types.h" + +void Timer_EnablePeripheralClocks(void); +void Timer_Reset(void); +void Timer_ConfigureMode(void); +void Timer_ConfigurePeriod(void); +void Timer_EnableOutputPin(void); +void Timer_Enable(void); +void Timer_ConfigureInterruptHandler(void); +void Timer_Start(void); + +#endif // _TIMERCONFIGURATOR_H diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/TimerHardware.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/TimerHardware.c new file mode 100644 index 0000000..d5e983f --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/TimerHardware.c @@ -0,0 +1,15 @@ +#include "Types.h" +#include "TimerHardware.h" +#include "TimerConfigurator.h" + +void TimerHardware_Init(void) +{ + Timer_EnablePeripheralClocks(); + Timer_Reset(); + Timer_ConfigureMode(); + Timer_ConfigurePeriod(); + Timer_EnableOutputPin(); + Timer_Enable(); + Timer_ConfigureInterruptHandler(); + Timer_Start(); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/TimerHardware.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/TimerHardware.h new file mode 100644 index 0000000..92fa287 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/TimerHardware.h @@ -0,0 +1,8 @@ +#ifndef _TIMERHARDWARE_H +#define _TIMERHARDWARE_H + +#include "Types.h" + +void TimerHardware_Init(void); + +#endif // _TIMERHARDWARE_H diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/TimerInterruptConfigurator.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/TimerInterruptConfigurator.c new file mode 100644 index 0000000..fe603ef --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/TimerInterruptConfigurator.c @@ -0,0 +1,55 @@ +#include "Types.h" +#include "TimerInterruptConfigurator.h" +#include "TimerInterruptHandler.h" + +static inline void SetInterruptHandler(void); +static inline void ConfigureInterruptSourceModeRegister(void); +static inline void ClearInterrupt(void); +static inline void EnableCompareInterruptForRegisterC(void); + +void Timer_DisableInterrupt(void) +{ + AT91C_BASE_AIC->AIC_IDCR = TIMER0_ID_MASK; +} + +void Timer_ResetSystemTime(void) +{ + Timer_SetSystemTime(0); +} + +void Timer_ConfigureInterrupt(void) +{ + SetInterruptHandler(); + ConfigureInterruptSourceModeRegister(); + ClearInterrupt(); + EnableCompareInterruptForRegisterC(); +} + +void Timer_EnableInterrupt(void) +{ + AT91C_BASE_AIC->AIC_IECR = TIMER0_ID_MASK; +} + +// +// Helpers +// + +static inline void SetInterruptHandler(void) +{ + AT91C_BASE_AIC->AIC_SVR[AT91C_ID_TC0] = (uint32)Timer_InterruptHandler; +} + +static inline void ConfigureInterruptSourceModeRegister(void) +{ + AT91C_BASE_AIC->AIC_SMR[AT91C_ID_TC0] = 1; +} + +static inline void ClearInterrupt(void) +{ + AT91C_BASE_AIC->AIC_ICCR = TIMER0_ID_MASK; +} + +static inline void EnableCompareInterruptForRegisterC(void) +{ + AT91C_BASE_TC0->TC_IER = AT91C_TC_CPCS; +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/TimerInterruptConfigurator.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/TimerInterruptConfigurator.h new file mode 100644 index 0000000..301110d --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/TimerInterruptConfigurator.h @@ -0,0 +1,13 @@ +#ifndef _TIMERINTERRUPTCONFIGURATOR_H +#define _TIMERINTERRUPCONFIGURATOR_H + +#include "Types.h" + +#define TIMER0_ID_MASK (((uint32)0x1) << AT91C_ID_TC0) + +void Timer_DisableInterrupt(void); +void Timer_ResetSystemTime(void); +void Timer_ConfigureInterrupt(void); +void Timer_EnableInterrupt(void); + +#endif // _TIMERINTERRUPTCONFIGURATOR_H diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/TimerInterruptHandler.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/TimerInterruptHandler.c new file mode 100644 index 0000000..ebb543d --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/TimerInterruptHandler.c @@ -0,0 +1,25 @@ +#include "Types.h" +#include "TimerInterruptHandler.h" +#include "TimerInterruptConfigurator.h" + +static uint32 systemTime; + +void Timer_SetSystemTime(uint32 time) +{ + systemTime = time; +} + +uint32 Timer_GetSystemTime(void) +{ + return systemTime; +} + +void Timer_InterruptHandler(void) +{ + uint32 status = AT91C_BASE_TC0->TC_SR; + if (status & AT91C_TC_CPCS) + { + systemTime += 10; + } +} + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/TimerInterruptHandler.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/TimerInterruptHandler.h new file mode 100644 index 0000000..29c0413 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/TimerInterruptHandler.h @@ -0,0 +1,10 @@ +#ifndef _TIMERINTERRUPTHANDLER_H +#define _TIMERINTERRUPTHANDLER_H + +#include "Types.h" + +void Timer_SetSystemTime(uint32 time); +uint32 Timer_GetSystemTime(void); +void Timer_InterruptHandler(void); + +#endif // _TIMERINTERRUPTHANDLER_H diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/TimerModel.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/TimerModel.c new file mode 100644 index 0000000..fcc9db9 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/TimerModel.c @@ -0,0 +1,9 @@ +#include "Types.h" +#include "TimerModel.h" +#include "TaskScheduler.h" + +void TimerModel_UpdateTime(uint32 systemTime) +{ + TaskScheduler_Update(systemTime); +} + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/TimerModel.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/TimerModel.h new file mode 100644 index 0000000..54be21a --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/TimerModel.h @@ -0,0 +1,8 @@ +#ifndef _TIMERMODEL_H +#define _TIMERMODEL_H + +#include "Types.h" + +void TimerModel_UpdateTime(uint32 systemTime); + +#endif // _TIMERMODEL_H diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/Types.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/Types.h new file mode 100644 index 0000000..6a0f824 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/Types.h @@ -0,0 +1,103 @@ +#ifndef _MYTYPES_H_ +#define _MYTYPES_H_ + +#include "AT91SAM7X256.h" +#include + +#ifndef __monitor +#define __monitor +#endif + +// Peripheral Helper Definitions +#define USART0_CLOCK_ENABLE (AT91C_ID_US0) +#define USART0_TX_PIN (AT91C_PA1_TXD0) +#define TIMER0_CLOCK_ENABLE (((uint32)0x1) << AT91C_ID_TC0) +#define PIOA_CLOCK_ENABLE (((uint32)0x1) << AT91C_ID_PIOA) +#define PIOB_CLOCK_ENABLE (((uint32)0x1) << AT91C_ID_PIOB) +#define TIOA0_PIN_MASK (((uint32)0x1) << 23) // Timer/Counter Output Pin + +// Application Type Definitions +typedef unsigned int uint32; +typedef int int32; +typedef unsigned short uint16; +typedef short int16; +typedef unsigned char uint8; +typedef char int8; +typedef char bool; + +// Application Special Value Definitions +#ifndef TRUE +#define TRUE (1) +#endif +#ifndef FALSE +#define FALSE (0) +#endif +#ifndef NULL +#define NULL (0) +#endif // NULL +#define DONT_CARE (0) + +#ifndef INFINITY +#define INFINITY (1.0 / 0.0) +#endif + +#ifndef NAN +#define NAN (0.0 / 0.0) +#endif + +// MIN/MAX Definitions for Standard Types +#ifndef INT8_MAX +#define INT8_MAX 127 +#endif + +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif + +#ifndef UINT8_MAX +#define UINT8_MAX 0xFFU +#endif + +#ifndef UINT8_MIN +#define UINT8_MIN 0x00U +#endif + +#ifndef INT16_MAX +#define INT16_MAX 32767 +#endif + +#ifndef INT16_MIN +#define INT16_MIN (-32768) +#endif + +#ifndef UINT16_MAX +#define UINT16_MAX 0xFFFFU +#endif + +#ifndef UINT16_MIN +#define UINT16_MIN 0x0000U +#endif + +#ifndef INT32_MAX +#define INT32_MAX 0x7FFFFFFF +#endif + +#ifndef INT32_MIN +#define INT32_MIN (-INT32_MAX - 1) +#endif + +#ifndef UINT32_MAX +#define UINT32_MAX 0xFFFFFFFFU +#endif + +#ifndef UINT32_MIN +#define UINT32_MIN 0x00000000U +#endif + +typedef struct _EXAMPLE_STRUCT_T +{ + int x; + int y; +} EXAMPLE_STRUCT_T; + +#endif // _MYTYPES_H_ diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/UsartBaudRateRegisterCalculator.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/UsartBaudRateRegisterCalculator.c new file mode 100644 index 0000000..f4ad147 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/UsartBaudRateRegisterCalculator.c @@ -0,0 +1,18 @@ +#include "Types.h" +#include "UsartBaudRateRegisterCalculator.h" + +uint8 UsartModel_CalculateBaudRateRegisterSetting(uint32 masterClock, uint32 baudRate) +{ + uint32 registerSetting = ((masterClock * 10) / (baudRate * 16)); + + if ((registerSetting % 10) >= 5) + { + registerSetting = (registerSetting / 10) + 1; + } + else + { + registerSetting /= 10; + } + + return (uint8)registerSetting; +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/UsartBaudRateRegisterCalculator.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/UsartBaudRateRegisterCalculator.h new file mode 100644 index 0000000..50e9048 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/UsartBaudRateRegisterCalculator.h @@ -0,0 +1,6 @@ +#ifndef _USARTBAUDRATEREGISTERCALCULATOR_H +#define _USARTBAUDRATEREGISTERCALCULATOR_H + +uint8 UsartModel_CalculateBaudRateRegisterSetting(uint32 masterClock, uint32 baudRate); + +#endif // _USARTBAUDRATEREGISTERCALCULATOR_H diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/UsartConductor.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/UsartConductor.c new file mode 100644 index 0000000..3eeec3c --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/UsartConductor.c @@ -0,0 +1,21 @@ +#include "Types.h" +#include "UsartConductor.h" +#include "UsartHardware.h" +#include "UsartModel.h" +#include "TaskScheduler.h" + +void UsartConductor_Init(void) +{ + UsartHardware_Init(UsartModel_GetBaudRateRegisterSetting()); + UsartHardware_TransmitString(UsartModel_GetWakeupMessage()); +} + +void UsartConductor_Run(void) +{ + char* temp; + if (TaskScheduler_DoUsart()) + { + temp = UsartModel_GetFormattedTemperature(); + UsartHardware_TransmitString(temp); + } +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/UsartConductor.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/UsartConductor.h new file mode 100644 index 0000000..f420736 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/UsartConductor.h @@ -0,0 +1,7 @@ +#ifndef _USARTCONDUCTOR_H +#define _USARTCONDUCTOR_H + +void UsartConductor_Init(void); +void UsartConductor_Run(void); + +#endif // _USARTCONDUCTOR_H diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/UsartConfigurator.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/UsartConfigurator.c new file mode 100644 index 0000000..b8c2cdc --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/UsartConfigurator.c @@ -0,0 +1,39 @@ +#include "Types.h" +#include "UsartConfigurator.h" + +void Usart_ConfigureUsartIO(void) +{ + AT91C_BASE_PIOA->PIO_ASR = USART0_TX_PIN; + AT91C_BASE_PIOA->PIO_BSR = 0; + AT91C_BASE_PIOA->PIO_PDR = USART0_TX_PIN; +} + +void Usart_EnablePeripheralClock(void) +{ + AT91C_BASE_PMC->PMC_PCER = ((uint32)1) << USART0_CLOCK_ENABLE; +} + +void Usart_Reset(void) +{ + AT91C_BASE_US0->US_IDR = 0xffffffff; + AT91C_BASE_US0->US_CR = AT91C_US_RSTRX | AT91C_US_RSTTX | AT91C_US_RXDIS | AT91C_US_TXDIS; +} + +void Usart_ConfigureMode(void) +{ + AT91C_BASE_US0->US_MR = AT91C_US_USMODE_NORMAL | + AT91C_US_NBSTOP_1_BIT | + AT91C_US_PAR_NONE | + AT91C_US_CHRL_8_BITS | + AT91C_US_CLKS_CLOCK; +} + +void Usart_SetBaudRateRegister(uint8 baudRateRegisterSetting) +{ + AT91C_BASE_US0->US_BRGR = baudRateRegisterSetting; +} + +void Usart_Enable(void) +{ + AT91C_BASE_US0->US_CR = AT91C_US_TXEN; +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/UsartConfigurator.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/UsartConfigurator.h new file mode 100644 index 0000000..02bede2 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/UsartConfigurator.h @@ -0,0 +1,13 @@ +#ifndef _USARTCONFIGURATOR_H +#define _USARTCONFIGURATOR_H + +#include "Types.h" + +void Usart_ConfigureUsartIO(void); +void Usart_EnablePeripheralClock(void); +void Usart_Reset(void); +void Usart_ConfigureMode(void); +void Usart_SetBaudRateRegister(uint8 baudRateRegisterSetting); +void Usart_Enable(void); + +#endif // _USARTCONFIGURATOR_H diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/UsartHardware.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/UsartHardware.c new file mode 100644 index 0000000..e37c2c6 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/UsartHardware.c @@ -0,0 +1,22 @@ +#include "Types.h" +#include "UsartHardware.h" +#include "UsartConfigurator.h" +#include "UsartPutChar.h" + +void UsartHardware_Init(uint8 baudRateRegisterSetting) +{ + Usart_ConfigureUsartIO(); + Usart_EnablePeripheralClock(); + Usart_Reset(); + Usart_ConfigureMode(); + Usart_SetBaudRateRegister(baudRateRegisterSetting); + Usart_Enable(); +} + +void UsartHardware_TransmitString(char* data) +{ + while(*data != NULL) + { + Usart_PutChar(*data++); + } +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/UsartHardware.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/UsartHardware.h new file mode 100644 index 0000000..041e280 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/UsartHardware.h @@ -0,0 +1,9 @@ +#ifndef _USARTHARDWARE_H +#define _USARTHARDWARE_H + +#include "Types.h" + +void UsartHardware_Init(uint8 baudRateRegisterSetting); +void UsartHardware_TransmitString(char* data); + +#endif // _USARTHARDWARE_H diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/UsartModel.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/UsartModel.c new file mode 100644 index 0000000..d722a2f --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/UsartModel.c @@ -0,0 +1,34 @@ +#include "Types.h" +#include "UsartModel.h" +#include "ModelConfig.h" +#include "UsartBaudRateRegisterCalculator.h" +#include "TemperatureFilter.h" +#include +#include + +char formattedTemperature[32]; +char* wakeup = "It's Awesome Time!\n"; + +uint8 UsartModel_GetBaudRateRegisterSetting(void) +{ + return UsartModel_CalculateBaudRateRegisterSetting(MASTER_CLOCK, USART0_BAUDRATE); +} + +char* UsartModel_GetFormattedTemperature(void) +{ + float temperature = TemperatureFilter_GetTemperatureInCelcius(); + if (temperature == -INFINITY) + { + sprintf(formattedTemperature, "%s", "Temperature sensor failure!\n"); + } + else + { + sprintf(formattedTemperature, "%.1f C\n", temperature); + } + return formattedTemperature; +} + +char* UsartModel_GetWakeupMessage(void) +{ + return wakeup; +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/UsartModel.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/UsartModel.h new file mode 100644 index 0000000..7d94854 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/UsartModel.h @@ -0,0 +1,10 @@ +#ifndef _USARTMODEL_H +#define _USARTMODEL_H + +#include "Types.h" + +uint8 UsartModel_GetBaudRateRegisterSetting(void); +char* UsartModel_GetFormattedTemperature(void); +char* UsartModel_GetWakeupMessage(void); + +#endif // _USARTMODEL_H diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/UsartPutChar.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/UsartPutChar.c new file mode 100644 index 0000000..9e3ce2c --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/UsartPutChar.c @@ -0,0 +1,16 @@ +#include "Types.h" +#include "UsartPutChar.h" +#include "UsartTransmitBufferStatus.h" +#ifdef SIMULATE +#include +#endif + +void Usart_PutChar(char data) +{ + while(!Usart_ReadyToTransmit()); +#ifdef SIMULATE + printf("%c", data); +#else + AT91C_BASE_US0->US_THR = data; +#endif +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/UsartPutChar.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/UsartPutChar.h new file mode 100644 index 0000000..924446a --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/UsartPutChar.h @@ -0,0 +1,8 @@ +#ifndef _USARTPUT_HAR_H +#define _USARTPUT_HAR_H + +#include "Types.h" + +void Usart_PutChar(char data); + +#endif // _USARTPUT_HAR_H diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/UsartTransmitBufferStatus.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/UsartTransmitBufferStatus.c new file mode 100644 index 0000000..914b2e1 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/UsartTransmitBufferStatus.c @@ -0,0 +1,7 @@ +#include "Types.h" +#include "UsartTransmitBufferStatus.h" + +bool Usart_ReadyToTransmit(void) +{ + return (AT91C_BASE_US0->US_CSR & AT91C_US_TXRDY) > 0; +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/UsartTransmitBufferStatus.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/UsartTransmitBufferStatus.h new file mode 100644 index 0000000..b5925ba --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/src/UsartTransmitBufferStatus.h @@ -0,0 +1,8 @@ +#ifndef _USARTTRANSMITBUFFERSTATUS_H +#define _USARTTRANSMITBUFFERSTATUS_H + +#include "Types.h" + +bool Usart_ReadyToTransmit(void); + +#endif // _USARTTRANSMITBUFFERSTATUS_H diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestAdcConductor.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestAdcConductor.c new file mode 100644 index 0000000..a15d7d1 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestAdcConductor.c @@ -0,0 +1,121 @@ +#include "unity.h" +#include "UnityHelper.h" +#include "Types.h" +#include "Types.h" +#include "AdcConductor.h" +#include "MockAdcModel.h" +#include "MockAdcHardware.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void testInitShouldCallHardwareInit(void) +{ + AdcHardware_Init_Expect(); + AdcConductor_Init(); +} + +void testRunShouldNotDoAnythingIfItIsNotTime(void) +{ + AdcModel_DoGetSample_ExpectAndReturn(FALSE); + + AdcConductor_Run(); +} + +void testRunShouldNotPassAdcResultToModelIfSampleIsNotComplete(void) +{ + AdcModel_DoGetSample_ExpectAndReturn(TRUE); + AdcHardware_GetSampleComplete_ExpectAndReturn(FALSE); + + AdcConductor_Run(); +} + +void testRunShouldGetLatestSampleFromAdcAndPassItToModelAndStartNewConversionWhenItIsTime(void) +{ + AdcModel_DoGetSample_ExpectAndReturn(TRUE); + AdcHardware_GetSampleComplete_ExpectAndReturn(TRUE); + AdcHardware_GetSample_ExpectAndReturn(293U); + AdcModel_ProcessInput_Expect(293U); + AdcHardware_StartConversion_Expect(); + + AdcConductor_Run(); +} + +void testJustHereToTest_Should_ProperlyPassAStructAndVerifyIt(void) +{ + EXAMPLE_STRUCT_T TestStruct; + TestStruct.x = 5; + TestStruct.y = 7; + + AdcModel_DoNothingExceptTestASpecialType_ExpectAndReturn(TestStruct, TRUE); + + TEST_ASSERT_TRUE(AdcConductor_JustHereToTest()); +} + +//void testJustHereToTest_Should_FailThisTestIfYouUncommentXIsBecauseItsWrong(void) +//{ +// EXAMPLE_STRUCT_T TestStruct; +// TestStruct.x = 6; +// TestStruct.y = 7; +// +// AdcModel_DoNothingExceptTestASpecialType_ExpectAndReturn(TestStruct, TRUE); +// +// TEST_ASSERT_TRUE(AdcConductor_JustHereToTest()); +//} +// +//void testJustHereToTest_Should_FailThisTestIfYouUncommentYIsBecauseItsWrong(void) +//{ +// EXAMPLE_STRUCT_T TestStruct; +// TestStruct.x = 5; +// TestStruct.y = 8; +// +// AdcModel_DoNothingExceptTestASpecialType_ExpectAndReturn(TestStruct, TRUE); +// +// TEST_ASSERT_TRUE(AdcConductor_JustHereToTest()); +//} + +void test_AdcConductor_AlsoHereToTest_Should_ProperlyReturnAStructAsExpected1(void) +{ + EXAMPLE_STRUCT_T TestStruct; + TestStruct.x = 99; + TestStruct.y = 1; + + AdcModel_DoNothingExceptReturnASpecialType_ExpectAndReturn(TestStruct); + + TEST_ASSERT_TRUE(AdcConductor_AlsoHereToTest()); +} + +void test_AdcConductor_AlsoHereToTest_Should_ProperlyReturnAStructAsExpected2(void) +{ + EXAMPLE_STRUCT_T TestStruct; + TestStruct.x = 98; + TestStruct.y = 1; + + AdcModel_DoNothingExceptReturnASpecialType_ExpectAndReturn(TestStruct); + + TEST_ASSERT_FALSE(AdcConductor_AlsoHereToTest()); +} + +void test_AdcConductor_YetAnotherTest_Should_VerifyThatPointersToStructsAreTestable(void) +{ + uint32 TestNum = 3; + + AdModel_DoNothingExceptTestPointers_ExpectAndReturn(&TestNum, TRUE); + + TEST_ASSERT_TRUE(AdcConductor_YetAnotherTest()); +} + +//void test_AdcConductor_YetAnotherTest_Should_FailIfYouUncommentThisTestBecauseTheValuePointedToIsWrong(void) +//{ +// uint32 TestNum = 7; +// +// AdModel_DoNothingExceptTestPointers_ExpectAndReturn(&TestNum, FALSE); +// +// TEST_ASSERT_FALSE(AdcConductor_YetAnotherTest()); +//} + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestAdcHardware.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestAdcHardware.c new file mode 100644 index 0000000..7aabaa7 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestAdcHardware.c @@ -0,0 +1,44 @@ +#include "unity.h" +#include "Types.h" +#include "AdcHardware.h" +#include "MockAdcHardwareConfigurator.h" +#include "MockAdcTemperatureSensor.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void testInitShouldDelegateToConfiguratorAndTemperatureSensor(void) +{ + Adc_Reset_Expect(); + Adc_ConfigureMode_Expect(); + Adc_EnableTemperatureChannel_Expect(); + Adc_StartTemperatureSensorConversion_Expect(); + + AdcHardware_Init(); +} + +void testGetSampleCompleteShouldReturn_FALSE_WhenTemperatureSensorSampleReadyReturns_FALSE(void) +{ + Adc_TemperatureSensorSampleReady_ExpectAndReturn(FALSE); + TEST_ASSERT(!AdcHardware_GetSampleComplete()); +} + +void testGetSampleCompleteShouldReturn_TRUE_WhenTemperatureSensorSampleReadyReturns_TRUE(void) +{ + Adc_TemperatureSensorSampleReady_ExpectAndReturn(TRUE); + TEST_ASSERT(AdcHardware_GetSampleComplete()); +} + +void testGetSampleShouldDelegateToAdcTemperatureSensor(void) +{ + uint16 sample; + Adc_ReadTemperatureSensor_ExpectAndReturn(847); + + sample = AdcHardware_GetSample(); + TEST_ASSERT_EQUAL(847, sample); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestAdcHardwareConfigurator.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestAdcHardwareConfigurator.c new file mode 100644 index 0000000..c1feceb --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestAdcHardwareConfigurator.c @@ -0,0 +1,43 @@ +#include "unity.h" +#include "Types.h" +#include "AdcHardwareConfigurator.h" +#include "AT91SAM7X256.h" +#include "ModelConfig.h" + +AT91S_ADC AdcPeripheral; + +void setUp(void) +{ + +} + +void tearDown(void) +{ +} + +void testResetShouldResetTheAdcConverterPeripheral(void) +{ + AT91C_BASE_ADC->ADC_CR = 0; + Adc_Reset(); + TEST_ASSERT_EQUAL(AT91C_ADC_SWRST, AT91C_BASE_ADC->ADC_CR); +} + +void testConfigureModeShouldSetAdcModeRegisterAppropriately(void) +{ + uint32 prescaler = (MASTER_CLOCK / (2 * 2000000)) - 1; // 5MHz ADC clock + + AT91C_BASE_ADC->ADC_MR = 0; + + Adc_ConfigureMode(); + + TEST_ASSERT_EQUAL(prescaler, (AT91C_BASE_ADC->ADC_MR & AT91C_ADC_PRESCAL) >> 8); +} + +void testEnableTemperatureChannelShouldEnableTheAppropriateAdcInput(void) +{ + AT91C_BASE_ADC->ADC_CHER = 0; + + Adc_EnableTemperatureChannel(); + + TEST_ASSERT_EQUAL(0x1 << 4, AT91C_BASE_ADC->ADC_CHER); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestAdcModel.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestAdcModel.c new file mode 100644 index 0000000..f1dcb4a --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestAdcModel.c @@ -0,0 +1,33 @@ +#include "unity.h" +#include "Types.h" +#include "AdcModel.h" +#include "MockTaskScheduler.h" +#include "MockTemperatureCalculator.h" +#include "MockTemperatureFilter.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void testDoGetSampleShouldReturn_FALSE_WhenTaskSchedulerReturns_FALSE(void) +{ + TaskScheduler_DoAdc_ExpectAndReturn(FALSE); + TEST_ASSERT_EQUAL(FALSE, AdcModel_DoGetSample()); +} + +void testDoGetSampleShouldReturn_TRUE_WhenTaskSchedulerReturns_TRUE(void) +{ + TaskScheduler_DoAdc_ExpectAndReturn(TRUE); + TEST_ASSERT_EQUAL(TRUE, AdcModel_DoGetSample()); +} + +void testProcessInputShouldDelegateToTemperatureCalculatorAndPassResultToFilter(void) +{ + TemperatureCalculator_Calculate_ExpectAndReturn(21473, 23.5f); + TemperatureFilter_ProcessInput_Expect(23.5f); + AdcModel_ProcessInput(21473); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestAdcTemperatureSensor.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestAdcTemperatureSensor.c new file mode 100644 index 0000000..0be339f --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestAdcTemperatureSensor.c @@ -0,0 +1,47 @@ +#include "unity.h" +#include "Types.h" +#include "AdcTemperatureSensor.h" +#include "AT91SAM7X256.h" + +AT91S_ADC AdcPeripheral; + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void testShouldStartTemperatureSensorConversionWhenTriggered(void) +{ + AT91C_BASE_ADC->ADC_CR = 0; + Adc_StartTemperatureSensorConversion(); + TEST_ASSERT_EQUAL(AT91C_ADC_START, AT91C_BASE_ADC->ADC_CR); +} + +void testTemperatureSensorSampleReadyShouldReturnChannelConversionCompletionStatus(void) +{ + AT91C_BASE_ADC->ADC_SR = 0; + TEST_ASSERT_EQUAL(FALSE, Adc_TemperatureSensorSampleReady()); + AT91C_BASE_ADC->ADC_SR = ~AT91C_ADC_EOC4; + TEST_ASSERT_EQUAL(FALSE, Adc_TemperatureSensorSampleReady()); + AT91C_BASE_ADC->ADC_SR = AT91C_ADC_EOC4; + TEST_ASSERT_EQUAL(TRUE, Adc_TemperatureSensorSampleReady()); + AT91C_BASE_ADC->ADC_SR = 0xffffffff; + TEST_ASSERT_EQUAL(TRUE, Adc_TemperatureSensorSampleReady()); +} + +void testReadTemperatureSensorShouldFetchAndTranslateLatestReadingToMillivolts(void) +{ + uint16 result; + + // ADC bit weight at 10-bit resolution with 3.0V reference = 2.9296875 mV/LSB + AT91C_BASE_ADC->ADC_CDR4 = 138; + result = Adc_ReadTemperatureSensor(); + TEST_ASSERT_EQUAL(404, result); + + AT91C_BASE_ADC->ADC_CDR4 = 854; + result = Adc_ReadTemperatureSensor(); + TEST_ASSERT_EQUAL(2502, result); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestExecutor.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestExecutor.c new file mode 100644 index 0000000..8e48326 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestExecutor.c @@ -0,0 +1,36 @@ +#include "unity.h" +#include "Types.h" +#include "Executor.h" +#include "MockModel.h" +#include "MockUsartConductor.h" +#include "MockAdcConductor.h" +#include "MockTimerConductor.h" +#include "MockIntrinsicsWrapper.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void testInitShouldCallInitOfAllConductorsAndTheModel(void) +{ + Model_Init_Expect(); + UsartConductor_Init_Expect(); + AdcConductor_Init_Expect(); + TimerConductor_Init_Expect(); + Interrupt_Enable_Expect(); + + Executor_Init(); +} + +void testRunShouldCallRunForEachConductorAndReturnTrueAlways(void) +{ + UsartConductor_Run_Expect(); + TimerConductor_Run_Expect(); + AdcConductor_Run_Expect(); + + TEST_ASSERT_EQUAL(TRUE, Executor_Run()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestMain.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestMain.c new file mode 100644 index 0000000..baf3382 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestMain.c @@ -0,0 +1,24 @@ +#include "unity.h" +#include "Types.h" +#include "MockExecutor.h" +#include "Main.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void testMainShouldCallExecutorInitAndContinueToCallExecutorRunUntilHalted(void) +{ + Executor_Init_Expect(); + Executor_Run_ExpectAndReturn(TRUE); + Executor_Run_ExpectAndReturn(TRUE); + Executor_Run_ExpectAndReturn(TRUE); + Executor_Run_ExpectAndReturn(TRUE); + Executor_Run_ExpectAndReturn(FALSE); + + AppMain(); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestModel.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestModel.c new file mode 100644 index 0000000..59dda1d --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestModel.c @@ -0,0 +1,20 @@ +#include "unity.h" +#include "Types.h" +#include "Model.h" +#include "MockTaskScheduler.h" +#include "MockTemperatureFilter.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void testInitShouldCallSchedulerAndTemperatureFilterInit(void) +{ + TaskScheduler_Init_Expect(); + TemperatureFilter_Init_Expect(); + Model_Init(); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestTaskScheduler.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestTaskScheduler.c new file mode 100644 index 0000000..29d1edf --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestTaskScheduler.c @@ -0,0 +1,104 @@ +#include "unity.h" +#include "Types.h" +#include "TaskScheduler.h" + +void setUp(void) +{ + TaskScheduler_Init(); +} + +void tearDown(void) +{ +} + +void testShouldScheduleUsartTaskAfter1000ms(void) +{ + TEST_ASSERT_EQUAL(FALSE, TaskScheduler_DoUsart()); + + TaskScheduler_Update(999); + TEST_ASSERT_EQUAL(FALSE, TaskScheduler_DoUsart()); + + TaskScheduler_Update(1000); + TEST_ASSERT_EQUAL(TRUE, TaskScheduler_DoUsart()); +} + +void testShouldClearUsartDoFlagAfterReported(void) +{ + TEST_ASSERT_EQUAL(FALSE, TaskScheduler_DoUsart()); + TaskScheduler_Update(1000); + TEST_ASSERT_EQUAL(TRUE, TaskScheduler_DoUsart()); + TEST_ASSERT_EQUAL(FALSE, TaskScheduler_DoUsart()); +} + +void testShouldScheduleUsartTaskEvery1000ms(void) +{ + TEST_ASSERT_EQUAL(FALSE, TaskScheduler_DoUsart()); + + TaskScheduler_Update(1300); + TEST_ASSERT_EQUAL(TRUE, TaskScheduler_DoUsart()); + + TaskScheduler_Update(2000); + TEST_ASSERT_EQUAL(TRUE, TaskScheduler_DoUsart()); + + TaskScheduler_Update(3100); + TEST_ASSERT_EQUAL(TRUE, TaskScheduler_DoUsart()); +} + +void testShouldScheduleUsartTaskOnlyOncePerPeriod(void) +{ + TEST_ASSERT_EQUAL(FALSE, TaskScheduler_DoUsart()); + TaskScheduler_Update(1000); + TEST_ASSERT_EQUAL(TRUE, TaskScheduler_DoUsart()); + TaskScheduler_Update(1001); + TEST_ASSERT_EQUAL(FALSE, TaskScheduler_DoUsart()); + TaskScheduler_Update(1999); + TEST_ASSERT_EQUAL(FALSE, TaskScheduler_DoUsart()); + TaskScheduler_Update(2000); + TEST_ASSERT_EQUAL(TRUE, TaskScheduler_DoUsart()); +} + +void testShouldScheduleAdcTaskAfter100ms(void) +{ + TEST_ASSERT_EQUAL(FALSE, TaskScheduler_DoAdc()); + + TaskScheduler_Update(99); + TEST_ASSERT_EQUAL(FALSE, TaskScheduler_DoAdc()); + + TaskScheduler_Update(100); + TEST_ASSERT_EQUAL(TRUE, TaskScheduler_DoAdc()); +} + +void testShouldClearAdcDoFlagAfterReported(void) +{ + TEST_ASSERT_EQUAL(FALSE, TaskScheduler_DoAdc()); + TaskScheduler_Update(100); + TEST_ASSERT_EQUAL(TRUE, TaskScheduler_DoAdc()); + TEST_ASSERT_EQUAL(FALSE, TaskScheduler_DoAdc()); +} + +void testShouldScheduleAdcTaskEvery100ms(void) +{ + TEST_ASSERT_EQUAL(FALSE, TaskScheduler_DoAdc()); + + TaskScheduler_Update(121); + TEST_ASSERT_EQUAL(TRUE, TaskScheduler_DoAdc()); + + TaskScheduler_Update(200); + TEST_ASSERT_EQUAL(TRUE, TaskScheduler_DoAdc()); + + TaskScheduler_Update(356); + TEST_ASSERT_EQUAL(TRUE, TaskScheduler_DoAdc()); +} + +void testShouldScheduleAdcTaskOnlyOncePerPeriod(void) +{ + TEST_ASSERT_EQUAL(FALSE, TaskScheduler_DoAdc()); + TaskScheduler_Update(100); + TEST_ASSERT_EQUAL(TRUE, TaskScheduler_DoAdc()); + TaskScheduler_Update(101); + TEST_ASSERT_EQUAL(FALSE, TaskScheduler_DoAdc()); + TaskScheduler_Update(199); + TEST_ASSERT_EQUAL(FALSE, TaskScheduler_DoAdc()); + TaskScheduler_Update(200); + TEST_ASSERT_EQUAL(TRUE, TaskScheduler_DoAdc()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestTemperatureCalculator.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestTemperatureCalculator.c new file mode 100644 index 0000000..dbb7dea --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestTemperatureCalculator.c @@ -0,0 +1,33 @@ +#include "unity.h" +#include "Types.h" +#include "TemperatureCalculator.h" +#include + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void testTemperatureCalculatorShouldCalculateTemperatureFromMillivolts(void) +{ + float result; + + // Series resistor is 5k Ohms; Reference voltage is 3.0V + // R(t) = A * e^(B*t); R is resistance of thermisor; t is temperature in C + result = TemperatureCalculator_Calculate(1000); + TEST_ASSERT_FLOAT_WITHIN(0.01f, 25.0f, result); + + result = TemperatureCalculator_Calculate(2985); + TEST_ASSERT_FLOAT_WITHIN(0.01f, 68.317f, result); + + result = TemperatureCalculator_Calculate(3); + TEST_ASSERT_FLOAT_WITHIN(0.01f, -19.96f, result); +} + +void testShouldReturnNegativeInfinityWhen_0_millivoltsInput(void) +{ + TEST_ASSERT_FLOAT_WITHIN(0.0000001f, -INFINITY, TemperatureCalculator_Calculate(0)); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestTemperatureFilter.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestTemperatureFilter.c new file mode 100644 index 0000000..58fb178 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestTemperatureFilter.c @@ -0,0 +1,69 @@ +#include "unity.h" +#include "Types.h" +#include "TemperatureFilter.h" +#include + +void setUp(void) +{ + TemperatureFilter_Init(); +} + +void tearDown(void) +{ +} + +void testShouldInitializeTemeratureToInvalidValue(void) +{ + TemperatureFilter_Init(); + TEST_ASSERT_FLOAT_WITHIN(0.0001f, -INFINITY, TemperatureFilter_GetTemperatureInCelcius()); +} + +void testShouldInitializeTemperatureAfterCallToInit(void) +{ + TemperatureFilter_Init(); + TemperatureFilter_ProcessInput(17.8f); + TEST_ASSERT_FLOAT_WITHIN(0.0001f, 17.8f, TemperatureFilter_GetTemperatureInCelcius()); + + TemperatureFilter_Init(); + TemperatureFilter_ProcessInput(32.6f); + TEST_ASSERT_FLOAT_WITHIN(0.0001f, 32.6f, TemperatureFilter_GetTemperatureInCelcius()); +} + +void setValueAndVerifyResponse(float input, float response) +{ + float actual; + TemperatureFilter_ProcessInput(input); + actual = TemperatureFilter_GetTemperatureInCelcius(); + TEST_ASSERT_FLOAT_WITHIN(0.0001f, response, actual); +} + +void testShouldWeightEachSubsequentValueBy25PercentAfterInitialValue(void) +{ + TemperatureFilter_Init(); + setValueAndVerifyResponse(0.0f, 0.0f); + setValueAndVerifyResponse(10.0f, 2.5f); + setValueAndVerifyResponse(10.0f, 4.375f); + setValueAndVerifyResponse(10.0f, 5.78125f); + + TemperatureFilter_Init(); + setValueAndVerifyResponse(100.0f, 100.0f); + setValueAndVerifyResponse(0.0f, 75.0f); + setValueAndVerifyResponse(0.0f, 56.25f); + setValueAndVerifyResponse(0.0f, 42.1875f); +} + +void setInvalidTemperatureAndVerifyReinitialized(float invalidTemperature) +{ + TemperatureFilter_Init(); + setValueAndVerifyResponse(100.0f, 100.0f); + setValueAndVerifyResponse(invalidTemperature, -INFINITY); + setValueAndVerifyResponse(14.3f, 14.3f); +} + +void testShouldResetAverageIfPassedInfinityOrInvalidValue(void) +{ + setInvalidTemperatureAndVerifyReinitialized(-INFINITY); + setInvalidTemperatureAndVerifyReinitialized(+INFINITY); + setInvalidTemperatureAndVerifyReinitialized(+NAN); + setInvalidTemperatureAndVerifyReinitialized(-NAN); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestTimerConductor.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestTimerConductor.c new file mode 100644 index 0000000..8064a8c --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestTimerConductor.c @@ -0,0 +1,32 @@ +#include "unity.h" +#include "Types.h" +#include "TimerConductor.h" +#include "MockTimerHardware.h" +#include "MockTimerModel.h" +#include "MockTimerInterruptHandler.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void testInitShouldCallHardwareInit(void) +{ + TimerHardware_Init_Expect(); + + TimerConductor_Init(); +} + +void testRunShouldGetSystemTimeAndPassOnToModelForEventScheduling(void) +{ + Timer_GetSystemTime_ExpectAndReturn(1230); + TimerModel_UpdateTime_Expect(1230); + TimerConductor_Run(); + + Timer_GetSystemTime_ExpectAndReturn(837460); + TimerModel_UpdateTime_Expect(837460); + TimerConductor_Run(); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestTimerConfigurator.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestTimerConfigurator.c new file mode 100644 index 0000000..5c7d4e0 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestTimerConfigurator.c @@ -0,0 +1,112 @@ +#include "unity.h" +#include "Types.h" +#include "TimerConfigurator.h" +#include "AT91SAM7X256.h" +#include "MockTimerInterruptConfigurator.h" + +AT91S_PMC PmcPeripheral; +AT91S_TC TimerCounter0Peripheral; +AT91S_PIO PioBPeripheral; + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void testEnablePeripheralClocksShouldEnableClockToTimer0Peripheral(void) +{ + AT91C_BASE_PMC->PMC_PCER = 0; + Timer_EnablePeripheralClocks(); + TEST_ASSERT_EQUAL( + TIMER0_CLOCK_ENABLE, + AT91C_BASE_PMC->PMC_PCER & TIMER0_CLOCK_ENABLE); +} + +void testEnablePeripheralClocksShouldEnableClockToPIOBPeripheral(void) +{ + AT91C_BASE_PMC->PMC_PCER = 0; + Timer_EnablePeripheralClocks(); + TEST_ASSERT_EQUAL( + PIOB_CLOCK_ENABLE, + AT91C_BASE_PMC->PMC_PCER & PIOB_CLOCK_ENABLE); +} + +void testResetShouldSetTimer0ClockDisableBit_DisableTimer0Interrupts_ClearStatusRegister(void) +{ + AT91C_BASE_TC0->TC_CCR = 0; + AT91C_BASE_TC0->TC_IDR = 0; + AT91C_BASE_TC0->TC_SR = 0xFFFFFFFF; + Timer_Reset(); + TEST_ASSERT_EQUAL(0x00000002, AT91C_BASE_TC0->TC_CCR); + TEST_ASSERT_EQUAL(0xffffffff, AT91C_BASE_TC0->TC_IDR); + // CANNOT BE VERIFIED!! TEST_ASSERT_EQUAL(0X00000000, AT91C_BASE_TC0->TC_SR); +} + +void testEnableOutputPinShouldEnable_TIOA0_DigitalOutput(void) +{ + AT91C_BASE_PIOB->PIO_PDR = 0; + Timer_EnableOutputPin(); + TEST_ASSERT_EQUAL(TIOA0_PIN_MASK, AT91C_BASE_PIOB->PIO_PDR); +} + +void testConfigureModeShouldConfigureTimer0ClockSourceForMasterClockDividedBy1024(void) +{ + AT91C_BASE_TC0->TC_CMR = 0; + Timer_ConfigureMode(); + TEST_ASSERT_EQUAL(0x00000004, AT91C_BASE_TC0->TC_CMR & 0x00000007); +} + +void testConfigureModeShouldConfigureTimer0ForWaveGeneration(void) +{ + AT91C_BASE_TC0->TC_CMR = 0; + Timer_ConfigureMode(); + TEST_ASSERT_EQUAL(0x00008000, AT91C_BASE_TC0->TC_CMR & 0x00008000); +} + +void testConfigureModeShouldConfigureTimer0ForUpModeWithAutomaticTriggerOnRCCompare(void) +{ + AT91C_BASE_TC0->TC_CMR = 0; + Timer_ConfigureMode(); + TEST_ASSERT_EQUAL(0x00004000, AT91C_BASE_TC0->TC_CMR & 0x00006000); +} + +void testConfigureModeShouldConfigureTimer0ToToggleTIOAOnRCCompare(void) +{ + AT91C_BASE_TC0->TC_CMR = 0; + Timer_ConfigureMode(); + TEST_ASSERT_EQUAL(0x000C0000, AT91C_BASE_TC0->TC_CMR & 0x000C0000); +} + +void testConfigurePeriodShouldConfigureRegisterCFor10msInterval(void) +{ + AT91C_BASE_TC0->TC_RC = 0; + Timer_ConfigurePeriod(); + TEST_ASSERT_EQUAL(469, AT91C_BASE_TC0->TC_RC); +} + +void testEnableShouldSetEnableFlagForTimer0(void) +{ + AT91C_BASE_TC0->TC_CCR = 0; + Timer_Enable(); + TEST_ASSERT_EQUAL_INT(1, AT91C_BASE_TC0->TC_CCR); +} + +void testConfigureInterruptHandler(void) +{ + Timer_DisableInterrupt_Expect(); + Timer_ResetSystemTime_Expect(); + Timer_ConfigureInterrupt_Expect(); + Timer_EnableInterrupt_Expect(); + + Timer_ConfigureInterruptHandler(); +} + +void testStartShouldSetSoftwareTriggerFlag(void) +{ + AT91C_BASE_TC0->TC_CCR = 0; + Timer_Start(); + TEST_ASSERT_EQUAL(0x04, AT91C_BASE_TC0->TC_CCR); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestTimerHardware.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestTimerHardware.c new file mode 100644 index 0000000..16339d0 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestTimerHardware.c @@ -0,0 +1,26 @@ +#include "unity.h" +#include "Types.h" +#include "TimerHardware.h" +#include "MockTimerConfigurator.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void testInitShouldDelegateAppropriatelyToConfigurator(void) +{ + Timer_EnablePeripheralClocks_Expect(); + Timer_Reset_Expect(); + Timer_ConfigureMode_Expect(); + Timer_ConfigurePeriod_Expect(); + Timer_EnableOutputPin_Expect(); + Timer_Enable_Expect(); + Timer_ConfigureInterruptHandler_Expect(); + Timer_Start_Expect(); + + TimerHardware_Init(); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestTimerInterruptConfigurator.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestTimerInterruptConfigurator.c new file mode 100644 index 0000000..13c35f4 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestTimerInterruptConfigurator.c @@ -0,0 +1,78 @@ +#include "unity.h" +#include "Types.h" +#include "TimerInterruptConfigurator.h" +#include "MockTimerInterruptHandler.h" +#include "AT91SAM7X256.h" + +AT91S_AIC AicPeripheral; +AT91S_TC TimerCounter0Peripheral; + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void test_TIMER0_ID_MASK_ShouldBeCorrect(void) +{ + TEST_ASSERT_EQUAL(((uint32)0x1) << AT91C_ID_TC0, TIMER0_ID_MASK); +} + +void testDisableInterruptDisablesTimer0InterruptInTheInterruptController(void) +{ + AT91C_BASE_AIC->AIC_IDCR = 0; + Timer_DisableInterrupt(); + TEST_ASSERT_EQUAL(TIMER0_ID_MASK, AT91C_BASE_AIC->AIC_IDCR); +} + +void testResetSystemTimeDelegatesTo_Timer_SetSystemTime_Appropriately(void) +{ + Timer_SetSystemTime_Expect(0); + Timer_ResetSystemTime(); +} + +void testConfigureInterruptShouldSetInterruptHandlerAppropriately(void) +{ + AT91C_BASE_AIC->AIC_SVR[AT91C_ID_TC0] = (uint32)NULL; + Timer_ConfigureInterrupt(); + TEST_ASSERT_EQUAL((uint32)Timer_InterruptHandler, AT91C_BASE_AIC->AIC_SVR[AT91C_ID_TC0]); +} + +void testConfigureInterruptShouldSetInterruptLevelInSourceModeRegisterAppropriately(void) +{ + AT91C_BASE_AIC->AIC_SMR[AT91C_ID_TC0] = 0; + Timer_ConfigureInterrupt(); + TEST_ASSERT_EQUAL( + AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL, + AT91C_BASE_AIC->AIC_SMR[AT91C_ID_TC0] & 0x00000060); +} + +void testConfigureInterruptShouldSetInterruptPriorityInSourceModeRegisterAppropriately(void) +{ + AT91C_BASE_AIC->AIC_SMR[AT91C_ID_TC0] = 0; + Timer_ConfigureInterrupt(); + TEST_ASSERT_EQUAL(1, AT91C_BASE_AIC->AIC_SMR[AT91C_ID_TC0] & 0x00000007); +} + +void testConfigureInterruptShouldClearTimer0InterruptOnTheInterruptController(void) +{ + AT91C_BASE_AIC->AIC_ICCR = 0; + Timer_ConfigureInterrupt(); + TEST_ASSERT_EQUAL(TIMER0_ID_MASK, AT91C_BASE_AIC->AIC_ICCR); +} + +void testConfigureInterruptShouldEnableCompareInterruptForRegisterC(void) +{ + AT91C_BASE_TC0->TC_IER = 0; + Timer_ConfigureInterrupt(); + TEST_ASSERT_EQUAL(AT91C_TC_CPCS, AT91C_BASE_TC0->TC_IER); +} + +void testEnableInterruptShouldEnableTimer0InterruptsInInterruptCotroller(void) +{ + AT91C_BASE_AIC->AIC_IECR = 0; + Timer_EnableInterrupt(); + TEST_ASSERT_EQUAL(TIMER0_ID_MASK, AT91C_BASE_AIC->AIC_IECR); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestTimerInterruptHandler.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestTimerInterruptHandler.c new file mode 100644 index 0000000..8e2e64e --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestTimerInterruptHandler.c @@ -0,0 +1,66 @@ +#include "unity.h" +#include "Types.h" +#include "TimerInterruptHandler.h" +#include "AT91SAM7X256.h" + +AT91S_TC TimerCounter0Peripheral; + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void testSetAndGetSystemTime(void) +{ + Timer_SetSystemTime(0); + TEST_ASSERT_EQUAL(0, Timer_GetSystemTime()); + + Timer_SetSystemTime(129837); + TEST_ASSERT_EQUAL(129837, Timer_GetSystemTime()); + + Timer_SetSystemTime(UINT32_MAX); + TEST_ASSERT_EQUAL(UINT32_MAX, Timer_GetSystemTime()); +} + +void testInterruptHandlerShouldIncrementSystemTimeOnlyIfStatusHasCompareRegisterCOverflowBitSet(void) +{ + Timer_SetSystemTime(0); + AT91C_BASE_TC0->TC_SR = 0; + Timer_InterruptHandler(); + TEST_ASSERT_EQUAL(0, Timer_GetSystemTime()); + + Timer_SetSystemTime(0); + AT91C_BASE_TC0->TC_SR = ~AT91C_TC_CPCS; + Timer_InterruptHandler(); + TEST_ASSERT_EQUAL(0, Timer_GetSystemTime()); + + Timer_SetSystemTime(0); + AT91C_BASE_TC0->TC_SR = AT91C_TC_CPCS; + Timer_InterruptHandler(); + TEST_ASSERT(Timer_GetSystemTime() > 0); + + Timer_SetSystemTime(0); + AT91C_BASE_TC0->TC_SR = 0xffffffff; + Timer_InterruptHandler(); + TEST_ASSERT(Timer_GetSystemTime() > 0); +} + +void testInterruptHandlerShouldIncrementSystemTimerBy_10(void) +{ + Timer_SetSystemTime(0); + AT91C_BASE_TC0->TC_SR = AT91C_TC_CPCS; + Timer_InterruptHandler(); + TEST_ASSERT_EQUAL(10, Timer_GetSystemTime()); + + AT91C_BASE_TC0->TC_SR = AT91C_TC_CPCS; + Timer_InterruptHandler(); + TEST_ASSERT_EQUAL(20, Timer_GetSystemTime()); + + Timer_SetSystemTime(39426857); + AT91C_BASE_TC0->TC_SR = AT91C_TC_CPCS; + Timer_InterruptHandler(); + TEST_ASSERT_EQUAL(39426867, Timer_GetSystemTime()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestTimerModel.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestTimerModel.c new file mode 100644 index 0000000..e92a96a --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestTimerModel.c @@ -0,0 +1,18 @@ +#include "unity.h" +#include "Types.h" +#include "TimerModel.h" +#include "MockTaskScheduler.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void testUpdateTimeShouldDelegateToTaskScheduler(void) +{ + TaskScheduler_Update_Expect(19387L); + TimerModel_UpdateTime(19387L); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestUsartBaudRateRegisterCalculator.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestUsartBaudRateRegisterCalculator.c new file mode 100644 index 0000000..08dc045 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestUsartBaudRateRegisterCalculator.c @@ -0,0 +1,21 @@ +#include "unity.h" +#include "Types.h" +#include "UsartBaudRateRegisterCalculator.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void testCalculateBaudRateRegisterSettingShouldCalculateRegisterSettingAppropriately(void) +{ + // BaudRate = MCK / (CD x 16) - per datasheet section 30.6.1.2 "Baud Rate Calculation Example" + TEST_ASSERT_EQUAL(26, UsartModel_CalculateBaudRateRegisterSetting(48000000, 115200)); + TEST_ASSERT_EQUAL(6, UsartModel_CalculateBaudRateRegisterSetting(3686400, 38400)); + TEST_ASSERT_EQUAL(23, UsartModel_CalculateBaudRateRegisterSetting(14318180, 38400)); + TEST_ASSERT_EQUAL(20, UsartModel_CalculateBaudRateRegisterSetting(12000000, 38400)); + TEST_ASSERT_EQUAL(13, UsartModel_CalculateBaudRateRegisterSetting(12000000, 56800)); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestUsartConductor.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestUsartConductor.c new file mode 100644 index 0000000..fd6de6e --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestUsartConductor.c @@ -0,0 +1,40 @@ +#include "unity.h" +#include "Types.h" +#include "UsartConductor.h" +#include "MockUsartModel.h" +#include "MockUsartHardware.h" +#include "MockTaskScheduler.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void testShouldInitializeHardwareWhenInitCalled(void) +{ + UsartModel_GetBaudRateRegisterSetting_ExpectAndReturn(4); + UsartModel_GetWakeupMessage_ExpectAndReturn("Hey there!"); + UsartHardware_TransmitString_Expect("Hey there!"); + UsartHardware_Init_Expect(4); + + UsartConductor_Init(); +} + +void testRunShouldNotDoAnythingIfSchedulerSaysItIsNotTimeYet(void) +{ + TaskScheduler_DoUsart_ExpectAndReturn(FALSE); + + UsartConductor_Run(); +} + +void testRunShouldGetCurrentTemperatureAndTransmitIfSchedulerSaysItIsTime(void) +{ + TaskScheduler_DoUsart_ExpectAndReturn(TRUE); + UsartModel_GetFormattedTemperature_ExpectAndReturn("hey there"); + UsartHardware_TransmitString_Expect("hey there"); + + UsartConductor_Run(); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestUsartConfigurator.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestUsartConfigurator.c new file mode 100644 index 0000000..b23029e --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestUsartConfigurator.c @@ -0,0 +1,77 @@ +#include "unity.h" +#include "Types.h" +#include "UsartConfigurator.h" + +AT91S_PIO PioAPeripheral; +AT91S_PMC PmcPeripheral; +AT91S_USART Usart0Peripheral; + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void testConfigureUsartIOShouldConfigureUsartTxPinfForPeripheralIO(void) +{ + AT91C_BASE_PIOA->PIO_ASR = 0; + AT91C_BASE_PIOA->PIO_BSR = 0xffffffff; + AT91C_BASE_PIOA->PIO_PDR = 0; + Usart_ConfigureUsartIO(); + TEST_ASSERT_EQUAL(USART0_TX_PIN, AT91C_BASE_PIOA->PIO_ASR); + TEST_ASSERT_EQUAL(0, AT91C_BASE_PIOA->PIO_BSR); + TEST_ASSERT_EQUAL(USART0_TX_PIN, AT91C_BASE_PIOA->PIO_PDR); +} + +void testEnablePeripheralClockShouldEnableClockToUsartPeripheral(void) +{ + AT91C_BASE_PMC->PMC_PCER = 0; + Usart_EnablePeripheralClock(); + TEST_ASSERT_EQUAL(((uint32)1) << USART0_CLOCK_ENABLE, AT91C_BASE_PMC->PMC_PCER); +} + +void testResetShouldDisableAllUsartInterrupts(void) +{ + AT91C_BASE_US0->US_IDR = 0; + Usart_Reset(); + TEST_ASSERT_EQUAL(0xffffffff, AT91C_BASE_US0->US_IDR); +} + +void testResetShouldResetUsartTransmitterAndReceiver(void) +{ + AT91C_BASE_US0->US_CR = 0; + Usart_Reset(); + TEST_ASSERT_EQUAL(AT91C_US_RSTRX | AT91C_US_RSTTX | AT91C_US_RXDIS | AT91C_US_TXDIS, AT91C_BASE_US0->US_CR); +} + +void testConfigureModeShouldSetUsartModeToAsynchronous(void) +{ + uint32 asyncMode = (AT91C_US_USMODE_NORMAL | + AT91C_US_NBSTOP_1_BIT | + AT91C_US_PAR_NONE | + AT91C_US_CHRL_8_BITS | + AT91C_US_CLKS_CLOCK); + + AT91C_BASE_US0->US_MR = ~asyncMode; + Usart_ConfigureMode(); + TEST_ASSERT_EQUAL(asyncMode, AT91C_BASE_US0->US_MR); +} + +void testSetBaudRateRegisterShouldSetUsartBaudRateRegisterToValuePassedAsParameter(void) +{ + AT91C_BASE_US0->US_BRGR = 0; + Usart_SetBaudRateRegister(3); + TEST_ASSERT_EQUAL(3, AT91C_BASE_US0->US_BRGR); + Usart_SetBaudRateRegister(251); + TEST_ASSERT_EQUAL(251, AT91C_BASE_US0->US_BRGR); +} + + +void testEnableShouldEnableUsart0Transmitter(void) +{ + AT91C_BASE_US0->US_CR = 0; + Usart_Enable(); + TEST_ASSERT_EQUAL(AT91C_US_TXEN, AT91C_BASE_US0->US_CR); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestUsartHardware.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestUsartHardware.c new file mode 100644 index 0000000..b4a0d0c --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestUsartHardware.c @@ -0,0 +1,37 @@ +#include "unity.h" +#include "Types.h" +#include "UsartHardware.h" +#include "AT91SAM7X256.h" +#include "MockUsartConfigurator.h" +#include "MockUsartPutChar.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void testInitShouldConfigureUsartPeripheralByCallingConfiguratorAppropriately(void) +{ + Usart_ConfigureUsartIO_Expect(); + Usart_EnablePeripheralClock_Expect(); + Usart_Reset_Expect(); + Usart_ConfigureMode_Expect(); + Usart_SetBaudRateRegister_Expect(73); + Usart_Enable_Expect(); + + UsartHardware_Init(73); +} + +void testTransmitStringShouldSendDesiredStringOutUsingUsart(void) +{ + Usart_PutChar_Expect('h'); + Usart_PutChar_Expect('e'); + Usart_PutChar_Expect('l'); + Usart_PutChar_Expect('l'); + Usart_PutChar_Expect('o'); + + UsartHardware_TransmitString("hello"); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestUsartModel.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestUsartModel.c new file mode 100644 index 0000000..6ab23bc --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestUsartModel.c @@ -0,0 +1,40 @@ +#include "unity.h" +#include "Types.h" +#include "UsartModel.h" +#include "ModelConfig.h" +#include "MockTemperatureFilter.h" +#include "MockUsartBaudRateRegisterCalculator.h" +#include + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void testGetBaudRateRegisterSettingShouldReturnAppropriateBaudRateRegisterSetting(void) +{ + uint8 dummyRegisterSetting = 17; + UsartModel_CalculateBaudRateRegisterSetting_ExpectAndReturn(MASTER_CLOCK, USART0_BAUDRATE, dummyRegisterSetting); + + TEST_ASSERT_EQUAL(dummyRegisterSetting, UsartModel_GetBaudRateRegisterSetting()); +} + +void testGetFormattedTemperatureFormatsTemperatureFromCalculatorAppropriately(void) +{ + TemperatureFilter_GetTemperatureInCelcius_ExpectAndReturn(25.0f); + TEST_ASSERT_EQUAL_STRING("25.0 C\n", UsartModel_GetFormattedTemperature()); +} + +void testShouldReturnErrorMessageUponInvalidTemperatureValue(void) +{ + TemperatureFilter_GetTemperatureInCelcius_ExpectAndReturn(-INFINITY); + TEST_ASSERT_EQUAL_STRING("Temperature sensor failure!\n", UsartModel_GetFormattedTemperature()); +} + +void testShouldReturnWakeupMessage(void) +{ + TEST_ASSERT_EQUAL_STRING("It's Awesome Time!\n", UsartModel_GetWakeupMessage()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestUsartPutChar.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestUsartPutChar.c new file mode 100644 index 0000000..766a889 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestUsartPutChar.c @@ -0,0 +1,43 @@ +#include "unity.h" +#include "Types.h" +#include "UsartPutChar.h" +#include "MockUsartTransmitBufferStatus.h" + +AT91S_USART Usart0Peripheral; + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void testPutCharShouldWriteDesiredCharacterToUsartTransmitBuffer(void) +{ + AT91C_BASE_US0->US_THR = 0; + + Usart_ReadyToTransmit_ExpectAndReturn(TRUE); + Usart_PutChar('x'); + TEST_ASSERT_EQUAL('x', AT91C_BASE_US0->US_THR); + + Usart_ReadyToTransmit_ExpectAndReturn(TRUE); + Usart_PutChar('1'); + TEST_ASSERT_EQUAL('1', AT91C_BASE_US0->US_THR); + + Usart_ReadyToTransmit_ExpectAndReturn(TRUE); + Usart_PutChar(':'); + TEST_ASSERT_EQUAL(':', AT91C_BASE_US0->US_THR); +} + +void testPutCharShouldWaitUntilReadyToTransmitBeforeLoadingTransmitBufffer(void) +{ + AT91C_BASE_US0->US_THR = 0; + + Usart_ReadyToTransmit_ExpectAndReturn(FALSE); + Usart_ReadyToTransmit_ExpectAndReturn(FALSE); + Usart_ReadyToTransmit_ExpectAndReturn(FALSE); + Usart_ReadyToTransmit_ExpectAndReturn(TRUE); + Usart_PutChar('x'); + TEST_ASSERT_EQUAL('x', AT91C_BASE_US0->US_THR); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestUsartTransmitBufferStatus.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestUsartTransmitBufferStatus.c new file mode 100644 index 0000000..c06084f --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/examples/test/TestUsartTransmitBufferStatus.c @@ -0,0 +1,22 @@ +#include "unity.h" +#include "Types.h" +#include "UsartTransmitBufferStatus.h" + +AT91S_USART Usart0Peripheral; + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void testReadyToTransmitShouldReturnStatusPerTransmitBufferReadyStatus(void) +{ + AT91C_BASE_US0->US_CSR = 0; + TEST_ASSERT(!Usart_ReadyToTransmit()); + + AT91C_BASE_US0->US_CSR = AT91C_US_TXRDY; + TEST_ASSERT(Usart_ReadyToTransmit()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/SAM7_FLASH.mac b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/SAM7_FLASH.mac new file mode 100644 index 0000000..407acb2 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/SAM7_FLASH.mac @@ -0,0 +1,71 @@ +// ---------------------------------------------------------------------------- +// ATMEL Microcontroller Software Support - ROUSSET - +// ---------------------------------------------------------------------------- +// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// ---------------------------------------------------------------------------- +// File Name : SAM7_FLASH.mac +// Object : Generic Macro File for IAR +// 1.0 17/Aug/05 FBr : Creation +// ---------------------------------------------------------------------------- + +/********************************************************************* +* +* _InitRSTC() +* +* Function description +* Initializes the RSTC (Reset controller). +* This makes sense since the default is to not allow user resets, which makes it impossible to +* apply a second RESET via J-Link +*/ +_InitRSTC() { + __writeMemory32(0xA5000001, 0xFFFFFD08,"Memory"); // Allow user reset +} + +/********************************************************************* +* +* _InitPLL() +* Function description +* Initializes the PMC. +* 1. Enable the Main Oscillator +* 2. Configure PLL to 96MHz +* 3. Switch Master Clock (MCK) on PLL/2 = 48MHz +*/ + _InitPLL() { + + __message "Enable Main Oscillator"; + __writeMemory32(0x00000601,0xFFFFFc20,"Memory"); // MOSC + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x1) ); + + __message "Set PLL to 96MHz"; + __writeMemory32(0x10191c05,0xFFFFFc2c,"Memory"); // LOCK + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x4) ); + + __message "Set Master Clock to 48MHz"; + __writeMemory32(0x00000004,0xFFFFFc30,"Memory"); // MCKRDY + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x8) ); + __writeMemory32(0x00000007,0xFFFFFc30,"Memory"); // MCKRDY + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x8) ); +} + +/********************************************************************* +* +* execUserReset() : JTAG set initially to Full Speed +*/ +execUserReset() { + __message "execUserReset()"; + __emulatorSpeed(30000); // Set JTAG speed to 30kHz to make a hardware reset + __hwReset(0); // Hardware Reset: CPU is automatically halted after the reset (JTAG is already configured to 32kHz) + _InitPLL(); // Allow to debug at JTAG Full Speed + _InitRSTC(); // Enable User Reset to allow execUserReset() execution + __emulatorSpeed(0); // Set JTAG speed to full speed +} + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/SAM7_RAM.mac b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/SAM7_RAM.mac new file mode 100644 index 0000000..a2b8a01 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/SAM7_RAM.mac @@ -0,0 +1,94 @@ +// ---------------------------------------------------------------------------- +// ATMEL Microcontroller Software Support - ROUSSET - +// ---------------------------------------------------------------------------- +// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// ---------------------------------------------------------------------------- +// File Name : SAM7_RAM.mac +// Object : Generic Macro File for IAR +// 1.0 17/Aug/05 FBr : Creation +// ---------------------------------------------------------------------------- + +/********************************************************************* +* +* _MapRAMAt0() +* +* Function description +* Maps RAM at 0. +*/ +_MapRAMAt0(){ + __message "Changing mapping: RAM mapped to 0"; + __writeMemory32(0x00000001,0xFFFFFF00,"Memory"); +} + +/********************************************************************* +* +* _InitRSTC() +* +* Function description +* Initializes the RSTC (Reset controller). +* This makes sense since the default is to not allow user resets, which makes it impossible to +* apply a second RESET via J-Link +*/ +_InitRSTC() { + __writeMemory32(0xA5000001, 0xFFFFFD08,"Memory"); // Allow user reset +} + +/********************************************************************* +* +* _InitPLL() +* Function description +* Initializes the PMC. +* 1. Enable the Main Oscillator +* 2. Configure PLL to 96MHz +* 3. Switch Master Clock (MCK) on PLL/2 = 48MHz +*/ + _InitPLL() { + + __message "Set Main Oscillator"; + __writeMemory32(0x00004001,0xFFFFFc20,"Memory"); // MOSC + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x1) ); + + __message "Set PLL to 96MHz"; + __writeMemory32(0x10483f0e,0xFFFFFc2c,"Memory"); // LOCK + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x4) ); + + __message "Set Master Clock to 48MHz"; + __writeMemory32(0x00000004,0xFFFFFc30,"Memory"); // MCKRDY + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x8) ); + __writeMemory32(0x00000007,0xFFFFFc30,"Memory"); // MCKRDY + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x8) ); +} + +/********************************************************************* +* +* execUserReset() : JTAG set initially to Full Speed +*/ +execUserReset() { + __message "execUserReset()"; + __emulatorSpeed(30000); // Set JTAG speed to 30kHz to make a hardware reset + __hwReset(0); // Hardware Reset: CPU is automatically halted after the reset + _InitPLL(); // Allow to debug at JTAG Full Speed + _MapRAMAt0(); // Remap RAM to address 0 + __emulatorSpeed(0); // Set JTAG speed to full speed +} + +/********************************************************************* +* +* execUserPreload() : JTAG set initially to 32kHz +*/ +execUserPreload() { + __message "execUserPreload()"; + __hwReset(0); // Hardware Reset: CPU is automatically halted after the reset (JTAG is already configured to 32kHz) + _InitPLL(); // Allow to load Code at JTAG Full Speed + _MapRAMAt0(); // Remap RAM to address 0 + _InitRSTC(); // Enable User Reset to allow execUserReset() execution +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/SAM7_SIM.mac b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/SAM7_SIM.mac new file mode 100644 index 0000000..418a2c3 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/SAM7_SIM.mac @@ -0,0 +1,67 @@ +//========================================================= +// Simulation setup file for esc07_demo project +//========================================================= + +__var _timer0_interrupt_ID; + +irqBreak() +{ + __var __AIC_SMR; + __var __AIC_IECR; + __var __AIC_IVR; + + // read AIC_IECR instead, since not fully supported by simulator + __AIC_IECR = __readMemory32(0xFFFFF120, "Memory"); + if(__AIC_IECR & 0x1000) + { + __AIC_SMR = __readMemory32(0xFFFFF060, "Memory"); + __AIC_IVR = __readMemory32(0xFFFFF0B0, "Memory"); //AIC_IVR = AIC_SVR[x] + __writeMemory32(__AIC_IVR, 0xFFFFF100, "Memory"); //AIC_IVR + __writeMemory32(0x1000, 0xFFFFF10C, "Memory"); //AIC_IPR + __writeMemory32(0x2, 0xFFFFF114, "Memory"); //AIC_CISR + } + + return 0; +} + +setupProcessorRegisters() +{ + // Write TC0_SR.CPCS with correct status for ISR (Clock enabled; RC Compare Flag = TRUE) + __writeMemory32(0x00010010, 0xfffa0020, "Memory"); + + // Set TX ready flag in USART0 status register + // USART0_BASE->US_CSR = AT91C_US_TXRDY + __writeMemory32(0x00000002, 0xfffc0014, "Memory"); +} + +configureTimer0Interrupt() +{ + __var _master_clock_frequency; + __var _timer0_period_cycles; + + // Calculate timer0 frequency in master clock cycles + _master_clock_frequency = 48054857; + _timer0_period_cycles = _master_clock_frequency / 100; + if((_master_clock_frequency % 100) >= 50) + { + _timer0_period_cycles++; + } + + __cancelAllInterrupts(); + __enableInterrupts(); + + _timer0_interrupt_ID = __orderInterrupt("IRQ", _timer0_period_cycles, _timer0_period_cycles, 0, 0, 0, 100); + + if(-1 == _timer0_interrupt_ID) + { + __message "ERROR: failed to order timer 0 interrupt"; + } + + __setCodeBreak("0x18", 0, "irqBreak()", "TRUE", ""); +} + +execUserReset() +{ + setupProcessorRegisters(); + configureTimer0Interrupt(); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/at91SAM7X256_FLASH.xcl b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/at91SAM7X256_FLASH.xcl new file mode 100644 index 0000000..02eaec7 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/at91SAM7X256_FLASH.xcl @@ -0,0 +1,185 @@ +// ---------------------------------------------------------------------------- +// ATMEL Microcontroller Software Support - ROUSSET - +// ---------------------------------------------------------------------------- +// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// ---------------------------------------------------------------------------- +// File Name : at91SAM7X256_FLASH.xcl +// Object : Generic Linker Command File for IAR +// 1.0 30/Aug/05 FBr : Creation for 4.30A +// ---------------------------------------------------------------------------- + +//************************************************************************* +// XLINK command file template for EWARM/ICCARM +// +// Usage: xlink -f lnkarm +// -s +//************************************************************************* +// +// ------------- +// Code segments - may be placed anywhere in memory. +// ------------- +// +// INTVEC -- Exception vector table. +// SWITAB -- Software interrupt vector table. +// ICODE -- Startup (cstartup) and exception code. +// DIFUNCT -- Dynamic initialization vectors used by C++. +// CODE -- Compiler generated code. +// CODE_I -- Compiler generated code declared __ramfunc (executes in RAM) +// CODE_ID -- Initializer for CODE_I (ROM). +// +// ------------- +// Data segments - may be placed anywhere in memory. +// ------------- +// +// CSTACK -- The stack used by C/C++ programs (system and user mode). +// IRQ_STACK -- The stack used by IRQ service routines. +// SVC_STACK -- The stack used in supervisor mode +// (Define other exception stacks as needed for +// FIQ, ABT, UND). +// HEAP -- The heap used by malloc and free in C and new and +// delete in C++. +// INITTAB -- Table containing addresses and sizes of segments that +// need to be initialized at startup (by cstartup). +// CHECKSUM -- The linker places checksum byte(s) in this segment, +// when the -J linker command line option is used. +// DATA_y -- Data objects. +// +// Where _y can be one of: +// +// _AN -- Holds uninitialized located objects, i.e. objects with +// an absolute location given by the @ operator or the +// #pragma location directive. Since these segments +// contain objects which already have a fixed address, +// they should not be mentioned in this linker command +// file. +// _C -- Constants (ROM). +// _I -- Initialized data (RAM). +// _ID -- The original content of _I (copied to _I by cstartup) (ROM). +// _N -- Uninitialized data (RAM). +// _Z -- Zero initialized data (RAM). +// +// Note: Be sure to use end values for the defined address ranges. +// Otherwise, the linker may allocate space outside the +// intended memory range. +//************************************************************************* + +//************************************************************************* +// Inform the linker about the CPU family used. +// AT91SAM7X256 Memory mapping +// No remap +// ROMSTART +// Start address 0x0000 0000 +// Size 256 Kbo 0x0004 0000 +// RAMSTART +// Start address 0x0020 0000 +// Size 64 Kbo 0x0001 0000 +// Remap done +// RAMSTART +// Start address 0x0000 0000 +// Size 64 Kbo 0x0001 0000 +// ROMSTART +// Start address 0x0010 0000 +// Size 256 Kbo 0x0004 0000 + +//************************************************************************* +-carm + +//************************************************************************* +// Internal Ram segments mapped AFTER REMAP 64 K. +//************************************************************************* +-Z(CONST)INTRAMSTART_REMAP=00200000 +-Z(CONST)INTRAMEND_REMAP=0020FFFF + +//************************************************************************* +// Read-only segments mapped to Flash 256 K. +//************************************************************************* +-DROMSTART=00000000 +-DROMEND=0003FFFF +//************************************************************************* +// Read/write segments mapped to 64 K RAM. +//************************************************************************* +-DRAMSTART=00200000 +-DRAMEND=0020FFFF + +//************************************************************************* +// Address range for reset and exception +// vectors (INTVEC). +// The vector area is 32 bytes, +// an additional 32 bytes is allocated for the +// constant table used by ldr PC in cstartup.s79. +//************************************************************************* +-Z(CODE)INTVEC=00-3F + +//************************************************************************* +// Startup code and exception routines (ICODE). +//************************************************************************* +-Z(CODE)ICODE,DIFUNCT=ROMSTART-ROMEND +-Z(CODE)SWITAB=ROMSTART-ROMEND + +//************************************************************************* +// Code segments may be placed anywhere. +//************************************************************************* +-Z(CODE)CODE=ROMSTART-ROMEND + +//************************************************************************* +// Various constants and initializers. +//************************************************************************* +-Z(CONST)INITTAB,DATA_ID,DATA_C=ROMSTART-ROMEND +-Z(CONST)CHECKSUM=ROMSTART-ROMEND + +//************************************************************************* +// Data segments. +//************************************************************************* +-Z(DATA)DATA_I,DATA_Z,DATA_N=RAMSTART-RAMEND + +//************************************************************************* +// __ramfunc code copied to and executed from RAM. +//************************************************************************* +-Z(DATA)CODE_I=RAMSTART-RAMEND +-Z(CONST)CODE_ID=ROMSTART-ROMEND // Initializer for +-QCODE_I=CODE_ID + +//************************************************************************* +// ICCARM produces code for __ramfunc functions in +// CODE_I segments. The -Q XLINK command line +// option redirects XLINK to emit the code in the +// debug information associated with the CODE_I +// segment, where the code will execute. +//************************************************************************* + +//************************************************************************* +// Stack and heap segments. +//************************************************************************* +-D_CSTACK_SIZE=(100*4) +-D_IRQ_STACK_SIZE=(3*8*4) +-D_HEAP_SIZE=(1024*1) + +-Z(DATA)CSTACK+_CSTACK_SIZE=RAMSTART-RAMEND +-Z(DATA)IRQ_STACK+_IRQ_STACK_SIZE=RAMSTART-RAMEND +-Z(DATA)HEAP+_HEAP_SIZE=RAMSTART-RAMEND + +//************************************************************************* +// ELF/DWARF support. +// +// Uncomment the line "-Felf" below to generate ELF/DWARF output. +// Available format specifiers are: +// +// "-yn": Suppress DWARF debug output +// "-yp": Multiple ELF program sections +// "-yas": Format suitable for debuggers from ARM Ltd (also sets -p flag) +// +// "-Felf" and the format specifiers can also be supplied directly as +// command line options, or selected from the Xlink Output tab in the +// IAR Embedded Workbench. +//************************************************************************* + +// -Felf diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/at91SAM7X256_RAM.xcl b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/at91SAM7X256_RAM.xcl new file mode 100644 index 0000000..adcec10 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/at91SAM7X256_RAM.xcl @@ -0,0 +1,185 @@ +// ---------------------------------------------------------------------------- +// ATMEL Microcontroller Software Support - ROUSSET - +// ---------------------------------------------------------------------------- +// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// ---------------------------------------------------------------------------- +// File Name : at91SAM7X256_RAM.xcl +// Object : Generic Linker Command File for IAR +// 1.0 30/Aug/05 FBr : Creation for 4.30A +// ---------------------------------------------------------------------------- + +//************************************************************************* +// XLINK command file template for EWARM/ICCARM +// +// Usage: xlink -f lnkarm +// -s +//************************************************************************* +// +// ------------- +// Code segments - may be placed anywhere in memory. +// ------------- +// +// INTVEC -- Exception vector table. +// SWITAB -- Software interrupt vector table. +// ICODE -- Startup (cstartup) and exception code. +// DIFUNCT -- Dynamic initialization vectors used by C++. +// CODE -- Compiler generated code. +// CODE_I -- Compiler generated code declared __ramfunc (executes in RAM) +// CODE_ID -- Initializer for CODE_I (ROM). +// +// ------------- +// Data segments - may be placed anywhere in memory. +// ------------- +// +// CSTACK -- The stack used by C/C++ programs (system and user mode). +// IRQ_STACK -- The stack used by IRQ service routines. +// SVC_STACK -- The stack used in supervisor mode +// (Define other exception stacks as needed for +// FIQ, ABT, UND). +// HEAP -- The heap used by malloc and free in C and new and +// delete in C++. +// INITTAB -- Table containing addresses and sizes of segments that +// need to be initialized at startup (by cstartup). +// CHECKSUM -- The linker places checksum byte(s) in this segment, +// when the -J linker command line option is used. +// DATA_y -- Data objects. +// +// Where _y can be one of: +// +// _AN -- Holds uninitialized located objects, i.e. objects with +// an absolute location given by the @ operator or the +// #pragma location directive. Since these segments +// contain objects which already have a fixed address, +// they should not be mentioned in this linker command +// file. +// _C -- Constants (ROM). +// _I -- Initialized data (RAM). +// _ID -- The original content of _I (copied to _I by cstartup) (ROM). +// _N -- Uninitialized data (RAM). +// _Z -- Zero initialized data (RAM). +// +// Note: Be sure to use end values for the defined address ranges. +// Otherwise, the linker may allocate space outside the +// intended memory range. +//************************************************************************* + +//************************************************************************* +// Inform the linker about the CPU family used. +// AT91SAM7X256 Memory mapping +// No remap +// ROMSTART +// Start address 0x0000 0000 +// Size 256 Kbo 0x0004 0000 +// RAMSTART +// Start address 0x0020 0000 +// Size 64 Kbo 0x0001 0000 +// Remap done +// RAMSTART +// Start address 0x0000 0000 +// Size 64 Kbo 0x0001 0000 +// ROMSTART +// Start address 0x0010 0000 +// Size 256 Kbo 0x0004 0000 + +//************************************************************************* +-carm + +//************************************************************************* +// Internal Ram segments mapped AFTER REMAP 64 K. +//************************************************************************* +-Z(CONST)INTRAMSTART_REMAP=00000000 +-Z(CONST)INTRAMEND_REMAP=0000FFFF + +//************************************************************************* +// Read-only segments mapped to Flash 256 K. +//************************************************************************* +-DROMSTART=00000000 +-DROMEND=0003FFFF +//************************************************************************* +// Read/write segments mapped to 64 K RAM. +//************************************************************************* +-DRAMSTART=00000000 +-DRAMEND=0000FFFF + +//************************************************************************* +// Address range for reset and exception +// vectors (INTVEC). +// The vector area is 32 bytes, +// an additional 32 bytes is allocated for the +// constant table used by ldr PC in cstartup.s79. +//************************************************************************* +-Z(CODE)INTVEC=00-3F + +//************************************************************************* +// Startup code and exception routines (ICODE). +//************************************************************************* +-Z(CODE)ICODE,DIFUNCT=ROMSTART-ROMEND +-Z(CODE)SWITAB=ROMSTART-ROMEND + +//************************************************************************* +// Code segments may be placed anywhere. +//************************************************************************* +-Z(CODE)CODE=ROMSTART-ROMEND + +//************************************************************************* +// Various constants and initializers. +//************************************************************************* +-Z(CONST)INITTAB,DATA_ID,DATA_C=ROMSTART-ROMEND +-Z(CONST)CHECKSUM=ROMSTART-ROMEND + +//************************************************************************* +// Data segments. +//************************************************************************* +-Z(DATA)DATA_I,DATA_Z,DATA_N=RAMSTART-RAMEND + +//************************************************************************* +// __ramfunc code copied to and executed from RAM. +//************************************************************************* +-Z(DATA)CODE_I=RAMSTART-RAMEND +-Z(CONST)CODE_ID=ROMSTART-ROMEND // Initializer for +-QCODE_I=CODE_ID + +//************************************************************************* +// ICCARM produces code for __ramfunc functions in +// CODE_I segments. The -Q XLINK command line +// option redirects XLINK to emit the code in the +// debug information associated with the CODE_I +// segment, where the code will execute. +//************************************************************************* + +//************************************************************************* +// Stack and heap segments. +//************************************************************************* +-D_CSTACK_SIZE=(100*4) +-D_IRQ_STACK_SIZE=(3*8*4) +-D_HEAP_SIZE=(1024*2) + +-Z(DATA)CSTACK+_CSTACK_SIZE=RAMSTART-RAMEND +-Z(DATA)IRQ_STACK+_IRQ_STACK_SIZE=RAMSTART-RAMEND +-Z(DATA)HEAP+_HEAP_SIZE=RAMSTART-RAMEND + +//************************************************************************* +// ELF/DWARF support. +// +// Uncomment the line "-Felf" below to generate ELF/DWARF output. +// Available format specifiers are: +// +// "-yn": Suppress DWARF debug output +// "-yp": Multiple ELF program sections +// "-yas": Format suitable for debuggers from ARM Ltd (also sets -p flag) +// +// "-Felf" and the format specifiers can also be supplied directly as +// command line options, or selected from the Xlink Output tab in the +// IAR Embedded Workbench. +//************************************************************************* + +// -Felf diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/ioat91sam7x256.ddf b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/ioat91sam7x256.ddf new file mode 100644 index 0000000..c9fcf32 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/ioat91sam7x256.ddf @@ -0,0 +1,2259 @@ +; ---------------------------------------------------------------------------- +; ATMEL Microcontroller Software Support - ROUSSET - +; ---------------------------------------------------------------------------- +; DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +; DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +; INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +; OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +; LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +; EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +; ---------------------------------------------------------------------------- +; File Name : AT91SAM7X256.ddf +; Object : AT91SAM7X256 definitions +; Generated : AT91 SW Application Group 11/02/2005 (15:17:30) +; +; CVS Reference : /AT91SAM7X256.pl/1.14/Tue Sep 13 15:06:52 2005// +; CVS Reference : /SYS_SAM7X.pl/1.3/Tue Feb 1 17:01:43 2005// +; CVS Reference : /MC_SAM7X.pl/1.2/Fri May 20 14:13:04 2005// +; CVS Reference : /PMC_SAM7X.pl/1.4/Tue Feb 8 13:58:10 2005// +; CVS Reference : /RSTC_SAM7X.pl/1.2/Wed Jul 13 14:57:50 2005// +; CVS Reference : /UDP_SAM7X.pl/1.1/Tue May 10 11:35:35 2005// +; CVS Reference : /PWM_SAM7X.pl/1.1/Tue May 10 11:53:07 2005// +; CVS Reference : /AIC_6075B.pl/1.3/Fri May 20 14:01:30 2005// +; CVS Reference : /PIO_6057A.pl/1.2/Thu Feb 3 10:18:28 2005// +; CVS Reference : /RTTC_6081A.pl/1.2/Tue Nov 9 14:43:58 2004// +; CVS Reference : /PITC_6079A.pl/1.2/Tue Nov 9 14:43:56 2004// +; CVS Reference : /WDTC_6080A.pl/1.3/Tue Nov 9 14:44:00 2004// +; CVS Reference : /VREG_6085B.pl/1.1/Tue Feb 1 16:05:48 2005// +; CVS Reference : /PDC_6074C.pl/1.2/Thu Feb 3 08:48:54 2005// +; CVS Reference : /DBGU_6059D.pl/1.1/Mon Jan 31 13:15:32 2005// +; CVS Reference : /SPI_6088D.pl/1.3/Fri May 20 14:08:59 2005// +; CVS Reference : /US_6089C.pl/1.1/Mon Jul 12 18:23:26 2004// +; CVS Reference : /SSC_6078B.pl/1.1/Wed Jul 13 15:19:19 2005// +; CVS Reference : /TWI_6061A.pl/1.1/Tue Jul 13 07:38:06 2004// +; CVS Reference : /TC_6082A.pl/1.7/Fri Mar 11 12:52:17 2005// +; CVS Reference : /CAN_6019B.pl/1.1/Tue Mar 8 12:42:22 2005// +; CVS Reference : /EMACB_6119A.pl/1.6/Wed Jul 13 15:05:35 2005// +; CVS Reference : /ADC_6051C.pl/1.1/Fri Oct 17 09:12:38 2003// +; ---------------------------------------------------------------------------- + +[Sfr] + +; ========== Register definition for SYS peripheral ========== +; ========== Register definition for AIC peripheral ========== +sfr = "AIC_SMR", "Memory", 0xfffff000, 4, base=16 +sfr = "AIC_SMR.PRIOR", "Memory", 0xfffff000, 4, base=16, bitRange=0-2 +sfr = "AIC_SMR.SRCTYPE", "Memory", 0xfffff000, 4, base=16, bitRange=5-6 +sfr = "AIC_SVR", "Memory", 0xfffff080, 4, base=16 +sfr = "AIC_IVR", "Memory", 0xfffff100, 4, base=16 +sfr = "AIC_FVR", "Memory", 0xfffff104, 4, base=16 +sfr = "AIC_ISR", "Memory", 0xfffff108, 4, base=16 +sfr = "AIC_IPR", "Memory", 0xfffff10c, 4, base=16 +sfr = "AIC_IMR", "Memory", 0xfffff110, 4, base=16 +sfr = "AIC_CISR", "Memory", 0xfffff114, 4, base=16 +sfr = "AIC_CISR.NFIQ", "Memory", 0xfffff114, 4, base=16, bitRange=0 +sfr = "AIC_CISR.NIRQ", "Memory", 0xfffff114, 4, base=16, bitRange=1 +sfr = "AIC_IECR", "Memory", 0xfffff120, 4, base=16 +sfr = "AIC_IDCR", "Memory", 0xfffff124, 4, base=16 +sfr = "AIC_ICCR", "Memory", 0xfffff128, 4, base=16 +sfr = "AIC_ISCR", "Memory", 0xfffff12c, 4, base=16 +sfr = "AIC_EOICR", "Memory", 0xfffff130, 4, base=16 +sfr = "AIC_SPU", "Memory", 0xfffff134, 4, base=16 +sfr = "AIC_DCR", "Memory", 0xfffff138, 4, base=16 +sfr = "AIC_DCR.PROT", "Memory", 0xfffff138, 4, base=16, bitRange=0 +sfr = "AIC_DCR.GMSK", "Memory", 0xfffff138, 4, base=16, bitRange=1 +sfr = "AIC_FFER", "Memory", 0xfffff140, 4, base=16 +sfr = "AIC_FFDR", "Memory", 0xfffff144, 4, base=16 +sfr = "AIC_FFSR", "Memory", 0xfffff148, 4, base=16 +; ========== Register definition for PDC_DBGU peripheral ========== +sfr = "DBGU_RPR", "Memory", 0xfffff300, 4, base=16 +sfr = "DBGU_RCR", "Memory", 0xfffff304, 4, base=16 +sfr = "DBGU_TPR", "Memory", 0xfffff308, 4, base=16 +sfr = "DBGU_TCR", "Memory", 0xfffff30c, 4, base=16 +sfr = "DBGU_RNPR", "Memory", 0xfffff310, 4, base=16 +sfr = "DBGU_RNCR", "Memory", 0xfffff314, 4, base=16 +sfr = "DBGU_TNPR", "Memory", 0xfffff318, 4, base=16 +sfr = "DBGU_TNCR", "Memory", 0xfffff31c, 4, base=16 +sfr = "DBGU_PTCR", "Memory", 0xfffff320, 4, base=16 +sfr = "DBGU_PTCR.RXTEN", "Memory", 0xfffff320, 4, base=16, bitRange=0 +sfr = "DBGU_PTCR.RXTDIS", "Memory", 0xfffff320, 4, base=16, bitRange=1 +sfr = "DBGU_PTCR.TXTEN", "Memory", 0xfffff320, 4, base=16, bitRange=8 +sfr = "DBGU_PTCR.TXTDIS", "Memory", 0xfffff320, 4, base=16, bitRange=9 +sfr = "DBGU_PTSR", "Memory", 0xfffff324, 4, base=16 +sfr = "DBGU_PTSR.RXTEN", "Memory", 0xfffff324, 4, base=16, bitRange=0 +sfr = "DBGU_PTSR.TXTEN", "Memory", 0xfffff324, 4, base=16, bitRange=8 +; ========== Register definition for DBGU peripheral ========== +sfr = "DBGU_CR", "Memory", 0xfffff200, 4, base=16 +sfr = "DBGU_CR.RSTRX", "Memory", 0xfffff200, 4, base=16, bitRange=2 +sfr = "DBGU_CR.RSTTX", "Memory", 0xfffff200, 4, base=16, bitRange=3 +sfr = "DBGU_CR.RXEN", "Memory", 0xfffff200, 4, base=16, bitRange=4 +sfr = "DBGU_CR.RXDIS", "Memory", 0xfffff200, 4, base=16, bitRange=5 +sfr = "DBGU_CR.TXEN", "Memory", 0xfffff200, 4, base=16, bitRange=6 +sfr = "DBGU_CR.TXDIS", "Memory", 0xfffff200, 4, base=16, bitRange=7 +sfr = "DBGU_CR.RSTSTA", "Memory", 0xfffff200, 4, base=16, bitRange=8 +sfr = "DBGU_MR", "Memory", 0xfffff204, 4, base=16 +sfr = "DBGU_MR.PAR", "Memory", 0xfffff204, 4, base=16, bitRange=9-11 +sfr = "DBGU_MR.CHMODE", "Memory", 0xfffff204, 4, base=16, bitRange=14-15 +sfr = "DBGU_IER", "Memory", 0xfffff208, 4, base=16 +sfr = "DBGU_IER.RXRDY", "Memory", 0xfffff208, 4, base=16, bitRange=0 +sfr = "DBGU_IER.TXRDY", "Memory", 0xfffff208, 4, base=16, bitRange=1 +sfr = "DBGU_IER.ENDRX", "Memory", 0xfffff208, 4, base=16, bitRange=3 +sfr = "DBGU_IER.ENDTX", "Memory", 0xfffff208, 4, base=16, bitRange=4 +sfr = "DBGU_IER.OVRE", "Memory", 0xfffff208, 4, base=16, bitRange=5 +sfr = "DBGU_IER.FRAME", "Memory", 0xfffff208, 4, base=16, bitRange=6 +sfr = "DBGU_IER.PARE", "Memory", 0xfffff208, 4, base=16, bitRange=7 +sfr = "DBGU_IER.TXEMPTY", "Memory", 0xfffff208, 4, base=16, bitRange=9 +sfr = "DBGU_IER.TXBUFE", "Memory", 0xfffff208, 4, base=16, bitRange=11 +sfr = "DBGU_IER.RXBUFF", "Memory", 0xfffff208, 4, base=16, bitRange=12 +sfr = "DBGU_IER.TX", "Memory", 0xfffff208, 4, base=16, bitRange=30 +sfr = "DBGU_IER.RX", "Memory", 0xfffff208, 4, base=16, bitRange=31 +sfr = "DBGU_IDR", "Memory", 0xfffff20c, 4, base=16 +sfr = "DBGU_IDR.RXRDY", "Memory", 0xfffff20c, 4, base=16, bitRange=0 +sfr = "DBGU_IDR.TXRDY", "Memory", 0xfffff20c, 4, base=16, bitRange=1 +sfr = "DBGU_IDR.ENDRX", "Memory", 0xfffff20c, 4, base=16, bitRange=3 +sfr = "DBGU_IDR.ENDTX", "Memory", 0xfffff20c, 4, base=16, bitRange=4 +sfr = "DBGU_IDR.OVRE", "Memory", 0xfffff20c, 4, base=16, bitRange=5 +sfr = "DBGU_IDR.FRAME", "Memory", 0xfffff20c, 4, base=16, bitRange=6 +sfr = "DBGU_IDR.PARE", "Memory", 0xfffff20c, 4, base=16, bitRange=7 +sfr = "DBGU_IDR.TXEMPTY", "Memory", 0xfffff20c, 4, base=16, bitRange=9 +sfr = "DBGU_IDR.TXBUFE", "Memory", 0xfffff20c, 4, base=16, bitRange=11 +sfr = "DBGU_IDR.RXBUFF", "Memory", 0xfffff20c, 4, base=16, bitRange=12 +sfr = "DBGU_IDR.TX", "Memory", 0xfffff20c, 4, base=16, bitRange=30 +sfr = "DBGU_IDR.RX", "Memory", 0xfffff20c, 4, base=16, bitRange=31 +sfr = "DBGU_IMR", "Memory", 0xfffff210, 4, base=16 +sfr = "DBGU_IMR.RXRDY", "Memory", 0xfffff210, 4, base=16, bitRange=0 +sfr = "DBGU_IMR.TXRDY", "Memory", 0xfffff210, 4, base=16, bitRange=1 +sfr = "DBGU_IMR.ENDRX", "Memory", 0xfffff210, 4, base=16, bitRange=3 +sfr = "DBGU_IMR.ENDTX", "Memory", 0xfffff210, 4, base=16, bitRange=4 +sfr = "DBGU_IMR.OVRE", "Memory", 0xfffff210, 4, base=16, bitRange=5 +sfr = "DBGU_IMR.FRAME", "Memory", 0xfffff210, 4, base=16, bitRange=6 +sfr = "DBGU_IMR.PARE", "Memory", 0xfffff210, 4, base=16, bitRange=7 +sfr = "DBGU_IMR.TXEMPTY", "Memory", 0xfffff210, 4, base=16, bitRange=9 +sfr = "DBGU_IMR.TXBUFE", "Memory", 0xfffff210, 4, base=16, bitRange=11 +sfr = "DBGU_IMR.RXBUFF", "Memory", 0xfffff210, 4, base=16, bitRange=12 +sfr = "DBGU_IMR.TX", "Memory", 0xfffff210, 4, base=16, bitRange=30 +sfr = "DBGU_IMR.RX", "Memory", 0xfffff210, 4, base=16, bitRange=31 +sfr = "DBGU_CSR", "Memory", 0xfffff214, 4, base=16 +sfr = "DBGU_CSR.RXRDY", "Memory", 0xfffff214, 4, base=16, bitRange=0 +sfr = "DBGU_CSR.TXRDY", "Memory", 0xfffff214, 4, base=16, bitRange=1 +sfr = "DBGU_CSR.ENDRX", "Memory", 0xfffff214, 4, base=16, bitRange=3 +sfr = "DBGU_CSR.ENDTX", "Memory", 0xfffff214, 4, base=16, bitRange=4 +sfr = "DBGU_CSR.OVRE", "Memory", 0xfffff214, 4, base=16, bitRange=5 +sfr = "DBGU_CSR.FRAME", "Memory", 0xfffff214, 4, base=16, bitRange=6 +sfr = "DBGU_CSR.PARE", "Memory", 0xfffff214, 4, base=16, bitRange=7 +sfr = "DBGU_CSR.TXEMPTY", "Memory", 0xfffff214, 4, base=16, bitRange=9 +sfr = "DBGU_CSR.TXBUFE", "Memory", 0xfffff214, 4, base=16, bitRange=11 +sfr = "DBGU_CSR.RXBUFF", "Memory", 0xfffff214, 4, base=16, bitRange=12 +sfr = "DBGU_CSR.TX", "Memory", 0xfffff214, 4, base=16, bitRange=30 +sfr = "DBGU_CSR.RX", "Memory", 0xfffff214, 4, base=16, bitRange=31 +sfr = "DBGU_RHR", "Memory", 0xfffff218, 4, base=16 +sfr = "DBGU_THR", "Memory", 0xfffff21c, 4, base=16 +sfr = "DBGU_BRGR", "Memory", 0xfffff220, 4, base=16 +sfr = "DBGU_CIDR", "Memory", 0xfffff240, 4, base=16 +sfr = "DBGU_EXID", "Memory", 0xfffff244, 4, base=16 +sfr = "DBGU_FNTR", "Memory", 0xfffff248, 4, base=16 +sfr = "DBGU_FNTR.NTRST", "Memory", 0xfffff248, 4, base=16, bitRange=0 +; ========== Register definition for PIOA peripheral ========== +sfr = "PIOA_PER", "Memory", 0xfffff400, 4, base=16 +sfr = "PIOA_PDR", "Memory", 0xfffff404, 4, base=16 +sfr = "PIOA_PSR", "Memory", 0xfffff408, 4, base=16 +sfr = "PIOA_OER", "Memory", 0xfffff410, 4, base=16 +sfr = "PIOA_ODR", "Memory", 0xfffff414, 4, base=16 +sfr = "PIOA_OSR", "Memory", 0xfffff418, 4, base=16 +sfr = "PIOA_IFER", "Memory", 0xfffff420, 4, base=16 +sfr = "PIOA_IFDR", "Memory", 0xfffff424, 4, base=16 +sfr = "PIOA_IFSR", "Memory", 0xfffff428, 4, base=16 +sfr = "PIOA_SODR", "Memory", 0xfffff430, 4, base=16 +sfr = "PIOA_CODR", "Memory", 0xfffff434, 4, base=16 +sfr = "PIOA_ODSR", "Memory", 0xfffff438, 4, base=16 +sfr = "PIOA_PDSR", "Memory", 0xfffff43c, 4, base=16 +sfr = "PIOA_IER", "Memory", 0xfffff440, 4, base=16 +sfr = "PIOA_IDR", "Memory", 0xfffff444, 4, base=16 +sfr = "PIOA_IMR", "Memory", 0xfffff448, 4, base=16 +sfr = "PIOA_ISR", "Memory", 0xfffff44c, 4, base=16 +sfr = "PIOA_MDER", "Memory", 0xfffff450, 4, base=16 +sfr = "PIOA_MDDR", "Memory", 0xfffff454, 4, base=16 +sfr = "PIOA_MDSR", "Memory", 0xfffff458, 4, base=16 +sfr = "PIOA_PPUDR", "Memory", 0xfffff460, 4, base=16 +sfr = "PIOA_PPUER", "Memory", 0xfffff464, 4, base=16 +sfr = "PIOA_PPUSR", "Memory", 0xfffff468, 4, base=16 +sfr = "PIOA_ASR", "Memory", 0xfffff470, 4, base=16 +sfr = "PIOA_BSR", "Memory", 0xfffff474, 4, base=16 +sfr = "PIOA_ABSR", "Memory", 0xfffff478, 4, base=16 +sfr = "PIOA_OWER", "Memory", 0xfffff4a0, 4, base=16 +sfr = "PIOA_OWDR", "Memory", 0xfffff4a4, 4, base=16 +sfr = "PIOA_OWSR", "Memory", 0xfffff4a8, 4, base=16 +; ========== Register definition for PIOB peripheral ========== +sfr = "PIOB_PER", "Memory", 0xfffff600, 4, base=16 +sfr = "PIOB_PDR", "Memory", 0xfffff604, 4, base=16 +sfr = "PIOB_PSR", "Memory", 0xfffff608, 4, base=16 +sfr = "PIOB_OER", "Memory", 0xfffff610, 4, base=16 +sfr = "PIOB_ODR", "Memory", 0xfffff614, 4, base=16 +sfr = "PIOB_OSR", "Memory", 0xfffff618, 4, base=16 +sfr = "PIOB_IFER", "Memory", 0xfffff620, 4, base=16 +sfr = "PIOB_IFDR", "Memory", 0xfffff624, 4, base=16 +sfr = "PIOB_IFSR", "Memory", 0xfffff628, 4, base=16 +sfr = "PIOB_SODR", "Memory", 0xfffff630, 4, base=16 +sfr = "PIOB_CODR", "Memory", 0xfffff634, 4, base=16 +sfr = "PIOB_ODSR", "Memory", 0xfffff638, 4, base=16 +sfr = "PIOB_PDSR", "Memory", 0xfffff63c, 4, base=16 +sfr = "PIOB_IER", "Memory", 0xfffff640, 4, base=16 +sfr = "PIOB_IDR", "Memory", 0xfffff644, 4, base=16 +sfr = "PIOB_IMR", "Memory", 0xfffff648, 4, base=16 +sfr = "PIOB_ISR", "Memory", 0xfffff64c, 4, base=16 +sfr = "PIOB_MDER", "Memory", 0xfffff650, 4, base=16 +sfr = "PIOB_MDDR", "Memory", 0xfffff654, 4, base=16 +sfr = "PIOB_MDSR", "Memory", 0xfffff658, 4, base=16 +sfr = "PIOB_PPUDR", "Memory", 0xfffff660, 4, base=16 +sfr = "PIOB_PPUER", "Memory", 0xfffff664, 4, base=16 +sfr = "PIOB_PPUSR", "Memory", 0xfffff668, 4, base=16 +sfr = "PIOB_ASR", "Memory", 0xfffff670, 4, base=16 +sfr = "PIOB_BSR", "Memory", 0xfffff674, 4, base=16 +sfr = "PIOB_ABSR", "Memory", 0xfffff678, 4, base=16 +sfr = "PIOB_OWER", "Memory", 0xfffff6a0, 4, base=16 +sfr = "PIOB_OWDR", "Memory", 0xfffff6a4, 4, base=16 +sfr = "PIOB_OWSR", "Memory", 0xfffff6a8, 4, base=16 +; ========== Register definition for CKGR peripheral ========== +sfr = "CKGR_MOR", "Memory", 0xfffffc20, 4, base=16 +sfr = "CKGR_MOR.MOSCEN", "Memory", 0xfffffc20, 4, base=16, bitRange=0 +sfr = "CKGR_MOR.OSCBYPASS", "Memory", 0xfffffc20, 4, base=16, bitRange=1 +sfr = "CKGR_MOR.OSCOUNT", "Memory", 0xfffffc20, 4, base=16, bitRange=8-15 +sfr = "CKGR_MCFR", "Memory", 0xfffffc24, 4, base=16 +sfr = "CKGR_MCFR.MAINF", "Memory", 0xfffffc24, 4, base=16, bitRange=0-15 +sfr = "CKGR_MCFR.MAINRDY", "Memory", 0xfffffc24, 4, base=16, bitRange=16 +sfr = "CKGR_PLLR", "Memory", 0xfffffc2c, 4, base=16 +sfr = "CKGR_PLLR.DIV", "Memory", 0xfffffc2c, 4, base=16, bitRange=0-7 +sfr = "CKGR_PLLR.PLLCOUNT", "Memory", 0xfffffc2c, 4, base=16, bitRange=8-13 +sfr = "CKGR_PLLR.OUT", "Memory", 0xfffffc2c, 4, base=16, bitRange=14-15 +sfr = "CKGR_PLLR.MUL", "Memory", 0xfffffc2c, 4, base=16, bitRange=16-26 +sfr = "CKGR_PLLR.USBDIV", "Memory", 0xfffffc2c, 4, base=16, bitRange=28-29 +; ========== Register definition for PMC peripheral ========== +sfr = "PMC_SCER", "Memory", 0xfffffc00, 4, base=16 +sfr = "PMC_SCER.PCK", "Memory", 0xfffffc00, 4, base=16, bitRange=0 +sfr = "PMC_SCER.UDP", "Memory", 0xfffffc00, 4, base=16, bitRange=7 +sfr = "PMC_SCER.PCK0", "Memory", 0xfffffc00, 4, base=16, bitRange=8 +sfr = "PMC_SCER.PCK1", "Memory", 0xfffffc00, 4, base=16, bitRange=9 +sfr = "PMC_SCER.PCK2", "Memory", 0xfffffc00, 4, base=16, bitRange=10 +sfr = "PMC_SCER.PCK3", "Memory", 0xfffffc00, 4, base=16, bitRange=11 +sfr = "PMC_SCDR", "Memory", 0xfffffc04, 4, base=16 +sfr = "PMC_SCDR.PCK", "Memory", 0xfffffc04, 4, base=16, bitRange=0 +sfr = "PMC_SCDR.UDP", "Memory", 0xfffffc04, 4, base=16, bitRange=7 +sfr = "PMC_SCDR.PCK0", "Memory", 0xfffffc04, 4, base=16, bitRange=8 +sfr = "PMC_SCDR.PCK1", "Memory", 0xfffffc04, 4, base=16, bitRange=9 +sfr = "PMC_SCDR.PCK2", "Memory", 0xfffffc04, 4, base=16, bitRange=10 +sfr = "PMC_SCDR.PCK3", "Memory", 0xfffffc04, 4, base=16, bitRange=11 +sfr = "PMC_SCSR", "Memory", 0xfffffc08, 4, base=16 +sfr = "PMC_SCSR.PCK", "Memory", 0xfffffc08, 4, base=16, bitRange=0 +sfr = "PMC_SCSR.UDP", "Memory", 0xfffffc08, 4, base=16, bitRange=7 +sfr = "PMC_SCSR.PCK0", "Memory", 0xfffffc08, 4, base=16, bitRange=8 +sfr = "PMC_SCSR.PCK1", "Memory", 0xfffffc08, 4, base=16, bitRange=9 +sfr = "PMC_SCSR.PCK2", "Memory", 0xfffffc08, 4, base=16, bitRange=10 +sfr = "PMC_SCSR.PCK3", "Memory", 0xfffffc08, 4, base=16, bitRange=11 +sfr = "PMC_PCER", "Memory", 0xfffffc10, 4, base=16 +sfr = "PMC_PCDR", "Memory", 0xfffffc14, 4, base=16 +sfr = "PMC_PCSR", "Memory", 0xfffffc18, 4, base=16 +sfr = "PMC_MOR", "Memory", 0xfffffc20, 4, base=16 +sfr = "PMC_MOR.MOSCEN", "Memory", 0xfffffc20, 4, base=16, bitRange=0 +sfr = "PMC_MOR.OSCBYPASS", "Memory", 0xfffffc20, 4, base=16, bitRange=1 +sfr = "PMC_MOR.OSCOUNT", "Memory", 0xfffffc20, 4, base=16, bitRange=8-15 +sfr = "PMC_MCFR", "Memory", 0xfffffc24, 4, base=16 +sfr = "PMC_MCFR.MAINF", "Memory", 0xfffffc24, 4, base=16, bitRange=0-15 +sfr = "PMC_MCFR.MAINRDY", "Memory", 0xfffffc24, 4, base=16, bitRange=16 +sfr = "PMC_PLLR", "Memory", 0xfffffc2c, 4, base=16 +sfr = "PMC_PLLR.DIV", "Memory", 0xfffffc2c, 4, base=16, bitRange=0-7 +sfr = "PMC_PLLR.PLLCOUNT", "Memory", 0xfffffc2c, 4, base=16, bitRange=8-13 +sfr = "PMC_PLLR.OUT", "Memory", 0xfffffc2c, 4, base=16, bitRange=14-15 +sfr = "PMC_PLLR.MUL", "Memory", 0xfffffc2c, 4, base=16, bitRange=16-26 +sfr = "PMC_PLLR.USBDIV", "Memory", 0xfffffc2c, 4, base=16, bitRange=28-29 +sfr = "PMC_MCKR", "Memory", 0xfffffc30, 4, base=16 +sfr = "PMC_MCKR.CSS", "Memory", 0xfffffc30, 4, base=16, bitRange=0-1 +sfr = "PMC_MCKR.PRES", "Memory", 0xfffffc30, 4, base=16, bitRange=2-4 +sfr = "PMC_PCKR", "Memory", 0xfffffc40, 4, base=16 +sfr = "PMC_PCKR.CSS", "Memory", 0xfffffc40, 4, base=16, bitRange=0-1 +sfr = "PMC_PCKR.PRES", "Memory", 0xfffffc40, 4, base=16, bitRange=2-4 +sfr = "PMC_IER", "Memory", 0xfffffc60, 4, base=16 +sfr = "PMC_IER.MOSCS", "Memory", 0xfffffc60, 4, base=16, bitRange=0 +sfr = "PMC_IER.LOCK", "Memory", 0xfffffc60, 4, base=16, bitRange=2 +sfr = "PMC_IER.MCKRDY", "Memory", 0xfffffc60, 4, base=16, bitRange=3 +sfr = "PMC_IER.PCK0RDY", "Memory", 0xfffffc60, 4, base=16, bitRange=8 +sfr = "PMC_IER.PCK1RDY", "Memory", 0xfffffc60, 4, base=16, bitRange=9 +sfr = "PMC_IER.PCK2RDY", "Memory", 0xfffffc60, 4, base=16, bitRange=10 +sfr = "PMC_IER.PCK3RDY", "Memory", 0xfffffc60, 4, base=16, bitRange=11 +sfr = "PMC_IDR", "Memory", 0xfffffc64, 4, base=16 +sfr = "PMC_IDR.MOSCS", "Memory", 0xfffffc64, 4, base=16, bitRange=0 +sfr = "PMC_IDR.LOCK", "Memory", 0xfffffc64, 4, base=16, bitRange=2 +sfr = "PMC_IDR.MCKRDY", "Memory", 0xfffffc64, 4, base=16, bitRange=3 +sfr = "PMC_IDR.PCK0RDY", "Memory", 0xfffffc64, 4, base=16, bitRange=8 +sfr = "PMC_IDR.PCK1RDY", "Memory", 0xfffffc64, 4, base=16, bitRange=9 +sfr = "PMC_IDR.PCK2RDY", "Memory", 0xfffffc64, 4, base=16, bitRange=10 +sfr = "PMC_IDR.PCK3RDY", "Memory", 0xfffffc64, 4, base=16, bitRange=11 +sfr = "PMC_SR", "Memory", 0xfffffc68, 4, base=16 +sfr = "PMC_SR.MOSCS", "Memory", 0xfffffc68, 4, base=16, bitRange=0 +sfr = "PMC_SR.LOCK", "Memory", 0xfffffc68, 4, base=16, bitRange=2 +sfr = "PMC_SR.MCKRDY", "Memory", 0xfffffc68, 4, base=16, bitRange=3 +sfr = "PMC_SR.PCK0RDY", "Memory", 0xfffffc68, 4, base=16, bitRange=8 +sfr = "PMC_SR.PCK1RDY", "Memory", 0xfffffc68, 4, base=16, bitRange=9 +sfr = "PMC_SR.PCK2RDY", "Memory", 0xfffffc68, 4, base=16, bitRange=10 +sfr = "PMC_SR.PCK3RDY", "Memory", 0xfffffc68, 4, base=16, bitRange=11 +sfr = "PMC_IMR", "Memory", 0xfffffc6c, 4, base=16 +sfr = "PMC_IMR.MOSCS", "Memory", 0xfffffc6c, 4, base=16, bitRange=0 +sfr = "PMC_IMR.LOCK", "Memory", 0xfffffc6c, 4, base=16, bitRange=2 +sfr = "PMC_IMR.MCKRDY", "Memory", 0xfffffc6c, 4, base=16, bitRange=3 +sfr = "PMC_IMR.PCK0RDY", "Memory", 0xfffffc6c, 4, base=16, bitRange=8 +sfr = "PMC_IMR.PCK1RDY", "Memory", 0xfffffc6c, 4, base=16, bitRange=9 +sfr = "PMC_IMR.PCK2RDY", "Memory", 0xfffffc6c, 4, base=16, bitRange=10 +sfr = "PMC_IMR.PCK3RDY", "Memory", 0xfffffc6c, 4, base=16, bitRange=11 +; ========== Register definition for RSTC peripheral ========== +sfr = "RSTC_RCR", "Memory", 0xfffffd00, 4, base=16 +sfr = "RSTC_RCR.PROCRST", "Memory", 0xfffffd00, 4, base=16, bitRange=0 +sfr = "RSTC_RCR.PERRST", "Memory", 0xfffffd00, 4, base=16, bitRange=2 +sfr = "RSTC_RCR.EXTRST", "Memory", 0xfffffd00, 4, base=16, bitRange=3 +sfr = "RSTC_RCR.KEY", "Memory", 0xfffffd00, 4, base=16, bitRange=24-31 +sfr = "RSTC_RSR", "Memory", 0xfffffd04, 4, base=16 +sfr = "RSTC_RSR.URSTS", "Memory", 0xfffffd04, 4, base=16, bitRange=0 +sfr = "RSTC_RSR.BODSTS", "Memory", 0xfffffd04, 4, base=16, bitRange=1 +sfr = "RSTC_RSR.RSTTYP", "Memory", 0xfffffd04, 4, base=16, bitRange=8-10 +sfr = "RSTC_RSR.NRSTL", "Memory", 0xfffffd04, 4, base=16, bitRange=16 +sfr = "RSTC_RSR.SRCMP", "Memory", 0xfffffd04, 4, base=16, bitRange=17 +sfr = "RSTC_RMR", "Memory", 0xfffffd08, 4, base=16 +sfr = "RSTC_RMR.URSTEN", "Memory", 0xfffffd08, 4, base=16, bitRange=0 +sfr = "RSTC_RMR.URSTIEN", "Memory", 0xfffffd08, 4, base=16, bitRange=4 +sfr = "RSTC_RMR.ERSTL", "Memory", 0xfffffd08, 4, base=16, bitRange=8-11 +sfr = "RSTC_RMR.BODIEN", "Memory", 0xfffffd08, 4, base=16, bitRange=16 +sfr = "RSTC_RMR.KEY", "Memory", 0xfffffd08, 4, base=16, bitRange=24-31 +; ========== Register definition for RTTC peripheral ========== +sfr = "RTTC_RTMR", "Memory", 0xfffffd20, 4, base=16 +sfr = "RTTC_RTMR.RTPRES", "Memory", 0xfffffd20, 4, base=16, bitRange=0-15 +sfr = "RTTC_RTMR.ALMIEN", "Memory", 0xfffffd20, 4, base=16, bitRange=16 +sfr = "RTTC_RTMR.RTTINCIEN", "Memory", 0xfffffd20, 4, base=16, bitRange=17 +sfr = "RTTC_RTMR.RTTRST", "Memory", 0xfffffd20, 4, base=16, bitRange=18 +sfr = "RTTC_RTAR", "Memory", 0xfffffd24, 4, base=16 +sfr = "RTTC_RTAR.ALMV", "Memory", 0xfffffd24, 4, base=16, bitRange=0-31 +sfr = "RTTC_RTVR", "Memory", 0xfffffd28, 4, base=16 +sfr = "RTTC_RTVR.CRTV", "Memory", 0xfffffd28, 4, base=16, bitRange=0-31 +sfr = "RTTC_RTSR", "Memory", 0xfffffd2c, 4, base=16 +sfr = "RTTC_RTSR.ALMS", "Memory", 0xfffffd2c, 4, base=16, bitRange=0 +sfr = "RTTC_RTSR.RTTINC", "Memory", 0xfffffd2c, 4, base=16, bitRange=1 +; ========== Register definition for PITC peripheral ========== +sfr = "PITC_PIMR", "Memory", 0xfffffd30, 4, base=16 +sfr = "PITC_PIMR.PIV", "Memory", 0xfffffd30, 4, base=16, bitRange=0-19 +sfr = "PITC_PIMR.PITEN", "Memory", 0xfffffd30, 4, base=16, bitRange=24 +sfr = "PITC_PIMR.PITIEN", "Memory", 0xfffffd30, 4, base=16, bitRange=25 +sfr = "PITC_PISR", "Memory", 0xfffffd34, 4, base=16 +sfr = "PITC_PISR.PITS", "Memory", 0xfffffd34, 4, base=16, bitRange=0 +sfr = "PITC_PIVR", "Memory", 0xfffffd38, 4, base=16 +sfr = "PITC_PIVR.CPIV", "Memory", 0xfffffd38, 4, base=16, bitRange=0-19 +sfr = "PITC_PIVR.PICNT", "Memory", 0xfffffd38, 4, base=16, bitRange=20-31 +sfr = "PITC_PIIR", "Memory", 0xfffffd3c, 4, base=16 +sfr = "PITC_PIIR.CPIV", "Memory", 0xfffffd3c, 4, base=16, bitRange=0-19 +sfr = "PITC_PIIR.PICNT", "Memory", 0xfffffd3c, 4, base=16, bitRange=20-31 +; ========== Register definition for WDTC peripheral ========== +sfr = "WDTC_WDCR", "Memory", 0xfffffd40, 4, base=16 +sfr = "WDTC_WDCR.WDRSTT", "Memory", 0xfffffd40, 4, base=16, bitRange=0 +sfr = "WDTC_WDCR.KEY", "Memory", 0xfffffd40, 4, base=16, bitRange=24-31 +sfr = "WDTC_WDMR", "Memory", 0xfffffd44, 4, base=16 +sfr = "WDTC_WDMR.WDV", "Memory", 0xfffffd44, 4, base=16, bitRange=0-11 +sfr = "WDTC_WDMR.WDFIEN", "Memory", 0xfffffd44, 4, base=16, bitRange=12 +sfr = "WDTC_WDMR.WDRSTEN", "Memory", 0xfffffd44, 4, base=16, bitRange=13 +sfr = "WDTC_WDMR.WDRPROC", "Memory", 0xfffffd44, 4, base=16, bitRange=14 +sfr = "WDTC_WDMR.WDDIS", "Memory", 0xfffffd44, 4, base=16, bitRange=15 +sfr = "WDTC_WDMR.WDD", "Memory", 0xfffffd44, 4, base=16, bitRange=16-27 +sfr = "WDTC_WDMR.WDDBGHLT", "Memory", 0xfffffd44, 4, base=16, bitRange=28 +sfr = "WDTC_WDMR.WDIDLEHLT", "Memory", 0xfffffd44, 4, base=16, bitRange=29 +sfr = "WDTC_WDSR", "Memory", 0xfffffd48, 4, base=16 +sfr = "WDTC_WDSR.WDUNF", "Memory", 0xfffffd48, 4, base=16, bitRange=0 +sfr = "WDTC_WDSR.WDERR", "Memory", 0xfffffd48, 4, base=16, bitRange=1 +; ========== Register definition for VREG peripheral ========== +sfr = "VREG_MR", "Memory", 0xfffffd60, 4, base=16 +sfr = "VREG_MR.PSTDBY", "Memory", 0xfffffd60, 4, base=16, bitRange=0 +; ========== Register definition for MC peripheral ========== +sfr = "MC_RCR", "Memory", 0xffffff00, 4, base=16 +sfr = "MC_RCR.RCB", "Memory", 0xffffff00, 4, base=16, bitRange=0 +sfr = "MC_ASR", "Memory", 0xffffff04, 4, base=16 +sfr = "MC_ASR.UNDADD", "Memory", 0xffffff04, 4, base=16, bitRange=0 +sfr = "MC_ASR.MISADD", "Memory", 0xffffff04, 4, base=16, bitRange=1 +sfr = "MC_ASR.ABTSZ", "Memory", 0xffffff04, 4, base=16, bitRange=8-9 +sfr = "MC_ASR.ABTTYP", "Memory", 0xffffff04, 4, base=16, bitRange=10-11 +sfr = "MC_ASR.MST0", "Memory", 0xffffff04, 4, base=16, bitRange=16 +sfr = "MC_ASR.MST1", "Memory", 0xffffff04, 4, base=16, bitRange=17 +sfr = "MC_ASR.SVMST0", "Memory", 0xffffff04, 4, base=16, bitRange=24 +sfr = "MC_ASR.SVMST1", "Memory", 0xffffff04, 4, base=16, bitRange=25 +sfr = "MC_AASR", "Memory", 0xffffff08, 4, base=16 +sfr = "MC_FMR", "Memory", 0xffffff60, 4, base=16 +sfr = "MC_FMR.FRDY", "Memory", 0xffffff60, 4, base=16, bitRange=0 +sfr = "MC_FMR.LOCKE", "Memory", 0xffffff60, 4, base=16, bitRange=2 +sfr = "MC_FMR.PROGE", "Memory", 0xffffff60, 4, base=16, bitRange=3 +sfr = "MC_FMR.NEBP", "Memory", 0xffffff60, 4, base=16, bitRange=7 +sfr = "MC_FMR.FWS", "Memory", 0xffffff60, 4, base=16, bitRange=8-9 +sfr = "MC_FMR.FMCN", "Memory", 0xffffff60, 4, base=16, bitRange=16-23 +sfr = "MC_FCR", "Memory", 0xffffff64, 4, base=16 +sfr = "MC_FCR.FCMD", "Memory", 0xffffff64, 4, base=16, bitRange=0-3 +sfr = "MC_FCR.PAGEN", "Memory", 0xffffff64, 4, base=16, bitRange=8-17 +sfr = "MC_FCR.KEY", "Memory", 0xffffff64, 4, base=16, bitRange=24-31 +sfr = "MC_FSR", "Memory", 0xffffff68, 4, base=16 +sfr = "MC_FSR.FRDY", "Memory", 0xffffff68, 4, base=16, bitRange=0 +sfr = "MC_FSR.LOCKE", "Memory", 0xffffff68, 4, base=16, bitRange=2 +sfr = "MC_FSR.PROGE", "Memory", 0xffffff68, 4, base=16, bitRange=3 +sfr = "MC_FSR.SECURITY", "Memory", 0xffffff68, 4, base=16, bitRange=4 +sfr = "MC_FSR.GPNVM0", "Memory", 0xffffff68, 4, base=16, bitRange=8 +sfr = "MC_FSR.GPNVM1", "Memory", 0xffffff68, 4, base=16, bitRange=9 +sfr = "MC_FSR.GPNVM2", "Memory", 0xffffff68, 4, base=16, bitRange=10 +sfr = "MC_FSR.GPNVM3", "Memory", 0xffffff68, 4, base=16, bitRange=11 +sfr = "MC_FSR.GPNVM4", "Memory", 0xffffff68, 4, base=16, bitRange=12 +sfr = "MC_FSR.GPNVM5", "Memory", 0xffffff68, 4, base=16, bitRange=13 +sfr = "MC_FSR.GPNVM6", "Memory", 0xffffff68, 4, base=16, bitRange=14 +sfr = "MC_FSR.GPNVM7", "Memory", 0xffffff68, 4, base=16, bitRange=15 +sfr = "MC_FSR.LOCKS0", "Memory", 0xffffff68, 4, base=16, bitRange=16 +sfr = "MC_FSR.LOCKS1", "Memory", 0xffffff68, 4, base=16, bitRange=17 +sfr = "MC_FSR.LOCKS2", "Memory", 0xffffff68, 4, base=16, bitRange=18 +sfr = "MC_FSR.LOCKS3", "Memory", 0xffffff68, 4, base=16, bitRange=19 +sfr = "MC_FSR.LOCKS4", "Memory", 0xffffff68, 4, base=16, bitRange=20 +sfr = "MC_FSR.LOCKS5", "Memory", 0xffffff68, 4, base=16, bitRange=21 +sfr = "MC_FSR.LOCKS6", "Memory", 0xffffff68, 4, base=16, bitRange=22 +sfr = "MC_FSR.LOCKS7", "Memory", 0xffffff68, 4, base=16, bitRange=23 +sfr = "MC_FSR.LOCKS8", "Memory", 0xffffff68, 4, base=16, bitRange=24 +sfr = "MC_FSR.LOCKS9", "Memory", 0xffffff68, 4, base=16, bitRange=25 +sfr = "MC_FSR.LOCKS10", "Memory", 0xffffff68, 4, base=16, bitRange=26 +sfr = "MC_FSR.LOCKS11", "Memory", 0xffffff68, 4, base=16, bitRange=27 +sfr = "MC_FSR.LOCKS12", "Memory", 0xffffff68, 4, base=16, bitRange=28 +sfr = "MC_FSR.LOCKS13", "Memory", 0xffffff68, 4, base=16, bitRange=29 +sfr = "MC_FSR.LOCKS14", "Memory", 0xffffff68, 4, base=16, bitRange=30 +sfr = "MC_FSR.LOCKS15", "Memory", 0xffffff68, 4, base=16, bitRange=31 +; ========== Register definition for PDC_SPI1 peripheral ========== +sfr = "SPI1_RPR", "Memory", 0xfffe4100, 4, base=16 +sfr = "SPI1_RCR", "Memory", 0xfffe4104, 4, base=16 +sfr = "SPI1_TPR", "Memory", 0xfffe4108, 4, base=16 +sfr = "SPI1_TCR", "Memory", 0xfffe410c, 4, base=16 +sfr = "SPI1_RNPR", "Memory", 0xfffe4110, 4, base=16 +sfr = "SPI1_RNCR", "Memory", 0xfffe4114, 4, base=16 +sfr = "SPI1_TNPR", "Memory", 0xfffe4118, 4, base=16 +sfr = "SPI1_TNCR", "Memory", 0xfffe411c, 4, base=16 +sfr = "SPI1_PTCR", "Memory", 0xfffe4120, 4, base=16 +sfr = "SPI1_PTCR.RXTEN", "Memory", 0xfffe4120, 4, base=16, bitRange=0 +sfr = "SPI1_PTCR.RXTDIS", "Memory", 0xfffe4120, 4, base=16, bitRange=1 +sfr = "SPI1_PTCR.TXTEN", "Memory", 0xfffe4120, 4, base=16, bitRange=8 +sfr = "SPI1_PTCR.TXTDIS", "Memory", 0xfffe4120, 4, base=16, bitRange=9 +sfr = "SPI1_PTSR", "Memory", 0xfffe4124, 4, base=16 +sfr = "SPI1_PTSR.RXTEN", "Memory", 0xfffe4124, 4, base=16, bitRange=0 +sfr = "SPI1_PTSR.TXTEN", "Memory", 0xfffe4124, 4, base=16, bitRange=8 +; ========== Register definition for SPI1 peripheral ========== +sfr = "SPI1_CR", "Memory", 0xfffe4000, 4, base=16 +sfr = "SPI1_CR.SPIEN", "Memory", 0xfffe4000, 4, base=16, bitRange=0 +sfr = "SPI1_CR.SPIDIS", "Memory", 0xfffe4000, 4, base=16, bitRange=1 +sfr = "SPI1_CR.SWRST", "Memory", 0xfffe4000, 4, base=16, bitRange=7 +sfr = "SPI1_CR.LASTXFER", "Memory", 0xfffe4000, 4, base=16, bitRange=24 +sfr = "SPI1_MR", "Memory", 0xfffe4004, 4, base=16 +sfr = "SPI1_MR.MSTR", "Memory", 0xfffe4004, 4, base=16, bitRange=0 +sfr = "SPI1_MR.PS", "Memory", 0xfffe4004, 4, base=16, bitRange=1 +sfr = "SPI1_MR.PCSDEC", "Memory", 0xfffe4004, 4, base=16, bitRange=2 +sfr = "SPI1_MR.FDIV", "Memory", 0xfffe4004, 4, base=16, bitRange=3 +sfr = "SPI1_MR.MODFDIS", "Memory", 0xfffe4004, 4, base=16, bitRange=4 +sfr = "SPI1_MR.LLB", "Memory", 0xfffe4004, 4, base=16, bitRange=7 +sfr = "SPI1_MR.PCS", "Memory", 0xfffe4004, 4, base=16, bitRange=16-19 +sfr = "SPI1_MR.DLYBCS", "Memory", 0xfffe4004, 4, base=16, bitRange=24-31 +sfr = "SPI1_RDR", "Memory", 0xfffe4008, 4, base=16 +sfr = "SPI1_RDR.RD", "Memory", 0xfffe4008, 4, base=16, bitRange=0-15 +sfr = "SPI1_RDR.RPCS", "Memory", 0xfffe4008, 4, base=16, bitRange=16-19 +sfr = "SPI1_TDR", "Memory", 0xfffe400c, 4, base=16 +sfr = "SPI1_TDR.TD", "Memory", 0xfffe400c, 4, base=16, bitRange=0-15 +sfr = "SPI1_TDR.TPCS", "Memory", 0xfffe400c, 4, base=16, bitRange=16-19 +sfr = "SPI1_TDR.LASTXFER", "Memory", 0xfffe400c, 4, base=16, bitRange=24 +sfr = "SPI1_SR", "Memory", 0xfffe4010, 4, base=16 +sfr = "SPI1_SR.RDRF", "Memory", 0xfffe4010, 4, base=16, bitRange=0 +sfr = "SPI1_SR.TDRE", "Memory", 0xfffe4010, 4, base=16, bitRange=1 +sfr = "SPI1_SR.MODF", "Memory", 0xfffe4010, 4, base=16, bitRange=2 +sfr = "SPI1_SR.OVRES", "Memory", 0xfffe4010, 4, base=16, bitRange=3 +sfr = "SPI1_SR.ENDRX", "Memory", 0xfffe4010, 4, base=16, bitRange=4 +sfr = "SPI1_SR.ENDTX", "Memory", 0xfffe4010, 4, base=16, bitRange=5 +sfr = "SPI1_SR.RXBUFF", "Memory", 0xfffe4010, 4, base=16, bitRange=6 +sfr = "SPI1_SR.TXBUFE", "Memory", 0xfffe4010, 4, base=16, bitRange=7 +sfr = "SPI1_SR.NSSR", "Memory", 0xfffe4010, 4, base=16, bitRange=8 +sfr = "SPI1_SR.TXEMPTY", "Memory", 0xfffe4010, 4, base=16, bitRange=9 +sfr = "SPI1_SR.SPIENS", "Memory", 0xfffe4010, 4, base=16, bitRange=16 +sfr = "SPI1_IER", "Memory", 0xfffe4014, 4, base=16 +sfr = "SPI1_IER.RDRF", "Memory", 0xfffe4014, 4, base=16, bitRange=0 +sfr = "SPI1_IER.TDRE", "Memory", 0xfffe4014, 4, base=16, bitRange=1 +sfr = "SPI1_IER.MODF", "Memory", 0xfffe4014, 4, base=16, bitRange=2 +sfr = "SPI1_IER.OVRES", "Memory", 0xfffe4014, 4, base=16, bitRange=3 +sfr = "SPI1_IER.ENDRX", "Memory", 0xfffe4014, 4, base=16, bitRange=4 +sfr = "SPI1_IER.ENDTX", "Memory", 0xfffe4014, 4, base=16, bitRange=5 +sfr = "SPI1_IER.RXBUFF", "Memory", 0xfffe4014, 4, base=16, bitRange=6 +sfr = "SPI1_IER.TXBUFE", "Memory", 0xfffe4014, 4, base=16, bitRange=7 +sfr = "SPI1_IER.NSSR", "Memory", 0xfffe4014, 4, base=16, bitRange=8 +sfr = "SPI1_IER.TXEMPTY", "Memory", 0xfffe4014, 4, base=16, bitRange=9 +sfr = "SPI1_IDR", "Memory", 0xfffe4018, 4, base=16 +sfr = "SPI1_IDR.RDRF", "Memory", 0xfffe4018, 4, base=16, bitRange=0 +sfr = "SPI1_IDR.TDRE", "Memory", 0xfffe4018, 4, base=16, bitRange=1 +sfr = "SPI1_IDR.MODF", "Memory", 0xfffe4018, 4, base=16, bitRange=2 +sfr = "SPI1_IDR.OVRES", "Memory", 0xfffe4018, 4, base=16, bitRange=3 +sfr = "SPI1_IDR.ENDRX", "Memory", 0xfffe4018, 4, base=16, bitRange=4 +sfr = "SPI1_IDR.ENDTX", "Memory", 0xfffe4018, 4, base=16, bitRange=5 +sfr = "SPI1_IDR.RXBUFF", "Memory", 0xfffe4018, 4, base=16, bitRange=6 +sfr = "SPI1_IDR.TXBUFE", "Memory", 0xfffe4018, 4, base=16, bitRange=7 +sfr = "SPI1_IDR.NSSR", "Memory", 0xfffe4018, 4, base=16, bitRange=8 +sfr = "SPI1_IDR.TXEMPTY", "Memory", 0xfffe4018, 4, base=16, bitRange=9 +sfr = "SPI1_IMR", "Memory", 0xfffe401c, 4, base=16 +sfr = "SPI1_IMR.RDRF", "Memory", 0xfffe401c, 4, base=16, bitRange=0 +sfr = "SPI1_IMR.TDRE", "Memory", 0xfffe401c, 4, base=16, bitRange=1 +sfr = "SPI1_IMR.MODF", "Memory", 0xfffe401c, 4, base=16, bitRange=2 +sfr = "SPI1_IMR.OVRES", "Memory", 0xfffe401c, 4, base=16, bitRange=3 +sfr = "SPI1_IMR.ENDRX", "Memory", 0xfffe401c, 4, base=16, bitRange=4 +sfr = "SPI1_IMR.ENDTX", "Memory", 0xfffe401c, 4, base=16, bitRange=5 +sfr = "SPI1_IMR.RXBUFF", "Memory", 0xfffe401c, 4, base=16, bitRange=6 +sfr = "SPI1_IMR.TXBUFE", "Memory", 0xfffe401c, 4, base=16, bitRange=7 +sfr = "SPI1_IMR.NSSR", "Memory", 0xfffe401c, 4, base=16, bitRange=8 +sfr = "SPI1_IMR.TXEMPTY", "Memory", 0xfffe401c, 4, base=16, bitRange=9 +sfr = "SPI1_CSR", "Memory", 0xfffe4030, 4, base=16 +sfr = "SPI1_CSR.CPOL", "Memory", 0xfffe4030, 4, base=16, bitRange=0 +sfr = "SPI1_CSR.NCPHA", "Memory", 0xfffe4030, 4, base=16, bitRange=1 +sfr = "SPI1_CSR.CSAAT", "Memory", 0xfffe4030, 4, base=16, bitRange=3 +sfr = "SPI1_CSR.BITS", "Memory", 0xfffe4030, 4, base=16, bitRange=4-7 +sfr = "SPI1_CSR.SCBR", "Memory", 0xfffe4030, 4, base=16, bitRange=8-15 +sfr = "SPI1_CSR.DLYBS", "Memory", 0xfffe4030, 4, base=16, bitRange=16-23 +sfr = "SPI1_CSR.DLYBCT", "Memory", 0xfffe4030, 4, base=16, bitRange=24-31 +; ========== Register definition for PDC_SPI0 peripheral ========== +sfr = "SPI0_RPR", "Memory", 0xfffe0100, 4, base=16 +sfr = "SPI0_RCR", "Memory", 0xfffe0104, 4, base=16 +sfr = "SPI0_TPR", "Memory", 0xfffe0108, 4, base=16 +sfr = "SPI0_TCR", "Memory", 0xfffe010c, 4, base=16 +sfr = "SPI0_RNPR", "Memory", 0xfffe0110, 4, base=16 +sfr = "SPI0_RNCR", "Memory", 0xfffe0114, 4, base=16 +sfr = "SPI0_TNPR", "Memory", 0xfffe0118, 4, base=16 +sfr = "SPI0_TNCR", "Memory", 0xfffe011c, 4, base=16 +sfr = "SPI0_PTCR", "Memory", 0xfffe0120, 4, base=16 +sfr = "SPI0_PTCR.RXTEN", "Memory", 0xfffe0120, 4, base=16, bitRange=0 +sfr = "SPI0_PTCR.RXTDIS", "Memory", 0xfffe0120, 4, base=16, bitRange=1 +sfr = "SPI0_PTCR.TXTEN", "Memory", 0xfffe0120, 4, base=16, bitRange=8 +sfr = "SPI0_PTCR.TXTDIS", "Memory", 0xfffe0120, 4, base=16, bitRange=9 +sfr = "SPI0_PTSR", "Memory", 0xfffe0124, 4, base=16 +sfr = "SPI0_PTSR.RXTEN", "Memory", 0xfffe0124, 4, base=16, bitRange=0 +sfr = "SPI0_PTSR.TXTEN", "Memory", 0xfffe0124, 4, base=16, bitRange=8 +; ========== Register definition for SPI0 peripheral ========== +sfr = "SPI0_CR", "Memory", 0xfffe0000, 4, base=16 +sfr = "SPI0_CR.SPIEN", "Memory", 0xfffe0000, 4, base=16, bitRange=0 +sfr = "SPI0_CR.SPIDIS", "Memory", 0xfffe0000, 4, base=16, bitRange=1 +sfr = "SPI0_CR.SWRST", "Memory", 0xfffe0000, 4, base=16, bitRange=7 +sfr = "SPI0_CR.LASTXFER", "Memory", 0xfffe0000, 4, base=16, bitRange=24 +sfr = "SPI0_MR", "Memory", 0xfffe0004, 4, base=16 +sfr = "SPI0_MR.MSTR", "Memory", 0xfffe0004, 4, base=16, bitRange=0 +sfr = "SPI0_MR.PS", "Memory", 0xfffe0004, 4, base=16, bitRange=1 +sfr = "SPI0_MR.PCSDEC", "Memory", 0xfffe0004, 4, base=16, bitRange=2 +sfr = "SPI0_MR.FDIV", "Memory", 0xfffe0004, 4, base=16, bitRange=3 +sfr = "SPI0_MR.MODFDIS", "Memory", 0xfffe0004, 4, base=16, bitRange=4 +sfr = "SPI0_MR.LLB", "Memory", 0xfffe0004, 4, base=16, bitRange=7 +sfr = "SPI0_MR.PCS", "Memory", 0xfffe0004, 4, base=16, bitRange=16-19 +sfr = "SPI0_MR.DLYBCS", "Memory", 0xfffe0004, 4, base=16, bitRange=24-31 +sfr = "SPI0_RDR", "Memory", 0xfffe0008, 4, base=16 +sfr = "SPI0_RDR.RD", "Memory", 0xfffe0008, 4, base=16, bitRange=0-15 +sfr = "SPI0_RDR.RPCS", "Memory", 0xfffe0008, 4, base=16, bitRange=16-19 +sfr = "SPI0_TDR", "Memory", 0xfffe000c, 4, base=16 +sfr = "SPI0_TDR.TD", "Memory", 0xfffe000c, 4, base=16, bitRange=0-15 +sfr = "SPI0_TDR.TPCS", "Memory", 0xfffe000c, 4, base=16, bitRange=16-19 +sfr = "SPI0_TDR.LASTXFER", "Memory", 0xfffe000c, 4, base=16, bitRange=24 +sfr = "SPI0_SR", "Memory", 0xfffe0010, 4, base=16 +sfr = "SPI0_SR.RDRF", "Memory", 0xfffe0010, 4, base=16, bitRange=0 +sfr = "SPI0_SR.TDRE", "Memory", 0xfffe0010, 4, base=16, bitRange=1 +sfr = "SPI0_SR.MODF", "Memory", 0xfffe0010, 4, base=16, bitRange=2 +sfr = "SPI0_SR.OVRES", "Memory", 0xfffe0010, 4, base=16, bitRange=3 +sfr = "SPI0_SR.ENDRX", "Memory", 0xfffe0010, 4, base=16, bitRange=4 +sfr = "SPI0_SR.ENDTX", "Memory", 0xfffe0010, 4, base=16, bitRange=5 +sfr = "SPI0_SR.RXBUFF", "Memory", 0xfffe0010, 4, base=16, bitRange=6 +sfr = "SPI0_SR.TXBUFE", "Memory", 0xfffe0010, 4, base=16, bitRange=7 +sfr = "SPI0_SR.NSSR", "Memory", 0xfffe0010, 4, base=16, bitRange=8 +sfr = "SPI0_SR.TXEMPTY", "Memory", 0xfffe0010, 4, base=16, bitRange=9 +sfr = "SPI0_SR.SPIENS", "Memory", 0xfffe0010, 4, base=16, bitRange=16 +sfr = "SPI0_IER", "Memory", 0xfffe0014, 4, base=16 +sfr = "SPI0_IER.RDRF", "Memory", 0xfffe0014, 4, base=16, bitRange=0 +sfr = "SPI0_IER.TDRE", "Memory", 0xfffe0014, 4, base=16, bitRange=1 +sfr = "SPI0_IER.MODF", "Memory", 0xfffe0014, 4, base=16, bitRange=2 +sfr = "SPI0_IER.OVRES", "Memory", 0xfffe0014, 4, base=16, bitRange=3 +sfr = "SPI0_IER.ENDRX", "Memory", 0xfffe0014, 4, base=16, bitRange=4 +sfr = "SPI0_IER.ENDTX", "Memory", 0xfffe0014, 4, base=16, bitRange=5 +sfr = "SPI0_IER.RXBUFF", "Memory", 0xfffe0014, 4, base=16, bitRange=6 +sfr = "SPI0_IER.TXBUFE", "Memory", 0xfffe0014, 4, base=16, bitRange=7 +sfr = "SPI0_IER.NSSR", "Memory", 0xfffe0014, 4, base=16, bitRange=8 +sfr = "SPI0_IER.TXEMPTY", "Memory", 0xfffe0014, 4, base=16, bitRange=9 +sfr = "SPI0_IDR", "Memory", 0xfffe0018, 4, base=16 +sfr = "SPI0_IDR.RDRF", "Memory", 0xfffe0018, 4, base=16, bitRange=0 +sfr = "SPI0_IDR.TDRE", "Memory", 0xfffe0018, 4, base=16, bitRange=1 +sfr = "SPI0_IDR.MODF", "Memory", 0xfffe0018, 4, base=16, bitRange=2 +sfr = "SPI0_IDR.OVRES", "Memory", 0xfffe0018, 4, base=16, bitRange=3 +sfr = "SPI0_IDR.ENDRX", "Memory", 0xfffe0018, 4, base=16, bitRange=4 +sfr = "SPI0_IDR.ENDTX", "Memory", 0xfffe0018, 4, base=16, bitRange=5 +sfr = "SPI0_IDR.RXBUFF", "Memory", 0xfffe0018, 4, base=16, bitRange=6 +sfr = "SPI0_IDR.TXBUFE", "Memory", 0xfffe0018, 4, base=16, bitRange=7 +sfr = "SPI0_IDR.NSSR", "Memory", 0xfffe0018, 4, base=16, bitRange=8 +sfr = "SPI0_IDR.TXEMPTY", "Memory", 0xfffe0018, 4, base=16, bitRange=9 +sfr = "SPI0_IMR", "Memory", 0xfffe001c, 4, base=16 +sfr = "SPI0_IMR.RDRF", "Memory", 0xfffe001c, 4, base=16, bitRange=0 +sfr = "SPI0_IMR.TDRE", "Memory", 0xfffe001c, 4, base=16, bitRange=1 +sfr = "SPI0_IMR.MODF", "Memory", 0xfffe001c, 4, base=16, bitRange=2 +sfr = "SPI0_IMR.OVRES", "Memory", 0xfffe001c, 4, base=16, bitRange=3 +sfr = "SPI0_IMR.ENDRX", "Memory", 0xfffe001c, 4, base=16, bitRange=4 +sfr = "SPI0_IMR.ENDTX", "Memory", 0xfffe001c, 4, base=16, bitRange=5 +sfr = "SPI0_IMR.RXBUFF", "Memory", 0xfffe001c, 4, base=16, bitRange=6 +sfr = "SPI0_IMR.TXBUFE", "Memory", 0xfffe001c, 4, base=16, bitRange=7 +sfr = "SPI0_IMR.NSSR", "Memory", 0xfffe001c, 4, base=16, bitRange=8 +sfr = "SPI0_IMR.TXEMPTY", "Memory", 0xfffe001c, 4, base=16, bitRange=9 +sfr = "SPI0_CSR", "Memory", 0xfffe0030, 4, base=16 +sfr = "SPI0_CSR.CPOL", "Memory", 0xfffe0030, 4, base=16, bitRange=0 +sfr = "SPI0_CSR.NCPHA", "Memory", 0xfffe0030, 4, base=16, bitRange=1 +sfr = "SPI0_CSR.CSAAT", "Memory", 0xfffe0030, 4, base=16, bitRange=3 +sfr = "SPI0_CSR.BITS", "Memory", 0xfffe0030, 4, base=16, bitRange=4-7 +sfr = "SPI0_CSR.SCBR", "Memory", 0xfffe0030, 4, base=16, bitRange=8-15 +sfr = "SPI0_CSR.DLYBS", "Memory", 0xfffe0030, 4, base=16, bitRange=16-23 +sfr = "SPI0_CSR.DLYBCT", "Memory", 0xfffe0030, 4, base=16, bitRange=24-31 +; ========== Register definition for PDC_US1 peripheral ========== +sfr = "US1_RPR", "Memory", 0xfffc4100, 4, base=16 +sfr = "US1_RCR", "Memory", 0xfffc4104, 4, base=16 +sfr = "US1_TPR", "Memory", 0xfffc4108, 4, base=16 +sfr = "US1_TCR", "Memory", 0xfffc410c, 4, base=16 +sfr = "US1_RNPR", "Memory", 0xfffc4110, 4, base=16 +sfr = "US1_RNCR", "Memory", 0xfffc4114, 4, base=16 +sfr = "US1_TNPR", "Memory", 0xfffc4118, 4, base=16 +sfr = "US1_TNCR", "Memory", 0xfffc411c, 4, base=16 +sfr = "US1_PTCR", "Memory", 0xfffc4120, 4, base=16 +sfr = "US1_PTCR.RXTEN", "Memory", 0xfffc4120, 4, base=16, bitRange=0 +sfr = "US1_PTCR.RXTDIS", "Memory", 0xfffc4120, 4, base=16, bitRange=1 +sfr = "US1_PTCR.TXTEN", "Memory", 0xfffc4120, 4, base=16, bitRange=8 +sfr = "US1_PTCR.TXTDIS", "Memory", 0xfffc4120, 4, base=16, bitRange=9 +sfr = "US1_PTSR", "Memory", 0xfffc4124, 4, base=16 +sfr = "US1_PTSR.RXTEN", "Memory", 0xfffc4124, 4, base=16, bitRange=0 +sfr = "US1_PTSR.TXTEN", "Memory", 0xfffc4124, 4, base=16, bitRange=8 +; ========== Register definition for US1 peripheral ========== +sfr = "US1_CR", "Memory", 0xfffc4000, 4, base=16 +sfr = "US1_CR.RSTRX", "Memory", 0xfffc4000, 4, base=16, bitRange=2 +sfr = "US1_CR.RSTTX", "Memory", 0xfffc4000, 4, base=16, bitRange=3 +sfr = "US1_CR.RXEN", "Memory", 0xfffc4000, 4, base=16, bitRange=4 +sfr = "US1_CR.RXDIS", "Memory", 0xfffc4000, 4, base=16, bitRange=5 +sfr = "US1_CR.TXEN", "Memory", 0xfffc4000, 4, base=16, bitRange=6 +sfr = "US1_CR.TXDIS", "Memory", 0xfffc4000, 4, base=16, bitRange=7 +sfr = "US1_CR.RSTSTA", "Memory", 0xfffc4000, 4, base=16, bitRange=8 +sfr = "US1_CR.STTBRK", "Memory", 0xfffc4000, 4, base=16, bitRange=9 +sfr = "US1_CR.STPBRK", "Memory", 0xfffc4000, 4, base=16, bitRange=10 +sfr = "US1_CR.STTTO", "Memory", 0xfffc4000, 4, base=16, bitRange=11 +sfr = "US1_CR.SENDA", "Memory", 0xfffc4000, 4, base=16, bitRange=12 +sfr = "US1_CR.RSTIT", "Memory", 0xfffc4000, 4, base=16, bitRange=13 +sfr = "US1_CR.RSTNACK", "Memory", 0xfffc4000, 4, base=16, bitRange=14 +sfr = "US1_CR.RETTO", "Memory", 0xfffc4000, 4, base=16, bitRange=15 +sfr = "US1_CR.DTREN", "Memory", 0xfffc4000, 4, base=16, bitRange=16 +sfr = "US1_CR.DTRDIS", "Memory", 0xfffc4000, 4, base=16, bitRange=17 +sfr = "US1_CR.RTSEN", "Memory", 0xfffc4000, 4, base=16, bitRange=18 +sfr = "US1_CR.RTSDIS", "Memory", 0xfffc4000, 4, base=16, bitRange=19 +sfr = "US1_MR", "Memory", 0xfffc4004, 4, base=16 +sfr = "US1_MR.USMODE", "Memory", 0xfffc4004, 4, base=16, bitRange=0-3 +sfr = "US1_MR.CLKS", "Memory", 0xfffc4004, 4, base=16, bitRange=4-5 +sfr = "US1_MR.CHRL", "Memory", 0xfffc4004, 4, base=16, bitRange=6-7 +sfr = "US1_MR.SYNC", "Memory", 0xfffc4004, 4, base=16, bitRange=8 +sfr = "US1_MR.PAR", "Memory", 0xfffc4004, 4, base=16, bitRange=9-11 +sfr = "US1_MR.NBSTOP", "Memory", 0xfffc4004, 4, base=16, bitRange=12-13 +sfr = "US1_MR.CHMODE", "Memory", 0xfffc4004, 4, base=16, bitRange=14-15 +sfr = "US1_MR.MSBF", "Memory", 0xfffc4004, 4, base=16, bitRange=16 +sfr = "US1_MR.MODE9", "Memory", 0xfffc4004, 4, base=16, bitRange=17 +sfr = "US1_MR.CKLO", "Memory", 0xfffc4004, 4, base=16, bitRange=18 +sfr = "US1_MR.OVER", "Memory", 0xfffc4004, 4, base=16, bitRange=19 +sfr = "US1_MR.INACK", "Memory", 0xfffc4004, 4, base=16, bitRange=20 +sfr = "US1_MR.DSNACK", "Memory", 0xfffc4004, 4, base=16, bitRange=21 +sfr = "US1_MR.ITER", "Memory", 0xfffc4004, 4, base=16, bitRange=24 +sfr = "US1_MR.FILTER", "Memory", 0xfffc4004, 4, base=16, bitRange=28 +sfr = "US1_IER", "Memory", 0xfffc4008, 4, base=16 +sfr = "US1_IER.RXRDY", "Memory", 0xfffc4008, 4, base=16, bitRange=0 +sfr = "US1_IER.TXRDY", "Memory", 0xfffc4008, 4, base=16, bitRange=1 +sfr = "US1_IER.RXBRK", "Memory", 0xfffc4008, 4, base=16, bitRange=2 +sfr = "US1_IER.ENDRX", "Memory", 0xfffc4008, 4, base=16, bitRange=3 +sfr = "US1_IER.ENDTX", "Memory", 0xfffc4008, 4, base=16, bitRange=4 +sfr = "US1_IER.OVRE", "Memory", 0xfffc4008, 4, base=16, bitRange=5 +sfr = "US1_IER.FRAME", "Memory", 0xfffc4008, 4, base=16, bitRange=6 +sfr = "US1_IER.PARE", "Memory", 0xfffc4008, 4, base=16, bitRange=7 +sfr = "US1_IER.TIMEOUT", "Memory", 0xfffc4008, 4, base=16, bitRange=8 +sfr = "US1_IER.TXEMPTY", "Memory", 0xfffc4008, 4, base=16, bitRange=9 +sfr = "US1_IER.ITERATION", "Memory", 0xfffc4008, 4, base=16, bitRange=10 +sfr = "US1_IER.TXBUFE", "Memory", 0xfffc4008, 4, base=16, bitRange=11 +sfr = "US1_IER.RXBUFF", "Memory", 0xfffc4008, 4, base=16, bitRange=12 +sfr = "US1_IER.NACK", "Memory", 0xfffc4008, 4, base=16, bitRange=13 +sfr = "US1_IER.RIIC", "Memory", 0xfffc4008, 4, base=16, bitRange=16 +sfr = "US1_IER.DSRIC", "Memory", 0xfffc4008, 4, base=16, bitRange=17 +sfr = "US1_IER.DCDIC", "Memory", 0xfffc4008, 4, base=16, bitRange=18 +sfr = "US1_IER.CTSIC", "Memory", 0xfffc4008, 4, base=16, bitRange=19 +sfr = "US1_IDR", "Memory", 0xfffc400c, 4, base=16 +sfr = "US1_IDR.RXRDY", "Memory", 0xfffc400c, 4, base=16, bitRange=0 +sfr = "US1_IDR.TXRDY", "Memory", 0xfffc400c, 4, base=16, bitRange=1 +sfr = "US1_IDR.RXBRK", "Memory", 0xfffc400c, 4, base=16, bitRange=2 +sfr = "US1_IDR.ENDRX", "Memory", 0xfffc400c, 4, base=16, bitRange=3 +sfr = "US1_IDR.ENDTX", "Memory", 0xfffc400c, 4, base=16, bitRange=4 +sfr = "US1_IDR.OVRE", "Memory", 0xfffc400c, 4, base=16, bitRange=5 +sfr = "US1_IDR.FRAME", "Memory", 0xfffc400c, 4, base=16, bitRange=6 +sfr = "US1_IDR.PARE", "Memory", 0xfffc400c, 4, base=16, bitRange=7 +sfr = "US1_IDR.TIMEOUT", "Memory", 0xfffc400c, 4, base=16, bitRange=8 +sfr = "US1_IDR.TXEMPTY", "Memory", 0xfffc400c, 4, base=16, bitRange=9 +sfr = "US1_IDR.ITERATION", "Memory", 0xfffc400c, 4, base=16, bitRange=10 +sfr = "US1_IDR.TXBUFE", "Memory", 0xfffc400c, 4, base=16, bitRange=11 +sfr = "US1_IDR.RXBUFF", "Memory", 0xfffc400c, 4, base=16, bitRange=12 +sfr = "US1_IDR.NACK", "Memory", 0xfffc400c, 4, base=16, bitRange=13 +sfr = "US1_IDR.RIIC", "Memory", 0xfffc400c, 4, base=16, bitRange=16 +sfr = "US1_IDR.DSRIC", "Memory", 0xfffc400c, 4, base=16, bitRange=17 +sfr = "US1_IDR.DCDIC", "Memory", 0xfffc400c, 4, base=16, bitRange=18 +sfr = "US1_IDR.CTSIC", "Memory", 0xfffc400c, 4, base=16, bitRange=19 +sfr = "US1_IMR", "Memory", 0xfffc4010, 4, base=16 +sfr = "US1_IMR.RXRDY", "Memory", 0xfffc4010, 4, base=16, bitRange=0 +sfr = "US1_IMR.TXRDY", "Memory", 0xfffc4010, 4, base=16, bitRange=1 +sfr = "US1_IMR.RXBRK", "Memory", 0xfffc4010, 4, base=16, bitRange=2 +sfr = "US1_IMR.ENDRX", "Memory", 0xfffc4010, 4, base=16, bitRange=3 +sfr = "US1_IMR.ENDTX", "Memory", 0xfffc4010, 4, base=16, bitRange=4 +sfr = "US1_IMR.OVRE", "Memory", 0xfffc4010, 4, base=16, bitRange=5 +sfr = "US1_IMR.FRAME", "Memory", 0xfffc4010, 4, base=16, bitRange=6 +sfr = "US1_IMR.PARE", "Memory", 0xfffc4010, 4, base=16, bitRange=7 +sfr = "US1_IMR.TIMEOUT", "Memory", 0xfffc4010, 4, base=16, bitRange=8 +sfr = "US1_IMR.TXEMPTY", "Memory", 0xfffc4010, 4, base=16, bitRange=9 +sfr = "US1_IMR.ITERATION", "Memory", 0xfffc4010, 4, base=16, bitRange=10 +sfr = "US1_IMR.TXBUFE", "Memory", 0xfffc4010, 4, base=16, bitRange=11 +sfr = "US1_IMR.RXBUFF", "Memory", 0xfffc4010, 4, base=16, bitRange=12 +sfr = "US1_IMR.NACK", "Memory", 0xfffc4010, 4, base=16, bitRange=13 +sfr = "US1_IMR.RIIC", "Memory", 0xfffc4010, 4, base=16, bitRange=16 +sfr = "US1_IMR.DSRIC", "Memory", 0xfffc4010, 4, base=16, bitRange=17 +sfr = "US1_IMR.DCDIC", "Memory", 0xfffc4010, 4, base=16, bitRange=18 +sfr = "US1_IMR.CTSIC", "Memory", 0xfffc4010, 4, base=16, bitRange=19 +sfr = "US1_CSR", "Memory", 0xfffc4014, 4, base=16 +sfr = "US1_CSR.RXRDY", "Memory", 0xfffc4014, 4, base=16, bitRange=0 +sfr = "US1_CSR.TXRDY", "Memory", 0xfffc4014, 4, base=16, bitRange=1 +sfr = "US1_CSR.RXBRK", "Memory", 0xfffc4014, 4, base=16, bitRange=2 +sfr = "US1_CSR.ENDRX", "Memory", 0xfffc4014, 4, base=16, bitRange=3 +sfr = "US1_CSR.ENDTX", "Memory", 0xfffc4014, 4, base=16, bitRange=4 +sfr = "US1_CSR.OVRE", "Memory", 0xfffc4014, 4, base=16, bitRange=5 +sfr = "US1_CSR.FRAME", "Memory", 0xfffc4014, 4, base=16, bitRange=6 +sfr = "US1_CSR.PARE", "Memory", 0xfffc4014, 4, base=16, bitRange=7 +sfr = "US1_CSR.TIMEOUT", "Memory", 0xfffc4014, 4, base=16, bitRange=8 +sfr = "US1_CSR.TXEMPTY", "Memory", 0xfffc4014, 4, base=16, bitRange=9 +sfr = "US1_CSR.ITERATION", "Memory", 0xfffc4014, 4, base=16, bitRange=10 +sfr = "US1_CSR.TXBUFE", "Memory", 0xfffc4014, 4, base=16, bitRange=11 +sfr = "US1_CSR.RXBUFF", "Memory", 0xfffc4014, 4, base=16, bitRange=12 +sfr = "US1_CSR.NACK", "Memory", 0xfffc4014, 4, base=16, bitRange=13 +sfr = "US1_CSR.RIIC", "Memory", 0xfffc4014, 4, base=16, bitRange=16 +sfr = "US1_CSR.DSRIC", "Memory", 0xfffc4014, 4, base=16, bitRange=17 +sfr = "US1_CSR.DCDIC", "Memory", 0xfffc4014, 4, base=16, bitRange=18 +sfr = "US1_CSR.CTSIC", "Memory", 0xfffc4014, 4, base=16, bitRange=19 +sfr = "US1_CSR.RI", "Memory", 0xfffc4014, 4, base=16, bitRange=20 +sfr = "US1_CSR.DSR", "Memory", 0xfffc4014, 4, base=16, bitRange=21 +sfr = "US1_CSR.DCD", "Memory", 0xfffc4014, 4, base=16, bitRange=22 +sfr = "US1_CSR.CTS", "Memory", 0xfffc4014, 4, base=16, bitRange=23 +sfr = "US1_RHR", "Memory", 0xfffc4018, 4, base=16 +sfr = "US1_THR", "Memory", 0xfffc401c, 4, base=16 +sfr = "US1_BRGR", "Memory", 0xfffc4020, 4, base=16 +sfr = "US1_RTOR", "Memory", 0xfffc4024, 4, base=16 +sfr = "US1_TTGR", "Memory", 0xfffc4028, 4, base=16 +sfr = "US1_FIDI", "Memory", 0xfffc4040, 4, base=16 +sfr = "US1_NER", "Memory", 0xfffc4044, 4, base=16 +sfr = "US1_IF", "Memory", 0xfffc404c, 4, base=16 +; ========== Register definition for PDC_US0 peripheral ========== +sfr = "US0_RPR", "Memory", 0xfffc0100, 4, base=16 +sfr = "US0_RCR", "Memory", 0xfffc0104, 4, base=16 +sfr = "US0_TPR", "Memory", 0xfffc0108, 4, base=16 +sfr = "US0_TCR", "Memory", 0xfffc010c, 4, base=16 +sfr = "US0_RNPR", "Memory", 0xfffc0110, 4, base=16 +sfr = "US0_RNCR", "Memory", 0xfffc0114, 4, base=16 +sfr = "US0_TNPR", "Memory", 0xfffc0118, 4, base=16 +sfr = "US0_TNCR", "Memory", 0xfffc011c, 4, base=16 +sfr = "US0_PTCR", "Memory", 0xfffc0120, 4, base=16 +sfr = "US0_PTCR.RXTEN", "Memory", 0xfffc0120, 4, base=16, bitRange=0 +sfr = "US0_PTCR.RXTDIS", "Memory", 0xfffc0120, 4, base=16, bitRange=1 +sfr = "US0_PTCR.TXTEN", "Memory", 0xfffc0120, 4, base=16, bitRange=8 +sfr = "US0_PTCR.TXTDIS", "Memory", 0xfffc0120, 4, base=16, bitRange=9 +sfr = "US0_PTSR", "Memory", 0xfffc0124, 4, base=16 +sfr = "US0_PTSR.RXTEN", "Memory", 0xfffc0124, 4, base=16, bitRange=0 +sfr = "US0_PTSR.TXTEN", "Memory", 0xfffc0124, 4, base=16, bitRange=8 +; ========== Register definition for US0 peripheral ========== +sfr = "US0_CR", "Memory", 0xfffc0000, 4, base=16 +sfr = "US0_CR.RSTRX", "Memory", 0xfffc0000, 4, base=16, bitRange=2 +sfr = "US0_CR.RSTTX", "Memory", 0xfffc0000, 4, base=16, bitRange=3 +sfr = "US0_CR.RXEN", "Memory", 0xfffc0000, 4, base=16, bitRange=4 +sfr = "US0_CR.RXDIS", "Memory", 0xfffc0000, 4, base=16, bitRange=5 +sfr = "US0_CR.TXEN", "Memory", 0xfffc0000, 4, base=16, bitRange=6 +sfr = "US0_CR.TXDIS", "Memory", 0xfffc0000, 4, base=16, bitRange=7 +sfr = "US0_CR.RSTSTA", "Memory", 0xfffc0000, 4, base=16, bitRange=8 +sfr = "US0_CR.STTBRK", "Memory", 0xfffc0000, 4, base=16, bitRange=9 +sfr = "US0_CR.STPBRK", "Memory", 0xfffc0000, 4, base=16, bitRange=10 +sfr = "US0_CR.STTTO", "Memory", 0xfffc0000, 4, base=16, bitRange=11 +sfr = "US0_CR.SENDA", "Memory", 0xfffc0000, 4, base=16, bitRange=12 +sfr = "US0_CR.RSTIT", "Memory", 0xfffc0000, 4, base=16, bitRange=13 +sfr = "US0_CR.RSTNACK", "Memory", 0xfffc0000, 4, base=16, bitRange=14 +sfr = "US0_CR.RETTO", "Memory", 0xfffc0000, 4, base=16, bitRange=15 +sfr = "US0_CR.DTREN", "Memory", 0xfffc0000, 4, base=16, bitRange=16 +sfr = "US0_CR.DTRDIS", "Memory", 0xfffc0000, 4, base=16, bitRange=17 +sfr = "US0_CR.RTSEN", "Memory", 0xfffc0000, 4, base=16, bitRange=18 +sfr = "US0_CR.RTSDIS", "Memory", 0xfffc0000, 4, base=16, bitRange=19 +sfr = "US0_MR", "Memory", 0xfffc0004, 4, base=16 +sfr = "US0_MR.USMODE", "Memory", 0xfffc0004, 4, base=16, bitRange=0-3 +sfr = "US0_MR.CLKS", "Memory", 0xfffc0004, 4, base=16, bitRange=4-5 +sfr = "US0_MR.CHRL", "Memory", 0xfffc0004, 4, base=16, bitRange=6-7 +sfr = "US0_MR.SYNC", "Memory", 0xfffc0004, 4, base=16, bitRange=8 +sfr = "US0_MR.PAR", "Memory", 0xfffc0004, 4, base=16, bitRange=9-11 +sfr = "US0_MR.NBSTOP", "Memory", 0xfffc0004, 4, base=16, bitRange=12-13 +sfr = "US0_MR.CHMODE", "Memory", 0xfffc0004, 4, base=16, bitRange=14-15 +sfr = "US0_MR.MSBF", "Memory", 0xfffc0004, 4, base=16, bitRange=16 +sfr = "US0_MR.MODE9", "Memory", 0xfffc0004, 4, base=16, bitRange=17 +sfr = "US0_MR.CKLO", "Memory", 0xfffc0004, 4, base=16, bitRange=18 +sfr = "US0_MR.OVER", "Memory", 0xfffc0004, 4, base=16, bitRange=19 +sfr = "US0_MR.INACK", "Memory", 0xfffc0004, 4, base=16, bitRange=20 +sfr = "US0_MR.DSNACK", "Memory", 0xfffc0004, 4, base=16, bitRange=21 +sfr = "US0_MR.ITER", "Memory", 0xfffc0004, 4, base=16, bitRange=24 +sfr = "US0_MR.FILTER", "Memory", 0xfffc0004, 4, base=16, bitRange=28 +sfr = "US0_IER", "Memory", 0xfffc0008, 4, base=16 +sfr = "US0_IER.RXRDY", "Memory", 0xfffc0008, 4, base=16, bitRange=0 +sfr = "US0_IER.TXRDY", "Memory", 0xfffc0008, 4, base=16, bitRange=1 +sfr = "US0_IER.RXBRK", "Memory", 0xfffc0008, 4, base=16, bitRange=2 +sfr = "US0_IER.ENDRX", "Memory", 0xfffc0008, 4, base=16, bitRange=3 +sfr = "US0_IER.ENDTX", "Memory", 0xfffc0008, 4, base=16, bitRange=4 +sfr = "US0_IER.OVRE", "Memory", 0xfffc0008, 4, base=16, bitRange=5 +sfr = "US0_IER.FRAME", "Memory", 0xfffc0008, 4, base=16, bitRange=6 +sfr = "US0_IER.PARE", "Memory", 0xfffc0008, 4, base=16, bitRange=7 +sfr = "US0_IER.TIMEOUT", "Memory", 0xfffc0008, 4, base=16, bitRange=8 +sfr = "US0_IER.TXEMPTY", "Memory", 0xfffc0008, 4, base=16, bitRange=9 +sfr = "US0_IER.ITERATION", "Memory", 0xfffc0008, 4, base=16, bitRange=10 +sfr = "US0_IER.TXBUFE", "Memory", 0xfffc0008, 4, base=16, bitRange=11 +sfr = "US0_IER.RXBUFF", "Memory", 0xfffc0008, 4, base=16, bitRange=12 +sfr = "US0_IER.NACK", "Memory", 0xfffc0008, 4, base=16, bitRange=13 +sfr = "US0_IER.RIIC", "Memory", 0xfffc0008, 4, base=16, bitRange=16 +sfr = "US0_IER.DSRIC", "Memory", 0xfffc0008, 4, base=16, bitRange=17 +sfr = "US0_IER.DCDIC", "Memory", 0xfffc0008, 4, base=16, bitRange=18 +sfr = "US0_IER.CTSIC", "Memory", 0xfffc0008, 4, base=16, bitRange=19 +sfr = "US0_IDR", "Memory", 0xfffc000c, 4, base=16 +sfr = "US0_IDR.RXRDY", "Memory", 0xfffc000c, 4, base=16, bitRange=0 +sfr = "US0_IDR.TXRDY", "Memory", 0xfffc000c, 4, base=16, bitRange=1 +sfr = "US0_IDR.RXBRK", "Memory", 0xfffc000c, 4, base=16, bitRange=2 +sfr = "US0_IDR.ENDRX", "Memory", 0xfffc000c, 4, base=16, bitRange=3 +sfr = "US0_IDR.ENDTX", "Memory", 0xfffc000c, 4, base=16, bitRange=4 +sfr = "US0_IDR.OVRE", "Memory", 0xfffc000c, 4, base=16, bitRange=5 +sfr = "US0_IDR.FRAME", "Memory", 0xfffc000c, 4, base=16, bitRange=6 +sfr = "US0_IDR.PARE", "Memory", 0xfffc000c, 4, base=16, bitRange=7 +sfr = "US0_IDR.TIMEOUT", "Memory", 0xfffc000c, 4, base=16, bitRange=8 +sfr = "US0_IDR.TXEMPTY", "Memory", 0xfffc000c, 4, base=16, bitRange=9 +sfr = "US0_IDR.ITERATION", "Memory", 0xfffc000c, 4, base=16, bitRange=10 +sfr = "US0_IDR.TXBUFE", "Memory", 0xfffc000c, 4, base=16, bitRange=11 +sfr = "US0_IDR.RXBUFF", "Memory", 0xfffc000c, 4, base=16, bitRange=12 +sfr = "US0_IDR.NACK", "Memory", 0xfffc000c, 4, base=16, bitRange=13 +sfr = "US0_IDR.RIIC", "Memory", 0xfffc000c, 4, base=16, bitRange=16 +sfr = "US0_IDR.DSRIC", "Memory", 0xfffc000c, 4, base=16, bitRange=17 +sfr = "US0_IDR.DCDIC", "Memory", 0xfffc000c, 4, base=16, bitRange=18 +sfr = "US0_IDR.CTSIC", "Memory", 0xfffc000c, 4, base=16, bitRange=19 +sfr = "US0_IMR", "Memory", 0xfffc0010, 4, base=16 +sfr = "US0_IMR.RXRDY", "Memory", 0xfffc0010, 4, base=16, bitRange=0 +sfr = "US0_IMR.TXRDY", "Memory", 0xfffc0010, 4, base=16, bitRange=1 +sfr = "US0_IMR.RXBRK", "Memory", 0xfffc0010, 4, base=16, bitRange=2 +sfr = "US0_IMR.ENDRX", "Memory", 0xfffc0010, 4, base=16, bitRange=3 +sfr = "US0_IMR.ENDTX", "Memory", 0xfffc0010, 4, base=16, bitRange=4 +sfr = "US0_IMR.OVRE", "Memory", 0xfffc0010, 4, base=16, bitRange=5 +sfr = "US0_IMR.FRAME", "Memory", 0xfffc0010, 4, base=16, bitRange=6 +sfr = "US0_IMR.PARE", "Memory", 0xfffc0010, 4, base=16, bitRange=7 +sfr = "US0_IMR.TIMEOUT", "Memory", 0xfffc0010, 4, base=16, bitRange=8 +sfr = "US0_IMR.TXEMPTY", "Memory", 0xfffc0010, 4, base=16, bitRange=9 +sfr = "US0_IMR.ITERATION", "Memory", 0xfffc0010, 4, base=16, bitRange=10 +sfr = "US0_IMR.TXBUFE", "Memory", 0xfffc0010, 4, base=16, bitRange=11 +sfr = "US0_IMR.RXBUFF", "Memory", 0xfffc0010, 4, base=16, bitRange=12 +sfr = "US0_IMR.NACK", "Memory", 0xfffc0010, 4, base=16, bitRange=13 +sfr = "US0_IMR.RIIC", "Memory", 0xfffc0010, 4, base=16, bitRange=16 +sfr = "US0_IMR.DSRIC", "Memory", 0xfffc0010, 4, base=16, bitRange=17 +sfr = "US0_IMR.DCDIC", "Memory", 0xfffc0010, 4, base=16, bitRange=18 +sfr = "US0_IMR.CTSIC", "Memory", 0xfffc0010, 4, base=16, bitRange=19 +sfr = "US0_CSR", "Memory", 0xfffc0014, 4, base=16 +sfr = "US0_CSR.RXRDY", "Memory", 0xfffc0014, 4, base=16, bitRange=0 +sfr = "US0_CSR.TXRDY", "Memory", 0xfffc0014, 4, base=16, bitRange=1 +sfr = "US0_CSR.RXBRK", "Memory", 0xfffc0014, 4, base=16, bitRange=2 +sfr = "US0_CSR.ENDRX", "Memory", 0xfffc0014, 4, base=16, bitRange=3 +sfr = "US0_CSR.ENDTX", "Memory", 0xfffc0014, 4, base=16, bitRange=4 +sfr = "US0_CSR.OVRE", "Memory", 0xfffc0014, 4, base=16, bitRange=5 +sfr = "US0_CSR.FRAME", "Memory", 0xfffc0014, 4, base=16, bitRange=6 +sfr = "US0_CSR.PARE", "Memory", 0xfffc0014, 4, base=16, bitRange=7 +sfr = "US0_CSR.TIMEOUT", "Memory", 0xfffc0014, 4, base=16, bitRange=8 +sfr = "US0_CSR.TXEMPTY", "Memory", 0xfffc0014, 4, base=16, bitRange=9 +sfr = "US0_CSR.ITERATION", "Memory", 0xfffc0014, 4, base=16, bitRange=10 +sfr = "US0_CSR.TXBUFE", "Memory", 0xfffc0014, 4, base=16, bitRange=11 +sfr = "US0_CSR.RXBUFF", "Memory", 0xfffc0014, 4, base=16, bitRange=12 +sfr = "US0_CSR.NACK", "Memory", 0xfffc0014, 4, base=16, bitRange=13 +sfr = "US0_CSR.RIIC", "Memory", 0xfffc0014, 4, base=16, bitRange=16 +sfr = "US0_CSR.DSRIC", "Memory", 0xfffc0014, 4, base=16, bitRange=17 +sfr = "US0_CSR.DCDIC", "Memory", 0xfffc0014, 4, base=16, bitRange=18 +sfr = "US0_CSR.CTSIC", "Memory", 0xfffc0014, 4, base=16, bitRange=19 +sfr = "US0_CSR.RI", "Memory", 0xfffc0014, 4, base=16, bitRange=20 +sfr = "US0_CSR.DSR", "Memory", 0xfffc0014, 4, base=16, bitRange=21 +sfr = "US0_CSR.DCD", "Memory", 0xfffc0014, 4, base=16, bitRange=22 +sfr = "US0_CSR.CTS", "Memory", 0xfffc0014, 4, base=16, bitRange=23 +sfr = "US0_RHR", "Memory", 0xfffc0018, 4, base=16 +sfr = "US0_THR", "Memory", 0xfffc001c, 4, base=16 +sfr = "US0_BRGR", "Memory", 0xfffc0020, 4, base=16 +sfr = "US0_RTOR", "Memory", 0xfffc0024, 4, base=16 +sfr = "US0_TTGR", "Memory", 0xfffc0028, 4, base=16 +sfr = "US0_FIDI", "Memory", 0xfffc0040, 4, base=16 +sfr = "US0_NER", "Memory", 0xfffc0044, 4, base=16 +sfr = "US0_IF", "Memory", 0xfffc004c, 4, base=16 +; ========== Register definition for PDC_SSC peripheral ========== +sfr = "SSC_RPR", "Memory", 0xfffd4100, 4, base=16 +sfr = "SSC_RCR", "Memory", 0xfffd4104, 4, base=16 +sfr = "SSC_TPR", "Memory", 0xfffd4108, 4, base=16 +sfr = "SSC_TCR", "Memory", 0xfffd410c, 4, base=16 +sfr = "SSC_RNPR", "Memory", 0xfffd4110, 4, base=16 +sfr = "SSC_RNCR", "Memory", 0xfffd4114, 4, base=16 +sfr = "SSC_TNPR", "Memory", 0xfffd4118, 4, base=16 +sfr = "SSC_TNCR", "Memory", 0xfffd411c, 4, base=16 +sfr = "SSC_PTCR", "Memory", 0xfffd4120, 4, base=16 +sfr = "SSC_PTCR.RXTEN", "Memory", 0xfffd4120, 4, base=16, bitRange=0 +sfr = "SSC_PTCR.RXTDIS", "Memory", 0xfffd4120, 4, base=16, bitRange=1 +sfr = "SSC_PTCR.TXTEN", "Memory", 0xfffd4120, 4, base=16, bitRange=8 +sfr = "SSC_PTCR.TXTDIS", "Memory", 0xfffd4120, 4, base=16, bitRange=9 +sfr = "SSC_PTSR", "Memory", 0xfffd4124, 4, base=16 +sfr = "SSC_PTSR.RXTEN", "Memory", 0xfffd4124, 4, base=16, bitRange=0 +sfr = "SSC_PTSR.TXTEN", "Memory", 0xfffd4124, 4, base=16, bitRange=8 +; ========== Register definition for SSC peripheral ========== +sfr = "SSC_CR", "Memory", 0xfffd4000, 4, base=16 +sfr = "SSC_CR.RXEN", "Memory", 0xfffd4000, 4, base=16, bitRange=0 +sfr = "SSC_CR.RXDIS", "Memory", 0xfffd4000, 4, base=16, bitRange=1 +sfr = "SSC_CR.TXEN", "Memory", 0xfffd4000, 4, base=16, bitRange=8 +sfr = "SSC_CR.TXDIS", "Memory", 0xfffd4000, 4, base=16, bitRange=9 +sfr = "SSC_CR.SWRST", "Memory", 0xfffd4000, 4, base=16, bitRange=15 +sfr = "SSC_CMR", "Memory", 0xfffd4004, 4, base=16 +sfr = "SSC_RCMR", "Memory", 0xfffd4010, 4, base=16 +sfr = "SSC_RCMR.CKS", "Memory", 0xfffd4010, 4, base=16, bitRange=0-1 +sfr = "SSC_RCMR.CKO", "Memory", 0xfffd4010, 4, base=16, bitRange=2-4 +sfr = "SSC_RCMR.CKI", "Memory", 0xfffd4010, 4, base=16, bitRange=5 +sfr = "SSC_RCMR.CKG", "Memory", 0xfffd4010, 4, base=16, bitRange=6-7 +sfr = "SSC_RCMR.START", "Memory", 0xfffd4010, 4, base=16, bitRange=8-11 +sfr = "SSC_RCMR.STOP", "Memory", 0xfffd4010, 4, base=16, bitRange=12 +sfr = "SSC_RCMR.STTDLY", "Memory", 0xfffd4010, 4, base=16, bitRange=16-23 +sfr = "SSC_RCMR.PERIOD", "Memory", 0xfffd4010, 4, base=16, bitRange=24-31 +sfr = "SSC_RFMR", "Memory", 0xfffd4014, 4, base=16 +sfr = "SSC_RFMR.DATLEN", "Memory", 0xfffd4014, 4, base=16, bitRange=0-4 +sfr = "SSC_RFMR.LOOP", "Memory", 0xfffd4014, 4, base=16, bitRange=5 +sfr = "SSC_RFMR.MSBF", "Memory", 0xfffd4014, 4, base=16, bitRange=7 +sfr = "SSC_RFMR.DATNB", "Memory", 0xfffd4014, 4, base=16, bitRange=8-11 +sfr = "SSC_RFMR.FSLEN", "Memory", 0xfffd4014, 4, base=16, bitRange=16-19 +sfr = "SSC_RFMR.FSOS", "Memory", 0xfffd4014, 4, base=16, bitRange=20-22 +sfr = "SSC_RFMR.FSEDGE", "Memory", 0xfffd4014, 4, base=16, bitRange=24 +sfr = "SSC_TCMR", "Memory", 0xfffd4018, 4, base=16 +sfr = "SSC_TCMR.CKS", "Memory", 0xfffd4018, 4, base=16, bitRange=0-1 +sfr = "SSC_TCMR.CKO", "Memory", 0xfffd4018, 4, base=16, bitRange=2-4 +sfr = "SSC_TCMR.CKI", "Memory", 0xfffd4018, 4, base=16, bitRange=5 +sfr = "SSC_TCMR.CKG", "Memory", 0xfffd4018, 4, base=16, bitRange=6-7 +sfr = "SSC_TCMR.START", "Memory", 0xfffd4018, 4, base=16, bitRange=8-11 +sfr = "SSC_TCMR.STTDLY", "Memory", 0xfffd4018, 4, base=16, bitRange=16-23 +sfr = "SSC_TCMR.PERIOD", "Memory", 0xfffd4018, 4, base=16, bitRange=24-31 +sfr = "SSC_TFMR", "Memory", 0xfffd401c, 4, base=16 +sfr = "SSC_TFMR.DATLEN", "Memory", 0xfffd401c, 4, base=16, bitRange=0-4 +sfr = "SSC_TFMR.DATDEF", "Memory", 0xfffd401c, 4, base=16, bitRange=5 +sfr = "SSC_TFMR.MSBF", "Memory", 0xfffd401c, 4, base=16, bitRange=7 +sfr = "SSC_TFMR.DATNB", "Memory", 0xfffd401c, 4, base=16, bitRange=8-11 +sfr = "SSC_TFMR.FSLEN", "Memory", 0xfffd401c, 4, base=16, bitRange=16-19 +sfr = "SSC_TFMR.FSOS", "Memory", 0xfffd401c, 4, base=16, bitRange=20-22 +sfr = "SSC_TFMR.FSDEN", "Memory", 0xfffd401c, 4, base=16, bitRange=23 +sfr = "SSC_TFMR.FSEDGE", "Memory", 0xfffd401c, 4, base=16, bitRange=24 +sfr = "SSC_RHR", "Memory", 0xfffd4020, 4, base=16 +sfr = "SSC_THR", "Memory", 0xfffd4024, 4, base=16 +sfr = "SSC_RSHR", "Memory", 0xfffd4030, 4, base=16 +sfr = "SSC_TSHR", "Memory", 0xfffd4034, 4, base=16 +sfr = "SSC_SR", "Memory", 0xfffd4040, 4, base=16 +sfr = "SSC_SR.TXRDY", "Memory", 0xfffd4040, 4, base=16, bitRange=0 +sfr = "SSC_SR.TXEMPTY", "Memory", 0xfffd4040, 4, base=16, bitRange=1 +sfr = "SSC_SR.ENDTX", "Memory", 0xfffd4040, 4, base=16, bitRange=2 +sfr = "SSC_SR.TXBUFE", "Memory", 0xfffd4040, 4, base=16, bitRange=3 +sfr = "SSC_SR.RXRDY", "Memory", 0xfffd4040, 4, base=16, bitRange=4 +sfr = "SSC_SR.OVRUN", "Memory", 0xfffd4040, 4, base=16, bitRange=5 +sfr = "SSC_SR.ENDRX", "Memory", 0xfffd4040, 4, base=16, bitRange=6 +sfr = "SSC_SR.RXBUFF", "Memory", 0xfffd4040, 4, base=16, bitRange=7 +sfr = "SSC_SR.CP0", "Memory", 0xfffd4040, 4, base=16, bitRange=8 +sfr = "SSC_SR.CP1", "Memory", 0xfffd4040, 4, base=16, bitRange=9 +sfr = "SSC_SR.TXSYN", "Memory", 0xfffd4040, 4, base=16, bitRange=10 +sfr = "SSC_SR.RXSYN", "Memory", 0xfffd4040, 4, base=16, bitRange=11 +sfr = "SSC_SR.TXENA", "Memory", 0xfffd4040, 4, base=16, bitRange=16 +sfr = "SSC_SR.RXENA", "Memory", 0xfffd4040, 4, base=16, bitRange=17 +sfr = "SSC_IER", "Memory", 0xfffd4044, 4, base=16 +sfr = "SSC_IER.TXRDY", "Memory", 0xfffd4044, 4, base=16, bitRange=0 +sfr = "SSC_IER.TXEMPTY", "Memory", 0xfffd4044, 4, base=16, bitRange=1 +sfr = "SSC_IER.ENDTX", "Memory", 0xfffd4044, 4, base=16, bitRange=2 +sfr = "SSC_IER.TXBUFE", "Memory", 0xfffd4044, 4, base=16, bitRange=3 +sfr = "SSC_IER.RXRDY", "Memory", 0xfffd4044, 4, base=16, bitRange=4 +sfr = "SSC_IER.OVRUN", "Memory", 0xfffd4044, 4, base=16, bitRange=5 +sfr = "SSC_IER.ENDRX", "Memory", 0xfffd4044, 4, base=16, bitRange=6 +sfr = "SSC_IER.RXBUFF", "Memory", 0xfffd4044, 4, base=16, bitRange=7 +sfr = "SSC_IER.CP0", "Memory", 0xfffd4044, 4, base=16, bitRange=8 +sfr = "SSC_IER.CP1", "Memory", 0xfffd4044, 4, base=16, bitRange=9 +sfr = "SSC_IER.TXSYN", "Memory", 0xfffd4044, 4, base=16, bitRange=10 +sfr = "SSC_IER.RXSYN", "Memory", 0xfffd4044, 4, base=16, bitRange=11 +sfr = "SSC_IDR", "Memory", 0xfffd4048, 4, base=16 +sfr = "SSC_IDR.TXRDY", "Memory", 0xfffd4048, 4, base=16, bitRange=0 +sfr = "SSC_IDR.TXEMPTY", "Memory", 0xfffd4048, 4, base=16, bitRange=1 +sfr = "SSC_IDR.ENDTX", "Memory", 0xfffd4048, 4, base=16, bitRange=2 +sfr = "SSC_IDR.TXBUFE", "Memory", 0xfffd4048, 4, base=16, bitRange=3 +sfr = "SSC_IDR.RXRDY", "Memory", 0xfffd4048, 4, base=16, bitRange=4 +sfr = "SSC_IDR.OVRUN", "Memory", 0xfffd4048, 4, base=16, bitRange=5 +sfr = "SSC_IDR.ENDRX", "Memory", 0xfffd4048, 4, base=16, bitRange=6 +sfr = "SSC_IDR.RXBUFF", "Memory", 0xfffd4048, 4, base=16, bitRange=7 +sfr = "SSC_IDR.CP0", "Memory", 0xfffd4048, 4, base=16, bitRange=8 +sfr = "SSC_IDR.CP1", "Memory", 0xfffd4048, 4, base=16, bitRange=9 +sfr = "SSC_IDR.TXSYN", "Memory", 0xfffd4048, 4, base=16, bitRange=10 +sfr = "SSC_IDR.RXSYN", "Memory", 0xfffd4048, 4, base=16, bitRange=11 +sfr = "SSC_IMR", "Memory", 0xfffd404c, 4, base=16 +sfr = "SSC_IMR.TXRDY", "Memory", 0xfffd404c, 4, base=16, bitRange=0 +sfr = "SSC_IMR.TXEMPTY", "Memory", 0xfffd404c, 4, base=16, bitRange=1 +sfr = "SSC_IMR.ENDTX", "Memory", 0xfffd404c, 4, base=16, bitRange=2 +sfr = "SSC_IMR.TXBUFE", "Memory", 0xfffd404c, 4, base=16, bitRange=3 +sfr = "SSC_IMR.RXRDY", "Memory", 0xfffd404c, 4, base=16, bitRange=4 +sfr = "SSC_IMR.OVRUN", "Memory", 0xfffd404c, 4, base=16, bitRange=5 +sfr = "SSC_IMR.ENDRX", "Memory", 0xfffd404c, 4, base=16, bitRange=6 +sfr = "SSC_IMR.RXBUFF", "Memory", 0xfffd404c, 4, base=16, bitRange=7 +sfr = "SSC_IMR.CP0", "Memory", 0xfffd404c, 4, base=16, bitRange=8 +sfr = "SSC_IMR.CP1", "Memory", 0xfffd404c, 4, base=16, bitRange=9 +sfr = "SSC_IMR.TXSYN", "Memory", 0xfffd404c, 4, base=16, bitRange=10 +sfr = "SSC_IMR.RXSYN", "Memory", 0xfffd404c, 4, base=16, bitRange=11 +; ========== Register definition for TWI peripheral ========== +sfr = "TWI_CR", "Memory", 0xfffb8000, 4, base=16 +sfr = "TWI_CR.START", "Memory", 0xfffb8000, 4, base=16, bitRange=0 +sfr = "TWI_CR.STOP", "Memory", 0xfffb8000, 4, base=16, bitRange=1 +sfr = "TWI_CR.MSEN", "Memory", 0xfffb8000, 4, base=16, bitRange=2 +sfr = "TWI_CR.MSDIS", "Memory", 0xfffb8000, 4, base=16, bitRange=3 +sfr = "TWI_CR.SWRST", "Memory", 0xfffb8000, 4, base=16, bitRange=7 +sfr = "TWI_MMR", "Memory", 0xfffb8004, 4, base=16 +sfr = "TWI_MMR.IADRSZ", "Memory", 0xfffb8004, 4, base=16, bitRange=8-9 +sfr = "TWI_MMR.MREAD", "Memory", 0xfffb8004, 4, base=16, bitRange=12 +sfr = "TWI_MMR.DADR", "Memory", 0xfffb8004, 4, base=16, bitRange=16-22 +sfr = "TWI_IADR", "Memory", 0xfffb800c, 4, base=16 +sfr = "TWI_CWGR", "Memory", 0xfffb8010, 4, base=16 +sfr = "TWI_CWGR.CLDIV", "Memory", 0xfffb8010, 4, base=16, bitRange=0-7 +sfr = "TWI_CWGR.CHDIV", "Memory", 0xfffb8010, 4, base=16, bitRange=8-15 +sfr = "TWI_CWGR.CKDIV", "Memory", 0xfffb8010, 4, base=16, bitRange=16-18 +sfr = "TWI_SR", "Memory", 0xfffb8020, 4, base=16 +sfr = "TWI_SR.TXCOMP", "Memory", 0xfffb8020, 4, base=16, bitRange=0 +sfr = "TWI_SR.RXRDY", "Memory", 0xfffb8020, 4, base=16, bitRange=1 +sfr = "TWI_SR.TXRDY", "Memory", 0xfffb8020, 4, base=16, bitRange=2 +sfr = "TWI_SR.OVRE", "Memory", 0xfffb8020, 4, base=16, bitRange=6 +sfr = "TWI_SR.UNRE", "Memory", 0xfffb8020, 4, base=16, bitRange=7 +sfr = "TWI_SR.NACK", "Memory", 0xfffb8020, 4, base=16, bitRange=8 +sfr = "TWI_IER", "Memory", 0xfffb8024, 4, base=16 +sfr = "TWI_IER.TXCOMP", "Memory", 0xfffb8024, 4, base=16, bitRange=0 +sfr = "TWI_IER.RXRDY", "Memory", 0xfffb8024, 4, base=16, bitRange=1 +sfr = "TWI_IER.TXRDY", "Memory", 0xfffb8024, 4, base=16, bitRange=2 +sfr = "TWI_IER.OVRE", "Memory", 0xfffb8024, 4, base=16, bitRange=6 +sfr = "TWI_IER.UNRE", "Memory", 0xfffb8024, 4, base=16, bitRange=7 +sfr = "TWI_IER.NACK", "Memory", 0xfffb8024, 4, base=16, bitRange=8 +sfr = "TWI_IDR", "Memory", 0xfffb8028, 4, base=16 +sfr = "TWI_IDR.TXCOMP", "Memory", 0xfffb8028, 4, base=16, bitRange=0 +sfr = "TWI_IDR.RXRDY", "Memory", 0xfffb8028, 4, base=16, bitRange=1 +sfr = "TWI_IDR.TXRDY", "Memory", 0xfffb8028, 4, base=16, bitRange=2 +sfr = "TWI_IDR.OVRE", "Memory", 0xfffb8028, 4, base=16, bitRange=6 +sfr = "TWI_IDR.UNRE", "Memory", 0xfffb8028, 4, base=16, bitRange=7 +sfr = "TWI_IDR.NACK", "Memory", 0xfffb8028, 4, base=16, bitRange=8 +sfr = "TWI_IMR", "Memory", 0xfffb802c, 4, base=16 +sfr = "TWI_IMR.TXCOMP", "Memory", 0xfffb802c, 4, base=16, bitRange=0 +sfr = "TWI_IMR.RXRDY", "Memory", 0xfffb802c, 4, base=16, bitRange=1 +sfr = "TWI_IMR.TXRDY", "Memory", 0xfffb802c, 4, base=16, bitRange=2 +sfr = "TWI_IMR.OVRE", "Memory", 0xfffb802c, 4, base=16, bitRange=6 +sfr = "TWI_IMR.UNRE", "Memory", 0xfffb802c, 4, base=16, bitRange=7 +sfr = "TWI_IMR.NACK", "Memory", 0xfffb802c, 4, base=16, bitRange=8 +sfr = "TWI_RHR", "Memory", 0xfffb8030, 4, base=16 +sfr = "TWI_THR", "Memory", 0xfffb8034, 4, base=16 +; ========== Register definition for PWMC_CH3 peripheral ========== +sfr = "PWMC_CH3_CMR", "Memory", 0xfffcc260, 4, base=16 +sfr = "PWMC_CH3_CMR.CPRE", "Memory", 0xfffcc260, 4, base=16, bitRange=0-3 +sfr = "PWMC_CH3_CMR.CALG", "Memory", 0xfffcc260, 4, base=16, bitRange=8 +sfr = "PWMC_CH3_CMR.CPOL", "Memory", 0xfffcc260, 4, base=16, bitRange=9 +sfr = "PWMC_CH3_CMR.CPD", "Memory", 0xfffcc260, 4, base=16, bitRange=10 +sfr = "PWMC_CH3_CDTYR", "Memory", 0xfffcc264, 4, base=16 +sfr = "PWMC_CH3_CDTYR.CDTY", "Memory", 0xfffcc264, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH3_CPRDR", "Memory", 0xfffcc268, 4, base=16 +sfr = "PWMC_CH3_CPRDR.CPRD", "Memory", 0xfffcc268, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH3_CCNTR", "Memory", 0xfffcc26c, 4, base=16 +sfr = "PWMC_CH3_CCNTR.CCNT", "Memory", 0xfffcc26c, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH3_CUPDR", "Memory", 0xfffcc270, 4, base=16 +sfr = "PWMC_CH3_CUPDR.CUPD", "Memory", 0xfffcc270, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH3_Reserved", "Memory", 0xfffcc274, 4, base=16 +; ========== Register definition for PWMC_CH2 peripheral ========== +sfr = "PWMC_CH2_CMR", "Memory", 0xfffcc240, 4, base=16 +sfr = "PWMC_CH2_CMR.CPRE", "Memory", 0xfffcc240, 4, base=16, bitRange=0-3 +sfr = "PWMC_CH2_CMR.CALG", "Memory", 0xfffcc240, 4, base=16, bitRange=8 +sfr = "PWMC_CH2_CMR.CPOL", "Memory", 0xfffcc240, 4, base=16, bitRange=9 +sfr = "PWMC_CH2_CMR.CPD", "Memory", 0xfffcc240, 4, base=16, bitRange=10 +sfr = "PWMC_CH2_CDTYR", "Memory", 0xfffcc244, 4, base=16 +sfr = "PWMC_CH2_CDTYR.CDTY", "Memory", 0xfffcc244, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH2_CPRDR", "Memory", 0xfffcc248, 4, base=16 +sfr = "PWMC_CH2_CPRDR.CPRD", "Memory", 0xfffcc248, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH2_CCNTR", "Memory", 0xfffcc24c, 4, base=16 +sfr = "PWMC_CH2_CCNTR.CCNT", "Memory", 0xfffcc24c, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH2_CUPDR", "Memory", 0xfffcc250, 4, base=16 +sfr = "PWMC_CH2_CUPDR.CUPD", "Memory", 0xfffcc250, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH2_Reserved", "Memory", 0xfffcc254, 4, base=16 +; ========== Register definition for PWMC_CH1 peripheral ========== +sfr = "PWMC_CH1_CMR", "Memory", 0xfffcc220, 4, base=16 +sfr = "PWMC_CH1_CMR.CPRE", "Memory", 0xfffcc220, 4, base=16, bitRange=0-3 +sfr = "PWMC_CH1_CMR.CALG", "Memory", 0xfffcc220, 4, base=16, bitRange=8 +sfr = "PWMC_CH1_CMR.CPOL", "Memory", 0xfffcc220, 4, base=16, bitRange=9 +sfr = "PWMC_CH1_CMR.CPD", "Memory", 0xfffcc220, 4, base=16, bitRange=10 +sfr = "PWMC_CH1_CDTYR", "Memory", 0xfffcc224, 4, base=16 +sfr = "PWMC_CH1_CDTYR.CDTY", "Memory", 0xfffcc224, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH1_CPRDR", "Memory", 0xfffcc228, 4, base=16 +sfr = "PWMC_CH1_CPRDR.CPRD", "Memory", 0xfffcc228, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH1_CCNTR", "Memory", 0xfffcc22c, 4, base=16 +sfr = "PWMC_CH1_CCNTR.CCNT", "Memory", 0xfffcc22c, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH1_CUPDR", "Memory", 0xfffcc230, 4, base=16 +sfr = "PWMC_CH1_CUPDR.CUPD", "Memory", 0xfffcc230, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH1_Reserved", "Memory", 0xfffcc234, 4, base=16 +; ========== Register definition for PWMC_CH0 peripheral ========== +sfr = "PWMC_CH0_CMR", "Memory", 0xfffcc200, 4, base=16 +sfr = "PWMC_CH0_CMR.CPRE", "Memory", 0xfffcc200, 4, base=16, bitRange=0-3 +sfr = "PWMC_CH0_CMR.CALG", "Memory", 0xfffcc200, 4, base=16, bitRange=8 +sfr = "PWMC_CH0_CMR.CPOL", "Memory", 0xfffcc200, 4, base=16, bitRange=9 +sfr = "PWMC_CH0_CMR.CPD", "Memory", 0xfffcc200, 4, base=16, bitRange=10 +sfr = "PWMC_CH0_CDTYR", "Memory", 0xfffcc204, 4, base=16 +sfr = "PWMC_CH0_CDTYR.CDTY", "Memory", 0xfffcc204, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH0_CPRDR", "Memory", 0xfffcc208, 4, base=16 +sfr = "PWMC_CH0_CPRDR.CPRD", "Memory", 0xfffcc208, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH0_CCNTR", "Memory", 0xfffcc20c, 4, base=16 +sfr = "PWMC_CH0_CCNTR.CCNT", "Memory", 0xfffcc20c, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH0_CUPDR", "Memory", 0xfffcc210, 4, base=16 +sfr = "PWMC_CH0_CUPDR.CUPD", "Memory", 0xfffcc210, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH0_Reserved", "Memory", 0xfffcc214, 4, base=16 +; ========== Register definition for PWMC peripheral ========== +sfr = "PWMC_MR", "Memory", 0xfffcc000, 4, base=16 +sfr = "PWMC_MR.DIVA", "Memory", 0xfffcc000, 4, base=16, bitRange=0-7 +sfr = "PWMC_MR.PREA", "Memory", 0xfffcc000, 4, base=16, bitRange=8-11 +sfr = "PWMC_MR.DIVB", "Memory", 0xfffcc000, 4, base=16, bitRange=16-23 +sfr = "PWMC_MR.PREB", "Memory", 0xfffcc000, 4, base=16, bitRange=24-27 +sfr = "PWMC_ENA", "Memory", 0xfffcc004, 4, base=16 +sfr = "PWMC_ENA.CHID0", "Memory", 0xfffcc004, 4, base=16, bitRange=0 +sfr = "PWMC_ENA.CHID1", "Memory", 0xfffcc004, 4, base=16, bitRange=1 +sfr = "PWMC_ENA.CHID2", "Memory", 0xfffcc004, 4, base=16, bitRange=2 +sfr = "PWMC_ENA.CHID3", "Memory", 0xfffcc004, 4, base=16, bitRange=3 +sfr = "PWMC_DIS", "Memory", 0xfffcc008, 4, base=16 +sfr = "PWMC_DIS.CHID0", "Memory", 0xfffcc008, 4, base=16, bitRange=0 +sfr = "PWMC_DIS.CHID1", "Memory", 0xfffcc008, 4, base=16, bitRange=1 +sfr = "PWMC_DIS.CHID2", "Memory", 0xfffcc008, 4, base=16, bitRange=2 +sfr = "PWMC_DIS.CHID3", "Memory", 0xfffcc008, 4, base=16, bitRange=3 +sfr = "PWMC_SR", "Memory", 0xfffcc00c, 4, base=16 +sfr = "PWMC_SR.CHID0", "Memory", 0xfffcc00c, 4, base=16, bitRange=0 +sfr = "PWMC_SR.CHID1", "Memory", 0xfffcc00c, 4, base=16, bitRange=1 +sfr = "PWMC_SR.CHID2", "Memory", 0xfffcc00c, 4, base=16, bitRange=2 +sfr = "PWMC_SR.CHID3", "Memory", 0xfffcc00c, 4, base=16, bitRange=3 +sfr = "PWMC_IER", "Memory", 0xfffcc010, 4, base=16 +sfr = "PWMC_IER.CHID0", "Memory", 0xfffcc010, 4, base=16, bitRange=0 +sfr = "PWMC_IER.CHID1", "Memory", 0xfffcc010, 4, base=16, bitRange=1 +sfr = "PWMC_IER.CHID2", "Memory", 0xfffcc010, 4, base=16, bitRange=2 +sfr = "PWMC_IER.CHID3", "Memory", 0xfffcc010, 4, base=16, bitRange=3 +sfr = "PWMC_IDR", "Memory", 0xfffcc014, 4, base=16 +sfr = "PWMC_IDR.CHID0", "Memory", 0xfffcc014, 4, base=16, bitRange=0 +sfr = "PWMC_IDR.CHID1", "Memory", 0xfffcc014, 4, base=16, bitRange=1 +sfr = "PWMC_IDR.CHID2", "Memory", 0xfffcc014, 4, base=16, bitRange=2 +sfr = "PWMC_IDR.CHID3", "Memory", 0xfffcc014, 4, base=16, bitRange=3 +sfr = "PWMC_IMR", "Memory", 0xfffcc018, 4, base=16 +sfr = "PWMC_IMR.CHID0", "Memory", 0xfffcc018, 4, base=16, bitRange=0 +sfr = "PWMC_IMR.CHID1", "Memory", 0xfffcc018, 4, base=16, bitRange=1 +sfr = "PWMC_IMR.CHID2", "Memory", 0xfffcc018, 4, base=16, bitRange=2 +sfr = "PWMC_IMR.CHID3", "Memory", 0xfffcc018, 4, base=16, bitRange=3 +sfr = "PWMC_ISR", "Memory", 0xfffcc01c, 4, base=16 +sfr = "PWMC_ISR.CHID0", "Memory", 0xfffcc01c, 4, base=16, bitRange=0 +sfr = "PWMC_ISR.CHID1", "Memory", 0xfffcc01c, 4, base=16, bitRange=1 +sfr = "PWMC_ISR.CHID2", "Memory", 0xfffcc01c, 4, base=16, bitRange=2 +sfr = "PWMC_ISR.CHID3", "Memory", 0xfffcc01c, 4, base=16, bitRange=3 +sfr = "PWMC_VR", "Memory", 0xfffcc0fc, 4, base=16 +; ========== Register definition for UDP peripheral ========== +sfr = "UDP_NUM", "Memory", 0xfffb0000, 4, base=16 +sfr = "UDP_NUM.NUM", "Memory", 0xfffb0000, 4, base=16, bitRange=0-10 +sfr = "UDP_NUM.ERR", "Memory", 0xfffb0000, 4, base=16, bitRange=16 +sfr = "UDP_NUM.OK", "Memory", 0xfffb0000, 4, base=16, bitRange=17 +sfr = "UDP_GLBSTATE", "Memory", 0xfffb0004, 4, base=16 +sfr = "UDP_GLBSTATE.FADDEN", "Memory", 0xfffb0004, 4, base=16, bitRange=0 +sfr = "UDP_GLBSTATE.CONFG", "Memory", 0xfffb0004, 4, base=16, bitRange=1 +sfr = "UDP_GLBSTATE.ESR", "Memory", 0xfffb0004, 4, base=16, bitRange=2 +sfr = "UDP_GLBSTATE.RSMINPR", "Memory", 0xfffb0004, 4, base=16, bitRange=3 +sfr = "UDP_GLBSTATE.RMWUPE", "Memory", 0xfffb0004, 4, base=16, bitRange=4 +sfr = "UDP_FADDR", "Memory", 0xfffb0008, 4, base=16 +sfr = "UDP_FADDR.FADD", "Memory", 0xfffb0008, 4, base=16, bitRange=0-7 +sfr = "UDP_FADDR.FEN", "Memory", 0xfffb0008, 4, base=16, bitRange=8 +sfr = "UDP_IER", "Memory", 0xfffb0010, 4, base=16 +sfr = "UDP_IER.EPINT0", "Memory", 0xfffb0010, 4, base=16, bitRange=0 +sfr = "UDP_IER.EPINT1", "Memory", 0xfffb0010, 4, base=16, bitRange=1 +sfr = "UDP_IER.EPINT2", "Memory", 0xfffb0010, 4, base=16, bitRange=2 +sfr = "UDP_IER.EPINT3", "Memory", 0xfffb0010, 4, base=16, bitRange=3 +sfr = "UDP_IER.EPINT4", "Memory", 0xfffb0010, 4, base=16, bitRange=4 +sfr = "UDP_IER.EPINT5", "Memory", 0xfffb0010, 4, base=16, bitRange=5 +sfr = "UDP_IER.RXSUSP", "Memory", 0xfffb0010, 4, base=16, bitRange=8 +sfr = "UDP_IER.RXRSM", "Memory", 0xfffb0010, 4, base=16, bitRange=9 +sfr = "UDP_IER.EXTRSM", "Memory", 0xfffb0010, 4, base=16, bitRange=10 +sfr = "UDP_IER.SOFINT", "Memory", 0xfffb0010, 4, base=16, bitRange=11 +sfr = "UDP_IER.WAKEUP", "Memory", 0xfffb0010, 4, base=16, bitRange=13 +sfr = "UDP_IDR", "Memory", 0xfffb0014, 4, base=16 +sfr = "UDP_IDR.EPINT0", "Memory", 0xfffb0014, 4, base=16, bitRange=0 +sfr = "UDP_IDR.EPINT1", "Memory", 0xfffb0014, 4, base=16, bitRange=1 +sfr = "UDP_IDR.EPINT2", "Memory", 0xfffb0014, 4, base=16, bitRange=2 +sfr = "UDP_IDR.EPINT3", "Memory", 0xfffb0014, 4, base=16, bitRange=3 +sfr = "UDP_IDR.EPINT4", "Memory", 0xfffb0014, 4, base=16, bitRange=4 +sfr = "UDP_IDR.EPINT5", "Memory", 0xfffb0014, 4, base=16, bitRange=5 +sfr = "UDP_IDR.RXSUSP", "Memory", 0xfffb0014, 4, base=16, bitRange=8 +sfr = "UDP_IDR.RXRSM", "Memory", 0xfffb0014, 4, base=16, bitRange=9 +sfr = "UDP_IDR.EXTRSM", "Memory", 0xfffb0014, 4, base=16, bitRange=10 +sfr = "UDP_IDR.SOFINT", "Memory", 0xfffb0014, 4, base=16, bitRange=11 +sfr = "UDP_IDR.WAKEUP", "Memory", 0xfffb0014, 4, base=16, bitRange=13 +sfr = "UDP_IMR", "Memory", 0xfffb0018, 4, base=16 +sfr = "UDP_IMR.EPINT0", "Memory", 0xfffb0018, 4, base=16, bitRange=0 +sfr = "UDP_IMR.EPINT1", "Memory", 0xfffb0018, 4, base=16, bitRange=1 +sfr = "UDP_IMR.EPINT2", "Memory", 0xfffb0018, 4, base=16, bitRange=2 +sfr = "UDP_IMR.EPINT3", "Memory", 0xfffb0018, 4, base=16, bitRange=3 +sfr = "UDP_IMR.EPINT4", "Memory", 0xfffb0018, 4, base=16, bitRange=4 +sfr = "UDP_IMR.EPINT5", "Memory", 0xfffb0018, 4, base=16, bitRange=5 +sfr = "UDP_IMR.RXSUSP", "Memory", 0xfffb0018, 4, base=16, bitRange=8 +sfr = "UDP_IMR.RXRSM", "Memory", 0xfffb0018, 4, base=16, bitRange=9 +sfr = "UDP_IMR.EXTRSM", "Memory", 0xfffb0018, 4, base=16, bitRange=10 +sfr = "UDP_IMR.SOFINT", "Memory", 0xfffb0018, 4, base=16, bitRange=11 +sfr = "UDP_IMR.WAKEUP", "Memory", 0xfffb0018, 4, base=16, bitRange=13 +sfr = "UDP_ISR", "Memory", 0xfffb001c, 4, base=16 +sfr = "UDP_ISR.EPINT0", "Memory", 0xfffb001c, 4, base=16, bitRange=0 +sfr = "UDP_ISR.EPINT1", "Memory", 0xfffb001c, 4, base=16, bitRange=1 +sfr = "UDP_ISR.EPINT2", "Memory", 0xfffb001c, 4, base=16, bitRange=2 +sfr = "UDP_ISR.EPINT3", "Memory", 0xfffb001c, 4, base=16, bitRange=3 +sfr = "UDP_ISR.EPINT4", "Memory", 0xfffb001c, 4, base=16, bitRange=4 +sfr = "UDP_ISR.EPINT5", "Memory", 0xfffb001c, 4, base=16, bitRange=5 +sfr = "UDP_ISR.RXSUSP", "Memory", 0xfffb001c, 4, base=16, bitRange=8 +sfr = "UDP_ISR.RXRSM", "Memory", 0xfffb001c, 4, base=16, bitRange=9 +sfr = "UDP_ISR.EXTRSM", "Memory", 0xfffb001c, 4, base=16, bitRange=10 +sfr = "UDP_ISR.SOFINT", "Memory", 0xfffb001c, 4, base=16, bitRange=11 +sfr = "UDP_ISR.ENDBUSRES", "Memory", 0xfffb001c, 4, base=16, bitRange=12 +sfr = "UDP_ISR.WAKEUP", "Memory", 0xfffb001c, 4, base=16, bitRange=13 +sfr = "UDP_ICR", "Memory", 0xfffb0020, 4, base=16 +sfr = "UDP_ICR.EPINT0", "Memory", 0xfffb0020, 4, base=16, bitRange=0 +sfr = "UDP_ICR.EPINT1", "Memory", 0xfffb0020, 4, base=16, bitRange=1 +sfr = "UDP_ICR.EPINT2", "Memory", 0xfffb0020, 4, base=16, bitRange=2 +sfr = "UDP_ICR.EPINT3", "Memory", 0xfffb0020, 4, base=16, bitRange=3 +sfr = "UDP_ICR.EPINT4", "Memory", 0xfffb0020, 4, base=16, bitRange=4 +sfr = "UDP_ICR.EPINT5", "Memory", 0xfffb0020, 4, base=16, bitRange=5 +sfr = "UDP_ICR.RXSUSP", "Memory", 0xfffb0020, 4, base=16, bitRange=8 +sfr = "UDP_ICR.RXRSM", "Memory", 0xfffb0020, 4, base=16, bitRange=9 +sfr = "UDP_ICR.EXTRSM", "Memory", 0xfffb0020, 4, base=16, bitRange=10 +sfr = "UDP_ICR.SOFINT", "Memory", 0xfffb0020, 4, base=16, bitRange=11 +sfr = "UDP_ICR.WAKEUP", "Memory", 0xfffb0020, 4, base=16, bitRange=13 +sfr = "UDP_RSTEP", "Memory", 0xfffb0028, 4, base=16 +sfr = "UDP_RSTEP.EP0", "Memory", 0xfffb0028, 4, base=16, bitRange=0 +sfr = "UDP_RSTEP.EP1", "Memory", 0xfffb0028, 4, base=16, bitRange=1 +sfr = "UDP_RSTEP.EP2", "Memory", 0xfffb0028, 4, base=16, bitRange=2 +sfr = "UDP_RSTEP.EP3", "Memory", 0xfffb0028, 4, base=16, bitRange=3 +sfr = "UDP_RSTEP.EP4", "Memory", 0xfffb0028, 4, base=16, bitRange=4 +sfr = "UDP_RSTEP.EP5", "Memory", 0xfffb0028, 4, base=16, bitRange=5 +sfr = "UDP_CSR", "Memory", 0xfffb0030, 4, base=16 +sfr = "UDP_CSR.TXCOMP", "Memory", 0xfffb0030, 4, base=16, bitRange=0 +sfr = "UDP_CSR.BK0", "Memory", 0xfffb0030, 4, base=16, bitRange=1 +sfr = "UDP_CSR.RXSETUP", "Memory", 0xfffb0030, 4, base=16, bitRange=2 +sfr = "UDP_CSR.ISOERROR", "Memory", 0xfffb0030, 4, base=16, bitRange=3 +sfr = "UDP_CSR.TXPKTRDY", "Memory", 0xfffb0030, 4, base=16, bitRange=4 +sfr = "UDP_CSR.FORCESTALL", "Memory", 0xfffb0030, 4, base=16, bitRange=5 +sfr = "UDP_CSR.BK1", "Memory", 0xfffb0030, 4, base=16, bitRange=6 +sfr = "UDP_CSR.DIR", "Memory", 0xfffb0030, 4, base=16, bitRange=7 +sfr = "UDP_CSR.EPTYPE", "Memory", 0xfffb0030, 4, base=16, bitRange=8-10 +sfr = "UDP_CSR.DTGLE", "Memory", 0xfffb0030, 4, base=16, bitRange=11 +sfr = "UDP_CSR.EPEDS", "Memory", 0xfffb0030, 4, base=16, bitRange=15 +sfr = "UDP_CSR.RXBYTECNT", "Memory", 0xfffb0030, 4, base=16, bitRange=16-26 +sfr = "UDP_FDR", "Memory", 0xfffb0050, 4, base=16 +sfr = "UDP_TXVC", "Memory", 0xfffb0074, 4, base=16 +sfr = "UDP_TXVC.TXVDIS", "Memory", 0xfffb0074, 4, base=16, bitRange=8 +sfr = "UDP_TXVC.PUON", "Memory", 0xfffb0074, 4, base=16, bitRange=9 +; ========== Register definition for TC0 peripheral ========== +sfr = "TC0_CCR", "Memory", 0xfffa0000, 4, base=16 +sfr = "TC0_CCR.CLKEN", "Memory", 0xfffa0000, 4, base=16, bitRange=0 +sfr = "TC0_CCR.CLKDIS", "Memory", 0xfffa0000, 4, base=16, bitRange=1 +sfr = "TC0_CCR.SWTRG", "Memory", 0xfffa0000, 4, base=16, bitRange=2 +sfr = "TC0_CMR", "Memory", 0xfffa0004, 4, base=16 +sfr = "TC0_CMR.CLKS", "Memory", 0xfffa0004, 4, base=16, bitRange=0-2 +sfr = "TC0_CMR.CLKI", "Memory", 0xfffa0004, 4, base=16, bitRange=3 +sfr = "TC0_CMR.BURST", "Memory", 0xfffa0004, 4, base=16, bitRange=4-5 +sfr = "TC0_CMR.CPCSTOP", "Memory", 0xfffa0004, 4, base=16, bitRange=6 +sfr = "TC0_CMR.LDBSTOP", "Memory", 0xfffa0004, 4, base=16, bitRange=6 +sfr = "TC0_CMR.CPCDIS", "Memory", 0xfffa0004, 4, base=16, bitRange=7 +sfr = "TC0_CMR.LDBDIS", "Memory", 0xfffa0004, 4, base=16, bitRange=7 +sfr = "TC0_CMR.ETRGEDG", "Memory", 0xfffa0004, 4, base=16, bitRange=8-9 +sfr = "TC0_CMR.EEVTEDG", "Memory", 0xfffa0004, 4, base=16, bitRange=8-9 +sfr = "TC0_CMR.EEVT", "Memory", 0xfffa0004, 4, base=16, bitRange=10-11 +sfr = "TC0_CMR.ABETRG", "Memory", 0xfffa0004, 4, base=16, bitRange=10 +sfr = "TC0_CMR.ENETRG", "Memory", 0xfffa0004, 4, base=16, bitRange=12 +sfr = "TC0_CMR.WAVESEL", "Memory", 0xfffa0004, 4, base=16, bitRange=13-14 +sfr = "TC0_CMR.CPCTRG", "Memory", 0xfffa0004, 4, base=16, bitRange=14 +sfr = "TC0_CMR.WAVE", "Memory", 0xfffa0004, 4, base=16, bitRange=15 +sfr = "TC0_CMR.ACPA", "Memory", 0xfffa0004, 4, base=16, bitRange=16-17 +sfr = "TC0_CMR.LDRA", "Memory", 0xfffa0004, 4, base=16, bitRange=16-17 +sfr = "TC0_CMR.ACPC", "Memory", 0xfffa0004, 4, base=16, bitRange=18-19 +sfr = "TC0_CMR.LDRB", "Memory", 0xfffa0004, 4, base=16, bitRange=18-19 +sfr = "TC0_CMR.AEEVT", "Memory", 0xfffa0004, 4, base=16, bitRange=20-21 +sfr = "TC0_CMR.ASWTRG", "Memory", 0xfffa0004, 4, base=16, bitRange=22-23 +sfr = "TC0_CMR.BCPB", "Memory", 0xfffa0004, 4, base=16, bitRange=24-25 +sfr = "TC0_CMR.BCPC", "Memory", 0xfffa0004, 4, base=16, bitRange=26-27 +sfr = "TC0_CMR.BEEVT", "Memory", 0xfffa0004, 4, base=16, bitRange=28-29 +sfr = "TC0_CMR.BSWTRG", "Memory", 0xfffa0004, 4, base=16, bitRange=30-31 +sfr = "TC0_CV", "Memory", 0xfffa0010, 4, base=16 +sfr = "TC0_RA", "Memory", 0xfffa0014, 4, base=16 +sfr = "TC0_RB", "Memory", 0xfffa0018, 4, base=16 +sfr = "TC0_RC", "Memory", 0xfffa001c, 4, base=16 +sfr = "TC0_SR", "Memory", 0xfffa0020, 4, base=16 +sfr = "TC0_SR.COVFS", "Memory", 0xfffa0020, 4, base=16, bitRange=0 +sfr = "TC0_SR.LOVRS", "Memory", 0xfffa0020, 4, base=16, bitRange=1 +sfr = "TC0_SR.CPAS", "Memory", 0xfffa0020, 4, base=16, bitRange=2 +sfr = "TC0_SR.CPBS", "Memory", 0xfffa0020, 4, base=16, bitRange=3 +sfr = "TC0_SR.CPCS", "Memory", 0xfffa0020, 4, base=16, bitRange=4 +sfr = "TC0_SR.LDRAS", "Memory", 0xfffa0020, 4, base=16, bitRange=5 +sfr = "TC0_SR.LDRBS", "Memory", 0xfffa0020, 4, base=16, bitRange=6 +sfr = "TC0_SR.ETRGS", "Memory", 0xfffa0020, 4, base=16, bitRange=7 +sfr = "TC0_SR.CLKSTA", "Memory", 0xfffa0020, 4, base=16, bitRange=16 +sfr = "TC0_SR.MTIOA", "Memory", 0xfffa0020, 4, base=16, bitRange=17 +sfr = "TC0_SR.MTIOB", "Memory", 0xfffa0020, 4, base=16, bitRange=18 +sfr = "TC0_IER", "Memory", 0xfffa0024, 4, base=16 +sfr = "TC0_IER.COVFS", "Memory", 0xfffa0024, 4, base=16, bitRange=0 +sfr = "TC0_IER.LOVRS", "Memory", 0xfffa0024, 4, base=16, bitRange=1 +sfr = "TC0_IER.CPAS", "Memory", 0xfffa0024, 4, base=16, bitRange=2 +sfr = "TC0_IER.CPBS", "Memory", 0xfffa0024, 4, base=16, bitRange=3 +sfr = "TC0_IER.CPCS", "Memory", 0xfffa0024, 4, base=16, bitRange=4 +sfr = "TC0_IER.LDRAS", "Memory", 0xfffa0024, 4, base=16, bitRange=5 +sfr = "TC0_IER.LDRBS", "Memory", 0xfffa0024, 4, base=16, bitRange=6 +sfr = "TC0_IER.ETRGS", "Memory", 0xfffa0024, 4, base=16, bitRange=7 +sfr = "TC0_IDR", "Memory", 0xfffa0028, 4, base=16 +sfr = "TC0_IDR.COVFS", "Memory", 0xfffa0028, 4, base=16, bitRange=0 +sfr = "TC0_IDR.LOVRS", "Memory", 0xfffa0028, 4, base=16, bitRange=1 +sfr = "TC0_IDR.CPAS", "Memory", 0xfffa0028, 4, base=16, bitRange=2 +sfr = "TC0_IDR.CPBS", "Memory", 0xfffa0028, 4, base=16, bitRange=3 +sfr = "TC0_IDR.CPCS", "Memory", 0xfffa0028, 4, base=16, bitRange=4 +sfr = "TC0_IDR.LDRAS", "Memory", 0xfffa0028, 4, base=16, bitRange=5 +sfr = "TC0_IDR.LDRBS", "Memory", 0xfffa0028, 4, base=16, bitRange=6 +sfr = "TC0_IDR.ETRGS", "Memory", 0xfffa0028, 4, base=16, bitRange=7 +sfr = "TC0_IMR", "Memory", 0xfffa002c, 4, base=16 +sfr = "TC0_IMR.COVFS", "Memory", 0xfffa002c, 4, base=16, bitRange=0 +sfr = "TC0_IMR.LOVRS", "Memory", 0xfffa002c, 4, base=16, bitRange=1 +sfr = "TC0_IMR.CPAS", "Memory", 0xfffa002c, 4, base=16, bitRange=2 +sfr = "TC0_IMR.CPBS", "Memory", 0xfffa002c, 4, base=16, bitRange=3 +sfr = "TC0_IMR.CPCS", "Memory", 0xfffa002c, 4, base=16, bitRange=4 +sfr = "TC0_IMR.LDRAS", "Memory", 0xfffa002c, 4, base=16, bitRange=5 +sfr = "TC0_IMR.LDRBS", "Memory", 0xfffa002c, 4, base=16, bitRange=6 +sfr = "TC0_IMR.ETRGS", "Memory", 0xfffa002c, 4, base=16, bitRange=7 +; ========== Register definition for TC1 peripheral ========== +sfr = "TC1_CCR", "Memory", 0xfffa0040, 4, base=16 +sfr = "TC1_CCR.CLKEN", "Memory", 0xfffa0040, 4, base=16, bitRange=0 +sfr = "TC1_CCR.CLKDIS", "Memory", 0xfffa0040, 4, base=16, bitRange=1 +sfr = "TC1_CCR.SWTRG", "Memory", 0xfffa0040, 4, base=16, bitRange=2 +sfr = "TC1_CMR", "Memory", 0xfffa0044, 4, base=16 +sfr = "TC1_CMR.CLKS", "Memory", 0xfffa0044, 4, base=16, bitRange=0-2 +sfr = "TC1_CMR.CLKI", "Memory", 0xfffa0044, 4, base=16, bitRange=3 +sfr = "TC1_CMR.BURST", "Memory", 0xfffa0044, 4, base=16, bitRange=4-5 +sfr = "TC1_CMR.CPCSTOP", "Memory", 0xfffa0044, 4, base=16, bitRange=6 +sfr = "TC1_CMR.LDBSTOP", "Memory", 0xfffa0044, 4, base=16, bitRange=6 +sfr = "TC1_CMR.CPCDIS", "Memory", 0xfffa0044, 4, base=16, bitRange=7 +sfr = "TC1_CMR.LDBDIS", "Memory", 0xfffa0044, 4, base=16, bitRange=7 +sfr = "TC1_CMR.ETRGEDG", "Memory", 0xfffa0044, 4, base=16, bitRange=8-9 +sfr = "TC1_CMR.EEVTEDG", "Memory", 0xfffa0044, 4, base=16, bitRange=8-9 +sfr = "TC1_CMR.EEVT", "Memory", 0xfffa0044, 4, base=16, bitRange=10-11 +sfr = "TC1_CMR.ABETRG", "Memory", 0xfffa0044, 4, base=16, bitRange=10 +sfr = "TC1_CMR.ENETRG", "Memory", 0xfffa0044, 4, base=16, bitRange=12 +sfr = "TC1_CMR.WAVESEL", "Memory", 0xfffa0044, 4, base=16, bitRange=13-14 +sfr = "TC1_CMR.CPCTRG", "Memory", 0xfffa0044, 4, base=16, bitRange=14 +sfr = "TC1_CMR.WAVE", "Memory", 0xfffa0044, 4, base=16, bitRange=15 +sfr = "TC1_CMR.ACPA", "Memory", 0xfffa0044, 4, base=16, bitRange=16-17 +sfr = "TC1_CMR.LDRA", "Memory", 0xfffa0044, 4, base=16, bitRange=16-17 +sfr = "TC1_CMR.ACPC", "Memory", 0xfffa0044, 4, base=16, bitRange=18-19 +sfr = "TC1_CMR.LDRB", "Memory", 0xfffa0044, 4, base=16, bitRange=18-19 +sfr = "TC1_CMR.AEEVT", "Memory", 0xfffa0044, 4, base=16, bitRange=20-21 +sfr = "TC1_CMR.ASWTRG", "Memory", 0xfffa0044, 4, base=16, bitRange=22-23 +sfr = "TC1_CMR.BCPB", "Memory", 0xfffa0044, 4, base=16, bitRange=24-25 +sfr = "TC1_CMR.BCPC", "Memory", 0xfffa0044, 4, base=16, bitRange=26-27 +sfr = "TC1_CMR.BEEVT", "Memory", 0xfffa0044, 4, base=16, bitRange=28-29 +sfr = "TC1_CMR.BSWTRG", "Memory", 0xfffa0044, 4, base=16, bitRange=30-31 +sfr = "TC1_CV", "Memory", 0xfffa0050, 4, base=16 +sfr = "TC1_RA", "Memory", 0xfffa0054, 4, base=16 +sfr = "TC1_RB", "Memory", 0xfffa0058, 4, base=16 +sfr = "TC1_RC", "Memory", 0xfffa005c, 4, base=16 +sfr = "TC1_SR", "Memory", 0xfffa0060, 4, base=16 +sfr = "TC1_SR.COVFS", "Memory", 0xfffa0060, 4, base=16, bitRange=0 +sfr = "TC1_SR.LOVRS", "Memory", 0xfffa0060, 4, base=16, bitRange=1 +sfr = "TC1_SR.CPAS", "Memory", 0xfffa0060, 4, base=16, bitRange=2 +sfr = "TC1_SR.CPBS", "Memory", 0xfffa0060, 4, base=16, bitRange=3 +sfr = "TC1_SR.CPCS", "Memory", 0xfffa0060, 4, base=16, bitRange=4 +sfr = "TC1_SR.LDRAS", "Memory", 0xfffa0060, 4, base=16, bitRange=5 +sfr = "TC1_SR.LDRBS", "Memory", 0xfffa0060, 4, base=16, bitRange=6 +sfr = "TC1_SR.ETRGS", "Memory", 0xfffa0060, 4, base=16, bitRange=7 +sfr = "TC1_SR.CLKSTA", "Memory", 0xfffa0060, 4, base=16, bitRange=16 +sfr = "TC1_SR.MTIOA", "Memory", 0xfffa0060, 4, base=16, bitRange=17 +sfr = "TC1_SR.MTIOB", "Memory", 0xfffa0060, 4, base=16, bitRange=18 +sfr = "TC1_IER", "Memory", 0xfffa0064, 4, base=16 +sfr = "TC1_IER.COVFS", "Memory", 0xfffa0064, 4, base=16, bitRange=0 +sfr = "TC1_IER.LOVRS", "Memory", 0xfffa0064, 4, base=16, bitRange=1 +sfr = "TC1_IER.CPAS", "Memory", 0xfffa0064, 4, base=16, bitRange=2 +sfr = "TC1_IER.CPBS", "Memory", 0xfffa0064, 4, base=16, bitRange=3 +sfr = "TC1_IER.CPCS", "Memory", 0xfffa0064, 4, base=16, bitRange=4 +sfr = "TC1_IER.LDRAS", "Memory", 0xfffa0064, 4, base=16, bitRange=5 +sfr = "TC1_IER.LDRBS", "Memory", 0xfffa0064, 4, base=16, bitRange=6 +sfr = "TC1_IER.ETRGS", "Memory", 0xfffa0064, 4, base=16, bitRange=7 +sfr = "TC1_IDR", "Memory", 0xfffa0068, 4, base=16 +sfr = "TC1_IDR.COVFS", "Memory", 0xfffa0068, 4, base=16, bitRange=0 +sfr = "TC1_IDR.LOVRS", "Memory", 0xfffa0068, 4, base=16, bitRange=1 +sfr = "TC1_IDR.CPAS", "Memory", 0xfffa0068, 4, base=16, bitRange=2 +sfr = "TC1_IDR.CPBS", "Memory", 0xfffa0068, 4, base=16, bitRange=3 +sfr = "TC1_IDR.CPCS", "Memory", 0xfffa0068, 4, base=16, bitRange=4 +sfr = "TC1_IDR.LDRAS", "Memory", 0xfffa0068, 4, base=16, bitRange=5 +sfr = "TC1_IDR.LDRBS", "Memory", 0xfffa0068, 4, base=16, bitRange=6 +sfr = "TC1_IDR.ETRGS", "Memory", 0xfffa0068, 4, base=16, bitRange=7 +sfr = "TC1_IMR", "Memory", 0xfffa006c, 4, base=16 +sfr = "TC1_IMR.COVFS", "Memory", 0xfffa006c, 4, base=16, bitRange=0 +sfr = "TC1_IMR.LOVRS", "Memory", 0xfffa006c, 4, base=16, bitRange=1 +sfr = "TC1_IMR.CPAS", "Memory", 0xfffa006c, 4, base=16, bitRange=2 +sfr = "TC1_IMR.CPBS", "Memory", 0xfffa006c, 4, base=16, bitRange=3 +sfr = "TC1_IMR.CPCS", "Memory", 0xfffa006c, 4, base=16, bitRange=4 +sfr = "TC1_IMR.LDRAS", "Memory", 0xfffa006c, 4, base=16, bitRange=5 +sfr = "TC1_IMR.LDRBS", "Memory", 0xfffa006c, 4, base=16, bitRange=6 +sfr = "TC1_IMR.ETRGS", "Memory", 0xfffa006c, 4, base=16, bitRange=7 +; ========== Register definition for TC2 peripheral ========== +sfr = "TC2_CCR", "Memory", 0xfffa0080, 4, base=16 +sfr = "TC2_CCR.CLKEN", "Memory", 0xfffa0080, 4, base=16, bitRange=0 +sfr = "TC2_CCR.CLKDIS", "Memory", 0xfffa0080, 4, base=16, bitRange=1 +sfr = "TC2_CCR.SWTRG", "Memory", 0xfffa0080, 4, base=16, bitRange=2 +sfr = "TC2_CMR", "Memory", 0xfffa0084, 4, base=16 +sfr = "TC2_CMR.CLKS", "Memory", 0xfffa0084, 4, base=16, bitRange=0-2 +sfr = "TC2_CMR.CLKI", "Memory", 0xfffa0084, 4, base=16, bitRange=3 +sfr = "TC2_CMR.BURST", "Memory", 0xfffa0084, 4, base=16, bitRange=4-5 +sfr = "TC2_CMR.CPCSTOP", "Memory", 0xfffa0084, 4, base=16, bitRange=6 +sfr = "TC2_CMR.LDBSTOP", "Memory", 0xfffa0084, 4, base=16, bitRange=6 +sfr = "TC2_CMR.CPCDIS", "Memory", 0xfffa0084, 4, base=16, bitRange=7 +sfr = "TC2_CMR.LDBDIS", "Memory", 0xfffa0084, 4, base=16, bitRange=7 +sfr = "TC2_CMR.ETRGEDG", "Memory", 0xfffa0084, 4, base=16, bitRange=8-9 +sfr = "TC2_CMR.EEVTEDG", "Memory", 0xfffa0084, 4, base=16, bitRange=8-9 +sfr = "TC2_CMR.EEVT", "Memory", 0xfffa0084, 4, base=16, bitRange=10-11 +sfr = "TC2_CMR.ABETRG", "Memory", 0xfffa0084, 4, base=16, bitRange=10 +sfr = "TC2_CMR.ENETRG", "Memory", 0xfffa0084, 4, base=16, bitRange=12 +sfr = "TC2_CMR.WAVESEL", "Memory", 0xfffa0084, 4, base=16, bitRange=13-14 +sfr = "TC2_CMR.CPCTRG", "Memory", 0xfffa0084, 4, base=16, bitRange=14 +sfr = "TC2_CMR.WAVE", "Memory", 0xfffa0084, 4, base=16, bitRange=15 +sfr = "TC2_CMR.ACPA", "Memory", 0xfffa0084, 4, base=16, bitRange=16-17 +sfr = "TC2_CMR.LDRA", "Memory", 0xfffa0084, 4, base=16, bitRange=16-17 +sfr = "TC2_CMR.ACPC", "Memory", 0xfffa0084, 4, base=16, bitRange=18-19 +sfr = "TC2_CMR.LDRB", "Memory", 0xfffa0084, 4, base=16, bitRange=18-19 +sfr = "TC2_CMR.AEEVT", "Memory", 0xfffa0084, 4, base=16, bitRange=20-21 +sfr = "TC2_CMR.ASWTRG", "Memory", 0xfffa0084, 4, base=16, bitRange=22-23 +sfr = "TC2_CMR.BCPB", "Memory", 0xfffa0084, 4, base=16, bitRange=24-25 +sfr = "TC2_CMR.BCPC", "Memory", 0xfffa0084, 4, base=16, bitRange=26-27 +sfr = "TC2_CMR.BEEVT", "Memory", 0xfffa0084, 4, base=16, bitRange=28-29 +sfr = "TC2_CMR.BSWTRG", "Memory", 0xfffa0084, 4, base=16, bitRange=30-31 +sfr = "TC2_CV", "Memory", 0xfffa0090, 4, base=16 +sfr = "TC2_RA", "Memory", 0xfffa0094, 4, base=16 +sfr = "TC2_RB", "Memory", 0xfffa0098, 4, base=16 +sfr = "TC2_RC", "Memory", 0xfffa009c, 4, base=16 +sfr = "TC2_SR", "Memory", 0xfffa00a0, 4, base=16 +sfr = "TC2_SR.COVFS", "Memory", 0xfffa00a0, 4, base=16, bitRange=0 +sfr = "TC2_SR.LOVRS", "Memory", 0xfffa00a0, 4, base=16, bitRange=1 +sfr = "TC2_SR.CPAS", "Memory", 0xfffa00a0, 4, base=16, bitRange=2 +sfr = "TC2_SR.CPBS", "Memory", 0xfffa00a0, 4, base=16, bitRange=3 +sfr = "TC2_SR.CPCS", "Memory", 0xfffa00a0, 4, base=16, bitRange=4 +sfr = "TC2_SR.LDRAS", "Memory", 0xfffa00a0, 4, base=16, bitRange=5 +sfr = "TC2_SR.LDRBS", "Memory", 0xfffa00a0, 4, base=16, bitRange=6 +sfr = "TC2_SR.ETRGS", "Memory", 0xfffa00a0, 4, base=16, bitRange=7 +sfr = "TC2_SR.CLKSTA", "Memory", 0xfffa00a0, 4, base=16, bitRange=16 +sfr = "TC2_SR.MTIOA", "Memory", 0xfffa00a0, 4, base=16, bitRange=17 +sfr = "TC2_SR.MTIOB", "Memory", 0xfffa00a0, 4, base=16, bitRange=18 +sfr = "TC2_IER", "Memory", 0xfffa00a4, 4, base=16 +sfr = "TC2_IER.COVFS", "Memory", 0xfffa00a4, 4, base=16, bitRange=0 +sfr = "TC2_IER.LOVRS", "Memory", 0xfffa00a4, 4, base=16, bitRange=1 +sfr = "TC2_IER.CPAS", "Memory", 0xfffa00a4, 4, base=16, bitRange=2 +sfr = "TC2_IER.CPBS", "Memory", 0xfffa00a4, 4, base=16, bitRange=3 +sfr = "TC2_IER.CPCS", "Memory", 0xfffa00a4, 4, base=16, bitRange=4 +sfr = "TC2_IER.LDRAS", "Memory", 0xfffa00a4, 4, base=16, bitRange=5 +sfr = "TC2_IER.LDRBS", "Memory", 0xfffa00a4, 4, base=16, bitRange=6 +sfr = "TC2_IER.ETRGS", "Memory", 0xfffa00a4, 4, base=16, bitRange=7 +sfr = "TC2_IDR", "Memory", 0xfffa00a8, 4, base=16 +sfr = "TC2_IDR.COVFS", "Memory", 0xfffa00a8, 4, base=16, bitRange=0 +sfr = "TC2_IDR.LOVRS", "Memory", 0xfffa00a8, 4, base=16, bitRange=1 +sfr = "TC2_IDR.CPAS", "Memory", 0xfffa00a8, 4, base=16, bitRange=2 +sfr = "TC2_IDR.CPBS", "Memory", 0xfffa00a8, 4, base=16, bitRange=3 +sfr = "TC2_IDR.CPCS", "Memory", 0xfffa00a8, 4, base=16, bitRange=4 +sfr = "TC2_IDR.LDRAS", "Memory", 0xfffa00a8, 4, base=16, bitRange=5 +sfr = "TC2_IDR.LDRBS", "Memory", 0xfffa00a8, 4, base=16, bitRange=6 +sfr = "TC2_IDR.ETRGS", "Memory", 0xfffa00a8, 4, base=16, bitRange=7 +sfr = "TC2_IMR", "Memory", 0xfffa00ac, 4, base=16 +sfr = "TC2_IMR.COVFS", "Memory", 0xfffa00ac, 4, base=16, bitRange=0 +sfr = "TC2_IMR.LOVRS", "Memory", 0xfffa00ac, 4, base=16, bitRange=1 +sfr = "TC2_IMR.CPAS", "Memory", 0xfffa00ac, 4, base=16, bitRange=2 +sfr = "TC2_IMR.CPBS", "Memory", 0xfffa00ac, 4, base=16, bitRange=3 +sfr = "TC2_IMR.CPCS", "Memory", 0xfffa00ac, 4, base=16, bitRange=4 +sfr = "TC2_IMR.LDRAS", "Memory", 0xfffa00ac, 4, base=16, bitRange=5 +sfr = "TC2_IMR.LDRBS", "Memory", 0xfffa00ac, 4, base=16, bitRange=6 +sfr = "TC2_IMR.ETRGS", "Memory", 0xfffa00ac, 4, base=16, bitRange=7 +; ========== Register definition for TCB peripheral ========== +sfr = "TCB_BCR", "Memory", 0xfffa00c0, 4, base=16 +sfr = "TCB_BCR.SYNC", "Memory", 0xfffa00c0, 4, base=16, bitRange=0 +sfr = "TCB_BMR", "Memory", 0xfffa00c4, 4, base=16 +sfr = "TCB_BMR.TC0XC0S", "Memory", 0xfffa00c4, 4, base=16, bitRange=0-1 +sfr = "TCB_BMR.TC1XC1S", "Memory", 0xfffa00c4, 4, base=16, bitRange=2-3 +sfr = "TCB_BMR.TC2XC2S", "Memory", 0xfffa00c4, 4, base=16, bitRange=4-5 +; ========== Register definition for CAN_MB0 peripheral ========== +sfr = "CAN_MB0_MMR", "Memory", 0xfffd0200, 4, base=16 +sfr = "CAN_MB0_MMR.MTIMEMARK", "Memory", 0xfffd0200, 4, base=16, bitRange=0-15 +sfr = "CAN_MB0_MMR.PRIOR", "Memory", 0xfffd0200, 4, base=16, bitRange=16-19 +sfr = "CAN_MB0_MMR.MOT", "Memory", 0xfffd0200, 4, base=16, bitRange=24-26 +sfr = "CAN_MB0_MAM", "Memory", 0xfffd0204, 4, base=16 +sfr = "CAN_MB0_MAM.MIDvB", "Memory", 0xfffd0204, 4, base=16, bitRange=0-17 +sfr = "CAN_MB0_MAM.MIDvA", "Memory", 0xfffd0204, 4, base=16, bitRange=18-28 +sfr = "CAN_MB0_MAM.MIDE", "Memory", 0xfffd0204, 4, base=16, bitRange=29 +sfr = "CAN_MB0_MID", "Memory", 0xfffd0208, 4, base=16 +sfr = "CAN_MB0_MID.MIDvB", "Memory", 0xfffd0208, 4, base=16, bitRange=0-17 +sfr = "CAN_MB0_MID.MIDvA", "Memory", 0xfffd0208, 4, base=16, bitRange=18-28 +sfr = "CAN_MB0_MID.MIDE", "Memory", 0xfffd0208, 4, base=16, bitRange=29 +sfr = "CAN_MB0_MFID", "Memory", 0xfffd020c, 4, base=16 +sfr = "CAN_MB0_MSR", "Memory", 0xfffd0210, 4, base=16 +sfr = "CAN_MB0_MSR.MTIMESTAMP", "Memory", 0xfffd0210, 4, base=16, bitRange=0-15 +sfr = "CAN_MB0_MSR.MDLC", "Memory", 0xfffd0210, 4, base=16, bitRange=16-19 +sfr = "CAN_MB0_MSR.MRTR", "Memory", 0xfffd0210, 4, base=16, bitRange=20 +sfr = "CAN_MB0_MSR.MABT", "Memory", 0xfffd0210, 4, base=16, bitRange=22 +sfr = "CAN_MB0_MSR.MRDY", "Memory", 0xfffd0210, 4, base=16, bitRange=23 +sfr = "CAN_MB0_MSR.MMI", "Memory", 0xfffd0210, 4, base=16, bitRange=24 +sfr = "CAN_MB0_MDL", "Memory", 0xfffd0214, 4, base=16 +sfr = "CAN_MB0_MDH", "Memory", 0xfffd0218, 4, base=16 +sfr = "CAN_MB0_MCR", "Memory", 0xfffd021c, 4, base=16 +sfr = "CAN_MB0_MCR.MDLC", "Memory", 0xfffd021c, 4, base=16, bitRange=16-19 +sfr = "CAN_MB0_MCR.MRTR", "Memory", 0xfffd021c, 4, base=16, bitRange=20 +sfr = "CAN_MB0_MCR.MACR", "Memory", 0xfffd021c, 4, base=16, bitRange=22 +sfr = "CAN_MB0_MCR.MTCR", "Memory", 0xfffd021c, 4, base=16, bitRange=23 +; ========== Register definition for CAN_MB1 peripheral ========== +sfr = "CAN_MB1_MMR", "Memory", 0xfffd0220, 4, base=16 +sfr = "CAN_MB1_MMR.MTIMEMARK", "Memory", 0xfffd0220, 4, base=16, bitRange=0-15 +sfr = "CAN_MB1_MMR.PRIOR", "Memory", 0xfffd0220, 4, base=16, bitRange=16-19 +sfr = "CAN_MB1_MMR.MOT", "Memory", 0xfffd0220, 4, base=16, bitRange=24-26 +sfr = "CAN_MB1_MAM", "Memory", 0xfffd0224, 4, base=16 +sfr = "CAN_MB1_MAM.MIDvB", "Memory", 0xfffd0224, 4, base=16, bitRange=0-17 +sfr = "CAN_MB1_MAM.MIDvA", "Memory", 0xfffd0224, 4, base=16, bitRange=18-28 +sfr = "CAN_MB1_MAM.MIDE", "Memory", 0xfffd0224, 4, base=16, bitRange=29 +sfr = "CAN_MB1_MID", "Memory", 0xfffd0228, 4, base=16 +sfr = "CAN_MB1_MID.MIDvB", "Memory", 0xfffd0228, 4, base=16, bitRange=0-17 +sfr = "CAN_MB1_MID.MIDvA", "Memory", 0xfffd0228, 4, base=16, bitRange=18-28 +sfr = "CAN_MB1_MID.MIDE", "Memory", 0xfffd0228, 4, base=16, bitRange=29 +sfr = "CAN_MB1_MFID", "Memory", 0xfffd022c, 4, base=16 +sfr = "CAN_MB1_MSR", "Memory", 0xfffd0230, 4, base=16 +sfr = "CAN_MB1_MSR.MTIMESTAMP", "Memory", 0xfffd0230, 4, base=16, bitRange=0-15 +sfr = "CAN_MB1_MSR.MDLC", "Memory", 0xfffd0230, 4, base=16, bitRange=16-19 +sfr = "CAN_MB1_MSR.MRTR", "Memory", 0xfffd0230, 4, base=16, bitRange=20 +sfr = "CAN_MB1_MSR.MABT", "Memory", 0xfffd0230, 4, base=16, bitRange=22 +sfr = "CAN_MB1_MSR.MRDY", "Memory", 0xfffd0230, 4, base=16, bitRange=23 +sfr = "CAN_MB1_MSR.MMI", "Memory", 0xfffd0230, 4, base=16, bitRange=24 +sfr = "CAN_MB1_MDL", "Memory", 0xfffd0234, 4, base=16 +sfr = "CAN_MB1_MDH", "Memory", 0xfffd0238, 4, base=16 +sfr = "CAN_MB1_MCR", "Memory", 0xfffd023c, 4, base=16 +sfr = "CAN_MB1_MCR.MDLC", "Memory", 0xfffd023c, 4, base=16, bitRange=16-19 +sfr = "CAN_MB1_MCR.MRTR", "Memory", 0xfffd023c, 4, base=16, bitRange=20 +sfr = "CAN_MB1_MCR.MACR", "Memory", 0xfffd023c, 4, base=16, bitRange=22 +sfr = "CAN_MB1_MCR.MTCR", "Memory", 0xfffd023c, 4, base=16, bitRange=23 +; ========== Register definition for CAN_MB2 peripheral ========== +sfr = "CAN_MB2_MMR", "Memory", 0xfffd0240, 4, base=16 +sfr = "CAN_MB2_MMR.MTIMEMARK", "Memory", 0xfffd0240, 4, base=16, bitRange=0-15 +sfr = "CAN_MB2_MMR.PRIOR", "Memory", 0xfffd0240, 4, base=16, bitRange=16-19 +sfr = "CAN_MB2_MMR.MOT", "Memory", 0xfffd0240, 4, base=16, bitRange=24-26 +sfr = "CAN_MB2_MAM", "Memory", 0xfffd0244, 4, base=16 +sfr = "CAN_MB2_MAM.MIDvB", "Memory", 0xfffd0244, 4, base=16, bitRange=0-17 +sfr = "CAN_MB2_MAM.MIDvA", "Memory", 0xfffd0244, 4, base=16, bitRange=18-28 +sfr = "CAN_MB2_MAM.MIDE", "Memory", 0xfffd0244, 4, base=16, bitRange=29 +sfr = "CAN_MB2_MID", "Memory", 0xfffd0248, 4, base=16 +sfr = "CAN_MB2_MID.MIDvB", "Memory", 0xfffd0248, 4, base=16, bitRange=0-17 +sfr = "CAN_MB2_MID.MIDvA", "Memory", 0xfffd0248, 4, base=16, bitRange=18-28 +sfr = "CAN_MB2_MID.MIDE", "Memory", 0xfffd0248, 4, base=16, bitRange=29 +sfr = "CAN_MB2_MFID", "Memory", 0xfffd024c, 4, base=16 +sfr = "CAN_MB2_MSR", "Memory", 0xfffd0250, 4, base=16 +sfr = "CAN_MB2_MSR.MTIMESTAMP", "Memory", 0xfffd0250, 4, base=16, bitRange=0-15 +sfr = "CAN_MB2_MSR.MDLC", "Memory", 0xfffd0250, 4, base=16, bitRange=16-19 +sfr = "CAN_MB2_MSR.MRTR", "Memory", 0xfffd0250, 4, base=16, bitRange=20 +sfr = "CAN_MB2_MSR.MABT", "Memory", 0xfffd0250, 4, base=16, bitRange=22 +sfr = "CAN_MB2_MSR.MRDY", "Memory", 0xfffd0250, 4, base=16, bitRange=23 +sfr = "CAN_MB2_MSR.MMI", "Memory", 0xfffd0250, 4, base=16, bitRange=24 +sfr = "CAN_MB2_MDL", "Memory", 0xfffd0254, 4, base=16 +sfr = "CAN_MB2_MDH", "Memory", 0xfffd0258, 4, base=16 +sfr = "CAN_MB2_MCR", "Memory", 0xfffd025c, 4, base=16 +sfr = "CAN_MB2_MCR.MDLC", "Memory", 0xfffd025c, 4, base=16, bitRange=16-19 +sfr = "CAN_MB2_MCR.MRTR", "Memory", 0xfffd025c, 4, base=16, bitRange=20 +sfr = "CAN_MB2_MCR.MACR", "Memory", 0xfffd025c, 4, base=16, bitRange=22 +sfr = "CAN_MB2_MCR.MTCR", "Memory", 0xfffd025c, 4, base=16, bitRange=23 +; ========== Register definition for CAN_MB3 peripheral ========== +sfr = "CAN_MB3_MMR", "Memory", 0xfffd0260, 4, base=16 +sfr = "CAN_MB3_MMR.MTIMEMARK", "Memory", 0xfffd0260, 4, base=16, bitRange=0-15 +sfr = "CAN_MB3_MMR.PRIOR", "Memory", 0xfffd0260, 4, base=16, bitRange=16-19 +sfr = "CAN_MB3_MMR.MOT", "Memory", 0xfffd0260, 4, base=16, bitRange=24-26 +sfr = "CAN_MB3_MAM", "Memory", 0xfffd0264, 4, base=16 +sfr = "CAN_MB3_MAM.MIDvB", "Memory", 0xfffd0264, 4, base=16, bitRange=0-17 +sfr = "CAN_MB3_MAM.MIDvA", "Memory", 0xfffd0264, 4, base=16, bitRange=18-28 +sfr = "CAN_MB3_MAM.MIDE", "Memory", 0xfffd0264, 4, base=16, bitRange=29 +sfr = "CAN_MB3_MID", "Memory", 0xfffd0268, 4, base=16 +sfr = "CAN_MB3_MID.MIDvB", "Memory", 0xfffd0268, 4, base=16, bitRange=0-17 +sfr = "CAN_MB3_MID.MIDvA", "Memory", 0xfffd0268, 4, base=16, bitRange=18-28 +sfr = "CAN_MB3_MID.MIDE", "Memory", 0xfffd0268, 4, base=16, bitRange=29 +sfr = "CAN_MB3_MFID", "Memory", 0xfffd026c, 4, base=16 +sfr = "CAN_MB3_MSR", "Memory", 0xfffd0270, 4, base=16 +sfr = "CAN_MB3_MSR.MTIMESTAMP", "Memory", 0xfffd0270, 4, base=16, bitRange=0-15 +sfr = "CAN_MB3_MSR.MDLC", "Memory", 0xfffd0270, 4, base=16, bitRange=16-19 +sfr = "CAN_MB3_MSR.MRTR", "Memory", 0xfffd0270, 4, base=16, bitRange=20 +sfr = "CAN_MB3_MSR.MABT", "Memory", 0xfffd0270, 4, base=16, bitRange=22 +sfr = "CAN_MB3_MSR.MRDY", "Memory", 0xfffd0270, 4, base=16, bitRange=23 +sfr = "CAN_MB3_MSR.MMI", "Memory", 0xfffd0270, 4, base=16, bitRange=24 +sfr = "CAN_MB3_MDL", "Memory", 0xfffd0274, 4, base=16 +sfr = "CAN_MB3_MDH", "Memory", 0xfffd0278, 4, base=16 +sfr = "CAN_MB3_MCR", "Memory", 0xfffd027c, 4, base=16 +sfr = "CAN_MB3_MCR.MDLC", "Memory", 0xfffd027c, 4, base=16, bitRange=16-19 +sfr = "CAN_MB3_MCR.MRTR", "Memory", 0xfffd027c, 4, base=16, bitRange=20 +sfr = "CAN_MB3_MCR.MACR", "Memory", 0xfffd027c, 4, base=16, bitRange=22 +sfr = "CAN_MB3_MCR.MTCR", "Memory", 0xfffd027c, 4, base=16, bitRange=23 +; ========== Register definition for CAN_MB4 peripheral ========== +sfr = "CAN_MB4_MMR", "Memory", 0xfffd0280, 4, base=16 +sfr = "CAN_MB4_MMR.MTIMEMARK", "Memory", 0xfffd0280, 4, base=16, bitRange=0-15 +sfr = "CAN_MB4_MMR.PRIOR", "Memory", 0xfffd0280, 4, base=16, bitRange=16-19 +sfr = "CAN_MB4_MMR.MOT", "Memory", 0xfffd0280, 4, base=16, bitRange=24-26 +sfr = "CAN_MB4_MAM", "Memory", 0xfffd0284, 4, base=16 +sfr = "CAN_MB4_MAM.MIDvB", "Memory", 0xfffd0284, 4, base=16, bitRange=0-17 +sfr = "CAN_MB4_MAM.MIDvA", "Memory", 0xfffd0284, 4, base=16, bitRange=18-28 +sfr = "CAN_MB4_MAM.MIDE", "Memory", 0xfffd0284, 4, base=16, bitRange=29 +sfr = "CAN_MB4_MID", "Memory", 0xfffd0288, 4, base=16 +sfr = "CAN_MB4_MID.MIDvB", "Memory", 0xfffd0288, 4, base=16, bitRange=0-17 +sfr = "CAN_MB4_MID.MIDvA", "Memory", 0xfffd0288, 4, base=16, bitRange=18-28 +sfr = "CAN_MB4_MID.MIDE", "Memory", 0xfffd0288, 4, base=16, bitRange=29 +sfr = "CAN_MB4_MFID", "Memory", 0xfffd028c, 4, base=16 +sfr = "CAN_MB4_MSR", "Memory", 0xfffd0290, 4, base=16 +sfr = "CAN_MB4_MSR.MTIMESTAMP", "Memory", 0xfffd0290, 4, base=16, bitRange=0-15 +sfr = "CAN_MB4_MSR.MDLC", "Memory", 0xfffd0290, 4, base=16, bitRange=16-19 +sfr = "CAN_MB4_MSR.MRTR", "Memory", 0xfffd0290, 4, base=16, bitRange=20 +sfr = "CAN_MB4_MSR.MABT", "Memory", 0xfffd0290, 4, base=16, bitRange=22 +sfr = "CAN_MB4_MSR.MRDY", "Memory", 0xfffd0290, 4, base=16, bitRange=23 +sfr = "CAN_MB4_MSR.MMI", "Memory", 0xfffd0290, 4, base=16, bitRange=24 +sfr = "CAN_MB4_MDL", "Memory", 0xfffd0294, 4, base=16 +sfr = "CAN_MB4_MDH", "Memory", 0xfffd0298, 4, base=16 +sfr = "CAN_MB4_MCR", "Memory", 0xfffd029c, 4, base=16 +sfr = "CAN_MB4_MCR.MDLC", "Memory", 0xfffd029c, 4, base=16, bitRange=16-19 +sfr = "CAN_MB4_MCR.MRTR", "Memory", 0xfffd029c, 4, base=16, bitRange=20 +sfr = "CAN_MB4_MCR.MACR", "Memory", 0xfffd029c, 4, base=16, bitRange=22 +sfr = "CAN_MB4_MCR.MTCR", "Memory", 0xfffd029c, 4, base=16, bitRange=23 +; ========== Register definition for CAN_MB5 peripheral ========== +sfr = "CAN_MB5_MMR", "Memory", 0xfffd02a0, 4, base=16 +sfr = "CAN_MB5_MMR.MTIMEMARK", "Memory", 0xfffd02a0, 4, base=16, bitRange=0-15 +sfr = "CAN_MB5_MMR.PRIOR", "Memory", 0xfffd02a0, 4, base=16, bitRange=16-19 +sfr = "CAN_MB5_MMR.MOT", "Memory", 0xfffd02a0, 4, base=16, bitRange=24-26 +sfr = "CAN_MB5_MAM", "Memory", 0xfffd02a4, 4, base=16 +sfr = "CAN_MB5_MAM.MIDvB", "Memory", 0xfffd02a4, 4, base=16, bitRange=0-17 +sfr = "CAN_MB5_MAM.MIDvA", "Memory", 0xfffd02a4, 4, base=16, bitRange=18-28 +sfr = "CAN_MB5_MAM.MIDE", "Memory", 0xfffd02a4, 4, base=16, bitRange=29 +sfr = "CAN_MB5_MID", "Memory", 0xfffd02a8, 4, base=16 +sfr = "CAN_MB5_MID.MIDvB", "Memory", 0xfffd02a8, 4, base=16, bitRange=0-17 +sfr = "CAN_MB5_MID.MIDvA", "Memory", 0xfffd02a8, 4, base=16, bitRange=18-28 +sfr = "CAN_MB5_MID.MIDE", "Memory", 0xfffd02a8, 4, base=16, bitRange=29 +sfr = "CAN_MB5_MFID", "Memory", 0xfffd02ac, 4, base=16 +sfr = "CAN_MB5_MSR", "Memory", 0xfffd02b0, 4, base=16 +sfr = "CAN_MB5_MSR.MTIMESTAMP", "Memory", 0xfffd02b0, 4, base=16, bitRange=0-15 +sfr = "CAN_MB5_MSR.MDLC", "Memory", 0xfffd02b0, 4, base=16, bitRange=16-19 +sfr = "CAN_MB5_MSR.MRTR", "Memory", 0xfffd02b0, 4, base=16, bitRange=20 +sfr = "CAN_MB5_MSR.MABT", "Memory", 0xfffd02b0, 4, base=16, bitRange=22 +sfr = "CAN_MB5_MSR.MRDY", "Memory", 0xfffd02b0, 4, base=16, bitRange=23 +sfr = "CAN_MB5_MSR.MMI", "Memory", 0xfffd02b0, 4, base=16, bitRange=24 +sfr = "CAN_MB5_MDL", "Memory", 0xfffd02b4, 4, base=16 +sfr = "CAN_MB5_MDH", "Memory", 0xfffd02b8, 4, base=16 +sfr = "CAN_MB5_MCR", "Memory", 0xfffd02bc, 4, base=16 +sfr = "CAN_MB5_MCR.MDLC", "Memory", 0xfffd02bc, 4, base=16, bitRange=16-19 +sfr = "CAN_MB5_MCR.MRTR", "Memory", 0xfffd02bc, 4, base=16, bitRange=20 +sfr = "CAN_MB5_MCR.MACR", "Memory", 0xfffd02bc, 4, base=16, bitRange=22 +sfr = "CAN_MB5_MCR.MTCR", "Memory", 0xfffd02bc, 4, base=16, bitRange=23 +; ========== Register definition for CAN_MB6 peripheral ========== +sfr = "CAN_MB6_MMR", "Memory", 0xfffd02c0, 4, base=16 +sfr = "CAN_MB6_MMR.MTIMEMARK", "Memory", 0xfffd02c0, 4, base=16, bitRange=0-15 +sfr = "CAN_MB6_MMR.PRIOR", "Memory", 0xfffd02c0, 4, base=16, bitRange=16-19 +sfr = "CAN_MB6_MMR.MOT", "Memory", 0xfffd02c0, 4, base=16, bitRange=24-26 +sfr = "CAN_MB6_MAM", "Memory", 0xfffd02c4, 4, base=16 +sfr = "CAN_MB6_MAM.MIDvB", "Memory", 0xfffd02c4, 4, base=16, bitRange=0-17 +sfr = "CAN_MB6_MAM.MIDvA", "Memory", 0xfffd02c4, 4, base=16, bitRange=18-28 +sfr = "CAN_MB6_MAM.MIDE", "Memory", 0xfffd02c4, 4, base=16, bitRange=29 +sfr = "CAN_MB6_MID", "Memory", 0xfffd02c8, 4, base=16 +sfr = "CAN_MB6_MID.MIDvB", "Memory", 0xfffd02c8, 4, base=16, bitRange=0-17 +sfr = "CAN_MB6_MID.MIDvA", "Memory", 0xfffd02c8, 4, base=16, bitRange=18-28 +sfr = "CAN_MB6_MID.MIDE", "Memory", 0xfffd02c8, 4, base=16, bitRange=29 +sfr = "CAN_MB6_MFID", "Memory", 0xfffd02cc, 4, base=16 +sfr = "CAN_MB6_MSR", "Memory", 0xfffd02d0, 4, base=16 +sfr = "CAN_MB6_MSR.MTIMESTAMP", "Memory", 0xfffd02d0, 4, base=16, bitRange=0-15 +sfr = "CAN_MB6_MSR.MDLC", "Memory", 0xfffd02d0, 4, base=16, bitRange=16-19 +sfr = "CAN_MB6_MSR.MRTR", "Memory", 0xfffd02d0, 4, base=16, bitRange=20 +sfr = "CAN_MB6_MSR.MABT", "Memory", 0xfffd02d0, 4, base=16, bitRange=22 +sfr = "CAN_MB6_MSR.MRDY", "Memory", 0xfffd02d0, 4, base=16, bitRange=23 +sfr = "CAN_MB6_MSR.MMI", "Memory", 0xfffd02d0, 4, base=16, bitRange=24 +sfr = "CAN_MB6_MDL", "Memory", 0xfffd02d4, 4, base=16 +sfr = "CAN_MB6_MDH", "Memory", 0xfffd02d8, 4, base=16 +sfr = "CAN_MB6_MCR", "Memory", 0xfffd02dc, 4, base=16 +sfr = "CAN_MB6_MCR.MDLC", "Memory", 0xfffd02dc, 4, base=16, bitRange=16-19 +sfr = "CAN_MB6_MCR.MRTR", "Memory", 0xfffd02dc, 4, base=16, bitRange=20 +sfr = "CAN_MB6_MCR.MACR", "Memory", 0xfffd02dc, 4, base=16, bitRange=22 +sfr = "CAN_MB6_MCR.MTCR", "Memory", 0xfffd02dc, 4, base=16, bitRange=23 +; ========== Register definition for CAN_MB7 peripheral ========== +sfr = "CAN_MB7_MMR", "Memory", 0xfffd02e0, 4, base=16 +sfr = "CAN_MB7_MMR.MTIMEMARK", "Memory", 0xfffd02e0, 4, base=16, bitRange=0-15 +sfr = "CAN_MB7_MMR.PRIOR", "Memory", 0xfffd02e0, 4, base=16, bitRange=16-19 +sfr = "CAN_MB7_MMR.MOT", "Memory", 0xfffd02e0, 4, base=16, bitRange=24-26 +sfr = "CAN_MB7_MAM", "Memory", 0xfffd02e4, 4, base=16 +sfr = "CAN_MB7_MAM.MIDvB", "Memory", 0xfffd02e4, 4, base=16, bitRange=0-17 +sfr = "CAN_MB7_MAM.MIDvA", "Memory", 0xfffd02e4, 4, base=16, bitRange=18-28 +sfr = "CAN_MB7_MAM.MIDE", "Memory", 0xfffd02e4, 4, base=16, bitRange=29 +sfr = "CAN_MB7_MID", "Memory", 0xfffd02e8, 4, base=16 +sfr = "CAN_MB7_MID.MIDvB", "Memory", 0xfffd02e8, 4, base=16, bitRange=0-17 +sfr = "CAN_MB7_MID.MIDvA", "Memory", 0xfffd02e8, 4, base=16, bitRange=18-28 +sfr = "CAN_MB7_MID.MIDE", "Memory", 0xfffd02e8, 4, base=16, bitRange=29 +sfr = "CAN_MB7_MFID", "Memory", 0xfffd02ec, 4, base=16 +sfr = "CAN_MB7_MSR", "Memory", 0xfffd02f0, 4, base=16 +sfr = "CAN_MB7_MSR.MTIMESTAMP", "Memory", 0xfffd02f0, 4, base=16, bitRange=0-15 +sfr = "CAN_MB7_MSR.MDLC", "Memory", 0xfffd02f0, 4, base=16, bitRange=16-19 +sfr = "CAN_MB7_MSR.MRTR", "Memory", 0xfffd02f0, 4, base=16, bitRange=20 +sfr = "CAN_MB7_MSR.MABT", "Memory", 0xfffd02f0, 4, base=16, bitRange=22 +sfr = "CAN_MB7_MSR.MRDY", "Memory", 0xfffd02f0, 4, base=16, bitRange=23 +sfr = "CAN_MB7_MSR.MMI", "Memory", 0xfffd02f0, 4, base=16, bitRange=24 +sfr = "CAN_MB7_MDL", "Memory", 0xfffd02f4, 4, base=16 +sfr = "CAN_MB7_MDH", "Memory", 0xfffd02f8, 4, base=16 +sfr = "CAN_MB7_MCR", "Memory", 0xfffd02fc, 4, base=16 +sfr = "CAN_MB7_MCR.MDLC", "Memory", 0xfffd02fc, 4, base=16, bitRange=16-19 +sfr = "CAN_MB7_MCR.MRTR", "Memory", 0xfffd02fc, 4, base=16, bitRange=20 +sfr = "CAN_MB7_MCR.MACR", "Memory", 0xfffd02fc, 4, base=16, bitRange=22 +sfr = "CAN_MB7_MCR.MTCR", "Memory", 0xfffd02fc, 4, base=16, bitRange=23 +; ========== Register definition for CAN peripheral ========== +sfr = "CAN_MR", "Memory", 0xfffd0000, 4, base=16 +sfr = "CAN_MR.CANEN", "Memory", 0xfffd0000, 4, base=16, bitRange=0 +sfr = "CAN_MR.LPM", "Memory", 0xfffd0000, 4, base=16, bitRange=1 +sfr = "CAN_MR.ABM", "Memory", 0xfffd0000, 4, base=16, bitRange=2 +sfr = "CAN_MR.OVL", "Memory", 0xfffd0000, 4, base=16, bitRange=3 +sfr = "CAN_MR.TEOF", "Memory", 0xfffd0000, 4, base=16, bitRange=4 +sfr = "CAN_MR.TTM", "Memory", 0xfffd0000, 4, base=16, bitRange=5 +sfr = "CAN_MR.TIMFRZ", "Memory", 0xfffd0000, 4, base=16, bitRange=6 +sfr = "CAN_MR.DRPT", "Memory", 0xfffd0000, 4, base=16, bitRange=7 +sfr = "CAN_IER", "Memory", 0xfffd0004, 4, base=16 +sfr = "CAN_IER.MB0", "Memory", 0xfffd0004, 4, base=16, bitRange=0 +sfr = "CAN_IER.MB1", "Memory", 0xfffd0004, 4, base=16, bitRange=1 +sfr = "CAN_IER.MB2", "Memory", 0xfffd0004, 4, base=16, bitRange=2 +sfr = "CAN_IER.MB3", "Memory", 0xfffd0004, 4, base=16, bitRange=3 +sfr = "CAN_IER.MB4", "Memory", 0xfffd0004, 4, base=16, bitRange=4 +sfr = "CAN_IER.MB5", "Memory", 0xfffd0004, 4, base=16, bitRange=5 +sfr = "CAN_IER.MB6", "Memory", 0xfffd0004, 4, base=16, bitRange=6 +sfr = "CAN_IER.MB7", "Memory", 0xfffd0004, 4, base=16, bitRange=7 +sfr = "CAN_IER.MB8", "Memory", 0xfffd0004, 4, base=16, bitRange=8 +sfr = "CAN_IER.MB9", "Memory", 0xfffd0004, 4, base=16, bitRange=9 +sfr = "CAN_IER.MB10", "Memory", 0xfffd0004, 4, base=16, bitRange=10 +sfr = "CAN_IER.MB11", "Memory", 0xfffd0004, 4, base=16, bitRange=11 +sfr = "CAN_IER.MB12", "Memory", 0xfffd0004, 4, base=16, bitRange=12 +sfr = "CAN_IER.MB13", "Memory", 0xfffd0004, 4, base=16, bitRange=13 +sfr = "CAN_IER.MB14", "Memory", 0xfffd0004, 4, base=16, bitRange=14 +sfr = "CAN_IER.MB15", "Memory", 0xfffd0004, 4, base=16, bitRange=15 +sfr = "CAN_IER.ERRA", "Memory", 0xfffd0004, 4, base=16, bitRange=16 +sfr = "CAN_IER.WARN", "Memory", 0xfffd0004, 4, base=16, bitRange=17 +sfr = "CAN_IER.ERRP", "Memory", 0xfffd0004, 4, base=16, bitRange=18 +sfr = "CAN_IER.BOFF", "Memory", 0xfffd0004, 4, base=16, bitRange=19 +sfr = "CAN_IER.SLEEP", "Memory", 0xfffd0004, 4, base=16, bitRange=20 +sfr = "CAN_IER.WAKEUP", "Memory", 0xfffd0004, 4, base=16, bitRange=21 +sfr = "CAN_IER.TOVF", "Memory", 0xfffd0004, 4, base=16, bitRange=22 +sfr = "CAN_IER.TSTP", "Memory", 0xfffd0004, 4, base=16, bitRange=23 +sfr = "CAN_IER.CERR", "Memory", 0xfffd0004, 4, base=16, bitRange=24 +sfr = "CAN_IER.SERR", "Memory", 0xfffd0004, 4, base=16, bitRange=25 +sfr = "CAN_IER.AERR", "Memory", 0xfffd0004, 4, base=16, bitRange=26 +sfr = "CAN_IER.FERR", "Memory", 0xfffd0004, 4, base=16, bitRange=27 +sfr = "CAN_IER.BERR", "Memory", 0xfffd0004, 4, base=16, bitRange=28 +sfr = "CAN_IDR", "Memory", 0xfffd0008, 4, base=16 +sfr = "CAN_IDR.MB0", "Memory", 0xfffd0008, 4, base=16, bitRange=0 +sfr = "CAN_IDR.MB1", "Memory", 0xfffd0008, 4, base=16, bitRange=1 +sfr = "CAN_IDR.MB2", "Memory", 0xfffd0008, 4, base=16, bitRange=2 +sfr = "CAN_IDR.MB3", "Memory", 0xfffd0008, 4, base=16, bitRange=3 +sfr = "CAN_IDR.MB4", "Memory", 0xfffd0008, 4, base=16, bitRange=4 +sfr = "CAN_IDR.MB5", "Memory", 0xfffd0008, 4, base=16, bitRange=5 +sfr = "CAN_IDR.MB6", "Memory", 0xfffd0008, 4, base=16, bitRange=6 +sfr = "CAN_IDR.MB7", "Memory", 0xfffd0008, 4, base=16, bitRange=7 +sfr = "CAN_IDR.MB8", "Memory", 0xfffd0008, 4, base=16, bitRange=8 +sfr = "CAN_IDR.MB9", "Memory", 0xfffd0008, 4, base=16, bitRange=9 +sfr = "CAN_IDR.MB10", "Memory", 0xfffd0008, 4, base=16, bitRange=10 +sfr = "CAN_IDR.MB11", "Memory", 0xfffd0008, 4, base=16, bitRange=11 +sfr = "CAN_IDR.MB12", "Memory", 0xfffd0008, 4, base=16, bitRange=12 +sfr = "CAN_IDR.MB13", "Memory", 0xfffd0008, 4, base=16, bitRange=13 +sfr = "CAN_IDR.MB14", "Memory", 0xfffd0008, 4, base=16, bitRange=14 +sfr = "CAN_IDR.MB15", "Memory", 0xfffd0008, 4, base=16, bitRange=15 +sfr = "CAN_IDR.ERRA", "Memory", 0xfffd0008, 4, base=16, bitRange=16 +sfr = "CAN_IDR.WARN", "Memory", 0xfffd0008, 4, base=16, bitRange=17 +sfr = "CAN_IDR.ERRP", "Memory", 0xfffd0008, 4, base=16, bitRange=18 +sfr = "CAN_IDR.BOFF", "Memory", 0xfffd0008, 4, base=16, bitRange=19 +sfr = "CAN_IDR.SLEEP", "Memory", 0xfffd0008, 4, base=16, bitRange=20 +sfr = "CAN_IDR.WAKEUP", "Memory", 0xfffd0008, 4, base=16, bitRange=21 +sfr = "CAN_IDR.TOVF", "Memory", 0xfffd0008, 4, base=16, bitRange=22 +sfr = "CAN_IDR.TSTP", "Memory", 0xfffd0008, 4, base=16, bitRange=23 +sfr = "CAN_IDR.CERR", "Memory", 0xfffd0008, 4, base=16, bitRange=24 +sfr = "CAN_IDR.SERR", "Memory", 0xfffd0008, 4, base=16, bitRange=25 +sfr = "CAN_IDR.AERR", "Memory", 0xfffd0008, 4, base=16, bitRange=26 +sfr = "CAN_IDR.FERR", "Memory", 0xfffd0008, 4, base=16, bitRange=27 +sfr = "CAN_IDR.BERR", "Memory", 0xfffd0008, 4, base=16, bitRange=28 +sfr = "CAN_IMR", "Memory", 0xfffd000c, 4, base=16 +sfr = "CAN_IMR.MB0", "Memory", 0xfffd000c, 4, base=16, bitRange=0 +sfr = "CAN_IMR.MB1", "Memory", 0xfffd000c, 4, base=16, bitRange=1 +sfr = "CAN_IMR.MB2", "Memory", 0xfffd000c, 4, base=16, bitRange=2 +sfr = "CAN_IMR.MB3", "Memory", 0xfffd000c, 4, base=16, bitRange=3 +sfr = "CAN_IMR.MB4", "Memory", 0xfffd000c, 4, base=16, bitRange=4 +sfr = "CAN_IMR.MB5", "Memory", 0xfffd000c, 4, base=16, bitRange=5 +sfr = "CAN_IMR.MB6", "Memory", 0xfffd000c, 4, base=16, bitRange=6 +sfr = "CAN_IMR.MB7", "Memory", 0xfffd000c, 4, base=16, bitRange=7 +sfr = "CAN_IMR.MB8", "Memory", 0xfffd000c, 4, base=16, bitRange=8 +sfr = "CAN_IMR.MB9", "Memory", 0xfffd000c, 4, base=16, bitRange=9 +sfr = "CAN_IMR.MB10", "Memory", 0xfffd000c, 4, base=16, bitRange=10 +sfr = "CAN_IMR.MB11", "Memory", 0xfffd000c, 4, base=16, bitRange=11 +sfr = "CAN_IMR.MB12", "Memory", 0xfffd000c, 4, base=16, bitRange=12 +sfr = "CAN_IMR.MB13", "Memory", 0xfffd000c, 4, base=16, bitRange=13 +sfr = "CAN_IMR.MB14", "Memory", 0xfffd000c, 4, base=16, bitRange=14 +sfr = "CAN_IMR.MB15", "Memory", 0xfffd000c, 4, base=16, bitRange=15 +sfr = "CAN_IMR.ERRA", "Memory", 0xfffd000c, 4, base=16, bitRange=16 +sfr = "CAN_IMR.WARN", "Memory", 0xfffd000c, 4, base=16, bitRange=17 +sfr = "CAN_IMR.ERRP", "Memory", 0xfffd000c, 4, base=16, bitRange=18 +sfr = "CAN_IMR.BOFF", "Memory", 0xfffd000c, 4, base=16, bitRange=19 +sfr = "CAN_IMR.SLEEP", "Memory", 0xfffd000c, 4, base=16, bitRange=20 +sfr = "CAN_IMR.WAKEUP", "Memory", 0xfffd000c, 4, base=16, bitRange=21 +sfr = "CAN_IMR.TOVF", "Memory", 0xfffd000c, 4, base=16, bitRange=22 +sfr = "CAN_IMR.TSTP", "Memory", 0xfffd000c, 4, base=16, bitRange=23 +sfr = "CAN_IMR.CERR", "Memory", 0xfffd000c, 4, base=16, bitRange=24 +sfr = "CAN_IMR.SERR", "Memory", 0xfffd000c, 4, base=16, bitRange=25 +sfr = "CAN_IMR.AERR", "Memory", 0xfffd000c, 4, base=16, bitRange=26 +sfr = "CAN_IMR.FERR", "Memory", 0xfffd000c, 4, base=16, bitRange=27 +sfr = "CAN_IMR.BERR", "Memory", 0xfffd000c, 4, base=16, bitRange=28 +sfr = "CAN_SR", "Memory", 0xfffd0010, 4, base=16 +sfr = "CAN_SR.MB0", "Memory", 0xfffd0010, 4, base=16, bitRange=0 +sfr = "CAN_SR.MB1", "Memory", 0xfffd0010, 4, base=16, bitRange=1 +sfr = "CAN_SR.MB2", "Memory", 0xfffd0010, 4, base=16, bitRange=2 +sfr = "CAN_SR.MB3", "Memory", 0xfffd0010, 4, base=16, bitRange=3 +sfr = "CAN_SR.MB4", "Memory", 0xfffd0010, 4, base=16, bitRange=4 +sfr = "CAN_SR.MB5", "Memory", 0xfffd0010, 4, base=16, bitRange=5 +sfr = "CAN_SR.MB6", "Memory", 0xfffd0010, 4, base=16, bitRange=6 +sfr = "CAN_SR.MB7", "Memory", 0xfffd0010, 4, base=16, bitRange=7 +sfr = "CAN_SR.MB8", "Memory", 0xfffd0010, 4, base=16, bitRange=8 +sfr = "CAN_SR.MB9", "Memory", 0xfffd0010, 4, base=16, bitRange=9 +sfr = "CAN_SR.MB10", "Memory", 0xfffd0010, 4, base=16, bitRange=10 +sfr = "CAN_SR.MB11", "Memory", 0xfffd0010, 4, base=16, bitRange=11 +sfr = "CAN_SR.MB12", "Memory", 0xfffd0010, 4, base=16, bitRange=12 +sfr = "CAN_SR.MB13", "Memory", 0xfffd0010, 4, base=16, bitRange=13 +sfr = "CAN_SR.MB14", "Memory", 0xfffd0010, 4, base=16, bitRange=14 +sfr = "CAN_SR.MB15", "Memory", 0xfffd0010, 4, base=16, bitRange=15 +sfr = "CAN_SR.ERRA", "Memory", 0xfffd0010, 4, base=16, bitRange=16 +sfr = "CAN_SR.WARN", "Memory", 0xfffd0010, 4, base=16, bitRange=17 +sfr = "CAN_SR.ERRP", "Memory", 0xfffd0010, 4, base=16, bitRange=18 +sfr = "CAN_SR.BOFF", "Memory", 0xfffd0010, 4, base=16, bitRange=19 +sfr = "CAN_SR.SLEEP", "Memory", 0xfffd0010, 4, base=16, bitRange=20 +sfr = "CAN_SR.WAKEUP", "Memory", 0xfffd0010, 4, base=16, bitRange=21 +sfr = "CAN_SR.TOVF", "Memory", 0xfffd0010, 4, base=16, bitRange=22 +sfr = "CAN_SR.TSTP", "Memory", 0xfffd0010, 4, base=16, bitRange=23 +sfr = "CAN_SR.CERR", "Memory", 0xfffd0010, 4, base=16, bitRange=24 +sfr = "CAN_SR.SERR", "Memory", 0xfffd0010, 4, base=16, bitRange=25 +sfr = "CAN_SR.AERR", "Memory", 0xfffd0010, 4, base=16, bitRange=26 +sfr = "CAN_SR.FERR", "Memory", 0xfffd0010, 4, base=16, bitRange=27 +sfr = "CAN_SR.BERR", "Memory", 0xfffd0010, 4, base=16, bitRange=28 +sfr = "CAN_SR.RBSY", "Memory", 0xfffd0010, 4, base=16, bitRange=29 +sfr = "CAN_SR.TBSY", "Memory", 0xfffd0010, 4, base=16, bitRange=30 +sfr = "CAN_SR.OVLY", "Memory", 0xfffd0010, 4, base=16, bitRange=31 +sfr = "CAN_BR", "Memory", 0xfffd0014, 4, base=16 +sfr = "CAN_BR.PHASE2", "Memory", 0xfffd0014, 4, base=16, bitRange=0-2 +sfr = "CAN_BR.PHASE1", "Memory", 0xfffd0014, 4, base=16, bitRange=4-6 +sfr = "CAN_BR.PROPAG", "Memory", 0xfffd0014, 4, base=16, bitRange=8-10 +sfr = "CAN_BR.SYNC", "Memory", 0xfffd0014, 4, base=16, bitRange=12-13 +sfr = "CAN_BR.BRP", "Memory", 0xfffd0014, 4, base=16, bitRange=16-22 +sfr = "CAN_BR.SMP", "Memory", 0xfffd0014, 4, base=16, bitRange=24 +sfr = "CAN_TIM", "Memory", 0xfffd0018, 4, base=16 +sfr = "CAN_TIM.TIMER", "Memory", 0xfffd0018, 4, base=16, bitRange=0-15 +sfr = "CAN_TIMESTP", "Memory", 0xfffd001c, 4, base=16 +sfr = "CAN_TIMESTP.MTIMESTAMP", "Memory", 0xfffd001c, 4, base=16, bitRange=0-15 +sfr = "CAN_ECR", "Memory", 0xfffd0020, 4, base=16 +sfr = "CAN_ECR.REC", "Memory", 0xfffd0020, 4, base=16, bitRange=0-7 +sfr = "CAN_ECR.TEC", "Memory", 0xfffd0020, 4, base=16, bitRange=16-23 +sfr = "CAN_TCR", "Memory", 0xfffd0024, 4, base=16 +sfr = "CAN_TCR.MB0", "Memory", 0xfffd0024, 4, base=16, bitRange=0 +sfr = "CAN_TCR.MB1", "Memory", 0xfffd0024, 4, base=16, bitRange=1 +sfr = "CAN_TCR.MB2", "Memory", 0xfffd0024, 4, base=16, bitRange=2 +sfr = "CAN_TCR.MB3", "Memory", 0xfffd0024, 4, base=16, bitRange=3 +sfr = "CAN_TCR.MB4", "Memory", 0xfffd0024, 4, base=16, bitRange=4 +sfr = "CAN_TCR.MB5", "Memory", 0xfffd0024, 4, base=16, bitRange=5 +sfr = "CAN_TCR.MB6", "Memory", 0xfffd0024, 4, base=16, bitRange=6 +sfr = "CAN_TCR.MB7", "Memory", 0xfffd0024, 4, base=16, bitRange=7 +sfr = "CAN_TCR.MB8", "Memory", 0xfffd0024, 4, base=16, bitRange=8 +sfr = "CAN_TCR.MB9", "Memory", 0xfffd0024, 4, base=16, bitRange=9 +sfr = "CAN_TCR.MB10", "Memory", 0xfffd0024, 4, base=16, bitRange=10 +sfr = "CAN_TCR.MB11", "Memory", 0xfffd0024, 4, base=16, bitRange=11 +sfr = "CAN_TCR.MB12", "Memory", 0xfffd0024, 4, base=16, bitRange=12 +sfr = "CAN_TCR.MB13", "Memory", 0xfffd0024, 4, base=16, bitRange=13 +sfr = "CAN_TCR.MB14", "Memory", 0xfffd0024, 4, base=16, bitRange=14 +sfr = "CAN_TCR.MB15", "Memory", 0xfffd0024, 4, base=16, bitRange=15 +sfr = "CAN_TCR.TIMRST", "Memory", 0xfffd0024, 4, base=16, bitRange=31 +sfr = "CAN_ACR", "Memory", 0xfffd0028, 4, base=16 +sfr = "CAN_ACR.MB0", "Memory", 0xfffd0028, 4, base=16, bitRange=0 +sfr = "CAN_ACR.MB1", "Memory", 0xfffd0028, 4, base=16, bitRange=1 +sfr = "CAN_ACR.MB2", "Memory", 0xfffd0028, 4, base=16, bitRange=2 +sfr = "CAN_ACR.MB3", "Memory", 0xfffd0028, 4, base=16, bitRange=3 +sfr = "CAN_ACR.MB4", "Memory", 0xfffd0028, 4, base=16, bitRange=4 +sfr = "CAN_ACR.MB5", "Memory", 0xfffd0028, 4, base=16, bitRange=5 +sfr = "CAN_ACR.MB6", "Memory", 0xfffd0028, 4, base=16, bitRange=6 +sfr = "CAN_ACR.MB7", "Memory", 0xfffd0028, 4, base=16, bitRange=7 +sfr = "CAN_ACR.MB8", "Memory", 0xfffd0028, 4, base=16, bitRange=8 +sfr = "CAN_ACR.MB9", "Memory", 0xfffd0028, 4, base=16, bitRange=9 +sfr = "CAN_ACR.MB10", "Memory", 0xfffd0028, 4, base=16, bitRange=10 +sfr = "CAN_ACR.MB11", "Memory", 0xfffd0028, 4, base=16, bitRange=11 +sfr = "CAN_ACR.MB12", "Memory", 0xfffd0028, 4, base=16, bitRange=12 +sfr = "CAN_ACR.MB13", "Memory", 0xfffd0028, 4, base=16, bitRange=13 +sfr = "CAN_ACR.MB14", "Memory", 0xfffd0028, 4, base=16, bitRange=14 +sfr = "CAN_ACR.MB15", "Memory", 0xfffd0028, 4, base=16, bitRange=15 +sfr = "CAN_VR", "Memory", 0xfffd00fc, 4, base=16 +; ========== Register definition for EMAC peripheral ========== +sfr = "EMAC_NCR", "Memory", 0xfffdc000, 4, base=16 +sfr = "EMAC_NCR.LB", "Memory", 0xfffdc000, 4, base=16, bitRange=0 +sfr = "EMAC_NCR.LLB", "Memory", 0xfffdc000, 4, base=16, bitRange=1 +sfr = "EMAC_NCR.RE", "Memory", 0xfffdc000, 4, base=16, bitRange=2 +sfr = "EMAC_NCR.TE", "Memory", 0xfffdc000, 4, base=16, bitRange=3 +sfr = "EMAC_NCR.MPE", "Memory", 0xfffdc000, 4, base=16, bitRange=4 +sfr = "EMAC_NCR.CLRSTAT", "Memory", 0xfffdc000, 4, base=16, bitRange=5 +sfr = "EMAC_NCR.INCSTAT", "Memory", 0xfffdc000, 4, base=16, bitRange=6 +sfr = "EMAC_NCR.WESTAT", "Memory", 0xfffdc000, 4, base=16, bitRange=7 +sfr = "EMAC_NCR.BP", "Memory", 0xfffdc000, 4, base=16, bitRange=8 +sfr = "EMAC_NCR.TSTART", "Memory", 0xfffdc000, 4, base=16, bitRange=9 +sfr = "EMAC_NCR.THALT", "Memory", 0xfffdc000, 4, base=16, bitRange=10 +sfr = "EMAC_NCR.TPFR", "Memory", 0xfffdc000, 4, base=16, bitRange=11 +sfr = "EMAC_NCR.TZQ", "Memory", 0xfffdc000, 4, base=16, bitRange=12 +sfr = "EMAC_NCFGR", "Memory", 0xfffdc004, 4, base=16 +sfr = "EMAC_NCFGR.SPD", "Memory", 0xfffdc004, 4, base=16, bitRange=0 +sfr = "EMAC_NCFGR.FD", "Memory", 0xfffdc004, 4, base=16, bitRange=1 +sfr = "EMAC_NCFGR.JFRAME", "Memory", 0xfffdc004, 4, base=16, bitRange=3 +sfr = "EMAC_NCFGR.CAF", "Memory", 0xfffdc004, 4, base=16, bitRange=4 +sfr = "EMAC_NCFGR.NBC", "Memory", 0xfffdc004, 4, base=16, bitRange=5 +sfr = "EMAC_NCFGR.MTI", "Memory", 0xfffdc004, 4, base=16, bitRange=6 +sfr = "EMAC_NCFGR.UNI", "Memory", 0xfffdc004, 4, base=16, bitRange=7 +sfr = "EMAC_NCFGR.BIG", "Memory", 0xfffdc004, 4, base=16, bitRange=8 +sfr = "EMAC_NCFGR.EAE", "Memory", 0xfffdc004, 4, base=16, bitRange=9 +sfr = "EMAC_NCFGR.CLK", "Memory", 0xfffdc004, 4, base=16, bitRange=10-11 +sfr = "EMAC_NCFGR.RTY", "Memory", 0xfffdc004, 4, base=16, bitRange=12 +sfr = "EMAC_NCFGR.PAE", "Memory", 0xfffdc004, 4, base=16, bitRange=13 +sfr = "EMAC_NCFGR.RBOF", "Memory", 0xfffdc004, 4, base=16, bitRange=14-15 +sfr = "EMAC_NCFGR.RLCE", "Memory", 0xfffdc004, 4, base=16, bitRange=16 +sfr = "EMAC_NCFGR.DRFCS", "Memory", 0xfffdc004, 4, base=16, bitRange=17 +sfr = "EMAC_NCFGR.EFRHD", "Memory", 0xfffdc004, 4, base=16, bitRange=18 +sfr = "EMAC_NCFGR.IRXFCS", "Memory", 0xfffdc004, 4, base=16, bitRange=19 +sfr = "EMAC_NSR", "Memory", 0xfffdc008, 4, base=16 +sfr = "EMAC_NSR.LINKR", "Memory", 0xfffdc008, 4, base=16, bitRange=0 +sfr = "EMAC_NSR.MDIO", "Memory", 0xfffdc008, 4, base=16, bitRange=1 +sfr = "EMAC_NSR.IDLE", "Memory", 0xfffdc008, 4, base=16, bitRange=2 +sfr = "EMAC_TSR", "Memory", 0xfffdc014, 4, base=16 +sfr = "EMAC_TSR.UBR", "Memory", 0xfffdc014, 4, base=16, bitRange=0 +sfr = "EMAC_TSR.COL", "Memory", 0xfffdc014, 4, base=16, bitRange=1 +sfr = "EMAC_TSR.RLES", "Memory", 0xfffdc014, 4, base=16, bitRange=2 +sfr = "EMAC_TSR.TGO", "Memory", 0xfffdc014, 4, base=16, bitRange=3 +sfr = "EMAC_TSR.BEX", "Memory", 0xfffdc014, 4, base=16, bitRange=4 +sfr = "EMAC_TSR.COMP", "Memory", 0xfffdc014, 4, base=16, bitRange=5 +sfr = "EMAC_TSR.UND", "Memory", 0xfffdc014, 4, base=16, bitRange=6 +sfr = "EMAC_RBQP", "Memory", 0xfffdc018, 4, base=16 +sfr = "EMAC_TBQP", "Memory", 0xfffdc01c, 4, base=16 +sfr = "EMAC_RSR", "Memory", 0xfffdc020, 4, base=16 +sfr = "EMAC_RSR.BNA", "Memory", 0xfffdc020, 4, base=16, bitRange=0 +sfr = "EMAC_RSR.REC", "Memory", 0xfffdc020, 4, base=16, bitRange=1 +sfr = "EMAC_RSR.OVR", "Memory", 0xfffdc020, 4, base=16, bitRange=2 +sfr = "EMAC_ISR", "Memory", 0xfffdc024, 4, base=16 +sfr = "EMAC_ISR.MFD", "Memory", 0xfffdc024, 4, base=16, bitRange=0 +sfr = "EMAC_ISR.RCOMP", "Memory", 0xfffdc024, 4, base=16, bitRange=1 +sfr = "EMAC_ISR.RXUBR", "Memory", 0xfffdc024, 4, base=16, bitRange=2 +sfr = "EMAC_ISR.TXUBR", "Memory", 0xfffdc024, 4, base=16, bitRange=3 +sfr = "EMAC_ISR.TUNDR", "Memory", 0xfffdc024, 4, base=16, bitRange=4 +sfr = "EMAC_ISR.RLEX", "Memory", 0xfffdc024, 4, base=16, bitRange=5 +sfr = "EMAC_ISR.TXERR", "Memory", 0xfffdc024, 4, base=16, bitRange=6 +sfr = "EMAC_ISR.TCOMP", "Memory", 0xfffdc024, 4, base=16, bitRange=7 +sfr = "EMAC_ISR.LINK", "Memory", 0xfffdc024, 4, base=16, bitRange=9 +sfr = "EMAC_ISR.ROVR", "Memory", 0xfffdc024, 4, base=16, bitRange=10 +sfr = "EMAC_ISR.HRESP", "Memory", 0xfffdc024, 4, base=16, bitRange=11 +sfr = "EMAC_ISR.PFRE", "Memory", 0xfffdc024, 4, base=16, bitRange=12 +sfr = "EMAC_ISR.PTZ", "Memory", 0xfffdc024, 4, base=16, bitRange=13 +sfr = "EMAC_IER", "Memory", 0xfffdc028, 4, base=16 +sfr = "EMAC_IER.MFD", "Memory", 0xfffdc028, 4, base=16, bitRange=0 +sfr = "EMAC_IER.RCOMP", "Memory", 0xfffdc028, 4, base=16, bitRange=1 +sfr = "EMAC_IER.RXUBR", "Memory", 0xfffdc028, 4, base=16, bitRange=2 +sfr = "EMAC_IER.TXUBR", "Memory", 0xfffdc028, 4, base=16, bitRange=3 +sfr = "EMAC_IER.TUNDR", "Memory", 0xfffdc028, 4, base=16, bitRange=4 +sfr = "EMAC_IER.RLEX", "Memory", 0xfffdc028, 4, base=16, bitRange=5 +sfr = "EMAC_IER.TXERR", "Memory", 0xfffdc028, 4, base=16, bitRange=6 +sfr = "EMAC_IER.TCOMP", "Memory", 0xfffdc028, 4, base=16, bitRange=7 +sfr = "EMAC_IER.LINK", "Memory", 0xfffdc028, 4, base=16, bitRange=9 +sfr = "EMAC_IER.ROVR", "Memory", 0xfffdc028, 4, base=16, bitRange=10 +sfr = "EMAC_IER.HRESP", "Memory", 0xfffdc028, 4, base=16, bitRange=11 +sfr = "EMAC_IER.PFRE", "Memory", 0xfffdc028, 4, base=16, bitRange=12 +sfr = "EMAC_IER.PTZ", "Memory", 0xfffdc028, 4, base=16, bitRange=13 +sfr = "EMAC_IDR", "Memory", 0xfffdc02c, 4, base=16 +sfr = "EMAC_IDR.MFD", "Memory", 0xfffdc02c, 4, base=16, bitRange=0 +sfr = "EMAC_IDR.RCOMP", "Memory", 0xfffdc02c, 4, base=16, bitRange=1 +sfr = "EMAC_IDR.RXUBR", "Memory", 0xfffdc02c, 4, base=16, bitRange=2 +sfr = "EMAC_IDR.TXUBR", "Memory", 0xfffdc02c, 4, base=16, bitRange=3 +sfr = "EMAC_IDR.TUNDR", "Memory", 0xfffdc02c, 4, base=16, bitRange=4 +sfr = "EMAC_IDR.RLEX", "Memory", 0xfffdc02c, 4, base=16, bitRange=5 +sfr = "EMAC_IDR.TXERR", "Memory", 0xfffdc02c, 4, base=16, bitRange=6 +sfr = "EMAC_IDR.TCOMP", "Memory", 0xfffdc02c, 4, base=16, bitRange=7 +sfr = "EMAC_IDR.LINK", "Memory", 0xfffdc02c, 4, base=16, bitRange=9 +sfr = "EMAC_IDR.ROVR", "Memory", 0xfffdc02c, 4, base=16, bitRange=10 +sfr = "EMAC_IDR.HRESP", "Memory", 0xfffdc02c, 4, base=16, bitRange=11 +sfr = "EMAC_IDR.PFRE", "Memory", 0xfffdc02c, 4, base=16, bitRange=12 +sfr = "EMAC_IDR.PTZ", "Memory", 0xfffdc02c, 4, base=16, bitRange=13 +sfr = "EMAC_IMR", "Memory", 0xfffdc030, 4, base=16 +sfr = "EMAC_IMR.MFD", "Memory", 0xfffdc030, 4, base=16, bitRange=0 +sfr = "EMAC_IMR.RCOMP", "Memory", 0xfffdc030, 4, base=16, bitRange=1 +sfr = "EMAC_IMR.RXUBR", "Memory", 0xfffdc030, 4, base=16, bitRange=2 +sfr = "EMAC_IMR.TXUBR", "Memory", 0xfffdc030, 4, base=16, bitRange=3 +sfr = "EMAC_IMR.TUNDR", "Memory", 0xfffdc030, 4, base=16, bitRange=4 +sfr = "EMAC_IMR.RLEX", "Memory", 0xfffdc030, 4, base=16, bitRange=5 +sfr = "EMAC_IMR.TXERR", "Memory", 0xfffdc030, 4, base=16, bitRange=6 +sfr = "EMAC_IMR.TCOMP", "Memory", 0xfffdc030, 4, base=16, bitRange=7 +sfr = "EMAC_IMR.LINK", "Memory", 0xfffdc030, 4, base=16, bitRange=9 +sfr = "EMAC_IMR.ROVR", "Memory", 0xfffdc030, 4, base=16, bitRange=10 +sfr = "EMAC_IMR.HRESP", "Memory", 0xfffdc030, 4, base=16, bitRange=11 +sfr = "EMAC_IMR.PFRE", "Memory", 0xfffdc030, 4, base=16, bitRange=12 +sfr = "EMAC_IMR.PTZ", "Memory", 0xfffdc030, 4, base=16, bitRange=13 +sfr = "EMAC_MAN", "Memory", 0xfffdc034, 4, base=16 +sfr = "EMAC_MAN.DATA", "Memory", 0xfffdc034, 4, base=16, bitRange=0-15 +sfr = "EMAC_MAN.CODE", "Memory", 0xfffdc034, 4, base=16, bitRange=16-17 +sfr = "EMAC_MAN.REGA", "Memory", 0xfffdc034, 4, base=16, bitRange=18-22 +sfr = "EMAC_MAN.PHYA", "Memory", 0xfffdc034, 4, base=16, bitRange=23-27 +sfr = "EMAC_MAN.RW", "Memory", 0xfffdc034, 4, base=16, bitRange=28-29 +sfr = "EMAC_MAN.SOF", "Memory", 0xfffdc034, 4, base=16, bitRange=30-31 +sfr = "EMAC_PTR", "Memory", 0xfffdc038, 4, base=16 +sfr = "EMAC_PFR", "Memory", 0xfffdc03c, 4, base=16 +sfr = "EMAC_FTO", "Memory", 0xfffdc040, 4, base=16 +sfr = "EMAC_SCF", "Memory", 0xfffdc044, 4, base=16 +sfr = "EMAC_MCF", "Memory", 0xfffdc048, 4, base=16 +sfr = "EMAC_FRO", "Memory", 0xfffdc04c, 4, base=16 +sfr = "EMAC_FCSE", "Memory", 0xfffdc050, 4, base=16 +sfr = "EMAC_ALE", "Memory", 0xfffdc054, 4, base=16 +sfr = "EMAC_DTF", "Memory", 0xfffdc058, 4, base=16 +sfr = "EMAC_LCOL", "Memory", 0xfffdc05c, 4, base=16 +sfr = "EMAC_ECOL", "Memory", 0xfffdc060, 4, base=16 +sfr = "EMAC_TUND", "Memory", 0xfffdc064, 4, base=16 +sfr = "EMAC_CSE", "Memory", 0xfffdc068, 4, base=16 +sfr = "EMAC_RRE", "Memory", 0xfffdc06c, 4, base=16 +sfr = "EMAC_ROV", "Memory", 0xfffdc070, 4, base=16 +sfr = "EMAC_RSE", "Memory", 0xfffdc074, 4, base=16 +sfr = "EMAC_ELE", "Memory", 0xfffdc078, 4, base=16 +sfr = "EMAC_RJA", "Memory", 0xfffdc07c, 4, base=16 +sfr = "EMAC_USF", "Memory", 0xfffdc080, 4, base=16 +sfr = "EMAC_STE", "Memory", 0xfffdc084, 4, base=16 +sfr = "EMAC_RLE", "Memory", 0xfffdc088, 4, base=16 +sfr = "EMAC_TPF", "Memory", 0xfffdc08c, 4, base=16 +sfr = "EMAC_HRB", "Memory", 0xfffdc090, 4, base=16 +sfr = "EMAC_HRT", "Memory", 0xfffdc094, 4, base=16 +sfr = "EMAC_SA1L", "Memory", 0xfffdc098, 4, base=16 +sfr = "EMAC_SA1H", "Memory", 0xfffdc09c, 4, base=16 +sfr = "EMAC_SA2L", "Memory", 0xfffdc0a0, 4, base=16 +sfr = "EMAC_SA2H", "Memory", 0xfffdc0a4, 4, base=16 +sfr = "EMAC_SA3L", "Memory", 0xfffdc0a8, 4, base=16 +sfr = "EMAC_SA3H", "Memory", 0xfffdc0ac, 4, base=16 +sfr = "EMAC_SA4L", "Memory", 0xfffdc0b0, 4, base=16 +sfr = "EMAC_SA4H", "Memory", 0xfffdc0b4, 4, base=16 +sfr = "EMAC_TID", "Memory", 0xfffdc0b8, 4, base=16 +sfr = "EMAC_TPQ", "Memory", 0xfffdc0bc, 4, base=16 +sfr = "EMAC_USRIO", "Memory", 0xfffdc0c0, 4, base=16 +sfr = "EMAC_USRIO.RMII", "Memory", 0xfffdc0c0, 4, base=16, bitRange=0 +sfr = "EMAC_USRIO.CLKEN", "Memory", 0xfffdc0c0, 4, base=16, bitRange=1 +sfr = "EMAC_WOL", "Memory", 0xfffdc0c4, 4, base=16 +sfr = "EMAC_WOL.IP", "Memory", 0xfffdc0c4, 4, base=16, bitRange=0-15 +sfr = "EMAC_WOL.MAG", "Memory", 0xfffdc0c4, 4, base=16, bitRange=16 +sfr = "EMAC_WOL.ARP", "Memory", 0xfffdc0c4, 4, base=16, bitRange=17 +sfr = "EMAC_WOL.SA1", "Memory", 0xfffdc0c4, 4, base=16, bitRange=18 +sfr = "EMAC_WOL.MTI", "Memory", 0xfffdc0c4, 4, base=16, bitRange=19 +sfr = "EMAC_REV", "Memory", 0xfffdc0fc, 4, base=16 +sfr = "EMAC_REV.REVREF", "Memory", 0xfffdc0fc, 4, base=16, bitRange=0-15 +sfr = "EMAC_REV.PARTREF", "Memory", 0xfffdc0fc, 4, base=16, bitRange=16-31 +; ========== Register definition for PDC_ADC peripheral ========== +sfr = "ADC_RPR", "Memory", 0xfffd8100, 4, base=16 +sfr = "ADC_RCR", "Memory", 0xfffd8104, 4, base=16 +sfr = "ADC_TPR", "Memory", 0xfffd8108, 4, base=16 +sfr = "ADC_TCR", "Memory", 0xfffd810c, 4, base=16 +sfr = "ADC_RNPR", "Memory", 0xfffd8110, 4, base=16 +sfr = "ADC_RNCR", "Memory", 0xfffd8114, 4, base=16 +sfr = "ADC_TNPR", "Memory", 0xfffd8118, 4, base=16 +sfr = "ADC_TNCR", "Memory", 0xfffd811c, 4, base=16 +sfr = "ADC_PTCR", "Memory", 0xfffd8120, 4, base=16 +sfr = "ADC_PTCR.RXTEN", "Memory", 0xfffd8120, 4, base=16, bitRange=0 +sfr = "ADC_PTCR.RXTDIS", "Memory", 0xfffd8120, 4, base=16, bitRange=1 +sfr = "ADC_PTCR.TXTEN", "Memory", 0xfffd8120, 4, base=16, bitRange=8 +sfr = "ADC_PTCR.TXTDIS", "Memory", 0xfffd8120, 4, base=16, bitRange=9 +sfr = "ADC_PTSR", "Memory", 0xfffd8124, 4, base=16 +sfr = "ADC_PTSR.RXTEN", "Memory", 0xfffd8124, 4, base=16, bitRange=0 +sfr = "ADC_PTSR.TXTEN", "Memory", 0xfffd8124, 4, base=16, bitRange=8 +; ========== Register definition for ADC peripheral ========== +sfr = "ADC_CR", "Memory", 0xfffd8000, 4, base=16 +sfr = "ADC_CR.SWRST", "Memory", 0xfffd8000, 4, base=16, bitRange=0 +sfr = "ADC_CR.START", "Memory", 0xfffd8000, 4, base=16, bitRange=1 +sfr = "ADC_MR", "Memory", 0xfffd8004, 4, base=16 +sfr = "ADC_MR.TRGEN", "Memory", 0xfffd8004, 4, base=16, bitRange=0 +sfr = "ADC_MR.TRGSEL", "Memory", 0xfffd8004, 4, base=16, bitRange=1-3 +sfr = "ADC_MR.LOWRES", "Memory", 0xfffd8004, 4, base=16, bitRange=4 +sfr = "ADC_MR.SLEEP", "Memory", 0xfffd8004, 4, base=16, bitRange=5 +sfr = "ADC_MR.PRESCAL", "Memory", 0xfffd8004, 4, base=16, bitRange=8-13 +sfr = "ADC_MR.STARTUP", "Memory", 0xfffd8004, 4, base=16, bitRange=16-20 +sfr = "ADC_MR.SHTIM", "Memory", 0xfffd8004, 4, base=16, bitRange=24-27 +sfr = "ADC_CHER", "Memory", 0xfffd8010, 4, base=16 +sfr = "ADC_CHER.CH0", "Memory", 0xfffd8010, 4, base=16, bitRange=0 +sfr = "ADC_CHER.CH1", "Memory", 0xfffd8010, 4, base=16, bitRange=1 +sfr = "ADC_CHER.CH2", "Memory", 0xfffd8010, 4, base=16, bitRange=2 +sfr = "ADC_CHER.CH3", "Memory", 0xfffd8010, 4, base=16, bitRange=3 +sfr = "ADC_CHER.CH4", "Memory", 0xfffd8010, 4, base=16, bitRange=4 +sfr = "ADC_CHER.CH5", "Memory", 0xfffd8010, 4, base=16, bitRange=5 +sfr = "ADC_CHER.CH6", "Memory", 0xfffd8010, 4, base=16, bitRange=6 +sfr = "ADC_CHER.CH7", "Memory", 0xfffd8010, 4, base=16, bitRange=7 +sfr = "ADC_CHDR", "Memory", 0xfffd8014, 4, base=16 +sfr = "ADC_CHDR.CH0", "Memory", 0xfffd8014, 4, base=16, bitRange=0 +sfr = "ADC_CHDR.CH1", "Memory", 0xfffd8014, 4, base=16, bitRange=1 +sfr = "ADC_CHDR.CH2", "Memory", 0xfffd8014, 4, base=16, bitRange=2 +sfr = "ADC_CHDR.CH3", "Memory", 0xfffd8014, 4, base=16, bitRange=3 +sfr = "ADC_CHDR.CH4", "Memory", 0xfffd8014, 4, base=16, bitRange=4 +sfr = "ADC_CHDR.CH5", "Memory", 0xfffd8014, 4, base=16, bitRange=5 +sfr = "ADC_CHDR.CH6", "Memory", 0xfffd8014, 4, base=16, bitRange=6 +sfr = "ADC_CHDR.CH7", "Memory", 0xfffd8014, 4, base=16, bitRange=7 +sfr = "ADC_CHSR", "Memory", 0xfffd8018, 4, base=16 +sfr = "ADC_CHSR.CH0", "Memory", 0xfffd8018, 4, base=16, bitRange=0 +sfr = "ADC_CHSR.CH1", "Memory", 0xfffd8018, 4, base=16, bitRange=1 +sfr = "ADC_CHSR.CH2", "Memory", 0xfffd8018, 4, base=16, bitRange=2 +sfr = "ADC_CHSR.CH3", "Memory", 0xfffd8018, 4, base=16, bitRange=3 +sfr = "ADC_CHSR.CH4", "Memory", 0xfffd8018, 4, base=16, bitRange=4 +sfr = "ADC_CHSR.CH5", "Memory", 0xfffd8018, 4, base=16, bitRange=5 +sfr = "ADC_CHSR.CH6", "Memory", 0xfffd8018, 4, base=16, bitRange=6 +sfr = "ADC_CHSR.CH7", "Memory", 0xfffd8018, 4, base=16, bitRange=7 +sfr = "ADC_SR", "Memory", 0xfffd801c, 4, base=16 +sfr = "ADC_SR.EOC0", "Memory", 0xfffd801c, 4, base=16, bitRange=0 +sfr = "ADC_SR.EOC1", "Memory", 0xfffd801c, 4, base=16, bitRange=1 +sfr = "ADC_SR.EOC2", "Memory", 0xfffd801c, 4, base=16, bitRange=2 +sfr = "ADC_SR.EOC3", "Memory", 0xfffd801c, 4, base=16, bitRange=3 +sfr = "ADC_SR.EOC4", "Memory", 0xfffd801c, 4, base=16, bitRange=4 +sfr = "ADC_SR.EOC5", "Memory", 0xfffd801c, 4, base=16, bitRange=5 +sfr = "ADC_SR.EOC6", "Memory", 0xfffd801c, 4, base=16, bitRange=6 +sfr = "ADC_SR.EOC7", "Memory", 0xfffd801c, 4, base=16, bitRange=7 +sfr = "ADC_SR.OVRE0", "Memory", 0xfffd801c, 4, base=16, bitRange=8 +sfr = "ADC_SR.OVRE1", "Memory", 0xfffd801c, 4, base=16, bitRange=9 +sfr = "ADC_SR.OVRE2", "Memory", 0xfffd801c, 4, base=16, bitRange=10 +sfr = "ADC_SR.OVRE3", "Memory", 0xfffd801c, 4, base=16, bitRange=11 +sfr = "ADC_SR.OVRE4", "Memory", 0xfffd801c, 4, base=16, bitRange=12 +sfr = "ADC_SR.OVRE5", "Memory", 0xfffd801c, 4, base=16, bitRange=13 +sfr = "ADC_SR.OVRE6", "Memory", 0xfffd801c, 4, base=16, bitRange=14 +sfr = "ADC_SR.OVRE7", "Memory", 0xfffd801c, 4, base=16, bitRange=15 +sfr = "ADC_SR.DRDY", "Memory", 0xfffd801c, 4, base=16, bitRange=16 +sfr = "ADC_SR.GOVRE", "Memory", 0xfffd801c, 4, base=16, bitRange=17 +sfr = "ADC_SR.ENDRX", "Memory", 0xfffd801c, 4, base=16, bitRange=18 +sfr = "ADC_SR.RXBUFF", "Memory", 0xfffd801c, 4, base=16, bitRange=19 +sfr = "ADC_LCDR", "Memory", 0xfffd8020, 4, base=16 +sfr = "ADC_LCDR.LDATA", "Memory", 0xfffd8020, 4, base=16, bitRange=0-9 +sfr = "ADC_IER", "Memory", 0xfffd8024, 4, base=16 +sfr = "ADC_IER.EOC0", "Memory", 0xfffd8024, 4, base=16, bitRange=0 +sfr = "ADC_IER.EOC1", "Memory", 0xfffd8024, 4, base=16, bitRange=1 +sfr = "ADC_IER.EOC2", "Memory", 0xfffd8024, 4, base=16, bitRange=2 +sfr = "ADC_IER.EOC3", "Memory", 0xfffd8024, 4, base=16, bitRange=3 +sfr = "ADC_IER.EOC4", "Memory", 0xfffd8024, 4, base=16, bitRange=4 +sfr = "ADC_IER.EOC5", "Memory", 0xfffd8024, 4, base=16, bitRange=5 +sfr = "ADC_IER.EOC6", "Memory", 0xfffd8024, 4, base=16, bitRange=6 +sfr = "ADC_IER.EOC7", "Memory", 0xfffd8024, 4, base=16, bitRange=7 +sfr = "ADC_IER.OVRE0", "Memory", 0xfffd8024, 4, base=16, bitRange=8 +sfr = "ADC_IER.OVRE1", "Memory", 0xfffd8024, 4, base=16, bitRange=9 +sfr = "ADC_IER.OVRE2", "Memory", 0xfffd8024, 4, base=16, bitRange=10 +sfr = "ADC_IER.OVRE3", "Memory", 0xfffd8024, 4, base=16, bitRange=11 +sfr = "ADC_IER.OVRE4", "Memory", 0xfffd8024, 4, base=16, bitRange=12 +sfr = "ADC_IER.OVRE5", "Memory", 0xfffd8024, 4, base=16, bitRange=13 +sfr = "ADC_IER.OVRE6", "Memory", 0xfffd8024, 4, base=16, bitRange=14 +sfr = "ADC_IER.OVRE7", "Memory", 0xfffd8024, 4, base=16, bitRange=15 +sfr = "ADC_IER.DRDY", "Memory", 0xfffd8024, 4, base=16, bitRange=16 +sfr = "ADC_IER.GOVRE", "Memory", 0xfffd8024, 4, base=16, bitRange=17 +sfr = "ADC_IER.ENDRX", "Memory", 0xfffd8024, 4, base=16, bitRange=18 +sfr = "ADC_IER.RXBUFF", "Memory", 0xfffd8024, 4, base=16, bitRange=19 +sfr = "ADC_IDR", "Memory", 0xfffd8028, 4, base=16 +sfr = "ADC_IDR.EOC0", "Memory", 0xfffd8028, 4, base=16, bitRange=0 +sfr = "ADC_IDR.EOC1", "Memory", 0xfffd8028, 4, base=16, bitRange=1 +sfr = "ADC_IDR.EOC2", "Memory", 0xfffd8028, 4, base=16, bitRange=2 +sfr = "ADC_IDR.EOC3", "Memory", 0xfffd8028, 4, base=16, bitRange=3 +sfr = "ADC_IDR.EOC4", "Memory", 0xfffd8028, 4, base=16, bitRange=4 +sfr = "ADC_IDR.EOC5", "Memory", 0xfffd8028, 4, base=16, bitRange=5 +sfr = "ADC_IDR.EOC6", "Memory", 0xfffd8028, 4, base=16, bitRange=6 +sfr = "ADC_IDR.EOC7", "Memory", 0xfffd8028, 4, base=16, bitRange=7 +sfr = "ADC_IDR.OVRE0", "Memory", 0xfffd8028, 4, base=16, bitRange=8 +sfr = "ADC_IDR.OVRE1", "Memory", 0xfffd8028, 4, base=16, bitRange=9 +sfr = "ADC_IDR.OVRE2", "Memory", 0xfffd8028, 4, base=16, bitRange=10 +sfr = "ADC_IDR.OVRE3", "Memory", 0xfffd8028, 4, base=16, bitRange=11 +sfr = "ADC_IDR.OVRE4", "Memory", 0xfffd8028, 4, base=16, bitRange=12 +sfr = "ADC_IDR.OVRE5", "Memory", 0xfffd8028, 4, base=16, bitRange=13 +sfr = "ADC_IDR.OVRE6", "Memory", 0xfffd8028, 4, base=16, bitRange=14 +sfr = "ADC_IDR.OVRE7", "Memory", 0xfffd8028, 4, base=16, bitRange=15 +sfr = "ADC_IDR.DRDY", "Memory", 0xfffd8028, 4, base=16, bitRange=16 +sfr = "ADC_IDR.GOVRE", "Memory", 0xfffd8028, 4, base=16, bitRange=17 +sfr = "ADC_IDR.ENDRX", "Memory", 0xfffd8028, 4, base=16, bitRange=18 +sfr = "ADC_IDR.RXBUFF", "Memory", 0xfffd8028, 4, base=16, bitRange=19 +sfr = "ADC_IMR", "Memory", 0xfffd802c, 4, base=16 +sfr = "ADC_IMR.EOC0", "Memory", 0xfffd802c, 4, base=16, bitRange=0 +sfr = "ADC_IMR.EOC1", "Memory", 0xfffd802c, 4, base=16, bitRange=1 +sfr = "ADC_IMR.EOC2", "Memory", 0xfffd802c, 4, base=16, bitRange=2 +sfr = "ADC_IMR.EOC3", "Memory", 0xfffd802c, 4, base=16, bitRange=3 +sfr = "ADC_IMR.EOC4", "Memory", 0xfffd802c, 4, base=16, bitRange=4 +sfr = "ADC_IMR.EOC5", "Memory", 0xfffd802c, 4, base=16, bitRange=5 +sfr = "ADC_IMR.EOC6", "Memory", 0xfffd802c, 4, base=16, bitRange=6 +sfr = "ADC_IMR.EOC7", "Memory", 0xfffd802c, 4, base=16, bitRange=7 +sfr = "ADC_IMR.OVRE0", "Memory", 0xfffd802c, 4, base=16, bitRange=8 +sfr = "ADC_IMR.OVRE1", "Memory", 0xfffd802c, 4, base=16, bitRange=9 +sfr = "ADC_IMR.OVRE2", "Memory", 0xfffd802c, 4, base=16, bitRange=10 +sfr = "ADC_IMR.OVRE3", "Memory", 0xfffd802c, 4, base=16, bitRange=11 +sfr = "ADC_IMR.OVRE4", "Memory", 0xfffd802c, 4, base=16, bitRange=12 +sfr = "ADC_IMR.OVRE5", "Memory", 0xfffd802c, 4, base=16, bitRange=13 +sfr = "ADC_IMR.OVRE6", "Memory", 0xfffd802c, 4, base=16, bitRange=14 +sfr = "ADC_IMR.OVRE7", "Memory", 0xfffd802c, 4, base=16, bitRange=15 +sfr = "ADC_IMR.DRDY", "Memory", 0xfffd802c, 4, base=16, bitRange=16 +sfr = "ADC_IMR.GOVRE", "Memory", 0xfffd802c, 4, base=16, bitRange=17 +sfr = "ADC_IMR.ENDRX", "Memory", 0xfffd802c, 4, base=16, bitRange=18 +sfr = "ADC_IMR.RXBUFF", "Memory", 0xfffd802c, 4, base=16, bitRange=19 +sfr = "ADC_CDR0", "Memory", 0xfffd8030, 4, base=16 +sfr = "ADC_CDR0.DATA", "Memory", 0xfffd8030, 4, base=16, bitRange=0-9 +sfr = "ADC_CDR1", "Memory", 0xfffd8034, 4, base=16 +sfr = "ADC_CDR1.DATA", "Memory", 0xfffd8034, 4, base=16, bitRange=0-9 +sfr = "ADC_CDR2", "Memory", 0xfffd8038, 4, base=16 +sfr = "ADC_CDR2.DATA", "Memory", 0xfffd8038, 4, base=16, bitRange=0-9 +sfr = "ADC_CDR3", "Memory", 0xfffd803c, 4, base=16 +sfr = "ADC_CDR3.DATA", "Memory", 0xfffd803c, 4, base=16, bitRange=0-9 +sfr = "ADC_CDR4", "Memory", 0xfffd8040, 4, base=16 +sfr = "ADC_CDR4.DATA", "Memory", 0xfffd8040, 4, base=16, bitRange=0-9 +sfr = "ADC_CDR5", "Memory", 0xfffd8044, 4, base=16 +sfr = "ADC_CDR5.DATA", "Memory", 0xfffd8044, 4, base=16, bitRange=0-9 +sfr = "ADC_CDR6", "Memory", 0xfffd8048, 4, base=16 +sfr = "ADC_CDR6.DATA", "Memory", 0xfffd8048, 4, base=16, bitRange=0-9 +sfr = "ADC_CDR7", "Memory", 0xfffd804c, 4, base=16 +sfr = "ADC_CDR7.DATA", "Memory", 0xfffd804c, 4, base=16, bitRange=0-9 + + +[SfrGroupInfo] +group = "TC0", "TC0_CCR", "TC0_CMR", "TC0_CV", "TC0_RA", "TC0_RB", "TC0_RC", "TC0_SR", "TC0_IER", "TC0_IDR", "TC0_IMR" +group = "TCB", "TCB_BCR", "TCB_BMR" +group = "TC1", "TC1_CCR", "TC1_CMR", "TC1_CV", "TC1_RA", "TC1_RB", "TC1_RC", "TC1_SR", "TC1_IER", "TC1_IDR", "TC1_IMR" +group = "TC2", "TC2_CCR", "TC2_CMR", "TC2_CV", "TC2_RA", "TC2_RB", "TC2_RC", "TC2_SR", "TC2_IER", "TC2_IDR", "TC2_IMR" +group = "UDP", "UDP_NUM", "UDP_GLBSTATE", "UDP_FADDR", "UDP_IER", "UDP_IDR", "UDP_IMR", "UDP_ISR", "UDP_ICR", "UDP_RSTEP", "UDP_CSR", "UDP_FDR", "UDP_TXVC" +group = "TWI", "TWI_CR", "TWI_MMR", "TWI_IADR", "TWI_CWGR", "TWI_SR", "TWI_IER", "TWI_IDR", "TWI_IMR", "TWI_RHR", "TWI_THR" +group = "US0", "US0_CR", "US0_MR", "US0_IER", "US0_IDR", "US0_IMR", "US0_CSR", "US0_RHR", "US0_THR", "US0_BRGR", "US0_RTOR", "US0_TTGR", "US0_FIDI", "US0_NER", "US0_IF" +group = "PDC_US0", "US0_RPR", "US0_RCR", "US0_TPR", "US0_TCR", "US0_RNPR", "US0_RNCR", "US0_TNPR", "US0_TNCR", "US0_PTCR", "US0_PTSR" +group = "US1", "US1_CR", "US1_MR", "US1_IER", "US1_IDR", "US1_IMR", "US1_CSR", "US1_RHR", "US1_THR", "US1_BRGR", "US1_RTOR", "US1_TTGR", "US1_FIDI", "US1_NER", "US1_IF" +group = "PDC_US1", "US1_RPR", "US1_RCR", "US1_TPR", "US1_TCR", "US1_RNPR", "US1_RNCR", "US1_TNPR", "US1_TNCR", "US1_PTCR", "US1_PTSR" +group = "PWMC", "PWMC_MR", "PWMC_ENA", "PWMC_DIS", "PWMC_SR", "PWMC_IER", "PWMC_IDR", "PWMC_IMR", "PWMC_ISR", "PWMC_VR" +group = "PWMC_CH0", "PWMC_CH0_CMR", "PWMC_CH0_CDTYR", "PWMC_CH0_CPRDR", "PWMC_CH0_CCNTR", "PWMC_CH0_CUPDR", "PWMC_CH0_Reserved" +group = "PWMC_CH1", "PWMC_CH1_CMR", "PWMC_CH1_CDTYR", "PWMC_CH1_CPRDR", "PWMC_CH1_CCNTR", "PWMC_CH1_CUPDR", "PWMC_CH1_Reserved" +group = "PWMC_CH2", "PWMC_CH2_CMR", "PWMC_CH2_CDTYR", "PWMC_CH2_CPRDR", "PWMC_CH2_CCNTR", "PWMC_CH2_CUPDR", "PWMC_CH2_Reserved" +group = "PWMC_CH3", "PWMC_CH3_CMR", "PWMC_CH3_CDTYR", "PWMC_CH3_CPRDR", "PWMC_CH3_CCNTR", "PWMC_CH3_CUPDR", "PWMC_CH3_Reserved" +group = "CAN", "CAN_MR", "CAN_IER", "CAN_IDR", "CAN_IMR", "CAN_SR", "CAN_BR", "CAN_TIM", "CAN_TIMESTP", "CAN_ECR", "CAN_TCR", "CAN_ACR", "CAN_VR" +group = "CAN_MB0", "CAN_MB0_MMR", "CAN_MB0_MAM", "CAN_MB0_MID", "CAN_MB0_MFID", "CAN_MB0_MSR", "CAN_MB0_MDL", "CAN_MB0_MDH", "CAN_MB0_MCR" +group = "CAN_MB1", "CAN_MB1_MMR", "CAN_MB1_MAM", "CAN_MB1_MID", "CAN_MB1_MFID", "CAN_MB1_MSR", "CAN_MB1_MDL", "CAN_MB1_MDH", "CAN_MB1_MCR" +group = "CAN_MB2", "CAN_MB2_MMR", "CAN_MB2_MAM", "CAN_MB2_MID", "CAN_MB2_MFID", "CAN_MB2_MSR", "CAN_MB2_MDL", "CAN_MB2_MDH", "CAN_MB2_MCR" +group = "CAN_MB3", "CAN_MB3_MMR", "CAN_MB3_MAM", "CAN_MB3_MID", "CAN_MB3_MFID", "CAN_MB3_MSR", "CAN_MB3_MDL", "CAN_MB3_MDH", "CAN_MB3_MCR" +group = "CAN_MB4", "CAN_MB4_MMR", "CAN_MB4_MAM", "CAN_MB4_MID", "CAN_MB4_MFID", "CAN_MB4_MSR", "CAN_MB4_MDL", "CAN_MB4_MDH", "CAN_MB4_MCR" +group = "CAN_MB5", "CAN_MB5_MMR", "CAN_MB5_MAM", "CAN_MB5_MID", "CAN_MB5_MFID", "CAN_MB5_MSR", "CAN_MB5_MDL", "CAN_MB5_MDH", "CAN_MB5_MCR" +group = "CAN_MB6", "CAN_MB6_MMR", "CAN_MB6_MAM", "CAN_MB6_MID", "CAN_MB6_MFID", "CAN_MB6_MSR", "CAN_MB6_MDL", "CAN_MB6_MDH", "CAN_MB6_MCR" +group = "CAN_MB7", "CAN_MB7_MMR", "CAN_MB7_MAM", "CAN_MB7_MID", "CAN_MB7_MFID", "CAN_MB7_MSR", "CAN_MB7_MDL", "CAN_MB7_MDH", "CAN_MB7_MCR" +group = "SSC", "SSC_CR", "SSC_CMR", "SSC_RCMR", "SSC_RFMR", "SSC_TCMR", "SSC_TFMR", "SSC_RHR", "SSC_THR", "SSC_RSHR", "SSC_TSHR", "SSC_SR", "SSC_IER", "SSC_IDR", "SSC_IMR" +group = "PDC_SSC", "SSC_RPR", "SSC_RCR", "SSC_TPR", "SSC_TCR", "SSC_RNPR", "SSC_RNCR", "SSC_TNPR", "SSC_TNCR", "SSC_PTCR", "SSC_PTSR" +group = "ADC", "ADC_CR", "ADC_MR", "ADC_CHER", "ADC_CHDR", "ADC_CHSR", "ADC_SR", "ADC_LCDR", "ADC_IER", "ADC_IDR", "ADC_IMR", "ADC_CDR0", "ADC_CDR1", "ADC_CDR2", "ADC_CDR3", "ADC_CDR4", "ADC_CDR5", "ADC_CDR6", "ADC_CDR7" +group = "PDC_ADC", "ADC_RPR", "ADC_RCR", "ADC_TPR", "ADC_TCR", "ADC_RNPR", "ADC_RNCR", "ADC_TNPR", "ADC_TNCR", "ADC_PTCR", "ADC_PTSR" +group = "EMAC", "EMAC_NCR", "EMAC_NCFGR", "EMAC_NSR", "EMAC_TSR", "EMAC_RBQP", "EMAC_TBQP", "EMAC_RSR", "EMAC_ISR", "EMAC_IER", "EMAC_IDR", "EMAC_IMR", "EMAC_MAN", "EMAC_PTR", "EMAC_PFR", "EMAC_FTO", "EMAC_SCF", "EMAC_MCF", "EMAC_FRO", "EMAC_FCSE", "EMAC_ALE", "EMAC_DTF", "EMAC_LCOL", "EMAC_ECOL", "EMAC_TUND", "EMAC_CSE", "EMAC_RRE", "EMAC_ROV", "EMAC_RSE", "EMAC_ELE", "EMAC_RJA", "EMAC_USF", "EMAC_STE", "EMAC_RLE", "EMAC_TPF", "EMAC_HRB", "EMAC_HRT", "EMAC_SA1L", "EMAC_SA1H", "EMAC_SA2L", "EMAC_SA2H", "EMAC_SA3L", "EMAC_SA3H", "EMAC_SA4L", "EMAC_SA4H", "EMAC_TID", "EMAC_TPQ", "EMAC_USRIO", "EMAC_WOL", "EMAC_REV" +group = "SPI0", "SPI0_CR", "SPI0_MR", "SPI0_RDR", "SPI0_TDR", "SPI0_SR", "SPI0_IER", "SPI0_IDR", "SPI0_IMR", "SPI0_CSR" +group = "PDC_SPI0", "SPI0_RPR", "SPI0_RCR", "SPI0_TPR", "SPI0_TCR", "SPI0_RNPR", "SPI0_RNCR", "SPI0_TNPR", "SPI0_TNCR", "SPI0_PTCR", "SPI0_PTSR" +group = "SPI1", "SPI1_CR", "SPI1_MR", "SPI1_RDR", "SPI1_TDR", "SPI1_SR", "SPI1_IER", "SPI1_IDR", "SPI1_IMR", "SPI1_CSR" +group = "PDC_SPI1", "SPI1_RPR", "SPI1_RCR", "SPI1_TPR", "SPI1_TCR", "SPI1_RNPR", "SPI1_RNCR", "SPI1_TNPR", "SPI1_TNCR", "SPI1_PTCR", "SPI1_PTSR" +group = "SYS" +group = "AIC", "AIC_SMR", "AIC_SVR", "AIC_IVR", "AIC_FVR", "AIC_ISR", "AIC_IPR", "AIC_IMR", "AIC_CISR", "AIC_IECR", "AIC_IDCR", "AIC_ICCR", "AIC_ISCR", "AIC_EOICR", "AIC_SPU", "AIC_DCR", "AIC_FFER", "AIC_FFDR", "AIC_FFSR" +group = "DBGU", "DBGU_CR", "DBGU_MR", "DBGU_IER", "DBGU_IDR", "DBGU_IMR", "DBGU_CSR", "DBGU_RHR", "DBGU_THR", "DBGU_BRGR", "DBGU_CIDR", "DBGU_EXID", "DBGU_FNTR" +group = "PDC_DBGU", "DBGU_RPR", "DBGU_RCR", "DBGU_TPR", "DBGU_TCR", "DBGU_RNPR", "DBGU_RNCR", "DBGU_TNPR", "DBGU_TNCR", "DBGU_PTCR", "DBGU_PTSR" +group = "PIOA", "PIOA_PER", "PIOA_PDR", "PIOA_PSR", "PIOA_OER", "PIOA_ODR", "PIOA_OSR", "PIOA_IFER", "PIOA_IFDR", "PIOA_IFSR", "PIOA_SODR", "PIOA_CODR", "PIOA_ODSR", "PIOA_PDSR", "PIOA_IER", "PIOA_IDR", "PIOA_IMR", "PIOA_ISR", "PIOA_MDER", "PIOA_MDDR", "PIOA_MDSR", "PIOA_PPUDR", "PIOA_PPUER", "PIOA_PPUSR", "PIOA_ASR", "PIOA_BSR", "PIOA_ABSR", "PIOA_OWER", "PIOA_OWDR", "PIOA_OWSR" +group = "PIOB", "PIOB_PER", "PIOB_PDR", "PIOB_PSR", "PIOB_OER", "PIOB_ODR", "PIOB_OSR", "PIOB_IFER", "PIOB_IFDR", "PIOB_IFSR", "PIOB_SODR", "PIOB_CODR", "PIOB_ODSR", "PIOB_PDSR", "PIOB_IER", "PIOB_IDR", "PIOB_IMR", "PIOB_ISR", "PIOB_MDER", "PIOB_MDDR", "PIOB_MDSR", "PIOB_PPUDR", "PIOB_PPUER", "PIOB_PPUSR", "PIOB_ASR", "PIOB_BSR", "PIOB_ABSR", "PIOB_OWER", "PIOB_OWDR", "PIOB_OWSR" +group = "PMC", "PMC_SCER", "PMC_SCDR", "PMC_SCSR", "PMC_PCER", "PMC_PCDR", "PMC_PCSR", "PMC_MOR", "PMC_MCFR", "PMC_PLLR", "PMC_MCKR", "PMC_PCKR", "PMC_IER", "PMC_IDR", "PMC_SR", "PMC_IMR" +group = "CKGR", "CKGR_MOR", "CKGR_MCFR", "CKGR_PLLR" +group = "RSTC", "RSTC_RCR", "RSTC_RSR", "RSTC_RMR" +group = "RTTC", "RTTC_RTMR", "RTTC_RTAR", "RTTC_RTVR", "RTTC_RTSR" +group = "PITC", "PITC_PIMR", "PITC_PISR", "PITC_PIVR", "PITC_PIIR" +group = "WDTC", "WDTC_WDCR", "WDTC_WDMR", "WDTC_WDSR" +group = "VREG", "VREG_MR" +group = "MC", "MC_RCR", "MC_ASR", "MC_AASR", "MC_FMR", "MC_FCR", "MC_FSR" diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/cmock_demo.dep b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/cmock_demo.dep new file mode 100644 index 0000000..ed68769 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/cmock_demo.dep @@ -0,0 +1,3691 @@ + + + + 2 + + Debug + + $PROJ_DIR$\Debug\Obj\Main.r79 + $PROJ_DIR$\Debug\Obj\IntrinsicsWrapper.r79 + $PROJ_DIR$\Debug\Obj\cmock_demo.pbd + $PROJ_DIR$\Debug\Obj\TimerInterruptConfigurator.r79 + $PROJ_DIR$\Debug\Obj\AdcConductor.r79 + $PROJ_DIR$\Debug\Obj\AdcModel.pbi + $PROJ_DIR$\Debug\Obj\Model.pbi + $PROJ_DIR$\Debug\Obj\AdcModel.r79 + $PROJ_DIR$\Debug\Obj\UsartModel.r79 + $PROJ_DIR$\Debug\Obj\TemperatureFilter.pbi + $PROJ_DIR$\Debug\List\AdcHardwareConfigurator.lst + $PROJ_DIR$\Debug\Obj\UsartConductor.pbi + $PROJ_DIR$\..\..\examples\src\Types.h + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.h + $TOOLKIT_DIR$\inc\DLib_Defaults.h + $PROJ_DIR$\..\..\examples\src\AT91SAM7X256.h + $PROJ_DIR$\..\..\examples\src\AdcConductor.h + $PROJ_DIR$\Debug\List\TimerInterruptHandler.lst + $PROJ_DIR$\..\..\examples\src\TaskScheduler.h + $PROJ_DIR$\..\..\examples\src\UsartConductor.h + $PROJ_DIR$\..\..\examples\src\Model.h + $TOOLKIT_DIR$\inc\intrinsics.h + $PROJ_DIR$\Debug\Obj\UsartHardware.pbi + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.h + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.h + $PROJ_DIR$\Debug\Exe\cmock_demo.d79 + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.h + $PROJ_DIR$\..\..\examples\src\AdcHardware.h + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.h + $PROJ_DIR$\..\..\examples\src\TimerConductor.h + $PROJ_DIR$\..\..\examples\src\UsartPutChar.h + $PROJ_DIR$\Debug\Obj\Executor.pbi + $PROJ_DIR$\..\..\examples\src\UsartModel.h + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.h + $PROJ_DIR$\Debug\List\UsartBaudRateRegisterCalculator.lst + $PROJ_DIR$\..\..\examples\src\UsartHardware.h + $PROJ_DIR$\Debug\List\UsartModel.lst + $PROJ_DIR$\Debug\List\Executor.lst + $PROJ_DIR$\Debug\List\UsartTransmitBufferStatus.lst + $PROJ_DIR$\Debug\Exe\cmock_demo.sim + $PROJ_DIR$\Debug\List\TimerModel.lst + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.h + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.h + $PROJ_DIR$\Debug\List\TimerHardware.lst + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.h + $PROJ_DIR$\Debug\Obj\UsartTransmitBufferStatus.r79 + $PROJ_DIR$\..\..\examples\src\TimerModel.h + $PROJ_DIR$\Debug\List\IntrinsicsWrapper.lst + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.h + $PROJ_DIR$\..\..\examples\src\TimerHardware.h + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.h + $PROJ_DIR$\Debug\List\Cstartup_SAM7.lst + $TOOLKIT_DIR$\inc\DLib_Product.h + $PROJ_DIR$\Debug\Obj\UsartModel.pbi + $TOOLKIT_DIR$\inc\math.h + $PROJ_DIR$\Debug\Obj\AdcHardware.r79 + $PROJ_DIR$\Debug\Obj\TimerModel.r79 + $TOOLKIT_DIR$\inc\stdio.h + $PROJ_DIR$\Debug\Obj\UsartConfigurator.pbi + $PROJ_DIR$\Debug\List\AdcModel.lst + $PROJ_DIR$\Debug\List\AdcConductor.lst + $PROJ_DIR$\Debug\List\UsartConductor.lst + $PROJ_DIR$\Debug\List\Model.lst + $PROJ_DIR$\Debug\List\TaskScheduler.lst + $PROJ_DIR$\Debug\List\UsartHardware.lst + $PROJ_DIR$\Debug\List\AdcHardware.lst + $PROJ_DIR$\Debug\List\Main.lst + $PROJ_DIR$\Debug\Obj\UsartBaudRateRegisterCalculator.r79 + $PROJ_DIR$\Debug\Obj\AdcConductor.pbi + $PROJ_DIR$\Debug\Obj\TaskScheduler.pbi + $PROJ_DIR$\Debug\List\UsartConfigurator.lst + $PROJ_DIR$\Debug\Obj\TaskScheduler.r79 + $TOOLKIT_DIR$\inc\ymath.h + $PROJ_DIR$\Debug\Obj\TemperatureFilter.r79 + $TOOLKIT_DIR$\inc\ysizet.h + $PROJ_DIR$\Debug\Obj\TimerHardware.pbi + $PROJ_DIR$\Debug\Obj\TemperatureCalculator.r79 + $PROJ_DIR$\Debug\Obj\AdcTemperatureSensor.pbi + $PROJ_DIR$\Debug\List\TemperatureCalculator.lst + $PROJ_DIR$\Debug\List\AdcTemperatureSensor.lst + $TOOLKIT_DIR$\lib\dl4tptinl8n.h + $PROJ_DIR$\Debug\Obj\AdcHardware.pbi + $PROJ_DIR$\Debug\Obj\UsartConfigurator.r79 + $TOOLKIT_DIR$\inc\xencoding_limits.h + $PROJ_DIR$\Debug\Obj\TimerConfigurator.r79 + $PROJ_DIR$\Debug\Obj\AdcTemperatureSensor.r79 + $PROJ_DIR$\Debug\Obj\Main.pbi + $TOOLKIT_DIR$\lib\dl4tptinl8n.r79 + $PROJ_DIR$\Debug\Obj\TimerInterruptHandler.r79 + $PROJ_DIR$\Debug\Obj\UsartHardware.r79 + $PROJ_DIR$\Debug\Obj\UsartPutChar.pbi + $PROJ_DIR$\Debug\Obj\TimerInterruptConfigurator.pbi + $TOOLKIT_DIR$\inc\yvals.h + $PROJ_DIR$\Debug\Obj\UsartTransmitBufferStatus.pbi + $PROJ_DIR$\Debug\Obj\IntrinsicsWrapper.pbi + $PROJ_DIR$\Debug\Obj\AdcHardwareConfigurator.r79 + $PROJ_DIR$\incIAR\AT91SAM7X256_inc.h + $TOOLKIT_DIR$\inc\DLib_Threads.h + $PROJ_DIR$\Debug\Obj\TimerConfigurator.pbi + $PROJ_DIR$\Debug\Obj\TimerConductor.pbi + $PROJ_DIR$\Debug\Obj\TimerInterruptHandler.pbi + $PROJ_DIR$\Debug\Obj\UsartPutChar.r79 + $PROJ_DIR$\Debug\Obj\UsartConductor.r79 + $PROJ_DIR$\Debug\Obj\TimerHardware.r79 + $PROJ_DIR$\Debug\Obj\Cstartup_SAM7.r79 + $PROJ_DIR$\Debug\List\cmock_demo.map + $PROJ_DIR$\Debug\List\TimerInterruptConfigurator.lst + $PROJ_DIR$\Debug\Obj\TimerConductor.r79 + $PROJ_DIR$\Debug\Obj\Model.r79 + $PROJ_DIR$\Debug\Obj\UsartBaudRateRegisterCalculator.pbi + $PROJ_DIR$\Debug\Obj\AdcHardwareConfigurator.pbi + $PROJ_DIR$\Debug\Obj\TemperatureCalculator.pbi + $PROJ_DIR$\Debug\Obj\Cstartup_SAM7.pbi + $PROJ_DIR$\Resource\at91SAM7X256_FLASH.xcl + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + $PROJ_DIR$\..\..\examples\src\TimerModel.c + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + $PROJ_DIR$\..\..\examples\src\UsartModel.c + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + $PROJ_DIR$\Cstartup.s79 + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + $PROJ_DIR$\Cstartup_SAM7.c + $PROJ_DIR$\..\..\examples\src\AdcModel.c + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + $PROJ_DIR$\..\..\examples\src\Executor.c + $PROJ_DIR$\..\..\examples\src\Main.c + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + $PROJ_DIR$\..\..\examples\src\Model.c + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + $PROJ_DIR$\Debug\Obj\Cstartup.r79 + $PROJ_DIR$\Debug\List\TimerConfigurator.lst + $PROJ_DIR$\..\..\examples\src\Executor.h + $PROJ_DIR$\Debug\List\TimerConductor.lst + $PROJ_DIR$\..\..\examples\src\AdcModel.h + $PROJ_DIR$\..\..\examples\src\ModelConfig.h + $PROJ_DIR$\Debug\Obj\Executor.r79 + $PROJ_DIR$\Debug\List\UsartPutChar.lst + $PROJ_DIR$\Debug\List\TemperatureFilter.lst + $PROJ_DIR$\Debug\Obj\TimerModel.pbi + $PROJ_DIR$\srcIAR\Cstartup.s79 + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + + + [ROOT_NODE] + + + XLINK + 25 105 39 + + + + + $PROJ_DIR$\Debug\Obj\cmock_demo.pbd + + + BILINK + 68 81 110 5 77 112 31 94 86 6 69 111 9 99 98 75 91 100 150 109 11 58 22 53 90 93 + + + + + $PROJ_DIR$\Debug\Exe\cmock_demo.d79 + + + XLINK + 105 39 + + + + + XLINK + 113 4 55 95 7 85 141 104 147 1 0 108 71 76 73 107 84 103 3 88 56 67 102 82 89 8 101 45 87 + + + + + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + + + ICCARM + 107 144 + + + BICOMP + 99 + + + + + ICCARM + 12 15 29 46 49 44 + + + BICOMP + 12 15 29 46 49 44 + + + + + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + + + ICCARM + 84 142 + + + BICOMP + 98 + + + + + ICCARM + 12 15 48 42 + + + BICOMP + 12 15 48 42 + + + + + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + + + ICCARM + 103 43 + + + BICOMP + 75 + + + + + ICCARM + 12 15 49 48 + + + BICOMP + 12 15 49 48 + + + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + + + ICCARM + 3 106 + + + BICOMP + 91 + + + + + ICCARM + 12 15 42 44 + + + BICOMP + 12 15 42 44 + + + + + $PROJ_DIR$\..\..\examples\src\TimerModel.c + + + ICCARM + 56 40 + + + BICOMP + 150 + + + + + ICCARM + 12 15 46 18 + + + BICOMP + 12 15 46 18 + + + + + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + + + ICCARM + 67 34 + + + BICOMP + 109 + + + + + ICCARM + 12 15 50 + + + BICOMP + 12 15 50 + + + + + $PROJ_DIR$\..\..\examples\src\UsartModel.c + + + ICCARM + 8 36 + + + BICOMP + 53 + + + + + ICCARM + 12 15 32 146 50 28 57 92 14 80 52 83 97 74 54 72 + + + BICOMP + 12 15 32 146 50 28 57 92 14 52 83 97 74 54 72 + + + + + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + + + ICCARM + 102 61 + + + BICOMP + 11 + + + + + ICCARM + 12 15 19 35 32 18 + + + BICOMP + 12 15 19 35 32 18 + + + + + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + + + ICCARM + 82 70 + + + BICOMP + 58 + + + + + ICCARM + 12 15 26 + + + BICOMP + 12 15 26 + + + + + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + + + ICCARM + 89 64 + + + BICOMP + 22 + + + + + ICCARM + 12 15 35 26 30 + + + BICOMP + 12 15 35 26 30 + + + + + $PROJ_DIR$\Cstartup.s79 + + + AARM + 141 + + + + + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + + + ICCARM + 101 148 + + + BICOMP + 90 + + + + + ICCARM + 12 15 30 41 + + + BICOMP + 12 15 30 41 + + + + + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + + + ICCARM + 45 38 + + + BICOMP + 93 + + + + + ICCARM + 12 15 41 + + + BICOMP + 12 15 41 + + + + + $PROJ_DIR$\Cstartup_SAM7.c + + + ICCARM + 104 51 + + + BICOMP + 112 + + + + + ICCARM + 15 + + + + + $PROJ_DIR$\..\..\examples\src\AdcModel.c + + + ICCARM + 7 59 + + + BICOMP + 5 + + + + + ICCARM + 12 15 145 18 23 28 + + + BICOMP + 12 15 145 18 23 28 + + + + + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + + + ICCARM + 85 79 + + + BICOMP + 77 + + + + + ICCARM + 12 15 24 + + + BICOMP + 12 15 24 + + + + + $PROJ_DIR$\..\..\examples\src\Executor.c + + + ICCARM + 147 37 + + + BICOMP + 31 + + + + + ICCARM + 12 15 143 20 19 29 16 33 + + + BICOMP + 12 15 143 20 19 29 16 33 + + + + + $PROJ_DIR$\..\..\examples\src\Main.c + + + ICCARM + 0 66 + + + BICOMP + 86 + + + + + ICCARM + 12 15 33 143 20 18 23 28 19 35 26 30 32 50 41 29 49 48 42 44 46 16 27 13 24 145 + + + BICOMP + 12 15 33 143 20 18 23 28 19 35 26 30 32 50 41 29 49 48 42 44 46 16 27 13 24 145 + + + + + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + + + ICCARM + 1 47 + + + BICOMP + 94 + + + + + ICCARM + 33 21 + + + BICOMP + 33 21 + + + + + $PROJ_DIR$\..\..\examples\src\Model.c + + + ICCARM + 108 62 + + + BICOMP + 6 + + + + + ICCARM + 20 12 15 18 28 + + + BICOMP + 20 12 15 18 28 + + + + + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + + + ICCARM + 76 78 + + + BICOMP + 111 + + + + + ICCARM + 12 15 23 54 72 92 14 80 52 83 97 + + + BICOMP + 12 15 23 54 72 92 14 52 83 97 + + + + + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + + + ICCARM + 71 63 + + + BICOMP + 69 + + + + + ICCARM + 12 15 18 + + + BICOMP + 12 15 18 + + + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + + + ICCARM + 88 17 + + + BICOMP + 100 + + + + + ICCARM + 12 15 44 42 + + + BICOMP + 12 15 44 42 + + + + + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + + + ICCARM + 73 149 + + + BICOMP + 9 + + + + + ICCARM + 12 15 28 54 72 92 14 80 52 83 97 + + + BICOMP + 12 15 28 54 72 92 14 52 83 97 + + + + + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + + + ICCARM + 95 10 + + + BICOMP + 110 + + + + + ICCARM + 12 15 13 146 + + + BICOMP + 12 15 13 146 + + + + + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + + + ICCARM + 4 60 + + + BICOMP + 68 + + + + + ICCARM + 12 15 16 145 27 + + + BICOMP + 12 15 16 145 27 + + + + + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + + + ICCARM + 55 65 + + + BICOMP + 81 + + + + + ICCARM + 12 15 27 13 24 + + + BICOMP + 12 15 27 13 24 + + + + + $PROJ_DIR$\srcIAR\Cstartup.s79 + + + AARM + 141 + + + + + AARM + 96 + + + + + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + + + ICCARM + 104 51 + + + BICOMP + 112 + + + + + ICCARM + 15 + + + + + + Release + + $PROJ_DIR$\..\test\system\src\TemperatureCalculator.h + $PROJ_DIR$\..\..\examples\src\Types.h + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.h + $TOOLKIT_DIR$\inc\DLib_Defaults.h + $PROJ_DIR$\..\..\examples\src\AT91SAM7X256.h + $PROJ_DIR$\..\..\examples\src\AdcConductor.h + $PROJ_DIR$\..\..\examples\src\TaskScheduler.h + $PROJ_DIR$\..\..\examples\src\UsartConductor.h + $PROJ_DIR$\..\..\examples\src\Model.h + $TOOLKIT_DIR$\inc\intrinsics.h + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.h + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.h + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.h + $PROJ_DIR$\..\..\examples\src\AdcHardware.h + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.h + $PROJ_DIR$\..\..\examples\src\TimerConductor.h + $PROJ_DIR$\..\..\examples\src\UsartPutChar.h + $PROJ_DIR$\..\..\examples\src\UsartModel.h + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.h + $PROJ_DIR$\..\..\examples\src\UsartHardware.h + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.h + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.h + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.h + $PROJ_DIR$\..\..\examples\src\TimerModel.h + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.h + $PROJ_DIR$\..\..\examples\src\TimerHardware.h + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.h + $TOOLKIT_DIR$\inc\DLib_Product.h + $TOOLKIT_DIR$\inc\math.h + $TOOLKIT_DIR$\inc\stdio.h + $TOOLKIT_DIR$\inc\ymath.h + $TOOLKIT_DIR$\inc\ysizet.h + $TOOLKIT_DIR$\lib\dl4tptinl8n.h + $PROJ_DIR$\..\test\system\src\UsartPutChar.h + $PROJ_DIR$\..\test\system\src\AdcTemperatureSensor.h + $PROJ_DIR$\..\test\system\src\TaskScheduler.h + $PROJ_DIR$\..\test\system\src\UsartTransmitBufferStatus.h + $PROJ_DIR$\..\test\system\src\UsartConfigurator.h + $PROJ_DIR$\..\test\system\src\TimerConfigurator.h + $PROJ_DIR$\..\test\system\src\AT91SAM7X256.h + $PROJ_DIR$\..\test\system\src\UsartBaudRateRegisterCalculator.h + $PROJ_DIR$\..\test\system\src\Executor.h + $PROJ_DIR$\..\test\system\src\ModelConfig.h + $PROJ_DIR$\..\test\system\src\TimerModel.h + $PROJ_DIR$\..\test\system\src\TimerInterruptHandler.h + $PROJ_DIR$\..\test\system\src\Main.c + $PROJ_DIR$\..\test\system\src\Model.c + $PROJ_DIR$\..\test\system\src\AdcHardwareConfigurator.c + $PROJ_DIR$\..\test\system\src\TimerModel.c + $PROJ_DIR$\..\test\system\src\UsartModel.c + $PROJ_DIR$\..\test\system\src\UsartHardware.c + $PROJ_DIR$\..\test\system\src\UsartTransmitBufferStatus.c + $PROJ_DIR$\..\test\system\src\UsartPutChar.c + $PROJ_DIR$\..\test\system\src\TimerInterruptConfigurator.c + $PROJ_DIR$\..\test\system\src\UsartBaudRateRegisterCalculator.c + $PROJ_DIR$\..\test\system\src\TaskScheduler.c + $PROJ_DIR$\..\test\system\src\AdcConductor.h + $PROJ_DIR$\..\test\system\src\TimerInterruptConfigurator.h + $PROJ_DIR$\..\test\system\src\Model.h + $PROJ_DIR$\..\test\system\src\TemperatureFilter.h + $PROJ_DIR$\..\test\system\src\AdcModel.c + $PROJ_DIR$\..\test\system\src\TimerHardware.h + $PROJ_DIR$\..\test\system\src\AdcTemperatureSensor.c + $PROJ_DIR$\..\test\system\src\AdcConductor.c + $PROJ_DIR$\..\test\system\src\AdcHardware.c + $PROJ_DIR$\..\test\system\src\AdcHardware.h + $PROJ_DIR$\..\test\system\src\Executor.c + $TOOLKIT_DIR$\inc\xencoding_limits.h + $TOOLKIT_DIR$\lib\dl4tptinl8n.r79 + $PROJ_DIR$\..\test\system\src\TemperatureCalculator.c + $PROJ_DIR$\..\test\system\src\Types.h + $PROJ_DIR$\..\test\system\src\TemperatureFilter.c + $PROJ_DIR$\..\test\system\src\TimerConductor.c + $PROJ_DIR$\..\test\system\src\TimerConfigurator.c + $PROJ_DIR$\..\test\system\src\TimerHardware.c + $PROJ_DIR$\..\test\system\src\TimerInterruptHandler.c + $PROJ_DIR$\..\test\system\src\UsartConductor.c + $PROJ_DIR$\..\test\system\src\UsartConfigurator.c + $PROJ_DIR$\..\test\system\src\UsartHardware.h + $PROJ_DIR$\..\test\system\src\TimerConductor.h + $PROJ_DIR$\..\test\system\src\AdcModel.h + $PROJ_DIR$\..\test\system\src\AdcHardwareConfigurator.h + $PROJ_DIR$\..\test\system\src\UsartConductor.h + $PROJ_DIR$\Release\Obj\Executor.pbi + $PROJ_DIR$\..\test\system\src\UsartModel.h + $PROJ_DIR$\Release\Obj\Model.pbi + $PROJ_DIR$\Release\Obj\Cstartup_SAM7.pbi + $PROJ_DIR$\Release\Obj\UsartConductor.pbi + $PROJ_DIR$\Release\Obj\AdcConductor.r79 + $PROJ_DIR$\Release\Obj\AdcHardware.r79 + $PROJ_DIR$\Release\Obj\TimerModel.pbi + $PROJ_DIR$\Release\Obj\AdcTemperatureSensor.pbi + $PROJ_DIR$\Release\Obj\UsartHardware.r79 + $PROJ_DIR$\Release\Obj\TemperatureFilter.pbi + $PROJ_DIR$\Release\Obj\UsartPutChar.pbi + $PROJ_DIR$\Release\Obj\TemperatureCalculator.r79 + $PROJ_DIR$\Release\Obj\AdcHardwareConfigurator.r79 + $PROJ_DIR$\Release\Obj\cmock_demo.pbd + $PROJ_DIR$\Release\Obj\UsartModel.r79 + $PROJ_DIR$\Release\Obj\UsartBaudRateRegisterCalculator.r79 + $PROJ_DIR$\Release\Obj\Model.r79 + $PROJ_DIR$\Release\Obj\AdcModel.r79 + $PROJ_DIR$\Release\Obj\AdcHardware.pbi + $PROJ_DIR$\Release\Obj\TimerModel.r79 + $PROJ_DIR$\Release\Obj\TimerHardware.r79 + $PROJ_DIR$\Release\Obj\UsartPutChar.r79 + $PROJ_DIR$\Release\Obj\AdcHardwareConfigurator.pbi + $PROJ_DIR$\Release\Obj\TimerInterruptConfigurator.r79 + $PROJ_DIR$\Release\Obj\TaskScheduler.pbi + $PROJ_DIR$\Release\List\cmock_demo.map + $PROJ_DIR$\Release\Obj\UsartTransmitBufferStatus.pbi + $PROJ_DIR$\Release\Exe\cmock_demo.d79 + $PROJ_DIR$\Release\Obj\AdcTemperatureSensor.r79 + $PROJ_DIR$\Release\Obj\TimerConductor.r79 + $PROJ_DIR$\Release\Obj\TimerConfigurator.r79 + $PROJ_DIR$\Release\Obj\Main.pbi + $PROJ_DIR$\Release\Obj\TimerInterruptConfigurator.pbi + $PROJ_DIR$\Release\Obj\UsartTransmitBufferStatus.r79 + $PROJ_DIR$\Release\Obj\AdcModel.pbi + $PROJ_DIR$\Release\Obj\TemperatureFilter.r79 + $PROJ_DIR$\Release\Obj\UsartHardware.pbi + $PROJ_DIR$\Release\Obj\Cstartup.r79 + $PROJ_DIR$\Release\Obj\UsartConductor.r79 + $PROJ_DIR$\Release\Obj\TimerInterruptHandler.pbi + $PROJ_DIR$\Release\Obj\TimerConductor.pbi + $PROJ_DIR$\Release\Obj\Main.r79 + $PROJ_DIR$\Release\Obj\UsartConfigurator.pbi + $PROJ_DIR$\Release\Obj\Executor.r79 + $PROJ_DIR$\Release\Obj\Cstartup_SAM7.r79 + $PROJ_DIR$\Release\Obj\TemperatureCalculator.pbi + $PROJ_DIR$\Release\Obj\TimerHardware.pbi + $PROJ_DIR$\Release\Exe\cmock_demo.sim + $PROJ_DIR$\Release\Obj\TimerConfigurator.pbi + $PROJ_DIR$\Release\Obj\UsartModel.pbi + $PROJ_DIR$\Release\Obj\TaskScheduler.r79 + $PROJ_DIR$\Release\Obj\UsartBaudRateRegisterCalculator.pbi + $PROJ_DIR$\Release\Obj\AdcConductor.pbi + $PROJ_DIR$\Release\Obj\TimerInterruptHandler.r79 + $PROJ_DIR$\Release\Obj\UsartConfigurator.r79 + $PROJ_DIR$\Release\Obj\IntrinsicsWrapper.pbi + $PROJ_DIR$\Release\Obj\IntrinsicsWrapper.r79 + $TOOLKIT_DIR$\inc\yvals.h + $PROJ_DIR$\incIAR\AT91SAM7X256_inc.h + $TOOLKIT_DIR$\inc\DLib_Threads.h + $PROJ_DIR$\Resource\at91SAM7X256_FLASH.xcl + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + $PROJ_DIR$\..\..\examples\src\TimerModel.c + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + $PROJ_DIR$\..\..\examples\src\UsartModel.c + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + $PROJ_DIR$\Cstartup.s79 + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + $PROJ_DIR$\Cstartup_SAM7.c + $PROJ_DIR$\..\..\examples\src\AdcModel.c + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + $PROJ_DIR$\..\..\examples\src\Executor.c + $PROJ_DIR$\..\..\examples\src\Main.c + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + $PROJ_DIR$\..\..\examples\src\Model.c + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + $PROJ_DIR$\..\..\examples\src\Executor.h + $PROJ_DIR$\..\..\examples\src\AdcModel.h + $PROJ_DIR$\..\..\examples\src\ModelConfig.h + $PROJ_DIR$\srcIAR\Cstartup.s79 + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + + + [ROOT_NODE] + + + XLINK + 111 109 131 + + + + + $PROJ_DIR$\..\test\system\src\Main.c + + + ICCARM + 125 + + + BICOMP + 115 + + + + + ICCARM + 70 39 41 58 35 0 59 82 78 37 33 84 40 36 79 61 38 57 44 43 56 65 81 34 80 + + + + + $PROJ_DIR$\..\test\system\src\Model.c + + + ICCARM + 100 + + + BICOMP + 85 + + + + + ICCARM + 58 70 39 35 59 + + + + + $PROJ_DIR$\..\test\system\src\AdcHardwareConfigurator.c + + + ICCARM + 96 + + + BICOMP + 106 + + + + + ICCARM + 70 39 81 42 + + + + + $PROJ_DIR$\..\test\system\src\TimerModel.c + + + ICCARM + 103 + + + BICOMP + 90 + + + + + ICCARM + 70 39 43 35 + + + + + $PROJ_DIR$\..\test\system\src\UsartModel.c + + + ICCARM + 98 + + + BICOMP + 133 + + + + + ICCARM + 70 39 84 42 40 59 29 141 3 32 27 67 143 31 28 30 + + + + + $PROJ_DIR$\..\test\system\src\UsartHardware.c + + + ICCARM + 92 + + + BICOMP + 120 + + + + + ICCARM + 70 39 78 37 33 + + + + + $PROJ_DIR$\..\test\system\src\UsartTransmitBufferStatus.c + + + ICCARM + 117 + + + BICOMP + 110 + + + + + ICCARM + 70 39 36 + + + + + $PROJ_DIR$\..\test\system\src\UsartPutChar.c + + + ICCARM + 105 + + + BICOMP + 94 + + + + + ICCARM + 70 39 33 36 + + + + + $PROJ_DIR$\..\test\system\src\TimerInterruptConfigurator.c + + + ICCARM + 107 + + + BICOMP + 116 + + + + + ICCARM + 70 39 57 44 + + + + + $PROJ_DIR$\..\test\system\src\UsartBaudRateRegisterCalculator.c + + + ICCARM + 99 + + + BICOMP + 135 + + + + + ICCARM + 70 39 40 + + + + + $PROJ_DIR$\..\test\system\src\TaskScheduler.c + + + ICCARM + 134 + + + BICOMP + 108 + + + + + ICCARM + 70 39 35 + + + + + $PROJ_DIR$\..\test\system\src\AdcModel.c + + + ICCARM + 101 + + + BICOMP + 118 + + + + + ICCARM + 70 39 80 35 0 59 + + + + + $PROJ_DIR$\..\test\system\src\AdcTemperatureSensor.c + + + ICCARM + 112 + + + BICOMP + 91 + + + + + ICCARM + 70 39 34 + + + + + $PROJ_DIR$\..\test\system\src\AdcConductor.c + + + ICCARM + 88 + + + BICOMP + 136 + + + + + $PROJ_DIR$\..\test\system\src\AdcHardware.c + + + ICCARM + 89 + + + BICOMP + 102 + + + + + ICCARM + 70 39 65 81 34 + + + + + $PROJ_DIR$\..\test\system\src\Executor.c + + + ICCARM + 127 + + + BICOMP + 83 + + + + + ICCARM + 70 39 41 58 82 79 56 + + + + + $PROJ_DIR$\..\test\system\src\TemperatureCalculator.c + + + ICCARM + 95 + + + BICOMP + 129 + + + + + ICCARM + 70 39 0 28 30 141 3 32 27 67 143 + + + + + $PROJ_DIR$\..\test\system\src\TemperatureFilter.c + + + ICCARM + 119 + + + BICOMP + 93 + + + + + ICCARM + 70 39 59 28 30 141 3 32 27 67 143 + + + + + $PROJ_DIR$\..\test\system\src\TimerConductor.c + + + ICCARM + 113 + + + BICOMP + 124 + + + + + ICCARM + 70 39 79 43 61 44 + + + + + $PROJ_DIR$\..\test\system\src\TimerConfigurator.c + + + ICCARM + 114 + + + BICOMP + 132 + + + + + ICCARM + 70 39 38 57 + + + + + $PROJ_DIR$\..\test\system\src\TimerHardware.c + + + ICCARM + 104 + + + BICOMP + 130 + + + + + ICCARM + 70 39 61 38 + + + + + $PROJ_DIR$\..\test\system\src\TimerInterruptHandler.c + + + ICCARM + 137 + + + BICOMP + 123 + + + + + ICCARM + 70 39 44 57 + + + + + $PROJ_DIR$\..\test\system\src\UsartConductor.c + + + ICCARM + 122 + + + BICOMP + 87 + + + + + ICCARM + 70 39 82 78 84 35 + + + + + $PROJ_DIR$\..\test\system\src\UsartConfigurator.c + + + ICCARM + 138 + + + BICOMP + 126 + + + + + ICCARM + 70 39 37 + + + + + $PROJ_DIR$\Release\Obj\cmock_demo.pbd + + + BILINK + 136 102 106 118 91 86 83 139 115 85 108 129 93 124 132 130 116 123 90 135 87 126 120 133 94 110 + + + + + $PROJ_DIR$\Release\Exe\cmock_demo.d79 + + + XLINK + 109 131 + + + + + XLINK + 144 88 89 96 101 112 121 128 127 140 125 100 134 95 119 113 114 104 107 137 103 99 122 138 92 98 105 117 68 + + + + + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + + + ICCARM + 113 + + + BICOMP + 124 + + + + + ICCARM + 1 4 15 23 25 22 + + + BICOMP + 1 4 15 23 25 22 + + + + + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + + + ICCARM + 114 + + + BICOMP + 132 + + + + + ICCARM + 1 4 24 21 + + + BICOMP + 1 4 24 21 + + + + + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + + + ICCARM + 104 + + + BICOMP + 130 + + + + + ICCARM + 1 4 25 24 + + + BICOMP + 1 4 25 24 + + + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + + + ICCARM + 107 + + + BICOMP + 116 + + + + + ICCARM + 1 4 21 22 + + + BICOMP + 1 4 21 22 + + + + + $PROJ_DIR$\..\..\examples\src\TimerModel.c + + + ICCARM + 103 + + + BICOMP + 90 + + + + + ICCARM + 1 4 23 6 + + + BICOMP + 1 4 23 6 + + + + + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + + + ICCARM + 99 + + + BICOMP + 135 + + + + + ICCARM + 1 4 26 + + + BICOMP + 1 4 26 + + + + + $PROJ_DIR$\..\..\examples\src\UsartModel.c + + + ICCARM + 98 + + + BICOMP + 133 + + + + + ICCARM + 1 4 17 174 26 14 29 141 3 32 27 67 143 31 28 30 + + + BICOMP + 1 4 17 174 26 14 29 141 3 27 67 143 31 28 30 + + + + + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + + + ICCARM + 122 + + + BICOMP + 87 + + + + + ICCARM + 1 4 7 19 17 6 + + + BICOMP + 1 4 7 19 17 6 + + + + + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + + + ICCARM + 138 + + + BICOMP + 126 + + + + + ICCARM + 1 4 12 + + + BICOMP + 1 4 12 + + + + + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + + + ICCARM + 92 + + + BICOMP + 120 + + + + + ICCARM + 1 4 19 12 16 + + + BICOMP + 1 4 19 12 16 + + + + + $PROJ_DIR$\Cstartup.s79 + + + AARM + 121 + + + + + AARM + 142 + + + + + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + + + ICCARM + 105 + + + BICOMP + 94 + + + + + ICCARM + 1 4 16 20 + + + BICOMP + 1 4 16 20 + + + + + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + + + ICCARM + 117 + + + BICOMP + 110 + + + + + ICCARM + 1 4 20 + + + BICOMP + 1 4 20 + + + + + $PROJ_DIR$\Cstartup_SAM7.c + + + ICCARM + 128 + + + BICOMP + 86 + + + + + ICCARM + 4 + + + BICOMP + 4 + + + + + $PROJ_DIR$\..\..\examples\src\AdcModel.c + + + ICCARM + 101 + + + BICOMP + 118 + + + + + ICCARM + 1 4 173 6 10 14 + + + BICOMP + 1 4 173 6 10 14 + + + + + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + + + ICCARM + 112 + + + BICOMP + 91 + + + + + ICCARM + 1 4 11 + + + BICOMP + 1 4 11 + + + + + $PROJ_DIR$\..\..\examples\src\Executor.c + + + ICCARM + 127 + + + BICOMP + 83 + + + + + ICCARM + 1 4 172 8 7 15 5 18 + + + BICOMP + 1 4 172 8 7 15 5 18 + + + + + $PROJ_DIR$\..\..\examples\src\Main.c + + + ICCARM + 125 + + + BICOMP + 115 + + + + + ICCARM + 1 4 18 172 8 6 10 14 7 19 12 16 17 26 20 15 25 24 21 22 23 5 13 2 11 173 + + + BICOMP + 1 4 18 172 8 6 10 14 7 19 12 16 17 26 20 15 25 24 21 22 23 5 13 2 11 173 + + + + + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + + + ICCARM + 140 + + + BICOMP + 139 + + + + + ICCARM + 18 9 + + + BICOMP + 18 9 + + + + + $PROJ_DIR$\..\..\examples\src\Model.c + + + ICCARM + 100 + + + BICOMP + 85 + + + + + ICCARM + 8 1 4 6 14 + + + BICOMP + 8 1 4 6 14 + + + + + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + + + ICCARM + 95 + + + BICOMP + 129 + + + + + ICCARM + 1 4 10 28 30 141 3 32 27 67 143 + + + BICOMP + 1 4 10 28 30 141 3 27 67 143 + + + + + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + + + ICCARM + 134 + + + BICOMP + 108 + + + + + ICCARM + 1 4 6 + + + BICOMP + 1 4 6 + + + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + + + ICCARM + 137 + + + BICOMP + 123 + + + + + ICCARM + 1 4 22 21 + + + BICOMP + 1 4 22 21 + + + + + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + + + ICCARM + 119 + + + BICOMP + 93 + + + + + ICCARM + 1 4 14 28 30 141 3 32 27 67 143 + + + BICOMP + 1 4 14 28 30 141 3 27 67 143 + + + + + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + + + ICCARM + 96 + + + BICOMP + 106 + + + + + ICCARM + 1 4 2 174 + + + BICOMP + 1 4 2 174 + + + + + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + + + ICCARM + 88 + + + BICOMP + 136 + + + + + ICCARM + 1 4 5 173 13 + + + BICOMP + 1 4 5 173 13 + + + + + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + + + ICCARM + 89 + + + BICOMP + 102 + + + + + ICCARM + 1 4 13 2 11 + + + BICOMP + 1 4 13 2 11 + + + + + $PROJ_DIR$\srcIAR\Cstartup.s79 + + + AARM + 121 + + + + + AARM + 142 + + + + + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + + + ICCARM + 128 + + + BICOMP + 86 + + + + + ICCARM + 4 + + + BICOMP + 4 + + + + + $PROJ_DIR$\..\test\system\src\Main.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\Model.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\AdcHardwareConfigurator.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\TimerModel.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\UsartModel.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\UsartHardware.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\UsartTransmitBufferStatus.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\UsartPutChar.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\TimerInterruptConfigurator.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\UsartBaudRateRegisterCalculator.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\TaskScheduler.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\AdcModel.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\AdcTemperatureSensor.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\AdcConductor.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\AdcHardware.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\Executor.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\TemperatureCalculator.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\TemperatureFilter.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\TimerConductor.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\TimerConfigurator.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\TimerHardware.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\TimerInterruptHandler.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\UsartConductor.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\UsartConfigurator.c + ICCARM + + + + Simulate + + $PROJ_DIR$\..\test\system\src\TemperatureCalculator.h + $PROJ_DIR$\..\..\examples\src\Types.h + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.h + $TOOLKIT_DIR$\inc\DLib_Defaults.h + $PROJ_DIR$\..\..\examples\src\AT91SAM7X256.h + $PROJ_DIR$\..\..\examples\src\AdcConductor.h + $PROJ_DIR$\..\..\examples\src\TaskScheduler.h + $PROJ_DIR$\..\..\examples\src\UsartConductor.h + $PROJ_DIR$\..\..\examples\src\Model.h + $TOOLKIT_DIR$\inc\intrinsics.h + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.h + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.h + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.h + $PROJ_DIR$\..\..\examples\src\AdcHardware.h + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.h + $PROJ_DIR$\..\..\examples\src\TimerConductor.h + $PROJ_DIR$\..\..\examples\src\UsartPutChar.h + $PROJ_DIR$\..\..\examples\src\UsartModel.h + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.h + $PROJ_DIR$\..\..\examples\src\UsartHardware.h + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.h + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.h + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.h + $PROJ_DIR$\..\..\examples\src\TimerModel.h + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.h + $PROJ_DIR$\..\..\examples\src\TimerHardware.h + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.h + $TOOLKIT_DIR$\inc\DLib_Product.h + $TOOLKIT_DIR$\inc\math.h + $TOOLKIT_DIR$\inc\stdio.h + $TOOLKIT_DIR$\inc\ymath.h + $TOOLKIT_DIR$\inc\ysizet.h + $TOOLKIT_DIR$\lib\dl4tptinl8n.h + $PROJ_DIR$\..\test\system\src\UsartPutChar.h + $PROJ_DIR$\..\test\system\src\AdcTemperatureSensor.h + $PROJ_DIR$\Simulate\Obj\cmock_demo.pbd + $PROJ_DIR$\..\test\system\src\TaskScheduler.h + $PROJ_DIR$\..\test\system\src\UsartTransmitBufferStatus.h + $PROJ_DIR$\..\test\system\src\UsartConfigurator.h + $PROJ_DIR$\..\test\system\src\TimerConfigurator.h + $PROJ_DIR$\..\test\system\src\AT91SAM7X256.h + $PROJ_DIR$\..\test\system\src\UsartBaudRateRegisterCalculator.h + $PROJ_DIR$\..\test\system\src\Executor.h + $PROJ_DIR$\..\test\system\src\ModelConfig.h + $PROJ_DIR$\..\test\system\src\TimerModel.h + $PROJ_DIR$\..\test\system\src\TimerInterruptHandler.h + $PROJ_DIR$\..\test\system\src\Main.c + $PROJ_DIR$\..\test\system\src\Model.c + $PROJ_DIR$\..\test\system\src\AdcHardwareConfigurator.c + $PROJ_DIR$\..\test\system\src\TimerModel.c + $PROJ_DIR$\..\test\system\src\UsartModel.c + $PROJ_DIR$\..\test\system\src\UsartHardware.c + $PROJ_DIR$\..\test\system\src\UsartTransmitBufferStatus.c + $PROJ_DIR$\..\test\system\src\UsartPutChar.c + $PROJ_DIR$\..\test\system\src\TimerInterruptConfigurator.c + $PROJ_DIR$\..\test\system\src\UsartBaudRateRegisterCalculator.c + $PROJ_DIR$\..\test\system\src\TaskScheduler.c + $PROJ_DIR$\..\test\system\src\AdcConductor.h + $PROJ_DIR$\..\test\system\src\TimerInterruptConfigurator.h + $PROJ_DIR$\..\test\system\src\Model.h + $PROJ_DIR$\..\test\system\src\TemperatureFilter.h + $PROJ_DIR$\..\test\system\src\AdcModel.c + $PROJ_DIR$\..\test\system\src\TimerHardware.h + $PROJ_DIR$\..\test\system\src\AdcTemperatureSensor.c + $PROJ_DIR$\..\test\system\src\AdcConductor.c + $PROJ_DIR$\..\test\system\src\AdcHardware.c + $PROJ_DIR$\..\test\system\src\AdcHardware.h + $PROJ_DIR$\..\test\system\src\Executor.c + $TOOLKIT_DIR$\inc\xencoding_limits.h + $TOOLKIT_DIR$\lib\dl4tptinl8n.r79 + $PROJ_DIR$\..\test\system\src\TemperatureCalculator.c + $PROJ_DIR$\..\test\system\src\Types.h + $PROJ_DIR$\..\test\system\src\TemperatureFilter.c + $PROJ_DIR$\..\test\system\src\TimerConductor.c + $PROJ_DIR$\..\test\system\src\TimerConfigurator.c + $PROJ_DIR$\..\test\system\src\TimerHardware.c + $PROJ_DIR$\..\test\system\src\TimerInterruptHandler.c + $PROJ_DIR$\..\test\system\src\UsartConductor.c + $PROJ_DIR$\..\test\system\src\UsartConfigurator.c + $PROJ_DIR$\..\test\system\src\UsartHardware.h + $PROJ_DIR$\..\test\system\src\TimerConductor.h + $PROJ_DIR$\..\test\system\src\AdcModel.h + $PROJ_DIR$\..\test\system\src\AdcHardwareConfigurator.h + $PROJ_DIR$\..\test\system\src\UsartConductor.h + $PROJ_DIR$\..\test\system\src\UsartModel.h + $PROJ_DIR$\Simulate\Obj\AdcConductor.r79 + $PROJ_DIR$\Simulate\Obj\Cstartup_SAM7.pbi + $PROJ_DIR$\Simulate\Obj\UsartHardware.r79 + $TOOLKIT_DIR$\inc\yvals.h + $PROJ_DIR$\incIAR\AT91SAM7X256_inc.h + $PROJ_DIR$\Simulate\List\TimerModel.lst + $PROJ_DIR$\Simulate\Obj\Executor.r79 + $PROJ_DIR$\Simulate\Obj\TimerHardware.pbi + $PROJ_DIR$\Simulate\Obj\UsartModel.pbi + $PROJ_DIR$\Simulate\Obj\IntrinsicsWrapper.r79 + $PROJ_DIR$\Simulate\Obj\TimerConductor.pbi + $PROJ_DIR$\Simulate\List\UsartConductor.lst + $PROJ_DIR$\Simulate\Obj\Main.pbi + $TOOLKIT_DIR$\inc\DLib_Threads.h + $PROJ_DIR$\Simulate\Obj\AdcHardwareConfigurator.pbi + $PROJ_DIR$\Simulate\Obj\TimerConfigurator.pbi + $PROJ_DIR$\Simulate\Exe\cmock_demo.sim + $PROJ_DIR$\Simulate\Obj\UsartTransmitBufferStatus.pbi + $PROJ_DIR$\Simulate\Obj\AdcHardware.r79 + $PROJ_DIR$\Simulate\Obj\Main.r79 + $PROJ_DIR$\Simulate\Obj\AdcTemperatureSensor.pbi + $PROJ_DIR$\Simulate\Obj\UsartPutChar.r79 + $PROJ_DIR$\Simulate\Obj\AdcHardwareConfigurator.r79 + $PROJ_DIR$\Simulate\Obj\UsartConductor.r79 + $PROJ_DIR$\Simulate\Obj\TimerHardware.r79 + $PROJ_DIR$\Simulate\Obj\TemperatureFilter.r79 + $PROJ_DIR$\Simulate\Obj\TemperatureCalculator.pbi + $PROJ_DIR$\Simulate\Obj\TimerInterruptConfigurator.r79 + $PROJ_DIR$\Simulate\Obj\UsartTransmitBufferStatus.r79 + $PROJ_DIR$\Simulate\Obj\TimerConductor.r79 + $PROJ_DIR$\Simulate\Obj\Executor.pbi + $PROJ_DIR$\Simulate\Obj\UsartConductor.pbi + $PROJ_DIR$\Simulate\Obj\TimerModel.pbi + $PROJ_DIR$\Simulate\Obj\AdcModel.pbi + $PROJ_DIR$\Simulate\List\TaskScheduler.lst + $PROJ_DIR$\Simulate\Obj\TimerModel.r79 + $PROJ_DIR$\Simulate\Obj\TemperatureFilter.pbi + $PROJ_DIR$\Simulate\Obj\UsartBaudRateRegisterCalculator.pbi + $PROJ_DIR$\Simulate\Obj\UsartHardware.pbi + $PROJ_DIR$\Simulate\Obj\TaskScheduler.pbi + $PROJ_DIR$\Simulate\Obj\AdcConductor.pbi + $PROJ_DIR$\Simulate\Obj\TimerConfigurator.r79 + $PROJ_DIR$\Simulate\Obj\Cstartup.r79 + $PROJ_DIR$\Simulate\Obj\TimerInterruptHandler.pbi + $PROJ_DIR$\Simulate\Obj\AdcModel.r79 + $PROJ_DIR$\Simulate\Obj\IntrinsicsWrapper.pbi + $PROJ_DIR$\Simulate\List\cmock_demo.map + $PROJ_DIR$\Simulate\Obj\TimerInterruptConfigurator.pbi + $PROJ_DIR$\Simulate\Exe\cmock_demo.d79 + $PROJ_DIR$\Simulate\Obj\TaskScheduler.r79 + $PROJ_DIR$\Simulate\Obj\Model.r79 + $PROJ_DIR$\Simulate\Obj\UsartConfigurator.pbi + $PROJ_DIR$\Simulate\Obj\UsartModel.r79 + $PROJ_DIR$\Simulate\Obj\Cstartup_SAM7.r79 + $PROJ_DIR$\Simulate\Obj\TemperatureCalculator.r79 + $PROJ_DIR$\Simulate\Obj\UsartPutChar.pbi + $PROJ_DIR$\Simulate\Obj\UsartConfigurator.r79 + $PROJ_DIR$\Simulate\Obj\AdcHardware.pbi + $PROJ_DIR$\Simulate\Obj\AdcTemperatureSensor.r79 + $PROJ_DIR$\Simulate\Obj\Model.pbi + $PROJ_DIR$\Simulate\Obj\UsartBaudRateRegisterCalculator.r79 + $PROJ_DIR$\Simulate\List\UsartBaudRateRegisterCalculator.lst + $PROJ_DIR$\Simulate\List\UsartTransmitBufferStatus.lst + $PROJ_DIR$\Simulate\List\AdcHardware.lst + $PROJ_DIR$\Simulate\List\TimerInterruptConfigurator.lst + $PROJ_DIR$\Simulate\List\Model.lst + $PROJ_DIR$\Simulate\Obj\TimerInterruptHandler.r79 + $PROJ_DIR$\Simulate\List\UsartPutChar.lst + $PROJ_DIR$\Simulate\List\UsartHardware.lst + $PROJ_DIR$\Simulate\List\Executor.lst + $PROJ_DIR$\Simulate\List\TimerConfigurator.lst + $PROJ_DIR$\Simulate\List\AdcTemperatureSensor.lst + $PROJ_DIR$\Simulate\List\Cstartup_SAM7.lst + $PROJ_DIR$\Simulate\List\AdcHardwareConfigurator.lst + $PROJ_DIR$\Simulate\List\AdcModel.lst + $PROJ_DIR$\Simulate\List\TemperatureFilter.lst + $PROJ_DIR$\Simulate\List\AdcConductor.lst + $PROJ_DIR$\Simulate\List\UsartConfigurator.lst + $PROJ_DIR$\Simulate\List\IntrinsicsWrapper.lst + $PROJ_DIR$\Simulate\List\TimerHardware.lst + $PROJ_DIR$\Simulate\List\TemperatureCalculator.lst + $PROJ_DIR$\Simulate\List\TimerInterruptHandler.lst + $PROJ_DIR$\Simulate\List\UsartModel.lst + $PROJ_DIR$\Simulate\List\Main.lst + $PROJ_DIR$\Simulate\List\TimerConductor.lst + $PROJ_DIR$\Resource\at91SAM7X256_FLASH.xcl + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + $PROJ_DIR$\..\..\examples\src\TimerModel.c + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + $PROJ_DIR$\..\..\examples\src\UsartModel.c + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + $PROJ_DIR$\Cstartup.s79 + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + $PROJ_DIR$\Cstartup_SAM7.c + $PROJ_DIR$\..\..\examples\src\AdcModel.c + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + $PROJ_DIR$\..\..\examples\src\Executor.c + $PROJ_DIR$\..\..\examples\src\Main.c + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + $PROJ_DIR$\..\..\examples\src\Model.c + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + $PROJ_DIR$\..\..\examples\src\Executor.h + $PROJ_DIR$\..\..\examples\src\AdcModel.h + $PROJ_DIR$\..\..\examples\src\ModelConfig.h + $PROJ_DIR$\srcIAR\Cstartup.s79 + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + + + [ROOT_NODE] + + + XLINK + 133 131 101 + + + + + $PROJ_DIR$\Simulate\Obj\cmock_demo.pbd + + + BILINK + 125 142 99 118 105 86 115 130 97 144 124 111 121 95 100 92 132 128 117 122 116 136 123 93 140 102 + + + + + $PROJ_DIR$\..\test\system\src\Main.c + + + ICCARM + 104 + + + BICOMP + 97 + + + + + ICCARM + 71 40 42 59 36 0 60 83 79 38 33 84 41 37 80 62 39 58 45 44 57 66 82 34 81 + + + BICOMP + 71 40 42 59 36 0 60 83 79 38 33 84 41 37 80 62 39 58 45 44 57 66 82 34 81 + + + + + $PROJ_DIR$\..\test\system\src\Model.c + + + ICCARM + 135 + + + BICOMP + 144 + + + + + ICCARM + 59 71 40 36 60 + + + BICOMP + 59 71 40 36 60 + + + + + $PROJ_DIR$\..\test\system\src\AdcHardwareConfigurator.c + + + ICCARM + 107 + + + BICOMP + 99 + + + + + ICCARM + 71 40 82 43 + + + BICOMP + 71 40 82 43 + + + + + $PROJ_DIR$\..\test\system\src\TimerModel.c + + + ICCARM + 120 + + + BICOMP + 117 + + + + + ICCARM + 71 40 44 36 + + + BICOMP + 71 40 44 36 + + + + + $PROJ_DIR$\..\test\system\src\UsartModel.c + + + ICCARM + 137 + + + BICOMP + 93 + + + + + ICCARM + 71 40 84 43 41 60 29 88 3 32 27 68 98 31 28 30 + + + BICOMP + 71 40 84 43 41 60 29 88 3 27 68 98 31 28 30 + + + + + $PROJ_DIR$\..\test\system\src\UsartHardware.c + + + ICCARM + 87 + + + BICOMP + 123 + + + + + ICCARM + 71 40 79 38 33 + + + BICOMP + 71 40 79 38 33 + + + + + $PROJ_DIR$\..\test\system\src\UsartTransmitBufferStatus.c + + + ICCARM + 113 + + + BICOMP + 102 + + + + + ICCARM + 71 40 37 + + + BICOMP + 71 40 37 + + + + + $PROJ_DIR$\..\test\system\src\UsartPutChar.c + + + ICCARM + 106 + + + BICOMP + 140 + + + + + ICCARM + 71 40 33 37 29 88 3 32 27 68 98 31 + + + BICOMP + 71 40 33 37 29 88 3 27 68 98 31 + + + + + $PROJ_DIR$\..\test\system\src\TimerInterruptConfigurator.c + + + ICCARM + 112 + + + BICOMP + 132 + + + + + ICCARM + 71 40 58 45 + + + BICOMP + 71 40 58 45 + + + + + $PROJ_DIR$\..\test\system\src\UsartBaudRateRegisterCalculator.c + + + ICCARM + 145 + + + BICOMP + 122 + + + + + ICCARM + 71 40 41 + + + BICOMP + 71 40 41 + + + + + $PROJ_DIR$\..\test\system\src\TaskScheduler.c + + + ICCARM + 134 + + + BICOMP + 124 + + + + + ICCARM + 71 40 36 + + + BICOMP + 71 40 36 + + + + + $PROJ_DIR$\..\test\system\src\AdcModel.c + + + ICCARM + 129 + + + BICOMP + 118 + + + + + ICCARM + 71 40 81 36 0 60 + + + BICOMP + 71 40 81 36 0 60 + + + + + $PROJ_DIR$\..\test\system\src\AdcTemperatureSensor.c + + + ICCARM + 143 + + + BICOMP + 105 + + + + + ICCARM + 71 40 34 + + + BICOMP + 71 40 34 + + + + + $PROJ_DIR$\..\test\system\src\AdcConductor.c + + + ICCARM + 85 + + + BICOMP + 125 + + + + + ICCARM + 71 40 57 81 66 + + + BICOMP + 71 40 57 81 66 + + + + + $PROJ_DIR$\..\test\system\src\AdcHardware.c + + + ICCARM + 103 + + + BICOMP + 142 + + + + + ICCARM + 71 40 66 82 34 + + + BICOMP + 71 40 66 82 34 + + + + + $PROJ_DIR$\..\test\system\src\Executor.c + + + ICCARM + 91 + + + BICOMP + 115 + + + + + ICCARM + 71 40 42 59 83 80 57 + + + BICOMP + 71 40 42 59 83 80 57 + + + + + $PROJ_DIR$\..\test\system\src\TemperatureCalculator.c + + + ICCARM + 139 + + + BICOMP + 111 + + + + + ICCARM + 71 40 0 28 30 88 3 32 27 68 98 + + + BICOMP + 71 40 0 28 30 88 3 27 68 98 + + + + + $PROJ_DIR$\..\test\system\src\TemperatureFilter.c + + + ICCARM + 110 + + + BICOMP + 121 + + + + + ICCARM + 71 40 60 28 30 88 3 32 27 68 98 + + + BICOMP + 71 40 60 28 30 88 3 27 68 98 + + + + + $PROJ_DIR$\..\test\system\src\TimerConductor.c + + + ICCARM + 114 + + + BICOMP + 95 + + + + + ICCARM + 71 40 80 44 62 45 + + + BICOMP + 71 40 80 44 62 45 + + + + + $PROJ_DIR$\..\test\system\src\TimerConfigurator.c + + + ICCARM + 126 + + + BICOMP + 100 + + + + + ICCARM + 71 40 39 58 + + + BICOMP + 71 40 39 58 + + + + + $PROJ_DIR$\..\test\system\src\TimerHardware.c + + + ICCARM + 109 + + + BICOMP + 92 + + + + + ICCARM + 71 40 62 39 + + + BICOMP + 71 40 62 39 + + + + + $PROJ_DIR$\..\test\system\src\TimerInterruptHandler.c + + + ICCARM + 151 + + + BICOMP + 128 + + + + + ICCARM + 71 40 45 58 + + + BICOMP + 71 40 45 58 + + + + + $PROJ_DIR$\..\test\system\src\UsartConductor.c + + + ICCARM + 108 + + + BICOMP + 116 + + + + + ICCARM + 71 40 83 79 84 36 + + + BICOMP + 71 40 83 79 84 36 + + + + + $PROJ_DIR$\..\test\system\src\UsartConfigurator.c + + + ICCARM + 141 + + + BICOMP + 136 + + + + + ICCARM + 71 40 38 + + + BICOMP + 71 40 38 + + + + + $PROJ_DIR$\Simulate\Exe\cmock_demo.d79 + + + XLINK + 131 101 + + + + + XLINK + 170 85 103 107 129 143 127 138 91 94 104 135 134 139 110 114 126 109 112 151 120 145 108 141 87 137 106 113 69 + + + + + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + + + ICCARM + 114 169 + + + BICOMP + 95 + + + + + ICCARM + 1 4 15 23 25 22 + + + BICOMP + 1 4 15 23 25 22 + + + + + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + + + ICCARM + 126 155 + + + BICOMP + 100 + + + + + ICCARM + 1 4 24 21 + + + BICOMP + 1 4 24 21 + + + + + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + + + ICCARM + 109 164 + + + BICOMP + 92 + + + + + ICCARM + 1 4 25 24 + + + BICOMP + 1 4 25 24 + + + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + + + ICCARM + 112 149 + + + BICOMP + 132 + + + + + ICCARM + 1 4 21 22 + + + BICOMP + 1 4 21 22 + + + + + $PROJ_DIR$\..\..\examples\src\TimerModel.c + + + ICCARM + 120 90 + + + BICOMP + 117 + + + + + ICCARM + 1 4 23 6 + + + BICOMP + 1 4 23 6 + + + + + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + + + ICCARM + 145 146 + + + BICOMP + 122 + + + + + ICCARM + 1 4 26 + + + BICOMP + 1 4 26 + + + + + $PROJ_DIR$\..\..\examples\src\UsartModel.c + + + ICCARM + 137 167 + + + BICOMP + 93 + + + + + ICCARM + 1 4 17 200 26 14 29 88 3 32 27 68 98 31 28 30 + + + BICOMP + 1 4 17 200 26 14 29 88 3 27 68 98 31 28 30 + + + + + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + + + ICCARM + 108 96 + + + BICOMP + 116 + + + + + ICCARM + 1 4 7 19 17 6 + + + BICOMP + 1 4 7 19 17 6 + + + + + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + + + ICCARM + 141 162 + + + BICOMP + 136 + + + + + ICCARM + 1 4 12 + + + BICOMP + 1 4 12 + + + + + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + + + ICCARM + 87 153 + + + BICOMP + 123 + + + + + ICCARM + 1 4 19 12 16 + + + BICOMP + 1 4 19 12 16 + + + + + $PROJ_DIR$\Cstartup.s79 + + + AARM + 127 + + + + + AARM + 89 + + + + + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + + + ICCARM + 106 152 + + + BICOMP + 140 + + + + + ICCARM + 1 4 16 20 29 88 3 32 27 68 98 31 + + + BICOMP + 1 4 16 20 29 88 3 27 68 98 31 + + + + + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + + + ICCARM + 113 147 + + + BICOMP + 102 + + + + + ICCARM + 1 4 20 + + + BICOMP + 1 4 20 + + + + + $PROJ_DIR$\Cstartup_SAM7.c + + + ICCARM + 138 157 + + + BICOMP + 86 + + + + + ICCARM + 4 + + + BICOMP + 4 + + + + + $PROJ_DIR$\..\..\examples\src\AdcModel.c + + + ICCARM + 129 159 + + + BICOMP + 118 + + + + + ICCARM + 1 4 199 6 10 14 + + + BICOMP + 1 4 199 6 10 14 + + + + + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + + + ICCARM + 143 156 + + + BICOMP + 105 + + + + + ICCARM + 1 4 11 + + + BICOMP + 1 4 11 + + + + + $PROJ_DIR$\..\..\examples\src\Executor.c + + + ICCARM + 91 154 + + + BICOMP + 115 + + + + + ICCARM + 1 4 198 8 7 15 5 18 + + + BICOMP + 1 4 198 8 7 15 5 18 + + + + + $PROJ_DIR$\..\..\examples\src\Main.c + + + ICCARM + 104 168 + + + BICOMP + 97 + + + + + ICCARM + 1 4 18 198 8 6 10 14 7 19 12 16 17 26 20 15 25 24 21 22 23 5 13 2 11 199 + + + BICOMP + 1 4 18 198 8 6 10 14 7 19 12 16 17 26 20 15 25 24 21 22 23 5 13 2 11 199 + + + + + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + + + ICCARM + 94 163 + + + BICOMP + 130 + + + + + ICCARM + 18 9 + + + BICOMP + 18 9 + + + + + $PROJ_DIR$\..\..\examples\src\Model.c + + + ICCARM + 135 150 + + + BICOMP + 144 + + + + + ICCARM + 8 1 4 6 14 + + + BICOMP + 8 1 4 6 14 + + + + + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + + + ICCARM + 139 165 + + + BICOMP + 111 + + + + + ICCARM + 1 4 10 28 30 88 3 32 27 68 98 + + + BICOMP + 1 4 10 28 30 88 3 27 68 98 + + + + + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + + + ICCARM + 134 119 + + + BICOMP + 124 + + + + + ICCARM + 1 4 6 + + + BICOMP + 1 4 6 + + + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + + + ICCARM + 151 166 + + + BICOMP + 128 + + + + + ICCARM + 1 4 22 21 + + + BICOMP + 1 4 22 21 + + + + + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + + + ICCARM + 110 160 + + + BICOMP + 121 + + + + + ICCARM + 1 4 14 28 30 88 3 32 27 68 98 + + + BICOMP + 1 4 14 28 30 88 3 27 68 98 + + + + + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + + + ICCARM + 107 158 + + + BICOMP + 99 + + + + + ICCARM + 1 4 2 200 + + + BICOMP + 1 4 2 200 + + + + + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + + + ICCARM + 85 161 + + + BICOMP + 125 + + + + + ICCARM + 1 4 5 199 13 + + + BICOMP + 1 4 5 199 13 + + + + + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + + + ICCARM + 103 148 + + + BICOMP + 142 + + + + + ICCARM + 1 4 13 2 11 + + + BICOMP + 1 4 13 2 11 + + + + + $PROJ_DIR$\srcIAR\Cstartup.s79 + + + AARM + 127 + + + + + AARM + 89 + + + + + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + + + ICCARM + 138 157 + + + BICOMP + 86 + + + + + ICCARM + 4 + + + BICOMP + 4 + + + + + + + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/cmock_demo.ewd b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/cmock_demo.ewd new file mode 100644 index 0000000..37a724d --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/cmock_demo.ewd @@ -0,0 +1,1696 @@ + + + + 1 + + Debug + + ARM + + 1 + + C-SPY + 2 + + 13 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 0 + 1 + 1 + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + JLINK_ID + 2 + + 6 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + MACRAIGOR_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ewplugin + 1 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CMXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CMXTinyArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + + + Simulate + + ARM + + 1 + + C-SPY + 2 + + 13 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 0 + 1 + 1 + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + JLINK_ID + 2 + + 6 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + MACRAIGOR_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ewplugin + 1 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CMXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CMXTinyArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + + + Release + + ARM + + 0 + + C-SPY + 2 + + 13 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 0 + 1 + 0 + + + + + ANGEL_ID + 2 + + 0 + 1 + 0 + + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 0 + + + + + + + + + + JLINK_ID + 2 + + 6 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 0 + 1 + 0 + + + + + + + + + + + + MACRAIGOR_ID + 2 + + 2 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 0 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 0 + + + + + + + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ewplugin + 1 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CMXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CMXTinyArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + + + + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/cmock_demo.ewp b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/cmock_demo.ewp new file mode 100644 index 0000000..ec55fbe --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/cmock_demo.ewp @@ -0,0 +1,2581 @@ + + + + 1 + + Debug + + ARM + + 1 + + General + 2 + + 9 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 14 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + XLINK + 2 + + 18 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + XAR + 2 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + Simulate + + ARM + + 1 + + General + 2 + + 9 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 14 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + XLINK + 2 + + 18 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + XAR + 2 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + Release + + ARM + + 0 + + General + 2 + + 9 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 14 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + XLINK + 2 + + 18 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + XAR + 2 + + 0 + 1 + 0 + + + + + + + BILINK + 0 + + + + + Resource + + $PROJ_DIR$\Resource\at91SAM7X256_FLASH.xcl + + + $PROJ_DIR$\Resource\at91SAM7X256_RAM.xcl + + + $PROJ_DIR$\Resource\SAM7_FLASH.mac + + + $PROJ_DIR$\Resource\SAM7_RAM.mac + + + $PROJ_DIR$\Resource\SAM7_SIM.mac + + + + Source + + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + + + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + + + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + + + $PROJ_DIR$\..\..\examples\src\AdcModel.c + + + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + + + $PROJ_DIR$\..\..\examples\src\Executor.c + + + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + + + $PROJ_DIR$\..\..\examples\src\Main.c + + + $PROJ_DIR$\..\..\examples\src\Model.c + + + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + + + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + + + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + + + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + + + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + + + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + + + $PROJ_DIR$\..\..\examples\src\TimerModel.c + + + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + + + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + + + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + + + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + + + $PROJ_DIR$\..\..\examples\src\UsartModel.c + + + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + + + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + + + + Startup + + $PROJ_DIR$\srcIAR\Cstartup.s79 + + + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + + + + + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/cmock_demo.eww b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/cmock_demo.eww new file mode 100644 index 0000000..5f78f6e --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/cmock_demo.eww @@ -0,0 +1,10 @@ + + + + + $WS_DIR$\cmock_demo.ewp + + + + + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X-EK.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X-EK.h new file mode 100644 index 0000000..9834675 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X-EK.h @@ -0,0 +1,61 @@ +// ---------------------------------------------------------------------------- +// ATMEL Microcontroller Software Support - ROUSSET - +// ---------------------------------------------------------------------------- +// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// ---------------------------------------------------------------------------- +// File Name : AT91SAM7X-EK.h +// Object : AT91SAM7X-EK Evaluation Board Features Definition File +// +// ---------------------------------------------------------------------------- + +#ifndef AT91SAM7X_EK_H +#define AT91SAM7X_EK_H + +/*-----------------*/ +/* LEDs Definition */ +/*-----------------*/ +#define AT91B_LED1 (1<<19) // AT91C_PIO_PB19 AT91C_PB19_PWM0 AT91C_PB19_TCLK1 +#define AT91B_LED2 (1<<20) // AT91C_PIO_PB20 AT91C_PB20_PWM1 AT91C_PB20_PWM1 +#define AT91B_LED3 (AT91C_PIO_PB21) // AT91C_PIO_PB21 AT91C_PB21_PWM2 AT91C_PB21_PCK1 +#define AT91B_LED4 (AT91C_PIO_PB22) // AT91C_PIO_PB22 AT91C_PB22_PWM3 AT91C_PB22_PCK2 +#define AT91B_NB_LEB 4 +#define AT91B_LED_MASK (AT91B_LED1|AT91B_LED2|AT91B_LED3|AT91B_LED4) +#define AT91D_BASE_PIO_LED (AT91C_BASE_PIOB) + +#define AT91B_POWERLED (1<<25) // PB25 + + +/*-------------------------------*/ +/* JOYSTICK Position Definition */ +/*-------------------------------*/ +#define AT91B_SW1 (1<<21) // PA21 Up Button AT91C_PA21_TF AT91C_PA21_NPCS10 +#define AT91B_SW2 (1<<22) // PA22 Down Button AT91C_PA22_TK AT91C_PA22_SPCK1 +#define AT91B_SW3 (1<<23) // PA23 Left Button AT91C_PA23_TD AT91C_PA23_MOSI1 +#define AT91B_SW4 (1<<24) // PA24 Right Button AT91C_PA24_RD AT91C_PA24_MISO1 +#define AT91B_SW5 (1<<25) // PA25 Push Button AT91C_PA25_RK AT91C_PA25_NPCS11 +#define AT91B_SW_MASK (AT91B_SW1|AT91B_SW2|AT91B_SW3|AT91B_SW4|AT91B_SW5) + + +#define AT91D_BASE_PIO_SW (AT91C_BASE_PIOA) + +/*------------------*/ +/* CAN Definition */ +/*------------------*/ +#define AT91B_CAN_TRANSCEIVER_RS (1<<2) // PA2 + +/*--------------*/ +/* Clocks */ +/*--------------*/ +#define AT91B_MAIN_OSC 18432000 // Main Oscillator MAINCK +#define AT91B_MCK ((18432000*73/14)/2) // Output PLL Clock + +#endif /* AT91SAM7X-EK_H */ diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.inc b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.inc new file mode 100644 index 0000000..da33985 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.inc @@ -0,0 +1,2314 @@ +;- ---------------------------------------------------------------------------- +;- ATMEL Microcontroller Software Support - ROUSSET - +;- ---------------------------------------------------------------------------- +;- DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +;- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +;- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +;- DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +;- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +;- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +;- OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +;- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +;- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +;- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +;- ---------------------------------------------------------------------------- +;- File Name : AT91SAM7X256.h +;- Object : AT91SAM7X256 definitions +;- Generated : AT91 SW Application Group 11/02/2005 (15:17:24) +;- +;- CVS Reference : /AT91SAM7X256.pl/1.14/Tue Sep 13 15:06:52 2005// +;- CVS Reference : /SYS_SAM7X.pl/1.3/Tue Feb 1 17:01:43 2005// +;- CVS Reference : /MC_SAM7X.pl/1.2/Fri May 20 14:13:04 2005// +;- CVS Reference : /PMC_SAM7X.pl/1.4/Tue Feb 8 13:58:10 2005// +;- CVS Reference : /RSTC_SAM7X.pl/1.2/Wed Jul 13 14:57:50 2005// +;- CVS Reference : /UDP_SAM7X.pl/1.1/Tue May 10 11:35:35 2005// +;- CVS Reference : /PWM_SAM7X.pl/1.1/Tue May 10 11:53:07 2005// +;- CVS Reference : /AIC_6075B.pl/1.3/Fri May 20 14:01:30 2005// +;- CVS Reference : /PIO_6057A.pl/1.2/Thu Feb 3 10:18:28 2005// +;- CVS Reference : /RTTC_6081A.pl/1.2/Tue Nov 9 14:43:58 2004// +;- CVS Reference : /PITC_6079A.pl/1.2/Tue Nov 9 14:43:56 2004// +;- CVS Reference : /WDTC_6080A.pl/1.3/Tue Nov 9 14:44:00 2004// +;- CVS Reference : /VREG_6085B.pl/1.1/Tue Feb 1 16:05:48 2005// +;- CVS Reference : /PDC_6074C.pl/1.2/Thu Feb 3 08:48:54 2005// +;- CVS Reference : /DBGU_6059D.pl/1.1/Mon Jan 31 13:15:32 2005// +;- CVS Reference : /SPI_6088D.pl/1.3/Fri May 20 14:08:59 2005// +;- CVS Reference : /US_6089C.pl/1.1/Mon Jul 12 18:23:26 2004// +;- CVS Reference : /SSC_6078B.pl/1.1/Wed Jul 13 15:19:19 2005// +;- CVS Reference : /TWI_6061A.pl/1.1/Tue Jul 13 07:38:06 2004// +;- CVS Reference : /TC_6082A.pl/1.7/Fri Mar 11 12:52:17 2005// +;- CVS Reference : /CAN_6019B.pl/1.1/Tue Mar 8 12:42:22 2005// +;- CVS Reference : /EMACB_6119A.pl/1.6/Wed Jul 13 15:05:35 2005// +;- CVS Reference : /ADC_6051C.pl/1.1/Fri Oct 17 09:12:38 2003// +;- ---------------------------------------------------------------------------- + +;- Hardware register definition + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR System Peripherals +;- ***************************************************************************** + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Advanced Interrupt Controller +;- ***************************************************************************** + ^ 0 ;- AT91S_AIC +AIC_SMR # 128 ;- Source Mode Register +AIC_SVR # 128 ;- Source Vector Register +AIC_IVR # 4 ;- IRQ Vector Register +AIC_FVR # 4 ;- FIQ Vector Register +AIC_ISR # 4 ;- Interrupt Status Register +AIC_IPR # 4 ;- Interrupt Pending Register +AIC_IMR # 4 ;- Interrupt Mask Register +AIC_CISR # 4 ;- Core Interrupt Status Register + # 8 ;- Reserved +AIC_IECR # 4 ;- Interrupt Enable Command Register +AIC_IDCR # 4 ;- Interrupt Disable Command Register +AIC_ICCR # 4 ;- Interrupt Clear Command Register +AIC_ISCR # 4 ;- Interrupt Set Command Register +AIC_EOICR # 4 ;- End of Interrupt Command Register +AIC_SPU # 4 ;- Spurious Vector Register +AIC_DCR # 4 ;- Debug Control Register (Protect) + # 4 ;- Reserved +AIC_FFER # 4 ;- Fast Forcing Enable Register +AIC_FFDR # 4 ;- Fast Forcing Disable Register +AIC_FFSR # 4 ;- Fast Forcing Status Register +;- -------- AIC_SMR : (AIC Offset: 0x0) Control Register -------- +AT91C_AIC_PRIOR EQU (0x7:SHL:0) ;- (AIC) Priority Level +AT91C_AIC_PRIOR_LOWEST EQU (0x0) ;- (AIC) Lowest priority level +AT91C_AIC_PRIOR_HIGHEST EQU (0x7) ;- (AIC) Highest priority level +AT91C_AIC_SRCTYPE EQU (0x3:SHL:5) ;- (AIC) Interrupt Source Type +AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL EQU (0x0:SHL:5) ;- (AIC) Internal Sources Code Label High-level Sensitive +AT91C_AIC_SRCTYPE_EXT_LOW_LEVEL EQU (0x0:SHL:5) ;- (AIC) External Sources Code Label Low-level Sensitive +AT91C_AIC_SRCTYPE_INT_POSITIVE_EDGE EQU (0x1:SHL:5) ;- (AIC) Internal Sources Code Label Positive Edge triggered +AT91C_AIC_SRCTYPE_EXT_NEGATIVE_EDGE EQU (0x1:SHL:5) ;- (AIC) External Sources Code Label Negative Edge triggered +AT91C_AIC_SRCTYPE_HIGH_LEVEL EQU (0x2:SHL:5) ;- (AIC) Internal Or External Sources Code Label High-level Sensitive +AT91C_AIC_SRCTYPE_POSITIVE_EDGE EQU (0x3:SHL:5) ;- (AIC) Internal Or External Sources Code Label Positive Edge triggered +;- -------- AIC_CISR : (AIC Offset: 0x114) AIC Core Interrupt Status Register -------- +AT91C_AIC_NFIQ EQU (0x1:SHL:0) ;- (AIC) NFIQ Status +AT91C_AIC_NIRQ EQU (0x1:SHL:1) ;- (AIC) NIRQ Status +;- -------- AIC_DCR : (AIC Offset: 0x138) AIC Debug Control Register (Protect) -------- +AT91C_AIC_DCR_PROT EQU (0x1:SHL:0) ;- (AIC) Protection Mode +AT91C_AIC_DCR_GMSK EQU (0x1:SHL:1) ;- (AIC) General Mask + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Peripheral DMA Controller +;- ***************************************************************************** + ^ 0 ;- AT91S_PDC +PDC_RPR # 4 ;- Receive Pointer Register +PDC_RCR # 4 ;- Receive Counter Register +PDC_TPR # 4 ;- Transmit Pointer Register +PDC_TCR # 4 ;- Transmit Counter Register +PDC_RNPR # 4 ;- Receive Next Pointer Register +PDC_RNCR # 4 ;- Receive Next Counter Register +PDC_TNPR # 4 ;- Transmit Next Pointer Register +PDC_TNCR # 4 ;- Transmit Next Counter Register +PDC_PTCR # 4 ;- PDC Transfer Control Register +PDC_PTSR # 4 ;- PDC Transfer Status Register +;- -------- PDC_PTCR : (PDC Offset: 0x20) PDC Transfer Control Register -------- +AT91C_PDC_RXTEN EQU (0x1:SHL:0) ;- (PDC) Receiver Transfer Enable +AT91C_PDC_RXTDIS EQU (0x1:SHL:1) ;- (PDC) Receiver Transfer Disable +AT91C_PDC_TXTEN EQU (0x1:SHL:8) ;- (PDC) Transmitter Transfer Enable +AT91C_PDC_TXTDIS EQU (0x1:SHL:9) ;- (PDC) Transmitter Transfer Disable +;- -------- PDC_PTSR : (PDC Offset: 0x24) PDC Transfer Status Register -------- + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Debug Unit +;- ***************************************************************************** + ^ 0 ;- AT91S_DBGU +DBGU_CR # 4 ;- Control Register +DBGU_MR # 4 ;- Mode Register +DBGU_IER # 4 ;- Interrupt Enable Register +DBGU_IDR # 4 ;- Interrupt Disable Register +DBGU_IMR # 4 ;- Interrupt Mask Register +DBGU_CSR # 4 ;- Channel Status Register +DBGU_RHR # 4 ;- Receiver Holding Register +DBGU_THR # 4 ;- Transmitter Holding Register +DBGU_BRGR # 4 ;- Baud Rate Generator Register + # 28 ;- Reserved +DBGU_CIDR # 4 ;- Chip ID Register +DBGU_EXID # 4 ;- Chip ID Extension Register +DBGU_FNTR # 4 ;- Force NTRST Register + # 180 ;- Reserved +DBGU_RPR # 4 ;- Receive Pointer Register +DBGU_RCR # 4 ;- Receive Counter Register +DBGU_TPR # 4 ;- Transmit Pointer Register +DBGU_TCR # 4 ;- Transmit Counter Register +DBGU_RNPR # 4 ;- Receive Next Pointer Register +DBGU_RNCR # 4 ;- Receive Next Counter Register +DBGU_TNPR # 4 ;- Transmit Next Pointer Register +DBGU_TNCR # 4 ;- Transmit Next Counter Register +DBGU_PTCR # 4 ;- PDC Transfer Control Register +DBGU_PTSR # 4 ;- PDC Transfer Status Register +;- -------- DBGU_CR : (DBGU Offset: 0x0) Debug Unit Control Register -------- +AT91C_US_RSTRX EQU (0x1:SHL:2) ;- (DBGU) Reset Receiver +AT91C_US_RSTTX EQU (0x1:SHL:3) ;- (DBGU) Reset Transmitter +AT91C_US_RXEN EQU (0x1:SHL:4) ;- (DBGU) Receiver Enable +AT91C_US_RXDIS EQU (0x1:SHL:5) ;- (DBGU) Receiver Disable +AT91C_US_TXEN EQU (0x1:SHL:6) ;- (DBGU) Transmitter Enable +AT91C_US_TXDIS EQU (0x1:SHL:7) ;- (DBGU) Transmitter Disable +AT91C_US_RSTSTA EQU (0x1:SHL:8) ;- (DBGU) Reset Status Bits +;- -------- DBGU_MR : (DBGU Offset: 0x4) Debug Unit Mode Register -------- +AT91C_US_PAR EQU (0x7:SHL:9) ;- (DBGU) Parity type +AT91C_US_PAR_EVEN EQU (0x0:SHL:9) ;- (DBGU) Even Parity +AT91C_US_PAR_ODD EQU (0x1:SHL:9) ;- (DBGU) Odd Parity +AT91C_US_PAR_SPACE EQU (0x2:SHL:9) ;- (DBGU) Parity forced to 0 (Space) +AT91C_US_PAR_MARK EQU (0x3:SHL:9) ;- (DBGU) Parity forced to 1 (Mark) +AT91C_US_PAR_NONE EQU (0x4:SHL:9) ;- (DBGU) No Parity +AT91C_US_PAR_MULTI_DROP EQU (0x6:SHL:9) ;- (DBGU) Multi-drop mode +AT91C_US_CHMODE EQU (0x3:SHL:14) ;- (DBGU) Channel Mode +AT91C_US_CHMODE_NORMAL EQU (0x0:SHL:14) ;- (DBGU) Normal Mode: The USART channel operates as an RX/TX USART. +AT91C_US_CHMODE_AUTO EQU (0x1:SHL:14) ;- (DBGU) Automatic Echo: Receiver Data Input is connected to the TXD pin. +AT91C_US_CHMODE_LOCAL EQU (0x2:SHL:14) ;- (DBGU) Local Loopback: Transmitter Output Signal is connected to Receiver Input Signal. +AT91C_US_CHMODE_REMOTE EQU (0x3:SHL:14) ;- (DBGU) Remote Loopback: RXD pin is internally connected to TXD pin. +;- -------- DBGU_IER : (DBGU Offset: 0x8) Debug Unit Interrupt Enable Register -------- +AT91C_US_RXRDY EQU (0x1:SHL:0) ;- (DBGU) RXRDY Interrupt +AT91C_US_TXRDY EQU (0x1:SHL:1) ;- (DBGU) TXRDY Interrupt +AT91C_US_ENDRX EQU (0x1:SHL:3) ;- (DBGU) End of Receive Transfer Interrupt +AT91C_US_ENDTX EQU (0x1:SHL:4) ;- (DBGU) End of Transmit Interrupt +AT91C_US_OVRE EQU (0x1:SHL:5) ;- (DBGU) Overrun Interrupt +AT91C_US_FRAME EQU (0x1:SHL:6) ;- (DBGU) Framing Error Interrupt +AT91C_US_PARE EQU (0x1:SHL:7) ;- (DBGU) Parity Error Interrupt +AT91C_US_TXEMPTY EQU (0x1:SHL:9) ;- (DBGU) TXEMPTY Interrupt +AT91C_US_TXBUFE EQU (0x1:SHL:11) ;- (DBGU) TXBUFE Interrupt +AT91C_US_RXBUFF EQU (0x1:SHL:12) ;- (DBGU) RXBUFF Interrupt +AT91C_US_COMM_TX EQU (0x1:SHL:30) ;- (DBGU) COMM_TX Interrupt +AT91C_US_COMM_RX EQU (0x1:SHL:31) ;- (DBGU) COMM_RX Interrupt +;- -------- DBGU_IDR : (DBGU Offset: 0xc) Debug Unit Interrupt Disable Register -------- +;- -------- DBGU_IMR : (DBGU Offset: 0x10) Debug Unit Interrupt Mask Register -------- +;- -------- DBGU_CSR : (DBGU Offset: 0x14) Debug Unit Channel Status Register -------- +;- -------- DBGU_FNTR : (DBGU Offset: 0x48) Debug Unit FORCE_NTRST Register -------- +AT91C_US_FORCE_NTRST EQU (0x1:SHL:0) ;- (DBGU) Force NTRST in JTAG + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Parallel Input Output Controler +;- ***************************************************************************** + ^ 0 ;- AT91S_PIO +PIO_PER # 4 ;- PIO Enable Register +PIO_PDR # 4 ;- PIO Disable Register +PIO_PSR # 4 ;- PIO Status Register + # 4 ;- Reserved +PIO_OER # 4 ;- Output Enable Register +PIO_ODR # 4 ;- Output Disable Registerr +PIO_OSR # 4 ;- Output Status Register + # 4 ;- Reserved +PIO_IFER # 4 ;- Input Filter Enable Register +PIO_IFDR # 4 ;- Input Filter Disable Register +PIO_IFSR # 4 ;- Input Filter Status Register + # 4 ;- Reserved +PIO_SODR # 4 ;- Set Output Data Register +PIO_CODR # 4 ;- Clear Output Data Register +PIO_ODSR # 4 ;- Output Data Status Register +PIO_PDSR # 4 ;- Pin Data Status Register +PIO_IER # 4 ;- Interrupt Enable Register +PIO_IDR # 4 ;- Interrupt Disable Register +PIO_IMR # 4 ;- Interrupt Mask Register +PIO_ISR # 4 ;- Interrupt Status Register +PIO_MDER # 4 ;- Multi-driver Enable Register +PIO_MDDR # 4 ;- Multi-driver Disable Register +PIO_MDSR # 4 ;- Multi-driver Status Register + # 4 ;- Reserved +PIO_PPUDR # 4 ;- Pull-up Disable Register +PIO_PPUER # 4 ;- Pull-up Enable Register +PIO_PPUSR # 4 ;- Pull-up Status Register + # 4 ;- Reserved +PIO_ASR # 4 ;- Select A Register +PIO_BSR # 4 ;- Select B Register +PIO_ABSR # 4 ;- AB Select Status Register + # 36 ;- Reserved +PIO_OWER # 4 ;- Output Write Enable Register +PIO_OWDR # 4 ;- Output Write Disable Register +PIO_OWSR # 4 ;- Output Write Status Register + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Clock Generator Controler +;- ***************************************************************************** + ^ 0 ;- AT91S_CKGR +CKGR_MOR # 4 ;- Main Oscillator Register +CKGR_MCFR # 4 ;- Main Clock Frequency Register + # 4 ;- Reserved +CKGR_PLLR # 4 ;- PLL Register +;- -------- CKGR_MOR : (CKGR Offset: 0x0) Main Oscillator Register -------- +AT91C_CKGR_MOSCEN EQU (0x1:SHL:0) ;- (CKGR) Main Oscillator Enable +AT91C_CKGR_OSCBYPASS EQU (0x1:SHL:1) ;- (CKGR) Main Oscillator Bypass +AT91C_CKGR_OSCOUNT EQU (0xFF:SHL:8) ;- (CKGR) Main Oscillator Start-up Time +;- -------- CKGR_MCFR : (CKGR Offset: 0x4) Main Clock Frequency Register -------- +AT91C_CKGR_MAINF EQU (0xFFFF:SHL:0) ;- (CKGR) Main Clock Frequency +AT91C_CKGR_MAINRDY EQU (0x1:SHL:16) ;- (CKGR) Main Clock Ready +;- -------- CKGR_PLLR : (CKGR Offset: 0xc) PLL B Register -------- +AT91C_CKGR_DIV EQU (0xFF:SHL:0) ;- (CKGR) Divider Selected +AT91C_CKGR_DIV_0 EQU (0x0) ;- (CKGR) Divider output is 0 +AT91C_CKGR_DIV_BYPASS EQU (0x1) ;- (CKGR) Divider is bypassed +AT91C_CKGR_PLLCOUNT EQU (0x3F:SHL:8) ;- (CKGR) PLL Counter +AT91C_CKGR_OUT EQU (0x3:SHL:14) ;- (CKGR) PLL Output Frequency Range +AT91C_CKGR_OUT_0 EQU (0x0:SHL:14) ;- (CKGR) Please refer to the PLL datasheet +AT91C_CKGR_OUT_1 EQU (0x1:SHL:14) ;- (CKGR) Please refer to the PLL datasheet +AT91C_CKGR_OUT_2 EQU (0x2:SHL:14) ;- (CKGR) Please refer to the PLL datasheet +AT91C_CKGR_OUT_3 EQU (0x3:SHL:14) ;- (CKGR) Please refer to the PLL datasheet +AT91C_CKGR_MUL EQU (0x7FF:SHL:16) ;- (CKGR) PLL Multiplier +AT91C_CKGR_USBDIV EQU (0x3:SHL:28) ;- (CKGR) Divider for USB Clocks +AT91C_CKGR_USBDIV_0 EQU (0x0:SHL:28) ;- (CKGR) Divider output is PLL clock output +AT91C_CKGR_USBDIV_1 EQU (0x1:SHL:28) ;- (CKGR) Divider output is PLL clock output divided by 2 +AT91C_CKGR_USBDIV_2 EQU (0x2:SHL:28) ;- (CKGR) Divider output is PLL clock output divided by 4 + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Power Management Controler +;- ***************************************************************************** + ^ 0 ;- AT91S_PMC +PMC_SCER # 4 ;- System Clock Enable Register +PMC_SCDR # 4 ;- System Clock Disable Register +PMC_SCSR # 4 ;- System Clock Status Register + # 4 ;- Reserved +PMC_PCER # 4 ;- Peripheral Clock Enable Register +PMC_PCDR # 4 ;- Peripheral Clock Disable Register +PMC_PCSR # 4 ;- Peripheral Clock Status Register + # 4 ;- Reserved +PMC_MOR # 4 ;- Main Oscillator Register +PMC_MCFR # 4 ;- Main Clock Frequency Register + # 4 ;- Reserved +PMC_PLLR # 4 ;- PLL Register +PMC_MCKR # 4 ;- Master Clock Register + # 12 ;- Reserved +PMC_PCKR # 16 ;- Programmable Clock Register + # 16 ;- Reserved +PMC_IER # 4 ;- Interrupt Enable Register +PMC_IDR # 4 ;- Interrupt Disable Register +PMC_SR # 4 ;- Status Register +PMC_IMR # 4 ;- Interrupt Mask Register +;- -------- PMC_SCER : (PMC Offset: 0x0) System Clock Enable Register -------- +AT91C_PMC_PCK EQU (0x1:SHL:0) ;- (PMC) Processor Clock +AT91C_PMC_UDP EQU (0x1:SHL:7) ;- (PMC) USB Device Port Clock +AT91C_PMC_PCK0 EQU (0x1:SHL:8) ;- (PMC) Programmable Clock Output +AT91C_PMC_PCK1 EQU (0x1:SHL:9) ;- (PMC) Programmable Clock Output +AT91C_PMC_PCK2 EQU (0x1:SHL:10) ;- (PMC) Programmable Clock Output +AT91C_PMC_PCK3 EQU (0x1:SHL:11) ;- (PMC) Programmable Clock Output +;- -------- PMC_SCDR : (PMC Offset: 0x4) System Clock Disable Register -------- +;- -------- PMC_SCSR : (PMC Offset: 0x8) System Clock Status Register -------- +;- -------- CKGR_MOR : (PMC Offset: 0x20) Main Oscillator Register -------- +;- -------- CKGR_MCFR : (PMC Offset: 0x24) Main Clock Frequency Register -------- +;- -------- CKGR_PLLR : (PMC Offset: 0x2c) PLL B Register -------- +;- -------- PMC_MCKR : (PMC Offset: 0x30) Master Clock Register -------- +AT91C_PMC_CSS EQU (0x3:SHL:0) ;- (PMC) Programmable Clock Selection +AT91C_PMC_CSS_SLOW_CLK EQU (0x0) ;- (PMC) Slow Clock is selected +AT91C_PMC_CSS_MAIN_CLK EQU (0x1) ;- (PMC) Main Clock is selected +AT91C_PMC_CSS_PLL_CLK EQU (0x3) ;- (PMC) Clock from PLL is selected +AT91C_PMC_PRES EQU (0x7:SHL:2) ;- (PMC) Programmable Clock Prescaler +AT91C_PMC_PRES_CLK EQU (0x0:SHL:2) ;- (PMC) Selected clock +AT91C_PMC_PRES_CLK_2 EQU (0x1:SHL:2) ;- (PMC) Selected clock divided by 2 +AT91C_PMC_PRES_CLK_4 EQU (0x2:SHL:2) ;- (PMC) Selected clock divided by 4 +AT91C_PMC_PRES_CLK_8 EQU (0x3:SHL:2) ;- (PMC) Selected clock divided by 8 +AT91C_PMC_PRES_CLK_16 EQU (0x4:SHL:2) ;- (PMC) Selected clock divided by 16 +AT91C_PMC_PRES_CLK_32 EQU (0x5:SHL:2) ;- (PMC) Selected clock divided by 32 +AT91C_PMC_PRES_CLK_64 EQU (0x6:SHL:2) ;- (PMC) Selected clock divided by 64 +;- -------- PMC_PCKR : (PMC Offset: 0x40) Programmable Clock Register -------- +;- -------- PMC_IER : (PMC Offset: 0x60) PMC Interrupt Enable Register -------- +AT91C_PMC_MOSCS EQU (0x1:SHL:0) ;- (PMC) MOSC Status/Enable/Disable/Mask +AT91C_PMC_LOCK EQU (0x1:SHL:2) ;- (PMC) PLL Status/Enable/Disable/Mask +AT91C_PMC_MCKRDY EQU (0x1:SHL:3) ;- (PMC) MCK_RDY Status/Enable/Disable/Mask +AT91C_PMC_PCK0RDY EQU (0x1:SHL:8) ;- (PMC) PCK0_RDY Status/Enable/Disable/Mask +AT91C_PMC_PCK1RDY EQU (0x1:SHL:9) ;- (PMC) PCK1_RDY Status/Enable/Disable/Mask +AT91C_PMC_PCK2RDY EQU (0x1:SHL:10) ;- (PMC) PCK2_RDY Status/Enable/Disable/Mask +AT91C_PMC_PCK3RDY EQU (0x1:SHL:11) ;- (PMC) PCK3_RDY Status/Enable/Disable/Mask +;- -------- PMC_IDR : (PMC Offset: 0x64) PMC Interrupt Disable Register -------- +;- -------- PMC_SR : (PMC Offset: 0x68) PMC Status Register -------- +;- -------- PMC_IMR : (PMC Offset: 0x6c) PMC Interrupt Mask Register -------- + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Reset Controller Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_RSTC +RSTC_RCR # 4 ;- Reset Control Register +RSTC_RSR # 4 ;- Reset Status Register +RSTC_RMR # 4 ;- Reset Mode Register +;- -------- RSTC_RCR : (RSTC Offset: 0x0) Reset Control Register -------- +AT91C_RSTC_PROCRST EQU (0x1:SHL:0) ;- (RSTC) Processor Reset +AT91C_RSTC_PERRST EQU (0x1:SHL:2) ;- (RSTC) Peripheral Reset +AT91C_RSTC_EXTRST EQU (0x1:SHL:3) ;- (RSTC) External Reset +AT91C_RSTC_KEY EQU (0xFF:SHL:24) ;- (RSTC) Password +;- -------- RSTC_RSR : (RSTC Offset: 0x4) Reset Status Register -------- +AT91C_RSTC_URSTS EQU (0x1:SHL:0) ;- (RSTC) User Reset Status +AT91C_RSTC_BODSTS EQU (0x1:SHL:1) ;- (RSTC) Brownout Detection Status +AT91C_RSTC_RSTTYP EQU (0x7:SHL:8) ;- (RSTC) Reset Type +AT91C_RSTC_RSTTYP_POWERUP EQU (0x0:SHL:8) ;- (RSTC) Power-up Reset. VDDCORE rising. +AT91C_RSTC_RSTTYP_WAKEUP EQU (0x1:SHL:8) ;- (RSTC) WakeUp Reset. VDDCORE rising. +AT91C_RSTC_RSTTYP_WATCHDOG EQU (0x2:SHL:8) ;- (RSTC) Watchdog Reset. Watchdog overflow occured. +AT91C_RSTC_RSTTYP_SOFTWARE EQU (0x3:SHL:8) ;- (RSTC) Software Reset. Processor reset required by the software. +AT91C_RSTC_RSTTYP_USER EQU (0x4:SHL:8) ;- (RSTC) User Reset. NRST pin detected low. +AT91C_RSTC_RSTTYP_BROWNOUT EQU (0x5:SHL:8) ;- (RSTC) Brownout Reset occured. +AT91C_RSTC_NRSTL EQU (0x1:SHL:16) ;- (RSTC) NRST pin level +AT91C_RSTC_SRCMP EQU (0x1:SHL:17) ;- (RSTC) Software Reset Command in Progress. +;- -------- RSTC_RMR : (RSTC Offset: 0x8) Reset Mode Register -------- +AT91C_RSTC_URSTEN EQU (0x1:SHL:0) ;- (RSTC) User Reset Enable +AT91C_RSTC_URSTIEN EQU (0x1:SHL:4) ;- (RSTC) User Reset Interrupt Enable +AT91C_RSTC_ERSTL EQU (0xF:SHL:8) ;- (RSTC) User Reset Length +AT91C_RSTC_BODIEN EQU (0x1:SHL:16) ;- (RSTC) Brownout Detection Interrupt Enable + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Real Time Timer Controller Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_RTTC +RTTC_RTMR # 4 ;- Real-time Mode Register +RTTC_RTAR # 4 ;- Real-time Alarm Register +RTTC_RTVR # 4 ;- Real-time Value Register +RTTC_RTSR # 4 ;- Real-time Status Register +;- -------- RTTC_RTMR : (RTTC Offset: 0x0) Real-time Mode Register -------- +AT91C_RTTC_RTPRES EQU (0xFFFF:SHL:0) ;- (RTTC) Real-time Timer Prescaler Value +AT91C_RTTC_ALMIEN EQU (0x1:SHL:16) ;- (RTTC) Alarm Interrupt Enable +AT91C_RTTC_RTTINCIEN EQU (0x1:SHL:17) ;- (RTTC) Real Time Timer Increment Interrupt Enable +AT91C_RTTC_RTTRST EQU (0x1:SHL:18) ;- (RTTC) Real Time Timer Restart +;- -------- RTTC_RTAR : (RTTC Offset: 0x4) Real-time Alarm Register -------- +AT91C_RTTC_ALMV EQU (0x0:SHL:0) ;- (RTTC) Alarm Value +;- -------- RTTC_RTVR : (RTTC Offset: 0x8) Current Real-time Value Register -------- +AT91C_RTTC_CRTV EQU (0x0:SHL:0) ;- (RTTC) Current Real-time Value +;- -------- RTTC_RTSR : (RTTC Offset: 0xc) Real-time Status Register -------- +AT91C_RTTC_ALMS EQU (0x1:SHL:0) ;- (RTTC) Real-time Alarm Status +AT91C_RTTC_RTTINC EQU (0x1:SHL:1) ;- (RTTC) Real-time Timer Increment + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Periodic Interval Timer Controller Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_PITC +PITC_PIMR # 4 ;- Period Interval Mode Register +PITC_PISR # 4 ;- Period Interval Status Register +PITC_PIVR # 4 ;- Period Interval Value Register +PITC_PIIR # 4 ;- Period Interval Image Register +;- -------- PITC_PIMR : (PITC Offset: 0x0) Periodic Interval Mode Register -------- +AT91C_PITC_PIV EQU (0xFFFFF:SHL:0) ;- (PITC) Periodic Interval Value +AT91C_PITC_PITEN EQU (0x1:SHL:24) ;- (PITC) Periodic Interval Timer Enabled +AT91C_PITC_PITIEN EQU (0x1:SHL:25) ;- (PITC) Periodic Interval Timer Interrupt Enable +;- -------- PITC_PISR : (PITC Offset: 0x4) Periodic Interval Status Register -------- +AT91C_PITC_PITS EQU (0x1:SHL:0) ;- (PITC) Periodic Interval Timer Status +;- -------- PITC_PIVR : (PITC Offset: 0x8) Periodic Interval Value Register -------- +AT91C_PITC_CPIV EQU (0xFFFFF:SHL:0) ;- (PITC) Current Periodic Interval Value +AT91C_PITC_PICNT EQU (0xFFF:SHL:20) ;- (PITC) Periodic Interval Counter +;- -------- PITC_PIIR : (PITC Offset: 0xc) Periodic Interval Image Register -------- + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Watchdog Timer Controller Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_WDTC +WDTC_WDCR # 4 ;- Watchdog Control Register +WDTC_WDMR # 4 ;- Watchdog Mode Register +WDTC_WDSR # 4 ;- Watchdog Status Register +;- -------- WDTC_WDCR : (WDTC Offset: 0x0) Periodic Interval Image Register -------- +AT91C_WDTC_WDRSTT EQU (0x1:SHL:0) ;- (WDTC) Watchdog Restart +AT91C_WDTC_KEY EQU (0xFF:SHL:24) ;- (WDTC) Watchdog KEY Password +;- -------- WDTC_WDMR : (WDTC Offset: 0x4) Watchdog Mode Register -------- +AT91C_WDTC_WDV EQU (0xFFF:SHL:0) ;- (WDTC) Watchdog Timer Restart +AT91C_WDTC_WDFIEN EQU (0x1:SHL:12) ;- (WDTC) Watchdog Fault Interrupt Enable +AT91C_WDTC_WDRSTEN EQU (0x1:SHL:13) ;- (WDTC) Watchdog Reset Enable +AT91C_WDTC_WDRPROC EQU (0x1:SHL:14) ;- (WDTC) Watchdog Timer Restart +AT91C_WDTC_WDDIS EQU (0x1:SHL:15) ;- (WDTC) Watchdog Disable +AT91C_WDTC_WDD EQU (0xFFF:SHL:16) ;- (WDTC) Watchdog Delta Value +AT91C_WDTC_WDDBGHLT EQU (0x1:SHL:28) ;- (WDTC) Watchdog Debug Halt +AT91C_WDTC_WDIDLEHLT EQU (0x1:SHL:29) ;- (WDTC) Watchdog Idle Halt +;- -------- WDTC_WDSR : (WDTC Offset: 0x8) Watchdog Status Register -------- +AT91C_WDTC_WDUNF EQU (0x1:SHL:0) ;- (WDTC) Watchdog Underflow +AT91C_WDTC_WDERR EQU (0x1:SHL:1) ;- (WDTC) Watchdog Error + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Voltage Regulator Mode Controller Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_VREG +VREG_MR # 4 ;- Voltage Regulator Mode Register +;- -------- VREG_MR : (VREG Offset: 0x0) Voltage Regulator Mode Register -------- +AT91C_VREG_PSTDBY EQU (0x1:SHL:0) ;- (VREG) Voltage Regulator Power Standby Mode + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Memory Controller Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_MC +MC_RCR # 4 ;- MC Remap Control Register +MC_ASR # 4 ;- MC Abort Status Register +MC_AASR # 4 ;- MC Abort Address Status Register + # 84 ;- Reserved +MC_FMR # 4 ;- MC Flash Mode Register +MC_FCR # 4 ;- MC Flash Command Register +MC_FSR # 4 ;- MC Flash Status Register +;- -------- MC_RCR : (MC Offset: 0x0) MC Remap Control Register -------- +AT91C_MC_RCB EQU (0x1:SHL:0) ;- (MC) Remap Command Bit +;- -------- MC_ASR : (MC Offset: 0x4) MC Abort Status Register -------- +AT91C_MC_UNDADD EQU (0x1:SHL:0) ;- (MC) Undefined Addess Abort Status +AT91C_MC_MISADD EQU (0x1:SHL:1) ;- (MC) Misaligned Addess Abort Status +AT91C_MC_ABTSZ EQU (0x3:SHL:8) ;- (MC) Abort Size Status +AT91C_MC_ABTSZ_BYTE EQU (0x0:SHL:8) ;- (MC) Byte +AT91C_MC_ABTSZ_HWORD EQU (0x1:SHL:8) ;- (MC) Half-word +AT91C_MC_ABTSZ_WORD EQU (0x2:SHL:8) ;- (MC) Word +AT91C_MC_ABTTYP EQU (0x3:SHL:10) ;- (MC) Abort Type Status +AT91C_MC_ABTTYP_DATAR EQU (0x0:SHL:10) ;- (MC) Data Read +AT91C_MC_ABTTYP_DATAW EQU (0x1:SHL:10) ;- (MC) Data Write +AT91C_MC_ABTTYP_FETCH EQU (0x2:SHL:10) ;- (MC) Code Fetch +AT91C_MC_MST0 EQU (0x1:SHL:16) ;- (MC) Master 0 Abort Source +AT91C_MC_MST1 EQU (0x1:SHL:17) ;- (MC) Master 1 Abort Source +AT91C_MC_SVMST0 EQU (0x1:SHL:24) ;- (MC) Saved Master 0 Abort Source +AT91C_MC_SVMST1 EQU (0x1:SHL:25) ;- (MC) Saved Master 1 Abort Source +;- -------- MC_FMR : (MC Offset: 0x60) MC Flash Mode Register -------- +AT91C_MC_FRDY EQU (0x1:SHL:0) ;- (MC) Flash Ready +AT91C_MC_LOCKE EQU (0x1:SHL:2) ;- (MC) Lock Error +AT91C_MC_PROGE EQU (0x1:SHL:3) ;- (MC) Programming Error +AT91C_MC_NEBP EQU (0x1:SHL:7) ;- (MC) No Erase Before Programming +AT91C_MC_FWS EQU (0x3:SHL:8) ;- (MC) Flash Wait State +AT91C_MC_FWS_0FWS EQU (0x0:SHL:8) ;- (MC) 1 cycle for Read, 2 for Write operations +AT91C_MC_FWS_1FWS EQU (0x1:SHL:8) ;- (MC) 2 cycles for Read, 3 for Write operations +AT91C_MC_FWS_2FWS EQU (0x2:SHL:8) ;- (MC) 3 cycles for Read, 4 for Write operations +AT91C_MC_FWS_3FWS EQU (0x3:SHL:8) ;- (MC) 4 cycles for Read, 4 for Write operations +AT91C_MC_FMCN EQU (0xFF:SHL:16) ;- (MC) Flash Microsecond Cycle Number +;- -------- MC_FCR : (MC Offset: 0x64) MC Flash Command Register -------- +AT91C_MC_FCMD EQU (0xF:SHL:0) ;- (MC) Flash Command +AT91C_MC_FCMD_START_PROG EQU (0x1) ;- (MC) Starts the programming of th epage specified by PAGEN. +AT91C_MC_FCMD_LOCK EQU (0x2) ;- (MC) Starts a lock sequence of the sector defined by the bits 4 to 7 of the field PAGEN. +AT91C_MC_FCMD_PROG_AND_LOCK EQU (0x3) ;- (MC) The lock sequence automatically happens after the programming sequence is completed. +AT91C_MC_FCMD_UNLOCK EQU (0x4) ;- (MC) Starts an unlock sequence of the sector defined by the bits 4 to 7 of the field PAGEN. +AT91C_MC_FCMD_ERASE_ALL EQU (0x8) ;- (MC) Starts the erase of the entire flash.If at least a page is locked, the command is cancelled. +AT91C_MC_FCMD_SET_GP_NVM EQU (0xB) ;- (MC) Set General Purpose NVM bits. +AT91C_MC_FCMD_CLR_GP_NVM EQU (0xD) ;- (MC) Clear General Purpose NVM bits. +AT91C_MC_FCMD_SET_SECURITY EQU (0xF) ;- (MC) Set Security Bit. +AT91C_MC_PAGEN EQU (0x3FF:SHL:8) ;- (MC) Page Number +AT91C_MC_KEY EQU (0xFF:SHL:24) ;- (MC) Writing Protect Key +;- -------- MC_FSR : (MC Offset: 0x68) MC Flash Command Register -------- +AT91C_MC_SECURITY EQU (0x1:SHL:4) ;- (MC) Security Bit Status +AT91C_MC_GPNVM0 EQU (0x1:SHL:8) ;- (MC) Sector 0 Lock Status +AT91C_MC_GPNVM1 EQU (0x1:SHL:9) ;- (MC) Sector 1 Lock Status +AT91C_MC_GPNVM2 EQU (0x1:SHL:10) ;- (MC) Sector 2 Lock Status +AT91C_MC_GPNVM3 EQU (0x1:SHL:11) ;- (MC) Sector 3 Lock Status +AT91C_MC_GPNVM4 EQU (0x1:SHL:12) ;- (MC) Sector 4 Lock Status +AT91C_MC_GPNVM5 EQU (0x1:SHL:13) ;- (MC) Sector 5 Lock Status +AT91C_MC_GPNVM6 EQU (0x1:SHL:14) ;- (MC) Sector 6 Lock Status +AT91C_MC_GPNVM7 EQU (0x1:SHL:15) ;- (MC) Sector 7 Lock Status +AT91C_MC_LOCKS0 EQU (0x1:SHL:16) ;- (MC) Sector 0 Lock Status +AT91C_MC_LOCKS1 EQU (0x1:SHL:17) ;- (MC) Sector 1 Lock Status +AT91C_MC_LOCKS2 EQU (0x1:SHL:18) ;- (MC) Sector 2 Lock Status +AT91C_MC_LOCKS3 EQU (0x1:SHL:19) ;- (MC) Sector 3 Lock Status +AT91C_MC_LOCKS4 EQU (0x1:SHL:20) ;- (MC) Sector 4 Lock Status +AT91C_MC_LOCKS5 EQU (0x1:SHL:21) ;- (MC) Sector 5 Lock Status +AT91C_MC_LOCKS6 EQU (0x1:SHL:22) ;- (MC) Sector 6 Lock Status +AT91C_MC_LOCKS7 EQU (0x1:SHL:23) ;- (MC) Sector 7 Lock Status +AT91C_MC_LOCKS8 EQU (0x1:SHL:24) ;- (MC) Sector 8 Lock Status +AT91C_MC_LOCKS9 EQU (0x1:SHL:25) ;- (MC) Sector 9 Lock Status +AT91C_MC_LOCKS10 EQU (0x1:SHL:26) ;- (MC) Sector 10 Lock Status +AT91C_MC_LOCKS11 EQU (0x1:SHL:27) ;- (MC) Sector 11 Lock Status +AT91C_MC_LOCKS12 EQU (0x1:SHL:28) ;- (MC) Sector 12 Lock Status +AT91C_MC_LOCKS13 EQU (0x1:SHL:29) ;- (MC) Sector 13 Lock Status +AT91C_MC_LOCKS14 EQU (0x1:SHL:30) ;- (MC) Sector 14 Lock Status +AT91C_MC_LOCKS15 EQU (0x1:SHL:31) ;- (MC) Sector 15 Lock Status + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Serial Parallel Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_SPI +SPI_CR # 4 ;- Control Register +SPI_MR # 4 ;- Mode Register +SPI_RDR # 4 ;- Receive Data Register +SPI_TDR # 4 ;- Transmit Data Register +SPI_SR # 4 ;- Status Register +SPI_IER # 4 ;- Interrupt Enable Register +SPI_IDR # 4 ;- Interrupt Disable Register +SPI_IMR # 4 ;- Interrupt Mask Register + # 16 ;- Reserved +SPI_CSR # 16 ;- Chip Select Register + # 192 ;- Reserved +SPI_RPR # 4 ;- Receive Pointer Register +SPI_RCR # 4 ;- Receive Counter Register +SPI_TPR # 4 ;- Transmit Pointer Register +SPI_TCR # 4 ;- Transmit Counter Register +SPI_RNPR # 4 ;- Receive Next Pointer Register +SPI_RNCR # 4 ;- Receive Next Counter Register +SPI_TNPR # 4 ;- Transmit Next Pointer Register +SPI_TNCR # 4 ;- Transmit Next Counter Register +SPI_PTCR # 4 ;- PDC Transfer Control Register +SPI_PTSR # 4 ;- PDC Transfer Status Register +;- -------- SPI_CR : (SPI Offset: 0x0) SPI Control Register -------- +AT91C_SPI_SPIEN EQU (0x1:SHL:0) ;- (SPI) SPI Enable +AT91C_SPI_SPIDIS EQU (0x1:SHL:1) ;- (SPI) SPI Disable +AT91C_SPI_SWRST EQU (0x1:SHL:7) ;- (SPI) SPI Software reset +AT91C_SPI_LASTXFER EQU (0x1:SHL:24) ;- (SPI) SPI Last Transfer +;- -------- SPI_MR : (SPI Offset: 0x4) SPI Mode Register -------- +AT91C_SPI_MSTR EQU (0x1:SHL:0) ;- (SPI) Master/Slave Mode +AT91C_SPI_PS EQU (0x1:SHL:1) ;- (SPI) Peripheral Select +AT91C_SPI_PS_FIXED EQU (0x0:SHL:1) ;- (SPI) Fixed Peripheral Select +AT91C_SPI_PS_VARIABLE EQU (0x1:SHL:1) ;- (SPI) Variable Peripheral Select +AT91C_SPI_PCSDEC EQU (0x1:SHL:2) ;- (SPI) Chip Select Decode +AT91C_SPI_FDIV EQU (0x1:SHL:3) ;- (SPI) Clock Selection +AT91C_SPI_MODFDIS EQU (0x1:SHL:4) ;- (SPI) Mode Fault Detection +AT91C_SPI_LLB EQU (0x1:SHL:7) ;- (SPI) Clock Selection +AT91C_SPI_PCS EQU (0xF:SHL:16) ;- (SPI) Peripheral Chip Select +AT91C_SPI_DLYBCS EQU (0xFF:SHL:24) ;- (SPI) Delay Between Chip Selects +;- -------- SPI_RDR : (SPI Offset: 0x8) Receive Data Register -------- +AT91C_SPI_RD EQU (0xFFFF:SHL:0) ;- (SPI) Receive Data +AT91C_SPI_RPCS EQU (0xF:SHL:16) ;- (SPI) Peripheral Chip Select Status +;- -------- SPI_TDR : (SPI Offset: 0xc) Transmit Data Register -------- +AT91C_SPI_TD EQU (0xFFFF:SHL:0) ;- (SPI) Transmit Data +AT91C_SPI_TPCS EQU (0xF:SHL:16) ;- (SPI) Peripheral Chip Select Status +;- -------- SPI_SR : (SPI Offset: 0x10) Status Register -------- +AT91C_SPI_RDRF EQU (0x1:SHL:0) ;- (SPI) Receive Data Register Full +AT91C_SPI_TDRE EQU (0x1:SHL:1) ;- (SPI) Transmit Data Register Empty +AT91C_SPI_MODF EQU (0x1:SHL:2) ;- (SPI) Mode Fault Error +AT91C_SPI_OVRES EQU (0x1:SHL:3) ;- (SPI) Overrun Error Status +AT91C_SPI_ENDRX EQU (0x1:SHL:4) ;- (SPI) End of Receiver Transfer +AT91C_SPI_ENDTX EQU (0x1:SHL:5) ;- (SPI) End of Receiver Transfer +AT91C_SPI_RXBUFF EQU (0x1:SHL:6) ;- (SPI) RXBUFF Interrupt +AT91C_SPI_TXBUFE EQU (0x1:SHL:7) ;- (SPI) TXBUFE Interrupt +AT91C_SPI_NSSR EQU (0x1:SHL:8) ;- (SPI) NSSR Interrupt +AT91C_SPI_TXEMPTY EQU (0x1:SHL:9) ;- (SPI) TXEMPTY Interrupt +AT91C_SPI_SPIENS EQU (0x1:SHL:16) ;- (SPI) Enable Status +;- -------- SPI_IER : (SPI Offset: 0x14) Interrupt Enable Register -------- +;- -------- SPI_IDR : (SPI Offset: 0x18) Interrupt Disable Register -------- +;- -------- SPI_IMR : (SPI Offset: 0x1c) Interrupt Mask Register -------- +;- -------- SPI_CSR : (SPI Offset: 0x30) Chip Select Register -------- +AT91C_SPI_CPOL EQU (0x1:SHL:0) ;- (SPI) Clock Polarity +AT91C_SPI_NCPHA EQU (0x1:SHL:1) ;- (SPI) Clock Phase +AT91C_SPI_CSAAT EQU (0x1:SHL:3) ;- (SPI) Chip Select Active After Transfer +AT91C_SPI_BITS EQU (0xF:SHL:4) ;- (SPI) Bits Per Transfer +AT91C_SPI_BITS_8 EQU (0x0:SHL:4) ;- (SPI) 8 Bits Per transfer +AT91C_SPI_BITS_9 EQU (0x1:SHL:4) ;- (SPI) 9 Bits Per transfer +AT91C_SPI_BITS_10 EQU (0x2:SHL:4) ;- (SPI) 10 Bits Per transfer +AT91C_SPI_BITS_11 EQU (0x3:SHL:4) ;- (SPI) 11 Bits Per transfer +AT91C_SPI_BITS_12 EQU (0x4:SHL:4) ;- (SPI) 12 Bits Per transfer +AT91C_SPI_BITS_13 EQU (0x5:SHL:4) ;- (SPI) 13 Bits Per transfer +AT91C_SPI_BITS_14 EQU (0x6:SHL:4) ;- (SPI) 14 Bits Per transfer +AT91C_SPI_BITS_15 EQU (0x7:SHL:4) ;- (SPI) 15 Bits Per transfer +AT91C_SPI_BITS_16 EQU (0x8:SHL:4) ;- (SPI) 16 Bits Per transfer +AT91C_SPI_SCBR EQU (0xFF:SHL:8) ;- (SPI) Serial Clock Baud Rate +AT91C_SPI_DLYBS EQU (0xFF:SHL:16) ;- (SPI) Delay Before SPCK +AT91C_SPI_DLYBCT EQU (0xFF:SHL:24) ;- (SPI) Delay Between Consecutive Transfers + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Usart +;- ***************************************************************************** + ^ 0 ;- AT91S_USART +US_CR # 4 ;- Control Register +US_MR # 4 ;- Mode Register +US_IER # 4 ;- Interrupt Enable Register +US_IDR # 4 ;- Interrupt Disable Register +US_IMR # 4 ;- Interrupt Mask Register +US_CSR # 4 ;- Channel Status Register +US_RHR # 4 ;- Receiver Holding Register +US_THR # 4 ;- Transmitter Holding Register +US_BRGR # 4 ;- Baud Rate Generator Register +US_RTOR # 4 ;- Receiver Time-out Register +US_TTGR # 4 ;- Transmitter Time-guard Register + # 20 ;- Reserved +US_FIDI # 4 ;- FI_DI_Ratio Register +US_NER # 4 ;- Nb Errors Register + # 4 ;- Reserved +US_IF # 4 ;- IRDA_FILTER Register + # 176 ;- Reserved +US_RPR # 4 ;- Receive Pointer Register +US_RCR # 4 ;- Receive Counter Register +US_TPR # 4 ;- Transmit Pointer Register +US_TCR # 4 ;- Transmit Counter Register +US_RNPR # 4 ;- Receive Next Pointer Register +US_RNCR # 4 ;- Receive Next Counter Register +US_TNPR # 4 ;- Transmit Next Pointer Register +US_TNCR # 4 ;- Transmit Next Counter Register +US_PTCR # 4 ;- PDC Transfer Control Register +US_PTSR # 4 ;- PDC Transfer Status Register +;- -------- US_CR : (USART Offset: 0x0) Debug Unit Control Register -------- +AT91C_US_STTBRK EQU (0x1:SHL:9) ;- (USART) Start Break +AT91C_US_STPBRK EQU (0x1:SHL:10) ;- (USART) Stop Break +AT91C_US_STTTO EQU (0x1:SHL:11) ;- (USART) Start Time-out +AT91C_US_SENDA EQU (0x1:SHL:12) ;- (USART) Send Address +AT91C_US_RSTIT EQU (0x1:SHL:13) ;- (USART) Reset Iterations +AT91C_US_RSTNACK EQU (0x1:SHL:14) ;- (USART) Reset Non Acknowledge +AT91C_US_RETTO EQU (0x1:SHL:15) ;- (USART) Rearm Time-out +AT91C_US_DTREN EQU (0x1:SHL:16) ;- (USART) Data Terminal ready Enable +AT91C_US_DTRDIS EQU (0x1:SHL:17) ;- (USART) Data Terminal ready Disable +AT91C_US_RTSEN EQU (0x1:SHL:18) ;- (USART) Request to Send enable +AT91C_US_RTSDIS EQU (0x1:SHL:19) ;- (USART) Request to Send Disable +;- -------- US_MR : (USART Offset: 0x4) Debug Unit Mode Register -------- +AT91C_US_USMODE EQU (0xF:SHL:0) ;- (USART) Usart mode +AT91C_US_USMODE_NORMAL EQU (0x0) ;- (USART) Normal +AT91C_US_USMODE_RS485 EQU (0x1) ;- (USART) RS485 +AT91C_US_USMODE_HWHSH EQU (0x2) ;- (USART) Hardware Handshaking +AT91C_US_USMODE_MODEM EQU (0x3) ;- (USART) Modem +AT91C_US_USMODE_ISO7816_0 EQU (0x4) ;- (USART) ISO7816 protocol: T = 0 +AT91C_US_USMODE_ISO7816_1 EQU (0x6) ;- (USART) ISO7816 protocol: T = 1 +AT91C_US_USMODE_IRDA EQU (0x8) ;- (USART) IrDA +AT91C_US_USMODE_SWHSH EQU (0xC) ;- (USART) Software Handshaking +AT91C_US_CLKS EQU (0x3:SHL:4) ;- (USART) Clock Selection (Baud Rate generator Input Clock +AT91C_US_CLKS_CLOCK EQU (0x0:SHL:4) ;- (USART) Clock +AT91C_US_CLKS_FDIV1 EQU (0x1:SHL:4) ;- (USART) fdiv1 +AT91C_US_CLKS_SLOW EQU (0x2:SHL:4) ;- (USART) slow_clock (ARM) +AT91C_US_CLKS_EXT EQU (0x3:SHL:4) ;- (USART) External (SCK) +AT91C_US_CHRL EQU (0x3:SHL:6) ;- (USART) Clock Selection (Baud Rate generator Input Clock +AT91C_US_CHRL_5_BITS EQU (0x0:SHL:6) ;- (USART) Character Length: 5 bits +AT91C_US_CHRL_6_BITS EQU (0x1:SHL:6) ;- (USART) Character Length: 6 bits +AT91C_US_CHRL_7_BITS EQU (0x2:SHL:6) ;- (USART) Character Length: 7 bits +AT91C_US_CHRL_8_BITS EQU (0x3:SHL:6) ;- (USART) Character Length: 8 bits +AT91C_US_SYNC EQU (0x1:SHL:8) ;- (USART) Synchronous Mode Select +AT91C_US_NBSTOP EQU (0x3:SHL:12) ;- (USART) Number of Stop bits +AT91C_US_NBSTOP_1_BIT EQU (0x0:SHL:12) ;- (USART) 1 stop bit +AT91C_US_NBSTOP_15_BIT EQU (0x1:SHL:12) ;- (USART) Asynchronous (SYNC=0) 2 stop bits Synchronous (SYNC=1) 2 stop bits +AT91C_US_NBSTOP_2_BIT EQU (0x2:SHL:12) ;- (USART) 2 stop bits +AT91C_US_MSBF EQU (0x1:SHL:16) ;- (USART) Bit Order +AT91C_US_MODE9 EQU (0x1:SHL:17) ;- (USART) 9-bit Character length +AT91C_US_CKLO EQU (0x1:SHL:18) ;- (USART) Clock Output Select +AT91C_US_OVER EQU (0x1:SHL:19) ;- (USART) Over Sampling Mode +AT91C_US_INACK EQU (0x1:SHL:20) ;- (USART) Inhibit Non Acknowledge +AT91C_US_DSNACK EQU (0x1:SHL:21) ;- (USART) Disable Successive NACK +AT91C_US_MAX_ITER EQU (0x1:SHL:24) ;- (USART) Number of Repetitions +AT91C_US_FILTER EQU (0x1:SHL:28) ;- (USART) Receive Line Filter +;- -------- US_IER : (USART Offset: 0x8) Debug Unit Interrupt Enable Register -------- +AT91C_US_RXBRK EQU (0x1:SHL:2) ;- (USART) Break Received/End of Break +AT91C_US_TIMEOUT EQU (0x1:SHL:8) ;- (USART) Receiver Time-out +AT91C_US_ITERATION EQU (0x1:SHL:10) ;- (USART) Max number of Repetitions Reached +AT91C_US_NACK EQU (0x1:SHL:13) ;- (USART) Non Acknowledge +AT91C_US_RIIC EQU (0x1:SHL:16) ;- (USART) Ring INdicator Input Change Flag +AT91C_US_DSRIC EQU (0x1:SHL:17) ;- (USART) Data Set Ready Input Change Flag +AT91C_US_DCDIC EQU (0x1:SHL:18) ;- (USART) Data Carrier Flag +AT91C_US_CTSIC EQU (0x1:SHL:19) ;- (USART) Clear To Send Input Change Flag +;- -------- US_IDR : (USART Offset: 0xc) Debug Unit Interrupt Disable Register -------- +;- -------- US_IMR : (USART Offset: 0x10) Debug Unit Interrupt Mask Register -------- +;- -------- US_CSR : (USART Offset: 0x14) Debug Unit Channel Status Register -------- +AT91C_US_RI EQU (0x1:SHL:20) ;- (USART) Image of RI Input +AT91C_US_DSR EQU (0x1:SHL:21) ;- (USART) Image of DSR Input +AT91C_US_DCD EQU (0x1:SHL:22) ;- (USART) Image of DCD Input +AT91C_US_CTS EQU (0x1:SHL:23) ;- (USART) Image of CTS Input + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Synchronous Serial Controller Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_SSC +SSC_CR # 4 ;- Control Register +SSC_CMR # 4 ;- Clock Mode Register + # 8 ;- Reserved +SSC_RCMR # 4 ;- Receive Clock ModeRegister +SSC_RFMR # 4 ;- Receive Frame Mode Register +SSC_TCMR # 4 ;- Transmit Clock Mode Register +SSC_TFMR # 4 ;- Transmit Frame Mode Register +SSC_RHR # 4 ;- Receive Holding Register +SSC_THR # 4 ;- Transmit Holding Register + # 8 ;- Reserved +SSC_RSHR # 4 ;- Receive Sync Holding Register +SSC_TSHR # 4 ;- Transmit Sync Holding Register + # 8 ;- Reserved +SSC_SR # 4 ;- Status Register +SSC_IER # 4 ;- Interrupt Enable Register +SSC_IDR # 4 ;- Interrupt Disable Register +SSC_IMR # 4 ;- Interrupt Mask Register + # 176 ;- Reserved +SSC_RPR # 4 ;- Receive Pointer Register +SSC_RCR # 4 ;- Receive Counter Register +SSC_TPR # 4 ;- Transmit Pointer Register +SSC_TCR # 4 ;- Transmit Counter Register +SSC_RNPR # 4 ;- Receive Next Pointer Register +SSC_RNCR # 4 ;- Receive Next Counter Register +SSC_TNPR # 4 ;- Transmit Next Pointer Register +SSC_TNCR # 4 ;- Transmit Next Counter Register +SSC_PTCR # 4 ;- PDC Transfer Control Register +SSC_PTSR # 4 ;- PDC Transfer Status Register +;- -------- SSC_CR : (SSC Offset: 0x0) SSC Control Register -------- +AT91C_SSC_RXEN EQU (0x1:SHL:0) ;- (SSC) Receive Enable +AT91C_SSC_RXDIS EQU (0x1:SHL:1) ;- (SSC) Receive Disable +AT91C_SSC_TXEN EQU (0x1:SHL:8) ;- (SSC) Transmit Enable +AT91C_SSC_TXDIS EQU (0x1:SHL:9) ;- (SSC) Transmit Disable +AT91C_SSC_SWRST EQU (0x1:SHL:15) ;- (SSC) Software Reset +;- -------- SSC_RCMR : (SSC Offset: 0x10) SSC Receive Clock Mode Register -------- +AT91C_SSC_CKS EQU (0x3:SHL:0) ;- (SSC) Receive/Transmit Clock Selection +AT91C_SSC_CKS_DIV EQU (0x0) ;- (SSC) Divided Clock +AT91C_SSC_CKS_TK EQU (0x1) ;- (SSC) TK Clock signal +AT91C_SSC_CKS_RK EQU (0x2) ;- (SSC) RK pin +AT91C_SSC_CKO EQU (0x7:SHL:2) ;- (SSC) Receive/Transmit Clock Output Mode Selection +AT91C_SSC_CKO_NONE EQU (0x0:SHL:2) ;- (SSC) Receive/Transmit Clock Output Mode: None RK pin: Input-only +AT91C_SSC_CKO_CONTINOUS EQU (0x1:SHL:2) ;- (SSC) Continuous Receive/Transmit Clock RK pin: Output +AT91C_SSC_CKO_DATA_TX EQU (0x2:SHL:2) ;- (SSC) Receive/Transmit Clock only during data transfers RK pin: Output +AT91C_SSC_CKI EQU (0x1:SHL:5) ;- (SSC) Receive/Transmit Clock Inversion +AT91C_SSC_CKG EQU (0x3:SHL:6) ;- (SSC) Receive/Transmit Clock Gating Selection +AT91C_SSC_CKG_NONE EQU (0x0:SHL:6) ;- (SSC) Receive/Transmit Clock Gating: None, continuous clock +AT91C_SSC_CKG_LOW EQU (0x1:SHL:6) ;- (SSC) Receive/Transmit Clock enabled only if RF Low +AT91C_SSC_CKG_HIGH EQU (0x2:SHL:6) ;- (SSC) Receive/Transmit Clock enabled only if RF High +AT91C_SSC_START EQU (0xF:SHL:8) ;- (SSC) Receive/Transmit Start Selection +AT91C_SSC_START_CONTINOUS EQU (0x0:SHL:8) ;- (SSC) Continuous, as soon as the receiver is enabled, and immediately after the end of transfer of the previous data. +AT91C_SSC_START_TX EQU (0x1:SHL:8) ;- (SSC) Transmit/Receive start +AT91C_SSC_START_LOW_RF EQU (0x2:SHL:8) ;- (SSC) Detection of a low level on RF input +AT91C_SSC_START_HIGH_RF EQU (0x3:SHL:8) ;- (SSC) Detection of a high level on RF input +AT91C_SSC_START_FALL_RF EQU (0x4:SHL:8) ;- (SSC) Detection of a falling edge on RF input +AT91C_SSC_START_RISE_RF EQU (0x5:SHL:8) ;- (SSC) Detection of a rising edge on RF input +AT91C_SSC_START_LEVEL_RF EQU (0x6:SHL:8) ;- (SSC) Detection of any level change on RF input +AT91C_SSC_START_EDGE_RF EQU (0x7:SHL:8) ;- (SSC) Detection of any edge on RF input +AT91C_SSC_START_0 EQU (0x8:SHL:8) ;- (SSC) Compare 0 +AT91C_SSC_STOP EQU (0x1:SHL:12) ;- (SSC) Receive Stop Selection +AT91C_SSC_STTDLY EQU (0xFF:SHL:16) ;- (SSC) Receive/Transmit Start Delay +AT91C_SSC_PERIOD EQU (0xFF:SHL:24) ;- (SSC) Receive/Transmit Period Divider Selection +;- -------- SSC_RFMR : (SSC Offset: 0x14) SSC Receive Frame Mode Register -------- +AT91C_SSC_DATLEN EQU (0x1F:SHL:0) ;- (SSC) Data Length +AT91C_SSC_LOOP EQU (0x1:SHL:5) ;- (SSC) Loop Mode +AT91C_SSC_MSBF EQU (0x1:SHL:7) ;- (SSC) Most Significant Bit First +AT91C_SSC_DATNB EQU (0xF:SHL:8) ;- (SSC) Data Number per Frame +AT91C_SSC_FSLEN EQU (0xF:SHL:16) ;- (SSC) Receive/Transmit Frame Sync length +AT91C_SSC_FSOS EQU (0x7:SHL:20) ;- (SSC) Receive/Transmit Frame Sync Output Selection +AT91C_SSC_FSOS_NONE EQU (0x0:SHL:20) ;- (SSC) Selected Receive/Transmit Frame Sync Signal: None RK pin Input-only +AT91C_SSC_FSOS_NEGATIVE EQU (0x1:SHL:20) ;- (SSC) Selected Receive/Transmit Frame Sync Signal: Negative Pulse +AT91C_SSC_FSOS_POSITIVE EQU (0x2:SHL:20) ;- (SSC) Selected Receive/Transmit Frame Sync Signal: Positive Pulse +AT91C_SSC_FSOS_LOW EQU (0x3:SHL:20) ;- (SSC) Selected Receive/Transmit Frame Sync Signal: Driver Low during data transfer +AT91C_SSC_FSOS_HIGH EQU (0x4:SHL:20) ;- (SSC) Selected Receive/Transmit Frame Sync Signal: Driver High during data transfer +AT91C_SSC_FSOS_TOGGLE EQU (0x5:SHL:20) ;- (SSC) Selected Receive/Transmit Frame Sync Signal: Toggling at each start of data transfer +AT91C_SSC_FSEDGE EQU (0x1:SHL:24) ;- (SSC) Frame Sync Edge Detection +;- -------- SSC_TCMR : (SSC Offset: 0x18) SSC Transmit Clock Mode Register -------- +;- -------- SSC_TFMR : (SSC Offset: 0x1c) SSC Transmit Frame Mode Register -------- +AT91C_SSC_DATDEF EQU (0x1:SHL:5) ;- (SSC) Data Default Value +AT91C_SSC_FSDEN EQU (0x1:SHL:23) ;- (SSC) Frame Sync Data Enable +;- -------- SSC_SR : (SSC Offset: 0x40) SSC Status Register -------- +AT91C_SSC_TXRDY EQU (0x1:SHL:0) ;- (SSC) Transmit Ready +AT91C_SSC_TXEMPTY EQU (0x1:SHL:1) ;- (SSC) Transmit Empty +AT91C_SSC_ENDTX EQU (0x1:SHL:2) ;- (SSC) End Of Transmission +AT91C_SSC_TXBUFE EQU (0x1:SHL:3) ;- (SSC) Transmit Buffer Empty +AT91C_SSC_RXRDY EQU (0x1:SHL:4) ;- (SSC) Receive Ready +AT91C_SSC_OVRUN EQU (0x1:SHL:5) ;- (SSC) Receive Overrun +AT91C_SSC_ENDRX EQU (0x1:SHL:6) ;- (SSC) End of Reception +AT91C_SSC_RXBUFF EQU (0x1:SHL:7) ;- (SSC) Receive Buffer Full +AT91C_SSC_CP0 EQU (0x1:SHL:8) ;- (SSC) Compare 0 +AT91C_SSC_CP1 EQU (0x1:SHL:9) ;- (SSC) Compare 1 +AT91C_SSC_TXSYN EQU (0x1:SHL:10) ;- (SSC) Transmit Sync +AT91C_SSC_RXSYN EQU (0x1:SHL:11) ;- (SSC) Receive Sync +AT91C_SSC_TXENA EQU (0x1:SHL:16) ;- (SSC) Transmit Enable +AT91C_SSC_RXENA EQU (0x1:SHL:17) ;- (SSC) Receive Enable +;- -------- SSC_IER : (SSC Offset: 0x44) SSC Interrupt Enable Register -------- +;- -------- SSC_IDR : (SSC Offset: 0x48) SSC Interrupt Disable Register -------- +;- -------- SSC_IMR : (SSC Offset: 0x4c) SSC Interrupt Mask Register -------- + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Two-wire Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_TWI +TWI_CR # 4 ;- Control Register +TWI_MMR # 4 ;- Master Mode Register + # 4 ;- Reserved +TWI_IADR # 4 ;- Internal Address Register +TWI_CWGR # 4 ;- Clock Waveform Generator Register + # 12 ;- Reserved +TWI_SR # 4 ;- Status Register +TWI_IER # 4 ;- Interrupt Enable Register +TWI_IDR # 4 ;- Interrupt Disable Register +TWI_IMR # 4 ;- Interrupt Mask Register +TWI_RHR # 4 ;- Receive Holding Register +TWI_THR # 4 ;- Transmit Holding Register +;- -------- TWI_CR : (TWI Offset: 0x0) TWI Control Register -------- +AT91C_TWI_START EQU (0x1:SHL:0) ;- (TWI) Send a START Condition +AT91C_TWI_STOP EQU (0x1:SHL:1) ;- (TWI) Send a STOP Condition +AT91C_TWI_MSEN EQU (0x1:SHL:2) ;- (TWI) TWI Master Transfer Enabled +AT91C_TWI_MSDIS EQU (0x1:SHL:3) ;- (TWI) TWI Master Transfer Disabled +AT91C_TWI_SWRST EQU (0x1:SHL:7) ;- (TWI) Software Reset +;- -------- TWI_MMR : (TWI Offset: 0x4) TWI Master Mode Register -------- +AT91C_TWI_IADRSZ EQU (0x3:SHL:8) ;- (TWI) Internal Device Address Size +AT91C_TWI_IADRSZ_NO EQU (0x0:SHL:8) ;- (TWI) No internal device address +AT91C_TWI_IADRSZ_1_BYTE EQU (0x1:SHL:8) ;- (TWI) One-byte internal device address +AT91C_TWI_IADRSZ_2_BYTE EQU (0x2:SHL:8) ;- (TWI) Two-byte internal device address +AT91C_TWI_IADRSZ_3_BYTE EQU (0x3:SHL:8) ;- (TWI) Three-byte internal device address +AT91C_TWI_MREAD EQU (0x1:SHL:12) ;- (TWI) Master Read Direction +AT91C_TWI_DADR EQU (0x7F:SHL:16) ;- (TWI) Device Address +;- -------- TWI_CWGR : (TWI Offset: 0x10) TWI Clock Waveform Generator Register -------- +AT91C_TWI_CLDIV EQU (0xFF:SHL:0) ;- (TWI) Clock Low Divider +AT91C_TWI_CHDIV EQU (0xFF:SHL:8) ;- (TWI) Clock High Divider +AT91C_TWI_CKDIV EQU (0x7:SHL:16) ;- (TWI) Clock Divider +;- -------- TWI_SR : (TWI Offset: 0x20) TWI Status Register -------- +AT91C_TWI_TXCOMP EQU (0x1:SHL:0) ;- (TWI) Transmission Completed +AT91C_TWI_RXRDY EQU (0x1:SHL:1) ;- (TWI) Receive holding register ReaDY +AT91C_TWI_TXRDY EQU (0x1:SHL:2) ;- (TWI) Transmit holding register ReaDY +AT91C_TWI_OVRE EQU (0x1:SHL:6) ;- (TWI) Overrun Error +AT91C_TWI_UNRE EQU (0x1:SHL:7) ;- (TWI) Underrun Error +AT91C_TWI_NACK EQU (0x1:SHL:8) ;- (TWI) Not Acknowledged +;- -------- TWI_IER : (TWI Offset: 0x24) TWI Interrupt Enable Register -------- +;- -------- TWI_IDR : (TWI Offset: 0x28) TWI Interrupt Disable Register -------- +;- -------- TWI_IMR : (TWI Offset: 0x2c) TWI Interrupt Mask Register -------- + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR PWMC Channel Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_PWMC_CH +PWMC_CMR # 4 ;- Channel Mode Register +PWMC_CDTYR # 4 ;- Channel Duty Cycle Register +PWMC_CPRDR # 4 ;- Channel Period Register +PWMC_CCNTR # 4 ;- Channel Counter Register +PWMC_CUPDR # 4 ;- Channel Update Register +PWMC_Reserved # 12 ;- Reserved +;- -------- PWMC_CMR : (PWMC_CH Offset: 0x0) PWMC Channel Mode Register -------- +AT91C_PWMC_CPRE EQU (0xF:SHL:0) ;- (PWMC_CH) Channel Pre-scaler : PWMC_CLKx +AT91C_PWMC_CPRE_MCK EQU (0x0) ;- (PWMC_CH) +AT91C_PWMC_CPRE_MCKA EQU (0xB) ;- (PWMC_CH) +AT91C_PWMC_CPRE_MCKB EQU (0xC) ;- (PWMC_CH) +AT91C_PWMC_CALG EQU (0x1:SHL:8) ;- (PWMC_CH) Channel Alignment +AT91C_PWMC_CPOL EQU (0x1:SHL:9) ;- (PWMC_CH) Channel Polarity +AT91C_PWMC_CPD EQU (0x1:SHL:10) ;- (PWMC_CH) Channel Update Period +;- -------- PWMC_CDTYR : (PWMC_CH Offset: 0x4) PWMC Channel Duty Cycle Register -------- +AT91C_PWMC_CDTY EQU (0x0:SHL:0) ;- (PWMC_CH) Channel Duty Cycle +;- -------- PWMC_CPRDR : (PWMC_CH Offset: 0x8) PWMC Channel Period Register -------- +AT91C_PWMC_CPRD EQU (0x0:SHL:0) ;- (PWMC_CH) Channel Period +;- -------- PWMC_CCNTR : (PWMC_CH Offset: 0xc) PWMC Channel Counter Register -------- +AT91C_PWMC_CCNT EQU (0x0:SHL:0) ;- (PWMC_CH) Channel Counter +;- -------- PWMC_CUPDR : (PWMC_CH Offset: 0x10) PWMC Channel Update Register -------- +AT91C_PWMC_CUPD EQU (0x0:SHL:0) ;- (PWMC_CH) Channel Update + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Pulse Width Modulation Controller Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_PWMC +PWMC_MR # 4 ;- PWMC Mode Register +PWMC_ENA # 4 ;- PWMC Enable Register +PWMC_DIS # 4 ;- PWMC Disable Register +PWMC_SR # 4 ;- PWMC Status Register +PWMC_IER # 4 ;- PWMC Interrupt Enable Register +PWMC_IDR # 4 ;- PWMC Interrupt Disable Register +PWMC_IMR # 4 ;- PWMC Interrupt Mask Register +PWMC_ISR # 4 ;- PWMC Interrupt Status Register + # 220 ;- Reserved +PWMC_VR # 4 ;- PWMC Version Register + # 256 ;- Reserved +PWMC_CH # 96 ;- PWMC Channel +;- -------- PWMC_MR : (PWMC Offset: 0x0) PWMC Mode Register -------- +AT91C_PWMC_DIVA EQU (0xFF:SHL:0) ;- (PWMC) CLKA divide factor. +AT91C_PWMC_PREA EQU (0xF:SHL:8) ;- (PWMC) Divider Input Clock Prescaler A +AT91C_PWMC_PREA_MCK EQU (0x0:SHL:8) ;- (PWMC) +AT91C_PWMC_DIVB EQU (0xFF:SHL:16) ;- (PWMC) CLKB divide factor. +AT91C_PWMC_PREB EQU (0xF:SHL:24) ;- (PWMC) Divider Input Clock Prescaler B +AT91C_PWMC_PREB_MCK EQU (0x0:SHL:24) ;- (PWMC) +;- -------- PWMC_ENA : (PWMC Offset: 0x4) PWMC Enable Register -------- +AT91C_PWMC_CHID0 EQU (0x1:SHL:0) ;- (PWMC) Channel ID 0 +AT91C_PWMC_CHID1 EQU (0x1:SHL:1) ;- (PWMC) Channel ID 1 +AT91C_PWMC_CHID2 EQU (0x1:SHL:2) ;- (PWMC) Channel ID 2 +AT91C_PWMC_CHID3 EQU (0x1:SHL:3) ;- (PWMC) Channel ID 3 +;- -------- PWMC_DIS : (PWMC Offset: 0x8) PWMC Disable Register -------- +;- -------- PWMC_SR : (PWMC Offset: 0xc) PWMC Status Register -------- +;- -------- PWMC_IER : (PWMC Offset: 0x10) PWMC Interrupt Enable Register -------- +;- -------- PWMC_IDR : (PWMC Offset: 0x14) PWMC Interrupt Disable Register -------- +;- -------- PWMC_IMR : (PWMC Offset: 0x18) PWMC Interrupt Mask Register -------- +;- -------- PWMC_ISR : (PWMC Offset: 0x1c) PWMC Interrupt Status Register -------- + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR USB Device Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_UDP +UDP_NUM # 4 ;- Frame Number Register +UDP_GLBSTATE # 4 ;- Global State Register +UDP_FADDR # 4 ;- Function Address Register + # 4 ;- Reserved +UDP_IER # 4 ;- Interrupt Enable Register +UDP_IDR # 4 ;- Interrupt Disable Register +UDP_IMR # 4 ;- Interrupt Mask Register +UDP_ISR # 4 ;- Interrupt Status Register +UDP_ICR # 4 ;- Interrupt Clear Register + # 4 ;- Reserved +UDP_RSTEP # 4 ;- Reset Endpoint Register + # 4 ;- Reserved +UDP_CSR # 24 ;- Endpoint Control and Status Register + # 8 ;- Reserved +UDP_FDR # 24 ;- Endpoint FIFO Data Register + # 12 ;- Reserved +UDP_TXVC # 4 ;- Transceiver Control Register +;- -------- UDP_FRM_NUM : (UDP Offset: 0x0) USB Frame Number Register -------- +AT91C_UDP_FRM_NUM EQU (0x7FF:SHL:0) ;- (UDP) Frame Number as Defined in the Packet Field Formats +AT91C_UDP_FRM_ERR EQU (0x1:SHL:16) ;- (UDP) Frame Error +AT91C_UDP_FRM_OK EQU (0x1:SHL:17) ;- (UDP) Frame OK +;- -------- UDP_GLB_STATE : (UDP Offset: 0x4) USB Global State Register -------- +AT91C_UDP_FADDEN EQU (0x1:SHL:0) ;- (UDP) Function Address Enable +AT91C_UDP_CONFG EQU (0x1:SHL:1) ;- (UDP) Configured +AT91C_UDP_ESR EQU (0x1:SHL:2) ;- (UDP) Enable Send Resume +AT91C_UDP_RSMINPR EQU (0x1:SHL:3) ;- (UDP) A Resume Has Been Sent to the Host +AT91C_UDP_RMWUPE EQU (0x1:SHL:4) ;- (UDP) Remote Wake Up Enable +;- -------- UDP_FADDR : (UDP Offset: 0x8) USB Function Address Register -------- +AT91C_UDP_FADD EQU (0xFF:SHL:0) ;- (UDP) Function Address Value +AT91C_UDP_FEN EQU (0x1:SHL:8) ;- (UDP) Function Enable +;- -------- UDP_IER : (UDP Offset: 0x10) USB Interrupt Enable Register -------- +AT91C_UDP_EPINT0 EQU (0x1:SHL:0) ;- (UDP) Endpoint 0 Interrupt +AT91C_UDP_EPINT1 EQU (0x1:SHL:1) ;- (UDP) Endpoint 0 Interrupt +AT91C_UDP_EPINT2 EQU (0x1:SHL:2) ;- (UDP) Endpoint 2 Interrupt +AT91C_UDP_EPINT3 EQU (0x1:SHL:3) ;- (UDP) Endpoint 3 Interrupt +AT91C_UDP_EPINT4 EQU (0x1:SHL:4) ;- (UDP) Endpoint 4 Interrupt +AT91C_UDP_EPINT5 EQU (0x1:SHL:5) ;- (UDP) Endpoint 5 Interrupt +AT91C_UDP_RXSUSP EQU (0x1:SHL:8) ;- (UDP) USB Suspend Interrupt +AT91C_UDP_RXRSM EQU (0x1:SHL:9) ;- (UDP) USB Resume Interrupt +AT91C_UDP_EXTRSM EQU (0x1:SHL:10) ;- (UDP) USB External Resume Interrupt +AT91C_UDP_SOFINT EQU (0x1:SHL:11) ;- (UDP) USB Start Of frame Interrupt +AT91C_UDP_WAKEUP EQU (0x1:SHL:13) ;- (UDP) USB Resume Interrupt +;- -------- UDP_IDR : (UDP Offset: 0x14) USB Interrupt Disable Register -------- +;- -------- UDP_IMR : (UDP Offset: 0x18) USB Interrupt Mask Register -------- +;- -------- UDP_ISR : (UDP Offset: 0x1c) USB Interrupt Status Register -------- +AT91C_UDP_ENDBUSRES EQU (0x1:SHL:12) ;- (UDP) USB End Of Bus Reset Interrupt +;- -------- UDP_ICR : (UDP Offset: 0x20) USB Interrupt Clear Register -------- +;- -------- UDP_RST_EP : (UDP Offset: 0x28) USB Reset Endpoint Register -------- +AT91C_UDP_EP0 EQU (0x1:SHL:0) ;- (UDP) Reset Endpoint 0 +AT91C_UDP_EP1 EQU (0x1:SHL:1) ;- (UDP) Reset Endpoint 1 +AT91C_UDP_EP2 EQU (0x1:SHL:2) ;- (UDP) Reset Endpoint 2 +AT91C_UDP_EP3 EQU (0x1:SHL:3) ;- (UDP) Reset Endpoint 3 +AT91C_UDP_EP4 EQU (0x1:SHL:4) ;- (UDP) Reset Endpoint 4 +AT91C_UDP_EP5 EQU (0x1:SHL:5) ;- (UDP) Reset Endpoint 5 +;- -------- UDP_CSR : (UDP Offset: 0x30) USB Endpoint Control and Status Register -------- +AT91C_UDP_TXCOMP EQU (0x1:SHL:0) ;- (UDP) Generates an IN packet with data previously written in the DPR +AT91C_UDP_RX_DATA_BK0 EQU (0x1:SHL:1) ;- (UDP) Receive Data Bank 0 +AT91C_UDP_RXSETUP EQU (0x1:SHL:2) ;- (UDP) Sends STALL to the Host (Control endpoints) +AT91C_UDP_ISOERROR EQU (0x1:SHL:3) ;- (UDP) Isochronous error (Isochronous endpoints) +AT91C_UDP_TXPKTRDY EQU (0x1:SHL:4) ;- (UDP) Transmit Packet Ready +AT91C_UDP_FORCESTALL EQU (0x1:SHL:5) ;- (UDP) Force Stall (used by Control, Bulk and Isochronous endpoints). +AT91C_UDP_RX_DATA_BK1 EQU (0x1:SHL:6) ;- (UDP) Receive Data Bank 1 (only used by endpoints with ping-pong attributes). +AT91C_UDP_DIR EQU (0x1:SHL:7) ;- (UDP) Transfer Direction +AT91C_UDP_EPTYPE EQU (0x7:SHL:8) ;- (UDP) Endpoint type +AT91C_UDP_EPTYPE_CTRL EQU (0x0:SHL:8) ;- (UDP) Control +AT91C_UDP_EPTYPE_ISO_OUT EQU (0x1:SHL:8) ;- (UDP) Isochronous OUT +AT91C_UDP_EPTYPE_BULK_OUT EQU (0x2:SHL:8) ;- (UDP) Bulk OUT +AT91C_UDP_EPTYPE_INT_OUT EQU (0x3:SHL:8) ;- (UDP) Interrupt OUT +AT91C_UDP_EPTYPE_ISO_IN EQU (0x5:SHL:8) ;- (UDP) Isochronous IN +AT91C_UDP_EPTYPE_BULK_IN EQU (0x6:SHL:8) ;- (UDP) Bulk IN +AT91C_UDP_EPTYPE_INT_IN EQU (0x7:SHL:8) ;- (UDP) Interrupt IN +AT91C_UDP_DTGLE EQU (0x1:SHL:11) ;- (UDP) Data Toggle +AT91C_UDP_EPEDS EQU (0x1:SHL:15) ;- (UDP) Endpoint Enable Disable +AT91C_UDP_RXBYTECNT EQU (0x7FF:SHL:16) ;- (UDP) Number Of Bytes Available in the FIFO +;- -------- UDP_TXVC : (UDP Offset: 0x74) Transceiver Control Register -------- +AT91C_UDP_TXVDIS EQU (0x1:SHL:8) ;- (UDP) +AT91C_UDP_PUON EQU (0x1:SHL:9) ;- (UDP) Pull-up ON + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Timer Counter Channel Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_TC +TC_CCR # 4 ;- Channel Control Register +TC_CMR # 4 ;- Channel Mode Register (Capture Mode / Waveform Mode) + # 8 ;- Reserved +TC_CV # 4 ;- Counter Value +TC_RA # 4 ;- Register A +TC_RB # 4 ;- Register B +TC_RC # 4 ;- Register C +TC_SR # 4 ;- Status Register +TC_IER # 4 ;- Interrupt Enable Register +TC_IDR # 4 ;- Interrupt Disable Register +TC_IMR # 4 ;- Interrupt Mask Register +;- -------- TC_CCR : (TC Offset: 0x0) TC Channel Control Register -------- +AT91C_TC_CLKEN EQU (0x1:SHL:0) ;- (TC) Counter Clock Enable Command +AT91C_TC_CLKDIS EQU (0x1:SHL:1) ;- (TC) Counter Clock Disable Command +AT91C_TC_SWTRG EQU (0x1:SHL:2) ;- (TC) Software Trigger Command +;- -------- TC_CMR : (TC Offset: 0x4) TC Channel Mode Register: Capture Mode / Waveform Mode -------- +AT91C_TC_CLKS EQU (0x7:SHL:0) ;- (TC) Clock Selection +AT91C_TC_CLKS_TIMER_DIV1_CLOCK EQU (0x0) ;- (TC) Clock selected: TIMER_DIV1_CLOCK +AT91C_TC_CLKS_TIMER_DIV2_CLOCK EQU (0x1) ;- (TC) Clock selected: TIMER_DIV2_CLOCK +AT91C_TC_CLKS_TIMER_DIV3_CLOCK EQU (0x2) ;- (TC) Clock selected: TIMER_DIV3_CLOCK +AT91C_TC_CLKS_TIMER_DIV4_CLOCK EQU (0x3) ;- (TC) Clock selected: TIMER_DIV4_CLOCK +AT91C_TC_CLKS_TIMER_DIV5_CLOCK EQU (0x4) ;- (TC) Clock selected: TIMER_DIV5_CLOCK +AT91C_TC_CLKS_XC0 EQU (0x5) ;- (TC) Clock selected: XC0 +AT91C_TC_CLKS_XC1 EQU (0x6) ;- (TC) Clock selected: XC1 +AT91C_TC_CLKS_XC2 EQU (0x7) ;- (TC) Clock selected: XC2 +AT91C_TC_CLKI EQU (0x1:SHL:3) ;- (TC) Clock Invert +AT91C_TC_BURST EQU (0x3:SHL:4) ;- (TC) Burst Signal Selection +AT91C_TC_BURST_NONE EQU (0x0:SHL:4) ;- (TC) The clock is not gated by an external signal +AT91C_TC_BURST_XC0 EQU (0x1:SHL:4) ;- (TC) XC0 is ANDed with the selected clock +AT91C_TC_BURST_XC1 EQU (0x2:SHL:4) ;- (TC) XC1 is ANDed with the selected clock +AT91C_TC_BURST_XC2 EQU (0x3:SHL:4) ;- (TC) XC2 is ANDed with the selected clock +AT91C_TC_CPCSTOP EQU (0x1:SHL:6) ;- (TC) Counter Clock Stopped with RC Compare +AT91C_TC_LDBSTOP EQU (0x1:SHL:6) ;- (TC) Counter Clock Stopped with RB Loading +AT91C_TC_CPCDIS EQU (0x1:SHL:7) ;- (TC) Counter Clock Disable with RC Compare +AT91C_TC_LDBDIS EQU (0x1:SHL:7) ;- (TC) Counter Clock Disabled with RB Loading +AT91C_TC_ETRGEDG EQU (0x3:SHL:8) ;- (TC) External Trigger Edge Selection +AT91C_TC_ETRGEDG_NONE EQU (0x0:SHL:8) ;- (TC) Edge: None +AT91C_TC_ETRGEDG_RISING EQU (0x1:SHL:8) ;- (TC) Edge: rising edge +AT91C_TC_ETRGEDG_FALLING EQU (0x2:SHL:8) ;- (TC) Edge: falling edge +AT91C_TC_ETRGEDG_BOTH EQU (0x3:SHL:8) ;- (TC) Edge: each edge +AT91C_TC_EEVTEDG EQU (0x3:SHL:8) ;- (TC) External Event Edge Selection +AT91C_TC_EEVTEDG_NONE EQU (0x0:SHL:8) ;- (TC) Edge: None +AT91C_TC_EEVTEDG_RISING EQU (0x1:SHL:8) ;- (TC) Edge: rising edge +AT91C_TC_EEVTEDG_FALLING EQU (0x2:SHL:8) ;- (TC) Edge: falling edge +AT91C_TC_EEVTEDG_BOTH EQU (0x3:SHL:8) ;- (TC) Edge: each edge +AT91C_TC_EEVT EQU (0x3:SHL:10) ;- (TC) External Event Selection +AT91C_TC_EEVT_TIOB EQU (0x0:SHL:10) ;- (TC) Signal selected as external event: TIOB TIOB direction: input +AT91C_TC_EEVT_XC0 EQU (0x1:SHL:10) ;- (TC) Signal selected as external event: XC0 TIOB direction: output +AT91C_TC_EEVT_XC1 EQU (0x2:SHL:10) ;- (TC) Signal selected as external event: XC1 TIOB direction: output +AT91C_TC_EEVT_XC2 EQU (0x3:SHL:10) ;- (TC) Signal selected as external event: XC2 TIOB direction: output +AT91C_TC_ABETRG EQU (0x1:SHL:10) ;- (TC) TIOA or TIOB External Trigger Selection +AT91C_TC_ENETRG EQU (0x1:SHL:12) ;- (TC) External Event Trigger enable +AT91C_TC_WAVESEL EQU (0x3:SHL:13) ;- (TC) Waveform Selection +AT91C_TC_WAVESEL_UP EQU (0x0:SHL:13) ;- (TC) UP mode without atomatic trigger on RC Compare +AT91C_TC_WAVESEL_UPDOWN EQU (0x1:SHL:13) ;- (TC) UPDOWN mode without automatic trigger on RC Compare +AT91C_TC_WAVESEL_UP_AUTO EQU (0x2:SHL:13) ;- (TC) UP mode with automatic trigger on RC Compare +AT91C_TC_WAVESEL_UPDOWN_AUTO EQU (0x3:SHL:13) ;- (TC) UPDOWN mode with automatic trigger on RC Compare +AT91C_TC_CPCTRG EQU (0x1:SHL:14) ;- (TC) RC Compare Trigger Enable +AT91C_TC_WAVE EQU (0x1:SHL:15) ;- (TC) +AT91C_TC_ACPA EQU (0x3:SHL:16) ;- (TC) RA Compare Effect on TIOA +AT91C_TC_ACPA_NONE EQU (0x0:SHL:16) ;- (TC) Effect: none +AT91C_TC_ACPA_SET EQU (0x1:SHL:16) ;- (TC) Effect: set +AT91C_TC_ACPA_CLEAR EQU (0x2:SHL:16) ;- (TC) Effect: clear +AT91C_TC_ACPA_TOGGLE EQU (0x3:SHL:16) ;- (TC) Effect: toggle +AT91C_TC_LDRA EQU (0x3:SHL:16) ;- (TC) RA Loading Selection +AT91C_TC_LDRA_NONE EQU (0x0:SHL:16) ;- (TC) Edge: None +AT91C_TC_LDRA_RISING EQU (0x1:SHL:16) ;- (TC) Edge: rising edge of TIOA +AT91C_TC_LDRA_FALLING EQU (0x2:SHL:16) ;- (TC) Edge: falling edge of TIOA +AT91C_TC_LDRA_BOTH EQU (0x3:SHL:16) ;- (TC) Edge: each edge of TIOA +AT91C_TC_ACPC EQU (0x3:SHL:18) ;- (TC) RC Compare Effect on TIOA +AT91C_TC_ACPC_NONE EQU (0x0:SHL:18) ;- (TC) Effect: none +AT91C_TC_ACPC_SET EQU (0x1:SHL:18) ;- (TC) Effect: set +AT91C_TC_ACPC_CLEAR EQU (0x2:SHL:18) ;- (TC) Effect: clear +AT91C_TC_ACPC_TOGGLE EQU (0x3:SHL:18) ;- (TC) Effect: toggle +AT91C_TC_LDRB EQU (0x3:SHL:18) ;- (TC) RB Loading Selection +AT91C_TC_LDRB_NONE EQU (0x0:SHL:18) ;- (TC) Edge: None +AT91C_TC_LDRB_RISING EQU (0x1:SHL:18) ;- (TC) Edge: rising edge of TIOA +AT91C_TC_LDRB_FALLING EQU (0x2:SHL:18) ;- (TC) Edge: falling edge of TIOA +AT91C_TC_LDRB_BOTH EQU (0x3:SHL:18) ;- (TC) Edge: each edge of TIOA +AT91C_TC_AEEVT EQU (0x3:SHL:20) ;- (TC) External Event Effect on TIOA +AT91C_TC_AEEVT_NONE EQU (0x0:SHL:20) ;- (TC) Effect: none +AT91C_TC_AEEVT_SET EQU (0x1:SHL:20) ;- (TC) Effect: set +AT91C_TC_AEEVT_CLEAR EQU (0x2:SHL:20) ;- (TC) Effect: clear +AT91C_TC_AEEVT_TOGGLE EQU (0x3:SHL:20) ;- (TC) Effect: toggle +AT91C_TC_ASWTRG EQU (0x3:SHL:22) ;- (TC) Software Trigger Effect on TIOA +AT91C_TC_ASWTRG_NONE EQU (0x0:SHL:22) ;- (TC) Effect: none +AT91C_TC_ASWTRG_SET EQU (0x1:SHL:22) ;- (TC) Effect: set +AT91C_TC_ASWTRG_CLEAR EQU (0x2:SHL:22) ;- (TC) Effect: clear +AT91C_TC_ASWTRG_TOGGLE EQU (0x3:SHL:22) ;- (TC) Effect: toggle +AT91C_TC_BCPB EQU (0x3:SHL:24) ;- (TC) RB Compare Effect on TIOB +AT91C_TC_BCPB_NONE EQU (0x0:SHL:24) ;- (TC) Effect: none +AT91C_TC_BCPB_SET EQU (0x1:SHL:24) ;- (TC) Effect: set +AT91C_TC_BCPB_CLEAR EQU (0x2:SHL:24) ;- (TC) Effect: clear +AT91C_TC_BCPB_TOGGLE EQU (0x3:SHL:24) ;- (TC) Effect: toggle +AT91C_TC_BCPC EQU (0x3:SHL:26) ;- (TC) RC Compare Effect on TIOB +AT91C_TC_BCPC_NONE EQU (0x0:SHL:26) ;- (TC) Effect: none +AT91C_TC_BCPC_SET EQU (0x1:SHL:26) ;- (TC) Effect: set +AT91C_TC_BCPC_CLEAR EQU (0x2:SHL:26) ;- (TC) Effect: clear +AT91C_TC_BCPC_TOGGLE EQU (0x3:SHL:26) ;- (TC) Effect: toggle +AT91C_TC_BEEVT EQU (0x3:SHL:28) ;- (TC) External Event Effect on TIOB +AT91C_TC_BEEVT_NONE EQU (0x0:SHL:28) ;- (TC) Effect: none +AT91C_TC_BEEVT_SET EQU (0x1:SHL:28) ;- (TC) Effect: set +AT91C_TC_BEEVT_CLEAR EQU (0x2:SHL:28) ;- (TC) Effect: clear +AT91C_TC_BEEVT_TOGGLE EQU (0x3:SHL:28) ;- (TC) Effect: toggle +AT91C_TC_BSWTRG EQU (0x3:SHL:30) ;- (TC) Software Trigger Effect on TIOB +AT91C_TC_BSWTRG_NONE EQU (0x0:SHL:30) ;- (TC) Effect: none +AT91C_TC_BSWTRG_SET EQU (0x1:SHL:30) ;- (TC) Effect: set +AT91C_TC_BSWTRG_CLEAR EQU (0x2:SHL:30) ;- (TC) Effect: clear +AT91C_TC_BSWTRG_TOGGLE EQU (0x3:SHL:30) ;- (TC) Effect: toggle +;- -------- TC_SR : (TC Offset: 0x20) TC Channel Status Register -------- +AT91C_TC_COVFS EQU (0x1:SHL:0) ;- (TC) Counter Overflow +AT91C_TC_LOVRS EQU (0x1:SHL:1) ;- (TC) Load Overrun +AT91C_TC_CPAS EQU (0x1:SHL:2) ;- (TC) RA Compare +AT91C_TC_CPBS EQU (0x1:SHL:3) ;- (TC) RB Compare +AT91C_TC_CPCS EQU (0x1:SHL:4) ;- (TC) RC Compare +AT91C_TC_LDRAS EQU (0x1:SHL:5) ;- (TC) RA Loading +AT91C_TC_LDRBS EQU (0x1:SHL:6) ;- (TC) RB Loading +AT91C_TC_ETRGS EQU (0x1:SHL:7) ;- (TC) External Trigger +AT91C_TC_CLKSTA EQU (0x1:SHL:16) ;- (TC) Clock Enabling +AT91C_TC_MTIOA EQU (0x1:SHL:17) ;- (TC) TIOA Mirror +AT91C_TC_MTIOB EQU (0x1:SHL:18) ;- (TC) TIOA Mirror +;- -------- TC_IER : (TC Offset: 0x24) TC Channel Interrupt Enable Register -------- +;- -------- TC_IDR : (TC Offset: 0x28) TC Channel Interrupt Disable Register -------- +;- -------- TC_IMR : (TC Offset: 0x2c) TC Channel Interrupt Mask Register -------- + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Timer Counter Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_TCB +TCB_TC0 # 48 ;- TC Channel 0 + # 16 ;- Reserved +TCB_TC1 # 48 ;- TC Channel 1 + # 16 ;- Reserved +TCB_TC2 # 48 ;- TC Channel 2 + # 16 ;- Reserved +TCB_BCR # 4 ;- TC Block Control Register +TCB_BMR # 4 ;- TC Block Mode Register +;- -------- TCB_BCR : (TCB Offset: 0xc0) TC Block Control Register -------- +AT91C_TCB_SYNC EQU (0x1:SHL:0) ;- (TCB) Synchro Command +;- -------- TCB_BMR : (TCB Offset: 0xc4) TC Block Mode Register -------- +AT91C_TCB_TC0XC0S EQU (0x3:SHL:0) ;- (TCB) External Clock Signal 0 Selection +AT91C_TCB_TC0XC0S_TCLK0 EQU (0x0) ;- (TCB) TCLK0 connected to XC0 +AT91C_TCB_TC0XC0S_NONE EQU (0x1) ;- (TCB) None signal connected to XC0 +AT91C_TCB_TC0XC0S_TIOA1 EQU (0x2) ;- (TCB) TIOA1 connected to XC0 +AT91C_TCB_TC0XC0S_TIOA2 EQU (0x3) ;- (TCB) TIOA2 connected to XC0 +AT91C_TCB_TC1XC1S EQU (0x3:SHL:2) ;- (TCB) External Clock Signal 1 Selection +AT91C_TCB_TC1XC1S_TCLK1 EQU (0x0:SHL:2) ;- (TCB) TCLK1 connected to XC1 +AT91C_TCB_TC1XC1S_NONE EQU (0x1:SHL:2) ;- (TCB) None signal connected to XC1 +AT91C_TCB_TC1XC1S_TIOA0 EQU (0x2:SHL:2) ;- (TCB) TIOA0 connected to XC1 +AT91C_TCB_TC1XC1S_TIOA2 EQU (0x3:SHL:2) ;- (TCB) TIOA2 connected to XC1 +AT91C_TCB_TC2XC2S EQU (0x3:SHL:4) ;- (TCB) External Clock Signal 2 Selection +AT91C_TCB_TC2XC2S_TCLK2 EQU (0x0:SHL:4) ;- (TCB) TCLK2 connected to XC2 +AT91C_TCB_TC2XC2S_NONE EQU (0x1:SHL:4) ;- (TCB) None signal connected to XC2 +AT91C_TCB_TC2XC2S_TIOA0 EQU (0x2:SHL:4) ;- (TCB) TIOA0 connected to XC2 +AT91C_TCB_TC2XC2S_TIOA1 EQU (0x3:SHL:4) ;- (TCB) TIOA2 connected to XC2 + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Control Area Network MailBox Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_CAN_MB +CAN_MB_MMR # 4 ;- MailBox Mode Register +CAN_MB_MAM # 4 ;- MailBox Acceptance Mask Register +CAN_MB_MID # 4 ;- MailBox ID Register +CAN_MB_MFID # 4 ;- MailBox Family ID Register +CAN_MB_MSR # 4 ;- MailBox Status Register +CAN_MB_MDL # 4 ;- MailBox Data Low Register +CAN_MB_MDH # 4 ;- MailBox Data High Register +CAN_MB_MCR # 4 ;- MailBox Control Register +;- -------- CAN_MMR : (CAN_MB Offset: 0x0) CAN Message Mode Register -------- +AT91C_CAN_MTIMEMARK EQU (0xFFFF:SHL:0) ;- (CAN_MB) Mailbox Timemark +AT91C_CAN_PRIOR EQU (0xF:SHL:16) ;- (CAN_MB) Mailbox Priority +AT91C_CAN_MOT EQU (0x7:SHL:24) ;- (CAN_MB) Mailbox Object Type +AT91C_CAN_MOT_DIS EQU (0x0:SHL:24) ;- (CAN_MB) +AT91C_CAN_MOT_RX EQU (0x1:SHL:24) ;- (CAN_MB) +AT91C_CAN_MOT_RXOVERWRITE EQU (0x2:SHL:24) ;- (CAN_MB) +AT91C_CAN_MOT_TX EQU (0x3:SHL:24) ;- (CAN_MB) +AT91C_CAN_MOT_CONSUMER EQU (0x4:SHL:24) ;- (CAN_MB) +AT91C_CAN_MOT_PRODUCER EQU (0x5:SHL:24) ;- (CAN_MB) +;- -------- CAN_MAM : (CAN_MB Offset: 0x4) CAN Message Acceptance Mask Register -------- +AT91C_CAN_MIDvB EQU (0x3FFFF:SHL:0) ;- (CAN_MB) Complementary bits for identifier in extended mode +AT91C_CAN_MIDvA EQU (0x7FF:SHL:18) ;- (CAN_MB) Identifier for standard frame mode +AT91C_CAN_MIDE EQU (0x1:SHL:29) ;- (CAN_MB) Identifier Version +;- -------- CAN_MID : (CAN_MB Offset: 0x8) CAN Message ID Register -------- +;- -------- CAN_MFID : (CAN_MB Offset: 0xc) CAN Message Family ID Register -------- +;- -------- CAN_MSR : (CAN_MB Offset: 0x10) CAN Message Status Register -------- +AT91C_CAN_MTIMESTAMP EQU (0xFFFF:SHL:0) ;- (CAN_MB) Timer Value +AT91C_CAN_MDLC EQU (0xF:SHL:16) ;- (CAN_MB) Mailbox Data Length Code +AT91C_CAN_MRTR EQU (0x1:SHL:20) ;- (CAN_MB) Mailbox Remote Transmission Request +AT91C_CAN_MABT EQU (0x1:SHL:22) ;- (CAN_MB) Mailbox Message Abort +AT91C_CAN_MRDY EQU (0x1:SHL:23) ;- (CAN_MB) Mailbox Ready +AT91C_CAN_MMI EQU (0x1:SHL:24) ;- (CAN_MB) Mailbox Message Ignored +;- -------- CAN_MDL : (CAN_MB Offset: 0x14) CAN Message Data Low Register -------- +;- -------- CAN_MDH : (CAN_MB Offset: 0x18) CAN Message Data High Register -------- +;- -------- CAN_MCR : (CAN_MB Offset: 0x1c) CAN Message Control Register -------- +AT91C_CAN_MACR EQU (0x1:SHL:22) ;- (CAN_MB) Abort Request for Mailbox +AT91C_CAN_MTCR EQU (0x1:SHL:23) ;- (CAN_MB) Mailbox Transfer Command + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Control Area Network Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_CAN +CAN_MR # 4 ;- Mode Register +CAN_IER # 4 ;- Interrupt Enable Register +CAN_IDR # 4 ;- Interrupt Disable Register +CAN_IMR # 4 ;- Interrupt Mask Register +CAN_SR # 4 ;- Status Register +CAN_BR # 4 ;- Baudrate Register +CAN_TIM # 4 ;- Timer Register +CAN_TIMESTP # 4 ;- Time Stamp Register +CAN_ECR # 4 ;- Error Counter Register +CAN_TCR # 4 ;- Transfer Command Register +CAN_ACR # 4 ;- Abort Command Register + # 208 ;- Reserved +CAN_VR # 4 ;- Version Register + # 256 ;- Reserved +CAN_MB0 # 32 ;- CAN Mailbox 0 +CAN_MB1 # 32 ;- CAN Mailbox 1 +CAN_MB2 # 32 ;- CAN Mailbox 2 +CAN_MB3 # 32 ;- CAN Mailbox 3 +CAN_MB4 # 32 ;- CAN Mailbox 4 +CAN_MB5 # 32 ;- CAN Mailbox 5 +CAN_MB6 # 32 ;- CAN Mailbox 6 +CAN_MB7 # 32 ;- CAN Mailbox 7 +CAN_MB8 # 32 ;- CAN Mailbox 8 +CAN_MB9 # 32 ;- CAN Mailbox 9 +CAN_MB10 # 32 ;- CAN Mailbox 10 +CAN_MB11 # 32 ;- CAN Mailbox 11 +CAN_MB12 # 32 ;- CAN Mailbox 12 +CAN_MB13 # 32 ;- CAN Mailbox 13 +CAN_MB14 # 32 ;- CAN Mailbox 14 +CAN_MB15 # 32 ;- CAN Mailbox 15 +;- -------- CAN_MR : (CAN Offset: 0x0) CAN Mode Register -------- +AT91C_CAN_CANEN EQU (0x1:SHL:0) ;- (CAN) CAN Controller Enable +AT91C_CAN_LPM EQU (0x1:SHL:1) ;- (CAN) Disable/Enable Low Power Mode +AT91C_CAN_ABM EQU (0x1:SHL:2) ;- (CAN) Disable/Enable Autobaud/Listen Mode +AT91C_CAN_OVL EQU (0x1:SHL:3) ;- (CAN) Disable/Enable Overload Frame +AT91C_CAN_TEOF EQU (0x1:SHL:4) ;- (CAN) Time Stamp messages at each end of Frame +AT91C_CAN_TTM EQU (0x1:SHL:5) ;- (CAN) Disable/Enable Time Trigger Mode +AT91C_CAN_TIMFRZ EQU (0x1:SHL:6) ;- (CAN) Enable Timer Freeze +AT91C_CAN_DRPT EQU (0x1:SHL:7) ;- (CAN) Disable Repeat +;- -------- CAN_IER : (CAN Offset: 0x4) CAN Interrupt Enable Register -------- +AT91C_CAN_MB0 EQU (0x1:SHL:0) ;- (CAN) Mailbox 0 Flag +AT91C_CAN_MB1 EQU (0x1:SHL:1) ;- (CAN) Mailbox 1 Flag +AT91C_CAN_MB2 EQU (0x1:SHL:2) ;- (CAN) Mailbox 2 Flag +AT91C_CAN_MB3 EQU (0x1:SHL:3) ;- (CAN) Mailbox 3 Flag +AT91C_CAN_MB4 EQU (0x1:SHL:4) ;- (CAN) Mailbox 4 Flag +AT91C_CAN_MB5 EQU (0x1:SHL:5) ;- (CAN) Mailbox 5 Flag +AT91C_CAN_MB6 EQU (0x1:SHL:6) ;- (CAN) Mailbox 6 Flag +AT91C_CAN_MB7 EQU (0x1:SHL:7) ;- (CAN) Mailbox 7 Flag +AT91C_CAN_MB8 EQU (0x1:SHL:8) ;- (CAN) Mailbox 8 Flag +AT91C_CAN_MB9 EQU (0x1:SHL:9) ;- (CAN) Mailbox 9 Flag +AT91C_CAN_MB10 EQU (0x1:SHL:10) ;- (CAN) Mailbox 10 Flag +AT91C_CAN_MB11 EQU (0x1:SHL:11) ;- (CAN) Mailbox 11 Flag +AT91C_CAN_MB12 EQU (0x1:SHL:12) ;- (CAN) Mailbox 12 Flag +AT91C_CAN_MB13 EQU (0x1:SHL:13) ;- (CAN) Mailbox 13 Flag +AT91C_CAN_MB14 EQU (0x1:SHL:14) ;- (CAN) Mailbox 14 Flag +AT91C_CAN_MB15 EQU (0x1:SHL:15) ;- (CAN) Mailbox 15 Flag +AT91C_CAN_ERRA EQU (0x1:SHL:16) ;- (CAN) Error Active Mode Flag +AT91C_CAN_WARN EQU (0x1:SHL:17) ;- (CAN) Warning Limit Flag +AT91C_CAN_ERRP EQU (0x1:SHL:18) ;- (CAN) Error Passive Mode Flag +AT91C_CAN_BOFF EQU (0x1:SHL:19) ;- (CAN) Bus Off Mode Flag +AT91C_CAN_SLEEP EQU (0x1:SHL:20) ;- (CAN) Sleep Flag +AT91C_CAN_WAKEUP EQU (0x1:SHL:21) ;- (CAN) Wakeup Flag +AT91C_CAN_TOVF EQU (0x1:SHL:22) ;- (CAN) Timer Overflow Flag +AT91C_CAN_TSTP EQU (0x1:SHL:23) ;- (CAN) Timestamp Flag +AT91C_CAN_CERR EQU (0x1:SHL:24) ;- (CAN) CRC Error +AT91C_CAN_SERR EQU (0x1:SHL:25) ;- (CAN) Stuffing Error +AT91C_CAN_AERR EQU (0x1:SHL:26) ;- (CAN) Acknowledgment Error +AT91C_CAN_FERR EQU (0x1:SHL:27) ;- (CAN) Form Error +AT91C_CAN_BERR EQU (0x1:SHL:28) ;- (CAN) Bit Error +;- -------- CAN_IDR : (CAN Offset: 0x8) CAN Interrupt Disable Register -------- +;- -------- CAN_IMR : (CAN Offset: 0xc) CAN Interrupt Mask Register -------- +;- -------- CAN_SR : (CAN Offset: 0x10) CAN Status Register -------- +AT91C_CAN_RBSY EQU (0x1:SHL:29) ;- (CAN) Receiver Busy +AT91C_CAN_TBSY EQU (0x1:SHL:30) ;- (CAN) Transmitter Busy +AT91C_CAN_OVLY EQU (0x1:SHL:31) ;- (CAN) Overload Busy +;- -------- CAN_BR : (CAN Offset: 0x14) CAN Baudrate Register -------- +AT91C_CAN_PHASE2 EQU (0x7:SHL:0) ;- (CAN) Phase 2 segment +AT91C_CAN_PHASE1 EQU (0x7:SHL:4) ;- (CAN) Phase 1 segment +AT91C_CAN_PROPAG EQU (0x7:SHL:8) ;- (CAN) Programmation time segment +AT91C_CAN_SYNC EQU (0x3:SHL:12) ;- (CAN) Re-synchronization jump width segment +AT91C_CAN_BRP EQU (0x7F:SHL:16) ;- (CAN) Baudrate Prescaler +AT91C_CAN_SMP EQU (0x1:SHL:24) ;- (CAN) Sampling mode +;- -------- CAN_TIM : (CAN Offset: 0x18) CAN Timer Register -------- +AT91C_CAN_TIMER EQU (0xFFFF:SHL:0) ;- (CAN) Timer field +;- -------- CAN_TIMESTP : (CAN Offset: 0x1c) CAN Timestamp Register -------- +;- -------- CAN_ECR : (CAN Offset: 0x20) CAN Error Counter Register -------- +AT91C_CAN_REC EQU (0xFF:SHL:0) ;- (CAN) Receive Error Counter +AT91C_CAN_TEC EQU (0xFF:SHL:16) ;- (CAN) Transmit Error Counter +;- -------- CAN_TCR : (CAN Offset: 0x24) CAN Transfer Command Register -------- +AT91C_CAN_TIMRST EQU (0x1:SHL:31) ;- (CAN) Timer Reset Field +;- -------- CAN_ACR : (CAN Offset: 0x28) CAN Abort Command Register -------- + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Ethernet MAC 10/100 +;- ***************************************************************************** + ^ 0 ;- AT91S_EMAC +EMAC_NCR # 4 ;- Network Control Register +EMAC_NCFGR # 4 ;- Network Configuration Register +EMAC_NSR # 4 ;- Network Status Register + # 8 ;- Reserved +EMAC_TSR # 4 ;- Transmit Status Register +EMAC_RBQP # 4 ;- Receive Buffer Queue Pointer +EMAC_TBQP # 4 ;- Transmit Buffer Queue Pointer +EMAC_RSR # 4 ;- Receive Status Register +EMAC_ISR # 4 ;- Interrupt Status Register +EMAC_IER # 4 ;- Interrupt Enable Register +EMAC_IDR # 4 ;- Interrupt Disable Register +EMAC_IMR # 4 ;- Interrupt Mask Register +EMAC_MAN # 4 ;- PHY Maintenance Register +EMAC_PTR # 4 ;- Pause Time Register +EMAC_PFR # 4 ;- Pause Frames received Register +EMAC_FTO # 4 ;- Frames Transmitted OK Register +EMAC_SCF # 4 ;- Single Collision Frame Register +EMAC_MCF # 4 ;- Multiple Collision Frame Register +EMAC_FRO # 4 ;- Frames Received OK Register +EMAC_FCSE # 4 ;- Frame Check Sequence Error Register +EMAC_ALE # 4 ;- Alignment Error Register +EMAC_DTF # 4 ;- Deferred Transmission Frame Register +EMAC_LCOL # 4 ;- Late Collision Register +EMAC_ECOL # 4 ;- Excessive Collision Register +EMAC_TUND # 4 ;- Transmit Underrun Error Register +EMAC_CSE # 4 ;- Carrier Sense Error Register +EMAC_RRE # 4 ;- Receive Ressource Error Register +EMAC_ROV # 4 ;- Receive Overrun Errors Register +EMAC_RSE # 4 ;- Receive Symbol Errors Register +EMAC_ELE # 4 ;- Excessive Length Errors Register +EMAC_RJA # 4 ;- Receive Jabbers Register +EMAC_USF # 4 ;- Undersize Frames Register +EMAC_STE # 4 ;- SQE Test Error Register +EMAC_RLE # 4 ;- Receive Length Field Mismatch Register +EMAC_TPF # 4 ;- Transmitted Pause Frames Register +EMAC_HRB # 4 ;- Hash Address Bottom[31:0] +EMAC_HRT # 4 ;- Hash Address Top[63:32] +EMAC_SA1L # 4 ;- Specific Address 1 Bottom, First 4 bytes +EMAC_SA1H # 4 ;- Specific Address 1 Top, Last 2 bytes +EMAC_SA2L # 4 ;- Specific Address 2 Bottom, First 4 bytes +EMAC_SA2H # 4 ;- Specific Address 2 Top, Last 2 bytes +EMAC_SA3L # 4 ;- Specific Address 3 Bottom, First 4 bytes +EMAC_SA3H # 4 ;- Specific Address 3 Top, Last 2 bytes +EMAC_SA4L # 4 ;- Specific Address 4 Bottom, First 4 bytes +EMAC_SA4H # 4 ;- Specific Address 4 Top, Last 2 bytes +EMAC_TID # 4 ;- Type ID Checking Register +EMAC_TPQ # 4 ;- Transmit Pause Quantum Register +EMAC_USRIO # 4 ;- USER Input/Output Register +EMAC_WOL # 4 ;- Wake On LAN Register + # 52 ;- Reserved +EMAC_REV # 4 ;- Revision Register +;- -------- EMAC_NCR : (EMAC Offset: 0x0) -------- +AT91C_EMAC_LB EQU (0x1:SHL:0) ;- (EMAC) Loopback. Optional. When set, loopback signal is at high level. +AT91C_EMAC_LLB EQU (0x1:SHL:1) ;- (EMAC) Loopback local. +AT91C_EMAC_RE EQU (0x1:SHL:2) ;- (EMAC) Receive enable. +AT91C_EMAC_TE EQU (0x1:SHL:3) ;- (EMAC) Transmit enable. +AT91C_EMAC_MPE EQU (0x1:SHL:4) ;- (EMAC) Management port enable. +AT91C_EMAC_CLRSTAT EQU (0x1:SHL:5) ;- (EMAC) Clear statistics registers. +AT91C_EMAC_INCSTAT EQU (0x1:SHL:6) ;- (EMAC) Increment statistics registers. +AT91C_EMAC_WESTAT EQU (0x1:SHL:7) ;- (EMAC) Write enable for statistics registers. +AT91C_EMAC_BP EQU (0x1:SHL:8) ;- (EMAC) Back pressure. +AT91C_EMAC_TSTART EQU (0x1:SHL:9) ;- (EMAC) Start Transmission. +AT91C_EMAC_THALT EQU (0x1:SHL:10) ;- (EMAC) Transmission Halt. +AT91C_EMAC_TPFR EQU (0x1:SHL:11) ;- (EMAC) Transmit pause frame +AT91C_EMAC_TZQ EQU (0x1:SHL:12) ;- (EMAC) Transmit zero quantum pause frame +;- -------- EMAC_NCFGR : (EMAC Offset: 0x4) Network Configuration Register -------- +AT91C_EMAC_SPD EQU (0x1:SHL:0) ;- (EMAC) Speed. +AT91C_EMAC_FD EQU (0x1:SHL:1) ;- (EMAC) Full duplex. +AT91C_EMAC_JFRAME EQU (0x1:SHL:3) ;- (EMAC) Jumbo Frames. +AT91C_EMAC_CAF EQU (0x1:SHL:4) ;- (EMAC) Copy all frames. +AT91C_EMAC_NBC EQU (0x1:SHL:5) ;- (EMAC) No broadcast. +AT91C_EMAC_MTI EQU (0x1:SHL:6) ;- (EMAC) Multicast hash event enable +AT91C_EMAC_UNI EQU (0x1:SHL:7) ;- (EMAC) Unicast hash enable. +AT91C_EMAC_BIG EQU (0x1:SHL:8) ;- (EMAC) Receive 1522 bytes. +AT91C_EMAC_EAE EQU (0x1:SHL:9) ;- (EMAC) External address match enable. +AT91C_EMAC_CLK EQU (0x3:SHL:10) ;- (EMAC) +AT91C_EMAC_CLK_HCLK_8 EQU (0x0:SHL:10) ;- (EMAC) HCLK divided by 8 +AT91C_EMAC_CLK_HCLK_16 EQU (0x1:SHL:10) ;- (EMAC) HCLK divided by 16 +AT91C_EMAC_CLK_HCLK_32 EQU (0x2:SHL:10) ;- (EMAC) HCLK divided by 32 +AT91C_EMAC_CLK_HCLK_64 EQU (0x3:SHL:10) ;- (EMAC) HCLK divided by 64 +AT91C_EMAC_RTY EQU (0x1:SHL:12) ;- (EMAC) +AT91C_EMAC_PAE EQU (0x1:SHL:13) ;- (EMAC) +AT91C_EMAC_RBOF EQU (0x3:SHL:14) ;- (EMAC) +AT91C_EMAC_RBOF_OFFSET_0 EQU (0x0:SHL:14) ;- (EMAC) no offset from start of receive buffer +AT91C_EMAC_RBOF_OFFSET_1 EQU (0x1:SHL:14) ;- (EMAC) one byte offset from start of receive buffer +AT91C_EMAC_RBOF_OFFSET_2 EQU (0x2:SHL:14) ;- (EMAC) two bytes offset from start of receive buffer +AT91C_EMAC_RBOF_OFFSET_3 EQU (0x3:SHL:14) ;- (EMAC) three bytes offset from start of receive buffer +AT91C_EMAC_RLCE EQU (0x1:SHL:16) ;- (EMAC) Receive Length field Checking Enable +AT91C_EMAC_DRFCS EQU (0x1:SHL:17) ;- (EMAC) Discard Receive FCS +AT91C_EMAC_EFRHD EQU (0x1:SHL:18) ;- (EMAC) +AT91C_EMAC_IRXFCS EQU (0x1:SHL:19) ;- (EMAC) Ignore RX FCS +;- -------- EMAC_NSR : (EMAC Offset: 0x8) Network Status Register -------- +AT91C_EMAC_LINKR EQU (0x1:SHL:0) ;- (EMAC) +AT91C_EMAC_MDIO EQU (0x1:SHL:1) ;- (EMAC) +AT91C_EMAC_IDLE EQU (0x1:SHL:2) ;- (EMAC) +;- -------- EMAC_TSR : (EMAC Offset: 0x14) Transmit Status Register -------- +AT91C_EMAC_UBR EQU (0x1:SHL:0) ;- (EMAC) +AT91C_EMAC_COL EQU (0x1:SHL:1) ;- (EMAC) +AT91C_EMAC_RLES EQU (0x1:SHL:2) ;- (EMAC) +AT91C_EMAC_TGO EQU (0x1:SHL:3) ;- (EMAC) Transmit Go +AT91C_EMAC_BEX EQU (0x1:SHL:4) ;- (EMAC) Buffers exhausted mid frame +AT91C_EMAC_COMP EQU (0x1:SHL:5) ;- (EMAC) +AT91C_EMAC_UND EQU (0x1:SHL:6) ;- (EMAC) +;- -------- EMAC_RSR : (EMAC Offset: 0x20) Receive Status Register -------- +AT91C_EMAC_BNA EQU (0x1:SHL:0) ;- (EMAC) +AT91C_EMAC_REC EQU (0x1:SHL:1) ;- (EMAC) +AT91C_EMAC_OVR EQU (0x1:SHL:2) ;- (EMAC) +;- -------- EMAC_ISR : (EMAC Offset: 0x24) Interrupt Status Register -------- +AT91C_EMAC_MFD EQU (0x1:SHL:0) ;- (EMAC) +AT91C_EMAC_RCOMP EQU (0x1:SHL:1) ;- (EMAC) +AT91C_EMAC_RXUBR EQU (0x1:SHL:2) ;- (EMAC) +AT91C_EMAC_TXUBR EQU (0x1:SHL:3) ;- (EMAC) +AT91C_EMAC_TUNDR EQU (0x1:SHL:4) ;- (EMAC) +AT91C_EMAC_RLEX EQU (0x1:SHL:5) ;- (EMAC) +AT91C_EMAC_TXERR EQU (0x1:SHL:6) ;- (EMAC) +AT91C_EMAC_TCOMP EQU (0x1:SHL:7) ;- (EMAC) +AT91C_EMAC_LINK EQU (0x1:SHL:9) ;- (EMAC) +AT91C_EMAC_ROVR EQU (0x1:SHL:10) ;- (EMAC) +AT91C_EMAC_HRESP EQU (0x1:SHL:11) ;- (EMAC) +AT91C_EMAC_PFRE EQU (0x1:SHL:12) ;- (EMAC) +AT91C_EMAC_PTZ EQU (0x1:SHL:13) ;- (EMAC) +;- -------- EMAC_IER : (EMAC Offset: 0x28) Interrupt Enable Register -------- +;- -------- EMAC_IDR : (EMAC Offset: 0x2c) Interrupt Disable Register -------- +;- -------- EMAC_IMR : (EMAC Offset: 0x30) Interrupt Mask Register -------- +;- -------- EMAC_MAN : (EMAC Offset: 0x34) PHY Maintenance Register -------- +AT91C_EMAC_DATA EQU (0xFFFF:SHL:0) ;- (EMAC) +AT91C_EMAC_CODE EQU (0x3:SHL:16) ;- (EMAC) +AT91C_EMAC_REGA EQU (0x1F:SHL:18) ;- (EMAC) +AT91C_EMAC_PHYA EQU (0x1F:SHL:23) ;- (EMAC) +AT91C_EMAC_RW EQU (0x3:SHL:28) ;- (EMAC) +AT91C_EMAC_SOF EQU (0x3:SHL:30) ;- (EMAC) +;- -------- EMAC_USRIO : (EMAC Offset: 0xc0) USER Input Output Register -------- +AT91C_EMAC_RMII EQU (0x1:SHL:0) ;- (EMAC) Reduce MII +AT91C_EMAC_CLKEN EQU (0x1:SHL:1) ;- (EMAC) Clock Enable +;- -------- EMAC_WOL : (EMAC Offset: 0xc4) Wake On LAN Register -------- +AT91C_EMAC_IP EQU (0xFFFF:SHL:0) ;- (EMAC) ARP request IP address +AT91C_EMAC_MAG EQU (0x1:SHL:16) ;- (EMAC) Magic packet event enable +AT91C_EMAC_ARP EQU (0x1:SHL:17) ;- (EMAC) ARP request event enable +AT91C_EMAC_SA1 EQU (0x1:SHL:18) ;- (EMAC) Specific address register 1 event enable +;- -------- EMAC_REV : (EMAC Offset: 0xfc) Revision Register -------- +AT91C_EMAC_REVREF EQU (0xFFFF:SHL:0) ;- (EMAC) +AT91C_EMAC_PARTREF EQU (0xFFFF:SHL:16) ;- (EMAC) + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Analog to Digital Convertor +;- ***************************************************************************** + ^ 0 ;- AT91S_ADC +ADC_CR # 4 ;- ADC Control Register +ADC_MR # 4 ;- ADC Mode Register + # 8 ;- Reserved +ADC_CHER # 4 ;- ADC Channel Enable Register +ADC_CHDR # 4 ;- ADC Channel Disable Register +ADC_CHSR # 4 ;- ADC Channel Status Register +ADC_SR # 4 ;- ADC Status Register +ADC_LCDR # 4 ;- ADC Last Converted Data Register +ADC_IER # 4 ;- ADC Interrupt Enable Register +ADC_IDR # 4 ;- ADC Interrupt Disable Register +ADC_IMR # 4 ;- ADC Interrupt Mask Register +ADC_CDR0 # 4 ;- ADC Channel Data Register 0 +ADC_CDR1 # 4 ;- ADC Channel Data Register 1 +ADC_CDR2 # 4 ;- ADC Channel Data Register 2 +ADC_CDR3 # 4 ;- ADC Channel Data Register 3 +ADC_CDR4 # 4 ;- ADC Channel Data Register 4 +ADC_CDR5 # 4 ;- ADC Channel Data Register 5 +ADC_CDR6 # 4 ;- ADC Channel Data Register 6 +ADC_CDR7 # 4 ;- ADC Channel Data Register 7 + # 176 ;- Reserved +ADC_RPR # 4 ;- Receive Pointer Register +ADC_RCR # 4 ;- Receive Counter Register +ADC_TPR # 4 ;- Transmit Pointer Register +ADC_TCR # 4 ;- Transmit Counter Register +ADC_RNPR # 4 ;- Receive Next Pointer Register +ADC_RNCR # 4 ;- Receive Next Counter Register +ADC_TNPR # 4 ;- Transmit Next Pointer Register +ADC_TNCR # 4 ;- Transmit Next Counter Register +ADC_PTCR # 4 ;- PDC Transfer Control Register +ADC_PTSR # 4 ;- PDC Transfer Status Register +;- -------- ADC_CR : (ADC Offset: 0x0) ADC Control Register -------- +AT91C_ADC_SWRST EQU (0x1:SHL:0) ;- (ADC) Software Reset +AT91C_ADC_START EQU (0x1:SHL:1) ;- (ADC) Start Conversion +;- -------- ADC_MR : (ADC Offset: 0x4) ADC Mode Register -------- +AT91C_ADC_TRGEN EQU (0x1:SHL:0) ;- (ADC) Trigger Enable +AT91C_ADC_TRGEN_DIS EQU (0x0) ;- (ADC) Hradware triggers are disabled. Starting a conversion is only possible by software +AT91C_ADC_TRGEN_EN EQU (0x1) ;- (ADC) Hardware trigger selected by TRGSEL field is enabled. +AT91C_ADC_TRGSEL EQU (0x7:SHL:1) ;- (ADC) Trigger Selection +AT91C_ADC_TRGSEL_TIOA0 EQU (0x0:SHL:1) ;- (ADC) Selected TRGSEL = TIAO0 +AT91C_ADC_TRGSEL_TIOA1 EQU (0x1:SHL:1) ;- (ADC) Selected TRGSEL = TIAO1 +AT91C_ADC_TRGSEL_TIOA2 EQU (0x2:SHL:1) ;- (ADC) Selected TRGSEL = TIAO2 +AT91C_ADC_TRGSEL_TIOA3 EQU (0x3:SHL:1) ;- (ADC) Selected TRGSEL = TIAO3 +AT91C_ADC_TRGSEL_TIOA4 EQU (0x4:SHL:1) ;- (ADC) Selected TRGSEL = TIAO4 +AT91C_ADC_TRGSEL_TIOA5 EQU (0x5:SHL:1) ;- (ADC) Selected TRGSEL = TIAO5 +AT91C_ADC_TRGSEL_EXT EQU (0x6:SHL:1) ;- (ADC) Selected TRGSEL = External Trigger +AT91C_ADC_LOWRES EQU (0x1:SHL:4) ;- (ADC) Resolution. +AT91C_ADC_LOWRES_10_BIT EQU (0x0:SHL:4) ;- (ADC) 10-bit resolution +AT91C_ADC_LOWRES_8_BIT EQU (0x1:SHL:4) ;- (ADC) 8-bit resolution +AT91C_ADC_SLEEP EQU (0x1:SHL:5) ;- (ADC) Sleep Mode +AT91C_ADC_SLEEP_NORMAL_MODE EQU (0x0:SHL:5) ;- (ADC) Normal Mode +AT91C_ADC_SLEEP_MODE EQU (0x1:SHL:5) ;- (ADC) Sleep Mode +AT91C_ADC_PRESCAL EQU (0x3F:SHL:8) ;- (ADC) Prescaler rate selection +AT91C_ADC_STARTUP EQU (0x1F:SHL:16) ;- (ADC) Startup Time +AT91C_ADC_SHTIM EQU (0xF:SHL:24) ;- (ADC) Sample & Hold Time +;- -------- ADC_CHER : (ADC Offset: 0x10) ADC Channel Enable Register -------- +AT91C_ADC_CH0 EQU (0x1:SHL:0) ;- (ADC) Channel 0 +AT91C_ADC_CH1 EQU (0x1:SHL:1) ;- (ADC) Channel 1 +AT91C_ADC_CH2 EQU (0x1:SHL:2) ;- (ADC) Channel 2 +AT91C_ADC_CH3 EQU (0x1:SHL:3) ;- (ADC) Channel 3 +AT91C_ADC_CH4 EQU (0x1:SHL:4) ;- (ADC) Channel 4 +AT91C_ADC_CH5 EQU (0x1:SHL:5) ;- (ADC) Channel 5 +AT91C_ADC_CH6 EQU (0x1:SHL:6) ;- (ADC) Channel 6 +AT91C_ADC_CH7 EQU (0x1:SHL:7) ;- (ADC) Channel 7 +;- -------- ADC_CHDR : (ADC Offset: 0x14) ADC Channel Disable Register -------- +;- -------- ADC_CHSR : (ADC Offset: 0x18) ADC Channel Status Register -------- +;- -------- ADC_SR : (ADC Offset: 0x1c) ADC Status Register -------- +AT91C_ADC_EOC0 EQU (0x1:SHL:0) ;- (ADC) End of Conversion +AT91C_ADC_EOC1 EQU (0x1:SHL:1) ;- (ADC) End of Conversion +AT91C_ADC_EOC2 EQU (0x1:SHL:2) ;- (ADC) End of Conversion +AT91C_ADC_EOC3 EQU (0x1:SHL:3) ;- (ADC) End of Conversion +AT91C_ADC_EOC4 EQU (0x1:SHL:4) ;- (ADC) End of Conversion +AT91C_ADC_EOC5 EQU (0x1:SHL:5) ;- (ADC) End of Conversion +AT91C_ADC_EOC6 EQU (0x1:SHL:6) ;- (ADC) End of Conversion +AT91C_ADC_EOC7 EQU (0x1:SHL:7) ;- (ADC) End of Conversion +AT91C_ADC_OVRE0 EQU (0x1:SHL:8) ;- (ADC) Overrun Error +AT91C_ADC_OVRE1 EQU (0x1:SHL:9) ;- (ADC) Overrun Error +AT91C_ADC_OVRE2 EQU (0x1:SHL:10) ;- (ADC) Overrun Error +AT91C_ADC_OVRE3 EQU (0x1:SHL:11) ;- (ADC) Overrun Error +AT91C_ADC_OVRE4 EQU (0x1:SHL:12) ;- (ADC) Overrun Error +AT91C_ADC_OVRE5 EQU (0x1:SHL:13) ;- (ADC) Overrun Error +AT91C_ADC_OVRE6 EQU (0x1:SHL:14) ;- (ADC) Overrun Error +AT91C_ADC_OVRE7 EQU (0x1:SHL:15) ;- (ADC) Overrun Error +AT91C_ADC_DRDY EQU (0x1:SHL:16) ;- (ADC) Data Ready +AT91C_ADC_GOVRE EQU (0x1:SHL:17) ;- (ADC) General Overrun +AT91C_ADC_ENDRX EQU (0x1:SHL:18) ;- (ADC) End of Receiver Transfer +AT91C_ADC_RXBUFF EQU (0x1:SHL:19) ;- (ADC) RXBUFF Interrupt +;- -------- ADC_LCDR : (ADC Offset: 0x20) ADC Last Converted Data Register -------- +AT91C_ADC_LDATA EQU (0x3FF:SHL:0) ;- (ADC) Last Data Converted +;- -------- ADC_IER : (ADC Offset: 0x24) ADC Interrupt Enable Register -------- +;- -------- ADC_IDR : (ADC Offset: 0x28) ADC Interrupt Disable Register -------- +;- -------- ADC_IMR : (ADC Offset: 0x2c) ADC Interrupt Mask Register -------- +;- -------- ADC_CDR0 : (ADC Offset: 0x30) ADC Channel Data Register 0 -------- +AT91C_ADC_DATA EQU (0x3FF:SHL:0) ;- (ADC) Converted Data +;- -------- ADC_CDR1 : (ADC Offset: 0x34) ADC Channel Data Register 1 -------- +;- -------- ADC_CDR2 : (ADC Offset: 0x38) ADC Channel Data Register 2 -------- +;- -------- ADC_CDR3 : (ADC Offset: 0x3c) ADC Channel Data Register 3 -------- +;- -------- ADC_CDR4 : (ADC Offset: 0x40) ADC Channel Data Register 4 -------- +;- -------- ADC_CDR5 : (ADC Offset: 0x44) ADC Channel Data Register 5 -------- +;- -------- ADC_CDR6 : (ADC Offset: 0x48) ADC Channel Data Register 6 -------- +;- -------- ADC_CDR7 : (ADC Offset: 0x4c) ADC Channel Data Register 7 -------- + +;- ***************************************************************************** +;- REGISTER ADDRESS DEFINITION FOR AT91SAM7X256 +;- ***************************************************************************** +;- ========== Register definition for SYS peripheral ========== +;- ========== Register definition for AIC peripheral ========== +AT91C_AIC_IVR EQU (0xFFFFF100) ;- (AIC) IRQ Vector Register +AT91C_AIC_SMR EQU (0xFFFFF000) ;- (AIC) Source Mode Register +AT91C_AIC_FVR EQU (0xFFFFF104) ;- (AIC) FIQ Vector Register +AT91C_AIC_DCR EQU (0xFFFFF138) ;- (AIC) Debug Control Register (Protect) +AT91C_AIC_EOICR EQU (0xFFFFF130) ;- (AIC) End of Interrupt Command Register +AT91C_AIC_SVR EQU (0xFFFFF080) ;- (AIC) Source Vector Register +AT91C_AIC_FFSR EQU (0xFFFFF148) ;- (AIC) Fast Forcing Status Register +AT91C_AIC_ICCR EQU (0xFFFFF128) ;- (AIC) Interrupt Clear Command Register +AT91C_AIC_ISR EQU (0xFFFFF108) ;- (AIC) Interrupt Status Register +AT91C_AIC_IMR EQU (0xFFFFF110) ;- (AIC) Interrupt Mask Register +AT91C_AIC_IPR EQU (0xFFFFF10C) ;- (AIC) Interrupt Pending Register +AT91C_AIC_FFER EQU (0xFFFFF140) ;- (AIC) Fast Forcing Enable Register +AT91C_AIC_IECR EQU (0xFFFFF120) ;- (AIC) Interrupt Enable Command Register +AT91C_AIC_ISCR EQU (0xFFFFF12C) ;- (AIC) Interrupt Set Command Register +AT91C_AIC_FFDR EQU (0xFFFFF144) ;- (AIC) Fast Forcing Disable Register +AT91C_AIC_CISR EQU (0xFFFFF114) ;- (AIC) Core Interrupt Status Register +AT91C_AIC_IDCR EQU (0xFFFFF124) ;- (AIC) Interrupt Disable Command Register +AT91C_AIC_SPU EQU (0xFFFFF134) ;- (AIC) Spurious Vector Register +;- ========== Register definition for PDC_DBGU peripheral ========== +AT91C_DBGU_TCR EQU (0xFFFFF30C) ;- (PDC_DBGU) Transmit Counter Register +AT91C_DBGU_RNPR EQU (0xFFFFF310) ;- (PDC_DBGU) Receive Next Pointer Register +AT91C_DBGU_TNPR EQU (0xFFFFF318) ;- (PDC_DBGU) Transmit Next Pointer Register +AT91C_DBGU_TPR EQU (0xFFFFF308) ;- (PDC_DBGU) Transmit Pointer Register +AT91C_DBGU_RPR EQU (0xFFFFF300) ;- (PDC_DBGU) Receive Pointer Register +AT91C_DBGU_RCR EQU (0xFFFFF304) ;- (PDC_DBGU) Receive Counter Register +AT91C_DBGU_RNCR EQU (0xFFFFF314) ;- (PDC_DBGU) Receive Next Counter Register +AT91C_DBGU_PTCR EQU (0xFFFFF320) ;- (PDC_DBGU) PDC Transfer Control Register +AT91C_DBGU_PTSR EQU (0xFFFFF324) ;- (PDC_DBGU) PDC Transfer Status Register +AT91C_DBGU_TNCR EQU (0xFFFFF31C) ;- (PDC_DBGU) Transmit Next Counter Register +;- ========== Register definition for DBGU peripheral ========== +AT91C_DBGU_EXID EQU (0xFFFFF244) ;- (DBGU) Chip ID Extension Register +AT91C_DBGU_BRGR EQU (0xFFFFF220) ;- (DBGU) Baud Rate Generator Register +AT91C_DBGU_IDR EQU (0xFFFFF20C) ;- (DBGU) Interrupt Disable Register +AT91C_DBGU_CSR EQU (0xFFFFF214) ;- (DBGU) Channel Status Register +AT91C_DBGU_CIDR EQU (0xFFFFF240) ;- (DBGU) Chip ID Register +AT91C_DBGU_MR EQU (0xFFFFF204) ;- (DBGU) Mode Register +AT91C_DBGU_IMR EQU (0xFFFFF210) ;- (DBGU) Interrupt Mask Register +AT91C_DBGU_CR EQU (0xFFFFF200) ;- (DBGU) Control Register +AT91C_DBGU_FNTR EQU (0xFFFFF248) ;- (DBGU) Force NTRST Register +AT91C_DBGU_THR EQU (0xFFFFF21C) ;- (DBGU) Transmitter Holding Register +AT91C_DBGU_RHR EQU (0xFFFFF218) ;- (DBGU) Receiver Holding Register +AT91C_DBGU_IER EQU (0xFFFFF208) ;- (DBGU) Interrupt Enable Register +;- ========== Register definition for PIOA peripheral ========== +AT91C_PIOA_ODR EQU (0xFFFFF414) ;- (PIOA) Output Disable Registerr +AT91C_PIOA_SODR EQU (0xFFFFF430) ;- (PIOA) Set Output Data Register +AT91C_PIOA_ISR EQU (0xFFFFF44C) ;- (PIOA) Interrupt Status Register +AT91C_PIOA_ABSR EQU (0xFFFFF478) ;- (PIOA) AB Select Status Register +AT91C_PIOA_IER EQU (0xFFFFF440) ;- (PIOA) Interrupt Enable Register +AT91C_PIOA_PPUDR EQU (0xFFFFF460) ;- (PIOA) Pull-up Disable Register +AT91C_PIOA_IMR EQU (0xFFFFF448) ;- (PIOA) Interrupt Mask Register +AT91C_PIOA_PER EQU (0xFFFFF400) ;- (PIOA) PIO Enable Register +AT91C_PIOA_IFDR EQU (0xFFFFF424) ;- (PIOA) Input Filter Disable Register +AT91C_PIOA_OWDR EQU (0xFFFFF4A4) ;- (PIOA) Output Write Disable Register +AT91C_PIOA_MDSR EQU (0xFFFFF458) ;- (PIOA) Multi-driver Status Register +AT91C_PIOA_IDR EQU (0xFFFFF444) ;- (PIOA) Interrupt Disable Register +AT91C_PIOA_ODSR EQU (0xFFFFF438) ;- (PIOA) Output Data Status Register +AT91C_PIOA_PPUSR EQU (0xFFFFF468) ;- (PIOA) Pull-up Status Register +AT91C_PIOA_OWSR EQU (0xFFFFF4A8) ;- (PIOA) Output Write Status Register +AT91C_PIOA_BSR EQU (0xFFFFF474) ;- (PIOA) Select B Register +AT91C_PIOA_OWER EQU (0xFFFFF4A0) ;- (PIOA) Output Write Enable Register +AT91C_PIOA_IFER EQU (0xFFFFF420) ;- (PIOA) Input Filter Enable Register +AT91C_PIOA_PDSR EQU (0xFFFFF43C) ;- (PIOA) Pin Data Status Register +AT91C_PIOA_PPUER EQU (0xFFFFF464) ;- (PIOA) Pull-up Enable Register +AT91C_PIOA_OSR EQU (0xFFFFF418) ;- (PIOA) Output Status Register +AT91C_PIOA_ASR EQU (0xFFFFF470) ;- (PIOA) Select A Register +AT91C_PIOA_MDDR EQU (0xFFFFF454) ;- (PIOA) Multi-driver Disable Register +AT91C_PIOA_CODR EQU (0xFFFFF434) ;- (PIOA) Clear Output Data Register +AT91C_PIOA_MDER EQU (0xFFFFF450) ;- (PIOA) Multi-driver Enable Register +AT91C_PIOA_PDR EQU (0xFFFFF404) ;- (PIOA) PIO Disable Register +AT91C_PIOA_IFSR EQU (0xFFFFF428) ;- (PIOA) Input Filter Status Register +AT91C_PIOA_OER EQU (0xFFFFF410) ;- (PIOA) Output Enable Register +AT91C_PIOA_PSR EQU (0xFFFFF408) ;- (PIOA) PIO Status Register +;- ========== Register definition for PIOB peripheral ========== +AT91C_PIOB_OWDR EQU (0xFFFFF6A4) ;- (PIOB) Output Write Disable Register +AT91C_PIOB_MDER EQU (0xFFFFF650) ;- (PIOB) Multi-driver Enable Register +AT91C_PIOB_PPUSR EQU (0xFFFFF668) ;- (PIOB) Pull-up Status Register +AT91C_PIOB_IMR EQU (0xFFFFF648) ;- (PIOB) Interrupt Mask Register +AT91C_PIOB_ASR EQU (0xFFFFF670) ;- (PIOB) Select A Register +AT91C_PIOB_PPUDR EQU (0xFFFFF660) ;- (PIOB) Pull-up Disable Register +AT91C_PIOB_PSR EQU (0xFFFFF608) ;- (PIOB) PIO Status Register +AT91C_PIOB_IER EQU (0xFFFFF640) ;- (PIOB) Interrupt Enable Register +AT91C_PIOB_CODR EQU (0xFFFFF634) ;- (PIOB) Clear Output Data Register +AT91C_PIOB_OWER EQU (0xFFFFF6A0) ;- (PIOB) Output Write Enable Register +AT91C_PIOB_ABSR EQU (0xFFFFF678) ;- (PIOB) AB Select Status Register +AT91C_PIOB_IFDR EQU (0xFFFFF624) ;- (PIOB) Input Filter Disable Register +AT91C_PIOB_PDSR EQU (0xFFFFF63C) ;- (PIOB) Pin Data Status Register +AT91C_PIOB_IDR EQU (0xFFFFF644) ;- (PIOB) Interrupt Disable Register +AT91C_PIOB_OWSR EQU (0xFFFFF6A8) ;- (PIOB) Output Write Status Register +AT91C_PIOB_PDR EQU (0xFFFFF604) ;- (PIOB) PIO Disable Register +AT91C_PIOB_ODR EQU (0xFFFFF614) ;- (PIOB) Output Disable Registerr +AT91C_PIOB_IFSR EQU (0xFFFFF628) ;- (PIOB) Input Filter Status Register +AT91C_PIOB_PPUER EQU (0xFFFFF664) ;- (PIOB) Pull-up Enable Register +AT91C_PIOB_SODR EQU (0xFFFFF630) ;- (PIOB) Set Output Data Register +AT91C_PIOB_ISR EQU (0xFFFFF64C) ;- (PIOB) Interrupt Status Register +AT91C_PIOB_ODSR EQU (0xFFFFF638) ;- (PIOB) Output Data Status Register +AT91C_PIOB_OSR EQU (0xFFFFF618) ;- (PIOB) Output Status Register +AT91C_PIOB_MDSR EQU (0xFFFFF658) ;- (PIOB) Multi-driver Status Register +AT91C_PIOB_IFER EQU (0xFFFFF620) ;- (PIOB) Input Filter Enable Register +AT91C_PIOB_BSR EQU (0xFFFFF674) ;- (PIOB) Select B Register +AT91C_PIOB_MDDR EQU (0xFFFFF654) ;- (PIOB) Multi-driver Disable Register +AT91C_PIOB_OER EQU (0xFFFFF610) ;- (PIOB) Output Enable Register +AT91C_PIOB_PER EQU (0xFFFFF600) ;- (PIOB) PIO Enable Register +;- ========== Register definition for CKGR peripheral ========== +AT91C_CKGR_MOR EQU (0xFFFFFC20) ;- (CKGR) Main Oscillator Register +AT91C_CKGR_PLLR EQU (0xFFFFFC2C) ;- (CKGR) PLL Register +AT91C_CKGR_MCFR EQU (0xFFFFFC24) ;- (CKGR) Main Clock Frequency Register +;- ========== Register definition for PMC peripheral ========== +AT91C_PMC_IDR EQU (0xFFFFFC64) ;- (PMC) Interrupt Disable Register +AT91C_PMC_MOR EQU (0xFFFFFC20) ;- (PMC) Main Oscillator Register +AT91C_PMC_PLLR EQU (0xFFFFFC2C) ;- (PMC) PLL Register +AT91C_PMC_PCER EQU (0xFFFFFC10) ;- (PMC) Peripheral Clock Enable Register +AT91C_PMC_PCKR EQU (0xFFFFFC40) ;- (PMC) Programmable Clock Register +AT91C_PMC_MCKR EQU (0xFFFFFC30) ;- (PMC) Master Clock Register +AT91C_PMC_SCDR EQU (0xFFFFFC04) ;- (PMC) System Clock Disable Register +AT91C_PMC_PCDR EQU (0xFFFFFC14) ;- (PMC) Peripheral Clock Disable Register +AT91C_PMC_SCSR EQU (0xFFFFFC08) ;- (PMC) System Clock Status Register +AT91C_PMC_PCSR EQU (0xFFFFFC18) ;- (PMC) Peripheral Clock Status Register +AT91C_PMC_MCFR EQU (0xFFFFFC24) ;- (PMC) Main Clock Frequency Register +AT91C_PMC_SCER EQU (0xFFFFFC00) ;- (PMC) System Clock Enable Register +AT91C_PMC_IMR EQU (0xFFFFFC6C) ;- (PMC) Interrupt Mask Register +AT91C_PMC_IER EQU (0xFFFFFC60) ;- (PMC) Interrupt Enable Register +AT91C_PMC_SR EQU (0xFFFFFC68) ;- (PMC) Status Register +;- ========== Register definition for RSTC peripheral ========== +AT91C_RSTC_RCR EQU (0xFFFFFD00) ;- (RSTC) Reset Control Register +AT91C_RSTC_RMR EQU (0xFFFFFD08) ;- (RSTC) Reset Mode Register +AT91C_RSTC_RSR EQU (0xFFFFFD04) ;- (RSTC) Reset Status Register +;- ========== Register definition for RTTC peripheral ========== +AT91C_RTTC_RTSR EQU (0xFFFFFD2C) ;- (RTTC) Real-time Status Register +AT91C_RTTC_RTMR EQU (0xFFFFFD20) ;- (RTTC) Real-time Mode Register +AT91C_RTTC_RTVR EQU (0xFFFFFD28) ;- (RTTC) Real-time Value Register +AT91C_RTTC_RTAR EQU (0xFFFFFD24) ;- (RTTC) Real-time Alarm Register +;- ========== Register definition for PITC peripheral ========== +AT91C_PITC_PIVR EQU (0xFFFFFD38) ;- (PITC) Period Interval Value Register +AT91C_PITC_PISR EQU (0xFFFFFD34) ;- (PITC) Period Interval Status Register +AT91C_PITC_PIIR EQU (0xFFFFFD3C) ;- (PITC) Period Interval Image Register +AT91C_PITC_PIMR EQU (0xFFFFFD30) ;- (PITC) Period Interval Mode Register +;- ========== Register definition for WDTC peripheral ========== +AT91C_WDTC_WDCR EQU (0xFFFFFD40) ;- (WDTC) Watchdog Control Register +AT91C_WDTC_WDSR EQU (0xFFFFFD48) ;- (WDTC) Watchdog Status Register +AT91C_WDTC_WDMR EQU (0xFFFFFD44) ;- (WDTC) Watchdog Mode Register +;- ========== Register definition for VREG peripheral ========== +AT91C_VREG_MR EQU (0xFFFFFD60) ;- (VREG) Voltage Regulator Mode Register +;- ========== Register definition for MC peripheral ========== +AT91C_MC_ASR EQU (0xFFFFFF04) ;- (MC) MC Abort Status Register +AT91C_MC_RCR EQU (0xFFFFFF00) ;- (MC) MC Remap Control Register +AT91C_MC_FCR EQU (0xFFFFFF64) ;- (MC) MC Flash Command Register +AT91C_MC_AASR EQU (0xFFFFFF08) ;- (MC) MC Abort Address Status Register +AT91C_MC_FSR EQU (0xFFFFFF68) ;- (MC) MC Flash Status Register +AT91C_MC_FMR EQU (0xFFFFFF60) ;- (MC) MC Flash Mode Register +;- ========== Register definition for PDC_SPI1 peripheral ========== +AT91C_SPI1_PTCR EQU (0xFFFE4120) ;- (PDC_SPI1) PDC Transfer Control Register +AT91C_SPI1_RPR EQU (0xFFFE4100) ;- (PDC_SPI1) Receive Pointer Register +AT91C_SPI1_TNCR EQU (0xFFFE411C) ;- (PDC_SPI1) Transmit Next Counter Register +AT91C_SPI1_TPR EQU (0xFFFE4108) ;- (PDC_SPI1) Transmit Pointer Register +AT91C_SPI1_TNPR EQU (0xFFFE4118) ;- (PDC_SPI1) Transmit Next Pointer Register +AT91C_SPI1_TCR EQU (0xFFFE410C) ;- (PDC_SPI1) Transmit Counter Register +AT91C_SPI1_RCR EQU (0xFFFE4104) ;- (PDC_SPI1) Receive Counter Register +AT91C_SPI1_RNPR EQU (0xFFFE4110) ;- (PDC_SPI1) Receive Next Pointer Register +AT91C_SPI1_RNCR EQU (0xFFFE4114) ;- (PDC_SPI1) Receive Next Counter Register +AT91C_SPI1_PTSR EQU (0xFFFE4124) ;- (PDC_SPI1) PDC Transfer Status Register +;- ========== Register definition for SPI1 peripheral ========== +AT91C_SPI1_IMR EQU (0xFFFE401C) ;- (SPI1) Interrupt Mask Register +AT91C_SPI1_IER EQU (0xFFFE4014) ;- (SPI1) Interrupt Enable Register +AT91C_SPI1_MR EQU (0xFFFE4004) ;- (SPI1) Mode Register +AT91C_SPI1_RDR EQU (0xFFFE4008) ;- (SPI1) Receive Data Register +AT91C_SPI1_IDR EQU (0xFFFE4018) ;- (SPI1) Interrupt Disable Register +AT91C_SPI1_SR EQU (0xFFFE4010) ;- (SPI1) Status Register +AT91C_SPI1_TDR EQU (0xFFFE400C) ;- (SPI1) Transmit Data Register +AT91C_SPI1_CR EQU (0xFFFE4000) ;- (SPI1) Control Register +AT91C_SPI1_CSR EQU (0xFFFE4030) ;- (SPI1) Chip Select Register +;- ========== Register definition for PDC_SPI0 peripheral ========== +AT91C_SPI0_PTCR EQU (0xFFFE0120) ;- (PDC_SPI0) PDC Transfer Control Register +AT91C_SPI0_TPR EQU (0xFFFE0108) ;- (PDC_SPI0) Transmit Pointer Register +AT91C_SPI0_TCR EQU (0xFFFE010C) ;- (PDC_SPI0) Transmit Counter Register +AT91C_SPI0_RCR EQU (0xFFFE0104) ;- (PDC_SPI0) Receive Counter Register +AT91C_SPI0_PTSR EQU (0xFFFE0124) ;- (PDC_SPI0) PDC Transfer Status Register +AT91C_SPI0_RNPR EQU (0xFFFE0110) ;- (PDC_SPI0) Receive Next Pointer Register +AT91C_SPI0_RPR EQU (0xFFFE0100) ;- (PDC_SPI0) Receive Pointer Register +AT91C_SPI0_TNCR EQU (0xFFFE011C) ;- (PDC_SPI0) Transmit Next Counter Register +AT91C_SPI0_RNCR EQU (0xFFFE0114) ;- (PDC_SPI0) Receive Next Counter Register +AT91C_SPI0_TNPR EQU (0xFFFE0118) ;- (PDC_SPI0) Transmit Next Pointer Register +;- ========== Register definition for SPI0 peripheral ========== +AT91C_SPI0_IER EQU (0xFFFE0014) ;- (SPI0) Interrupt Enable Register +AT91C_SPI0_SR EQU (0xFFFE0010) ;- (SPI0) Status Register +AT91C_SPI0_IDR EQU (0xFFFE0018) ;- (SPI0) Interrupt Disable Register +AT91C_SPI0_CR EQU (0xFFFE0000) ;- (SPI0) Control Register +AT91C_SPI0_MR EQU (0xFFFE0004) ;- (SPI0) Mode Register +AT91C_SPI0_IMR EQU (0xFFFE001C) ;- (SPI0) Interrupt Mask Register +AT91C_SPI0_TDR EQU (0xFFFE000C) ;- (SPI0) Transmit Data Register +AT91C_SPI0_RDR EQU (0xFFFE0008) ;- (SPI0) Receive Data Register +AT91C_SPI0_CSR EQU (0xFFFE0030) ;- (SPI0) Chip Select Register +;- ========== Register definition for PDC_US1 peripheral ========== +AT91C_US1_RNCR EQU (0xFFFC4114) ;- (PDC_US1) Receive Next Counter Register +AT91C_US1_PTCR EQU (0xFFFC4120) ;- (PDC_US1) PDC Transfer Control Register +AT91C_US1_TCR EQU (0xFFFC410C) ;- (PDC_US1) Transmit Counter Register +AT91C_US1_PTSR EQU (0xFFFC4124) ;- (PDC_US1) PDC Transfer Status Register +AT91C_US1_TNPR EQU (0xFFFC4118) ;- (PDC_US1) Transmit Next Pointer Register +AT91C_US1_RCR EQU (0xFFFC4104) ;- (PDC_US1) Receive Counter Register +AT91C_US1_RNPR EQU (0xFFFC4110) ;- (PDC_US1) Receive Next Pointer Register +AT91C_US1_RPR EQU (0xFFFC4100) ;- (PDC_US1) Receive Pointer Register +AT91C_US1_TNCR EQU (0xFFFC411C) ;- (PDC_US1) Transmit Next Counter Register +AT91C_US1_TPR EQU (0xFFFC4108) ;- (PDC_US1) Transmit Pointer Register +;- ========== Register definition for US1 peripheral ========== +AT91C_US1_IF EQU (0xFFFC404C) ;- (US1) IRDA_FILTER Register +AT91C_US1_NER EQU (0xFFFC4044) ;- (US1) Nb Errors Register +AT91C_US1_RTOR EQU (0xFFFC4024) ;- (US1) Receiver Time-out Register +AT91C_US1_CSR EQU (0xFFFC4014) ;- (US1) Channel Status Register +AT91C_US1_IDR EQU (0xFFFC400C) ;- (US1) Interrupt Disable Register +AT91C_US1_IER EQU (0xFFFC4008) ;- (US1) Interrupt Enable Register +AT91C_US1_THR EQU (0xFFFC401C) ;- (US1) Transmitter Holding Register +AT91C_US1_TTGR EQU (0xFFFC4028) ;- (US1) Transmitter Time-guard Register +AT91C_US1_RHR EQU (0xFFFC4018) ;- (US1) Receiver Holding Register +AT91C_US1_BRGR EQU (0xFFFC4020) ;- (US1) Baud Rate Generator Register +AT91C_US1_IMR EQU (0xFFFC4010) ;- (US1) Interrupt Mask Register +AT91C_US1_FIDI EQU (0xFFFC4040) ;- (US1) FI_DI_Ratio Register +AT91C_US1_CR EQU (0xFFFC4000) ;- (US1) Control Register +AT91C_US1_MR EQU (0xFFFC4004) ;- (US1) Mode Register +;- ========== Register definition for PDC_US0 peripheral ========== +AT91C_US0_TNPR EQU (0xFFFC0118) ;- (PDC_US0) Transmit Next Pointer Register +AT91C_US0_RNPR EQU (0xFFFC0110) ;- (PDC_US0) Receive Next Pointer Register +AT91C_US0_TCR EQU (0xFFFC010C) ;- (PDC_US0) Transmit Counter Register +AT91C_US0_PTCR EQU (0xFFFC0120) ;- (PDC_US0) PDC Transfer Control Register +AT91C_US0_PTSR EQU (0xFFFC0124) ;- (PDC_US0) PDC Transfer Status Register +AT91C_US0_TNCR EQU (0xFFFC011C) ;- (PDC_US0) Transmit Next Counter Register +AT91C_US0_TPR EQU (0xFFFC0108) ;- (PDC_US0) Transmit Pointer Register +AT91C_US0_RCR EQU (0xFFFC0104) ;- (PDC_US0) Receive Counter Register +AT91C_US0_RPR EQU (0xFFFC0100) ;- (PDC_US0) Receive Pointer Register +AT91C_US0_RNCR EQU (0xFFFC0114) ;- (PDC_US0) Receive Next Counter Register +;- ========== Register definition for US0 peripheral ========== +AT91C_US0_BRGR EQU (0xFFFC0020) ;- (US0) Baud Rate Generator Register +AT91C_US0_NER EQU (0xFFFC0044) ;- (US0) Nb Errors Register +AT91C_US0_CR EQU (0xFFFC0000) ;- (US0) Control Register +AT91C_US0_IMR EQU (0xFFFC0010) ;- (US0) Interrupt Mask Register +AT91C_US0_FIDI EQU (0xFFFC0040) ;- (US0) FI_DI_Ratio Register +AT91C_US0_TTGR EQU (0xFFFC0028) ;- (US0) Transmitter Time-guard Register +AT91C_US0_MR EQU (0xFFFC0004) ;- (US0) Mode Register +AT91C_US0_RTOR EQU (0xFFFC0024) ;- (US0) Receiver Time-out Register +AT91C_US0_CSR EQU (0xFFFC0014) ;- (US0) Channel Status Register +AT91C_US0_RHR EQU (0xFFFC0018) ;- (US0) Receiver Holding Register +AT91C_US0_IDR EQU (0xFFFC000C) ;- (US0) Interrupt Disable Register +AT91C_US0_THR EQU (0xFFFC001C) ;- (US0) Transmitter Holding Register +AT91C_US0_IF EQU (0xFFFC004C) ;- (US0) IRDA_FILTER Register +AT91C_US0_IER EQU (0xFFFC0008) ;- (US0) Interrupt Enable Register +;- ========== Register definition for PDC_SSC peripheral ========== +AT91C_SSC_TNCR EQU (0xFFFD411C) ;- (PDC_SSC) Transmit Next Counter Register +AT91C_SSC_RPR EQU (0xFFFD4100) ;- (PDC_SSC) Receive Pointer Register +AT91C_SSC_RNCR EQU (0xFFFD4114) ;- (PDC_SSC) Receive Next Counter Register +AT91C_SSC_TPR EQU (0xFFFD4108) ;- (PDC_SSC) Transmit Pointer Register +AT91C_SSC_PTCR EQU (0xFFFD4120) ;- (PDC_SSC) PDC Transfer Control Register +AT91C_SSC_TCR EQU (0xFFFD410C) ;- (PDC_SSC) Transmit Counter Register +AT91C_SSC_RCR EQU (0xFFFD4104) ;- (PDC_SSC) Receive Counter Register +AT91C_SSC_RNPR EQU (0xFFFD4110) ;- (PDC_SSC) Receive Next Pointer Register +AT91C_SSC_TNPR EQU (0xFFFD4118) ;- (PDC_SSC) Transmit Next Pointer Register +AT91C_SSC_PTSR EQU (0xFFFD4124) ;- (PDC_SSC) PDC Transfer Status Register +;- ========== Register definition for SSC peripheral ========== +AT91C_SSC_RHR EQU (0xFFFD4020) ;- (SSC) Receive Holding Register +AT91C_SSC_RSHR EQU (0xFFFD4030) ;- (SSC) Receive Sync Holding Register +AT91C_SSC_TFMR EQU (0xFFFD401C) ;- (SSC) Transmit Frame Mode Register +AT91C_SSC_IDR EQU (0xFFFD4048) ;- (SSC) Interrupt Disable Register +AT91C_SSC_THR EQU (0xFFFD4024) ;- (SSC) Transmit Holding Register +AT91C_SSC_RCMR EQU (0xFFFD4010) ;- (SSC) Receive Clock ModeRegister +AT91C_SSC_IER EQU (0xFFFD4044) ;- (SSC) Interrupt Enable Register +AT91C_SSC_TSHR EQU (0xFFFD4034) ;- (SSC) Transmit Sync Holding Register +AT91C_SSC_SR EQU (0xFFFD4040) ;- (SSC) Status Register +AT91C_SSC_CMR EQU (0xFFFD4004) ;- (SSC) Clock Mode Register +AT91C_SSC_TCMR EQU (0xFFFD4018) ;- (SSC) Transmit Clock Mode Register +AT91C_SSC_CR EQU (0xFFFD4000) ;- (SSC) Control Register +AT91C_SSC_IMR EQU (0xFFFD404C) ;- (SSC) Interrupt Mask Register +AT91C_SSC_RFMR EQU (0xFFFD4014) ;- (SSC) Receive Frame Mode Register +;- ========== Register definition for TWI peripheral ========== +AT91C_TWI_IER EQU (0xFFFB8024) ;- (TWI) Interrupt Enable Register +AT91C_TWI_CR EQU (0xFFFB8000) ;- (TWI) Control Register +AT91C_TWI_SR EQU (0xFFFB8020) ;- (TWI) Status Register +AT91C_TWI_IMR EQU (0xFFFB802C) ;- (TWI) Interrupt Mask Register +AT91C_TWI_THR EQU (0xFFFB8034) ;- (TWI) Transmit Holding Register +AT91C_TWI_IDR EQU (0xFFFB8028) ;- (TWI) Interrupt Disable Register +AT91C_TWI_IADR EQU (0xFFFB800C) ;- (TWI) Internal Address Register +AT91C_TWI_MMR EQU (0xFFFB8004) ;- (TWI) Master Mode Register +AT91C_TWI_CWGR EQU (0xFFFB8010) ;- (TWI) Clock Waveform Generator Register +AT91C_TWI_RHR EQU (0xFFFB8030) ;- (TWI) Receive Holding Register +;- ========== Register definition for PWMC_CH3 peripheral ========== +AT91C_PWMC_CH3_CUPDR EQU (0xFFFCC270) ;- (PWMC_CH3) Channel Update Register +AT91C_PWMC_CH3_Reserved EQU (0xFFFCC274) ;- (PWMC_CH3) Reserved +AT91C_PWMC_CH3_CPRDR EQU (0xFFFCC268) ;- (PWMC_CH3) Channel Period Register +AT91C_PWMC_CH3_CDTYR EQU (0xFFFCC264) ;- (PWMC_CH3) Channel Duty Cycle Register +AT91C_PWMC_CH3_CCNTR EQU (0xFFFCC26C) ;- (PWMC_CH3) Channel Counter Register +AT91C_PWMC_CH3_CMR EQU (0xFFFCC260) ;- (PWMC_CH3) Channel Mode Register +;- ========== Register definition for PWMC_CH2 peripheral ========== +AT91C_PWMC_CH2_Reserved EQU (0xFFFCC254) ;- (PWMC_CH2) Reserved +AT91C_PWMC_CH2_CMR EQU (0xFFFCC240) ;- (PWMC_CH2) Channel Mode Register +AT91C_PWMC_CH2_CCNTR EQU (0xFFFCC24C) ;- (PWMC_CH2) Channel Counter Register +AT91C_PWMC_CH2_CPRDR EQU (0xFFFCC248) ;- (PWMC_CH2) Channel Period Register +AT91C_PWMC_CH2_CUPDR EQU (0xFFFCC250) ;- (PWMC_CH2) Channel Update Register +AT91C_PWMC_CH2_CDTYR EQU (0xFFFCC244) ;- (PWMC_CH2) Channel Duty Cycle Register +;- ========== Register definition for PWMC_CH1 peripheral ========== +AT91C_PWMC_CH1_Reserved EQU (0xFFFCC234) ;- (PWMC_CH1) Reserved +AT91C_PWMC_CH1_CUPDR EQU (0xFFFCC230) ;- (PWMC_CH1) Channel Update Register +AT91C_PWMC_CH1_CPRDR EQU (0xFFFCC228) ;- (PWMC_CH1) Channel Period Register +AT91C_PWMC_CH1_CCNTR EQU (0xFFFCC22C) ;- (PWMC_CH1) Channel Counter Register +AT91C_PWMC_CH1_CDTYR EQU (0xFFFCC224) ;- (PWMC_CH1) Channel Duty Cycle Register +AT91C_PWMC_CH1_CMR EQU (0xFFFCC220) ;- (PWMC_CH1) Channel Mode Register +;- ========== Register definition for PWMC_CH0 peripheral ========== +AT91C_PWMC_CH0_Reserved EQU (0xFFFCC214) ;- (PWMC_CH0) Reserved +AT91C_PWMC_CH0_CPRDR EQU (0xFFFCC208) ;- (PWMC_CH0) Channel Period Register +AT91C_PWMC_CH0_CDTYR EQU (0xFFFCC204) ;- (PWMC_CH0) Channel Duty Cycle Register +AT91C_PWMC_CH0_CMR EQU (0xFFFCC200) ;- (PWMC_CH0) Channel Mode Register +AT91C_PWMC_CH0_CUPDR EQU (0xFFFCC210) ;- (PWMC_CH0) Channel Update Register +AT91C_PWMC_CH0_CCNTR EQU (0xFFFCC20C) ;- (PWMC_CH0) Channel Counter Register +;- ========== Register definition for PWMC peripheral ========== +AT91C_PWMC_IDR EQU (0xFFFCC014) ;- (PWMC) PWMC Interrupt Disable Register +AT91C_PWMC_DIS EQU (0xFFFCC008) ;- (PWMC) PWMC Disable Register +AT91C_PWMC_IER EQU (0xFFFCC010) ;- (PWMC) PWMC Interrupt Enable Register +AT91C_PWMC_VR EQU (0xFFFCC0FC) ;- (PWMC) PWMC Version Register +AT91C_PWMC_ISR EQU (0xFFFCC01C) ;- (PWMC) PWMC Interrupt Status Register +AT91C_PWMC_SR EQU (0xFFFCC00C) ;- (PWMC) PWMC Status Register +AT91C_PWMC_IMR EQU (0xFFFCC018) ;- (PWMC) PWMC Interrupt Mask Register +AT91C_PWMC_MR EQU (0xFFFCC000) ;- (PWMC) PWMC Mode Register +AT91C_PWMC_ENA EQU (0xFFFCC004) ;- (PWMC) PWMC Enable Register +;- ========== Register definition for UDP peripheral ========== +AT91C_UDP_IMR EQU (0xFFFB0018) ;- (UDP) Interrupt Mask Register +AT91C_UDP_FADDR EQU (0xFFFB0008) ;- (UDP) Function Address Register +AT91C_UDP_NUM EQU (0xFFFB0000) ;- (UDP) Frame Number Register +AT91C_UDP_FDR EQU (0xFFFB0050) ;- (UDP) Endpoint FIFO Data Register +AT91C_UDP_ISR EQU (0xFFFB001C) ;- (UDP) Interrupt Status Register +AT91C_UDP_CSR EQU (0xFFFB0030) ;- (UDP) Endpoint Control and Status Register +AT91C_UDP_IDR EQU (0xFFFB0014) ;- (UDP) Interrupt Disable Register +AT91C_UDP_ICR EQU (0xFFFB0020) ;- (UDP) Interrupt Clear Register +AT91C_UDP_RSTEP EQU (0xFFFB0028) ;- (UDP) Reset Endpoint Register +AT91C_UDP_TXVC EQU (0xFFFB0074) ;- (UDP) Transceiver Control Register +AT91C_UDP_GLBSTATE EQU (0xFFFB0004) ;- (UDP) Global State Register +AT91C_UDP_IER EQU (0xFFFB0010) ;- (UDP) Interrupt Enable Register +;- ========== Register definition for TC0 peripheral ========== +AT91C_TC0_SR EQU (0xFFFA0020) ;- (TC0) Status Register +AT91C_TC0_RC EQU (0xFFFA001C) ;- (TC0) Register C +AT91C_TC0_RB EQU (0xFFFA0018) ;- (TC0) Register B +AT91C_TC0_CCR EQU (0xFFFA0000) ;- (TC0) Channel Control Register +AT91C_TC0_CMR EQU (0xFFFA0004) ;- (TC0) Channel Mode Register (Capture Mode / Waveform Mode) +AT91C_TC0_IER EQU (0xFFFA0024) ;- (TC0) Interrupt Enable Register +AT91C_TC0_RA EQU (0xFFFA0014) ;- (TC0) Register A +AT91C_TC0_IDR EQU (0xFFFA0028) ;- (TC0) Interrupt Disable Register +AT91C_TC0_CV EQU (0xFFFA0010) ;- (TC0) Counter Value +AT91C_TC0_IMR EQU (0xFFFA002C) ;- (TC0) Interrupt Mask Register +;- ========== Register definition for TC1 peripheral ========== +AT91C_TC1_RB EQU (0xFFFA0058) ;- (TC1) Register B +AT91C_TC1_CCR EQU (0xFFFA0040) ;- (TC1) Channel Control Register +AT91C_TC1_IER EQU (0xFFFA0064) ;- (TC1) Interrupt Enable Register +AT91C_TC1_IDR EQU (0xFFFA0068) ;- (TC1) Interrupt Disable Register +AT91C_TC1_SR EQU (0xFFFA0060) ;- (TC1) Status Register +AT91C_TC1_CMR EQU (0xFFFA0044) ;- (TC1) Channel Mode Register (Capture Mode / Waveform Mode) +AT91C_TC1_RA EQU (0xFFFA0054) ;- (TC1) Register A +AT91C_TC1_RC EQU (0xFFFA005C) ;- (TC1) Register C +AT91C_TC1_IMR EQU (0xFFFA006C) ;- (TC1) Interrupt Mask Register +AT91C_TC1_CV EQU (0xFFFA0050) ;- (TC1) Counter Value +;- ========== Register definition for TC2 peripheral ========== +AT91C_TC2_CMR EQU (0xFFFA0084) ;- (TC2) Channel Mode Register (Capture Mode / Waveform Mode) +AT91C_TC2_CCR EQU (0xFFFA0080) ;- (TC2) Channel Control Register +AT91C_TC2_CV EQU (0xFFFA0090) ;- (TC2) Counter Value +AT91C_TC2_RA EQU (0xFFFA0094) ;- (TC2) Register A +AT91C_TC2_RB EQU (0xFFFA0098) ;- (TC2) Register B +AT91C_TC2_IDR EQU (0xFFFA00A8) ;- (TC2) Interrupt Disable Register +AT91C_TC2_IMR EQU (0xFFFA00AC) ;- (TC2) Interrupt Mask Register +AT91C_TC2_RC EQU (0xFFFA009C) ;- (TC2) Register C +AT91C_TC2_IER EQU (0xFFFA00A4) ;- (TC2) Interrupt Enable Register +AT91C_TC2_SR EQU (0xFFFA00A0) ;- (TC2) Status Register +;- ========== Register definition for TCB peripheral ========== +AT91C_TCB_BMR EQU (0xFFFA00C4) ;- (TCB) TC Block Mode Register +AT91C_TCB_BCR EQU (0xFFFA00C0) ;- (TCB) TC Block Control Register +;- ========== Register definition for CAN_MB0 peripheral ========== +AT91C_CAN_MB0_MDL EQU (0xFFFD0214) ;- (CAN_MB0) MailBox Data Low Register +AT91C_CAN_MB0_MAM EQU (0xFFFD0204) ;- (CAN_MB0) MailBox Acceptance Mask Register +AT91C_CAN_MB0_MCR EQU (0xFFFD021C) ;- (CAN_MB0) MailBox Control Register +AT91C_CAN_MB0_MID EQU (0xFFFD0208) ;- (CAN_MB0) MailBox ID Register +AT91C_CAN_MB0_MSR EQU (0xFFFD0210) ;- (CAN_MB0) MailBox Status Register +AT91C_CAN_MB0_MFID EQU (0xFFFD020C) ;- (CAN_MB0) MailBox Family ID Register +AT91C_CAN_MB0_MDH EQU (0xFFFD0218) ;- (CAN_MB0) MailBox Data High Register +AT91C_CAN_MB0_MMR EQU (0xFFFD0200) ;- (CAN_MB0) MailBox Mode Register +;- ========== Register definition for CAN_MB1 peripheral ========== +AT91C_CAN_MB1_MDL EQU (0xFFFD0234) ;- (CAN_MB1) MailBox Data Low Register +AT91C_CAN_MB1_MID EQU (0xFFFD0228) ;- (CAN_MB1) MailBox ID Register +AT91C_CAN_MB1_MMR EQU (0xFFFD0220) ;- (CAN_MB1) MailBox Mode Register +AT91C_CAN_MB1_MSR EQU (0xFFFD0230) ;- (CAN_MB1) MailBox Status Register +AT91C_CAN_MB1_MAM EQU (0xFFFD0224) ;- (CAN_MB1) MailBox Acceptance Mask Register +AT91C_CAN_MB1_MDH EQU (0xFFFD0238) ;- (CAN_MB1) MailBox Data High Register +AT91C_CAN_MB1_MCR EQU (0xFFFD023C) ;- (CAN_MB1) MailBox Control Register +AT91C_CAN_MB1_MFID EQU (0xFFFD022C) ;- (CAN_MB1) MailBox Family ID Register +;- ========== Register definition for CAN_MB2 peripheral ========== +AT91C_CAN_MB2_MCR EQU (0xFFFD025C) ;- (CAN_MB2) MailBox Control Register +AT91C_CAN_MB2_MDH EQU (0xFFFD0258) ;- (CAN_MB2) MailBox Data High Register +AT91C_CAN_MB2_MID EQU (0xFFFD0248) ;- (CAN_MB2) MailBox ID Register +AT91C_CAN_MB2_MDL EQU (0xFFFD0254) ;- (CAN_MB2) MailBox Data Low Register +AT91C_CAN_MB2_MMR EQU (0xFFFD0240) ;- (CAN_MB2) MailBox Mode Register +AT91C_CAN_MB2_MAM EQU (0xFFFD0244) ;- (CAN_MB2) MailBox Acceptance Mask Register +AT91C_CAN_MB2_MFID EQU (0xFFFD024C) ;- (CAN_MB2) MailBox Family ID Register +AT91C_CAN_MB2_MSR EQU (0xFFFD0250) ;- (CAN_MB2) MailBox Status Register +;- ========== Register definition for CAN_MB3 peripheral ========== +AT91C_CAN_MB3_MFID EQU (0xFFFD026C) ;- (CAN_MB3) MailBox Family ID Register +AT91C_CAN_MB3_MAM EQU (0xFFFD0264) ;- (CAN_MB3) MailBox Acceptance Mask Register +AT91C_CAN_MB3_MID EQU (0xFFFD0268) ;- (CAN_MB3) MailBox ID Register +AT91C_CAN_MB3_MCR EQU (0xFFFD027C) ;- (CAN_MB3) MailBox Control Register +AT91C_CAN_MB3_MMR EQU (0xFFFD0260) ;- (CAN_MB3) MailBox Mode Register +AT91C_CAN_MB3_MSR EQU (0xFFFD0270) ;- (CAN_MB3) MailBox Status Register +AT91C_CAN_MB3_MDL EQU (0xFFFD0274) ;- (CAN_MB3) MailBox Data Low Register +AT91C_CAN_MB3_MDH EQU (0xFFFD0278) ;- (CAN_MB3) MailBox Data High Register +;- ========== Register definition for CAN_MB4 peripheral ========== +AT91C_CAN_MB4_MID EQU (0xFFFD0288) ;- (CAN_MB4) MailBox ID Register +AT91C_CAN_MB4_MMR EQU (0xFFFD0280) ;- (CAN_MB4) MailBox Mode Register +AT91C_CAN_MB4_MDH EQU (0xFFFD0298) ;- (CAN_MB4) MailBox Data High Register +AT91C_CAN_MB4_MFID EQU (0xFFFD028C) ;- (CAN_MB4) MailBox Family ID Register +AT91C_CAN_MB4_MSR EQU (0xFFFD0290) ;- (CAN_MB4) MailBox Status Register +AT91C_CAN_MB4_MCR EQU (0xFFFD029C) ;- (CAN_MB4) MailBox Control Register +AT91C_CAN_MB4_MDL EQU (0xFFFD0294) ;- (CAN_MB4) MailBox Data Low Register +AT91C_CAN_MB4_MAM EQU (0xFFFD0284) ;- (CAN_MB4) MailBox Acceptance Mask Register +;- ========== Register definition for CAN_MB5 peripheral ========== +AT91C_CAN_MB5_MSR EQU (0xFFFD02B0) ;- (CAN_MB5) MailBox Status Register +AT91C_CAN_MB5_MCR EQU (0xFFFD02BC) ;- (CAN_MB5) MailBox Control Register +AT91C_CAN_MB5_MFID EQU (0xFFFD02AC) ;- (CAN_MB5) MailBox Family ID Register +AT91C_CAN_MB5_MDH EQU (0xFFFD02B8) ;- (CAN_MB5) MailBox Data High Register +AT91C_CAN_MB5_MID EQU (0xFFFD02A8) ;- (CAN_MB5) MailBox ID Register +AT91C_CAN_MB5_MMR EQU (0xFFFD02A0) ;- (CAN_MB5) MailBox Mode Register +AT91C_CAN_MB5_MDL EQU (0xFFFD02B4) ;- (CAN_MB5) MailBox Data Low Register +AT91C_CAN_MB5_MAM EQU (0xFFFD02A4) ;- (CAN_MB5) MailBox Acceptance Mask Register +;- ========== Register definition for CAN_MB6 peripheral ========== +AT91C_CAN_MB6_MFID EQU (0xFFFD02CC) ;- (CAN_MB6) MailBox Family ID Register +AT91C_CAN_MB6_MID EQU (0xFFFD02C8) ;- (CAN_MB6) MailBox ID Register +AT91C_CAN_MB6_MAM EQU (0xFFFD02C4) ;- (CAN_MB6) MailBox Acceptance Mask Register +AT91C_CAN_MB6_MSR EQU (0xFFFD02D0) ;- (CAN_MB6) MailBox Status Register +AT91C_CAN_MB6_MDL EQU (0xFFFD02D4) ;- (CAN_MB6) MailBox Data Low Register +AT91C_CAN_MB6_MCR EQU (0xFFFD02DC) ;- (CAN_MB6) MailBox Control Register +AT91C_CAN_MB6_MDH EQU (0xFFFD02D8) ;- (CAN_MB6) MailBox Data High Register +AT91C_CAN_MB6_MMR EQU (0xFFFD02C0) ;- (CAN_MB6) MailBox Mode Register +;- ========== Register definition for CAN_MB7 peripheral ========== +AT91C_CAN_MB7_MCR EQU (0xFFFD02FC) ;- (CAN_MB7) MailBox Control Register +AT91C_CAN_MB7_MDH EQU (0xFFFD02F8) ;- (CAN_MB7) MailBox Data High Register +AT91C_CAN_MB7_MFID EQU (0xFFFD02EC) ;- (CAN_MB7) MailBox Family ID Register +AT91C_CAN_MB7_MDL EQU (0xFFFD02F4) ;- (CAN_MB7) MailBox Data Low Register +AT91C_CAN_MB7_MID EQU (0xFFFD02E8) ;- (CAN_MB7) MailBox ID Register +AT91C_CAN_MB7_MMR EQU (0xFFFD02E0) ;- (CAN_MB7) MailBox Mode Register +AT91C_CAN_MB7_MAM EQU (0xFFFD02E4) ;- (CAN_MB7) MailBox Acceptance Mask Register +AT91C_CAN_MB7_MSR EQU (0xFFFD02F0) ;- (CAN_MB7) MailBox Status Register +;- ========== Register definition for CAN peripheral ========== +AT91C_CAN_TCR EQU (0xFFFD0024) ;- (CAN) Transfer Command Register +AT91C_CAN_IMR EQU (0xFFFD000C) ;- (CAN) Interrupt Mask Register +AT91C_CAN_IER EQU (0xFFFD0004) ;- (CAN) Interrupt Enable Register +AT91C_CAN_ECR EQU (0xFFFD0020) ;- (CAN) Error Counter Register +AT91C_CAN_TIMESTP EQU (0xFFFD001C) ;- (CAN) Time Stamp Register +AT91C_CAN_MR EQU (0xFFFD0000) ;- (CAN) Mode Register +AT91C_CAN_IDR EQU (0xFFFD0008) ;- (CAN) Interrupt Disable Register +AT91C_CAN_ACR EQU (0xFFFD0028) ;- (CAN) Abort Command Register +AT91C_CAN_TIM EQU (0xFFFD0018) ;- (CAN) Timer Register +AT91C_CAN_SR EQU (0xFFFD0010) ;- (CAN) Status Register +AT91C_CAN_BR EQU (0xFFFD0014) ;- (CAN) Baudrate Register +AT91C_CAN_VR EQU (0xFFFD00FC) ;- (CAN) Version Register +;- ========== Register definition for EMAC peripheral ========== +AT91C_EMAC_ISR EQU (0xFFFDC024) ;- (EMAC) Interrupt Status Register +AT91C_EMAC_SA4H EQU (0xFFFDC0B4) ;- (EMAC) Specific Address 4 Top, Last 2 bytes +AT91C_EMAC_SA1L EQU (0xFFFDC098) ;- (EMAC) Specific Address 1 Bottom, First 4 bytes +AT91C_EMAC_ELE EQU (0xFFFDC078) ;- (EMAC) Excessive Length Errors Register +AT91C_EMAC_LCOL EQU (0xFFFDC05C) ;- (EMAC) Late Collision Register +AT91C_EMAC_RLE EQU (0xFFFDC088) ;- (EMAC) Receive Length Field Mismatch Register +AT91C_EMAC_WOL EQU (0xFFFDC0C4) ;- (EMAC) Wake On LAN Register +AT91C_EMAC_DTF EQU (0xFFFDC058) ;- (EMAC) Deferred Transmission Frame Register +AT91C_EMAC_TUND EQU (0xFFFDC064) ;- (EMAC) Transmit Underrun Error Register +AT91C_EMAC_NCR EQU (0xFFFDC000) ;- (EMAC) Network Control Register +AT91C_EMAC_SA4L EQU (0xFFFDC0B0) ;- (EMAC) Specific Address 4 Bottom, First 4 bytes +AT91C_EMAC_RSR EQU (0xFFFDC020) ;- (EMAC) Receive Status Register +AT91C_EMAC_SA3L EQU (0xFFFDC0A8) ;- (EMAC) Specific Address 3 Bottom, First 4 bytes +AT91C_EMAC_TSR EQU (0xFFFDC014) ;- (EMAC) Transmit Status Register +AT91C_EMAC_IDR EQU (0xFFFDC02C) ;- (EMAC) Interrupt Disable Register +AT91C_EMAC_RSE EQU (0xFFFDC074) ;- (EMAC) Receive Symbol Errors Register +AT91C_EMAC_ECOL EQU (0xFFFDC060) ;- (EMAC) Excessive Collision Register +AT91C_EMAC_TID EQU (0xFFFDC0B8) ;- (EMAC) Type ID Checking Register +AT91C_EMAC_HRB EQU (0xFFFDC090) ;- (EMAC) Hash Address Bottom[31:0] +AT91C_EMAC_TBQP EQU (0xFFFDC01C) ;- (EMAC) Transmit Buffer Queue Pointer +AT91C_EMAC_USRIO EQU (0xFFFDC0C0) ;- (EMAC) USER Input/Output Register +AT91C_EMAC_PTR EQU (0xFFFDC038) ;- (EMAC) Pause Time Register +AT91C_EMAC_SA2H EQU (0xFFFDC0A4) ;- (EMAC) Specific Address 2 Top, Last 2 bytes +AT91C_EMAC_ROV EQU (0xFFFDC070) ;- (EMAC) Receive Overrun Errors Register +AT91C_EMAC_ALE EQU (0xFFFDC054) ;- (EMAC) Alignment Error Register +AT91C_EMAC_RJA EQU (0xFFFDC07C) ;- (EMAC) Receive Jabbers Register +AT91C_EMAC_RBQP EQU (0xFFFDC018) ;- (EMAC) Receive Buffer Queue Pointer +AT91C_EMAC_TPF EQU (0xFFFDC08C) ;- (EMAC) Transmitted Pause Frames Register +AT91C_EMAC_NCFGR EQU (0xFFFDC004) ;- (EMAC) Network Configuration Register +AT91C_EMAC_HRT EQU (0xFFFDC094) ;- (EMAC) Hash Address Top[63:32] +AT91C_EMAC_USF EQU (0xFFFDC080) ;- (EMAC) Undersize Frames Register +AT91C_EMAC_FCSE EQU (0xFFFDC050) ;- (EMAC) Frame Check Sequence Error Register +AT91C_EMAC_TPQ EQU (0xFFFDC0BC) ;- (EMAC) Transmit Pause Quantum Register +AT91C_EMAC_MAN EQU (0xFFFDC034) ;- (EMAC) PHY Maintenance Register +AT91C_EMAC_FTO EQU (0xFFFDC040) ;- (EMAC) Frames Transmitted OK Register +AT91C_EMAC_REV EQU (0xFFFDC0FC) ;- (EMAC) Revision Register +AT91C_EMAC_IMR EQU (0xFFFDC030) ;- (EMAC) Interrupt Mask Register +AT91C_EMAC_SCF EQU (0xFFFDC044) ;- (EMAC) Single Collision Frame Register +AT91C_EMAC_PFR EQU (0xFFFDC03C) ;- (EMAC) Pause Frames received Register +AT91C_EMAC_MCF EQU (0xFFFDC048) ;- (EMAC) Multiple Collision Frame Register +AT91C_EMAC_NSR EQU (0xFFFDC008) ;- (EMAC) Network Status Register +AT91C_EMAC_SA2L EQU (0xFFFDC0A0) ;- (EMAC) Specific Address 2 Bottom, First 4 bytes +AT91C_EMAC_FRO EQU (0xFFFDC04C) ;- (EMAC) Frames Received OK Register +AT91C_EMAC_IER EQU (0xFFFDC028) ;- (EMAC) Interrupt Enable Register +AT91C_EMAC_SA1H EQU (0xFFFDC09C) ;- (EMAC) Specific Address 1 Top, Last 2 bytes +AT91C_EMAC_CSE EQU (0xFFFDC068) ;- (EMAC) Carrier Sense Error Register +AT91C_EMAC_SA3H EQU (0xFFFDC0AC) ;- (EMAC) Specific Address 3 Top, Last 2 bytes +AT91C_EMAC_RRE EQU (0xFFFDC06C) ;- (EMAC) Receive Ressource Error Register +AT91C_EMAC_STE EQU (0xFFFDC084) ;- (EMAC) SQE Test Error Register +;- ========== Register definition for PDC_ADC peripheral ========== +AT91C_ADC_PTSR EQU (0xFFFD8124) ;- (PDC_ADC) PDC Transfer Status Register +AT91C_ADC_PTCR EQU (0xFFFD8120) ;- (PDC_ADC) PDC Transfer Control Register +AT91C_ADC_TNPR EQU (0xFFFD8118) ;- (PDC_ADC) Transmit Next Pointer Register +AT91C_ADC_TNCR EQU (0xFFFD811C) ;- (PDC_ADC) Transmit Next Counter Register +AT91C_ADC_RNPR EQU (0xFFFD8110) ;- (PDC_ADC) Receive Next Pointer Register +AT91C_ADC_RNCR EQU (0xFFFD8114) ;- (PDC_ADC) Receive Next Counter Register +AT91C_ADC_RPR EQU (0xFFFD8100) ;- (PDC_ADC) Receive Pointer Register +AT91C_ADC_TCR EQU (0xFFFD810C) ;- (PDC_ADC) Transmit Counter Register +AT91C_ADC_TPR EQU (0xFFFD8108) ;- (PDC_ADC) Transmit Pointer Register +AT91C_ADC_RCR EQU (0xFFFD8104) ;- (PDC_ADC) Receive Counter Register +;- ========== Register definition for ADC peripheral ========== +AT91C_ADC_CDR2 EQU (0xFFFD8038) ;- (ADC) ADC Channel Data Register 2 +AT91C_ADC_CDR3 EQU (0xFFFD803C) ;- (ADC) ADC Channel Data Register 3 +AT91C_ADC_CDR0 EQU (0xFFFD8030) ;- (ADC) ADC Channel Data Register 0 +AT91C_ADC_CDR5 EQU (0xFFFD8044) ;- (ADC) ADC Channel Data Register 5 +AT91C_ADC_CHDR EQU (0xFFFD8014) ;- (ADC) ADC Channel Disable Register +AT91C_ADC_SR EQU (0xFFFD801C) ;- (ADC) ADC Status Register +AT91C_ADC_CDR4 EQU (0xFFFD8040) ;- (ADC) ADC Channel Data Register 4 +AT91C_ADC_CDR1 EQU (0xFFFD8034) ;- (ADC) ADC Channel Data Register 1 +AT91C_ADC_LCDR EQU (0xFFFD8020) ;- (ADC) ADC Last Converted Data Register +AT91C_ADC_IDR EQU (0xFFFD8028) ;- (ADC) ADC Interrupt Disable Register +AT91C_ADC_CR EQU (0xFFFD8000) ;- (ADC) ADC Control Register +AT91C_ADC_CDR7 EQU (0xFFFD804C) ;- (ADC) ADC Channel Data Register 7 +AT91C_ADC_CDR6 EQU (0xFFFD8048) ;- (ADC) ADC Channel Data Register 6 +AT91C_ADC_IER EQU (0xFFFD8024) ;- (ADC) ADC Interrupt Enable Register +AT91C_ADC_CHER EQU (0xFFFD8010) ;- (ADC) ADC Channel Enable Register +AT91C_ADC_CHSR EQU (0xFFFD8018) ;- (ADC) ADC Channel Status Register +AT91C_ADC_MR EQU (0xFFFD8004) ;- (ADC) ADC Mode Register +AT91C_ADC_IMR EQU (0xFFFD802C) ;- (ADC) ADC Interrupt Mask Register + +;- ***************************************************************************** +;- PIO DEFINITIONS FOR AT91SAM7X256 +;- ***************************************************************************** +AT91C_PIO_PA0 EQU (1:SHL:0) ;- Pin Controlled by PA0 +AT91C_PA0_RXD0 EQU (AT91C_PIO_PA0) ;- USART 0 Receive Data +AT91C_PIO_PA1 EQU (1:SHL:1) ;- Pin Controlled by PA1 +AT91C_PA1_TXD0 EQU (AT91C_PIO_PA1) ;- USART 0 Transmit Data +AT91C_PIO_PA10 EQU (1:SHL:10) ;- Pin Controlled by PA10 +AT91C_PA10_TWD EQU (AT91C_PIO_PA10) ;- TWI Two-wire Serial Data +AT91C_PIO_PA11 EQU (1:SHL:11) ;- Pin Controlled by PA11 +AT91C_PA11_TWCK EQU (AT91C_PIO_PA11) ;- TWI Two-wire Serial Clock +AT91C_PIO_PA12 EQU (1:SHL:12) ;- Pin Controlled by PA12 +AT91C_PA12_SPI0_NPCS0 EQU (AT91C_PIO_PA12) ;- SPI 0 Peripheral Chip Select 0 +AT91C_PIO_PA13 EQU (1:SHL:13) ;- Pin Controlled by PA13 +AT91C_PA13_SPI0_NPCS1 EQU (AT91C_PIO_PA13) ;- SPI 0 Peripheral Chip Select 1 +AT91C_PA13_PCK1 EQU (AT91C_PIO_PA13) ;- PMC Programmable Clock Output 1 +AT91C_PIO_PA14 EQU (1:SHL:14) ;- Pin Controlled by PA14 +AT91C_PA14_SPI0_NPCS2 EQU (AT91C_PIO_PA14) ;- SPI 0 Peripheral Chip Select 2 +AT91C_PA14_IRQ1 EQU (AT91C_PIO_PA14) ;- External Interrupt 1 +AT91C_PIO_PA15 EQU (1:SHL:15) ;- Pin Controlled by PA15 +AT91C_PA15_SPI0_NPCS3 EQU (AT91C_PIO_PA15) ;- SPI 0 Peripheral Chip Select 3 +AT91C_PA15_TCLK2 EQU (AT91C_PIO_PA15) ;- Timer Counter 2 external clock input +AT91C_PIO_PA16 EQU (1:SHL:16) ;- Pin Controlled by PA16 +AT91C_PA16_SPI0_MISO EQU (AT91C_PIO_PA16) ;- SPI 0 Master In Slave +AT91C_PIO_PA17 EQU (1:SHL:17) ;- Pin Controlled by PA17 +AT91C_PA17_SPI0_MOSI EQU (AT91C_PIO_PA17) ;- SPI 0 Master Out Slave +AT91C_PIO_PA18 EQU (1:SHL:18) ;- Pin Controlled by PA18 +AT91C_PA18_SPI0_SPCK EQU (AT91C_PIO_PA18) ;- SPI 0 Serial Clock +AT91C_PIO_PA19 EQU (1:SHL:19) ;- Pin Controlled by PA19 +AT91C_PA19_CANRX EQU (AT91C_PIO_PA19) ;- CAN Receive +AT91C_PIO_PA2 EQU (1:SHL:2) ;- Pin Controlled by PA2 +AT91C_PA2_SCK0 EQU (AT91C_PIO_PA2) ;- USART 0 Serial Clock +AT91C_PA2_SPI1_NPCS1 EQU (AT91C_PIO_PA2) ;- SPI 1 Peripheral Chip Select 1 +AT91C_PIO_PA20 EQU (1:SHL:20) ;- Pin Controlled by PA20 +AT91C_PA20_CANTX EQU (AT91C_PIO_PA20) ;- CAN Transmit +AT91C_PIO_PA21 EQU (1:SHL:21) ;- Pin Controlled by PA21 +AT91C_PA21_TF EQU (AT91C_PIO_PA21) ;- SSC Transmit Frame Sync +AT91C_PA21_SPI1_NPCS0 EQU (AT91C_PIO_PA21) ;- SPI 1 Peripheral Chip Select 0 +AT91C_PIO_PA22 EQU (1:SHL:22) ;- Pin Controlled by PA22 +AT91C_PA22_TK EQU (AT91C_PIO_PA22) ;- SSC Transmit Clock +AT91C_PA22_SPI1_SPCK EQU (AT91C_PIO_PA22) ;- SPI 1 Serial Clock +AT91C_PIO_PA23 EQU (1:SHL:23) ;- Pin Controlled by PA23 +AT91C_PA23_TD EQU (AT91C_PIO_PA23) ;- SSC Transmit data +AT91C_PA23_SPI1_MOSI EQU (AT91C_PIO_PA23) ;- SPI 1 Master Out Slave +AT91C_PIO_PA24 EQU (1:SHL:24) ;- Pin Controlled by PA24 +AT91C_PA24_RD EQU (AT91C_PIO_PA24) ;- SSC Receive Data +AT91C_PA24_SPI1_MISO EQU (AT91C_PIO_PA24) ;- SPI 1 Master In Slave +AT91C_PIO_PA25 EQU (1:SHL:25) ;- Pin Controlled by PA25 +AT91C_PA25_RK EQU (AT91C_PIO_PA25) ;- SSC Receive Clock +AT91C_PA25_SPI1_NPCS1 EQU (AT91C_PIO_PA25) ;- SPI 1 Peripheral Chip Select 1 +AT91C_PIO_PA26 EQU (1:SHL:26) ;- Pin Controlled by PA26 +AT91C_PA26_RF EQU (AT91C_PIO_PA26) ;- SSC Receive Frame Sync +AT91C_PA26_SPI1_NPCS2 EQU (AT91C_PIO_PA26) ;- SPI 1 Peripheral Chip Select 2 +AT91C_PIO_PA27 EQU (1:SHL:27) ;- Pin Controlled by PA27 +AT91C_PA27_DRXD EQU (AT91C_PIO_PA27) ;- DBGU Debug Receive Data +AT91C_PA27_PCK3 EQU (AT91C_PIO_PA27) ;- PMC Programmable Clock Output 3 +AT91C_PIO_PA28 EQU (1:SHL:28) ;- Pin Controlled by PA28 +AT91C_PA28_DTXD EQU (AT91C_PIO_PA28) ;- DBGU Debug Transmit Data +AT91C_PIO_PA29 EQU (1:SHL:29) ;- Pin Controlled by PA29 +AT91C_PA29_FIQ EQU (AT91C_PIO_PA29) ;- AIC Fast Interrupt Input +AT91C_PA29_SPI1_NPCS3 EQU (AT91C_PIO_PA29) ;- SPI 1 Peripheral Chip Select 3 +AT91C_PIO_PA3 EQU (1:SHL:3) ;- Pin Controlled by PA3 +AT91C_PA3_RTS0 EQU (AT91C_PIO_PA3) ;- USART 0 Ready To Send +AT91C_PA3_SPI1_NPCS2 EQU (AT91C_PIO_PA3) ;- SPI 1 Peripheral Chip Select 2 +AT91C_PIO_PA30 EQU (1:SHL:30) ;- Pin Controlled by PA30 +AT91C_PA30_IRQ0 EQU (AT91C_PIO_PA30) ;- External Interrupt 0 +AT91C_PA30_PCK2 EQU (AT91C_PIO_PA30) ;- PMC Programmable Clock Output 2 +AT91C_PIO_PA4 EQU (1:SHL:4) ;- Pin Controlled by PA4 +AT91C_PA4_CTS0 EQU (AT91C_PIO_PA4) ;- USART 0 Clear To Send +AT91C_PA4_SPI1_NPCS3 EQU (AT91C_PIO_PA4) ;- SPI 1 Peripheral Chip Select 3 +AT91C_PIO_PA5 EQU (1:SHL:5) ;- Pin Controlled by PA5 +AT91C_PA5_RXD1 EQU (AT91C_PIO_PA5) ;- USART 1 Receive Data +AT91C_PIO_PA6 EQU (1:SHL:6) ;- Pin Controlled by PA6 +AT91C_PA6_TXD1 EQU (AT91C_PIO_PA6) ;- USART 1 Transmit Data +AT91C_PIO_PA7 EQU (1:SHL:7) ;- Pin Controlled by PA7 +AT91C_PA7_SCK1 EQU (AT91C_PIO_PA7) ;- USART 1 Serial Clock +AT91C_PA7_SPI0_NPCS1 EQU (AT91C_PIO_PA7) ;- SPI 0 Peripheral Chip Select 1 +AT91C_PIO_PA8 EQU (1:SHL:8) ;- Pin Controlled by PA8 +AT91C_PA8_RTS1 EQU (AT91C_PIO_PA8) ;- USART 1 Ready To Send +AT91C_PA8_SPI0_NPCS2 EQU (AT91C_PIO_PA8) ;- SPI 0 Peripheral Chip Select 2 +AT91C_PIO_PA9 EQU (1:SHL:9) ;- Pin Controlled by PA9 +AT91C_PA9_CTS1 EQU (AT91C_PIO_PA9) ;- USART 1 Clear To Send +AT91C_PA9_SPI0_NPCS3 EQU (AT91C_PIO_PA9) ;- SPI 0 Peripheral Chip Select 3 +AT91C_PIO_PB0 EQU (1:SHL:0) ;- Pin Controlled by PB0 +AT91C_PB0_ETXCK_EREFCK EQU (AT91C_PIO_PB0) ;- Ethernet MAC Transmit Clock/Reference Clock +AT91C_PB0_PCK0 EQU (AT91C_PIO_PB0) ;- PMC Programmable Clock Output 0 +AT91C_PIO_PB1 EQU (1:SHL:1) ;- Pin Controlled by PB1 +AT91C_PB1_ETXEN EQU (AT91C_PIO_PB1) ;- Ethernet MAC Transmit Enable +AT91C_PIO_PB10 EQU (1:SHL:10) ;- Pin Controlled by PB10 +AT91C_PB10_ETX2 EQU (AT91C_PIO_PB10) ;- Ethernet MAC Transmit Data 2 +AT91C_PB10_SPI1_NPCS1 EQU (AT91C_PIO_PB10) ;- SPI 1 Peripheral Chip Select 1 +AT91C_PIO_PB11 EQU (1:SHL:11) ;- Pin Controlled by PB11 +AT91C_PB11_ETX3 EQU (AT91C_PIO_PB11) ;- Ethernet MAC Transmit Data 3 +AT91C_PB11_SPI1_NPCS2 EQU (AT91C_PIO_PB11) ;- SPI 1 Peripheral Chip Select 2 +AT91C_PIO_PB12 EQU (1:SHL:12) ;- Pin Controlled by PB12 +AT91C_PB12_ETXER EQU (AT91C_PIO_PB12) ;- Ethernet MAC Transmikt Coding Error +AT91C_PB12_TCLK0 EQU (AT91C_PIO_PB12) ;- Timer Counter 0 external clock input +AT91C_PIO_PB13 EQU (1:SHL:13) ;- Pin Controlled by PB13 +AT91C_PB13_ERX2 EQU (AT91C_PIO_PB13) ;- Ethernet MAC Receive Data 2 +AT91C_PB13_SPI0_NPCS1 EQU (AT91C_PIO_PB13) ;- SPI 0 Peripheral Chip Select 1 +AT91C_PIO_PB14 EQU (1:SHL:14) ;- Pin Controlled by PB14 +AT91C_PB14_ERX3 EQU (AT91C_PIO_PB14) ;- Ethernet MAC Receive Data 3 +AT91C_PB14_SPI0_NPCS2 EQU (AT91C_PIO_PB14) ;- SPI 0 Peripheral Chip Select 2 +AT91C_PIO_PB15 EQU (1:SHL:15) ;- Pin Controlled by PB15 +AT91C_PB15_ERXDV_ECRSDV EQU (AT91C_PIO_PB15) ;- Ethernet MAC Receive Data Valid +AT91C_PIO_PB16 EQU (1:SHL:16) ;- Pin Controlled by PB16 +AT91C_PB16_ECOL EQU (AT91C_PIO_PB16) ;- Ethernet MAC Collision Detected +AT91C_PB16_SPI1_NPCS3 EQU (AT91C_PIO_PB16) ;- SPI 1 Peripheral Chip Select 3 +AT91C_PIO_PB17 EQU (1:SHL:17) ;- Pin Controlled by PB17 +AT91C_PB17_ERXCK EQU (AT91C_PIO_PB17) ;- Ethernet MAC Receive Clock +AT91C_PB17_SPI0_NPCS3 EQU (AT91C_PIO_PB17) ;- SPI 0 Peripheral Chip Select 3 +AT91C_PIO_PB18 EQU (1:SHL:18) ;- Pin Controlled by PB18 +AT91C_PB18_EF100 EQU (AT91C_PIO_PB18) ;- Ethernet MAC Force 100 Mbits/sec +AT91C_PB18_ADTRG EQU (AT91C_PIO_PB18) ;- ADC External Trigger +AT91C_PIO_PB19 EQU (1:SHL:19) ;- Pin Controlled by PB19 +AT91C_PB19_PWM0 EQU (AT91C_PIO_PB19) ;- PWM Channel 0 +AT91C_PB19_TCLK1 EQU (AT91C_PIO_PB19) ;- Timer Counter 1 external clock input +AT91C_PIO_PB2 EQU (1:SHL:2) ;- Pin Controlled by PB2 +AT91C_PB2_ETX0 EQU (AT91C_PIO_PB2) ;- Ethernet MAC Transmit Data 0 +AT91C_PIO_PB20 EQU (1:SHL:20) ;- Pin Controlled by PB20 +AT91C_PB20_PWM1 EQU (AT91C_PIO_PB20) ;- PWM Channel 1 +AT91C_PB20_PCK0 EQU (AT91C_PIO_PB20) ;- PMC Programmable Clock Output 0 +AT91C_PIO_PB21 EQU (1:SHL:21) ;- Pin Controlled by PB21 +AT91C_PB21_PWM2 EQU (AT91C_PIO_PB21) ;- PWM Channel 2 +AT91C_PB21_PCK1 EQU (AT91C_PIO_PB21) ;- PMC Programmable Clock Output 1 +AT91C_PIO_PB22 EQU (1:SHL:22) ;- Pin Controlled by PB22 +AT91C_PB22_PWM3 EQU (AT91C_PIO_PB22) ;- PWM Channel 3 +AT91C_PB22_PCK2 EQU (AT91C_PIO_PB22) ;- PMC Programmable Clock Output 2 +AT91C_PIO_PB23 EQU (1:SHL:23) ;- Pin Controlled by PB23 +AT91C_PB23_TIOA0 EQU (AT91C_PIO_PB23) ;- Timer Counter 0 Multipurpose Timer I/O Pin A +AT91C_PB23_DCD1 EQU (AT91C_PIO_PB23) ;- USART 1 Data Carrier Detect +AT91C_PIO_PB24 EQU (1:SHL:24) ;- Pin Controlled by PB24 +AT91C_PB24_TIOB0 EQU (AT91C_PIO_PB24) ;- Timer Counter 0 Multipurpose Timer I/O Pin B +AT91C_PB24_DSR1 EQU (AT91C_PIO_PB24) ;- USART 1 Data Set ready +AT91C_PIO_PB25 EQU (1:SHL:25) ;- Pin Controlled by PB25 +AT91C_PB25_TIOA1 EQU (AT91C_PIO_PB25) ;- Timer Counter 1 Multipurpose Timer I/O Pin A +AT91C_PB25_DTR1 EQU (AT91C_PIO_PB25) ;- USART 1 Data Terminal ready +AT91C_PIO_PB26 EQU (1:SHL:26) ;- Pin Controlled by PB26 +AT91C_PB26_TIOB1 EQU (AT91C_PIO_PB26) ;- Timer Counter 1 Multipurpose Timer I/O Pin B +AT91C_PB26_RI1 EQU (AT91C_PIO_PB26) ;- USART 1 Ring Indicator +AT91C_PIO_PB27 EQU (1:SHL:27) ;- Pin Controlled by PB27 +AT91C_PB27_TIOA2 EQU (AT91C_PIO_PB27) ;- Timer Counter 2 Multipurpose Timer I/O Pin A +AT91C_PB27_PWM0 EQU (AT91C_PIO_PB27) ;- PWM Channel 0 +AT91C_PIO_PB28 EQU (1:SHL:28) ;- Pin Controlled by PB28 +AT91C_PB28_TIOB2 EQU (AT91C_PIO_PB28) ;- Timer Counter 2 Multipurpose Timer I/O Pin B +AT91C_PB28_PWM1 EQU (AT91C_PIO_PB28) ;- PWM Channel 1 +AT91C_PIO_PB29 EQU (1:SHL:29) ;- Pin Controlled by PB29 +AT91C_PB29_PCK1 EQU (AT91C_PIO_PB29) ;- PMC Programmable Clock Output 1 +AT91C_PB29_PWM2 EQU (AT91C_PIO_PB29) ;- PWM Channel 2 +AT91C_PIO_PB3 EQU (1:SHL:3) ;- Pin Controlled by PB3 +AT91C_PB3_ETX1 EQU (AT91C_PIO_PB3) ;- Ethernet MAC Transmit Data 1 +AT91C_PIO_PB30 EQU (1:SHL:30) ;- Pin Controlled by PB30 +AT91C_PB30_PCK2 EQU (AT91C_PIO_PB30) ;- PMC Programmable Clock Output 2 +AT91C_PB30_PWM3 EQU (AT91C_PIO_PB30) ;- PWM Channel 3 +AT91C_PIO_PB4 EQU (1:SHL:4) ;- Pin Controlled by PB4 +AT91C_PB4_ECRS EQU (AT91C_PIO_PB4) ;- Ethernet MAC Carrier Sense/Carrier Sense and Data Valid +AT91C_PIO_PB5 EQU (1:SHL:5) ;- Pin Controlled by PB5 +AT91C_PB5_ERX0 EQU (AT91C_PIO_PB5) ;- Ethernet MAC Receive Data 0 +AT91C_PIO_PB6 EQU (1:SHL:6) ;- Pin Controlled by PB6 +AT91C_PB6_ERX1 EQU (AT91C_PIO_PB6) ;- Ethernet MAC Receive Data 1 +AT91C_PIO_PB7 EQU (1:SHL:7) ;- Pin Controlled by PB7 +AT91C_PB7_ERXER EQU (AT91C_PIO_PB7) ;- Ethernet MAC Receive Error +AT91C_PIO_PB8 EQU (1:SHL:8) ;- Pin Controlled by PB8 +AT91C_PB8_EMDC EQU (AT91C_PIO_PB8) ;- Ethernet MAC Management Data Clock +AT91C_PIO_PB9 EQU (1:SHL:9) ;- Pin Controlled by PB9 +AT91C_PB9_EMDIO EQU (AT91C_PIO_PB9) ;- Ethernet MAC Management Data Input/Output + +;- ***************************************************************************** +;- PERIPHERAL ID DEFINITIONS FOR AT91SAM7X256 +;- ***************************************************************************** +AT91C_ID_FIQ EQU ( 0) ;- Advanced Interrupt Controller (FIQ) +AT91C_ID_SYS EQU ( 1) ;- System Peripheral +AT91C_ID_PIOA EQU ( 2) ;- Parallel IO Controller A +AT91C_ID_PIOB EQU ( 3) ;- Parallel IO Controller B +AT91C_ID_SPI0 EQU ( 4) ;- Serial Peripheral Interface 0 +AT91C_ID_SPI1 EQU ( 5) ;- Serial Peripheral Interface 1 +AT91C_ID_US0 EQU ( 6) ;- USART 0 +AT91C_ID_US1 EQU ( 7) ;- USART 1 +AT91C_ID_SSC EQU ( 8) ;- Serial Synchronous Controller +AT91C_ID_TWI EQU ( 9) ;- Two-Wire Interface +AT91C_ID_PWMC EQU (10) ;- PWM Controller +AT91C_ID_UDP EQU (11) ;- USB Device Port +AT91C_ID_TC0 EQU (12) ;- Timer Counter 0 +AT91C_ID_TC1 EQU (13) ;- Timer Counter 1 +AT91C_ID_TC2 EQU (14) ;- Timer Counter 2 +AT91C_ID_CAN EQU (15) ;- Control Area Network Controller +AT91C_ID_EMAC EQU (16) ;- Ethernet MAC +AT91C_ID_ADC EQU (17) ;- Analog-to-Digital Converter +AT91C_ID_18_Reserved EQU (18) ;- Reserved +AT91C_ID_19_Reserved EQU (19) ;- Reserved +AT91C_ID_20_Reserved EQU (20) ;- Reserved +AT91C_ID_21_Reserved EQU (21) ;- Reserved +AT91C_ID_22_Reserved EQU (22) ;- Reserved +AT91C_ID_23_Reserved EQU (23) ;- Reserved +AT91C_ID_24_Reserved EQU (24) ;- Reserved +AT91C_ID_25_Reserved EQU (25) ;- Reserved +AT91C_ID_26_Reserved EQU (26) ;- Reserved +AT91C_ID_27_Reserved EQU (27) ;- Reserved +AT91C_ID_28_Reserved EQU (28) ;- Reserved +AT91C_ID_29_Reserved EQU (29) ;- Reserved +AT91C_ID_IRQ0 EQU (30) ;- Advanced Interrupt Controller (IRQ0) +AT91C_ID_IRQ1 EQU (31) ;- Advanced Interrupt Controller (IRQ1) +AT91C_ALL_INT EQU (0xC003FFFF) ;- ALL VALID INTERRUPTS + +;- ***************************************************************************** +;- BASE ADDRESS DEFINITIONS FOR AT91SAM7X256 +;- ***************************************************************************** +AT91C_BASE_SYS EQU (0xFFFFF000) ;- (SYS) Base Address +AT91C_BASE_AIC EQU (0xFFFFF000) ;- (AIC) Base Address +AT91C_BASE_PDC_DBGU EQU (0xFFFFF300) ;- (PDC_DBGU) Base Address +AT91C_BASE_DBGU EQU (0xFFFFF200) ;- (DBGU) Base Address +AT91C_BASE_PIOA EQU (0xFFFFF400) ;- (PIOA) Base Address +AT91C_BASE_PIOB EQU (0xFFFFF600) ;- (PIOB) Base Address +AT91C_BASE_CKGR EQU (0xFFFFFC20) ;- (CKGR) Base Address +AT91C_BASE_PMC EQU (0xFFFFFC00) ;- (PMC) Base Address +AT91C_BASE_RSTC EQU (0xFFFFFD00) ;- (RSTC) Base Address +AT91C_BASE_RTTC EQU (0xFFFFFD20) ;- (RTTC) Base Address +AT91C_BASE_PITC EQU (0xFFFFFD30) ;- (PITC) Base Address +AT91C_BASE_WDTC EQU (0xFFFFFD40) ;- (WDTC) Base Address +AT91C_BASE_VREG EQU (0xFFFFFD60) ;- (VREG) Base Address +AT91C_BASE_MC EQU (0xFFFFFF00) ;- (MC) Base Address +AT91C_BASE_PDC_SPI1 EQU (0xFFFE4100) ;- (PDC_SPI1) Base Address +AT91C_BASE_SPI1 EQU (0xFFFE4000) ;- (SPI1) Base Address +AT91C_BASE_PDC_SPI0 EQU (0xFFFE0100) ;- (PDC_SPI0) Base Address +AT91C_BASE_SPI0 EQU (0xFFFE0000) ;- (SPI0) Base Address +AT91C_BASE_PDC_US1 EQU (0xFFFC4100) ;- (PDC_US1) Base Address +AT91C_BASE_US1 EQU (0xFFFC4000) ;- (US1) Base Address +AT91C_BASE_PDC_US0 EQU (0xFFFC0100) ;- (PDC_US0) Base Address +AT91C_BASE_US0 EQU (0xFFFC0000) ;- (US0) Base Address +AT91C_BASE_PDC_SSC EQU (0xFFFD4100) ;- (PDC_SSC) Base Address +AT91C_BASE_SSC EQU (0xFFFD4000) ;- (SSC) Base Address +AT91C_BASE_TWI EQU (0xFFFB8000) ;- (TWI) Base Address +AT91C_BASE_PWMC_CH3 EQU (0xFFFCC260) ;- (PWMC_CH3) Base Address +AT91C_BASE_PWMC_CH2 EQU (0xFFFCC240) ;- (PWMC_CH2) Base Address +AT91C_BASE_PWMC_CH1 EQU (0xFFFCC220) ;- (PWMC_CH1) Base Address +AT91C_BASE_PWMC_CH0 EQU (0xFFFCC200) ;- (PWMC_CH0) Base Address +AT91C_BASE_PWMC EQU (0xFFFCC000) ;- (PWMC) Base Address +AT91C_BASE_UDP EQU (0xFFFB0000) ;- (UDP) Base Address +AT91C_BASE_TC0 EQU (0xFFFA0000) ;- (TC0) Base Address +AT91C_BASE_TC1 EQU (0xFFFA0040) ;- (TC1) Base Address +AT91C_BASE_TC2 EQU (0xFFFA0080) ;- (TC2) Base Address +AT91C_BASE_TCB EQU (0xFFFA0000) ;- (TCB) Base Address +AT91C_BASE_CAN_MB0 EQU (0xFFFD0200) ;- (CAN_MB0) Base Address +AT91C_BASE_CAN_MB1 EQU (0xFFFD0220) ;- (CAN_MB1) Base Address +AT91C_BASE_CAN_MB2 EQU (0xFFFD0240) ;- (CAN_MB2) Base Address +AT91C_BASE_CAN_MB3 EQU (0xFFFD0260) ;- (CAN_MB3) Base Address +AT91C_BASE_CAN_MB4 EQU (0xFFFD0280) ;- (CAN_MB4) Base Address +AT91C_BASE_CAN_MB5 EQU (0xFFFD02A0) ;- (CAN_MB5) Base Address +AT91C_BASE_CAN_MB6 EQU (0xFFFD02C0) ;- (CAN_MB6) Base Address +AT91C_BASE_CAN_MB7 EQU (0xFFFD02E0) ;- (CAN_MB7) Base Address +AT91C_BASE_CAN EQU (0xFFFD0000) ;- (CAN) Base Address +AT91C_BASE_EMAC EQU (0xFFFDC000) ;- (EMAC) Base Address +AT91C_BASE_PDC_ADC EQU (0xFFFD8100) ;- (PDC_ADC) Base Address +AT91C_BASE_ADC EQU (0xFFFD8000) ;- (ADC) Base Address + +;- ***************************************************************************** +;- MEMORY MAPPING DEFINITIONS FOR AT91SAM7X256 +;- ***************************************************************************** +;- ISRAM +AT91C_ISRAM EQU (0x00200000) ;- Internal SRAM base address +AT91C_ISRAM_SIZE EQU (0x00010000) ;- Internal SRAM size in byte (64 Kbytes) +;- IFLASH +AT91C_IFLASH EQU (0x00100000) ;- Internal FLASH base address +AT91C_IFLASH_SIZE EQU (0x00040000) ;- Internal FLASH size in byte (256 Kbytes) +AT91C_IFLASH_PAGE_SIZE EQU (256) ;- Internal FLASH Page Size: 256 bytes +AT91C_IFLASH_LOCK_REGION_SIZE EQU (16384) ;- Internal FLASH Lock Region Size: 16 Kbytes +AT91C_IFLASH_NB_OF_PAGES EQU (1024) ;- Internal FLASH Number of Pages: 1024 bytes +AT91C_IFLASH_NB_OF_LOCK_BITS EQU (16) ;- Internal FLASH Number of Lock Bits: 16 bytes + + + END diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.rdf b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.rdf new file mode 100644 index 0000000..7668f5b --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.rdf @@ -0,0 +1,4704 @@ +# ---------------------------------------------------------------------------- +# ATMEL Microcontroller Software Support - ROUSSET - +# ---------------------------------------------------------------------------- +# DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +# DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ---------------------------------------------------------------------------- +# File Name : AT91SAM7X256.h +# Object : AT91SAM7X256 definitions +# Generated : AT91 SW Application Group 11/02/2005 (15:17:24) +# +# CVS Reference : /AT91SAM7X256.pl/1.14/Tue Sep 13 15:06:52 2005// +# CVS Reference : /SYS_SAM7X.pl/1.3/Tue Feb 1 17:01:43 2005// +# CVS Reference : /MC_SAM7X.pl/1.2/Fri May 20 14:13:04 2005// +# CVS Reference : /PMC_SAM7X.pl/1.4/Tue Feb 8 13:58:10 2005// +# CVS Reference : /RSTC_SAM7X.pl/1.2/Wed Jul 13 14:57:50 2005// +# CVS Reference : /UDP_SAM7X.pl/1.1/Tue May 10 11:35:35 2005// +# CVS Reference : /PWM_SAM7X.pl/1.1/Tue May 10 11:53:07 2005// +# CVS Reference : /AIC_6075B.pl/1.3/Fri May 20 14:01:30 2005// +# CVS Reference : /PIO_6057A.pl/1.2/Thu Feb 3 10:18:28 2005// +# CVS Reference : /RTTC_6081A.pl/1.2/Tue Nov 9 14:43:58 2004// +# CVS Reference : /PITC_6079A.pl/1.2/Tue Nov 9 14:43:56 2004// +# CVS Reference : /WDTC_6080A.pl/1.3/Tue Nov 9 14:44:00 2004// +# CVS Reference : /VREG_6085B.pl/1.1/Tue Feb 1 16:05:48 2005// +# CVS Reference : /PDC_6074C.pl/1.2/Thu Feb 3 08:48:54 2005// +# CVS Reference : /DBGU_6059D.pl/1.1/Mon Jan 31 13:15:32 2005// +# CVS Reference : /SPI_6088D.pl/1.3/Fri May 20 14:08:59 2005// +# CVS Reference : /US_6089C.pl/1.1/Mon Jul 12 18:23:26 2004// +# CVS Reference : /SSC_6078B.pl/1.1/Wed Jul 13 15:19:19 2005// +# CVS Reference : /TWI_6061A.pl/1.1/Tue Jul 13 07:38:06 2004// +# CVS Reference : /TC_6082A.pl/1.7/Fri Mar 11 12:52:17 2005// +# CVS Reference : /CAN_6019B.pl/1.1/Tue Mar 8 12:42:22 2005// +# CVS Reference : /EMACB_6119A.pl/1.6/Wed Jul 13 15:05:35 2005// +# CVS Reference : /ADC_6051C.pl/1.1/Fri Oct 17 09:12:38 2003// +# ---------------------------------------------------------------------------- + +rdf.version=1 + +~sysinclude=arm_default.rdf +~sysinclude=arm_status.rdf +# ========== Register definition for SYS peripheral ========== +# ========== Register definition for AIC peripheral ========== +AT91C_AIC_IVR.name="AT91C_AIC_IVR" +AT91C_AIC_IVR.description="IRQ Vector Register" +AT91C_AIC_IVR.helpkey="IRQ Vector Register" +AT91C_AIC_IVR.access=memorymapped +AT91C_AIC_IVR.address=0xFFFFF100 +AT91C_AIC_IVR.width=32 +AT91C_AIC_IVR.byteEndian=little +AT91C_AIC_IVR.permission.write=none +AT91C_AIC_SMR.name="AT91C_AIC_SMR" +AT91C_AIC_SMR.description="Source Mode Register" +AT91C_AIC_SMR.helpkey="Source Mode Register" +AT91C_AIC_SMR.access=memorymapped +AT91C_AIC_SMR.address=0xFFFFF000 +AT91C_AIC_SMR.width=32 +AT91C_AIC_SMR.byteEndian=little +AT91C_AIC_FVR.name="AT91C_AIC_FVR" +AT91C_AIC_FVR.description="FIQ Vector Register" +AT91C_AIC_FVR.helpkey="FIQ Vector Register" +AT91C_AIC_FVR.access=memorymapped +AT91C_AIC_FVR.address=0xFFFFF104 +AT91C_AIC_FVR.width=32 +AT91C_AIC_FVR.byteEndian=little +AT91C_AIC_FVR.permission.write=none +AT91C_AIC_DCR.name="AT91C_AIC_DCR" +AT91C_AIC_DCR.description="Debug Control Register (Protect)" +AT91C_AIC_DCR.helpkey="Debug Control Register (Protect)" +AT91C_AIC_DCR.access=memorymapped +AT91C_AIC_DCR.address=0xFFFFF138 +AT91C_AIC_DCR.width=32 +AT91C_AIC_DCR.byteEndian=little +AT91C_AIC_EOICR.name="AT91C_AIC_EOICR" +AT91C_AIC_EOICR.description="End of Interrupt Command Register" +AT91C_AIC_EOICR.helpkey="End of Interrupt Command Register" +AT91C_AIC_EOICR.access=memorymapped +AT91C_AIC_EOICR.address=0xFFFFF130 +AT91C_AIC_EOICR.width=32 +AT91C_AIC_EOICR.byteEndian=little +AT91C_AIC_EOICR.type=enum +AT91C_AIC_EOICR.enum.0.name=*** Write only *** +AT91C_AIC_EOICR.enum.1.name=Error +AT91C_AIC_SVR.name="AT91C_AIC_SVR" +AT91C_AIC_SVR.description="Source Vector Register" +AT91C_AIC_SVR.helpkey="Source Vector Register" +AT91C_AIC_SVR.access=memorymapped +AT91C_AIC_SVR.address=0xFFFFF080 +AT91C_AIC_SVR.width=32 +AT91C_AIC_SVR.byteEndian=little +AT91C_AIC_FFSR.name="AT91C_AIC_FFSR" +AT91C_AIC_FFSR.description="Fast Forcing Status Register" +AT91C_AIC_FFSR.helpkey="Fast Forcing Status Register" +AT91C_AIC_FFSR.access=memorymapped +AT91C_AIC_FFSR.address=0xFFFFF148 +AT91C_AIC_FFSR.width=32 +AT91C_AIC_FFSR.byteEndian=little +AT91C_AIC_FFSR.permission.write=none +AT91C_AIC_ICCR.name="AT91C_AIC_ICCR" +AT91C_AIC_ICCR.description="Interrupt Clear Command Register" +AT91C_AIC_ICCR.helpkey="Interrupt Clear Command Register" +AT91C_AIC_ICCR.access=memorymapped +AT91C_AIC_ICCR.address=0xFFFFF128 +AT91C_AIC_ICCR.width=32 +AT91C_AIC_ICCR.byteEndian=little +AT91C_AIC_ICCR.type=enum +AT91C_AIC_ICCR.enum.0.name=*** Write only *** +AT91C_AIC_ICCR.enum.1.name=Error +AT91C_AIC_ISR.name="AT91C_AIC_ISR" +AT91C_AIC_ISR.description="Interrupt Status Register" +AT91C_AIC_ISR.helpkey="Interrupt Status Register" +AT91C_AIC_ISR.access=memorymapped +AT91C_AIC_ISR.address=0xFFFFF108 +AT91C_AIC_ISR.width=32 +AT91C_AIC_ISR.byteEndian=little +AT91C_AIC_ISR.permission.write=none +AT91C_AIC_IMR.name="AT91C_AIC_IMR" +AT91C_AIC_IMR.description="Interrupt Mask Register" +AT91C_AIC_IMR.helpkey="Interrupt Mask Register" +AT91C_AIC_IMR.access=memorymapped +AT91C_AIC_IMR.address=0xFFFFF110 +AT91C_AIC_IMR.width=32 +AT91C_AIC_IMR.byteEndian=little +AT91C_AIC_IMR.permission.write=none +AT91C_AIC_IPR.name="AT91C_AIC_IPR" +AT91C_AIC_IPR.description="Interrupt Pending Register" +AT91C_AIC_IPR.helpkey="Interrupt Pending Register" +AT91C_AIC_IPR.access=memorymapped +AT91C_AIC_IPR.address=0xFFFFF10C +AT91C_AIC_IPR.width=32 +AT91C_AIC_IPR.byteEndian=little +AT91C_AIC_IPR.permission.write=none +AT91C_AIC_FFER.name="AT91C_AIC_FFER" +AT91C_AIC_FFER.description="Fast Forcing Enable Register" +AT91C_AIC_FFER.helpkey="Fast Forcing Enable Register" +AT91C_AIC_FFER.access=memorymapped +AT91C_AIC_FFER.address=0xFFFFF140 +AT91C_AIC_FFER.width=32 +AT91C_AIC_FFER.byteEndian=little +AT91C_AIC_FFER.type=enum +AT91C_AIC_FFER.enum.0.name=*** Write only *** +AT91C_AIC_FFER.enum.1.name=Error +AT91C_AIC_IECR.name="AT91C_AIC_IECR" +AT91C_AIC_IECR.description="Interrupt Enable Command Register" +AT91C_AIC_IECR.helpkey="Interrupt Enable Command Register" +AT91C_AIC_IECR.access=memorymapped +AT91C_AIC_IECR.address=0xFFFFF120 +AT91C_AIC_IECR.width=32 +AT91C_AIC_IECR.byteEndian=little +AT91C_AIC_IECR.type=enum +AT91C_AIC_IECR.enum.0.name=*** Write only *** +AT91C_AIC_IECR.enum.1.name=Error +AT91C_AIC_ISCR.name="AT91C_AIC_ISCR" +AT91C_AIC_ISCR.description="Interrupt Set Command Register" +AT91C_AIC_ISCR.helpkey="Interrupt Set Command Register" +AT91C_AIC_ISCR.access=memorymapped +AT91C_AIC_ISCR.address=0xFFFFF12C +AT91C_AIC_ISCR.width=32 +AT91C_AIC_ISCR.byteEndian=little +AT91C_AIC_ISCR.type=enum +AT91C_AIC_ISCR.enum.0.name=*** Write only *** +AT91C_AIC_ISCR.enum.1.name=Error +AT91C_AIC_FFDR.name="AT91C_AIC_FFDR" +AT91C_AIC_FFDR.description="Fast Forcing Disable Register" +AT91C_AIC_FFDR.helpkey="Fast Forcing Disable Register" +AT91C_AIC_FFDR.access=memorymapped +AT91C_AIC_FFDR.address=0xFFFFF144 +AT91C_AIC_FFDR.width=32 +AT91C_AIC_FFDR.byteEndian=little +AT91C_AIC_FFDR.type=enum +AT91C_AIC_FFDR.enum.0.name=*** Write only *** +AT91C_AIC_FFDR.enum.1.name=Error +AT91C_AIC_CISR.name="AT91C_AIC_CISR" +AT91C_AIC_CISR.description="Core Interrupt Status Register" +AT91C_AIC_CISR.helpkey="Core Interrupt Status Register" +AT91C_AIC_CISR.access=memorymapped +AT91C_AIC_CISR.address=0xFFFFF114 +AT91C_AIC_CISR.width=32 +AT91C_AIC_CISR.byteEndian=little +AT91C_AIC_CISR.permission.write=none +AT91C_AIC_IDCR.name="AT91C_AIC_IDCR" +AT91C_AIC_IDCR.description="Interrupt Disable Command Register" +AT91C_AIC_IDCR.helpkey="Interrupt Disable Command Register" +AT91C_AIC_IDCR.access=memorymapped +AT91C_AIC_IDCR.address=0xFFFFF124 +AT91C_AIC_IDCR.width=32 +AT91C_AIC_IDCR.byteEndian=little +AT91C_AIC_IDCR.type=enum +AT91C_AIC_IDCR.enum.0.name=*** Write only *** +AT91C_AIC_IDCR.enum.1.name=Error +AT91C_AIC_SPU.name="AT91C_AIC_SPU" +AT91C_AIC_SPU.description="Spurious Vector Register" +AT91C_AIC_SPU.helpkey="Spurious Vector Register" +AT91C_AIC_SPU.access=memorymapped +AT91C_AIC_SPU.address=0xFFFFF134 +AT91C_AIC_SPU.width=32 +AT91C_AIC_SPU.byteEndian=little +# ========== Register definition for PDC_DBGU peripheral ========== +AT91C_DBGU_TCR.name="AT91C_DBGU_TCR" +AT91C_DBGU_TCR.description="Transmit Counter Register" +AT91C_DBGU_TCR.helpkey="Transmit Counter Register" +AT91C_DBGU_TCR.access=memorymapped +AT91C_DBGU_TCR.address=0xFFFFF30C +AT91C_DBGU_TCR.width=32 +AT91C_DBGU_TCR.byteEndian=little +AT91C_DBGU_RNPR.name="AT91C_DBGU_RNPR" +AT91C_DBGU_RNPR.description="Receive Next Pointer Register" +AT91C_DBGU_RNPR.helpkey="Receive Next Pointer Register" +AT91C_DBGU_RNPR.access=memorymapped +AT91C_DBGU_RNPR.address=0xFFFFF310 +AT91C_DBGU_RNPR.width=32 +AT91C_DBGU_RNPR.byteEndian=little +AT91C_DBGU_TNPR.name="AT91C_DBGU_TNPR" +AT91C_DBGU_TNPR.description="Transmit Next Pointer Register" +AT91C_DBGU_TNPR.helpkey="Transmit Next Pointer Register" +AT91C_DBGU_TNPR.access=memorymapped +AT91C_DBGU_TNPR.address=0xFFFFF318 +AT91C_DBGU_TNPR.width=32 +AT91C_DBGU_TNPR.byteEndian=little +AT91C_DBGU_TPR.name="AT91C_DBGU_TPR" +AT91C_DBGU_TPR.description="Transmit Pointer Register" +AT91C_DBGU_TPR.helpkey="Transmit Pointer Register" +AT91C_DBGU_TPR.access=memorymapped +AT91C_DBGU_TPR.address=0xFFFFF308 +AT91C_DBGU_TPR.width=32 +AT91C_DBGU_TPR.byteEndian=little +AT91C_DBGU_RPR.name="AT91C_DBGU_RPR" +AT91C_DBGU_RPR.description="Receive Pointer Register" +AT91C_DBGU_RPR.helpkey="Receive Pointer Register" +AT91C_DBGU_RPR.access=memorymapped +AT91C_DBGU_RPR.address=0xFFFFF300 +AT91C_DBGU_RPR.width=32 +AT91C_DBGU_RPR.byteEndian=little +AT91C_DBGU_RCR.name="AT91C_DBGU_RCR" +AT91C_DBGU_RCR.description="Receive Counter Register" +AT91C_DBGU_RCR.helpkey="Receive Counter Register" +AT91C_DBGU_RCR.access=memorymapped +AT91C_DBGU_RCR.address=0xFFFFF304 +AT91C_DBGU_RCR.width=32 +AT91C_DBGU_RCR.byteEndian=little +AT91C_DBGU_RNCR.name="AT91C_DBGU_RNCR" +AT91C_DBGU_RNCR.description="Receive Next Counter Register" +AT91C_DBGU_RNCR.helpkey="Receive Next Counter Register" +AT91C_DBGU_RNCR.access=memorymapped +AT91C_DBGU_RNCR.address=0xFFFFF314 +AT91C_DBGU_RNCR.width=32 +AT91C_DBGU_RNCR.byteEndian=little +AT91C_DBGU_PTCR.name="AT91C_DBGU_PTCR" +AT91C_DBGU_PTCR.description="PDC Transfer Control Register" +AT91C_DBGU_PTCR.helpkey="PDC Transfer Control Register" +AT91C_DBGU_PTCR.access=memorymapped +AT91C_DBGU_PTCR.address=0xFFFFF320 +AT91C_DBGU_PTCR.width=32 +AT91C_DBGU_PTCR.byteEndian=little +AT91C_DBGU_PTCR.type=enum +AT91C_DBGU_PTCR.enum.0.name=*** Write only *** +AT91C_DBGU_PTCR.enum.1.name=Error +AT91C_DBGU_PTSR.name="AT91C_DBGU_PTSR" +AT91C_DBGU_PTSR.description="PDC Transfer Status Register" +AT91C_DBGU_PTSR.helpkey="PDC Transfer Status Register" +AT91C_DBGU_PTSR.access=memorymapped +AT91C_DBGU_PTSR.address=0xFFFFF324 +AT91C_DBGU_PTSR.width=32 +AT91C_DBGU_PTSR.byteEndian=little +AT91C_DBGU_PTSR.permission.write=none +AT91C_DBGU_TNCR.name="AT91C_DBGU_TNCR" +AT91C_DBGU_TNCR.description="Transmit Next Counter Register" +AT91C_DBGU_TNCR.helpkey="Transmit Next Counter Register" +AT91C_DBGU_TNCR.access=memorymapped +AT91C_DBGU_TNCR.address=0xFFFFF31C +AT91C_DBGU_TNCR.width=32 +AT91C_DBGU_TNCR.byteEndian=little +# ========== Register definition for DBGU peripheral ========== +AT91C_DBGU_EXID.name="AT91C_DBGU_EXID" +AT91C_DBGU_EXID.description="Chip ID Extension Register" +AT91C_DBGU_EXID.helpkey="Chip ID Extension Register" +AT91C_DBGU_EXID.access=memorymapped +AT91C_DBGU_EXID.address=0xFFFFF244 +AT91C_DBGU_EXID.width=32 +AT91C_DBGU_EXID.byteEndian=little +AT91C_DBGU_EXID.permission.write=none +AT91C_DBGU_BRGR.name="AT91C_DBGU_BRGR" +AT91C_DBGU_BRGR.description="Baud Rate Generator Register" +AT91C_DBGU_BRGR.helpkey="Baud Rate Generator Register" +AT91C_DBGU_BRGR.access=memorymapped +AT91C_DBGU_BRGR.address=0xFFFFF220 +AT91C_DBGU_BRGR.width=32 +AT91C_DBGU_BRGR.byteEndian=little +AT91C_DBGU_IDR.name="AT91C_DBGU_IDR" +AT91C_DBGU_IDR.description="Interrupt Disable Register" +AT91C_DBGU_IDR.helpkey="Interrupt Disable Register" +AT91C_DBGU_IDR.access=memorymapped +AT91C_DBGU_IDR.address=0xFFFFF20C +AT91C_DBGU_IDR.width=32 +AT91C_DBGU_IDR.byteEndian=little +AT91C_DBGU_IDR.type=enum +AT91C_DBGU_IDR.enum.0.name=*** Write only *** +AT91C_DBGU_IDR.enum.1.name=Error +AT91C_DBGU_CSR.name="AT91C_DBGU_CSR" +AT91C_DBGU_CSR.description="Channel Status Register" +AT91C_DBGU_CSR.helpkey="Channel Status Register" +AT91C_DBGU_CSR.access=memorymapped +AT91C_DBGU_CSR.address=0xFFFFF214 +AT91C_DBGU_CSR.width=32 +AT91C_DBGU_CSR.byteEndian=little +AT91C_DBGU_CSR.permission.write=none +AT91C_DBGU_CIDR.name="AT91C_DBGU_CIDR" +AT91C_DBGU_CIDR.description="Chip ID Register" +AT91C_DBGU_CIDR.helpkey="Chip ID Register" +AT91C_DBGU_CIDR.access=memorymapped +AT91C_DBGU_CIDR.address=0xFFFFF240 +AT91C_DBGU_CIDR.width=32 +AT91C_DBGU_CIDR.byteEndian=little +AT91C_DBGU_CIDR.permission.write=none +AT91C_DBGU_MR.name="AT91C_DBGU_MR" +AT91C_DBGU_MR.description="Mode Register" +AT91C_DBGU_MR.helpkey="Mode Register" +AT91C_DBGU_MR.access=memorymapped +AT91C_DBGU_MR.address=0xFFFFF204 +AT91C_DBGU_MR.width=32 +AT91C_DBGU_MR.byteEndian=little +AT91C_DBGU_IMR.name="AT91C_DBGU_IMR" +AT91C_DBGU_IMR.description="Interrupt Mask Register" +AT91C_DBGU_IMR.helpkey="Interrupt Mask Register" +AT91C_DBGU_IMR.access=memorymapped +AT91C_DBGU_IMR.address=0xFFFFF210 +AT91C_DBGU_IMR.width=32 +AT91C_DBGU_IMR.byteEndian=little +AT91C_DBGU_IMR.permission.write=none +AT91C_DBGU_CR.name="AT91C_DBGU_CR" +AT91C_DBGU_CR.description="Control Register" +AT91C_DBGU_CR.helpkey="Control Register" +AT91C_DBGU_CR.access=memorymapped +AT91C_DBGU_CR.address=0xFFFFF200 +AT91C_DBGU_CR.width=32 +AT91C_DBGU_CR.byteEndian=little +AT91C_DBGU_CR.type=enum +AT91C_DBGU_CR.enum.0.name=*** Write only *** +AT91C_DBGU_CR.enum.1.name=Error +AT91C_DBGU_FNTR.name="AT91C_DBGU_FNTR" +AT91C_DBGU_FNTR.description="Force NTRST Register" +AT91C_DBGU_FNTR.helpkey="Force NTRST Register" +AT91C_DBGU_FNTR.access=memorymapped +AT91C_DBGU_FNTR.address=0xFFFFF248 +AT91C_DBGU_FNTR.width=32 +AT91C_DBGU_FNTR.byteEndian=little +AT91C_DBGU_THR.name="AT91C_DBGU_THR" +AT91C_DBGU_THR.description="Transmitter Holding Register" +AT91C_DBGU_THR.helpkey="Transmitter Holding Register" +AT91C_DBGU_THR.access=memorymapped +AT91C_DBGU_THR.address=0xFFFFF21C +AT91C_DBGU_THR.width=32 +AT91C_DBGU_THR.byteEndian=little +AT91C_DBGU_THR.type=enum +AT91C_DBGU_THR.enum.0.name=*** Write only *** +AT91C_DBGU_THR.enum.1.name=Error +AT91C_DBGU_RHR.name="AT91C_DBGU_RHR" +AT91C_DBGU_RHR.description="Receiver Holding Register" +AT91C_DBGU_RHR.helpkey="Receiver Holding Register" +AT91C_DBGU_RHR.access=memorymapped +AT91C_DBGU_RHR.address=0xFFFFF218 +AT91C_DBGU_RHR.width=32 +AT91C_DBGU_RHR.byteEndian=little +AT91C_DBGU_RHR.permission.write=none +AT91C_DBGU_IER.name="AT91C_DBGU_IER" +AT91C_DBGU_IER.description="Interrupt Enable Register" +AT91C_DBGU_IER.helpkey="Interrupt Enable Register" +AT91C_DBGU_IER.access=memorymapped +AT91C_DBGU_IER.address=0xFFFFF208 +AT91C_DBGU_IER.width=32 +AT91C_DBGU_IER.byteEndian=little +AT91C_DBGU_IER.type=enum +AT91C_DBGU_IER.enum.0.name=*** Write only *** +AT91C_DBGU_IER.enum.1.name=Error +# ========== Register definition for PIOA peripheral ========== +AT91C_PIOA_ODR.name="AT91C_PIOA_ODR" +AT91C_PIOA_ODR.description="Output Disable Registerr" +AT91C_PIOA_ODR.helpkey="Output Disable Registerr" +AT91C_PIOA_ODR.access=memorymapped +AT91C_PIOA_ODR.address=0xFFFFF414 +AT91C_PIOA_ODR.width=32 +AT91C_PIOA_ODR.byteEndian=little +AT91C_PIOA_ODR.type=enum +AT91C_PIOA_ODR.enum.0.name=*** Write only *** +AT91C_PIOA_ODR.enum.1.name=Error +AT91C_PIOA_SODR.name="AT91C_PIOA_SODR" +AT91C_PIOA_SODR.description="Set Output Data Register" +AT91C_PIOA_SODR.helpkey="Set Output Data Register" +AT91C_PIOA_SODR.access=memorymapped +AT91C_PIOA_SODR.address=0xFFFFF430 +AT91C_PIOA_SODR.width=32 +AT91C_PIOA_SODR.byteEndian=little +AT91C_PIOA_SODR.type=enum +AT91C_PIOA_SODR.enum.0.name=*** Write only *** +AT91C_PIOA_SODR.enum.1.name=Error +AT91C_PIOA_ISR.name="AT91C_PIOA_ISR" +AT91C_PIOA_ISR.description="Interrupt Status Register" +AT91C_PIOA_ISR.helpkey="Interrupt Status Register" +AT91C_PIOA_ISR.access=memorymapped +AT91C_PIOA_ISR.address=0xFFFFF44C +AT91C_PIOA_ISR.width=32 +AT91C_PIOA_ISR.byteEndian=little +AT91C_PIOA_ISR.permission.write=none +AT91C_PIOA_ABSR.name="AT91C_PIOA_ABSR" +AT91C_PIOA_ABSR.description="AB Select Status Register" +AT91C_PIOA_ABSR.helpkey="AB Select Status Register" +AT91C_PIOA_ABSR.access=memorymapped +AT91C_PIOA_ABSR.address=0xFFFFF478 +AT91C_PIOA_ABSR.width=32 +AT91C_PIOA_ABSR.byteEndian=little +AT91C_PIOA_ABSR.permission.write=none +AT91C_PIOA_IER.name="AT91C_PIOA_IER" +AT91C_PIOA_IER.description="Interrupt Enable Register" +AT91C_PIOA_IER.helpkey="Interrupt Enable Register" +AT91C_PIOA_IER.access=memorymapped +AT91C_PIOA_IER.address=0xFFFFF440 +AT91C_PIOA_IER.width=32 +AT91C_PIOA_IER.byteEndian=little +AT91C_PIOA_IER.type=enum +AT91C_PIOA_IER.enum.0.name=*** Write only *** +AT91C_PIOA_IER.enum.1.name=Error +AT91C_PIOA_PPUDR.name="AT91C_PIOA_PPUDR" +AT91C_PIOA_PPUDR.description="Pull-up Disable Register" +AT91C_PIOA_PPUDR.helpkey="Pull-up Disable Register" +AT91C_PIOA_PPUDR.access=memorymapped +AT91C_PIOA_PPUDR.address=0xFFFFF460 +AT91C_PIOA_PPUDR.width=32 +AT91C_PIOA_PPUDR.byteEndian=little +AT91C_PIOA_PPUDR.type=enum +AT91C_PIOA_PPUDR.enum.0.name=*** Write only *** +AT91C_PIOA_PPUDR.enum.1.name=Error +AT91C_PIOA_IMR.name="AT91C_PIOA_IMR" +AT91C_PIOA_IMR.description="Interrupt Mask Register" +AT91C_PIOA_IMR.helpkey="Interrupt Mask Register" +AT91C_PIOA_IMR.access=memorymapped +AT91C_PIOA_IMR.address=0xFFFFF448 +AT91C_PIOA_IMR.width=32 +AT91C_PIOA_IMR.byteEndian=little +AT91C_PIOA_IMR.permission.write=none +AT91C_PIOA_PER.name="AT91C_PIOA_PER" +AT91C_PIOA_PER.description="PIO Enable Register" +AT91C_PIOA_PER.helpkey="PIO Enable Register" +AT91C_PIOA_PER.access=memorymapped +AT91C_PIOA_PER.address=0xFFFFF400 +AT91C_PIOA_PER.width=32 +AT91C_PIOA_PER.byteEndian=little +AT91C_PIOA_PER.type=enum +AT91C_PIOA_PER.enum.0.name=*** Write only *** +AT91C_PIOA_PER.enum.1.name=Error +AT91C_PIOA_IFDR.name="AT91C_PIOA_IFDR" +AT91C_PIOA_IFDR.description="Input Filter Disable Register" +AT91C_PIOA_IFDR.helpkey="Input Filter Disable Register" +AT91C_PIOA_IFDR.access=memorymapped +AT91C_PIOA_IFDR.address=0xFFFFF424 +AT91C_PIOA_IFDR.width=32 +AT91C_PIOA_IFDR.byteEndian=little +AT91C_PIOA_IFDR.type=enum +AT91C_PIOA_IFDR.enum.0.name=*** Write only *** +AT91C_PIOA_IFDR.enum.1.name=Error +AT91C_PIOA_OWDR.name="AT91C_PIOA_OWDR" +AT91C_PIOA_OWDR.description="Output Write Disable Register" +AT91C_PIOA_OWDR.helpkey="Output Write Disable Register" +AT91C_PIOA_OWDR.access=memorymapped +AT91C_PIOA_OWDR.address=0xFFFFF4A4 +AT91C_PIOA_OWDR.width=32 +AT91C_PIOA_OWDR.byteEndian=little +AT91C_PIOA_OWDR.type=enum +AT91C_PIOA_OWDR.enum.0.name=*** Write only *** +AT91C_PIOA_OWDR.enum.1.name=Error +AT91C_PIOA_MDSR.name="AT91C_PIOA_MDSR" +AT91C_PIOA_MDSR.description="Multi-driver Status Register" +AT91C_PIOA_MDSR.helpkey="Multi-driver Status Register" +AT91C_PIOA_MDSR.access=memorymapped +AT91C_PIOA_MDSR.address=0xFFFFF458 +AT91C_PIOA_MDSR.width=32 +AT91C_PIOA_MDSR.byteEndian=little +AT91C_PIOA_MDSR.permission.write=none +AT91C_PIOA_IDR.name="AT91C_PIOA_IDR" +AT91C_PIOA_IDR.description="Interrupt Disable Register" +AT91C_PIOA_IDR.helpkey="Interrupt Disable Register" +AT91C_PIOA_IDR.access=memorymapped +AT91C_PIOA_IDR.address=0xFFFFF444 +AT91C_PIOA_IDR.width=32 +AT91C_PIOA_IDR.byteEndian=little +AT91C_PIOA_IDR.type=enum +AT91C_PIOA_IDR.enum.0.name=*** Write only *** +AT91C_PIOA_IDR.enum.1.name=Error +AT91C_PIOA_ODSR.name="AT91C_PIOA_ODSR" +AT91C_PIOA_ODSR.description="Output Data Status Register" +AT91C_PIOA_ODSR.helpkey="Output Data Status Register" +AT91C_PIOA_ODSR.access=memorymapped +AT91C_PIOA_ODSR.address=0xFFFFF438 +AT91C_PIOA_ODSR.width=32 +AT91C_PIOA_ODSR.byteEndian=little +AT91C_PIOA_ODSR.permission.write=none +AT91C_PIOA_PPUSR.name="AT91C_PIOA_PPUSR" +AT91C_PIOA_PPUSR.description="Pull-up Status Register" +AT91C_PIOA_PPUSR.helpkey="Pull-up Status Register" +AT91C_PIOA_PPUSR.access=memorymapped +AT91C_PIOA_PPUSR.address=0xFFFFF468 +AT91C_PIOA_PPUSR.width=32 +AT91C_PIOA_PPUSR.byteEndian=little +AT91C_PIOA_PPUSR.permission.write=none +AT91C_PIOA_OWSR.name="AT91C_PIOA_OWSR" +AT91C_PIOA_OWSR.description="Output Write Status Register" +AT91C_PIOA_OWSR.helpkey="Output Write Status Register" +AT91C_PIOA_OWSR.access=memorymapped +AT91C_PIOA_OWSR.address=0xFFFFF4A8 +AT91C_PIOA_OWSR.width=32 +AT91C_PIOA_OWSR.byteEndian=little +AT91C_PIOA_OWSR.permission.write=none +AT91C_PIOA_BSR.name="AT91C_PIOA_BSR" +AT91C_PIOA_BSR.description="Select B Register" +AT91C_PIOA_BSR.helpkey="Select B Register" +AT91C_PIOA_BSR.access=memorymapped +AT91C_PIOA_BSR.address=0xFFFFF474 +AT91C_PIOA_BSR.width=32 +AT91C_PIOA_BSR.byteEndian=little +AT91C_PIOA_BSR.type=enum +AT91C_PIOA_BSR.enum.0.name=*** Write only *** +AT91C_PIOA_BSR.enum.1.name=Error +AT91C_PIOA_OWER.name="AT91C_PIOA_OWER" +AT91C_PIOA_OWER.description="Output Write Enable Register" +AT91C_PIOA_OWER.helpkey="Output Write Enable Register" +AT91C_PIOA_OWER.access=memorymapped +AT91C_PIOA_OWER.address=0xFFFFF4A0 +AT91C_PIOA_OWER.width=32 +AT91C_PIOA_OWER.byteEndian=little +AT91C_PIOA_OWER.type=enum +AT91C_PIOA_OWER.enum.0.name=*** Write only *** +AT91C_PIOA_OWER.enum.1.name=Error +AT91C_PIOA_IFER.name="AT91C_PIOA_IFER" +AT91C_PIOA_IFER.description="Input Filter Enable Register" +AT91C_PIOA_IFER.helpkey="Input Filter Enable Register" +AT91C_PIOA_IFER.access=memorymapped +AT91C_PIOA_IFER.address=0xFFFFF420 +AT91C_PIOA_IFER.width=32 +AT91C_PIOA_IFER.byteEndian=little +AT91C_PIOA_IFER.type=enum +AT91C_PIOA_IFER.enum.0.name=*** Write only *** +AT91C_PIOA_IFER.enum.1.name=Error +AT91C_PIOA_PDSR.name="AT91C_PIOA_PDSR" +AT91C_PIOA_PDSR.description="Pin Data Status Register" +AT91C_PIOA_PDSR.helpkey="Pin Data Status Register" +AT91C_PIOA_PDSR.access=memorymapped +AT91C_PIOA_PDSR.address=0xFFFFF43C +AT91C_PIOA_PDSR.width=32 +AT91C_PIOA_PDSR.byteEndian=little +AT91C_PIOA_PDSR.permission.write=none +AT91C_PIOA_PPUER.name="AT91C_PIOA_PPUER" +AT91C_PIOA_PPUER.description="Pull-up Enable Register" +AT91C_PIOA_PPUER.helpkey="Pull-up Enable Register" +AT91C_PIOA_PPUER.access=memorymapped +AT91C_PIOA_PPUER.address=0xFFFFF464 +AT91C_PIOA_PPUER.width=32 +AT91C_PIOA_PPUER.byteEndian=little +AT91C_PIOA_PPUER.type=enum +AT91C_PIOA_PPUER.enum.0.name=*** Write only *** +AT91C_PIOA_PPUER.enum.1.name=Error +AT91C_PIOA_OSR.name="AT91C_PIOA_OSR" +AT91C_PIOA_OSR.description="Output Status Register" +AT91C_PIOA_OSR.helpkey="Output Status Register" +AT91C_PIOA_OSR.access=memorymapped +AT91C_PIOA_OSR.address=0xFFFFF418 +AT91C_PIOA_OSR.width=32 +AT91C_PIOA_OSR.byteEndian=little +AT91C_PIOA_OSR.permission.write=none +AT91C_PIOA_ASR.name="AT91C_PIOA_ASR" +AT91C_PIOA_ASR.description="Select A Register" +AT91C_PIOA_ASR.helpkey="Select A Register" +AT91C_PIOA_ASR.access=memorymapped +AT91C_PIOA_ASR.address=0xFFFFF470 +AT91C_PIOA_ASR.width=32 +AT91C_PIOA_ASR.byteEndian=little +AT91C_PIOA_ASR.type=enum +AT91C_PIOA_ASR.enum.0.name=*** Write only *** +AT91C_PIOA_ASR.enum.1.name=Error +AT91C_PIOA_MDDR.name="AT91C_PIOA_MDDR" +AT91C_PIOA_MDDR.description="Multi-driver Disable Register" +AT91C_PIOA_MDDR.helpkey="Multi-driver Disable Register" +AT91C_PIOA_MDDR.access=memorymapped +AT91C_PIOA_MDDR.address=0xFFFFF454 +AT91C_PIOA_MDDR.width=32 +AT91C_PIOA_MDDR.byteEndian=little +AT91C_PIOA_MDDR.type=enum +AT91C_PIOA_MDDR.enum.0.name=*** Write only *** +AT91C_PIOA_MDDR.enum.1.name=Error +AT91C_PIOA_CODR.name="AT91C_PIOA_CODR" +AT91C_PIOA_CODR.description="Clear Output Data Register" +AT91C_PIOA_CODR.helpkey="Clear Output Data Register" +AT91C_PIOA_CODR.access=memorymapped +AT91C_PIOA_CODR.address=0xFFFFF434 +AT91C_PIOA_CODR.width=32 +AT91C_PIOA_CODR.byteEndian=little +AT91C_PIOA_CODR.type=enum +AT91C_PIOA_CODR.enum.0.name=*** Write only *** +AT91C_PIOA_CODR.enum.1.name=Error +AT91C_PIOA_MDER.name="AT91C_PIOA_MDER" +AT91C_PIOA_MDER.description="Multi-driver Enable Register" +AT91C_PIOA_MDER.helpkey="Multi-driver Enable Register" +AT91C_PIOA_MDER.access=memorymapped +AT91C_PIOA_MDER.address=0xFFFFF450 +AT91C_PIOA_MDER.width=32 +AT91C_PIOA_MDER.byteEndian=little +AT91C_PIOA_MDER.type=enum +AT91C_PIOA_MDER.enum.0.name=*** Write only *** +AT91C_PIOA_MDER.enum.1.name=Error +AT91C_PIOA_PDR.name="AT91C_PIOA_PDR" +AT91C_PIOA_PDR.description="PIO Disable Register" +AT91C_PIOA_PDR.helpkey="PIO Disable Register" +AT91C_PIOA_PDR.access=memorymapped +AT91C_PIOA_PDR.address=0xFFFFF404 +AT91C_PIOA_PDR.width=32 +AT91C_PIOA_PDR.byteEndian=little +AT91C_PIOA_PDR.type=enum +AT91C_PIOA_PDR.enum.0.name=*** Write only *** +AT91C_PIOA_PDR.enum.1.name=Error +AT91C_PIOA_IFSR.name="AT91C_PIOA_IFSR" +AT91C_PIOA_IFSR.description="Input Filter Status Register" +AT91C_PIOA_IFSR.helpkey="Input Filter Status Register" +AT91C_PIOA_IFSR.access=memorymapped +AT91C_PIOA_IFSR.address=0xFFFFF428 +AT91C_PIOA_IFSR.width=32 +AT91C_PIOA_IFSR.byteEndian=little +AT91C_PIOA_IFSR.permission.write=none +AT91C_PIOA_OER.name="AT91C_PIOA_OER" +AT91C_PIOA_OER.description="Output Enable Register" +AT91C_PIOA_OER.helpkey="Output Enable Register" +AT91C_PIOA_OER.access=memorymapped +AT91C_PIOA_OER.address=0xFFFFF410 +AT91C_PIOA_OER.width=32 +AT91C_PIOA_OER.byteEndian=little +AT91C_PIOA_OER.type=enum +AT91C_PIOA_OER.enum.0.name=*** Write only *** +AT91C_PIOA_OER.enum.1.name=Error +AT91C_PIOA_PSR.name="AT91C_PIOA_PSR" +AT91C_PIOA_PSR.description="PIO Status Register" +AT91C_PIOA_PSR.helpkey="PIO Status Register" +AT91C_PIOA_PSR.access=memorymapped +AT91C_PIOA_PSR.address=0xFFFFF408 +AT91C_PIOA_PSR.width=32 +AT91C_PIOA_PSR.byteEndian=little +AT91C_PIOA_PSR.permission.write=none +# ========== Register definition for PIOB peripheral ========== +AT91C_PIOB_OWDR.name="AT91C_PIOB_OWDR" +AT91C_PIOB_OWDR.description="Output Write Disable Register" +AT91C_PIOB_OWDR.helpkey="Output Write Disable Register" +AT91C_PIOB_OWDR.access=memorymapped +AT91C_PIOB_OWDR.address=0xFFFFF6A4 +AT91C_PIOB_OWDR.width=32 +AT91C_PIOB_OWDR.byteEndian=little +AT91C_PIOB_OWDR.type=enum +AT91C_PIOB_OWDR.enum.0.name=*** Write only *** +AT91C_PIOB_OWDR.enum.1.name=Error +AT91C_PIOB_MDER.name="AT91C_PIOB_MDER" +AT91C_PIOB_MDER.description="Multi-driver Enable Register" +AT91C_PIOB_MDER.helpkey="Multi-driver Enable Register" +AT91C_PIOB_MDER.access=memorymapped +AT91C_PIOB_MDER.address=0xFFFFF650 +AT91C_PIOB_MDER.width=32 +AT91C_PIOB_MDER.byteEndian=little +AT91C_PIOB_MDER.type=enum +AT91C_PIOB_MDER.enum.0.name=*** Write only *** +AT91C_PIOB_MDER.enum.1.name=Error +AT91C_PIOB_PPUSR.name="AT91C_PIOB_PPUSR" +AT91C_PIOB_PPUSR.description="Pull-up Status Register" +AT91C_PIOB_PPUSR.helpkey="Pull-up Status Register" +AT91C_PIOB_PPUSR.access=memorymapped +AT91C_PIOB_PPUSR.address=0xFFFFF668 +AT91C_PIOB_PPUSR.width=32 +AT91C_PIOB_PPUSR.byteEndian=little +AT91C_PIOB_PPUSR.permission.write=none +AT91C_PIOB_IMR.name="AT91C_PIOB_IMR" +AT91C_PIOB_IMR.description="Interrupt Mask Register" +AT91C_PIOB_IMR.helpkey="Interrupt Mask Register" +AT91C_PIOB_IMR.access=memorymapped +AT91C_PIOB_IMR.address=0xFFFFF648 +AT91C_PIOB_IMR.width=32 +AT91C_PIOB_IMR.byteEndian=little +AT91C_PIOB_IMR.permission.write=none +AT91C_PIOB_ASR.name="AT91C_PIOB_ASR" +AT91C_PIOB_ASR.description="Select A Register" +AT91C_PIOB_ASR.helpkey="Select A Register" +AT91C_PIOB_ASR.access=memorymapped +AT91C_PIOB_ASR.address=0xFFFFF670 +AT91C_PIOB_ASR.width=32 +AT91C_PIOB_ASR.byteEndian=little +AT91C_PIOB_ASR.type=enum +AT91C_PIOB_ASR.enum.0.name=*** Write only *** +AT91C_PIOB_ASR.enum.1.name=Error +AT91C_PIOB_PPUDR.name="AT91C_PIOB_PPUDR" +AT91C_PIOB_PPUDR.description="Pull-up Disable Register" +AT91C_PIOB_PPUDR.helpkey="Pull-up Disable Register" +AT91C_PIOB_PPUDR.access=memorymapped +AT91C_PIOB_PPUDR.address=0xFFFFF660 +AT91C_PIOB_PPUDR.width=32 +AT91C_PIOB_PPUDR.byteEndian=little +AT91C_PIOB_PPUDR.type=enum +AT91C_PIOB_PPUDR.enum.0.name=*** Write only *** +AT91C_PIOB_PPUDR.enum.1.name=Error +AT91C_PIOB_PSR.name="AT91C_PIOB_PSR" +AT91C_PIOB_PSR.description="PIO Status Register" +AT91C_PIOB_PSR.helpkey="PIO Status Register" +AT91C_PIOB_PSR.access=memorymapped +AT91C_PIOB_PSR.address=0xFFFFF608 +AT91C_PIOB_PSR.width=32 +AT91C_PIOB_PSR.byteEndian=little +AT91C_PIOB_PSR.permission.write=none +AT91C_PIOB_IER.name="AT91C_PIOB_IER" +AT91C_PIOB_IER.description="Interrupt Enable Register" +AT91C_PIOB_IER.helpkey="Interrupt Enable Register" +AT91C_PIOB_IER.access=memorymapped +AT91C_PIOB_IER.address=0xFFFFF640 +AT91C_PIOB_IER.width=32 +AT91C_PIOB_IER.byteEndian=little +AT91C_PIOB_IER.type=enum +AT91C_PIOB_IER.enum.0.name=*** Write only *** +AT91C_PIOB_IER.enum.1.name=Error +AT91C_PIOB_CODR.name="AT91C_PIOB_CODR" +AT91C_PIOB_CODR.description="Clear Output Data Register" +AT91C_PIOB_CODR.helpkey="Clear Output Data Register" +AT91C_PIOB_CODR.access=memorymapped +AT91C_PIOB_CODR.address=0xFFFFF634 +AT91C_PIOB_CODR.width=32 +AT91C_PIOB_CODR.byteEndian=little +AT91C_PIOB_CODR.type=enum +AT91C_PIOB_CODR.enum.0.name=*** Write only *** +AT91C_PIOB_CODR.enum.1.name=Error +AT91C_PIOB_OWER.name="AT91C_PIOB_OWER" +AT91C_PIOB_OWER.description="Output Write Enable Register" +AT91C_PIOB_OWER.helpkey="Output Write Enable Register" +AT91C_PIOB_OWER.access=memorymapped +AT91C_PIOB_OWER.address=0xFFFFF6A0 +AT91C_PIOB_OWER.width=32 +AT91C_PIOB_OWER.byteEndian=little +AT91C_PIOB_OWER.type=enum +AT91C_PIOB_OWER.enum.0.name=*** Write only *** +AT91C_PIOB_OWER.enum.1.name=Error +AT91C_PIOB_ABSR.name="AT91C_PIOB_ABSR" +AT91C_PIOB_ABSR.description="AB Select Status Register" +AT91C_PIOB_ABSR.helpkey="AB Select Status Register" +AT91C_PIOB_ABSR.access=memorymapped +AT91C_PIOB_ABSR.address=0xFFFFF678 +AT91C_PIOB_ABSR.width=32 +AT91C_PIOB_ABSR.byteEndian=little +AT91C_PIOB_ABSR.permission.write=none +AT91C_PIOB_IFDR.name="AT91C_PIOB_IFDR" +AT91C_PIOB_IFDR.description="Input Filter Disable Register" +AT91C_PIOB_IFDR.helpkey="Input Filter Disable Register" +AT91C_PIOB_IFDR.access=memorymapped +AT91C_PIOB_IFDR.address=0xFFFFF624 +AT91C_PIOB_IFDR.width=32 +AT91C_PIOB_IFDR.byteEndian=little +AT91C_PIOB_IFDR.type=enum +AT91C_PIOB_IFDR.enum.0.name=*** Write only *** +AT91C_PIOB_IFDR.enum.1.name=Error +AT91C_PIOB_PDSR.name="AT91C_PIOB_PDSR" +AT91C_PIOB_PDSR.description="Pin Data Status Register" +AT91C_PIOB_PDSR.helpkey="Pin Data Status Register" +AT91C_PIOB_PDSR.access=memorymapped +AT91C_PIOB_PDSR.address=0xFFFFF63C +AT91C_PIOB_PDSR.width=32 +AT91C_PIOB_PDSR.byteEndian=little +AT91C_PIOB_PDSR.permission.write=none +AT91C_PIOB_IDR.name="AT91C_PIOB_IDR" +AT91C_PIOB_IDR.description="Interrupt Disable Register" +AT91C_PIOB_IDR.helpkey="Interrupt Disable Register" +AT91C_PIOB_IDR.access=memorymapped +AT91C_PIOB_IDR.address=0xFFFFF644 +AT91C_PIOB_IDR.width=32 +AT91C_PIOB_IDR.byteEndian=little +AT91C_PIOB_IDR.type=enum +AT91C_PIOB_IDR.enum.0.name=*** Write only *** +AT91C_PIOB_IDR.enum.1.name=Error +AT91C_PIOB_OWSR.name="AT91C_PIOB_OWSR" +AT91C_PIOB_OWSR.description="Output Write Status Register" +AT91C_PIOB_OWSR.helpkey="Output Write Status Register" +AT91C_PIOB_OWSR.access=memorymapped +AT91C_PIOB_OWSR.address=0xFFFFF6A8 +AT91C_PIOB_OWSR.width=32 +AT91C_PIOB_OWSR.byteEndian=little +AT91C_PIOB_OWSR.permission.write=none +AT91C_PIOB_PDR.name="AT91C_PIOB_PDR" +AT91C_PIOB_PDR.description="PIO Disable Register" +AT91C_PIOB_PDR.helpkey="PIO Disable Register" +AT91C_PIOB_PDR.access=memorymapped +AT91C_PIOB_PDR.address=0xFFFFF604 +AT91C_PIOB_PDR.width=32 +AT91C_PIOB_PDR.byteEndian=little +AT91C_PIOB_PDR.type=enum +AT91C_PIOB_PDR.enum.0.name=*** Write only *** +AT91C_PIOB_PDR.enum.1.name=Error +AT91C_PIOB_ODR.name="AT91C_PIOB_ODR" +AT91C_PIOB_ODR.description="Output Disable Registerr" +AT91C_PIOB_ODR.helpkey="Output Disable Registerr" +AT91C_PIOB_ODR.access=memorymapped +AT91C_PIOB_ODR.address=0xFFFFF614 +AT91C_PIOB_ODR.width=32 +AT91C_PIOB_ODR.byteEndian=little +AT91C_PIOB_ODR.type=enum +AT91C_PIOB_ODR.enum.0.name=*** Write only *** +AT91C_PIOB_ODR.enum.1.name=Error +AT91C_PIOB_IFSR.name="AT91C_PIOB_IFSR" +AT91C_PIOB_IFSR.description="Input Filter Status Register" +AT91C_PIOB_IFSR.helpkey="Input Filter Status Register" +AT91C_PIOB_IFSR.access=memorymapped +AT91C_PIOB_IFSR.address=0xFFFFF628 +AT91C_PIOB_IFSR.width=32 +AT91C_PIOB_IFSR.byteEndian=little +AT91C_PIOB_IFSR.permission.write=none +AT91C_PIOB_PPUER.name="AT91C_PIOB_PPUER" +AT91C_PIOB_PPUER.description="Pull-up Enable Register" +AT91C_PIOB_PPUER.helpkey="Pull-up Enable Register" +AT91C_PIOB_PPUER.access=memorymapped +AT91C_PIOB_PPUER.address=0xFFFFF664 +AT91C_PIOB_PPUER.width=32 +AT91C_PIOB_PPUER.byteEndian=little +AT91C_PIOB_PPUER.type=enum +AT91C_PIOB_PPUER.enum.0.name=*** Write only *** +AT91C_PIOB_PPUER.enum.1.name=Error +AT91C_PIOB_SODR.name="AT91C_PIOB_SODR" +AT91C_PIOB_SODR.description="Set Output Data Register" +AT91C_PIOB_SODR.helpkey="Set Output Data Register" +AT91C_PIOB_SODR.access=memorymapped +AT91C_PIOB_SODR.address=0xFFFFF630 +AT91C_PIOB_SODR.width=32 +AT91C_PIOB_SODR.byteEndian=little +AT91C_PIOB_SODR.type=enum +AT91C_PIOB_SODR.enum.0.name=*** Write only *** +AT91C_PIOB_SODR.enum.1.name=Error +AT91C_PIOB_ISR.name="AT91C_PIOB_ISR" +AT91C_PIOB_ISR.description="Interrupt Status Register" +AT91C_PIOB_ISR.helpkey="Interrupt Status Register" +AT91C_PIOB_ISR.access=memorymapped +AT91C_PIOB_ISR.address=0xFFFFF64C +AT91C_PIOB_ISR.width=32 +AT91C_PIOB_ISR.byteEndian=little +AT91C_PIOB_ISR.permission.write=none +AT91C_PIOB_ODSR.name="AT91C_PIOB_ODSR" +AT91C_PIOB_ODSR.description="Output Data Status Register" +AT91C_PIOB_ODSR.helpkey="Output Data Status Register" +AT91C_PIOB_ODSR.access=memorymapped +AT91C_PIOB_ODSR.address=0xFFFFF638 +AT91C_PIOB_ODSR.width=32 +AT91C_PIOB_ODSR.byteEndian=little +AT91C_PIOB_ODSR.permission.write=none +AT91C_PIOB_OSR.name="AT91C_PIOB_OSR" +AT91C_PIOB_OSR.description="Output Status Register" +AT91C_PIOB_OSR.helpkey="Output Status Register" +AT91C_PIOB_OSR.access=memorymapped +AT91C_PIOB_OSR.address=0xFFFFF618 +AT91C_PIOB_OSR.width=32 +AT91C_PIOB_OSR.byteEndian=little +AT91C_PIOB_OSR.permission.write=none +AT91C_PIOB_MDSR.name="AT91C_PIOB_MDSR" +AT91C_PIOB_MDSR.description="Multi-driver Status Register" +AT91C_PIOB_MDSR.helpkey="Multi-driver Status Register" +AT91C_PIOB_MDSR.access=memorymapped +AT91C_PIOB_MDSR.address=0xFFFFF658 +AT91C_PIOB_MDSR.width=32 +AT91C_PIOB_MDSR.byteEndian=little +AT91C_PIOB_MDSR.permission.write=none +AT91C_PIOB_IFER.name="AT91C_PIOB_IFER" +AT91C_PIOB_IFER.description="Input Filter Enable Register" +AT91C_PIOB_IFER.helpkey="Input Filter Enable Register" +AT91C_PIOB_IFER.access=memorymapped +AT91C_PIOB_IFER.address=0xFFFFF620 +AT91C_PIOB_IFER.width=32 +AT91C_PIOB_IFER.byteEndian=little +AT91C_PIOB_IFER.type=enum +AT91C_PIOB_IFER.enum.0.name=*** Write only *** +AT91C_PIOB_IFER.enum.1.name=Error +AT91C_PIOB_BSR.name="AT91C_PIOB_BSR" +AT91C_PIOB_BSR.description="Select B Register" +AT91C_PIOB_BSR.helpkey="Select B Register" +AT91C_PIOB_BSR.access=memorymapped +AT91C_PIOB_BSR.address=0xFFFFF674 +AT91C_PIOB_BSR.width=32 +AT91C_PIOB_BSR.byteEndian=little +AT91C_PIOB_BSR.type=enum +AT91C_PIOB_BSR.enum.0.name=*** Write only *** +AT91C_PIOB_BSR.enum.1.name=Error +AT91C_PIOB_MDDR.name="AT91C_PIOB_MDDR" +AT91C_PIOB_MDDR.description="Multi-driver Disable Register" +AT91C_PIOB_MDDR.helpkey="Multi-driver Disable Register" +AT91C_PIOB_MDDR.access=memorymapped +AT91C_PIOB_MDDR.address=0xFFFFF654 +AT91C_PIOB_MDDR.width=32 +AT91C_PIOB_MDDR.byteEndian=little +AT91C_PIOB_MDDR.type=enum +AT91C_PIOB_MDDR.enum.0.name=*** Write only *** +AT91C_PIOB_MDDR.enum.1.name=Error +AT91C_PIOB_OER.name="AT91C_PIOB_OER" +AT91C_PIOB_OER.description="Output Enable Register" +AT91C_PIOB_OER.helpkey="Output Enable Register" +AT91C_PIOB_OER.access=memorymapped +AT91C_PIOB_OER.address=0xFFFFF610 +AT91C_PIOB_OER.width=32 +AT91C_PIOB_OER.byteEndian=little +AT91C_PIOB_OER.type=enum +AT91C_PIOB_OER.enum.0.name=*** Write only *** +AT91C_PIOB_OER.enum.1.name=Error +AT91C_PIOB_PER.name="AT91C_PIOB_PER" +AT91C_PIOB_PER.description="PIO Enable Register" +AT91C_PIOB_PER.helpkey="PIO Enable Register" +AT91C_PIOB_PER.access=memorymapped +AT91C_PIOB_PER.address=0xFFFFF600 +AT91C_PIOB_PER.width=32 +AT91C_PIOB_PER.byteEndian=little +AT91C_PIOB_PER.type=enum +AT91C_PIOB_PER.enum.0.name=*** Write only *** +AT91C_PIOB_PER.enum.1.name=Error +# ========== Register definition for CKGR peripheral ========== +AT91C_CKGR_MOR.name="AT91C_CKGR_MOR" +AT91C_CKGR_MOR.description="Main Oscillator Register" +AT91C_CKGR_MOR.helpkey="Main Oscillator Register" +AT91C_CKGR_MOR.access=memorymapped +AT91C_CKGR_MOR.address=0xFFFFFC20 +AT91C_CKGR_MOR.width=32 +AT91C_CKGR_MOR.byteEndian=little +AT91C_CKGR_PLLR.name="AT91C_CKGR_PLLR" +AT91C_CKGR_PLLR.description="PLL Register" +AT91C_CKGR_PLLR.helpkey="PLL Register" +AT91C_CKGR_PLLR.access=memorymapped +AT91C_CKGR_PLLR.address=0xFFFFFC2C +AT91C_CKGR_PLLR.width=32 +AT91C_CKGR_PLLR.byteEndian=little +AT91C_CKGR_MCFR.name="AT91C_CKGR_MCFR" +AT91C_CKGR_MCFR.description="Main Clock Frequency Register" +AT91C_CKGR_MCFR.helpkey="Main Clock Frequency Register" +AT91C_CKGR_MCFR.access=memorymapped +AT91C_CKGR_MCFR.address=0xFFFFFC24 +AT91C_CKGR_MCFR.width=32 +AT91C_CKGR_MCFR.byteEndian=little +AT91C_CKGR_MCFR.permission.write=none +# ========== Register definition for PMC peripheral ========== +AT91C_PMC_IDR.name="AT91C_PMC_IDR" +AT91C_PMC_IDR.description="Interrupt Disable Register" +AT91C_PMC_IDR.helpkey="Interrupt Disable Register" +AT91C_PMC_IDR.access=memorymapped +AT91C_PMC_IDR.address=0xFFFFFC64 +AT91C_PMC_IDR.width=32 +AT91C_PMC_IDR.byteEndian=little +AT91C_PMC_IDR.type=enum +AT91C_PMC_IDR.enum.0.name=*** Write only *** +AT91C_PMC_IDR.enum.1.name=Error +AT91C_PMC_MOR.name="AT91C_PMC_MOR" +AT91C_PMC_MOR.description="Main Oscillator Register" +AT91C_PMC_MOR.helpkey="Main Oscillator Register" +AT91C_PMC_MOR.access=memorymapped +AT91C_PMC_MOR.address=0xFFFFFC20 +AT91C_PMC_MOR.width=32 +AT91C_PMC_MOR.byteEndian=little +AT91C_PMC_PLLR.name="AT91C_PMC_PLLR" +AT91C_PMC_PLLR.description="PLL Register" +AT91C_PMC_PLLR.helpkey="PLL Register" +AT91C_PMC_PLLR.access=memorymapped +AT91C_PMC_PLLR.address=0xFFFFFC2C +AT91C_PMC_PLLR.width=32 +AT91C_PMC_PLLR.byteEndian=little +AT91C_PMC_PCER.name="AT91C_PMC_PCER" +AT91C_PMC_PCER.description="Peripheral Clock Enable Register" +AT91C_PMC_PCER.helpkey="Peripheral Clock Enable Register" +AT91C_PMC_PCER.access=memorymapped +AT91C_PMC_PCER.address=0xFFFFFC10 +AT91C_PMC_PCER.width=32 +AT91C_PMC_PCER.byteEndian=little +AT91C_PMC_PCER.type=enum +AT91C_PMC_PCER.enum.0.name=*** Write only *** +AT91C_PMC_PCER.enum.1.name=Error +AT91C_PMC_PCKR.name="AT91C_PMC_PCKR" +AT91C_PMC_PCKR.description="Programmable Clock Register" +AT91C_PMC_PCKR.helpkey="Programmable Clock Register" +AT91C_PMC_PCKR.access=memorymapped +AT91C_PMC_PCKR.address=0xFFFFFC40 +AT91C_PMC_PCKR.width=32 +AT91C_PMC_PCKR.byteEndian=little +AT91C_PMC_MCKR.name="AT91C_PMC_MCKR" +AT91C_PMC_MCKR.description="Master Clock Register" +AT91C_PMC_MCKR.helpkey="Master Clock Register" +AT91C_PMC_MCKR.access=memorymapped +AT91C_PMC_MCKR.address=0xFFFFFC30 +AT91C_PMC_MCKR.width=32 +AT91C_PMC_MCKR.byteEndian=little +AT91C_PMC_SCDR.name="AT91C_PMC_SCDR" +AT91C_PMC_SCDR.description="System Clock Disable Register" +AT91C_PMC_SCDR.helpkey="System Clock Disable Register" +AT91C_PMC_SCDR.access=memorymapped +AT91C_PMC_SCDR.address=0xFFFFFC04 +AT91C_PMC_SCDR.width=32 +AT91C_PMC_SCDR.byteEndian=little +AT91C_PMC_SCDR.type=enum +AT91C_PMC_SCDR.enum.0.name=*** Write only *** +AT91C_PMC_SCDR.enum.1.name=Error +AT91C_PMC_PCDR.name="AT91C_PMC_PCDR" +AT91C_PMC_PCDR.description="Peripheral Clock Disable Register" +AT91C_PMC_PCDR.helpkey="Peripheral Clock Disable Register" +AT91C_PMC_PCDR.access=memorymapped +AT91C_PMC_PCDR.address=0xFFFFFC14 +AT91C_PMC_PCDR.width=32 +AT91C_PMC_PCDR.byteEndian=little +AT91C_PMC_PCDR.type=enum +AT91C_PMC_PCDR.enum.0.name=*** Write only *** +AT91C_PMC_PCDR.enum.1.name=Error +AT91C_PMC_SCSR.name="AT91C_PMC_SCSR" +AT91C_PMC_SCSR.description="System Clock Status Register" +AT91C_PMC_SCSR.helpkey="System Clock Status Register" +AT91C_PMC_SCSR.access=memorymapped +AT91C_PMC_SCSR.address=0xFFFFFC08 +AT91C_PMC_SCSR.width=32 +AT91C_PMC_SCSR.byteEndian=little +AT91C_PMC_SCSR.permission.write=none +AT91C_PMC_PCSR.name="AT91C_PMC_PCSR" +AT91C_PMC_PCSR.description="Peripheral Clock Status Register" +AT91C_PMC_PCSR.helpkey="Peripheral Clock Status Register" +AT91C_PMC_PCSR.access=memorymapped +AT91C_PMC_PCSR.address=0xFFFFFC18 +AT91C_PMC_PCSR.width=32 +AT91C_PMC_PCSR.byteEndian=little +AT91C_PMC_PCSR.permission.write=none +AT91C_PMC_MCFR.name="AT91C_PMC_MCFR" +AT91C_PMC_MCFR.description="Main Clock Frequency Register" +AT91C_PMC_MCFR.helpkey="Main Clock Frequency Register" +AT91C_PMC_MCFR.access=memorymapped +AT91C_PMC_MCFR.address=0xFFFFFC24 +AT91C_PMC_MCFR.width=32 +AT91C_PMC_MCFR.byteEndian=little +AT91C_PMC_MCFR.permission.write=none +AT91C_PMC_SCER.name="AT91C_PMC_SCER" +AT91C_PMC_SCER.description="System Clock Enable Register" +AT91C_PMC_SCER.helpkey="System Clock Enable Register" +AT91C_PMC_SCER.access=memorymapped +AT91C_PMC_SCER.address=0xFFFFFC00 +AT91C_PMC_SCER.width=32 +AT91C_PMC_SCER.byteEndian=little +AT91C_PMC_SCER.type=enum +AT91C_PMC_SCER.enum.0.name=*** Write only *** +AT91C_PMC_SCER.enum.1.name=Error +AT91C_PMC_IMR.name="AT91C_PMC_IMR" +AT91C_PMC_IMR.description="Interrupt Mask Register" +AT91C_PMC_IMR.helpkey="Interrupt Mask Register" +AT91C_PMC_IMR.access=memorymapped +AT91C_PMC_IMR.address=0xFFFFFC6C +AT91C_PMC_IMR.width=32 +AT91C_PMC_IMR.byteEndian=little +AT91C_PMC_IMR.permission.write=none +AT91C_PMC_IER.name="AT91C_PMC_IER" +AT91C_PMC_IER.description="Interrupt Enable Register" +AT91C_PMC_IER.helpkey="Interrupt Enable Register" +AT91C_PMC_IER.access=memorymapped +AT91C_PMC_IER.address=0xFFFFFC60 +AT91C_PMC_IER.width=32 +AT91C_PMC_IER.byteEndian=little +AT91C_PMC_IER.type=enum +AT91C_PMC_IER.enum.0.name=*** Write only *** +AT91C_PMC_IER.enum.1.name=Error +AT91C_PMC_SR.name="AT91C_PMC_SR" +AT91C_PMC_SR.description="Status Register" +AT91C_PMC_SR.helpkey="Status Register" +AT91C_PMC_SR.access=memorymapped +AT91C_PMC_SR.address=0xFFFFFC68 +AT91C_PMC_SR.width=32 +AT91C_PMC_SR.byteEndian=little +AT91C_PMC_SR.permission.write=none +# ========== Register definition for RSTC peripheral ========== +AT91C_RSTC_RCR.name="AT91C_RSTC_RCR" +AT91C_RSTC_RCR.description="Reset Control Register" +AT91C_RSTC_RCR.helpkey="Reset Control Register" +AT91C_RSTC_RCR.access=memorymapped +AT91C_RSTC_RCR.address=0xFFFFFD00 +AT91C_RSTC_RCR.width=32 +AT91C_RSTC_RCR.byteEndian=little +AT91C_RSTC_RCR.type=enum +AT91C_RSTC_RCR.enum.0.name=*** Write only *** +AT91C_RSTC_RCR.enum.1.name=Error +AT91C_RSTC_RMR.name="AT91C_RSTC_RMR" +AT91C_RSTC_RMR.description="Reset Mode Register" +AT91C_RSTC_RMR.helpkey="Reset Mode Register" +AT91C_RSTC_RMR.access=memorymapped +AT91C_RSTC_RMR.address=0xFFFFFD08 +AT91C_RSTC_RMR.width=32 +AT91C_RSTC_RMR.byteEndian=little +AT91C_RSTC_RSR.name="AT91C_RSTC_RSR" +AT91C_RSTC_RSR.description="Reset Status Register" +AT91C_RSTC_RSR.helpkey="Reset Status Register" +AT91C_RSTC_RSR.access=memorymapped +AT91C_RSTC_RSR.address=0xFFFFFD04 +AT91C_RSTC_RSR.width=32 +AT91C_RSTC_RSR.byteEndian=little +AT91C_RSTC_RSR.permission.write=none +# ========== Register definition for RTTC peripheral ========== +AT91C_RTTC_RTSR.name="AT91C_RTTC_RTSR" +AT91C_RTTC_RTSR.description="Real-time Status Register" +AT91C_RTTC_RTSR.helpkey="Real-time Status Register" +AT91C_RTTC_RTSR.access=memorymapped +AT91C_RTTC_RTSR.address=0xFFFFFD2C +AT91C_RTTC_RTSR.width=32 +AT91C_RTTC_RTSR.byteEndian=little +AT91C_RTTC_RTSR.permission.write=none +AT91C_RTTC_RTMR.name="AT91C_RTTC_RTMR" +AT91C_RTTC_RTMR.description="Real-time Mode Register" +AT91C_RTTC_RTMR.helpkey="Real-time Mode Register" +AT91C_RTTC_RTMR.access=memorymapped +AT91C_RTTC_RTMR.address=0xFFFFFD20 +AT91C_RTTC_RTMR.width=32 +AT91C_RTTC_RTMR.byteEndian=little +AT91C_RTTC_RTVR.name="AT91C_RTTC_RTVR" +AT91C_RTTC_RTVR.description="Real-time Value Register" +AT91C_RTTC_RTVR.helpkey="Real-time Value Register" +AT91C_RTTC_RTVR.access=memorymapped +AT91C_RTTC_RTVR.address=0xFFFFFD28 +AT91C_RTTC_RTVR.width=32 +AT91C_RTTC_RTVR.byteEndian=little +AT91C_RTTC_RTVR.permission.write=none +AT91C_RTTC_RTAR.name="AT91C_RTTC_RTAR" +AT91C_RTTC_RTAR.description="Real-time Alarm Register" +AT91C_RTTC_RTAR.helpkey="Real-time Alarm Register" +AT91C_RTTC_RTAR.access=memorymapped +AT91C_RTTC_RTAR.address=0xFFFFFD24 +AT91C_RTTC_RTAR.width=32 +AT91C_RTTC_RTAR.byteEndian=little +# ========== Register definition for PITC peripheral ========== +AT91C_PITC_PIVR.name="AT91C_PITC_PIVR" +AT91C_PITC_PIVR.description="Period Interval Value Register" +AT91C_PITC_PIVR.helpkey="Period Interval Value Register" +AT91C_PITC_PIVR.access=memorymapped +AT91C_PITC_PIVR.address=0xFFFFFD38 +AT91C_PITC_PIVR.width=32 +AT91C_PITC_PIVR.byteEndian=little +AT91C_PITC_PIVR.permission.write=none +AT91C_PITC_PISR.name="AT91C_PITC_PISR" +AT91C_PITC_PISR.description="Period Interval Status Register" +AT91C_PITC_PISR.helpkey="Period Interval Status Register" +AT91C_PITC_PISR.access=memorymapped +AT91C_PITC_PISR.address=0xFFFFFD34 +AT91C_PITC_PISR.width=32 +AT91C_PITC_PISR.byteEndian=little +AT91C_PITC_PISR.permission.write=none +AT91C_PITC_PIIR.name="AT91C_PITC_PIIR" +AT91C_PITC_PIIR.description="Period Interval Image Register" +AT91C_PITC_PIIR.helpkey="Period Interval Image Register" +AT91C_PITC_PIIR.access=memorymapped +AT91C_PITC_PIIR.address=0xFFFFFD3C +AT91C_PITC_PIIR.width=32 +AT91C_PITC_PIIR.byteEndian=little +AT91C_PITC_PIIR.permission.write=none +AT91C_PITC_PIMR.name="AT91C_PITC_PIMR" +AT91C_PITC_PIMR.description="Period Interval Mode Register" +AT91C_PITC_PIMR.helpkey="Period Interval Mode Register" +AT91C_PITC_PIMR.access=memorymapped +AT91C_PITC_PIMR.address=0xFFFFFD30 +AT91C_PITC_PIMR.width=32 +AT91C_PITC_PIMR.byteEndian=little +# ========== Register definition for WDTC peripheral ========== +AT91C_WDTC_WDCR.name="AT91C_WDTC_WDCR" +AT91C_WDTC_WDCR.description="Watchdog Control Register" +AT91C_WDTC_WDCR.helpkey="Watchdog Control Register" +AT91C_WDTC_WDCR.access=memorymapped +AT91C_WDTC_WDCR.address=0xFFFFFD40 +AT91C_WDTC_WDCR.width=32 +AT91C_WDTC_WDCR.byteEndian=little +AT91C_WDTC_WDCR.type=enum +AT91C_WDTC_WDCR.enum.0.name=*** Write only *** +AT91C_WDTC_WDCR.enum.1.name=Error +AT91C_WDTC_WDSR.name="AT91C_WDTC_WDSR" +AT91C_WDTC_WDSR.description="Watchdog Status Register" +AT91C_WDTC_WDSR.helpkey="Watchdog Status Register" +AT91C_WDTC_WDSR.access=memorymapped +AT91C_WDTC_WDSR.address=0xFFFFFD48 +AT91C_WDTC_WDSR.width=32 +AT91C_WDTC_WDSR.byteEndian=little +AT91C_WDTC_WDSR.permission.write=none +AT91C_WDTC_WDMR.name="AT91C_WDTC_WDMR" +AT91C_WDTC_WDMR.description="Watchdog Mode Register" +AT91C_WDTC_WDMR.helpkey="Watchdog Mode Register" +AT91C_WDTC_WDMR.access=memorymapped +AT91C_WDTC_WDMR.address=0xFFFFFD44 +AT91C_WDTC_WDMR.width=32 +AT91C_WDTC_WDMR.byteEndian=little +# ========== Register definition for VREG peripheral ========== +AT91C_VREG_MR.name="AT91C_VREG_MR" +AT91C_VREG_MR.description="Voltage Regulator Mode Register" +AT91C_VREG_MR.helpkey="Voltage Regulator Mode Register" +AT91C_VREG_MR.access=memorymapped +AT91C_VREG_MR.address=0xFFFFFD60 +AT91C_VREG_MR.width=32 +AT91C_VREG_MR.byteEndian=little +# ========== Register definition for MC peripheral ========== +AT91C_MC_ASR.name="AT91C_MC_ASR" +AT91C_MC_ASR.description="MC Abort Status Register" +AT91C_MC_ASR.helpkey="MC Abort Status Register" +AT91C_MC_ASR.access=memorymapped +AT91C_MC_ASR.address=0xFFFFFF04 +AT91C_MC_ASR.width=32 +AT91C_MC_ASR.byteEndian=little +AT91C_MC_ASR.permission.write=none +AT91C_MC_RCR.name="AT91C_MC_RCR" +AT91C_MC_RCR.description="MC Remap Control Register" +AT91C_MC_RCR.helpkey="MC Remap Control Register" +AT91C_MC_RCR.access=memorymapped +AT91C_MC_RCR.address=0xFFFFFF00 +AT91C_MC_RCR.width=32 +AT91C_MC_RCR.byteEndian=little +AT91C_MC_RCR.type=enum +AT91C_MC_RCR.enum.0.name=*** Write only *** +AT91C_MC_RCR.enum.1.name=Error +AT91C_MC_FCR.name="AT91C_MC_FCR" +AT91C_MC_FCR.description="MC Flash Command Register" +AT91C_MC_FCR.helpkey="MC Flash Command Register" +AT91C_MC_FCR.access=memorymapped +AT91C_MC_FCR.address=0xFFFFFF64 +AT91C_MC_FCR.width=32 +AT91C_MC_FCR.byteEndian=little +AT91C_MC_FCR.type=enum +AT91C_MC_FCR.enum.0.name=*** Write only *** +AT91C_MC_FCR.enum.1.name=Error +AT91C_MC_AASR.name="AT91C_MC_AASR" +AT91C_MC_AASR.description="MC Abort Address Status Register" +AT91C_MC_AASR.helpkey="MC Abort Address Status Register" +AT91C_MC_AASR.access=memorymapped +AT91C_MC_AASR.address=0xFFFFFF08 +AT91C_MC_AASR.width=32 +AT91C_MC_AASR.byteEndian=little +AT91C_MC_AASR.permission.write=none +AT91C_MC_FSR.name="AT91C_MC_FSR" +AT91C_MC_FSR.description="MC Flash Status Register" +AT91C_MC_FSR.helpkey="MC Flash Status Register" +AT91C_MC_FSR.access=memorymapped +AT91C_MC_FSR.address=0xFFFFFF68 +AT91C_MC_FSR.width=32 +AT91C_MC_FSR.byteEndian=little +AT91C_MC_FSR.permission.write=none +AT91C_MC_FMR.name="AT91C_MC_FMR" +AT91C_MC_FMR.description="MC Flash Mode Register" +AT91C_MC_FMR.helpkey="MC Flash Mode Register" +AT91C_MC_FMR.access=memorymapped +AT91C_MC_FMR.address=0xFFFFFF60 +AT91C_MC_FMR.width=32 +AT91C_MC_FMR.byteEndian=little +# ========== Register definition for PDC_SPI1 peripheral ========== +AT91C_SPI1_PTCR.name="AT91C_SPI1_PTCR" +AT91C_SPI1_PTCR.description="PDC Transfer Control Register" +AT91C_SPI1_PTCR.helpkey="PDC Transfer Control Register" +AT91C_SPI1_PTCR.access=memorymapped +AT91C_SPI1_PTCR.address=0xFFFE4120 +AT91C_SPI1_PTCR.width=32 +AT91C_SPI1_PTCR.byteEndian=little +AT91C_SPI1_PTCR.type=enum +AT91C_SPI1_PTCR.enum.0.name=*** Write only *** +AT91C_SPI1_PTCR.enum.1.name=Error +AT91C_SPI1_RPR.name="AT91C_SPI1_RPR" +AT91C_SPI1_RPR.description="Receive Pointer Register" +AT91C_SPI1_RPR.helpkey="Receive Pointer Register" +AT91C_SPI1_RPR.access=memorymapped +AT91C_SPI1_RPR.address=0xFFFE4100 +AT91C_SPI1_RPR.width=32 +AT91C_SPI1_RPR.byteEndian=little +AT91C_SPI1_TNCR.name="AT91C_SPI1_TNCR" +AT91C_SPI1_TNCR.description="Transmit Next Counter Register" +AT91C_SPI1_TNCR.helpkey="Transmit Next Counter Register" +AT91C_SPI1_TNCR.access=memorymapped +AT91C_SPI1_TNCR.address=0xFFFE411C +AT91C_SPI1_TNCR.width=32 +AT91C_SPI1_TNCR.byteEndian=little +AT91C_SPI1_TPR.name="AT91C_SPI1_TPR" +AT91C_SPI1_TPR.description="Transmit Pointer Register" +AT91C_SPI1_TPR.helpkey="Transmit Pointer Register" +AT91C_SPI1_TPR.access=memorymapped +AT91C_SPI1_TPR.address=0xFFFE4108 +AT91C_SPI1_TPR.width=32 +AT91C_SPI1_TPR.byteEndian=little +AT91C_SPI1_TNPR.name="AT91C_SPI1_TNPR" +AT91C_SPI1_TNPR.description="Transmit Next Pointer Register" +AT91C_SPI1_TNPR.helpkey="Transmit Next Pointer Register" +AT91C_SPI1_TNPR.access=memorymapped +AT91C_SPI1_TNPR.address=0xFFFE4118 +AT91C_SPI1_TNPR.width=32 +AT91C_SPI1_TNPR.byteEndian=little +AT91C_SPI1_TCR.name="AT91C_SPI1_TCR" +AT91C_SPI1_TCR.description="Transmit Counter Register" +AT91C_SPI1_TCR.helpkey="Transmit Counter Register" +AT91C_SPI1_TCR.access=memorymapped +AT91C_SPI1_TCR.address=0xFFFE410C +AT91C_SPI1_TCR.width=32 +AT91C_SPI1_TCR.byteEndian=little +AT91C_SPI1_RCR.name="AT91C_SPI1_RCR" +AT91C_SPI1_RCR.description="Receive Counter Register" +AT91C_SPI1_RCR.helpkey="Receive Counter Register" +AT91C_SPI1_RCR.access=memorymapped +AT91C_SPI1_RCR.address=0xFFFE4104 +AT91C_SPI1_RCR.width=32 +AT91C_SPI1_RCR.byteEndian=little +AT91C_SPI1_RNPR.name="AT91C_SPI1_RNPR" +AT91C_SPI1_RNPR.description="Receive Next Pointer Register" +AT91C_SPI1_RNPR.helpkey="Receive Next Pointer Register" +AT91C_SPI1_RNPR.access=memorymapped +AT91C_SPI1_RNPR.address=0xFFFE4110 +AT91C_SPI1_RNPR.width=32 +AT91C_SPI1_RNPR.byteEndian=little +AT91C_SPI1_RNCR.name="AT91C_SPI1_RNCR" +AT91C_SPI1_RNCR.description="Receive Next Counter Register" +AT91C_SPI1_RNCR.helpkey="Receive Next Counter Register" +AT91C_SPI1_RNCR.access=memorymapped +AT91C_SPI1_RNCR.address=0xFFFE4114 +AT91C_SPI1_RNCR.width=32 +AT91C_SPI1_RNCR.byteEndian=little +AT91C_SPI1_PTSR.name="AT91C_SPI1_PTSR" +AT91C_SPI1_PTSR.description="PDC Transfer Status Register" +AT91C_SPI1_PTSR.helpkey="PDC Transfer Status Register" +AT91C_SPI1_PTSR.access=memorymapped +AT91C_SPI1_PTSR.address=0xFFFE4124 +AT91C_SPI1_PTSR.width=32 +AT91C_SPI1_PTSR.byteEndian=little +AT91C_SPI1_PTSR.permission.write=none +# ========== Register definition for SPI1 peripheral ========== +AT91C_SPI1_IMR.name="AT91C_SPI1_IMR" +AT91C_SPI1_IMR.description="Interrupt Mask Register" +AT91C_SPI1_IMR.helpkey="Interrupt Mask Register" +AT91C_SPI1_IMR.access=memorymapped +AT91C_SPI1_IMR.address=0xFFFE401C +AT91C_SPI1_IMR.width=32 +AT91C_SPI1_IMR.byteEndian=little +AT91C_SPI1_IMR.permission.write=none +AT91C_SPI1_IER.name="AT91C_SPI1_IER" +AT91C_SPI1_IER.description="Interrupt Enable Register" +AT91C_SPI1_IER.helpkey="Interrupt Enable Register" +AT91C_SPI1_IER.access=memorymapped +AT91C_SPI1_IER.address=0xFFFE4014 +AT91C_SPI1_IER.width=32 +AT91C_SPI1_IER.byteEndian=little +AT91C_SPI1_IER.type=enum +AT91C_SPI1_IER.enum.0.name=*** Write only *** +AT91C_SPI1_IER.enum.1.name=Error +AT91C_SPI1_MR.name="AT91C_SPI1_MR" +AT91C_SPI1_MR.description="Mode Register" +AT91C_SPI1_MR.helpkey="Mode Register" +AT91C_SPI1_MR.access=memorymapped +AT91C_SPI1_MR.address=0xFFFE4004 +AT91C_SPI1_MR.width=32 +AT91C_SPI1_MR.byteEndian=little +AT91C_SPI1_RDR.name="AT91C_SPI1_RDR" +AT91C_SPI1_RDR.description="Receive Data Register" +AT91C_SPI1_RDR.helpkey="Receive Data Register" +AT91C_SPI1_RDR.access=memorymapped +AT91C_SPI1_RDR.address=0xFFFE4008 +AT91C_SPI1_RDR.width=32 +AT91C_SPI1_RDR.byteEndian=little +AT91C_SPI1_RDR.permission.write=none +AT91C_SPI1_IDR.name="AT91C_SPI1_IDR" +AT91C_SPI1_IDR.description="Interrupt Disable Register" +AT91C_SPI1_IDR.helpkey="Interrupt Disable Register" +AT91C_SPI1_IDR.access=memorymapped +AT91C_SPI1_IDR.address=0xFFFE4018 +AT91C_SPI1_IDR.width=32 +AT91C_SPI1_IDR.byteEndian=little +AT91C_SPI1_IDR.type=enum +AT91C_SPI1_IDR.enum.0.name=*** Write only *** +AT91C_SPI1_IDR.enum.1.name=Error +AT91C_SPI1_SR.name="AT91C_SPI1_SR" +AT91C_SPI1_SR.description="Status Register" +AT91C_SPI1_SR.helpkey="Status Register" +AT91C_SPI1_SR.access=memorymapped +AT91C_SPI1_SR.address=0xFFFE4010 +AT91C_SPI1_SR.width=32 +AT91C_SPI1_SR.byteEndian=little +AT91C_SPI1_SR.permission.write=none +AT91C_SPI1_TDR.name="AT91C_SPI1_TDR" +AT91C_SPI1_TDR.description="Transmit Data Register" +AT91C_SPI1_TDR.helpkey="Transmit Data Register" +AT91C_SPI1_TDR.access=memorymapped +AT91C_SPI1_TDR.address=0xFFFE400C +AT91C_SPI1_TDR.width=32 +AT91C_SPI1_TDR.byteEndian=little +AT91C_SPI1_TDR.type=enum +AT91C_SPI1_TDR.enum.0.name=*** Write only *** +AT91C_SPI1_TDR.enum.1.name=Error +AT91C_SPI1_CR.name="AT91C_SPI1_CR" +AT91C_SPI1_CR.description="Control Register" +AT91C_SPI1_CR.helpkey="Control Register" +AT91C_SPI1_CR.access=memorymapped +AT91C_SPI1_CR.address=0xFFFE4000 +AT91C_SPI1_CR.width=32 +AT91C_SPI1_CR.byteEndian=little +AT91C_SPI1_CR.permission.write=none +AT91C_SPI1_CSR.name="AT91C_SPI1_CSR" +AT91C_SPI1_CSR.description="Chip Select Register" +AT91C_SPI1_CSR.helpkey="Chip Select Register" +AT91C_SPI1_CSR.access=memorymapped +AT91C_SPI1_CSR.address=0xFFFE4030 +AT91C_SPI1_CSR.width=32 +AT91C_SPI1_CSR.byteEndian=little +# ========== Register definition for PDC_SPI0 peripheral ========== +AT91C_SPI0_PTCR.name="AT91C_SPI0_PTCR" +AT91C_SPI0_PTCR.description="PDC Transfer Control Register" +AT91C_SPI0_PTCR.helpkey="PDC Transfer Control Register" +AT91C_SPI0_PTCR.access=memorymapped +AT91C_SPI0_PTCR.address=0xFFFE0120 +AT91C_SPI0_PTCR.width=32 +AT91C_SPI0_PTCR.byteEndian=little +AT91C_SPI0_PTCR.type=enum +AT91C_SPI0_PTCR.enum.0.name=*** Write only *** +AT91C_SPI0_PTCR.enum.1.name=Error +AT91C_SPI0_TPR.name="AT91C_SPI0_TPR" +AT91C_SPI0_TPR.description="Transmit Pointer Register" +AT91C_SPI0_TPR.helpkey="Transmit Pointer Register" +AT91C_SPI0_TPR.access=memorymapped +AT91C_SPI0_TPR.address=0xFFFE0108 +AT91C_SPI0_TPR.width=32 +AT91C_SPI0_TPR.byteEndian=little +AT91C_SPI0_TCR.name="AT91C_SPI0_TCR" +AT91C_SPI0_TCR.description="Transmit Counter Register" +AT91C_SPI0_TCR.helpkey="Transmit Counter Register" +AT91C_SPI0_TCR.access=memorymapped +AT91C_SPI0_TCR.address=0xFFFE010C +AT91C_SPI0_TCR.width=32 +AT91C_SPI0_TCR.byteEndian=little +AT91C_SPI0_RCR.name="AT91C_SPI0_RCR" +AT91C_SPI0_RCR.description="Receive Counter Register" +AT91C_SPI0_RCR.helpkey="Receive Counter Register" +AT91C_SPI0_RCR.access=memorymapped +AT91C_SPI0_RCR.address=0xFFFE0104 +AT91C_SPI0_RCR.width=32 +AT91C_SPI0_RCR.byteEndian=little +AT91C_SPI0_PTSR.name="AT91C_SPI0_PTSR" +AT91C_SPI0_PTSR.description="PDC Transfer Status Register" +AT91C_SPI0_PTSR.helpkey="PDC Transfer Status Register" +AT91C_SPI0_PTSR.access=memorymapped +AT91C_SPI0_PTSR.address=0xFFFE0124 +AT91C_SPI0_PTSR.width=32 +AT91C_SPI0_PTSR.byteEndian=little +AT91C_SPI0_PTSR.permission.write=none +AT91C_SPI0_RNPR.name="AT91C_SPI0_RNPR" +AT91C_SPI0_RNPR.description="Receive Next Pointer Register" +AT91C_SPI0_RNPR.helpkey="Receive Next Pointer Register" +AT91C_SPI0_RNPR.access=memorymapped +AT91C_SPI0_RNPR.address=0xFFFE0110 +AT91C_SPI0_RNPR.width=32 +AT91C_SPI0_RNPR.byteEndian=little +AT91C_SPI0_RPR.name="AT91C_SPI0_RPR" +AT91C_SPI0_RPR.description="Receive Pointer Register" +AT91C_SPI0_RPR.helpkey="Receive Pointer Register" +AT91C_SPI0_RPR.access=memorymapped +AT91C_SPI0_RPR.address=0xFFFE0100 +AT91C_SPI0_RPR.width=32 +AT91C_SPI0_RPR.byteEndian=little +AT91C_SPI0_TNCR.name="AT91C_SPI0_TNCR" +AT91C_SPI0_TNCR.description="Transmit Next Counter Register" +AT91C_SPI0_TNCR.helpkey="Transmit Next Counter Register" +AT91C_SPI0_TNCR.access=memorymapped +AT91C_SPI0_TNCR.address=0xFFFE011C +AT91C_SPI0_TNCR.width=32 +AT91C_SPI0_TNCR.byteEndian=little +AT91C_SPI0_RNCR.name="AT91C_SPI0_RNCR" +AT91C_SPI0_RNCR.description="Receive Next Counter Register" +AT91C_SPI0_RNCR.helpkey="Receive Next Counter Register" +AT91C_SPI0_RNCR.access=memorymapped +AT91C_SPI0_RNCR.address=0xFFFE0114 +AT91C_SPI0_RNCR.width=32 +AT91C_SPI0_RNCR.byteEndian=little +AT91C_SPI0_TNPR.name="AT91C_SPI0_TNPR" +AT91C_SPI0_TNPR.description="Transmit Next Pointer Register" +AT91C_SPI0_TNPR.helpkey="Transmit Next Pointer Register" +AT91C_SPI0_TNPR.access=memorymapped +AT91C_SPI0_TNPR.address=0xFFFE0118 +AT91C_SPI0_TNPR.width=32 +AT91C_SPI0_TNPR.byteEndian=little +# ========== Register definition for SPI0 peripheral ========== +AT91C_SPI0_IER.name="AT91C_SPI0_IER" +AT91C_SPI0_IER.description="Interrupt Enable Register" +AT91C_SPI0_IER.helpkey="Interrupt Enable Register" +AT91C_SPI0_IER.access=memorymapped +AT91C_SPI0_IER.address=0xFFFE0014 +AT91C_SPI0_IER.width=32 +AT91C_SPI0_IER.byteEndian=little +AT91C_SPI0_IER.type=enum +AT91C_SPI0_IER.enum.0.name=*** Write only *** +AT91C_SPI0_IER.enum.1.name=Error +AT91C_SPI0_SR.name="AT91C_SPI0_SR" +AT91C_SPI0_SR.description="Status Register" +AT91C_SPI0_SR.helpkey="Status Register" +AT91C_SPI0_SR.access=memorymapped +AT91C_SPI0_SR.address=0xFFFE0010 +AT91C_SPI0_SR.width=32 +AT91C_SPI0_SR.byteEndian=little +AT91C_SPI0_SR.permission.write=none +AT91C_SPI0_IDR.name="AT91C_SPI0_IDR" +AT91C_SPI0_IDR.description="Interrupt Disable Register" +AT91C_SPI0_IDR.helpkey="Interrupt Disable Register" +AT91C_SPI0_IDR.access=memorymapped +AT91C_SPI0_IDR.address=0xFFFE0018 +AT91C_SPI0_IDR.width=32 +AT91C_SPI0_IDR.byteEndian=little +AT91C_SPI0_IDR.type=enum +AT91C_SPI0_IDR.enum.0.name=*** Write only *** +AT91C_SPI0_IDR.enum.1.name=Error +AT91C_SPI0_CR.name="AT91C_SPI0_CR" +AT91C_SPI0_CR.description="Control Register" +AT91C_SPI0_CR.helpkey="Control Register" +AT91C_SPI0_CR.access=memorymapped +AT91C_SPI0_CR.address=0xFFFE0000 +AT91C_SPI0_CR.width=32 +AT91C_SPI0_CR.byteEndian=little +AT91C_SPI0_CR.permission.write=none +AT91C_SPI0_MR.name="AT91C_SPI0_MR" +AT91C_SPI0_MR.description="Mode Register" +AT91C_SPI0_MR.helpkey="Mode Register" +AT91C_SPI0_MR.access=memorymapped +AT91C_SPI0_MR.address=0xFFFE0004 +AT91C_SPI0_MR.width=32 +AT91C_SPI0_MR.byteEndian=little +AT91C_SPI0_IMR.name="AT91C_SPI0_IMR" +AT91C_SPI0_IMR.description="Interrupt Mask Register" +AT91C_SPI0_IMR.helpkey="Interrupt Mask Register" +AT91C_SPI0_IMR.access=memorymapped +AT91C_SPI0_IMR.address=0xFFFE001C +AT91C_SPI0_IMR.width=32 +AT91C_SPI0_IMR.byteEndian=little +AT91C_SPI0_IMR.permission.write=none +AT91C_SPI0_TDR.name="AT91C_SPI0_TDR" +AT91C_SPI0_TDR.description="Transmit Data Register" +AT91C_SPI0_TDR.helpkey="Transmit Data Register" +AT91C_SPI0_TDR.access=memorymapped +AT91C_SPI0_TDR.address=0xFFFE000C +AT91C_SPI0_TDR.width=32 +AT91C_SPI0_TDR.byteEndian=little +AT91C_SPI0_TDR.type=enum +AT91C_SPI0_TDR.enum.0.name=*** Write only *** +AT91C_SPI0_TDR.enum.1.name=Error +AT91C_SPI0_RDR.name="AT91C_SPI0_RDR" +AT91C_SPI0_RDR.description="Receive Data Register" +AT91C_SPI0_RDR.helpkey="Receive Data Register" +AT91C_SPI0_RDR.access=memorymapped +AT91C_SPI0_RDR.address=0xFFFE0008 +AT91C_SPI0_RDR.width=32 +AT91C_SPI0_RDR.byteEndian=little +AT91C_SPI0_RDR.permission.write=none +AT91C_SPI0_CSR.name="AT91C_SPI0_CSR" +AT91C_SPI0_CSR.description="Chip Select Register" +AT91C_SPI0_CSR.helpkey="Chip Select Register" +AT91C_SPI0_CSR.access=memorymapped +AT91C_SPI0_CSR.address=0xFFFE0030 +AT91C_SPI0_CSR.width=32 +AT91C_SPI0_CSR.byteEndian=little +# ========== Register definition for PDC_US1 peripheral ========== +AT91C_US1_RNCR.name="AT91C_US1_RNCR" +AT91C_US1_RNCR.description="Receive Next Counter Register" +AT91C_US1_RNCR.helpkey="Receive Next Counter Register" +AT91C_US1_RNCR.access=memorymapped +AT91C_US1_RNCR.address=0xFFFC4114 +AT91C_US1_RNCR.width=32 +AT91C_US1_RNCR.byteEndian=little +AT91C_US1_PTCR.name="AT91C_US1_PTCR" +AT91C_US1_PTCR.description="PDC Transfer Control Register" +AT91C_US1_PTCR.helpkey="PDC Transfer Control Register" +AT91C_US1_PTCR.access=memorymapped +AT91C_US1_PTCR.address=0xFFFC4120 +AT91C_US1_PTCR.width=32 +AT91C_US1_PTCR.byteEndian=little +AT91C_US1_PTCR.type=enum +AT91C_US1_PTCR.enum.0.name=*** Write only *** +AT91C_US1_PTCR.enum.1.name=Error +AT91C_US1_TCR.name="AT91C_US1_TCR" +AT91C_US1_TCR.description="Transmit Counter Register" +AT91C_US1_TCR.helpkey="Transmit Counter Register" +AT91C_US1_TCR.access=memorymapped +AT91C_US1_TCR.address=0xFFFC410C +AT91C_US1_TCR.width=32 +AT91C_US1_TCR.byteEndian=little +AT91C_US1_PTSR.name="AT91C_US1_PTSR" +AT91C_US1_PTSR.description="PDC Transfer Status Register" +AT91C_US1_PTSR.helpkey="PDC Transfer Status Register" +AT91C_US1_PTSR.access=memorymapped +AT91C_US1_PTSR.address=0xFFFC4124 +AT91C_US1_PTSR.width=32 +AT91C_US1_PTSR.byteEndian=little +AT91C_US1_PTSR.permission.write=none +AT91C_US1_TNPR.name="AT91C_US1_TNPR" +AT91C_US1_TNPR.description="Transmit Next Pointer Register" +AT91C_US1_TNPR.helpkey="Transmit Next Pointer Register" +AT91C_US1_TNPR.access=memorymapped +AT91C_US1_TNPR.address=0xFFFC4118 +AT91C_US1_TNPR.width=32 +AT91C_US1_TNPR.byteEndian=little +AT91C_US1_RCR.name="AT91C_US1_RCR" +AT91C_US1_RCR.description="Receive Counter Register" +AT91C_US1_RCR.helpkey="Receive Counter Register" +AT91C_US1_RCR.access=memorymapped +AT91C_US1_RCR.address=0xFFFC4104 +AT91C_US1_RCR.width=32 +AT91C_US1_RCR.byteEndian=little +AT91C_US1_RNPR.name="AT91C_US1_RNPR" +AT91C_US1_RNPR.description="Receive Next Pointer Register" +AT91C_US1_RNPR.helpkey="Receive Next Pointer Register" +AT91C_US1_RNPR.access=memorymapped +AT91C_US1_RNPR.address=0xFFFC4110 +AT91C_US1_RNPR.width=32 +AT91C_US1_RNPR.byteEndian=little +AT91C_US1_RPR.name="AT91C_US1_RPR" +AT91C_US1_RPR.description="Receive Pointer Register" +AT91C_US1_RPR.helpkey="Receive Pointer Register" +AT91C_US1_RPR.access=memorymapped +AT91C_US1_RPR.address=0xFFFC4100 +AT91C_US1_RPR.width=32 +AT91C_US1_RPR.byteEndian=little +AT91C_US1_TNCR.name="AT91C_US1_TNCR" +AT91C_US1_TNCR.description="Transmit Next Counter Register" +AT91C_US1_TNCR.helpkey="Transmit Next Counter Register" +AT91C_US1_TNCR.access=memorymapped +AT91C_US1_TNCR.address=0xFFFC411C +AT91C_US1_TNCR.width=32 +AT91C_US1_TNCR.byteEndian=little +AT91C_US1_TPR.name="AT91C_US1_TPR" +AT91C_US1_TPR.description="Transmit Pointer Register" +AT91C_US1_TPR.helpkey="Transmit Pointer Register" +AT91C_US1_TPR.access=memorymapped +AT91C_US1_TPR.address=0xFFFC4108 +AT91C_US1_TPR.width=32 +AT91C_US1_TPR.byteEndian=little +# ========== Register definition for US1 peripheral ========== +AT91C_US1_IF.name="AT91C_US1_IF" +AT91C_US1_IF.description="IRDA_FILTER Register" +AT91C_US1_IF.helpkey="IRDA_FILTER Register" +AT91C_US1_IF.access=memorymapped +AT91C_US1_IF.address=0xFFFC404C +AT91C_US1_IF.width=32 +AT91C_US1_IF.byteEndian=little +AT91C_US1_NER.name="AT91C_US1_NER" +AT91C_US1_NER.description="Nb Errors Register" +AT91C_US1_NER.helpkey="Nb Errors Register" +AT91C_US1_NER.access=memorymapped +AT91C_US1_NER.address=0xFFFC4044 +AT91C_US1_NER.width=32 +AT91C_US1_NER.byteEndian=little +AT91C_US1_NER.permission.write=none +AT91C_US1_RTOR.name="AT91C_US1_RTOR" +AT91C_US1_RTOR.description="Receiver Time-out Register" +AT91C_US1_RTOR.helpkey="Receiver Time-out Register" +AT91C_US1_RTOR.access=memorymapped +AT91C_US1_RTOR.address=0xFFFC4024 +AT91C_US1_RTOR.width=32 +AT91C_US1_RTOR.byteEndian=little +AT91C_US1_CSR.name="AT91C_US1_CSR" +AT91C_US1_CSR.description="Channel Status Register" +AT91C_US1_CSR.helpkey="Channel Status Register" +AT91C_US1_CSR.access=memorymapped +AT91C_US1_CSR.address=0xFFFC4014 +AT91C_US1_CSR.width=32 +AT91C_US1_CSR.byteEndian=little +AT91C_US1_CSR.permission.write=none +AT91C_US1_IDR.name="AT91C_US1_IDR" +AT91C_US1_IDR.description="Interrupt Disable Register" +AT91C_US1_IDR.helpkey="Interrupt Disable Register" +AT91C_US1_IDR.access=memorymapped +AT91C_US1_IDR.address=0xFFFC400C +AT91C_US1_IDR.width=32 +AT91C_US1_IDR.byteEndian=little +AT91C_US1_IDR.type=enum +AT91C_US1_IDR.enum.0.name=*** Write only *** +AT91C_US1_IDR.enum.1.name=Error +AT91C_US1_IER.name="AT91C_US1_IER" +AT91C_US1_IER.description="Interrupt Enable Register" +AT91C_US1_IER.helpkey="Interrupt Enable Register" +AT91C_US1_IER.access=memorymapped +AT91C_US1_IER.address=0xFFFC4008 +AT91C_US1_IER.width=32 +AT91C_US1_IER.byteEndian=little +AT91C_US1_IER.type=enum +AT91C_US1_IER.enum.0.name=*** Write only *** +AT91C_US1_IER.enum.1.name=Error +AT91C_US1_THR.name="AT91C_US1_THR" +AT91C_US1_THR.description="Transmitter Holding Register" +AT91C_US1_THR.helpkey="Transmitter Holding Register" +AT91C_US1_THR.access=memorymapped +AT91C_US1_THR.address=0xFFFC401C +AT91C_US1_THR.width=32 +AT91C_US1_THR.byteEndian=little +AT91C_US1_THR.type=enum +AT91C_US1_THR.enum.0.name=*** Write only *** +AT91C_US1_THR.enum.1.name=Error +AT91C_US1_TTGR.name="AT91C_US1_TTGR" +AT91C_US1_TTGR.description="Transmitter Time-guard Register" +AT91C_US1_TTGR.helpkey="Transmitter Time-guard Register" +AT91C_US1_TTGR.access=memorymapped +AT91C_US1_TTGR.address=0xFFFC4028 +AT91C_US1_TTGR.width=32 +AT91C_US1_TTGR.byteEndian=little +AT91C_US1_RHR.name="AT91C_US1_RHR" +AT91C_US1_RHR.description="Receiver Holding Register" +AT91C_US1_RHR.helpkey="Receiver Holding Register" +AT91C_US1_RHR.access=memorymapped +AT91C_US1_RHR.address=0xFFFC4018 +AT91C_US1_RHR.width=32 +AT91C_US1_RHR.byteEndian=little +AT91C_US1_RHR.permission.write=none +AT91C_US1_BRGR.name="AT91C_US1_BRGR" +AT91C_US1_BRGR.description="Baud Rate Generator Register" +AT91C_US1_BRGR.helpkey="Baud Rate Generator Register" +AT91C_US1_BRGR.access=memorymapped +AT91C_US1_BRGR.address=0xFFFC4020 +AT91C_US1_BRGR.width=32 +AT91C_US1_BRGR.byteEndian=little +AT91C_US1_IMR.name="AT91C_US1_IMR" +AT91C_US1_IMR.description="Interrupt Mask Register" +AT91C_US1_IMR.helpkey="Interrupt Mask Register" +AT91C_US1_IMR.access=memorymapped +AT91C_US1_IMR.address=0xFFFC4010 +AT91C_US1_IMR.width=32 +AT91C_US1_IMR.byteEndian=little +AT91C_US1_IMR.permission.write=none +AT91C_US1_FIDI.name="AT91C_US1_FIDI" +AT91C_US1_FIDI.description="FI_DI_Ratio Register" +AT91C_US1_FIDI.helpkey="FI_DI_Ratio Register" +AT91C_US1_FIDI.access=memorymapped +AT91C_US1_FIDI.address=0xFFFC4040 +AT91C_US1_FIDI.width=32 +AT91C_US1_FIDI.byteEndian=little +AT91C_US1_CR.name="AT91C_US1_CR" +AT91C_US1_CR.description="Control Register" +AT91C_US1_CR.helpkey="Control Register" +AT91C_US1_CR.access=memorymapped +AT91C_US1_CR.address=0xFFFC4000 +AT91C_US1_CR.width=32 +AT91C_US1_CR.byteEndian=little +AT91C_US1_CR.type=enum +AT91C_US1_CR.enum.0.name=*** Write only *** +AT91C_US1_CR.enum.1.name=Error +AT91C_US1_MR.name="AT91C_US1_MR" +AT91C_US1_MR.description="Mode Register" +AT91C_US1_MR.helpkey="Mode Register" +AT91C_US1_MR.access=memorymapped +AT91C_US1_MR.address=0xFFFC4004 +AT91C_US1_MR.width=32 +AT91C_US1_MR.byteEndian=little +# ========== Register definition for PDC_US0 peripheral ========== +AT91C_US0_TNPR.name="AT91C_US0_TNPR" +AT91C_US0_TNPR.description="Transmit Next Pointer Register" +AT91C_US0_TNPR.helpkey="Transmit Next Pointer Register" +AT91C_US0_TNPR.access=memorymapped +AT91C_US0_TNPR.address=0xFFFC0118 +AT91C_US0_TNPR.width=32 +AT91C_US0_TNPR.byteEndian=little +AT91C_US0_RNPR.name="AT91C_US0_RNPR" +AT91C_US0_RNPR.description="Receive Next Pointer Register" +AT91C_US0_RNPR.helpkey="Receive Next Pointer Register" +AT91C_US0_RNPR.access=memorymapped +AT91C_US0_RNPR.address=0xFFFC0110 +AT91C_US0_RNPR.width=32 +AT91C_US0_RNPR.byteEndian=little +AT91C_US0_TCR.name="AT91C_US0_TCR" +AT91C_US0_TCR.description="Transmit Counter Register" +AT91C_US0_TCR.helpkey="Transmit Counter Register" +AT91C_US0_TCR.access=memorymapped +AT91C_US0_TCR.address=0xFFFC010C +AT91C_US0_TCR.width=32 +AT91C_US0_TCR.byteEndian=little +AT91C_US0_PTCR.name="AT91C_US0_PTCR" +AT91C_US0_PTCR.description="PDC Transfer Control Register" +AT91C_US0_PTCR.helpkey="PDC Transfer Control Register" +AT91C_US0_PTCR.access=memorymapped +AT91C_US0_PTCR.address=0xFFFC0120 +AT91C_US0_PTCR.width=32 +AT91C_US0_PTCR.byteEndian=little +AT91C_US0_PTCR.type=enum +AT91C_US0_PTCR.enum.0.name=*** Write only *** +AT91C_US0_PTCR.enum.1.name=Error +AT91C_US0_PTSR.name="AT91C_US0_PTSR" +AT91C_US0_PTSR.description="PDC Transfer Status Register" +AT91C_US0_PTSR.helpkey="PDC Transfer Status Register" +AT91C_US0_PTSR.access=memorymapped +AT91C_US0_PTSR.address=0xFFFC0124 +AT91C_US0_PTSR.width=32 +AT91C_US0_PTSR.byteEndian=little +AT91C_US0_PTSR.permission.write=none +AT91C_US0_TNCR.name="AT91C_US0_TNCR" +AT91C_US0_TNCR.description="Transmit Next Counter Register" +AT91C_US0_TNCR.helpkey="Transmit Next Counter Register" +AT91C_US0_TNCR.access=memorymapped +AT91C_US0_TNCR.address=0xFFFC011C +AT91C_US0_TNCR.width=32 +AT91C_US0_TNCR.byteEndian=little +AT91C_US0_TPR.name="AT91C_US0_TPR" +AT91C_US0_TPR.description="Transmit Pointer Register" +AT91C_US0_TPR.helpkey="Transmit Pointer Register" +AT91C_US0_TPR.access=memorymapped +AT91C_US0_TPR.address=0xFFFC0108 +AT91C_US0_TPR.width=32 +AT91C_US0_TPR.byteEndian=little +AT91C_US0_RCR.name="AT91C_US0_RCR" +AT91C_US0_RCR.description="Receive Counter Register" +AT91C_US0_RCR.helpkey="Receive Counter Register" +AT91C_US0_RCR.access=memorymapped +AT91C_US0_RCR.address=0xFFFC0104 +AT91C_US0_RCR.width=32 +AT91C_US0_RCR.byteEndian=little +AT91C_US0_RPR.name="AT91C_US0_RPR" +AT91C_US0_RPR.description="Receive Pointer Register" +AT91C_US0_RPR.helpkey="Receive Pointer Register" +AT91C_US0_RPR.access=memorymapped +AT91C_US0_RPR.address=0xFFFC0100 +AT91C_US0_RPR.width=32 +AT91C_US0_RPR.byteEndian=little +AT91C_US0_RNCR.name="AT91C_US0_RNCR" +AT91C_US0_RNCR.description="Receive Next Counter Register" +AT91C_US0_RNCR.helpkey="Receive Next Counter Register" +AT91C_US0_RNCR.access=memorymapped +AT91C_US0_RNCR.address=0xFFFC0114 +AT91C_US0_RNCR.width=32 +AT91C_US0_RNCR.byteEndian=little +# ========== Register definition for US0 peripheral ========== +AT91C_US0_BRGR.name="AT91C_US0_BRGR" +AT91C_US0_BRGR.description="Baud Rate Generator Register" +AT91C_US0_BRGR.helpkey="Baud Rate Generator Register" +AT91C_US0_BRGR.access=memorymapped +AT91C_US0_BRGR.address=0xFFFC0020 +AT91C_US0_BRGR.width=32 +AT91C_US0_BRGR.byteEndian=little +AT91C_US0_NER.name="AT91C_US0_NER" +AT91C_US0_NER.description="Nb Errors Register" +AT91C_US0_NER.helpkey="Nb Errors Register" +AT91C_US0_NER.access=memorymapped +AT91C_US0_NER.address=0xFFFC0044 +AT91C_US0_NER.width=32 +AT91C_US0_NER.byteEndian=little +AT91C_US0_NER.permission.write=none +AT91C_US0_CR.name="AT91C_US0_CR" +AT91C_US0_CR.description="Control Register" +AT91C_US0_CR.helpkey="Control Register" +AT91C_US0_CR.access=memorymapped +AT91C_US0_CR.address=0xFFFC0000 +AT91C_US0_CR.width=32 +AT91C_US0_CR.byteEndian=little +AT91C_US0_CR.type=enum +AT91C_US0_CR.enum.0.name=*** Write only *** +AT91C_US0_CR.enum.1.name=Error +AT91C_US0_IMR.name="AT91C_US0_IMR" +AT91C_US0_IMR.description="Interrupt Mask Register" +AT91C_US0_IMR.helpkey="Interrupt Mask Register" +AT91C_US0_IMR.access=memorymapped +AT91C_US0_IMR.address=0xFFFC0010 +AT91C_US0_IMR.width=32 +AT91C_US0_IMR.byteEndian=little +AT91C_US0_IMR.permission.write=none +AT91C_US0_FIDI.name="AT91C_US0_FIDI" +AT91C_US0_FIDI.description="FI_DI_Ratio Register" +AT91C_US0_FIDI.helpkey="FI_DI_Ratio Register" +AT91C_US0_FIDI.access=memorymapped +AT91C_US0_FIDI.address=0xFFFC0040 +AT91C_US0_FIDI.width=32 +AT91C_US0_FIDI.byteEndian=little +AT91C_US0_TTGR.name="AT91C_US0_TTGR" +AT91C_US0_TTGR.description="Transmitter Time-guard Register" +AT91C_US0_TTGR.helpkey="Transmitter Time-guard Register" +AT91C_US0_TTGR.access=memorymapped +AT91C_US0_TTGR.address=0xFFFC0028 +AT91C_US0_TTGR.width=32 +AT91C_US0_TTGR.byteEndian=little +AT91C_US0_MR.name="AT91C_US0_MR" +AT91C_US0_MR.description="Mode Register" +AT91C_US0_MR.helpkey="Mode Register" +AT91C_US0_MR.access=memorymapped +AT91C_US0_MR.address=0xFFFC0004 +AT91C_US0_MR.width=32 +AT91C_US0_MR.byteEndian=little +AT91C_US0_RTOR.name="AT91C_US0_RTOR" +AT91C_US0_RTOR.description="Receiver Time-out Register" +AT91C_US0_RTOR.helpkey="Receiver Time-out Register" +AT91C_US0_RTOR.access=memorymapped +AT91C_US0_RTOR.address=0xFFFC0024 +AT91C_US0_RTOR.width=32 +AT91C_US0_RTOR.byteEndian=little +AT91C_US0_CSR.name="AT91C_US0_CSR" +AT91C_US0_CSR.description="Channel Status Register" +AT91C_US0_CSR.helpkey="Channel Status Register" +AT91C_US0_CSR.access=memorymapped +AT91C_US0_CSR.address=0xFFFC0014 +AT91C_US0_CSR.width=32 +AT91C_US0_CSR.byteEndian=little +AT91C_US0_CSR.permission.write=none +AT91C_US0_RHR.name="AT91C_US0_RHR" +AT91C_US0_RHR.description="Receiver Holding Register" +AT91C_US0_RHR.helpkey="Receiver Holding Register" +AT91C_US0_RHR.access=memorymapped +AT91C_US0_RHR.address=0xFFFC0018 +AT91C_US0_RHR.width=32 +AT91C_US0_RHR.byteEndian=little +AT91C_US0_RHR.permission.write=none +AT91C_US0_IDR.name="AT91C_US0_IDR" +AT91C_US0_IDR.description="Interrupt Disable Register" +AT91C_US0_IDR.helpkey="Interrupt Disable Register" +AT91C_US0_IDR.access=memorymapped +AT91C_US0_IDR.address=0xFFFC000C +AT91C_US0_IDR.width=32 +AT91C_US0_IDR.byteEndian=little +AT91C_US0_IDR.type=enum +AT91C_US0_IDR.enum.0.name=*** Write only *** +AT91C_US0_IDR.enum.1.name=Error +AT91C_US0_THR.name="AT91C_US0_THR" +AT91C_US0_THR.description="Transmitter Holding Register" +AT91C_US0_THR.helpkey="Transmitter Holding Register" +AT91C_US0_THR.access=memorymapped +AT91C_US0_THR.address=0xFFFC001C +AT91C_US0_THR.width=32 +AT91C_US0_THR.byteEndian=little +AT91C_US0_THR.type=enum +AT91C_US0_THR.enum.0.name=*** Write only *** +AT91C_US0_THR.enum.1.name=Error +AT91C_US0_IF.name="AT91C_US0_IF" +AT91C_US0_IF.description="IRDA_FILTER Register" +AT91C_US0_IF.helpkey="IRDA_FILTER Register" +AT91C_US0_IF.access=memorymapped +AT91C_US0_IF.address=0xFFFC004C +AT91C_US0_IF.width=32 +AT91C_US0_IF.byteEndian=little +AT91C_US0_IER.name="AT91C_US0_IER" +AT91C_US0_IER.description="Interrupt Enable Register" +AT91C_US0_IER.helpkey="Interrupt Enable Register" +AT91C_US0_IER.access=memorymapped +AT91C_US0_IER.address=0xFFFC0008 +AT91C_US0_IER.width=32 +AT91C_US0_IER.byteEndian=little +AT91C_US0_IER.type=enum +AT91C_US0_IER.enum.0.name=*** Write only *** +AT91C_US0_IER.enum.1.name=Error +# ========== Register definition for PDC_SSC peripheral ========== +AT91C_SSC_TNCR.name="AT91C_SSC_TNCR" +AT91C_SSC_TNCR.description="Transmit Next Counter Register" +AT91C_SSC_TNCR.helpkey="Transmit Next Counter Register" +AT91C_SSC_TNCR.access=memorymapped +AT91C_SSC_TNCR.address=0xFFFD411C +AT91C_SSC_TNCR.width=32 +AT91C_SSC_TNCR.byteEndian=little +AT91C_SSC_RPR.name="AT91C_SSC_RPR" +AT91C_SSC_RPR.description="Receive Pointer Register" +AT91C_SSC_RPR.helpkey="Receive Pointer Register" +AT91C_SSC_RPR.access=memorymapped +AT91C_SSC_RPR.address=0xFFFD4100 +AT91C_SSC_RPR.width=32 +AT91C_SSC_RPR.byteEndian=little +AT91C_SSC_RNCR.name="AT91C_SSC_RNCR" +AT91C_SSC_RNCR.description="Receive Next Counter Register" +AT91C_SSC_RNCR.helpkey="Receive Next Counter Register" +AT91C_SSC_RNCR.access=memorymapped +AT91C_SSC_RNCR.address=0xFFFD4114 +AT91C_SSC_RNCR.width=32 +AT91C_SSC_RNCR.byteEndian=little +AT91C_SSC_TPR.name="AT91C_SSC_TPR" +AT91C_SSC_TPR.description="Transmit Pointer Register" +AT91C_SSC_TPR.helpkey="Transmit Pointer Register" +AT91C_SSC_TPR.access=memorymapped +AT91C_SSC_TPR.address=0xFFFD4108 +AT91C_SSC_TPR.width=32 +AT91C_SSC_TPR.byteEndian=little +AT91C_SSC_PTCR.name="AT91C_SSC_PTCR" +AT91C_SSC_PTCR.description="PDC Transfer Control Register" +AT91C_SSC_PTCR.helpkey="PDC Transfer Control Register" +AT91C_SSC_PTCR.access=memorymapped +AT91C_SSC_PTCR.address=0xFFFD4120 +AT91C_SSC_PTCR.width=32 +AT91C_SSC_PTCR.byteEndian=little +AT91C_SSC_PTCR.type=enum +AT91C_SSC_PTCR.enum.0.name=*** Write only *** +AT91C_SSC_PTCR.enum.1.name=Error +AT91C_SSC_TCR.name="AT91C_SSC_TCR" +AT91C_SSC_TCR.description="Transmit Counter Register" +AT91C_SSC_TCR.helpkey="Transmit Counter Register" +AT91C_SSC_TCR.access=memorymapped +AT91C_SSC_TCR.address=0xFFFD410C +AT91C_SSC_TCR.width=32 +AT91C_SSC_TCR.byteEndian=little +AT91C_SSC_RCR.name="AT91C_SSC_RCR" +AT91C_SSC_RCR.description="Receive Counter Register" +AT91C_SSC_RCR.helpkey="Receive Counter Register" +AT91C_SSC_RCR.access=memorymapped +AT91C_SSC_RCR.address=0xFFFD4104 +AT91C_SSC_RCR.width=32 +AT91C_SSC_RCR.byteEndian=little +AT91C_SSC_RNPR.name="AT91C_SSC_RNPR" +AT91C_SSC_RNPR.description="Receive Next Pointer Register" +AT91C_SSC_RNPR.helpkey="Receive Next Pointer Register" +AT91C_SSC_RNPR.access=memorymapped +AT91C_SSC_RNPR.address=0xFFFD4110 +AT91C_SSC_RNPR.width=32 +AT91C_SSC_RNPR.byteEndian=little +AT91C_SSC_TNPR.name="AT91C_SSC_TNPR" +AT91C_SSC_TNPR.description="Transmit Next Pointer Register" +AT91C_SSC_TNPR.helpkey="Transmit Next Pointer Register" +AT91C_SSC_TNPR.access=memorymapped +AT91C_SSC_TNPR.address=0xFFFD4118 +AT91C_SSC_TNPR.width=32 +AT91C_SSC_TNPR.byteEndian=little +AT91C_SSC_PTSR.name="AT91C_SSC_PTSR" +AT91C_SSC_PTSR.description="PDC Transfer Status Register" +AT91C_SSC_PTSR.helpkey="PDC Transfer Status Register" +AT91C_SSC_PTSR.access=memorymapped +AT91C_SSC_PTSR.address=0xFFFD4124 +AT91C_SSC_PTSR.width=32 +AT91C_SSC_PTSR.byteEndian=little +AT91C_SSC_PTSR.permission.write=none +# ========== Register definition for SSC peripheral ========== +AT91C_SSC_RHR.name="AT91C_SSC_RHR" +AT91C_SSC_RHR.description="Receive Holding Register" +AT91C_SSC_RHR.helpkey="Receive Holding Register" +AT91C_SSC_RHR.access=memorymapped +AT91C_SSC_RHR.address=0xFFFD4020 +AT91C_SSC_RHR.width=32 +AT91C_SSC_RHR.byteEndian=little +AT91C_SSC_RHR.permission.write=none +AT91C_SSC_RSHR.name="AT91C_SSC_RSHR" +AT91C_SSC_RSHR.description="Receive Sync Holding Register" +AT91C_SSC_RSHR.helpkey="Receive Sync Holding Register" +AT91C_SSC_RSHR.access=memorymapped +AT91C_SSC_RSHR.address=0xFFFD4030 +AT91C_SSC_RSHR.width=32 +AT91C_SSC_RSHR.byteEndian=little +AT91C_SSC_RSHR.permission.write=none +AT91C_SSC_TFMR.name="AT91C_SSC_TFMR" +AT91C_SSC_TFMR.description="Transmit Frame Mode Register" +AT91C_SSC_TFMR.helpkey="Transmit Frame Mode Register" +AT91C_SSC_TFMR.access=memorymapped +AT91C_SSC_TFMR.address=0xFFFD401C +AT91C_SSC_TFMR.width=32 +AT91C_SSC_TFMR.byteEndian=little +AT91C_SSC_IDR.name="AT91C_SSC_IDR" +AT91C_SSC_IDR.description="Interrupt Disable Register" +AT91C_SSC_IDR.helpkey="Interrupt Disable Register" +AT91C_SSC_IDR.access=memorymapped +AT91C_SSC_IDR.address=0xFFFD4048 +AT91C_SSC_IDR.width=32 +AT91C_SSC_IDR.byteEndian=little +AT91C_SSC_IDR.type=enum +AT91C_SSC_IDR.enum.0.name=*** Write only *** +AT91C_SSC_IDR.enum.1.name=Error +AT91C_SSC_THR.name="AT91C_SSC_THR" +AT91C_SSC_THR.description="Transmit Holding Register" +AT91C_SSC_THR.helpkey="Transmit Holding Register" +AT91C_SSC_THR.access=memorymapped +AT91C_SSC_THR.address=0xFFFD4024 +AT91C_SSC_THR.width=32 +AT91C_SSC_THR.byteEndian=little +AT91C_SSC_THR.type=enum +AT91C_SSC_THR.enum.0.name=*** Write only *** +AT91C_SSC_THR.enum.1.name=Error +AT91C_SSC_RCMR.name="AT91C_SSC_RCMR" +AT91C_SSC_RCMR.description="Receive Clock ModeRegister" +AT91C_SSC_RCMR.helpkey="Receive Clock ModeRegister" +AT91C_SSC_RCMR.access=memorymapped +AT91C_SSC_RCMR.address=0xFFFD4010 +AT91C_SSC_RCMR.width=32 +AT91C_SSC_RCMR.byteEndian=little +AT91C_SSC_IER.name="AT91C_SSC_IER" +AT91C_SSC_IER.description="Interrupt Enable Register" +AT91C_SSC_IER.helpkey="Interrupt Enable Register" +AT91C_SSC_IER.access=memorymapped +AT91C_SSC_IER.address=0xFFFD4044 +AT91C_SSC_IER.width=32 +AT91C_SSC_IER.byteEndian=little +AT91C_SSC_IER.type=enum +AT91C_SSC_IER.enum.0.name=*** Write only *** +AT91C_SSC_IER.enum.1.name=Error +AT91C_SSC_TSHR.name="AT91C_SSC_TSHR" +AT91C_SSC_TSHR.description="Transmit Sync Holding Register" +AT91C_SSC_TSHR.helpkey="Transmit Sync Holding Register" +AT91C_SSC_TSHR.access=memorymapped +AT91C_SSC_TSHR.address=0xFFFD4034 +AT91C_SSC_TSHR.width=32 +AT91C_SSC_TSHR.byteEndian=little +AT91C_SSC_SR.name="AT91C_SSC_SR" +AT91C_SSC_SR.description="Status Register" +AT91C_SSC_SR.helpkey="Status Register" +AT91C_SSC_SR.access=memorymapped +AT91C_SSC_SR.address=0xFFFD4040 +AT91C_SSC_SR.width=32 +AT91C_SSC_SR.byteEndian=little +AT91C_SSC_SR.permission.write=none +AT91C_SSC_CMR.name="AT91C_SSC_CMR" +AT91C_SSC_CMR.description="Clock Mode Register" +AT91C_SSC_CMR.helpkey="Clock Mode Register" +AT91C_SSC_CMR.access=memorymapped +AT91C_SSC_CMR.address=0xFFFD4004 +AT91C_SSC_CMR.width=32 +AT91C_SSC_CMR.byteEndian=little +AT91C_SSC_TCMR.name="AT91C_SSC_TCMR" +AT91C_SSC_TCMR.description="Transmit Clock Mode Register" +AT91C_SSC_TCMR.helpkey="Transmit Clock Mode Register" +AT91C_SSC_TCMR.access=memorymapped +AT91C_SSC_TCMR.address=0xFFFD4018 +AT91C_SSC_TCMR.width=32 +AT91C_SSC_TCMR.byteEndian=little +AT91C_SSC_CR.name="AT91C_SSC_CR" +AT91C_SSC_CR.description="Control Register" +AT91C_SSC_CR.helpkey="Control Register" +AT91C_SSC_CR.access=memorymapped +AT91C_SSC_CR.address=0xFFFD4000 +AT91C_SSC_CR.width=32 +AT91C_SSC_CR.byteEndian=little +AT91C_SSC_CR.type=enum +AT91C_SSC_CR.enum.0.name=*** Write only *** +AT91C_SSC_CR.enum.1.name=Error +AT91C_SSC_IMR.name="AT91C_SSC_IMR" +AT91C_SSC_IMR.description="Interrupt Mask Register" +AT91C_SSC_IMR.helpkey="Interrupt Mask Register" +AT91C_SSC_IMR.access=memorymapped +AT91C_SSC_IMR.address=0xFFFD404C +AT91C_SSC_IMR.width=32 +AT91C_SSC_IMR.byteEndian=little +AT91C_SSC_IMR.permission.write=none +AT91C_SSC_RFMR.name="AT91C_SSC_RFMR" +AT91C_SSC_RFMR.description="Receive Frame Mode Register" +AT91C_SSC_RFMR.helpkey="Receive Frame Mode Register" +AT91C_SSC_RFMR.access=memorymapped +AT91C_SSC_RFMR.address=0xFFFD4014 +AT91C_SSC_RFMR.width=32 +AT91C_SSC_RFMR.byteEndian=little +# ========== Register definition for TWI peripheral ========== +AT91C_TWI_IER.name="AT91C_TWI_IER" +AT91C_TWI_IER.description="Interrupt Enable Register" +AT91C_TWI_IER.helpkey="Interrupt Enable Register" +AT91C_TWI_IER.access=memorymapped +AT91C_TWI_IER.address=0xFFFB8024 +AT91C_TWI_IER.width=32 +AT91C_TWI_IER.byteEndian=little +AT91C_TWI_IER.type=enum +AT91C_TWI_IER.enum.0.name=*** Write only *** +AT91C_TWI_IER.enum.1.name=Error +AT91C_TWI_CR.name="AT91C_TWI_CR" +AT91C_TWI_CR.description="Control Register" +AT91C_TWI_CR.helpkey="Control Register" +AT91C_TWI_CR.access=memorymapped +AT91C_TWI_CR.address=0xFFFB8000 +AT91C_TWI_CR.width=32 +AT91C_TWI_CR.byteEndian=little +AT91C_TWI_CR.type=enum +AT91C_TWI_CR.enum.0.name=*** Write only *** +AT91C_TWI_CR.enum.1.name=Error +AT91C_TWI_SR.name="AT91C_TWI_SR" +AT91C_TWI_SR.description="Status Register" +AT91C_TWI_SR.helpkey="Status Register" +AT91C_TWI_SR.access=memorymapped +AT91C_TWI_SR.address=0xFFFB8020 +AT91C_TWI_SR.width=32 +AT91C_TWI_SR.byteEndian=little +AT91C_TWI_SR.permission.write=none +AT91C_TWI_IMR.name="AT91C_TWI_IMR" +AT91C_TWI_IMR.description="Interrupt Mask Register" +AT91C_TWI_IMR.helpkey="Interrupt Mask Register" +AT91C_TWI_IMR.access=memorymapped +AT91C_TWI_IMR.address=0xFFFB802C +AT91C_TWI_IMR.width=32 +AT91C_TWI_IMR.byteEndian=little +AT91C_TWI_IMR.permission.write=none +AT91C_TWI_THR.name="AT91C_TWI_THR" +AT91C_TWI_THR.description="Transmit Holding Register" +AT91C_TWI_THR.helpkey="Transmit Holding Register" +AT91C_TWI_THR.access=memorymapped +AT91C_TWI_THR.address=0xFFFB8034 +AT91C_TWI_THR.width=32 +AT91C_TWI_THR.byteEndian=little +AT91C_TWI_THR.type=enum +AT91C_TWI_THR.enum.0.name=*** Write only *** +AT91C_TWI_THR.enum.1.name=Error +AT91C_TWI_IDR.name="AT91C_TWI_IDR" +AT91C_TWI_IDR.description="Interrupt Disable Register" +AT91C_TWI_IDR.helpkey="Interrupt Disable Register" +AT91C_TWI_IDR.access=memorymapped +AT91C_TWI_IDR.address=0xFFFB8028 +AT91C_TWI_IDR.width=32 +AT91C_TWI_IDR.byteEndian=little +AT91C_TWI_IDR.type=enum +AT91C_TWI_IDR.enum.0.name=*** Write only *** +AT91C_TWI_IDR.enum.1.name=Error +AT91C_TWI_IADR.name="AT91C_TWI_IADR" +AT91C_TWI_IADR.description="Internal Address Register" +AT91C_TWI_IADR.helpkey="Internal Address Register" +AT91C_TWI_IADR.access=memorymapped +AT91C_TWI_IADR.address=0xFFFB800C +AT91C_TWI_IADR.width=32 +AT91C_TWI_IADR.byteEndian=little +AT91C_TWI_MMR.name="AT91C_TWI_MMR" +AT91C_TWI_MMR.description="Master Mode Register" +AT91C_TWI_MMR.helpkey="Master Mode Register" +AT91C_TWI_MMR.access=memorymapped +AT91C_TWI_MMR.address=0xFFFB8004 +AT91C_TWI_MMR.width=32 +AT91C_TWI_MMR.byteEndian=little +AT91C_TWI_CWGR.name="AT91C_TWI_CWGR" +AT91C_TWI_CWGR.description="Clock Waveform Generator Register" +AT91C_TWI_CWGR.helpkey="Clock Waveform Generator Register" +AT91C_TWI_CWGR.access=memorymapped +AT91C_TWI_CWGR.address=0xFFFB8010 +AT91C_TWI_CWGR.width=32 +AT91C_TWI_CWGR.byteEndian=little +AT91C_TWI_RHR.name="AT91C_TWI_RHR" +AT91C_TWI_RHR.description="Receive Holding Register" +AT91C_TWI_RHR.helpkey="Receive Holding Register" +AT91C_TWI_RHR.access=memorymapped +AT91C_TWI_RHR.address=0xFFFB8030 +AT91C_TWI_RHR.width=32 +AT91C_TWI_RHR.byteEndian=little +AT91C_TWI_RHR.permission.write=none +# ========== Register definition for PWMC_CH3 peripheral ========== +AT91C_PWMC_CH3_CUPDR.name="AT91C_PWMC_CH3_CUPDR" +AT91C_PWMC_CH3_CUPDR.description="Channel Update Register" +AT91C_PWMC_CH3_CUPDR.helpkey="Channel Update Register" +AT91C_PWMC_CH3_CUPDR.access=memorymapped +AT91C_PWMC_CH3_CUPDR.address=0xFFFCC270 +AT91C_PWMC_CH3_CUPDR.width=32 +AT91C_PWMC_CH3_CUPDR.byteEndian=little +AT91C_PWMC_CH3_CUPDR.type=enum +AT91C_PWMC_CH3_CUPDR.enum.0.name=*** Write only *** +AT91C_PWMC_CH3_CUPDR.enum.1.name=Error +AT91C_PWMC_CH3_Reserved.name="AT91C_PWMC_CH3_Reserved" +AT91C_PWMC_CH3_Reserved.description="Reserved" +AT91C_PWMC_CH3_Reserved.helpkey="Reserved" +AT91C_PWMC_CH3_Reserved.access=memorymapped +AT91C_PWMC_CH3_Reserved.address=0xFFFCC274 +AT91C_PWMC_CH3_Reserved.width=32 +AT91C_PWMC_CH3_Reserved.byteEndian=little +AT91C_PWMC_CH3_Reserved.type=enum +AT91C_PWMC_CH3_Reserved.enum.0.name=*** Write only *** +AT91C_PWMC_CH3_Reserved.enum.1.name=Error +AT91C_PWMC_CH3_CPRDR.name="AT91C_PWMC_CH3_CPRDR" +AT91C_PWMC_CH3_CPRDR.description="Channel Period Register" +AT91C_PWMC_CH3_CPRDR.helpkey="Channel Period Register" +AT91C_PWMC_CH3_CPRDR.access=memorymapped +AT91C_PWMC_CH3_CPRDR.address=0xFFFCC268 +AT91C_PWMC_CH3_CPRDR.width=32 +AT91C_PWMC_CH3_CPRDR.byteEndian=little +AT91C_PWMC_CH3_CDTYR.name="AT91C_PWMC_CH3_CDTYR" +AT91C_PWMC_CH3_CDTYR.description="Channel Duty Cycle Register" +AT91C_PWMC_CH3_CDTYR.helpkey="Channel Duty Cycle Register" +AT91C_PWMC_CH3_CDTYR.access=memorymapped +AT91C_PWMC_CH3_CDTYR.address=0xFFFCC264 +AT91C_PWMC_CH3_CDTYR.width=32 +AT91C_PWMC_CH3_CDTYR.byteEndian=little +AT91C_PWMC_CH3_CCNTR.name="AT91C_PWMC_CH3_CCNTR" +AT91C_PWMC_CH3_CCNTR.description="Channel Counter Register" +AT91C_PWMC_CH3_CCNTR.helpkey="Channel Counter Register" +AT91C_PWMC_CH3_CCNTR.access=memorymapped +AT91C_PWMC_CH3_CCNTR.address=0xFFFCC26C +AT91C_PWMC_CH3_CCNTR.width=32 +AT91C_PWMC_CH3_CCNTR.byteEndian=little +AT91C_PWMC_CH3_CCNTR.permission.write=none +AT91C_PWMC_CH3_CMR.name="AT91C_PWMC_CH3_CMR" +AT91C_PWMC_CH3_CMR.description="Channel Mode Register" +AT91C_PWMC_CH3_CMR.helpkey="Channel Mode Register" +AT91C_PWMC_CH3_CMR.access=memorymapped +AT91C_PWMC_CH3_CMR.address=0xFFFCC260 +AT91C_PWMC_CH3_CMR.width=32 +AT91C_PWMC_CH3_CMR.byteEndian=little +# ========== Register definition for PWMC_CH2 peripheral ========== +AT91C_PWMC_CH2_Reserved.name="AT91C_PWMC_CH2_Reserved" +AT91C_PWMC_CH2_Reserved.description="Reserved" +AT91C_PWMC_CH2_Reserved.helpkey="Reserved" +AT91C_PWMC_CH2_Reserved.access=memorymapped +AT91C_PWMC_CH2_Reserved.address=0xFFFCC254 +AT91C_PWMC_CH2_Reserved.width=32 +AT91C_PWMC_CH2_Reserved.byteEndian=little +AT91C_PWMC_CH2_Reserved.type=enum +AT91C_PWMC_CH2_Reserved.enum.0.name=*** Write only *** +AT91C_PWMC_CH2_Reserved.enum.1.name=Error +AT91C_PWMC_CH2_CMR.name="AT91C_PWMC_CH2_CMR" +AT91C_PWMC_CH2_CMR.description="Channel Mode Register" +AT91C_PWMC_CH2_CMR.helpkey="Channel Mode Register" +AT91C_PWMC_CH2_CMR.access=memorymapped +AT91C_PWMC_CH2_CMR.address=0xFFFCC240 +AT91C_PWMC_CH2_CMR.width=32 +AT91C_PWMC_CH2_CMR.byteEndian=little +AT91C_PWMC_CH2_CCNTR.name="AT91C_PWMC_CH2_CCNTR" +AT91C_PWMC_CH2_CCNTR.description="Channel Counter Register" +AT91C_PWMC_CH2_CCNTR.helpkey="Channel Counter Register" +AT91C_PWMC_CH2_CCNTR.access=memorymapped +AT91C_PWMC_CH2_CCNTR.address=0xFFFCC24C +AT91C_PWMC_CH2_CCNTR.width=32 +AT91C_PWMC_CH2_CCNTR.byteEndian=little +AT91C_PWMC_CH2_CCNTR.permission.write=none +AT91C_PWMC_CH2_CPRDR.name="AT91C_PWMC_CH2_CPRDR" +AT91C_PWMC_CH2_CPRDR.description="Channel Period Register" +AT91C_PWMC_CH2_CPRDR.helpkey="Channel Period Register" +AT91C_PWMC_CH2_CPRDR.access=memorymapped +AT91C_PWMC_CH2_CPRDR.address=0xFFFCC248 +AT91C_PWMC_CH2_CPRDR.width=32 +AT91C_PWMC_CH2_CPRDR.byteEndian=little +AT91C_PWMC_CH2_CUPDR.name="AT91C_PWMC_CH2_CUPDR" +AT91C_PWMC_CH2_CUPDR.description="Channel Update Register" +AT91C_PWMC_CH2_CUPDR.helpkey="Channel Update Register" +AT91C_PWMC_CH2_CUPDR.access=memorymapped +AT91C_PWMC_CH2_CUPDR.address=0xFFFCC250 +AT91C_PWMC_CH2_CUPDR.width=32 +AT91C_PWMC_CH2_CUPDR.byteEndian=little +AT91C_PWMC_CH2_CUPDR.type=enum +AT91C_PWMC_CH2_CUPDR.enum.0.name=*** Write only *** +AT91C_PWMC_CH2_CUPDR.enum.1.name=Error +AT91C_PWMC_CH2_CDTYR.name="AT91C_PWMC_CH2_CDTYR" +AT91C_PWMC_CH2_CDTYR.description="Channel Duty Cycle Register" +AT91C_PWMC_CH2_CDTYR.helpkey="Channel Duty Cycle Register" +AT91C_PWMC_CH2_CDTYR.access=memorymapped +AT91C_PWMC_CH2_CDTYR.address=0xFFFCC244 +AT91C_PWMC_CH2_CDTYR.width=32 +AT91C_PWMC_CH2_CDTYR.byteEndian=little +# ========== Register definition for PWMC_CH1 peripheral ========== +AT91C_PWMC_CH1_Reserved.name="AT91C_PWMC_CH1_Reserved" +AT91C_PWMC_CH1_Reserved.description="Reserved" +AT91C_PWMC_CH1_Reserved.helpkey="Reserved" +AT91C_PWMC_CH1_Reserved.access=memorymapped +AT91C_PWMC_CH1_Reserved.address=0xFFFCC234 +AT91C_PWMC_CH1_Reserved.width=32 +AT91C_PWMC_CH1_Reserved.byteEndian=little +AT91C_PWMC_CH1_Reserved.type=enum +AT91C_PWMC_CH1_Reserved.enum.0.name=*** Write only *** +AT91C_PWMC_CH1_Reserved.enum.1.name=Error +AT91C_PWMC_CH1_CUPDR.name="AT91C_PWMC_CH1_CUPDR" +AT91C_PWMC_CH1_CUPDR.description="Channel Update Register" +AT91C_PWMC_CH1_CUPDR.helpkey="Channel Update Register" +AT91C_PWMC_CH1_CUPDR.access=memorymapped +AT91C_PWMC_CH1_CUPDR.address=0xFFFCC230 +AT91C_PWMC_CH1_CUPDR.width=32 +AT91C_PWMC_CH1_CUPDR.byteEndian=little +AT91C_PWMC_CH1_CUPDR.type=enum +AT91C_PWMC_CH1_CUPDR.enum.0.name=*** Write only *** +AT91C_PWMC_CH1_CUPDR.enum.1.name=Error +AT91C_PWMC_CH1_CPRDR.name="AT91C_PWMC_CH1_CPRDR" +AT91C_PWMC_CH1_CPRDR.description="Channel Period Register" +AT91C_PWMC_CH1_CPRDR.helpkey="Channel Period Register" +AT91C_PWMC_CH1_CPRDR.access=memorymapped +AT91C_PWMC_CH1_CPRDR.address=0xFFFCC228 +AT91C_PWMC_CH1_CPRDR.width=32 +AT91C_PWMC_CH1_CPRDR.byteEndian=little +AT91C_PWMC_CH1_CCNTR.name="AT91C_PWMC_CH1_CCNTR" +AT91C_PWMC_CH1_CCNTR.description="Channel Counter Register" +AT91C_PWMC_CH1_CCNTR.helpkey="Channel Counter Register" +AT91C_PWMC_CH1_CCNTR.access=memorymapped +AT91C_PWMC_CH1_CCNTR.address=0xFFFCC22C +AT91C_PWMC_CH1_CCNTR.width=32 +AT91C_PWMC_CH1_CCNTR.byteEndian=little +AT91C_PWMC_CH1_CCNTR.permission.write=none +AT91C_PWMC_CH1_CDTYR.name="AT91C_PWMC_CH1_CDTYR" +AT91C_PWMC_CH1_CDTYR.description="Channel Duty Cycle Register" +AT91C_PWMC_CH1_CDTYR.helpkey="Channel Duty Cycle Register" +AT91C_PWMC_CH1_CDTYR.access=memorymapped +AT91C_PWMC_CH1_CDTYR.address=0xFFFCC224 +AT91C_PWMC_CH1_CDTYR.width=32 +AT91C_PWMC_CH1_CDTYR.byteEndian=little +AT91C_PWMC_CH1_CMR.name="AT91C_PWMC_CH1_CMR" +AT91C_PWMC_CH1_CMR.description="Channel Mode Register" +AT91C_PWMC_CH1_CMR.helpkey="Channel Mode Register" +AT91C_PWMC_CH1_CMR.access=memorymapped +AT91C_PWMC_CH1_CMR.address=0xFFFCC220 +AT91C_PWMC_CH1_CMR.width=32 +AT91C_PWMC_CH1_CMR.byteEndian=little +# ========== Register definition for PWMC_CH0 peripheral ========== +AT91C_PWMC_CH0_Reserved.name="AT91C_PWMC_CH0_Reserved" +AT91C_PWMC_CH0_Reserved.description="Reserved" +AT91C_PWMC_CH0_Reserved.helpkey="Reserved" +AT91C_PWMC_CH0_Reserved.access=memorymapped +AT91C_PWMC_CH0_Reserved.address=0xFFFCC214 +AT91C_PWMC_CH0_Reserved.width=32 +AT91C_PWMC_CH0_Reserved.byteEndian=little +AT91C_PWMC_CH0_Reserved.type=enum +AT91C_PWMC_CH0_Reserved.enum.0.name=*** Write only *** +AT91C_PWMC_CH0_Reserved.enum.1.name=Error +AT91C_PWMC_CH0_CPRDR.name="AT91C_PWMC_CH0_CPRDR" +AT91C_PWMC_CH0_CPRDR.description="Channel Period Register" +AT91C_PWMC_CH0_CPRDR.helpkey="Channel Period Register" +AT91C_PWMC_CH0_CPRDR.access=memorymapped +AT91C_PWMC_CH0_CPRDR.address=0xFFFCC208 +AT91C_PWMC_CH0_CPRDR.width=32 +AT91C_PWMC_CH0_CPRDR.byteEndian=little +AT91C_PWMC_CH0_CDTYR.name="AT91C_PWMC_CH0_CDTYR" +AT91C_PWMC_CH0_CDTYR.description="Channel Duty Cycle Register" +AT91C_PWMC_CH0_CDTYR.helpkey="Channel Duty Cycle Register" +AT91C_PWMC_CH0_CDTYR.access=memorymapped +AT91C_PWMC_CH0_CDTYR.address=0xFFFCC204 +AT91C_PWMC_CH0_CDTYR.width=32 +AT91C_PWMC_CH0_CDTYR.byteEndian=little +AT91C_PWMC_CH0_CMR.name="AT91C_PWMC_CH0_CMR" +AT91C_PWMC_CH0_CMR.description="Channel Mode Register" +AT91C_PWMC_CH0_CMR.helpkey="Channel Mode Register" +AT91C_PWMC_CH0_CMR.access=memorymapped +AT91C_PWMC_CH0_CMR.address=0xFFFCC200 +AT91C_PWMC_CH0_CMR.width=32 +AT91C_PWMC_CH0_CMR.byteEndian=little +AT91C_PWMC_CH0_CUPDR.name="AT91C_PWMC_CH0_CUPDR" +AT91C_PWMC_CH0_CUPDR.description="Channel Update Register" +AT91C_PWMC_CH0_CUPDR.helpkey="Channel Update Register" +AT91C_PWMC_CH0_CUPDR.access=memorymapped +AT91C_PWMC_CH0_CUPDR.address=0xFFFCC210 +AT91C_PWMC_CH0_CUPDR.width=32 +AT91C_PWMC_CH0_CUPDR.byteEndian=little +AT91C_PWMC_CH0_CUPDR.type=enum +AT91C_PWMC_CH0_CUPDR.enum.0.name=*** Write only *** +AT91C_PWMC_CH0_CUPDR.enum.1.name=Error +AT91C_PWMC_CH0_CCNTR.name="AT91C_PWMC_CH0_CCNTR" +AT91C_PWMC_CH0_CCNTR.description="Channel Counter Register" +AT91C_PWMC_CH0_CCNTR.helpkey="Channel Counter Register" +AT91C_PWMC_CH0_CCNTR.access=memorymapped +AT91C_PWMC_CH0_CCNTR.address=0xFFFCC20C +AT91C_PWMC_CH0_CCNTR.width=32 +AT91C_PWMC_CH0_CCNTR.byteEndian=little +AT91C_PWMC_CH0_CCNTR.permission.write=none +# ========== Register definition for PWMC peripheral ========== +AT91C_PWMC_IDR.name="AT91C_PWMC_IDR" +AT91C_PWMC_IDR.description="PWMC Interrupt Disable Register" +AT91C_PWMC_IDR.helpkey="PWMC Interrupt Disable Register" +AT91C_PWMC_IDR.access=memorymapped +AT91C_PWMC_IDR.address=0xFFFCC014 +AT91C_PWMC_IDR.width=32 +AT91C_PWMC_IDR.byteEndian=little +AT91C_PWMC_IDR.type=enum +AT91C_PWMC_IDR.enum.0.name=*** Write only *** +AT91C_PWMC_IDR.enum.1.name=Error +AT91C_PWMC_DIS.name="AT91C_PWMC_DIS" +AT91C_PWMC_DIS.description="PWMC Disable Register" +AT91C_PWMC_DIS.helpkey="PWMC Disable Register" +AT91C_PWMC_DIS.access=memorymapped +AT91C_PWMC_DIS.address=0xFFFCC008 +AT91C_PWMC_DIS.width=32 +AT91C_PWMC_DIS.byteEndian=little +AT91C_PWMC_DIS.type=enum +AT91C_PWMC_DIS.enum.0.name=*** Write only *** +AT91C_PWMC_DIS.enum.1.name=Error +AT91C_PWMC_IER.name="AT91C_PWMC_IER" +AT91C_PWMC_IER.description="PWMC Interrupt Enable Register" +AT91C_PWMC_IER.helpkey="PWMC Interrupt Enable Register" +AT91C_PWMC_IER.access=memorymapped +AT91C_PWMC_IER.address=0xFFFCC010 +AT91C_PWMC_IER.width=32 +AT91C_PWMC_IER.byteEndian=little +AT91C_PWMC_IER.type=enum +AT91C_PWMC_IER.enum.0.name=*** Write only *** +AT91C_PWMC_IER.enum.1.name=Error +AT91C_PWMC_VR.name="AT91C_PWMC_VR" +AT91C_PWMC_VR.description="PWMC Version Register" +AT91C_PWMC_VR.helpkey="PWMC Version Register" +AT91C_PWMC_VR.access=memorymapped +AT91C_PWMC_VR.address=0xFFFCC0FC +AT91C_PWMC_VR.width=32 +AT91C_PWMC_VR.byteEndian=little +AT91C_PWMC_VR.permission.write=none +AT91C_PWMC_ISR.name="AT91C_PWMC_ISR" +AT91C_PWMC_ISR.description="PWMC Interrupt Status Register" +AT91C_PWMC_ISR.helpkey="PWMC Interrupt Status Register" +AT91C_PWMC_ISR.access=memorymapped +AT91C_PWMC_ISR.address=0xFFFCC01C +AT91C_PWMC_ISR.width=32 +AT91C_PWMC_ISR.byteEndian=little +AT91C_PWMC_ISR.permission.write=none +AT91C_PWMC_SR.name="AT91C_PWMC_SR" +AT91C_PWMC_SR.description="PWMC Status Register" +AT91C_PWMC_SR.helpkey="PWMC Status Register" +AT91C_PWMC_SR.access=memorymapped +AT91C_PWMC_SR.address=0xFFFCC00C +AT91C_PWMC_SR.width=32 +AT91C_PWMC_SR.byteEndian=little +AT91C_PWMC_SR.permission.write=none +AT91C_PWMC_IMR.name="AT91C_PWMC_IMR" +AT91C_PWMC_IMR.description="PWMC Interrupt Mask Register" +AT91C_PWMC_IMR.helpkey="PWMC Interrupt Mask Register" +AT91C_PWMC_IMR.access=memorymapped +AT91C_PWMC_IMR.address=0xFFFCC018 +AT91C_PWMC_IMR.width=32 +AT91C_PWMC_IMR.byteEndian=little +AT91C_PWMC_IMR.permission.write=none +AT91C_PWMC_MR.name="AT91C_PWMC_MR" +AT91C_PWMC_MR.description="PWMC Mode Register" +AT91C_PWMC_MR.helpkey="PWMC Mode Register" +AT91C_PWMC_MR.access=memorymapped +AT91C_PWMC_MR.address=0xFFFCC000 +AT91C_PWMC_MR.width=32 +AT91C_PWMC_MR.byteEndian=little +AT91C_PWMC_ENA.name="AT91C_PWMC_ENA" +AT91C_PWMC_ENA.description="PWMC Enable Register" +AT91C_PWMC_ENA.helpkey="PWMC Enable Register" +AT91C_PWMC_ENA.access=memorymapped +AT91C_PWMC_ENA.address=0xFFFCC004 +AT91C_PWMC_ENA.width=32 +AT91C_PWMC_ENA.byteEndian=little +AT91C_PWMC_ENA.type=enum +AT91C_PWMC_ENA.enum.0.name=*** Write only *** +AT91C_PWMC_ENA.enum.1.name=Error +# ========== Register definition for UDP peripheral ========== +AT91C_UDP_IMR.name="AT91C_UDP_IMR" +AT91C_UDP_IMR.description="Interrupt Mask Register" +AT91C_UDP_IMR.helpkey="Interrupt Mask Register" +AT91C_UDP_IMR.access=memorymapped +AT91C_UDP_IMR.address=0xFFFB0018 +AT91C_UDP_IMR.width=32 +AT91C_UDP_IMR.byteEndian=little +AT91C_UDP_IMR.permission.write=none +AT91C_UDP_FADDR.name="AT91C_UDP_FADDR" +AT91C_UDP_FADDR.description="Function Address Register" +AT91C_UDP_FADDR.helpkey="Function Address Register" +AT91C_UDP_FADDR.access=memorymapped +AT91C_UDP_FADDR.address=0xFFFB0008 +AT91C_UDP_FADDR.width=32 +AT91C_UDP_FADDR.byteEndian=little +AT91C_UDP_NUM.name="AT91C_UDP_NUM" +AT91C_UDP_NUM.description="Frame Number Register" +AT91C_UDP_NUM.helpkey="Frame Number Register" +AT91C_UDP_NUM.access=memorymapped +AT91C_UDP_NUM.address=0xFFFB0000 +AT91C_UDP_NUM.width=32 +AT91C_UDP_NUM.byteEndian=little +AT91C_UDP_NUM.permission.write=none +AT91C_UDP_FDR.name="AT91C_UDP_FDR" +AT91C_UDP_FDR.description="Endpoint FIFO Data Register" +AT91C_UDP_FDR.helpkey="Endpoint FIFO Data Register" +AT91C_UDP_FDR.access=memorymapped +AT91C_UDP_FDR.address=0xFFFB0050 +AT91C_UDP_FDR.width=32 +AT91C_UDP_FDR.byteEndian=little +AT91C_UDP_ISR.name="AT91C_UDP_ISR" +AT91C_UDP_ISR.description="Interrupt Status Register" +AT91C_UDP_ISR.helpkey="Interrupt Status Register" +AT91C_UDP_ISR.access=memorymapped +AT91C_UDP_ISR.address=0xFFFB001C +AT91C_UDP_ISR.width=32 +AT91C_UDP_ISR.byteEndian=little +AT91C_UDP_ISR.permission.write=none +AT91C_UDP_CSR.name="AT91C_UDP_CSR" +AT91C_UDP_CSR.description="Endpoint Control and Status Register" +AT91C_UDP_CSR.helpkey="Endpoint Control and Status Register" +AT91C_UDP_CSR.access=memorymapped +AT91C_UDP_CSR.address=0xFFFB0030 +AT91C_UDP_CSR.width=32 +AT91C_UDP_CSR.byteEndian=little +AT91C_UDP_IDR.name="AT91C_UDP_IDR" +AT91C_UDP_IDR.description="Interrupt Disable Register" +AT91C_UDP_IDR.helpkey="Interrupt Disable Register" +AT91C_UDP_IDR.access=memorymapped +AT91C_UDP_IDR.address=0xFFFB0014 +AT91C_UDP_IDR.width=32 +AT91C_UDP_IDR.byteEndian=little +AT91C_UDP_IDR.type=enum +AT91C_UDP_IDR.enum.0.name=*** Write only *** +AT91C_UDP_IDR.enum.1.name=Error +AT91C_UDP_ICR.name="AT91C_UDP_ICR" +AT91C_UDP_ICR.description="Interrupt Clear Register" +AT91C_UDP_ICR.helpkey="Interrupt Clear Register" +AT91C_UDP_ICR.access=memorymapped +AT91C_UDP_ICR.address=0xFFFB0020 +AT91C_UDP_ICR.width=32 +AT91C_UDP_ICR.byteEndian=little +AT91C_UDP_ICR.permission.write=none +AT91C_UDP_RSTEP.name="AT91C_UDP_RSTEP" +AT91C_UDP_RSTEP.description="Reset Endpoint Register" +AT91C_UDP_RSTEP.helpkey="Reset Endpoint Register" +AT91C_UDP_RSTEP.access=memorymapped +AT91C_UDP_RSTEP.address=0xFFFB0028 +AT91C_UDP_RSTEP.width=32 +AT91C_UDP_RSTEP.byteEndian=little +AT91C_UDP_RSTEP.permission.write=none +AT91C_UDP_TXVC.name="AT91C_UDP_TXVC" +AT91C_UDP_TXVC.description="Transceiver Control Register" +AT91C_UDP_TXVC.helpkey="Transceiver Control Register" +AT91C_UDP_TXVC.access=memorymapped +AT91C_UDP_TXVC.address=0xFFFB0074 +AT91C_UDP_TXVC.width=32 +AT91C_UDP_TXVC.byteEndian=little +AT91C_UDP_GLBSTATE.name="AT91C_UDP_GLBSTATE" +AT91C_UDP_GLBSTATE.description="Global State Register" +AT91C_UDP_GLBSTATE.helpkey="Global State Register" +AT91C_UDP_GLBSTATE.access=memorymapped +AT91C_UDP_GLBSTATE.address=0xFFFB0004 +AT91C_UDP_GLBSTATE.width=32 +AT91C_UDP_GLBSTATE.byteEndian=little +AT91C_UDP_IER.name="AT91C_UDP_IER" +AT91C_UDP_IER.description="Interrupt Enable Register" +AT91C_UDP_IER.helpkey="Interrupt Enable Register" +AT91C_UDP_IER.access=memorymapped +AT91C_UDP_IER.address=0xFFFB0010 +AT91C_UDP_IER.width=32 +AT91C_UDP_IER.byteEndian=little +AT91C_UDP_IER.type=enum +AT91C_UDP_IER.enum.0.name=*** Write only *** +AT91C_UDP_IER.enum.1.name=Error +# ========== Register definition for TC0 peripheral ========== +AT91C_TC0_SR.name="AT91C_TC0_SR" +AT91C_TC0_SR.description="Status Register" +AT91C_TC0_SR.helpkey="Status Register" +AT91C_TC0_SR.access=memorymapped +AT91C_TC0_SR.address=0xFFFA0020 +AT91C_TC0_SR.width=32 +AT91C_TC0_SR.byteEndian=little +AT91C_TC0_SR.permission.write=none +AT91C_TC0_RC.name="AT91C_TC0_RC" +AT91C_TC0_RC.description="Register C" +AT91C_TC0_RC.helpkey="Register C" +AT91C_TC0_RC.access=memorymapped +AT91C_TC0_RC.address=0xFFFA001C +AT91C_TC0_RC.width=32 +AT91C_TC0_RC.byteEndian=little +AT91C_TC0_RB.name="AT91C_TC0_RB" +AT91C_TC0_RB.description="Register B" +AT91C_TC0_RB.helpkey="Register B" +AT91C_TC0_RB.access=memorymapped +AT91C_TC0_RB.address=0xFFFA0018 +AT91C_TC0_RB.width=32 +AT91C_TC0_RB.byteEndian=little +AT91C_TC0_CCR.name="AT91C_TC0_CCR" +AT91C_TC0_CCR.description="Channel Control Register" +AT91C_TC0_CCR.helpkey="Channel Control Register" +AT91C_TC0_CCR.access=memorymapped +AT91C_TC0_CCR.address=0xFFFA0000 +AT91C_TC0_CCR.width=32 +AT91C_TC0_CCR.byteEndian=little +AT91C_TC0_CCR.type=enum +AT91C_TC0_CCR.enum.0.name=*** Write only *** +AT91C_TC0_CCR.enum.1.name=Error +AT91C_TC0_CMR.name="AT91C_TC0_CMR" +AT91C_TC0_CMR.description="Channel Mode Register (Capture Mode / Waveform Mode)" +AT91C_TC0_CMR.helpkey="Channel Mode Register (Capture Mode / Waveform Mode)" +AT91C_TC0_CMR.access=memorymapped +AT91C_TC0_CMR.address=0xFFFA0004 +AT91C_TC0_CMR.width=32 +AT91C_TC0_CMR.byteEndian=little +AT91C_TC0_IER.name="AT91C_TC0_IER" +AT91C_TC0_IER.description="Interrupt Enable Register" +AT91C_TC0_IER.helpkey="Interrupt Enable Register" +AT91C_TC0_IER.access=memorymapped +AT91C_TC0_IER.address=0xFFFA0024 +AT91C_TC0_IER.width=32 +AT91C_TC0_IER.byteEndian=little +AT91C_TC0_IER.type=enum +AT91C_TC0_IER.enum.0.name=*** Write only *** +AT91C_TC0_IER.enum.1.name=Error +AT91C_TC0_RA.name="AT91C_TC0_RA" +AT91C_TC0_RA.description="Register A" +AT91C_TC0_RA.helpkey="Register A" +AT91C_TC0_RA.access=memorymapped +AT91C_TC0_RA.address=0xFFFA0014 +AT91C_TC0_RA.width=32 +AT91C_TC0_RA.byteEndian=little +AT91C_TC0_IDR.name="AT91C_TC0_IDR" +AT91C_TC0_IDR.description="Interrupt Disable Register" +AT91C_TC0_IDR.helpkey="Interrupt Disable Register" +AT91C_TC0_IDR.access=memorymapped +AT91C_TC0_IDR.address=0xFFFA0028 +AT91C_TC0_IDR.width=32 +AT91C_TC0_IDR.byteEndian=little +AT91C_TC0_IDR.type=enum +AT91C_TC0_IDR.enum.0.name=*** Write only *** +AT91C_TC0_IDR.enum.1.name=Error +AT91C_TC0_CV.name="AT91C_TC0_CV" +AT91C_TC0_CV.description="Counter Value" +AT91C_TC0_CV.helpkey="Counter Value" +AT91C_TC0_CV.access=memorymapped +AT91C_TC0_CV.address=0xFFFA0010 +AT91C_TC0_CV.width=32 +AT91C_TC0_CV.byteEndian=little +AT91C_TC0_IMR.name="AT91C_TC0_IMR" +AT91C_TC0_IMR.description="Interrupt Mask Register" +AT91C_TC0_IMR.helpkey="Interrupt Mask Register" +AT91C_TC0_IMR.access=memorymapped +AT91C_TC0_IMR.address=0xFFFA002C +AT91C_TC0_IMR.width=32 +AT91C_TC0_IMR.byteEndian=little +AT91C_TC0_IMR.permission.write=none +# ========== Register definition for TC1 peripheral ========== +AT91C_TC1_RB.name="AT91C_TC1_RB" +AT91C_TC1_RB.description="Register B" +AT91C_TC1_RB.helpkey="Register B" +AT91C_TC1_RB.access=memorymapped +AT91C_TC1_RB.address=0xFFFA0058 +AT91C_TC1_RB.width=32 +AT91C_TC1_RB.byteEndian=little +AT91C_TC1_CCR.name="AT91C_TC1_CCR" +AT91C_TC1_CCR.description="Channel Control Register" +AT91C_TC1_CCR.helpkey="Channel Control Register" +AT91C_TC1_CCR.access=memorymapped +AT91C_TC1_CCR.address=0xFFFA0040 +AT91C_TC1_CCR.width=32 +AT91C_TC1_CCR.byteEndian=little +AT91C_TC1_CCR.type=enum +AT91C_TC1_CCR.enum.0.name=*** Write only *** +AT91C_TC1_CCR.enum.1.name=Error +AT91C_TC1_IER.name="AT91C_TC1_IER" +AT91C_TC1_IER.description="Interrupt Enable Register" +AT91C_TC1_IER.helpkey="Interrupt Enable Register" +AT91C_TC1_IER.access=memorymapped +AT91C_TC1_IER.address=0xFFFA0064 +AT91C_TC1_IER.width=32 +AT91C_TC1_IER.byteEndian=little +AT91C_TC1_IER.type=enum +AT91C_TC1_IER.enum.0.name=*** Write only *** +AT91C_TC1_IER.enum.1.name=Error +AT91C_TC1_IDR.name="AT91C_TC1_IDR" +AT91C_TC1_IDR.description="Interrupt Disable Register" +AT91C_TC1_IDR.helpkey="Interrupt Disable Register" +AT91C_TC1_IDR.access=memorymapped +AT91C_TC1_IDR.address=0xFFFA0068 +AT91C_TC1_IDR.width=32 +AT91C_TC1_IDR.byteEndian=little +AT91C_TC1_IDR.type=enum +AT91C_TC1_IDR.enum.0.name=*** Write only *** +AT91C_TC1_IDR.enum.1.name=Error +AT91C_TC1_SR.name="AT91C_TC1_SR" +AT91C_TC1_SR.description="Status Register" +AT91C_TC1_SR.helpkey="Status Register" +AT91C_TC1_SR.access=memorymapped +AT91C_TC1_SR.address=0xFFFA0060 +AT91C_TC1_SR.width=32 +AT91C_TC1_SR.byteEndian=little +AT91C_TC1_SR.permission.write=none +AT91C_TC1_CMR.name="AT91C_TC1_CMR" +AT91C_TC1_CMR.description="Channel Mode Register (Capture Mode / Waveform Mode)" +AT91C_TC1_CMR.helpkey="Channel Mode Register (Capture Mode / Waveform Mode)" +AT91C_TC1_CMR.access=memorymapped +AT91C_TC1_CMR.address=0xFFFA0044 +AT91C_TC1_CMR.width=32 +AT91C_TC1_CMR.byteEndian=little +AT91C_TC1_RA.name="AT91C_TC1_RA" +AT91C_TC1_RA.description="Register A" +AT91C_TC1_RA.helpkey="Register A" +AT91C_TC1_RA.access=memorymapped +AT91C_TC1_RA.address=0xFFFA0054 +AT91C_TC1_RA.width=32 +AT91C_TC1_RA.byteEndian=little +AT91C_TC1_RC.name="AT91C_TC1_RC" +AT91C_TC1_RC.description="Register C" +AT91C_TC1_RC.helpkey="Register C" +AT91C_TC1_RC.access=memorymapped +AT91C_TC1_RC.address=0xFFFA005C +AT91C_TC1_RC.width=32 +AT91C_TC1_RC.byteEndian=little +AT91C_TC1_IMR.name="AT91C_TC1_IMR" +AT91C_TC1_IMR.description="Interrupt Mask Register" +AT91C_TC1_IMR.helpkey="Interrupt Mask Register" +AT91C_TC1_IMR.access=memorymapped +AT91C_TC1_IMR.address=0xFFFA006C +AT91C_TC1_IMR.width=32 +AT91C_TC1_IMR.byteEndian=little +AT91C_TC1_IMR.permission.write=none +AT91C_TC1_CV.name="AT91C_TC1_CV" +AT91C_TC1_CV.description="Counter Value" +AT91C_TC1_CV.helpkey="Counter Value" +AT91C_TC1_CV.access=memorymapped +AT91C_TC1_CV.address=0xFFFA0050 +AT91C_TC1_CV.width=32 +AT91C_TC1_CV.byteEndian=little +# ========== Register definition for TC2 peripheral ========== +AT91C_TC2_CMR.name="AT91C_TC2_CMR" +AT91C_TC2_CMR.description="Channel Mode Register (Capture Mode / Waveform Mode)" +AT91C_TC2_CMR.helpkey="Channel Mode Register (Capture Mode / Waveform Mode)" +AT91C_TC2_CMR.access=memorymapped +AT91C_TC2_CMR.address=0xFFFA0084 +AT91C_TC2_CMR.width=32 +AT91C_TC2_CMR.byteEndian=little +AT91C_TC2_CCR.name="AT91C_TC2_CCR" +AT91C_TC2_CCR.description="Channel Control Register" +AT91C_TC2_CCR.helpkey="Channel Control Register" +AT91C_TC2_CCR.access=memorymapped +AT91C_TC2_CCR.address=0xFFFA0080 +AT91C_TC2_CCR.width=32 +AT91C_TC2_CCR.byteEndian=little +AT91C_TC2_CCR.type=enum +AT91C_TC2_CCR.enum.0.name=*** Write only *** +AT91C_TC2_CCR.enum.1.name=Error +AT91C_TC2_CV.name="AT91C_TC2_CV" +AT91C_TC2_CV.description="Counter Value" +AT91C_TC2_CV.helpkey="Counter Value" +AT91C_TC2_CV.access=memorymapped +AT91C_TC2_CV.address=0xFFFA0090 +AT91C_TC2_CV.width=32 +AT91C_TC2_CV.byteEndian=little +AT91C_TC2_RA.name="AT91C_TC2_RA" +AT91C_TC2_RA.description="Register A" +AT91C_TC2_RA.helpkey="Register A" +AT91C_TC2_RA.access=memorymapped +AT91C_TC2_RA.address=0xFFFA0094 +AT91C_TC2_RA.width=32 +AT91C_TC2_RA.byteEndian=little +AT91C_TC2_RB.name="AT91C_TC2_RB" +AT91C_TC2_RB.description="Register B" +AT91C_TC2_RB.helpkey="Register B" +AT91C_TC2_RB.access=memorymapped +AT91C_TC2_RB.address=0xFFFA0098 +AT91C_TC2_RB.width=32 +AT91C_TC2_RB.byteEndian=little +AT91C_TC2_IDR.name="AT91C_TC2_IDR" +AT91C_TC2_IDR.description="Interrupt Disable Register" +AT91C_TC2_IDR.helpkey="Interrupt Disable Register" +AT91C_TC2_IDR.access=memorymapped +AT91C_TC2_IDR.address=0xFFFA00A8 +AT91C_TC2_IDR.width=32 +AT91C_TC2_IDR.byteEndian=little +AT91C_TC2_IDR.type=enum +AT91C_TC2_IDR.enum.0.name=*** Write only *** +AT91C_TC2_IDR.enum.1.name=Error +AT91C_TC2_IMR.name="AT91C_TC2_IMR" +AT91C_TC2_IMR.description="Interrupt Mask Register" +AT91C_TC2_IMR.helpkey="Interrupt Mask Register" +AT91C_TC2_IMR.access=memorymapped +AT91C_TC2_IMR.address=0xFFFA00AC +AT91C_TC2_IMR.width=32 +AT91C_TC2_IMR.byteEndian=little +AT91C_TC2_IMR.permission.write=none +AT91C_TC2_RC.name="AT91C_TC2_RC" +AT91C_TC2_RC.description="Register C" +AT91C_TC2_RC.helpkey="Register C" +AT91C_TC2_RC.access=memorymapped +AT91C_TC2_RC.address=0xFFFA009C +AT91C_TC2_RC.width=32 +AT91C_TC2_RC.byteEndian=little +AT91C_TC2_IER.name="AT91C_TC2_IER" +AT91C_TC2_IER.description="Interrupt Enable Register" +AT91C_TC2_IER.helpkey="Interrupt Enable Register" +AT91C_TC2_IER.access=memorymapped +AT91C_TC2_IER.address=0xFFFA00A4 +AT91C_TC2_IER.width=32 +AT91C_TC2_IER.byteEndian=little +AT91C_TC2_IER.type=enum +AT91C_TC2_IER.enum.0.name=*** Write only *** +AT91C_TC2_IER.enum.1.name=Error +AT91C_TC2_SR.name="AT91C_TC2_SR" +AT91C_TC2_SR.description="Status Register" +AT91C_TC2_SR.helpkey="Status Register" +AT91C_TC2_SR.access=memorymapped +AT91C_TC2_SR.address=0xFFFA00A0 +AT91C_TC2_SR.width=32 +AT91C_TC2_SR.byteEndian=little +AT91C_TC2_SR.permission.write=none +# ========== Register definition for TCB peripheral ========== +AT91C_TCB_BMR.name="AT91C_TCB_BMR" +AT91C_TCB_BMR.description="TC Block Mode Register" +AT91C_TCB_BMR.helpkey="TC Block Mode Register" +AT91C_TCB_BMR.access=memorymapped +AT91C_TCB_BMR.address=0xFFFA00C4 +AT91C_TCB_BMR.width=32 +AT91C_TCB_BMR.byteEndian=little +AT91C_TCB_BCR.name="AT91C_TCB_BCR" +AT91C_TCB_BCR.description="TC Block Control Register" +AT91C_TCB_BCR.helpkey="TC Block Control Register" +AT91C_TCB_BCR.access=memorymapped +AT91C_TCB_BCR.address=0xFFFA00C0 +AT91C_TCB_BCR.width=32 +AT91C_TCB_BCR.byteEndian=little +AT91C_TCB_BCR.type=enum +AT91C_TCB_BCR.enum.0.name=*** Write only *** +AT91C_TCB_BCR.enum.1.name=Error +# ========== Register definition for CAN_MB0 peripheral ========== +AT91C_CAN_MB0_MDL.name="AT91C_CAN_MB0_MDL" +AT91C_CAN_MB0_MDL.description="MailBox Data Low Register" +AT91C_CAN_MB0_MDL.helpkey="MailBox Data Low Register" +AT91C_CAN_MB0_MDL.access=memorymapped +AT91C_CAN_MB0_MDL.address=0xFFFD0214 +AT91C_CAN_MB0_MDL.width=32 +AT91C_CAN_MB0_MDL.byteEndian=little +AT91C_CAN_MB0_MAM.name="AT91C_CAN_MB0_MAM" +AT91C_CAN_MB0_MAM.description="MailBox Acceptance Mask Register" +AT91C_CAN_MB0_MAM.helpkey="MailBox Acceptance Mask Register" +AT91C_CAN_MB0_MAM.access=memorymapped +AT91C_CAN_MB0_MAM.address=0xFFFD0204 +AT91C_CAN_MB0_MAM.width=32 +AT91C_CAN_MB0_MAM.byteEndian=little +AT91C_CAN_MB0_MCR.name="AT91C_CAN_MB0_MCR" +AT91C_CAN_MB0_MCR.description="MailBox Control Register" +AT91C_CAN_MB0_MCR.helpkey="MailBox Control Register" +AT91C_CAN_MB0_MCR.access=memorymapped +AT91C_CAN_MB0_MCR.address=0xFFFD021C +AT91C_CAN_MB0_MCR.width=32 +AT91C_CAN_MB0_MCR.byteEndian=little +AT91C_CAN_MB0_MCR.type=enum +AT91C_CAN_MB0_MCR.enum.0.name=*** Write only *** +AT91C_CAN_MB0_MCR.enum.1.name=Error +AT91C_CAN_MB0_MID.name="AT91C_CAN_MB0_MID" +AT91C_CAN_MB0_MID.description="MailBox ID Register" +AT91C_CAN_MB0_MID.helpkey="MailBox ID Register" +AT91C_CAN_MB0_MID.access=memorymapped +AT91C_CAN_MB0_MID.address=0xFFFD0208 +AT91C_CAN_MB0_MID.width=32 +AT91C_CAN_MB0_MID.byteEndian=little +AT91C_CAN_MB0_MSR.name="AT91C_CAN_MB0_MSR" +AT91C_CAN_MB0_MSR.description="MailBox Status Register" +AT91C_CAN_MB0_MSR.helpkey="MailBox Status Register" +AT91C_CAN_MB0_MSR.access=memorymapped +AT91C_CAN_MB0_MSR.address=0xFFFD0210 +AT91C_CAN_MB0_MSR.width=32 +AT91C_CAN_MB0_MSR.byteEndian=little +AT91C_CAN_MB0_MSR.permission.write=none +AT91C_CAN_MB0_MFID.name="AT91C_CAN_MB0_MFID" +AT91C_CAN_MB0_MFID.description="MailBox Family ID Register" +AT91C_CAN_MB0_MFID.helpkey="MailBox Family ID Register" +AT91C_CAN_MB0_MFID.access=memorymapped +AT91C_CAN_MB0_MFID.address=0xFFFD020C +AT91C_CAN_MB0_MFID.width=32 +AT91C_CAN_MB0_MFID.byteEndian=little +AT91C_CAN_MB0_MFID.permission.write=none +AT91C_CAN_MB0_MDH.name="AT91C_CAN_MB0_MDH" +AT91C_CAN_MB0_MDH.description="MailBox Data High Register" +AT91C_CAN_MB0_MDH.helpkey="MailBox Data High Register" +AT91C_CAN_MB0_MDH.access=memorymapped +AT91C_CAN_MB0_MDH.address=0xFFFD0218 +AT91C_CAN_MB0_MDH.width=32 +AT91C_CAN_MB0_MDH.byteEndian=little +AT91C_CAN_MB0_MMR.name="AT91C_CAN_MB0_MMR" +AT91C_CAN_MB0_MMR.description="MailBox Mode Register" +AT91C_CAN_MB0_MMR.helpkey="MailBox Mode Register" +AT91C_CAN_MB0_MMR.access=memorymapped +AT91C_CAN_MB0_MMR.address=0xFFFD0200 +AT91C_CAN_MB0_MMR.width=32 +AT91C_CAN_MB0_MMR.byteEndian=little +# ========== Register definition for CAN_MB1 peripheral ========== +AT91C_CAN_MB1_MDL.name="AT91C_CAN_MB1_MDL" +AT91C_CAN_MB1_MDL.description="MailBox Data Low Register" +AT91C_CAN_MB1_MDL.helpkey="MailBox Data Low Register" +AT91C_CAN_MB1_MDL.access=memorymapped +AT91C_CAN_MB1_MDL.address=0xFFFD0234 +AT91C_CAN_MB1_MDL.width=32 +AT91C_CAN_MB1_MDL.byteEndian=little +AT91C_CAN_MB1_MID.name="AT91C_CAN_MB1_MID" +AT91C_CAN_MB1_MID.description="MailBox ID Register" +AT91C_CAN_MB1_MID.helpkey="MailBox ID Register" +AT91C_CAN_MB1_MID.access=memorymapped +AT91C_CAN_MB1_MID.address=0xFFFD0228 +AT91C_CAN_MB1_MID.width=32 +AT91C_CAN_MB1_MID.byteEndian=little +AT91C_CAN_MB1_MMR.name="AT91C_CAN_MB1_MMR" +AT91C_CAN_MB1_MMR.description="MailBox Mode Register" +AT91C_CAN_MB1_MMR.helpkey="MailBox Mode Register" +AT91C_CAN_MB1_MMR.access=memorymapped +AT91C_CAN_MB1_MMR.address=0xFFFD0220 +AT91C_CAN_MB1_MMR.width=32 +AT91C_CAN_MB1_MMR.byteEndian=little +AT91C_CAN_MB1_MSR.name="AT91C_CAN_MB1_MSR" +AT91C_CAN_MB1_MSR.description="MailBox Status Register" +AT91C_CAN_MB1_MSR.helpkey="MailBox Status Register" +AT91C_CAN_MB1_MSR.access=memorymapped +AT91C_CAN_MB1_MSR.address=0xFFFD0230 +AT91C_CAN_MB1_MSR.width=32 +AT91C_CAN_MB1_MSR.byteEndian=little +AT91C_CAN_MB1_MSR.permission.write=none +AT91C_CAN_MB1_MAM.name="AT91C_CAN_MB1_MAM" +AT91C_CAN_MB1_MAM.description="MailBox Acceptance Mask Register" +AT91C_CAN_MB1_MAM.helpkey="MailBox Acceptance Mask Register" +AT91C_CAN_MB1_MAM.access=memorymapped +AT91C_CAN_MB1_MAM.address=0xFFFD0224 +AT91C_CAN_MB1_MAM.width=32 +AT91C_CAN_MB1_MAM.byteEndian=little +AT91C_CAN_MB1_MDH.name="AT91C_CAN_MB1_MDH" +AT91C_CAN_MB1_MDH.description="MailBox Data High Register" +AT91C_CAN_MB1_MDH.helpkey="MailBox Data High Register" +AT91C_CAN_MB1_MDH.access=memorymapped +AT91C_CAN_MB1_MDH.address=0xFFFD0238 +AT91C_CAN_MB1_MDH.width=32 +AT91C_CAN_MB1_MDH.byteEndian=little +AT91C_CAN_MB1_MCR.name="AT91C_CAN_MB1_MCR" +AT91C_CAN_MB1_MCR.description="MailBox Control Register" +AT91C_CAN_MB1_MCR.helpkey="MailBox Control Register" +AT91C_CAN_MB1_MCR.access=memorymapped +AT91C_CAN_MB1_MCR.address=0xFFFD023C +AT91C_CAN_MB1_MCR.width=32 +AT91C_CAN_MB1_MCR.byteEndian=little +AT91C_CAN_MB1_MCR.type=enum +AT91C_CAN_MB1_MCR.enum.0.name=*** Write only *** +AT91C_CAN_MB1_MCR.enum.1.name=Error +AT91C_CAN_MB1_MFID.name="AT91C_CAN_MB1_MFID" +AT91C_CAN_MB1_MFID.description="MailBox Family ID Register" +AT91C_CAN_MB1_MFID.helpkey="MailBox Family ID Register" +AT91C_CAN_MB1_MFID.access=memorymapped +AT91C_CAN_MB1_MFID.address=0xFFFD022C +AT91C_CAN_MB1_MFID.width=32 +AT91C_CAN_MB1_MFID.byteEndian=little +AT91C_CAN_MB1_MFID.permission.write=none +# ========== Register definition for CAN_MB2 peripheral ========== +AT91C_CAN_MB2_MCR.name="AT91C_CAN_MB2_MCR" +AT91C_CAN_MB2_MCR.description="MailBox Control Register" +AT91C_CAN_MB2_MCR.helpkey="MailBox Control Register" +AT91C_CAN_MB2_MCR.access=memorymapped +AT91C_CAN_MB2_MCR.address=0xFFFD025C +AT91C_CAN_MB2_MCR.width=32 +AT91C_CAN_MB2_MCR.byteEndian=little +AT91C_CAN_MB2_MCR.type=enum +AT91C_CAN_MB2_MCR.enum.0.name=*** Write only *** +AT91C_CAN_MB2_MCR.enum.1.name=Error +AT91C_CAN_MB2_MDH.name="AT91C_CAN_MB2_MDH" +AT91C_CAN_MB2_MDH.description="MailBox Data High Register" +AT91C_CAN_MB2_MDH.helpkey="MailBox Data High Register" +AT91C_CAN_MB2_MDH.access=memorymapped +AT91C_CAN_MB2_MDH.address=0xFFFD0258 +AT91C_CAN_MB2_MDH.width=32 +AT91C_CAN_MB2_MDH.byteEndian=little +AT91C_CAN_MB2_MID.name="AT91C_CAN_MB2_MID" +AT91C_CAN_MB2_MID.description="MailBox ID Register" +AT91C_CAN_MB2_MID.helpkey="MailBox ID Register" +AT91C_CAN_MB2_MID.access=memorymapped +AT91C_CAN_MB2_MID.address=0xFFFD0248 +AT91C_CAN_MB2_MID.width=32 +AT91C_CAN_MB2_MID.byteEndian=little +AT91C_CAN_MB2_MDL.name="AT91C_CAN_MB2_MDL" +AT91C_CAN_MB2_MDL.description="MailBox Data Low Register" +AT91C_CAN_MB2_MDL.helpkey="MailBox Data Low Register" +AT91C_CAN_MB2_MDL.access=memorymapped +AT91C_CAN_MB2_MDL.address=0xFFFD0254 +AT91C_CAN_MB2_MDL.width=32 +AT91C_CAN_MB2_MDL.byteEndian=little +AT91C_CAN_MB2_MMR.name="AT91C_CAN_MB2_MMR" +AT91C_CAN_MB2_MMR.description="MailBox Mode Register" +AT91C_CAN_MB2_MMR.helpkey="MailBox Mode Register" +AT91C_CAN_MB2_MMR.access=memorymapped +AT91C_CAN_MB2_MMR.address=0xFFFD0240 +AT91C_CAN_MB2_MMR.width=32 +AT91C_CAN_MB2_MMR.byteEndian=little +AT91C_CAN_MB2_MAM.name="AT91C_CAN_MB2_MAM" +AT91C_CAN_MB2_MAM.description="MailBox Acceptance Mask Register" +AT91C_CAN_MB2_MAM.helpkey="MailBox Acceptance Mask Register" +AT91C_CAN_MB2_MAM.access=memorymapped +AT91C_CAN_MB2_MAM.address=0xFFFD0244 +AT91C_CAN_MB2_MAM.width=32 +AT91C_CAN_MB2_MAM.byteEndian=little +AT91C_CAN_MB2_MFID.name="AT91C_CAN_MB2_MFID" +AT91C_CAN_MB2_MFID.description="MailBox Family ID Register" +AT91C_CAN_MB2_MFID.helpkey="MailBox Family ID Register" +AT91C_CAN_MB2_MFID.access=memorymapped +AT91C_CAN_MB2_MFID.address=0xFFFD024C +AT91C_CAN_MB2_MFID.width=32 +AT91C_CAN_MB2_MFID.byteEndian=little +AT91C_CAN_MB2_MFID.permission.write=none +AT91C_CAN_MB2_MSR.name="AT91C_CAN_MB2_MSR" +AT91C_CAN_MB2_MSR.description="MailBox Status Register" +AT91C_CAN_MB2_MSR.helpkey="MailBox Status Register" +AT91C_CAN_MB2_MSR.access=memorymapped +AT91C_CAN_MB2_MSR.address=0xFFFD0250 +AT91C_CAN_MB2_MSR.width=32 +AT91C_CAN_MB2_MSR.byteEndian=little +AT91C_CAN_MB2_MSR.permission.write=none +# ========== Register definition for CAN_MB3 peripheral ========== +AT91C_CAN_MB3_MFID.name="AT91C_CAN_MB3_MFID" +AT91C_CAN_MB3_MFID.description="MailBox Family ID Register" +AT91C_CAN_MB3_MFID.helpkey="MailBox Family ID Register" +AT91C_CAN_MB3_MFID.access=memorymapped +AT91C_CAN_MB3_MFID.address=0xFFFD026C +AT91C_CAN_MB3_MFID.width=32 +AT91C_CAN_MB3_MFID.byteEndian=little +AT91C_CAN_MB3_MFID.permission.write=none +AT91C_CAN_MB3_MAM.name="AT91C_CAN_MB3_MAM" +AT91C_CAN_MB3_MAM.description="MailBox Acceptance Mask Register" +AT91C_CAN_MB3_MAM.helpkey="MailBox Acceptance Mask Register" +AT91C_CAN_MB3_MAM.access=memorymapped +AT91C_CAN_MB3_MAM.address=0xFFFD0264 +AT91C_CAN_MB3_MAM.width=32 +AT91C_CAN_MB3_MAM.byteEndian=little +AT91C_CAN_MB3_MID.name="AT91C_CAN_MB3_MID" +AT91C_CAN_MB3_MID.description="MailBox ID Register" +AT91C_CAN_MB3_MID.helpkey="MailBox ID Register" +AT91C_CAN_MB3_MID.access=memorymapped +AT91C_CAN_MB3_MID.address=0xFFFD0268 +AT91C_CAN_MB3_MID.width=32 +AT91C_CAN_MB3_MID.byteEndian=little +AT91C_CAN_MB3_MCR.name="AT91C_CAN_MB3_MCR" +AT91C_CAN_MB3_MCR.description="MailBox Control Register" +AT91C_CAN_MB3_MCR.helpkey="MailBox Control Register" +AT91C_CAN_MB3_MCR.access=memorymapped +AT91C_CAN_MB3_MCR.address=0xFFFD027C +AT91C_CAN_MB3_MCR.width=32 +AT91C_CAN_MB3_MCR.byteEndian=little +AT91C_CAN_MB3_MCR.type=enum +AT91C_CAN_MB3_MCR.enum.0.name=*** Write only *** +AT91C_CAN_MB3_MCR.enum.1.name=Error +AT91C_CAN_MB3_MMR.name="AT91C_CAN_MB3_MMR" +AT91C_CAN_MB3_MMR.description="MailBox Mode Register" +AT91C_CAN_MB3_MMR.helpkey="MailBox Mode Register" +AT91C_CAN_MB3_MMR.access=memorymapped +AT91C_CAN_MB3_MMR.address=0xFFFD0260 +AT91C_CAN_MB3_MMR.width=32 +AT91C_CAN_MB3_MMR.byteEndian=little +AT91C_CAN_MB3_MSR.name="AT91C_CAN_MB3_MSR" +AT91C_CAN_MB3_MSR.description="MailBox Status Register" +AT91C_CAN_MB3_MSR.helpkey="MailBox Status Register" +AT91C_CAN_MB3_MSR.access=memorymapped +AT91C_CAN_MB3_MSR.address=0xFFFD0270 +AT91C_CAN_MB3_MSR.width=32 +AT91C_CAN_MB3_MSR.byteEndian=little +AT91C_CAN_MB3_MSR.permission.write=none +AT91C_CAN_MB3_MDL.name="AT91C_CAN_MB3_MDL" +AT91C_CAN_MB3_MDL.description="MailBox Data Low Register" +AT91C_CAN_MB3_MDL.helpkey="MailBox Data Low Register" +AT91C_CAN_MB3_MDL.access=memorymapped +AT91C_CAN_MB3_MDL.address=0xFFFD0274 +AT91C_CAN_MB3_MDL.width=32 +AT91C_CAN_MB3_MDL.byteEndian=little +AT91C_CAN_MB3_MDH.name="AT91C_CAN_MB3_MDH" +AT91C_CAN_MB3_MDH.description="MailBox Data High Register" +AT91C_CAN_MB3_MDH.helpkey="MailBox Data High Register" +AT91C_CAN_MB3_MDH.access=memorymapped +AT91C_CAN_MB3_MDH.address=0xFFFD0278 +AT91C_CAN_MB3_MDH.width=32 +AT91C_CAN_MB3_MDH.byteEndian=little +# ========== Register definition for CAN_MB4 peripheral ========== +AT91C_CAN_MB4_MID.name="AT91C_CAN_MB4_MID" +AT91C_CAN_MB4_MID.description="MailBox ID Register" +AT91C_CAN_MB4_MID.helpkey="MailBox ID Register" +AT91C_CAN_MB4_MID.access=memorymapped +AT91C_CAN_MB4_MID.address=0xFFFD0288 +AT91C_CAN_MB4_MID.width=32 +AT91C_CAN_MB4_MID.byteEndian=little +AT91C_CAN_MB4_MMR.name="AT91C_CAN_MB4_MMR" +AT91C_CAN_MB4_MMR.description="MailBox Mode Register" +AT91C_CAN_MB4_MMR.helpkey="MailBox Mode Register" +AT91C_CAN_MB4_MMR.access=memorymapped +AT91C_CAN_MB4_MMR.address=0xFFFD0280 +AT91C_CAN_MB4_MMR.width=32 +AT91C_CAN_MB4_MMR.byteEndian=little +AT91C_CAN_MB4_MDH.name="AT91C_CAN_MB4_MDH" +AT91C_CAN_MB4_MDH.description="MailBox Data High Register" +AT91C_CAN_MB4_MDH.helpkey="MailBox Data High Register" +AT91C_CAN_MB4_MDH.access=memorymapped +AT91C_CAN_MB4_MDH.address=0xFFFD0298 +AT91C_CAN_MB4_MDH.width=32 +AT91C_CAN_MB4_MDH.byteEndian=little +AT91C_CAN_MB4_MFID.name="AT91C_CAN_MB4_MFID" +AT91C_CAN_MB4_MFID.description="MailBox Family ID Register" +AT91C_CAN_MB4_MFID.helpkey="MailBox Family ID Register" +AT91C_CAN_MB4_MFID.access=memorymapped +AT91C_CAN_MB4_MFID.address=0xFFFD028C +AT91C_CAN_MB4_MFID.width=32 +AT91C_CAN_MB4_MFID.byteEndian=little +AT91C_CAN_MB4_MFID.permission.write=none +AT91C_CAN_MB4_MSR.name="AT91C_CAN_MB4_MSR" +AT91C_CAN_MB4_MSR.description="MailBox Status Register" +AT91C_CAN_MB4_MSR.helpkey="MailBox Status Register" +AT91C_CAN_MB4_MSR.access=memorymapped +AT91C_CAN_MB4_MSR.address=0xFFFD0290 +AT91C_CAN_MB4_MSR.width=32 +AT91C_CAN_MB4_MSR.byteEndian=little +AT91C_CAN_MB4_MSR.permission.write=none +AT91C_CAN_MB4_MCR.name="AT91C_CAN_MB4_MCR" +AT91C_CAN_MB4_MCR.description="MailBox Control Register" +AT91C_CAN_MB4_MCR.helpkey="MailBox Control Register" +AT91C_CAN_MB4_MCR.access=memorymapped +AT91C_CAN_MB4_MCR.address=0xFFFD029C +AT91C_CAN_MB4_MCR.width=32 +AT91C_CAN_MB4_MCR.byteEndian=little +AT91C_CAN_MB4_MCR.type=enum +AT91C_CAN_MB4_MCR.enum.0.name=*** Write only *** +AT91C_CAN_MB4_MCR.enum.1.name=Error +AT91C_CAN_MB4_MDL.name="AT91C_CAN_MB4_MDL" +AT91C_CAN_MB4_MDL.description="MailBox Data Low Register" +AT91C_CAN_MB4_MDL.helpkey="MailBox Data Low Register" +AT91C_CAN_MB4_MDL.access=memorymapped +AT91C_CAN_MB4_MDL.address=0xFFFD0294 +AT91C_CAN_MB4_MDL.width=32 +AT91C_CAN_MB4_MDL.byteEndian=little +AT91C_CAN_MB4_MAM.name="AT91C_CAN_MB4_MAM" +AT91C_CAN_MB4_MAM.description="MailBox Acceptance Mask Register" +AT91C_CAN_MB4_MAM.helpkey="MailBox Acceptance Mask Register" +AT91C_CAN_MB4_MAM.access=memorymapped +AT91C_CAN_MB4_MAM.address=0xFFFD0284 +AT91C_CAN_MB4_MAM.width=32 +AT91C_CAN_MB4_MAM.byteEndian=little +# ========== Register definition for CAN_MB5 peripheral ========== +AT91C_CAN_MB5_MSR.name="AT91C_CAN_MB5_MSR" +AT91C_CAN_MB5_MSR.description="MailBox Status Register" +AT91C_CAN_MB5_MSR.helpkey="MailBox Status Register" +AT91C_CAN_MB5_MSR.access=memorymapped +AT91C_CAN_MB5_MSR.address=0xFFFD02B0 +AT91C_CAN_MB5_MSR.width=32 +AT91C_CAN_MB5_MSR.byteEndian=little +AT91C_CAN_MB5_MSR.permission.write=none +AT91C_CAN_MB5_MCR.name="AT91C_CAN_MB5_MCR" +AT91C_CAN_MB5_MCR.description="MailBox Control Register" +AT91C_CAN_MB5_MCR.helpkey="MailBox Control Register" +AT91C_CAN_MB5_MCR.access=memorymapped +AT91C_CAN_MB5_MCR.address=0xFFFD02BC +AT91C_CAN_MB5_MCR.width=32 +AT91C_CAN_MB5_MCR.byteEndian=little +AT91C_CAN_MB5_MCR.type=enum +AT91C_CAN_MB5_MCR.enum.0.name=*** Write only *** +AT91C_CAN_MB5_MCR.enum.1.name=Error +AT91C_CAN_MB5_MFID.name="AT91C_CAN_MB5_MFID" +AT91C_CAN_MB5_MFID.description="MailBox Family ID Register" +AT91C_CAN_MB5_MFID.helpkey="MailBox Family ID Register" +AT91C_CAN_MB5_MFID.access=memorymapped +AT91C_CAN_MB5_MFID.address=0xFFFD02AC +AT91C_CAN_MB5_MFID.width=32 +AT91C_CAN_MB5_MFID.byteEndian=little +AT91C_CAN_MB5_MFID.permission.write=none +AT91C_CAN_MB5_MDH.name="AT91C_CAN_MB5_MDH" +AT91C_CAN_MB5_MDH.description="MailBox Data High Register" +AT91C_CAN_MB5_MDH.helpkey="MailBox Data High Register" +AT91C_CAN_MB5_MDH.access=memorymapped +AT91C_CAN_MB5_MDH.address=0xFFFD02B8 +AT91C_CAN_MB5_MDH.width=32 +AT91C_CAN_MB5_MDH.byteEndian=little +AT91C_CAN_MB5_MID.name="AT91C_CAN_MB5_MID" +AT91C_CAN_MB5_MID.description="MailBox ID Register" +AT91C_CAN_MB5_MID.helpkey="MailBox ID Register" +AT91C_CAN_MB5_MID.access=memorymapped +AT91C_CAN_MB5_MID.address=0xFFFD02A8 +AT91C_CAN_MB5_MID.width=32 +AT91C_CAN_MB5_MID.byteEndian=little +AT91C_CAN_MB5_MMR.name="AT91C_CAN_MB5_MMR" +AT91C_CAN_MB5_MMR.description="MailBox Mode Register" +AT91C_CAN_MB5_MMR.helpkey="MailBox Mode Register" +AT91C_CAN_MB5_MMR.access=memorymapped +AT91C_CAN_MB5_MMR.address=0xFFFD02A0 +AT91C_CAN_MB5_MMR.width=32 +AT91C_CAN_MB5_MMR.byteEndian=little +AT91C_CAN_MB5_MDL.name="AT91C_CAN_MB5_MDL" +AT91C_CAN_MB5_MDL.description="MailBox Data Low Register" +AT91C_CAN_MB5_MDL.helpkey="MailBox Data Low Register" +AT91C_CAN_MB5_MDL.access=memorymapped +AT91C_CAN_MB5_MDL.address=0xFFFD02B4 +AT91C_CAN_MB5_MDL.width=32 +AT91C_CAN_MB5_MDL.byteEndian=little +AT91C_CAN_MB5_MAM.name="AT91C_CAN_MB5_MAM" +AT91C_CAN_MB5_MAM.description="MailBox Acceptance Mask Register" +AT91C_CAN_MB5_MAM.helpkey="MailBox Acceptance Mask Register" +AT91C_CAN_MB5_MAM.access=memorymapped +AT91C_CAN_MB5_MAM.address=0xFFFD02A4 +AT91C_CAN_MB5_MAM.width=32 +AT91C_CAN_MB5_MAM.byteEndian=little +# ========== Register definition for CAN_MB6 peripheral ========== +AT91C_CAN_MB6_MFID.name="AT91C_CAN_MB6_MFID" +AT91C_CAN_MB6_MFID.description="MailBox Family ID Register" +AT91C_CAN_MB6_MFID.helpkey="MailBox Family ID Register" +AT91C_CAN_MB6_MFID.access=memorymapped +AT91C_CAN_MB6_MFID.address=0xFFFD02CC +AT91C_CAN_MB6_MFID.width=32 +AT91C_CAN_MB6_MFID.byteEndian=little +AT91C_CAN_MB6_MFID.permission.write=none +AT91C_CAN_MB6_MID.name="AT91C_CAN_MB6_MID" +AT91C_CAN_MB6_MID.description="MailBox ID Register" +AT91C_CAN_MB6_MID.helpkey="MailBox ID Register" +AT91C_CAN_MB6_MID.access=memorymapped +AT91C_CAN_MB6_MID.address=0xFFFD02C8 +AT91C_CAN_MB6_MID.width=32 +AT91C_CAN_MB6_MID.byteEndian=little +AT91C_CAN_MB6_MAM.name="AT91C_CAN_MB6_MAM" +AT91C_CAN_MB6_MAM.description="MailBox Acceptance Mask Register" +AT91C_CAN_MB6_MAM.helpkey="MailBox Acceptance Mask Register" +AT91C_CAN_MB6_MAM.access=memorymapped +AT91C_CAN_MB6_MAM.address=0xFFFD02C4 +AT91C_CAN_MB6_MAM.width=32 +AT91C_CAN_MB6_MAM.byteEndian=little +AT91C_CAN_MB6_MSR.name="AT91C_CAN_MB6_MSR" +AT91C_CAN_MB6_MSR.description="MailBox Status Register" +AT91C_CAN_MB6_MSR.helpkey="MailBox Status Register" +AT91C_CAN_MB6_MSR.access=memorymapped +AT91C_CAN_MB6_MSR.address=0xFFFD02D0 +AT91C_CAN_MB6_MSR.width=32 +AT91C_CAN_MB6_MSR.byteEndian=little +AT91C_CAN_MB6_MSR.permission.write=none +AT91C_CAN_MB6_MDL.name="AT91C_CAN_MB6_MDL" +AT91C_CAN_MB6_MDL.description="MailBox Data Low Register" +AT91C_CAN_MB6_MDL.helpkey="MailBox Data Low Register" +AT91C_CAN_MB6_MDL.access=memorymapped +AT91C_CAN_MB6_MDL.address=0xFFFD02D4 +AT91C_CAN_MB6_MDL.width=32 +AT91C_CAN_MB6_MDL.byteEndian=little +AT91C_CAN_MB6_MCR.name="AT91C_CAN_MB6_MCR" +AT91C_CAN_MB6_MCR.description="MailBox Control Register" +AT91C_CAN_MB6_MCR.helpkey="MailBox Control Register" +AT91C_CAN_MB6_MCR.access=memorymapped +AT91C_CAN_MB6_MCR.address=0xFFFD02DC +AT91C_CAN_MB6_MCR.width=32 +AT91C_CAN_MB6_MCR.byteEndian=little +AT91C_CAN_MB6_MCR.type=enum +AT91C_CAN_MB6_MCR.enum.0.name=*** Write only *** +AT91C_CAN_MB6_MCR.enum.1.name=Error +AT91C_CAN_MB6_MDH.name="AT91C_CAN_MB6_MDH" +AT91C_CAN_MB6_MDH.description="MailBox Data High Register" +AT91C_CAN_MB6_MDH.helpkey="MailBox Data High Register" +AT91C_CAN_MB6_MDH.access=memorymapped +AT91C_CAN_MB6_MDH.address=0xFFFD02D8 +AT91C_CAN_MB6_MDH.width=32 +AT91C_CAN_MB6_MDH.byteEndian=little +AT91C_CAN_MB6_MMR.name="AT91C_CAN_MB6_MMR" +AT91C_CAN_MB6_MMR.description="MailBox Mode Register" +AT91C_CAN_MB6_MMR.helpkey="MailBox Mode Register" +AT91C_CAN_MB6_MMR.access=memorymapped +AT91C_CAN_MB6_MMR.address=0xFFFD02C0 +AT91C_CAN_MB6_MMR.width=32 +AT91C_CAN_MB6_MMR.byteEndian=little +# ========== Register definition for CAN_MB7 peripheral ========== +AT91C_CAN_MB7_MCR.name="AT91C_CAN_MB7_MCR" +AT91C_CAN_MB7_MCR.description="MailBox Control Register" +AT91C_CAN_MB7_MCR.helpkey="MailBox Control Register" +AT91C_CAN_MB7_MCR.access=memorymapped +AT91C_CAN_MB7_MCR.address=0xFFFD02FC +AT91C_CAN_MB7_MCR.width=32 +AT91C_CAN_MB7_MCR.byteEndian=little +AT91C_CAN_MB7_MCR.type=enum +AT91C_CAN_MB7_MCR.enum.0.name=*** Write only *** +AT91C_CAN_MB7_MCR.enum.1.name=Error +AT91C_CAN_MB7_MDH.name="AT91C_CAN_MB7_MDH" +AT91C_CAN_MB7_MDH.description="MailBox Data High Register" +AT91C_CAN_MB7_MDH.helpkey="MailBox Data High Register" +AT91C_CAN_MB7_MDH.access=memorymapped +AT91C_CAN_MB7_MDH.address=0xFFFD02F8 +AT91C_CAN_MB7_MDH.width=32 +AT91C_CAN_MB7_MDH.byteEndian=little +AT91C_CAN_MB7_MFID.name="AT91C_CAN_MB7_MFID" +AT91C_CAN_MB7_MFID.description="MailBox Family ID Register" +AT91C_CAN_MB7_MFID.helpkey="MailBox Family ID Register" +AT91C_CAN_MB7_MFID.access=memorymapped +AT91C_CAN_MB7_MFID.address=0xFFFD02EC +AT91C_CAN_MB7_MFID.width=32 +AT91C_CAN_MB7_MFID.byteEndian=little +AT91C_CAN_MB7_MFID.permission.write=none +AT91C_CAN_MB7_MDL.name="AT91C_CAN_MB7_MDL" +AT91C_CAN_MB7_MDL.description="MailBox Data Low Register" +AT91C_CAN_MB7_MDL.helpkey="MailBox Data Low Register" +AT91C_CAN_MB7_MDL.access=memorymapped +AT91C_CAN_MB7_MDL.address=0xFFFD02F4 +AT91C_CAN_MB7_MDL.width=32 +AT91C_CAN_MB7_MDL.byteEndian=little +AT91C_CAN_MB7_MID.name="AT91C_CAN_MB7_MID" +AT91C_CAN_MB7_MID.description="MailBox ID Register" +AT91C_CAN_MB7_MID.helpkey="MailBox ID Register" +AT91C_CAN_MB7_MID.access=memorymapped +AT91C_CAN_MB7_MID.address=0xFFFD02E8 +AT91C_CAN_MB7_MID.width=32 +AT91C_CAN_MB7_MID.byteEndian=little +AT91C_CAN_MB7_MMR.name="AT91C_CAN_MB7_MMR" +AT91C_CAN_MB7_MMR.description="MailBox Mode Register" +AT91C_CAN_MB7_MMR.helpkey="MailBox Mode Register" +AT91C_CAN_MB7_MMR.access=memorymapped +AT91C_CAN_MB7_MMR.address=0xFFFD02E0 +AT91C_CAN_MB7_MMR.width=32 +AT91C_CAN_MB7_MMR.byteEndian=little +AT91C_CAN_MB7_MAM.name="AT91C_CAN_MB7_MAM" +AT91C_CAN_MB7_MAM.description="MailBox Acceptance Mask Register" +AT91C_CAN_MB7_MAM.helpkey="MailBox Acceptance Mask Register" +AT91C_CAN_MB7_MAM.access=memorymapped +AT91C_CAN_MB7_MAM.address=0xFFFD02E4 +AT91C_CAN_MB7_MAM.width=32 +AT91C_CAN_MB7_MAM.byteEndian=little +AT91C_CAN_MB7_MSR.name="AT91C_CAN_MB7_MSR" +AT91C_CAN_MB7_MSR.description="MailBox Status Register" +AT91C_CAN_MB7_MSR.helpkey="MailBox Status Register" +AT91C_CAN_MB7_MSR.access=memorymapped +AT91C_CAN_MB7_MSR.address=0xFFFD02F0 +AT91C_CAN_MB7_MSR.width=32 +AT91C_CAN_MB7_MSR.byteEndian=little +AT91C_CAN_MB7_MSR.permission.write=none +# ========== Register definition for CAN peripheral ========== +AT91C_CAN_TCR.name="AT91C_CAN_TCR" +AT91C_CAN_TCR.description="Transfer Command Register" +AT91C_CAN_TCR.helpkey="Transfer Command Register" +AT91C_CAN_TCR.access=memorymapped +AT91C_CAN_TCR.address=0xFFFD0024 +AT91C_CAN_TCR.width=32 +AT91C_CAN_TCR.byteEndian=little +AT91C_CAN_TCR.type=enum +AT91C_CAN_TCR.enum.0.name=*** Write only *** +AT91C_CAN_TCR.enum.1.name=Error +AT91C_CAN_IMR.name="AT91C_CAN_IMR" +AT91C_CAN_IMR.description="Interrupt Mask Register" +AT91C_CAN_IMR.helpkey="Interrupt Mask Register" +AT91C_CAN_IMR.access=memorymapped +AT91C_CAN_IMR.address=0xFFFD000C +AT91C_CAN_IMR.width=32 +AT91C_CAN_IMR.byteEndian=little +AT91C_CAN_IMR.permission.write=none +AT91C_CAN_IER.name="AT91C_CAN_IER" +AT91C_CAN_IER.description="Interrupt Enable Register" +AT91C_CAN_IER.helpkey="Interrupt Enable Register" +AT91C_CAN_IER.access=memorymapped +AT91C_CAN_IER.address=0xFFFD0004 +AT91C_CAN_IER.width=32 +AT91C_CAN_IER.byteEndian=little +AT91C_CAN_IER.type=enum +AT91C_CAN_IER.enum.0.name=*** Write only *** +AT91C_CAN_IER.enum.1.name=Error +AT91C_CAN_ECR.name="AT91C_CAN_ECR" +AT91C_CAN_ECR.description="Error Counter Register" +AT91C_CAN_ECR.helpkey="Error Counter Register" +AT91C_CAN_ECR.access=memorymapped +AT91C_CAN_ECR.address=0xFFFD0020 +AT91C_CAN_ECR.width=32 +AT91C_CAN_ECR.byteEndian=little +AT91C_CAN_ECR.permission.write=none +AT91C_CAN_TIMESTP.name="AT91C_CAN_TIMESTP" +AT91C_CAN_TIMESTP.description="Time Stamp Register" +AT91C_CAN_TIMESTP.helpkey="Time Stamp Register" +AT91C_CAN_TIMESTP.access=memorymapped +AT91C_CAN_TIMESTP.address=0xFFFD001C +AT91C_CAN_TIMESTP.width=32 +AT91C_CAN_TIMESTP.byteEndian=little +AT91C_CAN_TIMESTP.permission.write=none +AT91C_CAN_MR.name="AT91C_CAN_MR" +AT91C_CAN_MR.description="Mode Register" +AT91C_CAN_MR.helpkey="Mode Register" +AT91C_CAN_MR.access=memorymapped +AT91C_CAN_MR.address=0xFFFD0000 +AT91C_CAN_MR.width=32 +AT91C_CAN_MR.byteEndian=little +AT91C_CAN_IDR.name="AT91C_CAN_IDR" +AT91C_CAN_IDR.description="Interrupt Disable Register" +AT91C_CAN_IDR.helpkey="Interrupt Disable Register" +AT91C_CAN_IDR.access=memorymapped +AT91C_CAN_IDR.address=0xFFFD0008 +AT91C_CAN_IDR.width=32 +AT91C_CAN_IDR.byteEndian=little +AT91C_CAN_IDR.type=enum +AT91C_CAN_IDR.enum.0.name=*** Write only *** +AT91C_CAN_IDR.enum.1.name=Error +AT91C_CAN_ACR.name="AT91C_CAN_ACR" +AT91C_CAN_ACR.description="Abort Command Register" +AT91C_CAN_ACR.helpkey="Abort Command Register" +AT91C_CAN_ACR.access=memorymapped +AT91C_CAN_ACR.address=0xFFFD0028 +AT91C_CAN_ACR.width=32 +AT91C_CAN_ACR.byteEndian=little +AT91C_CAN_ACR.type=enum +AT91C_CAN_ACR.enum.0.name=*** Write only *** +AT91C_CAN_ACR.enum.1.name=Error +AT91C_CAN_TIM.name="AT91C_CAN_TIM" +AT91C_CAN_TIM.description="Timer Register" +AT91C_CAN_TIM.helpkey="Timer Register" +AT91C_CAN_TIM.access=memorymapped +AT91C_CAN_TIM.address=0xFFFD0018 +AT91C_CAN_TIM.width=32 +AT91C_CAN_TIM.byteEndian=little +AT91C_CAN_TIM.permission.write=none +AT91C_CAN_SR.name="AT91C_CAN_SR" +AT91C_CAN_SR.description="Status Register" +AT91C_CAN_SR.helpkey="Status Register" +AT91C_CAN_SR.access=memorymapped +AT91C_CAN_SR.address=0xFFFD0010 +AT91C_CAN_SR.width=32 +AT91C_CAN_SR.byteEndian=little +AT91C_CAN_SR.permission.write=none +AT91C_CAN_BR.name="AT91C_CAN_BR" +AT91C_CAN_BR.description="Baudrate Register" +AT91C_CAN_BR.helpkey="Baudrate Register" +AT91C_CAN_BR.access=memorymapped +AT91C_CAN_BR.address=0xFFFD0014 +AT91C_CAN_BR.width=32 +AT91C_CAN_BR.byteEndian=little +AT91C_CAN_VR.name="AT91C_CAN_VR" +AT91C_CAN_VR.description="Version Register" +AT91C_CAN_VR.helpkey="Version Register" +AT91C_CAN_VR.access=memorymapped +AT91C_CAN_VR.address=0xFFFD00FC +AT91C_CAN_VR.width=32 +AT91C_CAN_VR.byteEndian=little +AT91C_CAN_VR.permission.write=none +# ========== Register definition for EMAC peripheral ========== +AT91C_EMAC_ISR.name="AT91C_EMAC_ISR" +AT91C_EMAC_ISR.description="Interrupt Status Register" +AT91C_EMAC_ISR.helpkey="Interrupt Status Register" +AT91C_EMAC_ISR.access=memorymapped +AT91C_EMAC_ISR.address=0xFFFDC024 +AT91C_EMAC_ISR.width=32 +AT91C_EMAC_ISR.byteEndian=little +AT91C_EMAC_SA4H.name="AT91C_EMAC_SA4H" +AT91C_EMAC_SA4H.description="Specific Address 4 Top, Last 2 bytes" +AT91C_EMAC_SA4H.helpkey="Specific Address 4 Top, Last 2 bytes" +AT91C_EMAC_SA4H.access=memorymapped +AT91C_EMAC_SA4H.address=0xFFFDC0B4 +AT91C_EMAC_SA4H.width=32 +AT91C_EMAC_SA4H.byteEndian=little +AT91C_EMAC_SA1L.name="AT91C_EMAC_SA1L" +AT91C_EMAC_SA1L.description="Specific Address 1 Bottom, First 4 bytes" +AT91C_EMAC_SA1L.helpkey="Specific Address 1 Bottom, First 4 bytes" +AT91C_EMAC_SA1L.access=memorymapped +AT91C_EMAC_SA1L.address=0xFFFDC098 +AT91C_EMAC_SA1L.width=32 +AT91C_EMAC_SA1L.byteEndian=little +AT91C_EMAC_ELE.name="AT91C_EMAC_ELE" +AT91C_EMAC_ELE.description="Excessive Length Errors Register" +AT91C_EMAC_ELE.helpkey="Excessive Length Errors Register" +AT91C_EMAC_ELE.access=memorymapped +AT91C_EMAC_ELE.address=0xFFFDC078 +AT91C_EMAC_ELE.width=32 +AT91C_EMAC_ELE.byteEndian=little +AT91C_EMAC_LCOL.name="AT91C_EMAC_LCOL" +AT91C_EMAC_LCOL.description="Late Collision Register" +AT91C_EMAC_LCOL.helpkey="Late Collision Register" +AT91C_EMAC_LCOL.access=memorymapped +AT91C_EMAC_LCOL.address=0xFFFDC05C +AT91C_EMAC_LCOL.width=32 +AT91C_EMAC_LCOL.byteEndian=little +AT91C_EMAC_RLE.name="AT91C_EMAC_RLE" +AT91C_EMAC_RLE.description="Receive Length Field Mismatch Register" +AT91C_EMAC_RLE.helpkey="Receive Length Field Mismatch Register" +AT91C_EMAC_RLE.access=memorymapped +AT91C_EMAC_RLE.address=0xFFFDC088 +AT91C_EMAC_RLE.width=32 +AT91C_EMAC_RLE.byteEndian=little +AT91C_EMAC_WOL.name="AT91C_EMAC_WOL" +AT91C_EMAC_WOL.description="Wake On LAN Register" +AT91C_EMAC_WOL.helpkey="Wake On LAN Register" +AT91C_EMAC_WOL.access=memorymapped +AT91C_EMAC_WOL.address=0xFFFDC0C4 +AT91C_EMAC_WOL.width=32 +AT91C_EMAC_WOL.byteEndian=little +AT91C_EMAC_DTF.name="AT91C_EMAC_DTF" +AT91C_EMAC_DTF.description="Deferred Transmission Frame Register" +AT91C_EMAC_DTF.helpkey="Deferred Transmission Frame Register" +AT91C_EMAC_DTF.access=memorymapped +AT91C_EMAC_DTF.address=0xFFFDC058 +AT91C_EMAC_DTF.width=32 +AT91C_EMAC_DTF.byteEndian=little +AT91C_EMAC_TUND.name="AT91C_EMAC_TUND" +AT91C_EMAC_TUND.description="Transmit Underrun Error Register" +AT91C_EMAC_TUND.helpkey="Transmit Underrun Error Register" +AT91C_EMAC_TUND.access=memorymapped +AT91C_EMAC_TUND.address=0xFFFDC064 +AT91C_EMAC_TUND.width=32 +AT91C_EMAC_TUND.byteEndian=little +AT91C_EMAC_NCR.name="AT91C_EMAC_NCR" +AT91C_EMAC_NCR.description="Network Control Register" +AT91C_EMAC_NCR.helpkey="Network Control Register" +AT91C_EMAC_NCR.access=memorymapped +AT91C_EMAC_NCR.address=0xFFFDC000 +AT91C_EMAC_NCR.width=32 +AT91C_EMAC_NCR.byteEndian=little +AT91C_EMAC_SA4L.name="AT91C_EMAC_SA4L" +AT91C_EMAC_SA4L.description="Specific Address 4 Bottom, First 4 bytes" +AT91C_EMAC_SA4L.helpkey="Specific Address 4 Bottom, First 4 bytes" +AT91C_EMAC_SA4L.access=memorymapped +AT91C_EMAC_SA4L.address=0xFFFDC0B0 +AT91C_EMAC_SA4L.width=32 +AT91C_EMAC_SA4L.byteEndian=little +AT91C_EMAC_RSR.name="AT91C_EMAC_RSR" +AT91C_EMAC_RSR.description="Receive Status Register" +AT91C_EMAC_RSR.helpkey="Receive Status Register" +AT91C_EMAC_RSR.access=memorymapped +AT91C_EMAC_RSR.address=0xFFFDC020 +AT91C_EMAC_RSR.width=32 +AT91C_EMAC_RSR.byteEndian=little +AT91C_EMAC_SA3L.name="AT91C_EMAC_SA3L" +AT91C_EMAC_SA3L.description="Specific Address 3 Bottom, First 4 bytes" +AT91C_EMAC_SA3L.helpkey="Specific Address 3 Bottom, First 4 bytes" +AT91C_EMAC_SA3L.access=memorymapped +AT91C_EMAC_SA3L.address=0xFFFDC0A8 +AT91C_EMAC_SA3L.width=32 +AT91C_EMAC_SA3L.byteEndian=little +AT91C_EMAC_TSR.name="AT91C_EMAC_TSR" +AT91C_EMAC_TSR.description="Transmit Status Register" +AT91C_EMAC_TSR.helpkey="Transmit Status Register" +AT91C_EMAC_TSR.access=memorymapped +AT91C_EMAC_TSR.address=0xFFFDC014 +AT91C_EMAC_TSR.width=32 +AT91C_EMAC_TSR.byteEndian=little +AT91C_EMAC_IDR.name="AT91C_EMAC_IDR" +AT91C_EMAC_IDR.description="Interrupt Disable Register" +AT91C_EMAC_IDR.helpkey="Interrupt Disable Register" +AT91C_EMAC_IDR.access=memorymapped +AT91C_EMAC_IDR.address=0xFFFDC02C +AT91C_EMAC_IDR.width=32 +AT91C_EMAC_IDR.byteEndian=little +AT91C_EMAC_IDR.type=enum +AT91C_EMAC_IDR.enum.0.name=*** Write only *** +AT91C_EMAC_IDR.enum.1.name=Error +AT91C_EMAC_RSE.name="AT91C_EMAC_RSE" +AT91C_EMAC_RSE.description="Receive Symbol Errors Register" +AT91C_EMAC_RSE.helpkey="Receive Symbol Errors Register" +AT91C_EMAC_RSE.access=memorymapped +AT91C_EMAC_RSE.address=0xFFFDC074 +AT91C_EMAC_RSE.width=32 +AT91C_EMAC_RSE.byteEndian=little +AT91C_EMAC_ECOL.name="AT91C_EMAC_ECOL" +AT91C_EMAC_ECOL.description="Excessive Collision Register" +AT91C_EMAC_ECOL.helpkey="Excessive Collision Register" +AT91C_EMAC_ECOL.access=memorymapped +AT91C_EMAC_ECOL.address=0xFFFDC060 +AT91C_EMAC_ECOL.width=32 +AT91C_EMAC_ECOL.byteEndian=little +AT91C_EMAC_TID.name="AT91C_EMAC_TID" +AT91C_EMAC_TID.description="Type ID Checking Register" +AT91C_EMAC_TID.helpkey="Type ID Checking Register" +AT91C_EMAC_TID.access=memorymapped +AT91C_EMAC_TID.address=0xFFFDC0B8 +AT91C_EMAC_TID.width=32 +AT91C_EMAC_TID.byteEndian=little +AT91C_EMAC_HRB.name="AT91C_EMAC_HRB" +AT91C_EMAC_HRB.description="Hash Address Bottom[31:0]" +AT91C_EMAC_HRB.helpkey="Hash Address Bottom[31:0]" +AT91C_EMAC_HRB.access=memorymapped +AT91C_EMAC_HRB.address=0xFFFDC090 +AT91C_EMAC_HRB.width=32 +AT91C_EMAC_HRB.byteEndian=little +AT91C_EMAC_TBQP.name="AT91C_EMAC_TBQP" +AT91C_EMAC_TBQP.description="Transmit Buffer Queue Pointer" +AT91C_EMAC_TBQP.helpkey="Transmit Buffer Queue Pointer" +AT91C_EMAC_TBQP.access=memorymapped +AT91C_EMAC_TBQP.address=0xFFFDC01C +AT91C_EMAC_TBQP.width=32 +AT91C_EMAC_TBQP.byteEndian=little +AT91C_EMAC_USRIO.name="AT91C_EMAC_USRIO" +AT91C_EMAC_USRIO.description="USER Input/Output Register" +AT91C_EMAC_USRIO.helpkey="USER Input/Output Register" +AT91C_EMAC_USRIO.access=memorymapped +AT91C_EMAC_USRIO.address=0xFFFDC0C0 +AT91C_EMAC_USRIO.width=32 +AT91C_EMAC_USRIO.byteEndian=little +AT91C_EMAC_PTR.name="AT91C_EMAC_PTR" +AT91C_EMAC_PTR.description="Pause Time Register" +AT91C_EMAC_PTR.helpkey="Pause Time Register" +AT91C_EMAC_PTR.access=memorymapped +AT91C_EMAC_PTR.address=0xFFFDC038 +AT91C_EMAC_PTR.width=32 +AT91C_EMAC_PTR.byteEndian=little +AT91C_EMAC_SA2H.name="AT91C_EMAC_SA2H" +AT91C_EMAC_SA2H.description="Specific Address 2 Top, Last 2 bytes" +AT91C_EMAC_SA2H.helpkey="Specific Address 2 Top, Last 2 bytes" +AT91C_EMAC_SA2H.access=memorymapped +AT91C_EMAC_SA2H.address=0xFFFDC0A4 +AT91C_EMAC_SA2H.width=32 +AT91C_EMAC_SA2H.byteEndian=little +AT91C_EMAC_ROV.name="AT91C_EMAC_ROV" +AT91C_EMAC_ROV.description="Receive Overrun Errors Register" +AT91C_EMAC_ROV.helpkey="Receive Overrun Errors Register" +AT91C_EMAC_ROV.access=memorymapped +AT91C_EMAC_ROV.address=0xFFFDC070 +AT91C_EMAC_ROV.width=32 +AT91C_EMAC_ROV.byteEndian=little +AT91C_EMAC_ALE.name="AT91C_EMAC_ALE" +AT91C_EMAC_ALE.description="Alignment Error Register" +AT91C_EMAC_ALE.helpkey="Alignment Error Register" +AT91C_EMAC_ALE.access=memorymapped +AT91C_EMAC_ALE.address=0xFFFDC054 +AT91C_EMAC_ALE.width=32 +AT91C_EMAC_ALE.byteEndian=little +AT91C_EMAC_RJA.name="AT91C_EMAC_RJA" +AT91C_EMAC_RJA.description="Receive Jabbers Register" +AT91C_EMAC_RJA.helpkey="Receive Jabbers Register" +AT91C_EMAC_RJA.access=memorymapped +AT91C_EMAC_RJA.address=0xFFFDC07C +AT91C_EMAC_RJA.width=32 +AT91C_EMAC_RJA.byteEndian=little +AT91C_EMAC_RBQP.name="AT91C_EMAC_RBQP" +AT91C_EMAC_RBQP.description="Receive Buffer Queue Pointer" +AT91C_EMAC_RBQP.helpkey="Receive Buffer Queue Pointer" +AT91C_EMAC_RBQP.access=memorymapped +AT91C_EMAC_RBQP.address=0xFFFDC018 +AT91C_EMAC_RBQP.width=32 +AT91C_EMAC_RBQP.byteEndian=little +AT91C_EMAC_TPF.name="AT91C_EMAC_TPF" +AT91C_EMAC_TPF.description="Transmitted Pause Frames Register" +AT91C_EMAC_TPF.helpkey="Transmitted Pause Frames Register" +AT91C_EMAC_TPF.access=memorymapped +AT91C_EMAC_TPF.address=0xFFFDC08C +AT91C_EMAC_TPF.width=32 +AT91C_EMAC_TPF.byteEndian=little +AT91C_EMAC_NCFGR.name="AT91C_EMAC_NCFGR" +AT91C_EMAC_NCFGR.description="Network Configuration Register" +AT91C_EMAC_NCFGR.helpkey="Network Configuration Register" +AT91C_EMAC_NCFGR.access=memorymapped +AT91C_EMAC_NCFGR.address=0xFFFDC004 +AT91C_EMAC_NCFGR.width=32 +AT91C_EMAC_NCFGR.byteEndian=little +AT91C_EMAC_HRT.name="AT91C_EMAC_HRT" +AT91C_EMAC_HRT.description="Hash Address Top[63:32]" +AT91C_EMAC_HRT.helpkey="Hash Address Top[63:32]" +AT91C_EMAC_HRT.access=memorymapped +AT91C_EMAC_HRT.address=0xFFFDC094 +AT91C_EMAC_HRT.width=32 +AT91C_EMAC_HRT.byteEndian=little +AT91C_EMAC_USF.name="AT91C_EMAC_USF" +AT91C_EMAC_USF.description="Undersize Frames Register" +AT91C_EMAC_USF.helpkey="Undersize Frames Register" +AT91C_EMAC_USF.access=memorymapped +AT91C_EMAC_USF.address=0xFFFDC080 +AT91C_EMAC_USF.width=32 +AT91C_EMAC_USF.byteEndian=little +AT91C_EMAC_FCSE.name="AT91C_EMAC_FCSE" +AT91C_EMAC_FCSE.description="Frame Check Sequence Error Register" +AT91C_EMAC_FCSE.helpkey="Frame Check Sequence Error Register" +AT91C_EMAC_FCSE.access=memorymapped +AT91C_EMAC_FCSE.address=0xFFFDC050 +AT91C_EMAC_FCSE.width=32 +AT91C_EMAC_FCSE.byteEndian=little +AT91C_EMAC_TPQ.name="AT91C_EMAC_TPQ" +AT91C_EMAC_TPQ.description="Transmit Pause Quantum Register" +AT91C_EMAC_TPQ.helpkey="Transmit Pause Quantum Register" +AT91C_EMAC_TPQ.access=memorymapped +AT91C_EMAC_TPQ.address=0xFFFDC0BC +AT91C_EMAC_TPQ.width=32 +AT91C_EMAC_TPQ.byteEndian=little +AT91C_EMAC_MAN.name="AT91C_EMAC_MAN" +AT91C_EMAC_MAN.description="PHY Maintenance Register" +AT91C_EMAC_MAN.helpkey="PHY Maintenance Register" +AT91C_EMAC_MAN.access=memorymapped +AT91C_EMAC_MAN.address=0xFFFDC034 +AT91C_EMAC_MAN.width=32 +AT91C_EMAC_MAN.byteEndian=little +AT91C_EMAC_FTO.name="AT91C_EMAC_FTO" +AT91C_EMAC_FTO.description="Frames Transmitted OK Register" +AT91C_EMAC_FTO.helpkey="Frames Transmitted OK Register" +AT91C_EMAC_FTO.access=memorymapped +AT91C_EMAC_FTO.address=0xFFFDC040 +AT91C_EMAC_FTO.width=32 +AT91C_EMAC_FTO.byteEndian=little +AT91C_EMAC_REV.name="AT91C_EMAC_REV" +AT91C_EMAC_REV.description="Revision Register" +AT91C_EMAC_REV.helpkey="Revision Register" +AT91C_EMAC_REV.access=memorymapped +AT91C_EMAC_REV.address=0xFFFDC0FC +AT91C_EMAC_REV.width=32 +AT91C_EMAC_REV.byteEndian=little +AT91C_EMAC_REV.permission.write=none +AT91C_EMAC_IMR.name="AT91C_EMAC_IMR" +AT91C_EMAC_IMR.description="Interrupt Mask Register" +AT91C_EMAC_IMR.helpkey="Interrupt Mask Register" +AT91C_EMAC_IMR.access=memorymapped +AT91C_EMAC_IMR.address=0xFFFDC030 +AT91C_EMAC_IMR.width=32 +AT91C_EMAC_IMR.byteEndian=little +AT91C_EMAC_IMR.permission.write=none +AT91C_EMAC_SCF.name="AT91C_EMAC_SCF" +AT91C_EMAC_SCF.description="Single Collision Frame Register" +AT91C_EMAC_SCF.helpkey="Single Collision Frame Register" +AT91C_EMAC_SCF.access=memorymapped +AT91C_EMAC_SCF.address=0xFFFDC044 +AT91C_EMAC_SCF.width=32 +AT91C_EMAC_SCF.byteEndian=little +AT91C_EMAC_PFR.name="AT91C_EMAC_PFR" +AT91C_EMAC_PFR.description="Pause Frames received Register" +AT91C_EMAC_PFR.helpkey="Pause Frames received Register" +AT91C_EMAC_PFR.access=memorymapped +AT91C_EMAC_PFR.address=0xFFFDC03C +AT91C_EMAC_PFR.width=32 +AT91C_EMAC_PFR.byteEndian=little +AT91C_EMAC_MCF.name="AT91C_EMAC_MCF" +AT91C_EMAC_MCF.description="Multiple Collision Frame Register" +AT91C_EMAC_MCF.helpkey="Multiple Collision Frame Register" +AT91C_EMAC_MCF.access=memorymapped +AT91C_EMAC_MCF.address=0xFFFDC048 +AT91C_EMAC_MCF.width=32 +AT91C_EMAC_MCF.byteEndian=little +AT91C_EMAC_NSR.name="AT91C_EMAC_NSR" +AT91C_EMAC_NSR.description="Network Status Register" +AT91C_EMAC_NSR.helpkey="Network Status Register" +AT91C_EMAC_NSR.access=memorymapped +AT91C_EMAC_NSR.address=0xFFFDC008 +AT91C_EMAC_NSR.width=32 +AT91C_EMAC_NSR.byteEndian=little +AT91C_EMAC_NSR.permission.write=none +AT91C_EMAC_SA2L.name="AT91C_EMAC_SA2L" +AT91C_EMAC_SA2L.description="Specific Address 2 Bottom, First 4 bytes" +AT91C_EMAC_SA2L.helpkey="Specific Address 2 Bottom, First 4 bytes" +AT91C_EMAC_SA2L.access=memorymapped +AT91C_EMAC_SA2L.address=0xFFFDC0A0 +AT91C_EMAC_SA2L.width=32 +AT91C_EMAC_SA2L.byteEndian=little +AT91C_EMAC_FRO.name="AT91C_EMAC_FRO" +AT91C_EMAC_FRO.description="Frames Received OK Register" +AT91C_EMAC_FRO.helpkey="Frames Received OK Register" +AT91C_EMAC_FRO.access=memorymapped +AT91C_EMAC_FRO.address=0xFFFDC04C +AT91C_EMAC_FRO.width=32 +AT91C_EMAC_FRO.byteEndian=little +AT91C_EMAC_IER.name="AT91C_EMAC_IER" +AT91C_EMAC_IER.description="Interrupt Enable Register" +AT91C_EMAC_IER.helpkey="Interrupt Enable Register" +AT91C_EMAC_IER.access=memorymapped +AT91C_EMAC_IER.address=0xFFFDC028 +AT91C_EMAC_IER.width=32 +AT91C_EMAC_IER.byteEndian=little +AT91C_EMAC_IER.type=enum +AT91C_EMAC_IER.enum.0.name=*** Write only *** +AT91C_EMAC_IER.enum.1.name=Error +AT91C_EMAC_SA1H.name="AT91C_EMAC_SA1H" +AT91C_EMAC_SA1H.description="Specific Address 1 Top, Last 2 bytes" +AT91C_EMAC_SA1H.helpkey="Specific Address 1 Top, Last 2 bytes" +AT91C_EMAC_SA1H.access=memorymapped +AT91C_EMAC_SA1H.address=0xFFFDC09C +AT91C_EMAC_SA1H.width=32 +AT91C_EMAC_SA1H.byteEndian=little +AT91C_EMAC_CSE.name="AT91C_EMAC_CSE" +AT91C_EMAC_CSE.description="Carrier Sense Error Register" +AT91C_EMAC_CSE.helpkey="Carrier Sense Error Register" +AT91C_EMAC_CSE.access=memorymapped +AT91C_EMAC_CSE.address=0xFFFDC068 +AT91C_EMAC_CSE.width=32 +AT91C_EMAC_CSE.byteEndian=little +AT91C_EMAC_SA3H.name="AT91C_EMAC_SA3H" +AT91C_EMAC_SA3H.description="Specific Address 3 Top, Last 2 bytes" +AT91C_EMAC_SA3H.helpkey="Specific Address 3 Top, Last 2 bytes" +AT91C_EMAC_SA3H.access=memorymapped +AT91C_EMAC_SA3H.address=0xFFFDC0AC +AT91C_EMAC_SA3H.width=32 +AT91C_EMAC_SA3H.byteEndian=little +AT91C_EMAC_RRE.name="AT91C_EMAC_RRE" +AT91C_EMAC_RRE.description="Receive Ressource Error Register" +AT91C_EMAC_RRE.helpkey="Receive Ressource Error Register" +AT91C_EMAC_RRE.access=memorymapped +AT91C_EMAC_RRE.address=0xFFFDC06C +AT91C_EMAC_RRE.width=32 +AT91C_EMAC_RRE.byteEndian=little +AT91C_EMAC_STE.name="AT91C_EMAC_STE" +AT91C_EMAC_STE.description="SQE Test Error Register" +AT91C_EMAC_STE.helpkey="SQE Test Error Register" +AT91C_EMAC_STE.access=memorymapped +AT91C_EMAC_STE.address=0xFFFDC084 +AT91C_EMAC_STE.width=32 +AT91C_EMAC_STE.byteEndian=little +# ========== Register definition for PDC_ADC peripheral ========== +AT91C_ADC_PTSR.name="AT91C_ADC_PTSR" +AT91C_ADC_PTSR.description="PDC Transfer Status Register" +AT91C_ADC_PTSR.helpkey="PDC Transfer Status Register" +AT91C_ADC_PTSR.access=memorymapped +AT91C_ADC_PTSR.address=0xFFFD8124 +AT91C_ADC_PTSR.width=32 +AT91C_ADC_PTSR.byteEndian=little +AT91C_ADC_PTSR.permission.write=none +AT91C_ADC_PTCR.name="AT91C_ADC_PTCR" +AT91C_ADC_PTCR.description="PDC Transfer Control Register" +AT91C_ADC_PTCR.helpkey="PDC Transfer Control Register" +AT91C_ADC_PTCR.access=memorymapped +AT91C_ADC_PTCR.address=0xFFFD8120 +AT91C_ADC_PTCR.width=32 +AT91C_ADC_PTCR.byteEndian=little +AT91C_ADC_PTCR.type=enum +AT91C_ADC_PTCR.enum.0.name=*** Write only *** +AT91C_ADC_PTCR.enum.1.name=Error +AT91C_ADC_TNPR.name="AT91C_ADC_TNPR" +AT91C_ADC_TNPR.description="Transmit Next Pointer Register" +AT91C_ADC_TNPR.helpkey="Transmit Next Pointer Register" +AT91C_ADC_TNPR.access=memorymapped +AT91C_ADC_TNPR.address=0xFFFD8118 +AT91C_ADC_TNPR.width=32 +AT91C_ADC_TNPR.byteEndian=little +AT91C_ADC_TNCR.name="AT91C_ADC_TNCR" +AT91C_ADC_TNCR.description="Transmit Next Counter Register" +AT91C_ADC_TNCR.helpkey="Transmit Next Counter Register" +AT91C_ADC_TNCR.access=memorymapped +AT91C_ADC_TNCR.address=0xFFFD811C +AT91C_ADC_TNCR.width=32 +AT91C_ADC_TNCR.byteEndian=little +AT91C_ADC_RNPR.name="AT91C_ADC_RNPR" +AT91C_ADC_RNPR.description="Receive Next Pointer Register" +AT91C_ADC_RNPR.helpkey="Receive Next Pointer Register" +AT91C_ADC_RNPR.access=memorymapped +AT91C_ADC_RNPR.address=0xFFFD8110 +AT91C_ADC_RNPR.width=32 +AT91C_ADC_RNPR.byteEndian=little +AT91C_ADC_RNCR.name="AT91C_ADC_RNCR" +AT91C_ADC_RNCR.description="Receive Next Counter Register" +AT91C_ADC_RNCR.helpkey="Receive Next Counter Register" +AT91C_ADC_RNCR.access=memorymapped +AT91C_ADC_RNCR.address=0xFFFD8114 +AT91C_ADC_RNCR.width=32 +AT91C_ADC_RNCR.byteEndian=little +AT91C_ADC_RPR.name="AT91C_ADC_RPR" +AT91C_ADC_RPR.description="Receive Pointer Register" +AT91C_ADC_RPR.helpkey="Receive Pointer Register" +AT91C_ADC_RPR.access=memorymapped +AT91C_ADC_RPR.address=0xFFFD8100 +AT91C_ADC_RPR.width=32 +AT91C_ADC_RPR.byteEndian=little +AT91C_ADC_TCR.name="AT91C_ADC_TCR" +AT91C_ADC_TCR.description="Transmit Counter Register" +AT91C_ADC_TCR.helpkey="Transmit Counter Register" +AT91C_ADC_TCR.access=memorymapped +AT91C_ADC_TCR.address=0xFFFD810C +AT91C_ADC_TCR.width=32 +AT91C_ADC_TCR.byteEndian=little +AT91C_ADC_TPR.name="AT91C_ADC_TPR" +AT91C_ADC_TPR.description="Transmit Pointer Register" +AT91C_ADC_TPR.helpkey="Transmit Pointer Register" +AT91C_ADC_TPR.access=memorymapped +AT91C_ADC_TPR.address=0xFFFD8108 +AT91C_ADC_TPR.width=32 +AT91C_ADC_TPR.byteEndian=little +AT91C_ADC_RCR.name="AT91C_ADC_RCR" +AT91C_ADC_RCR.description="Receive Counter Register" +AT91C_ADC_RCR.helpkey="Receive Counter Register" +AT91C_ADC_RCR.access=memorymapped +AT91C_ADC_RCR.address=0xFFFD8104 +AT91C_ADC_RCR.width=32 +AT91C_ADC_RCR.byteEndian=little +# ========== Register definition for ADC peripheral ========== +AT91C_ADC_CDR2.name="AT91C_ADC_CDR2" +AT91C_ADC_CDR2.description="ADC Channel Data Register 2" +AT91C_ADC_CDR2.helpkey="ADC Channel Data Register 2" +AT91C_ADC_CDR2.access=memorymapped +AT91C_ADC_CDR2.address=0xFFFD8038 +AT91C_ADC_CDR2.width=32 +AT91C_ADC_CDR2.byteEndian=little +AT91C_ADC_CDR2.permission.write=none +AT91C_ADC_CDR3.name="AT91C_ADC_CDR3" +AT91C_ADC_CDR3.description="ADC Channel Data Register 3" +AT91C_ADC_CDR3.helpkey="ADC Channel Data Register 3" +AT91C_ADC_CDR3.access=memorymapped +AT91C_ADC_CDR3.address=0xFFFD803C +AT91C_ADC_CDR3.width=32 +AT91C_ADC_CDR3.byteEndian=little +AT91C_ADC_CDR3.permission.write=none +AT91C_ADC_CDR0.name="AT91C_ADC_CDR0" +AT91C_ADC_CDR0.description="ADC Channel Data Register 0" +AT91C_ADC_CDR0.helpkey="ADC Channel Data Register 0" +AT91C_ADC_CDR0.access=memorymapped +AT91C_ADC_CDR0.address=0xFFFD8030 +AT91C_ADC_CDR0.width=32 +AT91C_ADC_CDR0.byteEndian=little +AT91C_ADC_CDR0.permission.write=none +AT91C_ADC_CDR5.name="AT91C_ADC_CDR5" +AT91C_ADC_CDR5.description="ADC Channel Data Register 5" +AT91C_ADC_CDR5.helpkey="ADC Channel Data Register 5" +AT91C_ADC_CDR5.access=memorymapped +AT91C_ADC_CDR5.address=0xFFFD8044 +AT91C_ADC_CDR5.width=32 +AT91C_ADC_CDR5.byteEndian=little +AT91C_ADC_CDR5.permission.write=none +AT91C_ADC_CHDR.name="AT91C_ADC_CHDR" +AT91C_ADC_CHDR.description="ADC Channel Disable Register" +AT91C_ADC_CHDR.helpkey="ADC Channel Disable Register" +AT91C_ADC_CHDR.access=memorymapped +AT91C_ADC_CHDR.address=0xFFFD8014 +AT91C_ADC_CHDR.width=32 +AT91C_ADC_CHDR.byteEndian=little +AT91C_ADC_CHDR.type=enum +AT91C_ADC_CHDR.enum.0.name=*** Write only *** +AT91C_ADC_CHDR.enum.1.name=Error +AT91C_ADC_SR.name="AT91C_ADC_SR" +AT91C_ADC_SR.description="ADC Status Register" +AT91C_ADC_SR.helpkey="ADC Status Register" +AT91C_ADC_SR.access=memorymapped +AT91C_ADC_SR.address=0xFFFD801C +AT91C_ADC_SR.width=32 +AT91C_ADC_SR.byteEndian=little +AT91C_ADC_SR.permission.write=none +AT91C_ADC_CDR4.name="AT91C_ADC_CDR4" +AT91C_ADC_CDR4.description="ADC Channel Data Register 4" +AT91C_ADC_CDR4.helpkey="ADC Channel Data Register 4" +AT91C_ADC_CDR4.access=memorymapped +AT91C_ADC_CDR4.address=0xFFFD8040 +AT91C_ADC_CDR4.width=32 +AT91C_ADC_CDR4.byteEndian=little +AT91C_ADC_CDR4.permission.write=none +AT91C_ADC_CDR1.name="AT91C_ADC_CDR1" +AT91C_ADC_CDR1.description="ADC Channel Data Register 1" +AT91C_ADC_CDR1.helpkey="ADC Channel Data Register 1" +AT91C_ADC_CDR1.access=memorymapped +AT91C_ADC_CDR1.address=0xFFFD8034 +AT91C_ADC_CDR1.width=32 +AT91C_ADC_CDR1.byteEndian=little +AT91C_ADC_CDR1.permission.write=none +AT91C_ADC_LCDR.name="AT91C_ADC_LCDR" +AT91C_ADC_LCDR.description="ADC Last Converted Data Register" +AT91C_ADC_LCDR.helpkey="ADC Last Converted Data Register" +AT91C_ADC_LCDR.access=memorymapped +AT91C_ADC_LCDR.address=0xFFFD8020 +AT91C_ADC_LCDR.width=32 +AT91C_ADC_LCDR.byteEndian=little +AT91C_ADC_LCDR.permission.write=none +AT91C_ADC_IDR.name="AT91C_ADC_IDR" +AT91C_ADC_IDR.description="ADC Interrupt Disable Register" +AT91C_ADC_IDR.helpkey="ADC Interrupt Disable Register" +AT91C_ADC_IDR.access=memorymapped +AT91C_ADC_IDR.address=0xFFFD8028 +AT91C_ADC_IDR.width=32 +AT91C_ADC_IDR.byteEndian=little +AT91C_ADC_IDR.type=enum +AT91C_ADC_IDR.enum.0.name=*** Write only *** +AT91C_ADC_IDR.enum.1.name=Error +AT91C_ADC_CR.name="AT91C_ADC_CR" +AT91C_ADC_CR.description="ADC Control Register" +AT91C_ADC_CR.helpkey="ADC Control Register" +AT91C_ADC_CR.access=memorymapped +AT91C_ADC_CR.address=0xFFFD8000 +AT91C_ADC_CR.width=32 +AT91C_ADC_CR.byteEndian=little +AT91C_ADC_CR.type=enum +AT91C_ADC_CR.enum.0.name=*** Write only *** +AT91C_ADC_CR.enum.1.name=Error +AT91C_ADC_CDR7.name="AT91C_ADC_CDR7" +AT91C_ADC_CDR7.description="ADC Channel Data Register 7" +AT91C_ADC_CDR7.helpkey="ADC Channel Data Register 7" +AT91C_ADC_CDR7.access=memorymapped +AT91C_ADC_CDR7.address=0xFFFD804C +AT91C_ADC_CDR7.width=32 +AT91C_ADC_CDR7.byteEndian=little +AT91C_ADC_CDR7.permission.write=none +AT91C_ADC_CDR6.name="AT91C_ADC_CDR6" +AT91C_ADC_CDR6.description="ADC Channel Data Register 6" +AT91C_ADC_CDR6.helpkey="ADC Channel Data Register 6" +AT91C_ADC_CDR6.access=memorymapped +AT91C_ADC_CDR6.address=0xFFFD8048 +AT91C_ADC_CDR6.width=32 +AT91C_ADC_CDR6.byteEndian=little +AT91C_ADC_CDR6.permission.write=none +AT91C_ADC_IER.name="AT91C_ADC_IER" +AT91C_ADC_IER.description="ADC Interrupt Enable Register" +AT91C_ADC_IER.helpkey="ADC Interrupt Enable Register" +AT91C_ADC_IER.access=memorymapped +AT91C_ADC_IER.address=0xFFFD8024 +AT91C_ADC_IER.width=32 +AT91C_ADC_IER.byteEndian=little +AT91C_ADC_IER.type=enum +AT91C_ADC_IER.enum.0.name=*** Write only *** +AT91C_ADC_IER.enum.1.name=Error +AT91C_ADC_CHER.name="AT91C_ADC_CHER" +AT91C_ADC_CHER.description="ADC Channel Enable Register" +AT91C_ADC_CHER.helpkey="ADC Channel Enable Register" +AT91C_ADC_CHER.access=memorymapped +AT91C_ADC_CHER.address=0xFFFD8010 +AT91C_ADC_CHER.width=32 +AT91C_ADC_CHER.byteEndian=little +AT91C_ADC_CHER.type=enum +AT91C_ADC_CHER.enum.0.name=*** Write only *** +AT91C_ADC_CHER.enum.1.name=Error +AT91C_ADC_CHSR.name="AT91C_ADC_CHSR" +AT91C_ADC_CHSR.description="ADC Channel Status Register" +AT91C_ADC_CHSR.helpkey="ADC Channel Status Register" +AT91C_ADC_CHSR.access=memorymapped +AT91C_ADC_CHSR.address=0xFFFD8018 +AT91C_ADC_CHSR.width=32 +AT91C_ADC_CHSR.byteEndian=little +AT91C_ADC_CHSR.permission.write=none +AT91C_ADC_MR.name="AT91C_ADC_MR" +AT91C_ADC_MR.description="ADC Mode Register" +AT91C_ADC_MR.helpkey="ADC Mode Register" +AT91C_ADC_MR.access=memorymapped +AT91C_ADC_MR.address=0xFFFD8004 +AT91C_ADC_MR.width=32 +AT91C_ADC_MR.byteEndian=little +AT91C_ADC_IMR.name="AT91C_ADC_IMR" +AT91C_ADC_IMR.description="ADC Interrupt Mask Register" +AT91C_ADC_IMR.helpkey="ADC Interrupt Mask Register" +AT91C_ADC_IMR.access=memorymapped +AT91C_ADC_IMR.address=0xFFFD802C +AT91C_ADC_IMR.width=32 +AT91C_ADC_IMR.byteEndian=little +AT91C_ADC_IMR.permission.write=none +# ========== Group definition for SYS peripheral ========== +group.SYS.description="ATMEL SYS Registers" +group.SYS.helpkey="ATMEL SYS Registers" +# ========== Group definition for AIC peripheral ========== +group.AIC.description="ATMEL AIC Registers" +group.AIC.helpkey="ATMEL AIC Registers" +group.AIC.register.0=AT91C_AIC_IVR +group.AIC.register.1=AT91C_AIC_SMR +group.AIC.register.2=AT91C_AIC_FVR +group.AIC.register.3=AT91C_AIC_DCR +group.AIC.register.4=AT91C_AIC_EOICR +group.AIC.register.5=AT91C_AIC_SVR +group.AIC.register.6=AT91C_AIC_FFSR +group.AIC.register.7=AT91C_AIC_ICCR +group.AIC.register.8=AT91C_AIC_ISR +group.AIC.register.9=AT91C_AIC_IMR +group.AIC.register.10=AT91C_AIC_IPR +group.AIC.register.11=AT91C_AIC_FFER +group.AIC.register.12=AT91C_AIC_IECR +group.AIC.register.13=AT91C_AIC_ISCR +group.AIC.register.14=AT91C_AIC_FFDR +group.AIC.register.15=AT91C_AIC_CISR +group.AIC.register.16=AT91C_AIC_IDCR +group.AIC.register.17=AT91C_AIC_SPU +# ========== Group definition for PDC_DBGU peripheral ========== +group.PDC_DBGU.description="ATMEL PDC_DBGU Registers" +group.PDC_DBGU.helpkey="ATMEL PDC_DBGU Registers" +group.PDC_DBGU.register.0=AT91C_DBGU_TCR +group.PDC_DBGU.register.1=AT91C_DBGU_RNPR +group.PDC_DBGU.register.2=AT91C_DBGU_TNPR +group.PDC_DBGU.register.3=AT91C_DBGU_TPR +group.PDC_DBGU.register.4=AT91C_DBGU_RPR +group.PDC_DBGU.register.5=AT91C_DBGU_RCR +group.PDC_DBGU.register.6=AT91C_DBGU_RNCR +group.PDC_DBGU.register.7=AT91C_DBGU_PTCR +group.PDC_DBGU.register.8=AT91C_DBGU_PTSR +group.PDC_DBGU.register.9=AT91C_DBGU_TNCR +# ========== Group definition for DBGU peripheral ========== +group.DBGU.description="ATMEL DBGU Registers" +group.DBGU.helpkey="ATMEL DBGU Registers" +group.DBGU.register.0=AT91C_DBGU_EXID +group.DBGU.register.1=AT91C_DBGU_BRGR +group.DBGU.register.2=AT91C_DBGU_IDR +group.DBGU.register.3=AT91C_DBGU_CSR +group.DBGU.register.4=AT91C_DBGU_CIDR +group.DBGU.register.5=AT91C_DBGU_MR +group.DBGU.register.6=AT91C_DBGU_IMR +group.DBGU.register.7=AT91C_DBGU_CR +group.DBGU.register.8=AT91C_DBGU_FNTR +group.DBGU.register.9=AT91C_DBGU_THR +group.DBGU.register.10=AT91C_DBGU_RHR +group.DBGU.register.11=AT91C_DBGU_IER +# ========== Group definition for PIOA peripheral ========== +group.PIOA.description="ATMEL PIOA Registers" +group.PIOA.helpkey="ATMEL PIOA Registers" +group.PIOA.register.0=AT91C_PIOA_ODR +group.PIOA.register.1=AT91C_PIOA_SODR +group.PIOA.register.2=AT91C_PIOA_ISR +group.PIOA.register.3=AT91C_PIOA_ABSR +group.PIOA.register.4=AT91C_PIOA_IER +group.PIOA.register.5=AT91C_PIOA_PPUDR +group.PIOA.register.6=AT91C_PIOA_IMR +group.PIOA.register.7=AT91C_PIOA_PER +group.PIOA.register.8=AT91C_PIOA_IFDR +group.PIOA.register.9=AT91C_PIOA_OWDR +group.PIOA.register.10=AT91C_PIOA_MDSR +group.PIOA.register.11=AT91C_PIOA_IDR +group.PIOA.register.12=AT91C_PIOA_ODSR +group.PIOA.register.13=AT91C_PIOA_PPUSR +group.PIOA.register.14=AT91C_PIOA_OWSR +group.PIOA.register.15=AT91C_PIOA_BSR +group.PIOA.register.16=AT91C_PIOA_OWER +group.PIOA.register.17=AT91C_PIOA_IFER +group.PIOA.register.18=AT91C_PIOA_PDSR +group.PIOA.register.19=AT91C_PIOA_PPUER +group.PIOA.register.20=AT91C_PIOA_OSR +group.PIOA.register.21=AT91C_PIOA_ASR +group.PIOA.register.22=AT91C_PIOA_MDDR +group.PIOA.register.23=AT91C_PIOA_CODR +group.PIOA.register.24=AT91C_PIOA_MDER +group.PIOA.register.25=AT91C_PIOA_PDR +group.PIOA.register.26=AT91C_PIOA_IFSR +group.PIOA.register.27=AT91C_PIOA_OER +group.PIOA.register.28=AT91C_PIOA_PSR +# ========== Group definition for PIOB peripheral ========== +group.PIOB.description="ATMEL PIOB Registers" +group.PIOB.helpkey="ATMEL PIOB Registers" +group.PIOB.register.0=AT91C_PIOB_OWDR +group.PIOB.register.1=AT91C_PIOB_MDER +group.PIOB.register.2=AT91C_PIOB_PPUSR +group.PIOB.register.3=AT91C_PIOB_IMR +group.PIOB.register.4=AT91C_PIOB_ASR +group.PIOB.register.5=AT91C_PIOB_PPUDR +group.PIOB.register.6=AT91C_PIOB_PSR +group.PIOB.register.7=AT91C_PIOB_IER +group.PIOB.register.8=AT91C_PIOB_CODR +group.PIOB.register.9=AT91C_PIOB_OWER +group.PIOB.register.10=AT91C_PIOB_ABSR +group.PIOB.register.11=AT91C_PIOB_IFDR +group.PIOB.register.12=AT91C_PIOB_PDSR +group.PIOB.register.13=AT91C_PIOB_IDR +group.PIOB.register.14=AT91C_PIOB_OWSR +group.PIOB.register.15=AT91C_PIOB_PDR +group.PIOB.register.16=AT91C_PIOB_ODR +group.PIOB.register.17=AT91C_PIOB_IFSR +group.PIOB.register.18=AT91C_PIOB_PPUER +group.PIOB.register.19=AT91C_PIOB_SODR +group.PIOB.register.20=AT91C_PIOB_ISR +group.PIOB.register.21=AT91C_PIOB_ODSR +group.PIOB.register.22=AT91C_PIOB_OSR +group.PIOB.register.23=AT91C_PIOB_MDSR +group.PIOB.register.24=AT91C_PIOB_IFER +group.PIOB.register.25=AT91C_PIOB_BSR +group.PIOB.register.26=AT91C_PIOB_MDDR +group.PIOB.register.27=AT91C_PIOB_OER +group.PIOB.register.28=AT91C_PIOB_PER +# ========== Group definition for CKGR peripheral ========== +group.CKGR.description="ATMEL CKGR Registers" +group.CKGR.helpkey="ATMEL CKGR Registers" +group.CKGR.register.0=AT91C_CKGR_MOR +group.CKGR.register.1=AT91C_CKGR_PLLR +group.CKGR.register.2=AT91C_CKGR_MCFR +# ========== Group definition for PMC peripheral ========== +group.PMC.description="ATMEL PMC Registers" +group.PMC.helpkey="ATMEL PMC Registers" +group.PMC.register.0=AT91C_PMC_IDR +group.PMC.register.1=AT91C_PMC_MOR +group.PMC.register.2=AT91C_PMC_PLLR +group.PMC.register.3=AT91C_PMC_PCER +group.PMC.register.4=AT91C_PMC_PCKR +group.PMC.register.5=AT91C_PMC_MCKR +group.PMC.register.6=AT91C_PMC_SCDR +group.PMC.register.7=AT91C_PMC_PCDR +group.PMC.register.8=AT91C_PMC_SCSR +group.PMC.register.9=AT91C_PMC_PCSR +group.PMC.register.10=AT91C_PMC_MCFR +group.PMC.register.11=AT91C_PMC_SCER +group.PMC.register.12=AT91C_PMC_IMR +group.PMC.register.13=AT91C_PMC_IER +group.PMC.register.14=AT91C_PMC_SR +# ========== Group definition for RSTC peripheral ========== +group.RSTC.description="ATMEL RSTC Registers" +group.RSTC.helpkey="ATMEL RSTC Registers" +group.RSTC.register.0=AT91C_RSTC_RCR +group.RSTC.register.1=AT91C_RSTC_RMR +group.RSTC.register.2=AT91C_RSTC_RSR +# ========== Group definition for RTTC peripheral ========== +group.RTTC.description="ATMEL RTTC Registers" +group.RTTC.helpkey="ATMEL RTTC Registers" +group.RTTC.register.0=AT91C_RTTC_RTSR +group.RTTC.register.1=AT91C_RTTC_RTMR +group.RTTC.register.2=AT91C_RTTC_RTVR +group.RTTC.register.3=AT91C_RTTC_RTAR +# ========== Group definition for PITC peripheral ========== +group.PITC.description="ATMEL PITC Registers" +group.PITC.helpkey="ATMEL PITC Registers" +group.PITC.register.0=AT91C_PITC_PIVR +group.PITC.register.1=AT91C_PITC_PISR +group.PITC.register.2=AT91C_PITC_PIIR +group.PITC.register.3=AT91C_PITC_PIMR +# ========== Group definition for WDTC peripheral ========== +group.WDTC.description="ATMEL WDTC Registers" +group.WDTC.helpkey="ATMEL WDTC Registers" +group.WDTC.register.0=AT91C_WDTC_WDCR +group.WDTC.register.1=AT91C_WDTC_WDSR +group.WDTC.register.2=AT91C_WDTC_WDMR +# ========== Group definition for VREG peripheral ========== +group.VREG.description="ATMEL VREG Registers" +group.VREG.helpkey="ATMEL VREG Registers" +group.VREG.register.0=AT91C_VREG_MR +# ========== Group definition for MC peripheral ========== +group.MC.description="ATMEL MC Registers" +group.MC.helpkey="ATMEL MC Registers" +group.MC.register.0=AT91C_MC_ASR +group.MC.register.1=AT91C_MC_RCR +group.MC.register.2=AT91C_MC_FCR +group.MC.register.3=AT91C_MC_AASR +group.MC.register.4=AT91C_MC_FSR +group.MC.register.5=AT91C_MC_FMR +# ========== Group definition for PDC_SPI1 peripheral ========== +group.PDC_SPI1.description="ATMEL PDC_SPI1 Registers" +group.PDC_SPI1.helpkey="ATMEL PDC_SPI1 Registers" +group.PDC_SPI1.register.0=AT91C_SPI1_PTCR +group.PDC_SPI1.register.1=AT91C_SPI1_RPR +group.PDC_SPI1.register.2=AT91C_SPI1_TNCR +group.PDC_SPI1.register.3=AT91C_SPI1_TPR +group.PDC_SPI1.register.4=AT91C_SPI1_TNPR +group.PDC_SPI1.register.5=AT91C_SPI1_TCR +group.PDC_SPI1.register.6=AT91C_SPI1_RCR +group.PDC_SPI1.register.7=AT91C_SPI1_RNPR +group.PDC_SPI1.register.8=AT91C_SPI1_RNCR +group.PDC_SPI1.register.9=AT91C_SPI1_PTSR +# ========== Group definition for SPI1 peripheral ========== +group.SPI1.description="ATMEL SPI1 Registers" +group.SPI1.helpkey="ATMEL SPI1 Registers" +group.SPI1.register.0=AT91C_SPI1_IMR +group.SPI1.register.1=AT91C_SPI1_IER +group.SPI1.register.2=AT91C_SPI1_MR +group.SPI1.register.3=AT91C_SPI1_RDR +group.SPI1.register.4=AT91C_SPI1_IDR +group.SPI1.register.5=AT91C_SPI1_SR +group.SPI1.register.6=AT91C_SPI1_TDR +group.SPI1.register.7=AT91C_SPI1_CR +group.SPI1.register.8=AT91C_SPI1_CSR +# ========== Group definition for PDC_SPI0 peripheral ========== +group.PDC_SPI0.description="ATMEL PDC_SPI0 Registers" +group.PDC_SPI0.helpkey="ATMEL PDC_SPI0 Registers" +group.PDC_SPI0.register.0=AT91C_SPI0_PTCR +group.PDC_SPI0.register.1=AT91C_SPI0_TPR +group.PDC_SPI0.register.2=AT91C_SPI0_TCR +group.PDC_SPI0.register.3=AT91C_SPI0_RCR +group.PDC_SPI0.register.4=AT91C_SPI0_PTSR +group.PDC_SPI0.register.5=AT91C_SPI0_RNPR +group.PDC_SPI0.register.6=AT91C_SPI0_RPR +group.PDC_SPI0.register.7=AT91C_SPI0_TNCR +group.PDC_SPI0.register.8=AT91C_SPI0_RNCR +group.PDC_SPI0.register.9=AT91C_SPI0_TNPR +# ========== Group definition for SPI0 peripheral ========== +group.SPI0.description="ATMEL SPI0 Registers" +group.SPI0.helpkey="ATMEL SPI0 Registers" +group.SPI0.register.0=AT91C_SPI0_IER +group.SPI0.register.1=AT91C_SPI0_SR +group.SPI0.register.2=AT91C_SPI0_IDR +group.SPI0.register.3=AT91C_SPI0_CR +group.SPI0.register.4=AT91C_SPI0_MR +group.SPI0.register.5=AT91C_SPI0_IMR +group.SPI0.register.6=AT91C_SPI0_TDR +group.SPI0.register.7=AT91C_SPI0_RDR +group.SPI0.register.8=AT91C_SPI0_CSR +# ========== Group definition for PDC_US1 peripheral ========== +group.PDC_US1.description="ATMEL PDC_US1 Registers" +group.PDC_US1.helpkey="ATMEL PDC_US1 Registers" +group.PDC_US1.register.0=AT91C_US1_RNCR +group.PDC_US1.register.1=AT91C_US1_PTCR +group.PDC_US1.register.2=AT91C_US1_TCR +group.PDC_US1.register.3=AT91C_US1_PTSR +group.PDC_US1.register.4=AT91C_US1_TNPR +group.PDC_US1.register.5=AT91C_US1_RCR +group.PDC_US1.register.6=AT91C_US1_RNPR +group.PDC_US1.register.7=AT91C_US1_RPR +group.PDC_US1.register.8=AT91C_US1_TNCR +group.PDC_US1.register.9=AT91C_US1_TPR +# ========== Group definition for US1 peripheral ========== +group.US1.description="ATMEL US1 Registers" +group.US1.helpkey="ATMEL US1 Registers" +group.US1.register.0=AT91C_US1_IF +group.US1.register.1=AT91C_US1_NER +group.US1.register.2=AT91C_US1_RTOR +group.US1.register.3=AT91C_US1_CSR +group.US1.register.4=AT91C_US1_IDR +group.US1.register.5=AT91C_US1_IER +group.US1.register.6=AT91C_US1_THR +group.US1.register.7=AT91C_US1_TTGR +group.US1.register.8=AT91C_US1_RHR +group.US1.register.9=AT91C_US1_BRGR +group.US1.register.10=AT91C_US1_IMR +group.US1.register.11=AT91C_US1_FIDI +group.US1.register.12=AT91C_US1_CR +group.US1.register.13=AT91C_US1_MR +# ========== Group definition for PDC_US0 peripheral ========== +group.PDC_US0.description="ATMEL PDC_US0 Registers" +group.PDC_US0.helpkey="ATMEL PDC_US0 Registers" +group.PDC_US0.register.0=AT91C_US0_TNPR +group.PDC_US0.register.1=AT91C_US0_RNPR +group.PDC_US0.register.2=AT91C_US0_TCR +group.PDC_US0.register.3=AT91C_US0_PTCR +group.PDC_US0.register.4=AT91C_US0_PTSR +group.PDC_US0.register.5=AT91C_US0_TNCR +group.PDC_US0.register.6=AT91C_US0_TPR +group.PDC_US0.register.7=AT91C_US0_RCR +group.PDC_US0.register.8=AT91C_US0_RPR +group.PDC_US0.register.9=AT91C_US0_RNCR +# ========== Group definition for US0 peripheral ========== +group.US0.description="ATMEL US0 Registers" +group.US0.helpkey="ATMEL US0 Registers" +group.US0.register.0=AT91C_US0_BRGR +group.US0.register.1=AT91C_US0_NER +group.US0.register.2=AT91C_US0_CR +group.US0.register.3=AT91C_US0_IMR +group.US0.register.4=AT91C_US0_FIDI +group.US0.register.5=AT91C_US0_TTGR +group.US0.register.6=AT91C_US0_MR +group.US0.register.7=AT91C_US0_RTOR +group.US0.register.8=AT91C_US0_CSR +group.US0.register.9=AT91C_US0_RHR +group.US0.register.10=AT91C_US0_IDR +group.US0.register.11=AT91C_US0_THR +group.US0.register.12=AT91C_US0_IF +group.US0.register.13=AT91C_US0_IER +# ========== Group definition for PDC_SSC peripheral ========== +group.PDC_SSC.description="ATMEL PDC_SSC Registers" +group.PDC_SSC.helpkey="ATMEL PDC_SSC Registers" +group.PDC_SSC.register.0=AT91C_SSC_TNCR +group.PDC_SSC.register.1=AT91C_SSC_RPR +group.PDC_SSC.register.2=AT91C_SSC_RNCR +group.PDC_SSC.register.3=AT91C_SSC_TPR +group.PDC_SSC.register.4=AT91C_SSC_PTCR +group.PDC_SSC.register.5=AT91C_SSC_TCR +group.PDC_SSC.register.6=AT91C_SSC_RCR +group.PDC_SSC.register.7=AT91C_SSC_RNPR +group.PDC_SSC.register.8=AT91C_SSC_TNPR +group.PDC_SSC.register.9=AT91C_SSC_PTSR +# ========== Group definition for SSC peripheral ========== +group.SSC.description="ATMEL SSC Registers" +group.SSC.helpkey="ATMEL SSC Registers" +group.SSC.register.0=AT91C_SSC_RHR +group.SSC.register.1=AT91C_SSC_RSHR +group.SSC.register.2=AT91C_SSC_TFMR +group.SSC.register.3=AT91C_SSC_IDR +group.SSC.register.4=AT91C_SSC_THR +group.SSC.register.5=AT91C_SSC_RCMR +group.SSC.register.6=AT91C_SSC_IER +group.SSC.register.7=AT91C_SSC_TSHR +group.SSC.register.8=AT91C_SSC_SR +group.SSC.register.9=AT91C_SSC_CMR +group.SSC.register.10=AT91C_SSC_TCMR +group.SSC.register.11=AT91C_SSC_CR +group.SSC.register.12=AT91C_SSC_IMR +group.SSC.register.13=AT91C_SSC_RFMR +# ========== Group definition for TWI peripheral ========== +group.TWI.description="ATMEL TWI Registers" +group.TWI.helpkey="ATMEL TWI Registers" +group.TWI.register.0=AT91C_TWI_IER +group.TWI.register.1=AT91C_TWI_CR +group.TWI.register.2=AT91C_TWI_SR +group.TWI.register.3=AT91C_TWI_IMR +group.TWI.register.4=AT91C_TWI_THR +group.TWI.register.5=AT91C_TWI_IDR +group.TWI.register.6=AT91C_TWI_IADR +group.TWI.register.7=AT91C_TWI_MMR +group.TWI.register.8=AT91C_TWI_CWGR +group.TWI.register.9=AT91C_TWI_RHR +# ========== Group definition for PWMC_CH3 peripheral ========== +group.PWMC_CH3.description="ATMEL PWMC_CH3 Registers" +group.PWMC_CH3.helpkey="ATMEL PWMC_CH3 Registers" +group.PWMC_CH3.register.0=AT91C_PWMC_CH3_CUPDR +group.PWMC_CH3.register.1=AT91C_PWMC_CH3_Reserved +group.PWMC_CH3.register.2=AT91C_PWMC_CH3_CPRDR +group.PWMC_CH3.register.3=AT91C_PWMC_CH3_CDTYR +group.PWMC_CH3.register.4=AT91C_PWMC_CH3_CCNTR +group.PWMC_CH3.register.5=AT91C_PWMC_CH3_CMR +# ========== Group definition for PWMC_CH2 peripheral ========== +group.PWMC_CH2.description="ATMEL PWMC_CH2 Registers" +group.PWMC_CH2.helpkey="ATMEL PWMC_CH2 Registers" +group.PWMC_CH2.register.0=AT91C_PWMC_CH2_Reserved +group.PWMC_CH2.register.1=AT91C_PWMC_CH2_CMR +group.PWMC_CH2.register.2=AT91C_PWMC_CH2_CCNTR +group.PWMC_CH2.register.3=AT91C_PWMC_CH2_CPRDR +group.PWMC_CH2.register.4=AT91C_PWMC_CH2_CUPDR +group.PWMC_CH2.register.5=AT91C_PWMC_CH2_CDTYR +# ========== Group definition for PWMC_CH1 peripheral ========== +group.PWMC_CH1.description="ATMEL PWMC_CH1 Registers" +group.PWMC_CH1.helpkey="ATMEL PWMC_CH1 Registers" +group.PWMC_CH1.register.0=AT91C_PWMC_CH1_Reserved +group.PWMC_CH1.register.1=AT91C_PWMC_CH1_CUPDR +group.PWMC_CH1.register.2=AT91C_PWMC_CH1_CPRDR +group.PWMC_CH1.register.3=AT91C_PWMC_CH1_CCNTR +group.PWMC_CH1.register.4=AT91C_PWMC_CH1_CDTYR +group.PWMC_CH1.register.5=AT91C_PWMC_CH1_CMR +# ========== Group definition for PWMC_CH0 peripheral ========== +group.PWMC_CH0.description="ATMEL PWMC_CH0 Registers" +group.PWMC_CH0.helpkey="ATMEL PWMC_CH0 Registers" +group.PWMC_CH0.register.0=AT91C_PWMC_CH0_Reserved +group.PWMC_CH0.register.1=AT91C_PWMC_CH0_CPRDR +group.PWMC_CH0.register.2=AT91C_PWMC_CH0_CDTYR +group.PWMC_CH0.register.3=AT91C_PWMC_CH0_CMR +group.PWMC_CH0.register.4=AT91C_PWMC_CH0_CUPDR +group.PWMC_CH0.register.5=AT91C_PWMC_CH0_CCNTR +# ========== Group definition for PWMC peripheral ========== +group.PWMC.description="ATMEL PWMC Registers" +group.PWMC.helpkey="ATMEL PWMC Registers" +group.PWMC.register.0=AT91C_PWMC_IDR +group.PWMC.register.1=AT91C_PWMC_DIS +group.PWMC.register.2=AT91C_PWMC_IER +group.PWMC.register.3=AT91C_PWMC_VR +group.PWMC.register.4=AT91C_PWMC_ISR +group.PWMC.register.5=AT91C_PWMC_SR +group.PWMC.register.6=AT91C_PWMC_IMR +group.PWMC.register.7=AT91C_PWMC_MR +group.PWMC.register.8=AT91C_PWMC_ENA +# ========== Group definition for UDP peripheral ========== +group.UDP.description="ATMEL UDP Registers" +group.UDP.helpkey="ATMEL UDP Registers" +group.UDP.register.0=AT91C_UDP_IMR +group.UDP.register.1=AT91C_UDP_FADDR +group.UDP.register.2=AT91C_UDP_NUM +group.UDP.register.3=AT91C_UDP_FDR +group.UDP.register.4=AT91C_UDP_ISR +group.UDP.register.5=AT91C_UDP_CSR +group.UDP.register.6=AT91C_UDP_IDR +group.UDP.register.7=AT91C_UDP_ICR +group.UDP.register.8=AT91C_UDP_RSTEP +group.UDP.register.9=AT91C_UDP_TXVC +group.UDP.register.10=AT91C_UDP_GLBSTATE +group.UDP.register.11=AT91C_UDP_IER +# ========== Group definition for TC0 peripheral ========== +group.TC0.description="ATMEL TC0 Registers" +group.TC0.helpkey="ATMEL TC0 Registers" +group.TC0.register.0=AT91C_TC0_SR +group.TC0.register.1=AT91C_TC0_RC +group.TC0.register.2=AT91C_TC0_RB +group.TC0.register.3=AT91C_TC0_CCR +group.TC0.register.4=AT91C_TC0_CMR +group.TC0.register.5=AT91C_TC0_IER +group.TC0.register.6=AT91C_TC0_RA +group.TC0.register.7=AT91C_TC0_IDR +group.TC0.register.8=AT91C_TC0_CV +group.TC0.register.9=AT91C_TC0_IMR +# ========== Group definition for TC1 peripheral ========== +group.TC1.description="ATMEL TC1 Registers" +group.TC1.helpkey="ATMEL TC1 Registers" +group.TC1.register.0=AT91C_TC1_RB +group.TC1.register.1=AT91C_TC1_CCR +group.TC1.register.2=AT91C_TC1_IER +group.TC1.register.3=AT91C_TC1_IDR +group.TC1.register.4=AT91C_TC1_SR +group.TC1.register.5=AT91C_TC1_CMR +group.TC1.register.6=AT91C_TC1_RA +group.TC1.register.7=AT91C_TC1_RC +group.TC1.register.8=AT91C_TC1_IMR +group.TC1.register.9=AT91C_TC1_CV +# ========== Group definition for TC2 peripheral ========== +group.TC2.description="ATMEL TC2 Registers" +group.TC2.helpkey="ATMEL TC2 Registers" +group.TC2.register.0=AT91C_TC2_CMR +group.TC2.register.1=AT91C_TC2_CCR +group.TC2.register.2=AT91C_TC2_CV +group.TC2.register.3=AT91C_TC2_RA +group.TC2.register.4=AT91C_TC2_RB +group.TC2.register.5=AT91C_TC2_IDR +group.TC2.register.6=AT91C_TC2_IMR +group.TC2.register.7=AT91C_TC2_RC +group.TC2.register.8=AT91C_TC2_IER +group.TC2.register.9=AT91C_TC2_SR +# ========== Group definition for TCB peripheral ========== +group.TCB.description="ATMEL TCB Registers" +group.TCB.helpkey="ATMEL TCB Registers" +group.TCB.register.0=AT91C_TCB_BMR +group.TCB.register.1=AT91C_TCB_BCR +# ========== Group definition for CAN_MB0 peripheral ========== +group.CAN_MB0.description="ATMEL CAN_MB0 Registers" +group.CAN_MB0.helpkey="ATMEL CAN_MB0 Registers" +group.CAN_MB0.register.0=AT91C_CAN_MB0_MDL +group.CAN_MB0.register.1=AT91C_CAN_MB0_MAM +group.CAN_MB0.register.2=AT91C_CAN_MB0_MCR +group.CAN_MB0.register.3=AT91C_CAN_MB0_MID +group.CAN_MB0.register.4=AT91C_CAN_MB0_MSR +group.CAN_MB0.register.5=AT91C_CAN_MB0_MFID +group.CAN_MB0.register.6=AT91C_CAN_MB0_MDH +group.CAN_MB0.register.7=AT91C_CAN_MB0_MMR +# ========== Group definition for CAN_MB1 peripheral ========== +group.CAN_MB1.description="ATMEL CAN_MB1 Registers" +group.CAN_MB1.helpkey="ATMEL CAN_MB1 Registers" +group.CAN_MB1.register.0=AT91C_CAN_MB1_MDL +group.CAN_MB1.register.1=AT91C_CAN_MB1_MID +group.CAN_MB1.register.2=AT91C_CAN_MB1_MMR +group.CAN_MB1.register.3=AT91C_CAN_MB1_MSR +group.CAN_MB1.register.4=AT91C_CAN_MB1_MAM +group.CAN_MB1.register.5=AT91C_CAN_MB1_MDH +group.CAN_MB1.register.6=AT91C_CAN_MB1_MCR +group.CAN_MB1.register.7=AT91C_CAN_MB1_MFID +# ========== Group definition for CAN_MB2 peripheral ========== +group.CAN_MB2.description="ATMEL CAN_MB2 Registers" +group.CAN_MB2.helpkey="ATMEL CAN_MB2 Registers" +group.CAN_MB2.register.0=AT91C_CAN_MB2_MCR +group.CAN_MB2.register.1=AT91C_CAN_MB2_MDH +group.CAN_MB2.register.2=AT91C_CAN_MB2_MID +group.CAN_MB2.register.3=AT91C_CAN_MB2_MDL +group.CAN_MB2.register.4=AT91C_CAN_MB2_MMR +group.CAN_MB2.register.5=AT91C_CAN_MB2_MAM +group.CAN_MB2.register.6=AT91C_CAN_MB2_MFID +group.CAN_MB2.register.7=AT91C_CAN_MB2_MSR +# ========== Group definition for CAN_MB3 peripheral ========== +group.CAN_MB3.description="ATMEL CAN_MB3 Registers" +group.CAN_MB3.helpkey="ATMEL CAN_MB3 Registers" +group.CAN_MB3.register.0=AT91C_CAN_MB3_MFID +group.CAN_MB3.register.1=AT91C_CAN_MB3_MAM +group.CAN_MB3.register.2=AT91C_CAN_MB3_MID +group.CAN_MB3.register.3=AT91C_CAN_MB3_MCR +group.CAN_MB3.register.4=AT91C_CAN_MB3_MMR +group.CAN_MB3.register.5=AT91C_CAN_MB3_MSR +group.CAN_MB3.register.6=AT91C_CAN_MB3_MDL +group.CAN_MB3.register.7=AT91C_CAN_MB3_MDH +# ========== Group definition for CAN_MB4 peripheral ========== +group.CAN_MB4.description="ATMEL CAN_MB4 Registers" +group.CAN_MB4.helpkey="ATMEL CAN_MB4 Registers" +group.CAN_MB4.register.0=AT91C_CAN_MB4_MID +group.CAN_MB4.register.1=AT91C_CAN_MB4_MMR +group.CAN_MB4.register.2=AT91C_CAN_MB4_MDH +group.CAN_MB4.register.3=AT91C_CAN_MB4_MFID +group.CAN_MB4.register.4=AT91C_CAN_MB4_MSR +group.CAN_MB4.register.5=AT91C_CAN_MB4_MCR +group.CAN_MB4.register.6=AT91C_CAN_MB4_MDL +group.CAN_MB4.register.7=AT91C_CAN_MB4_MAM +# ========== Group definition for CAN_MB5 peripheral ========== +group.CAN_MB5.description="ATMEL CAN_MB5 Registers" +group.CAN_MB5.helpkey="ATMEL CAN_MB5 Registers" +group.CAN_MB5.register.0=AT91C_CAN_MB5_MSR +group.CAN_MB5.register.1=AT91C_CAN_MB5_MCR +group.CAN_MB5.register.2=AT91C_CAN_MB5_MFID +group.CAN_MB5.register.3=AT91C_CAN_MB5_MDH +group.CAN_MB5.register.4=AT91C_CAN_MB5_MID +group.CAN_MB5.register.5=AT91C_CAN_MB5_MMR +group.CAN_MB5.register.6=AT91C_CAN_MB5_MDL +group.CAN_MB5.register.7=AT91C_CAN_MB5_MAM +# ========== Group definition for CAN_MB6 peripheral ========== +group.CAN_MB6.description="ATMEL CAN_MB6 Registers" +group.CAN_MB6.helpkey="ATMEL CAN_MB6 Registers" +group.CAN_MB6.register.0=AT91C_CAN_MB6_MFID +group.CAN_MB6.register.1=AT91C_CAN_MB6_MID +group.CAN_MB6.register.2=AT91C_CAN_MB6_MAM +group.CAN_MB6.register.3=AT91C_CAN_MB6_MSR +group.CAN_MB6.register.4=AT91C_CAN_MB6_MDL +group.CAN_MB6.register.5=AT91C_CAN_MB6_MCR +group.CAN_MB6.register.6=AT91C_CAN_MB6_MDH +group.CAN_MB6.register.7=AT91C_CAN_MB6_MMR +# ========== Group definition for CAN_MB7 peripheral ========== +group.CAN_MB7.description="ATMEL CAN_MB7 Registers" +group.CAN_MB7.helpkey="ATMEL CAN_MB7 Registers" +group.CAN_MB7.register.0=AT91C_CAN_MB7_MCR +group.CAN_MB7.register.1=AT91C_CAN_MB7_MDH +group.CAN_MB7.register.2=AT91C_CAN_MB7_MFID +group.CAN_MB7.register.3=AT91C_CAN_MB7_MDL +group.CAN_MB7.register.4=AT91C_CAN_MB7_MID +group.CAN_MB7.register.5=AT91C_CAN_MB7_MMR +group.CAN_MB7.register.6=AT91C_CAN_MB7_MAM +group.CAN_MB7.register.7=AT91C_CAN_MB7_MSR +# ========== Group definition for CAN peripheral ========== +group.CAN.description="ATMEL CAN Registers" +group.CAN.helpkey="ATMEL CAN Registers" +group.CAN.register.0=AT91C_CAN_TCR +group.CAN.register.1=AT91C_CAN_IMR +group.CAN.register.2=AT91C_CAN_IER +group.CAN.register.3=AT91C_CAN_ECR +group.CAN.register.4=AT91C_CAN_TIMESTP +group.CAN.register.5=AT91C_CAN_MR +group.CAN.register.6=AT91C_CAN_IDR +group.CAN.register.7=AT91C_CAN_ACR +group.CAN.register.8=AT91C_CAN_TIM +group.CAN.register.9=AT91C_CAN_SR +group.CAN.register.10=AT91C_CAN_BR +group.CAN.register.11=AT91C_CAN_VR +# ========== Group definition for EMAC peripheral ========== +group.EMAC.description="ATMEL EMAC Registers" +group.EMAC.helpkey="ATMEL EMAC Registers" +group.EMAC.register.0=AT91C_EMAC_ISR +group.EMAC.register.1=AT91C_EMAC_SA4H +group.EMAC.register.2=AT91C_EMAC_SA1L +group.EMAC.register.3=AT91C_EMAC_ELE +group.EMAC.register.4=AT91C_EMAC_LCOL +group.EMAC.register.5=AT91C_EMAC_RLE +group.EMAC.register.6=AT91C_EMAC_WOL +group.EMAC.register.7=AT91C_EMAC_DTF +group.EMAC.register.8=AT91C_EMAC_TUND +group.EMAC.register.9=AT91C_EMAC_NCR +group.EMAC.register.10=AT91C_EMAC_SA4L +group.EMAC.register.11=AT91C_EMAC_RSR +group.EMAC.register.12=AT91C_EMAC_SA3L +group.EMAC.register.13=AT91C_EMAC_TSR +group.EMAC.register.14=AT91C_EMAC_IDR +group.EMAC.register.15=AT91C_EMAC_RSE +group.EMAC.register.16=AT91C_EMAC_ECOL +group.EMAC.register.17=AT91C_EMAC_TID +group.EMAC.register.18=AT91C_EMAC_HRB +group.EMAC.register.19=AT91C_EMAC_TBQP +group.EMAC.register.20=AT91C_EMAC_USRIO +group.EMAC.register.21=AT91C_EMAC_PTR +group.EMAC.register.22=AT91C_EMAC_SA2H +group.EMAC.register.23=AT91C_EMAC_ROV +group.EMAC.register.24=AT91C_EMAC_ALE +group.EMAC.register.25=AT91C_EMAC_RJA +group.EMAC.register.26=AT91C_EMAC_RBQP +group.EMAC.register.27=AT91C_EMAC_TPF +group.EMAC.register.28=AT91C_EMAC_NCFGR +group.EMAC.register.29=AT91C_EMAC_HRT +group.EMAC.register.30=AT91C_EMAC_USF +group.EMAC.register.31=AT91C_EMAC_FCSE +group.EMAC.register.32=AT91C_EMAC_TPQ +group.EMAC.register.33=AT91C_EMAC_MAN +group.EMAC.register.34=AT91C_EMAC_FTO +group.EMAC.register.35=AT91C_EMAC_REV +group.EMAC.register.36=AT91C_EMAC_IMR +group.EMAC.register.37=AT91C_EMAC_SCF +group.EMAC.register.38=AT91C_EMAC_PFR +group.EMAC.register.39=AT91C_EMAC_MCF +group.EMAC.register.40=AT91C_EMAC_NSR +group.EMAC.register.41=AT91C_EMAC_SA2L +group.EMAC.register.42=AT91C_EMAC_FRO +group.EMAC.register.43=AT91C_EMAC_IER +group.EMAC.register.44=AT91C_EMAC_SA1H +group.EMAC.register.45=AT91C_EMAC_CSE +group.EMAC.register.46=AT91C_EMAC_SA3H +group.EMAC.register.47=AT91C_EMAC_RRE +group.EMAC.register.48=AT91C_EMAC_STE +# ========== Group definition for PDC_ADC peripheral ========== +group.PDC_ADC.description="ATMEL PDC_ADC Registers" +group.PDC_ADC.helpkey="ATMEL PDC_ADC Registers" +group.PDC_ADC.register.0=AT91C_ADC_PTSR +group.PDC_ADC.register.1=AT91C_ADC_PTCR +group.PDC_ADC.register.2=AT91C_ADC_TNPR +group.PDC_ADC.register.3=AT91C_ADC_TNCR +group.PDC_ADC.register.4=AT91C_ADC_RNPR +group.PDC_ADC.register.5=AT91C_ADC_RNCR +group.PDC_ADC.register.6=AT91C_ADC_RPR +group.PDC_ADC.register.7=AT91C_ADC_TCR +group.PDC_ADC.register.8=AT91C_ADC_TPR +group.PDC_ADC.register.9=AT91C_ADC_RCR +# ========== Group definition for ADC peripheral ========== +group.ADC.description="ATMEL ADC Registers" +group.ADC.helpkey="ATMEL ADC Registers" +group.ADC.register.0=AT91C_ADC_CDR2 +group.ADC.register.1=AT91C_ADC_CDR3 +group.ADC.register.2=AT91C_ADC_CDR0 +group.ADC.register.3=AT91C_ADC_CDR5 +group.ADC.register.4=AT91C_ADC_CHDR +group.ADC.register.5=AT91C_ADC_SR +group.ADC.register.6=AT91C_ADC_CDR4 +group.ADC.register.7=AT91C_ADC_CDR1 +group.ADC.register.8=AT91C_ADC_LCDR +group.ADC.register.9=AT91C_ADC_IDR +group.ADC.register.10=AT91C_ADC_CR +group.ADC.register.11=AT91C_ADC_CDR7 +group.ADC.register.12=AT91C_ADC_CDR6 +group.ADC.register.13=AT91C_ADC_IER +group.ADC.register.14=AT91C_ADC_CHER +group.ADC.register.15=AT91C_ADC_CHSR +group.ADC.register.16=AT91C_ADC_MR +group.ADC.register.17=AT91C_ADC_IMR +group.AT91SAM7X256.description="ATMEL AT91SAM7X256 Registers" +group.AT91SAM7X256.helpkey="ATMEL AT91SAM7X256 Registers" +group.AT91SAM7X256.topLevelIndex=100 +group.AT91SAM7X256.group.0=SYS +group.AT91SAM7X256.group.1=AIC +group.AT91SAM7X256.group.2=PDC_DBGU +group.AT91SAM7X256.group.3=DBGU +group.AT91SAM7X256.group.4=PIOA +group.AT91SAM7X256.group.5=PIOB +group.AT91SAM7X256.group.6=CKGR +group.AT91SAM7X256.group.7=PMC +group.AT91SAM7X256.group.8=RSTC +group.AT91SAM7X256.group.9=RTTC +group.AT91SAM7X256.group.10=PITC +group.AT91SAM7X256.group.11=WDTC +group.AT91SAM7X256.group.12=VREG +group.AT91SAM7X256.group.13=MC +group.AT91SAM7X256.group.14=PDC_SPI1 +group.AT91SAM7X256.group.15=SPI1 +group.AT91SAM7X256.group.16=PDC_SPI0 +group.AT91SAM7X256.group.17=SPI0 +group.AT91SAM7X256.group.18=PDC_US1 +group.AT91SAM7X256.group.19=US1 +group.AT91SAM7X256.group.20=PDC_US0 +group.AT91SAM7X256.group.21=US0 +group.AT91SAM7X256.group.22=PDC_SSC +group.AT91SAM7X256.group.23=SSC +group.AT91SAM7X256.group.24=TWI +group.AT91SAM7X256.group.25=PWMC_CH3 +group.AT91SAM7X256.group.26=PWMC_CH2 +group.AT91SAM7X256.group.27=PWMC_CH1 +group.AT91SAM7X256.group.28=PWMC_CH0 +group.AT91SAM7X256.group.29=PWMC +group.AT91SAM7X256.group.30=UDP +group.AT91SAM7X256.group.31=TC0 +group.AT91SAM7X256.group.32=TC1 +group.AT91SAM7X256.group.33=TC2 +group.AT91SAM7X256.group.34=TCB +group.AT91SAM7X256.group.35=CAN_MB0 +group.AT91SAM7X256.group.36=CAN_MB1 +group.AT91SAM7X256.group.37=CAN_MB2 +group.AT91SAM7X256.group.38=CAN_MB3 +group.AT91SAM7X256.group.39=CAN_MB4 +group.AT91SAM7X256.group.40=CAN_MB5 +group.AT91SAM7X256.group.41=CAN_MB6 +group.AT91SAM7X256.group.42=CAN_MB7 +group.AT91SAM7X256.group.43=CAN +group.AT91SAM7X256.group.44=EMAC +group.AT91SAM7X256.group.45=PDC_ADC +group.AT91SAM7X256.group.46=ADC diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.tcl b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.tcl new file mode 100644 index 0000000..5d3a662 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.tcl @@ -0,0 +1,3407 @@ +# ---------------------------------------------------------------------------- +# ATMEL Microcontroller Software Support - ROUSSET - +# ---------------------------------------------------------------------------- +# DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +# DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ---------------------------------------------------------------------------- +# File Name : AT91SAM7X256.tcl +# Object : AT91SAM7X256 definitions +# Generated : AT91 SW Application Group 11/02/2005 (15:17:30) +# +# CVS Reference : /AT91SAM7X256.pl/1.14/Tue Sep 13 15:06:52 2005// +# CVS Reference : /SYS_SAM7X.pl/1.3/Tue Feb 1 17:01:43 2005// +# CVS Reference : /MC_SAM7X.pl/1.2/Fri May 20 14:13:04 2005// +# CVS Reference : /PMC_SAM7X.pl/1.4/Tue Feb 8 13:58:10 2005// +# CVS Reference : /RSTC_SAM7X.pl/1.2/Wed Jul 13 14:57:50 2005// +# CVS Reference : /UDP_SAM7X.pl/1.1/Tue May 10 11:35:35 2005// +# CVS Reference : /PWM_SAM7X.pl/1.1/Tue May 10 11:53:07 2005// +# CVS Reference : /AIC_6075B.pl/1.3/Fri May 20 14:01:30 2005// +# CVS Reference : /PIO_6057A.pl/1.2/Thu Feb 3 10:18:28 2005// +# CVS Reference : /RTTC_6081A.pl/1.2/Tue Nov 9 14:43:58 2004// +# CVS Reference : /PITC_6079A.pl/1.2/Tue Nov 9 14:43:56 2004// +# CVS Reference : /WDTC_6080A.pl/1.3/Tue Nov 9 14:44:00 2004// +# CVS Reference : /VREG_6085B.pl/1.1/Tue Feb 1 16:05:48 2005// +# CVS Reference : /PDC_6074C.pl/1.2/Thu Feb 3 08:48:54 2005// +# CVS Reference : /DBGU_6059D.pl/1.1/Mon Jan 31 13:15:32 2005// +# CVS Reference : /SPI_6088D.pl/1.3/Fri May 20 14:08:59 2005// +# CVS Reference : /US_6089C.pl/1.1/Mon Jul 12 18:23:26 2004// +# CVS Reference : /SSC_6078B.pl/1.1/Wed Jul 13 15:19:19 2005// +# CVS Reference : /TWI_6061A.pl/1.1/Tue Jul 13 07:38:06 2004// +# CVS Reference : /TC_6082A.pl/1.7/Fri Mar 11 12:52:17 2005// +# CVS Reference : /CAN_6019B.pl/1.1/Tue Mar 8 12:42:22 2005// +# CVS Reference : /EMACB_6119A.pl/1.6/Wed Jul 13 15:05:35 2005// +# CVS Reference : /ADC_6051C.pl/1.1/Fri Oct 17 09:12:38 2003// +# ---------------------------------------------------------------------------- + + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR System Peripherals +# ***************************************************************************** + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Advanced Interrupt Controller +# ***************************************************************************** +# -------- AIC_SMR : (AIC Offset: 0x0) Control Register -------- +set AT91C_AIC_PRIOR [expr 0x7 << 0 ] +set AT91C_AIC_PRIOR_LOWEST 0x0 +set AT91C_AIC_PRIOR_HIGHEST 0x7 +set AT91C_AIC_SRCTYPE [expr 0x3 << 5 ] +set AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL [expr 0x0 << 5 ] +set AT91C_AIC_SRCTYPE_EXT_LOW_LEVEL [expr 0x0 << 5 ] +set AT91C_AIC_SRCTYPE_INT_POSITIVE_EDGE [expr 0x1 << 5 ] +set AT91C_AIC_SRCTYPE_EXT_NEGATIVE_EDGE [expr 0x1 << 5 ] +set AT91C_AIC_SRCTYPE_HIGH_LEVEL [expr 0x2 << 5 ] +set AT91C_AIC_SRCTYPE_POSITIVE_EDGE [expr 0x3 << 5 ] +# -------- AIC_CISR : (AIC Offset: 0x114) AIC Core Interrupt Status Register -------- +set AT91C_AIC_NFIQ [expr 0x1 << 0 ] +set AT91C_AIC_NIRQ [expr 0x1 << 1 ] +# -------- AIC_DCR : (AIC Offset: 0x138) AIC Debug Control Register (Protect) -------- +set AT91C_AIC_DCR_PROT [expr 0x1 << 0 ] +set AT91C_AIC_DCR_GMSK [expr 0x1 << 1 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Peripheral DMA Controller +# ***************************************************************************** +# -------- PDC_PTCR : (PDC Offset: 0x20) PDC Transfer Control Register -------- +set AT91C_PDC_RXTEN [expr 0x1 << 0 ] +set AT91C_PDC_RXTDIS [expr 0x1 << 1 ] +set AT91C_PDC_TXTEN [expr 0x1 << 8 ] +set AT91C_PDC_TXTDIS [expr 0x1 << 9 ] +# -------- PDC_PTSR : (PDC Offset: 0x24) PDC Transfer Status Register -------- +set AT91C_PDC_RXTEN [expr 0x1 << 0 ] +set AT91C_PDC_TXTEN [expr 0x1 << 8 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Debug Unit +# ***************************************************************************** +# -------- DBGU_CR : (DBGU Offset: 0x0) Debug Unit Control Register -------- +set AT91C_US_RSTRX [expr 0x1 << 2 ] +set AT91C_US_RSTTX [expr 0x1 << 3 ] +set AT91C_US_RXEN [expr 0x1 << 4 ] +set AT91C_US_RXDIS [expr 0x1 << 5 ] +set AT91C_US_TXEN [expr 0x1 << 6 ] +set AT91C_US_TXDIS [expr 0x1 << 7 ] +set AT91C_US_RSTSTA [expr 0x1 << 8 ] +# -------- DBGU_MR : (DBGU Offset: 0x4) Debug Unit Mode Register -------- +set AT91C_US_PAR [expr 0x7 << 9 ] +set AT91C_US_PAR_EVEN [expr 0x0 << 9 ] +set AT91C_US_PAR_ODD [expr 0x1 << 9 ] +set AT91C_US_PAR_SPACE [expr 0x2 << 9 ] +set AT91C_US_PAR_MARK [expr 0x3 << 9 ] +set AT91C_US_PAR_NONE [expr 0x4 << 9 ] +set AT91C_US_PAR_MULTI_DROP [expr 0x6 << 9 ] +set AT91C_US_CHMODE [expr 0x3 << 14 ] +set AT91C_US_CHMODE_NORMAL [expr 0x0 << 14 ] +set AT91C_US_CHMODE_AUTO [expr 0x1 << 14 ] +set AT91C_US_CHMODE_LOCAL [expr 0x2 << 14 ] +set AT91C_US_CHMODE_REMOTE [expr 0x3 << 14 ] +# -------- DBGU_IER : (DBGU Offset: 0x8) Debug Unit Interrupt Enable Register -------- +set AT91C_US_RXRDY [expr 0x1 << 0 ] +set AT91C_US_TXRDY [expr 0x1 << 1 ] +set AT91C_US_ENDRX [expr 0x1 << 3 ] +set AT91C_US_ENDTX [expr 0x1 << 4 ] +set AT91C_US_OVRE [expr 0x1 << 5 ] +set AT91C_US_FRAME [expr 0x1 << 6 ] +set AT91C_US_PARE [expr 0x1 << 7 ] +set AT91C_US_TXEMPTY [expr 0x1 << 9 ] +set AT91C_US_TXBUFE [expr 0x1 << 11 ] +set AT91C_US_RXBUFF [expr 0x1 << 12 ] +set AT91C_US_COMM_TX [expr 0x1 << 30 ] +set AT91C_US_COMM_RX [expr 0x1 << 31 ] +# -------- DBGU_IDR : (DBGU Offset: 0xc) Debug Unit Interrupt Disable Register -------- +set AT91C_US_RXRDY [expr 0x1 << 0 ] +set AT91C_US_TXRDY [expr 0x1 << 1 ] +set AT91C_US_ENDRX [expr 0x1 << 3 ] +set AT91C_US_ENDTX [expr 0x1 << 4 ] +set AT91C_US_OVRE [expr 0x1 << 5 ] +set AT91C_US_FRAME [expr 0x1 << 6 ] +set AT91C_US_PARE [expr 0x1 << 7 ] +set AT91C_US_TXEMPTY [expr 0x1 << 9 ] +set AT91C_US_TXBUFE [expr 0x1 << 11 ] +set AT91C_US_RXBUFF [expr 0x1 << 12 ] +set AT91C_US_COMM_TX [expr 0x1 << 30 ] +set AT91C_US_COMM_RX [expr 0x1 << 31 ] +# -------- DBGU_IMR : (DBGU Offset: 0x10) Debug Unit Interrupt Mask Register -------- +set AT91C_US_RXRDY [expr 0x1 << 0 ] +set AT91C_US_TXRDY [expr 0x1 << 1 ] +set AT91C_US_ENDRX [expr 0x1 << 3 ] +set AT91C_US_ENDTX [expr 0x1 << 4 ] +set AT91C_US_OVRE [expr 0x1 << 5 ] +set AT91C_US_FRAME [expr 0x1 << 6 ] +set AT91C_US_PARE [expr 0x1 << 7 ] +set AT91C_US_TXEMPTY [expr 0x1 << 9 ] +set AT91C_US_TXBUFE [expr 0x1 << 11 ] +set AT91C_US_RXBUFF [expr 0x1 << 12 ] +set AT91C_US_COMM_TX [expr 0x1 << 30 ] +set AT91C_US_COMM_RX [expr 0x1 << 31 ] +# -------- DBGU_CSR : (DBGU Offset: 0x14) Debug Unit Channel Status Register -------- +set AT91C_US_RXRDY [expr 0x1 << 0 ] +set AT91C_US_TXRDY [expr 0x1 << 1 ] +set AT91C_US_ENDRX [expr 0x1 << 3 ] +set AT91C_US_ENDTX [expr 0x1 << 4 ] +set AT91C_US_OVRE [expr 0x1 << 5 ] +set AT91C_US_FRAME [expr 0x1 << 6 ] +set AT91C_US_PARE [expr 0x1 << 7 ] +set AT91C_US_TXEMPTY [expr 0x1 << 9 ] +set AT91C_US_TXBUFE [expr 0x1 << 11 ] +set AT91C_US_RXBUFF [expr 0x1 << 12 ] +set AT91C_US_COMM_TX [expr 0x1 << 30 ] +set AT91C_US_COMM_RX [expr 0x1 << 31 ] +# -------- DBGU_FNTR : (DBGU Offset: 0x48) Debug Unit FORCE_NTRST Register -------- +set AT91C_US_FORCE_NTRST [expr 0x1 << 0 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Parallel Input Output Controler +# ***************************************************************************** + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Clock Generator Controler +# ***************************************************************************** +# -------- CKGR_MOR : (CKGR Offset: 0x0) Main Oscillator Register -------- +set AT91C_CKGR_MOSCEN [expr 0x1 << 0 ] +set AT91C_CKGR_OSCBYPASS [expr 0x1 << 1 ] +set AT91C_CKGR_OSCOUNT [expr 0xFF << 8 ] +# -------- CKGR_MCFR : (CKGR Offset: 0x4) Main Clock Frequency Register -------- +set AT91C_CKGR_MAINF [expr 0xFFFF << 0 ] +set AT91C_CKGR_MAINRDY [expr 0x1 << 16 ] +# -------- CKGR_PLLR : (CKGR Offset: 0xc) PLL B Register -------- +set AT91C_CKGR_DIV [expr 0xFF << 0 ] +set AT91C_CKGR_DIV_0 0x0 +set AT91C_CKGR_DIV_BYPASS 0x1 +set AT91C_CKGR_PLLCOUNT [expr 0x3F << 8 ] +set AT91C_CKGR_OUT [expr 0x3 << 14 ] +set AT91C_CKGR_OUT_0 [expr 0x0 << 14 ] +set AT91C_CKGR_OUT_1 [expr 0x1 << 14 ] +set AT91C_CKGR_OUT_2 [expr 0x2 << 14 ] +set AT91C_CKGR_OUT_3 [expr 0x3 << 14 ] +set AT91C_CKGR_MUL [expr 0x7FF << 16 ] +set AT91C_CKGR_USBDIV [expr 0x3 << 28 ] +set AT91C_CKGR_USBDIV_0 [expr 0x0 << 28 ] +set AT91C_CKGR_USBDIV_1 [expr 0x1 << 28 ] +set AT91C_CKGR_USBDIV_2 [expr 0x2 << 28 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Power Management Controler +# ***************************************************************************** +# -------- PMC_SCER : (PMC Offset: 0x0) System Clock Enable Register -------- +set AT91C_PMC_PCK [expr 0x1 << 0 ] +set AT91C_PMC_UDP [expr 0x1 << 7 ] +set AT91C_PMC_PCK0 [expr 0x1 << 8 ] +set AT91C_PMC_PCK1 [expr 0x1 << 9 ] +set AT91C_PMC_PCK2 [expr 0x1 << 10 ] +set AT91C_PMC_PCK3 [expr 0x1 << 11 ] +# -------- PMC_SCDR : (PMC Offset: 0x4) System Clock Disable Register -------- +set AT91C_PMC_PCK [expr 0x1 << 0 ] +set AT91C_PMC_UDP [expr 0x1 << 7 ] +set AT91C_PMC_PCK0 [expr 0x1 << 8 ] +set AT91C_PMC_PCK1 [expr 0x1 << 9 ] +set AT91C_PMC_PCK2 [expr 0x1 << 10 ] +set AT91C_PMC_PCK3 [expr 0x1 << 11 ] +# -------- PMC_SCSR : (PMC Offset: 0x8) System Clock Status Register -------- +set AT91C_PMC_PCK [expr 0x1 << 0 ] +set AT91C_PMC_UDP [expr 0x1 << 7 ] +set AT91C_PMC_PCK0 [expr 0x1 << 8 ] +set AT91C_PMC_PCK1 [expr 0x1 << 9 ] +set AT91C_PMC_PCK2 [expr 0x1 << 10 ] +set AT91C_PMC_PCK3 [expr 0x1 << 11 ] +# -------- CKGR_MOR : (PMC Offset: 0x20) Main Oscillator Register -------- +set AT91C_CKGR_MOSCEN [expr 0x1 << 0 ] +set AT91C_CKGR_OSCBYPASS [expr 0x1 << 1 ] +set AT91C_CKGR_OSCOUNT [expr 0xFF << 8 ] +# -------- CKGR_MCFR : (PMC Offset: 0x24) Main Clock Frequency Register -------- +set AT91C_CKGR_MAINF [expr 0xFFFF << 0 ] +set AT91C_CKGR_MAINRDY [expr 0x1 << 16 ] +# -------- CKGR_PLLR : (PMC Offset: 0x2c) PLL B Register -------- +set AT91C_CKGR_DIV [expr 0xFF << 0 ] +set AT91C_CKGR_DIV_0 0x0 +set AT91C_CKGR_DIV_BYPASS 0x1 +set AT91C_CKGR_PLLCOUNT [expr 0x3F << 8 ] +set AT91C_CKGR_OUT [expr 0x3 << 14 ] +set AT91C_CKGR_OUT_0 [expr 0x0 << 14 ] +set AT91C_CKGR_OUT_1 [expr 0x1 << 14 ] +set AT91C_CKGR_OUT_2 [expr 0x2 << 14 ] +set AT91C_CKGR_OUT_3 [expr 0x3 << 14 ] +set AT91C_CKGR_MUL [expr 0x7FF << 16 ] +set AT91C_CKGR_USBDIV [expr 0x3 << 28 ] +set AT91C_CKGR_USBDIV_0 [expr 0x0 << 28 ] +set AT91C_CKGR_USBDIV_1 [expr 0x1 << 28 ] +set AT91C_CKGR_USBDIV_2 [expr 0x2 << 28 ] +# -------- PMC_MCKR : (PMC Offset: 0x30) Master Clock Register -------- +set AT91C_PMC_CSS [expr 0x3 << 0 ] +set AT91C_PMC_CSS_SLOW_CLK 0x0 +set AT91C_PMC_CSS_MAIN_CLK 0x1 +set AT91C_PMC_CSS_PLL_CLK 0x3 +set AT91C_PMC_PRES [expr 0x7 << 2 ] +set AT91C_PMC_PRES_CLK [expr 0x0 << 2 ] +set AT91C_PMC_PRES_CLK_2 [expr 0x1 << 2 ] +set AT91C_PMC_PRES_CLK_4 [expr 0x2 << 2 ] +set AT91C_PMC_PRES_CLK_8 [expr 0x3 << 2 ] +set AT91C_PMC_PRES_CLK_16 [expr 0x4 << 2 ] +set AT91C_PMC_PRES_CLK_32 [expr 0x5 << 2 ] +set AT91C_PMC_PRES_CLK_64 [expr 0x6 << 2 ] +# -------- PMC_PCKR : (PMC Offset: 0x40) Programmable Clock Register -------- +set AT91C_PMC_CSS [expr 0x3 << 0 ] +set AT91C_PMC_CSS_SLOW_CLK 0x0 +set AT91C_PMC_CSS_MAIN_CLK 0x1 +set AT91C_PMC_CSS_PLL_CLK 0x3 +set AT91C_PMC_PRES [expr 0x7 << 2 ] +set AT91C_PMC_PRES_CLK [expr 0x0 << 2 ] +set AT91C_PMC_PRES_CLK_2 [expr 0x1 << 2 ] +set AT91C_PMC_PRES_CLK_4 [expr 0x2 << 2 ] +set AT91C_PMC_PRES_CLK_8 [expr 0x3 << 2 ] +set AT91C_PMC_PRES_CLK_16 [expr 0x4 << 2 ] +set AT91C_PMC_PRES_CLK_32 [expr 0x5 << 2 ] +set AT91C_PMC_PRES_CLK_64 [expr 0x6 << 2 ] +# -------- PMC_IER : (PMC Offset: 0x60) PMC Interrupt Enable Register -------- +set AT91C_PMC_MOSCS [expr 0x1 << 0 ] +set AT91C_PMC_LOCK [expr 0x1 << 2 ] +set AT91C_PMC_MCKRDY [expr 0x1 << 3 ] +set AT91C_PMC_PCK0RDY [expr 0x1 << 8 ] +set AT91C_PMC_PCK1RDY [expr 0x1 << 9 ] +set AT91C_PMC_PCK2RDY [expr 0x1 << 10 ] +set AT91C_PMC_PCK3RDY [expr 0x1 << 11 ] +# -------- PMC_IDR : (PMC Offset: 0x64) PMC Interrupt Disable Register -------- +set AT91C_PMC_MOSCS [expr 0x1 << 0 ] +set AT91C_PMC_LOCK [expr 0x1 << 2 ] +set AT91C_PMC_MCKRDY [expr 0x1 << 3 ] +set AT91C_PMC_PCK0RDY [expr 0x1 << 8 ] +set AT91C_PMC_PCK1RDY [expr 0x1 << 9 ] +set AT91C_PMC_PCK2RDY [expr 0x1 << 10 ] +set AT91C_PMC_PCK3RDY [expr 0x1 << 11 ] +# -------- PMC_SR : (PMC Offset: 0x68) PMC Status Register -------- +set AT91C_PMC_MOSCS [expr 0x1 << 0 ] +set AT91C_PMC_LOCK [expr 0x1 << 2 ] +set AT91C_PMC_MCKRDY [expr 0x1 << 3 ] +set AT91C_PMC_PCK0RDY [expr 0x1 << 8 ] +set AT91C_PMC_PCK1RDY [expr 0x1 << 9 ] +set AT91C_PMC_PCK2RDY [expr 0x1 << 10 ] +set AT91C_PMC_PCK3RDY [expr 0x1 << 11 ] +# -------- PMC_IMR : (PMC Offset: 0x6c) PMC Interrupt Mask Register -------- +set AT91C_PMC_MOSCS [expr 0x1 << 0 ] +set AT91C_PMC_LOCK [expr 0x1 << 2 ] +set AT91C_PMC_MCKRDY [expr 0x1 << 3 ] +set AT91C_PMC_PCK0RDY [expr 0x1 << 8 ] +set AT91C_PMC_PCK1RDY [expr 0x1 << 9 ] +set AT91C_PMC_PCK2RDY [expr 0x1 << 10 ] +set AT91C_PMC_PCK3RDY [expr 0x1 << 11 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Reset Controller Interface +# ***************************************************************************** +# -------- RSTC_RCR : (RSTC Offset: 0x0) Reset Control Register -------- +set AT91C_RSTC_PROCRST [expr 0x1 << 0 ] +set AT91C_RSTC_PERRST [expr 0x1 << 2 ] +set AT91C_RSTC_EXTRST [expr 0x1 << 3 ] +set AT91C_RSTC_KEY [expr 0xFF << 24 ] +# -------- RSTC_RSR : (RSTC Offset: 0x4) Reset Status Register -------- +set AT91C_RSTC_URSTS [expr 0x1 << 0 ] +set AT91C_RSTC_BODSTS [expr 0x1 << 1 ] +set AT91C_RSTC_RSTTYP [expr 0x7 << 8 ] +set AT91C_RSTC_RSTTYP_POWERUP [expr 0x0 << 8 ] +set AT91C_RSTC_RSTTYP_WAKEUP [expr 0x1 << 8 ] +set AT91C_RSTC_RSTTYP_WATCHDOG [expr 0x2 << 8 ] +set AT91C_RSTC_RSTTYP_SOFTWARE [expr 0x3 << 8 ] +set AT91C_RSTC_RSTTYP_USER [expr 0x4 << 8 ] +set AT91C_RSTC_RSTTYP_BROWNOUT [expr 0x5 << 8 ] +set AT91C_RSTC_NRSTL [expr 0x1 << 16 ] +set AT91C_RSTC_SRCMP [expr 0x1 << 17 ] +# -------- RSTC_RMR : (RSTC Offset: 0x8) Reset Mode Register -------- +set AT91C_RSTC_URSTEN [expr 0x1 << 0 ] +set AT91C_RSTC_URSTIEN [expr 0x1 << 4 ] +set AT91C_RSTC_ERSTL [expr 0xF << 8 ] +set AT91C_RSTC_BODIEN [expr 0x1 << 16 ] +set AT91C_RSTC_KEY [expr 0xFF << 24 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Real Time Timer Controller Interface +# ***************************************************************************** +# -------- RTTC_RTMR : (RTTC Offset: 0x0) Real-time Mode Register -------- +set AT91C_RTTC_RTPRES [expr 0xFFFF << 0 ] +set AT91C_RTTC_ALMIEN [expr 0x1 << 16 ] +set AT91C_RTTC_RTTINCIEN [expr 0x1 << 17 ] +set AT91C_RTTC_RTTRST [expr 0x1 << 18 ] +# -------- RTTC_RTAR : (RTTC Offset: 0x4) Real-time Alarm Register -------- +set AT91C_RTTC_ALMV [expr 0x0 << 0 ] +# -------- RTTC_RTVR : (RTTC Offset: 0x8) Current Real-time Value Register -------- +set AT91C_RTTC_CRTV [expr 0x0 << 0 ] +# -------- RTTC_RTSR : (RTTC Offset: 0xc) Real-time Status Register -------- +set AT91C_RTTC_ALMS [expr 0x1 << 0 ] +set AT91C_RTTC_RTTINC [expr 0x1 << 1 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Periodic Interval Timer Controller Interface +# ***************************************************************************** +# -------- PITC_PIMR : (PITC Offset: 0x0) Periodic Interval Mode Register -------- +set AT91C_PITC_PIV [expr 0xFFFFF << 0 ] +set AT91C_PITC_PITEN [expr 0x1 << 24 ] +set AT91C_PITC_PITIEN [expr 0x1 << 25 ] +# -------- PITC_PISR : (PITC Offset: 0x4) Periodic Interval Status Register -------- +set AT91C_PITC_PITS [expr 0x1 << 0 ] +# -------- PITC_PIVR : (PITC Offset: 0x8) Periodic Interval Value Register -------- +set AT91C_PITC_CPIV [expr 0xFFFFF << 0 ] +set AT91C_PITC_PICNT [expr 0xFFF << 20 ] +# -------- PITC_PIIR : (PITC Offset: 0xc) Periodic Interval Image Register -------- +set AT91C_PITC_CPIV [expr 0xFFFFF << 0 ] +set AT91C_PITC_PICNT [expr 0xFFF << 20 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Watchdog Timer Controller Interface +# ***************************************************************************** +# -------- WDTC_WDCR : (WDTC Offset: 0x0) Periodic Interval Image Register -------- +set AT91C_WDTC_WDRSTT [expr 0x1 << 0 ] +set AT91C_WDTC_KEY [expr 0xFF << 24 ] +# -------- WDTC_WDMR : (WDTC Offset: 0x4) Watchdog Mode Register -------- +set AT91C_WDTC_WDV [expr 0xFFF << 0 ] +set AT91C_WDTC_WDFIEN [expr 0x1 << 12 ] +set AT91C_WDTC_WDRSTEN [expr 0x1 << 13 ] +set AT91C_WDTC_WDRPROC [expr 0x1 << 14 ] +set AT91C_WDTC_WDDIS [expr 0x1 << 15 ] +set AT91C_WDTC_WDD [expr 0xFFF << 16 ] +set AT91C_WDTC_WDDBGHLT [expr 0x1 << 28 ] +set AT91C_WDTC_WDIDLEHLT [expr 0x1 << 29 ] +# -------- WDTC_WDSR : (WDTC Offset: 0x8) Watchdog Status Register -------- +set AT91C_WDTC_WDUNF [expr 0x1 << 0 ] +set AT91C_WDTC_WDERR [expr 0x1 << 1 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Voltage Regulator Mode Controller Interface +# ***************************************************************************** +# -------- VREG_MR : (VREG Offset: 0x0) Voltage Regulator Mode Register -------- +set AT91C_VREG_PSTDBY [expr 0x1 << 0 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Memory Controller Interface +# ***************************************************************************** +# -------- MC_RCR : (MC Offset: 0x0) MC Remap Control Register -------- +set AT91C_MC_RCB [expr 0x1 << 0 ] +# -------- MC_ASR : (MC Offset: 0x4) MC Abort Status Register -------- +set AT91C_MC_UNDADD [expr 0x1 << 0 ] +set AT91C_MC_MISADD [expr 0x1 << 1 ] +set AT91C_MC_ABTSZ [expr 0x3 << 8 ] +set AT91C_MC_ABTSZ_BYTE [expr 0x0 << 8 ] +set AT91C_MC_ABTSZ_HWORD [expr 0x1 << 8 ] +set AT91C_MC_ABTSZ_WORD [expr 0x2 << 8 ] +set AT91C_MC_ABTTYP [expr 0x3 << 10 ] +set AT91C_MC_ABTTYP_DATAR [expr 0x0 << 10 ] +set AT91C_MC_ABTTYP_DATAW [expr 0x1 << 10 ] +set AT91C_MC_ABTTYP_FETCH [expr 0x2 << 10 ] +set AT91C_MC_MST0 [expr 0x1 << 16 ] +set AT91C_MC_MST1 [expr 0x1 << 17 ] +set AT91C_MC_SVMST0 [expr 0x1 << 24 ] +set AT91C_MC_SVMST1 [expr 0x1 << 25 ] +# -------- MC_FMR : (MC Offset: 0x60) MC Flash Mode Register -------- +set AT91C_MC_FRDY [expr 0x1 << 0 ] +set AT91C_MC_LOCKE [expr 0x1 << 2 ] +set AT91C_MC_PROGE [expr 0x1 << 3 ] +set AT91C_MC_NEBP [expr 0x1 << 7 ] +set AT91C_MC_FWS [expr 0x3 << 8 ] +set AT91C_MC_FWS_0FWS [expr 0x0 << 8 ] +set AT91C_MC_FWS_1FWS [expr 0x1 << 8 ] +set AT91C_MC_FWS_2FWS [expr 0x2 << 8 ] +set AT91C_MC_FWS_3FWS [expr 0x3 << 8 ] +set AT91C_MC_FMCN [expr 0xFF << 16 ] +# -------- MC_FCR : (MC Offset: 0x64) MC Flash Command Register -------- +set AT91C_MC_FCMD [expr 0xF << 0 ] +set AT91C_MC_FCMD_START_PROG 0x1 +set AT91C_MC_FCMD_LOCK 0x2 +set AT91C_MC_FCMD_PROG_AND_LOCK 0x3 +set AT91C_MC_FCMD_UNLOCK 0x4 +set AT91C_MC_FCMD_ERASE_ALL 0x8 +set AT91C_MC_FCMD_SET_GP_NVM 0xB +set AT91C_MC_FCMD_CLR_GP_NVM 0xD +set AT91C_MC_FCMD_SET_SECURITY 0xF +set AT91C_MC_PAGEN [expr 0x3FF << 8 ] +set AT91C_MC_KEY [expr 0xFF << 24 ] +# -------- MC_FSR : (MC Offset: 0x68) MC Flash Command Register -------- +set AT91C_MC_FRDY [expr 0x1 << 0 ] +set AT91C_MC_LOCKE [expr 0x1 << 2 ] +set AT91C_MC_PROGE [expr 0x1 << 3 ] +set AT91C_MC_SECURITY [expr 0x1 << 4 ] +set AT91C_MC_GPNVM0 [expr 0x1 << 8 ] +set AT91C_MC_GPNVM1 [expr 0x1 << 9 ] +set AT91C_MC_GPNVM2 [expr 0x1 << 10 ] +set AT91C_MC_GPNVM3 [expr 0x1 << 11 ] +set AT91C_MC_GPNVM4 [expr 0x1 << 12 ] +set AT91C_MC_GPNVM5 [expr 0x1 << 13 ] +set AT91C_MC_GPNVM6 [expr 0x1 << 14 ] +set AT91C_MC_GPNVM7 [expr 0x1 << 15 ] +set AT91C_MC_LOCKS0 [expr 0x1 << 16 ] +set AT91C_MC_LOCKS1 [expr 0x1 << 17 ] +set AT91C_MC_LOCKS2 [expr 0x1 << 18 ] +set AT91C_MC_LOCKS3 [expr 0x1 << 19 ] +set AT91C_MC_LOCKS4 [expr 0x1 << 20 ] +set AT91C_MC_LOCKS5 [expr 0x1 << 21 ] +set AT91C_MC_LOCKS6 [expr 0x1 << 22 ] +set AT91C_MC_LOCKS7 [expr 0x1 << 23 ] +set AT91C_MC_LOCKS8 [expr 0x1 << 24 ] +set AT91C_MC_LOCKS9 [expr 0x1 << 25 ] +set AT91C_MC_LOCKS10 [expr 0x1 << 26 ] +set AT91C_MC_LOCKS11 [expr 0x1 << 27 ] +set AT91C_MC_LOCKS12 [expr 0x1 << 28 ] +set AT91C_MC_LOCKS13 [expr 0x1 << 29 ] +set AT91C_MC_LOCKS14 [expr 0x1 << 30 ] +set AT91C_MC_LOCKS15 [expr 0x1 << 31 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Serial Parallel Interface +# ***************************************************************************** +# -------- SPI_CR : (SPI Offset: 0x0) SPI Control Register -------- +set AT91C_SPI_SPIEN [expr 0x1 << 0 ] +set AT91C_SPI_SPIDIS [expr 0x1 << 1 ] +set AT91C_SPI_SWRST [expr 0x1 << 7 ] +set AT91C_SPI_LASTXFER [expr 0x1 << 24 ] +# -------- SPI_MR : (SPI Offset: 0x4) SPI Mode Register -------- +set AT91C_SPI_MSTR [expr 0x1 << 0 ] +set AT91C_SPI_PS [expr 0x1 << 1 ] +set AT91C_SPI_PS_FIXED [expr 0x0 << 1 ] +set AT91C_SPI_PS_VARIABLE [expr 0x1 << 1 ] +set AT91C_SPI_PCSDEC [expr 0x1 << 2 ] +set AT91C_SPI_FDIV [expr 0x1 << 3 ] +set AT91C_SPI_MODFDIS [expr 0x1 << 4 ] +set AT91C_SPI_LLB [expr 0x1 << 7 ] +set AT91C_SPI_PCS [expr 0xF << 16 ] +set AT91C_SPI_DLYBCS [expr 0xFF << 24 ] +# -------- SPI_RDR : (SPI Offset: 0x8) Receive Data Register -------- +set AT91C_SPI_RD [expr 0xFFFF << 0 ] +set AT91C_SPI_RPCS [expr 0xF << 16 ] +# -------- SPI_TDR : (SPI Offset: 0xc) Transmit Data Register -------- +set AT91C_SPI_TD [expr 0xFFFF << 0 ] +set AT91C_SPI_TPCS [expr 0xF << 16 ] +set AT91C_SPI_LASTXFER [expr 0x1 << 24 ] +# -------- SPI_SR : (SPI Offset: 0x10) Status Register -------- +set AT91C_SPI_RDRF [expr 0x1 << 0 ] +set AT91C_SPI_TDRE [expr 0x1 << 1 ] +set AT91C_SPI_MODF [expr 0x1 << 2 ] +set AT91C_SPI_OVRES [expr 0x1 << 3 ] +set AT91C_SPI_ENDRX [expr 0x1 << 4 ] +set AT91C_SPI_ENDTX [expr 0x1 << 5 ] +set AT91C_SPI_RXBUFF [expr 0x1 << 6 ] +set AT91C_SPI_TXBUFE [expr 0x1 << 7 ] +set AT91C_SPI_NSSR [expr 0x1 << 8 ] +set AT91C_SPI_TXEMPTY [expr 0x1 << 9 ] +set AT91C_SPI_SPIENS [expr 0x1 << 16 ] +# -------- SPI_IER : (SPI Offset: 0x14) Interrupt Enable Register -------- +set AT91C_SPI_RDRF [expr 0x1 << 0 ] +set AT91C_SPI_TDRE [expr 0x1 << 1 ] +set AT91C_SPI_MODF [expr 0x1 << 2 ] +set AT91C_SPI_OVRES [expr 0x1 << 3 ] +set AT91C_SPI_ENDRX [expr 0x1 << 4 ] +set AT91C_SPI_ENDTX [expr 0x1 << 5 ] +set AT91C_SPI_RXBUFF [expr 0x1 << 6 ] +set AT91C_SPI_TXBUFE [expr 0x1 << 7 ] +set AT91C_SPI_NSSR [expr 0x1 << 8 ] +set AT91C_SPI_TXEMPTY [expr 0x1 << 9 ] +# -------- SPI_IDR : (SPI Offset: 0x18) Interrupt Disable Register -------- +set AT91C_SPI_RDRF [expr 0x1 << 0 ] +set AT91C_SPI_TDRE [expr 0x1 << 1 ] +set AT91C_SPI_MODF [expr 0x1 << 2 ] +set AT91C_SPI_OVRES [expr 0x1 << 3 ] +set AT91C_SPI_ENDRX [expr 0x1 << 4 ] +set AT91C_SPI_ENDTX [expr 0x1 << 5 ] +set AT91C_SPI_RXBUFF [expr 0x1 << 6 ] +set AT91C_SPI_TXBUFE [expr 0x1 << 7 ] +set AT91C_SPI_NSSR [expr 0x1 << 8 ] +set AT91C_SPI_TXEMPTY [expr 0x1 << 9 ] +# -------- SPI_IMR : (SPI Offset: 0x1c) Interrupt Mask Register -------- +set AT91C_SPI_RDRF [expr 0x1 << 0 ] +set AT91C_SPI_TDRE [expr 0x1 << 1 ] +set AT91C_SPI_MODF [expr 0x1 << 2 ] +set AT91C_SPI_OVRES [expr 0x1 << 3 ] +set AT91C_SPI_ENDRX [expr 0x1 << 4 ] +set AT91C_SPI_ENDTX [expr 0x1 << 5 ] +set AT91C_SPI_RXBUFF [expr 0x1 << 6 ] +set AT91C_SPI_TXBUFE [expr 0x1 << 7 ] +set AT91C_SPI_NSSR [expr 0x1 << 8 ] +set AT91C_SPI_TXEMPTY [expr 0x1 << 9 ] +# -------- SPI_CSR : (SPI Offset: 0x30) Chip Select Register -------- +set AT91C_SPI_CPOL [expr 0x1 << 0 ] +set AT91C_SPI_NCPHA [expr 0x1 << 1 ] +set AT91C_SPI_CSAAT [expr 0x1 << 3 ] +set AT91C_SPI_BITS [expr 0xF << 4 ] +set AT91C_SPI_BITS_8 [expr 0x0 << 4 ] +set AT91C_SPI_BITS_9 [expr 0x1 << 4 ] +set AT91C_SPI_BITS_10 [expr 0x2 << 4 ] +set AT91C_SPI_BITS_11 [expr 0x3 << 4 ] +set AT91C_SPI_BITS_12 [expr 0x4 << 4 ] +set AT91C_SPI_BITS_13 [expr 0x5 << 4 ] +set AT91C_SPI_BITS_14 [expr 0x6 << 4 ] +set AT91C_SPI_BITS_15 [expr 0x7 << 4 ] +set AT91C_SPI_BITS_16 [expr 0x8 << 4 ] +set AT91C_SPI_SCBR [expr 0xFF << 8 ] +set AT91C_SPI_DLYBS [expr 0xFF << 16 ] +set AT91C_SPI_DLYBCT [expr 0xFF << 24 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Usart +# ***************************************************************************** +# -------- US_CR : (USART Offset: 0x0) Debug Unit Control Register -------- +set AT91C_US_RSTRX [expr 0x1 << 2 ] +set AT91C_US_RSTTX [expr 0x1 << 3 ] +set AT91C_US_RXEN [expr 0x1 << 4 ] +set AT91C_US_RXDIS [expr 0x1 << 5 ] +set AT91C_US_TXEN [expr 0x1 << 6 ] +set AT91C_US_TXDIS [expr 0x1 << 7 ] +set AT91C_US_RSTSTA [expr 0x1 << 8 ] +set AT91C_US_STTBRK [expr 0x1 << 9 ] +set AT91C_US_STPBRK [expr 0x1 << 10 ] +set AT91C_US_STTTO [expr 0x1 << 11 ] +set AT91C_US_SENDA [expr 0x1 << 12 ] +set AT91C_US_RSTIT [expr 0x1 << 13 ] +set AT91C_US_RSTNACK [expr 0x1 << 14 ] +set AT91C_US_RETTO [expr 0x1 << 15 ] +set AT91C_US_DTREN [expr 0x1 << 16 ] +set AT91C_US_DTRDIS [expr 0x1 << 17 ] +set AT91C_US_RTSEN [expr 0x1 << 18 ] +set AT91C_US_RTSDIS [expr 0x1 << 19 ] +# -------- US_MR : (USART Offset: 0x4) Debug Unit Mode Register -------- +set AT91C_US_USMODE [expr 0xF << 0 ] +set AT91C_US_USMODE_NORMAL 0x0 +set AT91C_US_USMODE_RS485 0x1 +set AT91C_US_USMODE_HWHSH 0x2 +set AT91C_US_USMODE_MODEM 0x3 +set AT91C_US_USMODE_ISO7816_0 0x4 +set AT91C_US_USMODE_ISO7816_1 0x6 +set AT91C_US_USMODE_IRDA 0x8 +set AT91C_US_USMODE_SWHSH 0xC +set AT91C_US_CLKS [expr 0x3 << 4 ] +set AT91C_US_CLKS_CLOCK [expr 0x0 << 4 ] +set AT91C_US_CLKS_FDIV1 [expr 0x1 << 4 ] +set AT91C_US_CLKS_SLOW [expr 0x2 << 4 ] +set AT91C_US_CLKS_EXT [expr 0x3 << 4 ] +set AT91C_US_CHRL [expr 0x3 << 6 ] +set AT91C_US_CHRL_5_BITS [expr 0x0 << 6 ] +set AT91C_US_CHRL_6_BITS [expr 0x1 << 6 ] +set AT91C_US_CHRL_7_BITS [expr 0x2 << 6 ] +set AT91C_US_CHRL_8_BITS [expr 0x3 << 6 ] +set AT91C_US_SYNC [expr 0x1 << 8 ] +set AT91C_US_PAR [expr 0x7 << 9 ] +set AT91C_US_PAR_EVEN [expr 0x0 << 9 ] +set AT91C_US_PAR_ODD [expr 0x1 << 9 ] +set AT91C_US_PAR_SPACE [expr 0x2 << 9 ] +set AT91C_US_PAR_MARK [expr 0x3 << 9 ] +set AT91C_US_PAR_NONE [expr 0x4 << 9 ] +set AT91C_US_PAR_MULTI_DROP [expr 0x6 << 9 ] +set AT91C_US_NBSTOP [expr 0x3 << 12 ] +set AT91C_US_NBSTOP_1_BIT [expr 0x0 << 12 ] +set AT91C_US_NBSTOP_15_BIT [expr 0x1 << 12 ] +set AT91C_US_NBSTOP_2_BIT [expr 0x2 << 12 ] +set AT91C_US_CHMODE [expr 0x3 << 14 ] +set AT91C_US_CHMODE_NORMAL [expr 0x0 << 14 ] +set AT91C_US_CHMODE_AUTO [expr 0x1 << 14 ] +set AT91C_US_CHMODE_LOCAL [expr 0x2 << 14 ] +set AT91C_US_CHMODE_REMOTE [expr 0x3 << 14 ] +set AT91C_US_MSBF [expr 0x1 << 16 ] +set AT91C_US_MODE9 [expr 0x1 << 17 ] +set AT91C_US_CKLO [expr 0x1 << 18 ] +set AT91C_US_OVER [expr 0x1 << 19 ] +set AT91C_US_INACK [expr 0x1 << 20 ] +set AT91C_US_DSNACK [expr 0x1 << 21 ] +set AT91C_US_MAX_ITER [expr 0x1 << 24 ] +set AT91C_US_FILTER [expr 0x1 << 28 ] +# -------- US_IER : (USART Offset: 0x8) Debug Unit Interrupt Enable Register -------- +set AT91C_US_RXRDY [expr 0x1 << 0 ] +set AT91C_US_TXRDY [expr 0x1 << 1 ] +set AT91C_US_RXBRK [expr 0x1 << 2 ] +set AT91C_US_ENDRX [expr 0x1 << 3 ] +set AT91C_US_ENDTX [expr 0x1 << 4 ] +set AT91C_US_OVRE [expr 0x1 << 5 ] +set AT91C_US_FRAME [expr 0x1 << 6 ] +set AT91C_US_PARE [expr 0x1 << 7 ] +set AT91C_US_TIMEOUT [expr 0x1 << 8 ] +set AT91C_US_TXEMPTY [expr 0x1 << 9 ] +set AT91C_US_ITERATION [expr 0x1 << 10 ] +set AT91C_US_TXBUFE [expr 0x1 << 11 ] +set AT91C_US_RXBUFF [expr 0x1 << 12 ] +set AT91C_US_NACK [expr 0x1 << 13 ] +set AT91C_US_RIIC [expr 0x1 << 16 ] +set AT91C_US_DSRIC [expr 0x1 << 17 ] +set AT91C_US_DCDIC [expr 0x1 << 18 ] +set AT91C_US_CTSIC [expr 0x1 << 19 ] +# -------- US_IDR : (USART Offset: 0xc) Debug Unit Interrupt Disable Register -------- +set AT91C_US_RXRDY [expr 0x1 << 0 ] +set AT91C_US_TXRDY [expr 0x1 << 1 ] +set AT91C_US_RXBRK [expr 0x1 << 2 ] +set AT91C_US_ENDRX [expr 0x1 << 3 ] +set AT91C_US_ENDTX [expr 0x1 << 4 ] +set AT91C_US_OVRE [expr 0x1 << 5 ] +set AT91C_US_FRAME [expr 0x1 << 6 ] +set AT91C_US_PARE [expr 0x1 << 7 ] +set AT91C_US_TIMEOUT [expr 0x1 << 8 ] +set AT91C_US_TXEMPTY [expr 0x1 << 9 ] +set AT91C_US_ITERATION [expr 0x1 << 10 ] +set AT91C_US_TXBUFE [expr 0x1 << 11 ] +set AT91C_US_RXBUFF [expr 0x1 << 12 ] +set AT91C_US_NACK [expr 0x1 << 13 ] +set AT91C_US_RIIC [expr 0x1 << 16 ] +set AT91C_US_DSRIC [expr 0x1 << 17 ] +set AT91C_US_DCDIC [expr 0x1 << 18 ] +set AT91C_US_CTSIC [expr 0x1 << 19 ] +# -------- US_IMR : (USART Offset: 0x10) Debug Unit Interrupt Mask Register -------- +set AT91C_US_RXRDY [expr 0x1 << 0 ] +set AT91C_US_TXRDY [expr 0x1 << 1 ] +set AT91C_US_RXBRK [expr 0x1 << 2 ] +set AT91C_US_ENDRX [expr 0x1 << 3 ] +set AT91C_US_ENDTX [expr 0x1 << 4 ] +set AT91C_US_OVRE [expr 0x1 << 5 ] +set AT91C_US_FRAME [expr 0x1 << 6 ] +set AT91C_US_PARE [expr 0x1 << 7 ] +set AT91C_US_TIMEOUT [expr 0x1 << 8 ] +set AT91C_US_TXEMPTY [expr 0x1 << 9 ] +set AT91C_US_ITERATION [expr 0x1 << 10 ] +set AT91C_US_TXBUFE [expr 0x1 << 11 ] +set AT91C_US_RXBUFF [expr 0x1 << 12 ] +set AT91C_US_NACK [expr 0x1 << 13 ] +set AT91C_US_RIIC [expr 0x1 << 16 ] +set AT91C_US_DSRIC [expr 0x1 << 17 ] +set AT91C_US_DCDIC [expr 0x1 << 18 ] +set AT91C_US_CTSIC [expr 0x1 << 19 ] +# -------- US_CSR : (USART Offset: 0x14) Debug Unit Channel Status Register -------- +set AT91C_US_RXRDY [expr 0x1 << 0 ] +set AT91C_US_TXRDY [expr 0x1 << 1 ] +set AT91C_US_RXBRK [expr 0x1 << 2 ] +set AT91C_US_ENDRX [expr 0x1 << 3 ] +set AT91C_US_ENDTX [expr 0x1 << 4 ] +set AT91C_US_OVRE [expr 0x1 << 5 ] +set AT91C_US_FRAME [expr 0x1 << 6 ] +set AT91C_US_PARE [expr 0x1 << 7 ] +set AT91C_US_TIMEOUT [expr 0x1 << 8 ] +set AT91C_US_TXEMPTY [expr 0x1 << 9 ] +set AT91C_US_ITERATION [expr 0x1 << 10 ] +set AT91C_US_TXBUFE [expr 0x1 << 11 ] +set AT91C_US_RXBUFF [expr 0x1 << 12 ] +set AT91C_US_NACK [expr 0x1 << 13 ] +set AT91C_US_RIIC [expr 0x1 << 16 ] +set AT91C_US_DSRIC [expr 0x1 << 17 ] +set AT91C_US_DCDIC [expr 0x1 << 18 ] +set AT91C_US_CTSIC [expr 0x1 << 19 ] +set AT91C_US_RI [expr 0x1 << 20 ] +set AT91C_US_DSR [expr 0x1 << 21 ] +set AT91C_US_DCD [expr 0x1 << 22 ] +set AT91C_US_CTS [expr 0x1 << 23 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Synchronous Serial Controller Interface +# ***************************************************************************** +# -------- SSC_CR : (SSC Offset: 0x0) SSC Control Register -------- +set AT91C_SSC_RXEN [expr 0x1 << 0 ] +set AT91C_SSC_RXDIS [expr 0x1 << 1 ] +set AT91C_SSC_TXEN [expr 0x1 << 8 ] +set AT91C_SSC_TXDIS [expr 0x1 << 9 ] +set AT91C_SSC_SWRST [expr 0x1 << 15 ] +# -------- SSC_RCMR : (SSC Offset: 0x10) SSC Receive Clock Mode Register -------- +set AT91C_SSC_CKS [expr 0x3 << 0 ] +set AT91C_SSC_CKS_DIV 0x0 +set AT91C_SSC_CKS_TK 0x1 +set AT91C_SSC_CKS_RK 0x2 +set AT91C_SSC_CKO [expr 0x7 << 2 ] +set AT91C_SSC_CKO_NONE [expr 0x0 << 2 ] +set AT91C_SSC_CKO_CONTINOUS [expr 0x1 << 2 ] +set AT91C_SSC_CKO_DATA_TX [expr 0x2 << 2 ] +set AT91C_SSC_CKI [expr 0x1 << 5 ] +set AT91C_SSC_CKG [expr 0x3 << 6 ] +set AT91C_SSC_CKG_NONE [expr 0x0 << 6 ] +set AT91C_SSC_CKG_LOW [expr 0x1 << 6 ] +set AT91C_SSC_CKG_HIGH [expr 0x2 << 6 ] +set AT91C_SSC_START [expr 0xF << 8 ] +set AT91C_SSC_START_CONTINOUS [expr 0x0 << 8 ] +set AT91C_SSC_START_TX [expr 0x1 << 8 ] +set AT91C_SSC_START_LOW_RF [expr 0x2 << 8 ] +set AT91C_SSC_START_HIGH_RF [expr 0x3 << 8 ] +set AT91C_SSC_START_FALL_RF [expr 0x4 << 8 ] +set AT91C_SSC_START_RISE_RF [expr 0x5 << 8 ] +set AT91C_SSC_START_LEVEL_RF [expr 0x6 << 8 ] +set AT91C_SSC_START_EDGE_RF [expr 0x7 << 8 ] +set AT91C_SSC_START_0 [expr 0x8 << 8 ] +set AT91C_SSC_STOP [expr 0x1 << 12 ] +set AT91C_SSC_STTDLY [expr 0xFF << 16 ] +set AT91C_SSC_PERIOD [expr 0xFF << 24 ] +# -------- SSC_RFMR : (SSC Offset: 0x14) SSC Receive Frame Mode Register -------- +set AT91C_SSC_DATLEN [expr 0x1F << 0 ] +set AT91C_SSC_LOOP [expr 0x1 << 5 ] +set AT91C_SSC_MSBF [expr 0x1 << 7 ] +set AT91C_SSC_DATNB [expr 0xF << 8 ] +set AT91C_SSC_FSLEN [expr 0xF << 16 ] +set AT91C_SSC_FSOS [expr 0x7 << 20 ] +set AT91C_SSC_FSOS_NONE [expr 0x0 << 20 ] +set AT91C_SSC_FSOS_NEGATIVE [expr 0x1 << 20 ] +set AT91C_SSC_FSOS_POSITIVE [expr 0x2 << 20 ] +set AT91C_SSC_FSOS_LOW [expr 0x3 << 20 ] +set AT91C_SSC_FSOS_HIGH [expr 0x4 << 20 ] +set AT91C_SSC_FSOS_TOGGLE [expr 0x5 << 20 ] +set AT91C_SSC_FSEDGE [expr 0x1 << 24 ] +# -------- SSC_TCMR : (SSC Offset: 0x18) SSC Transmit Clock Mode Register -------- +set AT91C_SSC_CKS [expr 0x3 << 0 ] +set AT91C_SSC_CKS_DIV 0x0 +set AT91C_SSC_CKS_TK 0x1 +set AT91C_SSC_CKS_RK 0x2 +set AT91C_SSC_CKO [expr 0x7 << 2 ] +set AT91C_SSC_CKO_NONE [expr 0x0 << 2 ] +set AT91C_SSC_CKO_CONTINOUS [expr 0x1 << 2 ] +set AT91C_SSC_CKO_DATA_TX [expr 0x2 << 2 ] +set AT91C_SSC_CKI [expr 0x1 << 5 ] +set AT91C_SSC_CKG [expr 0x3 << 6 ] +set AT91C_SSC_CKG_NONE [expr 0x0 << 6 ] +set AT91C_SSC_CKG_LOW [expr 0x1 << 6 ] +set AT91C_SSC_CKG_HIGH [expr 0x2 << 6 ] +set AT91C_SSC_START [expr 0xF << 8 ] +set AT91C_SSC_START_CONTINOUS [expr 0x0 << 8 ] +set AT91C_SSC_START_TX [expr 0x1 << 8 ] +set AT91C_SSC_START_LOW_RF [expr 0x2 << 8 ] +set AT91C_SSC_START_HIGH_RF [expr 0x3 << 8 ] +set AT91C_SSC_START_FALL_RF [expr 0x4 << 8 ] +set AT91C_SSC_START_RISE_RF [expr 0x5 << 8 ] +set AT91C_SSC_START_LEVEL_RF [expr 0x6 << 8 ] +set AT91C_SSC_START_EDGE_RF [expr 0x7 << 8 ] +set AT91C_SSC_START_0 [expr 0x8 << 8 ] +set AT91C_SSC_STTDLY [expr 0xFF << 16 ] +set AT91C_SSC_PERIOD [expr 0xFF << 24 ] +# -------- SSC_TFMR : (SSC Offset: 0x1c) SSC Transmit Frame Mode Register -------- +set AT91C_SSC_DATLEN [expr 0x1F << 0 ] +set AT91C_SSC_DATDEF [expr 0x1 << 5 ] +set AT91C_SSC_MSBF [expr 0x1 << 7 ] +set AT91C_SSC_DATNB [expr 0xF << 8 ] +set AT91C_SSC_FSLEN [expr 0xF << 16 ] +set AT91C_SSC_FSOS [expr 0x7 << 20 ] +set AT91C_SSC_FSOS_NONE [expr 0x0 << 20 ] +set AT91C_SSC_FSOS_NEGATIVE [expr 0x1 << 20 ] +set AT91C_SSC_FSOS_POSITIVE [expr 0x2 << 20 ] +set AT91C_SSC_FSOS_LOW [expr 0x3 << 20 ] +set AT91C_SSC_FSOS_HIGH [expr 0x4 << 20 ] +set AT91C_SSC_FSOS_TOGGLE [expr 0x5 << 20 ] +set AT91C_SSC_FSDEN [expr 0x1 << 23 ] +set AT91C_SSC_FSEDGE [expr 0x1 << 24 ] +# -------- SSC_SR : (SSC Offset: 0x40) SSC Status Register -------- +set AT91C_SSC_TXRDY [expr 0x1 << 0 ] +set AT91C_SSC_TXEMPTY [expr 0x1 << 1 ] +set AT91C_SSC_ENDTX [expr 0x1 << 2 ] +set AT91C_SSC_TXBUFE [expr 0x1 << 3 ] +set AT91C_SSC_RXRDY [expr 0x1 << 4 ] +set AT91C_SSC_OVRUN [expr 0x1 << 5 ] +set AT91C_SSC_ENDRX [expr 0x1 << 6 ] +set AT91C_SSC_RXBUFF [expr 0x1 << 7 ] +set AT91C_SSC_CP0 [expr 0x1 << 8 ] +set AT91C_SSC_CP1 [expr 0x1 << 9 ] +set AT91C_SSC_TXSYN [expr 0x1 << 10 ] +set AT91C_SSC_RXSYN [expr 0x1 << 11 ] +set AT91C_SSC_TXENA [expr 0x1 << 16 ] +set AT91C_SSC_RXENA [expr 0x1 << 17 ] +# -------- SSC_IER : (SSC Offset: 0x44) SSC Interrupt Enable Register -------- +set AT91C_SSC_TXRDY [expr 0x1 << 0 ] +set AT91C_SSC_TXEMPTY [expr 0x1 << 1 ] +set AT91C_SSC_ENDTX [expr 0x1 << 2 ] +set AT91C_SSC_TXBUFE [expr 0x1 << 3 ] +set AT91C_SSC_RXRDY [expr 0x1 << 4 ] +set AT91C_SSC_OVRUN [expr 0x1 << 5 ] +set AT91C_SSC_ENDRX [expr 0x1 << 6 ] +set AT91C_SSC_RXBUFF [expr 0x1 << 7 ] +set AT91C_SSC_CP0 [expr 0x1 << 8 ] +set AT91C_SSC_CP1 [expr 0x1 << 9 ] +set AT91C_SSC_TXSYN [expr 0x1 << 10 ] +set AT91C_SSC_RXSYN [expr 0x1 << 11 ] +# -------- SSC_IDR : (SSC Offset: 0x48) SSC Interrupt Disable Register -------- +set AT91C_SSC_TXRDY [expr 0x1 << 0 ] +set AT91C_SSC_TXEMPTY [expr 0x1 << 1 ] +set AT91C_SSC_ENDTX [expr 0x1 << 2 ] +set AT91C_SSC_TXBUFE [expr 0x1 << 3 ] +set AT91C_SSC_RXRDY [expr 0x1 << 4 ] +set AT91C_SSC_OVRUN [expr 0x1 << 5 ] +set AT91C_SSC_ENDRX [expr 0x1 << 6 ] +set AT91C_SSC_RXBUFF [expr 0x1 << 7 ] +set AT91C_SSC_CP0 [expr 0x1 << 8 ] +set AT91C_SSC_CP1 [expr 0x1 << 9 ] +set AT91C_SSC_TXSYN [expr 0x1 << 10 ] +set AT91C_SSC_RXSYN [expr 0x1 << 11 ] +# -------- SSC_IMR : (SSC Offset: 0x4c) SSC Interrupt Mask Register -------- +set AT91C_SSC_TXRDY [expr 0x1 << 0 ] +set AT91C_SSC_TXEMPTY [expr 0x1 << 1 ] +set AT91C_SSC_ENDTX [expr 0x1 << 2 ] +set AT91C_SSC_TXBUFE [expr 0x1 << 3 ] +set AT91C_SSC_RXRDY [expr 0x1 << 4 ] +set AT91C_SSC_OVRUN [expr 0x1 << 5 ] +set AT91C_SSC_ENDRX [expr 0x1 << 6 ] +set AT91C_SSC_RXBUFF [expr 0x1 << 7 ] +set AT91C_SSC_CP0 [expr 0x1 << 8 ] +set AT91C_SSC_CP1 [expr 0x1 << 9 ] +set AT91C_SSC_TXSYN [expr 0x1 << 10 ] +set AT91C_SSC_RXSYN [expr 0x1 << 11 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Two-wire Interface +# ***************************************************************************** +# -------- TWI_CR : (TWI Offset: 0x0) TWI Control Register -------- +set AT91C_TWI_START [expr 0x1 << 0 ] +set AT91C_TWI_STOP [expr 0x1 << 1 ] +set AT91C_TWI_MSEN [expr 0x1 << 2 ] +set AT91C_TWI_MSDIS [expr 0x1 << 3 ] +set AT91C_TWI_SWRST [expr 0x1 << 7 ] +# -------- TWI_MMR : (TWI Offset: 0x4) TWI Master Mode Register -------- +set AT91C_TWI_IADRSZ [expr 0x3 << 8 ] +set AT91C_TWI_IADRSZ_NO [expr 0x0 << 8 ] +set AT91C_TWI_IADRSZ_1_BYTE [expr 0x1 << 8 ] +set AT91C_TWI_IADRSZ_2_BYTE [expr 0x2 << 8 ] +set AT91C_TWI_IADRSZ_3_BYTE [expr 0x3 << 8 ] +set AT91C_TWI_MREAD [expr 0x1 << 12 ] +set AT91C_TWI_DADR [expr 0x7F << 16 ] +# -------- TWI_CWGR : (TWI Offset: 0x10) TWI Clock Waveform Generator Register -------- +set AT91C_TWI_CLDIV [expr 0xFF << 0 ] +set AT91C_TWI_CHDIV [expr 0xFF << 8 ] +set AT91C_TWI_CKDIV [expr 0x7 << 16 ] +# -------- TWI_SR : (TWI Offset: 0x20) TWI Status Register -------- +set AT91C_TWI_TXCOMP [expr 0x1 << 0 ] +set AT91C_TWI_RXRDY [expr 0x1 << 1 ] +set AT91C_TWI_TXRDY [expr 0x1 << 2 ] +set AT91C_TWI_OVRE [expr 0x1 << 6 ] +set AT91C_TWI_UNRE [expr 0x1 << 7 ] +set AT91C_TWI_NACK [expr 0x1 << 8 ] +# -------- TWI_IER : (TWI Offset: 0x24) TWI Interrupt Enable Register -------- +set AT91C_TWI_TXCOMP [expr 0x1 << 0 ] +set AT91C_TWI_RXRDY [expr 0x1 << 1 ] +set AT91C_TWI_TXRDY [expr 0x1 << 2 ] +set AT91C_TWI_OVRE [expr 0x1 << 6 ] +set AT91C_TWI_UNRE [expr 0x1 << 7 ] +set AT91C_TWI_NACK [expr 0x1 << 8 ] +# -------- TWI_IDR : (TWI Offset: 0x28) TWI Interrupt Disable Register -------- +set AT91C_TWI_TXCOMP [expr 0x1 << 0 ] +set AT91C_TWI_RXRDY [expr 0x1 << 1 ] +set AT91C_TWI_TXRDY [expr 0x1 << 2 ] +set AT91C_TWI_OVRE [expr 0x1 << 6 ] +set AT91C_TWI_UNRE [expr 0x1 << 7 ] +set AT91C_TWI_NACK [expr 0x1 << 8 ] +# -------- TWI_IMR : (TWI Offset: 0x2c) TWI Interrupt Mask Register -------- +set AT91C_TWI_TXCOMP [expr 0x1 << 0 ] +set AT91C_TWI_RXRDY [expr 0x1 << 1 ] +set AT91C_TWI_TXRDY [expr 0x1 << 2 ] +set AT91C_TWI_OVRE [expr 0x1 << 6 ] +set AT91C_TWI_UNRE [expr 0x1 << 7 ] +set AT91C_TWI_NACK [expr 0x1 << 8 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR PWMC Channel Interface +# ***************************************************************************** +# -------- PWMC_CMR : (PWMC_CH Offset: 0x0) PWMC Channel Mode Register -------- +set AT91C_PWMC_CPRE [expr 0xF << 0 ] +set AT91C_PWMC_CPRE_MCK 0x0 +set AT91C_PWMC_CPRE_MCK/2 0x1 +set AT91C_PWMC_CPRE_MCK/4 0x2 +set AT91C_PWMC_CPRE_MCK/8 0x3 +set AT91C_PWMC_CPRE_MCK/16 0x4 +set AT91C_PWMC_CPRE_MCK/32 0x5 +set AT91C_PWMC_CPRE_MCK/64 0x6 +set AT91C_PWMC_CPRE_MCK/128 0x7 +set AT91C_PWMC_CPRE_MCK/256 0x8 +set AT91C_PWMC_CPRE_MCK/512 0x9 +set AT91C_PWMC_CPRE_MCK/1024 0xA +set AT91C_PWMC_CPRE_MCKA 0xB +set AT91C_PWMC_CPRE_MCKB 0xC +set AT91C_PWMC_CALG [expr 0x1 << 8 ] +set AT91C_PWMC_CPOL [expr 0x1 << 9 ] +set AT91C_PWMC_CPD [expr 0x1 << 10 ] +# -------- PWMC_CDTYR : (PWMC_CH Offset: 0x4) PWMC Channel Duty Cycle Register -------- +set AT91C_PWMC_CDTY [expr 0x0 << 0 ] +# -------- PWMC_CPRDR : (PWMC_CH Offset: 0x8) PWMC Channel Period Register -------- +set AT91C_PWMC_CPRD [expr 0x0 << 0 ] +# -------- PWMC_CCNTR : (PWMC_CH Offset: 0xc) PWMC Channel Counter Register -------- +set AT91C_PWMC_CCNT [expr 0x0 << 0 ] +# -------- PWMC_CUPDR : (PWMC_CH Offset: 0x10) PWMC Channel Update Register -------- +set AT91C_PWMC_CUPD [expr 0x0 << 0 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Pulse Width Modulation Controller Interface +# ***************************************************************************** +# -------- PWMC_MR : (PWMC Offset: 0x0) PWMC Mode Register -------- +set AT91C_PWMC_DIVA [expr 0xFF << 0 ] +set AT91C_PWMC_PREA [expr 0xF << 8 ] +set AT91C_PWMC_PREA_MCK [expr 0x0 << 8 ] +set AT91C_PWMC_PREA_MCK/2 [expr 0x1 << 8 ] +set AT91C_PWMC_PREA_MCK/4 [expr 0x2 << 8 ] +set AT91C_PWMC_PREA_MCK/8 [expr 0x3 << 8 ] +set AT91C_PWMC_PREA_MCK/16 [expr 0x4 << 8 ] +set AT91C_PWMC_PREA_MCK/32 [expr 0x5 << 8 ] +set AT91C_PWMC_PREA_MCK/64 [expr 0x6 << 8 ] +set AT91C_PWMC_PREA_MCK/128 [expr 0x7 << 8 ] +set AT91C_PWMC_PREA_MCK/256 [expr 0x8 << 8 ] +set AT91C_PWMC_DIVB [expr 0xFF << 16 ] +set AT91C_PWMC_PREB [expr 0xF << 24 ] +set AT91C_PWMC_PREB_MCK [expr 0x0 << 24 ] +set AT91C_PWMC_PREB_MCK/2 [expr 0x1 << 24 ] +set AT91C_PWMC_PREB_MCK/4 [expr 0x2 << 24 ] +set AT91C_PWMC_PREB_MCK/8 [expr 0x3 << 24 ] +set AT91C_PWMC_PREB_MCK/16 [expr 0x4 << 24 ] +set AT91C_PWMC_PREB_MCK/32 [expr 0x5 << 24 ] +set AT91C_PWMC_PREB_MCK/64 [expr 0x6 << 24 ] +set AT91C_PWMC_PREB_MCK/128 [expr 0x7 << 24 ] +set AT91C_PWMC_PREB_MCK/256 [expr 0x8 << 24 ] +# -------- PWMC_ENA : (PWMC Offset: 0x4) PWMC Enable Register -------- +set AT91C_PWMC_CHID0 [expr 0x1 << 0 ] +set AT91C_PWMC_CHID1 [expr 0x1 << 1 ] +set AT91C_PWMC_CHID2 [expr 0x1 << 2 ] +set AT91C_PWMC_CHID3 [expr 0x1 << 3 ] +# -------- PWMC_DIS : (PWMC Offset: 0x8) PWMC Disable Register -------- +set AT91C_PWMC_CHID0 [expr 0x1 << 0 ] +set AT91C_PWMC_CHID1 [expr 0x1 << 1 ] +set AT91C_PWMC_CHID2 [expr 0x1 << 2 ] +set AT91C_PWMC_CHID3 [expr 0x1 << 3 ] +# -------- PWMC_SR : (PWMC Offset: 0xc) PWMC Status Register -------- +set AT91C_PWMC_CHID0 [expr 0x1 << 0 ] +set AT91C_PWMC_CHID1 [expr 0x1 << 1 ] +set AT91C_PWMC_CHID2 [expr 0x1 << 2 ] +set AT91C_PWMC_CHID3 [expr 0x1 << 3 ] +# -------- PWMC_IER : (PWMC Offset: 0x10) PWMC Interrupt Enable Register -------- +set AT91C_PWMC_CHID0 [expr 0x1 << 0 ] +set AT91C_PWMC_CHID1 [expr 0x1 << 1 ] +set AT91C_PWMC_CHID2 [expr 0x1 << 2 ] +set AT91C_PWMC_CHID3 [expr 0x1 << 3 ] +# -------- PWMC_IDR : (PWMC Offset: 0x14) PWMC Interrupt Disable Register -------- +set AT91C_PWMC_CHID0 [expr 0x1 << 0 ] +set AT91C_PWMC_CHID1 [expr 0x1 << 1 ] +set AT91C_PWMC_CHID2 [expr 0x1 << 2 ] +set AT91C_PWMC_CHID3 [expr 0x1 << 3 ] +# -------- PWMC_IMR : (PWMC Offset: 0x18) PWMC Interrupt Mask Register -------- +set AT91C_PWMC_CHID0 [expr 0x1 << 0 ] +set AT91C_PWMC_CHID1 [expr 0x1 << 1 ] +set AT91C_PWMC_CHID2 [expr 0x1 << 2 ] +set AT91C_PWMC_CHID3 [expr 0x1 << 3 ] +# -------- PWMC_ISR : (PWMC Offset: 0x1c) PWMC Interrupt Status Register -------- +set AT91C_PWMC_CHID0 [expr 0x1 << 0 ] +set AT91C_PWMC_CHID1 [expr 0x1 << 1 ] +set AT91C_PWMC_CHID2 [expr 0x1 << 2 ] +set AT91C_PWMC_CHID3 [expr 0x1 << 3 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR USB Device Interface +# ***************************************************************************** +# -------- UDP_FRM_NUM : (UDP Offset: 0x0) USB Frame Number Register -------- +set AT91C_UDP_FRM_NUM [expr 0x7FF << 0 ] +set AT91C_UDP_FRM_ERR [expr 0x1 << 16 ] +set AT91C_UDP_FRM_OK [expr 0x1 << 17 ] +# -------- UDP_GLB_STATE : (UDP Offset: 0x4) USB Global State Register -------- +set AT91C_UDP_FADDEN [expr 0x1 << 0 ] +set AT91C_UDP_CONFG [expr 0x1 << 1 ] +set AT91C_UDP_ESR [expr 0x1 << 2 ] +set AT91C_UDP_RSMINPR [expr 0x1 << 3 ] +set AT91C_UDP_RMWUPE [expr 0x1 << 4 ] +# -------- UDP_FADDR : (UDP Offset: 0x8) USB Function Address Register -------- +set AT91C_UDP_FADD [expr 0xFF << 0 ] +set AT91C_UDP_FEN [expr 0x1 << 8 ] +# -------- UDP_IER : (UDP Offset: 0x10) USB Interrupt Enable Register -------- +set AT91C_UDP_EPINT0 [expr 0x1 << 0 ] +set AT91C_UDP_EPINT1 [expr 0x1 << 1 ] +set AT91C_UDP_EPINT2 [expr 0x1 << 2 ] +set AT91C_UDP_EPINT3 [expr 0x1 << 3 ] +set AT91C_UDP_EPINT4 [expr 0x1 << 4 ] +set AT91C_UDP_EPINT5 [expr 0x1 << 5 ] +set AT91C_UDP_RXSUSP [expr 0x1 << 8 ] +set AT91C_UDP_RXRSM [expr 0x1 << 9 ] +set AT91C_UDP_EXTRSM [expr 0x1 << 10 ] +set AT91C_UDP_SOFINT [expr 0x1 << 11 ] +set AT91C_UDP_WAKEUP [expr 0x1 << 13 ] +# -------- UDP_IDR : (UDP Offset: 0x14) USB Interrupt Disable Register -------- +set AT91C_UDP_EPINT0 [expr 0x1 << 0 ] +set AT91C_UDP_EPINT1 [expr 0x1 << 1 ] +set AT91C_UDP_EPINT2 [expr 0x1 << 2 ] +set AT91C_UDP_EPINT3 [expr 0x1 << 3 ] +set AT91C_UDP_EPINT4 [expr 0x1 << 4 ] +set AT91C_UDP_EPINT5 [expr 0x1 << 5 ] +set AT91C_UDP_RXSUSP [expr 0x1 << 8 ] +set AT91C_UDP_RXRSM [expr 0x1 << 9 ] +set AT91C_UDP_EXTRSM [expr 0x1 << 10 ] +set AT91C_UDP_SOFINT [expr 0x1 << 11 ] +set AT91C_UDP_WAKEUP [expr 0x1 << 13 ] +# -------- UDP_IMR : (UDP Offset: 0x18) USB Interrupt Mask Register -------- +set AT91C_UDP_EPINT0 [expr 0x1 << 0 ] +set AT91C_UDP_EPINT1 [expr 0x1 << 1 ] +set AT91C_UDP_EPINT2 [expr 0x1 << 2 ] +set AT91C_UDP_EPINT3 [expr 0x1 << 3 ] +set AT91C_UDP_EPINT4 [expr 0x1 << 4 ] +set AT91C_UDP_EPINT5 [expr 0x1 << 5 ] +set AT91C_UDP_RXSUSP [expr 0x1 << 8 ] +set AT91C_UDP_RXRSM [expr 0x1 << 9 ] +set AT91C_UDP_EXTRSM [expr 0x1 << 10 ] +set AT91C_UDP_SOFINT [expr 0x1 << 11 ] +set AT91C_UDP_WAKEUP [expr 0x1 << 13 ] +# -------- UDP_ISR : (UDP Offset: 0x1c) USB Interrupt Status Register -------- +set AT91C_UDP_EPINT0 [expr 0x1 << 0 ] +set AT91C_UDP_EPINT1 [expr 0x1 << 1 ] +set AT91C_UDP_EPINT2 [expr 0x1 << 2 ] +set AT91C_UDP_EPINT3 [expr 0x1 << 3 ] +set AT91C_UDP_EPINT4 [expr 0x1 << 4 ] +set AT91C_UDP_EPINT5 [expr 0x1 << 5 ] +set AT91C_UDP_RXSUSP [expr 0x1 << 8 ] +set AT91C_UDP_RXRSM [expr 0x1 << 9 ] +set AT91C_UDP_EXTRSM [expr 0x1 << 10 ] +set AT91C_UDP_SOFINT [expr 0x1 << 11 ] +set AT91C_UDP_ENDBUSRES [expr 0x1 << 12 ] +set AT91C_UDP_WAKEUP [expr 0x1 << 13 ] +# -------- UDP_ICR : (UDP Offset: 0x20) USB Interrupt Clear Register -------- +set AT91C_UDP_EPINT0 [expr 0x1 << 0 ] +set AT91C_UDP_EPINT1 [expr 0x1 << 1 ] +set AT91C_UDP_EPINT2 [expr 0x1 << 2 ] +set AT91C_UDP_EPINT3 [expr 0x1 << 3 ] +set AT91C_UDP_EPINT4 [expr 0x1 << 4 ] +set AT91C_UDP_EPINT5 [expr 0x1 << 5 ] +set AT91C_UDP_RXSUSP [expr 0x1 << 8 ] +set AT91C_UDP_RXRSM [expr 0x1 << 9 ] +set AT91C_UDP_EXTRSM [expr 0x1 << 10 ] +set AT91C_UDP_SOFINT [expr 0x1 << 11 ] +set AT91C_UDP_WAKEUP [expr 0x1 << 13 ] +# -------- UDP_RST_EP : (UDP Offset: 0x28) USB Reset Endpoint Register -------- +set AT91C_UDP_EP0 [expr 0x1 << 0 ] +set AT91C_UDP_EP1 [expr 0x1 << 1 ] +set AT91C_UDP_EP2 [expr 0x1 << 2 ] +set AT91C_UDP_EP3 [expr 0x1 << 3 ] +set AT91C_UDP_EP4 [expr 0x1 << 4 ] +set AT91C_UDP_EP5 [expr 0x1 << 5 ] +# -------- UDP_CSR : (UDP Offset: 0x30) USB Endpoint Control and Status Register -------- +set AT91C_UDP_TXCOMP [expr 0x1 << 0 ] +set AT91C_UDP_RX_DATA_BK0 [expr 0x1 << 1 ] +set AT91C_UDP_RXSETUP [expr 0x1 << 2 ] +set AT91C_UDP_ISOERROR [expr 0x1 << 3 ] +set AT91C_UDP_TXPKTRDY [expr 0x1 << 4 ] +set AT91C_UDP_FORCESTALL [expr 0x1 << 5 ] +set AT91C_UDP_RX_DATA_BK1 [expr 0x1 << 6 ] +set AT91C_UDP_DIR [expr 0x1 << 7 ] +set AT91C_UDP_EPTYPE [expr 0x7 << 8 ] +set AT91C_UDP_EPTYPE_CTRL [expr 0x0 << 8 ] +set AT91C_UDP_EPTYPE_ISO_OUT [expr 0x1 << 8 ] +set AT91C_UDP_EPTYPE_BULK_OUT [expr 0x2 << 8 ] +set AT91C_UDP_EPTYPE_INT_OUT [expr 0x3 << 8 ] +set AT91C_UDP_EPTYPE_ISO_IN [expr 0x5 << 8 ] +set AT91C_UDP_EPTYPE_BULK_IN [expr 0x6 << 8 ] +set AT91C_UDP_EPTYPE_INT_IN [expr 0x7 << 8 ] +set AT91C_UDP_DTGLE [expr 0x1 << 11 ] +set AT91C_UDP_EPEDS [expr 0x1 << 15 ] +set AT91C_UDP_RXBYTECNT [expr 0x7FF << 16 ] +# -------- UDP_TXVC : (UDP Offset: 0x74) Transceiver Control Register -------- +set AT91C_UDP_TXVDIS [expr 0x1 << 8 ] +set AT91C_UDP_PUON [expr 0x1 << 9 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Timer Counter Channel Interface +# ***************************************************************************** +# -------- TC_CCR : (TC Offset: 0x0) TC Channel Control Register -------- +set AT91C_TC_CLKEN [expr 0x1 << 0 ] +set AT91C_TC_CLKDIS [expr 0x1 << 1 ] +set AT91C_TC_SWTRG [expr 0x1 << 2 ] +# -------- TC_CMR : (TC Offset: 0x4) TC Channel Mode Register: Capture Mode / Waveform Mode -------- +set AT91C_TC_CLKS [expr 0x7 << 0 ] +set AT91C_TC_CLKS_TIMER_DIV1_CLOCK 0x0 +set AT91C_TC_CLKS_TIMER_DIV2_CLOCK 0x1 +set AT91C_TC_CLKS_TIMER_DIV3_CLOCK 0x2 +set AT91C_TC_CLKS_TIMER_DIV4_CLOCK 0x3 +set AT91C_TC_CLKS_TIMER_DIV5_CLOCK 0x4 +set AT91C_TC_CLKS_XC0 0x5 +set AT91C_TC_CLKS_XC1 0x6 +set AT91C_TC_CLKS_XC2 0x7 +set AT91C_TC_CLKS [expr 0x7 << 0 ] +set AT91C_TC_CLKS_TIMER_DIV1_CLOCK 0x0 +set AT91C_TC_CLKS_TIMER_DIV2_CLOCK 0x1 +set AT91C_TC_CLKS_TIMER_DIV3_CLOCK 0x2 +set AT91C_TC_CLKS_TIMER_DIV4_CLOCK 0x3 +set AT91C_TC_CLKS_TIMER_DIV5_CLOCK 0x4 +set AT91C_TC_CLKS_XC0 0x5 +set AT91C_TC_CLKS_XC1 0x6 +set AT91C_TC_CLKS_XC2 0x7 +set AT91C_TC_CLKI [expr 0x1 << 3 ] +set AT91C_TC_CLKI [expr 0x1 << 3 ] +set AT91C_TC_BURST [expr 0x3 << 4 ] +set AT91C_TC_BURST_NONE [expr 0x0 << 4 ] +set AT91C_TC_BURST_XC0 [expr 0x1 << 4 ] +set AT91C_TC_BURST_XC1 [expr 0x2 << 4 ] +set AT91C_TC_BURST_XC2 [expr 0x3 << 4 ] +set AT91C_TC_BURST [expr 0x3 << 4 ] +set AT91C_TC_BURST_NONE [expr 0x0 << 4 ] +set AT91C_TC_BURST_XC0 [expr 0x1 << 4 ] +set AT91C_TC_BURST_XC1 [expr 0x2 << 4 ] +set AT91C_TC_BURST_XC2 [expr 0x3 << 4 ] +set AT91C_TC_CPCSTOP [expr 0x1 << 6 ] +set AT91C_TC_LDBSTOP [expr 0x1 << 6 ] +set AT91C_TC_CPCDIS [expr 0x1 << 7 ] +set AT91C_TC_LDBDIS [expr 0x1 << 7 ] +set AT91C_TC_ETRGEDG [expr 0x3 << 8 ] +set AT91C_TC_ETRGEDG_NONE [expr 0x0 << 8 ] +set AT91C_TC_ETRGEDG_RISING [expr 0x1 << 8 ] +set AT91C_TC_ETRGEDG_FALLING [expr 0x2 << 8 ] +set AT91C_TC_ETRGEDG_BOTH [expr 0x3 << 8 ] +set AT91C_TC_EEVTEDG [expr 0x3 << 8 ] +set AT91C_TC_EEVTEDG_NONE [expr 0x0 << 8 ] +set AT91C_TC_EEVTEDG_RISING [expr 0x1 << 8 ] +set AT91C_TC_EEVTEDG_FALLING [expr 0x2 << 8 ] +set AT91C_TC_EEVTEDG_BOTH [expr 0x3 << 8 ] +set AT91C_TC_EEVT [expr 0x3 << 10 ] +set AT91C_TC_EEVT_TIOB [expr 0x0 << 10 ] +set AT91C_TC_EEVT_XC0 [expr 0x1 << 10 ] +set AT91C_TC_EEVT_XC1 [expr 0x2 << 10 ] +set AT91C_TC_EEVT_XC2 [expr 0x3 << 10 ] +set AT91C_TC_ABETRG [expr 0x1 << 10 ] +set AT91C_TC_ENETRG [expr 0x1 << 12 ] +set AT91C_TC_WAVESEL [expr 0x3 << 13 ] +set AT91C_TC_WAVESEL_UP [expr 0x0 << 13 ] +set AT91C_TC_WAVESEL_UPDOWN [expr 0x1 << 13 ] +set AT91C_TC_WAVESEL_UP_AUTO [expr 0x2 << 13 ] +set AT91C_TC_WAVESEL_UPDOWN_AUTO [expr 0x3 << 13 ] +set AT91C_TC_CPCTRG [expr 0x1 << 14 ] +set AT91C_TC_WAVE [expr 0x1 << 15 ] +set AT91C_TC_WAVE [expr 0x1 << 15 ] +set AT91C_TC_ACPA [expr 0x3 << 16 ] +set AT91C_TC_ACPA_NONE [expr 0x0 << 16 ] +set AT91C_TC_ACPA_SET [expr 0x1 << 16 ] +set AT91C_TC_ACPA_CLEAR [expr 0x2 << 16 ] +set AT91C_TC_ACPA_TOGGLE [expr 0x3 << 16 ] +set AT91C_TC_LDRA [expr 0x3 << 16 ] +set AT91C_TC_LDRA_NONE [expr 0x0 << 16 ] +set AT91C_TC_LDRA_RISING [expr 0x1 << 16 ] +set AT91C_TC_LDRA_FALLING [expr 0x2 << 16 ] +set AT91C_TC_LDRA_BOTH [expr 0x3 << 16 ] +set AT91C_TC_ACPC [expr 0x3 << 18 ] +set AT91C_TC_ACPC_NONE [expr 0x0 << 18 ] +set AT91C_TC_ACPC_SET [expr 0x1 << 18 ] +set AT91C_TC_ACPC_CLEAR [expr 0x2 << 18 ] +set AT91C_TC_ACPC_TOGGLE [expr 0x3 << 18 ] +set AT91C_TC_LDRB [expr 0x3 << 18 ] +set AT91C_TC_LDRB_NONE [expr 0x0 << 18 ] +set AT91C_TC_LDRB_RISING [expr 0x1 << 18 ] +set AT91C_TC_LDRB_FALLING [expr 0x2 << 18 ] +set AT91C_TC_LDRB_BOTH [expr 0x3 << 18 ] +set AT91C_TC_AEEVT [expr 0x3 << 20 ] +set AT91C_TC_AEEVT_NONE [expr 0x0 << 20 ] +set AT91C_TC_AEEVT_SET [expr 0x1 << 20 ] +set AT91C_TC_AEEVT_CLEAR [expr 0x2 << 20 ] +set AT91C_TC_AEEVT_TOGGLE [expr 0x3 << 20 ] +set AT91C_TC_ASWTRG [expr 0x3 << 22 ] +set AT91C_TC_ASWTRG_NONE [expr 0x0 << 22 ] +set AT91C_TC_ASWTRG_SET [expr 0x1 << 22 ] +set AT91C_TC_ASWTRG_CLEAR [expr 0x2 << 22 ] +set AT91C_TC_ASWTRG_TOGGLE [expr 0x3 << 22 ] +set AT91C_TC_BCPB [expr 0x3 << 24 ] +set AT91C_TC_BCPB_NONE [expr 0x0 << 24 ] +set AT91C_TC_BCPB_SET [expr 0x1 << 24 ] +set AT91C_TC_BCPB_CLEAR [expr 0x2 << 24 ] +set AT91C_TC_BCPB_TOGGLE [expr 0x3 << 24 ] +set AT91C_TC_BCPC [expr 0x3 << 26 ] +set AT91C_TC_BCPC_NONE [expr 0x0 << 26 ] +set AT91C_TC_BCPC_SET [expr 0x1 << 26 ] +set AT91C_TC_BCPC_CLEAR [expr 0x2 << 26 ] +set AT91C_TC_BCPC_TOGGLE [expr 0x3 << 26 ] +set AT91C_TC_BEEVT [expr 0x3 << 28 ] +set AT91C_TC_BEEVT_NONE [expr 0x0 << 28 ] +set AT91C_TC_BEEVT_SET [expr 0x1 << 28 ] +set AT91C_TC_BEEVT_CLEAR [expr 0x2 << 28 ] +set AT91C_TC_BEEVT_TOGGLE [expr 0x3 << 28 ] +set AT91C_TC_BSWTRG [expr 0x3 << 30 ] +set AT91C_TC_BSWTRG_NONE [expr 0x0 << 30 ] +set AT91C_TC_BSWTRG_SET [expr 0x1 << 30 ] +set AT91C_TC_BSWTRG_CLEAR [expr 0x2 << 30 ] +set AT91C_TC_BSWTRG_TOGGLE [expr 0x3 << 30 ] +# -------- TC_SR : (TC Offset: 0x20) TC Channel Status Register -------- +set AT91C_TC_COVFS [expr 0x1 << 0 ] +set AT91C_TC_LOVRS [expr 0x1 << 1 ] +set AT91C_TC_CPAS [expr 0x1 << 2 ] +set AT91C_TC_CPBS [expr 0x1 << 3 ] +set AT91C_TC_CPCS [expr 0x1 << 4 ] +set AT91C_TC_LDRAS [expr 0x1 << 5 ] +set AT91C_TC_LDRBS [expr 0x1 << 6 ] +set AT91C_TC_ETRGS [expr 0x1 << 7 ] +set AT91C_TC_CLKSTA [expr 0x1 << 16 ] +set AT91C_TC_MTIOA [expr 0x1 << 17 ] +set AT91C_TC_MTIOB [expr 0x1 << 18 ] +# -------- TC_IER : (TC Offset: 0x24) TC Channel Interrupt Enable Register -------- +set AT91C_TC_COVFS [expr 0x1 << 0 ] +set AT91C_TC_LOVRS [expr 0x1 << 1 ] +set AT91C_TC_CPAS [expr 0x1 << 2 ] +set AT91C_TC_CPBS [expr 0x1 << 3 ] +set AT91C_TC_CPCS [expr 0x1 << 4 ] +set AT91C_TC_LDRAS [expr 0x1 << 5 ] +set AT91C_TC_LDRBS [expr 0x1 << 6 ] +set AT91C_TC_ETRGS [expr 0x1 << 7 ] +# -------- TC_IDR : (TC Offset: 0x28) TC Channel Interrupt Disable Register -------- +set AT91C_TC_COVFS [expr 0x1 << 0 ] +set AT91C_TC_LOVRS [expr 0x1 << 1 ] +set AT91C_TC_CPAS [expr 0x1 << 2 ] +set AT91C_TC_CPBS [expr 0x1 << 3 ] +set AT91C_TC_CPCS [expr 0x1 << 4 ] +set AT91C_TC_LDRAS [expr 0x1 << 5 ] +set AT91C_TC_LDRBS [expr 0x1 << 6 ] +set AT91C_TC_ETRGS [expr 0x1 << 7 ] +# -------- TC_IMR : (TC Offset: 0x2c) TC Channel Interrupt Mask Register -------- +set AT91C_TC_COVFS [expr 0x1 << 0 ] +set AT91C_TC_LOVRS [expr 0x1 << 1 ] +set AT91C_TC_CPAS [expr 0x1 << 2 ] +set AT91C_TC_CPBS [expr 0x1 << 3 ] +set AT91C_TC_CPCS [expr 0x1 << 4 ] +set AT91C_TC_LDRAS [expr 0x1 << 5 ] +set AT91C_TC_LDRBS [expr 0x1 << 6 ] +set AT91C_TC_ETRGS [expr 0x1 << 7 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Timer Counter Interface +# ***************************************************************************** +# -------- TCB_BCR : (TCB Offset: 0xc0) TC Block Control Register -------- +set AT91C_TCB_SYNC [expr 0x1 << 0 ] +# -------- TCB_BMR : (TCB Offset: 0xc4) TC Block Mode Register -------- +set AT91C_TCB_TC0XC0S [expr 0x3 << 0 ] +set AT91C_TCB_TC0XC0S_TCLK0 0x0 +set AT91C_TCB_TC0XC0S_NONE 0x1 +set AT91C_TCB_TC0XC0S_TIOA1 0x2 +set AT91C_TCB_TC0XC0S_TIOA2 0x3 +set AT91C_TCB_TC1XC1S [expr 0x3 << 2 ] +set AT91C_TCB_TC1XC1S_TCLK1 [expr 0x0 << 2 ] +set AT91C_TCB_TC1XC1S_NONE [expr 0x1 << 2 ] +set AT91C_TCB_TC1XC1S_TIOA0 [expr 0x2 << 2 ] +set AT91C_TCB_TC1XC1S_TIOA2 [expr 0x3 << 2 ] +set AT91C_TCB_TC2XC2S [expr 0x3 << 4 ] +set AT91C_TCB_TC2XC2S_TCLK2 [expr 0x0 << 4 ] +set AT91C_TCB_TC2XC2S_NONE [expr 0x1 << 4 ] +set AT91C_TCB_TC2XC2S_TIOA0 [expr 0x2 << 4 ] +set AT91C_TCB_TC2XC2S_TIOA1 [expr 0x3 << 4 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Control Area Network MailBox Interface +# ***************************************************************************** +# -------- CAN_MMR : (CAN_MB Offset: 0x0) CAN Message Mode Register -------- +set AT91C_CAN_MTIMEMARK [expr 0xFFFF << 0 ] +set AT91C_CAN_PRIOR [expr 0xF << 16 ] +set AT91C_CAN_MOT [expr 0x7 << 24 ] +set AT91C_CAN_MOT_DIS [expr 0x0 << 24 ] +set AT91C_CAN_MOT_RX [expr 0x1 << 24 ] +set AT91C_CAN_MOT_RXOVERWRITE [expr 0x2 << 24 ] +set AT91C_CAN_MOT_TX [expr 0x3 << 24 ] +set AT91C_CAN_MOT_CONSUMER [expr 0x4 << 24 ] +set AT91C_CAN_MOT_PRODUCER [expr 0x5 << 24 ] +# -------- CAN_MAM : (CAN_MB Offset: 0x4) CAN Message Acceptance Mask Register -------- +set AT91C_CAN_MIDvB [expr 0x3FFFF << 0 ] +set AT91C_CAN_MIDvA [expr 0x7FF << 18 ] +set AT91C_CAN_MIDE [expr 0x1 << 29 ] +# -------- CAN_MID : (CAN_MB Offset: 0x8) CAN Message ID Register -------- +set AT91C_CAN_MIDvB [expr 0x3FFFF << 0 ] +set AT91C_CAN_MIDvA [expr 0x7FF << 18 ] +set AT91C_CAN_MIDE [expr 0x1 << 29 ] +# -------- CAN_MFID : (CAN_MB Offset: 0xc) CAN Message Family ID Register -------- +# -------- CAN_MSR : (CAN_MB Offset: 0x10) CAN Message Status Register -------- +set AT91C_CAN_MTIMESTAMP [expr 0xFFFF << 0 ] +set AT91C_CAN_MDLC [expr 0xF << 16 ] +set AT91C_CAN_MRTR [expr 0x1 << 20 ] +set AT91C_CAN_MABT [expr 0x1 << 22 ] +set AT91C_CAN_MRDY [expr 0x1 << 23 ] +set AT91C_CAN_MMI [expr 0x1 << 24 ] +# -------- CAN_MDL : (CAN_MB Offset: 0x14) CAN Message Data Low Register -------- +# -------- CAN_MDH : (CAN_MB Offset: 0x18) CAN Message Data High Register -------- +# -------- CAN_MCR : (CAN_MB Offset: 0x1c) CAN Message Control Register -------- +set AT91C_CAN_MDLC [expr 0xF << 16 ] +set AT91C_CAN_MRTR [expr 0x1 << 20 ] +set AT91C_CAN_MACR [expr 0x1 << 22 ] +set AT91C_CAN_MTCR [expr 0x1 << 23 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Control Area Network Interface +# ***************************************************************************** +# -------- CAN_MR : (CAN Offset: 0x0) CAN Mode Register -------- +set AT91C_CAN_CANEN [expr 0x1 << 0 ] +set AT91C_CAN_LPM [expr 0x1 << 1 ] +set AT91C_CAN_ABM [expr 0x1 << 2 ] +set AT91C_CAN_OVL [expr 0x1 << 3 ] +set AT91C_CAN_TEOF [expr 0x1 << 4 ] +set AT91C_CAN_TTM [expr 0x1 << 5 ] +set AT91C_CAN_TIMFRZ [expr 0x1 << 6 ] +set AT91C_CAN_DRPT [expr 0x1 << 7 ] +# -------- CAN_IER : (CAN Offset: 0x4) CAN Interrupt Enable Register -------- +set AT91C_CAN_MB0 [expr 0x1 << 0 ] +set AT91C_CAN_MB1 [expr 0x1 << 1 ] +set AT91C_CAN_MB2 [expr 0x1 << 2 ] +set AT91C_CAN_MB3 [expr 0x1 << 3 ] +set AT91C_CAN_MB4 [expr 0x1 << 4 ] +set AT91C_CAN_MB5 [expr 0x1 << 5 ] +set AT91C_CAN_MB6 [expr 0x1 << 6 ] +set AT91C_CAN_MB7 [expr 0x1 << 7 ] +set AT91C_CAN_MB8 [expr 0x1 << 8 ] +set AT91C_CAN_MB9 [expr 0x1 << 9 ] +set AT91C_CAN_MB10 [expr 0x1 << 10 ] +set AT91C_CAN_MB11 [expr 0x1 << 11 ] +set AT91C_CAN_MB12 [expr 0x1 << 12 ] +set AT91C_CAN_MB13 [expr 0x1 << 13 ] +set AT91C_CAN_MB14 [expr 0x1 << 14 ] +set AT91C_CAN_MB15 [expr 0x1 << 15 ] +set AT91C_CAN_ERRA [expr 0x1 << 16 ] +set AT91C_CAN_WARN [expr 0x1 << 17 ] +set AT91C_CAN_ERRP [expr 0x1 << 18 ] +set AT91C_CAN_BOFF [expr 0x1 << 19 ] +set AT91C_CAN_SLEEP [expr 0x1 << 20 ] +set AT91C_CAN_WAKEUP [expr 0x1 << 21 ] +set AT91C_CAN_TOVF [expr 0x1 << 22 ] +set AT91C_CAN_TSTP [expr 0x1 << 23 ] +set AT91C_CAN_CERR [expr 0x1 << 24 ] +set AT91C_CAN_SERR [expr 0x1 << 25 ] +set AT91C_CAN_AERR [expr 0x1 << 26 ] +set AT91C_CAN_FERR [expr 0x1 << 27 ] +set AT91C_CAN_BERR [expr 0x1 << 28 ] +# -------- CAN_IDR : (CAN Offset: 0x8) CAN Interrupt Disable Register -------- +set AT91C_CAN_MB0 [expr 0x1 << 0 ] +set AT91C_CAN_MB1 [expr 0x1 << 1 ] +set AT91C_CAN_MB2 [expr 0x1 << 2 ] +set AT91C_CAN_MB3 [expr 0x1 << 3 ] +set AT91C_CAN_MB4 [expr 0x1 << 4 ] +set AT91C_CAN_MB5 [expr 0x1 << 5 ] +set AT91C_CAN_MB6 [expr 0x1 << 6 ] +set AT91C_CAN_MB7 [expr 0x1 << 7 ] +set AT91C_CAN_MB8 [expr 0x1 << 8 ] +set AT91C_CAN_MB9 [expr 0x1 << 9 ] +set AT91C_CAN_MB10 [expr 0x1 << 10 ] +set AT91C_CAN_MB11 [expr 0x1 << 11 ] +set AT91C_CAN_MB12 [expr 0x1 << 12 ] +set AT91C_CAN_MB13 [expr 0x1 << 13 ] +set AT91C_CAN_MB14 [expr 0x1 << 14 ] +set AT91C_CAN_MB15 [expr 0x1 << 15 ] +set AT91C_CAN_ERRA [expr 0x1 << 16 ] +set AT91C_CAN_WARN [expr 0x1 << 17 ] +set AT91C_CAN_ERRP [expr 0x1 << 18 ] +set AT91C_CAN_BOFF [expr 0x1 << 19 ] +set AT91C_CAN_SLEEP [expr 0x1 << 20 ] +set AT91C_CAN_WAKEUP [expr 0x1 << 21 ] +set AT91C_CAN_TOVF [expr 0x1 << 22 ] +set AT91C_CAN_TSTP [expr 0x1 << 23 ] +set AT91C_CAN_CERR [expr 0x1 << 24 ] +set AT91C_CAN_SERR [expr 0x1 << 25 ] +set AT91C_CAN_AERR [expr 0x1 << 26 ] +set AT91C_CAN_FERR [expr 0x1 << 27 ] +set AT91C_CAN_BERR [expr 0x1 << 28 ] +# -------- CAN_IMR : (CAN Offset: 0xc) CAN Interrupt Mask Register -------- +set AT91C_CAN_MB0 [expr 0x1 << 0 ] +set AT91C_CAN_MB1 [expr 0x1 << 1 ] +set AT91C_CAN_MB2 [expr 0x1 << 2 ] +set AT91C_CAN_MB3 [expr 0x1 << 3 ] +set AT91C_CAN_MB4 [expr 0x1 << 4 ] +set AT91C_CAN_MB5 [expr 0x1 << 5 ] +set AT91C_CAN_MB6 [expr 0x1 << 6 ] +set AT91C_CAN_MB7 [expr 0x1 << 7 ] +set AT91C_CAN_MB8 [expr 0x1 << 8 ] +set AT91C_CAN_MB9 [expr 0x1 << 9 ] +set AT91C_CAN_MB10 [expr 0x1 << 10 ] +set AT91C_CAN_MB11 [expr 0x1 << 11 ] +set AT91C_CAN_MB12 [expr 0x1 << 12 ] +set AT91C_CAN_MB13 [expr 0x1 << 13 ] +set AT91C_CAN_MB14 [expr 0x1 << 14 ] +set AT91C_CAN_MB15 [expr 0x1 << 15 ] +set AT91C_CAN_ERRA [expr 0x1 << 16 ] +set AT91C_CAN_WARN [expr 0x1 << 17 ] +set AT91C_CAN_ERRP [expr 0x1 << 18 ] +set AT91C_CAN_BOFF [expr 0x1 << 19 ] +set AT91C_CAN_SLEEP [expr 0x1 << 20 ] +set AT91C_CAN_WAKEUP [expr 0x1 << 21 ] +set AT91C_CAN_TOVF [expr 0x1 << 22 ] +set AT91C_CAN_TSTP [expr 0x1 << 23 ] +set AT91C_CAN_CERR [expr 0x1 << 24 ] +set AT91C_CAN_SERR [expr 0x1 << 25 ] +set AT91C_CAN_AERR [expr 0x1 << 26 ] +set AT91C_CAN_FERR [expr 0x1 << 27 ] +set AT91C_CAN_BERR [expr 0x1 << 28 ] +# -------- CAN_SR : (CAN Offset: 0x10) CAN Status Register -------- +set AT91C_CAN_MB0 [expr 0x1 << 0 ] +set AT91C_CAN_MB1 [expr 0x1 << 1 ] +set AT91C_CAN_MB2 [expr 0x1 << 2 ] +set AT91C_CAN_MB3 [expr 0x1 << 3 ] +set AT91C_CAN_MB4 [expr 0x1 << 4 ] +set AT91C_CAN_MB5 [expr 0x1 << 5 ] +set AT91C_CAN_MB6 [expr 0x1 << 6 ] +set AT91C_CAN_MB7 [expr 0x1 << 7 ] +set AT91C_CAN_MB8 [expr 0x1 << 8 ] +set AT91C_CAN_MB9 [expr 0x1 << 9 ] +set AT91C_CAN_MB10 [expr 0x1 << 10 ] +set AT91C_CAN_MB11 [expr 0x1 << 11 ] +set AT91C_CAN_MB12 [expr 0x1 << 12 ] +set AT91C_CAN_MB13 [expr 0x1 << 13 ] +set AT91C_CAN_MB14 [expr 0x1 << 14 ] +set AT91C_CAN_MB15 [expr 0x1 << 15 ] +set AT91C_CAN_ERRA [expr 0x1 << 16 ] +set AT91C_CAN_WARN [expr 0x1 << 17 ] +set AT91C_CAN_ERRP [expr 0x1 << 18 ] +set AT91C_CAN_BOFF [expr 0x1 << 19 ] +set AT91C_CAN_SLEEP [expr 0x1 << 20 ] +set AT91C_CAN_WAKEUP [expr 0x1 << 21 ] +set AT91C_CAN_TOVF [expr 0x1 << 22 ] +set AT91C_CAN_TSTP [expr 0x1 << 23 ] +set AT91C_CAN_CERR [expr 0x1 << 24 ] +set AT91C_CAN_SERR [expr 0x1 << 25 ] +set AT91C_CAN_AERR [expr 0x1 << 26 ] +set AT91C_CAN_FERR [expr 0x1 << 27 ] +set AT91C_CAN_BERR [expr 0x1 << 28 ] +set AT91C_CAN_RBSY [expr 0x1 << 29 ] +set AT91C_CAN_TBSY [expr 0x1 << 30 ] +set AT91C_CAN_OVLY [expr 0x1 << 31 ] +# -------- CAN_BR : (CAN Offset: 0x14) CAN Baudrate Register -------- +set AT91C_CAN_PHASE2 [expr 0x7 << 0 ] +set AT91C_CAN_PHASE1 [expr 0x7 << 4 ] +set AT91C_CAN_PROPAG [expr 0x7 << 8 ] +set AT91C_CAN_SYNC [expr 0x3 << 12 ] +set AT91C_CAN_BRP [expr 0x7F << 16 ] +set AT91C_CAN_SMP [expr 0x1 << 24 ] +# -------- CAN_TIM : (CAN Offset: 0x18) CAN Timer Register -------- +set AT91C_CAN_TIMER [expr 0xFFFF << 0 ] +# -------- CAN_TIMESTP : (CAN Offset: 0x1c) CAN Timestamp Register -------- +set AT91C_CAN_MTIMESTAMP [expr 0xFFFF << 0 ] +# -------- CAN_ECR : (CAN Offset: 0x20) CAN Error Counter Register -------- +set AT91C_CAN_REC [expr 0xFF << 0 ] +set AT91C_CAN_TEC [expr 0xFF << 16 ] +# -------- CAN_TCR : (CAN Offset: 0x24) CAN Transfer Command Register -------- +set AT91C_CAN_MB0 [expr 0x1 << 0 ] +set AT91C_CAN_MB1 [expr 0x1 << 1 ] +set AT91C_CAN_MB2 [expr 0x1 << 2 ] +set AT91C_CAN_MB3 [expr 0x1 << 3 ] +set AT91C_CAN_MB4 [expr 0x1 << 4 ] +set AT91C_CAN_MB5 [expr 0x1 << 5 ] +set AT91C_CAN_MB6 [expr 0x1 << 6 ] +set AT91C_CAN_MB7 [expr 0x1 << 7 ] +set AT91C_CAN_MB8 [expr 0x1 << 8 ] +set AT91C_CAN_MB9 [expr 0x1 << 9 ] +set AT91C_CAN_MB10 [expr 0x1 << 10 ] +set AT91C_CAN_MB11 [expr 0x1 << 11 ] +set AT91C_CAN_MB12 [expr 0x1 << 12 ] +set AT91C_CAN_MB13 [expr 0x1 << 13 ] +set AT91C_CAN_MB14 [expr 0x1 << 14 ] +set AT91C_CAN_MB15 [expr 0x1 << 15 ] +set AT91C_CAN_TIMRST [expr 0x1 << 31 ] +# -------- CAN_ACR : (CAN Offset: 0x28) CAN Abort Command Register -------- +set AT91C_CAN_MB0 [expr 0x1 << 0 ] +set AT91C_CAN_MB1 [expr 0x1 << 1 ] +set AT91C_CAN_MB2 [expr 0x1 << 2 ] +set AT91C_CAN_MB3 [expr 0x1 << 3 ] +set AT91C_CAN_MB4 [expr 0x1 << 4 ] +set AT91C_CAN_MB5 [expr 0x1 << 5 ] +set AT91C_CAN_MB6 [expr 0x1 << 6 ] +set AT91C_CAN_MB7 [expr 0x1 << 7 ] +set AT91C_CAN_MB8 [expr 0x1 << 8 ] +set AT91C_CAN_MB9 [expr 0x1 << 9 ] +set AT91C_CAN_MB10 [expr 0x1 << 10 ] +set AT91C_CAN_MB11 [expr 0x1 << 11 ] +set AT91C_CAN_MB12 [expr 0x1 << 12 ] +set AT91C_CAN_MB13 [expr 0x1 << 13 ] +set AT91C_CAN_MB14 [expr 0x1 << 14 ] +set AT91C_CAN_MB15 [expr 0x1 << 15 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Ethernet MAC 10/100 +# ***************************************************************************** +# -------- EMAC_NCR : (EMAC Offset: 0x0) -------- +set AT91C_EMAC_LB [expr 0x1 << 0 ] +set AT91C_EMAC_LLB [expr 0x1 << 1 ] +set AT91C_EMAC_RE [expr 0x1 << 2 ] +set AT91C_EMAC_TE [expr 0x1 << 3 ] +set AT91C_EMAC_MPE [expr 0x1 << 4 ] +set AT91C_EMAC_CLRSTAT [expr 0x1 << 5 ] +set AT91C_EMAC_INCSTAT [expr 0x1 << 6 ] +set AT91C_EMAC_WESTAT [expr 0x1 << 7 ] +set AT91C_EMAC_BP [expr 0x1 << 8 ] +set AT91C_EMAC_TSTART [expr 0x1 << 9 ] +set AT91C_EMAC_THALT [expr 0x1 << 10 ] +set AT91C_EMAC_TPFR [expr 0x1 << 11 ] +set AT91C_EMAC_TZQ [expr 0x1 << 12 ] +# -------- EMAC_NCFGR : (EMAC Offset: 0x4) Network Configuration Register -------- +set AT91C_EMAC_SPD [expr 0x1 << 0 ] +set AT91C_EMAC_FD [expr 0x1 << 1 ] +set AT91C_EMAC_JFRAME [expr 0x1 << 3 ] +set AT91C_EMAC_CAF [expr 0x1 << 4 ] +set AT91C_EMAC_NBC [expr 0x1 << 5 ] +set AT91C_EMAC_MTI [expr 0x1 << 6 ] +set AT91C_EMAC_UNI [expr 0x1 << 7 ] +set AT91C_EMAC_BIG [expr 0x1 << 8 ] +set AT91C_EMAC_EAE [expr 0x1 << 9 ] +set AT91C_EMAC_CLK [expr 0x3 << 10 ] +set AT91C_EMAC_CLK_HCLK_8 [expr 0x0 << 10 ] +set AT91C_EMAC_CLK_HCLK_16 [expr 0x1 << 10 ] +set AT91C_EMAC_CLK_HCLK_32 [expr 0x2 << 10 ] +set AT91C_EMAC_CLK_HCLK_64 [expr 0x3 << 10 ] +set AT91C_EMAC_RTY [expr 0x1 << 12 ] +set AT91C_EMAC_PAE [expr 0x1 << 13 ] +set AT91C_EMAC_RBOF [expr 0x3 << 14 ] +set AT91C_EMAC_RBOF_OFFSET_0 [expr 0x0 << 14 ] +set AT91C_EMAC_RBOF_OFFSET_1 [expr 0x1 << 14 ] +set AT91C_EMAC_RBOF_OFFSET_2 [expr 0x2 << 14 ] +set AT91C_EMAC_RBOF_OFFSET_3 [expr 0x3 << 14 ] +set AT91C_EMAC_RLCE [expr 0x1 << 16 ] +set AT91C_EMAC_DRFCS [expr 0x1 << 17 ] +set AT91C_EMAC_EFRHD [expr 0x1 << 18 ] +set AT91C_EMAC_IRXFCS [expr 0x1 << 19 ] +# -------- EMAC_NSR : (EMAC Offset: 0x8) Network Status Register -------- +set AT91C_EMAC_LINKR [expr 0x1 << 0 ] +set AT91C_EMAC_MDIO [expr 0x1 << 1 ] +set AT91C_EMAC_IDLE [expr 0x1 << 2 ] +# -------- EMAC_TSR : (EMAC Offset: 0x14) Transmit Status Register -------- +set AT91C_EMAC_UBR [expr 0x1 << 0 ] +set AT91C_EMAC_COL [expr 0x1 << 1 ] +set AT91C_EMAC_RLES [expr 0x1 << 2 ] +set AT91C_EMAC_TGO [expr 0x1 << 3 ] +set AT91C_EMAC_BEX [expr 0x1 << 4 ] +set AT91C_EMAC_COMP [expr 0x1 << 5 ] +set AT91C_EMAC_UND [expr 0x1 << 6 ] +# -------- EMAC_RSR : (EMAC Offset: 0x20) Receive Status Register -------- +set AT91C_EMAC_BNA [expr 0x1 << 0 ] +set AT91C_EMAC_REC [expr 0x1 << 1 ] +set AT91C_EMAC_OVR [expr 0x1 << 2 ] +# -------- EMAC_ISR : (EMAC Offset: 0x24) Interrupt Status Register -------- +set AT91C_EMAC_MFD [expr 0x1 << 0 ] +set AT91C_EMAC_RCOMP [expr 0x1 << 1 ] +set AT91C_EMAC_RXUBR [expr 0x1 << 2 ] +set AT91C_EMAC_TXUBR [expr 0x1 << 3 ] +set AT91C_EMAC_TUNDR [expr 0x1 << 4 ] +set AT91C_EMAC_RLEX [expr 0x1 << 5 ] +set AT91C_EMAC_TXERR [expr 0x1 << 6 ] +set AT91C_EMAC_TCOMP [expr 0x1 << 7 ] +set AT91C_EMAC_LINK [expr 0x1 << 9 ] +set AT91C_EMAC_ROVR [expr 0x1 << 10 ] +set AT91C_EMAC_HRESP [expr 0x1 << 11 ] +set AT91C_EMAC_PFRE [expr 0x1 << 12 ] +set AT91C_EMAC_PTZ [expr 0x1 << 13 ] +# -------- EMAC_IER : (EMAC Offset: 0x28) Interrupt Enable Register -------- +set AT91C_EMAC_MFD [expr 0x1 << 0 ] +set AT91C_EMAC_RCOMP [expr 0x1 << 1 ] +set AT91C_EMAC_RXUBR [expr 0x1 << 2 ] +set AT91C_EMAC_TXUBR [expr 0x1 << 3 ] +set AT91C_EMAC_TUNDR [expr 0x1 << 4 ] +set AT91C_EMAC_RLEX [expr 0x1 << 5 ] +set AT91C_EMAC_TXERR [expr 0x1 << 6 ] +set AT91C_EMAC_TCOMP [expr 0x1 << 7 ] +set AT91C_EMAC_LINK [expr 0x1 << 9 ] +set AT91C_EMAC_ROVR [expr 0x1 << 10 ] +set AT91C_EMAC_HRESP [expr 0x1 << 11 ] +set AT91C_EMAC_PFRE [expr 0x1 << 12 ] +set AT91C_EMAC_PTZ [expr 0x1 << 13 ] +# -------- EMAC_IDR : (EMAC Offset: 0x2c) Interrupt Disable Register -------- +set AT91C_EMAC_MFD [expr 0x1 << 0 ] +set AT91C_EMAC_RCOMP [expr 0x1 << 1 ] +set AT91C_EMAC_RXUBR [expr 0x1 << 2 ] +set AT91C_EMAC_TXUBR [expr 0x1 << 3 ] +set AT91C_EMAC_TUNDR [expr 0x1 << 4 ] +set AT91C_EMAC_RLEX [expr 0x1 << 5 ] +set AT91C_EMAC_TXERR [expr 0x1 << 6 ] +set AT91C_EMAC_TCOMP [expr 0x1 << 7 ] +set AT91C_EMAC_LINK [expr 0x1 << 9 ] +set AT91C_EMAC_ROVR [expr 0x1 << 10 ] +set AT91C_EMAC_HRESP [expr 0x1 << 11 ] +set AT91C_EMAC_PFRE [expr 0x1 << 12 ] +set AT91C_EMAC_PTZ [expr 0x1 << 13 ] +# -------- EMAC_IMR : (EMAC Offset: 0x30) Interrupt Mask Register -------- +set AT91C_EMAC_MFD [expr 0x1 << 0 ] +set AT91C_EMAC_RCOMP [expr 0x1 << 1 ] +set AT91C_EMAC_RXUBR [expr 0x1 << 2 ] +set AT91C_EMAC_TXUBR [expr 0x1 << 3 ] +set AT91C_EMAC_TUNDR [expr 0x1 << 4 ] +set AT91C_EMAC_RLEX [expr 0x1 << 5 ] +set AT91C_EMAC_TXERR [expr 0x1 << 6 ] +set AT91C_EMAC_TCOMP [expr 0x1 << 7 ] +set AT91C_EMAC_LINK [expr 0x1 << 9 ] +set AT91C_EMAC_ROVR [expr 0x1 << 10 ] +set AT91C_EMAC_HRESP [expr 0x1 << 11 ] +set AT91C_EMAC_PFRE [expr 0x1 << 12 ] +set AT91C_EMAC_PTZ [expr 0x1 << 13 ] +# -------- EMAC_MAN : (EMAC Offset: 0x34) PHY Maintenance Register -------- +set AT91C_EMAC_DATA [expr 0xFFFF << 0 ] +set AT91C_EMAC_CODE [expr 0x3 << 16 ] +set AT91C_EMAC_REGA [expr 0x1F << 18 ] +set AT91C_EMAC_PHYA [expr 0x1F << 23 ] +set AT91C_EMAC_RW [expr 0x3 << 28 ] +set AT91C_EMAC_SOF [expr 0x3 << 30 ] +# -------- EMAC_USRIO : (EMAC Offset: 0xc0) USER Input Output Register -------- +set AT91C_EMAC_RMII [expr 0x1 << 0 ] +set AT91C_EMAC_CLKEN [expr 0x1 << 1 ] +# -------- EMAC_WOL : (EMAC Offset: 0xc4) Wake On LAN Register -------- +set AT91C_EMAC_IP [expr 0xFFFF << 0 ] +set AT91C_EMAC_MAG [expr 0x1 << 16 ] +set AT91C_EMAC_ARP [expr 0x1 << 17 ] +set AT91C_EMAC_SA1 [expr 0x1 << 18 ] +set AT91C_EMAC_MTI [expr 0x1 << 19 ] +# -------- EMAC_REV : (EMAC Offset: 0xfc) Revision Register -------- +set AT91C_EMAC_REVREF [expr 0xFFFF << 0 ] +set AT91C_EMAC_PARTREF [expr 0xFFFF << 16 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Analog to Digital Convertor +# ***************************************************************************** +# -------- ADC_CR : (ADC Offset: 0x0) ADC Control Register -------- +set AT91C_ADC_SWRST [expr 0x1 << 0 ] +set AT91C_ADC_START [expr 0x1 << 1 ] +# -------- ADC_MR : (ADC Offset: 0x4) ADC Mode Register -------- +set AT91C_ADC_TRGEN [expr 0x1 << 0 ] +set AT91C_ADC_TRGEN_DIS 0x0 +set AT91C_ADC_TRGEN_EN 0x1 +set AT91C_ADC_TRGSEL [expr 0x7 << 1 ] +set AT91C_ADC_TRGSEL_TIOA0 [expr 0x0 << 1 ] +set AT91C_ADC_TRGSEL_TIOA1 [expr 0x1 << 1 ] +set AT91C_ADC_TRGSEL_TIOA2 [expr 0x2 << 1 ] +set AT91C_ADC_TRGSEL_TIOA3 [expr 0x3 << 1 ] +set AT91C_ADC_TRGSEL_TIOA4 [expr 0x4 << 1 ] +set AT91C_ADC_TRGSEL_TIOA5 [expr 0x5 << 1 ] +set AT91C_ADC_TRGSEL_EXT [expr 0x6 << 1 ] +set AT91C_ADC_LOWRES [expr 0x1 << 4 ] +set AT91C_ADC_LOWRES_10_BIT [expr 0x0 << 4 ] +set AT91C_ADC_LOWRES_8_BIT [expr 0x1 << 4 ] +set AT91C_ADC_SLEEP [expr 0x1 << 5 ] +set AT91C_ADC_SLEEP_NORMAL_MODE [expr 0x0 << 5 ] +set AT91C_ADC_SLEEP_MODE [expr 0x1 << 5 ] +set AT91C_ADC_PRESCAL [expr 0x3F << 8 ] +set AT91C_ADC_STARTUP [expr 0x1F << 16 ] +set AT91C_ADC_SHTIM [expr 0xF << 24 ] +# -------- ADC_CHER : (ADC Offset: 0x10) ADC Channel Enable Register -------- +set AT91C_ADC_CH0 [expr 0x1 << 0 ] +set AT91C_ADC_CH1 [expr 0x1 << 1 ] +set AT91C_ADC_CH2 [expr 0x1 << 2 ] +set AT91C_ADC_CH3 [expr 0x1 << 3 ] +set AT91C_ADC_CH4 [expr 0x1 << 4 ] +set AT91C_ADC_CH5 [expr 0x1 << 5 ] +set AT91C_ADC_CH6 [expr 0x1 << 6 ] +set AT91C_ADC_CH7 [expr 0x1 << 7 ] +# -------- ADC_CHDR : (ADC Offset: 0x14) ADC Channel Disable Register -------- +set AT91C_ADC_CH0 [expr 0x1 << 0 ] +set AT91C_ADC_CH1 [expr 0x1 << 1 ] +set AT91C_ADC_CH2 [expr 0x1 << 2 ] +set AT91C_ADC_CH3 [expr 0x1 << 3 ] +set AT91C_ADC_CH4 [expr 0x1 << 4 ] +set AT91C_ADC_CH5 [expr 0x1 << 5 ] +set AT91C_ADC_CH6 [expr 0x1 << 6 ] +set AT91C_ADC_CH7 [expr 0x1 << 7 ] +# -------- ADC_CHSR : (ADC Offset: 0x18) ADC Channel Status Register -------- +set AT91C_ADC_CH0 [expr 0x1 << 0 ] +set AT91C_ADC_CH1 [expr 0x1 << 1 ] +set AT91C_ADC_CH2 [expr 0x1 << 2 ] +set AT91C_ADC_CH3 [expr 0x1 << 3 ] +set AT91C_ADC_CH4 [expr 0x1 << 4 ] +set AT91C_ADC_CH5 [expr 0x1 << 5 ] +set AT91C_ADC_CH6 [expr 0x1 << 6 ] +set AT91C_ADC_CH7 [expr 0x1 << 7 ] +# -------- ADC_SR : (ADC Offset: 0x1c) ADC Status Register -------- +set AT91C_ADC_EOC0 [expr 0x1 << 0 ] +set AT91C_ADC_EOC1 [expr 0x1 << 1 ] +set AT91C_ADC_EOC2 [expr 0x1 << 2 ] +set AT91C_ADC_EOC3 [expr 0x1 << 3 ] +set AT91C_ADC_EOC4 [expr 0x1 << 4 ] +set AT91C_ADC_EOC5 [expr 0x1 << 5 ] +set AT91C_ADC_EOC6 [expr 0x1 << 6 ] +set AT91C_ADC_EOC7 [expr 0x1 << 7 ] +set AT91C_ADC_OVRE0 [expr 0x1 << 8 ] +set AT91C_ADC_OVRE1 [expr 0x1 << 9 ] +set AT91C_ADC_OVRE2 [expr 0x1 << 10 ] +set AT91C_ADC_OVRE3 [expr 0x1 << 11 ] +set AT91C_ADC_OVRE4 [expr 0x1 << 12 ] +set AT91C_ADC_OVRE5 [expr 0x1 << 13 ] +set AT91C_ADC_OVRE6 [expr 0x1 << 14 ] +set AT91C_ADC_OVRE7 [expr 0x1 << 15 ] +set AT91C_ADC_DRDY [expr 0x1 << 16 ] +set AT91C_ADC_GOVRE [expr 0x1 << 17 ] +set AT91C_ADC_ENDRX [expr 0x1 << 18 ] +set AT91C_ADC_RXBUFF [expr 0x1 << 19 ] +# -------- ADC_LCDR : (ADC Offset: 0x20) ADC Last Converted Data Register -------- +set AT91C_ADC_LDATA [expr 0x3FF << 0 ] +# -------- ADC_IER : (ADC Offset: 0x24) ADC Interrupt Enable Register -------- +set AT91C_ADC_EOC0 [expr 0x1 << 0 ] +set AT91C_ADC_EOC1 [expr 0x1 << 1 ] +set AT91C_ADC_EOC2 [expr 0x1 << 2 ] +set AT91C_ADC_EOC3 [expr 0x1 << 3 ] +set AT91C_ADC_EOC4 [expr 0x1 << 4 ] +set AT91C_ADC_EOC5 [expr 0x1 << 5 ] +set AT91C_ADC_EOC6 [expr 0x1 << 6 ] +set AT91C_ADC_EOC7 [expr 0x1 << 7 ] +set AT91C_ADC_OVRE0 [expr 0x1 << 8 ] +set AT91C_ADC_OVRE1 [expr 0x1 << 9 ] +set AT91C_ADC_OVRE2 [expr 0x1 << 10 ] +set AT91C_ADC_OVRE3 [expr 0x1 << 11 ] +set AT91C_ADC_OVRE4 [expr 0x1 << 12 ] +set AT91C_ADC_OVRE5 [expr 0x1 << 13 ] +set AT91C_ADC_OVRE6 [expr 0x1 << 14 ] +set AT91C_ADC_OVRE7 [expr 0x1 << 15 ] +set AT91C_ADC_DRDY [expr 0x1 << 16 ] +set AT91C_ADC_GOVRE [expr 0x1 << 17 ] +set AT91C_ADC_ENDRX [expr 0x1 << 18 ] +set AT91C_ADC_RXBUFF [expr 0x1 << 19 ] +# -------- ADC_IDR : (ADC Offset: 0x28) ADC Interrupt Disable Register -------- +set AT91C_ADC_EOC0 [expr 0x1 << 0 ] +set AT91C_ADC_EOC1 [expr 0x1 << 1 ] +set AT91C_ADC_EOC2 [expr 0x1 << 2 ] +set AT91C_ADC_EOC3 [expr 0x1 << 3 ] +set AT91C_ADC_EOC4 [expr 0x1 << 4 ] +set AT91C_ADC_EOC5 [expr 0x1 << 5 ] +set AT91C_ADC_EOC6 [expr 0x1 << 6 ] +set AT91C_ADC_EOC7 [expr 0x1 << 7 ] +set AT91C_ADC_OVRE0 [expr 0x1 << 8 ] +set AT91C_ADC_OVRE1 [expr 0x1 << 9 ] +set AT91C_ADC_OVRE2 [expr 0x1 << 10 ] +set AT91C_ADC_OVRE3 [expr 0x1 << 11 ] +set AT91C_ADC_OVRE4 [expr 0x1 << 12 ] +set AT91C_ADC_OVRE5 [expr 0x1 << 13 ] +set AT91C_ADC_OVRE6 [expr 0x1 << 14 ] +set AT91C_ADC_OVRE7 [expr 0x1 << 15 ] +set AT91C_ADC_DRDY [expr 0x1 << 16 ] +set AT91C_ADC_GOVRE [expr 0x1 << 17 ] +set AT91C_ADC_ENDRX [expr 0x1 << 18 ] +set AT91C_ADC_RXBUFF [expr 0x1 << 19 ] +# -------- ADC_IMR : (ADC Offset: 0x2c) ADC Interrupt Mask Register -------- +set AT91C_ADC_EOC0 [expr 0x1 << 0 ] +set AT91C_ADC_EOC1 [expr 0x1 << 1 ] +set AT91C_ADC_EOC2 [expr 0x1 << 2 ] +set AT91C_ADC_EOC3 [expr 0x1 << 3 ] +set AT91C_ADC_EOC4 [expr 0x1 << 4 ] +set AT91C_ADC_EOC5 [expr 0x1 << 5 ] +set AT91C_ADC_EOC6 [expr 0x1 << 6 ] +set AT91C_ADC_EOC7 [expr 0x1 << 7 ] +set AT91C_ADC_OVRE0 [expr 0x1 << 8 ] +set AT91C_ADC_OVRE1 [expr 0x1 << 9 ] +set AT91C_ADC_OVRE2 [expr 0x1 << 10 ] +set AT91C_ADC_OVRE3 [expr 0x1 << 11 ] +set AT91C_ADC_OVRE4 [expr 0x1 << 12 ] +set AT91C_ADC_OVRE5 [expr 0x1 << 13 ] +set AT91C_ADC_OVRE6 [expr 0x1 << 14 ] +set AT91C_ADC_OVRE7 [expr 0x1 << 15 ] +set AT91C_ADC_DRDY [expr 0x1 << 16 ] +set AT91C_ADC_GOVRE [expr 0x1 << 17 ] +set AT91C_ADC_ENDRX [expr 0x1 << 18 ] +set AT91C_ADC_RXBUFF [expr 0x1 << 19 ] +# -------- ADC_CDR0 : (ADC Offset: 0x30) ADC Channel Data Register 0 -------- +set AT91C_ADC_DATA [expr 0x3FF << 0 ] +# -------- ADC_CDR1 : (ADC Offset: 0x34) ADC Channel Data Register 1 -------- +set AT91C_ADC_DATA [expr 0x3FF << 0 ] +# -------- ADC_CDR2 : (ADC Offset: 0x38) ADC Channel Data Register 2 -------- +set AT91C_ADC_DATA [expr 0x3FF << 0 ] +# -------- ADC_CDR3 : (ADC Offset: 0x3c) ADC Channel Data Register 3 -------- +set AT91C_ADC_DATA [expr 0x3FF << 0 ] +# -------- ADC_CDR4 : (ADC Offset: 0x40) ADC Channel Data Register 4 -------- +set AT91C_ADC_DATA [expr 0x3FF << 0 ] +# -------- ADC_CDR5 : (ADC Offset: 0x44) ADC Channel Data Register 5 -------- +set AT91C_ADC_DATA [expr 0x3FF << 0 ] +# -------- ADC_CDR6 : (ADC Offset: 0x48) ADC Channel Data Register 6 -------- +set AT91C_ADC_DATA [expr 0x3FF << 0 ] +# -------- ADC_CDR7 : (ADC Offset: 0x4c) ADC Channel Data Register 7 -------- +set AT91C_ADC_DATA [expr 0x3FF << 0 ] + +# ***************************************************************************** +# REGISTER ADDRESS DEFINITION FOR AT91SAM7X256 +# ***************************************************************************** +# ========== Register definition for SYS peripheral ========== +# ========== Register definition for AIC peripheral ========== +set AT91C_AIC_IVR 0xFFFFF100 +set AT91C_AIC_SMR 0xFFFFF000 +set AT91C_AIC_FVR 0xFFFFF104 +set AT91C_AIC_DCR 0xFFFFF138 +set AT91C_AIC_EOICR 0xFFFFF130 +set AT91C_AIC_SVR 0xFFFFF080 +set AT91C_AIC_FFSR 0xFFFFF148 +set AT91C_AIC_ICCR 0xFFFFF128 +set AT91C_AIC_ISR 0xFFFFF108 +set AT91C_AIC_IMR 0xFFFFF110 +set AT91C_AIC_IPR 0xFFFFF10C +set AT91C_AIC_FFER 0xFFFFF140 +set AT91C_AIC_IECR 0xFFFFF120 +set AT91C_AIC_ISCR 0xFFFFF12C +set AT91C_AIC_FFDR 0xFFFFF144 +set AT91C_AIC_CISR 0xFFFFF114 +set AT91C_AIC_IDCR 0xFFFFF124 +set AT91C_AIC_SPU 0xFFFFF134 +# ========== Register definition for PDC_DBGU peripheral ========== +set AT91C_DBGU_TCR 0xFFFFF30C +set AT91C_DBGU_RNPR 0xFFFFF310 +set AT91C_DBGU_TNPR 0xFFFFF318 +set AT91C_DBGU_TPR 0xFFFFF308 +set AT91C_DBGU_RPR 0xFFFFF300 +set AT91C_DBGU_RCR 0xFFFFF304 +set AT91C_DBGU_RNCR 0xFFFFF314 +set AT91C_DBGU_PTCR 0xFFFFF320 +set AT91C_DBGU_PTSR 0xFFFFF324 +set AT91C_DBGU_TNCR 0xFFFFF31C +# ========== Register definition for DBGU peripheral ========== +set AT91C_DBGU_EXID 0xFFFFF244 +set AT91C_DBGU_BRGR 0xFFFFF220 +set AT91C_DBGU_IDR 0xFFFFF20C +set AT91C_DBGU_CSR 0xFFFFF214 +set AT91C_DBGU_CIDR 0xFFFFF240 +set AT91C_DBGU_MR 0xFFFFF204 +set AT91C_DBGU_IMR 0xFFFFF210 +set AT91C_DBGU_CR 0xFFFFF200 +set AT91C_DBGU_FNTR 0xFFFFF248 +set AT91C_DBGU_THR 0xFFFFF21C +set AT91C_DBGU_RHR 0xFFFFF218 +set AT91C_DBGU_IER 0xFFFFF208 +# ========== Register definition for PIOA peripheral ========== +set AT91C_PIOA_ODR 0xFFFFF414 +set AT91C_PIOA_SODR 0xFFFFF430 +set AT91C_PIOA_ISR 0xFFFFF44C +set AT91C_PIOA_ABSR 0xFFFFF478 +set AT91C_PIOA_IER 0xFFFFF440 +set AT91C_PIOA_PPUDR 0xFFFFF460 +set AT91C_PIOA_IMR 0xFFFFF448 +set AT91C_PIOA_PER 0xFFFFF400 +set AT91C_PIOA_IFDR 0xFFFFF424 +set AT91C_PIOA_OWDR 0xFFFFF4A4 +set AT91C_PIOA_MDSR 0xFFFFF458 +set AT91C_PIOA_IDR 0xFFFFF444 +set AT91C_PIOA_ODSR 0xFFFFF438 +set AT91C_PIOA_PPUSR 0xFFFFF468 +set AT91C_PIOA_OWSR 0xFFFFF4A8 +set AT91C_PIOA_BSR 0xFFFFF474 +set AT91C_PIOA_OWER 0xFFFFF4A0 +set AT91C_PIOA_IFER 0xFFFFF420 +set AT91C_PIOA_PDSR 0xFFFFF43C +set AT91C_PIOA_PPUER 0xFFFFF464 +set AT91C_PIOA_OSR 0xFFFFF418 +set AT91C_PIOA_ASR 0xFFFFF470 +set AT91C_PIOA_MDDR 0xFFFFF454 +set AT91C_PIOA_CODR 0xFFFFF434 +set AT91C_PIOA_MDER 0xFFFFF450 +set AT91C_PIOA_PDR 0xFFFFF404 +set AT91C_PIOA_IFSR 0xFFFFF428 +set AT91C_PIOA_OER 0xFFFFF410 +set AT91C_PIOA_PSR 0xFFFFF408 +# ========== Register definition for PIOB peripheral ========== +set AT91C_PIOB_OWDR 0xFFFFF6A4 +set AT91C_PIOB_MDER 0xFFFFF650 +set AT91C_PIOB_PPUSR 0xFFFFF668 +set AT91C_PIOB_IMR 0xFFFFF648 +set AT91C_PIOB_ASR 0xFFFFF670 +set AT91C_PIOB_PPUDR 0xFFFFF660 +set AT91C_PIOB_PSR 0xFFFFF608 +set AT91C_PIOB_IER 0xFFFFF640 +set AT91C_PIOB_CODR 0xFFFFF634 +set AT91C_PIOB_OWER 0xFFFFF6A0 +set AT91C_PIOB_ABSR 0xFFFFF678 +set AT91C_PIOB_IFDR 0xFFFFF624 +set AT91C_PIOB_PDSR 0xFFFFF63C +set AT91C_PIOB_IDR 0xFFFFF644 +set AT91C_PIOB_OWSR 0xFFFFF6A8 +set AT91C_PIOB_PDR 0xFFFFF604 +set AT91C_PIOB_ODR 0xFFFFF614 +set AT91C_PIOB_IFSR 0xFFFFF628 +set AT91C_PIOB_PPUER 0xFFFFF664 +set AT91C_PIOB_SODR 0xFFFFF630 +set AT91C_PIOB_ISR 0xFFFFF64C +set AT91C_PIOB_ODSR 0xFFFFF638 +set AT91C_PIOB_OSR 0xFFFFF618 +set AT91C_PIOB_MDSR 0xFFFFF658 +set AT91C_PIOB_IFER 0xFFFFF620 +set AT91C_PIOB_BSR 0xFFFFF674 +set AT91C_PIOB_MDDR 0xFFFFF654 +set AT91C_PIOB_OER 0xFFFFF610 +set AT91C_PIOB_PER 0xFFFFF600 +# ========== Register definition for CKGR peripheral ========== +set AT91C_CKGR_MOR 0xFFFFFC20 +set AT91C_CKGR_PLLR 0xFFFFFC2C +set AT91C_CKGR_MCFR 0xFFFFFC24 +# ========== Register definition for PMC peripheral ========== +set AT91C_PMC_IDR 0xFFFFFC64 +set AT91C_PMC_MOR 0xFFFFFC20 +set AT91C_PMC_PLLR 0xFFFFFC2C +set AT91C_PMC_PCER 0xFFFFFC10 +set AT91C_PMC_PCKR 0xFFFFFC40 +set AT91C_PMC_MCKR 0xFFFFFC30 +set AT91C_PMC_SCDR 0xFFFFFC04 +set AT91C_PMC_PCDR 0xFFFFFC14 +set AT91C_PMC_SCSR 0xFFFFFC08 +set AT91C_PMC_PCSR 0xFFFFFC18 +set AT91C_PMC_MCFR 0xFFFFFC24 +set AT91C_PMC_SCER 0xFFFFFC00 +set AT91C_PMC_IMR 0xFFFFFC6C +set AT91C_PMC_IER 0xFFFFFC60 +set AT91C_PMC_SR 0xFFFFFC68 +# ========== Register definition for RSTC peripheral ========== +set AT91C_RSTC_RCR 0xFFFFFD00 +set AT91C_RSTC_RMR 0xFFFFFD08 +set AT91C_RSTC_RSR 0xFFFFFD04 +# ========== Register definition for RTTC peripheral ========== +set AT91C_RTTC_RTSR 0xFFFFFD2C +set AT91C_RTTC_RTMR 0xFFFFFD20 +set AT91C_RTTC_RTVR 0xFFFFFD28 +set AT91C_RTTC_RTAR 0xFFFFFD24 +# ========== Register definition for PITC peripheral ========== +set AT91C_PITC_PIVR 0xFFFFFD38 +set AT91C_PITC_PISR 0xFFFFFD34 +set AT91C_PITC_PIIR 0xFFFFFD3C +set AT91C_PITC_PIMR 0xFFFFFD30 +# ========== Register definition for WDTC peripheral ========== +set AT91C_WDTC_WDCR 0xFFFFFD40 +set AT91C_WDTC_WDSR 0xFFFFFD48 +set AT91C_WDTC_WDMR 0xFFFFFD44 +# ========== Register definition for VREG peripheral ========== +set AT91C_VREG_MR 0xFFFFFD60 +# ========== Register definition for MC peripheral ========== +set AT91C_MC_ASR 0xFFFFFF04 +set AT91C_MC_RCR 0xFFFFFF00 +set AT91C_MC_FCR 0xFFFFFF64 +set AT91C_MC_AASR 0xFFFFFF08 +set AT91C_MC_FSR 0xFFFFFF68 +set AT91C_MC_FMR 0xFFFFFF60 +# ========== Register definition for PDC_SPI1 peripheral ========== +set AT91C_SPI1_PTCR 0xFFFE4120 +set AT91C_SPI1_RPR 0xFFFE4100 +set AT91C_SPI1_TNCR 0xFFFE411C +set AT91C_SPI1_TPR 0xFFFE4108 +set AT91C_SPI1_TNPR 0xFFFE4118 +set AT91C_SPI1_TCR 0xFFFE410C +set AT91C_SPI1_RCR 0xFFFE4104 +set AT91C_SPI1_RNPR 0xFFFE4110 +set AT91C_SPI1_RNCR 0xFFFE4114 +set AT91C_SPI1_PTSR 0xFFFE4124 +# ========== Register definition for SPI1 peripheral ========== +set AT91C_SPI1_IMR 0xFFFE401C +set AT91C_SPI1_IER 0xFFFE4014 +set AT91C_SPI1_MR 0xFFFE4004 +set AT91C_SPI1_RDR 0xFFFE4008 +set AT91C_SPI1_IDR 0xFFFE4018 +set AT91C_SPI1_SR 0xFFFE4010 +set AT91C_SPI1_TDR 0xFFFE400C +set AT91C_SPI1_CR 0xFFFE4000 +set AT91C_SPI1_CSR 0xFFFE4030 +# ========== Register definition for PDC_SPI0 peripheral ========== +set AT91C_SPI0_PTCR 0xFFFE0120 +set AT91C_SPI0_TPR 0xFFFE0108 +set AT91C_SPI0_TCR 0xFFFE010C +set AT91C_SPI0_RCR 0xFFFE0104 +set AT91C_SPI0_PTSR 0xFFFE0124 +set AT91C_SPI0_RNPR 0xFFFE0110 +set AT91C_SPI0_RPR 0xFFFE0100 +set AT91C_SPI0_TNCR 0xFFFE011C +set AT91C_SPI0_RNCR 0xFFFE0114 +set AT91C_SPI0_TNPR 0xFFFE0118 +# ========== Register definition for SPI0 peripheral ========== +set AT91C_SPI0_IER 0xFFFE0014 +set AT91C_SPI0_SR 0xFFFE0010 +set AT91C_SPI0_IDR 0xFFFE0018 +set AT91C_SPI0_CR 0xFFFE0000 +set AT91C_SPI0_MR 0xFFFE0004 +set AT91C_SPI0_IMR 0xFFFE001C +set AT91C_SPI0_TDR 0xFFFE000C +set AT91C_SPI0_RDR 0xFFFE0008 +set AT91C_SPI0_CSR 0xFFFE0030 +# ========== Register definition for PDC_US1 peripheral ========== +set AT91C_US1_RNCR 0xFFFC4114 +set AT91C_US1_PTCR 0xFFFC4120 +set AT91C_US1_TCR 0xFFFC410C +set AT91C_US1_PTSR 0xFFFC4124 +set AT91C_US1_TNPR 0xFFFC4118 +set AT91C_US1_RCR 0xFFFC4104 +set AT91C_US1_RNPR 0xFFFC4110 +set AT91C_US1_RPR 0xFFFC4100 +set AT91C_US1_TNCR 0xFFFC411C +set AT91C_US1_TPR 0xFFFC4108 +# ========== Register definition for US1 peripheral ========== +set AT91C_US1_IF 0xFFFC404C +set AT91C_US1_NER 0xFFFC4044 +set AT91C_US1_RTOR 0xFFFC4024 +set AT91C_US1_CSR 0xFFFC4014 +set AT91C_US1_IDR 0xFFFC400C +set AT91C_US1_IER 0xFFFC4008 +set AT91C_US1_THR 0xFFFC401C +set AT91C_US1_TTGR 0xFFFC4028 +set AT91C_US1_RHR 0xFFFC4018 +set AT91C_US1_BRGR 0xFFFC4020 +set AT91C_US1_IMR 0xFFFC4010 +set AT91C_US1_FIDI 0xFFFC4040 +set AT91C_US1_CR 0xFFFC4000 +set AT91C_US1_MR 0xFFFC4004 +# ========== Register definition for PDC_US0 peripheral ========== +set AT91C_US0_TNPR 0xFFFC0118 +set AT91C_US0_RNPR 0xFFFC0110 +set AT91C_US0_TCR 0xFFFC010C +set AT91C_US0_PTCR 0xFFFC0120 +set AT91C_US0_PTSR 0xFFFC0124 +set AT91C_US0_TNCR 0xFFFC011C +set AT91C_US0_TPR 0xFFFC0108 +set AT91C_US0_RCR 0xFFFC0104 +set AT91C_US0_RPR 0xFFFC0100 +set AT91C_US0_RNCR 0xFFFC0114 +# ========== Register definition for US0 peripheral ========== +set AT91C_US0_BRGR 0xFFFC0020 +set AT91C_US0_NER 0xFFFC0044 +set AT91C_US0_CR 0xFFFC0000 +set AT91C_US0_IMR 0xFFFC0010 +set AT91C_US0_FIDI 0xFFFC0040 +set AT91C_US0_TTGR 0xFFFC0028 +set AT91C_US0_MR 0xFFFC0004 +set AT91C_US0_RTOR 0xFFFC0024 +set AT91C_US0_CSR 0xFFFC0014 +set AT91C_US0_RHR 0xFFFC0018 +set AT91C_US0_IDR 0xFFFC000C +set AT91C_US0_THR 0xFFFC001C +set AT91C_US0_IF 0xFFFC004C +set AT91C_US0_IER 0xFFFC0008 +# ========== Register definition for PDC_SSC peripheral ========== +set AT91C_SSC_TNCR 0xFFFD411C +set AT91C_SSC_RPR 0xFFFD4100 +set AT91C_SSC_RNCR 0xFFFD4114 +set AT91C_SSC_TPR 0xFFFD4108 +set AT91C_SSC_PTCR 0xFFFD4120 +set AT91C_SSC_TCR 0xFFFD410C +set AT91C_SSC_RCR 0xFFFD4104 +set AT91C_SSC_RNPR 0xFFFD4110 +set AT91C_SSC_TNPR 0xFFFD4118 +set AT91C_SSC_PTSR 0xFFFD4124 +# ========== Register definition for SSC peripheral ========== +set AT91C_SSC_RHR 0xFFFD4020 +set AT91C_SSC_RSHR 0xFFFD4030 +set AT91C_SSC_TFMR 0xFFFD401C +set AT91C_SSC_IDR 0xFFFD4048 +set AT91C_SSC_THR 0xFFFD4024 +set AT91C_SSC_RCMR 0xFFFD4010 +set AT91C_SSC_IER 0xFFFD4044 +set AT91C_SSC_TSHR 0xFFFD4034 +set AT91C_SSC_SR 0xFFFD4040 +set AT91C_SSC_CMR 0xFFFD4004 +set AT91C_SSC_TCMR 0xFFFD4018 +set AT91C_SSC_CR 0xFFFD4000 +set AT91C_SSC_IMR 0xFFFD404C +set AT91C_SSC_RFMR 0xFFFD4014 +# ========== Register definition for TWI peripheral ========== +set AT91C_TWI_IER 0xFFFB8024 +set AT91C_TWI_CR 0xFFFB8000 +set AT91C_TWI_SR 0xFFFB8020 +set AT91C_TWI_IMR 0xFFFB802C +set AT91C_TWI_THR 0xFFFB8034 +set AT91C_TWI_IDR 0xFFFB8028 +set AT91C_TWI_IADR 0xFFFB800C +set AT91C_TWI_MMR 0xFFFB8004 +set AT91C_TWI_CWGR 0xFFFB8010 +set AT91C_TWI_RHR 0xFFFB8030 +# ========== Register definition for PWMC_CH3 peripheral ========== +set AT91C_PWMC_CH3_CUPDR 0xFFFCC270 +set AT91C_PWMC_CH3_Reserved 0xFFFCC274 +set AT91C_PWMC_CH3_CPRDR 0xFFFCC268 +set AT91C_PWMC_CH3_CDTYR 0xFFFCC264 +set AT91C_PWMC_CH3_CCNTR 0xFFFCC26C +set AT91C_PWMC_CH3_CMR 0xFFFCC260 +# ========== Register definition for PWMC_CH2 peripheral ========== +set AT91C_PWMC_CH2_Reserved 0xFFFCC254 +set AT91C_PWMC_CH2_CMR 0xFFFCC240 +set AT91C_PWMC_CH2_CCNTR 0xFFFCC24C +set AT91C_PWMC_CH2_CPRDR 0xFFFCC248 +set AT91C_PWMC_CH2_CUPDR 0xFFFCC250 +set AT91C_PWMC_CH2_CDTYR 0xFFFCC244 +# ========== Register definition for PWMC_CH1 peripheral ========== +set AT91C_PWMC_CH1_Reserved 0xFFFCC234 +set AT91C_PWMC_CH1_CUPDR 0xFFFCC230 +set AT91C_PWMC_CH1_CPRDR 0xFFFCC228 +set AT91C_PWMC_CH1_CCNTR 0xFFFCC22C +set AT91C_PWMC_CH1_CDTYR 0xFFFCC224 +set AT91C_PWMC_CH1_CMR 0xFFFCC220 +# ========== Register definition for PWMC_CH0 peripheral ========== +set AT91C_PWMC_CH0_Reserved 0xFFFCC214 +set AT91C_PWMC_CH0_CPRDR 0xFFFCC208 +set AT91C_PWMC_CH0_CDTYR 0xFFFCC204 +set AT91C_PWMC_CH0_CMR 0xFFFCC200 +set AT91C_PWMC_CH0_CUPDR 0xFFFCC210 +set AT91C_PWMC_CH0_CCNTR 0xFFFCC20C +# ========== Register definition for PWMC peripheral ========== +set AT91C_PWMC_IDR 0xFFFCC014 +set AT91C_PWMC_DIS 0xFFFCC008 +set AT91C_PWMC_IER 0xFFFCC010 +set AT91C_PWMC_VR 0xFFFCC0FC +set AT91C_PWMC_ISR 0xFFFCC01C +set AT91C_PWMC_SR 0xFFFCC00C +set AT91C_PWMC_IMR 0xFFFCC018 +set AT91C_PWMC_MR 0xFFFCC000 +set AT91C_PWMC_ENA 0xFFFCC004 +# ========== Register definition for UDP peripheral ========== +set AT91C_UDP_IMR 0xFFFB0018 +set AT91C_UDP_FADDR 0xFFFB0008 +set AT91C_UDP_NUM 0xFFFB0000 +set AT91C_UDP_FDR 0xFFFB0050 +set AT91C_UDP_ISR 0xFFFB001C +set AT91C_UDP_CSR 0xFFFB0030 +set AT91C_UDP_IDR 0xFFFB0014 +set AT91C_UDP_ICR 0xFFFB0020 +set AT91C_UDP_RSTEP 0xFFFB0028 +set AT91C_UDP_TXVC 0xFFFB0074 +set AT91C_UDP_GLBSTATE 0xFFFB0004 +set AT91C_UDP_IER 0xFFFB0010 +# ========== Register definition for TC0 peripheral ========== +set AT91C_TC0_SR 0xFFFA0020 +set AT91C_TC0_RC 0xFFFA001C +set AT91C_TC0_RB 0xFFFA0018 +set AT91C_TC0_CCR 0xFFFA0000 +set AT91C_TC0_CMR 0xFFFA0004 +set AT91C_TC0_IER 0xFFFA0024 +set AT91C_TC0_RA 0xFFFA0014 +set AT91C_TC0_IDR 0xFFFA0028 +set AT91C_TC0_CV 0xFFFA0010 +set AT91C_TC0_IMR 0xFFFA002C +# ========== Register definition for TC1 peripheral ========== +set AT91C_TC1_RB 0xFFFA0058 +set AT91C_TC1_CCR 0xFFFA0040 +set AT91C_TC1_IER 0xFFFA0064 +set AT91C_TC1_IDR 0xFFFA0068 +set AT91C_TC1_SR 0xFFFA0060 +set AT91C_TC1_CMR 0xFFFA0044 +set AT91C_TC1_RA 0xFFFA0054 +set AT91C_TC1_RC 0xFFFA005C +set AT91C_TC1_IMR 0xFFFA006C +set AT91C_TC1_CV 0xFFFA0050 +# ========== Register definition for TC2 peripheral ========== +set AT91C_TC2_CMR 0xFFFA0084 +set AT91C_TC2_CCR 0xFFFA0080 +set AT91C_TC2_CV 0xFFFA0090 +set AT91C_TC2_RA 0xFFFA0094 +set AT91C_TC2_RB 0xFFFA0098 +set AT91C_TC2_IDR 0xFFFA00A8 +set AT91C_TC2_IMR 0xFFFA00AC +set AT91C_TC2_RC 0xFFFA009C +set AT91C_TC2_IER 0xFFFA00A4 +set AT91C_TC2_SR 0xFFFA00A0 +# ========== Register definition for TCB peripheral ========== +set AT91C_TCB_BMR 0xFFFA00C4 +set AT91C_TCB_BCR 0xFFFA00C0 +# ========== Register definition for CAN_MB0 peripheral ========== +set AT91C_CAN_MB0_MDL 0xFFFD0214 +set AT91C_CAN_MB0_MAM 0xFFFD0204 +set AT91C_CAN_MB0_MCR 0xFFFD021C +set AT91C_CAN_MB0_MID 0xFFFD0208 +set AT91C_CAN_MB0_MSR 0xFFFD0210 +set AT91C_CAN_MB0_MFID 0xFFFD020C +set AT91C_CAN_MB0_MDH 0xFFFD0218 +set AT91C_CAN_MB0_MMR 0xFFFD0200 +# ========== Register definition for CAN_MB1 peripheral ========== +set AT91C_CAN_MB1_MDL 0xFFFD0234 +set AT91C_CAN_MB1_MID 0xFFFD0228 +set AT91C_CAN_MB1_MMR 0xFFFD0220 +set AT91C_CAN_MB1_MSR 0xFFFD0230 +set AT91C_CAN_MB1_MAM 0xFFFD0224 +set AT91C_CAN_MB1_MDH 0xFFFD0238 +set AT91C_CAN_MB1_MCR 0xFFFD023C +set AT91C_CAN_MB1_MFID 0xFFFD022C +# ========== Register definition for CAN_MB2 peripheral ========== +set AT91C_CAN_MB2_MCR 0xFFFD025C +set AT91C_CAN_MB2_MDH 0xFFFD0258 +set AT91C_CAN_MB2_MID 0xFFFD0248 +set AT91C_CAN_MB2_MDL 0xFFFD0254 +set AT91C_CAN_MB2_MMR 0xFFFD0240 +set AT91C_CAN_MB2_MAM 0xFFFD0244 +set AT91C_CAN_MB2_MFID 0xFFFD024C +set AT91C_CAN_MB2_MSR 0xFFFD0250 +# ========== Register definition for CAN_MB3 peripheral ========== +set AT91C_CAN_MB3_MFID 0xFFFD026C +set AT91C_CAN_MB3_MAM 0xFFFD0264 +set AT91C_CAN_MB3_MID 0xFFFD0268 +set AT91C_CAN_MB3_MCR 0xFFFD027C +set AT91C_CAN_MB3_MMR 0xFFFD0260 +set AT91C_CAN_MB3_MSR 0xFFFD0270 +set AT91C_CAN_MB3_MDL 0xFFFD0274 +set AT91C_CAN_MB3_MDH 0xFFFD0278 +# ========== Register definition for CAN_MB4 peripheral ========== +set AT91C_CAN_MB4_MID 0xFFFD0288 +set AT91C_CAN_MB4_MMR 0xFFFD0280 +set AT91C_CAN_MB4_MDH 0xFFFD0298 +set AT91C_CAN_MB4_MFID 0xFFFD028C +set AT91C_CAN_MB4_MSR 0xFFFD0290 +set AT91C_CAN_MB4_MCR 0xFFFD029C +set AT91C_CAN_MB4_MDL 0xFFFD0294 +set AT91C_CAN_MB4_MAM 0xFFFD0284 +# ========== Register definition for CAN_MB5 peripheral ========== +set AT91C_CAN_MB5_MSR 0xFFFD02B0 +set AT91C_CAN_MB5_MCR 0xFFFD02BC +set AT91C_CAN_MB5_MFID 0xFFFD02AC +set AT91C_CAN_MB5_MDH 0xFFFD02B8 +set AT91C_CAN_MB5_MID 0xFFFD02A8 +set AT91C_CAN_MB5_MMR 0xFFFD02A0 +set AT91C_CAN_MB5_MDL 0xFFFD02B4 +set AT91C_CAN_MB5_MAM 0xFFFD02A4 +# ========== Register definition for CAN_MB6 peripheral ========== +set AT91C_CAN_MB6_MFID 0xFFFD02CC +set AT91C_CAN_MB6_MID 0xFFFD02C8 +set AT91C_CAN_MB6_MAM 0xFFFD02C4 +set AT91C_CAN_MB6_MSR 0xFFFD02D0 +set AT91C_CAN_MB6_MDL 0xFFFD02D4 +set AT91C_CAN_MB6_MCR 0xFFFD02DC +set AT91C_CAN_MB6_MDH 0xFFFD02D8 +set AT91C_CAN_MB6_MMR 0xFFFD02C0 +# ========== Register definition for CAN_MB7 peripheral ========== +set AT91C_CAN_MB7_MCR 0xFFFD02FC +set AT91C_CAN_MB7_MDH 0xFFFD02F8 +set AT91C_CAN_MB7_MFID 0xFFFD02EC +set AT91C_CAN_MB7_MDL 0xFFFD02F4 +set AT91C_CAN_MB7_MID 0xFFFD02E8 +set AT91C_CAN_MB7_MMR 0xFFFD02E0 +set AT91C_CAN_MB7_MAM 0xFFFD02E4 +set AT91C_CAN_MB7_MSR 0xFFFD02F0 +# ========== Register definition for CAN peripheral ========== +set AT91C_CAN_TCR 0xFFFD0024 +set AT91C_CAN_IMR 0xFFFD000C +set AT91C_CAN_IER 0xFFFD0004 +set AT91C_CAN_ECR 0xFFFD0020 +set AT91C_CAN_TIMESTP 0xFFFD001C +set AT91C_CAN_MR 0xFFFD0000 +set AT91C_CAN_IDR 0xFFFD0008 +set AT91C_CAN_ACR 0xFFFD0028 +set AT91C_CAN_TIM 0xFFFD0018 +set AT91C_CAN_SR 0xFFFD0010 +set AT91C_CAN_BR 0xFFFD0014 +set AT91C_CAN_VR 0xFFFD00FC +# ========== Register definition for EMAC peripheral ========== +set AT91C_EMAC_ISR 0xFFFDC024 +set AT91C_EMAC_SA4H 0xFFFDC0B4 +set AT91C_EMAC_SA1L 0xFFFDC098 +set AT91C_EMAC_ELE 0xFFFDC078 +set AT91C_EMAC_LCOL 0xFFFDC05C +set AT91C_EMAC_RLE 0xFFFDC088 +set AT91C_EMAC_WOL 0xFFFDC0C4 +set AT91C_EMAC_DTF 0xFFFDC058 +set AT91C_EMAC_TUND 0xFFFDC064 +set AT91C_EMAC_NCR 0xFFFDC000 +set AT91C_EMAC_SA4L 0xFFFDC0B0 +set AT91C_EMAC_RSR 0xFFFDC020 +set AT91C_EMAC_SA3L 0xFFFDC0A8 +set AT91C_EMAC_TSR 0xFFFDC014 +set AT91C_EMAC_IDR 0xFFFDC02C +set AT91C_EMAC_RSE 0xFFFDC074 +set AT91C_EMAC_ECOL 0xFFFDC060 +set AT91C_EMAC_TID 0xFFFDC0B8 +set AT91C_EMAC_HRB 0xFFFDC090 +set AT91C_EMAC_TBQP 0xFFFDC01C +set AT91C_EMAC_USRIO 0xFFFDC0C0 +set AT91C_EMAC_PTR 0xFFFDC038 +set AT91C_EMAC_SA2H 0xFFFDC0A4 +set AT91C_EMAC_ROV 0xFFFDC070 +set AT91C_EMAC_ALE 0xFFFDC054 +set AT91C_EMAC_RJA 0xFFFDC07C +set AT91C_EMAC_RBQP 0xFFFDC018 +set AT91C_EMAC_TPF 0xFFFDC08C +set AT91C_EMAC_NCFGR 0xFFFDC004 +set AT91C_EMAC_HRT 0xFFFDC094 +set AT91C_EMAC_USF 0xFFFDC080 +set AT91C_EMAC_FCSE 0xFFFDC050 +set AT91C_EMAC_TPQ 0xFFFDC0BC +set AT91C_EMAC_MAN 0xFFFDC034 +set AT91C_EMAC_FTO 0xFFFDC040 +set AT91C_EMAC_REV 0xFFFDC0FC +set AT91C_EMAC_IMR 0xFFFDC030 +set AT91C_EMAC_SCF 0xFFFDC044 +set AT91C_EMAC_PFR 0xFFFDC03C +set AT91C_EMAC_MCF 0xFFFDC048 +set AT91C_EMAC_NSR 0xFFFDC008 +set AT91C_EMAC_SA2L 0xFFFDC0A0 +set AT91C_EMAC_FRO 0xFFFDC04C +set AT91C_EMAC_IER 0xFFFDC028 +set AT91C_EMAC_SA1H 0xFFFDC09C +set AT91C_EMAC_CSE 0xFFFDC068 +set AT91C_EMAC_SA3H 0xFFFDC0AC +set AT91C_EMAC_RRE 0xFFFDC06C +set AT91C_EMAC_STE 0xFFFDC084 +# ========== Register definition for PDC_ADC peripheral ========== +set AT91C_ADC_PTSR 0xFFFD8124 +set AT91C_ADC_PTCR 0xFFFD8120 +set AT91C_ADC_TNPR 0xFFFD8118 +set AT91C_ADC_TNCR 0xFFFD811C +set AT91C_ADC_RNPR 0xFFFD8110 +set AT91C_ADC_RNCR 0xFFFD8114 +set AT91C_ADC_RPR 0xFFFD8100 +set AT91C_ADC_TCR 0xFFFD810C +set AT91C_ADC_TPR 0xFFFD8108 +set AT91C_ADC_RCR 0xFFFD8104 +# ========== Register definition for ADC peripheral ========== +set AT91C_ADC_CDR2 0xFFFD8038 +set AT91C_ADC_CDR3 0xFFFD803C +set AT91C_ADC_CDR0 0xFFFD8030 +set AT91C_ADC_CDR5 0xFFFD8044 +set AT91C_ADC_CHDR 0xFFFD8014 +set AT91C_ADC_SR 0xFFFD801C +set AT91C_ADC_CDR4 0xFFFD8040 +set AT91C_ADC_CDR1 0xFFFD8034 +set AT91C_ADC_LCDR 0xFFFD8020 +set AT91C_ADC_IDR 0xFFFD8028 +set AT91C_ADC_CR 0xFFFD8000 +set AT91C_ADC_CDR7 0xFFFD804C +set AT91C_ADC_CDR6 0xFFFD8048 +set AT91C_ADC_IER 0xFFFD8024 +set AT91C_ADC_CHER 0xFFFD8010 +set AT91C_ADC_CHSR 0xFFFD8018 +set AT91C_ADC_MR 0xFFFD8004 +set AT91C_ADC_IMR 0xFFFD802C + +# ***************************************************************************** +# BASE ADDRESS DEFINITIONS FOR AT91SAM7X256 +# ***************************************************************************** +set AT91C_BASE_SYS 0xFFFFF000 +set AT91C_BASE_AIC 0xFFFFF000 +set AT91C_BASE_PDC_DBGU 0xFFFFF300 +set AT91C_BASE_DBGU 0xFFFFF200 +set AT91C_BASE_PIOA 0xFFFFF400 +set AT91C_BASE_PIOB 0xFFFFF600 +set AT91C_BASE_CKGR 0xFFFFFC20 +set AT91C_BASE_PMC 0xFFFFFC00 +set AT91C_BASE_RSTC 0xFFFFFD00 +set AT91C_BASE_RTTC 0xFFFFFD20 +set AT91C_BASE_PITC 0xFFFFFD30 +set AT91C_BASE_WDTC 0xFFFFFD40 +set AT91C_BASE_VREG 0xFFFFFD60 +set AT91C_BASE_MC 0xFFFFFF00 +set AT91C_BASE_PDC_SPI1 0xFFFE4100 +set AT91C_BASE_SPI1 0xFFFE4000 +set AT91C_BASE_PDC_SPI0 0xFFFE0100 +set AT91C_BASE_SPI0 0xFFFE0000 +set AT91C_BASE_PDC_US1 0xFFFC4100 +set AT91C_BASE_US1 0xFFFC4000 +set AT91C_BASE_PDC_US0 0xFFFC0100 +set AT91C_BASE_US0 0xFFFC0000 +set AT91C_BASE_PDC_SSC 0xFFFD4100 +set AT91C_BASE_SSC 0xFFFD4000 +set AT91C_BASE_TWI 0xFFFB8000 +set AT91C_BASE_PWMC_CH3 0xFFFCC260 +set AT91C_BASE_PWMC_CH2 0xFFFCC240 +set AT91C_BASE_PWMC_CH1 0xFFFCC220 +set AT91C_BASE_PWMC_CH0 0xFFFCC200 +set AT91C_BASE_PWMC 0xFFFCC000 +set AT91C_BASE_UDP 0xFFFB0000 +set AT91C_BASE_TC0 0xFFFA0000 +set AT91C_BASE_TC1 0xFFFA0040 +set AT91C_BASE_TC2 0xFFFA0080 +set AT91C_BASE_TCB 0xFFFA0000 +set AT91C_BASE_CAN_MB0 0xFFFD0200 +set AT91C_BASE_CAN_MB1 0xFFFD0220 +set AT91C_BASE_CAN_MB2 0xFFFD0240 +set AT91C_BASE_CAN_MB3 0xFFFD0260 +set AT91C_BASE_CAN_MB4 0xFFFD0280 +set AT91C_BASE_CAN_MB5 0xFFFD02A0 +set AT91C_BASE_CAN_MB6 0xFFFD02C0 +set AT91C_BASE_CAN_MB7 0xFFFD02E0 +set AT91C_BASE_CAN 0xFFFD0000 +set AT91C_BASE_EMAC 0xFFFDC000 +set AT91C_BASE_PDC_ADC 0xFFFD8100 +set AT91C_BASE_ADC 0xFFFD8000 + +# ***************************************************************************** +# PERIPHERAL ID DEFINITIONS FOR AT91SAM7X256 +# ***************************************************************************** +set AT91C_ID_FIQ 0 +set AT91C_ID_SYS 1 +set AT91C_ID_PIOA 2 +set AT91C_ID_PIOB 3 +set AT91C_ID_SPI0 4 +set AT91C_ID_SPI1 5 +set AT91C_ID_US0 6 +set AT91C_ID_US1 7 +set AT91C_ID_SSC 8 +set AT91C_ID_TWI 9 +set AT91C_ID_PWMC 10 +set AT91C_ID_UDP 11 +set AT91C_ID_TC0 12 +set AT91C_ID_TC1 13 +set AT91C_ID_TC2 14 +set AT91C_ID_CAN 15 +set AT91C_ID_EMAC 16 +set AT91C_ID_ADC 17 +set AT91C_ID_18_Reserved 18 +set AT91C_ID_19_Reserved 19 +set AT91C_ID_20_Reserved 20 +set AT91C_ID_21_Reserved 21 +set AT91C_ID_22_Reserved 22 +set AT91C_ID_23_Reserved 23 +set AT91C_ID_24_Reserved 24 +set AT91C_ID_25_Reserved 25 +set AT91C_ID_26_Reserved 26 +set AT91C_ID_27_Reserved 27 +set AT91C_ID_28_Reserved 28 +set AT91C_ID_29_Reserved 29 +set AT91C_ID_IRQ0 30 +set AT91C_ID_IRQ1 31 + +# ***************************************************************************** +# PIO DEFINITIONS FOR AT91SAM7X256 +# ***************************************************************************** +set AT91C_PIO_PA0 [expr 1 << 0 ] +set AT91C_PA0_RXD0 $AT91C_PIO_PA0 +set AT91C_PIO_PA1 [expr 1 << 1 ] +set AT91C_PA1_TXD0 $AT91C_PIO_PA1 +set AT91C_PIO_PA10 [expr 1 << 10 ] +set AT91C_PA10_TWD $AT91C_PIO_PA10 +set AT91C_PIO_PA11 [expr 1 << 11 ] +set AT91C_PA11_TWCK $AT91C_PIO_PA11 +set AT91C_PIO_PA12 [expr 1 << 12 ] +set AT91C_PA12_SPI0_NPCS0 $AT91C_PIO_PA12 +set AT91C_PIO_PA13 [expr 1 << 13 ] +set AT91C_PA13_SPI0_NPCS1 $AT91C_PIO_PA13 +set AT91C_PA13_PCK1 $AT91C_PIO_PA13 +set AT91C_PIO_PA14 [expr 1 << 14 ] +set AT91C_PA14_SPI0_NPCS2 $AT91C_PIO_PA14 +set AT91C_PA14_IRQ1 $AT91C_PIO_PA14 +set AT91C_PIO_PA15 [expr 1 << 15 ] +set AT91C_PA15_SPI0_NPCS3 $AT91C_PIO_PA15 +set AT91C_PA15_TCLK2 $AT91C_PIO_PA15 +set AT91C_PIO_PA16 [expr 1 << 16 ] +set AT91C_PA16_SPI0_MISO $AT91C_PIO_PA16 +set AT91C_PIO_PA17 [expr 1 << 17 ] +set AT91C_PA17_SPI0_MOSI $AT91C_PIO_PA17 +set AT91C_PIO_PA18 [expr 1 << 18 ] +set AT91C_PA18_SPI0_SPCK $AT91C_PIO_PA18 +set AT91C_PIO_PA19 [expr 1 << 19 ] +set AT91C_PA19_CANRX $AT91C_PIO_PA19 +set AT91C_PIO_PA2 [expr 1 << 2 ] +set AT91C_PA2_SCK0 $AT91C_PIO_PA2 +set AT91C_PA2_SPI1_NPCS1 $AT91C_PIO_PA2 +set AT91C_PIO_PA20 [expr 1 << 20 ] +set AT91C_PA20_CANTX $AT91C_PIO_PA20 +set AT91C_PIO_PA21 [expr 1 << 21 ] +set AT91C_PA21_TF $AT91C_PIO_PA21 +set AT91C_PA21_SPI1_NPCS0 $AT91C_PIO_PA21 +set AT91C_PIO_PA22 [expr 1 << 22 ] +set AT91C_PA22_TK $AT91C_PIO_PA22 +set AT91C_PA22_SPI1_SPCK $AT91C_PIO_PA22 +set AT91C_PIO_PA23 [expr 1 << 23 ] +set AT91C_PA23_TD $AT91C_PIO_PA23 +set AT91C_PA23_SPI1_MOSI $AT91C_PIO_PA23 +set AT91C_PIO_PA24 [expr 1 << 24 ] +set AT91C_PA24_RD $AT91C_PIO_PA24 +set AT91C_PA24_SPI1_MISO $AT91C_PIO_PA24 +set AT91C_PIO_PA25 [expr 1 << 25 ] +set AT91C_PA25_RK $AT91C_PIO_PA25 +set AT91C_PA25_SPI1_NPCS1 $AT91C_PIO_PA25 +set AT91C_PIO_PA26 [expr 1 << 26 ] +set AT91C_PA26_RF $AT91C_PIO_PA26 +set AT91C_PA26_SPI1_NPCS2 $AT91C_PIO_PA26 +set AT91C_PIO_PA27 [expr 1 << 27 ] +set AT91C_PA27_DRXD $AT91C_PIO_PA27 +set AT91C_PA27_PCK3 $AT91C_PIO_PA27 +set AT91C_PIO_PA28 [expr 1 << 28 ] +set AT91C_PA28_DTXD $AT91C_PIO_PA28 +set AT91C_PIO_PA29 [expr 1 << 29 ] +set AT91C_PA29_FIQ $AT91C_PIO_PA29 +set AT91C_PA29_SPI1_NPCS3 $AT91C_PIO_PA29 +set AT91C_PIO_PA3 [expr 1 << 3 ] +set AT91C_PA3_RTS0 $AT91C_PIO_PA3 +set AT91C_PA3_SPI1_NPCS2 $AT91C_PIO_PA3 +set AT91C_PIO_PA30 [expr 1 << 30 ] +set AT91C_PA30_IRQ0 $AT91C_PIO_PA30 +set AT91C_PA30_PCK2 $AT91C_PIO_PA30 +set AT91C_PIO_PA4 [expr 1 << 4 ] +set AT91C_PA4_CTS0 $AT91C_PIO_PA4 +set AT91C_PA4_SPI1_NPCS3 $AT91C_PIO_PA4 +set AT91C_PIO_PA5 [expr 1 << 5 ] +set AT91C_PA5_RXD1 $AT91C_PIO_PA5 +set AT91C_PIO_PA6 [expr 1 << 6 ] +set AT91C_PA6_TXD1 $AT91C_PIO_PA6 +set AT91C_PIO_PA7 [expr 1 << 7 ] +set AT91C_PA7_SCK1 $AT91C_PIO_PA7 +set AT91C_PA7_SPI0_NPCS1 $AT91C_PIO_PA7 +set AT91C_PIO_PA8 [expr 1 << 8 ] +set AT91C_PA8_RTS1 $AT91C_PIO_PA8 +set AT91C_PA8_SPI0_NPCS2 $AT91C_PIO_PA8 +set AT91C_PIO_PA9 [expr 1 << 9 ] +set AT91C_PA9_CTS1 $AT91C_PIO_PA9 +set AT91C_PA9_SPI0_NPCS3 $AT91C_PIO_PA9 +set AT91C_PIO_PB0 [expr 1 << 0 ] +set AT91C_PB0_ETXCK_EREFCK $AT91C_PIO_PB0 +set AT91C_PB0_PCK0 $AT91C_PIO_PB0 +set AT91C_PIO_PB1 [expr 1 << 1 ] +set AT91C_PB1_ETXEN $AT91C_PIO_PB1 +set AT91C_PIO_PB10 [expr 1 << 10 ] +set AT91C_PB10_ETX2 $AT91C_PIO_PB10 +set AT91C_PB10_SPI1_NPCS1 $AT91C_PIO_PB10 +set AT91C_PIO_PB11 [expr 1 << 11 ] +set AT91C_PB11_ETX3 $AT91C_PIO_PB11 +set AT91C_PB11_SPI1_NPCS2 $AT91C_PIO_PB11 +set AT91C_PIO_PB12 [expr 1 << 12 ] +set AT91C_PB12_ETXER $AT91C_PIO_PB12 +set AT91C_PB12_TCLK0 $AT91C_PIO_PB12 +set AT91C_PIO_PB13 [expr 1 << 13 ] +set AT91C_PB13_ERX2 $AT91C_PIO_PB13 +set AT91C_PB13_SPI0_NPCS1 $AT91C_PIO_PB13 +set AT91C_PIO_PB14 [expr 1 << 14 ] +set AT91C_PB14_ERX3 $AT91C_PIO_PB14 +set AT91C_PB14_SPI0_NPCS2 $AT91C_PIO_PB14 +set AT91C_PIO_PB15 [expr 1 << 15 ] +set AT91C_PB15_ERXDV_ECRSDV $AT91C_PIO_PB15 +set AT91C_PIO_PB16 [expr 1 << 16 ] +set AT91C_PB16_ECOL $AT91C_PIO_PB16 +set AT91C_PB16_SPI1_NPCS3 $AT91C_PIO_PB16 +set AT91C_PIO_PB17 [expr 1 << 17 ] +set AT91C_PB17_ERXCK $AT91C_PIO_PB17 +set AT91C_PB17_SPI0_NPCS3 $AT91C_PIO_PB17 +set AT91C_PIO_PB18 [expr 1 << 18 ] +set AT91C_PB18_EF100 $AT91C_PIO_PB18 +set AT91C_PB18_ADTRG $AT91C_PIO_PB18 +set AT91C_PIO_PB19 [expr 1 << 19 ] +set AT91C_PB19_PWM0 $AT91C_PIO_PB19 +set AT91C_PB19_TCLK1 $AT91C_PIO_PB19 +set AT91C_PIO_PB2 [expr 1 << 2 ] +set AT91C_PB2_ETX0 $AT91C_PIO_PB2 +set AT91C_PIO_PB20 [expr 1 << 20 ] +set AT91C_PB20_PWM1 $AT91C_PIO_PB20 +set AT91C_PB20_PCK0 $AT91C_PIO_PB20 +set AT91C_PIO_PB21 [expr 1 << 21 ] +set AT91C_PB21_PWM2 $AT91C_PIO_PB21 +set AT91C_PB21_PCK1 $AT91C_PIO_PB21 +set AT91C_PIO_PB22 [expr 1 << 22 ] +set AT91C_PB22_PWM3 $AT91C_PIO_PB22 +set AT91C_PB22_PCK2 $AT91C_PIO_PB22 +set AT91C_PIO_PB23 [expr 1 << 23 ] +set AT91C_PB23_TIOA0 $AT91C_PIO_PB23 +set AT91C_PB23_DCD1 $AT91C_PIO_PB23 +set AT91C_PIO_PB24 [expr 1 << 24 ] +set AT91C_PB24_TIOB0 $AT91C_PIO_PB24 +set AT91C_PB24_DSR1 $AT91C_PIO_PB24 +set AT91C_PIO_PB25 [expr 1 << 25 ] +set AT91C_PB25_TIOA1 $AT91C_PIO_PB25 +set AT91C_PB25_DTR1 $AT91C_PIO_PB25 +set AT91C_PIO_PB26 [expr 1 << 26 ] +set AT91C_PB26_TIOB1 $AT91C_PIO_PB26 +set AT91C_PB26_RI1 $AT91C_PIO_PB26 +set AT91C_PIO_PB27 [expr 1 << 27 ] +set AT91C_PB27_TIOA2 $AT91C_PIO_PB27 +set AT91C_PB27_PWM0 $AT91C_PIO_PB27 +set AT91C_PIO_PB28 [expr 1 << 28 ] +set AT91C_PB28_TIOB2 $AT91C_PIO_PB28 +set AT91C_PB28_PWM1 $AT91C_PIO_PB28 +set AT91C_PIO_PB29 [expr 1 << 29 ] +set AT91C_PB29_PCK1 $AT91C_PIO_PB29 +set AT91C_PB29_PWM2 $AT91C_PIO_PB29 +set AT91C_PIO_PB3 [expr 1 << 3 ] +set AT91C_PB3_ETX1 $AT91C_PIO_PB3 +set AT91C_PIO_PB30 [expr 1 << 30 ] +set AT91C_PB30_PCK2 $AT91C_PIO_PB30 +set AT91C_PB30_PWM3 $AT91C_PIO_PB30 +set AT91C_PIO_PB4 [expr 1 << 4 ] +set AT91C_PB4_ECRS $AT91C_PIO_PB4 +set AT91C_PIO_PB5 [expr 1 << 5 ] +set AT91C_PB5_ERX0 $AT91C_PIO_PB5 +set AT91C_PIO_PB6 [expr 1 << 6 ] +set AT91C_PB6_ERX1 $AT91C_PIO_PB6 +set AT91C_PIO_PB7 [expr 1 << 7 ] +set AT91C_PB7_ERXER $AT91C_PIO_PB7 +set AT91C_PIO_PB8 [expr 1 << 8 ] +set AT91C_PB8_EMDC $AT91C_PIO_PB8 +set AT91C_PIO_PB9 [expr 1 << 9 ] +set AT91C_PB9_EMDIO $AT91C_PIO_PB9 + +# ***************************************************************************** +# MEMORY MAPPING DEFINITIONS FOR AT91SAM7X256 +# ***************************************************************************** +set AT91C_ISRAM 0x00200000 +set AT91C_ISRAM_SIZE 0x00010000 +set AT91C_IFLASH 0x00100000 +set AT91C_IFLASH_SIZE 0x00040000 + + +# ***************************************************************************** +# ATTRIBUTES DEFINITIONS FOR AT91SAM7X256 +# ***************************************************************************** +array set AT91SAM7X256_att { + DBGU { LP DBGU_att } + PMC { LP PMC_att } + VREG { LP VREG_att } + RSTC { LP RSTC_att } + SSC { LP SSC_att } + WDTC { LP WDTC_att } + USART { LP US1_att US0_att } + SPI { LP SPI1_att SPI0_att } + PITC { LP PITC_att } + TCB { LP TCB_att } + CKGR { LP CKGR_att } + AIC { LP AIC_att } + TWI { LP TWI_att } + ADC { LP ADC_att } + PWMC_CH { LP PWMC_CH3_att PWMC_CH2_att PWMC_CH1_att PWMC_CH0_att } + RTTC { LP RTTC_att } + UDP { LP UDP_att } + EMAC { LP EMAC_att } + CAN_MB { LP CAN_MB0_att CAN_MB1_att CAN_MB2_att CAN_MB3_att CAN_MB4_att CAN_MB5_att CAN_MB6_att CAN_MB7_att } + TC { LP TC0_att TC1_att TC2_att } + SYS { LP SYS_att } + MC { LP MC_att } + PIO { LP PIOA_att PIOB_att } + CAN { LP CAN_att } + PWMC { LP PWMC_att } + PDC { LP PDC_DBGU_att PDC_SPI1_att PDC_SPI0_att PDC_US1_att PDC_US0_att PDC_SSC_att PDC_ADC_att } + +} +# ========== Peripheral attributes for DBGU peripheral ========== +array set DBGU_att { + EXID { R AT91C_DBGU_EXID RO } + BRGR { R AT91C_DBGU_BRGR RW } + IDR { R AT91C_DBGU_IDR WO } + CSR { R AT91C_DBGU_CSR RO } + CIDR { R AT91C_DBGU_CIDR RO } + MR { R AT91C_DBGU_MR RW } + IMR { R AT91C_DBGU_IMR RO } + CR { R AT91C_DBGU_CR WO } + FNTR { R AT91C_DBGU_FNTR RW } + THR { R AT91C_DBGU_THR WO } + RHR { R AT91C_DBGU_RHR RO } + IER { R AT91C_DBGU_IER WO } + listeReg { EXID BRGR IDR CSR CIDR MR IMR CR FNTR THR RHR IER } + +} + +# ========== Peripheral attributes for PMC peripheral ========== +array set PMC_att { + IDR { R AT91C_PMC_IDR WO } + MOR { R AT91C_PMC_MOR RW } + PLLR { R AT91C_PMC_PLLR RW } + PCER { R AT91C_PMC_PCER WO } + PCKR { R AT91C_PMC_PCKR RW } + MCKR { R AT91C_PMC_MCKR RW } + SCDR { R AT91C_PMC_SCDR WO } + PCDR { R AT91C_PMC_PCDR WO } + SCSR { R AT91C_PMC_SCSR RO } + PCSR { R AT91C_PMC_PCSR RO } + MCFR { R AT91C_PMC_MCFR RO } + SCER { R AT91C_PMC_SCER WO } + IMR { R AT91C_PMC_IMR RO } + IER { R AT91C_PMC_IER WO } + SR { R AT91C_PMC_SR RO } + listeReg { IDR MOR PLLR PCER PCKR MCKR SCDR PCDR SCSR PCSR MCFR SCER IMR IER SR } + +} + +# ========== Peripheral attributes for VREG peripheral ========== +array set VREG_att { + MR { R AT91C_VREG_MR RW } + listeReg { MR } + +} + +# ========== Peripheral attributes for RSTC peripheral ========== +array set RSTC_att { + RCR { R AT91C_RSTC_RCR WO } + RMR { R AT91C_RSTC_RMR RW } + RSR { R AT91C_RSTC_RSR RO } + listeReg { RCR RMR RSR } + +} + +# ========== Peripheral attributes for SSC peripheral ========== +array set SSC_att { + RHR { R AT91C_SSC_RHR RO } + RSHR { R AT91C_SSC_RSHR RO } + TFMR { R AT91C_SSC_TFMR RW } + IDR { R AT91C_SSC_IDR WO } + THR { R AT91C_SSC_THR WO } + RCMR { R AT91C_SSC_RCMR RW } + IER { R AT91C_SSC_IER WO } + TSHR { R AT91C_SSC_TSHR RW } + SR { R AT91C_SSC_SR RO } + CMR { R AT91C_SSC_CMR RW } + TCMR { R AT91C_SSC_TCMR RW } + CR { R AT91C_SSC_CR WO } + IMR { R AT91C_SSC_IMR RO } + RFMR { R AT91C_SSC_RFMR RW } + listeReg { RHR RSHR TFMR IDR THR RCMR IER TSHR SR CMR TCMR CR IMR RFMR } + +} + +# ========== Peripheral attributes for WDTC peripheral ========== +array set WDTC_att { + WDCR { R AT91C_WDTC_WDCR WO } + WDSR { R AT91C_WDTC_WDSR RO } + WDMR { R AT91C_WDTC_WDMR RW } + listeReg { WDCR WDSR WDMR } + +} + +# ========== Peripheral attributes for USART peripheral ========== +array set US1_att { + IF { R AT91C_US1_IF RW } + NER { R AT91C_US1_NER RO } + RTOR { R AT91C_US1_RTOR RW } + CSR { R AT91C_US1_CSR RO } + IDR { R AT91C_US1_IDR WO } + IER { R AT91C_US1_IER WO } + THR { R AT91C_US1_THR WO } + TTGR { R AT91C_US1_TTGR RW } + RHR { R AT91C_US1_RHR RO } + BRGR { R AT91C_US1_BRGR RW } + IMR { R AT91C_US1_IMR RO } + FIDI { R AT91C_US1_FIDI RW } + CR { R AT91C_US1_CR WO } + MR { R AT91C_US1_MR RW } + listeReg { IF NER RTOR CSR IDR IER THR TTGR RHR BRGR IMR FIDI CR MR } + +} +array set US0_att { + BRGR { R AT91C_US0_BRGR RW } + NER { R AT91C_US0_NER RO } + CR { R AT91C_US0_CR WO } + IMR { R AT91C_US0_IMR RO } + FIDI { R AT91C_US0_FIDI RW } + TTGR { R AT91C_US0_TTGR RW } + MR { R AT91C_US0_MR RW } + RTOR { R AT91C_US0_RTOR RW } + CSR { R AT91C_US0_CSR RO } + RHR { R AT91C_US0_RHR RO } + IDR { R AT91C_US0_IDR WO } + THR { R AT91C_US0_THR WO } + IF { R AT91C_US0_IF RW } + IER { R AT91C_US0_IER WO } + listeReg { BRGR NER CR IMR FIDI TTGR MR RTOR CSR RHR IDR THR IF IER } + +} + +# ========== Peripheral attributes for SPI peripheral ========== +array set SPI1_att { + IMR { R AT91C_SPI1_IMR RO } + IER { R AT91C_SPI1_IER WO } + MR { R AT91C_SPI1_MR RW } + RDR { R AT91C_SPI1_RDR RO } + IDR { R AT91C_SPI1_IDR WO } + SR { R AT91C_SPI1_SR RO } + TDR { R AT91C_SPI1_TDR WO } + CR { R AT91C_SPI1_CR RO } + CSR { R AT91C_SPI1_CSR RW } + listeReg { IMR IER MR RDR IDR SR TDR CR CSR } + +} +array set SPI0_att { + IER { R AT91C_SPI0_IER WO } + SR { R AT91C_SPI0_SR RO } + IDR { R AT91C_SPI0_IDR WO } + CR { R AT91C_SPI0_CR RO } + MR { R AT91C_SPI0_MR RW } + IMR { R AT91C_SPI0_IMR RO } + TDR { R AT91C_SPI0_TDR WO } + RDR { R AT91C_SPI0_RDR RO } + CSR { R AT91C_SPI0_CSR RW } + listeReg { IER SR IDR CR MR IMR TDR RDR CSR } + +} + +# ========== Peripheral attributes for PITC peripheral ========== +array set PITC_att { + PIVR { R AT91C_PITC_PIVR RO } + PISR { R AT91C_PITC_PISR RO } + PIIR { R AT91C_PITC_PIIR RO } + PIMR { R AT91C_PITC_PIMR RW } + listeReg { PIVR PISR PIIR PIMR } + +} + +# ========== Peripheral attributes for TCB peripheral ========== +array set TCB_att { + BMR { R AT91C_TCB_BMR RW } + BCR { R AT91C_TCB_BCR WO } + listeReg { BMR BCR } + +} + +# ========== Peripheral attributes for CKGR peripheral ========== +array set CKGR_att { + MOR { R AT91C_CKGR_MOR RW } + PLLR { R AT91C_CKGR_PLLR RW } + MCFR { R AT91C_CKGR_MCFR RO } + listeReg { MOR PLLR MCFR } + +} + +# ========== Peripheral attributes for AIC peripheral ========== +array set AIC_att { + IVR { R AT91C_AIC_IVR RO } + SMR { R AT91C_AIC_SMR RW } + FVR { R AT91C_AIC_FVR RO } + DCR { R AT91C_AIC_DCR RW } + EOICR { R AT91C_AIC_EOICR WO } + SVR { R AT91C_AIC_SVR RW } + FFSR { R AT91C_AIC_FFSR RO } + ICCR { R AT91C_AIC_ICCR WO } + ISR { R AT91C_AIC_ISR RO } + IMR { R AT91C_AIC_IMR RO } + IPR { R AT91C_AIC_IPR RO } + FFER { R AT91C_AIC_FFER WO } + IECR { R AT91C_AIC_IECR WO } + ISCR { R AT91C_AIC_ISCR WO } + FFDR { R AT91C_AIC_FFDR WO } + CISR { R AT91C_AIC_CISR RO } + IDCR { R AT91C_AIC_IDCR WO } + SPU { R AT91C_AIC_SPU RW } + listeReg { IVR SMR FVR DCR EOICR SVR FFSR ICCR ISR IMR IPR FFER IECR ISCR FFDR CISR IDCR SPU } + +} + +# ========== Peripheral attributes for TWI peripheral ========== +array set TWI_att { + IER { R AT91C_TWI_IER WO } + CR { R AT91C_TWI_CR WO } + SR { R AT91C_TWI_SR RO } + IMR { R AT91C_TWI_IMR RO } + THR { R AT91C_TWI_THR WO } + IDR { R AT91C_TWI_IDR WO } + IADR { R AT91C_TWI_IADR RW } + MMR { R AT91C_TWI_MMR RW } + CWGR { R AT91C_TWI_CWGR RW } + RHR { R AT91C_TWI_RHR RO } + listeReg { IER CR SR IMR THR IDR IADR MMR CWGR RHR } + +} + +# ========== Peripheral attributes for ADC peripheral ========== +array set ADC_att { + CDR2 { R AT91C_ADC_CDR2 RO } + CDR3 { R AT91C_ADC_CDR3 RO } + CDR0 { R AT91C_ADC_CDR0 RO } + CDR5 { R AT91C_ADC_CDR5 RO } + CHDR { R AT91C_ADC_CHDR WO } + SR { R AT91C_ADC_SR RO } + CDR4 { R AT91C_ADC_CDR4 RO } + CDR1 { R AT91C_ADC_CDR1 RO } + LCDR { R AT91C_ADC_LCDR RO } + IDR { R AT91C_ADC_IDR WO } + CR { R AT91C_ADC_CR WO } + CDR7 { R AT91C_ADC_CDR7 RO } + CDR6 { R AT91C_ADC_CDR6 RO } + IER { R AT91C_ADC_IER WO } + CHER { R AT91C_ADC_CHER WO } + CHSR { R AT91C_ADC_CHSR RO } + MR { R AT91C_ADC_MR RW } + IMR { R AT91C_ADC_IMR RO } + listeReg { CDR2 CDR3 CDR0 CDR5 CHDR SR CDR4 CDR1 LCDR IDR CR CDR7 CDR6 IER CHER CHSR MR IMR } + +} + +# ========== Peripheral attributes for PWMC_CH peripheral ========== +array set PWMC_CH3_att { + CUPDR { R AT91C_PWMC_CH3_CUPDR WO } + Reserved { R AT91C_PWMC_CH3_Reserved WO } + CPRDR { R AT91C_PWMC_CH3_CPRDR RW } + CDTYR { R AT91C_PWMC_CH3_CDTYR RW } + CCNTR { R AT91C_PWMC_CH3_CCNTR RO } + CMR { R AT91C_PWMC_CH3_CMR RW } + listeReg { CUPDR Reserved CPRDR CDTYR CCNTR CMR } + +} +array set PWMC_CH2_att { + Reserved { R AT91C_PWMC_CH2_Reserved WO } + CMR { R AT91C_PWMC_CH2_CMR RW } + CCNTR { R AT91C_PWMC_CH2_CCNTR RO } + CPRDR { R AT91C_PWMC_CH2_CPRDR RW } + CUPDR { R AT91C_PWMC_CH2_CUPDR WO } + CDTYR { R AT91C_PWMC_CH2_CDTYR RW } + listeReg { Reserved CMR CCNTR CPRDR CUPDR CDTYR } + +} +array set PWMC_CH1_att { + Reserved { R AT91C_PWMC_CH1_Reserved WO } + CUPDR { R AT91C_PWMC_CH1_CUPDR WO } + CPRDR { R AT91C_PWMC_CH1_CPRDR RW } + CCNTR { R AT91C_PWMC_CH1_CCNTR RO } + CDTYR { R AT91C_PWMC_CH1_CDTYR RW } + CMR { R AT91C_PWMC_CH1_CMR RW } + listeReg { Reserved CUPDR CPRDR CCNTR CDTYR CMR } + +} +array set PWMC_CH0_att { + Reserved { R AT91C_PWMC_CH0_Reserved WO } + CPRDR { R AT91C_PWMC_CH0_CPRDR RW } + CDTYR { R AT91C_PWMC_CH0_CDTYR RW } + CMR { R AT91C_PWMC_CH0_CMR RW } + CUPDR { R AT91C_PWMC_CH0_CUPDR WO } + CCNTR { R AT91C_PWMC_CH0_CCNTR RO } + listeReg { Reserved CPRDR CDTYR CMR CUPDR CCNTR } + +} + +# ========== Peripheral attributes for RTTC peripheral ========== +array set RTTC_att { + RTSR { R AT91C_RTTC_RTSR RO } + RTMR { R AT91C_RTTC_RTMR RW } + RTVR { R AT91C_RTTC_RTVR RO } + RTAR { R AT91C_RTTC_RTAR RW } + listeReg { RTSR RTMR RTVR RTAR } + +} + +# ========== Peripheral attributes for UDP peripheral ========== +array set UDP_att { + IMR { R AT91C_UDP_IMR RO } + FADDR { R AT91C_UDP_FADDR RW } + NUM { R AT91C_UDP_NUM RO } + FDR { R AT91C_UDP_FDR RW } + ISR { R AT91C_UDP_ISR RO } + CSR { R AT91C_UDP_CSR RW } + IDR { R AT91C_UDP_IDR WO } + ICR { R AT91C_UDP_ICR RO } + RSTEP { R AT91C_UDP_RSTEP RO } + TXVC { R AT91C_UDP_TXVC RW } + GLBSTATE { R AT91C_UDP_GLBSTATE RW } + IER { R AT91C_UDP_IER WO } + listeReg { IMR FADDR NUM FDR ISR CSR IDR ICR RSTEP TXVC GLBSTATE IER } + +} + +# ========== Peripheral attributes for EMAC peripheral ========== +array set EMAC_att { + ISR { R AT91C_EMAC_ISR RW } + SA4H { R AT91C_EMAC_SA4H RW } + SA1L { R AT91C_EMAC_SA1L RW } + ELE { R AT91C_EMAC_ELE RW } + LCOL { R AT91C_EMAC_LCOL RW } + RLE { R AT91C_EMAC_RLE RW } + WOL { R AT91C_EMAC_WOL RW } + DTF { R AT91C_EMAC_DTF RW } + TUND { R AT91C_EMAC_TUND RW } + NCR { R AT91C_EMAC_NCR RW } + SA4L { R AT91C_EMAC_SA4L RW } + RSR { R AT91C_EMAC_RSR RW } + SA3L { R AT91C_EMAC_SA3L RW } + TSR { R AT91C_EMAC_TSR RW } + IDR { R AT91C_EMAC_IDR WO } + RSE { R AT91C_EMAC_RSE RW } + ECOL { R AT91C_EMAC_ECOL RW } + TID { R AT91C_EMAC_TID RW } + HRB { R AT91C_EMAC_HRB RW } + TBQP { R AT91C_EMAC_TBQP RW } + USRIO { R AT91C_EMAC_USRIO RW } + PTR { R AT91C_EMAC_PTR RW } + SA2H { R AT91C_EMAC_SA2H RW } + ROV { R AT91C_EMAC_ROV RW } + ALE { R AT91C_EMAC_ALE RW } + RJA { R AT91C_EMAC_RJA RW } + RBQP { R AT91C_EMAC_RBQP RW } + TPF { R AT91C_EMAC_TPF RW } + NCFGR { R AT91C_EMAC_NCFGR RW } + HRT { R AT91C_EMAC_HRT RW } + USF { R AT91C_EMAC_USF RW } + FCSE { R AT91C_EMAC_FCSE RW } + TPQ { R AT91C_EMAC_TPQ RW } + MAN { R AT91C_EMAC_MAN RW } + FTO { R AT91C_EMAC_FTO RW } + REV { R AT91C_EMAC_REV RO } + IMR { R AT91C_EMAC_IMR RO } + SCF { R AT91C_EMAC_SCF RW } + PFR { R AT91C_EMAC_PFR RW } + MCF { R AT91C_EMAC_MCF RW } + NSR { R AT91C_EMAC_NSR RO } + SA2L { R AT91C_EMAC_SA2L RW } + FRO { R AT91C_EMAC_FRO RW } + IER { R AT91C_EMAC_IER WO } + SA1H { R AT91C_EMAC_SA1H RW } + CSE { R AT91C_EMAC_CSE RW } + SA3H { R AT91C_EMAC_SA3H RW } + RRE { R AT91C_EMAC_RRE RW } + STE { R AT91C_EMAC_STE RW } + listeReg { ISR SA4H SA1L ELE LCOL RLE WOL DTF TUND NCR SA4L RSR SA3L TSR IDR RSE ECOL TID HRB TBQP USRIO PTR SA2H ROV ALE RJA RBQP TPF NCFGR HRT USF FCSE TPQ MAN FTO REV IMR SCF PFR MCF NSR SA2L FRO IER SA1H CSE SA3H RRE STE } + +} + +# ========== Peripheral attributes for CAN_MB peripheral ========== +array set CAN_MB0_att { + MDL { R AT91C_CAN_MB0_MDL RW } + MAM { R AT91C_CAN_MB0_MAM RW } + MCR { R AT91C_CAN_MB0_MCR WO } + MID { R AT91C_CAN_MB0_MID RW } + MSR { R AT91C_CAN_MB0_MSR RO } + MFID { R AT91C_CAN_MB0_MFID RO } + MDH { R AT91C_CAN_MB0_MDH RW } + MMR { R AT91C_CAN_MB0_MMR RW } + listeReg { MDL MAM MCR MID MSR MFID MDH MMR } + +} +array set CAN_MB1_att { + MDL { R AT91C_CAN_MB1_MDL RW } + MID { R AT91C_CAN_MB1_MID RW } + MMR { R AT91C_CAN_MB1_MMR RW } + MSR { R AT91C_CAN_MB1_MSR RO } + MAM { R AT91C_CAN_MB1_MAM RW } + MDH { R AT91C_CAN_MB1_MDH RW } + MCR { R AT91C_CAN_MB1_MCR WO } + MFID { R AT91C_CAN_MB1_MFID RO } + listeReg { MDL MID MMR MSR MAM MDH MCR MFID } + +} +array set CAN_MB2_att { + MCR { R AT91C_CAN_MB2_MCR WO } + MDH { R AT91C_CAN_MB2_MDH RW } + MID { R AT91C_CAN_MB2_MID RW } + MDL { R AT91C_CAN_MB2_MDL RW } + MMR { R AT91C_CAN_MB2_MMR RW } + MAM { R AT91C_CAN_MB2_MAM RW } + MFID { R AT91C_CAN_MB2_MFID RO } + MSR { R AT91C_CAN_MB2_MSR RO } + listeReg { MCR MDH MID MDL MMR MAM MFID MSR } + +} +array set CAN_MB3_att { + MFID { R AT91C_CAN_MB3_MFID RO } + MAM { R AT91C_CAN_MB3_MAM RW } + MID { R AT91C_CAN_MB3_MID RW } + MCR { R AT91C_CAN_MB3_MCR WO } + MMR { R AT91C_CAN_MB3_MMR RW } + MSR { R AT91C_CAN_MB3_MSR RO } + MDL { R AT91C_CAN_MB3_MDL RW } + MDH { R AT91C_CAN_MB3_MDH RW } + listeReg { MFID MAM MID MCR MMR MSR MDL MDH } + +} +array set CAN_MB4_att { + MID { R AT91C_CAN_MB4_MID RW } + MMR { R AT91C_CAN_MB4_MMR RW } + MDH { R AT91C_CAN_MB4_MDH RW } + MFID { R AT91C_CAN_MB4_MFID RO } + MSR { R AT91C_CAN_MB4_MSR RO } + MCR { R AT91C_CAN_MB4_MCR WO } + MDL { R AT91C_CAN_MB4_MDL RW } + MAM { R AT91C_CAN_MB4_MAM RW } + listeReg { MID MMR MDH MFID MSR MCR MDL MAM } + +} +array set CAN_MB5_att { + MSR { R AT91C_CAN_MB5_MSR RO } + MCR { R AT91C_CAN_MB5_MCR WO } + MFID { R AT91C_CAN_MB5_MFID RO } + MDH { R AT91C_CAN_MB5_MDH RW } + MID { R AT91C_CAN_MB5_MID RW } + MMR { R AT91C_CAN_MB5_MMR RW } + MDL { R AT91C_CAN_MB5_MDL RW } + MAM { R AT91C_CAN_MB5_MAM RW } + listeReg { MSR MCR MFID MDH MID MMR MDL MAM } + +} +array set CAN_MB6_att { + MFID { R AT91C_CAN_MB6_MFID RO } + MID { R AT91C_CAN_MB6_MID RW } + MAM { R AT91C_CAN_MB6_MAM RW } + MSR { R AT91C_CAN_MB6_MSR RO } + MDL { R AT91C_CAN_MB6_MDL RW } + MCR { R AT91C_CAN_MB6_MCR WO } + MDH { R AT91C_CAN_MB6_MDH RW } + MMR { R AT91C_CAN_MB6_MMR RW } + listeReg { MFID MID MAM MSR MDL MCR MDH MMR } + +} +array set CAN_MB7_att { + MCR { R AT91C_CAN_MB7_MCR WO } + MDH { R AT91C_CAN_MB7_MDH RW } + MFID { R AT91C_CAN_MB7_MFID RO } + MDL { R AT91C_CAN_MB7_MDL RW } + MID { R AT91C_CAN_MB7_MID RW } + MMR { R AT91C_CAN_MB7_MMR RW } + MAM { R AT91C_CAN_MB7_MAM RW } + MSR { R AT91C_CAN_MB7_MSR RO } + listeReg { MCR MDH MFID MDL MID MMR MAM MSR } + +} + +# ========== Peripheral attributes for TC peripheral ========== +array set TC0_att { + SR { R AT91C_TC0_SR RO } + RC { R AT91C_TC0_RC RW } + RB { R AT91C_TC0_RB RW } + CCR { R AT91C_TC0_CCR WO } + CMR { R AT91C_TC0_CMR RW } + IER { R AT91C_TC0_IER WO } + RA { R AT91C_TC0_RA RW } + IDR { R AT91C_TC0_IDR WO } + CV { R AT91C_TC0_CV RW } + IMR { R AT91C_TC0_IMR RO } + listeReg { SR RC RB CCR CMR IER RA IDR CV IMR } + +} +array set TC1_att { + RB { R AT91C_TC1_RB RW } + CCR { R AT91C_TC1_CCR WO } + IER { R AT91C_TC1_IER WO } + IDR { R AT91C_TC1_IDR WO } + SR { R AT91C_TC1_SR RO } + CMR { R AT91C_TC1_CMR RW } + RA { R AT91C_TC1_RA RW } + RC { R AT91C_TC1_RC RW } + IMR { R AT91C_TC1_IMR RO } + CV { R AT91C_TC1_CV RW } + listeReg { RB CCR IER IDR SR CMR RA RC IMR CV } + +} +array set TC2_att { + CMR { R AT91C_TC2_CMR RW } + CCR { R AT91C_TC2_CCR WO } + CV { R AT91C_TC2_CV RW } + RA { R AT91C_TC2_RA RW } + RB { R AT91C_TC2_RB RW } + IDR { R AT91C_TC2_IDR WO } + IMR { R AT91C_TC2_IMR RO } + RC { R AT91C_TC2_RC RW } + IER { R AT91C_TC2_IER WO } + SR { R AT91C_TC2_SR RO } + listeReg { CMR CCR CV RA RB IDR IMR RC IER SR } + +} + +# ========== Peripheral attributes for SYS peripheral ========== +array set SYS_att { + listeReg { } + +} + +# ========== Peripheral attributes for MC peripheral ========== +array set MC_att { + ASR { R AT91C_MC_ASR RO } + RCR { R AT91C_MC_RCR WO } + FCR { R AT91C_MC_FCR WO } + AASR { R AT91C_MC_AASR RO } + FSR { R AT91C_MC_FSR RO } + FMR { R AT91C_MC_FMR RW } + listeReg { ASR RCR FCR AASR FSR FMR } + +} + +# ========== Peripheral attributes for PIO peripheral ========== +array set PIOA_att { + ODR { R AT91C_PIOA_ODR WO } + SODR { R AT91C_PIOA_SODR WO } + ISR { R AT91C_PIOA_ISR RO } + ABSR { R AT91C_PIOA_ABSR RO } + IER { R AT91C_PIOA_IER WO } + PPUDR { R AT91C_PIOA_PPUDR WO } + IMR { R AT91C_PIOA_IMR RO } + PER { R AT91C_PIOA_PER WO } + IFDR { R AT91C_PIOA_IFDR WO } + OWDR { R AT91C_PIOA_OWDR WO } + MDSR { R AT91C_PIOA_MDSR RO } + IDR { R AT91C_PIOA_IDR WO } + ODSR { R AT91C_PIOA_ODSR RO } + PPUSR { R AT91C_PIOA_PPUSR RO } + OWSR { R AT91C_PIOA_OWSR RO } + BSR { R AT91C_PIOA_BSR WO } + OWER { R AT91C_PIOA_OWER WO } + IFER { R AT91C_PIOA_IFER WO } + PDSR { R AT91C_PIOA_PDSR RO } + PPUER { R AT91C_PIOA_PPUER WO } + OSR { R AT91C_PIOA_OSR RO } + ASR { R AT91C_PIOA_ASR WO } + MDDR { R AT91C_PIOA_MDDR WO } + CODR { R AT91C_PIOA_CODR WO } + MDER { R AT91C_PIOA_MDER WO } + PDR { R AT91C_PIOA_PDR WO } + IFSR { R AT91C_PIOA_IFSR RO } + OER { R AT91C_PIOA_OER WO } + PSR { R AT91C_PIOA_PSR RO } + listeReg { ODR SODR ISR ABSR IER PPUDR IMR PER IFDR OWDR MDSR IDR ODSR PPUSR OWSR BSR OWER IFER PDSR PPUER OSR ASR MDDR CODR MDER PDR IFSR OER PSR } + +} +array set PIOB_att { + OWDR { R AT91C_PIOB_OWDR WO } + MDER { R AT91C_PIOB_MDER WO } + PPUSR { R AT91C_PIOB_PPUSR RO } + IMR { R AT91C_PIOB_IMR RO } + ASR { R AT91C_PIOB_ASR WO } + PPUDR { R AT91C_PIOB_PPUDR WO } + PSR { R AT91C_PIOB_PSR RO } + IER { R AT91C_PIOB_IER WO } + CODR { R AT91C_PIOB_CODR WO } + OWER { R AT91C_PIOB_OWER WO } + ABSR { R AT91C_PIOB_ABSR RO } + IFDR { R AT91C_PIOB_IFDR WO } + PDSR { R AT91C_PIOB_PDSR RO } + IDR { R AT91C_PIOB_IDR WO } + OWSR { R AT91C_PIOB_OWSR RO } + PDR { R AT91C_PIOB_PDR WO } + ODR { R AT91C_PIOB_ODR WO } + IFSR { R AT91C_PIOB_IFSR RO } + PPUER { R AT91C_PIOB_PPUER WO } + SODR { R AT91C_PIOB_SODR WO } + ISR { R AT91C_PIOB_ISR RO } + ODSR { R AT91C_PIOB_ODSR RO } + OSR { R AT91C_PIOB_OSR RO } + MDSR { R AT91C_PIOB_MDSR RO } + IFER { R AT91C_PIOB_IFER WO } + BSR { R AT91C_PIOB_BSR WO } + MDDR { R AT91C_PIOB_MDDR WO } + OER { R AT91C_PIOB_OER WO } + PER { R AT91C_PIOB_PER WO } + listeReg { OWDR MDER PPUSR IMR ASR PPUDR PSR IER CODR OWER ABSR IFDR PDSR IDR OWSR PDR ODR IFSR PPUER SODR ISR ODSR OSR MDSR IFER BSR MDDR OER PER } + +} + +# ========== Peripheral attributes for CAN peripheral ========== +array set CAN_att { + TCR { R AT91C_CAN_TCR WO } + IMR { R AT91C_CAN_IMR RO } + IER { R AT91C_CAN_IER WO } + ECR { R AT91C_CAN_ECR RO } + TIMESTP { R AT91C_CAN_TIMESTP RO } + MR { R AT91C_CAN_MR RW } + IDR { R AT91C_CAN_IDR WO } + ACR { R AT91C_CAN_ACR WO } + TIM { R AT91C_CAN_TIM RO } + SR { R AT91C_CAN_SR RO } + BR { R AT91C_CAN_BR RW } + VR { R AT91C_CAN_VR RO } + listeReg { TCR IMR IER ECR TIMESTP MR IDR ACR TIM SR BR VR } + +} + +# ========== Peripheral attributes for PWMC peripheral ========== +array set PWMC_att { + IDR { R AT91C_PWMC_IDR WO } + DIS { R AT91C_PWMC_DIS WO } + IER { R AT91C_PWMC_IER WO } + VR { R AT91C_PWMC_VR RO } + ISR { R AT91C_PWMC_ISR RO } + SR { R AT91C_PWMC_SR RO } + IMR { R AT91C_PWMC_IMR RO } + MR { R AT91C_PWMC_MR RW } + ENA { R AT91C_PWMC_ENA WO } + listeReg { IDR DIS IER VR ISR SR IMR MR ENA } + +} + +# ========== Peripheral attributes for PDC peripheral ========== +array set PDC_DBGU_att { + TCR { R AT91C_DBGU_TCR RW } + RNPR { R AT91C_DBGU_RNPR RW } + TNPR { R AT91C_DBGU_TNPR RW } + TPR { R AT91C_DBGU_TPR RW } + RPR { R AT91C_DBGU_RPR RW } + RCR { R AT91C_DBGU_RCR RW } + RNCR { R AT91C_DBGU_RNCR RW } + PTCR { R AT91C_DBGU_PTCR WO } + PTSR { R AT91C_DBGU_PTSR RO } + TNCR { R AT91C_DBGU_TNCR RW } + listeReg { TCR RNPR TNPR TPR RPR RCR RNCR PTCR PTSR TNCR } + +} +array set PDC_SPI1_att { + PTCR { R AT91C_SPI1_PTCR WO } + RPR { R AT91C_SPI1_RPR RW } + TNCR { R AT91C_SPI1_TNCR RW } + TPR { R AT91C_SPI1_TPR RW } + TNPR { R AT91C_SPI1_TNPR RW } + TCR { R AT91C_SPI1_TCR RW } + RCR { R AT91C_SPI1_RCR RW } + RNPR { R AT91C_SPI1_RNPR RW } + RNCR { R AT91C_SPI1_RNCR RW } + PTSR { R AT91C_SPI1_PTSR RO } + listeReg { PTCR RPR TNCR TPR TNPR TCR RCR RNPR RNCR PTSR } + +} +array set PDC_SPI0_att { + PTCR { R AT91C_SPI0_PTCR WO } + TPR { R AT91C_SPI0_TPR RW } + TCR { R AT91C_SPI0_TCR RW } + RCR { R AT91C_SPI0_RCR RW } + PTSR { R AT91C_SPI0_PTSR RO } + RNPR { R AT91C_SPI0_RNPR RW } + RPR { R AT91C_SPI0_RPR RW } + TNCR { R AT91C_SPI0_TNCR RW } + RNCR { R AT91C_SPI0_RNCR RW } + TNPR { R AT91C_SPI0_TNPR RW } + listeReg { PTCR TPR TCR RCR PTSR RNPR RPR TNCR RNCR TNPR } + +} +array set PDC_US1_att { + RNCR { R AT91C_US1_RNCR RW } + PTCR { R AT91C_US1_PTCR WO } + TCR { R AT91C_US1_TCR RW } + PTSR { R AT91C_US1_PTSR RO } + TNPR { R AT91C_US1_TNPR RW } + RCR { R AT91C_US1_RCR RW } + RNPR { R AT91C_US1_RNPR RW } + RPR { R AT91C_US1_RPR RW } + TNCR { R AT91C_US1_TNCR RW } + TPR { R AT91C_US1_TPR RW } + listeReg { RNCR PTCR TCR PTSR TNPR RCR RNPR RPR TNCR TPR } + +} +array set PDC_US0_att { + TNPR { R AT91C_US0_TNPR RW } + RNPR { R AT91C_US0_RNPR RW } + TCR { R AT91C_US0_TCR RW } + PTCR { R AT91C_US0_PTCR WO } + PTSR { R AT91C_US0_PTSR RO } + TNCR { R AT91C_US0_TNCR RW } + TPR { R AT91C_US0_TPR RW } + RCR { R AT91C_US0_RCR RW } + RPR { R AT91C_US0_RPR RW } + RNCR { R AT91C_US0_RNCR RW } + listeReg { TNPR RNPR TCR PTCR PTSR TNCR TPR RCR RPR RNCR } + +} +array set PDC_SSC_att { + TNCR { R AT91C_SSC_TNCR RW } + RPR { R AT91C_SSC_RPR RW } + RNCR { R AT91C_SSC_RNCR RW } + TPR { R AT91C_SSC_TPR RW } + PTCR { R AT91C_SSC_PTCR WO } + TCR { R AT91C_SSC_TCR RW } + RCR { R AT91C_SSC_RCR RW } + RNPR { R AT91C_SSC_RNPR RW } + TNPR { R AT91C_SSC_TNPR RW } + PTSR { R AT91C_SSC_PTSR RO } + listeReg { TNCR RPR RNCR TPR PTCR TCR RCR RNPR TNPR PTSR } + +} +array set PDC_ADC_att { + PTSR { R AT91C_ADC_PTSR RO } + PTCR { R AT91C_ADC_PTCR WO } + TNPR { R AT91C_ADC_TNPR RW } + TNCR { R AT91C_ADC_TNCR RW } + RNPR { R AT91C_ADC_RNPR RW } + RNCR { R AT91C_ADC_RNCR RW } + RPR { R AT91C_ADC_RPR RW } + TCR { R AT91C_ADC_TCR RW } + TPR { R AT91C_ADC_TPR RW } + RCR { R AT91C_ADC_RCR RW } + listeReg { PTSR PTCR TNPR TNCR RNPR RNCR RPR TCR TPR RCR } + +} + +# ========== PIO information ========== + +array set def_PIOA_att { + PA0 { RXD0 } + PA1 { TXD0 } + PA10 { TWD } + PA11 { TWCK } + PA12 { SPI0_NPCS0 } + PA13 { SPI0_NPCS1 PCK1 } + PA14 { SPI0_NPCS2 IRQ1 } + PA15 { SPI0_NPCS3 TCLK2 } + PA16 { SPI0_MISO } + PA17 { SPI0_MOSI } + PA18 { SPI0_SPCK } + PA19 { CANRX } + PA2 { SCK0 SPI1_NPCS1 } + PA20 { CANTX } + PA21 { TF SPI1_NPCS0 } + PA22 { TK SPI1_SPCK } + PA23 { TD SPI1_MOSI } + PA24 { RD SPI1_MISO } + PA25 { RK SPI1_NPCS1 } + PA26 { RF SPI1_NPCS2 } + PA27 { DRXD PCK3 } + PA28 { DTXD } + PA29 { FIQ SPI1_NPCS3 } + PA3 { RTS0 SPI1_NPCS2 } + PA30 { IRQ0 PCK2 } + PA4 { CTS0 SPI1_NPCS3 } + PA5 { RXD1 } + PA6 { TXD1 } + PA7 { SCK1 SPI0_NPCS1 } + PA8 { RTS1 SPI0_NPCS2 } + PA9 { CTS1 SPI0_NPCS3 } + } + +array set def_PIOB_att { + PB0 { ETXCK_EREFCK PCK0 } + PB1 { ETXEN } + PB10 { ETX2 SPI1_NPCS1 } + PB11 { ETX3 SPI1_NPCS2 } + PB12 { ETXER TCLK0 } + PB13 { ERX2 SPI0_NPCS1 } + PB14 { ERX3 SPI0_NPCS2 } + PB15 { ERXDV_ECRSDV } + PB16 { ECOL SPI1_NPCS3 } + PB17 { ERXCK SPI0_NPCS3 } + PB18 { EF100 ADTRG } + PB19 { PWM0 TCLK1 } + PB2 { ETX0 } + PB20 { PWM1 PCK0 } + PB21 { PWM2 PCK1 } + PB22 { PWM3 PCK2 } + PB23 { TIOA0 DCD1 } + PB24 { TIOB0 DSR1 } + PB25 { TIOA1 DTR1 } + PB26 { TIOB1 RI1 } + PB27 { TIOA2 PWM0 } + PB28 { TIOB2 PWM1 } + PB29 { PCK1 PWM2 } + PB3 { ETX1 } + PB30 { PCK2 PWM3 } + PB4 { ECRS } + PB5 { ERX0 } + PB6 { ERX1 } + PB7 { ERXER } + PB8 { EMDC } + PB9 { EMDIO } + } diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256_inc.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256_inc.h new file mode 100644 index 0000000..b393d05 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256_inc.h @@ -0,0 +1,2268 @@ +// ---------------------------------------------------------------------------- +// ATMEL Microcontroller Software Support - ROUSSET - +// ---------------------------------------------------------------------------- +// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// ---------------------------------------------------------------------------- +// File Name : AT91SAM7X256.h +// Object : AT91SAM7X256 definitions +// Generated : AT91 SW Application Group 11/02/2005 (15:17:24) +// +// CVS Reference : /AT91SAM7X256.pl/1.14/Tue Sep 13 15:06:52 2005// +// CVS Reference : /SYS_SAM7X.pl/1.3/Tue Feb 1 17:01:43 2005// +// CVS Reference : /MC_SAM7X.pl/1.2/Fri May 20 14:13:04 2005// +// CVS Reference : /PMC_SAM7X.pl/1.4/Tue Feb 8 13:58:10 2005// +// CVS Reference : /RSTC_SAM7X.pl/1.2/Wed Jul 13 14:57:50 2005// +// CVS Reference : /UDP_SAM7X.pl/1.1/Tue May 10 11:35:35 2005// +// CVS Reference : /PWM_SAM7X.pl/1.1/Tue May 10 11:53:07 2005// +// CVS Reference : /AIC_6075B.pl/1.3/Fri May 20 14:01:30 2005// +// CVS Reference : /PIO_6057A.pl/1.2/Thu Feb 3 10:18:28 2005// +// CVS Reference : /RTTC_6081A.pl/1.2/Tue Nov 9 14:43:58 2004// +// CVS Reference : /PITC_6079A.pl/1.2/Tue Nov 9 14:43:56 2004// +// CVS Reference : /WDTC_6080A.pl/1.3/Tue Nov 9 14:44:00 2004// +// CVS Reference : /VREG_6085B.pl/1.1/Tue Feb 1 16:05:48 2005// +// CVS Reference : /PDC_6074C.pl/1.2/Thu Feb 3 08:48:54 2005// +// CVS Reference : /DBGU_6059D.pl/1.1/Mon Jan 31 13:15:32 2005// +// CVS Reference : /SPI_6088D.pl/1.3/Fri May 20 14:08:59 2005// +// CVS Reference : /US_6089C.pl/1.1/Mon Jul 12 18:23:26 2004// +// CVS Reference : /SSC_6078B.pl/1.1/Wed Jul 13 15:19:19 2005// +// CVS Reference : /TWI_6061A.pl/1.1/Tue Jul 13 07:38:06 2004// +// CVS Reference : /TC_6082A.pl/1.7/Fri Mar 11 12:52:17 2005// +// CVS Reference : /CAN_6019B.pl/1.1/Tue Mar 8 12:42:22 2005// +// CVS Reference : /EMACB_6119A.pl/1.6/Wed Jul 13 15:05:35 2005// +// CVS Reference : /ADC_6051C.pl/1.1/Fri Oct 17 09:12:38 2003// +// ---------------------------------------------------------------------------- + +// Hardware register definition + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR System Peripherals +// ***************************************************************************** + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Advanced Interrupt Controller +// ***************************************************************************** +// *** Register offset in AT91S_AIC structure *** +#define AIC_SMR ( 0) // Source Mode Register +#define AIC_SVR (128) // Source Vector Register +#define AIC_IVR (256) // IRQ Vector Register +#define AIC_FVR (260) // FIQ Vector Register +#define AIC_ISR (264) // Interrupt Status Register +#define AIC_IPR (268) // Interrupt Pending Register +#define AIC_IMR (272) // Interrupt Mask Register +#define AIC_CISR (276) // Core Interrupt Status Register +#define AIC_IECR (288) // Interrupt Enable Command Register +#define AIC_IDCR (292) // Interrupt Disable Command Register +#define AIC_ICCR (296) // Interrupt Clear Command Register +#define AIC_ISCR (300) // Interrupt Set Command Register +#define AIC_EOICR (304) // End of Interrupt Command Register +#define AIC_SPU (308) // Spurious Vector Register +#define AIC_DCR (312) // Debug Control Register (Protect) +#define AIC_FFER (320) // Fast Forcing Enable Register +#define AIC_FFDR (324) // Fast Forcing Disable Register +#define AIC_FFSR (328) // Fast Forcing Status Register +// -------- AIC_SMR : (AIC Offset: 0x0) Control Register -------- +#define AT91C_AIC_PRIOR (0x7 << 0) // (AIC) Priority Level +#define AT91C_AIC_PRIOR_LOWEST (0x0) // (AIC) Lowest priority level +#define AT91C_AIC_PRIOR_HIGHEST (0x7) // (AIC) Highest priority level +#define AT91C_AIC_SRCTYPE (0x3 << 5) // (AIC) Interrupt Source Type +#define AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL (0x0 << 5) // (AIC) Internal Sources Code Label High-level Sensitive +#define AT91C_AIC_SRCTYPE_EXT_LOW_LEVEL (0x0 << 5) // (AIC) External Sources Code Label Low-level Sensitive +#define AT91C_AIC_SRCTYPE_INT_POSITIVE_EDGE (0x1 << 5) // (AIC) Internal Sources Code Label Positive Edge triggered +#define AT91C_AIC_SRCTYPE_EXT_NEGATIVE_EDGE (0x1 << 5) // (AIC) External Sources Code Label Negative Edge triggered +#define AT91C_AIC_SRCTYPE_HIGH_LEVEL (0x2 << 5) // (AIC) Internal Or External Sources Code Label High-level Sensitive +#define AT91C_AIC_SRCTYPE_POSITIVE_EDGE (0x3 << 5) // (AIC) Internal Or External Sources Code Label Positive Edge triggered +// -------- AIC_CISR : (AIC Offset: 0x114) AIC Core Interrupt Status Register -------- +#define AT91C_AIC_NFIQ (0x1 << 0) // (AIC) NFIQ Status +#define AT91C_AIC_NIRQ (0x1 << 1) // (AIC) NIRQ Status +// -------- AIC_DCR : (AIC Offset: 0x138) AIC Debug Control Register (Protect) -------- +#define AT91C_AIC_DCR_PROT (0x1 << 0) // (AIC) Protection Mode +#define AT91C_AIC_DCR_GMSK (0x1 << 1) // (AIC) General Mask + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Peripheral DMA Controller +// ***************************************************************************** +// *** Register offset in AT91S_PDC structure *** +#define PDC_RPR ( 0) // Receive Pointer Register +#define PDC_RCR ( 4) // Receive Counter Register +#define PDC_TPR ( 8) // Transmit Pointer Register +#define PDC_TCR (12) // Transmit Counter Register +#define PDC_RNPR (16) // Receive Next Pointer Register +#define PDC_RNCR (20) // Receive Next Counter Register +#define PDC_TNPR (24) // Transmit Next Pointer Register +#define PDC_TNCR (28) // Transmit Next Counter Register +#define PDC_PTCR (32) // PDC Transfer Control Register +#define PDC_PTSR (36) // PDC Transfer Status Register +// -------- PDC_PTCR : (PDC Offset: 0x20) PDC Transfer Control Register -------- +#define AT91C_PDC_RXTEN (0x1 << 0) // (PDC) Receiver Transfer Enable +#define AT91C_PDC_RXTDIS (0x1 << 1) // (PDC) Receiver Transfer Disable +#define AT91C_PDC_TXTEN (0x1 << 8) // (PDC) Transmitter Transfer Enable +#define AT91C_PDC_TXTDIS (0x1 << 9) // (PDC) Transmitter Transfer Disable +// -------- PDC_PTSR : (PDC Offset: 0x24) PDC Transfer Status Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Debug Unit +// ***************************************************************************** +// *** Register offset in AT91S_DBGU structure *** +#define DBGU_CR ( 0) // Control Register +#define DBGU_MR ( 4) // Mode Register +#define DBGU_IER ( 8) // Interrupt Enable Register +#define DBGU_IDR (12) // Interrupt Disable Register +#define DBGU_IMR (16) // Interrupt Mask Register +#define DBGU_CSR (20) // Channel Status Register +#define DBGU_RHR (24) // Receiver Holding Register +#define DBGU_THR (28) // Transmitter Holding Register +#define DBGU_BRGR (32) // Baud Rate Generator Register +#define DBGU_CIDR (64) // Chip ID Register +#define DBGU_EXID (68) // Chip ID Extension Register +#define DBGU_FNTR (72) // Force NTRST Register +#define DBGU_RPR (256) // Receive Pointer Register +#define DBGU_RCR (260) // Receive Counter Register +#define DBGU_TPR (264) // Transmit Pointer Register +#define DBGU_TCR (268) // Transmit Counter Register +#define DBGU_RNPR (272) // Receive Next Pointer Register +#define DBGU_RNCR (276) // Receive Next Counter Register +#define DBGU_TNPR (280) // Transmit Next Pointer Register +#define DBGU_TNCR (284) // Transmit Next Counter Register +#define DBGU_PTCR (288) // PDC Transfer Control Register +#define DBGU_PTSR (292) // PDC Transfer Status Register +// -------- DBGU_CR : (DBGU Offset: 0x0) Debug Unit Control Register -------- +#define AT91C_US_RSTRX (0x1 << 2) // (DBGU) Reset Receiver +#define AT91C_US_RSTTX (0x1 << 3) // (DBGU) Reset Transmitter +#define AT91C_US_RXEN (0x1 << 4) // (DBGU) Receiver Enable +#define AT91C_US_RXDIS (0x1 << 5) // (DBGU) Receiver Disable +#define AT91C_US_TXEN (0x1 << 6) // (DBGU) Transmitter Enable +#define AT91C_US_TXDIS (0x1 << 7) // (DBGU) Transmitter Disable +#define AT91C_US_RSTSTA (0x1 << 8) // (DBGU) Reset Status Bits +// -------- DBGU_MR : (DBGU Offset: 0x4) Debug Unit Mode Register -------- +#define AT91C_US_PAR (0x7 << 9) // (DBGU) Parity type +#define AT91C_US_PAR_EVEN (0x0 << 9) // (DBGU) Even Parity +#define AT91C_US_PAR_ODD (0x1 << 9) // (DBGU) Odd Parity +#define AT91C_US_PAR_SPACE (0x2 << 9) // (DBGU) Parity forced to 0 (Space) +#define AT91C_US_PAR_MARK (0x3 << 9) // (DBGU) Parity forced to 1 (Mark) +#define AT91C_US_PAR_NONE (0x4 << 9) // (DBGU) No Parity +#define AT91C_US_PAR_MULTI_DROP (0x6 << 9) // (DBGU) Multi-drop mode +#define AT91C_US_CHMODE (0x3 << 14) // (DBGU) Channel Mode +#define AT91C_US_CHMODE_NORMAL (0x0 << 14) // (DBGU) Normal Mode: The USART channel operates as an RX/TX USART. +#define AT91C_US_CHMODE_AUTO (0x1 << 14) // (DBGU) Automatic Echo: Receiver Data Input is connected to the TXD pin. +#define AT91C_US_CHMODE_LOCAL (0x2 << 14) // (DBGU) Local Loopback: Transmitter Output Signal is connected to Receiver Input Signal. +#define AT91C_US_CHMODE_REMOTE (0x3 << 14) // (DBGU) Remote Loopback: RXD pin is internally connected to TXD pin. +// -------- DBGU_IER : (DBGU Offset: 0x8) Debug Unit Interrupt Enable Register -------- +#define AT91C_US_RXRDY (0x1 << 0) // (DBGU) RXRDY Interrupt +#define AT91C_US_TXRDY (0x1 << 1) // (DBGU) TXRDY Interrupt +#define AT91C_US_ENDRX (0x1 << 3) // (DBGU) End of Receive Transfer Interrupt +#define AT91C_US_ENDTX (0x1 << 4) // (DBGU) End of Transmit Interrupt +#define AT91C_US_OVRE (0x1 << 5) // (DBGU) Overrun Interrupt +#define AT91C_US_FRAME (0x1 << 6) // (DBGU) Framing Error Interrupt +#define AT91C_US_PARE (0x1 << 7) // (DBGU) Parity Error Interrupt +#define AT91C_US_TXEMPTY (0x1 << 9) // (DBGU) TXEMPTY Interrupt +#define AT91C_US_TXBUFE (0x1 << 11) // (DBGU) TXBUFE Interrupt +#define AT91C_US_RXBUFF (0x1 << 12) // (DBGU) RXBUFF Interrupt +#define AT91C_US_COMM_TX (0x1 << 30) // (DBGU) COMM_TX Interrupt +#define AT91C_US_COMM_RX (0x1 << 31) // (DBGU) COMM_RX Interrupt +// -------- DBGU_IDR : (DBGU Offset: 0xc) Debug Unit Interrupt Disable Register -------- +// -------- DBGU_IMR : (DBGU Offset: 0x10) Debug Unit Interrupt Mask Register -------- +// -------- DBGU_CSR : (DBGU Offset: 0x14) Debug Unit Channel Status Register -------- +// -------- DBGU_FNTR : (DBGU Offset: 0x48) Debug Unit FORCE_NTRST Register -------- +#define AT91C_US_FORCE_NTRST (0x1 << 0) // (DBGU) Force NTRST in JTAG + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Parallel Input Output Controler +// ***************************************************************************** +// *** Register offset in AT91S_PIO structure *** +#define PIO_PER ( 0) // PIO Enable Register +#define PIO_PDR ( 4) // PIO Disable Register +#define PIO_PSR ( 8) // PIO Status Register +#define PIO_OER (16) // Output Enable Register +#define PIO_ODR (20) // Output Disable Registerr +#define PIO_OSR (24) // Output Status Register +#define PIO_IFER (32) // Input Filter Enable Register +#define PIO_IFDR (36) // Input Filter Disable Register +#define PIO_IFSR (40) // Input Filter Status Register +#define PIO_SODR (48) // Set Output Data Register +#define PIO_CODR (52) // Clear Output Data Register +#define PIO_ODSR (56) // Output Data Status Register +#define PIO_PDSR (60) // Pin Data Status Register +#define PIO_IER (64) // Interrupt Enable Register +#define PIO_IDR (68) // Interrupt Disable Register +#define PIO_IMR (72) // Interrupt Mask Register +#define PIO_ISR (76) // Interrupt Status Register +#define PIO_MDER (80) // Multi-driver Enable Register +#define PIO_MDDR (84) // Multi-driver Disable Register +#define PIO_MDSR (88) // Multi-driver Status Register +#define PIO_PPUDR (96) // Pull-up Disable Register +#define PIO_PPUER (100) // Pull-up Enable Register +#define PIO_PPUSR (104) // Pull-up Status Register +#define PIO_ASR (112) // Select A Register +#define PIO_BSR (116) // Select B Register +#define PIO_ABSR (120) // AB Select Status Register +#define PIO_OWER (160) // Output Write Enable Register +#define PIO_OWDR (164) // Output Write Disable Register +#define PIO_OWSR (168) // Output Write Status Register + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Clock Generator Controler +// ***************************************************************************** +// *** Register offset in AT91S_CKGR structure *** +#define CKGR_MOR ( 0) // Main Oscillator Register +#define CKGR_MCFR ( 4) // Main Clock Frequency Register +#define CKGR_PLLR (12) // PLL Register +// -------- CKGR_MOR : (CKGR Offset: 0x0) Main Oscillator Register -------- +#define AT91C_CKGR_MOSCEN (0x1 << 0) // (CKGR) Main Oscillator Enable +#define AT91C_CKGR_OSCBYPASS (0x1 << 1) // (CKGR) Main Oscillator Bypass +#define AT91C_CKGR_OSCOUNT (0xFF << 8) // (CKGR) Main Oscillator Start-up Time +// -------- CKGR_MCFR : (CKGR Offset: 0x4) Main Clock Frequency Register -------- +#define AT91C_CKGR_MAINF (0xFFFF << 0) // (CKGR) Main Clock Frequency +#define AT91C_CKGR_MAINRDY (0x1 << 16) // (CKGR) Main Clock Ready +// -------- CKGR_PLLR : (CKGR Offset: 0xc) PLL B Register -------- +#define AT91C_CKGR_DIV (0xFF << 0) // (CKGR) Divider Selected +#define AT91C_CKGR_DIV_0 (0x0) // (CKGR) Divider output is 0 +#define AT91C_CKGR_DIV_BYPASS (0x1) // (CKGR) Divider is bypassed +#define AT91C_CKGR_PLLCOUNT (0x3F << 8) // (CKGR) PLL Counter +#define AT91C_CKGR_OUT (0x3 << 14) // (CKGR) PLL Output Frequency Range +#define AT91C_CKGR_OUT_0 (0x0 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_OUT_1 (0x1 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_OUT_2 (0x2 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_OUT_3 (0x3 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_MUL (0x7FF << 16) // (CKGR) PLL Multiplier +#define AT91C_CKGR_USBDIV (0x3 << 28) // (CKGR) Divider for USB Clocks +#define AT91C_CKGR_USBDIV_0 (0x0 << 28) // (CKGR) Divider output is PLL clock output +#define AT91C_CKGR_USBDIV_1 (0x1 << 28) // (CKGR) Divider output is PLL clock output divided by 2 +#define AT91C_CKGR_USBDIV_2 (0x2 << 28) // (CKGR) Divider output is PLL clock output divided by 4 + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Power Management Controler +// ***************************************************************************** +// *** Register offset in AT91S_PMC structure *** +#define PMC_SCER ( 0) // System Clock Enable Register +#define PMC_SCDR ( 4) // System Clock Disable Register +#define PMC_SCSR ( 8) // System Clock Status Register +#define PMC_PCER (16) // Peripheral Clock Enable Register +#define PMC_PCDR (20) // Peripheral Clock Disable Register +#define PMC_PCSR (24) // Peripheral Clock Status Register +#define PMC_MOR (32) // Main Oscillator Register +#define PMC_MCFR (36) // Main Clock Frequency Register +#define PMC_PLLR (44) // PLL Register +#define PMC_MCKR (48) // Master Clock Register +#define PMC_PCKR (64) // Programmable Clock Register +#define PMC_IER (96) // Interrupt Enable Register +#define PMC_IDR (100) // Interrupt Disable Register +#define PMC_SR (104) // Status Register +#define PMC_IMR (108) // Interrupt Mask Register +// -------- PMC_SCER : (PMC Offset: 0x0) System Clock Enable Register -------- +#define AT91C_PMC_PCK (0x1 << 0) // (PMC) Processor Clock +#define AT91C_PMC_UDP (0x1 << 7) // (PMC) USB Device Port Clock +#define AT91C_PMC_PCK0 (0x1 << 8) // (PMC) Programmable Clock Output +#define AT91C_PMC_PCK1 (0x1 << 9) // (PMC) Programmable Clock Output +#define AT91C_PMC_PCK2 (0x1 << 10) // (PMC) Programmable Clock Output +#define AT91C_PMC_PCK3 (0x1 << 11) // (PMC) Programmable Clock Output +// -------- PMC_SCDR : (PMC Offset: 0x4) System Clock Disable Register -------- +// -------- PMC_SCSR : (PMC Offset: 0x8) System Clock Status Register -------- +// -------- CKGR_MOR : (PMC Offset: 0x20) Main Oscillator Register -------- +// -------- CKGR_MCFR : (PMC Offset: 0x24) Main Clock Frequency Register -------- +// -------- CKGR_PLLR : (PMC Offset: 0x2c) PLL B Register -------- +// -------- PMC_MCKR : (PMC Offset: 0x30) Master Clock Register -------- +#define AT91C_PMC_CSS (0x3 << 0) // (PMC) Programmable Clock Selection +#define AT91C_PMC_CSS_SLOW_CLK (0x0) // (PMC) Slow Clock is selected +#define AT91C_PMC_CSS_MAIN_CLK (0x1) // (PMC) Main Clock is selected +#define AT91C_PMC_CSS_PLL_CLK (0x3) // (PMC) Clock from PLL is selected +#define AT91C_PMC_PRES (0x7 << 2) // (PMC) Programmable Clock Prescaler +#define AT91C_PMC_PRES_CLK (0x0 << 2) // (PMC) Selected clock +#define AT91C_PMC_PRES_CLK_2 (0x1 << 2) // (PMC) Selected clock divided by 2 +#define AT91C_PMC_PRES_CLK_4 (0x2 << 2) // (PMC) Selected clock divided by 4 +#define AT91C_PMC_PRES_CLK_8 (0x3 << 2) // (PMC) Selected clock divided by 8 +#define AT91C_PMC_PRES_CLK_16 (0x4 << 2) // (PMC) Selected clock divided by 16 +#define AT91C_PMC_PRES_CLK_32 (0x5 << 2) // (PMC) Selected clock divided by 32 +#define AT91C_PMC_PRES_CLK_64 (0x6 << 2) // (PMC) Selected clock divided by 64 +// -------- PMC_PCKR : (PMC Offset: 0x40) Programmable Clock Register -------- +// -------- PMC_IER : (PMC Offset: 0x60) PMC Interrupt Enable Register -------- +#define AT91C_PMC_MOSCS (0x1 << 0) // (PMC) MOSC Status/Enable/Disable/Mask +#define AT91C_PMC_LOCK (0x1 << 2) // (PMC) PLL Status/Enable/Disable/Mask +#define AT91C_PMC_MCKRDY (0x1 << 3) // (PMC) MCK_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK0RDY (0x1 << 8) // (PMC) PCK0_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK1RDY (0x1 << 9) // (PMC) PCK1_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK2RDY (0x1 << 10) // (PMC) PCK2_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK3RDY (0x1 << 11) // (PMC) PCK3_RDY Status/Enable/Disable/Mask +// -------- PMC_IDR : (PMC Offset: 0x64) PMC Interrupt Disable Register -------- +// -------- PMC_SR : (PMC Offset: 0x68) PMC Status Register -------- +// -------- PMC_IMR : (PMC Offset: 0x6c) PMC Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Reset Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_RSTC structure *** +#define RSTC_RCR ( 0) // Reset Control Register +#define RSTC_RSR ( 4) // Reset Status Register +#define RSTC_RMR ( 8) // Reset Mode Register +// -------- RSTC_RCR : (RSTC Offset: 0x0) Reset Control Register -------- +#define AT91C_RSTC_PROCRST (0x1 << 0) // (RSTC) Processor Reset +#define AT91C_RSTC_PERRST (0x1 << 2) // (RSTC) Peripheral Reset +#define AT91C_RSTC_EXTRST (0x1 << 3) // (RSTC) External Reset +#define AT91C_RSTC_KEY (0xFF << 24) // (RSTC) Password +// -------- RSTC_RSR : (RSTC Offset: 0x4) Reset Status Register -------- +#define AT91C_RSTC_URSTS (0x1 << 0) // (RSTC) User Reset Status +#define AT91C_RSTC_BODSTS (0x1 << 1) // (RSTC) Brownout Detection Status +#define AT91C_RSTC_RSTTYP (0x7 << 8) // (RSTC) Reset Type +#define AT91C_RSTC_RSTTYP_POWERUP (0x0 << 8) // (RSTC) Power-up Reset. VDDCORE rising. +#define AT91C_RSTC_RSTTYP_WAKEUP (0x1 << 8) // (RSTC) WakeUp Reset. VDDCORE rising. +#define AT91C_RSTC_RSTTYP_WATCHDOG (0x2 << 8) // (RSTC) Watchdog Reset. Watchdog overflow occured. +#define AT91C_RSTC_RSTTYP_SOFTWARE (0x3 << 8) // (RSTC) Software Reset. Processor reset required by the software. +#define AT91C_RSTC_RSTTYP_USER (0x4 << 8) // (RSTC) User Reset. NRST pin detected low. +#define AT91C_RSTC_RSTTYP_BROWNOUT (0x5 << 8) // (RSTC) Brownout Reset occured. +#define AT91C_RSTC_NRSTL (0x1 << 16) // (RSTC) NRST pin level +#define AT91C_RSTC_SRCMP (0x1 << 17) // (RSTC) Software Reset Command in Progress. +// -------- RSTC_RMR : (RSTC Offset: 0x8) Reset Mode Register -------- +#define AT91C_RSTC_URSTEN (0x1 << 0) // (RSTC) User Reset Enable +#define AT91C_RSTC_URSTIEN (0x1 << 4) // (RSTC) User Reset Interrupt Enable +#define AT91C_RSTC_ERSTL (0xF << 8) // (RSTC) User Reset Length +#define AT91C_RSTC_BODIEN (0x1 << 16) // (RSTC) Brownout Detection Interrupt Enable + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Real Time Timer Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_RTTC structure *** +#define RTTC_RTMR ( 0) // Real-time Mode Register +#define RTTC_RTAR ( 4) // Real-time Alarm Register +#define RTTC_RTVR ( 8) // Real-time Value Register +#define RTTC_RTSR (12) // Real-time Status Register +// -------- RTTC_RTMR : (RTTC Offset: 0x0) Real-time Mode Register -------- +#define AT91C_RTTC_RTPRES (0xFFFF << 0) // (RTTC) Real-time Timer Prescaler Value +#define AT91C_RTTC_ALMIEN (0x1 << 16) // (RTTC) Alarm Interrupt Enable +#define AT91C_RTTC_RTTINCIEN (0x1 << 17) // (RTTC) Real Time Timer Increment Interrupt Enable +#define AT91C_RTTC_RTTRST (0x1 << 18) // (RTTC) Real Time Timer Restart +// -------- RTTC_RTAR : (RTTC Offset: 0x4) Real-time Alarm Register -------- +#define AT91C_RTTC_ALMV (0x0 << 0) // (RTTC) Alarm Value +// -------- RTTC_RTVR : (RTTC Offset: 0x8) Current Real-time Value Register -------- +#define AT91C_RTTC_CRTV (0x0 << 0) // (RTTC) Current Real-time Value +// -------- RTTC_RTSR : (RTTC Offset: 0xc) Real-time Status Register -------- +#define AT91C_RTTC_ALMS (0x1 << 0) // (RTTC) Real-time Alarm Status +#define AT91C_RTTC_RTTINC (0x1 << 1) // (RTTC) Real-time Timer Increment + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Periodic Interval Timer Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_PITC structure *** +#define PITC_PIMR ( 0) // Period Interval Mode Register +#define PITC_PISR ( 4) // Period Interval Status Register +#define PITC_PIVR ( 8) // Period Interval Value Register +#define PITC_PIIR (12) // Period Interval Image Register +// -------- PITC_PIMR : (PITC Offset: 0x0) Periodic Interval Mode Register -------- +#define AT91C_PITC_PIV (0xFFFFF << 0) // (PITC) Periodic Interval Value +#define AT91C_PITC_PITEN (0x1 << 24) // (PITC) Periodic Interval Timer Enabled +#define AT91C_PITC_PITIEN (0x1 << 25) // (PITC) Periodic Interval Timer Interrupt Enable +// -------- PITC_PISR : (PITC Offset: 0x4) Periodic Interval Status Register -------- +#define AT91C_PITC_PITS (0x1 << 0) // (PITC) Periodic Interval Timer Status +// -------- PITC_PIVR : (PITC Offset: 0x8) Periodic Interval Value Register -------- +#define AT91C_PITC_CPIV (0xFFFFF << 0) // (PITC) Current Periodic Interval Value +#define AT91C_PITC_PICNT (0xFFF << 20) // (PITC) Periodic Interval Counter +// -------- PITC_PIIR : (PITC Offset: 0xc) Periodic Interval Image Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Watchdog Timer Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_WDTC structure *** +#define WDTC_WDCR ( 0) // Watchdog Control Register +#define WDTC_WDMR ( 4) // Watchdog Mode Register +#define WDTC_WDSR ( 8) // Watchdog Status Register +// -------- WDTC_WDCR : (WDTC Offset: 0x0) Periodic Interval Image Register -------- +#define AT91C_WDTC_WDRSTT (0x1 << 0) // (WDTC) Watchdog Restart +#define AT91C_WDTC_KEY (0xFF << 24) // (WDTC) Watchdog KEY Password +// -------- WDTC_WDMR : (WDTC Offset: 0x4) Watchdog Mode Register -------- +#define AT91C_WDTC_WDV (0xFFF << 0) // (WDTC) Watchdog Timer Restart +#define AT91C_WDTC_WDFIEN (0x1 << 12) // (WDTC) Watchdog Fault Interrupt Enable +#define AT91C_WDTC_WDRSTEN (0x1 << 13) // (WDTC) Watchdog Reset Enable +#define AT91C_WDTC_WDRPROC (0x1 << 14) // (WDTC) Watchdog Timer Restart +#define AT91C_WDTC_WDDIS (0x1 << 15) // (WDTC) Watchdog Disable +#define AT91C_WDTC_WDD (0xFFF << 16) // (WDTC) Watchdog Delta Value +#define AT91C_WDTC_WDDBGHLT (0x1 << 28) // (WDTC) Watchdog Debug Halt +#define AT91C_WDTC_WDIDLEHLT (0x1 << 29) // (WDTC) Watchdog Idle Halt +// -------- WDTC_WDSR : (WDTC Offset: 0x8) Watchdog Status Register -------- +#define AT91C_WDTC_WDUNF (0x1 << 0) // (WDTC) Watchdog Underflow +#define AT91C_WDTC_WDERR (0x1 << 1) // (WDTC) Watchdog Error + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Voltage Regulator Mode Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_VREG structure *** +#define VREG_MR ( 0) // Voltage Regulator Mode Register +// -------- VREG_MR : (VREG Offset: 0x0) Voltage Regulator Mode Register -------- +#define AT91C_VREG_PSTDBY (0x1 << 0) // (VREG) Voltage Regulator Power Standby Mode + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Memory Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_MC structure *** +#define MC_RCR ( 0) // MC Remap Control Register +#define MC_ASR ( 4) // MC Abort Status Register +#define MC_AASR ( 8) // MC Abort Address Status Register +#define MC_FMR (96) // MC Flash Mode Register +#define MC_FCR (100) // MC Flash Command Register +#define MC_FSR (104) // MC Flash Status Register +// -------- MC_RCR : (MC Offset: 0x0) MC Remap Control Register -------- +#define AT91C_MC_RCB (0x1 << 0) // (MC) Remap Command Bit +// -------- MC_ASR : (MC Offset: 0x4) MC Abort Status Register -------- +#define AT91C_MC_UNDADD (0x1 << 0) // (MC) Undefined Addess Abort Status +#define AT91C_MC_MISADD (0x1 << 1) // (MC) Misaligned Addess Abort Status +#define AT91C_MC_ABTSZ (0x3 << 8) // (MC) Abort Size Status +#define AT91C_MC_ABTSZ_BYTE (0x0 << 8) // (MC) Byte +#define AT91C_MC_ABTSZ_HWORD (0x1 << 8) // (MC) Half-word +#define AT91C_MC_ABTSZ_WORD (0x2 << 8) // (MC) Word +#define AT91C_MC_ABTTYP (0x3 << 10) // (MC) Abort Type Status +#define AT91C_MC_ABTTYP_DATAR (0x0 << 10) // (MC) Data Read +#define AT91C_MC_ABTTYP_DATAW (0x1 << 10) // (MC) Data Write +#define AT91C_MC_ABTTYP_FETCH (0x2 << 10) // (MC) Code Fetch +#define AT91C_MC_MST0 (0x1 << 16) // (MC) Master 0 Abort Source +#define AT91C_MC_MST1 (0x1 << 17) // (MC) Master 1 Abort Source +#define AT91C_MC_SVMST0 (0x1 << 24) // (MC) Saved Master 0 Abort Source +#define AT91C_MC_SVMST1 (0x1 << 25) // (MC) Saved Master 1 Abort Source +// -------- MC_FMR : (MC Offset: 0x60) MC Flash Mode Register -------- +#define AT91C_MC_FRDY (0x1 << 0) // (MC) Flash Ready +#define AT91C_MC_LOCKE (0x1 << 2) // (MC) Lock Error +#define AT91C_MC_PROGE (0x1 << 3) // (MC) Programming Error +#define AT91C_MC_NEBP (0x1 << 7) // (MC) No Erase Before Programming +#define AT91C_MC_FWS (0x3 << 8) // (MC) Flash Wait State +#define AT91C_MC_FWS_0FWS (0x0 << 8) // (MC) 1 cycle for Read, 2 for Write operations +#define AT91C_MC_FWS_1FWS (0x1 << 8) // (MC) 2 cycles for Read, 3 for Write operations +#define AT91C_MC_FWS_2FWS (0x2 << 8) // (MC) 3 cycles for Read, 4 for Write operations +#define AT91C_MC_FWS_3FWS (0x3 << 8) // (MC) 4 cycles for Read, 4 for Write operations +#define AT91C_MC_FMCN (0xFF << 16) // (MC) Flash Microsecond Cycle Number +// -------- MC_FCR : (MC Offset: 0x64) MC Flash Command Register -------- +#define AT91C_MC_FCMD (0xF << 0) // (MC) Flash Command +#define AT91C_MC_FCMD_START_PROG (0x1) // (MC) Starts the programming of th epage specified by PAGEN. +#define AT91C_MC_FCMD_LOCK (0x2) // (MC) Starts a lock sequence of the sector defined by the bits 4 to 7 of the field PAGEN. +#define AT91C_MC_FCMD_PROG_AND_LOCK (0x3) // (MC) The lock sequence automatically happens after the programming sequence is completed. +#define AT91C_MC_FCMD_UNLOCK (0x4) // (MC) Starts an unlock sequence of the sector defined by the bits 4 to 7 of the field PAGEN. +#define AT91C_MC_FCMD_ERASE_ALL (0x8) // (MC) Starts the erase of the entire flash.If at least a page is locked, the command is cancelled. +#define AT91C_MC_FCMD_SET_GP_NVM (0xB) // (MC) Set General Purpose NVM bits. +#define AT91C_MC_FCMD_CLR_GP_NVM (0xD) // (MC) Clear General Purpose NVM bits. +#define AT91C_MC_FCMD_SET_SECURITY (0xF) // (MC) Set Security Bit. +#define AT91C_MC_PAGEN (0x3FF << 8) // (MC) Page Number +#define AT91C_MC_KEY (0xFF << 24) // (MC) Writing Protect Key +// -------- MC_FSR : (MC Offset: 0x68) MC Flash Command Register -------- +#define AT91C_MC_SECURITY (0x1 << 4) // (MC) Security Bit Status +#define AT91C_MC_GPNVM0 (0x1 << 8) // (MC) Sector 0 Lock Status +#define AT91C_MC_GPNVM1 (0x1 << 9) // (MC) Sector 1 Lock Status +#define AT91C_MC_GPNVM2 (0x1 << 10) // (MC) Sector 2 Lock Status +#define AT91C_MC_GPNVM3 (0x1 << 11) // (MC) Sector 3 Lock Status +#define AT91C_MC_GPNVM4 (0x1 << 12) // (MC) Sector 4 Lock Status +#define AT91C_MC_GPNVM5 (0x1 << 13) // (MC) Sector 5 Lock Status +#define AT91C_MC_GPNVM6 (0x1 << 14) // (MC) Sector 6 Lock Status +#define AT91C_MC_GPNVM7 (0x1 << 15) // (MC) Sector 7 Lock Status +#define AT91C_MC_LOCKS0 (0x1 << 16) // (MC) Sector 0 Lock Status +#define AT91C_MC_LOCKS1 (0x1 << 17) // (MC) Sector 1 Lock Status +#define AT91C_MC_LOCKS2 (0x1 << 18) // (MC) Sector 2 Lock Status +#define AT91C_MC_LOCKS3 (0x1 << 19) // (MC) Sector 3 Lock Status +#define AT91C_MC_LOCKS4 (0x1 << 20) // (MC) Sector 4 Lock Status +#define AT91C_MC_LOCKS5 (0x1 << 21) // (MC) Sector 5 Lock Status +#define AT91C_MC_LOCKS6 (0x1 << 22) // (MC) Sector 6 Lock Status +#define AT91C_MC_LOCKS7 (0x1 << 23) // (MC) Sector 7 Lock Status +#define AT91C_MC_LOCKS8 (0x1 << 24) // (MC) Sector 8 Lock Status +#define AT91C_MC_LOCKS9 (0x1 << 25) // (MC) Sector 9 Lock Status +#define AT91C_MC_LOCKS10 (0x1 << 26) // (MC) Sector 10 Lock Status +#define AT91C_MC_LOCKS11 (0x1 << 27) // (MC) Sector 11 Lock Status +#define AT91C_MC_LOCKS12 (0x1 << 28) // (MC) Sector 12 Lock Status +#define AT91C_MC_LOCKS13 (0x1 << 29) // (MC) Sector 13 Lock Status +#define AT91C_MC_LOCKS14 (0x1 << 30) // (MC) Sector 14 Lock Status +#define AT91C_MC_LOCKS15 (0x1 << 31) // (MC) Sector 15 Lock Status + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Serial Parallel Interface +// ***************************************************************************** +// *** Register offset in AT91S_SPI structure *** +#define SPI_CR ( 0) // Control Register +#define SPI_MR ( 4) // Mode Register +#define SPI_RDR ( 8) // Receive Data Register +#define SPI_TDR (12) // Transmit Data Register +#define SPI_SR (16) // Status Register +#define SPI_IER (20) // Interrupt Enable Register +#define SPI_IDR (24) // Interrupt Disable Register +#define SPI_IMR (28) // Interrupt Mask Register +#define SPI_CSR (48) // Chip Select Register +#define SPI_RPR (256) // Receive Pointer Register +#define SPI_RCR (260) // Receive Counter Register +#define SPI_TPR (264) // Transmit Pointer Register +#define SPI_TCR (268) // Transmit Counter Register +#define SPI_RNPR (272) // Receive Next Pointer Register +#define SPI_RNCR (276) // Receive Next Counter Register +#define SPI_TNPR (280) // Transmit Next Pointer Register +#define SPI_TNCR (284) // Transmit Next Counter Register +#define SPI_PTCR (288) // PDC Transfer Control Register +#define SPI_PTSR (292) // PDC Transfer Status Register +// -------- SPI_CR : (SPI Offset: 0x0) SPI Control Register -------- +#define AT91C_SPI_SPIEN (0x1 << 0) // (SPI) SPI Enable +#define AT91C_SPI_SPIDIS (0x1 << 1) // (SPI) SPI Disable +#define AT91C_SPI_SWRST (0x1 << 7) // (SPI) SPI Software reset +#define AT91C_SPI_LASTXFER (0x1 << 24) // (SPI) SPI Last Transfer +// -------- SPI_MR : (SPI Offset: 0x4) SPI Mode Register -------- +#define AT91C_SPI_MSTR (0x1 << 0) // (SPI) Master/Slave Mode +#define AT91C_SPI_PS (0x1 << 1) // (SPI) Peripheral Select +#define AT91C_SPI_PS_FIXED (0x0 << 1) // (SPI) Fixed Peripheral Select +#define AT91C_SPI_PS_VARIABLE (0x1 << 1) // (SPI) Variable Peripheral Select +#define AT91C_SPI_PCSDEC (0x1 << 2) // (SPI) Chip Select Decode +#define AT91C_SPI_FDIV (0x1 << 3) // (SPI) Clock Selection +#define AT91C_SPI_MODFDIS (0x1 << 4) // (SPI) Mode Fault Detection +#define AT91C_SPI_LLB (0x1 << 7) // (SPI) Clock Selection +#define AT91C_SPI_PCS (0xF << 16) // (SPI) Peripheral Chip Select +#define AT91C_SPI_DLYBCS (0xFF << 24) // (SPI) Delay Between Chip Selects +// -------- SPI_RDR : (SPI Offset: 0x8) Receive Data Register -------- +#define AT91C_SPI_RD (0xFFFF << 0) // (SPI) Receive Data +#define AT91C_SPI_RPCS (0xF << 16) // (SPI) Peripheral Chip Select Status +// -------- SPI_TDR : (SPI Offset: 0xc) Transmit Data Register -------- +#define AT91C_SPI_TD (0xFFFF << 0) // (SPI) Transmit Data +#define AT91C_SPI_TPCS (0xF << 16) // (SPI) Peripheral Chip Select Status +// -------- SPI_SR : (SPI Offset: 0x10) Status Register -------- +#define AT91C_SPI_RDRF (0x1 << 0) // (SPI) Receive Data Register Full +#define AT91C_SPI_TDRE (0x1 << 1) // (SPI) Transmit Data Register Empty +#define AT91C_SPI_MODF (0x1 << 2) // (SPI) Mode Fault Error +#define AT91C_SPI_OVRES (0x1 << 3) // (SPI) Overrun Error Status +#define AT91C_SPI_ENDRX (0x1 << 4) // (SPI) End of Receiver Transfer +#define AT91C_SPI_ENDTX (0x1 << 5) // (SPI) End of Receiver Transfer +#define AT91C_SPI_RXBUFF (0x1 << 6) // (SPI) RXBUFF Interrupt +#define AT91C_SPI_TXBUFE (0x1 << 7) // (SPI) TXBUFE Interrupt +#define AT91C_SPI_NSSR (0x1 << 8) // (SPI) NSSR Interrupt +#define AT91C_SPI_TXEMPTY (0x1 << 9) // (SPI) TXEMPTY Interrupt +#define AT91C_SPI_SPIENS (0x1 << 16) // (SPI) Enable Status +// -------- SPI_IER : (SPI Offset: 0x14) Interrupt Enable Register -------- +// -------- SPI_IDR : (SPI Offset: 0x18) Interrupt Disable Register -------- +// -------- SPI_IMR : (SPI Offset: 0x1c) Interrupt Mask Register -------- +// -------- SPI_CSR : (SPI Offset: 0x30) Chip Select Register -------- +#define AT91C_SPI_CPOL (0x1 << 0) // (SPI) Clock Polarity +#define AT91C_SPI_NCPHA (0x1 << 1) // (SPI) Clock Phase +#define AT91C_SPI_CSAAT (0x1 << 3) // (SPI) Chip Select Active After Transfer +#define AT91C_SPI_BITS (0xF << 4) // (SPI) Bits Per Transfer +#define AT91C_SPI_BITS_8 (0x0 << 4) // (SPI) 8 Bits Per transfer +#define AT91C_SPI_BITS_9 (0x1 << 4) // (SPI) 9 Bits Per transfer +#define AT91C_SPI_BITS_10 (0x2 << 4) // (SPI) 10 Bits Per transfer +#define AT91C_SPI_BITS_11 (0x3 << 4) // (SPI) 11 Bits Per transfer +#define AT91C_SPI_BITS_12 (0x4 << 4) // (SPI) 12 Bits Per transfer +#define AT91C_SPI_BITS_13 (0x5 << 4) // (SPI) 13 Bits Per transfer +#define AT91C_SPI_BITS_14 (0x6 << 4) // (SPI) 14 Bits Per transfer +#define AT91C_SPI_BITS_15 (0x7 << 4) // (SPI) 15 Bits Per transfer +#define AT91C_SPI_BITS_16 (0x8 << 4) // (SPI) 16 Bits Per transfer +#define AT91C_SPI_SCBR (0xFF << 8) // (SPI) Serial Clock Baud Rate +#define AT91C_SPI_DLYBS (0xFF << 16) // (SPI) Delay Before SPCK +#define AT91C_SPI_DLYBCT (0xFF << 24) // (SPI) Delay Between Consecutive Transfers + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Usart +// ***************************************************************************** +// *** Register offset in AT91S_USART structure *** +#define US_CR ( 0) // Control Register +#define US_MR ( 4) // Mode Register +#define US_IER ( 8) // Interrupt Enable Register +#define US_IDR (12) // Interrupt Disable Register +#define US_IMR (16) // Interrupt Mask Register +#define US_CSR (20) // Channel Status Register +#define US_RHR (24) // Receiver Holding Register +#define US_THR (28) // Transmitter Holding Register +#define US_BRGR (32) // Baud Rate Generator Register +#define US_RTOR (36) // Receiver Time-out Register +#define US_TTGR (40) // Transmitter Time-guard Register +#define US_FIDI (64) // FI_DI_Ratio Register +#define US_NER (68) // Nb Errors Register +#define US_IF (76) // IRDA_FILTER Register +#define US_RPR (256) // Receive Pointer Register +#define US_RCR (260) // Receive Counter Register +#define US_TPR (264) // Transmit Pointer Register +#define US_TCR (268) // Transmit Counter Register +#define US_RNPR (272) // Receive Next Pointer Register +#define US_RNCR (276) // Receive Next Counter Register +#define US_TNPR (280) // Transmit Next Pointer Register +#define US_TNCR (284) // Transmit Next Counter Register +#define US_PTCR (288) // PDC Transfer Control Register +#define US_PTSR (292) // PDC Transfer Status Register +// -------- US_CR : (USART Offset: 0x0) Debug Unit Control Register -------- +#define AT91C_US_STTBRK (0x1 << 9) // (USART) Start Break +#define AT91C_US_STPBRK (0x1 << 10) // (USART) Stop Break +#define AT91C_US_STTTO (0x1 << 11) // (USART) Start Time-out +#define AT91C_US_SENDA (0x1 << 12) // (USART) Send Address +#define AT91C_US_RSTIT (0x1 << 13) // (USART) Reset Iterations +#define AT91C_US_RSTNACK (0x1 << 14) // (USART) Reset Non Acknowledge +#define AT91C_US_RETTO (0x1 << 15) // (USART) Rearm Time-out +#define AT91C_US_DTREN (0x1 << 16) // (USART) Data Terminal ready Enable +#define AT91C_US_DTRDIS (0x1 << 17) // (USART) Data Terminal ready Disable +#define AT91C_US_RTSEN (0x1 << 18) // (USART) Request to Send enable +#define AT91C_US_RTSDIS (0x1 << 19) // (USART) Request to Send Disable +// -------- US_MR : (USART Offset: 0x4) Debug Unit Mode Register -------- +#define AT91C_US_USMODE (0xF << 0) // (USART) Usart mode +#define AT91C_US_USMODE_NORMAL (0x0) // (USART) Normal +#define AT91C_US_USMODE_RS485 (0x1) // (USART) RS485 +#define AT91C_US_USMODE_HWHSH (0x2) // (USART) Hardware Handshaking +#define AT91C_US_USMODE_MODEM (0x3) // (USART) Modem +#define AT91C_US_USMODE_ISO7816_0 (0x4) // (USART) ISO7816 protocol: T = 0 +#define AT91C_US_USMODE_ISO7816_1 (0x6) // (USART) ISO7816 protocol: T = 1 +#define AT91C_US_USMODE_IRDA (0x8) // (USART) IrDA +#define AT91C_US_USMODE_SWHSH (0xC) // (USART) Software Handshaking +#define AT91C_US_CLKS (0x3 << 4) // (USART) Clock Selection (Baud Rate generator Input Clock +#define AT91C_US_CLKS_CLOCK (0x0 << 4) // (USART) Clock +#define AT91C_US_CLKS_FDIV1 (0x1 << 4) // (USART) fdiv1 +#define AT91C_US_CLKS_SLOW (0x2 << 4) // (USART) slow_clock (ARM) +#define AT91C_US_CLKS_EXT (0x3 << 4) // (USART) External (SCK) +#define AT91C_US_CHRL (0x3 << 6) // (USART) Clock Selection (Baud Rate generator Input Clock +#define AT91C_US_CHRL_5_BITS (0x0 << 6) // (USART) Character Length: 5 bits +#define AT91C_US_CHRL_6_BITS (0x1 << 6) // (USART) Character Length: 6 bits +#define AT91C_US_CHRL_7_BITS (0x2 << 6) // (USART) Character Length: 7 bits +#define AT91C_US_CHRL_8_BITS (0x3 << 6) // (USART) Character Length: 8 bits +#define AT91C_US_SYNC (0x1 << 8) // (USART) Synchronous Mode Select +#define AT91C_US_NBSTOP (0x3 << 12) // (USART) Number of Stop bits +#define AT91C_US_NBSTOP_1_BIT (0x0 << 12) // (USART) 1 stop bit +#define AT91C_US_NBSTOP_15_BIT (0x1 << 12) // (USART) Asynchronous (SYNC=0) 2 stop bits Synchronous (SYNC=1) 2 stop bits +#define AT91C_US_NBSTOP_2_BIT (0x2 << 12) // (USART) 2 stop bits +#define AT91C_US_MSBF (0x1 << 16) // (USART) Bit Order +#define AT91C_US_MODE9 (0x1 << 17) // (USART) 9-bit Character length +#define AT91C_US_CKLO (0x1 << 18) // (USART) Clock Output Select +#define AT91C_US_OVER (0x1 << 19) // (USART) Over Sampling Mode +#define AT91C_US_INACK (0x1 << 20) // (USART) Inhibit Non Acknowledge +#define AT91C_US_DSNACK (0x1 << 21) // (USART) Disable Successive NACK +#define AT91C_US_MAX_ITER (0x1 << 24) // (USART) Number of Repetitions +#define AT91C_US_FILTER (0x1 << 28) // (USART) Receive Line Filter +// -------- US_IER : (USART Offset: 0x8) Debug Unit Interrupt Enable Register -------- +#define AT91C_US_RXBRK (0x1 << 2) // (USART) Break Received/End of Break +#define AT91C_US_TIMEOUT (0x1 << 8) // (USART) Receiver Time-out +#define AT91C_US_ITERATION (0x1 << 10) // (USART) Max number of Repetitions Reached +#define AT91C_US_NACK (0x1 << 13) // (USART) Non Acknowledge +#define AT91C_US_RIIC (0x1 << 16) // (USART) Ring INdicator Input Change Flag +#define AT91C_US_DSRIC (0x1 << 17) // (USART) Data Set Ready Input Change Flag +#define AT91C_US_DCDIC (0x1 << 18) // (USART) Data Carrier Flag +#define AT91C_US_CTSIC (0x1 << 19) // (USART) Clear To Send Input Change Flag +// -------- US_IDR : (USART Offset: 0xc) Debug Unit Interrupt Disable Register -------- +// -------- US_IMR : (USART Offset: 0x10) Debug Unit Interrupt Mask Register -------- +// -------- US_CSR : (USART Offset: 0x14) Debug Unit Channel Status Register -------- +#define AT91C_US_RI (0x1 << 20) // (USART) Image of RI Input +#define AT91C_US_DSR (0x1 << 21) // (USART) Image of DSR Input +#define AT91C_US_DCD (0x1 << 22) // (USART) Image of DCD Input +#define AT91C_US_CTS (0x1 << 23) // (USART) Image of CTS Input + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Synchronous Serial Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_SSC structure *** +#define SSC_CR ( 0) // Control Register +#define SSC_CMR ( 4) // Clock Mode Register +#define SSC_RCMR (16) // Receive Clock ModeRegister +#define SSC_RFMR (20) // Receive Frame Mode Register +#define SSC_TCMR (24) // Transmit Clock Mode Register +#define SSC_TFMR (28) // Transmit Frame Mode Register +#define SSC_RHR (32) // Receive Holding Register +#define SSC_THR (36) // Transmit Holding Register +#define SSC_RSHR (48) // Receive Sync Holding Register +#define SSC_TSHR (52) // Transmit Sync Holding Register +#define SSC_SR (64) // Status Register +#define SSC_IER (68) // Interrupt Enable Register +#define SSC_IDR (72) // Interrupt Disable Register +#define SSC_IMR (76) // Interrupt Mask Register +#define SSC_RPR (256) // Receive Pointer Register +#define SSC_RCR (260) // Receive Counter Register +#define SSC_TPR (264) // Transmit Pointer Register +#define SSC_TCR (268) // Transmit Counter Register +#define SSC_RNPR (272) // Receive Next Pointer Register +#define SSC_RNCR (276) // Receive Next Counter Register +#define SSC_TNPR (280) // Transmit Next Pointer Register +#define SSC_TNCR (284) // Transmit Next Counter Register +#define SSC_PTCR (288) // PDC Transfer Control Register +#define SSC_PTSR (292) // PDC Transfer Status Register +// -------- SSC_CR : (SSC Offset: 0x0) SSC Control Register -------- +#define AT91C_SSC_RXEN (0x1 << 0) // (SSC) Receive Enable +#define AT91C_SSC_RXDIS (0x1 << 1) // (SSC) Receive Disable +#define AT91C_SSC_TXEN (0x1 << 8) // (SSC) Transmit Enable +#define AT91C_SSC_TXDIS (0x1 << 9) // (SSC) Transmit Disable +#define AT91C_SSC_SWRST (0x1 << 15) // (SSC) Software Reset +// -------- SSC_RCMR : (SSC Offset: 0x10) SSC Receive Clock Mode Register -------- +#define AT91C_SSC_CKS (0x3 << 0) // (SSC) Receive/Transmit Clock Selection +#define AT91C_SSC_CKS_DIV (0x0) // (SSC) Divided Clock +#define AT91C_SSC_CKS_TK (0x1) // (SSC) TK Clock signal +#define AT91C_SSC_CKS_RK (0x2) // (SSC) RK pin +#define AT91C_SSC_CKO (0x7 << 2) // (SSC) Receive/Transmit Clock Output Mode Selection +#define AT91C_SSC_CKO_NONE (0x0 << 2) // (SSC) Receive/Transmit Clock Output Mode: None RK pin: Input-only +#define AT91C_SSC_CKO_CONTINOUS (0x1 << 2) // (SSC) Continuous Receive/Transmit Clock RK pin: Output +#define AT91C_SSC_CKO_DATA_TX (0x2 << 2) // (SSC) Receive/Transmit Clock only during data transfers RK pin: Output +#define AT91C_SSC_CKI (0x1 << 5) // (SSC) Receive/Transmit Clock Inversion +#define AT91C_SSC_CKG (0x3 << 6) // (SSC) Receive/Transmit Clock Gating Selection +#define AT91C_SSC_CKG_NONE (0x0 << 6) // (SSC) Receive/Transmit Clock Gating: None, continuous clock +#define AT91C_SSC_CKG_LOW (0x1 << 6) // (SSC) Receive/Transmit Clock enabled only if RF Low +#define AT91C_SSC_CKG_HIGH (0x2 << 6) // (SSC) Receive/Transmit Clock enabled only if RF High +#define AT91C_SSC_START (0xF << 8) // (SSC) Receive/Transmit Start Selection +#define AT91C_SSC_START_CONTINOUS (0x0 << 8) // (SSC) Continuous, as soon as the receiver is enabled, and immediately after the end of transfer of the previous data. +#define AT91C_SSC_START_TX (0x1 << 8) // (SSC) Transmit/Receive start +#define AT91C_SSC_START_LOW_RF (0x2 << 8) // (SSC) Detection of a low level on RF input +#define AT91C_SSC_START_HIGH_RF (0x3 << 8) // (SSC) Detection of a high level on RF input +#define AT91C_SSC_START_FALL_RF (0x4 << 8) // (SSC) Detection of a falling edge on RF input +#define AT91C_SSC_START_RISE_RF (0x5 << 8) // (SSC) Detection of a rising edge on RF input +#define AT91C_SSC_START_LEVEL_RF (0x6 << 8) // (SSC) Detection of any level change on RF input +#define AT91C_SSC_START_EDGE_RF (0x7 << 8) // (SSC) Detection of any edge on RF input +#define AT91C_SSC_START_0 (0x8 << 8) // (SSC) Compare 0 +#define AT91C_SSC_STOP (0x1 << 12) // (SSC) Receive Stop Selection +#define AT91C_SSC_STTDLY (0xFF << 16) // (SSC) Receive/Transmit Start Delay +#define AT91C_SSC_PERIOD (0xFF << 24) // (SSC) Receive/Transmit Period Divider Selection +// -------- SSC_RFMR : (SSC Offset: 0x14) SSC Receive Frame Mode Register -------- +#define AT91C_SSC_DATLEN (0x1F << 0) // (SSC) Data Length +#define AT91C_SSC_LOOP (0x1 << 5) // (SSC) Loop Mode +#define AT91C_SSC_MSBF (0x1 << 7) // (SSC) Most Significant Bit First +#define AT91C_SSC_DATNB (0xF << 8) // (SSC) Data Number per Frame +#define AT91C_SSC_FSLEN (0xF << 16) // (SSC) Receive/Transmit Frame Sync length +#define AT91C_SSC_FSOS (0x7 << 20) // (SSC) Receive/Transmit Frame Sync Output Selection +#define AT91C_SSC_FSOS_NONE (0x0 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: None RK pin Input-only +#define AT91C_SSC_FSOS_NEGATIVE (0x1 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Negative Pulse +#define AT91C_SSC_FSOS_POSITIVE (0x2 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Positive Pulse +#define AT91C_SSC_FSOS_LOW (0x3 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Driver Low during data transfer +#define AT91C_SSC_FSOS_HIGH (0x4 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Driver High during data transfer +#define AT91C_SSC_FSOS_TOGGLE (0x5 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Toggling at each start of data transfer +#define AT91C_SSC_FSEDGE (0x1 << 24) // (SSC) Frame Sync Edge Detection +// -------- SSC_TCMR : (SSC Offset: 0x18) SSC Transmit Clock Mode Register -------- +// -------- SSC_TFMR : (SSC Offset: 0x1c) SSC Transmit Frame Mode Register -------- +#define AT91C_SSC_DATDEF (0x1 << 5) // (SSC) Data Default Value +#define AT91C_SSC_FSDEN (0x1 << 23) // (SSC) Frame Sync Data Enable +// -------- SSC_SR : (SSC Offset: 0x40) SSC Status Register -------- +#define AT91C_SSC_TXRDY (0x1 << 0) // (SSC) Transmit Ready +#define AT91C_SSC_TXEMPTY (0x1 << 1) // (SSC) Transmit Empty +#define AT91C_SSC_ENDTX (0x1 << 2) // (SSC) End Of Transmission +#define AT91C_SSC_TXBUFE (0x1 << 3) // (SSC) Transmit Buffer Empty +#define AT91C_SSC_RXRDY (0x1 << 4) // (SSC) Receive Ready +#define AT91C_SSC_OVRUN (0x1 << 5) // (SSC) Receive Overrun +#define AT91C_SSC_ENDRX (0x1 << 6) // (SSC) End of Reception +#define AT91C_SSC_RXBUFF (0x1 << 7) // (SSC) Receive Buffer Full +#define AT91C_SSC_CP0 (0x1 << 8) // (SSC) Compare 0 +#define AT91C_SSC_CP1 (0x1 << 9) // (SSC) Compare 1 +#define AT91C_SSC_TXSYN (0x1 << 10) // (SSC) Transmit Sync +#define AT91C_SSC_RXSYN (0x1 << 11) // (SSC) Receive Sync +#define AT91C_SSC_TXENA (0x1 << 16) // (SSC) Transmit Enable +#define AT91C_SSC_RXENA (0x1 << 17) // (SSC) Receive Enable +// -------- SSC_IER : (SSC Offset: 0x44) SSC Interrupt Enable Register -------- +// -------- SSC_IDR : (SSC Offset: 0x48) SSC Interrupt Disable Register -------- +// -------- SSC_IMR : (SSC Offset: 0x4c) SSC Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Two-wire Interface +// ***************************************************************************** +// *** Register offset in AT91S_TWI structure *** +#define TWI_CR ( 0) // Control Register +#define TWI_MMR ( 4) // Master Mode Register +#define TWI_IADR (12) // Internal Address Register +#define TWI_CWGR (16) // Clock Waveform Generator Register +#define TWI_SR (32) // Status Register +#define TWI_IER (36) // Interrupt Enable Register +#define TWI_IDR (40) // Interrupt Disable Register +#define TWI_IMR (44) // Interrupt Mask Register +#define TWI_RHR (48) // Receive Holding Register +#define TWI_THR (52) // Transmit Holding Register +// -------- TWI_CR : (TWI Offset: 0x0) TWI Control Register -------- +#define AT91C_TWI_START (0x1 << 0) // (TWI) Send a START Condition +#define AT91C_TWI_STOP (0x1 << 1) // (TWI) Send a STOP Condition +#define AT91C_TWI_MSEN (0x1 << 2) // (TWI) TWI Master Transfer Enabled +#define AT91C_TWI_MSDIS (0x1 << 3) // (TWI) TWI Master Transfer Disabled +#define AT91C_TWI_SWRST (0x1 << 7) // (TWI) Software Reset +// -------- TWI_MMR : (TWI Offset: 0x4) TWI Master Mode Register -------- +#define AT91C_TWI_IADRSZ (0x3 << 8) // (TWI) Internal Device Address Size +#define AT91C_TWI_IADRSZ_NO (0x0 << 8) // (TWI) No internal device address +#define AT91C_TWI_IADRSZ_1_BYTE (0x1 << 8) // (TWI) One-byte internal device address +#define AT91C_TWI_IADRSZ_2_BYTE (0x2 << 8) // (TWI) Two-byte internal device address +#define AT91C_TWI_IADRSZ_3_BYTE (0x3 << 8) // (TWI) Three-byte internal device address +#define AT91C_TWI_MREAD (0x1 << 12) // (TWI) Master Read Direction +#define AT91C_TWI_DADR (0x7F << 16) // (TWI) Device Address +// -------- TWI_CWGR : (TWI Offset: 0x10) TWI Clock Waveform Generator Register -------- +#define AT91C_TWI_CLDIV (0xFF << 0) // (TWI) Clock Low Divider +#define AT91C_TWI_CHDIV (0xFF << 8) // (TWI) Clock High Divider +#define AT91C_TWI_CKDIV (0x7 << 16) // (TWI) Clock Divider +// -------- TWI_SR : (TWI Offset: 0x20) TWI Status Register -------- +#define AT91C_TWI_TXCOMP (0x1 << 0) // (TWI) Transmission Completed +#define AT91C_TWI_RXRDY (0x1 << 1) // (TWI) Receive holding register ReaDY +#define AT91C_TWI_TXRDY (0x1 << 2) // (TWI) Transmit holding register ReaDY +#define AT91C_TWI_OVRE (0x1 << 6) // (TWI) Overrun Error +#define AT91C_TWI_UNRE (0x1 << 7) // (TWI) Underrun Error +#define AT91C_TWI_NACK (0x1 << 8) // (TWI) Not Acknowledged +// -------- TWI_IER : (TWI Offset: 0x24) TWI Interrupt Enable Register -------- +// -------- TWI_IDR : (TWI Offset: 0x28) TWI Interrupt Disable Register -------- +// -------- TWI_IMR : (TWI Offset: 0x2c) TWI Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR PWMC Channel Interface +// ***************************************************************************** +// *** Register offset in AT91S_PWMC_CH structure *** +#define PWMC_CMR ( 0) // Channel Mode Register +#define PWMC_CDTYR ( 4) // Channel Duty Cycle Register +#define PWMC_CPRDR ( 8) // Channel Period Register +#define PWMC_CCNTR (12) // Channel Counter Register +#define PWMC_CUPDR (16) // Channel Update Register +#define PWMC_Reserved (20) // Reserved +// -------- PWMC_CMR : (PWMC_CH Offset: 0x0) PWMC Channel Mode Register -------- +#define AT91C_PWMC_CPRE (0xF << 0) // (PWMC_CH) Channel Pre-scaler : PWMC_CLKx +#define AT91C_PWMC_CPRE_MCK (0x0) // (PWMC_CH) +#define AT91C_PWMC_CPRE_MCKA (0xB) // (PWMC_CH) +#define AT91C_PWMC_CPRE_MCKB (0xC) // (PWMC_CH) +#define AT91C_PWMC_CALG (0x1 << 8) // (PWMC_CH) Channel Alignment +#define AT91C_PWMC_CPOL (0x1 << 9) // (PWMC_CH) Channel Polarity +#define AT91C_PWMC_CPD (0x1 << 10) // (PWMC_CH) Channel Update Period +// -------- PWMC_CDTYR : (PWMC_CH Offset: 0x4) PWMC Channel Duty Cycle Register -------- +#define AT91C_PWMC_CDTY (0x0 << 0) // (PWMC_CH) Channel Duty Cycle +// -------- PWMC_CPRDR : (PWMC_CH Offset: 0x8) PWMC Channel Period Register -------- +#define AT91C_PWMC_CPRD (0x0 << 0) // (PWMC_CH) Channel Period +// -------- PWMC_CCNTR : (PWMC_CH Offset: 0xc) PWMC Channel Counter Register -------- +#define AT91C_PWMC_CCNT (0x0 << 0) // (PWMC_CH) Channel Counter +// -------- PWMC_CUPDR : (PWMC_CH Offset: 0x10) PWMC Channel Update Register -------- +#define AT91C_PWMC_CUPD (0x0 << 0) // (PWMC_CH) Channel Update + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Pulse Width Modulation Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_PWMC structure *** +#define PWMC_MR ( 0) // PWMC Mode Register +#define PWMC_ENA ( 4) // PWMC Enable Register +#define PWMC_DIS ( 8) // PWMC Disable Register +#define PWMC_SR (12) // PWMC Status Register +#define PWMC_IER (16) // PWMC Interrupt Enable Register +#define PWMC_IDR (20) // PWMC Interrupt Disable Register +#define PWMC_IMR (24) // PWMC Interrupt Mask Register +#define PWMC_ISR (28) // PWMC Interrupt Status Register +#define PWMC_VR (252) // PWMC Version Register +#define PWMC_CH (512) // PWMC Channel +// -------- PWMC_MR : (PWMC Offset: 0x0) PWMC Mode Register -------- +#define AT91C_PWMC_DIVA (0xFF << 0) // (PWMC) CLKA divide factor. +#define AT91C_PWMC_PREA (0xF << 8) // (PWMC) Divider Input Clock Prescaler A +#define AT91C_PWMC_PREA_MCK (0x0 << 8) // (PWMC) +#define AT91C_PWMC_DIVB (0xFF << 16) // (PWMC) CLKB divide factor. +#define AT91C_PWMC_PREB (0xF << 24) // (PWMC) Divider Input Clock Prescaler B +#define AT91C_PWMC_PREB_MCK (0x0 << 24) // (PWMC) +// -------- PWMC_ENA : (PWMC Offset: 0x4) PWMC Enable Register -------- +#define AT91C_PWMC_CHID0 (0x1 << 0) // (PWMC) Channel ID 0 +#define AT91C_PWMC_CHID1 (0x1 << 1) // (PWMC) Channel ID 1 +#define AT91C_PWMC_CHID2 (0x1 << 2) // (PWMC) Channel ID 2 +#define AT91C_PWMC_CHID3 (0x1 << 3) // (PWMC) Channel ID 3 +// -------- PWMC_DIS : (PWMC Offset: 0x8) PWMC Disable Register -------- +// -------- PWMC_SR : (PWMC Offset: 0xc) PWMC Status Register -------- +// -------- PWMC_IER : (PWMC Offset: 0x10) PWMC Interrupt Enable Register -------- +// -------- PWMC_IDR : (PWMC Offset: 0x14) PWMC Interrupt Disable Register -------- +// -------- PWMC_IMR : (PWMC Offset: 0x18) PWMC Interrupt Mask Register -------- +// -------- PWMC_ISR : (PWMC Offset: 0x1c) PWMC Interrupt Status Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR USB Device Interface +// ***************************************************************************** +// *** Register offset in AT91S_UDP structure *** +#define UDP_NUM ( 0) // Frame Number Register +#define UDP_GLBSTATE ( 4) // Global State Register +#define UDP_FADDR ( 8) // Function Address Register +#define UDP_IER (16) // Interrupt Enable Register +#define UDP_IDR (20) // Interrupt Disable Register +#define UDP_IMR (24) // Interrupt Mask Register +#define UDP_ISR (28) // Interrupt Status Register +#define UDP_ICR (32) // Interrupt Clear Register +#define UDP_RSTEP (40) // Reset Endpoint Register +#define UDP_CSR (48) // Endpoint Control and Status Register +#define UDP_FDR (80) // Endpoint FIFO Data Register +#define UDP_TXVC (116) // Transceiver Control Register +// -------- UDP_FRM_NUM : (UDP Offset: 0x0) USB Frame Number Register -------- +#define AT91C_UDP_FRM_NUM (0x7FF << 0) // (UDP) Frame Number as Defined in the Packet Field Formats +#define AT91C_UDP_FRM_ERR (0x1 << 16) // (UDP) Frame Error +#define AT91C_UDP_FRM_OK (0x1 << 17) // (UDP) Frame OK +// -------- UDP_GLB_STATE : (UDP Offset: 0x4) USB Global State Register -------- +#define AT91C_UDP_FADDEN (0x1 << 0) // (UDP) Function Address Enable +#define AT91C_UDP_CONFG (0x1 << 1) // (UDP) Configured +#define AT91C_UDP_ESR (0x1 << 2) // (UDP) Enable Send Resume +#define AT91C_UDP_RSMINPR (0x1 << 3) // (UDP) A Resume Has Been Sent to the Host +#define AT91C_UDP_RMWUPE (0x1 << 4) // (UDP) Remote Wake Up Enable +// -------- UDP_FADDR : (UDP Offset: 0x8) USB Function Address Register -------- +#define AT91C_UDP_FADD (0xFF << 0) // (UDP) Function Address Value +#define AT91C_UDP_FEN (0x1 << 8) // (UDP) Function Enable +// -------- UDP_IER : (UDP Offset: 0x10) USB Interrupt Enable Register -------- +#define AT91C_UDP_EPINT0 (0x1 << 0) // (UDP) Endpoint 0 Interrupt +#define AT91C_UDP_EPINT1 (0x1 << 1) // (UDP) Endpoint 0 Interrupt +#define AT91C_UDP_EPINT2 (0x1 << 2) // (UDP) Endpoint 2 Interrupt +#define AT91C_UDP_EPINT3 (0x1 << 3) // (UDP) Endpoint 3 Interrupt +#define AT91C_UDP_EPINT4 (0x1 << 4) // (UDP) Endpoint 4 Interrupt +#define AT91C_UDP_EPINT5 (0x1 << 5) // (UDP) Endpoint 5 Interrupt +#define AT91C_UDP_RXSUSP (0x1 << 8) // (UDP) USB Suspend Interrupt +#define AT91C_UDP_RXRSM (0x1 << 9) // (UDP) USB Resume Interrupt +#define AT91C_UDP_EXTRSM (0x1 << 10) // (UDP) USB External Resume Interrupt +#define AT91C_UDP_SOFINT (0x1 << 11) // (UDP) USB Start Of frame Interrupt +#define AT91C_UDP_WAKEUP (0x1 << 13) // (UDP) USB Resume Interrupt +// -------- UDP_IDR : (UDP Offset: 0x14) USB Interrupt Disable Register -------- +// -------- UDP_IMR : (UDP Offset: 0x18) USB Interrupt Mask Register -------- +// -------- UDP_ISR : (UDP Offset: 0x1c) USB Interrupt Status Register -------- +#define AT91C_UDP_ENDBUSRES (0x1 << 12) // (UDP) USB End Of Bus Reset Interrupt +// -------- UDP_ICR : (UDP Offset: 0x20) USB Interrupt Clear Register -------- +// -------- UDP_RST_EP : (UDP Offset: 0x28) USB Reset Endpoint Register -------- +#define AT91C_UDP_EP0 (0x1 << 0) // (UDP) Reset Endpoint 0 +#define AT91C_UDP_EP1 (0x1 << 1) // (UDP) Reset Endpoint 1 +#define AT91C_UDP_EP2 (0x1 << 2) // (UDP) Reset Endpoint 2 +#define AT91C_UDP_EP3 (0x1 << 3) // (UDP) Reset Endpoint 3 +#define AT91C_UDP_EP4 (0x1 << 4) // (UDP) Reset Endpoint 4 +#define AT91C_UDP_EP5 (0x1 << 5) // (UDP) Reset Endpoint 5 +// -------- UDP_CSR : (UDP Offset: 0x30) USB Endpoint Control and Status Register -------- +#define AT91C_UDP_TXCOMP (0x1 << 0) // (UDP) Generates an IN packet with data previously written in the DPR +#define AT91C_UDP_RX_DATA_BK0 (0x1 << 1) // (UDP) Receive Data Bank 0 +#define AT91C_UDP_RXSETUP (0x1 << 2) // (UDP) Sends STALL to the Host (Control endpoints) +#define AT91C_UDP_ISOERROR (0x1 << 3) // (UDP) Isochronous error (Isochronous endpoints) +#define AT91C_UDP_TXPKTRDY (0x1 << 4) // (UDP) Transmit Packet Ready +#define AT91C_UDP_FORCESTALL (0x1 << 5) // (UDP) Force Stall (used by Control, Bulk and Isochronous endpoints). +#define AT91C_UDP_RX_DATA_BK1 (0x1 << 6) // (UDP) Receive Data Bank 1 (only used by endpoints with ping-pong attributes). +#define AT91C_UDP_DIR (0x1 << 7) // (UDP) Transfer Direction +#define AT91C_UDP_EPTYPE (0x7 << 8) // (UDP) Endpoint type +#define AT91C_UDP_EPTYPE_CTRL (0x0 << 8) // (UDP) Control +#define AT91C_UDP_EPTYPE_ISO_OUT (0x1 << 8) // (UDP) Isochronous OUT +#define AT91C_UDP_EPTYPE_BULK_OUT (0x2 << 8) // (UDP) Bulk OUT +#define AT91C_UDP_EPTYPE_INT_OUT (0x3 << 8) // (UDP) Interrupt OUT +#define AT91C_UDP_EPTYPE_ISO_IN (0x5 << 8) // (UDP) Isochronous IN +#define AT91C_UDP_EPTYPE_BULK_IN (0x6 << 8) // (UDP) Bulk IN +#define AT91C_UDP_EPTYPE_INT_IN (0x7 << 8) // (UDP) Interrupt IN +#define AT91C_UDP_DTGLE (0x1 << 11) // (UDP) Data Toggle +#define AT91C_UDP_EPEDS (0x1 << 15) // (UDP) Endpoint Enable Disable +#define AT91C_UDP_RXBYTECNT (0x7FF << 16) // (UDP) Number Of Bytes Available in the FIFO +// -------- UDP_TXVC : (UDP Offset: 0x74) Transceiver Control Register -------- +#define AT91C_UDP_TXVDIS (0x1 << 8) // (UDP) +#define AT91C_UDP_PUON (0x1 << 9) // (UDP) Pull-up ON + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Timer Counter Channel Interface +// ***************************************************************************** +// *** Register offset in AT91S_TC structure *** +#define TC_CCR ( 0) // Channel Control Register +#define TC_CMR ( 4) // Channel Mode Register (Capture Mode / Waveform Mode) +#define TC_CV (16) // Counter Value +#define TC_RA (20) // Register A +#define TC_RB (24) // Register B +#define TC_RC (28) // Register C +#define TC_SR (32) // Status Register +#define TC_IER (36) // Interrupt Enable Register +#define TC_IDR (40) // Interrupt Disable Register +#define TC_IMR (44) // Interrupt Mask Register +// -------- TC_CCR : (TC Offset: 0x0) TC Channel Control Register -------- +#define AT91C_TC_CLKEN (0x1 << 0) // (TC) Counter Clock Enable Command +#define AT91C_TC_CLKDIS (0x1 << 1) // (TC) Counter Clock Disable Command +#define AT91C_TC_SWTRG (0x1 << 2) // (TC) Software Trigger Command +// -------- TC_CMR : (TC Offset: 0x4) TC Channel Mode Register: Capture Mode / Waveform Mode -------- +#define AT91C_TC_CLKS (0x7 << 0) // (TC) Clock Selection +#define AT91C_TC_CLKS_TIMER_DIV1_CLOCK (0x0) // (TC) Clock selected: TIMER_DIV1_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV2_CLOCK (0x1) // (TC) Clock selected: TIMER_DIV2_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV3_CLOCK (0x2) // (TC) Clock selected: TIMER_DIV3_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV4_CLOCK (0x3) // (TC) Clock selected: TIMER_DIV4_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV5_CLOCK (0x4) // (TC) Clock selected: TIMER_DIV5_CLOCK +#define AT91C_TC_CLKS_XC0 (0x5) // (TC) Clock selected: XC0 +#define AT91C_TC_CLKS_XC1 (0x6) // (TC) Clock selected: XC1 +#define AT91C_TC_CLKS_XC2 (0x7) // (TC) Clock selected: XC2 +#define AT91C_TC_CLKI (0x1 << 3) // (TC) Clock Invert +#define AT91C_TC_BURST (0x3 << 4) // (TC) Burst Signal Selection +#define AT91C_TC_BURST_NONE (0x0 << 4) // (TC) The clock is not gated by an external signal +#define AT91C_TC_BURST_XC0 (0x1 << 4) // (TC) XC0 is ANDed with the selected clock +#define AT91C_TC_BURST_XC1 (0x2 << 4) // (TC) XC1 is ANDed with the selected clock +#define AT91C_TC_BURST_XC2 (0x3 << 4) // (TC) XC2 is ANDed with the selected clock +#define AT91C_TC_CPCSTOP (0x1 << 6) // (TC) Counter Clock Stopped with RC Compare +#define AT91C_TC_LDBSTOP (0x1 << 6) // (TC) Counter Clock Stopped with RB Loading +#define AT91C_TC_CPCDIS (0x1 << 7) // (TC) Counter Clock Disable with RC Compare +#define AT91C_TC_LDBDIS (0x1 << 7) // (TC) Counter Clock Disabled with RB Loading +#define AT91C_TC_ETRGEDG (0x3 << 8) // (TC) External Trigger Edge Selection +#define AT91C_TC_ETRGEDG_NONE (0x0 << 8) // (TC) Edge: None +#define AT91C_TC_ETRGEDG_RISING (0x1 << 8) // (TC) Edge: rising edge +#define AT91C_TC_ETRGEDG_FALLING (0x2 << 8) // (TC) Edge: falling edge +#define AT91C_TC_ETRGEDG_BOTH (0x3 << 8) // (TC) Edge: each edge +#define AT91C_TC_EEVTEDG (0x3 << 8) // (TC) External Event Edge Selection +#define AT91C_TC_EEVTEDG_NONE (0x0 << 8) // (TC) Edge: None +#define AT91C_TC_EEVTEDG_RISING (0x1 << 8) // (TC) Edge: rising edge +#define AT91C_TC_EEVTEDG_FALLING (0x2 << 8) // (TC) Edge: falling edge +#define AT91C_TC_EEVTEDG_BOTH (0x3 << 8) // (TC) Edge: each edge +#define AT91C_TC_EEVT (0x3 << 10) // (TC) External Event Selection +#define AT91C_TC_EEVT_TIOB (0x0 << 10) // (TC) Signal selected as external event: TIOB TIOB direction: input +#define AT91C_TC_EEVT_XC0 (0x1 << 10) // (TC) Signal selected as external event: XC0 TIOB direction: output +#define AT91C_TC_EEVT_XC1 (0x2 << 10) // (TC) Signal selected as external event: XC1 TIOB direction: output +#define AT91C_TC_EEVT_XC2 (0x3 << 10) // (TC) Signal selected as external event: XC2 TIOB direction: output +#define AT91C_TC_ABETRG (0x1 << 10) // (TC) TIOA or TIOB External Trigger Selection +#define AT91C_TC_ENETRG (0x1 << 12) // (TC) External Event Trigger enable +#define AT91C_TC_WAVESEL (0x3 << 13) // (TC) Waveform Selection +#define AT91C_TC_WAVESEL_UP (0x0 << 13) // (TC) UP mode without atomatic trigger on RC Compare +#define AT91C_TC_WAVESEL_UPDOWN (0x1 << 13) // (TC) UPDOWN mode without automatic trigger on RC Compare +#define AT91C_TC_WAVESEL_UP_AUTO (0x2 << 13) // (TC) UP mode with automatic trigger on RC Compare +#define AT91C_TC_WAVESEL_UPDOWN_AUTO (0x3 << 13) // (TC) UPDOWN mode with automatic trigger on RC Compare +#define AT91C_TC_CPCTRG (0x1 << 14) // (TC) RC Compare Trigger Enable +#define AT91C_TC_WAVE (0x1 << 15) // (TC) +#define AT91C_TC_ACPA (0x3 << 16) // (TC) RA Compare Effect on TIOA +#define AT91C_TC_ACPA_NONE (0x0 << 16) // (TC) Effect: none +#define AT91C_TC_ACPA_SET (0x1 << 16) // (TC) Effect: set +#define AT91C_TC_ACPA_CLEAR (0x2 << 16) // (TC) Effect: clear +#define AT91C_TC_ACPA_TOGGLE (0x3 << 16) // (TC) Effect: toggle +#define AT91C_TC_LDRA (0x3 << 16) // (TC) RA Loading Selection +#define AT91C_TC_LDRA_NONE (0x0 << 16) // (TC) Edge: None +#define AT91C_TC_LDRA_RISING (0x1 << 16) // (TC) Edge: rising edge of TIOA +#define AT91C_TC_LDRA_FALLING (0x2 << 16) // (TC) Edge: falling edge of TIOA +#define AT91C_TC_LDRA_BOTH (0x3 << 16) // (TC) Edge: each edge of TIOA +#define AT91C_TC_ACPC (0x3 << 18) // (TC) RC Compare Effect on TIOA +#define AT91C_TC_ACPC_NONE (0x0 << 18) // (TC) Effect: none +#define AT91C_TC_ACPC_SET (0x1 << 18) // (TC) Effect: set +#define AT91C_TC_ACPC_CLEAR (0x2 << 18) // (TC) Effect: clear +#define AT91C_TC_ACPC_TOGGLE (0x3 << 18) // (TC) Effect: toggle +#define AT91C_TC_LDRB (0x3 << 18) // (TC) RB Loading Selection +#define AT91C_TC_LDRB_NONE (0x0 << 18) // (TC) Edge: None +#define AT91C_TC_LDRB_RISING (0x1 << 18) // (TC) Edge: rising edge of TIOA +#define AT91C_TC_LDRB_FALLING (0x2 << 18) // (TC) Edge: falling edge of TIOA +#define AT91C_TC_LDRB_BOTH (0x3 << 18) // (TC) Edge: each edge of TIOA +#define AT91C_TC_AEEVT (0x3 << 20) // (TC) External Event Effect on TIOA +#define AT91C_TC_AEEVT_NONE (0x0 << 20) // (TC) Effect: none +#define AT91C_TC_AEEVT_SET (0x1 << 20) // (TC) Effect: set +#define AT91C_TC_AEEVT_CLEAR (0x2 << 20) // (TC) Effect: clear +#define AT91C_TC_AEEVT_TOGGLE (0x3 << 20) // (TC) Effect: toggle +#define AT91C_TC_ASWTRG (0x3 << 22) // (TC) Software Trigger Effect on TIOA +#define AT91C_TC_ASWTRG_NONE (0x0 << 22) // (TC) Effect: none +#define AT91C_TC_ASWTRG_SET (0x1 << 22) // (TC) Effect: set +#define AT91C_TC_ASWTRG_CLEAR (0x2 << 22) // (TC) Effect: clear +#define AT91C_TC_ASWTRG_TOGGLE (0x3 << 22) // (TC) Effect: toggle +#define AT91C_TC_BCPB (0x3 << 24) // (TC) RB Compare Effect on TIOB +#define AT91C_TC_BCPB_NONE (0x0 << 24) // (TC) Effect: none +#define AT91C_TC_BCPB_SET (0x1 << 24) // (TC) Effect: set +#define AT91C_TC_BCPB_CLEAR (0x2 << 24) // (TC) Effect: clear +#define AT91C_TC_BCPB_TOGGLE (0x3 << 24) // (TC) Effect: toggle +#define AT91C_TC_BCPC (0x3 << 26) // (TC) RC Compare Effect on TIOB +#define AT91C_TC_BCPC_NONE (0x0 << 26) // (TC) Effect: none +#define AT91C_TC_BCPC_SET (0x1 << 26) // (TC) Effect: set +#define AT91C_TC_BCPC_CLEAR (0x2 << 26) // (TC) Effect: clear +#define AT91C_TC_BCPC_TOGGLE (0x3 << 26) // (TC) Effect: toggle +#define AT91C_TC_BEEVT (0x3 << 28) // (TC) External Event Effect on TIOB +#define AT91C_TC_BEEVT_NONE (0x0 << 28) // (TC) Effect: none +#define AT91C_TC_BEEVT_SET (0x1 << 28) // (TC) Effect: set +#define AT91C_TC_BEEVT_CLEAR (0x2 << 28) // (TC) Effect: clear +#define AT91C_TC_BEEVT_TOGGLE (0x3 << 28) // (TC) Effect: toggle +#define AT91C_TC_BSWTRG (0x3 << 30) // (TC) Software Trigger Effect on TIOB +#define AT91C_TC_BSWTRG_NONE (0x0 << 30) // (TC) Effect: none +#define AT91C_TC_BSWTRG_SET (0x1 << 30) // (TC) Effect: set +#define AT91C_TC_BSWTRG_CLEAR (0x2 << 30) // (TC) Effect: clear +#define AT91C_TC_BSWTRG_TOGGLE (0x3 << 30) // (TC) Effect: toggle +// -------- TC_SR : (TC Offset: 0x20) TC Channel Status Register -------- +#define AT91C_TC_COVFS (0x1 << 0) // (TC) Counter Overflow +#define AT91C_TC_LOVRS (0x1 << 1) // (TC) Load Overrun +#define AT91C_TC_CPAS (0x1 << 2) // (TC) RA Compare +#define AT91C_TC_CPBS (0x1 << 3) // (TC) RB Compare +#define AT91C_TC_CPCS (0x1 << 4) // (TC) RC Compare +#define AT91C_TC_LDRAS (0x1 << 5) // (TC) RA Loading +#define AT91C_TC_LDRBS (0x1 << 6) // (TC) RB Loading +#define AT91C_TC_ETRGS (0x1 << 7) // (TC) External Trigger +#define AT91C_TC_CLKSTA (0x1 << 16) // (TC) Clock Enabling +#define AT91C_TC_MTIOA (0x1 << 17) // (TC) TIOA Mirror +#define AT91C_TC_MTIOB (0x1 << 18) // (TC) TIOA Mirror +// -------- TC_IER : (TC Offset: 0x24) TC Channel Interrupt Enable Register -------- +// -------- TC_IDR : (TC Offset: 0x28) TC Channel Interrupt Disable Register -------- +// -------- TC_IMR : (TC Offset: 0x2c) TC Channel Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Timer Counter Interface +// ***************************************************************************** +// *** Register offset in AT91S_TCB structure *** +#define TCB_TC0 ( 0) // TC Channel 0 +#define TCB_TC1 (64) // TC Channel 1 +#define TCB_TC2 (128) // TC Channel 2 +#define TCB_BCR (192) // TC Block Control Register +#define TCB_BMR (196) // TC Block Mode Register +// -------- TCB_BCR : (TCB Offset: 0xc0) TC Block Control Register -------- +#define AT91C_TCB_SYNC (0x1 << 0) // (TCB) Synchro Command +// -------- TCB_BMR : (TCB Offset: 0xc4) TC Block Mode Register -------- +#define AT91C_TCB_TC0XC0S (0x3 << 0) // (TCB) External Clock Signal 0 Selection +#define AT91C_TCB_TC0XC0S_TCLK0 (0x0) // (TCB) TCLK0 connected to XC0 +#define AT91C_TCB_TC0XC0S_NONE (0x1) // (TCB) None signal connected to XC0 +#define AT91C_TCB_TC0XC0S_TIOA1 (0x2) // (TCB) TIOA1 connected to XC0 +#define AT91C_TCB_TC0XC0S_TIOA2 (0x3) // (TCB) TIOA2 connected to XC0 +#define AT91C_TCB_TC1XC1S (0x3 << 2) // (TCB) External Clock Signal 1 Selection +#define AT91C_TCB_TC1XC1S_TCLK1 (0x0 << 2) // (TCB) TCLK1 connected to XC1 +#define AT91C_TCB_TC1XC1S_NONE (0x1 << 2) // (TCB) None signal connected to XC1 +#define AT91C_TCB_TC1XC1S_TIOA0 (0x2 << 2) // (TCB) TIOA0 connected to XC1 +#define AT91C_TCB_TC1XC1S_TIOA2 (0x3 << 2) // (TCB) TIOA2 connected to XC1 +#define AT91C_TCB_TC2XC2S (0x3 << 4) // (TCB) External Clock Signal 2 Selection +#define AT91C_TCB_TC2XC2S_TCLK2 (0x0 << 4) // (TCB) TCLK2 connected to XC2 +#define AT91C_TCB_TC2XC2S_NONE (0x1 << 4) // (TCB) None signal connected to XC2 +#define AT91C_TCB_TC2XC2S_TIOA0 (0x2 << 4) // (TCB) TIOA0 connected to XC2 +#define AT91C_TCB_TC2XC2S_TIOA1 (0x3 << 4) // (TCB) TIOA2 connected to XC2 + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Control Area Network MailBox Interface +// ***************************************************************************** +// *** Register offset in AT91S_CAN_MB structure *** +#define CAN_MB_MMR ( 0) // MailBox Mode Register +#define CAN_MB_MAM ( 4) // MailBox Acceptance Mask Register +#define CAN_MB_MID ( 8) // MailBox ID Register +#define CAN_MB_MFID (12) // MailBox Family ID Register +#define CAN_MB_MSR (16) // MailBox Status Register +#define CAN_MB_MDL (20) // MailBox Data Low Register +#define CAN_MB_MDH (24) // MailBox Data High Register +#define CAN_MB_MCR (28) // MailBox Control Register +// -------- CAN_MMR : (CAN_MB Offset: 0x0) CAN Message Mode Register -------- +#define AT91C_CAN_MTIMEMARK (0xFFFF << 0) // (CAN_MB) Mailbox Timemark +#define AT91C_CAN_PRIOR (0xF << 16) // (CAN_MB) Mailbox Priority +#define AT91C_CAN_MOT (0x7 << 24) // (CAN_MB) Mailbox Object Type +#define AT91C_CAN_MOT_DIS (0x0 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_RX (0x1 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_RXOVERWRITE (0x2 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_TX (0x3 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_CONSUMER (0x4 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_PRODUCER (0x5 << 24) // (CAN_MB) +// -------- CAN_MAM : (CAN_MB Offset: 0x4) CAN Message Acceptance Mask Register -------- +#define AT91C_CAN_MIDvB (0x3FFFF << 0) // (CAN_MB) Complementary bits for identifier in extended mode +#define AT91C_CAN_MIDvA (0x7FF << 18) // (CAN_MB) Identifier for standard frame mode +#define AT91C_CAN_MIDE (0x1 << 29) // (CAN_MB) Identifier Version +// -------- CAN_MID : (CAN_MB Offset: 0x8) CAN Message ID Register -------- +// -------- CAN_MFID : (CAN_MB Offset: 0xc) CAN Message Family ID Register -------- +// -------- CAN_MSR : (CAN_MB Offset: 0x10) CAN Message Status Register -------- +#define AT91C_CAN_MTIMESTAMP (0xFFFF << 0) // (CAN_MB) Timer Value +#define AT91C_CAN_MDLC (0xF << 16) // (CAN_MB) Mailbox Data Length Code +#define AT91C_CAN_MRTR (0x1 << 20) // (CAN_MB) Mailbox Remote Transmission Request +#define AT91C_CAN_MABT (0x1 << 22) // (CAN_MB) Mailbox Message Abort +#define AT91C_CAN_MRDY (0x1 << 23) // (CAN_MB) Mailbox Ready +#define AT91C_CAN_MMI (0x1 << 24) // (CAN_MB) Mailbox Message Ignored +// -------- CAN_MDL : (CAN_MB Offset: 0x14) CAN Message Data Low Register -------- +// -------- CAN_MDH : (CAN_MB Offset: 0x18) CAN Message Data High Register -------- +// -------- CAN_MCR : (CAN_MB Offset: 0x1c) CAN Message Control Register -------- +#define AT91C_CAN_MACR (0x1 << 22) // (CAN_MB) Abort Request for Mailbox +#define AT91C_CAN_MTCR (0x1 << 23) // (CAN_MB) Mailbox Transfer Command + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Control Area Network Interface +// ***************************************************************************** +// *** Register offset in AT91S_CAN structure *** +#define CAN_MR ( 0) // Mode Register +#define CAN_IER ( 4) // Interrupt Enable Register +#define CAN_IDR ( 8) // Interrupt Disable Register +#define CAN_IMR (12) // Interrupt Mask Register +#define CAN_SR (16) // Status Register +#define CAN_BR (20) // Baudrate Register +#define CAN_TIM (24) // Timer Register +#define CAN_TIMESTP (28) // Time Stamp Register +#define CAN_ECR (32) // Error Counter Register +#define CAN_TCR (36) // Transfer Command Register +#define CAN_ACR (40) // Abort Command Register +#define CAN_VR (252) // Version Register +#define CAN_MB0 (512) // CAN Mailbox 0 +#define CAN_MB1 (544) // CAN Mailbox 1 +#define CAN_MB2 (576) // CAN Mailbox 2 +#define CAN_MB3 (608) // CAN Mailbox 3 +#define CAN_MB4 (640) // CAN Mailbox 4 +#define CAN_MB5 (672) // CAN Mailbox 5 +#define CAN_MB6 (704) // CAN Mailbox 6 +#define CAN_MB7 (736) // CAN Mailbox 7 +#define CAN_MB8 (768) // CAN Mailbox 8 +#define CAN_MB9 (800) // CAN Mailbox 9 +#define CAN_MB10 (832) // CAN Mailbox 10 +#define CAN_MB11 (864) // CAN Mailbox 11 +#define CAN_MB12 (896) // CAN Mailbox 12 +#define CAN_MB13 (928) // CAN Mailbox 13 +#define CAN_MB14 (960) // CAN Mailbox 14 +#define CAN_MB15 (992) // CAN Mailbox 15 +// -------- CAN_MR : (CAN Offset: 0x0) CAN Mode Register -------- +#define AT91C_CAN_CANEN (0x1 << 0) // (CAN) CAN Controller Enable +#define AT91C_CAN_LPM (0x1 << 1) // (CAN) Disable/Enable Low Power Mode +#define AT91C_CAN_ABM (0x1 << 2) // (CAN) Disable/Enable Autobaud/Listen Mode +#define AT91C_CAN_OVL (0x1 << 3) // (CAN) Disable/Enable Overload Frame +#define AT91C_CAN_TEOF (0x1 << 4) // (CAN) Time Stamp messages at each end of Frame +#define AT91C_CAN_TTM (0x1 << 5) // (CAN) Disable/Enable Time Trigger Mode +#define AT91C_CAN_TIMFRZ (0x1 << 6) // (CAN) Enable Timer Freeze +#define AT91C_CAN_DRPT (0x1 << 7) // (CAN) Disable Repeat +// -------- CAN_IER : (CAN Offset: 0x4) CAN Interrupt Enable Register -------- +#define AT91C_CAN_MB0 (0x1 << 0) // (CAN) Mailbox 0 Flag +#define AT91C_CAN_MB1 (0x1 << 1) // (CAN) Mailbox 1 Flag +#define AT91C_CAN_MB2 (0x1 << 2) // (CAN) Mailbox 2 Flag +#define AT91C_CAN_MB3 (0x1 << 3) // (CAN) Mailbox 3 Flag +#define AT91C_CAN_MB4 (0x1 << 4) // (CAN) Mailbox 4 Flag +#define AT91C_CAN_MB5 (0x1 << 5) // (CAN) Mailbox 5 Flag +#define AT91C_CAN_MB6 (0x1 << 6) // (CAN) Mailbox 6 Flag +#define AT91C_CAN_MB7 (0x1 << 7) // (CAN) Mailbox 7 Flag +#define AT91C_CAN_MB8 (0x1 << 8) // (CAN) Mailbox 8 Flag +#define AT91C_CAN_MB9 (0x1 << 9) // (CAN) Mailbox 9 Flag +#define AT91C_CAN_MB10 (0x1 << 10) // (CAN) Mailbox 10 Flag +#define AT91C_CAN_MB11 (0x1 << 11) // (CAN) Mailbox 11 Flag +#define AT91C_CAN_MB12 (0x1 << 12) // (CAN) Mailbox 12 Flag +#define AT91C_CAN_MB13 (0x1 << 13) // (CAN) Mailbox 13 Flag +#define AT91C_CAN_MB14 (0x1 << 14) // (CAN) Mailbox 14 Flag +#define AT91C_CAN_MB15 (0x1 << 15) // (CAN) Mailbox 15 Flag +#define AT91C_CAN_ERRA (0x1 << 16) // (CAN) Error Active Mode Flag +#define AT91C_CAN_WARN (0x1 << 17) // (CAN) Warning Limit Flag +#define AT91C_CAN_ERRP (0x1 << 18) // (CAN) Error Passive Mode Flag +#define AT91C_CAN_BOFF (0x1 << 19) // (CAN) Bus Off Mode Flag +#define AT91C_CAN_SLEEP (0x1 << 20) // (CAN) Sleep Flag +#define AT91C_CAN_WAKEUP (0x1 << 21) // (CAN) Wakeup Flag +#define AT91C_CAN_TOVF (0x1 << 22) // (CAN) Timer Overflow Flag +#define AT91C_CAN_TSTP (0x1 << 23) // (CAN) Timestamp Flag +#define AT91C_CAN_CERR (0x1 << 24) // (CAN) CRC Error +#define AT91C_CAN_SERR (0x1 << 25) // (CAN) Stuffing Error +#define AT91C_CAN_AERR (0x1 << 26) // (CAN) Acknowledgment Error +#define AT91C_CAN_FERR (0x1 << 27) // (CAN) Form Error +#define AT91C_CAN_BERR (0x1 << 28) // (CAN) Bit Error +// -------- CAN_IDR : (CAN Offset: 0x8) CAN Interrupt Disable Register -------- +// -------- CAN_IMR : (CAN Offset: 0xc) CAN Interrupt Mask Register -------- +// -------- CAN_SR : (CAN Offset: 0x10) CAN Status Register -------- +#define AT91C_CAN_RBSY (0x1 << 29) // (CAN) Receiver Busy +#define AT91C_CAN_TBSY (0x1 << 30) // (CAN) Transmitter Busy +#define AT91C_CAN_OVLY (0x1 << 31) // (CAN) Overload Busy +// -------- CAN_BR : (CAN Offset: 0x14) CAN Baudrate Register -------- +#define AT91C_CAN_PHASE2 (0x7 << 0) // (CAN) Phase 2 segment +#define AT91C_CAN_PHASE1 (0x7 << 4) // (CAN) Phase 1 segment +#define AT91C_CAN_PROPAG (0x7 << 8) // (CAN) Programmation time segment +#define AT91C_CAN_SYNC (0x3 << 12) // (CAN) Re-synchronization jump width segment +#define AT91C_CAN_BRP (0x7F << 16) // (CAN) Baudrate Prescaler +#define AT91C_CAN_SMP (0x1 << 24) // (CAN) Sampling mode +// -------- CAN_TIM : (CAN Offset: 0x18) CAN Timer Register -------- +#define AT91C_CAN_TIMER (0xFFFF << 0) // (CAN) Timer field +// -------- CAN_TIMESTP : (CAN Offset: 0x1c) CAN Timestamp Register -------- +// -------- CAN_ECR : (CAN Offset: 0x20) CAN Error Counter Register -------- +#define AT91C_CAN_REC (0xFF << 0) // (CAN) Receive Error Counter +#define AT91C_CAN_TEC (0xFF << 16) // (CAN) Transmit Error Counter +// -------- CAN_TCR : (CAN Offset: 0x24) CAN Transfer Command Register -------- +#define AT91C_CAN_TIMRST (0x1 << 31) // (CAN) Timer Reset Field +// -------- CAN_ACR : (CAN Offset: 0x28) CAN Abort Command Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Ethernet MAC 10/100 +// ***************************************************************************** +// *** Register offset in AT91S_EMAC structure *** +#define EMAC_NCR ( 0) // Network Control Register +#define EMAC_NCFGR ( 4) // Network Configuration Register +#define EMAC_NSR ( 8) // Network Status Register +#define EMAC_TSR (20) // Transmit Status Register +#define EMAC_RBQP (24) // Receive Buffer Queue Pointer +#define EMAC_TBQP (28) // Transmit Buffer Queue Pointer +#define EMAC_RSR (32) // Receive Status Register +#define EMAC_ISR (36) // Interrupt Status Register +#define EMAC_IER (40) // Interrupt Enable Register +#define EMAC_IDR (44) // Interrupt Disable Register +#define EMAC_IMR (48) // Interrupt Mask Register +#define EMAC_MAN (52) // PHY Maintenance Register +#define EMAC_PTR (56) // Pause Time Register +#define EMAC_PFR (60) // Pause Frames received Register +#define EMAC_FTO (64) // Frames Transmitted OK Register +#define EMAC_SCF (68) // Single Collision Frame Register +#define EMAC_MCF (72) // Multiple Collision Frame Register +#define EMAC_FRO (76) // Frames Received OK Register +#define EMAC_FCSE (80) // Frame Check Sequence Error Register +#define EMAC_ALE (84) // Alignment Error Register +#define EMAC_DTF (88) // Deferred Transmission Frame Register +#define EMAC_LCOL (92) // Late Collision Register +#define EMAC_ECOL (96) // Excessive Collision Register +#define EMAC_TUND (100) // Transmit Underrun Error Register +#define EMAC_CSE (104) // Carrier Sense Error Register +#define EMAC_RRE (108) // Receive Ressource Error Register +#define EMAC_ROV (112) // Receive Overrun Errors Register +#define EMAC_RSE (116) // Receive Symbol Errors Register +#define EMAC_ELE (120) // Excessive Length Errors Register +#define EMAC_RJA (124) // Receive Jabbers Register +#define EMAC_USF (128) // Undersize Frames Register +#define EMAC_STE (132) // SQE Test Error Register +#define EMAC_RLE (136) // Receive Length Field Mismatch Register +#define EMAC_TPF (140) // Transmitted Pause Frames Register +#define EMAC_HRB (144) // Hash Address Bottom[31:0] +#define EMAC_HRT (148) // Hash Address Top[63:32] +#define EMAC_SA1L (152) // Specific Address 1 Bottom, First 4 bytes +#define EMAC_SA1H (156) // Specific Address 1 Top, Last 2 bytes +#define EMAC_SA2L (160) // Specific Address 2 Bottom, First 4 bytes +#define EMAC_SA2H (164) // Specific Address 2 Top, Last 2 bytes +#define EMAC_SA3L (168) // Specific Address 3 Bottom, First 4 bytes +#define EMAC_SA3H (172) // Specific Address 3 Top, Last 2 bytes +#define EMAC_SA4L (176) // Specific Address 4 Bottom, First 4 bytes +#define EMAC_SA4H (180) // Specific Address 4 Top, Last 2 bytes +#define EMAC_TID (184) // Type ID Checking Register +#define EMAC_TPQ (188) // Transmit Pause Quantum Register +#define EMAC_USRIO (192) // USER Input/Output Register +#define EMAC_WOL (196) // Wake On LAN Register +#define EMAC_REV (252) // Revision Register +// -------- EMAC_NCR : (EMAC Offset: 0x0) -------- +#define AT91C_EMAC_LB (0x1 << 0) // (EMAC) Loopback. Optional. When set, loopback signal is at high level. +#define AT91C_EMAC_LLB (0x1 << 1) // (EMAC) Loopback local. +#define AT91C_EMAC_RE (0x1 << 2) // (EMAC) Receive enable. +#define AT91C_EMAC_TE (0x1 << 3) // (EMAC) Transmit enable. +#define AT91C_EMAC_MPE (0x1 << 4) // (EMAC) Management port enable. +#define AT91C_EMAC_CLRSTAT (0x1 << 5) // (EMAC) Clear statistics registers. +#define AT91C_EMAC_INCSTAT (0x1 << 6) // (EMAC) Increment statistics registers. +#define AT91C_EMAC_WESTAT (0x1 << 7) // (EMAC) Write enable for statistics registers. +#define AT91C_EMAC_BP (0x1 << 8) // (EMAC) Back pressure. +#define AT91C_EMAC_TSTART (0x1 << 9) // (EMAC) Start Transmission. +#define AT91C_EMAC_THALT (0x1 << 10) // (EMAC) Transmission Halt. +#define AT91C_EMAC_TPFR (0x1 << 11) // (EMAC) Transmit pause frame +#define AT91C_EMAC_TZQ (0x1 << 12) // (EMAC) Transmit zero quantum pause frame +// -------- EMAC_NCFGR : (EMAC Offset: 0x4) Network Configuration Register -------- +#define AT91C_EMAC_SPD (0x1 << 0) // (EMAC) Speed. +#define AT91C_EMAC_FD (0x1 << 1) // (EMAC) Full duplex. +#define AT91C_EMAC_JFRAME (0x1 << 3) // (EMAC) Jumbo Frames. +#define AT91C_EMAC_CAF (0x1 << 4) // (EMAC) Copy all frames. +#define AT91C_EMAC_NBC (0x1 << 5) // (EMAC) No broadcast. +#define AT91C_EMAC_MTI (0x1 << 6) // (EMAC) Multicast hash event enable +#define AT91C_EMAC_UNI (0x1 << 7) // (EMAC) Unicast hash enable. +#define AT91C_EMAC_BIG (0x1 << 8) // (EMAC) Receive 1522 bytes. +#define AT91C_EMAC_EAE (0x1 << 9) // (EMAC) External address match enable. +#define AT91C_EMAC_CLK (0x3 << 10) // (EMAC) +#define AT91C_EMAC_CLK_HCLK_8 (0x0 << 10) // (EMAC) HCLK divided by 8 +#define AT91C_EMAC_CLK_HCLK_16 (0x1 << 10) // (EMAC) HCLK divided by 16 +#define AT91C_EMAC_CLK_HCLK_32 (0x2 << 10) // (EMAC) HCLK divided by 32 +#define AT91C_EMAC_CLK_HCLK_64 (0x3 << 10) // (EMAC) HCLK divided by 64 +#define AT91C_EMAC_RTY (0x1 << 12) // (EMAC) +#define AT91C_EMAC_PAE (0x1 << 13) // (EMAC) +#define AT91C_EMAC_RBOF (0x3 << 14) // (EMAC) +#define AT91C_EMAC_RBOF_OFFSET_0 (0x0 << 14) // (EMAC) no offset from start of receive buffer +#define AT91C_EMAC_RBOF_OFFSET_1 (0x1 << 14) // (EMAC) one byte offset from start of receive buffer +#define AT91C_EMAC_RBOF_OFFSET_2 (0x2 << 14) // (EMAC) two bytes offset from start of receive buffer +#define AT91C_EMAC_RBOF_OFFSET_3 (0x3 << 14) // (EMAC) three bytes offset from start of receive buffer +#define AT91C_EMAC_RLCE (0x1 << 16) // (EMAC) Receive Length field Checking Enable +#define AT91C_EMAC_DRFCS (0x1 << 17) // (EMAC) Discard Receive FCS +#define AT91C_EMAC_EFRHD (0x1 << 18) // (EMAC) +#define AT91C_EMAC_IRXFCS (0x1 << 19) // (EMAC) Ignore RX FCS +// -------- EMAC_NSR : (EMAC Offset: 0x8) Network Status Register -------- +#define AT91C_EMAC_LINKR (0x1 << 0) // (EMAC) +#define AT91C_EMAC_MDIO (0x1 << 1) // (EMAC) +#define AT91C_EMAC_IDLE (0x1 << 2) // (EMAC) +// -------- EMAC_TSR : (EMAC Offset: 0x14) Transmit Status Register -------- +#define AT91C_EMAC_UBR (0x1 << 0) // (EMAC) +#define AT91C_EMAC_COL (0x1 << 1) // (EMAC) +#define AT91C_EMAC_RLES (0x1 << 2) // (EMAC) +#define AT91C_EMAC_TGO (0x1 << 3) // (EMAC) Transmit Go +#define AT91C_EMAC_BEX (0x1 << 4) // (EMAC) Buffers exhausted mid frame +#define AT91C_EMAC_COMP (0x1 << 5) // (EMAC) +#define AT91C_EMAC_UND (0x1 << 6) // (EMAC) +// -------- EMAC_RSR : (EMAC Offset: 0x20) Receive Status Register -------- +#define AT91C_EMAC_BNA (0x1 << 0) // (EMAC) +#define AT91C_EMAC_REC (0x1 << 1) // (EMAC) +#define AT91C_EMAC_OVR (0x1 << 2) // (EMAC) +// -------- EMAC_ISR : (EMAC Offset: 0x24) Interrupt Status Register -------- +#define AT91C_EMAC_MFD (0x1 << 0) // (EMAC) +#define AT91C_EMAC_RCOMP (0x1 << 1) // (EMAC) +#define AT91C_EMAC_RXUBR (0x1 << 2) // (EMAC) +#define AT91C_EMAC_TXUBR (0x1 << 3) // (EMAC) +#define AT91C_EMAC_TUNDR (0x1 << 4) // (EMAC) +#define AT91C_EMAC_RLEX (0x1 << 5) // (EMAC) +#define AT91C_EMAC_TXERR (0x1 << 6) // (EMAC) +#define AT91C_EMAC_TCOMP (0x1 << 7) // (EMAC) +#define AT91C_EMAC_LINK (0x1 << 9) // (EMAC) +#define AT91C_EMAC_ROVR (0x1 << 10) // (EMAC) +#define AT91C_EMAC_HRESP (0x1 << 11) // (EMAC) +#define AT91C_EMAC_PFRE (0x1 << 12) // (EMAC) +#define AT91C_EMAC_PTZ (0x1 << 13) // (EMAC) +// -------- EMAC_IER : (EMAC Offset: 0x28) Interrupt Enable Register -------- +// -------- EMAC_IDR : (EMAC Offset: 0x2c) Interrupt Disable Register -------- +// -------- EMAC_IMR : (EMAC Offset: 0x30) Interrupt Mask Register -------- +// -------- EMAC_MAN : (EMAC Offset: 0x34) PHY Maintenance Register -------- +#define AT91C_EMAC_DATA (0xFFFF << 0) // (EMAC) +#define AT91C_EMAC_CODE (0x3 << 16) // (EMAC) +#define AT91C_EMAC_REGA (0x1F << 18) // (EMAC) +#define AT91C_EMAC_PHYA (0x1F << 23) // (EMAC) +#define AT91C_EMAC_RW (0x3 << 28) // (EMAC) +#define AT91C_EMAC_SOF (0x3 << 30) // (EMAC) +// -------- EMAC_USRIO : (EMAC Offset: 0xc0) USER Input Output Register -------- +#define AT91C_EMAC_RMII (0x1 << 0) // (EMAC) Reduce MII +#define AT91C_EMAC_CLKEN (0x1 << 1) // (EMAC) Clock Enable +// -------- EMAC_WOL : (EMAC Offset: 0xc4) Wake On LAN Register -------- +#define AT91C_EMAC_IP (0xFFFF << 0) // (EMAC) ARP request IP address +#define AT91C_EMAC_MAG (0x1 << 16) // (EMAC) Magic packet event enable +#define AT91C_EMAC_ARP (0x1 << 17) // (EMAC) ARP request event enable +#define AT91C_EMAC_SA1 (0x1 << 18) // (EMAC) Specific address register 1 event enable +// -------- EMAC_REV : (EMAC Offset: 0xfc) Revision Register -------- +#define AT91C_EMAC_REVREF (0xFFFF << 0) // (EMAC) +#define AT91C_EMAC_PARTREF (0xFFFF << 16) // (EMAC) + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Analog to Digital Convertor +// ***************************************************************************** +// *** Register offset in AT91S_ADC structure *** +#define ADC_CR ( 0) // ADC Control Register +#define ADC_MR ( 4) // ADC Mode Register +#define ADC_CHER (16) // ADC Channel Enable Register +#define ADC_CHDR (20) // ADC Channel Disable Register +#define ADC_CHSR (24) // ADC Channel Status Register +#define ADC_SR (28) // ADC Status Register +#define ADC_LCDR (32) // ADC Last Converted Data Register +#define ADC_IER (36) // ADC Interrupt Enable Register +#define ADC_IDR (40) // ADC Interrupt Disable Register +#define ADC_IMR (44) // ADC Interrupt Mask Register +#define ADC_CDR0 (48) // ADC Channel Data Register 0 +#define ADC_CDR1 (52) // ADC Channel Data Register 1 +#define ADC_CDR2 (56) // ADC Channel Data Register 2 +#define ADC_CDR3 (60) // ADC Channel Data Register 3 +#define ADC_CDR4 (64) // ADC Channel Data Register 4 +#define ADC_CDR5 (68) // ADC Channel Data Register 5 +#define ADC_CDR6 (72) // ADC Channel Data Register 6 +#define ADC_CDR7 (76) // ADC Channel Data Register 7 +#define ADC_RPR (256) // Receive Pointer Register +#define ADC_RCR (260) // Receive Counter Register +#define ADC_TPR (264) // Transmit Pointer Register +#define ADC_TCR (268) // Transmit Counter Register +#define ADC_RNPR (272) // Receive Next Pointer Register +#define ADC_RNCR (276) // Receive Next Counter Register +#define ADC_TNPR (280) // Transmit Next Pointer Register +#define ADC_TNCR (284) // Transmit Next Counter Register +#define ADC_PTCR (288) // PDC Transfer Control Register +#define ADC_PTSR (292) // PDC Transfer Status Register +// -------- ADC_CR : (ADC Offset: 0x0) ADC Control Register -------- +#define AT91C_ADC_SWRST (0x1 << 0) // (ADC) Software Reset +#define AT91C_ADC_START (0x1 << 1) // (ADC) Start Conversion +// -------- ADC_MR : (ADC Offset: 0x4) ADC Mode Register -------- +#define AT91C_ADC_TRGEN (0x1 << 0) // (ADC) Trigger Enable +#define AT91C_ADC_TRGEN_DIS (0x0) // (ADC) Hradware triggers are disabled. Starting a conversion is only possible by software +#define AT91C_ADC_TRGEN_EN (0x1) // (ADC) Hardware trigger selected by TRGSEL field is enabled. +#define AT91C_ADC_TRGSEL (0x7 << 1) // (ADC) Trigger Selection +#define AT91C_ADC_TRGSEL_TIOA0 (0x0 << 1) // (ADC) Selected TRGSEL = TIAO0 +#define AT91C_ADC_TRGSEL_TIOA1 (0x1 << 1) // (ADC) Selected TRGSEL = TIAO1 +#define AT91C_ADC_TRGSEL_TIOA2 (0x2 << 1) // (ADC) Selected TRGSEL = TIAO2 +#define AT91C_ADC_TRGSEL_TIOA3 (0x3 << 1) // (ADC) Selected TRGSEL = TIAO3 +#define AT91C_ADC_TRGSEL_TIOA4 (0x4 << 1) // (ADC) Selected TRGSEL = TIAO4 +#define AT91C_ADC_TRGSEL_TIOA5 (0x5 << 1) // (ADC) Selected TRGSEL = TIAO5 +#define AT91C_ADC_TRGSEL_EXT (0x6 << 1) // (ADC) Selected TRGSEL = External Trigger +#define AT91C_ADC_LOWRES (0x1 << 4) // (ADC) Resolution. +#define AT91C_ADC_LOWRES_10_BIT (0x0 << 4) // (ADC) 10-bit resolution +#define AT91C_ADC_LOWRES_8_BIT (0x1 << 4) // (ADC) 8-bit resolution +#define AT91C_ADC_SLEEP (0x1 << 5) // (ADC) Sleep Mode +#define AT91C_ADC_SLEEP_NORMAL_MODE (0x0 << 5) // (ADC) Normal Mode +#define AT91C_ADC_SLEEP_MODE (0x1 << 5) // (ADC) Sleep Mode +#define AT91C_ADC_PRESCAL (0x3F << 8) // (ADC) Prescaler rate selection +#define AT91C_ADC_STARTUP (0x1F << 16) // (ADC) Startup Time +#define AT91C_ADC_SHTIM (0xF << 24) // (ADC) Sample & Hold Time +// -------- ADC_CHER : (ADC Offset: 0x10) ADC Channel Enable Register -------- +#define AT91C_ADC_CH0 (0x1 << 0) // (ADC) Channel 0 +#define AT91C_ADC_CH1 (0x1 << 1) // (ADC) Channel 1 +#define AT91C_ADC_CH2 (0x1 << 2) // (ADC) Channel 2 +#define AT91C_ADC_CH3 (0x1 << 3) // (ADC) Channel 3 +#define AT91C_ADC_CH4 (0x1 << 4) // (ADC) Channel 4 +#define AT91C_ADC_CH5 (0x1 << 5) // (ADC) Channel 5 +#define AT91C_ADC_CH6 (0x1 << 6) // (ADC) Channel 6 +#define AT91C_ADC_CH7 (0x1 << 7) // (ADC) Channel 7 +// -------- ADC_CHDR : (ADC Offset: 0x14) ADC Channel Disable Register -------- +// -------- ADC_CHSR : (ADC Offset: 0x18) ADC Channel Status Register -------- +// -------- ADC_SR : (ADC Offset: 0x1c) ADC Status Register -------- +#define AT91C_ADC_EOC0 (0x1 << 0) // (ADC) End of Conversion +#define AT91C_ADC_EOC1 (0x1 << 1) // (ADC) End of Conversion +#define AT91C_ADC_EOC2 (0x1 << 2) // (ADC) End of Conversion +#define AT91C_ADC_EOC3 (0x1 << 3) // (ADC) End of Conversion +#define AT91C_ADC_EOC4 (0x1 << 4) // (ADC) End of Conversion +#define AT91C_ADC_EOC5 (0x1 << 5) // (ADC) End of Conversion +#define AT91C_ADC_EOC6 (0x1 << 6) // (ADC) End of Conversion +#define AT91C_ADC_EOC7 (0x1 << 7) // (ADC) End of Conversion +#define AT91C_ADC_OVRE0 (0x1 << 8) // (ADC) Overrun Error +#define AT91C_ADC_OVRE1 (0x1 << 9) // (ADC) Overrun Error +#define AT91C_ADC_OVRE2 (0x1 << 10) // (ADC) Overrun Error +#define AT91C_ADC_OVRE3 (0x1 << 11) // (ADC) Overrun Error +#define AT91C_ADC_OVRE4 (0x1 << 12) // (ADC) Overrun Error +#define AT91C_ADC_OVRE5 (0x1 << 13) // (ADC) Overrun Error +#define AT91C_ADC_OVRE6 (0x1 << 14) // (ADC) Overrun Error +#define AT91C_ADC_OVRE7 (0x1 << 15) // (ADC) Overrun Error +#define AT91C_ADC_DRDY (0x1 << 16) // (ADC) Data Ready +#define AT91C_ADC_GOVRE (0x1 << 17) // (ADC) General Overrun +#define AT91C_ADC_ENDRX (0x1 << 18) // (ADC) End of Receiver Transfer +#define AT91C_ADC_RXBUFF (0x1 << 19) // (ADC) RXBUFF Interrupt +// -------- ADC_LCDR : (ADC Offset: 0x20) ADC Last Converted Data Register -------- +#define AT91C_ADC_LDATA (0x3FF << 0) // (ADC) Last Data Converted +// -------- ADC_IER : (ADC Offset: 0x24) ADC Interrupt Enable Register -------- +// -------- ADC_IDR : (ADC Offset: 0x28) ADC Interrupt Disable Register -------- +// -------- ADC_IMR : (ADC Offset: 0x2c) ADC Interrupt Mask Register -------- +// -------- ADC_CDR0 : (ADC Offset: 0x30) ADC Channel Data Register 0 -------- +#define AT91C_ADC_DATA (0x3FF << 0) // (ADC) Converted Data +// -------- ADC_CDR1 : (ADC Offset: 0x34) ADC Channel Data Register 1 -------- +// -------- ADC_CDR2 : (ADC Offset: 0x38) ADC Channel Data Register 2 -------- +// -------- ADC_CDR3 : (ADC Offset: 0x3c) ADC Channel Data Register 3 -------- +// -------- ADC_CDR4 : (ADC Offset: 0x40) ADC Channel Data Register 4 -------- +// -------- ADC_CDR5 : (ADC Offset: 0x44) ADC Channel Data Register 5 -------- +// -------- ADC_CDR6 : (ADC Offset: 0x48) ADC Channel Data Register 6 -------- +// -------- ADC_CDR7 : (ADC Offset: 0x4c) ADC Channel Data Register 7 -------- + +// ***************************************************************************** +// REGISTER ADDRESS DEFINITION FOR AT91SAM7X256 +// ***************************************************************************** +// ========== Register definition for SYS peripheral ========== +// ========== Register definition for AIC peripheral ========== +#define AT91C_AIC_IVR (0xFFFFF100) // (AIC) IRQ Vector Register +#define AT91C_AIC_SMR (0xFFFFF000) // (AIC) Source Mode Register +#define AT91C_AIC_FVR (0xFFFFF104) // (AIC) FIQ Vector Register +#define AT91C_AIC_DCR (0xFFFFF138) // (AIC) Debug Control Register (Protect) +#define AT91C_AIC_EOICR (0xFFFFF130) // (AIC) End of Interrupt Command Register +#define AT91C_AIC_SVR (0xFFFFF080) // (AIC) Source Vector Register +#define AT91C_AIC_FFSR (0xFFFFF148) // (AIC) Fast Forcing Status Register +#define AT91C_AIC_ICCR (0xFFFFF128) // (AIC) Interrupt Clear Command Register +#define AT91C_AIC_ISR (0xFFFFF108) // (AIC) Interrupt Status Register +#define AT91C_AIC_IMR (0xFFFFF110) // (AIC) Interrupt Mask Register +#define AT91C_AIC_IPR (0xFFFFF10C) // (AIC) Interrupt Pending Register +#define AT91C_AIC_FFER (0xFFFFF140) // (AIC) Fast Forcing Enable Register +#define AT91C_AIC_IECR (0xFFFFF120) // (AIC) Interrupt Enable Command Register +#define AT91C_AIC_ISCR (0xFFFFF12C) // (AIC) Interrupt Set Command Register +#define AT91C_AIC_FFDR (0xFFFFF144) // (AIC) Fast Forcing Disable Register +#define AT91C_AIC_CISR (0xFFFFF114) // (AIC) Core Interrupt Status Register +#define AT91C_AIC_IDCR (0xFFFFF124) // (AIC) Interrupt Disable Command Register +#define AT91C_AIC_SPU (0xFFFFF134) // (AIC) Spurious Vector Register +// ========== Register definition for PDC_DBGU peripheral ========== +#define AT91C_DBGU_TCR (0xFFFFF30C) // (PDC_DBGU) Transmit Counter Register +#define AT91C_DBGU_RNPR (0xFFFFF310) // (PDC_DBGU) Receive Next Pointer Register +#define AT91C_DBGU_TNPR (0xFFFFF318) // (PDC_DBGU) Transmit Next Pointer Register +#define AT91C_DBGU_TPR (0xFFFFF308) // (PDC_DBGU) Transmit Pointer Register +#define AT91C_DBGU_RPR (0xFFFFF300) // (PDC_DBGU) Receive Pointer Register +#define AT91C_DBGU_RCR (0xFFFFF304) // (PDC_DBGU) Receive Counter Register +#define AT91C_DBGU_RNCR (0xFFFFF314) // (PDC_DBGU) Receive Next Counter Register +#define AT91C_DBGU_PTCR (0xFFFFF320) // (PDC_DBGU) PDC Transfer Control Register +#define AT91C_DBGU_PTSR (0xFFFFF324) // (PDC_DBGU) PDC Transfer Status Register +#define AT91C_DBGU_TNCR (0xFFFFF31C) // (PDC_DBGU) Transmit Next Counter Register +// ========== Register definition for DBGU peripheral ========== +#define AT91C_DBGU_EXID (0xFFFFF244) // (DBGU) Chip ID Extension Register +#define AT91C_DBGU_BRGR (0xFFFFF220) // (DBGU) Baud Rate Generator Register +#define AT91C_DBGU_IDR (0xFFFFF20C) // (DBGU) Interrupt Disable Register +#define AT91C_DBGU_CSR (0xFFFFF214) // (DBGU) Channel Status Register +#define AT91C_DBGU_CIDR (0xFFFFF240) // (DBGU) Chip ID Register +#define AT91C_DBGU_MR (0xFFFFF204) // (DBGU) Mode Register +#define AT91C_DBGU_IMR (0xFFFFF210) // (DBGU) Interrupt Mask Register +#define AT91C_DBGU_CR (0xFFFFF200) // (DBGU) Control Register +#define AT91C_DBGU_FNTR (0xFFFFF248) // (DBGU) Force NTRST Register +#define AT91C_DBGU_THR (0xFFFFF21C) // (DBGU) Transmitter Holding Register +#define AT91C_DBGU_RHR (0xFFFFF218) // (DBGU) Receiver Holding Register +#define AT91C_DBGU_IER (0xFFFFF208) // (DBGU) Interrupt Enable Register +// ========== Register definition for PIOA peripheral ========== +#define AT91C_PIOA_ODR (0xFFFFF414) // (PIOA) Output Disable Registerr +#define AT91C_PIOA_SODR (0xFFFFF430) // (PIOA) Set Output Data Register +#define AT91C_PIOA_ISR (0xFFFFF44C) // (PIOA) Interrupt Status Register +#define AT91C_PIOA_ABSR (0xFFFFF478) // (PIOA) AB Select Status Register +#define AT91C_PIOA_IER (0xFFFFF440) // (PIOA) Interrupt Enable Register +#define AT91C_PIOA_PPUDR (0xFFFFF460) // (PIOA) Pull-up Disable Register +#define AT91C_PIOA_IMR (0xFFFFF448) // (PIOA) Interrupt Mask Register +#define AT91C_PIOA_PER (0xFFFFF400) // (PIOA) PIO Enable Register +#define AT91C_PIOA_IFDR (0xFFFFF424) // (PIOA) Input Filter Disable Register +#define AT91C_PIOA_OWDR (0xFFFFF4A4) // (PIOA) Output Write Disable Register +#define AT91C_PIOA_MDSR (0xFFFFF458) // (PIOA) Multi-driver Status Register +#define AT91C_PIOA_IDR (0xFFFFF444) // (PIOA) Interrupt Disable Register +#define AT91C_PIOA_ODSR (0xFFFFF438) // (PIOA) Output Data Status Register +#define AT91C_PIOA_PPUSR (0xFFFFF468) // (PIOA) Pull-up Status Register +#define AT91C_PIOA_OWSR (0xFFFFF4A8) // (PIOA) Output Write Status Register +#define AT91C_PIOA_BSR (0xFFFFF474) // (PIOA) Select B Register +#define AT91C_PIOA_OWER (0xFFFFF4A0) // (PIOA) Output Write Enable Register +#define AT91C_PIOA_IFER (0xFFFFF420) // (PIOA) Input Filter Enable Register +#define AT91C_PIOA_PDSR (0xFFFFF43C) // (PIOA) Pin Data Status Register +#define AT91C_PIOA_PPUER (0xFFFFF464) // (PIOA) Pull-up Enable Register +#define AT91C_PIOA_OSR (0xFFFFF418) // (PIOA) Output Status Register +#define AT91C_PIOA_ASR (0xFFFFF470) // (PIOA) Select A Register +#define AT91C_PIOA_MDDR (0xFFFFF454) // (PIOA) Multi-driver Disable Register +#define AT91C_PIOA_CODR (0xFFFFF434) // (PIOA) Clear Output Data Register +#define AT91C_PIOA_MDER (0xFFFFF450) // (PIOA) Multi-driver Enable Register +#define AT91C_PIOA_PDR (0xFFFFF404) // (PIOA) PIO Disable Register +#define AT91C_PIOA_IFSR (0xFFFFF428) // (PIOA) Input Filter Status Register +#define AT91C_PIOA_OER (0xFFFFF410) // (PIOA) Output Enable Register +#define AT91C_PIOA_PSR (0xFFFFF408) // (PIOA) PIO Status Register +// ========== Register definition for PIOB peripheral ========== +#define AT91C_PIOB_OWDR (0xFFFFF6A4) // (PIOB) Output Write Disable Register +#define AT91C_PIOB_MDER (0xFFFFF650) // (PIOB) Multi-driver Enable Register +#define AT91C_PIOB_PPUSR (0xFFFFF668) // (PIOB) Pull-up Status Register +#define AT91C_PIOB_IMR (0xFFFFF648) // (PIOB) Interrupt Mask Register +#define AT91C_PIOB_ASR (0xFFFFF670) // (PIOB) Select A Register +#define AT91C_PIOB_PPUDR (0xFFFFF660) // (PIOB) Pull-up Disable Register +#define AT91C_PIOB_PSR (0xFFFFF608) // (PIOB) PIO Status Register +#define AT91C_PIOB_IER (0xFFFFF640) // (PIOB) Interrupt Enable Register +#define AT91C_PIOB_CODR (0xFFFFF634) // (PIOB) Clear Output Data Register +#define AT91C_PIOB_OWER (0xFFFFF6A0) // (PIOB) Output Write Enable Register +#define AT91C_PIOB_ABSR (0xFFFFF678) // (PIOB) AB Select Status Register +#define AT91C_PIOB_IFDR (0xFFFFF624) // (PIOB) Input Filter Disable Register +#define AT91C_PIOB_PDSR (0xFFFFF63C) // (PIOB) Pin Data Status Register +#define AT91C_PIOB_IDR (0xFFFFF644) // (PIOB) Interrupt Disable Register +#define AT91C_PIOB_OWSR (0xFFFFF6A8) // (PIOB) Output Write Status Register +#define AT91C_PIOB_PDR (0xFFFFF604) // (PIOB) PIO Disable Register +#define AT91C_PIOB_ODR (0xFFFFF614) // (PIOB) Output Disable Registerr +#define AT91C_PIOB_IFSR (0xFFFFF628) // (PIOB) Input Filter Status Register +#define AT91C_PIOB_PPUER (0xFFFFF664) // (PIOB) Pull-up Enable Register +#define AT91C_PIOB_SODR (0xFFFFF630) // (PIOB) Set Output Data Register +#define AT91C_PIOB_ISR (0xFFFFF64C) // (PIOB) Interrupt Status Register +#define AT91C_PIOB_ODSR (0xFFFFF638) // (PIOB) Output Data Status Register +#define AT91C_PIOB_OSR (0xFFFFF618) // (PIOB) Output Status Register +#define AT91C_PIOB_MDSR (0xFFFFF658) // (PIOB) Multi-driver Status Register +#define AT91C_PIOB_IFER (0xFFFFF620) // (PIOB) Input Filter Enable Register +#define AT91C_PIOB_BSR (0xFFFFF674) // (PIOB) Select B Register +#define AT91C_PIOB_MDDR (0xFFFFF654) // (PIOB) Multi-driver Disable Register +#define AT91C_PIOB_OER (0xFFFFF610) // (PIOB) Output Enable Register +#define AT91C_PIOB_PER (0xFFFFF600) // (PIOB) PIO Enable Register +// ========== Register definition for CKGR peripheral ========== +#define AT91C_CKGR_MOR (0xFFFFFC20) // (CKGR) Main Oscillator Register +#define AT91C_CKGR_PLLR (0xFFFFFC2C) // (CKGR) PLL Register +#define AT91C_CKGR_MCFR (0xFFFFFC24) // (CKGR) Main Clock Frequency Register +// ========== Register definition for PMC peripheral ========== +#define AT91C_PMC_IDR (0xFFFFFC64) // (PMC) Interrupt Disable Register +#define AT91C_PMC_MOR (0xFFFFFC20) // (PMC) Main Oscillator Register +#define AT91C_PMC_PLLR (0xFFFFFC2C) // (PMC) PLL Register +#define AT91C_PMC_PCER (0xFFFFFC10) // (PMC) Peripheral Clock Enable Register +#define AT91C_PMC_PCKR (0xFFFFFC40) // (PMC) Programmable Clock Register +#define AT91C_PMC_MCKR (0xFFFFFC30) // (PMC) Master Clock Register +#define AT91C_PMC_SCDR (0xFFFFFC04) // (PMC) System Clock Disable Register +#define AT91C_PMC_PCDR (0xFFFFFC14) // (PMC) Peripheral Clock Disable Register +#define AT91C_PMC_SCSR (0xFFFFFC08) // (PMC) System Clock Status Register +#define AT91C_PMC_PCSR (0xFFFFFC18) // (PMC) Peripheral Clock Status Register +#define AT91C_PMC_MCFR (0xFFFFFC24) // (PMC) Main Clock Frequency Register +#define AT91C_PMC_SCER (0xFFFFFC00) // (PMC) System Clock Enable Register +#define AT91C_PMC_IMR (0xFFFFFC6C) // (PMC) Interrupt Mask Register +#define AT91C_PMC_IER (0xFFFFFC60) // (PMC) Interrupt Enable Register +#define AT91C_PMC_SR (0xFFFFFC68) // (PMC) Status Register +// ========== Register definition for RSTC peripheral ========== +#define AT91C_RSTC_RCR (0xFFFFFD00) // (RSTC) Reset Control Register +#define AT91C_RSTC_RMR (0xFFFFFD08) // (RSTC) Reset Mode Register +#define AT91C_RSTC_RSR (0xFFFFFD04) // (RSTC) Reset Status Register +// ========== Register definition for RTTC peripheral ========== +#define AT91C_RTTC_RTSR (0xFFFFFD2C) // (RTTC) Real-time Status Register +#define AT91C_RTTC_RTMR (0xFFFFFD20) // (RTTC) Real-time Mode Register +#define AT91C_RTTC_RTVR (0xFFFFFD28) // (RTTC) Real-time Value Register +#define AT91C_RTTC_RTAR (0xFFFFFD24) // (RTTC) Real-time Alarm Register +// ========== Register definition for PITC peripheral ========== +#define AT91C_PITC_PIVR (0xFFFFFD38) // (PITC) Period Interval Value Register +#define AT91C_PITC_PISR (0xFFFFFD34) // (PITC) Period Interval Status Register +#define AT91C_PITC_PIIR (0xFFFFFD3C) // (PITC) Period Interval Image Register +#define AT91C_PITC_PIMR (0xFFFFFD30) // (PITC) Period Interval Mode Register +// ========== Register definition for WDTC peripheral ========== +#define AT91C_WDTC_WDCR (0xFFFFFD40) // (WDTC) Watchdog Control Register +#define AT91C_WDTC_WDSR (0xFFFFFD48) // (WDTC) Watchdog Status Register +#define AT91C_WDTC_WDMR (0xFFFFFD44) // (WDTC) Watchdog Mode Register +// ========== Register definition for VREG peripheral ========== +#define AT91C_VREG_MR (0xFFFFFD60) // (VREG) Voltage Regulator Mode Register +// ========== Register definition for MC peripheral ========== +#define AT91C_MC_ASR (0xFFFFFF04) // (MC) MC Abort Status Register +#define AT91C_MC_RCR (0xFFFFFF00) // (MC) MC Remap Control Register +#define AT91C_MC_FCR (0xFFFFFF64) // (MC) MC Flash Command Register +#define AT91C_MC_AASR (0xFFFFFF08) // (MC) MC Abort Address Status Register +#define AT91C_MC_FSR (0xFFFFFF68) // (MC) MC Flash Status Register +#define AT91C_MC_FMR (0xFFFFFF60) // (MC) MC Flash Mode Register +// ========== Register definition for PDC_SPI1 peripheral ========== +#define AT91C_SPI1_PTCR (0xFFFE4120) // (PDC_SPI1) PDC Transfer Control Register +#define AT91C_SPI1_RPR (0xFFFE4100) // (PDC_SPI1) Receive Pointer Register +#define AT91C_SPI1_TNCR (0xFFFE411C) // (PDC_SPI1) Transmit Next Counter Register +#define AT91C_SPI1_TPR (0xFFFE4108) // (PDC_SPI1) Transmit Pointer Register +#define AT91C_SPI1_TNPR (0xFFFE4118) // (PDC_SPI1) Transmit Next Pointer Register +#define AT91C_SPI1_TCR (0xFFFE410C) // (PDC_SPI1) Transmit Counter Register +#define AT91C_SPI1_RCR (0xFFFE4104) // (PDC_SPI1) Receive Counter Register +#define AT91C_SPI1_RNPR (0xFFFE4110) // (PDC_SPI1) Receive Next Pointer Register +#define AT91C_SPI1_RNCR (0xFFFE4114) // (PDC_SPI1) Receive Next Counter Register +#define AT91C_SPI1_PTSR (0xFFFE4124) // (PDC_SPI1) PDC Transfer Status Register +// ========== Register definition for SPI1 peripheral ========== +#define AT91C_SPI1_IMR (0xFFFE401C) // (SPI1) Interrupt Mask Register +#define AT91C_SPI1_IER (0xFFFE4014) // (SPI1) Interrupt Enable Register +#define AT91C_SPI1_MR (0xFFFE4004) // (SPI1) Mode Register +#define AT91C_SPI1_RDR (0xFFFE4008) // (SPI1) Receive Data Register +#define AT91C_SPI1_IDR (0xFFFE4018) // (SPI1) Interrupt Disable Register +#define AT91C_SPI1_SR (0xFFFE4010) // (SPI1) Status Register +#define AT91C_SPI1_TDR (0xFFFE400C) // (SPI1) Transmit Data Register +#define AT91C_SPI1_CR (0xFFFE4000) // (SPI1) Control Register +#define AT91C_SPI1_CSR (0xFFFE4030) // (SPI1) Chip Select Register +// ========== Register definition for PDC_SPI0 peripheral ========== +#define AT91C_SPI0_PTCR (0xFFFE0120) // (PDC_SPI0) PDC Transfer Control Register +#define AT91C_SPI0_TPR (0xFFFE0108) // (PDC_SPI0) Transmit Pointer Register +#define AT91C_SPI0_TCR (0xFFFE010C) // (PDC_SPI0) Transmit Counter Register +#define AT91C_SPI0_RCR (0xFFFE0104) // (PDC_SPI0) Receive Counter Register +#define AT91C_SPI0_PTSR (0xFFFE0124) // (PDC_SPI0) PDC Transfer Status Register +#define AT91C_SPI0_RNPR (0xFFFE0110) // (PDC_SPI0) Receive Next Pointer Register +#define AT91C_SPI0_RPR (0xFFFE0100) // (PDC_SPI0) Receive Pointer Register +#define AT91C_SPI0_TNCR (0xFFFE011C) // (PDC_SPI0) Transmit Next Counter Register +#define AT91C_SPI0_RNCR (0xFFFE0114) // (PDC_SPI0) Receive Next Counter Register +#define AT91C_SPI0_TNPR (0xFFFE0118) // (PDC_SPI0) Transmit Next Pointer Register +// ========== Register definition for SPI0 peripheral ========== +#define AT91C_SPI0_IER (0xFFFE0014) // (SPI0) Interrupt Enable Register +#define AT91C_SPI0_SR (0xFFFE0010) // (SPI0) Status Register +#define AT91C_SPI0_IDR (0xFFFE0018) // (SPI0) Interrupt Disable Register +#define AT91C_SPI0_CR (0xFFFE0000) // (SPI0) Control Register +#define AT91C_SPI0_MR (0xFFFE0004) // (SPI0) Mode Register +#define AT91C_SPI0_IMR (0xFFFE001C) // (SPI0) Interrupt Mask Register +#define AT91C_SPI0_TDR (0xFFFE000C) // (SPI0) Transmit Data Register +#define AT91C_SPI0_RDR (0xFFFE0008) // (SPI0) Receive Data Register +#define AT91C_SPI0_CSR (0xFFFE0030) // (SPI0) Chip Select Register +// ========== Register definition for PDC_US1 peripheral ========== +#define AT91C_US1_RNCR (0xFFFC4114) // (PDC_US1) Receive Next Counter Register +#define AT91C_US1_PTCR (0xFFFC4120) // (PDC_US1) PDC Transfer Control Register +#define AT91C_US1_TCR (0xFFFC410C) // (PDC_US1) Transmit Counter Register +#define AT91C_US1_PTSR (0xFFFC4124) // (PDC_US1) PDC Transfer Status Register +#define AT91C_US1_TNPR (0xFFFC4118) // (PDC_US1) Transmit Next Pointer Register +#define AT91C_US1_RCR (0xFFFC4104) // (PDC_US1) Receive Counter Register +#define AT91C_US1_RNPR (0xFFFC4110) // (PDC_US1) Receive Next Pointer Register +#define AT91C_US1_RPR (0xFFFC4100) // (PDC_US1) Receive Pointer Register +#define AT91C_US1_TNCR (0xFFFC411C) // (PDC_US1) Transmit Next Counter Register +#define AT91C_US1_TPR (0xFFFC4108) // (PDC_US1) Transmit Pointer Register +// ========== Register definition for US1 peripheral ========== +#define AT91C_US1_IF (0xFFFC404C) // (US1) IRDA_FILTER Register +#define AT91C_US1_NER (0xFFFC4044) // (US1) Nb Errors Register +#define AT91C_US1_RTOR (0xFFFC4024) // (US1) Receiver Time-out Register +#define AT91C_US1_CSR (0xFFFC4014) // (US1) Channel Status Register +#define AT91C_US1_IDR (0xFFFC400C) // (US1) Interrupt Disable Register +#define AT91C_US1_IER (0xFFFC4008) // (US1) Interrupt Enable Register +#define AT91C_US1_THR (0xFFFC401C) // (US1) Transmitter Holding Register +#define AT91C_US1_TTGR (0xFFFC4028) // (US1) Transmitter Time-guard Register +#define AT91C_US1_RHR (0xFFFC4018) // (US1) Receiver Holding Register +#define AT91C_US1_BRGR (0xFFFC4020) // (US1) Baud Rate Generator Register +#define AT91C_US1_IMR (0xFFFC4010) // (US1) Interrupt Mask Register +#define AT91C_US1_FIDI (0xFFFC4040) // (US1) FI_DI_Ratio Register +#define AT91C_US1_CR (0xFFFC4000) // (US1) Control Register +#define AT91C_US1_MR (0xFFFC4004) // (US1) Mode Register +// ========== Register definition for PDC_US0 peripheral ========== +#define AT91C_US0_TNPR (0xFFFC0118) // (PDC_US0) Transmit Next Pointer Register +#define AT91C_US0_RNPR (0xFFFC0110) // (PDC_US0) Receive Next Pointer Register +#define AT91C_US0_TCR (0xFFFC010C) // (PDC_US0) Transmit Counter Register +#define AT91C_US0_PTCR (0xFFFC0120) // (PDC_US0) PDC Transfer Control Register +#define AT91C_US0_PTSR (0xFFFC0124) // (PDC_US0) PDC Transfer Status Register +#define AT91C_US0_TNCR (0xFFFC011C) // (PDC_US0) Transmit Next Counter Register +#define AT91C_US0_TPR (0xFFFC0108) // (PDC_US0) Transmit Pointer Register +#define AT91C_US0_RCR (0xFFFC0104) // (PDC_US0) Receive Counter Register +#define AT91C_US0_RPR (0xFFFC0100) // (PDC_US0) Receive Pointer Register +#define AT91C_US0_RNCR (0xFFFC0114) // (PDC_US0) Receive Next Counter Register +// ========== Register definition for US0 peripheral ========== +#define AT91C_US0_BRGR (0xFFFC0020) // (US0) Baud Rate Generator Register +#define AT91C_US0_NER (0xFFFC0044) // (US0) Nb Errors Register +#define AT91C_US0_CR (0xFFFC0000) // (US0) Control Register +#define AT91C_US0_IMR (0xFFFC0010) // (US0) Interrupt Mask Register +#define AT91C_US0_FIDI (0xFFFC0040) // (US0) FI_DI_Ratio Register +#define AT91C_US0_TTGR (0xFFFC0028) // (US0) Transmitter Time-guard Register +#define AT91C_US0_MR (0xFFFC0004) // (US0) Mode Register +#define AT91C_US0_RTOR (0xFFFC0024) // (US0) Receiver Time-out Register +#define AT91C_US0_CSR (0xFFFC0014) // (US0) Channel Status Register +#define AT91C_US0_RHR (0xFFFC0018) // (US0) Receiver Holding Register +#define AT91C_US0_IDR (0xFFFC000C) // (US0) Interrupt Disable Register +#define AT91C_US0_THR (0xFFFC001C) // (US0) Transmitter Holding Register +#define AT91C_US0_IF (0xFFFC004C) // (US0) IRDA_FILTER Register +#define AT91C_US0_IER (0xFFFC0008) // (US0) Interrupt Enable Register +// ========== Register definition for PDC_SSC peripheral ========== +#define AT91C_SSC_TNCR (0xFFFD411C) // (PDC_SSC) Transmit Next Counter Register +#define AT91C_SSC_RPR (0xFFFD4100) // (PDC_SSC) Receive Pointer Register +#define AT91C_SSC_RNCR (0xFFFD4114) // (PDC_SSC) Receive Next Counter Register +#define AT91C_SSC_TPR (0xFFFD4108) // (PDC_SSC) Transmit Pointer Register +#define AT91C_SSC_PTCR (0xFFFD4120) // (PDC_SSC) PDC Transfer Control Register +#define AT91C_SSC_TCR (0xFFFD410C) // (PDC_SSC) Transmit Counter Register +#define AT91C_SSC_RCR (0xFFFD4104) // (PDC_SSC) Receive Counter Register +#define AT91C_SSC_RNPR (0xFFFD4110) // (PDC_SSC) Receive Next Pointer Register +#define AT91C_SSC_TNPR (0xFFFD4118) // (PDC_SSC) Transmit Next Pointer Register +#define AT91C_SSC_PTSR (0xFFFD4124) // (PDC_SSC) PDC Transfer Status Register +// ========== Register definition for SSC peripheral ========== +#define AT91C_SSC_RHR (0xFFFD4020) // (SSC) Receive Holding Register +#define AT91C_SSC_RSHR (0xFFFD4030) // (SSC) Receive Sync Holding Register +#define AT91C_SSC_TFMR (0xFFFD401C) // (SSC) Transmit Frame Mode Register +#define AT91C_SSC_IDR (0xFFFD4048) // (SSC) Interrupt Disable Register +#define AT91C_SSC_THR (0xFFFD4024) // (SSC) Transmit Holding Register +#define AT91C_SSC_RCMR (0xFFFD4010) // (SSC) Receive Clock ModeRegister +#define AT91C_SSC_IER (0xFFFD4044) // (SSC) Interrupt Enable Register +#define AT91C_SSC_TSHR (0xFFFD4034) // (SSC) Transmit Sync Holding Register +#define AT91C_SSC_SR (0xFFFD4040) // (SSC) Status Register +#define AT91C_SSC_CMR (0xFFFD4004) // (SSC) Clock Mode Register +#define AT91C_SSC_TCMR (0xFFFD4018) // (SSC) Transmit Clock Mode Register +#define AT91C_SSC_CR (0xFFFD4000) // (SSC) Control Register +#define AT91C_SSC_IMR (0xFFFD404C) // (SSC) Interrupt Mask Register +#define AT91C_SSC_RFMR (0xFFFD4014) // (SSC) Receive Frame Mode Register +// ========== Register definition for TWI peripheral ========== +#define AT91C_TWI_IER (0xFFFB8024) // (TWI) Interrupt Enable Register +#define AT91C_TWI_CR (0xFFFB8000) // (TWI) Control Register +#define AT91C_TWI_SR (0xFFFB8020) // (TWI) Status Register +#define AT91C_TWI_IMR (0xFFFB802C) // (TWI) Interrupt Mask Register +#define AT91C_TWI_THR (0xFFFB8034) // (TWI) Transmit Holding Register +#define AT91C_TWI_IDR (0xFFFB8028) // (TWI) Interrupt Disable Register +#define AT91C_TWI_IADR (0xFFFB800C) // (TWI) Internal Address Register +#define AT91C_TWI_MMR (0xFFFB8004) // (TWI) Master Mode Register +#define AT91C_TWI_CWGR (0xFFFB8010) // (TWI) Clock Waveform Generator Register +#define AT91C_TWI_RHR (0xFFFB8030) // (TWI) Receive Holding Register +// ========== Register definition for PWMC_CH3 peripheral ========== +#define AT91C_PWMC_CH3_CUPDR (0xFFFCC270) // (PWMC_CH3) Channel Update Register +#define AT91C_PWMC_CH3_Reserved (0xFFFCC274) // (PWMC_CH3) Reserved +#define AT91C_PWMC_CH3_CPRDR (0xFFFCC268) // (PWMC_CH3) Channel Period Register +#define AT91C_PWMC_CH3_CDTYR (0xFFFCC264) // (PWMC_CH3) Channel Duty Cycle Register +#define AT91C_PWMC_CH3_CCNTR (0xFFFCC26C) // (PWMC_CH3) Channel Counter Register +#define AT91C_PWMC_CH3_CMR (0xFFFCC260) // (PWMC_CH3) Channel Mode Register +// ========== Register definition for PWMC_CH2 peripheral ========== +#define AT91C_PWMC_CH2_Reserved (0xFFFCC254) // (PWMC_CH2) Reserved +#define AT91C_PWMC_CH2_CMR (0xFFFCC240) // (PWMC_CH2) Channel Mode Register +#define AT91C_PWMC_CH2_CCNTR (0xFFFCC24C) // (PWMC_CH2) Channel Counter Register +#define AT91C_PWMC_CH2_CPRDR (0xFFFCC248) // (PWMC_CH2) Channel Period Register +#define AT91C_PWMC_CH2_CUPDR (0xFFFCC250) // (PWMC_CH2) Channel Update Register +#define AT91C_PWMC_CH2_CDTYR (0xFFFCC244) // (PWMC_CH2) Channel Duty Cycle Register +// ========== Register definition for PWMC_CH1 peripheral ========== +#define AT91C_PWMC_CH1_Reserved (0xFFFCC234) // (PWMC_CH1) Reserved +#define AT91C_PWMC_CH1_CUPDR (0xFFFCC230) // (PWMC_CH1) Channel Update Register +#define AT91C_PWMC_CH1_CPRDR (0xFFFCC228) // (PWMC_CH1) Channel Period Register +#define AT91C_PWMC_CH1_CCNTR (0xFFFCC22C) // (PWMC_CH1) Channel Counter Register +#define AT91C_PWMC_CH1_CDTYR (0xFFFCC224) // (PWMC_CH1) Channel Duty Cycle Register +#define AT91C_PWMC_CH1_CMR (0xFFFCC220) // (PWMC_CH1) Channel Mode Register +// ========== Register definition for PWMC_CH0 peripheral ========== +#define AT91C_PWMC_CH0_Reserved (0xFFFCC214) // (PWMC_CH0) Reserved +#define AT91C_PWMC_CH0_CPRDR (0xFFFCC208) // (PWMC_CH0) Channel Period Register +#define AT91C_PWMC_CH0_CDTYR (0xFFFCC204) // (PWMC_CH0) Channel Duty Cycle Register +#define AT91C_PWMC_CH0_CMR (0xFFFCC200) // (PWMC_CH0) Channel Mode Register +#define AT91C_PWMC_CH0_CUPDR (0xFFFCC210) // (PWMC_CH0) Channel Update Register +#define AT91C_PWMC_CH0_CCNTR (0xFFFCC20C) // (PWMC_CH0) Channel Counter Register +// ========== Register definition for PWMC peripheral ========== +#define AT91C_PWMC_IDR (0xFFFCC014) // (PWMC) PWMC Interrupt Disable Register +#define AT91C_PWMC_DIS (0xFFFCC008) // (PWMC) PWMC Disable Register +#define AT91C_PWMC_IER (0xFFFCC010) // (PWMC) PWMC Interrupt Enable Register +#define AT91C_PWMC_VR (0xFFFCC0FC) // (PWMC) PWMC Version Register +#define AT91C_PWMC_ISR (0xFFFCC01C) // (PWMC) PWMC Interrupt Status Register +#define AT91C_PWMC_SR (0xFFFCC00C) // (PWMC) PWMC Status Register +#define AT91C_PWMC_IMR (0xFFFCC018) // (PWMC) PWMC Interrupt Mask Register +#define AT91C_PWMC_MR (0xFFFCC000) // (PWMC) PWMC Mode Register +#define AT91C_PWMC_ENA (0xFFFCC004) // (PWMC) PWMC Enable Register +// ========== Register definition for UDP peripheral ========== +#define AT91C_UDP_IMR (0xFFFB0018) // (UDP) Interrupt Mask Register +#define AT91C_UDP_FADDR (0xFFFB0008) // (UDP) Function Address Register +#define AT91C_UDP_NUM (0xFFFB0000) // (UDP) Frame Number Register +#define AT91C_UDP_FDR (0xFFFB0050) // (UDP) Endpoint FIFO Data Register +#define AT91C_UDP_ISR (0xFFFB001C) // (UDP) Interrupt Status Register +#define AT91C_UDP_CSR (0xFFFB0030) // (UDP) Endpoint Control and Status Register +#define AT91C_UDP_IDR (0xFFFB0014) // (UDP) Interrupt Disable Register +#define AT91C_UDP_ICR (0xFFFB0020) // (UDP) Interrupt Clear Register +#define AT91C_UDP_RSTEP (0xFFFB0028) // (UDP) Reset Endpoint Register +#define AT91C_UDP_TXVC (0xFFFB0074) // (UDP) Transceiver Control Register +#define AT91C_UDP_GLBSTATE (0xFFFB0004) // (UDP) Global State Register +#define AT91C_UDP_IER (0xFFFB0010) // (UDP) Interrupt Enable Register +// ========== Register definition for TC0 peripheral ========== +#define AT91C_TC0_SR (0xFFFA0020) // (TC0) Status Register +#define AT91C_TC0_RC (0xFFFA001C) // (TC0) Register C +#define AT91C_TC0_RB (0xFFFA0018) // (TC0) Register B +#define AT91C_TC0_CCR (0xFFFA0000) // (TC0) Channel Control Register +#define AT91C_TC0_CMR (0xFFFA0004) // (TC0) Channel Mode Register (Capture Mode / Waveform Mode) +#define AT91C_TC0_IER (0xFFFA0024) // (TC0) Interrupt Enable Register +#define AT91C_TC0_RA (0xFFFA0014) // (TC0) Register A +#define AT91C_TC0_IDR (0xFFFA0028) // (TC0) Interrupt Disable Register +#define AT91C_TC0_CV (0xFFFA0010) // (TC0) Counter Value +#define AT91C_TC0_IMR (0xFFFA002C) // (TC0) Interrupt Mask Register +// ========== Register definition for TC1 peripheral ========== +#define AT91C_TC1_RB (0xFFFA0058) // (TC1) Register B +#define AT91C_TC1_CCR (0xFFFA0040) // (TC1) Channel Control Register +#define AT91C_TC1_IER (0xFFFA0064) // (TC1) Interrupt Enable Register +#define AT91C_TC1_IDR (0xFFFA0068) // (TC1) Interrupt Disable Register +#define AT91C_TC1_SR (0xFFFA0060) // (TC1) Status Register +#define AT91C_TC1_CMR (0xFFFA0044) // (TC1) Channel Mode Register (Capture Mode / Waveform Mode) +#define AT91C_TC1_RA (0xFFFA0054) // (TC1) Register A +#define AT91C_TC1_RC (0xFFFA005C) // (TC1) Register C +#define AT91C_TC1_IMR (0xFFFA006C) // (TC1) Interrupt Mask Register +#define AT91C_TC1_CV (0xFFFA0050) // (TC1) Counter Value +// ========== Register definition for TC2 peripheral ========== +#define AT91C_TC2_CMR (0xFFFA0084) // (TC2) Channel Mode Register (Capture Mode / Waveform Mode) +#define AT91C_TC2_CCR (0xFFFA0080) // (TC2) Channel Control Register +#define AT91C_TC2_CV (0xFFFA0090) // (TC2) Counter Value +#define AT91C_TC2_RA (0xFFFA0094) // (TC2) Register A +#define AT91C_TC2_RB (0xFFFA0098) // (TC2) Register B +#define AT91C_TC2_IDR (0xFFFA00A8) // (TC2) Interrupt Disable Register +#define AT91C_TC2_IMR (0xFFFA00AC) // (TC2) Interrupt Mask Register +#define AT91C_TC2_RC (0xFFFA009C) // (TC2) Register C +#define AT91C_TC2_IER (0xFFFA00A4) // (TC2) Interrupt Enable Register +#define AT91C_TC2_SR (0xFFFA00A0) // (TC2) Status Register +// ========== Register definition for TCB peripheral ========== +#define AT91C_TCB_BMR (0xFFFA00C4) // (TCB) TC Block Mode Register +#define AT91C_TCB_BCR (0xFFFA00C0) // (TCB) TC Block Control Register +// ========== Register definition for CAN_MB0 peripheral ========== +#define AT91C_CAN_MB0_MDL (0xFFFD0214) // (CAN_MB0) MailBox Data Low Register +#define AT91C_CAN_MB0_MAM (0xFFFD0204) // (CAN_MB0) MailBox Acceptance Mask Register +#define AT91C_CAN_MB0_MCR (0xFFFD021C) // (CAN_MB0) MailBox Control Register +#define AT91C_CAN_MB0_MID (0xFFFD0208) // (CAN_MB0) MailBox ID Register +#define AT91C_CAN_MB0_MSR (0xFFFD0210) // (CAN_MB0) MailBox Status Register +#define AT91C_CAN_MB0_MFID (0xFFFD020C) // (CAN_MB0) MailBox Family ID Register +#define AT91C_CAN_MB0_MDH (0xFFFD0218) // (CAN_MB0) MailBox Data High Register +#define AT91C_CAN_MB0_MMR (0xFFFD0200) // (CAN_MB0) MailBox Mode Register +// ========== Register definition for CAN_MB1 peripheral ========== +#define AT91C_CAN_MB1_MDL (0xFFFD0234) // (CAN_MB1) MailBox Data Low Register +#define AT91C_CAN_MB1_MID (0xFFFD0228) // (CAN_MB1) MailBox ID Register +#define AT91C_CAN_MB1_MMR (0xFFFD0220) // (CAN_MB1) MailBox Mode Register +#define AT91C_CAN_MB1_MSR (0xFFFD0230) // (CAN_MB1) MailBox Status Register +#define AT91C_CAN_MB1_MAM (0xFFFD0224) // (CAN_MB1) MailBox Acceptance Mask Register +#define AT91C_CAN_MB1_MDH (0xFFFD0238) // (CAN_MB1) MailBox Data High Register +#define AT91C_CAN_MB1_MCR (0xFFFD023C) // (CAN_MB1) MailBox Control Register +#define AT91C_CAN_MB1_MFID (0xFFFD022C) // (CAN_MB1) MailBox Family ID Register +// ========== Register definition for CAN_MB2 peripheral ========== +#define AT91C_CAN_MB2_MCR (0xFFFD025C) // (CAN_MB2) MailBox Control Register +#define AT91C_CAN_MB2_MDH (0xFFFD0258) // (CAN_MB2) MailBox Data High Register +#define AT91C_CAN_MB2_MID (0xFFFD0248) // (CAN_MB2) MailBox ID Register +#define AT91C_CAN_MB2_MDL (0xFFFD0254) // (CAN_MB2) MailBox Data Low Register +#define AT91C_CAN_MB2_MMR (0xFFFD0240) // (CAN_MB2) MailBox Mode Register +#define AT91C_CAN_MB2_MAM (0xFFFD0244) // (CAN_MB2) MailBox Acceptance Mask Register +#define AT91C_CAN_MB2_MFID (0xFFFD024C) // (CAN_MB2) MailBox Family ID Register +#define AT91C_CAN_MB2_MSR (0xFFFD0250) // (CAN_MB2) MailBox Status Register +// ========== Register definition for CAN_MB3 peripheral ========== +#define AT91C_CAN_MB3_MFID (0xFFFD026C) // (CAN_MB3) MailBox Family ID Register +#define AT91C_CAN_MB3_MAM (0xFFFD0264) // (CAN_MB3) MailBox Acceptance Mask Register +#define AT91C_CAN_MB3_MID (0xFFFD0268) // (CAN_MB3) MailBox ID Register +#define AT91C_CAN_MB3_MCR (0xFFFD027C) // (CAN_MB3) MailBox Control Register +#define AT91C_CAN_MB3_MMR (0xFFFD0260) // (CAN_MB3) MailBox Mode Register +#define AT91C_CAN_MB3_MSR (0xFFFD0270) // (CAN_MB3) MailBox Status Register +#define AT91C_CAN_MB3_MDL (0xFFFD0274) // (CAN_MB3) MailBox Data Low Register +#define AT91C_CAN_MB3_MDH (0xFFFD0278) // (CAN_MB3) MailBox Data High Register +// ========== Register definition for CAN_MB4 peripheral ========== +#define AT91C_CAN_MB4_MID (0xFFFD0288) // (CAN_MB4) MailBox ID Register +#define AT91C_CAN_MB4_MMR (0xFFFD0280) // (CAN_MB4) MailBox Mode Register +#define AT91C_CAN_MB4_MDH (0xFFFD0298) // (CAN_MB4) MailBox Data High Register +#define AT91C_CAN_MB4_MFID (0xFFFD028C) // (CAN_MB4) MailBox Family ID Register +#define AT91C_CAN_MB4_MSR (0xFFFD0290) // (CAN_MB4) MailBox Status Register +#define AT91C_CAN_MB4_MCR (0xFFFD029C) // (CAN_MB4) MailBox Control Register +#define AT91C_CAN_MB4_MDL (0xFFFD0294) // (CAN_MB4) MailBox Data Low Register +#define AT91C_CAN_MB4_MAM (0xFFFD0284) // (CAN_MB4) MailBox Acceptance Mask Register +// ========== Register definition for CAN_MB5 peripheral ========== +#define AT91C_CAN_MB5_MSR (0xFFFD02B0) // (CAN_MB5) MailBox Status Register +#define AT91C_CAN_MB5_MCR (0xFFFD02BC) // (CAN_MB5) MailBox Control Register +#define AT91C_CAN_MB5_MFID (0xFFFD02AC) // (CAN_MB5) MailBox Family ID Register +#define AT91C_CAN_MB5_MDH (0xFFFD02B8) // (CAN_MB5) MailBox Data High Register +#define AT91C_CAN_MB5_MID (0xFFFD02A8) // (CAN_MB5) MailBox ID Register +#define AT91C_CAN_MB5_MMR (0xFFFD02A0) // (CAN_MB5) MailBox Mode Register +#define AT91C_CAN_MB5_MDL (0xFFFD02B4) // (CAN_MB5) MailBox Data Low Register +#define AT91C_CAN_MB5_MAM (0xFFFD02A4) // (CAN_MB5) MailBox Acceptance Mask Register +// ========== Register definition for CAN_MB6 peripheral ========== +#define AT91C_CAN_MB6_MFID (0xFFFD02CC) // (CAN_MB6) MailBox Family ID Register +#define AT91C_CAN_MB6_MID (0xFFFD02C8) // (CAN_MB6) MailBox ID Register +#define AT91C_CAN_MB6_MAM (0xFFFD02C4) // (CAN_MB6) MailBox Acceptance Mask Register +#define AT91C_CAN_MB6_MSR (0xFFFD02D0) // (CAN_MB6) MailBox Status Register +#define AT91C_CAN_MB6_MDL (0xFFFD02D4) // (CAN_MB6) MailBox Data Low Register +#define AT91C_CAN_MB6_MCR (0xFFFD02DC) // (CAN_MB6) MailBox Control Register +#define AT91C_CAN_MB6_MDH (0xFFFD02D8) // (CAN_MB6) MailBox Data High Register +#define AT91C_CAN_MB6_MMR (0xFFFD02C0) // (CAN_MB6) MailBox Mode Register +// ========== Register definition for CAN_MB7 peripheral ========== +#define AT91C_CAN_MB7_MCR (0xFFFD02FC) // (CAN_MB7) MailBox Control Register +#define AT91C_CAN_MB7_MDH (0xFFFD02F8) // (CAN_MB7) MailBox Data High Register +#define AT91C_CAN_MB7_MFID (0xFFFD02EC) // (CAN_MB7) MailBox Family ID Register +#define AT91C_CAN_MB7_MDL (0xFFFD02F4) // (CAN_MB7) MailBox Data Low Register +#define AT91C_CAN_MB7_MID (0xFFFD02E8) // (CAN_MB7) MailBox ID Register +#define AT91C_CAN_MB7_MMR (0xFFFD02E0) // (CAN_MB7) MailBox Mode Register +#define AT91C_CAN_MB7_MAM (0xFFFD02E4) // (CAN_MB7) MailBox Acceptance Mask Register +#define AT91C_CAN_MB7_MSR (0xFFFD02F0) // (CAN_MB7) MailBox Status Register +// ========== Register definition for CAN peripheral ========== +#define AT91C_CAN_TCR (0xFFFD0024) // (CAN) Transfer Command Register +#define AT91C_CAN_IMR (0xFFFD000C) // (CAN) Interrupt Mask Register +#define AT91C_CAN_IER (0xFFFD0004) // (CAN) Interrupt Enable Register +#define AT91C_CAN_ECR (0xFFFD0020) // (CAN) Error Counter Register +#define AT91C_CAN_TIMESTP (0xFFFD001C) // (CAN) Time Stamp Register +#define AT91C_CAN_MR (0xFFFD0000) // (CAN) Mode Register +#define AT91C_CAN_IDR (0xFFFD0008) // (CAN) Interrupt Disable Register +#define AT91C_CAN_ACR (0xFFFD0028) // (CAN) Abort Command Register +#define AT91C_CAN_TIM (0xFFFD0018) // (CAN) Timer Register +#define AT91C_CAN_SR (0xFFFD0010) // (CAN) Status Register +#define AT91C_CAN_BR (0xFFFD0014) // (CAN) Baudrate Register +#define AT91C_CAN_VR (0xFFFD00FC) // (CAN) Version Register +// ========== Register definition for EMAC peripheral ========== +#define AT91C_EMAC_ISR (0xFFFDC024) // (EMAC) Interrupt Status Register +#define AT91C_EMAC_SA4H (0xFFFDC0B4) // (EMAC) Specific Address 4 Top, Last 2 bytes +#define AT91C_EMAC_SA1L (0xFFFDC098) // (EMAC) Specific Address 1 Bottom, First 4 bytes +#define AT91C_EMAC_ELE (0xFFFDC078) // (EMAC) Excessive Length Errors Register +#define AT91C_EMAC_LCOL (0xFFFDC05C) // (EMAC) Late Collision Register +#define AT91C_EMAC_RLE (0xFFFDC088) // (EMAC) Receive Length Field Mismatch Register +#define AT91C_EMAC_WOL (0xFFFDC0C4) // (EMAC) Wake On LAN Register +#define AT91C_EMAC_DTF (0xFFFDC058) // (EMAC) Deferred Transmission Frame Register +#define AT91C_EMAC_TUND (0xFFFDC064) // (EMAC) Transmit Underrun Error Register +#define AT91C_EMAC_NCR (0xFFFDC000) // (EMAC) Network Control Register +#define AT91C_EMAC_SA4L (0xFFFDC0B0) // (EMAC) Specific Address 4 Bottom, First 4 bytes +#define AT91C_EMAC_RSR (0xFFFDC020) // (EMAC) Receive Status Register +#define AT91C_EMAC_SA3L (0xFFFDC0A8) // (EMAC) Specific Address 3 Bottom, First 4 bytes +#define AT91C_EMAC_TSR (0xFFFDC014) // (EMAC) Transmit Status Register +#define AT91C_EMAC_IDR (0xFFFDC02C) // (EMAC) Interrupt Disable Register +#define AT91C_EMAC_RSE (0xFFFDC074) // (EMAC) Receive Symbol Errors Register +#define AT91C_EMAC_ECOL (0xFFFDC060) // (EMAC) Excessive Collision Register +#define AT91C_EMAC_TID (0xFFFDC0B8) // (EMAC) Type ID Checking Register +#define AT91C_EMAC_HRB (0xFFFDC090) // (EMAC) Hash Address Bottom[31:0] +#define AT91C_EMAC_TBQP (0xFFFDC01C) // (EMAC) Transmit Buffer Queue Pointer +#define AT91C_EMAC_USRIO (0xFFFDC0C0) // (EMAC) USER Input/Output Register +#define AT91C_EMAC_PTR (0xFFFDC038) // (EMAC) Pause Time Register +#define AT91C_EMAC_SA2H (0xFFFDC0A4) // (EMAC) Specific Address 2 Top, Last 2 bytes +#define AT91C_EMAC_ROV (0xFFFDC070) // (EMAC) Receive Overrun Errors Register +#define AT91C_EMAC_ALE (0xFFFDC054) // (EMAC) Alignment Error Register +#define AT91C_EMAC_RJA (0xFFFDC07C) // (EMAC) Receive Jabbers Register +#define AT91C_EMAC_RBQP (0xFFFDC018) // (EMAC) Receive Buffer Queue Pointer +#define AT91C_EMAC_TPF (0xFFFDC08C) // (EMAC) Transmitted Pause Frames Register +#define AT91C_EMAC_NCFGR (0xFFFDC004) // (EMAC) Network Configuration Register +#define AT91C_EMAC_HRT (0xFFFDC094) // (EMAC) Hash Address Top[63:32] +#define AT91C_EMAC_USF (0xFFFDC080) // (EMAC) Undersize Frames Register +#define AT91C_EMAC_FCSE (0xFFFDC050) // (EMAC) Frame Check Sequence Error Register +#define AT91C_EMAC_TPQ (0xFFFDC0BC) // (EMAC) Transmit Pause Quantum Register +#define AT91C_EMAC_MAN (0xFFFDC034) // (EMAC) PHY Maintenance Register +#define AT91C_EMAC_FTO (0xFFFDC040) // (EMAC) Frames Transmitted OK Register +#define AT91C_EMAC_REV (0xFFFDC0FC) // (EMAC) Revision Register +#define AT91C_EMAC_IMR (0xFFFDC030) // (EMAC) Interrupt Mask Register +#define AT91C_EMAC_SCF (0xFFFDC044) // (EMAC) Single Collision Frame Register +#define AT91C_EMAC_PFR (0xFFFDC03C) // (EMAC) Pause Frames received Register +#define AT91C_EMAC_MCF (0xFFFDC048) // (EMAC) Multiple Collision Frame Register +#define AT91C_EMAC_NSR (0xFFFDC008) // (EMAC) Network Status Register +#define AT91C_EMAC_SA2L (0xFFFDC0A0) // (EMAC) Specific Address 2 Bottom, First 4 bytes +#define AT91C_EMAC_FRO (0xFFFDC04C) // (EMAC) Frames Received OK Register +#define AT91C_EMAC_IER (0xFFFDC028) // (EMAC) Interrupt Enable Register +#define AT91C_EMAC_SA1H (0xFFFDC09C) // (EMAC) Specific Address 1 Top, Last 2 bytes +#define AT91C_EMAC_CSE (0xFFFDC068) // (EMAC) Carrier Sense Error Register +#define AT91C_EMAC_SA3H (0xFFFDC0AC) // (EMAC) Specific Address 3 Top, Last 2 bytes +#define AT91C_EMAC_RRE (0xFFFDC06C) // (EMAC) Receive Ressource Error Register +#define AT91C_EMAC_STE (0xFFFDC084) // (EMAC) SQE Test Error Register +// ========== Register definition for PDC_ADC peripheral ========== +#define AT91C_ADC_PTSR (0xFFFD8124) // (PDC_ADC) PDC Transfer Status Register +#define AT91C_ADC_PTCR (0xFFFD8120) // (PDC_ADC) PDC Transfer Control Register +#define AT91C_ADC_TNPR (0xFFFD8118) // (PDC_ADC) Transmit Next Pointer Register +#define AT91C_ADC_TNCR (0xFFFD811C) // (PDC_ADC) Transmit Next Counter Register +#define AT91C_ADC_RNPR (0xFFFD8110) // (PDC_ADC) Receive Next Pointer Register +#define AT91C_ADC_RNCR (0xFFFD8114) // (PDC_ADC) Receive Next Counter Register +#define AT91C_ADC_RPR (0xFFFD8100) // (PDC_ADC) Receive Pointer Register +#define AT91C_ADC_TCR (0xFFFD810C) // (PDC_ADC) Transmit Counter Register +#define AT91C_ADC_TPR (0xFFFD8108) // (PDC_ADC) Transmit Pointer Register +#define AT91C_ADC_RCR (0xFFFD8104) // (PDC_ADC) Receive Counter Register +// ========== Register definition for ADC peripheral ========== +#define AT91C_ADC_CDR2 (0xFFFD8038) // (ADC) ADC Channel Data Register 2 +#define AT91C_ADC_CDR3 (0xFFFD803C) // (ADC) ADC Channel Data Register 3 +#define AT91C_ADC_CDR0 (0xFFFD8030) // (ADC) ADC Channel Data Register 0 +#define AT91C_ADC_CDR5 (0xFFFD8044) // (ADC) ADC Channel Data Register 5 +#define AT91C_ADC_CHDR (0xFFFD8014) // (ADC) ADC Channel Disable Register +#define AT91C_ADC_SR (0xFFFD801C) // (ADC) ADC Status Register +#define AT91C_ADC_CDR4 (0xFFFD8040) // (ADC) ADC Channel Data Register 4 +#define AT91C_ADC_CDR1 (0xFFFD8034) // (ADC) ADC Channel Data Register 1 +#define AT91C_ADC_LCDR (0xFFFD8020) // (ADC) ADC Last Converted Data Register +#define AT91C_ADC_IDR (0xFFFD8028) // (ADC) ADC Interrupt Disable Register +#define AT91C_ADC_CR (0xFFFD8000) // (ADC) ADC Control Register +#define AT91C_ADC_CDR7 (0xFFFD804C) // (ADC) ADC Channel Data Register 7 +#define AT91C_ADC_CDR6 (0xFFFD8048) // (ADC) ADC Channel Data Register 6 +#define AT91C_ADC_IER (0xFFFD8024) // (ADC) ADC Interrupt Enable Register +#define AT91C_ADC_CHER (0xFFFD8010) // (ADC) ADC Channel Enable Register +#define AT91C_ADC_CHSR (0xFFFD8018) // (ADC) ADC Channel Status Register +#define AT91C_ADC_MR (0xFFFD8004) // (ADC) ADC Mode Register +#define AT91C_ADC_IMR (0xFFFD802C) // (ADC) ADC Interrupt Mask Register + +// ***************************************************************************** +// PIO DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** +#define AT91C_PIO_PA0 (1 << 0) // Pin Controlled by PA0 +#define AT91C_PA0_RXD0 (AT91C_PIO_PA0) // USART 0 Receive Data +#define AT91C_PIO_PA1 (1 << 1) // Pin Controlled by PA1 +#define AT91C_PA1_TXD0 (AT91C_PIO_PA1) // USART 0 Transmit Data +#define AT91C_PIO_PA10 (1 << 10) // Pin Controlled by PA10 +#define AT91C_PA10_TWD (AT91C_PIO_PA10) // TWI Two-wire Serial Data +#define AT91C_PIO_PA11 (1 << 11) // Pin Controlled by PA11 +#define AT91C_PA11_TWCK (AT91C_PIO_PA11) // TWI Two-wire Serial Clock +#define AT91C_PIO_PA12 (1 << 12) // Pin Controlled by PA12 +#define AT91C_PA12_SPI0_NPCS0 (AT91C_PIO_PA12) // SPI 0 Peripheral Chip Select 0 +#define AT91C_PIO_PA13 (1 << 13) // Pin Controlled by PA13 +#define AT91C_PA13_SPI0_NPCS1 (AT91C_PIO_PA13) // SPI 0 Peripheral Chip Select 1 +#define AT91C_PA13_PCK1 (AT91C_PIO_PA13) // PMC Programmable Clock Output 1 +#define AT91C_PIO_PA14 (1 << 14) // Pin Controlled by PA14 +#define AT91C_PA14_SPI0_NPCS2 (AT91C_PIO_PA14) // SPI 0 Peripheral Chip Select 2 +#define AT91C_PA14_IRQ1 (AT91C_PIO_PA14) // External Interrupt 1 +#define AT91C_PIO_PA15 (1 << 15) // Pin Controlled by PA15 +#define AT91C_PA15_SPI0_NPCS3 (AT91C_PIO_PA15) // SPI 0 Peripheral Chip Select 3 +#define AT91C_PA15_TCLK2 (AT91C_PIO_PA15) // Timer Counter 2 external clock input +#define AT91C_PIO_PA16 (1 << 16) // Pin Controlled by PA16 +#define AT91C_PA16_SPI0_MISO (AT91C_PIO_PA16) // SPI 0 Master In Slave +#define AT91C_PIO_PA17 (1 << 17) // Pin Controlled by PA17 +#define AT91C_PA17_SPI0_MOSI (AT91C_PIO_PA17) // SPI 0 Master Out Slave +#define AT91C_PIO_PA18 (1 << 18) // Pin Controlled by PA18 +#define AT91C_PA18_SPI0_SPCK (AT91C_PIO_PA18) // SPI 0 Serial Clock +#define AT91C_PIO_PA19 (1 << 19) // Pin Controlled by PA19 +#define AT91C_PA19_CANRX (AT91C_PIO_PA19) // CAN Receive +#define AT91C_PIO_PA2 (1 << 2) // Pin Controlled by PA2 +#define AT91C_PA2_SCK0 (AT91C_PIO_PA2) // USART 0 Serial Clock +#define AT91C_PA2_SPI1_NPCS1 (AT91C_PIO_PA2) // SPI 1 Peripheral Chip Select 1 +#define AT91C_PIO_PA20 (1 << 20) // Pin Controlled by PA20 +#define AT91C_PA20_CANTX (AT91C_PIO_PA20) // CAN Transmit +#define AT91C_PIO_PA21 (1 << 21) // Pin Controlled by PA21 +#define AT91C_PA21_TF (AT91C_PIO_PA21) // SSC Transmit Frame Sync +#define AT91C_PA21_SPI1_NPCS0 (AT91C_PIO_PA21) // SPI 1 Peripheral Chip Select 0 +#define AT91C_PIO_PA22 (1 << 22) // Pin Controlled by PA22 +#define AT91C_PA22_TK (AT91C_PIO_PA22) // SSC Transmit Clock +#define AT91C_PA22_SPI1_SPCK (AT91C_PIO_PA22) // SPI 1 Serial Clock +#define AT91C_PIO_PA23 (1 << 23) // Pin Controlled by PA23 +#define AT91C_PA23_TD (AT91C_PIO_PA23) // SSC Transmit data +#define AT91C_PA23_SPI1_MOSI (AT91C_PIO_PA23) // SPI 1 Master Out Slave +#define AT91C_PIO_PA24 (1 << 24) // Pin Controlled by PA24 +#define AT91C_PA24_RD (AT91C_PIO_PA24) // SSC Receive Data +#define AT91C_PA24_SPI1_MISO (AT91C_PIO_PA24) // SPI 1 Master In Slave +#define AT91C_PIO_PA25 (1 << 25) // Pin Controlled by PA25 +#define AT91C_PA25_RK (AT91C_PIO_PA25) // SSC Receive Clock +#define AT91C_PA25_SPI1_NPCS1 (AT91C_PIO_PA25) // SPI 1 Peripheral Chip Select 1 +#define AT91C_PIO_PA26 (1 << 26) // Pin Controlled by PA26 +#define AT91C_PA26_RF (AT91C_PIO_PA26) // SSC Receive Frame Sync +#define AT91C_PA26_SPI1_NPCS2 (AT91C_PIO_PA26) // SPI 1 Peripheral Chip Select 2 +#define AT91C_PIO_PA27 (1 << 27) // Pin Controlled by PA27 +#define AT91C_PA27_DRXD (AT91C_PIO_PA27) // DBGU Debug Receive Data +#define AT91C_PA27_PCK3 (AT91C_PIO_PA27) // PMC Programmable Clock Output 3 +#define AT91C_PIO_PA28 (1 << 28) // Pin Controlled by PA28 +#define AT91C_PA28_DTXD (AT91C_PIO_PA28) // DBGU Debug Transmit Data +#define AT91C_PIO_PA29 (1 << 29) // Pin Controlled by PA29 +#define AT91C_PA29_FIQ (AT91C_PIO_PA29) // AIC Fast Interrupt Input +#define AT91C_PA29_SPI1_NPCS3 (AT91C_PIO_PA29) // SPI 1 Peripheral Chip Select 3 +#define AT91C_PIO_PA3 (1 << 3) // Pin Controlled by PA3 +#define AT91C_PA3_RTS0 (AT91C_PIO_PA3) // USART 0 Ready To Send +#define AT91C_PA3_SPI1_NPCS2 (AT91C_PIO_PA3) // SPI 1 Peripheral Chip Select 2 +#define AT91C_PIO_PA30 (1 << 30) // Pin Controlled by PA30 +#define AT91C_PA30_IRQ0 (AT91C_PIO_PA30) // External Interrupt 0 +#define AT91C_PA30_PCK2 (AT91C_PIO_PA30) // PMC Programmable Clock Output 2 +#define AT91C_PIO_PA4 (1 << 4) // Pin Controlled by PA4 +#define AT91C_PA4_CTS0 (AT91C_PIO_PA4) // USART 0 Clear To Send +#define AT91C_PA4_SPI1_NPCS3 (AT91C_PIO_PA4) // SPI 1 Peripheral Chip Select 3 +#define AT91C_PIO_PA5 (1 << 5) // Pin Controlled by PA5 +#define AT91C_PA5_RXD1 (AT91C_PIO_PA5) // USART 1 Receive Data +#define AT91C_PIO_PA6 (1 << 6) // Pin Controlled by PA6 +#define AT91C_PA6_TXD1 (AT91C_PIO_PA6) // USART 1 Transmit Data +#define AT91C_PIO_PA7 (1 << 7) // Pin Controlled by PA7 +#define AT91C_PA7_SCK1 (AT91C_PIO_PA7) // USART 1 Serial Clock +#define AT91C_PA7_SPI0_NPCS1 (AT91C_PIO_PA7) // SPI 0 Peripheral Chip Select 1 +#define AT91C_PIO_PA8 (1 << 8) // Pin Controlled by PA8 +#define AT91C_PA8_RTS1 (AT91C_PIO_PA8) // USART 1 Ready To Send +#define AT91C_PA8_SPI0_NPCS2 (AT91C_PIO_PA8) // SPI 0 Peripheral Chip Select 2 +#define AT91C_PIO_PA9 (1 << 9) // Pin Controlled by PA9 +#define AT91C_PA9_CTS1 (AT91C_PIO_PA9) // USART 1 Clear To Send +#define AT91C_PA9_SPI0_NPCS3 (AT91C_PIO_PA9) // SPI 0 Peripheral Chip Select 3 +#define AT91C_PIO_PB0 (1 << 0) // Pin Controlled by PB0 +#define AT91C_PB0_ETXCK_EREFCK (AT91C_PIO_PB0) // Ethernet MAC Transmit Clock/Reference Clock +#define AT91C_PB0_PCK0 (AT91C_PIO_PB0) // PMC Programmable Clock Output 0 +#define AT91C_PIO_PB1 (1 << 1) // Pin Controlled by PB1 +#define AT91C_PB1_ETXEN (AT91C_PIO_PB1) // Ethernet MAC Transmit Enable +#define AT91C_PIO_PB10 (1 << 10) // Pin Controlled by PB10 +#define AT91C_PB10_ETX2 (AT91C_PIO_PB10) // Ethernet MAC Transmit Data 2 +#define AT91C_PB10_SPI1_NPCS1 (AT91C_PIO_PB10) // SPI 1 Peripheral Chip Select 1 +#define AT91C_PIO_PB11 (1 << 11) // Pin Controlled by PB11 +#define AT91C_PB11_ETX3 (AT91C_PIO_PB11) // Ethernet MAC Transmit Data 3 +#define AT91C_PB11_SPI1_NPCS2 (AT91C_PIO_PB11) // SPI 1 Peripheral Chip Select 2 +#define AT91C_PIO_PB12 (1 << 12) // Pin Controlled by PB12 +#define AT91C_PB12_ETXER (AT91C_PIO_PB12) // Ethernet MAC Transmikt Coding Error +#define AT91C_PB12_TCLK0 (AT91C_PIO_PB12) // Timer Counter 0 external clock input +#define AT91C_PIO_PB13 (1 << 13) // Pin Controlled by PB13 +#define AT91C_PB13_ERX2 (AT91C_PIO_PB13) // Ethernet MAC Receive Data 2 +#define AT91C_PB13_SPI0_NPCS1 (AT91C_PIO_PB13) // SPI 0 Peripheral Chip Select 1 +#define AT91C_PIO_PB14 (1 << 14) // Pin Controlled by PB14 +#define AT91C_PB14_ERX3 (AT91C_PIO_PB14) // Ethernet MAC Receive Data 3 +#define AT91C_PB14_SPI0_NPCS2 (AT91C_PIO_PB14) // SPI 0 Peripheral Chip Select 2 +#define AT91C_PIO_PB15 (1 << 15) // Pin Controlled by PB15 +#define AT91C_PB15_ERXDV_ECRSDV (AT91C_PIO_PB15) // Ethernet MAC Receive Data Valid +#define AT91C_PIO_PB16 (1 << 16) // Pin Controlled by PB16 +#define AT91C_PB16_ECOL (AT91C_PIO_PB16) // Ethernet MAC Collision Detected +#define AT91C_PB16_SPI1_NPCS3 (AT91C_PIO_PB16) // SPI 1 Peripheral Chip Select 3 +#define AT91C_PIO_PB17 (1 << 17) // Pin Controlled by PB17 +#define AT91C_PB17_ERXCK (AT91C_PIO_PB17) // Ethernet MAC Receive Clock +#define AT91C_PB17_SPI0_NPCS3 (AT91C_PIO_PB17) // SPI 0 Peripheral Chip Select 3 +#define AT91C_PIO_PB18 (1 << 18) // Pin Controlled by PB18 +#define AT91C_PB18_EF100 (AT91C_PIO_PB18) // Ethernet MAC Force 100 Mbits/sec +#define AT91C_PB18_ADTRG (AT91C_PIO_PB18) // ADC External Trigger +#define AT91C_PIO_PB19 (1 << 19) // Pin Controlled by PB19 +#define AT91C_PB19_PWM0 (AT91C_PIO_PB19) // PWM Channel 0 +#define AT91C_PB19_TCLK1 (AT91C_PIO_PB19) // Timer Counter 1 external clock input +#define AT91C_PIO_PB2 (1 << 2) // Pin Controlled by PB2 +#define AT91C_PB2_ETX0 (AT91C_PIO_PB2) // Ethernet MAC Transmit Data 0 +#define AT91C_PIO_PB20 (1 << 20) // Pin Controlled by PB20 +#define AT91C_PB20_PWM1 (AT91C_PIO_PB20) // PWM Channel 1 +#define AT91C_PB20_PCK0 (AT91C_PIO_PB20) // PMC Programmable Clock Output 0 +#define AT91C_PIO_PB21 (1 << 21) // Pin Controlled by PB21 +#define AT91C_PB21_PWM2 (AT91C_PIO_PB21) // PWM Channel 2 +#define AT91C_PB21_PCK1 (AT91C_PIO_PB21) // PMC Programmable Clock Output 1 +#define AT91C_PIO_PB22 (1 << 22) // Pin Controlled by PB22 +#define AT91C_PB22_PWM3 (AT91C_PIO_PB22) // PWM Channel 3 +#define AT91C_PB22_PCK2 (AT91C_PIO_PB22) // PMC Programmable Clock Output 2 +#define AT91C_PIO_PB23 (1 << 23) // Pin Controlled by PB23 +#define AT91C_PB23_TIOA0 (AT91C_PIO_PB23) // Timer Counter 0 Multipurpose Timer I/O Pin A +#define AT91C_PB23_DCD1 (AT91C_PIO_PB23) // USART 1 Data Carrier Detect +#define AT91C_PIO_PB24 (1 << 24) // Pin Controlled by PB24 +#define AT91C_PB24_TIOB0 (AT91C_PIO_PB24) // Timer Counter 0 Multipurpose Timer I/O Pin B +#define AT91C_PB24_DSR1 (AT91C_PIO_PB24) // USART 1 Data Set ready +#define AT91C_PIO_PB25 (1 << 25) // Pin Controlled by PB25 +#define AT91C_PB25_TIOA1 (AT91C_PIO_PB25) // Timer Counter 1 Multipurpose Timer I/O Pin A +#define AT91C_PB25_DTR1 (AT91C_PIO_PB25) // USART 1 Data Terminal ready +#define AT91C_PIO_PB26 (1 << 26) // Pin Controlled by PB26 +#define AT91C_PB26_TIOB1 (AT91C_PIO_PB26) // Timer Counter 1 Multipurpose Timer I/O Pin B +#define AT91C_PB26_RI1 (AT91C_PIO_PB26) // USART 1 Ring Indicator +#define AT91C_PIO_PB27 (1 << 27) // Pin Controlled by PB27 +#define AT91C_PB27_TIOA2 (AT91C_PIO_PB27) // Timer Counter 2 Multipurpose Timer I/O Pin A +#define AT91C_PB27_PWM0 (AT91C_PIO_PB27) // PWM Channel 0 +#define AT91C_PIO_PB28 (1 << 28) // Pin Controlled by PB28 +#define AT91C_PB28_TIOB2 (AT91C_PIO_PB28) // Timer Counter 2 Multipurpose Timer I/O Pin B +#define AT91C_PB28_PWM1 (AT91C_PIO_PB28) // PWM Channel 1 +#define AT91C_PIO_PB29 (1 << 29) // Pin Controlled by PB29 +#define AT91C_PB29_PCK1 (AT91C_PIO_PB29) // PMC Programmable Clock Output 1 +#define AT91C_PB29_PWM2 (AT91C_PIO_PB29) // PWM Channel 2 +#define AT91C_PIO_PB3 (1 << 3) // Pin Controlled by PB3 +#define AT91C_PB3_ETX1 (AT91C_PIO_PB3) // Ethernet MAC Transmit Data 1 +#define AT91C_PIO_PB30 (1 << 30) // Pin Controlled by PB30 +#define AT91C_PB30_PCK2 (AT91C_PIO_PB30) // PMC Programmable Clock Output 2 +#define AT91C_PB30_PWM3 (AT91C_PIO_PB30) // PWM Channel 3 +#define AT91C_PIO_PB4 (1 << 4) // Pin Controlled by PB4 +#define AT91C_PB4_ECRS (AT91C_PIO_PB4) // Ethernet MAC Carrier Sense/Carrier Sense and Data Valid +#define AT91C_PIO_PB5 (1 << 5) // Pin Controlled by PB5 +#define AT91C_PB5_ERX0 (AT91C_PIO_PB5) // Ethernet MAC Receive Data 0 +#define AT91C_PIO_PB6 (1 << 6) // Pin Controlled by PB6 +#define AT91C_PB6_ERX1 (AT91C_PIO_PB6) // Ethernet MAC Receive Data 1 +#define AT91C_PIO_PB7 (1 << 7) // Pin Controlled by PB7 +#define AT91C_PB7_ERXER (AT91C_PIO_PB7) // Ethernet MAC Receive Error +#define AT91C_PIO_PB8 (1 << 8) // Pin Controlled by PB8 +#define AT91C_PB8_EMDC (AT91C_PIO_PB8) // Ethernet MAC Management Data Clock +#define AT91C_PIO_PB9 (1 << 9) // Pin Controlled by PB9 +#define AT91C_PB9_EMDIO (AT91C_PIO_PB9) // Ethernet MAC Management Data Input/Output + +// ***************************************************************************** +// PERIPHERAL ID DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** +#define AT91C_ID_FIQ ( 0) // Advanced Interrupt Controller (FIQ) +#define AT91C_ID_SYS ( 1) // System Peripheral +#define AT91C_ID_PIOA ( 2) // Parallel IO Controller A +#define AT91C_ID_PIOB ( 3) // Parallel IO Controller B +#define AT91C_ID_SPI0 ( 4) // Serial Peripheral Interface 0 +#define AT91C_ID_SPI1 ( 5) // Serial Peripheral Interface 1 +#define AT91C_ID_US0 ( 6) // USART 0 +#define AT91C_ID_US1 ( 7) // USART 1 +#define AT91C_ID_SSC ( 8) // Serial Synchronous Controller +#define AT91C_ID_TWI ( 9) // Two-Wire Interface +#define AT91C_ID_PWMC (10) // PWM Controller +#define AT91C_ID_UDP (11) // USB Device Port +#define AT91C_ID_TC0 (12) // Timer Counter 0 +#define AT91C_ID_TC1 (13) // Timer Counter 1 +#define AT91C_ID_TC2 (14) // Timer Counter 2 +#define AT91C_ID_CAN (15) // Control Area Network Controller +#define AT91C_ID_EMAC (16) // Ethernet MAC +#define AT91C_ID_ADC (17) // Analog-to-Digital Converter +#define AT91C_ID_18_Reserved (18) // Reserved +#define AT91C_ID_19_Reserved (19) // Reserved +#define AT91C_ID_20_Reserved (20) // Reserved +#define AT91C_ID_21_Reserved (21) // Reserved +#define AT91C_ID_22_Reserved (22) // Reserved +#define AT91C_ID_23_Reserved (23) // Reserved +#define AT91C_ID_24_Reserved (24) // Reserved +#define AT91C_ID_25_Reserved (25) // Reserved +#define AT91C_ID_26_Reserved (26) // Reserved +#define AT91C_ID_27_Reserved (27) // Reserved +#define AT91C_ID_28_Reserved (28) // Reserved +#define AT91C_ID_29_Reserved (29) // Reserved +#define AT91C_ID_IRQ0 (30) // Advanced Interrupt Controller (IRQ0) +#define AT91C_ID_IRQ1 (31) // Advanced Interrupt Controller (IRQ1) +#define AT91C_ALL_INT (0xC003FFFF) // ALL VALID INTERRUPTS + +// ***************************************************************************** +// BASE ADDRESS DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** +#define AT91C_BASE_SYS (0xFFFFF000) // (SYS) Base Address +#define AT91C_BASE_AIC (0xFFFFF000) // (AIC) Base Address +#define AT91C_BASE_PDC_DBGU (0xFFFFF300) // (PDC_DBGU) Base Address +#define AT91C_BASE_DBGU (0xFFFFF200) // (DBGU) Base Address +#define AT91C_BASE_PIOA (0xFFFFF400) // (PIOA) Base Address +#define AT91C_BASE_PIOB (0xFFFFF600) // (PIOB) Base Address +#define AT91C_BASE_CKGR (0xFFFFFC20) // (CKGR) Base Address +#define AT91C_BASE_PMC (0xFFFFFC00) // (PMC) Base Address +#define AT91C_BASE_RSTC (0xFFFFFD00) // (RSTC) Base Address +#define AT91C_BASE_RTTC (0xFFFFFD20) // (RTTC) Base Address +#define AT91C_BASE_PITC (0xFFFFFD30) // (PITC) Base Address +#define AT91C_BASE_WDTC (0xFFFFFD40) // (WDTC) Base Address +#define AT91C_BASE_VREG (0xFFFFFD60) // (VREG) Base Address +#define AT91C_BASE_MC (0xFFFFFF00) // (MC) Base Address +#define AT91C_BASE_PDC_SPI1 (0xFFFE4100) // (PDC_SPI1) Base Address +#define AT91C_BASE_SPI1 (0xFFFE4000) // (SPI1) Base Address +#define AT91C_BASE_PDC_SPI0 (0xFFFE0100) // (PDC_SPI0) Base Address +#define AT91C_BASE_SPI0 (0xFFFE0000) // (SPI0) Base Address +#define AT91C_BASE_PDC_US1 (0xFFFC4100) // (PDC_US1) Base Address +#define AT91C_BASE_US1 (0xFFFC4000) // (US1) Base Address +#define AT91C_BASE_PDC_US0 (0xFFFC0100) // (PDC_US0) Base Address +#define AT91C_BASE_US0 (0xFFFC0000) // (US0) Base Address +#define AT91C_BASE_PDC_SSC (0xFFFD4100) // (PDC_SSC) Base Address +#define AT91C_BASE_SSC (0xFFFD4000) // (SSC) Base Address +#define AT91C_BASE_TWI (0xFFFB8000) // (TWI) Base Address +#define AT91C_BASE_PWMC_CH3 (0xFFFCC260) // (PWMC_CH3) Base Address +#define AT91C_BASE_PWMC_CH2 (0xFFFCC240) // (PWMC_CH2) Base Address +#define AT91C_BASE_PWMC_CH1 (0xFFFCC220) // (PWMC_CH1) Base Address +#define AT91C_BASE_PWMC_CH0 (0xFFFCC200) // (PWMC_CH0) Base Address +#define AT91C_BASE_PWMC (0xFFFCC000) // (PWMC) Base Address +#define AT91C_BASE_UDP (0xFFFB0000) // (UDP) Base Address +#define AT91C_BASE_TC0 (0xFFFA0000) // (TC0) Base Address +#define AT91C_BASE_TC1 (0xFFFA0040) // (TC1) Base Address +#define AT91C_BASE_TC2 (0xFFFA0080) // (TC2) Base Address +#define AT91C_BASE_TCB (0xFFFA0000) // (TCB) Base Address +#define AT91C_BASE_CAN_MB0 (0xFFFD0200) // (CAN_MB0) Base Address +#define AT91C_BASE_CAN_MB1 (0xFFFD0220) // (CAN_MB1) Base Address +#define AT91C_BASE_CAN_MB2 (0xFFFD0240) // (CAN_MB2) Base Address +#define AT91C_BASE_CAN_MB3 (0xFFFD0260) // (CAN_MB3) Base Address +#define AT91C_BASE_CAN_MB4 (0xFFFD0280) // (CAN_MB4) Base Address +#define AT91C_BASE_CAN_MB5 (0xFFFD02A0) // (CAN_MB5) Base Address +#define AT91C_BASE_CAN_MB6 (0xFFFD02C0) // (CAN_MB6) Base Address +#define AT91C_BASE_CAN_MB7 (0xFFFD02E0) // (CAN_MB7) Base Address +#define AT91C_BASE_CAN (0xFFFD0000) // (CAN) Base Address +#define AT91C_BASE_EMAC (0xFFFDC000) // (EMAC) Base Address +#define AT91C_BASE_PDC_ADC (0xFFFD8100) // (PDC_ADC) Base Address +#define AT91C_BASE_ADC (0xFFFD8000) // (ADC) Base Address + +// ***************************************************************************** +// MEMORY MAPPING DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** +// ISRAM +#define AT91C_ISRAM (0x00200000) // Internal SRAM base address +#define AT91C_ISRAM_SIZE (0x00010000) // Internal SRAM size in byte (64 Kbytes) +// IFLASH +#define AT91C_IFLASH (0x00100000) // Internal FLASH base address +#define AT91C_IFLASH_SIZE (0x00040000) // Internal FLASH size in byte (256 Kbytes) +#define AT91C_IFLASH_PAGE_SIZE (256) // Internal FLASH Page Size: 256 bytes +#define AT91C_IFLASH_LOCK_REGION_SIZE (16384) // Internal FLASH Lock Region Size: 16 Kbytes +#define AT91C_IFLASH_NB_OF_PAGES (1024) // Internal FLASH Number of Pages: 1024 bytes +#define AT91C_IFLASH_NB_OF_LOCK_BITS (16) // Internal FLASH Number of Lock Bits: 16 bytes + + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/ioat91sam7x256.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/ioat91sam7x256.h new file mode 100644 index 0000000..ab71b93 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/ioat91sam7x256.h @@ -0,0 +1,4380 @@ +// - ---------------------------------------------------------------------------- +// - ATMEL Microcontroller Software Support - ROUSSET - +// - ---------------------------------------------------------------------------- +// - DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// - DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// - OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// - EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// - ---------------------------------------------------------------------------- +// - File Name : AT91SAM7X256.h +// - Object : AT91SAM7X256 definitions +// - Generated : AT91 SW Application Group 11/02/2005 (15:17:24) +// - +// - CVS Reference : /AT91SAM7X256.pl/1.14/Tue Sep 13 15:06:52 2005// +// - CVS Reference : /SYS_SAM7X.pl/1.3/Tue Feb 1 17:01:43 2005// +// - CVS Reference : /MC_SAM7X.pl/1.2/Fri May 20 14:13:04 2005// +// - CVS Reference : /PMC_SAM7X.pl/1.4/Tue Feb 8 13:58:10 2005// +// - CVS Reference : /RSTC_SAM7X.pl/1.2/Wed Jul 13 14:57:50 2005// +// - CVS Reference : /UDP_SAM7X.pl/1.1/Tue May 10 11:35:35 2005// +// - CVS Reference : /PWM_SAM7X.pl/1.1/Tue May 10 11:53:07 2005// +// - CVS Reference : /AIC_6075B.pl/1.3/Fri May 20 14:01:30 2005// +// - CVS Reference : /PIO_6057A.pl/1.2/Thu Feb 3 10:18:28 2005// +// - CVS Reference : /RTTC_6081A.pl/1.2/Tue Nov 9 14:43:58 2004// +// - CVS Reference : /PITC_6079A.pl/1.2/Tue Nov 9 14:43:56 2004// +// - CVS Reference : /WDTC_6080A.pl/1.3/Tue Nov 9 14:44:00 2004// +// - CVS Reference : /VREG_6085B.pl/1.1/Tue Feb 1 16:05:48 2005// +// - CVS Reference : /PDC_6074C.pl/1.2/Thu Feb 3 08:48:54 2005// +// - CVS Reference : /DBGU_6059D.pl/1.1/Mon Jan 31 13:15:32 2005// +// - CVS Reference : /SPI_6088D.pl/1.3/Fri May 20 14:08:59 2005// +// - CVS Reference : /US_6089C.pl/1.1/Mon Jul 12 18:23:26 2004// +// - CVS Reference : /SSC_6078B.pl/1.1/Wed Jul 13 15:19:19 2005// +// - CVS Reference : /TWI_6061A.pl/1.1/Tue Jul 13 07:38:06 2004// +// - CVS Reference : /TC_6082A.pl/1.7/Fri Mar 11 12:52:17 2005// +// - CVS Reference : /CAN_6019B.pl/1.1/Tue Mar 8 12:42:22 2005// +// - CVS Reference : /EMACB_6119A.pl/1.6/Wed Jul 13 15:05:35 2005// +// - CVS Reference : /ADC_6051C.pl/1.1/Fri Oct 17 09:12:38 2003// +// - ---------------------------------------------------------------------------- + +#ifndef AT91SAM7X256_H +#define AT91SAM7X256_H + +#ifdef __IAR_SYSTEMS_ICC__ + +typedef volatile unsigned int AT91_REG;// Hardware register definition + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR System Peripherals +// ***************************************************************************** +typedef struct _AT91S_SYS { + AT91_REG AIC_SMR[32]; // Source Mode Register + AT91_REG AIC_SVR[32]; // Source Vector Register + AT91_REG AIC_IVR; // IRQ Vector Register + AT91_REG AIC_FVR; // FIQ Vector Register + AT91_REG AIC_ISR; // Interrupt Status Register + AT91_REG AIC_IPR; // Interrupt Pending Register + AT91_REG AIC_IMR; // Interrupt Mask Register + AT91_REG AIC_CISR; // Core Interrupt Status Register + AT91_REG Reserved0[2]; // + AT91_REG AIC_IECR; // Interrupt Enable Command Register + AT91_REG AIC_IDCR; // Interrupt Disable Command Register + AT91_REG AIC_ICCR; // Interrupt Clear Command Register + AT91_REG AIC_ISCR; // Interrupt Set Command Register + AT91_REG AIC_EOICR; // End of Interrupt Command Register + AT91_REG AIC_SPU; // Spurious Vector Register + AT91_REG AIC_DCR; // Debug Control Register (Protect) + AT91_REG Reserved1[1]; // + AT91_REG AIC_FFER; // Fast Forcing Enable Register + AT91_REG AIC_FFDR; // Fast Forcing Disable Register + AT91_REG AIC_FFSR; // Fast Forcing Status Register + AT91_REG Reserved2[45]; // + AT91_REG DBGU_CR; // Control Register + AT91_REG DBGU_MR; // Mode Register + AT91_REG DBGU_IER; // Interrupt Enable Register + AT91_REG DBGU_IDR; // Interrupt Disable Register + AT91_REG DBGU_IMR; // Interrupt Mask Register + AT91_REG DBGU_CSR; // Channel Status Register + AT91_REG DBGU_RHR; // Receiver Holding Register + AT91_REG DBGU_THR; // Transmitter Holding Register + AT91_REG DBGU_BRGR; // Baud Rate Generator Register + AT91_REG Reserved3[7]; // + AT91_REG DBGU_CIDR; // Chip ID Register + AT91_REG DBGU_EXID; // Chip ID Extension Register + AT91_REG DBGU_FNTR; // Force NTRST Register + AT91_REG Reserved4[45]; // + AT91_REG DBGU_RPR; // Receive Pointer Register + AT91_REG DBGU_RCR; // Receive Counter Register + AT91_REG DBGU_TPR; // Transmit Pointer Register + AT91_REG DBGU_TCR; // Transmit Counter Register + AT91_REG DBGU_RNPR; // Receive Next Pointer Register + AT91_REG DBGU_RNCR; // Receive Next Counter Register + AT91_REG DBGU_TNPR; // Transmit Next Pointer Register + AT91_REG DBGU_TNCR; // Transmit Next Counter Register + AT91_REG DBGU_PTCR; // PDC Transfer Control Register + AT91_REG DBGU_PTSR; // PDC Transfer Status Register + AT91_REG Reserved5[54]; // + AT91_REG PIOA_PER; // PIO Enable Register + AT91_REG PIOA_PDR; // PIO Disable Register + AT91_REG PIOA_PSR; // PIO Status Register + AT91_REG Reserved6[1]; // + AT91_REG PIOA_OER; // Output Enable Register + AT91_REG PIOA_ODR; // Output Disable Registerr + AT91_REG PIOA_OSR; // Output Status Register + AT91_REG Reserved7[1]; // + AT91_REG PIOA_IFER; // Input Filter Enable Register + AT91_REG PIOA_IFDR; // Input Filter Disable Register + AT91_REG PIOA_IFSR; // Input Filter Status Register + AT91_REG Reserved8[1]; // + AT91_REG PIOA_SODR; // Set Output Data Register + AT91_REG PIOA_CODR; // Clear Output Data Register + AT91_REG PIOA_ODSR; // Output Data Status Register + AT91_REG PIOA_PDSR; // Pin Data Status Register + AT91_REG PIOA_IER; // Interrupt Enable Register + AT91_REG PIOA_IDR; // Interrupt Disable Register + AT91_REG PIOA_IMR; // Interrupt Mask Register + AT91_REG PIOA_ISR; // Interrupt Status Register + AT91_REG PIOA_MDER; // Multi-driver Enable Register + AT91_REG PIOA_MDDR; // Multi-driver Disable Register + AT91_REG PIOA_MDSR; // Multi-driver Status Register + AT91_REG Reserved9[1]; // + AT91_REG PIOA_PPUDR; // Pull-up Disable Register + AT91_REG PIOA_PPUER; // Pull-up Enable Register + AT91_REG PIOA_PPUSR; // Pull-up Status Register + AT91_REG Reserved10[1]; // + AT91_REG PIOA_ASR; // Select A Register + AT91_REG PIOA_BSR; // Select B Register + AT91_REG PIOA_ABSR; // AB Select Status Register + AT91_REG Reserved11[9]; // + AT91_REG PIOA_OWER; // Output Write Enable Register + AT91_REG PIOA_OWDR; // Output Write Disable Register + AT91_REG PIOA_OWSR; // Output Write Status Register + AT91_REG Reserved12[85]; // + AT91_REG PIOB_PER; // PIO Enable Register + AT91_REG PIOB_PDR; // PIO Disable Register + AT91_REG PIOB_PSR; // PIO Status Register + AT91_REG Reserved13[1]; // + AT91_REG PIOB_OER; // Output Enable Register + AT91_REG PIOB_ODR; // Output Disable Registerr + AT91_REG PIOB_OSR; // Output Status Register + AT91_REG Reserved14[1]; // + AT91_REG PIOB_IFER; // Input Filter Enable Register + AT91_REG PIOB_IFDR; // Input Filter Disable Register + AT91_REG PIOB_IFSR; // Input Filter Status Register + AT91_REG Reserved15[1]; // + AT91_REG PIOB_SODR; // Set Output Data Register + AT91_REG PIOB_CODR; // Clear Output Data Register + AT91_REG PIOB_ODSR; // Output Data Status Register + AT91_REG PIOB_PDSR; // Pin Data Status Register + AT91_REG PIOB_IER; // Interrupt Enable Register + AT91_REG PIOB_IDR; // Interrupt Disable Register + AT91_REG PIOB_IMR; // Interrupt Mask Register + AT91_REG PIOB_ISR; // Interrupt Status Register + AT91_REG PIOB_MDER; // Multi-driver Enable Register + AT91_REG PIOB_MDDR; // Multi-driver Disable Register + AT91_REG PIOB_MDSR; // Multi-driver Status Register + AT91_REG Reserved16[1]; // + AT91_REG PIOB_PPUDR; // Pull-up Disable Register + AT91_REG PIOB_PPUER; // Pull-up Enable Register + AT91_REG PIOB_PPUSR; // Pull-up Status Register + AT91_REG Reserved17[1]; // + AT91_REG PIOB_ASR; // Select A Register + AT91_REG PIOB_BSR; // Select B Register + AT91_REG PIOB_ABSR; // AB Select Status Register + AT91_REG Reserved18[9]; // + AT91_REG PIOB_OWER; // Output Write Enable Register + AT91_REG PIOB_OWDR; // Output Write Disable Register + AT91_REG PIOB_OWSR; // Output Write Status Register + AT91_REG Reserved19[341]; // + AT91_REG PMC_SCER; // System Clock Enable Register + AT91_REG PMC_SCDR; // System Clock Disable Register + AT91_REG PMC_SCSR; // System Clock Status Register + AT91_REG Reserved20[1]; // + AT91_REG PMC_PCER; // Peripheral Clock Enable Register + AT91_REG PMC_PCDR; // Peripheral Clock Disable Register + AT91_REG PMC_PCSR; // Peripheral Clock Status Register + AT91_REG Reserved21[1]; // + AT91_REG PMC_MOR; // Main Oscillator Register + AT91_REG PMC_MCFR; // Main Clock Frequency Register + AT91_REG Reserved22[1]; // + AT91_REG PMC_PLLR; // PLL Register + AT91_REG PMC_MCKR; // Master Clock Register + AT91_REG Reserved23[3]; // + AT91_REG PMC_PCKR[4]; // Programmable Clock Register + AT91_REG Reserved24[4]; // + AT91_REG PMC_IER; // Interrupt Enable Register + AT91_REG PMC_IDR; // Interrupt Disable Register + AT91_REG PMC_SR; // Status Register + AT91_REG PMC_IMR; // Interrupt Mask Register + AT91_REG Reserved25[36]; // + AT91_REG RSTC_RCR; // Reset Control Register + AT91_REG RSTC_RSR; // Reset Status Register + AT91_REG RSTC_RMR; // Reset Mode Register + AT91_REG Reserved26[5]; // + AT91_REG RTTC_RTMR; // Real-time Mode Register + AT91_REG RTTC_RTAR; // Real-time Alarm Register + AT91_REG RTTC_RTVR; // Real-time Value Register + AT91_REG RTTC_RTSR; // Real-time Status Register + AT91_REG PITC_PIMR; // Period Interval Mode Register + AT91_REG PITC_PISR; // Period Interval Status Register + AT91_REG PITC_PIVR; // Period Interval Value Register + AT91_REG PITC_PIIR; // Period Interval Image Register + AT91_REG WDTC_WDCR; // Watchdog Control Register + AT91_REG WDTC_WDMR; // Watchdog Mode Register + AT91_REG WDTC_WDSR; // Watchdog Status Register + AT91_REG Reserved27[5]; // + AT91_REG VREG_MR; // Voltage Regulator Mode Register +} AT91S_SYS, *AT91PS_SYS; + + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Advanced Interrupt Controller +// ***************************************************************************** +typedef struct _AT91S_AIC { + AT91_REG AIC_SMR[32]; // Source Mode Register + AT91_REG AIC_SVR[32]; // Source Vector Register + AT91_REG AIC_IVR; // IRQ Vector Register + AT91_REG AIC_FVR; // FIQ Vector Register + AT91_REG AIC_ISR; // Interrupt Status Register + AT91_REG AIC_IPR; // Interrupt Pending Register + AT91_REG AIC_IMR; // Interrupt Mask Register + AT91_REG AIC_CISR; // Core Interrupt Status Register + AT91_REG Reserved0[2]; // + AT91_REG AIC_IECR; // Interrupt Enable Command Register + AT91_REG AIC_IDCR; // Interrupt Disable Command Register + AT91_REG AIC_ICCR; // Interrupt Clear Command Register + AT91_REG AIC_ISCR; // Interrupt Set Command Register + AT91_REG AIC_EOICR; // End of Interrupt Command Register + AT91_REG AIC_SPU; // Spurious Vector Register + AT91_REG AIC_DCR; // Debug Control Register (Protect) + AT91_REG Reserved1[1]; // + AT91_REG AIC_FFER; // Fast Forcing Enable Register + AT91_REG AIC_FFDR; // Fast Forcing Disable Register + AT91_REG AIC_FFSR; // Fast Forcing Status Register +} AT91S_AIC, *AT91PS_AIC; + +// -------- AIC_SMR : (AIC Offset: 0x0) Control Register -------- +#define AT91C_AIC_PRIOR ((unsigned int) 0x7 << 0) // (AIC) Priority Level +#define AT91C_AIC_PRIOR_LOWEST ((unsigned int) 0x0) // (AIC) Lowest priority level +#define AT91C_AIC_PRIOR_HIGHEST ((unsigned int) 0x7) // (AIC) Highest priority level +#define AT91C_AIC_SRCTYPE ((unsigned int) 0x3 << 5) // (AIC) Interrupt Source Type +#define AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL ((unsigned int) 0x0 << 5) // (AIC) Internal Sources Code Label High-level Sensitive +#define AT91C_AIC_SRCTYPE_EXT_LOW_LEVEL ((unsigned int) 0x0 << 5) // (AIC) External Sources Code Label Low-level Sensitive +#define AT91C_AIC_SRCTYPE_INT_POSITIVE_EDGE ((unsigned int) 0x1 << 5) // (AIC) Internal Sources Code Label Positive Edge triggered +#define AT91C_AIC_SRCTYPE_EXT_NEGATIVE_EDGE ((unsigned int) 0x1 << 5) // (AIC) External Sources Code Label Negative Edge triggered +#define AT91C_AIC_SRCTYPE_HIGH_LEVEL ((unsigned int) 0x2 << 5) // (AIC) Internal Or External Sources Code Label High-level Sensitive +#define AT91C_AIC_SRCTYPE_POSITIVE_EDGE ((unsigned int) 0x3 << 5) // (AIC) Internal Or External Sources Code Label Positive Edge triggered +// -------- AIC_CISR : (AIC Offset: 0x114) AIC Core Interrupt Status Register -------- +#define AT91C_AIC_NFIQ ((unsigned int) 0x1 << 0) // (AIC) NFIQ Status +#define AT91C_AIC_NIRQ ((unsigned int) 0x1 << 1) // (AIC) NIRQ Status +// -------- AIC_DCR : (AIC Offset: 0x138) AIC Debug Control Register (Protect) -------- +#define AT91C_AIC_DCR_PROT ((unsigned int) 0x1 << 0) // (AIC) Protection Mode +#define AT91C_AIC_DCR_GMSK ((unsigned int) 0x1 << 1) // (AIC) General Mask + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Peripheral DMA Controller +// ***************************************************************************** +typedef struct _AT91S_PDC { + AT91_REG PDC_RPR; // Receive Pointer Register + AT91_REG PDC_RCR; // Receive Counter Register + AT91_REG PDC_TPR; // Transmit Pointer Register + AT91_REG PDC_TCR; // Transmit Counter Register + AT91_REG PDC_RNPR; // Receive Next Pointer Register + AT91_REG PDC_RNCR; // Receive Next Counter Register + AT91_REG PDC_TNPR; // Transmit Next Pointer Register + AT91_REG PDC_TNCR; // Transmit Next Counter Register + AT91_REG PDC_PTCR; // PDC Transfer Control Register + AT91_REG PDC_PTSR; // PDC Transfer Status Register +} AT91S_PDC, *AT91PS_PDC; + +// -------- PDC_PTCR : (PDC Offset: 0x20) PDC Transfer Control Register -------- +#define AT91C_PDC_RXTEN ((unsigned int) 0x1 << 0) // (PDC) Receiver Transfer Enable +#define AT91C_PDC_RXTDIS ((unsigned int) 0x1 << 1) // (PDC) Receiver Transfer Disable +#define AT91C_PDC_TXTEN ((unsigned int) 0x1 << 8) // (PDC) Transmitter Transfer Enable +#define AT91C_PDC_TXTDIS ((unsigned int) 0x1 << 9) // (PDC) Transmitter Transfer Disable +// -------- PDC_PTSR : (PDC Offset: 0x24) PDC Transfer Status Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Debug Unit +// ***************************************************************************** +typedef struct _AT91S_DBGU { + AT91_REG DBGU_CR; // Control Register + AT91_REG DBGU_MR; // Mode Register + AT91_REG DBGU_IER; // Interrupt Enable Register + AT91_REG DBGU_IDR; // Interrupt Disable Register + AT91_REG DBGU_IMR; // Interrupt Mask Register + AT91_REG DBGU_CSR; // Channel Status Register + AT91_REG DBGU_RHR; // Receiver Holding Register + AT91_REG DBGU_THR; // Transmitter Holding Register + AT91_REG DBGU_BRGR; // Baud Rate Generator Register + AT91_REG Reserved0[7]; // + AT91_REG DBGU_CIDR; // Chip ID Register + AT91_REG DBGU_EXID; // Chip ID Extension Register + AT91_REG DBGU_FNTR; // Force NTRST Register + AT91_REG Reserved1[45]; // + AT91_REG DBGU_RPR; // Receive Pointer Register + AT91_REG DBGU_RCR; // Receive Counter Register + AT91_REG DBGU_TPR; // Transmit Pointer Register + AT91_REG DBGU_TCR; // Transmit Counter Register + AT91_REG DBGU_RNPR; // Receive Next Pointer Register + AT91_REG DBGU_RNCR; // Receive Next Counter Register + AT91_REG DBGU_TNPR; // Transmit Next Pointer Register + AT91_REG DBGU_TNCR; // Transmit Next Counter Register + AT91_REG DBGU_PTCR; // PDC Transfer Control Register + AT91_REG DBGU_PTSR; // PDC Transfer Status Register +} AT91S_DBGU, *AT91PS_DBGU; + +// -------- DBGU_CR : (DBGU Offset: 0x0) Debug Unit Control Register -------- +#define AT91C_US_RSTRX ((unsigned int) 0x1 << 2) // (DBGU) Reset Receiver +#define AT91C_US_RSTTX ((unsigned int) 0x1 << 3) // (DBGU) Reset Transmitter +#define AT91C_US_RXEN ((unsigned int) 0x1 << 4) // (DBGU) Receiver Enable +#define AT91C_US_RXDIS ((unsigned int) 0x1 << 5) // (DBGU) Receiver Disable +#define AT91C_US_TXEN ((unsigned int) 0x1 << 6) // (DBGU) Transmitter Enable +#define AT91C_US_TXDIS ((unsigned int) 0x1 << 7) // (DBGU) Transmitter Disable +#define AT91C_US_RSTSTA ((unsigned int) 0x1 << 8) // (DBGU) Reset Status Bits +// -------- DBGU_MR : (DBGU Offset: 0x4) Debug Unit Mode Register -------- +#define AT91C_US_PAR ((unsigned int) 0x7 << 9) // (DBGU) Parity type +#define AT91C_US_PAR_EVEN ((unsigned int) 0x0 << 9) // (DBGU) Even Parity +#define AT91C_US_PAR_ODD ((unsigned int) 0x1 << 9) // (DBGU) Odd Parity +#define AT91C_US_PAR_SPACE ((unsigned int) 0x2 << 9) // (DBGU) Parity forced to 0 (Space) +#define AT91C_US_PAR_MARK ((unsigned int) 0x3 << 9) // (DBGU) Parity forced to 1 (Mark) +#define AT91C_US_PAR_NONE ((unsigned int) 0x4 << 9) // (DBGU) No Parity +#define AT91C_US_PAR_MULTI_DROP ((unsigned int) 0x6 << 9) // (DBGU) Multi-drop mode +#define AT91C_US_CHMODE ((unsigned int) 0x3 << 14) // (DBGU) Channel Mode +#define AT91C_US_CHMODE_NORMAL ((unsigned int) 0x0 << 14) // (DBGU) Normal Mode: The USART channel operates as an RX/TX USART. +#define AT91C_US_CHMODE_AUTO ((unsigned int) 0x1 << 14) // (DBGU) Automatic Echo: Receiver Data Input is connected to the TXD pin. +#define AT91C_US_CHMODE_LOCAL ((unsigned int) 0x2 << 14) // (DBGU) Local Loopback: Transmitter Output Signal is connected to Receiver Input Signal. +#define AT91C_US_CHMODE_REMOTE ((unsigned int) 0x3 << 14) // (DBGU) Remote Loopback: RXD pin is internally connected to TXD pin. +// -------- DBGU_IER : (DBGU Offset: 0x8) Debug Unit Interrupt Enable Register -------- +#define AT91C_US_RXRDY ((unsigned int) 0x1 << 0) // (DBGU) RXRDY Interrupt +#define AT91C_US_TXRDY ((unsigned int) 0x1 << 1) // (DBGU) TXRDY Interrupt +#define AT91C_US_ENDRX ((unsigned int) 0x1 << 3) // (DBGU) End of Receive Transfer Interrupt +#define AT91C_US_ENDTX ((unsigned int) 0x1 << 4) // (DBGU) End of Transmit Interrupt +#define AT91C_US_OVRE ((unsigned int) 0x1 << 5) // (DBGU) Overrun Interrupt +#define AT91C_US_FRAME ((unsigned int) 0x1 << 6) // (DBGU) Framing Error Interrupt +#define AT91C_US_PARE ((unsigned int) 0x1 << 7) // (DBGU) Parity Error Interrupt +#define AT91C_US_TXEMPTY ((unsigned int) 0x1 << 9) // (DBGU) TXEMPTY Interrupt +#define AT91C_US_TXBUFE ((unsigned int) 0x1 << 11) // (DBGU) TXBUFE Interrupt +#define AT91C_US_RXBUFF ((unsigned int) 0x1 << 12) // (DBGU) RXBUFF Interrupt +#define AT91C_US_COMM_TX ((unsigned int) 0x1 << 30) // (DBGU) COMM_TX Interrupt +#define AT91C_US_COMM_RX ((unsigned int) 0x1 << 31) // (DBGU) COMM_RX Interrupt +// -------- DBGU_IDR : (DBGU Offset: 0xc) Debug Unit Interrupt Disable Register -------- +// -------- DBGU_IMR : (DBGU Offset: 0x10) Debug Unit Interrupt Mask Register -------- +// -------- DBGU_CSR : (DBGU Offset: 0x14) Debug Unit Channel Status Register -------- +// -------- DBGU_FNTR : (DBGU Offset: 0x48) Debug Unit FORCE_NTRST Register -------- +#define AT91C_US_FORCE_NTRST ((unsigned int) 0x1 << 0) // (DBGU) Force NTRST in JTAG + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Parallel Input Output Controler +// ***************************************************************************** +typedef struct _AT91S_PIO { + AT91_REG PIO_PER; // PIO Enable Register + AT91_REG PIO_PDR; // PIO Disable Register + AT91_REG PIO_PSR; // PIO Status Register + AT91_REG Reserved0[1]; // + AT91_REG PIO_OER; // Output Enable Register + AT91_REG PIO_ODR; // Output Disable Registerr + AT91_REG PIO_OSR; // Output Status Register + AT91_REG Reserved1[1]; // + AT91_REG PIO_IFER; // Input Filter Enable Register + AT91_REG PIO_IFDR; // Input Filter Disable Register + AT91_REG PIO_IFSR; // Input Filter Status Register + AT91_REG Reserved2[1]; // + AT91_REG PIO_SODR; // Set Output Data Register + AT91_REG PIO_CODR; // Clear Output Data Register + AT91_REG PIO_ODSR; // Output Data Status Register + AT91_REG PIO_PDSR; // Pin Data Status Register + AT91_REG PIO_IER; // Interrupt Enable Register + AT91_REG PIO_IDR; // Interrupt Disable Register + AT91_REG PIO_IMR; // Interrupt Mask Register + AT91_REG PIO_ISR; // Interrupt Status Register + AT91_REG PIO_MDER; // Multi-driver Enable Register + AT91_REG PIO_MDDR; // Multi-driver Disable Register + AT91_REG PIO_MDSR; // Multi-driver Status Register + AT91_REG Reserved3[1]; // + AT91_REG PIO_PPUDR; // Pull-up Disable Register + AT91_REG PIO_PPUER; // Pull-up Enable Register + AT91_REG PIO_PPUSR; // Pull-up Status Register + AT91_REG Reserved4[1]; // + AT91_REG PIO_ASR; // Select A Register + AT91_REG PIO_BSR; // Select B Register + AT91_REG PIO_ABSR; // AB Select Status Register + AT91_REG Reserved5[9]; // + AT91_REG PIO_OWER; // Output Write Enable Register + AT91_REG PIO_OWDR; // Output Write Disable Register + AT91_REG PIO_OWSR; // Output Write Status Register +} AT91S_PIO, *AT91PS_PIO; + + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Clock Generator Controler +// ***************************************************************************** +typedef struct _AT91S_CKGR { + AT91_REG CKGR_MOR; // Main Oscillator Register + AT91_REG CKGR_MCFR; // Main Clock Frequency Register + AT91_REG Reserved0[1]; // + AT91_REG CKGR_PLLR; // PLL Register +} AT91S_CKGR, *AT91PS_CKGR; + +// -------- CKGR_MOR : (CKGR Offset: 0x0) Main Oscillator Register -------- +#define AT91C_CKGR_MOSCEN ((unsigned int) 0x1 << 0) // (CKGR) Main Oscillator Enable +#define AT91C_CKGR_OSCBYPASS ((unsigned int) 0x1 << 1) // (CKGR) Main Oscillator Bypass +#define AT91C_CKGR_OSCOUNT ((unsigned int) 0xFF << 8) // (CKGR) Main Oscillator Start-up Time +// -------- CKGR_MCFR : (CKGR Offset: 0x4) Main Clock Frequency Register -------- +#define AT91C_CKGR_MAINF ((unsigned int) 0xFFFF << 0) // (CKGR) Main Clock Frequency +#define AT91C_CKGR_MAINRDY ((unsigned int) 0x1 << 16) // (CKGR) Main Clock Ready +// -------- CKGR_PLLR : (CKGR Offset: 0xc) PLL B Register -------- +#define AT91C_CKGR_DIV ((unsigned int) 0xFF << 0) // (CKGR) Divider Selected +#define AT91C_CKGR_DIV_0 ((unsigned int) 0x0) // (CKGR) Divider output is 0 +#define AT91C_CKGR_DIV_BYPASS ((unsigned int) 0x1) // (CKGR) Divider is bypassed +#define AT91C_CKGR_PLLCOUNT ((unsigned int) 0x3F << 8) // (CKGR) PLL Counter +#define AT91C_CKGR_OUT ((unsigned int) 0x3 << 14) // (CKGR) PLL Output Frequency Range +#define AT91C_CKGR_OUT_0 ((unsigned int) 0x0 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_OUT_1 ((unsigned int) 0x1 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_OUT_2 ((unsigned int) 0x2 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_OUT_3 ((unsigned int) 0x3 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_MUL ((unsigned int) 0x7FF << 16) // (CKGR) PLL Multiplier +#define AT91C_CKGR_USBDIV ((unsigned int) 0x3 << 28) // (CKGR) Divider for USB Clocks +#define AT91C_CKGR_USBDIV_0 ((unsigned int) 0x0 << 28) // (CKGR) Divider output is PLL clock output +#define AT91C_CKGR_USBDIV_1 ((unsigned int) 0x1 << 28) // (CKGR) Divider output is PLL clock output divided by 2 +#define AT91C_CKGR_USBDIV_2 ((unsigned int) 0x2 << 28) // (CKGR) Divider output is PLL clock output divided by 4 + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Power Management Controler +// ***************************************************************************** +typedef struct _AT91S_PMC { + AT91_REG PMC_SCER; // System Clock Enable Register + AT91_REG PMC_SCDR; // System Clock Disable Register + AT91_REG PMC_SCSR; // System Clock Status Register + AT91_REG Reserved0[1]; // + AT91_REG PMC_PCER; // Peripheral Clock Enable Register + AT91_REG PMC_PCDR; // Peripheral Clock Disable Register + AT91_REG PMC_PCSR; // Peripheral Clock Status Register + AT91_REG Reserved1[1]; // + AT91_REG PMC_MOR; // Main Oscillator Register + AT91_REG PMC_MCFR; // Main Clock Frequency Register + AT91_REG Reserved2[1]; // + AT91_REG PMC_PLLR; // PLL Register + AT91_REG PMC_MCKR; // Master Clock Register + AT91_REG Reserved3[3]; // + AT91_REG PMC_PCKR[4]; // Programmable Clock Register + AT91_REG Reserved4[4]; // + AT91_REG PMC_IER; // Interrupt Enable Register + AT91_REG PMC_IDR; // Interrupt Disable Register + AT91_REG PMC_SR; // Status Register + AT91_REG PMC_IMR; // Interrupt Mask Register +} AT91S_PMC, *AT91PS_PMC; + +// -------- PMC_SCER : (PMC Offset: 0x0) System Clock Enable Register -------- +#define AT91C_PMC_PCK ((unsigned int) 0x1 << 0) // (PMC) Processor Clock +#define AT91C_PMC_UDP ((unsigned int) 0x1 << 7) // (PMC) USB Device Port Clock +#define AT91C_PMC_PCK0 ((unsigned int) 0x1 << 8) // (PMC) Programmable Clock Output +#define AT91C_PMC_PCK1 ((unsigned int) 0x1 << 9) // (PMC) Programmable Clock Output +#define AT91C_PMC_PCK2 ((unsigned int) 0x1 << 10) // (PMC) Programmable Clock Output +#define AT91C_PMC_PCK3 ((unsigned int) 0x1 << 11) // (PMC) Programmable Clock Output +// -------- PMC_SCDR : (PMC Offset: 0x4) System Clock Disable Register -------- +// -------- PMC_SCSR : (PMC Offset: 0x8) System Clock Status Register -------- +// -------- CKGR_MOR : (PMC Offset: 0x20) Main Oscillator Register -------- +// -------- CKGR_MCFR : (PMC Offset: 0x24) Main Clock Frequency Register -------- +// -------- CKGR_PLLR : (PMC Offset: 0x2c) PLL B Register -------- +// -------- PMC_MCKR : (PMC Offset: 0x30) Master Clock Register -------- +#define AT91C_PMC_CSS ((unsigned int) 0x3 << 0) // (PMC) Programmable Clock Selection +#define AT91C_PMC_CSS_SLOW_CLK ((unsigned int) 0x0) // (PMC) Slow Clock is selected +#define AT91C_PMC_CSS_MAIN_CLK ((unsigned int) 0x1) // (PMC) Main Clock is selected +#define AT91C_PMC_CSS_PLL_CLK ((unsigned int) 0x3) // (PMC) Clock from PLL is selected +#define AT91C_PMC_PRES ((unsigned int) 0x7 << 2) // (PMC) Programmable Clock Prescaler +#define AT91C_PMC_PRES_CLK ((unsigned int) 0x0 << 2) // (PMC) Selected clock +#define AT91C_PMC_PRES_CLK_2 ((unsigned int) 0x1 << 2) // (PMC) Selected clock divided by 2 +#define AT91C_PMC_PRES_CLK_4 ((unsigned int) 0x2 << 2) // (PMC) Selected clock divided by 4 +#define AT91C_PMC_PRES_CLK_8 ((unsigned int) 0x3 << 2) // (PMC) Selected clock divided by 8 +#define AT91C_PMC_PRES_CLK_16 ((unsigned int) 0x4 << 2) // (PMC) Selected clock divided by 16 +#define AT91C_PMC_PRES_CLK_32 ((unsigned int) 0x5 << 2) // (PMC) Selected clock divided by 32 +#define AT91C_PMC_PRES_CLK_64 ((unsigned int) 0x6 << 2) // (PMC) Selected clock divided by 64 +// -------- PMC_PCKR : (PMC Offset: 0x40) Programmable Clock Register -------- +// -------- PMC_IER : (PMC Offset: 0x60) PMC Interrupt Enable Register -------- +#define AT91C_PMC_MOSCS ((unsigned int) 0x1 << 0) // (PMC) MOSC Status/Enable/Disable/Mask +#define AT91C_PMC_LOCK ((unsigned int) 0x1 << 2) // (PMC) PLL Status/Enable/Disable/Mask +#define AT91C_PMC_MCKRDY ((unsigned int) 0x1 << 3) // (PMC) MCK_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK0RDY ((unsigned int) 0x1 << 8) // (PMC) PCK0_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK1RDY ((unsigned int) 0x1 << 9) // (PMC) PCK1_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK2RDY ((unsigned int) 0x1 << 10) // (PMC) PCK2_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK3RDY ((unsigned int) 0x1 << 11) // (PMC) PCK3_RDY Status/Enable/Disable/Mask +// -------- PMC_IDR : (PMC Offset: 0x64) PMC Interrupt Disable Register -------- +// -------- PMC_SR : (PMC Offset: 0x68) PMC Status Register -------- +// -------- PMC_IMR : (PMC Offset: 0x6c) PMC Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Reset Controller Interface +// ***************************************************************************** +typedef struct _AT91S_RSTC { + AT91_REG RSTC_RCR; // Reset Control Register + AT91_REG RSTC_RSR; // Reset Status Register + AT91_REG RSTC_RMR; // Reset Mode Register +} AT91S_RSTC, *AT91PS_RSTC; + +// -------- RSTC_RCR : (RSTC Offset: 0x0) Reset Control Register -------- +#define AT91C_RSTC_PROCRST ((unsigned int) 0x1 << 0) // (RSTC) Processor Reset +#define AT91C_RSTC_PERRST ((unsigned int) 0x1 << 2) // (RSTC) Peripheral Reset +#define AT91C_RSTC_EXTRST ((unsigned int) 0x1 << 3) // (RSTC) External Reset +#define AT91C_RSTC_KEY ((unsigned int) 0xFF << 24) // (RSTC) Password +// -------- RSTC_RSR : (RSTC Offset: 0x4) Reset Status Register -------- +#define AT91C_RSTC_URSTS ((unsigned int) 0x1 << 0) // (RSTC) User Reset Status +#define AT91C_RSTC_BODSTS ((unsigned int) 0x1 << 1) // (RSTC) Brownout Detection Status +#define AT91C_RSTC_RSTTYP ((unsigned int) 0x7 << 8) // (RSTC) Reset Type +#define AT91C_RSTC_RSTTYP_POWERUP ((unsigned int) 0x0 << 8) // (RSTC) Power-up Reset. VDDCORE rising. +#define AT91C_RSTC_RSTTYP_WAKEUP ((unsigned int) 0x1 << 8) // (RSTC) WakeUp Reset. VDDCORE rising. +#define AT91C_RSTC_RSTTYP_WATCHDOG ((unsigned int) 0x2 << 8) // (RSTC) Watchdog Reset. Watchdog overflow occured. +#define AT91C_RSTC_RSTTYP_SOFTWARE ((unsigned int) 0x3 << 8) // (RSTC) Software Reset. Processor reset required by the software. +#define AT91C_RSTC_RSTTYP_USER ((unsigned int) 0x4 << 8) // (RSTC) User Reset. NRST pin detected low. +#define AT91C_RSTC_RSTTYP_BROWNOUT ((unsigned int) 0x5 << 8) // (RSTC) Brownout Reset occured. +#define AT91C_RSTC_NRSTL ((unsigned int) 0x1 << 16) // (RSTC) NRST pin level +#define AT91C_RSTC_SRCMP ((unsigned int) 0x1 << 17) // (RSTC) Software Reset Command in Progress. +// -------- RSTC_RMR : (RSTC Offset: 0x8) Reset Mode Register -------- +#define AT91C_RSTC_URSTEN ((unsigned int) 0x1 << 0) // (RSTC) User Reset Enable +#define AT91C_RSTC_URSTIEN ((unsigned int) 0x1 << 4) // (RSTC) User Reset Interrupt Enable +#define AT91C_RSTC_ERSTL ((unsigned int) 0xF << 8) // (RSTC) User Reset Length +#define AT91C_RSTC_BODIEN ((unsigned int) 0x1 << 16) // (RSTC) Brownout Detection Interrupt Enable + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Real Time Timer Controller Interface +// ***************************************************************************** +typedef struct _AT91S_RTTC { + AT91_REG RTTC_RTMR; // Real-time Mode Register + AT91_REG RTTC_RTAR; // Real-time Alarm Register + AT91_REG RTTC_RTVR; // Real-time Value Register + AT91_REG RTTC_RTSR; // Real-time Status Register +} AT91S_RTTC, *AT91PS_RTTC; + +// -------- RTTC_RTMR : (RTTC Offset: 0x0) Real-time Mode Register -------- +#define AT91C_RTTC_RTPRES ((unsigned int) 0xFFFF << 0) // (RTTC) Real-time Timer Prescaler Value +#define AT91C_RTTC_ALMIEN ((unsigned int) 0x1 << 16) // (RTTC) Alarm Interrupt Enable +#define AT91C_RTTC_RTTINCIEN ((unsigned int) 0x1 << 17) // (RTTC) Real Time Timer Increment Interrupt Enable +#define AT91C_RTTC_RTTRST ((unsigned int) 0x1 << 18) // (RTTC) Real Time Timer Restart +// -------- RTTC_RTAR : (RTTC Offset: 0x4) Real-time Alarm Register -------- +#define AT91C_RTTC_ALMV ((unsigned int) 0x0 << 0) // (RTTC) Alarm Value +// -------- RTTC_RTVR : (RTTC Offset: 0x8) Current Real-time Value Register -------- +#define AT91C_RTTC_CRTV ((unsigned int) 0x0 << 0) // (RTTC) Current Real-time Value +// -------- RTTC_RTSR : (RTTC Offset: 0xc) Real-time Status Register -------- +#define AT91C_RTTC_ALMS ((unsigned int) 0x1 << 0) // (RTTC) Real-time Alarm Status +#define AT91C_RTTC_RTTINC ((unsigned int) 0x1 << 1) // (RTTC) Real-time Timer Increment + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Periodic Interval Timer Controller Interface +// ***************************************************************************** +typedef struct _AT91S_PITC { + AT91_REG PITC_PIMR; // Period Interval Mode Register + AT91_REG PITC_PISR; // Period Interval Status Register + AT91_REG PITC_PIVR; // Period Interval Value Register + AT91_REG PITC_PIIR; // Period Interval Image Register +} AT91S_PITC, *AT91PS_PITC; + +// -------- PITC_PIMR : (PITC Offset: 0x0) Periodic Interval Mode Register -------- +#define AT91C_PITC_PIV ((unsigned int) 0xFFFFF << 0) // (PITC) Periodic Interval Value +#define AT91C_PITC_PITEN ((unsigned int) 0x1 << 24) // (PITC) Periodic Interval Timer Enabled +#define AT91C_PITC_PITIEN ((unsigned int) 0x1 << 25) // (PITC) Periodic Interval Timer Interrupt Enable +// -------- PITC_PISR : (PITC Offset: 0x4) Periodic Interval Status Register -------- +#define AT91C_PITC_PITS ((unsigned int) 0x1 << 0) // (PITC) Periodic Interval Timer Status +// -------- PITC_PIVR : (PITC Offset: 0x8) Periodic Interval Value Register -------- +#define AT91C_PITC_CPIV ((unsigned int) 0xFFFFF << 0) // (PITC) Current Periodic Interval Value +#define AT91C_PITC_PICNT ((unsigned int) 0xFFF << 20) // (PITC) Periodic Interval Counter +// -------- PITC_PIIR : (PITC Offset: 0xc) Periodic Interval Image Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Watchdog Timer Controller Interface +// ***************************************************************************** +typedef struct _AT91S_WDTC { + AT91_REG WDTC_WDCR; // Watchdog Control Register + AT91_REG WDTC_WDMR; // Watchdog Mode Register + AT91_REG WDTC_WDSR; // Watchdog Status Register +} AT91S_WDTC, *AT91PS_WDTC; + +// -------- WDTC_WDCR : (WDTC Offset: 0x0) Periodic Interval Image Register -------- +#define AT91C_WDTC_WDRSTT ((unsigned int) 0x1 << 0) // (WDTC) Watchdog Restart +#define AT91C_WDTC_KEY ((unsigned int) 0xFF << 24) // (WDTC) Watchdog KEY Password +// -------- WDTC_WDMR : (WDTC Offset: 0x4) Watchdog Mode Register -------- +#define AT91C_WDTC_WDV ((unsigned int) 0xFFF << 0) // (WDTC) Watchdog Timer Restart +#define AT91C_WDTC_WDFIEN ((unsigned int) 0x1 << 12) // (WDTC) Watchdog Fault Interrupt Enable +#define AT91C_WDTC_WDRSTEN ((unsigned int) 0x1 << 13) // (WDTC) Watchdog Reset Enable +#define AT91C_WDTC_WDRPROC ((unsigned int) 0x1 << 14) // (WDTC) Watchdog Timer Restart +#define AT91C_WDTC_WDDIS ((unsigned int) 0x1 << 15) // (WDTC) Watchdog Disable +#define AT91C_WDTC_WDD ((unsigned int) 0xFFF << 16) // (WDTC) Watchdog Delta Value +#define AT91C_WDTC_WDDBGHLT ((unsigned int) 0x1 << 28) // (WDTC) Watchdog Debug Halt +#define AT91C_WDTC_WDIDLEHLT ((unsigned int) 0x1 << 29) // (WDTC) Watchdog Idle Halt +// -------- WDTC_WDSR : (WDTC Offset: 0x8) Watchdog Status Register -------- +#define AT91C_WDTC_WDUNF ((unsigned int) 0x1 << 0) // (WDTC) Watchdog Underflow +#define AT91C_WDTC_WDERR ((unsigned int) 0x1 << 1) // (WDTC) Watchdog Error + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Voltage Regulator Mode Controller Interface +// ***************************************************************************** +typedef struct _AT91S_VREG { + AT91_REG VREG_MR; // Voltage Regulator Mode Register +} AT91S_VREG, *AT91PS_VREG; + +// -------- VREG_MR : (VREG Offset: 0x0) Voltage Regulator Mode Register -------- +#define AT91C_VREG_PSTDBY ((unsigned int) 0x1 << 0) // (VREG) Voltage Regulator Power Standby Mode + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Memory Controller Interface +// ***************************************************************************** +typedef struct _AT91S_MC { + AT91_REG MC_RCR; // MC Remap Control Register + AT91_REG MC_ASR; // MC Abort Status Register + AT91_REG MC_AASR; // MC Abort Address Status Register + AT91_REG Reserved0[21]; // + AT91_REG MC_FMR; // MC Flash Mode Register + AT91_REG MC_FCR; // MC Flash Command Register + AT91_REG MC_FSR; // MC Flash Status Register +} AT91S_MC, *AT91PS_MC; + +// -------- MC_RCR : (MC Offset: 0x0) MC Remap Control Register -------- +#define AT91C_MC_RCB ((unsigned int) 0x1 << 0) // (MC) Remap Command Bit +// -------- MC_ASR : (MC Offset: 0x4) MC Abort Status Register -------- +#define AT91C_MC_UNDADD ((unsigned int) 0x1 << 0) // (MC) Undefined Addess Abort Status +#define AT91C_MC_MISADD ((unsigned int) 0x1 << 1) // (MC) Misaligned Addess Abort Status +#define AT91C_MC_ABTSZ ((unsigned int) 0x3 << 8) // (MC) Abort Size Status +#define AT91C_MC_ABTSZ_BYTE ((unsigned int) 0x0 << 8) // (MC) Byte +#define AT91C_MC_ABTSZ_HWORD ((unsigned int) 0x1 << 8) // (MC) Half-word +#define AT91C_MC_ABTSZ_WORD ((unsigned int) 0x2 << 8) // (MC) Word +#define AT91C_MC_ABTTYP ((unsigned int) 0x3 << 10) // (MC) Abort Type Status +#define AT91C_MC_ABTTYP_DATAR ((unsigned int) 0x0 << 10) // (MC) Data Read +#define AT91C_MC_ABTTYP_DATAW ((unsigned int) 0x1 << 10) // (MC) Data Write +#define AT91C_MC_ABTTYP_FETCH ((unsigned int) 0x2 << 10) // (MC) Code Fetch +#define AT91C_MC_MST0 ((unsigned int) 0x1 << 16) // (MC) Master 0 Abort Source +#define AT91C_MC_MST1 ((unsigned int) 0x1 << 17) // (MC) Master 1 Abort Source +#define AT91C_MC_SVMST0 ((unsigned int) 0x1 << 24) // (MC) Saved Master 0 Abort Source +#define AT91C_MC_SVMST1 ((unsigned int) 0x1 << 25) // (MC) Saved Master 1 Abort Source +// -------- MC_FMR : (MC Offset: 0x60) MC Flash Mode Register -------- +#define AT91C_MC_FRDY ((unsigned int) 0x1 << 0) // (MC) Flash Ready +#define AT91C_MC_LOCKE ((unsigned int) 0x1 << 2) // (MC) Lock Error +#define AT91C_MC_PROGE ((unsigned int) 0x1 << 3) // (MC) Programming Error +#define AT91C_MC_NEBP ((unsigned int) 0x1 << 7) // (MC) No Erase Before Programming +#define AT91C_MC_FWS ((unsigned int) 0x3 << 8) // (MC) Flash Wait State +#define AT91C_MC_FWS_0FWS ((unsigned int) 0x0 << 8) // (MC) 1 cycle for Read, 2 for Write operations +#define AT91C_MC_FWS_1FWS ((unsigned int) 0x1 << 8) // (MC) 2 cycles for Read, 3 for Write operations +#define AT91C_MC_FWS_2FWS ((unsigned int) 0x2 << 8) // (MC) 3 cycles for Read, 4 for Write operations +#define AT91C_MC_FWS_3FWS ((unsigned int) 0x3 << 8) // (MC) 4 cycles for Read, 4 for Write operations +#define AT91C_MC_FMCN ((unsigned int) 0xFF << 16) // (MC) Flash Microsecond Cycle Number +// -------- MC_FCR : (MC Offset: 0x64) MC Flash Command Register -------- +#define AT91C_MC_FCMD ((unsigned int) 0xF << 0) // (MC) Flash Command +#define AT91C_MC_FCMD_START_PROG ((unsigned int) 0x1) // (MC) Starts the programming of th epage specified by PAGEN. +#define AT91C_MC_FCMD_LOCK ((unsigned int) 0x2) // (MC) Starts a lock sequence of the sector defined by the bits 4 to 7 of the field PAGEN. +#define AT91C_MC_FCMD_PROG_AND_LOCK ((unsigned int) 0x3) // (MC) The lock sequence automatically happens after the programming sequence is completed. +#define AT91C_MC_FCMD_UNLOCK ((unsigned int) 0x4) // (MC) Starts an unlock sequence of the sector defined by the bits 4 to 7 of the field PAGEN. +#define AT91C_MC_FCMD_ERASE_ALL ((unsigned int) 0x8) // (MC) Starts the erase of the entire flash.If at least a page is locked, the command is cancelled. +#define AT91C_MC_FCMD_SET_GP_NVM ((unsigned int) 0xB) // (MC) Set General Purpose NVM bits. +#define AT91C_MC_FCMD_CLR_GP_NVM ((unsigned int) 0xD) // (MC) Clear General Purpose NVM bits. +#define AT91C_MC_FCMD_SET_SECURITY ((unsigned int) 0xF) // (MC) Set Security Bit. +#define AT91C_MC_PAGEN ((unsigned int) 0x3FF << 8) // (MC) Page Number +#define AT91C_MC_KEY ((unsigned int) 0xFF << 24) // (MC) Writing Protect Key +// -------- MC_FSR : (MC Offset: 0x68) MC Flash Command Register -------- +#define AT91C_MC_SECURITY ((unsigned int) 0x1 << 4) // (MC) Security Bit Status +#define AT91C_MC_GPNVM0 ((unsigned int) 0x1 << 8) // (MC) Sector 0 Lock Status +#define AT91C_MC_GPNVM1 ((unsigned int) 0x1 << 9) // (MC) Sector 1 Lock Status +#define AT91C_MC_GPNVM2 ((unsigned int) 0x1 << 10) // (MC) Sector 2 Lock Status +#define AT91C_MC_GPNVM3 ((unsigned int) 0x1 << 11) // (MC) Sector 3 Lock Status +#define AT91C_MC_GPNVM4 ((unsigned int) 0x1 << 12) // (MC) Sector 4 Lock Status +#define AT91C_MC_GPNVM5 ((unsigned int) 0x1 << 13) // (MC) Sector 5 Lock Status +#define AT91C_MC_GPNVM6 ((unsigned int) 0x1 << 14) // (MC) Sector 6 Lock Status +#define AT91C_MC_GPNVM7 ((unsigned int) 0x1 << 15) // (MC) Sector 7 Lock Status +#define AT91C_MC_LOCKS0 ((unsigned int) 0x1 << 16) // (MC) Sector 0 Lock Status +#define AT91C_MC_LOCKS1 ((unsigned int) 0x1 << 17) // (MC) Sector 1 Lock Status +#define AT91C_MC_LOCKS2 ((unsigned int) 0x1 << 18) // (MC) Sector 2 Lock Status +#define AT91C_MC_LOCKS3 ((unsigned int) 0x1 << 19) // (MC) Sector 3 Lock Status +#define AT91C_MC_LOCKS4 ((unsigned int) 0x1 << 20) // (MC) Sector 4 Lock Status +#define AT91C_MC_LOCKS5 ((unsigned int) 0x1 << 21) // (MC) Sector 5 Lock Status +#define AT91C_MC_LOCKS6 ((unsigned int) 0x1 << 22) // (MC) Sector 6 Lock Status +#define AT91C_MC_LOCKS7 ((unsigned int) 0x1 << 23) // (MC) Sector 7 Lock Status +#define AT91C_MC_LOCKS8 ((unsigned int) 0x1 << 24) // (MC) Sector 8 Lock Status +#define AT91C_MC_LOCKS9 ((unsigned int) 0x1 << 25) // (MC) Sector 9 Lock Status +#define AT91C_MC_LOCKS10 ((unsigned int) 0x1 << 26) // (MC) Sector 10 Lock Status +#define AT91C_MC_LOCKS11 ((unsigned int) 0x1 << 27) // (MC) Sector 11 Lock Status +#define AT91C_MC_LOCKS12 ((unsigned int) 0x1 << 28) // (MC) Sector 12 Lock Status +#define AT91C_MC_LOCKS13 ((unsigned int) 0x1 << 29) // (MC) Sector 13 Lock Status +#define AT91C_MC_LOCKS14 ((unsigned int) 0x1 << 30) // (MC) Sector 14 Lock Status +#define AT91C_MC_LOCKS15 ((unsigned int) 0x1 << 31) // (MC) Sector 15 Lock Status + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Serial Parallel Interface +// ***************************************************************************** +typedef struct _AT91S_SPI { + AT91_REG SPI_CR; // Control Register + AT91_REG SPI_MR; // Mode Register + AT91_REG SPI_RDR; // Receive Data Register + AT91_REG SPI_TDR; // Transmit Data Register + AT91_REG SPI_SR; // Status Register + AT91_REG SPI_IER; // Interrupt Enable Register + AT91_REG SPI_IDR; // Interrupt Disable Register + AT91_REG SPI_IMR; // Interrupt Mask Register + AT91_REG Reserved0[4]; // + AT91_REG SPI_CSR[4]; // Chip Select Register + AT91_REG Reserved1[48]; // + AT91_REG SPI_RPR; // Receive Pointer Register + AT91_REG SPI_RCR; // Receive Counter Register + AT91_REG SPI_TPR; // Transmit Pointer Register + AT91_REG SPI_TCR; // Transmit Counter Register + AT91_REG SPI_RNPR; // Receive Next Pointer Register + AT91_REG SPI_RNCR; // Receive Next Counter Register + AT91_REG SPI_TNPR; // Transmit Next Pointer Register + AT91_REG SPI_TNCR; // Transmit Next Counter Register + AT91_REG SPI_PTCR; // PDC Transfer Control Register + AT91_REG SPI_PTSR; // PDC Transfer Status Register +} AT91S_SPI, *AT91PS_SPI; + +// -------- SPI_CR : (SPI Offset: 0x0) SPI Control Register -------- +#define AT91C_SPI_SPIEN ((unsigned int) 0x1 << 0) // (SPI) SPI Enable +#define AT91C_SPI_SPIDIS ((unsigned int) 0x1 << 1) // (SPI) SPI Disable +#define AT91C_SPI_SWRST ((unsigned int) 0x1 << 7) // (SPI) SPI Software reset +#define AT91C_SPI_LASTXFER ((unsigned int) 0x1 << 24) // (SPI) SPI Last Transfer +// -------- SPI_MR : (SPI Offset: 0x4) SPI Mode Register -------- +#define AT91C_SPI_MSTR ((unsigned int) 0x1 << 0) // (SPI) Master/Slave Mode +#define AT91C_SPI_PS ((unsigned int) 0x1 << 1) // (SPI) Peripheral Select +#define AT91C_SPI_PS_FIXED ((unsigned int) 0x0 << 1) // (SPI) Fixed Peripheral Select +#define AT91C_SPI_PS_VARIABLE ((unsigned int) 0x1 << 1) // (SPI) Variable Peripheral Select +#define AT91C_SPI_PCSDEC ((unsigned int) 0x1 << 2) // (SPI) Chip Select Decode +#define AT91C_SPI_FDIV ((unsigned int) 0x1 << 3) // (SPI) Clock Selection +#define AT91C_SPI_MODFDIS ((unsigned int) 0x1 << 4) // (SPI) Mode Fault Detection +#define AT91C_SPI_LLB ((unsigned int) 0x1 << 7) // (SPI) Clock Selection +#define AT91C_SPI_PCS ((unsigned int) 0xF << 16) // (SPI) Peripheral Chip Select +#define AT91C_SPI_DLYBCS ((unsigned int) 0xFF << 24) // (SPI) Delay Between Chip Selects +// -------- SPI_RDR : (SPI Offset: 0x8) Receive Data Register -------- +#define AT91C_SPI_RD ((unsigned int) 0xFFFF << 0) // (SPI) Receive Data +#define AT91C_SPI_RPCS ((unsigned int) 0xF << 16) // (SPI) Peripheral Chip Select Status +// -------- SPI_TDR : (SPI Offset: 0xc) Transmit Data Register -------- +#define AT91C_SPI_TD ((unsigned int) 0xFFFF << 0) // (SPI) Transmit Data +#define AT91C_SPI_TPCS ((unsigned int) 0xF << 16) // (SPI) Peripheral Chip Select Status +// -------- SPI_SR : (SPI Offset: 0x10) Status Register -------- +#define AT91C_SPI_RDRF ((unsigned int) 0x1 << 0) // (SPI) Receive Data Register Full +#define AT91C_SPI_TDRE ((unsigned int) 0x1 << 1) // (SPI) Transmit Data Register Empty +#define AT91C_SPI_MODF ((unsigned int) 0x1 << 2) // (SPI) Mode Fault Error +#define AT91C_SPI_OVRES ((unsigned int) 0x1 << 3) // (SPI) Overrun Error Status +#define AT91C_SPI_ENDRX ((unsigned int) 0x1 << 4) // (SPI) End of Receiver Transfer +#define AT91C_SPI_ENDTX ((unsigned int) 0x1 << 5) // (SPI) End of Receiver Transfer +#define AT91C_SPI_RXBUFF ((unsigned int) 0x1 << 6) // (SPI) RXBUFF Interrupt +#define AT91C_SPI_TXBUFE ((unsigned int) 0x1 << 7) // (SPI) TXBUFE Interrupt +#define AT91C_SPI_NSSR ((unsigned int) 0x1 << 8) // (SPI) NSSR Interrupt +#define AT91C_SPI_TXEMPTY ((unsigned int) 0x1 << 9) // (SPI) TXEMPTY Interrupt +#define AT91C_SPI_SPIENS ((unsigned int) 0x1 << 16) // (SPI) Enable Status +// -------- SPI_IER : (SPI Offset: 0x14) Interrupt Enable Register -------- +// -------- SPI_IDR : (SPI Offset: 0x18) Interrupt Disable Register -------- +// -------- SPI_IMR : (SPI Offset: 0x1c) Interrupt Mask Register -------- +// -------- SPI_CSR : (SPI Offset: 0x30) Chip Select Register -------- +#define AT91C_SPI_CPOL ((unsigned int) 0x1 << 0) // (SPI) Clock Polarity +#define AT91C_SPI_NCPHA ((unsigned int) 0x1 << 1) // (SPI) Clock Phase +#define AT91C_SPI_CSAAT ((unsigned int) 0x1 << 3) // (SPI) Chip Select Active After Transfer +#define AT91C_SPI_BITS ((unsigned int) 0xF << 4) // (SPI) Bits Per Transfer +#define AT91C_SPI_BITS_8 ((unsigned int) 0x0 << 4) // (SPI) 8 Bits Per transfer +#define AT91C_SPI_BITS_9 ((unsigned int) 0x1 << 4) // (SPI) 9 Bits Per transfer +#define AT91C_SPI_BITS_10 ((unsigned int) 0x2 << 4) // (SPI) 10 Bits Per transfer +#define AT91C_SPI_BITS_11 ((unsigned int) 0x3 << 4) // (SPI) 11 Bits Per transfer +#define AT91C_SPI_BITS_12 ((unsigned int) 0x4 << 4) // (SPI) 12 Bits Per transfer +#define AT91C_SPI_BITS_13 ((unsigned int) 0x5 << 4) // (SPI) 13 Bits Per transfer +#define AT91C_SPI_BITS_14 ((unsigned int) 0x6 << 4) // (SPI) 14 Bits Per transfer +#define AT91C_SPI_BITS_15 ((unsigned int) 0x7 << 4) // (SPI) 15 Bits Per transfer +#define AT91C_SPI_BITS_16 ((unsigned int) 0x8 << 4) // (SPI) 16 Bits Per transfer +#define AT91C_SPI_SCBR ((unsigned int) 0xFF << 8) // (SPI) Serial Clock Baud Rate +#define AT91C_SPI_DLYBS ((unsigned int) 0xFF << 16) // (SPI) Delay Before SPCK +#define AT91C_SPI_DLYBCT ((unsigned int) 0xFF << 24) // (SPI) Delay Between Consecutive Transfers + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Usart +// ***************************************************************************** +typedef struct _AT91S_USART { + AT91_REG US_CR; // Control Register + AT91_REG US_MR; // Mode Register + AT91_REG US_IER; // Interrupt Enable Register + AT91_REG US_IDR; // Interrupt Disable Register + AT91_REG US_IMR; // Interrupt Mask Register + AT91_REG US_CSR; // Channel Status Register + AT91_REG US_RHR; // Receiver Holding Register + AT91_REG US_THR; // Transmitter Holding Register + AT91_REG US_BRGR; // Baud Rate Generator Register + AT91_REG US_RTOR; // Receiver Time-out Register + AT91_REG US_TTGR; // Transmitter Time-guard Register + AT91_REG Reserved0[5]; // + AT91_REG US_FIDI; // FI_DI_Ratio Register + AT91_REG US_NER; // Nb Errors Register + AT91_REG Reserved1[1]; // + AT91_REG US_IF; // IRDA_FILTER Register + AT91_REG Reserved2[44]; // + AT91_REG US_RPR; // Receive Pointer Register + AT91_REG US_RCR; // Receive Counter Register + AT91_REG US_TPR; // Transmit Pointer Register + AT91_REG US_TCR; // Transmit Counter Register + AT91_REG US_RNPR; // Receive Next Pointer Register + AT91_REG US_RNCR; // Receive Next Counter Register + AT91_REG US_TNPR; // Transmit Next Pointer Register + AT91_REG US_TNCR; // Transmit Next Counter Register + AT91_REG US_PTCR; // PDC Transfer Control Register + AT91_REG US_PTSR; // PDC Transfer Status Register +} AT91S_USART, *AT91PS_USART; + +// -------- US_CR : (USART Offset: 0x0) Debug Unit Control Register -------- +#define AT91C_US_STTBRK ((unsigned int) 0x1 << 9) // (USART) Start Break +#define AT91C_US_STPBRK ((unsigned int) 0x1 << 10) // (USART) Stop Break +#define AT91C_US_STTTO ((unsigned int) 0x1 << 11) // (USART) Start Time-out +#define AT91C_US_SENDA ((unsigned int) 0x1 << 12) // (USART) Send Address +#define AT91C_US_RSTIT ((unsigned int) 0x1 << 13) // (USART) Reset Iterations +#define AT91C_US_RSTNACK ((unsigned int) 0x1 << 14) // (USART) Reset Non Acknowledge +#define AT91C_US_RETTO ((unsigned int) 0x1 << 15) // (USART) Rearm Time-out +#define AT91C_US_DTREN ((unsigned int) 0x1 << 16) // (USART) Data Terminal ready Enable +#define AT91C_US_DTRDIS ((unsigned int) 0x1 << 17) // (USART) Data Terminal ready Disable +#define AT91C_US_RTSEN ((unsigned int) 0x1 << 18) // (USART) Request to Send enable +#define AT91C_US_RTSDIS ((unsigned int) 0x1 << 19) // (USART) Request to Send Disable +// -------- US_MR : (USART Offset: 0x4) Debug Unit Mode Register -------- +#define AT91C_US_USMODE ((unsigned int) 0xF << 0) // (USART) Usart mode +#define AT91C_US_USMODE_NORMAL ((unsigned int) 0x0) // (USART) Normal +#define AT91C_US_USMODE_RS485 ((unsigned int) 0x1) // (USART) RS485 +#define AT91C_US_USMODE_HWHSH ((unsigned int) 0x2) // (USART) Hardware Handshaking +#define AT91C_US_USMODE_MODEM ((unsigned int) 0x3) // (USART) Modem +#define AT91C_US_USMODE_ISO7816_0 ((unsigned int) 0x4) // (USART) ISO7816 protocol: T = 0 +#define AT91C_US_USMODE_ISO7816_1 ((unsigned int) 0x6) // (USART) ISO7816 protocol: T = 1 +#define AT91C_US_USMODE_IRDA ((unsigned int) 0x8) // (USART) IrDA +#define AT91C_US_USMODE_SWHSH ((unsigned int) 0xC) // (USART) Software Handshaking +#define AT91C_US_CLKS ((unsigned int) 0x3 << 4) // (USART) Clock Selection (Baud Rate generator Input Clock +#define AT91C_US_CLKS_CLOCK ((unsigned int) 0x0 << 4) // (USART) Clock +#define AT91C_US_CLKS_FDIV1 ((unsigned int) 0x1 << 4) // (USART) fdiv1 +#define AT91C_US_CLKS_SLOW ((unsigned int) 0x2 << 4) // (USART) slow_clock (ARM) +#define AT91C_US_CLKS_EXT ((unsigned int) 0x3 << 4) // (USART) External (SCK) +#define AT91C_US_CHRL ((unsigned int) 0x3 << 6) // (USART) Clock Selection (Baud Rate generator Input Clock +#define AT91C_US_CHRL_5_BITS ((unsigned int) 0x0 << 6) // (USART) Character Length: 5 bits +#define AT91C_US_CHRL_6_BITS ((unsigned int) 0x1 << 6) // (USART) Character Length: 6 bits +#define AT91C_US_CHRL_7_BITS ((unsigned int) 0x2 << 6) // (USART) Character Length: 7 bits +#define AT91C_US_CHRL_8_BITS ((unsigned int) 0x3 << 6) // (USART) Character Length: 8 bits +#define AT91C_US_SYNC ((unsigned int) 0x1 << 8) // (USART) Synchronous Mode Select +#define AT91C_US_NBSTOP ((unsigned int) 0x3 << 12) // (USART) Number of Stop bits +#define AT91C_US_NBSTOP_1_BIT ((unsigned int) 0x0 << 12) // (USART) 1 stop bit +#define AT91C_US_NBSTOP_15_BIT ((unsigned int) 0x1 << 12) // (USART) Asynchronous (SYNC=0) 2 stop bits Synchronous (SYNC=1) 2 stop bits +#define AT91C_US_NBSTOP_2_BIT ((unsigned int) 0x2 << 12) // (USART) 2 stop bits +#define AT91C_US_MSBF ((unsigned int) 0x1 << 16) // (USART) Bit Order +#define AT91C_US_MODE9 ((unsigned int) 0x1 << 17) // (USART) 9-bit Character length +#define AT91C_US_CKLO ((unsigned int) 0x1 << 18) // (USART) Clock Output Select +#define AT91C_US_OVER ((unsigned int) 0x1 << 19) // (USART) Over Sampling Mode +#define AT91C_US_INACK ((unsigned int) 0x1 << 20) // (USART) Inhibit Non Acknowledge +#define AT91C_US_DSNACK ((unsigned int) 0x1 << 21) // (USART) Disable Successive NACK +#define AT91C_US_MAX_ITER ((unsigned int) 0x1 << 24) // (USART) Number of Repetitions +#define AT91C_US_FILTER ((unsigned int) 0x1 << 28) // (USART) Receive Line Filter +// -------- US_IER : (USART Offset: 0x8) Debug Unit Interrupt Enable Register -------- +#define AT91C_US_RXBRK ((unsigned int) 0x1 << 2) // (USART) Break Received/End of Break +#define AT91C_US_TIMEOUT ((unsigned int) 0x1 << 8) // (USART) Receiver Time-out +#define AT91C_US_ITERATION ((unsigned int) 0x1 << 10) // (USART) Max number of Repetitions Reached +#define AT91C_US_NACK ((unsigned int) 0x1 << 13) // (USART) Non Acknowledge +#define AT91C_US_RIIC ((unsigned int) 0x1 << 16) // (USART) Ring INdicator Input Change Flag +#define AT91C_US_DSRIC ((unsigned int) 0x1 << 17) // (USART) Data Set Ready Input Change Flag +#define AT91C_US_DCDIC ((unsigned int) 0x1 << 18) // (USART) Data Carrier Flag +#define AT91C_US_CTSIC ((unsigned int) 0x1 << 19) // (USART) Clear To Send Input Change Flag +// -------- US_IDR : (USART Offset: 0xc) Debug Unit Interrupt Disable Register -------- +// -------- US_IMR : (USART Offset: 0x10) Debug Unit Interrupt Mask Register -------- +// -------- US_CSR : (USART Offset: 0x14) Debug Unit Channel Status Register -------- +#define AT91C_US_RI ((unsigned int) 0x1 << 20) // (USART) Image of RI Input +#define AT91C_US_DSR ((unsigned int) 0x1 << 21) // (USART) Image of DSR Input +#define AT91C_US_DCD ((unsigned int) 0x1 << 22) // (USART) Image of DCD Input +#define AT91C_US_CTS ((unsigned int) 0x1 << 23) // (USART) Image of CTS Input + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Synchronous Serial Controller Interface +// ***************************************************************************** +typedef struct _AT91S_SSC { + AT91_REG SSC_CR; // Control Register + AT91_REG SSC_CMR; // Clock Mode Register + AT91_REG Reserved0[2]; // + AT91_REG SSC_RCMR; // Receive Clock ModeRegister + AT91_REG SSC_RFMR; // Receive Frame Mode Register + AT91_REG SSC_TCMR; // Transmit Clock Mode Register + AT91_REG SSC_TFMR; // Transmit Frame Mode Register + AT91_REG SSC_RHR; // Receive Holding Register + AT91_REG SSC_THR; // Transmit Holding Register + AT91_REG Reserved1[2]; // + AT91_REG SSC_RSHR; // Receive Sync Holding Register + AT91_REG SSC_TSHR; // Transmit Sync Holding Register + AT91_REG Reserved2[2]; // + AT91_REG SSC_SR; // Status Register + AT91_REG SSC_IER; // Interrupt Enable Register + AT91_REG SSC_IDR; // Interrupt Disable Register + AT91_REG SSC_IMR; // Interrupt Mask Register + AT91_REG Reserved3[44]; // + AT91_REG SSC_RPR; // Receive Pointer Register + AT91_REG SSC_RCR; // Receive Counter Register + AT91_REG SSC_TPR; // Transmit Pointer Register + AT91_REG SSC_TCR; // Transmit Counter Register + AT91_REG SSC_RNPR; // Receive Next Pointer Register + AT91_REG SSC_RNCR; // Receive Next Counter Register + AT91_REG SSC_TNPR; // Transmit Next Pointer Register + AT91_REG SSC_TNCR; // Transmit Next Counter Register + AT91_REG SSC_PTCR; // PDC Transfer Control Register + AT91_REG SSC_PTSR; // PDC Transfer Status Register +} AT91S_SSC, *AT91PS_SSC; + +// -------- SSC_CR : (SSC Offset: 0x0) SSC Control Register -------- +#define AT91C_SSC_RXEN ((unsigned int) 0x1 << 0) // (SSC) Receive Enable +#define AT91C_SSC_RXDIS ((unsigned int) 0x1 << 1) // (SSC) Receive Disable +#define AT91C_SSC_TXEN ((unsigned int) 0x1 << 8) // (SSC) Transmit Enable +#define AT91C_SSC_TXDIS ((unsigned int) 0x1 << 9) // (SSC) Transmit Disable +#define AT91C_SSC_SWRST ((unsigned int) 0x1 << 15) // (SSC) Software Reset +// -------- SSC_RCMR : (SSC Offset: 0x10) SSC Receive Clock Mode Register -------- +#define AT91C_SSC_CKS ((unsigned int) 0x3 << 0) // (SSC) Receive/Transmit Clock Selection +#define AT91C_SSC_CKS_DIV ((unsigned int) 0x0) // (SSC) Divided Clock +#define AT91C_SSC_CKS_TK ((unsigned int) 0x1) // (SSC) TK Clock signal +#define AT91C_SSC_CKS_RK ((unsigned int) 0x2) // (SSC) RK pin +#define AT91C_SSC_CKO ((unsigned int) 0x7 << 2) // (SSC) Receive/Transmit Clock Output Mode Selection +#define AT91C_SSC_CKO_NONE ((unsigned int) 0x0 << 2) // (SSC) Receive/Transmit Clock Output Mode: None RK pin: Input-only +#define AT91C_SSC_CKO_CONTINOUS ((unsigned int) 0x1 << 2) // (SSC) Continuous Receive/Transmit Clock RK pin: Output +#define AT91C_SSC_CKO_DATA_TX ((unsigned int) 0x2 << 2) // (SSC) Receive/Transmit Clock only during data transfers RK pin: Output +#define AT91C_SSC_CKI ((unsigned int) 0x1 << 5) // (SSC) Receive/Transmit Clock Inversion +#define AT91C_SSC_CKG ((unsigned int) 0x3 << 6) // (SSC) Receive/Transmit Clock Gating Selection +#define AT91C_SSC_CKG_NONE ((unsigned int) 0x0 << 6) // (SSC) Receive/Transmit Clock Gating: None, continuous clock +#define AT91C_SSC_CKG_LOW ((unsigned int) 0x1 << 6) // (SSC) Receive/Transmit Clock enabled only if RF Low +#define AT91C_SSC_CKG_HIGH ((unsigned int) 0x2 << 6) // (SSC) Receive/Transmit Clock enabled only if RF High +#define AT91C_SSC_START ((unsigned int) 0xF << 8) // (SSC) Receive/Transmit Start Selection +#define AT91C_SSC_START_CONTINOUS ((unsigned int) 0x0 << 8) // (SSC) Continuous, as soon as the receiver is enabled, and immediately after the end of transfer of the previous data. +#define AT91C_SSC_START_TX ((unsigned int) 0x1 << 8) // (SSC) Transmit/Receive start +#define AT91C_SSC_START_LOW_RF ((unsigned int) 0x2 << 8) // (SSC) Detection of a low level on RF input +#define AT91C_SSC_START_HIGH_RF ((unsigned int) 0x3 << 8) // (SSC) Detection of a high level on RF input +#define AT91C_SSC_START_FALL_RF ((unsigned int) 0x4 << 8) // (SSC) Detection of a falling edge on RF input +#define AT91C_SSC_START_RISE_RF ((unsigned int) 0x5 << 8) // (SSC) Detection of a rising edge on RF input +#define AT91C_SSC_START_LEVEL_RF ((unsigned int) 0x6 << 8) // (SSC) Detection of any level change on RF input +#define AT91C_SSC_START_EDGE_RF ((unsigned int) 0x7 << 8) // (SSC) Detection of any edge on RF input +#define AT91C_SSC_START_0 ((unsigned int) 0x8 << 8) // (SSC) Compare 0 +#define AT91C_SSC_STOP ((unsigned int) 0x1 << 12) // (SSC) Receive Stop Selection +#define AT91C_SSC_STTDLY ((unsigned int) 0xFF << 16) // (SSC) Receive/Transmit Start Delay +#define AT91C_SSC_PERIOD ((unsigned int) 0xFF << 24) // (SSC) Receive/Transmit Period Divider Selection +// -------- SSC_RFMR : (SSC Offset: 0x14) SSC Receive Frame Mode Register -------- +#define AT91C_SSC_DATLEN ((unsigned int) 0x1F << 0) // (SSC) Data Length +#define AT91C_SSC_LOOP ((unsigned int) 0x1 << 5) // (SSC) Loop Mode +#define AT91C_SSC_MSBF ((unsigned int) 0x1 << 7) // (SSC) Most Significant Bit First +#define AT91C_SSC_DATNB ((unsigned int) 0xF << 8) // (SSC) Data Number per Frame +#define AT91C_SSC_FSLEN ((unsigned int) 0xF << 16) // (SSC) Receive/Transmit Frame Sync length +#define AT91C_SSC_FSOS ((unsigned int) 0x7 << 20) // (SSC) Receive/Transmit Frame Sync Output Selection +#define AT91C_SSC_FSOS_NONE ((unsigned int) 0x0 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: None RK pin Input-only +#define AT91C_SSC_FSOS_NEGATIVE ((unsigned int) 0x1 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Negative Pulse +#define AT91C_SSC_FSOS_POSITIVE ((unsigned int) 0x2 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Positive Pulse +#define AT91C_SSC_FSOS_LOW ((unsigned int) 0x3 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Driver Low during data transfer +#define AT91C_SSC_FSOS_HIGH ((unsigned int) 0x4 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Driver High during data transfer +#define AT91C_SSC_FSOS_TOGGLE ((unsigned int) 0x5 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Toggling at each start of data transfer +#define AT91C_SSC_FSEDGE ((unsigned int) 0x1 << 24) // (SSC) Frame Sync Edge Detection +// -------- SSC_TCMR : (SSC Offset: 0x18) SSC Transmit Clock Mode Register -------- +// -------- SSC_TFMR : (SSC Offset: 0x1c) SSC Transmit Frame Mode Register -------- +#define AT91C_SSC_DATDEF ((unsigned int) 0x1 << 5) // (SSC) Data Default Value +#define AT91C_SSC_FSDEN ((unsigned int) 0x1 << 23) // (SSC) Frame Sync Data Enable +// -------- SSC_SR : (SSC Offset: 0x40) SSC Status Register -------- +#define AT91C_SSC_TXRDY ((unsigned int) 0x1 << 0) // (SSC) Transmit Ready +#define AT91C_SSC_TXEMPTY ((unsigned int) 0x1 << 1) // (SSC) Transmit Empty +#define AT91C_SSC_ENDTX ((unsigned int) 0x1 << 2) // (SSC) End Of Transmission +#define AT91C_SSC_TXBUFE ((unsigned int) 0x1 << 3) // (SSC) Transmit Buffer Empty +#define AT91C_SSC_RXRDY ((unsigned int) 0x1 << 4) // (SSC) Receive Ready +#define AT91C_SSC_OVRUN ((unsigned int) 0x1 << 5) // (SSC) Receive Overrun +#define AT91C_SSC_ENDRX ((unsigned int) 0x1 << 6) // (SSC) End of Reception +#define AT91C_SSC_RXBUFF ((unsigned int) 0x1 << 7) // (SSC) Receive Buffer Full +#define AT91C_SSC_CP0 ((unsigned int) 0x1 << 8) // (SSC) Compare 0 +#define AT91C_SSC_CP1 ((unsigned int) 0x1 << 9) // (SSC) Compare 1 +#define AT91C_SSC_TXSYN ((unsigned int) 0x1 << 10) // (SSC) Transmit Sync +#define AT91C_SSC_RXSYN ((unsigned int) 0x1 << 11) // (SSC) Receive Sync +#define AT91C_SSC_TXENA ((unsigned int) 0x1 << 16) // (SSC) Transmit Enable +#define AT91C_SSC_RXENA ((unsigned int) 0x1 << 17) // (SSC) Receive Enable +// -------- SSC_IER : (SSC Offset: 0x44) SSC Interrupt Enable Register -------- +// -------- SSC_IDR : (SSC Offset: 0x48) SSC Interrupt Disable Register -------- +// -------- SSC_IMR : (SSC Offset: 0x4c) SSC Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Two-wire Interface +// ***************************************************************************** +typedef struct _AT91S_TWI { + AT91_REG TWI_CR; // Control Register + AT91_REG TWI_MMR; // Master Mode Register + AT91_REG Reserved0[1]; // + AT91_REG TWI_IADR; // Internal Address Register + AT91_REG TWI_CWGR; // Clock Waveform Generator Register + AT91_REG Reserved1[3]; // + AT91_REG TWI_SR; // Status Register + AT91_REG TWI_IER; // Interrupt Enable Register + AT91_REG TWI_IDR; // Interrupt Disable Register + AT91_REG TWI_IMR; // Interrupt Mask Register + AT91_REG TWI_RHR; // Receive Holding Register + AT91_REG TWI_THR; // Transmit Holding Register +} AT91S_TWI, *AT91PS_TWI; + +// -------- TWI_CR : (TWI Offset: 0x0) TWI Control Register -------- +#define AT91C_TWI_START ((unsigned int) 0x1 << 0) // (TWI) Send a START Condition +#define AT91C_TWI_STOP ((unsigned int) 0x1 << 1) // (TWI) Send a STOP Condition +#define AT91C_TWI_MSEN ((unsigned int) 0x1 << 2) // (TWI) TWI Master Transfer Enabled +#define AT91C_TWI_MSDIS ((unsigned int) 0x1 << 3) // (TWI) TWI Master Transfer Disabled +#define AT91C_TWI_SWRST ((unsigned int) 0x1 << 7) // (TWI) Software Reset +// -------- TWI_MMR : (TWI Offset: 0x4) TWI Master Mode Register -------- +#define AT91C_TWI_IADRSZ ((unsigned int) 0x3 << 8) // (TWI) Internal Device Address Size +#define AT91C_TWI_IADRSZ_NO ((unsigned int) 0x0 << 8) // (TWI) No internal device address +#define AT91C_TWI_IADRSZ_1_BYTE ((unsigned int) 0x1 << 8) // (TWI) One-byte internal device address +#define AT91C_TWI_IADRSZ_2_BYTE ((unsigned int) 0x2 << 8) // (TWI) Two-byte internal device address +#define AT91C_TWI_IADRSZ_3_BYTE ((unsigned int) 0x3 << 8) // (TWI) Three-byte internal device address +#define AT91C_TWI_MREAD ((unsigned int) 0x1 << 12) // (TWI) Master Read Direction +#define AT91C_TWI_DADR ((unsigned int) 0x7F << 16) // (TWI) Device Address +// -------- TWI_CWGR : (TWI Offset: 0x10) TWI Clock Waveform Generator Register -------- +#define AT91C_TWI_CLDIV ((unsigned int) 0xFF << 0) // (TWI) Clock Low Divider +#define AT91C_TWI_CHDIV ((unsigned int) 0xFF << 8) // (TWI) Clock High Divider +#define AT91C_TWI_CKDIV ((unsigned int) 0x7 << 16) // (TWI) Clock Divider +// -------- TWI_SR : (TWI Offset: 0x20) TWI Status Register -------- +#define AT91C_TWI_TXCOMP ((unsigned int) 0x1 << 0) // (TWI) Transmission Completed +#define AT91C_TWI_RXRDY ((unsigned int) 0x1 << 1) // (TWI) Receive holding register ReaDY +#define AT91C_TWI_TXRDY ((unsigned int) 0x1 << 2) // (TWI) Transmit holding register ReaDY +#define AT91C_TWI_OVRE ((unsigned int) 0x1 << 6) // (TWI) Overrun Error +#define AT91C_TWI_UNRE ((unsigned int) 0x1 << 7) // (TWI) Underrun Error +#define AT91C_TWI_NACK ((unsigned int) 0x1 << 8) // (TWI) Not Acknowledged +// -------- TWI_IER : (TWI Offset: 0x24) TWI Interrupt Enable Register -------- +// -------- TWI_IDR : (TWI Offset: 0x28) TWI Interrupt Disable Register -------- +// -------- TWI_IMR : (TWI Offset: 0x2c) TWI Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR PWMC Channel Interface +// ***************************************************************************** +typedef struct _AT91S_PWMC_CH { + AT91_REG PWMC_CMR; // Channel Mode Register + AT91_REG PWMC_CDTYR; // Channel Duty Cycle Register + AT91_REG PWMC_CPRDR; // Channel Period Register + AT91_REG PWMC_CCNTR; // Channel Counter Register + AT91_REG PWMC_CUPDR; // Channel Update Register + AT91_REG PWMC_Reserved[3]; // Reserved +} AT91S_PWMC_CH, *AT91PS_PWMC_CH; + +// -------- PWMC_CMR : (PWMC_CH Offset: 0x0) PWMC Channel Mode Register -------- +#define AT91C_PWMC_CPRE ((unsigned int) 0xF << 0) // (PWMC_CH) Channel Pre-scaler : PWMC_CLKx +#define AT91C_PWMC_CPRE_MCK ((unsigned int) 0x0) // (PWMC_CH) +#define AT91C_PWMC_CPRE_MCKA ((unsigned int) 0xB) // (PWMC_CH) +#define AT91C_PWMC_CPRE_MCKB ((unsigned int) 0xC) // (PWMC_CH) +#define AT91C_PWMC_CALG ((unsigned int) 0x1 << 8) // (PWMC_CH) Channel Alignment +#define AT91C_PWMC_CPOL ((unsigned int) 0x1 << 9) // (PWMC_CH) Channel Polarity +#define AT91C_PWMC_CPD ((unsigned int) 0x1 << 10) // (PWMC_CH) Channel Update Period +// -------- PWMC_CDTYR : (PWMC_CH Offset: 0x4) PWMC Channel Duty Cycle Register -------- +#define AT91C_PWMC_CDTY ((unsigned int) 0x0 << 0) // (PWMC_CH) Channel Duty Cycle +// -------- PWMC_CPRDR : (PWMC_CH Offset: 0x8) PWMC Channel Period Register -------- +#define AT91C_PWMC_CPRD ((unsigned int) 0x0 << 0) // (PWMC_CH) Channel Period +// -------- PWMC_CCNTR : (PWMC_CH Offset: 0xc) PWMC Channel Counter Register -------- +#define AT91C_PWMC_CCNT ((unsigned int) 0x0 << 0) // (PWMC_CH) Channel Counter +// -------- PWMC_CUPDR : (PWMC_CH Offset: 0x10) PWMC Channel Update Register -------- +#define AT91C_PWMC_CUPD ((unsigned int) 0x0 << 0) // (PWMC_CH) Channel Update + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Pulse Width Modulation Controller Interface +// ***************************************************************************** +typedef struct _AT91S_PWMC { + AT91_REG PWMC_MR; // PWMC Mode Register + AT91_REG PWMC_ENA; // PWMC Enable Register + AT91_REG PWMC_DIS; // PWMC Disable Register + AT91_REG PWMC_SR; // PWMC Status Register + AT91_REG PWMC_IER; // PWMC Interrupt Enable Register + AT91_REG PWMC_IDR; // PWMC Interrupt Disable Register + AT91_REG PWMC_IMR; // PWMC Interrupt Mask Register + AT91_REG PWMC_ISR; // PWMC Interrupt Status Register + AT91_REG Reserved0[55]; // + AT91_REG PWMC_VR; // PWMC Version Register + AT91_REG Reserved1[64]; // + AT91S_PWMC_CH PWMC_CH[4]; // PWMC Channel +} AT91S_PWMC, *AT91PS_PWMC; + +// -------- PWMC_MR : (PWMC Offset: 0x0) PWMC Mode Register -------- +#define AT91C_PWMC_DIVA ((unsigned int) 0xFF << 0) // (PWMC) CLKA divide factor. +#define AT91C_PWMC_PREA ((unsigned int) 0xF << 8) // (PWMC) Divider Input Clock Prescaler A +#define AT91C_PWMC_PREA_MCK ((unsigned int) 0x0 << 8) // (PWMC) +#define AT91C_PWMC_DIVB ((unsigned int) 0xFF << 16) // (PWMC) CLKB divide factor. +#define AT91C_PWMC_PREB ((unsigned int) 0xF << 24) // (PWMC) Divider Input Clock Prescaler B +#define AT91C_PWMC_PREB_MCK ((unsigned int) 0x0 << 24) // (PWMC) +// -------- PWMC_ENA : (PWMC Offset: 0x4) PWMC Enable Register -------- +#define AT91C_PWMC_CHID0 ((unsigned int) 0x1 << 0) // (PWMC) Channel ID 0 +#define AT91C_PWMC_CHID1 ((unsigned int) 0x1 << 1) // (PWMC) Channel ID 1 +#define AT91C_PWMC_CHID2 ((unsigned int) 0x1 << 2) // (PWMC) Channel ID 2 +#define AT91C_PWMC_CHID3 ((unsigned int) 0x1 << 3) // (PWMC) Channel ID 3 +// -------- PWMC_DIS : (PWMC Offset: 0x8) PWMC Disable Register -------- +// -------- PWMC_SR : (PWMC Offset: 0xc) PWMC Status Register -------- +// -------- PWMC_IER : (PWMC Offset: 0x10) PWMC Interrupt Enable Register -------- +// -------- PWMC_IDR : (PWMC Offset: 0x14) PWMC Interrupt Disable Register -------- +// -------- PWMC_IMR : (PWMC Offset: 0x18) PWMC Interrupt Mask Register -------- +// -------- PWMC_ISR : (PWMC Offset: 0x1c) PWMC Interrupt Status Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR USB Device Interface +// ***************************************************************************** +typedef struct _AT91S_UDP { + AT91_REG UDP_NUM; // Frame Number Register + AT91_REG UDP_GLBSTATE; // Global State Register + AT91_REG UDP_FADDR; // Function Address Register + AT91_REG Reserved0[1]; // + AT91_REG UDP_IER; // Interrupt Enable Register + AT91_REG UDP_IDR; // Interrupt Disable Register + AT91_REG UDP_IMR; // Interrupt Mask Register + AT91_REG UDP_ISR; // Interrupt Status Register + AT91_REG UDP_ICR; // Interrupt Clear Register + AT91_REG Reserved1[1]; // + AT91_REG UDP_RSTEP; // Reset Endpoint Register + AT91_REG Reserved2[1]; // + AT91_REG UDP_CSR[6]; // Endpoint Control and Status Register + AT91_REG Reserved3[2]; // + AT91_REG UDP_FDR[6]; // Endpoint FIFO Data Register + AT91_REG Reserved4[3]; // + AT91_REG UDP_TXVC; // Transceiver Control Register +} AT91S_UDP, *AT91PS_UDP; + +// -------- UDP_FRM_NUM : (UDP Offset: 0x0) USB Frame Number Register -------- +#define AT91C_UDP_FRM_NUM ((unsigned int) 0x7FF << 0) // (UDP) Frame Number as Defined in the Packet Field Formats +#define AT91C_UDP_FRM_ERR ((unsigned int) 0x1 << 16) // (UDP) Frame Error +#define AT91C_UDP_FRM_OK ((unsigned int) 0x1 << 17) // (UDP) Frame OK +// -------- UDP_GLB_STATE : (UDP Offset: 0x4) USB Global State Register -------- +#define AT91C_UDP_FADDEN ((unsigned int) 0x1 << 0) // (UDP) Function Address Enable +#define AT91C_UDP_CONFG ((unsigned int) 0x1 << 1) // (UDP) Configured +#define AT91C_UDP_ESR ((unsigned int) 0x1 << 2) // (UDP) Enable Send Resume +#define AT91C_UDP_RSMINPR ((unsigned int) 0x1 << 3) // (UDP) A Resume Has Been Sent to the Host +#define AT91C_UDP_RMWUPE ((unsigned int) 0x1 << 4) // (UDP) Remote Wake Up Enable +// -------- UDP_FADDR : (UDP Offset: 0x8) USB Function Address Register -------- +#define AT91C_UDP_FADD ((unsigned int) 0xFF << 0) // (UDP) Function Address Value +#define AT91C_UDP_FEN ((unsigned int) 0x1 << 8) // (UDP) Function Enable +// -------- UDP_IER : (UDP Offset: 0x10) USB Interrupt Enable Register -------- +#define AT91C_UDP_EPINT0 ((unsigned int) 0x1 << 0) // (UDP) Endpoint 0 Interrupt +#define AT91C_UDP_EPINT1 ((unsigned int) 0x1 << 1) // (UDP) Endpoint 0 Interrupt +#define AT91C_UDP_EPINT2 ((unsigned int) 0x1 << 2) // (UDP) Endpoint 2 Interrupt +#define AT91C_UDP_EPINT3 ((unsigned int) 0x1 << 3) // (UDP) Endpoint 3 Interrupt +#define AT91C_UDP_EPINT4 ((unsigned int) 0x1 << 4) // (UDP) Endpoint 4 Interrupt +#define AT91C_UDP_EPINT5 ((unsigned int) 0x1 << 5) // (UDP) Endpoint 5 Interrupt +#define AT91C_UDP_RXSUSP ((unsigned int) 0x1 << 8) // (UDP) USB Suspend Interrupt +#define AT91C_UDP_RXRSM ((unsigned int) 0x1 << 9) // (UDP) USB Resume Interrupt +#define AT91C_UDP_EXTRSM ((unsigned int) 0x1 << 10) // (UDP) USB External Resume Interrupt +#define AT91C_UDP_SOFINT ((unsigned int) 0x1 << 11) // (UDP) USB Start Of frame Interrupt +#define AT91C_UDP_WAKEUP ((unsigned int) 0x1 << 13) // (UDP) USB Resume Interrupt +// -------- UDP_IDR : (UDP Offset: 0x14) USB Interrupt Disable Register -------- +// -------- UDP_IMR : (UDP Offset: 0x18) USB Interrupt Mask Register -------- +// -------- UDP_ISR : (UDP Offset: 0x1c) USB Interrupt Status Register -------- +#define AT91C_UDP_ENDBUSRES ((unsigned int) 0x1 << 12) // (UDP) USB End Of Bus Reset Interrupt +// -------- UDP_ICR : (UDP Offset: 0x20) USB Interrupt Clear Register -------- +// -------- UDP_RST_EP : (UDP Offset: 0x28) USB Reset Endpoint Register -------- +#define AT91C_UDP_EP0 ((unsigned int) 0x1 << 0) // (UDP) Reset Endpoint 0 +#define AT91C_UDP_EP1 ((unsigned int) 0x1 << 1) // (UDP) Reset Endpoint 1 +#define AT91C_UDP_EP2 ((unsigned int) 0x1 << 2) // (UDP) Reset Endpoint 2 +#define AT91C_UDP_EP3 ((unsigned int) 0x1 << 3) // (UDP) Reset Endpoint 3 +#define AT91C_UDP_EP4 ((unsigned int) 0x1 << 4) // (UDP) Reset Endpoint 4 +#define AT91C_UDP_EP5 ((unsigned int) 0x1 << 5) // (UDP) Reset Endpoint 5 +// -------- UDP_CSR : (UDP Offset: 0x30) USB Endpoint Control and Status Register -------- +#define AT91C_UDP_TXCOMP ((unsigned int) 0x1 << 0) // (UDP) Generates an IN packet with data previously written in the DPR +#define AT91C_UDP_RX_DATA_BK0 ((unsigned int) 0x1 << 1) // (UDP) Receive Data Bank 0 +#define AT91C_UDP_RXSETUP ((unsigned int) 0x1 << 2) // (UDP) Sends STALL to the Host (Control endpoints) +#define AT91C_UDP_ISOERROR ((unsigned int) 0x1 << 3) // (UDP) Isochronous error (Isochronous endpoints) +#define AT91C_UDP_TXPKTRDY ((unsigned int) 0x1 << 4) // (UDP) Transmit Packet Ready +#define AT91C_UDP_FORCESTALL ((unsigned int) 0x1 << 5) // (UDP) Force Stall (used by Control, Bulk and Isochronous endpoints). +#define AT91C_UDP_RX_DATA_BK1 ((unsigned int) 0x1 << 6) // (UDP) Receive Data Bank 1 (only used by endpoints with ping-pong attributes). +#define AT91C_UDP_DIR ((unsigned int) 0x1 << 7) // (UDP) Transfer Direction +#define AT91C_UDP_EPTYPE ((unsigned int) 0x7 << 8) // (UDP) Endpoint type +#define AT91C_UDP_EPTYPE_CTRL ((unsigned int) 0x0 << 8) // (UDP) Control +#define AT91C_UDP_EPTYPE_ISO_OUT ((unsigned int) 0x1 << 8) // (UDP) Isochronous OUT +#define AT91C_UDP_EPTYPE_BULK_OUT ((unsigned int) 0x2 << 8) // (UDP) Bulk OUT +#define AT91C_UDP_EPTYPE_INT_OUT ((unsigned int) 0x3 << 8) // (UDP) Interrupt OUT +#define AT91C_UDP_EPTYPE_ISO_IN ((unsigned int) 0x5 << 8) // (UDP) Isochronous IN +#define AT91C_UDP_EPTYPE_BULK_IN ((unsigned int) 0x6 << 8) // (UDP) Bulk IN +#define AT91C_UDP_EPTYPE_INT_IN ((unsigned int) 0x7 << 8) // (UDP) Interrupt IN +#define AT91C_UDP_DTGLE ((unsigned int) 0x1 << 11) // (UDP) Data Toggle +#define AT91C_UDP_EPEDS ((unsigned int) 0x1 << 15) // (UDP) Endpoint Enable Disable +#define AT91C_UDP_RXBYTECNT ((unsigned int) 0x7FF << 16) // (UDP) Number Of Bytes Available in the FIFO +// -------- UDP_TXVC : (UDP Offset: 0x74) Transceiver Control Register -------- +#define AT91C_UDP_TXVDIS ((unsigned int) 0x1 << 8) // (UDP) +#define AT91C_UDP_PUON ((unsigned int) 0x1 << 9) // (UDP) Pull-up ON + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Timer Counter Channel Interface +// ***************************************************************************** +typedef struct _AT91S_TC { + AT91_REG TC_CCR; // Channel Control Register + AT91_REG TC_CMR; // Channel Mode Register (Capture Mode / Waveform Mode) + AT91_REG Reserved0[2]; // + AT91_REG TC_CV; // Counter Value + AT91_REG TC_RA; // Register A + AT91_REG TC_RB; // Register B + AT91_REG TC_RC; // Register C + AT91_REG TC_SR; // Status Register + AT91_REG TC_IER; // Interrupt Enable Register + AT91_REG TC_IDR; // Interrupt Disable Register + AT91_REG TC_IMR; // Interrupt Mask Register +} AT91S_TC, *AT91PS_TC; + +// -------- TC_CCR : (TC Offset: 0x0) TC Channel Control Register -------- +#define AT91C_TC_CLKEN ((unsigned int) 0x1 << 0) // (TC) Counter Clock Enable Command +#define AT91C_TC_CLKDIS ((unsigned int) 0x1 << 1) // (TC) Counter Clock Disable Command +#define AT91C_TC_SWTRG ((unsigned int) 0x1 << 2) // (TC) Software Trigger Command +// -------- TC_CMR : (TC Offset: 0x4) TC Channel Mode Register: Capture Mode / Waveform Mode -------- +#define AT91C_TC_CLKS ((unsigned int) 0x7 << 0) // (TC) Clock Selection +#define AT91C_TC_CLKS_TIMER_DIV1_CLOCK ((unsigned int) 0x0) // (TC) Clock selected: TIMER_DIV1_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV2_CLOCK ((unsigned int) 0x1) // (TC) Clock selected: TIMER_DIV2_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV3_CLOCK ((unsigned int) 0x2) // (TC) Clock selected: TIMER_DIV3_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV4_CLOCK ((unsigned int) 0x3) // (TC) Clock selected: TIMER_DIV4_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV5_CLOCK ((unsigned int) 0x4) // (TC) Clock selected: TIMER_DIV5_CLOCK +#define AT91C_TC_CLKS_XC0 ((unsigned int) 0x5) // (TC) Clock selected: XC0 +#define AT91C_TC_CLKS_XC1 ((unsigned int) 0x6) // (TC) Clock selected: XC1 +#define AT91C_TC_CLKS_XC2 ((unsigned int) 0x7) // (TC) Clock selected: XC2 +#define AT91C_TC_CLKI ((unsigned int) 0x1 << 3) // (TC) Clock Invert +#define AT91C_TC_BURST ((unsigned int) 0x3 << 4) // (TC) Burst Signal Selection +#define AT91C_TC_BURST_NONE ((unsigned int) 0x0 << 4) // (TC) The clock is not gated by an external signal +#define AT91C_TC_BURST_XC0 ((unsigned int) 0x1 << 4) // (TC) XC0 is ANDed with the selected clock +#define AT91C_TC_BURST_XC1 ((unsigned int) 0x2 << 4) // (TC) XC1 is ANDed with the selected clock +#define AT91C_TC_BURST_XC2 ((unsigned int) 0x3 << 4) // (TC) XC2 is ANDed with the selected clock +#define AT91C_TC_CPCSTOP ((unsigned int) 0x1 << 6) // (TC) Counter Clock Stopped with RC Compare +#define AT91C_TC_LDBSTOP ((unsigned int) 0x1 << 6) // (TC) Counter Clock Stopped with RB Loading +#define AT91C_TC_CPCDIS ((unsigned int) 0x1 << 7) // (TC) Counter Clock Disable with RC Compare +#define AT91C_TC_LDBDIS ((unsigned int) 0x1 << 7) // (TC) Counter Clock Disabled with RB Loading +#define AT91C_TC_ETRGEDG ((unsigned int) 0x3 << 8) // (TC) External Trigger Edge Selection +#define AT91C_TC_ETRGEDG_NONE ((unsigned int) 0x0 << 8) // (TC) Edge: None +#define AT91C_TC_ETRGEDG_RISING ((unsigned int) 0x1 << 8) // (TC) Edge: rising edge +#define AT91C_TC_ETRGEDG_FALLING ((unsigned int) 0x2 << 8) // (TC) Edge: falling edge +#define AT91C_TC_ETRGEDG_BOTH ((unsigned int) 0x3 << 8) // (TC) Edge: each edge +#define AT91C_TC_EEVTEDG ((unsigned int) 0x3 << 8) // (TC) External Event Edge Selection +#define AT91C_TC_EEVTEDG_NONE ((unsigned int) 0x0 << 8) // (TC) Edge: None +#define AT91C_TC_EEVTEDG_RISING ((unsigned int) 0x1 << 8) // (TC) Edge: rising edge +#define AT91C_TC_EEVTEDG_FALLING ((unsigned int) 0x2 << 8) // (TC) Edge: falling edge +#define AT91C_TC_EEVTEDG_BOTH ((unsigned int) 0x3 << 8) // (TC) Edge: each edge +#define AT91C_TC_EEVT ((unsigned int) 0x3 << 10) // (TC) External Event Selection +#define AT91C_TC_EEVT_TIOB ((unsigned int) 0x0 << 10) // (TC) Signal selected as external event: TIOB TIOB direction: input +#define AT91C_TC_EEVT_XC0 ((unsigned int) 0x1 << 10) // (TC) Signal selected as external event: XC0 TIOB direction: output +#define AT91C_TC_EEVT_XC1 ((unsigned int) 0x2 << 10) // (TC) Signal selected as external event: XC1 TIOB direction: output +#define AT91C_TC_EEVT_XC2 ((unsigned int) 0x3 << 10) // (TC) Signal selected as external event: XC2 TIOB direction: output +#define AT91C_TC_ABETRG ((unsigned int) 0x1 << 10) // (TC) TIOA or TIOB External Trigger Selection +#define AT91C_TC_ENETRG ((unsigned int) 0x1 << 12) // (TC) External Event Trigger enable +#define AT91C_TC_WAVESEL ((unsigned int) 0x3 << 13) // (TC) Waveform Selection +#define AT91C_TC_WAVESEL_UP ((unsigned int) 0x0 << 13) // (TC) UP mode without atomatic trigger on RC Compare +#define AT91C_TC_WAVESEL_UPDOWN ((unsigned int) 0x1 << 13) // (TC) UPDOWN mode without automatic trigger on RC Compare +#define AT91C_TC_WAVESEL_UP_AUTO ((unsigned int) 0x2 << 13) // (TC) UP mode with automatic trigger on RC Compare +#define AT91C_TC_WAVESEL_UPDOWN_AUTO ((unsigned int) 0x3 << 13) // (TC) UPDOWN mode with automatic trigger on RC Compare +#define AT91C_TC_CPCTRG ((unsigned int) 0x1 << 14) // (TC) RC Compare Trigger Enable +#define AT91C_TC_WAVE ((unsigned int) 0x1 << 15) // (TC) +#define AT91C_TC_ACPA ((unsigned int) 0x3 << 16) // (TC) RA Compare Effect on TIOA +#define AT91C_TC_ACPA_NONE ((unsigned int) 0x0 << 16) // (TC) Effect: none +#define AT91C_TC_ACPA_SET ((unsigned int) 0x1 << 16) // (TC) Effect: set +#define AT91C_TC_ACPA_CLEAR ((unsigned int) 0x2 << 16) // (TC) Effect: clear +#define AT91C_TC_ACPA_TOGGLE ((unsigned int) 0x3 << 16) // (TC) Effect: toggle +#define AT91C_TC_LDRA ((unsigned int) 0x3 << 16) // (TC) RA Loading Selection +#define AT91C_TC_LDRA_NONE ((unsigned int) 0x0 << 16) // (TC) Edge: None +#define AT91C_TC_LDRA_RISING ((unsigned int) 0x1 << 16) // (TC) Edge: rising edge of TIOA +#define AT91C_TC_LDRA_FALLING ((unsigned int) 0x2 << 16) // (TC) Edge: falling edge of TIOA +#define AT91C_TC_LDRA_BOTH ((unsigned int) 0x3 << 16) // (TC) Edge: each edge of TIOA +#define AT91C_TC_ACPC ((unsigned int) 0x3 << 18) // (TC) RC Compare Effect on TIOA +#define AT91C_TC_ACPC_NONE ((unsigned int) 0x0 << 18) // (TC) Effect: none +#define AT91C_TC_ACPC_SET ((unsigned int) 0x1 << 18) // (TC) Effect: set +#define AT91C_TC_ACPC_CLEAR ((unsigned int) 0x2 << 18) // (TC) Effect: clear +#define AT91C_TC_ACPC_TOGGLE ((unsigned int) 0x3 << 18) // (TC) Effect: toggle +#define AT91C_TC_LDRB ((unsigned int) 0x3 << 18) // (TC) RB Loading Selection +#define AT91C_TC_LDRB_NONE ((unsigned int) 0x0 << 18) // (TC) Edge: None +#define AT91C_TC_LDRB_RISING ((unsigned int) 0x1 << 18) // (TC) Edge: rising edge of TIOA +#define AT91C_TC_LDRB_FALLING ((unsigned int) 0x2 << 18) // (TC) Edge: falling edge of TIOA +#define AT91C_TC_LDRB_BOTH ((unsigned int) 0x3 << 18) // (TC) Edge: each edge of TIOA +#define AT91C_TC_AEEVT ((unsigned int) 0x3 << 20) // (TC) External Event Effect on TIOA +#define AT91C_TC_AEEVT_NONE ((unsigned int) 0x0 << 20) // (TC) Effect: none +#define AT91C_TC_AEEVT_SET ((unsigned int) 0x1 << 20) // (TC) Effect: set +#define AT91C_TC_AEEVT_CLEAR ((unsigned int) 0x2 << 20) // (TC) Effect: clear +#define AT91C_TC_AEEVT_TOGGLE ((unsigned int) 0x3 << 20) // (TC) Effect: toggle +#define AT91C_TC_ASWTRG ((unsigned int) 0x3 << 22) // (TC) Software Trigger Effect on TIOA +#define AT91C_TC_ASWTRG_NONE ((unsigned int) 0x0 << 22) // (TC) Effect: none +#define AT91C_TC_ASWTRG_SET ((unsigned int) 0x1 << 22) // (TC) Effect: set +#define AT91C_TC_ASWTRG_CLEAR ((unsigned int) 0x2 << 22) // (TC) Effect: clear +#define AT91C_TC_ASWTRG_TOGGLE ((unsigned int) 0x3 << 22) // (TC) Effect: toggle +#define AT91C_TC_BCPB ((unsigned int) 0x3 << 24) // (TC) RB Compare Effect on TIOB +#define AT91C_TC_BCPB_NONE ((unsigned int) 0x0 << 24) // (TC) Effect: none +#define AT91C_TC_BCPB_SET ((unsigned int) 0x1 << 24) // (TC) Effect: set +#define AT91C_TC_BCPB_CLEAR ((unsigned int) 0x2 << 24) // (TC) Effect: clear +#define AT91C_TC_BCPB_TOGGLE ((unsigned int) 0x3 << 24) // (TC) Effect: toggle +#define AT91C_TC_BCPC ((unsigned int) 0x3 << 26) // (TC) RC Compare Effect on TIOB +#define AT91C_TC_BCPC_NONE ((unsigned int) 0x0 << 26) // (TC) Effect: none +#define AT91C_TC_BCPC_SET ((unsigned int) 0x1 << 26) // (TC) Effect: set +#define AT91C_TC_BCPC_CLEAR ((unsigned int) 0x2 << 26) // (TC) Effect: clear +#define AT91C_TC_BCPC_TOGGLE ((unsigned int) 0x3 << 26) // (TC) Effect: toggle +#define AT91C_TC_BEEVT ((unsigned int) 0x3 << 28) // (TC) External Event Effect on TIOB +#define AT91C_TC_BEEVT_NONE ((unsigned int) 0x0 << 28) // (TC) Effect: none +#define AT91C_TC_BEEVT_SET ((unsigned int) 0x1 << 28) // (TC) Effect: set +#define AT91C_TC_BEEVT_CLEAR ((unsigned int) 0x2 << 28) // (TC) Effect: clear +#define AT91C_TC_BEEVT_TOGGLE ((unsigned int) 0x3 << 28) // (TC) Effect: toggle +#define AT91C_TC_BSWTRG ((unsigned int) 0x3 << 30) // (TC) Software Trigger Effect on TIOB +#define AT91C_TC_BSWTRG_NONE ((unsigned int) 0x0 << 30) // (TC) Effect: none +#define AT91C_TC_BSWTRG_SET ((unsigned int) 0x1 << 30) // (TC) Effect: set +#define AT91C_TC_BSWTRG_CLEAR ((unsigned int) 0x2 << 30) // (TC) Effect: clear +#define AT91C_TC_BSWTRG_TOGGLE ((unsigned int) 0x3 << 30) // (TC) Effect: toggle +// -------- TC_SR : (TC Offset: 0x20) TC Channel Status Register -------- +#define AT91C_TC_COVFS ((unsigned int) 0x1 << 0) // (TC) Counter Overflow +#define AT91C_TC_LOVRS ((unsigned int) 0x1 << 1) // (TC) Load Overrun +#define AT91C_TC_CPAS ((unsigned int) 0x1 << 2) // (TC) RA Compare +#define AT91C_TC_CPBS ((unsigned int) 0x1 << 3) // (TC) RB Compare +#define AT91C_TC_CPCS ((unsigned int) 0x1 << 4) // (TC) RC Compare +#define AT91C_TC_LDRAS ((unsigned int) 0x1 << 5) // (TC) RA Loading +#define AT91C_TC_LDRBS ((unsigned int) 0x1 << 6) // (TC) RB Loading +#define AT91C_TC_ETRGS ((unsigned int) 0x1 << 7) // (TC) External Trigger +#define AT91C_TC_CLKSTA ((unsigned int) 0x1 << 16) // (TC) Clock Enabling +#define AT91C_TC_MTIOA ((unsigned int) 0x1 << 17) // (TC) TIOA Mirror +#define AT91C_TC_MTIOB ((unsigned int) 0x1 << 18) // (TC) TIOA Mirror +// -------- TC_IER : (TC Offset: 0x24) TC Channel Interrupt Enable Register -------- +// -------- TC_IDR : (TC Offset: 0x28) TC Channel Interrupt Disable Register -------- +// -------- TC_IMR : (TC Offset: 0x2c) TC Channel Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Timer Counter Interface +// ***************************************************************************** +typedef struct _AT91S_TCB { + AT91S_TC TCB_TC0; // TC Channel 0 + AT91_REG Reserved0[4]; // + AT91S_TC TCB_TC1; // TC Channel 1 + AT91_REG Reserved1[4]; // + AT91S_TC TCB_TC2; // TC Channel 2 + AT91_REG Reserved2[4]; // + AT91_REG TCB_BCR; // TC Block Control Register + AT91_REG TCB_BMR; // TC Block Mode Register +} AT91S_TCB, *AT91PS_TCB; + +// -------- TCB_BCR : (TCB Offset: 0xc0) TC Block Control Register -------- +#define AT91C_TCB_SYNC ((unsigned int) 0x1 << 0) // (TCB) Synchro Command +// -------- TCB_BMR : (TCB Offset: 0xc4) TC Block Mode Register -------- +#define AT91C_TCB_TC0XC0S ((unsigned int) 0x3 << 0) // (TCB) External Clock Signal 0 Selection +#define AT91C_TCB_TC0XC0S_TCLK0 ((unsigned int) 0x0) // (TCB) TCLK0 connected to XC0 +#define AT91C_TCB_TC0XC0S_NONE ((unsigned int) 0x1) // (TCB) None signal connected to XC0 +#define AT91C_TCB_TC0XC0S_TIOA1 ((unsigned int) 0x2) // (TCB) TIOA1 connected to XC0 +#define AT91C_TCB_TC0XC0S_TIOA2 ((unsigned int) 0x3) // (TCB) TIOA2 connected to XC0 +#define AT91C_TCB_TC1XC1S ((unsigned int) 0x3 << 2) // (TCB) External Clock Signal 1 Selection +#define AT91C_TCB_TC1XC1S_TCLK1 ((unsigned int) 0x0 << 2) // (TCB) TCLK1 connected to XC1 +#define AT91C_TCB_TC1XC1S_NONE ((unsigned int) 0x1 << 2) // (TCB) None signal connected to XC1 +#define AT91C_TCB_TC1XC1S_TIOA0 ((unsigned int) 0x2 << 2) // (TCB) TIOA0 connected to XC1 +#define AT91C_TCB_TC1XC1S_TIOA2 ((unsigned int) 0x3 << 2) // (TCB) TIOA2 connected to XC1 +#define AT91C_TCB_TC2XC2S ((unsigned int) 0x3 << 4) // (TCB) External Clock Signal 2 Selection +#define AT91C_TCB_TC2XC2S_TCLK2 ((unsigned int) 0x0 << 4) // (TCB) TCLK2 connected to XC2 +#define AT91C_TCB_TC2XC2S_NONE ((unsigned int) 0x1 << 4) // (TCB) None signal connected to XC2 +#define AT91C_TCB_TC2XC2S_TIOA0 ((unsigned int) 0x2 << 4) // (TCB) TIOA0 connected to XC2 +#define AT91C_TCB_TC2XC2S_TIOA1 ((unsigned int) 0x3 << 4) // (TCB) TIOA2 connected to XC2 + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Control Area Network MailBox Interface +// ***************************************************************************** +typedef struct _AT91S_CAN_MB { + AT91_REG CAN_MB_MMR; // MailBox Mode Register + AT91_REG CAN_MB_MAM; // MailBox Acceptance Mask Register + AT91_REG CAN_MB_MID; // MailBox ID Register + AT91_REG CAN_MB_MFID; // MailBox Family ID Register + AT91_REG CAN_MB_MSR; // MailBox Status Register + AT91_REG CAN_MB_MDL; // MailBox Data Low Register + AT91_REG CAN_MB_MDH; // MailBox Data High Register + AT91_REG CAN_MB_MCR; // MailBox Control Register +} AT91S_CAN_MB, *AT91PS_CAN_MB; + +// -------- CAN_MMR : (CAN_MB Offset: 0x0) CAN Message Mode Register -------- +#define AT91C_CAN_MTIMEMARK ((unsigned int) 0xFFFF << 0) // (CAN_MB) Mailbox Timemark +#define AT91C_CAN_PRIOR ((unsigned int) 0xF << 16) // (CAN_MB) Mailbox Priority +#define AT91C_CAN_MOT ((unsigned int) 0x7 << 24) // (CAN_MB) Mailbox Object Type +#define AT91C_CAN_MOT_DIS ((unsigned int) 0x0 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_RX ((unsigned int) 0x1 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_RXOVERWRITE ((unsigned int) 0x2 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_TX ((unsigned int) 0x3 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_CONSUMER ((unsigned int) 0x4 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_PRODUCER ((unsigned int) 0x5 << 24) // (CAN_MB) +// -------- CAN_MAM : (CAN_MB Offset: 0x4) CAN Message Acceptance Mask Register -------- +#define AT91C_CAN_MIDvB ((unsigned int) 0x3FFFF << 0) // (CAN_MB) Complementary bits for identifier in extended mode +#define AT91C_CAN_MIDvA ((unsigned int) 0x7FF << 18) // (CAN_MB) Identifier for standard frame mode +#define AT91C_CAN_MIDE ((unsigned int) 0x1 << 29) // (CAN_MB) Identifier Version +// -------- CAN_MID : (CAN_MB Offset: 0x8) CAN Message ID Register -------- +// -------- CAN_MFID : (CAN_MB Offset: 0xc) CAN Message Family ID Register -------- +// -------- CAN_MSR : (CAN_MB Offset: 0x10) CAN Message Status Register -------- +#define AT91C_CAN_MTIMESTAMP ((unsigned int) 0xFFFF << 0) // (CAN_MB) Timer Value +#define AT91C_CAN_MDLC ((unsigned int) 0xF << 16) // (CAN_MB) Mailbox Data Length Code +#define AT91C_CAN_MRTR ((unsigned int) 0x1 << 20) // (CAN_MB) Mailbox Remote Transmission Request +#define AT91C_CAN_MABT ((unsigned int) 0x1 << 22) // (CAN_MB) Mailbox Message Abort +#define AT91C_CAN_MRDY ((unsigned int) 0x1 << 23) // (CAN_MB) Mailbox Ready +#define AT91C_CAN_MMI ((unsigned int) 0x1 << 24) // (CAN_MB) Mailbox Message Ignored +// -------- CAN_MDL : (CAN_MB Offset: 0x14) CAN Message Data Low Register -------- +// -------- CAN_MDH : (CAN_MB Offset: 0x18) CAN Message Data High Register -------- +// -------- CAN_MCR : (CAN_MB Offset: 0x1c) CAN Message Control Register -------- +#define AT91C_CAN_MACR ((unsigned int) 0x1 << 22) // (CAN_MB) Abort Request for Mailbox +#define AT91C_CAN_MTCR ((unsigned int) 0x1 << 23) // (CAN_MB) Mailbox Transfer Command + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Control Area Network Interface +// ***************************************************************************** +typedef struct _AT91S_CAN { + AT91_REG CAN_MR; // Mode Register + AT91_REG CAN_IER; // Interrupt Enable Register + AT91_REG CAN_IDR; // Interrupt Disable Register + AT91_REG CAN_IMR; // Interrupt Mask Register + AT91_REG CAN_SR; // Status Register + AT91_REG CAN_BR; // Baudrate Register + AT91_REG CAN_TIM; // Timer Register + AT91_REG CAN_TIMESTP; // Time Stamp Register + AT91_REG CAN_ECR; // Error Counter Register + AT91_REG CAN_TCR; // Transfer Command Register + AT91_REG CAN_ACR; // Abort Command Register + AT91_REG Reserved0[52]; // + AT91_REG CAN_VR; // Version Register + AT91_REG Reserved1[64]; // + AT91S_CAN_MB CAN_MB0; // CAN Mailbox 0 + AT91S_CAN_MB CAN_MB1; // CAN Mailbox 1 + AT91S_CAN_MB CAN_MB2; // CAN Mailbox 2 + AT91S_CAN_MB CAN_MB3; // CAN Mailbox 3 + AT91S_CAN_MB CAN_MB4; // CAN Mailbox 4 + AT91S_CAN_MB CAN_MB5; // CAN Mailbox 5 + AT91S_CAN_MB CAN_MB6; // CAN Mailbox 6 + AT91S_CAN_MB CAN_MB7; // CAN Mailbox 7 + AT91S_CAN_MB CAN_MB8; // CAN Mailbox 8 + AT91S_CAN_MB CAN_MB9; // CAN Mailbox 9 + AT91S_CAN_MB CAN_MB10; // CAN Mailbox 10 + AT91S_CAN_MB CAN_MB11; // CAN Mailbox 11 + AT91S_CAN_MB CAN_MB12; // CAN Mailbox 12 + AT91S_CAN_MB CAN_MB13; // CAN Mailbox 13 + AT91S_CAN_MB CAN_MB14; // CAN Mailbox 14 + AT91S_CAN_MB CAN_MB15; // CAN Mailbox 15 +} AT91S_CAN, *AT91PS_CAN; + +// -------- CAN_MR : (CAN Offset: 0x0) CAN Mode Register -------- +#define AT91C_CAN_CANEN ((unsigned int) 0x1 << 0) // (CAN) CAN Controller Enable +#define AT91C_CAN_LPM ((unsigned int) 0x1 << 1) // (CAN) Disable/Enable Low Power Mode +#define AT91C_CAN_ABM ((unsigned int) 0x1 << 2) // (CAN) Disable/Enable Autobaud/Listen Mode +#define AT91C_CAN_OVL ((unsigned int) 0x1 << 3) // (CAN) Disable/Enable Overload Frame +#define AT91C_CAN_TEOF ((unsigned int) 0x1 << 4) // (CAN) Time Stamp messages at each end of Frame +#define AT91C_CAN_TTM ((unsigned int) 0x1 << 5) // (CAN) Disable/Enable Time Trigger Mode +#define AT91C_CAN_TIMFRZ ((unsigned int) 0x1 << 6) // (CAN) Enable Timer Freeze +#define AT91C_CAN_DRPT ((unsigned int) 0x1 << 7) // (CAN) Disable Repeat +// -------- CAN_IER : (CAN Offset: 0x4) CAN Interrupt Enable Register -------- +#define AT91C_CAN_MB0 ((unsigned int) 0x1 << 0) // (CAN) Mailbox 0 Flag +#define AT91C_CAN_MB1 ((unsigned int) 0x1 << 1) // (CAN) Mailbox 1 Flag +#define AT91C_CAN_MB2 ((unsigned int) 0x1 << 2) // (CAN) Mailbox 2 Flag +#define AT91C_CAN_MB3 ((unsigned int) 0x1 << 3) // (CAN) Mailbox 3 Flag +#define AT91C_CAN_MB4 ((unsigned int) 0x1 << 4) // (CAN) Mailbox 4 Flag +#define AT91C_CAN_MB5 ((unsigned int) 0x1 << 5) // (CAN) Mailbox 5 Flag +#define AT91C_CAN_MB6 ((unsigned int) 0x1 << 6) // (CAN) Mailbox 6 Flag +#define AT91C_CAN_MB7 ((unsigned int) 0x1 << 7) // (CAN) Mailbox 7 Flag +#define AT91C_CAN_MB8 ((unsigned int) 0x1 << 8) // (CAN) Mailbox 8 Flag +#define AT91C_CAN_MB9 ((unsigned int) 0x1 << 9) // (CAN) Mailbox 9 Flag +#define AT91C_CAN_MB10 ((unsigned int) 0x1 << 10) // (CAN) Mailbox 10 Flag +#define AT91C_CAN_MB11 ((unsigned int) 0x1 << 11) // (CAN) Mailbox 11 Flag +#define AT91C_CAN_MB12 ((unsigned int) 0x1 << 12) // (CAN) Mailbox 12 Flag +#define AT91C_CAN_MB13 ((unsigned int) 0x1 << 13) // (CAN) Mailbox 13 Flag +#define AT91C_CAN_MB14 ((unsigned int) 0x1 << 14) // (CAN) Mailbox 14 Flag +#define AT91C_CAN_MB15 ((unsigned int) 0x1 << 15) // (CAN) Mailbox 15 Flag +#define AT91C_CAN_ERRA ((unsigned int) 0x1 << 16) // (CAN) Error Active Mode Flag +#define AT91C_CAN_WARN ((unsigned int) 0x1 << 17) // (CAN) Warning Limit Flag +#define AT91C_CAN_ERRP ((unsigned int) 0x1 << 18) // (CAN) Error Passive Mode Flag +#define AT91C_CAN_BOFF ((unsigned int) 0x1 << 19) // (CAN) Bus Off Mode Flag +#define AT91C_CAN_SLEEP ((unsigned int) 0x1 << 20) // (CAN) Sleep Flag +#define AT91C_CAN_WAKEUP ((unsigned int) 0x1 << 21) // (CAN) Wakeup Flag +#define AT91C_CAN_TOVF ((unsigned int) 0x1 << 22) // (CAN) Timer Overflow Flag +#define AT91C_CAN_TSTP ((unsigned int) 0x1 << 23) // (CAN) Timestamp Flag +#define AT91C_CAN_CERR ((unsigned int) 0x1 << 24) // (CAN) CRC Error +#define AT91C_CAN_SERR ((unsigned int) 0x1 << 25) // (CAN) Stuffing Error +#define AT91C_CAN_AERR ((unsigned int) 0x1 << 26) // (CAN) Acknowledgment Error +#define AT91C_CAN_FERR ((unsigned int) 0x1 << 27) // (CAN) Form Error +#define AT91C_CAN_BERR ((unsigned int) 0x1 << 28) // (CAN) Bit Error +// -------- CAN_IDR : (CAN Offset: 0x8) CAN Interrupt Disable Register -------- +// -------- CAN_IMR : (CAN Offset: 0xc) CAN Interrupt Mask Register -------- +// -------- CAN_SR : (CAN Offset: 0x10) CAN Status Register -------- +#define AT91C_CAN_RBSY ((unsigned int) 0x1 << 29) // (CAN) Receiver Busy +#define AT91C_CAN_TBSY ((unsigned int) 0x1 << 30) // (CAN) Transmitter Busy +#define AT91C_CAN_OVLY ((unsigned int) 0x1 << 31) // (CAN) Overload Busy +// -------- CAN_BR : (CAN Offset: 0x14) CAN Baudrate Register -------- +#define AT91C_CAN_PHASE2 ((unsigned int) 0x7 << 0) // (CAN) Phase 2 segment +#define AT91C_CAN_PHASE1 ((unsigned int) 0x7 << 4) // (CAN) Phase 1 segment +#define AT91C_CAN_PROPAG ((unsigned int) 0x7 << 8) // (CAN) Programmation time segment +#define AT91C_CAN_SYNC ((unsigned int) 0x3 << 12) // (CAN) Re-synchronization jump width segment +#define AT91C_CAN_BRP ((unsigned int) 0x7F << 16) // (CAN) Baudrate Prescaler +#define AT91C_CAN_SMP ((unsigned int) 0x1 << 24) // (CAN) Sampling mode +// -------- CAN_TIM : (CAN Offset: 0x18) CAN Timer Register -------- +#define AT91C_CAN_TIMER ((unsigned int) 0xFFFF << 0) // (CAN) Timer field +// -------- CAN_TIMESTP : (CAN Offset: 0x1c) CAN Timestamp Register -------- +// -------- CAN_ECR : (CAN Offset: 0x20) CAN Error Counter Register -------- +#define AT91C_CAN_REC ((unsigned int) 0xFF << 0) // (CAN) Receive Error Counter +#define AT91C_CAN_TEC ((unsigned int) 0xFF << 16) // (CAN) Transmit Error Counter +// -------- CAN_TCR : (CAN Offset: 0x24) CAN Transfer Command Register -------- +#define AT91C_CAN_TIMRST ((unsigned int) 0x1 << 31) // (CAN) Timer Reset Field +// -------- CAN_ACR : (CAN Offset: 0x28) CAN Abort Command Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Ethernet MAC 10/100 +// ***************************************************************************** +typedef struct _AT91S_EMAC { + AT91_REG EMAC_NCR; // Network Control Register + AT91_REG EMAC_NCFGR; // Network Configuration Register + AT91_REG EMAC_NSR; // Network Status Register + AT91_REG Reserved0[2]; // + AT91_REG EMAC_TSR; // Transmit Status Register + AT91_REG EMAC_RBQP; // Receive Buffer Queue Pointer + AT91_REG EMAC_TBQP; // Transmit Buffer Queue Pointer + AT91_REG EMAC_RSR; // Receive Status Register + AT91_REG EMAC_ISR; // Interrupt Status Register + AT91_REG EMAC_IER; // Interrupt Enable Register + AT91_REG EMAC_IDR; // Interrupt Disable Register + AT91_REG EMAC_IMR; // Interrupt Mask Register + AT91_REG EMAC_MAN; // PHY Maintenance Register + AT91_REG EMAC_PTR; // Pause Time Register + AT91_REG EMAC_PFR; // Pause Frames received Register + AT91_REG EMAC_FTO; // Frames Transmitted OK Register + AT91_REG EMAC_SCF; // Single Collision Frame Register + AT91_REG EMAC_MCF; // Multiple Collision Frame Register + AT91_REG EMAC_FRO; // Frames Received OK Register + AT91_REG EMAC_FCSE; // Frame Check Sequence Error Register + AT91_REG EMAC_ALE; // Alignment Error Register + AT91_REG EMAC_DTF; // Deferred Transmission Frame Register + AT91_REG EMAC_LCOL; // Late Collision Register + AT91_REG EMAC_ECOL; // Excessive Collision Register + AT91_REG EMAC_TUND; // Transmit Underrun Error Register + AT91_REG EMAC_CSE; // Carrier Sense Error Register + AT91_REG EMAC_RRE; // Receive Ressource Error Register + AT91_REG EMAC_ROV; // Receive Overrun Errors Register + AT91_REG EMAC_RSE; // Receive Symbol Errors Register + AT91_REG EMAC_ELE; // Excessive Length Errors Register + AT91_REG EMAC_RJA; // Receive Jabbers Register + AT91_REG EMAC_USF; // Undersize Frames Register + AT91_REG EMAC_STE; // SQE Test Error Register + AT91_REG EMAC_RLE; // Receive Length Field Mismatch Register + AT91_REG EMAC_TPF; // Transmitted Pause Frames Register + AT91_REG EMAC_HRB; // Hash Address Bottom[31:0] + AT91_REG EMAC_HRT; // Hash Address Top[63:32] + AT91_REG EMAC_SA1L; // Specific Address 1 Bottom, First 4 bytes + AT91_REG EMAC_SA1H; // Specific Address 1 Top, Last 2 bytes + AT91_REG EMAC_SA2L; // Specific Address 2 Bottom, First 4 bytes + AT91_REG EMAC_SA2H; // Specific Address 2 Top, Last 2 bytes + AT91_REG EMAC_SA3L; // Specific Address 3 Bottom, First 4 bytes + AT91_REG EMAC_SA3H; // Specific Address 3 Top, Last 2 bytes + AT91_REG EMAC_SA4L; // Specific Address 4 Bottom, First 4 bytes + AT91_REG EMAC_SA4H; // Specific Address 4 Top, Last 2 bytes + AT91_REG EMAC_TID; // Type ID Checking Register + AT91_REG EMAC_TPQ; // Transmit Pause Quantum Register + AT91_REG EMAC_USRIO; // USER Input/Output Register + AT91_REG EMAC_WOL; // Wake On LAN Register + AT91_REG Reserved1[13]; // + AT91_REG EMAC_REV; // Revision Register +} AT91S_EMAC, *AT91PS_EMAC; + +// -------- EMAC_NCR : (EMAC Offset: 0x0) -------- +#define AT91C_EMAC_LB ((unsigned int) 0x1 << 0) // (EMAC) Loopback. Optional. When set, loopback signal is at high level. +#define AT91C_EMAC_LLB ((unsigned int) 0x1 << 1) // (EMAC) Loopback local. +#define AT91C_EMAC_RE ((unsigned int) 0x1 << 2) // (EMAC) Receive enable. +#define AT91C_EMAC_TE ((unsigned int) 0x1 << 3) // (EMAC) Transmit enable. +#define AT91C_EMAC_MPE ((unsigned int) 0x1 << 4) // (EMAC) Management port enable. +#define AT91C_EMAC_CLRSTAT ((unsigned int) 0x1 << 5) // (EMAC) Clear statistics registers. +#define AT91C_EMAC_INCSTAT ((unsigned int) 0x1 << 6) // (EMAC) Increment statistics registers. +#define AT91C_EMAC_WESTAT ((unsigned int) 0x1 << 7) // (EMAC) Write enable for statistics registers. +#define AT91C_EMAC_BP ((unsigned int) 0x1 << 8) // (EMAC) Back pressure. +#define AT91C_EMAC_TSTART ((unsigned int) 0x1 << 9) // (EMAC) Start Transmission. +#define AT91C_EMAC_THALT ((unsigned int) 0x1 << 10) // (EMAC) Transmission Halt. +#define AT91C_EMAC_TPFR ((unsigned int) 0x1 << 11) // (EMAC) Transmit pause frame +#define AT91C_EMAC_TZQ ((unsigned int) 0x1 << 12) // (EMAC) Transmit zero quantum pause frame +// -------- EMAC_NCFGR : (EMAC Offset: 0x4) Network Configuration Register -------- +#define AT91C_EMAC_SPD ((unsigned int) 0x1 << 0) // (EMAC) Speed. +#define AT91C_EMAC_FD ((unsigned int) 0x1 << 1) // (EMAC) Full duplex. +#define AT91C_EMAC_JFRAME ((unsigned int) 0x1 << 3) // (EMAC) Jumbo Frames. +#define AT91C_EMAC_CAF ((unsigned int) 0x1 << 4) // (EMAC) Copy all frames. +#define AT91C_EMAC_NBC ((unsigned int) 0x1 << 5) // (EMAC) No broadcast. +#define AT91C_EMAC_MTI ((unsigned int) 0x1 << 6) // (EMAC) Multicast hash event enable +#define AT91C_EMAC_UNI ((unsigned int) 0x1 << 7) // (EMAC) Unicast hash enable. +#define AT91C_EMAC_BIG ((unsigned int) 0x1 << 8) // (EMAC) Receive 1522 bytes. +#define AT91C_EMAC_EAE ((unsigned int) 0x1 << 9) // (EMAC) External address match enable. +#define AT91C_EMAC_CLK ((unsigned int) 0x3 << 10) // (EMAC) +#define AT91C_EMAC_CLK_HCLK_8 ((unsigned int) 0x0 << 10) // (EMAC) HCLK divided by 8 +#define AT91C_EMAC_CLK_HCLK_16 ((unsigned int) 0x1 << 10) // (EMAC) HCLK divided by 16 +#define AT91C_EMAC_CLK_HCLK_32 ((unsigned int) 0x2 << 10) // (EMAC) HCLK divided by 32 +#define AT91C_EMAC_CLK_HCLK_64 ((unsigned int) 0x3 << 10) // (EMAC) HCLK divided by 64 +#define AT91C_EMAC_RTY ((unsigned int) 0x1 << 12) // (EMAC) +#define AT91C_EMAC_PAE ((unsigned int) 0x1 << 13) // (EMAC) +#define AT91C_EMAC_RBOF ((unsigned int) 0x3 << 14) // (EMAC) +#define AT91C_EMAC_RBOF_OFFSET_0 ((unsigned int) 0x0 << 14) // (EMAC) no offset from start of receive buffer +#define AT91C_EMAC_RBOF_OFFSET_1 ((unsigned int) 0x1 << 14) // (EMAC) one byte offset from start of receive buffer +#define AT91C_EMAC_RBOF_OFFSET_2 ((unsigned int) 0x2 << 14) // (EMAC) two bytes offset from start of receive buffer +#define AT91C_EMAC_RBOF_OFFSET_3 ((unsigned int) 0x3 << 14) // (EMAC) three bytes offset from start of receive buffer +#define AT91C_EMAC_RLCE ((unsigned int) 0x1 << 16) // (EMAC) Receive Length field Checking Enable +#define AT91C_EMAC_DRFCS ((unsigned int) 0x1 << 17) // (EMAC) Discard Receive FCS +#define AT91C_EMAC_EFRHD ((unsigned int) 0x1 << 18) // (EMAC) +#define AT91C_EMAC_IRXFCS ((unsigned int) 0x1 << 19) // (EMAC) Ignore RX FCS +// -------- EMAC_NSR : (EMAC Offset: 0x8) Network Status Register -------- +#define AT91C_EMAC_LINKR ((unsigned int) 0x1 << 0) // (EMAC) +#define AT91C_EMAC_MDIO ((unsigned int) 0x1 << 1) // (EMAC) +#define AT91C_EMAC_IDLE ((unsigned int) 0x1 << 2) // (EMAC) +// -------- EMAC_TSR : (EMAC Offset: 0x14) Transmit Status Register -------- +#define AT91C_EMAC_UBR ((unsigned int) 0x1 << 0) // (EMAC) +#define AT91C_EMAC_COL ((unsigned int) 0x1 << 1) // (EMAC) +#define AT91C_EMAC_RLES ((unsigned int) 0x1 << 2) // (EMAC) +#define AT91C_EMAC_TGO ((unsigned int) 0x1 << 3) // (EMAC) Transmit Go +#define AT91C_EMAC_BEX ((unsigned int) 0x1 << 4) // (EMAC) Buffers exhausted mid frame +#define AT91C_EMAC_COMP ((unsigned int) 0x1 << 5) // (EMAC) +#define AT91C_EMAC_UND ((unsigned int) 0x1 << 6) // (EMAC) +// -------- EMAC_RSR : (EMAC Offset: 0x20) Receive Status Register -------- +#define AT91C_EMAC_BNA ((unsigned int) 0x1 << 0) // (EMAC) +#define AT91C_EMAC_REC ((unsigned int) 0x1 << 1) // (EMAC) +#define AT91C_EMAC_OVR ((unsigned int) 0x1 << 2) // (EMAC) +// -------- EMAC_ISR : (EMAC Offset: 0x24) Interrupt Status Register -------- +#define AT91C_EMAC_MFD ((unsigned int) 0x1 << 0) // (EMAC) +#define AT91C_EMAC_RCOMP ((unsigned int) 0x1 << 1) // (EMAC) +#define AT91C_EMAC_RXUBR ((unsigned int) 0x1 << 2) // (EMAC) +#define AT91C_EMAC_TXUBR ((unsigned int) 0x1 << 3) // (EMAC) +#define AT91C_EMAC_TUNDR ((unsigned int) 0x1 << 4) // (EMAC) +#define AT91C_EMAC_RLEX ((unsigned int) 0x1 << 5) // (EMAC) +#define AT91C_EMAC_TXERR ((unsigned int) 0x1 << 6) // (EMAC) +#define AT91C_EMAC_TCOMP ((unsigned int) 0x1 << 7) // (EMAC) +#define AT91C_EMAC_LINK ((unsigned int) 0x1 << 9) // (EMAC) +#define AT91C_EMAC_ROVR ((unsigned int) 0x1 << 10) // (EMAC) +#define AT91C_EMAC_HRESP ((unsigned int) 0x1 << 11) // (EMAC) +#define AT91C_EMAC_PFRE ((unsigned int) 0x1 << 12) // (EMAC) +#define AT91C_EMAC_PTZ ((unsigned int) 0x1 << 13) // (EMAC) +// -------- EMAC_IER : (EMAC Offset: 0x28) Interrupt Enable Register -------- +// -------- EMAC_IDR : (EMAC Offset: 0x2c) Interrupt Disable Register -------- +// -------- EMAC_IMR : (EMAC Offset: 0x30) Interrupt Mask Register -------- +// -------- EMAC_MAN : (EMAC Offset: 0x34) PHY Maintenance Register -------- +#define AT91C_EMAC_DATA ((unsigned int) 0xFFFF << 0) // (EMAC) +#define AT91C_EMAC_CODE ((unsigned int) 0x3 << 16) // (EMAC) +#define AT91C_EMAC_REGA ((unsigned int) 0x1F << 18) // (EMAC) +#define AT91C_EMAC_PHYA ((unsigned int) 0x1F << 23) // (EMAC) +#define AT91C_EMAC_RW ((unsigned int) 0x3 << 28) // (EMAC) +#define AT91C_EMAC_SOF ((unsigned int) 0x3 << 30) // (EMAC) +// -------- EMAC_USRIO : (EMAC Offset: 0xc0) USER Input Output Register -------- +#define AT91C_EMAC_RMII ((unsigned int) 0x1 << 0) // (EMAC) Reduce MII +#define AT91C_EMAC_CLKEN ((unsigned int) 0x1 << 1) // (EMAC) Clock Enable +// -------- EMAC_WOL : (EMAC Offset: 0xc4) Wake On LAN Register -------- +#define AT91C_EMAC_IP ((unsigned int) 0xFFFF << 0) // (EMAC) ARP request IP address +#define AT91C_EMAC_MAG ((unsigned int) 0x1 << 16) // (EMAC) Magic packet event enable +#define AT91C_EMAC_ARP ((unsigned int) 0x1 << 17) // (EMAC) ARP request event enable +#define AT91C_EMAC_SA1 ((unsigned int) 0x1 << 18) // (EMAC) Specific address register 1 event enable +// -------- EMAC_REV : (EMAC Offset: 0xfc) Revision Register -------- +#define AT91C_EMAC_REVREF ((unsigned int) 0xFFFF << 0) // (EMAC) +#define AT91C_EMAC_PARTREF ((unsigned int) 0xFFFF << 16) // (EMAC) + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Analog to Digital Convertor +// ***************************************************************************** +typedef struct _AT91S_ADC { + AT91_REG ADC_CR; // ADC Control Register + AT91_REG ADC_MR; // ADC Mode Register + AT91_REG Reserved0[2]; // + AT91_REG ADC_CHER; // ADC Channel Enable Register + AT91_REG ADC_CHDR; // ADC Channel Disable Register + AT91_REG ADC_CHSR; // ADC Channel Status Register + AT91_REG ADC_SR; // ADC Status Register + AT91_REG ADC_LCDR; // ADC Last Converted Data Register + AT91_REG ADC_IER; // ADC Interrupt Enable Register + AT91_REG ADC_IDR; // ADC Interrupt Disable Register + AT91_REG ADC_IMR; // ADC Interrupt Mask Register + AT91_REG ADC_CDR0; // ADC Channel Data Register 0 + AT91_REG ADC_CDR1; // ADC Channel Data Register 1 + AT91_REG ADC_CDR2; // ADC Channel Data Register 2 + AT91_REG ADC_CDR3; // ADC Channel Data Register 3 + AT91_REG ADC_CDR4; // ADC Channel Data Register 4 + AT91_REG ADC_CDR5; // ADC Channel Data Register 5 + AT91_REG ADC_CDR6; // ADC Channel Data Register 6 + AT91_REG ADC_CDR7; // ADC Channel Data Register 7 + AT91_REG Reserved1[44]; // + AT91_REG ADC_RPR; // Receive Pointer Register + AT91_REG ADC_RCR; // Receive Counter Register + AT91_REG ADC_TPR; // Transmit Pointer Register + AT91_REG ADC_TCR; // Transmit Counter Register + AT91_REG ADC_RNPR; // Receive Next Pointer Register + AT91_REG ADC_RNCR; // Receive Next Counter Register + AT91_REG ADC_TNPR; // Transmit Next Pointer Register + AT91_REG ADC_TNCR; // Transmit Next Counter Register + AT91_REG ADC_PTCR; // PDC Transfer Control Register + AT91_REG ADC_PTSR; // PDC Transfer Status Register +} AT91S_ADC, *AT91PS_ADC; + +// -------- ADC_CR : (ADC Offset: 0x0) ADC Control Register -------- +#define AT91C_ADC_SWRST ((unsigned int) 0x1 << 0) // (ADC) Software Reset +#define AT91C_ADC_START ((unsigned int) 0x1 << 1) // (ADC) Start Conversion +// -------- ADC_MR : (ADC Offset: 0x4) ADC Mode Register -------- +#define AT91C_ADC_TRGEN ((unsigned int) 0x1 << 0) // (ADC) Trigger Enable +#define AT91C_ADC_TRGEN_DIS ((unsigned int) 0x0) // (ADC) Hradware triggers are disabled. Starting a conversion is only possible by software +#define AT91C_ADC_TRGEN_EN ((unsigned int) 0x1) // (ADC) Hardware trigger selected by TRGSEL field is enabled. +#define AT91C_ADC_TRGSEL ((unsigned int) 0x7 << 1) // (ADC) Trigger Selection +#define AT91C_ADC_TRGSEL_TIOA0 ((unsigned int) 0x0 << 1) // (ADC) Selected TRGSEL = TIAO0 +#define AT91C_ADC_TRGSEL_TIOA1 ((unsigned int) 0x1 << 1) // (ADC) Selected TRGSEL = TIAO1 +#define AT91C_ADC_TRGSEL_TIOA2 ((unsigned int) 0x2 << 1) // (ADC) Selected TRGSEL = TIAO2 +#define AT91C_ADC_TRGSEL_TIOA3 ((unsigned int) 0x3 << 1) // (ADC) Selected TRGSEL = TIAO3 +#define AT91C_ADC_TRGSEL_TIOA4 ((unsigned int) 0x4 << 1) // (ADC) Selected TRGSEL = TIAO4 +#define AT91C_ADC_TRGSEL_TIOA5 ((unsigned int) 0x5 << 1) // (ADC) Selected TRGSEL = TIAO5 +#define AT91C_ADC_TRGSEL_EXT ((unsigned int) 0x6 << 1) // (ADC) Selected TRGSEL = External Trigger +#define AT91C_ADC_LOWRES ((unsigned int) 0x1 << 4) // (ADC) Resolution. +#define AT91C_ADC_LOWRES_10_BIT ((unsigned int) 0x0 << 4) // (ADC) 10-bit resolution +#define AT91C_ADC_LOWRES_8_BIT ((unsigned int) 0x1 << 4) // (ADC) 8-bit resolution +#define AT91C_ADC_SLEEP ((unsigned int) 0x1 << 5) // (ADC) Sleep Mode +#define AT91C_ADC_SLEEP_NORMAL_MODE ((unsigned int) 0x0 << 5) // (ADC) Normal Mode +#define AT91C_ADC_SLEEP_MODE ((unsigned int) 0x1 << 5) // (ADC) Sleep Mode +#define AT91C_ADC_PRESCAL ((unsigned int) 0x3F << 8) // (ADC) Prescaler rate selection +#define AT91C_ADC_STARTUP ((unsigned int) 0x1F << 16) // (ADC) Startup Time +#define AT91C_ADC_SHTIM ((unsigned int) 0xF << 24) // (ADC) Sample & Hold Time +// -------- ADC_CHER : (ADC Offset: 0x10) ADC Channel Enable Register -------- +#define AT91C_ADC_CH0 ((unsigned int) 0x1 << 0) // (ADC) Channel 0 +#define AT91C_ADC_CH1 ((unsigned int) 0x1 << 1) // (ADC) Channel 1 +#define AT91C_ADC_CH2 ((unsigned int) 0x1 << 2) // (ADC) Channel 2 +#define AT91C_ADC_CH3 ((unsigned int) 0x1 << 3) // (ADC) Channel 3 +#define AT91C_ADC_CH4 ((unsigned int) 0x1 << 4) // (ADC) Channel 4 +#define AT91C_ADC_CH5 ((unsigned int) 0x1 << 5) // (ADC) Channel 5 +#define AT91C_ADC_CH6 ((unsigned int) 0x1 << 6) // (ADC) Channel 6 +#define AT91C_ADC_CH7 ((unsigned int) 0x1 << 7) // (ADC) Channel 7 +// -------- ADC_CHDR : (ADC Offset: 0x14) ADC Channel Disable Register -------- +// -------- ADC_CHSR : (ADC Offset: 0x18) ADC Channel Status Register -------- +// -------- ADC_SR : (ADC Offset: 0x1c) ADC Status Register -------- +#define AT91C_ADC_EOC0 ((unsigned int) 0x1 << 0) // (ADC) End of Conversion +#define AT91C_ADC_EOC1 ((unsigned int) 0x1 << 1) // (ADC) End of Conversion +#define AT91C_ADC_EOC2 ((unsigned int) 0x1 << 2) // (ADC) End of Conversion +#define AT91C_ADC_EOC3 ((unsigned int) 0x1 << 3) // (ADC) End of Conversion +#define AT91C_ADC_EOC4 ((unsigned int) 0x1 << 4) // (ADC) End of Conversion +#define AT91C_ADC_EOC5 ((unsigned int) 0x1 << 5) // (ADC) End of Conversion +#define AT91C_ADC_EOC6 ((unsigned int) 0x1 << 6) // (ADC) End of Conversion +#define AT91C_ADC_EOC7 ((unsigned int) 0x1 << 7) // (ADC) End of Conversion +#define AT91C_ADC_OVRE0 ((unsigned int) 0x1 << 8) // (ADC) Overrun Error +#define AT91C_ADC_OVRE1 ((unsigned int) 0x1 << 9) // (ADC) Overrun Error +#define AT91C_ADC_OVRE2 ((unsigned int) 0x1 << 10) // (ADC) Overrun Error +#define AT91C_ADC_OVRE3 ((unsigned int) 0x1 << 11) // (ADC) Overrun Error +#define AT91C_ADC_OVRE4 ((unsigned int) 0x1 << 12) // (ADC) Overrun Error +#define AT91C_ADC_OVRE5 ((unsigned int) 0x1 << 13) // (ADC) Overrun Error +#define AT91C_ADC_OVRE6 ((unsigned int) 0x1 << 14) // (ADC) Overrun Error +#define AT91C_ADC_OVRE7 ((unsigned int) 0x1 << 15) // (ADC) Overrun Error +#define AT91C_ADC_DRDY ((unsigned int) 0x1 << 16) // (ADC) Data Ready +#define AT91C_ADC_GOVRE ((unsigned int) 0x1 << 17) // (ADC) General Overrun +#define AT91C_ADC_ENDRX ((unsigned int) 0x1 << 18) // (ADC) End of Receiver Transfer +#define AT91C_ADC_RXBUFF ((unsigned int) 0x1 << 19) // (ADC) RXBUFF Interrupt +// -------- ADC_LCDR : (ADC Offset: 0x20) ADC Last Converted Data Register -------- +#define AT91C_ADC_LDATA ((unsigned int) 0x3FF << 0) // (ADC) Last Data Converted +// -------- ADC_IER : (ADC Offset: 0x24) ADC Interrupt Enable Register -------- +// -------- ADC_IDR : (ADC Offset: 0x28) ADC Interrupt Disable Register -------- +// -------- ADC_IMR : (ADC Offset: 0x2c) ADC Interrupt Mask Register -------- +// -------- ADC_CDR0 : (ADC Offset: 0x30) ADC Channel Data Register 0 -------- +#define AT91C_ADC_DATA ((unsigned int) 0x3FF << 0) // (ADC) Converted Data +// -------- ADC_CDR1 : (ADC Offset: 0x34) ADC Channel Data Register 1 -------- +// -------- ADC_CDR2 : (ADC Offset: 0x38) ADC Channel Data Register 2 -------- +// -------- ADC_CDR3 : (ADC Offset: 0x3c) ADC Channel Data Register 3 -------- +// -------- ADC_CDR4 : (ADC Offset: 0x40) ADC Channel Data Register 4 -------- +// -------- ADC_CDR5 : (ADC Offset: 0x44) ADC Channel Data Register 5 -------- +// -------- ADC_CDR6 : (ADC Offset: 0x48) ADC Channel Data Register 6 -------- +// -------- ADC_CDR7 : (ADC Offset: 0x4c) ADC Channel Data Register 7 -------- + +// ***************************************************************************** +// REGISTER ADDRESS DEFINITION FOR AT91SAM7X256 +// ***************************************************************************** +// ========== Register definition for SYS peripheral ========== +// ========== Register definition for AIC peripheral ========== +#define AT91C_AIC_IVR ((AT91_REG *) 0xFFFFF100) // (AIC) IRQ Vector Register +#define AT91C_AIC_SMR ((AT91_REG *) 0xFFFFF000) // (AIC) Source Mode Register +#define AT91C_AIC_FVR ((AT91_REG *) 0xFFFFF104) // (AIC) FIQ Vector Register +#define AT91C_AIC_DCR ((AT91_REG *) 0xFFFFF138) // (AIC) Debug Control Register (Protect) +#define AT91C_AIC_EOICR ((AT91_REG *) 0xFFFFF130) // (AIC) End of Interrupt Command Register +#define AT91C_AIC_SVR ((AT91_REG *) 0xFFFFF080) // (AIC) Source Vector Register +#define AT91C_AIC_FFSR ((AT91_REG *) 0xFFFFF148) // (AIC) Fast Forcing Status Register +#define AT91C_AIC_ICCR ((AT91_REG *) 0xFFFFF128) // (AIC) Interrupt Clear Command Register +#define AT91C_AIC_ISR ((AT91_REG *) 0xFFFFF108) // (AIC) Interrupt Status Register +#define AT91C_AIC_IMR ((AT91_REG *) 0xFFFFF110) // (AIC) Interrupt Mask Register +#define AT91C_AIC_IPR ((AT91_REG *) 0xFFFFF10C) // (AIC) Interrupt Pending Register +#define AT91C_AIC_FFER ((AT91_REG *) 0xFFFFF140) // (AIC) Fast Forcing Enable Register +#define AT91C_AIC_IECR ((AT91_REG *) 0xFFFFF120) // (AIC) Interrupt Enable Command Register +#define AT91C_AIC_ISCR ((AT91_REG *) 0xFFFFF12C) // (AIC) Interrupt Set Command Register +#define AT91C_AIC_FFDR ((AT91_REG *) 0xFFFFF144) // (AIC) Fast Forcing Disable Register +#define AT91C_AIC_CISR ((AT91_REG *) 0xFFFFF114) // (AIC) Core Interrupt Status Register +#define AT91C_AIC_IDCR ((AT91_REG *) 0xFFFFF124) // (AIC) Interrupt Disable Command Register +#define AT91C_AIC_SPU ((AT91_REG *) 0xFFFFF134) // (AIC) Spurious Vector Register +// ========== Register definition for PDC_DBGU peripheral ========== +#define AT91C_DBGU_TCR ((AT91_REG *) 0xFFFFF30C) // (PDC_DBGU) Transmit Counter Register +#define AT91C_DBGU_RNPR ((AT91_REG *) 0xFFFFF310) // (PDC_DBGU) Receive Next Pointer Register +#define AT91C_DBGU_TNPR ((AT91_REG *) 0xFFFFF318) // (PDC_DBGU) Transmit Next Pointer Register +#define AT91C_DBGU_TPR ((AT91_REG *) 0xFFFFF308) // (PDC_DBGU) Transmit Pointer Register +#define AT91C_DBGU_RPR ((AT91_REG *) 0xFFFFF300) // (PDC_DBGU) Receive Pointer Register +#define AT91C_DBGU_RCR ((AT91_REG *) 0xFFFFF304) // (PDC_DBGU) Receive Counter Register +#define AT91C_DBGU_RNCR ((AT91_REG *) 0xFFFFF314) // (PDC_DBGU) Receive Next Counter Register +#define AT91C_DBGU_PTCR ((AT91_REG *) 0xFFFFF320) // (PDC_DBGU) PDC Transfer Control Register +#define AT91C_DBGU_PTSR ((AT91_REG *) 0xFFFFF324) // (PDC_DBGU) PDC Transfer Status Register +#define AT91C_DBGU_TNCR ((AT91_REG *) 0xFFFFF31C) // (PDC_DBGU) Transmit Next Counter Register +// ========== Register definition for DBGU peripheral ========== +#define AT91C_DBGU_EXID ((AT91_REG *) 0xFFFFF244) // (DBGU) Chip ID Extension Register +#define AT91C_DBGU_BRGR ((AT91_REG *) 0xFFFFF220) // (DBGU) Baud Rate Generator Register +#define AT91C_DBGU_IDR ((AT91_REG *) 0xFFFFF20C) // (DBGU) Interrupt Disable Register +#define AT91C_DBGU_CSR ((AT91_REG *) 0xFFFFF214) // (DBGU) Channel Status Register +#define AT91C_DBGU_CIDR ((AT91_REG *) 0xFFFFF240) // (DBGU) Chip ID Register +#define AT91C_DBGU_MR ((AT91_REG *) 0xFFFFF204) // (DBGU) Mode Register +#define AT91C_DBGU_IMR ((AT91_REG *) 0xFFFFF210) // (DBGU) Interrupt Mask Register +#define AT91C_DBGU_CR ((AT91_REG *) 0xFFFFF200) // (DBGU) Control Register +#define AT91C_DBGU_FNTR ((AT91_REG *) 0xFFFFF248) // (DBGU) Force NTRST Register +#define AT91C_DBGU_THR ((AT91_REG *) 0xFFFFF21C) // (DBGU) Transmitter Holding Register +#define AT91C_DBGU_RHR ((AT91_REG *) 0xFFFFF218) // (DBGU) Receiver Holding Register +#define AT91C_DBGU_IER ((AT91_REG *) 0xFFFFF208) // (DBGU) Interrupt Enable Register +// ========== Register definition for PIOA peripheral ========== +#define AT91C_PIOA_ODR ((AT91_REG *) 0xFFFFF414) // (PIOA) Output Disable Registerr +#define AT91C_PIOA_SODR ((AT91_REG *) 0xFFFFF430) // (PIOA) Set Output Data Register +#define AT91C_PIOA_ISR ((AT91_REG *) 0xFFFFF44C) // (PIOA) Interrupt Status Register +#define AT91C_PIOA_ABSR ((AT91_REG *) 0xFFFFF478) // (PIOA) AB Select Status Register +#define AT91C_PIOA_IER ((AT91_REG *) 0xFFFFF440) // (PIOA) Interrupt Enable Register +#define AT91C_PIOA_PPUDR ((AT91_REG *) 0xFFFFF460) // (PIOA) Pull-up Disable Register +#define AT91C_PIOA_IMR ((AT91_REG *) 0xFFFFF448) // (PIOA) Interrupt Mask Register +#define AT91C_PIOA_PER ((AT91_REG *) 0xFFFFF400) // (PIOA) PIO Enable Register +#define AT91C_PIOA_IFDR ((AT91_REG *) 0xFFFFF424) // (PIOA) Input Filter Disable Register +#define AT91C_PIOA_OWDR ((AT91_REG *) 0xFFFFF4A4) // (PIOA) Output Write Disable Register +#define AT91C_PIOA_MDSR ((AT91_REG *) 0xFFFFF458) // (PIOA) Multi-driver Status Register +#define AT91C_PIOA_IDR ((AT91_REG *) 0xFFFFF444) // (PIOA) Interrupt Disable Register +#define AT91C_PIOA_ODSR ((AT91_REG *) 0xFFFFF438) // (PIOA) Output Data Status Register +#define AT91C_PIOA_PPUSR ((AT91_REG *) 0xFFFFF468) // (PIOA) Pull-up Status Register +#define AT91C_PIOA_OWSR ((AT91_REG *) 0xFFFFF4A8) // (PIOA) Output Write Status Register +#define AT91C_PIOA_BSR ((AT91_REG *) 0xFFFFF474) // (PIOA) Select B Register +#define AT91C_PIOA_OWER ((AT91_REG *) 0xFFFFF4A0) // (PIOA) Output Write Enable Register +#define AT91C_PIOA_IFER ((AT91_REG *) 0xFFFFF420) // (PIOA) Input Filter Enable Register +#define AT91C_PIOA_PDSR ((AT91_REG *) 0xFFFFF43C) // (PIOA) Pin Data Status Register +#define AT91C_PIOA_PPUER ((AT91_REG *) 0xFFFFF464) // (PIOA) Pull-up Enable Register +#define AT91C_PIOA_OSR ((AT91_REG *) 0xFFFFF418) // (PIOA) Output Status Register +#define AT91C_PIOA_ASR ((AT91_REG *) 0xFFFFF470) // (PIOA) Select A Register +#define AT91C_PIOA_MDDR ((AT91_REG *) 0xFFFFF454) // (PIOA) Multi-driver Disable Register +#define AT91C_PIOA_CODR ((AT91_REG *) 0xFFFFF434) // (PIOA) Clear Output Data Register +#define AT91C_PIOA_MDER ((AT91_REG *) 0xFFFFF450) // (PIOA) Multi-driver Enable Register +#define AT91C_PIOA_PDR ((AT91_REG *) 0xFFFFF404) // (PIOA) PIO Disable Register +#define AT91C_PIOA_IFSR ((AT91_REG *) 0xFFFFF428) // (PIOA) Input Filter Status Register +#define AT91C_PIOA_OER ((AT91_REG *) 0xFFFFF410) // (PIOA) Output Enable Register +#define AT91C_PIOA_PSR ((AT91_REG *) 0xFFFFF408) // (PIOA) PIO Status Register +// ========== Register definition for PIOB peripheral ========== +#define AT91C_PIOB_OWDR ((AT91_REG *) 0xFFFFF6A4) // (PIOB) Output Write Disable Register +#define AT91C_PIOB_MDER ((AT91_REG *) 0xFFFFF650) // (PIOB) Multi-driver Enable Register +#define AT91C_PIOB_PPUSR ((AT91_REG *) 0xFFFFF668) // (PIOB) Pull-up Status Register +#define AT91C_PIOB_IMR ((AT91_REG *) 0xFFFFF648) // (PIOB) Interrupt Mask Register +#define AT91C_PIOB_ASR ((AT91_REG *) 0xFFFFF670) // (PIOB) Select A Register +#define AT91C_PIOB_PPUDR ((AT91_REG *) 0xFFFFF660) // (PIOB) Pull-up Disable Register +#define AT91C_PIOB_PSR ((AT91_REG *) 0xFFFFF608) // (PIOB) PIO Status Register +#define AT91C_PIOB_IER ((AT91_REG *) 0xFFFFF640) // (PIOB) Interrupt Enable Register +#define AT91C_PIOB_CODR ((AT91_REG *) 0xFFFFF634) // (PIOB) Clear Output Data Register +#define AT91C_PIOB_OWER ((AT91_REG *) 0xFFFFF6A0) // (PIOB) Output Write Enable Register +#define AT91C_PIOB_ABSR ((AT91_REG *) 0xFFFFF678) // (PIOB) AB Select Status Register +#define AT91C_PIOB_IFDR ((AT91_REG *) 0xFFFFF624) // (PIOB) Input Filter Disable Register +#define AT91C_PIOB_PDSR ((AT91_REG *) 0xFFFFF63C) // (PIOB) Pin Data Status Register +#define AT91C_PIOB_IDR ((AT91_REG *) 0xFFFFF644) // (PIOB) Interrupt Disable Register +#define AT91C_PIOB_OWSR ((AT91_REG *) 0xFFFFF6A8) // (PIOB) Output Write Status Register +#define AT91C_PIOB_PDR ((AT91_REG *) 0xFFFFF604) // (PIOB) PIO Disable Register +#define AT91C_PIOB_ODR ((AT91_REG *) 0xFFFFF614) // (PIOB) Output Disable Registerr +#define AT91C_PIOB_IFSR ((AT91_REG *) 0xFFFFF628) // (PIOB) Input Filter Status Register +#define AT91C_PIOB_PPUER ((AT91_REG *) 0xFFFFF664) // (PIOB) Pull-up Enable Register +#define AT91C_PIOB_SODR ((AT91_REG *) 0xFFFFF630) // (PIOB) Set Output Data Register +#define AT91C_PIOB_ISR ((AT91_REG *) 0xFFFFF64C) // (PIOB) Interrupt Status Register +#define AT91C_PIOB_ODSR ((AT91_REG *) 0xFFFFF638) // (PIOB) Output Data Status Register +#define AT91C_PIOB_OSR ((AT91_REG *) 0xFFFFF618) // (PIOB) Output Status Register +#define AT91C_PIOB_MDSR ((AT91_REG *) 0xFFFFF658) // (PIOB) Multi-driver Status Register +#define AT91C_PIOB_IFER ((AT91_REG *) 0xFFFFF620) // (PIOB) Input Filter Enable Register +#define AT91C_PIOB_BSR ((AT91_REG *) 0xFFFFF674) // (PIOB) Select B Register +#define AT91C_PIOB_MDDR ((AT91_REG *) 0xFFFFF654) // (PIOB) Multi-driver Disable Register +#define AT91C_PIOB_OER ((AT91_REG *) 0xFFFFF610) // (PIOB) Output Enable Register +#define AT91C_PIOB_PER ((AT91_REG *) 0xFFFFF600) // (PIOB) PIO Enable Register +// ========== Register definition for CKGR peripheral ========== +#define AT91C_CKGR_MOR ((AT91_REG *) 0xFFFFFC20) // (CKGR) Main Oscillator Register +#define AT91C_CKGR_PLLR ((AT91_REG *) 0xFFFFFC2C) // (CKGR) PLL Register +#define AT91C_CKGR_MCFR ((AT91_REG *) 0xFFFFFC24) // (CKGR) Main Clock Frequency Register +// ========== Register definition for PMC peripheral ========== +#define AT91C_PMC_IDR ((AT91_REG *) 0xFFFFFC64) // (PMC) Interrupt Disable Register +#define AT91C_PMC_MOR ((AT91_REG *) 0xFFFFFC20) // (PMC) Main Oscillator Register +#define AT91C_PMC_PLLR ((AT91_REG *) 0xFFFFFC2C) // (PMC) PLL Register +#define AT91C_PMC_PCER ((AT91_REG *) 0xFFFFFC10) // (PMC) Peripheral Clock Enable Register +#define AT91C_PMC_PCKR ((AT91_REG *) 0xFFFFFC40) // (PMC) Programmable Clock Register +#define AT91C_PMC_MCKR ((AT91_REG *) 0xFFFFFC30) // (PMC) Master Clock Register +#define AT91C_PMC_SCDR ((AT91_REG *) 0xFFFFFC04) // (PMC) System Clock Disable Register +#define AT91C_PMC_PCDR ((AT91_REG *) 0xFFFFFC14) // (PMC) Peripheral Clock Disable Register +#define AT91C_PMC_SCSR ((AT91_REG *) 0xFFFFFC08) // (PMC) System Clock Status Register +#define AT91C_PMC_PCSR ((AT91_REG *) 0xFFFFFC18) // (PMC) Peripheral Clock Status Register +#define AT91C_PMC_MCFR ((AT91_REG *) 0xFFFFFC24) // (PMC) Main Clock Frequency Register +#define AT91C_PMC_SCER ((AT91_REG *) 0xFFFFFC00) // (PMC) System Clock Enable Register +#define AT91C_PMC_IMR ((AT91_REG *) 0xFFFFFC6C) // (PMC) Interrupt Mask Register +#define AT91C_PMC_IER ((AT91_REG *) 0xFFFFFC60) // (PMC) Interrupt Enable Register +#define AT91C_PMC_SR ((AT91_REG *) 0xFFFFFC68) // (PMC) Status Register +// ========== Register definition for RSTC peripheral ========== +#define AT91C_RSTC_RCR ((AT91_REG *) 0xFFFFFD00) // (RSTC) Reset Control Register +#define AT91C_RSTC_RMR ((AT91_REG *) 0xFFFFFD08) // (RSTC) Reset Mode Register +#define AT91C_RSTC_RSR ((AT91_REG *) 0xFFFFFD04) // (RSTC) Reset Status Register +// ========== Register definition for RTTC peripheral ========== +#define AT91C_RTTC_RTSR ((AT91_REG *) 0xFFFFFD2C) // (RTTC) Real-time Status Register +#define AT91C_RTTC_RTMR ((AT91_REG *) 0xFFFFFD20) // (RTTC) Real-time Mode Register +#define AT91C_RTTC_RTVR ((AT91_REG *) 0xFFFFFD28) // (RTTC) Real-time Value Register +#define AT91C_RTTC_RTAR ((AT91_REG *) 0xFFFFFD24) // (RTTC) Real-time Alarm Register +// ========== Register definition for PITC peripheral ========== +#define AT91C_PITC_PIVR ((AT91_REG *) 0xFFFFFD38) // (PITC) Period Interval Value Register +#define AT91C_PITC_PISR ((AT91_REG *) 0xFFFFFD34) // (PITC) Period Interval Status Register +#define AT91C_PITC_PIIR ((AT91_REG *) 0xFFFFFD3C) // (PITC) Period Interval Image Register +#define AT91C_PITC_PIMR ((AT91_REG *) 0xFFFFFD30) // (PITC) Period Interval Mode Register +// ========== Register definition for WDTC peripheral ========== +#define AT91C_WDTC_WDCR ((AT91_REG *) 0xFFFFFD40) // (WDTC) Watchdog Control Register +#define AT91C_WDTC_WDSR ((AT91_REG *) 0xFFFFFD48) // (WDTC) Watchdog Status Register +#define AT91C_WDTC_WDMR ((AT91_REG *) 0xFFFFFD44) // (WDTC) Watchdog Mode Register +// ========== Register definition for VREG peripheral ========== +#define AT91C_VREG_MR ((AT91_REG *) 0xFFFFFD60) // (VREG) Voltage Regulator Mode Register +// ========== Register definition for MC peripheral ========== +#define AT91C_MC_ASR ((AT91_REG *) 0xFFFFFF04) // (MC) MC Abort Status Register +#define AT91C_MC_RCR ((AT91_REG *) 0xFFFFFF00) // (MC) MC Remap Control Register +#define AT91C_MC_FCR ((AT91_REG *) 0xFFFFFF64) // (MC) MC Flash Command Register +#define AT91C_MC_AASR ((AT91_REG *) 0xFFFFFF08) // (MC) MC Abort Address Status Register +#define AT91C_MC_FSR ((AT91_REG *) 0xFFFFFF68) // (MC) MC Flash Status Register +#define AT91C_MC_FMR ((AT91_REG *) 0xFFFFFF60) // (MC) MC Flash Mode Register +// ========== Register definition for PDC_SPI1 peripheral ========== +#define AT91C_SPI1_PTCR ((AT91_REG *) 0xFFFE4120) // (PDC_SPI1) PDC Transfer Control Register +#define AT91C_SPI1_RPR ((AT91_REG *) 0xFFFE4100) // (PDC_SPI1) Receive Pointer Register +#define AT91C_SPI1_TNCR ((AT91_REG *) 0xFFFE411C) // (PDC_SPI1) Transmit Next Counter Register +#define AT91C_SPI1_TPR ((AT91_REG *) 0xFFFE4108) // (PDC_SPI1) Transmit Pointer Register +#define AT91C_SPI1_TNPR ((AT91_REG *) 0xFFFE4118) // (PDC_SPI1) Transmit Next Pointer Register +#define AT91C_SPI1_TCR ((AT91_REG *) 0xFFFE410C) // (PDC_SPI1) Transmit Counter Register +#define AT91C_SPI1_RCR ((AT91_REG *) 0xFFFE4104) // (PDC_SPI1) Receive Counter Register +#define AT91C_SPI1_RNPR ((AT91_REG *) 0xFFFE4110) // (PDC_SPI1) Receive Next Pointer Register +#define AT91C_SPI1_RNCR ((AT91_REG *) 0xFFFE4114) // (PDC_SPI1) Receive Next Counter Register +#define AT91C_SPI1_PTSR ((AT91_REG *) 0xFFFE4124) // (PDC_SPI1) PDC Transfer Status Register +// ========== Register definition for SPI1 peripheral ========== +#define AT91C_SPI1_IMR ((AT91_REG *) 0xFFFE401C) // (SPI1) Interrupt Mask Register +#define AT91C_SPI1_IER ((AT91_REG *) 0xFFFE4014) // (SPI1) Interrupt Enable Register +#define AT91C_SPI1_MR ((AT91_REG *) 0xFFFE4004) // (SPI1) Mode Register +#define AT91C_SPI1_RDR ((AT91_REG *) 0xFFFE4008) // (SPI1) Receive Data Register +#define AT91C_SPI1_IDR ((AT91_REG *) 0xFFFE4018) // (SPI1) Interrupt Disable Register +#define AT91C_SPI1_SR ((AT91_REG *) 0xFFFE4010) // (SPI1) Status Register +#define AT91C_SPI1_TDR ((AT91_REG *) 0xFFFE400C) // (SPI1) Transmit Data Register +#define AT91C_SPI1_CR ((AT91_REG *) 0xFFFE4000) // (SPI1) Control Register +#define AT91C_SPI1_CSR ((AT91_REG *) 0xFFFE4030) // (SPI1) Chip Select Register +// ========== Register definition for PDC_SPI0 peripheral ========== +#define AT91C_SPI0_PTCR ((AT91_REG *) 0xFFFE0120) // (PDC_SPI0) PDC Transfer Control Register +#define AT91C_SPI0_TPR ((AT91_REG *) 0xFFFE0108) // (PDC_SPI0) Transmit Pointer Register +#define AT91C_SPI0_TCR ((AT91_REG *) 0xFFFE010C) // (PDC_SPI0) Transmit Counter Register +#define AT91C_SPI0_RCR ((AT91_REG *) 0xFFFE0104) // (PDC_SPI0) Receive Counter Register +#define AT91C_SPI0_PTSR ((AT91_REG *) 0xFFFE0124) // (PDC_SPI0) PDC Transfer Status Register +#define AT91C_SPI0_RNPR ((AT91_REG *) 0xFFFE0110) // (PDC_SPI0) Receive Next Pointer Register +#define AT91C_SPI0_RPR ((AT91_REG *) 0xFFFE0100) // (PDC_SPI0) Receive Pointer Register +#define AT91C_SPI0_TNCR ((AT91_REG *) 0xFFFE011C) // (PDC_SPI0) Transmit Next Counter Register +#define AT91C_SPI0_RNCR ((AT91_REG *) 0xFFFE0114) // (PDC_SPI0) Receive Next Counter Register +#define AT91C_SPI0_TNPR ((AT91_REG *) 0xFFFE0118) // (PDC_SPI0) Transmit Next Pointer Register +// ========== Register definition for SPI0 peripheral ========== +#define AT91C_SPI0_IER ((AT91_REG *) 0xFFFE0014) // (SPI0) Interrupt Enable Register +#define AT91C_SPI0_SR ((AT91_REG *) 0xFFFE0010) // (SPI0) Status Register +#define AT91C_SPI0_IDR ((AT91_REG *) 0xFFFE0018) // (SPI0) Interrupt Disable Register +#define AT91C_SPI0_CR ((AT91_REG *) 0xFFFE0000) // (SPI0) Control Register +#define AT91C_SPI0_MR ((AT91_REG *) 0xFFFE0004) // (SPI0) Mode Register +#define AT91C_SPI0_IMR ((AT91_REG *) 0xFFFE001C) // (SPI0) Interrupt Mask Register +#define AT91C_SPI0_TDR ((AT91_REG *) 0xFFFE000C) // (SPI0) Transmit Data Register +#define AT91C_SPI0_RDR ((AT91_REG *) 0xFFFE0008) // (SPI0) Receive Data Register +#define AT91C_SPI0_CSR ((AT91_REG *) 0xFFFE0030) // (SPI0) Chip Select Register +// ========== Register definition for PDC_US1 peripheral ========== +#define AT91C_US1_RNCR ((AT91_REG *) 0xFFFC4114) // (PDC_US1) Receive Next Counter Register +#define AT91C_US1_PTCR ((AT91_REG *) 0xFFFC4120) // (PDC_US1) PDC Transfer Control Register +#define AT91C_US1_TCR ((AT91_REG *) 0xFFFC410C) // (PDC_US1) Transmit Counter Register +#define AT91C_US1_PTSR ((AT91_REG *) 0xFFFC4124) // (PDC_US1) PDC Transfer Status Register +#define AT91C_US1_TNPR ((AT91_REG *) 0xFFFC4118) // (PDC_US1) Transmit Next Pointer Register +#define AT91C_US1_RCR ((AT91_REG *) 0xFFFC4104) // (PDC_US1) Receive Counter Register +#define AT91C_US1_RNPR ((AT91_REG *) 0xFFFC4110) // (PDC_US1) Receive Next Pointer Register +#define AT91C_US1_RPR ((AT91_REG *) 0xFFFC4100) // (PDC_US1) Receive Pointer Register +#define AT91C_US1_TNCR ((AT91_REG *) 0xFFFC411C) // (PDC_US1) Transmit Next Counter Register +#define AT91C_US1_TPR ((AT91_REG *) 0xFFFC4108) // (PDC_US1) Transmit Pointer Register +// ========== Register definition for US1 peripheral ========== +#define AT91C_US1_IF ((AT91_REG *) 0xFFFC404C) // (US1) IRDA_FILTER Register +#define AT91C_US1_NER ((AT91_REG *) 0xFFFC4044) // (US1) Nb Errors Register +#define AT91C_US1_RTOR ((AT91_REG *) 0xFFFC4024) // (US1) Receiver Time-out Register +#define AT91C_US1_CSR ((AT91_REG *) 0xFFFC4014) // (US1) Channel Status Register +#define AT91C_US1_IDR ((AT91_REG *) 0xFFFC400C) // (US1) Interrupt Disable Register +#define AT91C_US1_IER ((AT91_REG *) 0xFFFC4008) // (US1) Interrupt Enable Register +#define AT91C_US1_THR ((AT91_REG *) 0xFFFC401C) // (US1) Transmitter Holding Register +#define AT91C_US1_TTGR ((AT91_REG *) 0xFFFC4028) // (US1) Transmitter Time-guard Register +#define AT91C_US1_RHR ((AT91_REG *) 0xFFFC4018) // (US1) Receiver Holding Register +#define AT91C_US1_BRGR ((AT91_REG *) 0xFFFC4020) // (US1) Baud Rate Generator Register +#define AT91C_US1_IMR ((AT91_REG *) 0xFFFC4010) // (US1) Interrupt Mask Register +#define AT91C_US1_FIDI ((AT91_REG *) 0xFFFC4040) // (US1) FI_DI_Ratio Register +#define AT91C_US1_CR ((AT91_REG *) 0xFFFC4000) // (US1) Control Register +#define AT91C_US1_MR ((AT91_REG *) 0xFFFC4004) // (US1) Mode Register +// ========== Register definition for PDC_US0 peripheral ========== +#define AT91C_US0_TNPR ((AT91_REG *) 0xFFFC0118) // (PDC_US0) Transmit Next Pointer Register +#define AT91C_US0_RNPR ((AT91_REG *) 0xFFFC0110) // (PDC_US0) Receive Next Pointer Register +#define AT91C_US0_TCR ((AT91_REG *) 0xFFFC010C) // (PDC_US0) Transmit Counter Register +#define AT91C_US0_PTCR ((AT91_REG *) 0xFFFC0120) // (PDC_US0) PDC Transfer Control Register +#define AT91C_US0_PTSR ((AT91_REG *) 0xFFFC0124) // (PDC_US0) PDC Transfer Status Register +#define AT91C_US0_TNCR ((AT91_REG *) 0xFFFC011C) // (PDC_US0) Transmit Next Counter Register +#define AT91C_US0_TPR ((AT91_REG *) 0xFFFC0108) // (PDC_US0) Transmit Pointer Register +#define AT91C_US0_RCR ((AT91_REG *) 0xFFFC0104) // (PDC_US0) Receive Counter Register +#define AT91C_US0_RPR ((AT91_REG *) 0xFFFC0100) // (PDC_US0) Receive Pointer Register +#define AT91C_US0_RNCR ((AT91_REG *) 0xFFFC0114) // (PDC_US0) Receive Next Counter Register +// ========== Register definition for US0 peripheral ========== +#define AT91C_US0_BRGR ((AT91_REG *) 0xFFFC0020) // (US0) Baud Rate Generator Register +#define AT91C_US0_NER ((AT91_REG *) 0xFFFC0044) // (US0) Nb Errors Register +#define AT91C_US0_CR ((AT91_REG *) 0xFFFC0000) // (US0) Control Register +#define AT91C_US0_IMR ((AT91_REG *) 0xFFFC0010) // (US0) Interrupt Mask Register +#define AT91C_US0_FIDI ((AT91_REG *) 0xFFFC0040) // (US0) FI_DI_Ratio Register +#define AT91C_US0_TTGR ((AT91_REG *) 0xFFFC0028) // (US0) Transmitter Time-guard Register +#define AT91C_US0_MR ((AT91_REG *) 0xFFFC0004) // (US0) Mode Register +#define AT91C_US0_RTOR ((AT91_REG *) 0xFFFC0024) // (US0) Receiver Time-out Register +#define AT91C_US0_CSR ((AT91_REG *) 0xFFFC0014) // (US0) Channel Status Register +#define AT91C_US0_RHR ((AT91_REG *) 0xFFFC0018) // (US0) Receiver Holding Register +#define AT91C_US0_IDR ((AT91_REG *) 0xFFFC000C) // (US0) Interrupt Disable Register +#define AT91C_US0_THR ((AT91_REG *) 0xFFFC001C) // (US0) Transmitter Holding Register +#define AT91C_US0_IF ((AT91_REG *) 0xFFFC004C) // (US0) IRDA_FILTER Register +#define AT91C_US0_IER ((AT91_REG *) 0xFFFC0008) // (US0) Interrupt Enable Register +// ========== Register definition for PDC_SSC peripheral ========== +#define AT91C_SSC_TNCR ((AT91_REG *) 0xFFFD411C) // (PDC_SSC) Transmit Next Counter Register +#define AT91C_SSC_RPR ((AT91_REG *) 0xFFFD4100) // (PDC_SSC) Receive Pointer Register +#define AT91C_SSC_RNCR ((AT91_REG *) 0xFFFD4114) // (PDC_SSC) Receive Next Counter Register +#define AT91C_SSC_TPR ((AT91_REG *) 0xFFFD4108) // (PDC_SSC) Transmit Pointer Register +#define AT91C_SSC_PTCR ((AT91_REG *) 0xFFFD4120) // (PDC_SSC) PDC Transfer Control Register +#define AT91C_SSC_TCR ((AT91_REG *) 0xFFFD410C) // (PDC_SSC) Transmit Counter Register +#define AT91C_SSC_RCR ((AT91_REG *) 0xFFFD4104) // (PDC_SSC) Receive Counter Register +#define AT91C_SSC_RNPR ((AT91_REG *) 0xFFFD4110) // (PDC_SSC) Receive Next Pointer Register +#define AT91C_SSC_TNPR ((AT91_REG *) 0xFFFD4118) // (PDC_SSC) Transmit Next Pointer Register +#define AT91C_SSC_PTSR ((AT91_REG *) 0xFFFD4124) // (PDC_SSC) PDC Transfer Status Register +// ========== Register definition for SSC peripheral ========== +#define AT91C_SSC_RHR ((AT91_REG *) 0xFFFD4020) // (SSC) Receive Holding Register +#define AT91C_SSC_RSHR ((AT91_REG *) 0xFFFD4030) // (SSC) Receive Sync Holding Register +#define AT91C_SSC_TFMR ((AT91_REG *) 0xFFFD401C) // (SSC) Transmit Frame Mode Register +#define AT91C_SSC_IDR ((AT91_REG *) 0xFFFD4048) // (SSC) Interrupt Disable Register +#define AT91C_SSC_THR ((AT91_REG *) 0xFFFD4024) // (SSC) Transmit Holding Register +#define AT91C_SSC_RCMR ((AT91_REG *) 0xFFFD4010) // (SSC) Receive Clock ModeRegister +#define AT91C_SSC_IER ((AT91_REG *) 0xFFFD4044) // (SSC) Interrupt Enable Register +#define AT91C_SSC_TSHR ((AT91_REG *) 0xFFFD4034) // (SSC) Transmit Sync Holding Register +#define AT91C_SSC_SR ((AT91_REG *) 0xFFFD4040) // (SSC) Status Register +#define AT91C_SSC_CMR ((AT91_REG *) 0xFFFD4004) // (SSC) Clock Mode Register +#define AT91C_SSC_TCMR ((AT91_REG *) 0xFFFD4018) // (SSC) Transmit Clock Mode Register +#define AT91C_SSC_CR ((AT91_REG *) 0xFFFD4000) // (SSC) Control Register +#define AT91C_SSC_IMR ((AT91_REG *) 0xFFFD404C) // (SSC) Interrupt Mask Register +#define AT91C_SSC_RFMR ((AT91_REG *) 0xFFFD4014) // (SSC) Receive Frame Mode Register +// ========== Register definition for TWI peripheral ========== +#define AT91C_TWI_IER ((AT91_REG *) 0xFFFB8024) // (TWI) Interrupt Enable Register +#define AT91C_TWI_CR ((AT91_REG *) 0xFFFB8000) // (TWI) Control Register +#define AT91C_TWI_SR ((AT91_REG *) 0xFFFB8020) // (TWI) Status Register +#define AT91C_TWI_IMR ((AT91_REG *) 0xFFFB802C) // (TWI) Interrupt Mask Register +#define AT91C_TWI_THR ((AT91_REG *) 0xFFFB8034) // (TWI) Transmit Holding Register +#define AT91C_TWI_IDR ((AT91_REG *) 0xFFFB8028) // (TWI) Interrupt Disable Register +#define AT91C_TWI_IADR ((AT91_REG *) 0xFFFB800C) // (TWI) Internal Address Register +#define AT91C_TWI_MMR ((AT91_REG *) 0xFFFB8004) // (TWI) Master Mode Register +#define AT91C_TWI_CWGR ((AT91_REG *) 0xFFFB8010) // (TWI) Clock Waveform Generator Register +#define AT91C_TWI_RHR ((AT91_REG *) 0xFFFB8030) // (TWI) Receive Holding Register +// ========== Register definition for PWMC_CH3 peripheral ========== +#define AT91C_PWMC_CH3_CUPDR ((AT91_REG *) 0xFFFCC270) // (PWMC_CH3) Channel Update Register +#define AT91C_PWMC_CH3_Reserved ((AT91_REG *) 0xFFFCC274) // (PWMC_CH3) Reserved +#define AT91C_PWMC_CH3_CPRDR ((AT91_REG *) 0xFFFCC268) // (PWMC_CH3) Channel Period Register +#define AT91C_PWMC_CH3_CDTYR ((AT91_REG *) 0xFFFCC264) // (PWMC_CH3) Channel Duty Cycle Register +#define AT91C_PWMC_CH3_CCNTR ((AT91_REG *) 0xFFFCC26C) // (PWMC_CH3) Channel Counter Register +#define AT91C_PWMC_CH3_CMR ((AT91_REG *) 0xFFFCC260) // (PWMC_CH3) Channel Mode Register +// ========== Register definition for PWMC_CH2 peripheral ========== +#define AT91C_PWMC_CH2_Reserved ((AT91_REG *) 0xFFFCC254) // (PWMC_CH2) Reserved +#define AT91C_PWMC_CH2_CMR ((AT91_REG *) 0xFFFCC240) // (PWMC_CH2) Channel Mode Register +#define AT91C_PWMC_CH2_CCNTR ((AT91_REG *) 0xFFFCC24C) // (PWMC_CH2) Channel Counter Register +#define AT91C_PWMC_CH2_CPRDR ((AT91_REG *) 0xFFFCC248) // (PWMC_CH2) Channel Period Register +#define AT91C_PWMC_CH2_CUPDR ((AT91_REG *) 0xFFFCC250) // (PWMC_CH2) Channel Update Register +#define AT91C_PWMC_CH2_CDTYR ((AT91_REG *) 0xFFFCC244) // (PWMC_CH2) Channel Duty Cycle Register +// ========== Register definition for PWMC_CH1 peripheral ========== +#define AT91C_PWMC_CH1_Reserved ((AT91_REG *) 0xFFFCC234) // (PWMC_CH1) Reserved +#define AT91C_PWMC_CH1_CUPDR ((AT91_REG *) 0xFFFCC230) // (PWMC_CH1) Channel Update Register +#define AT91C_PWMC_CH1_CPRDR ((AT91_REG *) 0xFFFCC228) // (PWMC_CH1) Channel Period Register +#define AT91C_PWMC_CH1_CCNTR ((AT91_REG *) 0xFFFCC22C) // (PWMC_CH1) Channel Counter Register +#define AT91C_PWMC_CH1_CDTYR ((AT91_REG *) 0xFFFCC224) // (PWMC_CH1) Channel Duty Cycle Register +#define AT91C_PWMC_CH1_CMR ((AT91_REG *) 0xFFFCC220) // (PWMC_CH1) Channel Mode Register +// ========== Register definition for PWMC_CH0 peripheral ========== +#define AT91C_PWMC_CH0_Reserved ((AT91_REG *) 0xFFFCC214) // (PWMC_CH0) Reserved +#define AT91C_PWMC_CH0_CPRDR ((AT91_REG *) 0xFFFCC208) // (PWMC_CH0) Channel Period Register +#define AT91C_PWMC_CH0_CDTYR ((AT91_REG *) 0xFFFCC204) // (PWMC_CH0) Channel Duty Cycle Register +#define AT91C_PWMC_CH0_CMR ((AT91_REG *) 0xFFFCC200) // (PWMC_CH0) Channel Mode Register +#define AT91C_PWMC_CH0_CUPDR ((AT91_REG *) 0xFFFCC210) // (PWMC_CH0) Channel Update Register +#define AT91C_PWMC_CH0_CCNTR ((AT91_REG *) 0xFFFCC20C) // (PWMC_CH0) Channel Counter Register +// ========== Register definition for PWMC peripheral ========== +#define AT91C_PWMC_IDR ((AT91_REG *) 0xFFFCC014) // (PWMC) PWMC Interrupt Disable Register +#define AT91C_PWMC_DIS ((AT91_REG *) 0xFFFCC008) // (PWMC) PWMC Disable Register +#define AT91C_PWMC_IER ((AT91_REG *) 0xFFFCC010) // (PWMC) PWMC Interrupt Enable Register +#define AT91C_PWMC_VR ((AT91_REG *) 0xFFFCC0FC) // (PWMC) PWMC Version Register +#define AT91C_PWMC_ISR ((AT91_REG *) 0xFFFCC01C) // (PWMC) PWMC Interrupt Status Register +#define AT91C_PWMC_SR ((AT91_REG *) 0xFFFCC00C) // (PWMC) PWMC Status Register +#define AT91C_PWMC_IMR ((AT91_REG *) 0xFFFCC018) // (PWMC) PWMC Interrupt Mask Register +#define AT91C_PWMC_MR ((AT91_REG *) 0xFFFCC000) // (PWMC) PWMC Mode Register +#define AT91C_PWMC_ENA ((AT91_REG *) 0xFFFCC004) // (PWMC) PWMC Enable Register +// ========== Register definition for UDP peripheral ========== +#define AT91C_UDP_IMR ((AT91_REG *) 0xFFFB0018) // (UDP) Interrupt Mask Register +#define AT91C_UDP_FADDR ((AT91_REG *) 0xFFFB0008) // (UDP) Function Address Register +#define AT91C_UDP_NUM ((AT91_REG *) 0xFFFB0000) // (UDP) Frame Number Register +#define AT91C_UDP_FDR ((AT91_REG *) 0xFFFB0050) // (UDP) Endpoint FIFO Data Register +#define AT91C_UDP_ISR ((AT91_REG *) 0xFFFB001C) // (UDP) Interrupt Status Register +#define AT91C_UDP_CSR ((AT91_REG *) 0xFFFB0030) // (UDP) Endpoint Control and Status Register +#define AT91C_UDP_IDR ((AT91_REG *) 0xFFFB0014) // (UDP) Interrupt Disable Register +#define AT91C_UDP_ICR ((AT91_REG *) 0xFFFB0020) // (UDP) Interrupt Clear Register +#define AT91C_UDP_RSTEP ((AT91_REG *) 0xFFFB0028) // (UDP) Reset Endpoint Register +#define AT91C_UDP_TXVC ((AT91_REG *) 0xFFFB0074) // (UDP) Transceiver Control Register +#define AT91C_UDP_GLBSTATE ((AT91_REG *) 0xFFFB0004) // (UDP) Global State Register +#define AT91C_UDP_IER ((AT91_REG *) 0xFFFB0010) // (UDP) Interrupt Enable Register +// ========== Register definition for TC0 peripheral ========== +#define AT91C_TC0_SR ((AT91_REG *) 0xFFFA0020) // (TC0) Status Register +#define AT91C_TC0_RC ((AT91_REG *) 0xFFFA001C) // (TC0) Register C +#define AT91C_TC0_RB ((AT91_REG *) 0xFFFA0018) // (TC0) Register B +#define AT91C_TC0_CCR ((AT91_REG *) 0xFFFA0000) // (TC0) Channel Control Register +#define AT91C_TC0_CMR ((AT91_REG *) 0xFFFA0004) // (TC0) Channel Mode Register (Capture Mode / Waveform Mode) +#define AT91C_TC0_IER ((AT91_REG *) 0xFFFA0024) // (TC0) Interrupt Enable Register +#define AT91C_TC0_RA ((AT91_REG *) 0xFFFA0014) // (TC0) Register A +#define AT91C_TC0_IDR ((AT91_REG *) 0xFFFA0028) // (TC0) Interrupt Disable Register +#define AT91C_TC0_CV ((AT91_REG *) 0xFFFA0010) // (TC0) Counter Value +#define AT91C_TC0_IMR ((AT91_REG *) 0xFFFA002C) // (TC0) Interrupt Mask Register +// ========== Register definition for TC1 peripheral ========== +#define AT91C_TC1_RB ((AT91_REG *) 0xFFFA0058) // (TC1) Register B +#define AT91C_TC1_CCR ((AT91_REG *) 0xFFFA0040) // (TC1) Channel Control Register +#define AT91C_TC1_IER ((AT91_REG *) 0xFFFA0064) // (TC1) Interrupt Enable Register +#define AT91C_TC1_IDR ((AT91_REG *) 0xFFFA0068) // (TC1) Interrupt Disable Register +#define AT91C_TC1_SR ((AT91_REG *) 0xFFFA0060) // (TC1) Status Register +#define AT91C_TC1_CMR ((AT91_REG *) 0xFFFA0044) // (TC1) Channel Mode Register (Capture Mode / Waveform Mode) +#define AT91C_TC1_RA ((AT91_REG *) 0xFFFA0054) // (TC1) Register A +#define AT91C_TC1_RC ((AT91_REG *) 0xFFFA005C) // (TC1) Register C +#define AT91C_TC1_IMR ((AT91_REG *) 0xFFFA006C) // (TC1) Interrupt Mask Register +#define AT91C_TC1_CV ((AT91_REG *) 0xFFFA0050) // (TC1) Counter Value +// ========== Register definition for TC2 peripheral ========== +#define AT91C_TC2_CMR ((AT91_REG *) 0xFFFA0084) // (TC2) Channel Mode Register (Capture Mode / Waveform Mode) +#define AT91C_TC2_CCR ((AT91_REG *) 0xFFFA0080) // (TC2) Channel Control Register +#define AT91C_TC2_CV ((AT91_REG *) 0xFFFA0090) // (TC2) Counter Value +#define AT91C_TC2_RA ((AT91_REG *) 0xFFFA0094) // (TC2) Register A +#define AT91C_TC2_RB ((AT91_REG *) 0xFFFA0098) // (TC2) Register B +#define AT91C_TC2_IDR ((AT91_REG *) 0xFFFA00A8) // (TC2) Interrupt Disable Register +#define AT91C_TC2_IMR ((AT91_REG *) 0xFFFA00AC) // (TC2) Interrupt Mask Register +#define AT91C_TC2_RC ((AT91_REG *) 0xFFFA009C) // (TC2) Register C +#define AT91C_TC2_IER ((AT91_REG *) 0xFFFA00A4) // (TC2) Interrupt Enable Register +#define AT91C_TC2_SR ((AT91_REG *) 0xFFFA00A0) // (TC2) Status Register +// ========== Register definition for TCB peripheral ========== +#define AT91C_TCB_BMR ((AT91_REG *) 0xFFFA00C4) // (TCB) TC Block Mode Register +#define AT91C_TCB_BCR ((AT91_REG *) 0xFFFA00C0) // (TCB) TC Block Control Register +// ========== Register definition for CAN_MB0 peripheral ========== +#define AT91C_CAN_MB0_MDL ((AT91_REG *) 0xFFFD0214) // (CAN_MB0) MailBox Data Low Register +#define AT91C_CAN_MB0_MAM ((AT91_REG *) 0xFFFD0204) // (CAN_MB0) MailBox Acceptance Mask Register +#define AT91C_CAN_MB0_MCR ((AT91_REG *) 0xFFFD021C) // (CAN_MB0) MailBox Control Register +#define AT91C_CAN_MB0_MID ((AT91_REG *) 0xFFFD0208) // (CAN_MB0) MailBox ID Register +#define AT91C_CAN_MB0_MSR ((AT91_REG *) 0xFFFD0210) // (CAN_MB0) MailBox Status Register +#define AT91C_CAN_MB0_MFID ((AT91_REG *) 0xFFFD020C) // (CAN_MB0) MailBox Family ID Register +#define AT91C_CAN_MB0_MDH ((AT91_REG *) 0xFFFD0218) // (CAN_MB0) MailBox Data High Register +#define AT91C_CAN_MB0_MMR ((AT91_REG *) 0xFFFD0200) // (CAN_MB0) MailBox Mode Register +// ========== Register definition for CAN_MB1 peripheral ========== +#define AT91C_CAN_MB1_MDL ((AT91_REG *) 0xFFFD0234) // (CAN_MB1) MailBox Data Low Register +#define AT91C_CAN_MB1_MID ((AT91_REG *) 0xFFFD0228) // (CAN_MB1) MailBox ID Register +#define AT91C_CAN_MB1_MMR ((AT91_REG *) 0xFFFD0220) // (CAN_MB1) MailBox Mode Register +#define AT91C_CAN_MB1_MSR ((AT91_REG *) 0xFFFD0230) // (CAN_MB1) MailBox Status Register +#define AT91C_CAN_MB1_MAM ((AT91_REG *) 0xFFFD0224) // (CAN_MB1) MailBox Acceptance Mask Register +#define AT91C_CAN_MB1_MDH ((AT91_REG *) 0xFFFD0238) // (CAN_MB1) MailBox Data High Register +#define AT91C_CAN_MB1_MCR ((AT91_REG *) 0xFFFD023C) // (CAN_MB1) MailBox Control Register +#define AT91C_CAN_MB1_MFID ((AT91_REG *) 0xFFFD022C) // (CAN_MB1) MailBox Family ID Register +// ========== Register definition for CAN_MB2 peripheral ========== +#define AT91C_CAN_MB2_MCR ((AT91_REG *) 0xFFFD025C) // (CAN_MB2) MailBox Control Register +#define AT91C_CAN_MB2_MDH ((AT91_REG *) 0xFFFD0258) // (CAN_MB2) MailBox Data High Register +#define AT91C_CAN_MB2_MID ((AT91_REG *) 0xFFFD0248) // (CAN_MB2) MailBox ID Register +#define AT91C_CAN_MB2_MDL ((AT91_REG *) 0xFFFD0254) // (CAN_MB2) MailBox Data Low Register +#define AT91C_CAN_MB2_MMR ((AT91_REG *) 0xFFFD0240) // (CAN_MB2) MailBox Mode Register +#define AT91C_CAN_MB2_MAM ((AT91_REG *) 0xFFFD0244) // (CAN_MB2) MailBox Acceptance Mask Register +#define AT91C_CAN_MB2_MFID ((AT91_REG *) 0xFFFD024C) // (CAN_MB2) MailBox Family ID Register +#define AT91C_CAN_MB2_MSR ((AT91_REG *) 0xFFFD0250) // (CAN_MB2) MailBox Status Register +// ========== Register definition for CAN_MB3 peripheral ========== +#define AT91C_CAN_MB3_MFID ((AT91_REG *) 0xFFFD026C) // (CAN_MB3) MailBox Family ID Register +#define AT91C_CAN_MB3_MAM ((AT91_REG *) 0xFFFD0264) // (CAN_MB3) MailBox Acceptance Mask Register +#define AT91C_CAN_MB3_MID ((AT91_REG *) 0xFFFD0268) // (CAN_MB3) MailBox ID Register +#define AT91C_CAN_MB3_MCR ((AT91_REG *) 0xFFFD027C) // (CAN_MB3) MailBox Control Register +#define AT91C_CAN_MB3_MMR ((AT91_REG *) 0xFFFD0260) // (CAN_MB3) MailBox Mode Register +#define AT91C_CAN_MB3_MSR ((AT91_REG *) 0xFFFD0270) // (CAN_MB3) MailBox Status Register +#define AT91C_CAN_MB3_MDL ((AT91_REG *) 0xFFFD0274) // (CAN_MB3) MailBox Data Low Register +#define AT91C_CAN_MB3_MDH ((AT91_REG *) 0xFFFD0278) // (CAN_MB3) MailBox Data High Register +// ========== Register definition for CAN_MB4 peripheral ========== +#define AT91C_CAN_MB4_MID ((AT91_REG *) 0xFFFD0288) // (CAN_MB4) MailBox ID Register +#define AT91C_CAN_MB4_MMR ((AT91_REG *) 0xFFFD0280) // (CAN_MB4) MailBox Mode Register +#define AT91C_CAN_MB4_MDH ((AT91_REG *) 0xFFFD0298) // (CAN_MB4) MailBox Data High Register +#define AT91C_CAN_MB4_MFID ((AT91_REG *) 0xFFFD028C) // (CAN_MB4) MailBox Family ID Register +#define AT91C_CAN_MB4_MSR ((AT91_REG *) 0xFFFD0290) // (CAN_MB4) MailBox Status Register +#define AT91C_CAN_MB4_MCR ((AT91_REG *) 0xFFFD029C) // (CAN_MB4) MailBox Control Register +#define AT91C_CAN_MB4_MDL ((AT91_REG *) 0xFFFD0294) // (CAN_MB4) MailBox Data Low Register +#define AT91C_CAN_MB4_MAM ((AT91_REG *) 0xFFFD0284) // (CAN_MB4) MailBox Acceptance Mask Register +// ========== Register definition for CAN_MB5 peripheral ========== +#define AT91C_CAN_MB5_MSR ((AT91_REG *) 0xFFFD02B0) // (CAN_MB5) MailBox Status Register +#define AT91C_CAN_MB5_MCR ((AT91_REG *) 0xFFFD02BC) // (CAN_MB5) MailBox Control Register +#define AT91C_CAN_MB5_MFID ((AT91_REG *) 0xFFFD02AC) // (CAN_MB5) MailBox Family ID Register +#define AT91C_CAN_MB5_MDH ((AT91_REG *) 0xFFFD02B8) // (CAN_MB5) MailBox Data High Register +#define AT91C_CAN_MB5_MID ((AT91_REG *) 0xFFFD02A8) // (CAN_MB5) MailBox ID Register +#define AT91C_CAN_MB5_MMR ((AT91_REG *) 0xFFFD02A0) // (CAN_MB5) MailBox Mode Register +#define AT91C_CAN_MB5_MDL ((AT91_REG *) 0xFFFD02B4) // (CAN_MB5) MailBox Data Low Register +#define AT91C_CAN_MB5_MAM ((AT91_REG *) 0xFFFD02A4) // (CAN_MB5) MailBox Acceptance Mask Register +// ========== Register definition for CAN_MB6 peripheral ========== +#define AT91C_CAN_MB6_MFID ((AT91_REG *) 0xFFFD02CC) // (CAN_MB6) MailBox Family ID Register +#define AT91C_CAN_MB6_MID ((AT91_REG *) 0xFFFD02C8) // (CAN_MB6) MailBox ID Register +#define AT91C_CAN_MB6_MAM ((AT91_REG *) 0xFFFD02C4) // (CAN_MB6) MailBox Acceptance Mask Register +#define AT91C_CAN_MB6_MSR ((AT91_REG *) 0xFFFD02D0) // (CAN_MB6) MailBox Status Register +#define AT91C_CAN_MB6_MDL ((AT91_REG *) 0xFFFD02D4) // (CAN_MB6) MailBox Data Low Register +#define AT91C_CAN_MB6_MCR ((AT91_REG *) 0xFFFD02DC) // (CAN_MB6) MailBox Control Register +#define AT91C_CAN_MB6_MDH ((AT91_REG *) 0xFFFD02D8) // (CAN_MB6) MailBox Data High Register +#define AT91C_CAN_MB6_MMR ((AT91_REG *) 0xFFFD02C0) // (CAN_MB6) MailBox Mode Register +// ========== Register definition for CAN_MB7 peripheral ========== +#define AT91C_CAN_MB7_MCR ((AT91_REG *) 0xFFFD02FC) // (CAN_MB7) MailBox Control Register +#define AT91C_CAN_MB7_MDH ((AT91_REG *) 0xFFFD02F8) // (CAN_MB7) MailBox Data High Register +#define AT91C_CAN_MB7_MFID ((AT91_REG *) 0xFFFD02EC) // (CAN_MB7) MailBox Family ID Register +#define AT91C_CAN_MB7_MDL ((AT91_REG *) 0xFFFD02F4) // (CAN_MB7) MailBox Data Low Register +#define AT91C_CAN_MB7_MID ((AT91_REG *) 0xFFFD02E8) // (CAN_MB7) MailBox ID Register +#define AT91C_CAN_MB7_MMR ((AT91_REG *) 0xFFFD02E0) // (CAN_MB7) MailBox Mode Register +#define AT91C_CAN_MB7_MAM ((AT91_REG *) 0xFFFD02E4) // (CAN_MB7) MailBox Acceptance Mask Register +#define AT91C_CAN_MB7_MSR ((AT91_REG *) 0xFFFD02F0) // (CAN_MB7) MailBox Status Register +// ========== Register definition for CAN peripheral ========== +#define AT91C_CAN_TCR ((AT91_REG *) 0xFFFD0024) // (CAN) Transfer Command Register +#define AT91C_CAN_IMR ((AT91_REG *) 0xFFFD000C) // (CAN) Interrupt Mask Register +#define AT91C_CAN_IER ((AT91_REG *) 0xFFFD0004) // (CAN) Interrupt Enable Register +#define AT91C_CAN_ECR ((AT91_REG *) 0xFFFD0020) // (CAN) Error Counter Register +#define AT91C_CAN_TIMESTP ((AT91_REG *) 0xFFFD001C) // (CAN) Time Stamp Register +#define AT91C_CAN_MR ((AT91_REG *) 0xFFFD0000) // (CAN) Mode Register +#define AT91C_CAN_IDR ((AT91_REG *) 0xFFFD0008) // (CAN) Interrupt Disable Register +#define AT91C_CAN_ACR ((AT91_REG *) 0xFFFD0028) // (CAN) Abort Command Register +#define AT91C_CAN_TIM ((AT91_REG *) 0xFFFD0018) // (CAN) Timer Register +#define AT91C_CAN_SR ((AT91_REG *) 0xFFFD0010) // (CAN) Status Register +#define AT91C_CAN_BR ((AT91_REG *) 0xFFFD0014) // (CAN) Baudrate Register +#define AT91C_CAN_VR ((AT91_REG *) 0xFFFD00FC) // (CAN) Version Register +// ========== Register definition for EMAC peripheral ========== +#define AT91C_EMAC_ISR ((AT91_REG *) 0xFFFDC024) // (EMAC) Interrupt Status Register +#define AT91C_EMAC_SA4H ((AT91_REG *) 0xFFFDC0B4) // (EMAC) Specific Address 4 Top, Last 2 bytes +#define AT91C_EMAC_SA1L ((AT91_REG *) 0xFFFDC098) // (EMAC) Specific Address 1 Bottom, First 4 bytes +#define AT91C_EMAC_ELE ((AT91_REG *) 0xFFFDC078) // (EMAC) Excessive Length Errors Register +#define AT91C_EMAC_LCOL ((AT91_REG *) 0xFFFDC05C) // (EMAC) Late Collision Register +#define AT91C_EMAC_RLE ((AT91_REG *) 0xFFFDC088) // (EMAC) Receive Length Field Mismatch Register +#define AT91C_EMAC_WOL ((AT91_REG *) 0xFFFDC0C4) // (EMAC) Wake On LAN Register +#define AT91C_EMAC_DTF ((AT91_REG *) 0xFFFDC058) // (EMAC) Deferred Transmission Frame Register +#define AT91C_EMAC_TUND ((AT91_REG *) 0xFFFDC064) // (EMAC) Transmit Underrun Error Register +#define AT91C_EMAC_NCR ((AT91_REG *) 0xFFFDC000) // (EMAC) Network Control Register +#define AT91C_EMAC_SA4L ((AT91_REG *) 0xFFFDC0B0) // (EMAC) Specific Address 4 Bottom, First 4 bytes +#define AT91C_EMAC_RSR ((AT91_REG *) 0xFFFDC020) // (EMAC) Receive Status Register +#define AT91C_EMAC_SA3L ((AT91_REG *) 0xFFFDC0A8) // (EMAC) Specific Address 3 Bottom, First 4 bytes +#define AT91C_EMAC_TSR ((AT91_REG *) 0xFFFDC014) // (EMAC) Transmit Status Register +#define AT91C_EMAC_IDR ((AT91_REG *) 0xFFFDC02C) // (EMAC) Interrupt Disable Register +#define AT91C_EMAC_RSE ((AT91_REG *) 0xFFFDC074) // (EMAC) Receive Symbol Errors Register +#define AT91C_EMAC_ECOL ((AT91_REG *) 0xFFFDC060) // (EMAC) Excessive Collision Register +#define AT91C_EMAC_TID ((AT91_REG *) 0xFFFDC0B8) // (EMAC) Type ID Checking Register +#define AT91C_EMAC_HRB ((AT91_REG *) 0xFFFDC090) // (EMAC) Hash Address Bottom[31:0] +#define AT91C_EMAC_TBQP ((AT91_REG *) 0xFFFDC01C) // (EMAC) Transmit Buffer Queue Pointer +#define AT91C_EMAC_USRIO ((AT91_REG *) 0xFFFDC0C0) // (EMAC) USER Input/Output Register +#define AT91C_EMAC_PTR ((AT91_REG *) 0xFFFDC038) // (EMAC) Pause Time Register +#define AT91C_EMAC_SA2H ((AT91_REG *) 0xFFFDC0A4) // (EMAC) Specific Address 2 Top, Last 2 bytes +#define AT91C_EMAC_ROV ((AT91_REG *) 0xFFFDC070) // (EMAC) Receive Overrun Errors Register +#define AT91C_EMAC_ALE ((AT91_REG *) 0xFFFDC054) // (EMAC) Alignment Error Register +#define AT91C_EMAC_RJA ((AT91_REG *) 0xFFFDC07C) // (EMAC) Receive Jabbers Register +#define AT91C_EMAC_RBQP ((AT91_REG *) 0xFFFDC018) // (EMAC) Receive Buffer Queue Pointer +#define AT91C_EMAC_TPF ((AT91_REG *) 0xFFFDC08C) // (EMAC) Transmitted Pause Frames Register +#define AT91C_EMAC_NCFGR ((AT91_REG *) 0xFFFDC004) // (EMAC) Network Configuration Register +#define AT91C_EMAC_HRT ((AT91_REG *) 0xFFFDC094) // (EMAC) Hash Address Top[63:32] +#define AT91C_EMAC_USF ((AT91_REG *) 0xFFFDC080) // (EMAC) Undersize Frames Register +#define AT91C_EMAC_FCSE ((AT91_REG *) 0xFFFDC050) // (EMAC) Frame Check Sequence Error Register +#define AT91C_EMAC_TPQ ((AT91_REG *) 0xFFFDC0BC) // (EMAC) Transmit Pause Quantum Register +#define AT91C_EMAC_MAN ((AT91_REG *) 0xFFFDC034) // (EMAC) PHY Maintenance Register +#define AT91C_EMAC_FTO ((AT91_REG *) 0xFFFDC040) // (EMAC) Frames Transmitted OK Register +#define AT91C_EMAC_REV ((AT91_REG *) 0xFFFDC0FC) // (EMAC) Revision Register +#define AT91C_EMAC_IMR ((AT91_REG *) 0xFFFDC030) // (EMAC) Interrupt Mask Register +#define AT91C_EMAC_SCF ((AT91_REG *) 0xFFFDC044) // (EMAC) Single Collision Frame Register +#define AT91C_EMAC_PFR ((AT91_REG *) 0xFFFDC03C) // (EMAC) Pause Frames received Register +#define AT91C_EMAC_MCF ((AT91_REG *) 0xFFFDC048) // (EMAC) Multiple Collision Frame Register +#define AT91C_EMAC_NSR ((AT91_REG *) 0xFFFDC008) // (EMAC) Network Status Register +#define AT91C_EMAC_SA2L ((AT91_REG *) 0xFFFDC0A0) // (EMAC) Specific Address 2 Bottom, First 4 bytes +#define AT91C_EMAC_FRO ((AT91_REG *) 0xFFFDC04C) // (EMAC) Frames Received OK Register +#define AT91C_EMAC_IER ((AT91_REG *) 0xFFFDC028) // (EMAC) Interrupt Enable Register +#define AT91C_EMAC_SA1H ((AT91_REG *) 0xFFFDC09C) // (EMAC) Specific Address 1 Top, Last 2 bytes +#define AT91C_EMAC_CSE ((AT91_REG *) 0xFFFDC068) // (EMAC) Carrier Sense Error Register +#define AT91C_EMAC_SA3H ((AT91_REG *) 0xFFFDC0AC) // (EMAC) Specific Address 3 Top, Last 2 bytes +#define AT91C_EMAC_RRE ((AT91_REG *) 0xFFFDC06C) // (EMAC) Receive Ressource Error Register +#define AT91C_EMAC_STE ((AT91_REG *) 0xFFFDC084) // (EMAC) SQE Test Error Register +// ========== Register definition for PDC_ADC peripheral ========== +#define AT91C_ADC_PTSR ((AT91_REG *) 0xFFFD8124) // (PDC_ADC) PDC Transfer Status Register +#define AT91C_ADC_PTCR ((AT91_REG *) 0xFFFD8120) // (PDC_ADC) PDC Transfer Control Register +#define AT91C_ADC_TNPR ((AT91_REG *) 0xFFFD8118) // (PDC_ADC) Transmit Next Pointer Register +#define AT91C_ADC_TNCR ((AT91_REG *) 0xFFFD811C) // (PDC_ADC) Transmit Next Counter Register +#define AT91C_ADC_RNPR ((AT91_REG *) 0xFFFD8110) // (PDC_ADC) Receive Next Pointer Register +#define AT91C_ADC_RNCR ((AT91_REG *) 0xFFFD8114) // (PDC_ADC) Receive Next Counter Register +#define AT91C_ADC_RPR ((AT91_REG *) 0xFFFD8100) // (PDC_ADC) Receive Pointer Register +#define AT91C_ADC_TCR ((AT91_REG *) 0xFFFD810C) // (PDC_ADC) Transmit Counter Register +#define AT91C_ADC_TPR ((AT91_REG *) 0xFFFD8108) // (PDC_ADC) Transmit Pointer Register +#define AT91C_ADC_RCR ((AT91_REG *) 0xFFFD8104) // (PDC_ADC) Receive Counter Register +// ========== Register definition for ADC peripheral ========== +#define AT91C_ADC_CDR2 ((AT91_REG *) 0xFFFD8038) // (ADC) ADC Channel Data Register 2 +#define AT91C_ADC_CDR3 ((AT91_REG *) 0xFFFD803C) // (ADC) ADC Channel Data Register 3 +#define AT91C_ADC_CDR0 ((AT91_REG *) 0xFFFD8030) // (ADC) ADC Channel Data Register 0 +#define AT91C_ADC_CDR5 ((AT91_REG *) 0xFFFD8044) // (ADC) ADC Channel Data Register 5 +#define AT91C_ADC_CHDR ((AT91_REG *) 0xFFFD8014) // (ADC) ADC Channel Disable Register +#define AT91C_ADC_SR ((AT91_REG *) 0xFFFD801C) // (ADC) ADC Status Register +#define AT91C_ADC_CDR4 ((AT91_REG *) 0xFFFD8040) // (ADC) ADC Channel Data Register 4 +#define AT91C_ADC_CDR1 ((AT91_REG *) 0xFFFD8034) // (ADC) ADC Channel Data Register 1 +#define AT91C_ADC_LCDR ((AT91_REG *) 0xFFFD8020) // (ADC) ADC Last Converted Data Register +#define AT91C_ADC_IDR ((AT91_REG *) 0xFFFD8028) // (ADC) ADC Interrupt Disable Register +#define AT91C_ADC_CR ((AT91_REG *) 0xFFFD8000) // (ADC) ADC Control Register +#define AT91C_ADC_CDR7 ((AT91_REG *) 0xFFFD804C) // (ADC) ADC Channel Data Register 7 +#define AT91C_ADC_CDR6 ((AT91_REG *) 0xFFFD8048) // (ADC) ADC Channel Data Register 6 +#define AT91C_ADC_IER ((AT91_REG *) 0xFFFD8024) // (ADC) ADC Interrupt Enable Register +#define AT91C_ADC_CHER ((AT91_REG *) 0xFFFD8010) // (ADC) ADC Channel Enable Register +#define AT91C_ADC_CHSR ((AT91_REG *) 0xFFFD8018) // (ADC) ADC Channel Status Register +#define AT91C_ADC_MR ((AT91_REG *) 0xFFFD8004) // (ADC) ADC Mode Register +#define AT91C_ADC_IMR ((AT91_REG *) 0xFFFD802C) // (ADC) ADC Interrupt Mask Register + +// ***************************************************************************** +// PIO DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** +#define AT91C_PIO_PA0 ((unsigned int) 1 << 0) // Pin Controlled by PA0 +#define AT91C_PA0_RXD0 ((unsigned int) AT91C_PIO_PA0) // USART 0 Receive Data +#define AT91C_PIO_PA1 ((unsigned int) 1 << 1) // Pin Controlled by PA1 +#define AT91C_PA1_TXD0 ((unsigned int) AT91C_PIO_PA1) // USART 0 Transmit Data +#define AT91C_PIO_PA10 ((unsigned int) 1 << 10) // Pin Controlled by PA10 +#define AT91C_PA10_TWD ((unsigned int) AT91C_PIO_PA10) // TWI Two-wire Serial Data +#define AT91C_PIO_PA11 ((unsigned int) 1 << 11) // Pin Controlled by PA11 +#define AT91C_PA11_TWCK ((unsigned int) AT91C_PIO_PA11) // TWI Two-wire Serial Clock +#define AT91C_PIO_PA12 ((unsigned int) 1 << 12) // Pin Controlled by PA12 +#define AT91C_PA12_SPI0_NPCS0 ((unsigned int) AT91C_PIO_PA12) // SPI 0 Peripheral Chip Select 0 +#define AT91C_PIO_PA13 ((unsigned int) 1 << 13) // Pin Controlled by PA13 +#define AT91C_PA13_SPI0_NPCS1 ((unsigned int) AT91C_PIO_PA13) // SPI 0 Peripheral Chip Select 1 +#define AT91C_PA13_PCK1 ((unsigned int) AT91C_PIO_PA13) // PMC Programmable Clock Output 1 +#define AT91C_PIO_PA14 ((unsigned int) 1 << 14) // Pin Controlled by PA14 +#define AT91C_PA14_SPI0_NPCS2 ((unsigned int) AT91C_PIO_PA14) // SPI 0 Peripheral Chip Select 2 +#define AT91C_PA14_IRQ1 ((unsigned int) AT91C_PIO_PA14) // External Interrupt 1 +#define AT91C_PIO_PA15 ((unsigned int) 1 << 15) // Pin Controlled by PA15 +#define AT91C_PA15_SPI0_NPCS3 ((unsigned int) AT91C_PIO_PA15) // SPI 0 Peripheral Chip Select 3 +#define AT91C_PA15_TCLK2 ((unsigned int) AT91C_PIO_PA15) // Timer Counter 2 external clock input +#define AT91C_PIO_PA16 ((unsigned int) 1 << 16) // Pin Controlled by PA16 +#define AT91C_PA16_SPI0_MISO ((unsigned int) AT91C_PIO_PA16) // SPI 0 Master In Slave +#define AT91C_PIO_PA17 ((unsigned int) 1 << 17) // Pin Controlled by PA17 +#define AT91C_PA17_SPI0_MOSI ((unsigned int) AT91C_PIO_PA17) // SPI 0 Master Out Slave +#define AT91C_PIO_PA18 ((unsigned int) 1 << 18) // Pin Controlled by PA18 +#define AT91C_PA18_SPI0_SPCK ((unsigned int) AT91C_PIO_PA18) // SPI 0 Serial Clock +#define AT91C_PIO_PA19 ((unsigned int) 1 << 19) // Pin Controlled by PA19 +#define AT91C_PA19_CANRX ((unsigned int) AT91C_PIO_PA19) // CAN Receive +#define AT91C_PIO_PA2 ((unsigned int) 1 << 2) // Pin Controlled by PA2 +#define AT91C_PA2_SCK0 ((unsigned int) AT91C_PIO_PA2) // USART 0 Serial Clock +#define AT91C_PA2_SPI1_NPCS1 ((unsigned int) AT91C_PIO_PA2) // SPI 1 Peripheral Chip Select 1 +#define AT91C_PIO_PA20 ((unsigned int) 1 << 20) // Pin Controlled by PA20 +#define AT91C_PA20_CANTX ((unsigned int) AT91C_PIO_PA20) // CAN Transmit +#define AT91C_PIO_PA21 ((unsigned int) 1 << 21) // Pin Controlled by PA21 +#define AT91C_PA21_TF ((unsigned int) AT91C_PIO_PA21) // SSC Transmit Frame Sync +#define AT91C_PA21_SPI1_NPCS0 ((unsigned int) AT91C_PIO_PA21) // SPI 1 Peripheral Chip Select 0 +#define AT91C_PIO_PA22 ((unsigned int) 1 << 22) // Pin Controlled by PA22 +#define AT91C_PA22_TK ((unsigned int) AT91C_PIO_PA22) // SSC Transmit Clock +#define AT91C_PA22_SPI1_SPCK ((unsigned int) AT91C_PIO_PA22) // SPI 1 Serial Clock +#define AT91C_PIO_PA23 ((unsigned int) 1 << 23) // Pin Controlled by PA23 +#define AT91C_PA23_TD ((unsigned int) AT91C_PIO_PA23) // SSC Transmit data +#define AT91C_PA23_SPI1_MOSI ((unsigned int) AT91C_PIO_PA23) // SPI 1 Master Out Slave +#define AT91C_PIO_PA24 ((unsigned int) 1 << 24) // Pin Controlled by PA24 +#define AT91C_PA24_RD ((unsigned int) AT91C_PIO_PA24) // SSC Receive Data +#define AT91C_PA24_SPI1_MISO ((unsigned int) AT91C_PIO_PA24) // SPI 1 Master In Slave +#define AT91C_PIO_PA25 ((unsigned int) 1 << 25) // Pin Controlled by PA25 +#define AT91C_PA25_RK ((unsigned int) AT91C_PIO_PA25) // SSC Receive Clock +#define AT91C_PA25_SPI1_NPCS1 ((unsigned int) AT91C_PIO_PA25) // SPI 1 Peripheral Chip Select 1 +#define AT91C_PIO_PA26 ((unsigned int) 1 << 26) // Pin Controlled by PA26 +#define AT91C_PA26_RF ((unsigned int) AT91C_PIO_PA26) // SSC Receive Frame Sync +#define AT91C_PA26_SPI1_NPCS2 ((unsigned int) AT91C_PIO_PA26) // SPI 1 Peripheral Chip Select 2 +#define AT91C_PIO_PA27 ((unsigned int) 1 << 27) // Pin Controlled by PA27 +#define AT91C_PA27_DRXD ((unsigned int) AT91C_PIO_PA27) // DBGU Debug Receive Data +#define AT91C_PA27_PCK3 ((unsigned int) AT91C_PIO_PA27) // PMC Programmable Clock Output 3 +#define AT91C_PIO_PA28 ((unsigned int) 1 << 28) // Pin Controlled by PA28 +#define AT91C_PA28_DTXD ((unsigned int) AT91C_PIO_PA28) // DBGU Debug Transmit Data +#define AT91C_PIO_PA29 ((unsigned int) 1 << 29) // Pin Controlled by PA29 +#define AT91C_PA29_FIQ ((unsigned int) AT91C_PIO_PA29) // AIC Fast Interrupt Input +#define AT91C_PA29_SPI1_NPCS3 ((unsigned int) AT91C_PIO_PA29) // SPI 1 Peripheral Chip Select 3 +#define AT91C_PIO_PA3 ((unsigned int) 1 << 3) // Pin Controlled by PA3 +#define AT91C_PA3_RTS0 ((unsigned int) AT91C_PIO_PA3) // USART 0 Ready To Send +#define AT91C_PA3_SPI1_NPCS2 ((unsigned int) AT91C_PIO_PA3) // SPI 1 Peripheral Chip Select 2 +#define AT91C_PIO_PA30 ((unsigned int) 1 << 30) // Pin Controlled by PA30 +#define AT91C_PA30_IRQ0 ((unsigned int) AT91C_PIO_PA30) // External Interrupt 0 +#define AT91C_PA30_PCK2 ((unsigned int) AT91C_PIO_PA30) // PMC Programmable Clock Output 2 +#define AT91C_PIO_PA4 ((unsigned int) 1 << 4) // Pin Controlled by PA4 +#define AT91C_PA4_CTS0 ((unsigned int) AT91C_PIO_PA4) // USART 0 Clear To Send +#define AT91C_PA4_SPI1_NPCS3 ((unsigned int) AT91C_PIO_PA4) // SPI 1 Peripheral Chip Select 3 +#define AT91C_PIO_PA5 ((unsigned int) 1 << 5) // Pin Controlled by PA5 +#define AT91C_PA5_RXD1 ((unsigned int) AT91C_PIO_PA5) // USART 1 Receive Data +#define AT91C_PIO_PA6 ((unsigned int) 1 << 6) // Pin Controlled by PA6 +#define AT91C_PA6_TXD1 ((unsigned int) AT91C_PIO_PA6) // USART 1 Transmit Data +#define AT91C_PIO_PA7 ((unsigned int) 1 << 7) // Pin Controlled by PA7 +#define AT91C_PA7_SCK1 ((unsigned int) AT91C_PIO_PA7) // USART 1 Serial Clock +#define AT91C_PA7_SPI0_NPCS1 ((unsigned int) AT91C_PIO_PA7) // SPI 0 Peripheral Chip Select 1 +#define AT91C_PIO_PA8 ((unsigned int) 1 << 8) // Pin Controlled by PA8 +#define AT91C_PA8_RTS1 ((unsigned int) AT91C_PIO_PA8) // USART 1 Ready To Send +#define AT91C_PA8_SPI0_NPCS2 ((unsigned int) AT91C_PIO_PA8) // SPI 0 Peripheral Chip Select 2 +#define AT91C_PIO_PA9 ((unsigned int) 1 << 9) // Pin Controlled by PA9 +#define AT91C_PA9_CTS1 ((unsigned int) AT91C_PIO_PA9) // USART 1 Clear To Send +#define AT91C_PA9_SPI0_NPCS3 ((unsigned int) AT91C_PIO_PA9) // SPI 0 Peripheral Chip Select 3 +#define AT91C_PIO_PB0 ((unsigned int) 1 << 0) // Pin Controlled by PB0 +#define AT91C_PB0_ETXCK_EREFCK ((unsigned int) AT91C_PIO_PB0) // Ethernet MAC Transmit Clock/Reference Clock +#define AT91C_PB0_PCK0 ((unsigned int) AT91C_PIO_PB0) // PMC Programmable Clock Output 0 +#define AT91C_PIO_PB1 ((unsigned int) 1 << 1) // Pin Controlled by PB1 +#define AT91C_PB1_ETXEN ((unsigned int) AT91C_PIO_PB1) // Ethernet MAC Transmit Enable +#define AT91C_PIO_PB10 ((unsigned int) 1 << 10) // Pin Controlled by PB10 +#define AT91C_PB10_ETX2 ((unsigned int) AT91C_PIO_PB10) // Ethernet MAC Transmit Data 2 +#define AT91C_PB10_SPI1_NPCS1 ((unsigned int) AT91C_PIO_PB10) // SPI 1 Peripheral Chip Select 1 +#define AT91C_PIO_PB11 ((unsigned int) 1 << 11) // Pin Controlled by PB11 +#define AT91C_PB11_ETX3 ((unsigned int) AT91C_PIO_PB11) // Ethernet MAC Transmit Data 3 +#define AT91C_PB11_SPI1_NPCS2 ((unsigned int) AT91C_PIO_PB11) // SPI 1 Peripheral Chip Select 2 +#define AT91C_PIO_PB12 ((unsigned int) 1 << 12) // Pin Controlled by PB12 +#define AT91C_PB12_ETXER ((unsigned int) AT91C_PIO_PB12) // Ethernet MAC Transmikt Coding Error +#define AT91C_PB12_TCLK0 ((unsigned int) AT91C_PIO_PB12) // Timer Counter 0 external clock input +#define AT91C_PIO_PB13 ((unsigned int) 1 << 13) // Pin Controlled by PB13 +#define AT91C_PB13_ERX2 ((unsigned int) AT91C_PIO_PB13) // Ethernet MAC Receive Data 2 +#define AT91C_PB13_SPI0_NPCS1 ((unsigned int) AT91C_PIO_PB13) // SPI 0 Peripheral Chip Select 1 +#define AT91C_PIO_PB14 ((unsigned int) 1 << 14) // Pin Controlled by PB14 +#define AT91C_PB14_ERX3 ((unsigned int) AT91C_PIO_PB14) // Ethernet MAC Receive Data 3 +#define AT91C_PB14_SPI0_NPCS2 ((unsigned int) AT91C_PIO_PB14) // SPI 0 Peripheral Chip Select 2 +#define AT91C_PIO_PB15 ((unsigned int) 1 << 15) // Pin Controlled by PB15 +#define AT91C_PB15_ERXDV_ECRSDV ((unsigned int) AT91C_PIO_PB15) // Ethernet MAC Receive Data Valid +#define AT91C_PIO_PB16 ((unsigned int) 1 << 16) // Pin Controlled by PB16 +#define AT91C_PB16_ECOL ((unsigned int) AT91C_PIO_PB16) // Ethernet MAC Collision Detected +#define AT91C_PB16_SPI1_NPCS3 ((unsigned int) AT91C_PIO_PB16) // SPI 1 Peripheral Chip Select 3 +#define AT91C_PIO_PB17 ((unsigned int) 1 << 17) // Pin Controlled by PB17 +#define AT91C_PB17_ERXCK ((unsigned int) AT91C_PIO_PB17) // Ethernet MAC Receive Clock +#define AT91C_PB17_SPI0_NPCS3 ((unsigned int) AT91C_PIO_PB17) // SPI 0 Peripheral Chip Select 3 +#define AT91C_PIO_PB18 ((unsigned int) 1 << 18) // Pin Controlled by PB18 +#define AT91C_PB18_EF100 ((unsigned int) AT91C_PIO_PB18) // Ethernet MAC Force 100 Mbits/sec +#define AT91C_PB18_ADTRG ((unsigned int) AT91C_PIO_PB18) // ADC External Trigger +#define AT91C_PIO_PB19 ((unsigned int) 1 << 19) // Pin Controlled by PB19 +#define AT91C_PB19_PWM0 ((unsigned int) AT91C_PIO_PB19) // PWM Channel 0 +#define AT91C_PB19_TCLK1 ((unsigned int) AT91C_PIO_PB19) // Timer Counter 1 external clock input +#define AT91C_PIO_PB2 ((unsigned int) 1 << 2) // Pin Controlled by PB2 +#define AT91C_PB2_ETX0 ((unsigned int) AT91C_PIO_PB2) // Ethernet MAC Transmit Data 0 +#define AT91C_PIO_PB20 ((unsigned int) 1 << 20) // Pin Controlled by PB20 +#define AT91C_PB20_PWM1 ((unsigned int) AT91C_PIO_PB20) // PWM Channel 1 +#define AT91C_PB20_PCK0 ((unsigned int) AT91C_PIO_PB20) // PMC Programmable Clock Output 0 +#define AT91C_PIO_PB21 ((unsigned int) 1 << 21) // Pin Controlled by PB21 +#define AT91C_PB21_PWM2 ((unsigned int) AT91C_PIO_PB21) // PWM Channel 2 +#define AT91C_PB21_PCK1 ((unsigned int) AT91C_PIO_PB21) // PMC Programmable Clock Output 1 +#define AT91C_PIO_PB22 ((unsigned int) 1 << 22) // Pin Controlled by PB22 +#define AT91C_PB22_PWM3 ((unsigned int) AT91C_PIO_PB22) // PWM Channel 3 +#define AT91C_PB22_PCK2 ((unsigned int) AT91C_PIO_PB22) // PMC Programmable Clock Output 2 +#define AT91C_PIO_PB23 ((unsigned int) 1 << 23) // Pin Controlled by PB23 +#define AT91C_PB23_TIOA0 ((unsigned int) AT91C_PIO_PB23) // Timer Counter 0 Multipurpose Timer I/O Pin A +#define AT91C_PB23_DCD1 ((unsigned int) AT91C_PIO_PB23) // USART 1 Data Carrier Detect +#define AT91C_PIO_PB24 ((unsigned int) 1 << 24) // Pin Controlled by PB24 +#define AT91C_PB24_TIOB0 ((unsigned int) AT91C_PIO_PB24) // Timer Counter 0 Multipurpose Timer I/O Pin B +#define AT91C_PB24_DSR1 ((unsigned int) AT91C_PIO_PB24) // USART 1 Data Set ready +#define AT91C_PIO_PB25 ((unsigned int) 1 << 25) // Pin Controlled by PB25 +#define AT91C_PB25_TIOA1 ((unsigned int) AT91C_PIO_PB25) // Timer Counter 1 Multipurpose Timer I/O Pin A +#define AT91C_PB25_DTR1 ((unsigned int) AT91C_PIO_PB25) // USART 1 Data Terminal ready +#define AT91C_PIO_PB26 ((unsigned int) 1 << 26) // Pin Controlled by PB26 +#define AT91C_PB26_TIOB1 ((unsigned int) AT91C_PIO_PB26) // Timer Counter 1 Multipurpose Timer I/O Pin B +#define AT91C_PB26_RI1 ((unsigned int) AT91C_PIO_PB26) // USART 1 Ring Indicator +#define AT91C_PIO_PB27 ((unsigned int) 1 << 27) // Pin Controlled by PB27 +#define AT91C_PB27_TIOA2 ((unsigned int) AT91C_PIO_PB27) // Timer Counter 2 Multipurpose Timer I/O Pin A +#define AT91C_PB27_PWM0 ((unsigned int) AT91C_PIO_PB27) // PWM Channel 0 +#define AT91C_PIO_PB28 ((unsigned int) 1 << 28) // Pin Controlled by PB28 +#define AT91C_PB28_TIOB2 ((unsigned int) AT91C_PIO_PB28) // Timer Counter 2 Multipurpose Timer I/O Pin B +#define AT91C_PB28_PWM1 ((unsigned int) AT91C_PIO_PB28) // PWM Channel 1 +#define AT91C_PIO_PB29 ((unsigned int) 1 << 29) // Pin Controlled by PB29 +#define AT91C_PB29_PCK1 ((unsigned int) AT91C_PIO_PB29) // PMC Programmable Clock Output 1 +#define AT91C_PB29_PWM2 ((unsigned int) AT91C_PIO_PB29) // PWM Channel 2 +#define AT91C_PIO_PB3 ((unsigned int) 1 << 3) // Pin Controlled by PB3 +#define AT91C_PB3_ETX1 ((unsigned int) AT91C_PIO_PB3) // Ethernet MAC Transmit Data 1 +#define AT91C_PIO_PB30 ((unsigned int) 1 << 30) // Pin Controlled by PB30 +#define AT91C_PB30_PCK2 ((unsigned int) AT91C_PIO_PB30) // PMC Programmable Clock Output 2 +#define AT91C_PB30_PWM3 ((unsigned int) AT91C_PIO_PB30) // PWM Channel 3 +#define AT91C_PIO_PB4 ((unsigned int) 1 << 4) // Pin Controlled by PB4 +#define AT91C_PB4_ECRS ((unsigned int) AT91C_PIO_PB4) // Ethernet MAC Carrier Sense/Carrier Sense and Data Valid +#define AT91C_PIO_PB5 ((unsigned int) 1 << 5) // Pin Controlled by PB5 +#define AT91C_PB5_ERX0 ((unsigned int) AT91C_PIO_PB5) // Ethernet MAC Receive Data 0 +#define AT91C_PIO_PB6 ((unsigned int) 1 << 6) // Pin Controlled by PB6 +#define AT91C_PB6_ERX1 ((unsigned int) AT91C_PIO_PB6) // Ethernet MAC Receive Data 1 +#define AT91C_PIO_PB7 ((unsigned int) 1 << 7) // Pin Controlled by PB7 +#define AT91C_PB7_ERXER ((unsigned int) AT91C_PIO_PB7) // Ethernet MAC Receive Error +#define AT91C_PIO_PB8 ((unsigned int) 1 << 8) // Pin Controlled by PB8 +#define AT91C_PB8_EMDC ((unsigned int) AT91C_PIO_PB8) // Ethernet MAC Management Data Clock +#define AT91C_PIO_PB9 ((unsigned int) 1 << 9) // Pin Controlled by PB9 +#define AT91C_PB9_EMDIO ((unsigned int) AT91C_PIO_PB9) // Ethernet MAC Management Data Input/Output + +// ***************************************************************************** +// PERIPHERAL ID DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** +#define AT91C_ID_FIQ ((unsigned int) 0) // Advanced Interrupt Controller (FIQ) +#define AT91C_ID_SYS ((unsigned int) 1) // System Peripheral +#define AT91C_ID_PIOA ((unsigned int) 2) // Parallel IO Controller A +#define AT91C_ID_PIOB ((unsigned int) 3) // Parallel IO Controller B +#define AT91C_ID_SPI0 ((unsigned int) 4) // Serial Peripheral Interface 0 +#define AT91C_ID_SPI1 ((unsigned int) 5) // Serial Peripheral Interface 1 +#define AT91C_ID_US0 ((unsigned int) 6) // USART 0 +#define AT91C_ID_US1 ((unsigned int) 7) // USART 1 +#define AT91C_ID_SSC ((unsigned int) 8) // Serial Synchronous Controller +#define AT91C_ID_TWI ((unsigned int) 9) // Two-Wire Interface +#define AT91C_ID_PWMC ((unsigned int) 10) // PWM Controller +#define AT91C_ID_UDP ((unsigned int) 11) // USB Device Port +#define AT91C_ID_TC0 ((unsigned int) 12) // Timer Counter 0 +#define AT91C_ID_TC1 ((unsigned int) 13) // Timer Counter 1 +#define AT91C_ID_TC2 ((unsigned int) 14) // Timer Counter 2 +#define AT91C_ID_CAN ((unsigned int) 15) // Control Area Network Controller +#define AT91C_ID_EMAC ((unsigned int) 16) // Ethernet MAC +#define AT91C_ID_ADC ((unsigned int) 17) // Analog-to-Digital Converter +#define AT91C_ID_18_Reserved ((unsigned int) 18) // Reserved +#define AT91C_ID_19_Reserved ((unsigned int) 19) // Reserved +#define AT91C_ID_20_Reserved ((unsigned int) 20) // Reserved +#define AT91C_ID_21_Reserved ((unsigned int) 21) // Reserved +#define AT91C_ID_22_Reserved ((unsigned int) 22) // Reserved +#define AT91C_ID_23_Reserved ((unsigned int) 23) // Reserved +#define AT91C_ID_24_Reserved ((unsigned int) 24) // Reserved +#define AT91C_ID_25_Reserved ((unsigned int) 25) // Reserved +#define AT91C_ID_26_Reserved ((unsigned int) 26) // Reserved +#define AT91C_ID_27_Reserved ((unsigned int) 27) // Reserved +#define AT91C_ID_28_Reserved ((unsigned int) 28) // Reserved +#define AT91C_ID_29_Reserved ((unsigned int) 29) // Reserved +#define AT91C_ID_IRQ0 ((unsigned int) 30) // Advanced Interrupt Controller (IRQ0) +#define AT91C_ID_IRQ1 ((unsigned int) 31) // Advanced Interrupt Controller (IRQ1) +#define AT91C_ALL_INT ((unsigned int) 0xC003FFFF) // ALL VALID INTERRUPTS + +// ***************************************************************************** +// BASE ADDRESS DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** +#define AT91C_BASE_SYS ((AT91PS_SYS) 0xFFFFF000) // (SYS) Base Address +#define AT91C_BASE_AIC ((AT91PS_AIC) 0xFFFFF000) // (AIC) Base Address +#define AT91C_BASE_PDC_DBGU ((AT91PS_PDC) 0xFFFFF300) // (PDC_DBGU) Base Address +#define AT91C_BASE_DBGU ((AT91PS_DBGU) 0xFFFFF200) // (DBGU) Base Address +#define AT91C_BASE_PIOA ((AT91PS_PIO) 0xFFFFF400) // (PIOA) Base Address +#define AT91C_BASE_PIOB ((AT91PS_PIO) 0xFFFFF600) // (PIOB) Base Address +#define AT91C_BASE_CKGR ((AT91PS_CKGR) 0xFFFFFC20) // (CKGR) Base Address +#define AT91C_BASE_PMC ((AT91PS_PMC) 0xFFFFFC00) // (PMC) Base Address +#define AT91C_BASE_RSTC ((AT91PS_RSTC) 0xFFFFFD00) // (RSTC) Base Address +#define AT91C_BASE_RTTC ((AT91PS_RTTC) 0xFFFFFD20) // (RTTC) Base Address +#define AT91C_BASE_PITC ((AT91PS_PITC) 0xFFFFFD30) // (PITC) Base Address +#define AT91C_BASE_WDTC ((AT91PS_WDTC) 0xFFFFFD40) // (WDTC) Base Address +#define AT91C_BASE_VREG ((AT91PS_VREG) 0xFFFFFD60) // (VREG) Base Address +#define AT91C_BASE_MC ((AT91PS_MC) 0xFFFFFF00) // (MC) Base Address +#define AT91C_BASE_PDC_SPI1 ((AT91PS_PDC) 0xFFFE4100) // (PDC_SPI1) Base Address +#define AT91C_BASE_SPI1 ((AT91PS_SPI) 0xFFFE4000) // (SPI1) Base Address +#define AT91C_BASE_PDC_SPI0 ((AT91PS_PDC) 0xFFFE0100) // (PDC_SPI0) Base Address +#define AT91C_BASE_SPI0 ((AT91PS_SPI) 0xFFFE0000) // (SPI0) Base Address +#define AT91C_BASE_PDC_US1 ((AT91PS_PDC) 0xFFFC4100) // (PDC_US1) Base Address +#define AT91C_BASE_US1 ((AT91PS_USART) 0xFFFC4000) // (US1) Base Address +#define AT91C_BASE_PDC_US0 ((AT91PS_PDC) 0xFFFC0100) // (PDC_US0) Base Address +#define AT91C_BASE_US0 ((AT91PS_USART) 0xFFFC0000) // (US0) Base Address +#define AT91C_BASE_PDC_SSC ((AT91PS_PDC) 0xFFFD4100) // (PDC_SSC) Base Address +#define AT91C_BASE_SSC ((AT91PS_SSC) 0xFFFD4000) // (SSC) Base Address +#define AT91C_BASE_TWI ((AT91PS_TWI) 0xFFFB8000) // (TWI) Base Address +#define AT91C_BASE_PWMC_CH3 ((AT91PS_PWMC_CH) 0xFFFCC260) // (PWMC_CH3) Base Address +#define AT91C_BASE_PWMC_CH2 ((AT91PS_PWMC_CH) 0xFFFCC240) // (PWMC_CH2) Base Address +#define AT91C_BASE_PWMC_CH1 ((AT91PS_PWMC_CH) 0xFFFCC220) // (PWMC_CH1) Base Address +#define AT91C_BASE_PWMC_CH0 ((AT91PS_PWMC_CH) 0xFFFCC200) // (PWMC_CH0) Base Address +#define AT91C_BASE_PWMC ((AT91PS_PWMC) 0xFFFCC000) // (PWMC) Base Address +#define AT91C_BASE_UDP ((AT91PS_UDP) 0xFFFB0000) // (UDP) Base Address +#define AT91C_BASE_TC0 ((AT91PS_TC) 0xFFFA0000) // (TC0) Base Address +#define AT91C_BASE_TC1 ((AT91PS_TC) 0xFFFA0040) // (TC1) Base Address +#define AT91C_BASE_TC2 ((AT91PS_TC) 0xFFFA0080) // (TC2) Base Address +#define AT91C_BASE_TCB ((AT91PS_TCB) 0xFFFA0000) // (TCB) Base Address +#define AT91C_BASE_CAN_MB0 ((AT91PS_CAN_MB) 0xFFFD0200) // (CAN_MB0) Base Address +#define AT91C_BASE_CAN_MB1 ((AT91PS_CAN_MB) 0xFFFD0220) // (CAN_MB1) Base Address +#define AT91C_BASE_CAN_MB2 ((AT91PS_CAN_MB) 0xFFFD0240) // (CAN_MB2) Base Address +#define AT91C_BASE_CAN_MB3 ((AT91PS_CAN_MB) 0xFFFD0260) // (CAN_MB3) Base Address +#define AT91C_BASE_CAN_MB4 ((AT91PS_CAN_MB) 0xFFFD0280) // (CAN_MB4) Base Address +#define AT91C_BASE_CAN_MB5 ((AT91PS_CAN_MB) 0xFFFD02A0) // (CAN_MB5) Base Address +#define AT91C_BASE_CAN_MB6 ((AT91PS_CAN_MB) 0xFFFD02C0) // (CAN_MB6) Base Address +#define AT91C_BASE_CAN_MB7 ((AT91PS_CAN_MB) 0xFFFD02E0) // (CAN_MB7) Base Address +#define AT91C_BASE_CAN ((AT91PS_CAN) 0xFFFD0000) // (CAN) Base Address +#define AT91C_BASE_EMAC ((AT91PS_EMAC) 0xFFFDC000) // (EMAC) Base Address +#define AT91C_BASE_PDC_ADC ((AT91PS_PDC) 0xFFFD8100) // (PDC_ADC) Base Address +#define AT91C_BASE_ADC ((AT91PS_ADC) 0xFFFD8000) // (ADC) Base Address + +// ***************************************************************************** +// MEMORY MAPPING DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** +// ISRAM +#define AT91C_ISRAM ((char *) 0x00200000) // Internal SRAM base address +#define AT91C_ISRAM_SIZE ((unsigned int) 0x00010000) // Internal SRAM size in byte (64 Kbytes) +// IFLASH +#define AT91C_IFLASH ((char *) 0x00100000) // Internal FLASH base address +#define AT91C_IFLASH_SIZE ((unsigned int) 0x00040000) // Internal FLASH size in byte (256 Kbytes) +#define AT91C_IFLASH_PAGE_SIZE ((unsigned int) 256) // Internal FLASH Page Size: 256 bytes +#define AT91C_IFLASH_LOCK_REGION_SIZE ((unsigned int) 16384) // Internal FLASH Lock Region Size: 16 Kbytes +#define AT91C_IFLASH_NB_OF_PAGES ((unsigned int) 1024) // Internal FLASH Number of Pages: 1024 bytes +#define AT91C_IFLASH_NB_OF_LOCK_BITS ((unsigned int) 16) // Internal FLASH Number of Lock Bits: 16 bytes +#endif /* __IAR_SYSTEMS_ICC__ */ + +#ifdef __IAR_SYSTEMS_ASM__ + +// - Hardware register definition + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR System Peripherals +// - ***************************************************************************** + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Advanced Interrupt Controller +// - ***************************************************************************** +// - -------- AIC_SMR : (AIC Offset: 0x0) Control Register -------- +AT91C_AIC_PRIOR EQU (0x7 << 0) ;- (AIC) Priority Level +AT91C_AIC_PRIOR_LOWEST EQU (0x0) ;- (AIC) Lowest priority level +AT91C_AIC_PRIOR_HIGHEST EQU (0x7) ;- (AIC) Highest priority level +AT91C_AIC_SRCTYPE EQU (0x3 << 5) ;- (AIC) Interrupt Source Type +AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL EQU (0x0 << 5) ;- (AIC) Internal Sources Code Label High-level Sensitive +AT91C_AIC_SRCTYPE_EXT_LOW_LEVEL EQU (0x0 << 5) ;- (AIC) External Sources Code Label Low-level Sensitive +AT91C_AIC_SRCTYPE_INT_POSITIVE_EDGE EQU (0x1 << 5) ;- (AIC) Internal Sources Code Label Positive Edge triggered +AT91C_AIC_SRCTYPE_EXT_NEGATIVE_EDGE EQU (0x1 << 5) ;- (AIC) External Sources Code Label Negative Edge triggered +AT91C_AIC_SRCTYPE_HIGH_LEVEL EQU (0x2 << 5) ;- (AIC) Internal Or External Sources Code Label High-level Sensitive +AT91C_AIC_SRCTYPE_POSITIVE_EDGE EQU (0x3 << 5) ;- (AIC) Internal Or External Sources Code Label Positive Edge triggered +// - -------- AIC_CISR : (AIC Offset: 0x114) AIC Core Interrupt Status Register -------- +AT91C_AIC_NFIQ EQU (0x1 << 0) ;- (AIC) NFIQ Status +AT91C_AIC_NIRQ EQU (0x1 << 1) ;- (AIC) NIRQ Status +// - -------- AIC_DCR : (AIC Offset: 0x138) AIC Debug Control Register (Protect) -------- +AT91C_AIC_DCR_PROT EQU (0x1 << 0) ;- (AIC) Protection Mode +AT91C_AIC_DCR_GMSK EQU (0x1 << 1) ;- (AIC) General Mask + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Peripheral DMA Controller +// - ***************************************************************************** +// - -------- PDC_PTCR : (PDC Offset: 0x20) PDC Transfer Control Register -------- +AT91C_PDC_RXTEN EQU (0x1 << 0) ;- (PDC) Receiver Transfer Enable +AT91C_PDC_RXTDIS EQU (0x1 << 1) ;- (PDC) Receiver Transfer Disable +AT91C_PDC_TXTEN EQU (0x1 << 8) ;- (PDC) Transmitter Transfer Enable +AT91C_PDC_TXTDIS EQU (0x1 << 9) ;- (PDC) Transmitter Transfer Disable +// - -------- PDC_PTSR : (PDC Offset: 0x24) PDC Transfer Status Register -------- + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Debug Unit +// - ***************************************************************************** +// - -------- DBGU_CR : (DBGU Offset: 0x0) Debug Unit Control Register -------- +AT91C_US_RSTRX EQU (0x1 << 2) ;- (DBGU) Reset Receiver +AT91C_US_RSTTX EQU (0x1 << 3) ;- (DBGU) Reset Transmitter +AT91C_US_RXEN EQU (0x1 << 4) ;- (DBGU) Receiver Enable +AT91C_US_RXDIS EQU (0x1 << 5) ;- (DBGU) Receiver Disable +AT91C_US_TXEN EQU (0x1 << 6) ;- (DBGU) Transmitter Enable +AT91C_US_TXDIS EQU (0x1 << 7) ;- (DBGU) Transmitter Disable +AT91C_US_RSTSTA EQU (0x1 << 8) ;- (DBGU) Reset Status Bits +// - -------- DBGU_MR : (DBGU Offset: 0x4) Debug Unit Mode Register -------- +AT91C_US_PAR EQU (0x7 << 9) ;- (DBGU) Parity type +AT91C_US_PAR_EVEN EQU (0x0 << 9) ;- (DBGU) Even Parity +AT91C_US_PAR_ODD EQU (0x1 << 9) ;- (DBGU) Odd Parity +AT91C_US_PAR_SPACE EQU (0x2 << 9) ;- (DBGU) Parity forced to 0 (Space) +AT91C_US_PAR_MARK EQU (0x3 << 9) ;- (DBGU) Parity forced to 1 (Mark) +AT91C_US_PAR_NONE EQU (0x4 << 9) ;- (DBGU) No Parity +AT91C_US_PAR_MULTI_DROP EQU (0x6 << 9) ;- (DBGU) Multi-drop mode +AT91C_US_CHMODE EQU (0x3 << 14) ;- (DBGU) Channel Mode +AT91C_US_CHMODE_NORMAL EQU (0x0 << 14) ;- (DBGU) Normal Mode: The USART channel operates as an RX/TX USART. +AT91C_US_CHMODE_AUTO EQU (0x1 << 14) ;- (DBGU) Automatic Echo: Receiver Data Input is connected to the TXD pin. +AT91C_US_CHMODE_LOCAL EQU (0x2 << 14) ;- (DBGU) Local Loopback: Transmitter Output Signal is connected to Receiver Input Signal. +AT91C_US_CHMODE_REMOTE EQU (0x3 << 14) ;- (DBGU) Remote Loopback: RXD pin is internally connected to TXD pin. +// - -------- DBGU_IER : (DBGU Offset: 0x8) Debug Unit Interrupt Enable Register -------- +AT91C_US_RXRDY EQU (0x1 << 0) ;- (DBGU) RXRDY Interrupt +AT91C_US_TXRDY EQU (0x1 << 1) ;- (DBGU) TXRDY Interrupt +AT91C_US_ENDRX EQU (0x1 << 3) ;- (DBGU) End of Receive Transfer Interrupt +AT91C_US_ENDTX EQU (0x1 << 4) ;- (DBGU) End of Transmit Interrupt +AT91C_US_OVRE EQU (0x1 << 5) ;- (DBGU) Overrun Interrupt +AT91C_US_FRAME EQU (0x1 << 6) ;- (DBGU) Framing Error Interrupt +AT91C_US_PARE EQU (0x1 << 7) ;- (DBGU) Parity Error Interrupt +AT91C_US_TXEMPTY EQU (0x1 << 9) ;- (DBGU) TXEMPTY Interrupt +AT91C_US_TXBUFE EQU (0x1 << 11) ;- (DBGU) TXBUFE Interrupt +AT91C_US_RXBUFF EQU (0x1 << 12) ;- (DBGU) RXBUFF Interrupt +AT91C_US_COMM_TX EQU (0x1 << 30) ;- (DBGU) COMM_TX Interrupt +AT91C_US_COMM_RX EQU (0x1 << 31) ;- (DBGU) COMM_RX Interrupt +// - -------- DBGU_IDR : (DBGU Offset: 0xc) Debug Unit Interrupt Disable Register -------- +// - -------- DBGU_IMR : (DBGU Offset: 0x10) Debug Unit Interrupt Mask Register -------- +// - -------- DBGU_CSR : (DBGU Offset: 0x14) Debug Unit Channel Status Register -------- +// - -------- DBGU_FNTR : (DBGU Offset: 0x48) Debug Unit FORCE_NTRST Register -------- +AT91C_US_FORCE_NTRST EQU (0x1 << 0) ;- (DBGU) Force NTRST in JTAG + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Parallel Input Output Controler +// - ***************************************************************************** + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Clock Generator Controler +// - ***************************************************************************** +// - -------- CKGR_MOR : (CKGR Offset: 0x0) Main Oscillator Register -------- +AT91C_CKGR_MOSCEN EQU (0x1 << 0) ;- (CKGR) Main Oscillator Enable +AT91C_CKGR_OSCBYPASS EQU (0x1 << 1) ;- (CKGR) Main Oscillator Bypass +AT91C_CKGR_OSCOUNT EQU (0xFF << 8) ;- (CKGR) Main Oscillator Start-up Time +// - -------- CKGR_MCFR : (CKGR Offset: 0x4) Main Clock Frequency Register -------- +AT91C_CKGR_MAINF EQU (0xFFFF << 0) ;- (CKGR) Main Clock Frequency +AT91C_CKGR_MAINRDY EQU (0x1 << 16) ;- (CKGR) Main Clock Ready +// - -------- CKGR_PLLR : (CKGR Offset: 0xc) PLL B Register -------- +AT91C_CKGR_DIV EQU (0xFF << 0) ;- (CKGR) Divider Selected +AT91C_CKGR_DIV_0 EQU (0x0) ;- (CKGR) Divider output is 0 +AT91C_CKGR_DIV_BYPASS EQU (0x1) ;- (CKGR) Divider is bypassed +AT91C_CKGR_PLLCOUNT EQU (0x3F << 8) ;- (CKGR) PLL Counter +AT91C_CKGR_OUT EQU (0x3 << 14) ;- (CKGR) PLL Output Frequency Range +AT91C_CKGR_OUT_0 EQU (0x0 << 14) ;- (CKGR) Please refer to the PLL datasheet +AT91C_CKGR_OUT_1 EQU (0x1 << 14) ;- (CKGR) Please refer to the PLL datasheet +AT91C_CKGR_OUT_2 EQU (0x2 << 14) ;- (CKGR) Please refer to the PLL datasheet +AT91C_CKGR_OUT_3 EQU (0x3 << 14) ;- (CKGR) Please refer to the PLL datasheet +AT91C_CKGR_MUL EQU (0x7FF << 16) ;- (CKGR) PLL Multiplier +AT91C_CKGR_USBDIV EQU (0x3 << 28) ;- (CKGR) Divider for USB Clocks +AT91C_CKGR_USBDIV_0 EQU (0x0 << 28) ;- (CKGR) Divider output is PLL clock output +AT91C_CKGR_USBDIV_1 EQU (0x1 << 28) ;- (CKGR) Divider output is PLL clock output divided by 2 +AT91C_CKGR_USBDIV_2 EQU (0x2 << 28) ;- (CKGR) Divider output is PLL clock output divided by 4 + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Power Management Controler +// - ***************************************************************************** +// - -------- PMC_SCER : (PMC Offset: 0x0) System Clock Enable Register -------- +AT91C_PMC_PCK EQU (0x1 << 0) ;- (PMC) Processor Clock +AT91C_PMC_UDP EQU (0x1 << 7) ;- (PMC) USB Device Port Clock +AT91C_PMC_PCK0 EQU (0x1 << 8) ;- (PMC) Programmable Clock Output +AT91C_PMC_PCK1 EQU (0x1 << 9) ;- (PMC) Programmable Clock Output +AT91C_PMC_PCK2 EQU (0x1 << 10) ;- (PMC) Programmable Clock Output +AT91C_PMC_PCK3 EQU (0x1 << 11) ;- (PMC) Programmable Clock Output +// - -------- PMC_SCDR : (PMC Offset: 0x4) System Clock Disable Register -------- +// - -------- PMC_SCSR : (PMC Offset: 0x8) System Clock Status Register -------- +// - -------- CKGR_MOR : (PMC Offset: 0x20) Main Oscillator Register -------- +// - -------- CKGR_MCFR : (PMC Offset: 0x24) Main Clock Frequency Register -------- +// - -------- CKGR_PLLR : (PMC Offset: 0x2c) PLL B Register -------- +// - -------- PMC_MCKR : (PMC Offset: 0x30) Master Clock Register -------- +AT91C_PMC_CSS EQU (0x3 << 0) ;- (PMC) Programmable Clock Selection +AT91C_PMC_CSS_SLOW_CLK EQU (0x0) ;- (PMC) Slow Clock is selected +AT91C_PMC_CSS_MAIN_CLK EQU (0x1) ;- (PMC) Main Clock is selected +AT91C_PMC_CSS_PLL_CLK EQU (0x3) ;- (PMC) Clock from PLL is selected +AT91C_PMC_PRES EQU (0x7 << 2) ;- (PMC) Programmable Clock Prescaler +AT91C_PMC_PRES_CLK EQU (0x0 << 2) ;- (PMC) Selected clock +AT91C_PMC_PRES_CLK_2 EQU (0x1 << 2) ;- (PMC) Selected clock divided by 2 +AT91C_PMC_PRES_CLK_4 EQU (0x2 << 2) ;- (PMC) Selected clock divided by 4 +AT91C_PMC_PRES_CLK_8 EQU (0x3 << 2) ;- (PMC) Selected clock divided by 8 +AT91C_PMC_PRES_CLK_16 EQU (0x4 << 2) ;- (PMC) Selected clock divided by 16 +AT91C_PMC_PRES_CLK_32 EQU (0x5 << 2) ;- (PMC) Selected clock divided by 32 +AT91C_PMC_PRES_CLK_64 EQU (0x6 << 2) ;- (PMC) Selected clock divided by 64 +// - -------- PMC_PCKR : (PMC Offset: 0x40) Programmable Clock Register -------- +// - -------- PMC_IER : (PMC Offset: 0x60) PMC Interrupt Enable Register -------- +AT91C_PMC_MOSCS EQU (0x1 << 0) ;- (PMC) MOSC Status/Enable/Disable/Mask +AT91C_PMC_LOCK EQU (0x1 << 2) ;- (PMC) PLL Status/Enable/Disable/Mask +AT91C_PMC_MCKRDY EQU (0x1 << 3) ;- (PMC) MCK_RDY Status/Enable/Disable/Mask +AT91C_PMC_PCK0RDY EQU (0x1 << 8) ;- (PMC) PCK0_RDY Status/Enable/Disable/Mask +AT91C_PMC_PCK1RDY EQU (0x1 << 9) ;- (PMC) PCK1_RDY Status/Enable/Disable/Mask +AT91C_PMC_PCK2RDY EQU (0x1 << 10) ;- (PMC) PCK2_RDY Status/Enable/Disable/Mask +AT91C_PMC_PCK3RDY EQU (0x1 << 11) ;- (PMC) PCK3_RDY Status/Enable/Disable/Mask +// - -------- PMC_IDR : (PMC Offset: 0x64) PMC Interrupt Disable Register -------- +// - -------- PMC_SR : (PMC Offset: 0x68) PMC Status Register -------- +// - -------- PMC_IMR : (PMC Offset: 0x6c) PMC Interrupt Mask Register -------- + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Reset Controller Interface +// - ***************************************************************************** +// - -------- RSTC_RCR : (RSTC Offset: 0x0) Reset Control Register -------- +AT91C_RSTC_PROCRST EQU (0x1 << 0) ;- (RSTC) Processor Reset +AT91C_RSTC_PERRST EQU (0x1 << 2) ;- (RSTC) Peripheral Reset +AT91C_RSTC_EXTRST EQU (0x1 << 3) ;- (RSTC) External Reset +AT91C_RSTC_KEY EQU (0xFF << 24) ;- (RSTC) Password +// - -------- RSTC_RSR : (RSTC Offset: 0x4) Reset Status Register -------- +AT91C_RSTC_URSTS EQU (0x1 << 0) ;- (RSTC) User Reset Status +AT91C_RSTC_BODSTS EQU (0x1 << 1) ;- (RSTC) Brownout Detection Status +AT91C_RSTC_RSTTYP EQU (0x7 << 8) ;- (RSTC) Reset Type +AT91C_RSTC_RSTTYP_POWERUP EQU (0x0 << 8) ;- (RSTC) Power-up Reset. VDDCORE rising. +AT91C_RSTC_RSTTYP_WAKEUP EQU (0x1 << 8) ;- (RSTC) WakeUp Reset. VDDCORE rising. +AT91C_RSTC_RSTTYP_WATCHDOG EQU (0x2 << 8) ;- (RSTC) Watchdog Reset. Watchdog overflow occured. +AT91C_RSTC_RSTTYP_SOFTWARE EQU (0x3 << 8) ;- (RSTC) Software Reset. Processor reset required by the software. +AT91C_RSTC_RSTTYP_USER EQU (0x4 << 8) ;- (RSTC) User Reset. NRST pin detected low. +AT91C_RSTC_RSTTYP_BROWNOUT EQU (0x5 << 8) ;- (RSTC) Brownout Reset occured. +AT91C_RSTC_NRSTL EQU (0x1 << 16) ;- (RSTC) NRST pin level +AT91C_RSTC_SRCMP EQU (0x1 << 17) ;- (RSTC) Software Reset Command in Progress. +// - -------- RSTC_RMR : (RSTC Offset: 0x8) Reset Mode Register -------- +AT91C_RSTC_URSTEN EQU (0x1 << 0) ;- (RSTC) User Reset Enable +AT91C_RSTC_URSTIEN EQU (0x1 << 4) ;- (RSTC) User Reset Interrupt Enable +AT91C_RSTC_ERSTL EQU (0xF << 8) ;- (RSTC) User Reset Length +AT91C_RSTC_BODIEN EQU (0x1 << 16) ;- (RSTC) Brownout Detection Interrupt Enable + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Real Time Timer Controller Interface +// - ***************************************************************************** +// - -------- RTTC_RTMR : (RTTC Offset: 0x0) Real-time Mode Register -------- +AT91C_RTTC_RTPRES EQU (0xFFFF << 0) ;- (RTTC) Real-time Timer Prescaler Value +AT91C_RTTC_ALMIEN EQU (0x1 << 16) ;- (RTTC) Alarm Interrupt Enable +AT91C_RTTC_RTTINCIEN EQU (0x1 << 17) ;- (RTTC) Real Time Timer Increment Interrupt Enable +AT91C_RTTC_RTTRST EQU (0x1 << 18) ;- (RTTC) Real Time Timer Restart +// - -------- RTTC_RTAR : (RTTC Offset: 0x4) Real-time Alarm Register -------- +AT91C_RTTC_ALMV EQU (0x0 << 0) ;- (RTTC) Alarm Value +// - -------- RTTC_RTVR : (RTTC Offset: 0x8) Current Real-time Value Register -------- +AT91C_RTTC_CRTV EQU (0x0 << 0) ;- (RTTC) Current Real-time Value +// - -------- RTTC_RTSR : (RTTC Offset: 0xc) Real-time Status Register -------- +AT91C_RTTC_ALMS EQU (0x1 << 0) ;- (RTTC) Real-time Alarm Status +AT91C_RTTC_RTTINC EQU (0x1 << 1) ;- (RTTC) Real-time Timer Increment + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Periodic Interval Timer Controller Interface +// - ***************************************************************************** +// - -------- PITC_PIMR : (PITC Offset: 0x0) Periodic Interval Mode Register -------- +AT91C_PITC_PIV EQU (0xFFFFF << 0) ;- (PITC) Periodic Interval Value +AT91C_PITC_PITEN EQU (0x1 << 24) ;- (PITC) Periodic Interval Timer Enabled +AT91C_PITC_PITIEN EQU (0x1 << 25) ;- (PITC) Periodic Interval Timer Interrupt Enable +// - -------- PITC_PISR : (PITC Offset: 0x4) Periodic Interval Status Register -------- +AT91C_PITC_PITS EQU (0x1 << 0) ;- (PITC) Periodic Interval Timer Status +// - -------- PITC_PIVR : (PITC Offset: 0x8) Periodic Interval Value Register -------- +AT91C_PITC_CPIV EQU (0xFFFFF << 0) ;- (PITC) Current Periodic Interval Value +AT91C_PITC_PICNT EQU (0xFFF << 20) ;- (PITC) Periodic Interval Counter +// - -------- PITC_PIIR : (PITC Offset: 0xc) Periodic Interval Image Register -------- + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Watchdog Timer Controller Interface +// - ***************************************************************************** +// - -------- WDTC_WDCR : (WDTC Offset: 0x0) Periodic Interval Image Register -------- +AT91C_WDTC_WDRSTT EQU (0x1 << 0) ;- (WDTC) Watchdog Restart +AT91C_WDTC_KEY EQU (0xFF << 24) ;- (WDTC) Watchdog KEY Password +// - -------- WDTC_WDMR : (WDTC Offset: 0x4) Watchdog Mode Register -------- +AT91C_WDTC_WDV EQU (0xFFF << 0) ;- (WDTC) Watchdog Timer Restart +AT91C_WDTC_WDFIEN EQU (0x1 << 12) ;- (WDTC) Watchdog Fault Interrupt Enable +AT91C_WDTC_WDRSTEN EQU (0x1 << 13) ;- (WDTC) Watchdog Reset Enable +AT91C_WDTC_WDRPROC EQU (0x1 << 14) ;- (WDTC) Watchdog Timer Restart +AT91C_WDTC_WDDIS EQU (0x1 << 15) ;- (WDTC) Watchdog Disable +AT91C_WDTC_WDD EQU (0xFFF << 16) ;- (WDTC) Watchdog Delta Value +AT91C_WDTC_WDDBGHLT EQU (0x1 << 28) ;- (WDTC) Watchdog Debug Halt +AT91C_WDTC_WDIDLEHLT EQU (0x1 << 29) ;- (WDTC) Watchdog Idle Halt +// - -------- WDTC_WDSR : (WDTC Offset: 0x8) Watchdog Status Register -------- +AT91C_WDTC_WDUNF EQU (0x1 << 0) ;- (WDTC) Watchdog Underflow +AT91C_WDTC_WDERR EQU (0x1 << 1) ;- (WDTC) Watchdog Error + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Voltage Regulator Mode Controller Interface +// - ***************************************************************************** +// - -------- VREG_MR : (VREG Offset: 0x0) Voltage Regulator Mode Register -------- +AT91C_VREG_PSTDBY EQU (0x1 << 0) ;- (VREG) Voltage Regulator Power Standby Mode + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Memory Controller Interface +// - ***************************************************************************** +// - -------- MC_RCR : (MC Offset: 0x0) MC Remap Control Register -------- +AT91C_MC_RCB EQU (0x1 << 0) ;- (MC) Remap Command Bit +// - -------- MC_ASR : (MC Offset: 0x4) MC Abort Status Register -------- +AT91C_MC_UNDADD EQU (0x1 << 0) ;- (MC) Undefined Addess Abort Status +AT91C_MC_MISADD EQU (0x1 << 1) ;- (MC) Misaligned Addess Abort Status +AT91C_MC_ABTSZ EQU (0x3 << 8) ;- (MC) Abort Size Status +AT91C_MC_ABTSZ_BYTE EQU (0x0 << 8) ;- (MC) Byte +AT91C_MC_ABTSZ_HWORD EQU (0x1 << 8) ;- (MC) Half-word +AT91C_MC_ABTSZ_WORD EQU (0x2 << 8) ;- (MC) Word +AT91C_MC_ABTTYP EQU (0x3 << 10) ;- (MC) Abort Type Status +AT91C_MC_ABTTYP_DATAR EQU (0x0 << 10) ;- (MC) Data Read +AT91C_MC_ABTTYP_DATAW EQU (0x1 << 10) ;- (MC) Data Write +AT91C_MC_ABTTYP_FETCH EQU (0x2 << 10) ;- (MC) Code Fetch +AT91C_MC_MST0 EQU (0x1 << 16) ;- (MC) Master 0 Abort Source +AT91C_MC_MST1 EQU (0x1 << 17) ;- (MC) Master 1 Abort Source +AT91C_MC_SVMST0 EQU (0x1 << 24) ;- (MC) Saved Master 0 Abort Source +AT91C_MC_SVMST1 EQU (0x1 << 25) ;- (MC) Saved Master 1 Abort Source +// - -------- MC_FMR : (MC Offset: 0x60) MC Flash Mode Register -------- +AT91C_MC_FRDY EQU (0x1 << 0) ;- (MC) Flash Ready +AT91C_MC_LOCKE EQU (0x1 << 2) ;- (MC) Lock Error +AT91C_MC_PROGE EQU (0x1 << 3) ;- (MC) Programming Error +AT91C_MC_NEBP EQU (0x1 << 7) ;- (MC) No Erase Before Programming +AT91C_MC_FWS EQU (0x3 << 8) ;- (MC) Flash Wait State +AT91C_MC_FWS_0FWS EQU (0x0 << 8) ;- (MC) 1 cycle for Read, 2 for Write operations +AT91C_MC_FWS_1FWS EQU (0x1 << 8) ;- (MC) 2 cycles for Read, 3 for Write operations +AT91C_MC_FWS_2FWS EQU (0x2 << 8) ;- (MC) 3 cycles for Read, 4 for Write operations +AT91C_MC_FWS_3FWS EQU (0x3 << 8) ;- (MC) 4 cycles for Read, 4 for Write operations +AT91C_MC_FMCN EQU (0xFF << 16) ;- (MC) Flash Microsecond Cycle Number +// - -------- MC_FCR : (MC Offset: 0x64) MC Flash Command Register -------- +AT91C_MC_FCMD EQU (0xF << 0) ;- (MC) Flash Command +AT91C_MC_FCMD_START_PROG EQU (0x1) ;- (MC) Starts the programming of th epage specified by PAGEN. +AT91C_MC_FCMD_LOCK EQU (0x2) ;- (MC) Starts a lock sequence of the sector defined by the bits 4 to 7 of the field PAGEN. +AT91C_MC_FCMD_PROG_AND_LOCK EQU (0x3) ;- (MC) The lock sequence automatically happens after the programming sequence is completed. +AT91C_MC_FCMD_UNLOCK EQU (0x4) ;- (MC) Starts an unlock sequence of the sector defined by the bits 4 to 7 of the field PAGEN. +AT91C_MC_FCMD_ERASE_ALL EQU (0x8) ;- (MC) Starts the erase of the entire flash.If at least a page is locked, the command is cancelled. +AT91C_MC_FCMD_SET_GP_NVM EQU (0xB) ;- (MC) Set General Purpose NVM bits. +AT91C_MC_FCMD_CLR_GP_NVM EQU (0xD) ;- (MC) Clear General Purpose NVM bits. +AT91C_MC_FCMD_SET_SECURITY EQU (0xF) ;- (MC) Set Security Bit. +AT91C_MC_PAGEN EQU (0x3FF << 8) ;- (MC) Page Number +AT91C_MC_KEY EQU (0xFF << 24) ;- (MC) Writing Protect Key +// - -------- MC_FSR : (MC Offset: 0x68) MC Flash Command Register -------- +AT91C_MC_SECURITY EQU (0x1 << 4) ;- (MC) Security Bit Status +AT91C_MC_GPNVM0 EQU (0x1 << 8) ;- (MC) Sector 0 Lock Status +AT91C_MC_GPNVM1 EQU (0x1 << 9) ;- (MC) Sector 1 Lock Status +AT91C_MC_GPNVM2 EQU (0x1 << 10) ;- (MC) Sector 2 Lock Status +AT91C_MC_GPNVM3 EQU (0x1 << 11) ;- (MC) Sector 3 Lock Status +AT91C_MC_GPNVM4 EQU (0x1 << 12) ;- (MC) Sector 4 Lock Status +AT91C_MC_GPNVM5 EQU (0x1 << 13) ;- (MC) Sector 5 Lock Status +AT91C_MC_GPNVM6 EQU (0x1 << 14) ;- (MC) Sector 6 Lock Status +AT91C_MC_GPNVM7 EQU (0x1 << 15) ;- (MC) Sector 7 Lock Status +AT91C_MC_LOCKS0 EQU (0x1 << 16) ;- (MC) Sector 0 Lock Status +AT91C_MC_LOCKS1 EQU (0x1 << 17) ;- (MC) Sector 1 Lock Status +AT91C_MC_LOCKS2 EQU (0x1 << 18) ;- (MC) Sector 2 Lock Status +AT91C_MC_LOCKS3 EQU (0x1 << 19) ;- (MC) Sector 3 Lock Status +AT91C_MC_LOCKS4 EQU (0x1 << 20) ;- (MC) Sector 4 Lock Status +AT91C_MC_LOCKS5 EQU (0x1 << 21) ;- (MC) Sector 5 Lock Status +AT91C_MC_LOCKS6 EQU (0x1 << 22) ;- (MC) Sector 6 Lock Status +AT91C_MC_LOCKS7 EQU (0x1 << 23) ;- (MC) Sector 7 Lock Status +AT91C_MC_LOCKS8 EQU (0x1 << 24) ;- (MC) Sector 8 Lock Status +AT91C_MC_LOCKS9 EQU (0x1 << 25) ;- (MC) Sector 9 Lock Status +AT91C_MC_LOCKS10 EQU (0x1 << 26) ;- (MC) Sector 10 Lock Status +AT91C_MC_LOCKS11 EQU (0x1 << 27) ;- (MC) Sector 11 Lock Status +AT91C_MC_LOCKS12 EQU (0x1 << 28) ;- (MC) Sector 12 Lock Status +AT91C_MC_LOCKS13 EQU (0x1 << 29) ;- (MC) Sector 13 Lock Status +AT91C_MC_LOCKS14 EQU (0x1 << 30) ;- (MC) Sector 14 Lock Status +AT91C_MC_LOCKS15 EQU (0x1 << 31) ;- (MC) Sector 15 Lock Status + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Serial Parallel Interface +// - ***************************************************************************** +// - -------- SPI_CR : (SPI Offset: 0x0) SPI Control Register -------- +AT91C_SPI_SPIEN EQU (0x1 << 0) ;- (SPI) SPI Enable +AT91C_SPI_SPIDIS EQU (0x1 << 1) ;- (SPI) SPI Disable +AT91C_SPI_SWRST EQU (0x1 << 7) ;- (SPI) SPI Software reset +AT91C_SPI_LASTXFER EQU (0x1 << 24) ;- (SPI) SPI Last Transfer +// - -------- SPI_MR : (SPI Offset: 0x4) SPI Mode Register -------- +AT91C_SPI_MSTR EQU (0x1 << 0) ;- (SPI) Master/Slave Mode +AT91C_SPI_PS EQU (0x1 << 1) ;- (SPI) Peripheral Select +AT91C_SPI_PS_FIXED EQU (0x0 << 1) ;- (SPI) Fixed Peripheral Select +AT91C_SPI_PS_VARIABLE EQU (0x1 << 1) ;- (SPI) Variable Peripheral Select +AT91C_SPI_PCSDEC EQU (0x1 << 2) ;- (SPI) Chip Select Decode +AT91C_SPI_FDIV EQU (0x1 << 3) ;- (SPI) Clock Selection +AT91C_SPI_MODFDIS EQU (0x1 << 4) ;- (SPI) Mode Fault Detection +AT91C_SPI_LLB EQU (0x1 << 7) ;- (SPI) Clock Selection +AT91C_SPI_PCS EQU (0xF << 16) ;- (SPI) Peripheral Chip Select +AT91C_SPI_DLYBCS EQU (0xFF << 24) ;- (SPI) Delay Between Chip Selects +// - -------- SPI_RDR : (SPI Offset: 0x8) Receive Data Register -------- +AT91C_SPI_RD EQU (0xFFFF << 0) ;- (SPI) Receive Data +AT91C_SPI_RPCS EQU (0xF << 16) ;- (SPI) Peripheral Chip Select Status +// - -------- SPI_TDR : (SPI Offset: 0xc) Transmit Data Register -------- +AT91C_SPI_TD EQU (0xFFFF << 0) ;- (SPI) Transmit Data +AT91C_SPI_TPCS EQU (0xF << 16) ;- (SPI) Peripheral Chip Select Status +// - -------- SPI_SR : (SPI Offset: 0x10) Status Register -------- +AT91C_SPI_RDRF EQU (0x1 << 0) ;- (SPI) Receive Data Register Full +AT91C_SPI_TDRE EQU (0x1 << 1) ;- (SPI) Transmit Data Register Empty +AT91C_SPI_MODF EQU (0x1 << 2) ;- (SPI) Mode Fault Error +AT91C_SPI_OVRES EQU (0x1 << 3) ;- (SPI) Overrun Error Status +AT91C_SPI_ENDRX EQU (0x1 << 4) ;- (SPI) End of Receiver Transfer +AT91C_SPI_ENDTX EQU (0x1 << 5) ;- (SPI) End of Receiver Transfer +AT91C_SPI_RXBUFF EQU (0x1 << 6) ;- (SPI) RXBUFF Interrupt +AT91C_SPI_TXBUFE EQU (0x1 << 7) ;- (SPI) TXBUFE Interrupt +AT91C_SPI_NSSR EQU (0x1 << 8) ;- (SPI) NSSR Interrupt +AT91C_SPI_TXEMPTY EQU (0x1 << 9) ;- (SPI) TXEMPTY Interrupt +AT91C_SPI_SPIENS EQU (0x1 << 16) ;- (SPI) Enable Status +// - -------- SPI_IER : (SPI Offset: 0x14) Interrupt Enable Register -------- +// - -------- SPI_IDR : (SPI Offset: 0x18) Interrupt Disable Register -------- +// - -------- SPI_IMR : (SPI Offset: 0x1c) Interrupt Mask Register -------- +// - -------- SPI_CSR : (SPI Offset: 0x30) Chip Select Register -------- +AT91C_SPI_CPOL EQU (0x1 << 0) ;- (SPI) Clock Polarity +AT91C_SPI_NCPHA EQU (0x1 << 1) ;- (SPI) Clock Phase +AT91C_SPI_CSAAT EQU (0x1 << 3) ;- (SPI) Chip Select Active After Transfer +AT91C_SPI_BITS EQU (0xF << 4) ;- (SPI) Bits Per Transfer +AT91C_SPI_BITS_8 EQU (0x0 << 4) ;- (SPI) 8 Bits Per transfer +AT91C_SPI_BITS_9 EQU (0x1 << 4) ;- (SPI) 9 Bits Per transfer +AT91C_SPI_BITS_10 EQU (0x2 << 4) ;- (SPI) 10 Bits Per transfer +AT91C_SPI_BITS_11 EQU (0x3 << 4) ;- (SPI) 11 Bits Per transfer +AT91C_SPI_BITS_12 EQU (0x4 << 4) ;- (SPI) 12 Bits Per transfer +AT91C_SPI_BITS_13 EQU (0x5 << 4) ;- (SPI) 13 Bits Per transfer +AT91C_SPI_BITS_14 EQU (0x6 << 4) ;- (SPI) 14 Bits Per transfer +AT91C_SPI_BITS_15 EQU (0x7 << 4) ;- (SPI) 15 Bits Per transfer +AT91C_SPI_BITS_16 EQU (0x8 << 4) ;- (SPI) 16 Bits Per transfer +AT91C_SPI_SCBR EQU (0xFF << 8) ;- (SPI) Serial Clock Baud Rate +AT91C_SPI_DLYBS EQU (0xFF << 16) ;- (SPI) Delay Before SPCK +AT91C_SPI_DLYBCT EQU (0xFF << 24) ;- (SPI) Delay Between Consecutive Transfers + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Usart +// - ***************************************************************************** +// - -------- US_CR : (USART Offset: 0x0) Debug Unit Control Register -------- +AT91C_US_STTBRK EQU (0x1 << 9) ;- (USART) Start Break +AT91C_US_STPBRK EQU (0x1 << 10) ;- (USART) Stop Break +AT91C_US_STTTO EQU (0x1 << 11) ;- (USART) Start Time-out +AT91C_US_SENDA EQU (0x1 << 12) ;- (USART) Send Address +AT91C_US_RSTIT EQU (0x1 << 13) ;- (USART) Reset Iterations +AT91C_US_RSTNACK EQU (0x1 << 14) ;- (USART) Reset Non Acknowledge +AT91C_US_RETTO EQU (0x1 << 15) ;- (USART) Rearm Time-out +AT91C_US_DTREN EQU (0x1 << 16) ;- (USART) Data Terminal ready Enable +AT91C_US_DTRDIS EQU (0x1 << 17) ;- (USART) Data Terminal ready Disable +AT91C_US_RTSEN EQU (0x1 << 18) ;- (USART) Request to Send enable +AT91C_US_RTSDIS EQU (0x1 << 19) ;- (USART) Request to Send Disable +// - -------- US_MR : (USART Offset: 0x4) Debug Unit Mode Register -------- +AT91C_US_USMODE EQU (0xF << 0) ;- (USART) Usart mode +AT91C_US_USMODE_NORMAL EQU (0x0) ;- (USART) Normal +AT91C_US_USMODE_RS485 EQU (0x1) ;- (USART) RS485 +AT91C_US_USMODE_HWHSH EQU (0x2) ;- (USART) Hardware Handshaking +AT91C_US_USMODE_MODEM EQU (0x3) ;- (USART) Modem +AT91C_US_USMODE_ISO7816_0 EQU (0x4) ;- (USART) ISO7816 protocol: T = 0 +AT91C_US_USMODE_ISO7816_1 EQU (0x6) ;- (USART) ISO7816 protocol: T = 1 +AT91C_US_USMODE_IRDA EQU (0x8) ;- (USART) IrDA +AT91C_US_USMODE_SWHSH EQU (0xC) ;- (USART) Software Handshaking +AT91C_US_CLKS EQU (0x3 << 4) ;- (USART) Clock Selection (Baud Rate generator Input Clock +AT91C_US_CLKS_CLOCK EQU (0x0 << 4) ;- (USART) Clock +AT91C_US_CLKS_FDIV1 EQU (0x1 << 4) ;- (USART) fdiv1 +AT91C_US_CLKS_SLOW EQU (0x2 << 4) ;- (USART) slow_clock (ARM) +AT91C_US_CLKS_EXT EQU (0x3 << 4) ;- (USART) External (SCK) +AT91C_US_CHRL EQU (0x3 << 6) ;- (USART) Clock Selection (Baud Rate generator Input Clock +AT91C_US_CHRL_5_BITS EQU (0x0 << 6) ;- (USART) Character Length: 5 bits +AT91C_US_CHRL_6_BITS EQU (0x1 << 6) ;- (USART) Character Length: 6 bits +AT91C_US_CHRL_7_BITS EQU (0x2 << 6) ;- (USART) Character Length: 7 bits +AT91C_US_CHRL_8_BITS EQU (0x3 << 6) ;- (USART) Character Length: 8 bits +AT91C_US_SYNC EQU (0x1 << 8) ;- (USART) Synchronous Mode Select +AT91C_US_NBSTOP EQU (0x3 << 12) ;- (USART) Number of Stop bits +AT91C_US_NBSTOP_1_BIT EQU (0x0 << 12) ;- (USART) 1 stop bit +AT91C_US_NBSTOP_15_BIT EQU (0x1 << 12) ;- (USART) Asynchronous (SYNC=0) 2 stop bits Synchronous (SYNC=1) 2 stop bits +AT91C_US_NBSTOP_2_BIT EQU (0x2 << 12) ;- (USART) 2 stop bits +AT91C_US_MSBF EQU (0x1 << 16) ;- (USART) Bit Order +AT91C_US_MODE9 EQU (0x1 << 17) ;- (USART) 9-bit Character length +AT91C_US_CKLO EQU (0x1 << 18) ;- (USART) Clock Output Select +AT91C_US_OVER EQU (0x1 << 19) ;- (USART) Over Sampling Mode +AT91C_US_INACK EQU (0x1 << 20) ;- (USART) Inhibit Non Acknowledge +AT91C_US_DSNACK EQU (0x1 << 21) ;- (USART) Disable Successive NACK +AT91C_US_MAX_ITER EQU (0x1 << 24) ;- (USART) Number of Repetitions +AT91C_US_FILTER EQU (0x1 << 28) ;- (USART) Receive Line Filter +// - -------- US_IER : (USART Offset: 0x8) Debug Unit Interrupt Enable Register -------- +AT91C_US_RXBRK EQU (0x1 << 2) ;- (USART) Break Received/End of Break +AT91C_US_TIMEOUT EQU (0x1 << 8) ;- (USART) Receiver Time-out +AT91C_US_ITERATION EQU (0x1 << 10) ;- (USART) Max number of Repetitions Reached +AT91C_US_NACK EQU (0x1 << 13) ;- (USART) Non Acknowledge +AT91C_US_RIIC EQU (0x1 << 16) ;- (USART) Ring INdicator Input Change Flag +AT91C_US_DSRIC EQU (0x1 << 17) ;- (USART) Data Set Ready Input Change Flag +AT91C_US_DCDIC EQU (0x1 << 18) ;- (USART) Data Carrier Flag +AT91C_US_CTSIC EQU (0x1 << 19) ;- (USART) Clear To Send Input Change Flag +// - -------- US_IDR : (USART Offset: 0xc) Debug Unit Interrupt Disable Register -------- +// - -------- US_IMR : (USART Offset: 0x10) Debug Unit Interrupt Mask Register -------- +// - -------- US_CSR : (USART Offset: 0x14) Debug Unit Channel Status Register -------- +AT91C_US_RI EQU (0x1 << 20) ;- (USART) Image of RI Input +AT91C_US_DSR EQU (0x1 << 21) ;- (USART) Image of DSR Input +AT91C_US_DCD EQU (0x1 << 22) ;- (USART) Image of DCD Input +AT91C_US_CTS EQU (0x1 << 23) ;- (USART) Image of CTS Input + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Synchronous Serial Controller Interface +// - ***************************************************************************** +// - -------- SSC_CR : (SSC Offset: 0x0) SSC Control Register -------- +AT91C_SSC_RXEN EQU (0x1 << 0) ;- (SSC) Receive Enable +AT91C_SSC_RXDIS EQU (0x1 << 1) ;- (SSC) Receive Disable +AT91C_SSC_TXEN EQU (0x1 << 8) ;- (SSC) Transmit Enable +AT91C_SSC_TXDIS EQU (0x1 << 9) ;- (SSC) Transmit Disable +AT91C_SSC_SWRST EQU (0x1 << 15) ;- (SSC) Software Reset +// - -------- SSC_RCMR : (SSC Offset: 0x10) SSC Receive Clock Mode Register -------- +AT91C_SSC_CKS EQU (0x3 << 0) ;- (SSC) Receive/Transmit Clock Selection +AT91C_SSC_CKS_DIV EQU (0x0) ;- (SSC) Divided Clock +AT91C_SSC_CKS_TK EQU (0x1) ;- (SSC) TK Clock signal +AT91C_SSC_CKS_RK EQU (0x2) ;- (SSC) RK pin +AT91C_SSC_CKO EQU (0x7 << 2) ;- (SSC) Receive/Transmit Clock Output Mode Selection +AT91C_SSC_CKO_NONE EQU (0x0 << 2) ;- (SSC) Receive/Transmit Clock Output Mode: None RK pin: Input-only +AT91C_SSC_CKO_CONTINOUS EQU (0x1 << 2) ;- (SSC) Continuous Receive/Transmit Clock RK pin: Output +AT91C_SSC_CKO_DATA_TX EQU (0x2 << 2) ;- (SSC) Receive/Transmit Clock only during data transfers RK pin: Output +AT91C_SSC_CKI EQU (0x1 << 5) ;- (SSC) Receive/Transmit Clock Inversion +AT91C_SSC_CKG EQU (0x3 << 6) ;- (SSC) Receive/Transmit Clock Gating Selection +AT91C_SSC_CKG_NONE EQU (0x0 << 6) ;- (SSC) Receive/Transmit Clock Gating: None, continuous clock +AT91C_SSC_CKG_LOW EQU (0x1 << 6) ;- (SSC) Receive/Transmit Clock enabled only if RF Low +AT91C_SSC_CKG_HIGH EQU (0x2 << 6) ;- (SSC) Receive/Transmit Clock enabled only if RF High +AT91C_SSC_START EQU (0xF << 8) ;- (SSC) Receive/Transmit Start Selection +AT91C_SSC_START_CONTINOUS EQU (0x0 << 8) ;- (SSC) Continuous, as soon as the receiver is enabled, and immediately after the end of transfer of the previous data. +AT91C_SSC_START_TX EQU (0x1 << 8) ;- (SSC) Transmit/Receive start +AT91C_SSC_START_LOW_RF EQU (0x2 << 8) ;- (SSC) Detection of a low level on RF input +AT91C_SSC_START_HIGH_RF EQU (0x3 << 8) ;- (SSC) Detection of a high level on RF input +AT91C_SSC_START_FALL_RF EQU (0x4 << 8) ;- (SSC) Detection of a falling edge on RF input +AT91C_SSC_START_RISE_RF EQU (0x5 << 8) ;- (SSC) Detection of a rising edge on RF input +AT91C_SSC_START_LEVEL_RF EQU (0x6 << 8) ;- (SSC) Detection of any level change on RF input +AT91C_SSC_START_EDGE_RF EQU (0x7 << 8) ;- (SSC) Detection of any edge on RF input +AT91C_SSC_START_0 EQU (0x8 << 8) ;- (SSC) Compare 0 +AT91C_SSC_STOP EQU (0x1 << 12) ;- (SSC) Receive Stop Selection +AT91C_SSC_STTDLY EQU (0xFF << 16) ;- (SSC) Receive/Transmit Start Delay +AT91C_SSC_PERIOD EQU (0xFF << 24) ;- (SSC) Receive/Transmit Period Divider Selection +// - -------- SSC_RFMR : (SSC Offset: 0x14) SSC Receive Frame Mode Register -------- +AT91C_SSC_DATLEN EQU (0x1F << 0) ;- (SSC) Data Length +AT91C_SSC_LOOP EQU (0x1 << 5) ;- (SSC) Loop Mode +AT91C_SSC_MSBF EQU (0x1 << 7) ;- (SSC) Most Significant Bit First +AT91C_SSC_DATNB EQU (0xF << 8) ;- (SSC) Data Number per Frame +AT91C_SSC_FSLEN EQU (0xF << 16) ;- (SSC) Receive/Transmit Frame Sync length +AT91C_SSC_FSOS EQU (0x7 << 20) ;- (SSC) Receive/Transmit Frame Sync Output Selection +AT91C_SSC_FSOS_NONE EQU (0x0 << 20) ;- (SSC) Selected Receive/Transmit Frame Sync Signal: None RK pin Input-only +AT91C_SSC_FSOS_NEGATIVE EQU (0x1 << 20) ;- (SSC) Selected Receive/Transmit Frame Sync Signal: Negative Pulse +AT91C_SSC_FSOS_POSITIVE EQU (0x2 << 20) ;- (SSC) Selected Receive/Transmit Frame Sync Signal: Positive Pulse +AT91C_SSC_FSOS_LOW EQU (0x3 << 20) ;- (SSC) Selected Receive/Transmit Frame Sync Signal: Driver Low during data transfer +AT91C_SSC_FSOS_HIGH EQU (0x4 << 20) ;- (SSC) Selected Receive/Transmit Frame Sync Signal: Driver High during data transfer +AT91C_SSC_FSOS_TOGGLE EQU (0x5 << 20) ;- (SSC) Selected Receive/Transmit Frame Sync Signal: Toggling at each start of data transfer +AT91C_SSC_FSEDGE EQU (0x1 << 24) ;- (SSC) Frame Sync Edge Detection +// - -------- SSC_TCMR : (SSC Offset: 0x18) SSC Transmit Clock Mode Register -------- +// - -------- SSC_TFMR : (SSC Offset: 0x1c) SSC Transmit Frame Mode Register -------- +AT91C_SSC_DATDEF EQU (0x1 << 5) ;- (SSC) Data Default Value +AT91C_SSC_FSDEN EQU (0x1 << 23) ;- (SSC) Frame Sync Data Enable +// - -------- SSC_SR : (SSC Offset: 0x40) SSC Status Register -------- +AT91C_SSC_TXRDY EQU (0x1 << 0) ;- (SSC) Transmit Ready +AT91C_SSC_TXEMPTY EQU (0x1 << 1) ;- (SSC) Transmit Empty +AT91C_SSC_ENDTX EQU (0x1 << 2) ;- (SSC) End Of Transmission +AT91C_SSC_TXBUFE EQU (0x1 << 3) ;- (SSC) Transmit Buffer Empty +AT91C_SSC_RXRDY EQU (0x1 << 4) ;- (SSC) Receive Ready +AT91C_SSC_OVRUN EQU (0x1 << 5) ;- (SSC) Receive Overrun +AT91C_SSC_ENDRX EQU (0x1 << 6) ;- (SSC) End of Reception +AT91C_SSC_RXBUFF EQU (0x1 << 7) ;- (SSC) Receive Buffer Full +AT91C_SSC_CP0 EQU (0x1 << 8) ;- (SSC) Compare 0 +AT91C_SSC_CP1 EQU (0x1 << 9) ;- (SSC) Compare 1 +AT91C_SSC_TXSYN EQU (0x1 << 10) ;- (SSC) Transmit Sync +AT91C_SSC_RXSYN EQU (0x1 << 11) ;- (SSC) Receive Sync +AT91C_SSC_TXENA EQU (0x1 << 16) ;- (SSC) Transmit Enable +AT91C_SSC_RXENA EQU (0x1 << 17) ;- (SSC) Receive Enable +// - -------- SSC_IER : (SSC Offset: 0x44) SSC Interrupt Enable Register -------- +// - -------- SSC_IDR : (SSC Offset: 0x48) SSC Interrupt Disable Register -------- +// - -------- SSC_IMR : (SSC Offset: 0x4c) SSC Interrupt Mask Register -------- + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Two-wire Interface +// - ***************************************************************************** +// - -------- TWI_CR : (TWI Offset: 0x0) TWI Control Register -------- +AT91C_TWI_START EQU (0x1 << 0) ;- (TWI) Send a START Condition +AT91C_TWI_STOP EQU (0x1 << 1) ;- (TWI) Send a STOP Condition +AT91C_TWI_MSEN EQU (0x1 << 2) ;- (TWI) TWI Master Transfer Enabled +AT91C_TWI_MSDIS EQU (0x1 << 3) ;- (TWI) TWI Master Transfer Disabled +AT91C_TWI_SWRST EQU (0x1 << 7) ;- (TWI) Software Reset +// - -------- TWI_MMR : (TWI Offset: 0x4) TWI Master Mode Register -------- +AT91C_TWI_IADRSZ EQU (0x3 << 8) ;- (TWI) Internal Device Address Size +AT91C_TWI_IADRSZ_NO EQU (0x0 << 8) ;- (TWI) No internal device address +AT91C_TWI_IADRSZ_1_BYTE EQU (0x1 << 8) ;- (TWI) One-byte internal device address +AT91C_TWI_IADRSZ_2_BYTE EQU (0x2 << 8) ;- (TWI) Two-byte internal device address +AT91C_TWI_IADRSZ_3_BYTE EQU (0x3 << 8) ;- (TWI) Three-byte internal device address +AT91C_TWI_MREAD EQU (0x1 << 12) ;- (TWI) Master Read Direction +AT91C_TWI_DADR EQU (0x7F << 16) ;- (TWI) Device Address +// - -------- TWI_CWGR : (TWI Offset: 0x10) TWI Clock Waveform Generator Register -------- +AT91C_TWI_CLDIV EQU (0xFF << 0) ;- (TWI) Clock Low Divider +AT91C_TWI_CHDIV EQU (0xFF << 8) ;- (TWI) Clock High Divider +AT91C_TWI_CKDIV EQU (0x7 << 16) ;- (TWI) Clock Divider +// - -------- TWI_SR : (TWI Offset: 0x20) TWI Status Register -------- +AT91C_TWI_TXCOMP EQU (0x1 << 0) ;- (TWI) Transmission Completed +AT91C_TWI_RXRDY EQU (0x1 << 1) ;- (TWI) Receive holding register ReaDY +AT91C_TWI_TXRDY EQU (0x1 << 2) ;- (TWI) Transmit holding register ReaDY +AT91C_TWI_OVRE EQU (0x1 << 6) ;- (TWI) Overrun Error +AT91C_TWI_UNRE EQU (0x1 << 7) ;- (TWI) Underrun Error +AT91C_TWI_NACK EQU (0x1 << 8) ;- (TWI) Not Acknowledged +// - -------- TWI_IER : (TWI Offset: 0x24) TWI Interrupt Enable Register -------- +// - -------- TWI_IDR : (TWI Offset: 0x28) TWI Interrupt Disable Register -------- +// - -------- TWI_IMR : (TWI Offset: 0x2c) TWI Interrupt Mask Register -------- + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR PWMC Channel Interface +// - ***************************************************************************** +// - -------- PWMC_CMR : (PWMC_CH Offset: 0x0) PWMC Channel Mode Register -------- +AT91C_PWMC_CPRE EQU (0xF << 0) ;- (PWMC_CH) Channel Pre-scaler : PWMC_CLKx +AT91C_PWMC_CPRE_MCK EQU (0x0) ;- (PWMC_CH) +AT91C_PWMC_CPRE_MCKA EQU (0xB) ;- (PWMC_CH) +AT91C_PWMC_CPRE_MCKB EQU (0xC) ;- (PWMC_CH) +AT91C_PWMC_CALG EQU (0x1 << 8) ;- (PWMC_CH) Channel Alignment +AT91C_PWMC_CPOL EQU (0x1 << 9) ;- (PWMC_CH) Channel Polarity +AT91C_PWMC_CPD EQU (0x1 << 10) ;- (PWMC_CH) Channel Update Period +// - -------- PWMC_CDTYR : (PWMC_CH Offset: 0x4) PWMC Channel Duty Cycle Register -------- +AT91C_PWMC_CDTY EQU (0x0 << 0) ;- (PWMC_CH) Channel Duty Cycle +// - -------- PWMC_CPRDR : (PWMC_CH Offset: 0x8) PWMC Channel Period Register -------- +AT91C_PWMC_CPRD EQU (0x0 << 0) ;- (PWMC_CH) Channel Period +// - -------- PWMC_CCNTR : (PWMC_CH Offset: 0xc) PWMC Channel Counter Register -------- +AT91C_PWMC_CCNT EQU (0x0 << 0) ;- (PWMC_CH) Channel Counter +// - -------- PWMC_CUPDR : (PWMC_CH Offset: 0x10) PWMC Channel Update Register -------- +AT91C_PWMC_CUPD EQU (0x0 << 0) ;- (PWMC_CH) Channel Update + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Pulse Width Modulation Controller Interface +// - ***************************************************************************** +// - -------- PWMC_MR : (PWMC Offset: 0x0) PWMC Mode Register -------- +AT91C_PWMC_DIVA EQU (0xFF << 0) ;- (PWMC) CLKA divide factor. +AT91C_PWMC_PREA EQU (0xF << 8) ;- (PWMC) Divider Input Clock Prescaler A +AT91C_PWMC_PREA_MCK EQU (0x0 << 8) ;- (PWMC) +AT91C_PWMC_DIVB EQU (0xFF << 16) ;- (PWMC) CLKB divide factor. +AT91C_PWMC_PREB EQU (0xF << 24) ;- (PWMC) Divider Input Clock Prescaler B +AT91C_PWMC_PREB_MCK EQU (0x0 << 24) ;- (PWMC) +// - -------- PWMC_ENA : (PWMC Offset: 0x4) PWMC Enable Register -------- +AT91C_PWMC_CHID0 EQU (0x1 << 0) ;- (PWMC) Channel ID 0 +AT91C_PWMC_CHID1 EQU (0x1 << 1) ;- (PWMC) Channel ID 1 +AT91C_PWMC_CHID2 EQU (0x1 << 2) ;- (PWMC) Channel ID 2 +AT91C_PWMC_CHID3 EQU (0x1 << 3) ;- (PWMC) Channel ID 3 +// - -------- PWMC_DIS : (PWMC Offset: 0x8) PWMC Disable Register -------- +// - -------- PWMC_SR : (PWMC Offset: 0xc) PWMC Status Register -------- +// - -------- PWMC_IER : (PWMC Offset: 0x10) PWMC Interrupt Enable Register -------- +// - -------- PWMC_IDR : (PWMC Offset: 0x14) PWMC Interrupt Disable Register -------- +// - -------- PWMC_IMR : (PWMC Offset: 0x18) PWMC Interrupt Mask Register -------- +// - -------- PWMC_ISR : (PWMC Offset: 0x1c) PWMC Interrupt Status Register -------- + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR USB Device Interface +// - ***************************************************************************** +// - -------- UDP_FRM_NUM : (UDP Offset: 0x0) USB Frame Number Register -------- +AT91C_UDP_FRM_NUM EQU (0x7FF << 0) ;- (UDP) Frame Number as Defined in the Packet Field Formats +AT91C_UDP_FRM_ERR EQU (0x1 << 16) ;- (UDP) Frame Error +AT91C_UDP_FRM_OK EQU (0x1 << 17) ;- (UDP) Frame OK +// - -------- UDP_GLB_STATE : (UDP Offset: 0x4) USB Global State Register -------- +AT91C_UDP_FADDEN EQU (0x1 << 0) ;- (UDP) Function Address Enable +AT91C_UDP_CONFG EQU (0x1 << 1) ;- (UDP) Configured +AT91C_UDP_ESR EQU (0x1 << 2) ;- (UDP) Enable Send Resume +AT91C_UDP_RSMINPR EQU (0x1 << 3) ;- (UDP) A Resume Has Been Sent to the Host +AT91C_UDP_RMWUPE EQU (0x1 << 4) ;- (UDP) Remote Wake Up Enable +// - -------- UDP_FADDR : (UDP Offset: 0x8) USB Function Address Register -------- +AT91C_UDP_FADD EQU (0xFF << 0) ;- (UDP) Function Address Value +AT91C_UDP_FEN EQU (0x1 << 8) ;- (UDP) Function Enable +// - -------- UDP_IER : (UDP Offset: 0x10) USB Interrupt Enable Register -------- +AT91C_UDP_EPINT0 EQU (0x1 << 0) ;- (UDP) Endpoint 0 Interrupt +AT91C_UDP_EPINT1 EQU (0x1 << 1) ;- (UDP) Endpoint 0 Interrupt +AT91C_UDP_EPINT2 EQU (0x1 << 2) ;- (UDP) Endpoint 2 Interrupt +AT91C_UDP_EPINT3 EQU (0x1 << 3) ;- (UDP) Endpoint 3 Interrupt +AT91C_UDP_EPINT4 EQU (0x1 << 4) ;- (UDP) Endpoint 4 Interrupt +AT91C_UDP_EPINT5 EQU (0x1 << 5) ;- (UDP) Endpoint 5 Interrupt +AT91C_UDP_RXSUSP EQU (0x1 << 8) ;- (UDP) USB Suspend Interrupt +AT91C_UDP_RXRSM EQU (0x1 << 9) ;- (UDP) USB Resume Interrupt +AT91C_UDP_EXTRSM EQU (0x1 << 10) ;- (UDP) USB External Resume Interrupt +AT91C_UDP_SOFINT EQU (0x1 << 11) ;- (UDP) USB Start Of frame Interrupt +AT91C_UDP_WAKEUP EQU (0x1 << 13) ;- (UDP) USB Resume Interrupt +// - -------- UDP_IDR : (UDP Offset: 0x14) USB Interrupt Disable Register -------- +// - -------- UDP_IMR : (UDP Offset: 0x18) USB Interrupt Mask Register -------- +// - -------- UDP_ISR : (UDP Offset: 0x1c) USB Interrupt Status Register -------- +AT91C_UDP_ENDBUSRES EQU (0x1 << 12) ;- (UDP) USB End Of Bus Reset Interrupt +// - -------- UDP_ICR : (UDP Offset: 0x20) USB Interrupt Clear Register -------- +// - -------- UDP_RST_EP : (UDP Offset: 0x28) USB Reset Endpoint Register -------- +AT91C_UDP_EP0 EQU (0x1 << 0) ;- (UDP) Reset Endpoint 0 +AT91C_UDP_EP1 EQU (0x1 << 1) ;- (UDP) Reset Endpoint 1 +AT91C_UDP_EP2 EQU (0x1 << 2) ;- (UDP) Reset Endpoint 2 +AT91C_UDP_EP3 EQU (0x1 << 3) ;- (UDP) Reset Endpoint 3 +AT91C_UDP_EP4 EQU (0x1 << 4) ;- (UDP) Reset Endpoint 4 +AT91C_UDP_EP5 EQU (0x1 << 5) ;- (UDP) Reset Endpoint 5 +// - -------- UDP_CSR : (UDP Offset: 0x30) USB Endpoint Control and Status Register -------- +AT91C_UDP_TXCOMP EQU (0x1 << 0) ;- (UDP) Generates an IN packet with data previously written in the DPR +AT91C_UDP_RX_DATA_BK0 EQU (0x1 << 1) ;- (UDP) Receive Data Bank 0 +AT91C_UDP_RXSETUP EQU (0x1 << 2) ;- (UDP) Sends STALL to the Host (Control endpoints) +AT91C_UDP_ISOERROR EQU (0x1 << 3) ;- (UDP) Isochronous error (Isochronous endpoints) +AT91C_UDP_TXPKTRDY EQU (0x1 << 4) ;- (UDP) Transmit Packet Ready +AT91C_UDP_FORCESTALL EQU (0x1 << 5) ;- (UDP) Force Stall (used by Control, Bulk and Isochronous endpoints). +AT91C_UDP_RX_DATA_BK1 EQU (0x1 << 6) ;- (UDP) Receive Data Bank 1 (only used by endpoints with ping-pong attributes). +AT91C_UDP_DIR EQU (0x1 << 7) ;- (UDP) Transfer Direction +AT91C_UDP_EPTYPE EQU (0x7 << 8) ;- (UDP) Endpoint type +AT91C_UDP_EPTYPE_CTRL EQU (0x0 << 8) ;- (UDP) Control +AT91C_UDP_EPTYPE_ISO_OUT EQU (0x1 << 8) ;- (UDP) Isochronous OUT +AT91C_UDP_EPTYPE_BULK_OUT EQU (0x2 << 8) ;- (UDP) Bulk OUT +AT91C_UDP_EPTYPE_INT_OUT EQU (0x3 << 8) ;- (UDP) Interrupt OUT +AT91C_UDP_EPTYPE_ISO_IN EQU (0x5 << 8) ;- (UDP) Isochronous IN +AT91C_UDP_EPTYPE_BULK_IN EQU (0x6 << 8) ;- (UDP) Bulk IN +AT91C_UDP_EPTYPE_INT_IN EQU (0x7 << 8) ;- (UDP) Interrupt IN +AT91C_UDP_DTGLE EQU (0x1 << 11) ;- (UDP) Data Toggle +AT91C_UDP_EPEDS EQU (0x1 << 15) ;- (UDP) Endpoint Enable Disable +AT91C_UDP_RXBYTECNT EQU (0x7FF << 16) ;- (UDP) Number Of Bytes Available in the FIFO +// - -------- UDP_TXVC : (UDP Offset: 0x74) Transceiver Control Register -------- +AT91C_UDP_TXVDIS EQU (0x1 << 8) ;- (UDP) +AT91C_UDP_PUON EQU (0x1 << 9) ;- (UDP) Pull-up ON + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Timer Counter Channel Interface +// - ***************************************************************************** +// - -------- TC_CCR : (TC Offset: 0x0) TC Channel Control Register -------- +AT91C_TC_CLKEN EQU (0x1 << 0) ;- (TC) Counter Clock Enable Command +AT91C_TC_CLKDIS EQU (0x1 << 1) ;- (TC) Counter Clock Disable Command +AT91C_TC_SWTRG EQU (0x1 << 2) ;- (TC) Software Trigger Command +// - -------- TC_CMR : (TC Offset: 0x4) TC Channel Mode Register: Capture Mode / Waveform Mode -------- +AT91C_TC_CLKS EQU (0x7 << 0) ;- (TC) Clock Selection +AT91C_TC_CLKS_TIMER_DIV1_CLOCK EQU (0x0) ;- (TC) Clock selected: TIMER_DIV1_CLOCK +AT91C_TC_CLKS_TIMER_DIV2_CLOCK EQU (0x1) ;- (TC) Clock selected: TIMER_DIV2_CLOCK +AT91C_TC_CLKS_TIMER_DIV3_CLOCK EQU (0x2) ;- (TC) Clock selected: TIMER_DIV3_CLOCK +AT91C_TC_CLKS_TIMER_DIV4_CLOCK EQU (0x3) ;- (TC) Clock selected: TIMER_DIV4_CLOCK +AT91C_TC_CLKS_TIMER_DIV5_CLOCK EQU (0x4) ;- (TC) Clock selected: TIMER_DIV5_CLOCK +AT91C_TC_CLKS_XC0 EQU (0x5) ;- (TC) Clock selected: XC0 +AT91C_TC_CLKS_XC1 EQU (0x6) ;- (TC) Clock selected: XC1 +AT91C_TC_CLKS_XC2 EQU (0x7) ;- (TC) Clock selected: XC2 +AT91C_TC_CLKI EQU (0x1 << 3) ;- (TC) Clock Invert +AT91C_TC_BURST EQU (0x3 << 4) ;- (TC) Burst Signal Selection +AT91C_TC_BURST_NONE EQU (0x0 << 4) ;- (TC) The clock is not gated by an external signal +AT91C_TC_BURST_XC0 EQU (0x1 << 4) ;- (TC) XC0 is ANDed with the selected clock +AT91C_TC_BURST_XC1 EQU (0x2 << 4) ;- (TC) XC1 is ANDed with the selected clock +AT91C_TC_BURST_XC2 EQU (0x3 << 4) ;- (TC) XC2 is ANDed with the selected clock +AT91C_TC_CPCSTOP EQU (0x1 << 6) ;- (TC) Counter Clock Stopped with RC Compare +AT91C_TC_LDBSTOP EQU (0x1 << 6) ;- (TC) Counter Clock Stopped with RB Loading +AT91C_TC_CPCDIS EQU (0x1 << 7) ;- (TC) Counter Clock Disable with RC Compare +AT91C_TC_LDBDIS EQU (0x1 << 7) ;- (TC) Counter Clock Disabled with RB Loading +AT91C_TC_ETRGEDG EQU (0x3 << 8) ;- (TC) External Trigger Edge Selection +AT91C_TC_ETRGEDG_NONE EQU (0x0 << 8) ;- (TC) Edge: None +AT91C_TC_ETRGEDG_RISING EQU (0x1 << 8) ;- (TC) Edge: rising edge +AT91C_TC_ETRGEDG_FALLING EQU (0x2 << 8) ;- (TC) Edge: falling edge +AT91C_TC_ETRGEDG_BOTH EQU (0x3 << 8) ;- (TC) Edge: each edge +AT91C_TC_EEVTEDG EQU (0x3 << 8) ;- (TC) External Event Edge Selection +AT91C_TC_EEVTEDG_NONE EQU (0x0 << 8) ;- (TC) Edge: None +AT91C_TC_EEVTEDG_RISING EQU (0x1 << 8) ;- (TC) Edge: rising edge +AT91C_TC_EEVTEDG_FALLING EQU (0x2 << 8) ;- (TC) Edge: falling edge +AT91C_TC_EEVTEDG_BOTH EQU (0x3 << 8) ;- (TC) Edge: each edge +AT91C_TC_EEVT EQU (0x3 << 10) ;- (TC) External Event Selection +AT91C_TC_EEVT_TIOB EQU (0x0 << 10) ;- (TC) Signal selected as external event: TIOB TIOB direction: input +AT91C_TC_EEVT_XC0 EQU (0x1 << 10) ;- (TC) Signal selected as external event: XC0 TIOB direction: output +AT91C_TC_EEVT_XC1 EQU (0x2 << 10) ;- (TC) Signal selected as external event: XC1 TIOB direction: output +AT91C_TC_EEVT_XC2 EQU (0x3 << 10) ;- (TC) Signal selected as external event: XC2 TIOB direction: output +AT91C_TC_ABETRG EQU (0x1 << 10) ;- (TC) TIOA or TIOB External Trigger Selection +AT91C_TC_ENETRG EQU (0x1 << 12) ;- (TC) External Event Trigger enable +AT91C_TC_WAVESEL EQU (0x3 << 13) ;- (TC) Waveform Selection +AT91C_TC_WAVESEL_UP EQU (0x0 << 13) ;- (TC) UP mode without atomatic trigger on RC Compare +AT91C_TC_WAVESEL_UPDOWN EQU (0x1 << 13) ;- (TC) UPDOWN mode without automatic trigger on RC Compare +AT91C_TC_WAVESEL_UP_AUTO EQU (0x2 << 13) ;- (TC) UP mode with automatic trigger on RC Compare +AT91C_TC_WAVESEL_UPDOWN_AUTO EQU (0x3 << 13) ;- (TC) UPDOWN mode with automatic trigger on RC Compare +AT91C_TC_CPCTRG EQU (0x1 << 14) ;- (TC) RC Compare Trigger Enable +AT91C_TC_WAVE EQU (0x1 << 15) ;- (TC) +AT91C_TC_ACPA EQU (0x3 << 16) ;- (TC) RA Compare Effect on TIOA +AT91C_TC_ACPA_NONE EQU (0x0 << 16) ;- (TC) Effect: none +AT91C_TC_ACPA_SET EQU (0x1 << 16) ;- (TC) Effect: set +AT91C_TC_ACPA_CLEAR EQU (0x2 << 16) ;- (TC) Effect: clear +AT91C_TC_ACPA_TOGGLE EQU (0x3 << 16) ;- (TC) Effect: toggle +AT91C_TC_LDRA EQU (0x3 << 16) ;- (TC) RA Loading Selection +AT91C_TC_LDRA_NONE EQU (0x0 << 16) ;- (TC) Edge: None +AT91C_TC_LDRA_RISING EQU (0x1 << 16) ;- (TC) Edge: rising edge of TIOA +AT91C_TC_LDRA_FALLING EQU (0x2 << 16) ;- (TC) Edge: falling edge of TIOA +AT91C_TC_LDRA_BOTH EQU (0x3 << 16) ;- (TC) Edge: each edge of TIOA +AT91C_TC_ACPC EQU (0x3 << 18) ;- (TC) RC Compare Effect on TIOA +AT91C_TC_ACPC_NONE EQU (0x0 << 18) ;- (TC) Effect: none +AT91C_TC_ACPC_SET EQU (0x1 << 18) ;- (TC) Effect: set +AT91C_TC_ACPC_CLEAR EQU (0x2 << 18) ;- (TC) Effect: clear +AT91C_TC_ACPC_TOGGLE EQU (0x3 << 18) ;- (TC) Effect: toggle +AT91C_TC_LDRB EQU (0x3 << 18) ;- (TC) RB Loading Selection +AT91C_TC_LDRB_NONE EQU (0x0 << 18) ;- (TC) Edge: None +AT91C_TC_LDRB_RISING EQU (0x1 << 18) ;- (TC) Edge: rising edge of TIOA +AT91C_TC_LDRB_FALLING EQU (0x2 << 18) ;- (TC) Edge: falling edge of TIOA +AT91C_TC_LDRB_BOTH EQU (0x3 << 18) ;- (TC) Edge: each edge of TIOA +AT91C_TC_AEEVT EQU (0x3 << 20) ;- (TC) External Event Effect on TIOA +AT91C_TC_AEEVT_NONE EQU (0x0 << 20) ;- (TC) Effect: none +AT91C_TC_AEEVT_SET EQU (0x1 << 20) ;- (TC) Effect: set +AT91C_TC_AEEVT_CLEAR EQU (0x2 << 20) ;- (TC) Effect: clear +AT91C_TC_AEEVT_TOGGLE EQU (0x3 << 20) ;- (TC) Effect: toggle +AT91C_TC_ASWTRG EQU (0x3 << 22) ;- (TC) Software Trigger Effect on TIOA +AT91C_TC_ASWTRG_NONE EQU (0x0 << 22) ;- (TC) Effect: none +AT91C_TC_ASWTRG_SET EQU (0x1 << 22) ;- (TC) Effect: set +AT91C_TC_ASWTRG_CLEAR EQU (0x2 << 22) ;- (TC) Effect: clear +AT91C_TC_ASWTRG_TOGGLE EQU (0x3 << 22) ;- (TC) Effect: toggle +AT91C_TC_BCPB EQU (0x3 << 24) ;- (TC) RB Compare Effect on TIOB +AT91C_TC_BCPB_NONE EQU (0x0 << 24) ;- (TC) Effect: none +AT91C_TC_BCPB_SET EQU (0x1 << 24) ;- (TC) Effect: set +AT91C_TC_BCPB_CLEAR EQU (0x2 << 24) ;- (TC) Effect: clear +AT91C_TC_BCPB_TOGGLE EQU (0x3 << 24) ;- (TC) Effect: toggle +AT91C_TC_BCPC EQU (0x3 << 26) ;- (TC) RC Compare Effect on TIOB +AT91C_TC_BCPC_NONE EQU (0x0 << 26) ;- (TC) Effect: none +AT91C_TC_BCPC_SET EQU (0x1 << 26) ;- (TC) Effect: set +AT91C_TC_BCPC_CLEAR EQU (0x2 << 26) ;- (TC) Effect: clear +AT91C_TC_BCPC_TOGGLE EQU (0x3 << 26) ;- (TC) Effect: toggle +AT91C_TC_BEEVT EQU (0x3 << 28) ;- (TC) External Event Effect on TIOB +AT91C_TC_BEEVT_NONE EQU (0x0 << 28) ;- (TC) Effect: none +AT91C_TC_BEEVT_SET EQU (0x1 << 28) ;- (TC) Effect: set +AT91C_TC_BEEVT_CLEAR EQU (0x2 << 28) ;- (TC) Effect: clear +AT91C_TC_BEEVT_TOGGLE EQU (0x3 << 28) ;- (TC) Effect: toggle +AT91C_TC_BSWTRG EQU (0x3 << 30) ;- (TC) Software Trigger Effect on TIOB +AT91C_TC_BSWTRG_NONE EQU (0x0 << 30) ;- (TC) Effect: none +AT91C_TC_BSWTRG_SET EQU (0x1 << 30) ;- (TC) Effect: set +AT91C_TC_BSWTRG_CLEAR EQU (0x2 << 30) ;- (TC) Effect: clear +AT91C_TC_BSWTRG_TOGGLE EQU (0x3 << 30) ;- (TC) Effect: toggle +// - -------- TC_SR : (TC Offset: 0x20) TC Channel Status Register -------- +AT91C_TC_COVFS EQU (0x1 << 0) ;- (TC) Counter Overflow +AT91C_TC_LOVRS EQU (0x1 << 1) ;- (TC) Load Overrun +AT91C_TC_CPAS EQU (0x1 << 2) ;- (TC) RA Compare +AT91C_TC_CPBS EQU (0x1 << 3) ;- (TC) RB Compare +AT91C_TC_CPCS EQU (0x1 << 4) ;- (TC) RC Compare +AT91C_TC_LDRAS EQU (0x1 << 5) ;- (TC) RA Loading +AT91C_TC_LDRBS EQU (0x1 << 6) ;- (TC) RB Loading +AT91C_TC_ETRGS EQU (0x1 << 7) ;- (TC) External Trigger +AT91C_TC_CLKSTA EQU (0x1 << 16) ;- (TC) Clock Enabling +AT91C_TC_MTIOA EQU (0x1 << 17) ;- (TC) TIOA Mirror +AT91C_TC_MTIOB EQU (0x1 << 18) ;- (TC) TIOA Mirror +// - -------- TC_IER : (TC Offset: 0x24) TC Channel Interrupt Enable Register -------- +// - -------- TC_IDR : (TC Offset: 0x28) TC Channel Interrupt Disable Register -------- +// - -------- TC_IMR : (TC Offset: 0x2c) TC Channel Interrupt Mask Register -------- + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Timer Counter Interface +// - ***************************************************************************** +// - -------- TCB_BCR : (TCB Offset: 0xc0) TC Block Control Register -------- +AT91C_TCB_SYNC EQU (0x1 << 0) ;- (TCB) Synchro Command +// - -------- TCB_BMR : (TCB Offset: 0xc4) TC Block Mode Register -------- +AT91C_TCB_TC0XC0S EQU (0x3 << 0) ;- (TCB) External Clock Signal 0 Selection +AT91C_TCB_TC0XC0S_TCLK0 EQU (0x0) ;- (TCB) TCLK0 connected to XC0 +AT91C_TCB_TC0XC0S_NONE EQU (0x1) ;- (TCB) None signal connected to XC0 +AT91C_TCB_TC0XC0S_TIOA1 EQU (0x2) ;- (TCB) TIOA1 connected to XC0 +AT91C_TCB_TC0XC0S_TIOA2 EQU (0x3) ;- (TCB) TIOA2 connected to XC0 +AT91C_TCB_TC1XC1S EQU (0x3 << 2) ;- (TCB) External Clock Signal 1 Selection +AT91C_TCB_TC1XC1S_TCLK1 EQU (0x0 << 2) ;- (TCB) TCLK1 connected to XC1 +AT91C_TCB_TC1XC1S_NONE EQU (0x1 << 2) ;- (TCB) None signal connected to XC1 +AT91C_TCB_TC1XC1S_TIOA0 EQU (0x2 << 2) ;- (TCB) TIOA0 connected to XC1 +AT91C_TCB_TC1XC1S_TIOA2 EQU (0x3 << 2) ;- (TCB) TIOA2 connected to XC1 +AT91C_TCB_TC2XC2S EQU (0x3 << 4) ;- (TCB) External Clock Signal 2 Selection +AT91C_TCB_TC2XC2S_TCLK2 EQU (0x0 << 4) ;- (TCB) TCLK2 connected to XC2 +AT91C_TCB_TC2XC2S_NONE EQU (0x1 << 4) ;- (TCB) None signal connected to XC2 +AT91C_TCB_TC2XC2S_TIOA0 EQU (0x2 << 4) ;- (TCB) TIOA0 connected to XC2 +AT91C_TCB_TC2XC2S_TIOA1 EQU (0x3 << 4) ;- (TCB) TIOA2 connected to XC2 + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Control Area Network MailBox Interface +// - ***************************************************************************** +// - -------- CAN_MMR : (CAN_MB Offset: 0x0) CAN Message Mode Register -------- +AT91C_CAN_MTIMEMARK EQU (0xFFFF << 0) ;- (CAN_MB) Mailbox Timemark +AT91C_CAN_PRIOR EQU (0xF << 16) ;- (CAN_MB) Mailbox Priority +AT91C_CAN_MOT EQU (0x7 << 24) ;- (CAN_MB) Mailbox Object Type +AT91C_CAN_MOT_DIS EQU (0x0 << 24) ;- (CAN_MB) +AT91C_CAN_MOT_RX EQU (0x1 << 24) ;- (CAN_MB) +AT91C_CAN_MOT_RXOVERWRITE EQU (0x2 << 24) ;- (CAN_MB) +AT91C_CAN_MOT_TX EQU (0x3 << 24) ;- (CAN_MB) +AT91C_CAN_MOT_CONSUMER EQU (0x4 << 24) ;- (CAN_MB) +AT91C_CAN_MOT_PRODUCER EQU (0x5 << 24) ;- (CAN_MB) +// - -------- CAN_MAM : (CAN_MB Offset: 0x4) CAN Message Acceptance Mask Register -------- +AT91C_CAN_MIDvB EQU (0x3FFFF << 0) ;- (CAN_MB) Complementary bits for identifier in extended mode +AT91C_CAN_MIDvA EQU (0x7FF << 18) ;- (CAN_MB) Identifier for standard frame mode +AT91C_CAN_MIDE EQU (0x1 << 29) ;- (CAN_MB) Identifier Version +// - -------- CAN_MID : (CAN_MB Offset: 0x8) CAN Message ID Register -------- +// - -------- CAN_MFID : (CAN_MB Offset: 0xc) CAN Message Family ID Register -------- +// - -------- CAN_MSR : (CAN_MB Offset: 0x10) CAN Message Status Register -------- +AT91C_CAN_MTIMESTAMP EQU (0xFFFF << 0) ;- (CAN_MB) Timer Value +AT91C_CAN_MDLC EQU (0xF << 16) ;- (CAN_MB) Mailbox Data Length Code +AT91C_CAN_MRTR EQU (0x1 << 20) ;- (CAN_MB) Mailbox Remote Transmission Request +AT91C_CAN_MABT EQU (0x1 << 22) ;- (CAN_MB) Mailbox Message Abort +AT91C_CAN_MRDY EQU (0x1 << 23) ;- (CAN_MB) Mailbox Ready +AT91C_CAN_MMI EQU (0x1 << 24) ;- (CAN_MB) Mailbox Message Ignored +// - -------- CAN_MDL : (CAN_MB Offset: 0x14) CAN Message Data Low Register -------- +// - -------- CAN_MDH : (CAN_MB Offset: 0x18) CAN Message Data High Register -------- +// - -------- CAN_MCR : (CAN_MB Offset: 0x1c) CAN Message Control Register -------- +AT91C_CAN_MACR EQU (0x1 << 22) ;- (CAN_MB) Abort Request for Mailbox +AT91C_CAN_MTCR EQU (0x1 << 23) ;- (CAN_MB) Mailbox Transfer Command + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Control Area Network Interface +// - ***************************************************************************** +// - -------- CAN_MR : (CAN Offset: 0x0) CAN Mode Register -------- +AT91C_CAN_CANEN EQU (0x1 << 0) ;- (CAN) CAN Controller Enable +AT91C_CAN_LPM EQU (0x1 << 1) ;- (CAN) Disable/Enable Low Power Mode +AT91C_CAN_ABM EQU (0x1 << 2) ;- (CAN) Disable/Enable Autobaud/Listen Mode +AT91C_CAN_OVL EQU (0x1 << 3) ;- (CAN) Disable/Enable Overload Frame +AT91C_CAN_TEOF EQU (0x1 << 4) ;- (CAN) Time Stamp messages at each end of Frame +AT91C_CAN_TTM EQU (0x1 << 5) ;- (CAN) Disable/Enable Time Trigger Mode +AT91C_CAN_TIMFRZ EQU (0x1 << 6) ;- (CAN) Enable Timer Freeze +AT91C_CAN_DRPT EQU (0x1 << 7) ;- (CAN) Disable Repeat +// - -------- CAN_IER : (CAN Offset: 0x4) CAN Interrupt Enable Register -------- +AT91C_CAN_MB0 EQU (0x1 << 0) ;- (CAN) Mailbox 0 Flag +AT91C_CAN_MB1 EQU (0x1 << 1) ;- (CAN) Mailbox 1 Flag +AT91C_CAN_MB2 EQU (0x1 << 2) ;- (CAN) Mailbox 2 Flag +AT91C_CAN_MB3 EQU (0x1 << 3) ;- (CAN) Mailbox 3 Flag +AT91C_CAN_MB4 EQU (0x1 << 4) ;- (CAN) Mailbox 4 Flag +AT91C_CAN_MB5 EQU (0x1 << 5) ;- (CAN) Mailbox 5 Flag +AT91C_CAN_MB6 EQU (0x1 << 6) ;- (CAN) Mailbox 6 Flag +AT91C_CAN_MB7 EQU (0x1 << 7) ;- (CAN) Mailbox 7 Flag +AT91C_CAN_MB8 EQU (0x1 << 8) ;- (CAN) Mailbox 8 Flag +AT91C_CAN_MB9 EQU (0x1 << 9) ;- (CAN) Mailbox 9 Flag +AT91C_CAN_MB10 EQU (0x1 << 10) ;- (CAN) Mailbox 10 Flag +AT91C_CAN_MB11 EQU (0x1 << 11) ;- (CAN) Mailbox 11 Flag +AT91C_CAN_MB12 EQU (0x1 << 12) ;- (CAN) Mailbox 12 Flag +AT91C_CAN_MB13 EQU (0x1 << 13) ;- (CAN) Mailbox 13 Flag +AT91C_CAN_MB14 EQU (0x1 << 14) ;- (CAN) Mailbox 14 Flag +AT91C_CAN_MB15 EQU (0x1 << 15) ;- (CAN) Mailbox 15 Flag +AT91C_CAN_ERRA EQU (0x1 << 16) ;- (CAN) Error Active Mode Flag +AT91C_CAN_WARN EQU (0x1 << 17) ;- (CAN) Warning Limit Flag +AT91C_CAN_ERRP EQU (0x1 << 18) ;- (CAN) Error Passive Mode Flag +AT91C_CAN_BOFF EQU (0x1 << 19) ;- (CAN) Bus Off Mode Flag +AT91C_CAN_SLEEP EQU (0x1 << 20) ;- (CAN) Sleep Flag +AT91C_CAN_WAKEUP EQU (0x1 << 21) ;- (CAN) Wakeup Flag +AT91C_CAN_TOVF EQU (0x1 << 22) ;- (CAN) Timer Overflow Flag +AT91C_CAN_TSTP EQU (0x1 << 23) ;- (CAN) Timestamp Flag +AT91C_CAN_CERR EQU (0x1 << 24) ;- (CAN) CRC Error +AT91C_CAN_SERR EQU (0x1 << 25) ;- (CAN) Stuffing Error +AT91C_CAN_AERR EQU (0x1 << 26) ;- (CAN) Acknowledgment Error +AT91C_CAN_FERR EQU (0x1 << 27) ;- (CAN) Form Error +AT91C_CAN_BERR EQU (0x1 << 28) ;- (CAN) Bit Error +// - -------- CAN_IDR : (CAN Offset: 0x8) CAN Interrupt Disable Register -------- +// - -------- CAN_IMR : (CAN Offset: 0xc) CAN Interrupt Mask Register -------- +// - -------- CAN_SR : (CAN Offset: 0x10) CAN Status Register -------- +AT91C_CAN_RBSY EQU (0x1 << 29) ;- (CAN) Receiver Busy +AT91C_CAN_TBSY EQU (0x1 << 30) ;- (CAN) Transmitter Busy +AT91C_CAN_OVLY EQU (0x1 << 31) ;- (CAN) Overload Busy +// - -------- CAN_BR : (CAN Offset: 0x14) CAN Baudrate Register -------- +AT91C_CAN_PHASE2 EQU (0x7 << 0) ;- (CAN) Phase 2 segment +AT91C_CAN_PHASE1 EQU (0x7 << 4) ;- (CAN) Phase 1 segment +AT91C_CAN_PROPAG EQU (0x7 << 8) ;- (CAN) Programmation time segment +AT91C_CAN_SYNC EQU (0x3 << 12) ;- (CAN) Re-synchronization jump width segment +AT91C_CAN_BRP EQU (0x7F << 16) ;- (CAN) Baudrate Prescaler +AT91C_CAN_SMP EQU (0x1 << 24) ;- (CAN) Sampling mode +// - -------- CAN_TIM : (CAN Offset: 0x18) CAN Timer Register -------- +AT91C_CAN_TIMER EQU (0xFFFF << 0) ;- (CAN) Timer field +// - -------- CAN_TIMESTP : (CAN Offset: 0x1c) CAN Timestamp Register -------- +// - -------- CAN_ECR : (CAN Offset: 0x20) CAN Error Counter Register -------- +AT91C_CAN_REC EQU (0xFF << 0) ;- (CAN) Receive Error Counter +AT91C_CAN_TEC EQU (0xFF << 16) ;- (CAN) Transmit Error Counter +// - -------- CAN_TCR : (CAN Offset: 0x24) CAN Transfer Command Register -------- +AT91C_CAN_TIMRST EQU (0x1 << 31) ;- (CAN) Timer Reset Field +// - -------- CAN_ACR : (CAN Offset: 0x28) CAN Abort Command Register -------- + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Ethernet MAC 10/100 +// - ***************************************************************************** +// - -------- EMAC_NCR : (EMAC Offset: 0x0) -------- +AT91C_EMAC_LB EQU (0x1 << 0) ;- (EMAC) Loopback. Optional. When set, loopback signal is at high level. +AT91C_EMAC_LLB EQU (0x1 << 1) ;- (EMAC) Loopback local. +AT91C_EMAC_RE EQU (0x1 << 2) ;- (EMAC) Receive enable. +AT91C_EMAC_TE EQU (0x1 << 3) ;- (EMAC) Transmit enable. +AT91C_EMAC_MPE EQU (0x1 << 4) ;- (EMAC) Management port enable. +AT91C_EMAC_CLRSTAT EQU (0x1 << 5) ;- (EMAC) Clear statistics registers. +AT91C_EMAC_INCSTAT EQU (0x1 << 6) ;- (EMAC) Increment statistics registers. +AT91C_EMAC_WESTAT EQU (0x1 << 7) ;- (EMAC) Write enable for statistics registers. +AT91C_EMAC_BP EQU (0x1 << 8) ;- (EMAC) Back pressure. +AT91C_EMAC_TSTART EQU (0x1 << 9) ;- (EMAC) Start Transmission. +AT91C_EMAC_THALT EQU (0x1 << 10) ;- (EMAC) Transmission Halt. +AT91C_EMAC_TPFR EQU (0x1 << 11) ;- (EMAC) Transmit pause frame +AT91C_EMAC_TZQ EQU (0x1 << 12) ;- (EMAC) Transmit zero quantum pause frame +// - -------- EMAC_NCFGR : (EMAC Offset: 0x4) Network Configuration Register -------- +AT91C_EMAC_SPD EQU (0x1 << 0) ;- (EMAC) Speed. +AT91C_EMAC_FD EQU (0x1 << 1) ;- (EMAC) Full duplex. +AT91C_EMAC_JFRAME EQU (0x1 << 3) ;- (EMAC) Jumbo Frames. +AT91C_EMAC_CAF EQU (0x1 << 4) ;- (EMAC) Copy all frames. +AT91C_EMAC_NBC EQU (0x1 << 5) ;- (EMAC) No broadcast. +AT91C_EMAC_MTI EQU (0x1 << 6) ;- (EMAC) Multicast hash event enable +AT91C_EMAC_UNI EQU (0x1 << 7) ;- (EMAC) Unicast hash enable. +AT91C_EMAC_BIG EQU (0x1 << 8) ;- (EMAC) Receive 1522 bytes. +AT91C_EMAC_EAE EQU (0x1 << 9) ;- (EMAC) External address match enable. +AT91C_EMAC_CLK EQU (0x3 << 10) ;- (EMAC) +AT91C_EMAC_CLK_HCLK_8 EQU (0x0 << 10) ;- (EMAC) HCLK divided by 8 +AT91C_EMAC_CLK_HCLK_16 EQU (0x1 << 10) ;- (EMAC) HCLK divided by 16 +AT91C_EMAC_CLK_HCLK_32 EQU (0x2 << 10) ;- (EMAC) HCLK divided by 32 +AT91C_EMAC_CLK_HCLK_64 EQU (0x3 << 10) ;- (EMAC) HCLK divided by 64 +AT91C_EMAC_RTY EQU (0x1 << 12) ;- (EMAC) +AT91C_EMAC_PAE EQU (0x1 << 13) ;- (EMAC) +AT91C_EMAC_RBOF EQU (0x3 << 14) ;- (EMAC) +AT91C_EMAC_RBOF_OFFSET_0 EQU (0x0 << 14) ;- (EMAC) no offset from start of receive buffer +AT91C_EMAC_RBOF_OFFSET_1 EQU (0x1 << 14) ;- (EMAC) one byte offset from start of receive buffer +AT91C_EMAC_RBOF_OFFSET_2 EQU (0x2 << 14) ;- (EMAC) two bytes offset from start of receive buffer +AT91C_EMAC_RBOF_OFFSET_3 EQU (0x3 << 14) ;- (EMAC) three bytes offset from start of receive buffer +AT91C_EMAC_RLCE EQU (0x1 << 16) ;- (EMAC) Receive Length field Checking Enable +AT91C_EMAC_DRFCS EQU (0x1 << 17) ;- (EMAC) Discard Receive FCS +AT91C_EMAC_EFRHD EQU (0x1 << 18) ;- (EMAC) +AT91C_EMAC_IRXFCS EQU (0x1 << 19) ;- (EMAC) Ignore RX FCS +// - -------- EMAC_NSR : (EMAC Offset: 0x8) Network Status Register -------- +AT91C_EMAC_LINKR EQU (0x1 << 0) ;- (EMAC) +AT91C_EMAC_MDIO EQU (0x1 << 1) ;- (EMAC) +AT91C_EMAC_IDLE EQU (0x1 << 2) ;- (EMAC) +// - -------- EMAC_TSR : (EMAC Offset: 0x14) Transmit Status Register -------- +AT91C_EMAC_UBR EQU (0x1 << 0) ;- (EMAC) +AT91C_EMAC_COL EQU (0x1 << 1) ;- (EMAC) +AT91C_EMAC_RLES EQU (0x1 << 2) ;- (EMAC) +AT91C_EMAC_TGO EQU (0x1 << 3) ;- (EMAC) Transmit Go +AT91C_EMAC_BEX EQU (0x1 << 4) ;- (EMAC) Buffers exhausted mid frame +AT91C_EMAC_COMP EQU (0x1 << 5) ;- (EMAC) +AT91C_EMAC_UND EQU (0x1 << 6) ;- (EMAC) +// - -------- EMAC_RSR : (EMAC Offset: 0x20) Receive Status Register -------- +AT91C_EMAC_BNA EQU (0x1 << 0) ;- (EMAC) +AT91C_EMAC_REC EQU (0x1 << 1) ;- (EMAC) +AT91C_EMAC_OVR EQU (0x1 << 2) ;- (EMAC) +// - -------- EMAC_ISR : (EMAC Offset: 0x24) Interrupt Status Register -------- +AT91C_EMAC_MFD EQU (0x1 << 0) ;- (EMAC) +AT91C_EMAC_RCOMP EQU (0x1 << 1) ;- (EMAC) +AT91C_EMAC_RXUBR EQU (0x1 << 2) ;- (EMAC) +AT91C_EMAC_TXUBR EQU (0x1 << 3) ;- (EMAC) +AT91C_EMAC_TUNDR EQU (0x1 << 4) ;- (EMAC) +AT91C_EMAC_RLEX EQU (0x1 << 5) ;- (EMAC) +AT91C_EMAC_TXERR EQU (0x1 << 6) ;- (EMAC) +AT91C_EMAC_TCOMP EQU (0x1 << 7) ;- (EMAC) +AT91C_EMAC_LINK EQU (0x1 << 9) ;- (EMAC) +AT91C_EMAC_ROVR EQU (0x1 << 10) ;- (EMAC) +AT91C_EMAC_HRESP EQU (0x1 << 11) ;- (EMAC) +AT91C_EMAC_PFRE EQU (0x1 << 12) ;- (EMAC) +AT91C_EMAC_PTZ EQU (0x1 << 13) ;- (EMAC) +// - -------- EMAC_IER : (EMAC Offset: 0x28) Interrupt Enable Register -------- +// - -------- EMAC_IDR : (EMAC Offset: 0x2c) Interrupt Disable Register -------- +// - -------- EMAC_IMR : (EMAC Offset: 0x30) Interrupt Mask Register -------- +// - -------- EMAC_MAN : (EMAC Offset: 0x34) PHY Maintenance Register -------- +AT91C_EMAC_DATA EQU (0xFFFF << 0) ;- (EMAC) +AT91C_EMAC_CODE EQU (0x3 << 16) ;- (EMAC) +AT91C_EMAC_REGA EQU (0x1F << 18) ;- (EMAC) +AT91C_EMAC_PHYA EQU (0x1F << 23) ;- (EMAC) +AT91C_EMAC_RW EQU (0x3 << 28) ;- (EMAC) +AT91C_EMAC_SOF EQU (0x3 << 30) ;- (EMAC) +// - -------- EMAC_USRIO : (EMAC Offset: 0xc0) USER Input Output Register -------- +AT91C_EMAC_RMII EQU (0x1 << 0) ;- (EMAC) Reduce MII +AT91C_EMAC_CLKEN EQU (0x1 << 1) ;- (EMAC) Clock Enable +// - -------- EMAC_WOL : (EMAC Offset: 0xc4) Wake On LAN Register -------- +AT91C_EMAC_IP EQU (0xFFFF << 0) ;- (EMAC) ARP request IP address +AT91C_EMAC_MAG EQU (0x1 << 16) ;- (EMAC) Magic packet event enable +AT91C_EMAC_ARP EQU (0x1 << 17) ;- (EMAC) ARP request event enable +AT91C_EMAC_SA1 EQU (0x1 << 18) ;- (EMAC) Specific address register 1 event enable +// - -------- EMAC_REV : (EMAC Offset: 0xfc) Revision Register -------- +AT91C_EMAC_REVREF EQU (0xFFFF << 0) ;- (EMAC) +AT91C_EMAC_PARTREF EQU (0xFFFF << 16) ;- (EMAC) + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Analog to Digital Convertor +// - ***************************************************************************** +// - -------- ADC_CR : (ADC Offset: 0x0) ADC Control Register -------- +AT91C_ADC_SWRST EQU (0x1 << 0) ;- (ADC) Software Reset +AT91C_ADC_START EQU (0x1 << 1) ;- (ADC) Start Conversion +// - -------- ADC_MR : (ADC Offset: 0x4) ADC Mode Register -------- +AT91C_ADC_TRGEN EQU (0x1 << 0) ;- (ADC) Trigger Enable +AT91C_ADC_TRGEN_DIS EQU (0x0) ;- (ADC) Hradware triggers are disabled. Starting a conversion is only possible by software +AT91C_ADC_TRGEN_EN EQU (0x1) ;- (ADC) Hardware trigger selected by TRGSEL field is enabled. +AT91C_ADC_TRGSEL EQU (0x7 << 1) ;- (ADC) Trigger Selection +AT91C_ADC_TRGSEL_TIOA0 EQU (0x0 << 1) ;- (ADC) Selected TRGSEL = TIAO0 +AT91C_ADC_TRGSEL_TIOA1 EQU (0x1 << 1) ;- (ADC) Selected TRGSEL = TIAO1 +AT91C_ADC_TRGSEL_TIOA2 EQU (0x2 << 1) ;- (ADC) Selected TRGSEL = TIAO2 +AT91C_ADC_TRGSEL_TIOA3 EQU (0x3 << 1) ;- (ADC) Selected TRGSEL = TIAO3 +AT91C_ADC_TRGSEL_TIOA4 EQU (0x4 << 1) ;- (ADC) Selected TRGSEL = TIAO4 +AT91C_ADC_TRGSEL_TIOA5 EQU (0x5 << 1) ;- (ADC) Selected TRGSEL = TIAO5 +AT91C_ADC_TRGSEL_EXT EQU (0x6 << 1) ;- (ADC) Selected TRGSEL = External Trigger +AT91C_ADC_LOWRES EQU (0x1 << 4) ;- (ADC) Resolution. +AT91C_ADC_LOWRES_10_BIT EQU (0x0 << 4) ;- (ADC) 10-bit resolution +AT91C_ADC_LOWRES_8_BIT EQU (0x1 << 4) ;- (ADC) 8-bit resolution +AT91C_ADC_SLEEP EQU (0x1 << 5) ;- (ADC) Sleep Mode +AT91C_ADC_SLEEP_NORMAL_MODE EQU (0x0 << 5) ;- (ADC) Normal Mode +AT91C_ADC_SLEEP_MODE EQU (0x1 << 5) ;- (ADC) Sleep Mode +AT91C_ADC_PRESCAL EQU (0x3F << 8) ;- (ADC) Prescaler rate selection +AT91C_ADC_STARTUP EQU (0x1F << 16) ;- (ADC) Startup Time +AT91C_ADC_SHTIM EQU (0xF << 24) ;- (ADC) Sample & Hold Time +// - -------- ADC_CHER : (ADC Offset: 0x10) ADC Channel Enable Register -------- +AT91C_ADC_CH0 EQU (0x1 << 0) ;- (ADC) Channel 0 +AT91C_ADC_CH1 EQU (0x1 << 1) ;- (ADC) Channel 1 +AT91C_ADC_CH2 EQU (0x1 << 2) ;- (ADC) Channel 2 +AT91C_ADC_CH3 EQU (0x1 << 3) ;- (ADC) Channel 3 +AT91C_ADC_CH4 EQU (0x1 << 4) ;- (ADC) Channel 4 +AT91C_ADC_CH5 EQU (0x1 << 5) ;- (ADC) Channel 5 +AT91C_ADC_CH6 EQU (0x1 << 6) ;- (ADC) Channel 6 +AT91C_ADC_CH7 EQU (0x1 << 7) ;- (ADC) Channel 7 +// - -------- ADC_CHDR : (ADC Offset: 0x14) ADC Channel Disable Register -------- +// - -------- ADC_CHSR : (ADC Offset: 0x18) ADC Channel Status Register -------- +// - -------- ADC_SR : (ADC Offset: 0x1c) ADC Status Register -------- +AT91C_ADC_EOC0 EQU (0x1 << 0) ;- (ADC) End of Conversion +AT91C_ADC_EOC1 EQU (0x1 << 1) ;- (ADC) End of Conversion +AT91C_ADC_EOC2 EQU (0x1 << 2) ;- (ADC) End of Conversion +AT91C_ADC_EOC3 EQU (0x1 << 3) ;- (ADC) End of Conversion +AT91C_ADC_EOC4 EQU (0x1 << 4) ;- (ADC) End of Conversion +AT91C_ADC_EOC5 EQU (0x1 << 5) ;- (ADC) End of Conversion +AT91C_ADC_EOC6 EQU (0x1 << 6) ;- (ADC) End of Conversion +AT91C_ADC_EOC7 EQU (0x1 << 7) ;- (ADC) End of Conversion +AT91C_ADC_OVRE0 EQU (0x1 << 8) ;- (ADC) Overrun Error +AT91C_ADC_OVRE1 EQU (0x1 << 9) ;- (ADC) Overrun Error +AT91C_ADC_OVRE2 EQU (0x1 << 10) ;- (ADC) Overrun Error +AT91C_ADC_OVRE3 EQU (0x1 << 11) ;- (ADC) Overrun Error +AT91C_ADC_OVRE4 EQU (0x1 << 12) ;- (ADC) Overrun Error +AT91C_ADC_OVRE5 EQU (0x1 << 13) ;- (ADC) Overrun Error +AT91C_ADC_OVRE6 EQU (0x1 << 14) ;- (ADC) Overrun Error +AT91C_ADC_OVRE7 EQU (0x1 << 15) ;- (ADC) Overrun Error +AT91C_ADC_DRDY EQU (0x1 << 16) ;- (ADC) Data Ready +AT91C_ADC_GOVRE EQU (0x1 << 17) ;- (ADC) General Overrun +AT91C_ADC_ENDRX EQU (0x1 << 18) ;- (ADC) End of Receiver Transfer +AT91C_ADC_RXBUFF EQU (0x1 << 19) ;- (ADC) RXBUFF Interrupt +// - -------- ADC_LCDR : (ADC Offset: 0x20) ADC Last Converted Data Register -------- +AT91C_ADC_LDATA EQU (0x3FF << 0) ;- (ADC) Last Data Converted +// - -------- ADC_IER : (ADC Offset: 0x24) ADC Interrupt Enable Register -------- +// - -------- ADC_IDR : (ADC Offset: 0x28) ADC Interrupt Disable Register -------- +// - -------- ADC_IMR : (ADC Offset: 0x2c) ADC Interrupt Mask Register -------- +// - -------- ADC_CDR0 : (ADC Offset: 0x30) ADC Channel Data Register 0 -------- +AT91C_ADC_DATA EQU (0x3FF << 0) ;- (ADC) Converted Data +// - -------- ADC_CDR1 : (ADC Offset: 0x34) ADC Channel Data Register 1 -------- +// - -------- ADC_CDR2 : (ADC Offset: 0x38) ADC Channel Data Register 2 -------- +// - -------- ADC_CDR3 : (ADC Offset: 0x3c) ADC Channel Data Register 3 -------- +// - -------- ADC_CDR4 : (ADC Offset: 0x40) ADC Channel Data Register 4 -------- +// - -------- ADC_CDR5 : (ADC Offset: 0x44) ADC Channel Data Register 5 -------- +// - -------- ADC_CDR6 : (ADC Offset: 0x48) ADC Channel Data Register 6 -------- +// - -------- ADC_CDR7 : (ADC Offset: 0x4c) ADC Channel Data Register 7 -------- + +// - ***************************************************************************** +// - REGISTER ADDRESS DEFINITION FOR AT91SAM7X256 +// - ***************************************************************************** +// - ========== Register definition for SYS peripheral ========== +// - ========== Register definition for AIC peripheral ========== +AT91C_AIC_IVR EQU (0xFFFFF100) ;- (AIC) IRQ Vector Register +AT91C_AIC_SMR EQU (0xFFFFF000) ;- (AIC) Source Mode Register +AT91C_AIC_FVR EQU (0xFFFFF104) ;- (AIC) FIQ Vector Register +AT91C_AIC_DCR EQU (0xFFFFF138) ;- (AIC) Debug Control Register (Protect) +AT91C_AIC_EOICR EQU (0xFFFFF130) ;- (AIC) End of Interrupt Command Register +AT91C_AIC_SVR EQU (0xFFFFF080) ;- (AIC) Source Vector Register +AT91C_AIC_FFSR EQU (0xFFFFF148) ;- (AIC) Fast Forcing Status Register +AT91C_AIC_ICCR EQU (0xFFFFF128) ;- (AIC) Interrupt Clear Command Register +AT91C_AIC_ISR EQU (0xFFFFF108) ;- (AIC) Interrupt Status Register +AT91C_AIC_IMR EQU (0xFFFFF110) ;- (AIC) Interrupt Mask Register +AT91C_AIC_IPR EQU (0xFFFFF10C) ;- (AIC) Interrupt Pending Register +AT91C_AIC_FFER EQU (0xFFFFF140) ;- (AIC) Fast Forcing Enable Register +AT91C_AIC_IECR EQU (0xFFFFF120) ;- (AIC) Interrupt Enable Command Register +AT91C_AIC_ISCR EQU (0xFFFFF12C) ;- (AIC) Interrupt Set Command Register +AT91C_AIC_FFDR EQU (0xFFFFF144) ;- (AIC) Fast Forcing Disable Register +AT91C_AIC_CISR EQU (0xFFFFF114) ;- (AIC) Core Interrupt Status Register +AT91C_AIC_IDCR EQU (0xFFFFF124) ;- (AIC) Interrupt Disable Command Register +AT91C_AIC_SPU EQU (0xFFFFF134) ;- (AIC) Spurious Vector Register +// - ========== Register definition for PDC_DBGU peripheral ========== +AT91C_DBGU_TCR EQU (0xFFFFF30C) ;- (PDC_DBGU) Transmit Counter Register +AT91C_DBGU_RNPR EQU (0xFFFFF310) ;- (PDC_DBGU) Receive Next Pointer Register +AT91C_DBGU_TNPR EQU (0xFFFFF318) ;- (PDC_DBGU) Transmit Next Pointer Register +AT91C_DBGU_TPR EQU (0xFFFFF308) ;- (PDC_DBGU) Transmit Pointer Register +AT91C_DBGU_RPR EQU (0xFFFFF300) ;- (PDC_DBGU) Receive Pointer Register +AT91C_DBGU_RCR EQU (0xFFFFF304) ;- (PDC_DBGU) Receive Counter Register +AT91C_DBGU_RNCR EQU (0xFFFFF314) ;- (PDC_DBGU) Receive Next Counter Register +AT91C_DBGU_PTCR EQU (0xFFFFF320) ;- (PDC_DBGU) PDC Transfer Control Register +AT91C_DBGU_PTSR EQU (0xFFFFF324) ;- (PDC_DBGU) PDC Transfer Status Register +AT91C_DBGU_TNCR EQU (0xFFFFF31C) ;- (PDC_DBGU) Transmit Next Counter Register +// - ========== Register definition for DBGU peripheral ========== +AT91C_DBGU_EXID EQU (0xFFFFF244) ;- (DBGU) Chip ID Extension Register +AT91C_DBGU_BRGR EQU (0xFFFFF220) ;- (DBGU) Baud Rate Generator Register +AT91C_DBGU_IDR EQU (0xFFFFF20C) ;- (DBGU) Interrupt Disable Register +AT91C_DBGU_CSR EQU (0xFFFFF214) ;- (DBGU) Channel Status Register +AT91C_DBGU_CIDR EQU (0xFFFFF240) ;- (DBGU) Chip ID Register +AT91C_DBGU_MR EQU (0xFFFFF204) ;- (DBGU) Mode Register +AT91C_DBGU_IMR EQU (0xFFFFF210) ;- (DBGU) Interrupt Mask Register +AT91C_DBGU_CR EQU (0xFFFFF200) ;- (DBGU) Control Register +AT91C_DBGU_FNTR EQU (0xFFFFF248) ;- (DBGU) Force NTRST Register +AT91C_DBGU_THR EQU (0xFFFFF21C) ;- (DBGU) Transmitter Holding Register +AT91C_DBGU_RHR EQU (0xFFFFF218) ;- (DBGU) Receiver Holding Register +AT91C_DBGU_IER EQU (0xFFFFF208) ;- (DBGU) Interrupt Enable Register +// - ========== Register definition for PIOA peripheral ========== +AT91C_PIOA_ODR EQU (0xFFFFF414) ;- (PIOA) Output Disable Registerr +AT91C_PIOA_SODR EQU (0xFFFFF430) ;- (PIOA) Set Output Data Register +AT91C_PIOA_ISR EQU (0xFFFFF44C) ;- (PIOA) Interrupt Status Register +AT91C_PIOA_ABSR EQU (0xFFFFF478) ;- (PIOA) AB Select Status Register +AT91C_PIOA_IER EQU (0xFFFFF440) ;- (PIOA) Interrupt Enable Register +AT91C_PIOA_PPUDR EQU (0xFFFFF460) ;- (PIOA) Pull-up Disable Register +AT91C_PIOA_IMR EQU (0xFFFFF448) ;- (PIOA) Interrupt Mask Register +AT91C_PIOA_PER EQU (0xFFFFF400) ;- (PIOA) PIO Enable Register +AT91C_PIOA_IFDR EQU (0xFFFFF424) ;- (PIOA) Input Filter Disable Register +AT91C_PIOA_OWDR EQU (0xFFFFF4A4) ;- (PIOA) Output Write Disable Register +AT91C_PIOA_MDSR EQU (0xFFFFF458) ;- (PIOA) Multi-driver Status Register +AT91C_PIOA_IDR EQU (0xFFFFF444) ;- (PIOA) Interrupt Disable Register +AT91C_PIOA_ODSR EQU (0xFFFFF438) ;- (PIOA) Output Data Status Register +AT91C_PIOA_PPUSR EQU (0xFFFFF468) ;- (PIOA) Pull-up Status Register +AT91C_PIOA_OWSR EQU (0xFFFFF4A8) ;- (PIOA) Output Write Status Register +AT91C_PIOA_BSR EQU (0xFFFFF474) ;- (PIOA) Select B Register +AT91C_PIOA_OWER EQU (0xFFFFF4A0) ;- (PIOA) Output Write Enable Register +AT91C_PIOA_IFER EQU (0xFFFFF420) ;- (PIOA) Input Filter Enable Register +AT91C_PIOA_PDSR EQU (0xFFFFF43C) ;- (PIOA) Pin Data Status Register +AT91C_PIOA_PPUER EQU (0xFFFFF464) ;- (PIOA) Pull-up Enable Register +AT91C_PIOA_OSR EQU (0xFFFFF418) ;- (PIOA) Output Status Register +AT91C_PIOA_ASR EQU (0xFFFFF470) ;- (PIOA) Select A Register +AT91C_PIOA_MDDR EQU (0xFFFFF454) ;- (PIOA) Multi-driver Disable Register +AT91C_PIOA_CODR EQU (0xFFFFF434) ;- (PIOA) Clear Output Data Register +AT91C_PIOA_MDER EQU (0xFFFFF450) ;- (PIOA) Multi-driver Enable Register +AT91C_PIOA_PDR EQU (0xFFFFF404) ;- (PIOA) PIO Disable Register +AT91C_PIOA_IFSR EQU (0xFFFFF428) ;- (PIOA) Input Filter Status Register +AT91C_PIOA_OER EQU (0xFFFFF410) ;- (PIOA) Output Enable Register +AT91C_PIOA_PSR EQU (0xFFFFF408) ;- (PIOA) PIO Status Register +// - ========== Register definition for PIOB peripheral ========== +AT91C_PIOB_OWDR EQU (0xFFFFF6A4) ;- (PIOB) Output Write Disable Register +AT91C_PIOB_MDER EQU (0xFFFFF650) ;- (PIOB) Multi-driver Enable Register +AT91C_PIOB_PPUSR EQU (0xFFFFF668) ;- (PIOB) Pull-up Status Register +AT91C_PIOB_IMR EQU (0xFFFFF648) ;- (PIOB) Interrupt Mask Register +AT91C_PIOB_ASR EQU (0xFFFFF670) ;- (PIOB) Select A Register +AT91C_PIOB_PPUDR EQU (0xFFFFF660) ;- (PIOB) Pull-up Disable Register +AT91C_PIOB_PSR EQU (0xFFFFF608) ;- (PIOB) PIO Status Register +AT91C_PIOB_IER EQU (0xFFFFF640) ;- (PIOB) Interrupt Enable Register +AT91C_PIOB_CODR EQU (0xFFFFF634) ;- (PIOB) Clear Output Data Register +AT91C_PIOB_OWER EQU (0xFFFFF6A0) ;- (PIOB) Output Write Enable Register +AT91C_PIOB_ABSR EQU (0xFFFFF678) ;- (PIOB) AB Select Status Register +AT91C_PIOB_IFDR EQU (0xFFFFF624) ;- (PIOB) Input Filter Disable Register +AT91C_PIOB_PDSR EQU (0xFFFFF63C) ;- (PIOB) Pin Data Status Register +AT91C_PIOB_IDR EQU (0xFFFFF644) ;- (PIOB) Interrupt Disable Register +AT91C_PIOB_OWSR EQU (0xFFFFF6A8) ;- (PIOB) Output Write Status Register +AT91C_PIOB_PDR EQU (0xFFFFF604) ;- (PIOB) PIO Disable Register +AT91C_PIOB_ODR EQU (0xFFFFF614) ;- (PIOB) Output Disable Registerr +AT91C_PIOB_IFSR EQU (0xFFFFF628) ;- (PIOB) Input Filter Status Register +AT91C_PIOB_PPUER EQU (0xFFFFF664) ;- (PIOB) Pull-up Enable Register +AT91C_PIOB_SODR EQU (0xFFFFF630) ;- (PIOB) Set Output Data Register +AT91C_PIOB_ISR EQU (0xFFFFF64C) ;- (PIOB) Interrupt Status Register +AT91C_PIOB_ODSR EQU (0xFFFFF638) ;- (PIOB) Output Data Status Register +AT91C_PIOB_OSR EQU (0xFFFFF618) ;- (PIOB) Output Status Register +AT91C_PIOB_MDSR EQU (0xFFFFF658) ;- (PIOB) Multi-driver Status Register +AT91C_PIOB_IFER EQU (0xFFFFF620) ;- (PIOB) Input Filter Enable Register +AT91C_PIOB_BSR EQU (0xFFFFF674) ;- (PIOB) Select B Register +AT91C_PIOB_MDDR EQU (0xFFFFF654) ;- (PIOB) Multi-driver Disable Register +AT91C_PIOB_OER EQU (0xFFFFF610) ;- (PIOB) Output Enable Register +AT91C_PIOB_PER EQU (0xFFFFF600) ;- (PIOB) PIO Enable Register +// - ========== Register definition for CKGR peripheral ========== +AT91C_CKGR_MOR EQU (0xFFFFFC20) ;- (CKGR) Main Oscillator Register +AT91C_CKGR_PLLR EQU (0xFFFFFC2C) ;- (CKGR) PLL Register +AT91C_CKGR_MCFR EQU (0xFFFFFC24) ;- (CKGR) Main Clock Frequency Register +// - ========== Register definition for PMC peripheral ========== +AT91C_PMC_IDR EQU (0xFFFFFC64) ;- (PMC) Interrupt Disable Register +AT91C_PMC_MOR EQU (0xFFFFFC20) ;- (PMC) Main Oscillator Register +AT91C_PMC_PLLR EQU (0xFFFFFC2C) ;- (PMC) PLL Register +AT91C_PMC_PCER EQU (0xFFFFFC10) ;- (PMC) Peripheral Clock Enable Register +AT91C_PMC_PCKR EQU (0xFFFFFC40) ;- (PMC) Programmable Clock Register +AT91C_PMC_MCKR EQU (0xFFFFFC30) ;- (PMC) Master Clock Register +AT91C_PMC_SCDR EQU (0xFFFFFC04) ;- (PMC) System Clock Disable Register +AT91C_PMC_PCDR EQU (0xFFFFFC14) ;- (PMC) Peripheral Clock Disable Register +AT91C_PMC_SCSR EQU (0xFFFFFC08) ;- (PMC) System Clock Status Register +AT91C_PMC_PCSR EQU (0xFFFFFC18) ;- (PMC) Peripheral Clock Status Register +AT91C_PMC_MCFR EQU (0xFFFFFC24) ;- (PMC) Main Clock Frequency Register +AT91C_PMC_SCER EQU (0xFFFFFC00) ;- (PMC) System Clock Enable Register +AT91C_PMC_IMR EQU (0xFFFFFC6C) ;- (PMC) Interrupt Mask Register +AT91C_PMC_IER EQU (0xFFFFFC60) ;- (PMC) Interrupt Enable Register +AT91C_PMC_SR EQU (0xFFFFFC68) ;- (PMC) Status Register +// - ========== Register definition for RSTC peripheral ========== +AT91C_RSTC_RCR EQU (0xFFFFFD00) ;- (RSTC) Reset Control Register +AT91C_RSTC_RMR EQU (0xFFFFFD08) ;- (RSTC) Reset Mode Register +AT91C_RSTC_RSR EQU (0xFFFFFD04) ;- (RSTC) Reset Status Register +// - ========== Register definition for RTTC peripheral ========== +AT91C_RTTC_RTSR EQU (0xFFFFFD2C) ;- (RTTC) Real-time Status Register +AT91C_RTTC_RTMR EQU (0xFFFFFD20) ;- (RTTC) Real-time Mode Register +AT91C_RTTC_RTVR EQU (0xFFFFFD28) ;- (RTTC) Real-time Value Register +AT91C_RTTC_RTAR EQU (0xFFFFFD24) ;- (RTTC) Real-time Alarm Register +// - ========== Register definition for PITC peripheral ========== +AT91C_PITC_PIVR EQU (0xFFFFFD38) ;- (PITC) Period Interval Value Register +AT91C_PITC_PISR EQU (0xFFFFFD34) ;- (PITC) Period Interval Status Register +AT91C_PITC_PIIR EQU (0xFFFFFD3C) ;- (PITC) Period Interval Image Register +AT91C_PITC_PIMR EQU (0xFFFFFD30) ;- (PITC) Period Interval Mode Register +// - ========== Register definition for WDTC peripheral ========== +AT91C_WDTC_WDCR EQU (0xFFFFFD40) ;- (WDTC) Watchdog Control Register +AT91C_WDTC_WDSR EQU (0xFFFFFD48) ;- (WDTC) Watchdog Status Register +AT91C_WDTC_WDMR EQU (0xFFFFFD44) ;- (WDTC) Watchdog Mode Register +// - ========== Register definition for VREG peripheral ========== +AT91C_VREG_MR EQU (0xFFFFFD60) ;- (VREG) Voltage Regulator Mode Register +// - ========== Register definition for MC peripheral ========== +AT91C_MC_ASR EQU (0xFFFFFF04) ;- (MC) MC Abort Status Register +AT91C_MC_RCR EQU (0xFFFFFF00) ;- (MC) MC Remap Control Register +AT91C_MC_FCR EQU (0xFFFFFF64) ;- (MC) MC Flash Command Register +AT91C_MC_AASR EQU (0xFFFFFF08) ;- (MC) MC Abort Address Status Register +AT91C_MC_FSR EQU (0xFFFFFF68) ;- (MC) MC Flash Status Register +AT91C_MC_FMR EQU (0xFFFFFF60) ;- (MC) MC Flash Mode Register +// - ========== Register definition for PDC_SPI1 peripheral ========== +AT91C_SPI1_PTCR EQU (0xFFFE4120) ;- (PDC_SPI1) PDC Transfer Control Register +AT91C_SPI1_RPR EQU (0xFFFE4100) ;- (PDC_SPI1) Receive Pointer Register +AT91C_SPI1_TNCR EQU (0xFFFE411C) ;- (PDC_SPI1) Transmit Next Counter Register +AT91C_SPI1_TPR EQU (0xFFFE4108) ;- (PDC_SPI1) Transmit Pointer Register +AT91C_SPI1_TNPR EQU (0xFFFE4118) ;- (PDC_SPI1) Transmit Next Pointer Register +AT91C_SPI1_TCR EQU (0xFFFE410C) ;- (PDC_SPI1) Transmit Counter Register +AT91C_SPI1_RCR EQU (0xFFFE4104) ;- (PDC_SPI1) Receive Counter Register +AT91C_SPI1_RNPR EQU (0xFFFE4110) ;- (PDC_SPI1) Receive Next Pointer Register +AT91C_SPI1_RNCR EQU (0xFFFE4114) ;- (PDC_SPI1) Receive Next Counter Register +AT91C_SPI1_PTSR EQU (0xFFFE4124) ;- (PDC_SPI1) PDC Transfer Status Register +// - ========== Register definition for SPI1 peripheral ========== +AT91C_SPI1_IMR EQU (0xFFFE401C) ;- (SPI1) Interrupt Mask Register +AT91C_SPI1_IER EQU (0xFFFE4014) ;- (SPI1) Interrupt Enable Register +AT91C_SPI1_MR EQU (0xFFFE4004) ;- (SPI1) Mode Register +AT91C_SPI1_RDR EQU (0xFFFE4008) ;- (SPI1) Receive Data Register +AT91C_SPI1_IDR EQU (0xFFFE4018) ;- (SPI1) Interrupt Disable Register +AT91C_SPI1_SR EQU (0xFFFE4010) ;- (SPI1) Status Register +AT91C_SPI1_TDR EQU (0xFFFE400C) ;- (SPI1) Transmit Data Register +AT91C_SPI1_CR EQU (0xFFFE4000) ;- (SPI1) Control Register +AT91C_SPI1_CSR EQU (0xFFFE4030) ;- (SPI1) Chip Select Register +// - ========== Register definition for PDC_SPI0 peripheral ========== +AT91C_SPI0_PTCR EQU (0xFFFE0120) ;- (PDC_SPI0) PDC Transfer Control Register +AT91C_SPI0_TPR EQU (0xFFFE0108) ;- (PDC_SPI0) Transmit Pointer Register +AT91C_SPI0_TCR EQU (0xFFFE010C) ;- (PDC_SPI0) Transmit Counter Register +AT91C_SPI0_RCR EQU (0xFFFE0104) ;- (PDC_SPI0) Receive Counter Register +AT91C_SPI0_PTSR EQU (0xFFFE0124) ;- (PDC_SPI0) PDC Transfer Status Register +AT91C_SPI0_RNPR EQU (0xFFFE0110) ;- (PDC_SPI0) Receive Next Pointer Register +AT91C_SPI0_RPR EQU (0xFFFE0100) ;- (PDC_SPI0) Receive Pointer Register +AT91C_SPI0_TNCR EQU (0xFFFE011C) ;- (PDC_SPI0) Transmit Next Counter Register +AT91C_SPI0_RNCR EQU (0xFFFE0114) ;- (PDC_SPI0) Receive Next Counter Register +AT91C_SPI0_TNPR EQU (0xFFFE0118) ;- (PDC_SPI0) Transmit Next Pointer Register +// - ========== Register definition for SPI0 peripheral ========== +AT91C_SPI0_IER EQU (0xFFFE0014) ;- (SPI0) Interrupt Enable Register +AT91C_SPI0_SR EQU (0xFFFE0010) ;- (SPI0) Status Register +AT91C_SPI0_IDR EQU (0xFFFE0018) ;- (SPI0) Interrupt Disable Register +AT91C_SPI0_CR EQU (0xFFFE0000) ;- (SPI0) Control Register +AT91C_SPI0_MR EQU (0xFFFE0004) ;- (SPI0) Mode Register +AT91C_SPI0_IMR EQU (0xFFFE001C) ;- (SPI0) Interrupt Mask Register +AT91C_SPI0_TDR EQU (0xFFFE000C) ;- (SPI0) Transmit Data Register +AT91C_SPI0_RDR EQU (0xFFFE0008) ;- (SPI0) Receive Data Register +AT91C_SPI0_CSR EQU (0xFFFE0030) ;- (SPI0) Chip Select Register +// - ========== Register definition for PDC_US1 peripheral ========== +AT91C_US1_RNCR EQU (0xFFFC4114) ;- (PDC_US1) Receive Next Counter Register +AT91C_US1_PTCR EQU (0xFFFC4120) ;- (PDC_US1) PDC Transfer Control Register +AT91C_US1_TCR EQU (0xFFFC410C) ;- (PDC_US1) Transmit Counter Register +AT91C_US1_PTSR EQU (0xFFFC4124) ;- (PDC_US1) PDC Transfer Status Register +AT91C_US1_TNPR EQU (0xFFFC4118) ;- (PDC_US1) Transmit Next Pointer Register +AT91C_US1_RCR EQU (0xFFFC4104) ;- (PDC_US1) Receive Counter Register +AT91C_US1_RNPR EQU (0xFFFC4110) ;- (PDC_US1) Receive Next Pointer Register +AT91C_US1_RPR EQU (0xFFFC4100) ;- (PDC_US1) Receive Pointer Register +AT91C_US1_TNCR EQU (0xFFFC411C) ;- (PDC_US1) Transmit Next Counter Register +AT91C_US1_TPR EQU (0xFFFC4108) ;- (PDC_US1) Transmit Pointer Register +// - ========== Register definition for US1 peripheral ========== +AT91C_US1_IF EQU (0xFFFC404C) ;- (US1) IRDA_FILTER Register +AT91C_US1_NER EQU (0xFFFC4044) ;- (US1) Nb Errors Register +AT91C_US1_RTOR EQU (0xFFFC4024) ;- (US1) Receiver Time-out Register +AT91C_US1_CSR EQU (0xFFFC4014) ;- (US1) Channel Status Register +AT91C_US1_IDR EQU (0xFFFC400C) ;- (US1) Interrupt Disable Register +AT91C_US1_IER EQU (0xFFFC4008) ;- (US1) Interrupt Enable Register +AT91C_US1_THR EQU (0xFFFC401C) ;- (US1) Transmitter Holding Register +AT91C_US1_TTGR EQU (0xFFFC4028) ;- (US1) Transmitter Time-guard Register +AT91C_US1_RHR EQU (0xFFFC4018) ;- (US1) Receiver Holding Register +AT91C_US1_BRGR EQU (0xFFFC4020) ;- (US1) Baud Rate Generator Register +AT91C_US1_IMR EQU (0xFFFC4010) ;- (US1) Interrupt Mask Register +AT91C_US1_FIDI EQU (0xFFFC4040) ;- (US1) FI_DI_Ratio Register +AT91C_US1_CR EQU (0xFFFC4000) ;- (US1) Control Register +AT91C_US1_MR EQU (0xFFFC4004) ;- (US1) Mode Register +// - ========== Register definition for PDC_US0 peripheral ========== +AT91C_US0_TNPR EQU (0xFFFC0118) ;- (PDC_US0) Transmit Next Pointer Register +AT91C_US0_RNPR EQU (0xFFFC0110) ;- (PDC_US0) Receive Next Pointer Register +AT91C_US0_TCR EQU (0xFFFC010C) ;- (PDC_US0) Transmit Counter Register +AT91C_US0_PTCR EQU (0xFFFC0120) ;- (PDC_US0) PDC Transfer Control Register +AT91C_US0_PTSR EQU (0xFFFC0124) ;- (PDC_US0) PDC Transfer Status Register +AT91C_US0_TNCR EQU (0xFFFC011C) ;- (PDC_US0) Transmit Next Counter Register +AT91C_US0_TPR EQU (0xFFFC0108) ;- (PDC_US0) Transmit Pointer Register +AT91C_US0_RCR EQU (0xFFFC0104) ;- (PDC_US0) Receive Counter Register +AT91C_US0_RPR EQU (0xFFFC0100) ;- (PDC_US0) Receive Pointer Register +AT91C_US0_RNCR EQU (0xFFFC0114) ;- (PDC_US0) Receive Next Counter Register +// - ========== Register definition for US0 peripheral ========== +AT91C_US0_BRGR EQU (0xFFFC0020) ;- (US0) Baud Rate Generator Register +AT91C_US0_NER EQU (0xFFFC0044) ;- (US0) Nb Errors Register +AT91C_US0_CR EQU (0xFFFC0000) ;- (US0) Control Register +AT91C_US0_IMR EQU (0xFFFC0010) ;- (US0) Interrupt Mask Register +AT91C_US0_FIDI EQU (0xFFFC0040) ;- (US0) FI_DI_Ratio Register +AT91C_US0_TTGR EQU (0xFFFC0028) ;- (US0) Transmitter Time-guard Register +AT91C_US0_MR EQU (0xFFFC0004) ;- (US0) Mode Register +AT91C_US0_RTOR EQU (0xFFFC0024) ;- (US0) Receiver Time-out Register +AT91C_US0_CSR EQU (0xFFFC0014) ;- (US0) Channel Status Register +AT91C_US0_RHR EQU (0xFFFC0018) ;- (US0) Receiver Holding Register +AT91C_US0_IDR EQU (0xFFFC000C) ;- (US0) Interrupt Disable Register +AT91C_US0_THR EQU (0xFFFC001C) ;- (US0) Transmitter Holding Register +AT91C_US0_IF EQU (0xFFFC004C) ;- (US0) IRDA_FILTER Register +AT91C_US0_IER EQU (0xFFFC0008) ;- (US0) Interrupt Enable Register +// - ========== Register definition for PDC_SSC peripheral ========== +AT91C_SSC_TNCR EQU (0xFFFD411C) ;- (PDC_SSC) Transmit Next Counter Register +AT91C_SSC_RPR EQU (0xFFFD4100) ;- (PDC_SSC) Receive Pointer Register +AT91C_SSC_RNCR EQU (0xFFFD4114) ;- (PDC_SSC) Receive Next Counter Register +AT91C_SSC_TPR EQU (0xFFFD4108) ;- (PDC_SSC) Transmit Pointer Register +AT91C_SSC_PTCR EQU (0xFFFD4120) ;- (PDC_SSC) PDC Transfer Control Register +AT91C_SSC_TCR EQU (0xFFFD410C) ;- (PDC_SSC) Transmit Counter Register +AT91C_SSC_RCR EQU (0xFFFD4104) ;- (PDC_SSC) Receive Counter Register +AT91C_SSC_RNPR EQU (0xFFFD4110) ;- (PDC_SSC) Receive Next Pointer Register +AT91C_SSC_TNPR EQU (0xFFFD4118) ;- (PDC_SSC) Transmit Next Pointer Register +AT91C_SSC_PTSR EQU (0xFFFD4124) ;- (PDC_SSC) PDC Transfer Status Register +// - ========== Register definition for SSC peripheral ========== +AT91C_SSC_RHR EQU (0xFFFD4020) ;- (SSC) Receive Holding Register +AT91C_SSC_RSHR EQU (0xFFFD4030) ;- (SSC) Receive Sync Holding Register +AT91C_SSC_TFMR EQU (0xFFFD401C) ;- (SSC) Transmit Frame Mode Register +AT91C_SSC_IDR EQU (0xFFFD4048) ;- (SSC) Interrupt Disable Register +AT91C_SSC_THR EQU (0xFFFD4024) ;- (SSC) Transmit Holding Register +AT91C_SSC_RCMR EQU (0xFFFD4010) ;- (SSC) Receive Clock ModeRegister +AT91C_SSC_IER EQU (0xFFFD4044) ;- (SSC) Interrupt Enable Register +AT91C_SSC_TSHR EQU (0xFFFD4034) ;- (SSC) Transmit Sync Holding Register +AT91C_SSC_SR EQU (0xFFFD4040) ;- (SSC) Status Register +AT91C_SSC_CMR EQU (0xFFFD4004) ;- (SSC) Clock Mode Register +AT91C_SSC_TCMR EQU (0xFFFD4018) ;- (SSC) Transmit Clock Mode Register +AT91C_SSC_CR EQU (0xFFFD4000) ;- (SSC) Control Register +AT91C_SSC_IMR EQU (0xFFFD404C) ;- (SSC) Interrupt Mask Register +AT91C_SSC_RFMR EQU (0xFFFD4014) ;- (SSC) Receive Frame Mode Register +// - ========== Register definition for TWI peripheral ========== +AT91C_TWI_IER EQU (0xFFFB8024) ;- (TWI) Interrupt Enable Register +AT91C_TWI_CR EQU (0xFFFB8000) ;- (TWI) Control Register +AT91C_TWI_SR EQU (0xFFFB8020) ;- (TWI) Status Register +AT91C_TWI_IMR EQU (0xFFFB802C) ;- (TWI) Interrupt Mask Register +AT91C_TWI_THR EQU (0xFFFB8034) ;- (TWI) Transmit Holding Register +AT91C_TWI_IDR EQU (0xFFFB8028) ;- (TWI) Interrupt Disable Register +AT91C_TWI_IADR EQU (0xFFFB800C) ;- (TWI) Internal Address Register +AT91C_TWI_MMR EQU (0xFFFB8004) ;- (TWI) Master Mode Register +AT91C_TWI_CWGR EQU (0xFFFB8010) ;- (TWI) Clock Waveform Generator Register +AT91C_TWI_RHR EQU (0xFFFB8030) ;- (TWI) Receive Holding Register +// - ========== Register definition for PWMC_CH3 peripheral ========== +AT91C_PWMC_CH3_CUPDR EQU (0xFFFCC270) ;- (PWMC_CH3) Channel Update Register +AT91C_PWMC_CH3_Reserved EQU (0xFFFCC274) ;- (PWMC_CH3) Reserved +AT91C_PWMC_CH3_CPRDR EQU (0xFFFCC268) ;- (PWMC_CH3) Channel Period Register +AT91C_PWMC_CH3_CDTYR EQU (0xFFFCC264) ;- (PWMC_CH3) Channel Duty Cycle Register +AT91C_PWMC_CH3_CCNTR EQU (0xFFFCC26C) ;- (PWMC_CH3) Channel Counter Register +AT91C_PWMC_CH3_CMR EQU (0xFFFCC260) ;- (PWMC_CH3) Channel Mode Register +// - ========== Register definition for PWMC_CH2 peripheral ========== +AT91C_PWMC_CH2_Reserved EQU (0xFFFCC254) ;- (PWMC_CH2) Reserved +AT91C_PWMC_CH2_CMR EQU (0xFFFCC240) ;- (PWMC_CH2) Channel Mode Register +AT91C_PWMC_CH2_CCNTR EQU (0xFFFCC24C) ;- (PWMC_CH2) Channel Counter Register +AT91C_PWMC_CH2_CPRDR EQU (0xFFFCC248) ;- (PWMC_CH2) Channel Period Register +AT91C_PWMC_CH2_CUPDR EQU (0xFFFCC250) ;- (PWMC_CH2) Channel Update Register +AT91C_PWMC_CH2_CDTYR EQU (0xFFFCC244) ;- (PWMC_CH2) Channel Duty Cycle Register +// - ========== Register definition for PWMC_CH1 peripheral ========== +AT91C_PWMC_CH1_Reserved EQU (0xFFFCC234) ;- (PWMC_CH1) Reserved +AT91C_PWMC_CH1_CUPDR EQU (0xFFFCC230) ;- (PWMC_CH1) Channel Update Register +AT91C_PWMC_CH1_CPRDR EQU (0xFFFCC228) ;- (PWMC_CH1) Channel Period Register +AT91C_PWMC_CH1_CCNTR EQU (0xFFFCC22C) ;- (PWMC_CH1) Channel Counter Register +AT91C_PWMC_CH1_CDTYR EQU (0xFFFCC224) ;- (PWMC_CH1) Channel Duty Cycle Register +AT91C_PWMC_CH1_CMR EQU (0xFFFCC220) ;- (PWMC_CH1) Channel Mode Register +// - ========== Register definition for PWMC_CH0 peripheral ========== +AT91C_PWMC_CH0_Reserved EQU (0xFFFCC214) ;- (PWMC_CH0) Reserved +AT91C_PWMC_CH0_CPRDR EQU (0xFFFCC208) ;- (PWMC_CH0) Channel Period Register +AT91C_PWMC_CH0_CDTYR EQU (0xFFFCC204) ;- (PWMC_CH0) Channel Duty Cycle Register +AT91C_PWMC_CH0_CMR EQU (0xFFFCC200) ;- (PWMC_CH0) Channel Mode Register +AT91C_PWMC_CH0_CUPDR EQU (0xFFFCC210) ;- (PWMC_CH0) Channel Update Register +AT91C_PWMC_CH0_CCNTR EQU (0xFFFCC20C) ;- (PWMC_CH0) Channel Counter Register +// - ========== Register definition for PWMC peripheral ========== +AT91C_PWMC_IDR EQU (0xFFFCC014) ;- (PWMC) PWMC Interrupt Disable Register +AT91C_PWMC_DIS EQU (0xFFFCC008) ;- (PWMC) PWMC Disable Register +AT91C_PWMC_IER EQU (0xFFFCC010) ;- (PWMC) PWMC Interrupt Enable Register +AT91C_PWMC_VR EQU (0xFFFCC0FC) ;- (PWMC) PWMC Version Register +AT91C_PWMC_ISR EQU (0xFFFCC01C) ;- (PWMC) PWMC Interrupt Status Register +AT91C_PWMC_SR EQU (0xFFFCC00C) ;- (PWMC) PWMC Status Register +AT91C_PWMC_IMR EQU (0xFFFCC018) ;- (PWMC) PWMC Interrupt Mask Register +AT91C_PWMC_MR EQU (0xFFFCC000) ;- (PWMC) PWMC Mode Register +AT91C_PWMC_ENA EQU (0xFFFCC004) ;- (PWMC) PWMC Enable Register +// - ========== Register definition for UDP peripheral ========== +AT91C_UDP_IMR EQU (0xFFFB0018) ;- (UDP) Interrupt Mask Register +AT91C_UDP_FADDR EQU (0xFFFB0008) ;- (UDP) Function Address Register +AT91C_UDP_NUM EQU (0xFFFB0000) ;- (UDP) Frame Number Register +AT91C_UDP_FDR EQU (0xFFFB0050) ;- (UDP) Endpoint FIFO Data Register +AT91C_UDP_ISR EQU (0xFFFB001C) ;- (UDP) Interrupt Status Register +AT91C_UDP_CSR EQU (0xFFFB0030) ;- (UDP) Endpoint Control and Status Register +AT91C_UDP_IDR EQU (0xFFFB0014) ;- (UDP) Interrupt Disable Register +AT91C_UDP_ICR EQU (0xFFFB0020) ;- (UDP) Interrupt Clear Register +AT91C_UDP_RSTEP EQU (0xFFFB0028) ;- (UDP) Reset Endpoint Register +AT91C_UDP_TXVC EQU (0xFFFB0074) ;- (UDP) Transceiver Control Register +AT91C_UDP_GLBSTATE EQU (0xFFFB0004) ;- (UDP) Global State Register +AT91C_UDP_IER EQU (0xFFFB0010) ;- (UDP) Interrupt Enable Register +// - ========== Register definition for TC0 peripheral ========== +AT91C_TC0_SR EQU (0xFFFA0020) ;- (TC0) Status Register +AT91C_TC0_RC EQU (0xFFFA001C) ;- (TC0) Register C +AT91C_TC0_RB EQU (0xFFFA0018) ;- (TC0) Register B +AT91C_TC0_CCR EQU (0xFFFA0000) ;- (TC0) Channel Control Register +AT91C_TC0_CMR EQU (0xFFFA0004) ;- (TC0) Channel Mode Register (Capture Mode / Waveform Mode) +AT91C_TC0_IER EQU (0xFFFA0024) ;- (TC0) Interrupt Enable Register +AT91C_TC0_RA EQU (0xFFFA0014) ;- (TC0) Register A +AT91C_TC0_IDR EQU (0xFFFA0028) ;- (TC0) Interrupt Disable Register +AT91C_TC0_CV EQU (0xFFFA0010) ;- (TC0) Counter Value +AT91C_TC0_IMR EQU (0xFFFA002C) ;- (TC0) Interrupt Mask Register +// - ========== Register definition for TC1 peripheral ========== +AT91C_TC1_RB EQU (0xFFFA0058) ;- (TC1) Register B +AT91C_TC1_CCR EQU (0xFFFA0040) ;- (TC1) Channel Control Register +AT91C_TC1_IER EQU (0xFFFA0064) ;- (TC1) Interrupt Enable Register +AT91C_TC1_IDR EQU (0xFFFA0068) ;- (TC1) Interrupt Disable Register +AT91C_TC1_SR EQU (0xFFFA0060) ;- (TC1) Status Register +AT91C_TC1_CMR EQU (0xFFFA0044) ;- (TC1) Channel Mode Register (Capture Mode / Waveform Mode) +AT91C_TC1_RA EQU (0xFFFA0054) ;- (TC1) Register A +AT91C_TC1_RC EQU (0xFFFA005C) ;- (TC1) Register C +AT91C_TC1_IMR EQU (0xFFFA006C) ;- (TC1) Interrupt Mask Register +AT91C_TC1_CV EQU (0xFFFA0050) ;- (TC1) Counter Value +// - ========== Register definition for TC2 peripheral ========== +AT91C_TC2_CMR EQU (0xFFFA0084) ;- (TC2) Channel Mode Register (Capture Mode / Waveform Mode) +AT91C_TC2_CCR EQU (0xFFFA0080) ;- (TC2) Channel Control Register +AT91C_TC2_CV EQU (0xFFFA0090) ;- (TC2) Counter Value +AT91C_TC2_RA EQU (0xFFFA0094) ;- (TC2) Register A +AT91C_TC2_RB EQU (0xFFFA0098) ;- (TC2) Register B +AT91C_TC2_IDR EQU (0xFFFA00A8) ;- (TC2) Interrupt Disable Register +AT91C_TC2_IMR EQU (0xFFFA00AC) ;- (TC2) Interrupt Mask Register +AT91C_TC2_RC EQU (0xFFFA009C) ;- (TC2) Register C +AT91C_TC2_IER EQU (0xFFFA00A4) ;- (TC2) Interrupt Enable Register +AT91C_TC2_SR EQU (0xFFFA00A0) ;- (TC2) Status Register +// - ========== Register definition for TCB peripheral ========== +AT91C_TCB_BMR EQU (0xFFFA00C4) ;- (TCB) TC Block Mode Register +AT91C_TCB_BCR EQU (0xFFFA00C0) ;- (TCB) TC Block Control Register +// - ========== Register definition for CAN_MB0 peripheral ========== +AT91C_CAN_MB0_MDL EQU (0xFFFD0214) ;- (CAN_MB0) MailBox Data Low Register +AT91C_CAN_MB0_MAM EQU (0xFFFD0204) ;- (CAN_MB0) MailBox Acceptance Mask Register +AT91C_CAN_MB0_MCR EQU (0xFFFD021C) ;- (CAN_MB0) MailBox Control Register +AT91C_CAN_MB0_MID EQU (0xFFFD0208) ;- (CAN_MB0) MailBox ID Register +AT91C_CAN_MB0_MSR EQU (0xFFFD0210) ;- (CAN_MB0) MailBox Status Register +AT91C_CAN_MB0_MFID EQU (0xFFFD020C) ;- (CAN_MB0) MailBox Family ID Register +AT91C_CAN_MB0_MDH EQU (0xFFFD0218) ;- (CAN_MB0) MailBox Data High Register +AT91C_CAN_MB0_MMR EQU (0xFFFD0200) ;- (CAN_MB0) MailBox Mode Register +// - ========== Register definition for CAN_MB1 peripheral ========== +AT91C_CAN_MB1_MDL EQU (0xFFFD0234) ;- (CAN_MB1) MailBox Data Low Register +AT91C_CAN_MB1_MID EQU (0xFFFD0228) ;- (CAN_MB1) MailBox ID Register +AT91C_CAN_MB1_MMR EQU (0xFFFD0220) ;- (CAN_MB1) MailBox Mode Register +AT91C_CAN_MB1_MSR EQU (0xFFFD0230) ;- (CAN_MB1) MailBox Status Register +AT91C_CAN_MB1_MAM EQU (0xFFFD0224) ;- (CAN_MB1) MailBox Acceptance Mask Register +AT91C_CAN_MB1_MDH EQU (0xFFFD0238) ;- (CAN_MB1) MailBox Data High Register +AT91C_CAN_MB1_MCR EQU (0xFFFD023C) ;- (CAN_MB1) MailBox Control Register +AT91C_CAN_MB1_MFID EQU (0xFFFD022C) ;- (CAN_MB1) MailBox Family ID Register +// - ========== Register definition for CAN_MB2 peripheral ========== +AT91C_CAN_MB2_MCR EQU (0xFFFD025C) ;- (CAN_MB2) MailBox Control Register +AT91C_CAN_MB2_MDH EQU (0xFFFD0258) ;- (CAN_MB2) MailBox Data High Register +AT91C_CAN_MB2_MID EQU (0xFFFD0248) ;- (CAN_MB2) MailBox ID Register +AT91C_CAN_MB2_MDL EQU (0xFFFD0254) ;- (CAN_MB2) MailBox Data Low Register +AT91C_CAN_MB2_MMR EQU (0xFFFD0240) ;- (CAN_MB2) MailBox Mode Register +AT91C_CAN_MB2_MAM EQU (0xFFFD0244) ;- (CAN_MB2) MailBox Acceptance Mask Register +AT91C_CAN_MB2_MFID EQU (0xFFFD024C) ;- (CAN_MB2) MailBox Family ID Register +AT91C_CAN_MB2_MSR EQU (0xFFFD0250) ;- (CAN_MB2) MailBox Status Register +// - ========== Register definition for CAN_MB3 peripheral ========== +AT91C_CAN_MB3_MFID EQU (0xFFFD026C) ;- (CAN_MB3) MailBox Family ID Register +AT91C_CAN_MB3_MAM EQU (0xFFFD0264) ;- (CAN_MB3) MailBox Acceptance Mask Register +AT91C_CAN_MB3_MID EQU (0xFFFD0268) ;- (CAN_MB3) MailBox ID Register +AT91C_CAN_MB3_MCR EQU (0xFFFD027C) ;- (CAN_MB3) MailBox Control Register +AT91C_CAN_MB3_MMR EQU (0xFFFD0260) ;- (CAN_MB3) MailBox Mode Register +AT91C_CAN_MB3_MSR EQU (0xFFFD0270) ;- (CAN_MB3) MailBox Status Register +AT91C_CAN_MB3_MDL EQU (0xFFFD0274) ;- (CAN_MB3) MailBox Data Low Register +AT91C_CAN_MB3_MDH EQU (0xFFFD0278) ;- (CAN_MB3) MailBox Data High Register +// - ========== Register definition for CAN_MB4 peripheral ========== +AT91C_CAN_MB4_MID EQU (0xFFFD0288) ;- (CAN_MB4) MailBox ID Register +AT91C_CAN_MB4_MMR EQU (0xFFFD0280) ;- (CAN_MB4) MailBox Mode Register +AT91C_CAN_MB4_MDH EQU (0xFFFD0298) ;- (CAN_MB4) MailBox Data High Register +AT91C_CAN_MB4_MFID EQU (0xFFFD028C) ;- (CAN_MB4) MailBox Family ID Register +AT91C_CAN_MB4_MSR EQU (0xFFFD0290) ;- (CAN_MB4) MailBox Status Register +AT91C_CAN_MB4_MCR EQU (0xFFFD029C) ;- (CAN_MB4) MailBox Control Register +AT91C_CAN_MB4_MDL EQU (0xFFFD0294) ;- (CAN_MB4) MailBox Data Low Register +AT91C_CAN_MB4_MAM EQU (0xFFFD0284) ;- (CAN_MB4) MailBox Acceptance Mask Register +// - ========== Register definition for CAN_MB5 peripheral ========== +AT91C_CAN_MB5_MSR EQU (0xFFFD02B0) ;- (CAN_MB5) MailBox Status Register +AT91C_CAN_MB5_MCR EQU (0xFFFD02BC) ;- (CAN_MB5) MailBox Control Register +AT91C_CAN_MB5_MFID EQU (0xFFFD02AC) ;- (CAN_MB5) MailBox Family ID Register +AT91C_CAN_MB5_MDH EQU (0xFFFD02B8) ;- (CAN_MB5) MailBox Data High Register +AT91C_CAN_MB5_MID EQU (0xFFFD02A8) ;- (CAN_MB5) MailBox ID Register +AT91C_CAN_MB5_MMR EQU (0xFFFD02A0) ;- (CAN_MB5) MailBox Mode Register +AT91C_CAN_MB5_MDL EQU (0xFFFD02B4) ;- (CAN_MB5) MailBox Data Low Register +AT91C_CAN_MB5_MAM EQU (0xFFFD02A4) ;- (CAN_MB5) MailBox Acceptance Mask Register +// - ========== Register definition for CAN_MB6 peripheral ========== +AT91C_CAN_MB6_MFID EQU (0xFFFD02CC) ;- (CAN_MB6) MailBox Family ID Register +AT91C_CAN_MB6_MID EQU (0xFFFD02C8) ;- (CAN_MB6) MailBox ID Register +AT91C_CAN_MB6_MAM EQU (0xFFFD02C4) ;- (CAN_MB6) MailBox Acceptance Mask Register +AT91C_CAN_MB6_MSR EQU (0xFFFD02D0) ;- (CAN_MB6) MailBox Status Register +AT91C_CAN_MB6_MDL EQU (0xFFFD02D4) ;- (CAN_MB6) MailBox Data Low Register +AT91C_CAN_MB6_MCR EQU (0xFFFD02DC) ;- (CAN_MB6) MailBox Control Register +AT91C_CAN_MB6_MDH EQU (0xFFFD02D8) ;- (CAN_MB6) MailBox Data High Register +AT91C_CAN_MB6_MMR EQU (0xFFFD02C0) ;- (CAN_MB6) MailBox Mode Register +// - ========== Register definition for CAN_MB7 peripheral ========== +AT91C_CAN_MB7_MCR EQU (0xFFFD02FC) ;- (CAN_MB7) MailBox Control Register +AT91C_CAN_MB7_MDH EQU (0xFFFD02F8) ;- (CAN_MB7) MailBox Data High Register +AT91C_CAN_MB7_MFID EQU (0xFFFD02EC) ;- (CAN_MB7) MailBox Family ID Register +AT91C_CAN_MB7_MDL EQU (0xFFFD02F4) ;- (CAN_MB7) MailBox Data Low Register +AT91C_CAN_MB7_MID EQU (0xFFFD02E8) ;- (CAN_MB7) MailBox ID Register +AT91C_CAN_MB7_MMR EQU (0xFFFD02E0) ;- (CAN_MB7) MailBox Mode Register +AT91C_CAN_MB7_MAM EQU (0xFFFD02E4) ;- (CAN_MB7) MailBox Acceptance Mask Register +AT91C_CAN_MB7_MSR EQU (0xFFFD02F0) ;- (CAN_MB7) MailBox Status Register +// - ========== Register definition for CAN peripheral ========== +AT91C_CAN_TCR EQU (0xFFFD0024) ;- (CAN) Transfer Command Register +AT91C_CAN_IMR EQU (0xFFFD000C) ;- (CAN) Interrupt Mask Register +AT91C_CAN_IER EQU (0xFFFD0004) ;- (CAN) Interrupt Enable Register +AT91C_CAN_ECR EQU (0xFFFD0020) ;- (CAN) Error Counter Register +AT91C_CAN_TIMESTP EQU (0xFFFD001C) ;- (CAN) Time Stamp Register +AT91C_CAN_MR EQU (0xFFFD0000) ;- (CAN) Mode Register +AT91C_CAN_IDR EQU (0xFFFD0008) ;- (CAN) Interrupt Disable Register +AT91C_CAN_ACR EQU (0xFFFD0028) ;- (CAN) Abort Command Register +AT91C_CAN_TIM EQU (0xFFFD0018) ;- (CAN) Timer Register +AT91C_CAN_SR EQU (0xFFFD0010) ;- (CAN) Status Register +AT91C_CAN_BR EQU (0xFFFD0014) ;- (CAN) Baudrate Register +AT91C_CAN_VR EQU (0xFFFD00FC) ;- (CAN) Version Register +// - ========== Register definition for EMAC peripheral ========== +AT91C_EMAC_ISR EQU (0xFFFDC024) ;- (EMAC) Interrupt Status Register +AT91C_EMAC_SA4H EQU (0xFFFDC0B4) ;- (EMAC) Specific Address 4 Top, Last 2 bytes +AT91C_EMAC_SA1L EQU (0xFFFDC098) ;- (EMAC) Specific Address 1 Bottom, First 4 bytes +AT91C_EMAC_ELE EQU (0xFFFDC078) ;- (EMAC) Excessive Length Errors Register +AT91C_EMAC_LCOL EQU (0xFFFDC05C) ;- (EMAC) Late Collision Register +AT91C_EMAC_RLE EQU (0xFFFDC088) ;- (EMAC) Receive Length Field Mismatch Register +AT91C_EMAC_WOL EQU (0xFFFDC0C4) ;- (EMAC) Wake On LAN Register +AT91C_EMAC_DTF EQU (0xFFFDC058) ;- (EMAC) Deferred Transmission Frame Register +AT91C_EMAC_TUND EQU (0xFFFDC064) ;- (EMAC) Transmit Underrun Error Register +AT91C_EMAC_NCR EQU (0xFFFDC000) ;- (EMAC) Network Control Register +AT91C_EMAC_SA4L EQU (0xFFFDC0B0) ;- (EMAC) Specific Address 4 Bottom, First 4 bytes +AT91C_EMAC_RSR EQU (0xFFFDC020) ;- (EMAC) Receive Status Register +AT91C_EMAC_SA3L EQU (0xFFFDC0A8) ;- (EMAC) Specific Address 3 Bottom, First 4 bytes +AT91C_EMAC_TSR EQU (0xFFFDC014) ;- (EMAC) Transmit Status Register +AT91C_EMAC_IDR EQU (0xFFFDC02C) ;- (EMAC) Interrupt Disable Register +AT91C_EMAC_RSE EQU (0xFFFDC074) ;- (EMAC) Receive Symbol Errors Register +AT91C_EMAC_ECOL EQU (0xFFFDC060) ;- (EMAC) Excessive Collision Register +AT91C_EMAC_TID EQU (0xFFFDC0B8) ;- (EMAC) Type ID Checking Register +AT91C_EMAC_HRB EQU (0xFFFDC090) ;- (EMAC) Hash Address Bottom[31:0] +AT91C_EMAC_TBQP EQU (0xFFFDC01C) ;- (EMAC) Transmit Buffer Queue Pointer +AT91C_EMAC_USRIO EQU (0xFFFDC0C0) ;- (EMAC) USER Input/Output Register +AT91C_EMAC_PTR EQU (0xFFFDC038) ;- (EMAC) Pause Time Register +AT91C_EMAC_SA2H EQU (0xFFFDC0A4) ;- (EMAC) Specific Address 2 Top, Last 2 bytes +AT91C_EMAC_ROV EQU (0xFFFDC070) ;- (EMAC) Receive Overrun Errors Register +AT91C_EMAC_ALE EQU (0xFFFDC054) ;- (EMAC) Alignment Error Register +AT91C_EMAC_RJA EQU (0xFFFDC07C) ;- (EMAC) Receive Jabbers Register +AT91C_EMAC_RBQP EQU (0xFFFDC018) ;- (EMAC) Receive Buffer Queue Pointer +AT91C_EMAC_TPF EQU (0xFFFDC08C) ;- (EMAC) Transmitted Pause Frames Register +AT91C_EMAC_NCFGR EQU (0xFFFDC004) ;- (EMAC) Network Configuration Register +AT91C_EMAC_HRT EQU (0xFFFDC094) ;- (EMAC) Hash Address Top[63:32] +AT91C_EMAC_USF EQU (0xFFFDC080) ;- (EMAC) Undersize Frames Register +AT91C_EMAC_FCSE EQU (0xFFFDC050) ;- (EMAC) Frame Check Sequence Error Register +AT91C_EMAC_TPQ EQU (0xFFFDC0BC) ;- (EMAC) Transmit Pause Quantum Register +AT91C_EMAC_MAN EQU (0xFFFDC034) ;- (EMAC) PHY Maintenance Register +AT91C_EMAC_FTO EQU (0xFFFDC040) ;- (EMAC) Frames Transmitted OK Register +AT91C_EMAC_REV EQU (0xFFFDC0FC) ;- (EMAC) Revision Register +AT91C_EMAC_IMR EQU (0xFFFDC030) ;- (EMAC) Interrupt Mask Register +AT91C_EMAC_SCF EQU (0xFFFDC044) ;- (EMAC) Single Collision Frame Register +AT91C_EMAC_PFR EQU (0xFFFDC03C) ;- (EMAC) Pause Frames received Register +AT91C_EMAC_MCF EQU (0xFFFDC048) ;- (EMAC) Multiple Collision Frame Register +AT91C_EMAC_NSR EQU (0xFFFDC008) ;- (EMAC) Network Status Register +AT91C_EMAC_SA2L EQU (0xFFFDC0A0) ;- (EMAC) Specific Address 2 Bottom, First 4 bytes +AT91C_EMAC_FRO EQU (0xFFFDC04C) ;- (EMAC) Frames Received OK Register +AT91C_EMAC_IER EQU (0xFFFDC028) ;- (EMAC) Interrupt Enable Register +AT91C_EMAC_SA1H EQU (0xFFFDC09C) ;- (EMAC) Specific Address 1 Top, Last 2 bytes +AT91C_EMAC_CSE EQU (0xFFFDC068) ;- (EMAC) Carrier Sense Error Register +AT91C_EMAC_SA3H EQU (0xFFFDC0AC) ;- (EMAC) Specific Address 3 Top, Last 2 bytes +AT91C_EMAC_RRE EQU (0xFFFDC06C) ;- (EMAC) Receive Ressource Error Register +AT91C_EMAC_STE EQU (0xFFFDC084) ;- (EMAC) SQE Test Error Register +// - ========== Register definition for PDC_ADC peripheral ========== +AT91C_ADC_PTSR EQU (0xFFFD8124) ;- (PDC_ADC) PDC Transfer Status Register +AT91C_ADC_PTCR EQU (0xFFFD8120) ;- (PDC_ADC) PDC Transfer Control Register +AT91C_ADC_TNPR EQU (0xFFFD8118) ;- (PDC_ADC) Transmit Next Pointer Register +AT91C_ADC_TNCR EQU (0xFFFD811C) ;- (PDC_ADC) Transmit Next Counter Register +AT91C_ADC_RNPR EQU (0xFFFD8110) ;- (PDC_ADC) Receive Next Pointer Register +AT91C_ADC_RNCR EQU (0xFFFD8114) ;- (PDC_ADC) Receive Next Counter Register +AT91C_ADC_RPR EQU (0xFFFD8100) ;- (PDC_ADC) Receive Pointer Register +AT91C_ADC_TCR EQU (0xFFFD810C) ;- (PDC_ADC) Transmit Counter Register +AT91C_ADC_TPR EQU (0xFFFD8108) ;- (PDC_ADC) Transmit Pointer Register +AT91C_ADC_RCR EQU (0xFFFD8104) ;- (PDC_ADC) Receive Counter Register +// - ========== Register definition for ADC peripheral ========== +AT91C_ADC_CDR2 EQU (0xFFFD8038) ;- (ADC) ADC Channel Data Register 2 +AT91C_ADC_CDR3 EQU (0xFFFD803C) ;- (ADC) ADC Channel Data Register 3 +AT91C_ADC_CDR0 EQU (0xFFFD8030) ;- (ADC) ADC Channel Data Register 0 +AT91C_ADC_CDR5 EQU (0xFFFD8044) ;- (ADC) ADC Channel Data Register 5 +AT91C_ADC_CHDR EQU (0xFFFD8014) ;- (ADC) ADC Channel Disable Register +AT91C_ADC_SR EQU (0xFFFD801C) ;- (ADC) ADC Status Register +AT91C_ADC_CDR4 EQU (0xFFFD8040) ;- (ADC) ADC Channel Data Register 4 +AT91C_ADC_CDR1 EQU (0xFFFD8034) ;- (ADC) ADC Channel Data Register 1 +AT91C_ADC_LCDR EQU (0xFFFD8020) ;- (ADC) ADC Last Converted Data Register +AT91C_ADC_IDR EQU (0xFFFD8028) ;- (ADC) ADC Interrupt Disable Register +AT91C_ADC_CR EQU (0xFFFD8000) ;- (ADC) ADC Control Register +AT91C_ADC_CDR7 EQU (0xFFFD804C) ;- (ADC) ADC Channel Data Register 7 +AT91C_ADC_CDR6 EQU (0xFFFD8048) ;- (ADC) ADC Channel Data Register 6 +AT91C_ADC_IER EQU (0xFFFD8024) ;- (ADC) ADC Interrupt Enable Register +AT91C_ADC_CHER EQU (0xFFFD8010) ;- (ADC) ADC Channel Enable Register +AT91C_ADC_CHSR EQU (0xFFFD8018) ;- (ADC) ADC Channel Status Register +AT91C_ADC_MR EQU (0xFFFD8004) ;- (ADC) ADC Mode Register +AT91C_ADC_IMR EQU (0xFFFD802C) ;- (ADC) ADC Interrupt Mask Register + +// - ***************************************************************************** +// - PIO DEFINITIONS FOR AT91SAM7X256 +// - ***************************************************************************** +AT91C_PIO_PA0 EQU (1 << 0) ;- Pin Controlled by PA0 +AT91C_PA0_RXD0 EQU (AT91C_PIO_PA0) ;- USART 0 Receive Data +AT91C_PIO_PA1 EQU (1 << 1) ;- Pin Controlled by PA1 +AT91C_PA1_TXD0 EQU (AT91C_PIO_PA1) ;- USART 0 Transmit Data +AT91C_PIO_PA10 EQU (1 << 10) ;- Pin Controlled by PA10 +AT91C_PA10_TWD EQU (AT91C_PIO_PA10) ;- TWI Two-wire Serial Data +AT91C_PIO_PA11 EQU (1 << 11) ;- Pin Controlled by PA11 +AT91C_PA11_TWCK EQU (AT91C_PIO_PA11) ;- TWI Two-wire Serial Clock +AT91C_PIO_PA12 EQU (1 << 12) ;- Pin Controlled by PA12 +AT91C_PA12_SPI0_NPCS0 EQU (AT91C_PIO_PA12) ;- SPI 0 Peripheral Chip Select 0 +AT91C_PIO_PA13 EQU (1 << 13) ;- Pin Controlled by PA13 +AT91C_PA13_SPI0_NPCS1 EQU (AT91C_PIO_PA13) ;- SPI 0 Peripheral Chip Select 1 +AT91C_PA13_PCK1 EQU (AT91C_PIO_PA13) ;- PMC Programmable Clock Output 1 +AT91C_PIO_PA14 EQU (1 << 14) ;- Pin Controlled by PA14 +AT91C_PA14_SPI0_NPCS2 EQU (AT91C_PIO_PA14) ;- SPI 0 Peripheral Chip Select 2 +AT91C_PA14_IRQ1 EQU (AT91C_PIO_PA14) ;- External Interrupt 1 +AT91C_PIO_PA15 EQU (1 << 15) ;- Pin Controlled by PA15 +AT91C_PA15_SPI0_NPCS3 EQU (AT91C_PIO_PA15) ;- SPI 0 Peripheral Chip Select 3 +AT91C_PA15_TCLK2 EQU (AT91C_PIO_PA15) ;- Timer Counter 2 external clock input +AT91C_PIO_PA16 EQU (1 << 16) ;- Pin Controlled by PA16 +AT91C_PA16_SPI0_MISO EQU (AT91C_PIO_PA16) ;- SPI 0 Master In Slave +AT91C_PIO_PA17 EQU (1 << 17) ;- Pin Controlled by PA17 +AT91C_PA17_SPI0_MOSI EQU (AT91C_PIO_PA17) ;- SPI 0 Master Out Slave +AT91C_PIO_PA18 EQU (1 << 18) ;- Pin Controlled by PA18 +AT91C_PA18_SPI0_SPCK EQU (AT91C_PIO_PA18) ;- SPI 0 Serial Clock +AT91C_PIO_PA19 EQU (1 << 19) ;- Pin Controlled by PA19 +AT91C_PA19_CANRX EQU (AT91C_PIO_PA19) ;- CAN Receive +AT91C_PIO_PA2 EQU (1 << 2) ;- Pin Controlled by PA2 +AT91C_PA2_SCK0 EQU (AT91C_PIO_PA2) ;- USART 0 Serial Clock +AT91C_PA2_SPI1_NPCS1 EQU (AT91C_PIO_PA2) ;- SPI 1 Peripheral Chip Select 1 +AT91C_PIO_PA20 EQU (1 << 20) ;- Pin Controlled by PA20 +AT91C_PA20_CANTX EQU (AT91C_PIO_PA20) ;- CAN Transmit +AT91C_PIO_PA21 EQU (1 << 21) ;- Pin Controlled by PA21 +AT91C_PA21_TF EQU (AT91C_PIO_PA21) ;- SSC Transmit Frame Sync +AT91C_PA21_SPI1_NPCS0 EQU (AT91C_PIO_PA21) ;- SPI 1 Peripheral Chip Select 0 +AT91C_PIO_PA22 EQU (1 << 22) ;- Pin Controlled by PA22 +AT91C_PA22_TK EQU (AT91C_PIO_PA22) ;- SSC Transmit Clock +AT91C_PA22_SPI1_SPCK EQU (AT91C_PIO_PA22) ;- SPI 1 Serial Clock +AT91C_PIO_PA23 EQU (1 << 23) ;- Pin Controlled by PA23 +AT91C_PA23_TD EQU (AT91C_PIO_PA23) ;- SSC Transmit data +AT91C_PA23_SPI1_MOSI EQU (AT91C_PIO_PA23) ;- SPI 1 Master Out Slave +AT91C_PIO_PA24 EQU (1 << 24) ;- Pin Controlled by PA24 +AT91C_PA24_RD EQU (AT91C_PIO_PA24) ;- SSC Receive Data +AT91C_PA24_SPI1_MISO EQU (AT91C_PIO_PA24) ;- SPI 1 Master In Slave +AT91C_PIO_PA25 EQU (1 << 25) ;- Pin Controlled by PA25 +AT91C_PA25_RK EQU (AT91C_PIO_PA25) ;- SSC Receive Clock +AT91C_PA25_SPI1_NPCS1 EQU (AT91C_PIO_PA25) ;- SPI 1 Peripheral Chip Select 1 +AT91C_PIO_PA26 EQU (1 << 26) ;- Pin Controlled by PA26 +AT91C_PA26_RF EQU (AT91C_PIO_PA26) ;- SSC Receive Frame Sync +AT91C_PA26_SPI1_NPCS2 EQU (AT91C_PIO_PA26) ;- SPI 1 Peripheral Chip Select 2 +AT91C_PIO_PA27 EQU (1 << 27) ;- Pin Controlled by PA27 +AT91C_PA27_DRXD EQU (AT91C_PIO_PA27) ;- DBGU Debug Receive Data +AT91C_PA27_PCK3 EQU (AT91C_PIO_PA27) ;- PMC Programmable Clock Output 3 +AT91C_PIO_PA28 EQU (1 << 28) ;- Pin Controlled by PA28 +AT91C_PA28_DTXD EQU (AT91C_PIO_PA28) ;- DBGU Debug Transmit Data +AT91C_PIO_PA29 EQU (1 << 29) ;- Pin Controlled by PA29 +AT91C_PA29_FIQ EQU (AT91C_PIO_PA29) ;- AIC Fast Interrupt Input +AT91C_PA29_SPI1_NPCS3 EQU (AT91C_PIO_PA29) ;- SPI 1 Peripheral Chip Select 3 +AT91C_PIO_PA3 EQU (1 << 3) ;- Pin Controlled by PA3 +AT91C_PA3_RTS0 EQU (AT91C_PIO_PA3) ;- USART 0 Ready To Send +AT91C_PA3_SPI1_NPCS2 EQU (AT91C_PIO_PA3) ;- SPI 1 Peripheral Chip Select 2 +AT91C_PIO_PA30 EQU (1 << 30) ;- Pin Controlled by PA30 +AT91C_PA30_IRQ0 EQU (AT91C_PIO_PA30) ;- External Interrupt 0 +AT91C_PA30_PCK2 EQU (AT91C_PIO_PA30) ;- PMC Programmable Clock Output 2 +AT91C_PIO_PA4 EQU (1 << 4) ;- Pin Controlled by PA4 +AT91C_PA4_CTS0 EQU (AT91C_PIO_PA4) ;- USART 0 Clear To Send +AT91C_PA4_SPI1_NPCS3 EQU (AT91C_PIO_PA4) ;- SPI 1 Peripheral Chip Select 3 +AT91C_PIO_PA5 EQU (1 << 5) ;- Pin Controlled by PA5 +AT91C_PA5_RXD1 EQU (AT91C_PIO_PA5) ;- USART 1 Receive Data +AT91C_PIO_PA6 EQU (1 << 6) ;- Pin Controlled by PA6 +AT91C_PA6_TXD1 EQU (AT91C_PIO_PA6) ;- USART 1 Transmit Data +AT91C_PIO_PA7 EQU (1 << 7) ;- Pin Controlled by PA7 +AT91C_PA7_SCK1 EQU (AT91C_PIO_PA7) ;- USART 1 Serial Clock +AT91C_PA7_SPI0_NPCS1 EQU (AT91C_PIO_PA7) ;- SPI 0 Peripheral Chip Select 1 +AT91C_PIO_PA8 EQU (1 << 8) ;- Pin Controlled by PA8 +AT91C_PA8_RTS1 EQU (AT91C_PIO_PA8) ;- USART 1 Ready To Send +AT91C_PA8_SPI0_NPCS2 EQU (AT91C_PIO_PA8) ;- SPI 0 Peripheral Chip Select 2 +AT91C_PIO_PA9 EQU (1 << 9) ;- Pin Controlled by PA9 +AT91C_PA9_CTS1 EQU (AT91C_PIO_PA9) ;- USART 1 Clear To Send +AT91C_PA9_SPI0_NPCS3 EQU (AT91C_PIO_PA9) ;- SPI 0 Peripheral Chip Select 3 +AT91C_PIO_PB0 EQU (1 << 0) ;- Pin Controlled by PB0 +AT91C_PB0_ETXCK_EREFCK EQU (AT91C_PIO_PB0) ;- Ethernet MAC Transmit Clock/Reference Clock +AT91C_PB0_PCK0 EQU (AT91C_PIO_PB0) ;- PMC Programmable Clock Output 0 +AT91C_PIO_PB1 EQU (1 << 1) ;- Pin Controlled by PB1 +AT91C_PB1_ETXEN EQU (AT91C_PIO_PB1) ;- Ethernet MAC Transmit Enable +AT91C_PIO_PB10 EQU (1 << 10) ;- Pin Controlled by PB10 +AT91C_PB10_ETX2 EQU (AT91C_PIO_PB10) ;- Ethernet MAC Transmit Data 2 +AT91C_PB10_SPI1_NPCS1 EQU (AT91C_PIO_PB10) ;- SPI 1 Peripheral Chip Select 1 +AT91C_PIO_PB11 EQU (1 << 11) ;- Pin Controlled by PB11 +AT91C_PB11_ETX3 EQU (AT91C_PIO_PB11) ;- Ethernet MAC Transmit Data 3 +AT91C_PB11_SPI1_NPCS2 EQU (AT91C_PIO_PB11) ;- SPI 1 Peripheral Chip Select 2 +AT91C_PIO_PB12 EQU (1 << 12) ;- Pin Controlled by PB12 +AT91C_PB12_ETXER EQU (AT91C_PIO_PB12) ;- Ethernet MAC Transmikt Coding Error +AT91C_PB12_TCLK0 EQU (AT91C_PIO_PB12) ;- Timer Counter 0 external clock input +AT91C_PIO_PB13 EQU (1 << 13) ;- Pin Controlled by PB13 +AT91C_PB13_ERX2 EQU (AT91C_PIO_PB13) ;- Ethernet MAC Receive Data 2 +AT91C_PB13_SPI0_NPCS1 EQU (AT91C_PIO_PB13) ;- SPI 0 Peripheral Chip Select 1 +AT91C_PIO_PB14 EQU (1 << 14) ;- Pin Controlled by PB14 +AT91C_PB14_ERX3 EQU (AT91C_PIO_PB14) ;- Ethernet MAC Receive Data 3 +AT91C_PB14_SPI0_NPCS2 EQU (AT91C_PIO_PB14) ;- SPI 0 Peripheral Chip Select 2 +AT91C_PIO_PB15 EQU (1 << 15) ;- Pin Controlled by PB15 +AT91C_PB15_ERXDV_ECRSDV EQU (AT91C_PIO_PB15) ;- Ethernet MAC Receive Data Valid +AT91C_PIO_PB16 EQU (1 << 16) ;- Pin Controlled by PB16 +AT91C_PB16_ECOL EQU (AT91C_PIO_PB16) ;- Ethernet MAC Collision Detected +AT91C_PB16_SPI1_NPCS3 EQU (AT91C_PIO_PB16) ;- SPI 1 Peripheral Chip Select 3 +AT91C_PIO_PB17 EQU (1 << 17) ;- Pin Controlled by PB17 +AT91C_PB17_ERXCK EQU (AT91C_PIO_PB17) ;- Ethernet MAC Receive Clock +AT91C_PB17_SPI0_NPCS3 EQU (AT91C_PIO_PB17) ;- SPI 0 Peripheral Chip Select 3 +AT91C_PIO_PB18 EQU (1 << 18) ;- Pin Controlled by PB18 +AT91C_PB18_EF100 EQU (AT91C_PIO_PB18) ;- Ethernet MAC Force 100 Mbits/sec +AT91C_PB18_ADTRG EQU (AT91C_PIO_PB18) ;- ADC External Trigger +AT91C_PIO_PB19 EQU (1 << 19) ;- Pin Controlled by PB19 +AT91C_PB19_PWM0 EQU (AT91C_PIO_PB19) ;- PWM Channel 0 +AT91C_PB19_TCLK1 EQU (AT91C_PIO_PB19) ;- Timer Counter 1 external clock input +AT91C_PIO_PB2 EQU (1 << 2) ;- Pin Controlled by PB2 +AT91C_PB2_ETX0 EQU (AT91C_PIO_PB2) ;- Ethernet MAC Transmit Data 0 +AT91C_PIO_PB20 EQU (1 << 20) ;- Pin Controlled by PB20 +AT91C_PB20_PWM1 EQU (AT91C_PIO_PB20) ;- PWM Channel 1 +AT91C_PB20_PCK0 EQU (AT91C_PIO_PB20) ;- PMC Programmable Clock Output 0 +AT91C_PIO_PB21 EQU (1 << 21) ;- Pin Controlled by PB21 +AT91C_PB21_PWM2 EQU (AT91C_PIO_PB21) ;- PWM Channel 2 +AT91C_PB21_PCK1 EQU (AT91C_PIO_PB21) ;- PMC Programmable Clock Output 1 +AT91C_PIO_PB22 EQU (1 << 22) ;- Pin Controlled by PB22 +AT91C_PB22_PWM3 EQU (AT91C_PIO_PB22) ;- PWM Channel 3 +AT91C_PB22_PCK2 EQU (AT91C_PIO_PB22) ;- PMC Programmable Clock Output 2 +AT91C_PIO_PB23 EQU (1 << 23) ;- Pin Controlled by PB23 +AT91C_PB23_TIOA0 EQU (AT91C_PIO_PB23) ;- Timer Counter 0 Multipurpose Timer I/O Pin A +AT91C_PB23_DCD1 EQU (AT91C_PIO_PB23) ;- USART 1 Data Carrier Detect +AT91C_PIO_PB24 EQU (1 << 24) ;- Pin Controlled by PB24 +AT91C_PB24_TIOB0 EQU (AT91C_PIO_PB24) ;- Timer Counter 0 Multipurpose Timer I/O Pin B +AT91C_PB24_DSR1 EQU (AT91C_PIO_PB24) ;- USART 1 Data Set ready +AT91C_PIO_PB25 EQU (1 << 25) ;- Pin Controlled by PB25 +AT91C_PB25_TIOA1 EQU (AT91C_PIO_PB25) ;- Timer Counter 1 Multipurpose Timer I/O Pin A +AT91C_PB25_DTR1 EQU (AT91C_PIO_PB25) ;- USART 1 Data Terminal ready +AT91C_PIO_PB26 EQU (1 << 26) ;- Pin Controlled by PB26 +AT91C_PB26_TIOB1 EQU (AT91C_PIO_PB26) ;- Timer Counter 1 Multipurpose Timer I/O Pin B +AT91C_PB26_RI1 EQU (AT91C_PIO_PB26) ;- USART 1 Ring Indicator +AT91C_PIO_PB27 EQU (1 << 27) ;- Pin Controlled by PB27 +AT91C_PB27_TIOA2 EQU (AT91C_PIO_PB27) ;- Timer Counter 2 Multipurpose Timer I/O Pin A +AT91C_PB27_PWM0 EQU (AT91C_PIO_PB27) ;- PWM Channel 0 +AT91C_PIO_PB28 EQU (1 << 28) ;- Pin Controlled by PB28 +AT91C_PB28_TIOB2 EQU (AT91C_PIO_PB28) ;- Timer Counter 2 Multipurpose Timer I/O Pin B +AT91C_PB28_PWM1 EQU (AT91C_PIO_PB28) ;- PWM Channel 1 +AT91C_PIO_PB29 EQU (1 << 29) ;- Pin Controlled by PB29 +AT91C_PB29_PCK1 EQU (AT91C_PIO_PB29) ;- PMC Programmable Clock Output 1 +AT91C_PB29_PWM2 EQU (AT91C_PIO_PB29) ;- PWM Channel 2 +AT91C_PIO_PB3 EQU (1 << 3) ;- Pin Controlled by PB3 +AT91C_PB3_ETX1 EQU (AT91C_PIO_PB3) ;- Ethernet MAC Transmit Data 1 +AT91C_PIO_PB30 EQU (1 << 30) ;- Pin Controlled by PB30 +AT91C_PB30_PCK2 EQU (AT91C_PIO_PB30) ;- PMC Programmable Clock Output 2 +AT91C_PB30_PWM3 EQU (AT91C_PIO_PB30) ;- PWM Channel 3 +AT91C_PIO_PB4 EQU (1 << 4) ;- Pin Controlled by PB4 +AT91C_PB4_ECRS EQU (AT91C_PIO_PB4) ;- Ethernet MAC Carrier Sense/Carrier Sense and Data Valid +AT91C_PIO_PB5 EQU (1 << 5) ;- Pin Controlled by PB5 +AT91C_PB5_ERX0 EQU (AT91C_PIO_PB5) ;- Ethernet MAC Receive Data 0 +AT91C_PIO_PB6 EQU (1 << 6) ;- Pin Controlled by PB6 +AT91C_PB6_ERX1 EQU (AT91C_PIO_PB6) ;- Ethernet MAC Receive Data 1 +AT91C_PIO_PB7 EQU (1 << 7) ;- Pin Controlled by PB7 +AT91C_PB7_ERXER EQU (AT91C_PIO_PB7) ;- Ethernet MAC Receive Error +AT91C_PIO_PB8 EQU (1 << 8) ;- Pin Controlled by PB8 +AT91C_PB8_EMDC EQU (AT91C_PIO_PB8) ;- Ethernet MAC Management Data Clock +AT91C_PIO_PB9 EQU (1 << 9) ;- Pin Controlled by PB9 +AT91C_PB9_EMDIO EQU (AT91C_PIO_PB9) ;- Ethernet MAC Management Data Input/Output + +// - ***************************************************************************** +// - PERIPHERAL ID DEFINITIONS FOR AT91SAM7X256 +// - ***************************************************************************** +AT91C_ID_FIQ EQU ( 0) ;- Advanced Interrupt Controller (FIQ) +AT91C_ID_SYS EQU ( 1) ;- System Peripheral +AT91C_ID_PIOA EQU ( 2) ;- Parallel IO Controller A +AT91C_ID_PIOB EQU ( 3) ;- Parallel IO Controller B +AT91C_ID_SPI0 EQU ( 4) ;- Serial Peripheral Interface 0 +AT91C_ID_SPI1 EQU ( 5) ;- Serial Peripheral Interface 1 +AT91C_ID_US0 EQU ( 6) ;- USART 0 +AT91C_ID_US1 EQU ( 7) ;- USART 1 +AT91C_ID_SSC EQU ( 8) ;- Serial Synchronous Controller +AT91C_ID_TWI EQU ( 9) ;- Two-Wire Interface +AT91C_ID_PWMC EQU (10) ;- PWM Controller +AT91C_ID_UDP EQU (11) ;- USB Device Port +AT91C_ID_TC0 EQU (12) ;- Timer Counter 0 +AT91C_ID_TC1 EQU (13) ;- Timer Counter 1 +AT91C_ID_TC2 EQU (14) ;- Timer Counter 2 +AT91C_ID_CAN EQU (15) ;- Control Area Network Controller +AT91C_ID_EMAC EQU (16) ;- Ethernet MAC +AT91C_ID_ADC EQU (17) ;- Analog-to-Digital Converter +AT91C_ID_18_Reserved EQU (18) ;- Reserved +AT91C_ID_19_Reserved EQU (19) ;- Reserved +AT91C_ID_20_Reserved EQU (20) ;- Reserved +AT91C_ID_21_Reserved EQU (21) ;- Reserved +AT91C_ID_22_Reserved EQU (22) ;- Reserved +AT91C_ID_23_Reserved EQU (23) ;- Reserved +AT91C_ID_24_Reserved EQU (24) ;- Reserved +AT91C_ID_25_Reserved EQU (25) ;- Reserved +AT91C_ID_26_Reserved EQU (26) ;- Reserved +AT91C_ID_27_Reserved EQU (27) ;- Reserved +AT91C_ID_28_Reserved EQU (28) ;- Reserved +AT91C_ID_29_Reserved EQU (29) ;- Reserved +AT91C_ID_IRQ0 EQU (30) ;- Advanced Interrupt Controller (IRQ0) +AT91C_ID_IRQ1 EQU (31) ;- Advanced Interrupt Controller (IRQ1) +AT91C_ALL_INT EQU (0xC003FFFF) ;- ALL VALID INTERRUPTS + +// - ***************************************************************************** +// - BASE ADDRESS DEFINITIONS FOR AT91SAM7X256 +// - ***************************************************************************** +AT91C_BASE_SYS EQU (0xFFFFF000) ;- (SYS) Base Address +AT91C_BASE_AIC EQU (0xFFFFF000) ;- (AIC) Base Address +AT91C_BASE_PDC_DBGU EQU (0xFFFFF300) ;- (PDC_DBGU) Base Address +AT91C_BASE_DBGU EQU (0xFFFFF200) ;- (DBGU) Base Address +AT91C_BASE_PIOA EQU (0xFFFFF400) ;- (PIOA) Base Address +AT91C_BASE_PIOB EQU (0xFFFFF600) ;- (PIOB) Base Address +AT91C_BASE_CKGR EQU (0xFFFFFC20) ;- (CKGR) Base Address +AT91C_BASE_PMC EQU (0xFFFFFC00) ;- (PMC) Base Address +AT91C_BASE_RSTC EQU (0xFFFFFD00) ;- (RSTC) Base Address +AT91C_BASE_RTTC EQU (0xFFFFFD20) ;- (RTTC) Base Address +AT91C_BASE_PITC EQU (0xFFFFFD30) ;- (PITC) Base Address +AT91C_BASE_WDTC EQU (0xFFFFFD40) ;- (WDTC) Base Address +AT91C_BASE_VREG EQU (0xFFFFFD60) ;- (VREG) Base Address +AT91C_BASE_MC EQU (0xFFFFFF00) ;- (MC) Base Address +AT91C_BASE_PDC_SPI1 EQU (0xFFFE4100) ;- (PDC_SPI1) Base Address +AT91C_BASE_SPI1 EQU (0xFFFE4000) ;- (SPI1) Base Address +AT91C_BASE_PDC_SPI0 EQU (0xFFFE0100) ;- (PDC_SPI0) Base Address +AT91C_BASE_SPI0 EQU (0xFFFE0000) ;- (SPI0) Base Address +AT91C_BASE_PDC_US1 EQU (0xFFFC4100) ;- (PDC_US1) Base Address +AT91C_BASE_US1 EQU (0xFFFC4000) ;- (US1) Base Address +AT91C_BASE_PDC_US0 EQU (0xFFFC0100) ;- (PDC_US0) Base Address +AT91C_BASE_US0 EQU (0xFFFC0000) ;- (US0) Base Address +AT91C_BASE_PDC_SSC EQU (0xFFFD4100) ;- (PDC_SSC) Base Address +AT91C_BASE_SSC EQU (0xFFFD4000) ;- (SSC) Base Address +AT91C_BASE_TWI EQU (0xFFFB8000) ;- (TWI) Base Address +AT91C_BASE_PWMC_CH3 EQU (0xFFFCC260) ;- (PWMC_CH3) Base Address +AT91C_BASE_PWMC_CH2 EQU (0xFFFCC240) ;- (PWMC_CH2) Base Address +AT91C_BASE_PWMC_CH1 EQU (0xFFFCC220) ;- (PWMC_CH1) Base Address +AT91C_BASE_PWMC_CH0 EQU (0xFFFCC200) ;- (PWMC_CH0) Base Address +AT91C_BASE_PWMC EQU (0xFFFCC000) ;- (PWMC) Base Address +AT91C_BASE_UDP EQU (0xFFFB0000) ;- (UDP) Base Address +AT91C_BASE_TC0 EQU (0xFFFA0000) ;- (TC0) Base Address +AT91C_BASE_TC1 EQU (0xFFFA0040) ;- (TC1) Base Address +AT91C_BASE_TC2 EQU (0xFFFA0080) ;- (TC2) Base Address +AT91C_BASE_TCB EQU (0xFFFA0000) ;- (TCB) Base Address +AT91C_BASE_CAN_MB0 EQU (0xFFFD0200) ;- (CAN_MB0) Base Address +AT91C_BASE_CAN_MB1 EQU (0xFFFD0220) ;- (CAN_MB1) Base Address +AT91C_BASE_CAN_MB2 EQU (0xFFFD0240) ;- (CAN_MB2) Base Address +AT91C_BASE_CAN_MB3 EQU (0xFFFD0260) ;- (CAN_MB3) Base Address +AT91C_BASE_CAN_MB4 EQU (0xFFFD0280) ;- (CAN_MB4) Base Address +AT91C_BASE_CAN_MB5 EQU (0xFFFD02A0) ;- (CAN_MB5) Base Address +AT91C_BASE_CAN_MB6 EQU (0xFFFD02C0) ;- (CAN_MB6) Base Address +AT91C_BASE_CAN_MB7 EQU (0xFFFD02E0) ;- (CAN_MB7) Base Address +AT91C_BASE_CAN EQU (0xFFFD0000) ;- (CAN) Base Address +AT91C_BASE_EMAC EQU (0xFFFDC000) ;- (EMAC) Base Address +AT91C_BASE_PDC_ADC EQU (0xFFFD8100) ;- (PDC_ADC) Base Address +AT91C_BASE_ADC EQU (0xFFFD8000) ;- (ADC) Base Address + +// - ***************************************************************************** +// - MEMORY MAPPING DEFINITIONS FOR AT91SAM7X256 +// - ***************************************************************************** +// - ISRAM +AT91C_ISRAM EQU (0x00200000) ;- Internal SRAM base address +AT91C_ISRAM_SIZE EQU (0x00010000) ;- Internal SRAM size in byte (64 Kbytes) +// - IFLASH +AT91C_IFLASH EQU (0x00100000) ;- Internal FLASH base address +AT91C_IFLASH_SIZE EQU (0x00040000) ;- Internal FLASH size in byte (256 Kbytes) +AT91C_IFLASH_PAGE_SIZE EQU (256) ;- Internal FLASH Page Size: 256 bytes +AT91C_IFLASH_LOCK_REGION_SIZE EQU (16384) ;- Internal FLASH Lock Region Size: 16 Kbytes +AT91C_IFLASH_NB_OF_PAGES EQU (1024) ;- Internal FLASH Number of Pages: 1024 bytes +AT91C_IFLASH_NB_OF_LOCK_BITS EQU (16) ;- Internal FLASH Number of Lock Bits: 16 bytes +#endif /* __IAR_SYSTEMS_ASM__ */ + + +#endif /* AT91SAM7X256_H */ diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/lib_AT91SAM7X256.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/lib_AT91SAM7X256.h new file mode 100644 index 0000000..95492d0 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/lib_AT91SAM7X256.h @@ -0,0 +1,4211 @@ +//* ---------------------------------------------------------------------------- +//* ATMEL Microcontroller Software Support - ROUSSET - +//* ---------------------------------------------------------------------------- +//* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +//* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +//* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +//* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +//* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +//* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +//* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +//* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +//* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +//* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +//* ---------------------------------------------------------------------------- +//* File Name : lib_AT91SAM7X256.h +//* Object : AT91SAM7X256 inlined functions +//* Generated : AT91 SW Application Group 11/02/2005 (15:17:24) +//* +//* CVS Reference : /lib_dbgu.h/1.1/Thu Aug 25 12:56:22 2005// +//* CVS Reference : /lib_pmc_SAM7X.h/1.4/Tue Aug 30 13:00:36 2005// +//* CVS Reference : /lib_VREG_6085B.h/1.1/Tue Feb 1 16:20:47 2005// +//* CVS Reference : /lib_rstc_6098A.h/1.1/Wed Oct 6 10:39:20 2004// +//* CVS Reference : /lib_ssc.h/1.4/Fri Jan 31 12:19:20 2003// +//* CVS Reference : /lib_wdtc_6080A.h/1.1/Wed Oct 6 10:38:30 2004// +//* CVS Reference : /lib_usart.h/1.5/Thu Nov 21 16:01:54 2002// +//* CVS Reference : /lib_spi2.h/1.2/Tue Aug 23 15:37:28 2005// +//* CVS Reference : /lib_pitc_6079A.h/1.2/Tue Nov 9 14:43:56 2004// +//* CVS Reference : /lib_aic_6075b.h/1.2/Thu Jul 7 07:48:22 2005// +//* CVS Reference : /lib_twi.h/1.3/Mon Jul 19 14:27:58 2004// +//* CVS Reference : /lib_adc.h/1.6/Fri Oct 17 09:12:38 2003// +//* CVS Reference : /lib_rttc_6081A.h/1.1/Wed Oct 6 10:39:38 2004// +//* CVS Reference : /lib_udp.h/1.5/Tue Aug 30 12:13:47 2005// +//* CVS Reference : /lib_tc_1753b.h/1.1/Fri Jan 31 12:20:02 2003// +//* CVS Reference : /lib_MC_SAM7X.h/1.1/Thu Mar 25 15:19:14 2004// +//* CVS Reference : /lib_pio.h/1.3/Fri Jan 31 12:18:56 2003// +//* CVS Reference : /lib_can_AT91.h/1.5/Tue Aug 23 15:37:07 2005// +//* CVS Reference : /lib_PWM_SAM.h/1.3/Thu Jan 22 10:10:50 2004// +//* CVS Reference : /lib_pdc.h/1.2/Tue Jul 2 13:29:40 2002// +//* ---------------------------------------------------------------------------- + +#ifndef lib_AT91SAM7X256_H +#define lib_AT91SAM7X256_H + +/* ***************************************************************************** + SOFTWARE API FOR AIC + ***************************************************************************** */ +#define AT91C_AIC_BRANCH_OPCODE ((void (*) ()) 0xE51FFF20) // ldr, pc, [pc, #-&F20] + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_ConfigureIt +//* \brief Interrupt Handler Initialization +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_AIC_ConfigureIt ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id, // \arg interrupt number to initialize + unsigned int priority, // \arg priority to give to the interrupt + unsigned int src_type, // \arg activation and sense of activation + void (*newHandler) () ) // \arg address of the interrupt handler +{ + unsigned int oldHandler; + unsigned int mask ; + + oldHandler = pAic->AIC_SVR[irq_id]; + + mask = 0x1 << irq_id ; + //* Disable the interrupt on the interrupt controller + pAic->AIC_IDCR = mask ; + //* Save the interrupt handler routine pointer and the interrupt priority + pAic->AIC_SVR[irq_id] = (unsigned int) newHandler ; + //* Store the Source Mode Register + pAic->AIC_SMR[irq_id] = src_type | priority ; + //* Clear the interrupt on the interrupt controller + pAic->AIC_ICCR = mask ; + + return oldHandler; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_EnableIt +//* \brief Enable corresponding IT number +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_EnableIt ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id ) // \arg interrupt number to initialize +{ + //* Enable the interrupt on the interrupt controller + pAic->AIC_IECR = 0x1 << irq_id ; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_DisableIt +//* \brief Disable corresponding IT number +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_DisableIt ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id ) // \arg interrupt number to initialize +{ + unsigned int mask = 0x1 << irq_id; + //* Disable the interrupt on the interrupt controller + pAic->AIC_IDCR = mask ; + //* Clear the interrupt on the Interrupt Controller ( if one is pending ) + pAic->AIC_ICCR = mask ; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_ClearIt +//* \brief Clear corresponding IT number +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_ClearIt ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id) // \arg interrupt number to initialize +{ + //* Clear the interrupt on the Interrupt Controller ( if one is pending ) + pAic->AIC_ICCR = (0x1 << irq_id); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_AcknowledgeIt +//* \brief Acknowledge corresponding IT number +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_AcknowledgeIt ( + AT91PS_AIC pAic) // \arg pointer to the AIC registers +{ + pAic->AIC_EOICR = pAic->AIC_EOICR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_SetExceptionVector +//* \brief Configure vector handler +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_AIC_SetExceptionVector ( + unsigned int *pVector, // \arg pointer to the AIC registers + void (*Handler) () ) // \arg Interrupt Handler +{ + unsigned int oldVector = *pVector; + + if ((unsigned int) Handler == (unsigned int) AT91C_AIC_BRANCH_OPCODE) + *pVector = (unsigned int) AT91C_AIC_BRANCH_OPCODE; + else + *pVector = (((((unsigned int) Handler) - ((unsigned int) pVector) - 0x8) >> 2) & 0x00FFFFFF) | 0xEA000000; + + return oldVector; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_Trig +//* \brief Trig an IT +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_Trig ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id) // \arg interrupt number +{ + pAic->AIC_ISCR = (0x1 << irq_id) ; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_IsActive +//* \brief Test if an IT is active +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_AIC_IsActive ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id) // \arg Interrupt Number +{ + return (pAic->AIC_ISR & (0x1 << irq_id)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_IsPending +//* \brief Test if an IT is pending +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_AIC_IsPending ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id) // \arg Interrupt Number +{ + return (pAic->AIC_IPR & (0x1 << irq_id)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_Open +//* \brief Set exception vectors and AIC registers to default values +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_Open( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + void (*IrqHandler) (), // \arg Default IRQ vector exception + void (*FiqHandler) (), // \arg Default FIQ vector exception + void (*DefaultHandler) (), // \arg Default Handler set in ISR + void (*SpuriousHandler) (), // \arg Default Spurious Handler + unsigned int protectMode) // \arg Debug Control Register +{ + int i; + + // Disable all interrupts and set IVR to the default handler + for (i = 0; i < 32; ++i) { + AT91F_AIC_DisableIt(pAic, i); + AT91F_AIC_ConfigureIt(pAic, i, AT91C_AIC_PRIOR_LOWEST, AT91C_AIC_SRCTYPE_HIGH_LEVEL, DefaultHandler); + } + + // Set the IRQ exception vector + AT91F_AIC_SetExceptionVector((unsigned int *) 0x18, IrqHandler); + // Set the Fast Interrupt exception vector + AT91F_AIC_SetExceptionVector((unsigned int *) 0x1C, FiqHandler); + + pAic->AIC_SPU = (unsigned int) SpuriousHandler; + pAic->AIC_DCR = protectMode; +} +/* ***************************************************************************** + SOFTWARE API FOR PDC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_SetNextRx +//* \brief Set the next receive transfer descriptor +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_SetNextRx ( + AT91PS_PDC pPDC, // \arg pointer to a PDC controller + char *address, // \arg address to the next bloc to be received + unsigned int bytes) // \arg number of bytes to be received +{ + pPDC->PDC_RNPR = (unsigned int) address; + pPDC->PDC_RNCR = bytes; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_SetNextTx +//* \brief Set the next transmit transfer descriptor +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_SetNextTx ( + AT91PS_PDC pPDC, // \arg pointer to a PDC controller + char *address, // \arg address to the next bloc to be transmitted + unsigned int bytes) // \arg number of bytes to be transmitted +{ + pPDC->PDC_TNPR = (unsigned int) address; + pPDC->PDC_TNCR = bytes; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_SetRx +//* \brief Set the receive transfer descriptor +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_SetRx ( + AT91PS_PDC pPDC, // \arg pointer to a PDC controller + char *address, // \arg address to the next bloc to be received + unsigned int bytes) // \arg number of bytes to be received +{ + pPDC->PDC_RPR = (unsigned int) address; + pPDC->PDC_RCR = bytes; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_SetTx +//* \brief Set the transmit transfer descriptor +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_SetTx ( + AT91PS_PDC pPDC, // \arg pointer to a PDC controller + char *address, // \arg address to the next bloc to be transmitted + unsigned int bytes) // \arg number of bytes to be transmitted +{ + pPDC->PDC_TPR = (unsigned int) address; + pPDC->PDC_TCR = bytes; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_EnableTx +//* \brief Enable transmit +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_EnableTx ( + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + pPDC->PDC_PTCR = AT91C_PDC_TXTEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_EnableRx +//* \brief Enable receive +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_EnableRx ( + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + pPDC->PDC_PTCR = AT91C_PDC_RXTEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_DisableTx +//* \brief Disable transmit +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_DisableTx ( + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + pPDC->PDC_PTCR = AT91C_PDC_TXTDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_DisableRx +//* \brief Disable receive +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_DisableRx ( + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + pPDC->PDC_PTCR = AT91C_PDC_RXTDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_IsTxEmpty +//* \brief Test if the current transfer descriptor has been sent +//*---------------------------------------------------------------------------- +__inline int AT91F_PDC_IsTxEmpty ( // \return return 1 if transfer is complete + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + return !(pPDC->PDC_TCR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_IsNextTxEmpty +//* \brief Test if the next transfer descriptor has been moved to the current td +//*---------------------------------------------------------------------------- +__inline int AT91F_PDC_IsNextTxEmpty ( // \return return 1 if transfer is complete + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + return !(pPDC->PDC_TNCR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_IsRxEmpty +//* \brief Test if the current transfer descriptor has been filled +//*---------------------------------------------------------------------------- +__inline int AT91F_PDC_IsRxEmpty ( // \return return 1 if transfer is complete + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + return !(pPDC->PDC_RCR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_IsNextRxEmpty +//* \brief Test if the next transfer descriptor has been moved to the current td +//*---------------------------------------------------------------------------- +__inline int AT91F_PDC_IsNextRxEmpty ( // \return return 1 if transfer is complete + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + return !(pPDC->PDC_RNCR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_Open +//* \brief Open PDC: disable TX and RX reset transfer descriptors, re-enable RX and TX +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_Open ( + AT91PS_PDC pPDC) // \arg pointer to a PDC controller +{ + //* Disable the RX and TX PDC transfer requests + AT91F_PDC_DisableRx(pPDC); + AT91F_PDC_DisableTx(pPDC); + + //* Reset all Counter register Next buffer first + AT91F_PDC_SetNextTx(pPDC, (char *) 0, 0); + AT91F_PDC_SetNextRx(pPDC, (char *) 0, 0); + AT91F_PDC_SetTx(pPDC, (char *) 0, 0); + AT91F_PDC_SetRx(pPDC, (char *) 0, 0); + + //* Enable the RX and TX PDC transfer requests + AT91F_PDC_EnableRx(pPDC); + AT91F_PDC_EnableTx(pPDC); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_Close +//* \brief Close PDC: disable TX and RX reset transfer descriptors +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_Close ( + AT91PS_PDC pPDC) // \arg pointer to a PDC controller +{ + //* Disable the RX and TX PDC transfer requests + AT91F_PDC_DisableRx(pPDC); + AT91F_PDC_DisableTx(pPDC); + + //* Reset all Counter register Next buffer first + AT91F_PDC_SetNextTx(pPDC, (char *) 0, 0); + AT91F_PDC_SetNextRx(pPDC, (char *) 0, 0); + AT91F_PDC_SetTx(pPDC, (char *) 0, 0); + AT91F_PDC_SetRx(pPDC, (char *) 0, 0); + +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_SendFrame +//* \brief Close PDC: disable TX and RX reset transfer descriptors +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PDC_SendFrame( + AT91PS_PDC pPDC, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + if (AT91F_PDC_IsTxEmpty(pPDC)) { + //* Buffer and next buffer can be initialized + AT91F_PDC_SetTx(pPDC, pBuffer, szBuffer); + AT91F_PDC_SetNextTx(pPDC, pNextBuffer, szNextBuffer); + return 2; + } + else if (AT91F_PDC_IsNextTxEmpty(pPDC)) { + //* Only one buffer can be initialized + AT91F_PDC_SetNextTx(pPDC, pBuffer, szBuffer); + return 1; + } + else { + //* All buffer are in use... + return 0; + } +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_ReceiveFrame +//* \brief Close PDC: disable TX and RX reset transfer descriptors +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PDC_ReceiveFrame ( + AT91PS_PDC pPDC, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + if (AT91F_PDC_IsRxEmpty(pPDC)) { + //* Buffer and next buffer can be initialized + AT91F_PDC_SetRx(pPDC, pBuffer, szBuffer); + AT91F_PDC_SetNextRx(pPDC, pNextBuffer, szNextBuffer); + return 2; + } + else if (AT91F_PDC_IsNextRxEmpty(pPDC)) { + //* Only one buffer can be initialized + AT91F_PDC_SetNextRx(pPDC, pBuffer, szBuffer); + return 1; + } + else { + //* All buffer are in use... + return 0; + } +} +/* ***************************************************************************** + SOFTWARE API FOR DBGU + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_DBGU_InterruptEnable +//* \brief Enable DBGU Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_DBGU_InterruptEnable( + AT91PS_DBGU pDbgu, // \arg pointer to a DBGU controller + unsigned int flag) // \arg dbgu interrupt to be enabled +{ + pDbgu->DBGU_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_DBGU_InterruptDisable +//* \brief Disable DBGU Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_DBGU_InterruptDisable( + AT91PS_DBGU pDbgu, // \arg pointer to a DBGU controller + unsigned int flag) // \arg dbgu interrupt to be disabled +{ + pDbgu->DBGU_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_DBGU_GetInterruptMaskStatus +//* \brief Return DBGU Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_DBGU_GetInterruptMaskStatus( // \return DBGU Interrupt Mask Status + AT91PS_DBGU pDbgu) // \arg pointer to a DBGU controller +{ + return pDbgu->DBGU_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_DBGU_IsInterruptMasked +//* \brief Test if DBGU Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_DBGU_IsInterruptMasked( + AT91PS_DBGU pDbgu, // \arg pointer to a DBGU controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_DBGU_GetInterruptMaskStatus(pDbgu) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR PIO + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgPeriph +//* \brief Enable pins to be drived by peripheral +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgPeriph( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int periphAEnable, // \arg PERIPH A to enable + unsigned int periphBEnable) // \arg PERIPH B to enable + +{ + pPio->PIO_ASR = periphAEnable; + pPio->PIO_BSR = periphBEnable; + pPio->PIO_PDR = (periphAEnable | periphBEnable); // Set in Periph mode +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgOutput +//* \brief Enable PIO in output mode +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgOutput( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int pioEnable) // \arg PIO to be enabled +{ + pPio->PIO_PER = pioEnable; // Set in PIO mode + pPio->PIO_OER = pioEnable; // Configure in Output +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgInput +//* \brief Enable PIO in input mode +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgInput( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int inputEnable) // \arg PIO to be enabled +{ + // Disable output + pPio->PIO_ODR = inputEnable; + pPio->PIO_PER = inputEnable; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgOpendrain +//* \brief Configure PIO in open drain +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgOpendrain( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int multiDrvEnable) // \arg pio to be configured in open drain +{ + // Configure the multi-drive option + pPio->PIO_MDDR = ~multiDrvEnable; + pPio->PIO_MDER = multiDrvEnable; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgPullup +//* \brief Enable pullup on PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgPullup( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int pullupEnable) // \arg enable pullup on PIO +{ + // Connect or not Pullup + pPio->PIO_PPUDR = ~pullupEnable; + pPio->PIO_PPUER = pullupEnable; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgDirectDrive +//* \brief Enable direct drive on PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgDirectDrive( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int directDrive) // \arg PIO to be configured with direct drive + +{ + // Configure the Direct Drive + pPio->PIO_OWDR = ~directDrive; + pPio->PIO_OWER = directDrive; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgInputFilter +//* \brief Enable input filter on input PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgInputFilter( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int inputFilter) // \arg PIO to be configured with input filter + +{ + // Configure the Direct Drive + pPio->PIO_IFDR = ~inputFilter; + pPio->PIO_IFER = inputFilter; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetInput +//* \brief Return PIO input value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetInput( // \return PIO input + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_PDSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsInputSet +//* \brief Test if PIO is input flag is active +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsInputSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetInput(pPio) & flag); +} + + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_SetOutput +//* \brief Set to 1 output PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_SetOutput( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg output to be set +{ + pPio->PIO_SODR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_ClearOutput +//* \brief Set to 0 output PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_ClearOutput( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg output to be cleared +{ + pPio->PIO_CODR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_ForceOutput +//* \brief Force output when Direct drive option is enabled +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_ForceOutput( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg output to be forced +{ + pPio->PIO_ODSR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_Enable +//* \brief Enable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_Enable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio to be enabled +{ + pPio->PIO_PER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_Disable +//* \brief Disable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_Disable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio to be disabled +{ + pPio->PIO_PDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetStatus +//* \brief Return PIO Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetStatus( // \return PIO Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_PSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsSet +//* \brief Test if PIO is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_OutputEnable +//* \brief Output Enable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_OutputEnable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio output to be enabled +{ + pPio->PIO_OER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_OutputDisable +//* \brief Output Enable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_OutputDisable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio output to be disabled +{ + pPio->PIO_ODR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetOutputStatus +//* \brief Return PIO Output Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetOutputStatus( // \return PIO Output Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_OSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsOuputSet +//* \brief Test if PIO Output is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsOutputSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetOutputStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_InputFilterEnable +//* \brief Input Filter Enable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_InputFilterEnable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio input filter to be enabled +{ + pPio->PIO_IFER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_InputFilterDisable +//* \brief Input Filter Disable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_InputFilterDisable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio input filter to be disabled +{ + pPio->PIO_IFDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetInputFilterStatus +//* \brief Return PIO Input Filter Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetInputFilterStatus( // \return PIO Input Filter Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_IFSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsInputFilterSet +//* \brief Test if PIO Input filter is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsInputFilterSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetInputFilterStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetOutputDataStatus +//* \brief Return PIO Output Data Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetOutputDataStatus( // \return PIO Output Data Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_ODSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_InterruptEnable +//* \brief Enable PIO Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_InterruptEnable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio interrupt to be enabled +{ + pPio->PIO_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_InterruptDisable +//* \brief Disable PIO Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_InterruptDisable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio interrupt to be disabled +{ + pPio->PIO_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetInterruptMaskStatus +//* \brief Return PIO Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetInterruptMaskStatus( // \return PIO Interrupt Mask Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetInterruptStatus +//* \brief Return PIO Interrupt Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetInterruptStatus( // \return PIO Interrupt Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_ISR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsInterruptMasked +//* \brief Test if PIO Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsInterruptMasked( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetInterruptMaskStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsInterruptSet +//* \brief Test if PIO Interrupt is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsInterruptSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetInterruptStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_MultiDriverEnable +//* \brief Multi Driver Enable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_MultiDriverEnable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio to be enabled +{ + pPio->PIO_MDER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_MultiDriverDisable +//* \brief Multi Driver Disable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_MultiDriverDisable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio to be disabled +{ + pPio->PIO_MDDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetMultiDriverStatus +//* \brief Return PIO Multi Driver Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetMultiDriverStatus( // \return PIO Multi Driver Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_MDSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsMultiDriverSet +//* \brief Test if PIO MultiDriver is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsMultiDriverSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetMultiDriverStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_A_RegisterSelection +//* \brief PIO A Register Selection +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_A_RegisterSelection( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio A register selection +{ + pPio->PIO_ASR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_B_RegisterSelection +//* \brief PIO B Register Selection +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_B_RegisterSelection( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio B register selection +{ + pPio->PIO_BSR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_Get_AB_RegisterStatus +//* \brief Return PIO Interrupt Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_Get_AB_RegisterStatus( // \return PIO AB Register Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_ABSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsAB_RegisterSet +//* \brief Test if PIO AB Register is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsAB_RegisterSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_Get_AB_RegisterStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_OutputWriteEnable +//* \brief Output Write Enable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_OutputWriteEnable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio output write to be enabled +{ + pPio->PIO_OWER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_OutputWriteDisable +//* \brief Output Write Disable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_OutputWriteDisable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio output write to be disabled +{ + pPio->PIO_OWDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetOutputWriteStatus +//* \brief Return PIO Output Write Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetOutputWriteStatus( // \return PIO Output Write Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_OWSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsOutputWriteSet +//* \brief Test if PIO OutputWrite is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsOutputWriteSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetOutputWriteStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetCfgPullup +//* \brief Return PIO Configuration Pullup +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetCfgPullup( // \return PIO Configuration Pullup + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_PPUSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsOutputDataStatusSet +//* \brief Test if PIO Output Data Status is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsOutputDataStatusSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetOutputDataStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsCfgPullupStatusSet +//* \brief Test if PIO Configuration Pullup Status is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsCfgPullupStatusSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (~AT91F_PIO_GetCfgPullup(pPio) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR PMC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_CfgSysClkEnableReg +//* \brief Configure the System Clock Enable Register of the PMC controller +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_CfgSysClkEnableReg ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int mode) +{ + //* Write to the SCER register + pPMC->PMC_SCER = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_CfgSysClkDisableReg +//* \brief Configure the System Clock Disable Register of the PMC controller +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_CfgSysClkDisableReg ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int mode) +{ + //* Write to the SCDR register + pPMC->PMC_SCDR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_GetSysClkStatusReg +//* \brief Return the System Clock Status Register of the PMC controller +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_GetSysClkStatusReg ( + AT91PS_PMC pPMC // pointer to a CAN controller + ) +{ + return pPMC->PMC_SCSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_EnablePeriphClock +//* \brief Enable peripheral clock +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_EnablePeriphClock ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int periphIds) // \arg IDs of peripherals to enable +{ + pPMC->PMC_PCER = periphIds; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_DisablePeriphClock +//* \brief Disable peripheral clock +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_DisablePeriphClock ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int periphIds) // \arg IDs of peripherals to enable +{ + pPMC->PMC_PCDR = periphIds; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_GetPeriphClock +//* \brief Get peripheral clock status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_GetPeriphClock ( + AT91PS_PMC pPMC) // \arg pointer to PMC controller +{ + return pPMC->PMC_PCSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_CfgMainOscillatorReg +//* \brief Cfg the main oscillator +//*---------------------------------------------------------------------------- +__inline void AT91F_CKGR_CfgMainOscillatorReg ( + AT91PS_CKGR pCKGR, // \arg pointer to CKGR controller + unsigned int mode) +{ + pCKGR->CKGR_MOR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_GetMainOscillatorReg +//* \brief Cfg the main oscillator +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CKGR_GetMainOscillatorReg ( + AT91PS_CKGR pCKGR) // \arg pointer to CKGR controller +{ + return pCKGR->CKGR_MOR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_EnableMainOscillator +//* \brief Enable the main oscillator +//*---------------------------------------------------------------------------- +__inline void AT91F_CKGR_EnableMainOscillator( + AT91PS_CKGR pCKGR) // \arg pointer to CKGR controller +{ + pCKGR->CKGR_MOR |= AT91C_CKGR_MOSCEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_DisableMainOscillator +//* \brief Disable the main oscillator +//*---------------------------------------------------------------------------- +__inline void AT91F_CKGR_DisableMainOscillator ( + AT91PS_CKGR pCKGR) // \arg pointer to CKGR controller +{ + pCKGR->CKGR_MOR &= ~AT91C_CKGR_MOSCEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_CfgMainOscStartUpTime +//* \brief Cfg MOR Register according to the main osc startup time +//*---------------------------------------------------------------------------- +__inline void AT91F_CKGR_CfgMainOscStartUpTime ( + AT91PS_CKGR pCKGR, // \arg pointer to CKGR controller + unsigned int startup_time, // \arg main osc startup time in microsecond (us) + unsigned int slowClock) // \arg slowClock in Hz +{ + pCKGR->CKGR_MOR &= ~AT91C_CKGR_OSCOUNT; + pCKGR->CKGR_MOR |= ((slowClock * startup_time)/(8*1000000)) << 8; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_GetMainClockFreqReg +//* \brief Cfg the main oscillator +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CKGR_GetMainClockFreqReg ( + AT91PS_CKGR pCKGR) // \arg pointer to CKGR controller +{ + return pCKGR->CKGR_MCFR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_GetMainClock +//* \brief Return Main clock in Hz +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CKGR_GetMainClock ( + AT91PS_CKGR pCKGR, // \arg pointer to CKGR controller + unsigned int slowClock) // \arg slowClock in Hz +{ + return ((pCKGR->CKGR_MCFR & AT91C_CKGR_MAINF) * slowClock) >> 4; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_CfgMCKReg +//* \brief Cfg Master Clock Register +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_CfgMCKReg ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int mode) +{ + pPMC->PMC_MCKR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_GetMCKReg +//* \brief Return Master Clock Register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_GetMCKReg( + AT91PS_PMC pPMC) // \arg pointer to PMC controller +{ + return pPMC->PMC_MCKR; +} + +//*------------------------------------------------------------------------------ +//* \fn AT91F_PMC_GetMasterClock +//* \brief Return master clock in Hz which correponds to processor clock for ARM7 +//*------------------------------------------------------------------------------ +__inline unsigned int AT91F_PMC_GetMasterClock ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + AT91PS_CKGR pCKGR, // \arg pointer to CKGR controller + unsigned int slowClock) // \arg slowClock in Hz +{ + unsigned int reg = pPMC->PMC_MCKR; + unsigned int prescaler = (1 << ((reg & AT91C_PMC_PRES) >> 2)); + unsigned int pllDivider, pllMultiplier; + + switch (reg & AT91C_PMC_CSS) { + case AT91C_PMC_CSS_SLOW_CLK: // Slow clock selected + return slowClock / prescaler; + case AT91C_PMC_CSS_MAIN_CLK: // Main clock is selected + return AT91F_CKGR_GetMainClock(pCKGR, slowClock) / prescaler; + case AT91C_PMC_CSS_PLL_CLK: // PLLB clock is selected + reg = pCKGR->CKGR_PLLR; + pllDivider = (reg & AT91C_CKGR_DIV); + pllMultiplier = ((reg & AT91C_CKGR_MUL) >> 16) + 1; + return AT91F_CKGR_GetMainClock(pCKGR, slowClock) / pllDivider * pllMultiplier / prescaler; + } + return 0; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_EnablePCK +//* \brief Enable peripheral clock +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_EnablePCK ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int pck, // \arg Peripheral clock identifier 0 .. 7 + unsigned int mode) +{ + pPMC->PMC_PCKR[pck] = mode; + pPMC->PMC_SCER = (1 << pck) << 8; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_DisablePCK +//* \brief Enable peripheral clock +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_DisablePCK ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int pck) // \arg Peripheral clock identifier 0 .. 7 +{ + pPMC->PMC_SCDR = (1 << pck) << 8; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_EnableIt +//* \brief Enable PMC interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_EnableIt ( + AT91PS_PMC pPMC, // pointer to a PMC controller + unsigned int flag) // IT to be enabled +{ + //* Write to the IER register + pPMC->PMC_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_DisableIt +//* \brief Disable PMC interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_DisableIt ( + AT91PS_PMC pPMC, // pointer to a PMC controller + unsigned int flag) // IT to be disabled +{ + //* Write to the IDR register + pPMC->PMC_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_GetStatus +//* \brief Return PMC Interrupt Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_GetStatus( // \return PMC Interrupt Status + AT91PS_PMC pPMC) // pointer to a PMC controller +{ + return pPMC->PMC_SR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_GetInterruptMaskStatus +//* \brief Return PMC Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_GetInterruptMaskStatus( // \return PMC Interrupt Mask Status + AT91PS_PMC pPMC) // pointer to a PMC controller +{ + return pPMC->PMC_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_IsInterruptMasked +//* \brief Test if PMC Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_IsInterruptMasked( + AT91PS_PMC pPMC, // \arg pointer to a PMC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PMC_GetInterruptMaskStatus(pPMC) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_IsStatusSet +//* \brief Test if PMC Status is Set +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_IsStatusSet( + AT91PS_PMC pPMC, // \arg pointer to a PMC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PMC_GetStatus(pPMC) & flag); +} + +// ---------------------------------------------------------------------------- +// \fn AT91F_CKGR_CfgPLLReg +// \brief Cfg the PLL Register +// ---------------------------------------------------------------------------- +__inline void AT91F_CKGR_CfgPLLReg ( + AT91PS_CKGR pCKGR, // \arg pointer to CKGR controller + unsigned int mode) +{ + pCKGR->CKGR_PLLR = mode; +} + +// ---------------------------------------------------------------------------- +// \fn AT91F_CKGR_GetPLLReg +// \brief Get the PLL Register +// ---------------------------------------------------------------------------- +__inline unsigned int AT91F_CKGR_GetPLLReg ( + AT91PS_CKGR pCKGR) // \arg pointer to CKGR controller +{ + return pCKGR->CKGR_PLLR; +} + + +/* ***************************************************************************** + SOFTWARE API FOR RSTC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_RSTSoftReset +//* \brief Start Software Reset +//*---------------------------------------------------------------------------- +__inline void AT91F_RSTSoftReset( + AT91PS_RSTC pRSTC, + unsigned int reset) +{ + pRSTC->RSTC_RCR = (0xA5000000 | reset); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_RSTSetMode +//* \brief Set Reset Mode +//*---------------------------------------------------------------------------- +__inline void AT91F_RSTSetMode( + AT91PS_RSTC pRSTC, + unsigned int mode) +{ + pRSTC->RSTC_RMR = (0xA5000000 | mode); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_RSTGetMode +//* \brief Get Reset Mode +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_RSTGetMode( + AT91PS_RSTC pRSTC) +{ + return (pRSTC->RSTC_RMR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_RSTGetStatus +//* \brief Get Reset Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_RSTGetStatus( + AT91PS_RSTC pRSTC) +{ + return (pRSTC->RSTC_RSR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_RSTIsSoftRstActive +//* \brief Return !=0 if software reset is still not completed +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_RSTIsSoftRstActive( + AT91PS_RSTC pRSTC) +{ + return ((pRSTC->RSTC_RSR) & AT91C_RSTC_SRCMP); +} +/* ***************************************************************************** + SOFTWARE API FOR RTTC + ***************************************************************************** */ +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_SetRTT_TimeBase() +//* \brief Set the RTT prescaler according to the TimeBase in ms +//*-------------------------------------------------------------------------------------- +__inline unsigned int AT91F_RTTSetTimeBase( + AT91PS_RTTC pRTTC, + unsigned int ms) +{ + if (ms > 2000) + return 1; // AT91C_TIME_OUT_OF_RANGE + pRTTC->RTTC_RTMR &= ~0xFFFF; + pRTTC->RTTC_RTMR |= (((ms << 15) /1000) & 0xFFFF); + return 0; +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTTSetPrescaler() +//* \brief Set the new prescaler value +//*-------------------------------------------------------------------------------------- +__inline unsigned int AT91F_RTTSetPrescaler( + AT91PS_RTTC pRTTC, + unsigned int rtpres) +{ + pRTTC->RTTC_RTMR &= ~0xFFFF; + pRTTC->RTTC_RTMR |= (rtpres & 0xFFFF); + return (pRTTC->RTTC_RTMR); +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTTRestart() +//* \brief Restart the RTT prescaler +//*-------------------------------------------------------------------------------------- +__inline void AT91F_RTTRestart( + AT91PS_RTTC pRTTC) +{ + pRTTC->RTTC_RTMR |= AT91C_RTTC_RTTRST; +} + + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_SetAlarmINT() +//* \brief Enable RTT Alarm Interrupt +//*-------------------------------------------------------------------------------------- +__inline void AT91F_RTTSetAlarmINT( + AT91PS_RTTC pRTTC) +{ + pRTTC->RTTC_RTMR |= AT91C_RTTC_ALMIEN; +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_ClearAlarmINT() +//* \brief Disable RTT Alarm Interrupt +//*-------------------------------------------------------------------------------------- +__inline void AT91F_RTTClearAlarmINT( + AT91PS_RTTC pRTTC) +{ + pRTTC->RTTC_RTMR &= ~AT91C_RTTC_ALMIEN; +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_SetRttIncINT() +//* \brief Enable RTT INC Interrupt +//*-------------------------------------------------------------------------------------- +__inline void AT91F_RTTSetRttIncINT( + AT91PS_RTTC pRTTC) +{ + pRTTC->RTTC_RTMR |= AT91C_RTTC_RTTINCIEN; +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_ClearRttIncINT() +//* \brief Disable RTT INC Interrupt +//*-------------------------------------------------------------------------------------- +__inline void AT91F_RTTClearRttIncINT( + AT91PS_RTTC pRTTC) +{ + pRTTC->RTTC_RTMR &= ~AT91C_RTTC_RTTINCIEN; +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_SetAlarmValue() +//* \brief Set RTT Alarm Value +//*-------------------------------------------------------------------------------------- +__inline void AT91F_RTTSetAlarmValue( + AT91PS_RTTC pRTTC, unsigned int alarm) +{ + pRTTC->RTTC_RTAR = alarm; +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_GetAlarmValue() +//* \brief Get RTT Alarm Value +//*-------------------------------------------------------------------------------------- +__inline unsigned int AT91F_RTTGetAlarmValue( + AT91PS_RTTC pRTTC) +{ + return(pRTTC->RTTC_RTAR); +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTTGetStatus() +//* \brief Read the RTT status +//*-------------------------------------------------------------------------------------- +__inline unsigned int AT91F_RTTGetStatus( + AT91PS_RTTC pRTTC) +{ + return(pRTTC->RTTC_RTSR); +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_ReadValue() +//* \brief Read the RTT value +//*-------------------------------------------------------------------------------------- +__inline unsigned int AT91F_RTTReadValue( + AT91PS_RTTC pRTTC) +{ + register volatile unsigned int val1,val2; + do + { + val1 = pRTTC->RTTC_RTVR; + val2 = pRTTC->RTTC_RTVR; + } + while(val1 != val2); + return(val1); +} +/* ***************************************************************************** + SOFTWARE API FOR PITC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITInit +//* \brief System timer init : period in µsecond, system clock freq in MHz +//*---------------------------------------------------------------------------- +__inline void AT91F_PITInit( + AT91PS_PITC pPITC, + unsigned int period, + unsigned int pit_frequency) +{ + pPITC->PITC_PIMR = period? (period * pit_frequency + 8) >> 4 : 0; // +8 to avoid %10 and /10 + pPITC->PITC_PIMR |= AT91C_PITC_PITEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITSetPIV +//* \brief Set the PIT Periodic Interval Value +//*---------------------------------------------------------------------------- +__inline void AT91F_PITSetPIV( + AT91PS_PITC pPITC, + unsigned int piv) +{ + pPITC->PITC_PIMR = piv | (pPITC->PITC_PIMR & (AT91C_PITC_PITEN | AT91C_PITC_PITIEN)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITEnableInt +//* \brief Enable PIT periodic interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PITEnableInt( + AT91PS_PITC pPITC) +{ + pPITC->PITC_PIMR |= AT91C_PITC_PITIEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITDisableInt +//* \brief Disable PIT periodic interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PITDisableInt( + AT91PS_PITC pPITC) +{ + pPITC->PITC_PIMR &= ~AT91C_PITC_PITIEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITGetMode +//* \brief Read PIT mode register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PITGetMode( + AT91PS_PITC pPITC) +{ + return(pPITC->PITC_PIMR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITGetStatus +//* \brief Read PIT status register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PITGetStatus( + AT91PS_PITC pPITC) +{ + return(pPITC->PITC_PISR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITGetPIIR +//* \brief Read PIT CPIV and PICNT without ressetting the counters +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PITGetPIIR( + AT91PS_PITC pPITC) +{ + return(pPITC->PITC_PIIR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITGetPIVR +//* \brief Read System timer CPIV and PICNT without ressetting the counters +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PITGetPIVR( + AT91PS_PITC pPITC) +{ + return(pPITC->PITC_PIVR); +} +/* ***************************************************************************** + SOFTWARE API FOR WDTC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_WDTSetMode +//* \brief Set Watchdog Mode Register +//*---------------------------------------------------------------------------- +__inline void AT91F_WDTSetMode( + AT91PS_WDTC pWDTC, + unsigned int Mode) +{ + pWDTC->WDTC_WDMR = Mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_WDTRestart +//* \brief Restart Watchdog +//*---------------------------------------------------------------------------- +__inline void AT91F_WDTRestart( + AT91PS_WDTC pWDTC) +{ + pWDTC->WDTC_WDCR = 0xA5000001; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_WDTSGettatus +//* \brief Get Watchdog Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_WDTSGettatus( + AT91PS_WDTC pWDTC) +{ + return(pWDTC->WDTC_WDSR & 0x3); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_WDTGetPeriod +//* \brief Translate ms into Watchdog Compatible value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_WDTGetPeriod(unsigned int ms) +{ + if ((ms < 4) || (ms > 16000)) + return 0; + return((ms << 8) / 1000); +} +/* ***************************************************************************** + SOFTWARE API FOR VREG + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_VREG_Enable_LowPowerMode +//* \brief Enable VREG Low Power Mode +//*---------------------------------------------------------------------------- +__inline void AT91F_VREG_Enable_LowPowerMode( + AT91PS_VREG pVREG) +{ + pVREG->VREG_MR |= AT91C_VREG_PSTDBY; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_VREG_Disable_LowPowerMode +//* \brief Disable VREG Low Power Mode +//*---------------------------------------------------------------------------- +__inline void AT91F_VREG_Disable_LowPowerMode( + AT91PS_VREG pVREG) +{ + pVREG->VREG_MR &= ~AT91C_VREG_PSTDBY; +}/* ***************************************************************************** + SOFTWARE API FOR MC + ***************************************************************************** */ + +#define AT91C_MC_CORRECT_KEY ((unsigned int) 0x5A << 24) // (MC) Correct Protect Key + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_Remap +//* \brief Make Remap +//*---------------------------------------------------------------------------- +__inline void AT91F_MC_Remap (void) // +{ + AT91PS_MC pMC = (AT91PS_MC) AT91C_BASE_MC; + + pMC->MC_RCR = AT91C_MC_RCB; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_CfgModeReg +//* \brief Configure the EFC Mode Register of the MC controller +//*---------------------------------------------------------------------------- +__inline void AT91F_MC_EFC_CfgModeReg ( + AT91PS_MC pMC, // pointer to a MC controller + unsigned int mode) // mode register +{ + // Write to the FMR register + pMC->MC_FMR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_GetModeReg +//* \brief Return MC EFC Mode Regsiter +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_MC_EFC_GetModeReg( + AT91PS_MC pMC) // pointer to a MC controller +{ + return pMC->MC_FMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_ComputeFMCN +//* \brief Return MC EFC Mode Regsiter +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_MC_EFC_ComputeFMCN( + int master_clock) // master clock in Hz +{ + return (master_clock/1000000 +2); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_PerformCmd +//* \brief Perform EFC Command +//*---------------------------------------------------------------------------- +__inline void AT91F_MC_EFC_PerformCmd ( + AT91PS_MC pMC, // pointer to a MC controller + unsigned int transfer_cmd) +{ + pMC->MC_FCR = transfer_cmd; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_GetStatus +//* \brief Return MC EFC Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_MC_EFC_GetStatus( + AT91PS_MC pMC) // pointer to a MC controller +{ + return pMC->MC_FSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_IsInterruptMasked +//* \brief Test if EFC MC Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_MC_EFC_IsInterruptMasked( + AT91PS_MC pMC, // \arg pointer to a MC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_MC_EFC_GetModeReg(pMC) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_IsInterruptSet +//* \brief Test if EFC MC Interrupt is Set +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_MC_EFC_IsInterruptSet( + AT91PS_MC pMC, // \arg pointer to a MC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_MC_EFC_GetStatus(pMC) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR SPI + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_CfgCs +//* \brief Configure SPI chip select register +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_CfgCs ( + AT91PS_SPI pSPI, // pointer to a SPI controller + int cs, // SPI cs number (0 to 3) + int val) // chip select register +{ + //* Write to the CSR register + *(pSPI->SPI_CSR + cs) = val; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_EnableIt +//* \brief Enable SPI interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_EnableIt ( + AT91PS_SPI pSPI, // pointer to a SPI controller + unsigned int flag) // IT to be enabled +{ + //* Write to the IER register + pSPI->SPI_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_DisableIt +//* \brief Disable SPI interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_DisableIt ( + AT91PS_SPI pSPI, // pointer to a SPI controller + unsigned int flag) // IT to be disabled +{ + //* Write to the IDR register + pSPI->SPI_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_Reset +//* \brief Reset the SPI controller +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_Reset ( + AT91PS_SPI pSPI // pointer to a SPI controller + ) +{ + //* Write to the CR register + pSPI->SPI_CR = AT91C_SPI_SWRST; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_Enable +//* \brief Enable the SPI controller +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_Enable ( + AT91PS_SPI pSPI // pointer to a SPI controller + ) +{ + //* Write to the CR register + pSPI->SPI_CR = AT91C_SPI_SPIEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_Disable +//* \brief Disable the SPI controller +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_Disable ( + AT91PS_SPI pSPI // pointer to a SPI controller + ) +{ + //* Write to the CR register + pSPI->SPI_CR = AT91C_SPI_SPIDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_CfgMode +//* \brief Enable the SPI controller +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_CfgMode ( + AT91PS_SPI pSPI, // pointer to a SPI controller + int mode) // mode register +{ + //* Write to the MR register + pSPI->SPI_MR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_CfgPCS +//* \brief Switch to the correct PCS of SPI Mode Register : Fixed Peripheral Selected +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_CfgPCS ( + AT91PS_SPI pSPI, // pointer to a SPI controller + char PCS_Device) // PCS of the Device +{ + //* Write to the MR register + pSPI->SPI_MR &= 0xFFF0FFFF; + pSPI->SPI_MR |= ( (PCS_Device<<16) & AT91C_SPI_PCS ); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_ReceiveFrame +//* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initializaed with Next Buffer, 0 if PDC is busy +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_SPI_ReceiveFrame ( + AT91PS_SPI pSPI, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + return AT91F_PDC_ReceiveFrame( + (AT91PS_PDC) &(pSPI->SPI_RPR), + pBuffer, + szBuffer, + pNextBuffer, + szNextBuffer); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_SendFrame +//* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initializaed with Next Buffer, 0 if PDC is bSPIy +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_SPI_SendFrame( + AT91PS_SPI pSPI, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + return AT91F_PDC_SendFrame( + (AT91PS_PDC) &(pSPI->SPI_RPR), + pBuffer, + szBuffer, + pNextBuffer, + szNextBuffer); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_Close +//* \brief Close SPI: disable IT disable transfert, close PDC +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_Close ( + AT91PS_SPI pSPI) // \arg pointer to a SPI controller +{ + //* Reset all the Chip Select register + pSPI->SPI_CSR[0] = 0 ; + pSPI->SPI_CSR[1] = 0 ; + pSPI->SPI_CSR[2] = 0 ; + pSPI->SPI_CSR[3] = 0 ; + + //* Reset the SPI mode + pSPI->SPI_MR = 0 ; + + //* Disable all interrupts + pSPI->SPI_IDR = 0xFFFFFFFF ; + + //* Abort the Peripheral Data Transfers + AT91F_PDC_Close((AT91PS_PDC) &(pSPI->SPI_RPR)); + + //* Disable receiver and transmitter and stop any activity immediately + pSPI->SPI_CR = AT91C_SPI_SPIDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_PutChar +//* \brief Send a character,does not check if ready to send +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_PutChar ( + AT91PS_SPI pSPI, + unsigned int character, + unsigned int cs_number ) +{ + unsigned int value_for_cs; + value_for_cs = (~(1 << cs_number)) & 0xF; //Place a zero among a 4 ONEs number + pSPI->SPI_TDR = (character & 0xFFFF) | (value_for_cs << 16); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_GetChar +//* \brief Receive a character,does not check if a character is available +//*---------------------------------------------------------------------------- +__inline int AT91F_SPI_GetChar ( + const AT91PS_SPI pSPI) +{ + return((pSPI->SPI_RDR) & 0xFFFF); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_GetInterruptMaskStatus +//* \brief Return SPI Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_SPI_GetInterruptMaskStatus( // \return SPI Interrupt Mask Status + AT91PS_SPI pSpi) // \arg pointer to a SPI controller +{ + return pSpi->SPI_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_IsInterruptMasked +//* \brief Test if SPI Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_SPI_IsInterruptMasked( + AT91PS_SPI pSpi, // \arg pointer to a SPI controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_SPI_GetInterruptMaskStatus(pSpi) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR USART + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_Baudrate +//* \brief Calculate the baudrate +//* Standard Asynchronous Mode : 8 bits , 1 stop , no parity +#define AT91C_US_ASYNC_MODE ( AT91C_US_USMODE_NORMAL + \ + AT91C_US_NBSTOP_1_BIT + \ + AT91C_US_PAR_NONE + \ + AT91C_US_CHRL_8_BITS + \ + AT91C_US_CLKS_CLOCK ) + +//* Standard External Asynchronous Mode : 8 bits , 1 stop , no parity +#define AT91C_US_ASYNC_SCK_MODE ( AT91C_US_USMODE_NORMAL + \ + AT91C_US_NBSTOP_1_BIT + \ + AT91C_US_PAR_NONE + \ + AT91C_US_CHRL_8_BITS + \ + AT91C_US_CLKS_EXT ) + +//* Standard Synchronous Mode : 8 bits , 1 stop , no parity +#define AT91C_US_SYNC_MODE ( AT91C_US_SYNC + \ + AT91C_US_USMODE_NORMAL + \ + AT91C_US_NBSTOP_1_BIT + \ + AT91C_US_PAR_NONE + \ + AT91C_US_CHRL_8_BITS + \ + AT91C_US_CLKS_CLOCK ) + +//* SCK used Label +#define AT91C_US_SCK_USED (AT91C_US_CKLO | AT91C_US_CLKS_EXT) + +//* Standard ISO T=0 Mode : 8 bits , 1 stop , parity +#define AT91C_US_ISO_READER_MODE ( AT91C_US_USMODE_ISO7816_0 + \ + AT91C_US_CLKS_CLOCK +\ + AT91C_US_NBSTOP_1_BIT + \ + AT91C_US_PAR_EVEN + \ + AT91C_US_CHRL_8_BITS + \ + AT91C_US_CKLO +\ + AT91C_US_OVER) + +//* Standard IRDA mode +#define AT91C_US_ASYNC_IRDA_MODE ( AT91C_US_USMODE_IRDA + \ + AT91C_US_NBSTOP_1_BIT + \ + AT91C_US_PAR_NONE + \ + AT91C_US_CHRL_8_BITS + \ + AT91C_US_CLKS_CLOCK ) + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_Baudrate +//* \brief Caluculate baud_value according to the main clock and the baud rate +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_US_Baudrate ( + const unsigned int main_clock, // \arg peripheral clock + const unsigned int baud_rate) // \arg UART baudrate +{ + unsigned int baud_value = ((main_clock*10)/(baud_rate * 16)); + if ((baud_value % 10) >= 5) + baud_value = (baud_value / 10) + 1; + else + baud_value /= 10; + return baud_value; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_SetBaudrate +//* \brief Set the baudrate according to the CPU clock +//*---------------------------------------------------------------------------- +__inline void AT91F_US_SetBaudrate ( + AT91PS_USART pUSART, // \arg pointer to a USART controller + unsigned int mainClock, // \arg peripheral clock + unsigned int speed) // \arg UART baudrate +{ + //* Define the baud rate divisor register + pUSART->US_BRGR = AT91F_US_Baudrate(mainClock, speed); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_SetTimeguard +//* \brief Set USART timeguard +//*---------------------------------------------------------------------------- +__inline void AT91F_US_SetTimeguard ( + AT91PS_USART pUSART, // \arg pointer to a USART controller + unsigned int timeguard) // \arg timeguard value +{ + //* Write the Timeguard Register + pUSART->US_TTGR = timeguard ; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_EnableIt +//* \brief Enable USART IT +//*---------------------------------------------------------------------------- +__inline void AT91F_US_EnableIt ( + AT91PS_USART pUSART, // \arg pointer to a USART controller + unsigned int flag) // \arg IT to be enabled +{ + //* Write to the IER register + pUSART->US_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_DisableIt +//* \brief Disable USART IT +//*---------------------------------------------------------------------------- +__inline void AT91F_US_DisableIt ( + AT91PS_USART pUSART, // \arg pointer to a USART controller + unsigned int flag) // \arg IT to be disabled +{ + //* Write to the IER register + pUSART->US_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_Configure +//* \brief Configure USART +//*---------------------------------------------------------------------------- +__inline void AT91F_US_Configure ( + AT91PS_USART pUSART, // \arg pointer to a USART controller + unsigned int mainClock, // \arg peripheral clock + unsigned int mode , // \arg mode Register to be programmed + unsigned int baudRate , // \arg baudrate to be programmed + unsigned int timeguard ) // \arg timeguard to be programmed +{ + //* Disable interrupts + pUSART->US_IDR = (unsigned int) -1; + + //* Reset receiver and transmitter + pUSART->US_CR = AT91C_US_RSTRX | AT91C_US_RSTTX | AT91C_US_RXDIS | AT91C_US_TXDIS ; + + //* Define the baud rate divisor register + AT91F_US_SetBaudrate(pUSART, mainClock, baudRate); + + //* Write the Timeguard Register + AT91F_US_SetTimeguard(pUSART, timeguard); + + //* Clear Transmit and Receive Counters + AT91F_PDC_Open((AT91PS_PDC) &(pUSART->US_RPR)); + + //* Define the USART mode + pUSART->US_MR = mode ; + +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_EnableRx +//* \brief Enable receiving characters +//*---------------------------------------------------------------------------- +__inline void AT91F_US_EnableRx ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Enable receiver + pUSART->US_CR = AT91C_US_RXEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_EnableTx +//* \brief Enable sending characters +//*---------------------------------------------------------------------------- +__inline void AT91F_US_EnableTx ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Enable transmitter + pUSART->US_CR = AT91C_US_TXEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_ResetRx +//* \brief Reset Receiver and re-enable it +//*---------------------------------------------------------------------------- +__inline void AT91F_US_ResetRx ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Reset receiver + pUSART->US_CR = AT91C_US_RSTRX; + //* Re-Enable receiver + pUSART->US_CR = AT91C_US_RXEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_ResetTx +//* \brief Reset Transmitter and re-enable it +//*---------------------------------------------------------------------------- +__inline void AT91F_US_ResetTx ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Reset transmitter + pUSART->US_CR = AT91C_US_RSTTX; + //* Enable transmitter + pUSART->US_CR = AT91C_US_TXEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_DisableRx +//* \brief Disable Receiver +//*---------------------------------------------------------------------------- +__inline void AT91F_US_DisableRx ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Disable receiver + pUSART->US_CR = AT91C_US_RXDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_DisableTx +//* \brief Disable Transmitter +//*---------------------------------------------------------------------------- +__inline void AT91F_US_DisableTx ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Disable transmitter + pUSART->US_CR = AT91C_US_TXDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_Close +//* \brief Close USART: disable IT disable receiver and transmitter, close PDC +//*---------------------------------------------------------------------------- +__inline void AT91F_US_Close ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Reset the baud rate divisor register + pUSART->US_BRGR = 0 ; + + //* Reset the USART mode + pUSART->US_MR = 0 ; + + //* Reset the Timeguard Register + pUSART->US_TTGR = 0; + + //* Disable all interrupts + pUSART->US_IDR = 0xFFFFFFFF ; + + //* Abort the Peripheral Data Transfers + AT91F_PDC_Close((AT91PS_PDC) &(pUSART->US_RPR)); + + //* Disable receiver and transmitter and stop any activity immediately + pUSART->US_CR = AT91C_US_TXDIS | AT91C_US_RXDIS | AT91C_US_RSTTX | AT91C_US_RSTRX ; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_TxReady +//* \brief Return 1 if a character can be written in US_THR +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_US_TxReady ( + AT91PS_USART pUSART ) // \arg pointer to a USART controller +{ + return (pUSART->US_CSR & AT91C_US_TXRDY); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_RxReady +//* \brief Return 1 if a character can be read in US_RHR +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_US_RxReady ( + AT91PS_USART pUSART ) // \arg pointer to a USART controller +{ + return (pUSART->US_CSR & AT91C_US_RXRDY); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_Error +//* \brief Return the error flag +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_US_Error ( + AT91PS_USART pUSART ) // \arg pointer to a USART controller +{ + return (pUSART->US_CSR & + (AT91C_US_OVRE | // Overrun error + AT91C_US_FRAME | // Framing error + AT91C_US_PARE)); // Parity error +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_PutChar +//* \brief Send a character,does not check if ready to send +//*---------------------------------------------------------------------------- +__inline void AT91F_US_PutChar ( + AT91PS_USART pUSART, + int character ) +{ + pUSART->US_THR = (character & 0x1FF); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_GetChar +//* \brief Receive a character,does not check if a character is available +//*---------------------------------------------------------------------------- +__inline int AT91F_US_GetChar ( + const AT91PS_USART pUSART) +{ + return((pUSART->US_RHR) & 0x1FF); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_SendFrame +//* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initializaed with Next Buffer, 0 if PDC is busy +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_US_SendFrame( + AT91PS_USART pUSART, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + return AT91F_PDC_SendFrame( + (AT91PS_PDC) &(pUSART->US_RPR), + pBuffer, + szBuffer, + pNextBuffer, + szNextBuffer); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_ReceiveFrame +//* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initializaed with Next Buffer, 0 if PDC is busy +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_US_ReceiveFrame ( + AT91PS_USART pUSART, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + return AT91F_PDC_ReceiveFrame( + (AT91PS_PDC) &(pUSART->US_RPR), + pBuffer, + szBuffer, + pNextBuffer, + szNextBuffer); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_SetIrdaFilter +//* \brief Set the value of IrDa filter tregister +//*---------------------------------------------------------------------------- +__inline void AT91F_US_SetIrdaFilter ( + AT91PS_USART pUSART, + unsigned char value +) +{ + pUSART->US_IF = value; +} + +/* ***************************************************************************** + SOFTWARE API FOR SSC + ***************************************************************************** */ +//* Define the standard I2S mode configuration + +//* Configuration to set in the SSC Transmit Clock Mode Register +//* Parameters : nb_bit_by_slot : 8, 16 or 32 bits +//* nb_slot_by_frame : number of channels +#define AT91C_I2S_ASY_MASTER_TX_SETTING(nb_bit_by_slot, nb_slot_by_frame)( +\ + AT91C_SSC_CKS_DIV +\ + AT91C_SSC_CKO_CONTINOUS +\ + AT91C_SSC_CKG_NONE +\ + AT91C_SSC_START_FALL_RF +\ + AT91C_SSC_STTOUT +\ + ((1<<16) & AT91C_SSC_STTDLY) +\ + ((((nb_bit_by_slot*nb_slot_by_frame)/2)-1) <<24)) + + +//* Configuration to set in the SSC Transmit Frame Mode Register +//* Parameters : nb_bit_by_slot : 8, 16 or 32 bits +//* nb_slot_by_frame : number of channels +#define AT91C_I2S_ASY_TX_FRAME_SETTING(nb_bit_by_slot, nb_slot_by_frame)( +\ + (nb_bit_by_slot-1) +\ + AT91C_SSC_MSBF +\ + (((nb_slot_by_frame-1)<<8) & AT91C_SSC_DATNB) +\ + (((nb_bit_by_slot-1)<<16) & AT91C_SSC_FSLEN) +\ + AT91C_SSC_FSOS_NEGATIVE) + + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_SetBaudrate +//* \brief Set the baudrate according to the CPU clock +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_SetBaudrate ( + AT91PS_SSC pSSC, // \arg pointer to a SSC controller + unsigned int mainClock, // \arg peripheral clock + unsigned int speed) // \arg SSC baudrate +{ + unsigned int baud_value; + //* Define the baud rate divisor register + if (speed == 0) + baud_value = 0; + else + { + baud_value = (unsigned int) (mainClock * 10)/(2*speed); + if ((baud_value % 10) >= 5) + baud_value = (baud_value / 10) + 1; + else + baud_value /= 10; + } + + pSSC->SSC_CMR = baud_value; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_Configure +//* \brief Configure SSC +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_Configure ( + AT91PS_SSC pSSC, // \arg pointer to a SSC controller + unsigned int syst_clock, // \arg System Clock Frequency + unsigned int baud_rate, // \arg Expected Baud Rate Frequency + unsigned int clock_rx, // \arg Receiver Clock Parameters + unsigned int mode_rx, // \arg mode Register to be programmed + unsigned int clock_tx, // \arg Transmitter Clock Parameters + unsigned int mode_tx) // \arg mode Register to be programmed +{ + //* Disable interrupts + pSSC->SSC_IDR = (unsigned int) -1; + + //* Reset receiver and transmitter + pSSC->SSC_CR = AT91C_SSC_SWRST | AT91C_SSC_RXDIS | AT91C_SSC_TXDIS ; + + //* Define the Clock Mode Register + AT91F_SSC_SetBaudrate(pSSC, syst_clock, baud_rate); + + //* Write the Receive Clock Mode Register + pSSC->SSC_RCMR = clock_rx; + + //* Write the Transmit Clock Mode Register + pSSC->SSC_TCMR = clock_tx; + + //* Write the Receive Frame Mode Register + pSSC->SSC_RFMR = mode_rx; + + //* Write the Transmit Frame Mode Register + pSSC->SSC_TFMR = mode_tx; + + //* Clear Transmit and Receive Counters + AT91F_PDC_Open((AT91PS_PDC) &(pSSC->SSC_RPR)); + + +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_EnableRx +//* \brief Enable receiving datas +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_EnableRx ( + AT91PS_SSC pSSC) // \arg pointer to a SSC controller +{ + //* Enable receiver + pSSC->SSC_CR = AT91C_SSC_RXEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_DisableRx +//* \brief Disable receiving datas +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_DisableRx ( + AT91PS_SSC pSSC) // \arg pointer to a SSC controller +{ + //* Disable receiver + pSSC->SSC_CR = AT91C_SSC_RXDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_EnableTx +//* \brief Enable sending datas +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_EnableTx ( + AT91PS_SSC pSSC) // \arg pointer to a SSC controller +{ + //* Enable transmitter + pSSC->SSC_CR = AT91C_SSC_TXEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_DisableTx +//* \brief Disable sending datas +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_DisableTx ( + AT91PS_SSC pSSC) // \arg pointer to a SSC controller +{ + //* Disable transmitter + pSSC->SSC_CR = AT91C_SSC_TXDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_EnableIt +//* \brief Enable SSC IT +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_EnableIt ( + AT91PS_SSC pSSC, // \arg pointer to a SSC controller + unsigned int flag) // \arg IT to be enabled +{ + //* Write to the IER register + pSSC->SSC_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_DisableIt +//* \brief Disable SSC IT +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_DisableIt ( + AT91PS_SSC pSSC, // \arg pointer to a SSC controller + unsigned int flag) // \arg IT to be disabled +{ + //* Write to the IDR register + pSSC->SSC_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_ReceiveFrame +//* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initialized with Next Buffer, 0 if PDC is busy +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_SSC_ReceiveFrame ( + AT91PS_SSC pSSC, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + return AT91F_PDC_ReceiveFrame( + (AT91PS_PDC) &(pSSC->SSC_RPR), + pBuffer, + szBuffer, + pNextBuffer, + szNextBuffer); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_SendFrame +//* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initialized with Next Buffer, 0 if PDC is busy +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_SSC_SendFrame( + AT91PS_SSC pSSC, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + return AT91F_PDC_SendFrame( + (AT91PS_PDC) &(pSSC->SSC_RPR), + pBuffer, + szBuffer, + pNextBuffer, + szNextBuffer); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_GetInterruptMaskStatus +//* \brief Return SSC Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_SSC_GetInterruptMaskStatus( // \return SSC Interrupt Mask Status + AT91PS_SSC pSsc) // \arg pointer to a SSC controller +{ + return pSsc->SSC_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_IsInterruptMasked +//* \brief Test if SSC Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_SSC_IsInterruptMasked( + AT91PS_SSC pSsc, // \arg pointer to a SSC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_SSC_GetInterruptMaskStatus(pSsc) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR TWI + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_EnableIt +//* \brief Enable TWI IT +//*---------------------------------------------------------------------------- +__inline void AT91F_TWI_EnableIt ( + AT91PS_TWI pTWI, // \arg pointer to a TWI controller + unsigned int flag) // \arg IT to be enabled +{ + //* Write to the IER register + pTWI->TWI_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_DisableIt +//* \brief Disable TWI IT +//*---------------------------------------------------------------------------- +__inline void AT91F_TWI_DisableIt ( + AT91PS_TWI pTWI, // \arg pointer to a TWI controller + unsigned int flag) // \arg IT to be disabled +{ + //* Write to the IDR register + pTWI->TWI_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_Configure +//* \brief Configure TWI in master mode +//*---------------------------------------------------------------------------- +__inline void AT91F_TWI_Configure ( AT91PS_TWI pTWI ) // \arg pointer to a TWI controller +{ + //* Disable interrupts + pTWI->TWI_IDR = (unsigned int) -1; + + //* Reset peripheral + pTWI->TWI_CR = AT91C_TWI_SWRST; + + //* Set Master mode + pTWI->TWI_CR = AT91C_TWI_MSEN; + +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_GetInterruptMaskStatus +//* \brief Return TWI Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_TWI_GetInterruptMaskStatus( // \return TWI Interrupt Mask Status + AT91PS_TWI pTwi) // \arg pointer to a TWI controller +{ + return pTwi->TWI_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_IsInterruptMasked +//* \brief Test if TWI Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_TWI_IsInterruptMasked( + AT91PS_TWI pTwi, // \arg pointer to a TWI controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_TWI_GetInterruptMaskStatus(pTwi) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR PWMC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_GetStatus +//* \brief Return PWM Interrupt Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PWMC_GetStatus( // \return PWM Interrupt Status + AT91PS_PWMC pPWM) // pointer to a PWM controller +{ + return pPWM->PWMC_SR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_InterruptEnable +//* \brief Enable PWM Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_InterruptEnable( + AT91PS_PWMC pPwm, // \arg pointer to a PWM controller + unsigned int flag) // \arg PWM interrupt to be enabled +{ + pPwm->PWMC_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_InterruptDisable +//* \brief Disable PWM Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_InterruptDisable( + AT91PS_PWMC pPwm, // \arg pointer to a PWM controller + unsigned int flag) // \arg PWM interrupt to be disabled +{ + pPwm->PWMC_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_GetInterruptMaskStatus +//* \brief Return PWM Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PWMC_GetInterruptMaskStatus( // \return PWM Interrupt Mask Status + AT91PS_PWMC pPwm) // \arg pointer to a PWM controller +{ + return pPwm->PWMC_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_IsInterruptMasked +//* \brief Test if PWM Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PWMC_IsInterruptMasked( + AT91PS_PWMC pPWM, // \arg pointer to a PWM controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PWMC_GetInterruptMaskStatus(pPWM) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_IsStatusSet +//* \brief Test if PWM Interrupt is Set +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PWMC_IsStatusSet( + AT91PS_PWMC pPWM, // \arg pointer to a PWM controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PWMC_GetStatus(pPWM) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_CfgChannel +//* \brief Test if PWM Interrupt is Set +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_CfgChannel( + AT91PS_PWMC pPWM, // \arg pointer to a PWM controller + unsigned int channelId, // \arg PWM channel ID + unsigned int mode, // \arg PWM mode + unsigned int period, // \arg PWM period + unsigned int duty) // \arg PWM duty cycle +{ + pPWM->PWMC_CH[channelId].PWMC_CMR = mode; + pPWM->PWMC_CH[channelId].PWMC_CDTYR = duty; + pPWM->PWMC_CH[channelId].PWMC_CPRDR = period; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_StartChannel +//* \brief Enable channel +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_StartChannel( + AT91PS_PWMC pPWM, // \arg pointer to a PWM controller + unsigned int flag) // \arg Channels IDs to be enabled +{ + pPWM->PWMC_ENA = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_StopChannel +//* \brief Disable channel +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_StopChannel( + AT91PS_PWMC pPWM, // \arg pointer to a PWM controller + unsigned int flag) // \arg Channels IDs to be enabled +{ + pPWM->PWMC_DIS = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_UpdateChannel +//* \brief Update Period or Duty Cycle +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_UpdateChannel( + AT91PS_PWMC pPWM, // \arg pointer to a PWM controller + unsigned int channelId, // \arg PWM channel ID + unsigned int update) // \arg Channels IDs to be enabled +{ + pPWM->PWMC_CH[channelId].PWMC_CUPDR = update; +} + +/* ***************************************************************************** + SOFTWARE API FOR UDP + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EnableIt +//* \brief Enable UDP IT +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EnableIt ( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned int flag) // \arg IT to be enabled +{ + //* Write to the IER register + pUDP->UDP_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_DisableIt +//* \brief Disable UDP IT +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_DisableIt ( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned int flag) // \arg IT to be disabled +{ + //* Write to the IDR register + pUDP->UDP_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_SetAddress +//* \brief Set UDP functional address +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_SetAddress ( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char address) // \arg new UDP address +{ + pUDP->UDP_FADDR = (AT91C_UDP_FEN | address); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EnableEp +//* \brief Enable Endpoint +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EnableEp ( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint) // \arg endpoint number +{ + pUDP->UDP_CSR[endpoint] |= AT91C_UDP_EPEDS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_DisableEp +//* \brief Enable Endpoint +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_DisableEp ( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint) // \arg endpoint number +{ + pUDP->UDP_CSR[endpoint] &= ~AT91C_UDP_EPEDS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_SetState +//* \brief Set UDP Device state +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_SetState ( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned int flag) // \arg new UDP address +{ + pUDP->UDP_GLBSTATE &= ~(AT91C_UDP_FADDEN | AT91C_UDP_CONFG); + pUDP->UDP_GLBSTATE |= flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_GetState +//* \brief return UDP Device state +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_UDP_GetState ( // \return the UDP device state + AT91PS_UDP pUDP) // \arg pointer to a UDP controller +{ + return (pUDP->UDP_GLBSTATE & (AT91C_UDP_FADDEN | AT91C_UDP_CONFG)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_ResetEp +//* \brief Reset UDP endpoint +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_ResetEp ( // \return the UDP device state + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned int flag) // \arg Endpoints to be reset +{ + pUDP->UDP_RSTEP = flag; + pUDP->UDP_RSTEP = 0; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpStall +//* \brief Endpoint will STALL requests +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EpStall( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint) // \arg endpoint number +{ + pUDP->UDP_CSR[endpoint] |= AT91C_UDP_FORCESTALL; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpWrite +//* \brief Write value in the DPR +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EpWrite( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint, // \arg endpoint number + unsigned char value) // \arg value to be written in the DPR +{ + pUDP->UDP_FDR[endpoint] = value; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpRead +//* \brief Return value from the DPR +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_UDP_EpRead( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint) // \arg endpoint number +{ + return pUDP->UDP_FDR[endpoint]; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpEndOfWr +//* \brief Notify the UDP that values in DPR are ready to be sent +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EpEndOfWr( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint) // \arg endpoint number +{ + pUDP->UDP_CSR[endpoint] |= AT91C_UDP_TXPKTRDY; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpClear +//* \brief Clear flag in the endpoint CSR register +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EpClear( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint, // \arg endpoint number + unsigned int flag) // \arg flag to be cleared +{ + pUDP->UDP_CSR[endpoint] &= ~(flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpSet +//* \brief Set flag in the endpoint CSR register +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EpSet( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint, // \arg endpoint number + unsigned int flag) // \arg flag to be cleared +{ + pUDP->UDP_CSR[endpoint] |= flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpStatus +//* \brief Return the endpoint CSR register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_UDP_EpStatus( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint) // \arg endpoint number +{ + return pUDP->UDP_CSR[endpoint]; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_GetInterruptMaskStatus +//* \brief Return UDP Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_UDP_GetInterruptMaskStatus( + AT91PS_UDP pUdp) // \arg pointer to a UDP controller +{ + return pUdp->UDP_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_IsInterruptMasked +//* \brief Test if UDP Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_UDP_IsInterruptMasked( + AT91PS_UDP pUdp, // \arg pointer to a UDP controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_UDP_GetInterruptMaskStatus(pUdp) & flag); +} + +// ---------------------------------------------------------------------------- +// \fn AT91F_UDP_InterruptStatusRegister +// \brief Return the Interrupt Status Register +// ---------------------------------------------------------------------------- +__inline unsigned int AT91F_UDP_InterruptStatusRegister( + AT91PS_UDP pUDP ) // \arg pointer to a UDP controller +{ + return pUDP->UDP_ISR; +} + +// ---------------------------------------------------------------------------- +// \fn AT91F_UDP_InterruptClearRegister +// \brief Clear Interrupt Register +// ---------------------------------------------------------------------------- +__inline void AT91F_UDP_InterruptClearRegister ( + AT91PS_UDP pUDP, // \arg pointer to UDP controller + unsigned int flag) // \arg IT to be cleat +{ + pUDP->UDP_ICR = flag; +} + +// ---------------------------------------------------------------------------- +// \fn AT91F_UDP_EnableTransceiver +// \brief Enable transceiver +// ---------------------------------------------------------------------------- +__inline void AT91F_UDP_EnableTransceiver( + AT91PS_UDP pUDP ) // \arg pointer to a UDP controller +{ + pUDP->UDP_TXVC &= ~AT91C_UDP_TXVDIS; +} + +// ---------------------------------------------------------------------------- +// \fn AT91F_UDP_DisableTransceiver +// \brief Disable transceiver +// ---------------------------------------------------------------------------- +__inline void AT91F_UDP_DisableTransceiver( + AT91PS_UDP pUDP ) // \arg pointer to a UDP controller +{ + pUDP->UDP_TXVC = AT91C_UDP_TXVDIS; +} + +/* ***************************************************************************** + SOFTWARE API FOR TC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC_InterruptEnable +//* \brief Enable TC Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_TC_InterruptEnable( + AT91PS_TC pTc, // \arg pointer to a TC controller + unsigned int flag) // \arg TC interrupt to be enabled +{ + pTc->TC_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC_InterruptDisable +//* \brief Disable TC Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_TC_InterruptDisable( + AT91PS_TC pTc, // \arg pointer to a TC controller + unsigned int flag) // \arg TC interrupt to be disabled +{ + pTc->TC_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC_GetInterruptMaskStatus +//* \brief Return TC Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_TC_GetInterruptMaskStatus( // \return TC Interrupt Mask Status + AT91PS_TC pTc) // \arg pointer to a TC controller +{ + return pTc->TC_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC_IsInterruptMasked +//* \brief Test if TC Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_TC_IsInterruptMasked( + AT91PS_TC pTc, // \arg pointer to a TC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_TC_GetInterruptMaskStatus(pTc) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR CAN + ***************************************************************************** */ +#define STANDARD_FORMAT 0 +#define EXTENDED_FORMAT 1 + +//*---------------------------------------------------------------------------- +//* \fn AT91F_InitMailboxRegisters() +//* \brief Configure the corresponding mailbox +//*---------------------------------------------------------------------------- +__inline void AT91F_InitMailboxRegisters(AT91PS_CAN_MB CAN_Mailbox, + int mode_reg, + int acceptance_mask_reg, + int id_reg, + int data_low_reg, + int data_high_reg, + int control_reg) +{ + CAN_Mailbox->CAN_MB_MCR = 0x0; + CAN_Mailbox->CAN_MB_MMR = mode_reg; + CAN_Mailbox->CAN_MB_MAM = acceptance_mask_reg; + CAN_Mailbox->CAN_MB_MID = id_reg; + CAN_Mailbox->CAN_MB_MDL = data_low_reg; + CAN_Mailbox->CAN_MB_MDH = data_high_reg; + CAN_Mailbox->CAN_MB_MCR = control_reg; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_EnableCAN() +//* \brief +//*---------------------------------------------------------------------------- +__inline void AT91F_EnableCAN( + AT91PS_CAN pCAN) // pointer to a CAN controller +{ + pCAN->CAN_MR |= AT91C_CAN_CANEN; + + // Wait for WAKEUP flag raising <=> 11-recessive-bit were scanned by the transceiver + while( (pCAN->CAN_SR & AT91C_CAN_WAKEUP) != AT91C_CAN_WAKEUP ); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_DisableCAN() +//* \brief +//*---------------------------------------------------------------------------- +__inline void AT91F_DisableCAN( + AT91PS_CAN pCAN) // pointer to a CAN controller +{ + pCAN->CAN_MR &= ~AT91C_CAN_CANEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_EnableIt +//* \brief Enable CAN interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_EnableIt ( + AT91PS_CAN pCAN, // pointer to a CAN controller + unsigned int flag) // IT to be enabled +{ + //* Write to the IER register + pCAN->CAN_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_DisableIt +//* \brief Disable CAN interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_DisableIt ( + AT91PS_CAN pCAN, // pointer to a CAN controller + unsigned int flag) // IT to be disabled +{ + //* Write to the IDR register + pCAN->CAN_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetStatus +//* \brief Return CAN Interrupt Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetStatus( // \return CAN Interrupt Status + AT91PS_CAN pCAN) // pointer to a CAN controller +{ + return pCAN->CAN_SR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetInterruptMaskStatus +//* \brief Return CAN Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetInterruptMaskStatus( // \return CAN Interrupt Mask Status + AT91PS_CAN pCAN) // pointer to a CAN controller +{ + return pCAN->CAN_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_IsInterruptMasked +//* \brief Test if CAN Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_IsInterruptMasked( + AT91PS_CAN pCAN, // \arg pointer to a CAN controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_CAN_GetInterruptMaskStatus(pCAN) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_IsStatusSet +//* \brief Test if CAN Interrupt is Set +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_IsStatusSet( + AT91PS_CAN pCAN, // \arg pointer to a CAN controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_CAN_GetStatus(pCAN) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgModeReg +//* \brief Configure the Mode Register of the CAN controller +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgModeReg ( + AT91PS_CAN pCAN, // pointer to a CAN controller + unsigned int mode) // mode register +{ + //* Write to the MR register + pCAN->CAN_MR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetModeReg +//* \brief Return the Mode Register of the CAN controller value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetModeReg ( + AT91PS_CAN pCAN // pointer to a CAN controller + ) +{ + return pCAN->CAN_MR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgBaudrateReg +//* \brief Configure the Baudrate of the CAN controller for the network +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgBaudrateReg ( + AT91PS_CAN pCAN, // pointer to a CAN controller + unsigned int baudrate_cfg) +{ + //* Write to the BR register + pCAN->CAN_BR = baudrate_cfg; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetBaudrate +//* \brief Return the Baudrate of the CAN controller for the network value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetBaudrate ( + AT91PS_CAN pCAN // pointer to a CAN controller + ) +{ + return pCAN->CAN_BR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetInternalCounter +//* \brief Return CAN Timer Regsiter Value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetInternalCounter ( + AT91PS_CAN pCAN // pointer to a CAN controller + ) +{ + return pCAN->CAN_TIM; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetTimestamp +//* \brief Return CAN Timestamp Register Value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetTimestamp ( + AT91PS_CAN pCAN // pointer to a CAN controller + ) +{ + return pCAN->CAN_TIMESTP; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetErrorCounter +//* \brief Return CAN Error Counter Register Value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetErrorCounter ( + AT91PS_CAN pCAN // pointer to a CAN controller + ) +{ + return pCAN->CAN_ECR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_InitTransferRequest +//* \brief Request for a transfer on the corresponding mailboxes +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_InitTransferRequest ( + AT91PS_CAN pCAN, // pointer to a CAN controller + unsigned int transfer_cmd) +{ + pCAN->CAN_TCR = transfer_cmd; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_InitAbortRequest +//* \brief Abort the corresponding mailboxes +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_InitAbortRequest ( + AT91PS_CAN pCAN, // pointer to a CAN controller + unsigned int abort_cmd) +{ + pCAN->CAN_ACR = abort_cmd; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgMessageModeReg +//* \brief Program the Message Mode Register +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgMessageModeReg ( + AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox + unsigned int mode) +{ + CAN_Mailbox->CAN_MB_MMR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetMessageModeReg +//* \brief Return the Message Mode Register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetMessageModeReg ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgMessageIDReg +//* \brief Program the Message ID Register +//* \brief Version == 0 for Standard messsage, Version == 1 for Extended +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgMessageIDReg ( + AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox + unsigned int id, + unsigned char version) +{ + if(version==0) // IDvA Standard Format + CAN_Mailbox->CAN_MB_MID = id<<18; + else // IDvB Extended Format + CAN_Mailbox->CAN_MB_MID = id | (1<<29); // set MIDE bit +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetMessageIDReg +//* \brief Return the Message ID Register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetMessageIDReg ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MID; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgMessageAcceptanceMaskReg +//* \brief Program the Message Acceptance Mask Register +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgMessageAcceptanceMaskReg ( + AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox + unsigned int mask) +{ + CAN_Mailbox->CAN_MB_MAM = mask; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetMessageAcceptanceMaskReg +//* \brief Return the Message Acceptance Mask Register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetMessageAcceptanceMaskReg ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MAM; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetFamilyID +//* \brief Return the Message ID Register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetFamilyID ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MFID; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgMessageCtrl +//* \brief Request and config for a transfer on the corresponding mailbox +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgMessageCtrlReg ( + AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox + unsigned int message_ctrl_cmd) +{ + CAN_Mailbox->CAN_MB_MCR = message_ctrl_cmd; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetMessageStatus +//* \brief Return CAN Mailbox Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetMessageStatus ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgMessageDataLow +//* \brief Program data low value +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgMessageDataLow ( + AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox + unsigned int data) +{ + CAN_Mailbox->CAN_MB_MDL = data; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetMessageDataLow +//* \brief Return data low value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetMessageDataLow ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MDL; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgMessageDataHigh +//* \brief Program data high value +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgMessageDataHigh ( + AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox + unsigned int data) +{ + CAN_Mailbox->CAN_MB_MDH = data; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetMessageDataHigh +//* \brief Return data high value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetMessageDataHigh ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MDH; +} + +/* ***************************************************************************** + SOFTWARE API FOR ADC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_EnableIt +//* \brief Enable ADC interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_EnableIt ( + AT91PS_ADC pADC, // pointer to a ADC controller + unsigned int flag) // IT to be enabled +{ + //* Write to the IER register + pADC->ADC_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_DisableIt +//* \brief Disable ADC interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_DisableIt ( + AT91PS_ADC pADC, // pointer to a ADC controller + unsigned int flag) // IT to be disabled +{ + //* Write to the IDR register + pADC->ADC_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetStatus +//* \brief Return ADC Interrupt Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetStatus( // \return ADC Interrupt Status + AT91PS_ADC pADC) // pointer to a ADC controller +{ + return pADC->ADC_SR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetInterruptMaskStatus +//* \brief Return ADC Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetInterruptMaskStatus( // \return ADC Interrupt Mask Status + AT91PS_ADC pADC) // pointer to a ADC controller +{ + return pADC->ADC_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_IsInterruptMasked +//* \brief Test if ADC Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_IsInterruptMasked( + AT91PS_ADC pADC, // \arg pointer to a ADC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_ADC_GetInterruptMaskStatus(pADC) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_IsStatusSet +//* \brief Test if ADC Status is Set +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_IsStatusSet( + AT91PS_ADC pADC, // \arg pointer to a ADC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_ADC_GetStatus(pADC) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_CfgModeReg +//* \brief Configure the Mode Register of the ADC controller +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_CfgModeReg ( + AT91PS_ADC pADC, // pointer to a ADC controller + unsigned int mode) // mode register +{ + //* Write to the MR register + pADC->ADC_MR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetModeReg +//* \brief Return the Mode Register of the ADC controller value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetModeReg ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_MR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_CfgTimings +//* \brief Configure the different necessary timings of the ADC controller +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_CfgTimings ( + AT91PS_ADC pADC, // pointer to a ADC controller + unsigned int mck_clock, // in MHz + unsigned int adc_clock, // in MHz + unsigned int startup_time, // in us + unsigned int sample_and_hold_time) // in ns +{ + unsigned int prescal,startup,shtim; + + prescal = mck_clock/(2*adc_clock) - 1; + startup = adc_clock*startup_time/8 - 1; + shtim = adc_clock*sample_and_hold_time/1000 - 1; + + //* Write to the MR register + pADC->ADC_MR = ( (prescal<<8) & AT91C_ADC_PRESCAL) | ( (startup<<16) & AT91C_ADC_STARTUP) | ( (shtim<<24) & AT91C_ADC_SHTIM); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_EnableChannel +//* \brief Return ADC Timer Register Value +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_EnableChannel ( + AT91PS_ADC pADC, // pointer to a ADC controller + unsigned int channel) // mode register +{ + //* Write to the CHER register + pADC->ADC_CHER = channel; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_DisableChannel +//* \brief Return ADC Timer Register Value +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_DisableChannel ( + AT91PS_ADC pADC, // pointer to a ADC controller + unsigned int channel) // mode register +{ + //* Write to the CHDR register + pADC->ADC_CHDR = channel; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetChannelStatus +//* \brief Return ADC Timer Register Value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetChannelStatus ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CHSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_StartConversion +//* \brief Software request for a analog to digital conversion +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_StartConversion ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + pADC->ADC_CR = AT91C_ADC_START; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_SoftReset +//* \brief Software reset +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_SoftReset ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + pADC->ADC_CR = AT91C_ADC_SWRST; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetLastConvertedData +//* \brief Return the Last Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetLastConvertedData ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_LCDR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH0 +//* \brief Return the Channel 0 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH0 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR0; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH1 +//* \brief Return the Channel 1 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH1 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR1; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH2 +//* \brief Return the Channel 2 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH2 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR2; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH3 +//* \brief Return the Channel 3 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH3 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR3; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH4 +//* \brief Return the Channel 4 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH4 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR4; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH5 +//* \brief Return the Channel 5 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH5 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR5; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH6 +//* \brief Return the Channel 6 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH6 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR6; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH7 +//* \brief Return the Channel 7 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH7 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR7; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_DBGU_CfgPMC +//* \brief Enable Peripheral clock in PMC for DBGU +//*---------------------------------------------------------------------------- +__inline void AT91F_DBGU_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_DBGU_CfgPIO +//* \brief Configure PIO controllers to drive DBGU signals +//*---------------------------------------------------------------------------- +__inline void AT91F_DBGU_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA27_DRXD ) | + ((unsigned int) AT91C_PA28_DTXD ), // Peripheral A + 0); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_CfgPMC +//* \brief Enable Peripheral clock in PMC for PMC +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_CfgPIO +//* \brief Configure PIO controllers to drive PMC signals +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB30_PCK2 ) | + ((unsigned int) AT91C_PB29_PCK1 ), // Peripheral A + ((unsigned int) AT91C_PB20_PCK0 ) | + ((unsigned int) AT91C_PB0_PCK0 ) | + ((unsigned int) AT91C_PB22_PCK2 ) | + ((unsigned int) AT91C_PB21_PCK1 )); // Peripheral B + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PA30_PCK2 ) | + ((unsigned int) AT91C_PA13_PCK1 ) | + ((unsigned int) AT91C_PA27_PCK3 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_VREG_CfgPMC +//* \brief Enable Peripheral clock in PMC for VREG +//*---------------------------------------------------------------------------- +__inline void AT91F_VREG_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_RSTC_CfgPMC +//* \brief Enable Peripheral clock in PMC for RSTC +//*---------------------------------------------------------------------------- +__inline void AT91F_RSTC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_CfgPMC +//* \brief Enable Peripheral clock in PMC for SSC +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SSC)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_CfgPIO +//* \brief Configure PIO controllers to drive SSC signals +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA25_RK ) | + ((unsigned int) AT91C_PA22_TK ) | + ((unsigned int) AT91C_PA21_TF ) | + ((unsigned int) AT91C_PA24_RD ) | + ((unsigned int) AT91C_PA26_RF ) | + ((unsigned int) AT91C_PA23_TD ), // Peripheral A + 0); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_WDTC_CfgPMC +//* \brief Enable Peripheral clock in PMC for WDTC +//*---------------------------------------------------------------------------- +__inline void AT91F_WDTC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US1_CfgPMC +//* \brief Enable Peripheral clock in PMC for US1 +//*---------------------------------------------------------------------------- +__inline void AT91F_US1_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_US1)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US1_CfgPIO +//* \brief Configure PIO controllers to drive US1 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_US1_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PB26_RI1 ) | + ((unsigned int) AT91C_PB24_DSR1 ) | + ((unsigned int) AT91C_PB23_DCD1 ) | + ((unsigned int) AT91C_PB25_DTR1 )); // Peripheral B + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA7_SCK1 ) | + ((unsigned int) AT91C_PA8_RTS1 ) | + ((unsigned int) AT91C_PA6_TXD1 ) | + ((unsigned int) AT91C_PA5_RXD1 ) | + ((unsigned int) AT91C_PA9_CTS1 ), // Peripheral A + 0); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US0_CfgPMC +//* \brief Enable Peripheral clock in PMC for US0 +//*---------------------------------------------------------------------------- +__inline void AT91F_US0_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_US0)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US0_CfgPIO +//* \brief Configure PIO controllers to drive US0 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_US0_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA0_RXD0 ) | + ((unsigned int) AT91C_PA4_CTS0 ) | + ((unsigned int) AT91C_PA3_RTS0 ) | + ((unsigned int) AT91C_PA2_SCK0 ) | + ((unsigned int) AT91C_PA1_TXD0 ), // Peripheral A + 0); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI1_CfgPMC +//* \brief Enable Peripheral clock in PMC for SPI1 +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI1_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SPI1)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI1_CfgPIO +//* \brief Configure PIO controllers to drive SPI1 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI1_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PB11_SPI1_NPCS2) | + ((unsigned int) AT91C_PB10_SPI1_NPCS1) | + ((unsigned int) AT91C_PB16_SPI1_NPCS3)); // Peripheral B + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PA22_SPI1_SPCK) | + ((unsigned int) AT91C_PA3_SPI1_NPCS2) | + ((unsigned int) AT91C_PA26_SPI1_NPCS2) | + ((unsigned int) AT91C_PA25_SPI1_NPCS1) | + ((unsigned int) AT91C_PA2_SPI1_NPCS1) | + ((unsigned int) AT91C_PA24_SPI1_MISO) | + ((unsigned int) AT91C_PA4_SPI1_NPCS3) | + ((unsigned int) AT91C_PA29_SPI1_NPCS3) | + ((unsigned int) AT91C_PA21_SPI1_NPCS0) | + ((unsigned int) AT91C_PA23_SPI1_MOSI)); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI0_CfgPMC +//* \brief Enable Peripheral clock in PMC for SPI0 +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI0_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SPI0)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI0_CfgPIO +//* \brief Configure PIO controllers to drive SPI0 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI0_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PB13_SPI0_NPCS1) | + ((unsigned int) AT91C_PB14_SPI0_NPCS2) | + ((unsigned int) AT91C_PB17_SPI0_NPCS3)); // Peripheral B + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA16_SPI0_MISO) | + ((unsigned int) AT91C_PA13_SPI0_NPCS1) | + ((unsigned int) AT91C_PA14_SPI0_NPCS2) | + ((unsigned int) AT91C_PA12_SPI0_NPCS0) | + ((unsigned int) AT91C_PA17_SPI0_MOSI) | + ((unsigned int) AT91C_PA15_SPI0_NPCS3) | + ((unsigned int) AT91C_PA18_SPI0_SPCK), // Peripheral A + ((unsigned int) AT91C_PA7_SPI0_NPCS1) | + ((unsigned int) AT91C_PA8_SPI0_NPCS2) | + ((unsigned int) AT91C_PA9_SPI0_NPCS3)); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITC_CfgPMC +//* \brief Enable Peripheral clock in PMC for PITC +//*---------------------------------------------------------------------------- +__inline void AT91F_PITC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_CfgPMC +//* \brief Enable Peripheral clock in PMC for AIC +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_FIQ) | + ((unsigned int) 1 << AT91C_ID_IRQ0) | + ((unsigned int) 1 << AT91C_ID_IRQ1)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_CfgPIO +//* \brief Configure PIO controllers to drive AIC signals +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA30_IRQ0 ) | + ((unsigned int) AT91C_PA29_FIQ ), // Peripheral A + ((unsigned int) AT91C_PA14_IRQ1 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_CfgPMC +//* \brief Enable Peripheral clock in PMC for TWI +//*---------------------------------------------------------------------------- +__inline void AT91F_TWI_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_TWI)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_CfgPIO +//* \brief Configure PIO controllers to drive TWI signals +//*---------------------------------------------------------------------------- +__inline void AT91F_TWI_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA11_TWCK ) | + ((unsigned int) AT91C_PA10_TWD ), // Peripheral A + 0); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_CfgPMC +//* \brief Enable Peripheral clock in PMC for ADC +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_ADC)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_CfgPIO +//* \brief Configure PIO controllers to drive ADC signals +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PB18_ADTRG )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWMC_CH3_CfgPIO +//* \brief Configure PIO controllers to drive PWMC_CH3 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_CH3_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB22_PWM3 ), // Peripheral A + ((unsigned int) AT91C_PB30_PWM3 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWMC_CH2_CfgPIO +//* \brief Configure PIO controllers to drive PWMC_CH2 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_CH2_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB21_PWM2 ), // Peripheral A + ((unsigned int) AT91C_PB29_PWM2 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWMC_CH1_CfgPIO +//* \brief Configure PIO controllers to drive PWMC_CH1 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_CH1_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB20_PWM1 ), // Peripheral A + ((unsigned int) AT91C_PB28_PWM1 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWMC_CH0_CfgPIO +//* \brief Configure PIO controllers to drive PWMC_CH0 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_CH0_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB19_PWM0 ), // Peripheral A + ((unsigned int) AT91C_PB27_PWM0 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_RTTC_CfgPMC +//* \brief Enable Peripheral clock in PMC for RTTC +//*---------------------------------------------------------------------------- +__inline void AT91F_RTTC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_CfgPMC +//* \brief Enable Peripheral clock in PMC for UDP +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_UDP)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_EMAC_CfgPMC +//* \brief Enable Peripheral clock in PMC for EMAC +//*---------------------------------------------------------------------------- +__inline void AT91F_EMAC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_EMAC)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_EMAC_CfgPIO +//* \brief Configure PIO controllers to drive EMAC signals +//*---------------------------------------------------------------------------- +__inline void AT91F_EMAC_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB2_ETX0 ) | + ((unsigned int) AT91C_PB12_ETXER ) | + ((unsigned int) AT91C_PB16_ECOL ) | + ((unsigned int) AT91C_PB15_ERXDV_ECRSDV) | + ((unsigned int) AT91C_PB11_ETX3 ) | + ((unsigned int) AT91C_PB6_ERX1 ) | + ((unsigned int) AT91C_PB13_ERX2 ) | + ((unsigned int) AT91C_PB3_ETX1 ) | + ((unsigned int) AT91C_PB4_ECRS ) | + ((unsigned int) AT91C_PB8_EMDC ) | + ((unsigned int) AT91C_PB5_ERX0 ) | + ((unsigned int) AT91C_PB18_EF100 ) | + ((unsigned int) AT91C_PB14_ERX3 ) | + ((unsigned int) AT91C_PB1_ETXEN ) | + ((unsigned int) AT91C_PB10_ETX2 ) | + ((unsigned int) AT91C_PB0_ETXCK_EREFCK) | + ((unsigned int) AT91C_PB9_EMDIO ) | + ((unsigned int) AT91C_PB7_ERXER ) | + ((unsigned int) AT91C_PB17_ERXCK ), // Peripheral A + 0); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC0_CfgPMC +//* \brief Enable Peripheral clock in PMC for TC0 +//*---------------------------------------------------------------------------- +__inline void AT91F_TC0_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_TC0)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC0_CfgPIO +//* \brief Configure PIO controllers to drive TC0 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_TC0_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB23_TIOA0 ) | + ((unsigned int) AT91C_PB24_TIOB0 ), // Peripheral A + ((unsigned int) AT91C_PB12_TCLK0 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC1_CfgPMC +//* \brief Enable Peripheral clock in PMC for TC1 +//*---------------------------------------------------------------------------- +__inline void AT91F_TC1_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_TC1)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC1_CfgPIO +//* \brief Configure PIO controllers to drive TC1 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_TC1_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB25_TIOA1 ) | + ((unsigned int) AT91C_PB26_TIOB1 ), // Peripheral A + ((unsigned int) AT91C_PB19_TCLK1 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC2_CfgPMC +//* \brief Enable Peripheral clock in PMC for TC2 +//*---------------------------------------------------------------------------- +__inline void AT91F_TC2_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_TC2)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC2_CfgPIO +//* \brief Configure PIO controllers to drive TC2 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_TC2_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB28_TIOB2 ) | + ((unsigned int) AT91C_PB27_TIOA2 ), // Peripheral A + 0); // Peripheral B + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PA15_TCLK2 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_CfgPMC +//* \brief Enable Peripheral clock in PMC for MC +//*---------------------------------------------------------------------------- +__inline void AT91F_MC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIOA_CfgPMC +//* \brief Enable Peripheral clock in PMC for PIOA +//*---------------------------------------------------------------------------- +__inline void AT91F_PIOA_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_PIOA)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIOB_CfgPMC +//* \brief Enable Peripheral clock in PMC for PIOB +//*---------------------------------------------------------------------------- +__inline void AT91F_PIOB_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_PIOB)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgPMC +//* \brief Enable Peripheral clock in PMC for CAN +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_CAN)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgPIO +//* \brief Configure PIO controllers to drive CAN signals +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA20_CANTX ) | + ((unsigned int) AT91C_PA19_CANRX ), // Peripheral A + 0); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWMC_CfgPMC +//* \brief Enable Peripheral clock in PMC for PWMC +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_PWMC)); +} + +#endif // lib_AT91SAM7X256_H diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/settings/cmock_demo.cspy.bat b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/settings/cmock_demo.cspy.bat new file mode 100644 index 0000000..46433e0 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/settings/cmock_demo.cspy.bat @@ -0,0 +1,32 @@ +@REM This bat file has been generated by the IAR Embeddded Workbench +@REM C-SPY interactive debugger,as an aid to preparing a command +@REM line for running the cspybat command line utility with the +@REM appropriate settings. +@REM +@REM After making some adjustments to this file, you can launch cspybat +@REM by typing the name of this file followed by the name of the debug +@REM file (usually an ubrof file). Note that this file is generated +@REM every time a new debug session is initialized, so you may want to +@REM move or rename the file before making changes. +@REM +@REM Note: some command line arguments cannot be properly generated +@REM by this process. Specifically, the plugin which is responsible +@REM for the Terminal I/O window (and other C runtime functionality) +@REM comes in a special version for cspybat, and the name of that +@REM plugin dll is not known when generating this file. It resides in +@REM the $TOOLKIT_DIR$\bin folder and is usually called XXXbat.dll or +@REM XXXlibsupportbat.dll, where XXX is the name of the corresponding +@REM tool chain. Replace the '' parameter +@REM below with the appropriate file name. Other plugins loaded by +@REM C-SPY are usually not needed by, or will not work in, cspybat +@REM but they are listed at the end of this file for reference. + + +"C:\Program Files\IAR Systems\Embedded Workbench 4.0\common\bin\cspybat" "C:\Program Files\IAR Systems\Embedded Workbench 4.0\ARM\bin\armproc.dll" "C:\Program Files\IAR Systems\Embedded Workbench 4.0\ARM\bin\armjlink.dll" %1 --plugin "C:\Program Files\IAR Systems\Embedded Workbench 4.0\ARM\bin\" --macro "C:\svn\cmock\iar\iar_v4\Resource\SAM7_FLASH.mac" --backend -B "--endian" "little" "--cpu" "ARM7TDMI" "--fpu" "None" "--proc_device_desc_file" "C:\Program Files\IAR Systems\Embedded Workbench 4.0\ARM\CONFIG\ioAT91SAM7X256.ddf" "--drv_verify_download" "all" "--proc_driver" "jlink" "--jlink_connection" "USB:0" "--jlink_initial_speed" "32" + + +@REM loaded plugins: +@REM armlibsupport.dll +@REM C:\Program Files\IAR Systems\Embedded Workbench 4.0\common\plugins\CodeCoverage\CodeCoverage.dll +@REM C:\Program Files\IAR Systems\Embedded Workbench 4.0\common\plugins\Profiling\Profiling.dll +@REM C:\Program Files\IAR Systems\Embedded Workbench 4.0\common\plugins\stack\stack.dll diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/settings/cmock_demo.dbgdt b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/settings/cmock_demo.dbgdt new file mode 100644 index 0000000..5e79c26 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/settings/cmock_demo.dbgdt @@ -0,0 +1,86 @@ + + + + + + + + + + + + + 185272727 + + + + + + 100 + + 20 + 1115 + 297 + 74 + + 110$PROJ_DIR$\TermIOInput.txt10 + + + + + + + + TabID-23656-3537 + Debug Log + Debug-Log + + + + TabID-22088-3567 + Build + Build + + + TabID-16970-5692Terminal I/OTerminalIO + + 0 + + + TabID-1637-3541 + Workspace + Workspace + + + cmock_democmock_demo/source + + + + 0 + + + TabID-12385-3544 + Disassembly + Disassembly + + + + + 0 + + + + + + TextEditorC:\svn\cmock\examples\src\Main.c02780680600100000010000001 + + + + + + + iaridepm1debuggergui1-2-2509276-2-2179148129149173302200577598361-2-2509177-2-2179148129149173302129149598361-2-22771388-2-213902791002886326698129149173302 + + + + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/settings/cmock_demo.dni b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/settings/cmock_demo.dni new file mode 100644 index 0000000..b187569 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/settings/cmock_demo.dni @@ -0,0 +1,42 @@ +[JLinkDriver] +WatchCond=_ 0 +Watch0=_ 0 "" 0 "" 0 "" 0 "" 0 0 0 0 +Watch1=_ 0 "" 0 "" 0 "" 0 "" 0 0 0 0 +[DisAssemblyWindow] +NumStates=_ 1 +State 1=_ 1 +[StackPlugin] +Enabled=1 +OverflowWarningsEnabled=1 +WarningThreshold=90 +SpWarningsEnabled=1 +WarnHow=0 +UseTrigger=1 +TriggerName=main +LimitSize=0 +ByteLimit=50 +[Log file] +LoggingEnabled=_ 0 +LogFile=_ "" +Category=_ 0 +[TermIOLog] +LoggingEnabled=_ 0 +LogFile=_ "" +[Interrupts] +Enabled=1 +Irq0=_ 0 480549 0 480549 0 0 0 100 0 1 "IRQ 1 0x18 CPSR.I" +Count=1 +[MemoryMap] +Enabled=0 +Base=0 +UseAuto=0 +TypeViolation=1 +UnspecRange=1 +ActionState=1 +[Disassemble mode] +mode=0 +[Breakpoints] +Count=0 +[TraceHelper] +Enabled=0 +ShowSource=1 diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/settings/cmock_demo.wsdt b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/settings/cmock_demo.wsdt new file mode 100644 index 0000000..33a5635 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/settings/cmock_demo.wsdt @@ -0,0 +1,76 @@ + + + + + + cmock_demo/Debug + + + + + + + + + 237272727 + + + + + + + 20111529774 + + + + + 100 + + + + + + + TabID-20770-112 + Workspace + Workspace + + + cmock_democmock_demo/Sourcecmock_demo/source + + + + 0 + + + TabID-10733-1323 + Build + Build + + + + TabID-27316-3469 + Debug Log + Debug-Log + + + + + 0 + + + + + + TextEditorC:\svn\cmock\examples\src\Main.c0056856800100000010000001 + + + + + + + iaridepm1-2-2554328-2-2179148129149173302238095651054-2-22561388-2-213902581002886302108129149173302 + + + + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/srcIAR/Cstartup.s79 b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/srcIAR/Cstartup.s79 new file mode 100644 index 0000000..73a53fc --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/srcIAR/Cstartup.s79 @@ -0,0 +1,266 @@ +;- ---------------------------------------------------------------------------- +;- ATMEL Microcontroller Software Support - ROUSSET - +;- ---------------------------------------------------------------------------- +;- DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +;- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +;- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +;- DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +;- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +;- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +;- OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +;- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +;- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +;- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +;- ---------------------------------------------------------------------------- +;- File source : Cstartup.s79 +;- Object : Generic CStartup +;- 1.0 01/Sep/05 FBr : Creation +;- 1.1 09/Sep/05 JPP : Change Interrupt management +;------------------------------------------------------------------------------ + +;------------------------------------------------------------------------------ +; Include your AT91 Library files +;------------------------------------------------------------------------------ +#include "AT91SAM7X256_inc.h" +;------------------------------------------------------------------------------ + +;------------------------------------------------------------------------------ +; ?RESET +; Reset Vector. +; Normally, segment INTVEC is linked at address 0. +; For debugging purposes, INTVEC may be placed at other addresses. +; A debugger that honors the entry point will start the +; program in a normal way even if INTVEC is not at address 0. +;------------------------------------------------------------------------------ + + PROGRAM ?RESET ;- Begins a program module + RSEG INTRAMEND_REMAP ;- Begins a relocatable segment + RSEG ICODE:CODE (2) ;- Begins a relocatable segment : corresponding address is 32-bit aligned + CODE32 ;- Always ARM mode after reset + ORG 0 ;- Sets the location counter: corresponds to the RESET vector address + +;------------------------------------------------------------------------------ +;- Exception vectors +;------------------------------------------------------------------------------ +;- These vectors can be read at address 0 or at RAM address +;- They ABSOLUTELY requires to be in relative addresssing mode in order to +;- guarantee a valid jump. For the moment, all are just looping. +;- If an exception occurs before remap, this would result in an infinite loop. +;- To ensure if a exeption occurs before start application to infinite loop. +;------------------------------------------------------------------------------ + +reset + B InitReset ; 0x00 Reset handler +undefvec: + B undefvec ; 0x04 Undefined Instruction +swivec: + B swivec ; 0x08 Software Interrupt +pabtvec: + B pabtvec ; 0x0C Prefetch Abort +dabtvec: + B dabtvec ; 0x10 Data Abort +rsvdvec: + B rsvdvec ; 0x14 reserved +irqvec: + B IRQ_Handler_Entry ; 0x18 IRQ + +fiqvec: ; 0x1c FIQ +;------------------------------------------------------------------------------ +;- Function : FIQ_Handler_Entry +;- Treatments : FIQ Controller Interrupt Handler. +;- Called Functions : AIC_FVR[interrupt] +;------------------------------------------------------------------------------ + +FIQ_Handler_Entry: + +;- Switch in SVC/User Mode to allow User Stack access for C code +; because the FIQ is not yet acknowledged + +;- Save and r0 in FIQ_Register + mov r9,r0 + ldr r0 , [r8, #AIC_FVR] + msr CPSR_c,#I_BIT | F_BIT | ARM_MODE_SVC +;- Save scratch/used registers and LR in User Stack + stmfd sp!, { r1-r3, r12, lr} + +;- Branch to the routine pointed by the AIC_FVR + mov r14, pc + bx r0 + +;- Restore scratch/used registers and LR from User Stack + ldmia sp!, { r1-r3, r12, lr} + +;- Leave Interrupts disabled and switch back in FIQ mode + msr CPSR_c, #I_BIT | F_BIT | ARM_MODE_FIQ + +;- Restore the R0 ARM_MODE_SVC register + mov r0,r9 + +;- Restore the Program Counter using the LR_fiq directly in the PC + subs pc,lr,#4 + +;------------------------------------------------------------------------------ +;- Manage exception: The exception must be ensure in ARM mode +;------------------------------------------------------------------------------ +;------------------------------------------------------------------------------ +;- Function : IRQ_Handler_Entry +;- Treatments : IRQ Controller Interrupt Handler. +;- Called Functions : AIC_IVR[interrupt] +;------------------------------------------------------------------------------ +IRQ_Handler_Entry: + +;------------------------- +;- Manage Exception Entry +;------------------------- +;- Adjust and save LR_irq in IRQ stack + sub lr, lr, #4 + stmfd sp!, {lr} + +;- Save r0 and SPSR (need to be saved for nested interrupt) + mrs r14, SPSR + stmfd sp!, {r0,r14} + +;- Write in the IVR to support Protect Mode +;- No effect in Normal Mode +;- De-assert the NIRQ and clear the source in Protect Mode + ldr r14, =AT91C_BASE_AIC + ldr r0 , [r14, #AIC_IVR] + str r14, [r14, #AIC_IVR] + +;- Enable Interrupt and Switch in Supervisor Mode + msr CPSR_c, #ARM_MODE_SVC + +;- Save scratch/used registers and LR in User Stack + stmfd sp!, { r1-r3, r12, r14} + +;---------------------------------------------- +;- Branch to the routine pointed by the AIC_IVR +;---------------------------------------------- + mov r14, pc + bx r0 + +;---------------------------------------------- +;- Manage Exception Exit +;---------------------------------------------- +;- Restore scratch/used registers and LR from User Stack + ldmia sp!, { r1-r3, r12, r14} + +;- Disable Interrupt and switch back in IRQ mode + msr CPSR_c, #I_BIT | ARM_MODE_IRQ + +;- Mark the End of Interrupt on the AIC + ldr r14, =AT91C_BASE_AIC + str r14, [r14, #AIC_EOICR] + +;- Restore SPSR_irq and r0 from IRQ stack + ldmia sp!, {r0,r14} + msr SPSR_cxsf, r14 + +;- Restore adjusted LR_irq from IRQ stack directly in the PC + ldmia sp!, {pc}^ + + + +InitReset: + +;------------------------------------------------------------------------------ +;- Low level Init is performed in a C function: AT91F_LowLevelInit +;- Init Stack Pointer to a valid memory area before calling AT91F_LowLevelInit +;------------------------------------------------------------------------------ + +;- Retrieve end of RAM address +__iramend EQU SFB(INTRAMEND_REMAP) ;- Segment begin + + EXTERN AT91F_LowLevelInit + ldr r13,=__iramend ;- Temporary stack in internal RAM for Low Level Init execution + ldr r0,=AT91F_LowLevelInit + mov lr, pc + bx r0 ;- Branch on C function (with interworking) + +;------------------------------------------------------------------------------ +;- Top of Stack Definition +;------------------------------------------------------------------------------ +;- Interrupt and Supervisor Stack are located at the top of internal memory in +;- order to speed the exception handling context saving and restoring. +;- ARM_MODE_SVC (Application, C) Stack is located at the top of the external memory. +;------------------------------------------------------------------------------ + +IRQ_STACK_SIZE EQU (3*8*4) ; 3 words to be saved per interrupt priority level +ARM_MODE_FIQ EQU 0x11 +ARM_MODE_IRQ EQU 0x12 +ARM_MODE_SVC EQU 0x13 +I_BIT EQU 0x80 +F_BIT EQU 0x40 + +;------------------------------------------------------------------------------ +;- Setup the stack for each mode +;------------------------------------------------------------------------------ + ldr r0, =__iramend + +;- Set up Fast Interrupt Mode and set FIQ Mode Stack + msr CPSR_c, #ARM_MODE_FIQ | I_BIT | F_BIT +;- Init the FIQ register + ldr r8, =AT91C_BASE_AIC + +;- Set up Interrupt Mode and set IRQ Mode Stack + msr CPSR_c, #ARM_MODE_IRQ | I_BIT | F_BIT + mov r13, r0 ; Init stack IRQ + sub r0, r0, #IRQ_STACK_SIZE + +;- Enable interrupt & Set up Supervisor Mode and set Supervisor Mode Stack + msr CPSR_c, #ARM_MODE_SVC + mov r13, r0 + +;------------------------------------------------------------------------------ +; Initialize segments. +;------------------------------------------------------------------------------ +; __segment_init is assumed to use +; instruction set and to be reachable by BL from the ICODE segment +; (it is safest to link them in segment ICODE). +;------------------------------------------------------------------------------ + EXTERN __segment_init + ldr r0,=__segment_init + mov lr, pc + bx r0 + +;------------------------------------------------------------------------------ +;- Branch on C code Main function (with interworking) +;------------------------------------------------------------------------------ + EXTERN main + PUBLIC __main +?jump_to_main: + ldr lr,=?call_exit + ldr r0,=main +__main: + bx r0 + +;------------------------------------------------------------------------------ +;- Loop for ever +;------------------------------------------------------------------------------ +;- End of application. Normally, never occur. +;- Could jump on Software Reset ( B 0x0 ). +;------------------------------------------------------------------------------ +?call_exit: +End + b End + +;------------------------------------------------------------------------------ +;- Exception Vectors +;------------------------------------------------------------------------------ + PUBLIC AT91F_Default_FIQ_handler + PUBLIC AT91F_Default_IRQ_handler + PUBLIC AT91F_Spurious_handler + + CODE32 ; Always ARM mode after exeption + +AT91F_Default_FIQ_handler + b AT91F_Default_FIQ_handler + +AT91F_Default_IRQ_handler + b AT91F_Default_IRQ_handler + +AT91F_Spurious_handler + b AT91F_Spurious_handler + + ENDMOD ;- Terminates the assembly of the current module + END ;- Terminates the assembly of the last module in a file \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/srcIAR/Cstartup_SAM7.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/srcIAR/Cstartup_SAM7.c new file mode 100644 index 0000000..0913da3 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v4/srcIAR/Cstartup_SAM7.c @@ -0,0 +1,98 @@ +// ---------------------------------------------------------------------------- +// ATMEL Microcontroller Software Support - ROUSSET - +// ---------------------------------------------------------------------------- +// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// ---------------------------------------------------------------------------- +// File Name : Cstartup_SAM7.c +// Object : Low level initialisations written in C for IAR Tools +// Creation : FBr 01-Sep-2005 +// 1.0 08-Sep-2005 JPP : Suppress Reset +// ---------------------------------------------------------------------------- + +#include "AT91SAM7X256.h" + +// The following functions must be write in ARM mode this function called directly by exception vector +extern void AT91F_Spurious_handler(void); +extern void AT91F_Default_IRQ_handler(void); +extern void AT91F_Default_FIQ_handler(void); + +//*---------------------------------------------------------------------------- +//* \fn AT91F_LowLevelInit +//* \brief This function performs very low level HW initialization +//* this function can use a Stack, depending the compilation +//* optimization mode +//*---------------------------------------------------------------------------- +void AT91F_LowLevelInit(void) +{ + unsigned char i; + ///////////////////////////////////////////////////////////////////////////////////////////////////// + // EFC Init + ///////////////////////////////////////////////////////////////////////////////////////////////////// + AT91C_BASE_MC->MC_FMR = AT91C_MC_FWS_1FWS; // 1 Wait State necessary to work at 48MHz + + ///////////////////////////////////////////////////////////////////////////////////////////////////// + // Init PMC Step 1. Enable Main Oscillator + // Main Oscillator startup time is board specific: + // Main Oscillator Startup Time worst case (3MHz) corresponds to 15ms (0x40 for AT91C_CKGR_OSCOUNT field) + ///////////////////////////////////////////////////////////////////////////////////////////////////// + AT91C_BASE_PMC->PMC_MOR = (( AT91C_CKGR_OSCOUNT & (0x40 <<8) | AT91C_CKGR_MOSCEN )); +#ifndef SIMULATE + // Wait Main Oscillator stabilization + while(!(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MOSCS)); +#endif + + ///////////////////////////////////////////////////////////////////////////////////////////////////// + // Init PMC Step 2. + // Set PLL to 96MHz (96,109MHz) and UDP Clock to 48MHz + // PLL Startup time depends on PLL RC filter: worst case is choosen + // UDP Clock (48,058MHz) is compliant with the Universal Serial Bus Specification (+/- 0.25% for full speed) + ///////////////////////////////////////////////////////////////////////////////////////////////////// + AT91C_BASE_PMC->PMC_PLLR = AT91C_CKGR_USBDIV_1 | AT91C_CKGR_OUT_0 | AT91C_CKGR_PLLCOUNT | + (AT91C_CKGR_MUL & (72 << 16)) | (AT91C_CKGR_DIV & 14); +#ifndef SIMULATE + // Wait for PLL stabilization + while( !(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_LOCK) ); + // Wait until the master clock is established for the case we already turn on the PLL + while( !(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MCKRDY) ); +#endif + + ///////////////////////////////////////////////////////////////////////////////////////////////////// + // Init PMC Step 3. + // Selection of Master Clock MCK (equal to Processor Clock PCK) equal to PLL/2 = 48MHz + // The PMC_MCKR register must not be programmed in a single write operation (see. Product Errata Sheet) + ///////////////////////////////////////////////////////////////////////////////////////////////////// + AT91C_BASE_PMC->PMC_MCKR = AT91C_PMC_PRES_CLK_2; +#ifndef SIMULATE + // Wait until the master clock is established + while( !(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MCKRDY) ); +#endif + + AT91C_BASE_PMC->PMC_MCKR |= AT91C_PMC_CSS_PLL_CLK; +#ifndef SIMULATE + // Wait until the master clock is established + while( !(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MCKRDY) ); +#endif + + ///////////////////////////////////////////////////////////////////////////////////////////////////// + // Disable Watchdog (write once register) + ///////////////////////////////////////////////////////////////////////////////////////////////////// + AT91C_BASE_WDTC->WDTC_WDMR = AT91C_WDTC_WDDIS; + + //////////////////////////////////////////////////////////////////////////////////////////////////// + // Init AIC: assign corresponding handler for each interrupt source + ///////////////////////////////////////////////////////////////////////////////////////////////////// + AT91C_BASE_AIC->AIC_SVR[0] = (int) AT91F_Default_FIQ_handler ; + for (i = 1; i < 31; i++) { + AT91C_BASE_AIC->AIC_SVR[i] = (int) AT91F_Default_IRQ_handler ; + } + AT91C_BASE_AIC->AIC_SPU = (unsigned int) AT91F_Spurious_handler; +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/SAM7_FLASH.mac b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/SAM7_FLASH.mac new file mode 100644 index 0000000..407acb2 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/SAM7_FLASH.mac @@ -0,0 +1,71 @@ +// ---------------------------------------------------------------------------- +// ATMEL Microcontroller Software Support - ROUSSET - +// ---------------------------------------------------------------------------- +// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// ---------------------------------------------------------------------------- +// File Name : SAM7_FLASH.mac +// Object : Generic Macro File for IAR +// 1.0 17/Aug/05 FBr : Creation +// ---------------------------------------------------------------------------- + +/********************************************************************* +* +* _InitRSTC() +* +* Function description +* Initializes the RSTC (Reset controller). +* This makes sense since the default is to not allow user resets, which makes it impossible to +* apply a second RESET via J-Link +*/ +_InitRSTC() { + __writeMemory32(0xA5000001, 0xFFFFFD08,"Memory"); // Allow user reset +} + +/********************************************************************* +* +* _InitPLL() +* Function description +* Initializes the PMC. +* 1. Enable the Main Oscillator +* 2. Configure PLL to 96MHz +* 3. Switch Master Clock (MCK) on PLL/2 = 48MHz +*/ + _InitPLL() { + + __message "Enable Main Oscillator"; + __writeMemory32(0x00000601,0xFFFFFc20,"Memory"); // MOSC + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x1) ); + + __message "Set PLL to 96MHz"; + __writeMemory32(0x10191c05,0xFFFFFc2c,"Memory"); // LOCK + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x4) ); + + __message "Set Master Clock to 48MHz"; + __writeMemory32(0x00000004,0xFFFFFc30,"Memory"); // MCKRDY + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x8) ); + __writeMemory32(0x00000007,0xFFFFFc30,"Memory"); // MCKRDY + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x8) ); +} + +/********************************************************************* +* +* execUserReset() : JTAG set initially to Full Speed +*/ +execUserReset() { + __message "execUserReset()"; + __emulatorSpeed(30000); // Set JTAG speed to 30kHz to make a hardware reset + __hwReset(0); // Hardware Reset: CPU is automatically halted after the reset (JTAG is already configured to 32kHz) + _InitPLL(); // Allow to debug at JTAG Full Speed + _InitRSTC(); // Enable User Reset to allow execUserReset() execution + __emulatorSpeed(0); // Set JTAG speed to full speed +} + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/SAM7_RAM.mac b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/SAM7_RAM.mac new file mode 100644 index 0000000..a2b8a01 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/SAM7_RAM.mac @@ -0,0 +1,94 @@ +// ---------------------------------------------------------------------------- +// ATMEL Microcontroller Software Support - ROUSSET - +// ---------------------------------------------------------------------------- +// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// ---------------------------------------------------------------------------- +// File Name : SAM7_RAM.mac +// Object : Generic Macro File for IAR +// 1.0 17/Aug/05 FBr : Creation +// ---------------------------------------------------------------------------- + +/********************************************************************* +* +* _MapRAMAt0() +* +* Function description +* Maps RAM at 0. +*/ +_MapRAMAt0(){ + __message "Changing mapping: RAM mapped to 0"; + __writeMemory32(0x00000001,0xFFFFFF00,"Memory"); +} + +/********************************************************************* +* +* _InitRSTC() +* +* Function description +* Initializes the RSTC (Reset controller). +* This makes sense since the default is to not allow user resets, which makes it impossible to +* apply a second RESET via J-Link +*/ +_InitRSTC() { + __writeMemory32(0xA5000001, 0xFFFFFD08,"Memory"); // Allow user reset +} + +/********************************************************************* +* +* _InitPLL() +* Function description +* Initializes the PMC. +* 1. Enable the Main Oscillator +* 2. Configure PLL to 96MHz +* 3. Switch Master Clock (MCK) on PLL/2 = 48MHz +*/ + _InitPLL() { + + __message "Set Main Oscillator"; + __writeMemory32(0x00004001,0xFFFFFc20,"Memory"); // MOSC + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x1) ); + + __message "Set PLL to 96MHz"; + __writeMemory32(0x10483f0e,0xFFFFFc2c,"Memory"); // LOCK + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x4) ); + + __message "Set Master Clock to 48MHz"; + __writeMemory32(0x00000004,0xFFFFFc30,"Memory"); // MCKRDY + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x8) ); + __writeMemory32(0x00000007,0xFFFFFc30,"Memory"); // MCKRDY + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x8) ); +} + +/********************************************************************* +* +* execUserReset() : JTAG set initially to Full Speed +*/ +execUserReset() { + __message "execUserReset()"; + __emulatorSpeed(30000); // Set JTAG speed to 30kHz to make a hardware reset + __hwReset(0); // Hardware Reset: CPU is automatically halted after the reset + _InitPLL(); // Allow to debug at JTAG Full Speed + _MapRAMAt0(); // Remap RAM to address 0 + __emulatorSpeed(0); // Set JTAG speed to full speed +} + +/********************************************************************* +* +* execUserPreload() : JTAG set initially to 32kHz +*/ +execUserPreload() { + __message "execUserPreload()"; + __hwReset(0); // Hardware Reset: CPU is automatically halted after the reset (JTAG is already configured to 32kHz) + _InitPLL(); // Allow to load Code at JTAG Full Speed + _MapRAMAt0(); // Remap RAM to address 0 + _InitRSTC(); // Enable User Reset to allow execUserReset() execution +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/SAM7_SIM.mac b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/SAM7_SIM.mac new file mode 100644 index 0000000..418a2c3 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/SAM7_SIM.mac @@ -0,0 +1,67 @@ +//========================================================= +// Simulation setup file for esc07_demo project +//========================================================= + +__var _timer0_interrupt_ID; + +irqBreak() +{ + __var __AIC_SMR; + __var __AIC_IECR; + __var __AIC_IVR; + + // read AIC_IECR instead, since not fully supported by simulator + __AIC_IECR = __readMemory32(0xFFFFF120, "Memory"); + if(__AIC_IECR & 0x1000) + { + __AIC_SMR = __readMemory32(0xFFFFF060, "Memory"); + __AIC_IVR = __readMemory32(0xFFFFF0B0, "Memory"); //AIC_IVR = AIC_SVR[x] + __writeMemory32(__AIC_IVR, 0xFFFFF100, "Memory"); //AIC_IVR + __writeMemory32(0x1000, 0xFFFFF10C, "Memory"); //AIC_IPR + __writeMemory32(0x2, 0xFFFFF114, "Memory"); //AIC_CISR + } + + return 0; +} + +setupProcessorRegisters() +{ + // Write TC0_SR.CPCS with correct status for ISR (Clock enabled; RC Compare Flag = TRUE) + __writeMemory32(0x00010010, 0xfffa0020, "Memory"); + + // Set TX ready flag in USART0 status register + // USART0_BASE->US_CSR = AT91C_US_TXRDY + __writeMemory32(0x00000002, 0xfffc0014, "Memory"); +} + +configureTimer0Interrupt() +{ + __var _master_clock_frequency; + __var _timer0_period_cycles; + + // Calculate timer0 frequency in master clock cycles + _master_clock_frequency = 48054857; + _timer0_period_cycles = _master_clock_frequency / 100; + if((_master_clock_frequency % 100) >= 50) + { + _timer0_period_cycles++; + } + + __cancelAllInterrupts(); + __enableInterrupts(); + + _timer0_interrupt_ID = __orderInterrupt("IRQ", _timer0_period_cycles, _timer0_period_cycles, 0, 0, 0, 100); + + if(-1 == _timer0_interrupt_ID) + { + __message "ERROR: failed to order timer 0 interrupt"; + } + + __setCodeBreak("0x18", 0, "irqBreak()", "TRUE", ""); +} + +execUserReset() +{ + setupProcessorRegisters(); + configureTimer0Interrupt(); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/at91SAM7X256_FLASH.icf b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/at91SAM7X256_FLASH.icf new file mode 100644 index 0000000..ab842a2 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/at91SAM7X256_FLASH.icf @@ -0,0 +1,43 @@ +/*###ICF### Section handled by ICF editor, don't touch! ****/ +/*-Editor annotation file-*/ +/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\a_v1_0.xml" */ +/*-Specials-*/ +define symbol __ICFEDIT_intvec_start__ = 0x00000000; +/*-Memory Regions-*/ +define symbol __ICFEDIT_region_ROM_start__ = 0x00000100; +define symbol __ICFEDIT_region_ROM_end__ = 0x0003FFFF; +define symbol __ICFEDIT_region_RAM_start__ = 0x00200000; +define symbol __ICFEDIT_region_RAM_end__ = 0x0020FFFF; +/*-Sizes-*/ +define symbol __ICFEDIT_size_cstack__ = 0x400; +define symbol __ICFEDIT_size_svcstack__ = 0x100; +define symbol __ICFEDIT_size_irqstack__ = 0x100; +define symbol __ICFEDIT_size_fiqstack__ = 0x40; +define symbol __ICFEDIT_size_undstack__ = 0x40; +define symbol __ICFEDIT_size_abtstack__ = 0x40; +define symbol __ICFEDIT_size_heap__ = 0x400; +/**** End of ICF editor section. ###ICF###*/ + + +define memory mem with size = 4G; +define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__]; +define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; + +define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; +define block SVC_STACK with alignment = 8, size = __ICFEDIT_size_svcstack__ { }; +define block IRQ_STACK with alignment = 8, size = __ICFEDIT_size_irqstack__ { }; +define block FIQ_STACK with alignment = 8, size = __ICFEDIT_size_fiqstack__ { }; +define block UND_STACK with alignment = 8, size = __ICFEDIT_size_undstack__ { }; +define block ABT_STACK with alignment = 8, size = __ICFEDIT_size_abtstack__ { }; +define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; + +initialize by copy { readwrite }; +do not initialize { section .noinit }; + +place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; + +place in ROM_region { readonly }; +place in RAM_region { readwrite, + block CSTACK, block SVC_STACK, block IRQ_STACK, block FIQ_STACK, + block UND_STACK, block ABT_STACK, block HEAP }; + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/at91SAM7X256_RAM.icf b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/at91SAM7X256_RAM.icf new file mode 100644 index 0000000..cc79cda --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/at91SAM7X256_RAM.icf @@ -0,0 +1,42 @@ +/*###ICF### Section handled by ICF editor, don't touch! ****/ +/*-Editor annotation file-*/ +/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\a_v1_0.xml" */ +/*-Specials-*/ +define symbol __ICFEDIT_intvec_start__ = 0x00000000; +/*-Memory Regions-*/ +define symbol __ICFEDIT_region_ROM_start__ = 0x00; +define symbol __ICFEDIT_region_ROM_end__ = 0x00; +define symbol __ICFEDIT_region_RAM_start__ = 0x00000100; +define symbol __ICFEDIT_region_RAM_end__ = 0x0000FFFF; +/*-Sizes-*/ +define symbol __ICFEDIT_size_cstack__ = 0x400; +define symbol __ICFEDIT_size_svcstack__ = 0x100; +define symbol __ICFEDIT_size_irqstack__ = 0x100; +define symbol __ICFEDIT_size_fiqstack__ = 0x40; +define symbol __ICFEDIT_size_undstack__ = 0x40; +define symbol __ICFEDIT_size_abtstack__ = 0x40; +define symbol __ICFEDIT_size_heap__ = 0x800; +/**** End of ICF editor section. ###ICF###*/ + + +define memory mem with size = 4G; +define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; + +define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; +define block SVC_STACK with alignment = 8, size = __ICFEDIT_size_svcstack__ { }; +define block IRQ_STACK with alignment = 8, size = __ICFEDIT_size_irqstack__ { }; +define block FIQ_STACK with alignment = 8, size = __ICFEDIT_size_fiqstack__ { }; +define block UND_STACK with alignment = 8, size = __ICFEDIT_size_undstack__ { }; +define block ABT_STACK with alignment = 8, size = __ICFEDIT_size_abtstack__ { }; +define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; + +initialize by copy { readwrite }; +do not initialize { section .noinit }; + +place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; + +place in RAM_region { readonly }; +place in RAM_region { readwrite, + block CSTACK, block SVC_STACK, block IRQ_STACK, block FIQ_STACK, + block UND_STACK, block ABT_STACK, block HEAP }; + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/cmock_demo.dep b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/cmock_demo.dep new file mode 100644 index 0000000..456f4db --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/cmock_demo.dep @@ -0,0 +1,4204 @@ + + + + 2 + 3270150602 + + Binary + + $PROJ_DIR$\Binary\Obj\TimerConductor.o + $TOOLKIT_DIR$\inc\DLib_Defaults.h + $TOOLKIT_DIR$\inc\DLib_Threads.h + $PROJ_DIR$\Binary\Obj\TimerConductor.pbi + $PROJ_DIR$\Binary\List\TimerInterruptConfigurator.lst + $PROJ_DIR$\Binary\Obj\AdcTemperatureSensor.o + $PROJ_DIR$\..\..\test\system\src\TimerInterruptConfigurator.h + $PROJ_DIR$\..\..\test\system\src\TimerModel.h + $TOOLKIT_DIR$\inc\ymath.h + $PROJ_DIR$\Binary\Obj\Cstartup_SAM7.o + $TOOLKIT_DIR$\inc\DLib_Product.h + $TOOLKIT_DIR$\inc\math.h + $PROJ_DIR$\Binary\Exe\cmock_demo.hex + $PROJ_DIR$\Binary\Obj\UsartPutChar.pbi + $PROJ_DIR$\..\..\test\system\src\TimerInterruptHandler.h + $PROJ_DIR$\Binary\Obj\AdcConductor.pbi + $PROJ_DIR$\Binary\List\TimerConfigurator.lst + $PROJ_DIR$\Binary\List\TaskScheduler.lst + $PROJ_DIR$\Binary\List\TemperatureCalculator.lst + $PROJ_DIR$\Binary\List\UsartConductor.lst + $PROJ_DIR$\Binary\Obj\UsartConductor.o + $PROJ_DIR$\Binary\Obj\TimerModel.o + $PROJ_DIR$\Binary\Obj\UsartConfigurator.pbi + $PROJ_DIR$\Binary\Obj\TimerInterruptConfigurator.o + $PROJ_DIR$\Binary\List\Cstartup.lst + $PROJ_DIR$\..\..\test\system\src\Executor.h + $PROJ_DIR$\incIAR\project.h + $PROJ_DIR$\Binary\Obj\Executor.pbi + $PROJ_DIR$\Binary\List\TimerConductor.lst + $PROJ_DIR$\Binary\Obj\TimerModel.pbi + $TOOLKIT_DIR$\inc\intrinsics.h + $PROJ_DIR$\Binary\Obj\Model.pbi + $PROJ_DIR$\Binary\Obj\UsartBaudRateRegisterCalculator.o + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.h + $PROJ_DIR$\..\..\examples\src\UsartModel.h + $PROJ_DIR$\Binary\Obj\TaskScheduler.pbi + $PROJ_DIR$\Binary\Obj\Executor.o + $PROJ_DIR$\Binary\Obj\TemperatureCalculator.o + $PROJ_DIR$\Binary\Obj\Cstartup_SAM7.pbi + $PROJ_DIR$\..\..\test\system\src\AT91SAM7X256.h + $PROJ_DIR$\Binary\Obj\IntrinsicsWrapper.pbi + $PROJ_DIR$\..\..\examples\src\UsartHardware.h + $PROJ_DIR$\Binary\List\Main.lst + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.h + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.h + $PROJ_DIR$\Binary\List\TimerHardware.lst + $PROJ_DIR$\..\..\test\system\src\UsartBaudRateRegisterCalculator.h + $PROJ_DIR$\..\..\test\system\src\TemperatureCalculator.h + $PROJ_DIR$\..\..\test\system\src\UsartPutChar.h + $PROJ_DIR$\..\..\test\system\src\TaskScheduler.h + $PROJ_DIR$\Binary\List\UsartTransmitBufferStatus.lst + $PROJ_DIR$\Binary\Obj\AdcTemperatureSensor.pbi + $PROJ_DIR$\Binary\Obj\Main.pbi + $PROJ_DIR$\Binary\List\UsartModel.lst + $PROJ_DIR$\Binary\Obj\TemperatureFilter.pbi + $PROJ_DIR$\Binary\List\AdcHardware.lst + $PROJ_DIR$\Binary\List\AdcTemperatureSensor.lst + $PROJ_DIR$\Binary\Obj\UsartTransmitBufferStatus.pbi + $PROJ_DIR$\Binary\Obj\AdcHardware.pbi + $PROJ_DIR$\Binary\Obj\TemperatureCalculator.pbi + $TOOLKIT_DIR$\lib\dl4t_tl_in.a + $TOOLKIT_DIR$\inc\ycheck.h + $PROJ_DIR$\..\..\test\system\src\ModelConfig.h + $PROJ_DIR$\Binary\List\AdcConductor.lst + $PROJ_DIR$\Binary\List\AdcHardwareConfigurator.lst + $PROJ_DIR$\Binary\Obj\TimerHardware.o + $PROJ_DIR$\Binary\Obj\TimerInterruptHandler.o + $TOOLKIT_DIR$\inc\stdio.h + $PROJ_DIR$\Binary\Obj\UsartHardware.o + $PROJ_DIR$\Binary\Obj\TimerInterruptHandler.pbi + $PROJ_DIR$\Binary\Obj\UsartModel.o + $TOOLKIT_DIR$\inc\DLib_Config_Normal.h + $PROJ_DIR$\Binary\List\TemperatureFilter.lst + $PROJ_DIR$\Binary\List\UsartPutChar.lst + $PROJ_DIR$\Binary\Obj\UsartConfigurator.o + $PROJ_DIR$\..\..\test\system\src\UsartConductor.h + $PROJ_DIR$\Binary\List\AdcModel.lst + $PROJ_DIR$\..\..\test\system\src\TemperatureFilter.h + $PROJ_DIR$\..\..\test\system\src\Types.h + $PROJ_DIR$\..\..\test\system\src\TimerConfigurator.h + $TOOLKIT_DIR$\inc\yvals.h + $PROJ_DIR$\..\..\test\system\src\UsartModel.h + $PROJ_DIR$\Binary\Obj\UsartTransmitBufferStatus.o + $TOOLKIT_DIR$\lib\rt4t_al.a + $PROJ_DIR$\Binary\List\UsartHardware.lst + $TOOLKIT_DIR$\inc\ysizet.h + $PROJ_DIR$\Binary\Obj\AdcModel.o + $PROJ_DIR$\Binary\Obj\AdcConductor.o + $PROJ_DIR$\Binary\Exe\cmock_demo.out + $PROJ_DIR$\..\..\test\system\src\AdcConductor.h + $PROJ_DIR$\..\..\test\system\src\AdcTemperatureSensor.h + $PROJ_DIR$\Binary\Obj\UsartModel.pbi + $PROJ_DIR$\..\..\test\system\src\TimerHardware.h + $PROJ_DIR$\..\..\test\system\src\AdcModel.h + $PROJ_DIR$\..\..\test\system\src\AdcHardware.h + $PROJ_DIR$\Binary\List\UsartBaudRateRegisterCalculator.lst + $PROJ_DIR$\..\..\test\system\src\Model.h + $TOOLKIT_DIR$\lib\shs_l.a + $PROJ_DIR$\..\..\test\system\src\UsartConfigurator.h + $PROJ_DIR$\Binary\Obj\TimerInterruptConfigurator.pbi + $PROJ_DIR$\Binary\List\UsartConfigurator.lst + $PROJ_DIR$\Binary\List\TimerModel.lst + $PROJ_DIR$\..\..\examples\src\Executor.h + $PROJ_DIR$\Binary\Obj\IntrinsicsWrapper.o + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.h + $PROJ_DIR$\..\..\examples\src\UsartConductor.h + $PROJ_DIR$\..\..\test\system\src\AdcTemperatureSensor.c + $PROJ_DIR$\..\..\examples\src\TimerConductor.h + $PROJ_DIR$\Binary\Obj\AdcHardwareConfigurator.o + $TOOLKIT_DIR$\inc\xencoding_limits.h + $PROJ_DIR$\..\..\test\system\src\Main.c + $PROJ_DIR$\..\..\test\system\src\AdcHardwareConfigurator.c + $PROJ_DIR$\..\..\test\system\src\AdcConductor.c + $PROJ_DIR$\..\..\test\system\src\AdcHardware.c + $PROJ_DIR$\..\..\examples\src\TimerModel.h + $PROJ_DIR$\..\..\test\system\src\AdcModel.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.h + $PROJ_DIR$\..\..\test\system\src\Executor.c + $PROJ_DIR$\..\..\examples\src\Model.h + $PROJ_DIR$\..\..\test\system\src\Model.c + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.h + $PROJ_DIR$\..\..\examples\src\UsartPutChar.h + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.h + $PROJ_DIR$\..\..\test\system\src\TemperatureFilter.c + $PROJ_DIR$\..\..\test\system\src\TimerConfigurator.c + $PROJ_DIR$\..\..\test\system\src\TemperatureCalculator.c + $PROJ_DIR$\..\..\test\system\src\TaskScheduler.c + $PROJ_DIR$\..\..\test\system\src\TimerInterruptConfigurator.c + $PROJ_DIR$\Binary\Obj\AdcModel.pbi + $PROJ_DIR$\..\..\test\system\src\TimerConductor.c + $PROJ_DIR$\..\..\test\system\src\TimerInterruptHandler.c + $PROJ_DIR$\Binary\Obj\AdcHardware.o + $PROJ_DIR$\..\..\test\system\src\UsartConfigurator.c + $PROJ_DIR$\..\..\test\system\src\TimerHardware.c + $PROJ_DIR$\..\..\test\system\src\UsartTransmitBufferStatus.c + $PROJ_DIR$\..\..\examples\src\AdcModel.h + $PROJ_DIR$\..\..\test\system\src\TimerModel.c + $PROJ_DIR$\..\..\test\system\src\UsartBaudRateRegisterCalculator.c + $PROJ_DIR$\..\..\test\system\src\UsartConductor.c + $PROJ_DIR$\..\..\examples\src\AdcHardware.h + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.h + $PROJ_DIR$\..\..\test\system\src\UsartHardware.c + $PROJ_DIR$\..\..\test\system\src\UsartModel.c + $PROJ_DIR$\..\..\test\system\src\UsartPutChar.c + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.h + $PROJ_DIR$\..\..\examples\src\ModelConfig.h + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.h + $PROJ_DIR$\..\..\examples\src\Types.h + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.h + $PROJ_DIR$\..\..\examples\src\AdcConductor.h + $PROJ_DIR$\..\..\examples\src\AT91SAM7X256.h + $PROJ_DIR$\..\..\examples\src\TaskScheduler.h + $PROJ_DIR$\..\..\examples\src\TimerHardware.h + $PROJ_DIR$\Binary\Obj\TimerHardware.pbi + $PROJ_DIR$\Binary\Obj\TimerConfigurator.o + $PROJ_DIR$\Binary\List\Model.lst + $PROJ_DIR$\Binary\Obj\Cstartup.o + $PROJ_DIR$\Binary\Obj\TaskScheduler.o + $PROJ_DIR$\Binary\Obj\TemperatureFilter.o + $PROJ_DIR$\..\..\test\system\src\TimerConductor.h + $PROJ_DIR$\Binary\Obj\Model.o + $PROJ_DIR$\..\..\test\system\src\UsartTransmitBufferStatus.h + $PROJ_DIR$\Binary\Obj\UsartHardware.pbi + $PROJ_DIR$\Binary\List\TimerInterruptHandler.lst + $PROJ_DIR$\Binary\Obj\cmock_demo.pbd + $PROJ_DIR$\..\..\test\system\src\UsartHardware.h + $PROJ_DIR$\..\..\test\system\src\AdcHardwareConfigurator.h + $PROJ_DIR$\Binary\Obj\UsartConductor.pbi + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + $PROJ_DIR$\..\..\examples\src\AdcModel.c + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + $PROJ_DIR$\..\..\examples\src\Executor.c + $PROJ_DIR$\..\..\examples\src\Main.c + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + $PROJ_DIR$\..\..\examples\src\Model.c + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + $PROJ_DIR$\Resource\at91SAM7X256_FLASH.icf + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + $PROJ_DIR$\..\..\examples\src\TimerModel.c + $PROJ_DIR$\..\..\examples\src\UsartModel.c + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + $PROJ_DIR$\srcIAR\Cstartup.s + $PROJ_DIR$\Binary\Obj\UsartPutChar.o + $PROJ_DIR$\Binary\Obj\TimerConfigurator.pbi + $PROJ_DIR$\Binary\Obj\Main.o + $PROJ_DIR$\Binary\List\Executor.lst + $PROJ_DIR$\incIAR\AT91SAM7X-EK.h + $PROJ_DIR$\incIAR\lib_AT91SAM7X256.h + $PROJ_DIR$\incIAR\AT91SAM7X256_inc.h + $PROJ_DIR$\Binary\Obj\AdcHardwareConfigurator.pbi + $PROJ_DIR$\Binary\Obj\UsartBaudRateRegisterCalculator.pbi + + + [ROOT_NODE] + + + ILINK + 88 + + + + + $PROJ_DIR$\Binary\Exe\cmock_demo.out + + + OBJCOPY + 12 + + + + + ILINK + 179 87 131 108 86 5 156 9 36 103 198 160 157 37 158 0 154 65 23 66 21 32 20 74 68 70 196 82 97 83 60 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcTemperatureSensor.c + + + BICOMP + 51 + + + ICCARM + 56 5 + + + + + BICOMP + 78 39 90 + + + ICCARM + 78 39 90 + + + + + $PROJ_DIR$\..\..\test\system\src\Main.c + + + BICOMP + 52 + + + ICCARM + 42 198 + + + + + BICOMP + 78 39 25 96 49 47 77 75 165 98 48 81 46 161 159 92 79 6 14 7 89 94 166 90 93 + + + ICCARM + 78 39 25 96 49 47 77 75 165 98 48 81 46 161 159 92 79 6 14 7 89 94 166 90 93 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcHardwareConfigurator.c + + + BICOMP + 203 + + + ICCARM + 64 108 + + + + + BICOMP + 78 39 166 62 + + + ICCARM + 78 39 166 62 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcConductor.c + + + BICOMP + 15 + + + ICCARM + 63 87 + + + + + BICOMP + 78 39 89 93 94 + + + ICCARM + 78 39 89 93 94 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcHardware.c + + + BICOMP + 58 + + + ICCARM + 55 131 + + + + + BICOMP + 78 39 94 166 90 + + + ICCARM + 78 39 94 166 90 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcModel.c + + + BICOMP + 128 + + + ICCARM + 76 86 + + + + + BICOMP + 78 39 93 49 47 77 + + + ICCARM + 78 39 93 49 47 77 + + + + + $PROJ_DIR$\..\..\test\system\src\Executor.c + + + BICOMP + 27 + + + ICCARM + 199 36 + + + + + BICOMP + 78 39 25 96 75 159 89 30 61 + + + ICCARM + 78 39 25 96 75 159 89 30 61 + + + + + $PROJ_DIR$\..\..\test\system\src\Model.c + + + BICOMP + 31 + + + ICCARM + 155 160 + + + + + BICOMP + 96 78 39 49 77 + + + ICCARM + 96 78 39 49 77 + + + + + $PROJ_DIR$\..\..\test\system\src\TemperatureFilter.c + + + BICOMP + 54 + + + ICCARM + 72 158 + + + + + BICOMP + 78 39 77 11 61 8 80 1 10 109 2 + + + ICCARM + 78 39 77 11 61 8 80 1 71 10 109 2 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerConfigurator.c + + + BICOMP + 197 + + + ICCARM + 16 154 + + + + + BICOMP + 78 39 79 6 + + + ICCARM + 78 39 79 6 + + + + + $PROJ_DIR$\..\..\test\system\src\TemperatureCalculator.c + + + BICOMP + 59 + + + ICCARM + 18 37 + + + + + BICOMP + 78 39 47 11 61 8 80 1 10 109 2 + + + ICCARM + 78 39 47 11 61 8 80 1 71 10 109 2 + + + + + $PROJ_DIR$\..\..\test\system\src\TaskScheduler.c + + + BICOMP + 35 + + + ICCARM + 17 157 + + + + + BICOMP + 78 39 49 + + + ICCARM + 78 39 49 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerInterruptConfigurator.c + + + BICOMP + 99 + + + ICCARM + 4 23 + + + + + BICOMP + 78 39 6 14 + + + ICCARM + 78 39 6 14 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerConductor.c + + + BICOMP + 3 + + + ICCARM + 28 0 + + + + + BICOMP + 78 39 159 7 92 14 + + + ICCARM + 78 39 159 7 92 14 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerInterruptHandler.c + + + BICOMP + 69 + + + ICCARM + 163 66 + + + + + BICOMP + 78 39 14 6 + + + ICCARM + 78 39 14 6 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartConfigurator.c + + + BICOMP + 22 + + + ICCARM + 100 74 + + + + + BICOMP + 78 39 98 + + + ICCARM + 78 39 98 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerHardware.c + + + BICOMP + 153 + + + ICCARM + 45 65 + + + + + BICOMP + 78 39 92 79 + + + ICCARM + 78 39 92 79 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartTransmitBufferStatus.c + + + BICOMP + 57 + + + ICCARM + 50 82 + + + + + BICOMP + 78 39 161 + + + ICCARM + 78 39 161 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerModel.c + + + BICOMP + 29 + + + ICCARM + 101 21 + + + + + BICOMP + 78 39 7 49 + + + ICCARM + 78 39 7 49 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartBaudRateRegisterCalculator.c + + + BICOMP + 204 + + + ICCARM + 95 32 + + + + + BICOMP + 78 39 46 + + + ICCARM + 78 39 46 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartConductor.c + + + BICOMP + 167 + + + ICCARM + 19 20 + + + + + BICOMP + 78 39 75 165 81 49 + + + ICCARM + 78 39 75 165 81 49 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartHardware.c + + + BICOMP + 162 + + + ICCARM + 84 68 + + + + + BICOMP + 78 39 165 98 48 + + + ICCARM + 78 39 165 98 48 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartModel.c + + + BICOMP + 91 + + + ICCARM + 53 70 + + + + + BICOMP + 78 39 81 62 46 77 67 61 80 1 10 109 2 85 11 8 + + + ICCARM + 78 39 81 62 46 77 67 61 80 1 71 10 109 2 85 11 8 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartPutChar.c + + + BICOMP + 13 + + + ICCARM + 73 196 + + + + + BICOMP + 78 39 48 161 + + + ICCARM + 78 39 48 161 + + + + + $PROJ_DIR$\Binary\Obj\cmock_demo.pbd + + + BILINK + 15 58 203 128 51 38 27 40 52 31 35 59 54 3 197 153 99 69 29 204 167 22 162 91 13 57 + + + + + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + + + BICOMP + 38 + + + + + BICOMP + 26 30 61 200 150 201 + + + + + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + + + BICOMP + 203 + + + + + BICOMP + 147 150 146 145 + + + + + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + + + BICOMP + 15 + + + ICCARM + 63 87 131 108 86 5 36 103 198 160 157 37 158 0 154 65 23 66 21 32 20 74 68 70 196 82 9 + + + + + BICOMP + 147 150 149 135 139 + + + ICCARM + 147 150 149 135 139 146 144 145 151 148 140 102 118 105 107 120 30 61 41 43 121 34 33 44 152 104 122 116 114 11 8 80 1 71 10 109 2 67 85 26 200 201 + + + + + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + + + BICOMP + 58 + + + + + BICOMP + 147 150 139 146 144 + + + + + $PROJ_DIR$\..\..\examples\src\AdcModel.c + + + BICOMP + 128 + + + + + BICOMP + 147 150 135 151 148 140 + + + + + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + + + BICOMP + 51 + + + + + BICOMP + 147 150 144 + + + + + $PROJ_DIR$\..\..\examples\src\Executor.c + + + BICOMP + 27 + + + + + BICOMP + 147 150 102 118 105 107 149 120 + + + + + $PROJ_DIR$\..\..\examples\src\Main.c + + + BICOMP + 52 + + + + + BICOMP + 147 150 120 102 118 151 148 140 105 41 43 121 34 33 44 107 152 104 122 116 114 149 139 146 144 135 + + + + + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + + + BICOMP + 40 + + + + + BICOMP + 120 30 61 + + + + + $PROJ_DIR$\..\..\examples\src\Model.c + + + BICOMP + 31 + + + + + BICOMP + 118 147 150 151 140 + + + + + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + + + BICOMP + 59 + + + + + BICOMP + 147 150 148 11 61 8 80 1 10 109 2 + + + + + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + + + BICOMP + 35 + + + + + BICOMP + 147 150 151 + + + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + + + BICOMP + 99 + + + + + BICOMP + 147 150 122 116 + + + + + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + + + BICOMP + 54 + + + + + BICOMP + 147 150 140 11 61 8 80 1 10 109 2 + + + + + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + + + BICOMP + 3 + + + + + BICOMP + 147 150 107 114 152 116 + + + + + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + + + BICOMP + 197 + + + + + BICOMP + 147 150 104 122 + + + + + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + + + BICOMP + 153 + + + + + BICOMP + 147 150 152 104 + + + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + + + BICOMP + 69 + + + + + BICOMP + 147 150 116 122 + + + + + $PROJ_DIR$\..\..\examples\src\TimerModel.c + + + BICOMP + 29 + + + + + BICOMP + 147 150 114 151 + + + + + $PROJ_DIR$\..\..\examples\src\UsartModel.c + + + BICOMP + 91 + + + + + BICOMP + 147 150 34 145 33 140 67 61 80 1 10 109 2 85 11 8 + + + + + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + + + BICOMP + 204 + + + + + BICOMP + 147 150 33 + + + + + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + + + BICOMP + 167 + + + + + BICOMP + 147 150 105 41 34 151 + + + + + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + + + BICOMP + 22 + + + + + BICOMP + 147 150 43 + + + + + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + + + BICOMP + 162 + + + + + BICOMP + 147 150 41 43 121 + + + + + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + + + BICOMP + 57 + + + + + BICOMP + 147 150 44 + + + + + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + + + BICOMP + 13 + + + + + BICOMP + 147 150 121 44 + + + + + $PROJ_DIR$\srcIAR\Cstartup.s + + + AARM + 156 24 + + + + + AARM + 202 + + + + + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\AdcModel.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\Executor.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\Main.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\Model.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\TimerModel.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\UsartModel.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + ICCARM + + + + FLASH_Debug + + $TOOLKIT_DIR$\inc\DLib_Defaults.h + $TOOLKIT_DIR$\inc\DLib_Threads.h + $PROJ_DIR$\..\..\test\system\src\TimerInterruptConfigurator.h + $PROJ_DIR$\..\..\test\system\src\TimerModel.h + $TOOLKIT_DIR$\inc\ymath.h + $TOOLKIT_DIR$\inc\DLib_Product.h + $TOOLKIT_DIR$\inc\math.h + $PROJ_DIR$\..\..\test\system\src\TimerInterruptHandler.h + $PROJ_DIR$\..\..\test\system\src\Executor.h + $PROJ_DIR$\incIAR\project.h + $TOOLKIT_DIR$\inc\intrinsics.h + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.h + $PROJ_DIR$\..\..\examples\src\UsartModel.h + $PROJ_DIR$\..\..\test\system\src\AT91SAM7X256.h + $PROJ_DIR$\..\..\examples\src\UsartHardware.h + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.h + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.h + $PROJ_DIR$\..\..\test\system\src\UsartBaudRateRegisterCalculator.h + $PROJ_DIR$\..\..\test\system\src\TemperatureCalculator.h + $PROJ_DIR$\..\..\test\system\src\UsartPutChar.h + $PROJ_DIR$\..\..\test\system\src\TaskScheduler.h + $TOOLKIT_DIR$\lib\dl4t_tl_in.a + $TOOLKIT_DIR$\inc\ycheck.h + $PROJ_DIR$\..\..\test\system\src\ModelConfig.h + $TOOLKIT_DIR$\inc\stdio.h + $TOOLKIT_DIR$\inc\DLib_Config_Normal.h + $PROJ_DIR$\..\..\test\system\src\UsartConductor.h + $PROJ_DIR$\..\..\test\system\src\TemperatureFilter.h + $PROJ_DIR$\..\..\test\system\src\Types.h + $PROJ_DIR$\..\..\test\system\src\TimerConfigurator.h + $TOOLKIT_DIR$\inc\yvals.h + $PROJ_DIR$\..\..\test\system\src\UsartModel.h + $TOOLKIT_DIR$\lib\rt4t_al.a + $TOOLKIT_DIR$\inc\ysizet.h + $PROJ_DIR$\..\..\test\system\src\AdcConductor.h + $PROJ_DIR$\..\..\test\system\src\AdcTemperatureSensor.h + $PROJ_DIR$\..\..\test\system\src\TimerHardware.h + $PROJ_DIR$\..\..\test\system\src\AdcModel.h + $PROJ_DIR$\..\..\test\system\src\AdcHardware.h + $PROJ_DIR$\..\..\test\system\src\Model.h + $TOOLKIT_DIR$\lib\shs_l.a + $PROJ_DIR$\..\..\test\system\src\UsartConfigurator.h + $PROJ_DIR$\..\..\examples\src\Executor.h + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.h + $PROJ_DIR$\..\..\examples\src\UsartConductor.h + $PROJ_DIR$\..\..\test\system\src\AdcTemperatureSensor.c + $PROJ_DIR$\..\..\examples\src\TimerConductor.h + $TOOLKIT_DIR$\inc\xencoding_limits.h + $PROJ_DIR$\FLASH_Debug\Obj\cmock_demo.pbd + $PROJ_DIR$\..\..\test\system\src\Main.c + $PROJ_DIR$\..\..\test\system\src\AdcHardwareConfigurator.c + $PROJ_DIR$\..\..\test\system\src\AdcConductor.c + $PROJ_DIR$\..\..\test\system\src\AdcHardware.c + $PROJ_DIR$\..\..\examples\src\TimerModel.h + $PROJ_DIR$\..\..\test\system\src\AdcModel.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.h + $PROJ_DIR$\..\..\test\system\src\Executor.c + $PROJ_DIR$\..\..\examples\src\Model.h + $PROJ_DIR$\..\..\test\system\src\Model.c + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.h + $PROJ_DIR$\..\..\examples\src\UsartPutChar.h + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.h + $PROJ_DIR$\..\..\test\system\src\TemperatureFilter.c + $PROJ_DIR$\..\..\test\system\src\TimerConfigurator.c + $PROJ_DIR$\..\..\test\system\src\TemperatureCalculator.c + $PROJ_DIR$\..\..\test\system\src\TaskScheduler.c + $PROJ_DIR$\..\..\test\system\src\TimerInterruptConfigurator.c + $PROJ_DIR$\..\..\test\system\src\TimerConductor.c + $PROJ_DIR$\..\..\test\system\src\TimerInterruptHandler.c + $PROJ_DIR$\..\..\test\system\src\UsartConfigurator.c + $PROJ_DIR$\..\..\test\system\src\TimerHardware.c + $PROJ_DIR$\..\..\test\system\src\UsartTransmitBufferStatus.c + $PROJ_DIR$\..\..\examples\src\AdcModel.h + $PROJ_DIR$\..\..\test\system\src\TimerModel.c + $PROJ_DIR$\..\..\test\system\src\UsartBaudRateRegisterCalculator.c + $PROJ_DIR$\..\..\test\system\src\UsartConductor.c + $PROJ_DIR$\..\..\examples\src\AdcHardware.h + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.h + $PROJ_DIR$\..\..\test\system\src\UsartHardware.c + $PROJ_DIR$\..\..\test\system\src\UsartModel.c + $PROJ_DIR$\..\..\test\system\src\UsartPutChar.c + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.h + $PROJ_DIR$\..\..\examples\src\ModelConfig.h + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.h + $PROJ_DIR$\..\..\examples\src\Types.h + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.h + $PROJ_DIR$\..\..\examples\src\AdcConductor.h + $PROJ_DIR$\..\..\examples\src\AT91SAM7X256.h + $PROJ_DIR$\..\..\examples\src\TaskScheduler.h + $PROJ_DIR$\..\..\examples\src\TimerHardware.h + $PROJ_DIR$\..\..\test\system\src\TimerConductor.h + $PROJ_DIR$\..\..\test\system\src\UsartTransmitBufferStatus.h + $PROJ_DIR$\..\..\test\system\src\UsartHardware.h + $PROJ_DIR$\FLASH_Debug\Obj\Main.o + $PROJ_DIR$\..\..\test\system\src\AdcHardwareConfigurator.h + $PROJ_DIR$\FLASH_Debug\List\TimerHardware.lst + $PROJ_DIR$\FLASH_Debug\List\ext_irq.lst + $PROJ_DIR$\FLASH_Debug\Obj\Cstartup.o + $PROJ_DIR$\FLASH_Debug\Obj\TimerConfigurator.pbi + $PROJ_DIR$\FLASH_Debug\List\UsartHardware.lst + $PROJ_DIR$\..\src\ext_irq.c + $PROJ_DIR$\FLASH_Debug\Obj\interrupt_Usart.o + $PROJ_DIR$\FLASH_Debug\Obj\interrupt_Usart.pbi + $PROJ_DIR$\FLASH_Debug\Obj\TimerModel.o + $PROJ_DIR$\FLASH_Debug\Obj\main.pbi + $PROJ_DIR$\FLASH_Debug\List\Model.lst + $PROJ_DIR$\FLASH_Debug\Obj\AdcModel.o + $PROJ_DIR$\FLASH_Debug\Obj\UsartHardware.o + $PROJ_DIR$\FLASH_Debug\Obj\UsartPutChar.o + $PROJ_DIR$\FLASH_Debug\Obj\TemperatureCalculator.pbi + $PROJ_DIR$\FLASH_Debug\List\AdcConductor.lst + $PROJ_DIR$\FLASH_Debug\Obj\UsartTransmitBufferStatus.pbi + $PROJ_DIR$\FLASH_Debug\Obj\AdcConductor.pbi + $PROJ_DIR$\FLASH_Debug\Obj\Model.pbi + $PROJ_DIR$\FLASH_Debug\Obj\Cstartup_SAM7.o + $PROJ_DIR$\FLASH_Debug\Obj\IntrinsicsWrapper.o + $PROJ_DIR$\FLASH_Debug\Obj\IntrinsicsWrapper.pbi + $PROJ_DIR$\FLASH_Debug\Obj\AdcHardware.o + $PROJ_DIR$\FLASH_Debug\Obj\UsartPutChar.pbi + $PROJ_DIR$\FLASH_Debug\Obj\UsartBaudRateRegisterCalculator.pbi + $PROJ_DIR$\FLASH_Debug\List\interrupt_timer.lst + $PROJ_DIR$\FLASH_Debug\List\Cstartup_SAM7.lst + $PROJ_DIR$\FLASH_Debug\Obj\AdcHardwareConfigurator.o + $PROJ_DIR$\FLASH_Debug\List\AdcHardwareConfigurator.lst + $PROJ_DIR$\FLASH_Debug\Obj\TemperatureFilter.pbi + $PROJ_DIR$\FLASH_Debug\Obj\TimerConductor.pbi + $PROJ_DIR$\..\..\include\lib_AT91SAM7X256.h + $PROJ_DIR$\FLASH_Debug\Obj\TaskScheduler.o + $PROJ_DIR$\FLASH_Debug\Obj\TemperatureFilter.o + $PROJ_DIR$\FLASH_Debug\Obj\ext_irq.pbi + $PROJ_DIR$\..\..\include\AT91SAM7X256.h + $PROJ_DIR$\FLASH_Debug\Obj\AdcModel.pbi + $PROJ_DIR$\FLASH_Debug\Obj\TimerInterruptConfigurator.o + $PROJ_DIR$\FLASH_Debug\List\AdcModel.lst + $PROJ_DIR$\FLASH_Debug\List\interrupt_Usart.lst + $PROJ_DIR$\FLASH_Debug\List\Cstartup.lst + $PROJ_DIR$\FLASH_Debug\Obj\UsartHardware.pbi + $PROJ_DIR$\FLASH_Debug\List\TimerModel.lst + $PROJ_DIR$\FLASH_Debug\Obj\UsartConductor.o + $PROJ_DIR$\FLASH_Debug\Obj\UsartConfigurator.o + $PROJ_DIR$\FLASH_Debug\List\UsartPutChar.lst + $PROJ_DIR$\FLASH_Debug\List\TemperatureFilter.lst + $PROJ_DIR$\FLASH_Debug\Obj\TimerInterruptHandler.pbi + $PROJ_DIR$\FLASH_Debug\List\TemperatureCalculator.lst + $PROJ_DIR$\FLASH_Debug\List\UsartTransmitBufferStatus.lst + $PROJ_DIR$\FLASH_Debug\Obj\UsartModel.pbi + $PROJ_DIR$\FLASH_Debug\List\UsartConductor.lst + $PROJ_DIR$\FLASH_Debug\List\TimerConfigurator.lst + $PROJ_DIR$\FLASH_Debug\Obj\Model.o + $PROJ_DIR$\FLASH_Debug\List\Executor.lst + $PROJ_DIR$\FLASH_Debug\List\UsartModel.lst + $PROJ_DIR$\FLASH_Debug\List\TimerInterruptHandler.lst + $PROJ_DIR$\FLASH_Debug\List\Main.lst + $PROJ_DIR$\FLASH_Debug\List\TimerInterruptConfigurator.lst + $PROJ_DIR$\FLASH_Debug\Exe\cmock_demo.out + $PROJ_DIR$\FLASH_Debug\Obj\TimerHardware.pbi + $PROJ_DIR$\FLASH_Debug\Obj\TaskScheduler.pbi + $PROJ_DIR$\FLASH_Debug\Obj\TimerModel.pbi + $PROJ_DIR$\FLASH_Debug\Obj\AdcConductor.o + $PROJ_DIR$\FLASH_Debug\Obj\AdcTemperatureSensor.o + $PROJ_DIR$\..\src\AT91SAM7X-EK.h + $PROJ_DIR$\FLASH_Debug\Obj\UsartTransmitBufferStatus.o + $PROJ_DIR$\FLASH_Debug\Obj\AdcHardware.pbi + $PROJ_DIR$\FLASH_Debug\Obj\UsartBaudRateRegisterCalculator.o + $PROJ_DIR$\FLASH_Debug\Obj\ext_irq.o + $PROJ_DIR$\FLASH_Debug\Obj\AdcTemperatureSensor.pbi + $PROJ_DIR$\FLASH_Debug\Obj\TemperatureCalculator.o + $PROJ_DIR$\FLASH_Debug\Obj\TimerHardware.o + $PROJ_DIR$\FLASH_Debug\Obj\UsartModel.o + $PROJ_DIR$\FLASH_Debug\List\UsartConfigurator.lst + $PROJ_DIR$\FLASH_Debug\Obj\TimerConductor.o + $PROJ_DIR$\srcIAR\project.h + $PROJ_DIR$\FLASH_Debug\List\UsartBaudRateRegisterCalculator.lst + $PROJ_DIR$\FLASH_Debug\Obj\AdcHardwareConfigurator.pbi + $PROJ_DIR$\FLASH_Debug\Obj\TimerInterruptHandler.o + $PROJ_DIR$\FLASH_Debug\List\TimerConductor.lst + $PROJ_DIR$\FLASH_Debug\Obj\Cstartup_SAM7.pbi + $PROJ_DIR$\FLASH_Debug\Obj\UsartConductor.pbi + $PROJ_DIR$\FLASH_Debug\Obj\UsartConfigurator.pbi + $PROJ_DIR$\FLASH_Debug\Obj\Executor.o + $PROJ_DIR$\FLASH_Debug\List\AdcHardware.lst + $PROJ_DIR$\FLASH_Debug\Obj\Executor.pbi + $PROJ_DIR$\..\src\interrupt_timer.c + $PROJ_DIR$\..\src\interrupt_Usart.c + $PROJ_DIR$\FLASH_Debug\Obj\TimerInterruptConfigurator.pbi + $PROJ_DIR$\..\src\main.c + $PROJ_DIR$\FLASH_Debug\Obj\TimerConfigurator.o + $PROJ_DIR$\FLASH_Debug\List\AdcTemperatureSensor.lst + $PROJ_DIR$\FLASH_Debug\List\TaskScheduler.lst + $PROJ_DIR$\FLASH_Debug\Obj\interrupt_timer.o + $PROJ_DIR$\FLASH_Debug\List\IntrinsicsWrapper.lst + $PROJ_DIR$\FLASH_Debug\Obj\interrupt_timer.pbi + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + $PROJ_DIR$\..\..\examples\src\AdcModel.c + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + $PROJ_DIR$\..\..\examples\src\Executor.c + $PROJ_DIR$\..\..\examples\src\Main.c + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + $PROJ_DIR$\..\..\examples\src\Model.c + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + $PROJ_DIR$\Resource\at91SAM7X256_FLASH.icf + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + $PROJ_DIR$\..\..\examples\src\TimerModel.c + $PROJ_DIR$\..\..\examples\src\UsartModel.c + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + $PROJ_DIR$\srcIAR\Cstartup.s + $PROJ_DIR$\incIAR\AT91SAM7X-EK.h + $PROJ_DIR$\incIAR\lib_AT91SAM7X256.h + $PROJ_DIR$\incIAR\AT91SAM7X256_inc.h + + + [ROOT_NODE] + + + ILINK + 154 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcTemperatureSensor.c + + + BICOMP + 165 + + + ICCARM + 187 159 + + + + + ICCARM + 28 13 35 + + + + + $PROJ_DIR$\FLASH_Debug\Obj\cmock_demo.pbd + + + BILINK + 112 162 173 131 165 176 181 116 113 156 109 124 125 98 155 184 142 157 119 177 178 136 145 118 111 104 + + + + + $PROJ_DIR$\..\..\test\system\src\Main.c + + + BICOMP + 104 + + + ICCARM + 152 93 + + + + + ICCARM + 28 13 8 39 20 18 27 26 92 41 19 31 17 91 90 36 29 2 7 3 34 38 94 35 37 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcHardwareConfigurator.c + + + BICOMP + 173 + + + ICCARM + 123 122 + + + + + ICCARM + 28 13 94 23 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcConductor.c + + + BICOMP + 112 + + + ICCARM + 110 158 + + + + + ICCARM + 28 13 34 37 38 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcHardware.c + + + BICOMP + 162 + + + ICCARM + 180 117 + + + + + ICCARM + 28 13 38 94 35 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcModel.c + + + BICOMP + 131 + + + ICCARM + 133 106 + + + + + ICCARM + 28 13 37 20 18 27 + + + + + $PROJ_DIR$\..\..\test\system\src\Executor.c + + + BICOMP + 181 + + + ICCARM + 149 179 + + + + + ICCARM + 28 13 8 39 26 90 34 10 22 + + + + + $PROJ_DIR$\..\..\test\system\src\Model.c + + + BICOMP + 113 + + + ICCARM + 105 148 + + + + + ICCARM + 39 28 13 20 27 + + + + + $PROJ_DIR$\..\..\test\system\src\TemperatureFilter.c + + + BICOMP + 124 + + + ICCARM + 141 128 + + + + + ICCARM + 28 13 27 6 22 4 30 0 25 5 47 1 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerConfigurator.c + + + BICOMP + 98 + + + ICCARM + 147 186 + + + + + ICCARM + 28 13 29 2 + + + + + $PROJ_DIR$\..\..\test\system\src\TemperatureCalculator.c + + + BICOMP + 109 + + + ICCARM + 143 166 + + + + + ICCARM + 28 13 18 6 22 4 30 0 25 5 47 1 + + + + + $PROJ_DIR$\..\..\test\system\src\TaskScheduler.c + + + BICOMP + 156 + + + ICCARM + 188 127 + + + + + ICCARM + 28 13 20 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerInterruptConfigurator.c + + + BICOMP + 184 + + + ICCARM + 153 132 + + + + + ICCARM + 28 13 2 7 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerConductor.c + + + BICOMP + 125 + + + ICCARM + 175 170 + + + + + ICCARM + 28 13 90 3 36 7 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerInterruptHandler.c + + + BICOMP + 142 + + + ICCARM + 151 174 + + + + + ICCARM + 28 13 7 2 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartConfigurator.c + + + BICOMP + 178 + + + ICCARM + 169 139 + + + + + ICCARM + 28 13 41 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerHardware.c + + + BICOMP + 155 + + + ICCARM + 95 167 + + + + + ICCARM + 28 13 36 29 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartTransmitBufferStatus.c + + + BICOMP + 111 + + + ICCARM + 144 161 + + + + + ICCARM + 28 13 91 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerModel.c + + + BICOMP + 157 + + + ICCARM + 137 103 + + + + + ICCARM + 28 13 3 20 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartBaudRateRegisterCalculator.c + + + BICOMP + 119 + + + ICCARM + 172 163 + + + + + ICCARM + 28 13 17 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartConductor.c + + + BICOMP + 177 + + + ICCARM + 146 138 + + + + + ICCARM + 28 13 26 92 31 20 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartHardware.c + + + BICOMP + 136 + + + ICCARM + 99 107 + + + + + ICCARM + 28 13 92 41 19 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartModel.c + + + BICOMP + 145 + + + ICCARM + 150 168 + + + + + ICCARM + 28 13 31 23 17 27 24 22 30 0 25 5 47 1 33 6 4 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartPutChar.c + + + BICOMP + 118 + + + ICCARM + 140 108 + + + + + ICCARM + 28 13 19 91 + + + + + $PROJ_DIR$\..\src\ext_irq.c + + + BICOMP + 129 + + + ICCARM + 96 164 + + + + + BICOMP + 171 10 22 160 130 126 + + + ICCARM + 171 10 22 160 130 126 + + + + + $PROJ_DIR$\FLASH_Debug\Exe\cmock_demo.out + + + ILINK + 203 158 117 122 106 159 97 114 179 115 93 148 127 166 128 170 186 167 132 174 103 163 138 139 107 168 108 161 40 32 21 + + + + + $PROJ_DIR$\..\src\interrupt_timer.c + + + BICOMP + 191 + + + ICCARM + 120 189 + + + + + BICOMP + 171 10 22 160 130 126 + + + ICCARM + 171 10 22 160 130 126 + + + + + $PROJ_DIR$\..\src\interrupt_Usart.c + + + BICOMP + 102 + + + ICCARM + 134 101 + + + + + BICOMP + 171 10 22 160 130 126 + + + ICCARM + 171 10 22 160 130 126 + + + + + $PROJ_DIR$\..\src\main.c + + + BICOMP + 104 + + + ICCARM + 152 93 + + + + + BICOMP + 171 10 22 160 130 126 + + + ICCARM + 171 10 22 160 130 126 + + + + + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + + + BICOMP + 176 + + + ICCARM + 121 114 + + + + + BICOMP + 9 10 22 220 221 + + + ICCARM + 9 10 22 220 87 221 + + + + + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + + + BICOMP + 173 + + + ICCARM + 123 122 + + + + + BICOMP + 84 87 83 82 + + + ICCARM + 84 87 83 82 + + + + + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + + + BICOMP + 112 + + + ICCARM + 110 158 + + + + + BICOMP + 84 87 86 72 76 + + + ICCARM + 84 87 86 72 76 + + + + + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + + + BICOMP + 162 + + + ICCARM + 180 117 + + + + + BICOMP + 84 87 76 83 81 + + + ICCARM + 84 87 76 83 81 + + + + + $PROJ_DIR$\..\..\examples\src\AdcModel.c + + + BICOMP + 131 + + + ICCARM + 133 106 + + + + + BICOMP + 84 87 72 88 85 77 + + + ICCARM + 84 87 72 88 85 77 + + + + + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + + + BICOMP + 165 + + + ICCARM + 187 159 + + + + + BICOMP + 84 87 81 + + + ICCARM + 84 87 81 + + + + + $PROJ_DIR$\..\..\examples\src\Executor.c + + + BICOMP + 181 + + + ICCARM + 149 179 + + + + + BICOMP + 84 87 42 57 44 46 86 59 + + + ICCARM + 84 87 42 57 44 46 86 59 + + + + + $PROJ_DIR$\..\..\examples\src\Main.c + + + BICOMP + 104 + + + ICCARM + 152 93 + + + + + BICOMP + 84 87 59 42 57 88 85 77 44 14 15 60 12 11 16 46 89 43 61 55 53 86 76 83 81 72 + + + ICCARM + 84 87 59 42 57 88 85 77 44 14 15 60 12 11 16 46 89 43 61 55 53 86 76 83 81 72 + + + + + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + + + BICOMP + 116 + + + ICCARM + 190 115 + + + + + BICOMP + 59 10 22 + + + ICCARM + 59 10 22 + + + + + $PROJ_DIR$\..\..\examples\src\Model.c + + + BICOMP + 113 + + + ICCARM + 105 148 + + + + + BICOMP + 57 84 87 88 77 + + + ICCARM + 57 84 87 88 77 + + + + + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + + + BICOMP + 109 + + + ICCARM + 143 166 + + + + + BICOMP + 84 87 85 6 22 4 30 0 5 47 1 + + + ICCARM + 84 87 85 6 22 4 30 0 25 5 47 1 + + + + + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + + + BICOMP + 156 + + + ICCARM + 188 127 + + + + + BICOMP + 84 87 88 + + + ICCARM + 84 87 88 + + + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + + + BICOMP + 184 + + + ICCARM + 153 132 + + + + + BICOMP + 84 87 61 55 + + + ICCARM + 84 87 61 55 + + + + + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + + + BICOMP + 124 + + + ICCARM + 141 128 + + + + + BICOMP + 84 87 77 6 22 4 30 0 5 47 1 + + + ICCARM + 84 87 77 6 22 4 30 0 25 5 47 1 + + + + + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + + + BICOMP + 125 + + + ICCARM + 175 170 + + + + + BICOMP + 84 87 46 53 89 55 + + + ICCARM + 84 87 46 53 89 55 + + + + + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + + + BICOMP + 98 + + + ICCARM + 147 186 + + + + + BICOMP + 84 87 43 61 + + + ICCARM + 84 87 43 61 + + + + + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + + + BICOMP + 155 + + + ICCARM + 95 167 + + + + + BICOMP + 84 87 89 43 + + + ICCARM + 84 87 89 43 + + + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + + + BICOMP + 142 + + + ICCARM + 151 174 + + + + + BICOMP + 84 87 55 61 + + + ICCARM + 84 87 55 61 + + + + + $PROJ_DIR$\..\..\examples\src\TimerModel.c + + + BICOMP + 157 + + + ICCARM + 137 103 + + + + + BICOMP + 84 87 53 88 + + + ICCARM + 84 87 53 88 + + + + + $PROJ_DIR$\..\..\examples\src\UsartModel.c + + + BICOMP + 145 + + + ICCARM + 150 168 + + + + + ICCARM + 84 87 12 82 11 77 24 22 30 0 25 5 47 1 33 6 4 + + + + + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + + + BICOMP + 119 + + + ICCARM + 172 163 + + + + + BICOMP + 84 87 11 + + + ICCARM + 84 87 11 + + + + + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + + + BICOMP + 177 + + + ICCARM + 146 138 + + + + + BICOMP + 84 87 44 14 12 88 + + + ICCARM + 84 87 44 14 12 88 + + + + + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + + + BICOMP + 178 + + + ICCARM + 169 139 + + + + + BICOMP + 84 87 15 + + + ICCARM + 84 87 15 + + + + + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + + + BICOMP + 136 + + + ICCARM + 99 107 + + + + + BICOMP + 84 87 14 15 60 + + + ICCARM + 84 87 14 15 60 + + + + + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + + + BICOMP + 111 + + + ICCARM + 144 161 + + + + + ICCARM + 84 87 16 + + + + + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + + + BICOMP + 118 + + + ICCARM + 140 108 + + + + + ICCARM + 84 87 60 16 + + + + + $PROJ_DIR$\srcIAR\Cstartup.s + + + AARM + 97 135 + + + + + AARM + 222 + + + + + + RAM_Debug + + $PROJ_DIR$\Resource\SAM7_FLASH.mac + $TOOLKIT_DIR$\inc\DLib_Defaults.h + $TOOLKIT_DIR$\inc\DLib_Threads.h + $PROJ_DIR$\..\..\test\system\src\TimerInterruptConfigurator.h + $PROJ_DIR$\..\..\test\system\src\TimerModel.h + $TOOLKIT_DIR$\inc\ymath.h + $TOOLKIT_DIR$\inc\DLib_Product.h + $TOOLKIT_DIR$\inc\math.h + $PROJ_DIR$\..\..\test\system\src\TimerInterruptHandler.h + $PROJ_DIR$\..\..\test\system\src\Executor.h + $PROJ_DIR$\incIAR\project.h + $TOOLKIT_DIR$\inc\intrinsics.h + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.h + $PROJ_DIR$\..\..\examples\src\UsartModel.h + $PROJ_DIR$\..\..\test\system\src\AT91SAM7X256.h + $PROJ_DIR$\..\..\examples\src\UsartHardware.h + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.h + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.h + $PROJ_DIR$\..\..\test\system\src\UsartBaudRateRegisterCalculator.h + $PROJ_DIR$\..\..\test\system\src\TemperatureCalculator.h + $PROJ_DIR$\..\..\test\system\src\UsartPutChar.h + $PROJ_DIR$\..\..\test\system\src\TaskScheduler.h + $TOOLKIT_DIR$\lib\dl4t_tl_in.a + $TOOLKIT_DIR$\inc\ycheck.h + $PROJ_DIR$\..\..\test\system\src\ModelConfig.h + $TOOLKIT_DIR$\inc\stdio.h + $TOOLKIT_DIR$\inc\DLib_Config_Normal.h + $PROJ_DIR$\..\..\test\system\src\UsartConductor.h + $PROJ_DIR$\..\..\test\system\src\TemperatureFilter.h + $PROJ_DIR$\..\..\test\system\src\Types.h + $PROJ_DIR$\..\..\test\system\src\TimerConfigurator.h + $TOOLKIT_DIR$\inc\yvals.h + $PROJ_DIR$\..\..\test\system\src\UsartModel.h + $TOOLKIT_DIR$\lib\rt4t_al.a + $TOOLKIT_DIR$\inc\ysizet.h + $PROJ_DIR$\..\..\test\system\src\AdcConductor.h + $PROJ_DIR$\..\..\test\system\src\AdcTemperatureSensor.h + $PROJ_DIR$\..\..\test\system\src\TimerHardware.h + $PROJ_DIR$\..\..\test\system\src\AdcModel.h + $PROJ_DIR$\..\..\test\system\src\AdcHardware.h + $PROJ_DIR$\..\..\test\system\src\Model.h + $TOOLKIT_DIR$\lib\shs_l.a + $PROJ_DIR$\..\..\test\system\src\UsartConfigurator.h + $PROJ_DIR$\..\..\examples\src\Executor.h + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.h + $PROJ_DIR$\..\..\examples\src\UsartConductor.h + $PROJ_DIR$\..\..\test\system\src\AdcTemperatureSensor.c + $PROJ_DIR$\..\..\examples\src\TimerConductor.h + $TOOLKIT_DIR$\inc\xencoding_limits.h + $PROJ_DIR$\..\..\test\system\src\Main.c + $PROJ_DIR$\..\..\test\system\src\AdcHardwareConfigurator.c + $PROJ_DIR$\..\..\test\system\src\AdcConductor.c + $PROJ_DIR$\..\..\test\system\src\AdcHardware.c + $PROJ_DIR$\..\..\examples\src\TimerModel.h + $PROJ_DIR$\..\..\test\system\src\AdcModel.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.h + $PROJ_DIR$\..\..\test\system\src\Executor.c + $PROJ_DIR$\..\..\examples\src\Model.h + $PROJ_DIR$\..\..\test\system\src\Model.c + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.h + $PROJ_DIR$\..\..\examples\src\UsartPutChar.h + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.h + $PROJ_DIR$\..\..\test\system\src\TemperatureFilter.c + $PROJ_DIR$\..\..\test\system\src\TimerConfigurator.c + $PROJ_DIR$\..\..\test\system\src\TemperatureCalculator.c + $PROJ_DIR$\..\..\test\system\src\TaskScheduler.c + $PROJ_DIR$\..\..\test\system\src\TimerInterruptConfigurator.c + $PROJ_DIR$\..\..\test\system\src\TimerConductor.c + $PROJ_DIR$\..\..\test\system\src\TimerInterruptHandler.c + $PROJ_DIR$\..\..\test\system\src\UsartConfigurator.c + $PROJ_DIR$\..\..\test\system\src\TimerHardware.c + $PROJ_DIR$\..\..\test\system\src\UsartTransmitBufferStatus.c + $PROJ_DIR$\..\..\examples\src\AdcModel.h + $PROJ_DIR$\..\..\test\system\src\TimerModel.c + $PROJ_DIR$\..\..\test\system\src\UsartBaudRateRegisterCalculator.c + $PROJ_DIR$\..\..\test\system\src\UsartConductor.c + $PROJ_DIR$\..\..\examples\src\AdcHardware.h + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.h + $PROJ_DIR$\..\..\test\system\src\UsartHardware.c + $PROJ_DIR$\..\..\test\system\src\UsartModel.c + $PROJ_DIR$\..\..\test\system\src\UsartPutChar.c + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.h + $PROJ_DIR$\..\..\examples\src\ModelConfig.h + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.h + $PROJ_DIR$\..\..\examples\src\Types.h + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.h + $PROJ_DIR$\..\..\examples\src\AdcConductor.h + $PROJ_DIR$\..\..\examples\src\AT91SAM7X256.h + $PROJ_DIR$\..\..\examples\src\TaskScheduler.h + $PROJ_DIR$\..\..\examples\src\TimerHardware.h + $PROJ_DIR$\..\..\test\system\src\TimerConductor.h + $PROJ_DIR$\..\..\test\system\src\UsartTransmitBufferStatus.h + $PROJ_DIR$\..\..\test\system\src\UsartHardware.h + $PROJ_DIR$\..\..\test\system\src\AdcHardwareConfigurator.h + $PROJ_DIR$\..\src\ext_irq.c + $PROJ_DIR$\..\src\interrupt_timer.c + $PROJ_DIR$\..\src\interrupt_Usart.c + $PROJ_DIR$\..\src\main.c + $PROJ_DIR$\RAM_Debug\Obj\UsartConductor.o + $PROJ_DIR$\RAM_Debug\List\AdcConductor.lst + $PROJ_DIR$\RAM_Debug\List\TimerInterruptHandler.lst + $PROJ_DIR$\RAM_Debug\List\AdcHardwareConfigurator.lst + $PROJ_DIR$\RAM_Debug\Obj\TimerHardware.pbi + $PROJ_DIR$\RAM_Debug\Obj\UsartHardware.pbi + $PROJ_DIR$\RAM_Debug\Obj\UsartConductor.pbi + $PROJ_DIR$\RAM_Debug\List\TimerConfigurator.lst + $PROJ_DIR$\RAM_Debug\List\UsartPutChar.lst + $PROJ_DIR$\RAM_Debug\Obj\TimerConductor.o + $PROJ_DIR$\RAM_Debug\Obj\TimerConfigurator.o + $PROJ_DIR$\RAM_Debug\Obj\UsartBaudRateRegisterCalculator.pbi + $PROJ_DIR$\RAM_Debug\Obj\AdcHardwareConfigurator.o + $PROJ_DIR$\RAM_Debug\List\AdcModel.lst + $PROJ_DIR$\RAM_Debug\List\TimerConductor.lst + $PROJ_DIR$\RAM_Debug\List\TimerHardware.lst + $PROJ_DIR$\RAM_Debug\Obj\AdcHardware.o + $PROJ_DIR$\RAM_Debug\List\TemperatureFilter.lst + $PROJ_DIR$\RAM_Debug\Obj\AdcModel.pbi + $PROJ_DIR$\RAM_Debug\List\IntrinsicsWrapper.lst + $PROJ_DIR$\RAM_Debug\Obj\Cstartup.o + $PROJ_DIR$\RAM_Debug\Obj\interrupt_Usart.o + $PROJ_DIR$\RAM_Debug\Obj\AdcHardwareConfigurator.pbi + $PROJ_DIR$\RAM_Debug\Obj\main.pbi + $PROJ_DIR$\RAM_Debug\List\AdcTemperatureSensor.lst + $PROJ_DIR$\RAM_Debug\Obj\TimerInterruptHandler.pbi + $PROJ_DIR$\RAM_Debug\List\Model.lst + $PROJ_DIR$\RAM_Debug\Obj\Model.pbi + $PROJ_DIR$\RAM_Debug\Obj\AdcHardware.pbi + $PROJ_DIR$\RAM_Debug\List\UsartBaudRateRegisterCalculator.lst + $PROJ_DIR$\RAM_Debug\Obj\ext_irq.o + $PROJ_DIR$\RAM_Debug\Obj\TimerInterruptHandler.o + $PROJ_DIR$\RAM_Debug\List\Cstartup.lst + $PROJ_DIR$\RAM_Debug\Obj\TimerConfigurator.pbi + $PROJ_DIR$\RAM_Debug\Obj\Cstartup_SAM7.o + $PROJ_DIR$\RAM_Debug\Obj\AdcTemperatureSensor.pbi + $PROJ_DIR$\RAM_Debug\List\UsartConfigurator.lst + $PROJ_DIR$\RAM_Debug\List\UsartTransmitBufferStatus.lst + $PROJ_DIR$\RAM_Debug\Obj\UsartPutChar.pbi + $PROJ_DIR$\RAM_Debug\List\TaskScheduler.lst + $PROJ_DIR$\RAM_Debug\Obj\interrupt_timer.pbi + $PROJ_DIR$\RAM_Debug\List\UsartHardware.lst + $PROJ_DIR$\RAM_Debug\Obj\TaskScheduler.pbi + $PROJ_DIR$\RAM_Debug\Obj\Cstartup_SAM7.pbi + $PROJ_DIR$\RAM_Debug\List\Cstartup_SAM7.lst + $PROJ_DIR$\RAM_Debug\Obj\UsartTransmitBufferStatus.o + $PROJ_DIR$\RAM_Debug\Obj\TimerModel.pbi + $PROJ_DIR$\RAM_Debug\List\UsartConductor.lst + $PROJ_DIR$\RAM_Debug\Obj\UsartPutChar.o + $PROJ_DIR$\RAM_Debug\Obj\TimerInterruptConfigurator.pbi + $PROJ_DIR$\RAM_Debug\Obj\TimerHardware.o + $PROJ_DIR$\RAM_Debug\Obj\AdcTemperatureSensor.o + $PROJ_DIR$\RAM_Debug\Obj\AdcModel.o + $PROJ_DIR$\RAM_Debug\Obj\Executor.pbi + $PROJ_DIR$\RAM_Debug\Obj\TemperatureFilter.o + $PROJ_DIR$\RAM_Debug\Obj\AdcConductor.pbi + $PROJ_DIR$\RAM_Debug\List\TimerInterruptConfigurator.lst + $PROJ_DIR$\RAM_Debug\List\UsartModel.lst + $PROJ_DIR$\RAM_Debug\Obj\UsartConfigurator.o + $PROJ_DIR$\RAM_Debug\Obj\cmock_demo.pbd + $PROJ_DIR$\RAM_Debug\Exe\cmock_demo.out + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + $PROJ_DIR$\RAM_Debug\List\TemperatureCalculator.lst + $PROJ_DIR$\RAM_Debug\List\AdcHardware.lst + $PROJ_DIR$\RAM_Debug\List\Executor.lst + $PROJ_DIR$\RAM_Debug\Obj\UsartModel.pbi + $PROJ_DIR$\RAM_Debug\Obj\TimerConductor.pbi + $PROJ_DIR$\RAM_Debug\Obj\UsartConfigurator.pbi + $PROJ_DIR$\RAM_Debug\Obj\UsartHardware.o + $PROJ_DIR$\RAM_Debug\Obj\TemperatureCalculator.o + $PROJ_DIR$\RAM_Debug\Obj\AdcConductor.o + $PROJ_DIR$\RAM_Debug\Obj\IntrinsicsWrapper.o + $PROJ_DIR$\RAM_Debug\Obj\Model.o + $PROJ_DIR$\RAM_Debug\Obj\UsartTransmitBufferStatus.pbi + $PROJ_DIR$\RAM_Debug\Obj\TimerModel.o + $PROJ_DIR$\RAM_Debug\Obj\Executor.o + $PROJ_DIR$\RAM_Debug\Obj\TemperatureCalculator.pbi + $PROJ_DIR$\RAM_Debug\Obj\UsartBaudRateRegisterCalculator.o + $PROJ_DIR$\RAM_Debug\Obj\TimerInterruptConfigurator.o + $PROJ_DIR$\RAM_Debug\Obj\interrupt_Usart.pbi + $PROJ_DIR$\RAM_Debug\Obj\TaskScheduler.o + $PROJ_DIR$\RAM_Debug\Obj\Main.o + $PROJ_DIR$\RAM_Debug\Obj\ext_irq.pbi + $PROJ_DIR$\RAM_Debug\List\Main.lst + $PROJ_DIR$\RAM_Debug\List\TimerModel.lst + $PROJ_DIR$\RAM_Debug\Obj\interrupt_timer.o + $PROJ_DIR$\RAM_Debug\Obj\UsartModel.o + $PROJ_DIR$\RAM_Debug\Obj\TemperatureFilter.pbi + $PROJ_DIR$\RAM_Debug\Obj\IntrinsicsWrapper.pbi + $PROJ_DIR$\Resource\at91SAM7X256_RAM.icf + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + $PROJ_DIR$\..\..\examples\src\AdcModel.c + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + $PROJ_DIR$\..\..\examples\src\Executor.c + $PROJ_DIR$\..\..\examples\src\Main.c + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + $PROJ_DIR$\..\..\examples\src\Model.c + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + $PROJ_DIR$\Resource\SAM7_RAM.mac + $PROJ_DIR$\Resource\at91SAM7X256_FLASH.icf + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + $PROJ_DIR$\..\..\examples\src\TimerModel.c + $PROJ_DIR$\..\..\examples\src\UsartModel.c + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + $PROJ_DIR$\srcIAR\Cstartup.s + $PROJ_DIR$\incIAR\AT91SAM7X-EK.h + $PROJ_DIR$\incIAR\lib_AT91SAM7X256.h + $PROJ_DIR$\incIAR\AT91SAM7X256_inc.h + + + [ROOT_NODE] + + + ILINK + 158 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcTemperatureSensor.c + + + BICOMP + 133 + + + ICCARM + 122 149 + + + + + BICOMP + 29 14 36 + + + ICCARM + 29 14 36 + + + + + $PROJ_DIR$\..\..\test\system\src\Main.c + + + BICOMP + 121 + + + ICCARM + 181 179 + + + + + BICOMP + 29 14 9 40 21 19 28 27 92 42 20 32 18 91 90 37 30 3 8 4 35 39 93 36 38 + + + ICCARM + 29 14 9 40 21 19 28 27 92 42 20 32 18 91 90 37 30 3 8 4 35 39 93 36 38 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcHardwareConfigurator.c + + + BICOMP + 120 + + + ICCARM + 101 110 + + + + + BICOMP + 29 14 93 24 + + + ICCARM + 29 14 93 24 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcConductor.c + + + BICOMP + 153 + + + ICCARM + 99 168 + + + + + BICOMP + 29 14 35 38 39 + + + ICCARM + 29 14 35 38 39 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcHardware.c + + + BICOMP + 126 + + + ICCARM + 161 114 + + + + + BICOMP + 29 14 39 93 36 + + + ICCARM + 29 14 39 93 36 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcModel.c + + + BICOMP + 116 + + + ICCARM + 111 150 + + + + + BICOMP + 29 14 38 21 19 28 + + + ICCARM + 29 14 38 21 19 28 + + + + + $PROJ_DIR$\..\..\test\system\src\Executor.c + + + BICOMP + 151 + + + ICCARM + 162 173 + + + + + BICOMP + 29 14 9 40 27 90 35 11 23 + + + ICCARM + 29 14 9 40 27 90 35 11 23 + + + + + $PROJ_DIR$\..\..\test\system\src\Model.c + + + BICOMP + 125 + + + ICCARM + 124 170 + + + + + BICOMP + 40 29 14 21 28 + + + ICCARM + 40 29 14 21 28 + + + + + $PROJ_DIR$\..\..\test\system\src\TemperatureFilter.c + + + BICOMP + 185 + + + ICCARM + 115 152 + + + + + BICOMP + 29 14 28 7 23 5 31 1 6 48 2 + + + ICCARM + 29 14 28 7 23 5 31 1 26 6 48 2 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerConfigurator.c + + + BICOMP + 131 + + + ICCARM + 105 108 + + + + + BICOMP + 29 14 30 3 + + + ICCARM + 29 14 30 3 + + + + + $PROJ_DIR$\..\..\test\system\src\TemperatureCalculator.c + + + BICOMP + 174 + + + ICCARM + 160 167 + + + + + BICOMP + 29 14 19 7 23 5 31 1 6 48 2 + + + ICCARM + 29 14 19 7 23 5 31 1 26 6 48 2 + + + + + $PROJ_DIR$\..\..\test\system\src\TaskScheduler.c + + + BICOMP + 140 + + + ICCARM + 137 178 + + + + + BICOMP + 29 14 21 + + + ICCARM + 29 14 21 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerInterruptConfigurator.c + + + BICOMP + 147 + + + ICCARM + 154 176 + + + + + BICOMP + 29 14 3 8 + + + ICCARM + 29 14 3 8 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerConductor.c + + + BICOMP + 164 + + + ICCARM + 112 107 + + + + + BICOMP + 29 14 90 4 37 8 + + + ICCARM + 29 14 90 4 37 8 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerInterruptHandler.c + + + BICOMP + 123 + + + ICCARM + 100 129 + + + + + BICOMP + 29 14 8 3 + + + ICCARM + 29 14 8 3 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartConfigurator.c + + + BICOMP + 165 + + + ICCARM + 134 156 + + + + + BICOMP + 29 14 42 + + + ICCARM + 29 14 42 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerHardware.c + + + BICOMP + 102 + + + ICCARM + 113 148 + + + + + BICOMP + 29 14 37 30 + + + ICCARM + 29 14 37 30 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartTransmitBufferStatus.c + + + BICOMP + 171 + + + ICCARM + 135 143 + + + + + BICOMP + 29 14 91 + + + ICCARM + 29 14 91 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerModel.c + + + BICOMP + 144 + + + ICCARM + 182 172 + + + + + BICOMP + 29 14 4 21 + + + ICCARM + 29 14 4 21 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartBaudRateRegisterCalculator.c + + + BICOMP + 109 + + + ICCARM + 127 175 + + + + + BICOMP + 29 14 18 + + + ICCARM + 29 14 18 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartConductor.c + + + BICOMP + 104 + + + ICCARM + 145 98 + + + + + BICOMP + 29 14 27 92 32 21 + + + ICCARM + 29 14 27 92 32 21 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartHardware.c + + + BICOMP + 103 + + + ICCARM + 139 166 + + + + + BICOMP + 29 14 92 42 20 + + + ICCARM + 29 14 92 42 20 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartModel.c + + + BICOMP + 163 + + + ICCARM + 155 184 + + + + + BICOMP + 29 14 32 24 18 28 25 23 31 1 6 48 2 34 7 5 + + + ICCARM + 29 14 32 24 18 28 25 23 31 1 26 6 48 2 34 7 5 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartPutChar.c + + + BICOMP + 136 + + + ICCARM + 106 146 + + + + + BICOMP + 29 14 20 91 + + + ICCARM + 29 14 20 91 + + + + + $PROJ_DIR$\..\src\ext_irq.c + + + BICOMP + 180 + + + ICCARM + 128 + + + + + $PROJ_DIR$\..\src\interrupt_timer.c + + + BICOMP + 138 + + + ICCARM + 183 + + + + + $PROJ_DIR$\..\src\interrupt_Usart.c + + + BICOMP + 177 + + + ICCARM + 119 + + + + + $PROJ_DIR$\..\src\main.c + + + BICOMP + 121 + + + ICCARM + 179 + + + + + $PROJ_DIR$\RAM_Debug\Obj\cmock_demo.pbd + + + BILINK + 153 126 120 116 133 141 151 186 125 140 174 185 164 131 102 147 123 144 109 104 165 103 163 136 171 121 + + + + + $PROJ_DIR$\RAM_Debug\Exe\cmock_demo.out + + + ILINK + 187 168 114 110 150 149 118 132 173 169 179 170 178 167 152 107 108 148 176 129 172 175 98 156 166 184 146 143 41 33 22 + + + + + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + + + BICOMP + 141 + + + ICCARM + 142 132 + + + + + BICOMP + 10 11 23 216 87 217 + + + ICCARM + 10 11 23 216 87 217 + + + + + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + + + BICOMP + 120 + + + ICCARM + 101 110 + + + + + BICOMP + 84 87 83 82 + + + ICCARM + 84 87 83 82 + + + + + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + + + BICOMP + 153 + + + ICCARM + 99 168 + + + + + BICOMP + 84 87 86 72 76 + + + ICCARM + 84 87 86 72 76 + + + + + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + + + BICOMP + 126 + + + ICCARM + 161 114 + + + + + BICOMP + 84 87 76 83 81 + + + ICCARM + 84 87 76 83 81 + + + + + $PROJ_DIR$\..\..\examples\src\AdcModel.c + + + BICOMP + 116 + + + ICCARM + 111 150 + + + + + BICOMP + 84 87 72 88 85 77 + + + ICCARM + 84 87 72 88 85 77 + + + + + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + + + BICOMP + 133 + + + ICCARM + 122 149 + + + + + BICOMP + 84 87 81 + + + ICCARM + 84 87 81 + + + + + $PROJ_DIR$\..\..\examples\src\Executor.c + + + BICOMP + 151 + + + ICCARM + 162 173 + + + + + BICOMP + 84 87 43 57 45 47 86 59 + + + ICCARM + 84 87 43 57 45 47 86 59 + + + + + $PROJ_DIR$\..\..\examples\src\Main.c + + + BICOMP + 121 + + + ICCARM + 181 179 + + + + + BICOMP + 84 87 59 43 57 88 85 77 45 15 16 60 13 12 17 47 89 44 61 55 53 86 76 83 81 72 + + + ICCARM + 84 87 59 43 57 88 85 77 45 15 16 60 13 12 17 47 89 44 61 55 53 86 76 83 81 72 + + + + + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + + + BICOMP + 186 + + + ICCARM + 117 169 + + + + + BICOMP + 59 11 23 + + + ICCARM + 59 11 23 + + + + + $PROJ_DIR$\..\..\examples\src\Model.c + + + BICOMP + 125 + + + ICCARM + 124 170 + + + + + BICOMP + 57 84 87 88 77 + + + ICCARM + 57 84 87 88 77 + + + + + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + + + BICOMP + 174 + + + ICCARM + 160 167 + + + + + BICOMP + 84 87 85 7 23 5 31 1 6 48 2 + + + ICCARM + 84 87 85 7 23 5 31 1 26 6 48 2 + + + + + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + + + BICOMP + 140 + + + ICCARM + 137 178 + + + + + BICOMP + 84 87 88 + + + ICCARM + 84 87 88 + + + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + + + BICOMP + 147 + + + ICCARM + 154 176 + + + + + BICOMP + 84 87 61 55 + + + ICCARM + 84 87 61 55 + + + + + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + + + BICOMP + 185 + + + ICCARM + 115 152 + + + + + BICOMP + 84 87 77 7 23 5 31 1 6 48 2 + + + ICCARM + 84 87 77 7 23 5 31 1 26 6 48 2 + + + + + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + + + BICOMP + 164 + + + ICCARM + 112 107 + + + + + BICOMP + 84 87 47 53 89 55 + + + ICCARM + 84 87 47 53 89 55 + + + + + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + + + BICOMP + 131 + + + ICCARM + 105 108 + + + + + BICOMP + 84 87 44 61 + + + ICCARM + 84 87 44 61 + + + + + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + + + BICOMP + 102 + + + ICCARM + 113 148 + + + + + BICOMP + 84 87 89 44 + + + ICCARM + 84 87 89 44 + + + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + + + BICOMP + 123 + + + ICCARM + 100 129 + + + + + BICOMP + 84 87 55 61 + + + ICCARM + 84 87 55 61 + + + + + $PROJ_DIR$\..\..\examples\src\TimerModel.c + + + BICOMP + 144 + + + ICCARM + 182 172 + + + + + BICOMP + 84 87 53 88 + + + ICCARM + 84 87 53 88 + + + + + $PROJ_DIR$\..\..\examples\src\UsartModel.c + + + BICOMP + 163 + + + ICCARM + 155 184 + + + + + BICOMP + 84 87 13 82 12 77 25 23 31 1 6 48 2 34 7 5 + + + ICCARM + 84 87 13 82 12 77 25 23 31 1 26 6 48 2 34 7 5 + + + + + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + + + BICOMP + 109 + + + ICCARM + 127 175 + + + + + BICOMP + 84 87 12 + + + ICCARM + 84 87 12 + + + + + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + + + BICOMP + 104 + + + ICCARM + 145 98 + + + + + BICOMP + 84 87 45 15 13 88 + + + ICCARM + 84 87 45 15 13 88 + + + + + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + + + BICOMP + 165 + + + ICCARM + 134 156 + + + + + BICOMP + 84 87 16 + + + ICCARM + 84 87 16 + + + + + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + + + BICOMP + 103 + + + ICCARM + 139 166 + + + + + BICOMP + 84 87 15 16 60 + + + ICCARM + 84 87 15 16 60 + + + + + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + + + BICOMP + 171 + + + ICCARM + 135 143 + + + + + BICOMP + 84 87 17 + + + ICCARM + 84 87 17 + + + + + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + + + BICOMP + 136 + + + ICCARM + 106 146 + + + + + BICOMP + 84 87 60 17 + + + ICCARM + 84 87 60 17 + + + + + $PROJ_DIR$\srcIAR\Cstartup.s + + + AARM + 118 130 + + + + + AARM + 218 + + + + + $PROJ_DIR$\..\src\ext_irq.c + ICCARM + + + $PROJ_DIR$\..\src\interrupt_timer.c + ICCARM + + + $PROJ_DIR$\..\src\interrupt_Usart.c + ICCARM + + + $PROJ_DIR$\..\src\main.c + ICCARM + + + + + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/cmock_demo.ewd b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/cmock_demo.ewd new file mode 100644 index 0000000..27cc8e9 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/cmock_demo.ewd @@ -0,0 +1,1906 @@ + + + + 2 + + RAM_Debug + + ARM + + 1 + + C-SPY + 2 + + 18 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 1 + + + + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + JLINK_ID + 2 + + 10 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + MACRAIGOR_ID + 2 + + 3 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin + 1 + + + + + FLASH_Debug + + ARM + + 1 + + C-SPY + 2 + + 18 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 1 + + + + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + JLINK_ID + 2 + + 10 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + MACRAIGOR_ID + 2 + + 3 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin + 1 + + + + + Binary + + ARM + + 1 + + C-SPY + 2 + + 18 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 1 + + + + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + JLINK_ID + 2 + + 10 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + MACRAIGOR_ID + 2 + + 3 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin + 1 + + + + + + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/cmock_demo.ewp b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/cmock_demo.ewp new file mode 100644 index 0000000..4524d91 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/cmock_demo.ewp @@ -0,0 +1,2426 @@ + + + + 2 + + RAM_Debug + + ARM + + 1 + + General + 3 + + 16 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 20 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + ILINK + 0 + + 6 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + FLASH_Debug + + ARM + + 1 + + General + 3 + + 16 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 20 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + ILINK + 0 + + 6 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + Binary + + ARM + + 1 + + General + 3 + + 16 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 20 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + ILINK + 0 + + 6 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + Binary + + + Resource + + $PROJ_DIR$\Resource\at91SAM7X256_FLASH.icf + + + $PROJ_DIR$\Resource\at91SAM7X256_RAM.icf + + + $PROJ_DIR$\Resource\SAM7_FLASH.mac + + + $PROJ_DIR$\Resource\SAM7_RAM.mac + + + + Source + + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + + + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + + + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + + + $PROJ_DIR$\..\..\examples\src\AdcModel.c + + + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + + + $PROJ_DIR$\..\..\examples\src\Executor.c + + + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + + + $PROJ_DIR$\..\..\examples\src\Main.c + + + $PROJ_DIR$\..\..\examples\src\Model.c + + + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + + + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + + + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + + + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + + + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + + + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + + + $PROJ_DIR$\..\..\examples\src\TimerModel.c + + + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + + + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + + + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + + + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + + + $PROJ_DIR$\..\..\examples\src\UsartModel.c + + + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + + + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + + + + Startup + + $PROJ_DIR$\srcIAR\Cstartup.s + + + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + + + + + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/cmock_demo.eww b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/cmock_demo.eww new file mode 100644 index 0000000..a299a5d --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/cmock_demo.eww @@ -0,0 +1,26 @@ + + + + + $WS_DIR$\cmock_demo.ewp + + + + All + + cmock_demo + Binary + + + cmock_demo + FLASH_Debug + + + cmock_demo + RAM_Debug + + + + + + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/incIAR/AT91SAM7X-EK.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/incIAR/AT91SAM7X-EK.h new file mode 100644 index 0000000..9834675 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/incIAR/AT91SAM7X-EK.h @@ -0,0 +1,61 @@ +// ---------------------------------------------------------------------------- +// ATMEL Microcontroller Software Support - ROUSSET - +// ---------------------------------------------------------------------------- +// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// ---------------------------------------------------------------------------- +// File Name : AT91SAM7X-EK.h +// Object : AT91SAM7X-EK Evaluation Board Features Definition File +// +// ---------------------------------------------------------------------------- + +#ifndef AT91SAM7X_EK_H +#define AT91SAM7X_EK_H + +/*-----------------*/ +/* LEDs Definition */ +/*-----------------*/ +#define AT91B_LED1 (1<<19) // AT91C_PIO_PB19 AT91C_PB19_PWM0 AT91C_PB19_TCLK1 +#define AT91B_LED2 (1<<20) // AT91C_PIO_PB20 AT91C_PB20_PWM1 AT91C_PB20_PWM1 +#define AT91B_LED3 (AT91C_PIO_PB21) // AT91C_PIO_PB21 AT91C_PB21_PWM2 AT91C_PB21_PCK1 +#define AT91B_LED4 (AT91C_PIO_PB22) // AT91C_PIO_PB22 AT91C_PB22_PWM3 AT91C_PB22_PCK2 +#define AT91B_NB_LEB 4 +#define AT91B_LED_MASK (AT91B_LED1|AT91B_LED2|AT91B_LED3|AT91B_LED4) +#define AT91D_BASE_PIO_LED (AT91C_BASE_PIOB) + +#define AT91B_POWERLED (1<<25) // PB25 + + +/*-------------------------------*/ +/* JOYSTICK Position Definition */ +/*-------------------------------*/ +#define AT91B_SW1 (1<<21) // PA21 Up Button AT91C_PA21_TF AT91C_PA21_NPCS10 +#define AT91B_SW2 (1<<22) // PA22 Down Button AT91C_PA22_TK AT91C_PA22_SPCK1 +#define AT91B_SW3 (1<<23) // PA23 Left Button AT91C_PA23_TD AT91C_PA23_MOSI1 +#define AT91B_SW4 (1<<24) // PA24 Right Button AT91C_PA24_RD AT91C_PA24_MISO1 +#define AT91B_SW5 (1<<25) // PA25 Push Button AT91C_PA25_RK AT91C_PA25_NPCS11 +#define AT91B_SW_MASK (AT91B_SW1|AT91B_SW2|AT91B_SW3|AT91B_SW4|AT91B_SW5) + + +#define AT91D_BASE_PIO_SW (AT91C_BASE_PIOA) + +/*------------------*/ +/* CAN Definition */ +/*------------------*/ +#define AT91B_CAN_TRANSCEIVER_RS (1<<2) // PA2 + +/*--------------*/ +/* Clocks */ +/*--------------*/ +#define AT91B_MAIN_OSC 18432000 // Main Oscillator MAINCK +#define AT91B_MCK ((18432000*73/14)/2) // Output PLL Clock + +#endif /* AT91SAM7X-EK_H */ diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/incIAR/AT91SAM7X256_inc.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/incIAR/AT91SAM7X256_inc.h new file mode 100644 index 0000000..18e58d4 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/incIAR/AT91SAM7X256_inc.h @@ -0,0 +1,2268 @@ +// ---------------------------------------------------------------------------- +// ATMEL Microcontroller Software Support - ROUSSET - +// ---------------------------------------------------------------------------- +// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// ---------------------------------------------------------------------------- +// File Name : AT91SAM7X256.h +// Object : AT91SAM7X256 definitions +// Generated : AT91 SW Application Group 01/16/2006 (16:36:22) +// +// CVS Reference : /AT91SAM7X256.pl/1.15/Wed Nov 2 13:56:49 2005// +// CVS Reference : /SYS_SAM7X.pl/1.3/Tue Feb 1 17:01:43 2005// +// CVS Reference : /MC_SAM7X.pl/1.2/Fri May 20 14:13:04 2005// +// CVS Reference : /PMC_SAM7X.pl/1.4/Tue Feb 8 13:58:10 2005// +// CVS Reference : /RSTC_SAM7X.pl/1.2/Wed Jul 13 14:57:50 2005// +// CVS Reference : /UDP_SAM7X.pl/1.1/Tue May 10 11:35:35 2005// +// CVS Reference : /PWM_SAM7X.pl/1.1/Tue May 10 11:53:07 2005// +// CVS Reference : /AIC_6075B.pl/1.3/Fri May 20 14:01:30 2005// +// CVS Reference : /PIO_6057A.pl/1.2/Thu Feb 3 10:18:28 2005// +// CVS Reference : /RTTC_6081A.pl/1.2/Tue Nov 9 14:43:58 2004// +// CVS Reference : /PITC_6079A.pl/1.2/Tue Nov 9 14:43:56 2004// +// CVS Reference : /WDTC_6080A.pl/1.3/Tue Nov 9 14:44:00 2004// +// CVS Reference : /VREG_6085B.pl/1.1/Tue Feb 1 16:05:48 2005// +// CVS Reference : /PDC_6074C.pl/1.2/Thu Feb 3 08:48:54 2005// +// CVS Reference : /DBGU_6059D.pl/1.1/Mon Jan 31 13:15:32 2005// +// CVS Reference : /SPI_6088D.pl/1.3/Fri May 20 14:08:59 2005// +// CVS Reference : /US_6089C.pl/1.1/Mon Jul 12 18:23:26 2004// +// CVS Reference : /SSC_6078B.pl/1.1/Wed Jul 13 15:19:19 2005// +// CVS Reference : /TWI_6061A.pl/1.1/Tue Jul 13 07:38:06 2004// +// CVS Reference : /TC_6082A.pl/1.7/Fri Mar 11 12:52:17 2005// +// CVS Reference : /CAN_6019B.pl/1.1/Tue Mar 8 12:42:22 2005// +// CVS Reference : /EMACB_6119A.pl/1.6/Wed Jul 13 15:05:35 2005// +// CVS Reference : /ADC_6051C.pl/1.1/Fri Oct 17 09:12:38 2003// +// ---------------------------------------------------------------------------- + +// Hardware register definition + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR System Peripherals +// ***************************************************************************** + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Advanced Interrupt Controller +// ***************************************************************************** +// *** Register offset in AT91S_AIC structure *** +#define AIC_SMR ( 0) // Source Mode Register +#define AIC_SVR (128) // Source Vector Register +#define AIC_IVR (256) // IRQ Vector Register +#define AIC_FVR (260) // FIQ Vector Register +#define AIC_ISR (264) // Interrupt Status Register +#define AIC_IPR (268) // Interrupt Pending Register +#define AIC_IMR (272) // Interrupt Mask Register +#define AIC_CISR (276) // Core Interrupt Status Register +#define AIC_IECR (288) // Interrupt Enable Command Register +#define AIC_IDCR (292) // Interrupt Disable Command Register +#define AIC_ICCR (296) // Interrupt Clear Command Register +#define AIC_ISCR (300) // Interrupt Set Command Register +#define AIC_EOICR (304) // End of Interrupt Command Register +#define AIC_SPU (308) // Spurious Vector Register +#define AIC_DCR (312) // Debug Control Register (Protect) +#define AIC_FFER (320) // Fast Forcing Enable Register +#define AIC_FFDR (324) // Fast Forcing Disable Register +#define AIC_FFSR (328) // Fast Forcing Status Register +// -------- AIC_SMR : (AIC Offset: 0x0) Control Register -------- +#define AT91C_AIC_PRIOR (0x7 << 0) // (AIC) Priority Level +#define AT91C_AIC_PRIOR_LOWEST (0x0) // (AIC) Lowest priority level +#define AT91C_AIC_PRIOR_HIGHEST (0x7) // (AIC) Highest priority level +#define AT91C_AIC_SRCTYPE (0x3 << 5) // (AIC) Interrupt Source Type +#define AT91C_AIC_SRCTYPE_EXT_LOW_LEVEL (0x0 << 5) // (AIC) External Sources Code Label Low-level Sensitive +#define AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL (0x0 << 5) // (AIC) Internal Sources Code Label High-level Sensitive +#define AT91C_AIC_SRCTYPE_INT_POSITIVE_EDGE (0x1 << 5) // (AIC) Internal Sources Code Label Positive Edge triggered +#define AT91C_AIC_SRCTYPE_EXT_NEGATIVE_EDGE (0x1 << 5) // (AIC) External Sources Code Label Negative Edge triggered +#define AT91C_AIC_SRCTYPE_HIGH_LEVEL (0x2 << 5) // (AIC) Internal Or External Sources Code Label High-level Sensitive +#define AT91C_AIC_SRCTYPE_POSITIVE_EDGE (0x3 << 5) // (AIC) Internal Or External Sources Code Label Positive Edge triggered +// -------- AIC_CISR : (AIC Offset: 0x114) AIC Core Interrupt Status Register -------- +#define AT91C_AIC_NFIQ (0x1 << 0) // (AIC) NFIQ Status +#define AT91C_AIC_NIRQ (0x1 << 1) // (AIC) NIRQ Status +// -------- AIC_DCR : (AIC Offset: 0x138) AIC Debug Control Register (Protect) -------- +#define AT91C_AIC_DCR_PROT (0x1 << 0) // (AIC) Protection Mode +#define AT91C_AIC_DCR_GMSK (0x1 << 1) // (AIC) General Mask + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Peripheral DMA Controller +// ***************************************************************************** +// *** Register offset in AT91S_PDC structure *** +#define PDC_RPR ( 0) // Receive Pointer Register +#define PDC_RCR ( 4) // Receive Counter Register +#define PDC_TPR ( 8) // Transmit Pointer Register +#define PDC_TCR (12) // Transmit Counter Register +#define PDC_RNPR (16) // Receive Next Pointer Register +#define PDC_RNCR (20) // Receive Next Counter Register +#define PDC_TNPR (24) // Transmit Next Pointer Register +#define PDC_TNCR (28) // Transmit Next Counter Register +#define PDC_PTCR (32) // PDC Transfer Control Register +#define PDC_PTSR (36) // PDC Transfer Status Register +// -------- PDC_PTCR : (PDC Offset: 0x20) PDC Transfer Control Register -------- +#define AT91C_PDC_RXTEN (0x1 << 0) // (PDC) Receiver Transfer Enable +#define AT91C_PDC_RXTDIS (0x1 << 1) // (PDC) Receiver Transfer Disable +#define AT91C_PDC_TXTEN (0x1 << 8) // (PDC) Transmitter Transfer Enable +#define AT91C_PDC_TXTDIS (0x1 << 9) // (PDC) Transmitter Transfer Disable +// -------- PDC_PTSR : (PDC Offset: 0x24) PDC Transfer Status Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Debug Unit +// ***************************************************************************** +// *** Register offset in AT91S_DBGU structure *** +#define DBGU_CR ( 0) // Control Register +#define DBGU_MR ( 4) // Mode Register +#define DBGU_IER ( 8) // Interrupt Enable Register +#define DBGU_IDR (12) // Interrupt Disable Register +#define DBGU_IMR (16) // Interrupt Mask Register +#define DBGU_CSR (20) // Channel Status Register +#define DBGU_RHR (24) // Receiver Holding Register +#define DBGU_THR (28) // Transmitter Holding Register +#define DBGU_BRGR (32) // Baud Rate Generator Register +#define DBGU_CIDR (64) // Chip ID Register +#define DBGU_EXID (68) // Chip ID Extension Register +#define DBGU_FNTR (72) // Force NTRST Register +#define DBGU_RPR (256) // Receive Pointer Register +#define DBGU_RCR (260) // Receive Counter Register +#define DBGU_TPR (264) // Transmit Pointer Register +#define DBGU_TCR (268) // Transmit Counter Register +#define DBGU_RNPR (272) // Receive Next Pointer Register +#define DBGU_RNCR (276) // Receive Next Counter Register +#define DBGU_TNPR (280) // Transmit Next Pointer Register +#define DBGU_TNCR (284) // Transmit Next Counter Register +#define DBGU_PTCR (288) // PDC Transfer Control Register +#define DBGU_PTSR (292) // PDC Transfer Status Register +// -------- DBGU_CR : (DBGU Offset: 0x0) Debug Unit Control Register -------- +#define AT91C_US_RSTRX (0x1 << 2) // (DBGU) Reset Receiver +#define AT91C_US_RSTTX (0x1 << 3) // (DBGU) Reset Transmitter +#define AT91C_US_RXEN (0x1 << 4) // (DBGU) Receiver Enable +#define AT91C_US_RXDIS (0x1 << 5) // (DBGU) Receiver Disable +#define AT91C_US_TXEN (0x1 << 6) // (DBGU) Transmitter Enable +#define AT91C_US_TXDIS (0x1 << 7) // (DBGU) Transmitter Disable +#define AT91C_US_RSTSTA (0x1 << 8) // (DBGU) Reset Status Bits +// -------- DBGU_MR : (DBGU Offset: 0x4) Debug Unit Mode Register -------- +#define AT91C_US_PAR (0x7 << 9) // (DBGU) Parity type +#define AT91C_US_PAR_EVEN (0x0 << 9) // (DBGU) Even Parity +#define AT91C_US_PAR_ODD (0x1 << 9) // (DBGU) Odd Parity +#define AT91C_US_PAR_SPACE (0x2 << 9) // (DBGU) Parity forced to 0 (Space) +#define AT91C_US_PAR_MARK (0x3 << 9) // (DBGU) Parity forced to 1 (Mark) +#define AT91C_US_PAR_NONE (0x4 << 9) // (DBGU) No Parity +#define AT91C_US_PAR_MULTI_DROP (0x6 << 9) // (DBGU) Multi-drop mode +#define AT91C_US_CHMODE (0x3 << 14) // (DBGU) Channel Mode +#define AT91C_US_CHMODE_NORMAL (0x0 << 14) // (DBGU) Normal Mode: The USART channel operates as an RX/TX USART. +#define AT91C_US_CHMODE_AUTO (0x1 << 14) // (DBGU) Automatic Echo: Receiver Data Input is connected to the TXD pin. +#define AT91C_US_CHMODE_LOCAL (0x2 << 14) // (DBGU) Local Loopback: Transmitter Output Signal is connected to Receiver Input Signal. +#define AT91C_US_CHMODE_REMOTE (0x3 << 14) // (DBGU) Remote Loopback: RXD pin is internally connected to TXD pin. +// -------- DBGU_IER : (DBGU Offset: 0x8) Debug Unit Interrupt Enable Register -------- +#define AT91C_US_RXRDY (0x1 << 0) // (DBGU) RXRDY Interrupt +#define AT91C_US_TXRDY (0x1 << 1) // (DBGU) TXRDY Interrupt +#define AT91C_US_ENDRX (0x1 << 3) // (DBGU) End of Receive Transfer Interrupt +#define AT91C_US_ENDTX (0x1 << 4) // (DBGU) End of Transmit Interrupt +#define AT91C_US_OVRE (0x1 << 5) // (DBGU) Overrun Interrupt +#define AT91C_US_FRAME (0x1 << 6) // (DBGU) Framing Error Interrupt +#define AT91C_US_PARE (0x1 << 7) // (DBGU) Parity Error Interrupt +#define AT91C_US_TXEMPTY (0x1 << 9) // (DBGU) TXEMPTY Interrupt +#define AT91C_US_TXBUFE (0x1 << 11) // (DBGU) TXBUFE Interrupt +#define AT91C_US_RXBUFF (0x1 << 12) // (DBGU) RXBUFF Interrupt +#define AT91C_US_COMM_TX (0x1 << 30) // (DBGU) COMM_TX Interrupt +#define AT91C_US_COMM_RX (0x1 << 31) // (DBGU) COMM_RX Interrupt +// -------- DBGU_IDR : (DBGU Offset: 0xc) Debug Unit Interrupt Disable Register -------- +// -------- DBGU_IMR : (DBGU Offset: 0x10) Debug Unit Interrupt Mask Register -------- +// -------- DBGU_CSR : (DBGU Offset: 0x14) Debug Unit Channel Status Register -------- +// -------- DBGU_FNTR : (DBGU Offset: 0x48) Debug Unit FORCE_NTRST Register -------- +#define AT91C_US_FORCE_NTRST (0x1 << 0) // (DBGU) Force NTRST in JTAG + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Parallel Input Output Controler +// ***************************************************************************** +// *** Register offset in AT91S_PIO structure *** +#define PIO_PER ( 0) // PIO Enable Register +#define PIO_PDR ( 4) // PIO Disable Register +#define PIO_PSR ( 8) // PIO Status Register +#define PIO_OER (16) // Output Enable Register +#define PIO_ODR (20) // Output Disable Registerr +#define PIO_OSR (24) // Output Status Register +#define PIO_IFER (32) // Input Filter Enable Register +#define PIO_IFDR (36) // Input Filter Disable Register +#define PIO_IFSR (40) // Input Filter Status Register +#define PIO_SODR (48) // Set Output Data Register +#define PIO_CODR (52) // Clear Output Data Register +#define PIO_ODSR (56) // Output Data Status Register +#define PIO_PDSR (60) // Pin Data Status Register +#define PIO_IER (64) // Interrupt Enable Register +#define PIO_IDR (68) // Interrupt Disable Register +#define PIO_IMR (72) // Interrupt Mask Register +#define PIO_ISR (76) // Interrupt Status Register +#define PIO_MDER (80) // Multi-driver Enable Register +#define PIO_MDDR (84) // Multi-driver Disable Register +#define PIO_MDSR (88) // Multi-driver Status Register +#define PIO_PPUDR (96) // Pull-up Disable Register +#define PIO_PPUER (100) // Pull-up Enable Register +#define PIO_PPUSR (104) // Pull-up Status Register +#define PIO_ASR (112) // Select A Register +#define PIO_BSR (116) // Select B Register +#define PIO_ABSR (120) // AB Select Status Register +#define PIO_OWER (160) // Output Write Enable Register +#define PIO_OWDR (164) // Output Write Disable Register +#define PIO_OWSR (168) // Output Write Status Register + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Clock Generator Controler +// ***************************************************************************** +// *** Register offset in AT91S_CKGR structure *** +#define CKGR_MOR ( 0) // Main Oscillator Register +#define CKGR_MCFR ( 4) // Main Clock Frequency Register +#define CKGR_PLLR (12) // PLL Register +// -------- CKGR_MOR : (CKGR Offset: 0x0) Main Oscillator Register -------- +#define AT91C_CKGR_MOSCEN (0x1 << 0) // (CKGR) Main Oscillator Enable +#define AT91C_CKGR_OSCBYPASS (0x1 << 1) // (CKGR) Main Oscillator Bypass +#define AT91C_CKGR_OSCOUNT (0xFF << 8) // (CKGR) Main Oscillator Start-up Time +// -------- CKGR_MCFR : (CKGR Offset: 0x4) Main Clock Frequency Register -------- +#define AT91C_CKGR_MAINF (0xFFFF << 0) // (CKGR) Main Clock Frequency +#define AT91C_CKGR_MAINRDY (0x1 << 16) // (CKGR) Main Clock Ready +// -------- CKGR_PLLR : (CKGR Offset: 0xc) PLL B Register -------- +#define AT91C_CKGR_DIV (0xFF << 0) // (CKGR) Divider Selected +#define AT91C_CKGR_DIV_0 (0x0) // (CKGR) Divider output is 0 +#define AT91C_CKGR_DIV_BYPASS (0x1) // (CKGR) Divider is bypassed +#define AT91C_CKGR_PLLCOUNT (0x3F << 8) // (CKGR) PLL Counter +#define AT91C_CKGR_OUT (0x3 << 14) // (CKGR) PLL Output Frequency Range +#define AT91C_CKGR_OUT_0 (0x0 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_OUT_1 (0x1 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_OUT_2 (0x2 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_OUT_3 (0x3 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_MUL (0x7FF << 16) // (CKGR) PLL Multiplier +#define AT91C_CKGR_USBDIV (0x3 << 28) // (CKGR) Divider for USB Clocks +#define AT91C_CKGR_USBDIV_0 (0x0 << 28) // (CKGR) Divider output is PLL clock output +#define AT91C_CKGR_USBDIV_1 (0x1 << 28) // (CKGR) Divider output is PLL clock output divided by 2 +#define AT91C_CKGR_USBDIV_2 (0x2 << 28) // (CKGR) Divider output is PLL clock output divided by 4 + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Power Management Controler +// ***************************************************************************** +// *** Register offset in AT91S_PMC structure *** +#define PMC_SCER ( 0) // System Clock Enable Register +#define PMC_SCDR ( 4) // System Clock Disable Register +#define PMC_SCSR ( 8) // System Clock Status Register +#define PMC_PCER (16) // Peripheral Clock Enable Register +#define PMC_PCDR (20) // Peripheral Clock Disable Register +#define PMC_PCSR (24) // Peripheral Clock Status Register +#define PMC_MOR (32) // Main Oscillator Register +#define PMC_MCFR (36) // Main Clock Frequency Register +#define PMC_PLLR (44) // PLL Register +#define PMC_MCKR (48) // Master Clock Register +#define PMC_PCKR (64) // Programmable Clock Register +#define PMC_IER (96) // Interrupt Enable Register +#define PMC_IDR (100) // Interrupt Disable Register +#define PMC_SR (104) // Status Register +#define PMC_IMR (108) // Interrupt Mask Register +// -------- PMC_SCER : (PMC Offset: 0x0) System Clock Enable Register -------- +#define AT91C_PMC_PCK (0x1 << 0) // (PMC) Processor Clock +#define AT91C_PMC_UDP (0x1 << 7) // (PMC) USB Device Port Clock +#define AT91C_PMC_PCK0 (0x1 << 8) // (PMC) Programmable Clock Output +#define AT91C_PMC_PCK1 (0x1 << 9) // (PMC) Programmable Clock Output +#define AT91C_PMC_PCK2 (0x1 << 10) // (PMC) Programmable Clock Output +#define AT91C_PMC_PCK3 (0x1 << 11) // (PMC) Programmable Clock Output +// -------- PMC_SCDR : (PMC Offset: 0x4) System Clock Disable Register -------- +// -------- PMC_SCSR : (PMC Offset: 0x8) System Clock Status Register -------- +// -------- CKGR_MOR : (PMC Offset: 0x20) Main Oscillator Register -------- +// -------- CKGR_MCFR : (PMC Offset: 0x24) Main Clock Frequency Register -------- +// -------- CKGR_PLLR : (PMC Offset: 0x2c) PLL B Register -------- +// -------- PMC_MCKR : (PMC Offset: 0x30) Master Clock Register -------- +#define AT91C_PMC_CSS (0x3 << 0) // (PMC) Programmable Clock Selection +#define AT91C_PMC_CSS_SLOW_CLK (0x0) // (PMC) Slow Clock is selected +#define AT91C_PMC_CSS_MAIN_CLK (0x1) // (PMC) Main Clock is selected +#define AT91C_PMC_CSS_PLL_CLK (0x3) // (PMC) Clock from PLL is selected +#define AT91C_PMC_PRES (0x7 << 2) // (PMC) Programmable Clock Prescaler +#define AT91C_PMC_PRES_CLK (0x0 << 2) // (PMC) Selected clock +#define AT91C_PMC_PRES_CLK_2 (0x1 << 2) // (PMC) Selected clock divided by 2 +#define AT91C_PMC_PRES_CLK_4 (0x2 << 2) // (PMC) Selected clock divided by 4 +#define AT91C_PMC_PRES_CLK_8 (0x3 << 2) // (PMC) Selected clock divided by 8 +#define AT91C_PMC_PRES_CLK_16 (0x4 << 2) // (PMC) Selected clock divided by 16 +#define AT91C_PMC_PRES_CLK_32 (0x5 << 2) // (PMC) Selected clock divided by 32 +#define AT91C_PMC_PRES_CLK_64 (0x6 << 2) // (PMC) Selected clock divided by 64 +// -------- PMC_PCKR : (PMC Offset: 0x40) Programmable Clock Register -------- +// -------- PMC_IER : (PMC Offset: 0x60) PMC Interrupt Enable Register -------- +#define AT91C_PMC_MOSCS (0x1 << 0) // (PMC) MOSC Status/Enable/Disable/Mask +#define AT91C_PMC_LOCK (0x1 << 2) // (PMC) PLL Status/Enable/Disable/Mask +#define AT91C_PMC_MCKRDY (0x1 << 3) // (PMC) MCK_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK0RDY (0x1 << 8) // (PMC) PCK0_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK1RDY (0x1 << 9) // (PMC) PCK1_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK2RDY (0x1 << 10) // (PMC) PCK2_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK3RDY (0x1 << 11) // (PMC) PCK3_RDY Status/Enable/Disable/Mask +// -------- PMC_IDR : (PMC Offset: 0x64) PMC Interrupt Disable Register -------- +// -------- PMC_SR : (PMC Offset: 0x68) PMC Status Register -------- +// -------- PMC_IMR : (PMC Offset: 0x6c) PMC Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Reset Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_RSTC structure *** +#define RSTC_RCR ( 0) // Reset Control Register +#define RSTC_RSR ( 4) // Reset Status Register +#define RSTC_RMR ( 8) // Reset Mode Register +// -------- RSTC_RCR : (RSTC Offset: 0x0) Reset Control Register -------- +#define AT91C_RSTC_PROCRST (0x1 << 0) // (RSTC) Processor Reset +#define AT91C_RSTC_PERRST (0x1 << 2) // (RSTC) Peripheral Reset +#define AT91C_RSTC_EXTRST (0x1 << 3) // (RSTC) External Reset +#define AT91C_RSTC_KEY (0xFF << 24) // (RSTC) Password +// -------- RSTC_RSR : (RSTC Offset: 0x4) Reset Status Register -------- +#define AT91C_RSTC_URSTS (0x1 << 0) // (RSTC) User Reset Status +#define AT91C_RSTC_BODSTS (0x1 << 1) // (RSTC) Brownout Detection Status +#define AT91C_RSTC_RSTTYP (0x7 << 8) // (RSTC) Reset Type +#define AT91C_RSTC_RSTTYP_POWERUP (0x0 << 8) // (RSTC) Power-up Reset. VDDCORE rising. +#define AT91C_RSTC_RSTTYP_WAKEUP (0x1 << 8) // (RSTC) WakeUp Reset. VDDCORE rising. +#define AT91C_RSTC_RSTTYP_WATCHDOG (0x2 << 8) // (RSTC) Watchdog Reset. Watchdog overflow occured. +#define AT91C_RSTC_RSTTYP_SOFTWARE (0x3 << 8) // (RSTC) Software Reset. Processor reset required by the software. +#define AT91C_RSTC_RSTTYP_USER (0x4 << 8) // (RSTC) User Reset. NRST pin detected low. +#define AT91C_RSTC_RSTTYP_BROWNOUT (0x5 << 8) // (RSTC) Brownout Reset occured. +#define AT91C_RSTC_NRSTL (0x1 << 16) // (RSTC) NRST pin level +#define AT91C_RSTC_SRCMP (0x1 << 17) // (RSTC) Software Reset Command in Progress. +// -------- RSTC_RMR : (RSTC Offset: 0x8) Reset Mode Register -------- +#define AT91C_RSTC_URSTEN (0x1 << 0) // (RSTC) User Reset Enable +#define AT91C_RSTC_URSTIEN (0x1 << 4) // (RSTC) User Reset Interrupt Enable +#define AT91C_RSTC_ERSTL (0xF << 8) // (RSTC) User Reset Length +#define AT91C_RSTC_BODIEN (0x1 << 16) // (RSTC) Brownout Detection Interrupt Enable + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Real Time Timer Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_RTTC structure *** +#define RTTC_RTMR ( 0) // Real-time Mode Register +#define RTTC_RTAR ( 4) // Real-time Alarm Register +#define RTTC_RTVR ( 8) // Real-time Value Register +#define RTTC_RTSR (12) // Real-time Status Register +// -------- RTTC_RTMR : (RTTC Offset: 0x0) Real-time Mode Register -------- +#define AT91C_RTTC_RTPRES (0xFFFF << 0) // (RTTC) Real-time Timer Prescaler Value +#define AT91C_RTTC_ALMIEN (0x1 << 16) // (RTTC) Alarm Interrupt Enable +#define AT91C_RTTC_RTTINCIEN (0x1 << 17) // (RTTC) Real Time Timer Increment Interrupt Enable +#define AT91C_RTTC_RTTRST (0x1 << 18) // (RTTC) Real Time Timer Restart +// -------- RTTC_RTAR : (RTTC Offset: 0x4) Real-time Alarm Register -------- +#define AT91C_RTTC_ALMV (0x0 << 0) // (RTTC) Alarm Value +// -------- RTTC_RTVR : (RTTC Offset: 0x8) Current Real-time Value Register -------- +#define AT91C_RTTC_CRTV (0x0 << 0) // (RTTC) Current Real-time Value +// -------- RTTC_RTSR : (RTTC Offset: 0xc) Real-time Status Register -------- +#define AT91C_RTTC_ALMS (0x1 << 0) // (RTTC) Real-time Alarm Status +#define AT91C_RTTC_RTTINC (0x1 << 1) // (RTTC) Real-time Timer Increment + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Periodic Interval Timer Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_PITC structure *** +#define PITC_PIMR ( 0) // Period Interval Mode Register +#define PITC_PISR ( 4) // Period Interval Status Register +#define PITC_PIVR ( 8) // Period Interval Value Register +#define PITC_PIIR (12) // Period Interval Image Register +// -------- PITC_PIMR : (PITC Offset: 0x0) Periodic Interval Mode Register -------- +#define AT91C_PITC_PIV (0xFFFFF << 0) // (PITC) Periodic Interval Value +#define AT91C_PITC_PITEN (0x1 << 24) // (PITC) Periodic Interval Timer Enabled +#define AT91C_PITC_PITIEN (0x1 << 25) // (PITC) Periodic Interval Timer Interrupt Enable +// -------- PITC_PISR : (PITC Offset: 0x4) Periodic Interval Status Register -------- +#define AT91C_PITC_PITS (0x1 << 0) // (PITC) Periodic Interval Timer Status +// -------- PITC_PIVR : (PITC Offset: 0x8) Periodic Interval Value Register -------- +#define AT91C_PITC_CPIV (0xFFFFF << 0) // (PITC) Current Periodic Interval Value +#define AT91C_PITC_PICNT (0xFFF << 20) // (PITC) Periodic Interval Counter +// -------- PITC_PIIR : (PITC Offset: 0xc) Periodic Interval Image Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Watchdog Timer Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_WDTC structure *** +#define WDTC_WDCR ( 0) // Watchdog Control Register +#define WDTC_WDMR ( 4) // Watchdog Mode Register +#define WDTC_WDSR ( 8) // Watchdog Status Register +// -------- WDTC_WDCR : (WDTC Offset: 0x0) Periodic Interval Image Register -------- +#define AT91C_WDTC_WDRSTT (0x1 << 0) // (WDTC) Watchdog Restart +#define AT91C_WDTC_KEY (0xFF << 24) // (WDTC) Watchdog KEY Password +// -------- WDTC_WDMR : (WDTC Offset: 0x4) Watchdog Mode Register -------- +#define AT91C_WDTC_WDV (0xFFF << 0) // (WDTC) Watchdog Timer Restart +#define AT91C_WDTC_WDFIEN (0x1 << 12) // (WDTC) Watchdog Fault Interrupt Enable +#define AT91C_WDTC_WDRSTEN (0x1 << 13) // (WDTC) Watchdog Reset Enable +#define AT91C_WDTC_WDRPROC (0x1 << 14) // (WDTC) Watchdog Timer Restart +#define AT91C_WDTC_WDDIS (0x1 << 15) // (WDTC) Watchdog Disable +#define AT91C_WDTC_WDD (0xFFF << 16) // (WDTC) Watchdog Delta Value +#define AT91C_WDTC_WDDBGHLT (0x1 << 28) // (WDTC) Watchdog Debug Halt +#define AT91C_WDTC_WDIDLEHLT (0x1 << 29) // (WDTC) Watchdog Idle Halt +// -------- WDTC_WDSR : (WDTC Offset: 0x8) Watchdog Status Register -------- +#define AT91C_WDTC_WDUNF (0x1 << 0) // (WDTC) Watchdog Underflow +#define AT91C_WDTC_WDERR (0x1 << 1) // (WDTC) Watchdog Error + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Voltage Regulator Mode Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_VREG structure *** +#define VREG_MR ( 0) // Voltage Regulator Mode Register +// -------- VREG_MR : (VREG Offset: 0x0) Voltage Regulator Mode Register -------- +#define AT91C_VREG_PSTDBY (0x1 << 0) // (VREG) Voltage Regulator Power Standby Mode + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Memory Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_MC structure *** +#define MC_RCR ( 0) // MC Remap Control Register +#define MC_ASR ( 4) // MC Abort Status Register +#define MC_AASR ( 8) // MC Abort Address Status Register +#define MC_FMR (96) // MC Flash Mode Register +#define MC_FCR (100) // MC Flash Command Register +#define MC_FSR (104) // MC Flash Status Register +// -------- MC_RCR : (MC Offset: 0x0) MC Remap Control Register -------- +#define AT91C_MC_RCB (0x1 << 0) // (MC) Remap Command Bit +// -------- MC_ASR : (MC Offset: 0x4) MC Abort Status Register -------- +#define AT91C_MC_UNDADD (0x1 << 0) // (MC) Undefined Addess Abort Status +#define AT91C_MC_MISADD (0x1 << 1) // (MC) Misaligned Addess Abort Status +#define AT91C_MC_ABTSZ (0x3 << 8) // (MC) Abort Size Status +#define AT91C_MC_ABTSZ_BYTE (0x0 << 8) // (MC) Byte +#define AT91C_MC_ABTSZ_HWORD (0x1 << 8) // (MC) Half-word +#define AT91C_MC_ABTSZ_WORD (0x2 << 8) // (MC) Word +#define AT91C_MC_ABTTYP (0x3 << 10) // (MC) Abort Type Status +#define AT91C_MC_ABTTYP_DATAR (0x0 << 10) // (MC) Data Read +#define AT91C_MC_ABTTYP_DATAW (0x1 << 10) // (MC) Data Write +#define AT91C_MC_ABTTYP_FETCH (0x2 << 10) // (MC) Code Fetch +#define AT91C_MC_MST0 (0x1 << 16) // (MC) Master 0 Abort Source +#define AT91C_MC_MST1 (0x1 << 17) // (MC) Master 1 Abort Source +#define AT91C_MC_SVMST0 (0x1 << 24) // (MC) Saved Master 0 Abort Source +#define AT91C_MC_SVMST1 (0x1 << 25) // (MC) Saved Master 1 Abort Source +// -------- MC_FMR : (MC Offset: 0x60) MC Flash Mode Register -------- +#define AT91C_MC_FRDY (0x1 << 0) // (MC) Flash Ready +#define AT91C_MC_LOCKE (0x1 << 2) // (MC) Lock Error +#define AT91C_MC_PROGE (0x1 << 3) // (MC) Programming Error +#define AT91C_MC_NEBP (0x1 << 7) // (MC) No Erase Before Programming +#define AT91C_MC_FWS (0x3 << 8) // (MC) Flash Wait State +#define AT91C_MC_FWS_0FWS (0x0 << 8) // (MC) 1 cycle for Read, 2 for Write operations +#define AT91C_MC_FWS_1FWS (0x1 << 8) // (MC) 2 cycles for Read, 3 for Write operations +#define AT91C_MC_FWS_2FWS (0x2 << 8) // (MC) 3 cycles for Read, 4 for Write operations +#define AT91C_MC_FWS_3FWS (0x3 << 8) // (MC) 4 cycles for Read, 4 for Write operations +#define AT91C_MC_FMCN (0xFF << 16) // (MC) Flash Microsecond Cycle Number +// -------- MC_FCR : (MC Offset: 0x64) MC Flash Command Register -------- +#define AT91C_MC_FCMD (0xF << 0) // (MC) Flash Command +#define AT91C_MC_FCMD_START_PROG (0x1) // (MC) Starts the programming of th epage specified by PAGEN. +#define AT91C_MC_FCMD_LOCK (0x2) // (MC) Starts a lock sequence of the sector defined by the bits 4 to 7 of the field PAGEN. +#define AT91C_MC_FCMD_PROG_AND_LOCK (0x3) // (MC) The lock sequence automatically happens after the programming sequence is completed. +#define AT91C_MC_FCMD_UNLOCK (0x4) // (MC) Starts an unlock sequence of the sector defined by the bits 4 to 7 of the field PAGEN. +#define AT91C_MC_FCMD_ERASE_ALL (0x8) // (MC) Starts the erase of the entire flash.If at least a page is locked, the command is cancelled. +#define AT91C_MC_FCMD_SET_GP_NVM (0xB) // (MC) Set General Purpose NVM bits. +#define AT91C_MC_FCMD_CLR_GP_NVM (0xD) // (MC) Clear General Purpose NVM bits. +#define AT91C_MC_FCMD_SET_SECURITY (0xF) // (MC) Set Security Bit. +#define AT91C_MC_PAGEN (0x3FF << 8) // (MC) Page Number +#define AT91C_MC_KEY (0xFF << 24) // (MC) Writing Protect Key +// -------- MC_FSR : (MC Offset: 0x68) MC Flash Command Register -------- +#define AT91C_MC_SECURITY (0x1 << 4) // (MC) Security Bit Status +#define AT91C_MC_GPNVM0 (0x1 << 8) // (MC) Sector 0 Lock Status +#define AT91C_MC_GPNVM1 (0x1 << 9) // (MC) Sector 1 Lock Status +#define AT91C_MC_GPNVM2 (0x1 << 10) // (MC) Sector 2 Lock Status +#define AT91C_MC_GPNVM3 (0x1 << 11) // (MC) Sector 3 Lock Status +#define AT91C_MC_GPNVM4 (0x1 << 12) // (MC) Sector 4 Lock Status +#define AT91C_MC_GPNVM5 (0x1 << 13) // (MC) Sector 5 Lock Status +#define AT91C_MC_GPNVM6 (0x1 << 14) // (MC) Sector 6 Lock Status +#define AT91C_MC_GPNVM7 (0x1 << 15) // (MC) Sector 7 Lock Status +#define AT91C_MC_LOCKS0 (0x1 << 16) // (MC) Sector 0 Lock Status +#define AT91C_MC_LOCKS1 (0x1 << 17) // (MC) Sector 1 Lock Status +#define AT91C_MC_LOCKS2 (0x1 << 18) // (MC) Sector 2 Lock Status +#define AT91C_MC_LOCKS3 (0x1 << 19) // (MC) Sector 3 Lock Status +#define AT91C_MC_LOCKS4 (0x1 << 20) // (MC) Sector 4 Lock Status +#define AT91C_MC_LOCKS5 (0x1 << 21) // (MC) Sector 5 Lock Status +#define AT91C_MC_LOCKS6 (0x1 << 22) // (MC) Sector 6 Lock Status +#define AT91C_MC_LOCKS7 (0x1 << 23) // (MC) Sector 7 Lock Status +#define AT91C_MC_LOCKS8 (0x1 << 24) // (MC) Sector 8 Lock Status +#define AT91C_MC_LOCKS9 (0x1 << 25) // (MC) Sector 9 Lock Status +#define AT91C_MC_LOCKS10 (0x1 << 26) // (MC) Sector 10 Lock Status +#define AT91C_MC_LOCKS11 (0x1 << 27) // (MC) Sector 11 Lock Status +#define AT91C_MC_LOCKS12 (0x1 << 28) // (MC) Sector 12 Lock Status +#define AT91C_MC_LOCKS13 (0x1 << 29) // (MC) Sector 13 Lock Status +#define AT91C_MC_LOCKS14 (0x1 << 30) // (MC) Sector 14 Lock Status +#define AT91C_MC_LOCKS15 (0x1 << 31) // (MC) Sector 15 Lock Status + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Serial Parallel Interface +// ***************************************************************************** +// *** Register offset in AT91S_SPI structure *** +#define SPI_CR ( 0) // Control Register +#define SPI_MR ( 4) // Mode Register +#define SPI_RDR ( 8) // Receive Data Register +#define SPI_TDR (12) // Transmit Data Register +#define SPI_SR (16) // Status Register +#define SPI_IER (20) // Interrupt Enable Register +#define SPI_IDR (24) // Interrupt Disable Register +#define SPI_IMR (28) // Interrupt Mask Register +#define SPI_CSR (48) // Chip Select Register +#define SPI_RPR (256) // Receive Pointer Register +#define SPI_RCR (260) // Receive Counter Register +#define SPI_TPR (264) // Transmit Pointer Register +#define SPI_TCR (268) // Transmit Counter Register +#define SPI_RNPR (272) // Receive Next Pointer Register +#define SPI_RNCR (276) // Receive Next Counter Register +#define SPI_TNPR (280) // Transmit Next Pointer Register +#define SPI_TNCR (284) // Transmit Next Counter Register +#define SPI_PTCR (288) // PDC Transfer Control Register +#define SPI_PTSR (292) // PDC Transfer Status Register +// -------- SPI_CR : (SPI Offset: 0x0) SPI Control Register -------- +#define AT91C_SPI_SPIEN (0x1 << 0) // (SPI) SPI Enable +#define AT91C_SPI_SPIDIS (0x1 << 1) // (SPI) SPI Disable +#define AT91C_SPI_SWRST (0x1 << 7) // (SPI) SPI Software reset +#define AT91C_SPI_LASTXFER (0x1 << 24) // (SPI) SPI Last Transfer +// -------- SPI_MR : (SPI Offset: 0x4) SPI Mode Register -------- +#define AT91C_SPI_MSTR (0x1 << 0) // (SPI) Master/Slave Mode +#define AT91C_SPI_PS (0x1 << 1) // (SPI) Peripheral Select +#define AT91C_SPI_PS_FIXED (0x0 << 1) // (SPI) Fixed Peripheral Select +#define AT91C_SPI_PS_VARIABLE (0x1 << 1) // (SPI) Variable Peripheral Select +#define AT91C_SPI_PCSDEC (0x1 << 2) // (SPI) Chip Select Decode +#define AT91C_SPI_FDIV (0x1 << 3) // (SPI) Clock Selection +#define AT91C_SPI_MODFDIS (0x1 << 4) // (SPI) Mode Fault Detection +#define AT91C_SPI_LLB (0x1 << 7) // (SPI) Clock Selection +#define AT91C_SPI_PCS (0xF << 16) // (SPI) Peripheral Chip Select +#define AT91C_SPI_DLYBCS (0xFF << 24) // (SPI) Delay Between Chip Selects +// -------- SPI_RDR : (SPI Offset: 0x8) Receive Data Register -------- +#define AT91C_SPI_RD (0xFFFF << 0) // (SPI) Receive Data +#define AT91C_SPI_RPCS (0xF << 16) // (SPI) Peripheral Chip Select Status +// -------- SPI_TDR : (SPI Offset: 0xc) Transmit Data Register -------- +#define AT91C_SPI_TD (0xFFFF << 0) // (SPI) Transmit Data +#define AT91C_SPI_TPCS (0xF << 16) // (SPI) Peripheral Chip Select Status +// -------- SPI_SR : (SPI Offset: 0x10) Status Register -------- +#define AT91C_SPI_RDRF (0x1 << 0) // (SPI) Receive Data Register Full +#define AT91C_SPI_TDRE (0x1 << 1) // (SPI) Transmit Data Register Empty +#define AT91C_SPI_MODF (0x1 << 2) // (SPI) Mode Fault Error +#define AT91C_SPI_OVRES (0x1 << 3) // (SPI) Overrun Error Status +#define AT91C_SPI_ENDRX (0x1 << 4) // (SPI) End of Receiver Transfer +#define AT91C_SPI_ENDTX (0x1 << 5) // (SPI) End of Receiver Transfer +#define AT91C_SPI_RXBUFF (0x1 << 6) // (SPI) RXBUFF Interrupt +#define AT91C_SPI_TXBUFE (0x1 << 7) // (SPI) TXBUFE Interrupt +#define AT91C_SPI_NSSR (0x1 << 8) // (SPI) NSSR Interrupt +#define AT91C_SPI_TXEMPTY (0x1 << 9) // (SPI) TXEMPTY Interrupt +#define AT91C_SPI_SPIENS (0x1 << 16) // (SPI) Enable Status +// -------- SPI_IER : (SPI Offset: 0x14) Interrupt Enable Register -------- +// -------- SPI_IDR : (SPI Offset: 0x18) Interrupt Disable Register -------- +// -------- SPI_IMR : (SPI Offset: 0x1c) Interrupt Mask Register -------- +// -------- SPI_CSR : (SPI Offset: 0x30) Chip Select Register -------- +#define AT91C_SPI_CPOL (0x1 << 0) // (SPI) Clock Polarity +#define AT91C_SPI_NCPHA (0x1 << 1) // (SPI) Clock Phase +#define AT91C_SPI_CSAAT (0x1 << 3) // (SPI) Chip Select Active After Transfer +#define AT91C_SPI_BITS (0xF << 4) // (SPI) Bits Per Transfer +#define AT91C_SPI_BITS_8 (0x0 << 4) // (SPI) 8 Bits Per transfer +#define AT91C_SPI_BITS_9 (0x1 << 4) // (SPI) 9 Bits Per transfer +#define AT91C_SPI_BITS_10 (0x2 << 4) // (SPI) 10 Bits Per transfer +#define AT91C_SPI_BITS_11 (0x3 << 4) // (SPI) 11 Bits Per transfer +#define AT91C_SPI_BITS_12 (0x4 << 4) // (SPI) 12 Bits Per transfer +#define AT91C_SPI_BITS_13 (0x5 << 4) // (SPI) 13 Bits Per transfer +#define AT91C_SPI_BITS_14 (0x6 << 4) // (SPI) 14 Bits Per transfer +#define AT91C_SPI_BITS_15 (0x7 << 4) // (SPI) 15 Bits Per transfer +#define AT91C_SPI_BITS_16 (0x8 << 4) // (SPI) 16 Bits Per transfer +#define AT91C_SPI_SCBR (0xFF << 8) // (SPI) Serial Clock Baud Rate +#define AT91C_SPI_DLYBS (0xFF << 16) // (SPI) Delay Before SPCK +#define AT91C_SPI_DLYBCT (0xFF << 24) // (SPI) Delay Between Consecutive Transfers + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Usart +// ***************************************************************************** +// *** Register offset in AT91S_USART structure *** +#define US_CR ( 0) // Control Register +#define US_MR ( 4) // Mode Register +#define US_IER ( 8) // Interrupt Enable Register +#define US_IDR (12) // Interrupt Disable Register +#define US_IMR (16) // Interrupt Mask Register +#define US_CSR (20) // Channel Status Register +#define US_RHR (24) // Receiver Holding Register +#define US_THR (28) // Transmitter Holding Register +#define US_BRGR (32) // Baud Rate Generator Register +#define US_RTOR (36) // Receiver Time-out Register +#define US_TTGR (40) // Transmitter Time-guard Register +#define US_FIDI (64) // FI_DI_Ratio Register +#define US_NER (68) // Nb Errors Register +#define US_IF (76) // IRDA_FILTER Register +#define US_RPR (256) // Receive Pointer Register +#define US_RCR (260) // Receive Counter Register +#define US_TPR (264) // Transmit Pointer Register +#define US_TCR (268) // Transmit Counter Register +#define US_RNPR (272) // Receive Next Pointer Register +#define US_RNCR (276) // Receive Next Counter Register +#define US_TNPR (280) // Transmit Next Pointer Register +#define US_TNCR (284) // Transmit Next Counter Register +#define US_PTCR (288) // PDC Transfer Control Register +#define US_PTSR (292) // PDC Transfer Status Register +// -------- US_CR : (USART Offset: 0x0) Debug Unit Control Register -------- +#define AT91C_US_STTBRK (0x1 << 9) // (USART) Start Break +#define AT91C_US_STPBRK (0x1 << 10) // (USART) Stop Break +#define AT91C_US_STTTO (0x1 << 11) // (USART) Start Time-out +#define AT91C_US_SENDA (0x1 << 12) // (USART) Send Address +#define AT91C_US_RSTIT (0x1 << 13) // (USART) Reset Iterations +#define AT91C_US_RSTNACK (0x1 << 14) // (USART) Reset Non Acknowledge +#define AT91C_US_RETTO (0x1 << 15) // (USART) Rearm Time-out +#define AT91C_US_DTREN (0x1 << 16) // (USART) Data Terminal ready Enable +#define AT91C_US_DTRDIS (0x1 << 17) // (USART) Data Terminal ready Disable +#define AT91C_US_RTSEN (0x1 << 18) // (USART) Request to Send enable +#define AT91C_US_RTSDIS (0x1 << 19) // (USART) Request to Send Disable +// -------- US_MR : (USART Offset: 0x4) Debug Unit Mode Register -------- +#define AT91C_US_USMODE (0xF << 0) // (USART) Usart mode +#define AT91C_US_USMODE_NORMAL (0x0) // (USART) Normal +#define AT91C_US_USMODE_RS485 (0x1) // (USART) RS485 +#define AT91C_US_USMODE_HWHSH (0x2) // (USART) Hardware Handshaking +#define AT91C_US_USMODE_MODEM (0x3) // (USART) Modem +#define AT91C_US_USMODE_ISO7816_0 (0x4) // (USART) ISO7816 protocol: T = 0 +#define AT91C_US_USMODE_ISO7816_1 (0x6) // (USART) ISO7816 protocol: T = 1 +#define AT91C_US_USMODE_IRDA (0x8) // (USART) IrDA +#define AT91C_US_USMODE_SWHSH (0xC) // (USART) Software Handshaking +#define AT91C_US_CLKS (0x3 << 4) // (USART) Clock Selection (Baud Rate generator Input Clock +#define AT91C_US_CLKS_CLOCK (0x0 << 4) // (USART) Clock +#define AT91C_US_CLKS_FDIV1 (0x1 << 4) // (USART) fdiv1 +#define AT91C_US_CLKS_SLOW (0x2 << 4) // (USART) slow_clock (ARM) +#define AT91C_US_CLKS_EXT (0x3 << 4) // (USART) External (SCK) +#define AT91C_US_CHRL (0x3 << 6) // (USART) Clock Selection (Baud Rate generator Input Clock +#define AT91C_US_CHRL_5_BITS (0x0 << 6) // (USART) Character Length: 5 bits +#define AT91C_US_CHRL_6_BITS (0x1 << 6) // (USART) Character Length: 6 bits +#define AT91C_US_CHRL_7_BITS (0x2 << 6) // (USART) Character Length: 7 bits +#define AT91C_US_CHRL_8_BITS (0x3 << 6) // (USART) Character Length: 8 bits +#define AT91C_US_SYNC (0x1 << 8) // (USART) Synchronous Mode Select +#define AT91C_US_NBSTOP (0x3 << 12) // (USART) Number of Stop bits +#define AT91C_US_NBSTOP_1_BIT (0x0 << 12) // (USART) 1 stop bit +#define AT91C_US_NBSTOP_15_BIT (0x1 << 12) // (USART) Asynchronous (SYNC=0) 2 stop bits Synchronous (SYNC=1) 2 stop bits +#define AT91C_US_NBSTOP_2_BIT (0x2 << 12) // (USART) 2 stop bits +#define AT91C_US_MSBF (0x1 << 16) // (USART) Bit Order +#define AT91C_US_MODE9 (0x1 << 17) // (USART) 9-bit Character length +#define AT91C_US_CKLO (0x1 << 18) // (USART) Clock Output Select +#define AT91C_US_OVER (0x1 << 19) // (USART) Over Sampling Mode +#define AT91C_US_INACK (0x1 << 20) // (USART) Inhibit Non Acknowledge +#define AT91C_US_DSNACK (0x1 << 21) // (USART) Disable Successive NACK +#define AT91C_US_MAX_ITER (0x1 << 24) // (USART) Number of Repetitions +#define AT91C_US_FILTER (0x1 << 28) // (USART) Receive Line Filter +// -------- US_IER : (USART Offset: 0x8) Debug Unit Interrupt Enable Register -------- +#define AT91C_US_RXBRK (0x1 << 2) // (USART) Break Received/End of Break +#define AT91C_US_TIMEOUT (0x1 << 8) // (USART) Receiver Time-out +#define AT91C_US_ITERATION (0x1 << 10) // (USART) Max number of Repetitions Reached +#define AT91C_US_NACK (0x1 << 13) // (USART) Non Acknowledge +#define AT91C_US_RIIC (0x1 << 16) // (USART) Ring INdicator Input Change Flag +#define AT91C_US_DSRIC (0x1 << 17) // (USART) Data Set Ready Input Change Flag +#define AT91C_US_DCDIC (0x1 << 18) // (USART) Data Carrier Flag +#define AT91C_US_CTSIC (0x1 << 19) // (USART) Clear To Send Input Change Flag +// -------- US_IDR : (USART Offset: 0xc) Debug Unit Interrupt Disable Register -------- +// -------- US_IMR : (USART Offset: 0x10) Debug Unit Interrupt Mask Register -------- +// -------- US_CSR : (USART Offset: 0x14) Debug Unit Channel Status Register -------- +#define AT91C_US_RI (0x1 << 20) // (USART) Image of RI Input +#define AT91C_US_DSR (0x1 << 21) // (USART) Image of DSR Input +#define AT91C_US_DCD (0x1 << 22) // (USART) Image of DCD Input +#define AT91C_US_CTS (0x1 << 23) // (USART) Image of CTS Input + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Synchronous Serial Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_SSC structure *** +#define SSC_CR ( 0) // Control Register +#define SSC_CMR ( 4) // Clock Mode Register +#define SSC_RCMR (16) // Receive Clock ModeRegister +#define SSC_RFMR (20) // Receive Frame Mode Register +#define SSC_TCMR (24) // Transmit Clock Mode Register +#define SSC_TFMR (28) // Transmit Frame Mode Register +#define SSC_RHR (32) // Receive Holding Register +#define SSC_THR (36) // Transmit Holding Register +#define SSC_RSHR (48) // Receive Sync Holding Register +#define SSC_TSHR (52) // Transmit Sync Holding Register +#define SSC_SR (64) // Status Register +#define SSC_IER (68) // Interrupt Enable Register +#define SSC_IDR (72) // Interrupt Disable Register +#define SSC_IMR (76) // Interrupt Mask Register +#define SSC_RPR (256) // Receive Pointer Register +#define SSC_RCR (260) // Receive Counter Register +#define SSC_TPR (264) // Transmit Pointer Register +#define SSC_TCR (268) // Transmit Counter Register +#define SSC_RNPR (272) // Receive Next Pointer Register +#define SSC_RNCR (276) // Receive Next Counter Register +#define SSC_TNPR (280) // Transmit Next Pointer Register +#define SSC_TNCR (284) // Transmit Next Counter Register +#define SSC_PTCR (288) // PDC Transfer Control Register +#define SSC_PTSR (292) // PDC Transfer Status Register +// -------- SSC_CR : (SSC Offset: 0x0) SSC Control Register -------- +#define AT91C_SSC_RXEN (0x1 << 0) // (SSC) Receive Enable +#define AT91C_SSC_RXDIS (0x1 << 1) // (SSC) Receive Disable +#define AT91C_SSC_TXEN (0x1 << 8) // (SSC) Transmit Enable +#define AT91C_SSC_TXDIS (0x1 << 9) // (SSC) Transmit Disable +#define AT91C_SSC_SWRST (0x1 << 15) // (SSC) Software Reset +// -------- SSC_RCMR : (SSC Offset: 0x10) SSC Receive Clock Mode Register -------- +#define AT91C_SSC_CKS (0x3 << 0) // (SSC) Receive/Transmit Clock Selection +#define AT91C_SSC_CKS_DIV (0x0) // (SSC) Divided Clock +#define AT91C_SSC_CKS_TK (0x1) // (SSC) TK Clock signal +#define AT91C_SSC_CKS_RK (0x2) // (SSC) RK pin +#define AT91C_SSC_CKO (0x7 << 2) // (SSC) Receive/Transmit Clock Output Mode Selection +#define AT91C_SSC_CKO_NONE (0x0 << 2) // (SSC) Receive/Transmit Clock Output Mode: None RK pin: Input-only +#define AT91C_SSC_CKO_CONTINOUS (0x1 << 2) // (SSC) Continuous Receive/Transmit Clock RK pin: Output +#define AT91C_SSC_CKO_DATA_TX (0x2 << 2) // (SSC) Receive/Transmit Clock only during data transfers RK pin: Output +#define AT91C_SSC_CKI (0x1 << 5) // (SSC) Receive/Transmit Clock Inversion +#define AT91C_SSC_CKG (0x3 << 6) // (SSC) Receive/Transmit Clock Gating Selection +#define AT91C_SSC_CKG_NONE (0x0 << 6) // (SSC) Receive/Transmit Clock Gating: None, continuous clock +#define AT91C_SSC_CKG_LOW (0x1 << 6) // (SSC) Receive/Transmit Clock enabled only if RF Low +#define AT91C_SSC_CKG_HIGH (0x2 << 6) // (SSC) Receive/Transmit Clock enabled only if RF High +#define AT91C_SSC_START (0xF << 8) // (SSC) Receive/Transmit Start Selection +#define AT91C_SSC_START_CONTINOUS (0x0 << 8) // (SSC) Continuous, as soon as the receiver is enabled, and immediately after the end of transfer of the previous data. +#define AT91C_SSC_START_TX (0x1 << 8) // (SSC) Transmit/Receive start +#define AT91C_SSC_START_LOW_RF (0x2 << 8) // (SSC) Detection of a low level on RF input +#define AT91C_SSC_START_HIGH_RF (0x3 << 8) // (SSC) Detection of a high level on RF input +#define AT91C_SSC_START_FALL_RF (0x4 << 8) // (SSC) Detection of a falling edge on RF input +#define AT91C_SSC_START_RISE_RF (0x5 << 8) // (SSC) Detection of a rising edge on RF input +#define AT91C_SSC_START_LEVEL_RF (0x6 << 8) // (SSC) Detection of any level change on RF input +#define AT91C_SSC_START_EDGE_RF (0x7 << 8) // (SSC) Detection of any edge on RF input +#define AT91C_SSC_START_0 (0x8 << 8) // (SSC) Compare 0 +#define AT91C_SSC_STOP (0x1 << 12) // (SSC) Receive Stop Selection +#define AT91C_SSC_STTDLY (0xFF << 16) // (SSC) Receive/Transmit Start Delay +#define AT91C_SSC_PERIOD (0xFF << 24) // (SSC) Receive/Transmit Period Divider Selection +// -------- SSC_RFMR : (SSC Offset: 0x14) SSC Receive Frame Mode Register -------- +#define AT91C_SSC_DATLEN (0x1F << 0) // (SSC) Data Length +#define AT91C_SSC_LOOP (0x1 << 5) // (SSC) Loop Mode +#define AT91C_SSC_MSBF (0x1 << 7) // (SSC) Most Significant Bit First +#define AT91C_SSC_DATNB (0xF << 8) // (SSC) Data Number per Frame +#define AT91C_SSC_FSLEN (0xF << 16) // (SSC) Receive/Transmit Frame Sync length +#define AT91C_SSC_FSOS (0x7 << 20) // (SSC) Receive/Transmit Frame Sync Output Selection +#define AT91C_SSC_FSOS_NONE (0x0 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: None RK pin Input-only +#define AT91C_SSC_FSOS_NEGATIVE (0x1 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Negative Pulse +#define AT91C_SSC_FSOS_POSITIVE (0x2 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Positive Pulse +#define AT91C_SSC_FSOS_LOW (0x3 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Driver Low during data transfer +#define AT91C_SSC_FSOS_HIGH (0x4 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Driver High during data transfer +#define AT91C_SSC_FSOS_TOGGLE (0x5 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Toggling at each start of data transfer +#define AT91C_SSC_FSEDGE (0x1 << 24) // (SSC) Frame Sync Edge Detection +// -------- SSC_TCMR : (SSC Offset: 0x18) SSC Transmit Clock Mode Register -------- +// -------- SSC_TFMR : (SSC Offset: 0x1c) SSC Transmit Frame Mode Register -------- +#define AT91C_SSC_DATDEF (0x1 << 5) // (SSC) Data Default Value +#define AT91C_SSC_FSDEN (0x1 << 23) // (SSC) Frame Sync Data Enable +// -------- SSC_SR : (SSC Offset: 0x40) SSC Status Register -------- +#define AT91C_SSC_TXRDY (0x1 << 0) // (SSC) Transmit Ready +#define AT91C_SSC_TXEMPTY (0x1 << 1) // (SSC) Transmit Empty +#define AT91C_SSC_ENDTX (0x1 << 2) // (SSC) End Of Transmission +#define AT91C_SSC_TXBUFE (0x1 << 3) // (SSC) Transmit Buffer Empty +#define AT91C_SSC_RXRDY (0x1 << 4) // (SSC) Receive Ready +#define AT91C_SSC_OVRUN (0x1 << 5) // (SSC) Receive Overrun +#define AT91C_SSC_ENDRX (0x1 << 6) // (SSC) End of Reception +#define AT91C_SSC_RXBUFF (0x1 << 7) // (SSC) Receive Buffer Full +#define AT91C_SSC_CP0 (0x1 << 8) // (SSC) Compare 0 +#define AT91C_SSC_CP1 (0x1 << 9) // (SSC) Compare 1 +#define AT91C_SSC_TXSYN (0x1 << 10) // (SSC) Transmit Sync +#define AT91C_SSC_RXSYN (0x1 << 11) // (SSC) Receive Sync +#define AT91C_SSC_TXENA (0x1 << 16) // (SSC) Transmit Enable +#define AT91C_SSC_RXENA (0x1 << 17) // (SSC) Receive Enable +// -------- SSC_IER : (SSC Offset: 0x44) SSC Interrupt Enable Register -------- +// -------- SSC_IDR : (SSC Offset: 0x48) SSC Interrupt Disable Register -------- +// -------- SSC_IMR : (SSC Offset: 0x4c) SSC Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Two-wire Interface +// ***************************************************************************** +// *** Register offset in AT91S_TWI structure *** +#define TWI_CR ( 0) // Control Register +#define TWI_MMR ( 4) // Master Mode Register +#define TWI_IADR (12) // Internal Address Register +#define TWI_CWGR (16) // Clock Waveform Generator Register +#define TWI_SR (32) // Status Register +#define TWI_IER (36) // Interrupt Enable Register +#define TWI_IDR (40) // Interrupt Disable Register +#define TWI_IMR (44) // Interrupt Mask Register +#define TWI_RHR (48) // Receive Holding Register +#define TWI_THR (52) // Transmit Holding Register +// -------- TWI_CR : (TWI Offset: 0x0) TWI Control Register -------- +#define AT91C_TWI_START (0x1 << 0) // (TWI) Send a START Condition +#define AT91C_TWI_STOP (0x1 << 1) // (TWI) Send a STOP Condition +#define AT91C_TWI_MSEN (0x1 << 2) // (TWI) TWI Master Transfer Enabled +#define AT91C_TWI_MSDIS (0x1 << 3) // (TWI) TWI Master Transfer Disabled +#define AT91C_TWI_SWRST (0x1 << 7) // (TWI) Software Reset +// -------- TWI_MMR : (TWI Offset: 0x4) TWI Master Mode Register -------- +#define AT91C_TWI_IADRSZ (0x3 << 8) // (TWI) Internal Device Address Size +#define AT91C_TWI_IADRSZ_NO (0x0 << 8) // (TWI) No internal device address +#define AT91C_TWI_IADRSZ_1_BYTE (0x1 << 8) // (TWI) One-byte internal device address +#define AT91C_TWI_IADRSZ_2_BYTE (0x2 << 8) // (TWI) Two-byte internal device address +#define AT91C_TWI_IADRSZ_3_BYTE (0x3 << 8) // (TWI) Three-byte internal device address +#define AT91C_TWI_MREAD (0x1 << 12) // (TWI) Master Read Direction +#define AT91C_TWI_DADR (0x7F << 16) // (TWI) Device Address +// -------- TWI_CWGR : (TWI Offset: 0x10) TWI Clock Waveform Generator Register -------- +#define AT91C_TWI_CLDIV (0xFF << 0) // (TWI) Clock Low Divider +#define AT91C_TWI_CHDIV (0xFF << 8) // (TWI) Clock High Divider +#define AT91C_TWI_CKDIV (0x7 << 16) // (TWI) Clock Divider +// -------- TWI_SR : (TWI Offset: 0x20) TWI Status Register -------- +#define AT91C_TWI_TXCOMP (0x1 << 0) // (TWI) Transmission Completed +#define AT91C_TWI_RXRDY (0x1 << 1) // (TWI) Receive holding register ReaDY +#define AT91C_TWI_TXRDY (0x1 << 2) // (TWI) Transmit holding register ReaDY +#define AT91C_TWI_OVRE (0x1 << 6) // (TWI) Overrun Error +#define AT91C_TWI_UNRE (0x1 << 7) // (TWI) Underrun Error +#define AT91C_TWI_NACK (0x1 << 8) // (TWI) Not Acknowledged +// -------- TWI_IER : (TWI Offset: 0x24) TWI Interrupt Enable Register -------- +// -------- TWI_IDR : (TWI Offset: 0x28) TWI Interrupt Disable Register -------- +// -------- TWI_IMR : (TWI Offset: 0x2c) TWI Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR PWMC Channel Interface +// ***************************************************************************** +// *** Register offset in AT91S_PWMC_CH structure *** +#define PWMC_CMR ( 0) // Channel Mode Register +#define PWMC_CDTYR ( 4) // Channel Duty Cycle Register +#define PWMC_CPRDR ( 8) // Channel Period Register +#define PWMC_CCNTR (12) // Channel Counter Register +#define PWMC_CUPDR (16) // Channel Update Register +#define PWMC_Reserved (20) // Reserved +// -------- PWMC_CMR : (PWMC_CH Offset: 0x0) PWMC Channel Mode Register -------- +#define AT91C_PWMC_CPRE (0xF << 0) // (PWMC_CH) Channel Pre-scaler : PWMC_CLKx +#define AT91C_PWMC_CPRE_MCK (0x0) // (PWMC_CH) +#define AT91C_PWMC_CPRE_MCKA (0xB) // (PWMC_CH) +#define AT91C_PWMC_CPRE_MCKB (0xC) // (PWMC_CH) +#define AT91C_PWMC_CALG (0x1 << 8) // (PWMC_CH) Channel Alignment +#define AT91C_PWMC_CPOL (0x1 << 9) // (PWMC_CH) Channel Polarity +#define AT91C_PWMC_CPD (0x1 << 10) // (PWMC_CH) Channel Update Period +// -------- PWMC_CDTYR : (PWMC_CH Offset: 0x4) PWMC Channel Duty Cycle Register -------- +#define AT91C_PWMC_CDTY (0x0 << 0) // (PWMC_CH) Channel Duty Cycle +// -------- PWMC_CPRDR : (PWMC_CH Offset: 0x8) PWMC Channel Period Register -------- +#define AT91C_PWMC_CPRD (0x0 << 0) // (PWMC_CH) Channel Period +// -------- PWMC_CCNTR : (PWMC_CH Offset: 0xc) PWMC Channel Counter Register -------- +#define AT91C_PWMC_CCNT (0x0 << 0) // (PWMC_CH) Channel Counter +// -------- PWMC_CUPDR : (PWMC_CH Offset: 0x10) PWMC Channel Update Register -------- +#define AT91C_PWMC_CUPD (0x0 << 0) // (PWMC_CH) Channel Update + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Pulse Width Modulation Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_PWMC structure *** +#define PWMC_MR ( 0) // PWMC Mode Register +#define PWMC_ENA ( 4) // PWMC Enable Register +#define PWMC_DIS ( 8) // PWMC Disable Register +#define PWMC_SR (12) // PWMC Status Register +#define PWMC_IER (16) // PWMC Interrupt Enable Register +#define PWMC_IDR (20) // PWMC Interrupt Disable Register +#define PWMC_IMR (24) // PWMC Interrupt Mask Register +#define PWMC_ISR (28) // PWMC Interrupt Status Register +#define PWMC_VR (252) // PWMC Version Register +#define PWMC_CH (512) // PWMC Channel +// -------- PWMC_MR : (PWMC Offset: 0x0) PWMC Mode Register -------- +#define AT91C_PWMC_DIVA (0xFF << 0) // (PWMC) CLKA divide factor. +#define AT91C_PWMC_PREA (0xF << 8) // (PWMC) Divider Input Clock Prescaler A +#define AT91C_PWMC_PREA_MCK (0x0 << 8) // (PWMC) +#define AT91C_PWMC_DIVB (0xFF << 16) // (PWMC) CLKB divide factor. +#define AT91C_PWMC_PREB (0xF << 24) // (PWMC) Divider Input Clock Prescaler B +#define AT91C_PWMC_PREB_MCK (0x0 << 24) // (PWMC) +// -------- PWMC_ENA : (PWMC Offset: 0x4) PWMC Enable Register -------- +#define AT91C_PWMC_CHID0 (0x1 << 0) // (PWMC) Channel ID 0 +#define AT91C_PWMC_CHID1 (0x1 << 1) // (PWMC) Channel ID 1 +#define AT91C_PWMC_CHID2 (0x1 << 2) // (PWMC) Channel ID 2 +#define AT91C_PWMC_CHID3 (0x1 << 3) // (PWMC) Channel ID 3 +// -------- PWMC_DIS : (PWMC Offset: 0x8) PWMC Disable Register -------- +// -------- PWMC_SR : (PWMC Offset: 0xc) PWMC Status Register -------- +// -------- PWMC_IER : (PWMC Offset: 0x10) PWMC Interrupt Enable Register -------- +// -------- PWMC_IDR : (PWMC Offset: 0x14) PWMC Interrupt Disable Register -------- +// -------- PWMC_IMR : (PWMC Offset: 0x18) PWMC Interrupt Mask Register -------- +// -------- PWMC_ISR : (PWMC Offset: 0x1c) PWMC Interrupt Status Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR USB Device Interface +// ***************************************************************************** +// *** Register offset in AT91S_UDP structure *** +#define UDP_NUM ( 0) // Frame Number Register +#define UDP_GLBSTATE ( 4) // Global State Register +#define UDP_FADDR ( 8) // Function Address Register +#define UDP_IER (16) // Interrupt Enable Register +#define UDP_IDR (20) // Interrupt Disable Register +#define UDP_IMR (24) // Interrupt Mask Register +#define UDP_ISR (28) // Interrupt Status Register +#define UDP_ICR (32) // Interrupt Clear Register +#define UDP_RSTEP (40) // Reset Endpoint Register +#define UDP_CSR (48) // Endpoint Control and Status Register +#define UDP_FDR (80) // Endpoint FIFO Data Register +#define UDP_TXVC (116) // Transceiver Control Register +// -------- UDP_FRM_NUM : (UDP Offset: 0x0) USB Frame Number Register -------- +#define AT91C_UDP_FRM_NUM (0x7FF << 0) // (UDP) Frame Number as Defined in the Packet Field Formats +#define AT91C_UDP_FRM_ERR (0x1 << 16) // (UDP) Frame Error +#define AT91C_UDP_FRM_OK (0x1 << 17) // (UDP) Frame OK +// -------- UDP_GLB_STATE : (UDP Offset: 0x4) USB Global State Register -------- +#define AT91C_UDP_FADDEN (0x1 << 0) // (UDP) Function Address Enable +#define AT91C_UDP_CONFG (0x1 << 1) // (UDP) Configured +#define AT91C_UDP_ESR (0x1 << 2) // (UDP) Enable Send Resume +#define AT91C_UDP_RSMINPR (0x1 << 3) // (UDP) A Resume Has Been Sent to the Host +#define AT91C_UDP_RMWUPE (0x1 << 4) // (UDP) Remote Wake Up Enable +// -------- UDP_FADDR : (UDP Offset: 0x8) USB Function Address Register -------- +#define AT91C_UDP_FADD (0xFF << 0) // (UDP) Function Address Value +#define AT91C_UDP_FEN (0x1 << 8) // (UDP) Function Enable +// -------- UDP_IER : (UDP Offset: 0x10) USB Interrupt Enable Register -------- +#define AT91C_UDP_EPINT0 (0x1 << 0) // (UDP) Endpoint 0 Interrupt +#define AT91C_UDP_EPINT1 (0x1 << 1) // (UDP) Endpoint 0 Interrupt +#define AT91C_UDP_EPINT2 (0x1 << 2) // (UDP) Endpoint 2 Interrupt +#define AT91C_UDP_EPINT3 (0x1 << 3) // (UDP) Endpoint 3 Interrupt +#define AT91C_UDP_EPINT4 (0x1 << 4) // (UDP) Endpoint 4 Interrupt +#define AT91C_UDP_EPINT5 (0x1 << 5) // (UDP) Endpoint 5 Interrupt +#define AT91C_UDP_RXSUSP (0x1 << 8) // (UDP) USB Suspend Interrupt +#define AT91C_UDP_RXRSM (0x1 << 9) // (UDP) USB Resume Interrupt +#define AT91C_UDP_EXTRSM (0x1 << 10) // (UDP) USB External Resume Interrupt +#define AT91C_UDP_SOFINT (0x1 << 11) // (UDP) USB Start Of frame Interrupt +#define AT91C_UDP_WAKEUP (0x1 << 13) // (UDP) USB Resume Interrupt +// -------- UDP_IDR : (UDP Offset: 0x14) USB Interrupt Disable Register -------- +// -------- UDP_IMR : (UDP Offset: 0x18) USB Interrupt Mask Register -------- +// -------- UDP_ISR : (UDP Offset: 0x1c) USB Interrupt Status Register -------- +#define AT91C_UDP_ENDBUSRES (0x1 << 12) // (UDP) USB End Of Bus Reset Interrupt +// -------- UDP_ICR : (UDP Offset: 0x20) USB Interrupt Clear Register -------- +// -------- UDP_RST_EP : (UDP Offset: 0x28) USB Reset Endpoint Register -------- +#define AT91C_UDP_EP0 (0x1 << 0) // (UDP) Reset Endpoint 0 +#define AT91C_UDP_EP1 (0x1 << 1) // (UDP) Reset Endpoint 1 +#define AT91C_UDP_EP2 (0x1 << 2) // (UDP) Reset Endpoint 2 +#define AT91C_UDP_EP3 (0x1 << 3) // (UDP) Reset Endpoint 3 +#define AT91C_UDP_EP4 (0x1 << 4) // (UDP) Reset Endpoint 4 +#define AT91C_UDP_EP5 (0x1 << 5) // (UDP) Reset Endpoint 5 +// -------- UDP_CSR : (UDP Offset: 0x30) USB Endpoint Control and Status Register -------- +#define AT91C_UDP_TXCOMP (0x1 << 0) // (UDP) Generates an IN packet with data previously written in the DPR +#define AT91C_UDP_RX_DATA_BK0 (0x1 << 1) // (UDP) Receive Data Bank 0 +#define AT91C_UDP_RXSETUP (0x1 << 2) // (UDP) Sends STALL to the Host (Control endpoints) +#define AT91C_UDP_ISOERROR (0x1 << 3) // (UDP) Isochronous error (Isochronous endpoints) +#define AT91C_UDP_TXPKTRDY (0x1 << 4) // (UDP) Transmit Packet Ready +#define AT91C_UDP_FORCESTALL (0x1 << 5) // (UDP) Force Stall (used by Control, Bulk and Isochronous endpoints). +#define AT91C_UDP_RX_DATA_BK1 (0x1 << 6) // (UDP) Receive Data Bank 1 (only used by endpoints with ping-pong attributes). +#define AT91C_UDP_DIR (0x1 << 7) // (UDP) Transfer Direction +#define AT91C_UDP_EPTYPE (0x7 << 8) // (UDP) Endpoint type +#define AT91C_UDP_EPTYPE_CTRL (0x0 << 8) // (UDP) Control +#define AT91C_UDP_EPTYPE_ISO_OUT (0x1 << 8) // (UDP) Isochronous OUT +#define AT91C_UDP_EPTYPE_BULK_OUT (0x2 << 8) // (UDP) Bulk OUT +#define AT91C_UDP_EPTYPE_INT_OUT (0x3 << 8) // (UDP) Interrupt OUT +#define AT91C_UDP_EPTYPE_ISO_IN (0x5 << 8) // (UDP) Isochronous IN +#define AT91C_UDP_EPTYPE_BULK_IN (0x6 << 8) // (UDP) Bulk IN +#define AT91C_UDP_EPTYPE_INT_IN (0x7 << 8) // (UDP) Interrupt IN +#define AT91C_UDP_DTGLE (0x1 << 11) // (UDP) Data Toggle +#define AT91C_UDP_EPEDS (0x1 << 15) // (UDP) Endpoint Enable Disable +#define AT91C_UDP_RXBYTECNT (0x7FF << 16) // (UDP) Number Of Bytes Available in the FIFO +// -------- UDP_TXVC : (UDP Offset: 0x74) Transceiver Control Register -------- +#define AT91C_UDP_TXVDIS (0x1 << 8) // (UDP) +#define AT91C_UDP_PUON (0x1 << 9) // (UDP) Pull-up ON + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Timer Counter Channel Interface +// ***************************************************************************** +// *** Register offset in AT91S_TC structure *** +#define TC_CCR ( 0) // Channel Control Register +#define TC_CMR ( 4) // Channel Mode Register (Capture Mode / Waveform Mode) +#define TC_CV (16) // Counter Value +#define TC_RA (20) // Register A +#define TC_RB (24) // Register B +#define TC_RC (28) // Register C +#define TC_SR (32) // Status Register +#define TC_IER (36) // Interrupt Enable Register +#define TC_IDR (40) // Interrupt Disable Register +#define TC_IMR (44) // Interrupt Mask Register +// -------- TC_CCR : (TC Offset: 0x0) TC Channel Control Register -------- +#define AT91C_TC_CLKEN (0x1 << 0) // (TC) Counter Clock Enable Command +#define AT91C_TC_CLKDIS (0x1 << 1) // (TC) Counter Clock Disable Command +#define AT91C_TC_SWTRG (0x1 << 2) // (TC) Software Trigger Command +// -------- TC_CMR : (TC Offset: 0x4) TC Channel Mode Register: Capture Mode / Waveform Mode -------- +#define AT91C_TC_CLKS (0x7 << 0) // (TC) Clock Selection +#define AT91C_TC_CLKS_TIMER_DIV1_CLOCK (0x0) // (TC) Clock selected: TIMER_DIV1_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV2_CLOCK (0x1) // (TC) Clock selected: TIMER_DIV2_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV3_CLOCK (0x2) // (TC) Clock selected: TIMER_DIV3_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV4_CLOCK (0x3) // (TC) Clock selected: TIMER_DIV4_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV5_CLOCK (0x4) // (TC) Clock selected: TIMER_DIV5_CLOCK +#define AT91C_TC_CLKS_XC0 (0x5) // (TC) Clock selected: XC0 +#define AT91C_TC_CLKS_XC1 (0x6) // (TC) Clock selected: XC1 +#define AT91C_TC_CLKS_XC2 (0x7) // (TC) Clock selected: XC2 +#define AT91C_TC_CLKI (0x1 << 3) // (TC) Clock Invert +#define AT91C_TC_BURST (0x3 << 4) // (TC) Burst Signal Selection +#define AT91C_TC_BURST_NONE (0x0 << 4) // (TC) The clock is not gated by an external signal +#define AT91C_TC_BURST_XC0 (0x1 << 4) // (TC) XC0 is ANDed with the selected clock +#define AT91C_TC_BURST_XC1 (0x2 << 4) // (TC) XC1 is ANDed with the selected clock +#define AT91C_TC_BURST_XC2 (0x3 << 4) // (TC) XC2 is ANDed with the selected clock +#define AT91C_TC_CPCSTOP (0x1 << 6) // (TC) Counter Clock Stopped with RC Compare +#define AT91C_TC_LDBSTOP (0x1 << 6) // (TC) Counter Clock Stopped with RB Loading +#define AT91C_TC_LDBDIS (0x1 << 7) // (TC) Counter Clock Disabled with RB Loading +#define AT91C_TC_CPCDIS (0x1 << 7) // (TC) Counter Clock Disable with RC Compare +#define AT91C_TC_ETRGEDG (0x3 << 8) // (TC) External Trigger Edge Selection +#define AT91C_TC_ETRGEDG_NONE (0x0 << 8) // (TC) Edge: None +#define AT91C_TC_ETRGEDG_RISING (0x1 << 8) // (TC) Edge: rising edge +#define AT91C_TC_ETRGEDG_FALLING (0x2 << 8) // (TC) Edge: falling edge +#define AT91C_TC_ETRGEDG_BOTH (0x3 << 8) // (TC) Edge: each edge +#define AT91C_TC_EEVTEDG (0x3 << 8) // (TC) External Event Edge Selection +#define AT91C_TC_EEVTEDG_NONE (0x0 << 8) // (TC) Edge: None +#define AT91C_TC_EEVTEDG_RISING (0x1 << 8) // (TC) Edge: rising edge +#define AT91C_TC_EEVTEDG_FALLING (0x2 << 8) // (TC) Edge: falling edge +#define AT91C_TC_EEVTEDG_BOTH (0x3 << 8) // (TC) Edge: each edge +#define AT91C_TC_ABETRG (0x1 << 10) // (TC) TIOA or TIOB External Trigger Selection +#define AT91C_TC_EEVT (0x3 << 10) // (TC) External Event Selection +#define AT91C_TC_EEVT_TIOB (0x0 << 10) // (TC) Signal selected as external event: TIOB TIOB direction: input +#define AT91C_TC_EEVT_XC0 (0x1 << 10) // (TC) Signal selected as external event: XC0 TIOB direction: output +#define AT91C_TC_EEVT_XC1 (0x2 << 10) // (TC) Signal selected as external event: XC1 TIOB direction: output +#define AT91C_TC_EEVT_XC2 (0x3 << 10) // (TC) Signal selected as external event: XC2 TIOB direction: output +#define AT91C_TC_ENETRG (0x1 << 12) // (TC) External Event Trigger enable +#define AT91C_TC_WAVESEL (0x3 << 13) // (TC) Waveform Selection +#define AT91C_TC_WAVESEL_UP (0x0 << 13) // (TC) UP mode without atomatic trigger on RC Compare +#define AT91C_TC_WAVESEL_UPDOWN (0x1 << 13) // (TC) UPDOWN mode without automatic trigger on RC Compare +#define AT91C_TC_WAVESEL_UP_AUTO (0x2 << 13) // (TC) UP mode with automatic trigger on RC Compare +#define AT91C_TC_WAVESEL_UPDOWN_AUTO (0x3 << 13) // (TC) UPDOWN mode with automatic trigger on RC Compare +#define AT91C_TC_CPCTRG (0x1 << 14) // (TC) RC Compare Trigger Enable +#define AT91C_TC_WAVE (0x1 << 15) // (TC) +#define AT91C_TC_LDRA (0x3 << 16) // (TC) RA Loading Selection +#define AT91C_TC_LDRA_NONE (0x0 << 16) // (TC) Edge: None +#define AT91C_TC_LDRA_RISING (0x1 << 16) // (TC) Edge: rising edge of TIOA +#define AT91C_TC_LDRA_FALLING (0x2 << 16) // (TC) Edge: falling edge of TIOA +#define AT91C_TC_LDRA_BOTH (0x3 << 16) // (TC) Edge: each edge of TIOA +#define AT91C_TC_ACPA (0x3 << 16) // (TC) RA Compare Effect on TIOA +#define AT91C_TC_ACPA_NONE (0x0 << 16) // (TC) Effect: none +#define AT91C_TC_ACPA_SET (0x1 << 16) // (TC) Effect: set +#define AT91C_TC_ACPA_CLEAR (0x2 << 16) // (TC) Effect: clear +#define AT91C_TC_ACPA_TOGGLE (0x3 << 16) // (TC) Effect: toggle +#define AT91C_TC_LDRB (0x3 << 18) // (TC) RB Loading Selection +#define AT91C_TC_LDRB_NONE (0x0 << 18) // (TC) Edge: None +#define AT91C_TC_LDRB_RISING (0x1 << 18) // (TC) Edge: rising edge of TIOA +#define AT91C_TC_LDRB_FALLING (0x2 << 18) // (TC) Edge: falling edge of TIOA +#define AT91C_TC_LDRB_BOTH (0x3 << 18) // (TC) Edge: each edge of TIOA +#define AT91C_TC_ACPC (0x3 << 18) // (TC) RC Compare Effect on TIOA +#define AT91C_TC_ACPC_NONE (0x0 << 18) // (TC) Effect: none +#define AT91C_TC_ACPC_SET (0x1 << 18) // (TC) Effect: set +#define AT91C_TC_ACPC_CLEAR (0x2 << 18) // (TC) Effect: clear +#define AT91C_TC_ACPC_TOGGLE (0x3 << 18) // (TC) Effect: toggle +#define AT91C_TC_AEEVT (0x3 << 20) // (TC) External Event Effect on TIOA +#define AT91C_TC_AEEVT_NONE (0x0 << 20) // (TC) Effect: none +#define AT91C_TC_AEEVT_SET (0x1 << 20) // (TC) Effect: set +#define AT91C_TC_AEEVT_CLEAR (0x2 << 20) // (TC) Effect: clear +#define AT91C_TC_AEEVT_TOGGLE (0x3 << 20) // (TC) Effect: toggle +#define AT91C_TC_ASWTRG (0x3 << 22) // (TC) Software Trigger Effect on TIOA +#define AT91C_TC_ASWTRG_NONE (0x0 << 22) // (TC) Effect: none +#define AT91C_TC_ASWTRG_SET (0x1 << 22) // (TC) Effect: set +#define AT91C_TC_ASWTRG_CLEAR (0x2 << 22) // (TC) Effect: clear +#define AT91C_TC_ASWTRG_TOGGLE (0x3 << 22) // (TC) Effect: toggle +#define AT91C_TC_BCPB (0x3 << 24) // (TC) RB Compare Effect on TIOB +#define AT91C_TC_BCPB_NONE (0x0 << 24) // (TC) Effect: none +#define AT91C_TC_BCPB_SET (0x1 << 24) // (TC) Effect: set +#define AT91C_TC_BCPB_CLEAR (0x2 << 24) // (TC) Effect: clear +#define AT91C_TC_BCPB_TOGGLE (0x3 << 24) // (TC) Effect: toggle +#define AT91C_TC_BCPC (0x3 << 26) // (TC) RC Compare Effect on TIOB +#define AT91C_TC_BCPC_NONE (0x0 << 26) // (TC) Effect: none +#define AT91C_TC_BCPC_SET (0x1 << 26) // (TC) Effect: set +#define AT91C_TC_BCPC_CLEAR (0x2 << 26) // (TC) Effect: clear +#define AT91C_TC_BCPC_TOGGLE (0x3 << 26) // (TC) Effect: toggle +#define AT91C_TC_BEEVT (0x3 << 28) // (TC) External Event Effect on TIOB +#define AT91C_TC_BEEVT_NONE (0x0 << 28) // (TC) Effect: none +#define AT91C_TC_BEEVT_SET (0x1 << 28) // (TC) Effect: set +#define AT91C_TC_BEEVT_CLEAR (0x2 << 28) // (TC) Effect: clear +#define AT91C_TC_BEEVT_TOGGLE (0x3 << 28) // (TC) Effect: toggle +#define AT91C_TC_BSWTRG (0x3 << 30) // (TC) Software Trigger Effect on TIOB +#define AT91C_TC_BSWTRG_NONE (0x0 << 30) // (TC) Effect: none +#define AT91C_TC_BSWTRG_SET (0x1 << 30) // (TC) Effect: set +#define AT91C_TC_BSWTRG_CLEAR (0x2 << 30) // (TC) Effect: clear +#define AT91C_TC_BSWTRG_TOGGLE (0x3 << 30) // (TC) Effect: toggle +// -------- TC_SR : (TC Offset: 0x20) TC Channel Status Register -------- +#define AT91C_TC_COVFS (0x1 << 0) // (TC) Counter Overflow +#define AT91C_TC_LOVRS (0x1 << 1) // (TC) Load Overrun +#define AT91C_TC_CPAS (0x1 << 2) // (TC) RA Compare +#define AT91C_TC_CPBS (0x1 << 3) // (TC) RB Compare +#define AT91C_TC_CPCS (0x1 << 4) // (TC) RC Compare +#define AT91C_TC_LDRAS (0x1 << 5) // (TC) RA Loading +#define AT91C_TC_LDRBS (0x1 << 6) // (TC) RB Loading +#define AT91C_TC_ETRGS (0x1 << 7) // (TC) External Trigger +#define AT91C_TC_CLKSTA (0x1 << 16) // (TC) Clock Enabling +#define AT91C_TC_MTIOA (0x1 << 17) // (TC) TIOA Mirror +#define AT91C_TC_MTIOB (0x1 << 18) // (TC) TIOA Mirror +// -------- TC_IER : (TC Offset: 0x24) TC Channel Interrupt Enable Register -------- +// -------- TC_IDR : (TC Offset: 0x28) TC Channel Interrupt Disable Register -------- +// -------- TC_IMR : (TC Offset: 0x2c) TC Channel Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Timer Counter Interface +// ***************************************************************************** +// *** Register offset in AT91S_TCB structure *** +#define TCB_TC0 ( 0) // TC Channel 0 +#define TCB_TC1 (64) // TC Channel 1 +#define TCB_TC2 (128) // TC Channel 2 +#define TCB_BCR (192) // TC Block Control Register +#define TCB_BMR (196) // TC Block Mode Register +// -------- TCB_BCR : (TCB Offset: 0xc0) TC Block Control Register -------- +#define AT91C_TCB_SYNC (0x1 << 0) // (TCB) Synchro Command +// -------- TCB_BMR : (TCB Offset: 0xc4) TC Block Mode Register -------- +#define AT91C_TCB_TC0XC0S (0x3 << 0) // (TCB) External Clock Signal 0 Selection +#define AT91C_TCB_TC0XC0S_TCLK0 (0x0) // (TCB) TCLK0 connected to XC0 +#define AT91C_TCB_TC0XC0S_NONE (0x1) // (TCB) None signal connected to XC0 +#define AT91C_TCB_TC0XC0S_TIOA1 (0x2) // (TCB) TIOA1 connected to XC0 +#define AT91C_TCB_TC0XC0S_TIOA2 (0x3) // (TCB) TIOA2 connected to XC0 +#define AT91C_TCB_TC1XC1S (0x3 << 2) // (TCB) External Clock Signal 1 Selection +#define AT91C_TCB_TC1XC1S_TCLK1 (0x0 << 2) // (TCB) TCLK1 connected to XC1 +#define AT91C_TCB_TC1XC1S_NONE (0x1 << 2) // (TCB) None signal connected to XC1 +#define AT91C_TCB_TC1XC1S_TIOA0 (0x2 << 2) // (TCB) TIOA0 connected to XC1 +#define AT91C_TCB_TC1XC1S_TIOA2 (0x3 << 2) // (TCB) TIOA2 connected to XC1 +#define AT91C_TCB_TC2XC2S (0x3 << 4) // (TCB) External Clock Signal 2 Selection +#define AT91C_TCB_TC2XC2S_TCLK2 (0x0 << 4) // (TCB) TCLK2 connected to XC2 +#define AT91C_TCB_TC2XC2S_NONE (0x1 << 4) // (TCB) None signal connected to XC2 +#define AT91C_TCB_TC2XC2S_TIOA0 (0x2 << 4) // (TCB) TIOA0 connected to XC2 +#define AT91C_TCB_TC2XC2S_TIOA1 (0x3 << 4) // (TCB) TIOA2 connected to XC2 + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Control Area Network MailBox Interface +// ***************************************************************************** +// *** Register offset in AT91S_CAN_MB structure *** +#define CAN_MB_MMR ( 0) // MailBox Mode Register +#define CAN_MB_MAM ( 4) // MailBox Acceptance Mask Register +#define CAN_MB_MID ( 8) // MailBox ID Register +#define CAN_MB_MFID (12) // MailBox Family ID Register +#define CAN_MB_MSR (16) // MailBox Status Register +#define CAN_MB_MDL (20) // MailBox Data Low Register +#define CAN_MB_MDH (24) // MailBox Data High Register +#define CAN_MB_MCR (28) // MailBox Control Register +// -------- CAN_MMR : (CAN_MB Offset: 0x0) CAN Message Mode Register -------- +#define AT91C_CAN_MTIMEMARK (0xFFFF << 0) // (CAN_MB) Mailbox Timemark +#define AT91C_CAN_PRIOR (0xF << 16) // (CAN_MB) Mailbox Priority +#define AT91C_CAN_MOT (0x7 << 24) // (CAN_MB) Mailbox Object Type +#define AT91C_CAN_MOT_DIS (0x0 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_RX (0x1 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_RXOVERWRITE (0x2 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_TX (0x3 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_CONSUMER (0x4 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_PRODUCER (0x5 << 24) // (CAN_MB) +// -------- CAN_MAM : (CAN_MB Offset: 0x4) CAN Message Acceptance Mask Register -------- +#define AT91C_CAN_MIDvB (0x3FFFF << 0) // (CAN_MB) Complementary bits for identifier in extended mode +#define AT91C_CAN_MIDvA (0x7FF << 18) // (CAN_MB) Identifier for standard frame mode +#define AT91C_CAN_MIDE (0x1 << 29) // (CAN_MB) Identifier Version +// -------- CAN_MID : (CAN_MB Offset: 0x8) CAN Message ID Register -------- +// -------- CAN_MFID : (CAN_MB Offset: 0xc) CAN Message Family ID Register -------- +// -------- CAN_MSR : (CAN_MB Offset: 0x10) CAN Message Status Register -------- +#define AT91C_CAN_MTIMESTAMP (0xFFFF << 0) // (CAN_MB) Timer Value +#define AT91C_CAN_MDLC (0xF << 16) // (CAN_MB) Mailbox Data Length Code +#define AT91C_CAN_MRTR (0x1 << 20) // (CAN_MB) Mailbox Remote Transmission Request +#define AT91C_CAN_MABT (0x1 << 22) // (CAN_MB) Mailbox Message Abort +#define AT91C_CAN_MRDY (0x1 << 23) // (CAN_MB) Mailbox Ready +#define AT91C_CAN_MMI (0x1 << 24) // (CAN_MB) Mailbox Message Ignored +// -------- CAN_MDL : (CAN_MB Offset: 0x14) CAN Message Data Low Register -------- +// -------- CAN_MDH : (CAN_MB Offset: 0x18) CAN Message Data High Register -------- +// -------- CAN_MCR : (CAN_MB Offset: 0x1c) CAN Message Control Register -------- +#define AT91C_CAN_MACR (0x1 << 22) // (CAN_MB) Abort Request for Mailbox +#define AT91C_CAN_MTCR (0x1 << 23) // (CAN_MB) Mailbox Transfer Command + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Control Area Network Interface +// ***************************************************************************** +// *** Register offset in AT91S_CAN structure *** +#define CAN_MR ( 0) // Mode Register +#define CAN_IER ( 4) // Interrupt Enable Register +#define CAN_IDR ( 8) // Interrupt Disable Register +#define CAN_IMR (12) // Interrupt Mask Register +#define CAN_SR (16) // Status Register +#define CAN_BR (20) // Baudrate Register +#define CAN_TIM (24) // Timer Register +#define CAN_TIMESTP (28) // Time Stamp Register +#define CAN_ECR (32) // Error Counter Register +#define CAN_TCR (36) // Transfer Command Register +#define CAN_ACR (40) // Abort Command Register +#define CAN_VR (252) // Version Register +#define CAN_MB0 (512) // CAN Mailbox 0 +#define CAN_MB1 (544) // CAN Mailbox 1 +#define CAN_MB2 (576) // CAN Mailbox 2 +#define CAN_MB3 (608) // CAN Mailbox 3 +#define CAN_MB4 (640) // CAN Mailbox 4 +#define CAN_MB5 (672) // CAN Mailbox 5 +#define CAN_MB6 (704) // CAN Mailbox 6 +#define CAN_MB7 (736) // CAN Mailbox 7 +#define CAN_MB8 (768) // CAN Mailbox 8 +#define CAN_MB9 (800) // CAN Mailbox 9 +#define CAN_MB10 (832) // CAN Mailbox 10 +#define CAN_MB11 (864) // CAN Mailbox 11 +#define CAN_MB12 (896) // CAN Mailbox 12 +#define CAN_MB13 (928) // CAN Mailbox 13 +#define CAN_MB14 (960) // CAN Mailbox 14 +#define CAN_MB15 (992) // CAN Mailbox 15 +// -------- CAN_MR : (CAN Offset: 0x0) CAN Mode Register -------- +#define AT91C_CAN_CANEN (0x1 << 0) // (CAN) CAN Controller Enable +#define AT91C_CAN_LPM (0x1 << 1) // (CAN) Disable/Enable Low Power Mode +#define AT91C_CAN_ABM (0x1 << 2) // (CAN) Disable/Enable Autobaud/Listen Mode +#define AT91C_CAN_OVL (0x1 << 3) // (CAN) Disable/Enable Overload Frame +#define AT91C_CAN_TEOF (0x1 << 4) // (CAN) Time Stamp messages at each end of Frame +#define AT91C_CAN_TTM (0x1 << 5) // (CAN) Disable/Enable Time Trigger Mode +#define AT91C_CAN_TIMFRZ (0x1 << 6) // (CAN) Enable Timer Freeze +#define AT91C_CAN_DRPT (0x1 << 7) // (CAN) Disable Repeat +// -------- CAN_IER : (CAN Offset: 0x4) CAN Interrupt Enable Register -------- +#define AT91C_CAN_MB0 (0x1 << 0) // (CAN) Mailbox 0 Flag +#define AT91C_CAN_MB1 (0x1 << 1) // (CAN) Mailbox 1 Flag +#define AT91C_CAN_MB2 (0x1 << 2) // (CAN) Mailbox 2 Flag +#define AT91C_CAN_MB3 (0x1 << 3) // (CAN) Mailbox 3 Flag +#define AT91C_CAN_MB4 (0x1 << 4) // (CAN) Mailbox 4 Flag +#define AT91C_CAN_MB5 (0x1 << 5) // (CAN) Mailbox 5 Flag +#define AT91C_CAN_MB6 (0x1 << 6) // (CAN) Mailbox 6 Flag +#define AT91C_CAN_MB7 (0x1 << 7) // (CAN) Mailbox 7 Flag +#define AT91C_CAN_MB8 (0x1 << 8) // (CAN) Mailbox 8 Flag +#define AT91C_CAN_MB9 (0x1 << 9) // (CAN) Mailbox 9 Flag +#define AT91C_CAN_MB10 (0x1 << 10) // (CAN) Mailbox 10 Flag +#define AT91C_CAN_MB11 (0x1 << 11) // (CAN) Mailbox 11 Flag +#define AT91C_CAN_MB12 (0x1 << 12) // (CAN) Mailbox 12 Flag +#define AT91C_CAN_MB13 (0x1 << 13) // (CAN) Mailbox 13 Flag +#define AT91C_CAN_MB14 (0x1 << 14) // (CAN) Mailbox 14 Flag +#define AT91C_CAN_MB15 (0x1 << 15) // (CAN) Mailbox 15 Flag +#define AT91C_CAN_ERRA (0x1 << 16) // (CAN) Error Active Mode Flag +#define AT91C_CAN_WARN (0x1 << 17) // (CAN) Warning Limit Flag +#define AT91C_CAN_ERRP (0x1 << 18) // (CAN) Error Passive Mode Flag +#define AT91C_CAN_BOFF (0x1 << 19) // (CAN) Bus Off Mode Flag +#define AT91C_CAN_SLEEP (0x1 << 20) // (CAN) Sleep Flag +#define AT91C_CAN_WAKEUP (0x1 << 21) // (CAN) Wakeup Flag +#define AT91C_CAN_TOVF (0x1 << 22) // (CAN) Timer Overflow Flag +#define AT91C_CAN_TSTP (0x1 << 23) // (CAN) Timestamp Flag +#define AT91C_CAN_CERR (0x1 << 24) // (CAN) CRC Error +#define AT91C_CAN_SERR (0x1 << 25) // (CAN) Stuffing Error +#define AT91C_CAN_AERR (0x1 << 26) // (CAN) Acknowledgment Error +#define AT91C_CAN_FERR (0x1 << 27) // (CAN) Form Error +#define AT91C_CAN_BERR (0x1 << 28) // (CAN) Bit Error +// -------- CAN_IDR : (CAN Offset: 0x8) CAN Interrupt Disable Register -------- +// -------- CAN_IMR : (CAN Offset: 0xc) CAN Interrupt Mask Register -------- +// -------- CAN_SR : (CAN Offset: 0x10) CAN Status Register -------- +#define AT91C_CAN_RBSY (0x1 << 29) // (CAN) Receiver Busy +#define AT91C_CAN_TBSY (0x1 << 30) // (CAN) Transmitter Busy +#define AT91C_CAN_OVLY (0x1 << 31) // (CAN) Overload Busy +// -------- CAN_BR : (CAN Offset: 0x14) CAN Baudrate Register -------- +#define AT91C_CAN_PHASE2 (0x7 << 0) // (CAN) Phase 2 segment +#define AT91C_CAN_PHASE1 (0x7 << 4) // (CAN) Phase 1 segment +#define AT91C_CAN_PROPAG (0x7 << 8) // (CAN) Programmation time segment +#define AT91C_CAN_SYNC (0x3 << 12) // (CAN) Re-synchronization jump width segment +#define AT91C_CAN_BRP (0x7F << 16) // (CAN) Baudrate Prescaler +#define AT91C_CAN_SMP (0x1 << 24) // (CAN) Sampling mode +// -------- CAN_TIM : (CAN Offset: 0x18) CAN Timer Register -------- +#define AT91C_CAN_TIMER (0xFFFF << 0) // (CAN) Timer field +// -------- CAN_TIMESTP : (CAN Offset: 0x1c) CAN Timestamp Register -------- +// -------- CAN_ECR : (CAN Offset: 0x20) CAN Error Counter Register -------- +#define AT91C_CAN_REC (0xFF << 0) // (CAN) Receive Error Counter +#define AT91C_CAN_TEC (0xFF << 16) // (CAN) Transmit Error Counter +// -------- CAN_TCR : (CAN Offset: 0x24) CAN Transfer Command Register -------- +#define AT91C_CAN_TIMRST (0x1 << 31) // (CAN) Timer Reset Field +// -------- CAN_ACR : (CAN Offset: 0x28) CAN Abort Command Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Ethernet MAC 10/100 +// ***************************************************************************** +// *** Register offset in AT91S_EMAC structure *** +#define EMAC_NCR ( 0) // Network Control Register +#define EMAC_NCFGR ( 4) // Network Configuration Register +#define EMAC_NSR ( 8) // Network Status Register +#define EMAC_TSR (20) // Transmit Status Register +#define EMAC_RBQP (24) // Receive Buffer Queue Pointer +#define EMAC_TBQP (28) // Transmit Buffer Queue Pointer +#define EMAC_RSR (32) // Receive Status Register +#define EMAC_ISR (36) // Interrupt Status Register +#define EMAC_IER (40) // Interrupt Enable Register +#define EMAC_IDR (44) // Interrupt Disable Register +#define EMAC_IMR (48) // Interrupt Mask Register +#define EMAC_MAN (52) // PHY Maintenance Register +#define EMAC_PTR (56) // Pause Time Register +#define EMAC_PFR (60) // Pause Frames received Register +#define EMAC_FTO (64) // Frames Transmitted OK Register +#define EMAC_SCF (68) // Single Collision Frame Register +#define EMAC_MCF (72) // Multiple Collision Frame Register +#define EMAC_FRO (76) // Frames Received OK Register +#define EMAC_FCSE (80) // Frame Check Sequence Error Register +#define EMAC_ALE (84) // Alignment Error Register +#define EMAC_DTF (88) // Deferred Transmission Frame Register +#define EMAC_LCOL (92) // Late Collision Register +#define EMAC_ECOL (96) // Excessive Collision Register +#define EMAC_TUND (100) // Transmit Underrun Error Register +#define EMAC_CSE (104) // Carrier Sense Error Register +#define EMAC_RRE (108) // Receive Ressource Error Register +#define EMAC_ROV (112) // Receive Overrun Errors Register +#define EMAC_RSE (116) // Receive Symbol Errors Register +#define EMAC_ELE (120) // Excessive Length Errors Register +#define EMAC_RJA (124) // Receive Jabbers Register +#define EMAC_USF (128) // Undersize Frames Register +#define EMAC_STE (132) // SQE Test Error Register +#define EMAC_RLE (136) // Receive Length Field Mismatch Register +#define EMAC_TPF (140) // Transmitted Pause Frames Register +#define EMAC_HRB (144) // Hash Address Bottom[31:0] +#define EMAC_HRT (148) // Hash Address Top[63:32] +#define EMAC_SA1L (152) // Specific Address 1 Bottom, First 4 bytes +#define EMAC_SA1H (156) // Specific Address 1 Top, Last 2 bytes +#define EMAC_SA2L (160) // Specific Address 2 Bottom, First 4 bytes +#define EMAC_SA2H (164) // Specific Address 2 Top, Last 2 bytes +#define EMAC_SA3L (168) // Specific Address 3 Bottom, First 4 bytes +#define EMAC_SA3H (172) // Specific Address 3 Top, Last 2 bytes +#define EMAC_SA4L (176) // Specific Address 4 Bottom, First 4 bytes +#define EMAC_SA4H (180) // Specific Address 4 Top, Last 2 bytes +#define EMAC_TID (184) // Type ID Checking Register +#define EMAC_TPQ (188) // Transmit Pause Quantum Register +#define EMAC_USRIO (192) // USER Input/Output Register +#define EMAC_WOL (196) // Wake On LAN Register +#define EMAC_REV (252) // Revision Register +// -------- EMAC_NCR : (EMAC Offset: 0x0) -------- +#define AT91C_EMAC_LB (0x1 << 0) // (EMAC) Loopback. Optional. When set, loopback signal is at high level. +#define AT91C_EMAC_LLB (0x1 << 1) // (EMAC) Loopback local. +#define AT91C_EMAC_RE (0x1 << 2) // (EMAC) Receive enable. +#define AT91C_EMAC_TE (0x1 << 3) // (EMAC) Transmit enable. +#define AT91C_EMAC_MPE (0x1 << 4) // (EMAC) Management port enable. +#define AT91C_EMAC_CLRSTAT (0x1 << 5) // (EMAC) Clear statistics registers. +#define AT91C_EMAC_INCSTAT (0x1 << 6) // (EMAC) Increment statistics registers. +#define AT91C_EMAC_WESTAT (0x1 << 7) // (EMAC) Write enable for statistics registers. +#define AT91C_EMAC_BP (0x1 << 8) // (EMAC) Back pressure. +#define AT91C_EMAC_TSTART (0x1 << 9) // (EMAC) Start Transmission. +#define AT91C_EMAC_THALT (0x1 << 10) // (EMAC) Transmission Halt. +#define AT91C_EMAC_TPFR (0x1 << 11) // (EMAC) Transmit pause frame +#define AT91C_EMAC_TZQ (0x1 << 12) // (EMAC) Transmit zero quantum pause frame +// -------- EMAC_NCFGR : (EMAC Offset: 0x4) Network Configuration Register -------- +#define AT91C_EMAC_SPD (0x1 << 0) // (EMAC) Speed. +#define AT91C_EMAC_FD (0x1 << 1) // (EMAC) Full duplex. +#define AT91C_EMAC_JFRAME (0x1 << 3) // (EMAC) Jumbo Frames. +#define AT91C_EMAC_CAF (0x1 << 4) // (EMAC) Copy all frames. +#define AT91C_EMAC_NBC (0x1 << 5) // (EMAC) No broadcast. +#define AT91C_EMAC_MTI (0x1 << 6) // (EMAC) Multicast hash event enable +#define AT91C_EMAC_UNI (0x1 << 7) // (EMAC) Unicast hash enable. +#define AT91C_EMAC_BIG (0x1 << 8) // (EMAC) Receive 1522 bytes. +#define AT91C_EMAC_EAE (0x1 << 9) // (EMAC) External address match enable. +#define AT91C_EMAC_CLK (0x3 << 10) // (EMAC) +#define AT91C_EMAC_CLK_HCLK_8 (0x0 << 10) // (EMAC) HCLK divided by 8 +#define AT91C_EMAC_CLK_HCLK_16 (0x1 << 10) // (EMAC) HCLK divided by 16 +#define AT91C_EMAC_CLK_HCLK_32 (0x2 << 10) // (EMAC) HCLK divided by 32 +#define AT91C_EMAC_CLK_HCLK_64 (0x3 << 10) // (EMAC) HCLK divided by 64 +#define AT91C_EMAC_RTY (0x1 << 12) // (EMAC) +#define AT91C_EMAC_PAE (0x1 << 13) // (EMAC) +#define AT91C_EMAC_RBOF (0x3 << 14) // (EMAC) +#define AT91C_EMAC_RBOF_OFFSET_0 (0x0 << 14) // (EMAC) no offset from start of receive buffer +#define AT91C_EMAC_RBOF_OFFSET_1 (0x1 << 14) // (EMAC) one byte offset from start of receive buffer +#define AT91C_EMAC_RBOF_OFFSET_2 (0x2 << 14) // (EMAC) two bytes offset from start of receive buffer +#define AT91C_EMAC_RBOF_OFFSET_3 (0x3 << 14) // (EMAC) three bytes offset from start of receive buffer +#define AT91C_EMAC_RLCE (0x1 << 16) // (EMAC) Receive Length field Checking Enable +#define AT91C_EMAC_DRFCS (0x1 << 17) // (EMAC) Discard Receive FCS +#define AT91C_EMAC_EFRHD (0x1 << 18) // (EMAC) +#define AT91C_EMAC_IRXFCS (0x1 << 19) // (EMAC) Ignore RX FCS +// -------- EMAC_NSR : (EMAC Offset: 0x8) Network Status Register -------- +#define AT91C_EMAC_LINKR (0x1 << 0) // (EMAC) +#define AT91C_EMAC_MDIO (0x1 << 1) // (EMAC) +#define AT91C_EMAC_IDLE (0x1 << 2) // (EMAC) +// -------- EMAC_TSR : (EMAC Offset: 0x14) Transmit Status Register -------- +#define AT91C_EMAC_UBR (0x1 << 0) // (EMAC) +#define AT91C_EMAC_COL (0x1 << 1) // (EMAC) +#define AT91C_EMAC_RLES (0x1 << 2) // (EMAC) +#define AT91C_EMAC_TGO (0x1 << 3) // (EMAC) Transmit Go +#define AT91C_EMAC_BEX (0x1 << 4) // (EMAC) Buffers exhausted mid frame +#define AT91C_EMAC_COMP (0x1 << 5) // (EMAC) +#define AT91C_EMAC_UND (0x1 << 6) // (EMAC) +// -------- EMAC_RSR : (EMAC Offset: 0x20) Receive Status Register -------- +#define AT91C_EMAC_BNA (0x1 << 0) // (EMAC) +#define AT91C_EMAC_REC (0x1 << 1) // (EMAC) +#define AT91C_EMAC_OVR (0x1 << 2) // (EMAC) +// -------- EMAC_ISR : (EMAC Offset: 0x24) Interrupt Status Register -------- +#define AT91C_EMAC_MFD (0x1 << 0) // (EMAC) +#define AT91C_EMAC_RCOMP (0x1 << 1) // (EMAC) +#define AT91C_EMAC_RXUBR (0x1 << 2) // (EMAC) +#define AT91C_EMAC_TXUBR (0x1 << 3) // (EMAC) +#define AT91C_EMAC_TUNDR (0x1 << 4) // (EMAC) +#define AT91C_EMAC_RLEX (0x1 << 5) // (EMAC) +#define AT91C_EMAC_TXERR (0x1 << 6) // (EMAC) +#define AT91C_EMAC_TCOMP (0x1 << 7) // (EMAC) +#define AT91C_EMAC_LINK (0x1 << 9) // (EMAC) +#define AT91C_EMAC_ROVR (0x1 << 10) // (EMAC) +#define AT91C_EMAC_HRESP (0x1 << 11) // (EMAC) +#define AT91C_EMAC_PFRE (0x1 << 12) // (EMAC) +#define AT91C_EMAC_PTZ (0x1 << 13) // (EMAC) +// -------- EMAC_IER : (EMAC Offset: 0x28) Interrupt Enable Register -------- +// -------- EMAC_IDR : (EMAC Offset: 0x2c) Interrupt Disable Register -------- +// -------- EMAC_IMR : (EMAC Offset: 0x30) Interrupt Mask Register -------- +// -------- EMAC_MAN : (EMAC Offset: 0x34) PHY Maintenance Register -------- +#define AT91C_EMAC_DATA (0xFFFF << 0) // (EMAC) +#define AT91C_EMAC_CODE (0x3 << 16) // (EMAC) +#define AT91C_EMAC_REGA (0x1F << 18) // (EMAC) +#define AT91C_EMAC_PHYA (0x1F << 23) // (EMAC) +#define AT91C_EMAC_RW (0x3 << 28) // (EMAC) +#define AT91C_EMAC_SOF (0x3 << 30) // (EMAC) +// -------- EMAC_USRIO : (EMAC Offset: 0xc0) USER Input Output Register -------- +#define AT91C_EMAC_RMII (0x1 << 0) // (EMAC) Reduce MII +#define AT91C_EMAC_CLKEN (0x1 << 1) // (EMAC) Clock Enable +// -------- EMAC_WOL : (EMAC Offset: 0xc4) Wake On LAN Register -------- +#define AT91C_EMAC_IP (0xFFFF << 0) // (EMAC) ARP request IP address +#define AT91C_EMAC_MAG (0x1 << 16) // (EMAC) Magic packet event enable +#define AT91C_EMAC_ARP (0x1 << 17) // (EMAC) ARP request event enable +#define AT91C_EMAC_SA1 (0x1 << 18) // (EMAC) Specific address register 1 event enable +// -------- EMAC_REV : (EMAC Offset: 0xfc) Revision Register -------- +#define AT91C_EMAC_REVREF (0xFFFF << 0) // (EMAC) +#define AT91C_EMAC_PARTREF (0xFFFF << 16) // (EMAC) + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Analog to Digital Convertor +// ***************************************************************************** +// *** Register offset in AT91S_ADC structure *** +#define ADC_CR ( 0) // ADC Control Register +#define ADC_MR ( 4) // ADC Mode Register +#define ADC_CHER (16) // ADC Channel Enable Register +#define ADC_CHDR (20) // ADC Channel Disable Register +#define ADC_CHSR (24) // ADC Channel Status Register +#define ADC_SR (28) // ADC Status Register +#define ADC_LCDR (32) // ADC Last Converted Data Register +#define ADC_IER (36) // ADC Interrupt Enable Register +#define ADC_IDR (40) // ADC Interrupt Disable Register +#define ADC_IMR (44) // ADC Interrupt Mask Register +#define ADC_CDR0 (48) // ADC Channel Data Register 0 +#define ADC_CDR1 (52) // ADC Channel Data Register 1 +#define ADC_CDR2 (56) // ADC Channel Data Register 2 +#define ADC_CDR3 (60) // ADC Channel Data Register 3 +#define ADC_CDR4 (64) // ADC Channel Data Register 4 +#define ADC_CDR5 (68) // ADC Channel Data Register 5 +#define ADC_CDR6 (72) // ADC Channel Data Register 6 +#define ADC_CDR7 (76) // ADC Channel Data Register 7 +#define ADC_RPR (256) // Receive Pointer Register +#define ADC_RCR (260) // Receive Counter Register +#define ADC_TPR (264) // Transmit Pointer Register +#define ADC_TCR (268) // Transmit Counter Register +#define ADC_RNPR (272) // Receive Next Pointer Register +#define ADC_RNCR (276) // Receive Next Counter Register +#define ADC_TNPR (280) // Transmit Next Pointer Register +#define ADC_TNCR (284) // Transmit Next Counter Register +#define ADC_PTCR (288) // PDC Transfer Control Register +#define ADC_PTSR (292) // PDC Transfer Status Register +// -------- ADC_CR : (ADC Offset: 0x0) ADC Control Register -------- +#define AT91C_ADC_SWRST (0x1 << 0) // (ADC) Software Reset +#define AT91C_ADC_START (0x1 << 1) // (ADC) Start Conversion +// -------- ADC_MR : (ADC Offset: 0x4) ADC Mode Register -------- +#define AT91C_ADC_TRGEN (0x1 << 0) // (ADC) Trigger Enable +#define AT91C_ADC_TRGEN_DIS (0x0) // (ADC) Hradware triggers are disabled. Starting a conversion is only possible by software +#define AT91C_ADC_TRGEN_EN (0x1) // (ADC) Hardware trigger selected by TRGSEL field is enabled. +#define AT91C_ADC_TRGSEL (0x7 << 1) // (ADC) Trigger Selection +#define AT91C_ADC_TRGSEL_TIOA0 (0x0 << 1) // (ADC) Selected TRGSEL = TIAO0 +#define AT91C_ADC_TRGSEL_TIOA1 (0x1 << 1) // (ADC) Selected TRGSEL = TIAO1 +#define AT91C_ADC_TRGSEL_TIOA2 (0x2 << 1) // (ADC) Selected TRGSEL = TIAO2 +#define AT91C_ADC_TRGSEL_TIOA3 (0x3 << 1) // (ADC) Selected TRGSEL = TIAO3 +#define AT91C_ADC_TRGSEL_TIOA4 (0x4 << 1) // (ADC) Selected TRGSEL = TIAO4 +#define AT91C_ADC_TRGSEL_TIOA5 (0x5 << 1) // (ADC) Selected TRGSEL = TIAO5 +#define AT91C_ADC_TRGSEL_EXT (0x6 << 1) // (ADC) Selected TRGSEL = External Trigger +#define AT91C_ADC_LOWRES (0x1 << 4) // (ADC) Resolution. +#define AT91C_ADC_LOWRES_10_BIT (0x0 << 4) // (ADC) 10-bit resolution +#define AT91C_ADC_LOWRES_8_BIT (0x1 << 4) // (ADC) 8-bit resolution +#define AT91C_ADC_SLEEP (0x1 << 5) // (ADC) Sleep Mode +#define AT91C_ADC_SLEEP_NORMAL_MODE (0x0 << 5) // (ADC) Normal Mode +#define AT91C_ADC_SLEEP_MODE (0x1 << 5) // (ADC) Sleep Mode +#define AT91C_ADC_PRESCAL (0x3F << 8) // (ADC) Prescaler rate selection +#define AT91C_ADC_STARTUP (0x1F << 16) // (ADC) Startup Time +#define AT91C_ADC_SHTIM (0xF << 24) // (ADC) Sample & Hold Time +// -------- ADC_CHER : (ADC Offset: 0x10) ADC Channel Enable Register -------- +#define AT91C_ADC_CH0 (0x1 << 0) // (ADC) Channel 0 +#define AT91C_ADC_CH1 (0x1 << 1) // (ADC) Channel 1 +#define AT91C_ADC_CH2 (0x1 << 2) // (ADC) Channel 2 +#define AT91C_ADC_CH3 (0x1 << 3) // (ADC) Channel 3 +#define AT91C_ADC_CH4 (0x1 << 4) // (ADC) Channel 4 +#define AT91C_ADC_CH5 (0x1 << 5) // (ADC) Channel 5 +#define AT91C_ADC_CH6 (0x1 << 6) // (ADC) Channel 6 +#define AT91C_ADC_CH7 (0x1 << 7) // (ADC) Channel 7 +// -------- ADC_CHDR : (ADC Offset: 0x14) ADC Channel Disable Register -------- +// -------- ADC_CHSR : (ADC Offset: 0x18) ADC Channel Status Register -------- +// -------- ADC_SR : (ADC Offset: 0x1c) ADC Status Register -------- +#define AT91C_ADC_EOC0 (0x1 << 0) // (ADC) End of Conversion +#define AT91C_ADC_EOC1 (0x1 << 1) // (ADC) End of Conversion +#define AT91C_ADC_EOC2 (0x1 << 2) // (ADC) End of Conversion +#define AT91C_ADC_EOC3 (0x1 << 3) // (ADC) End of Conversion +#define AT91C_ADC_EOC4 (0x1 << 4) // (ADC) End of Conversion +#define AT91C_ADC_EOC5 (0x1 << 5) // (ADC) End of Conversion +#define AT91C_ADC_EOC6 (0x1 << 6) // (ADC) End of Conversion +#define AT91C_ADC_EOC7 (0x1 << 7) // (ADC) End of Conversion +#define AT91C_ADC_OVRE0 (0x1 << 8) // (ADC) Overrun Error +#define AT91C_ADC_OVRE1 (0x1 << 9) // (ADC) Overrun Error +#define AT91C_ADC_OVRE2 (0x1 << 10) // (ADC) Overrun Error +#define AT91C_ADC_OVRE3 (0x1 << 11) // (ADC) Overrun Error +#define AT91C_ADC_OVRE4 (0x1 << 12) // (ADC) Overrun Error +#define AT91C_ADC_OVRE5 (0x1 << 13) // (ADC) Overrun Error +#define AT91C_ADC_OVRE6 (0x1 << 14) // (ADC) Overrun Error +#define AT91C_ADC_OVRE7 (0x1 << 15) // (ADC) Overrun Error +#define AT91C_ADC_DRDY (0x1 << 16) // (ADC) Data Ready +#define AT91C_ADC_GOVRE (0x1 << 17) // (ADC) General Overrun +#define AT91C_ADC_ENDRX (0x1 << 18) // (ADC) End of Receiver Transfer +#define AT91C_ADC_RXBUFF (0x1 << 19) // (ADC) RXBUFF Interrupt +// -------- ADC_LCDR : (ADC Offset: 0x20) ADC Last Converted Data Register -------- +#define AT91C_ADC_LDATA (0x3FF << 0) // (ADC) Last Data Converted +// -------- ADC_IER : (ADC Offset: 0x24) ADC Interrupt Enable Register -------- +// -------- ADC_IDR : (ADC Offset: 0x28) ADC Interrupt Disable Register -------- +// -------- ADC_IMR : (ADC Offset: 0x2c) ADC Interrupt Mask Register -------- +// -------- ADC_CDR0 : (ADC Offset: 0x30) ADC Channel Data Register 0 -------- +#define AT91C_ADC_DATA (0x3FF << 0) // (ADC) Converted Data +// -------- ADC_CDR1 : (ADC Offset: 0x34) ADC Channel Data Register 1 -------- +// -------- ADC_CDR2 : (ADC Offset: 0x38) ADC Channel Data Register 2 -------- +// -------- ADC_CDR3 : (ADC Offset: 0x3c) ADC Channel Data Register 3 -------- +// -------- ADC_CDR4 : (ADC Offset: 0x40) ADC Channel Data Register 4 -------- +// -------- ADC_CDR5 : (ADC Offset: 0x44) ADC Channel Data Register 5 -------- +// -------- ADC_CDR6 : (ADC Offset: 0x48) ADC Channel Data Register 6 -------- +// -------- ADC_CDR7 : (ADC Offset: 0x4c) ADC Channel Data Register 7 -------- + +// ***************************************************************************** +// REGISTER ADDRESS DEFINITION FOR AT91SAM7X256 +// ***************************************************************************** +// ========== Register definition for SYS peripheral ========== +// ========== Register definition for AIC peripheral ========== +#define AT91C_AIC_ICCR (0xFFFFF128) // (AIC) Interrupt Clear Command Register +#define AT91C_AIC_IECR (0xFFFFF120) // (AIC) Interrupt Enable Command Register +#define AT91C_AIC_SMR (0xFFFFF000) // (AIC) Source Mode Register +#define AT91C_AIC_ISCR (0xFFFFF12C) // (AIC) Interrupt Set Command Register +#define AT91C_AIC_EOICR (0xFFFFF130) // (AIC) End of Interrupt Command Register +#define AT91C_AIC_DCR (0xFFFFF138) // (AIC) Debug Control Register (Protect) +#define AT91C_AIC_FFER (0xFFFFF140) // (AIC) Fast Forcing Enable Register +#define AT91C_AIC_SVR (0xFFFFF080) // (AIC) Source Vector Register +#define AT91C_AIC_SPU (0xFFFFF134) // (AIC) Spurious Vector Register +#define AT91C_AIC_FFDR (0xFFFFF144) // (AIC) Fast Forcing Disable Register +#define AT91C_AIC_FVR (0xFFFFF104) // (AIC) FIQ Vector Register +#define AT91C_AIC_FFSR (0xFFFFF148) // (AIC) Fast Forcing Status Register +#define AT91C_AIC_IMR (0xFFFFF110) // (AIC) Interrupt Mask Register +#define AT91C_AIC_ISR (0xFFFFF108) // (AIC) Interrupt Status Register +#define AT91C_AIC_IVR (0xFFFFF100) // (AIC) IRQ Vector Register +#define AT91C_AIC_IDCR (0xFFFFF124) // (AIC) Interrupt Disable Command Register +#define AT91C_AIC_CISR (0xFFFFF114) // (AIC) Core Interrupt Status Register +#define AT91C_AIC_IPR (0xFFFFF10C) // (AIC) Interrupt Pending Register +// ========== Register definition for PDC_DBGU peripheral ========== +#define AT91C_DBGU_TNCR (0xFFFFF31C) // (PDC_DBGU) Transmit Next Counter Register +#define AT91C_DBGU_RNCR (0xFFFFF314) // (PDC_DBGU) Receive Next Counter Register +#define AT91C_DBGU_PTCR (0xFFFFF320) // (PDC_DBGU) PDC Transfer Control Register +#define AT91C_DBGU_PTSR (0xFFFFF324) // (PDC_DBGU) PDC Transfer Status Register +#define AT91C_DBGU_RCR (0xFFFFF304) // (PDC_DBGU) Receive Counter Register +#define AT91C_DBGU_TCR (0xFFFFF30C) // (PDC_DBGU) Transmit Counter Register +#define AT91C_DBGU_RPR (0xFFFFF300) // (PDC_DBGU) Receive Pointer Register +#define AT91C_DBGU_TPR (0xFFFFF308) // (PDC_DBGU) Transmit Pointer Register +#define AT91C_DBGU_RNPR (0xFFFFF310) // (PDC_DBGU) Receive Next Pointer Register +#define AT91C_DBGU_TNPR (0xFFFFF318) // (PDC_DBGU) Transmit Next Pointer Register +// ========== Register definition for DBGU peripheral ========== +#define AT91C_DBGU_EXID (0xFFFFF244) // (DBGU) Chip ID Extension Register +#define AT91C_DBGU_THR (0xFFFFF21C) // (DBGU) Transmitter Holding Register +#define AT91C_DBGU_CSR (0xFFFFF214) // (DBGU) Channel Status Register +#define AT91C_DBGU_IDR (0xFFFFF20C) // (DBGU) Interrupt Disable Register +#define AT91C_DBGU_MR (0xFFFFF204) // (DBGU) Mode Register +#define AT91C_DBGU_FNTR (0xFFFFF248) // (DBGU) Force NTRST Register +#define AT91C_DBGU_CIDR (0xFFFFF240) // (DBGU) Chip ID Register +#define AT91C_DBGU_BRGR (0xFFFFF220) // (DBGU) Baud Rate Generator Register +#define AT91C_DBGU_RHR (0xFFFFF218) // (DBGU) Receiver Holding Register +#define AT91C_DBGU_IMR (0xFFFFF210) // (DBGU) Interrupt Mask Register +#define AT91C_DBGU_IER (0xFFFFF208) // (DBGU) Interrupt Enable Register +#define AT91C_DBGU_CR (0xFFFFF200) // (DBGU) Control Register +// ========== Register definition for PIOA peripheral ========== +#define AT91C_PIOA_IMR (0xFFFFF448) // (PIOA) Interrupt Mask Register +#define AT91C_PIOA_IER (0xFFFFF440) // (PIOA) Interrupt Enable Register +#define AT91C_PIOA_OWDR (0xFFFFF4A4) // (PIOA) Output Write Disable Register +#define AT91C_PIOA_ISR (0xFFFFF44C) // (PIOA) Interrupt Status Register +#define AT91C_PIOA_PPUDR (0xFFFFF460) // (PIOA) Pull-up Disable Register +#define AT91C_PIOA_MDSR (0xFFFFF458) // (PIOA) Multi-driver Status Register +#define AT91C_PIOA_MDER (0xFFFFF450) // (PIOA) Multi-driver Enable Register +#define AT91C_PIOA_PER (0xFFFFF400) // (PIOA) PIO Enable Register +#define AT91C_PIOA_PSR (0xFFFFF408) // (PIOA) PIO Status Register +#define AT91C_PIOA_OER (0xFFFFF410) // (PIOA) Output Enable Register +#define AT91C_PIOA_BSR (0xFFFFF474) // (PIOA) Select B Register +#define AT91C_PIOA_PPUER (0xFFFFF464) // (PIOA) Pull-up Enable Register +#define AT91C_PIOA_MDDR (0xFFFFF454) // (PIOA) Multi-driver Disable Register +#define AT91C_PIOA_PDR (0xFFFFF404) // (PIOA) PIO Disable Register +#define AT91C_PIOA_ODR (0xFFFFF414) // (PIOA) Output Disable Registerr +#define AT91C_PIOA_IFDR (0xFFFFF424) // (PIOA) Input Filter Disable Register +#define AT91C_PIOA_ABSR (0xFFFFF478) // (PIOA) AB Select Status Register +#define AT91C_PIOA_ASR (0xFFFFF470) // (PIOA) Select A Register +#define AT91C_PIOA_PPUSR (0xFFFFF468) // (PIOA) Pull-up Status Register +#define AT91C_PIOA_ODSR (0xFFFFF438) // (PIOA) Output Data Status Register +#define AT91C_PIOA_SODR (0xFFFFF430) // (PIOA) Set Output Data Register +#define AT91C_PIOA_IFSR (0xFFFFF428) // (PIOA) Input Filter Status Register +#define AT91C_PIOA_IFER (0xFFFFF420) // (PIOA) Input Filter Enable Register +#define AT91C_PIOA_OSR (0xFFFFF418) // (PIOA) Output Status Register +#define AT91C_PIOA_IDR (0xFFFFF444) // (PIOA) Interrupt Disable Register +#define AT91C_PIOA_PDSR (0xFFFFF43C) // (PIOA) Pin Data Status Register +#define AT91C_PIOA_CODR (0xFFFFF434) // (PIOA) Clear Output Data Register +#define AT91C_PIOA_OWSR (0xFFFFF4A8) // (PIOA) Output Write Status Register +#define AT91C_PIOA_OWER (0xFFFFF4A0) // (PIOA) Output Write Enable Register +// ========== Register definition for PIOB peripheral ========== +#define AT91C_PIOB_OWSR (0xFFFFF6A8) // (PIOB) Output Write Status Register +#define AT91C_PIOB_PPUSR (0xFFFFF668) // (PIOB) Pull-up Status Register +#define AT91C_PIOB_PPUDR (0xFFFFF660) // (PIOB) Pull-up Disable Register +#define AT91C_PIOB_MDSR (0xFFFFF658) // (PIOB) Multi-driver Status Register +#define AT91C_PIOB_MDER (0xFFFFF650) // (PIOB) Multi-driver Enable Register +#define AT91C_PIOB_IMR (0xFFFFF648) // (PIOB) Interrupt Mask Register +#define AT91C_PIOB_OSR (0xFFFFF618) // (PIOB) Output Status Register +#define AT91C_PIOB_OER (0xFFFFF610) // (PIOB) Output Enable Register +#define AT91C_PIOB_PSR (0xFFFFF608) // (PIOB) PIO Status Register +#define AT91C_PIOB_PER (0xFFFFF600) // (PIOB) PIO Enable Register +#define AT91C_PIOB_BSR (0xFFFFF674) // (PIOB) Select B Register +#define AT91C_PIOB_PPUER (0xFFFFF664) // (PIOB) Pull-up Enable Register +#define AT91C_PIOB_IFDR (0xFFFFF624) // (PIOB) Input Filter Disable Register +#define AT91C_PIOB_ODR (0xFFFFF614) // (PIOB) Output Disable Registerr +#define AT91C_PIOB_ABSR (0xFFFFF678) // (PIOB) AB Select Status Register +#define AT91C_PIOB_ASR (0xFFFFF670) // (PIOB) Select A Register +#define AT91C_PIOB_IFER (0xFFFFF620) // (PIOB) Input Filter Enable Register +#define AT91C_PIOB_IFSR (0xFFFFF628) // (PIOB) Input Filter Status Register +#define AT91C_PIOB_SODR (0xFFFFF630) // (PIOB) Set Output Data Register +#define AT91C_PIOB_ODSR (0xFFFFF638) // (PIOB) Output Data Status Register +#define AT91C_PIOB_CODR (0xFFFFF634) // (PIOB) Clear Output Data Register +#define AT91C_PIOB_PDSR (0xFFFFF63C) // (PIOB) Pin Data Status Register +#define AT91C_PIOB_OWER (0xFFFFF6A0) // (PIOB) Output Write Enable Register +#define AT91C_PIOB_IER (0xFFFFF640) // (PIOB) Interrupt Enable Register +#define AT91C_PIOB_OWDR (0xFFFFF6A4) // (PIOB) Output Write Disable Register +#define AT91C_PIOB_MDDR (0xFFFFF654) // (PIOB) Multi-driver Disable Register +#define AT91C_PIOB_ISR (0xFFFFF64C) // (PIOB) Interrupt Status Register +#define AT91C_PIOB_IDR (0xFFFFF644) // (PIOB) Interrupt Disable Register +#define AT91C_PIOB_PDR (0xFFFFF604) // (PIOB) PIO Disable Register +// ========== Register definition for CKGR peripheral ========== +#define AT91C_CKGR_PLLR (0xFFFFFC2C) // (CKGR) PLL Register +#define AT91C_CKGR_MCFR (0xFFFFFC24) // (CKGR) Main Clock Frequency Register +#define AT91C_CKGR_MOR (0xFFFFFC20) // (CKGR) Main Oscillator Register +// ========== Register definition for PMC peripheral ========== +#define AT91C_PMC_SCSR (0xFFFFFC08) // (PMC) System Clock Status Register +#define AT91C_PMC_SCER (0xFFFFFC00) // (PMC) System Clock Enable Register +#define AT91C_PMC_IMR (0xFFFFFC6C) // (PMC) Interrupt Mask Register +#define AT91C_PMC_IDR (0xFFFFFC64) // (PMC) Interrupt Disable Register +#define AT91C_PMC_PCDR (0xFFFFFC14) // (PMC) Peripheral Clock Disable Register +#define AT91C_PMC_SCDR (0xFFFFFC04) // (PMC) System Clock Disable Register +#define AT91C_PMC_SR (0xFFFFFC68) // (PMC) Status Register +#define AT91C_PMC_IER (0xFFFFFC60) // (PMC) Interrupt Enable Register +#define AT91C_PMC_MCKR (0xFFFFFC30) // (PMC) Master Clock Register +#define AT91C_PMC_MOR (0xFFFFFC20) // (PMC) Main Oscillator Register +#define AT91C_PMC_PCER (0xFFFFFC10) // (PMC) Peripheral Clock Enable Register +#define AT91C_PMC_PCSR (0xFFFFFC18) // (PMC) Peripheral Clock Status Register +#define AT91C_PMC_PLLR (0xFFFFFC2C) // (PMC) PLL Register +#define AT91C_PMC_MCFR (0xFFFFFC24) // (PMC) Main Clock Frequency Register +#define AT91C_PMC_PCKR (0xFFFFFC40) // (PMC) Programmable Clock Register +// ========== Register definition for RSTC peripheral ========== +#define AT91C_RSTC_RSR (0xFFFFFD04) // (RSTC) Reset Status Register +#define AT91C_RSTC_RMR (0xFFFFFD08) // (RSTC) Reset Mode Register +#define AT91C_RSTC_RCR (0xFFFFFD00) // (RSTC) Reset Control Register +// ========== Register definition for RTTC peripheral ========== +#define AT91C_RTTC_RTSR (0xFFFFFD2C) // (RTTC) Real-time Status Register +#define AT91C_RTTC_RTAR (0xFFFFFD24) // (RTTC) Real-time Alarm Register +#define AT91C_RTTC_RTVR (0xFFFFFD28) // (RTTC) Real-time Value Register +#define AT91C_RTTC_RTMR (0xFFFFFD20) // (RTTC) Real-time Mode Register +// ========== Register definition for PITC peripheral ========== +#define AT91C_PITC_PIIR (0xFFFFFD3C) // (PITC) Period Interval Image Register +#define AT91C_PITC_PISR (0xFFFFFD34) // (PITC) Period Interval Status Register +#define AT91C_PITC_PIVR (0xFFFFFD38) // (PITC) Period Interval Value Register +#define AT91C_PITC_PIMR (0xFFFFFD30) // (PITC) Period Interval Mode Register +// ========== Register definition for WDTC peripheral ========== +#define AT91C_WDTC_WDMR (0xFFFFFD44) // (WDTC) Watchdog Mode Register +#define AT91C_WDTC_WDSR (0xFFFFFD48) // (WDTC) Watchdog Status Register +#define AT91C_WDTC_WDCR (0xFFFFFD40) // (WDTC) Watchdog Control Register +// ========== Register definition for VREG peripheral ========== +#define AT91C_VREG_MR (0xFFFFFD60) // (VREG) Voltage Regulator Mode Register +// ========== Register definition for MC peripheral ========== +#define AT91C_MC_FCR (0xFFFFFF64) // (MC) MC Flash Command Register +#define AT91C_MC_ASR (0xFFFFFF04) // (MC) MC Abort Status Register +#define AT91C_MC_FSR (0xFFFFFF68) // (MC) MC Flash Status Register +#define AT91C_MC_FMR (0xFFFFFF60) // (MC) MC Flash Mode Register +#define AT91C_MC_AASR (0xFFFFFF08) // (MC) MC Abort Address Status Register +#define AT91C_MC_RCR (0xFFFFFF00) // (MC) MC Remap Control Register +// ========== Register definition for PDC_SPI1 peripheral ========== +#define AT91C_SPI1_RNPR (0xFFFE4110) // (PDC_SPI1) Receive Next Pointer Register +#define AT91C_SPI1_TPR (0xFFFE4108) // (PDC_SPI1) Transmit Pointer Register +#define AT91C_SPI1_RPR (0xFFFE4100) // (PDC_SPI1) Receive Pointer Register +#define AT91C_SPI1_PTSR (0xFFFE4124) // (PDC_SPI1) PDC Transfer Status Register +#define AT91C_SPI1_RCR (0xFFFE4104) // (PDC_SPI1) Receive Counter Register +#define AT91C_SPI1_TCR (0xFFFE410C) // (PDC_SPI1) Transmit Counter Register +#define AT91C_SPI1_RNCR (0xFFFE4114) // (PDC_SPI1) Receive Next Counter Register +#define AT91C_SPI1_TNCR (0xFFFE411C) // (PDC_SPI1) Transmit Next Counter Register +#define AT91C_SPI1_TNPR (0xFFFE4118) // (PDC_SPI1) Transmit Next Pointer Register +#define AT91C_SPI1_PTCR (0xFFFE4120) // (PDC_SPI1) PDC Transfer Control Register +// ========== Register definition for SPI1 peripheral ========== +#define AT91C_SPI1_CSR (0xFFFE4030) // (SPI1) Chip Select Register +#define AT91C_SPI1_IDR (0xFFFE4018) // (SPI1) Interrupt Disable Register +#define AT91C_SPI1_SR (0xFFFE4010) // (SPI1) Status Register +#define AT91C_SPI1_RDR (0xFFFE4008) // (SPI1) Receive Data Register +#define AT91C_SPI1_CR (0xFFFE4000) // (SPI1) Control Register +#define AT91C_SPI1_IMR (0xFFFE401C) // (SPI1) Interrupt Mask Register +#define AT91C_SPI1_IER (0xFFFE4014) // (SPI1) Interrupt Enable Register +#define AT91C_SPI1_TDR (0xFFFE400C) // (SPI1) Transmit Data Register +#define AT91C_SPI1_MR (0xFFFE4004) // (SPI1) Mode Register +// ========== Register definition for PDC_SPI0 peripheral ========== +#define AT91C_SPI0_PTCR (0xFFFE0120) // (PDC_SPI0) PDC Transfer Control Register +#define AT91C_SPI0_TNPR (0xFFFE0118) // (PDC_SPI0) Transmit Next Pointer Register +#define AT91C_SPI0_RNPR (0xFFFE0110) // (PDC_SPI0) Receive Next Pointer Register +#define AT91C_SPI0_TPR (0xFFFE0108) // (PDC_SPI0) Transmit Pointer Register +#define AT91C_SPI0_RPR (0xFFFE0100) // (PDC_SPI0) Receive Pointer Register +#define AT91C_SPI0_PTSR (0xFFFE0124) // (PDC_SPI0) PDC Transfer Status Register +#define AT91C_SPI0_TNCR (0xFFFE011C) // (PDC_SPI0) Transmit Next Counter Register +#define AT91C_SPI0_RNCR (0xFFFE0114) // (PDC_SPI0) Receive Next Counter Register +#define AT91C_SPI0_TCR (0xFFFE010C) // (PDC_SPI0) Transmit Counter Register +#define AT91C_SPI0_RCR (0xFFFE0104) // (PDC_SPI0) Receive Counter Register +// ========== Register definition for SPI0 peripheral ========== +#define AT91C_SPI0_CSR (0xFFFE0030) // (SPI0) Chip Select Register +#define AT91C_SPI0_IDR (0xFFFE0018) // (SPI0) Interrupt Disable Register +#define AT91C_SPI0_SR (0xFFFE0010) // (SPI0) Status Register +#define AT91C_SPI0_RDR (0xFFFE0008) // (SPI0) Receive Data Register +#define AT91C_SPI0_CR (0xFFFE0000) // (SPI0) Control Register +#define AT91C_SPI0_IMR (0xFFFE001C) // (SPI0) Interrupt Mask Register +#define AT91C_SPI0_IER (0xFFFE0014) // (SPI0) Interrupt Enable Register +#define AT91C_SPI0_TDR (0xFFFE000C) // (SPI0) Transmit Data Register +#define AT91C_SPI0_MR (0xFFFE0004) // (SPI0) Mode Register +// ========== Register definition for PDC_US1 peripheral ========== +#define AT91C_US1_PTSR (0xFFFC4124) // (PDC_US1) PDC Transfer Status Register +#define AT91C_US1_TNCR (0xFFFC411C) // (PDC_US1) Transmit Next Counter Register +#define AT91C_US1_RNCR (0xFFFC4114) // (PDC_US1) Receive Next Counter Register +#define AT91C_US1_TCR (0xFFFC410C) // (PDC_US1) Transmit Counter Register +#define AT91C_US1_RCR (0xFFFC4104) // (PDC_US1) Receive Counter Register +#define AT91C_US1_PTCR (0xFFFC4120) // (PDC_US1) PDC Transfer Control Register +#define AT91C_US1_TNPR (0xFFFC4118) // (PDC_US1) Transmit Next Pointer Register +#define AT91C_US1_RNPR (0xFFFC4110) // (PDC_US1) Receive Next Pointer Register +#define AT91C_US1_TPR (0xFFFC4108) // (PDC_US1) Transmit Pointer Register +#define AT91C_US1_RPR (0xFFFC4100) // (PDC_US1) Receive Pointer Register +// ========== Register definition for US1 peripheral ========== +#define AT91C_US1_RHR (0xFFFC4018) // (US1) Receiver Holding Register +#define AT91C_US1_IMR (0xFFFC4010) // (US1) Interrupt Mask Register +#define AT91C_US1_IER (0xFFFC4008) // (US1) Interrupt Enable Register +#define AT91C_US1_CR (0xFFFC4000) // (US1) Control Register +#define AT91C_US1_RTOR (0xFFFC4024) // (US1) Receiver Time-out Register +#define AT91C_US1_THR (0xFFFC401C) // (US1) Transmitter Holding Register +#define AT91C_US1_CSR (0xFFFC4014) // (US1) Channel Status Register +#define AT91C_US1_IDR (0xFFFC400C) // (US1) Interrupt Disable Register +#define AT91C_US1_FIDI (0xFFFC4040) // (US1) FI_DI_Ratio Register +#define AT91C_US1_BRGR (0xFFFC4020) // (US1) Baud Rate Generator Register +#define AT91C_US1_TTGR (0xFFFC4028) // (US1) Transmitter Time-guard Register +#define AT91C_US1_IF (0xFFFC404C) // (US1) IRDA_FILTER Register +#define AT91C_US1_NER (0xFFFC4044) // (US1) Nb Errors Register +#define AT91C_US1_MR (0xFFFC4004) // (US1) Mode Register +// ========== Register definition for PDC_US0 peripheral ========== +#define AT91C_US0_PTCR (0xFFFC0120) // (PDC_US0) PDC Transfer Control Register +#define AT91C_US0_TNPR (0xFFFC0118) // (PDC_US0) Transmit Next Pointer Register +#define AT91C_US0_RNPR (0xFFFC0110) // (PDC_US0) Receive Next Pointer Register +#define AT91C_US0_TPR (0xFFFC0108) // (PDC_US0) Transmit Pointer Register +#define AT91C_US0_RPR (0xFFFC0100) // (PDC_US0) Receive Pointer Register +#define AT91C_US0_PTSR (0xFFFC0124) // (PDC_US0) PDC Transfer Status Register +#define AT91C_US0_TNCR (0xFFFC011C) // (PDC_US0) Transmit Next Counter Register +#define AT91C_US0_RNCR (0xFFFC0114) // (PDC_US0) Receive Next Counter Register +#define AT91C_US0_TCR (0xFFFC010C) // (PDC_US0) Transmit Counter Register +#define AT91C_US0_RCR (0xFFFC0104) // (PDC_US0) Receive Counter Register +// ========== Register definition for US0 peripheral ========== +#define AT91C_US0_TTGR (0xFFFC0028) // (US0) Transmitter Time-guard Register +#define AT91C_US0_BRGR (0xFFFC0020) // (US0) Baud Rate Generator Register +#define AT91C_US0_RHR (0xFFFC0018) // (US0) Receiver Holding Register +#define AT91C_US0_IMR (0xFFFC0010) // (US0) Interrupt Mask Register +#define AT91C_US0_NER (0xFFFC0044) // (US0) Nb Errors Register +#define AT91C_US0_RTOR (0xFFFC0024) // (US0) Receiver Time-out Register +#define AT91C_US0_FIDI (0xFFFC0040) // (US0) FI_DI_Ratio Register +#define AT91C_US0_CR (0xFFFC0000) // (US0) Control Register +#define AT91C_US0_IER (0xFFFC0008) // (US0) Interrupt Enable Register +#define AT91C_US0_IF (0xFFFC004C) // (US0) IRDA_FILTER Register +#define AT91C_US0_MR (0xFFFC0004) // (US0) Mode Register +#define AT91C_US0_IDR (0xFFFC000C) // (US0) Interrupt Disable Register +#define AT91C_US0_CSR (0xFFFC0014) // (US0) Channel Status Register +#define AT91C_US0_THR (0xFFFC001C) // (US0) Transmitter Holding Register +// ========== Register definition for PDC_SSC peripheral ========== +#define AT91C_SSC_PTCR (0xFFFD4120) // (PDC_SSC) PDC Transfer Control Register +#define AT91C_SSC_TNPR (0xFFFD4118) // (PDC_SSC) Transmit Next Pointer Register +#define AT91C_SSC_RNPR (0xFFFD4110) // (PDC_SSC) Receive Next Pointer Register +#define AT91C_SSC_TPR (0xFFFD4108) // (PDC_SSC) Transmit Pointer Register +#define AT91C_SSC_RPR (0xFFFD4100) // (PDC_SSC) Receive Pointer Register +#define AT91C_SSC_PTSR (0xFFFD4124) // (PDC_SSC) PDC Transfer Status Register +#define AT91C_SSC_TNCR (0xFFFD411C) // (PDC_SSC) Transmit Next Counter Register +#define AT91C_SSC_RNCR (0xFFFD4114) // (PDC_SSC) Receive Next Counter Register +#define AT91C_SSC_TCR (0xFFFD410C) // (PDC_SSC) Transmit Counter Register +#define AT91C_SSC_RCR (0xFFFD4104) // (PDC_SSC) Receive Counter Register +// ========== Register definition for SSC peripheral ========== +#define AT91C_SSC_RFMR (0xFFFD4014) // (SSC) Receive Frame Mode Register +#define AT91C_SSC_CMR (0xFFFD4004) // (SSC) Clock Mode Register +#define AT91C_SSC_IDR (0xFFFD4048) // (SSC) Interrupt Disable Register +#define AT91C_SSC_SR (0xFFFD4040) // (SSC) Status Register +#define AT91C_SSC_RSHR (0xFFFD4030) // (SSC) Receive Sync Holding Register +#define AT91C_SSC_RHR (0xFFFD4020) // (SSC) Receive Holding Register +#define AT91C_SSC_TCMR (0xFFFD4018) // (SSC) Transmit Clock Mode Register +#define AT91C_SSC_RCMR (0xFFFD4010) // (SSC) Receive Clock ModeRegister +#define AT91C_SSC_CR (0xFFFD4000) // (SSC) Control Register +#define AT91C_SSC_IMR (0xFFFD404C) // (SSC) Interrupt Mask Register +#define AT91C_SSC_IER (0xFFFD4044) // (SSC) Interrupt Enable Register +#define AT91C_SSC_TSHR (0xFFFD4034) // (SSC) Transmit Sync Holding Register +#define AT91C_SSC_THR (0xFFFD4024) // (SSC) Transmit Holding Register +#define AT91C_SSC_TFMR (0xFFFD401C) // (SSC) Transmit Frame Mode Register +// ========== Register definition for TWI peripheral ========== +#define AT91C_TWI_RHR (0xFFFB8030) // (TWI) Receive Holding Register +#define AT91C_TWI_IDR (0xFFFB8028) // (TWI) Interrupt Disable Register +#define AT91C_TWI_SR (0xFFFB8020) // (TWI) Status Register +#define AT91C_TWI_CWGR (0xFFFB8010) // (TWI) Clock Waveform Generator Register +#define AT91C_TWI_CR (0xFFFB8000) // (TWI) Control Register +#define AT91C_TWI_THR (0xFFFB8034) // (TWI) Transmit Holding Register +#define AT91C_TWI_IMR (0xFFFB802C) // (TWI) Interrupt Mask Register +#define AT91C_TWI_IER (0xFFFB8024) // (TWI) Interrupt Enable Register +#define AT91C_TWI_IADR (0xFFFB800C) // (TWI) Internal Address Register +#define AT91C_TWI_MMR (0xFFFB8004) // (TWI) Master Mode Register +// ========== Register definition for PWMC_CH3 peripheral ========== +#define AT91C_PWMC_CH3_CUPDR (0xFFFCC270) // (PWMC_CH3) Channel Update Register +#define AT91C_PWMC_CH3_CPRDR (0xFFFCC268) // (PWMC_CH3) Channel Period Register +#define AT91C_PWMC_CH3_CMR (0xFFFCC260) // (PWMC_CH3) Channel Mode Register +#define AT91C_PWMC_CH3_Reserved (0xFFFCC274) // (PWMC_CH3) Reserved +#define AT91C_PWMC_CH3_CCNTR (0xFFFCC26C) // (PWMC_CH3) Channel Counter Register +#define AT91C_PWMC_CH3_CDTYR (0xFFFCC264) // (PWMC_CH3) Channel Duty Cycle Register +// ========== Register definition for PWMC_CH2 peripheral ========== +#define AT91C_PWMC_CH2_CUPDR (0xFFFCC250) // (PWMC_CH2) Channel Update Register +#define AT91C_PWMC_CH2_CPRDR (0xFFFCC248) // (PWMC_CH2) Channel Period Register +#define AT91C_PWMC_CH2_CMR (0xFFFCC240) // (PWMC_CH2) Channel Mode Register +#define AT91C_PWMC_CH2_Reserved (0xFFFCC254) // (PWMC_CH2) Reserved +#define AT91C_PWMC_CH2_CCNTR (0xFFFCC24C) // (PWMC_CH2) Channel Counter Register +#define AT91C_PWMC_CH2_CDTYR (0xFFFCC244) // (PWMC_CH2) Channel Duty Cycle Register +// ========== Register definition for PWMC_CH1 peripheral ========== +#define AT91C_PWMC_CH1_CUPDR (0xFFFCC230) // (PWMC_CH1) Channel Update Register +#define AT91C_PWMC_CH1_CPRDR (0xFFFCC228) // (PWMC_CH1) Channel Period Register +#define AT91C_PWMC_CH1_CMR (0xFFFCC220) // (PWMC_CH1) Channel Mode Register +#define AT91C_PWMC_CH1_Reserved (0xFFFCC234) // (PWMC_CH1) Reserved +#define AT91C_PWMC_CH1_CCNTR (0xFFFCC22C) // (PWMC_CH1) Channel Counter Register +#define AT91C_PWMC_CH1_CDTYR (0xFFFCC224) // (PWMC_CH1) Channel Duty Cycle Register +// ========== Register definition for PWMC_CH0 peripheral ========== +#define AT91C_PWMC_CH0_CUPDR (0xFFFCC210) // (PWMC_CH0) Channel Update Register +#define AT91C_PWMC_CH0_CPRDR (0xFFFCC208) // (PWMC_CH0) Channel Period Register +#define AT91C_PWMC_CH0_CMR (0xFFFCC200) // (PWMC_CH0) Channel Mode Register +#define AT91C_PWMC_CH0_Reserved (0xFFFCC214) // (PWMC_CH0) Reserved +#define AT91C_PWMC_CH0_CCNTR (0xFFFCC20C) // (PWMC_CH0) Channel Counter Register +#define AT91C_PWMC_CH0_CDTYR (0xFFFCC204) // (PWMC_CH0) Channel Duty Cycle Register +// ========== Register definition for PWMC peripheral ========== +#define AT91C_PWMC_VR (0xFFFCC0FC) // (PWMC) PWMC Version Register +#define AT91C_PWMC_ISR (0xFFFCC01C) // (PWMC) PWMC Interrupt Status Register +#define AT91C_PWMC_IDR (0xFFFCC014) // (PWMC) PWMC Interrupt Disable Register +#define AT91C_PWMC_SR (0xFFFCC00C) // (PWMC) PWMC Status Register +#define AT91C_PWMC_ENA (0xFFFCC004) // (PWMC) PWMC Enable Register +#define AT91C_PWMC_IMR (0xFFFCC018) // (PWMC) PWMC Interrupt Mask Register +#define AT91C_PWMC_MR (0xFFFCC000) // (PWMC) PWMC Mode Register +#define AT91C_PWMC_DIS (0xFFFCC008) // (PWMC) PWMC Disable Register +#define AT91C_PWMC_IER (0xFFFCC010) // (PWMC) PWMC Interrupt Enable Register +// ========== Register definition for UDP peripheral ========== +#define AT91C_UDP_TXVC (0xFFFB0074) // (UDP) Transceiver Control Register +#define AT91C_UDP_ISR (0xFFFB001C) // (UDP) Interrupt Status Register +#define AT91C_UDP_IDR (0xFFFB0014) // (UDP) Interrupt Disable Register +#define AT91C_UDP_CSR (0xFFFB0030) // (UDP) Endpoint Control and Status Register +#define AT91C_UDP_RSTEP (0xFFFB0028) // (UDP) Reset Endpoint Register +#define AT91C_UDP_ICR (0xFFFB0020) // (UDP) Interrupt Clear Register +#define AT91C_UDP_GLBSTATE (0xFFFB0004) // (UDP) Global State Register +#define AT91C_UDP_NUM (0xFFFB0000) // (UDP) Frame Number Register +#define AT91C_UDP_FADDR (0xFFFB0008) // (UDP) Function Address Register +#define AT91C_UDP_IER (0xFFFB0010) // (UDP) Interrupt Enable Register +#define AT91C_UDP_IMR (0xFFFB0018) // (UDP) Interrupt Mask Register +#define AT91C_UDP_FDR (0xFFFB0050) // (UDP) Endpoint FIFO Data Register +// ========== Register definition for TC0 peripheral ========== +#define AT91C_TC0_IMR (0xFFFA002C) // (TC0) Interrupt Mask Register +#define AT91C_TC0_IER (0xFFFA0024) // (TC0) Interrupt Enable Register +#define AT91C_TC0_RC (0xFFFA001C) // (TC0) Register C +#define AT91C_TC0_RA (0xFFFA0014) // (TC0) Register A +#define AT91C_TC0_CMR (0xFFFA0004) // (TC0) Channel Mode Register (Capture Mode / Waveform Mode) +#define AT91C_TC0_IDR (0xFFFA0028) // (TC0) Interrupt Disable Register +#define AT91C_TC0_SR (0xFFFA0020) // (TC0) Status Register +#define AT91C_TC0_RB (0xFFFA0018) // (TC0) Register B +#define AT91C_TC0_CV (0xFFFA0010) // (TC0) Counter Value +#define AT91C_TC0_CCR (0xFFFA0000) // (TC0) Channel Control Register +// ========== Register definition for TC1 peripheral ========== +#define AT91C_TC1_IMR (0xFFFA006C) // (TC1) Interrupt Mask Register +#define AT91C_TC1_IER (0xFFFA0064) // (TC1) Interrupt Enable Register +#define AT91C_TC1_RC (0xFFFA005C) // (TC1) Register C +#define AT91C_TC1_RA (0xFFFA0054) // (TC1) Register A +#define AT91C_TC1_CMR (0xFFFA0044) // (TC1) Channel Mode Register (Capture Mode / Waveform Mode) +#define AT91C_TC1_IDR (0xFFFA0068) // (TC1) Interrupt Disable Register +#define AT91C_TC1_SR (0xFFFA0060) // (TC1) Status Register +#define AT91C_TC1_RB (0xFFFA0058) // (TC1) Register B +#define AT91C_TC1_CV (0xFFFA0050) // (TC1) Counter Value +#define AT91C_TC1_CCR (0xFFFA0040) // (TC1) Channel Control Register +// ========== Register definition for TC2 peripheral ========== +#define AT91C_TC2_IMR (0xFFFA00AC) // (TC2) Interrupt Mask Register +#define AT91C_TC2_IER (0xFFFA00A4) // (TC2) Interrupt Enable Register +#define AT91C_TC2_RC (0xFFFA009C) // (TC2) Register C +#define AT91C_TC2_RA (0xFFFA0094) // (TC2) Register A +#define AT91C_TC2_CMR (0xFFFA0084) // (TC2) Channel Mode Register (Capture Mode / Waveform Mode) +#define AT91C_TC2_IDR (0xFFFA00A8) // (TC2) Interrupt Disable Register +#define AT91C_TC2_SR (0xFFFA00A0) // (TC2) Status Register +#define AT91C_TC2_RB (0xFFFA0098) // (TC2) Register B +#define AT91C_TC2_CV (0xFFFA0090) // (TC2) Counter Value +#define AT91C_TC2_CCR (0xFFFA0080) // (TC2) Channel Control Register +// ========== Register definition for TCB peripheral ========== +#define AT91C_TCB_BMR (0xFFFA00C4) // (TCB) TC Block Mode Register +#define AT91C_TCB_BCR (0xFFFA00C0) // (TCB) TC Block Control Register +// ========== Register definition for CAN_MB0 peripheral ========== +#define AT91C_CAN_MB0_MCR (0xFFFD021C) // (CAN_MB0) MailBox Control Register +#define AT91C_CAN_MB0_MDL (0xFFFD0214) // (CAN_MB0) MailBox Data Low Register +#define AT91C_CAN_MB0_MFID (0xFFFD020C) // (CAN_MB0) MailBox Family ID Register +#define AT91C_CAN_MB0_MAM (0xFFFD0204) // (CAN_MB0) MailBox Acceptance Mask Register +#define AT91C_CAN_MB0_MDH (0xFFFD0218) // (CAN_MB0) MailBox Data High Register +#define AT91C_CAN_MB0_MSR (0xFFFD0210) // (CAN_MB0) MailBox Status Register +#define AT91C_CAN_MB0_MID (0xFFFD0208) // (CAN_MB0) MailBox ID Register +#define AT91C_CAN_MB0_MMR (0xFFFD0200) // (CAN_MB0) MailBox Mode Register +// ========== Register definition for CAN_MB1 peripheral ========== +#define AT91C_CAN_MB1_MCR (0xFFFD023C) // (CAN_MB1) MailBox Control Register +#define AT91C_CAN_MB1_MDL (0xFFFD0234) // (CAN_MB1) MailBox Data Low Register +#define AT91C_CAN_MB1_MFID (0xFFFD022C) // (CAN_MB1) MailBox Family ID Register +#define AT91C_CAN_MB1_MAM (0xFFFD0224) // (CAN_MB1) MailBox Acceptance Mask Register +#define AT91C_CAN_MB1_MDH (0xFFFD0238) // (CAN_MB1) MailBox Data High Register +#define AT91C_CAN_MB1_MSR (0xFFFD0230) // (CAN_MB1) MailBox Status Register +#define AT91C_CAN_MB1_MID (0xFFFD0228) // (CAN_MB1) MailBox ID Register +#define AT91C_CAN_MB1_MMR (0xFFFD0220) // (CAN_MB1) MailBox Mode Register +// ========== Register definition for CAN_MB2 peripheral ========== +#define AT91C_CAN_MB2_MCR (0xFFFD025C) // (CAN_MB2) MailBox Control Register +#define AT91C_CAN_MB2_MDL (0xFFFD0254) // (CAN_MB2) MailBox Data Low Register +#define AT91C_CAN_MB2_MFID (0xFFFD024C) // (CAN_MB2) MailBox Family ID Register +#define AT91C_CAN_MB2_MAM (0xFFFD0244) // (CAN_MB2) MailBox Acceptance Mask Register +#define AT91C_CAN_MB2_MDH (0xFFFD0258) // (CAN_MB2) MailBox Data High Register +#define AT91C_CAN_MB2_MSR (0xFFFD0250) // (CAN_MB2) MailBox Status Register +#define AT91C_CAN_MB2_MID (0xFFFD0248) // (CAN_MB2) MailBox ID Register +#define AT91C_CAN_MB2_MMR (0xFFFD0240) // (CAN_MB2) MailBox Mode Register +// ========== Register definition for CAN_MB3 peripheral ========== +#define AT91C_CAN_MB3_MCR (0xFFFD027C) // (CAN_MB3) MailBox Control Register +#define AT91C_CAN_MB3_MDL (0xFFFD0274) // (CAN_MB3) MailBox Data Low Register +#define AT91C_CAN_MB3_MFID (0xFFFD026C) // (CAN_MB3) MailBox Family ID Register +#define AT91C_CAN_MB3_MAM (0xFFFD0264) // (CAN_MB3) MailBox Acceptance Mask Register +#define AT91C_CAN_MB3_MDH (0xFFFD0278) // (CAN_MB3) MailBox Data High Register +#define AT91C_CAN_MB3_MSR (0xFFFD0270) // (CAN_MB3) MailBox Status Register +#define AT91C_CAN_MB3_MID (0xFFFD0268) // (CAN_MB3) MailBox ID Register +#define AT91C_CAN_MB3_MMR (0xFFFD0260) // (CAN_MB3) MailBox Mode Register +// ========== Register definition for CAN_MB4 peripheral ========== +#define AT91C_CAN_MB4_MCR (0xFFFD029C) // (CAN_MB4) MailBox Control Register +#define AT91C_CAN_MB4_MDL (0xFFFD0294) // (CAN_MB4) MailBox Data Low Register +#define AT91C_CAN_MB4_MFID (0xFFFD028C) // (CAN_MB4) MailBox Family ID Register +#define AT91C_CAN_MB4_MAM (0xFFFD0284) // (CAN_MB4) MailBox Acceptance Mask Register +#define AT91C_CAN_MB4_MDH (0xFFFD0298) // (CAN_MB4) MailBox Data High Register +#define AT91C_CAN_MB4_MSR (0xFFFD0290) // (CAN_MB4) MailBox Status Register +#define AT91C_CAN_MB4_MID (0xFFFD0288) // (CAN_MB4) MailBox ID Register +#define AT91C_CAN_MB4_MMR (0xFFFD0280) // (CAN_MB4) MailBox Mode Register +// ========== Register definition for CAN_MB5 peripheral ========== +#define AT91C_CAN_MB5_MCR (0xFFFD02BC) // (CAN_MB5) MailBox Control Register +#define AT91C_CAN_MB5_MDL (0xFFFD02B4) // (CAN_MB5) MailBox Data Low Register +#define AT91C_CAN_MB5_MFID (0xFFFD02AC) // (CAN_MB5) MailBox Family ID Register +#define AT91C_CAN_MB5_MAM (0xFFFD02A4) // (CAN_MB5) MailBox Acceptance Mask Register +#define AT91C_CAN_MB5_MDH (0xFFFD02B8) // (CAN_MB5) MailBox Data High Register +#define AT91C_CAN_MB5_MSR (0xFFFD02B0) // (CAN_MB5) MailBox Status Register +#define AT91C_CAN_MB5_MID (0xFFFD02A8) // (CAN_MB5) MailBox ID Register +#define AT91C_CAN_MB5_MMR (0xFFFD02A0) // (CAN_MB5) MailBox Mode Register +// ========== Register definition for CAN_MB6 peripheral ========== +#define AT91C_CAN_MB6_MAM (0xFFFD02C4) // (CAN_MB6) MailBox Acceptance Mask Register +#define AT91C_CAN_MB6_MDH (0xFFFD02D8) // (CAN_MB6) MailBox Data High Register +#define AT91C_CAN_MB6_MSR (0xFFFD02D0) // (CAN_MB6) MailBox Status Register +#define AT91C_CAN_MB6_MID (0xFFFD02C8) // (CAN_MB6) MailBox ID Register +#define AT91C_CAN_MB6_MMR (0xFFFD02C0) // (CAN_MB6) MailBox Mode Register +#define AT91C_CAN_MB6_MCR (0xFFFD02DC) // (CAN_MB6) MailBox Control Register +#define AT91C_CAN_MB6_MDL (0xFFFD02D4) // (CAN_MB6) MailBox Data Low Register +#define AT91C_CAN_MB6_MFID (0xFFFD02CC) // (CAN_MB6) MailBox Family ID Register +// ========== Register definition for CAN_MB7 peripheral ========== +#define AT91C_CAN_MB7_MDH (0xFFFD02F8) // (CAN_MB7) MailBox Data High Register +#define AT91C_CAN_MB7_MSR (0xFFFD02F0) // (CAN_MB7) MailBox Status Register +#define AT91C_CAN_MB7_MID (0xFFFD02E8) // (CAN_MB7) MailBox ID Register +#define AT91C_CAN_MB7_MMR (0xFFFD02E0) // (CAN_MB7) MailBox Mode Register +#define AT91C_CAN_MB7_MCR (0xFFFD02FC) // (CAN_MB7) MailBox Control Register +#define AT91C_CAN_MB7_MDL (0xFFFD02F4) // (CAN_MB7) MailBox Data Low Register +#define AT91C_CAN_MB7_MFID (0xFFFD02EC) // (CAN_MB7) MailBox Family ID Register +#define AT91C_CAN_MB7_MAM (0xFFFD02E4) // (CAN_MB7) MailBox Acceptance Mask Register +// ========== Register definition for CAN peripheral ========== +#define AT91C_CAN_IMR (0xFFFD000C) // (CAN) Interrupt Mask Register +#define AT91C_CAN_IER (0xFFFD0004) // (CAN) Interrupt Enable Register +#define AT91C_CAN_ECR (0xFFFD0020) // (CAN) Error Counter Register +#define AT91C_CAN_TIM (0xFFFD0018) // (CAN) Timer Register +#define AT91C_CAN_SR (0xFFFD0010) // (CAN) Status Register +#define AT91C_CAN_IDR (0xFFFD0008) // (CAN) Interrupt Disable Register +#define AT91C_CAN_MR (0xFFFD0000) // (CAN) Mode Register +#define AT91C_CAN_BR (0xFFFD0014) // (CAN) Baudrate Register +#define AT91C_CAN_TIMESTP (0xFFFD001C) // (CAN) Time Stamp Register +#define AT91C_CAN_TCR (0xFFFD0024) // (CAN) Transfer Command Register +#define AT91C_CAN_ACR (0xFFFD0028) // (CAN) Abort Command Register +#define AT91C_CAN_VR (0xFFFD00FC) // (CAN) Version Register +// ========== Register definition for EMAC peripheral ========== +#define AT91C_EMAC_TID (0xFFFDC0B8) // (EMAC) Type ID Checking Register +#define AT91C_EMAC_SA3L (0xFFFDC0A8) // (EMAC) Specific Address 3 Bottom, First 4 bytes +#define AT91C_EMAC_STE (0xFFFDC084) // (EMAC) SQE Test Error Register +#define AT91C_EMAC_RSE (0xFFFDC074) // (EMAC) Receive Symbol Errors Register +#define AT91C_EMAC_IDR (0xFFFDC02C) // (EMAC) Interrupt Disable Register +#define AT91C_EMAC_TBQP (0xFFFDC01C) // (EMAC) Transmit Buffer Queue Pointer +#define AT91C_EMAC_TPQ (0xFFFDC0BC) // (EMAC) Transmit Pause Quantum Register +#define AT91C_EMAC_SA1L (0xFFFDC098) // (EMAC) Specific Address 1 Bottom, First 4 bytes +#define AT91C_EMAC_RLE (0xFFFDC088) // (EMAC) Receive Length Field Mismatch Register +#define AT91C_EMAC_IMR (0xFFFDC030) // (EMAC) Interrupt Mask Register +#define AT91C_EMAC_SA1H (0xFFFDC09C) // (EMAC) Specific Address 1 Top, Last 2 bytes +#define AT91C_EMAC_PFR (0xFFFDC03C) // (EMAC) Pause Frames received Register +#define AT91C_EMAC_FCSE (0xFFFDC050) // (EMAC) Frame Check Sequence Error Register +#define AT91C_EMAC_FTO (0xFFFDC040) // (EMAC) Frames Transmitted OK Register +#define AT91C_EMAC_TUND (0xFFFDC064) // (EMAC) Transmit Underrun Error Register +#define AT91C_EMAC_ALE (0xFFFDC054) // (EMAC) Alignment Error Register +#define AT91C_EMAC_SCF (0xFFFDC044) // (EMAC) Single Collision Frame Register +#define AT91C_EMAC_SA3H (0xFFFDC0AC) // (EMAC) Specific Address 3 Top, Last 2 bytes +#define AT91C_EMAC_ELE (0xFFFDC078) // (EMAC) Excessive Length Errors Register +#define AT91C_EMAC_CSE (0xFFFDC068) // (EMAC) Carrier Sense Error Register +#define AT91C_EMAC_DTF (0xFFFDC058) // (EMAC) Deferred Transmission Frame Register +#define AT91C_EMAC_RSR (0xFFFDC020) // (EMAC) Receive Status Register +#define AT91C_EMAC_USRIO (0xFFFDC0C0) // (EMAC) USER Input/Output Register +#define AT91C_EMAC_SA4L (0xFFFDC0B0) // (EMAC) Specific Address 4 Bottom, First 4 bytes +#define AT91C_EMAC_RRE (0xFFFDC06C) // (EMAC) Receive Ressource Error Register +#define AT91C_EMAC_RJA (0xFFFDC07C) // (EMAC) Receive Jabbers Register +#define AT91C_EMAC_TPF (0xFFFDC08C) // (EMAC) Transmitted Pause Frames Register +#define AT91C_EMAC_ISR (0xFFFDC024) // (EMAC) Interrupt Status Register +#define AT91C_EMAC_MAN (0xFFFDC034) // (EMAC) PHY Maintenance Register +#define AT91C_EMAC_WOL (0xFFFDC0C4) // (EMAC) Wake On LAN Register +#define AT91C_EMAC_USF (0xFFFDC080) // (EMAC) Undersize Frames Register +#define AT91C_EMAC_HRB (0xFFFDC090) // (EMAC) Hash Address Bottom[31:0] +#define AT91C_EMAC_PTR (0xFFFDC038) // (EMAC) Pause Time Register +#define AT91C_EMAC_HRT (0xFFFDC094) // (EMAC) Hash Address Top[63:32] +#define AT91C_EMAC_REV (0xFFFDC0FC) // (EMAC) Revision Register +#define AT91C_EMAC_MCF (0xFFFDC048) // (EMAC) Multiple Collision Frame Register +#define AT91C_EMAC_SA2L (0xFFFDC0A0) // (EMAC) Specific Address 2 Bottom, First 4 bytes +#define AT91C_EMAC_NCR (0xFFFDC000) // (EMAC) Network Control Register +#define AT91C_EMAC_FRO (0xFFFDC04C) // (EMAC) Frames Received OK Register +#define AT91C_EMAC_LCOL (0xFFFDC05C) // (EMAC) Late Collision Register +#define AT91C_EMAC_SA4H (0xFFFDC0B4) // (EMAC) Specific Address 4 Top, Last 2 bytes +#define AT91C_EMAC_NCFGR (0xFFFDC004) // (EMAC) Network Configuration Register +#define AT91C_EMAC_TSR (0xFFFDC014) // (EMAC) Transmit Status Register +#define AT91C_EMAC_SA2H (0xFFFDC0A4) // (EMAC) Specific Address 2 Top, Last 2 bytes +#define AT91C_EMAC_ECOL (0xFFFDC060) // (EMAC) Excessive Collision Register +#define AT91C_EMAC_ROV (0xFFFDC070) // (EMAC) Receive Overrun Errors Register +#define AT91C_EMAC_NSR (0xFFFDC008) // (EMAC) Network Status Register +#define AT91C_EMAC_RBQP (0xFFFDC018) // (EMAC) Receive Buffer Queue Pointer +#define AT91C_EMAC_IER (0xFFFDC028) // (EMAC) Interrupt Enable Register +// ========== Register definition for PDC_ADC peripheral ========== +#define AT91C_ADC_PTCR (0xFFFD8120) // (PDC_ADC) PDC Transfer Control Register +#define AT91C_ADC_TNPR (0xFFFD8118) // (PDC_ADC) Transmit Next Pointer Register +#define AT91C_ADC_RNPR (0xFFFD8110) // (PDC_ADC) Receive Next Pointer Register +#define AT91C_ADC_TPR (0xFFFD8108) // (PDC_ADC) Transmit Pointer Register +#define AT91C_ADC_RPR (0xFFFD8100) // (PDC_ADC) Receive Pointer Register +#define AT91C_ADC_PTSR (0xFFFD8124) // (PDC_ADC) PDC Transfer Status Register +#define AT91C_ADC_TNCR (0xFFFD811C) // (PDC_ADC) Transmit Next Counter Register +#define AT91C_ADC_RNCR (0xFFFD8114) // (PDC_ADC) Receive Next Counter Register +#define AT91C_ADC_TCR (0xFFFD810C) // (PDC_ADC) Transmit Counter Register +#define AT91C_ADC_RCR (0xFFFD8104) // (PDC_ADC) Receive Counter Register +// ========== Register definition for ADC peripheral ========== +#define AT91C_ADC_IMR (0xFFFD802C) // (ADC) ADC Interrupt Mask Register +#define AT91C_ADC_CDR4 (0xFFFD8040) // (ADC) ADC Channel Data Register 4 +#define AT91C_ADC_CDR2 (0xFFFD8038) // (ADC) ADC Channel Data Register 2 +#define AT91C_ADC_CDR0 (0xFFFD8030) // (ADC) ADC Channel Data Register 0 +#define AT91C_ADC_CDR7 (0xFFFD804C) // (ADC) ADC Channel Data Register 7 +#define AT91C_ADC_CDR1 (0xFFFD8034) // (ADC) ADC Channel Data Register 1 +#define AT91C_ADC_CDR3 (0xFFFD803C) // (ADC) ADC Channel Data Register 3 +#define AT91C_ADC_CDR5 (0xFFFD8044) // (ADC) ADC Channel Data Register 5 +#define AT91C_ADC_MR (0xFFFD8004) // (ADC) ADC Mode Register +#define AT91C_ADC_CDR6 (0xFFFD8048) // (ADC) ADC Channel Data Register 6 +#define AT91C_ADC_CR (0xFFFD8000) // (ADC) ADC Control Register +#define AT91C_ADC_CHER (0xFFFD8010) // (ADC) ADC Channel Enable Register +#define AT91C_ADC_CHSR (0xFFFD8018) // (ADC) ADC Channel Status Register +#define AT91C_ADC_IER (0xFFFD8024) // (ADC) ADC Interrupt Enable Register +#define AT91C_ADC_SR (0xFFFD801C) // (ADC) ADC Status Register +#define AT91C_ADC_CHDR (0xFFFD8014) // (ADC) ADC Channel Disable Register +#define AT91C_ADC_IDR (0xFFFD8028) // (ADC) ADC Interrupt Disable Register +#define AT91C_ADC_LCDR (0xFFFD8020) // (ADC) ADC Last Converted Data Register + +// ***************************************************************************** +// PIO DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** +#define AT91C_PIO_PA0 (1 << 0) // Pin Controlled by PA0 +#define AT91C_PA0_RXD0 (AT91C_PIO_PA0) // USART 0 Receive Data +#define AT91C_PIO_PA1 (1 << 1) // Pin Controlled by PA1 +#define AT91C_PA1_TXD0 (AT91C_PIO_PA1) // USART 0 Transmit Data +#define AT91C_PIO_PA10 (1 << 10) // Pin Controlled by PA10 +#define AT91C_PA10_TWD (AT91C_PIO_PA10) // TWI Two-wire Serial Data +#define AT91C_PIO_PA11 (1 << 11) // Pin Controlled by PA11 +#define AT91C_PA11_TWCK (AT91C_PIO_PA11) // TWI Two-wire Serial Clock +#define AT91C_PIO_PA12 (1 << 12) // Pin Controlled by PA12 +#define AT91C_PA12_SPI0_NPCS0 (AT91C_PIO_PA12) // SPI 0 Peripheral Chip Select 0 +#define AT91C_PIO_PA13 (1 << 13) // Pin Controlled by PA13 +#define AT91C_PA13_SPI0_NPCS1 (AT91C_PIO_PA13) // SPI 0 Peripheral Chip Select 1 +#define AT91C_PA13_PCK1 (AT91C_PIO_PA13) // PMC Programmable Clock Output 1 +#define AT91C_PIO_PA14 (1 << 14) // Pin Controlled by PA14 +#define AT91C_PA14_SPI0_NPCS2 (AT91C_PIO_PA14) // SPI 0 Peripheral Chip Select 2 +#define AT91C_PA14_IRQ1 (AT91C_PIO_PA14) // External Interrupt 1 +#define AT91C_PIO_PA15 (1 << 15) // Pin Controlled by PA15 +#define AT91C_PA15_SPI0_NPCS3 (AT91C_PIO_PA15) // SPI 0 Peripheral Chip Select 3 +#define AT91C_PA15_TCLK2 (AT91C_PIO_PA15) // Timer Counter 2 external clock input +#define AT91C_PIO_PA16 (1 << 16) // Pin Controlled by PA16 +#define AT91C_PA16_SPI0_MISO (AT91C_PIO_PA16) // SPI 0 Master In Slave +#define AT91C_PIO_PA17 (1 << 17) // Pin Controlled by PA17 +#define AT91C_PA17_SPI0_MOSI (AT91C_PIO_PA17) // SPI 0 Master Out Slave +#define AT91C_PIO_PA18 (1 << 18) // Pin Controlled by PA18 +#define AT91C_PA18_SPI0_SPCK (AT91C_PIO_PA18) // SPI 0 Serial Clock +#define AT91C_PIO_PA19 (1 << 19) // Pin Controlled by PA19 +#define AT91C_PA19_CANRX (AT91C_PIO_PA19) // CAN Receive +#define AT91C_PIO_PA2 (1 << 2) // Pin Controlled by PA2 +#define AT91C_PA2_SCK0 (AT91C_PIO_PA2) // USART 0 Serial Clock +#define AT91C_PA2_SPI1_NPCS1 (AT91C_PIO_PA2) // SPI 1 Peripheral Chip Select 1 +#define AT91C_PIO_PA20 (1 << 20) // Pin Controlled by PA20 +#define AT91C_PA20_CANTX (AT91C_PIO_PA20) // CAN Transmit +#define AT91C_PIO_PA21 (1 << 21) // Pin Controlled by PA21 +#define AT91C_PA21_TF (AT91C_PIO_PA21) // SSC Transmit Frame Sync +#define AT91C_PA21_SPI1_NPCS0 (AT91C_PIO_PA21) // SPI 1 Peripheral Chip Select 0 +#define AT91C_PIO_PA22 (1 << 22) // Pin Controlled by PA22 +#define AT91C_PA22_TK (AT91C_PIO_PA22) // SSC Transmit Clock +#define AT91C_PA22_SPI1_SPCK (AT91C_PIO_PA22) // SPI 1 Serial Clock +#define AT91C_PIO_PA23 (1 << 23) // Pin Controlled by PA23 +#define AT91C_PA23_TD (AT91C_PIO_PA23) // SSC Transmit data +#define AT91C_PA23_SPI1_MOSI (AT91C_PIO_PA23) // SPI 1 Master Out Slave +#define AT91C_PIO_PA24 (1 << 24) // Pin Controlled by PA24 +#define AT91C_PA24_RD (AT91C_PIO_PA24) // SSC Receive Data +#define AT91C_PA24_SPI1_MISO (AT91C_PIO_PA24) // SPI 1 Master In Slave +#define AT91C_PIO_PA25 (1 << 25) // Pin Controlled by PA25 +#define AT91C_PA25_RK (AT91C_PIO_PA25) // SSC Receive Clock +#define AT91C_PA25_SPI1_NPCS1 (AT91C_PIO_PA25) // SPI 1 Peripheral Chip Select 1 +#define AT91C_PIO_PA26 (1 << 26) // Pin Controlled by PA26 +#define AT91C_PA26_RF (AT91C_PIO_PA26) // SSC Receive Frame Sync +#define AT91C_PA26_SPI1_NPCS2 (AT91C_PIO_PA26) // SPI 1 Peripheral Chip Select 2 +#define AT91C_PIO_PA27 (1 << 27) // Pin Controlled by PA27 +#define AT91C_PA27_DRXD (AT91C_PIO_PA27) // DBGU Debug Receive Data +#define AT91C_PA27_PCK3 (AT91C_PIO_PA27) // PMC Programmable Clock Output 3 +#define AT91C_PIO_PA28 (1 << 28) // Pin Controlled by PA28 +#define AT91C_PA28_DTXD (AT91C_PIO_PA28) // DBGU Debug Transmit Data +#define AT91C_PIO_PA29 (1 << 29) // Pin Controlled by PA29 +#define AT91C_PA29_FIQ (AT91C_PIO_PA29) // AIC Fast Interrupt Input +#define AT91C_PA29_SPI1_NPCS3 (AT91C_PIO_PA29) // SPI 1 Peripheral Chip Select 3 +#define AT91C_PIO_PA3 (1 << 3) // Pin Controlled by PA3 +#define AT91C_PA3_RTS0 (AT91C_PIO_PA3) // USART 0 Ready To Send +#define AT91C_PA3_SPI1_NPCS2 (AT91C_PIO_PA3) // SPI 1 Peripheral Chip Select 2 +#define AT91C_PIO_PA30 (1 << 30) // Pin Controlled by PA30 +#define AT91C_PA30_IRQ0 (AT91C_PIO_PA30) // External Interrupt 0 +#define AT91C_PA30_PCK2 (AT91C_PIO_PA30) // PMC Programmable Clock Output 2 +#define AT91C_PIO_PA4 (1 << 4) // Pin Controlled by PA4 +#define AT91C_PA4_CTS0 (AT91C_PIO_PA4) // USART 0 Clear To Send +#define AT91C_PA4_SPI1_NPCS3 (AT91C_PIO_PA4) // SPI 1 Peripheral Chip Select 3 +#define AT91C_PIO_PA5 (1 << 5) // Pin Controlled by PA5 +#define AT91C_PA5_RXD1 (AT91C_PIO_PA5) // USART 1 Receive Data +#define AT91C_PIO_PA6 (1 << 6) // Pin Controlled by PA6 +#define AT91C_PA6_TXD1 (AT91C_PIO_PA6) // USART 1 Transmit Data +#define AT91C_PIO_PA7 (1 << 7) // Pin Controlled by PA7 +#define AT91C_PA7_SCK1 (AT91C_PIO_PA7) // USART 1 Serial Clock +#define AT91C_PA7_SPI0_NPCS1 (AT91C_PIO_PA7) // SPI 0 Peripheral Chip Select 1 +#define AT91C_PIO_PA8 (1 << 8) // Pin Controlled by PA8 +#define AT91C_PA8_RTS1 (AT91C_PIO_PA8) // USART 1 Ready To Send +#define AT91C_PA8_SPI0_NPCS2 (AT91C_PIO_PA8) // SPI 0 Peripheral Chip Select 2 +#define AT91C_PIO_PA9 (1 << 9) // Pin Controlled by PA9 +#define AT91C_PA9_CTS1 (AT91C_PIO_PA9) // USART 1 Clear To Send +#define AT91C_PA9_SPI0_NPCS3 (AT91C_PIO_PA9) // SPI 0 Peripheral Chip Select 3 +#define AT91C_PIO_PB0 (1 << 0) // Pin Controlled by PB0 +#define AT91C_PB0_ETXCK_EREFCK (AT91C_PIO_PB0) // Ethernet MAC Transmit Clock/Reference Clock +#define AT91C_PB0_PCK0 (AT91C_PIO_PB0) // PMC Programmable Clock Output 0 +#define AT91C_PIO_PB1 (1 << 1) // Pin Controlled by PB1 +#define AT91C_PB1_ETXEN (AT91C_PIO_PB1) // Ethernet MAC Transmit Enable +#define AT91C_PIO_PB10 (1 << 10) // Pin Controlled by PB10 +#define AT91C_PB10_ETX2 (AT91C_PIO_PB10) // Ethernet MAC Transmit Data 2 +#define AT91C_PB10_SPI1_NPCS1 (AT91C_PIO_PB10) // SPI 1 Peripheral Chip Select 1 +#define AT91C_PIO_PB11 (1 << 11) // Pin Controlled by PB11 +#define AT91C_PB11_ETX3 (AT91C_PIO_PB11) // Ethernet MAC Transmit Data 3 +#define AT91C_PB11_SPI1_NPCS2 (AT91C_PIO_PB11) // SPI 1 Peripheral Chip Select 2 +#define AT91C_PIO_PB12 (1 << 12) // Pin Controlled by PB12 +#define AT91C_PB12_ETXER (AT91C_PIO_PB12) // Ethernet MAC Transmikt Coding Error +#define AT91C_PB12_TCLK0 (AT91C_PIO_PB12) // Timer Counter 0 external clock input +#define AT91C_PIO_PB13 (1 << 13) // Pin Controlled by PB13 +#define AT91C_PB13_ERX2 (AT91C_PIO_PB13) // Ethernet MAC Receive Data 2 +#define AT91C_PB13_SPI0_NPCS1 (AT91C_PIO_PB13) // SPI 0 Peripheral Chip Select 1 +#define AT91C_PIO_PB14 (1 << 14) // Pin Controlled by PB14 +#define AT91C_PB14_ERX3 (AT91C_PIO_PB14) // Ethernet MAC Receive Data 3 +#define AT91C_PB14_SPI0_NPCS2 (AT91C_PIO_PB14) // SPI 0 Peripheral Chip Select 2 +#define AT91C_PIO_PB15 (1 << 15) // Pin Controlled by PB15 +#define AT91C_PB15_ERXDV_ECRSDV (AT91C_PIO_PB15) // Ethernet MAC Receive Data Valid +#define AT91C_PIO_PB16 (1 << 16) // Pin Controlled by PB16 +#define AT91C_PB16_ECOL (AT91C_PIO_PB16) // Ethernet MAC Collision Detected +#define AT91C_PB16_SPI1_NPCS3 (AT91C_PIO_PB16) // SPI 1 Peripheral Chip Select 3 +#define AT91C_PIO_PB17 (1 << 17) // Pin Controlled by PB17 +#define AT91C_PB17_ERXCK (AT91C_PIO_PB17) // Ethernet MAC Receive Clock +#define AT91C_PB17_SPI0_NPCS3 (AT91C_PIO_PB17) // SPI 0 Peripheral Chip Select 3 +#define AT91C_PIO_PB18 (1 << 18) // Pin Controlled by PB18 +#define AT91C_PB18_EF100 (AT91C_PIO_PB18) // Ethernet MAC Force 100 Mbits/sec +#define AT91C_PB18_ADTRG (AT91C_PIO_PB18) // ADC External Trigger +#define AT91C_PIO_PB19 (1 << 19) // Pin Controlled by PB19 +#define AT91C_PB19_PWM0 (AT91C_PIO_PB19) // PWM Channel 0 +#define AT91C_PB19_TCLK1 (AT91C_PIO_PB19) // Timer Counter 1 external clock input +#define AT91C_PIO_PB2 (1 << 2) // Pin Controlled by PB2 +#define AT91C_PB2_ETX0 (AT91C_PIO_PB2) // Ethernet MAC Transmit Data 0 +#define AT91C_PIO_PB20 (1 << 20) // Pin Controlled by PB20 +#define AT91C_PB20_PWM1 (AT91C_PIO_PB20) // PWM Channel 1 +#define AT91C_PB20_PCK0 (AT91C_PIO_PB20) // PMC Programmable Clock Output 0 +#define AT91C_PIO_PB21 (1 << 21) // Pin Controlled by PB21 +#define AT91C_PB21_PWM2 (AT91C_PIO_PB21) // PWM Channel 2 +#define AT91C_PB21_PCK1 (AT91C_PIO_PB21) // PMC Programmable Clock Output 1 +#define AT91C_PIO_PB22 (1 << 22) // Pin Controlled by PB22 +#define AT91C_PB22_PWM3 (AT91C_PIO_PB22) // PWM Channel 3 +#define AT91C_PB22_PCK2 (AT91C_PIO_PB22) // PMC Programmable Clock Output 2 +#define AT91C_PIO_PB23 (1 << 23) // Pin Controlled by PB23 +#define AT91C_PB23_TIOA0 (AT91C_PIO_PB23) // Timer Counter 0 Multipurpose Timer I/O Pin A +#define AT91C_PB23_DCD1 (AT91C_PIO_PB23) // USART 1 Data Carrier Detect +#define AT91C_PIO_PB24 (1 << 24) // Pin Controlled by PB24 +#define AT91C_PB24_TIOB0 (AT91C_PIO_PB24) // Timer Counter 0 Multipurpose Timer I/O Pin B +#define AT91C_PB24_DSR1 (AT91C_PIO_PB24) // USART 1 Data Set ready +#define AT91C_PIO_PB25 (1 << 25) // Pin Controlled by PB25 +#define AT91C_PB25_TIOA1 (AT91C_PIO_PB25) // Timer Counter 1 Multipurpose Timer I/O Pin A +#define AT91C_PB25_DTR1 (AT91C_PIO_PB25) // USART 1 Data Terminal ready +#define AT91C_PIO_PB26 (1 << 26) // Pin Controlled by PB26 +#define AT91C_PB26_TIOB1 (AT91C_PIO_PB26) // Timer Counter 1 Multipurpose Timer I/O Pin B +#define AT91C_PB26_RI1 (AT91C_PIO_PB26) // USART 1 Ring Indicator +#define AT91C_PIO_PB27 (1 << 27) // Pin Controlled by PB27 +#define AT91C_PB27_TIOA2 (AT91C_PIO_PB27) // Timer Counter 2 Multipurpose Timer I/O Pin A +#define AT91C_PB27_PWM0 (AT91C_PIO_PB27) // PWM Channel 0 +#define AT91C_PIO_PB28 (1 << 28) // Pin Controlled by PB28 +#define AT91C_PB28_TIOB2 (AT91C_PIO_PB28) // Timer Counter 2 Multipurpose Timer I/O Pin B +#define AT91C_PB28_PWM1 (AT91C_PIO_PB28) // PWM Channel 1 +#define AT91C_PIO_PB29 (1 << 29) // Pin Controlled by PB29 +#define AT91C_PB29_PCK1 (AT91C_PIO_PB29) // PMC Programmable Clock Output 1 +#define AT91C_PB29_PWM2 (AT91C_PIO_PB29) // PWM Channel 2 +#define AT91C_PIO_PB3 (1 << 3) // Pin Controlled by PB3 +#define AT91C_PB3_ETX1 (AT91C_PIO_PB3) // Ethernet MAC Transmit Data 1 +#define AT91C_PIO_PB30 (1 << 30) // Pin Controlled by PB30 +#define AT91C_PB30_PCK2 (AT91C_PIO_PB30) // PMC Programmable Clock Output 2 +#define AT91C_PB30_PWM3 (AT91C_PIO_PB30) // PWM Channel 3 +#define AT91C_PIO_PB4 (1 << 4) // Pin Controlled by PB4 +#define AT91C_PB4_ECRS (AT91C_PIO_PB4) // Ethernet MAC Carrier Sense/Carrier Sense and Data Valid +#define AT91C_PIO_PB5 (1 << 5) // Pin Controlled by PB5 +#define AT91C_PB5_ERX0 (AT91C_PIO_PB5) // Ethernet MAC Receive Data 0 +#define AT91C_PIO_PB6 (1 << 6) // Pin Controlled by PB6 +#define AT91C_PB6_ERX1 (AT91C_PIO_PB6) // Ethernet MAC Receive Data 1 +#define AT91C_PIO_PB7 (1 << 7) // Pin Controlled by PB7 +#define AT91C_PB7_ERXER (AT91C_PIO_PB7) // Ethernet MAC Receive Error +#define AT91C_PIO_PB8 (1 << 8) // Pin Controlled by PB8 +#define AT91C_PB8_EMDC (AT91C_PIO_PB8) // Ethernet MAC Management Data Clock +#define AT91C_PIO_PB9 (1 << 9) // Pin Controlled by PB9 +#define AT91C_PB9_EMDIO (AT91C_PIO_PB9) // Ethernet MAC Management Data Input/Output + +// ***************************************************************************** +// PERIPHERAL ID DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** +#define AT91C_ID_FIQ ( 0) // Advanced Interrupt Controller (FIQ) +#define AT91C_ID_SYS ( 1) // System Peripheral +#define AT91C_ID_PIOA ( 2) // Parallel IO Controller A +#define AT91C_ID_PIOB ( 3) // Parallel IO Controller B +#define AT91C_ID_SPI0 ( 4) // Serial Peripheral Interface 0 +#define AT91C_ID_SPI1 ( 5) // Serial Peripheral Interface 1 +#define AT91C_ID_US0 ( 6) // USART 0 +#define AT91C_ID_US1 ( 7) // USART 1 +#define AT91C_ID_SSC ( 8) // Serial Synchronous Controller +#define AT91C_ID_TWI ( 9) // Two-Wire Interface +#define AT91C_ID_PWMC (10) // PWM Controller +#define AT91C_ID_UDP (11) // USB Device Port +#define AT91C_ID_TC0 (12) // Timer Counter 0 +#define AT91C_ID_TC1 (13) // Timer Counter 1 +#define AT91C_ID_TC2 (14) // Timer Counter 2 +#define AT91C_ID_CAN (15) // Control Area Network Controller +#define AT91C_ID_EMAC (16) // Ethernet MAC +#define AT91C_ID_ADC (17) // Analog-to-Digital Converter +#define AT91C_ID_18_Reserved (18) // Reserved +#define AT91C_ID_19_Reserved (19) // Reserved +#define AT91C_ID_20_Reserved (20) // Reserved +#define AT91C_ID_21_Reserved (21) // Reserved +#define AT91C_ID_22_Reserved (22) // Reserved +#define AT91C_ID_23_Reserved (23) // Reserved +#define AT91C_ID_24_Reserved (24) // Reserved +#define AT91C_ID_25_Reserved (25) // Reserved +#define AT91C_ID_26_Reserved (26) // Reserved +#define AT91C_ID_27_Reserved (27) // Reserved +#define AT91C_ID_28_Reserved (28) // Reserved +#define AT91C_ID_29_Reserved (29) // Reserved +#define AT91C_ID_IRQ0 (30) // Advanced Interrupt Controller (IRQ0) +#define AT91C_ID_IRQ1 (31) // Advanced Interrupt Controller (IRQ1) +#define AT91C_ALL_INT (0xC003FFFF) // ALL VALID INTERRUPTS + +// ***************************************************************************** +// BASE ADDRESS DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** +#define AT91C_BASE_SYS (0xFFFFF000) // (SYS) Base Address +#define AT91C_BASE_AIC (0xFFFFF000) // (AIC) Base Address +#define AT91C_BASE_PDC_DBGU (0xFFFFF300) // (PDC_DBGU) Base Address +#define AT91C_BASE_DBGU (0xFFFFF200) // (DBGU) Base Address +#define AT91C_BASE_PIOA (0xFFFFF400) // (PIOA) Base Address +#define AT91C_BASE_PIOB (0xFFFFF600) // (PIOB) Base Address +#define AT91C_BASE_CKGR (0xFFFFFC20) // (CKGR) Base Address +#define AT91C_BASE_PMC (0xFFFFFC00) // (PMC) Base Address +#define AT91C_BASE_RSTC (0xFFFFFD00) // (RSTC) Base Address +#define AT91C_BASE_RTTC (0xFFFFFD20) // (RTTC) Base Address +#define AT91C_BASE_PITC (0xFFFFFD30) // (PITC) Base Address +#define AT91C_BASE_WDTC (0xFFFFFD40) // (WDTC) Base Address +#define AT91C_BASE_VREG (0xFFFFFD60) // (VREG) Base Address +#define AT91C_BASE_MC (0xFFFFFF00) // (MC) Base Address +#define AT91C_BASE_PDC_SPI1 (0xFFFE4100) // (PDC_SPI1) Base Address +#define AT91C_BASE_SPI1 (0xFFFE4000) // (SPI1) Base Address +#define AT91C_BASE_PDC_SPI0 (0xFFFE0100) // (PDC_SPI0) Base Address +#define AT91C_BASE_SPI0 (0xFFFE0000) // (SPI0) Base Address +#define AT91C_BASE_PDC_US1 (0xFFFC4100) // (PDC_US1) Base Address +#define AT91C_BASE_US1 (0xFFFC4000) // (US1) Base Address +#define AT91C_BASE_PDC_US0 (0xFFFC0100) // (PDC_US0) Base Address +#define AT91C_BASE_US0 (0xFFFC0000) // (US0) Base Address +#define AT91C_BASE_PDC_SSC (0xFFFD4100) // (PDC_SSC) Base Address +#define AT91C_BASE_SSC (0xFFFD4000) // (SSC) Base Address +#define AT91C_BASE_TWI (0xFFFB8000) // (TWI) Base Address +#define AT91C_BASE_PWMC_CH3 (0xFFFCC260) // (PWMC_CH3) Base Address +#define AT91C_BASE_PWMC_CH2 (0xFFFCC240) // (PWMC_CH2) Base Address +#define AT91C_BASE_PWMC_CH1 (0xFFFCC220) // (PWMC_CH1) Base Address +#define AT91C_BASE_PWMC_CH0 (0xFFFCC200) // (PWMC_CH0) Base Address +#define AT91C_BASE_PWMC (0xFFFCC000) // (PWMC) Base Address +#define AT91C_BASE_UDP (0xFFFB0000) // (UDP) Base Address +#define AT91C_BASE_TC0 (0xFFFA0000) // (TC0) Base Address +#define AT91C_BASE_TC1 (0xFFFA0040) // (TC1) Base Address +#define AT91C_BASE_TC2 (0xFFFA0080) // (TC2) Base Address +#define AT91C_BASE_TCB (0xFFFA0000) // (TCB) Base Address +#define AT91C_BASE_CAN_MB0 (0xFFFD0200) // (CAN_MB0) Base Address +#define AT91C_BASE_CAN_MB1 (0xFFFD0220) // (CAN_MB1) Base Address +#define AT91C_BASE_CAN_MB2 (0xFFFD0240) // (CAN_MB2) Base Address +#define AT91C_BASE_CAN_MB3 (0xFFFD0260) // (CAN_MB3) Base Address +#define AT91C_BASE_CAN_MB4 (0xFFFD0280) // (CAN_MB4) Base Address +#define AT91C_BASE_CAN_MB5 (0xFFFD02A0) // (CAN_MB5) Base Address +#define AT91C_BASE_CAN_MB6 (0xFFFD02C0) // (CAN_MB6) Base Address +#define AT91C_BASE_CAN_MB7 (0xFFFD02E0) // (CAN_MB7) Base Address +#define AT91C_BASE_CAN (0xFFFD0000) // (CAN) Base Address +#define AT91C_BASE_EMAC (0xFFFDC000) // (EMAC) Base Address +#define AT91C_BASE_PDC_ADC (0xFFFD8100) // (PDC_ADC) Base Address +#define AT91C_BASE_ADC (0xFFFD8000) // (ADC) Base Address + +// ***************************************************************************** +// MEMORY MAPPING DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** +// ISRAM +#define AT91C_ISRAM (0x00200000) // Internal SRAM base address +#define AT91C_ISRAM_SIZE (0x00010000) // Internal SRAM size in byte (64 Kbytes) +// IFLASH +#define AT91C_IFLASH (0x00100000) // Internal FLASH base address +#define AT91C_IFLASH_SIZE (0x00040000) // Internal FLASH size in byte (256 Kbytes) +#define AT91C_IFLASH_PAGE_SIZE (256) // Internal FLASH Page Size: 256 bytes +#define AT91C_IFLASH_LOCK_REGION_SIZE (16384) // Internal FLASH Lock Region Size: 16 Kbytes +#define AT91C_IFLASH_NB_OF_PAGES (1024) // Internal FLASH Number of Pages: 1024 bytes +#define AT91C_IFLASH_NB_OF_LOCK_BITS (16) // Internal FLASH Number of Lock Bits: 16 bytes + + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/incIAR/lib_AT91SAM7X256.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/incIAR/lib_AT91SAM7X256.h new file mode 100644 index 0000000..8bd8f04 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/incIAR/lib_AT91SAM7X256.h @@ -0,0 +1,4211 @@ +//* ---------------------------------------------------------------------------- +//* ATMEL Microcontroller Software Support - ROUSSET - +//* ---------------------------------------------------------------------------- +//* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +//* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +//* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +//* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +//* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +//* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +//* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +//* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +//* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +//* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +//* ---------------------------------------------------------------------------- +//* File Name : lib_AT91SAM7X256.h +//* Object : AT91SAM7X256 inlined functions +//* Generated : AT91 SW Application Group 01/16/2006 (16:36:21) +//* +//* CVS Reference : /lib_MC_SAM7X.h/1.1/Thu Mar 25 15:19:14 2004// +//* CVS Reference : /lib_pdc.h/1.2/Tue Jul 2 13:29:40 2002// +//* CVS Reference : /lib_dbgu.h/1.1/Thu Aug 25 12:56:22 2005// +//* CVS Reference : /lib_VREG_6085B.h/1.1/Tue Feb 1 16:20:47 2005// +//* CVS Reference : /lib_ssc.h/1.4/Fri Jan 31 12:19:20 2003// +//* CVS Reference : /lib_spi2.h/1.2/Tue Aug 23 15:37:28 2005// +//* CVS Reference : /lib_PWM_SAM.h/1.3/Thu Jan 22 10:10:50 2004// +//* CVS Reference : /lib_tc_1753b.h/1.1/Fri Jan 31 12:20:02 2003// +//* CVS Reference : /lib_pitc_6079A.h/1.2/Tue Nov 9 14:43:56 2004// +//* CVS Reference : /lib_adc.h/1.6/Fri Oct 17 09:12:38 2003// +//* CVS Reference : /lib_pmc_SAM7X.h/1.5/Fri Nov 4 09:41:32 2005// +//* CVS Reference : /lib_rstc_6098A.h/1.1/Wed Oct 6 10:39:20 2004// +//* CVS Reference : /lib_rttc_6081A.h/1.1/Wed Oct 6 10:39:38 2004// +//* CVS Reference : /lib_pio.h/1.3/Fri Jan 31 12:18:56 2003// +//* CVS Reference : /lib_twi.h/1.3/Mon Jul 19 14:27:58 2004// +//* CVS Reference : /lib_wdtc_6080A.h/1.1/Wed Oct 6 10:38:30 2004// +//* CVS Reference : /lib_usart.h/1.5/Thu Nov 21 16:01:54 2002// +//* CVS Reference : /lib_udp.h/1.5/Tue Aug 30 12:13:47 2005// +//* CVS Reference : /lib_aic_6075b.h/1.2/Thu Jul 7 07:48:22 2005// +//* CVS Reference : /lib_can_AT91.h/1.5/Tue Aug 23 15:37:07 2005// +//* ---------------------------------------------------------------------------- + +#ifndef lib_AT91SAM7X256_H +#define lib_AT91SAM7X256_H + +/* ***************************************************************************** + SOFTWARE API FOR AIC + ***************************************************************************** */ +#define AT91C_AIC_BRANCH_OPCODE ((void (*) ()) 0xE51FFF20) // ldr, pc, [pc, #-&F20] + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_ConfigureIt +//* \brief Interrupt Handler Initialization +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_AIC_ConfigureIt ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id, // \arg interrupt number to initialize + unsigned int priority, // \arg priority to give to the interrupt + unsigned int src_type, // \arg activation and sense of activation + void (*newHandler) () ) // \arg address of the interrupt handler +{ + unsigned int oldHandler; + unsigned int mask ; + + oldHandler = pAic->AIC_SVR[irq_id]; + + mask = 0x1 << irq_id ; + //* Disable the interrupt on the interrupt controller + pAic->AIC_IDCR = mask ; + //* Save the interrupt handler routine pointer and the interrupt priority + pAic->AIC_SVR[irq_id] = (unsigned int) newHandler ; + //* Store the Source Mode Register + pAic->AIC_SMR[irq_id] = src_type | priority ; + //* Clear the interrupt on the interrupt controller + pAic->AIC_ICCR = mask ; + + return oldHandler; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_EnableIt +//* \brief Enable corresponding IT number +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_EnableIt ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id ) // \arg interrupt number to initialize +{ + //* Enable the interrupt on the interrupt controller + pAic->AIC_IECR = 0x1 << irq_id ; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_DisableIt +//* \brief Disable corresponding IT number +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_DisableIt ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id ) // \arg interrupt number to initialize +{ + unsigned int mask = 0x1 << irq_id; + //* Disable the interrupt on the interrupt controller + pAic->AIC_IDCR = mask ; + //* Clear the interrupt on the Interrupt Controller ( if one is pending ) + pAic->AIC_ICCR = mask ; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_ClearIt +//* \brief Clear corresponding IT number +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_ClearIt ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id) // \arg interrupt number to initialize +{ + //* Clear the interrupt on the Interrupt Controller ( if one is pending ) + pAic->AIC_ICCR = (0x1 << irq_id); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_AcknowledgeIt +//* \brief Acknowledge corresponding IT number +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_AcknowledgeIt ( + AT91PS_AIC pAic) // \arg pointer to the AIC registers +{ + pAic->AIC_EOICR = pAic->AIC_EOICR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_SetExceptionVector +//* \brief Configure vector handler +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_AIC_SetExceptionVector ( + unsigned int *pVector, // \arg pointer to the AIC registers + void (*Handler) () ) // \arg Interrupt Handler +{ + unsigned int oldVector = *pVector; + + if ((unsigned int) Handler == (unsigned int) AT91C_AIC_BRANCH_OPCODE) + *pVector = (unsigned int) AT91C_AIC_BRANCH_OPCODE; + else + *pVector = (((((unsigned int) Handler) - ((unsigned int) pVector) - 0x8) >> 2) & 0x00FFFFFF) | 0xEA000000; + + return oldVector; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_Trig +//* \brief Trig an IT +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_Trig ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id) // \arg interrupt number +{ + pAic->AIC_ISCR = (0x1 << irq_id) ; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_IsActive +//* \brief Test if an IT is active +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_AIC_IsActive ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id) // \arg Interrupt Number +{ + return (pAic->AIC_ISR & (0x1 << irq_id)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_IsPending +//* \brief Test if an IT is pending +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_AIC_IsPending ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id) // \arg Interrupt Number +{ + return (pAic->AIC_IPR & (0x1 << irq_id)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_Open +//* \brief Set exception vectors and AIC registers to default values +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_Open( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + void (*IrqHandler) (), // \arg Default IRQ vector exception + void (*FiqHandler) (), // \arg Default FIQ vector exception + void (*DefaultHandler) (), // \arg Default Handler set in ISR + void (*SpuriousHandler) (), // \arg Default Spurious Handler + unsigned int protectMode) // \arg Debug Control Register +{ + int i; + + // Disable all interrupts and set IVR to the default handler + for (i = 0; i < 32; ++i) { + AT91F_AIC_DisableIt(pAic, i); + AT91F_AIC_ConfigureIt(pAic, i, AT91C_AIC_PRIOR_LOWEST, AT91C_AIC_SRCTYPE_HIGH_LEVEL, DefaultHandler); + } + + // Set the IRQ exception vector + AT91F_AIC_SetExceptionVector((unsigned int *) 0x18, IrqHandler); + // Set the Fast Interrupt exception vector + AT91F_AIC_SetExceptionVector((unsigned int *) 0x1C, FiqHandler); + + pAic->AIC_SPU = (unsigned int) SpuriousHandler; + pAic->AIC_DCR = protectMode; +} +/* ***************************************************************************** + SOFTWARE API FOR PDC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_SetNextRx +//* \brief Set the next receive transfer descriptor +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_SetNextRx ( + AT91PS_PDC pPDC, // \arg pointer to a PDC controller + char *address, // \arg address to the next bloc to be received + unsigned int bytes) // \arg number of bytes to be received +{ + pPDC->PDC_RNPR = (unsigned int) address; + pPDC->PDC_RNCR = bytes; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_SetNextTx +//* \brief Set the next transmit transfer descriptor +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_SetNextTx ( + AT91PS_PDC pPDC, // \arg pointer to a PDC controller + char *address, // \arg address to the next bloc to be transmitted + unsigned int bytes) // \arg number of bytes to be transmitted +{ + pPDC->PDC_TNPR = (unsigned int) address; + pPDC->PDC_TNCR = bytes; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_SetRx +//* \brief Set the receive transfer descriptor +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_SetRx ( + AT91PS_PDC pPDC, // \arg pointer to a PDC controller + char *address, // \arg address to the next bloc to be received + unsigned int bytes) // \arg number of bytes to be received +{ + pPDC->PDC_RPR = (unsigned int) address; + pPDC->PDC_RCR = bytes; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_SetTx +//* \brief Set the transmit transfer descriptor +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_SetTx ( + AT91PS_PDC pPDC, // \arg pointer to a PDC controller + char *address, // \arg address to the next bloc to be transmitted + unsigned int bytes) // \arg number of bytes to be transmitted +{ + pPDC->PDC_TPR = (unsigned int) address; + pPDC->PDC_TCR = bytes; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_EnableTx +//* \brief Enable transmit +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_EnableTx ( + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + pPDC->PDC_PTCR = AT91C_PDC_TXTEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_EnableRx +//* \brief Enable receive +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_EnableRx ( + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + pPDC->PDC_PTCR = AT91C_PDC_RXTEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_DisableTx +//* \brief Disable transmit +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_DisableTx ( + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + pPDC->PDC_PTCR = AT91C_PDC_TXTDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_DisableRx +//* \brief Disable receive +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_DisableRx ( + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + pPDC->PDC_PTCR = AT91C_PDC_RXTDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_IsTxEmpty +//* \brief Test if the current transfer descriptor has been sent +//*---------------------------------------------------------------------------- +__inline int AT91F_PDC_IsTxEmpty ( // \return return 1 if transfer is complete + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + return !(pPDC->PDC_TCR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_IsNextTxEmpty +//* \brief Test if the next transfer descriptor has been moved to the current td +//*---------------------------------------------------------------------------- +__inline int AT91F_PDC_IsNextTxEmpty ( // \return return 1 if transfer is complete + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + return !(pPDC->PDC_TNCR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_IsRxEmpty +//* \brief Test if the current transfer descriptor has been filled +//*---------------------------------------------------------------------------- +__inline int AT91F_PDC_IsRxEmpty ( // \return return 1 if transfer is complete + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + return !(pPDC->PDC_RCR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_IsNextRxEmpty +//* \brief Test if the next transfer descriptor has been moved to the current td +//*---------------------------------------------------------------------------- +__inline int AT91F_PDC_IsNextRxEmpty ( // \return return 1 if transfer is complete + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + return !(pPDC->PDC_RNCR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_Open +//* \brief Open PDC: disable TX and RX reset transfer descriptors, re-enable RX and TX +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_Open ( + AT91PS_PDC pPDC) // \arg pointer to a PDC controller +{ + //* Disable the RX and TX PDC transfer requests + AT91F_PDC_DisableRx(pPDC); + AT91F_PDC_DisableTx(pPDC); + + //* Reset all Counter register Next buffer first + AT91F_PDC_SetNextTx(pPDC, (char *) 0, 0); + AT91F_PDC_SetNextRx(pPDC, (char *) 0, 0); + AT91F_PDC_SetTx(pPDC, (char *) 0, 0); + AT91F_PDC_SetRx(pPDC, (char *) 0, 0); + + //* Enable the RX and TX PDC transfer requests + AT91F_PDC_EnableRx(pPDC); + AT91F_PDC_EnableTx(pPDC); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_Close +//* \brief Close PDC: disable TX and RX reset transfer descriptors +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_Close ( + AT91PS_PDC pPDC) // \arg pointer to a PDC controller +{ + //* Disable the RX and TX PDC transfer requests + AT91F_PDC_DisableRx(pPDC); + AT91F_PDC_DisableTx(pPDC); + + //* Reset all Counter register Next buffer first + AT91F_PDC_SetNextTx(pPDC, (char *) 0, 0); + AT91F_PDC_SetNextRx(pPDC, (char *) 0, 0); + AT91F_PDC_SetTx(pPDC, (char *) 0, 0); + AT91F_PDC_SetRx(pPDC, (char *) 0, 0); + +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_SendFrame +//* \brief Close PDC: disable TX and RX reset transfer descriptors +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PDC_SendFrame( + AT91PS_PDC pPDC, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + if (AT91F_PDC_IsTxEmpty(pPDC)) { + //* Buffer and next buffer can be initialized + AT91F_PDC_SetTx(pPDC, pBuffer, szBuffer); + AT91F_PDC_SetNextTx(pPDC, pNextBuffer, szNextBuffer); + return 2; + } + else if (AT91F_PDC_IsNextTxEmpty(pPDC)) { + //* Only one buffer can be initialized + AT91F_PDC_SetNextTx(pPDC, pBuffer, szBuffer); + return 1; + } + else { + //* All buffer are in use... + return 0; + } +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_ReceiveFrame +//* \brief Close PDC: disable TX and RX reset transfer descriptors +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PDC_ReceiveFrame ( + AT91PS_PDC pPDC, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + if (AT91F_PDC_IsRxEmpty(pPDC)) { + //* Buffer and next buffer can be initialized + AT91F_PDC_SetRx(pPDC, pBuffer, szBuffer); + AT91F_PDC_SetNextRx(pPDC, pNextBuffer, szNextBuffer); + return 2; + } + else if (AT91F_PDC_IsNextRxEmpty(pPDC)) { + //* Only one buffer can be initialized + AT91F_PDC_SetNextRx(pPDC, pBuffer, szBuffer); + return 1; + } + else { + //* All buffer are in use... + return 0; + } +} +/* ***************************************************************************** + SOFTWARE API FOR DBGU + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_DBGU_InterruptEnable +//* \brief Enable DBGU Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_DBGU_InterruptEnable( + AT91PS_DBGU pDbgu, // \arg pointer to a DBGU controller + unsigned int flag) // \arg dbgu interrupt to be enabled +{ + pDbgu->DBGU_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_DBGU_InterruptDisable +//* \brief Disable DBGU Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_DBGU_InterruptDisable( + AT91PS_DBGU pDbgu, // \arg pointer to a DBGU controller + unsigned int flag) // \arg dbgu interrupt to be disabled +{ + pDbgu->DBGU_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_DBGU_GetInterruptMaskStatus +//* \brief Return DBGU Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_DBGU_GetInterruptMaskStatus( // \return DBGU Interrupt Mask Status + AT91PS_DBGU pDbgu) // \arg pointer to a DBGU controller +{ + return pDbgu->DBGU_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_DBGU_IsInterruptMasked +//* \brief Test if DBGU Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_DBGU_IsInterruptMasked( + AT91PS_DBGU pDbgu, // \arg pointer to a DBGU controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_DBGU_GetInterruptMaskStatus(pDbgu) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR PIO + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgPeriph +//* \brief Enable pins to be drived by peripheral +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgPeriph( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int periphAEnable, // \arg PERIPH A to enable + unsigned int periphBEnable) // \arg PERIPH B to enable + +{ + pPio->PIO_ASR = periphAEnable; + pPio->PIO_BSR = periphBEnable; + pPio->PIO_PDR = (periphAEnable | periphBEnable); // Set in Periph mode +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgOutput +//* \brief Enable PIO in output mode +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgOutput( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int pioEnable) // \arg PIO to be enabled +{ + pPio->PIO_PER = pioEnable; // Set in PIO mode + pPio->PIO_OER = pioEnable; // Configure in Output +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgInput +//* \brief Enable PIO in input mode +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgInput( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int inputEnable) // \arg PIO to be enabled +{ + // Disable output + pPio->PIO_ODR = inputEnable; + pPio->PIO_PER = inputEnable; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgOpendrain +//* \brief Configure PIO in open drain +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgOpendrain( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int multiDrvEnable) // \arg pio to be configured in open drain +{ + // Configure the multi-drive option + pPio->PIO_MDDR = ~multiDrvEnable; + pPio->PIO_MDER = multiDrvEnable; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgPullup +//* \brief Enable pullup on PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgPullup( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int pullupEnable) // \arg enable pullup on PIO +{ + // Connect or not Pullup + pPio->PIO_PPUDR = ~pullupEnable; + pPio->PIO_PPUER = pullupEnable; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgDirectDrive +//* \brief Enable direct drive on PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgDirectDrive( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int directDrive) // \arg PIO to be configured with direct drive + +{ + // Configure the Direct Drive + pPio->PIO_OWDR = ~directDrive; + pPio->PIO_OWER = directDrive; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgInputFilter +//* \brief Enable input filter on input PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgInputFilter( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int inputFilter) // \arg PIO to be configured with input filter + +{ + // Configure the Direct Drive + pPio->PIO_IFDR = ~inputFilter; + pPio->PIO_IFER = inputFilter; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetInput +//* \brief Return PIO input value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetInput( // \return PIO input + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_PDSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsInputSet +//* \brief Test if PIO is input flag is active +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsInputSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetInput(pPio) & flag); +} + + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_SetOutput +//* \brief Set to 1 output PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_SetOutput( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg output to be set +{ + pPio->PIO_SODR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_ClearOutput +//* \brief Set to 0 output PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_ClearOutput( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg output to be cleared +{ + pPio->PIO_CODR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_ForceOutput +//* \brief Force output when Direct drive option is enabled +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_ForceOutput( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg output to be forced +{ + pPio->PIO_ODSR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_Enable +//* \brief Enable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_Enable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio to be enabled +{ + pPio->PIO_PER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_Disable +//* \brief Disable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_Disable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio to be disabled +{ + pPio->PIO_PDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetStatus +//* \brief Return PIO Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetStatus( // \return PIO Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_PSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsSet +//* \brief Test if PIO is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_OutputEnable +//* \brief Output Enable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_OutputEnable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio output to be enabled +{ + pPio->PIO_OER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_OutputDisable +//* \brief Output Enable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_OutputDisable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio output to be disabled +{ + pPio->PIO_ODR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetOutputStatus +//* \brief Return PIO Output Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetOutputStatus( // \return PIO Output Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_OSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsOuputSet +//* \brief Test if PIO Output is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsOutputSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetOutputStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_InputFilterEnable +//* \brief Input Filter Enable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_InputFilterEnable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio input filter to be enabled +{ + pPio->PIO_IFER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_InputFilterDisable +//* \brief Input Filter Disable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_InputFilterDisable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio input filter to be disabled +{ + pPio->PIO_IFDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetInputFilterStatus +//* \brief Return PIO Input Filter Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetInputFilterStatus( // \return PIO Input Filter Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_IFSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsInputFilterSet +//* \brief Test if PIO Input filter is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsInputFilterSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetInputFilterStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetOutputDataStatus +//* \brief Return PIO Output Data Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetOutputDataStatus( // \return PIO Output Data Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_ODSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_InterruptEnable +//* \brief Enable PIO Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_InterruptEnable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio interrupt to be enabled +{ + pPio->PIO_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_InterruptDisable +//* \brief Disable PIO Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_InterruptDisable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio interrupt to be disabled +{ + pPio->PIO_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetInterruptMaskStatus +//* \brief Return PIO Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetInterruptMaskStatus( // \return PIO Interrupt Mask Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetInterruptStatus +//* \brief Return PIO Interrupt Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetInterruptStatus( // \return PIO Interrupt Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_ISR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsInterruptMasked +//* \brief Test if PIO Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsInterruptMasked( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetInterruptMaskStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsInterruptSet +//* \brief Test if PIO Interrupt is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsInterruptSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetInterruptStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_MultiDriverEnable +//* \brief Multi Driver Enable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_MultiDriverEnable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio to be enabled +{ + pPio->PIO_MDER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_MultiDriverDisable +//* \brief Multi Driver Disable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_MultiDriverDisable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio to be disabled +{ + pPio->PIO_MDDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetMultiDriverStatus +//* \brief Return PIO Multi Driver Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetMultiDriverStatus( // \return PIO Multi Driver Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_MDSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsMultiDriverSet +//* \brief Test if PIO MultiDriver is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsMultiDriverSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetMultiDriverStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_A_RegisterSelection +//* \brief PIO A Register Selection +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_A_RegisterSelection( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio A register selection +{ + pPio->PIO_ASR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_B_RegisterSelection +//* \brief PIO B Register Selection +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_B_RegisterSelection( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio B register selection +{ + pPio->PIO_BSR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_Get_AB_RegisterStatus +//* \brief Return PIO Interrupt Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_Get_AB_RegisterStatus( // \return PIO AB Register Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_ABSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsAB_RegisterSet +//* \brief Test if PIO AB Register is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsAB_RegisterSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_Get_AB_RegisterStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_OutputWriteEnable +//* \brief Output Write Enable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_OutputWriteEnable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio output write to be enabled +{ + pPio->PIO_OWER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_OutputWriteDisable +//* \brief Output Write Disable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_OutputWriteDisable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio output write to be disabled +{ + pPio->PIO_OWDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetOutputWriteStatus +//* \brief Return PIO Output Write Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetOutputWriteStatus( // \return PIO Output Write Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_OWSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsOutputWriteSet +//* \brief Test if PIO OutputWrite is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsOutputWriteSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetOutputWriteStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetCfgPullup +//* \brief Return PIO Configuration Pullup +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetCfgPullup( // \return PIO Configuration Pullup + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_PPUSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsOutputDataStatusSet +//* \brief Test if PIO Output Data Status is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsOutputDataStatusSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetOutputDataStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsCfgPullupStatusSet +//* \brief Test if PIO Configuration Pullup Status is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsCfgPullupStatusSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (~AT91F_PIO_GetCfgPullup(pPio) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR PMC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_CfgSysClkEnableReg +//* \brief Configure the System Clock Enable Register of the PMC controller +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_CfgSysClkEnableReg ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int mode) +{ + //* Write to the SCER register + pPMC->PMC_SCER = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_CfgSysClkDisableReg +//* \brief Configure the System Clock Disable Register of the PMC controller +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_CfgSysClkDisableReg ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int mode) +{ + //* Write to the SCDR register + pPMC->PMC_SCDR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_GetSysClkStatusReg +//* \brief Return the System Clock Status Register of the PMC controller +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_GetSysClkStatusReg ( + AT91PS_PMC pPMC // pointer to a CAN controller + ) +{ + return pPMC->PMC_SCSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_EnablePeriphClock +//* \brief Enable peripheral clock +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_EnablePeriphClock ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int periphIds) // \arg IDs of peripherals +{ + pPMC->PMC_PCER = periphIds; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_DisablePeriphClock +//* \brief Disable peripheral clock +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_DisablePeriphClock ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int periphIds) // \arg IDs of peripherals +{ + pPMC->PMC_PCDR = periphIds; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_GetPeriphClock +//* \brief Get peripheral clock status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_GetPeriphClock ( + AT91PS_PMC pPMC) // \arg pointer to PMC controller +{ + return pPMC->PMC_PCSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_CfgMainOscillatorReg +//* \brief Cfg the main oscillator +//*---------------------------------------------------------------------------- +__inline void AT91F_CKGR_CfgMainOscillatorReg ( + AT91PS_CKGR pCKGR, // \arg pointer to CKGR controller + unsigned int mode) +{ + pCKGR->CKGR_MOR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_GetMainOscillatorReg +//* \brief Cfg the main oscillator +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CKGR_GetMainOscillatorReg ( + AT91PS_CKGR pCKGR) // \arg pointer to CKGR controller +{ + return pCKGR->CKGR_MOR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_EnableMainOscillator +//* \brief Enable the main oscillator +//*---------------------------------------------------------------------------- +__inline void AT91F_CKGR_EnableMainOscillator( + AT91PS_CKGR pCKGR) // \arg pointer to CKGR controller +{ + pCKGR->CKGR_MOR |= AT91C_CKGR_MOSCEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_DisableMainOscillator +//* \brief Disable the main oscillator +//*---------------------------------------------------------------------------- +__inline void AT91F_CKGR_DisableMainOscillator ( + AT91PS_CKGR pCKGR) // \arg pointer to CKGR controller +{ + pCKGR->CKGR_MOR &= ~AT91C_CKGR_MOSCEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_CfgMainOscStartUpTime +//* \brief Cfg MOR Register according to the main osc startup time +//*---------------------------------------------------------------------------- +__inline void AT91F_CKGR_CfgMainOscStartUpTime ( + AT91PS_CKGR pCKGR, // \arg pointer to CKGR controller + unsigned int startup_time, // \arg main osc startup time in microsecond (us) + unsigned int slowClock) // \arg slowClock in Hz +{ + pCKGR->CKGR_MOR &= ~AT91C_CKGR_OSCOUNT; + pCKGR->CKGR_MOR |= ((slowClock * startup_time)/(8*1000000)) << 8; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_GetMainClockFreqReg +//* \brief Cfg the main oscillator +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CKGR_GetMainClockFreqReg ( + AT91PS_CKGR pCKGR) // \arg pointer to CKGR controller +{ + return pCKGR->CKGR_MCFR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_GetMainClock +//* \brief Return Main clock in Hz +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CKGR_GetMainClock ( + AT91PS_CKGR pCKGR, // \arg pointer to CKGR controller + unsigned int slowClock) // \arg slowClock in Hz +{ + return ((pCKGR->CKGR_MCFR & AT91C_CKGR_MAINF) * slowClock) >> 4; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_CfgMCKReg +//* \brief Cfg Master Clock Register +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_CfgMCKReg ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int mode) +{ + pPMC->PMC_MCKR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_GetMCKReg +//* \brief Return Master Clock Register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_GetMCKReg( + AT91PS_PMC pPMC) // \arg pointer to PMC controller +{ + return pPMC->PMC_MCKR; +} + +//*------------------------------------------------------------------------------ +//* \fn AT91F_PMC_GetMasterClock +//* \brief Return master clock in Hz which correponds to processor clock for ARM7 +//*------------------------------------------------------------------------------ +__inline unsigned int AT91F_PMC_GetMasterClock ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + AT91PS_CKGR pCKGR, // \arg pointer to CKGR controller + unsigned int slowClock) // \arg slowClock in Hz +{ + unsigned int reg = pPMC->PMC_MCKR; + unsigned int prescaler = (1 << ((reg & AT91C_PMC_PRES) >> 2)); + unsigned int pllDivider, pllMultiplier; + + switch (reg & AT91C_PMC_CSS) { + case AT91C_PMC_CSS_SLOW_CLK: // Slow clock selected + return slowClock / prescaler; + case AT91C_PMC_CSS_MAIN_CLK: // Main clock is selected + return AT91F_CKGR_GetMainClock(pCKGR, slowClock) / prescaler; + case AT91C_PMC_CSS_PLL_CLK: // PLLB clock is selected + reg = pCKGR->CKGR_PLLR; + pllDivider = (reg & AT91C_CKGR_DIV); + pllMultiplier = ((reg & AT91C_CKGR_MUL) >> 16) + 1; + return AT91F_CKGR_GetMainClock(pCKGR, slowClock) / pllDivider * pllMultiplier / prescaler; + } + return 0; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_EnablePCK +//* \brief Enable Programmable Clock x Output +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_EnablePCK ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int pck, // \arg Programmable Clock x Output + unsigned int mode) +{ + pPMC->PMC_PCKR[pck] = mode; + pPMC->PMC_SCER = (1 << pck) << 8; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_DisablePCK +//* \brief Disable Programmable Clock x Output +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_DisablePCK ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int pck) // \arg Programmable Clock x Output +{ + pPMC->PMC_SCDR = (1 << pck) << 8; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_EnableIt +//* \brief Enable PMC interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_EnableIt ( + AT91PS_PMC pPMC, // pointer to a PMC controller + unsigned int flag) // IT to be enabled +{ + //* Write to the IER register + pPMC->PMC_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_DisableIt +//* \brief Disable PMC interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_DisableIt ( + AT91PS_PMC pPMC, // pointer to a PMC controller + unsigned int flag) // IT to be disabled +{ + //* Write to the IDR register + pPMC->PMC_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_GetStatus +//* \brief Return PMC Interrupt Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_GetStatus( // \return PMC Interrupt Status + AT91PS_PMC pPMC) // pointer to a PMC controller +{ + return pPMC->PMC_SR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_GetInterruptMaskStatus +//* \brief Return PMC Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_GetInterruptMaskStatus( // \return PMC Interrupt Mask Status + AT91PS_PMC pPMC) // pointer to a PMC controller +{ + return pPMC->PMC_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_IsInterruptMasked +//* \brief Test if PMC Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_IsInterruptMasked( + AT91PS_PMC pPMC, // \arg pointer to a PMC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PMC_GetInterruptMaskStatus(pPMC) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_IsStatusSet +//* \brief Test if PMC Status is Set +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_IsStatusSet( + AT91PS_PMC pPMC, // \arg pointer to a PMC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PMC_GetStatus(pPMC) & flag); +} + +// ---------------------------------------------------------------------------- +// \fn AT91F_CKGR_CfgPLLReg +// \brief Cfg the PLL Register +// ---------------------------------------------------------------------------- +__inline void AT91F_CKGR_CfgPLLReg ( + AT91PS_CKGR pCKGR, // \arg pointer to CKGR controller + unsigned int mode) +{ + pCKGR->CKGR_PLLR = mode; +} + +// ---------------------------------------------------------------------------- +// \fn AT91F_CKGR_GetPLLReg +// \brief Get the PLL Register +// ---------------------------------------------------------------------------- +__inline unsigned int AT91F_CKGR_GetPLLReg ( + AT91PS_CKGR pCKGR) // \arg pointer to CKGR controller +{ + return pCKGR->CKGR_PLLR; +} + + +/* ***************************************************************************** + SOFTWARE API FOR RSTC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_RSTSoftReset +//* \brief Start Software Reset +//*---------------------------------------------------------------------------- +__inline void AT91F_RSTSoftReset( + AT91PS_RSTC pRSTC, + unsigned int reset) +{ + pRSTC->RSTC_RCR = (0xA5000000 | reset); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_RSTSetMode +//* \brief Set Reset Mode +//*---------------------------------------------------------------------------- +__inline void AT91F_RSTSetMode( + AT91PS_RSTC pRSTC, + unsigned int mode) +{ + pRSTC->RSTC_RMR = (0xA5000000 | mode); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_RSTGetMode +//* \brief Get Reset Mode +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_RSTGetMode( + AT91PS_RSTC pRSTC) +{ + return (pRSTC->RSTC_RMR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_RSTGetStatus +//* \brief Get Reset Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_RSTGetStatus( + AT91PS_RSTC pRSTC) +{ + return (pRSTC->RSTC_RSR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_RSTIsSoftRstActive +//* \brief Return !=0 if software reset is still not completed +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_RSTIsSoftRstActive( + AT91PS_RSTC pRSTC) +{ + return ((pRSTC->RSTC_RSR) & AT91C_RSTC_SRCMP); +} +/* ***************************************************************************** + SOFTWARE API FOR RTTC + ***************************************************************************** */ +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_SetRTT_TimeBase() +//* \brief Set the RTT prescaler according to the TimeBase in ms +//*-------------------------------------------------------------------------------------- +__inline unsigned int AT91F_RTTSetTimeBase( + AT91PS_RTTC pRTTC, + unsigned int ms) +{ + if (ms > 2000) + return 1; // AT91C_TIME_OUT_OF_RANGE + pRTTC->RTTC_RTMR &= ~0xFFFF; + pRTTC->RTTC_RTMR |= (((ms << 15) /1000) & 0xFFFF); + return 0; +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTTSetPrescaler() +//* \brief Set the new prescaler value +//*-------------------------------------------------------------------------------------- +__inline unsigned int AT91F_RTTSetPrescaler( + AT91PS_RTTC pRTTC, + unsigned int rtpres) +{ + pRTTC->RTTC_RTMR &= ~0xFFFF; + pRTTC->RTTC_RTMR |= (rtpres & 0xFFFF); + return (pRTTC->RTTC_RTMR); +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTTRestart() +//* \brief Restart the RTT prescaler +//*-------------------------------------------------------------------------------------- +__inline void AT91F_RTTRestart( + AT91PS_RTTC pRTTC) +{ + pRTTC->RTTC_RTMR |= AT91C_RTTC_RTTRST; +} + + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_SetAlarmINT() +//* \brief Enable RTT Alarm Interrupt +//*-------------------------------------------------------------------------------------- +__inline void AT91F_RTTSetAlarmINT( + AT91PS_RTTC pRTTC) +{ + pRTTC->RTTC_RTMR |= AT91C_RTTC_ALMIEN; +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_ClearAlarmINT() +//* \brief Disable RTT Alarm Interrupt +//*-------------------------------------------------------------------------------------- +__inline void AT91F_RTTClearAlarmINT( + AT91PS_RTTC pRTTC) +{ + pRTTC->RTTC_RTMR &= ~AT91C_RTTC_ALMIEN; +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_SetRttIncINT() +//* \brief Enable RTT INC Interrupt +//*-------------------------------------------------------------------------------------- +__inline void AT91F_RTTSetRttIncINT( + AT91PS_RTTC pRTTC) +{ + pRTTC->RTTC_RTMR |= AT91C_RTTC_RTTINCIEN; +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_ClearRttIncINT() +//* \brief Disable RTT INC Interrupt +//*-------------------------------------------------------------------------------------- +__inline void AT91F_RTTClearRttIncINT( + AT91PS_RTTC pRTTC) +{ + pRTTC->RTTC_RTMR &= ~AT91C_RTTC_RTTINCIEN; +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_SetAlarmValue() +//* \brief Set RTT Alarm Value +//*-------------------------------------------------------------------------------------- +__inline void AT91F_RTTSetAlarmValue( + AT91PS_RTTC pRTTC, unsigned int alarm) +{ + pRTTC->RTTC_RTAR = alarm; +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_GetAlarmValue() +//* \brief Get RTT Alarm Value +//*-------------------------------------------------------------------------------------- +__inline unsigned int AT91F_RTTGetAlarmValue( + AT91PS_RTTC pRTTC) +{ + return(pRTTC->RTTC_RTAR); +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTTGetStatus() +//* \brief Read the RTT status +//*-------------------------------------------------------------------------------------- +__inline unsigned int AT91F_RTTGetStatus( + AT91PS_RTTC pRTTC) +{ + return(pRTTC->RTTC_RTSR); +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_ReadValue() +//* \brief Read the RTT value +//*-------------------------------------------------------------------------------------- +__inline unsigned int AT91F_RTTReadValue( + AT91PS_RTTC pRTTC) +{ + register volatile unsigned int val1,val2; + do + { + val1 = pRTTC->RTTC_RTVR; + val2 = pRTTC->RTTC_RTVR; + } + while(val1 != val2); + return(val1); +} +/* ***************************************************************************** + SOFTWARE API FOR PITC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITInit +//* \brief System timer init : period in µsecond, system clock freq in MHz +//*---------------------------------------------------------------------------- +__inline void AT91F_PITInit( + AT91PS_PITC pPITC, + unsigned int period, + unsigned int pit_frequency) +{ + pPITC->PITC_PIMR = period? (period * pit_frequency + 8) >> 4 : 0; // +8 to avoid %10 and /10 + pPITC->PITC_PIMR |= AT91C_PITC_PITEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITSetPIV +//* \brief Set the PIT Periodic Interval Value +//*---------------------------------------------------------------------------- +__inline void AT91F_PITSetPIV( + AT91PS_PITC pPITC, + unsigned int piv) +{ + pPITC->PITC_PIMR = piv | (pPITC->PITC_PIMR & (AT91C_PITC_PITEN | AT91C_PITC_PITIEN)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITEnableInt +//* \brief Enable PIT periodic interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PITEnableInt( + AT91PS_PITC pPITC) +{ + pPITC->PITC_PIMR |= AT91C_PITC_PITIEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITDisableInt +//* \brief Disable PIT periodic interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PITDisableInt( + AT91PS_PITC pPITC) +{ + pPITC->PITC_PIMR &= ~AT91C_PITC_PITIEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITGetMode +//* \brief Read PIT mode register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PITGetMode( + AT91PS_PITC pPITC) +{ + return(pPITC->PITC_PIMR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITGetStatus +//* \brief Read PIT status register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PITGetStatus( + AT91PS_PITC pPITC) +{ + return(pPITC->PITC_PISR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITGetPIIR +//* \brief Read PIT CPIV and PICNT without ressetting the counters +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PITGetPIIR( + AT91PS_PITC pPITC) +{ + return(pPITC->PITC_PIIR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITGetPIVR +//* \brief Read System timer CPIV and PICNT without ressetting the counters +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PITGetPIVR( + AT91PS_PITC pPITC) +{ + return(pPITC->PITC_PIVR); +} +/* ***************************************************************************** + SOFTWARE API FOR WDTC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_WDTSetMode +//* \brief Set Watchdog Mode Register +//*---------------------------------------------------------------------------- +__inline void AT91F_WDTSetMode( + AT91PS_WDTC pWDTC, + unsigned int Mode) +{ + pWDTC->WDTC_WDMR = Mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_WDTRestart +//* \brief Restart Watchdog +//*---------------------------------------------------------------------------- +__inline void AT91F_WDTRestart( + AT91PS_WDTC pWDTC) +{ + pWDTC->WDTC_WDCR = 0xA5000001; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_WDTSGettatus +//* \brief Get Watchdog Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_WDTSGettatus( + AT91PS_WDTC pWDTC) +{ + return(pWDTC->WDTC_WDSR & 0x3); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_WDTGetPeriod +//* \brief Translate ms into Watchdog Compatible value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_WDTGetPeriod(unsigned int ms) +{ + if ((ms < 4) || (ms > 16000)) + return 0; + return((ms << 8) / 1000); +} +/* ***************************************************************************** + SOFTWARE API FOR VREG + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_VREG_Enable_LowPowerMode +//* \brief Enable VREG Low Power Mode +//*---------------------------------------------------------------------------- +__inline void AT91F_VREG_Enable_LowPowerMode( + AT91PS_VREG pVREG) +{ + pVREG->VREG_MR |= AT91C_VREG_PSTDBY; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_VREG_Disable_LowPowerMode +//* \brief Disable VREG Low Power Mode +//*---------------------------------------------------------------------------- +__inline void AT91F_VREG_Disable_LowPowerMode( + AT91PS_VREG pVREG) +{ + pVREG->VREG_MR &= ~AT91C_VREG_PSTDBY; +}/* ***************************************************************************** + SOFTWARE API FOR MC + ***************************************************************************** */ + +#define AT91C_MC_CORRECT_KEY ((unsigned int) 0x5A << 24) // (MC) Correct Protect Key + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_Remap +//* \brief Make Remap +//*---------------------------------------------------------------------------- +__inline void AT91F_MC_Remap (void) // +{ + AT91PS_MC pMC = (AT91PS_MC) AT91C_BASE_MC; + + pMC->MC_RCR = AT91C_MC_RCB; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_CfgModeReg +//* \brief Configure the EFC Mode Register of the MC controller +//*---------------------------------------------------------------------------- +__inline void AT91F_MC_EFC_CfgModeReg ( + AT91PS_MC pMC, // pointer to a MC controller + unsigned int mode) // mode register +{ + // Write to the FMR register + pMC->MC_FMR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_GetModeReg +//* \brief Return MC EFC Mode Regsiter +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_MC_EFC_GetModeReg( + AT91PS_MC pMC) // pointer to a MC controller +{ + return pMC->MC_FMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_ComputeFMCN +//* \brief Return MC EFC Mode Regsiter +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_MC_EFC_ComputeFMCN( + int master_clock) // master clock in Hz +{ + return (master_clock/1000000 +2); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_PerformCmd +//* \brief Perform EFC Command +//*---------------------------------------------------------------------------- +__inline void AT91F_MC_EFC_PerformCmd ( + AT91PS_MC pMC, // pointer to a MC controller + unsigned int transfer_cmd) +{ + pMC->MC_FCR = transfer_cmd; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_GetStatus +//* \brief Return MC EFC Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_MC_EFC_GetStatus( + AT91PS_MC pMC) // pointer to a MC controller +{ + return pMC->MC_FSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_IsInterruptMasked +//* \brief Test if EFC MC Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_MC_EFC_IsInterruptMasked( + AT91PS_MC pMC, // \arg pointer to a MC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_MC_EFC_GetModeReg(pMC) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_IsInterruptSet +//* \brief Test if EFC MC Interrupt is Set +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_MC_EFC_IsInterruptSet( + AT91PS_MC pMC, // \arg pointer to a MC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_MC_EFC_GetStatus(pMC) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR SPI + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_CfgCs +//* \brief Configure SPI chip select register +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_CfgCs ( + AT91PS_SPI pSPI, // pointer to a SPI controller + int cs, // SPI cs number (0 to 3) + int val) // chip select register +{ + //* Write to the CSR register + *(pSPI->SPI_CSR + cs) = val; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_EnableIt +//* \brief Enable SPI interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_EnableIt ( + AT91PS_SPI pSPI, // pointer to a SPI controller + unsigned int flag) // IT to be enabled +{ + //* Write to the IER register + pSPI->SPI_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_DisableIt +//* \brief Disable SPI interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_DisableIt ( + AT91PS_SPI pSPI, // pointer to a SPI controller + unsigned int flag) // IT to be disabled +{ + //* Write to the IDR register + pSPI->SPI_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_Reset +//* \brief Reset the SPI controller +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_Reset ( + AT91PS_SPI pSPI // pointer to a SPI controller + ) +{ + //* Write to the CR register + pSPI->SPI_CR = AT91C_SPI_SWRST; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_Enable +//* \brief Enable the SPI controller +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_Enable ( + AT91PS_SPI pSPI // pointer to a SPI controller + ) +{ + //* Write to the CR register + pSPI->SPI_CR = AT91C_SPI_SPIEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_Disable +//* \brief Disable the SPI controller +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_Disable ( + AT91PS_SPI pSPI // pointer to a SPI controller + ) +{ + //* Write to the CR register + pSPI->SPI_CR = AT91C_SPI_SPIDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_CfgMode +//* \brief Enable the SPI controller +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_CfgMode ( + AT91PS_SPI pSPI, // pointer to a SPI controller + int mode) // mode register +{ + //* Write to the MR register + pSPI->SPI_MR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_CfgPCS +//* \brief Switch to the correct PCS of SPI Mode Register : Fixed Peripheral Selected +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_CfgPCS ( + AT91PS_SPI pSPI, // pointer to a SPI controller + char PCS_Device) // PCS of the Device +{ + //* Write to the MR register + pSPI->SPI_MR &= 0xFFF0FFFF; + pSPI->SPI_MR |= ( (PCS_Device<<16) & AT91C_SPI_PCS ); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_ReceiveFrame +//* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initializaed with Next Buffer, 0 if PDC is busy +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_SPI_ReceiveFrame ( + AT91PS_SPI pSPI, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + return AT91F_PDC_ReceiveFrame( + (AT91PS_PDC) &(pSPI->SPI_RPR), + pBuffer, + szBuffer, + pNextBuffer, + szNextBuffer); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_SendFrame +//* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initializaed with Next Buffer, 0 if PDC is bSPIy +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_SPI_SendFrame( + AT91PS_SPI pSPI, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + return AT91F_PDC_SendFrame( + (AT91PS_PDC) &(pSPI->SPI_RPR), + pBuffer, + szBuffer, + pNextBuffer, + szNextBuffer); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_Close +//* \brief Close SPI: disable IT disable transfert, close PDC +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_Close ( + AT91PS_SPI pSPI) // \arg pointer to a SPI controller +{ + //* Reset all the Chip Select register + pSPI->SPI_CSR[0] = 0 ; + pSPI->SPI_CSR[1] = 0 ; + pSPI->SPI_CSR[2] = 0 ; + pSPI->SPI_CSR[3] = 0 ; + + //* Reset the SPI mode + pSPI->SPI_MR = 0 ; + + //* Disable all interrupts + pSPI->SPI_IDR = 0xFFFFFFFF ; + + //* Abort the Peripheral Data Transfers + AT91F_PDC_Close((AT91PS_PDC) &(pSPI->SPI_RPR)); + + //* Disable receiver and transmitter and stop any activity immediately + pSPI->SPI_CR = AT91C_SPI_SPIDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_PutChar +//* \brief Send a character,does not check if ready to send +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_PutChar ( + AT91PS_SPI pSPI, + unsigned int character, + unsigned int cs_number ) +{ + unsigned int value_for_cs; + value_for_cs = (~(1 << cs_number)) & 0xF; //Place a zero among a 4 ONEs number + pSPI->SPI_TDR = (character & 0xFFFF) | (value_for_cs << 16); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_GetChar +//* \brief Receive a character,does not check if a character is available +//*---------------------------------------------------------------------------- +__inline int AT91F_SPI_GetChar ( + const AT91PS_SPI pSPI) +{ + return((pSPI->SPI_RDR) & 0xFFFF); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_GetInterruptMaskStatus +//* \brief Return SPI Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_SPI_GetInterruptMaskStatus( // \return SPI Interrupt Mask Status + AT91PS_SPI pSpi) // \arg pointer to a SPI controller +{ + return pSpi->SPI_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_IsInterruptMasked +//* \brief Test if SPI Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_SPI_IsInterruptMasked( + AT91PS_SPI pSpi, // \arg pointer to a SPI controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_SPI_GetInterruptMaskStatus(pSpi) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR USART + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_Baudrate +//* \brief Calculate the baudrate +//* Standard Asynchronous Mode : 8 bits , 1 stop , no parity +#define AT91C_US_ASYNC_MODE ( AT91C_US_USMODE_NORMAL + \ + AT91C_US_NBSTOP_1_BIT + \ + AT91C_US_PAR_NONE + \ + AT91C_US_CHRL_8_BITS + \ + AT91C_US_CLKS_CLOCK ) + +//* Standard External Asynchronous Mode : 8 bits , 1 stop , no parity +#define AT91C_US_ASYNC_SCK_MODE ( AT91C_US_USMODE_NORMAL + \ + AT91C_US_NBSTOP_1_BIT + \ + AT91C_US_PAR_NONE + \ + AT91C_US_CHRL_8_BITS + \ + AT91C_US_CLKS_EXT ) + +//* Standard Synchronous Mode : 8 bits , 1 stop , no parity +#define AT91C_US_SYNC_MODE ( AT91C_US_SYNC + \ + AT91C_US_USMODE_NORMAL + \ + AT91C_US_NBSTOP_1_BIT + \ + AT91C_US_PAR_NONE + \ + AT91C_US_CHRL_8_BITS + \ + AT91C_US_CLKS_CLOCK ) + +//* SCK used Label +#define AT91C_US_SCK_USED (AT91C_US_CKLO | AT91C_US_CLKS_EXT) + +//* Standard ISO T=0 Mode : 8 bits , 1 stop , parity +#define AT91C_US_ISO_READER_MODE ( AT91C_US_USMODE_ISO7816_0 + \ + AT91C_US_CLKS_CLOCK +\ + AT91C_US_NBSTOP_1_BIT + \ + AT91C_US_PAR_EVEN + \ + AT91C_US_CHRL_8_BITS + \ + AT91C_US_CKLO +\ + AT91C_US_OVER) + +//* Standard IRDA mode +#define AT91C_US_ASYNC_IRDA_MODE ( AT91C_US_USMODE_IRDA + \ + AT91C_US_NBSTOP_1_BIT + \ + AT91C_US_PAR_NONE + \ + AT91C_US_CHRL_8_BITS + \ + AT91C_US_CLKS_CLOCK ) + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_Baudrate +//* \brief Caluculate baud_value according to the main clock and the baud rate +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_US_Baudrate ( + const unsigned int main_clock, // \arg peripheral clock + const unsigned int baud_rate) // \arg UART baudrate +{ + unsigned int baud_value = ((main_clock*10)/(baud_rate * 16)); + if ((baud_value % 10) >= 5) + baud_value = (baud_value / 10) + 1; + else + baud_value /= 10; + return baud_value; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_SetBaudrate +//* \brief Set the baudrate according to the CPU clock +//*---------------------------------------------------------------------------- +__inline void AT91F_US_SetBaudrate ( + AT91PS_USART pUSART, // \arg pointer to a USART controller + unsigned int mainClock, // \arg peripheral clock + unsigned int speed) // \arg UART baudrate +{ + //* Define the baud rate divisor register + pUSART->US_BRGR = AT91F_US_Baudrate(mainClock, speed); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_SetTimeguard +//* \brief Set USART timeguard +//*---------------------------------------------------------------------------- +__inline void AT91F_US_SetTimeguard ( + AT91PS_USART pUSART, // \arg pointer to a USART controller + unsigned int timeguard) // \arg timeguard value +{ + //* Write the Timeguard Register + pUSART->US_TTGR = timeguard ; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_EnableIt +//* \brief Enable USART IT +//*---------------------------------------------------------------------------- +__inline void AT91F_US_EnableIt ( + AT91PS_USART pUSART, // \arg pointer to a USART controller + unsigned int flag) // \arg IT to be enabled +{ + //* Write to the IER register + pUSART->US_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_DisableIt +//* \brief Disable USART IT +//*---------------------------------------------------------------------------- +__inline void AT91F_US_DisableIt ( + AT91PS_USART pUSART, // \arg pointer to a USART controller + unsigned int flag) // \arg IT to be disabled +{ + //* Write to the IER register + pUSART->US_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_Configure +//* \brief Configure USART +//*---------------------------------------------------------------------------- +__inline void AT91F_US_Configure ( + AT91PS_USART pUSART, // \arg pointer to a USART controller + unsigned int mainClock, // \arg peripheral clock + unsigned int mode , // \arg mode Register to be programmed + unsigned int baudRate , // \arg baudrate to be programmed + unsigned int timeguard ) // \arg timeguard to be programmed +{ + //* Disable interrupts + pUSART->US_IDR = (unsigned int) -1; + + //* Reset receiver and transmitter + pUSART->US_CR = AT91C_US_RSTRX | AT91C_US_RSTTX | AT91C_US_RXDIS | AT91C_US_TXDIS ; + + //* Define the baud rate divisor register + AT91F_US_SetBaudrate(pUSART, mainClock, baudRate); + + //* Write the Timeguard Register + AT91F_US_SetTimeguard(pUSART, timeguard); + + //* Clear Transmit and Receive Counters + AT91F_PDC_Open((AT91PS_PDC) &(pUSART->US_RPR)); + + //* Define the USART mode + pUSART->US_MR = mode ; + +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_EnableRx +//* \brief Enable receiving characters +//*---------------------------------------------------------------------------- +__inline void AT91F_US_EnableRx ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Enable receiver + pUSART->US_CR = AT91C_US_RXEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_EnableTx +//* \brief Enable sending characters +//*---------------------------------------------------------------------------- +__inline void AT91F_US_EnableTx ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Enable transmitter + pUSART->US_CR = AT91C_US_TXEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_ResetRx +//* \brief Reset Receiver and re-enable it +//*---------------------------------------------------------------------------- +__inline void AT91F_US_ResetRx ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Reset receiver + pUSART->US_CR = AT91C_US_RSTRX; + //* Re-Enable receiver + pUSART->US_CR = AT91C_US_RXEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_ResetTx +//* \brief Reset Transmitter and re-enable it +//*---------------------------------------------------------------------------- +__inline void AT91F_US_ResetTx ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Reset transmitter + pUSART->US_CR = AT91C_US_RSTTX; + //* Enable transmitter + pUSART->US_CR = AT91C_US_TXEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_DisableRx +//* \brief Disable Receiver +//*---------------------------------------------------------------------------- +__inline void AT91F_US_DisableRx ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Disable receiver + pUSART->US_CR = AT91C_US_RXDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_DisableTx +//* \brief Disable Transmitter +//*---------------------------------------------------------------------------- +__inline void AT91F_US_DisableTx ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Disable transmitter + pUSART->US_CR = AT91C_US_TXDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_Close +//* \brief Close USART: disable IT disable receiver and transmitter, close PDC +//*---------------------------------------------------------------------------- +__inline void AT91F_US_Close ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Reset the baud rate divisor register + pUSART->US_BRGR = 0 ; + + //* Reset the USART mode + pUSART->US_MR = 0 ; + + //* Reset the Timeguard Register + pUSART->US_TTGR = 0; + + //* Disable all interrupts + pUSART->US_IDR = 0xFFFFFFFF ; + + //* Abort the Peripheral Data Transfers + AT91F_PDC_Close((AT91PS_PDC) &(pUSART->US_RPR)); + + //* Disable receiver and transmitter and stop any activity immediately + pUSART->US_CR = AT91C_US_TXDIS | AT91C_US_RXDIS | AT91C_US_RSTTX | AT91C_US_RSTRX ; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_TxReady +//* \brief Return 1 if a character can be written in US_THR +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_US_TxReady ( + AT91PS_USART pUSART ) // \arg pointer to a USART controller +{ + return (pUSART->US_CSR & AT91C_US_TXRDY); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_RxReady +//* \brief Return 1 if a character can be read in US_RHR +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_US_RxReady ( + AT91PS_USART pUSART ) // \arg pointer to a USART controller +{ + return (pUSART->US_CSR & AT91C_US_RXRDY); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_Error +//* \brief Return the error flag +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_US_Error ( + AT91PS_USART pUSART ) // \arg pointer to a USART controller +{ + return (pUSART->US_CSR & + (AT91C_US_OVRE | // Overrun error + AT91C_US_FRAME | // Framing error + AT91C_US_PARE)); // Parity error +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_PutChar +//* \brief Send a character,does not check if ready to send +//*---------------------------------------------------------------------------- +__inline void AT91F_US_PutChar ( + AT91PS_USART pUSART, + int character ) +{ + pUSART->US_THR = (character & 0x1FF); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_GetChar +//* \brief Receive a character,does not check if a character is available +//*---------------------------------------------------------------------------- +__inline int AT91F_US_GetChar ( + const AT91PS_USART pUSART) +{ + return((pUSART->US_RHR) & 0x1FF); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_SendFrame +//* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initializaed with Next Buffer, 0 if PDC is busy +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_US_SendFrame( + AT91PS_USART pUSART, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + return AT91F_PDC_SendFrame( + (AT91PS_PDC) &(pUSART->US_RPR), + pBuffer, + szBuffer, + pNextBuffer, + szNextBuffer); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_ReceiveFrame +//* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initializaed with Next Buffer, 0 if PDC is busy +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_US_ReceiveFrame ( + AT91PS_USART pUSART, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + return AT91F_PDC_ReceiveFrame( + (AT91PS_PDC) &(pUSART->US_RPR), + pBuffer, + szBuffer, + pNextBuffer, + szNextBuffer); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_SetIrdaFilter +//* \brief Set the value of IrDa filter tregister +//*---------------------------------------------------------------------------- +__inline void AT91F_US_SetIrdaFilter ( + AT91PS_USART pUSART, + unsigned char value +) +{ + pUSART->US_IF = value; +} + +/* ***************************************************************************** + SOFTWARE API FOR SSC + ***************************************************************************** */ +//* Define the standard I2S mode configuration + +//* Configuration to set in the SSC Transmit Clock Mode Register +//* Parameters : nb_bit_by_slot : 8, 16 or 32 bits +//* nb_slot_by_frame : number of channels +#define AT91C_I2S_ASY_MASTER_TX_SETTING(nb_bit_by_slot, nb_slot_by_frame)( +\ + AT91C_SSC_CKS_DIV +\ + AT91C_SSC_CKO_CONTINOUS +\ + AT91C_SSC_CKG_NONE +\ + AT91C_SSC_START_FALL_RF +\ + AT91C_SSC_STTOUT +\ + ((1<<16) & AT91C_SSC_STTDLY) +\ + ((((nb_bit_by_slot*nb_slot_by_frame)/2)-1) <<24)) + + +//* Configuration to set in the SSC Transmit Frame Mode Register +//* Parameters : nb_bit_by_slot : 8, 16 or 32 bits +//* nb_slot_by_frame : number of channels +#define AT91C_I2S_ASY_TX_FRAME_SETTING(nb_bit_by_slot, nb_slot_by_frame)( +\ + (nb_bit_by_slot-1) +\ + AT91C_SSC_MSBF +\ + (((nb_slot_by_frame-1)<<8) & AT91C_SSC_DATNB) +\ + (((nb_bit_by_slot-1)<<16) & AT91C_SSC_FSLEN) +\ + AT91C_SSC_FSOS_NEGATIVE) + + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_SetBaudrate +//* \brief Set the baudrate according to the CPU clock +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_SetBaudrate ( + AT91PS_SSC pSSC, // \arg pointer to a SSC controller + unsigned int mainClock, // \arg peripheral clock + unsigned int speed) // \arg SSC baudrate +{ + unsigned int baud_value; + //* Define the baud rate divisor register + if (speed == 0) + baud_value = 0; + else + { + baud_value = (unsigned int) (mainClock * 10)/(2*speed); + if ((baud_value % 10) >= 5) + baud_value = (baud_value / 10) + 1; + else + baud_value /= 10; + } + + pSSC->SSC_CMR = baud_value; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_Configure +//* \brief Configure SSC +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_Configure ( + AT91PS_SSC pSSC, // \arg pointer to a SSC controller + unsigned int syst_clock, // \arg System Clock Frequency + unsigned int baud_rate, // \arg Expected Baud Rate Frequency + unsigned int clock_rx, // \arg Receiver Clock Parameters + unsigned int mode_rx, // \arg mode Register to be programmed + unsigned int clock_tx, // \arg Transmitter Clock Parameters + unsigned int mode_tx) // \arg mode Register to be programmed +{ + //* Disable interrupts + pSSC->SSC_IDR = (unsigned int) -1; + + //* Reset receiver and transmitter + pSSC->SSC_CR = AT91C_SSC_SWRST | AT91C_SSC_RXDIS | AT91C_SSC_TXDIS ; + + //* Define the Clock Mode Register + AT91F_SSC_SetBaudrate(pSSC, syst_clock, baud_rate); + + //* Write the Receive Clock Mode Register + pSSC->SSC_RCMR = clock_rx; + + //* Write the Transmit Clock Mode Register + pSSC->SSC_TCMR = clock_tx; + + //* Write the Receive Frame Mode Register + pSSC->SSC_RFMR = mode_rx; + + //* Write the Transmit Frame Mode Register + pSSC->SSC_TFMR = mode_tx; + + //* Clear Transmit and Receive Counters + AT91F_PDC_Open((AT91PS_PDC) &(pSSC->SSC_RPR)); + + +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_EnableRx +//* \brief Enable receiving datas +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_EnableRx ( + AT91PS_SSC pSSC) // \arg pointer to a SSC controller +{ + //* Enable receiver + pSSC->SSC_CR = AT91C_SSC_RXEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_DisableRx +//* \brief Disable receiving datas +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_DisableRx ( + AT91PS_SSC pSSC) // \arg pointer to a SSC controller +{ + //* Disable receiver + pSSC->SSC_CR = AT91C_SSC_RXDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_EnableTx +//* \brief Enable sending datas +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_EnableTx ( + AT91PS_SSC pSSC) // \arg pointer to a SSC controller +{ + //* Enable transmitter + pSSC->SSC_CR = AT91C_SSC_TXEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_DisableTx +//* \brief Disable sending datas +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_DisableTx ( + AT91PS_SSC pSSC) // \arg pointer to a SSC controller +{ + //* Disable transmitter + pSSC->SSC_CR = AT91C_SSC_TXDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_EnableIt +//* \brief Enable SSC IT +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_EnableIt ( + AT91PS_SSC pSSC, // \arg pointer to a SSC controller + unsigned int flag) // \arg IT to be enabled +{ + //* Write to the IER register + pSSC->SSC_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_DisableIt +//* \brief Disable SSC IT +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_DisableIt ( + AT91PS_SSC pSSC, // \arg pointer to a SSC controller + unsigned int flag) // \arg IT to be disabled +{ + //* Write to the IDR register + pSSC->SSC_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_ReceiveFrame +//* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initialized with Next Buffer, 0 if PDC is busy +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_SSC_ReceiveFrame ( + AT91PS_SSC pSSC, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + return AT91F_PDC_ReceiveFrame( + (AT91PS_PDC) &(pSSC->SSC_RPR), + pBuffer, + szBuffer, + pNextBuffer, + szNextBuffer); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_SendFrame +//* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initialized with Next Buffer, 0 if PDC is busy +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_SSC_SendFrame( + AT91PS_SSC pSSC, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + return AT91F_PDC_SendFrame( + (AT91PS_PDC) &(pSSC->SSC_RPR), + pBuffer, + szBuffer, + pNextBuffer, + szNextBuffer); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_GetInterruptMaskStatus +//* \brief Return SSC Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_SSC_GetInterruptMaskStatus( // \return SSC Interrupt Mask Status + AT91PS_SSC pSsc) // \arg pointer to a SSC controller +{ + return pSsc->SSC_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_IsInterruptMasked +//* \brief Test if SSC Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_SSC_IsInterruptMasked( + AT91PS_SSC pSsc, // \arg pointer to a SSC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_SSC_GetInterruptMaskStatus(pSsc) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR TWI + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_EnableIt +//* \brief Enable TWI IT +//*---------------------------------------------------------------------------- +__inline void AT91F_TWI_EnableIt ( + AT91PS_TWI pTWI, // \arg pointer to a TWI controller + unsigned int flag) // \arg IT to be enabled +{ + //* Write to the IER register + pTWI->TWI_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_DisableIt +//* \brief Disable TWI IT +//*---------------------------------------------------------------------------- +__inline void AT91F_TWI_DisableIt ( + AT91PS_TWI pTWI, // \arg pointer to a TWI controller + unsigned int flag) // \arg IT to be disabled +{ + //* Write to the IDR register + pTWI->TWI_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_Configure +//* \brief Configure TWI in master mode +//*---------------------------------------------------------------------------- +__inline void AT91F_TWI_Configure ( AT91PS_TWI pTWI ) // \arg pointer to a TWI controller +{ + //* Disable interrupts + pTWI->TWI_IDR = (unsigned int) -1; + + //* Reset peripheral + pTWI->TWI_CR = AT91C_TWI_SWRST; + + //* Set Master mode + pTWI->TWI_CR = AT91C_TWI_MSEN; + +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_GetInterruptMaskStatus +//* \brief Return TWI Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_TWI_GetInterruptMaskStatus( // \return TWI Interrupt Mask Status + AT91PS_TWI pTwi) // \arg pointer to a TWI controller +{ + return pTwi->TWI_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_IsInterruptMasked +//* \brief Test if TWI Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_TWI_IsInterruptMasked( + AT91PS_TWI pTwi, // \arg pointer to a TWI controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_TWI_GetInterruptMaskStatus(pTwi) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR PWMC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_GetStatus +//* \brief Return PWM Interrupt Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PWMC_GetStatus( // \return PWM Interrupt Status + AT91PS_PWMC pPWM) // pointer to a PWM controller +{ + return pPWM->PWMC_SR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_InterruptEnable +//* \brief Enable PWM Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_InterruptEnable( + AT91PS_PWMC pPwm, // \arg pointer to a PWM controller + unsigned int flag) // \arg PWM interrupt to be enabled +{ + pPwm->PWMC_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_InterruptDisable +//* \brief Disable PWM Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_InterruptDisable( + AT91PS_PWMC pPwm, // \arg pointer to a PWM controller + unsigned int flag) // \arg PWM interrupt to be disabled +{ + pPwm->PWMC_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_GetInterruptMaskStatus +//* \brief Return PWM Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PWMC_GetInterruptMaskStatus( // \return PWM Interrupt Mask Status + AT91PS_PWMC pPwm) // \arg pointer to a PWM controller +{ + return pPwm->PWMC_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_IsInterruptMasked +//* \brief Test if PWM Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PWMC_IsInterruptMasked( + AT91PS_PWMC pPWM, // \arg pointer to a PWM controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PWMC_GetInterruptMaskStatus(pPWM) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_IsStatusSet +//* \brief Test if PWM Interrupt is Set +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PWMC_IsStatusSet( + AT91PS_PWMC pPWM, // \arg pointer to a PWM controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PWMC_GetStatus(pPWM) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_CfgChannel +//* \brief Test if PWM Interrupt is Set +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_CfgChannel( + AT91PS_PWMC pPWM, // \arg pointer to a PWM controller + unsigned int channelId, // \arg PWM channel ID + unsigned int mode, // \arg PWM mode + unsigned int period, // \arg PWM period + unsigned int duty) // \arg PWM duty cycle +{ + pPWM->PWMC_CH[channelId].PWMC_CMR = mode; + pPWM->PWMC_CH[channelId].PWMC_CDTYR = duty; + pPWM->PWMC_CH[channelId].PWMC_CPRDR = period; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_StartChannel +//* \brief Enable channel +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_StartChannel( + AT91PS_PWMC pPWM, // \arg pointer to a PWM controller + unsigned int flag) // \arg Channels IDs to be enabled +{ + pPWM->PWMC_ENA = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_StopChannel +//* \brief Disable channel +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_StopChannel( + AT91PS_PWMC pPWM, // \arg pointer to a PWM controller + unsigned int flag) // \arg Channels IDs to be enabled +{ + pPWM->PWMC_DIS = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_UpdateChannel +//* \brief Update Period or Duty Cycle +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_UpdateChannel( + AT91PS_PWMC pPWM, // \arg pointer to a PWM controller + unsigned int channelId, // \arg PWM channel ID + unsigned int update) // \arg Channels IDs to be enabled +{ + pPWM->PWMC_CH[channelId].PWMC_CUPDR = update; +} + +/* ***************************************************************************** + SOFTWARE API FOR UDP + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EnableIt +//* \brief Enable UDP IT +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EnableIt ( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned int flag) // \arg IT to be enabled +{ + //* Write to the IER register + pUDP->UDP_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_DisableIt +//* \brief Disable UDP IT +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_DisableIt ( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned int flag) // \arg IT to be disabled +{ + //* Write to the IDR register + pUDP->UDP_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_SetAddress +//* \brief Set UDP functional address +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_SetAddress ( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char address) // \arg new UDP address +{ + pUDP->UDP_FADDR = (AT91C_UDP_FEN | address); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EnableEp +//* \brief Enable Endpoint +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EnableEp ( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint) // \arg endpoint number +{ + pUDP->UDP_CSR[endpoint] |= AT91C_UDP_EPEDS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_DisableEp +//* \brief Enable Endpoint +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_DisableEp ( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint) // \arg endpoint number +{ + pUDP->UDP_CSR[endpoint] &= ~AT91C_UDP_EPEDS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_SetState +//* \brief Set UDP Device state +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_SetState ( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned int flag) // \arg new UDP address +{ + pUDP->UDP_GLBSTATE &= ~(AT91C_UDP_FADDEN | AT91C_UDP_CONFG); + pUDP->UDP_GLBSTATE |= flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_GetState +//* \brief return UDP Device state +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_UDP_GetState ( // \return the UDP device state + AT91PS_UDP pUDP) // \arg pointer to a UDP controller +{ + return (pUDP->UDP_GLBSTATE & (AT91C_UDP_FADDEN | AT91C_UDP_CONFG)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_ResetEp +//* \brief Reset UDP endpoint +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_ResetEp ( // \return the UDP device state + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned int flag) // \arg Endpoints to be reset +{ + pUDP->UDP_RSTEP = flag; + pUDP->UDP_RSTEP = 0; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpStall +//* \brief Endpoint will STALL requests +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EpStall( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint) // \arg endpoint number +{ + pUDP->UDP_CSR[endpoint] |= AT91C_UDP_FORCESTALL; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpWrite +//* \brief Write value in the DPR +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EpWrite( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint, // \arg endpoint number + unsigned char value) // \arg value to be written in the DPR +{ + pUDP->UDP_FDR[endpoint] = value; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpRead +//* \brief Return value from the DPR +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_UDP_EpRead( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint) // \arg endpoint number +{ + return pUDP->UDP_FDR[endpoint]; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpEndOfWr +//* \brief Notify the UDP that values in DPR are ready to be sent +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EpEndOfWr( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint) // \arg endpoint number +{ + pUDP->UDP_CSR[endpoint] |= AT91C_UDP_TXPKTRDY; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpClear +//* \brief Clear flag in the endpoint CSR register +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EpClear( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint, // \arg endpoint number + unsigned int flag) // \arg flag to be cleared +{ + pUDP->UDP_CSR[endpoint] &= ~(flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpSet +//* \brief Set flag in the endpoint CSR register +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EpSet( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint, // \arg endpoint number + unsigned int flag) // \arg flag to be cleared +{ + pUDP->UDP_CSR[endpoint] |= flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpStatus +//* \brief Return the endpoint CSR register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_UDP_EpStatus( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint) // \arg endpoint number +{ + return pUDP->UDP_CSR[endpoint]; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_GetInterruptMaskStatus +//* \brief Return UDP Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_UDP_GetInterruptMaskStatus( + AT91PS_UDP pUdp) // \arg pointer to a UDP controller +{ + return pUdp->UDP_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_IsInterruptMasked +//* \brief Test if UDP Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_UDP_IsInterruptMasked( + AT91PS_UDP pUdp, // \arg pointer to a UDP controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_UDP_GetInterruptMaskStatus(pUdp) & flag); +} + +// ---------------------------------------------------------------------------- +// \fn AT91F_UDP_InterruptStatusRegister +// \brief Return the Interrupt Status Register +// ---------------------------------------------------------------------------- +__inline unsigned int AT91F_UDP_InterruptStatusRegister( + AT91PS_UDP pUDP ) // \arg pointer to a UDP controller +{ + return pUDP->UDP_ISR; +} + +// ---------------------------------------------------------------------------- +// \fn AT91F_UDP_InterruptClearRegister +// \brief Clear Interrupt Register +// ---------------------------------------------------------------------------- +__inline void AT91F_UDP_InterruptClearRegister ( + AT91PS_UDP pUDP, // \arg pointer to UDP controller + unsigned int flag) // \arg IT to be cleat +{ + pUDP->UDP_ICR = flag; +} + +// ---------------------------------------------------------------------------- +// \fn AT91F_UDP_EnableTransceiver +// \brief Enable transceiver +// ---------------------------------------------------------------------------- +__inline void AT91F_UDP_EnableTransceiver( + AT91PS_UDP pUDP ) // \arg pointer to a UDP controller +{ + pUDP->UDP_TXVC &= ~AT91C_UDP_TXVDIS; +} + +// ---------------------------------------------------------------------------- +// \fn AT91F_UDP_DisableTransceiver +// \brief Disable transceiver +// ---------------------------------------------------------------------------- +__inline void AT91F_UDP_DisableTransceiver( + AT91PS_UDP pUDP ) // \arg pointer to a UDP controller +{ + pUDP->UDP_TXVC = AT91C_UDP_TXVDIS; +} + +/* ***************************************************************************** + SOFTWARE API FOR TC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC_InterruptEnable +//* \brief Enable TC Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_TC_InterruptEnable( + AT91PS_TC pTc, // \arg pointer to a TC controller + unsigned int flag) // \arg TC interrupt to be enabled +{ + pTc->TC_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC_InterruptDisable +//* \brief Disable TC Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_TC_InterruptDisable( + AT91PS_TC pTc, // \arg pointer to a TC controller + unsigned int flag) // \arg TC interrupt to be disabled +{ + pTc->TC_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC_GetInterruptMaskStatus +//* \brief Return TC Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_TC_GetInterruptMaskStatus( // \return TC Interrupt Mask Status + AT91PS_TC pTc) // \arg pointer to a TC controller +{ + return pTc->TC_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC_IsInterruptMasked +//* \brief Test if TC Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_TC_IsInterruptMasked( + AT91PS_TC pTc, // \arg pointer to a TC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_TC_GetInterruptMaskStatus(pTc) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR CAN + ***************************************************************************** */ +#define STANDARD_FORMAT 0 +#define EXTENDED_FORMAT 1 + +//*---------------------------------------------------------------------------- +//* \fn AT91F_InitMailboxRegisters() +//* \brief Configure the corresponding mailbox +//*---------------------------------------------------------------------------- +__inline void AT91F_InitMailboxRegisters(AT91PS_CAN_MB CAN_Mailbox, + int mode_reg, + int acceptance_mask_reg, + int id_reg, + int data_low_reg, + int data_high_reg, + int control_reg) +{ + CAN_Mailbox->CAN_MB_MCR = 0x0; + CAN_Mailbox->CAN_MB_MMR = mode_reg; + CAN_Mailbox->CAN_MB_MAM = acceptance_mask_reg; + CAN_Mailbox->CAN_MB_MID = id_reg; + CAN_Mailbox->CAN_MB_MDL = data_low_reg; + CAN_Mailbox->CAN_MB_MDH = data_high_reg; + CAN_Mailbox->CAN_MB_MCR = control_reg; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_EnableCAN() +//* \brief +//*---------------------------------------------------------------------------- +__inline void AT91F_EnableCAN( + AT91PS_CAN pCAN) // pointer to a CAN controller +{ + pCAN->CAN_MR |= AT91C_CAN_CANEN; + + // Wait for WAKEUP flag raising <=> 11-recessive-bit were scanned by the transceiver + while( (pCAN->CAN_SR & AT91C_CAN_WAKEUP) != AT91C_CAN_WAKEUP ); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_DisableCAN() +//* \brief +//*---------------------------------------------------------------------------- +__inline void AT91F_DisableCAN( + AT91PS_CAN pCAN) // pointer to a CAN controller +{ + pCAN->CAN_MR &= ~AT91C_CAN_CANEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_EnableIt +//* \brief Enable CAN interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_EnableIt ( + AT91PS_CAN pCAN, // pointer to a CAN controller + unsigned int flag) // IT to be enabled +{ + //* Write to the IER register + pCAN->CAN_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_DisableIt +//* \brief Disable CAN interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_DisableIt ( + AT91PS_CAN pCAN, // pointer to a CAN controller + unsigned int flag) // IT to be disabled +{ + //* Write to the IDR register + pCAN->CAN_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetStatus +//* \brief Return CAN Interrupt Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetStatus( // \return CAN Interrupt Status + AT91PS_CAN pCAN) // pointer to a CAN controller +{ + return pCAN->CAN_SR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetInterruptMaskStatus +//* \brief Return CAN Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetInterruptMaskStatus( // \return CAN Interrupt Mask Status + AT91PS_CAN pCAN) // pointer to a CAN controller +{ + return pCAN->CAN_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_IsInterruptMasked +//* \brief Test if CAN Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_IsInterruptMasked( + AT91PS_CAN pCAN, // \arg pointer to a CAN controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_CAN_GetInterruptMaskStatus(pCAN) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_IsStatusSet +//* \brief Test if CAN Interrupt is Set +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_IsStatusSet( + AT91PS_CAN pCAN, // \arg pointer to a CAN controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_CAN_GetStatus(pCAN) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgModeReg +//* \brief Configure the Mode Register of the CAN controller +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgModeReg ( + AT91PS_CAN pCAN, // pointer to a CAN controller + unsigned int mode) // mode register +{ + //* Write to the MR register + pCAN->CAN_MR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetModeReg +//* \brief Return the Mode Register of the CAN controller value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetModeReg ( + AT91PS_CAN pCAN // pointer to a CAN controller + ) +{ + return pCAN->CAN_MR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgBaudrateReg +//* \brief Configure the Baudrate of the CAN controller for the network +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgBaudrateReg ( + AT91PS_CAN pCAN, // pointer to a CAN controller + unsigned int baudrate_cfg) +{ + //* Write to the BR register + pCAN->CAN_BR = baudrate_cfg; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetBaudrate +//* \brief Return the Baudrate of the CAN controller for the network value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetBaudrate ( + AT91PS_CAN pCAN // pointer to a CAN controller + ) +{ + return pCAN->CAN_BR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetInternalCounter +//* \brief Return CAN Timer Regsiter Value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetInternalCounter ( + AT91PS_CAN pCAN // pointer to a CAN controller + ) +{ + return pCAN->CAN_TIM; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetTimestamp +//* \brief Return CAN Timestamp Register Value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetTimestamp ( + AT91PS_CAN pCAN // pointer to a CAN controller + ) +{ + return pCAN->CAN_TIMESTP; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetErrorCounter +//* \brief Return CAN Error Counter Register Value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetErrorCounter ( + AT91PS_CAN pCAN // pointer to a CAN controller + ) +{ + return pCAN->CAN_ECR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_InitTransferRequest +//* \brief Request for a transfer on the corresponding mailboxes +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_InitTransferRequest ( + AT91PS_CAN pCAN, // pointer to a CAN controller + unsigned int transfer_cmd) +{ + pCAN->CAN_TCR = transfer_cmd; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_InitAbortRequest +//* \brief Abort the corresponding mailboxes +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_InitAbortRequest ( + AT91PS_CAN pCAN, // pointer to a CAN controller + unsigned int abort_cmd) +{ + pCAN->CAN_ACR = abort_cmd; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgMessageModeReg +//* \brief Program the Message Mode Register +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgMessageModeReg ( + AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox + unsigned int mode) +{ + CAN_Mailbox->CAN_MB_MMR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetMessageModeReg +//* \brief Return the Message Mode Register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetMessageModeReg ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgMessageIDReg +//* \brief Program the Message ID Register +//* \brief Version == 0 for Standard messsage, Version == 1 for Extended +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgMessageIDReg ( + AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox + unsigned int id, + unsigned char version) +{ + if(version==0) // IDvA Standard Format + CAN_Mailbox->CAN_MB_MID = id<<18; + else // IDvB Extended Format + CAN_Mailbox->CAN_MB_MID = id | (1<<29); // set MIDE bit +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetMessageIDReg +//* \brief Return the Message ID Register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetMessageIDReg ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MID; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgMessageAcceptanceMaskReg +//* \brief Program the Message Acceptance Mask Register +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgMessageAcceptanceMaskReg ( + AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox + unsigned int mask) +{ + CAN_Mailbox->CAN_MB_MAM = mask; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetMessageAcceptanceMaskReg +//* \brief Return the Message Acceptance Mask Register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetMessageAcceptanceMaskReg ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MAM; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetFamilyID +//* \brief Return the Message ID Register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetFamilyID ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MFID; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgMessageCtrl +//* \brief Request and config for a transfer on the corresponding mailbox +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgMessageCtrlReg ( + AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox + unsigned int message_ctrl_cmd) +{ + CAN_Mailbox->CAN_MB_MCR = message_ctrl_cmd; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetMessageStatus +//* \brief Return CAN Mailbox Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetMessageStatus ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgMessageDataLow +//* \brief Program data low value +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgMessageDataLow ( + AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox + unsigned int data) +{ + CAN_Mailbox->CAN_MB_MDL = data; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetMessageDataLow +//* \brief Return data low value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetMessageDataLow ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MDL; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgMessageDataHigh +//* \brief Program data high value +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgMessageDataHigh ( + AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox + unsigned int data) +{ + CAN_Mailbox->CAN_MB_MDH = data; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetMessageDataHigh +//* \brief Return data high value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetMessageDataHigh ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MDH; +} + +/* ***************************************************************************** + SOFTWARE API FOR ADC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_EnableIt +//* \brief Enable ADC interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_EnableIt ( + AT91PS_ADC pADC, // pointer to a ADC controller + unsigned int flag) // IT to be enabled +{ + //* Write to the IER register + pADC->ADC_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_DisableIt +//* \brief Disable ADC interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_DisableIt ( + AT91PS_ADC pADC, // pointer to a ADC controller + unsigned int flag) // IT to be disabled +{ + //* Write to the IDR register + pADC->ADC_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetStatus +//* \brief Return ADC Interrupt Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetStatus( // \return ADC Interrupt Status + AT91PS_ADC pADC) // pointer to a ADC controller +{ + return pADC->ADC_SR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetInterruptMaskStatus +//* \brief Return ADC Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetInterruptMaskStatus( // \return ADC Interrupt Mask Status + AT91PS_ADC pADC) // pointer to a ADC controller +{ + return pADC->ADC_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_IsInterruptMasked +//* \brief Test if ADC Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_IsInterruptMasked( + AT91PS_ADC pADC, // \arg pointer to a ADC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_ADC_GetInterruptMaskStatus(pADC) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_IsStatusSet +//* \brief Test if ADC Status is Set +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_IsStatusSet( + AT91PS_ADC pADC, // \arg pointer to a ADC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_ADC_GetStatus(pADC) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_CfgModeReg +//* \brief Configure the Mode Register of the ADC controller +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_CfgModeReg ( + AT91PS_ADC pADC, // pointer to a ADC controller + unsigned int mode) // mode register +{ + //* Write to the MR register + pADC->ADC_MR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetModeReg +//* \brief Return the Mode Register of the ADC controller value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetModeReg ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_MR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_CfgTimings +//* \brief Configure the different necessary timings of the ADC controller +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_CfgTimings ( + AT91PS_ADC pADC, // pointer to a ADC controller + unsigned int mck_clock, // in MHz + unsigned int adc_clock, // in MHz + unsigned int startup_time, // in us + unsigned int sample_and_hold_time) // in ns +{ + unsigned int prescal,startup,shtim; + + prescal = mck_clock/(2*adc_clock) - 1; + startup = adc_clock*startup_time/8 - 1; + shtim = adc_clock*sample_and_hold_time/1000 - 1; + + //* Write to the MR register + pADC->ADC_MR = ( (prescal<<8) & AT91C_ADC_PRESCAL) | ( (startup<<16) & AT91C_ADC_STARTUP) | ( (shtim<<24) & AT91C_ADC_SHTIM); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_EnableChannel +//* \brief Return ADC Timer Register Value +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_EnableChannel ( + AT91PS_ADC pADC, // pointer to a ADC controller + unsigned int channel) // mode register +{ + //* Write to the CHER register + pADC->ADC_CHER = channel; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_DisableChannel +//* \brief Return ADC Timer Register Value +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_DisableChannel ( + AT91PS_ADC pADC, // pointer to a ADC controller + unsigned int channel) // mode register +{ + //* Write to the CHDR register + pADC->ADC_CHDR = channel; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetChannelStatus +//* \brief Return ADC Timer Register Value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetChannelStatus ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CHSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_StartConversion +//* \brief Software request for a analog to digital conversion +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_StartConversion ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + pADC->ADC_CR = AT91C_ADC_START; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_SoftReset +//* \brief Software reset +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_SoftReset ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + pADC->ADC_CR = AT91C_ADC_SWRST; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetLastConvertedData +//* \brief Return the Last Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetLastConvertedData ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_LCDR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH0 +//* \brief Return the Channel 0 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH0 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR0; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH1 +//* \brief Return the Channel 1 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH1 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR1; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH2 +//* \brief Return the Channel 2 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH2 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR2; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH3 +//* \brief Return the Channel 3 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH3 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR3; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH4 +//* \brief Return the Channel 4 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH4 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR4; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH5 +//* \brief Return the Channel 5 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH5 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR5; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH6 +//* \brief Return the Channel 6 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH6 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR6; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH7 +//* \brief Return the Channel 7 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH7 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR7; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_CfgPMC +//* \brief Enable Peripheral clock in PMC for MC +//*---------------------------------------------------------------------------- +__inline void AT91F_MC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_DBGU_CfgPMC +//* \brief Enable Peripheral clock in PMC for DBGU +//*---------------------------------------------------------------------------- +__inline void AT91F_DBGU_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_DBGU_CfgPIO +//* \brief Configure PIO controllers to drive DBGU signals +//*---------------------------------------------------------------------------- +__inline void AT91F_DBGU_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA28_DTXD ) | + ((unsigned int) AT91C_PA27_DRXD ), // Peripheral A + 0); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWMC_CH3_CfgPIO +//* \brief Configure PIO controllers to drive PWMC_CH3 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_CH3_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB22_PWM3 ), // Peripheral A + ((unsigned int) AT91C_PB30_PWM3 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWMC_CH2_CfgPIO +//* \brief Configure PIO controllers to drive PWMC_CH2 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_CH2_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB21_PWM2 ), // Peripheral A + ((unsigned int) AT91C_PB29_PWM2 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWMC_CH1_CfgPIO +//* \brief Configure PIO controllers to drive PWMC_CH1 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_CH1_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB20_PWM1 ), // Peripheral A + ((unsigned int) AT91C_PB28_PWM1 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWMC_CH0_CfgPIO +//* \brief Configure PIO controllers to drive PWMC_CH0 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_CH0_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB19_PWM0 ), // Peripheral A + ((unsigned int) AT91C_PB27_PWM0 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_EMAC_CfgPMC +//* \brief Enable Peripheral clock in PMC for EMAC +//*---------------------------------------------------------------------------- +__inline void AT91F_EMAC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_EMAC)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_EMAC_CfgPIO +//* \brief Configure PIO controllers to drive EMAC signals +//*---------------------------------------------------------------------------- +__inline void AT91F_EMAC_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB9_EMDIO ) | + ((unsigned int) AT91C_PB17_ERXCK ) | + ((unsigned int) AT91C_PB15_ERXDV_ECRSDV) | + ((unsigned int) AT91C_PB8_EMDC ) | + ((unsigned int) AT91C_PB16_ECOL ) | + ((unsigned int) AT91C_PB7_ERXER ) | + ((unsigned int) AT91C_PB5_ERX0 ) | + ((unsigned int) AT91C_PB6_ERX1 ) | + ((unsigned int) AT91C_PB13_ERX2 ) | + ((unsigned int) AT91C_PB1_ETXEN ) | + ((unsigned int) AT91C_PB14_ERX3 ) | + ((unsigned int) AT91C_PB12_ETXER ) | + ((unsigned int) AT91C_PB2_ETX0 ) | + ((unsigned int) AT91C_PB3_ETX1 ) | + ((unsigned int) AT91C_PB10_ETX2 ) | + ((unsigned int) AT91C_PB18_EF100 ) | + ((unsigned int) AT91C_PB11_ETX3 ) | + ((unsigned int) AT91C_PB4_ECRS ) | + ((unsigned int) AT91C_PB0_ETXCK_EREFCK), // Peripheral A + 0); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_VREG_CfgPMC +//* \brief Enable Peripheral clock in PMC for VREG +//*---------------------------------------------------------------------------- +__inline void AT91F_VREG_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_CfgPMC +//* \brief Enable Peripheral clock in PMC for SSC +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SSC)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_CfgPIO +//* \brief Configure PIO controllers to drive SSC signals +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA23_TD ) | + ((unsigned int) AT91C_PA21_TF ) | + ((unsigned int) AT91C_PA25_RK ) | + ((unsigned int) AT91C_PA24_RD ) | + ((unsigned int) AT91C_PA26_RF ) | + ((unsigned int) AT91C_PA22_TK ), // Peripheral A + 0); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI1_CfgPMC +//* \brief Enable Peripheral clock in PMC for SPI1 +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI1_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SPI1)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI1_CfgPIO +//* \brief Configure PIO controllers to drive SPI1 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI1_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PA23_SPI1_MOSI) | + ((unsigned int) AT91C_PA21_SPI1_NPCS0) | + ((unsigned int) AT91C_PA25_SPI1_NPCS1) | + ((unsigned int) AT91C_PA2_SPI1_NPCS1) | + ((unsigned int) AT91C_PA24_SPI1_MISO) | + ((unsigned int) AT91C_PA22_SPI1_SPCK) | + ((unsigned int) AT91C_PA26_SPI1_NPCS2) | + ((unsigned int) AT91C_PA3_SPI1_NPCS2) | + ((unsigned int) AT91C_PA29_SPI1_NPCS3) | + ((unsigned int) AT91C_PA4_SPI1_NPCS3)); // Peripheral B + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PB10_SPI1_NPCS1) | + ((unsigned int) AT91C_PB11_SPI1_NPCS2) | + ((unsigned int) AT91C_PB16_SPI1_NPCS3)); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI0_CfgPMC +//* \brief Enable Peripheral clock in PMC for SPI0 +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI0_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SPI0)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI0_CfgPIO +//* \brief Configure PIO controllers to drive SPI0 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI0_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA17_SPI0_MOSI) | + ((unsigned int) AT91C_PA12_SPI0_NPCS0) | + ((unsigned int) AT91C_PA13_SPI0_NPCS1) | + ((unsigned int) AT91C_PA16_SPI0_MISO) | + ((unsigned int) AT91C_PA14_SPI0_NPCS2) | + ((unsigned int) AT91C_PA18_SPI0_SPCK) | + ((unsigned int) AT91C_PA15_SPI0_NPCS3), // Peripheral A + ((unsigned int) AT91C_PA7_SPI0_NPCS1) | + ((unsigned int) AT91C_PA8_SPI0_NPCS2) | + ((unsigned int) AT91C_PA9_SPI0_NPCS3)); // Peripheral B + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PB13_SPI0_NPCS1) | + ((unsigned int) AT91C_PB14_SPI0_NPCS2) | + ((unsigned int) AT91C_PB17_SPI0_NPCS3)); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWMC_CfgPMC +//* \brief Enable Peripheral clock in PMC for PWMC +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_PWMC)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC0_CfgPMC +//* \brief Enable Peripheral clock in PMC for TC0 +//*---------------------------------------------------------------------------- +__inline void AT91F_TC0_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_TC0)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC0_CfgPIO +//* \brief Configure PIO controllers to drive TC0 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_TC0_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB23_TIOA0 ) | + ((unsigned int) AT91C_PB24_TIOB0 ), // Peripheral A + ((unsigned int) AT91C_PB12_TCLK0 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC1_CfgPMC +//* \brief Enable Peripheral clock in PMC for TC1 +//*---------------------------------------------------------------------------- +__inline void AT91F_TC1_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_TC1)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC1_CfgPIO +//* \brief Configure PIO controllers to drive TC1 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_TC1_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB25_TIOA1 ) | + ((unsigned int) AT91C_PB26_TIOB1 ), // Peripheral A + ((unsigned int) AT91C_PB19_TCLK1 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC2_CfgPMC +//* \brief Enable Peripheral clock in PMC for TC2 +//*---------------------------------------------------------------------------- +__inline void AT91F_TC2_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_TC2)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC2_CfgPIO +//* \brief Configure PIO controllers to drive TC2 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_TC2_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PA15_TCLK2 )); // Peripheral B + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB27_TIOA2 ) | + ((unsigned int) AT91C_PB28_TIOB2 ), // Peripheral A + 0); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITC_CfgPMC +//* \brief Enable Peripheral clock in PMC for PITC +//*---------------------------------------------------------------------------- +__inline void AT91F_PITC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_CfgPMC +//* \brief Enable Peripheral clock in PMC for ADC +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_ADC)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_CfgPIO +//* \brief Configure PIO controllers to drive ADC signals +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PB18_ADTRG )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_CfgPMC +//* \brief Enable Peripheral clock in PMC for PMC +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_CfgPIO +//* \brief Configure PIO controllers to drive PMC signals +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PA13_PCK1 ) | + ((unsigned int) AT91C_PA30_PCK2 ) | + ((unsigned int) AT91C_PA27_PCK3 )); // Peripheral B + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB29_PCK1 ) | + ((unsigned int) AT91C_PB30_PCK2 ), // Peripheral A + ((unsigned int) AT91C_PB21_PCK1 ) | + ((unsigned int) AT91C_PB22_PCK2 ) | + ((unsigned int) AT91C_PB20_PCK0 ) | + ((unsigned int) AT91C_PB0_PCK0 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_RSTC_CfgPMC +//* \brief Enable Peripheral clock in PMC for RSTC +//*---------------------------------------------------------------------------- +__inline void AT91F_RSTC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_RTTC_CfgPMC +//* \brief Enable Peripheral clock in PMC for RTTC +//*---------------------------------------------------------------------------- +__inline void AT91F_RTTC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIOA_CfgPMC +//* \brief Enable Peripheral clock in PMC for PIOA +//*---------------------------------------------------------------------------- +__inline void AT91F_PIOA_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_PIOA)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIOB_CfgPMC +//* \brief Enable Peripheral clock in PMC for PIOB +//*---------------------------------------------------------------------------- +__inline void AT91F_PIOB_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_PIOB)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_CfgPMC +//* \brief Enable Peripheral clock in PMC for TWI +//*---------------------------------------------------------------------------- +__inline void AT91F_TWI_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_TWI)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_CfgPIO +//* \brief Configure PIO controllers to drive TWI signals +//*---------------------------------------------------------------------------- +__inline void AT91F_TWI_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA10_TWD ) | + ((unsigned int) AT91C_PA11_TWCK ), // Peripheral A + 0); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_WDTC_CfgPMC +//* \brief Enable Peripheral clock in PMC for WDTC +//*---------------------------------------------------------------------------- +__inline void AT91F_WDTC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US1_CfgPMC +//* \brief Enable Peripheral clock in PMC for US1 +//*---------------------------------------------------------------------------- +__inline void AT91F_US1_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_US1)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US1_CfgPIO +//* \brief Configure PIO controllers to drive US1 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_US1_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA5_RXD1 ) | + ((unsigned int) AT91C_PA6_TXD1 ) | + ((unsigned int) AT91C_PA8_RTS1 ) | + ((unsigned int) AT91C_PA7_SCK1 ) | + ((unsigned int) AT91C_PA9_CTS1 ), // Peripheral A + 0); // Peripheral B + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PB25_DTR1 ) | + ((unsigned int) AT91C_PB23_DCD1 ) | + ((unsigned int) AT91C_PB24_DSR1 ) | + ((unsigned int) AT91C_PB26_RI1 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US0_CfgPMC +//* \brief Enable Peripheral clock in PMC for US0 +//*---------------------------------------------------------------------------- +__inline void AT91F_US0_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_US0)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US0_CfgPIO +//* \brief Configure PIO controllers to drive US0 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_US0_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA0_RXD0 ) | + ((unsigned int) AT91C_PA1_TXD0 ) | + ((unsigned int) AT91C_PA3_RTS0 ) | + ((unsigned int) AT91C_PA2_SCK0 ) | + ((unsigned int) AT91C_PA4_CTS0 ), // Peripheral A + 0); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_CfgPMC +//* \brief Enable Peripheral clock in PMC for UDP +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_UDP)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_CfgPMC +//* \brief Enable Peripheral clock in PMC for AIC +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_IRQ0) | + ((unsigned int) 1 << AT91C_ID_FIQ) | + ((unsigned int) 1 << AT91C_ID_IRQ1)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_CfgPIO +//* \brief Configure PIO controllers to drive AIC signals +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA30_IRQ0 ) | + ((unsigned int) AT91C_PA29_FIQ ), // Peripheral A + ((unsigned int) AT91C_PA14_IRQ1 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgPMC +//* \brief Enable Peripheral clock in PMC for CAN +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_CAN)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgPIO +//* \brief Configure PIO controllers to drive CAN signals +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA20_CANTX ) | + ((unsigned int) AT91C_PA19_CANRX ), // Peripheral A + 0); // Peripheral B +} + +#endif // lib_AT91SAM7X256_H diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/incIAR/project.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/incIAR/project.h new file mode 100644 index 0000000..24fb698 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/incIAR/project.h @@ -0,0 +1,30 @@ +//----------------------------------------------------------------------------- +// ATMEL Microcontroller Software Support - ROUSSET - +//----------------------------------------------------------------------------- +// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +//----------------------------------------------------------------------------- +// File Name : project.h +// Object : project specific include file to AT91SAM7X256 +// Creation : JPP 14-Sep-2006 +//----------------------------------------------------------------------------- +#ifndef _PROJECT_H +#define _PROJECT_H + +/// Include your AT91 Library files and specific compiler definitions + +#include +#include "AT91SAM7X-EK.h" +#include "AT91SAM7X256.h" +#define __inline inline +#include "lib_AT91SAM7X256.h" + +#endif // _PROJECT_H diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.cspy.bat b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.cspy.bat new file mode 100644 index 0000000..aa07e50 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.cspy.bat @@ -0,0 +1,33 @@ +@REM This bat file has been generated by the IAR Embeddded Workbench +@REM C-SPY interactive debugger,as an aid to preparing a command +@REM line for running the cspybat command line utility with the +@REM appropriate settings. +@REM +@REM After making some adjustments to this file, you can launch cspybat +@REM by typing the name of this file followed by the name of the debug +@REM file (usually an ubrof file). Note that this file is generated +@REM every time a new debug session is initialized, so you may want to +@REM move or rename the file before making changes. +@REM +@REM Note: some command line arguments cannot be properly generated +@REM by this process. Specifically, the plugin which is responsible +@REM for the Terminal I/O window (and other C runtime functionality) +@REM comes in a special version for cspybat, and the name of that +@REM plugin dll is not known when generating this file. It resides in +@REM the $TOOLKIT_DIR$\bin folder and is usually called XXXbat.dll or +@REM XXXlibsupportbat.dll, where XXX is the name of the corresponding +@REM tool chain. Replace the '' parameter +@REM below with the appropriate file name. Other plugins loaded by +@REM C-SPY are usually not needed by, or will not work in, cspybat +@REM but they are listed at the end of this file for reference. + + +"C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\bin\cspybat" "C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\bin\armproc.dll" "C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\bin\armjlink.dll" %1 --plugin "C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\bin\" --macro "C:\Documents and Settings\Greg\Desktop\SAM7X256\AT91SAM7X-Interrupt_SAM7X\Compil\resource\SAM7_FLASH.mac" --backend -B "--endian=little" "--cpu=ARM7TDMI" "--fpu=None" "-p" "C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\CONFIG\debugger\Atmel\ioAT91SAM7X256.ddf" "--drv_verify_download" "--semihosting" "--device=AT91SAM7X256" "-d" "jlink" "--drv_communication=USB0" "--jlink_speed=adaptive" + + +@REM Loaded plugins: +@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\bin\armlibsupport.dll +@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\plugins\CodeCoverage\CodeCoverage.dll +@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\plugins\Profiling\Profiling.dll +@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\plugins\stack\stack.dll +@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\plugins\SymList\SymList.dll diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.dbgdt b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.dbgdt new file mode 100644 index 0000000..e068f91 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.dbgdt @@ -0,0 +1,5 @@ + + + + + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.dni b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.dni new file mode 100644 index 0000000..a4e49ac --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.dni @@ -0,0 +1,18 @@ +[JLinkDriver] +WatchCond=_ 0 +Watch0=_ 0 "" 0 "" 0 "" 0 "" 0 0 0 0 +Watch1=_ 0 "" 0 "" 0 "" 0 "" 0 0 0 0 +[TermIOLog] +LoggingEnabled=_ 0 +LogFile=_ "" +[Log file] +LoggingEnabled=_ 0 +LogFile=_ "" +Category=_ 0 +[Disassemble mode] +mode=0 +[Breakpoints] +Count=0 +[TraceHelper] +Enabled=0 +ShowSource=1 diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.wsdt b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.wsdt new file mode 100644 index 0000000..f9f15e9 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.wsdt @@ -0,0 +1,74 @@ + + + + + + BasicInterrupt_SAM7X/FLASH_Debug + + + + + + + + + 271272727 + + + 20 + 995 + 265 + 66 + + + + + + + + + + + TabID-26686-579 + Workspace + Workspace + + + BasicInterrupt_SAM7X + + + + 0 + + + TabID-13847-615 + Build + Build + + + + TabID-20936-687 + Debug Log + Debug-Log + + + + + 1 + + + + + + 0100000010000001 + + + + + + + iaridepm.enu1-2-2612345-2-2200200144300234192250361718970-2-21981388-2-213902001002886234192144300234192 + + + + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X_FLASH_Debug.jlink b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X_FLASH_Debug.jlink new file mode 100644 index 0000000..ecbb0a8 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X_FLASH_Debug.jlink @@ -0,0 +1,12 @@ +[FLASH] +SkipProgOnCRCMatch = 1 +VerifyDownload = 1 +AllowCaching = 1 +EnableFlashDL = 2 +Override = 0 +Device="ADUC7020X62" +[BREAKPOINTS] +ShowInfoWin = 1 +EnableFlashBP = 2 +[CPU] +AllowSimulation = 1 diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo.cspy.bat b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo.cspy.bat new file mode 100644 index 0000000..0e4d177 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo.cspy.bat @@ -0,0 +1,33 @@ +@REM This bat file has been generated by the IAR Embeddded Workbench +@REM C-SPY interactive debugger,as an aid to preparing a command +@REM line for running the cspybat command line utility with the +@REM appropriate settings. +@REM +@REM After making some adjustments to this file, you can launch cspybat +@REM by typing the name of this file followed by the name of the debug +@REM file (usually an ubrof file). Note that this file is generated +@REM every time a new debug session is initialized, so you may want to +@REM move or rename the file before making changes. +@REM +@REM Note: some command line arguments cannot be properly generated +@REM by this process. Specifically, the plugin which is responsible +@REM for the Terminal I/O window (and other C runtime functionality) +@REM comes in a special version for cspybat, and the name of that +@REM plugin dll is not known when generating this file. It resides in +@REM the $TOOLKIT_DIR$\bin folder and is usually called XXXbat.dll or +@REM XXXlibsupportbat.dll, where XXX is the name of the corresponding +@REM tool chain. Replace the '' parameter +@REM below with the appropriate file name. Other plugins loaded by +@REM C-SPY are usually not needed by, or will not work in, cspybat +@REM but they are listed at the end of this file for reference. + + +"C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\bin\cspybat" "C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\bin\armproc.dll" "C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\bin\armjlink.dll" %1 --plugin "C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\bin\" --macro "C:\svn\cmock\iar\iar_v5\Resource\SAM7_RAM.mac" --backend -B "--endian=little" "--cpu=ARM7TDMI" "--fpu=None" "-p" "C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\CONFIG\debugger\Atmel\ioAT91SAM7X256.ddf" "--drv_verify_download" "--semihosting" "--device=AT91SAM7X256" "-d" "jlink" "--drv_communication=USB0" "--jlink_speed=adaptive" + + +@REM Loaded plugins: +@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\bin\armlibsupport.dll +@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\plugins\CodeCoverage\CodeCoverage.dll +@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\plugins\Profiling\Profiling.dll +@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\plugins\stack\stack.dll +@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\plugins\SymList\SymList.dll diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo.dbgdt b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo.dbgdt new file mode 100644 index 0000000..b521f67 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo.dbgdt @@ -0,0 +1,85 @@ + + + + + + + + 20 + 995 + 265 + 66 + + + + + + + + 124272727 + + + + + 10 + + + + + + + + + TabID-27249-27051 + Debug Log + Debug-Log + + + + TabID-4707-27064 + Build + Build + + + + + 0 + + + TabID-5230-27054 + Workspace + Workspace + + + cmock_demo + + + + 0 + + + TabID-15978-27058 + Disassembly + Disassembly + + + + + 0 + + + + + + TextEditorC:\svn\cmock\examples\src\Main.c0258358350TextEditorC:\svn\cmock\examples\src\TaskScheduler.c0439819810100000010000001 + + + + + + + iaridepm.enu1debuggergui.enu1-2-2588198-2-2200200144300234192144300690867-2-2588198-2-2200200144300234192144300690867-2-21981388-2-213902001002886234192144300234192 + + + + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo.dni b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo.dni new file mode 100644 index 0000000..84237e1 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo.dni @@ -0,0 +1,44 @@ +[JLinkDriver] +WatchCond=_ 0 +Watch0=_ 0 "" 0 "" 0 "" 0 "" 0 0 0 0 +Watch1=_ 0 "" 0 "" 0 "" 0 "" 0 0 0 0 +[DisAssemblyWindow] +NumStates=_ 1 +State 1=_ 1 +[CodeCoverage] +Enabled=_ 0 +[Profiling] +Enabled=0 +[StackPlugin] +Enabled=1 +OverflowWarningsEnabled=1 +WarningThreshold=90 +SpWarningsEnabled=1 +WarnHow=0 +UseTrigger=1 +TriggerName=main +LimitSize=0 +ByteLimit=50 +[Interrupts] +Enabled=1 +[MemoryMap] +Enabled=0 +Base=0 +UseAuto=0 +TypeViolation=1 +UnspecRange=1 +ActionState=1 +[Log file] +LoggingEnabled=_ 0 +LogFile=_ "" +Category=_ 0 +[TermIOLog] +LoggingEnabled=_ 0 +LogFile=_ "" +[Disassemble mode] +mode=0 +[Breakpoints] +Count=0 +[TraceHelper] +Enabled=0 +ShowSource=1 diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo.wsdt b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo.wsdt new file mode 100644 index 0000000..c1a7704 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo.wsdt @@ -0,0 +1,73 @@ + + + + + + cmock_demo/RAM_Debug + + + + + + + + 2099526566 + + + + + + + 216272727 + + + + + + + + + + TabID-7530-24964 + Build + Build + + + + TabID-25388-26881 + Debug Log + Debug-Log + + + + + 0 + + + TabID-18278-24968 + Workspace + Workspace + + + cmock_democmock_demo/Sourcecmock_demo/srccmock_demo/srcIAR + + + + 0 + + + + + + TextEditorC:\svn\cmock\examples\src\Main.c02582082000100000010000001 + + + + + + + iaridepm.enu1-2-2513307-2-2200200144300234192222944603044-2-22971388-2-213902991002886350117144300234192 + + + + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo_Binary.jlink b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo_Binary.jlink new file mode 100644 index 0000000..ecbb0a8 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo_Binary.jlink @@ -0,0 +1,12 @@ +[FLASH] +SkipProgOnCRCMatch = 1 +VerifyDownload = 1 +AllowCaching = 1 +EnableFlashDL = 2 +Override = 0 +Device="ADUC7020X62" +[BREAKPOINTS] +ShowInfoWin = 1 +EnableFlashBP = 2 +[CPU] +AllowSimulation = 1 diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo_FLASH_Debug.jlink b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo_FLASH_Debug.jlink new file mode 100644 index 0000000..ecbb0a8 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo_FLASH_Debug.jlink @@ -0,0 +1,12 @@ +[FLASH] +SkipProgOnCRCMatch = 1 +VerifyDownload = 1 +AllowCaching = 1 +EnableFlashDL = 2 +Override = 0 +Device="ADUC7020X62" +[BREAKPOINTS] +ShowInfoWin = 1 +EnableFlashBP = 2 +[CPU] +AllowSimulation = 1 diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo_RAM_Debug.jlink b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo_RAM_Debug.jlink new file mode 100644 index 0000000..ecbb0a8 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo_RAM_Debug.jlink @@ -0,0 +1,12 @@ +[FLASH] +SkipProgOnCRCMatch = 1 +VerifyDownload = 1 +AllowCaching = 1 +EnableFlashDL = 2 +Override = 0 +Device="ADUC7020X62" +[BREAKPOINTS] +ShowInfoWin = 1 +EnableFlashBP = 2 +[CPU] +AllowSimulation = 1 diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/srcIAR/Cstartup.s b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/srcIAR/Cstartup.s new file mode 100644 index 0000000..7113c80 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/srcIAR/Cstartup.s @@ -0,0 +1,299 @@ +;* ---------------------------------------------------------------------------- +;* ATMEL Microcontroller Software Support - ROUSSET - +;* ---------------------------------------------------------------------------- +;* Copyright (c) 2006, Atmel Corporation +; +;* All rights reserved. +;* +;* Redistribution and use in source and binary forms, with or without +;* modification, are permitted provided that the following conditions are met: +;* +;* - Redistributions of source code must retain the above copyright notice, +;* this list of conditions and the disclaimer below. +;* +;* - Redistributions in binary form must reproduce the above copyright notice, +;* this list of conditions and the disclaimer below in the documentation and/or +;* other materials provided with the distribution. +;* +;* Atmel's name may not be used to endorse or promote products derived from +;* this software without specific prior written permission. +;* +;* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +;* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +;* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +;* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +;* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +;* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +;* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +;* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +;* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +;* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +;* ---------------------------------------------------------------------------- + +;------------------------------------------------------------------------------ +; Include your AT91 Library files +;------------------------------------------------------------------------------ +#include "AT91SAM7X256_inc.h" +;------------------------------------------------------------------------------ + +#define TOP_OF_MEMORY (AT91C_ISRAM + AT91C_ISRAM_SIZE) +#define IRQ_STACK_SIZE (3*8*4) + ; 3 words to be saved per interrupt priority level + +; Mode, correspords to bits 0-5 in CPSR +MODE_BITS DEFINE 0x1F ; Bit mask for mode bits in CPSR +USR_MODE DEFINE 0x10 ; User mode +FIQ_MODE DEFINE 0x11 ; Fast Interrupt Request mode +IRQ_MODE DEFINE 0x12 ; Interrupt Request mode +SVC_MODE DEFINE 0x13 ; Supervisor mode +ABT_MODE DEFINE 0x17 ; Abort mode +UND_MODE DEFINE 0x1B ; Undefined Instruction mode +SYS_MODE DEFINE 0x1F ; System mode + +I_BIT DEFINE 0x80 +F_BIT DEFINE 0x40 + +;------------------------------------------------------------------------------ +; ?RESET +; Reset Vector. +; Normally, segment INTVEC is linked at address 0. +; For debugging purposes, INTVEC may be placed at other addresses. +; A debugger that honors the entry point will start the +; program in a normal way even if INTVEC is not at address 0. +;------------------------------------------------------------------------------ + SECTION .intvec:CODE:NOROOT(2) + PUBLIC __vector + PUBLIC __iar_program_start + + ARM +__vector: + ldr pc,[pc,#+24] ;; Reset +__und_handler: + ldr pc,[pc,#+24] ;; Undefined instructions +__swi_handler: + ldr pc,[pc,#+24] ;; Software interrupt (SWI/SVC) +__prefetch_handler: + ldr pc,[pc,#+24] ;; Prefetch abort +__data_handler: + ldr pc,[pc,#+24] ;; Data abort + DC32 0xFFFFFFFF ;; RESERVED +__irq_handler: + ldr pc,[pc,#+24] ;; IRQ +__fiq_handler: + ldr pc,[pc,#+24] ;; FIQ + + DC32 __iar_program_start + DC32 __und_handler + DC32 __swi_handler + DC32 __prefetch_handler + DC32 __data_handler + B . + DC32 IRQ_Handler_Entry + DC32 FIQ_Handler_Entry + +;------------------------------------------------------------------------------ +;- Manage exception: The exception must be ensure in ARM mode +;------------------------------------------------------------------------------ + SECTION text:CODE:NOROOT(2) + ARM +;------------------------------------------------------------------------------ +;- Function : FIQ_Handler_Entry +;- Treatments : FIQ Controller Interrupt Handler. +;- R8 is initialize in Cstartup +;- Called Functions : None only by FIQ +;------------------------------------------------------------------------------ +FIQ_Handler_Entry: + +;- Switch in SVC/User Mode to allow User Stack access for C code +; because the FIQ is not yet acknowledged + +;- Save and r0 in FIQ_Register + mov r9,r0 + ldr r0 , [r8, #AIC_FVR] + msr CPSR_c,#I_BIT | F_BIT | SVC_MODE +;- Save scratch/used registers and LR in User Stack + stmfd sp!, { r1-r3, r12, lr} + +;- Branch to the routine pointed by the AIC_FVR + mov r14, pc + bx r0 + +;- Restore scratch/used registers and LR from User Stack + ldmia sp!, { r1-r3, r12, lr} + +;- Leave Interrupts disabled and switch back in FIQ mode + msr CPSR_c, #I_BIT | F_BIT | FIQ_MODE + +;- Restore the R0 ARM_MODE_SVC register + mov r0,r9 + +;- Restore the Program Counter using the LR_fiq directly in the PC + subs pc,lr,#4 +;------------------------------------------------------------------------------ +;- Function : IRQ_Handler_Entry +;- Treatments : IRQ Controller Interrupt Handler. +;- Called Functions : AIC_IVR[interrupt] +;------------------------------------------------------------------------------ +IRQ_Handler_Entry: +;------------------------- +;- Manage Exception Entry +;------------------------- +;- Adjust and save LR_irq in IRQ stack + sub lr, lr, #4 + stmfd sp!, {lr} + +;- Save r0 and SPSR (need to be saved for nested interrupt) + mrs r14, SPSR + stmfd sp!, {r0,r14} + +;- Write in the IVR to support Protect Mode +;- No effect in Normal Mode +;- De-assert the NIRQ and clear the source in Protect Mode + ldr r14, =AT91C_BASE_AIC + ldr r0 , [r14, #AIC_IVR] + str r14, [r14, #AIC_IVR] + +;- Enable Interrupt and Switch in Supervisor Mode + msr CPSR_c, #SVC_MODE + +;- Save scratch/used registers and LR in User Stack + stmfd sp!, { r1-r3, r12, r14} + +;---------------------------------------------- +;- Branch to the routine pointed by the AIC_IVR +;---------------------------------------------- + mov r14, pc + bx r0 + +;---------------------------------------------- +;- Manage Exception Exit +;---------------------------------------------- +;- Restore scratch/used registers and LR from User Stack + ldmia sp!, { r1-r3, r12, r14} + +;- Disable Interrupt and switch back in IRQ mode + msr CPSR_c, #I_BIT | IRQ_MODE + +;- Mark the End of Interrupt on the AIC + ldr r14, =AT91C_BASE_AIC + str r14, [r14, #AIC_EOICR] + +;- Restore SPSR_irq and r0 from IRQ stack + ldmia sp!, {r0,r14} + msr SPSR_cxsf, r14 + +;- Restore adjusted LR_irq from IRQ stack directly in the PC + ldmia sp!, {pc}^ + +;------------------------------------------------------------------------------ +;- Exception Vectors +;------------------------------------------------------------------------------ + PUBLIC AT91F_Default_FIQ_handler + PUBLIC AT91F_Default_IRQ_handler + PUBLIC AT91F_Spurious_handler + + ARM ; Always ARM mode after exeption + +AT91F_Default_FIQ_handler + b AT91F_Default_FIQ_handler + +AT91F_Default_IRQ_handler + b AT91F_Default_IRQ_handler + +AT91F_Spurious_handler + b AT91F_Spurious_handler + + +;------------------------------------------------------------------------------ +; ?INIT +; Program entry. +;------------------------------------------------------------------------------ + + SECTION FIQ_STACK:DATA:NOROOT(3) + SECTION IRQ_STACK:DATA:NOROOT(3) + SECTION SVC_STACK:DATA:NOROOT(3) + SECTION ABT_STACK:DATA:NOROOT(3) + SECTION UND_STACK:DATA:NOROOT(3) + SECTION CSTACK:DATA:NOROOT(3) + SECTION text:CODE:NOROOT(2) + REQUIRE __vector + EXTERN ?main + PUBLIC __iar_program_start + EXTERN AT91F_LowLevelInit + + +__iar_program_start: + +;------------------------------------------------------------------------------ +;- Low level Init is performed in a C function: AT91F_LowLevelInit +;- Init Stack Pointer to a valid memory area before calling AT91F_LowLevelInit +;------------------------------------------------------------------------------ + +;- Retrieve end of RAM address + + ldr r13,=TOP_OF_MEMORY ;- Temporary stack in internal RAM for Low Level Init execution + ldr r0,=AT91F_LowLevelInit + mov lr, pc + bx r0 ;- Branch on C function (with interworking) + +; Initialize the stack pointers. +; The pattern below can be used for any of the exception stacks: +; FIQ, IRQ, SVC, ABT, UND, SYS. +; The USR mode uses the same stack as SYS. +; The stack segments must be defined in the linker command file, +; and be declared above. + + mrs r0,cpsr ; Original PSR value + bic r0,r0,#MODE_BITS ; Clear the mode bits + orr r0,r0,#SVC_MODE ; Set SVC mode bits + msr cpsr_c,r0 ; Change the mode + ldr sp,=SFE(SVC_STACK) ; End of SVC_STACK + + bic r0,r0,#MODE_BITS ; Clear the mode bits + orr r0,r0,#UND_MODE ; Set UND mode bits + msr cpsr_c,r0 ; Change the mode + ldr sp,=SFE(UND_STACK) ; End of UND_STACK + + bic r0,r0,#MODE_BITS ; Clear the mode bits + orr r0,r0,#ABT_MODE ; Set ABT mode bits + msr cpsr_c,r0 ; Change the mode + ldr sp,=SFE(ABT_STACK) ; End of ABT_STACK + + bic r0,r0,#MODE_BITS ; Clear the mode bits + orr r0,r0,#FIQ_MODE ; Set FIQ mode bits + msr cpsr_c,r0 ; Change the mode + ldr sp,=SFE(FIQ_STACK) ; End of FIQ_STACK + ;- Init the FIQ register + ldr r8, =AT91C_BASE_AIC + + bic r0,r0,#MODE_BITS ; Clear the mode bits + orr r0,r0,#IRQ_MODE ; Set IRQ mode bits + msr cpsr_c,r0 ; Change the mode + ldr sp,=SFE(IRQ_STACK) ; End of IRQ_STACK + + bic r0,r0,#MODE_BITS ; Clear the mode bits + orr r0,r0,#SYS_MODE ; Set System mode bits + msr cpsr_c,r0 ; Change the mode + ldr sp,=SFE(CSTACK) ; End of CSTACK + +#ifdef __ARMVFP__ +; Enable the VFP coprocessor. + mov r0, #0x40000000 ; Set EN bit in VFP + fmxr fpexc, r0 ; FPEXC, clear others. + +; Disable underflow exceptions by setting flush to zero mode. +; For full IEEE 754 underflow compliance this code should be removed +; and the appropriate exception handler installed. + mov r0, #0x01000000 ; Set FZ bit in VFP + fmxr fpscr, r0 ; FPSCR, clear others. +#endif + +; Add more initialization here + + +; Continue to ?main for more IAR specific system startup + + ldr r0,=?main + bx r0 + + END ;- Terminates the assembly of the last module in a file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/srcIAR/Cstartup_SAM7.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/srcIAR/Cstartup_SAM7.c new file mode 100644 index 0000000..a7c72b9 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/iar/iar_v5/srcIAR/Cstartup_SAM7.c @@ -0,0 +1,98 @@ +//----------------------------------------------------------------------------- +// ATMEL Microcontroller Software Support - ROUSSET - +//----------------------------------------------------------------------------- +// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +//----------------------------------------------------------------------------- +// File Name : Cstartup_SAM7.c +// Object : Low level initialisations written in C for Tools +// For AT91SAM7X256 with 2 flash plane +// Creation : JPP 14-Sep-2006 +//----------------------------------------------------------------------------- + +#include "project.h" + + +// The following functions must be write in ARM mode this function called +// directly by exception vector +extern void AT91F_Spurious_handler(void); +extern void AT91F_Default_IRQ_handler(void); +extern void AT91F_Default_FIQ_handler(void); + +//*---------------------------------------------------------------------------- +//* \fn AT91F_LowLevelInit +//* \brief This function performs very low level HW initialization +//* this function can use a Stack, depending the compilation +//* optimization mode +//*---------------------------------------------------------------------------- +void AT91F_LowLevelInit(void) @ "ICODE" +{ + unsigned char i; + /////////////////////////////////////////////////////////////////////////// + // EFC Init + /////////////////////////////////////////////////////////////////////////// + AT91C_BASE_MC->MC_FMR = AT91C_MC_FWS_1FWS ; + + /////////////////////////////////////////////////////////////////////////// + // Init PMC Step 1. Enable Main Oscillator + // Main Oscillator startup time is board specific: + // Main Oscillator Startup Time worst case (3MHz) corresponds to 15ms + // (0x40 for AT91C_CKGR_OSCOUNT field) + /////////////////////////////////////////////////////////////////////////// + AT91C_BASE_PMC->PMC_MOR = (( AT91C_CKGR_OSCOUNT & (0x40 <<8) | AT91C_CKGR_MOSCEN )); + // Wait Main Oscillator stabilization + while(!(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MOSCS)); + + /////////////////////////////////////////////////////////////////////////// + // Init PMC Step 2. + // Set PLL to 96MHz (96,109MHz) and UDP Clock to 48MHz + // PLL Startup time depends on PLL RC filter: worst case is choosen + // UDP Clock (48,058MHz) is compliant with the Universal Serial Bus + // Specification (+/- 0.25% for full speed) + /////////////////////////////////////////////////////////////////////////// + AT91C_BASE_PMC->PMC_PLLR = AT91C_CKGR_USBDIV_1 | + (16 << 8) | + (AT91C_CKGR_MUL & (72 << 16)) | + (AT91C_CKGR_DIV & 14); + // Wait for PLL stabilization + while( !(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_LOCK) ); + // Wait until the master clock is established for the case we already + // turn on the PLL + while( !(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MCKRDY) ); + + /////////////////////////////////////////////////////////////////////////// + // Init PMC Step 3. + // Selection of Master Clock MCK equal to (Processor Clock PCK) PLL/2=48MHz + // The PMC_MCKR register must not be programmed in a single write operation + // (see. Product Errata Sheet) + /////////////////////////////////////////////////////////////////////////// + AT91C_BASE_PMC->PMC_MCKR = AT91C_PMC_PRES_CLK_2; + // Wait until the master clock is established + while( !(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MCKRDY) ); + + AT91C_BASE_PMC->PMC_MCKR |= AT91C_PMC_CSS_PLL_CLK; + // Wait until the master clock is established + while( !(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MCKRDY) ); + + /////////////////////////////////////////////////////////////////////////// + // Disable Watchdog (write once register) + /////////////////////////////////////////////////////////////////////////// + AT91C_BASE_WDTC->WDTC_WDMR = AT91C_WDTC_WDDIS; + + /////////////////////////////////////////////////////////////////////////// + // Init AIC: assign corresponding handler for each interrupt source + /////////////////////////////////////////////////////////////////////////// + AT91C_BASE_AIC->AIC_SVR[0] = (int) AT91F_Default_FIQ_handler ; + for (i = 1; i < 31; i++) { + AT91C_BASE_AIC->AIC_SVR[i] = (int) AT91F_Default_IRQ_handler ; + } + AT91C_BASE_AIC->AIC_SPU = (unsigned int) AT91F_Spurious_handler; +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/lib/cmock.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/lib/cmock.rb new file mode 100644 index 0000000..e332351 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/lib/cmock.rb @@ -0,0 +1,65 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +[ "../config/production_environment", + "cmock_header_parser", + "cmock_generator", + "cmock_file_writer", + "cmock_config", + "cmock_plugin_manager", + "cmock_generator_utils", + "cmock_unityhelper_parser"].each {|req| require "#{File.expand_path(File.dirname(__FILE__))}/#{req}"} + +class CMock + + def initialize(options=nil) + cm_config = CMockConfig.new(options) + cm_unityhelper = CMockUnityHelperParser.new(cm_config) + cm_writer = CMockFileWriter.new(cm_config) + cm_gen_utils = CMockGeneratorUtils.new(cm_config, {:unity_helper => cm_unityhelper}) + cm_gen_plugins = CMockPluginManager.new(cm_config, cm_gen_utils) + @cm_parser = CMockHeaderParser.new(cm_config) + @cm_generator = CMockGenerator.new(cm_config, cm_writer, cm_gen_utils, cm_gen_plugins) + @silent = (cm_config.verbosity < 2) + end + + def setup_mocks(files) + [files].flatten.each do |src| + generate_mock src + end + end + + private ############################### + + def generate_mock(src) + name = File.basename(src, '.h') + puts "Creating mock for #{name}..." unless @silent + @cm_generator.create_mock(name, @cm_parser.parse(name, File.read(src))) + end +end + + # Command Line Support ############################### + +if ($0 == __FILE__) + usage = "usage: ruby #{__FILE__} (-oOptionsFile) File(s)ToMock" + + if (!ARGV[0]) + puts usage + exit 1 + end + + options = nil + filelist = [] + ARGV.each do |arg| + if (arg =~ /^-o(\w*)/) + options = arg.gsub(/^-o/,'') + else + filelist << arg + end + end + + CMock.new(options).setup_mocks(filelist) +end \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/lib/cmock_config.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/lib/cmock_config.rb new file mode 100644 index 0000000..d574a70 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/lib/cmock_config.rb @@ -0,0 +1,123 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +class CMockConfig + + CMockDefaultOptions = + { + :framework => :unity, + :mock_path => 'mocks', + :mock_prefix => 'Mock', + :plugins => [], + :strippables => ['(?:__attribute__\s*\(+.*?\)+)'], + :attributes => ['__ramfunc', '__irq', '__fiq', 'register', 'extern'], + :enforce_strict_ordering => false, + :unity_helper => false, + :treat_as => {}, + :treat_as_void => [], + :memcmp_if_unknown => true, + :when_no_prototypes => :warn, #the options being :ignore, :warn, or :error + :when_ptr => :compare_data, #the options being :compare_ptr, :compare_data, or :smart + :verbosity => 2, #the options being 0 errors only, 1 warnings and errors, 2 normal info, 3 verbose + :treat_externs => :exclude, #the options being :include or :exclude + :ignore => :args_and_calls, #the options being :args_and_calls or :args_only + :callback_include_count => true, + :callback_after_arg_check => false, + :includes => nil, + :includes_h_pre_orig_header => nil, + :includes_h_post_orig_header => nil, + :includes_c_pre_header => nil, + :includes_c_post_header => nil, + } + + def initialize(options=nil) + case(options) + when NilClass then options = CMockDefaultOptions.clone + when String then options = CMockDefaultOptions.clone.merge(load_config_file_from_yaml(options)) + when Hash then options = CMockDefaultOptions.clone.merge(options) + else raise "If you specify arguments, it should be a filename or a hash of options" + end + + #do some quick type verification + [:plugins, :attributes, :treat_as_void].each do |opt| + unless (options[opt].class == Array) + options[opt] = [] + puts "WARNING: :#{opt.to_s} should be an array." unless (options[:verbosity] < 1) + end + end + [:includes, :includes_h_pre_orig_header, :includes_h_post_orig_header, :includes_c_pre_header, :includes_c_post_header].each do |opt| + unless (options[opt].nil? or (options[opt].class == Array)) + options[opt] = [] + puts "WARNING: :#{opt.to_s} should be an array." unless (options[:verbosity] < 1) + end + end + options[:plugins].compact! + options[:plugins].map! {|p| p.to_sym} + @options = options + @options[:treat_as].merge!(standard_treat_as_map) + @options.each_key { |key| eval("def #{key.to_s}() return @options[:#{key.to_s}] end") } + end + + def load_config_file_from_yaml yaml_filename + require 'yaml' + require 'fileutils' + YAML.load_file(yaml_filename)[:cmock] + end + + def set_path(path) + @src_path = path + end + + def load_unity_helper + return File.new(@options[:unity_helper]).read if (@options[:unity_helper]) + return nil + end + + def standard_treat_as_map + { + 'int' => 'INT', + 'char' => 'INT8', + 'short' => 'INT16', + 'long' => 'INT', + 'int8' => 'INT8', + 'int16' => 'INT16', + 'int32' => 'INT', + 'int8_t' => 'INT8', + 'int16_t' => 'INT16', + 'int32_t' => 'INT', + 'INT8_T' => 'INT8', + 'INT16_T' => 'INT16', + 'INT32_T' => 'INT', + 'bool' => 'INT', + 'bool_t' => 'INT', + 'BOOL' => 'INT', + 'BOOL_T' => 'INT', + 'unsigned int' => 'HEX32', + 'unsigned long' => 'HEX32', + 'uint32' => 'HEX32', + 'uint32_t' => 'HEX32', + 'UINT32' => 'HEX32', + 'UINT32_T' => 'HEX32', + 'void*' => 'PTR', + 'unsigned short' => 'HEX16', + 'uint16' => 'HEX16', + 'uint16_t' => 'HEX16', + 'UINT16' => 'HEX16', + 'UINT16_T' => 'HEX16', + 'unsigned char' => 'HEX8', + 'uint8' => 'HEX8', + 'uint8_t' => 'HEX8', + 'UINT8' => 'HEX8', + 'UINT8_T' => 'HEX8', + 'char*' => 'STRING', + 'pCHAR' => 'STRING', + 'cstring' => 'STRING', + 'CSTRING' => 'STRING', + 'float' => 'FLOAT', + 'double' => 'FLOAT', + } + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/lib/cmock_file_writer.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/lib/cmock_file_writer.rb new file mode 100644 index 0000000..63faee5 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/lib/cmock_file_writer.rb @@ -0,0 +1,33 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +class CMockFileWriter + + attr_reader :config + + def initialize(config) + @config = config + end + + def create_file(filename) + raise "Where's the block of data to create?" unless block_given? + full_file_name_temp = "#{@config.mock_path}/#{filename}.new" + full_file_name_done = "#{@config.mock_path}/#{filename}" + File.open(full_file_name_temp, 'w') do |file| + yield(file, filename) + end + update_file(full_file_name_done, full_file_name_temp) + end + + private ################################### + + def update_file(dest, src) + require 'fileutils' + FileUtils.rm(dest) if (File.exist?(dest)) + FileUtils.cp(src, dest) + FileUtils.rm(src) + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/lib/cmock_generator.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/lib/cmock_generator.rb new file mode 100644 index 0000000..5f483ba --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/lib/cmock_generator.rb @@ -0,0 +1,196 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +$here = File.dirname __FILE__ + +class CMockGenerator + + attr_accessor :config, :file_writer, :module_name, :mock_name, :utils, :plugins, :ordered + + def initialize(config, file_writer, utils, plugins) + @file_writer = file_writer + @utils = utils + @plugins = plugins + @config = config + @prefix = @config.mock_prefix + @ordered = @config.enforce_strict_ordering + @framework = @config.framework.to_s + + @includes_h_pre_orig_header = (@config.includes || @config.includes_h_pre_orig_header || []).map{|h| h =~ /\n" + file << "#include \n" + file << "#include \n" + file << "#include \"#{@framework}.h\"\n" + file << "#include \"cmock.h\"\n" + @includes_c_pre_header.each {|inc| file << "#include #{inc}\n"} + file << "#include \"#{header_file}\"\n" + @includes_c_post_header.each {|inc| file << "#include #{inc}\n"} + file << "\n" + end + + def create_instance_structure(file, functions) + functions.each do |function| + file << "typedef struct _CMOCK_#{function[:name]}_CALL_INSTANCE\n{\n" + file << " UNITY_LINE_TYPE LineNumber;\n" + file << @plugins.run(:instance_typedefs, function) + file << "\n} CMOCK_#{function[:name]}_CALL_INSTANCE;\n\n" + end + file << "static struct #{@mock_name}Instance\n{\n" + if (functions.size == 0) + file << " unsigned char placeHolder;\n" + end + functions.each do |function| + file << @plugins.run(:instance_structure, function) + file << " CMOCK_MEM_INDEX_TYPE #{function[:name]}_CallInstance;\n" + end + file << "} Mock;\n\n" + end + + def create_extern_declarations(file) + file << "extern jmp_buf AbortFrame;\n" + if (@ordered) + file << "extern int GlobalExpectCount;\n" + file << "extern int GlobalVerifyOrder;\n" + end + file << "\n" + end + + def create_mock_verify_function(file, functions) + file << "void #{@mock_name}_Verify(void)\n{\n" + verifications = functions.collect {|function| @plugins.run(:mock_verify, function)}.join + file << " UNITY_LINE_TYPE cmock_line = TEST_LINE_NUM;\n" unless verifications.empty? + file << verifications + file << "}\n\n" + end + + def create_mock_init_function(file) + file << "void #{@mock_name}_Init(void)\n{\n" + file << " #{@mock_name}_Destroy();\n" + file << "}\n\n" + end + + def create_mock_destroy_function(file, functions) + file << "void #{@mock_name}_Destroy(void)\n{\n" + file << " CMock_Guts_MemFreeAll();\n" + file << " memset(&Mock, 0, sizeof(Mock));\n" + file << functions.collect {|function| @plugins.run(:mock_destroy, function)}.join + if (@ordered) + file << " GlobalExpectCount = 0;\n" + file << " GlobalVerifyOrder = 0;\n" + end + file << "}\n\n" + end + + def create_mock_implementation(file, function) + # prepare return value and arguments + if (function[:modifier].empty?) + function_mod_and_rettype = function[:return][:type] + else + function_mod_and_rettype = function[:modifier] + ' ' + function[:return][:type] + end + args_string = function[:args_string] + args_string += (", " + function[:var_arg]) unless (function[:var_arg].nil?) + + # Create mock function + file << "#{function_mod_and_rettype} #{function[:name]}(#{args_string})\n" + file << "{\n" + file << " UNITY_LINE_TYPE cmock_line = TEST_LINE_NUM;\n" + file << " CMOCK_#{function[:name]}_CALL_INSTANCE* cmock_call_instance = (CMOCK_#{function[:name]}_CALL_INSTANCE*)CMock_Guts_GetAddressFor(Mock.#{function[:name]}_CallInstance);\n" + file << " Mock.#{function[:name]}_CallInstance = CMock_Guts_MemNext(Mock.#{function[:name]}_CallInstance);\n" + file << @plugins.run(:mock_implementation_precheck, function) + file << " UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, \"Function '#{function[:name]}' called more times than expected.\");\n" + file << " cmock_line = cmock_call_instance->LineNumber;\n" + if (@ordered) + file << " if (cmock_call_instance->CallOrder > ++GlobalVerifyOrder)\n" + file << " UNITY_TEST_FAIL(cmock_line, \"Function '#{function[:name]}' called earlier than expected.\");" + file << " if (cmock_call_instance->CallOrder < GlobalVerifyOrder)\n" + file << " UNITY_TEST_FAIL(cmock_line, \"Function '#{function[:name]}' called later than expected.\");" + # file << " UNITY_TEST_ASSERT((cmock_call_instance->CallOrder == ++GlobalVerifyOrder), cmock_line, \"Out of order function calls. Function '#{function[:name]}'\");\n" + end + file << @plugins.run(:mock_implementation, function) + file << " return cmock_call_instance->ReturnVal;\n" unless (function[:return][:void?]) + file << "}\n\n" + end + + def create_mock_interfaces(file, function) + file << @utils.code_add_argument_loader(function) + file << @plugins.run(:mock_interfaces, function) + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_array.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_array.rb new file mode 100644 index 0000000..25045a2 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_array.rb @@ -0,0 +1,57 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +class CMockGeneratorPluginArray + + attr_reader :priority + attr_accessor :config, :utils, :unity_helper, :ordered + def initialize(config, utils) + @config = config + @ptr_handling = @config.when_ptr + @ordered = @config.enforce_strict_ordering + @utils = utils + @unity_helper = @utils.helpers[:unity_helper] + @priority = 8 + end + + def instance_typedefs(function) + function[:args].inject("") do |all, arg| + (arg[:ptr?]) ? all + " int Expected_#{arg[:name]}_Depth;\n" : all + end + end + + def mock_function_declarations(function) + return nil unless function[:contains_ptr?] + args_call = function[:args].map{|m| m[:ptr?] ? "#{m[:name]}, #{m[:name]}_Depth" : "#{m[:name]}"}.join(', ') + args_string = function[:args].map{|m| m[:ptr?] ? "#{m[:type]} #{m[:name]}, int #{m[:name]}_Depth" : "#{m[:type]} #{m[:name]}"}.join(', ') + if (function[:return][:void?]) + return "#define #{function[:name]}_ExpectWithArray(#{args_call}) #{function[:name]}_CMockExpectWithArray(__LINE__, #{args_call})\n" + + "void #{function[:name]}_CMockExpectWithArray(UNITY_LINE_TYPE cmock_line, #{args_string});\n" + else + return "#define #{function[:name]}_ExpectWithArrayAndReturn(#{args_call}, cmock_retval) #{function[:name]}_CMockExpectWithArrayAndReturn(__LINE__, #{args_call}, cmock_retval)\n" + + "void #{function[:name]}_CMockExpectWithArrayAndReturn(UNITY_LINE_TYPE cmock_line, #{args_string}, #{function[:return][:str]});\n" + end + end + + def mock_interfaces(function) + return nil unless function[:contains_ptr?] + lines = [] + func_name = function[:name] + args_string = function[:args].map{|m| m[:ptr?] ? "#{m[:type]} #{m[:name]}, int #{m[:name]}_Depth" : "#{m[:type]} #{m[:name]}"}.join(', ') + call_string = function[:args].map{|m| m[:ptr?] ? "#{m[:name]}, #{m[:name]}_Depth" : m[:name]}.join(', ') + if (function[:return][:void?]) + lines << "void #{func_name}_CMockExpectWithArray(UNITY_LINE_TYPE cmock_line, #{args_string})\n" + else + lines << "void #{func_name}_CMockExpectWithArrayAndReturn(UNITY_LINE_TYPE cmock_line, #{args_string}, #{function[:return][:str]})\n" + end + lines << "{\n" + lines << @utils.code_add_base_expectation(func_name) + lines << " CMockExpectParameters_#{func_name}(cmock_call_instance, #{call_string});\n" + lines << " cmock_call_instance->ReturnVal = cmock_to_return;\n" unless (function[:return][:void?]) + lines << "}\n\n" + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_callback.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_callback.rb new file mode 100644 index 0000000..0db9b36 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_callback.rb @@ -0,0 +1,78 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +class CMockGeneratorPluginCallback + + attr_accessor :include_count + attr_reader :priority + attr_reader :config, :utils + + def initialize(config, utils) + @config = config + @utils = utils + @priority = 6 + + @include_count = @config.callback_include_count + if (@config.callback_after_arg_check) + alias :mock_implementation :mock_implementation_for_callbacks + alias :mock_implementation_precheck :nothing + else + alias :mock_implementation_precheck :mock_implementation_for_callbacks + alias :mock_implementation :nothing + end + end + + def instance_structure(function) + func_name = function[:name] + " CMOCK_#{func_name}_CALLBACK #{func_name}_CallbackFunctionPointer;\n" + + " int #{func_name}_CallbackCalls;\n" + end + + def mock_function_declarations(function) + func_name = function[:name] + return_type = function[:return][:const?] ? "const #{function[:return][:type]}" : function[:return][:type] + style = (@include_count ? 1 : 0) | (function[:args].empty? ? 0 : 2) + styles = [ "void", "int cmock_num_calls", function[:args_string], "#{function[:args_string]}, int cmock_num_calls" ] + "typedef #{return_type} (* CMOCK_#{func_name}_CALLBACK)(#{styles[style]});\nvoid #{func_name}_StubWithCallback(CMOCK_#{func_name}_CALLBACK Callback);\n" + end + + def mock_implementation_for_callbacks(function) + func_name = function[:name] + style = (@include_count ? 1 : 0) | (function[:args].empty? ? 0 : 2) | (function[:return][:void?] ? 0 : 4) + " if (Mock.#{func_name}_CallbackFunctionPointer != NULL)\n {\n" + + case(style) + when 0 then " Mock.#{func_name}_CallbackFunctionPointer();\n return;\n }\n" + when 1 then " Mock.#{func_name}_CallbackFunctionPointer(Mock.#{func_name}_CallbackCalls++);\n return;\n }\n" + when 2 then " Mock.#{func_name}_CallbackFunctionPointer(#{function[:args].map{|m| m[:name]}.join(', ')});\n return;\n }\n" + when 3 then " Mock.#{func_name}_CallbackFunctionPointer(#{function[:args].map{|m| m[:name]}.join(', ')}, Mock.#{func_name}_CallbackCalls++);\n return;\n }\n" + when 4 then " return Mock.#{func_name}_CallbackFunctionPointer(void);\n }\n" + when 5 then " return Mock.#{func_name}_CallbackFunctionPointer(Mock.#{func_name}_CallbackCalls++);\n }\n" + when 6 then " return Mock.#{func_name}_CallbackFunctionPointer(#{function[:args].map{|m| m[:name]}.join(', ')});\n }\n" + when 7 then " return Mock.#{func_name}_CallbackFunctionPointer(#{function[:args].map{|m| m[:name]}.join(', ')}, Mock.#{func_name}_CallbackCalls++);\n }\n" + end + end + + def nothing(function) + return "" + end + + def mock_interfaces(function) + func_name = function[:name] + "void #{func_name}_StubWithCallback(CMOCK_#{func_name}_CALLBACK Callback)\n{\n" + + " Mock.#{func_name}_CallbackFunctionPointer = Callback;\n}\n\n" + end + + def mock_destroy(function) + " Mock.#{function[:name]}_CallbackFunctionPointer = NULL;\n" + + " Mock.#{function[:name]}_CallbackCalls = 0;\n" + end + + def mock_verify(function) + func_name = function[:name] + " if (Mock.#{func_name}_CallbackFunctionPointer != NULL)\n Mock.#{func_name}_CallInstance = CMOCK_GUTS_NONE;\n" + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_cexception.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_cexception.rb new file mode 100644 index 0000000..fdf31db --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_cexception.rb @@ -0,0 +1,51 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +class CMockGeneratorPluginCexception + + attr_reader :priority + attr_reader :config, :utils + + def initialize(config, utils) + @config = config + @utils = utils + @priority = 7 + end + + def include_files + return "#include \"CException.h\"\n" + end + + def instance_typedefs(function) + " CEXCEPTION_T ExceptionToThrow;\n" + end + + def mock_function_declarations(function) + if (function[:args_string] == "void") + return "#define #{function[:name]}_ExpectAndThrow(cmock_to_throw) #{function[:name]}_CMockExpectAndThrow(__LINE__, cmock_to_throw)\n" + + "void #{function[:name]}_CMockExpectAndThrow(UNITY_LINE_TYPE cmock_line, CEXCEPTION_T cmock_to_throw);\n" + else + return "#define #{function[:name]}_ExpectAndThrow(#{function[:args_call]}, cmock_to_throw) #{function[:name]}_CMockExpectAndThrow(__LINE__, #{function[:args_call]}, cmock_to_throw)\n" + + "void #{function[:name]}_CMockExpectAndThrow(UNITY_LINE_TYPE cmock_line, #{function[:args_string]}, CEXCEPTION_T cmock_to_throw);\n" + end + end + + def mock_implementation(function) + " if (cmock_call_instance->ExceptionToThrow != CEXCEPTION_NONE)\n {\n" + + " Throw(cmock_call_instance->ExceptionToThrow);\n }\n" + end + + def mock_interfaces(function) + arg_insert = (function[:args_string] == "void") ? "" : "#{function[:args_string]}, " + call_string = function[:args].map{|m| m[:name]}.join(', ') + [ "void #{function[:name]}_CMockExpectAndThrow(UNITY_LINE_TYPE cmock_line, #{arg_insert}CEXCEPTION_T cmock_to_throw)\n{\n", + @utils.code_add_base_expectation(function[:name]), + @utils.code_call_argument_loader(function), + " cmock_call_instance->ExceptionToThrow = cmock_to_throw;\n", + "}\n\n" ].join + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_expect.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_expect.rb new file mode 100644 index 0000000..5651cd9 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_expect.rb @@ -0,0 +1,86 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +class CMockGeneratorPluginExpect + + attr_reader :priority + attr_accessor :config, :utils, :unity_helper, :ordered + + def initialize(config, utils) + @config = config + @ptr_handling = @config.when_ptr + @ordered = @config.enforce_strict_ordering + @utils = utils + @unity_helper = @utils.helpers[:unity_helper] + @priority = 5 + end + + def instance_typedefs(function) + lines = "" + lines << " #{function[:return][:type]} ReturnVal;\n" unless (function[:return][:void?]) + lines << " int CallOrder;\n" if (@ordered) + function[:args].each do |arg| + lines << " #{arg[:type]} Expected_#{arg[:name]};\n" + end + lines + end + + def mock_function_declarations(function) + if (function[:args].empty?) + if (function[:return][:void?]) + return "#define #{function[:name]}_Expect() #{function[:name]}_CMockExpect(__LINE__)\n" + + "void #{function[:name]}_CMockExpect(UNITY_LINE_TYPE cmock_line);\n" + else + return "#define #{function[:name]}_ExpectAndReturn(cmock_retval) #{function[:name]}_CMockExpectAndReturn(__LINE__, cmock_retval)\n" + + "void #{function[:name]}_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, #{function[:return][:str]});\n" + end + else + if (function[:return][:void?]) + return "#define #{function[:name]}_Expect(#{function[:args_call]}) #{function[:name]}_CMockExpect(__LINE__, #{function[:args_call]})\n" + + "void #{function[:name]}_CMockExpect(UNITY_LINE_TYPE cmock_line, #{function[:args_string]});\n" + else + return "#define #{function[:name]}_ExpectAndReturn(#{function[:args_call]}, cmock_retval) #{function[:name]}_CMockExpectAndReturn(__LINE__, #{function[:args_call]}, cmock_retval)\n" + + "void #{function[:name]}_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, #{function[:args_string]}, #{function[:return][:str]});\n" + end + end + end + + def mock_implementation(function) + lines = "" + function[:args].each do |arg| + lines << @utils.code_verify_an_arg_expectation(function, arg) + end + lines + end + + def mock_interfaces(function) + lines = "" + func_name = function[:name] + if (function[:return][:void?]) + if (function[:args_string] == "void") + lines << "void #{func_name}_CMockExpect(UNITY_LINE_TYPE cmock_line)\n{\n" + else + lines << "void #{func_name}_CMockExpect(UNITY_LINE_TYPE cmock_line, #{function[:args_string]})\n{\n" + end + else + if (function[:args_string] == "void") + lines << "void #{func_name}_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, #{function[:return][:str]})\n{\n" + else + lines << "void #{func_name}_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, #{function[:args_string]}, #{function[:return][:str]})\n{\n" + end + end + lines << @utils.code_add_base_expectation(func_name) + lines << @utils.code_call_argument_loader(function) + lines << @utils.code_assign_argument_quickly("cmock_call_instance->ReturnVal", function[:return]) unless (function[:return][:void?]) + lines << "}\n\n" + end + + def mock_verify(function) + func_name = function[:name] + " UNITY_TEST_ASSERT(CMOCK_GUTS_NONE == Mock.#{func_name}_CallInstance, cmock_line, \"Function '#{func_name}' called less times than expected.\");\n" + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_ignore.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_ignore.rb new file mode 100644 index 0000000..a81933d --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_ignore.rb @@ -0,0 +1,85 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +class CMockGeneratorPluginIgnore + + attr_reader :priority + attr_reader :config, :utils + + def initialize(config, utils) + @config = config + if (@config.ignore == :args_and_calls) + alias :mock_implementation_precheck :mock_implementation_for_ignores + alias :mock_implementation :nothing + alias :mock_verify :mock_conditionally_verify_counts + else + alias :mock_implementation :mock_implementation_for_ignores + alias :mock_implementation_precheck :nothing + alias :mock_verify :nothing + end + @utils = utils + @priority = 2 + end + + def instance_structure(function) + if (function[:return][:void?]) + " int #{function[:name]}_IgnoreBool;\n" + else + " int #{function[:name]}_IgnoreBool;\n #{function[:return][:type]} #{function[:name]}_FinalReturn;\n" + end + end + + def mock_function_declarations(function) + if (function[:return][:void?]) + return "#define #{function[:name]}_Ignore() #{function[:name]}_CMockIgnore(__LINE__)\n" + + "void #{function[:name]}_CMockIgnore(UNITY_LINE_TYPE cmock_line);\n" + else + return "#define #{function[:name]}_IgnoreAndReturn(cmock_retval) #{function[:name]}_CMockIgnoreAndReturn(__LINE__, cmock_retval)\n" + + "void #{function[:name]}_CMockIgnoreAndReturn(UNITY_LINE_TYPE cmock_line, #{function[:return][:str]});\n" + end + end + + def mock_implementation_for_ignores(function) + lines = " if (Mock.#{function[:name]}_IgnoreBool)\n {\n" + if (function[:return][:void?]) + lines << " return;\n }\n" + else + retval = function[:return].merge( { :name => "cmock_call_instance->ReturnVal"} ) + lines << " if (cmock_call_instance == NULL)\n return Mock.#{function[:name]}_FinalReturn;\n" + lines << " " + @utils.code_assign_argument_quickly("Mock.#{function[:name]}_FinalReturn", retval) unless (retval[:void?]) + lines << " return cmock_call_instance->ReturnVal;\n }\n" + end + lines + end + + def mock_interfaces(function) + lines = "" + if (function[:return][:void?]) + lines << "void #{function[:name]}_CMockIgnore(UNITY_LINE_TYPE cmock_line)\n{\n" + else + lines << "void #{function[:name]}_CMockIgnoreAndReturn(UNITY_LINE_TYPE cmock_line, #{function[:return][:str]})\n{\n" + end + if (@config.ignore == :args_only) + lines << @utils.code_add_base_expectation(function[:name], true) + elsif (!function[:return][:void?]) + lines << @utils.code_add_base_expectation(function[:name], false) + end + unless (function[:return][:void?]) + lines << " cmock_call_instance->ReturnVal = cmock_to_return;\n" + end + lines << " Mock.#{function[:name]}_IgnoreBool = (int)1;\n" + lines << "}\n\n" + end + + def mock_conditionally_verify_counts(function) + func_name = function[:name] + " if (Mock.#{func_name}_IgnoreBool)\n Mock.#{func_name}_CallInstance = CMOCK_GUTS_NONE;\n" + end + + def nothing(function) + return "" + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/lib/cmock_generator_utils.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/lib/cmock_generator_utils.rb new file mode 100644 index 0000000..4444979 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/lib/cmock_generator_utils.rb @@ -0,0 +1,177 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +class CMockGeneratorUtils + + attr_accessor :config, :helpers, :ordered, :ptr_handling, :arrays, :cexception + + def initialize(config, helpers={}) + @config = config + @ptr_handling = @config.when_ptr + @ordered = @config.enforce_strict_ordering + @arrays = @config.plugins.include? :array + @cexception = @config.plugins.include? :cexception + @treat_as = @config.treat_as + @helpers = helpers + + if (@arrays) + case(@ptr_handling) + when :smart then alias :code_verify_an_arg_expectation :code_verify_an_arg_expectation_with_smart_arrays + when :compare_data then alias :code_verify_an_arg_expectation :code_verify_an_arg_expectation_with_normal_arrays + when :compare_ptr then raise "ERROR: the array plugin doesn't enjoy working with :compare_ptr only. Disable one option." + end + else + alias :code_verify_an_arg_expectation :code_verify_an_arg_expectation_with_no_arrays + end + end + + def code_add_base_expectation(func_name, global_ordering_supported=true) + lines = " CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_#{func_name}_CALL_INSTANCE));\n" + lines << " CMOCK_#{func_name}_CALL_INSTANCE* cmock_call_instance = (CMOCK_#{func_name}_CALL_INSTANCE*)CMock_Guts_GetAddressFor(cmock_guts_index);\n" + lines << " UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, \"CMock has run out of memory. Please allocate more.\");\n" + lines << " Mock.#{func_name}_CallInstance = CMock_Guts_MemChain(Mock.#{func_name}_CallInstance, cmock_guts_index);\n" + lines << " cmock_call_instance->LineNumber = cmock_line;\n" + lines << " cmock_call_instance->CallOrder = ++GlobalExpectCount;\n" if (@ordered and global_ordering_supported) + lines << " cmock_call_instance->ExceptionToThrow = CEXCEPTION_NONE;\n" if (@cexception) + lines + end + + def code_add_an_arg_expectation(arg, depth=1) + lines = code_assign_argument_quickly("cmock_call_instance->Expected_#{arg[:name]}", arg) + lines << " cmock_call_instance->Expected_#{arg[:name]}_Depth = #{arg[:name]}_Depth;\n" if (@arrays and (depth.class == String)) + lines + end + + def code_assign_argument_quickly(dest, arg) + if (arg[:ptr?] or @treat_as.include?(arg[:type])) + " #{dest} = #{arg[:const?] ? "(#{arg[:type]})" : ''}#{arg[:name]};\n" + else + " memcpy(&#{dest}, &#{arg[:name]}, sizeof(#{arg[:type]}));\n" + end + end + + def code_add_argument_loader(function) + if (function[:args_string] != "void") + if (@arrays) + args_string = function[:args].map do |m| + const_str = m[ :const? ] ? 'const ' : '' + m[:ptr?] ? "#{const_str}#{m[:type]} #{m[:name]}, int #{m[:name]}_Depth" : "#{const_str}#{m[:type]} #{m[:name]}" + end.join(', ') + "void CMockExpectParameters_#{function[:name]}(CMOCK_#{function[:name]}_CALL_INSTANCE* cmock_call_instance, #{args_string})\n{\n" + + function[:args].inject("") { |all, arg| all + code_add_an_arg_expectation(arg, (arg[:ptr?] ? "#{arg[:name]}_Depth" : 1) ) } + + "}\n\n" + else + "void CMockExpectParameters_#{function[:name]}(CMOCK_#{function[:name]}_CALL_INSTANCE* cmock_call_instance, #{function[:args_string]})\n{\n" + + function[:args].inject("") { |all, arg| all + code_add_an_arg_expectation(arg) } + + "}\n\n" + end + else + "" + end + end + + def code_call_argument_loader(function) + if (function[:args_string] != "void") + args = function[:args].map do |m| + (@arrays and m[:ptr?]) ? "#{m[:name]}, 1" : m[:name] + end + " CMockExpectParameters_#{function[:name]}(cmock_call_instance, #{args.join(', ')});\n" + else + "" + end + end + + #private ###################### + + def lookup_expect_type(function, arg) + c_type = arg[:type] + arg_name = arg[:name] + expected = "cmock_call_instance->Expected_#{arg_name}" + unity_func = if ((arg[:ptr?]) and ((c_type =~ /\*\*/) or (@ptr_handling == :compare_ptr))) + ['UNITY_TEST_ASSERT_EQUAL_PTR', ''] + else + (@helpers.nil? or @helpers[:unity_helper].nil?) ? ["UNITY_TEST_ASSERT_EQUAL",''] : @helpers[:unity_helper].get_helper(c_type) + end + unity_msg = "Function '#{function[:name]}' called with unexpected value for argument '#{arg_name}'." + return c_type, arg_name, expected, unity_func[0], unity_func[1], unity_msg + end + + def code_verify_an_arg_expectation_with_no_arrays(function, arg) + c_type, arg_name, expected, unity_func, pre, unity_msg = lookup_expect_type(function, arg) + case(unity_func) + when "UNITY_TEST_ASSERT_EQUAL_MEMORY" + c_type_local = c_type.gsub(/\*$/,'') + return " UNITY_TEST_ASSERT_EQUAL_MEMORY((void*)(#{pre}#{expected}), (void*)(#{pre}#{arg_name}), sizeof(#{c_type_local}), cmock_line, \"#{unity_msg}\");\n" + when "UNITY_TEST_ASSERT_EQUAL_MEMORY" + [ " if (#{pre}#{expected} == NULL)", + " { UNITY_TEST_ASSERT_NULL(#{pre}#{arg_name}, cmock_line, \"Expected NULL. #{unity_msg}\"); }", + " else", + " { UNITY_TEST_ASSERT_EQUAL_MEMORY((void*)(#{pre}#{expected}), (void*)(#{pre}#{arg_name}), sizeof(#{c_type.sub('*','')}), cmock_line, \"#{unity_msg}\"); }\n"].join("\n") + when /_ARRAY/ + [ " if (#{pre}#{expected} == NULL)", + " { UNITY_TEST_ASSERT_NULL(#{pre}#{arg_name}, cmock_line, \"Expected NULL. #{unity_msg}\"); }", + " else", + " { #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, 1, cmock_line, \"#{unity_msg}\"); }\n"].join("\n") + else + return " #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, cmock_line, \"#{unity_msg}\");\n" + end + end + + def code_verify_an_arg_expectation_with_normal_arrays(function, arg) + c_type, arg_name, expected, unity_func, pre, unity_msg = lookup_expect_type(function, arg) + depth_name = (arg[:ptr?]) ? "cmock_call_instance->Expected_#{arg_name}_Depth" : 1 + case(unity_func) + when "UNITY_TEST_ASSERT_EQUAL_MEMORY" + c_type_local = c_type.gsub(/\*$/,'') + return " UNITY_TEST_ASSERT_EQUAL_MEMORY((void*)(#{pre}#{expected}), (void*)(#{pre}#{arg_name}), sizeof(#{c_type_local}), cmock_line, \"#{unity_msg}\");\n" + when "UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY" + [ " if (#{pre}#{expected} == NULL)", + " { UNITY_TEST_ASSERT_NULL(#{pre}#{arg_name}, cmock_line, \"Expected NULL. #{unity_msg}\"); }", + " else", + " { UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY((void*)(#{pre}#{expected}), (void*)(#{pre}#{arg_name}), sizeof(#{c_type.sub('*','')}), #{depth_name}, cmock_line, \"#{unity_msg}\"); }\n"].compact.join("\n") + when /_ARRAY/ + if (pre == '&') + " #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, #{depth_name}, cmock_line, \"#{unity_msg}\");\n" + else + [ " if (#{pre}#{expected} == NULL)", + " { UNITY_TEST_ASSERT_NULL(#{pre}#{arg_name}, cmock_line, \"Expected NULL. #{unity_msg}\"); }", + " else", + " { #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, #{depth_name}, cmock_line, \"#{unity_msg}\"); }\n"].compact.join("\n") + end + else + return " #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, cmock_line, \"#{unity_msg}\");\n" + end + end + + def code_verify_an_arg_expectation_with_smart_arrays(function, arg) + c_type, arg_name, expected, unity_func, pre, unity_msg = lookup_expect_type(function, arg) + depth_name = (arg[:ptr?]) ? "cmock_call_instance->Expected_#{arg_name}_Depth" : 1 + case(unity_func) + when "UNITY_TEST_ASSERT_EQUAL_MEMORY" + c_type_local = c_type.gsub(/\*$/,'') + return " UNITY_TEST_ASSERT_EQUAL_MEMORY((void*)(#{pre}#{expected}), (void*)(#{pre}#{arg_name}), sizeof(#{c_type_local}), cmock_line, \"#{unity_msg}\");\n" + when "UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY" + [ " if (#{pre}#{expected} == NULL)", + " { UNITY_TEST_ASSERT_NULL(#{arg_name}, cmock_line, \"Expected NULL. #{unity_msg}\"); }", + ((depth_name != 1) ? " else if (#{depth_name} == 0)\n { UNITY_TEST_ASSERT_EQUAL_PTR(#{pre}#{expected}, #{pre}#{arg_name}, cmock_line, \"#{unity_msg}\"); }" : nil), + " else", + " { UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY((void*)(#{pre}#{expected}), (void*)(#{pre}#{arg_name}), sizeof(#{c_type.sub('*','')}), #{depth_name}, cmock_line, \"#{unity_msg}\"); }\n"].compact.join("\n") + when /_ARRAY/ + if (pre == '&') + " #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, #{depth_name}, cmock_line, \"#{unity_msg}\");\n" + else + [ " if (#{pre}#{expected} == NULL)", + " { UNITY_TEST_ASSERT_NULL(#{pre}#{arg_name}, cmock_line, \"Expected NULL. #{unity_msg}\"); }", + ((depth_name != 1) ? " else if (#{depth_name} == 0)\n { UNITY_TEST_ASSERT_EQUAL_PTR(#{pre}#{expected}, #{pre}#{arg_name}, cmock_line, \"#{unity_msg}\"); }" : nil), + " else", + " { #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, #{depth_name}, cmock_line, \"#{unity_msg}\"); }\n"].compact.join("\n") + end + else + return " #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, cmock_line, \"#{unity_msg}\");\n" + end + end + +end \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/lib/cmock_header_parser.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/lib/cmock_header_parser.rb new file mode 100644 index 0000000..4ea9966 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/lib/cmock_header_parser.rb @@ -0,0 +1,270 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +class CMockHeaderParser + + attr_accessor :funcs, :c_attributes, :treat_as_void, :treat_externs + + def initialize(cfg) + @funcs = [] + @c_strippables = cfg.strippables + @c_attributes = (['const'] + cfg.attributes).uniq + @treat_as_void = (['void'] + cfg.treat_as_void).uniq + @declaration_parse_matcher = /([\d\w\s\*\(\),\[\]]+??)\(([\d\w\s\*\(\),\.\[\]+-]*)\)$/m + @standards = (['int','short','char','long','unsigned','signed'] + cfg.treat_as.keys).uniq + @when_no_prototypes = cfg.when_no_prototypes + @local_as_void = @treat_as_void + @verbosity = cfg.verbosity + @treat_externs = cfg.treat_externs + @c_strippables += ['extern'] if (@treat_externs == :include) #we'll need to remove the attribute if we're allowing externs + end + + def parse(name, source) + @module_name = name + @typedefs = [] + @funcs = [] + function_names = [] + + parse_functions( import_source(source) ).map do |decl| + func = parse_declaration(decl) + unless (function_names.include? func[:name]) + @funcs << func + function_names << func[:name] + end + end + + { :includes => nil, + :functions => @funcs, + :typedefs => @typedefs + } + end + + private if $ThisIsOnlyATest.nil? ################ + + def import_source(source) + + # void must be void for cmock _ExpectAndReturn calls to process properly, not some weird typedef which equates to void + # to a certain extent, this action assumes we're chewing on pre-processed header files, otherwise we'll most likely just get stuff from @treat_as_void + @local_as_void = @treat_as_void + void_types = source.scan(/typedef\s+(?:\(\s*)?void(?:\s*\))?\s+([\w\d]+)\s*;/) + if void_types + @local_as_void += void_types.flatten.uniq.compact + end + + # smush multiline macros into single line (checking for continuation character at end of line '\') + source.gsub!(/\s*\\\s*/m, ' ') + + #remove comments (block and line, in three steps to ensure correct precedence) + source.gsub!(/\/\/(?:.+\/\*|\*(?:$|[^\/])).*$/, '') # remove line comments that comment out the start of blocks + source.gsub!(/\/\*.*?\*\//m, '') # remove block comments + source.gsub!(/\/\/.*$/, '') # remove line comments (all that remain) + + # remove assembler pragma sections + source.gsub!(/^\s*#\s*pragma\s+asm\s+.*?#\s*pragma\s+endasm/m, '') + + # remove preprocessor statements and extern "C" + source.gsub!(/^\s*#.*/, '') + source.gsub!(/extern\s+\"C\"\s+\{/, '') + + # enums, unions, structs, and typedefs can all contain things (e.g. function pointers) that parse like function prototypes, so yank them + # forward declared structs are removed before struct definitions so they don't mess up real thing later. we leave structs keywords in function prototypes + source.gsub!(/^[\w\s]*struct[^;\{\}\(\)]+;/m, '') # remove forward declared structs + source.gsub!(/^[\w\s]*(enum|union|struct|typepdef)[\w\s]*\{[^\}]+\}[\w\s\*\,]*;/m, '') # remove struct, union, and enum definitions and typedefs with braces + source.gsub!(/(\W)(?:register|auto|static|restrict)(\W)/, '\1\2') # remove problem keywords + source.gsub!(/\s*=\s*['"a-zA-Z0-9_\.]+\s*/, '') # remove default value statements from argument lists + source.gsub!(/^(?:[\w\s]*\W)?typedef\W.*/, '') # remove typedef statements + source.gsub!(/(^|\W+)(?:#{@c_strippables.join('|')})(?=$|\W+)/,'\1') unless @c_strippables.empty? # remove known attributes slated to be stripped + + #scan for functions which return function pointers, because they are a pain + source.gsub!(/([\w\s\*]+)\(*\(\s*\*([\w\s\*]+)\s*\(([\w\s\*,]*)\)\)\s*\(([\w\s\*,]*)\)\)*/) do |m| + functype = "cmock_#{@module_name}_func_ptr#{@typedefs.size + 1}" + @typedefs << "typedef #{$1.strip}(*#{functype})(#{$4});" + "#{functype} #{$2.strip}(#{$3});" + end + + #drop extra white space to make the rest go faster + source.gsub!(/^\s+/, '') # remove extra white space from beginning of line + source.gsub!(/\s+$/, '') # remove extra white space from end of line + source.gsub!(/\s*\(\s*/, '(') # remove extra white space from before left parens + source.gsub!(/\s*\)\s*/, ')') # remove extra white space from before right parens + source.gsub!(/\s+/, ' ') # remove remaining extra white space + + #split lines on semicolons and remove things that are obviously not what we are looking for + src_lines = source.split(/\s*;\s*/) + src_lines.delete_if {|line| line.strip.length == 0} # remove blank lines + src_lines.delete_if {|line| !(line =~ /\(\s*\*(?:.*\[\d*\])??\s*\)/).nil?} #remove function pointer arrays + if (@treat_externs == :include) + src_lines.delete_if {|line| !(line =~ /(?:^|\s+)(?:inline)\s+/).nil?} #remove inline functions + else + src_lines.delete_if {|line| !(line =~ /(?:^|\s+)(?:extern|inline)\s+/).nil?} #remove inline and extern functions + end + end + + def parse_functions(source) + funcs = [] + source.each {|line| funcs << line.strip.gsub(/\s+/, ' ') if (line =~ @declaration_parse_matcher)} + if funcs.empty? + case @when_no_prototypes + when :error + raise "ERROR: No function prototypes found!" + when :warn + puts "WARNING: No function prototypes found!" unless (@verbosity < 1) + end + end + return funcs + end + + def parse_args(arg_list) + args = [] + arg_list.split(',').each do |arg| + arg.strip! + return args if (arg =~ /^\s*((\.\.\.)|(void))\s*$/) # we're done if we reach void by itself or ... + arg_array = arg.split + arg_elements = arg_array - @c_attributes # split up words and remove known attributes + args << { :type => (arg_type =arg_elements[0..-2].join(' ')), + :name => arg_elements[-1], + :ptr? => divine_ptr(arg_type), + :const? => arg_array.include?('const') + } + end + return args + end + + def divine_ptr(arg_type) + return false unless arg_type.include? '*' + return false if arg_type.gsub(/(const|char|\*|\s)+/,'').empty? + return true + end + + def clean_args(arg_list) + if ((@local_as_void.include?(arg_list.strip)) or (arg_list.empty?)) + return 'void' + else + c=0 + arg_list.gsub!(/(\w+)(?:\s*\[[\s\d\w+-]*\])+/,'*\1') # magically turn brackets into asterisks + arg_list.gsub!(/\s+\*/,'*') # remove space to place asterisks with type (where they belong) + arg_list.gsub!(/\*(\w)/,'* \1') # pull asterisks away from arg to place asterisks with type (where they belong) + + #scan argument list for function pointers and replace them with custom types + arg_list.gsub!(/([\w\s]+)\(*\(\s*\*([\w\s\*]+)\)\s*\(([\w\s\*,]*)\)\)*/) do |m| + functype = "cmock_#{@module_name}_func_ptr#{@typedefs.size + 1}" + funcret = $1.strip + funcname = $2.strip + funcargs = $3.strip + funconst = '' + if (funcname.include? 'const') + funcname.gsub!('const','').strip! + funconst = 'const ' + end + @typedefs << "typedef #{funcret}(*#{functype})(#{funcargs});" + funcname = "cmock_arg#{c+=1}" if (funcname.empty?) + "#{functype} #{funconst}#{funcname}" + end + + #automatically name unnamed arguments (those that only had a type) + arg_list.split(/\s*,\s*/).map { |arg| + parts = (arg.split - ['struct', 'union', 'enum', 'const', 'const*']) + if ((parts.size < 2) or (parts[-1][-1].chr == '*') or (@standards.include?(parts[-1]))) + "#{arg} cmock_arg#{c+=1}" + else + arg + end + }.join(', ') + end + end + + def parse_declaration(declaration) + decl = {} + + regex_match = @declaration_parse_matcher.match(declaration) + raise "Failed parsing function declaration: '#{declaration}'" if regex_match.nil? + + #grab argument list + args = regex_match[2].strip + + #process function attributes, return type, and name + descriptors = regex_match[1] + descriptors.gsub!(/\s+\*/,'*') #remove space to place asterisks with return type (where they belong) + descriptors.gsub!(/\*(\w)/,'* \1') #pull asterisks away from function name to place asterisks with return type (where they belong) + descriptors = descriptors.split #array of all descriptor strings + + #grab name + decl[:name] = descriptors[-1] #snag name as last array item + + #build attribute and return type strings + decl[:modifier] = [] + rettype = [] + descriptors[0..-2].each do |word| + if @c_attributes.include?(word) + decl[:modifier] << word + else + rettype << word + end + end + decl[:modifier] = decl[:modifier].join(' ') + rettype = rettype.join(' ') + rettype = 'void' if (@local_as_void.include?(rettype.strip)) + decl[:return] = { :type => rettype, + :name => 'cmock_to_return', + :ptr? => divine_ptr(rettype), + :const? => rettype.split(/\s/).include?('const'), + :str => "#{rettype} cmock_to_return", + :void? => (rettype == 'void') + } + + #remove default argument statements from mock definitions + args.gsub!(/=\s*[a-zA-Z0-9_\.]+\s*/, ' ') + + #check for var args + if (args =~ /\.\.\./) + decl[:var_arg] = args.match( /[\w\s]*\.\.\./ ).to_s.strip + if (args =~ /\,[\w\s]*\.\.\./) + args = args.gsub!(/\,[\w\s]*\.\.\./,'') + else + args = 'void' + end + else + decl[:var_arg] = nil + end + args = clean_args(args) + decl[:args_string] = args + decl[:args] = parse_args(args) + decl[:args_call] = decl[:args].map{|a| a[:name]}.join(', ') + decl[:contains_ptr?] = decl[:args].inject(false) {|ptr, arg| arg[:ptr?] ? true : ptr } + + if (decl[:return][:type].nil? or decl[:name].nil? or decl[:args].nil? or + decl[:return][:type].empty? or decl[:name].empty?) + raise "Failed Parsing Declaration Prototype!\n" + + " declaration: '#{declaration}'\n" + + " modifier: '#{decl[:modifier]}'\n" + + " return: #{prototype_inspect_hash(decl[:return])}\n" + + " function: '#{decl[:name]}'\n" + + " args: #{prototype_inspect_array_of_hashes(decl[:args])}\n" + end + + return decl + end + + def prototype_inspect_hash(hash) + pairs = [] + hash.each_pair { |name, value| pairs << ":#{name} => #{"'" if (value.class == String)}#{value}#{"'" if (value.class == String)}" } + return "{#{pairs.join(', ')}}" + end + + def prototype_inspect_array_of_hashes(array) + hashes = [] + array.each { |hash| hashes << prototype_inspect_hash(hash) } + case (array.size) + when 0 + return "[]" + when 1 + return "[#{hashes[0]}]" + else + return "[\n #{hashes.join("\n ")}\n ]\n" + end + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/lib/cmock_plugin_manager.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/lib/cmock_plugin_manager.rb new file mode 100644 index 0000000..eb8f9e8 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/lib/cmock_plugin_manager.rb @@ -0,0 +1,40 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +class CMockPluginManager + + attr_accessor :plugins + + def initialize(config, utils) + @plugins = [] + plugins_to_load = [:expect, config.plugins].flatten.uniq.compact + plugins_to_load.each do |plugin| + plugin_name = plugin.to_s + object_name = "CMockGeneratorPlugin" + camelize(plugin_name) + begin + unless (Object.const_defined? object_name) + require "#{File.expand_path(File.dirname(__FILE__))}/cmock_generator_plugin_#{plugin_name.downcase}.rb" + end + @plugins << eval("#{object_name}.new(config, utils)") + rescue + raise "ERROR: CMock unable to load plugin '#{plugin_name}'" + end + end + @plugins.sort! {|a,b| a.priority <=> b.priority } + end + + def run(method, args=nil) + if args.nil? + return @plugins.collect{ |plugin| plugin.send(method) if plugin.respond_to?(method) }.flatten.join + else + return @plugins.collect{ |plugin| plugin.send(method, args) if plugin.respond_to?(method) }.flatten.join + end + end + + def camelize(lower_case_and_underscored_word) + lower_case_and_underscored_word.gsub(/\/(.?)/) { "::" + $1.upcase }.gsub(/(^|_)(.)/) { $2.upcase } + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/lib/cmock_unityhelper_parser.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/lib/cmock_unityhelper_parser.rb new file mode 100644 index 0000000..3ddffb3 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/lib/cmock_unityhelper_parser.rb @@ -0,0 +1,74 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +class CMockUnityHelperParser + + attr_accessor :c_types + + def initialize(config) + @config = config + @fallback = @config.plugins.include?(:array) ? 'UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY' : 'UNITY_TEST_ASSERT_EQUAL_MEMORY' + @c_types = map_C_types.merge(import_source) + end + + def get_helper(ctype) + lookup = ctype.gsub(/(?:^|(\S?)(\s*)|(\W))const(?:$|(\s*)(\S)|(\W))/,'\1\3\5\6').strip.gsub(/\s+/,'_') + return [@c_types[lookup], ''] if (@c_types[lookup]) + if (lookup =~ /\*$/) + lookup = lookup.gsub(/\*$/,'') + return [@c_types[lookup], '*'] if (@c_types[lookup]) + else + lookup = lookup + '*' + return [@c_types[lookup], '&'] if (@c_types[lookup]) + end + return ['UNITY_TEST_ASSERT_EQUAL_PTR', ''] if (ctype =~ /cmock_\w+_ptr\d+/) + raise("Don't know how to test #{ctype} and memory tests are disabled!") unless @config.memcmp_if_unknown + return (lookup =~ /\*$/) ? [@fallback, '&'] : [@fallback, ''] + end + + private ########################### + + def map_C_types + c_types = {} + @config.treat_as.each_pair do |ctype, expecttype| + if (expecttype =~ /\*/) + c_types[ctype.gsub(/\s+/,'_')] = "UNITY_TEST_ASSERT_EQUAL_#{expecttype.gsub(/\*/,'')}_ARRAY" + else + c_types[ctype.gsub(/\s+/,'_')] = "UNITY_TEST_ASSERT_EQUAL_#{expecttype}" + c_types[ctype.gsub(/\s+/,'_')+'*'] = "UNITY_TEST_ASSERT_EQUAL_#{expecttype}_ARRAY" + end + end + c_types + end + + def import_source + source = @config.load_unity_helper + return {} if source.nil? + c_types = {} + source = source.gsub(/\/\/.*$/, '') #remove line comments + source = source.gsub(/\/\*.*?\*\//m, '') #remove block comments + + #scan for comparison helpers + match_regex = Regexp.new('^\s*#define\s+(UNITY_TEST_ASSERT_EQUAL_(\w+))\s*\(' + Array.new(4,'\s*\w+\s*').join(',') + '\)') + pairs = source.scan(match_regex).flatten.compact + (pairs.size/2).times do |i| + expect = pairs[i*2] + ctype = pairs[(i*2)+1] + c_types[ctype] = expect unless expect.include?("_ARRAY") + end + + #scan for array variants of those helpers + match_regex = Regexp.new('^\s*#define\s+(UNITY_TEST_ASSERT_EQUAL_(\w+_ARRAY))\s*\(' + Array.new(5,'\s*\w+\s*').join(',') + '\)') + pairs = source.scan(match_regex).flatten.compact + (pairs.size/2).times do |i| + expect = pairs[i*2] + ctype = pairs[(i*2)+1] + c_types[ctype.gsub('_ARRAY','*')] = expect + end + + c_types + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/rakefile.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/rakefile.rb new file mode 100644 index 0000000..1ea3ef2 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/rakefile.rb @@ -0,0 +1,89 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require './config/test_environment' +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require './rakefile_helper' + +include RakefileHelpers + +DEFAULT_CONFIG_FILE = 'gcc.yml' + +configure_clean +configure_toolchain(DEFAULT_CONFIG_FILE) + +task :default => ['test:all'] +task :cruise => [:no_color, :default] + +desc "Load configuration" +task :config, :config_file do |t, args| + args = {:config_file => DEFAULT_CONFIG_FILE} if args[:config_file].nil? + args = {:config_file => args[:config_file] + '.yml'} unless args[:config_file] =~ /\.yml$/i + configure_toolchain(args[:config_file]) +end + +namespace :test do + desc "Run all unit and system tests" + task :all => [:clobber, 'test:units', 'test:c', 'test:system'] + + desc "Run Unit Tests" + Rake::TestTask.new('units') do |t| + t.pattern = 'test/unit/*_test.rb' + t.verbose = true + end + + #individual unit tests + FileList['test/unit/*_test.rb'].each do |test| + Rake::TestTask.new(File.basename(test,'.*')) do |t| + t.pattern = test + t.verbose = true + end + end + + desc "Run C Unit Tests" + task :c do + build_and_test_c_files + end + + desc "Run System Tests" + task :system => [:clobber] do + #get a list of all system tests, removing unsupported tests for this compiler + sys_unsupported = $cfg['unsupported'].map {|a| 'test/system/test_interactions/'+a+'.yml'} + sys_tests_to_run = FileList['test/system/test_interactions/*.yml'] - sys_unsupported + compile_unsupported = $cfg['unsupported'].map {|a| SYSTEST_COMPILE_MOCKABLES_PATH+a+'.h'} + compile_tests_to_run = FileList[SYSTEST_COMPILE_MOCKABLES_PATH + '*.h'] - compile_unsupported + unless (sys_unsupported.empty? and compile_unsupported.empty?) + report "\nIgnoring these system tests..." + sys_unsupported.each {|a| report a} + compile_unsupported.each {|a| report a} + end + report "\nRunning system tests..." + tests_failed = run_system_test_interactions(sys_tests_to_run) + raise "System tests failed." if (tests_failed > 0) + + run_system_test_compilations(compile_tests_to_run) + end + + #individual system tests + FileList['test/system/test_interactions/*.yml'].each do |test| + desc "Run system test #{File.basename(test,'.*')}" + task "test:#{File.basename(test,'.*')}" do + run_system_test_interactions([test]) + end + end + + desc "Profile Mock Generation" + task :profile => [:clobber] do + run_system_test_profiles(FileList[SYSTEST_COMPILE_MOCKABLES_PATH + '*.h']) + end +end + +task :no_color do + $colour_output = false +end + \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/rakefile_helper.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/rakefile_helper.rb new file mode 100644 index 0000000..c7103b7 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/rakefile_helper.rb @@ -0,0 +1,383 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require 'yaml' +require 'fileutils' +require './vendor/unity/auto/generate_test_runner' +require './vendor/unity/auto/unity_test_summary' +require './test/system/systest_generator' +require './vendor/unity/auto/colour_reporter.rb' + +module RakefileHelpers + + SYSTEST_GENERATED_FILES_PATH = 'test/system/generated/' + SYSTEST_BUILD_FILES_PATH = 'test/system/build/' + SYSTEST_COMPILE_MOCKABLES_PATH = 'test/system/test_compilation/' + C_EXTENSION = '.c' + RESULT_EXTENSION = '.result' + + def load_configuration(config_file) + $cfg_file = config_file + $cfg = YAML.load(File.read('./targets/' + $cfg_file)) + $colour_output = false unless $cfg['colour'] + end + + def configure_clean + CLEAN.include(SYSTEST_GENERATED_FILES_PATH + '*.*') + CLEAN.include(SYSTEST_BUILD_FILES_PATH + '*.*') + end + + def configure_toolchain(config_file) + load_configuration(config_file) + configure_clean + end + + def get_local_include_dirs + include_dirs = $cfg['compiler']['includes']['items'].dup + include_dirs.delete_if {|dir| dir.is_a?(Array)} + return include_dirs + end + + def extract_headers(filename) + includes = [] + lines = File.readlines(filename) + lines.each do |line| + m = line.match(/^\s*#include\s+\"\s*(.+\.[hH])\s*\"/) + if not m.nil? + includes << m[1] + end + end + return includes + end + + def find_source_file(header, paths) + paths.each do |dir| + src_file = dir + header.ext(C_EXTENSION) + if (File.exists?(src_file)) + return src_file + end + end + return nil + end + + def squash(prefix, items) + result = '' + items.each { |item| result += " #{prefix}#{tackit(item)}" } + return result + end + + def build_compiler_fields + command = tackit($cfg['compiler']['path']) + if $cfg['compiler']['defines']['items'].nil? + defines = '' + else + defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items']) + end + options = squash('', $cfg['compiler']['options']) + includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :defines => defines, :options => options, :includes => includes} + end + + def compile(file, defines=[]) + compiler = build_compiler_fields + cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{defines.inject(''){|all, a| ' -D'+a+all }}#{compiler[:options]}#{compiler[:includes]} #{file} " + + "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" + + "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" + execute(cmd_str) + end + + def build_linker_fields + command = tackit($cfg['linker']['path']) + if $cfg['linker']['options'].nil? + options = '' + else + options = squash('', $cfg['linker']['options']) + end + if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?) + includes = '' + else + includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) + end + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :options => options, :includes => includes} + end + + def link(exe_name, obj_list) + linker = build_linker_fields + cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + + (obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).uniq.join + + $cfg['linker']['bin_files']['prefix'] + ' ' + + $cfg['linker']['bin_files']['destination'] + + exe_name + $cfg['linker']['bin_files']['extension'] + execute(cmd_str) + end + + def build_simulator_fields + return nil if $cfg['simulator'].nil? + if $cfg['simulator']['path'].nil? + command = '' + else + command = (tackit($cfg['simulator']['path']) + ' ') + end + if $cfg['simulator']['pre_support'].nil? + pre_support = '' + else + pre_support = squash('', $cfg['simulator']['pre_support']) + end + if $cfg['simulator']['post_support'].nil? + post_support = '' + else + post_support = squash('', $cfg['simulator']['post_support']) + end + return {:command => command, :pre_support => pre_support, :post_support => post_support} + end + + def execute(command_string, verbose=true, raise_on_failure=true) + #report command_string + output = `#{command_string}`.chomp + report(output) if (verbose && !output.nil? && (output.length > 0)) + if ($?.exitstatus != 0) and (raise_on_failure) + raise "#{command_string} failed. (Returned #{$?.exitstatus})" + end + return output + end + + def tackit(strings) + case(strings) + when Array + "\"#{strings.join}\"" + when /^-/ + strings + when /\s/ + "\"#{strings}\"" + else + strings + end + end + + def report_summary + summary = UnityTestSummary.new + summary.set_root_path(File.expand_path(File.dirname(__FILE__)) + '/') + results_glob = "#{$cfg['compiler']['build_path']}*.test*" + results_glob.gsub!(/\\/, '/') + results = Dir[results_glob] + summary.set_targets(results) + summary.run + fail_out "FAIL: There were failures" if (summary.failures > 0) + end + + def run_system_test_interactions(test_case_files) + load './lib/cmock.rb' + + SystemTestGenerator.new.generate_files(test_case_files) + test_files = FileList.new(SYSTEST_GENERATED_FILES_PATH + 'test*.c') + + load_configuration($cfg_file) + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + + include_dirs = get_local_include_dirs + + # Build and execute each unit test + test_files.each do |test| + + obj_list = [] + + test_base = File.basename(test, C_EXTENSION) + cmock_config = test_base.gsub(/test_/, '') + '_cmock.yml' + + report "Executing system tests in #{File.basename(test)}..." + + # Detect dependencies and build required required modules + extract_headers(test).each do |header| + + # Generate any needed mocks + if header =~ /^mock_(.*)\.h/i + module_name = $1 + cmock = CMock.new(SYSTEST_GENERATED_FILES_PATH + cmock_config) + cmock.setup_mocks("#{$cfg['compiler']['source_path']}#{module_name}.h") + end + # Compile corresponding source file if it exists + src_file = find_source_file(header, include_dirs) + if !src_file.nil? + compile(src_file) + obj_list << header.ext($cfg['compiler']['object_files']['extension']) + end + end + + # Generate and build the test suite runner + runner_name = test_base + '_runner.c' + runner_path = $cfg['compiler']['source_path'] + runner_name + UnityTestRunnerGenerator.new(SYSTEST_GENERATED_FILES_PATH + cmock_config).run(test, runner_path) + compile(runner_path) + obj_list << runner_name.ext($cfg['compiler']['object_files']['extension']) + + # Build the test module + compile(test) + obj_list << test_base.ext($cfg['compiler']['object_files']['extension']) + + # Link the test executable + link(test_base, obj_list) + + # Execute unit test and generate results file + simulator = build_simulator_fields + executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] + if simulator.nil? + cmd_str = executable + else + cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" + end + output = execute(cmd_str, false, false) + test_results = $cfg['compiler']['build_path'] + test_base + RESULT_EXTENSION + File.open(test_results, 'w') { |f| f.print output } + end + + # Parse and report test results + total_tests = 0 + total_failures = 0 + failure_messages = [] + + test_case_files.each do |test_case| + tests = (YAML.load_file(test_case))[:systest][:tests][:units] + total_tests += tests.size + + test_file = 'test_' + File.basename(test_case).ext(C_EXTENSION) + result_file = test_file.ext(RESULT_EXTENSION) + test_results = File.readlines(SYSTEST_BUILD_FILES_PATH + result_file) + tests.each_with_index do |test, index| + # compare test's intended pass/fail state with pass/fail state in actual results; + # if they don't match, the system test has failed + this_failed = case(test[:pass]) + when :ignore + (test_results[index] =~ /:IGNORE/).nil? + when true + (test_results[index] =~ /:PASS/).nil? + when false + (test_results[index] =~ /:FAIL/).nil? + end + if (this_failed) + total_failures += 1 + test_results[index] =~ /test#{index+1}:(.+)/ + failure_messages << "#{test_file}:test#{index+1}:should #{test[:should]}:#{$1}" + end + # some tests have additional requirements to check for (checking the actual output message) + if (test[:verify_error]) and not (test_results[index] =~ /test#{index+1}:.*#{test[:verify_error]}/) + total_failures += 1 + failure_messages << "#{test_file}:test#{index+1}:should #{test[:should]}:should have output matching '#{test[:verify_error]}'" + end + end + end + + report "\n" + report "------------------------------------\n" + report "SYSTEM TEST MOCK INTERACTION SUMMARY\n" + report "------------------------------------\n" + report "#{total_tests} Tests #{total_failures} Failures 0 Ignored\n" + report "\n" + + if (failure_messages.size > 0) + report 'System test failures:' + failure_messages.each do |failure| + report failure + end + end + + report '' + + return total_failures + end + + def profile_this(filename) + profile = true + begin + require 'ruby-prof' + RubyProf.start + rescue + profile = false + end + + yield + + if (profile) + profile_result = RubyProf.stop + File.open("Profile_#{filename}.html", 'w') do |f| + RubyProf::GraphHtmlPrinter.new(profile_result).print(f) + end + end + end + + def run_system_test_compilations(mockables) + load './lib/cmock.rb' + + load_configuration($cfg_file) + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + + report "\n" + report "------------------------------------\n" + report "SYSTEM TEST MOCK COMPILATION SUMMARY\n" + report "------------------------------------\n" + mockables.each do |header| + mock_filename = 'mock_' + File.basename(header).ext('.c') + CMock.new(SYSTEST_COMPILE_MOCKABLES_PATH + 'config.yml').setup_mocks(header) + report "Compiling #{mock_filename}..." + compile(SYSTEST_GENERATED_FILES_PATH + mock_filename) + end + end + + def run_system_test_profiles(mockables) + load './lib/cmock.rb' + + load_configuration($cfg_file) + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + + report "\n" + report "--------------------------\n" + report "SYSTEM TEST MOCK PROFILING\n" + report "--------------------------\n" + mockables.each do |header| + mock_filename = 'mock_' + File.basename(header).ext('.c') + profile_this(mock_filename.gsub('.c','')) do + 10.times do + CMock.new(SYSTEST_COMPILE_MOCKABLES_PATH + 'config.yml').setup_mocks(header) + end + end + report "Compiling #{mock_filename}..." + compile(SYSTEST_GENERATED_FILES_PATH + mock_filename) + end + end + + def build_and_test_c_files + report "\n" + report "----------------\n" + report "UNIT TEST C CODE\n" + report "----------------\n" + errors = false + FileList.new("test/c/*.yml").each do |yaml_file| + test = YAML.load(File.read(yaml_file)) + report "\nTesting #{yaml_file.sub('.yml','')}" + report "(#{test[:options].join(', ')})" + test[:files].each { |f| compile(f, test[:options]) } + obj_files = test[:files].map { |f| f.gsub!(/.*\//,'').gsub!(C_EXTENSION, $cfg['compiler']['object_files']['extension']) } + link('TestCMockC', obj_files) + if $cfg['simulator'].nil? + execute($cfg['linker']['bin_files']['destination'] + 'TestCMockC' + $cfg['linker']['bin_files']['extension']) + else + execute(tackit($cfg['simulator']['path'].join) + ' ' + + $cfg['simulator']['pre_support'].map{|o| tackit(o)}.join(' ') + ' ' + + $cfg['linker']['bin_files']['destination'] + + 'TestCMockC' + + $cfg['linker']['bin_files']['extension'] + ' ' + + $cfg['simulator']['post_support'].map{|o| tackit(o)}.join(' ') ) + end + end + end + + def fail_out(msg) + puts msg + exit(-1) + end +end + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/release/build.info b/flex-bison/clcalc/tools/ceedling/vendor/cmock/release/build.info new file mode 100644 index 0000000..360b9e4 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/release/build.info @@ -0,0 +1,2 @@ +209 + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/release/version.info b/flex-bison/clcalc/tools/ceedling/vendor/cmock/release/version.info new file mode 100644 index 0000000..0d71c08 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/release/version.info @@ -0,0 +1,2 @@ +2.0 + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/src/cmock.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/src/cmock.c new file mode 100644 index 0000000..558e19a --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/src/cmock.c @@ -0,0 +1,186 @@ +/* ========================================== + CMock Project - Automatic Mock Generation for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity.h" +#include "cmock.h" + +//define CMOCK_MEM_DYNAMIC to grab memory as needed with malloc +//when you do that, CMOCK_MEM_SIZE is used for incremental size instead of total +#ifdef CMOCK_MEM_STATIC +#undef CMOCK_MEM_DYNAMIC +#endif + +#ifdef CMOCK_MEM_DYNAMIC +#include +#endif + +//this is used internally during pointer arithmetic. make sure this type is the same size as the target's pointer type +#ifndef CMOCK_MEM_PTR_AS_INT +#define CMOCK_MEM_PTR_AS_INT unsigned long +#endif + +//0 for no alignment, 1 for 16-bit, 2 for 32-bit, 3 for 64-bit +#ifndef CMOCK_MEM_ALIGN +#define CMOCK_MEM_ALIGN (2) +#endif + +//amount of memory to allow cmock to use in its internal heap +#ifndef CMOCK_MEM_SIZE +#define CMOCK_MEM_SIZE (32768) +#endif + +//automatically calculated defs for easier reading +#define CMOCK_MEM_ALIGN_SIZE (1u << CMOCK_MEM_ALIGN) +#define CMOCK_MEM_ALIGN_MASK (CMOCK_MEM_ALIGN_SIZE - 1) +#define CMOCK_MEM_INDEX_SIZE ((sizeof(CMOCK_MEM_INDEX_TYPE) > CMOCK_MEM_ALIGN_SIZE) ? sizeof(CMOCK_MEM_INDEX_TYPE) : CMOCK_MEM_ALIGN_SIZE) + +//private variables +#ifdef CMOCK_MEM_DYNAMIC +static unsigned char* CMock_Guts_Buffer = NULL; +static CMOCK_MEM_INDEX_TYPE CMock_Guts_BufferSize = CMOCK_MEM_ALIGN_SIZE; +static CMOCK_MEM_INDEX_TYPE CMock_Guts_FreePtr; +#else +static unsigned char CMock_Guts_Buffer[CMOCK_MEM_SIZE + CMOCK_MEM_ALIGN_SIZE]; +static CMOCK_MEM_INDEX_TYPE CMock_Guts_BufferSize = CMOCK_MEM_SIZE + CMOCK_MEM_ALIGN_SIZE; +static CMOCK_MEM_INDEX_TYPE CMock_Guts_FreePtr; +#endif +//------------------------------------------------------- +// CMock_Guts_MemNew +//------------------------------------------------------- +CMOCK_MEM_INDEX_TYPE CMock_Guts_MemNew(CMOCK_MEM_INDEX_TYPE size) +{ + CMOCK_MEM_INDEX_TYPE index; + + //verify arguments valid (we must be allocating space for at least 1 byte, and the existing chain must be in memory somewhere) + if (size < 1) + return CMOCK_GUTS_NONE; + + //verify we have enough room + size = size + CMOCK_MEM_INDEX_SIZE; + if (size & CMOCK_MEM_ALIGN_MASK) + size = (size + CMOCK_MEM_ALIGN_MASK) & ~CMOCK_MEM_ALIGN_MASK; + if ((CMock_Guts_BufferSize - CMock_Guts_FreePtr) < size) + { +#ifdef CMOCK_MEM_DYNAMIC + CMock_Guts_BufferSize += CMOCK_MEM_SIZE + size; + CMock_Guts_Buffer = realloc(CMock_Guts_Buffer, CMock_Guts_BufferSize); + if (CMock_Guts_Buffer == NULL) +#endif //yes that if will continue to the return below if TRUE + return CMOCK_GUTS_NONE; + } + + //determine where we're putting this new block, and init its pointer to be the end of the line + index = CMock_Guts_FreePtr + CMOCK_MEM_INDEX_SIZE; + *(CMOCK_MEM_INDEX_TYPE*)(&CMock_Guts_Buffer[CMock_Guts_FreePtr]) = CMOCK_GUTS_NONE; + CMock_Guts_FreePtr += size; + + return index; +} + +//------------------------------------------------------- +// CMock_Guts_MemChain +//------------------------------------------------------- +CMOCK_MEM_INDEX_TYPE CMock_Guts_MemChain(CMOCK_MEM_INDEX_TYPE root_index, CMOCK_MEM_INDEX_TYPE obj_index) +{ + CMOCK_MEM_INDEX_TYPE index; + void* root; + void* obj; + void* next; + + if (root_index == CMOCK_GUTS_NONE) + { + //if there is no root currently, we return this object as the root of the chain + return obj_index; + } + else + { + //reject illegal nodes + if ((root_index < CMOCK_MEM_ALIGN_SIZE) || (root_index >= CMock_Guts_FreePtr)) + { + return CMOCK_GUTS_NONE; + } + if ((obj_index < CMOCK_MEM_ALIGN_SIZE) || (obj_index >= CMock_Guts_FreePtr)) + { + return CMOCK_GUTS_NONE; + } + + root = (void*)(&CMock_Guts_Buffer[root_index]); + obj = (void*)(&CMock_Guts_Buffer[obj_index]); + + //find the end of the existing chain and add us + next = root; + do { + index = *(CMOCK_MEM_INDEX_TYPE*)((CMOCK_MEM_PTR_AS_INT)next - CMOCK_MEM_INDEX_SIZE); + if (index >= CMock_Guts_FreePtr) + return CMOCK_GUTS_NONE; + if (index > 0) + next = (void*)(&CMock_Guts_Buffer[index]); + } while (index > 0); + *(CMOCK_MEM_INDEX_TYPE*)((CMOCK_MEM_PTR_AS_INT)next - CMOCK_MEM_INDEX_SIZE) = ((CMOCK_MEM_PTR_AS_INT)obj - (CMOCK_MEM_PTR_AS_INT)CMock_Guts_Buffer); + return root_index; + } +} + +//------------------------------------------------------- +// CMock_Guts_MemNext +//------------------------------------------------------- +CMOCK_MEM_INDEX_TYPE CMock_Guts_MemNext(CMOCK_MEM_INDEX_TYPE previous_item_index) +{ + CMOCK_MEM_INDEX_TYPE index; + void* previous_item; + + //There is nothing "next" if the pointer isn't from our buffer + if ((previous_item_index < CMOCK_MEM_ALIGN_SIZE) || (previous_item_index >= CMock_Guts_FreePtr)) + return CMOCK_GUTS_NONE; + previous_item = (void*)(&CMock_Guts_Buffer[previous_item_index]); + + //if the pointer is good, then use it to look up the next index + //(we know the first element always goes in zero, so NEXT must always be > 1) + index = *(CMOCK_MEM_INDEX_TYPE*)((CMOCK_MEM_PTR_AS_INT)previous_item - CMOCK_MEM_INDEX_SIZE); + if ((index > 1) && (index < CMock_Guts_FreePtr)) + return index; + else + return CMOCK_GUTS_NONE; +} + +//------------------------------------------------------- +// CMock_GetAddressFor +//------------------------------------------------------- +void* CMock_Guts_GetAddressFor(CMOCK_MEM_INDEX_TYPE index) +{ + if ((index >= CMOCK_MEM_ALIGN_SIZE) && (index < CMock_Guts_FreePtr)) + { + return (void*)(&CMock_Guts_Buffer[index]); + } + else + { + return NULL; + } +} + +//------------------------------------------------------- +// CMock_Guts_MemBytesFree +//------------------------------------------------------- +CMOCK_MEM_INDEX_TYPE CMock_Guts_MemBytesFree(void) +{ + return CMock_Guts_BufferSize - CMock_Guts_FreePtr; +} + +//------------------------------------------------------- +// CMock_Guts_MemBytesUsed +//------------------------------------------------------- +CMOCK_MEM_INDEX_TYPE CMock_Guts_MemBytesUsed(void) +{ + return CMock_Guts_FreePtr - CMOCK_MEM_ALIGN_SIZE; +} + +//------------------------------------------------------- +// CMock_Guts_MemFreeAll +//------------------------------------------------------- +void CMock_Guts_MemFreeAll(void) +{ + CMock_Guts_FreePtr = CMOCK_MEM_ALIGN_SIZE; //skip the very beginning +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/src/cmock.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/src/cmock.h new file mode 100644 index 0000000..a43e9e0 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/src/cmock.h @@ -0,0 +1,30 @@ +/* ========================================== + CMock Project - Automatic Mock Generation for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef CMOCK_FRAMEWORK_H +#define CMOCK_FRAMEWORK_H + +//should be big enough to index full range of CMOCK_MEM_MAX +#ifndef CMOCK_MEM_INDEX_TYPE +#define CMOCK_MEM_INDEX_TYPE unsigned int +#endif + +#define CMOCK_GUTS_NONE (0) + +//------------------------------------------------------- +// Memory API +//------------------------------------------------------- +CMOCK_MEM_INDEX_TYPE CMock_Guts_MemNew(CMOCK_MEM_INDEX_TYPE size); +CMOCK_MEM_INDEX_TYPE CMock_Guts_MemChain(CMOCK_MEM_INDEX_TYPE root_index, CMOCK_MEM_INDEX_TYPE obj_index); +CMOCK_MEM_INDEX_TYPE CMock_Guts_MemNext(CMOCK_MEM_INDEX_TYPE previous_item_index); + +void* CMock_Guts_GetAddressFor(CMOCK_MEM_INDEX_TYPE index); + +CMOCK_MEM_INDEX_TYPE CMock_Guts_MemBytesFree(void); +CMOCK_MEM_INDEX_TYPE CMock_Guts_MemBytesUsed(void); +void CMock_Guts_MemFreeAll(void); + +#endif //CMOCK_FRAMEWORK diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/targets/gcc.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/targets/gcc.yml new file mode 100644 index 0000000..e46aec5 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/targets/gcc.yml @@ -0,0 +1,50 @@ +--- +compiler: + path: gcc + source_path: &systest_generated_path 'test/system/generated/' + unit_tests_path: &unit_tests_path 'examples/test/' + mocks_path: &systest_mocks_path 'test/system/generated/' + build_path: &systest_build_path 'test/system/build/' + options: + - '-c' + - '-Wall' + - '-Wno-address' + - '-std=c99' + - '-pedantic' + includes: + prefix: '-I' + items: + - *systest_generated_path + - *unit_tests_path + - *systest_mocks_path + - 'src/' + - 'vendor/unity/src/' + - 'vendor/c_exception/lib/' + - 'test/system/test_compilation/' + - 'test/' + defines: + prefix: '-D' + items: + object_files: + prefix: '-o' + extension: '.o' + destination: *systest_build_path + +linker: + path: gcc + options: + - -lm + includes: + prefix: '-I' + object_files: + path: *systest_build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.exe' + destination: *systest_build_path + +unsupported: + - unity_64bit_support + +colour: true diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/targets/gcc_32_with_64_support.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/targets/gcc_32_with_64_support.yml new file mode 100644 index 0000000..2decb69 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/targets/gcc_32_with_64_support.yml @@ -0,0 +1,52 @@ +--- +compiler: + path: gcc + source_path: &systest_generated_path 'test/system/generated/' + unit_tests_path: &unit_tests_path 'examples/test/' + mocks_path: &systest_mocks_path 'test/system/generated/' + build_path: &systest_build_path 'test/system/build/' + options: + - '-c' + - '-Wall' + - '-Wno-address' + - '-std=c99' + - '-pedantic' + includes: + prefix: '-I' + items: + - *systest_generated_path + - *unit_tests_path + - *systest_mocks_path + - 'src/' + - 'vendor/unity/src/' + - 'vendor/c_exception/lib/' + - 'test/system/test_compilation/' + - 'test/' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - UNITY_LONG_WIDTH=32 + - 'CMOCK_MEM_PTR_AS_INT=long' + object_files: + prefix: '-o' + extension: '.o' + destination: *systest_build_path + +linker: + path: gcc + options: + - -lm + includes: + prefix: '-I' + object_files: + path: *systest_build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.exe' + destination: *systest_build_path + +unsupported: [] + +colour: true diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/targets/gcc_64.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/targets/gcc_64.yml new file mode 100644 index 0000000..2296537 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/targets/gcc_64.yml @@ -0,0 +1,53 @@ +--- +compiler: + path: gcc + source_path: &systest_generated_path 'test/system/generated/' + unit_tests_path: &unit_tests_path 'examples/test/' + mocks_path: &systest_mocks_path 'test/system/generated/' + build_path: &systest_build_path 'test/system/build/' + options: + - '-c' + - '-Wall' + - '-std=c99' + - '-Wno-address' + - '-pedantic-errors' + includes: + prefix: '-I' + items: + - *systest_generated_path + - *unit_tests_path + - *systest_mocks_path + - 'src/' + - 'vendor/unity/src/' + - 'vendor/c_exception/lib/' + - 'test/system/test_compilation/' + - 'test/' + defines: + prefix: '-D' + items: + - 'UNITY_SUPPORT_64' + - 'UNITY_LONG_WIDTH=64' + - 'UNITY_POINTER_WIDTH=64' + - 'CMOCK_MEM_PTR_AS_INT=long' + object_files: + prefix: '-o' + extension: '.o' + destination: *systest_build_path + +linker: + path: gcc + options: + - -lm + includes: + prefix: '-I' + object_files: + path: *systest_build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.exe' + destination: *systest_build_path + +unsupported: [] + +colour: true diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/targets/iar_arm_v4.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/targets/iar_arm_v4.yml new file mode 100644 index 0000000..574814b --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/targets/iar_arm_v4.yml @@ -0,0 +1,107 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 4.0\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: &systest_generated_path 'test/system/generated/' + unit_tests_path: &unit_tests_path 'examples/test/' + mocks_path: &systest_mocks_path 'test/system/generated/' + build_path: &systest_build_path 'test/system/build/' + options: + - --dlib_config + - [*tools_root, 'arm\lib\dl4tptinl8n.h'] + - -z3 + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian little + - --cpu ARM7TDMI + - --stack_align 4 + - --interwork + - -e + - --silent + - --warnings_are_errors + - --fpu None + #We are supressing some warnings here because we test CMock against some questionable code to make sure it still works + - --diag_suppress Pa050 + - --diag_suppress Pe191 + - --diag_suppress=Pe494 + - --diag_suppress=Pe083 + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - *systest_generated_path + - *unit_tests_path + - *systest_mocks_path + - 'src/' + - 'vendor/unity/src/' + - 'vendor/c_exception/lib/' + - 'test/system/test_compilation/' + - 'test\' + defines: + prefix: '-D' + items: + object_files: + prefix: '-o' + extension: '.r79' + destination: *systest_build_path + +linker: + path: [*tools_root, 'common\bin\xlink.exe'] + options: + - -rt + - [*tools_root, 'arm\lib\dl4tptinl8n.r79'] + - -D_L_EXTMEM_START=0 + - -D_L_EXTMEM_SIZE=0 + - -D_L_HEAP_SIZE=120 + - -D_L_STACK_SIZE=32 + - -e_small_write=_formatted_write + - -s + - __program_start + - '-f iar\iar_v4\Resource\at91SAM7X256_FLASH.xcl' + includes: + prefix: '-I' + items: + - *systest_generated_path + - *unit_tests_path + - *systest_mocks_path + - 'vendor/unity/src/' + - [*tools_root, 'arm\config\'] + - [*tools_root, 'arm\lib\'] + object_files: + path: *systest_build_path + extension: '.r79' + bin_files: + prefix: '-o' + extension: '.d79' + destination: *systest_build_path + +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --macro + - 'iar\iar_v4\Resource\SAM7_SIM.mac' + - --backend + - -B + - -p + - [*tools_root, 'arm\config\ioat91sam7X256.ddf'] + - -d + - sim + +unsupported: + - nonstandard_parsed_stuff_1 + - const + - unity_64bit_support + +colour: true diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/targets/iar_arm_v5.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/targets/iar_arm_v5.yml new file mode 100644 index 0000000..fc4e4c4 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/targets/iar_arm_v5.yml @@ -0,0 +1,92 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: &systest_generated_path 'test/system/generated/' + unit_tests_path: &unit_tests_path 'examples/test/' + mocks_path: &systest_mocks_path 'test/system/generated/' + build_path: &systest_build_path 'test/system/build/' + options: + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian=little + - --cpu=ARM7TDMI + - --interwork + - --warnings_are_errors + - --fpu=None + - -e + - -On + #We are supressing some warnings here because we test CMock against some questionable code to make sure it still works + - --diag_suppress=Pa050 + - --diag_suppress=Pe191 + - --diag_suppress=Pe494 + - --diag_suppress=Pe083 + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - *systest_generated_path + - *unit_tests_path + - *systest_mocks_path + - 'src/' + - 'vendor/unity/src/' + - 'vendor/c_exception/lib/' + - 'iar\iar_v5\incIAR\' + - 'test\system\test_compilation\' + - 'test\' + defines: + prefix: '-D' + items: + object_files: + prefix: '-o' + extension: '.r79' + destination: *systest_build_path + +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config iar\iar_v5\Resource\at91SAM7X256_RAM.icf + object_files: + path: *systest_build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *systest_build_path + +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --macro + - 'iar\iar_v5\Resource\SAM7_SIM.mac' + - --backend + - -B + - -p + - [*tools_root, 'arm\config\debugger\Atmel\ioat91sam7X256.ddf'] + - -d + - sim + +unsupported: + - nonstandard_parsed_stuff_1 + - const + - unity_64bit_support + +colour: true diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/c/TestCMockC.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/c/TestCMockC.c new file mode 100644 index 0000000..9a61b39 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/c/TestCMockC.c @@ -0,0 +1,280 @@ +/* ========================================== + CMock Project - Automatic Mock Generation for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity.h" +#include "cmock.h" + +#define TEST_MEM_INDEX_SIZE (sizeof(CMOCK_MEM_INDEX_TYPE)) + +void setUp(void) +{ + CMock_Guts_MemFreeAll(); +} + +void tearDown(void) +{ +} + +void test_MemNewWillReturnNullIfGivenIllegalSizes(void) +{ + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemNew(0) ); + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemNew(CMOCK_MEM_SIZE - TEST_MEM_INDEX_SIZE + 1) ); + TEST_ASSERT_NULL( CMock_Guts_GetAddressFor(CMOCK_GUTS_NONE) ); + + //verify we're cleared still + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE, CMock_Guts_MemBytesFree()); +} + +void test_MemChainWillReturnNullAndDoNothingIfGivenIllegalInformation(void) +{ + CMOCK_MEM_INDEX_TYPE next = CMock_Guts_MemNew(4); + TEST_ASSERT_EQUAL(4 + TEST_MEM_INDEX_SIZE, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - 4 - TEST_MEM_INDEX_SIZE, CMock_Guts_MemBytesFree()); + + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemChain(next + CMOCK_MEM_SIZE, next) ); + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemChain(next, next + CMOCK_MEM_SIZE) ); + + //verify we're still the same + TEST_ASSERT_EQUAL(4 + TEST_MEM_INDEX_SIZE, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - 4 - TEST_MEM_INDEX_SIZE, CMock_Guts_MemBytesFree()); +} + +void test_MemNextWillReturnNullIfGivenABadRoot(void) +{ + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemNext(0) ); + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemNext(2) ); + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemNext(CMOCK_MEM_SIZE - 4) ); + + //verify we're cleared still + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE, CMock_Guts_MemBytesFree()); +} + +void test_ThatWeCanClaimAndChainAFewElementsTogether(void) +{ + unsigned int i; + CMOCK_MEM_INDEX_TYPE next; + CMOCK_MEM_INDEX_TYPE first = CMOCK_GUTS_NONE; + CMOCK_MEM_INDEX_TYPE element[4]; + + //verify we're cleared first + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE, CMock_Guts_MemBytesFree()); + + //first element + element[0] = CMock_Guts_MemNew(sizeof(unsigned int)); + TEST_ASSERT_MESSAGE(element[0] != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + first = CMock_Guts_MemChain(first, element[0]); + TEST_ASSERT_EQUAL(element[0], first); + *((unsigned int*)CMock_Guts_GetAddressFor(element[0])) = 0; + + //verify we're using the right amount of memory + TEST_ASSERT_EQUAL(1 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - 1 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesFree()); + + //second element + element[1] = CMock_Guts_MemNew(sizeof(unsigned int)); + TEST_ASSERT_MESSAGE(element[1] != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + TEST_ASSERT_NOT_EQUAL(element[0], element[1]); + TEST_ASSERT_EQUAL(first, CMock_Guts_MemChain(first, element[1])); + *((unsigned int*)CMock_Guts_GetAddressFor(element[1])) = 1; + + //verify we're using the right amount of memory + TEST_ASSERT_EQUAL(2 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - 2 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesFree()); + + //third element + element[2] = CMock_Guts_MemNew(sizeof(unsigned int)); + TEST_ASSERT_MESSAGE(element[2] != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + TEST_ASSERT_NOT_EQUAL(element[0], element[2]); + TEST_ASSERT_NOT_EQUAL(element[1], element[2]); + TEST_ASSERT_EQUAL(first, CMock_Guts_MemChain(first, element[2])); + *((unsigned int*)CMock_Guts_GetAddressFor(element[2])) = 2; + + //verify we're using the right amount of memory + TEST_ASSERT_EQUAL(3 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - 3 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesFree()); + + //fourth element + element[3] = CMock_Guts_MemNew(sizeof(unsigned int)); + TEST_ASSERT_MESSAGE(element[3] != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + TEST_ASSERT_NOT_EQUAL(element[0], element[3]); + TEST_ASSERT_NOT_EQUAL(element[1], element[3]); + TEST_ASSERT_NOT_EQUAL(element[2], element[3]); + TEST_ASSERT_EQUAL(first, CMock_Guts_MemChain(first, element[3])); + *((unsigned int*)CMock_Guts_GetAddressFor(element[3])) = 3; + + //verify we're using the right amount of memory + TEST_ASSERT_EQUAL(4 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - 4 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesFree()); + + //traverse list + next = first; + for (i = 0; i < 4; i++) + { + TEST_ASSERT_EQUAL(element[i], next); + TEST_ASSERT_EQUAL(i, *((unsigned int*)CMock_Guts_GetAddressFor(element[i]))); + next = CMock_Guts_MemNext(next); + } + + //verify we get a null at the end of the list + TEST_ASSERT_EQUAL_HEX(CMOCK_GUTS_NONE, next); + + //verify we're using the right amount of memory + TEST_ASSERT_EQUAL(4 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - 4 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesFree()); + + //Free it all + CMock_Guts_MemFreeAll(); + + //verify we're cleared + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE, CMock_Guts_MemBytesFree()); +} + +void test_ThatCMockStopsReturningMoreDataWhenItRunsOutOfMemory(void) +{ + unsigned int i; + CMOCK_MEM_INDEX_TYPE first = CMOCK_GUTS_NONE; + CMOCK_MEM_INDEX_TYPE next; + + //even though we are asking for one byte, we've told it to align to closest 4 bytes, therefore it will waste a byte each time + //so each call will use 8 bytes (4 for the index, 1 for the data, and 3 wasted). + //therefore we can safely allocated total/8 times. + for (i = 0; i < (CMOCK_MEM_SIZE / 8); i++) + { + TEST_ASSERT_EQUAL(i*8, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - i*8, CMock_Guts_MemBytesFree()); + + next = CMock_Guts_MemNew(1); + TEST_ASSERT_MESSAGE(next != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + + first = CMock_Guts_MemChain(first, next); + TEST_ASSERT_MESSAGE(first != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + } + + //verify we're at top of memory + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesFree()); + + //The very next call will return a NULL, and any after that + TEST_ASSERT_EQUAL_HEX(CMOCK_GUTS_NONE, CMock_Guts_MemNew(1)); + TEST_ASSERT_EQUAL_HEX(CMOCK_GUTS_NONE, CMock_Guts_MemNew(1)); + TEST_ASSERT_EQUAL_HEX(CMOCK_GUTS_NONE, CMock_Guts_MemNew(1)); + + //verify nothing has changed + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesFree()); + + //verify we can still walk through the elements allocated + next = first; + for (i = 0; i < (CMOCK_MEM_SIZE / 8); i++) + { + TEST_ASSERT_MESSAGE(next != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + next = CMock_Guts_MemNext(next); + } + + //there aren't any after that + TEST_ASSERT_EQUAL_HEX(CMOCK_GUTS_NONE, next); +} + +void test_ThatCMockStopsReturningMoreDataWhenAskForMoreThanItHasLeftEvenIfNotAtExactEnd(void) +{ + unsigned int i; + CMOCK_MEM_INDEX_TYPE first = CMOCK_GUTS_NONE; + CMOCK_MEM_INDEX_TYPE next; + + //we're asking for 12 bytes each time now (4 for index, 8 for data). + //10 requests will give us 120 bytes used, which isn't enough for another 12 bytes if total memory is 128 + for (i = 0; i < 10; i++) + { + TEST_ASSERT_EQUAL(i*12, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - i*12, CMock_Guts_MemBytesFree()); + + next = CMock_Guts_MemNew(8); + TEST_ASSERT_MESSAGE(next != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + + first = CMock_Guts_MemChain(first, next); + TEST_ASSERT_MESSAGE(first != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + + //verify writing data won't screw us up + *((unsigned int*)CMock_Guts_GetAddressFor(next)) = i; + } + + //verify we're at top of memory + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - 8, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(8, CMock_Guts_MemBytesFree()); + + //The very next call will return a NONE, and any after that + TEST_ASSERT_EQUAL_HEX(CMOCK_GUTS_NONE, CMock_Guts_MemNew(8)); + TEST_ASSERT_EQUAL_HEX(CMOCK_GUTS_NONE, CMock_Guts_MemNew(5)); + + //verify nothing has changed + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - 8, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(8, CMock_Guts_MemBytesFree()); + + //verify we can still walk through the elements allocated + next = first; + for (i = 0; i < 10; i++) + { + TEST_ASSERT_MESSAGE(next != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + TEST_ASSERT_EQUAL(i, *((unsigned int*)CMock_Guts_GetAddressFor(next))); + next = CMock_Guts_MemNext(next); + } + + //there aren't any after that + TEST_ASSERT_EQUAL_HEX(CMOCK_GUTS_NONE, next); +} + +void test_ThatWeCanAskForAllSortsOfSizes(void) +{ + unsigned int i; + CMOCK_MEM_INDEX_TYPE first = CMOCK_GUTS_NONE; + CMOCK_MEM_INDEX_TYPE next; + unsigned int sizes[5] = {3, 1, 80, 5, 4}; + unsigned int sizes_buffered[5] = {4, 4, 80, 8, 4}; + unsigned int sum = 0; + + for (i = 0; i < 5; i++) + { + next = CMock_Guts_MemNew(sizes[i]); + TEST_ASSERT_MESSAGE(next != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + + first = CMock_Guts_MemChain(first, next); + TEST_ASSERT_MESSAGE(first != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + + sum += sizes_buffered[i] + 4; + TEST_ASSERT_EQUAL(sum, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - sum, CMock_Guts_MemBytesFree()); + } + + //show that we can't ask for too much memory + TEST_ASSERT_EQUAL_HEX(CMOCK_GUTS_NONE, CMock_Guts_MemNew(12)); + TEST_ASSERT_EQUAL_HEX(CMOCK_GUTS_NONE, CMock_Guts_MemNew(5)); + + //but we CAN ask for something that will still fit + next = CMock_Guts_MemNew(4); + TEST_ASSERT_MESSAGE(next != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + + first = CMock_Guts_MemChain(first, next); + TEST_ASSERT_MESSAGE(first != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + + //verify we're used up now + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesFree()); + + //verify we can still walk through the elements allocated + next = first; + for (i = 0; i < 6; i++) + { + TEST_ASSERT_MESSAGE(next != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + next = CMock_Guts_MemNext(next); + } + + //there aren't any after that + TEST_ASSERT_EQUAL_HEX(CMOCK_GUTS_NONE, next); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/c/TestCMockC.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/c/TestCMockC.yml new file mode 100644 index 0000000..cd76154 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/c/TestCMockC.yml @@ -0,0 +1,12 @@ +--- +:files: + - 'src/cmock.c' + - 'test/c/TestCMockC.c' + - 'test/c/TestCMockC_Runner.c' + - 'vendor/unity/src/unity.c' +:options: + - 'TEST' + - 'CMOCK_MEM_SIZE=128' + - 'CMOCK_MEM_ALIGN=2' + - 'CMOCK_MEM_INDEX_TYPE=int' + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/c/TestCMockCDynamic.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/c/TestCMockCDynamic.c new file mode 100644 index 0000000..bd699a8 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/c/TestCMockCDynamic.c @@ -0,0 +1,186 @@ +/* ========================================== + CMock Project - Automatic Mock Generation for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity.h" +#include "cmock.h" + +#define TEST_MEM_INDEX_SIZE (sizeof(CMOCK_MEM_INDEX_TYPE)) +#define TEST_MEM_INDEX_PAD ((sizeof(CMOCK_MEM_INDEX_TYPE) + 7) & ~7) //round up to nearest 4 byte boundary + +unsigned int StartingSize; + +void setUp(void) +{ + CMock_Guts_MemFreeAll(); + StartingSize = CMock_Guts_MemBytesFree(); + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesUsed()); +} + +void tearDown(void) +{ +} + +void test_MemNewWillReturnNullIfGivenIllegalSizes(void) +{ + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemNew(0) ); + + //verify we're cleared still + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesFree()); +} + +void test_MemNewWillNowSupportSizesGreaterThanTheDefinesCMockSize(void) +{ + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesFree()); + + TEST_ASSERT_MESSAGE(CMock_Guts_MemNew(CMOCK_MEM_SIZE - TEST_MEM_INDEX_SIZE + 1) != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE + TEST_MEM_INDEX_PAD, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE, CMock_Guts_MemBytesFree()); +} + +void test_MemChainWillReturnNullAndDoNothingIfGivenIllegalInformation(void) +{ + CMOCK_MEM_INDEX_TYPE next = CMock_Guts_MemNew(8); + TEST_ASSERT_EQUAL(8 + TEST_MEM_INDEX_PAD, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(StartingSize - 8 - TEST_MEM_INDEX_PAD, CMock_Guts_MemBytesFree()); + + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemChain(next + CMOCK_MEM_SIZE, next) ); + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemChain(next, next + CMOCK_MEM_SIZE) ); + + //verify we're still the same + TEST_ASSERT_EQUAL(8 + TEST_MEM_INDEX_PAD, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(StartingSize - 8 - TEST_MEM_INDEX_PAD, CMock_Guts_MemBytesFree()); +} + +void test_MemNextWillReturnNullIfGivenABadRoot(void) +{ + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemNext(0) ); + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemNext(2) ); + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemNext( CMOCK_MEM_SIZE - 4 ) ); + + //verify we're cleared still + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(StartingSize, CMock_Guts_MemBytesFree()); +} + +void test_ThatWeCanClaimAndChainAFewElementsTogether(void) +{ + unsigned int i; + CMOCK_MEM_INDEX_TYPE first = CMOCK_GUTS_NONE; + CMOCK_MEM_INDEX_TYPE next; + CMOCK_MEM_INDEX_TYPE element[4]; + + //verify we're cleared first + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(StartingSize, CMock_Guts_MemBytesFree()); + + //first element + element[0] = CMock_Guts_MemNew(sizeof(unsigned int)); + TEST_ASSERT_MESSAGE(element[0] != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + first = CMock_Guts_MemChain(first, element[0]); + TEST_ASSERT_EQUAL(element[0], first); + *((unsigned int*)CMock_Guts_GetAddressFor(element[0])) = 0; + + //verify we're using the right amount of memory + TEST_ASSERT_EQUAL(1 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(StartingSize - 1 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesFree()); + + //second element + element[1] = CMock_Guts_MemNew(sizeof(unsigned int)); + TEST_ASSERT_MESSAGE(element[1] != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + TEST_ASSERT_NOT_EQUAL(element[0], element[1]); + TEST_ASSERT_EQUAL(first, CMock_Guts_MemChain(first, element[1])); + *((unsigned int*)CMock_Guts_GetAddressFor(element[1])) = 1; + + //verify we're using the right amount of memory + TEST_ASSERT_EQUAL(2 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(StartingSize - 2 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesFree()); + + //third element + element[2] = CMock_Guts_MemNew(sizeof(unsigned int)); + TEST_ASSERT_MESSAGE(element[2] != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + TEST_ASSERT_NOT_EQUAL(element[0], element[2]); + TEST_ASSERT_NOT_EQUAL(element[1], element[2]); + TEST_ASSERT_EQUAL(first, CMock_Guts_MemChain(first, element[2])); + *((unsigned int*)CMock_Guts_GetAddressFor(element[2])) = 2; + + //verify we're using the right amount of memory + TEST_ASSERT_EQUAL(3 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(StartingSize - 3 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesFree()); + + //fourth element + element[3] = CMock_Guts_MemNew(sizeof(unsigned int)); + TEST_ASSERT_MESSAGE(element[3] != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + TEST_ASSERT_NOT_EQUAL(element[0], element[3]); + TEST_ASSERT_NOT_EQUAL(element[1], element[3]); + TEST_ASSERT_NOT_EQUAL(element[2], element[3]); + TEST_ASSERT_EQUAL(first, CMock_Guts_MemChain(first, element[3])); + *((unsigned int*)CMock_Guts_GetAddressFor(element[3])) = 3; + + //verify we're using the right amount of memory + TEST_ASSERT_EQUAL(4 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(StartingSize - 4 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesFree()); + + //traverse list + next = first; + for (i = 0; i < 4; i++) + { + TEST_ASSERT_EQUAL(element[i], next); + TEST_ASSERT_EQUAL(i, *((unsigned int*)CMock_Guts_GetAddressFor(element[i]))); + next = CMock_Guts_MemNext(next); + } + + //verify we get a null at the end of the list + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, next); + + //verify we're using the right amount of memory + TEST_ASSERT_EQUAL(4 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(StartingSize - 4 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesFree()); + + //Free it all + CMock_Guts_MemFreeAll(); + + //verify we're cleared + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(StartingSize, CMock_Guts_MemBytesFree()); +} + +void test_ThatWeCanAskForAllSortsOfSizes(void) +{ + unsigned int i; + CMOCK_MEM_INDEX_TYPE first = CMOCK_GUTS_NONE; + CMOCK_MEM_INDEX_TYPE next; + unsigned int sizes[10] = {3, 1, 80, 5, 8, 31, 7, 911, 2, 80}; + unsigned int sizes_buffered[10] = {16, 16, 88, 16, 16, 40, 16, 920, 16, 88}; //includes counter + unsigned int sum = 0; + unsigned int cap; + + for (i = 0; i < 10; i++) + { + next = CMock_Guts_MemNew(sizes[i]); + TEST_ASSERT_MESSAGE(next != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + + first = CMock_Guts_MemChain(first, next); + TEST_ASSERT_MESSAGE(first != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + + sum += sizes_buffered[i]; + cap = (StartingSize > (sum + CMOCK_MEM_SIZE)) ? StartingSize : (sum + CMOCK_MEM_SIZE); + TEST_ASSERT_EQUAL(sum, CMock_Guts_MemBytesUsed()); + TEST_ASSERT(cap >= CMock_Guts_MemBytesFree()); + } + + //verify we can still walk through the elements allocated + next = first; + for (i = 0; i < 10; i++) + { + TEST_ASSERT_MESSAGE(next != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + next = CMock_Guts_MemNext(next); + } + + //there aren't any after that + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, next); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/c/TestCMockCDynamic.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/c/TestCMockCDynamic.yml new file mode 100644 index 0000000..7776c89 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/c/TestCMockCDynamic.yml @@ -0,0 +1,12 @@ +--- +:files: + - 'src/cmock.c' + - 'test/c/TestCMockCDynamic.c' + - 'test/c/TestCMockCDynamic_Runner.c' + - 'vendor/unity/src/unity.c' +:options: + - 'TEST' + - 'CMOCK_MEM_DYNAMIC' + - 'CMOCK_MEM_SIZE=64' + - 'CMOCK_MEM_ALIGN=3' + - 'CMOCK_MEM_INDEX_TYPE=short' diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/c/TestCMockCDynamic_Runner.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/c/TestCMockCDynamic_Runner.c new file mode 100644 index 0000000..e161625 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/c/TestCMockCDynamic_Runner.c @@ -0,0 +1,35 @@ +/* ========================================== + CMock Project - Automatic Mock Generation for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity.h" +#include +#include + +extern void setUp(void); +extern void tearDown(void); + +extern void test_MemNewWillReturnNullIfGivenIllegalSizes(void); +extern void test_MemNewWillNowSupportSizesGreaterThanTheDefinesCMockSize(void); +extern void test_MemChainWillReturnNullAndDoNothingIfGivenIllegalInformation(void); +extern void test_MemNextWillReturnNullIfGivenABadRoot(void); +extern void test_ThatWeCanClaimAndChainAFewElementsTogether(void); +extern void test_ThatWeCanAskForAllSortsOfSizes(void); + +int main(void) +{ + Unity.TestFile = "TestCMockDynamic.c"; + UnityBegin(); + + RUN_TEST(test_MemNewWillReturnNullIfGivenIllegalSizes, 26); + RUN_TEST(test_MemNewWillNowSupportSizesGreaterThanTheDefinesCMockSize, 35); + RUN_TEST(test_MemChainWillReturnNullAndDoNothingIfGivenIllegalInformation, 45); + RUN_TEST(test_MemNextWillReturnNullIfGivenABadRoot, 59); + RUN_TEST(test_ThatWeCanClaimAndChainAFewElementsTogether, 70); + RUN_TEST(test_ThatWeCanAskForAllSortsOfSizes, 152); + + UnityEnd(); + return 0; +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/c/TestCMockC_Runner.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/c/TestCMockC_Runner.c new file mode 100644 index 0000000..93d8e1f --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/c/TestCMockC_Runner.c @@ -0,0 +1,37 @@ +/* ========================================== + CMock Project - Automatic Mock Generation for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity.h" +#include +#include + +extern void setUp(void); +extern void tearDown(void); + +extern void test_MemNewWillReturnNullIfGivenIllegalSizes(void); +extern void test_MemChainWillReturnNullAndDoNothingIfGivenIllegalInformation(void); +extern void test_MemNextWillReturnNullIfGivenABadRoot(void); +extern void test_ThatWeCanClaimAndChainAFewElementsTogether(void); +extern void test_ThatCMockStopsReturningMoreDataWhenItRunsOutOfMemory(void); +extern void test_ThatCMockStopsReturningMoreDataWhenAskForMoreThanItHasLeftEvenIfNotAtExactEnd(void); +extern void test_ThatWeCanAskForAllSortsOfSizes(void); + +int main(void) +{ + Unity.TestFile = "TestCMock.c"; + UnityBegin(); + + RUN_TEST(test_MemNewWillReturnNullIfGivenIllegalSizes, 21); + RUN_TEST(test_MemChainWillReturnNullAndDoNothingIfGivenIllegalInformation, 32); + RUN_TEST(test_MemNextWillReturnNullIfGivenABadRoot, 46); + RUN_TEST(test_ThatWeCanClaimAndChainAFewElementsTogether, 57); + RUN_TEST(test_ThatCMockStopsReturningMoreDataWhenItRunsOutOfMemory, 139); + RUN_TEST(test_ThatCMockStopsReturningMoreDataWhenAskForMoreThanItHasLeftEvenIfNotAtExactEnd, 185); + RUN_TEST(test_ThatWeCanAskForAllSortsOfSizes, 233); + + UnityEnd(); + return 0; +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/systest_generator.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/systest_generator.rb new file mode 100644 index 0000000..368b039 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/systest_generator.rb @@ -0,0 +1,178 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require 'yaml' + +SYS_TEST_GEN_ROOT = File.expand_path( File.dirname( __FILE__ ) ) + '/' +GENERATED_PATH = SYS_TEST_GEN_ROOT + 'generated/' +BUILD_PATH = SYS_TEST_GEN_ROOT + 'build/' +CASES_PATH = SYS_TEST_GEN_ROOT + 'cases/' + +TYPES_H = 'types.h' +UNITY_H = 'unity.h' +CMOCK_H = 'cmock.h' +UNITY_HELPER_H = 'unity_helper.h' +UNITY_HELPER_C = 'unity_helper.c' +MOCKABLE_H = 'mockable.h' + +YAML_EXTENSION = '.yml' +TEST_PREFIX = 'test_' +MOCK_PREFIX = 'mock_' +H_EXTENSION = '.h' +C_EXTENSION = '.c' + + +class SystemTestGenerator + + def generate_files(test_cases) + test_cases.each do |filename| + yaml_hash = YAML.load_file(filename) + + name = File.basename(filename, YAML_EXTENSION) + namix = "#{name}_" + + generate_cmock_config(yaml_hash, namix) + generate_code(yaml_hash, namix, name) + end + end + + private + + def generate_cmock_config(yaml_hash, namix) + cmock_yaml = yaml_hash.clone + cmock_yaml.delete(:systest) + cmock = cmock_yaml[:cmock] + + cmock[:mock_path] = GENERATED_PATH + cmock[:includes] = (cmock[:includes] || []) + [namix + TYPES_H] + cmock[:mock_prefix] = MOCK_PREFIX + if not yaml_hash[:systest][:unity_helper].nil? + cmock[:includes] << namix + UNITY_HELPER_H + cmock[:unity_helper] = GENERATED_PATH + namix + UNITY_HELPER_H + end + + File.open(GENERATED_PATH + namix + 'cmock' + YAML_EXTENSION, 'w') do |out| + YAML.dump(cmock_yaml, out) + end + end + + def generate_code(yaml_hash, namix, name) + generate_types_file(yaml_hash, namix) + generate_mockable_file(yaml_hash, namix) + generate_unity_helper_files(yaml_hash, namix) + + generate_test_file(yaml_hash, namix, name) + generate_source_file(yaml_hash, namix, name) + end + + def generate_types_file(yaml_hash, namix) + types = yaml_hash[:systest][:types] + return if types.nil? + + write_header_file(GENERATED_PATH + namix + TYPES_H, namix.upcase + 'TYPES_H') do |out| + out.puts(types) + end + end + + def generate_mockable_file(yaml_hash, namix) + mockable = yaml_hash[:systest][:mockable] + return if mockable.nil? + + write_header_file(GENERATED_PATH + namix + MOCKABLE_H, namix.upcase + 'MOCKABLE_H', [namix + TYPES_H]) do |out| + out.puts(mockable) + end + end + + def generate_unity_helper_files(yaml_hash, namix) + unity_helper = yaml_hash[:systest][:unity_helper] + return if unity_helper.nil? + + write_header_file(GENERATED_PATH + namix + UNITY_HELPER_H, namix.upcase + 'UNITY_HELPER_H', [namix + TYPES_H]) do |out| + out.puts(unity_helper[:header]) + end + + write_source_file(GENERATED_PATH + namix + UNITY_HELPER_C, ["unity.h", namix + UNITY_HELPER_H]) do |out| + out.puts(unity_helper[:code]) + end + end + + def generate_test_file(yaml_hash, namix, name) + tests = yaml_hash[:systest][:tests] + return if tests.nil? + + includes = [UNITY_H, CMOCK_H] + includes << (namix + UNITY_HELPER_H) if not yaml_hash[:systest][:unity_helper].nil? + includes << [MOCK_PREFIX + namix + MOCKABLE_H] + includes << [name + H_EXTENSION] + + write_source_file(GENERATED_PATH + TEST_PREFIX + name + C_EXTENSION, includes.flatten) do |out| + out.puts(tests[:common]) + out.puts('') + + tests[:units].each_with_index do |test, index| + out.puts('// should ' + test[:should]) + out.puts(test[:code].gsub!(/test\(\)/, "void test#{index+1}(void)")) + out.puts('') + end + end + end + + def generate_source_file(yaml_hash, namix, name) + source = yaml_hash[:systest][:source] + return if source.nil? + + header_file = name + H_EXTENSION + + includes = yaml_hash[:systest][:types].nil? ? [] : [(namix + TYPES_H)] + + write_header_file(GENERATED_PATH + header_file, name.upcase, includes) do |out| + out.puts(source[:header]) + end + + includes = [] + includes << (namix + TYPES_H) if not yaml_hash[:systest][:types].nil? + includes << (namix + MOCKABLE_H) if not yaml_hash[:systest][:mockable].nil? + includes << header_file + + write_source_file(GENERATED_PATH + name + C_EXTENSION, includes.flatten) do |out| + out.puts(source[:code]) + end + end + + def write_header_file(filename, upcase_name, include_list=[]) + File.open(filename, 'w') do |out| + out.puts("#ifndef _#{upcase_name}") + out.puts("#define _#{upcase_name}") + out.puts('') + include_list.each do |include| + out.puts("#include \"#{include}\"") + end + out.puts('') + yield(out) + out.puts('') + out.puts("#endif // _#{upcase_name}") + out.puts('') + end + end + + def write_source_file(filename, include_list=[]) + File.open(filename, 'w') do |out| + include_list.each do |include| + out.puts("#include \"#{include}\"") + end + out.puts('') + yield(out) + out.puts('') + end + end + +end + + +if ($0 == __FILE__) + SystemTestGenerator.new.generate_files(Dir[CASES_PATH + "*#{YAML_EXTENSION}"]) +end + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_compilation/config.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_compilation/config.yml new file mode 100644 index 0000000..7726699 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_compilation/config.yml @@ -0,0 +1,9 @@ +--- +:cmock: + :plugins: [] + :includes: [] + :mock_path: test/system/generated/ + :mock_prefix: mock_ + :treat_as_void: + - OSEK_TASK + - VOID_TYPE_CRAZINESS diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_compilation/const.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_compilation/const.h new file mode 100644 index 0000000..e17c465 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_compilation/const.h @@ -0,0 +1,15 @@ +/* ========================================== + CMock Project - Automatic Mock Generation for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +struct _DUMMY_T { unsigned int a; float b; }; + +void const_variants1( const char* a, int const, unsigned short const * c ); + +void const_variants2( + struct _DUMMY_T const * const param1, + const unsigned long int const * const param2, + const struct _DUMMY_T const * param3 ); + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_compilation/osek.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_compilation/osek.h new file mode 100644 index 0000000..f3abe7b --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_compilation/osek.h @@ -0,0 +1,275 @@ +/* ========================================== + CMock Project - Automatic Mock Generation for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +typedef unsigned char OSServiceIdType; +typedef void (*OSEKOS_VOIDFUNCPTR)(void); + +typedef unsigned char StatusType; +typedef unsigned char OSEK_U8; +typedef unsigned short OSEK_U16; +typedef unsigned long OSEK_U32; + +void OSEKOSDisableAll(void); +void OSEKOSEnableAll(void); + +typedef unsigned long * OSEKOSSaveType; +typedef void OSEK_TASK; +typedef OSEK_U8 OSEKOSPrioType; + +enum { +Task_DbgCAN +, +Task_ALS +, +CalibrateMagTask +, +Task_IAQ +, +SmartBeam +, +Task_QbertTestImage +, +Task_TestQbertMem +, +Task_Cyclic1000 +, +ProcessMagForCompass +, +ReadMag +, +Task_Cyclic10 +, +Task_Wdm +, +BackgroundTask +, +Task_Cyclic20 +, +Task_Cyclic2 +}; + +OSEK_TASK OSEKOS_T_Task_DbgCAN(void); +OSEK_TASK OSEKOS_T_Task_ALS(void); +OSEK_TASK OSEKOS_T_CalibrateMagTask(void); +OSEK_TASK OSEKOS_T_Task_IAQ(void); +OSEK_TASK OSEKOS_T_SmartBeam(void); +OSEK_TASK OSEKOS_T_Task_QbertTestImage(void); +OSEK_TASK OSEKOS_T_Task_TestQbertMem(void); +OSEK_TASK OSEKOS_T_Task_Cyclic1000(void); +OSEK_TASK OSEKOS_T_ProcessMagForCompass(void); +OSEK_TASK OSEKOS_T_ReadMag(void); +OSEK_TASK OSEKOS_T_Task_Cyclic10(void); +OSEK_TASK OSEKOS_T_Task_Wdm(void); +OSEK_TASK OSEKOS_T_BackgroundTask(void); +OSEK_TASK OSEKOS_T_Task_Cyclic20(void); +OSEK_TASK OSEKOS_T_Task_Cyclic2(void); +OSEK_TASK OSEKOS_Twrap_Task_DbgCAN(void); +OSEK_TASK OSEKOS_Twrap_Task_ALS(void); +OSEK_TASK OSEKOS_Twrap_CalibrateMagTask(void); +OSEK_TASK OSEKOS_Twrap_Task_IAQ(void); +OSEK_TASK OSEKOS_Twrap_SmartBeam(void); +OSEK_TASK OSEKOS_Twrap_Task_QbertTestImage(void); +OSEK_TASK OSEKOS_Twrap_Task_TestQbertMem(void); +OSEK_TASK OSEKOS_Twrap_Task_Cyclic1000(void); +OSEK_TASK OSEKOS_Twrap_ProcessMagForCompass(void); +OSEK_TASK OSEKOS_Twrap_ReadMag(void); +OSEK_TASK OSEKOS_Twrap_Task_Cyclic10(void); +OSEK_TASK OSEKOS_Twrap_Task_Wdm(void); +OSEK_TASK OSEKOS_Twrap_BackgroundTask(void); +OSEK_TASK OSEKOS_Twrap_Task_Cyclic20(void); +OSEK_TASK OSEKOS_Twrap_Task_Cyclic2(void); + +typedef OSEK_U8 TaskType; +typedef OSEK_U8 TaskStateType; +typedef OSEK_U16 EventMaskType; +typedef OSEK_U8 ResourceType; + +void OSEKOSEnableSystemTimers(void); + +typedef OSEK_U8 CounterType; +typedef OSEK_U32 TickType; +typedef OSEK_U8 AlarmType; + +void OSEKOS_ISR_CanTxInterrupt(void); +void OSEKOS_ISR_CanRxInterrupt(void); +void OSEKOS_ISR_CanErrInterrupt(void); +void OSEKOS_ISR_SCIRxInterrupt(void); +void OSEKOS_ISR_SCITxInterrupt(void); +void OSEKOS_ISR_UP_DMA_Interrupt_0(void); +void OSEKOS_ISR_UP_DMA_Interrupt_1(void); +void OSEKOS_ISR_UP_DMA_Interrupt_2(void); +void OSEKOS_ISR_UP_DMA_Interrupt_3(void); +void OSEKOS_ISR_CompFreqHandler(void); +void OSEKOS_ISR_AmbientReturnInt(void); +void OSEKOS_ISR_GlareReturnInt(void); +void OSEKOS_ISR_ALSTimeoutInt(void); +void OSEKOS_ISR_LINTimerInt(void); +void OSEKOS_ISR_LINDelayInt(void); +void OSEKOS_ISR_TimerMExpire(void); +void OSEKOS_ISR_LINRxTx_SCI1(void); +void OSEKOS_ISR_CanRxInterrupt_1(void); +void OSEKOS_ISR_LINError_SCI1(void); +void OSEKOS_ISR_SysCounter(void); + + +// defined multiple times (slightly different forms) These should be ignored because they are externed +extern void OSEKOS_ISR_CanTxInterrupt( void ); +extern void OSEKOS_ISR_CanRxInterrupt( void ); + + +unsigned long OSEKOSrtcGetSeconds ( void ); +void OSEKOSrtcIncrement ( unsigned long nsec ); + +enum +{ + E_OS_ACCESS = 1, + E_OS_CALLEVEL = 2, + E_OS_ID = 3, + E_OS_LIMIT = 4, + E_OS_NOFUNC = 5, + E_OS_RESOURCE = 6, + E_OS_STATE = 7, + E_OS_VALUE = 8, + E_OS_SYS_StackOverflow = 20, + E_OS_SYS_StackUnderflow = 21, + E_OS_SYS_INIT = 22, + E_OS_SYS_CONFIG = 23, + E_OS_SYS_CODE = 24, + E_OS_SYS_TOOL = 25, + E_OS_SYS_TimerRange = 26 +}; + +enum +{ + SUSPENDED = 0x00, + READY = 0x01, + RUNNING = 0x02, + WAITING = 0x03, + INTSTART = 0x08, + SETSTART = 0x10, + NPRTASK = 0x20, + USEFP = 0x40 +}; + +typedef struct +{ + TickType maxallowedvalue; + TickType ticksperbase; +} AlarmBaseType; + +typedef TaskType *TaskRefType; +typedef TaskStateType *TaskStateRefType; +typedef EventMaskType *EventMaskRefType; +typedef TickType *TickRefType; +typedef AlarmBaseType *AlarmBaseRefType; +typedef OSEK_U8 AppModeType; +typedef OSEK_U8 OSEKOSTaskActCntType; + +TaskType OSEKOStidact; +OSEKOSPrioType OSEKOSrunprio; + +StatusType OSEKOSError ( register StatusType ); +void ErrorHook ( StatusType ); +void StartupHook ( void ); +void ShutdownHook ( StatusType ); + +int getUsedTaskStack ( TaskType ); +int getUnusedTaskStack ( TaskType ); +int getUsedIsrStack ( void ); +int getUnusedIsrStack ( void ); +void OSEKOStaskStackCheckInit ( void ); +signed char OSEKOStaskStackCheck ( OSEK_U8 * ); +signed char OSEKOSisrStackCheck ( OSEK_U8 * ); +void OSEKOStaskStackCheckFatal ( OSEK_U8 * ); +void OSEKOSisrStackCheckFatal ( OSEK_U8 * ); +OSEK_U8 * OSEKOSgetStackPointer ( void ); +void OSEKOSTaskSwitch ( void ); +StatusType OSEKOSReturn ( StatusType ); +StatusType OSEKOSActivateTask ( register TaskType ); +void OSEKOSTerminateTask ( TaskType, TaskType ); + + extern void OSEKOSGetResource ( ResourceType ); + extern void OSEKOSReleaseResource ( ResourceType ); + +int OSEKOSSetEvent ( TaskType, EventMaskType ); +int OSEKOSWaitEvent ( EventMaskType ); +TickType OSEKOSGetAlarm(register AlarmType); +void OSEKOSSetAlarm ( AlarmType, TickType, TickType ); +StatusType OSEKOSSetAbsAlarm ( AlarmType a, TickType b, TickType c ); + +StatusType OSEKOSCancelAlarm ( register AlarmType ); +void OSEKOSAdvCntr ( void ); +AppModeType GetActiveApplicationMode ( void ); + +void StartOS ( AppModeType ); + +void OSEKOSShutdownOS ( StatusType ); + +StatusType ActivateTask ( TaskType A ); +StatusType TerminateTask ( void ); +StatusType ChainTask ( TaskType A ); +StatusType GetTaskState ( TaskType A, TaskStateRefType B ); +StatusType GetTaskID ( TaskRefType A ); +StatusType Schedule ( void ); +StatusType GetResource ( ResourceType A ); +StatusType ReleaseResource ( ResourceType A ); +StatusType SetEvent ( TaskType A, EventMaskType B ); +StatusType ClearEvent ( EventMaskType A ); +StatusType WaitEvent ( EventMaskType A ); +StatusType GetEvent ( TaskType A, EventMaskRefType B ); +StatusType GetAlarm ( AlarmType A, TickRefType B ); +StatusType GetAlarmBase ( AlarmType A, AlarmBaseRefType B ); +StatusType SetRelAlarm ( AlarmType A, TickType B, TickType C ); +StatusType SetAbsAlarm ( AlarmType A, TickType B, TickType C ); +StatusType CancelAlarm ( AlarmType A ); +StatusType AdvCntr ( CounterType A ); +StatusType IAdvCntr ( CounterType A ); +void SuspendOSInterrupts ( void ); +void ResumeOSInterrupts ( void ); +void SuspendAllInterrupts ( void ); +void ResumeAllInterrupts ( void ); +void DisableAllInterrupts ( void ); +void EnableAllInterrupts ( void ); + +void OSEKOSDisable(void); +void OSEKOSEnable(void); +void OSEKOSAsmIDispatch(unsigned long *); +void OSEKOSAsmDispatch(OSEKOSPrioType p); +void OSEKOSStartupEnable(void); +void OSEKOSNop(void); +unsigned int OSEKOSV850CheckIsrSwitch(void); +void OSEKOSV850InitInterrupts(void); +void OSEKOSV850SetupInterrupts(); +void OSEKOSV850SyncContextLoad(OSEKOSSaveType); +void OSEKOSV850SyncContextLoadFromIRQ(OSEKOSSaveType); +void OSEKOSV850ASyncContextLoad(OSEKOSSaveType); +void OSEKOSV850ASyncContextLoadFromIRQ(OSEKOSSaveType); + +// arrays of function pointers - they look like function prototypes +void ( ( * const OSEKOStaskStartAddress [10] ) ( void ) ); +StatusType (* OSEKOStaskStatuses [10][5]) ( void ); + +void OSEKOSV850StartContext +( + OSEK_TASK (( * const ) ( void )), + OSEK_U8 * const +); +void OSEKOSV850StartContextFromIRQ +( + OSEK_TASK (( * const ) ( void )), + OSEK_U8 * const +); + +void OSEKOSSuspendOSInterrupts(void); +void OSEKOSResumeOSInterrupts(void); +void OSEKOSSuspendAllInterrupts(void); +void OSEKOSResumeAllInterrupts(void); +void OSEKOScheckSuspendResumeNesting(void); + + +void OSEKOSgetSR(void); +void OSEKOSEnableInterrupt_intern(int nr); +void OSEKOSDisableInterrupt_intern(int nr); diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_compilation/parsing.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_compilation/parsing.h new file mode 100644 index 0000000..e1bcb8b --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_compilation/parsing.h @@ -0,0 +1,47 @@ +/* ========================================== + CMock Project - Automatic Mock Generation for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +typedef unsigned short U16; +typedef signed int int32_t; + +typedef struct _POINT_T +{ + int x; + int y; +} POINT_T; + +// typedef edge case; +// not ANSI C but it has been done and will break cmock if not handled +typedef void VOID_TYPE_CRAZINESS; + +/* fun parsing & mock generation cases */ + +void var_args1(int a, ...); +void var_args2(int a, int b, ...); + +VOID_TYPE_CRAZINESS void_type_craziness1(int, float, double, char, short, long, long int, long long, void*); +int void_type_craziness2( VOID_TYPE_CRAZINESS ); + + void crazy_whitespace ( int lint, double shot , short stack ) ; + +char + crazy_multiline +( + int a, + unsigned int b); + +U16 *ptr_return1(int a); +U16* ptr_return2(int a); +U16 * ptr_return3(int a); + +unsigned int** ptr_ptr_return1(unsigned int** a); +unsigned int* *ptr_ptr_return2(unsigned int* *a); +unsigned int **ptr_ptr_return3(unsigned int **a); +unsigned int ** ptr_ptr_return4(unsigned int ** a); + +extern unsigned long int incredible_descriptors(register const unsigned short a); + +int32_t example_c99_type(int32_t param1); diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/all_plugins_but_other_limits.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/all_plugins_but_other_limits.yml new file mode 100644 index 0000000..052f883 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/all_plugins_but_other_limits.yml @@ -0,0 +1,340 @@ +--- +#this test is different than all_plugins_coexist primarily because of these options +:cmock: + :enforce_strict_ordering: 1 + :treat_externs: :include + :ignore: :args_only + :plugins: + - :array + - :cexception + - :ignore + - :callback + +:systest: + :types: | + typedef struct _POINT_T { + int x; + int y; + } POINT_T; + + :mockable: | + #include "CException.h" + void foo(POINT_T* a); + POINT_T* bar(void); + void fooa(POINT_T a[]); + void foos(const char * a); + extern const char * bars(void); + void no_pointers(int a, char* b); + int mixed(int a, int* b, int c); + + :source: + :header: | + #include "CException.h" + void function_a(void); + void function_b(void); + void function_c(void); + int function_d(void); + void function_e(void); + + :code: | + void function_a(void) + { + foo(bar()); + } + + void function_b(void) { + fooa(bar()); + } + + void function_c(void) { + CEXCEPTION_T e; + Try { + foos(bars()); + } Catch(e) { foos("err"); } + } + + int function_d(void) { + int test_list[] = { 1, 2, 3, 4, 5 }; + no_pointers(1, "silly"); + return mixed(6, test_list, 7); + } + + void function_e(void) { + foos("Hello"); + foos("Tuna"); + foos("Oranges"); + } + + :tests: + :common: | + #include "CException.h" + void setUp(void) {} + void tearDown(void) {} + + :units: + - :pass: TRUE + :should: 'handle the situation where we pass nulls to pointers' + :code: | + test() + { + bar_ExpectAndReturn(NULL); + foo_Expect(NULL); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we expected nulls to pointers but did not get that' + :code: | + test() + { + POINT_T pt = {1, 2}; + bar_ExpectAndReturn(&pt); + foo_Expect(NULL); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we did not expect nulls to pointers but got null' + :code: | + test() + { + POINT_T ex = {1, 2}; + bar_ExpectAndReturn(NULL); + foo_Expect(&ex); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass single object with expect and it is wrong' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 3}; + bar_ExpectAndReturn(&pt); + foo_Expect(&ex); + + function_a(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass single object with expect and use array handler' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 2}; + bar_ExpectAndReturn(&pt); + foo_ExpectWithArray(&ex, 1); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass single object with expect and use array handler and it is wrong' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 3}; + bar_ExpectAndReturn(&pt); + foo_ExpectWithArray(&ex, 1); + + function_a(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass multiple objects with expect and use array handler' + :code: | + test() + { + POINT_T pt[] = {{1, 2}, {3, 4}, {5, 6}}; + POINT_T ex[] = {{1, 2}, {3, 4}, {5, 6}}; + bar_ExpectAndReturn(pt); + foo_ExpectWithArray(ex, 3); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass multiple objects with expect and use array handler and it is wrong at end' + :code: | + test() + { + POINT_T pt[] = {{1, 2}, {3, 4}, {5, 6}}; + POINT_T ex[] = {{1, 2}, {3, 4}, {5, 9}}; + bar_ExpectAndReturn(pt); + foo_ExpectWithArray(ex, 3); + + function_a(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass single array element with expect' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 2}; + bar_ExpectAndReturn(&pt); + fooa_Expect(&ex); + + function_b(); + } + + - :pass: TRUE + :should: 'handle standard c string as null terminated on not do crappy memory compares of a byte, passing' + :code: | + test() + { + bars_ExpectAndReturn("This is a\0 silly string"); + foos_Expect("This is a\0 wacky string"); + + function_c(); + } + + - :pass: FALSE + :should: 'handle standard c string as null terminated on not do crappy memory compares of a byte, finding failures' + :code: | + test() + { + bars_ExpectAndReturn("This is a silly string"); + foos_Expect("This is a wacky string"); + + function_c(); + } + + - :pass: TRUE + :should: 'handle creating array expects when we have mixed arguments for single object' + :code: | + test() + { + int expect_list[] = { 1, 9 }; + no_pointers_Expect(1, "silly"); + mixed_ExpectAndReturn(6, expect_list, 7, 13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: FALSE + :should: 'handle creating array expects when we have mixed arguments and handle failures for single object' + :code: | + test() + { + int expect_list[] = { 9, 1 }; + no_pointers_Expect(1, "silly"); + mixed_ExpectAndReturn(6, expect_list, 7, 13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: TRUE + :should: 'handle creating array expects when we have mixed arguments for multiple objects' + :code: | + test() + { + int expect_list[] = { 1, 2, 3, 4, 6 }; + no_pointers_Expect(1, "silly"); + mixed_ExpectWithArrayAndReturn(6, expect_list, 4, 7, 13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: FALSE + :should: 'handle creating array expects when we have mixed arguments and handle failures for multiple objects' + :code: | + test() + { + int expect_list[] = { 1, 2, 3, 4, 6 }; + no_pointers_Expect(1, "silly"); + mixed_ExpectWithArrayAndReturn(6, expect_list, 5, 7, 13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: TRUE + :should: 'handle an exception being caught' + :code: | + test() + { + bars_ExpectAndReturn("This is a\0 silly string"); + foos_ExpectAndThrow("This is a\0 wacky string", 55); + foos_Expect("err"); + + function_c(); + } + + - :pass: FALSE + :should: 'handle an exception being caught but still catch following errors' + :code: | + test() + { + bars_ExpectAndReturn("This is a\0 silly string"); + foos_ExpectAndThrow("This is a\0 wacky string", 55); + foos_Expect("wrong error"); + + function_c(); + } + + - :pass: FALSE + :should: 'fail strict ordering problems even though we would otherwise have passed' + :code: | + test() + { + int expect_list[] = { 1, 2, 3, 4, 6 }; + mixed_ExpectWithArrayAndReturn(6, expect_list, 4, 7, 13); + no_pointers_Expect(1, "silly"); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: TRUE + :should: 'properly ignore first function but the other will work properly' + :code: | + test() + { + int expect_list[] = { 1, 2, 3, 4, 6 }; + no_pointers_Ignore(); + mixed_ExpectWithArrayAndReturn(6, expect_list, 4, 7, 13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: TRUE + :should: 'properly ignore last function but the other will work properly' + :code: | + test() + { + no_pointers_Expect(1, "silly"); + mixed_IgnoreAndReturn(13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: TRUE + :should: 'be ok if we ignore a call each because we are counting calls' + :code: | + test() + { + foos_Ignore(); + foos_Ignore(); + foos_Ignore(); + + function_e(); + } + + - :pass: FALSE + :should: 'fail if we do not ignore a call once because we are counting calls' + :code: | + test() + { + foos_Ignore(); + foos_Ignore(); + + function_e(); + } + +... diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/all_plugins_coexist.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/all_plugins_coexist.yml new file mode 100644 index 0000000..b76859f --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/all_plugins_coexist.yml @@ -0,0 +1,381 @@ +--- +:cmock: + :enforce_strict_ordering: 1 + :plugins: + - :array + - :cexception + - :ignore + - :callback + :callback_after_arg_check: true + #:callback_include_count: false + :treat_externs: :include + +:systest: + :types: | + typedef struct _POINT_T { + int x; + int y; + } POINT_T; + + :mockable: | + #include "CException.h" + extern void foo(POINT_T* a); + POINT_T* bar(void); + void fooa(POINT_T a[]); + void foos(const char * a); + const char * bars(void); + void no_pointers(int a, char* b); + int mixed(int a, int* b, int c); + + :source: + :header: | + #include "CException.h" + void function_a(void); + void function_b(void); + void function_c(void); + int function_d(void); + void function_e(void); + + :code: | + void function_a(void) + { + foo(bar()); + } + + void function_b(void) { + fooa(bar()); + } + + void function_c(void) { + CEXCEPTION_T e; + Try { + foos(bars()); + } Catch(e) { foos("err"); } + } + + int function_d(void) { + int test_list[] = { 1, 2, 3, 4, 5 }; + no_pointers(1, "silly"); + return mixed(6, test_list, 7); + } + + void function_e(void) { + foos("Hello"); + foos("Tuna"); + foos("Oranges"); + } + + :tests: + :common: | + #include "CException.h" + void setUp(void) {} + void tearDown(void) {} + void my_foo_callback(POINT_T* a) { TEST_ASSERT_EQUAL_INT(2, a->x); } + + :units: + - :pass: TRUE + :should: 'handle the situation where we pass nulls to pointers' + :code: | + test() + { + bar_ExpectAndReturn(NULL); + foo_Expect(NULL); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we expected nulls to pointers but did not get that' + :code: | + test() + { + POINT_T pt = {1, 2}; + bar_ExpectAndReturn(&pt); + foo_Expect(NULL); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we did not expect nulls to pointers but got null' + :code: | + test() + { + POINT_T ex = {1, 2}; + bar_ExpectAndReturn(NULL); + foo_Expect(&ex); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass single object with expect and it is wrong' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 3}; + bar_ExpectAndReturn(&pt); + foo_Expect(&ex); + + function_a(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass single object with expect and use array handler' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 2}; + bar_ExpectAndReturn(&pt); + foo_ExpectWithArray(&ex, 1); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass single object with expect and use array handler and it is wrong' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 3}; + bar_ExpectAndReturn(&pt); + foo_ExpectWithArray(&ex, 1); + + function_a(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass multiple objects with expect and use array handler' + :code: | + test() + { + POINT_T pt[] = {{1, 2}, {3, 4}, {5, 6}}; + POINT_T ex[] = {{1, 2}, {3, 4}, {5, 6}}; + bar_ExpectAndReturn(pt); + foo_ExpectWithArray(ex, 3); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass multiple objects with expect and use array handler and it is wrong at end' + :code: | + test() + { + POINT_T pt[] = {{1, 2}, {3, 4}, {5, 6}}; + POINT_T ex[] = {{1, 2}, {3, 4}, {5, 9}}; + bar_ExpectAndReturn(pt); + foo_ExpectWithArray(ex, 3); + + function_a(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass single array element with expect' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 2}; + bar_ExpectAndReturn(&pt); + fooa_Expect(&ex); + + function_b(); + } + + - :pass: TRUE + :should: 'handle standard c string as null terminated on not do crappy memory compares of a byte, passing' + :code: | + test() + { + bars_ExpectAndReturn("This is a\0 silly string"); + foos_Expect("This is a\0 wacky string"); + + function_c(); + } + + - :pass: FALSE + :should: 'handle standard c string as null terminated on not do crappy memory compares of a byte, finding failures' + :code: | + test() + { + bars_ExpectAndReturn("This is a silly string"); + foos_Expect("This is a wacky string"); + + function_c(); + } + + - :pass: TRUE + :should: 'handle creating array expects when we have mixed arguments for single object' + :code: | + test() + { + int expect_list[] = { 1, 9 }; + no_pointers_Expect(1, "silly"); + mixed_ExpectAndReturn(6, expect_list, 7, 13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: FALSE + :should: 'handle creating array expects when we have mixed arguments and handle failures for single object' + :code: | + test() + { + int expect_list[] = { 9, 1 }; + no_pointers_Expect(1, "silly"); + mixed_ExpectAndReturn(6, expect_list, 7, 13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: TRUE + :should: 'handle creating array expects when we have mixed arguments for multiple objects' + :code: | + test() + { + int expect_list[] = { 1, 2, 3, 4, 6 }; + no_pointers_Expect(1, "silly"); + mixed_ExpectWithArrayAndReturn(6, expect_list, 4, 7, 13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: FALSE + :should: 'handle creating array expects when we have mixed arguments and handle failures for multiple objects' + :code: | + test() + { + int expect_list[] = { 1, 2, 3, 4, 6 }; + no_pointers_Expect(1, "silly"); + mixed_ExpectWithArrayAndReturn(6, expect_list, 5, 7, 13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: TRUE + :should: 'handle an exception being caught' + :code: | + test() + { + bars_ExpectAndReturn("This is a\0 silly string"); + foos_ExpectAndThrow("This is a\0 wacky string", 55); + foos_Expect("err"); + + function_c(); + } + + - :pass: FALSE + :should: 'handle an exception being caught but still catch following errors' + :code: | + test() + { + bars_ExpectAndReturn("This is a\0 silly string"); + foos_ExpectAndThrow("This is a\0 wacky string", 55); + foos_Expect("wrong error"); + + function_c(); + } + + - :pass: FALSE + :should: 'fail strict ordering problems even though we would otherwise have passed' + :code: | + test() + { + int expect_list[] = { 1, 2, 3, 4, 6 }; + mixed_ExpectWithArrayAndReturn(6, expect_list, 4, 7, 13); + no_pointers_Expect(1, "silly"); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: TRUE + :should: 'that we can properly ignore last function but the other will work properly' + :code: | + test() + { + int expect_list[] = { 1, 2, 3, 4, 6 }; + mixed_ExpectWithArrayAndReturn(6, expect_list, 4, 7, 13); + no_pointers_Ignore(); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: TRUE + :should: 'that we can properly ignore first function but the other will work properly' + :code: | + test() + { + mixed_IgnoreAndReturn(13); + no_pointers_Expect(1, "silly"); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: TRUE + :should: 'that we just have to ignore a call once because we are not counting calls' + :code: | + test() + { + foos_Ignore(); + + function_e(); + } + + - :pass: TRUE + :should: 'that we can use a callback and an expect' + :code: | + test() + { + POINT_T pt1 = {2, 3}; + POINT_T pt2 = {2, 3}; + bar_ExpectAndReturn(&pt1); + foo_Expect(&pt2); + foo_StubWithCallback((CMOCK_foo_CALLBACK)my_foo_callback); + + function_a(); + } + + - :pass: FALSE + :should: 'that we can fail even when using a callback if we want to expect call but did not and we are checking that' + :code: | + test() + { + POINT_T pt = {2, 3}; + bar_ExpectAndReturn(&pt); + foo_StubWithCallback((CMOCK_foo_CALLBACK)my_foo_callback); + + function_a(); + } + + - :pass: FALSE + :should: 'that we can fail even when using a callback if args are wrong and we are checking those' + :code: | + test() + { + POINT_T pt1 = {2, 3}; + POINT_T pt2 = {1, 3}; + bar_ExpectAndReturn(&pt1); + foo_Expect(&pt2); + foo_StubWithCallback((CMOCK_foo_CALLBACK)my_foo_callback); + + function_a(); + } + + - :pass: FALSE + :should: 'that we can fail from the callback itself' + :code: | + test() + { + POINT_T pt = {3, 3}; + bar_ExpectAndReturn(&pt); + foo_Expect(&pt); + foo_StubWithCallback((CMOCK_foo_CALLBACK)my_foo_callback); + + function_a(); + } + +... diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/array_and_pointer_handling.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/array_and_pointer_handling.yml new file mode 100644 index 0000000..dfa7d10 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/array_and_pointer_handling.yml @@ -0,0 +1,382 @@ +--- +:cmock: + :when_ptr: :smart + :plugins: + - :array + +:systest: + :types: | + typedef struct _POINT_T { + int x; + int y; + } POINT_T; + #define ARRAY_A_SIZE (5) + + :mockable: | + void foo(POINT_T* a); + POINT_T* bar(void); + void fooa(POINT_T a[ARRAY_A_SIZE+1-1]); + void foos(const char * a); + const char * bars(void); + void no_pointers(int a, char* b); + int mixed(int a, int* b, int c); + void potential_packing_problem(short *a); + + :source: + :header: | + void function_a(void); + void function_b(void); + void function_c(void); + int function_d(void); + void function_e(void); + + :code: | + void function_a(void) + { + foo(bar()); + } + + void function_b(void) { + fooa(bar()); + } + + void function_c(void) { + foos(bars()); + } + + int function_d(void) { + int test_list[] = { 1, 2, 3, 4, 5 }; + no_pointers(1, "silly"); + return mixed(6, test_list, 7); + } + + void function_e(void) { + short test_list[] = {-1, -2, -3, -4}; + potential_packing_problem(&test_list[1]); + } + + :tests: + :common: | + void setUp(void) {} + void tearDown(void) {} + + :units: + - :pass: TRUE + :should: 'handle the situation where we pass nulls to pointers' + :code: | + test() + { + bar_ExpectAndReturn(NULL); + foo_Expect(NULL); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we expected nulls to pointers but did not get that' + :code: | + test() + { + POINT_T pt = {1, 2}; + bar_ExpectAndReturn(&pt); + foo_Expect(NULL); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we did not expect nulls to pointers but got null' + :code: | + test() + { + POINT_T ex = {1, 2}; + bar_ExpectAndReturn(NULL); + foo_Expect(&ex); + + function_a(); + } + + - :pass: TRUE + :should: 'handle the situation where it falls back to pointers because you asked it to compare 0 elements' + :code: | + test() + { + POINT_T ex = {1, 2}; + bar_ExpectAndReturn(&ex); + foo_ExpectWithArray(&ex, 0); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where it fails because you asked it to compare zero elements and the pointers do not match' + :code: | + test() + { + POINT_T ex = {1, 2}; + POINT_T pt = {1, 2}; + bar_ExpectAndReturn(&pt); + foo_ExpectWithArray(&ex, 0); + + function_a(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass single object with expect' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 2}; + bar_ExpectAndReturn(&pt); + foo_Expect(&ex); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass single object with expect and it is wrong' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 3}; + bar_ExpectAndReturn(&pt); + foo_Expect(&ex); + + function_a(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass single object with expect and use array handler' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 2}; + bar_ExpectAndReturn(&pt); + foo_ExpectWithArray(&ex, 1); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass single object with expect and use array handler and it is wrong' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 3}; + bar_ExpectAndReturn(&pt); + foo_ExpectWithArray(&ex, 1); + + function_a(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass multiple objects with expect and use array handler' + :code: | + test() + { + POINT_T pt[] = {{1, 2}, {3, 4}, {5, 6}}; + POINT_T ex[] = {{1, 2}, {3, 4}, {5, 6}}; + bar_ExpectAndReturn(pt); + foo_ExpectWithArray(ex, 3); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass multiple objects with expect and use array handler and it is wrong at start' + :code: | + test() + { + POINT_T pt[] = {{1, 2}, {3, 4}, {5, 6}}; + POINT_T ex[] = {{9, 2}, {3, 4}, {5, 6}}; + bar_ExpectAndReturn(pt); + foo_ExpectWithArray(ex, 3); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass multiple objects with expect and use array handler and it is wrong at end' + :code: | + test() + { + POINT_T pt[] = {{1, 2}, {3, 4}, {5, 6}}; + POINT_T ex[] = {{1, 2}, {3, 4}, {5, 9}}; + bar_ExpectAndReturn(pt); + foo_ExpectWithArray(ex, 3); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass multiple objects with expect and use array handler and it is wrong in middle' + :code: | + test() + { + POINT_T pt[] = {{1, 2}, {3, 4}, {5, 6}}; + POINT_T ex[] = {{1, 2}, {3, 9}, {5, 6}}; + bar_ExpectAndReturn(pt); + foo_ExpectWithArray(ex, 3); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass nulls to pointers and fail' + :code: | + test() + { + POINT_T pt = {1, 2}; + bar_ExpectAndReturn(&pt); + foo_Expect(NULL); + + function_a(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass nulls to arrays' + :code: | + test() + { + bar_ExpectAndReturn(NULL); + fooa_Expect(NULL); + + function_b(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass single array element with expect' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 2}; + bar_ExpectAndReturn(&pt); + fooa_Expect(&ex); + + function_b(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass single array element with expect and it is wrong' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 3}; + bar_ExpectAndReturn(&pt); + fooa_Expect(&ex); + + function_b(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass nulls to arrays and fail' + :code: | + test() + { + POINT_T pt = {1, 2}; + bar_ExpectAndReturn(&pt); + fooa_Expect(NULL); + + function_b(); + } + + - :pass: TRUE + :should: 'handle standard c string as null terminated on not do crappy memory compares of a byte, passing' + :code: | + test() + { + bars_ExpectAndReturn("This is a\0 silly string"); + foos_Expect("This is a\0 wacky string"); + + function_c(); + } + + - :pass: FALSE + :should: 'handle standard c string as null terminated on not do crappy memory compares of a byte, finding failures' + :code: | + test() + { + bars_ExpectAndReturn("This is a silly string"); + foos_Expect("This is a wacky string"); + + function_c(); + } + + - :pass: TRUE + :should: 'handle creating array expects when we have mixed arguments for single object' + :code: | + test() + { + int expect_list[] = { 1, 9 }; + no_pointers_Expect(1, "silly"); + mixed_ExpectAndReturn(6, expect_list, 7, 13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: FALSE + :should: 'handle creating array expects when we have mixed arguments and handle failures for single object' + :code: | + test() + { + int expect_list[] = { 9, 1 }; + no_pointers_Expect(1, "silly"); + mixed_ExpectAndReturn(6, expect_list, 7, 13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: TRUE + :should: 'handle creating array expects when we have mixed arguments for multiple objects' + :code: | + test() + { + int expect_list[] = { 1, 2, 3, 4, 6 }; + no_pointers_Expect(1, "silly"); + mixed_ExpectWithArrayAndReturn(6, expect_list, 4, 7, 13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: FALSE + :should: 'handle creating array expects when we have mixed arguments and handle failures for multiple objects' + :code: | + test() + { + int expect_list[] = { 1, 2, 3, 4, 6 }; + no_pointers_Expect(1, "silly"); + mixed_ExpectWithArrayAndReturn(6, expect_list, 5, 7, 13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: TRUE + :should: 'handle a passing version of a potential packing problem (particularly try with ARM simulators)' + :code: | + test() + { + short expect_list[] = { -2, -3, -4 }; + potential_packing_problem_ExpectWithArray(expect_list, 3); + + function_e(); + } + + - :pass: FALSE + :should: 'handle a failing version of a potential packing problem (particularly try with ARM simulators)' + :code: | + test() + { + short expect_list[] = { -2, -3, 4 }; + potential_packing_problem_ExpectWithArray(expect_list, 3); + + function_e(); + } + + +... diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/basic_expect_and_return.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/basic_expect_and_return.yml new file mode 100644 index 0000000..ecd6b2c --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/basic_expect_and_return.yml @@ -0,0 +1,123 @@ +--- +:cmock: + :plugins: + - # none + +:systest: + :types: | + #define UINT32 unsigned int + + typedef signed int custom_type; + + :mockable: | + UINT32 foo(custom_type a); + UINT32 bar(custom_type b); + UINT32 foo_varargs(custom_type a, ...); + char* foo_char_strings(char a[], char* b); + + :source: + :header: | + UINT32 function_a(int a, int b); + void function_b(void); + UINT32 function_c(int a); + char* function_d(char a[], char* b); + + :code: | + UINT32 function_a(int a, int b) + { + return foo((custom_type)a) + bar((custom_type)b); + } + + void function_b(void) { } + + UINT32 function_c(int a) + { + return foo_varargs((custom_type)a, "ignored", 5); + } + + char* function_d(char a[], char* b) + { + return foo_char_strings(a, b); + } + + :tests: + :common: | + void setUp(void) {} + void tearDown(void) {} + + :units: + - :pass: TRUE + :should: 'successfully exercise two simple ExpectAndReturn mock calls' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + bar_ExpectAndReturn((custom_type)2, 20); + TEST_ASSERT_EQUAL(30, function_a(1, 2)); + } + + - :pass: FALSE + :should: 'fail because bar() is not called but is expected' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + TEST_ASSERT_EQUAL(30, function_a(1, 2)); + } + + - :pass: FALSE + :should: 'fail because bar() is called but is not expected' + :code: | + test() + { + bar_ExpectAndReturn((custom_type)1, 10); + function_b(); + } + + - :pass: TRUE + :should: 'consume var args passed to mocked function' + :code: | + test() + { + foo_varargs_ExpectAndReturn((custom_type)3, 10); + TEST_ASSERT_EQUAL(10, function_c(3)); + } + + - :pass: TRUE + :should: 'handle char strings' + :code: | + test() + { + foo_char_strings_ExpectAndReturn("larry", "curly", "moe"); + TEST_ASSERT_EQUAL_STRING("moe", function_d("larry", "curly")); + } + + - :pass: TRUE + :should: 'successfully exercise multiple cycles of expecting and mocking and pass' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + bar_ExpectAndReturn((custom_type)2, 20); + TEST_ASSERT_EQUAL(30, function_a(1, 2)); + + foo_ExpectAndReturn((custom_type)3, 30); + bar_ExpectAndReturn((custom_type)4, 40); + TEST_ASSERT_EQUAL(70, function_a(3, 4)); + } + + - :pass: FALSE + :should: 'successfully exercise multiple cycles of expecting and mocking and fail' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + bar_ExpectAndReturn((custom_type)2, 20); + TEST_ASSERT_EQUAL(30, function_a(1, 2)); + + foo_ExpectAndReturn((custom_type)3, 30); + bar_ExpectAndReturn((custom_type)4, 40); + TEST_ASSERT_EQUAL(70, function_a(3, 5)); + } + +... diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/const_primitives_handling.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/const_primitives_handling.yml new file mode 100644 index 0000000..2fc1b21 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/const_primitives_handling.yml @@ -0,0 +1,87 @@ +--- +:cmock: + :plugins: + - # none + +:systest: + :types: | + + :mockable: | + // no argument names + void foo(char const*, char* const, const char*); + + // argument names + void bar(char const* param1, char* const param2, const char* param3); + + :source: + :header: | + void exercise_const1(char const* param1, char* const param2, const char* param3); + void exercise_const2(char const* param1, char* const param2, const char* param3); + + :code: | + char value1 = '1'; + char value2 = '2'; + + const char* A = &value1; + char* const B = &value2; + const char* C = "C"; + const char* D = "D"; + + void exercise_const1(char const* param1, char* const param2, const char* param3) + { + foo(param1, param2, param3); + } + + void exercise_const2(char const* param1, char* const param2, const char* param3) + { + bar(param1, param2, param3); + } + + :tests: + :common: | + extern const char* A; + extern char* const B; + extern const char* C; + extern const char* D; + + void setUp(void) {} + void tearDown(void) {} + :units: + - :pass: TRUE + :should: 'successfully pass several const parameters' + :code: | + test() + { + foo_Expect( A, B, C ); + exercise_const1( A, B, C ); + } + + - :pass: FALSE + :should: 'should fail upon wrong const arguments passed' + :code: | + test() + { + foo_Expect( A, B, C ); + exercise_const1( (const char*)B, (char * const)A, C ); + } + + - :pass: FALSE + :should: 'should fail upon wrong const arguments passed' + :code: | + test() + { + foo_Expect( A, B, C ); + exercise_const1( A, B, D ); + } + + - :pass: FALSE + :should: 'should fail upon wrong const arguments passed' + :code: | + test() + { + bar_Expect( A, B, C ); + exercise_const2( A, (char * const)C, (const char *)B ); + } + + +... diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/enforce_strict_ordering.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/enforce_strict_ordering.yml new file mode 100644 index 0000000..61e2999 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/enforce_strict_ordering.yml @@ -0,0 +1,247 @@ +--- +:cmock: + :enforce_strict_ordering: 1 + :plugins: + - :ignore + - :cexception + +:systest: + :types: | + #define UINT32 unsigned int + + typedef signed int custom_type; + + :mockable: | + #include "CException.h" + UINT32 foo(custom_type a); + UINT32 bar(custom_type b); + void baz(custom_type c); + + :source: + :header: | + #include "CException.h" + UINT32 function_a(int a, int b); + void function_b(void); + void function_c(void); + void function_d(void); + + :code: | + UINT32 function_a(int a, int b) + { + return foo((custom_type)a) + bar((custom_type)b); + } + + void function_b(void) + { + baz((custom_type)1); + foo((custom_type)2); + bar((custom_type)3); + baz((custom_type)4); + foo((custom_type)5); + bar((custom_type)6); + baz((custom_type)7); + } + + void function_c(void) + { + foo((custom_type)1); + foo((custom_type)2); + bar((custom_type)3); + bar((custom_type)4); + foo((custom_type)5); + } + + void function_d(void) + { + CEXCEPTION_T e; + Try + { + foo((custom_type)1); + } + Catch(e) {} + Try + { + bar((custom_type)2); + } + Catch(e) {} + Try + { + foo((custom_type)3); + } + Catch(e) {} + } + + :tests: + :common: | + #include "CException.h" + void setUp(void) {} + void tearDown(void) {} + + :units: + - :pass: TRUE + :should: 'successfully exercise two simple ExpectAndReturn mock calls' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + bar_ExpectAndReturn((custom_type)2, 20); + TEST_ASSERT_EQUAL(30, function_a(1, 2)); + } + + - :pass: FALSE + :should: 'fail because bar() is called but is not expected' + :verify_error: 'called more times than expected' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + TEST_ASSERT_EQUAL(30, function_a(1, 2)); + } + + - :pass: FALSE + :should: 'fail because bar() is called twice but is expected once' + :verify_error: 'called less times than expected' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + bar_ExpectAndReturn((custom_type)2, 20); + bar_ExpectAndReturn((custom_type)3, 30); + TEST_ASSERT_EQUAL(30, function_a(1, 2)); + } + + - :pass: FALSE + :should: 'fail because bar and foo called in reverse order' + :verify_error: 'called earlier than expected' + :code: | + test() + { + bar_ExpectAndReturn((custom_type)2, 20); + foo_ExpectAndReturn((custom_type)1, 10); + TEST_ASSERT_EQUAL(30, function_a(1, 2)); + } + + - :pass: TRUE + :should: 'pass because bar and foo called in order with multiple params' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + foo_ExpectAndReturn((custom_type)2, 10); + bar_ExpectAndReturn((custom_type)3, 20); + bar_ExpectAndReturn((custom_type)4, 10); + foo_ExpectAndReturn((custom_type)5, 10); + function_c(); + } + + - :pass: FALSE + :should: 'fail because bar and foo called out of order at end' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + foo_ExpectAndReturn((custom_type)2, 10); + bar_ExpectAndReturn((custom_type)3, 20); + foo_ExpectAndReturn((custom_type)5, 10); + bar_ExpectAndReturn((custom_type)4, 10); + function_c(); + } + + - :pass: FALSE + :should: 'fail because bar and foo called out of order at start' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)2, 10); + foo_ExpectAndReturn((custom_type)1, 10); + bar_ExpectAndReturn((custom_type)3, 20); + bar_ExpectAndReturn((custom_type)4, 10); + foo_ExpectAndReturn((custom_type)5, 10); + function_c(); + } + + - :pass: TRUE + :should: 'pass because we are properly ignoring baz' + :code: | + test() + { + baz_Ignore(); + foo_ExpectAndReturn((custom_type)2, 10); + bar_ExpectAndReturn((custom_type)3, 20); + foo_ExpectAndReturn((custom_type)5, 10); + bar_ExpectAndReturn((custom_type)6, 10); + function_b(); + } + + - :pass: FALSE + :should: 'fail because bar and foo out of order, even though baz is ignored' + :code: | + test() + { + baz_Ignore(); + foo_ExpectAndReturn((custom_type)2, 10); + foo_ExpectAndReturn((custom_type)5, 10); + bar_ExpectAndReturn((custom_type)3, 20); + bar_ExpectAndReturn((custom_type)6, 10); + function_b(); + } + + - :pass: TRUE + :should: 'pass when using cexception, as long as the order is right' + :code: | + test() + { + foo_ExpectAndThrow((custom_type)1, 10); + bar_ExpectAndReturn((custom_type)2, 20); + foo_ExpectAndReturn((custom_type)3, 10); + function_d(); + } + + - :pass: FALSE + :should: 'fail when an throw call is made out of order' + :code: | + test() + { + bar_ExpectAndReturn((custom_type)2, 20); + foo_ExpectAndThrow((custom_type)1, 10); + foo_ExpectAndReturn((custom_type)3, 10); + function_d(); + } + + - :pass: TRUE + :should: 'successfully handle back to back ExpectAndReturn setup and mock calls' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + bar_ExpectAndReturn((custom_type)2, 20); + TEST_ASSERT_EQUAL(30, function_a(1, 2)); + + foo_ExpectAndReturn((custom_type)3, 30); + bar_ExpectAndReturn((custom_type)4, 40); + TEST_ASSERT_EQUAL(70, function_a(3, 4)); + + foo_ExpectAndReturn((custom_type)1, 50); + bar_ExpectAndReturn((custom_type)9, 60); + TEST_ASSERT_EQUAL(110, function_a(1, 9)); + } + + - :pass: FALSE + :should: 'successfully catch errors during back to back ExpectAndReturn setup and mock calls' + :verify_error: 'called earlier than expected' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + bar_ExpectAndReturn((custom_type)2, 20); + TEST_ASSERT_EQUAL(30, function_a(1, 2)); + + foo_ExpectAndReturn((custom_type)3, 30); + bar_ExpectAndReturn((custom_type)4, 40); + TEST_ASSERT_EQUAL(70, function_a(3, 4)); + + bar_ExpectAndReturn((custom_type)9, 60); + foo_ExpectAndReturn((custom_type)1, 50); + TEST_ASSERT_EQUAL(110, function_a(1, 9)); + } +... diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/expect_and_return_custom_types.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/expect_and_return_custom_types.yml new file mode 100644 index 0000000..f5b13a3 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/expect_and_return_custom_types.yml @@ -0,0 +1,108 @@ +--- +:cmock: + :plugins: + - # none + :memcmp_if_unknown: false + +:systest: + :types: | + typedef struct _EXAMPLE_STRUCT_T { int x; int y; } EXAMPLE_STRUCT_T; + + :mockable: | + EXAMPLE_STRUCT_T foo(EXAMPLE_STRUCT_T a); + + :source: + :header: | + EXAMPLE_STRUCT_T function_a(EXAMPLE_STRUCT_T a, EXAMPLE_STRUCT_T b); + EXAMPLE_STRUCT_T function_b(EXAMPLE_STRUCT_T a, EXAMPLE_STRUCT_T b); + + :code: | + EXAMPLE_STRUCT_T function_a(EXAMPLE_STRUCT_T a, EXAMPLE_STRUCT_T b) + { + EXAMPLE_STRUCT_T retval = foo(a); + retval.x += b.x; + retval.y += b.y; + return retval; + } + + EXAMPLE_STRUCT_T function_b(EXAMPLE_STRUCT_T a, EXAMPLE_STRUCT_T b) + { + EXAMPLE_STRUCT_T retval = foo(b); + retval.x *= a.x; + retval.y *= a.y; + return retval; + } + + :tests: + :common: | + #include "expect_and_return_custom_types_unity_helper.h" + void setUp(void) {} + void tearDown(void) {} + + :units: + - :pass: TRUE + :should: 'successfully exercise simple ExpectAndReturn mock calls' + :code: | + test() + { + EXAMPLE_STRUCT_T c = {1,2}; + EXAMPLE_STRUCT_T d = {3,4}; + EXAMPLE_STRUCT_T e = {2,4}; + EXAMPLE_STRUCT_T f = {5,8}; + foo_ExpectAndReturn(c, e); + TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(f, function_a(c,d)); + } + + - :pass: FALSE + :should: 'fail because it is expecting to call foo with c not d' + :code: | + test() + { + EXAMPLE_STRUCT_T c = {1,2}; + EXAMPLE_STRUCT_T d = {3,4}; + EXAMPLE_STRUCT_T e = {2,4}; + EXAMPLE_STRUCT_T f = {5,8}; + foo_ExpectAndReturn(d, e); + TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(f, function_a(c,d)); + } + + - :pass: TRUE + :should: 'successfully exercise simple ExpectAndReturn mock calls on other function' + :code: | + test() + { + EXAMPLE_STRUCT_T c = {1,2}; + EXAMPLE_STRUCT_T d = {3,4}; + EXAMPLE_STRUCT_T e = {2,4}; + EXAMPLE_STRUCT_T f = {2,8}; + foo_ExpectAndReturn(d, e); + TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(f, function_b(c,d)); + } + + - :pass: FALSE + :should: 'fail because it is expecting to call foo with d not c' + :code: | + test() + { + EXAMPLE_STRUCT_T c = {1,2}; + EXAMPLE_STRUCT_T d = {3,4}; + EXAMPLE_STRUCT_T e = {2,4}; + EXAMPLE_STRUCT_T f = {2,8}; + foo_ExpectAndReturn(c, e); + TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(f, function_b(c,d)); + } + + :unity_helper: + :header: | + void AssertEqualExampleStruct(EXAMPLE_STRUCT_T expected, EXAMPLE_STRUCT_T actual, unsigned short line); + #define UNITY_TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(expected, actual, line, message) {AssertEqualExampleStruct(expected, actual, line);} + #define TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(expected, actual) UNITY_TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(expected, actual, __LINE__, NULL); + + :code: | + void AssertEqualExampleStruct(EXAMPLE_STRUCT_T expected, EXAMPLE_STRUCT_T actual, unsigned short line) + { + UNITY_TEST_ASSERT_EQUAL_INT(expected.x, actual.x, line, "Example Struct Failed For Field x"); + UNITY_TEST_ASSERT_EQUAL_INT(expected.y, actual.y, line, "Example Struct Failed For Field y"); + } + +... diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/expect_and_return_treat_as.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/expect_and_return_treat_as.yml new file mode 100644 index 0000000..2a73273 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/expect_and_return_treat_as.yml @@ -0,0 +1,173 @@ +--- +:cmock: + :plugins: + - # none + :treat_as: + MY_STRING: STRING + MY_INT: INT + PTR_INT: INT* + MY_HEX: HEX32 + +:systest: + :types: | + typedef char* MY_STRING; + typedef int MY_INT; + typedef unsigned int MY_HEX; + typedef int* PTR_INT; + + :mockable: | + MY_INT foo(MY_HEX a); + MY_INT bar(MY_HEX b); + MY_STRING foo_char_strings(MY_STRING a, MY_STRING b); + float float_adder(float a, float b); + MY_INT* pointer_foo(MY_HEX* a); + void pointer_bar(PTR_INT a); + + :source: + :header: | + MY_INT function_a(MY_INT a, MY_INT b); + MY_STRING function_b(MY_STRING a, MY_STRING b); + float function_c(float a, float b); + MY_INT function_d(MY_HEX a); + void function_e(PTR_INT a); + + :code: | + MY_INT function_a(MY_INT a, MY_INT b) + { + return foo((MY_HEX)a) + bar((MY_HEX)b); + } + + MY_STRING function_b(MY_STRING a, MY_STRING b) + { + return foo_char_strings(a, b); + } + + float function_c(float a, float b) + { + return float_adder(b, a); + } + + MY_INT function_d(MY_HEX a) + { + MY_HEX b = a; + MY_INT* c = pointer_foo(&b); + return *c; + } + + void function_e(PTR_INT a) + { + pointer_bar(a); + } + + :tests: + :common: | + void setUp(void) {} + void tearDown(void) {} + + :units: + - :pass: TRUE + :should: 'successfully exercise two simple ExpectAndReturn mock calls' + :code: | + test() + { + foo_ExpectAndReturn((MY_HEX)1, 10); + bar_ExpectAndReturn((MY_HEX)2, 20); + TEST_ASSERT_EQUAL(30, function_a(1, 2)); + } + + - :pass: FALSE + :should: 'fail because bar() is expected but not called' + :code: | + test() + { + foo_ExpectAndReturn((MY_HEX)1, 10); + TEST_ASSERT_EQUAL(30, function_a(1, 2)); + } + + - :pass: FALSE + :should: 'fail because foo_char_strings() is called but is not expected' + :code: | + test() + { + foo_char_strings_ExpectAndReturn((MY_STRING)"jello", (MY_STRING)"jiggle", (MY_STRING)"boing!"); + function_a(1,2); + } + + - :pass: TRUE + :should: 'handle char strings' + :code: | + test() + { + foo_char_strings_ExpectAndReturn((MY_STRING)"jello", (MY_STRING)"jiggle", (MY_STRING)"boing!"); + TEST_ASSERT_EQUAL_STRING("boing!", function_b((MY_STRING)"jello", (MY_STRING)"jiggle")); + } + + - :pass: TRUE + :should: 'handle floating point numbers with Unity support: pass' + :code: | + test() + { + float_adder_ExpectAndReturn(1.2345, 6.7890, 8.0235); + TEST_ASSERT_EQUAL_FLOAT(8.0235, function_c(6.7890, 1.2345)); + } + + - :pass: FALSE + :should: 'handle floating point numbers with Unity support: fail' + :code: | + test() + { + float_adder_ExpectAndReturn(1.2345, 6.7892, 8.0235); + TEST_ASSERT_EQUAL_FLOAT(8.0235, function_c(6.7890, 1.2345)); + } + + - :pass: TRUE + :should: 'handle pointers to treat_as values just as cleanly as the treat_as itself for passes' + :code: | + test() + { + MY_HEX TestHex = (MY_HEX)45; + MY_INT TestInt = (MY_INT)33; + pointer_foo_ExpectAndReturn(&TestHex, &TestInt); + TEST_ASSERT_EQUAL_INT(33, function_d(45)); + } + + - :pass: FALSE + :should: 'handle pointers to treat_as values just as cleanly as the treat_as itself for failures' + :verify_error: 'Element 0 Expected 0x0000002D Was 0x0000002B' + :code: | + test() + { + MY_HEX TestHex = (MY_HEX)45; + MY_INT TestInt = (MY_INT)33; + pointer_foo_ExpectAndReturn(&TestHex, &TestInt); + TEST_ASSERT_EQUAL_INT(33, function_d(43)); + } + + - :pass: TRUE + :should: 'handle treat_as values containing pointers for passes' + :code: | + test() + { + MY_INT ExpInt = (MY_INT)33; + PTR_INT ExpPtr = (PTR_INT)(&ExpInt); + MY_INT ActInt = (MY_INT)33; + PTR_INT ActPtr = (PTR_INT)(&ActInt); + pointer_bar_Expect(ExpPtr); + function_e(ActPtr); + } + + - :pass: FALSE + :should: 'handle treat_as values containing pointers for failures' + :verify_error: 'Element 0 Expected 33 Was 45' + :code: | + test() + { + MY_INT ExpInt = (MY_INT)33; + PTR_INT ExpPtr = (PTR_INT)(&ExpInt); + MY_INT ActInt = (MY_INT)45; + PTR_INT ActPtr = (PTR_INT)(&ActInt); + pointer_bar_Expect(ExpPtr); + function_e(ActPtr); + } + +... diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/expect_and_throw.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/expect_and_throw.yml new file mode 100644 index 0000000..c22524c --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/expect_and_throw.yml @@ -0,0 +1,170 @@ +--- +:cmock: + :plugins: + - :cexception + +:systest: + :types: | + #define UINT32 unsigned int + typedef signed int custom_type; + + :mockable: | + #include "CException.h" + UINT32 foo(custom_type a); + UINT32 bar(custom_type b); + UINT32 foo_varargs(custom_type a, ...); + + :source: + :header: | + #include "CException.h" + UINT32 function_a(int a); + void function_b(char a); + + :code: | + UINT32 function_a(int a) + { + UINT32 r = 0; + CEXCEPTION_T e; + + Try + { + r = (UINT32)foo((custom_type)a); + } + Catch(e) + { + r = (UINT32)e*2; + } + return r; + } + + void function_b(char a) + { + if (a) + { + Throw((CEXCEPTION_T)a); + } + } + + :tests: + :common: | + #include "CException.h" + void setUp(void) {} + void tearDown(void) {} + + :units: + - :pass: TRUE + :should: 'successfully exercise a simple ExpectAndReturn mock calls' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + TEST_ASSERT_EQUAL(10, function_a(1)); + } + + - :pass: TRUE + :should: 'successfully throw an error on first call' + :code: | + test() + { + foo_ExpectAndThrow((custom_type)1, 55); + TEST_ASSERT_EQUAL(110, function_a(1)); + } + + - :pass: TRUE + :should: 'successfully throw an error on later calls' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + foo_ExpectAndReturn((custom_type)2, 20); + foo_ExpectAndThrow((custom_type)3, 15); + foo_ExpectAndReturn((custom_type)4, 40); + TEST_ASSERT_EQUAL(10, function_a(1)); + TEST_ASSERT_EQUAL(20, function_a(2)); + TEST_ASSERT_EQUAL(30, function_a(3)); + TEST_ASSERT_EQUAL(40, function_a(4)); + } + + - :pass: TRUE + :should: 'pass because we nothing happens' + :code: | + test() + { + function_b(0); + } + + - :pass: FALSE + :should: 'fail because we did not expect function B to throw' + :code: | + test() + { + function_b(1); + } + + - :pass: TRUE + :should: 'fail because we expect function B to throw' + :code: | + test() + { + CEXCEPTION_T e; + Try + { + function_b(3); + TEST_FAIL_MESSAGE("Should Have Thrown"); + } + Catch(e) + { + TEST_ASSERT_EQUAL(3, e); + } + } + + - :pass: TRUE + :should: 'successfully throw an error on consecutive calls' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + foo_ExpectAndReturn((custom_type)1, 20); + foo_ExpectAndThrow((custom_type)1, 15); + foo_ExpectAndThrow((custom_type)3, 40); + TEST_ASSERT_EQUAL(10, function_a(1)); + TEST_ASSERT_EQUAL(20, function_a(1)); + TEST_ASSERT_EQUAL(30, function_a(1)); + TEST_ASSERT_EQUAL(80, function_a(3)); + } + + - :pass: TRUE + :should: 'successfully throw an error on later calls and after a previous mock call' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + foo_ExpectAndReturn((custom_type)1, 20); + foo_ExpectAndThrow((custom_type)1, 15); + TEST_ASSERT_EQUAL(10, function_a(1)); + TEST_ASSERT_EQUAL(20, function_a(1)); + TEST_ASSERT_EQUAL(30, function_a(1)); + + foo_ExpectAndReturn((custom_type)2, 20); + foo_ExpectAndThrow((custom_type)3, 40); + TEST_ASSERT_EQUAL(20, function_a(2)); + TEST_ASSERT_EQUAL(80, function_a(3)); + } + + - :pass: TRUE + :should: 'successfully throw an error if expects and mocks called before it' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + foo_ExpectAndReturn((custom_type)1, 20); + TEST_ASSERT_EQUAL(10, function_a(1)); + TEST_ASSERT_EQUAL(20, function_a(1)); + + foo_ExpectAndReturn((custom_type)2, 20); + foo_ExpectAndThrow((custom_type)3, 40); + TEST_ASSERT_EQUAL(20, function_a(2)); + TEST_ASSERT_EQUAL(80, function_a(3)); + } + +... diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/fancy_pointer_handling.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/fancy_pointer_handling.yml new file mode 100644 index 0000000..e6e75e5 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/fancy_pointer_handling.yml @@ -0,0 +1,208 @@ +--- +:cmock: + :plugins: + - # none + :treat_as: + INT_PTR: INT* + +:systest: + :types: | + typedef struct _POINT_T { + int x; + int y; + } POINT_T; + typedef int* INT_PTR; + + :mockable: | + void foo(POINT_T* a); + POINT_T* bar(void); + void fooa(POINT_T a[]); + void foos(const char *a); + const char* bars(void); + INT_PTR zoink(INT_PTR a); + + :source: + :header: | + void function_a(void); + void function_b(void); + void function_c(void); + int function_d(void); + + :code: | + void function_a(void) + { + foo(bar()); + } + + void function_b(void) { + fooa(bar()); + } + + void function_c(void) { + foos(bars()); + } + + int function_d(void) { + int i = 456; + INT_PTR ptr = (INT_PTR)(&i); + return (int)(*(zoink(ptr))); + } + + :tests: + :common: | + void setUp(void) {} + void tearDown(void) {} + + :units: + - :pass: TRUE + :should: 'handle the situation where we pass nulls to pointers' + :code: | + test() + { + bar_ExpectAndReturn(NULL); + foo_Expect(NULL); + + function_a(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass single object with expect' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 2}; + bar_ExpectAndReturn(&pt); + foo_Expect(&ex); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass single object with expect and it is wrong' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 3}; + bar_ExpectAndReturn(&pt); + foo_Expect(&ex); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass nulls to pointers and fail' + :code: | + test() + { + POINT_T pt = {1, 2}; + bar_ExpectAndReturn(&pt); + foo_Expect(NULL); + + function_a(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass nulls to arrays' + :code: | + test() + { + bar_ExpectAndReturn(NULL); + fooa_Expect(NULL); + + function_b(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass single array element with expect' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 2}; + bar_ExpectAndReturn(&pt); + fooa_Expect(&ex); + + function_b(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass single array element with expect and it is wrong' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 3}; + bar_ExpectAndReturn(&pt); + fooa_Expect(&ex); + + function_b(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass nulls to arrays and fail' + :code: | + test() + { + POINT_T pt = {1, 2}; + bar_ExpectAndReturn(&pt); + fooa_Expect(NULL); + + function_b(); + } + + - :pass: TRUE + :should: 'handle standard c string as null terminated on not do crappy memory compares of a byte, passing' + :code: | + test() + { + bars_ExpectAndReturn("This is a\0 silly string"); + foos_Expect("This is a\0 wacky string"); + + function_c(); + } + + - :pass: FALSE + :should: 'handle standard c string as null terminated on not do crappy memory compares of a byte, finding failures' + :code: | + test() + { + bars_ExpectAndReturn("This is a silly string"); + foos_Expect("This is a wacky string"); + + function_c(); + } + + - :pass: TRUE + :should: 'handle handle typedefs that ARE pointers by using treat_as' + :code: | + test() + { + int e = 456; + int r = 789; + INT_PTR ptr_e = (INT_PTR)(&e); + INT_PTR ptr_r = (INT_PTR)(&r); + + zoink_ExpectAndReturn(ptr_e, ptr_r); + + TEST_ASSERT_EQUAL(r, function_d()); + } + + - :pass: FALSE + :should: 'handle handle typedefs that ARE pointers by using treat_as and catch failures' + :code: | + test() + { + int e = 457; + int r = 789; + INT_PTR ptr_e = (INT_PTR)(&e); + INT_PTR ptr_r = (INT_PTR)(&r); + + zoink_ExpectAndReturn(ptr_e, ptr_r); + + TEST_ASSERT_EQUAL(r, function_d()); + } + + +... diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/function_pointer_handling.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/function_pointer_handling.yml new file mode 100644 index 0000000..9462bdd --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/function_pointer_handling.yml @@ -0,0 +1,82 @@ +--- +:cmock: + :plugins: + - # none + :treat_as: + FUNCTION_T: PTR + +:systest: + :types: | + typedef void (*FUNCTION_T)(void); + + :mockable: | + void takes_function_type( FUNCTION_T myfunc ); + void takes_function_ptr( unsigned int (*func_ptr)(int, char) ); + void takes_const_function_ptr( unsigned int (* const)(int, char) ); + unsigned short (*returns_function_ptr( const char op_code ))( int, long int ); + + :source: + :header: | + void exercise_function_pointer_param(void); + unsigned short (*exercise_function_pointer_return( const char op_code ))( int, long int ); + + // functions for function pointer tests + unsigned int dummy_function1(int a, char b); + unsigned short dummy_function2(int a, long int b); + + :code: | + /* + * functions used in tests + */ + + unsigned int dummy_function1(int a, char b) + { + // prevent compiler warnings by using everything + return (unsigned int)a + (unsigned int)b; + } + + unsigned short dummy_function2(int a, long int b) + { + // prevent compiler warnings by using everything + return (unsigned short)a + (unsigned short)b; + } + + /* + * functions executed by tests + */ + + void exercise_function_pointer_param(void) + { + takes_function_ptr(dummy_function1); + } + + unsigned short (*exercise_function_pointer_return( const char op_code ))( int, long int ) + { + return returns_function_ptr(op_code); + } + + :tests: + :common: | + void setUp(void) {} + void tearDown(void) {} + :units: + - :pass: TRUE + :should: 'expect a function pointer param' + :code: | + test() + { + takes_function_ptr_Expect(dummy_function1); + exercise_function_pointer_param(); + } + + - :pass: TRUE + :should: 'return a function pointer' + :code: | + test() + { + returns_function_ptr_ExpectAndReturn('z', dummy_function2); + TEST_ASSERT_EQUAL_PTR(dummy_function2, exercise_function_pointer_return('z')); + } + + +... diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/ignore_and_return.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/ignore_and_return.yml new file mode 100644 index 0000000..281efd0 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/ignore_and_return.yml @@ -0,0 +1,153 @@ +--- +:cmock: + :plugins: + - 'ignore' + +:systest: + :types: | + + :mockable: | + int foo(int a); + void bar(int b); + + :source: + :header: | + int function(int a, int b, int c); + :code: | + int function(int a, int b, int c) + { + bar(b); + return foo(a) + foo(b) + foo(c); + } + + :tests: + :common: | + void setUp(void) {} + void tearDown(void) {} + :units: + - :pass: TRUE + :should: 'successfully exercise simple ExpectAndReturn mock calls' + :code: | + test() + { + bar_Expect(2); + foo_ExpectAndReturn(1, 10); + foo_ExpectAndReturn(2, 20); + foo_ExpectAndReturn(3, 30); + TEST_ASSERT_EQUAL(60, function(1, 2, 3)); + } + + - :pass: TRUE + :should: 'ignore foo() calls' + :code: | + test() + { + bar_Expect(4); + foo_IgnoreAndReturn(10); + foo_IgnoreAndReturn(40); + foo_IgnoreAndReturn(80); + TEST_ASSERT_EQUAL(130, function(3, 4, 3)); + } + + - :pass: TRUE + :should: 'ignore foo() calls and always return last item if we run out' + :code: | + test() + { + bar_Expect(4); + foo_IgnoreAndReturn(20); + foo_IgnoreAndReturn(30); + TEST_ASSERT_EQUAL(80, function(3, 4, 9)); + } + + - :pass: TRUE + :should: 'ignore foo() calls and always return only item if only one specified' + :code: | + test() + { + bar_Expect(4); + foo_IgnoreAndReturn(20); + TEST_ASSERT_EQUAL(60, function(3, 4, 9)); + } + + - :pass: TRUE + :should: 'ignore bar() and foo() calls' + :code: | + test() + { + bar_Ignore(); + foo_IgnoreAndReturn(50); + TEST_ASSERT_EQUAL(150, function(0, 0, 0)); + } + + - :pass: TRUE + :should: 'ignore foo() calls over multiple mock calls' + :code: | + test() + { + bar_Ignore(); + foo_IgnoreAndReturn(50); + foo_IgnoreAndReturn(60); + foo_IgnoreAndReturn(70); + TEST_ASSERT_EQUAL(180, function(0, 0, 0)); + + bar_Ignore(); + foo_IgnoreAndReturn(30); + foo_IgnoreAndReturn(80); + foo_IgnoreAndReturn(10); + TEST_ASSERT_EQUAL(120, function(0, 0, 0)); + + foo_IgnoreAndReturn(70); + foo_IgnoreAndReturn(20); + TEST_ASSERT_EQUAL(110, function(0, 0, 0)); + } + + - :pass: TRUE + :should: 'multiple cycles of expects still pass when ignores enabled' + :code: | + test() + { + bar_Expect(2); + foo_ExpectAndReturn(1, 50); + foo_ExpectAndReturn(2, 60); + foo_ExpectAndReturn(3, 70); + TEST_ASSERT_EQUAL(180, function(1, 2, 3)); + + bar_Expect(5); + foo_ExpectAndReturn(4, 30); + foo_ExpectAndReturn(5, 80); + foo_ExpectAndReturn(6, 10); + TEST_ASSERT_EQUAL(120, function(4, 5, 6)); + + bar_Expect(8); + foo_ExpectAndReturn(7, 70); + foo_ExpectAndReturn(8, 20); + foo_ExpectAndReturn(9, 20); + TEST_ASSERT_EQUAL(110, function(7, 8, 9)); + } + + - :pass: FALSE + :should: 'multiple cycles of expects still fail when ignores enabled' + :code: | + test() + { + bar_Expect(2); + foo_ExpectAndReturn(1, 50); + foo_ExpectAndReturn(2, 60); + foo_ExpectAndReturn(3, 70); + TEST_ASSERT_EQUAL(180, function(1, 2, 3)); + + bar_Expect(5); + foo_ExpectAndReturn(4, 30); + foo_ExpectAndReturn(5, 80); + foo_ExpectAndReturn(6, 10); + TEST_ASSERT_EQUAL(120, function(4, 5, 6)); + + bar_Expect(8); + foo_ExpectAndReturn(7, 70); + foo_ExpectAndReturn(8, 20); + foo_ExpectAndReturn(9, 20); + TEST_ASSERT_EQUAL(110, function(0, 8, 9)); + } + +... diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/newer_standards_stuff1.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/newer_standards_stuff1.yml new file mode 100644 index 0000000..6843eae --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/newer_standards_stuff1.yml @@ -0,0 +1,52 @@ +--- +#The purpose of this test is to pull in some standard library stuff from C99 +:cmock: + :includes: + - "" + - "" + +:systest: + :types: | + #include + #include + + + :mockable: | + int32_t foo(int32_t a); + + :source: + :header: | + int8_t function_a(void); + + :code: | + int8_t function_a(void) { + return (int8_t)(INT_MIN == foo(INT_MAX)); + } + + :tests: + :common: | + void setUp(void) {} + void tearDown(void) {} + + :units: + - :pass: TRUE + :should: 'handle handle a simple comparison of C99 types which pass' + :code: | + test() + { + foo_ExpectAndReturn(INT_MAX, INT_MIN); + + TEST_ASSERT_TRUE(function_a()); + } + + - :pass: FALSE + :should: 'handle handle a simple comparison of C99 types which fail' + :code: | + test() + { + foo_ExpectAndReturn(INT_MIN, INT_MIN); + + TEST_ASSERT_TRUE(function_a()); + } + +... diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/nonstandard_parsed_stuff_1.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/nonstandard_parsed_stuff_1.yml new file mode 100644 index 0000000..01538ea --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/nonstandard_parsed_stuff_1.yml @@ -0,0 +1,91 @@ +--- +#The purpose of this test is to play with things like "const char const *" which isn't supported by some compilers +:cmock: + :enforce_strict_ordering: 1 + :plugins: + - :array + - :cexception + - :ignore + +:systest: + :types: | + typedef struct _POINT_T { + int x; + int y; + } POINT_T; + + :mockable: | + #include "CException.h" + void foos(const char const * a); + const char const * bars(void); + + :source: + :header: | + #include "CException.h" + void function_a(void); + void function_b(void); + void function_c(void); + int function_d(void); + + :code: | + void function_c(void) { + CEXCEPTION_T e; + Try { + foos(bars()); + } Catch(e) { foos("err"); } + } + + :tests: + :common: | + #include "CException.h" + void setUp(void) {} + void tearDown(void) {} + + :units: + - :pass: TRUE + :should: 'handle standard c string as null terminated on not do crappy memory compares of a byte, passing' + :code: | + test() + { + bars_ExpectAndReturn("This is a\0 silly string"); + foos_Expect("This is a\0 wacky string"); + + function_c(); + } + + - :pass: FALSE + :should: 'handle standard c string as null terminated on not do crappy memory compares of a byte, finding failures' + :code: | + test() + { + bars_ExpectAndReturn("This is a silly string"); + foos_Expect("This is a wacky string"); + + function_c(); + } + + - :pass: TRUE + :should: 'handle an exception being caught' + :code: | + test() + { + bars_ExpectAndReturn("This is a\0 silly string"); + foos_ExpectAndThrow("This is a\0 wacky string", 55); + foos_Expect("err"); + + function_c(); + } + + - :pass: FALSE + :should: 'handle an exception being caught but still catch following errors' + :code: | + test() + { + bars_ExpectAndReturn("This is a\0 silly string"); + foos_ExpectAndThrow("This is a\0 wacky string", 55); + foos_Expect("wrong error"); + + function_c(); + } + +... diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/nonstandard_parsed_stuff_2.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/nonstandard_parsed_stuff_2.yml new file mode 100644 index 0000000..f9c9538 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/nonstandard_parsed_stuff_2.yml @@ -0,0 +1,59 @@ +--- +#The purpose of this test is to play with our really rough multidimensional array support, which involves an implicit cast not supported everywhere +:cmock: + :plugins: + - :array + +:systest: + :types: | + + + :mockable: | + void foo(unsigned char** a); + unsigned char** bar(void); + + :source: + :header: | + void function_a(void); + + :code: | + void function_a(void) { + foo(bar()); + } + + :tests: + :common: | + void setUp(void) {} + void tearDown(void) {} + + :units: + - :pass: TRUE + :should: 'handle two dimensional array of unsigned characters just like we would handle a single dimensional array in expect (where we really only care about first element)' + :code: | + test() + { + unsigned char a[] = { 1, 2, 3, 4, 5, 6 }; + unsigned char** pa = (unsigned char**)(&a); + + bar_ExpectAndReturn(pa); + foo_Expect(pa); + + function_a(); + } + + - :pass: FALSE + :should: 'handle two dimensional array of unsigned characters just like we would handle a single dimensional array in expect as failures (where we really only care about first element)' + :code: | + test() + { + unsigned char a[] = { 1, 2, 3, 4, 5, 6 }; + unsigned char b[] = { 5, 6, 7, 8, 9, 0 }; + unsigned char** pa = (unsigned char**)(&a); + unsigned char** pb = (unsigned char**)(&b); + + bar_ExpectAndReturn(pa); + foo_Expect(pb); + + function_a(); + } +... diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/parsing_challenges.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/parsing_challenges.yml new file mode 100644 index 0000000..835e1fa --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/parsing_challenges.yml @@ -0,0 +1,222 @@ +--- +:cmock: + :plugins: + - # no plugins + :treat_as_void: + - VOID_TYPE_CRAZINESS_CFG + :treat_as: + TypeDefInt: HEX8 + +:systest: + :types: | + typedef unsigned short U16; + typedef struct _POINT_T + { + int x; + int y; + } POINT_T; + typedef void VOID_TYPE_CRAZINESS_CFG; + typedef int TypeDefInt; + + :mockable: | + /* Make sure we ignore the following + #include "NonExistantFile.h + */ + //#include "AndIgnoreThisToo.h" + #ifdef __cplusplus + extern "C" { + #endif + #define SHOULD_IGNORE_NEXT_FUNC_DEF_AS_PART_OF_MACRO \ + void IgnoredFunction(NotAValidType ToMakeItFailIfWeActuallyMockedThis); + + // typedef edge case; must be in mockable.h for test to compile + // not ANSI C but it has been done and will break cmock if not handled + typedef void VOID_TYPE_CRAZINESS_LCL; + + VOID_TYPE_CRAZINESS_LCL void_type_craziness1(int * a, int *b, int* c); + void void_type_craziness2(VOID_TYPE_CRAZINESS_CFG); + + // pointer parsing exercise + U16 *ptr_return1(int a); + U16* ptr_return2(int a); + U16 * ptr_return3(int a); + + unsigned int** ptr_ptr_return1(unsigned int** a); + unsigned int* *ptr_ptr_return2(unsigned int* *a); + unsigned int **ptr_ptr_return3(unsigned int **a); + unsigned int ** ptr_ptr_return4(unsigned int ** a); + + // variable argument lists + void var_args1(int a, ...); + void var_args2(int a, int b, ...); + + // parsing "stress tests" + char + crazy_multiline( + int a, + unsigned int b); + + unsigned long int incredible_descriptors(register const unsigned short a); + + TypeDefInt uses_typedef_like_names(TypeDefInt typedefvar); + + void oh_brackets1(int fudge[5]); + void oh_brackets2(int caramel[]); + #ifdef __cplusplus + } + #endif + + :source: + :header: | + U16* exercise_return_pointers(int a); + void exercise_var_args(int a, int b); + void exercise_arglist_pointers(void); + char exercise_multiline_declarations(int a, unsigned int b); + void exercise_double_pointers(unsigned int** a); + int exercise_many_descriptors(int a); + TypeDefInt exercise_typedef_like_names(TypeDefInt a); + + :code: | + int A, B, C; + unsigned int *pA, *pB, *pC; + + U16* exercise_return_pointers(int a) + { + ptr_return1(a); + ptr_return2(a); + return ptr_return3(a); + } + + void exercise_var_args(int a, int b) + { + var_args1(a, 3); + var_args2(a, b, 'c'); + } + + void exercise_arglist_pointers(void) + { + void_type_craziness1(&A, &B, &C); + void_type_craziness2(); + } + + char exercise_multiline_declarations(int a, unsigned int b) + { + return crazy_multiline(a, b); + } + + void exercise_double_pointers(unsigned int** a) + { + ptr_ptr_return1((unsigned int**)a); + ptr_ptr_return2((unsigned int**)a); + ptr_ptr_return3((unsigned int**)a); + ptr_ptr_return4((unsigned int**)a); + } + + int exercise_many_descriptors(int a) + { + return (int)incredible_descriptors((unsigned short)a); + } + + TypeDefInt exercise_typedef_like_names(TypeDefInt a) + { + return uses_typedef_like_names(a); + } + + :tests: + :common: | + extern int A, B, C; + extern unsigned int *pA, *pB, *pC; + + void setUp(void) + { + A = 100; + B = 200; + C = 300; + pA = (unsigned int*)(&A); + pB = (unsigned int*)(&B); + pC = (unsigned int*)(&C); + } + void tearDown(void) {} + :units: + - :pass: TRUE + :should: 'execute simple pointer return value check' + :code: | + test() + { + U16 retval; + ptr_return1_ExpectAndReturn(2, NULL); + ptr_return2_ExpectAndReturn(2, NULL); + ptr_return3_ExpectAndReturn(2, &retval); + TEST_ASSERT_EQUAL_PTR(&retval, exercise_return_pointers(2)); + } + + - :pass: TRUE + :should: 'ignore var args in expect prototype generation' + :code: | + test() + { + var_args1_Expect(2); + var_args2_Expect(2, 3); + exercise_var_args(2, 3); + } + + - :pass: TRUE + :should: "not process a typedef'd void as anything other than void" + :code: | + test() + { + void_type_craziness1_Expect(&A, &B, &C); + void_type_craziness2_Expect(); + exercise_arglist_pointers(); + } + + - :pass: TRUE + :should: 'successfully mock crazy multline function prototypes' + :code: | + test() + { + crazy_multiline_ExpectAndReturn(-10, 11, 'z'); + TEST_ASSERT_EQUAL('z', exercise_multiline_declarations(-10, 11)); + } + + - :pass: TRUE + :should: 'mock double pointers just fine' + :code: | + test() + { + ptr_ptr_return1_ExpectAndReturn(&pA, &pB); + ptr_ptr_return2_ExpectAndReturn(&pA, &pB); + ptr_ptr_return3_ExpectAndReturn(&pA, &pB); + ptr_ptr_return4_ExpectAndReturn(&pA, &pB); + exercise_double_pointers((unsigned int**)(&pA)); + } + + - :pass: TRUE + :should: 'mock prototypes with long lists of return and parameter type descriptors' + :code: | + test() + { + incredible_descriptors_ExpectAndReturn(888, 777); + TEST_ASSERT_EQUAL(777, exercise_many_descriptors(888)); + } + + - :pass: TRUE + :should: 'handle words like typdef as PART of a variable or type' + :code: | + test() + { + uses_typedef_like_names_ExpectAndReturn((TypeDefInt)54, (TypeDefInt)53); + TEST_ASSERT_EQUAL(53, exercise_typedef_like_names((TypeDefInt)54)); + } + + - :pass: FALSE + :should: 'handle words like typdef as PART of a variable or type during failing tests' + :code: | + test() + { + uses_typedef_like_names_ExpectAndReturn((TypeDefInt)52, (TypeDefInt)53); + TEST_ASSERT_EQUAL(53, exercise_typedef_like_names((TypeDefInt)54)); + } + + +... diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/struct_union_enum_expect_and_return.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/struct_union_enum_expect_and_return.yml new file mode 100644 index 0000000..d4cf6af --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/struct_union_enum_expect_and_return.yml @@ -0,0 +1,277 @@ +--- +:cmock: + :plugins: + - # none + +:systest: + :types: | + struct THING { int a; int b; }; + + union STARS_AND_STRIPES { int a; char b; }; + + enum HOKEY_POKEY { IN, OUT, SHAKE_IT_ALL_ABOUT }; + + :mockable: | + void foo_struct(struct THING*, struct THING); + struct THING foobar_struct(void); + + void foo_union(union STARS_AND_STRIPES*, union STARS_AND_STRIPES); + union STARS_AND_STRIPES foobar_union(void); + + void foo_enum(enum HOKEY_POKEY a, enum HOKEY_POKEY * b); + enum HOKEY_POKEY foobar_enum(void); + + :source: + :header: | + void exercise_struct(struct THING* a, struct THING b); + struct THING return_struct(void); + + void exercise_union(union STARS_AND_STRIPES* a, union STARS_AND_STRIPES b); + union STARS_AND_STRIPES return_union(void); + + void exercise_enum(enum HOKEY_POKEY a, enum HOKEY_POKEY * b); + enum HOKEY_POKEY return_enum(void); + + :code: | + void exercise_struct(struct THING* a, struct THING b) + { + foo_struct(a, b); + } + + struct THING return_struct(void) + { + return foobar_struct(); + } + + void exercise_union(union STARS_AND_STRIPES* a, union STARS_AND_STRIPES b) + { + foo_union(a, b); + } + + union STARS_AND_STRIPES return_union(void) + { + return foobar_union(); + } + + void exercise_enum(enum HOKEY_POKEY a, enum HOKEY_POKEY * b) + { + foo_enum(a, b); + } + + enum HOKEY_POKEY return_enum(void) + { + return foobar_enum(); + } + + + :tests: + :common: | + struct THING struct1; + struct THING struct2; + struct THING struct3; + struct THING struct4; + struct THING struct5; + struct THING struct6; + + union STARS_AND_STRIPES union1; + union STARS_AND_STRIPES union2; + union STARS_AND_STRIPES union3; + union STARS_AND_STRIPES union4; + union STARS_AND_STRIPES union5; + union STARS_AND_STRIPES union6; + + enum HOKEY_POKEY enum1; + enum HOKEY_POKEY enum2; + + void setUp(void) + { + struct1.a = 1; + struct1.b = 2; + + struct2.a = 3; + struct2.b = 4; + + struct3.a = 5; + struct3.b = 6; + + struct4.a = 7; + struct4.b = 8; + + struct5.a = 9; + struct5.b = 10; + + struct6.a = 9; + struct6.b = 10; + + union1.a = 1; + union2.a = 2; + union3.a = 3; + union4.a = 4; + union5.a = 5; + union6.a = 5; + + enum1 = OUT; + enum2 = IN; + } + + void tearDown(void) {} + + :units: + - :pass: TRUE + :should: 'successfully compare structs' + :code: | + test() + { + foo_struct_Expect(&struct1, struct2); + exercise_struct(&struct1, struct2); + } + + - :pass: FALSE + :should: 'blow up on bad struct pointer comparison' + :code: | + test() + { + foo_struct_Expect(&struct1, struct2); + exercise_struct(&struct3, struct2); + } + + - :pass: FALSE + :should: 'blow up on bad structure comparison' + :code: | + test() + { + foo_struct_Expect(&struct1, struct2); + exercise_struct(&struct1, struct4); + } + + - :pass: TRUE + :should: 'compare returned structs as equal' + :code: | + test() + { + foobar_struct_ExpectAndReturn(struct5); + TEST_ASSERT_EQUAL_THING(struct6, return_struct()); + } + + - :pass: FALSE + :should: 'compare returned structs as unequal' + :code: | + test() + { + foobar_struct_ExpectAndReturn(struct4); + TEST_ASSERT_EQUAL_THING(struct5, return_struct()); + } + + - :pass: TRUE + :should: 'successfully compare unions' + :code: | + test() + { + foo_union_Expect(&union1, union2); + exercise_union(&union1, union2); + } + + - :pass: FALSE + :should: 'blow up on bad union pointer comparison' + :code: | + test() + { + foo_union_Expect(&union1, union2); + exercise_union(&union3, union2); + } + + - :pass: FALSE + :should: 'blow up on bad union comparison' + :code: | + test() + { + foo_union_Expect(&union1, union2); + exercise_union(&union1, union4); + } + + - :pass: TRUE + :should: 'compare returned unions as equal' + :code: | + test() + { + foobar_union_ExpectAndReturn(union5); + TEST_ASSERT_EQUAL_STARS_AND_STRIPES(union6, return_union()); + } + + - :pass: FALSE + :should: 'compare returned unions as unequal' + :code: | + test() + { + foobar_union_ExpectAndReturn(union4); + TEST_ASSERT_EQUAL_STARS_AND_STRIPES(union5, return_union()); + } + + - :pass: TRUE + :should: 'successfully pass enum values' + :code: | + test() + { + foo_enum_Expect(OUT, &enum1); + exercise_enum(OUT, &enum1); + } + + - :pass: FALSE + :should: 'blow up on bad enum pointer comparison' + :code: | + test() + { + foo_enum_Expect(IN, &enum1); + exercise_enum(IN, &enum2); + } + + - :pass: FALSE + :should: 'blow up on bad enum comparison' + :code: | + test() + { + foo_enum_Expect(IN, &enum1); + exercise_enum(SHAKE_IT_ALL_ABOUT, &enum1); + } + + - :pass: TRUE + :should: 'compare returned enums as equal' + :code: | + test() + { + foobar_enum_ExpectAndReturn(OUT); + TEST_ASSERT_EQUAL(OUT, return_enum()); + } + + - :pass: FALSE + :should: 'compare returned unions as unequal' + :code: | + test() + { + foobar_enum_ExpectAndReturn(OUT); + TEST_ASSERT_EQUAL(IN, return_enum()); + } + + + :unity_helper: + :header: | + void AssertEqualTHINGStruct(struct THING expected, struct THING actual); + void AssertEqualSTARS_AND_STRIPESUnion(union STARS_AND_STRIPES expected, union STARS_AND_STRIPES actual); + + #define TEST_ASSERT_EQUAL_THING(expected, actual) {AssertEqualTHINGStruct(expected, actual);} + #define TEST_ASSERT_EQUAL_STARS_AND_STRIPES(expected, actual) {AssertEqualSTARS_AND_STRIPESUnion(expected, actual);} + + :code: | + void AssertEqualTHINGStruct(struct THING expected, struct THING actual) + { + TEST_ASSERT_EQUAL_INT_MESSAGE(expected.a, actual.a, "actual struct member \"a\" does not equal expected"); + TEST_ASSERT_EQUAL_INT_MESSAGE(expected.b, actual.b, "actual struct member \"b\" does not equal expected"); + } + + void AssertEqualSTARS_AND_STRIPESUnion(union STARS_AND_STRIPES expected, union STARS_AND_STRIPES actual) + { + TEST_ASSERT_EQUAL_INT_MESSAGE(expected.a, actual.a, "actual union member \"a\" does not equal expected"); + TEST_ASSERT_EQUAL_MESSAGE(expected.b, actual.b, "actual union member \"b\" does not equal expected"); + } + +... diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/stubs_with_callbacks.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/stubs_with_callbacks.yml new file mode 100644 index 0000000..fcae12c --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/stubs_with_callbacks.yml @@ -0,0 +1,221 @@ +--- +:cmock: + :plugins: + - :callback + :treat_as: + custom_type: INT + +:systest: + :types: | + #define UINT32 unsigned int + + typedef signed int custom_type; + + :mockable: | + UINT32 foo(custom_type* a); + UINT32 bar(custom_type* b); + int baz(void); + void fuz(int* args, int num); + + :source: + :header: | + void function_a(int a, int b); + UINT32 function_b(void); + int function_c(void); + + :code: | + void function_a(int a, int b) + { + int args[6] = {0, 1, 2, 3, 5, 5}; + args[0] = a; + fuz(args, b); + } + + UINT32 function_b(void) + { + UINT32 sum = 0; + custom_type a = 0; + custom_type b = 0; + sum = foo(&a) + bar(&b); + return sum + a + b; + } + + int function_c(void) + { + return (baz() + baz() + baz()); + } + + :tests: + :common: | + void setUp(void) {} + void tearDown(void) {} + + UINT32 FooAndBarHelper(custom_type* data, int num) + { + num++; + *data = (custom_type)(num * 2); + return (*data * 2); + } + + int BazCallbackPointless(int num) + { + return num; + } + + int BazCallbackComplainsIfCalledMoreThanTwice(int num) + { + TEST_ASSERT_MESSAGE(num < 2, "Do Not Call Baz More Than Twice"); + return num; + } + + void FuzVerifier(int* args, int num_args, int num_calls) + { + int i; + TEST_ASSERT_MESSAGE(num_args < 5, "No More Than 5 Args Allowed"); + for (i = 0; i < num_args; i++) + { + TEST_ASSERT_EQUAL(num_calls + i, args[i]); + } + } + + :units: + - :pass: TRUE + :should: 'successfully exercise two simple ExpectAndReturn mock calls the normal way' + :code: | + test() + { + custom_type exp = 0; + foo_ExpectAndReturn(&exp, 10); + bar_ExpectAndReturn(&exp, 20); + TEST_ASSERT_EQUAL(30, function_b()); + } + + - :pass: FALSE + :should: 'successfully exercise two simple ExpectAndReturn mock calls and catch failure the normal way' + :code: | + test() + { + custom_type exp = 1; + foo_ExpectAndReturn(&exp, 10); + bar_ExpectAndReturn(&exp, 20); + TEST_ASSERT_EQUAL(30, function_b()); + } + + - :pass: TRUE + :should: 'successfully exercise using some basic callbacks' + :code: | + test() + { + foo_StubWithCallback((CMOCK_foo_CALLBACK)FooAndBarHelper); + bar_StubWithCallback((CMOCK_bar_CALLBACK)FooAndBarHelper); + TEST_ASSERT_EQUAL(12, function_b()); + } + + - :pass: TRUE + :should: 'successfully exercise using some basic callbacks even if there were expects' + :code: | + test() + { + custom_type exp = 500; + foo_ExpectAndReturn(&exp, 10); + foo_StubWithCallback((CMOCK_foo_CALLBACK)FooAndBarHelper); + bar_StubWithCallback((CMOCK_bar_CALLBACK)FooAndBarHelper); + TEST_ASSERT_EQUAL(12, function_b()); + } + + - :pass: FALSE + :should: 'successfully exercise using some basic callbacks and notice failures' + :code: | + test() + { + foo_StubWithCallback((CMOCK_foo_CALLBACK)FooAndBarHelper); + bar_StubWithCallback((CMOCK_bar_CALLBACK)FooAndBarHelper); + TEST_ASSERT_EQUAL(10, function_b()); + } + + - :pass: TRUE + :should: 'successfully exercise a callback with no arguments' + :code: | + test() + { + baz_StubWithCallback((CMOCK_baz_CALLBACK)BazCallbackPointless); + TEST_ASSERT_EQUAL(3, function_c()); + } + + - :pass: FALSE + :should: 'successfully throw a failure from within a callback function' + :code: | + test() + { + baz_StubWithCallback((CMOCK_baz_CALLBACK)BazCallbackComplainsIfCalledMoreThanTwice); + function_c(); + } + + - :pass: TRUE + :should: 'be usable for things like dynamically sized memory checking for passing conditions' + :code: | + test() + { + fuz_StubWithCallback((CMOCK_fuz_CALLBACK)FuzVerifier); + function_a(0, 4); + } + + - :pass: FALSE + :should: 'be usable for things like dynamically sized memory checking for failing conditions' + :code: | + test() + { + fuz_StubWithCallback((CMOCK_fuz_CALLBACK)FuzVerifier); + function_a(0, 5); + } + + - :pass: FALSE + :should: 'be usable for things like dynamically sized memory checking for failing conditions 2' + :code: | + test() + { + fuz_StubWithCallback((CMOCK_fuz_CALLBACK)FuzVerifier); + function_a(1, 4); + } + + - :pass: TRUE + :should: 'run them interlaced' + :code: | + test() + { + custom_type exp = 0; + foo_ExpectAndReturn(&exp, 10); + foo_ExpectAndReturn(&exp, 15); + bar_ExpectAndReturn(&exp, 20); + bar_ExpectAndReturn(&exp, 40); + fuz_StubWithCallback((CMOCK_fuz_CALLBACK)FuzVerifier); + baz_StubWithCallback((CMOCK_baz_CALLBACK)BazCallbackPointless); + + TEST_ASSERT_EQUAL(30, function_b()); + TEST_ASSERT_EQUAL(55, function_b()); + function_a(0, 4); + TEST_ASSERT_EQUAL(3, function_c()); + } + + - :pass: TRUE + :should: 'run them back to back' + :code: | + test() + { + custom_type exp = 0; + foo_ExpectAndReturn(&exp, 10); + bar_ExpectAndReturn(&exp, 20); + TEST_ASSERT_EQUAL(30, function_b()); + + foo_ExpectAndReturn(&exp, 15); + bar_ExpectAndReturn(&exp, 40); + TEST_ASSERT_EQUAL(55, function_b()); + + fuz_StubWithCallback((CMOCK_fuz_CALLBACK)FuzVerifier); + function_a(0, 4); + + baz_StubWithCallback((CMOCK_baz_CALLBACK)BazCallbackPointless); + TEST_ASSERT_EQUAL(3, function_c()); + } + +... diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/unity_64bit_support.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/unity_64bit_support.yml new file mode 100644 index 0000000..c34bb1c --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/unity_64bit_support.yml @@ -0,0 +1,82 @@ +--- +#The purpose of this test is to play with things 64-bit integers, which aren't supported by all compilers +:cmock: + :plugins: + - :array + - :ignore + +:systest: + :types: | + #if (UNITY_LONG_WIDTH == 32) + typedef unsigned long long TEST64; + #elif (UNITY_LONG_WIDTH == 64) + typedef unsigned long TEST64; + #else + #error This Test Should Not Be Run Unless You Have 64 Bit Support Enabled + #endif + + :mockable: | + TEST64 foo(TEST64 a); + TEST64* bar(TEST64* b); + + :source: + :header: | + TEST64 function_a(void); + + :code: | + TEST64 function_a(void) { + TEST64 a = 0x1234567890123456; + TEST64 b; + TEST64* c; + + b = foo(a); + c = bar(&b); + return *c; + } + + :tests: + :common: | + void setUp(void) {} + void tearDown(void) {} + + :units: + - :pass: TRUE + :should: 'handle a straightforward 64-bit series of calls' + :code: | + test() + { + TEST64 a = 0x0987654321543210; + TEST64 b = 0x5a5a5a5a5a5a5a5a; + foo_ExpectAndReturn(0x1234567890123456, 0x0987654321543210); + bar_ExpectAndReturn(&a, &b); + + TEST_ASSERT_EQUAL_HEX64(b, function_a()); + } + + - :pass: FALSE + :should: 'handle a straightforward 64-bit series of calls with a failure' + :code: | + test() + { + TEST64 a = 0x0987654321543210; + TEST64 b = 0x5a5a5a5a5a5a5a5a; + foo_ExpectAndReturn(0x1234567890123456, 0x0987654321543211); + bar_ExpectAndReturn(&a, &b); + + TEST_ASSERT_EQUAL_HEX64(b, function_a()); + } + + - :pass: FALSE + :should: 'handle a straightforward 64-bit series of calls returning a failure' + :code: | + test() + { + TEST64 a = 0x0987654321543210; + TEST64 b = 0x5a5a5a5a5a5a5a5a; + foo_ExpectAndReturn(0x1234567890123456, 0x0987654321543210); + bar_ExpectAndReturn(&a, &b); + + TEST_ASSERT_EQUAL_HEX64(b+1, function_a()); + } + +... diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/unity_ignores.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/unity_ignores.yml new file mode 100644 index 0000000..c6f8574 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/system/test_interactions/unity_ignores.yml @@ -0,0 +1,139 @@ +--- +:cmock: + :plugins: + - # none + +:systest: + :types: | + #define UINT32 unsigned int + + :mockable: | + UINT32 foo(UINT32 a); + void bar(void); + + :source: + :header: | + UINT32 function_a(int a); + void function_b(void); + + :code: | + UINT32 function_a(int a) + { + bar(); + return foo((UINT32)a); + } + + void function_b(void) + { + bar(); + } + + :tests: + :common: | + void setUp(void) {} + void tearDown(void) {} + + :units: + - :pass: :ignore + :should: 'ignore incorrect expects after the TEST_IGNORE call' + :code: | + test() + { + TEST_IGNORE(); + bar_Expect(); + foo_ExpectAndReturn(10, 20); + TEST_ASSERT_EQUAL(40, function_a(30)); + } + + - :pass: :ignore + :should: 'ignore missing expects after the TEST_IGNORE call' + :code: | + test() + { + TEST_IGNORE(); + foo_ExpectAndReturn(10, 20); + TEST_ASSERT_EQUAL(20, function_a(10)); + } + + - :pass: :ignore + :should: 'ignore extra expects after the TEST_IGNORE call' + :code: | + test() + { + TEST_IGNORE(); + bar_Expect(); + bar_Expect(); + foo_ExpectAndReturn(10, 20); + foo_ExpectAndReturn(10, 20); + foo_ExpectAndReturn(10, 20); + TEST_ASSERT_EQUAL(20, function_a(10)); + } + + - :pass: :ignore + :should: 'ignore no expects after the TEST_IGNORE call' + :code: | + test() + { + TEST_IGNORE(); + TEST_ASSERT_EQUAL(20, function_a(10)); + } + + - :pass: :ignore + :should: 'ignore extra expects after the TEST_IGNORE call even if it happens later' + :code: | + test() + { + bar_Expect(); + foo_ExpectAndReturn(10, 20); + function_a(10); + + TEST_IGNORE(); + bar_Expect(); + foo_ExpectAndReturn(10, 20); + TEST_ASSERT_EQUAL(40, function_a(30)); + } + + - :pass: false + :should: 'still fail if there are expect problems before the TEST_IGNORE' + :code: | + test() + { + bar_Expect(); + foo_ExpectAndReturn(10, 20); + function_a(30); + + TEST_IGNORE(); + bar_Expect(); + foo_ExpectAndReturn(10, 20); + TEST_ASSERT_EQUAL(40, function_a(30)); + } + + - :pass: false + :should: 'still fail if there are missing expect problems before the TEST_IGNORE' + :code: | + test() + { + bar_Expect(); + function_a(10); + + TEST_IGNORE(); + bar_Expect(); + foo_ExpectAndReturn(10, 20); + TEST_ASSERT_EQUAL(40, function_a(30)); + } + + - :pass: :ignore + :should: 'ignore if extra expects before the TEST_IGNORE because it ignored the rest of the test that might have made calls to it' + :code: | + test() + { + bar_Expect(); + bar_Expect(); + foo_ExpectAndReturn(10, 20); + function_a(10); + + TEST_IGNORE(); + foo_ExpectAndReturn(10, 20); + TEST_ASSERT_EQUAL(40, function_a(30)); + } +... diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/test_helper.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/test_helper.rb new file mode 100644 index 0000000..7dd33fb --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/test_helper.rb @@ -0,0 +1,44 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== +[ "/../config/test_environment", + "/../vendor/behaviors/lib/behaviors" +].each do |req| + require File.expand_path(File.dirname(__FILE__)) + req +end + +#gem install test-unit -v 1.2.3 +ruby_version = RUBY_VERSION.split('.') +if (ruby_version[1].to_i == 9) and (ruby_version[2].to_i > 1) + require 'rubygems' + gem 'test-unit' +end +require 'test/unit' +require 'hardmock' + +class Test::Unit::TestCase + extend Behaviors + + #these are helpful test structures which can be used during tests + + def test_return + { + :int => {:type => "int", :name => 'cmock_to_return', :ptr? => false, :const? => false, :void? => false, :str => 'int cmock_to_return'}, + :int_ptr => {:type => "int*", :name => 'cmock_to_return', :ptr? => true, :const? => false, :void? => false, :str => 'int* cmock_to_return'}, + :void => {:type => "void", :name => 'cmock_to_return', :ptr? => false, :const? => false, :void? => true, :str => 'void cmock_to_return'}, + :string => {:type => "char*", :name => 'cmock_to_return', :ptr? => false, :const? => true, :void? => false, :str => 'const char* cmock_to_return'}, + } + end + + def test_arg + { + :int => {:type => "int", :name => 'MyInt', :ptr? => false, :const? => false}, + :int_ptr => {:type => "int*", :name => 'MyIntPtr', :ptr? => true, :const? => false}, + :mytype => {:type => "MY_TYPE", :name => 'MyMyType', :ptr? => false, :const? => true}, + :mytype_ptr => {:type => "MY_TYPE*", :name => 'MyMyTypePtr', :ptr? => true, :const? => false}, + :string => {:type => "char*", :name => 'MyStr', :ptr? => false, :const? => true}, + } + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/unit/cmock_config_test.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/unit/cmock_config_test.rb new file mode 100644 index 0000000..cfdfc41 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/unit/cmock_config_test.rb @@ -0,0 +1,45 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require File.expand_path(File.dirname(__FILE__)) + "/../test_helper" +require 'cmock_config' + +class CMockConfigTest < Test::Unit::TestCase + def setup + end + + def teardown + end + + should "use default settings when no parameters are specified" do + config = CMockConfig.new + assert_equal(CMockConfig::CMockDefaultOptions[:mock_path], config.mock_path) + assert_equal(CMockConfig::CMockDefaultOptions[:includes], config.includes) + assert_equal(CMockConfig::CMockDefaultOptions[:attributes], config.attributes) + assert_equal(CMockConfig::CMockDefaultOptions[:plugins], config.plugins) + assert_equal(CMockConfig::CMockDefaultOptions[:treat_externs], config.treat_externs) + end + + should "replace only options specified in a hash" do + test_includes = ['hello'] + test_attributes = ['blah', 'bleh'] + config = CMockConfig.new(:includes => test_includes, :attributes => test_attributes) + assert_equal(CMockConfig::CMockDefaultOptions[:mock_path], config.mock_path) + assert_equal(test_includes, config.includes) + assert_equal(test_attributes, config.attributes) + assert_equal(CMockConfig::CMockDefaultOptions[:plugins], config.plugins) + assert_equal(CMockConfig::CMockDefaultOptions[:treat_externs], config.treat_externs) + end + + should "replace only options specified in a yaml file" do + test_plugins = [:soda, :pizza] + config = CMockConfig.new("#{File.expand_path(File.dirname(__FILE__))}/cmock_config_test.yml") + assert_equal(CMockConfig::CMockDefaultOptions[:mock_path], config.mock_path) + assert_equal(CMockConfig::CMockDefaultOptions[:includes], config.includes) + assert_equal(test_plugins, config.plugins) + assert_equal(:include, config.treat_externs) + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/unit/cmock_config_test.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/unit/cmock_config_test.yml new file mode 100644 index 0000000..b2444f8 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/unit/cmock_config_test.yml @@ -0,0 +1,5 @@ +:cmock: + :plugins: + - 'soda' + - 'pizza' + :treat_externs: :include diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/unit/cmock_file_writer_test.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/unit/cmock_file_writer_test.rb new file mode 100644 index 0000000..13c2631 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/unit/cmock_file_writer_test.rb @@ -0,0 +1,30 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require File.expand_path(File.dirname(__FILE__)) + "/../test_helper" +require 'cmock_file_writer' + +class CMockFileWriterTest < Test::Unit::TestCase + def setup + create_mocks :config + @cmock_file_writer = CMockFileWriter.new(@config) + end + + def teardown + end + + should "have set up internal accessors correctly on init" do + assert_equal(@config, @cmock_file_writer.config) + end + + should "complain if a block was not specified when calling create" do + begin + @cmock_file_writer.create_file("test.txt") + assert false, "Should Have Thrown An Error When Calling Without A Block" + rescue + end + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/unit/cmock_generator_main_test.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/unit/cmock_generator_main_test.rb new file mode 100644 index 0000000..f743d84 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/unit/cmock_generator_main_test.rb @@ -0,0 +1,412 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +$ThisIsOnlyATest = true + +require File.expand_path(File.dirname(__FILE__)) + "/../test_helper" +require 'cmock_generator' + +class MockedPluginHelper + def initialize return_this + @return_this = return_this + end + + def include_files + return @return_this + end + + def instance_structure( name, args, rettype ) + return " #{@return_this}_#{name}(#{args}, #{rettype})" + end + + def mock_verify( name ) + return " #{@return_this}_#{name}" + end + + def mock_destroy( name, args, rettype ) + return " #{@return_this}_#{name}(#{args}, #{rettype})" + end + + def mock_implementation(name, args) + return " Mock#{name}#{@return_this}(#{args.join(", ")})" + end +end + +class CMockGeneratorTest < Test::Unit::TestCase + def setup + create_mocks :config, :file_writer, :utils, :plugins + @module_name = "PoutPoutFish" + + #no strict handling + @config.expect.mock_prefix.returns("Mock") + @config.expect.enforce_strict_ordering.returns(nil) + @config.expect.framework.returns(:unity) + @config.expect.includes.returns(["ConfigRequiredHeader1.h","ConfigRequiredHeader2.h"]) + #@config.expect.includes_h_pre_orig_header.returns(nil) #not called because includes called + @config.expect.includes_h_post_orig_header.returns(nil) + @config.expect.includes_c_pre_header.returns(nil) + @config.expect.includes_c_post_header.returns(nil) + @cmock_generator = CMockGenerator.new(@config, @file_writer, @utils, @plugins) + @cmock_generator.module_name = @module_name + @cmock_generator.mock_name = "Mock#{@module_name}" + + #strict handling + @config.expect.mock_prefix.returns("Mock") + @config.expect.enforce_strict_ordering.returns(true) + @config.expect.framework.returns(:unity) + @config.expect.includes.returns(nil) + @config.expect.includes_h_pre_orig_header.returns(nil) + @config.expect.includes_h_post_orig_header.returns(nil) + @config.expect.includes_c_pre_header.returns(nil) + @config.expect.includes_c_post_header.returns(nil) + @cmock_generator_strict = CMockGenerator.new(@config, @file_writer, @utils, @plugins) + @cmock_generator_strict.module_name = @module_name + @cmock_generator_strict.mock_name = "Mock#{@module_name}" + end + + def teardown + end + + should "have set up internal accessors correctly on init" do + assert_equal(@config, @cmock_generator.config) + assert_equal(@file_writer, @cmock_generator.file_writer) + assert_equal(@utils, @cmock_generator.utils) + assert_equal(@plugins, @cmock_generator.plugins) + end + + should "create the top of a header file with optional include files from config and include file from plugin" do + @config.expect.mock_prefix.returns("Mock") + orig_filename = "PoutPoutFish.h" + define_name = "MOCKPOUTPOUTFISH_H" + mock_name = "MockPoutPoutFish" + output = [] + expected = [ "/* AUTOGENERATED FILE. DO NOT EDIT. */\n", + "#ifndef _#{define_name}\n", + "#define _#{define_name}\n\n", + "#include \"ConfigRequiredHeader1.h\"\n", + "#include \"ConfigRequiredHeader2.h\"\n", + "#include \"#{orig_filename}\"\n", + "#include \"PluginRequiredHeader.h\"\n", + "\n" + ] + + @plugins.expect.run(:include_files).returns("#include \"PluginRequiredHeader.h\"\n") + + @cmock_generator.create_mock_header_header(output, "MockPoutPoutFish.h") + + assert_equal(expected, output) + end + + should "create the top of a header file with optional include files from config" do + @config.expect.mock_prefix.returns("Mock") + orig_filename = "PoutPoutFish.h" + define_name = "MOCKPOUTPOUTFISH_H" + mock_name = "MockPoutPoutFish" + output = [] + expected = [ "/* AUTOGENERATED FILE. DO NOT EDIT. */\n", + "#ifndef _#{define_name}\n", + "#define _#{define_name}\n\n", + "#include \"ConfigRequiredHeader1.h\"\n", + "#include \"ConfigRequiredHeader2.h\"\n", + "#include \"#{orig_filename}\"\n", + "\n" + ] + + @plugins.expect.run(:include_files).returns('') + + @cmock_generator.create_mock_header_header(output, "MockPoutPoutFish.h") + + assert_equal(expected, output) + end + + should "create the top of a header file with include file from plugin" do + @config.expect.mock_prefix.returns("Mock") + orig_filename = "PoutPoutFish.h" + define_name = "MOCKPOUTPOUTFISH_H" + mock_name = "MockPoutPoutFish" + output = [] + expected = [ "/* AUTOGENERATED FILE. DO NOT EDIT. */\n", + "#ifndef _#{define_name}\n", + "#define _#{define_name}\n\n", + "#include \"ConfigRequiredHeader1.h\"\n", + "#include \"ConfigRequiredHeader2.h\"\n", + "#include \"#{orig_filename}\"\n", + "#include \"PluginRequiredHeader.h\"\n", + "\n" + ] + + @plugins.expect.run(:include_files).returns("#include \"PluginRequiredHeader.h\"\n") + + @cmock_generator.create_mock_header_header(output, "MockPoutPoutFish.h") + + assert_equal(expected, output) + end + + should "write typedefs" do + typedefs = [ 'typedef unsigned char U8;', + 'typedef char S8;', + 'typedef unsigned long U32;' + ] + output = [] + expected = [ "\n", + "typedef unsigned char U8;\n", + "typedef char S8;\n", + "typedef unsigned long U32;\n", + "\n\n" + ] + + @cmock_generator.create_typedefs(output, typedefs) + + assert_equal(expected, output.flatten) + end + + should "create the header file service call declarations" do + mock_name = "MockPoutPoutFish" + + output = [] + expected = [ "void #{mock_name}_Init(void);\n", + "void #{mock_name}_Destroy(void);\n", + "void #{mock_name}_Verify(void);\n\n" + ] + + @cmock_generator.create_mock_header_service_call_declarations(output) + + assert_equal(expected, output) + end + + should "append the proper footer to the header file" do + output = [] + expected = ["\n#endif\n"] + + @cmock_generator.create_mock_header_footer(output) + + assert_equal(expected, output) + end + + should "create a proper heading for a source file" do + output = [] + expected = [ "/* AUTOGENERATED FILE. DO NOT EDIT. */\n", + "#include \n", + "#include \n", + "#include \n", + "#include \"unity.h\"\n", + "#include \"cmock.h\"\n", + "#include \"MockPoutPoutFish.h\"\n", + "\n" + ] + + @cmock_generator.create_source_header_section(output, "MockPoutPoutFish.c") + + assert_equal(expected, output) + end + + should "create the instance structure where it is needed when no functions" do + output = [] + functions = [] + expected = [ "static struct MockPoutPoutFishInstance\n", + "{\n", + " unsigned char placeHolder;\n", + "} Mock;\n\n" + ].join + + @cmock_generator.create_instance_structure(output, functions) + + assert_equal(expected, output.join) + end + + should "create the instance structure where it is needed when functions required" do + output = [] + functions = [ { :name => "First", :args => "int Candy", :return => test_return[:int] }, + { :name => "Second", :args => "bool Smarty", :return => test_return[:string] } + ] + expected = [ "typedef struct _CMOCK_First_CALL_INSTANCE\n{\n", + " UNITY_LINE_TYPE LineNumber;\n", + " b1 b2", + "\n} CMOCK_First_CALL_INSTANCE;\n\n", + "typedef struct _CMOCK_Second_CALL_INSTANCE\n{\n", + " UNITY_LINE_TYPE LineNumber;\n", + "\n} CMOCK_Second_CALL_INSTANCE;\n\n", + "static struct MockPoutPoutFishInstance\n{\n", + " d1", + " CMOCK_MEM_INDEX_TYPE First_CallInstance;\n", + " e1 e2 e3", + " CMOCK_MEM_INDEX_TYPE Second_CallInstance;\n", + "} Mock;\n\n" + ].join + @plugins.expect.run(:instance_typedefs, functions[0]).returns([" b1"," b2"]) + @plugins.expect.run(:instance_typedefs, functions[1]).returns([]) + + @plugins.expect.run(:instance_structure, functions[0]).returns([" d1"]) + @plugins.expect.run(:instance_structure, functions[1]).returns([" e1"," e2"," e3"]) + + @cmock_generator.create_instance_structure(output, functions) + + assert_equal(expected, output.join) + end + + should "create extern declarations for source file" do + output = [] + expected = [ "extern jmp_buf AbortFrame;\n", + "\n" ] + + @cmock_generator.create_extern_declarations(output) + + assert_equal(expected, output.flatten) + end + + should "create extern declarations for source file when using strict ordering" do + output = [] + expected = [ "extern jmp_buf AbortFrame;\n", + "extern int GlobalExpectCount;\n", + "extern int GlobalVerifyOrder;\n", + "\n" ] + + @cmock_generator_strict.create_extern_declarations(output) + + assert_equal(expected, output.flatten) + end + + should "create mock verify functions in source file when no functions specified" do + functions = [] + output = [] + expected = "void MockPoutPoutFish_Verify(void)\n{\n}\n\n" + + @cmock_generator.create_mock_verify_function(output, functions) + + assert_equal(expected, output.join) + end + + should "create mock verify functions in source file when extra functions specified" do + functions = [ { :name => "First", :args => "int Candy", :return => test_return[:int] }, + { :name => "Second", :args => "bool Smarty", :return => test_return[:string] } + ] + output = [] + expected = [ "void MockPoutPoutFish_Verify(void)\n{\n", + " UNITY_LINE_TYPE cmock_line = TEST_LINE_NUM;\n", + " Uno_First" + + " Dos_First" + + " Uno_Second" + + " Dos_Second", + "}\n\n" + ] + @plugins.expect.run(:mock_verify, functions[0]).returns([" Uno_First"," Dos_First"]) + @plugins.expect.run(:mock_verify, functions[1]).returns([" Uno_Second"," Dos_Second"]) + + @cmock_generator.ordered = true + @cmock_generator.create_mock_verify_function(output, functions) + + assert_equal(expected, output.flatten) + end + + should "create mock init functions in source file" do + output = [] + expected = [ "void MockPoutPoutFish_Init(void)\n{\n", + " MockPoutPoutFish_Destroy();\n", + "}\n\n" + ] + + @cmock_generator.create_mock_init_function(output) + + assert_equal(expected.join, output.join) + end + + should "create mock destroy functions in source file" do + functions = [] + output = [] + expected = [ "void MockPoutPoutFish_Destroy(void)\n{\n", + " CMock_Guts_MemFreeAll();\n", + " memset(&Mock, 0, sizeof(Mock));\n", + "}\n\n" + ] + + @cmock_generator.create_mock_destroy_function(output, functions) + + assert_equal(expected.join, output.join) + end + + should "create mock destroy functions in source file when specified with strict ordering" do + functions = [ { :name => "First", :args => "int Candy", :return => test_return[:int] }, + { :name => "Second", :args => "bool Smarty", :return => test_return[:string] } + ] + output = [] + expected = [ "void MockPoutPoutFish_Destroy(void)\n{\n", + " CMock_Guts_MemFreeAll();\n", + " memset(&Mock, 0, sizeof(Mock));\n", + " uno", + " GlobalExpectCount = 0;\n", + " GlobalVerifyOrder = 0;\n", + "}\n\n" + ] + @plugins.expect.run(:mock_destroy, functions[0]).returns([]) + @plugins.expect.run(:mock_destroy, functions[1]).returns([" uno"]) + + @cmock_generator_strict.create_mock_destroy_function(output, functions) + + assert_equal(expected.join, output.join) + end + + should "create mock implementation functions in source file" do + function = { :modifier => "static", + :return => test_return[:int], + :args_string => "uint32 sandwiches, const char* named", + :args => ["uint32 sandwiches", "const char* named"], + :var_arg => nil, + :name => "SupaFunction", + :attributes => "__inline" + } + output = [] + expected = [ "static int SupaFunction(uint32 sandwiches, const char* named)\n", + "{\n", + " UNITY_LINE_TYPE cmock_line = TEST_LINE_NUM;\n", + " CMOCK_SupaFunction_CALL_INSTANCE* cmock_call_instance = (CMOCK_SupaFunction_CALL_INSTANCE*)CMock_Guts_GetAddressFor(Mock.SupaFunction_CallInstance);\n", + " Mock.SupaFunction_CallInstance = CMock_Guts_MemNext(Mock.SupaFunction_CallInstance);\n", + " uno", + " UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, \"Function 'SupaFunction' called more times than expected.\");\n", + " cmock_line = cmock_call_instance->LineNumber;\n", + " dos", + " tres", + " return cmock_call_instance->ReturnVal;\n", + "}\n\n" + ] + @plugins.expect.run(:mock_implementation_precheck, function).returns([" uno"]) + @plugins.expect.run(:mock_implementation, function).returns([" dos"," tres"]) + + @cmock_generator.create_mock_implementation(output, function) + + assert_equal(expected.join, output.join) + end + + should "create mock implementation functions in source file with different options" do + function = { :modifier => "", + :return => test_return[:int], + :args_string => "uint32 sandwiches", + :args => ["uint32 sandwiches"], + :var_arg => "corn ...", + :name => "SupaFunction", + :attributes => nil + } + output = [] + expected = [ "int SupaFunction(uint32 sandwiches, corn ...)\n", + "{\n", + " UNITY_LINE_TYPE cmock_line = TEST_LINE_NUM;\n", + " CMOCK_SupaFunction_CALL_INSTANCE* cmock_call_instance = (CMOCK_SupaFunction_CALL_INSTANCE*)CMock_Guts_GetAddressFor(Mock.SupaFunction_CallInstance);\n", + " Mock.SupaFunction_CallInstance = CMock_Guts_MemNext(Mock.SupaFunction_CallInstance);\n", + " uno", + " UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, \"Function 'SupaFunction' called more times than expected.\");\n", + " cmock_line = cmock_call_instance->LineNumber;\n", + " dos", + " tres", + " return cmock_call_instance->ReturnVal;\n", + "}\n\n" + ] + @plugins.expect.run(:mock_implementation_precheck, function).returns([" uno"]) + @plugins.expect.run(:mock_implementation, function).returns([" dos"," tres"]) + + @cmock_generator.create_mock_implementation(output, function) + + assert_equal(expected.join, output.join) + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_array_test.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_array_test.rb new file mode 100644 index 0000000..959a8e0 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_array_test.rb @@ -0,0 +1,114 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require File.expand_path(File.dirname(__FILE__)) + "/../test_helper" +require 'cmock_generator_plugin_array' + +class CMockGeneratorPluginArrayTest < Test::Unit::TestCase + def setup + create_mocks :config, :utils + + #no strict ordering + @config.expect.when_ptr.returns(:compare_data) + @config.expect.enforce_strict_ordering.returns(false) + @config.stubs!(:respond_to?).returns(true) + @utils.expect.helpers.returns({}) + @cmock_generator_plugin_array = CMockGeneratorPluginArray.new(@config, @utils) + end + + def teardown + end + + should "have set up internal accessors correctly on init" do + assert_equal(@config, @cmock_generator_plugin_array.config) + assert_equal(@utils, @cmock_generator_plugin_array.utils) + assert_equal(nil, @cmock_generator_plugin_array.unity_helper) + assert_equal(8, @cmock_generator_plugin_array.priority) + end + + should "not include any additional include files" do + assert(!@cmock_generator_plugin_array.respond_to?(:include_files)) + end + + should "not add to typedef structure for functions of style 'int* func(void)'" do + function = {:name => "Oak", :args => [], :return => test_return[:int_ptr]} + returned = @cmock_generator_plugin_array.instance_typedefs(function) + assert_equal("", returned) + end + + should "add to tyepdef structure mock needs of functions of style 'void func(int chicken, int* pork)'" do + function = {:name => "Cedar", :args => [{ :name => "chicken", :type => "int", :ptr? => false}, { :name => "pork", :type => "int*", :ptr? => true}], :return => test_return[:void]} + expected = " int Expected_pork_Depth;\n" + returned = @cmock_generator_plugin_array.instance_typedefs(function) + assert_equal(expected, returned) + end + + should "not add an additional mock interface for functions not containing pointers" do + function = {:name => "Maple", :args_string => "int blah", :return => test_return[:string], :contains_ptr? => false} + returned = @cmock_generator_plugin_array.mock_function_declarations(function) + assert_nil(returned) + end + + should "add another mock function declaration for functions of style 'void func(int* tofu)'" do + function = {:name => "Pine", + :args => [{ :type => "int*", + :name => "tofu", + :ptr? => true, + }], + :return => test_return[:void], + :contains_ptr? => true } + + expected = "#define #{function[:name]}_ExpectWithArray(tofu, tofu_Depth) #{function[:name]}_CMockExpectWithArray(__LINE__, tofu, tofu_Depth)\n" + + "void #{function[:name]}_CMockExpectWithArray(UNITY_LINE_TYPE cmock_line, int* tofu, int tofu_Depth);\n" + returned = @cmock_generator_plugin_array.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "add another mock function declaration for functions of style 'const char* func(int* tofu)'" do + function = {:name => "Pine", + :args => [{ :type => "int*", + :name => "tofu", + :ptr? => true, + }], + :return => test_return[:string], + :contains_ptr? => true } + + expected = "#define #{function[:name]}_ExpectWithArrayAndReturn(tofu, tofu_Depth, cmock_retval) #{function[:name]}_CMockExpectWithArrayAndReturn(__LINE__, tofu, tofu_Depth, cmock_retval)\n" + + "void #{function[:name]}_CMockExpectWithArrayAndReturn(UNITY_LINE_TYPE cmock_line, int* tofu, int tofu_Depth, const char* cmock_to_return);\n" + returned = @cmock_generator_plugin_array.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "not have a mock function implementation" do + assert(!@cmock_generator_plugin_array.respond_to?(:mock_implementation)) + end + + should "not have a mock interfaces for functions of style 'int* func(void)'" do + function = {:name => "Pear", :args => [], :args_string => "void", :return => test_return[:int_ptr]} + returned = @cmock_generator_plugin_array.mock_interfaces(function) + assert_nil(returned) + end + + should "add mock interfaces for functions of style 'int* func(int* pescado, int pes)'" do + function = {:name => "Lemon", + :args => [{ :type => "int*", :name => "pescado", :ptr? => true}, { :type => "int", :name => "pes", :ptr? => false}], + :args_string => "int* pescado, int pes", + :return => test_return[:int_ptr], + :contains_ptr? => true } + @utils.expect.code_add_base_expectation("Lemon").returns("mock_retval_0") + + expected = ["void Lemon_CMockExpectWithArrayAndReturn(UNITY_LINE_TYPE cmock_line, int* pescado, int pescado_Depth, int pes, int* cmock_to_return)\n", + "{\n", + "mock_retval_0", + " CMockExpectParameters_Lemon(cmock_call_instance, pescado, pescado_Depth, pes);\n", + " cmock_call_instance->ReturnVal = cmock_to_return;\n", + "}\n\n" + ].join + returned = @cmock_generator_plugin_array.mock_interfaces(function).join + assert_equal(expected, returned) + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_callback_test.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_callback_test.rb new file mode 100644 index 0000000..8542fc6 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_callback_test.rb @@ -0,0 +1,190 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require File.expand_path(File.dirname(__FILE__)) + "/../test_helper" +require 'cmock_generator_plugin_callback' + +class CMockGeneratorPluginCallbackTest < Test::Unit::TestCase + def setup + create_mocks :config, :utils + + @config.expect.callback_include_count.returns(true) + @config.expect.callback_after_arg_check.returns(false) + + @cmock_generator_plugin_callback = CMockGeneratorPluginCallback.new(@config, @utils) + end + + def teardown + end + + should "have set up internal accessors correctly on init" do + assert_equal(@config, @cmock_generator_plugin_callback.config) + assert_equal(@utils, @cmock_generator_plugin_callback.utils) + assert_equal(6, @cmock_generator_plugin_callback.priority) + end + + should "not include any additional include files" do + assert(!@cmock_generator_plugin_callback.respond_to?(:include_files)) + end + + should "add to instance structure" do + function = {:name => "Oak", :args => [:type => "int*", :name => "blah", :ptr? => true], :return => test_return[:int_ptr]} + expected = " CMOCK_Oak_CALLBACK Oak_CallbackFunctionPointer;\n" + + " int Oak_CallbackCalls;\n" + returned = @cmock_generator_plugin_callback.instance_structure(function) + assert_equal(expected, returned) + end + + should "add mock function declaration for function without arguments" do + function = {:name => "Maple", :args_string => "void", :args => [], :return => test_return[:void]} + expected = [ "typedef void (* CMOCK_Maple_CALLBACK)(int cmock_num_calls);\n", + "void Maple_StubWithCallback(CMOCK_Maple_CALLBACK Callback);\n" ].join + returned = @cmock_generator_plugin_callback.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "add mock function declaration for function without arguments when count is also turned off" do + function = {:name => "Maple", :args_string => "void", :args => [], :return => test_return[:void]} + expected = [ "typedef void (* CMOCK_Maple_CALLBACK)(void);\n", + "void Maple_StubWithCallback(CMOCK_Maple_CALLBACK Callback);\n" ].join + @cmock_generator_plugin_callback.include_count = false + returned = @cmock_generator_plugin_callback.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "add mock function declaration for function with arguments" do + function = {:name => "Maple", :args_string => "int* tofu", :args => [1], :return => test_return[:void]} + expected = [ "typedef void (* CMOCK_Maple_CALLBACK)(int* tofu, int cmock_num_calls);\n", + "void Maple_StubWithCallback(CMOCK_Maple_CALLBACK Callback);\n" ].join + returned = @cmock_generator_plugin_callback.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "add mock function declaration for function with return values" do + function = {:name => "Maple", :args_string => "int* tofu", :args => [1], :return => test_return[:string]} + expected = [ "typedef const char* (* CMOCK_Maple_CALLBACK)(int* tofu, int cmock_num_calls);\n", + "void Maple_StubWithCallback(CMOCK_Maple_CALLBACK Callback);\n" ].join + returned = @cmock_generator_plugin_callback.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "add mock function declaration for function with return values and count is turned off" do + function = {:name => "Maple", :args_string => "int* tofu", :args => [1], :return => test_return[:string]} + expected = [ "typedef const char* (* CMOCK_Maple_CALLBACK)(int* tofu);\n", + "void Maple_StubWithCallback(CMOCK_Maple_CALLBACK Callback);\n" ].join + @cmock_generator_plugin_callback.include_count = false + returned = @cmock_generator_plugin_callback.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "add mock function implementation for functions of style 'void func(void)'" do + function = {:name => "Apple", :args => [], :args_string => "void", :return => test_return[:void]} + expected = [" if (Mock.Apple_CallbackFunctionPointer != NULL)\n", + " {\n", + " Mock.Apple_CallbackFunctionPointer(Mock.Apple_CallbackCalls++);\n", + " return;\n", + " }\n" + ].join + returned = @cmock_generator_plugin_callback.mock_implementation_precheck(function) + assert_equal(expected, returned) + end + + should "add mock function implementation for functions of style 'void func(void)' when count turned off" do + function = {:name => "Apple", :args => [], :args_string => "void", :return => test_return[:void]} + expected = [" if (Mock.Apple_CallbackFunctionPointer != NULL)\n", + " {\n", + " Mock.Apple_CallbackFunctionPointer();\n", + " return;\n", + " }\n" + ].join + @cmock_generator_plugin_callback.include_count = false + returned = @cmock_generator_plugin_callback.mock_implementation_precheck(function) + assert_equal(expected, returned) + end + + should "add mock function implementation for functions of style 'int func(void)'" do + function = {:name => "Apple", :args => [], :args_string => "void", :return => test_return[:int]} + expected = [" if (Mock.Apple_CallbackFunctionPointer != NULL)\n", + " {\n", + " return Mock.Apple_CallbackFunctionPointer(Mock.Apple_CallbackCalls++);\n", + " }\n" + ].join + returned = @cmock_generator_plugin_callback.mock_implementation_precheck(function) + assert_equal(expected, returned) + end + + should "add mock function implementation for functions of style 'void func(int* steak, uint8_t flag)'" do + function = {:name => "Apple", + :args => [ { :type => 'int*', :name => 'steak', :ptr? => true}, + { :type => 'uint8_t', :name => 'flag', :ptr? => false} ], + :args_string => "int* steak, uint8_t flag", + :return=> test_return[:void]} + expected = [" if (Mock.Apple_CallbackFunctionPointer != NULL)\n", + " {\n", + " Mock.Apple_CallbackFunctionPointer(steak, flag, Mock.Apple_CallbackCalls++);\n", + " return;\n", + " }\n" + ].join + returned = @cmock_generator_plugin_callback.mock_implementation_precheck(function) + assert_equal(expected, returned) + end + + should "add mock function implementation for functions of style 'void func(int* steak, uint8_t flag)' when count turned off" do + function = {:name => "Apple", + :args => [ { :type => 'int*', :name => 'steak', :ptr? => true}, + { :type => 'uint8_t', :name => 'flag', :ptr? => false} ], + :args_string => "int* steak, uint8_t flag", + :return=> test_return[:void]} + expected = [" if (Mock.Apple_CallbackFunctionPointer != NULL)\n", + " {\n", + " Mock.Apple_CallbackFunctionPointer(steak, flag);\n", + " return;\n", + " }\n" + ].join + @cmock_generator_plugin_callback.include_count = false + returned = @cmock_generator_plugin_callback.mock_implementation_precheck(function) + assert_equal(expected, returned) + end + + should "add mock function implementation for functions of style 'int16_t func(int* steak, uint8_t flag)'" do + function = {:name => "Apple", + :args => [ { :type => 'int*', :name => 'steak', :ptr? => true}, + { :type => 'uint8_t', :name => 'flag', :ptr? => false} ], + :args_string => "int* steak, uint8_t flag", + :return => test_return[:int]} + expected = [" if (Mock.Apple_CallbackFunctionPointer != NULL)\n", + " {\n", + " return Mock.Apple_CallbackFunctionPointer(steak, flag, Mock.Apple_CallbackCalls++);\n", + " }\n" + ].join + returned = @cmock_generator_plugin_callback.mock_implementation_precheck(function) + assert_equal(expected, returned) + end + + should "add mock interfaces for functions " do + function = {:name => "Lemon", + :args => [{ :type => "char*", :name => "pescado"}], + :args_string => "char* pescado", + :return => test_return[:int] + } + + expected = ["void Lemon_StubWithCallback(CMOCK_Lemon_CALLBACK Callback)\n", + "{\n", + " Mock.Lemon_CallbackFunctionPointer = Callback;\n", + "}\n\n" + ].join + returned = @cmock_generator_plugin_callback.mock_interfaces(function) + assert_equal(expected, returned) + end + + should "add mock destroy for functions" do + function = {:name => "Peach", :args => [], :return => test_return[:void] } + expected = " Mock.Peach_CallbackFunctionPointer = NULL;\n" + + " Mock.Peach_CallbackCalls = 0;\n" + returned = @cmock_generator_plugin_callback.mock_destroy(function) + assert_equal(expected, returned) + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_cexception_test.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_cexception_test.rb new file mode 100644 index 0000000..ac64f30 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_cexception_test.rb @@ -0,0 +1,94 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require File.expand_path(File.dirname(__FILE__)) + "/../test_helper" +require 'cmock_generator_plugin_cexception' + +class CMockGeneratorPluginCexceptionTest < Test::Unit::TestCase + def setup + create_mocks :config, :utils + @cmock_generator_plugin_cexception = CMockGeneratorPluginCexception.new(@config, @utils) + end + + def teardown + end + + should "have set up internal accessors correctly on init" do + assert_equal(@config, @cmock_generator_plugin_cexception.config) + assert_equal(@utils, @cmock_generator_plugin_cexception.utils) + assert_equal(7, @cmock_generator_plugin_cexception.priority) + end + + should "include the cexception library" do + expected = "#include \"CException.h\"\n" + returned = @cmock_generator_plugin_cexception.include_files + assert_equal(expected, returned) + end + + should "add to typedef structure mock needs" do + function = { :name => "Oak", :args => [], :return => test_return[:void] } + expected = " CEXCEPTION_T ExceptionToThrow;\n" + returned = @cmock_generator_plugin_cexception.instance_typedefs(function) + assert_equal(expected, returned) + end + + should "add mock function declarations for functions without arguments" do + function = { :name => "Spruce", :args_string => "void", :return => test_return[:void] } + expected = "#define Spruce_ExpectAndThrow(cmock_to_throw) Spruce_CMockExpectAndThrow(__LINE__, cmock_to_throw)\n"+ + "void Spruce_CMockExpectAndThrow(UNITY_LINE_TYPE cmock_line, CEXCEPTION_T cmock_to_throw);\n" + returned = @cmock_generator_plugin_cexception.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "add mock function declarations for functions with arguments" do + function = { :name => "Spruce", :args_string => "const char* Petunia, uint32_t Lily", :args_call => "Petunia, Lily", :return => test_return[:void] } + expected = "#define Spruce_ExpectAndThrow(Petunia, Lily, cmock_to_throw) Spruce_CMockExpectAndThrow(__LINE__, Petunia, Lily, cmock_to_throw)\n" + + "void Spruce_CMockExpectAndThrow(UNITY_LINE_TYPE cmock_line, const char* Petunia, uint32_t Lily, CEXCEPTION_T cmock_to_throw);\n" + returned = @cmock_generator_plugin_cexception.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "add a mock implementation" do + function = {:name => "Cherry", :args => [], :return => test_return[:void]} + expected = " if (cmock_call_instance->ExceptionToThrow != CEXCEPTION_NONE)\n {\n" + + " Throw(cmock_call_instance->ExceptionToThrow);\n }\n" + returned = @cmock_generator_plugin_cexception.mock_implementation(function) + assert_equal(expected, returned) + end + + should "add mock interfaces for functions without arguments" do + function = {:name => "Pear", :args_string => "void", :args => [], :return => test_return[:void]} + @utils.expect.code_add_base_expectation("Pear").returns("mock_retval_0") + @utils.expect.code_call_argument_loader(function).returns("") + + expected = ["void Pear_CMockExpectAndThrow(UNITY_LINE_TYPE cmock_line, CEXCEPTION_T cmock_to_throw)\n", + "{\n", + "mock_retval_0", + "", + " cmock_call_instance->ExceptionToThrow = cmock_to_throw;\n", + "}\n\n" + ].join + returned = @cmock_generator_plugin_cexception.mock_interfaces(function) + assert_equal(expected, returned) + end + + should "add a mock interfaces for functions with arguments" do + function = {:name => "Pear", :args_string => "int blah", :args => [{ :type => "int", :name => "blah" }], :return => test_return[:void]} + @utils.expect.code_add_base_expectation("Pear").returns("mock_retval_0") + @utils.expect.code_call_argument_loader(function).returns("mock_return_1") + + expected = ["void Pear_CMockExpectAndThrow(UNITY_LINE_TYPE cmock_line, int blah, CEXCEPTION_T cmock_to_throw)\n", + "{\n", + "mock_retval_0", + "mock_return_1", + " cmock_call_instance->ExceptionToThrow = cmock_to_throw;\n", + "}\n\n" + ].join + returned = @cmock_generator_plugin_cexception.mock_interfaces(function) + assert_equal(expected, returned) + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_expect_test.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_expect_test.rb new file mode 100644 index 0000000..fa85936 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_expect_test.rb @@ -0,0 +1,206 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require File.expand_path(File.dirname(__FILE__)) + "/../test_helper" +require 'cmock_generator_plugin_expect' + +class CMockGeneratorPluginExpectTest < Test::Unit::TestCase + def setup + create_mocks :config, :utils + + #no strict ordering and args_and_calls + @config.expect.when_ptr.returns(:compare_data) + @config.expect.enforce_strict_ordering.returns(false) + @config.stubs!(:respond_to?).returns(true) + # @config.expect.ignore.returns(:args_and_calls) + @utils.expect.helpers.returns({}) + @cmock_generator_plugin_expect = CMockGeneratorPluginExpect.new(@config, @utils) + + #strict ordering and args_only + @config.expect.when_ptr.returns(:compare_data) + @config.expect.enforce_strict_ordering.returns(true) + @config.stubs!(:respond_to?).returns(true) + # @config.expect.ignore.returns(:args_only) + @utils.expect.helpers.returns({}) + @cmock_generator_plugin_expect_strict = CMockGeneratorPluginExpect.new(@config, @utils) + end + + def teardown + end + + should "have set up internal accessors correctly on init" do + assert_equal(@config, @cmock_generator_plugin_expect.config) + assert_equal(@utils, @cmock_generator_plugin_expect.utils) + assert_equal(nil, @cmock_generator_plugin_expect.unity_helper) + assert_equal(5, @cmock_generator_plugin_expect.priority) + end + + should "not include any additional include files" do + assert(!@cmock_generator_plugin_expect.respond_to?(:include_files)) + end + + should "add to typedef structure mock needs of functions of style 'void func(void)'" do + function = {:name => "Oak", :args => [], :return => test_return[:void]} + expected = "" + returned = @cmock_generator_plugin_expect.instance_typedefs(function) + assert_equal(expected, returned) + end + + should "add to typedef structure mock needs of functions of style 'int func(void)'" do + function = {:name => "Elm", :args => [], :return => test_return[:int]} + expected = " int ReturnVal;\n" + returned = @cmock_generator_plugin_expect.instance_typedefs(function) + assert_equal(expected, returned) + end + + should "add to typedef structure mock needs of functions of style 'void func(int chicken, char* pork)'" do + function = {:name => "Cedar", :args => [{ :name => "chicken", :type => "int"}, { :name => "pork", :type => "char*"}], :return => test_return[:void]} + expected = " int Expected_chicken;\n char* Expected_pork;\n" + returned = @cmock_generator_plugin_expect.instance_typedefs(function) + assert_equal(expected, returned) + end + + should "add to typedef structure mock needs of functions of style 'int func(float beef)'" do + function = {:name => "Birch", :args => [{ :name => "beef", :type => "float"}], :return => test_return[:int]} + expected = " int ReturnVal;\n float Expected_beef;\n" + returned = @cmock_generator_plugin_expect.instance_typedefs(function) + assert_equal(expected, returned) + end + + should "add to typedef structure mock needs of functions of style 'void func(void)' and global ordering" do + function = {:name => "Oak", :args => [], :return => test_return[:void]} + expected = " int CallOrder;\n" + returned = @cmock_generator_plugin_expect_strict.instance_typedefs(function) + assert_equal(expected, returned) + end + + should "add mock function declaration for functions of style 'void func(void)'" do + function = {:name => "Maple", :args => [], :return => test_return[:void]} + expected = "#define Maple_Expect() Maple_CMockExpect(__LINE__)\n" + + "void Maple_CMockExpect(UNITY_LINE_TYPE cmock_line);\n" + returned = @cmock_generator_plugin_expect.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "add mock function declaration for functions of style 'int func(void)'" do + function = {:name => "Spruce", :args => [], :return => test_return[:int]} + expected = "#define Spruce_ExpectAndReturn(cmock_retval) Spruce_CMockExpectAndReturn(__LINE__, cmock_retval)\n" + + "void Spruce_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, int cmock_to_return);\n" + returned = @cmock_generator_plugin_expect.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "add mock function declaration for functions of style 'const char* func(int tofu)'" do + function = {:name => "Pine", :args => ["int tofu"], :args_string => "int tofu", :args_call => 'tofu', :return => test_return[:string]} + expected = "#define Pine_ExpectAndReturn(tofu, cmock_retval) Pine_CMockExpectAndReturn(__LINE__, tofu, cmock_retval)\n" + + "void Pine_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, int tofu, const char* cmock_to_return);\n" + returned = @cmock_generator_plugin_expect.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "add mock function implementation for functions of style 'void func(void)'" do + function = {:name => "Apple", :args => [], :return => test_return[:void]} + expected = "" + returned = @cmock_generator_plugin_expect.mock_implementation(function) + assert_equal(expected, returned) + end + + should "add mock function implementation for functions of style 'int func(int veal, unsigned int sushi)'" do + function = {:name => "Cherry", :args => [ { :type => "int", :name => "veal" }, { :type => "unsigned int", :name => "sushi" } ], :return => test_return[:int]} + + @utils.expect.code_verify_an_arg_expectation(function, function[:args][0]).returns(" mocked_retval_1") + @utils.expect.code_verify_an_arg_expectation(function, function[:args][1]).returns(" mocked_retval_2") + expected = " mocked_retval_1 mocked_retval_2" + returned = @cmock_generator_plugin_expect.mock_implementation(function) + assert_equal(expected, returned) + end + + should "add mock function implementation using ordering if needed" do + function = {:name => "Apple", :args => [], :return => test_return[:void]} + expected = "" + @cmock_generator_plugin_expect.ordered = true + returned = @cmock_generator_plugin_expect.mock_implementation(function) + assert_equal(expected, returned) + end + + should "add mock function implementation for functions of style 'void func(int worm)' and strict ordering" do + function = {:name => "Apple", :args => [{ :type => "int", :name => "worm" }], :return => test_return[:void]} + @utils.expect.code_verify_an_arg_expectation(function, function[:args][0]).returns("mocked_retval_0") + expected = "mocked_retval_0" + @cmock_generator_plugin_expect.ordered = true + returned = @cmock_generator_plugin_expect_strict.mock_implementation(function) + assert_equal(expected, returned) + end + + should "add mock interfaces for functions of style 'void func(void)'" do + function = {:name => "Pear", :args => [], :args_string => "void", :return => test_return[:void]} + @utils.expect.code_add_base_expectation("Pear").returns("mock_retval_0 ") + @utils.expect.code_call_argument_loader(function).returns("mock_retval_1 ") + expected = ["void Pear_CMockExpect(UNITY_LINE_TYPE cmock_line)\n", + "{\n", + "mock_retval_0 ", + "mock_retval_1 ", + "}\n\n" + ].join + returned = @cmock_generator_plugin_expect.mock_interfaces(function) + assert_equal(expected, returned) + end + + should "add mock interfaces for functions of style 'int func(void)'" do + function = {:name => "Orange", :args => [], :args_string => "void", :return => test_return[:int]} + @utils.expect.code_add_base_expectation("Orange").returns("mock_retval_0 ") + @utils.expect.code_call_argument_loader(function).returns("mock_retval_1 ") + @utils.expect.code_assign_argument_quickly("cmock_call_instance->ReturnVal", function[:return]).returns("mock_retval_2") + expected = ["void Orange_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, int cmock_to_return)\n", + "{\n", + "mock_retval_0 ", + "mock_retval_1 ", + "mock_retval_2", + "}\n\n" + ].join + returned = @cmock_generator_plugin_expect.mock_interfaces(function) + assert_equal(expected, returned) + end + + should "add mock interfaces for functions of style 'int func(char* pescado)'" do + function = {:name => "Lemon", :args => [{ :type => "char*", :name => "pescado"}], :args_string => "char* pescado", :return => test_return[:int]} + @utils.expect.code_add_base_expectation("Lemon").returns("mock_retval_0 ") + @utils.expect.code_call_argument_loader(function).returns("mock_retval_1 ") + @utils.expect.code_assign_argument_quickly("cmock_call_instance->ReturnVal", function[:return]).returns("mock_retval_2") + expected = ["void Lemon_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, char* pescado, int cmock_to_return)\n", + "{\n", + "mock_retval_0 ", + "mock_retval_1 ", + "mock_retval_2", + "}\n\n" + ].join + returned = @cmock_generator_plugin_expect.mock_interfaces(function) + assert_equal(expected, returned) + end + + should "add mock interfaces for functions when using ordering" do + function = {:name => "Pear", :args => [], :args_string => "void", :return => test_return[:void]} + @utils.expect.code_add_base_expectation("Pear").returns("mock_retval_0 ") + @utils.expect.code_call_argument_loader(function).returns("mock_retval_1 ") + expected = ["void Pear_CMockExpect(UNITY_LINE_TYPE cmock_line)\n", + "{\n", + "mock_retval_0 ", + "mock_retval_1 ", + "}\n\n" + ].join + @cmock_generator_plugin_expect.ordered = true + returned = @cmock_generator_plugin_expect.mock_interfaces(function) + assert_equal(expected, returned) + end + + should "add mock verify lines" do + function = {:name => "Banana" } + expected = " UNITY_TEST_ASSERT(CMOCK_GUTS_NONE == Mock.Banana_CallInstance, cmock_line, \"Function 'Banana' called less times than expected.\");\n" + returned = @cmock_generator_plugin_expect.mock_verify(function) + assert_equal(expected, returned) + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_ignore_test.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_ignore_test.rb new file mode 100644 index 0000000..15f72cc --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_ignore_test.rb @@ -0,0 +1,159 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require File.expand_path(File.dirname(__FILE__)) + "/../test_helper" +require 'cmock_generator_plugin_ignore' + +class CMockGeneratorPluginIgnoreTest < Test::Unit::TestCase + def setup + create_mocks :config, :utils + @config.expect.ignore.returns(:args_and_calls) + @config.stubs!(:respond_to?).returns(true) + @cmock_generator_plugin_ignore = CMockGeneratorPluginIgnore.new(@config, @utils) + + @config.expect.ignore.returns(:args_only) + @cmock_generator_plugin_ignore_just_args = CMockGeneratorPluginIgnore.new(@config, @utils) + end + + def teardown + end + + should "have set up internal accessors correctly on init" do + assert_equal(@config, @cmock_generator_plugin_ignore.config) + assert_equal(@utils, @cmock_generator_plugin_ignore.utils) + assert_equal(2, @cmock_generator_plugin_ignore.priority) + end + + should "not have any additional include file requirements" do + assert(!@cmock_generator_plugin_ignore.respond_to?(:include_files)) + end + + should "add a required variable to the instance structure" do + function = {:name => "Grass", :args => [], :return => test_return[:void]} + expected = " int Grass_IgnoreBool;\n" + returned = @cmock_generator_plugin_ignore.instance_structure(function) + assert_equal(expected, returned) + end + + should "handle function declarations for functions without return values" do + function = {:name => "Mold", :args_string => "void", :return => test_return[:void]} + expected = "#define Mold_Ignore() Mold_CMockIgnore(__LINE__)\nvoid Mold_CMockIgnore(UNITY_LINE_TYPE cmock_line);\n" + returned = @cmock_generator_plugin_ignore.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "handle function declarations for functions that returns something" do + function = {:name => "Fungus", :args_string => "void", :return => test_return[:string]} + expected = "#define Fungus_IgnoreAndReturn(cmock_retval) Fungus_CMockIgnoreAndReturn(__LINE__, cmock_retval)\n"+ + "void Fungus_CMockIgnoreAndReturn(UNITY_LINE_TYPE cmock_line, const char* cmock_to_return);\n" + returned = @cmock_generator_plugin_ignore.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "add required code to implementation precheck with void function (when :args_and_calls)" do + function = {:name => "Mold", :args_string => "void", :return => test_return[:void]} + expected = [" if (Mock.Mold_IgnoreBool)\n", + " {\n", + " return;\n", + " }\n" + ].join + returned = @cmock_generator_plugin_ignore.mock_implementation_for_ignores(function) + assert_equal(expected, returned) + end + + should "add required code to implementation precheck with return functions (when :args_and_calls)" do + function = {:name => "Fungus", :args_string => "void", :return => test_return[:int]} + retval = test_return[:int].merge({ :name => "cmock_call_instance->ReturnVal"}) + @utils.expect.code_assign_argument_quickly("Mock.Fungus_FinalReturn", retval).returns(' mock_retval_0') + expected = [" if (Mock.Fungus_IgnoreBool)\n", + " {\n", + " if (cmock_call_instance == NULL)\n", + " return Mock.Fungus_FinalReturn;\n", + " mock_retval_0", + " return cmock_call_instance->ReturnVal;\n", + " }\n" + ].join + returned = @cmock_generator_plugin_ignore.mock_implementation_for_ignores(function) + assert_equal(expected, returned) + end + + should "not add code to implementation prefix (when :args_only)" do + function = {:name => "Fungus", :args_string => "void", :return => test_return[:int]} + retval = test_return[:int].merge({ :name => "cmock_call_instance->ReturnVal"}) + expected = "" + returned = @cmock_generator_plugin_ignore.mock_implementation_precheck(function) + assert_equal(expected, returned) + end + + should "add required code to implementation with void function (when :args_only)" do + function = {:name => "Mold", :args_string => "void", :return => test_return[:void]} + expected = [" if (Mock.Mold_IgnoreBool)\n", + " {\n", + " return;\n", + " }\n" + ].join + returned = @cmock_generator_plugin_ignore_just_args.mock_implementation(function) + assert_equal(expected, returned) + end + + should "add required code to implementation with return functions (when :args_only)" do + function = {:name => "Fungus", :args_string => "void", :return => test_return[:int]} + retval = test_return[:int].merge({ :name => "cmock_call_instance->ReturnVal"}) + @utils.expect.code_assign_argument_quickly("Mock.Fungus_FinalReturn", retval).returns(' mock_retval_0') + expected = [" if (Mock.Fungus_IgnoreBool)\n", + " {\n", + " if (cmock_call_instance == NULL)\n", + " return Mock.Fungus_FinalReturn;\n", + " mock_retval_0", + " return cmock_call_instance->ReturnVal;\n", + " }\n" + ].join + returned = @cmock_generator_plugin_ignore_just_args.mock_implementation(function) + assert_equal(expected, returned) + end + + should "add a new mock interface for ignoring when function had no return value" do + function = {:name => "Slime", :args => [], :args_string => "void", :return => test_return[:void]} + expected = ["void Slime_CMockIgnore(UNITY_LINE_TYPE cmock_line)\n", + "{\n", + " Mock.Slime_IgnoreBool = (int)1;\n", + "}\n\n" + ].join + @config.expect.ignore.returns(:args_and_calls) + returned = @cmock_generator_plugin_ignore.mock_interfaces(function) + assert_equal(expected, returned) + end + + should "add a new mock interface for ignoring when function had no return value and we are checking args only" do + function = {:name => "Slime", :args => [], :args_string => "void", :return => test_return[:void]} + expected = ["void Slime_CMockIgnore(UNITY_LINE_TYPE cmock_line)\n", + "{\n", + "mock_return_1", + " Mock.Slime_IgnoreBool = (int)1;\n", + "}\n\n" + ].join + @config.expect.ignore.returns(:args_only) + @utils.expect.code_add_base_expectation("Slime", true).returns("mock_return_1") + returned = @cmock_generator_plugin_ignore.mock_interfaces(function) + assert_equal(expected, returned) + end + + should "add a new mock interface for ignoring when function has return value" do + function = {:name => "Slime", :args => [], :args_string => "void", :return => test_return[:int]} + @config.expect.ignore.returns(:args_and_calls) + @utils.expect.code_add_base_expectation("Slime", false).returns("mock_return_1") + expected = ["void Slime_CMockIgnoreAndReturn(UNITY_LINE_TYPE cmock_line, int cmock_to_return)\n", + "{\n", + "mock_return_1", + " cmock_call_instance->ReturnVal = cmock_to_return;\n", + " Mock.Slime_IgnoreBool = (int)1;\n", + "}\n\n" + ].join + returned = @cmock_generator_plugin_ignore.mock_interfaces(function) + assert_equal(expected, returned) + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/unit/cmock_generator_utils_test.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/unit/cmock_generator_utils_test.rb new file mode 100644 index 0000000..7b24fe3 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/unit/cmock_generator_utils_test.rb @@ -0,0 +1,291 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require File.expand_path(File.dirname(__FILE__)) + "/../test_helper" +require 'cmock_generator_utils' + +class CMockGeneratorUtilsTest < Test::Unit::TestCase + def setup + create_mocks :config, :unity_helper, :unity_helper + + @config.expect.when_ptr.returns(:compare_ptr) + @config.expect.enforce_strict_ordering.returns(false) + @config.expect.plugins.returns([]) + @config.expect.plugins.returns([]) + @config.expect.treat_as.returns(['int','short','long','char','char*']) + @cmock_generator_utils_simple = CMockGeneratorUtils.new(@config, {:unity_helper => @unity_helper}) + + @config.expect.when_ptr.returns(:smart) + @config.expect.enforce_strict_ordering.returns(true) + @config.expect.plugins.returns([:array, :cexception]) + @config.expect.plugins.returns([:array, :cexception]) + @config.expect.treat_as.returns(['int','short','long','char','uint32_t','char*']) + @cmock_generator_utils_complex = CMockGeneratorUtils.new(@config, {:unity_helper => @unity_helper, :A=>1, :B=>2}) + end + + def teardown + end + + should "have set up internal accessors correctly on init" do + assert_equal(@config, @cmock_generator_utils_simple.config) + assert_equal({:unity_helper => @unity_helper}, @cmock_generator_utils_simple.helpers) + assert_equal(false, @cmock_generator_utils_simple.arrays) + assert_equal(false, @cmock_generator_utils_simple.cexception) + end + + should "have set up internal accessors correctly on init, complete with passed helpers" do + assert_equal(@config, @cmock_generator_utils_complex.config) + assert_equal({:unity_helper => @unity_helper, :A=>1, :B=>2},@cmock_generator_utils_complex.helpers) + assert_equal(true, @cmock_generator_utils_complex.arrays) + assert_equal(true, @cmock_generator_utils_complex.cexception) + end + + should "add code for a base expectation with no plugins" do + expected = + " CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_Apple_CALL_INSTANCE));\n" + + " CMOCK_Apple_CALL_INSTANCE* cmock_call_instance = (CMOCK_Apple_CALL_INSTANCE*)CMock_Guts_GetAddressFor(cmock_guts_index);\n" + + " UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, \"CMock has run out of memory. Please allocate more.\");\n" + + " Mock.Apple_CallInstance = CMock_Guts_MemChain(Mock.Apple_CallInstance, cmock_guts_index);\n" + + " cmock_call_instance->LineNumber = cmock_line;\n" + output = @cmock_generator_utils_simple.code_add_base_expectation("Apple") + assert_equal(expected, output) + end + + should "add code for a base expectation with all plugins" do + expected = + " CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_Apple_CALL_INSTANCE));\n" + + " CMOCK_Apple_CALL_INSTANCE* cmock_call_instance = (CMOCK_Apple_CALL_INSTANCE*)CMock_Guts_GetAddressFor(cmock_guts_index);\n" + + " UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, \"CMock has run out of memory. Please allocate more.\");\n" + + " Mock.Apple_CallInstance = CMock_Guts_MemChain(Mock.Apple_CallInstance, cmock_guts_index);\n" + + " cmock_call_instance->LineNumber = cmock_line;\n" + + " cmock_call_instance->CallOrder = ++GlobalExpectCount;\n" + + " cmock_call_instance->ExceptionToThrow = CEXCEPTION_NONE;\n" + output = @cmock_generator_utils_complex.code_add_base_expectation("Apple", true) + assert_equal(expected, output) + end + + should "add code for a base expectation with all plugins and ordering not supported" do + expected = + " CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_Apple_CALL_INSTANCE));\n" + + " CMOCK_Apple_CALL_INSTANCE* cmock_call_instance = (CMOCK_Apple_CALL_INSTANCE*)CMock_Guts_GetAddressFor(cmock_guts_index);\n" + + " UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, \"CMock has run out of memory. Please allocate more.\");\n" + + " Mock.Apple_CallInstance = CMock_Guts_MemChain(Mock.Apple_CallInstance, cmock_guts_index);\n" + + " cmock_call_instance->LineNumber = cmock_line;\n" + + " cmock_call_instance->ExceptionToThrow = CEXCEPTION_NONE;\n" + output = @cmock_generator_utils_complex.code_add_base_expectation("Apple", false) + assert_equal(expected, output) + end + + should "add argument expectations for values when no array plugin" do + arg1 = { :name => "Orange", :const? => false, :type => 'int', :ptr? => false } + expected1 = " cmock_call_instance->Expected_Orange = Orange;\n" + + arg2 = { :name => "Lemon", :const? => true, :type => 'const char*', :ptr? => true } + expected2 = " cmock_call_instance->Expected_Lemon = (const char*)Lemon;\n" + + arg3 = { :name => "Kiwi", :const? => false, :type => 'KIWI_T*', :ptr? => true } + expected3 = " cmock_call_instance->Expected_Kiwi = Kiwi;\n" + + arg4 = { :name => "Lime", :const? => false, :type => 'LIME_T', :ptr? => false } + expected4 = " memcpy(&cmock_call_instance->Expected_Lime, &Lime, sizeof(LIME_T));\n" + + assert_equal(expected1, @cmock_generator_utils_simple.code_add_an_arg_expectation(arg1)) + assert_equal(expected2, @cmock_generator_utils_simple.code_add_an_arg_expectation(arg2)) + assert_equal(expected3, @cmock_generator_utils_simple.code_add_an_arg_expectation(arg3)) + assert_equal(expected4, @cmock_generator_utils_simple.code_add_an_arg_expectation(arg4)) + end + + should "add argument expectations for values when array plugin enabled" do + arg1 = { :name => "Orange", :const? => false, :type => 'int', :ptr? => false } + expected1 = " cmock_call_instance->Expected_Orange = Orange;\n" + + arg2 = { :name => "Lemon", :const? => true, :type => 'const char*', :ptr? => true } + expected2 = " cmock_call_instance->Expected_Lemon = (const char*)Lemon;\n" + + " cmock_call_instance->Expected_Lemon_Depth = Lemon_Depth;\n" + + arg3 = { :name => "Kiwi", :const? => false, :type => 'KIWI_T*', :ptr? => true } + expected3 = " cmock_call_instance->Expected_Kiwi = Kiwi;\n" + + " cmock_call_instance->Expected_Kiwi_Depth = Kiwi_Depth;\n" + + arg4 = { :name => "Lime", :const? => false, :type => 'LIME_T', :ptr? => false } + expected4 = " memcpy(&cmock_call_instance->Expected_Lime, &Lime, sizeof(LIME_T));\n" + + assert_equal(expected1, @cmock_generator_utils_complex.code_add_an_arg_expectation(arg1)) + assert_equal(expected2, @cmock_generator_utils_complex.code_add_an_arg_expectation(arg2, 'Lemon_Depth')) + assert_equal(expected3, @cmock_generator_utils_complex.code_add_an_arg_expectation(arg3, 'Lemon_Depth')) + assert_equal(expected4, @cmock_generator_utils_complex.code_add_an_arg_expectation(arg4)) + end + + should 'not have an argument loader when the function has no arguments' do + function = { :name => "Melon", :args_string => "void" } + + assert_equal("", @cmock_generator_utils_complex.code_add_argument_loader(function)) + end + + should 'create an argument loader when the function has arguments' do + function = { :name => "Melon", + :args_string => "stuff", + :args => [test_arg[:int_ptr], test_arg[:mytype], test_arg[:string]] + } + expected = "void CMockExpectParameters_Melon(CMOCK_Melon_CALL_INSTANCE* cmock_call_instance, stuff)\n{\n" + + " cmock_call_instance->Expected_MyIntPtr = MyIntPtr;\n" + + " memcpy(&cmock_call_instance->Expected_MyMyType, &MyMyType, sizeof(MY_TYPE));\n" + + " cmock_call_instance->Expected_MyStr = (char*)MyStr;\n" + + "}\n\n" + assert_equal(expected, @cmock_generator_utils_simple.code_add_argument_loader(function)) + end + + should 'create an argument loader when the function has arguments supporting arrays' do + function = { :name => "Melon", + :args_string => "stuff", + :args => [test_arg[:int_ptr], test_arg[:mytype], test_arg[:string]] + } + expected = "void CMockExpectParameters_Melon(CMOCK_Melon_CALL_INSTANCE* cmock_call_instance, int* MyIntPtr, int MyIntPtr_Depth, const MY_TYPE MyMyType, const char* MyStr)\n{\n" + + " cmock_call_instance->Expected_MyIntPtr = MyIntPtr;\n" + + " cmock_call_instance->Expected_MyIntPtr_Depth = MyIntPtr_Depth;\n" + + " memcpy(&cmock_call_instance->Expected_MyMyType, &MyMyType, sizeof(MY_TYPE));\n" + + " cmock_call_instance->Expected_MyStr = (char*)MyStr;\n" + + "}\n\n" + assert_equal(expected, @cmock_generator_utils_complex.code_add_argument_loader(function)) + end + + should "not call argument loader if there are no arguments to actually use for this function" do + function = { :name => "Pineapple", :args_string => "void" } + + assert_equal("", @cmock_generator_utils_complex.code_call_argument_loader(function)) + end + + should 'call an argument loader when the function has arguments' do + function = { :name => "Pineapple", + :args_string => "stuff", + :args => [test_arg[:int_ptr], test_arg[:mytype], test_arg[:string]] + } + expected = " CMockExpectParameters_Pineapple(cmock_call_instance, MyIntPtr, MyMyType, MyStr);\n" + assert_equal(expected, @cmock_generator_utils_simple.code_call_argument_loader(function)) + end + + should 'call an argument loader when the function has arguments with arrays' do + function = { :name => "Pineapple", + :args_string => "stuff", + :args => [test_arg[:int_ptr], test_arg[:mytype], test_arg[:string]] + } + expected = " CMockExpectParameters_Pineapple(cmock_call_instance, MyIntPtr, 1, MyMyType, MyStr);\n" + assert_equal(expected, @cmock_generator_utils_complex.code_call_argument_loader(function)) + end + + should 'handle a simple assert when requested' do + function = { :name => 'Pear' } + arg = test_arg[:int] + expected = " UNITY_TEST_ASSERT_EQUAL_INT(cmock_call_instance->Expected_MyInt, MyInt, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyInt'.\");\n" + @unity_helper.expect.get_helper('int').returns(['UNITY_TEST_ASSERT_EQUAL_INT','']) + assert_equal(expected, @cmock_generator_utils_simple.code_verify_an_arg_expectation(function, arg)) + end + + should 'handle a pointer comparison when configured to do so' do + function = { :name => 'Pear' } + arg = test_arg[:int_ptr] + expected = " UNITY_TEST_ASSERT_EQUAL_PTR(cmock_call_instance->Expected_MyIntPtr, MyIntPtr, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyIntPtr'.\");\n" + assert_equal(expected, @cmock_generator_utils_simple.code_verify_an_arg_expectation(function, arg)) + end + + should 'handle const char as string compares ' do + function = { :name => 'Pear' } + arg = test_arg[:string] + expected = " UNITY_TEST_ASSERT_EQUAL_STRING(cmock_call_instance->Expected_MyStr, MyStr, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyStr'.\");\n" + @unity_helper.expect.get_helper('char*').returns(['UNITY_TEST_ASSERT_EQUAL_STRING','']) + assert_equal(expected, @cmock_generator_utils_simple.code_verify_an_arg_expectation(function, arg)) + end + + should 'handle custom types as memory compares when we have no better way to do it' do + function = { :name => 'Pear' } + arg = test_arg[:mytype] + expected = " UNITY_TEST_ASSERT_EQUAL_MEMORY((void*)(&cmock_call_instance->Expected_MyMyType), (void*)(&MyMyType), sizeof(MY_TYPE), cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyMyType'.\");\n" + @unity_helper.expect.get_helper('MY_TYPE').returns(['UNITY_TEST_ASSERT_EQUAL_MEMORY','&']) + assert_equal(expected, @cmock_generator_utils_simple.code_verify_an_arg_expectation(function, arg)) + end + + should 'handle custom types with custom handlers when available, even if they do not support the extra message' do + function = { :name => 'Pear' } + arg = test_arg[:mytype] + expected = " UNITY_TEST_ASSERT_EQUAL_MY_TYPE(cmock_call_instance->Expected_MyMyType, MyMyType, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyMyType'.\");\n" + @unity_helper.expect.get_helper('MY_TYPE').returns(['UNITY_TEST_ASSERT_EQUAL_MY_TYPE','']) + assert_equal(expected, @cmock_generator_utils_simple.code_verify_an_arg_expectation(function, arg)) + end + + should 'handle pointers to custom types with array handlers, even if the array extension is turned off' do + function = { :name => 'Pear' } + arg = test_arg[:mytype] + expected = " UNITY_TEST_ASSERT_EQUAL_MY_TYPE_ARRAY(&cmock_call_instance->Expected_MyMyType, &MyMyType, 1, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyMyType'.\");\n" + @unity_helper.expect.get_helper('MY_TYPE').returns(['UNITY_TEST_ASSERT_EQUAL_MY_TYPE_ARRAY','&']) + assert_equal(expected, @cmock_generator_utils_simple.code_verify_an_arg_expectation(function, arg)) + end + + should 'handle a simple assert when requested with array plugin enabled' do + function = { :name => 'Pear' } + arg = test_arg[:int] + expected = " UNITY_TEST_ASSERT_EQUAL_INT(cmock_call_instance->Expected_MyInt, MyInt, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyInt'.\");\n" + @unity_helper.expect.get_helper('int').returns(['UNITY_TEST_ASSERT_EQUAL_INT','']) + assert_equal(expected, @cmock_generator_utils_complex.code_verify_an_arg_expectation(function, arg)) + end + + should 'handle an array comparison with array plugin enabled' do + function = { :name => 'Pear' } + arg = test_arg[:int_ptr] + expected = " if (cmock_call_instance->Expected_MyIntPtr == NULL)\n" + + " { UNITY_TEST_ASSERT_NULL(MyIntPtr, cmock_line, \"Expected NULL. Function 'Pear' called with unexpected value for argument 'MyIntPtr'.\"); }\n" + + " else if (cmock_call_instance->Expected_MyIntPtr_Depth == 0)\n" + + " { UNITY_TEST_ASSERT_EQUAL_PTR(cmock_call_instance->Expected_MyIntPtr, MyIntPtr, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyIntPtr'.\"); }\n" + + " else\n" + + " { UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(cmock_call_instance->Expected_MyIntPtr, MyIntPtr, cmock_call_instance->Expected_MyIntPtr_Depth, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyIntPtr'.\"); }\n" + @unity_helper.expect.get_helper('int*').returns(['UNITY_TEST_ASSERT_EQUAL_INT_ARRAY','']) + assert_equal(expected, @cmock_generator_utils_complex.code_verify_an_arg_expectation(function, arg)) + end + + should 'handle const char as string compares with array plugin enabled' do + function = { :name => 'Pear' } + arg = test_arg[:string] + expected = " UNITY_TEST_ASSERT_EQUAL_STRING(cmock_call_instance->Expected_MyStr, MyStr, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyStr'.\");\n" + @unity_helper.expect.get_helper('char*').returns(['UNITY_TEST_ASSERT_EQUAL_STRING','']) + assert_equal(expected, @cmock_generator_utils_complex.code_verify_an_arg_expectation(function, arg)) + end + + should 'handle custom types as memory compares when we have no better way to do it with array plugin enabled' do + function = { :name => 'Pear' } + arg = test_arg[:mytype] + expected = " UNITY_TEST_ASSERT_EQUAL_MEMORY((void*)(&cmock_call_instance->Expected_MyMyType), (void*)(&MyMyType), sizeof(MY_TYPE), cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyMyType'.\");\n" + @unity_helper.expect.get_helper('MY_TYPE').returns(['UNITY_TEST_ASSERT_EQUAL_MEMORY','&']) + assert_equal(expected, @cmock_generator_utils_complex.code_verify_an_arg_expectation(function, arg)) + end + + should 'handle custom types with custom handlers when available, even if they do not support the extra message with array plugin enabled' do + function = { :name => 'Pear' } + arg = test_arg[:mytype] + expected = " UNITY_TEST_ASSERT_EQUAL_MY_TYPE(cmock_call_instance->Expected_MyMyType, MyMyType, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyMyType'.\");\n" + @unity_helper.expect.get_helper('MY_TYPE').returns(['UNITY_TEST_ASSERT_EQUAL_MY_TYPE','']) + assert_equal(expected, @cmock_generator_utils_complex.code_verify_an_arg_expectation(function, arg)) + end + + should 'handle custom types with array handlers when array plugin is enabled' do + function = { :name => 'Pear' } + arg = test_arg[:mytype_ptr] + expected = " if (cmock_call_instance->Expected_MyMyTypePtr == NULL)\n" + + " { UNITY_TEST_ASSERT_NULL(MyMyTypePtr, cmock_line, \"Expected NULL. Function 'Pear' called with unexpected value for argument 'MyMyTypePtr'.\"); }\n" + + " else if (cmock_call_instance->Expected_MyMyTypePtr_Depth == 0)\n" + + " { UNITY_TEST_ASSERT_EQUAL_PTR(cmock_call_instance->Expected_MyMyTypePtr, MyMyTypePtr, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyMyTypePtr'.\"); }\n" + + " else\n" + + " { UNITY_TEST_ASSERT_EQUAL_MY_TYPE_ARRAY(cmock_call_instance->Expected_MyMyTypePtr, MyMyTypePtr, cmock_call_instance->Expected_MyMyTypePtr_Depth, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyMyTypePtr'.\"); }\n" + @unity_helper.expect.get_helper('MY_TYPE*').returns(['UNITY_TEST_ASSERT_EQUAL_MY_TYPE_ARRAY','']) + assert_equal(expected, @cmock_generator_utils_complex.code_verify_an_arg_expectation(function, arg)) + end + + should 'handle custom types with array handlers when array plugin is enabled for non-array types' do + function = { :name => 'Pear' } + arg = test_arg[:mytype] + expected = " UNITY_TEST_ASSERT_EQUAL_MY_TYPE_ARRAY(&cmock_call_instance->Expected_MyMyType, &MyMyType, 1, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyMyType'.\");\n" + @unity_helper.expect.get_helper('MY_TYPE').returns(['UNITY_TEST_ASSERT_EQUAL_MY_TYPE_ARRAY','&']) + assert_equal(expected, @cmock_generator_utils_complex.code_verify_an_arg_expectation(function, arg)) + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/unit/cmock_header_parser_test.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/unit/cmock_header_parser_test.rb new file mode 100644 index 0000000..6517abd --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/unit/cmock_header_parser_test.rb @@ -0,0 +1,1170 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +$ThisIsOnlyATest = true + +require File.expand_path(File.dirname(__FILE__)) + "/../test_helper" +require 'cmock_header_parser' + +class CMockHeaderParserTest < Test::Unit::TestCase + + def setup + create_mocks :config + @test_name = 'test_file.h' + @config.expect.strippables.returns(['(?:__attribute__\s*\(+.*?\)+)']) + @config.expect.attributes.returns(['__ramfunc', 'funky_attrib']) + @config.expect.treat_as_void.returns(['MY_FUNKY_VOID']) + @config.expect.treat_as.returns({ "BANJOS" => "INT", "TUBAS" => "HEX16"} ) + @config.expect.when_no_prototypes.returns(:error) + @config.expect.verbosity.returns(1) + @config.expect.treat_externs.returns(:exclude) + + @parser = CMockHeaderParser.new(@config) + end + + def teardown + end + + should "create and initialize variables to defaults appropriately" do + assert_equal([], @parser.funcs) + assert_equal(['const', '__ramfunc', 'funky_attrib'], @parser.c_attributes) + assert_equal(['void','MY_FUNKY_VOID'], @parser.treat_as_void) + end + + should "strip out line comments" do + source = + " abcd;\n" + + "// hello;\n" + + "who // is you\n" + + expected = + [ + "abcd", + "who" + ] + + assert_equal(expected, @parser.import_source(source).map!{|s|s.strip}) + end + + + should "remove block comments" do + source = + " no_comments;\n" + + "// basic_line_comment;\n" + + "/* basic_block_comment;*/\n" + + "pre_block; /* start_of_block_comment;\n" + + "// embedded_line_comment_in_block_comment; */\n" + + "// /* commented_out_block_comment_line\n" + + "shown_because_block_comment_invalid_from_line_comment;\n" + + "// */\n" + + "//* shorter_commented_out_block_comment_line; \n" + + "shown_because_block_comment_invalid_from_shorter_line_comment;\n" + + "/*/\n" + + "not_shown_because_line_above_started_comment;\n" + + "//*/\n" + + "/* \n" + + "not_shown_because_block_comment_started_this_time;\n" + + "/*/\n" + + "shown_because_line_above_ended_comment_this_time;\n" + + "//*/\n" + + expected = + [ + "no_comments", + "pre_block", + "shown_because_block_comment_invalid_from_line_comment", + "shown_because_block_comment_invalid_from_shorter_line_comment", + "shown_because_line_above_ended_comment_this_time" + ] + + assert_equal(expected, @parser.import_source(source).map!{|s|s.strip}) + end + + + should "remove preprocessor directives" do + source = + "#when stuff_happens\n" + + "#ifdef _TEST\n" + + "#pragma stack_switch" + + expected = [] + + assert_equal(expected, @parser.import_source(source)) + end + + + should "remove assembler pragma sections" do + source = + " #pragma\tasm\n" + + " .foo\n" + + " lda %m\n" + + " nop\n" + + "# pragma endasm \n" + + "foo" + + expected = ["foo"] + + assert_equal(expected, @parser.import_source(source)) + end + + + should "smush lines together that contain continuation characters" do + source = + "hoo hah \\\n" + + "when \\ \n" + + expected = + [ + "hoo hah when" + ] + + assert_equal(expected, @parser.import_source(source).map!{|s|s.strip}) + end + + + should "remove C macro definitions" do + source = + "#define this is the first line\\\n" + + "and the second\\\n" + + "and the third that should be removed\n" + + "but I'm here\n" + + expected = ["but I'm here"] + + assert_equal(expected, @parser.import_source(source)) + end + + + should "remove typedef statements" do + source = + "typedef uint32 (unsigned int);\n" + + "const typedef int INT;\n" + + "int notatypedef;\n" + + "int typedef_isnt_me;\n" + + " typedef who cares what really comes here \\\n" + # exercise multiline typedef + " continuation;\n" + + "this should remain!;\n" + + "typedef blah bleh;\n" + + "typedef struct shell_command_struct {\n" + + " char_ptr COMMAND;\n" + + " int_32 (*SHELL_FUNC)(int_32 argc);\n" + + "} SHELL_COMMAND_STRUCT, * SHELL_COMMAND_PTR;\n" + + "typedef struct shell_command_struct {\n" + + " char_ptr COMMAND;\n" + + " int_32 (*SHELL_FUNC)(int_32 argc, char_ptr argv[]);\n" + + "} SHELL_COMMAND_STRUCT, * SHELL_COMMAND_PTR;\n" + + "typedef struct shell_command_struct {\n" + + " char_ptr COMMAND;\n" + + " int_32 (*SHELL_FUNC)(int_32 argc);\n" + + "};\n" + + expected = + [ + "int notatypedef", + "int typedef_isnt_me", + "this should remain!" + ] + + assert_equal(expected, @parser.import_source(source).map!{|s|s.strip}) + end + + + should "remove enum statements" do + source = + "enum _NamedEnum {\n" + + " THING1 = (0x0001),\n" + + " THING2 = (0x0001 << 5),\n" + + "}ListOValues;\n\n" + + "don't delete me!!\n" + + " modifier_str enum _NamedEnum {THING1 = (0x0001), THING2 = (0x0001 << 5)} ListOValues;\n\n" + + "typedef enum {\n" + + " THING1,\n" + + " THING2,\n" + + "} Thinger;\n" + + "or me!!\n" + + assert_equal(["don't delete me!! or me!!"], @parser.import_source(source).map!{|s|s.strip}) + end + + + should "remove union statements" do + source = + "union _NamedDoohicky {\n" + + " unsigned int a;\n" + + " char b;\n" + + "} Doohicky;\n\n" + + "I want to live!!\n" + + "some_modifier union { unsigned int a; char b;} Whatever;\n" + + "typedef union {\n" + + " unsigned int a;\n" + + " char b;\n" + + "} Whatever;\n" + + "me too!!\n" + + assert_equal(["I want to live!! me too!!"], @parser.import_source(source).map!{|s|s.strip}) + end + + + should "remove struct statements" do + source = + "struct _NamedStruct1 {\n" + + " unsigned int a;\n" + + " signed long int b;\n" + + "} Thing ;\n\n" + + "extern struct ForwardDeclared_t TestDataType1;\n" + + "void foo(void);\n" + + "struct\n"+ + " MultilineForwardDeclared_t\n" + + " TestDataType2;\n" + + "struct THINGER foo(void);\n" + + "typedef struct {\n" + + " unsigned int a;\n" + + " signed char b;\n" + + "}Thinger;\n" + + "I want to live!!\n" + + assert_equal(["void foo(void)", "struct THINGER foo(void)", "I want to live!!"], + @parser.import_source(source).map!{|s|s.strip}) + end + + should "remove externed and inline functions" do + source = + " extern uint32 foobar(unsigned int);\n" + + "uint32 extern_name_func(unsigned int);\n" + + "uint32 funcinline(unsigned int);\n" + + "extern void bar(unsigned int);\n" + + "inline void bar(unsigned int);\n" + + "extern\n" + + "void kinda_ugly_on_the_next_line(unsigned int);\n" + + expected = + [ + "uint32 extern_name_func(unsigned int)", + "uint32 funcinline(unsigned int)" + ] + + assert_equal(expected, @parser.import_source(source).map!{|s|s.strip}) + end + + should "remove a fully defined inline function" do + source = + "inline void foo(unsigned int a) { oranges = a; }\n" + + "inline void bar(unsigned int a) { apples = a; };\n" + + "inline void bar(unsigned int a)\n" + + "{" + + " bananas = a;\n" + + "}" + + # ensure it's expected type of exception + assert_raise RuntimeError do + @parser.parse("module", source) + end + + assert_equal([], @parser.funcs) + + # verify exception message + begin + @parser.parse("module", source) + rescue RuntimeError => e + assert_equal("ERROR: No function prototypes found!", e.message) + end + end + + should "remove just inline functions if externs to be included" do + source = + " extern uint32 foobar(unsigned int);\n" + + "uint32 extern_name_func(unsigned int);\n" + + "uint32 funcinline(unsigned int);\n" + + "extern void bar(unsigned int);\n" + + "inline void bar(unsigned int);\n" + + "extern\n" + + "void kinda_ugly_on_the_next_line(unsigned int);\n" + + expected = + [ "extern uint32 foobar(unsigned int)", + "uint32 extern_name_func(unsigned int)", + "uint32 funcinline(unsigned int)", + "extern void bar(unsigned int)", + "extern void kinda_ugly_on_the_next_line(unsigned int)" + ] + + @parser.treat_externs = :include + assert_equal(expected, @parser.import_source(source).map!{|s|s.strip}) + end + + + should "remove defines" do + source = + "#define whatever you feel like defining\n" + + "void hello(void);\n" + + "#DEFINE I JUST DON'T CARE\n" + + "#deFINE\n" + + "#define get_foo() \\\n ((Thing)foo.bar)" # exercise multiline define + + expected = + [ + "void hello(void)", + ] + + assert_equal(expected, @parser.import_source(source).map!{|s|s.strip}) + end + + + should "remove keywords that would keep things from going smoothly in the future" do + source = + "const int TheMatrix(register int Trinity, unsigned int *restrict Neo)" + + expected = + [ + "const int TheMatrix(int Trinity, unsigned int * Neo)", + ] + + assert_equal(expected, @parser.import_source(source).map!{|s|s.strip}) + end + + + # some code actually typedef's void even though it's not ANSI C and is, frankly, weird + # since cmock treats void specially, we can't let void be obfuscated + should "handle odd case of typedef'd void returned" do + source = "MY_FUNKY_VOID FunkyVoidReturned(int a)" + expected = { :var_arg=>nil, + :name=>"FunkyVoidReturned", + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :modifier=>"", + :contains_ptr? => false, + :args=>[{:type=>"int", :name=>"a", :ptr? => false, :const? => false}], + :args_string=>"int a", + :args_call=>"a"} + assert_equal(expected, @parser.parse_declaration(source)) + end + + should "handle odd case of typedef'd void as arg" do + source = "int FunkyVoidAsArg(MY_FUNKY_VOID)" + expected = { :var_arg=>nil, + :name=>"FunkyVoidAsArg", + :return=>{ :type => "int", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "int cmock_to_return", + :void? => false + }, + :modifier=>"", + :contains_ptr? => false, + :args=>[], + :args_string=>"void", + :args_call=>"" } + assert_equal(expected, @parser.parse_declaration(source)) + end + + should "handle odd case of typedef'd void as arg pointer" do + source = "char FunkyVoidPointer(MY_FUNKY_VOID* bluh)" + expected = { :var_arg=>nil, + :name=>"FunkyVoidPointer", + :return=>{ :type => "char", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "char cmock_to_return", + :void? => false + }, + :modifier=>"", + :contains_ptr? => true, + :args=>[{:type=>"MY_FUNKY_VOID*", :name=>"bluh", :ptr? => true, :const? => false}], + :args_string=>"MY_FUNKY_VOID* bluh", + :args_call=>"bluh" } + assert_equal(expected, @parser.parse_declaration(source)) + end + + + should "strip default values from function parameter lists" do + source = + "void Foo(int a = 57, float b=37.52, char c= 'd', char* e=\"junk\");\n" + + expected = + [ + "void Foo(int a, float b, char c, char* e)" + ] + + assert_equal(expected, @parser.import_source(source).map!{|s|s.strip}) + end + + + should "raise upon empty file" do + source = '' + + # ensure it's expected type of exception + assert_raise RuntimeError do + @parser.parse("module", "") + end + + assert_equal([], @parser.funcs) + + # verify exception message + begin + @parser.parse("module", "") + rescue RuntimeError => e + assert_equal("ERROR: No function prototypes found!", e.message) + end + end + + + should "raise upon no function prototypes found in file" do + source = + "typedef void SILLY_VOID_TYPE1;\n" + + "typedef (void) SILLY_VOID_TYPE2 ;\n" + + "typedef ( void ) (*FUNCPTR)(void);\n\n" + + "#define get_foo() \\\n ((Thing)foo.bar)" + + # ensure it's expected type of exception + assert_raise(RuntimeError) do + @parser.parse("module", source) + end + + assert_equal([], @parser.funcs) + + # verify exception message + begin + @parser.parse("module", source) + rescue RuntimeError => e + assert_equal("ERROR: No function prototypes found!", e.message) + end + end + + + should "raise upon prototype parsing failure" do + source = "void (int, )" + + # ensure it's expected type of exception + assert_raise(RuntimeError) do + @parser.parse("module", source) + end + + # verify exception message + begin + @parser.parse("module", source) + rescue RuntimeError => e + assert(e.message.include?("Failed Parsing Declaration Prototype!")) + end + end + + should "extract and return function declarations with retval and args" do + + source = "int Foo(int a, unsigned int b)" + expected = { :var_arg=>nil, + :name=>"Foo", + :return=>{ :type => "int", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "int cmock_to_return", + :void? => false + }, + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"int", :name=>"a", :ptr? => false, :const? => false}, + {:type=>"unsigned int", :name=>"b", :ptr? => false, :const? => false} + ], + :args_string=>"int a, unsigned int b", + :args_call=>"a, b" } + assert_equal(expected, @parser.parse_declaration(source)) + end + + should "extract and return function declarations with no retval" do + + source = "void FunkyChicken( uint la, int de, bool da)" + expected = { :var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"FunkyChicken", + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"uint", :name=>"la", :ptr? => false, :const? => false}, + {:type=>"int", :name=>"de", :ptr? => false, :const? => false}, + {:type=>"bool", :name=>"da", :ptr? => false, :const? => false} + ], + :args_string=>"uint la, int de, bool da", + :args_call=>"la, de, da" } + assert_equal(expected, @parser.parse_declaration(source)) + end + + should "extract and return function declarations with implied voids" do + + source = "void tat()" + expected = { :var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"tat", + :modifier=>"", + :contains_ptr? => false, + :args=>[ ], + :args_string=>"void", + :args_call=>"" } + assert_equal(expected, @parser.parse_declaration(source)) + end + + should "extract modifiers properly" do + + source = "const int TheMatrix(int Trinity, unsigned int * Neo)" + expected = { :var_arg=>nil, + :return=>{ :type => "int", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "int cmock_to_return", + :void? => false + }, + :name=>"TheMatrix", + :modifier=>"const", + :contains_ptr? => true, + :args=>[ {:type=>"int", :name=>"Trinity", :ptr? => false, :const? => false}, + {:type=>"unsigned int*", :name=>"Neo", :ptr? => true, :const? => false} + ], + :args_string=>"int Trinity, unsigned int* Neo", + :args_call=>"Trinity, Neo" } + assert_equal(expected, @parser.parse_declaration(source)) + end + + should "fully parse multiple prototypes" do + + source = "const int TheMatrix(int Trinity, unsigned int * Neo);\n" + + "int Morpheus(int, unsigned int*);\n" + + expected = [{ :var_arg=>nil, + :return=> { :type => "int", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "int cmock_to_return", + :void? => false + }, + :name=>"TheMatrix", + :modifier=>"const", + :contains_ptr? => true, + :args=>[ {:type=>"int", :name=>"Trinity", :ptr? => false, :const? => false}, + {:type=>"unsigned int*", :name=>"Neo", :ptr? => true, :const? => false} + ], + :args_string=>"int Trinity, unsigned int* Neo", + :args_call=>"Trinity, Neo" }, + { :var_arg=>nil, + :return=> { :type => "int", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "int cmock_to_return", + :void? => false + }, + :name=>"Morpheus", + :modifier=>"", + :contains_ptr? => true, + :args=>[ {:type=>"int", :name=>"cmock_arg1", :ptr? => false, :const? => false}, + {:type=>"unsigned int*", :name=>"cmock_arg2", :ptr? => true, :const? => false} + ], + :args_string=>"int cmock_arg1, unsigned int* cmock_arg2", + :args_call=>"cmock_arg1, cmock_arg2" + }] + assert_equal(expected, @parser.parse("module", source)[:functions]) + end + + should "not extract for mocking multiply defined prototypes" do + + source = "const int TheMatrix(int Trinity, unsigned int * Neo);\n" + + "const int TheMatrix(int, unsigned int*);\n" + + expected = [{ :var_arg=>nil, + :name=>"TheMatrix", + :return=> { :type => "int", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "int cmock_to_return", + :void? => false + }, + :modifier=>"const", + :contains_ptr? => true, + :args=>[ {:type=>"int", :name=>"Trinity", :ptr? => false, :const? => false}, + {:type=>"unsigned int*", :name=>"Neo", :ptr? => true, :const? => false} + ], + :args_string=>"int Trinity, unsigned int* Neo", + :args_call=>"Trinity, Neo" + }] + assert_equal(expected, @parser.parse("module", source)[:functions]) + end + + should "properly detect typedef'd variants of void and use those" do + + source = "typedef (void) FUNKY_VOID_T;\n" + + "typedef void CHUNKY_VOID_T;\n" + + "FUNKY_VOID_T DrHorrible(int SingAlong);\n" + + "int CaptainHammer(CHUNKY_VOID_T);\n" + + expected = [{ :var_arg=>nil, + :name=>"DrHorrible", + :return => { :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"int", :name=>"SingAlong", :ptr? => false, :const? => false} ], + :args_string=>"int SingAlong", + :args_call=>"SingAlong" + }, + { :var_arg=>nil, + :return=> { :type => "int", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "int cmock_to_return", + :void? => false + }, + :name=>"CaptainHammer", + :modifier=>"", + :contains_ptr? => false, + :args=>[ ], + :args_string=>"void", + :args_call=>"" + }] + assert_equal(expected, @parser.parse("module", source)[:functions]) + end + + should "be ok with structs inside of function declarations" do + + source = "int DrHorrible(struct SingAlong Blog);\n" + + "void Penny(struct const _KeepYourHeadUp_ * const BillyBuddy);\n" + + "struct TheseArentTheHammer CaptainHammer(void);\n" + + expected = [{ :var_arg=>nil, + :return =>{ :type => "int", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "int cmock_to_return", + :void? => false + }, + :name=>"DrHorrible", + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"struct SingAlong", :name=>"Blog", :ptr? => false, :const? => false} ], + :args_string=>"struct SingAlong Blog", + :args_call=>"Blog" + }, + { :var_arg=>nil, + :return=> { :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"Penny", + :modifier=>"", + :contains_ptr? => true, + :args=>[ {:type=>"struct _KeepYourHeadUp_*", :name=>"BillyBuddy", :ptr? => true, :const? => true} ], + :args_string=>"struct const _KeepYourHeadUp_* const BillyBuddy", + :args_call=>"BillyBuddy" + }, + { :var_arg=>nil, + :return=> { :type => "struct TheseArentTheHammer", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "struct TheseArentTheHammer cmock_to_return", + :void? => false + }, + :name=>"CaptainHammer", + :modifier=>"", + :contains_ptr? => false, + :args=>[ ], + :args_string=>"void", + :args_call=>"" + }] + assert_equal(expected, @parser.parse("module", source)[:functions]) + end + + should "extract functions containing unions with union specifier" do + source = "void OrangePeel(union STARS_AND_STRIPES * a, union AFL_CIO b)" + expected = [{ :var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"OrangePeel", + :modifier=>"", + :contains_ptr? => true, + :args=>[ {:type=>"union STARS_AND_STRIPES*", :name=>"a", :ptr? => true, :const? => false}, + {:type=>"union AFL_CIO", :name=>"b", :ptr? => false, :const? => false} + ], + :args_string=>"union STARS_AND_STRIPES* a, union AFL_CIO b", + :args_call=>"a, b" }] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + end + + should "not be thwarted by variables named with primitive types as part of the name" do + source = "void ApplePeel(const unsigned int const_param, int int_param, int integer, char character, int* const constant)" + expected = [{ :var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"ApplePeel", + :modifier=>"", + :contains_ptr? => true, + :args=>[ {:type=> "unsigned int", :name=>"const_param", :ptr? => false, :const? => true}, + {:type=>"int", :name=>"int_param", :ptr? => false, :const? => false}, + {:type=>"int", :name=>"integer", :ptr? => false, :const? => false}, + {:type=>"char", :name=>"character", :ptr? => false, :const? => false}, + {:type=>"int*", :name=>"constant", :ptr? => true, :const? => true} + ], + :args_string=>"const unsigned int const_param, int int_param, int integer, char character, int* const constant", + :args_call=>"const_param, int_param, integer, character, constant" }] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + end + + should "not be thwarted by custom types named similarly to primitive types" do + source = "void LemonPeel(integer param, character thing, longint * junk, constant value, int32_t const number)" + expected = [{:var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"LemonPeel", + :modifier=>"", + :contains_ptr? => true, + :args=>[ {:type=>"integer", :name=>"param", :ptr? => false, :const? => false}, + {:type=>"character", :name=>"thing", :ptr? => false, :const? => false}, + {:type=>"longint*", :name=>"junk", :ptr? => true, :const? => false}, + {:type=>"constant", :name=>"value", :ptr? => false, :const? => false}, + {:type=>"int32_t", :name=>"number", :ptr? => false, :const? => true} + ], + :args_string=>"integer param, character thing, longint* junk, constant value, int32_t const number", + :args_call=>"param, thing, junk, value, number" }] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + end + + should "handle some of those chains of C name specifiers naturally" do + source = "void CoinOperated(signed char abc, const unsigned long int xyz_123, unsigned int const abc_123, long long arm_of_the_law)" + expected = [{:var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"CoinOperated", + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"signed char", :name=>"abc", :ptr? => false, :const? => false}, + {:type=>"unsigned long int", :name=>"xyz_123", :ptr? => false, :const? => true}, + {:type=>"unsigned int", :name=>"abc_123", :ptr? => false, :const? => true}, + {:type=>"long long", :name=>"arm_of_the_law", :ptr? => false, :const? => false} + ], + :args_string=>"signed char abc, const unsigned long int xyz_123, unsigned int const abc_123, long long arm_of_the_law", + :args_call=>"abc, xyz_123, abc_123, arm_of_the_law" }] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + end + + should "handle custom types of various formats" do + source = "void CardOperated(CUSTOM_TYPE abc, CUSTOM_TYPE* xyz_123, CUSTOM_TYPE const abcxyz, struct CUSTOM_TYPE const * const abc123)" + expected = [{:var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"CardOperated", + :modifier=>"", + :contains_ptr? => true, + :args=>[ {:type=>"CUSTOM_TYPE", :name=>"abc", :ptr? => false, :const? => false}, + {:type=>"CUSTOM_TYPE*", :name=>"xyz_123", :ptr? => true, :const? => false}, + {:type=>"CUSTOM_TYPE", :name=>"abcxyz", :ptr? => false, :const? => true}, + {:type=>"struct CUSTOM_TYPE const*", :name=>"abc123", :ptr? => true, :const? => true} + ], + :args_string=>"CUSTOM_TYPE abc, CUSTOM_TYPE* xyz_123, CUSTOM_TYPE const abcxyz, struct CUSTOM_TYPE const* const abc123", + :args_call=>"abc, xyz_123, abcxyz, abc123" }] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + end + + should "handle arrays and treat them as pointers" do + source = "void KeyOperated(CUSTOM_TYPE thing1[], int thing2 [ ], char thing3 [][2 ][ 3], int* thing4[4])" + expected = [{:var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"KeyOperated", + :modifier=>"", + :contains_ptr? => true, + :args=>[ {:type=>"CUSTOM_TYPE*", :name=>"thing1", :ptr? => true, :const? => false}, + {:type=>"int*", :name=>"thing2", :ptr? => true, :const? => false}, + {:type=>"char*", :name=>"thing3", :ptr? => false, :const? => false}, #THIS one will likely change in the future when we improve multidimensional array support + {:type=>"int**", :name=>"thing4", :ptr? => true, :const? => false} #THIS one will likely change in the future when we improve multidimensional array support + ], + :args_string=>"CUSTOM_TYPE* thing1, int* thing2, char* thing3, int** thing4", + :args_call=>"thing1, thing2, thing3, thing4" }] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + end + + should "give a reasonable guess when dealing with weird combinations of custom types and modifiers" do + source = "void Cheese(unsigned CUSTOM_TYPE abc, unsigned xyz, CUSTOM_TYPE1 CUSTOM_TYPE2 pdq)" + expected = [{:var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"Cheese", + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"unsigned CUSTOM_TYPE", :name=>"abc", :ptr? => false, :const? => false}, + {:type=>"unsigned", :name=>"xyz", :ptr? => false, :const? => false}, + {:type=>"CUSTOM_TYPE1 CUSTOM_TYPE2", :name=>"pdq", :ptr? => false, :const? => false} + ], + :args_string=>"unsigned CUSTOM_TYPE abc, unsigned xyz, CUSTOM_TYPE1 CUSTOM_TYPE2 pdq", + :args_call=>"abc, xyz, pdq" }] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + end + + should "extract functions containing a function pointer" do + source = "void FunkyTurkey(unsigned int (*func_ptr)(int, char))" + expected = [{ :var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"FunkyTurkey", + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"cmock_module_func_ptr1", :name=>"func_ptr", :ptr? => false, :const? => false} + ], + :args_string=>"cmock_module_func_ptr1 func_ptr", + :args_call=>"func_ptr" }] + typedefs = ["typedef unsigned int(*cmock_module_func_ptr1)(int, char);"] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + assert_equal(typedefs, result[:typedefs]) + end + + should "extract functions containing a function pointer with an implied void" do + source = "void FunkyTurkey(unsigned int (*func_ptr)())" + expected = [{ :var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"FunkyTurkey", + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"cmock_module_func_ptr1", :name=>"func_ptr", :ptr? => false, :const? => false} + ], + :args_string=>"cmock_module_func_ptr1 func_ptr", + :args_call=>"func_ptr" }] + typedefs = ["typedef unsigned int(*cmock_module_func_ptr1)();"] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + assert_equal(typedefs, result[:typedefs]) + end + + should "extract functions containing a constant function pointer and a pointer in the nested arg list" do + source = "void FunkyChicken(unsigned int (* const func_ptr)(unsigned long int * , char))" + expected = [{ :var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"FunkyChicken", + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"cmock_module_func_ptr1", :name=>"func_ptr", :ptr? => false, :const? => true} + ], + :args_string=>"cmock_module_func_ptr1 const func_ptr", + :args_call=>"func_ptr" }] + typedefs = ["typedef unsigned int(*cmock_module_func_ptr1)(unsigned long int* , char);"] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + assert_equal(typedefs, result[:typedefs]) + end + + # should "extract functions containing a function pointer taking a vararg" do + # source = "void FunkyParrot(unsigned int (*func_ptr)(int, char, ...))" + # expected = [{ :var_arg=>nil, + # :return=>{ :type => "void", + # :name => 'cmock_to_return', + # :ptr? => false, + # :const? => false, + # :str => "void cmock_to_return", + # :void? => true + # }, + # :name=>"FunkyParrot", + # :modifier=>"", + # :contains_ptr? => false, + # :args=>[ {:type=>"cmock_module_func_ptr1", :name=>"func_ptr", :ptr? => false, :const? => false} + # ], + # :args_string=>"cmock_module_func_ptr1 func_ptr", + # :args_call=>"func_ptr" }] + # typedefs = ["typedef unsigned int(*cmock_module_func_ptr1)(int, char, ...);"] + # result = @parser.parse("module", source) + # assert_equal(expected, result[:functions]) + # assert_equal(typedefs, result[:typedefs]) + # end + + should "extract functions containing a function pointer with extra parenthesis and two sets" do + source = "void FunkyBudgie(int (((* func_ptr1)(int, char))), void (*func_ptr2)(void))" + expected = [{ :var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"FunkyBudgie", + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"cmock_module_func_ptr1", :name=>"func_ptr1", :ptr? => false, :const? => false}, + {:type=>"cmock_module_func_ptr2", :name=>"func_ptr2", :ptr? => false, :const? => false} + ], + :args_string=>"cmock_module_func_ptr1 func_ptr1, cmock_module_func_ptr2 func_ptr2", + :args_call=>"func_ptr1, func_ptr2" }] + typedefs = ["typedef int(*cmock_module_func_ptr1)(int, char);", "typedef void(*cmock_module_func_ptr2)(void);"] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + assert_equal(typedefs, result[:typedefs]) + end + + should "extract functions containing an anonymous function pointer" do + source = "void FunkyFowl(unsigned int (* const)(int, char))" + expected = [{ :var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"FunkyFowl", + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"cmock_module_func_ptr1", :name=>"cmock_arg1", :ptr? => false, :const? => true} + ], + :args_string=>"cmock_module_func_ptr1 const cmock_arg1", + :args_call=>"cmock_arg1" }] + typedefs = ["typedef unsigned int(*cmock_module_func_ptr1)(int, char);"] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + assert_equal(typedefs, result[:typedefs]) + end + + should "extract functions returning a function pointer" do + source = "unsigned short (*FunkyPidgeon( const char op_code ))( int, long int )" + expected = [{ :var_arg=>nil, + :return=>{ :type => "cmock_module_func_ptr1", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "cmock_module_func_ptr1 cmock_to_return", + :void? => false + }, + :name=>"FunkyPidgeon", + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"char", :name=>"op_code", :ptr? => false, :const? => true} + ], + :args_string=>"const char op_code", + :args_call=>"op_code" }] + typedefs = ["typedef unsigned short(*cmock_module_func_ptr1)( int, long int );"] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + assert_equal(typedefs, result[:typedefs]) + end + + should "extract functions returning a function pointer with implied void" do + source = "unsigned short (*FunkyTweetie())()" + expected = [{ :var_arg=>nil, + :return=>{ :type => "cmock_module_func_ptr1", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "cmock_module_func_ptr1 cmock_to_return", + :void? => false + }, + :name=>"FunkyTweetie", + :modifier=>"", + :contains_ptr? => false, + :args=>[], + :args_string=>"void", + :args_call=>"" }] + typedefs = ["typedef unsigned short(*cmock_module_func_ptr1)();"] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + assert_equal(typedefs, result[:typedefs]) + end + + should "extract functions returning a function pointer where everything is a void" do + source = "void (* FunkySeaGull(void))(void)" + expected = [{ :var_arg=>nil, + :return=>{ :type => "cmock_module_func_ptr1", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "cmock_module_func_ptr1 cmock_to_return", + :void? => false + }, + :name=>"FunkySeaGull", + :modifier=>"", + :contains_ptr? => false, + :args=>[], + :args_string=>"void", + :args_call=>"" }] + typedefs = ["typedef void(*cmock_module_func_ptr1)(void);"] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + assert_equal(typedefs, result[:typedefs]) + end + + should "extract functions returning a function pointer with some pointer nonsense" do + source = "unsigned int * (* FunkyMacaw(double* foo, THING *bar))(unsigned int)" + expected = [{ :var_arg=>nil, + :return=>{ :type => "cmock_module_func_ptr1", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "cmock_module_func_ptr1 cmock_to_return", + :void? => false + }, + :name=>"FunkyMacaw", + :modifier=>"", + :contains_ptr? => true, + :args=>[ {:type=>"double*", :name=>"foo", :ptr? => true, :const? => false}, + {:type=>"THING*", :name=>"bar", :ptr? => true, :const? => false} + ], + :args_string=>"double* foo, THING* bar", + :args_call=>"foo, bar" }] + typedefs = ["typedef unsigned int *(*cmock_module_func_ptr1)(unsigned int);"] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + assert_equal(typedefs, result[:typedefs]) + end + + should "extract functions with varargs" do + source = "int XFiles(int Scully, int Mulder, ...);\n" + expected = [{ :var_arg=>"...", + :return=> { :type => "int", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "int cmock_to_return", + :void? => false + }, + :name=>"XFiles", + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"int", :name=>"Scully", :ptr? => false, :const? => false}, + {:type=>"int", :name=>"Mulder", :ptr? => false, :const? => false} + ], + :args_string=>"int Scully, int Mulder", + :args_call=>"Scully, Mulder" + }] + assert_equal(expected, @parser.parse("module", source)[:functions]) + end + + should "extract functions with strippable confusing junk like gcc attributes" do + source = "int LaverneAndShirley(int Lenny, int Squiggy) __attribute__((weak)) __attribute__ ((deprecated));\n" + expected = [{ :var_arg=>nil, + :return=> { :type => "int", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "int cmock_to_return", + :void? => false + }, + :name=>"LaverneAndShirley", + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"int", :name=>"Lenny", :ptr? => false, :const? => false}, + {:type=>"int", :name=>"Squiggy", :ptr? => false, :const? => false} + ], + :args_string=>"int Lenny, int Squiggy", + :args_call=>"Lenny, Squiggy" + }] + assert_equal(expected, @parser.parse("module", source)[:functions]) + end + + should "extract functions with strippable confusing junk like gcc attributes with parenthesis" do + source = "int TheCosbyShow(int Cliff, int Claire) __attribute__((weak, alias (\"__f\"));\n" + expected = [{ :var_arg=>nil, + :return=> { :type => "int", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "int cmock_to_return", + :void? => false + }, + :name=>"TheCosbyShow", + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"int", :name=>"Cliff", :ptr? => false, :const? => false}, + {:type=>"int", :name=>"Claire", :ptr? => false, :const? => false} + ], + :args_string=>"int Cliff, int Claire", + :args_call=>"Cliff, Claire" + }] + assert_equal(expected, @parser.parse("module", source)[:functions]) + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/unit/cmock_plugin_manager_test.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/unit/cmock_plugin_manager_test.rb new file mode 100644 index 0000000..88b4e6b --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/unit/cmock_plugin_manager_test.rb @@ -0,0 +1,85 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require File.expand_path(File.dirname(__FILE__)) + "/../test_helper" +require 'cmock_plugin_manager' + +class CMockPluginManagerTest < Test::Unit::TestCase + def setup + create_mocks :config, :utils, :pluginA, :pluginB + @config.stubs!(:respond_to?).returns(true) + @config.stubs!(:when_ptr).returns(:compare_data) + @config.stubs!(:enforce_strict_ordering).returns(false) + @config.stubs!(:ignore).returns(:args_and_calls) + end + + def teardown + end + + should "return all plugins by default" do + @config.expect.plugins.returns(['cexception','ignore']) + @utils.expect.helpers.returns({}) + + @cmock_plugins = CMockPluginManager.new(@config, @utils) + + test_plugins = @cmock_plugins.plugins + contained = { :expect => false, :ignore => false, :cexception => false } + test_plugins.each do |plugin| + contained[:expect] = true if plugin.instance_of?(CMockGeneratorPluginExpect) + contained[:ignore] = true if plugin.instance_of?(CMockGeneratorPluginIgnore) + contained[:cexception] = true if plugin.instance_of?(CMockGeneratorPluginCexception) + end + assert_equal(true, contained[:expect]) + assert_equal(true, contained[:ignore]) + assert_equal(true, contained[:cexception]) + end + + should "return restricted plugins based on config" do + @config.expect.plugins.returns([]) + @utils.expect.helpers.returns({}) + + @cmock_plugins = CMockPluginManager.new(@config, @utils) + + test_plugins = @cmock_plugins.plugins + contained = { :expect => false, :ignore => false, :cexception => false } + test_plugins.each do |plugin| + contained[:expect] = true if plugin.instance_of?(CMockGeneratorPluginExpect) + contained[:ignore] = true if plugin.instance_of?(CMockGeneratorPluginIgnore) + contained[:cexception] = true if plugin.instance_of?(CMockGeneratorPluginCexception) + end + assert_equal(true, contained[:expect]) + assert_equal(false,contained[:ignore]) + assert_equal(false,contained[:cexception]) + end + + should "run a desired method over each plugin requested and return the results" do + @config.expect.plugins.returns([]) + @utils.expect.helpers.returns({}) + @cmock_plugins = CMockPluginManager.new(@config, @utils) + + @cmock_plugins.plugins = [@pluginA, @pluginB] + @pluginA.stubs!(:test_method).returns(["This Is An Awesome Test-"]) + @pluginB.stubs!(:test_method).returns(["And This is Part 2-","Of An Awesome Test"]) + + expected = "This Is An Awesome Test-And This is Part 2-Of An Awesome Test" + output = @cmock_plugins.run(:test_method) + assert_equal(expected, output) + end + + should "run a desired method and arg list over each plugin requested and return the results" do + @config.expect.plugins.returns([]) + @utils.expect.helpers.returns({}) + @cmock_plugins = CMockPluginManager.new(@config, @utils) + + @cmock_plugins.plugins = [@pluginA, @pluginB] + @pluginA.stubs!(:test_method).returns(["This Is An Awesome Test-"]) + @pluginB.stubs!(:test_method).returns(["And This is Part 2-","Of An Awesome Test"]) + + expected = "This Is An Awesome Test-And This is Part 2-Of An Awesome Test" + output = @cmock_plugins.run(:test_method, "chickenpotpie") + assert_equal(expected, output) + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/unit/cmock_unityhelper_parser_test.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/unit/cmock_unityhelper_parser_test.rb new file mode 100644 index 0000000..3af5762 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/test/unit/cmock_unityhelper_parser_test.rb @@ -0,0 +1,223 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require File.expand_path(File.dirname(__FILE__)) + "/../test_helper" +require 'cmock_unityhelper_parser' + +class CMockUnityHelperParserTest < Test::Unit::TestCase + + def setup + create_mocks :config + end + + def teardown + end + + should "ignore lines that are commented out" do + source = + " abcd;\n" + + "// #define UNITY_TEST_ASSERT_EQUAL_CHICKENS(a,b,line,msg) {...};\n" + + "or maybe // #define UNITY_TEST_ASSERT_EQUAL_CHICKENS(a,b,line,msg) {...};\n\n" + @config.expects.plugins.returns([]) #not :array + @config.expects.treat_as.returns({}) + @config.expects.load_unity_helper.returns(source) + @parser = CMockUnityHelperParser.new(@config) + expected = {} + + assert_equal(expected, @parser.c_types) + end + + should "ignore stuff in block comments" do + source = + " abcd; /*\n" + + "#define UNITY_TEST_ASSERT_EQUAL_CHICKENS(a,b,line,msg) {...};\n" + + "#define UNITY_TEST_ASSERT_EQUAL_CHICKENS(a,b,line,msg) {...};\n */\n" + @config.expects.plugins.returns([]) #not :array + @config.expects.treat_as.returns({}) + @config.expect.load_unity_helper.returns(source) + @parser = CMockUnityHelperParser.new(@config) + expected = {} + + assert_equal(expected, @parser.c_types) + end + + should "notice equal helpers in the proper form and ignore others" do + source = + "abcd;\n" + + "#define UNITY_TEST_ASSERT_EQUAL_TURKEYS_T(a,b,line,msg) {...};\n" + + "abcd;\n" + + "#define UNITY_TEST_ASSERT_EQUAL_WRONG_NUM_ARGS(a,b,c,d,e) {...};\n" + + "#define UNITY_TEST_ASSERT_WRONG_NAME_EQUAL(a,b,c,d) {...};\n" + + "#define UNITY_TEST_ASSERT_EQUAL_unsigned_funky_rabbits(a,b,c,d) {...};\n" + + "abcd;\n" + @config.expects.plugins.returns([]) #not :array + @config.expects.treat_as.returns({}) + @config.expect.load_unity_helper.returns(source) + @parser = CMockUnityHelperParser.new(@config) + expected = { + 'TURKEYS_T' => "UNITY_TEST_ASSERT_EQUAL_TURKEYS_T", + 'unsigned_funky_rabbits' => "UNITY_TEST_ASSERT_EQUAL_unsigned_funky_rabbits" + } + + assert_equal(expected, @parser.c_types) + end + + should "notice equal helpers that contain arrays" do + source = + "abcd;\n" + + "#define UNITY_TEST_ASSERT_EQUAL_TURKEYS_ARRAY(a,b,c,d,e) {...};\n" + + "abcd;\n" + + "#define UNITY_TEST_ASSERT_EQUAL_WRONG_NUM_ARGS_ARRAY(a,b,c,d,e,f) {...};\n" + + "#define UNITY_TEST_ASSERT_WRONG_NAME_EQUAL_ARRAY(a,b,c,d,e) {...};\n" + + "#define UNITY_TEST_ASSERT_EQUAL_unsigned_funky_rabbits_ARRAY(a,b,c,d,e) {...};\n" + + "abcd;\n" + @config.expects.plugins.returns([]) #not :array + @config.expects.treat_as.returns({}) + @config.expect.load_unity_helper.returns(source) + @parser = CMockUnityHelperParser.new(@config) + expected = { + 'TURKEYS*' => "UNITY_TEST_ASSERT_EQUAL_TURKEYS_ARRAY", + 'unsigned_funky_rabbits*' => "UNITY_TEST_ASSERT_EQUAL_unsigned_funky_rabbits_ARRAY" + } + + assert_equal(expected, @parser.c_types) + end + + should "pull in the standard set of helpers and add them to my list" do + pairs = { + "UINT" => "HEX32", + "unsigned long" => "HEX64", + } + expected = { + "UINT" => "UNITY_TEST_ASSERT_EQUAL_HEX32", + "unsigned_long" => "UNITY_TEST_ASSERT_EQUAL_HEX64", + "UINT*" => "UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY", + "unsigned_long*"=> "UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY", + } + @config.expects.plugins.returns([]) #not :array + @config.expects.treat_as.returns(pairs) + @config.expect.load_unity_helper.returns(nil) + @parser = CMockUnityHelperParser.new(@config) + + assert_equal(expected, @parser.c_types) + end + + should "pull in the user specified set of helpers and add them to my list" do + pairs = { + "char*" => "STRING", + "unsigned int" => "HEX32", + } + expected = { + "char*" => "UNITY_TEST_ASSERT_EQUAL_STRING", + "unsigned_int" => "UNITY_TEST_ASSERT_EQUAL_HEX32", + "char**" => "UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY", + "unsigned_int*" => "UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY", + } + @config.expects.plugins.returns([]) #not :array + @config.expects.treat_as.returns(pairs) + @config.expect.load_unity_helper.returns(nil) + @parser = CMockUnityHelperParser.new(@config) + + assert_equal(expected, @parser.c_types) + end + + should "be able to fetch helpers on my list" do + @config.expects.plugins.returns([]) #not :array + @config.expects.treat_as.returns({}) + @config.expect.load_unity_helper.returns("") + @parser = CMockUnityHelperParser.new(@config) + @parser.c_types = { + 'UINT8' => "UNITY_TEST_ASSERT_EQUAL_UINT8", + 'UINT16*' => "UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY", + 'SPINACH' => "UNITY_TEST_ASSERT_EQUAL_SPINACH", + 'LONG_LONG' => "UNITY_TEST_ASSERT_EQUAL_LONG_LONG" + } + + [["UINT8","UINT8"], + ["UINT16*","UINT16_ARRAY"], + ["const SPINACH","SPINACH"], + ["LONG LONG","LONG_LONG"] ].each do |ctype, exptype| + assert_equal(["UNITY_TEST_ASSERT_EQUAL_#{exptype}",''], @parser.get_helper(ctype)) + end + end + + should "return memory comparison when asked to fetch helper of types not on my list" do + @config.expects.plugins.returns([]) #not :array + @config.expects.treat_as.returns({}) + @config.expects.load_unity_helper.returns("") + @parser = CMockUnityHelperParser.new(@config) + @parser.c_types = { + 'UINT8' => "UNITY_TEST_ASSERT_EQUAL_UINT8", + 'UINT16*' => "UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY", + 'SPINACH' => "UNITY_TEST_ASSERT_EQUAL_SPINACH", + } + + ["UINT32","SPINACH_T","SALAD","PINEAPPLE"].each do |ctype| + @config.expect.memcmp_if_unknown.returns(true) + assert_equal(["UNITY_TEST_ASSERT_EQUAL_MEMORY",'&'], @parser.get_helper(ctype)) + end + end + + should "return memory array comparison when asked to fetch helper of types not on my list" do + @config.expects.plugins.returns([:array]) + @config.expects.treat_as.returns({}) + @config.expects.load_unity_helper.returns("") + @parser = CMockUnityHelperParser.new(@config) + @parser.c_types = { + 'UINT8' => "UNITY_TEST_ASSERT_EQUAL_UINT8", + 'UINT16*' => "UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY", + 'SPINACH' => "UNITY_TEST_ASSERT_EQUAL_SPINACH", + } + + ["UINT32*","SPINACH_T*"].each do |ctype| + @config.expect.memcmp_if_unknown.returns(true) + assert_equal(["UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY",''], @parser.get_helper(ctype)) + end + end + + should "return the array handler if we cannot find the normal handler" do + @config.expects.plugins.returns([]) #not :array + @config.expects.treat_as.returns({}) + @config.expect.load_unity_helper.returns("") + @parser = CMockUnityHelperParser.new(@config) + @parser.c_types = { + 'UINT8' => "UNITY_TEST_ASSERT_EQUAL_UINT8", + 'UINT16*' => "UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY", + 'SPINACH' => "UNITY_TEST_ASSERT_EQUAL_SPINACH", + } + + assert_equal(["UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY",'&'], @parser.get_helper("UINT16")) + end + + should "return the normal handler if we cannot find the array handler" do + @config.expects.plugins.returns([]) #not :array + @config.expects.treat_as.returns({}) + @config.expect.load_unity_helper.returns("") + @parser = CMockUnityHelperParser.new(@config) + @parser.c_types = { + 'UINT8' => "UNITY_TEST_ASSERT_EQUAL_UINT8", + 'UINT16' => "UNITY_TEST_ASSERT_EQUAL_UINT16", + 'SPINACH' => "UNITY_TEST_ASSERT_EQUAL_SPINACH", + } + + assert_equal(["UNITY_TEST_ASSERT_EQUAL_UINT8",'*'], @parser.get_helper("UINT8*")) + end + + should "raise error when asked to fetch helper of type not on my list and not allowed to mem check" do + @config.expects.plugins.returns([]) #not :array + @config.expects.treat_as.returns({}) + @config.expect.load_unity_helper.returns("") + @config.expect.memcmp_if_unknown.returns(false) + @parser = CMockUnityHelperParser.new(@config) + @parser.c_types = { + 'UINT8' => "UNITY_TEST_ASSERT_EQUAL_UINT8", + 'UINT32*' => "UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY", + 'SPINACH' => "UNITY_TEST_ASSERT_EQUAL_SPINACH", + } + + assert_raise(RuntimeError) { @parser.get_helper("UINT16") } + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/behaviors/Manifest.txt b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/behaviors/Manifest.txt new file mode 100644 index 0000000..6c954ec --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/behaviors/Manifest.txt @@ -0,0 +1,9 @@ +Manifest.txt +Rakefile +lib/behaviors.rb +lib/behaviors/reporttask.rb +test/behaviors_tasks_test.rb +test/behaviors_test.rb +test/tasks_test/lib/user.rb +test/tasks_test/Rakefile +test/tasks_test/test/user_test.rb diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/behaviors/Rakefile b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/behaviors/Rakefile new file mode 100644 index 0000000..d4d68b9 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/behaviors/Rakefile @@ -0,0 +1,19 @@ +require 'rake' +require 'rubygems' +require 'hoe' + +Hoe.new('behaviors','1.0.3') do |p| + p.author = "Atomic Object LLC" + p.email = "dev@atomicobject.com" + p.url = "http://behaviors.rubyforge.org" + p.summary = "behavior-driven unit test helper" + p.description = <<-EOS +Behaviors allows for Test::Unit test case methods to be defined as +human-readable descriptions of program behavior. It also provides +Rake tasks to list the behaviors of your project. + EOS + p.test_globs = ['test/*_test.rb'] + + p.changes = <<-EOS + EOS +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/behaviors/lib/behaviors.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/behaviors/lib/behaviors.rb new file mode 100644 index 0000000..d8d70f7 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/behaviors/lib/behaviors.rb @@ -0,0 +1,76 @@ +=begin rdoc += Usage +Behaviors provides a single method: should. + +Instead of naming test methods like: + + def test_something + end + +You declare test methods like: + + should "perform action" do + end + +You may omit the body of a should method to describe unimplemented behavior. + + should "perform other action" + +When you run your unit tests, empty should methods will appear as an 'UNIMPLEMENTED CASE' along with the described behavior. +This is useful for sketching out planned behavior quickly. + +Simply extend Behaviors in your TestCase to start using behaviors. + + require 'test/unit' + require 'behaviors' + require 'user' + + class UserTest < Test::Unit::TestCase + extend Behaviors + ... + end + += Motivation +Test methods typically focus on the name of the method under test instead of its behavior. +Creating test methods with should statements focuses on the behavior of an object. +This helps you to think about the role of the object under test. + +Using a behavior-driven approach prevents the danger in assuming a one-to-one mapping of method names to +test method names. +As always, you get the most value by writing the tests first. + +For a more complete BDD framework, try RSpec http://rspec.rubyforge.org/ + += Rake tasks + +You can define a Behaviors::ReportTask in your Rakefile to generate rake tasks that +summarize the behavior of your project. + +These tasks are named behaviors and behaviors_html. They will output to the +console or an html file in the doc directory with a list all of your should tests. + Behaviors::ReportTask.new do |t| + t.pattern = 'test/**/*_test.rb' + end + +You may also initialize the ReportTask with a custom name to associate with a particular suite of tests. + Behaviors::ReportTask.new(:widget_subsystem) do |t| + t.pattern = 'test/widgets/*_test.rb' + end + +The html report will be placed in the doc directory by default. +You can override this default by setting the html_dir in the ReportTask. + Behaviors::ReportTask.new do |t| + t.pattern = 'test/**/*_test.rb' + t.html_dir = 'behaviors_html_reports' + end +=end +module Behaviors + def should(behave,&block) + mname = "test_should_#{behave}" + if block + define_method mname, &block + else + puts ">>> UNIMPLEMENTED CASE: #{name.sub(/Test$/,'')} should #{behave}" + end + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/behaviors/lib/behaviors/reporttask.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/behaviors/lib/behaviors/reporttask.rb new file mode 100644 index 0000000..51c0eca --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/behaviors/lib/behaviors/reporttask.rb @@ -0,0 +1,158 @@ +require 'rake' +require 'rake/tasklib' + +module Behaviors +include Rake + + class ReportTask < TaskLib + attr_accessor :pattern + attr_accessor :html_dir + + def initialize(name=:behaviors) + @name = name + @html_dir = 'doc' + yield self if block_given? + define + end + + def define + desc "List behavioral definitions for the classes specified (use for= to further limit files included in report)" + task @name do + specifications.each do |spec| + puts "#{spec.name} should:\n" + spec.requirements.each do |req| + puts " - #{req}" + end + end + end + + desc "Generate html report of behavioral definitions for the classes specified (use for= to further limit files included in report)" + task "#{@name}_html" do + require 'erb' + txt =<<-EOS + + + + + +
Specifications
+<% specifications.each do |spec| %> +
+<%= spec.name %> should: +
    +<% spec.requirements.each do |req| %> +
  • <%= req %>
  • +<% end %> +
+
+<% end %> + + + EOS + output_dir = File.expand_path(@html_dir) + mkdir_p output_dir + output_filename = output_dir + "/behaviors.html" + File.open(output_filename,"w") do |f| + f.write ERB.new(txt).result(binding) + end + puts "(Wrote #{output_filename})" + end + end + + private + def test_files + test_list = FileList[@pattern] + if ENV['for'] + test_list = test_list.grep(/#{ENV['for']}/i) + end + test_list + end + + def specifications + test_files.map do |file| + spec = OpenStruct.new + m = %r".*/([^/].*)_test.rb".match(file) + class_name = titleize(m[1]) if m[1] + spec.name = class_name + spec.requirements = [] + File::readlines(file).each do |line| + if line =~ /^\s*should\s+\(?\s*["'](.*)["']/ + spec.requirements << $1 + end + end + spec + end + end + + ############################################################ + # STOLEN FROM inflector.rb + ############################################################ + #-- + # Copyright (c) 2005 David Heinemeier Hansson + # + # Permission is hereby granted, free of charge, to any person obtaining + # a copy of this software and associated documentation files (the + # "Software"), to deal in the Software without restriction, including + # without limitation the rights to use, copy, modify, merge, publish, + # distribute, sublicense, and/or sell copies of the Software, and to + # permit persons to whom the Software is furnished to do so, subject to + # the following conditions: + # + # The above copyright notice and this permission notice shall be + # included in all copies or substantial portions of the Software. + # + # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + #++ + def titleize(word) + humanize(underscore(word)).gsub(/\b([a-z])/) { $1.capitalize } + end + + def underscore(camel_cased_word) camel_cased_word.to_s.gsub(/::/, '/'). + gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').gsub(/([a-z\d])([A-Z])/,'\1_\2').tr("-", "_").downcase + end + + def humanize(lower_case_and_underscored_word) + lower_case_and_underscored_word.to_s.gsub(/_id$/, "").gsub(/_/, " ").capitalize + end + + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/behaviors/test/behaviors_tasks_test.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/behaviors/test/behaviors_tasks_test.rb new file mode 100644 index 0000000..9382e07 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/behaviors/test/behaviors_tasks_test.rb @@ -0,0 +1,73 @@ +require 'test/unit' +require 'fileutils' + +class BehaviorsTasksTest < Test::Unit::TestCase + include FileUtils + + def setup + @here = File.expand_path(File.dirname(__FILE__)) + @base_cmd = RUBY_PLATFORM[/mswin/] ? 'rake.cmd ' : 'rake ' + end + + # + # HELPERS + # + def run_behaviors_task + run_cmd "behaviors" + end + + def run_behaviors_html_task + run_cmd "behaviors_html" + end + + def run_cmd(cmd) + cd "#{@here}/tasks_test" do + @report = %x[ #{@base_cmd} #{cmd} ] + end + end + + def see_html_task_output_message + @html_output_filename = "#{@here}/tasks_test/behaviors_doc/behaviors.html" + assert_match(/Wrote #{@html_output_filename}/, @report) + end + + def see_that_html_report_file_exits + assert File.exists?(@html_output_filename), "html output file should exist" + end + + def html_report_file_should_contain(user_behaviors) + file_contents = File.read(@html_output_filename) + user_behaviors.each do |line| + assert_match(/#{line}/, file_contents) + end + rm_rf File.dirname(@html_output_filename) + end + + # + # TESTS + # + def test_that_behaviors_tasks_should_list_behavioral_definitions_for_the_classes_under_test + run_behaviors_task + user_behaviors = [ + "User should:", + " - be able set user name and age during construction", + " - be able to get user name and age", + " - be able to ask if a user is an adult" + ] + assert_match(/#{user_behaviors.join("\n")}/, @report) + end + + def test_that_behaviors_tasks_should_list_behavioral_definitions_for_the_classes_under_test_in_html_output + run_behaviors_html_task + see_html_task_output_message + see_that_html_report_file_exits + user_behaviors = [ + "User should:", + "be able set user name and age during construction", + "be able to get user name and age", + "be able to ask if a user is an adult" + ] + html_report_file_should_contain user_behaviors + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/behaviors/test/behaviors_test.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/behaviors/test/behaviors_test.rb new file mode 100644 index 0000000..fd0a77f --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/behaviors/test/behaviors_test.rb @@ -0,0 +1,50 @@ +require 'test/unit' +require File.expand_path(File.dirname(__FILE__)) + '/../lib/behaviors' +require 'stringio' + +loading_developer_test_class_stdout = StringIO.new +saved_stdout = $stdout.dup +$stdout = loading_developer_test_class_stdout + +class DeveloperTest + extend Behaviors + attr_accessor :flunk_msg, :tested_code + + should "test their code" do + @tested_code = true + end + should "go to meetings" +end + +$stdout = saved_stdout +loading_developer_test_class_stdout.rewind +$loading_developer_test_class_output = loading_developer_test_class_stdout.read + +class BehaviorsTest < Test::Unit::TestCase + + + def setup + @target = DeveloperTest.new + assert_nil @target.tested_code, "block called too early" + end + + # + # TESTS + # + def test_should_called_with_a_block_defines_a_test + assert @target.methods.include?("test_should_test their code"), "Missing test method" + + @target.send("test_should_test their code") + + assert @target.tested_code, "block not called" + end + + def test_should_called_without_a_block_does_not_create_a_test_method + assert !@target.methods.include?("test_should_go to meetings"), "Should not have method" + end + + def test_should_called_without_a_block_will_give_unimplemented_output_when_class_loads + unimplemented_output = "UNIMPLEMENTED CASE: Developer should go to meetings" + assert_match(/#{unimplemented_output}/, $loading_developer_test_class_output) + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/behaviors/test/tasks_test/Rakefile b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/behaviors/test/tasks_test/Rakefile new file mode 100644 index 0000000..ba71f71 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/behaviors/test/tasks_test/Rakefile @@ -0,0 +1,19 @@ +require 'rake' +require 'rake/testtask' + +here = File.expand_path(File.dirname(__FILE__)) +require "#{here}/../../lib/behaviors/reporttask" + +desc 'Default: run unit tests.' +task :default => :test + +Rake::TestTask.new(:test) do |t| + t.libs << "#{here}/../../lib" + t.pattern = 'test/**/*_test.rb' + t.verbose = true +end + +Behaviors::ReportTask.new(:behaviors) do |t| + t.pattern = 'test/**/*_test.rb' + t.html_dir = 'behaviors_doc' +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/behaviors/test/tasks_test/lib/user.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/behaviors/test/tasks_test/lib/user.rb new file mode 100644 index 0000000..40bc07c --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/behaviors/test/tasks_test/lib/user.rb @@ -0,0 +1,2 @@ +class User +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/behaviors/test/tasks_test/test/user_test.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/behaviors/test/tasks_test/test/user_test.rb new file mode 100644 index 0000000..ad3cd1b --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/behaviors/test/tasks_test/test/user_test.rb @@ -0,0 +1,17 @@ +require 'test/unit' +require 'behaviors' + +require 'user' + +class UserTest < Test::Unit::TestCase + extend Behaviors + + def setup + end + + should "be able set user name and age during construction" + should "be able to get user name and age" + should "be able to ask if a user is an adult" + def test_DELETEME + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/docs/CExceptionSummary.odt b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/docs/CExceptionSummary.odt new file mode 100644 index 0000000..ea852a0 Binary files /dev/null and b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/docs/CExceptionSummary.odt differ diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/docs/CExceptionSummary.pdf b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/docs/CExceptionSummary.pdf new file mode 100644 index 0000000..a838337 Binary files /dev/null and b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/docs/CExceptionSummary.pdf differ diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/docs/license.txt b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/docs/license.txt new file mode 100644 index 0000000..561e5f2 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/docs/license.txt @@ -0,0 +1,30 @@ + Copyright (c) 2007 Mark VanderVoord + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + The end-user documentation included with the redistribution, if + any, must include the following acknowledgment: "This product + includes software developed for the CEXCeption Project, by Mark + VanderVoord and other contributors", in the same place and form + as other third-party acknowledgments. Alternately, this + acknowledgment may appear in the software itself, in the same + form and location as other such third-party acknowledgments. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/docs/readme.txt b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/docs/readme.txt new file mode 100644 index 0000000..92cac38 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/docs/readme.txt @@ -0,0 +1,236 @@ +==================================================================== +CException +==================================================================== + +CException is a basic exception framework for C, suitable for use in +embedded applications. It provides an exception framework similar in +use to C++, but with much less overhead. + +CException uses C standard library functions setjmp and longjmp to +operate. As long as the target system has these two functions defined, +this library should be useable with very little configuration. It +even supports environments where multiple program flows are in use, +such as real-time operating systems. + +There are about a gabillion exception frameworks using a similar +setjmp/longjmp method out there... and there will probably be more +in the future. Unfortunately, when we started our last embedded +project, all those that existed either (a) did not support multiple +tasks (therefore multiple stacks) or (b) were way more complex than +we really wanted. CException was born. + +Why use CException? + +0. It's ANSI C, and it beats passing error codes around. + +1. You want something simple... CException throws a single id. You can + define those ID's to be whatever you like. You might even choose which + type that number is for your project. But that's as far as it goes. + We weren't interested in passing objects or structs or strings... + just simple error codes. + +2. Performance... CException can be configured for single tasking or + multitasking. In single tasking, there is very little overhead past + the setjmp/longjmp calls (which are already fast). In multitasking, + your only additional overhead is the time it takes you to determine + a unique task id 0 - num_tasks. + +For the latest version, go to http://cexception.sourceforge.net + +-------------------------------------------------------------------- +CONTENTS OF THIS DOCUMENT +-------------------------------------------------------------------- + +Usage +Limitations +API +Configuration +Testing +License + +-------------------------------------------------------------------- +Usage +-------------------------------------------------------------------- + +Code that is to be protected are wrapped in Try { } Catch { } blocks. +The code directly following the Try call is "protected", meaning that +if any Throws occur, program control is directly transferred to the +start of the Catch block. + +A numerical exception ID is included with Throw, and is made accessible +from the Catch block. + +Throws can occur from within function calls (nested as deeply as you +like) or directly from within the function itself. + +-------------------------------------------------------------------- +Limitations +-------------------------------------------------------------------- + +This library was made to be as fast as possible, and provide basic +exception handling. It is not a full-blown exception library. Because +of this, there are a few limitations that should be observed in order +to successfully utilize this library: + +1. Do not directly "return" from within a Try block, nor "goto" + into or out of a Try block. + + Why? + + The "Try" macro allocates some local memory and alters a global + pointer. These are cleaned up at the top of the "Catch" macro. + Gotos and returns would bypass some of these steps, resulting in + memory leaks or unpredictable behavior. + +2. If (a) you change local (stack) variables within your Try block, + AND (b) wish to make use of the updated values after an exception + is thrown, those variables should be made volatile. Note that this + is ONLY for locals and ONLY when you need access to them after a + throw. + + Why? + + Compilers optimize. There is no way to guarantee that the actual + memory location was updated and not just a register unless the + variable is marked volatile. + +3. Memory which is malloc'd or new'd is not automatically released + when an error is thrown. This will sometimes be desirable, and + othertimes may not. It will be the responsibility of the Catch + block to perform this kind of cleanup. + + Why? + + There's just no easy way to track malloc'd memory, etc., without + replacing or wrapping malloc calls or something like that. This + is a light framework, so these options were not desirable. + +-------------------------------------------------------------------- +API +-------------------------------------------------------------------- + +Try +--- + +Try is a macro which starts a protected block. It MUST be followed by +a pair of braces or a single protected line (similar to an 'if'), +enclosing the data that is to be protected. It MUST be followed by a +Catch block (don't worry, you'll get compiler errors to let you know if +you mess any of that up). + +Catch(e) +-------- + +Catch is a macro which ends the Try block and starts the error handling +block. The catch block is called if and only if an exception was thrown +while within the Try block. This error was thrown by a Throw call +somewhere within Try (or within a function called within Try, or a function +called by a function called within Try, etc). + +The single parameter 'e' is filled with the error code which was thrown. +This can be used for reporting, conditional cleanup, etc. (or you can just +ignore it if you really want... people ignore return codes all the time, +right?). 'e' should be of type EXCEPTION_T; + +Throw(e) +-------- + +The method of throwing an error. Throws should only occur from within a +protected (Try...Catch) block, though it may easily be nested many function +calls deep without an impact on performance or functionality. Throw takes +a single argument, which is an exception id which will be passed to Catch +as the reason for the error. + +If you wish to Rethrow an error, this can be done by calling Throw(e) with +the error code you just caught. It IS valid to throw from a catch block. + +-------------------------------------------------------------------- +CONFIGURATION +-------------------------------------------------------------------- + +CException is a mostly portable library. It has one universal +dependency, and some macros which are required if working in a +multi-tasking environment. + +1. The standard C library setjmp must be available. Since this is part + of the standard library, chances are good that you'll be fine. + +2. If working in a multitasking environment, methods for obtaining an + index into an array of frames and to get the overall number of + id's are required. If the OS supports a method to retrieve Task + ID's, and those Tasks are number 0, 1, 2... you are in an ideal + situation. Otherwise, a more creative mapping function may be + required. Note that this function is likely to be called twice + for each protected block and once during a throw. This is the + only overhead in the system. + +Exception.h +----------------- +By convention, most projects include Exception.h which defines any +further requirements, then calls CException.h to do the gruntwork. All +of these are optional. You could directly include CException.h if +you wanted and just use the defaults provided. + +EXCEPTION_T - Set this to the type you want your exception id's + to be. Defaults to 'unsigned int'. + +EXCEPTION_NONE - Set this to a number which will never be an + exception id in your system. Defaults to 0x5a5a5a5a. + +EXCEPTION_GET_ID - If in a multi-tasking environment, this should be + set to be a call to the function described in #2 above. + Defaults to just return 0 all the time (good for + single tasking environments) + +EXCEPTION_NUM_ID - If in a multi-tasking environment, this should be set + to the number of ID's required (usually the number of + tasks in the system). Defaults to 1 (for single + tasking environments). + +You may also want to include any header files which will commonly be +needed by the rest of your application where it uses exception handling +here. For example, OS header files or exception codes would be useful. + +-------------------------------------------------------------------- +TESTING +-------------------------------------------------------------------- + +If you want to validate that CException works with your tools or that +it works with your custom configuration, you may want to run the test +suite. + +The test suite included makes use of the Unity Test Framework. It will +require a native C compiler. The example makefile uses MinGW's gcc. +Modify the makefile to include the proper paths to tools, then run 'make' +to compile and run the test application. + +C_COMPILER - The C compiler to use to perform the tests +C_LIBS - The path to the C libraries (including setjmp) +UNITY_DIR - The path to the Unity framework (required to run tests) + (get it at http://embunity.sourceforge.net) + +-------------------------------------------------------------------- +LICENSE +-------------------------------------------------------------------- + +This software is licensed under the MIT License + +Copyright (c) 2007 Mark VanderVoord + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/lib/CException.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/lib/CException.c new file mode 100644 index 0000000..57f5353 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/lib/CException.c @@ -0,0 +1,39 @@ +#include "CException.h" + +volatile CEXCEPTION_FRAME_T CExceptionFrames[CEXCEPTION_NUM_ID]; + +//------------------------------------------------------------------------------------------ +// Throw +//------------------------------------------------------------------------------------------ +void Throw(CEXCEPTION_T ExceptionID) +{ + unsigned int MY_ID = CEXCEPTION_GET_ID; + CExceptionFrames[MY_ID].Exception = ExceptionID; + longjmp(*CExceptionFrames[MY_ID].pFrame, 1); +} + +//------------------------------------------------------------------------------------------ +// Explaination of what it's all for: +//------------------------------------------------------------------------------------------ +/* +#define Try + { <- give us some local scope. most compilers are happy with this + jmp_buf *PrevFrame, NewFrame; <- prev frame points to the last try block's frame. new frame gets created on stack for this Try block + unsigned int MY_ID = CEXCEPTION_GET_ID; <- look up this task's id for use in frame array. always 0 if single-tasking + PrevFrame = CExceptionFrames[CEXCEPTION_GET_ID].pFrame; <- set pointer to point at old frame (which array is currently pointing at) + CExceptionFrames[MY_ID].pFrame = &NewFrame; <- set array to point at my new frame instead, now + CExceptionFrames[MY_ID].Exception = CEXCEPTION_NONE; <- initialize my exception id to be NONE + if (setjmp(NewFrame) == 0) { <- do setjmp. it returns 1 if longjump called, otherwise 0 + if (&PrevFrame) <- this is here to force proper scoping. it requires braces or a single line to be but after Try, otherwise won't compile. This is always true at this point. + +#define Catch(e) + else { } <- this also forces proper scoping. Without this they could stick their own 'else' in and it would get ugly + CExceptionFrames[MY_ID].Exception = CEXCEPTION_NONE; <- no errors happened, so just set the exception id to NONE (in case it was corrupted) + } + else <- an exception occurred + { e = CExceptionFrames[MY_ID].Exception; e=e;} <- assign the caught exception id to the variable passed in. + CExceptionFrames[MY_ID].pFrame = PrevFrame; <- make the pointer in the array point at the previous frame again, as if NewFrame never existed. + } <- finish off that local scope we created to have our own variables + if (CExceptionFrames[CEXCEPTION_GET_ID].Exception != CEXCEPTION_NONE) <- start the actual 'catch' processing if we have an exception id saved away + */ + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/lib/CException.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/lib/CException.h new file mode 100644 index 0000000..40c6fc7 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/lib/CException.h @@ -0,0 +1,70 @@ +#ifndef _CEXCEPTION_H +#define _CEXCEPTION_H + +#include + +//To Use CException, you have a number of options: +//1. Just include it and run with the defaults +//2. Define any of the following symbols at the command line to override them +//3. Include a header file before CException.h everywhere which defines any of these +//4. Create an Exception.h in your path, and just define EXCEPTION_USE_CONFIG_FILE first + +#ifdef CEXCEPTION_USE_CONFIG_FILE +#include "CExceptionConfig.h" +#endif + +//This is the value to assign when there isn't an exception +#ifndef CEXCEPTION_NONE +#define CEXCEPTION_NONE (0x5A5A5A5A) +#endif + +//This is number of exception stacks to keep track of (one per task) +#ifndef CEXCEPTION_NUM_ID +#define CEXCEPTION_NUM_ID (1) //there is only the one stack by default +#endif + +//This is the method of getting the current exception stack index (0 if only one stack) +#ifndef CEXCEPTION_GET_ID +#define CEXCEPTION_GET_ID (0) //use the first index always because there is only one anyway +#endif + +//The type to use to store the exception values. +#ifndef CEXCEPTION_T +#define CEXCEPTION_T unsigned int +#endif + +//exception frame structures +typedef struct { + jmp_buf* pFrame; + volatile CEXCEPTION_T Exception; +} CEXCEPTION_FRAME_T; + +//actual root frame storage (only one if single-tasking) +extern volatile CEXCEPTION_FRAME_T CExceptionFrames[]; + +//Try (see C file for explanation) +#define Try \ + { \ + jmp_buf *PrevFrame, NewFrame; \ + unsigned int MY_ID = CEXCEPTION_GET_ID; \ + PrevFrame = CExceptionFrames[CEXCEPTION_GET_ID].pFrame; \ + CExceptionFrames[MY_ID].pFrame = (jmp_buf*)(&NewFrame); \ + CExceptionFrames[MY_ID].Exception = CEXCEPTION_NONE; \ + if (setjmp(NewFrame) == 0) { \ + if (&PrevFrame) + +//Catch (see C file for explanation) +#define Catch(e) \ + else { } \ + CExceptionFrames[MY_ID].Exception = CEXCEPTION_NONE; \ + } \ + else \ + { e = CExceptionFrames[MY_ID].Exception; e=e; } \ + CExceptionFrames[MY_ID].pFrame = PrevFrame; \ + } \ + if (CExceptionFrames[CEXCEPTION_GET_ID].Exception != CEXCEPTION_NONE) + +//Throw an Error +void Throw(CEXCEPTION_T ExceptionID); + +#endif // _CEXCEPTION_H diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/makefile b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/makefile new file mode 100644 index 0000000..c168a41 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/makefile @@ -0,0 +1,24 @@ +#Tool and Lib Locations +C_COMPILER=gcc +C_LIBS=C:/MinGW/lib +UNITY_DIR=vendor/unity/src + +#Test File To Be Created +OUT_FILE=test_cexceptions +ifeq ($(OS),Windows_NT) +OUT_EXTENSION=.exe +else +OUT_EXTENSION=.out +endif + +#Options +SRC_FILES=lib/CException.c test/TestException.c test/TestException_Runner.c $(UNITY_DIR)/unity.c +INC_DIRS=-Ilib -Itest -I$(UNITY_DIR) +LIB_DIRS=-L$(C_LIBS) +SYMBOLS=-DTEST -DEXCEPTION_USE_CONFIG_FILE + +#Default Task: Compile And Run Tests +default: + $(C_COMPILER) $(INC_DIRS) $(LIB_DIRS) $(SYMBOLS) $(SRC_FILES) -o $(OUT_FILE)$(OUT_EXTENSION) + $(OUT_FILE)$(OUT_EXTENSION) + \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/rakefile.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/rakefile.rb new file mode 100644 index 0000000..2458c6f --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/rakefile.rb @@ -0,0 +1,41 @@ +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require HERE+'vendor/unity/auto/colour_reporter.rb' + +#Tool and Lib Locations +C_COMPILER = 'gcc' +C_LIBS = '' +UNITY_DIR = 'vendor/unity/src' + +#Test File To Be Created +OUT_FILE = 'test_cexceptions' +OUT_EXTENSION = '.out' + +#Options +SRC_FILES = "lib/CException.c test/TestException.c test/TestException_Runner.c #{UNITY_DIR}/unity.c" +INC_DIRS = "-Ilib -Itest -I#{UNITY_DIR}" +LIB_DIRS = C_LIBS.empty? ? '' : "-L#{C_LIBS}" +SYMBOLS = '-DTEST -DEXCEPTION_USE_CONFIG_FILE' + +CLEAN.include("#{HERE}*.out") + +task :default => [:clobber, :test] +task :cruise => [:no_color, :default] + +desc "performs a quick set of unit tests to confirm you're ready to go" +task :test do + report "#{C_COMPILER} #{INC_DIRS} #{LIB_DIRS} #{SYMBOLS} #{SRC_FILES} -o #{OUT_FILE}#{OUT_EXTENSION}" + output = `#{C_COMPILER} #{INC_DIRS} #{LIB_DIRS} #{SYMBOLS} #{SRC_FILES} -o #{OUT_FILE}#{OUT_EXTENSION}` + report output + + report "#{HERE}#{OUT_FILE}#{OUT_EXTENSION}" + output = `#{HERE}#{OUT_FILE}#{OUT_EXTENSION}` + report output +end + +task :no_color do + $colour_output = false +end \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/release/build.info b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/release/build.info new file mode 100644 index 0000000..b5794c5 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/release/build.info @@ -0,0 +1,2 @@ +16 + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/release/version.info b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/release/version.info new file mode 100644 index 0000000..cb7e5f6 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/release/version.info @@ -0,0 +1,2 @@ +1.2.0 + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/test/CExceptionConfig.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/test/CExceptionConfig.h new file mode 100644 index 0000000..79b085d --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/test/CExceptionConfig.h @@ -0,0 +1,27 @@ +#ifndef _EXCEPTION_H +#define _EXCEPTION_H + +//Optionally define the exception type (something like an int which can be directly assigned) +#define CEXCEPTION_T int + +// Optionally define the reserved value representing NO EXCEPTION +#define CEXCEPTION_NONE (1234) + +// Multi-Tasking environments will need a couple of macros defined to make this library +// properly handle multiple exception stacks. You will need to include and required +// definitions, then define the following macros: +// EXCEPTION_GET_ID - returns the id of the current task indexed 0 to (numtasks - 1) +// EXCEPTION_NUM_ID - returns the number of tasks that might be returned +// +// For example, Quadros might include the following implementation: +#ifndef TEST +#include "OSAPI.h" +#define CEXCEPTION_GET_ID (KS_GetTaskID()) +#define CEXCEPTION_NUM_ID (NTASKS + 1) +#endif + +//This could be a good place to define/include some error ID's: +#define ERROR_ID_EVERYTHING_IS_BROKEN (0x88) +#define ERROR_ID_ONLY_THIS_IS_BROKEN (0x77) + +#endif // _EXCEPTION_H diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/test/TestException.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/test/TestException.c new file mode 100644 index 0000000..704cfdb --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/test/TestException.c @@ -0,0 +1,291 @@ +#include "unity.h" +#include "CException.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void test_BasicTryDoesNothingIfNoThrow(void) +{ + int i; + CEXCEPTION_T e = 0x5a; + + Try + { + i += 1; + } + Catch(e) + { + TEST_FAIL_MESSAGE("Should Not Enter Catch If Not Thrown") + } + + //verify that e was untouched + TEST_ASSERT_EQUAL(0x5a, e); +} + +void test_BasicThrowAndCatch(void) +{ + CEXCEPTION_T e; + + Try + { + Throw(0xBE); + TEST_FAIL_MESSAGE("Should Have Thrown An Error") + } + Catch(e) + { + //verify that e has the right data + TEST_ASSERT_EQUAL(0xBE, e); + } + + //verify that e STILL has the right data + TEST_ASSERT_EQUAL(0xBE, e); +} + +void test_BasicThrowAndCatch_WithMiniSyntax(void) +{ + CEXCEPTION_T e; + + //Mini Throw and Catch + Try + Throw(0xEF); + Catch(e) + TEST_ASSERT_EQUAL(0xEF, e); + TEST_ASSERT_EQUAL(0xEF, e); + + //Mini Passthrough + Try + e = 0; + Catch(e) + TEST_FAIL_MESSAGE("I shouldn't be caught because there was no throw"); + + TEST_ASSERT_EQUAL(0, e); +} + +void test_VerifyVolatilesSurviveThrowAndCatch(void) +{ + volatile unsigned int VolVal = 0; + CEXCEPTION_T e; + + Try + { + VolVal = 2; + Throw(0xBF); + TEST_FAIL_MESSAGE("Should Have Thrown An Error") + } + Catch(e) + { + VolVal += 2; + TEST_ASSERT_EQUAL(0xBF, e); + } + + TEST_ASSERT_EQUAL(4, VolVal); + TEST_ASSERT_EQUAL(0xBF, e); +} + +void HappyExceptionThrower(unsigned int ID) +{ + if (ID != 0) + { + Throw(ID); + } +} + +void test_ThrowFromASubFunctionAndCatchInRootFunc(void) +{ + volatile unsigned int ID = 0; + CEXCEPTION_T e; + + Try + { + + HappyExceptionThrower(0xBA); + TEST_FAIL_MESSAGE("Should Have Thrown An Exception"); + } + Catch(e) + { + ID = e; + } + + //verify that I can pass that value to something else + TEST_ASSERT_EQUAL(0xBA, e); +} + +void HappyExceptionRethrower(unsigned int ID) +{ + CEXCEPTION_T e; + + Try + { + Throw(ID); + } + Catch(e) + { + switch (e) + { + case 0xBD: + Throw(0xBF); + break; + default: + break; + } + } +} + +void test_ThrowAndCatchFromASubFunctionAndRethrowToCatchInRootFunc(void) +{ + volatile unsigned int ID = 0; + CEXCEPTION_T e; + + Try + { + HappyExceptionRethrower(0xBD); + TEST_FAIL_MESSAGE("Should Have Rethrown Exception"); + } + Catch(e) + { + ID = 1; + } + + TEST_ASSERT_EQUAL(0xBF, e); + TEST_ASSERT_EQUAL(1, ID); +} + +void test_ThrowAndCatchFromASubFunctionAndNoRethrowToCatchInRootFunc(void) +{ + CEXCEPTION_T e = 3; + + Try + { + HappyExceptionRethrower(0xBF); + } + Catch(e) + { + TEST_FAIL_MESSAGE("Should Not Have Re-thrown Error (it should have already been caught)"); + } + + //verify that THIS e is still untouched, even though subfunction was touched + TEST_ASSERT_EQUAL(3, e); +} + +void test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThisDoesntCorruptExceptionId(void) +{ + CEXCEPTION_T e; + + Try + { + HappyExceptionThrower(0xBF); + TEST_FAIL_MESSAGE("Should Have Thrown Exception"); + } + Catch(e) + { + TEST_ASSERT_EQUAL(0xBF, e); + HappyExceptionRethrower(0x12); + TEST_ASSERT_EQUAL(0xBF, e); + } + TEST_ASSERT_EQUAL(0xBF, e); +} + +void test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThatEachExceptionIdIndependent(void) +{ + CEXCEPTION_T e1, e2; + + Try + { + HappyExceptionThrower(0xBF); + TEST_FAIL_MESSAGE("Should Have Thrown Exception"); + } + Catch(e1) + { + TEST_ASSERT_EQUAL(0xBF, e1); + Try + { + HappyExceptionThrower(0x12); + } + Catch(e2) + { + TEST_ASSERT_EQUAL(0x12, e2); + } + TEST_ASSERT_EQUAL(0x12, e2); + TEST_ASSERT_EQUAL(0xBF, e1); + } + TEST_ASSERT_EQUAL(0x12, e2); + TEST_ASSERT_EQUAL(0xBF, e1); +} + +void test_CanHaveMultipleTryBlocksInASingleFunction(void) +{ + CEXCEPTION_T e; + + Try + { + HappyExceptionThrower(0x01); + TEST_FAIL_MESSAGE("Should Have Thrown Exception"); + } + Catch(e) + { + TEST_ASSERT_EQUAL(0x01, e); + } + + Try + { + HappyExceptionThrower(0xF0); + TEST_FAIL_MESSAGE("Should Have Thrown Exception"); + } + Catch(e) + { + TEST_ASSERT_EQUAL(0xF0, e); + } +} + +void test_CanHaveNestedTryBlocksInASingleFunction_ThrowInside(void) +{ + int i = 0; + CEXCEPTION_T e; + + Try + { + Try + { + HappyExceptionThrower(0x01); + i = 1; + TEST_FAIL_MESSAGE("Should Have Rethrown Exception"); + } + Catch(e) + { + TEST_ASSERT_EQUAL(0x01, e); + } + } + Catch(e) + { + TEST_FAIL_MESSAGE("Should Have Been Caught By Inside Catch"); + } +} + +void test_CanHaveNestedTryBlocksInASingleFunction_ThrowOutside(void) +{ + int i = 0; + CEXCEPTION_T e; + + Try + { + Try + { + i = 2; + } + Catch(e) + { + TEST_FAIL_MESSAGE("Should NotBe Caught Here"); + } + HappyExceptionThrower(0x01); + TEST_FAIL_MESSAGE("Should Have Rethrown Exception"); + } + Catch(e) + { + TEST_ASSERT_EQUAL(0x01, e); + } +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/test/TestException_Runner.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/test/TestException_Runner.c new file mode 100644 index 0000000..1697a0e --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/test/TestException_Runner.c @@ -0,0 +1,62 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ +#include "unity.h" +#include "CException.h" + +extern void setUp(void); +extern void tearDown(void); + +extern void test_BasicTryDoesNothingIfNoThrow(void); +extern void test_BasicThrowAndCatch(void); +extern void test_BasicThrowAndCatch_WithMiniSyntax(void); +extern void test_VerifyVolatilesSurviveThrowAndCatch(void); +extern void test_ThrowFromASubFunctionAndCatchInRootFunc(void); +extern void test_ThrowAndCatchFromASubFunctionAndRethrowToCatchInRootFunc(void); +extern void test_ThrowAndCatchFromASubFunctionAndNoRethrowToCatchInRootFunc(void); +extern void test_CanHaveMultipleTryBlocksInASingleFunction(void); +extern void test_CanHaveNestedTryBlocksInASingleFunction_ThrowInside(void); +extern void test_CanHaveNestedTryBlocksInASingleFunction_ThrowOutside(void); +extern void test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThisDoesntCorruptExceptionId(void); +extern void test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThatEachExceptionIdIndependent(void); + +static void runTest(UnityTestFunction test) +{ + CEXCEPTION_T e; + if (TEST_PROTECT()) + { + setUp(); + Try + { + test(); + } + Catch(e) + { + TEST_FAIL_MESSAGE("Unexpected exception!") + } + } + tearDown(); +} + + +int main(void) +{ + Unity.TestFile = __FILE__; + UnityBegin(); + + // RUN_TEST calls runTest + RUN_TEST(test_BasicTryDoesNothingIfNoThrow, 12); + RUN_TEST(test_BasicThrowAndCatch, 30); + RUN_TEST(test_BasicThrowAndCatch_WithMiniSyntax, 49); + RUN_TEST(test_VerifyVolatilesSurviveThrowAndCatch, 69); + RUN_TEST(test_ThrowFromASubFunctionAndCatchInRootFunc, 98); + RUN_TEST(test_ThrowAndCatchFromASubFunctionAndRethrowToCatchInRootFunc, 139); + RUN_TEST(test_ThrowAndCatchFromASubFunctionAndNoRethrowToCatchInRootFunc, 158); + RUN_TEST(test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThisDoesntCorruptExceptionId, 175); + RUN_TEST(test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThatEachExceptionIdIndependent, 193); + RUN_TEST(test_CanHaveMultipleTryBlocksInASingleFunction, 220); + RUN_TEST(test_CanHaveNestedTryBlocksInASingleFunction_ThrowInside, 245); + RUN_TEST(test_CanHaveNestedTryBlocksInASingleFunction_ThrowOutside, 269); + + UnityEnd(); + + return 0; +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/colour_prompt.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/colour_prompt.rb new file mode 100644 index 0000000..81003dd --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/colour_prompt.rb @@ -0,0 +1,94 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +if RUBY_PLATFORM =~/(win|w)32$/ + begin + require 'Win32API' + rescue LoadError + puts "ERROR! \"Win32API\" library not found" + puts "\"Win32API\" is required for colour on a windows machine" + puts " try => \"gem install Win32API\" on the command line" + puts + end + # puts + # puts 'Windows Environment Detected...' + # puts 'Win32API Library Found.' + # puts +end + +class ColourCommandLine + def initialize + if RUBY_PLATFORM =~/(win|w)32$/ + get_std_handle = Win32API.new("kernel32", "GetStdHandle", ['L'], 'L') + @set_console_txt_attrb = + Win32API.new("kernel32","SetConsoleTextAttribute",['L','N'], 'I') + @hout = get_std_handle.call(-11) + end + end + + def change_to(new_colour) + if RUBY_PLATFORM =~/(win|w)32$/ + @set_console_txt_attrb.call(@hout,self.win32_colour(new_colour)) + else + "\033[30;#{posix_colour(new_colour)};22m" + end + end + + def win32_colour(colour) + case colour + when :black then 0 + when :dark_blue then 1 + when :dark_green then 2 + when :dark_cyan then 3 + when :dark_red then 4 + when :dark_purple then 5 + when :dark_yellow, :narrative then 6 + when :default_white, :default, :dark_white then 7 + when :silver then 8 + when :blue then 9 + when :green, :success then 10 + when :cyan, :output then 11 + when :red, :failure then 12 + when :purple then 13 + when :yellow then 14 + when :white then 15 + else + 0 + end + end + + def posix_colour(colour) + case colour + when :black then 30 + when :red, :failure then 31 + when :green, :success then 32 + when :yellow then 33 + when :blue, :narrative then 34 + when :purple, :magenta then 35 + when :cyan, :output then 36 + when :white, :default_white, :default then 37 + else + 30 + end + end + + def out_c(mode, colour, str) + case RUBY_PLATFORM + when /(win|w)32$/ + change_to(colour) + $stdout.puts str if mode == :puts + $stdout.print str if mode == :print + change_to(:default_white) + else + $stdout.puts("#{change_to(colour)}#{str}\033[0m") if mode == :puts + $stdout.print("#{change_to(colour)}#{str}\033[0m") if mode == :print + end + end +end # ColourCommandLine + +def colour_puts(role,str) ColourCommandLine.new.out_c(:puts, role, str) end +def colour_print(role,str) ColourCommandLine.new.out_c(:print, role, str) end + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/colour_reporter.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/colour_reporter.rb new file mode 100644 index 0000000..5aa1d27 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/colour_reporter.rb @@ -0,0 +1,39 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require "#{File.expand_path(File.dirname(__FILE__))}/colour_prompt" + +$colour_output = true + +def report(message) + if not $colour_output + $stdout.puts(message) + else + message = message.join('\n') if (message.class == Array) + message.each_line do |line| + line.chomp! + colour = case(line) + when /(?:total\s+)?tests:?\s+(\d+)\s+(?:total\s+)?failures:?\s+\d+\s+Ignored:?/i + ($1.to_i == 0) ? :green : :red + when /PASS/ + :green + when /^OK$/ + :green + when /(?:FAIL|ERROR)/ + :red + when /IGNORE/ + :yellow + when /^(?:Creating|Compiling|Linking)/ + :white + else + :silver + end + colour_puts(colour, line) + end + end + $stdout.flush + $stderr.flush +end \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_config.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_config.yml new file mode 100644 index 0000000..4a5e474 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_config.yml @@ -0,0 +1,36 @@ +#this is a sample configuration file for generate_module +#you would use it by calling generate_module with the -ygenerate_config.yml option +#files like this are useful for customizing generate_module to your environment +:generate_module: + :defaults: + #these defaults are used in place of any missing options at the command line + :path_src: ../src/ + :path_inc: ../src/ + :path_tst: ../test/ + :update_svn: true + :includes: + #use [] for no additional includes, otherwise list the includes on separate lines + :src: + - Defs.h + - Board.h + :inc: [] + :tst: + - Defs.h + - Board.h + - Exception.h + :boilerplates: + #these are inserted at the top of generated files. + #just comment out or remove if not desired. + #use %1$s where you would like the file name to appear (path/extension not included) + :src: | + //------------------------------------------- + // %1$s.c + //------------------------------------------- + :inc: | + //------------------------------------------- + // %1$s.h + //------------------------------------------- + :tst: | + //------------------------------------------- + // Test%1$s.c : Units tests for %1$s.c + //------------------------------------------- diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_module.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_module.rb new file mode 100644 index 0000000..3db1a98 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_module.rb @@ -0,0 +1,202 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +# This script creates all the files with start code necessary for a new module. +# A simple module only requires a source file, header file, and test file. +# Triad modules require a source, header, and test file for each triad type (like model, conductor, and hardware). + +require 'rubygems' +require 'fileutils' + +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +#help text when requested +HELP_TEXT = [ "\nGENERATE MODULE\n-------- ------", + "\nUsage: ruby generate_module [options] module_name", + " -i\"include\" sets the path to output headers to 'include' (DEFAULT ../src)", + " -s\"../src\" sets the path to output source to '../src' (DEFAULT ../src)", + " -t\"C:/test\" sets the path to output source to 'C:/test' (DEFAULT ../test)", + " -p\"MCH\" sets the output pattern to MCH.", + " dh - driver hardware.", + " dih - driver interrupt hardware.", + " mch - model conductor hardware.", + " mvp - model view presenter.", + " src - just a single source module. (DEFAULT)", + " -d destroy module instead of creating it.", + " -u update subversion too (requires subversion command line)", + " -y\"my.yml\" selects a different yaml config file for module generation", + "" ].join("\n") + +#Built in patterns +PATTERNS = { 'src' => {'' => { :inc => [] } }, + 'dh' => {'Driver' => { :inc => ['%1$sHardware.h'] }, + 'Hardware' => { :inc => [] } + }, + 'dih' => {'Driver' => { :inc => ['%1$sHardware.h', '%1$sInterrupt.h'] }, + 'Interrupt'=> { :inc => ['%1$sHardware.h'] }, + 'Hardware' => { :inc => [] } + }, + 'mch' => {'Model' => { :inc => [] }, + 'Conductor'=> { :inc => ['%1$sModel.h', '%1$sHardware.h'] }, + 'Hardware' => { :inc => [] } + }, + 'mvp' => {'Model' => { :inc => [] }, + 'Presenter'=> { :inc => ['%1$sModel.h', '%1$sView.h'] }, + 'View' => { :inc => [] } + } + } + +#TEMPLATE_TST +TEMPLATE_TST = %q[#include "unity.h" +%2$s#include "%1$s.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void test_%1$s_NeedToImplement(void) +{ + TEST_IGNORE(); +} +] + +#TEMPLATE_SRC +TEMPLATE_SRC = %q[%2$s#include "%1$s.h" +] + +#TEMPLATE_INC +TEMPLATE_INC = %q[#ifndef _%3$s_H +#define _%3$s_H%2$s + +#endif // _%3$s_H +] + +# Parse the command line parameters. +ARGV.each do |arg| + case(arg) + when /^-d/ then @destroy = true + when /^-u/ then @update_svn = true + when /^-p(\w+)/ then @pattern = $1 + when /^-s(.+)/ then @path_src = $1 + when /^-i(.+)/ then @path_inc = $1 + when /^-t(.+)/ then @path_tst = $1 + when /^-y(.+)/ then @yaml_config = $1 + when /^(\w+)/ + raise "ERROR: You can't have more than one Module name specified!" unless @module_name.nil? + @module_name = arg + when /^-(h|-help)/ + puts HELP_TEXT + exit + else + raise "ERROR: Unknown option specified '#{arg}'" + end +end +raise "ERROR: You must have a Module name specified! (use option -h for help)" if @module_name.nil? + +#load yaml file if one was requested +if @yaml_config + require 'yaml' + cfg = YAML.load_file(HERE + @yaml_config)[:generate_module] + @path_src = cfg[:defaults][:path_src] if @path_src.nil? + @path_inc = cfg[:defaults][:path_inc] if @path_inc.nil? + @path_tst = cfg[:defaults][:path_tst] if @path_tst.nil? + @update_svn = cfg[:defaults][:update_svn] if @update_svn.nil? + @extra_inc = cfg[:includes] + @boilerplates = cfg[:boilerplates] +else + @boilerplates = {} +end + +# Create default file paths if none were provided +@path_src = HERE + "../src/" if @path_src.nil? +@path_inc = @path_src if @path_inc.nil? +@path_tst = HERE + "../test/" if @path_tst.nil? +@path_src += '/' unless (@path_src[-1] == 47) +@path_inc += '/' unless (@path_inc[-1] == 47) +@path_tst += '/' unless (@path_tst[-1] == 47) +@pattern = 'src' if @pattern.nil? +@includes = { :src => [], :inc => [], :tst => [] } +@includes.merge!(@extra_inc) unless @extra_inc.nil? + +#create triad definition +TRIAD = [ { :ext => '.c', :path => @path_src, :template => TEMPLATE_SRC, :inc => :src, :boilerplate => @boilerplates[:src] }, + { :ext => '.h', :path => @path_inc, :template => TEMPLATE_INC, :inc => :inc, :boilerplate => @boilerplates[:inc] }, + { :ext => '.c', :path => @path_tst+'Test', :template => TEMPLATE_TST, :inc => :tst, :boilerplate => @boilerplates[:tst] }, + ] + +#prepare the pattern for use +@patterns = PATTERNS[@pattern.downcase] +raise "ERROR: The design pattern specified isn't one that I recognize!" if @patterns.nil? + +# Assemble the path/names of the files we need to work with. +files = [] +TRIAD.each do |triad| + @patterns.each_pair do |pattern_file, pattern_traits| + files << { + :path => "#{triad[:path]}#{@module_name}#{pattern_file}#{triad[:ext]}", + :name => "#{@module_name}#{pattern_file}", + :template => triad[:template], + :boilerplate => triad[:boilerplate], + :includes => case(triad[:inc]) + when :src then @includes[:src] | pattern_traits[:inc].map{|f| f % [@module_name]} + when :inc then @includes[:inc] + when :tst then @includes[:tst] | pattern_traits[:inc].map{|f| "Mock#{f}"% [@module_name]} + end + } + end +end + +# destroy files if that was what was requested +if @destroy + files.each do |filespec| + file = filespec[:path] + if File.exist?(file) + if @update_svn + `svn delete \"#{file}\" --force` + puts "File #{file} deleted and removed from source control" + else + FileUtils.remove(file) + puts "File #{file} deleted" + end + else + puts "File #{file} does not exist so cannot be removed." + end + end + puts "Destroy Complete" + exit +end + +#Abort if any module already exists +files.each do |file| + raise "ERROR: File #{file[:name]} already exists. Exiting." if File.exist?(file[:path]) +end + +# Create Source Modules +files.each_with_index do |file, i| + File.open(file[:path], 'w') do |f| + f.write(file[:boilerplate] % [file[:name]]) unless file[:boilerplate].nil? + f.write(file[:template] % [ file[:name], + file[:includes].map{|f| "#include \"#{f}\"\n"}.join, + file[:name].upcase ] + ) + end + if (@update_svn) + `svn add \"#{file[:path]}\"` + if $?.exitstatus == 0 + puts "File #{file[:path]} created and added to source control" + else + puts "File #{file[:path]} created but FAILED adding to source control!" + end + else + puts "File #{file[:path]} created" + end +end + +puts 'Generate Complete' diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb new file mode 100644 index 0000000..aff5053 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb @@ -0,0 +1,303 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +File.expand_path(File.join(File.dirname(__FILE__),'colour_prompt')) + +class UnityTestRunnerGenerator + + def initialize(options = nil) + @options = { :includes => [], :plugins => [], :framework => :unity } + case(options) + when NilClass then @options + when String then @options.merge!(UnityTestRunnerGenerator.grab_config(options)) + when Hash then @options.merge!(options) + else raise "If you specify arguments, it should be a filename or a hash of options" + end + end + + def self.grab_config(config_file) + options = { :includes => [], :plugins => [], :framework => :unity } + unless (config_file.nil? or config_file.empty?) + require 'yaml' + yaml_guts = YAML.load_file(config_file) + options.merge!(yaml_guts[:unity] ? yaml_guts[:unity] : yaml_guts[:cmock]) + raise "No :unity or :cmock section found in #{config_file}" unless options + end + return(options) + end + + def run(input_file, output_file, options=nil) + tests = [] + includes = [] + used_mocks = [] + + @options.merge!(options) unless options.nil? + module_name = File.basename(input_file) + + #pull required data from source file + File.open(input_file, 'r') do |input| + tests = find_tests(input) + includes = find_includes(input) + used_mocks = find_mocks(includes) + end + + #build runner file + File.open(output_file, 'w') do |output| + create_header(output, used_mocks) + create_externs(output, tests, used_mocks) + create_mock_management(output, used_mocks) + create_suite_setup_and_teardown(output) + create_reset(output, used_mocks) + create_main(output, input_file, tests) + end + + all_files_used = [input_file, output_file] + all_files_used += includes.map {|filename| filename + '.c'} unless includes.empty? + all_files_used += @options[:includes] unless @options[:includes].empty? + return all_files_used.uniq + end + + def find_tests(input_file) + tests_raw = [] + tests_args = [] + tests_and_line_numbers = [] + + input_file.rewind + source_raw = input_file.read + source_scrubbed = source_raw.gsub(/\/\/.*$/, '') # remove line comments + source_scrubbed = source_scrubbed.gsub(/\/\*.*?\*\//m, '') # remove block comments + lines = source_scrubbed.split(/(^\s*\#.*$) # Treat preprocessor directives as a logical line + | (;|\{|\}) /x) # Match ;, {, and } as end of lines + + lines.each_with_index do |line, index| + #find tests + if line =~ /^((?:\s*TEST_CASE\s*\(.*?\)\s*)*)\s*void\s+(test.*?)\s*\(\s*(.*)\s*\)/ + arguments = $1 + name = $2 + call = $3 + args = nil + if (@options[:use_param_tests] and !arguments.empty?) + args = [] + arguments.scan(/\s*TEST_CASE\s*\((.*)\)\s*$/) {|a| args << a[0]} + end + tests_and_line_numbers << { :name => name, :args => args, :call => call, :line_number => 0 } + tests_args = [] + end + end + + #determine line numbers and create tests to run + source_lines = source_raw.split("\n") + source_index = 0; + tests_and_line_numbers.size.times do |i| + source_lines[source_index..-1].each_with_index do |line, index| + if (line =~ /#{tests_and_line_numbers[i][:name]}/) + source_index += index + tests_and_line_numbers[i][:line_number] = source_index + 1 + break + end + end + end + + return tests_and_line_numbers + end + + def find_includes(input_file) + input_file.rewind + includes = [] + input_file.readlines.each do |line| + scan_results = line.scan(/^\s*#include\s+\"\s*(.+)\.[hH]\s*\"/) + includes << scan_results[0][0] if (scan_results.size > 0) + end + return includes + end + + def find_mocks(includes) + mock_headers = [] + includes.each do |include_file| + mock_headers << File.basename(include_file) if (include_file =~ /^mock/i) + end + return mock_headers + end + + def create_header(output, mocks) + output.puts('/* AUTOGENERATED FILE. DO NOT EDIT. */') + create_runtest(output, mocks) + output.puts("\n//=======Automagically Detected Files To Include=====") + output.puts("#include \"#{@options[:framework].to_s}.h\"") + output.puts('#include "cmock.h"') unless (mocks.empty?) + @options[:includes].flatten.uniq.compact.each do |inc| + output.puts("#include #{inc.include?('<') ? inc : "\"#{inc.gsub('.h','')}.h\""}") + end + output.puts('#include ') + output.puts('#include ') + output.puts('#include "CException.h"') if @options[:plugins].include?(:cexception) + mocks.each do |mock| + output.puts("#include \"#{mock.gsub('.h','')}.h\"") + end + if @options[:enforce_strict_ordering] + output.puts('') + output.puts('int GlobalExpectCount;') + output.puts('int GlobalVerifyOrder;') + output.puts('char* GlobalOrderError;') + end + end + + def create_externs(output, tests, mocks) + output.puts("\n//=======External Functions This Runner Calls=====") + output.puts("extern void setUp(void);") + output.puts("extern void tearDown(void);") + tests.each do |test| + output.puts("extern void #{test[:name]}(#{test[:call]});") + end + output.puts('') + end + + def create_mock_management(output, mocks) + unless (mocks.empty?) + output.puts("\n//=======Mock Management=====") + output.puts("static void CMock_Init(void)") + output.puts("{") + if @options[:enforce_strict_ordering] + output.puts(" GlobalExpectCount = 0;") + output.puts(" GlobalVerifyOrder = 0;") + output.puts(" GlobalOrderError = NULL;") + end + mocks.each do |mock| + output.puts(" #{mock}_Init();") + end + output.puts("}\n") + + output.puts("static void CMock_Verify(void)") + output.puts("{") + mocks.each do |mock| + output.puts(" #{mock}_Verify();") + end + output.puts("}\n") + + output.puts("static void CMock_Destroy(void)") + output.puts("{") + mocks.each do |mock| + output.puts(" #{mock}_Destroy();") + end + output.puts("}\n") + end + end + + def create_suite_setup_and_teardown(output) + unless (@options[:suite_setup].nil?) + output.puts("\n//=======Suite Setup=====") + output.puts("static int suite_setup(void)") + output.puts("{") + output.puts(@options[:suite_setup]) + output.puts("}") + end + unless (@options[:suite_teardown].nil?) + output.puts("\n//=======Suite Teardown=====") + output.puts("static int suite_teardown(int num_failures)") + output.puts("{") + output.puts(@options[:suite_teardown]) + output.puts("}") + end + end + + def create_runtest(output, used_mocks) + cexception = @options[:plugins].include? :cexception + va_args1 = @options[:use_param_tests] ? ', ...' : '' + va_args2 = @options[:use_param_tests] ? '__VA_ARGS__' : '' + output.puts("\n//=======Test Runner Used To Run Each Test Below=====") + output.puts("#define RUN_TEST_NO_ARGS") if @options[:use_param_tests] + output.puts("#define RUN_TEST(TestFunc, TestLineNum#{va_args1}) \\") + output.puts("{ \\") + output.puts(" Unity.CurrentTestName = #TestFunc#{va_args2.empty? ? '' : " \"(\" ##{va_args2} \")\""}; \\") + output.puts(" Unity.CurrentTestLineNumber = TestLineNum; \\") + output.puts(" Unity.NumberOfTests++; \\") + output.puts(" if (TEST_PROTECT()) \\") + output.puts(" { \\") + output.puts(" CEXCEPTION_T e; \\") if cexception + output.puts(" Try { \\") if cexception + output.puts(" CMock_Init(); \\") unless (used_mocks.empty?) + output.puts(" setUp(); \\") + output.puts(" TestFunc(#{va_args2}); \\") + output.puts(" CMock_Verify(); \\") unless (used_mocks.empty?) + output.puts(" } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, \"Unhandled Exception!\"); } \\") if cexception + output.puts(" } \\") + output.puts(" CMock_Destroy(); \\") unless (used_mocks.empty?) + output.puts(" if (TEST_PROTECT() && !TEST_IS_IGNORED) \\") + output.puts(" { \\") + output.puts(" tearDown(); \\") + output.puts(" } \\") + output.puts(" UnityConcludeTest(); \\") + output.puts("}\n") + end + + def create_reset(output, used_mocks) + output.puts("\n//=======Test Reset Option=====") + output.puts("void resetTest()") + output.puts("{") + output.puts(" CMock_Verify();") unless (used_mocks.empty?) + output.puts(" CMock_Destroy();") unless (used_mocks.empty?) + output.puts(" tearDown();") + output.puts(" CMock_Init();") unless (used_mocks.empty?) + output.puts(" setUp();") + output.puts("}") + end + + def create_main(output, filename, tests) + output.puts("\n\n//=======MAIN=====") + output.puts("int main(void)") + output.puts("{") + output.puts(" suite_setup();") unless @options[:suite_setup].nil? + output.puts(" Unity.TestFile = \"#{filename}\";") + output.puts(" UnityBegin();") + if (@options[:use_param_tests]) + tests.each do |test| + if ((test[:args].nil?) or (test[:args].empty?)) + output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]}, RUN_TEST_NO_ARGS);") + else + test[:args].each {|args| output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]}, #{args});")} + end + end + else + tests.each { |test| output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]});") } + end + output.puts() + output.puts(" return #{@options[:suite_teardown].nil? ? "" : "suite_teardown"}(UnityEnd());") + output.puts("}") + end +end + + +if ($0 == __FILE__) + options = { :includes => [] } + yaml_file = nil + + #parse out all the options first + ARGV.reject! do |arg| + case(arg) + when '-cexception' + options[:plugins] = [:cexception]; true + when /\.*\.yml/ + options = UnityTestRunnerGenerator.grab_config(arg); true + else false + end + end + + #make sure there is at least one parameter left (the input file) + if !ARGV[0] + puts ["usage: ruby #{__FILE__} (yaml) (options) input_test_file output_test_runner (includes)", + " blah.yml - will use config options in the yml file (see docs)", + " -cexception - include cexception support"].join("\n") + exit 1 + end + + #create the default test runner name if not specified + ARGV[1] = ARGV[0].gsub(".c","_Runner.c") if (!ARGV[1]) + + #everything else is an include file + options[:includes] ||= (ARGV.slice(2..-1).flatten.compact) if (ARGV.size > 2) + + UnityTestRunnerGenerator.new(options).run(ARGV[0], ARGV[1]) +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/test_file_filter.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/test_file_filter.rb new file mode 100644 index 0000000..3dbc26a --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/test_file_filter.rb @@ -0,0 +1,23 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require'yaml' + +module RakefileHelpers + class TestFileFilter + def initialize(all_files = false) + @all_files = all_files + if not @all_files == true + if File.exist?('test_file_filter.yml') + filters = YAML.load_file( 'test_file_filter.yml' ) + @all_files, @only_files, @exclude_files = + filters[:all_files], filters[:only_files], filters[:exclude_files] + end + end + end + attr_accessor :all_files, :only_files, :exclude_files + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/unity_test_summary.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/unity_test_summary.rb new file mode 100644 index 0000000..69ec2e8 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/unity_test_summary.rb @@ -0,0 +1,126 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +#!/usr/bin/ruby +# +# unity_test_summary.rb +# +require 'fileutils' +require 'set' + +class UnityTestSummary + include FileUtils::Verbose + + attr_reader :report, :total_tests, :failures, :ignored + + def initialize + @report = '' + @total_tests = 0 + @failures = 0 + @ignored = 0 + end + + def run + # Clean up result file names + results = @targets.map {|target| target.gsub(/\\/,'/')} + + # Dig through each result file, looking for details on pass/fail: + failure_output = [] + ignore_output = [] + + results.each do |result_file| + lines = File.readlines(result_file).map { |line| line.chomp } + if lines.length == 0 + raise "Empty test result file: #{result_file}" + else + output = get_details(result_file, lines) + failure_output << output[:failures] unless output[:failures].empty? + ignore_output << output[:ignores] unless output[:ignores].empty? + tests,failures,ignored = parse_test_summary(lines) + @total_tests += tests + @failures += failures + @ignored += ignored + end + end + + if @ignored > 0 + @report += "\n" + @report += "--------------------------\n" + @report += "UNITY IGNORED TEST SUMMARY\n" + @report += "--------------------------\n" + @report += ignore_output.flatten.join("\n") + end + + if @failures > 0 + @report += "\n" + @report += "--------------------------\n" + @report += "UNITY FAILED TEST SUMMARY\n" + @report += "--------------------------\n" + @report += failure_output.flatten.join("\n") + end + + @report += "\n" + @report += "--------------------------\n" + @report += "OVERALL UNITY TEST SUMMARY\n" + @report += "--------------------------\n" + @report += "#{@total_tests} TOTAL TESTS #{@failures} TOTAL FAILURES #{@ignored} IGNORED\n" + @report += "\n" + end + + def set_targets(target_array) + @targets = target_array + end + + def set_root_path(path) + @root = path + end + + def usage(err_msg=nil) + puts err_msg if err_msg + puts "Usage: unity_test_summary.rb" + exit 1 + end + + protected + + @@targets=nil + @@path=nil + @@root=nil + + def get_details(result_file, lines) + results = { :failures => [], :ignores => [], :successes => [] } + lines.each do |line| + src_file,src_line,test_name,status,msg = line.split(/:/) + line_out = ((@root and (@root != 0)) ? "#{@root}#{line}" : line ).gsub(/\//, "\\") + case(status) + when 'IGNORE' then results[:ignores] << line_out + when 'FAIL' then results[:failures] << line_out + when 'PASS' then results[:successes] << line_out + end + end + return results + end + + def parse_test_summary(summary) + if summary[-3..-1].join("\n") =~ /(\d+) Tests (\d+) Failures (\d+) Ignored/ + [$1.to_i,$2.to_i,$3.to_i] + else + raise "Couldn't parse test results: #{summary}" + end + end + + def here; File.expand_path(File.dirname(__FILE__)); end + +end + +if $0 == __FILE__ + script = UnityTestSummary.new + begin + script.run + rescue Exception => e + script.usage e.message + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/docs/Unity Summary.odt b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/docs/Unity Summary.odt new file mode 100644 index 0000000..f699661 Binary files /dev/null and b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/docs/Unity Summary.odt differ diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/docs/Unity Summary.pdf b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/docs/Unity Summary.pdf new file mode 100644 index 0000000..ad1a956 Binary files /dev/null and b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/docs/Unity Summary.pdf differ diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/docs/Unity Summary.txt b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/docs/Unity Summary.txt new file mode 100644 index 0000000..e0b179d --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/docs/Unity Summary.txt @@ -0,0 +1,217 @@ +============== +Unity Test API +============== + +[Copyright (c) 2007 - Unity Project by Mike Karlesky, Mark VanderVoord, and Greg Williams] + +------------- +Running Tests +------------- + +RUN_TEST(func, linenum) + +Each Test is run within the macro RUN_TEST. This macro performs necessary setup before the test is called and handles cleanup and result tabulation afterwards. + +-------------- +Ignoring Tests +-------------- + +There are times when a test is incomplete or not valid for some reason. At these times, TEST_IGNORE can be called. Control will immediately be returned to the caller of the test, and no failures will be returned. + +TEST_IGNORE() + +Ignore this test and return immediately + +TEST_IGNORE_MESSAGE (message) + +Ignore this test and return immediately. Output a message stating why the test was ignored. + +-------------- +Aborting Tests +-------------- + +There are times when a test will contain an infinite loop on error conditions, or there may be reason to escape from the test early without executing the rest of the test. A pair of macros support this functionality in Unity. The first (TEST_PROTECT) sets up the feature, and handles emergency abort cases. TEST_ABORT can then be used at any time within the tests to return to the last TEST_PROTECT call. + +TEST_PROTECT() + +Setup and Catch macro + +TEST_ABORT() + +Abort Test macro + +Example: + +main() +{ + if (TEST_PROTECT() == 0) + { + MyTest(); + } +} + +If MyTest calls TEST_ABORT, program control will immediately return to TEST_PROTECT with a non-zero return value. + + +======================= +Unity Assertion Summary +======================= + +-------------------- +Basic Validity Tests +-------------------- + +TEST_ASSERT_TRUE(condition) + +Evaluates whatever code is in condition and fails if it evaluates to false + +TEST_ASSERT_FALSE(condition) + +Evaluates whatever code is in condition and fails if it evaluates to true + +TEST_ASSERT(condition) + +Another way of calling TEST_ASSERT_TRUE + +TEST_ASSERT_UNLESS(condition) + +Another way of calling TEST_ASSERT_FALSE + +TEST_FAIL() +TEST_FAIL_MESSAGE(message) + +This test is automatically marked as a failure. The message is output stating why. + +------------------------------ +Numerical Assertions: Integers +------------------------------ + +TEST_ASSERT_EQUAL_INT(expected, actual) +TEST_ASSERT_EQUAL_INT8(expected, actual) +TEST_ASSERT_EQUAL_INT16(expected, actual) +TEST_ASSERT_EQUAL_INT32(expected, actual) +TEST_ASSERT_EQUAL_INT64(expected, actual) + +Compare two integers for equality and display errors as signed integers. A cast will be performed +to your natural integer size so often this can just be used. When you need to specify the exact size, +like when comparing arrays, you can use a specific version: + + + +TEST_ASSERT_EQUAL_UINT(expected, actual) + +Compare two integers for equality and display errors as unsigned integers. Like INT, there are +variants for different sizes also. + + + +TEST_ASSERT_EQUAL_HEX(expected, actual) + +Compares two integers for equality and display errors as hexadecimal. Like the other integer comparisons, +you can specify the size... here the size will also effect how many nibbles are shown (for example, HEX16 +will show 4 nibbles). + +_ARRAY + +You can append _ARRAY to any of these macros to make an array comparison of that type. Here you will +need to care a bit more about the actual size of the value being checked. You will also specify an +additional argument which is the number of elements to compare. For example: + +TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, elements) + + +TEST_ASSERT_EQUAL(expected, actual) + +Another way of calling TEST_ASSERT_EQUAL_INT + + + +TEST_ASSERT_INT_WITHIN(delta, expected, actual) + +Asserts that the actual value is within plus or minus delta of the expected value. This also comes in +size specific variants. + + +----------------------------- +Numerical Assertions: Bitwise +----------------------------- + +TEST_ASSERT_BITS(mask, expected, actual) + +Use an integer mask to specify which bits should be compared between two other integers. High bits in the mask are compared, low bits ignored. + +TEST_ASSERT_BITS_HIGH(mask, actual) + +Use an integer mask to specify which bits should be inspected to determine if they are all set high. High bits in the mask are compared, low bits ignored. + +TEST_ASSERT_BITS_LOW(mask, actual) + +Use an integer mask to specify which bits should be inspected to determine if they are all set low. High bits in the mask are compared, low bits ignored. + +TEST_ASSERT_BIT_HIGH(bit, actual) + +Test a single bit and verify that it is high. The bit is specified 0-31 for a 32-bit integer. + +TEST_ASSERT_BIT_LOW(bit, actual) + +Test a single bit and verify that it is low. The bit is specified 0-31 for a 32-bit integer. + +---------------------------- +Numerical Assertions: Floats +---------------------------- + +TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual) + +Asserts that the actual value is within plus or minus delta of the expected value. + +TEST_ASSERT_EQUAL_FLOAT(expected, actual) + +Asserts that two floating point values are "equal" within a small % delta of the expected value. + +----------------- +String Assertions +----------------- + +TEST_ASSERT_EQUAL_STRING(expected, actual) + +Compare two null-terminate strings. Fail if any character is different or if the lengths are different. + +TEST_ASSERT_EQUAL_STRING_MESSAGE(expected, actual, message) + +Compare two null-terminate strings. Fail if any character is different or if the lengths are different. Output a custom message on failure. + +------------------ +Pointer Assertions +------------------ + +Most pointer operations can be performed by simply using the integer comparisons above. However, a couple of special cases are added for clarity. + +TEST_ASSERT_NULL(pointer) + +Fails if the pointer is not equal to NULL + +TEST_ASSERT_NOT_NULL(pointer) + +Fails if the pointer is equal to NULL + + +----------------- +Memory Assertions +----------------- + +TEST_ASSERT_EQUAL_MEMORY(expected, actual, len) + +Compare two blocks of memory. This is a good generic assertion for types that can't be coerced into acting like +standard types... but since it's a memory compare, you have to be careful that your data types are packed. + +-------- +_MESSAGE +-------- + +you can append _MESSAGE to any of the macros to make them take an additional argument. This argument +is a string that will be printed at the end of the failure strings. This is useful for specifying more +information about the problem. + + + + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/docs/license.txt b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/docs/license.txt new file mode 100644 index 0000000..c42e330 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/docs/license.txt @@ -0,0 +1,31 @@ + Copyright (c) 2007-2010 Mike Karlesky, Mark VanderVoord, Greg Williams + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + The end-user documentation included with the redistribution, if + any, must include the following acknowledgment: "This product + includes software developed for the Unity Project, by Mike Karlesky, + Mark VanderVoord, and Greg Williams and other contributors", in + the same place and form as other third-party acknowledgments. + Alternately, this acknowledgment may appear in the software + itself, in the same form and location as other such third-party + acknowledgments. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.c new file mode 100644 index 0000000..9cf42c6 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.c @@ -0,0 +1,10 @@ +#include "unity.h" +#include "UnityHelper.h" +#include +#include + +void AssertEqualExampleStruct(const EXAMPLE_STRUCT_T expected, const EXAMPLE_STRUCT_T actual, const unsigned short line) +{ + UNITY_TEST_ASSERT_EQUAL_INT(expected.x, actual.x, line, "Example Struct Failed For Field x"); + UNITY_TEST_ASSERT_EQUAL_INT(expected.y, actual.y, line, "Example Struct Failed For Field y"); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.h new file mode 100644 index 0000000..1516111 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.h @@ -0,0 +1,12 @@ +#ifndef _TESTHELPER_H +#define _TESTHELPER_H + +#include "Types.h" + +void AssertEqualExampleStruct(const EXAMPLE_STRUCT_T expected, const EXAMPLE_STRUCT_T actual, const unsigned short line); + +#define UNITY_TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(expected, actual, line, message) AssertEqualExampleStruct(expected, actual, line); + +#define TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(expected, actual) UNITY_TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(expected, actual, __LINE__, NULL); + +#endif // _TESTHELPER_H diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/makefile b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/makefile new file mode 100644 index 0000000..723d390 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/makefile @@ -0,0 +1,40 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +C_COMPILER=gcc +TARGET_BASE1=test1 +TARGET_BASE2=test2 +ifeq ($(OS),Windows_NT) + TARGET_EXTENSION=.exe +else + TARGET_EXTENSION=.out +endif +TARGET1 = $(TARGET_BASE1)$(TARGET_EXTENSION) +TARGET2 = $(TARGET_BASE2)$(TARGET_EXTENSION) +SRC_FILES1=../src/unity.c src/ProductionCode.c test/TestProductionCode.c test/no_ruby/TestProductionCode_Runner.c +SRC_FILES2=../src/unity.c src/ProductionCode2.c test/TestProductionCode2.c test/no_ruby/TestProductionCode2_Runner.c +INC_DIRS=-Isrc -I../src +SYMBOLS=-DTEST + +ifeq ($(OS),Windows_NT) + CLEANUP = del /F /Q build\* && del /F /Q $(TARGET1) && del /F /Q $(TARGET2) +else + CLEANUP = rm -f build/*.o ; rm -f $(TARGET1) ; rm -f $(TARGET2) +endif + +all: clean default + +default: +# ruby auto/generate_test_runner.rb test/TestProductionCode.c test/no_ruby/TestProductionCode_Runner.c +# ruby auto/generate_test_runner.rb test/TestProductionCode2.c test/no_ruby/TestProductionCode2_Runner.c + $(C_COMPILER) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES1) -o $(TARGET1) + $(C_COMPILER) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES2) -o $(TARGET2) + $(TARGET1) + $(TARGET2) + +clean: + $(CLEANUP) + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/rakefile.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/rakefile.rb new file mode 100644 index 0000000..0905b4b --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/rakefile.rb @@ -0,0 +1,32 @@ +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require HERE+'rakefile_helper' + +include RakefileHelpers + +# Load default configuration, for now +DEFAULT_CONFIG_FILE = 'gcc.yml' +configure_toolchain(DEFAULT_CONFIG_FILE) + +task :unit do + run_tests get_unit_test_files +end + +desc "Generate test summary" +task :summary do + report_summary +end + +desc "Build and test Unity" +task :all => [:clean, :unit, :summary] +task :default => [:clobber, :all] +task :ci => [:default] +task :cruise => [:default] + +desc "Load configuration" +task :config, :config_file do |t, args| + configure_toolchain(args[:config_file]) +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/rakefile_helper.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/rakefile_helper.rb new file mode 100644 index 0000000..0127d69 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/rakefile_helper.rb @@ -0,0 +1,260 @@ +require 'yaml' +require 'fileutils' +require HERE+'../auto/unity_test_summary' +require HERE+'../auto/generate_test_runner' +require HERE+'../auto/colour_reporter' + +module RakefileHelpers + + C_EXTENSION = '.c' + + def load_configuration(config_file) + $cfg_file = "../targets/#{config_file}" + $cfg = YAML.load(File.read($cfg_file)) + end + + def configure_clean + CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil? + end + + def configure_toolchain(config_file=DEFAULT_CONFIG_FILE) + config_file += '.yml' unless config_file =~ /\.yml$/ + load_configuration('../targets/'+config_file) + configure_clean + end + + def get_unit_test_files + path = $cfg['compiler']['unit_tests_path'] + 'Test*' + C_EXTENSION + path.gsub!(/\\/, '/') + FileList.new(path) + end + + def get_local_include_dirs + include_dirs = $cfg['compiler']['includes']['items'].dup + include_dirs.delete_if {|dir| dir.is_a?(Array)} + return include_dirs + end + + def extract_headers(filename) + includes = [] + lines = File.readlines(filename) + lines.each do |line| + m = line.match(/^\s*#include\s+\"\s*(.+\.[hH])\s*\"/) + if not m.nil? + includes << m[1] + end + end + return includes + end + + def find_source_file(header, paths) + paths.each do |dir| + src_file = dir + header.ext(C_EXTENSION) + if (File.exists?(src_file)) + return src_file + end + end + return nil + end + + def tackit(strings) + if strings.is_a?(Array) + result = "\"#{strings.join}\"" + else + result = strings + end + return result + end + + def squash(prefix, items) + result = '' + items.each { |item| result += " #{prefix}#{tackit(item)}" } + return result + end + + def build_compiler_fields + command = tackit($cfg['compiler']['path']) + if $cfg['compiler']['defines']['items'].nil? + defines = '' + else + defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items']) + end + options = squash('', $cfg['compiler']['options']) + includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :defines => defines, :options => options, :includes => includes} + end + + def compile(file, defines=[]) + compiler = build_compiler_fields + cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{file} " + + "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" + + "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" + execute(cmd_str) + end + + def build_linker_fields + command = tackit($cfg['linker']['path']) + if $cfg['linker']['options'].nil? + options = '' + else + options = squash('', $cfg['linker']['options']) + end + if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?) + includes = '' + else + includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) + end + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :options => options, :includes => includes} + end + + def link(exe_name, obj_list) + linker = build_linker_fields + cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + + (obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).join + + $cfg['linker']['bin_files']['prefix'] + ' ' + + $cfg['linker']['bin_files']['destination'] + + exe_name + $cfg['linker']['bin_files']['extension'] + execute(cmd_str) + end + + def build_simulator_fields + return nil if $cfg['simulator'].nil? + if $cfg['simulator']['path'].nil? + command = '' + else + command = (tackit($cfg['simulator']['path']) + ' ') + end + if $cfg['simulator']['pre_support'].nil? + pre_support = '' + else + pre_support = squash('', $cfg['simulator']['pre_support']) + end + if $cfg['simulator']['post_support'].nil? + post_support = '' + else + post_support = squash('', $cfg['simulator']['post_support']) + end + return {:command => command, :pre_support => pre_support, :post_support => post_support} + end + + def execute(command_string, verbose=true, raise_on_fail=true) + report command_string + output = `#{command_string}`.chomp + report(output) if (verbose && !output.nil? && (output.length > 0)) + if (($?.exitstatus != 0) and (raise_on_fail)) + raise "Command failed. (Returned #{$?.exitstatus})" + end + return output + end + + def report_summary + summary = UnityTestSummary.new + summary.set_root_path(HERE) + results_glob = "#{$cfg['compiler']['build_path']}*.test*" + results_glob.gsub!(/\\/, '/') + results = Dir[results_glob] + summary.set_targets(results) + summary.run + fail_out "FAIL: There were failures" if (summary.failures > 0) + end + + def run_tests(test_files) + + report 'Running system tests...' + + # Tack on TEST define for compiling unit tests + load_configuration($cfg_file) + test_defines = ['TEST'] + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + $cfg['compiler']['defines']['items'] << 'TEST' + + include_dirs = get_local_include_dirs + + # Build and execute each unit test + test_files.each do |test| + obj_list = [] + + # Detect dependencies and build required required modules + extract_headers(test).each do |header| + # Compile corresponding source file if it exists + src_file = find_source_file(header, include_dirs) + if !src_file.nil? + compile(src_file, test_defines) + obj_list << header.ext($cfg['compiler']['object_files']['extension']) + end + end + + # Build the test runner (generate if configured to do so) + test_base = File.basename(test, C_EXTENSION) + runner_name = test_base + '_Runner.c' + if $cfg['compiler']['runner_path'].nil? + runner_path = $cfg['compiler']['build_path'] + runner_name + test_gen = UnityTestRunnerGenerator.new($cfg_file) + test_gen.run(test, runner_path) + else + runner_path = $cfg['compiler']['runner_path'] + runner_name + end + + compile(runner_path, test_defines) + obj_list << runner_name.ext($cfg['compiler']['object_files']['extension']) + + # Build the test module + compile(test, test_defines) + obj_list << test_base.ext($cfg['compiler']['object_files']['extension']) + + # Link the test executable + link(test_base, obj_list) + + # Execute unit test and generate results file + simulator = build_simulator_fields + executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] + if simulator.nil? + cmd_str = executable + else + cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" + end + output = execute(cmd_str, true, false) + test_results = $cfg['compiler']['build_path'] + test_base + if output.match(/OK$/m).nil? + test_results += '.testfail' + else + test_results += '.testpass' + end + File.open(test_results, 'w') { |f| f.print output } + end + end + + def build_application(main) + + report "Building application..." + + obj_list = [] + load_configuration($cfg_file) + main_path = $cfg['compiler']['source_path'] + main + C_EXTENSION + + # Detect dependencies and build required required modules + include_dirs = get_local_include_dirs + extract_headers(main_path).each do |header| + src_file = find_source_file(header, include_dirs) + if !src_file.nil? + compile(src_file) + obj_list << header.ext($cfg['compiler']['object_files']['extension']) + end + end + + # Build the main source file + main_base = File.basename(main_path, C_EXTENSION) + compile(main_path) + obj_list << main_base.ext($cfg['compiler']['object_files']['extension']) + + # Create the executable + link(main_base, obj_list) + end + + def fail_out(msg) + puts msg + exit(-1) + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/readme.txt b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/readme.txt new file mode 100644 index 0000000..6c7780e --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/readme.txt @@ -0,0 +1,18 @@ +Example Project + +This example project gives an example of some passing, ignored, and failing tests. +It's simple and meant for you to look over and get an idea for what all of this stuff does. + +You can build and test using the makefile if you have gcc installed (you may need to tweak +the locations of some tools in the makefile). Otherwise, the rake version will let you +test with gcc or a couple versions of IAR. You can tweak the yaml files to get those versions +running. + +Ruby is required if you're using the rake version (obviously). This version shows off most of +Unity's advanced features (automatically creating test runners, fancy summaries, etc.) + +The makefile version doesn't require anything outside of your normal build tools, but won't do the +extras for you. So that you can test right away, we've written the test runners for you and +put them in the test\no_ruby subdirectory. If you make changes to the tests or source, you might +need to update these (like when you add or remove tests). Do that for a while and you'll learn +why you really want to start using the Ruby tools. \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/src/ProductionCode.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/src/ProductionCode.c new file mode 100644 index 0000000..500b44b --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/src/ProductionCode.c @@ -0,0 +1,24 @@ + +#include "ProductionCode.h" + +int Counter = 0; +int NumbersToFind[9] = { 0, 34, 55, 66, 32, 11, 1, 77, 888 }; //some obnoxious array to search that is 1-based indexing instead of 0. + +// This function is supposed to search through NumbersToFind and find a particular number. +// If it finds it, the index is returned. Otherwise 0 is returned which sorta makes sense since +// NumbersToFind is indexed from 1. Unfortunately it's broken +// (and should therefore be caught by our tests) +int FindFunction_WhichIsBroken(int NumberToFind) +{ + int i = 0; + while (i <= 8) //Notice I should have been in braces + i++; + if (NumbersToFind[i] == NumberToFind) //Yikes! I'm getting run after the loop finishes instead of during it! + return i; + return 0; +} + +int FunctionWhichReturnsLocalVariable(void) +{ + return Counter; +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/src/ProductionCode.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/src/ProductionCode.h new file mode 100644 index 0000000..250ca0d --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/src/ProductionCode.h @@ -0,0 +1,3 @@ + +int FindFunction_WhichIsBroken(int NumberToFind); +int FunctionWhichReturnsLocalVariable(void); diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/src/ProductionCode2.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/src/ProductionCode2.c new file mode 100644 index 0000000..a8c72e1 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/src/ProductionCode2.c @@ -0,0 +1,9 @@ + +#include "ProductionCode2.h" + +char* ThisFunctionHasNotBeenTested(int Poor, char* LittleFunction) +{ + //Since There Are No Tests Yet, This Function Could Be Empty For All We Know. + // Which isn't terribly useful... but at least we put in a TEST_IGNORE so we won't forget + return (char*)0; +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/src/ProductionCode2.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/src/ProductionCode2.h new file mode 100644 index 0000000..34ae980 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/src/ProductionCode2.h @@ -0,0 +1,2 @@ + +char* ThisFunctionHasNotBeenTested(int Poor, char* LittleFunction); diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/test/TestProductionCode.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/test/TestProductionCode.c new file mode 100644 index 0000000..28a5581 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/test/TestProductionCode.c @@ -0,0 +1,62 @@ + +#include "ProductionCode.h" +#include "unity.h" + +//sometimes you may want to get at local data in a module. +//for example: If you plan to pass by reference, this could be useful +//however, it should often be avoided +extern int Counter; + +void setUp(void) +{ + //This is run before EACH TEST + Counter = 0x5a5a; +} + +void tearDown(void) +{ +} + +void test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode(void) +{ + //All of these should pass + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(78)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(1)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(33)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(999)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(-1)); +} + +void test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken(void) +{ + // You should see this line fail in your test summary + TEST_ASSERT_EQUAL(1, FindFunction_WhichIsBroken(34)); + + // Notice the rest of these didn't get a chance to run because the line above failed. + // Unit tests abort each test function on the first sign of trouble. + // Then NEXT test function runs as normal. + TEST_ASSERT_EQUAL(8, FindFunction_WhichIsBroken(8888)); +} + +void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue(void) +{ + //This should be true because setUp set this up for us before this test + TEST_ASSERT_EQUAL_HEX(0x5a5a, FunctionWhichReturnsLocalVariable()); + + //This should be true because we can still change our answer + Counter = 0x1234; + TEST_ASSERT_EQUAL_HEX(0x1234, FunctionWhichReturnsLocalVariable()); +} + +void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain(void) +{ + //This should be true again because setup was rerun before this test (and after we changed it to 0x1234) + TEST_ASSERT_EQUAL_HEX(0x5a5a, FunctionWhichReturnsLocalVariable()); +} + +void test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed(void) +{ + //Sometimes you get the test wrong. When that happens, you get a failure too... and a quick look should tell + // you what actually happened...which in this case was a failure to setup the initial condition. + TEST_ASSERT_EQUAL_HEX(0x1234, FunctionWhichReturnsLocalVariable()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/test/TestProductionCode2.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/test/TestProductionCode2.c new file mode 100644 index 0000000..20c9251 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/test/TestProductionCode2.c @@ -0,0 +1,26 @@ + +#include "ProductionCode2.h" +#include "unity.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void test_IgnoredTest(void) +{ + TEST_IGNORE_MESSAGE("This Test Was Ignored On Purpose"); +} + +void test_AnotherIgnoredTest(void) +{ + TEST_IGNORE_MESSAGE("These Can Be Useful For Leaving Yourself Notes On What You Need To Do Yet"); +} + +void test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented(void) +{ + TEST_IGNORE(); //Like This +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode2_Runner.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode2_Runner.c new file mode 100644 index 0000000..56515ae --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode2_Runner.c @@ -0,0 +1,46 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ +#include "unity.h" +#include +#include + +char MessageBuffer[50]; + +extern void setUp(void); +extern void tearDown(void); + +extern void test_IgnoredTest(void); +extern void test_AnotherIgnoredTest(void); +extern void test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented(void); + +static void runTest(UnityTestFunction test) +{ + if (TEST_PROTECT()) + { + setUp(); + test(); + } + if (TEST_PROTECT() && !TEST_IS_IGNORED) + { + tearDown(); + } +} +void resetTest() +{ + tearDown(); + setUp(); +} + + +int main(void) +{ + Unity.TestFile = "test/TestProductionCode2.c"; + UnityBegin(); + + // RUN_TEST calls runTest + RUN_TEST(test_IgnoredTest, 13); + RUN_TEST(test_AnotherIgnoredTest, 18); + RUN_TEST(test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented, 23); + + UnityEnd(); + return 0; +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode_Runner.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode_Runner.c new file mode 100644 index 0000000..64112f3 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode_Runner.c @@ -0,0 +1,50 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ +#include "unity.h" +#include +#include + +char MessageBuffer[50]; + +extern void setUp(void); +extern void tearDown(void); + +extern void test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode(void); +extern void test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken(void); +extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue(void); +extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain(void); +extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed(void); + +static void runTest(UnityTestFunction test) +{ + if (TEST_PROTECT()) + { + setUp(); + test(); + } + if (TEST_PROTECT() && !TEST_IS_IGNORED) + { + tearDown(); + } +} +void resetTest() +{ + tearDown(); + setUp(); +} + + +int main(void) +{ + Unity.TestFile = "test/TestProductionCode.c"; + UnityBegin(); + + // RUN_TEST calls runTest + RUN_TEST(test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode, 20); + RUN_TEST(test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken, 30); + RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue, 41); + RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain, 51); + RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed, 57); + + UnityEnd(); + return 0; +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/build/MakefileWorker.mk b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/build/MakefileWorker.mk new file mode 100644 index 0000000..9948751 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/build/MakefileWorker.mk @@ -0,0 +1,331 @@ +#--------- +# +# MakefileWorker.mk +# +# Include this helper file in your makefile +# It makes +# A static library holding the application objs +# A test executable +# +# See this example for parameter settings +# examples/Makefile +# +#---------- +# Inputs - these variables describe what to build +# +# INCLUDE_DIRS - Directories used to search for include files. +# This generates a -I for each directory +# SRC_DIRS - Directories containing source file to built into the library +# SRC_FILES - Specific source files to build into library. Helpful when not all code +# in a directory can be built for test (hopefully a temporary situation) +# TEST_SRC_DIRS - Directories containing unit test code build into the unit test runner +# These do not go in a library. They are explicitly included in the test runner +# MOCKS_SRC_DIRS - Directories containing mock source files to build into the test runner +# These do not go in a library. They are explicitly included in the test runner +#---------- +# You can adjust these variables to influence how to build the test target +# and where to put and name outputs +# See below to determine defaults +# COMPONENT_NAME - the name of the thing being built +# UNITY_HOME - where Unity home dir found +# UNITY_BUILD_HOME - place for scripts +# UNITY_OBJS_DIR - a directory where o and d files go +# UNITY_LIB_DIR - a directory where libs go +# UNITY_ENABLE_DEBUG - build for debug +# UNITY_USE_MEM_LEAK_DETECTION - Links with overridden new and delete +# UNITY_USE_STD_CPP_LIB - Set to N to keep the standard C++ library out +# of the test harness +# UNITY_USE_GCOV - Turn on coverage analysis +# Clean then build with this flag set to Y, then 'make gcov' +# UNITY_TEST_RUNNER_FLAGS +# None by default +# UNITY_MAPFILE - generate a map file +# UNITY_WARNINGFLAGS - overly picky by default +# OTHER_MAKEFILE_TO_INCLUDE - a hook to use this makefile to make +# other targets. Like CSlim, which is part of fitnesse +#---------- +# +# Other flags users can initialize to sneak in their settings +# UNITY_CFLAGS - C complier +# UNITY_LDFLAGS - Linker flags +#---------- + + +ifndef COMPONENT_NAME + COMPONENT_NAME = name_this_in_the_makefile +endif + +# Debug on by default +ifndef UNITY_ENABLE_DEBUG + UNITY_ENABLE_DEBUG = Y +endif + +# new and delete for memory leak detection on by default +ifndef UNITY_USE_MEM_LEAK_DETECTION + UNITY_USE_MEM_LEAK_DETECTION = Y +endif + +# Use gcov, off by default +ifndef UNITY_USE_GCOV + UNITY_USE_GCOV = N +endif + +# Default warnings +ifndef UNITY_WARNINGFLAGS + UNITY_WARNINGFLAGS = -Wall -Werror -Wshadow -Wswitch-default +endif + +# Default dir for temporary files (d, o) +ifndef UNITY_OBJS_DIR + UNITY_OBJS_DIR = objs +endif + +# Default dir for the outout library +ifndef UNITY_LIB_DIR + UNITY_LIB_DIR = lib +endif + +# No map by default +ifndef UNITY_MAP_FILE + UNITY_MAP_FILE = N +endif + +#Not verbose by deafult +ifdef VERBOSE + UNITY_TEST_RUNNER_FLAGS += -v +endif + +ifdef GROUP + UNITY_TEST_RUNNER_FLAGS += -g $(GROUP) +endif + +ifdef NAME + UNITY_TEST_RUNNER_FLAGS += -n $(NAME) +endif + +ifdef REPEAT + UNITY_TEST_RUNNER_FLAGS += -r $(REPEAT) +endif + + +# -------------------------------------- +# derived flags in the following area +# -------------------------------------- +ifeq ($(UNITY_USE_MEM_LEAK_DETECTION), N) + UNITY_CFLAGS += -DUNITY_MEM_LEAK_DETECTION_DISABLED +else + UNITY_MEMLEAK_DETECTOR_MALLOC_MACRO_FILE = -include $(UNITY_HOME)/extras/fixture/src/unity_fixture_malloc_overrides.h +endif + +ifeq ($(UNITY_ENABLE_DEBUG), Y) + UNITY_CFLAGS += -g +endif + +ifeq ($(UNITY_USE_GCOV), Y) + UNITY_CFLAGS += -fprofile-arcs -ftest-coverage +endif + +UNITY_CFLAGS += $(UNITY_MEMLEAK_DETECTOR_MALLOC_MACRO_FILE) + +TARGET_MAP = $(COMPONENT_NAME).map.txt +ifeq ($(UNITY_MAP_FILE), Y) + UNITY_LDFLAGS += -Wl,-map,$(TARGET_MAP) +endif + +LD_LIBRARIES += -lgcov + +TARGET_LIB = \ + $(UNITY_LIB_DIR)/lib$(COMPONENT_NAME).a + +TEST_TARGET = \ + $(COMPONENT_NAME)_tests + +#Helper Functions +get_src_from_dir = $(wildcard $1/*.cpp) $(wildcard $1/*.c) +get_dirs_from_dirspec = $(wildcard $1) +get_src_from_dir_list = $(foreach dir, $1, $(call get_src_from_dir,$(dir))) +__src_to = $(subst .c,$1, $(subst .cpp,$1,$2)) +src_to = $(addprefix $(UNITY_OBJS_DIR)/,$(call __src_to,$1,$2)) +src_to_o = $(call src_to,.o,$1) +src_to_d = $(call src_to,.d,$1) +src_to_gcda = $(call src_to,.gcda,$1) +src_to_gcno = $(call src_to,.gcno,$1) +make_dotdot_a_subdir = $(subst ..,_dot_dot, $1) +time = $(shell date +%s) +delta_t = $(eval minus, $1, $2) +debug_print_list = $(foreach word,$1,echo " $(word)";) echo; + +#Derived +STUFF_TO_CLEAN += $(TEST_TARGET) $(TEST_TARGET).exe $(TARGET_LIB) $(TARGET_MAP) + +SRC += $(call get_src_from_dir_list, $(SRC_DIRS)) $(SRC_FILES) +OBJ = $(call src_to_o,$(SRC)) +OBJ2 = $(call make_dotdot_a_subdir. $(OBJ)) + +STUFF_TO_CLEAN += $(OBJ) + +TEST_SRC = $(call get_src_from_dir_list, $(TEST_SRC_DIRS)) +TEST_OBJS = $(call src_to_o,$(TEST_SRC)) +STUFF_TO_CLEAN += $(TEST_OBJS) + + +MOCKS_SRC = $(call get_src_from_dir_list, $(MOCKS_SRC_DIRS)) +MOCKS_OBJS = $(call src_to_o,$(MOCKS_SRC)) +STUFF_TO_CLEAN += $(MOCKS_OBJS) + +ALL_SRC = $(SRC) $(TEST_SRC) $(MOCKS_SRC) + +#Test coverage with gcov +GCOV_OUTPUT = gcov_output.txt +GCOV_REPORT = gcov_report.txt +GCOV_ERROR = gcov_error.txt +GCOV_GCDA_FILES = $(call src_to_gcda, $(ALL_SRC)) +GCOV_GCNO_FILES = $(call src_to_gcno, $(ALL_SRC)) +TEST_OUTPUT = $(TEST_TARGET).txt +STUFF_TO_CLEAN += \ + $(GCOV_OUTPUT)\ + $(GCOV_REPORT)\ + $(GCOV_REPORT).html\ + $(GCOV_ERROR)\ + $(GCOV_GCDA_FILES)\ + $(GCOV_GCNO_FILES)\ + $(TEST_OUTPUT) + + +#The gcda files for gcov need to be deleted before each run +#To avoid annoying messages. +GCOV_CLEAN = $(SILENCE)rm -f $(GCOV_GCDA_FILES) $(GCOV_OUTPUT) $(GCOV_REPORT) $(GCOV_ERROR) +RUN_TEST_TARGET = $(SILENCE) $(GCOV_CLEAN) ; echo "Running $(TEST_TARGET)"; ./$(TEST_TARGET) $(UNITY_TEST_RUNNER_FLAGS) + +INCLUDES_DIRS_EXPANDED = $(call get_dirs_from_dirspec, $(INCLUDE_DIRS)) +INCLUDES += $(foreach dir, $(INCLUDES_DIRS_EXPANDED), -I$(dir)) +MOCK_DIRS_EXPANDED = $(call get_dirs_from_dirspec, $(MOCKS_SRC_DIRS)) +INCLUDES += $(foreach dir, $(MOCK_DIRS_EXPANDED), -I$(dir)) + + +DEP_FILES = $(call src_to_d, $(ALL_SRC)) +STUFF_TO_CLEAN += $(DEP_FILES) $(PRODUCTION_CODE_START) $(PRODUCTION_CODE_END) +STUFF_TO_CLEAN += $(STDLIB_CODE_START) $(MAP_FILE) cpputest_*.xml junit_run_output + +# We'll use the UNITY_CFLAGS etc so that you can override AND add to the CppUTest flags +CFLAGS = $(UNITY_CFLAGS) $(UNITY_ADDITIONAL_CFLAGS) $(INCLUDES) $(UNITY_WARNINGFLAGS) +LDFLAGS = $(UNITY_LDFLAGS) $(UNITY_ADDITIONAL_LDFLAGS) + +# Targets + +.PHONY: all +all: start $(TEST_TARGET) + $(RUN_TEST_TARGET) + +.PHONY: start +start: $(TEST_TARGET) + $(SILENCE)START_TIME=$(call time) + +.PHONY: all_no_tests +all_no_tests: $(TEST_TARGET) + +.PHONY: flags +flags: + @echo + @echo "Compile C source with CFLAGS:" + @$(call debug_print_list,$(CFLAGS)) + @echo "Link with LDFLAGS:" + @$(call debug_print_list,$(LDFLAGS)) + @echo "Link with LD_LIBRARIES:" + @$(call debug_print_list,$(LD_LIBRARIES)) + @echo "Create libraries with ARFLAGS:" + @$(call debug_print_list,$(ARFLAGS)) + @echo "OBJ files:" + @$(call debug_print_list,$(OBJ2)) + + +$(TEST_TARGET): $(TEST_OBJS) $(MOCKS_OBJS) $(PRODUCTION_CODE_START) $(TARGET_LIB) $(USER_LIBS) $(PRODUCTION_CODE_END) $(STDLIB_CODE_START) + $(SILENCE)echo Linking $@ + $(SILENCE)$(LINK.o) -o $@ $^ $(LD_LIBRARIES) + +$(TARGET_LIB): $(OBJ) + $(SILENCE)echo Building archive $@ + $(SILENCE)mkdir -p lib + $(SILENCE)$(AR) $(ARFLAGS) $@ $^ + $(SILENCE)ranlib $@ + +test: $(TEST_TARGET) + $(RUN_TEST_TARGET) | tee $(TEST_OUTPUT) + +vtest: $(TEST_TARGET) + $(RUN_TEST_TARGET) -v | tee $(TEST_OUTPUT) + +$(UNITY_OBJS_DIR)/%.o: %.cpp + @echo compiling $(notdir $<) + $(SILENCE)mkdir -p $(dir $@) + $(SILENCE)$(COMPILE.cpp) -MMD -MP $(OUTPUT_OPTION) $< + +$(UNITY_OBJS_DIR)/%.o: %.c + @echo compiling $(notdir $<) + $(SILENCE)mkdir -p $(dir $@) + $(SILENCE)$(COMPILE.c) -MMD -MP $(OUTPUT_OPTION) $< + +ifneq "$(MAKECMDGOALS)" "clean" +-include $(DEP_FILES) +endif + +.PHONY: clean +clean: + $(SILENCE)echo Making clean + $(SILENCE)$(RM) $(STUFF_TO_CLEAN) + $(SILENCE)rm -rf gcov $(UNITY_OBJS_DIR) + $(SILENCE)find . -name "*.gcno" | xargs rm -f + $(SILENCE)find . -name "*.gcda" | xargs rm -f + +#realclean gets rid of all gcov, o and d files in the directory tree +#not just the ones made by this makefile +.PHONY: realclean +realclean: clean + $(SILENCE)rm -rf gcov + $(SILENCE)find . -name "*.gdcno" | xargs rm -f + $(SILENCE)find . -name "*.[do]" | xargs rm -f + +gcov: test + $(SILENCE)for d in $(SRC_DIRS) ; do \ + gcov --object-directory $(UNITY_OBJS_DIR)/$$d $$d/*.c $$d/*.cpp >> $(GCOV_OUTPUT) 2>>$(GCOV_ERROR) ; \ + done + $(SILENCE)for f in $(SRC_FILES) ; do \ + gcov --object-directory $(UNITY_OBJS_DIR)/$$f $$f >> $(GCOV_OUTPUT) 2>>$(GCOV_ERROR) ; \ + done + $(UNITY_BUILD_HOME)/filterGcov.sh $(GCOV_OUTPUT) $(GCOV_ERROR) $(GCOV_REPORT) $(TEST_OUTPUT) + $(SILENCE)cat $(GCOV_REPORT) + $(SILENCE)mkdir -p gcov + $(SILENCE)mv *.gcov gcov + $(SILENCE)mv gcov_* gcov + $(SILENCE)echo "See gcov directory for details" + +debug: + @echo + @echo "Target Source files:" + @$(call debug_print_list,$(SRC)) + @echo "Target Object files:" + @$(call debug_print_list,$(OBJ)) + @echo "Test Source files:" + @$(call debug_print_list,$(TEST_SRC)) + @echo "Test Object files:" + @$(call debug_print_list,$(TEST_OBJS)) + @echo "Mock Source files:" + @$(call debug_print_list,$(MOCKS_SRC)) + @echo "Mock Object files:" + @$(call debug_print_list,$(MOCKS_OBJS)) + @echo "All Input Dependency files:" + @$(call debug_print_list,$(DEP_FILES)) + @echo Stuff to clean: + @$(call debug_print_list,$(STUFF_TO_CLEAN)) + @echo Includes: + @$(call debug_print_list,$(INCLUDES)) + +ifneq "$(OTHER_MAKEFILE_TO_INCLUDE)" "" +-include $(OTHER_MAKEFILE_TO_INCLUDE) +endif + + + +st,$(TEST_SRC)) + @echo "Test Object files:" + @$(call debug_print \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/build/filterGcov.sh b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/build/filterGcov.sh new file mode 100644 index 0000000..a861cf6 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/build/filterGcov.sh @@ -0,0 +1,61 @@ +#!/bin/bash +INPUT_FILE=$1 +TEMP_FILE1=${INPUT_FILE}1.tmp +TEMP_FILE2=${INPUT_FILE}2.tmp +TEMP_FILE3=${INPUT_FILE}3.tmp +ERROR_FILE=$2 +OUTPUT_FILE=$3 +HTML_OUTPUT_FILE=$3.html +TEST_RESULTS=$4 + +flattenGcovOutput() { +while read line1 +do + read line2 + echo $line2 " " $line1 + read junk + read junk +done < ${INPUT_FILE} +} + +getRidOfCruft() { +sed '-e s/^Lines.*://g' \ + '-e s/^[0-9]\./ &/g' \ + '-e s/^[0-9][0-9]\./ &/g' \ + '-e s/of.*File/ /g' \ + "-e s/'//g" \ + '-e s/^.*\/usr\/.*$//g' \ + '-e s/^.*\.$//g' +} + +getFileNameRootFromErrorFile() { +sed '-e s/gc..:cannot open .* file//g' ${ERROR_FILE} +} + +writeEachNoTestCoverageFile() { +while read line +do + echo " 0.00% " ${line} +done +} + +createHtmlOutput() { + echo "" + echo "" + sed "-e s/.*% /
CoverageFile
&<\/td>/" \ + "-e s/[a-zA-Z0-9_]*\.[ch][a-z]*/&<\/a><\/td><\/tr>/" + echo "
" + sed "-e s/.*/&
/g" < ${TEST_RESULTS} +} + + +flattenGcovOutput | getRidOfCruft > ${TEMP_FILE1} +getFileNameRootFromErrorFile | writeEachNoTestCoverageFile > ${TEMP_FILE2} +cat ${TEMP_FILE1} ${TEMP_FILE2} | sort | uniq > ${OUTPUT_FILE} +createHtmlOutput < ${OUTPUT_FILE} > ${HTML_OUTPUT_FILE} +rm -f ${TEMP_FILE1} ${TEMP_FILE2} +erageFile" + sed "-e s/.*% /&<\/td>/" \ + "-e s/[a-zA-Z0-9_]*\.[ch][a-z]*/
&<\/a><\/td><\/tr>/" + echo "" + sed "-e s/.*/&
/g" < ${TEST_RESULTS \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/rakefile.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/rakefile.rb new file mode 100644 index 0000000..6181707 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/rakefile.rb @@ -0,0 +1,37 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require HERE + 'rakefile_helper' + +include RakefileHelpers + +# Load default configuration, for now +DEFAULT_CONFIG_FILE = 'gcc.yml' +configure_toolchain(DEFAULT_CONFIG_FILE) + +task :unit do + run_tests +end + +desc "Build and test Unity Framework" +task :all => [:clean, :unit] +task :default => [:clobber, :all] +task :ci => [:no_color, :default] +task :cruise => [:no_color, :default] + +desc "Load configuration" +task :config, :config_file do |t, args| + configure_toolchain(args[:config_file]) +end + +task :no_color do + $colour_output = false +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/rakefile_helper.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/rakefile_helper.rb new file mode 100644 index 0000000..a7f6a28 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/rakefile_helper.rb @@ -0,0 +1,178 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require 'yaml' +require 'fileutils' +require HERE+'../../auto/unity_test_summary' +require HERE+'../../auto/generate_test_runner' +require HERE+'../../auto/colour_reporter' + +module RakefileHelpers + + C_EXTENSION = '.c' + + def load_configuration(config_file) + unless ($configured) + $cfg_file = HERE+"../../targets/#{config_file}" unless (config_file =~ /[\\|\/]/) + $cfg = YAML.load(File.read($cfg_file)) + $colour_output = false unless $cfg['colour'] + $configured = true if (config_file != DEFAULT_CONFIG_FILE) + end + end + + def configure_clean + CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil? + end + + def configure_toolchain(config_file=DEFAULT_CONFIG_FILE) + config_file += '.yml' unless config_file =~ /\.yml$/ + config_file = config_file unless config_file =~ /[\\|\/]/ + load_configuration(config_file) + configure_clean + end + + def tackit(strings) + if strings.is_a?(Array) + result = "\"#{strings.join}\"" + else + result = strings + end + return result + end + + def squash(prefix, items) + result = '' + items.each { |item| result += " #{prefix}#{tackit(item)}" } + return result + end + + def build_compiler_fields + command = tackit($cfg['compiler']['path']) + if $cfg['compiler']['defines']['items'].nil? + defines = '' + else + defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items'] + ['UNITY_OUTPUT_CHAR=UnityOutputCharSpy_OutputChar']) + end + options = squash('', $cfg['compiler']['options']) + includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :defines => defines, :options => options, :includes => includes} + end + + def compile(file, defines=[]) + compiler = build_compiler_fields + unity_include = $cfg['compiler']['includes']['prefix']+'../../src' + cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{unity_include} #{file} " + + "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" + + "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" + execute(cmd_str) + end + + def build_linker_fields + command = tackit($cfg['linker']['path']) + if $cfg['linker']['options'].nil? + options = '' + else + options = squash('', $cfg['linker']['options']) + end + if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?) + includes = '' + else + includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) + end + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :options => options, :includes => includes} + end + + def link(exe_name, obj_list) + linker = build_linker_fields + cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + + (obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).join + + $cfg['linker']['bin_files']['prefix'] + ' ' + + $cfg['linker']['bin_files']['destination'] + + exe_name + $cfg['linker']['bin_files']['extension'] + execute(cmd_str) + end + + def build_simulator_fields + return nil if $cfg['simulator'].nil? + if $cfg['simulator']['path'].nil? + command = '' + else + command = (tackit($cfg['simulator']['path']) + ' ') + end + if $cfg['simulator']['pre_support'].nil? + pre_support = '' + else + pre_support = squash('', $cfg['simulator']['pre_support']) + end + if $cfg['simulator']['post_support'].nil? + post_support = '' + else + post_support = squash('', $cfg['simulator']['post_support']) + end + return {:command => command, :pre_support => pre_support, :post_support => post_support} + end + + def execute(command_string, verbose=true) + report command_string + output = `#{command_string}`.chomp + report(output) if (verbose && !output.nil? && (output.length > 0)) + if ($?.exitstatus != 0) + raise "Command failed. (Returned #{$?.exitstatus})" + end + return output + end + + def report_summary + summary = UnityTestSummary.new + summary.set_root_path(HERE) + results_glob = "#{$cfg['compiler']['build_path']}*.test*" + results_glob.gsub!(/\\/, '/') + results = Dir[results_glob] + summary.set_targets(results) + summary.run + end + + def run_tests + report 'Running Unity system tests...' + + # Tack on TEST define for compiling unit tests + load_configuration($cfg_file) + test_defines = ['TEST'] + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + + # Get a list of all source files needed + src_files = Dir[HERE+'src/*.c'] + src_files += Dir[HERE+'test/*.c'] + src_files << '../../src/Unity.c' + + # Build object files + src_files.each { |f| compile(f, test_defines) } + obj_list = src_files.map {|f| File.basename(f.ext($cfg['compiler']['object_files']['extension'])) } + + # Link the test executable + test_base = "framework_test" + link(test_base, obj_list) + + # Execute unit test and generate results file + simulator = build_simulator_fields + executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] + if simulator.nil? + cmd_str = executable + " -v -r" + else + cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" + end + output = execute(cmd_str) + test_results = $cfg['compiler']['build_path'] + test_base + if output.match(/OK$/m).nil? + test_results += '.testfail' + else + test_results += '.testpass' + end + File.open(test_results, 'w') { |f| f.print output } + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/readme.txt b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/readme.txt new file mode 100644 index 0000000..6b9a78c --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/readme.txt @@ -0,0 +1,9 @@ +Copyright (c) 2010 James Grenning and Contributed to Unity Project + +Unity Project - A Test Framework for C +Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +[Released under MIT License. Please refer to license.txt for details] + +This Framework is an optional add-on to Unity. By including unity_framework.h in place of unity.h, +you may now work with Unity in a manner similar to CppUTest. This framework adds the concepts of +test groups and gives finer control of your tests over the command line. \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c new file mode 100644 index 0000000..1ba3e9a --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c @@ -0,0 +1,381 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" +#include "unity_internals.h" +#include + +UNITY_FIXTURE_T UnityFixture; + +//If you decide to use the function pointer approach. +int (*outputChar)(int) = putchar; + +int verbose = 0; + +void setUp(void) { /*does nothing*/ } +void tearDown(void) { /*does nothing*/ } + +void announceTestRun(int runNumber) +{ + UnityPrint("Unity test run "); + UnityPrintNumber(runNumber+1); + UnityPrint(" of "); + UnityPrintNumber(UnityFixture.RepeatCount); + UNITY_OUTPUT_CHAR('\n'); +} + +int UnityMain(int argc, char* argv[], void (*runAllTests)()) +{ + int result = UnityGetCommandLineOptions(argc, argv); + int r; + if (result != 0) + return result; + + for (r = 0; r < UnityFixture.RepeatCount; r++) + { + announceTestRun(r); + UnityBegin(); + runAllTests(); + UNITY_OUTPUT_CHAR('\n'); + UnityEnd(); + } + + return UnityFailureCount(); +} + +static int selected(const char * filter, const char * name) +{ + if (filter == 0) + return 1; + return strstr(name, filter) ? 1 : 0; +} + +static int testSelected(const char* test) +{ + return selected(UnityFixture.NameFilter, test); +} + +static int groupSelected(const char* group) +{ + return selected(UnityFixture.GroupFilter, group); +} + +static void runTestCase() +{ + +} + +void UnityTestRunner(unityfunction* setup, + unityfunction* testBody, + unityfunction* teardown, + const char * printableName, + const char * group, + const char * name, + const char * file, int line) +{ + if (testSelected(name) && groupSelected(group)) + { + Unity.CurrentTestFailed = 0; + Unity.TestFile = file; + Unity.CurrentTestName = printableName; + Unity.CurrentTestLineNumber = line; + if (!UnityFixture.Verbose) + UNITY_OUTPUT_CHAR('.'); + else + UnityPrint(printableName); + + Unity.NumberOfTests++; + UnityMalloc_StartTest(); + UnityPointer_Init(); + + runTestCase(); + if (TEST_PROTECT()) + { + setup(); + testBody(); + } + if (TEST_PROTECT()) + { + teardown(); + } + if (TEST_PROTECT()) + { + UnityPointer_UndoAllSets(); + if (!Unity.CurrentTestFailed) + UnityMalloc_EndTest(); + UnityConcludeFixtureTest(); + } + else + { + //aborting - jwg - di i need these for the other TEST_PROTECTS? + } + } +} + +void UnityIgnoreTest() +{ + Unity.NumberOfTests++; + Unity.CurrentTestIgnored = 1; + UNITY_OUTPUT_CHAR('!'); +} + + +//------------------------------------------------- +//Malloc and free stuff +// +#define MALLOC_DONT_FAIL -1 +static int malloc_count; +static int malloc_fail_countdown = MALLOC_DONT_FAIL; + +void UnityMalloc_StartTest() +{ + malloc_count = 0; + malloc_fail_countdown = MALLOC_DONT_FAIL; +} + +void UnityMalloc_EndTest() +{ + malloc_fail_countdown = MALLOC_DONT_FAIL; + if (malloc_count != 0) + { + TEST_FAIL_MESSAGE("This test leaks!"); + } +} + +void UnityMalloc_MakeMallocFailAfterCount(int countdown) +{ + malloc_fail_countdown = countdown; +} + +#ifdef malloc +#undef malloc +#endif + +#ifdef free +#undef free +#endif + +#include +#include + +typedef struct GuardBytes +{ + int size; + char guard[sizeof(int)]; +} Guard; + + +static const char * end = "END"; + +void * unity_malloc(size_t size) +{ + char* mem; + Guard* guard; + + if (malloc_fail_countdown != MALLOC_DONT_FAIL) + { + if (malloc_fail_countdown == 0) + return 0; + malloc_fail_countdown--; + } + + malloc_count++; + + guard = (Guard*)malloc(size + sizeof(Guard) + 4); + guard->size = size; + mem = (char*)&(guard[1]); + memcpy(&mem[size], end, strlen(end) + 1); + + return (void*)mem; +} + +static int isOverrun(void * mem) +{ + Guard* guard = (Guard*)mem; + char* memAsChar = (char*)mem; + guard--; + + return strcmp(&memAsChar[guard->size], end) != 0; +} + +static void release_memory(void * mem) +{ + Guard* guard = (Guard*)mem; + guard--; + + malloc_count--; + free(guard); +} + +void unity_free(void * mem) +{ + int overrun = isOverrun(mem);//strcmp(&memAsChar[guard->size], end) != 0; + release_memory(mem); + if (overrun) + { + TEST_FAIL_MESSAGE("Buffer overrun detected during free()"); + } +} + +void* unity_calloc(size_t num, size_t size) +{ + void* mem = unity_malloc(num * size); + memset(mem, 0, num*size); + return mem; +} + +void* unity_realloc(void * oldMem, size_t size) +{ + Guard* guard = (Guard*)oldMem; +// char* memAsChar = (char*)oldMem; + void* newMem; + + if (oldMem == 0) + return unity_malloc(size); + + guard--; + if (isOverrun(oldMem)) + { + release_memory(oldMem); + TEST_FAIL_MESSAGE("Buffer overrun detected during realloc()"); + } + + if (size == 0) + { + release_memory(oldMem); + return 0; + } + + if (guard->size >= size) + return oldMem; + + newMem = unity_malloc(size); + memcpy(newMem, oldMem, size); + unity_free(oldMem); + return newMem; +} + + +//-------------------------------------------------------- +//Automatic pointer restoration functions +typedef struct _PointerPair +{ + struct _PointerPair * next; + void ** pointer; + void * old_value; +} PointerPair; + +enum {MAX_POINTERS=50}; +static PointerPair pointer_store[MAX_POINTERS]; +static int pointer_index = 0; + +void UnityPointer_Init() +{ + pointer_index = 0; +} + +void UnityPointer_Set(void ** pointer, void * newValue) +{ + if (pointer_index >= MAX_POINTERS) + TEST_FAIL_MESSAGE("Too many pointers set"); + + pointer_store[pointer_index].pointer = pointer; + pointer_store[pointer_index].old_value = *pointer; + *pointer = newValue; + pointer_index++; +} + +void UnityPointer_UndoAllSets() +{ + while (pointer_index > 0) + { + pointer_index--; + *(pointer_store[pointer_index].pointer) = + pointer_store[pointer_index].old_value; + + } +} + +int UnityFailureCount() +{ + return Unity.TestFailures; +} + +int UnityGetCommandLineOptions(int argc, char* argv[]) +{ + int i; + UnityFixture.Verbose = 0; + UnityFixture.GroupFilter = 0; + UnityFixture.NameFilter = 0; + UnityFixture.RepeatCount = 1; + + if (argc == 1) + return 0; + + for (i = 1; i < argc; ) + { + if (strcmp(argv[i], "-v") == 0) + { + UnityFixture.Verbose = 1; + i++; + } + else if (strcmp(argv[i], "-g") == 0) + { + i++; + if (i >= argc) + return 1; + UnityFixture.GroupFilter = argv[i]; + i++; + } + else if (strcmp(argv[i], "-n") == 0) + { + i++; + if (i >= argc) + return 1; + UnityFixture.NameFilter = argv[i]; + i++; + } + else if (strcmp(argv[i], "-r") == 0) + { + UnityFixture.RepeatCount = 2; + i++; + if (i < argc) + { + if (*(argv[i]) >= '0' && *(argv[i]) <= '9') + { + UnityFixture.RepeatCount = atoi(argv[i]); + i++; + } + } + } + } + return 0; +} + +void UnityConcludeFixtureTest() +{ + if (Unity.CurrentTestIgnored) + { + Unity.TestIgnores++; + } + else if (!Unity.CurrentTestFailed) + { + if (UnityFixture.Verbose) + { + UnityPrint(" PASS"); + UNITY_OUTPUT_CHAR('\n'); + } + } + else if (Unity.CurrentTestFailed) + { + Unity.TestFailures++; + } + + Unity.CurrentTestFailed = 0; + Unity.CurrentTestIgnored = 0; +} + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.h new file mode 100644 index 0000000..da1f871 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.h @@ -0,0 +1,81 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FIXTURE_H_ +#define UNITY_FIXTURE_H_ + +#include "unity.h" +#include "unity_internals.h" +#include "unity_fixture_malloc_overrides.h" +#include "unity_fixture_internals.h" + +int UnityMain(int argc, char* argv[], void (*runAllTests)()); + + +#define TEST_GROUP(group)\ + int TEST_GROUP_##group = 0 + +#define TEST_SETUP(group) void TEST_##group##_SETUP() + +#define TEST_TEAR_DOWN(group) void TEST_##group##_TEAR_DOWN() + + +#define TEST(group, name) \ + void TEST_##group##_##name##_();\ + void TEST_##group##_##name##_run()\ + {\ + UnityTestRunner(TEST_##group##_SETUP,\ + TEST_##group##_##name##_,\ + TEST_##group##_TEAR_DOWN,\ + "TEST(" #group ", " #name ")",\ + #group, #name,\ + __FILE__, __LINE__);\ + }\ + void TEST_##group##_##name##_() + +#define IGNORE_TEST(group, name) \ + void TEST_##group##_##name##_();\ + void TEST_##group##_##name##_run()\ + {\ + UnityIgnoreTest();\ + }\ + void TEST_##group##_##name##_() + +#define DECLARE_TEST_CASE(group, name) \ + void TEST_##group##_##name##_run() + +#define RUN_TEST_CASE(group, name) \ + DECLARE_TEST_CASE(group, name);\ + TEST_##group##_##name##_run(); + +//This goes at the bottom of each test file or in a separate c file +#define TEST_GROUP_RUNNER(group)\ + void TEST_##group##_GROUP_RUNNER_runAll();\ + void TEST_##group##_GROUP_RUNNER()\ + {\ + TEST_##group##_GROUP_RUNNER_runAll();\ + }\ + void TEST_##group##_GROUP_RUNNER_runAll() + +//Call this from main +#define RUN_TEST_GROUP(group)\ + void TEST_##group##_GROUP_RUNNER();\ + TEST_##group##_GROUP_RUNNER(); + +//CppUTest Compatibility Macros +#define UT_PTR_SET(ptr, newPointerValue) UnityPointer_Set((void**)&ptr, (void*)newPointerValue) +#define TEST_ASSERT_POINTERS_EQUAL(expected, actual) TEST_ASSERT_EQUAL_PTR(expected, actual) +#define TEST_ASSERT_BYTES_EQUAL(expected, actual) TEST_ASSERT_EQUAL_HEX8(0xff & (expected), 0xff & (actual)) +#define FAIL(message) TEST_FAIL((message)) +#define CHECK(condition) TEST_ASSERT_TRUE((condition)) +#define LONGS_EQUAL(expected, actual) TEST_ASSERT_EQUAL_INT((expected), (actual)) +#define STRCMP_EQUAL(expected, actual) TEST_ASSERT_EQUAL_STRING((expected), (actual)) +#define DOUBLES_EQUAL(expected, actual, delta) TEST_ASSERT_FLOAT_WITHIN(((expected), (actual), (delta)) + +void UnityMalloc_MakeMallocFailAfterCount(int count); + +#endif /* UNITY_FIXTURE_H_ */ diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h new file mode 100644 index 0000000..db23f67 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h @@ -0,0 +1,44 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FIXTURE_INTERNALS_H_ +#define UNITY_FIXTURE_INTERNALS_H_ + +typedef struct _UNITY_FIXTURE_T +{ + int Verbose; + unsigned int RepeatCount; + const char* NameFilter; + const char* GroupFilter; +} UNITY_FIXTURE_T; + +typedef void unityfunction(); +void UnityTestRunner(unityfunction * setup, + unityfunction * body, + unityfunction * teardown, + const char * printableName, + const char * group, + const char * name, + const char * file, int line); + +void UnityIgnoreTest(); +void UnityMalloc_StartTest(); +void UnityMalloc_EndTest(); +int UnityFailureCount(); +int UnityGetCommandLineOptions(int argc, char* argv[]); +void UnityConcludeFixtureTest(); + +void UnityPointer_Set(void ** ptr, void * newValue); +void UnityPointer_UndoAllSets(); +void UnityPointer_Init(); + +void UnityAssertEqualPointer(const void * expected, + const void * actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +#endif /* UNITY_FIXTURE_INTERNALS_H_ */ diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h new file mode 100644 index 0000000..38f8e34 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h @@ -0,0 +1,16 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FIXTURE_MALLOC_OVERRIDES_H_ +#define UNITY_FIXTURE_MALLOC_OVERRIDES_H_ + +#define malloc unity_malloc +#define calloc unity_calloc +#define realloc unity_realloc +#define free unity_free + +#endif /* UNITY_FIXTURE_MALLOC_OVERRIDES_H_ */ diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/main/AllTests.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/main/AllTests.c new file mode 100644 index 0000000..ccb775b --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/main/AllTests.c @@ -0,0 +1,21 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" + +static void runAllTests() +{ + RUN_TEST_GROUP(UnityFixture); + RUN_TEST_GROUP(UnityCommandOptions); + RUN_TEST_GROUP(LeakDetection) +} + +int main(int argc, char* argv[]) +{ + return UnityMain(argc, argv, runAllTests); +} + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/testunity_fixture.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/testunity_fixture.c new file mode 100644 index 0000000..de0c04c --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/testunity_fixture.c @@ -0,0 +1,39 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" + +static int data = -1; + +TEST_GROUP(mygroup); + +TEST_SETUP(mygroup) +{ + data = 0; +} + +TEST_TEAR_DOWN(mygroup) +{ + data = -1; +} + +TEST(mygroup, test1) +{ + TEST_ASSERT_EQUAL_INT(0, data); +} + +TEST(mygroup, test2) +{ + TEST_ASSERT_EQUAL_INT(0, data); + data = 5; +} + +TEST(mygroup, test3) +{ + data = 7; + TEST_ASSERT_EQUAL_INT(7, data); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c new file mode 100644 index 0000000..b8b4524 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c @@ -0,0 +1,321 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" +#include "unity_output_Spy.h" +#include +#include + +extern UNITY_FIXTURE_T UnityFixture; + +TEST_GROUP(UnityFixture); + +TEST_SETUP(UnityFixture) +{ +} + +TEST_TEAR_DOWN(UnityFixture) +{ +} + +int my_int; +int* pointer1 = 0; +int* pointer2 = (int*)2; +int* pointer3 = (int*)3; +int int1; +int int2; +int int3; +int int4; + +TEST(UnityFixture, PointerSetting) +{ + TEST_ASSERT_POINTERS_EQUAL(pointer1, 0); + UT_PTR_SET(pointer1, &int1); + UT_PTR_SET(pointer2, &int2); + UT_PTR_SET(pointer3, &int3); + TEST_ASSERT_POINTERS_EQUAL(pointer1, &int1); + TEST_ASSERT_POINTERS_EQUAL(pointer2, &int2); + TEST_ASSERT_POINTERS_EQUAL(pointer3, &int3); + UT_PTR_SET(pointer1, &int4); + UnityPointer_UndoAllSets(); + TEST_ASSERT_POINTERS_EQUAL(pointer1, 0); + TEST_ASSERT_POINTERS_EQUAL(pointer2, (int*)2); + TEST_ASSERT_POINTERS_EQUAL(pointer3, (int*)3); +} + +TEST(UnityFixture, ForceMallocFail) +{ + UnityMalloc_MakeMallocFailAfterCount(1); + void* m = malloc(10); + CHECK(m); + void* mfails = malloc(10); + TEST_ASSERT_POINTERS_EQUAL(0, mfails); + free(m); +} + +TEST(UnityFixture, ReallocSmallerIsUnchanged) +{ + void* m1 = malloc(10); + void* m2 = realloc(m1, 5); + TEST_ASSERT_POINTERS_EQUAL(m1, m2); + free(m2); +} + +TEST(UnityFixture, ReallocSameIsUnchanged) +{ + void* m1 = malloc(10); + void* m2 = realloc(m1, 10); + TEST_ASSERT_POINTERS_EQUAL(m1, m2); + free(m2); +} + +TEST(UnityFixture, ReallocLargerNeeded) +{ + void* m1 = malloc(10); + strcpy((char*)m1, "123456789"); + void* m2 = realloc(m1, 15); + CHECK(m1 != m2); + STRCMP_EQUAL("123456789", m2); + free(m2); +} + +TEST(UnityFixture, ReallocNullPointerIsLikeMalloc) +{ + void* m = realloc(0, 15); + CHECK(m != 0); + free(m); +} + +TEST(UnityFixture, ReallocSizeZeroFreesMemAndReturnsNullPointer) +{ + void* m1 = malloc(10); + void* m2 = realloc(m1, 0); + TEST_ASSERT_POINTERS_EQUAL(0, m2); +} + +TEST(UnityFixture, CallocFillsWithZero) +{ + void* m = calloc(3, sizeof(char)); + char* s = (char*)m; + TEST_ASSERT_BYTES_EQUAL(0, s[0]); + TEST_ASSERT_BYTES_EQUAL(0, s[1]); + TEST_ASSERT_BYTES_EQUAL(0, s[2]); + free(m); +} + +char *p1; +char *p2; + +TEST(UnityFixture, PointerSet) +{ + char c1; + char c2; + char newC1; + char newC2; + p1 = &c1; + p2 = &c2; + + UnityPointer_Init(10); + UT_PTR_SET(p1, &newC1); + UT_PTR_SET(p2, &newC2); + TEST_ASSERT_POINTERS_EQUAL(&newC1, p1); + TEST_ASSERT_POINTERS_EQUAL(&newC2, p2); + UnityPointer_UndoAllSets(); + TEST_ASSERT_POINTERS_EQUAL(&c1, p1); + TEST_ASSERT_POINTERS_EQUAL(&c2, p2); +} + +//------------------------------------------------------------ + +TEST_GROUP(UnityCommandOptions); + +int savedVerbose; +int savedRepeat; +const char* savedName; +const char* savedGroup; + +TEST_SETUP(UnityCommandOptions) +{ + savedVerbose = UnityFixture.Verbose; + savedRepeat = UnityFixture.RepeatCount; + savedName = UnityFixture.NameFilter; + savedGroup = UnityFixture.GroupFilter; +} + +TEST_TEAR_DOWN(UnityCommandOptions) +{ + UnityFixture.Verbose = savedVerbose; + UnityFixture.RepeatCount= savedRepeat; + UnityFixture.NameFilter = savedName; + UnityFixture.GroupFilter = savedGroup; +} + + +static char* noOptions[] = { + "testrunner.exe" +}; + +TEST(UnityCommandOptions, DefaultOptions) +{ + UnityGetCommandLineOptions(1, noOptions); + TEST_ASSERT_EQUAL(0, UnityFixture.Verbose); + TEST_ASSERT_POINTERS_EQUAL(0, UnityFixture.GroupFilter); + TEST_ASSERT_POINTERS_EQUAL(0, UnityFixture.NameFilter); + TEST_ASSERT_EQUAL(1, UnityFixture.RepeatCount); +} + +static char* verbose[] = { + "testrunner.exe", + "-v" +}; + +TEST(UnityCommandOptions, OptionVerbose) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(2, verbose)); + TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); +} + +static char* group[] = { + "testrunner.exe", + "-g", "groupname" +}; + +TEST(UnityCommandOptions, OptionSelectTestByGroup) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, group)); + STRCMP_EQUAL("groupname", UnityFixture.GroupFilter); +} + +static char* name[] = { + "testrunner.exe", + "-n", "testname" +}; + +TEST(UnityCommandOptions, OptionSelectTestByName) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, name)); + STRCMP_EQUAL("testname", UnityFixture.NameFilter); +} + +static char* repeat[] = { + "testrunner.exe", + "-r", "99" +}; + +TEST(UnityCommandOptions, OptionSelectRepeatTestsDefaultCount) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(2, repeat)); + TEST_ASSERT_EQUAL(2, UnityFixture.RepeatCount); +} + +TEST(UnityCommandOptions, OptionSelectRepeatTestsSpecificCount) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, repeat)); + TEST_ASSERT_EQUAL(99, UnityFixture.RepeatCount); +} + +static char* multiple[] = { + "testrunner.exe", + "-v", + "-g", "groupname", + "-n", "testname", + "-r", "98" +}; + +TEST(UnityCommandOptions, MultipleOptions) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(8, multiple)); + TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); + STRCMP_EQUAL("groupname", UnityFixture.GroupFilter); + STRCMP_EQUAL("testname", UnityFixture.NameFilter); + TEST_ASSERT_EQUAL(98, UnityFixture.RepeatCount); +} + +static char* dashRNotLast[] = { + "testrunner.exe", + "-v", + "-g", "gggg", + "-r", + "-n", "tttt", +}; + +TEST(UnityCommandOptions, MultipleOptionsDashRNotLastAndNoValueSpecified) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(7, dashRNotLast)); + TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); + STRCMP_EQUAL("gggg", UnityFixture.GroupFilter); + STRCMP_EQUAL("tttt", UnityFixture.NameFilter); + TEST_ASSERT_EQUAL(2, UnityFixture.RepeatCount); +} + + +//------------------------------------------------------------ + +TEST_GROUP(LeakDetection); + +TEST_SETUP(LeakDetection) +{ + UnityOutputCharSpy_Create(1000); +} + +TEST_TEAR_DOWN(LeakDetection) +{ + UnityOutputCharSpy_Destroy(); +} + +#define EXPECT_ABORT_BEGIN \ + { \ + jmp_buf TestAbortFrame; \ + memcpy(TestAbortFrame, Unity.AbortFrame, sizeof(jmp_buf)); \ + if (TEST_PROTECT()) \ + { + +#define EXPECT_ABORT_END \ + } \ + memcpy(Unity.AbortFrame, TestAbortFrame, sizeof(jmp_buf)); \ + } + +TEST(LeakDetection, DetectsLeak) +{ + void* m = malloc(10); + UnityOutputCharSpy_Enable(1); + EXPECT_ABORT_BEGIN + UnityMalloc_EndTest(); + EXPECT_ABORT_END + UnityOutputCharSpy_Enable(0); + CHECK(strstr(UnityOutputCharSpy_Get(), "This test leaks!")); + free(m); + Unity.CurrentTestFailed = 0; +} + +TEST(LeakDetection, BufferOverrunFoundDuringFree) +{ + void* m = malloc(10); + char* s = (char*)m; + s[10] = (char)0xFF; + UnityOutputCharSpy_Enable(1); + EXPECT_ABORT_BEGIN + free(m); + EXPECT_ABORT_END + UnityOutputCharSpy_Enable(0); + CHECK(strstr(UnityOutputCharSpy_Get(), "Buffer overrun detected during free()")); + Unity.CurrentTestFailed = 0; +} + +TEST(LeakDetection, BufferOverrunFoundDuringRealloc) +{ + void* m = malloc(10); + char* s = (char*)m; + s[10] = (char)0xFF; + UnityOutputCharSpy_Enable(1); + EXPECT_ABORT_BEGIN + m = realloc(m, 100); + EXPECT_ABORT_END + UnityOutputCharSpy_Enable(0); + CHECK(strstr(UnityOutputCharSpy_Get(), "Buffer overrun detected during realloc()")); + Unity.CurrentTestFailed = 0; +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c new file mode 100644 index 0000000..80fec09 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c @@ -0,0 +1,40 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" + +TEST_GROUP_RUNNER(UnityFixture) +{ + RUN_TEST_CASE(UnityFixture, PointerSetting); + RUN_TEST_CASE(UnityFixture, ForceMallocFail); + RUN_TEST_CASE(UnityFixture, ReallocSmallerIsUnchanged); + RUN_TEST_CASE(UnityFixture, ReallocSameIsUnchanged); + RUN_TEST_CASE(UnityFixture, ReallocLargerNeeded); + RUN_TEST_CASE(UnityFixture, ReallocNullPointerIsLikeMalloc); + RUN_TEST_CASE(UnityFixture, ReallocSizeZeroFreesMemAndReturnsNullPointer); + RUN_TEST_CASE(UnityFixture, CallocFillsWithZero); + RUN_TEST_CASE(UnityFixture, PointerSet); +} + +TEST_GROUP_RUNNER(UnityCommandOptions) +{ + RUN_TEST_CASE(UnityCommandOptions, DefaultOptions); + RUN_TEST_CASE(UnityCommandOptions, OptionVerbose); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectTestByGroup); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectTestByName); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectRepeatTestsDefaultCount); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectRepeatTestsSpecificCount); + RUN_TEST_CASE(UnityCommandOptions, MultipleOptions); + RUN_TEST_CASE(UnityCommandOptions, MultipleOptionsDashRNotLastAndNoValueSpecified); +} + +TEST_GROUP_RUNNER(LeakDetection) +{ + RUN_TEST_CASE(LeakDetection, DetectsLeak); + RUN_TEST_CASE(LeakDetection, BufferOverrunFoundDuringFree); + RUN_TEST_CASE(LeakDetection, BufferOverrunFoundDuringRealloc); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.c new file mode 100644 index 0000000..16faefa --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.c @@ -0,0 +1,56 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + + +#include "unity_output_Spy.h" +#include +#include +#include + +static int size; +static int count; +static char* buffer; +static int spy_enable; + +void UnityOutputCharSpy_Create(int s) +{ + size = s; + count = 0; + spy_enable = 0; + buffer = malloc(size); + memset(buffer, 0, size); +} + +void UnityOutputCharSpy_Destroy() +{ + size = 0; + free(buffer); +} + +int UnityOutputCharSpy_OutputChar(int c) +{ + if (spy_enable) + { + if (count < (size-1)) + buffer[count++] = c; + } + else + { + putchar(c); + } + return c; +} + +const char * UnityOutputCharSpy_Get() +{ + return buffer; +} + +void UnityOutputCharSpy_Enable(int enable) +{ + spy_enable = enable; +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.h new file mode 100644 index 0000000..7c1590e --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.h @@ -0,0 +1,17 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef D_unity_output_Spy_H +#define D_unity_output_Spy_H + +void UnityOutputCharSpy_Create(int s); +void UnityOutputCharSpy_Destroy(); +int UnityOutputCharSpy_OutputChar(int c); +const char * UnityOutputCharSpy_Get(); +void UnityOutputCharSpy_Enable(int enable); + +#endif diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/makefile b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/makefile new file mode 100644 index 0000000..8c8444b --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/makefile @@ -0,0 +1,35 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +C_COMPILER=gcc +TARGET_BASE = testunity +ifeq ($(OS),Windows_NT) + TARGET_EXTENSION=.exe +else + TARGET_EXTENSION=.out +endif +TARGET = $(TARGET_BASE)$(TARGET_EXTENSION) +OUT_FILE=-o $(TARGET) +SRC_FILES=src/unity.c test/testunity.c build/testunity_Runner.c +INC_DIRS=-Isrc +SYMBOLS=-DTEST -DUNITY_SUPPORT_64 + +ifeq ($(OS),Windows_NT) + CLEANUP = del /F /Q build\* && del /F /Q $(TARGET) +else + CLEANUP = rm -f build/*.o ; rm -f $(TARGET) +endif + +all: clean default + +default: + ruby auto/generate_test_runner.rb test/testunity.c build/testunity_Runner.c + $(C_COMPILER) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES) $(OUT_FILE) + $(TARGET) + +clean: + $(CLEANUP) + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/rakefile.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/rakefile.rb new file mode 100644 index 0000000..3ec5d5a --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/rakefile.rb @@ -0,0 +1,48 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require HERE + 'rakefile_helper' + +include RakefileHelpers + +# Load default configuration, for now +DEFAULT_CONFIG_FILE = 'gcc.yml' +configure_toolchain(DEFAULT_CONFIG_FILE) + +desc "Test unity with its own unit tests" +task :unit do + run_tests get_unit_test_files +end + +Rake::TestTask.new(:scripts) do |t| + t.pattern = 'test/test_*.rb' + t.verbose = true +end + +desc "Generate test summary" +task :summary do + report_summary +end + +desc "Build and test Unity" +task :all => [:clean, :scripts, :unit, :summary] +task :default => [:clobber, :all] +task :ci => [:no_color, :default] +task :cruise => [:no_color, :default] + +desc "Load configuration" +task :config, :config_file do |t, args| + configure_toolchain(args[:config_file]) +end + +task :no_color do + $colour_output = false +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/rakefile_helper.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/rakefile_helper.rb new file mode 100644 index 0000000..218fcaa --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/rakefile_helper.rb @@ -0,0 +1,243 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require 'yaml' +require 'fileutils' +require HERE+'auto/unity_test_summary' +require HERE+'auto/generate_test_runner' +require HERE+'auto/colour_reporter' + +module RakefileHelpers + + C_EXTENSION = '.c' + + def load_configuration(config_file) + unless ($configured) + $cfg_file = "targets/#{config_file}" unless (config_file =~ /[\\|\/]/) + $cfg = YAML.load(File.read($cfg_file)) + $colour_output = false unless $cfg['colour'] + $configured = true if (config_file != DEFAULT_CONFIG_FILE) + end + end + + def configure_clean + CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil? + end + + def configure_toolchain(config_file=DEFAULT_CONFIG_FILE) + config_file += '.yml' unless config_file =~ /\.yml$/ + config_file = config_file unless config_file =~ /[\\|\/]/ + load_configuration(config_file) + configure_clean + end + + def get_unit_test_files + path = $cfg['compiler']['unit_tests_path'] + 'test*' + C_EXTENSION + path.gsub!(/\\/, '/') + FileList.new(path) + end + + def get_local_include_dirs + include_dirs = $cfg['compiler']['includes']['items'].dup + include_dirs.delete_if {|dir| dir.is_a?(Array)} + return include_dirs + end + + def extract_headers(filename) + includes = [] + lines = File.readlines(filename) + lines.each do |line| + m = line.match(/^\s*#include\s+\"\s*(.+\.[hH])\s*\"/) + if not m.nil? + includes << m[1] + end + end + return includes + end + + def find_source_file(header, paths) + paths.each do |dir| + src_file = dir + header.ext(C_EXTENSION) + if (File.exists?(src_file)) + return src_file + end + end + return nil + end + + def tackit(strings) + if strings.is_a?(Array) + result = "\"#{strings.join}\"" + else + result = strings + end + return result + end + + def squash(prefix, items) + result = '' + items.each { |item| result += " #{prefix}#{tackit(item)}" } + return result + end + + def build_compiler_fields + command = tackit($cfg['compiler']['path']) + if $cfg['compiler']['defines']['items'].nil? + defines = '' + else + defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items']) + end + options = squash('', $cfg['compiler']['options']) + includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :defines => defines, :options => options, :includes => includes} + end + + def compile(file, defines=[]) + compiler = build_compiler_fields + cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{file} " + + "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" + + "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" + execute(cmd_str) + end + + def build_linker_fields + command = tackit($cfg['linker']['path']) + if $cfg['linker']['options'].nil? + options = '' + else + options = squash('', $cfg['linker']['options']) + end + if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?) + includes = '' + else + includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) + end + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :options => options, :includes => includes} + end + + def link(exe_name, obj_list) + linker = build_linker_fields + cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + + (obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).join + + $cfg['linker']['bin_files']['prefix'] + ' ' + + $cfg['linker']['bin_files']['destination'] + + exe_name + $cfg['linker']['bin_files']['extension'] + execute(cmd_str) + end + + def build_simulator_fields + return nil if $cfg['simulator'].nil? + if $cfg['simulator']['path'].nil? + command = '' + else + command = (tackit($cfg['simulator']['path']) + ' ') + end + if $cfg['simulator']['pre_support'].nil? + pre_support = '' + else + pre_support = squash('', $cfg['simulator']['pre_support']) + end + if $cfg['simulator']['post_support'].nil? + post_support = '' + else + post_support = squash('', $cfg['simulator']['post_support']) + end + return {:command => command, :pre_support => pre_support, :post_support => post_support} + end + + def execute(command_string, verbose=true) + report command_string + output = `#{command_string}`.chomp + report(output) if (verbose && !output.nil? && (output.length > 0)) + if $?.exitstatus != 0 + raise "Command failed. (Returned #{$?.exitstatus})" + end + return output + end + + def report_summary + summary = UnityTestSummary.new + summary.set_root_path(HERE) + results_glob = "#{$cfg['compiler']['build_path']}*.test*" + results_glob.gsub!(/\\/, '/') + results = Dir[results_glob] + summary.set_targets(results) + summary.run + end + + def run_tests(test_files) + report 'Running Unity system tests...' + + # Tack on TEST define for compiling unit tests + load_configuration($cfg_file) + test_defines = ['TEST'] + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + $cfg['compiler']['defines']['items'] << 'TEST' + + include_dirs = get_local_include_dirs + + # Build and execute each unit test + test_files.each do |test| + obj_list = [] + + # Detect dependencies and build required modules + extract_headers(test).each do |header| + # Compile corresponding source file if it exists + src_file = find_source_file(header, include_dirs) + if !src_file.nil? + compile(src_file, test_defines) + obj_list << header.ext($cfg['compiler']['object_files']['extension']) + end + end + + # Build the test runner (generate if configured to do so) + test_base = File.basename(test, C_EXTENSION) + + runner_name = test_base + '_Runner.c' + runner_path = '' + + if $cfg['compiler']['runner_path'].nil? + runner_path = $cfg['compiler']['build_path'] + runner_name + else + runner_path = $cfg['compiler']['runner_path'] + runner_name + end + + options = $cfg[:unity] + options[:use_param_tests] = (test =~ /parameterized/) ? true : false + UnityTestRunnerGenerator.new(options).run(test, runner_path) + + compile(runner_path, test_defines) + obj_list << runner_name.ext($cfg['compiler']['object_files']['extension']) + + # Build the test module + compile(test, test_defines) + obj_list << test_base.ext($cfg['compiler']['object_files']['extension']) + + # Link the test executable + link(test_base, obj_list) + + # Execute unit test and generate results file + simulator = build_simulator_fields + executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] + if simulator.nil? + cmd_str = executable + else + cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" + end + output = execute(cmd_str) + test_results = $cfg['compiler']['build_path'] + test_base + if output.match(/OK$/m).nil? + test_results += '.testfail' + else + test_results += '.testpass' + end + File.open(test_results, 'w') { |f| f.print output } + + end + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/release/build.info b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/release/build.info new file mode 100644 index 0000000..7871b21 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/release/build.info @@ -0,0 +1,2 @@ +118 + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/release/version.info b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/release/version.info new file mode 100644 index 0000000..0d71c08 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/release/version.info @@ -0,0 +1,2 @@ +2.0 + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/src/unity.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/src/unity.c new file mode 100644 index 0000000..d85b880 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/src/unity.c @@ -0,0 +1,855 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity.h" +#include +#include + +#define UNITY_FAIL_AND_BAIL { Unity.CurrentTestFailed = 1; UNITY_OUTPUT_CHAR('\n'); longjmp(Unity.AbortFrame, 1); } +#define UNITY_IGNORE_AND_BAIL { Unity.CurrentTestIgnored = 1; UNITY_OUTPUT_CHAR('\n'); longjmp(Unity.AbortFrame, 1); } +/// return prematurely if we are already in failure or ignore state +#define UNITY_SKIP_EXECUTION { if ((Unity.CurrentTestFailed != 0) || (Unity.CurrentTestIgnored != 0)) {return;} } +#define UNITY_PRINT_EOL { UNITY_OUTPUT_CHAR('\n'); } + +struct _Unity Unity = { 0 }; + +const char* UnityStrNull = "NULL"; +const char* UnityStrSpacer = ". "; +const char* UnityStrExpected = " Expected "; +const char* UnityStrWas = " Was "; +const char* UnityStrTo = " To "; +const char* UnityStrElement = " Element "; +const char* UnityStrMemory = " Memory Mismatch"; +const char* UnityStrDelta = " Values Not Within Delta "; +const char* UnityStrPointless= " You Asked Me To Compare Nothing, Which Was Pointless."; +const char* UnityStrNullPointerForExpected= " Expected pointer to be NULL"; +const char* UnityStrNullPointerForActual = " Actual pointer was NULL"; + +const _U_UINT UnitySizeMask[] = +{ + 255, + 65535, + 65535, + 4294967295, + 4294967295, + 4294967295, + 4294967295 +#ifdef UNITY_SUPPORT_64 + ,0xFFFFFFFFFFFFFFFF +#endif +}; + +//----------------------------------------------- +// Pretty Printers & Test Result Output Handlers +//----------------------------------------------- + +void UnityPrint(const char* string) +{ + const char* pch = string; + + if (pch != NULL) + { + while (*pch) + { + // printable characters plus CR & LF are printed + if ((*pch <= 126) && (*pch >= 32)) + { + UNITY_OUTPUT_CHAR(*pch); + } + //write escaped carriage returns + else if (*pch == 13) + { + UNITY_OUTPUT_CHAR('\\'); + UNITY_OUTPUT_CHAR('r'); + } + //write escaped line feeds + else if (*pch == 10) + { + UNITY_OUTPUT_CHAR('\\'); + UNITY_OUTPUT_CHAR('n'); + } + // unprintable characters are shown as codes + else + { + UNITY_OUTPUT_CHAR('\\'); + UnityPrintNumberHex((_U_SINT)*pch, 2); + } + pch++; + } + } +} + +//----------------------------------------------- +void UnityPrintNumberByStyle(const _U_SINT number, const UNITY_DISPLAY_STYLE_T style) +{ + if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT) + { + UnityPrintNumber(number); + } + else if ((style & UNITY_DISPLAY_RANGE_UINT) == UNITY_DISPLAY_RANGE_UINT) + { + UnityPrintNumberUnsigned( (_U_UINT)number & UnitySizeMask[((_U_UINT)style & (_U_UINT)0x0F) - 1] ); + } + else + { + UnityPrintNumberHex((_U_UINT)number, (style & 0x000F) << 1); + } +} + +//----------------------------------------------- +/// basically do an itoa using as little ram as possible +void UnityPrintNumber(const _U_SINT number_to_print) +{ + _U_SINT divisor = 1; + _U_SINT next_divisor; + _U_SINT number = number_to_print; + + if (number < 0) + { + UNITY_OUTPUT_CHAR('-'); + number = -number; + } + + // figure out initial divisor + while (number / divisor > 9) + { + next_divisor = divisor * 10; + if (next_divisor > divisor) + divisor = next_divisor; + else + break; + } + + // now mod and print, then divide divisor + do + { + UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10))); + divisor /= 10; + } + while (divisor > 0); +} + +//----------------------------------------------- +/// basically do an itoa using as little ram as possible +void UnityPrintNumberUnsigned(const _U_UINT number) +{ + _U_UINT divisor = 1; + _U_UINT next_divisor; + + // figure out initial divisor + while (number / divisor > 9) + { + next_divisor = divisor * 10; + if (next_divisor > divisor) + divisor = next_divisor; + else + break; + } + + // now mod and print, then divide divisor + do + { + UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10))); + divisor /= 10; + } + while (divisor > 0); +} + +//----------------------------------------------- +void UnityPrintNumberHex(const _U_UINT number, const char nibbles_to_print) +{ + _U_UINT nibble; + char nibbles = nibbles_to_print; + UNITY_OUTPUT_CHAR('0'); + UNITY_OUTPUT_CHAR('x'); + + while (nibbles > 0) + { + nibble = (number >> (--nibbles << 2)) & 0x0000000F; + if (nibble <= 9) + { + UNITY_OUTPUT_CHAR((char)('0' + nibble)); + } + else + { + UNITY_OUTPUT_CHAR((char)('A' - 10 + nibble)); + } + } +} + +//----------------------------------------------- +void UnityPrintMask(const _U_UINT mask, const _U_UINT number) +{ + _U_UINT current_bit = (_U_UINT)1 << (UNITY_INT_WIDTH - 1); + _US32 i; + + for (i = 0; i < UNITY_INT_WIDTH; i++) + { + if (current_bit & mask) + { + if (current_bit & number) + { + UNITY_OUTPUT_CHAR('1'); + } + else + { + UNITY_OUTPUT_CHAR('0'); + } + } + else + { + UNITY_OUTPUT_CHAR('X'); + } + current_bit = current_bit >> 1; + } +} + +//----------------------------------------------- +#ifdef UNITY_FLOAT_VERBOSE +void UnityPrintFloat(_UF number) +{ + char TempBuffer[32]; + sprintf(TempBuffer, "%.6f", number); + UnityPrint(TempBuffer); +} +#endif + +//----------------------------------------------- +void UnityTestResultsBegin(const char* file, const UNITY_LINE_TYPE line) +{ + UnityPrint(file); + UNITY_OUTPUT_CHAR(':'); + UnityPrintNumber(line); + UNITY_OUTPUT_CHAR(':'); + UnityPrint(Unity.CurrentTestName); + UNITY_OUTPUT_CHAR(':'); +} + +//----------------------------------------------- +void UnityTestResultsFailBegin(const UNITY_LINE_TYPE line) +{ + UnityTestResultsBegin(Unity.TestFile, line); + UnityPrint("FAIL:"); +} + +//----------------------------------------------- +void UnityConcludeTest(void) +{ + if (Unity.CurrentTestIgnored) + { + Unity.TestIgnores++; + } + else if (!Unity.CurrentTestFailed) + { + UnityTestResultsBegin(Unity.TestFile, Unity.CurrentTestLineNumber); + UnityPrint("PASS"); + UNITY_PRINT_EOL; + } + else + { + Unity.TestFailures++; + } + + Unity.CurrentTestFailed = 0; + Unity.CurrentTestIgnored = 0; +} + +//----------------------------------------------- +void UnityAddMsgIfSpecified(const char* msg) +{ + if (msg) + { + UnityPrint(UnityStrSpacer); + UnityPrint(msg); + } +} + +//----------------------------------------------- +void UnityPrintExpectedAndActualStrings(const char* expected, const char* actual) +{ + UnityPrint(UnityStrExpected); + if (expected != NULL) + { + UNITY_OUTPUT_CHAR('\''); + UnityPrint(expected); + UNITY_OUTPUT_CHAR('\''); + } + else + { + UnityPrint(UnityStrNull); + } + UnityPrint(UnityStrWas); + if (actual != NULL) + { + UNITY_OUTPUT_CHAR('\''); + UnityPrint(actual); + UNITY_OUTPUT_CHAR('\''); + } + else + { + UnityPrint(UnityStrNull); + } +} + +//----------------------------------------------- +// Assertion & Control Helpers +//----------------------------------------------- + +int UnityCheckArraysForNull(const void* expected, const void* actual, const UNITY_LINE_TYPE lineNumber, const char* msg) +{ + //return true if they are both NULL + if ((expected == NULL) && (actual == NULL)) + return 1; + + //throw error if just expected is NULL + if (expected == NULL) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrNullPointerForExpected); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + //throw error if just actual is NULL + if (actual == NULL) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrNullPointerForActual); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + //return false if neither is NULL + return 0; +} + +//----------------------------------------------- +// Assertion Functions +//----------------------------------------------- + +void UnityAssertBits(const _U_SINT mask, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + UNITY_SKIP_EXECUTION; + + if ((mask & expected) != (mask & actual)) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrExpected); + UnityPrintMask(mask, expected); + UnityPrint(UnityStrWas); + UnityPrintMask(mask, actual); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualNumber(const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style) +{ + UNITY_SKIP_EXECUTION; + + if (expected != actual) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(expected, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(actual, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualIntArray(const _U_SINT* expected, + const _U_SINT* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style) +{ + _UU32 elements = num_elements; + const _US8* ptr_exp = (_US8*)expected; + const _US8* ptr_act = (_US8*)actual; + + UNITY_SKIP_EXECUTION; + + if (elements == 0) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + switch(style) + { + case UNITY_DISPLAY_STYLE_HEX8: + case UNITY_DISPLAY_STYLE_INT8: + case UNITY_DISPLAY_STYLE_UINT8: + while (elements--) + { + if (*ptr_exp != *ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 1; + ptr_act += 1; + } + break; + case UNITY_DISPLAY_STYLE_HEX16: + case UNITY_DISPLAY_STYLE_INT16: + case UNITY_DISPLAY_STYLE_UINT16: + while (elements--) + { + if (*(_US16*)ptr_exp != *(_US16*)ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*(_US16*)ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*(_US16*)ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 2; + ptr_act += 2; + } + break; +#ifdef UNITY_SUPPORT_64 + case UNITY_DISPLAY_STYLE_HEX64: + case UNITY_DISPLAY_STYLE_INT64: + case UNITY_DISPLAY_STYLE_UINT64: + while (elements--) + { + if (*(_US64*)ptr_exp != *(_US64*)ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*(_US64*)ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*(_US64*)ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 8; + ptr_act += 8; + } + break; +#endif + default: + while (elements--) + { + if (*(_US32*)ptr_exp != *(_US32*)ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*(_US32*)ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*(_US32*)ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 4; + ptr_act += 4; + } + break; + } +} + +//----------------------------------------------- +#ifndef UNITY_EXCLUDE_FLOAT +void UnityAssertEqualFloatArray(const _UF* expected, + const _UF* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UU32 elements = num_elements; + const _UF* ptr_expected = expected; + const _UF* ptr_actual = actual; + _UF diff, tol; + + UNITY_SKIP_EXECUTION; + + if (elements == 0) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + while (elements--) + { + diff = *ptr_expected - *ptr_actual; + if (diff < 0.0) + diff = 0.0 - diff; + tol = UNITY_FLOAT_PRECISION * *ptr_expected; + if (tol < 0.0) + tol = 0.0 - tol; + if (diff > tol) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); +#ifdef UNITY_FLOAT_VERBOSE + UnityPrint(UnityStrExpected); + UnityPrintFloat(*ptr_expected); + UnityPrint(UnityStrWas); + UnityPrintFloat(*ptr_actual); +#else + UnityPrint(UnityStrDelta); +#endif + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_expected++; + ptr_actual++; + } +} + +//----------------------------------------------- +void UnityAssertFloatsWithin(const _UF delta, + const _UF expected, + const _UF actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UF diff = actual - expected; + _UF pos_delta = delta; + + UNITY_SKIP_EXECUTION; + + if (diff < 0) + { + diff = 0.0f - diff; + } + if (pos_delta < 0) + { + pos_delta = 0.0f - pos_delta; + } + + if (pos_delta < diff) + { + UnityTestResultsFailBegin(lineNumber); +#ifdef UNITY_FLOAT_VERBOSE + UnityPrint(UnityStrExpected); + UnityPrintFloat(expected); + UnityPrint(UnityStrWas); + UnityPrintFloat(actual); +#else + UnityPrint(UnityStrDelta); +#endif + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} +#endif + +//----------------------------------------------- +void UnityAssertNumbersWithin( const _U_SINT delta, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style) +{ + UNITY_SKIP_EXECUTION; + + if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT) + { + if (actual > expected) + Unity.CurrentTestFailed = ((actual - expected) > delta); + else + Unity.CurrentTestFailed = ((expected - actual) > delta); + } + else + { + if ((_U_UINT)actual > (_U_UINT)expected) + Unity.CurrentTestFailed = ((_U_UINT)(actual - expected) > (_U_UINT)delta); + else + Unity.CurrentTestFailed = ((_U_UINT)(expected - actual) > (_U_UINT)delta); + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrDelta); + UnityPrintNumberByStyle(delta, style); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(expected, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(actual, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualString(const char* expected, + const char* actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UU32 i; + + UNITY_SKIP_EXECUTION; + + // if both pointers not null compare the strings + if (expected && actual) + { + for (i = 0; expected[i] || actual[i]; i++) + { + if (expected[i] != actual[i]) + { + Unity.CurrentTestFailed = 1; + break; + } + } + } + else + { // handle case of one pointers being null (if both null, test should pass) + if (expected != actual) + { + Unity.CurrentTestFailed = 1; + } + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrintExpectedAndActualStrings(expected, actual); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualStringArray( const char** expected, + const char** actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UU32 i, j = 0; + + UNITY_SKIP_EXECUTION; + + // if no elements, it's an error + if (num_elements == 0) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + do + { + // if both pointers not null compare the strings + if (expected[j] && actual[j]) + { + for (i = 0; expected[j][i] || actual[j][i]; i++) + { + if (expected[j][i] != actual[j][i]) + { + Unity.CurrentTestFailed = 1; + break; + } + } + } + else + { // handle case of one pointers being null (if both null, test should pass) + if (expected[j] != actual[j]) + { + Unity.CurrentTestFailed = 1; + } + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + if (num_elements > 1) + { + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - j - 1), UNITY_DISPLAY_STYLE_UINT); + } + UnityPrintExpectedAndActualStrings((const char*)(expected[j]), (const char*)(actual[j])); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + } while (++j < num_elements); +} + +//----------------------------------------------- +void UnityAssertEqualMemory( const void* expected, + const void* actual, + _UU32 length, + _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + unsigned char* expected_ptr = (unsigned char*)expected; + unsigned char* actual_ptr = (unsigned char*)actual; + _UU32 elements = num_elements; + + UNITY_SKIP_EXECUTION; + + if ((elements == 0) || (length == 0)) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + while (elements--) + { + if (memcmp((const void*)expected_ptr, (const void*)actual_ptr, length) != 0) + { + Unity.CurrentTestFailed = 1; + break; + } + expected_ptr += length; + actual_ptr += length; + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + if (num_elements > 1) + { + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + } + UnityPrint(UnityStrMemory); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +// Control Functions +//----------------------------------------------- + +void UnityFail(const char* msg, const UNITY_LINE_TYPE line) +{ + UNITY_SKIP_EXECUTION; + + UnityTestResultsBegin(Unity.TestFile, line); + UnityPrint("FAIL"); + if (msg != NULL) + { + UNITY_OUTPUT_CHAR(':'); + if (msg[0] != ' ') + { + UNITY_OUTPUT_CHAR(' '); + } + UnityPrint(msg); + } + UNITY_FAIL_AND_BAIL; +} + +//----------------------------------------------- +void UnityIgnore(const char* msg, const UNITY_LINE_TYPE line) +{ + UNITY_SKIP_EXECUTION; + + UnityTestResultsBegin(Unity.TestFile, line); + UnityPrint("IGNORE"); + if (msg != NULL) + { + UNITY_OUTPUT_CHAR(':'); + UNITY_OUTPUT_CHAR(' '); + UnityPrint(msg); + } + UNITY_IGNORE_AND_BAIL; +} + +//----------------------------------------------- +void setUp(void); +void tearDown(void); +void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum) +{ + Unity.CurrentTestName = FuncName; + Unity.CurrentTestLineNumber = FuncLineNum; + Unity.NumberOfTests++; + if (TEST_PROTECT()) + { + setUp(); + Func(); + } + if (TEST_PROTECT() && !(Unity.CurrentTestIgnored)) + { + tearDown(); + } + UnityConcludeTest(); +} + +//----------------------------------------------- +void UnityBegin(void) +{ + Unity.NumberOfTests = 0; +} + +//----------------------------------------------- +int UnityEnd(void) +{ + UnityPrint("-----------------------"); + UNITY_PRINT_EOL; + UnityPrintNumber(Unity.NumberOfTests); + UnityPrint(" Tests "); + UnityPrintNumber(Unity.TestFailures); + UnityPrint(" Failures "); + UnityPrintNumber(Unity.TestIgnores); + UnityPrint(" Ignored"); + UNITY_PRINT_EOL; + if (Unity.TestFailures == 0U) + { + UnityPrint("OK"); + } + else + { + UnityPrint("FAIL"); + } + UNITY_PRINT_EOL; + return Unity.TestFailures; +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/src/unity.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/src/unity.h new file mode 100644 index 0000000..0b1b187 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/src/unity.h @@ -0,0 +1,213 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FRAMEWORK_H +#define UNITY_FRAMEWORK_H + +#define UNITY + +#include "unity_internals.h" + +//------------------------------------------------------- +// Configuration Options +//------------------------------------------------------- + +// Integers +// - Unity assumes 32 bit integers by default +// - If your compiler treats ints of a different size, define UNITY_INT_WIDTH + +// Floats +// - define UNITY_EXCLUDE_FLOAT to disallow floating point comparisons +// - define UNITY_FLOAT_PRECISION to specify the precision to use when doing TEST_ASSERT_EQUAL_FLOAT +// - define UNITY_FLOAT_TYPE to specify doubles instead of single precision floats +// - define UNITY_FLOAT_VERBOSE to print floating point values in errors (uses sprintf) + +// Output +// - by default, Unity prints to standard out with putchar. define UNITY_OUTPUT_CHAR(a) with a different function if desired + +// Optimization +// - by default, line numbers are stored in unsigned shorts. Define UNITY_LINE_TYPE with a different type if your files are huge +// - by default, test and failure counters are unsigned shorts. Define UNITY_COUNTER_TYPE with a different type if you want to save space or have more than 65535 Tests. + +// Test Cases +// - define UNITY_SUPPORT_TEST_CASES to include the TEST_CASE macro, though really it's mostly about the runner generator script + +// Parameterized Tests +// - you'll want to create a define of TEST_CASE(...) which basically evaluates to nothing + +//------------------------------------------------------- +// Test Running Macros +//------------------------------------------------------- + +#define TEST_PROTECT() (setjmp(Unity.AbortFrame) == 0) + +#define TEST_ABORT() {longjmp(Unity.AbortFrame, 1);} + +#ifndef RUN_TEST +#define RUN_TEST(func, line_num) UnityDefaultTestRun(func, #func, line_num) +#endif + +#define TEST_LINE_NUM (Unity.CurrentTestLineNumber) +#define TEST_IS_IGNORED (Unity.CurrentTestIgnored) + +//------------------------------------------------------- +// Basic Fail and Ignore +//------------------------------------------------------- + +#define TEST_FAIL_MESSAGE(message) UNITY_TEST_FAIL(__LINE__, message) +#define TEST_FAIL() UNITY_TEST_FAIL(__LINE__, NULL) +#define TEST_IGNORE_MESSAGE(message) UNITY_TEST_IGNORE(__LINE__, message) +#define TEST_IGNORE() UNITY_TEST_IGNORE(__LINE__, NULL) +#define TEST_ONLY() + +//------------------------------------------------------- +// Test Asserts (simple) +//------------------------------------------------------- + +//Boolean +#define TEST_ASSERT(condition) UNITY_TEST_ASSERT( (condition), __LINE__, " Expression Evaluated To FALSE") +#define TEST_ASSERT_TRUE(condition) UNITY_TEST_ASSERT( (condition), __LINE__, " Expected TRUE Was FALSE") +#define TEST_ASSERT_UNLESS(condition) UNITY_TEST_ASSERT( !(condition), __LINE__, " Expression Evaluated To TRUE") +#define TEST_ASSERT_FALSE(condition) UNITY_TEST_ASSERT( !(condition), __LINE__, " Expected FALSE Was TRUE") +#define TEST_ASSERT_NULL(pointer) UNITY_TEST_ASSERT_NULL( (pointer), __LINE__, " Expected NULL") +#define TEST_ASSERT_NOT_NULL(pointer) UNITY_TEST_ASSERT_NOT_NULL((pointer), __LINE__, " Expected Non-NULL") + +//Integers (of all sizes) +#define TEST_ASSERT_EQUAL_INT(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT8(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT8((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT16(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT16((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT32(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT32((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT64(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT64((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_NOT_EQUAL(expected, actual) UNITY_TEST_ASSERT(((expected) != (actual)), __LINE__, " Expected Not-Equal") +#define TEST_ASSERT_EQUAL_UINT(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT8(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT8( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT16(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT16( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT32(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT32( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT64(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT64( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX8(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX8( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX16(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX16((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX32(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX64(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX64((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_BITS(mask, expected, actual) UNITY_TEST_ASSERT_BITS((mask), (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_BITS_HIGH(mask, actual) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(-1), (actual), __LINE__, NULL) +#define TEST_ASSERT_BITS_LOW(mask, actual) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(0), (actual), __LINE__, NULL) +#define TEST_ASSERT_BIT_HIGH(bit, actual) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(-1), (actual), __LINE__, NULL) +#define TEST_ASSERT_BIT_LOW(bit, actual) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(0), (actual), __LINE__, NULL) + +//Integer Ranges (of all sizes) +#define TEST_ASSERT_INT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_UINT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX8_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX16_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX32_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX64_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, __LINE__, NULL) + +//Structs and Strings +#define TEST_ASSERT_EQUAL_PTR(expected, actual) UNITY_TEST_ASSERT_EQUAL_PTR((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_STRING(expected, actual) UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_MEMORY(expected, actual, len) UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, __LINE__, NULL) + +//Arrays +#define TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements) UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, __LINE__, NULL) + +//Floating Point (If Enabled) +#define TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_FLOAT(expected, actual) UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, __LINE__, NULL) + +//------------------------------------------------------- +// Test Asserts (with additional messages) +//------------------------------------------------------- + +//Boolean +#define TEST_ASSERT_MESSAGE(condition, message) UNITY_TEST_ASSERT( (condition), __LINE__, message) +#define TEST_ASSERT_TRUE_MESSAGE(condition, message) UNITY_TEST_ASSERT( (condition), __LINE__, message) +#define TEST_ASSERT_UNLESS_MESSAGE(condition, message) UNITY_TEST_ASSERT( !(condition), __LINE__, message) +#define TEST_ASSERT_FALSE_MESSAGE(condition, message) UNITY_TEST_ASSERT( !(condition), __LINE__, message) +#define TEST_ASSERT_NULL_MESSAGE(pointer, message) UNITY_TEST_ASSERT_NULL( (pointer), __LINE__, message) +#define TEST_ASSERT_NOT_NULL_MESSAGE(pointer, message) UNITY_TEST_ASSERT_NOT_NULL((pointer), __LINE__, message) + +//Integers (of all sizes) +#define TEST_ASSERT_EQUAL_INT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT8((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT16((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT32((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT64((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, message) +#define TEST_ASSERT_NOT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT(((expected) != (actual)), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT8( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT16( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT32( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT64( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX8( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX16((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX64((expected), (actual), __LINE__, message) +#define TEST_ASSERT_BITS_MESSAGE(mask, expected, actual, message) UNITY_TEST_ASSERT_BITS((mask), (expected), (actual), __LINE__, message) +#define TEST_ASSERT_BITS_HIGH_MESSAGE(mask, actual, message) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(-1), (actual), __LINE__, message) +#define TEST_ASSERT_BITS_LOW_MESSAGE(mask, actual, message) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(0), (actual), __LINE__, message) +#define TEST_ASSERT_BIT_HIGH_MESSAGE(bit, actual, message) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(-1), (actual), __LINE__, message) +#define TEST_ASSERT_BIT_LOW_MESSAGE(bit, actual, message) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(0), (actual), __LINE__, message) + +//Integer Ranges (of all sizes) +#define TEST_ASSERT_INT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_UINT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX8_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX16_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX32_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX64_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, __LINE__, message) + +//Structs and Strings +#define TEST_ASSERT_EQUAL_PTR_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_PTR(expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_STRING_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_MEMORY_MESSAGE(expected, actual, len, message) UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, __LINE__, message) + +//Arrays +#define TEST_ASSERT_EQUAL_INT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_STRING_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_MEMORY_ARRAY_MESSAGE(expected, actual, len, num_elements, message) UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, __LINE__, message) + +//Floating Point (If Enabled) +#define TEST_ASSERT_FLOAT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_FLOAT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_FLOAT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, __LINE__, message) +#endif diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/src/unity_internals.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/src/unity_internals.h new file mode 100644 index 0000000..29c9d1d --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/src/unity_internals.h @@ -0,0 +1,355 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_INTERNALS_H +#define UNITY_INTERNALS_H + +#include +#include + +//------------------------------------------------------- +// Int Support +//------------------------------------------------------- + +#ifndef UNITY_INT_WIDTH +#define UNITY_INT_WIDTH (32) +#endif + +#ifndef UNITY_LONG_WIDTH +#define UNITY_LONG_WIDTH (32) +#endif + +#if (UNITY_INT_WIDTH == 32) + typedef unsigned char _UU8; + typedef unsigned short _UU16; + typedef unsigned int _UU32; + typedef signed char _US8; + typedef signed short _US16; + typedef signed int _US32; +#elif (UNITY_INT_WIDTH == 16) + typedef unsigned char _UU8; + typedef unsigned int _UU16; + typedef unsigned long _UU32; + typedef signed char _US8; + typedef signed int _US16; + typedef signed long _US32; +#else + #error Invalid UNITY_INT_WIDTH specified! (16 or 32 are supported) +#endif + +//------------------------------------------------------- +// 64-bit Support +//------------------------------------------------------- + +#ifndef UNITY_SUPPORT_64 + +//No 64-bit Support +typedef _UU32 _U_UINT; +typedef _US32 _U_SINT; + +#else + +//64-bit Support +#if (UNITY_LONG_WIDTH == 32) + typedef unsigned long long _UU64; + typedef signed long long _US64; +#elif (UNITY_LONG_WIDTH == 64) + typedef unsigned long _UU64; + typedef signed long _US64; +#else + #error Invalid UNITY_LONG_WIDTH specified! (32 or 64 are supported) +#endif +typedef _UU64 _U_UINT; +typedef _US64 _U_SINT; + +#endif + +//------------------------------------------------------- +// Pointer Support +//------------------------------------------------------- + +#ifndef UNITY_POINTER_WIDTH +#define UNITY_POINTER_WIDTH (32) +#endif + +#if (UNITY_POINTER_WIDTH == 32) + typedef _UU32 _UP; +#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX32 +#elif (UNITY_POINTER_WIDTH == 64) + typedef _UU64 _UP; +#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX64 +#elif (UNITY_POINTER_WIDTH == 16) + typedef _UU16 _UP; +#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX16 +#else + #error Invalid UNITY_POINTER_WIDTH specified! (16, 32 or 64 are supported) +#endif + +//------------------------------------------------------- +// Float Support +//------------------------------------------------------- + +#ifdef UNITY_EXCLUDE_FLOAT + +//No Floating Point Support +#undef UNITY_FLOAT_PRECISION +#undef UNITY_FLOAT_TYPE +#undef UNITY_FLOAT_VERBOSE + +#else + +//Floating Point Support +#ifndef UNITY_FLOAT_PRECISION +#define UNITY_FLOAT_PRECISION (0.00001f) +#endif +#ifndef UNITY_FLOAT_TYPE +#define UNITY_FLOAT_TYPE float +#endif +typedef UNITY_FLOAT_TYPE _UF; + +#endif + +//------------------------------------------------------- +// Output Method +//------------------------------------------------------- + +#ifndef UNITY_OUTPUT_CHAR +//Default to using putchar, which is defined in stdio.h above +#define UNITY_OUTPUT_CHAR(a) putchar(a) +#else +//If defined as something else, make sure we declare it here so it's ready for use +extern int UNITY_OUTPUT_CHAR(int); +#endif + +//------------------------------------------------------- +// Footprint +//------------------------------------------------------- + +#ifndef UNITY_LINE_TYPE +#define UNITY_LINE_TYPE unsigned short +#endif + +#ifndef UNITY_COUNTER_TYPE +#define UNITY_COUNTER_TYPE unsigned short +#endif + +//------------------------------------------------------- +// Internal Structs Needed +//------------------------------------------------------- + +typedef void (*UnityTestFunction)(void); + +#define UNITY_DISPLAY_RANGE_INT (0x10) +#define UNITY_DISPLAY_RANGE_UINT (0x20) +#define UNITY_DISPLAY_RANGE_HEX (0x40) +#define UNITY_DISPLAY_RANGE_AUTO (0x80) + +typedef enum +{ + UNITY_DISPLAY_STYLE_INT = 4 + UNITY_DISPLAY_RANGE_INT + UNITY_DISPLAY_RANGE_AUTO, + UNITY_DISPLAY_STYLE_INT8 = 1 + UNITY_DISPLAY_RANGE_INT, + UNITY_DISPLAY_STYLE_INT16 = 2 + UNITY_DISPLAY_RANGE_INT, + UNITY_DISPLAY_STYLE_INT32 = 4 + UNITY_DISPLAY_RANGE_INT, +#ifdef UNITY_SUPPORT_64 + UNITY_DISPLAY_STYLE_INT64 = 8 + UNITY_DISPLAY_RANGE_INT, +#endif + UNITY_DISPLAY_STYLE_UINT = 4 + UNITY_DISPLAY_RANGE_UINT + UNITY_DISPLAY_RANGE_AUTO, + UNITY_DISPLAY_STYLE_UINT8 = 1 + UNITY_DISPLAY_RANGE_UINT, + UNITY_DISPLAY_STYLE_UINT16 = 2 + UNITY_DISPLAY_RANGE_UINT, + UNITY_DISPLAY_STYLE_UINT32 = 4 + UNITY_DISPLAY_RANGE_UINT, +#ifdef UNITY_SUPPORT_64 + UNITY_DISPLAY_STYLE_UINT64 = 8 + UNITY_DISPLAY_RANGE_UINT, +#endif + UNITY_DISPLAY_STYLE_HEX8 = 1 + UNITY_DISPLAY_RANGE_HEX, + UNITY_DISPLAY_STYLE_HEX16 = 2 + UNITY_DISPLAY_RANGE_HEX, + UNITY_DISPLAY_STYLE_HEX32 = 4 + UNITY_DISPLAY_RANGE_HEX, +#ifdef UNITY_SUPPORT_64 + UNITY_DISPLAY_STYLE_HEX64 = 8 + UNITY_DISPLAY_RANGE_HEX, +#endif +} UNITY_DISPLAY_STYLE_T; + +struct _Unity +{ + const char* TestFile; + const char* CurrentTestName; + _UU32 CurrentTestLineNumber; + UNITY_COUNTER_TYPE NumberOfTests; + UNITY_COUNTER_TYPE TestFailures; + UNITY_COUNTER_TYPE TestIgnores; + UNITY_COUNTER_TYPE CurrentTestFailed; + UNITY_COUNTER_TYPE CurrentTestIgnored; + jmp_buf AbortFrame; +}; + +extern struct _Unity Unity; + +//------------------------------------------------------- +// Test Suite Management +//------------------------------------------------------- + +void UnityBegin(void); +int UnityEnd(void); +void UnityConcludeTest(void); +void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum); + +//------------------------------------------------------- +// Test Output +//------------------------------------------------------- + +void UnityPrint(const char* string); +void UnityPrintMask(const _U_UINT mask, const _U_UINT number); +void UnityPrintNumberByStyle(const _U_SINT number, const UNITY_DISPLAY_STYLE_T style); +void UnityPrintNumber(const _U_SINT number); +void UnityPrintNumberUnsigned(const _U_UINT number); +void UnityPrintNumberHex(const _U_UINT number, const char nibbles); + +#ifdef UNITY_FLOAT_VERBOSE +void UnityPrintFloat(const _UF number); +#endif + +//------------------------------------------------------- +// Test Assertion Fuctions +//------------------------------------------------------- +// Use the macros below this section instead of calling +// these directly. The macros have a consistent naming +// convention and will pull in file and line information +// for you. + +void UnityAssertEqualNumber(const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style); + +void UnityAssertEqualIntArray(const _U_SINT* expected, + const _U_SINT* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style); + +void UnityAssertBits(const _U_SINT mask, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualString(const char* expected, + const char* actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualStringArray( const char** expected, + const char** actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualMemory( const void* expected, + const void* actual, + const _UU32 length, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertNumbersWithin(const _U_SINT delta, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style); + +void UnityFail(const char* message, const UNITY_LINE_TYPE line); + +void UnityIgnore(const char* message, const UNITY_LINE_TYPE line); + +#ifndef UNITY_EXCLUDE_FLOAT +void UnityAssertFloatsWithin(const _UF delta, + const _UF expected, + const _UF actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualFloatArray(const _UF* expected, + const _UF* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber); +#endif + +//------------------------------------------------------- +// Basic Fail and Ignore +//------------------------------------------------------- + +#define UNITY_TEST_FAIL(line, message) UnityFail( (message), (UNITY_LINE_TYPE)line); +#define UNITY_TEST_IGNORE(line, message) UnityIgnore( (message), (UNITY_LINE_TYPE)line); + +//------------------------------------------------------- +// Test Asserts +//------------------------------------------------------- + +#define UNITY_TEST_ASSERT(condition, line, message) if (condition) {} else {UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, message);} +#define UNITY_TEST_ASSERT_NULL(pointer, line, message) UNITY_TEST_ASSERT(((pointer) == NULL), (UNITY_LINE_TYPE)line, message) +#define UNITY_TEST_ASSERT_NOT_NULL(pointer, line, message) UNITY_TEST_ASSERT(((pointer) != NULL), (UNITY_LINE_TYPE)line, message) + +#define UNITY_TEST_ASSERT_EQUAL_INT(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_UINT(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_HEX8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX8) +#define UNITY_TEST_ASSERT_EQUAL_HEX16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX16) +#define UNITY_TEST_ASSERT_EQUAL_HEX32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX32) +#define UNITY_TEST_ASSERT_BITS(mask, expected, actual, line, message) UnityAssertBits((_U_SINT)(mask), (_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line) + +#define UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX8) +#define UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX16) +#define UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX32) +#define UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64) + +#define UNITY_TEST_ASSERT_EQUAL_PTR(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(_UP)(expected), (_U_SINT)(_UP)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_POINTER) +#define UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, line, message) UnityAssertEqualString((const char*)(expected), (const char*)(actual), (message), (UNITY_LINE_TYPE)line) +#define UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, line, message) UnityAssertEqualMemory((void*)(expected), (void*)(actual), (_UU32)(len), 1, (message), (UNITY_LINE_TYPE)line) + +#define UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT8) +#define UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT16) +#define UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT32) +#define UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT8) +#define UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT16) +#define UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT32) +#define UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX8) +#define UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX16) +#define UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX32) +#define UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualStringArray((const char**)(expected), (const char**)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line) +#define UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, line, message) UnityAssertEqualMemory((void*)(expected), (void*)(actual), (_UU32)(len), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line) + +#ifdef UNITY_SUPPORT_64 +#define UNITY_TEST_ASSERT_EQUAL_INT64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT64) +#define UNITY_TEST_ASSERT_EQUAL_UINT64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT64) +#define UNITY_TEST_ASSERT_EQUAL_HEX64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64) +#define UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT64) +#define UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT64) +#define UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64) +#endif + +#ifdef UNITY_EXCLUDE_FLOAT +#define UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled") +#define UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled") +#define UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled") +#else +#define UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, line, message) UnityAssertFloatsWithin((_UF)(delta), (_UF)(expected), (_UF)(actual), (message), (UNITY_LINE_TYPE)line) +#define UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, line, message) UNITY_TEST_ASSERT_FLOAT_WITHIN((_UF)(expected) * (_UF)UNITY_FLOAT_PRECISION, (_UF)expected, (_UF)actual, (UNITY_LINE_TYPE)line, message) +#define UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualFloatArray((_UF*)(expected), (_UF*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line) +#endif + +#endif diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/gcc.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/gcc.yml new file mode 100644 index 0000000..0f18c6c --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/gcc.yml @@ -0,0 +1,42 @@ +compiler: + path: gcc + source_path: 'src/' + unit_tests_path: &unit_tests_path 'test/' + build_path: &build_path 'build/' + options: + - '-c' + - '-Wall' + - '-Wno-address' + - '-std=c99' + - '-pedantic' + includes: + prefix: '-I' + items: + - 'src/' + - '../src/' + - *unit_tests_path + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - UNITY_SUPPORT_TEST_CASES + object_files: + prefix: '-o' + extension: '.o' + destination: *build_path +linker: + path: gcc + options: + - -lm + includes: + prefix: '-I' + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.exe' + destination: *build_path +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/gcc_64.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/gcc_64.yml new file mode 100644 index 0000000..97cb958 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/gcc_64.yml @@ -0,0 +1,43 @@ +compiler: + path: gcc + source_path: 'src/' + unit_tests_path: &unit_tests_path 'test/' + build_path: &build_path 'build/' + options: + - '-c' + - '-Wall' + - '-Wno-address' + - '-std=c99' + - '-pedantic' + includes: + prefix: '-I' + items: + - 'src/' + - '../src/' + - *unit_tests_path + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - UNITY_SUPPORT_TEST_CASES + - 'UNITY_POINTER_WIDTH=64' + object_files: + prefix: '-o' + extension: '.o' + destination: *build_path +linker: + path: gcc + options: + - -lm + includes: + prefix: '-I' + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.exe' + destination: *build_path +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/hitech_picc18.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/hitech_picc18.yml new file mode 100644 index 0000000..210d944 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/hitech_picc18.yml @@ -0,0 +1,101 @@ +# rumor has it that this yaml file works for the standard edition of the +# hitech PICC18 compiler, but not the pro version. +# +compiler: + path: cd build && picc18 + source_path: 'c:\Projects\NexGen\Prototypes\CMockTest\src\' + unit_tests_path: &unit_tests_path 'c:\Projects\NexGen\Prototypes\CMockTest\test\' + build_path: &build_path 'c:\Projects\NexGen\Prototypes\CMockTest\build\' + options: + - --chip=18F87J10 + - --ide=hitide + - --q #quiet please + - --asmlist + - --codeoffset=0 + - --emi=wordwrite # External memory interface protocol + - --warn=0 # allow all normal warning messages + - --errors=10 # Number of errors before aborting compile + - --char=unsigned + - -Bl # Large memory model + - -G # generate symbol file + - --cp=16 # 16-bit pointers + - --double=24 + - -N255 # 255-char symbol names + - --opt=none # Do not use any compiler optimziations + - -c # compile only + - -M + includes: + prefix: '-I' + items: + - 'c:/Projects/NexGen/Prototypes/CMockTest/src/' + - 'c:/Projects/NexGen/Prototypes/CMockTest/mocks/' + - 'c:/CMock/src/' + - 'c:/CMock/examples/src/' + - 'c:/CMock/vendor/unity/src/' + - 'c:/CMock/vendor/unity/examples/helper/' + - *unit_tests_path + defines: + prefix: '-D' + items: + - UNITY_INT_WIDTH=16 + - UNITY_POINTER_WIDTH=16 + - CMOCK_MEM_STATIC + - CMOCK_MEM_SIZE=3000 + - UNITY_SUPPORT_TEST_CASES + - _PICC18 + object_files: + # prefix: '-O' # Hi-Tech doesn't want a prefix. They key off of filename .extensions, instead + extension: '.obj' + destination: *build_path + +linker: + path: cd build && picc18 + options: + - --chip=18F87J10 + - --ide=hitide + - --cp=24 # 24-bit pointers. Is this needed for linker?? + - --double=24 # Is this needed for linker?? + - -Lw # Scan the pic87*w.lib in the lib/ of the compiler installation directory + - --summary=mem,file # info listing + - --summary=+psect + - --summary=+hex + - --output=+intel + - --output=+mcof + - --runtime=+init # Directs startup code to copy idata, ibigdata and ifardata psects from ROM to RAM. + - --runtime=+clear # Directs startup code to clear bss, bigbss, rbss and farbss psects + - --runtime=+clib # link in the c-runtime + - --runtime=+keep # Keep the generated startup src after its obj is linked + - -G # Generate src-level symbol file + - -MIWasTheLastToBuild.map + - --warn=0 # allow all normal warning messages + - -Bl # Large memory model (probably not needed for linking) + includes: + prefix: '-I' + object_files: + path: *build_path + extension: '.obj' + bin_files: + prefix: '-O' + extension: '.hex' + destination: *build_path + +simulator: + path: + pre_support: + - 'java -client -jar ' # note space + - ['C:\Program Files\HI-TECH Software\HI-TIDE\3.15\lib\', 'simpic18.jar'] + - 18F87J10 + post_support: + +:cmock: + :plugins: [] + :includes: + - Types.h + :suite_teardown: | + if (num_failures) + _FAILED_TEST(); + else + _PASSED_TESTS(); + return 0; + +colour: true \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_arm_v4.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_arm_v4.yml new file mode 100644 index 0000000..c2e7f18 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_arm_v4.yml @@ -0,0 +1,89 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 4.0 Kickstart\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\lib\dl4tptinl8n.h'] + - -z3 + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian little + - --cpu ARM7TDMI + - --stack_align 4 + - --interwork + - -e + - --silent + - --warnings_are_errors + - --fpu None + - --diag_suppress Pa050 + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'common\bin\xlink.exe'] + options: + - -rt + - [*tools_root, 'arm\lib\dl4tptinl8n.r79'] + - -D_L_EXTMEM_START=0 + - -D_L_EXTMEM_SIZE=0 + - -D_L_HEAP_SIZE=120 + - -D_L_STACK_SIZE=32 + - -e_small_write=_formatted_write + - -s + - __program_start + - -f + - [*tools_root, '\arm\config\lnkarm.xcl'] + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\config\'] + - [*tools_root, 'arm\lib\'] + object_files: + path: *build_path + extension: '.r79' + bin_files: + prefix: '-o' + extension: '.d79' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\ioat91sam7X256.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_arm_v5.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_arm_v5.yml new file mode 100644 index 0000000..0549d8e --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_arm_v5.yml @@ -0,0 +1,79 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian=little + - --cpu=ARM7TDMI + - --interwork + - --warnings_are_errors + - --fpu=None + - --diag_suppress=Pa050 + - --diag_suppress=Pe111 + - -e + - -On + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\debugger\atmel\ioat91sam7X256.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_arm_v5_3.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_arm_v5_3.yml new file mode 100644 index 0000000..0549d8e --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_arm_v5_3.yml @@ -0,0 +1,79 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian=little + - --cpu=ARM7TDMI + - --interwork + - --warnings_are_errors + - --fpu=None + - --diag_suppress=Pa050 + - --diag_suppress=Pe111 + - -e + - -On + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\debugger\atmel\ioat91sam7X256.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml new file mode 100644 index 0000000..eb0785c --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml @@ -0,0 +1,93 @@ +#Default tool path for IAR 5.4 on Windows XP 64bit +tools_root: &tools_root 'C:\Program Files (x86)\IAR Systems\Embedded Workbench 5.4 Kickstart\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --diag_suppress=Pa050 + #- --diag_suppress=Pe111 + - --debug + - --endian=little + - --cpu=Cortex-M3 + - --no_path_in_file_macros + - -e + - --fpu=None + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + #- --preinclude --preinclude C:\Vss\T2 Working\common\system.h + - --interwork + - --warnings_are_errors +# - Ohz + - -Oh +# - --no_cse +# - --no_unroll +# - --no_inline +# - --no_code_motion +# - --no_tbaa +# - --no_clustering +# - --no_scheduling + + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - ewarm + - PART_LM3S9B92 + - TARGET_IS_TEMPEST_RB1 + - USE_ROM_DRIVERS + - UART_BUFFERED + - UNITY_SUPPORT_64 + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic.icf'] +# - ['C:\Temp\lm3s9b92.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + #- --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim2.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - --endian=little + - --cpu=Cortex-M3 + - --fpu=None + - -p + - [*tools_root, 'arm\config\debugger\TexasInstruments\iolm3sxxxx.ddf'] + - --semihosting + - --device=LM3SxBxx + #- -d + #- sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_cortexm3_v5.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_cortexm3_v5.yml new file mode 100644 index 0000000..cf0d1d0 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_cortexm3_v5.yml @@ -0,0 +1,83 @@ +# unit testing under iar compiler / simulator for STM32 Cortex-M3 + +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.4\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian=little + - --cpu=Cortex-M3 + - --interwork + - --warnings_are_errors + - --fpu=None + - --diag_suppress=Pa050 + - --diag_suppress=Pe111 + - -e + - -On + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - 'IAR' + - 'UNITY_SUPPORT_64' + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic_cortex.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\debugger\ST\iostm32f107xx.ddf'] + - --cpu=Cortex-M3 + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_msp430.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_msp430.yml new file mode 100644 index 0000000..e022647 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_msp430.yml @@ -0,0 +1,94 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3 MSP430\' +core_root: &core_root [*tools_root, '430\'] +core_bin: &core_bin [*core_root, 'bin\'] +core_config: &core_config [*core_root, 'config\'] +core_lib: &core_lib [*core_root, 'lib\'] +core_inc: &core_inc [*core_root, 'inc\'] +core_config: &core_config [*core_root, 'config\'] + +compiler: + path: [*core_bin, 'icc430.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*core_lib, 'dlib\dl430fn.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --debug + - -e + - -Ol + - --multiplier=16 + - --double=32 + - --diag_suppress Pa050 + - --diag_suppress Pe111 + includes: + prefix: '-I' + items: + - *core_inc + - [*core_inc, 'dlib'] + - [*core_lib, 'dlib'] + - 'src\' + - '../src/' + - *unit_tests_path + - 'vendor\unity\src' + defines: + prefix: '-D' + items: + - '__MSP430F149__' + - 'INT_WIDTH=16' + - 'UNITY_EXCLUDE_FLOAT' + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r43' + destination: *build_path +linker: + path: [*core_bin, 'xlink.exe'] + options: + - -rt + - [*core_lib, 'dlib\dl430fn.r43'] + - -e_PrintfTiny=_Printf + - -e_ScanfSmall=_Scanf + - -s __program_start + - -D_STACK_SIZE=50 + - -D_DATA16_HEAP_SIZE=50 + - -D_DATA20_HEAP_SIZE=50 + - -f + - [*core_config, 'lnk430f5438.xcl'] + - -f + - [*core_config, 'multiplier.xcl'] + includes: + prefix: '-I' + items: + - *core_config + - *core_lib + - [*core_lib, 'dlib'] + object_files: + path: *build_path + extension: '.r79' + bin_files: + prefix: '-o' + extension: '.d79' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*core_bin, '430proc.dll'] + - [*core_bin, '430sim.dll'] + post_support: + - --plugin + - [*core_bin, '430bat.dll'] + - --backend -B + - --cpu MSP430F5438 + - -p + - [*core_config, 'MSP430F5438.ddf'] + - -d sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_sh2a_v6.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_sh2a_v6.yml new file mode 100644 index 0000000..ddc5603 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_sh2a_v6.yml @@ -0,0 +1,85 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 6.0\' +compiler: + path: [*tools_root, 'sh\bin\iccsh.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - -e + - --char_is_signed + - -Ol + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_scheduling + - --no_clustering + - --debug + - --dlib_config + - [*tools_root, 'sh\inc\DLib_Product.h'] + - --double=32 + - --code_model=huge + - --data_model=huge + - --core=sh2afpu + - --warnings_affect_exit_code + - --warnings_are_errors + - --mfc + - --use_unix_directory_separators + - --diag_suppress=Pe161 + includes: + prefix: '-I' + items: + - [*tools_root, 'sh\inc\'] + - [*tools_root, 'sh\inc\c'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.o' + destination: *build_path +linker: + path: [*tools_root, 'sh\bin\ilinksh.exe'] + options: + - --redirect __Printf=__PrintfSmall + - --redirect __Scanf=__ScanfSmall + - --config + - [*tools_root, 'sh\config\generic.icf'] + - --config_def _CSTACK_SIZE=0x800 + - --config_def _HEAP_SIZE=0x800 + - --config_def _INT_TABLE=0x10 + - --entry __iar_program_start + - --debug_lib + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'sh\bin\shproc.dll'] + - [*tools_root, 'sh\bin\shsim.dll'] + post_support: + - --plugin + - [*tools_root, 'sh\bin\shbat.dll'] + - --backend + - -B + - --core sh2afpu + - -p + - [*tools_root, 'sh\config\debugger\io7264.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_cmd.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_cmd.c new file mode 100644 index 0000000..42841d8 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_cmd.c @@ -0,0 +1,54 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include +#include "CException.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_def.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_def.c new file mode 100644 index 0000000..8280804 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_def.c @@ -0,0 +1,50 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_cmd.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_cmd.c new file mode 100644 index 0000000..e47b31c --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_cmd.c @@ -0,0 +1,76 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_def.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_def.c new file mode 100644 index 0000000..3ca9dba --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_def.c @@ -0,0 +1,72 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new1.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new1.c new file mode 100644 index 0000000..a7cbcd8 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new1.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + GlobalExpectCount = 0; + GlobalVerifyOrder = 0; + GlobalOrderError = NULL; + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new2.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new2.c new file mode 100644 index 0000000..2c76bf2 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new2.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_param.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_param.c new file mode 100644 index 0000000..23c04f4 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_param.c @@ -0,0 +1,73 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST_NO_ARGS +#define RUN_TEST(TestFunc, TestLineNum, ...) \ +{ \ + Unity.CurrentTestName = #TestFunc "(" #__VA_ARGS__ ")"; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(__VA_ARGS__); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21, RUN_TEST_NO_ARGS); + RUN_TEST(test_TheSecondThingToTest, 43, RUN_TEST_NO_ARGS); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run1.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run1.c new file mode 100644 index 0000000..a7cbcd8 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run1.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + GlobalExpectCount = 0; + GlobalVerifyOrder = 0; + GlobalOrderError = NULL; + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run2.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run2.c new file mode 100644 index 0000000..2c76bf2 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run2.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_yaml.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_yaml.c new file mode 100644 index 0000000..68b545a --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_yaml.c @@ -0,0 +1,86 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include "two.h" +#include "three.h" +#include +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_yaml_setup(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_new1.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_new1.c new file mode 100644 index 0000000..e5bcac2 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_new1.c @@ -0,0 +1,60 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_new2.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_new2.c new file mode 100644 index 0000000..b7c7e5b --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_new2.c @@ -0,0 +1,63 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_param.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_param.c new file mode 100644 index 0000000..4157007 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_param.c @@ -0,0 +1,51 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST_NO_ARGS +#define RUN_TEST(TestFunc, TestLineNum, ...) \ +{ \ + Unity.CurrentTestName = #TestFunc "(" #__VA_ARGS__ ")"; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(__VA_ARGS__); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21, RUN_TEST_NO_ARGS); + RUN_TEST(test_TheSecondThingToTest, 43, RUN_TEST_NO_ARGS); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_run1.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_run1.c new file mode 100644 index 0000000..e5bcac2 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_run1.c @@ -0,0 +1,60 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_run2.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_run2.c new file mode 100644 index 0000000..b7c7e5b --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_run2.c @@ -0,0 +1,63 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_yaml.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_yaml.c new file mode 100644 index 0000000..d109287 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_yaml.c @@ -0,0 +1,64 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "two.h" +#include "three.h" +#include +#include +#include +#include "CException.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_yaml_setup(); +} + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/test_generate_test_runner.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/test_generate_test_runner.rb new file mode 100644 index 0000000..61c8df9 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/test_generate_test_runner.rb @@ -0,0 +1,94 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +ruby_version = RUBY_VERSION.split('.') +if (ruby_version[1].to_i == 9) and (ruby_version[2].to_i > 1) + require 'rubygems' + gem 'test-unit' +end +require 'test/unit' +require './auto/generate_test_runner.rb' + +TEST_FILE = 'test/testdata/testsample.c' +TEST_MOCK = 'test/testdata/mocksample.c' +OUT_FILE = 'build/testsample_' +EXP_FILE = 'test/expectdata/testsample_' + +class TestGenerateTestRunner < Test::Unit::TestCase + def setup + end + + def teardown + end + + def verify_output_equal(subtest) + expected = File.read(EXP_FILE + subtest + '.c').gsub(/\r\n/,"\n") + actual = File.read(OUT_FILE + subtest + '.c').gsub(/\r\n/,"\n") + assert_equal(expected, actual, "Generated File Sub-Test '#{subtest}' Failed") + end + + def test_ShouldGenerateARunnerByCreatingRunnerWithOptions + sets = { 'def' => nil, + 'new1' => { :plugins => [:cexception], :includes => ['one.h', 'two.h'], :enforce_strict_ordering => true }, + 'new2' => { :plugins => [:ignore], :suite_setup => "a_custom_setup();", :suite_teardown => "a_custom_teardown();" } + } + + sets.each_pair do |subtest, options| + UnityTestRunnerGenerator.new(options).run(TEST_FILE, OUT_FILE + subtest + '.c') + verify_output_equal(subtest) + UnityTestRunnerGenerator.new(options).run(TEST_MOCK, OUT_FILE + 'mock_' + subtest + '.c') + verify_output_equal('mock_' + subtest) + end + end + + def test_ShouldGenerateARunnerByRunningRunnerWithOptions + sets = { 'run1' => { :plugins => [:cexception], :includes => ['one.h', 'two.h'], :enforce_strict_ordering => true }, + 'run2' => { :plugins => [:ignore], :suite_setup => "a_custom_setup();", :suite_teardown => "a_custom_teardown();" } + } + + sets.each_pair do |subtest, options| + UnityTestRunnerGenerator.new.run(TEST_FILE, OUT_FILE + subtest + '.c', options) + verify_output_equal(subtest) + UnityTestRunnerGenerator.new.run(TEST_MOCK, OUT_FILE + 'mock_' + subtest + '.c', options) + verify_output_equal('mock_' + subtest) + end + end + + def test_ShouldGenerateARunnerByPullingYamlOptions + subtest = 'yaml' + cmdstr = "ruby auto/generate_test_runner.rb test/testdata/sample.yml \"#{TEST_FILE}\" \"#{OUT_FILE + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal(subtest) + + cmdstr = "ruby auto/generate_test_runner.rb test/testdata/sample.yml \"#{TEST_MOCK}\" \"#{OUT_FILE + 'mock_' + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal('mock_' + subtest) + end + + def test_ShouldGenerateARunnerByPullingCommandlineOptions + subtest = 'cmd' + cmdstr = "ruby auto/generate_test_runner.rb -cexception \"#{TEST_FILE}\" \"#{OUT_FILE + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal(subtest) + + cmdstr = "ruby auto/generate_test_runner.rb -cexception \"#{TEST_MOCK}\" \"#{OUT_FILE + 'mock_' + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal('mock_' + subtest) + end + + def test_ShouldGenerateARunnerThatUsesParameterizedTests + sets = { 'param' => { :plugins => [:ignore], :use_param_tests => true } + } + + sets.each_pair do |subtest, options| + UnityTestRunnerGenerator.new(options).run(TEST_FILE, OUT_FILE + subtest + '.c') + verify_output_equal(subtest) + UnityTestRunnerGenerator.new(options).run(TEST_MOCK, OUT_FILE + 'mock_' + subtest + '.c') + verify_output_equal('mock_' + subtest) + end + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/mocksample.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/mocksample.c new file mode 100644 index 0000000..b709438 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/mocksample.c @@ -0,0 +1,51 @@ +// This is just a sample test file to be used to test the generator script +#ifndef TEST_SAMPLE_H +#define TEST_SAMPLE_H + +#include +#include "unity.h" +#include "funky.h" +#include "Mockstanky.h" + +void setUp(void) +{ + CustomSetupStuff(); +} + +void tearDown(void) +{ + CustomTeardownStuff +} + +//Yup, nice comment +void test_TheFirstThingToTest(void) +{ + TEST_ASSERT(1); + + TEST_ASSERT_TRUE(1); +} + +/* +void test_ShouldBeIgnored(void) +{ + DoesStuff(); +} +*/ + +//void test_ShouldAlsoNotBeTested(void) +//{ +// Call_An_Expect(); +// +// CallAFunction(); +// test_CallAFunctionThatLooksLikeATest(); +//} + +void test_TheSecondThingToTest(void) +{ + Call_An_Expect(); + + CallAFunction(); + test_CallAFunctionThatLooksLikeATest(); +} + +#endif //TEST_SAMPLE_H diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/sample.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/sample.yml new file mode 100644 index 0000000..9e5eece --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/sample.yml @@ -0,0 +1,9 @@ +:unity: + :includes: + - two.h + - three.h + - + :plugins: + - :cexception + :suite_setup: | + a_yaml_setup(); \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/testsample.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/testsample.c new file mode 100644 index 0000000..4f30ec7 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/testsample.c @@ -0,0 +1,51 @@ +// This is just a sample test file to be used to test the generator script +#ifndef TEST_SAMPLE_H +#define TEST_SAMPLE_H + +#include +#include "unity.h" +#include "funky.h" +#include "stanky.h" + +void setUp(void) +{ + CustomSetupStuff(); +} + +void tearDown(void) +{ + CustomTeardownStuff +} + +//Yup, nice comment +void test_TheFirstThingToTest(void) +{ + TEST_ASSERT(1); + + TEST_ASSERT_TRUE(1); +} + +/* +void test_ShouldBeIgnored(void) +{ + DoesStuff(); +} +*/ + +//void test_ShouldAlsoNotBeTested(void) +//{ +// Call_An_Expect(); +// +// CallAFunction(); +// test_CallAFunctionThatLooksLikeATest(); +//} + +void test_TheSecondThingToTest(void) +{ + Call_An_Expect(); + + CallAFunction(); + test_CallAFunctionThatLooksLikeATest(); +} + +#endif //TEST_SAMPLE_H diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testparameterized.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testparameterized.c new file mode 100644 index 0000000..037cd21 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testparameterized.c @@ -0,0 +1,101 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include +#include "unity.h" + +#define TEST_CASE(...) + +#define EXPECT_ABORT_BEGIN \ + if (TEST_PROTECT()) \ + { + +#define VERIFY_FAILS_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestFailed == 1) ? 0 : 1; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Failed But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +#define VERIFY_IGNORES_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestIgnored == 1) ? 0 : 1; \ + Unity.CurrentTestIgnored = 0; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Ignored But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +int SetToOneToFailInTearDown; +int SetToOneMeanWeAlreadyCheckedThisGuy; + +void setUp(void) +{ + SetToOneToFailInTearDown = 0; + SetToOneMeanWeAlreadyCheckedThisGuy = 0; +} + +void tearDown(void) +{ + if (SetToOneToFailInTearDown == 1) + TEST_FAIL_MESSAGE("<= Failed in tearDown"); + if ((SetToOneMeanWeAlreadyCheckedThisGuy == 0) && (Unity.CurrentTestFailed > 0)) + { + UnityPrint("[[[[ Previous Test Should Have Passed But Did Not ]]]]"); + UNITY_OUTPUT_CHAR('\n'); + } +} + +TEST_CASE(0) +TEST_CASE(44) +TEST_CASE((90)+9) +void test_TheseShouldAllPass(int Num) +{ + TEST_ASSERT_TRUE(Num < 100); +} + +TEST_CASE(3) +TEST_CASE(77) +TEST_CASE( (99) + 1 - (1)) +void test_TheseShouldAllFail(int Num) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(Num > 100); + VERIFY_FAILS_END +} + +TEST_CASE(1) +TEST_CASE(44) +TEST_CASE(99) +TEST_CASE(98) +void test_TheseAreEveryOther(int Num) +{ + if (Num & 1) + { + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(Num > 100); + VERIFY_FAILS_END + } + else + { + TEST_ASSERT_TRUE(Num < 100); + } +} + +void test_NormalPassesStillWork(void) +{ + TEST_ASSERT_TRUE(1); +} + +void test_NormalFailsStillWork(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(0); + VERIFY_FAILS_END +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testunity.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testunity.c new file mode 100644 index 0000000..9f826dc --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testunity.c @@ -0,0 +1,1510 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include +#include "unity.h" + +#define EXPECT_ABORT_BEGIN \ + if (TEST_PROTECT()) \ + { + +#define VERIFY_FAILS_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestFailed == 1) ? 0 : 1; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Failed But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +#define VERIFY_IGNORES_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestIgnored == 1) ? 0 : 1; \ + Unity.CurrentTestIgnored = 0; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Ignored But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +int SetToOneToFailInTearDown; +int SetToOneMeanWeAlreadyCheckedThisGuy; + +void setUp(void) +{ + SetToOneToFailInTearDown = 0; + SetToOneMeanWeAlreadyCheckedThisGuy = 0; +} + +void tearDown(void) +{ + if (SetToOneToFailInTearDown == 1) + TEST_FAIL_MESSAGE("<= Failed in tearDown"); + if ((SetToOneMeanWeAlreadyCheckedThisGuy == 0) && (Unity.CurrentTestFailed > 0)) + { + UnityPrint("[[[[ Previous Test Should Have Passed But Did Not ]]]]"); + UNITY_OUTPUT_CHAR('\n'); + } +} + +void testTrue(void) +{ + TEST_ASSERT(1); + + TEST_ASSERT_TRUE(1); +} + +void testFalse(void) +{ + TEST_ASSERT_FALSE(0); + + TEST_ASSERT_UNLESS(0); +} + +void testPreviousPass(void) +{ + TEST_ASSERT_EQUAL_INT(0U, Unity.TestFailures); +} + +void testNotVanilla(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT(0); + VERIFY_FAILS_END +} + +void testNotTrue(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(0); + VERIFY_FAILS_END +} + +void testNotFalse(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_FALSE(1); + VERIFY_FAILS_END +} + +void testNotUnless(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UNLESS(1); + VERIFY_FAILS_END +} + +void testNotNotEqual(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_NOT_EQUAL(10, 10); + VERIFY_FAILS_END +} + +void testFail(void) +{ + EXPECT_ABORT_BEGIN + TEST_FAIL_MESSAGE("Expected for testing"); + VERIFY_FAILS_END +} + +void testIsNull(void) +{ + char* ptr1 = NULL; + char* ptr2 = "hello"; + + TEST_ASSERT_NULL(ptr1); + TEST_ASSERT_NOT_NULL(ptr2); +} + +void testIsNullShouldFailIfNot(void) +{ + char* ptr1 = "hello"; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_NULL(ptr1); + VERIFY_FAILS_END +} + +void testNotNullShouldFailIfNULL(void) +{ + char* ptr1 = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_NOT_NULL(ptr1); + VERIFY_FAILS_END +} + +void testIgnore(void) +{ + EXPECT_ABORT_BEGIN + TEST_IGNORE(); + TEST_FAIL_MESSAGE("This should not be reached"); + VERIFY_IGNORES_END +} + +void testIgnoreMessage(void) +{ + EXPECT_ABORT_BEGIN + TEST_IGNORE_MESSAGE("This is an expected TEST_IGNORE_MESSAGE string!"); + TEST_FAIL_MESSAGE("This should not be reached"); + VERIFY_IGNORES_END +} + +void testNotEqualInts(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT(3982, 3983); + VERIFY_FAILS_END +} + +void testNotEqualInt8s(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT8(-127, -126); + VERIFY_FAILS_END +} + +void testNotEqualInt16s(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT16(-16383, -16382); + VERIFY_FAILS_END +} + +void testNotEqualInt32s(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT32(-2147483647, -2147483646); + VERIFY_FAILS_END +} + +void testNotEqualBits(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_BITS(0xFF00, 0x5555, 0x5A55); + VERIFY_FAILS_END +} + +void testNotEqualUInts(void) +{ + _UU16 v0, v1; + + v0 = 9000; + v1 = 9001; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualUInt8s(void) +{ + _UU8 v0, v1; + + v0 = 254; + v1 = 255; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT8(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualUInt16s(void) +{ + _UU16 v0, v1; + + v0 = 65535; + v1 = 65534; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualUInt32s(void) +{ + _UU32 v0, v1; + + v0 = 4294967295; + v1 = 4294967294; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT32(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex8s(void) +{ + _UU8 v0, v1; + + v0 = 0x23; + v1 = 0x22; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex8sIfSigned(void) +{ + _US8 v0, v1; + + v0 = -2; + v1 = 2; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex16s(void) +{ + _UU16 v0, v1; + + v0 = 0x1234; + v1 = 0x1235; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex16sIfSigned(void) +{ + _US16 v0, v1; + + v0 = -1024; + v1 = -1028; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex32s(void) +{ + _UU32 v0, v1; + + v0 = 900000; + v1 = 900001; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex32sIfSigned(void) +{ + _US32 v0, v1; + + v0 = -900000; + v1 = 900001; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32(v0, v1); + VERIFY_FAILS_END +} + +void testEqualInts(void) +{ + int v0, v1; + int *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(1837, 1837); + TEST_ASSERT_EQUAL_INT(-27365, -27365); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(19467, v1); + TEST_ASSERT_EQUAL_INT(v0, 19467); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 19467); +} + +void testEqualUints(void) +{ + unsigned int v0, v1; + unsigned int *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_UINT(1837, 1837); + TEST_ASSERT_EQUAL_UINT(v0, v1); + TEST_ASSERT_EQUAL_UINT(19467, v1); + TEST_ASSERT_EQUAL_UINT(v0, 19467); + TEST_ASSERT_EQUAL_UINT(*p0, v1); + TEST_ASSERT_EQUAL_UINT(*p0, *p1); + TEST_ASSERT_EQUAL_UINT(*p0, 19467); + TEST_ASSERT_EQUAL_UINT(60872u, 60872u); +} + +void testNotEqual(void) +{ + TEST_ASSERT_NOT_EQUAL(0, 1); + TEST_ASSERT_NOT_EQUAL(1, 0); + TEST_ASSERT_NOT_EQUAL(100, 101); + TEST_ASSERT_NOT_EQUAL(0, -1); + TEST_ASSERT_NOT_EQUAL(65535, -65535); + TEST_ASSERT_NOT_EQUAL(75, 900); + TEST_ASSERT_NOT_EQUAL(-100, -101); +} + +void testEqualHex8s(void) +{ + _UU8 v0, v1; + _UU8 *p0, *p1; + + v0 = 0x22; + v1 = 0x22; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX8(0x22, 0x22); + TEST_ASSERT_EQUAL_HEX8(v0, v1); + TEST_ASSERT_EQUAL_HEX8(0x22, v1); + TEST_ASSERT_EQUAL_HEX8(v0, 0x22); + TEST_ASSERT_EQUAL_HEX8(*p0, v1); + TEST_ASSERT_EQUAL_HEX8(*p0, *p1); + TEST_ASSERT_EQUAL_HEX8(*p0, 0x22); +} + +void testEqualHex8sNegatives(void) +{ + _UU8 v0, v1; + _UU8 *p0, *p1; + + v0 = 0xDD; + v1 = 0xDD; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX8(0xDD, 0xDD); + TEST_ASSERT_EQUAL_HEX8(v0, v1); + TEST_ASSERT_EQUAL_HEX8(0xDD, v1); + TEST_ASSERT_EQUAL_HEX8(v0, 0xDD); + TEST_ASSERT_EQUAL_HEX8(*p0, v1); + TEST_ASSERT_EQUAL_HEX8(*p0, *p1); + TEST_ASSERT_EQUAL_HEX8(*p0, 0xDD); +} + +void testEqualHex16s(void) +{ + _UU16 v0, v1; + _UU16 *p0, *p1; + + v0 = 0x9876; + v1 = 0x9876; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX16(0x9876, 0x9876); + TEST_ASSERT_EQUAL_HEX16(v0, v1); + TEST_ASSERT_EQUAL_HEX16(0x9876, v1); + TEST_ASSERT_EQUAL_HEX16(v0, 0x9876); + TEST_ASSERT_EQUAL_HEX16(*p0, v1); + TEST_ASSERT_EQUAL_HEX16(*p0, *p1); + TEST_ASSERT_EQUAL_HEX16(*p0, 0x9876); +} + +void testEqualHex32s(void) +{ + _UU32 v0, v1; + _UU32 *p0, *p1; + + v0 = 0x98765432ul; + v1 = 0x98765432ul; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX32(0x98765432ul, 0x98765432ul); + TEST_ASSERT_EQUAL_HEX32(v0, v1); + TEST_ASSERT_EQUAL_HEX32(0x98765432ul, v1); + TEST_ASSERT_EQUAL_HEX32(v0, 0x98765432ul); + TEST_ASSERT_EQUAL_HEX32(*p0, v1); + TEST_ASSERT_EQUAL_HEX32(*p0, *p1); + TEST_ASSERT_EQUAL_HEX32(*p0, 0x98765432ul); +} + +void testEqualBits(void) +{ + _UU32 v0 = 0xFF55AA00; + _UU32 v1 = 0x55550000; + + TEST_ASSERT_BITS(v1, v0, 0x55550000); + TEST_ASSERT_BITS(v1, v0, 0xFF55CC00); + TEST_ASSERT_BITS(0xFFFFFFFF, v0, 0xFF55AA00); + TEST_ASSERT_BITS(0xFFFFFFFF, v0, v0); + TEST_ASSERT_BITS(0xF0F0F0F0, v0, 0xFC5DAE0F); + TEST_ASSERT_BITS_HIGH(v1, v0); + TEST_ASSERT_BITS_LOW(0x000055FF, v0); + TEST_ASSERT_BIT_HIGH(30, v0); + TEST_ASSERT_BIT_LOW(5, v0); +} + +void testEqualShorts(void) +{ + short v0, v1; + short *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(1837, 1837); + TEST_ASSERT_EQUAL_INT(-2987, -2987); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(19467, v1); + TEST_ASSERT_EQUAL_INT(v0, 19467); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 19467); +} + +void testEqualUShorts(void) +{ + unsigned short v0, v1; + unsigned short *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_UINT(1837, 1837); + TEST_ASSERT_EQUAL_UINT(2987, 2987); + TEST_ASSERT_EQUAL_UINT(v0, v1); + TEST_ASSERT_EQUAL_UINT(19467, v1); + TEST_ASSERT_EQUAL_UINT(v0, 19467); + TEST_ASSERT_EQUAL_UINT(*p0, v1); + TEST_ASSERT_EQUAL_UINT(*p0, *p1); + TEST_ASSERT_EQUAL_UINT(*p0, 19467); +} + +void testEqualChars(void) +{ + signed char v0, v1; + signed char *p0, *p1; + + v0 = 109; + v1 = 109; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(42, 42); + TEST_ASSERT_EQUAL_INT(-116, -116); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(109, v1); + TEST_ASSERT_EQUAL_INT(v0, 109); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 109); +} + +void testEqualUChars(void) +{ + unsigned char v0, v1; + unsigned char *p0, *p1; + + v0 = 251; + v1 = 251; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(42, 42); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(251, v1); + TEST_ASSERT_EQUAL_INT(v0, 251); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 251); +} + +void testEqualPointers(void) +{ + int v0, v1; + int *p0, *p1, *p2; + + v0 = 19467; + v1 = 18271; + p0 = &v0; + p1 = &v1; + p2 = &v1; + + TEST_ASSERT_EQUAL_PTR(p0, &v0); + TEST_ASSERT_EQUAL_PTR(&v1, p1); + TEST_ASSERT_EQUAL_PTR(p2, p1); + TEST_ASSERT_EQUAL_PTR(&v0, &v0); +} + +void testNotEqualPointers(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_PTR(0x12345678, 0x12345677); + VERIFY_FAILS_END +} + +void testIntsWithinDelta(void) +{ + TEST_ASSERT_INT_WITHIN(1, 5000, 5001); + TEST_ASSERT_INT_WITHIN(5, 5000, 4996); + TEST_ASSERT_INT_WITHIN(5, 5000, 5005); + TEST_ASSERT_INT_WITHIN(500, 50, -440); + + TEST_ASSERT_INT_WITHIN(2, -1, -1); + TEST_ASSERT_INT_WITHIN(5, 1, -1); + TEST_ASSERT_INT_WITHIN(5, -1, 1); +} + +void testIntsNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_INT_WITHIN(5, 5000, 5006); + VERIFY_FAILS_END +} + +void testUIntsWithinDelta(void) +{ + TEST_ASSERT_UINT_WITHIN(1, 5000, 5001); + TEST_ASSERT_UINT_WITHIN(5, 5000, 4996); + TEST_ASSERT_UINT_WITHIN(5, 5000, 5005); +} + +void testUIntsNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UINT_WITHIN(1, 2147483647u, 2147483649u); + VERIFY_FAILS_END +} + +void testUIntsNotWithinDeltaEvenThoughASignedIntWouldPassSmallFirst(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UINT_WITHIN(5, 1, -1); + VERIFY_FAILS_END +} + +void testUIntsNotWithinDeltaEvenThoughASignedIntWouldPassBigFirst(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UINT_WITHIN(5, -1, 1); + VERIFY_FAILS_END +} + +void testHEX32sWithinDelta(void) +{ + TEST_ASSERT_HEX32_WITHIN(1, 5000, 5001); + TEST_ASSERT_HEX32_WITHIN(5, 5000, 4996); + TEST_ASSERT_HEX32_WITHIN(5, 5000, 5005); +} + +void testHEX32sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX32_WITHIN(1, 2147483647u, 2147483649u); + VERIFY_FAILS_END +} + +void testHEX32sNotWithinDeltaEvenThoughASignedIntWouldPass(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX32_WITHIN(5, 1, -1); + VERIFY_FAILS_END +} + +void testHEX16sWithinDelta(void) +{ + TEST_ASSERT_HEX16_WITHIN(1, 5000, 5001); + TEST_ASSERT_HEX16_WITHIN(5, 5000, 4996); + TEST_ASSERT_HEX16_WITHIN(5, 5000, 5005); +} + +void testHEX16sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX16_WITHIN(2, 65535, 0); + VERIFY_FAILS_END +} + +void testHEX8sWithinDelta(void) +{ + TEST_ASSERT_HEX8_WITHIN(1, 254, 255); + TEST_ASSERT_HEX8_WITHIN(5, 251, 255); + TEST_ASSERT_HEX8_WITHIN(5, 1, 4); +} + +void testHEX8sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX8_WITHIN(2, 255, 0); + VERIFY_FAILS_END +} + +void testEqualStrings(void) +{ + const char *testString = "foo"; + + TEST_ASSERT_EQUAL_STRING(testString, testString); + TEST_ASSERT_EQUAL_STRING("foo", "foo"); + TEST_ASSERT_EQUAL_STRING("foo", testString); + TEST_ASSERT_EQUAL_STRING(testString, "foo"); + TEST_ASSERT_EQUAL_STRING("", ""); +} + +void testEqualStringsWithCarriageReturnsAndLineFeeds(void) +{ + const char *testString = "foo\r\nbar"; + + TEST_ASSERT_EQUAL_STRING(testString, testString); + TEST_ASSERT_EQUAL_STRING("foo\r\nbar", "foo\r\nbar"); + TEST_ASSERT_EQUAL_STRING("foo\r\nbar", testString); + TEST_ASSERT_EQUAL_STRING(testString, "foo\r\nbar"); + TEST_ASSERT_EQUAL_STRING("", ""); +} + +void testNotEqualString1(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("foo", "bar"); + VERIFY_FAILS_END +} + +void testNotEqualString2(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("foo", ""); + VERIFY_FAILS_END +} + +void testNotEqualString3(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("", "bar"); + VERIFY_FAILS_END +} + +void testNotEqualString4(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("bar\r", "bar\n"); + VERIFY_FAILS_END +} + +void testNotEqualString5(void) +{ + const char str1[] = { 0x41, 0x42, 0x03, 0x00 }; + const char str2[] = { 0x41, 0x42, 0x04, 0x00 }; + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING(str1, str2); + VERIFY_FAILS_END +} + +void testNotEqualString_ExpectedStringIsNull(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING(NULL, "bar"); + VERIFY_FAILS_END +} + +void testNotEqualString_ActualStringIsNull(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("foo", NULL); + VERIFY_FAILS_END +} + +void testEqualStringArrays(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, expStrings, 3); + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 3); + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 2); + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 1); +} + +void testNotEqualStringArray1(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray2(void) +{ + const char *testStrings[] = { "zoo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", "boo", "woo", "moo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray3(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", NULL }; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray4(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", NULL, "woo", "moo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray5(void) +{ + const char **testStrings = NULL; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray6(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "zoo" }; + const char **expStrings = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testEqualStringArrayIfBothNulls(void) +{ + const char **testStrings = NULL; + const char **expStrings = NULL; + + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); +} + +void testEqualMemory(void) +{ + const char *testString = "whatever"; + + TEST_ASSERT_EQUAL_MEMORY(testString, testString, 8); + TEST_ASSERT_EQUAL_MEMORY("whatever", "whatever", 8); + TEST_ASSERT_EQUAL_MEMORY("whatever", testString, 8); + TEST_ASSERT_EQUAL_MEMORY(testString, "whatever", 8); + TEST_ASSERT_EQUAL_MEMORY(testString, "whatever", 2); + TEST_ASSERT_EQUAL_MEMORY(NULL, NULL, 1); +} + +void testNotEqualMemory1(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY("foo", "bar", 3); + VERIFY_FAILS_END +} + +void testNotEqualMemory2(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY("fool", "food", 4); + VERIFY_FAILS_END +} + +void testNotEqualMemory3(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY(NULL, "food", 4); + VERIFY_FAILS_END +} + +void testNotEqualMemory4(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY("fool", NULL, 4); + VERIFY_FAILS_END +} + +void testEqualIntArrays(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, -2}; + int p2[] = {1, 8, 987, 2}; + int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p3, 1); +} + +void testNotEqualIntArraysNullExpected(void) +{ + int* p0 = NULL; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArraysNullActual(void) +{ + int* p1 = NULL; + int p0[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArrays1(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArrays2(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {2, 8, 987, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArrays3(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 986, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualInt8Arrays(void) +{ + _US8 p0[] = {1, 8, 117, -2}; + _US8 p1[] = {1, 8, 117, -2}; + _US8 p2[] = {1, 8, 117, 2}; + _US8 p3[] = {1, 50, 60, 70}; + + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p3, 1); +} + +void testNotEqualInt8Arrays(void) +{ + _US8 p0[] = {1, 8, 127, -2}; + _US8 p1[] = {1, 8, 127, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualUIntArrays(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65132u}; + unsigned int p2[] = {1, 8, 987, 2}; + unsigned int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p3, 1); +} + +void testNotEqualUIntArrays1(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUIntArrays2(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUIntArrays3(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualInt16Arrays(void) +{ + _UU16 p0[] = {1, 8, 117, 3}; + _UU16 p1[] = {1, 8, 117, 3}; + _UU16 p2[] = {1, 8, 117, 2}; + _UU16 p3[] = {1, 50, 60, 70}; + + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p3, 1); +} + +void testNotEqualInt16Arrays(void) +{ + _UU16 p0[] = {1, 8, 127, 3}; + _UU16 p1[] = {1, 8, 127, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualUINT16Arrays(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65132u}; + unsigned short p2[] = {1, 8, 987, 2}; + unsigned short p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p3, 1); +} + +void testNotEqualUINT16Arrays1(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUINT16Arrays2(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUINT16Arrays3(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualHEXArrays(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65132u}; + unsigned int p2[] = {1, 8, 987, 2}; + unsigned int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p3, 1); +} + +void testNotEqualHEXArrays1(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEXArrays2(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEXArrays3(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualHEX16Arrays(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65132u}; + unsigned short p2[] = {1, 8, 987, 2}; + unsigned short p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p3, 1); +} + +void testNotEqualHEX16Arrays1(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX16Arrays2(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX16Arrays3(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualHEX8Arrays(void) +{ + unsigned short p0[] = {1, 8, 254u, 123}; + unsigned short p1[] = {1, 8, 254u, 123}; + unsigned short p2[] = {1, 8, 254u, 2}; + unsigned short p3[] = {1, 23, 25, 26}; + + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p3, 1); +} + +void testNotEqualHEX8Arrays1(void) +{ + unsigned char p0[] = {1, 8, 254u, 253u}; + unsigned char p1[] = {1, 8, 254u, 252u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX8Arrays2(void) +{ + unsigned char p0[] = {1, 8, 254u, 253u}; + unsigned char p1[] = {2, 8, 254u, 253u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX8Arrays3(void) +{ + unsigned char p0[] = {1, 8, 254u, 253u}; + unsigned char p1[] = {1, 8, 255u, 253u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualMemoryArrays(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, -2}; + int p2[] = {1, 8, 987, 2}; + int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p0, 4, 1); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p0, 4, 4); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p2, 4, 3); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p3, 4, 1); +} + +void testNotEqualMemoryArraysExpectedNull(void) +{ + int* p0 = NULL; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArraysActualNull(void) +{ + int p0[] = {1, 8, 987, -2}; + int* p1 = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArrays1(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArrays2(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {2, 8, 987, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArrays3(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 986, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testProtection(void) +{ + volatile int mask = 0; + + if (TEST_PROTECT()) + { + mask |= 1; + TEST_ABORT(); + } + else + { + Unity.CurrentTestFailed = 0; + mask |= 2; + } + + TEST_ASSERT_EQUAL(3, mask); +} + +void testIgnoredAndThenFailInTearDown(void) +{ + SetToOneToFailInTearDown = 1; + TEST_IGNORE(); +} + +// ===================== THESE TEST WILL RUN IF YOUR CONFIG INCLUDES 64 BIT SUPPORT ================== +#ifdef UNITY_SUPPORT_64 + +void testEqualHex64s(void) +{ + _UU64 v0, v1; + _UU64 *p0, *p1; + + v0 = 0x9876543201234567; + v1 = 0x9876543201234567; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX64(0x9876543201234567, 0x9876543201234567); + TEST_ASSERT_EQUAL_HEX64(v0, v1); + TEST_ASSERT_EQUAL_HEX64(0x9876543201234567, v1); + TEST_ASSERT_EQUAL_HEX64(v0, 0x9876543201234567); + TEST_ASSERT_EQUAL_HEX64(*p0, v1); + TEST_ASSERT_EQUAL_HEX64(*p0, *p1); + TEST_ASSERT_EQUAL_HEX64(*p0, 0x9876543201234567); +} + +void testNotEqualHex64s(void) +{ + _UU64 v0, v1; + + v0 = 9000000000; + v1 = 9100000000; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex64sIfSigned(void) +{ + _US64 v0, v1; + + v0 = -9000000000; + v1 = 9000000000; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64(v0, v1); + VERIFY_FAILS_END +} + +void testHEX64sWithinDelta(void) +{ + TEST_ASSERT_HEX64_WITHIN(1, 0x7FFFFFFFFFFFFFFF,0x7FFFFFFFFFFFFFFE); + TEST_ASSERT_HEX64_WITHIN(5, 5000, 4996); + TEST_ASSERT_HEX64_WITHIN(5, 5000, 5005); +} + +void testHEX64sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX64_WITHIN(1, 0x7FFFFFFFFFFFFFFF, 0x7FFFFFFFFFFFFFFC); + VERIFY_FAILS_END +} + +void testHEX64sNotWithinDeltaEvenThoughASignedIntWouldPass(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX64_WITHIN(5, 1, -1); + VERIFY_FAILS_END +} + +void testEqualHEX64Arrays(void) +{ + _UU64 p0[] = {1, 8, 987, 65132u}; + _UU64 p1[] = {1, 8, 987, 65132u}; + _UU64 p2[] = {1, 8, 987, 2}; + _UU64 p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p3, 1); +} + +void testNotEqualHEX64Arrays1(void) +{ + _UU64 p0[] = {1, 8, 987, 65132u}; + _UU64 p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX64Arrays2(void) +{ + _UU64 p0[] = {1, 8, 987, 65132u}; + _UU64 p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +#endif //64-bit SUPPORT + +// ===================== THESE TEST WILL RUN IF YOUR CONFIG INCLUDES FLOAT SUPPORT ================== +#ifndef UNITY_EXCLUDE_FLOAT + +void testFloatsWithinDelta(void) +{ + TEST_ASSERT_FLOAT_WITHIN(0.00003f, 187245.03485f, 187245.03488f); + TEST_ASSERT_FLOAT_WITHIN(1.0f, 187245.0f, 187246.0f); + TEST_ASSERT_FLOAT_WITHIN(0.05f, 9273.2549f, 9273.2049f); + TEST_ASSERT_FLOAT_WITHIN(0.007f, -726.93724f, -726.94424f); +} + +void testFloatsNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_FLOAT_WITHIN(0.05f, 9273.2649f, 9273.2049f); + VERIFY_FAILS_END +} + +void testFloatsEqual(void) +{ + TEST_ASSERT_EQUAL_FLOAT(187245.0f, 187246.0f); + TEST_ASSERT_EQUAL_FLOAT(18724.5f, 18724.6f); + TEST_ASSERT_EQUAL_FLOAT(9273.2549f, 9273.2599f); + TEST_ASSERT_EQUAL_FLOAT(-726.93724f, -726.9374f); +} + +void testFloatsNotEqual(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT(9273.9649f, 9273.0049f); + VERIFY_FAILS_END +} + +void testFloatsNotEqualNegative1(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT(-9273.9649f, -9273.0049f); + VERIFY_FAILS_END +} + +void testFloatsNotEqualNegative2(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT(-9273.0049f, -9273.9649f); + VERIFY_FAILS_END +} + +void testEqualFloatArrays(void) +{ + float p0[] = {1.0, -8.0, 25.4, -0.123}; + float p1[] = {1.0, -8.0, 25.4, -0.123}; + float p2[] = {1.0, -8.0, 25.4, -0.2}; + float p3[] = {1.0, -23.0, 25.0, -0.26}; + + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p3, 1); +} + +void testNotEqualFloatArraysExpectedNull(void) +{ + float* p0 = NULL; + float p1[] = {1.0, 8.0, 25.4, 0.252}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysActualNull(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float* p1 = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArrays1(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float p1[] = {1.0, 8.0, 25.4, 0.252}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArrays2(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float p1[] = {2.0, 8.0, 25.4, 0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArrays3(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float p1[] = {1.0, 8.0, 25.5, 0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysNegative1(void) +{ + float p0[] = {-1.0, -8.0, -25.4, -0.253}; + float p1[] = {-1.0, -8.0, -25.4, -0.252}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysNegative2(void) +{ + float p0[] = {-1.0, -8.0, -25.4, -0.253}; + float p1[] = {-2.0, -8.0, -25.4, -0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysNegative3(void) +{ + float p0[] = {-1.0, -8.0, -25.4, -0.253}; + float p1[] = {-1.0, -8.0, -25.5, -0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +#endif //FLOAT SUPPORT diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/CHANGES b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/CHANGES new file mode 100644 index 0000000..4b5184c --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/CHANGES @@ -0,0 +1,78 @@ +Hardmock 1.3.7 + +* BUG FIX: expects! could not setup expectations for more than one concrete method on an object, since the method aliasing and rewriting was only taking place when the background mock instance was first created. This logic has been updated and now you can do all the things you'd expect. + +Hardmock 1.3.6 + +* BUG FIX: In Rails apps (and others) Hardmock and Fixtures battled viciously over "setup" and "teardown" and "method_added" (and any other clever test enhancement tool, namely Mocha) causing unpredictable results, notably failure to auto-verify mocks after teardown (leading to false positive tests). + * The newly-added TestUnitBeforeAfter provides TestCase.before_setup and TestCase.after_teardown -- formal test wrapping hooks -- lets Hardmock provide its preparation and auto-verify behavior without contending for setup/teardown supremacy. + +Hardmock 1.3.5 + +* Aliased should_receive => expects and and_return => returns for easier transition from rspec mock and flexmock users. + +Hardmock 1.3.4 + +* Prevents accidental stubbing and mocking on NilClasses + +Hardmock 1.3.3 + +* stubs! and expects! no longer require that their target methods exist in reality (this used to prevent you from stubbing methods that "exist" by virtue of "method_missing" +* Tweaked inner metaclass code to avoid collisions with rspec's "metaid" stuff +* Moved this project's Rake tasks into rake_tasks... otherwise Rails will load them, if Hardmock is installed as a Rails plugin +* Alias added: 'verify_hardmocks' is now an alias for 'verify_mocks' (some internal projects were using this modified method name as a means of cooexisting with mocha) + +Hardmock 1.3.2 + +November 2007 + +* adds 'with' as an alternate syntax for specifying argument expectations. + +Hardmock 1.3.1 + +October 2007 + +* Can use stubs! on a mock object +* expects! now generates mocked methods that can safely transfer runtime blocks to the mock instance itself +* No longer need to call "prepare_hardmock_control" when using stubs in the absence of mocks +* Stubs of concrete class or instance methods are restored to original state in teardown + +Hardmock 1.3.0 + +October 2007 + +* Adds stubs! and expects! method to all objects and classes to support concrete stubbing/mocking. + +Hardmock 1.2.3 + +Sat Apr 28 01:16:15 EDT 2007 + +* Re-release of 1.2.2 (which was canceled)... tasks moved to lib/tasks + +Hardmock 1.2.2 + +Sat Apr 28 00:41:30 EDT 2007 + +* assert_error has been broken out into its own lib file +* Gem package can now run all tests successfully +* Internal code refactoring; a number of classes that were defined in hardmock.rb are now in their own files + +Hardmock 1.2.1 + +Sat Apr 28 00:41:30 EDT 2007 + +* (botched release, see 1.2.2) + +Hardmock 1.2.0 + +* You can now use "expect" in place of "expects" if you must. +* "inspect" has been added to the list of methods NOT erased by MethodCleanout. + +Hardmock 1.1.0 + +* "expects" replaces "expect" ("expect" now raises Hardmock::DeprecationError) +* "verify_mocks" is now implicit in teardown, you needn't call it anymore +* Mocking methods that Mock would otherwise inherit from Object (eg, to_s) is now possible +* require 'hardmock' is all that's required to use the library now; no need to include in TestCase + +(previously called CMock, translated to Hardmock on 2006-12-10) diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/LICENSE b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/LICENSE new file mode 100644 index 0000000..396211e --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/LICENSE @@ -0,0 +1,7 @@ +Copyright (c) 2006,2007 David Crosby at Atomic Object, LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/README b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/README new file mode 100644 index 0000000..4650a2a --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/README @@ -0,0 +1,70 @@ +== Hardmock + +Strict, ordered mock objects using very lightweight syntax in your tests. + +== How + +The basic procedure for using Hardmock in your tests is: + +* require 'hardmock' (this happens automatically when being used as a Rails plugin) +* Create some mocks +* Setup some expectations +* Execute the target code +* Verification of calls is automatic in =teardown= + +The expectations you set when using mocks are strict and ordered. +Expectations you declare by creating and using mocks are all considered together. + +* Hardmock::Mock#expects will show you more examples +* Hardmock::SimpleExpectation will teach you more about expectation methods + +== Example + + create_mocks :garage, :car + + # Set some expectations + @garage.expects.open_door + @car.expects.start(:choke) + @car.expects.drive(:reverse, 5.mph) + + # Execute the code (this code is usually, obviously, in your class under test) + @garage.open_door + @car.start :choke + @car.drive :reverse, 5.mph + + verify_mocks # OPTIONAL, teardown will do this for you + +Expects @garage.open_door, @car.start(:choke) and @car.drive(:reverse, 5.mph) to be called in that order, with those specific arguments. +* Violations of expectations, such as mis-ordered calls, calls on wrong objects, or incorrect methods result in Hardmock::ExpectationError +* verify_mocks will raise VerifyError if not all expectations have been met. + +== Download and Install + +* Homepage: http://hardmock.rubyforge.org +* GEM or TGZ or ZIP: http://rubyforge.org/frs/?group_id=2742 +* Rails plugin: script/plugin install +* SVN access: svn co svn://rubyforge.org/var/svn/hardmock/trunk +* Developer SVN access: svn co svn://developername@rubyforge.org/var/svn/hardmock/trunk + +== Setup for Test::Unit + + require 'hardmock' + require 'assert_error' # OPTIONAL: this adds the TestUnit extension 'assert_error' + +NOTE: If installed as a Rails plugin, init.rb does this for you... nothing else is needed. + +== Setup for RSpec + +Get this into your spec helper or environment or Rakefile or wherever you prefer: + + Spec::Runner.configure do |configuration| + configuration.include Hardmock + configuration.after(:each) {verify_mocks} + end + +This puts the implicit conveniences into your spec context, like "create_mocks" etc, and also provides for automatic +"verify_mocks" after each Example is run. + +== Author +* David Crosby crosby at http://atomicobject.com +* (c) 2006,2007 Atomic Object LLC diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/Rakefile b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/Rakefile new file mode 100644 index 0000000..aff126c --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/Rakefile @@ -0,0 +1,8 @@ +require 'rake' +require 'rubygems' + +HARDMOCK_VERSION = "1.3.7" + +Dir["rake_tasks/*.rake"].each { |f| load f } + +task :default => [ 'test:all' ] diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/config/environment.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/config/environment.rb new file mode 100644 index 0000000..a15e598 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/config/environment.rb @@ -0,0 +1,12 @@ +# The path to the root directory of your application. +APP_ROOT = File.join(File.dirname(__FILE__), '..') + +ADDITIONAL_LOAD_PATHS = [] +ADDITIONAL_LOAD_PATHS.concat %w( + lib +).map { |dir| "#{APP_ROOT}/#{dir}" }.select { |dir| File.directory?(dir) } + +# Prepend to $LOAD_PATH +ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) } + +# Require any additional libraries needed diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/lib/assert_error.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/lib/assert_error.rb new file mode 100644 index 0000000..6da61de --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/lib/assert_error.rb @@ -0,0 +1,23 @@ +require 'test/unit/assertions' + +module Test::Unit #:nodoc:# + module Assertions #:nodoc:# + # A better 'assert_raise'. +patterns+ can be one or more Regexps, or a literal String that + # must match the entire error message. + def assert_error(err_type,*patterns,&block) + assert_not_nil block, "assert_error requires a block" + assert((err_type and err_type.kind_of?(Class)), "First argument to assert_error has to be an error type") + err = assert_raise(err_type) do + block.call + end + patterns.each do |pattern| + case pattern + when Regexp + assert_match(pattern, err.message) + else + assert_equal pattern, err.message + end + end + end + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/lib/extend_test_unit.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/lib/extend_test_unit.rb new file mode 100644 index 0000000..3d7ef9d --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/lib/extend_test_unit.rb @@ -0,0 +1,14 @@ + +require 'test/unit/testcase' +class Test::Unit::TestCase + include Hardmock +end + +require 'test_unit_before_after' +Test::Unit::TestCase.before_setup do |test| + test.prepare_hardmock_control +end + +Test::Unit::TestCase.after_teardown do |test| + test.verify_mocks +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock.rb new file mode 100644 index 0000000..50f9a94 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock.rb @@ -0,0 +1,86 @@ +require 'hardmock/method_cleanout' +require 'hardmock/mock' +require 'hardmock/mock_control' +require 'hardmock/utils' +require 'hardmock/errors' +require 'hardmock/trapper' +require 'hardmock/expector' +require 'hardmock/expectation' +require 'hardmock/expectation_builder' +require 'hardmock/stubbing' + +module Hardmock + + # Create one or more new Mock instances in your test suite. + # Once created, the Mocks are accessible as instance variables in your test. + # Newly built Mocks are added to the full set of Mocks for this test, which will + # be verified when you call verify_mocks. + # + # create_mocks :donkey, :cat # Your test now has @donkey and @cat + # create_mock :dog # Test now has @donkey, @cat and @dog + # + # The first call returned a hash { :donkey => @donkey, :cat => @cat } + # and the second call returned { :dog => @dog } + # + # For more info on how to use your mocks, see Mock and Expectation + # + def create_mocks(*mock_names) + prepare_hardmock_control unless @main_mock_control + + mocks = {} + mock_names.each do |mock_name| + raise ArgumentError, "'nil' is not a valid name for a mock" if mock_name.nil? + mock_name = mock_name.to_s + mock_object = Mock.new(mock_name, @main_mock_control) + mocks[mock_name.to_sym] = mock_object + self.instance_variable_set "@#{mock_name}", mock_object + end + @all_mocks ||= {} + @all_mocks.merge! mocks + + return mocks.clone + end + + def prepare_hardmock_control + if @main_mock_control.nil? + @main_mock_control = MockControl.new + $main_mock_control = @main_mock_control + else + raise "@main_mock_control is already setup for this test!" + end + end + + alias :create_mock :create_mocks + + # Ensures that all expectations have been met. If not, VerifyException is + # raised. + # + # You normally won't need to call this yourself. Within Test::Unit::TestCase, this will be done automatically at teardown time. + # + # * +force+ -- if +false+, and a VerifyError or ExpectationError has already occurred, this method will not raise. This is to help you suppress repeated errors when if you're calling #verify_mocks in the teardown method of your test suite. BE WARNED - only use this if you're sure you aren't obscuring useful information. Eg, if your code handles exceptions internally, and an ExpectationError gets gobbled up by your +rescue+ block, the cause of failure for your test may be hidden from you. For this reason, #verify_mocks defaults to force=true as of Hardmock 1.0.1 + def verify_mocks(force=true) + return unless @main_mock_control + return if @main_mock_control.disappointed? and !force + @main_mock_control.verify + ensure + @main_mock_control.clear_expectations if @main_mock_control + $main_mock_control = nil + reset_stubs + end + + alias :verify_hardmocks :verify_mocks + + # Purge the main MockControl of all expectations, restore all concrete stubbed/mocked methods + def clear_expectations + @main_mock_control.clear_expectations if @main_mock_control + reset_stubs + $main_mock_control = nil + end + + def reset_stubs + Hardmock.restore_all_replaced_methods + end + +end + +require 'extend_test_unit' diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/errors.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/errors.rb new file mode 100644 index 0000000..48698a6 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/errors.rb @@ -0,0 +1,22 @@ +module Hardmock + # Raised when: + # * Unexpected method is called on a mock object + # * Bad arguments passed to an expected call + class ExpectationError < StandardError #:nodoc:# + end + + # Raised for methods that should no longer be called. Hopefully, the exception message contains helpful alternatives. + class DeprecationError < StandardError #:nodoc:# + end + + # Raised when stubbing fails + class StubbingError < StandardError #:nodoc:# + end + + # Raised when it is discovered that an expected method call was never made. + class VerifyError < StandardError #:nodoc:# + def initialize(msg,unmet_expectations) + super("#{msg}:" + unmet_expectations.map { |ex| "\n * #{ex.to_s}" }.join) + end + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/expectation.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/expectation.rb new file mode 100644 index 0000000..4d1db92 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/expectation.rb @@ -0,0 +1,229 @@ +require 'hardmock/utils' + +module Hardmock + class Expectation + include Utils + attr_reader :block_value + + def initialize(options) #:nodoc: + @options = options + end + + def apply_method_call(mock,mname,args,block) #:nodoc: + unless @options[:mock].equal?(mock) + raise anger("Wrong object", mock,mname,args) + end + unless @options[:method] == mname + raise anger("Wrong method",mock,mname,args) + end + + # Tester-defined block to invoke at method-call-time: + expectation_block = @options[:block] + + expected_args = @options[:arguments] + # if we have a block, we can skip the argument check if none were specified + unless (expected_args.nil? || expected_args.empty?) && expectation_block && !@options[:suppress_arguments_to_block] + unless expected_args == args + raise anger("Wrong arguments",mock,mname,args) + end + end + + relayed_args = args.dup + if block + if expectation_block.nil? + # Can't handle a runtime block without an expectation block + raise ExpectationError.new("Unexpected block provided to #{to_s}") + else + # Runtime blocks are passed as final argument to the expectation block + unless @options[:suppress_arguments_to_block] + relayed_args << block + else + # Arguments suppressed; send only the block + relayed_args = [block] + end + end + end + + # Run the expectation block: + @block_value = expectation_block.call(*relayed_args) if expectation_block + + raise @options[:raises] unless @options[:raises].nil? + + return_value = @options[:returns] + if return_value.nil? + return @block_value + else + return return_value + end + end + + # Set the return value for an expected method call. + # Eg, + # @cash_machine.expects.withdraw(20,:dollars).returns(20.00) + def returns(val) + @options[:returns] = val + self + end + alias_method :and_return, :returns + + # Set the arguments for an expected method call. + # Eg, + # @cash_machine.expects.deposit.with(20, "dollars").returns(:balance => "20") + def with(*args) + @options[:arguments] = args + self + end + + # Rig an expected method to raise an exception when the mock is invoked. + # + # Eg, + # @cash_machine.expects.withdraw(20,:dollars).raises "Insufficient funds" + # + # The argument can be: + # * an Exception -- will be used directly + # * a String -- will be used as the message for a RuntimeError + # * nothing -- RuntimeError.new("An Error") will be raised + def raises(err=nil) + case err + when Exception + @options[:raises] = err + when String + @options[:raises] = RuntimeError.new(err) + else + @options[:raises] = RuntimeError.new("An Error") + end + self + end + + # Convenience method: assumes +block_value+ is set, and is set to a Proc + # (or anything that responds to 'call') + # + # light_event = @traffic_light.trap.subscribe(:light_changes) + # + # # This code will meet the expectation: + # @traffic_light.subscribe :light_changes do |color| + # puts color + # end + # + # The color-handling block is now stored in light_event.block_value + # + # The block can be invoked like this: + # + # light_event.trigger :red + # + # See Mock#trap and Mock#expects for information on using expectation objects + # after they are set. + # + def trigger(*block_arguments) + unless block_value + raise ExpectationError.new("No block value is currently set for expectation #{to_s}") + end + unless block_value.respond_to?(:call) + raise ExpectationError.new("Can't apply trigger to #{block_value} for expectation #{to_s}") + end + block_value.call *block_arguments + end + + # Used when an expected method accepts a block at runtime. + # When the expected method is invoked, the block passed to + # that method will be invoked as well. + # + # NOTE: ExpectationError will be thrown upon running the expected method + # if the arguments you set up in +yields+ do not properly match up with + # the actual block that ends up getting passed. + # + # == Examples + # Single invocation: The block passed to +lock_down+ gets invoked + # once with no arguments: + # + # @safe_zone.expects.lock_down.yields + # + # # (works on code that looks like:) + # @safe_zone.lock_down do + # # ... this block invoked once + # end + # + # Multi-parameter blocks: The block passed to +each_item+ gets + # invoked twice, with :item1 the first time, and with + # :item2 the second time: + # + # @fruit_basket.expects.each_with_index.yields [:apple,1], [:orange,2] + # + # # (works on code that looks like:) + # @fruit_basket.each_with_index do |fruit,index| + # # ... this block invoked with fruit=:apple, index=1, + # # ... and then with fruit=:orange, index=2 + # end + # + # Arrays can be passed as arguments too... if the block + # takes a single argument and you want to pass a series of arrays into it, + # that will work as well: + # + # @list_provider.expects.each_list.yields [1,2,3], [4,5,6] + # + # # (works on code that looks like:) + # @list_provider.each_list do |list| + # # ... list is [1,2,3] the first time + # # ... list is [4,5,6] the second time + # end + # + # Return value: You can set the return value for the method that + # accepts the block like so: + # + # @cruncher.expects.do_things.yields(:bean1,:bean2).returns("The Results") + # + # Raising errors: You can set the raised exception for the method that + # accepts the block. NOTE: the error will be raised _after_ the block has + # been invoked. + # + # # :bean1 and :bean2 will be passed to the block, then an error is raised: + # @cruncher.expects.do_things.yields(:bean1,:bean2).raises("Too crunchy") + # + def yields(*items) + @options[:suppress_arguments_to_block] = true + if items.empty? + # Yield once + @options[:block] = lambda do |block| + if block.arity != 0 and block.arity != -1 + raise ExpectationError.new("The given block was expected to have no parameter count; instead, got #{block.arity} to <#{to_s}>") + end + block.call + end + else + # Yield one or more specific items + @options[:block] = lambda do |block| + items.each do |item| + if item.kind_of?(Array) + if block.arity == item.size + # Unfold the array into the block's arguments: + block.call *item + elsif block.arity == 1 + # Just pass the array in + block.call item + else + # Size mismatch + raise ExpectationError.new("Can't pass #{item.inspect} to block with arity #{block.arity} to <#{to_s}>") + end + else + if block.arity != 1 + # Size mismatch + raise ExpectationError.new("Can't pass #{item.inspect} to block with arity #{block.arity} to <#{to_s}>") + end + block.call item + end + end + end + end + self + end + + def to_s # :nodoc: + format_method_call_string(@options[:mock],@options[:method],@options[:arguments]) + end + + private + def anger(msg, mock,mname,args) + ExpectationError.new("#{msg}: expected call <#{to_s}> but was <#{format_method_call_string(mock,mname,args)}>") + end + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/expectation_builder.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/expectation_builder.rb new file mode 100644 index 0000000..7445fb1 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/expectation_builder.rb @@ -0,0 +1,9 @@ +require 'hardmock/expectation' + +module Hardmock + class ExpectationBuilder #:nodoc: + def build_expectation(options) + Expectation.new(options) + end + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/expector.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/expector.rb new file mode 100644 index 0000000..8055460 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/expector.rb @@ -0,0 +1,26 @@ +require 'hardmock/method_cleanout' +require 'hardmock/errors' + +module Hardmock + class Expector #:nodoc: + include MethodCleanout + + def initialize(mock,mock_control,expectation_builder) + @mock = mock + @mock_control = mock_control + @expectation_builder = expectation_builder + end + + def method_missing(mname, *args, &block) + expectation = @expectation_builder.build_expectation( + :mock => @mock, + :method => mname, + :arguments => args, + :block => block) + + @mock_control.add_expectation expectation + expectation + end + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/method_cleanout.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/method_cleanout.rb new file mode 100644 index 0000000..51797e6 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/method_cleanout.rb @@ -0,0 +1,33 @@ + +module Hardmock #:nodoc: + module MethodCleanout #:nodoc: + SACRED_METHODS = %w{ + __id__ + __send__ + equal? + object_id + send + nil? + class + kind_of? + respond_to? + inspect + method + to_s + instance_variables + instance_eval + == + hm_metaclass + hm_meta_eval + hm_meta_def + } + + def self.included(base) #:nodoc: + base.class_eval do + instance_methods.each do |m| + undef_method m unless SACRED_METHODS.include?(m.to_s) + end + end + end + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/mock.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/mock.rb new file mode 100644 index 0000000..928c432 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/mock.rb @@ -0,0 +1,180 @@ + +module Hardmock + # Mock is used to set expectations in your test. Most of the time you'll use + # #expects to create expectations. + # + # Aside from the scant few control methods (like +expects+, +trap+ and +_verify+) + # all calls made on a Mock instance will be immediately applied to the internal + # expectation mechanism. + # + # * If the method call was expected and all the parameters match properly, execution continues + # * If the expectation was configured with an expectation block, the block is invoked + # * If the expectation was set up to raise an error, the error is raised now + # * If the expectation was set up to return a value, it is returned + # * If the method call was _not_ expected, or the parameter values are wrong, an ExpectationError is raised. + class Mock + include Hardmock::MethodCleanout + + # Create a new Mock instance with a name and a MockControl to support it. + # If not given, a MockControl is made implicitly for this Mock alone; this means + # expectations for this mock are not tied to other expectations in your test. + # + # It's not recommended to use a Mock directly; see Hardmock and + # Hardmock#create_mocks for the more wholistic approach. + def initialize(name, mock_control=nil) + @name = name + @control = mock_control || MockControl.new + @expectation_builder = ExpectationBuilder.new + end + + def inspect + "" + end + + # Begin declaring an expectation for this Mock. + # + # == Simple Examples + # Expect the +customer+ to be queried for +account+, and return "The + # Account": + # @customer.expects.account.returns "The Account" + # + # Expect the +withdraw+ method to be called, and raise an exception when it + # is (see Expectation#raises for more info): + # @cash_machine.expects.withdraw(20,:dollars).raises("not enough money") + # + # Expect +customer+ to have its +user_name+ set + # @customer.expects.user_name = 'Big Boss' + # + # Expect +customer+ to have its +user_name+ set, and raise a RuntimeException when + # that happens: + # @customer.expects('user_name=', "Big Boss").raises "lost connection" + # + # Expect +evaluate+ to be passed a block, and when that happens, pass a value + # to the block (see Expectation#yields for more info): + # @cruncher.expects.evaluate.yields("some data").returns("some results") + # + # + # == Expectation Blocks + # To do special handling of expected method calls when they occur, you + # may pass a block to your expectation, like: + # @page_scraper.expects.handle_content do |address,request,status| + # assert_not_nil address, "Can't abide nil addresses" + # assert_equal "http-get", request.method, "Can only handle GET" + # assert status > 200 and status < 300, status, "Failed status" + # "Simulated results #{request.content.downcase}" + # end + # In this example, when page_scraper.handle_content is called, its + # three arguments are passed to the expectation block and evaluated + # using the above assertions. The last value in the block will be used + # as the return value for +handle_content+ + # + # You may specify arguments to the expected method call, just like any normal + # expectation, and those arguments will be pre-validated before being passed + # to the expectation block. This is useful when you know all of the + # expected values but still need to do something programmatic. + # + # If the method being invoked on the mock accepts a block, that block will be + # passed to your expectation block as the last (or only) argument. Eg, the + # convenience method +yields+ can be replaced with the more explicit: + # @cruncher.expects.evaluate do |block| + # block.call "some data" + # "some results" + # end + # + # The result value of the expectation block becomes the return value for the + # expected method call. This can be overidden by using the +returns+ method: + # @cruncher.expects.evaluate do |block| + # block.call "some data" + # "some results" + # end.returns("the actual value") + # + # Additionally, the resulting value of the expectation block is stored + # in the +block_value+ field on the expectation. If you've saved a reference + # to your expectation, you may retrieve the block value once the expectation + # has been met. + # + # evaluation_event = @cruncher.expects.evaluate do |block| + # block.call "some data" + # "some results" + # end.returns("the actual value") + # + # result = @cruncher.evaluate do |input| + # puts input # => 'some data' + # end + # # result is 'the actual value' + # + # evaluation_event.block_value # => 'some results' + # + def expects(*args, &block) + expector = Expector.new(self,@control,@expectation_builder) + # If there are no args, we return the Expector + return expector if args.empty? + # If there ARE args, we set up the expectation right here and return it + expector.send(args.shift.to_sym, *args, &block) + end + alias_method :expect, :expects + alias_method :should_receive, :expects + + # Special-case convenience: #trap sets up an expectation for a method + # that will take a block. That block, when sent to the expected method, will + # be trapped and stored in the expectation's +block_value+ field. + # The Expectation#trigger method may then be used to invoke that block. + # + # Like +expects+, the +trap+ mechanism can be followed by +raises+ or +returns+. + # + # _Unlike_ +expects+, you may not use an expectation block with +trap+. If + # the expected method takes arguments in addition to the block, they must + # be specified in the arguments to the +trap+ call itself. + # + # == Example + # + # create_mocks :address_book, :editor_form + # + # # Expect a subscription on the :person_added event for @address_book: + # person_event = @address_book.trap.subscribe(:person_added) + # + # # The runtime code would look like: + # @address_book.subscribe :person_added do |person_name| + # @editor_form.name = person_name + # end + # + # # At this point, the expectation for 'subscribe' is met and the + # # block has been captured. But we're not done: + # @editor_form.expects.name = "David" + # + # # Now invoke the block we trapped earlier: + # person_event.trigger "David" + # + # verify_mocks + def trap(*args) + Trapper.new(self,@control,ExpectationBuilder.new) + end + + def method_missing(mname,*args) #:nodoc: + block = nil + block = Proc.new if block_given? + @control.apply_method_call(self,mname,args,block) + end + + + def _control #:nodoc: + @control + end + + def _name #:nodoc: + @name + end + + # Verify that all expectations are fulfilled. NOTE: this method triggers + # validation on the _control_ for this mock, so all Mocks that share the + # MockControl with this instance will be included in the verification. + # + # Only use this method if you are managing your own Mocks and their controls. + # + # Normal usage of Hardmock doesn't require you to call this; let + # Hardmock#verify_mocks do it for you. + def _verify + @control.verify + end + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/mock_control.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/mock_control.rb new file mode 100644 index 0000000..302ebce --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/mock_control.rb @@ -0,0 +1,53 @@ +require 'hardmock/utils' + +module Hardmock + class MockControl #:nodoc: + include Utils + attr_accessor :name + + def initialize + clear_expectations + end + + def happy? + @expectations.empty? + end + + def disappointed? + @disappointed + end + + def add_expectation(expectation) +# puts "MockControl #{self.object_id.to_s(16)} adding expectation: #{expectation}" + @expectations << expectation + end + + def apply_method_call(mock,mname,args,block) + # Are we even expecting any sort of call? + if happy? + @disappointed = true + raise ExpectationError.new("Surprise call to #{format_method_call_string(mock,mname,args)}") + end + + begin + @expectations.shift.apply_method_call(mock,mname,args,block) + rescue Exception => ouch + @disappointed = true + raise ouch + end + end + + def verify +# puts "MockControl #{self.object_id.to_s(16)} verify: happy? #{happy?}" + @disappointed = !happy? + raise VerifyError.new("Unmet expectations", @expectations) unless happy? + end + + def clear_expectations + @expectations = [] + @disappointed = false + end + + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/stubbing.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/stubbing.rb new file mode 100644 index 0000000..0f8a293 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/stubbing.rb @@ -0,0 +1,210 @@ + + +# Stubbing support +# +# Stubs methods on classes and instances +# + +# Why's "metaid.rb" stuff crunched down: +class Object #:nodoc:# + def hm_metaclass #:nodoc:# + class << self + self + end + end + + def hm_meta_eval(&blk) #:nodoc:# + hm_metaclass.instance_eval(&blk) + end + + def hm_meta_def(name, &blk) #:nodoc:# + hm_meta_eval { define_method name, &blk } + end +end + + + +module Hardmock + + # == Hardmock: Stubbing and Mocking Concrete Methods + # + # Hardmock lets you stub and/or mock methods on concrete classes or objects. + # + # * To "stub" a concrete method is to rig it to return the same thing always, disregarding any arguments. + # * To "mock" a concrete method is to surplant its funcionality by delegating to a mock object who will cover this behavior. + # + # Mocked methods have their expectations considered along with all other mock object expectations. + # + # If you use stubbing or concrete mocking in the absence (or before creation) of other mocks, you need to invoke prepare_hardmock_control. + # Once verify_mocks or clear_expectaions is called, the overriden behavior in the target objects is restored. + # + # == Examples + # + # River.stubs!(:sounds_like).returns("gurgle") + # + # River.expects!(:jump).returns("splash") + # + # rogue.stubs!(:sounds_like).returns("pshshsh") + # + # rogue.expects!(:rawhide_tanning_solvents).returns("giant snapping turtles") + # + module Stubbing + # Exists only for documentation + end + + class ReplacedMethod #:nodoc:# + attr_reader :target, :method_name + + def initialize(target, method_name) + @target = target + @method_name = method_name + + Hardmock.track_replaced_method self + end + end + + class StubbedMethod < ReplacedMethod #:nodoc:# + def invoke(args) + raise @raises if @raises + @return_value + end + + def returns(stubbed_return) + @return_value = stubbed_return + end + + def raises(err) + err = RuntimeError.new(err) unless err.kind_of?(Exception) + @raises = err + end + end + + class ::Object + def stubs!(method_name) + method_name = method_name.to_s + already_stubbed = Hardmock.has_replaced_method?(self, method_name) + + stubbed_method = Hardmock::StubbedMethod.new(self, method_name) + + + unless _is_mock? or already_stubbed + if methods.include?(method_name.to_s) + hm_meta_eval do + alias_method "_hardmock_original_#{method_name}".to_sym, method_name.to_sym + end + end + end + + hm_meta_def method_name do |*args| + stubbed_method.invoke(args) + end + + stubbed_method + end + + def expects!(method_name, *args, &block) + if self._is_mock? + raise Hardmock::StubbingError, "Cannot use 'expects!(:#{method_name})' on a Mock object; try 'expects' instead" + end + + method_name = method_name.to_s + + @_my_mock = Mock.new(_my_name, $main_mock_control) if @_my_mock.nil? + + unless Hardmock.has_replaced_method?(self, method_name) + # Track the method as replaced + Hardmock::ReplacedMethod.new(self, method_name) + + # Preserver original implementation of the method by aliasing it away + if methods.include?(method_name) + hm_meta_eval do + alias_method "_hardmock_original_#{method_name}".to_sym, method_name.to_sym + end + end + + # Re-define the method to utilize our patron mock instance. + # (This global-temp-var thing is hokey but I was having difficulty generating + # code for the meta class.) + begin + $method_text_temp = %{ + def #{method_name}(*args,&block) + @_my_mock.__send__(:#{method_name}, *args, &block) + end + } + class << self + eval $method_text_temp + end + ensure + $method_text_temp = nil + end + end + + return @_my_mock.expects(method_name, *args, &block) + end + + def _is_mock? + self.kind_of?(Mock) + end + + def _my_name + self.kind_of?(Class) ? self.name : self.class.name + end + + def _clear_mock + @_my_mock = nil + end + + end + + class ::NilClass + # Use this only if you really mean it + alias_method :intentionally_stubs!, :stubs! + + # Use this only if you really mean it + alias_method :intentionally_expects!, :expects! + + # Overridden to protect against accidental nil reference self delusion + def stubs!(mname) + raise StubbingError, "Cannot stub #{mname} method on nil. (If you really mean to, try 'intentionally_stubs!')" + end + + # Overridden to protect against accidental nil reference self delusion + def expects!(mname, *args) + raise StubbingError, "Cannot mock #{mname} method on nil. (If you really mean to, try 'intentionally_expects!')" + end + end + + class << self + def track_replaced_method(replaced_method) + all_replaced_methods << replaced_method + end + + def all_replaced_methods + $all_replaced_methods ||= [] + end + + def has_replaced_method?(obj, method_name) + hits = all_replaced_methods.select do |replaced| + (replaced.target.object_id == obj.object_id) and (replaced.method_name.to_s == method_name.to_s) + end + return !hits.empty? + end + + def restore_all_replaced_methods + all_replaced_methods.each do |replaced| + unless replaced.target._is_mock? + backed_up = "_hardmock_original_#{replaced.method_name}" + if replaced.target.methods.include?(backed_up) + replaced.target.hm_meta_eval do + alias_method replaced.method_name.to_sym, backed_up.to_sym + end + end + replaced.target._clear_mock + end + end + all_replaced_methods.clear + end + end + +end + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/trapper.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/trapper.rb new file mode 100644 index 0000000..6aab176 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/trapper.rb @@ -0,0 +1,31 @@ +require 'test/unit/assertions' +require 'hardmock/errors' + +module Hardmock + class Trapper #:nodoc: + include Hardmock::MethodCleanout + + def initialize(mock,mock_control,expectation_builder) + @mock = mock + @mock_control = mock_control + @expectation_builder = expectation_builder + end + + def method_missing(mname, *args) + if block_given? + raise ExpectationError.new("Don't pass blocks when using 'trap' (setting exepectations for '#{mname}')") + end + + the_block = lambda { |target_block| target_block } + expectation = @expectation_builder.build_expectation( + :mock => @mock, + :method => mname, + :arguments => args, + :suppress_arguments_to_block => true, + :block => the_block) + + @mock_control.add_expectation expectation + expectation + end + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/utils.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/utils.rb new file mode 100644 index 0000000..1740577 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/utils.rb @@ -0,0 +1,9 @@ + +module Hardmock + module Utils #:nodoc: + def format_method_call_string(mock,mname,args) + arg_string = args.map { |a| a.inspect }.join(', ') + call_text = "#{mock._name}.#{mname}(#{arg_string})" + end + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/lib/test_unit_before_after.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/lib/test_unit_before_after.rb new file mode 100644 index 0000000..0499e39 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/lib/test_unit_before_after.rb @@ -0,0 +1,169 @@ +require 'test/unit' +require 'test/unit/testcase' +require 'test/unit/assertions' + +module Test #:nodoc:# + module Unit #:nodoc:# + + # == TestCase Modifications + # + # Monkey-patch to provide a formal mechanism for appending actions to be executed after teardown. + # Use after_teardown to define one or more actions to be executed after teardown for ALL tests. + # + # COMING SOON? + # * (maybe?) Hooks for before_teardown, after_setup, on_error + # * (maybe?) Options for positional control, eg, after_teardown :before_other_actions + # * (maybe?) Provide tagging/filtering so action execution can be controlled specifically? + # + # == Usage + # + # Invoke TestCase.after_teardown with optional parameter, which will be invoked with a reference + # to the test instance that has just been torn down. + # + # Example: + # + # Test::Unit::TestCase.after_teardown do |test| + # test.verify_mocks + # end + # + # == Justification + # + # There are a number of tools and libraries that play fast-n-loose with setup and teardown by + # wrapping them, and by overriding method_added as a means of upholding special setup/teardown + # behavior, usually by re-wrapping newly defined user-level setup/teardown methods. + # mocha and active_record/fixtures (and previously, hardmock) will fight for this + # territory with often unpredictable results. + # + # We wouldn't have to battle if Test::Unit provided a formal pre- and post- hook mechanism. + # + class TestCase + + class << self + + # Define an action to be run after teardown. Subsequent calls result in + # multiple actions. The block will be given a reference to the test + # being executed. + # + # Example: + # + # Test::Unit::TestCase.after_teardown do |test| + # test.verify_mocks + # end + def after_teardown(&block) + post_teardown_actions << block + end + + # Used internally. Access the list of post teardown actions for to be + # used by all tests. + def post_teardown_actions + @@post_teardown_actions ||= [] + end + + # Define an action to be run before setup. Subsequent calls result in + # multiple actions, EACH BEING PREPENDED TO THE PREVIOUS. + # The block will be given a reference to the test being executed. + # + # Example: + # + # Test::Unit::TestCase.before_setup do |test| + # test.prepare_hardmock_control + # end + def before_setup(&block) + pre_setup_actions.unshift block + end + + # Used internally. Access the list of post teardown actions for to be + # used by all tests. + def pre_setup_actions + @@pre_setup_actions ||= [] + end + end + + # OVERRIDE: This is a reimplementation of the default "run", updated to + # execute actions after teardown. + def run(result) + yield(STARTED, name) + @_result = result + begin + execute_pre_setup_actions(self) + setup + __send__(@method_name) + rescue Test::Unit::AssertionFailedError => e + add_failure(e.message, auxiliary_backtrace_filter(e.backtrace)) + rescue Exception + raise if should_passthru_exception($!) # See implementation; this is for pre-1.8.6 compat + add_error($!) + ensure + begin + teardown + rescue Test::Unit::AssertionFailedError => e + add_failure(e.message, auxiliary_backtrace_filter(e.backtrace)) + rescue Exception + raise if should_passthru_exception($!) # See implementation; this is for pre-1.8.6 compat + add_error($!) + ensure + execute_post_teardown_actions(self) + end + end + result.add_run + yield(FINISHED, name) + end + + private + + # Run through the after_teardown actions, treating failures and errors + # in the same way that "run" does: they are reported, and the remaining + # actions are executed. + def execute_post_teardown_actions(test_instance) + self.class.post_teardown_actions.each do |action| + begin + action.call test_instance + rescue Test::Unit::AssertionFailedError => e + add_failure(e.message, auxiliary_backtrace_filter(e.backtrace)) + rescue Exception + raise if should_passthru_exception($!) + add_error($!) + end + end + end + + # Run through the before_setup actions. + # Failures or errors cause execution to stop. + def execute_pre_setup_actions(test_instance) + self.class.pre_setup_actions.each do |action| +# begin + action.call test_instance +# rescue Test::Unit::AssertionFailedError => e +# add_failure(e.message, auxiliary_backtrace_filter(e.backtrace)) +# rescue Exception +# raise if should_passthru_exception($!) +# add_error($!) +# end + end + end + + # Make sure that this extension doesn't show up in failure backtraces + def auxiliary_backtrace_filter(trace) + trace.reject { |x| x =~ /test_unit_before_after/ } + end + + # Is the given error of the type that we allow to fly out (rather than catching it)? + def should_passthru_exception(ex) + return passthrough_exception_types.include?($!.class) + end + + # Provide a list of exception types that are to be allowed to explode out. + # Pre-ruby-1.8.6 doesn't use this functionality, so the PASSTHROUGH_EXCEPTIONS + # constant won't be defined. This methods defends against that and returns + # an empty list instead. + def passthrough_exception_types + begin + return PASSTHROUGH_EXCEPTIONS + rescue NameError + # older versions of test/unit do not have PASSTHROUGH_EXCEPTIONS constant + return [] + end + end + end + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/rake_tasks/rdoc.rake b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/rake_tasks/rdoc.rake new file mode 100644 index 0000000..6a6d79f --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/rake_tasks/rdoc.rake @@ -0,0 +1,19 @@ +require 'rake/rdoctask' +require File.expand_path(File.dirname(__FILE__) + "/rdoc_options.rb") + +namespace :doc do + + desc "Generate RDoc documentation" + Rake::RDocTask.new { |rdoc| + rdoc.rdoc_dir = 'doc' + rdoc.title = "Hardmock: Strict expectation-based mock object library " + add_rdoc_options(rdoc.options) + rdoc.rdoc_files.include('lib/**/*.rb', 'README','CHANGES','LICENSE') + } + + task :show => [ 'doc:rerdoc' ] do + sh "open doc/index.html" + end + +end + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/rake_tasks/rdoc_options.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/rake_tasks/rdoc_options.rb new file mode 100644 index 0000000..85bf4ce --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/rake_tasks/rdoc_options.rb @@ -0,0 +1,4 @@ + +def add_rdoc_options(options) + options << '--line-numbers' << '--inline-source' << '--main' << 'README' << '--title' << 'Hardmock' +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/rake_tasks/test.rake b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/rake_tasks/test.rake new file mode 100644 index 0000000..85a3753 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/rake_tasks/test.rake @@ -0,0 +1,22 @@ +require 'rake/testtask' + +namespace :test do + + desc "Run unit tests" + Rake::TestTask.new("units") { |t| + t.libs << "test" + t.pattern = 'test/unit/*_test.rb' + t.verbose = true + } + + desc "Run functional tests" + Rake::TestTask.new("functional") { |t| + t.libs << "test" + t.pattern = 'test/functional/*_test.rb' + t.verbose = true + } + + desc "Run all the tests" + task :all => [ 'test:units', 'test:functional' ] + +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/assert_error_test.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/assert_error_test.rb new file mode 100644 index 0000000..e4b35cf --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/assert_error_test.rb @@ -0,0 +1,52 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'assert_error' + +class AssertErrorTest < Test::Unit::TestCase + + it "specfies an error type and message that should be raised" do + assert_error RuntimeError, "Too funky" do + raise RuntimeError.new("Too funky") + end + end + + it "flunks if the error message is wrong" do + err = assert_raise Test::Unit::AssertionFailedError do + assert_error RuntimeError, "not good" do + raise RuntimeError.new("Too funky") + end + end + assert_match(/not good/i, err.message) + assert_match(/too funky/i, err.message) + end + + it "flunks if the error type is wrong" do + err = assert_raise Test::Unit::AssertionFailedError do + assert_error StandardError, "Too funky" do + raise RuntimeError.new("Too funky") + end + end + assert_match(/StandardError/i, err.message) + assert_match(/RuntimeError/i, err.message) + end + + it "can match error message text using a series of Regexps" do + assert_error StandardError, /too/i, /funky/i do + raise StandardError.new("Too funky") + end + end + + it "flunks if the error message doesn't match all the Regexps" do + err = assert_raise Test::Unit::AssertionFailedError do + assert_error StandardError, /way/i, /too/i, /funky/i do + raise StandardError.new("Too funky") + end + end + assert_match(/way/i, err.message) + end + + it "can operate without any message specification" do + assert_error StandardError do + raise StandardError.new("ooof") + end + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/auto_verify_test.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/auto_verify_test.rb new file mode 100644 index 0000000..1b005bd --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/auto_verify_test.rb @@ -0,0 +1,178 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'fileutils' + +class AutoVerifyTest < Test::Unit::TestCase + + def setup + @expect_unmet_expectations = true + end + + def teardown + remove_temp_test_file + end + + # + # TESTS + # + + it "auto-verifies all mocks in teardown" do + write_and_execute_test + end + + it "auto-verifies even if user defines own teardown" do + @teardown_code =<<-EOM + def teardown + # just in the way + end + EOM + write_and_execute_test + end + + should "not obscure normal failures when verification fails" do + @test_code =<<-EOM + def test_setup_doomed_expectation + create_mock :automobile + @automobile.expects.start + flunk "natural failure" + end + EOM + @expect_failures = 1 + write_and_execute_test + end + + should "not skip user-defined teardown when verification fails" do + @teardown_code =<<-EOM + def teardown + puts "User teardown" + end + EOM + write_and_execute_test + assert_output_contains(/User teardown/) + end + + it "is quiet when verification is ok" do + @test_code =<<-EOM + def test_ok + create_mock :automobile + @automobile.expects.start + @automobile.start + end + EOM + @teardown_code =<<-EOM + def teardown + puts "User teardown" + end + EOM + @expect_unmet_expectations = false + @expect_failures = 0 + @expect_errors = 0 + write_and_execute_test + assert_output_contains(/User teardown/) + end + + should "auto-verify even if user teardown explodes" do + @teardown_code =<<-EOM + def teardown + raise "self destruct" + end + EOM + @expect_errors = 2 + write_and_execute_test + assert_output_contains(/self destruct/) + end + + it "plays nice with inherited teardown methods" do + @full_code ||=<<-EOTEST + require File.expand_path(File.dirname(__FILE__) + "/../test_helper") + require 'hardmock' + class Test::Unit::TestCase + def teardown + puts "Test helper teardown" + end + end + class DummyTest < Test::Unit::TestCase + def test_prepare_to_die + create_mock :automobile + @automobile.expects.start + end + end + EOTEST + write_and_execute_test + assert_output_contains(/Test helper teardown/) + end + + # + # HELPERS + # + + def temp_test_file + File.expand_path(File.dirname(__FILE__) + "/tear_down_verification_test.rb") + end + + def run_test(tbody) + File.open(temp_test_file,"w") { |f| f.print(tbody) } + @test_output = `ruby #{temp_test_file} 2>&1` + end + + def formatted_test_output + if @test_output + @test_output.split(/\n/).map { |line| "> #{line}" }.join("\n") + else + "(NO TEST OUTPUT!)" + end + end + + def remove_temp_test_file + FileUtils::rm_f temp_test_file + end + + def assert_results(h) + if @test_output !~ /#{h[:tests]} tests, [0-9]+ assertions, #{h[:failures]} failures, #{h[:errors]} errors/ + flunk "Test results didn't match #{h.inspect}:\n#{formatted_test_output}" + end + end + + def assert_output_contains(*patterns) + patterns.each do |pattern| + if @test_output !~ pattern + flunk "Test output didn't match #{pattern.inspect}:\n#{formatted_test_output}" + end + end + end + + def assert_output_doesnt_contain(*patterns) + patterns.each do |pattern| + assert @test_output !~ pattern, "Output shouldn't match #{pattern.inspect} but it does." + end + end + + def write_and_execute_test + @test_code ||=<<-EOM + def test_setup_doomed_expectation + create_mock :automobile + @automobile.expects.start + end + EOM + @full_code ||=<<-EOTEST + require File.expand_path(File.dirname(__FILE__) + "/../test_helper") + require 'hardmock' + class DummyTest < Test::Unit::TestCase + #{@teardown_code} + #{@test_code} + end + EOTEST + run_test @full_code + + if @expect_unmet_expectations + assert_output_contains(/unmet expectations/i, /automobile/, /start/) + else + assert_output_doesnt_contain(/unmet expectations/i, /automobile/, /start/) + end + + @expect_tests ||= 1 + @expect_failures ||= 0 + @expect_errors ||= 1 + assert_results :tests => @expect_tests, :failures => @expect_failures, :errors => @expect_errors + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/direct_mock_usage_test.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/direct_mock_usage_test.rb new file mode 100644 index 0000000..dcf2b2a --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/direct_mock_usage_test.rb @@ -0,0 +1,396 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock' + +class DirectMockUsageTest < Test::Unit::TestCase + + def setup + @bird = Mock.new('bird') + end + + def teardown + end + + # + # TESTS + # + + it "raises VerifyError if expected method not called" do + @bird.expects.flap_flap + + err = assert_raise VerifyError do + @bird._verify + end + assert_match(/unmet expectations/i, err.message) + end + + should "not raise when expected calls are made in order" do + @bird.expects.flap_flap + @bird.expects.bang + @bird.expects.plop + + @bird.flap_flap + @bird.bang + @bird.plop + + @bird._verify + end + + it "raises ExpectationError when unexpected method are called" do + @bird.expects.flap_flap + + err = assert_raise ExpectationError do + @bird.shoot + end + assert_match(/wrong method/i, err.message) + end + + it "raises ExpectationError on bad arguments" do + @bird.expects.flap_flap(:swoosh) + + err = assert_raise ExpectationError do + @bird.flap_flap(:rip) + end + assert_match(/wrong arguments/i, err.message) + end + + it "raises VerifyError when not all expected methods are called" do + @bird.expects.flap_flap + @bird.expects.bang + @bird.expects.plop + + @bird.flap_flap + + err = assert_raise VerifyError do + @bird._verify + end + assert_match(/unmet expectations/i, err.message) + end + + it "raises ExpectationError when calls are made out of order" do + @bird.expects.flap_flap + @bird.expects.bang + @bird.expects.plop + + @bird.flap_flap + err = assert_raise ExpectationError do + @bird.plop + end + assert_match(/wrong method/i, err.message) + end + + it "returns the configured value" do + @bird.expects.plop.returns(':P') + assert_equal ':P', @bird.plop + @bird._verify + + @bird.expects.plop.returns(':x') + assert_equal ':x', @bird.plop + @bird._verify + end + + it "returns nil when no return is specified" do + @bird.expects.plop + assert_nil @bird.plop + @bird._verify + end + + it "raises the configured exception" do + err = RuntimeError.new('shaq') + @bird.expects.plop.raises(err) + actual_err = assert_raise RuntimeError do + @bird.plop + end + assert_same err, actual_err, 'should be the same error' + @bird._verify + end + + it "raises a RuntimeError when told to 'raise' a string" do + @bird.expects.plop.raises('shaq') + err = assert_raise RuntimeError do + @bird.plop + end + assert_match(/shaq/i, err.message) + @bird._verify + end + + it "raises a default RuntimeError" do + @bird.expects.plop.raises + err = assert_raise RuntimeError do + @bird.plop + end + assert_match(/error/i, err.message) + @bird._verify + end + + it "is quiet when correct arguments given" do + thing = Object.new + @bird.expects.plop(:big,'one',thing) + @bird.plop(:big,'one',thing) + @bird._verify + end + + it "raises ExpectationError when wrong number of arguments specified" do + thing = Object.new + @bird.expects.plop(:big,'one',thing) + err = assert_raise ExpectationError do + # more + @bird.plop(:big,'one',thing,:other) + end + assert_match(/wrong arguments/i, err.message) + @bird._verify + + @bird.expects.plop(:big,'one',thing) + err = assert_raise ExpectationError do + # less + @bird.plop(:big,'one') + end + assert_match(/wrong arguments/i, err.message) + @bird._verify + + @bird.expects.plop + err = assert_raise ExpectationError do + # less + @bird.plop(:big) + end + assert_match(/wrong arguments/i, err.message) + @bird._verify + end + + it "raises ExpectationError when arguments don't match" do + thing = Object.new + @bird.expects.plop(:big,'one',thing) + err = assert_raise ExpectationError do + @bird.plop(:big,'two',thing,:other) + end + assert_match(/wrong arguments/i, err.message) + @bird._verify + end + + it "can use a block for custom reactions" do + mitt = nil + @bird.expects.plop { mitt = :ball } + assert_nil mitt + @bird.plop + assert_equal :ball, mitt, 'didnt catch the ball' + @bird._verify + + @bird.expects.plop { raise 'ball' } + err = assert_raise RuntimeError do + @bird.plop + end + assert_match(/ball/i, err.message) + @bird._verify + end + + it "passes mock-call arguments to the expectation block" do + ball = nil + mitt = nil + @bird.expects.plop {|arg1,arg2| + ball = arg1 + mitt = arg2 + } + assert_nil ball + assert_nil mitt + @bird.plop(:ball,:mitt) + assert_equal :ball, ball + assert_equal :mitt, mitt + @bird._verify + end + + it "validates arguments if specified in addition to a block" do + ball = nil + mitt = nil + @bird.expects.plop(:ball,:mitt) {|arg1,arg2| + ball = arg1 + mitt = arg2 + } + assert_nil ball + assert_nil mitt + @bird.plop(:ball,:mitt) + assert_equal :ball, ball + assert_equal :mitt, mitt + @bird._verify + + ball = nil + mitt = nil + @bird.expects.plop(:bad,:stupid) {|arg1,arg2| + ball = arg1 + mitt = arg2 + } + assert_nil ball + assert_nil mitt + err = assert_raise ExpectationError do + @bird.plop(:ball,:mitt) + end + assert_match(/wrong arguments/i, err.message) + assert_nil ball + assert_nil mitt + @bird._verify + + ball = nil + mitt = nil + @bird.expects.plop(:ball,:mitt) {|arg1,arg2| + ball = arg1 + mitt = arg2 + } + assert_nil ball + assert_nil mitt + err = assert_raise ExpectationError do + @bird.plop(:ball) + end + assert_match(/wrong arguments/i, err.message) + assert_nil ball + assert_nil mitt + @bird._verify + end + + it "passes runtime blocks to the expectation block as the final argument" do + runtime_block_called = false + got_arg = nil + + # Eg, bird expects someone to subscribe to :tweet using the 'when' method + @bird.expects.when(:tweet) { |arg1, block| + got_arg = arg1 + block.call + } + + @bird.when(:tweet) do + runtime_block_called = true + end + + assert_equal :tweet, got_arg, "Wrong arg" + assert runtime_block_called, "The runtime block should have been invoked by the user block" + + @bird.expects.when(:warnk) { |e,blk| } + + err = assert_raise ExpectationError do + @bird.when(:honk) { } + end + assert_match(/wrong arguments/i, err.message) + + @bird._verify + end + + it "passes the runtime block to the expectation block as sole argument if no other args come into play" do + runtime_block_called = false + @bird.expects.subscribe { |block| block.call } + @bird.subscribe do + runtime_block_called = true + end + assert runtime_block_called, "The runtime block should have been invoked by the user block" + end + + it "provides nil as final argument if expectation block seems to want a block" do + invoked = false + @bird.expects.kablam(:scatter) { |shot,block| + assert_equal :scatter, shot, "Wrong shot" + assert_nil block, "The expectation block should get a nil block when user neglects to pass one" + invoked = true + } + @bird.kablam :scatter + assert invoked, "Expectation block not invoked" + + @bird._verify + end + + it "can set explicit return after an expectation block" do + got = nil + @bird.expects.kablam(:scatter) { |shot| + got = shot + }.returns(:death) + + val = @bird.kablam :scatter + assert_equal :death, val, "Wrong return value" + assert_equal :scatter, got, "Wrong argument" + @bird._verify + end + + it "can raise after an expectation block" do + got = nil + @bird.expects.kablam(:scatter) do |shot| + got = shot + end.raises "hell" + + err = assert_raise RuntimeError do + @bird.kablam :scatter + end + assert_match(/hell/i, err.message) + + @bird._verify + end + + it "stores the semantic value of the expectation block after it executes" do + expectation = @bird.expects.kablam(:slug) { |shot| + "The shot was #{shot}" + } + + assert_not_nil expectation, "Expectation nil" + assert_nil expectation.block_value, "Block value should start out nil" + + ret_val = @bird.kablam :slug + + assert_equal "The shot was slug", expectation.block_value + assert_equal "The shot was slug", ret_val, "Block value should also be used for return" + + @bird._verify + end + + + it "uses the value of the expectation block as the default return value" do + @bird.expects.kablam(:scatter) { |shot| + "The shot was #{shot}" + } + val = @bird.kablam :scatter + assert_equal "The shot was scatter", val, "Wrong return value" + @bird._verify + end + + it "returns the Expectation even if 'returns' is used" do + expectation = @bird.expects.kablam(:slug) { |shot| + "The shot was #{shot}" + }.returns :hosed + + assert_not_nil expectation, "Expectation nil" + assert_nil expectation.block_value, "Block value should start out nil" + + ret_val = @bird.kablam :slug + + assert_equal "The shot was slug", expectation.block_value + assert_equal :hosed, ret_val, "Block value should also be used for return" + + @bird._verify + end + + it "returns the Expectation even if 'raises' is used" do + expectation = @bird.expects.kablam(:slug) { |shot| + "The shot was #{shot}" + }.raises "aiee!" + + assert_not_nil expectation, "Expectation nil" + assert_nil expectation.block_value, "Block value should start out nil" + + err = assert_raise RuntimeError do + @bird.kablam :slug + end + assert_match(/aiee!/i, err.message) + assert_equal "The shot was slug", expectation.block_value + @bird._verify + end + + + it "supports assignment-style methods" do + @bird.expects.size = "large" + @bird.size = "large" + @bird._verify + end + + it "supports assignments and raising (using explicit-method syntax)" do + @bird.expects('size=','large').raises "boom" + + err = assert_raise RuntimeError do + @bird.size = "large" + end + assert_match(/boom/i, err.message) + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/hardmock_test.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/hardmock_test.rb new file mode 100644 index 0000000..159d369 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/hardmock_test.rb @@ -0,0 +1,434 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock' +require 'assert_error' + +class HardmockTest < Test::Unit::TestCase + + # + # TESTS + # + + it "conveniently creates mocks using create_mock and create_mocks" do + + h = create_mock :donkey + assert_equal [ :donkey ], h.keys + + assert_mock_exists :donkey + assert_same @donkey, h[:donkey] + + assert_equal [ :donkey ], @all_mocks.keys, "Wrong keyset for @all_mocks" + + h2 = create_mocks :cat, 'dog' # symbol/string indifference at this level + assert_equal [:cat,:dog].to_set, h2.keys.to_set, "Wrong keyset for second hash" + assert_equal [:cat,:dog,:donkey].to_set, @all_mocks.keys.to_set, "@all_mocks wrong" + + assert_mock_exists :cat + assert_same @cat, h2[:cat] + assert_mock_exists :dog + assert_same @dog, h2[:dog] + + assert_mock_exists :donkey + end + + it "provides literal 'expects' syntax" do + assert_nil @order, "Should be no @order yet" + create_mock :order + assert_not_nil @order, "@order should be built" + + # Setup an expectation + @order.expects.update_stuff :key1 => 'val1', :key2 => 'val2' + + # Use the mock + @order.update_stuff :key1 => 'val1', :key2 => 'val2' + + # Verify + verify_mocks + + # See that it's ok to do it again + verify_mocks + end + + it "supports 'with' for specifying argument expectations" do + create_mocks :car + @car.expects(:fill).with('gas','booze') + @car.fill('gas', 'booze') + verify_mocks + end + + it "supports several mocks at once" do + create_mocks :order_builder, :order, :customer + + @order_builder.expects.create_new_order.returns @order + @customer.expects.account_number.returns(1234) + @order.expects.account_no = 1234 + @order.expects.save! + + # Run "the code" + o = @order_builder.create_new_order + o.account_no = @customer.account_number + o.save! + + verify_mocks + end + + it "enforces inter-mock call ordering" do + create_mocks :order_builder, :order, :customer + + @order_builder.expects.create_new_order.returns @order + @customer.expects.account_number.returns(1234) + @order.expects.account_no = 1234 + @order.expects.save! + + # Run "the code" + o = @order_builder.create_new_order + err = assert_raise ExpectationError do + o.save! + end + assert_match(/wrong object/i, err.message) + assert_match(/order.save!/i, err.message) + assert_match(/customer.account_number/i, err.message) + + assert_error VerifyError, /unmet expectations/i do + verify_mocks + end + end + + class UserPresenter + def initialize(args) + view = args[:view] + model = args[:model] + model.when :data_changes do + view.user_name = model.user_name + end + view.when :user_edited do + model.user_name = view.user_name + end + end + end + + it "makes MVP testing simple" do + mox = create_mocks :model, :view + + data_change = @model.expects.when(:data_changes) { |evt,block| block } + user_edit = @view.expects.when(:user_edited) { |evt,block| block } + + UserPresenter.new mox + + # Expect user name transfer from model to view + @model.expects.user_name.returns 'Da Croz' + @view.expects.user_name = 'Da Croz' + # Trigger data change event in model + data_change.block_value.call + + # Expect user name transfer from view to model + @view.expects.user_name.returns '6:8' + @model.expects.user_name = '6:8' + # Trigger edit event in view + user_edit.block_value.call + + verify_mocks + end + + it "continues to function after verify, if verification error is controlled" do + mox = create_mocks :model, :view + data_change = @model.expects.when(:data_changes) { |evt,block| block } + user_edit = @view.expects.when(:user_edited) { |evt,block| block } + UserPresenter.new mox + + # Expect user name transfer from model to view + @model.expects.user_name.returns 'Da Croz' + @view.expects.user_name = 'Da Croz' + + assert_error ExpectationError, /model.monkey_wrench/i do + @model.monkey_wrench + end + + # This should raise because of unmet expectations + assert_error VerifyError, /unmet expectations/i, /user_name/i do + verify_mocks + end + + # See that the non-forced verification remains quiet + assert_nothing_raised VerifyError do + verify_mocks(false) + end + + @model.expects.never_gonna_happen + + assert_error VerifyError, /unmet expectations/i, /never_gonna_happen/i do + verify_mocks + end + end + + class UserPresenterBroken + def initialize(args) + view = args[:view] + model = args[:model] + model.when :data_changes do + view.user_name = model.user_name + end + # no view stuff, will break appropriately + end + end + + it "flunks for typical Presenter constructor wiring failure" do + mox = create_mocks :model, :view + + data_change = @model.expects.when(:data_changes) { |evt,block| block } + user_edit = @view.expects.when(:user_edited) { |evt,block| block } + + UserPresenterBroken.new mox + + err = assert_raise VerifyError do + verify_mocks + end + assert_match(/unmet expectations/i, err.message) + assert_match(/view.when\(:user_edited\)/i, err.message) + + end + + it "provides convenient event-subscription trap syntax for MVP testing" do + mox = create_mocks :model, :view + + data_change = @model.trap.when(:data_changes) + user_edit = @view.trap.when(:user_edited) + + UserPresenter.new mox + + # Expect user name transfer from model to view + @model.expects.user_name.returns 'Da Croz' + @view.expects.user_name = 'Da Croz' + # Trigger data change event in model + data_change.trigger + + # Expect user name transfer from view to model + @view.expects.user_name.returns '6:8' + @model.expects.user_name = '6:8' + # Trigger edit event in view + user_edit.trigger + + verify_mocks + end + + it "raises if you try to pass an expectation block to 'trap'" do + create_mock :model + assert_error Hardmock::ExpectationError, /blocks/i, /trap/i do + @model.trap.when(:some_event) do raise "huh?" end + end + end + + class Grinder + def initialize(objects) + @chute = objects[:chute] + @bucket = objects[:bucket] + @blade = objects[:blade] + end + + def grind(slot) + @chute.each_bean(slot) do |bean| + @bucket << @blade.chop(bean) + end + end + end + + it "lets you write clear iteration-oriented expectations" do + grinder = Grinder.new create_mocks(:blade, :chute, :bucket) + + # Style 1: assertions on method args is done explicitly in block + @chute.expects.each_bean { |slot,block| + assert_equal :side_slot, slot, "Wrong slot" + block.call :bean1 + block.call :bean2 + } + + @blade.expects.chop(:bean1).returns(:grounds1) + @bucket.expects('<<', :grounds1) + + @blade.expects.chop(:bean2).returns(:grounds2) + @bucket.expects('<<', :grounds2) + + # Run "the code" + grinder.grind(:side_slot) + + verify_mocks + + # Style 2: assertions on method arguments done implicitly in the expectation code + @chute.expects.each_bean(:main_slot) { |slot,block| + block.call :bean3 + } + @blade.expects.chop(:bean3).returns(:grounds3) + @bucket.expects('<<', :grounds3) + grinder.grind :main_slot + verify_mocks + end + + it "further supports iteration testing using 'yield'" do + grinder = Grinder.new create_mocks(:blade, :chute, :bucket) + + @chute.expects.each_bean(:side_slot).yields :bean1, :bean2 + + @blade.expects.chop(:bean1).returns(:grounds1) + @bucket.expects('<<', :grounds1) + + @blade.expects.chop(:bean2).returns(:grounds2) + @bucket.expects('<<', :grounds2) + + grinder.grind :side_slot + + verify_mocks + end + + class HurtLocker + attr_reader :caught + def initialize(opts) + @locker = opts[:locker] + @store = opts[:store] + end + + def do_the_thing(area,data) + @locker.with_lock(area) do + @store.eat(data) + end + rescue => oops + @caught = oops + end + end + + it "makes mutex-style locking scenarios easy to test" do + hurt = HurtLocker.new create_mocks(:locker, :store) + + @locker.expects.with_lock(:main).yields + @store.expects.eat("some info") + + hurt.do_the_thing(:main, "some info") + + verify_mocks + end + + it "makes it easy to simulate error in mutex-style locking scenarios" do + hurt = HurtLocker.new create_mocks(:locker, :store) + err = StandardError.new('fmshooop') + @locker.expects.with_lock(:main).yields + @store.expects.eat("some info").raises(err) + + hurt.do_the_thing(:main, "some info") + + assert_same err, hurt.caught, "Expected that error to be handled internally" + verify_mocks + end + + it "actually returns 'false' instead of nil when mocking boolean return values" do + create_mock :car + @car.expects.ignition_on?.returns(true) + assert_equal true, @car.ignition_on?, "Should be true" + @car.expects.ignition_on?.returns(false) + assert_equal false, @car.ignition_on?, "Should be false" + end + + it "can mock most methods inherited from object using literal syntax" do + target_methods = %w|id clone display dup eql? ==| + create_mock :foo + target_methods.each do |m| + eval %{@foo.expects(m, "some stuff")} + eval %{@foo.#{m} "some stuff"} + end + end + + it "provides 'expect' as an alias for 'expects'" do + create_mock :foo + @foo.expect.boomboom + @foo.boomboom + verify_mocks + end + + it "provides 'should_receive' as an alias for 'expects'" do + create_mock :foo + @foo.should_receive.boomboom + @foo.boomboom + verify_mocks + end + + it "provides 'and_return' as an alias for 'returns'" do + create_mock :foo + @foo.expects(:boomboom).and_return :brick + assert_equal :brick, @foo.boomboom + verify_mocks + end + + it "does not interfere with a core subset of Object methods" do + create_mock :foo + @foo.method(:inspect) + @foo.inspect + @foo.to_s + @foo.instance_variables + @foo.instance_eval("") + verify_mocks + end + + it "can raise errors from within an expectation block" do + create_mock :cat + @cat.expects.meow do |arg| + assert_equal "mix", arg + raise 'HAIRBALL' + end + assert_error RuntimeError, 'HAIRBALL' do + @cat.meow("mix") + end + end + + it "can raise errors AFTER an expectation block" do + create_mock :cat + @cat.expects.meow do |arg| + assert_equal "mix", arg + end.raises('HAIRBALL') + assert_error RuntimeError, 'HAIRBALL' do + @cat.meow("mix") + end + end + + it "raises an immediate error if a mock is created with a nil name (common mistake: create_mock @cat)" do + # I make this mistake all the time: Typing in an instance var name instead of a symbol in create_mocks. + # When you do that, you're effectively passing nil(s) in as mock names. + assert_error ArgumentError, /'nil' is not a valid name for a mock/ do + create_mocks @apples, @oranges + end + end + + it "overrides 'inspect' to make nice output" do + create_mock :hay_bailer + assert_equal "", @hay_bailer.inspect, "Wrong output from 'inspect'" + end + + it "raises if prepare_hardmock_control is invoked after create_mocks, or more than once" do + create_mock :hi_there + create_mocks :another, :one + assert_error RuntimeError, /already setup/ do + prepare_hardmock_control + end + end + + should "support alias verify_hardmocks" do + create_mock :tree + @tree.expects(:grow) + assert_error VerifyError, /unmet/i do + verify_hardmocks + end + end + + # + # HELPERS + # + + def assert_mock_exists(name) + assert_not_nil @all_mocks, "@all_mocks not here yet" + mo = @all_mocks[name] + assert_not_nil mo, "Mock '#{name}' not in @all_mocks" + assert_kind_of Mock, mo, "Wrong type of object, wanted a Mock" + assert_equal name.to_s, mo._name, "Mock '#{name}' had wrong name" + ivar = self.instance_variable_get("@#{name}") + assert_not_nil ivar, "Mock '#{name}' not set as ivar" + assert_same mo, ivar, "Mock '#{name}' ivar not same as instance in @all_mocks" + assert_same @main_mock_control, mo._control, "Mock '#{name}' doesn't share the main mock control" + end +end + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/stubbing_test.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/stubbing_test.rb new file mode 100644 index 0000000..f07a670 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/stubbing_test.rb @@ -0,0 +1,479 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock' +require 'assert_error' + +class StubbingTest < Test::Unit::TestCase + + # + # TESTS + # + + it "stubs a class method (and un-stubs after reset_stubs)" do + assert_equal "stones and gravel", Concrete.pour + assert_equal "glug glug", Jug.pour + + Concrete.stubs!(:pour).returns("dust and plaster") + + 3.times do + assert_equal "dust and plaster", Concrete.pour + end + + assert_equal "glug glug", Jug.pour, "Jug's 'pour' method broken" + assert_equal "stones and gravel", Concrete._hardmock_original_pour, "Original 'pour' method not aliased" + + assert_equal "For roads", Concrete.describe, "'describe' method broken" + + reset_stubs + + assert_equal "stones and gravel", Concrete.pour, "'pour' method not restored" + assert_equal "For roads", Concrete.describe, "'describe' method broken after verify" + + end + + it "stubs several class methods" do + Concrete.stubs!(:pour).returns("sludge") + Concrete.stubs!(:describe).returns("awful") + Jug.stubs!(:pour).returns("milk") + + assert_equal "sludge", Concrete.pour + assert_equal "awful", Concrete.describe + assert_equal "milk", Jug.pour + + reset_stubs + + assert_equal "stones and gravel", Concrete.pour + assert_equal "For roads", Concrete.describe + assert_equal "glug glug", Jug.pour + end + + it "stubs instance methods" do + slab = Concrete.new + assert_equal "bonk", slab.hit + + slab.stubs!(:hit).returns("slap") + assert_equal "slap", slab.hit, "'hit' not stubbed" + + reset_stubs + + assert_equal "bonk", slab.hit, "'hit' not restored" + end + + it "stubs instance methods without breaking class methods or other instances" do + slab = Concrete.new + scrape = Concrete.new + assert_equal "an instance", slab.describe + assert_equal "an instance", scrape.describe + assert_equal "For roads", Concrete.describe + + slab.stubs!(:describe).returns("new instance describe") + assert_equal "new instance describe", slab.describe, "'describe' on instance not stubbed" + assert_equal "an instance", scrape.describe, "'describe' on 'scrape' instance broken" + assert_equal "For roads", Concrete.describe, "'describe' class method broken" + + reset_stubs + + assert_equal "an instance", slab.describe, "'describe' instance method not restored" + assert_equal "an instance", scrape.describe, "'describe' on 'scrape' instance broken after restore" + assert_equal "For roads", Concrete.describe, "'describe' class method broken after restore" + end + + should "allow stubbing of nonexistant class methods" do + Concrete.stubs!(:funky).returns('juice') + assert_equal 'juice', Concrete.funky + end + + should "allow stubbing of nonexistant instance methods" do + chunk = Concrete.new + chunk.stubs!(:shark).returns('bite') + assert_equal 'bite', chunk.shark + end + + should "allow re-stubbing" do + Concrete.stubs!(:pour).returns("one") + assert_equal "one", Concrete.pour + + Concrete.stubs!(:pour).raises("hell") + assert_error RuntimeError, /hell/ do + Concrete.pour + end + + Concrete.stubs!(:pour).returns("two") + assert_equal "two", Concrete.pour + + reset_stubs + + assert_equal "stones and gravel", Concrete.pour + end + + it "does nothing with a runtime block when simply stubbing" do + slab = Concrete.new + slab.stubs!(:hit) do |nothing| + raise "BOOOMM!" + end + slab.hit + reset_stubs + end + + it "can raise errors from a stubbed method" do + Concrete.stubs!(:pour).raises(StandardError.new("no!")) + assert_error StandardError, /no!/ do + Concrete.pour + end + end + + it "provides string syntax for convenient raising of RuntimeErrors" do + Concrete.stubs!(:pour).raises("never!") + assert_error RuntimeError, /never!/ do + Concrete.pour + end + end + + + # + # Per-method mocking on classes or instances + # + + it "mocks specific methods on existing classes, and returns the class method to normal after verification" do + + assert_equal "stones and gravel", Concrete.pour, "Concrete.pour is already messed up" + + Concrete.expects!(:pour).returns("ALIGATORS") + assert_equal "ALIGATORS", Concrete.pour + + verify_mocks + assert_equal "stones and gravel", Concrete.pour, "Concrete.pour not restored" + end + + it "flunks if expected class method is not invoked" do + + Concrete.expects!(:pour).returns("ALIGATORS") + assert_error(Hardmock::VerifyError, /Concrete.pour/, /unmet expectations/i) do + verify_mocks + end + clear_expectations + end + + it "supports all normal mock functionality for class methods" do + + Concrete.expects!(:pour, "two tons").returns("mice") + Concrete.expects!(:pour, "three tons").returns("cats") + Concrete.expects!(:pour, "four tons").raises("Can't do it") + Concrete.expects!(:pour) do |some, args| + "==#{some}+#{args}==" + end + + assert_equal "mice", Concrete.pour("two tons") + assert_equal "cats", Concrete.pour("three tons") + assert_error(RuntimeError, /Can't do it/) do + Concrete.pour("four tons") + end + assert_equal "==first+second==", Concrete.pour("first","second") + end + + + it "enforces inter-mock ordering when mocking class methods" do + create_mocks :truck, :foreman + + @truck.expects.backup + Concrete.expects!(:pour, "something") + @foreman.expects.shout + + @truck.backup + assert_error Hardmock::ExpectationError, /wrong/i, /expected call/i, /Concrete.pour/ do + @foreman.shout + end + assert_error Hardmock::VerifyError, /unmet expectations/i, /foreman.shout/ do + verify_mocks + end + clear_expectations + end + + should "allow mocking non-existant class methods" do + Concrete.expects!(:something).returns("else") + assert_equal "else", Concrete.something + end + + it "mocks specific methods on existing instances, then restore them after verify" do + + slab = Concrete.new + assert_equal "bonk", slab.hit + + slab.expects!(:hit).returns("slap") + assert_equal "slap", slab.hit, "'hit' not stubbed" + + verify_mocks + assert_equal "bonk", slab.hit, "'hit' not restored" + end + + it "flunks if expected instance method is not invoked" do + + slab = Concrete.new + slab.expects!(:hit) + + assert_error Hardmock::VerifyError, /unmet expectations/i, /Concrete.hit/ do + verify_mocks + end + clear_expectations + end + + it "supports all normal mock functionality for instance methods" do + + slab = Concrete.new + + slab.expects!(:hit, "soft").returns("hey") + slab.expects!(:hit, "hard").returns("OOF") + slab.expects!(:hit).raises("stoppit") + slab.expects!(:hit) do |some, args| + "==#{some}+#{args}==" + end + + assert_equal "hey", slab.hit("soft") + assert_equal "OOF", slab.hit("hard") + assert_error(RuntimeError, /stoppit/) do + slab.hit + end + assert_equal "==first+second==", slab.hit("first","second") + + end + + it "enforces inter-mock ordering when mocking instance methods" do + create_mocks :truck, :foreman + slab1 = Concrete.new + slab2 = Concrete.new + + @truck.expects.backup + slab1.expects!(:hit) + @foreman.expects.shout + slab2.expects!(:hit) + @foreman.expects.whatever + + @truck.backup + slab1.hit + @foreman.shout + assert_error Hardmock::ExpectationError, /wrong/i, /expected call/i, /Concrete.hit/ do + @foreman.whatever + end + assert_error Hardmock::VerifyError, /unmet expectations/i, /foreman.whatever/ do + verify_mocks + end + clear_expectations + end + + should "allow mocking non-existant instance methods" do + slab = Concrete.new + slab.expects!(:wholly).returns('happy') + assert_equal 'happy', slab.wholly + end + + should "support concrete expectations that deal with runtime blocks" do + + Concrete.expects!(:pour, "a lot") do |how_much, block| + assert_equal "a lot", how_much, "Wrong how_much arg" + assert_not_nil block, "nil runtime block" + assert_equal "the block value", block.call, "Wrong runtime block value" + end + + Concrete.pour("a lot") do + "the block value" + end + + end + + it "can stub methods on mock objects" do + create_mock :horse + @horse.stubs!(:speak).returns("silence") + @horse.stubs!(:hello).returns("nothing") + @horse.expects(:canter).returns("clip clop") + + assert_equal "silence", @horse.speak + assert_equal "clip clop", @horse.canter + assert_equal "silence", @horse.speak + assert_equal "silence", @horse.speak + assert_equal "nothing", @horse.hello + assert_equal "nothing", @horse.hello + + verify_mocks + reset_stubs + end + + it "can stub the new method and return values" do + Concrete.stubs!(:new).returns("this value") + assert_equal "this value", Concrete.new, "did not properly stub new class method" + reset_stubs + end + + it "can mock the new method and return values" do + Concrete.expects!(:new).with("foo").returns("hello") + Concrete.expects!(:new).with("bar").returns("world") + + assert_equal "hello", Concrete.new("foo"), "did not properly mock out new class method" + assert_equal "world", Concrete.new("bar"), "did not properly mock out new class method" + + verify_mocks + reset_stubs + end + + it "can mock several different class methods at once" do + sim_code = lambda do |input| + record = Multitool.find_record(input) + report = Multitool.generate_report(record) + Multitool.format_output(report) + end + + @identifier = "the id" + @record = "the record" + @report = "the report" + @output = "the output" + + Multitool.expects!(:find_record).with(@identifier).returns(@record) + Multitool.expects!(:generate_report).with(@record).returns(@report) + Multitool.expects!(:format_output).with(@report).returns(@output) + + result = sim_code.call(@identifier) + assert_equal @output, result, "Wrong output" + end + + it "can handle a mix of different and repeat class method mock calls" do + prep = lambda { + Multitool.expects!(:find_record).with("A").returns("1") + Multitool.expects!(:generate_report).with("1") + Multitool.expects!(:find_record).with("B").returns("2") + Multitool.expects!(:generate_report).with("2") + } + + prep[] + Multitool.generate_report(Multitool.find_record("A")) + Multitool.generate_report(Multitool.find_record("B")) + + prep[] + Multitool.generate_report(Multitool.find_record("A")) + assert_error Hardmock::ExpectationError, /Wrong arguments/, /find_record\("B"\)/, /find_record\("C"\)/ do + Multitool.generate_report(Multitool.find_record("C")) + end + clear_expectations + end + + it "can mock several concrete instance methods at once" do + inst = OtherMultitool.new + sim_code = lambda do |input| + record = inst.find_record(input) + report = inst.generate_report(record) + inst.format_output(report) + end + + @identifier = "the id" + @record = "the record" + @report = "the report" + @output = "the output" + + inst.expects!(:find_record).with(@identifier).returns(@record) + inst.expects!(:generate_report).with(@record).returns(@report) + inst.expects!(:format_output).with(@report).returns(@output) + + result = sim_code.call(@identifier) + assert_equal @output, result, "Wrong output" + end + + it "verifies all concrete expects! from several different expectations" do + Multitool.expects!(:find_record) + Multitool.expects!(:generate_report) + Multitool.expects!(:format_output) + + Multitool.find_record + Multitool.generate_report + + assert_error Hardmock::VerifyError, /unmet expectations/i, /format_output/i do + verify_mocks + end + end + + it "will not allow expects! to be used on a mock object" do + create_mock :cow + assert_error Hardmock::StubbingError, /expects!/, /mock/i, /something/ do + @cow.expects!(:something) + end + end + + it "does not allow stubbing on nil objects" do + [ nil, @this_is_nil ].each do |nil_obj| + assert_error Hardmock::StubbingError, /cannot/i, /nil/i, /intentionally/ do + nil_obj.stubs!(:wont_work) + end + end + end + + it "does not allow concrete method mocking on nil objects" do + [ nil, @this_is_nil ].each do |nil_obj| + assert_error Hardmock::StubbingError, /cannot/i, /nil/i, /intentionally/ do + nil_obj.expects!(:wont_work) + end + end + end + + it "provides an alternate method for stubbing on nil objects" do + @this_is_nil.intentionally_stubs!(:bogus).returns('output') + assert_equal 'output', @this_is_nil.bogus + end + + it "provides an alternate method for mocking concreate methods on nil objects" do + @this_is_nil.intentionally_expects!(:bogus).returns('output') + assert_error Hardmock::VerifyError, /unmet expectations/i, /NilClass.bogus/ do + verify_mocks + end + end + + # + # HELPERS + # + + class Concrete + def initialize; end + def self.pour + "stones and gravel" + end + + def self.describe + "For roads" + end + + def hit + "bonk" + end + + def describe + "an instance" + end + end + + class Jug + def self.pour + "glug glug" + end + end + + class Multitool + def self.find_record(*a) + raise "The real Multitool.find_record was called with #{a.inspect}" + end + def self.generate_report(*a) + raise "The real Multitool.generate_report was called with #{a.inspect}" + end + def self.format_output(*a) + raise "The real Multitool.format_output was called with #{a.inspect}" + end + end + + class OtherMultitool + def find_record(*a) + raise "The real OtherMultitool#find_record was called with #{a.inspect}" + end + def generate_report(*a) + raise "The real OtherMultitool#generate_report was called with #{a.inspect}" + end + def format_output(*a) + raise "The real OtherMultitool#format_output was called with #{a.inspect}" + end + end + +end + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/test/test_helper.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/test/test_helper.rb new file mode 100644 index 0000000..af159a4 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/test/test_helper.rb @@ -0,0 +1,43 @@ +here = File.expand_path(File.dirname(__FILE__)) +$: << here + +require "#{here}/../config/environment" +require 'test/unit' +require 'fileutils' +require 'logger' +require 'find' +require 'yaml' +require 'set' +require 'ostruct' + +class Test::Unit::TestCase + include FileUtils + + def poll(time_limit) + (time_limit * 10).to_i.times do + return true if yield + sleep 0.1 + end + return false + end + + def self.it(str, &block) + make_test_case "it", str, &block + end + + def self.should(str, &block) + make_test_case "should", str, &block + end + + def self.make_test_case(prefix, str, &block) + tname = self.name.sub(/Test$/,'') + if block + define_method "test #{prefix} #{str}" do + instance_eval &block + end + else + puts ">>> UNIMPLEMENTED CASE: #{tname}: #{str}" + end + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/expectation_builder_test.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/expectation_builder_test.rb new file mode 100644 index 0000000..f689f98 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/expectation_builder_test.rb @@ -0,0 +1,19 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/expectation_builder' + +class ExpectationBuilderTest < Test::Unit::TestCase + include Hardmock + + def test_build_expectation + builder = ExpectationBuilder.new + + ex = builder.build_expectation( :stuff => 'inside' ) + assert_not_nil ex, "Didn't build an expectation" + assert_kind_of Expectation, ex, "Wrong type!" + + # Shhhh... fragile, yes, whatever. The functional tests do the + # real testing of this anyway + assert_equal({:stuff => 'inside'}, ex.instance_variable_get('@options'), "Hash not sent to SimpleExpectation constructor") + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/expectation_test.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/expectation_test.rb new file mode 100644 index 0000000..54bd204 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/expectation_test.rb @@ -0,0 +1,372 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/expectation' +require 'hardmock/errors' +require 'assert_error' + +class ExpectationTest < Test::Unit::TestCase + include Hardmock + + def setup + @mock = TheMock.new + end + # + # HELPERS + # + + class TheMock + def _name; 'the_mock'; end + end + class OtherMock + def _name; 'other_mock'; end + end + + # + # TESTS + # + + def test_to_s + ex = Expectation.new( :mock => @mock, :method => 'a_func', :arguments => [1, "two", :three, { :four => 4 }] ) + assert_equal %|the_mock.a_func(1, "two", :three, {:four=>4})|, ex.to_s + end + + def test_apply_method_call + se = Expectation.new(:mock => @mock, :method => 'some_func', + :arguments => [1,'two',:three] ) + + # Try it good: + assert_nothing_raised ExpectationError do + se.apply_method_call( @mock, 'some_func', [1,'two',:three], nil ) + end + + # Bad func name: + err = assert_raise ExpectationError do + se.apply_method_call( @mock, 'wrong_func', [1,'two',:three], nil ) + end + assert_match(/wrong method/i, err.message) + assert_match(/wrong_func/i, err.message) + assert_match(/[1, "two", :three]/i, err.message) + assert_match(/some_func/i, err.message) + assert_match(/the_mock/i, err.message) + + # Wrong mock + err = assert_raise ExpectationError do + se.apply_method_call( OtherMock.new, 'some_func', [1,'two',:three], nil ) + end + assert_match(/[1, "two", :three]/i, err.message) + assert_match(/some_func/i, err.message) + assert_match(/the_mock/i, err.message) + assert_match(/other_mock/i, err.message) + + # Wrong args + err = assert_raise ExpectationError do + se.apply_method_call( @mock, 'some_func', [1,'two',:four], nil) + end + assert_match(/[1, "two", :three]/i, err.message) + assert_match(/[1, "two", :four]/i, err.message) + assert_match(/wrong arguments/i, err.message) + assert_match(/some_func/i, err.message) + end + + def test_apply_method_call_should_call_proc_when_given + # now with a proc + thinger = nil + the_proc = Proc.new { thinger = :shaq } + se = Expectation.new(:mock => @mock, :method => 'some_func', + :block => the_proc) + + # Try it good: + assert_nil thinger + assert_nothing_raised ExpectationError do + se.apply_method_call(@mock, 'some_func', [], nil) + end + assert_equal :shaq, thinger, 'wheres shaq??' + end + + def test_apply_method_call_passes_runtime_block_as_last_argument_to_expectation_block + + passed_block = nil + exp_block_called = false + exp_block = Proc.new { |blk| + exp_block_called = true + passed_block = blk + } + + se = Expectation.new(:mock => @mock, :method => 'some_func', :block => exp_block, + :arguments => []) + + set_flag = false + runtime_block = Proc.new { set_flag = true } + + assert_nil passed_block, "Passed block should be nil" + assert !set_flag, "set_flag should be off" + + # Go + se.apply_method_call( @mock, 'some_func', [], runtime_block) + + # Examine the passed block + assert exp_block_called, "Expectation block not called" + assert_not_nil passed_block, "Should have been passed a block" + assert !set_flag, "set_flag should still be off" + passed_block.call + assert set_flag, "set_flag should be on" + end + + def test_apply_method_call_fails_when_theres_no_expectation_block_to_handle_the_runtime_block + se = Expectation.new(:mock => @mock, :method => 'some_func', :arguments => []) + runtime_block = Proc.new { set_flag = true } + err = assert_raise ExpectationError do + se.apply_method_call( @mock, 'some_func', [], runtime_block) + end + assert_match(/unexpected block/i, err.message) + assert_match(/the_mock.some_func()/i, err.message) + end + + def test_returns + se = Expectation.new(:mock => @mock, :method => 'some_func', + :arguments => [1,'two',:three]) + + se.returns "A value" + + assert_equal "A value", se.apply_method_call(@mock, 'some_func', [1,'two',:three], nil) + end + + def test_apply_method_call_captures_block_value + the_proc = lambda { "in the block" } + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => [], :block => the_proc) + + assert_nil se.block_value, "Block value starts out nil" + + se.apply_method_call(@mock, 'do_it', [], nil) + + assert_equal "in the block", se.block_value, "Block value not captured" + end + + def test_trigger + # convenience method for block_value.call + target = false + inner_proc = lambda { target = true } + the_proc = lambda { inner_proc } + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => [], :block => the_proc) + + assert_nil se.block_value, "Block value starts out nil" + se.apply_method_call(@mock, 'do_it', [], nil) + assert_not_nil se.block_value, "Block value not set" + + assert !target, "Target should still be false" + se.trigger + assert target, "Target not true!" + end + + def test_trigger_with_arguments + # convenience method for block_value.call + target = nil + inner_proc = lambda { |one,two| target = [one,two] } + the_proc = lambda { inner_proc } + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => [], :block => the_proc) + + assert_nil se.block_value, "Block value starts out nil" + se.apply_method_call(@mock, 'do_it', [], nil) + assert_not_nil se.block_value, "Block value not set" + + assert_nil target, "target should still be nil" + se.trigger 'cat','dog' + assert_equal ['cat','dog'], target + end + + def test_trigger_nil_block_value + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => []) + + assert_nil se.block_value, "Block value starts out nil" + se.apply_method_call(@mock, 'do_it', [], nil) + assert_nil se.block_value, "Block value should still be nil" + + err = assert_raise ExpectationError do + se.trigger + end + assert_match(/do_it/i, err.message) + assert_match(/block value/i, err.message) + end + + def test_trigger_non_proc_block_value + the_block = lambda { "woops" } + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => [], :block => the_block) + + se.apply_method_call(@mock, 'do_it', [], nil) + assert_equal "woops", se.block_value + + err = assert_raise ExpectationError do + se.trigger + end + assert_match(/do_it/i, err.message) + assert_match(/trigger/i, err.message) + assert_match(/woops/i, err.message) + end + + + + def test_proc_used_for_return + the_proc = lambda { "in the block" } + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => [], :block => the_proc) + + assert_equal "in the block", se.apply_method_call(@mock, 'do_it', [], nil) + assert_equal "in the block", se.block_value, "Captured block value affected wrongly" + end + + def test_explicit_return_overrides_proc_return + the_proc = lambda { "in the block" } + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => [], :block => the_proc) + se.returns "the override" + assert_equal "the override", se.apply_method_call(@mock, 'do_it', [], nil) + assert_equal "in the block", se.block_value, "Captured block value affected wrongly" + end + + def test_yields + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] ) + se.yields :bean1, :bean2 + + things = [] + a_block = lambda { |thinger| things << thinger } + + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + assert_equal [:bean1,:bean2], things, "Wrong things" + end + + def test_yields_block_takes_no_arguments + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] ) + se.yields + + things = [] + a_block = lambda { things << 'OOF' } + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + assert_equal ['OOF'], things + end + + def test_yields_params_to_block_takes_no_arguments + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] ) + se.yields :wont_fit + + things = [] + a_block = lambda { things << 'WUP' } + + err = assert_raise ExpectationError do + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + end + assert_match(/wont_fit/i, err.message) + assert_match(/arity -1/i, err.message) + assert_equal [], things, "Wrong things" + end + + def test_yields_with_returns + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] , + :returns => 'the results') + + exp = se.yields :bean1, :bean2 + assert_same se, exp, "'yields' needs to return a reference to the expectation" + things = [] + a_block = lambda { |thinger| things << thinger } + returned = se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + assert_equal [:bean1,:bean2], things, "Wrong things" + assert_equal 'the results', returned, "Wrong return value" + end + + def test_yields_with_raises + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot], + :raises => RuntimeError.new("kerboom")) + + exp = se.yields :bean1, :bean2 + assert_same se, exp, "'yields' needs to return a reference to the expectation" + things = [] + a_block = lambda { |thinger| things << thinger } + err = assert_raise RuntimeError do + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + end + assert_match(/kerboom/i, err.message) + assert_equal [:bean1,:bean2], things, "Wrong things" + end + + def test_yields_and_inner_block_explodes + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot]) + + exp = se.yields :bean1, :bean2 + assert_same se, exp, "'yields' needs to return a reference to the expectation" + things = [] + a_block = lambda { |thinger| + things << thinger + raise "nasty" + } + err = assert_raise RuntimeError do + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + end + assert_match(/nasty/i, err.message) + assert_equal [:bean1], things, "Wrong things" + end + + def test_yields_with_several_arrays + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] ) + se.yields ['a','b'], ['c','d'] + + things = [] + a_block = lambda { |thinger| things << thinger } + + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + assert_equal [ ['a','b'], ['c','d'] ], things, "Wrong things" + end + + def test_yields_tuples + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] ) + se.yields ['a','b','c'], ['d','e','f'] + + things = [] + a_block = lambda { |left,mid,right| + things << { :left => left, :mid => mid, :right => right } + } + + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + assert_equal [ + {:left => 'a', :mid => 'b', :right => 'c' }, + {:left => 'd', :mid => 'e', :right => 'f' }, + ], things, "Wrong things" + end + + def test_yields_tuples_size_mismatch + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] ) + se.yields ['a','b','c'], ['d','e','f'] + + things = [] + a_block = lambda { |left,mid| + things << { :left => left, :mid => mid } + } + + err = assert_raise ExpectationError do + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + end + assert_match(/arity/i, err.message) + assert_match(/the_mock.each_bean/i, err.message) + assert_match(/"a", "b", "c"/i, err.message) + assert_equal [], things, "Wrong things" + end + + def test_yields_bad_block_arity + se = Expectation.new(:mock => @mock, :method => 'do_later', :arguments => [] ) + se.yields + + assert_error Hardmock::ExpectationError, /block/i, /expected/i, /no param/i, /got 2/i do + se.apply_method_call(@mock,'do_later',[],lambda { |doesnt,match| raise "Surprise!" } ) + end + end + + def test_that_arguments_can_be_added_to_expectation + expectation = Expectation.new(:mock => @mock, :method => "each_bean") + assert_same expectation, expectation.with("jello", "for", "cosby"), "should have returned the same expectation" + + err = assert_raise ExpectationError do + expectation.apply_method_call(@mock, 'each_bean', [], nil) + end + assert_match(/wrong arguments/i, err.message) + + assert_nothing_raised(ExpectationError) do + expectation.apply_method_call(@mock, 'each_bean', ["jello", "for", "cosby"], nil) + end + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/expector_test.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/expector_test.rb new file mode 100644 index 0000000..f420db2 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/expector_test.rb @@ -0,0 +1,57 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/expector' + +class ExpectorTest < Test::Unit::TestCase + include Hardmock + + class MyControl + attr_reader :added + def add_expectation(expectation) + @added ||= [] + @added << expectation + end + end + + class ExpBuilder + attr_reader :options + def build_expectation(options) + @options = options + "dummy expectation" + end + end + + def try_it_with(method_name) + mock = Object.new + mock_control = MyControl.new + builder = ExpBuilder.new + + exp = Expector.new(mock, mock_control, builder) + output = exp.send(method_name,:with, 1, 'sauce') + + assert_same mock, builder.options[:mock] + assert_equal method_name, builder.options[:method].to_s + assert_equal [:with,1,'sauce'], builder.options[:arguments] + assert_nil builder.options[:block] + assert_equal [ "dummy expectation" ], mock_control.added, + "Wrong expectation added to control" + + assert_equal "dummy expectation", output, "Expectation should have been returned" + end + + # + # TESTS + # + def test_method_missing + try_it_with 'wonder_bread' + try_it_with 'whatever' + end + + def test_methods_that_wont_trigger_method_missing + mock = Object.new + mock_control = MyControl.new + builder = ExpBuilder.new + + exp = Expector.new(mock, mock_control, builder) + assert_equal mock, exp.instance_eval("@mock") + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/method_cleanout_test.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/method_cleanout_test.rb new file mode 100644 index 0000000..7aa6293 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/method_cleanout_test.rb @@ -0,0 +1,36 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/method_cleanout' + +class MethodCleanoutTest < Test::Unit::TestCase + class Victim + OriginalMethods = instance_methods + include Hardmock::MethodCleanout + end + + def setup + @victim = Victim.new + end + + def test_should_remove_most_methods_from_a_class + expect_removed = Victim::OriginalMethods.reject { |m| + Hardmock::MethodCleanout::SACRED_METHODS.include?(m) + } + expect_removed.each do |m| + assert !@victim.respond_to?(m), "should not have method #{m}" + end + end + + def test_should_leave_the_sacred_methods_defined + Hardmock::MethodCleanout::SACRED_METHODS.each do |m| + next if m =~ /^hm_/ + assert @victim.respond_to?(m), "Sacred method '#{m}' was removed unexpectedly" + end + end + + def test_should_include_certain_important_methods_in_the_sacred_methods_list + %w|__id__ __send__ equal? object_id send nil? class kind_of? respond_to? inspect method to_s instance_variables instance_eval|.each do |m| + assert Hardmock::MethodCleanout::SACRED_METHODS.include?(m), "important method #{m} is not included in SACRED_METHODS" + end + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/mock_control_test.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/mock_control_test.rb new file mode 100644 index 0000000..3c52db6 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/mock_control_test.rb @@ -0,0 +1,175 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/utils' +require 'hardmock/errors' +require 'hardmock/mock_control' + +class MockControlTest < Test::Unit::TestCase + include Hardmock + + def setup + @unmock = OpenStruct.new( :_name => 'fakemock' ) + + @control = MockControl.new + assert @control.happy?, "Control should start out happy" + end + + def teardown + end + + # + # HELPERS + # + + class MyExp + attr_reader :mock, :mname, :args, :block + def apply_method_call(mock, mname, args, block) + @mock = mock + @mname = mname + @args = args + @block = block + end + end + + class BoomExp < MyExp + def apply_method_call(mock, mname, args, block) + super + raise "BOOM" + end + end + + # + # TESTS + # + + def test_add_exepectation_and_apply_method_call + e1 = MyExp.new + + @control.add_expectation e1 + assert !@control.happy? + + @control.apply_method_call @unmock, 'some_func', [ 'the', :args ], nil + assert @control.happy? + + assert_same @unmock, e1.mock, "Wrong mock" + assert_equal 'some_func', e1.mname, "Wrong method" + assert_equal [ 'the', :args ], e1.args, "Wrong args" + + @control.verify + end + + def test_add_exepectation_and_apply_method_call_with_block + e1 = MyExp.new + + @control.add_expectation e1 + assert !@control.happy? + + runtime_block = Proc.new { "hello" } + @control.apply_method_call @unmock, 'some_func', [ 'the', :args ], runtime_block + assert @control.happy? + + assert_same @unmock, e1.mock, "Wrong mock" + assert_equal 'some_func', e1.mname, "Wrong method" + assert_equal [ 'the', :args ], e1.args, "Wrong args" + assert_equal "hello", e1.block.call, "Wrong block in expectation" + + @control.verify + end + + def test_add_expectation_then_verify + e1 = MyExp.new + + @control.add_expectation e1 + assert !@control.happy?, "Shoudn't be happy" + err = assert_raise VerifyError do + @control.verify + end + assert_match(/unmet expectations/i, err.message) + + @control.apply_method_call @unmock, 'some_func', [ 'the', :args ], nil + assert @control.happy? + + assert_same @unmock, e1.mock, "Wrong mock" + assert_equal 'some_func', e1.mname, "Wrong method" + assert_equal [ 'the', :args ], e1.args, "Wrong args" + + @control.verify + end + + def test_expectation_explosion + be1 = BoomExp.new + + @control.add_expectation be1 + + err = assert_raise RuntimeError do + @control.apply_method_call @unmock, 'a func', [:arg], nil + end + assert_match(/BOOM/i, err.message) + + assert_same @unmock, be1.mock + assert_equal 'a func', be1.mname + assert_equal [:arg], be1.args + end + + def test_disappointment_on_bad_verify + @control.add_expectation MyExp.new + assert !@control.happy?, "Shouldn't be happy" + assert !@control.disappointed?, "too early to be disappointed" + + # See verify fails + err = assert_raise VerifyError do + @control.verify + end + assert_match(/unmet expectations/i, err.message) + + assert !@control.happy?, "Still have unmet expectation" + assert @control.disappointed?, "We should be disappointed following that failure" + + @control.apply_method_call @unmock, 'something', [], nil + assert @control.happy?, "Should be happy" + assert @control.disappointed?, "We should be skeptical" + + @control.verify + + assert !@control.disappointed?, "Should be non-disappointed" + end + + def test_disappointment_from_surprise_calls + assert @control.happy?, "Should be happy" + assert !@control.disappointed?, "too early to be disappointed" + + # See verify fails + err = assert_raise ExpectationError do + @control.apply_method_call @unmock, "something", [], nil + end + assert_match(/surprise/i, err.message) + + assert @control.happy?, "Happiness is an empty list of expectations" + assert @control.disappointed?, "We should be disappointed following that failure" + + @control.verify + assert !@control.disappointed?, "Disappointment should be gone" + end + + def test_disappointment_from_bad_calls + be1 = BoomExp.new + assert !@control.disappointed?, "Shouldn't be disappointed" + @control.add_expectation be1 + assert !@control.disappointed?, "Shouldn't be disappointed" + + err = assert_raise RuntimeError do + @control.apply_method_call @unmock, 'a func', [:arg], nil + end + assert_match(/BOOM/i, err.message) + assert @control.disappointed?, "Should be disappointed" + + assert_same @unmock, be1.mock + assert_equal 'a func', be1.mname + assert_equal [:arg], be1.args + + assert @control.happy?, "Happiness is an empty list of expectations" + @control.verify + assert !@control.disappointed?, "Disappointment should be gone" + end + + +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/mock_test.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/mock_test.rb new file mode 100644 index 0000000..2579bcc --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/mock_test.rb @@ -0,0 +1,279 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/method_cleanout' +require 'hardmock/mock' +require 'hardmock/mock_control' +require 'hardmock/expectation_builder' +require 'hardmock/expector' +require 'hardmock/trapper' + +class MockTest < Test::Unit::TestCase + include Hardmock + + def test_build_with_control + mc1 = MockControl.new + mock = Mock.new('hi', mc1) + assert_equal 'hi', mock._name, "Wrong name" + assert_same mc1, mock._control, "Wrong contol" + end + + def test_basics + mock = Mock.new('a name') + assert_equal 'a name', mock._name, "Wrong name for mock" + assert_not_nil mock._control, "Nil control in mock" + end + + def test_expects + mock = Mock.new('order') + control = mock._control + assert control.happy?, "Mock should start out satisfied" + + mock.expects.absorb_something(:location, 'garbage') + assert !control.happy?, "mock control should be unhappy" + + # Do the call + mock.absorb_something(:location, 'garbage') + assert control.happy?, "mock control should be happy again" + + # Verify + assert_nothing_raised Exception do + mock._verify + end + end + + def test_expects_using_arguments_for_method_and_arguments + mock = Mock.new('order') + mock.expects(:absorb_something, :location, 'garbage') + mock.absorb_something(:location, 'garbage') + mock._verify + end + + def test_expects_using_arguments_for_method_and_arguments_with_block + mock = Mock.new('order') + mock.expects(:absorb_something, :location, 'garbage') { |a,b,block| + assert_equal :location, a, "Wrong 'a' argument" + assert_equal 'garbage', b, "Wrong 'b' argument" + assert_equal 'innards', block.call, "Wrong block" + } + mock.absorb_something(:location, 'garbage') do "innards" end + mock._verify + end + + def test_expects_using_string_method_name + mock = Mock.new('order') + mock.expects('absorb_something', :location, 'garbage') + mock.absorb_something(:location, 'garbage') + mock._verify + end + + + def test_expects_assignment + mock = Mock.new('order') + mock.expects.account_number = 1234 + + mock.account_number = 1234 + + mock._verify + end + + def test_expects_assigment_using_arguments_for_method_and_arguments + mock = Mock.new('order') + mock.expects(:account_number=, 1234) + mock.account_number = 1234 + mock._verify + end + + def test_expects_assigment_using_string_method_name + mock = Mock.new('order') + mock.expects('account_number=', 1234) + mock.account_number = 1234 + mock._verify + end + + def test_expects_assignment_and_return_is_overruled_by_ruby_syntax + # Prove that we can set up a return but that it doesn't mean much, + # because ruby's parser will 'do the right thing' as regards semantic + # values for assignment. (That is, the rvalue of the assignment) + mock = Mock.new('order') + mock.expects(:account_number=, 1234).returns "gold" + got = mock.account_number = 1234 + mock._verify + assert_equal 1234, got, "Expected rvalue" + end + + def test_expects_assignment_and_raise + mock = Mock.new('order') + mock.expects(:account_number=, 1234).raises StandardError.new("kaboom") + err = assert_raise StandardError do + mock.account_number = 1234 + end + assert_match(/kaboom/i, err.message) + mock._verify + end + + + def test_expects_multiple + mock = Mock.new('order') + control = mock._control + + assert control.happy? + + mock.expects.one_thing :hi, { :goose => 'neck' } + mock.expects.another 5,6,7 + assert !control.happy? + + mock.one_thing :hi, { :goose => 'neck' } + assert !control.happy? + + mock.another 5,6,7 + assert control.happy? + end + + def test_surprise_call + mock = Mock.new('order') + err = assert_raise ExpectationError do + mock.uh_oh + end + assert_match(/surprise/i, err.message) + assert_match(/uh_oh/i, err.message) + + err = assert_raise ExpectationError do + mock.whoa :horse + end + assert_match(/surprise/i, err.message) + assert_match(/order\.whoa\(:horse\)/i, err.message) + end + + def test_wrong_call + mock = Mock.new('order') + mock.expects.pig 'arse' + err = assert_raise ExpectationError do + mock.whoa :horse + end + assert_match(/wrong method/i, err.message) + assert_match(/order\.whoa\(:horse\)/i, err.message) + assert_match(/order\.pig\("arse"\)/i, err.message) + end + + def test_wrong_arguments + mock = Mock.new('order') + mock.expects.go_fast(:a, 1, 'three') + + err = assert_raise ExpectationError do + mock.go_fast :a, 1, 'not right' + end + assert_match(/wrong argument/i, err.message) + assert_match(/order\.go_fast\(:a, 1, "three"\)/i, err.message) + assert_match(/order\.go_fast\(:a, 1, "not right"\)/i, err.message) + end + + def test_expects_and_return + mock = Mock.new('order') + mock.expects.delivery_date.returns Date.today + assert_equal Date.today, mock.delivery_date + mock._verify + end + + def test_expects_and_return_with_arguments + mock = Mock.new('order') + mock.expects.delivery_date(:arf,14).returns(Date.today) + assert_equal Date.today, mock.delivery_date(:arf,14) + mock._verify + end + + def test_expects_and_raise + mock = Mock.new('order') + mock.expects.delivery_date.raises StandardError.new("bloof") + + err = assert_raise StandardError do + mock.delivery_date + end + assert_match(/bloof/i, err.message) + + mock._verify + + # Try convenience argument String + mock.expects.pow.raises "hell" + err = assert_raise RuntimeError do + mock.pow + end + assert_match(/hell/i, err.message) + + mock._verify + + # Try convenience argument nothing + mock.expects.pow.raises + err = assert_raise RuntimeError do + mock.pow + end + assert_match(/an error/i, err.message) + + mock._verify + end + + def test_expects_a_runtime_block + mock = Mock.new('order') + got_val = nil + + mock.expects.when(:something) { |e,block| + got_val = block.call + } + + mock.when :something do "hi there" end + + assert_equal "hi there", got_val, "Expectation block not invoked" + mock._verify + end + + def test_trap_block + mock = Mock.new('order') + exp = mock.trap.observe + + # use it + mock.observe { "burp" } + + assert_equal "burp", exp.block_value.call + end + + def test_trap_arguments_and_block + mock = Mock.new('order') + exp = mock.trap.subscribe(:data_changed) + + # use it + mock.subscribe(:data_changed) { "burp" } + assert_equal "burp", exp.block_value.call + mock._verify + end + + def test_trap_arguments_and_block_wrong_num_args + mock = Mock.new('order') + exp = mock.trap.subscribe(:data_changed) + + assert_raise ExpectationError do + mock.subscribe(:data_changed,1) { "burp" } + end + mock._verify + end + + def test_trap_arguments_and_block_wrong_args + mock = Mock.new('order') + exp = mock.trap.subscribe(:data_changed) + + assert_raise ExpectationError do + mock.subscribe("no good") { "burp" } + end + + mock._verify + end + + def test_trap_is_not_leniant_about_arguments + mock = Mock.new('order') + exp = mock.trap.subscribe + + assert_raise ExpectationError do + mock.subscribe("no good") { "burp" } + end + + mock._verify + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/test_unit_before_after_test.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/test_unit_before_after_test.rb new file mode 100644 index 0000000..172f527 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/test_unit_before_after_test.rb @@ -0,0 +1,452 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") + +class TestUnitBeforeAfter < Test::Unit::TestCase + + # + # after_teardown + # + + it "adds TestCase.after_teardown hook for appending post-teardown actions" do + write_and_run_test :use_after_teardown => true + + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "THE TEARDOWN", + "1st after_teardown", + "2nd after_teardown", + "Finished in" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 0 + end + + should "execute all after_teardowns, even if the main teardown flunks" do + write_and_run_test :use_after_teardown => true, :flunk_in_teardown => true + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "F", + "1st after_teardown", + "2nd after_teardown", + "Finished in", + "1) Failure:", + "test_something(MyExampleTest) [_test_file_temp.rb:20]:", + "FLUNK IN TEARDOWN" + see_results :tests => 1, :assertions => 1, :failures => 1, :errors => 0 + end + + should "execute all after_teardowns, even if the main teardown explodes" do + write_and_run_test :use_after_teardown => true, :raise_in_teardown => true + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "E", + "1st after_teardown", + "2nd after_teardown", + "Finished in", + "RuntimeError: ERROR IN TEARDOWN" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 1 + end + + should "execute all after_teardowns, even if some of them flunk" do + write_and_run_test :use_after_teardown => true, :flunk_in_after_teardown => true + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "THE TEARDOWN", + "1st after_teardown", + "F", + "2nd after_teardown", + "Finished in", + "1) Failure:", + "test_something(MyExampleTest) [_test_file_temp.rb:7]:", + "Flunk in first after_teardown", + "2) Failure:", + "test_something(MyExampleTest) [_test_file_temp.rb:10]:", + "Flunk in second after_teardown" + see_results :tests => 1, :assertions => 2, :failures => 2, :errors => 0 + end + + should "execute all after_teardowns, even if some of them explode" do + write_and_run_test :use_after_teardown => true, :raise_in_after_teardown => true + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "THE TEARDOWN", + "1st after_teardown", + "E", + "2nd after_teardown", + "Finished in", + "RuntimeError: Error in first after_teardown", + "RuntimeError: Error in second after_teardown" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 2 + end + + it "will run after_teardowns in the absence of a regular teardown" do + write_and_run_test :omit_teardown => true, :use_after_teardown => true + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "1st after_teardown", + "2nd after_teardown", + "Finished in" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 0 + end + + should "not interfere with normal test writing" do + write_and_run_test + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "THE TEARDOWN", + "Finished in" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 0 + end + + it "provides a cleaned-up backtrace" do + write_and_run_test :with_failure => true + see_in_order "Loaded suite", + "THE SETUP", + "A FAILING TEST", + "F", "THE TEARDOWN", + "Finished in", + "1) Failure:", + "test_something(MyExampleTest) [_test_file_temp.rb:17]:", + "Instrumented failure.", + " is not true." + see_results :tests => 1, :assertions => 1, :failures => 1, :errors => 0 + end + + it "provides a cleaned-up backtrace, but not TOO cleaned up" do + write_and_run_test :with_failure => true, :use_helpers => true + see_in_order "Loaded suite", + "THE SETUP", + "A FAILING TEST", + "F", "THE TEARDOWN", + "Finished in", + "1) Failure:", + "test_something(MyExampleTest)\n", + "[_test_file_temp.rb:25:in `tripwire'", + "_test_file_temp.rb:21:in `my_helper'", + "_test_file_temp.rb:17:in `test_something']:", + "Instrumented failure.", + " is not true." + see_results :tests => 1, :assertions => 1, :failures => 1, :errors => 0 + end + + should "not interfere with passthrough exception types" do + if is_modern_test_unit? + write_and_run_test :raise_nasty_in_test => true + see_in_no_particular_order "Loaded suite", + "THE TEARDOWN", + "_test_file_temp.rb:16:in `test_something': NASTY ERROR (NoMemoryError)" + see_no_results + end + end + + # + # before_setup + # + + it "adds TestCase.before_setup hook for prepending pre-setup actions" do + write_and_run_test :use_before_setup => true + see_in_order "Loaded suite", + "3rd before_setup", + "2nd before_setup", + "1st before_setup", + "THE SETUP", + "A TEST", + "THE TEARDOWN", + "Finished in" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 0 + end + + should "stop executing the test on the first failure withing a before_setup action" do + write_and_run_test :use_before_setup => true, :flunk_in_before_setup => true + see_in_order "Loaded suite", + "3rd before_setup", + "2nd before_setup", + "FTHE TEARDOWN", + "1) Failure:", + "test_something(MyExampleTest) [_test_file_temp.rb:10]:", + "Flunk in 2nd before_setup." + see_results :tests => 1, :assertions => 1, :failures => 1, :errors => 0 + end + + should "stop executing the test on the first error within a before_setup action" do + write_and_run_test :use_before_setup => true, :raise_in_before_setup => true + see_in_order "Loaded suite", + "3rd before_setup", + "2nd before_setup", + "ETHE TEARDOWN", + "Finished in", + "test_something(MyExampleTest):", + "RuntimeError: Error in 2nd before_setup", + "_test_file_temp.rb:10", + "/hardmock/lib/test_unit_before_after.rb:", ":in `call'" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 1 + end + + it "will run before_setup actions in the absence of a regular setup" do + write_and_run_test :omit_setup => true, :use_before_setup => true + see_in_order "Loaded suite", + "3rd before_setup", + "2nd before_setup", + "1st before_setup", + "A TEST", + "THE TEARDOWN", + "Finished in" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 0 + end + + it "allows before_setup and after_teardown to be used at the same time" do + write_and_run_test :use_before_setup => true, :use_after_teardown => true + see_in_order "Loaded suite", + "3rd before_setup", + "2nd before_setup", + "1st before_setup", + "A TEST", + "THE TEARDOWN", + "1st after_teardown", + "2nd after_teardown", + "Finished in" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 0 + end + + # + # HELPERS + # + + def teardown + remove_test + end + + def test_filename + "_test_file_temp.rb" + end + + def remove_test + rm_f test_filename + end + + def write_and_run_test(opts={}) + write(test_filename, generate_test_code(opts)) + run_test + end + + def run_test + @output = `ruby #{test_filename} 2>&1` + end + + + def write(fname, code) + File.open(fname,"w") do |f| + f.print code + end + end + + def show_output + puts "-- BEGIN TEST OUTPUT" + puts @output + puts "-- END TEST OUTPUT" + end + + def see_in_order(*phrases) + idx = 0 + phrases.each do |txt| + idx = @output.index(txt, idx) + if idx.nil? + if @output.index(txt) + flunk "Phrase '#{txt}' is out-of-order in test output:\n#{@output}" + else + flunk "Phrase '#{txt}' not found in test output:\n#{@output}" + end + end + end + end + + def see_in_no_particular_order(*phrases) + phrases.each do |txt| + assert_not_nil @output.index(txt), "Didn't see '#{txt}' in test output:\n#{@output}" + end + end + + def see_results(opts) + if @output =~ /(\d+) tests, (\d+) assertions, (\d+) failures, (\d+) errors/ + tests, assertions, failures, errors = [ $1, $2, $3, $4 ] + [:tests, :assertions, :failures, :errors].each do |key| + eval %{assert_equal(opts[:#{key}].to_s, #{key}, "Wrong number of #{key} in report") if opts[:#{key}]} + end + else + flunk "Didn't see the test results report line" + end + end + + def see_no_results + if @output =~ /\d+ tests, \d+ assertions, \d+ failures, \d+ errors/ + flunk "Should not have had a results line:\n#{@output}" + end + end + + def lib_dir + File.expand_path(File.dirname(__FILE__) + "/../../lib") + end + + def generate_test_code(opts={}) + + if opts[:with_failure] or opts[:raise_nasty_in_test] + test_method_code = generate_failing_test("test_something", opts) + else + test_method_code = generate_passing_test("test_something") + end + + + requires_for_ext = '' + if opts[:use_before_setup] or opts[:use_after_teardown] + requires_for_ext =<<-RFE + $: << "#{lib_dir}" + require 'test_unit_before_after' + RFE + end + + before_setups = '' + if opts[:use_before_setup] + add_on_two = "" + if opts[:flunk_in_before_setup] + add_on_two = %{; test.flunk "Flunk in 2nd before_setup"} + elsif opts[:raise_in_before_setup] + add_on_two = %{; raise "Error in 2nd before_setup"} + end + before_setups =<<-BSTS + Test::Unit::TestCase.before_setup do |test| + puts "1st before_setup" + end + Test::Unit::TestCase.before_setup do |test| + puts "2nd before_setup" #{add_on_two} + end + Test::Unit::TestCase.before_setup do |test| + puts "3rd before_setup" + end + + BSTS + end + + + setup_code =<<-SC + def setup + puts "THE SETUP" + end + SC + if opts[:omit_setup] + setup_code = "" + end + + after_teardowns = '' + if opts[:use_after_teardown] + add_on_one = "" + add_on_two = "" + if opts[:flunk_in_after_teardown] + add_on_one = %{; test.flunk "Flunk in first after_teardown"} + add_on_two = %{; test.flunk "Flunk in second after_teardown"} + elsif opts[:raise_in_after_teardown] + add_on_one = %{; raise "Error in first after_teardown"} + add_on_two = %{; raise "Error in second after_teardown"} + end + after_teardowns =<<-ATDS + Test::Unit::TestCase.after_teardown do |test| + puts "1st after_teardown" #{add_on_one} + end + Test::Unit::TestCase.after_teardown do |test| + puts "2nd after_teardown" #{add_on_two} + end + ATDS + end + + teardown_code =<<-TDC + def teardown + puts "THE TEARDOWN" + end + TDC + if opts[:flunk_in_teardown] + teardown_code =<<-TDC + def teardown + flunk "FLUNK IN TEARDOWN" + end + TDC + elsif opts[:raise_in_teardown] + teardown_code =<<-TDC + def teardown + raise "ERROR IN TEARDOWN" + end + TDC + end + if opts[:omit_teardown] + teardown_code = "" + end + + str = <<-TCODE + require 'test/unit' + #{requires_for_ext} + + #{before_setups} #{after_teardowns} + + class MyExampleTest < Test::Unit::TestCase + #{setup_code} + #{teardown_code} + #{test_method_code} + end + TCODE + end + + def generate_passing_test(tname) + str = <<-TMETH + def #{tname} + puts "A TEST" + end + TMETH + end + + def generate_failing_test(tname, opts={}) + str = "NOT DEFINED?" + if opts[:raise_nasty_in_test] + str = <<-TMETH + def #{tname} + raise NoMemoryError, "NASTY ERROR" + end + TMETH + + elsif opts[:use_helpers] + str = <<-TMETH + def #{tname} + puts "A FAILING TEST" + my_helper + end + + def my_helper + tripwire + end + + def tripwire + assert false, "Instrumented failure" + end + TMETH + else + str = <<-TMETH + def #{tname} + puts "A FAILING TEST" + assert false, "Instrumented failure" + end + TMETH + end + return str + end + + def is_modern_test_unit? + begin + Test::Unit::TestCase::PASSTHROUGH_EXCEPTIONS + return true + rescue NameError + return false + end + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/trapper_test.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/trapper_test.rb new file mode 100644 index 0000000..f7d4114 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/trapper_test.rb @@ -0,0 +1,62 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/method_cleanout' +require 'hardmock/trapper' + +class TrapperTest < Test::Unit::TestCase + include Hardmock + + def setup + @mock = Object.new + @mock_control = MyControl.new + @builder = ExpBuilder.new + @trapper = Trapper.new(@mock, @mock_control, @builder) + end + + # + # HELPERS + # + + class MyControl + attr_reader :added + def add_expectation(expectation) + @added ||= [] + @added << expectation + end + end + + class ExpBuilder + attr_reader :options + def build_expectation(options) + @options = options + "dummy expectation" + end + end + + # + # TESTS + # + + def test_method_missing + + output = @trapper.change(:less) + + assert_same @mock, @builder.options[:mock] + assert_equal :change, @builder.options[:method] + assert_equal [:less], @builder.options[:arguments] + assert_not_nil @builder.options[:block] + assert @builder.options[:suppress_arguments_to_block], ":suppress_arguments_to_block should be set" + assert_equal [ "dummy expectation" ], @mock_control.added, + "Wrong expectation added to control" + + assert_equal "dummy expectation", output, "Expectation should have been returned" + + # Examine the block. It should take one argument and simply return + # that argument. because of the 'suppress arguments to block' + # setting, the argument can only end up being a block, in practice. + trapper_block = @builder.options[:block] + assert_equal "the argument", trapper_block.call("the argument"), + "The block should merely return the passed argument" + end + + +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/verify_error_test.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/verify_error_test.rb new file mode 100644 index 0000000..ecd23fd --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/verify_error_test.rb @@ -0,0 +1,40 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/method_cleanout' +require 'hardmock/mock_control' +require 'hardmock/errors' +require 'hardmock/expectation_builder' +require 'hardmock/expectation' +require 'hardmock/mock' + +class VerifyErrorTest < Test::Unit::TestCase + include Hardmock + + # + # TESTS + # + + def test_formatted_list_of_unmet_expectations + mock1 = Mock.new('mock1') + mock2 = Mock.new('mock2') + exp1 = Expectation.new( :mock => mock1, :method => 'send_parts', :arguments => [1,2,:a] ) + exp2 = Expectation.new( :mock => mock2, :method => 'grind_it', :arguments => [] ) + + exp_list = [ exp1, exp2 ] + + err = VerifyError.new("This is the error", exp_list) + assert_equal "This is the error:\n * #{exp1.to_s}\n * #{exp2.to_s}", err.message + end + + def test_empty_list_of_expectations + # this is not a normal case; not spending a lot of time to make this better + exp_list = [] + err = VerifyError.new("This is the error:\n", exp_list) + end + + def test_nil_expectation_list + # this is not a normal case; not spending a lot of time to make this better + exp_list = [] + err = VerifyError.new("This is the error:\n", exp_list) + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/auto/colour_prompt.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/auto/colour_prompt.rb new file mode 100644 index 0000000..81003dd --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/auto/colour_prompt.rb @@ -0,0 +1,94 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +if RUBY_PLATFORM =~/(win|w)32$/ + begin + require 'Win32API' + rescue LoadError + puts "ERROR! \"Win32API\" library not found" + puts "\"Win32API\" is required for colour on a windows machine" + puts " try => \"gem install Win32API\" on the command line" + puts + end + # puts + # puts 'Windows Environment Detected...' + # puts 'Win32API Library Found.' + # puts +end + +class ColourCommandLine + def initialize + if RUBY_PLATFORM =~/(win|w)32$/ + get_std_handle = Win32API.new("kernel32", "GetStdHandle", ['L'], 'L') + @set_console_txt_attrb = + Win32API.new("kernel32","SetConsoleTextAttribute",['L','N'], 'I') + @hout = get_std_handle.call(-11) + end + end + + def change_to(new_colour) + if RUBY_PLATFORM =~/(win|w)32$/ + @set_console_txt_attrb.call(@hout,self.win32_colour(new_colour)) + else + "\033[30;#{posix_colour(new_colour)};22m" + end + end + + def win32_colour(colour) + case colour + when :black then 0 + when :dark_blue then 1 + when :dark_green then 2 + when :dark_cyan then 3 + when :dark_red then 4 + when :dark_purple then 5 + when :dark_yellow, :narrative then 6 + when :default_white, :default, :dark_white then 7 + when :silver then 8 + when :blue then 9 + when :green, :success then 10 + when :cyan, :output then 11 + when :red, :failure then 12 + when :purple then 13 + when :yellow then 14 + when :white then 15 + else + 0 + end + end + + def posix_colour(colour) + case colour + when :black then 30 + when :red, :failure then 31 + when :green, :success then 32 + when :yellow then 33 + when :blue, :narrative then 34 + when :purple, :magenta then 35 + when :cyan, :output then 36 + when :white, :default_white, :default then 37 + else + 30 + end + end + + def out_c(mode, colour, str) + case RUBY_PLATFORM + when /(win|w)32$/ + change_to(colour) + $stdout.puts str if mode == :puts + $stdout.print str if mode == :print + change_to(:default_white) + else + $stdout.puts("#{change_to(colour)}#{str}\033[0m") if mode == :puts + $stdout.print("#{change_to(colour)}#{str}\033[0m") if mode == :print + end + end +end # ColourCommandLine + +def colour_puts(role,str) ColourCommandLine.new.out_c(:puts, role, str) end +def colour_print(role,str) ColourCommandLine.new.out_c(:print, role, str) end + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/auto/colour_reporter.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/auto/colour_reporter.rb new file mode 100644 index 0000000..5aa1d27 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/auto/colour_reporter.rb @@ -0,0 +1,39 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require "#{File.expand_path(File.dirname(__FILE__))}/colour_prompt" + +$colour_output = true + +def report(message) + if not $colour_output + $stdout.puts(message) + else + message = message.join('\n') if (message.class == Array) + message.each_line do |line| + line.chomp! + colour = case(line) + when /(?:total\s+)?tests:?\s+(\d+)\s+(?:total\s+)?failures:?\s+\d+\s+Ignored:?/i + ($1.to_i == 0) ? :green : :red + when /PASS/ + :green + when /^OK$/ + :green + when /(?:FAIL|ERROR)/ + :red + when /IGNORE/ + :yellow + when /^(?:Creating|Compiling|Linking)/ + :white + else + :silver + end + colour_puts(colour, line) + end + end + $stdout.flush + $stderr.flush +end \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/auto/generate_config.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/auto/generate_config.yml new file mode 100644 index 0000000..4a5e474 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/auto/generate_config.yml @@ -0,0 +1,36 @@ +#this is a sample configuration file for generate_module +#you would use it by calling generate_module with the -ygenerate_config.yml option +#files like this are useful for customizing generate_module to your environment +:generate_module: + :defaults: + #these defaults are used in place of any missing options at the command line + :path_src: ../src/ + :path_inc: ../src/ + :path_tst: ../test/ + :update_svn: true + :includes: + #use [] for no additional includes, otherwise list the includes on separate lines + :src: + - Defs.h + - Board.h + :inc: [] + :tst: + - Defs.h + - Board.h + - Exception.h + :boilerplates: + #these are inserted at the top of generated files. + #just comment out or remove if not desired. + #use %1$s where you would like the file name to appear (path/extension not included) + :src: | + //------------------------------------------- + // %1$s.c + //------------------------------------------- + :inc: | + //------------------------------------------- + // %1$s.h + //------------------------------------------- + :tst: | + //------------------------------------------- + // Test%1$s.c : Units tests for %1$s.c + //------------------------------------------- diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/auto/generate_module.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/auto/generate_module.rb new file mode 100644 index 0000000..3db1a98 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/auto/generate_module.rb @@ -0,0 +1,202 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +# This script creates all the files with start code necessary for a new module. +# A simple module only requires a source file, header file, and test file. +# Triad modules require a source, header, and test file for each triad type (like model, conductor, and hardware). + +require 'rubygems' +require 'fileutils' + +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +#help text when requested +HELP_TEXT = [ "\nGENERATE MODULE\n-------- ------", + "\nUsage: ruby generate_module [options] module_name", + " -i\"include\" sets the path to output headers to 'include' (DEFAULT ../src)", + " -s\"../src\" sets the path to output source to '../src' (DEFAULT ../src)", + " -t\"C:/test\" sets the path to output source to 'C:/test' (DEFAULT ../test)", + " -p\"MCH\" sets the output pattern to MCH.", + " dh - driver hardware.", + " dih - driver interrupt hardware.", + " mch - model conductor hardware.", + " mvp - model view presenter.", + " src - just a single source module. (DEFAULT)", + " -d destroy module instead of creating it.", + " -u update subversion too (requires subversion command line)", + " -y\"my.yml\" selects a different yaml config file for module generation", + "" ].join("\n") + +#Built in patterns +PATTERNS = { 'src' => {'' => { :inc => [] } }, + 'dh' => {'Driver' => { :inc => ['%1$sHardware.h'] }, + 'Hardware' => { :inc => [] } + }, + 'dih' => {'Driver' => { :inc => ['%1$sHardware.h', '%1$sInterrupt.h'] }, + 'Interrupt'=> { :inc => ['%1$sHardware.h'] }, + 'Hardware' => { :inc => [] } + }, + 'mch' => {'Model' => { :inc => [] }, + 'Conductor'=> { :inc => ['%1$sModel.h', '%1$sHardware.h'] }, + 'Hardware' => { :inc => [] } + }, + 'mvp' => {'Model' => { :inc => [] }, + 'Presenter'=> { :inc => ['%1$sModel.h', '%1$sView.h'] }, + 'View' => { :inc => [] } + } + } + +#TEMPLATE_TST +TEMPLATE_TST = %q[#include "unity.h" +%2$s#include "%1$s.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void test_%1$s_NeedToImplement(void) +{ + TEST_IGNORE(); +} +] + +#TEMPLATE_SRC +TEMPLATE_SRC = %q[%2$s#include "%1$s.h" +] + +#TEMPLATE_INC +TEMPLATE_INC = %q[#ifndef _%3$s_H +#define _%3$s_H%2$s + +#endif // _%3$s_H +] + +# Parse the command line parameters. +ARGV.each do |arg| + case(arg) + when /^-d/ then @destroy = true + when /^-u/ then @update_svn = true + when /^-p(\w+)/ then @pattern = $1 + when /^-s(.+)/ then @path_src = $1 + when /^-i(.+)/ then @path_inc = $1 + when /^-t(.+)/ then @path_tst = $1 + when /^-y(.+)/ then @yaml_config = $1 + when /^(\w+)/ + raise "ERROR: You can't have more than one Module name specified!" unless @module_name.nil? + @module_name = arg + when /^-(h|-help)/ + puts HELP_TEXT + exit + else + raise "ERROR: Unknown option specified '#{arg}'" + end +end +raise "ERROR: You must have a Module name specified! (use option -h for help)" if @module_name.nil? + +#load yaml file if one was requested +if @yaml_config + require 'yaml' + cfg = YAML.load_file(HERE + @yaml_config)[:generate_module] + @path_src = cfg[:defaults][:path_src] if @path_src.nil? + @path_inc = cfg[:defaults][:path_inc] if @path_inc.nil? + @path_tst = cfg[:defaults][:path_tst] if @path_tst.nil? + @update_svn = cfg[:defaults][:update_svn] if @update_svn.nil? + @extra_inc = cfg[:includes] + @boilerplates = cfg[:boilerplates] +else + @boilerplates = {} +end + +# Create default file paths if none were provided +@path_src = HERE + "../src/" if @path_src.nil? +@path_inc = @path_src if @path_inc.nil? +@path_tst = HERE + "../test/" if @path_tst.nil? +@path_src += '/' unless (@path_src[-1] == 47) +@path_inc += '/' unless (@path_inc[-1] == 47) +@path_tst += '/' unless (@path_tst[-1] == 47) +@pattern = 'src' if @pattern.nil? +@includes = { :src => [], :inc => [], :tst => [] } +@includes.merge!(@extra_inc) unless @extra_inc.nil? + +#create triad definition +TRIAD = [ { :ext => '.c', :path => @path_src, :template => TEMPLATE_SRC, :inc => :src, :boilerplate => @boilerplates[:src] }, + { :ext => '.h', :path => @path_inc, :template => TEMPLATE_INC, :inc => :inc, :boilerplate => @boilerplates[:inc] }, + { :ext => '.c', :path => @path_tst+'Test', :template => TEMPLATE_TST, :inc => :tst, :boilerplate => @boilerplates[:tst] }, + ] + +#prepare the pattern for use +@patterns = PATTERNS[@pattern.downcase] +raise "ERROR: The design pattern specified isn't one that I recognize!" if @patterns.nil? + +# Assemble the path/names of the files we need to work with. +files = [] +TRIAD.each do |triad| + @patterns.each_pair do |pattern_file, pattern_traits| + files << { + :path => "#{triad[:path]}#{@module_name}#{pattern_file}#{triad[:ext]}", + :name => "#{@module_name}#{pattern_file}", + :template => triad[:template], + :boilerplate => triad[:boilerplate], + :includes => case(triad[:inc]) + when :src then @includes[:src] | pattern_traits[:inc].map{|f| f % [@module_name]} + when :inc then @includes[:inc] + when :tst then @includes[:tst] | pattern_traits[:inc].map{|f| "Mock#{f}"% [@module_name]} + end + } + end +end + +# destroy files if that was what was requested +if @destroy + files.each do |filespec| + file = filespec[:path] + if File.exist?(file) + if @update_svn + `svn delete \"#{file}\" --force` + puts "File #{file} deleted and removed from source control" + else + FileUtils.remove(file) + puts "File #{file} deleted" + end + else + puts "File #{file} does not exist so cannot be removed." + end + end + puts "Destroy Complete" + exit +end + +#Abort if any module already exists +files.each do |file| + raise "ERROR: File #{file[:name]} already exists. Exiting." if File.exist?(file[:path]) +end + +# Create Source Modules +files.each_with_index do |file, i| + File.open(file[:path], 'w') do |f| + f.write(file[:boilerplate] % [file[:name]]) unless file[:boilerplate].nil? + f.write(file[:template] % [ file[:name], + file[:includes].map{|f| "#include \"#{f}\"\n"}.join, + file[:name].upcase ] + ) + end + if (@update_svn) + `svn add \"#{file[:path]}\"` + if $?.exitstatus == 0 + puts "File #{file[:path]} created and added to source control" + else + puts "File #{file[:path]} created but FAILED adding to source control!" + end + else + puts "File #{file[:path]} created" + end +end + +puts 'Generate Complete' diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/auto/generate_test_runner.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/auto/generate_test_runner.rb new file mode 100644 index 0000000..aff5053 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/auto/generate_test_runner.rb @@ -0,0 +1,303 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +File.expand_path(File.join(File.dirname(__FILE__),'colour_prompt')) + +class UnityTestRunnerGenerator + + def initialize(options = nil) + @options = { :includes => [], :plugins => [], :framework => :unity } + case(options) + when NilClass then @options + when String then @options.merge!(UnityTestRunnerGenerator.grab_config(options)) + when Hash then @options.merge!(options) + else raise "If you specify arguments, it should be a filename or a hash of options" + end + end + + def self.grab_config(config_file) + options = { :includes => [], :plugins => [], :framework => :unity } + unless (config_file.nil? or config_file.empty?) + require 'yaml' + yaml_guts = YAML.load_file(config_file) + options.merge!(yaml_guts[:unity] ? yaml_guts[:unity] : yaml_guts[:cmock]) + raise "No :unity or :cmock section found in #{config_file}" unless options + end + return(options) + end + + def run(input_file, output_file, options=nil) + tests = [] + includes = [] + used_mocks = [] + + @options.merge!(options) unless options.nil? + module_name = File.basename(input_file) + + #pull required data from source file + File.open(input_file, 'r') do |input| + tests = find_tests(input) + includes = find_includes(input) + used_mocks = find_mocks(includes) + end + + #build runner file + File.open(output_file, 'w') do |output| + create_header(output, used_mocks) + create_externs(output, tests, used_mocks) + create_mock_management(output, used_mocks) + create_suite_setup_and_teardown(output) + create_reset(output, used_mocks) + create_main(output, input_file, tests) + end + + all_files_used = [input_file, output_file] + all_files_used += includes.map {|filename| filename + '.c'} unless includes.empty? + all_files_used += @options[:includes] unless @options[:includes].empty? + return all_files_used.uniq + end + + def find_tests(input_file) + tests_raw = [] + tests_args = [] + tests_and_line_numbers = [] + + input_file.rewind + source_raw = input_file.read + source_scrubbed = source_raw.gsub(/\/\/.*$/, '') # remove line comments + source_scrubbed = source_scrubbed.gsub(/\/\*.*?\*\//m, '') # remove block comments + lines = source_scrubbed.split(/(^\s*\#.*$) # Treat preprocessor directives as a logical line + | (;|\{|\}) /x) # Match ;, {, and } as end of lines + + lines.each_with_index do |line, index| + #find tests + if line =~ /^((?:\s*TEST_CASE\s*\(.*?\)\s*)*)\s*void\s+(test.*?)\s*\(\s*(.*)\s*\)/ + arguments = $1 + name = $2 + call = $3 + args = nil + if (@options[:use_param_tests] and !arguments.empty?) + args = [] + arguments.scan(/\s*TEST_CASE\s*\((.*)\)\s*$/) {|a| args << a[0]} + end + tests_and_line_numbers << { :name => name, :args => args, :call => call, :line_number => 0 } + tests_args = [] + end + end + + #determine line numbers and create tests to run + source_lines = source_raw.split("\n") + source_index = 0; + tests_and_line_numbers.size.times do |i| + source_lines[source_index..-1].each_with_index do |line, index| + if (line =~ /#{tests_and_line_numbers[i][:name]}/) + source_index += index + tests_and_line_numbers[i][:line_number] = source_index + 1 + break + end + end + end + + return tests_and_line_numbers + end + + def find_includes(input_file) + input_file.rewind + includes = [] + input_file.readlines.each do |line| + scan_results = line.scan(/^\s*#include\s+\"\s*(.+)\.[hH]\s*\"/) + includes << scan_results[0][0] if (scan_results.size > 0) + end + return includes + end + + def find_mocks(includes) + mock_headers = [] + includes.each do |include_file| + mock_headers << File.basename(include_file) if (include_file =~ /^mock/i) + end + return mock_headers + end + + def create_header(output, mocks) + output.puts('/* AUTOGENERATED FILE. DO NOT EDIT. */') + create_runtest(output, mocks) + output.puts("\n//=======Automagically Detected Files To Include=====") + output.puts("#include \"#{@options[:framework].to_s}.h\"") + output.puts('#include "cmock.h"') unless (mocks.empty?) + @options[:includes].flatten.uniq.compact.each do |inc| + output.puts("#include #{inc.include?('<') ? inc : "\"#{inc.gsub('.h','')}.h\""}") + end + output.puts('#include ') + output.puts('#include ') + output.puts('#include "CException.h"') if @options[:plugins].include?(:cexception) + mocks.each do |mock| + output.puts("#include \"#{mock.gsub('.h','')}.h\"") + end + if @options[:enforce_strict_ordering] + output.puts('') + output.puts('int GlobalExpectCount;') + output.puts('int GlobalVerifyOrder;') + output.puts('char* GlobalOrderError;') + end + end + + def create_externs(output, tests, mocks) + output.puts("\n//=======External Functions This Runner Calls=====") + output.puts("extern void setUp(void);") + output.puts("extern void tearDown(void);") + tests.each do |test| + output.puts("extern void #{test[:name]}(#{test[:call]});") + end + output.puts('') + end + + def create_mock_management(output, mocks) + unless (mocks.empty?) + output.puts("\n//=======Mock Management=====") + output.puts("static void CMock_Init(void)") + output.puts("{") + if @options[:enforce_strict_ordering] + output.puts(" GlobalExpectCount = 0;") + output.puts(" GlobalVerifyOrder = 0;") + output.puts(" GlobalOrderError = NULL;") + end + mocks.each do |mock| + output.puts(" #{mock}_Init();") + end + output.puts("}\n") + + output.puts("static void CMock_Verify(void)") + output.puts("{") + mocks.each do |mock| + output.puts(" #{mock}_Verify();") + end + output.puts("}\n") + + output.puts("static void CMock_Destroy(void)") + output.puts("{") + mocks.each do |mock| + output.puts(" #{mock}_Destroy();") + end + output.puts("}\n") + end + end + + def create_suite_setup_and_teardown(output) + unless (@options[:suite_setup].nil?) + output.puts("\n//=======Suite Setup=====") + output.puts("static int suite_setup(void)") + output.puts("{") + output.puts(@options[:suite_setup]) + output.puts("}") + end + unless (@options[:suite_teardown].nil?) + output.puts("\n//=======Suite Teardown=====") + output.puts("static int suite_teardown(int num_failures)") + output.puts("{") + output.puts(@options[:suite_teardown]) + output.puts("}") + end + end + + def create_runtest(output, used_mocks) + cexception = @options[:plugins].include? :cexception + va_args1 = @options[:use_param_tests] ? ', ...' : '' + va_args2 = @options[:use_param_tests] ? '__VA_ARGS__' : '' + output.puts("\n//=======Test Runner Used To Run Each Test Below=====") + output.puts("#define RUN_TEST_NO_ARGS") if @options[:use_param_tests] + output.puts("#define RUN_TEST(TestFunc, TestLineNum#{va_args1}) \\") + output.puts("{ \\") + output.puts(" Unity.CurrentTestName = #TestFunc#{va_args2.empty? ? '' : " \"(\" ##{va_args2} \")\""}; \\") + output.puts(" Unity.CurrentTestLineNumber = TestLineNum; \\") + output.puts(" Unity.NumberOfTests++; \\") + output.puts(" if (TEST_PROTECT()) \\") + output.puts(" { \\") + output.puts(" CEXCEPTION_T e; \\") if cexception + output.puts(" Try { \\") if cexception + output.puts(" CMock_Init(); \\") unless (used_mocks.empty?) + output.puts(" setUp(); \\") + output.puts(" TestFunc(#{va_args2}); \\") + output.puts(" CMock_Verify(); \\") unless (used_mocks.empty?) + output.puts(" } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, \"Unhandled Exception!\"); } \\") if cexception + output.puts(" } \\") + output.puts(" CMock_Destroy(); \\") unless (used_mocks.empty?) + output.puts(" if (TEST_PROTECT() && !TEST_IS_IGNORED) \\") + output.puts(" { \\") + output.puts(" tearDown(); \\") + output.puts(" } \\") + output.puts(" UnityConcludeTest(); \\") + output.puts("}\n") + end + + def create_reset(output, used_mocks) + output.puts("\n//=======Test Reset Option=====") + output.puts("void resetTest()") + output.puts("{") + output.puts(" CMock_Verify();") unless (used_mocks.empty?) + output.puts(" CMock_Destroy();") unless (used_mocks.empty?) + output.puts(" tearDown();") + output.puts(" CMock_Init();") unless (used_mocks.empty?) + output.puts(" setUp();") + output.puts("}") + end + + def create_main(output, filename, tests) + output.puts("\n\n//=======MAIN=====") + output.puts("int main(void)") + output.puts("{") + output.puts(" suite_setup();") unless @options[:suite_setup].nil? + output.puts(" Unity.TestFile = \"#{filename}\";") + output.puts(" UnityBegin();") + if (@options[:use_param_tests]) + tests.each do |test| + if ((test[:args].nil?) or (test[:args].empty?)) + output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]}, RUN_TEST_NO_ARGS);") + else + test[:args].each {|args| output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]}, #{args});")} + end + end + else + tests.each { |test| output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]});") } + end + output.puts() + output.puts(" return #{@options[:suite_teardown].nil? ? "" : "suite_teardown"}(UnityEnd());") + output.puts("}") + end +end + + +if ($0 == __FILE__) + options = { :includes => [] } + yaml_file = nil + + #parse out all the options first + ARGV.reject! do |arg| + case(arg) + when '-cexception' + options[:plugins] = [:cexception]; true + when /\.*\.yml/ + options = UnityTestRunnerGenerator.grab_config(arg); true + else false + end + end + + #make sure there is at least one parameter left (the input file) + if !ARGV[0] + puts ["usage: ruby #{__FILE__} (yaml) (options) input_test_file output_test_runner (includes)", + " blah.yml - will use config options in the yml file (see docs)", + " -cexception - include cexception support"].join("\n") + exit 1 + end + + #create the default test runner name if not specified + ARGV[1] = ARGV[0].gsub(".c","_Runner.c") if (!ARGV[1]) + + #everything else is an include file + options[:includes] ||= (ARGV.slice(2..-1).flatten.compact) if (ARGV.size > 2) + + UnityTestRunnerGenerator.new(options).run(ARGV[0], ARGV[1]) +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/auto/test_file_filter.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/auto/test_file_filter.rb new file mode 100644 index 0000000..3dbc26a --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/auto/test_file_filter.rb @@ -0,0 +1,23 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require'yaml' + +module RakefileHelpers + class TestFileFilter + def initialize(all_files = false) + @all_files = all_files + if not @all_files == true + if File.exist?('test_file_filter.yml') + filters = YAML.load_file( 'test_file_filter.yml' ) + @all_files, @only_files, @exclude_files = + filters[:all_files], filters[:only_files], filters[:exclude_files] + end + end + end + attr_accessor :all_files, :only_files, :exclude_files + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/auto/unity_test_summary.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/auto/unity_test_summary.rb new file mode 100644 index 0000000..69ec2e8 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/auto/unity_test_summary.rb @@ -0,0 +1,126 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +#!/usr/bin/ruby +# +# unity_test_summary.rb +# +require 'fileutils' +require 'set' + +class UnityTestSummary + include FileUtils::Verbose + + attr_reader :report, :total_tests, :failures, :ignored + + def initialize + @report = '' + @total_tests = 0 + @failures = 0 + @ignored = 0 + end + + def run + # Clean up result file names + results = @targets.map {|target| target.gsub(/\\/,'/')} + + # Dig through each result file, looking for details on pass/fail: + failure_output = [] + ignore_output = [] + + results.each do |result_file| + lines = File.readlines(result_file).map { |line| line.chomp } + if lines.length == 0 + raise "Empty test result file: #{result_file}" + else + output = get_details(result_file, lines) + failure_output << output[:failures] unless output[:failures].empty? + ignore_output << output[:ignores] unless output[:ignores].empty? + tests,failures,ignored = parse_test_summary(lines) + @total_tests += tests + @failures += failures + @ignored += ignored + end + end + + if @ignored > 0 + @report += "\n" + @report += "--------------------------\n" + @report += "UNITY IGNORED TEST SUMMARY\n" + @report += "--------------------------\n" + @report += ignore_output.flatten.join("\n") + end + + if @failures > 0 + @report += "\n" + @report += "--------------------------\n" + @report += "UNITY FAILED TEST SUMMARY\n" + @report += "--------------------------\n" + @report += failure_output.flatten.join("\n") + end + + @report += "\n" + @report += "--------------------------\n" + @report += "OVERALL UNITY TEST SUMMARY\n" + @report += "--------------------------\n" + @report += "#{@total_tests} TOTAL TESTS #{@failures} TOTAL FAILURES #{@ignored} IGNORED\n" + @report += "\n" + end + + def set_targets(target_array) + @targets = target_array + end + + def set_root_path(path) + @root = path + end + + def usage(err_msg=nil) + puts err_msg if err_msg + puts "Usage: unity_test_summary.rb" + exit 1 + end + + protected + + @@targets=nil + @@path=nil + @@root=nil + + def get_details(result_file, lines) + results = { :failures => [], :ignores => [], :successes => [] } + lines.each do |line| + src_file,src_line,test_name,status,msg = line.split(/:/) + line_out = ((@root and (@root != 0)) ? "#{@root}#{line}" : line ).gsub(/\//, "\\") + case(status) + when 'IGNORE' then results[:ignores] << line_out + when 'FAIL' then results[:failures] << line_out + when 'PASS' then results[:successes] << line_out + end + end + return results + end + + def parse_test_summary(summary) + if summary[-3..-1].join("\n") =~ /(\d+) Tests (\d+) Failures (\d+) Ignored/ + [$1.to_i,$2.to_i,$3.to_i] + else + raise "Couldn't parse test results: #{summary}" + end + end + + def here; File.expand_path(File.dirname(__FILE__)); end + +end + +if $0 == __FILE__ + script = UnityTestSummary.new + begin + script.run + rescue Exception => e + script.usage e.message + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/docs/Unity Summary.odt b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/docs/Unity Summary.odt new file mode 100644 index 0000000..f699661 Binary files /dev/null and b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/docs/Unity Summary.odt differ diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/docs/Unity Summary.pdf b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/docs/Unity Summary.pdf new file mode 100644 index 0000000..ad1a956 Binary files /dev/null and b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/docs/Unity Summary.pdf differ diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/docs/Unity Summary.txt b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/docs/Unity Summary.txt new file mode 100644 index 0000000..e0b179d --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/docs/Unity Summary.txt @@ -0,0 +1,217 @@ +============== +Unity Test API +============== + +[Copyright (c) 2007 - Unity Project by Mike Karlesky, Mark VanderVoord, and Greg Williams] + +------------- +Running Tests +------------- + +RUN_TEST(func, linenum) + +Each Test is run within the macro RUN_TEST. This macro performs necessary setup before the test is called and handles cleanup and result tabulation afterwards. + +-------------- +Ignoring Tests +-------------- + +There are times when a test is incomplete or not valid for some reason. At these times, TEST_IGNORE can be called. Control will immediately be returned to the caller of the test, and no failures will be returned. + +TEST_IGNORE() + +Ignore this test and return immediately + +TEST_IGNORE_MESSAGE (message) + +Ignore this test and return immediately. Output a message stating why the test was ignored. + +-------------- +Aborting Tests +-------------- + +There are times when a test will contain an infinite loop on error conditions, or there may be reason to escape from the test early without executing the rest of the test. A pair of macros support this functionality in Unity. The first (TEST_PROTECT) sets up the feature, and handles emergency abort cases. TEST_ABORT can then be used at any time within the tests to return to the last TEST_PROTECT call. + +TEST_PROTECT() + +Setup and Catch macro + +TEST_ABORT() + +Abort Test macro + +Example: + +main() +{ + if (TEST_PROTECT() == 0) + { + MyTest(); + } +} + +If MyTest calls TEST_ABORT, program control will immediately return to TEST_PROTECT with a non-zero return value. + + +======================= +Unity Assertion Summary +======================= + +-------------------- +Basic Validity Tests +-------------------- + +TEST_ASSERT_TRUE(condition) + +Evaluates whatever code is in condition and fails if it evaluates to false + +TEST_ASSERT_FALSE(condition) + +Evaluates whatever code is in condition and fails if it evaluates to true + +TEST_ASSERT(condition) + +Another way of calling TEST_ASSERT_TRUE + +TEST_ASSERT_UNLESS(condition) + +Another way of calling TEST_ASSERT_FALSE + +TEST_FAIL() +TEST_FAIL_MESSAGE(message) + +This test is automatically marked as a failure. The message is output stating why. + +------------------------------ +Numerical Assertions: Integers +------------------------------ + +TEST_ASSERT_EQUAL_INT(expected, actual) +TEST_ASSERT_EQUAL_INT8(expected, actual) +TEST_ASSERT_EQUAL_INT16(expected, actual) +TEST_ASSERT_EQUAL_INT32(expected, actual) +TEST_ASSERT_EQUAL_INT64(expected, actual) + +Compare two integers for equality and display errors as signed integers. A cast will be performed +to your natural integer size so often this can just be used. When you need to specify the exact size, +like when comparing arrays, you can use a specific version: + + + +TEST_ASSERT_EQUAL_UINT(expected, actual) + +Compare two integers for equality and display errors as unsigned integers. Like INT, there are +variants for different sizes also. + + + +TEST_ASSERT_EQUAL_HEX(expected, actual) + +Compares two integers for equality and display errors as hexadecimal. Like the other integer comparisons, +you can specify the size... here the size will also effect how many nibbles are shown (for example, HEX16 +will show 4 nibbles). + +_ARRAY + +You can append _ARRAY to any of these macros to make an array comparison of that type. Here you will +need to care a bit more about the actual size of the value being checked. You will also specify an +additional argument which is the number of elements to compare. For example: + +TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, elements) + + +TEST_ASSERT_EQUAL(expected, actual) + +Another way of calling TEST_ASSERT_EQUAL_INT + + + +TEST_ASSERT_INT_WITHIN(delta, expected, actual) + +Asserts that the actual value is within plus or minus delta of the expected value. This also comes in +size specific variants. + + +----------------------------- +Numerical Assertions: Bitwise +----------------------------- + +TEST_ASSERT_BITS(mask, expected, actual) + +Use an integer mask to specify which bits should be compared between two other integers. High bits in the mask are compared, low bits ignored. + +TEST_ASSERT_BITS_HIGH(mask, actual) + +Use an integer mask to specify which bits should be inspected to determine if they are all set high. High bits in the mask are compared, low bits ignored. + +TEST_ASSERT_BITS_LOW(mask, actual) + +Use an integer mask to specify which bits should be inspected to determine if they are all set low. High bits in the mask are compared, low bits ignored. + +TEST_ASSERT_BIT_HIGH(bit, actual) + +Test a single bit and verify that it is high. The bit is specified 0-31 for a 32-bit integer. + +TEST_ASSERT_BIT_LOW(bit, actual) + +Test a single bit and verify that it is low. The bit is specified 0-31 for a 32-bit integer. + +---------------------------- +Numerical Assertions: Floats +---------------------------- + +TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual) + +Asserts that the actual value is within plus or minus delta of the expected value. + +TEST_ASSERT_EQUAL_FLOAT(expected, actual) + +Asserts that two floating point values are "equal" within a small % delta of the expected value. + +----------------- +String Assertions +----------------- + +TEST_ASSERT_EQUAL_STRING(expected, actual) + +Compare two null-terminate strings. Fail if any character is different or if the lengths are different. + +TEST_ASSERT_EQUAL_STRING_MESSAGE(expected, actual, message) + +Compare two null-terminate strings. Fail if any character is different or if the lengths are different. Output a custom message on failure. + +------------------ +Pointer Assertions +------------------ + +Most pointer operations can be performed by simply using the integer comparisons above. However, a couple of special cases are added for clarity. + +TEST_ASSERT_NULL(pointer) + +Fails if the pointer is not equal to NULL + +TEST_ASSERT_NOT_NULL(pointer) + +Fails if the pointer is equal to NULL + + +----------------- +Memory Assertions +----------------- + +TEST_ASSERT_EQUAL_MEMORY(expected, actual, len) + +Compare two blocks of memory. This is a good generic assertion for types that can't be coerced into acting like +standard types... but since it's a memory compare, you have to be careful that your data types are packed. + +-------- +_MESSAGE +-------- + +you can append _MESSAGE to any of the macros to make them take an additional argument. This argument +is a string that will be printed at the end of the failure strings. This is useful for specifying more +information about the problem. + + + + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/docs/license.txt b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/docs/license.txt new file mode 100644 index 0000000..c42e330 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/docs/license.txt @@ -0,0 +1,31 @@ + Copyright (c) 2007-2010 Mike Karlesky, Mark VanderVoord, Greg Williams + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + The end-user documentation included with the redistribution, if + any, must include the following acknowledgment: "This product + includes software developed for the Unity Project, by Mike Karlesky, + Mark VanderVoord, and Greg Williams and other contributors", in + the same place and form as other third-party acknowledgments. + Alternately, this acknowledgment may appear in the software + itself, in the same form and location as other such third-party + acknowledgments. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/examples/helper/UnityHelper.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/examples/helper/UnityHelper.c new file mode 100644 index 0000000..9cf42c6 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/examples/helper/UnityHelper.c @@ -0,0 +1,10 @@ +#include "unity.h" +#include "UnityHelper.h" +#include +#include + +void AssertEqualExampleStruct(const EXAMPLE_STRUCT_T expected, const EXAMPLE_STRUCT_T actual, const unsigned short line) +{ + UNITY_TEST_ASSERT_EQUAL_INT(expected.x, actual.x, line, "Example Struct Failed For Field x"); + UNITY_TEST_ASSERT_EQUAL_INT(expected.y, actual.y, line, "Example Struct Failed For Field y"); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/examples/helper/UnityHelper.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/examples/helper/UnityHelper.h new file mode 100644 index 0000000..1516111 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/examples/helper/UnityHelper.h @@ -0,0 +1,12 @@ +#ifndef _TESTHELPER_H +#define _TESTHELPER_H + +#include "Types.h" + +void AssertEqualExampleStruct(const EXAMPLE_STRUCT_T expected, const EXAMPLE_STRUCT_T actual, const unsigned short line); + +#define UNITY_TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(expected, actual, line, message) AssertEqualExampleStruct(expected, actual, line); + +#define TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(expected, actual) UNITY_TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(expected, actual, __LINE__, NULL); + +#endif // _TESTHELPER_H diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/examples/makefile b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/examples/makefile new file mode 100644 index 0000000..723d390 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/examples/makefile @@ -0,0 +1,40 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +C_COMPILER=gcc +TARGET_BASE1=test1 +TARGET_BASE2=test2 +ifeq ($(OS),Windows_NT) + TARGET_EXTENSION=.exe +else + TARGET_EXTENSION=.out +endif +TARGET1 = $(TARGET_BASE1)$(TARGET_EXTENSION) +TARGET2 = $(TARGET_BASE2)$(TARGET_EXTENSION) +SRC_FILES1=../src/unity.c src/ProductionCode.c test/TestProductionCode.c test/no_ruby/TestProductionCode_Runner.c +SRC_FILES2=../src/unity.c src/ProductionCode2.c test/TestProductionCode2.c test/no_ruby/TestProductionCode2_Runner.c +INC_DIRS=-Isrc -I../src +SYMBOLS=-DTEST + +ifeq ($(OS),Windows_NT) + CLEANUP = del /F /Q build\* && del /F /Q $(TARGET1) && del /F /Q $(TARGET2) +else + CLEANUP = rm -f build/*.o ; rm -f $(TARGET1) ; rm -f $(TARGET2) +endif + +all: clean default + +default: +# ruby auto/generate_test_runner.rb test/TestProductionCode.c test/no_ruby/TestProductionCode_Runner.c +# ruby auto/generate_test_runner.rb test/TestProductionCode2.c test/no_ruby/TestProductionCode2_Runner.c + $(C_COMPILER) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES1) -o $(TARGET1) + $(C_COMPILER) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES2) -o $(TARGET2) + $(TARGET1) + $(TARGET2) + +clean: + $(CLEANUP) + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/examples/rakefile.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/examples/rakefile.rb new file mode 100644 index 0000000..0905b4b --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/examples/rakefile.rb @@ -0,0 +1,32 @@ +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require HERE+'rakefile_helper' + +include RakefileHelpers + +# Load default configuration, for now +DEFAULT_CONFIG_FILE = 'gcc.yml' +configure_toolchain(DEFAULT_CONFIG_FILE) + +task :unit do + run_tests get_unit_test_files +end + +desc "Generate test summary" +task :summary do + report_summary +end + +desc "Build and test Unity" +task :all => [:clean, :unit, :summary] +task :default => [:clobber, :all] +task :ci => [:default] +task :cruise => [:default] + +desc "Load configuration" +task :config, :config_file do |t, args| + configure_toolchain(args[:config_file]) +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/examples/rakefile_helper.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/examples/rakefile_helper.rb new file mode 100644 index 0000000..0127d69 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/examples/rakefile_helper.rb @@ -0,0 +1,260 @@ +require 'yaml' +require 'fileutils' +require HERE+'../auto/unity_test_summary' +require HERE+'../auto/generate_test_runner' +require HERE+'../auto/colour_reporter' + +module RakefileHelpers + + C_EXTENSION = '.c' + + def load_configuration(config_file) + $cfg_file = "../targets/#{config_file}" + $cfg = YAML.load(File.read($cfg_file)) + end + + def configure_clean + CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil? + end + + def configure_toolchain(config_file=DEFAULT_CONFIG_FILE) + config_file += '.yml' unless config_file =~ /\.yml$/ + load_configuration('../targets/'+config_file) + configure_clean + end + + def get_unit_test_files + path = $cfg['compiler']['unit_tests_path'] + 'Test*' + C_EXTENSION + path.gsub!(/\\/, '/') + FileList.new(path) + end + + def get_local_include_dirs + include_dirs = $cfg['compiler']['includes']['items'].dup + include_dirs.delete_if {|dir| dir.is_a?(Array)} + return include_dirs + end + + def extract_headers(filename) + includes = [] + lines = File.readlines(filename) + lines.each do |line| + m = line.match(/^\s*#include\s+\"\s*(.+\.[hH])\s*\"/) + if not m.nil? + includes << m[1] + end + end + return includes + end + + def find_source_file(header, paths) + paths.each do |dir| + src_file = dir + header.ext(C_EXTENSION) + if (File.exists?(src_file)) + return src_file + end + end + return nil + end + + def tackit(strings) + if strings.is_a?(Array) + result = "\"#{strings.join}\"" + else + result = strings + end + return result + end + + def squash(prefix, items) + result = '' + items.each { |item| result += " #{prefix}#{tackit(item)}" } + return result + end + + def build_compiler_fields + command = tackit($cfg['compiler']['path']) + if $cfg['compiler']['defines']['items'].nil? + defines = '' + else + defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items']) + end + options = squash('', $cfg['compiler']['options']) + includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :defines => defines, :options => options, :includes => includes} + end + + def compile(file, defines=[]) + compiler = build_compiler_fields + cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{file} " + + "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" + + "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" + execute(cmd_str) + end + + def build_linker_fields + command = tackit($cfg['linker']['path']) + if $cfg['linker']['options'].nil? + options = '' + else + options = squash('', $cfg['linker']['options']) + end + if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?) + includes = '' + else + includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) + end + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :options => options, :includes => includes} + end + + def link(exe_name, obj_list) + linker = build_linker_fields + cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + + (obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).join + + $cfg['linker']['bin_files']['prefix'] + ' ' + + $cfg['linker']['bin_files']['destination'] + + exe_name + $cfg['linker']['bin_files']['extension'] + execute(cmd_str) + end + + def build_simulator_fields + return nil if $cfg['simulator'].nil? + if $cfg['simulator']['path'].nil? + command = '' + else + command = (tackit($cfg['simulator']['path']) + ' ') + end + if $cfg['simulator']['pre_support'].nil? + pre_support = '' + else + pre_support = squash('', $cfg['simulator']['pre_support']) + end + if $cfg['simulator']['post_support'].nil? + post_support = '' + else + post_support = squash('', $cfg['simulator']['post_support']) + end + return {:command => command, :pre_support => pre_support, :post_support => post_support} + end + + def execute(command_string, verbose=true, raise_on_fail=true) + report command_string + output = `#{command_string}`.chomp + report(output) if (verbose && !output.nil? && (output.length > 0)) + if (($?.exitstatus != 0) and (raise_on_fail)) + raise "Command failed. (Returned #{$?.exitstatus})" + end + return output + end + + def report_summary + summary = UnityTestSummary.new + summary.set_root_path(HERE) + results_glob = "#{$cfg['compiler']['build_path']}*.test*" + results_glob.gsub!(/\\/, '/') + results = Dir[results_glob] + summary.set_targets(results) + summary.run + fail_out "FAIL: There were failures" if (summary.failures > 0) + end + + def run_tests(test_files) + + report 'Running system tests...' + + # Tack on TEST define for compiling unit tests + load_configuration($cfg_file) + test_defines = ['TEST'] + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + $cfg['compiler']['defines']['items'] << 'TEST' + + include_dirs = get_local_include_dirs + + # Build and execute each unit test + test_files.each do |test| + obj_list = [] + + # Detect dependencies and build required required modules + extract_headers(test).each do |header| + # Compile corresponding source file if it exists + src_file = find_source_file(header, include_dirs) + if !src_file.nil? + compile(src_file, test_defines) + obj_list << header.ext($cfg['compiler']['object_files']['extension']) + end + end + + # Build the test runner (generate if configured to do so) + test_base = File.basename(test, C_EXTENSION) + runner_name = test_base + '_Runner.c' + if $cfg['compiler']['runner_path'].nil? + runner_path = $cfg['compiler']['build_path'] + runner_name + test_gen = UnityTestRunnerGenerator.new($cfg_file) + test_gen.run(test, runner_path) + else + runner_path = $cfg['compiler']['runner_path'] + runner_name + end + + compile(runner_path, test_defines) + obj_list << runner_name.ext($cfg['compiler']['object_files']['extension']) + + # Build the test module + compile(test, test_defines) + obj_list << test_base.ext($cfg['compiler']['object_files']['extension']) + + # Link the test executable + link(test_base, obj_list) + + # Execute unit test and generate results file + simulator = build_simulator_fields + executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] + if simulator.nil? + cmd_str = executable + else + cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" + end + output = execute(cmd_str, true, false) + test_results = $cfg['compiler']['build_path'] + test_base + if output.match(/OK$/m).nil? + test_results += '.testfail' + else + test_results += '.testpass' + end + File.open(test_results, 'w') { |f| f.print output } + end + end + + def build_application(main) + + report "Building application..." + + obj_list = [] + load_configuration($cfg_file) + main_path = $cfg['compiler']['source_path'] + main + C_EXTENSION + + # Detect dependencies and build required required modules + include_dirs = get_local_include_dirs + extract_headers(main_path).each do |header| + src_file = find_source_file(header, include_dirs) + if !src_file.nil? + compile(src_file) + obj_list << header.ext($cfg['compiler']['object_files']['extension']) + end + end + + # Build the main source file + main_base = File.basename(main_path, C_EXTENSION) + compile(main_path) + obj_list << main_base.ext($cfg['compiler']['object_files']['extension']) + + # Create the executable + link(main_base, obj_list) + end + + def fail_out(msg) + puts msg + exit(-1) + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/examples/readme.txt b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/examples/readme.txt new file mode 100644 index 0000000..6c7780e --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/examples/readme.txt @@ -0,0 +1,18 @@ +Example Project + +This example project gives an example of some passing, ignored, and failing tests. +It's simple and meant for you to look over and get an idea for what all of this stuff does. + +You can build and test using the makefile if you have gcc installed (you may need to tweak +the locations of some tools in the makefile). Otherwise, the rake version will let you +test with gcc or a couple versions of IAR. You can tweak the yaml files to get those versions +running. + +Ruby is required if you're using the rake version (obviously). This version shows off most of +Unity's advanced features (automatically creating test runners, fancy summaries, etc.) + +The makefile version doesn't require anything outside of your normal build tools, but won't do the +extras for you. So that you can test right away, we've written the test runners for you and +put them in the test\no_ruby subdirectory. If you make changes to the tests or source, you might +need to update these (like when you add or remove tests). Do that for a while and you'll learn +why you really want to start using the Ruby tools. \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/examples/src/ProductionCode.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/examples/src/ProductionCode.c new file mode 100644 index 0000000..500b44b --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/examples/src/ProductionCode.c @@ -0,0 +1,24 @@ + +#include "ProductionCode.h" + +int Counter = 0; +int NumbersToFind[9] = { 0, 34, 55, 66, 32, 11, 1, 77, 888 }; //some obnoxious array to search that is 1-based indexing instead of 0. + +// This function is supposed to search through NumbersToFind and find a particular number. +// If it finds it, the index is returned. Otherwise 0 is returned which sorta makes sense since +// NumbersToFind is indexed from 1. Unfortunately it's broken +// (and should therefore be caught by our tests) +int FindFunction_WhichIsBroken(int NumberToFind) +{ + int i = 0; + while (i <= 8) //Notice I should have been in braces + i++; + if (NumbersToFind[i] == NumberToFind) //Yikes! I'm getting run after the loop finishes instead of during it! + return i; + return 0; +} + +int FunctionWhichReturnsLocalVariable(void) +{ + return Counter; +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/examples/src/ProductionCode.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/examples/src/ProductionCode.h new file mode 100644 index 0000000..250ca0d --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/examples/src/ProductionCode.h @@ -0,0 +1,3 @@ + +int FindFunction_WhichIsBroken(int NumberToFind); +int FunctionWhichReturnsLocalVariable(void); diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/examples/src/ProductionCode2.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/examples/src/ProductionCode2.c new file mode 100644 index 0000000..a8c72e1 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/examples/src/ProductionCode2.c @@ -0,0 +1,9 @@ + +#include "ProductionCode2.h" + +char* ThisFunctionHasNotBeenTested(int Poor, char* LittleFunction) +{ + //Since There Are No Tests Yet, This Function Could Be Empty For All We Know. + // Which isn't terribly useful... but at least we put in a TEST_IGNORE so we won't forget + return (char*)0; +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/examples/src/ProductionCode2.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/examples/src/ProductionCode2.h new file mode 100644 index 0000000..34ae980 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/examples/src/ProductionCode2.h @@ -0,0 +1,2 @@ + +char* ThisFunctionHasNotBeenTested(int Poor, char* LittleFunction); diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/examples/test/TestProductionCode.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/examples/test/TestProductionCode.c new file mode 100644 index 0000000..28a5581 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/examples/test/TestProductionCode.c @@ -0,0 +1,62 @@ + +#include "ProductionCode.h" +#include "unity.h" + +//sometimes you may want to get at local data in a module. +//for example: If you plan to pass by reference, this could be useful +//however, it should often be avoided +extern int Counter; + +void setUp(void) +{ + //This is run before EACH TEST + Counter = 0x5a5a; +} + +void tearDown(void) +{ +} + +void test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode(void) +{ + //All of these should pass + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(78)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(1)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(33)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(999)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(-1)); +} + +void test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken(void) +{ + // You should see this line fail in your test summary + TEST_ASSERT_EQUAL(1, FindFunction_WhichIsBroken(34)); + + // Notice the rest of these didn't get a chance to run because the line above failed. + // Unit tests abort each test function on the first sign of trouble. + // Then NEXT test function runs as normal. + TEST_ASSERT_EQUAL(8, FindFunction_WhichIsBroken(8888)); +} + +void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue(void) +{ + //This should be true because setUp set this up for us before this test + TEST_ASSERT_EQUAL_HEX(0x5a5a, FunctionWhichReturnsLocalVariable()); + + //This should be true because we can still change our answer + Counter = 0x1234; + TEST_ASSERT_EQUAL_HEX(0x1234, FunctionWhichReturnsLocalVariable()); +} + +void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain(void) +{ + //This should be true again because setup was rerun before this test (and after we changed it to 0x1234) + TEST_ASSERT_EQUAL_HEX(0x5a5a, FunctionWhichReturnsLocalVariable()); +} + +void test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed(void) +{ + //Sometimes you get the test wrong. When that happens, you get a failure too... and a quick look should tell + // you what actually happened...which in this case was a failure to setup the initial condition. + TEST_ASSERT_EQUAL_HEX(0x1234, FunctionWhichReturnsLocalVariable()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/examples/test/TestProductionCode2.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/examples/test/TestProductionCode2.c new file mode 100644 index 0000000..20c9251 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/examples/test/TestProductionCode2.c @@ -0,0 +1,26 @@ + +#include "ProductionCode2.h" +#include "unity.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void test_IgnoredTest(void) +{ + TEST_IGNORE_MESSAGE("This Test Was Ignored On Purpose"); +} + +void test_AnotherIgnoredTest(void) +{ + TEST_IGNORE_MESSAGE("These Can Be Useful For Leaving Yourself Notes On What You Need To Do Yet"); +} + +void test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented(void) +{ + TEST_IGNORE(); //Like This +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/examples/test/no_ruby/TestProductionCode2_Runner.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/examples/test/no_ruby/TestProductionCode2_Runner.c new file mode 100644 index 0000000..56515ae --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/examples/test/no_ruby/TestProductionCode2_Runner.c @@ -0,0 +1,46 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ +#include "unity.h" +#include +#include + +char MessageBuffer[50]; + +extern void setUp(void); +extern void tearDown(void); + +extern void test_IgnoredTest(void); +extern void test_AnotherIgnoredTest(void); +extern void test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented(void); + +static void runTest(UnityTestFunction test) +{ + if (TEST_PROTECT()) + { + setUp(); + test(); + } + if (TEST_PROTECT() && !TEST_IS_IGNORED) + { + tearDown(); + } +} +void resetTest() +{ + tearDown(); + setUp(); +} + + +int main(void) +{ + Unity.TestFile = "test/TestProductionCode2.c"; + UnityBegin(); + + // RUN_TEST calls runTest + RUN_TEST(test_IgnoredTest, 13); + RUN_TEST(test_AnotherIgnoredTest, 18); + RUN_TEST(test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented, 23); + + UnityEnd(); + return 0; +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/examples/test/no_ruby/TestProductionCode_Runner.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/examples/test/no_ruby/TestProductionCode_Runner.c new file mode 100644 index 0000000..64112f3 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/examples/test/no_ruby/TestProductionCode_Runner.c @@ -0,0 +1,50 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ +#include "unity.h" +#include +#include + +char MessageBuffer[50]; + +extern void setUp(void); +extern void tearDown(void); + +extern void test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode(void); +extern void test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken(void); +extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue(void); +extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain(void); +extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed(void); + +static void runTest(UnityTestFunction test) +{ + if (TEST_PROTECT()) + { + setUp(); + test(); + } + if (TEST_PROTECT() && !TEST_IS_IGNORED) + { + tearDown(); + } +} +void resetTest() +{ + tearDown(); + setUp(); +} + + +int main(void) +{ + Unity.TestFile = "test/TestProductionCode.c"; + UnityBegin(); + + // RUN_TEST calls runTest + RUN_TEST(test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode, 20); + RUN_TEST(test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken, 30); + RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue, 41); + RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain, 51); + RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed, 57); + + UnityEnd(); + return 0; +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/build/MakefileWorker.mk b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/build/MakefileWorker.mk new file mode 100644 index 0000000..9948751 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/build/MakefileWorker.mk @@ -0,0 +1,331 @@ +#--------- +# +# MakefileWorker.mk +# +# Include this helper file in your makefile +# It makes +# A static library holding the application objs +# A test executable +# +# See this example for parameter settings +# examples/Makefile +# +#---------- +# Inputs - these variables describe what to build +# +# INCLUDE_DIRS - Directories used to search for include files. +# This generates a -I for each directory +# SRC_DIRS - Directories containing source file to built into the library +# SRC_FILES - Specific source files to build into library. Helpful when not all code +# in a directory can be built for test (hopefully a temporary situation) +# TEST_SRC_DIRS - Directories containing unit test code build into the unit test runner +# These do not go in a library. They are explicitly included in the test runner +# MOCKS_SRC_DIRS - Directories containing mock source files to build into the test runner +# These do not go in a library. They are explicitly included in the test runner +#---------- +# You can adjust these variables to influence how to build the test target +# and where to put and name outputs +# See below to determine defaults +# COMPONENT_NAME - the name of the thing being built +# UNITY_HOME - where Unity home dir found +# UNITY_BUILD_HOME - place for scripts +# UNITY_OBJS_DIR - a directory where o and d files go +# UNITY_LIB_DIR - a directory where libs go +# UNITY_ENABLE_DEBUG - build for debug +# UNITY_USE_MEM_LEAK_DETECTION - Links with overridden new and delete +# UNITY_USE_STD_CPP_LIB - Set to N to keep the standard C++ library out +# of the test harness +# UNITY_USE_GCOV - Turn on coverage analysis +# Clean then build with this flag set to Y, then 'make gcov' +# UNITY_TEST_RUNNER_FLAGS +# None by default +# UNITY_MAPFILE - generate a map file +# UNITY_WARNINGFLAGS - overly picky by default +# OTHER_MAKEFILE_TO_INCLUDE - a hook to use this makefile to make +# other targets. Like CSlim, which is part of fitnesse +#---------- +# +# Other flags users can initialize to sneak in their settings +# UNITY_CFLAGS - C complier +# UNITY_LDFLAGS - Linker flags +#---------- + + +ifndef COMPONENT_NAME + COMPONENT_NAME = name_this_in_the_makefile +endif + +# Debug on by default +ifndef UNITY_ENABLE_DEBUG + UNITY_ENABLE_DEBUG = Y +endif + +# new and delete for memory leak detection on by default +ifndef UNITY_USE_MEM_LEAK_DETECTION + UNITY_USE_MEM_LEAK_DETECTION = Y +endif + +# Use gcov, off by default +ifndef UNITY_USE_GCOV + UNITY_USE_GCOV = N +endif + +# Default warnings +ifndef UNITY_WARNINGFLAGS + UNITY_WARNINGFLAGS = -Wall -Werror -Wshadow -Wswitch-default +endif + +# Default dir for temporary files (d, o) +ifndef UNITY_OBJS_DIR + UNITY_OBJS_DIR = objs +endif + +# Default dir for the outout library +ifndef UNITY_LIB_DIR + UNITY_LIB_DIR = lib +endif + +# No map by default +ifndef UNITY_MAP_FILE + UNITY_MAP_FILE = N +endif + +#Not verbose by deafult +ifdef VERBOSE + UNITY_TEST_RUNNER_FLAGS += -v +endif + +ifdef GROUP + UNITY_TEST_RUNNER_FLAGS += -g $(GROUP) +endif + +ifdef NAME + UNITY_TEST_RUNNER_FLAGS += -n $(NAME) +endif + +ifdef REPEAT + UNITY_TEST_RUNNER_FLAGS += -r $(REPEAT) +endif + + +# -------------------------------------- +# derived flags in the following area +# -------------------------------------- +ifeq ($(UNITY_USE_MEM_LEAK_DETECTION), N) + UNITY_CFLAGS += -DUNITY_MEM_LEAK_DETECTION_DISABLED +else + UNITY_MEMLEAK_DETECTOR_MALLOC_MACRO_FILE = -include $(UNITY_HOME)/extras/fixture/src/unity_fixture_malloc_overrides.h +endif + +ifeq ($(UNITY_ENABLE_DEBUG), Y) + UNITY_CFLAGS += -g +endif + +ifeq ($(UNITY_USE_GCOV), Y) + UNITY_CFLAGS += -fprofile-arcs -ftest-coverage +endif + +UNITY_CFLAGS += $(UNITY_MEMLEAK_DETECTOR_MALLOC_MACRO_FILE) + +TARGET_MAP = $(COMPONENT_NAME).map.txt +ifeq ($(UNITY_MAP_FILE), Y) + UNITY_LDFLAGS += -Wl,-map,$(TARGET_MAP) +endif + +LD_LIBRARIES += -lgcov + +TARGET_LIB = \ + $(UNITY_LIB_DIR)/lib$(COMPONENT_NAME).a + +TEST_TARGET = \ + $(COMPONENT_NAME)_tests + +#Helper Functions +get_src_from_dir = $(wildcard $1/*.cpp) $(wildcard $1/*.c) +get_dirs_from_dirspec = $(wildcard $1) +get_src_from_dir_list = $(foreach dir, $1, $(call get_src_from_dir,$(dir))) +__src_to = $(subst .c,$1, $(subst .cpp,$1,$2)) +src_to = $(addprefix $(UNITY_OBJS_DIR)/,$(call __src_to,$1,$2)) +src_to_o = $(call src_to,.o,$1) +src_to_d = $(call src_to,.d,$1) +src_to_gcda = $(call src_to,.gcda,$1) +src_to_gcno = $(call src_to,.gcno,$1) +make_dotdot_a_subdir = $(subst ..,_dot_dot, $1) +time = $(shell date +%s) +delta_t = $(eval minus, $1, $2) +debug_print_list = $(foreach word,$1,echo " $(word)";) echo; + +#Derived +STUFF_TO_CLEAN += $(TEST_TARGET) $(TEST_TARGET).exe $(TARGET_LIB) $(TARGET_MAP) + +SRC += $(call get_src_from_dir_list, $(SRC_DIRS)) $(SRC_FILES) +OBJ = $(call src_to_o,$(SRC)) +OBJ2 = $(call make_dotdot_a_subdir. $(OBJ)) + +STUFF_TO_CLEAN += $(OBJ) + +TEST_SRC = $(call get_src_from_dir_list, $(TEST_SRC_DIRS)) +TEST_OBJS = $(call src_to_o,$(TEST_SRC)) +STUFF_TO_CLEAN += $(TEST_OBJS) + + +MOCKS_SRC = $(call get_src_from_dir_list, $(MOCKS_SRC_DIRS)) +MOCKS_OBJS = $(call src_to_o,$(MOCKS_SRC)) +STUFF_TO_CLEAN += $(MOCKS_OBJS) + +ALL_SRC = $(SRC) $(TEST_SRC) $(MOCKS_SRC) + +#Test coverage with gcov +GCOV_OUTPUT = gcov_output.txt +GCOV_REPORT = gcov_report.txt +GCOV_ERROR = gcov_error.txt +GCOV_GCDA_FILES = $(call src_to_gcda, $(ALL_SRC)) +GCOV_GCNO_FILES = $(call src_to_gcno, $(ALL_SRC)) +TEST_OUTPUT = $(TEST_TARGET).txt +STUFF_TO_CLEAN += \ + $(GCOV_OUTPUT)\ + $(GCOV_REPORT)\ + $(GCOV_REPORT).html\ + $(GCOV_ERROR)\ + $(GCOV_GCDA_FILES)\ + $(GCOV_GCNO_FILES)\ + $(TEST_OUTPUT) + + +#The gcda files for gcov need to be deleted before each run +#To avoid annoying messages. +GCOV_CLEAN = $(SILENCE)rm -f $(GCOV_GCDA_FILES) $(GCOV_OUTPUT) $(GCOV_REPORT) $(GCOV_ERROR) +RUN_TEST_TARGET = $(SILENCE) $(GCOV_CLEAN) ; echo "Running $(TEST_TARGET)"; ./$(TEST_TARGET) $(UNITY_TEST_RUNNER_FLAGS) + +INCLUDES_DIRS_EXPANDED = $(call get_dirs_from_dirspec, $(INCLUDE_DIRS)) +INCLUDES += $(foreach dir, $(INCLUDES_DIRS_EXPANDED), -I$(dir)) +MOCK_DIRS_EXPANDED = $(call get_dirs_from_dirspec, $(MOCKS_SRC_DIRS)) +INCLUDES += $(foreach dir, $(MOCK_DIRS_EXPANDED), -I$(dir)) + + +DEP_FILES = $(call src_to_d, $(ALL_SRC)) +STUFF_TO_CLEAN += $(DEP_FILES) $(PRODUCTION_CODE_START) $(PRODUCTION_CODE_END) +STUFF_TO_CLEAN += $(STDLIB_CODE_START) $(MAP_FILE) cpputest_*.xml junit_run_output + +# We'll use the UNITY_CFLAGS etc so that you can override AND add to the CppUTest flags +CFLAGS = $(UNITY_CFLAGS) $(UNITY_ADDITIONAL_CFLAGS) $(INCLUDES) $(UNITY_WARNINGFLAGS) +LDFLAGS = $(UNITY_LDFLAGS) $(UNITY_ADDITIONAL_LDFLAGS) + +# Targets + +.PHONY: all +all: start $(TEST_TARGET) + $(RUN_TEST_TARGET) + +.PHONY: start +start: $(TEST_TARGET) + $(SILENCE)START_TIME=$(call time) + +.PHONY: all_no_tests +all_no_tests: $(TEST_TARGET) + +.PHONY: flags +flags: + @echo + @echo "Compile C source with CFLAGS:" + @$(call debug_print_list,$(CFLAGS)) + @echo "Link with LDFLAGS:" + @$(call debug_print_list,$(LDFLAGS)) + @echo "Link with LD_LIBRARIES:" + @$(call debug_print_list,$(LD_LIBRARIES)) + @echo "Create libraries with ARFLAGS:" + @$(call debug_print_list,$(ARFLAGS)) + @echo "OBJ files:" + @$(call debug_print_list,$(OBJ2)) + + +$(TEST_TARGET): $(TEST_OBJS) $(MOCKS_OBJS) $(PRODUCTION_CODE_START) $(TARGET_LIB) $(USER_LIBS) $(PRODUCTION_CODE_END) $(STDLIB_CODE_START) + $(SILENCE)echo Linking $@ + $(SILENCE)$(LINK.o) -o $@ $^ $(LD_LIBRARIES) + +$(TARGET_LIB): $(OBJ) + $(SILENCE)echo Building archive $@ + $(SILENCE)mkdir -p lib + $(SILENCE)$(AR) $(ARFLAGS) $@ $^ + $(SILENCE)ranlib $@ + +test: $(TEST_TARGET) + $(RUN_TEST_TARGET) | tee $(TEST_OUTPUT) + +vtest: $(TEST_TARGET) + $(RUN_TEST_TARGET) -v | tee $(TEST_OUTPUT) + +$(UNITY_OBJS_DIR)/%.o: %.cpp + @echo compiling $(notdir $<) + $(SILENCE)mkdir -p $(dir $@) + $(SILENCE)$(COMPILE.cpp) -MMD -MP $(OUTPUT_OPTION) $< + +$(UNITY_OBJS_DIR)/%.o: %.c + @echo compiling $(notdir $<) + $(SILENCE)mkdir -p $(dir $@) + $(SILENCE)$(COMPILE.c) -MMD -MP $(OUTPUT_OPTION) $< + +ifneq "$(MAKECMDGOALS)" "clean" +-include $(DEP_FILES) +endif + +.PHONY: clean +clean: + $(SILENCE)echo Making clean + $(SILENCE)$(RM) $(STUFF_TO_CLEAN) + $(SILENCE)rm -rf gcov $(UNITY_OBJS_DIR) + $(SILENCE)find . -name "*.gcno" | xargs rm -f + $(SILENCE)find . -name "*.gcda" | xargs rm -f + +#realclean gets rid of all gcov, o and d files in the directory tree +#not just the ones made by this makefile +.PHONY: realclean +realclean: clean + $(SILENCE)rm -rf gcov + $(SILENCE)find . -name "*.gdcno" | xargs rm -f + $(SILENCE)find . -name "*.[do]" | xargs rm -f + +gcov: test + $(SILENCE)for d in $(SRC_DIRS) ; do \ + gcov --object-directory $(UNITY_OBJS_DIR)/$$d $$d/*.c $$d/*.cpp >> $(GCOV_OUTPUT) 2>>$(GCOV_ERROR) ; \ + done + $(SILENCE)for f in $(SRC_FILES) ; do \ + gcov --object-directory $(UNITY_OBJS_DIR)/$$f $$f >> $(GCOV_OUTPUT) 2>>$(GCOV_ERROR) ; \ + done + $(UNITY_BUILD_HOME)/filterGcov.sh $(GCOV_OUTPUT) $(GCOV_ERROR) $(GCOV_REPORT) $(TEST_OUTPUT) + $(SILENCE)cat $(GCOV_REPORT) + $(SILENCE)mkdir -p gcov + $(SILENCE)mv *.gcov gcov + $(SILENCE)mv gcov_* gcov + $(SILENCE)echo "See gcov directory for details" + +debug: + @echo + @echo "Target Source files:" + @$(call debug_print_list,$(SRC)) + @echo "Target Object files:" + @$(call debug_print_list,$(OBJ)) + @echo "Test Source files:" + @$(call debug_print_list,$(TEST_SRC)) + @echo "Test Object files:" + @$(call debug_print_list,$(TEST_OBJS)) + @echo "Mock Source files:" + @$(call debug_print_list,$(MOCKS_SRC)) + @echo "Mock Object files:" + @$(call debug_print_list,$(MOCKS_OBJS)) + @echo "All Input Dependency files:" + @$(call debug_print_list,$(DEP_FILES)) + @echo Stuff to clean: + @$(call debug_print_list,$(STUFF_TO_CLEAN)) + @echo Includes: + @$(call debug_print_list,$(INCLUDES)) + +ifneq "$(OTHER_MAKEFILE_TO_INCLUDE)" "" +-include $(OTHER_MAKEFILE_TO_INCLUDE) +endif + + + +st,$(TEST_SRC)) + @echo "Test Object files:" + @$(call debug_print \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/build/filterGcov.sh b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/build/filterGcov.sh new file mode 100644 index 0000000..a861cf6 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/build/filterGcov.sh @@ -0,0 +1,61 @@ +#!/bin/bash +INPUT_FILE=$1 +TEMP_FILE1=${INPUT_FILE}1.tmp +TEMP_FILE2=${INPUT_FILE}2.tmp +TEMP_FILE3=${INPUT_FILE}3.tmp +ERROR_FILE=$2 +OUTPUT_FILE=$3 +HTML_OUTPUT_FILE=$3.html +TEST_RESULTS=$4 + +flattenGcovOutput() { +while read line1 +do + read line2 + echo $line2 " " $line1 + read junk + read junk +done < ${INPUT_FILE} +} + +getRidOfCruft() { +sed '-e s/^Lines.*://g' \ + '-e s/^[0-9]\./ &/g' \ + '-e s/^[0-9][0-9]\./ &/g' \ + '-e s/of.*File/ /g' \ + "-e s/'//g" \ + '-e s/^.*\/usr\/.*$//g' \ + '-e s/^.*\.$//g' +} + +getFileNameRootFromErrorFile() { +sed '-e s/gc..:cannot open .* file//g' ${ERROR_FILE} +} + +writeEachNoTestCoverageFile() { +while read line +do + echo " 0.00% " ${line} +done +} + +createHtmlOutput() { + echo "" + echo "" + sed "-e s/.*% /
CoverageFile
&<\/td>/" \ + "-e s/[a-zA-Z0-9_]*\.[ch][a-z]*/&<\/a><\/td><\/tr>/" + echo "
" + sed "-e s/.*/&
/g" < ${TEST_RESULTS} +} + + +flattenGcovOutput | getRidOfCruft > ${TEMP_FILE1} +getFileNameRootFromErrorFile | writeEachNoTestCoverageFile > ${TEMP_FILE2} +cat ${TEMP_FILE1} ${TEMP_FILE2} | sort | uniq > ${OUTPUT_FILE} +createHtmlOutput < ${OUTPUT_FILE} > ${HTML_OUTPUT_FILE} +rm -f ${TEMP_FILE1} ${TEMP_FILE2} +erageFile" + sed "-e s/.*% /&<\/td>/" \ + "-e s/[a-zA-Z0-9_]*\.[ch][a-z]*/
&<\/a><\/td><\/tr>/" + echo "" + sed "-e s/.*/&
/g" < ${TEST_RESULTS \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/rakefile.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/rakefile.rb new file mode 100644 index 0000000..6181707 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/rakefile.rb @@ -0,0 +1,37 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require HERE + 'rakefile_helper' + +include RakefileHelpers + +# Load default configuration, for now +DEFAULT_CONFIG_FILE = 'gcc.yml' +configure_toolchain(DEFAULT_CONFIG_FILE) + +task :unit do + run_tests +end + +desc "Build and test Unity Framework" +task :all => [:clean, :unit] +task :default => [:clobber, :all] +task :ci => [:no_color, :default] +task :cruise => [:no_color, :default] + +desc "Load configuration" +task :config, :config_file do |t, args| + configure_toolchain(args[:config_file]) +end + +task :no_color do + $colour_output = false +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/rakefile_helper.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/rakefile_helper.rb new file mode 100644 index 0000000..a7f6a28 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/rakefile_helper.rb @@ -0,0 +1,178 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require 'yaml' +require 'fileutils' +require HERE+'../../auto/unity_test_summary' +require HERE+'../../auto/generate_test_runner' +require HERE+'../../auto/colour_reporter' + +module RakefileHelpers + + C_EXTENSION = '.c' + + def load_configuration(config_file) + unless ($configured) + $cfg_file = HERE+"../../targets/#{config_file}" unless (config_file =~ /[\\|\/]/) + $cfg = YAML.load(File.read($cfg_file)) + $colour_output = false unless $cfg['colour'] + $configured = true if (config_file != DEFAULT_CONFIG_FILE) + end + end + + def configure_clean + CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil? + end + + def configure_toolchain(config_file=DEFAULT_CONFIG_FILE) + config_file += '.yml' unless config_file =~ /\.yml$/ + config_file = config_file unless config_file =~ /[\\|\/]/ + load_configuration(config_file) + configure_clean + end + + def tackit(strings) + if strings.is_a?(Array) + result = "\"#{strings.join}\"" + else + result = strings + end + return result + end + + def squash(prefix, items) + result = '' + items.each { |item| result += " #{prefix}#{tackit(item)}" } + return result + end + + def build_compiler_fields + command = tackit($cfg['compiler']['path']) + if $cfg['compiler']['defines']['items'].nil? + defines = '' + else + defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items'] + ['UNITY_OUTPUT_CHAR=UnityOutputCharSpy_OutputChar']) + end + options = squash('', $cfg['compiler']['options']) + includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :defines => defines, :options => options, :includes => includes} + end + + def compile(file, defines=[]) + compiler = build_compiler_fields + unity_include = $cfg['compiler']['includes']['prefix']+'../../src' + cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{unity_include} #{file} " + + "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" + + "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" + execute(cmd_str) + end + + def build_linker_fields + command = tackit($cfg['linker']['path']) + if $cfg['linker']['options'].nil? + options = '' + else + options = squash('', $cfg['linker']['options']) + end + if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?) + includes = '' + else + includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) + end + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :options => options, :includes => includes} + end + + def link(exe_name, obj_list) + linker = build_linker_fields + cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + + (obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).join + + $cfg['linker']['bin_files']['prefix'] + ' ' + + $cfg['linker']['bin_files']['destination'] + + exe_name + $cfg['linker']['bin_files']['extension'] + execute(cmd_str) + end + + def build_simulator_fields + return nil if $cfg['simulator'].nil? + if $cfg['simulator']['path'].nil? + command = '' + else + command = (tackit($cfg['simulator']['path']) + ' ') + end + if $cfg['simulator']['pre_support'].nil? + pre_support = '' + else + pre_support = squash('', $cfg['simulator']['pre_support']) + end + if $cfg['simulator']['post_support'].nil? + post_support = '' + else + post_support = squash('', $cfg['simulator']['post_support']) + end + return {:command => command, :pre_support => pre_support, :post_support => post_support} + end + + def execute(command_string, verbose=true) + report command_string + output = `#{command_string}`.chomp + report(output) if (verbose && !output.nil? && (output.length > 0)) + if ($?.exitstatus != 0) + raise "Command failed. (Returned #{$?.exitstatus})" + end + return output + end + + def report_summary + summary = UnityTestSummary.new + summary.set_root_path(HERE) + results_glob = "#{$cfg['compiler']['build_path']}*.test*" + results_glob.gsub!(/\\/, '/') + results = Dir[results_glob] + summary.set_targets(results) + summary.run + end + + def run_tests + report 'Running Unity system tests...' + + # Tack on TEST define for compiling unit tests + load_configuration($cfg_file) + test_defines = ['TEST'] + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + + # Get a list of all source files needed + src_files = Dir[HERE+'src/*.c'] + src_files += Dir[HERE+'test/*.c'] + src_files << '../../src/Unity.c' + + # Build object files + src_files.each { |f| compile(f, test_defines) } + obj_list = src_files.map {|f| File.basename(f.ext($cfg['compiler']['object_files']['extension'])) } + + # Link the test executable + test_base = "framework_test" + link(test_base, obj_list) + + # Execute unit test and generate results file + simulator = build_simulator_fields + executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] + if simulator.nil? + cmd_str = executable + " -v -r" + else + cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" + end + output = execute(cmd_str) + test_results = $cfg['compiler']['build_path'] + test_base + if output.match(/OK$/m).nil? + test_results += '.testfail' + else + test_results += '.testpass' + end + File.open(test_results, 'w') { |f| f.print output } + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/readme.txt b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/readme.txt new file mode 100644 index 0000000..6b9a78c --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/readme.txt @@ -0,0 +1,9 @@ +Copyright (c) 2010 James Grenning and Contributed to Unity Project + +Unity Project - A Test Framework for C +Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +[Released under MIT License. Please refer to license.txt for details] + +This Framework is an optional add-on to Unity. By including unity_framework.h in place of unity.h, +you may now work with Unity in a manner similar to CppUTest. This framework adds the concepts of +test groups and gives finer control of your tests over the command line. \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.c new file mode 100644 index 0000000..1ba3e9a --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.c @@ -0,0 +1,381 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" +#include "unity_internals.h" +#include + +UNITY_FIXTURE_T UnityFixture; + +//If you decide to use the function pointer approach. +int (*outputChar)(int) = putchar; + +int verbose = 0; + +void setUp(void) { /*does nothing*/ } +void tearDown(void) { /*does nothing*/ } + +void announceTestRun(int runNumber) +{ + UnityPrint("Unity test run "); + UnityPrintNumber(runNumber+1); + UnityPrint(" of "); + UnityPrintNumber(UnityFixture.RepeatCount); + UNITY_OUTPUT_CHAR('\n'); +} + +int UnityMain(int argc, char* argv[], void (*runAllTests)()) +{ + int result = UnityGetCommandLineOptions(argc, argv); + int r; + if (result != 0) + return result; + + for (r = 0; r < UnityFixture.RepeatCount; r++) + { + announceTestRun(r); + UnityBegin(); + runAllTests(); + UNITY_OUTPUT_CHAR('\n'); + UnityEnd(); + } + + return UnityFailureCount(); +} + +static int selected(const char * filter, const char * name) +{ + if (filter == 0) + return 1; + return strstr(name, filter) ? 1 : 0; +} + +static int testSelected(const char* test) +{ + return selected(UnityFixture.NameFilter, test); +} + +static int groupSelected(const char* group) +{ + return selected(UnityFixture.GroupFilter, group); +} + +static void runTestCase() +{ + +} + +void UnityTestRunner(unityfunction* setup, + unityfunction* testBody, + unityfunction* teardown, + const char * printableName, + const char * group, + const char * name, + const char * file, int line) +{ + if (testSelected(name) && groupSelected(group)) + { + Unity.CurrentTestFailed = 0; + Unity.TestFile = file; + Unity.CurrentTestName = printableName; + Unity.CurrentTestLineNumber = line; + if (!UnityFixture.Verbose) + UNITY_OUTPUT_CHAR('.'); + else + UnityPrint(printableName); + + Unity.NumberOfTests++; + UnityMalloc_StartTest(); + UnityPointer_Init(); + + runTestCase(); + if (TEST_PROTECT()) + { + setup(); + testBody(); + } + if (TEST_PROTECT()) + { + teardown(); + } + if (TEST_PROTECT()) + { + UnityPointer_UndoAllSets(); + if (!Unity.CurrentTestFailed) + UnityMalloc_EndTest(); + UnityConcludeFixtureTest(); + } + else + { + //aborting - jwg - di i need these for the other TEST_PROTECTS? + } + } +} + +void UnityIgnoreTest() +{ + Unity.NumberOfTests++; + Unity.CurrentTestIgnored = 1; + UNITY_OUTPUT_CHAR('!'); +} + + +//------------------------------------------------- +//Malloc and free stuff +// +#define MALLOC_DONT_FAIL -1 +static int malloc_count; +static int malloc_fail_countdown = MALLOC_DONT_FAIL; + +void UnityMalloc_StartTest() +{ + malloc_count = 0; + malloc_fail_countdown = MALLOC_DONT_FAIL; +} + +void UnityMalloc_EndTest() +{ + malloc_fail_countdown = MALLOC_DONT_FAIL; + if (malloc_count != 0) + { + TEST_FAIL_MESSAGE("This test leaks!"); + } +} + +void UnityMalloc_MakeMallocFailAfterCount(int countdown) +{ + malloc_fail_countdown = countdown; +} + +#ifdef malloc +#undef malloc +#endif + +#ifdef free +#undef free +#endif + +#include +#include + +typedef struct GuardBytes +{ + int size; + char guard[sizeof(int)]; +} Guard; + + +static const char * end = "END"; + +void * unity_malloc(size_t size) +{ + char* mem; + Guard* guard; + + if (malloc_fail_countdown != MALLOC_DONT_FAIL) + { + if (malloc_fail_countdown == 0) + return 0; + malloc_fail_countdown--; + } + + malloc_count++; + + guard = (Guard*)malloc(size + sizeof(Guard) + 4); + guard->size = size; + mem = (char*)&(guard[1]); + memcpy(&mem[size], end, strlen(end) + 1); + + return (void*)mem; +} + +static int isOverrun(void * mem) +{ + Guard* guard = (Guard*)mem; + char* memAsChar = (char*)mem; + guard--; + + return strcmp(&memAsChar[guard->size], end) != 0; +} + +static void release_memory(void * mem) +{ + Guard* guard = (Guard*)mem; + guard--; + + malloc_count--; + free(guard); +} + +void unity_free(void * mem) +{ + int overrun = isOverrun(mem);//strcmp(&memAsChar[guard->size], end) != 0; + release_memory(mem); + if (overrun) + { + TEST_FAIL_MESSAGE("Buffer overrun detected during free()"); + } +} + +void* unity_calloc(size_t num, size_t size) +{ + void* mem = unity_malloc(num * size); + memset(mem, 0, num*size); + return mem; +} + +void* unity_realloc(void * oldMem, size_t size) +{ + Guard* guard = (Guard*)oldMem; +// char* memAsChar = (char*)oldMem; + void* newMem; + + if (oldMem == 0) + return unity_malloc(size); + + guard--; + if (isOverrun(oldMem)) + { + release_memory(oldMem); + TEST_FAIL_MESSAGE("Buffer overrun detected during realloc()"); + } + + if (size == 0) + { + release_memory(oldMem); + return 0; + } + + if (guard->size >= size) + return oldMem; + + newMem = unity_malloc(size); + memcpy(newMem, oldMem, size); + unity_free(oldMem); + return newMem; +} + + +//-------------------------------------------------------- +//Automatic pointer restoration functions +typedef struct _PointerPair +{ + struct _PointerPair * next; + void ** pointer; + void * old_value; +} PointerPair; + +enum {MAX_POINTERS=50}; +static PointerPair pointer_store[MAX_POINTERS]; +static int pointer_index = 0; + +void UnityPointer_Init() +{ + pointer_index = 0; +} + +void UnityPointer_Set(void ** pointer, void * newValue) +{ + if (pointer_index >= MAX_POINTERS) + TEST_FAIL_MESSAGE("Too many pointers set"); + + pointer_store[pointer_index].pointer = pointer; + pointer_store[pointer_index].old_value = *pointer; + *pointer = newValue; + pointer_index++; +} + +void UnityPointer_UndoAllSets() +{ + while (pointer_index > 0) + { + pointer_index--; + *(pointer_store[pointer_index].pointer) = + pointer_store[pointer_index].old_value; + + } +} + +int UnityFailureCount() +{ + return Unity.TestFailures; +} + +int UnityGetCommandLineOptions(int argc, char* argv[]) +{ + int i; + UnityFixture.Verbose = 0; + UnityFixture.GroupFilter = 0; + UnityFixture.NameFilter = 0; + UnityFixture.RepeatCount = 1; + + if (argc == 1) + return 0; + + for (i = 1; i < argc; ) + { + if (strcmp(argv[i], "-v") == 0) + { + UnityFixture.Verbose = 1; + i++; + } + else if (strcmp(argv[i], "-g") == 0) + { + i++; + if (i >= argc) + return 1; + UnityFixture.GroupFilter = argv[i]; + i++; + } + else if (strcmp(argv[i], "-n") == 0) + { + i++; + if (i >= argc) + return 1; + UnityFixture.NameFilter = argv[i]; + i++; + } + else if (strcmp(argv[i], "-r") == 0) + { + UnityFixture.RepeatCount = 2; + i++; + if (i < argc) + { + if (*(argv[i]) >= '0' && *(argv[i]) <= '9') + { + UnityFixture.RepeatCount = atoi(argv[i]); + i++; + } + } + } + } + return 0; +} + +void UnityConcludeFixtureTest() +{ + if (Unity.CurrentTestIgnored) + { + Unity.TestIgnores++; + } + else if (!Unity.CurrentTestFailed) + { + if (UnityFixture.Verbose) + { + UnityPrint(" PASS"); + UNITY_OUTPUT_CHAR('\n'); + } + } + else if (Unity.CurrentTestFailed) + { + Unity.TestFailures++; + } + + Unity.CurrentTestFailed = 0; + Unity.CurrentTestIgnored = 0; +} + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.h new file mode 100644 index 0000000..da1f871 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.h @@ -0,0 +1,81 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FIXTURE_H_ +#define UNITY_FIXTURE_H_ + +#include "unity.h" +#include "unity_internals.h" +#include "unity_fixture_malloc_overrides.h" +#include "unity_fixture_internals.h" + +int UnityMain(int argc, char* argv[], void (*runAllTests)()); + + +#define TEST_GROUP(group)\ + int TEST_GROUP_##group = 0 + +#define TEST_SETUP(group) void TEST_##group##_SETUP() + +#define TEST_TEAR_DOWN(group) void TEST_##group##_TEAR_DOWN() + + +#define TEST(group, name) \ + void TEST_##group##_##name##_();\ + void TEST_##group##_##name##_run()\ + {\ + UnityTestRunner(TEST_##group##_SETUP,\ + TEST_##group##_##name##_,\ + TEST_##group##_TEAR_DOWN,\ + "TEST(" #group ", " #name ")",\ + #group, #name,\ + __FILE__, __LINE__);\ + }\ + void TEST_##group##_##name##_() + +#define IGNORE_TEST(group, name) \ + void TEST_##group##_##name##_();\ + void TEST_##group##_##name##_run()\ + {\ + UnityIgnoreTest();\ + }\ + void TEST_##group##_##name##_() + +#define DECLARE_TEST_CASE(group, name) \ + void TEST_##group##_##name##_run() + +#define RUN_TEST_CASE(group, name) \ + DECLARE_TEST_CASE(group, name);\ + TEST_##group##_##name##_run(); + +//This goes at the bottom of each test file or in a separate c file +#define TEST_GROUP_RUNNER(group)\ + void TEST_##group##_GROUP_RUNNER_runAll();\ + void TEST_##group##_GROUP_RUNNER()\ + {\ + TEST_##group##_GROUP_RUNNER_runAll();\ + }\ + void TEST_##group##_GROUP_RUNNER_runAll() + +//Call this from main +#define RUN_TEST_GROUP(group)\ + void TEST_##group##_GROUP_RUNNER();\ + TEST_##group##_GROUP_RUNNER(); + +//CppUTest Compatibility Macros +#define UT_PTR_SET(ptr, newPointerValue) UnityPointer_Set((void**)&ptr, (void*)newPointerValue) +#define TEST_ASSERT_POINTERS_EQUAL(expected, actual) TEST_ASSERT_EQUAL_PTR(expected, actual) +#define TEST_ASSERT_BYTES_EQUAL(expected, actual) TEST_ASSERT_EQUAL_HEX8(0xff & (expected), 0xff & (actual)) +#define FAIL(message) TEST_FAIL((message)) +#define CHECK(condition) TEST_ASSERT_TRUE((condition)) +#define LONGS_EQUAL(expected, actual) TEST_ASSERT_EQUAL_INT((expected), (actual)) +#define STRCMP_EQUAL(expected, actual) TEST_ASSERT_EQUAL_STRING((expected), (actual)) +#define DOUBLES_EQUAL(expected, actual, delta) TEST_ASSERT_FLOAT_WITHIN(((expected), (actual), (delta)) + +void UnityMalloc_MakeMallocFailAfterCount(int count); + +#endif /* UNITY_FIXTURE_H_ */ diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_internals.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_internals.h new file mode 100644 index 0000000..db23f67 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_internals.h @@ -0,0 +1,44 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FIXTURE_INTERNALS_H_ +#define UNITY_FIXTURE_INTERNALS_H_ + +typedef struct _UNITY_FIXTURE_T +{ + int Verbose; + unsigned int RepeatCount; + const char* NameFilter; + const char* GroupFilter; +} UNITY_FIXTURE_T; + +typedef void unityfunction(); +void UnityTestRunner(unityfunction * setup, + unityfunction * body, + unityfunction * teardown, + const char * printableName, + const char * group, + const char * name, + const char * file, int line); + +void UnityIgnoreTest(); +void UnityMalloc_StartTest(); +void UnityMalloc_EndTest(); +int UnityFailureCount(); +int UnityGetCommandLineOptions(int argc, char* argv[]); +void UnityConcludeFixtureTest(); + +void UnityPointer_Set(void ** ptr, void * newValue); +void UnityPointer_UndoAllSets(); +void UnityPointer_Init(); + +void UnityAssertEqualPointer(const void * expected, + const void * actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +#endif /* UNITY_FIXTURE_INTERNALS_H_ */ diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h new file mode 100644 index 0000000..38f8e34 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h @@ -0,0 +1,16 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FIXTURE_MALLOC_OVERRIDES_H_ +#define UNITY_FIXTURE_MALLOC_OVERRIDES_H_ + +#define malloc unity_malloc +#define calloc unity_calloc +#define realloc unity_realloc +#define free unity_free + +#endif /* UNITY_FIXTURE_MALLOC_OVERRIDES_H_ */ diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/main/AllTests.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/main/AllTests.c new file mode 100644 index 0000000..ccb775b --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/main/AllTests.c @@ -0,0 +1,21 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" + +static void runAllTests() +{ + RUN_TEST_GROUP(UnityFixture); + RUN_TEST_GROUP(UnityCommandOptions); + RUN_TEST_GROUP(LeakDetection) +} + +int main(int argc, char* argv[]) +{ + return UnityMain(argc, argv, runAllTests); +} + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/testunity_fixture.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/testunity_fixture.c new file mode 100644 index 0000000..de0c04c --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/testunity_fixture.c @@ -0,0 +1,39 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" + +static int data = -1; + +TEST_GROUP(mygroup); + +TEST_SETUP(mygroup) +{ + data = 0; +} + +TEST_TEAR_DOWN(mygroup) +{ + data = -1; +} + +TEST(mygroup, test1) +{ + TEST_ASSERT_EQUAL_INT(0, data); +} + +TEST(mygroup, test2) +{ + TEST_ASSERT_EQUAL_INT(0, data); + data = 5; +} + +TEST(mygroup, test3) +{ + data = 7; + TEST_ASSERT_EQUAL_INT(7, data); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_Test.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_Test.c new file mode 100644 index 0000000..b8b4524 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_Test.c @@ -0,0 +1,321 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" +#include "unity_output_Spy.h" +#include +#include + +extern UNITY_FIXTURE_T UnityFixture; + +TEST_GROUP(UnityFixture); + +TEST_SETUP(UnityFixture) +{ +} + +TEST_TEAR_DOWN(UnityFixture) +{ +} + +int my_int; +int* pointer1 = 0; +int* pointer2 = (int*)2; +int* pointer3 = (int*)3; +int int1; +int int2; +int int3; +int int4; + +TEST(UnityFixture, PointerSetting) +{ + TEST_ASSERT_POINTERS_EQUAL(pointer1, 0); + UT_PTR_SET(pointer1, &int1); + UT_PTR_SET(pointer2, &int2); + UT_PTR_SET(pointer3, &int3); + TEST_ASSERT_POINTERS_EQUAL(pointer1, &int1); + TEST_ASSERT_POINTERS_EQUAL(pointer2, &int2); + TEST_ASSERT_POINTERS_EQUAL(pointer3, &int3); + UT_PTR_SET(pointer1, &int4); + UnityPointer_UndoAllSets(); + TEST_ASSERT_POINTERS_EQUAL(pointer1, 0); + TEST_ASSERT_POINTERS_EQUAL(pointer2, (int*)2); + TEST_ASSERT_POINTERS_EQUAL(pointer3, (int*)3); +} + +TEST(UnityFixture, ForceMallocFail) +{ + UnityMalloc_MakeMallocFailAfterCount(1); + void* m = malloc(10); + CHECK(m); + void* mfails = malloc(10); + TEST_ASSERT_POINTERS_EQUAL(0, mfails); + free(m); +} + +TEST(UnityFixture, ReallocSmallerIsUnchanged) +{ + void* m1 = malloc(10); + void* m2 = realloc(m1, 5); + TEST_ASSERT_POINTERS_EQUAL(m1, m2); + free(m2); +} + +TEST(UnityFixture, ReallocSameIsUnchanged) +{ + void* m1 = malloc(10); + void* m2 = realloc(m1, 10); + TEST_ASSERT_POINTERS_EQUAL(m1, m2); + free(m2); +} + +TEST(UnityFixture, ReallocLargerNeeded) +{ + void* m1 = malloc(10); + strcpy((char*)m1, "123456789"); + void* m2 = realloc(m1, 15); + CHECK(m1 != m2); + STRCMP_EQUAL("123456789", m2); + free(m2); +} + +TEST(UnityFixture, ReallocNullPointerIsLikeMalloc) +{ + void* m = realloc(0, 15); + CHECK(m != 0); + free(m); +} + +TEST(UnityFixture, ReallocSizeZeroFreesMemAndReturnsNullPointer) +{ + void* m1 = malloc(10); + void* m2 = realloc(m1, 0); + TEST_ASSERT_POINTERS_EQUAL(0, m2); +} + +TEST(UnityFixture, CallocFillsWithZero) +{ + void* m = calloc(3, sizeof(char)); + char* s = (char*)m; + TEST_ASSERT_BYTES_EQUAL(0, s[0]); + TEST_ASSERT_BYTES_EQUAL(0, s[1]); + TEST_ASSERT_BYTES_EQUAL(0, s[2]); + free(m); +} + +char *p1; +char *p2; + +TEST(UnityFixture, PointerSet) +{ + char c1; + char c2; + char newC1; + char newC2; + p1 = &c1; + p2 = &c2; + + UnityPointer_Init(10); + UT_PTR_SET(p1, &newC1); + UT_PTR_SET(p2, &newC2); + TEST_ASSERT_POINTERS_EQUAL(&newC1, p1); + TEST_ASSERT_POINTERS_EQUAL(&newC2, p2); + UnityPointer_UndoAllSets(); + TEST_ASSERT_POINTERS_EQUAL(&c1, p1); + TEST_ASSERT_POINTERS_EQUAL(&c2, p2); +} + +//------------------------------------------------------------ + +TEST_GROUP(UnityCommandOptions); + +int savedVerbose; +int savedRepeat; +const char* savedName; +const char* savedGroup; + +TEST_SETUP(UnityCommandOptions) +{ + savedVerbose = UnityFixture.Verbose; + savedRepeat = UnityFixture.RepeatCount; + savedName = UnityFixture.NameFilter; + savedGroup = UnityFixture.GroupFilter; +} + +TEST_TEAR_DOWN(UnityCommandOptions) +{ + UnityFixture.Verbose = savedVerbose; + UnityFixture.RepeatCount= savedRepeat; + UnityFixture.NameFilter = savedName; + UnityFixture.GroupFilter = savedGroup; +} + + +static char* noOptions[] = { + "testrunner.exe" +}; + +TEST(UnityCommandOptions, DefaultOptions) +{ + UnityGetCommandLineOptions(1, noOptions); + TEST_ASSERT_EQUAL(0, UnityFixture.Verbose); + TEST_ASSERT_POINTERS_EQUAL(0, UnityFixture.GroupFilter); + TEST_ASSERT_POINTERS_EQUAL(0, UnityFixture.NameFilter); + TEST_ASSERT_EQUAL(1, UnityFixture.RepeatCount); +} + +static char* verbose[] = { + "testrunner.exe", + "-v" +}; + +TEST(UnityCommandOptions, OptionVerbose) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(2, verbose)); + TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); +} + +static char* group[] = { + "testrunner.exe", + "-g", "groupname" +}; + +TEST(UnityCommandOptions, OptionSelectTestByGroup) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, group)); + STRCMP_EQUAL("groupname", UnityFixture.GroupFilter); +} + +static char* name[] = { + "testrunner.exe", + "-n", "testname" +}; + +TEST(UnityCommandOptions, OptionSelectTestByName) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, name)); + STRCMP_EQUAL("testname", UnityFixture.NameFilter); +} + +static char* repeat[] = { + "testrunner.exe", + "-r", "99" +}; + +TEST(UnityCommandOptions, OptionSelectRepeatTestsDefaultCount) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(2, repeat)); + TEST_ASSERT_EQUAL(2, UnityFixture.RepeatCount); +} + +TEST(UnityCommandOptions, OptionSelectRepeatTestsSpecificCount) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, repeat)); + TEST_ASSERT_EQUAL(99, UnityFixture.RepeatCount); +} + +static char* multiple[] = { + "testrunner.exe", + "-v", + "-g", "groupname", + "-n", "testname", + "-r", "98" +}; + +TEST(UnityCommandOptions, MultipleOptions) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(8, multiple)); + TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); + STRCMP_EQUAL("groupname", UnityFixture.GroupFilter); + STRCMP_EQUAL("testname", UnityFixture.NameFilter); + TEST_ASSERT_EQUAL(98, UnityFixture.RepeatCount); +} + +static char* dashRNotLast[] = { + "testrunner.exe", + "-v", + "-g", "gggg", + "-r", + "-n", "tttt", +}; + +TEST(UnityCommandOptions, MultipleOptionsDashRNotLastAndNoValueSpecified) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(7, dashRNotLast)); + TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); + STRCMP_EQUAL("gggg", UnityFixture.GroupFilter); + STRCMP_EQUAL("tttt", UnityFixture.NameFilter); + TEST_ASSERT_EQUAL(2, UnityFixture.RepeatCount); +} + + +//------------------------------------------------------------ + +TEST_GROUP(LeakDetection); + +TEST_SETUP(LeakDetection) +{ + UnityOutputCharSpy_Create(1000); +} + +TEST_TEAR_DOWN(LeakDetection) +{ + UnityOutputCharSpy_Destroy(); +} + +#define EXPECT_ABORT_BEGIN \ + { \ + jmp_buf TestAbortFrame; \ + memcpy(TestAbortFrame, Unity.AbortFrame, sizeof(jmp_buf)); \ + if (TEST_PROTECT()) \ + { + +#define EXPECT_ABORT_END \ + } \ + memcpy(Unity.AbortFrame, TestAbortFrame, sizeof(jmp_buf)); \ + } + +TEST(LeakDetection, DetectsLeak) +{ + void* m = malloc(10); + UnityOutputCharSpy_Enable(1); + EXPECT_ABORT_BEGIN + UnityMalloc_EndTest(); + EXPECT_ABORT_END + UnityOutputCharSpy_Enable(0); + CHECK(strstr(UnityOutputCharSpy_Get(), "This test leaks!")); + free(m); + Unity.CurrentTestFailed = 0; +} + +TEST(LeakDetection, BufferOverrunFoundDuringFree) +{ + void* m = malloc(10); + char* s = (char*)m; + s[10] = (char)0xFF; + UnityOutputCharSpy_Enable(1); + EXPECT_ABORT_BEGIN + free(m); + EXPECT_ABORT_END + UnityOutputCharSpy_Enable(0); + CHECK(strstr(UnityOutputCharSpy_Get(), "Buffer overrun detected during free()")); + Unity.CurrentTestFailed = 0; +} + +TEST(LeakDetection, BufferOverrunFoundDuringRealloc) +{ + void* m = malloc(10); + char* s = (char*)m; + s[10] = (char)0xFF; + UnityOutputCharSpy_Enable(1); + EXPECT_ABORT_BEGIN + m = realloc(m, 100); + EXPECT_ABORT_END + UnityOutputCharSpy_Enable(0); + CHECK(strstr(UnityOutputCharSpy_Get(), "Buffer overrun detected during realloc()")); + Unity.CurrentTestFailed = 0; +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c new file mode 100644 index 0000000..80fec09 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c @@ -0,0 +1,40 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" + +TEST_GROUP_RUNNER(UnityFixture) +{ + RUN_TEST_CASE(UnityFixture, PointerSetting); + RUN_TEST_CASE(UnityFixture, ForceMallocFail); + RUN_TEST_CASE(UnityFixture, ReallocSmallerIsUnchanged); + RUN_TEST_CASE(UnityFixture, ReallocSameIsUnchanged); + RUN_TEST_CASE(UnityFixture, ReallocLargerNeeded); + RUN_TEST_CASE(UnityFixture, ReallocNullPointerIsLikeMalloc); + RUN_TEST_CASE(UnityFixture, ReallocSizeZeroFreesMemAndReturnsNullPointer); + RUN_TEST_CASE(UnityFixture, CallocFillsWithZero); + RUN_TEST_CASE(UnityFixture, PointerSet); +} + +TEST_GROUP_RUNNER(UnityCommandOptions) +{ + RUN_TEST_CASE(UnityCommandOptions, DefaultOptions); + RUN_TEST_CASE(UnityCommandOptions, OptionVerbose); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectTestByGroup); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectTestByName); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectRepeatTestsDefaultCount); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectRepeatTestsSpecificCount); + RUN_TEST_CASE(UnityCommandOptions, MultipleOptions); + RUN_TEST_CASE(UnityCommandOptions, MultipleOptionsDashRNotLastAndNoValueSpecified); +} + +TEST_GROUP_RUNNER(LeakDetection) +{ + RUN_TEST_CASE(LeakDetection, DetectsLeak); + RUN_TEST_CASE(LeakDetection, BufferOverrunFoundDuringFree); + RUN_TEST_CASE(LeakDetection, BufferOverrunFoundDuringRealloc); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/unity_output_Spy.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/unity_output_Spy.c new file mode 100644 index 0000000..16faefa --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/unity_output_Spy.c @@ -0,0 +1,56 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + + +#include "unity_output_Spy.h" +#include +#include +#include + +static int size; +static int count; +static char* buffer; +static int spy_enable; + +void UnityOutputCharSpy_Create(int s) +{ + size = s; + count = 0; + spy_enable = 0; + buffer = malloc(size); + memset(buffer, 0, size); +} + +void UnityOutputCharSpy_Destroy() +{ + size = 0; + free(buffer); +} + +int UnityOutputCharSpy_OutputChar(int c) +{ + if (spy_enable) + { + if (count < (size-1)) + buffer[count++] = c; + } + else + { + putchar(c); + } + return c; +} + +const char * UnityOutputCharSpy_Get() +{ + return buffer; +} + +void UnityOutputCharSpy_Enable(int enable) +{ + spy_enable = enable; +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/unity_output_Spy.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/unity_output_Spy.h new file mode 100644 index 0000000..7c1590e --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/unity_output_Spy.h @@ -0,0 +1,17 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef D_unity_output_Spy_H +#define D_unity_output_Spy_H + +void UnityOutputCharSpy_Create(int s); +void UnityOutputCharSpy_Destroy(); +int UnityOutputCharSpy_OutputChar(int c); +const char * UnityOutputCharSpy_Get(); +void UnityOutputCharSpy_Enable(int enable); + +#endif diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/makefile b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/makefile new file mode 100644 index 0000000..8c8444b --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/makefile @@ -0,0 +1,35 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +C_COMPILER=gcc +TARGET_BASE = testunity +ifeq ($(OS),Windows_NT) + TARGET_EXTENSION=.exe +else + TARGET_EXTENSION=.out +endif +TARGET = $(TARGET_BASE)$(TARGET_EXTENSION) +OUT_FILE=-o $(TARGET) +SRC_FILES=src/unity.c test/testunity.c build/testunity_Runner.c +INC_DIRS=-Isrc +SYMBOLS=-DTEST -DUNITY_SUPPORT_64 + +ifeq ($(OS),Windows_NT) + CLEANUP = del /F /Q build\* && del /F /Q $(TARGET) +else + CLEANUP = rm -f build/*.o ; rm -f $(TARGET) +endif + +all: clean default + +default: + ruby auto/generate_test_runner.rb test/testunity.c build/testunity_Runner.c + $(C_COMPILER) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES) $(OUT_FILE) + $(TARGET) + +clean: + $(CLEANUP) + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/rakefile.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/rakefile.rb new file mode 100644 index 0000000..3ec5d5a --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/rakefile.rb @@ -0,0 +1,48 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require HERE + 'rakefile_helper' + +include RakefileHelpers + +# Load default configuration, for now +DEFAULT_CONFIG_FILE = 'gcc.yml' +configure_toolchain(DEFAULT_CONFIG_FILE) + +desc "Test unity with its own unit tests" +task :unit do + run_tests get_unit_test_files +end + +Rake::TestTask.new(:scripts) do |t| + t.pattern = 'test/test_*.rb' + t.verbose = true +end + +desc "Generate test summary" +task :summary do + report_summary +end + +desc "Build and test Unity" +task :all => [:clean, :scripts, :unit, :summary] +task :default => [:clobber, :all] +task :ci => [:no_color, :default] +task :cruise => [:no_color, :default] + +desc "Load configuration" +task :config, :config_file do |t, args| + configure_toolchain(args[:config_file]) +end + +task :no_color do + $colour_output = false +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/rakefile_helper.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/rakefile_helper.rb new file mode 100644 index 0000000..218fcaa --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/rakefile_helper.rb @@ -0,0 +1,243 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require 'yaml' +require 'fileutils' +require HERE+'auto/unity_test_summary' +require HERE+'auto/generate_test_runner' +require HERE+'auto/colour_reporter' + +module RakefileHelpers + + C_EXTENSION = '.c' + + def load_configuration(config_file) + unless ($configured) + $cfg_file = "targets/#{config_file}" unless (config_file =~ /[\\|\/]/) + $cfg = YAML.load(File.read($cfg_file)) + $colour_output = false unless $cfg['colour'] + $configured = true if (config_file != DEFAULT_CONFIG_FILE) + end + end + + def configure_clean + CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil? + end + + def configure_toolchain(config_file=DEFAULT_CONFIG_FILE) + config_file += '.yml' unless config_file =~ /\.yml$/ + config_file = config_file unless config_file =~ /[\\|\/]/ + load_configuration(config_file) + configure_clean + end + + def get_unit_test_files + path = $cfg['compiler']['unit_tests_path'] + 'test*' + C_EXTENSION + path.gsub!(/\\/, '/') + FileList.new(path) + end + + def get_local_include_dirs + include_dirs = $cfg['compiler']['includes']['items'].dup + include_dirs.delete_if {|dir| dir.is_a?(Array)} + return include_dirs + end + + def extract_headers(filename) + includes = [] + lines = File.readlines(filename) + lines.each do |line| + m = line.match(/^\s*#include\s+\"\s*(.+\.[hH])\s*\"/) + if not m.nil? + includes << m[1] + end + end + return includes + end + + def find_source_file(header, paths) + paths.each do |dir| + src_file = dir + header.ext(C_EXTENSION) + if (File.exists?(src_file)) + return src_file + end + end + return nil + end + + def tackit(strings) + if strings.is_a?(Array) + result = "\"#{strings.join}\"" + else + result = strings + end + return result + end + + def squash(prefix, items) + result = '' + items.each { |item| result += " #{prefix}#{tackit(item)}" } + return result + end + + def build_compiler_fields + command = tackit($cfg['compiler']['path']) + if $cfg['compiler']['defines']['items'].nil? + defines = '' + else + defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items']) + end + options = squash('', $cfg['compiler']['options']) + includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :defines => defines, :options => options, :includes => includes} + end + + def compile(file, defines=[]) + compiler = build_compiler_fields + cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{file} " + + "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" + + "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" + execute(cmd_str) + end + + def build_linker_fields + command = tackit($cfg['linker']['path']) + if $cfg['linker']['options'].nil? + options = '' + else + options = squash('', $cfg['linker']['options']) + end + if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?) + includes = '' + else + includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) + end + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :options => options, :includes => includes} + end + + def link(exe_name, obj_list) + linker = build_linker_fields + cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + + (obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).join + + $cfg['linker']['bin_files']['prefix'] + ' ' + + $cfg['linker']['bin_files']['destination'] + + exe_name + $cfg['linker']['bin_files']['extension'] + execute(cmd_str) + end + + def build_simulator_fields + return nil if $cfg['simulator'].nil? + if $cfg['simulator']['path'].nil? + command = '' + else + command = (tackit($cfg['simulator']['path']) + ' ') + end + if $cfg['simulator']['pre_support'].nil? + pre_support = '' + else + pre_support = squash('', $cfg['simulator']['pre_support']) + end + if $cfg['simulator']['post_support'].nil? + post_support = '' + else + post_support = squash('', $cfg['simulator']['post_support']) + end + return {:command => command, :pre_support => pre_support, :post_support => post_support} + end + + def execute(command_string, verbose=true) + report command_string + output = `#{command_string}`.chomp + report(output) if (verbose && !output.nil? && (output.length > 0)) + if $?.exitstatus != 0 + raise "Command failed. (Returned #{$?.exitstatus})" + end + return output + end + + def report_summary + summary = UnityTestSummary.new + summary.set_root_path(HERE) + results_glob = "#{$cfg['compiler']['build_path']}*.test*" + results_glob.gsub!(/\\/, '/') + results = Dir[results_glob] + summary.set_targets(results) + summary.run + end + + def run_tests(test_files) + report 'Running Unity system tests...' + + # Tack on TEST define for compiling unit tests + load_configuration($cfg_file) + test_defines = ['TEST'] + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + $cfg['compiler']['defines']['items'] << 'TEST' + + include_dirs = get_local_include_dirs + + # Build and execute each unit test + test_files.each do |test| + obj_list = [] + + # Detect dependencies and build required modules + extract_headers(test).each do |header| + # Compile corresponding source file if it exists + src_file = find_source_file(header, include_dirs) + if !src_file.nil? + compile(src_file, test_defines) + obj_list << header.ext($cfg['compiler']['object_files']['extension']) + end + end + + # Build the test runner (generate if configured to do so) + test_base = File.basename(test, C_EXTENSION) + + runner_name = test_base + '_Runner.c' + runner_path = '' + + if $cfg['compiler']['runner_path'].nil? + runner_path = $cfg['compiler']['build_path'] + runner_name + else + runner_path = $cfg['compiler']['runner_path'] + runner_name + end + + options = $cfg[:unity] + options[:use_param_tests] = (test =~ /parameterized/) ? true : false + UnityTestRunnerGenerator.new(options).run(test, runner_path) + + compile(runner_path, test_defines) + obj_list << runner_name.ext($cfg['compiler']['object_files']['extension']) + + # Build the test module + compile(test, test_defines) + obj_list << test_base.ext($cfg['compiler']['object_files']['extension']) + + # Link the test executable + link(test_base, obj_list) + + # Execute unit test and generate results file + simulator = build_simulator_fields + executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] + if simulator.nil? + cmd_str = executable + else + cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" + end + output = execute(cmd_str) + test_results = $cfg['compiler']['build_path'] + test_base + if output.match(/OK$/m).nil? + test_results += '.testfail' + else + test_results += '.testpass' + end + File.open(test_results, 'w') { |f| f.print output } + + end + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/release/build.info b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/release/build.info new file mode 100644 index 0000000..7871b21 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/release/build.info @@ -0,0 +1,2 @@ +118 + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/release/version.info b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/release/version.info new file mode 100644 index 0000000..0d71c08 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/release/version.info @@ -0,0 +1,2 @@ +2.0 + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/src/unity.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/src/unity.c new file mode 100644 index 0000000..d85b880 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/src/unity.c @@ -0,0 +1,855 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity.h" +#include +#include + +#define UNITY_FAIL_AND_BAIL { Unity.CurrentTestFailed = 1; UNITY_OUTPUT_CHAR('\n'); longjmp(Unity.AbortFrame, 1); } +#define UNITY_IGNORE_AND_BAIL { Unity.CurrentTestIgnored = 1; UNITY_OUTPUT_CHAR('\n'); longjmp(Unity.AbortFrame, 1); } +/// return prematurely if we are already in failure or ignore state +#define UNITY_SKIP_EXECUTION { if ((Unity.CurrentTestFailed != 0) || (Unity.CurrentTestIgnored != 0)) {return;} } +#define UNITY_PRINT_EOL { UNITY_OUTPUT_CHAR('\n'); } + +struct _Unity Unity = { 0 }; + +const char* UnityStrNull = "NULL"; +const char* UnityStrSpacer = ". "; +const char* UnityStrExpected = " Expected "; +const char* UnityStrWas = " Was "; +const char* UnityStrTo = " To "; +const char* UnityStrElement = " Element "; +const char* UnityStrMemory = " Memory Mismatch"; +const char* UnityStrDelta = " Values Not Within Delta "; +const char* UnityStrPointless= " You Asked Me To Compare Nothing, Which Was Pointless."; +const char* UnityStrNullPointerForExpected= " Expected pointer to be NULL"; +const char* UnityStrNullPointerForActual = " Actual pointer was NULL"; + +const _U_UINT UnitySizeMask[] = +{ + 255, + 65535, + 65535, + 4294967295, + 4294967295, + 4294967295, + 4294967295 +#ifdef UNITY_SUPPORT_64 + ,0xFFFFFFFFFFFFFFFF +#endif +}; + +//----------------------------------------------- +// Pretty Printers & Test Result Output Handlers +//----------------------------------------------- + +void UnityPrint(const char* string) +{ + const char* pch = string; + + if (pch != NULL) + { + while (*pch) + { + // printable characters plus CR & LF are printed + if ((*pch <= 126) && (*pch >= 32)) + { + UNITY_OUTPUT_CHAR(*pch); + } + //write escaped carriage returns + else if (*pch == 13) + { + UNITY_OUTPUT_CHAR('\\'); + UNITY_OUTPUT_CHAR('r'); + } + //write escaped line feeds + else if (*pch == 10) + { + UNITY_OUTPUT_CHAR('\\'); + UNITY_OUTPUT_CHAR('n'); + } + // unprintable characters are shown as codes + else + { + UNITY_OUTPUT_CHAR('\\'); + UnityPrintNumberHex((_U_SINT)*pch, 2); + } + pch++; + } + } +} + +//----------------------------------------------- +void UnityPrintNumberByStyle(const _U_SINT number, const UNITY_DISPLAY_STYLE_T style) +{ + if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT) + { + UnityPrintNumber(number); + } + else if ((style & UNITY_DISPLAY_RANGE_UINT) == UNITY_DISPLAY_RANGE_UINT) + { + UnityPrintNumberUnsigned( (_U_UINT)number & UnitySizeMask[((_U_UINT)style & (_U_UINT)0x0F) - 1] ); + } + else + { + UnityPrintNumberHex((_U_UINT)number, (style & 0x000F) << 1); + } +} + +//----------------------------------------------- +/// basically do an itoa using as little ram as possible +void UnityPrintNumber(const _U_SINT number_to_print) +{ + _U_SINT divisor = 1; + _U_SINT next_divisor; + _U_SINT number = number_to_print; + + if (number < 0) + { + UNITY_OUTPUT_CHAR('-'); + number = -number; + } + + // figure out initial divisor + while (number / divisor > 9) + { + next_divisor = divisor * 10; + if (next_divisor > divisor) + divisor = next_divisor; + else + break; + } + + // now mod and print, then divide divisor + do + { + UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10))); + divisor /= 10; + } + while (divisor > 0); +} + +//----------------------------------------------- +/// basically do an itoa using as little ram as possible +void UnityPrintNumberUnsigned(const _U_UINT number) +{ + _U_UINT divisor = 1; + _U_UINT next_divisor; + + // figure out initial divisor + while (number / divisor > 9) + { + next_divisor = divisor * 10; + if (next_divisor > divisor) + divisor = next_divisor; + else + break; + } + + // now mod and print, then divide divisor + do + { + UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10))); + divisor /= 10; + } + while (divisor > 0); +} + +//----------------------------------------------- +void UnityPrintNumberHex(const _U_UINT number, const char nibbles_to_print) +{ + _U_UINT nibble; + char nibbles = nibbles_to_print; + UNITY_OUTPUT_CHAR('0'); + UNITY_OUTPUT_CHAR('x'); + + while (nibbles > 0) + { + nibble = (number >> (--nibbles << 2)) & 0x0000000F; + if (nibble <= 9) + { + UNITY_OUTPUT_CHAR((char)('0' + nibble)); + } + else + { + UNITY_OUTPUT_CHAR((char)('A' - 10 + nibble)); + } + } +} + +//----------------------------------------------- +void UnityPrintMask(const _U_UINT mask, const _U_UINT number) +{ + _U_UINT current_bit = (_U_UINT)1 << (UNITY_INT_WIDTH - 1); + _US32 i; + + for (i = 0; i < UNITY_INT_WIDTH; i++) + { + if (current_bit & mask) + { + if (current_bit & number) + { + UNITY_OUTPUT_CHAR('1'); + } + else + { + UNITY_OUTPUT_CHAR('0'); + } + } + else + { + UNITY_OUTPUT_CHAR('X'); + } + current_bit = current_bit >> 1; + } +} + +//----------------------------------------------- +#ifdef UNITY_FLOAT_VERBOSE +void UnityPrintFloat(_UF number) +{ + char TempBuffer[32]; + sprintf(TempBuffer, "%.6f", number); + UnityPrint(TempBuffer); +} +#endif + +//----------------------------------------------- +void UnityTestResultsBegin(const char* file, const UNITY_LINE_TYPE line) +{ + UnityPrint(file); + UNITY_OUTPUT_CHAR(':'); + UnityPrintNumber(line); + UNITY_OUTPUT_CHAR(':'); + UnityPrint(Unity.CurrentTestName); + UNITY_OUTPUT_CHAR(':'); +} + +//----------------------------------------------- +void UnityTestResultsFailBegin(const UNITY_LINE_TYPE line) +{ + UnityTestResultsBegin(Unity.TestFile, line); + UnityPrint("FAIL:"); +} + +//----------------------------------------------- +void UnityConcludeTest(void) +{ + if (Unity.CurrentTestIgnored) + { + Unity.TestIgnores++; + } + else if (!Unity.CurrentTestFailed) + { + UnityTestResultsBegin(Unity.TestFile, Unity.CurrentTestLineNumber); + UnityPrint("PASS"); + UNITY_PRINT_EOL; + } + else + { + Unity.TestFailures++; + } + + Unity.CurrentTestFailed = 0; + Unity.CurrentTestIgnored = 0; +} + +//----------------------------------------------- +void UnityAddMsgIfSpecified(const char* msg) +{ + if (msg) + { + UnityPrint(UnityStrSpacer); + UnityPrint(msg); + } +} + +//----------------------------------------------- +void UnityPrintExpectedAndActualStrings(const char* expected, const char* actual) +{ + UnityPrint(UnityStrExpected); + if (expected != NULL) + { + UNITY_OUTPUT_CHAR('\''); + UnityPrint(expected); + UNITY_OUTPUT_CHAR('\''); + } + else + { + UnityPrint(UnityStrNull); + } + UnityPrint(UnityStrWas); + if (actual != NULL) + { + UNITY_OUTPUT_CHAR('\''); + UnityPrint(actual); + UNITY_OUTPUT_CHAR('\''); + } + else + { + UnityPrint(UnityStrNull); + } +} + +//----------------------------------------------- +// Assertion & Control Helpers +//----------------------------------------------- + +int UnityCheckArraysForNull(const void* expected, const void* actual, const UNITY_LINE_TYPE lineNumber, const char* msg) +{ + //return true if they are both NULL + if ((expected == NULL) && (actual == NULL)) + return 1; + + //throw error if just expected is NULL + if (expected == NULL) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrNullPointerForExpected); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + //throw error if just actual is NULL + if (actual == NULL) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrNullPointerForActual); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + //return false if neither is NULL + return 0; +} + +//----------------------------------------------- +// Assertion Functions +//----------------------------------------------- + +void UnityAssertBits(const _U_SINT mask, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + UNITY_SKIP_EXECUTION; + + if ((mask & expected) != (mask & actual)) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrExpected); + UnityPrintMask(mask, expected); + UnityPrint(UnityStrWas); + UnityPrintMask(mask, actual); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualNumber(const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style) +{ + UNITY_SKIP_EXECUTION; + + if (expected != actual) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(expected, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(actual, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualIntArray(const _U_SINT* expected, + const _U_SINT* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style) +{ + _UU32 elements = num_elements; + const _US8* ptr_exp = (_US8*)expected; + const _US8* ptr_act = (_US8*)actual; + + UNITY_SKIP_EXECUTION; + + if (elements == 0) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + switch(style) + { + case UNITY_DISPLAY_STYLE_HEX8: + case UNITY_DISPLAY_STYLE_INT8: + case UNITY_DISPLAY_STYLE_UINT8: + while (elements--) + { + if (*ptr_exp != *ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 1; + ptr_act += 1; + } + break; + case UNITY_DISPLAY_STYLE_HEX16: + case UNITY_DISPLAY_STYLE_INT16: + case UNITY_DISPLAY_STYLE_UINT16: + while (elements--) + { + if (*(_US16*)ptr_exp != *(_US16*)ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*(_US16*)ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*(_US16*)ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 2; + ptr_act += 2; + } + break; +#ifdef UNITY_SUPPORT_64 + case UNITY_DISPLAY_STYLE_HEX64: + case UNITY_DISPLAY_STYLE_INT64: + case UNITY_DISPLAY_STYLE_UINT64: + while (elements--) + { + if (*(_US64*)ptr_exp != *(_US64*)ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*(_US64*)ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*(_US64*)ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 8; + ptr_act += 8; + } + break; +#endif + default: + while (elements--) + { + if (*(_US32*)ptr_exp != *(_US32*)ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*(_US32*)ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*(_US32*)ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 4; + ptr_act += 4; + } + break; + } +} + +//----------------------------------------------- +#ifndef UNITY_EXCLUDE_FLOAT +void UnityAssertEqualFloatArray(const _UF* expected, + const _UF* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UU32 elements = num_elements; + const _UF* ptr_expected = expected; + const _UF* ptr_actual = actual; + _UF diff, tol; + + UNITY_SKIP_EXECUTION; + + if (elements == 0) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + while (elements--) + { + diff = *ptr_expected - *ptr_actual; + if (diff < 0.0) + diff = 0.0 - diff; + tol = UNITY_FLOAT_PRECISION * *ptr_expected; + if (tol < 0.0) + tol = 0.0 - tol; + if (diff > tol) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); +#ifdef UNITY_FLOAT_VERBOSE + UnityPrint(UnityStrExpected); + UnityPrintFloat(*ptr_expected); + UnityPrint(UnityStrWas); + UnityPrintFloat(*ptr_actual); +#else + UnityPrint(UnityStrDelta); +#endif + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_expected++; + ptr_actual++; + } +} + +//----------------------------------------------- +void UnityAssertFloatsWithin(const _UF delta, + const _UF expected, + const _UF actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UF diff = actual - expected; + _UF pos_delta = delta; + + UNITY_SKIP_EXECUTION; + + if (diff < 0) + { + diff = 0.0f - diff; + } + if (pos_delta < 0) + { + pos_delta = 0.0f - pos_delta; + } + + if (pos_delta < diff) + { + UnityTestResultsFailBegin(lineNumber); +#ifdef UNITY_FLOAT_VERBOSE + UnityPrint(UnityStrExpected); + UnityPrintFloat(expected); + UnityPrint(UnityStrWas); + UnityPrintFloat(actual); +#else + UnityPrint(UnityStrDelta); +#endif + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} +#endif + +//----------------------------------------------- +void UnityAssertNumbersWithin( const _U_SINT delta, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style) +{ + UNITY_SKIP_EXECUTION; + + if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT) + { + if (actual > expected) + Unity.CurrentTestFailed = ((actual - expected) > delta); + else + Unity.CurrentTestFailed = ((expected - actual) > delta); + } + else + { + if ((_U_UINT)actual > (_U_UINT)expected) + Unity.CurrentTestFailed = ((_U_UINT)(actual - expected) > (_U_UINT)delta); + else + Unity.CurrentTestFailed = ((_U_UINT)(expected - actual) > (_U_UINT)delta); + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrDelta); + UnityPrintNumberByStyle(delta, style); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(expected, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(actual, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualString(const char* expected, + const char* actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UU32 i; + + UNITY_SKIP_EXECUTION; + + // if both pointers not null compare the strings + if (expected && actual) + { + for (i = 0; expected[i] || actual[i]; i++) + { + if (expected[i] != actual[i]) + { + Unity.CurrentTestFailed = 1; + break; + } + } + } + else + { // handle case of one pointers being null (if both null, test should pass) + if (expected != actual) + { + Unity.CurrentTestFailed = 1; + } + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrintExpectedAndActualStrings(expected, actual); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualStringArray( const char** expected, + const char** actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UU32 i, j = 0; + + UNITY_SKIP_EXECUTION; + + // if no elements, it's an error + if (num_elements == 0) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + do + { + // if both pointers not null compare the strings + if (expected[j] && actual[j]) + { + for (i = 0; expected[j][i] || actual[j][i]; i++) + { + if (expected[j][i] != actual[j][i]) + { + Unity.CurrentTestFailed = 1; + break; + } + } + } + else + { // handle case of one pointers being null (if both null, test should pass) + if (expected[j] != actual[j]) + { + Unity.CurrentTestFailed = 1; + } + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + if (num_elements > 1) + { + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - j - 1), UNITY_DISPLAY_STYLE_UINT); + } + UnityPrintExpectedAndActualStrings((const char*)(expected[j]), (const char*)(actual[j])); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + } while (++j < num_elements); +} + +//----------------------------------------------- +void UnityAssertEqualMemory( const void* expected, + const void* actual, + _UU32 length, + _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + unsigned char* expected_ptr = (unsigned char*)expected; + unsigned char* actual_ptr = (unsigned char*)actual; + _UU32 elements = num_elements; + + UNITY_SKIP_EXECUTION; + + if ((elements == 0) || (length == 0)) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + while (elements--) + { + if (memcmp((const void*)expected_ptr, (const void*)actual_ptr, length) != 0) + { + Unity.CurrentTestFailed = 1; + break; + } + expected_ptr += length; + actual_ptr += length; + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + if (num_elements > 1) + { + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + } + UnityPrint(UnityStrMemory); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +// Control Functions +//----------------------------------------------- + +void UnityFail(const char* msg, const UNITY_LINE_TYPE line) +{ + UNITY_SKIP_EXECUTION; + + UnityTestResultsBegin(Unity.TestFile, line); + UnityPrint("FAIL"); + if (msg != NULL) + { + UNITY_OUTPUT_CHAR(':'); + if (msg[0] != ' ') + { + UNITY_OUTPUT_CHAR(' '); + } + UnityPrint(msg); + } + UNITY_FAIL_AND_BAIL; +} + +//----------------------------------------------- +void UnityIgnore(const char* msg, const UNITY_LINE_TYPE line) +{ + UNITY_SKIP_EXECUTION; + + UnityTestResultsBegin(Unity.TestFile, line); + UnityPrint("IGNORE"); + if (msg != NULL) + { + UNITY_OUTPUT_CHAR(':'); + UNITY_OUTPUT_CHAR(' '); + UnityPrint(msg); + } + UNITY_IGNORE_AND_BAIL; +} + +//----------------------------------------------- +void setUp(void); +void tearDown(void); +void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum) +{ + Unity.CurrentTestName = FuncName; + Unity.CurrentTestLineNumber = FuncLineNum; + Unity.NumberOfTests++; + if (TEST_PROTECT()) + { + setUp(); + Func(); + } + if (TEST_PROTECT() && !(Unity.CurrentTestIgnored)) + { + tearDown(); + } + UnityConcludeTest(); +} + +//----------------------------------------------- +void UnityBegin(void) +{ + Unity.NumberOfTests = 0; +} + +//----------------------------------------------- +int UnityEnd(void) +{ + UnityPrint("-----------------------"); + UNITY_PRINT_EOL; + UnityPrintNumber(Unity.NumberOfTests); + UnityPrint(" Tests "); + UnityPrintNumber(Unity.TestFailures); + UnityPrint(" Failures "); + UnityPrintNumber(Unity.TestIgnores); + UnityPrint(" Ignored"); + UNITY_PRINT_EOL; + if (Unity.TestFailures == 0U) + { + UnityPrint("OK"); + } + else + { + UnityPrint("FAIL"); + } + UNITY_PRINT_EOL; + return Unity.TestFailures; +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/src/unity.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/src/unity.h new file mode 100644 index 0000000..0b1b187 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/src/unity.h @@ -0,0 +1,213 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FRAMEWORK_H +#define UNITY_FRAMEWORK_H + +#define UNITY + +#include "unity_internals.h" + +//------------------------------------------------------- +// Configuration Options +//------------------------------------------------------- + +// Integers +// - Unity assumes 32 bit integers by default +// - If your compiler treats ints of a different size, define UNITY_INT_WIDTH + +// Floats +// - define UNITY_EXCLUDE_FLOAT to disallow floating point comparisons +// - define UNITY_FLOAT_PRECISION to specify the precision to use when doing TEST_ASSERT_EQUAL_FLOAT +// - define UNITY_FLOAT_TYPE to specify doubles instead of single precision floats +// - define UNITY_FLOAT_VERBOSE to print floating point values in errors (uses sprintf) + +// Output +// - by default, Unity prints to standard out with putchar. define UNITY_OUTPUT_CHAR(a) with a different function if desired + +// Optimization +// - by default, line numbers are stored in unsigned shorts. Define UNITY_LINE_TYPE with a different type if your files are huge +// - by default, test and failure counters are unsigned shorts. Define UNITY_COUNTER_TYPE with a different type if you want to save space or have more than 65535 Tests. + +// Test Cases +// - define UNITY_SUPPORT_TEST_CASES to include the TEST_CASE macro, though really it's mostly about the runner generator script + +// Parameterized Tests +// - you'll want to create a define of TEST_CASE(...) which basically evaluates to nothing + +//------------------------------------------------------- +// Test Running Macros +//------------------------------------------------------- + +#define TEST_PROTECT() (setjmp(Unity.AbortFrame) == 0) + +#define TEST_ABORT() {longjmp(Unity.AbortFrame, 1);} + +#ifndef RUN_TEST +#define RUN_TEST(func, line_num) UnityDefaultTestRun(func, #func, line_num) +#endif + +#define TEST_LINE_NUM (Unity.CurrentTestLineNumber) +#define TEST_IS_IGNORED (Unity.CurrentTestIgnored) + +//------------------------------------------------------- +// Basic Fail and Ignore +//------------------------------------------------------- + +#define TEST_FAIL_MESSAGE(message) UNITY_TEST_FAIL(__LINE__, message) +#define TEST_FAIL() UNITY_TEST_FAIL(__LINE__, NULL) +#define TEST_IGNORE_MESSAGE(message) UNITY_TEST_IGNORE(__LINE__, message) +#define TEST_IGNORE() UNITY_TEST_IGNORE(__LINE__, NULL) +#define TEST_ONLY() + +//------------------------------------------------------- +// Test Asserts (simple) +//------------------------------------------------------- + +//Boolean +#define TEST_ASSERT(condition) UNITY_TEST_ASSERT( (condition), __LINE__, " Expression Evaluated To FALSE") +#define TEST_ASSERT_TRUE(condition) UNITY_TEST_ASSERT( (condition), __LINE__, " Expected TRUE Was FALSE") +#define TEST_ASSERT_UNLESS(condition) UNITY_TEST_ASSERT( !(condition), __LINE__, " Expression Evaluated To TRUE") +#define TEST_ASSERT_FALSE(condition) UNITY_TEST_ASSERT( !(condition), __LINE__, " Expected FALSE Was TRUE") +#define TEST_ASSERT_NULL(pointer) UNITY_TEST_ASSERT_NULL( (pointer), __LINE__, " Expected NULL") +#define TEST_ASSERT_NOT_NULL(pointer) UNITY_TEST_ASSERT_NOT_NULL((pointer), __LINE__, " Expected Non-NULL") + +//Integers (of all sizes) +#define TEST_ASSERT_EQUAL_INT(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT8(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT8((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT16(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT16((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT32(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT32((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT64(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT64((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_NOT_EQUAL(expected, actual) UNITY_TEST_ASSERT(((expected) != (actual)), __LINE__, " Expected Not-Equal") +#define TEST_ASSERT_EQUAL_UINT(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT8(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT8( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT16(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT16( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT32(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT32( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT64(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT64( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX8(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX8( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX16(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX16((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX32(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX64(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX64((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_BITS(mask, expected, actual) UNITY_TEST_ASSERT_BITS((mask), (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_BITS_HIGH(mask, actual) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(-1), (actual), __LINE__, NULL) +#define TEST_ASSERT_BITS_LOW(mask, actual) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(0), (actual), __LINE__, NULL) +#define TEST_ASSERT_BIT_HIGH(bit, actual) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(-1), (actual), __LINE__, NULL) +#define TEST_ASSERT_BIT_LOW(bit, actual) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(0), (actual), __LINE__, NULL) + +//Integer Ranges (of all sizes) +#define TEST_ASSERT_INT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_UINT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX8_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX16_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX32_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX64_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, __LINE__, NULL) + +//Structs and Strings +#define TEST_ASSERT_EQUAL_PTR(expected, actual) UNITY_TEST_ASSERT_EQUAL_PTR((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_STRING(expected, actual) UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_MEMORY(expected, actual, len) UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, __LINE__, NULL) + +//Arrays +#define TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements) UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, __LINE__, NULL) + +//Floating Point (If Enabled) +#define TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_FLOAT(expected, actual) UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, __LINE__, NULL) + +//------------------------------------------------------- +// Test Asserts (with additional messages) +//------------------------------------------------------- + +//Boolean +#define TEST_ASSERT_MESSAGE(condition, message) UNITY_TEST_ASSERT( (condition), __LINE__, message) +#define TEST_ASSERT_TRUE_MESSAGE(condition, message) UNITY_TEST_ASSERT( (condition), __LINE__, message) +#define TEST_ASSERT_UNLESS_MESSAGE(condition, message) UNITY_TEST_ASSERT( !(condition), __LINE__, message) +#define TEST_ASSERT_FALSE_MESSAGE(condition, message) UNITY_TEST_ASSERT( !(condition), __LINE__, message) +#define TEST_ASSERT_NULL_MESSAGE(pointer, message) UNITY_TEST_ASSERT_NULL( (pointer), __LINE__, message) +#define TEST_ASSERT_NOT_NULL_MESSAGE(pointer, message) UNITY_TEST_ASSERT_NOT_NULL((pointer), __LINE__, message) + +//Integers (of all sizes) +#define TEST_ASSERT_EQUAL_INT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT8((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT16((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT32((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT64((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, message) +#define TEST_ASSERT_NOT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT(((expected) != (actual)), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT8( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT16( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT32( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT64( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX8( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX16((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX64((expected), (actual), __LINE__, message) +#define TEST_ASSERT_BITS_MESSAGE(mask, expected, actual, message) UNITY_TEST_ASSERT_BITS((mask), (expected), (actual), __LINE__, message) +#define TEST_ASSERT_BITS_HIGH_MESSAGE(mask, actual, message) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(-1), (actual), __LINE__, message) +#define TEST_ASSERT_BITS_LOW_MESSAGE(mask, actual, message) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(0), (actual), __LINE__, message) +#define TEST_ASSERT_BIT_HIGH_MESSAGE(bit, actual, message) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(-1), (actual), __LINE__, message) +#define TEST_ASSERT_BIT_LOW_MESSAGE(bit, actual, message) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(0), (actual), __LINE__, message) + +//Integer Ranges (of all sizes) +#define TEST_ASSERT_INT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_UINT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX8_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX16_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX32_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX64_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, __LINE__, message) + +//Structs and Strings +#define TEST_ASSERT_EQUAL_PTR_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_PTR(expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_STRING_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_MEMORY_MESSAGE(expected, actual, len, message) UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, __LINE__, message) + +//Arrays +#define TEST_ASSERT_EQUAL_INT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_STRING_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_MEMORY_ARRAY_MESSAGE(expected, actual, len, num_elements, message) UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, __LINE__, message) + +//Floating Point (If Enabled) +#define TEST_ASSERT_FLOAT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_FLOAT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_FLOAT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, __LINE__, message) +#endif diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/src/unity_internals.h b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/src/unity_internals.h new file mode 100644 index 0000000..29c9d1d --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/src/unity_internals.h @@ -0,0 +1,355 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_INTERNALS_H +#define UNITY_INTERNALS_H + +#include +#include + +//------------------------------------------------------- +// Int Support +//------------------------------------------------------- + +#ifndef UNITY_INT_WIDTH +#define UNITY_INT_WIDTH (32) +#endif + +#ifndef UNITY_LONG_WIDTH +#define UNITY_LONG_WIDTH (32) +#endif + +#if (UNITY_INT_WIDTH == 32) + typedef unsigned char _UU8; + typedef unsigned short _UU16; + typedef unsigned int _UU32; + typedef signed char _US8; + typedef signed short _US16; + typedef signed int _US32; +#elif (UNITY_INT_WIDTH == 16) + typedef unsigned char _UU8; + typedef unsigned int _UU16; + typedef unsigned long _UU32; + typedef signed char _US8; + typedef signed int _US16; + typedef signed long _US32; +#else + #error Invalid UNITY_INT_WIDTH specified! (16 or 32 are supported) +#endif + +//------------------------------------------------------- +// 64-bit Support +//------------------------------------------------------- + +#ifndef UNITY_SUPPORT_64 + +//No 64-bit Support +typedef _UU32 _U_UINT; +typedef _US32 _U_SINT; + +#else + +//64-bit Support +#if (UNITY_LONG_WIDTH == 32) + typedef unsigned long long _UU64; + typedef signed long long _US64; +#elif (UNITY_LONG_WIDTH == 64) + typedef unsigned long _UU64; + typedef signed long _US64; +#else + #error Invalid UNITY_LONG_WIDTH specified! (32 or 64 are supported) +#endif +typedef _UU64 _U_UINT; +typedef _US64 _U_SINT; + +#endif + +//------------------------------------------------------- +// Pointer Support +//------------------------------------------------------- + +#ifndef UNITY_POINTER_WIDTH +#define UNITY_POINTER_WIDTH (32) +#endif + +#if (UNITY_POINTER_WIDTH == 32) + typedef _UU32 _UP; +#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX32 +#elif (UNITY_POINTER_WIDTH == 64) + typedef _UU64 _UP; +#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX64 +#elif (UNITY_POINTER_WIDTH == 16) + typedef _UU16 _UP; +#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX16 +#else + #error Invalid UNITY_POINTER_WIDTH specified! (16, 32 or 64 are supported) +#endif + +//------------------------------------------------------- +// Float Support +//------------------------------------------------------- + +#ifdef UNITY_EXCLUDE_FLOAT + +//No Floating Point Support +#undef UNITY_FLOAT_PRECISION +#undef UNITY_FLOAT_TYPE +#undef UNITY_FLOAT_VERBOSE + +#else + +//Floating Point Support +#ifndef UNITY_FLOAT_PRECISION +#define UNITY_FLOAT_PRECISION (0.00001f) +#endif +#ifndef UNITY_FLOAT_TYPE +#define UNITY_FLOAT_TYPE float +#endif +typedef UNITY_FLOAT_TYPE _UF; + +#endif + +//------------------------------------------------------- +// Output Method +//------------------------------------------------------- + +#ifndef UNITY_OUTPUT_CHAR +//Default to using putchar, which is defined in stdio.h above +#define UNITY_OUTPUT_CHAR(a) putchar(a) +#else +//If defined as something else, make sure we declare it here so it's ready for use +extern int UNITY_OUTPUT_CHAR(int); +#endif + +//------------------------------------------------------- +// Footprint +//------------------------------------------------------- + +#ifndef UNITY_LINE_TYPE +#define UNITY_LINE_TYPE unsigned short +#endif + +#ifndef UNITY_COUNTER_TYPE +#define UNITY_COUNTER_TYPE unsigned short +#endif + +//------------------------------------------------------- +// Internal Structs Needed +//------------------------------------------------------- + +typedef void (*UnityTestFunction)(void); + +#define UNITY_DISPLAY_RANGE_INT (0x10) +#define UNITY_DISPLAY_RANGE_UINT (0x20) +#define UNITY_DISPLAY_RANGE_HEX (0x40) +#define UNITY_DISPLAY_RANGE_AUTO (0x80) + +typedef enum +{ + UNITY_DISPLAY_STYLE_INT = 4 + UNITY_DISPLAY_RANGE_INT + UNITY_DISPLAY_RANGE_AUTO, + UNITY_DISPLAY_STYLE_INT8 = 1 + UNITY_DISPLAY_RANGE_INT, + UNITY_DISPLAY_STYLE_INT16 = 2 + UNITY_DISPLAY_RANGE_INT, + UNITY_DISPLAY_STYLE_INT32 = 4 + UNITY_DISPLAY_RANGE_INT, +#ifdef UNITY_SUPPORT_64 + UNITY_DISPLAY_STYLE_INT64 = 8 + UNITY_DISPLAY_RANGE_INT, +#endif + UNITY_DISPLAY_STYLE_UINT = 4 + UNITY_DISPLAY_RANGE_UINT + UNITY_DISPLAY_RANGE_AUTO, + UNITY_DISPLAY_STYLE_UINT8 = 1 + UNITY_DISPLAY_RANGE_UINT, + UNITY_DISPLAY_STYLE_UINT16 = 2 + UNITY_DISPLAY_RANGE_UINT, + UNITY_DISPLAY_STYLE_UINT32 = 4 + UNITY_DISPLAY_RANGE_UINT, +#ifdef UNITY_SUPPORT_64 + UNITY_DISPLAY_STYLE_UINT64 = 8 + UNITY_DISPLAY_RANGE_UINT, +#endif + UNITY_DISPLAY_STYLE_HEX8 = 1 + UNITY_DISPLAY_RANGE_HEX, + UNITY_DISPLAY_STYLE_HEX16 = 2 + UNITY_DISPLAY_RANGE_HEX, + UNITY_DISPLAY_STYLE_HEX32 = 4 + UNITY_DISPLAY_RANGE_HEX, +#ifdef UNITY_SUPPORT_64 + UNITY_DISPLAY_STYLE_HEX64 = 8 + UNITY_DISPLAY_RANGE_HEX, +#endif +} UNITY_DISPLAY_STYLE_T; + +struct _Unity +{ + const char* TestFile; + const char* CurrentTestName; + _UU32 CurrentTestLineNumber; + UNITY_COUNTER_TYPE NumberOfTests; + UNITY_COUNTER_TYPE TestFailures; + UNITY_COUNTER_TYPE TestIgnores; + UNITY_COUNTER_TYPE CurrentTestFailed; + UNITY_COUNTER_TYPE CurrentTestIgnored; + jmp_buf AbortFrame; +}; + +extern struct _Unity Unity; + +//------------------------------------------------------- +// Test Suite Management +//------------------------------------------------------- + +void UnityBegin(void); +int UnityEnd(void); +void UnityConcludeTest(void); +void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum); + +//------------------------------------------------------- +// Test Output +//------------------------------------------------------- + +void UnityPrint(const char* string); +void UnityPrintMask(const _U_UINT mask, const _U_UINT number); +void UnityPrintNumberByStyle(const _U_SINT number, const UNITY_DISPLAY_STYLE_T style); +void UnityPrintNumber(const _U_SINT number); +void UnityPrintNumberUnsigned(const _U_UINT number); +void UnityPrintNumberHex(const _U_UINT number, const char nibbles); + +#ifdef UNITY_FLOAT_VERBOSE +void UnityPrintFloat(const _UF number); +#endif + +//------------------------------------------------------- +// Test Assertion Fuctions +//------------------------------------------------------- +// Use the macros below this section instead of calling +// these directly. The macros have a consistent naming +// convention and will pull in file and line information +// for you. + +void UnityAssertEqualNumber(const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style); + +void UnityAssertEqualIntArray(const _U_SINT* expected, + const _U_SINT* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style); + +void UnityAssertBits(const _U_SINT mask, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualString(const char* expected, + const char* actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualStringArray( const char** expected, + const char** actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualMemory( const void* expected, + const void* actual, + const _UU32 length, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertNumbersWithin(const _U_SINT delta, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style); + +void UnityFail(const char* message, const UNITY_LINE_TYPE line); + +void UnityIgnore(const char* message, const UNITY_LINE_TYPE line); + +#ifndef UNITY_EXCLUDE_FLOAT +void UnityAssertFloatsWithin(const _UF delta, + const _UF expected, + const _UF actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualFloatArray(const _UF* expected, + const _UF* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber); +#endif + +//------------------------------------------------------- +// Basic Fail and Ignore +//------------------------------------------------------- + +#define UNITY_TEST_FAIL(line, message) UnityFail( (message), (UNITY_LINE_TYPE)line); +#define UNITY_TEST_IGNORE(line, message) UnityIgnore( (message), (UNITY_LINE_TYPE)line); + +//------------------------------------------------------- +// Test Asserts +//------------------------------------------------------- + +#define UNITY_TEST_ASSERT(condition, line, message) if (condition) {} else {UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, message);} +#define UNITY_TEST_ASSERT_NULL(pointer, line, message) UNITY_TEST_ASSERT(((pointer) == NULL), (UNITY_LINE_TYPE)line, message) +#define UNITY_TEST_ASSERT_NOT_NULL(pointer, line, message) UNITY_TEST_ASSERT(((pointer) != NULL), (UNITY_LINE_TYPE)line, message) + +#define UNITY_TEST_ASSERT_EQUAL_INT(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_UINT(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_HEX8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX8) +#define UNITY_TEST_ASSERT_EQUAL_HEX16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX16) +#define UNITY_TEST_ASSERT_EQUAL_HEX32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX32) +#define UNITY_TEST_ASSERT_BITS(mask, expected, actual, line, message) UnityAssertBits((_U_SINT)(mask), (_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line) + +#define UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX8) +#define UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX16) +#define UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX32) +#define UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64) + +#define UNITY_TEST_ASSERT_EQUAL_PTR(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(_UP)(expected), (_U_SINT)(_UP)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_POINTER) +#define UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, line, message) UnityAssertEqualString((const char*)(expected), (const char*)(actual), (message), (UNITY_LINE_TYPE)line) +#define UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, line, message) UnityAssertEqualMemory((void*)(expected), (void*)(actual), (_UU32)(len), 1, (message), (UNITY_LINE_TYPE)line) + +#define UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT8) +#define UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT16) +#define UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT32) +#define UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT8) +#define UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT16) +#define UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT32) +#define UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX8) +#define UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX16) +#define UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX32) +#define UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualStringArray((const char**)(expected), (const char**)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line) +#define UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, line, message) UnityAssertEqualMemory((void*)(expected), (void*)(actual), (_UU32)(len), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line) + +#ifdef UNITY_SUPPORT_64 +#define UNITY_TEST_ASSERT_EQUAL_INT64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT64) +#define UNITY_TEST_ASSERT_EQUAL_UINT64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT64) +#define UNITY_TEST_ASSERT_EQUAL_HEX64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64) +#define UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT64) +#define UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT64) +#define UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64) +#endif + +#ifdef UNITY_EXCLUDE_FLOAT +#define UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled") +#define UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled") +#define UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled") +#else +#define UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, line, message) UnityAssertFloatsWithin((_UF)(delta), (_UF)(expected), (_UF)(actual), (message), (UNITY_LINE_TYPE)line) +#define UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, line, message) UNITY_TEST_ASSERT_FLOAT_WITHIN((_UF)(expected) * (_UF)UNITY_FLOAT_PRECISION, (_UF)expected, (_UF)actual, (UNITY_LINE_TYPE)line, message) +#define UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualFloatArray((_UF*)(expected), (_UF*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line) +#endif + +#endif diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/targets/gcc.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/targets/gcc.yml new file mode 100644 index 0000000..0f18c6c --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/targets/gcc.yml @@ -0,0 +1,42 @@ +compiler: + path: gcc + source_path: 'src/' + unit_tests_path: &unit_tests_path 'test/' + build_path: &build_path 'build/' + options: + - '-c' + - '-Wall' + - '-Wno-address' + - '-std=c99' + - '-pedantic' + includes: + prefix: '-I' + items: + - 'src/' + - '../src/' + - *unit_tests_path + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - UNITY_SUPPORT_TEST_CASES + object_files: + prefix: '-o' + extension: '.o' + destination: *build_path +linker: + path: gcc + options: + - -lm + includes: + prefix: '-I' + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.exe' + destination: *build_path +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/targets/gcc_64.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/targets/gcc_64.yml new file mode 100644 index 0000000..97cb958 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/targets/gcc_64.yml @@ -0,0 +1,43 @@ +compiler: + path: gcc + source_path: 'src/' + unit_tests_path: &unit_tests_path 'test/' + build_path: &build_path 'build/' + options: + - '-c' + - '-Wall' + - '-Wno-address' + - '-std=c99' + - '-pedantic' + includes: + prefix: '-I' + items: + - 'src/' + - '../src/' + - *unit_tests_path + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - UNITY_SUPPORT_TEST_CASES + - 'UNITY_POINTER_WIDTH=64' + object_files: + prefix: '-o' + extension: '.o' + destination: *build_path +linker: + path: gcc + options: + - -lm + includes: + prefix: '-I' + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.exe' + destination: *build_path +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/targets/hitech_picc18.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/targets/hitech_picc18.yml new file mode 100644 index 0000000..210d944 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/targets/hitech_picc18.yml @@ -0,0 +1,101 @@ +# rumor has it that this yaml file works for the standard edition of the +# hitech PICC18 compiler, but not the pro version. +# +compiler: + path: cd build && picc18 + source_path: 'c:\Projects\NexGen\Prototypes\CMockTest\src\' + unit_tests_path: &unit_tests_path 'c:\Projects\NexGen\Prototypes\CMockTest\test\' + build_path: &build_path 'c:\Projects\NexGen\Prototypes\CMockTest\build\' + options: + - --chip=18F87J10 + - --ide=hitide + - --q #quiet please + - --asmlist + - --codeoffset=0 + - --emi=wordwrite # External memory interface protocol + - --warn=0 # allow all normal warning messages + - --errors=10 # Number of errors before aborting compile + - --char=unsigned + - -Bl # Large memory model + - -G # generate symbol file + - --cp=16 # 16-bit pointers + - --double=24 + - -N255 # 255-char symbol names + - --opt=none # Do not use any compiler optimziations + - -c # compile only + - -M + includes: + prefix: '-I' + items: + - 'c:/Projects/NexGen/Prototypes/CMockTest/src/' + - 'c:/Projects/NexGen/Prototypes/CMockTest/mocks/' + - 'c:/CMock/src/' + - 'c:/CMock/examples/src/' + - 'c:/CMock/vendor/unity/src/' + - 'c:/CMock/vendor/unity/examples/helper/' + - *unit_tests_path + defines: + prefix: '-D' + items: + - UNITY_INT_WIDTH=16 + - UNITY_POINTER_WIDTH=16 + - CMOCK_MEM_STATIC + - CMOCK_MEM_SIZE=3000 + - UNITY_SUPPORT_TEST_CASES + - _PICC18 + object_files: + # prefix: '-O' # Hi-Tech doesn't want a prefix. They key off of filename .extensions, instead + extension: '.obj' + destination: *build_path + +linker: + path: cd build && picc18 + options: + - --chip=18F87J10 + - --ide=hitide + - --cp=24 # 24-bit pointers. Is this needed for linker?? + - --double=24 # Is this needed for linker?? + - -Lw # Scan the pic87*w.lib in the lib/ of the compiler installation directory + - --summary=mem,file # info listing + - --summary=+psect + - --summary=+hex + - --output=+intel + - --output=+mcof + - --runtime=+init # Directs startup code to copy idata, ibigdata and ifardata psects from ROM to RAM. + - --runtime=+clear # Directs startup code to clear bss, bigbss, rbss and farbss psects + - --runtime=+clib # link in the c-runtime + - --runtime=+keep # Keep the generated startup src after its obj is linked + - -G # Generate src-level symbol file + - -MIWasTheLastToBuild.map + - --warn=0 # allow all normal warning messages + - -Bl # Large memory model (probably not needed for linking) + includes: + prefix: '-I' + object_files: + path: *build_path + extension: '.obj' + bin_files: + prefix: '-O' + extension: '.hex' + destination: *build_path + +simulator: + path: + pre_support: + - 'java -client -jar ' # note space + - ['C:\Program Files\HI-TECH Software\HI-TIDE\3.15\lib\', 'simpic18.jar'] + - 18F87J10 + post_support: + +:cmock: + :plugins: [] + :includes: + - Types.h + :suite_teardown: | + if (num_failures) + _FAILED_TEST(); + else + _PASSED_TESTS(); + return 0; + +colour: true \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_arm_v4.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_arm_v4.yml new file mode 100644 index 0000000..c2e7f18 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_arm_v4.yml @@ -0,0 +1,89 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 4.0 Kickstart\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\lib\dl4tptinl8n.h'] + - -z3 + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian little + - --cpu ARM7TDMI + - --stack_align 4 + - --interwork + - -e + - --silent + - --warnings_are_errors + - --fpu None + - --diag_suppress Pa050 + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'common\bin\xlink.exe'] + options: + - -rt + - [*tools_root, 'arm\lib\dl4tptinl8n.r79'] + - -D_L_EXTMEM_START=0 + - -D_L_EXTMEM_SIZE=0 + - -D_L_HEAP_SIZE=120 + - -D_L_STACK_SIZE=32 + - -e_small_write=_formatted_write + - -s + - __program_start + - -f + - [*tools_root, '\arm\config\lnkarm.xcl'] + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\config\'] + - [*tools_root, 'arm\lib\'] + object_files: + path: *build_path + extension: '.r79' + bin_files: + prefix: '-o' + extension: '.d79' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\ioat91sam7X256.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_arm_v5.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_arm_v5.yml new file mode 100644 index 0000000..0549d8e --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_arm_v5.yml @@ -0,0 +1,79 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian=little + - --cpu=ARM7TDMI + - --interwork + - --warnings_are_errors + - --fpu=None + - --diag_suppress=Pa050 + - --diag_suppress=Pe111 + - -e + - -On + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\debugger\atmel\ioat91sam7X256.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_arm_v5_3.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_arm_v5_3.yml new file mode 100644 index 0000000..0549d8e --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_arm_v5_3.yml @@ -0,0 +1,79 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian=little + - --cpu=ARM7TDMI + - --interwork + - --warnings_are_errors + - --fpu=None + - --diag_suppress=Pa050 + - --diag_suppress=Pe111 + - -e + - -On + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\debugger\atmel\ioat91sam7X256.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml new file mode 100644 index 0000000..eb0785c --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml @@ -0,0 +1,93 @@ +#Default tool path for IAR 5.4 on Windows XP 64bit +tools_root: &tools_root 'C:\Program Files (x86)\IAR Systems\Embedded Workbench 5.4 Kickstart\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --diag_suppress=Pa050 + #- --diag_suppress=Pe111 + - --debug + - --endian=little + - --cpu=Cortex-M3 + - --no_path_in_file_macros + - -e + - --fpu=None + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + #- --preinclude --preinclude C:\Vss\T2 Working\common\system.h + - --interwork + - --warnings_are_errors +# - Ohz + - -Oh +# - --no_cse +# - --no_unroll +# - --no_inline +# - --no_code_motion +# - --no_tbaa +# - --no_clustering +# - --no_scheduling + + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - ewarm + - PART_LM3S9B92 + - TARGET_IS_TEMPEST_RB1 + - USE_ROM_DRIVERS + - UART_BUFFERED + - UNITY_SUPPORT_64 + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic.icf'] +# - ['C:\Temp\lm3s9b92.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + #- --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim2.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - --endian=little + - --cpu=Cortex-M3 + - --fpu=None + - -p + - [*tools_root, 'arm\config\debugger\TexasInstruments\iolm3sxxxx.ddf'] + - --semihosting + - --device=LM3SxBxx + #- -d + #- sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_cortexm3_v5.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_cortexm3_v5.yml new file mode 100644 index 0000000..cf0d1d0 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_cortexm3_v5.yml @@ -0,0 +1,83 @@ +# unit testing under iar compiler / simulator for STM32 Cortex-M3 + +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.4\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian=little + - --cpu=Cortex-M3 + - --interwork + - --warnings_are_errors + - --fpu=None + - --diag_suppress=Pa050 + - --diag_suppress=Pe111 + - -e + - -On + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - 'IAR' + - 'UNITY_SUPPORT_64' + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic_cortex.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\debugger\ST\iostm32f107xx.ddf'] + - --cpu=Cortex-M3 + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_msp430.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_msp430.yml new file mode 100644 index 0000000..e022647 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_msp430.yml @@ -0,0 +1,94 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3 MSP430\' +core_root: &core_root [*tools_root, '430\'] +core_bin: &core_bin [*core_root, 'bin\'] +core_config: &core_config [*core_root, 'config\'] +core_lib: &core_lib [*core_root, 'lib\'] +core_inc: &core_inc [*core_root, 'inc\'] +core_config: &core_config [*core_root, 'config\'] + +compiler: + path: [*core_bin, 'icc430.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*core_lib, 'dlib\dl430fn.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --debug + - -e + - -Ol + - --multiplier=16 + - --double=32 + - --diag_suppress Pa050 + - --diag_suppress Pe111 + includes: + prefix: '-I' + items: + - *core_inc + - [*core_inc, 'dlib'] + - [*core_lib, 'dlib'] + - 'src\' + - '../src/' + - *unit_tests_path + - 'vendor\unity\src' + defines: + prefix: '-D' + items: + - '__MSP430F149__' + - 'INT_WIDTH=16' + - 'UNITY_EXCLUDE_FLOAT' + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r43' + destination: *build_path +linker: + path: [*core_bin, 'xlink.exe'] + options: + - -rt + - [*core_lib, 'dlib\dl430fn.r43'] + - -e_PrintfTiny=_Printf + - -e_ScanfSmall=_Scanf + - -s __program_start + - -D_STACK_SIZE=50 + - -D_DATA16_HEAP_SIZE=50 + - -D_DATA20_HEAP_SIZE=50 + - -f + - [*core_config, 'lnk430f5438.xcl'] + - -f + - [*core_config, 'multiplier.xcl'] + includes: + prefix: '-I' + items: + - *core_config + - *core_lib + - [*core_lib, 'dlib'] + object_files: + path: *build_path + extension: '.r79' + bin_files: + prefix: '-o' + extension: '.d79' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*core_bin, '430proc.dll'] + - [*core_bin, '430sim.dll'] + post_support: + - --plugin + - [*core_bin, '430bat.dll'] + - --backend -B + - --cpu MSP430F5438 + - -p + - [*core_config, 'MSP430F5438.ddf'] + - -d sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_sh2a_v6.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_sh2a_v6.yml new file mode 100644 index 0000000..ddc5603 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_sh2a_v6.yml @@ -0,0 +1,85 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 6.0\' +compiler: + path: [*tools_root, 'sh\bin\iccsh.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - -e + - --char_is_signed + - -Ol + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_scheduling + - --no_clustering + - --debug + - --dlib_config + - [*tools_root, 'sh\inc\DLib_Product.h'] + - --double=32 + - --code_model=huge + - --data_model=huge + - --core=sh2afpu + - --warnings_affect_exit_code + - --warnings_are_errors + - --mfc + - --use_unix_directory_separators + - --diag_suppress=Pe161 + includes: + prefix: '-I' + items: + - [*tools_root, 'sh\inc\'] + - [*tools_root, 'sh\inc\c'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.o' + destination: *build_path +linker: + path: [*tools_root, 'sh\bin\ilinksh.exe'] + options: + - --redirect __Printf=__PrintfSmall + - --redirect __Scanf=__ScanfSmall + - --config + - [*tools_root, 'sh\config\generic.icf'] + - --config_def _CSTACK_SIZE=0x800 + - --config_def _HEAP_SIZE=0x800 + - --config_def _INT_TABLE=0x10 + - --entry __iar_program_start + - --debug_lib + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'sh\bin\shproc.dll'] + - [*tools_root, 'sh\bin\shsim.dll'] + post_support: + - --plugin + - [*tools_root, 'sh\bin\shbat.dll'] + - --backend + - -B + - --core sh2afpu + - -p + - [*tools_root, 'sh\config\debugger\io7264.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_cmd.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_cmd.c new file mode 100644 index 0000000..42841d8 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_cmd.c @@ -0,0 +1,54 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include +#include "CException.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_def.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_def.c new file mode 100644 index 0000000..8280804 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_def.c @@ -0,0 +1,50 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_cmd.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_cmd.c new file mode 100644 index 0000000..e47b31c --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_cmd.c @@ -0,0 +1,76 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_def.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_def.c new file mode 100644 index 0000000..3ca9dba --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_def.c @@ -0,0 +1,72 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new1.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new1.c new file mode 100644 index 0000000..a7cbcd8 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new1.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + GlobalExpectCount = 0; + GlobalVerifyOrder = 0; + GlobalOrderError = NULL; + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new2.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new2.c new file mode 100644 index 0000000..2c76bf2 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new2.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_param.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_param.c new file mode 100644 index 0000000..23c04f4 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_param.c @@ -0,0 +1,73 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST_NO_ARGS +#define RUN_TEST(TestFunc, TestLineNum, ...) \ +{ \ + Unity.CurrentTestName = #TestFunc "(" #__VA_ARGS__ ")"; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(__VA_ARGS__); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21, RUN_TEST_NO_ARGS); + RUN_TEST(test_TheSecondThingToTest, 43, RUN_TEST_NO_ARGS); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run1.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run1.c new file mode 100644 index 0000000..a7cbcd8 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run1.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + GlobalExpectCount = 0; + GlobalVerifyOrder = 0; + GlobalOrderError = NULL; + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run2.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run2.c new file mode 100644 index 0000000..2c76bf2 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run2.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_yaml.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_yaml.c new file mode 100644 index 0000000..68b545a --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_yaml.c @@ -0,0 +1,86 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include "two.h" +#include "three.h" +#include +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_yaml_setup(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_new1.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_new1.c new file mode 100644 index 0000000..e5bcac2 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_new1.c @@ -0,0 +1,60 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_new2.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_new2.c new file mode 100644 index 0000000..b7c7e5b --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_new2.c @@ -0,0 +1,63 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_param.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_param.c new file mode 100644 index 0000000..4157007 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_param.c @@ -0,0 +1,51 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST_NO_ARGS +#define RUN_TEST(TestFunc, TestLineNum, ...) \ +{ \ + Unity.CurrentTestName = #TestFunc "(" #__VA_ARGS__ ")"; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(__VA_ARGS__); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21, RUN_TEST_NO_ARGS); + RUN_TEST(test_TheSecondThingToTest, 43, RUN_TEST_NO_ARGS); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_run1.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_run1.c new file mode 100644 index 0000000..e5bcac2 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_run1.c @@ -0,0 +1,60 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_run2.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_run2.c new file mode 100644 index 0000000..b7c7e5b --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_run2.c @@ -0,0 +1,63 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_yaml.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_yaml.c new file mode 100644 index 0000000..d109287 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_yaml.c @@ -0,0 +1,64 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "two.h" +#include "three.h" +#include +#include +#include +#include "CException.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_yaml_setup(); +} + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/test_generate_test_runner.rb b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/test_generate_test_runner.rb new file mode 100644 index 0000000..61c8df9 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/test_generate_test_runner.rb @@ -0,0 +1,94 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +ruby_version = RUBY_VERSION.split('.') +if (ruby_version[1].to_i == 9) and (ruby_version[2].to_i > 1) + require 'rubygems' + gem 'test-unit' +end +require 'test/unit' +require './auto/generate_test_runner.rb' + +TEST_FILE = 'test/testdata/testsample.c' +TEST_MOCK = 'test/testdata/mocksample.c' +OUT_FILE = 'build/testsample_' +EXP_FILE = 'test/expectdata/testsample_' + +class TestGenerateTestRunner < Test::Unit::TestCase + def setup + end + + def teardown + end + + def verify_output_equal(subtest) + expected = File.read(EXP_FILE + subtest + '.c').gsub(/\r\n/,"\n") + actual = File.read(OUT_FILE + subtest + '.c').gsub(/\r\n/,"\n") + assert_equal(expected, actual, "Generated File Sub-Test '#{subtest}' Failed") + end + + def test_ShouldGenerateARunnerByCreatingRunnerWithOptions + sets = { 'def' => nil, + 'new1' => { :plugins => [:cexception], :includes => ['one.h', 'two.h'], :enforce_strict_ordering => true }, + 'new2' => { :plugins => [:ignore], :suite_setup => "a_custom_setup();", :suite_teardown => "a_custom_teardown();" } + } + + sets.each_pair do |subtest, options| + UnityTestRunnerGenerator.new(options).run(TEST_FILE, OUT_FILE + subtest + '.c') + verify_output_equal(subtest) + UnityTestRunnerGenerator.new(options).run(TEST_MOCK, OUT_FILE + 'mock_' + subtest + '.c') + verify_output_equal('mock_' + subtest) + end + end + + def test_ShouldGenerateARunnerByRunningRunnerWithOptions + sets = { 'run1' => { :plugins => [:cexception], :includes => ['one.h', 'two.h'], :enforce_strict_ordering => true }, + 'run2' => { :plugins => [:ignore], :suite_setup => "a_custom_setup();", :suite_teardown => "a_custom_teardown();" } + } + + sets.each_pair do |subtest, options| + UnityTestRunnerGenerator.new.run(TEST_FILE, OUT_FILE + subtest + '.c', options) + verify_output_equal(subtest) + UnityTestRunnerGenerator.new.run(TEST_MOCK, OUT_FILE + 'mock_' + subtest + '.c', options) + verify_output_equal('mock_' + subtest) + end + end + + def test_ShouldGenerateARunnerByPullingYamlOptions + subtest = 'yaml' + cmdstr = "ruby auto/generate_test_runner.rb test/testdata/sample.yml \"#{TEST_FILE}\" \"#{OUT_FILE + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal(subtest) + + cmdstr = "ruby auto/generate_test_runner.rb test/testdata/sample.yml \"#{TEST_MOCK}\" \"#{OUT_FILE + 'mock_' + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal('mock_' + subtest) + end + + def test_ShouldGenerateARunnerByPullingCommandlineOptions + subtest = 'cmd' + cmdstr = "ruby auto/generate_test_runner.rb -cexception \"#{TEST_FILE}\" \"#{OUT_FILE + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal(subtest) + + cmdstr = "ruby auto/generate_test_runner.rb -cexception \"#{TEST_MOCK}\" \"#{OUT_FILE + 'mock_' + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal('mock_' + subtest) + end + + def test_ShouldGenerateARunnerThatUsesParameterizedTests + sets = { 'param' => { :plugins => [:ignore], :use_param_tests => true } + } + + sets.each_pair do |subtest, options| + UnityTestRunnerGenerator.new(options).run(TEST_FILE, OUT_FILE + subtest + '.c') + verify_output_equal(subtest) + UnityTestRunnerGenerator.new(options).run(TEST_MOCK, OUT_FILE + 'mock_' + subtest + '.c') + verify_output_equal('mock_' + subtest) + end + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/testdata/mocksample.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/testdata/mocksample.c new file mode 100644 index 0000000..b709438 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/testdata/mocksample.c @@ -0,0 +1,51 @@ +// This is just a sample test file to be used to test the generator script +#ifndef TEST_SAMPLE_H +#define TEST_SAMPLE_H + +#include +#include "unity.h" +#include "funky.h" +#include "Mockstanky.h" + +void setUp(void) +{ + CustomSetupStuff(); +} + +void tearDown(void) +{ + CustomTeardownStuff +} + +//Yup, nice comment +void test_TheFirstThingToTest(void) +{ + TEST_ASSERT(1); + + TEST_ASSERT_TRUE(1); +} + +/* +void test_ShouldBeIgnored(void) +{ + DoesStuff(); +} +*/ + +//void test_ShouldAlsoNotBeTested(void) +//{ +// Call_An_Expect(); +// +// CallAFunction(); +// test_CallAFunctionThatLooksLikeATest(); +//} + +void test_TheSecondThingToTest(void) +{ + Call_An_Expect(); + + CallAFunction(); + test_CallAFunctionThatLooksLikeATest(); +} + +#endif //TEST_SAMPLE_H diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/testdata/sample.yml b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/testdata/sample.yml new file mode 100644 index 0000000..9e5eece --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/testdata/sample.yml @@ -0,0 +1,9 @@ +:unity: + :includes: + - two.h + - three.h + - + :plugins: + - :cexception + :suite_setup: | + a_yaml_setup(); \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/testdata/testsample.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/testdata/testsample.c new file mode 100644 index 0000000..4f30ec7 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/testdata/testsample.c @@ -0,0 +1,51 @@ +// This is just a sample test file to be used to test the generator script +#ifndef TEST_SAMPLE_H +#define TEST_SAMPLE_H + +#include +#include "unity.h" +#include "funky.h" +#include "stanky.h" + +void setUp(void) +{ + CustomSetupStuff(); +} + +void tearDown(void) +{ + CustomTeardownStuff +} + +//Yup, nice comment +void test_TheFirstThingToTest(void) +{ + TEST_ASSERT(1); + + TEST_ASSERT_TRUE(1); +} + +/* +void test_ShouldBeIgnored(void) +{ + DoesStuff(); +} +*/ + +//void test_ShouldAlsoNotBeTested(void) +//{ +// Call_An_Expect(); +// +// CallAFunction(); +// test_CallAFunctionThatLooksLikeATest(); +//} + +void test_TheSecondThingToTest(void) +{ + Call_An_Expect(); + + CallAFunction(); + test_CallAFunctionThatLooksLikeATest(); +} + +#endif //TEST_SAMPLE_H diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/testparameterized.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/testparameterized.c new file mode 100644 index 0000000..037cd21 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/testparameterized.c @@ -0,0 +1,101 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include +#include "unity.h" + +#define TEST_CASE(...) + +#define EXPECT_ABORT_BEGIN \ + if (TEST_PROTECT()) \ + { + +#define VERIFY_FAILS_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestFailed == 1) ? 0 : 1; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Failed But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +#define VERIFY_IGNORES_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestIgnored == 1) ? 0 : 1; \ + Unity.CurrentTestIgnored = 0; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Ignored But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +int SetToOneToFailInTearDown; +int SetToOneMeanWeAlreadyCheckedThisGuy; + +void setUp(void) +{ + SetToOneToFailInTearDown = 0; + SetToOneMeanWeAlreadyCheckedThisGuy = 0; +} + +void tearDown(void) +{ + if (SetToOneToFailInTearDown == 1) + TEST_FAIL_MESSAGE("<= Failed in tearDown"); + if ((SetToOneMeanWeAlreadyCheckedThisGuy == 0) && (Unity.CurrentTestFailed > 0)) + { + UnityPrint("[[[[ Previous Test Should Have Passed But Did Not ]]]]"); + UNITY_OUTPUT_CHAR('\n'); + } +} + +TEST_CASE(0) +TEST_CASE(44) +TEST_CASE((90)+9) +void test_TheseShouldAllPass(int Num) +{ + TEST_ASSERT_TRUE(Num < 100); +} + +TEST_CASE(3) +TEST_CASE(77) +TEST_CASE( (99) + 1 - (1)) +void test_TheseShouldAllFail(int Num) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(Num > 100); + VERIFY_FAILS_END +} + +TEST_CASE(1) +TEST_CASE(44) +TEST_CASE(99) +TEST_CASE(98) +void test_TheseAreEveryOther(int Num) +{ + if (Num & 1) + { + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(Num > 100); + VERIFY_FAILS_END + } + else + { + TEST_ASSERT_TRUE(Num < 100); + } +} + +void test_NormalPassesStillWork(void) +{ + TEST_ASSERT_TRUE(1); +} + +void test_NormalFailsStillWork(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(0); + VERIFY_FAILS_END +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/testunity.c b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/testunity.c new file mode 100644 index 0000000..9f826dc --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/cmock/vendor/unity/test/testunity.c @@ -0,0 +1,1510 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include +#include "unity.h" + +#define EXPECT_ABORT_BEGIN \ + if (TEST_PROTECT()) \ + { + +#define VERIFY_FAILS_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestFailed == 1) ? 0 : 1; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Failed But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +#define VERIFY_IGNORES_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestIgnored == 1) ? 0 : 1; \ + Unity.CurrentTestIgnored = 0; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Ignored But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +int SetToOneToFailInTearDown; +int SetToOneMeanWeAlreadyCheckedThisGuy; + +void setUp(void) +{ + SetToOneToFailInTearDown = 0; + SetToOneMeanWeAlreadyCheckedThisGuy = 0; +} + +void tearDown(void) +{ + if (SetToOneToFailInTearDown == 1) + TEST_FAIL_MESSAGE("<= Failed in tearDown"); + if ((SetToOneMeanWeAlreadyCheckedThisGuy == 0) && (Unity.CurrentTestFailed > 0)) + { + UnityPrint("[[[[ Previous Test Should Have Passed But Did Not ]]]]"); + UNITY_OUTPUT_CHAR('\n'); + } +} + +void testTrue(void) +{ + TEST_ASSERT(1); + + TEST_ASSERT_TRUE(1); +} + +void testFalse(void) +{ + TEST_ASSERT_FALSE(0); + + TEST_ASSERT_UNLESS(0); +} + +void testPreviousPass(void) +{ + TEST_ASSERT_EQUAL_INT(0U, Unity.TestFailures); +} + +void testNotVanilla(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT(0); + VERIFY_FAILS_END +} + +void testNotTrue(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(0); + VERIFY_FAILS_END +} + +void testNotFalse(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_FALSE(1); + VERIFY_FAILS_END +} + +void testNotUnless(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UNLESS(1); + VERIFY_FAILS_END +} + +void testNotNotEqual(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_NOT_EQUAL(10, 10); + VERIFY_FAILS_END +} + +void testFail(void) +{ + EXPECT_ABORT_BEGIN + TEST_FAIL_MESSAGE("Expected for testing"); + VERIFY_FAILS_END +} + +void testIsNull(void) +{ + char* ptr1 = NULL; + char* ptr2 = "hello"; + + TEST_ASSERT_NULL(ptr1); + TEST_ASSERT_NOT_NULL(ptr2); +} + +void testIsNullShouldFailIfNot(void) +{ + char* ptr1 = "hello"; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_NULL(ptr1); + VERIFY_FAILS_END +} + +void testNotNullShouldFailIfNULL(void) +{ + char* ptr1 = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_NOT_NULL(ptr1); + VERIFY_FAILS_END +} + +void testIgnore(void) +{ + EXPECT_ABORT_BEGIN + TEST_IGNORE(); + TEST_FAIL_MESSAGE("This should not be reached"); + VERIFY_IGNORES_END +} + +void testIgnoreMessage(void) +{ + EXPECT_ABORT_BEGIN + TEST_IGNORE_MESSAGE("This is an expected TEST_IGNORE_MESSAGE string!"); + TEST_FAIL_MESSAGE("This should not be reached"); + VERIFY_IGNORES_END +} + +void testNotEqualInts(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT(3982, 3983); + VERIFY_FAILS_END +} + +void testNotEqualInt8s(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT8(-127, -126); + VERIFY_FAILS_END +} + +void testNotEqualInt16s(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT16(-16383, -16382); + VERIFY_FAILS_END +} + +void testNotEqualInt32s(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT32(-2147483647, -2147483646); + VERIFY_FAILS_END +} + +void testNotEqualBits(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_BITS(0xFF00, 0x5555, 0x5A55); + VERIFY_FAILS_END +} + +void testNotEqualUInts(void) +{ + _UU16 v0, v1; + + v0 = 9000; + v1 = 9001; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualUInt8s(void) +{ + _UU8 v0, v1; + + v0 = 254; + v1 = 255; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT8(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualUInt16s(void) +{ + _UU16 v0, v1; + + v0 = 65535; + v1 = 65534; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualUInt32s(void) +{ + _UU32 v0, v1; + + v0 = 4294967295; + v1 = 4294967294; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT32(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex8s(void) +{ + _UU8 v0, v1; + + v0 = 0x23; + v1 = 0x22; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex8sIfSigned(void) +{ + _US8 v0, v1; + + v0 = -2; + v1 = 2; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex16s(void) +{ + _UU16 v0, v1; + + v0 = 0x1234; + v1 = 0x1235; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex16sIfSigned(void) +{ + _US16 v0, v1; + + v0 = -1024; + v1 = -1028; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex32s(void) +{ + _UU32 v0, v1; + + v0 = 900000; + v1 = 900001; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex32sIfSigned(void) +{ + _US32 v0, v1; + + v0 = -900000; + v1 = 900001; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32(v0, v1); + VERIFY_FAILS_END +} + +void testEqualInts(void) +{ + int v0, v1; + int *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(1837, 1837); + TEST_ASSERT_EQUAL_INT(-27365, -27365); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(19467, v1); + TEST_ASSERT_EQUAL_INT(v0, 19467); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 19467); +} + +void testEqualUints(void) +{ + unsigned int v0, v1; + unsigned int *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_UINT(1837, 1837); + TEST_ASSERT_EQUAL_UINT(v0, v1); + TEST_ASSERT_EQUAL_UINT(19467, v1); + TEST_ASSERT_EQUAL_UINT(v0, 19467); + TEST_ASSERT_EQUAL_UINT(*p0, v1); + TEST_ASSERT_EQUAL_UINT(*p0, *p1); + TEST_ASSERT_EQUAL_UINT(*p0, 19467); + TEST_ASSERT_EQUAL_UINT(60872u, 60872u); +} + +void testNotEqual(void) +{ + TEST_ASSERT_NOT_EQUAL(0, 1); + TEST_ASSERT_NOT_EQUAL(1, 0); + TEST_ASSERT_NOT_EQUAL(100, 101); + TEST_ASSERT_NOT_EQUAL(0, -1); + TEST_ASSERT_NOT_EQUAL(65535, -65535); + TEST_ASSERT_NOT_EQUAL(75, 900); + TEST_ASSERT_NOT_EQUAL(-100, -101); +} + +void testEqualHex8s(void) +{ + _UU8 v0, v1; + _UU8 *p0, *p1; + + v0 = 0x22; + v1 = 0x22; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX8(0x22, 0x22); + TEST_ASSERT_EQUAL_HEX8(v0, v1); + TEST_ASSERT_EQUAL_HEX8(0x22, v1); + TEST_ASSERT_EQUAL_HEX8(v0, 0x22); + TEST_ASSERT_EQUAL_HEX8(*p0, v1); + TEST_ASSERT_EQUAL_HEX8(*p0, *p1); + TEST_ASSERT_EQUAL_HEX8(*p0, 0x22); +} + +void testEqualHex8sNegatives(void) +{ + _UU8 v0, v1; + _UU8 *p0, *p1; + + v0 = 0xDD; + v1 = 0xDD; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX8(0xDD, 0xDD); + TEST_ASSERT_EQUAL_HEX8(v0, v1); + TEST_ASSERT_EQUAL_HEX8(0xDD, v1); + TEST_ASSERT_EQUAL_HEX8(v0, 0xDD); + TEST_ASSERT_EQUAL_HEX8(*p0, v1); + TEST_ASSERT_EQUAL_HEX8(*p0, *p1); + TEST_ASSERT_EQUAL_HEX8(*p0, 0xDD); +} + +void testEqualHex16s(void) +{ + _UU16 v0, v1; + _UU16 *p0, *p1; + + v0 = 0x9876; + v1 = 0x9876; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX16(0x9876, 0x9876); + TEST_ASSERT_EQUAL_HEX16(v0, v1); + TEST_ASSERT_EQUAL_HEX16(0x9876, v1); + TEST_ASSERT_EQUAL_HEX16(v0, 0x9876); + TEST_ASSERT_EQUAL_HEX16(*p0, v1); + TEST_ASSERT_EQUAL_HEX16(*p0, *p1); + TEST_ASSERT_EQUAL_HEX16(*p0, 0x9876); +} + +void testEqualHex32s(void) +{ + _UU32 v0, v1; + _UU32 *p0, *p1; + + v0 = 0x98765432ul; + v1 = 0x98765432ul; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX32(0x98765432ul, 0x98765432ul); + TEST_ASSERT_EQUAL_HEX32(v0, v1); + TEST_ASSERT_EQUAL_HEX32(0x98765432ul, v1); + TEST_ASSERT_EQUAL_HEX32(v0, 0x98765432ul); + TEST_ASSERT_EQUAL_HEX32(*p0, v1); + TEST_ASSERT_EQUAL_HEX32(*p0, *p1); + TEST_ASSERT_EQUAL_HEX32(*p0, 0x98765432ul); +} + +void testEqualBits(void) +{ + _UU32 v0 = 0xFF55AA00; + _UU32 v1 = 0x55550000; + + TEST_ASSERT_BITS(v1, v0, 0x55550000); + TEST_ASSERT_BITS(v1, v0, 0xFF55CC00); + TEST_ASSERT_BITS(0xFFFFFFFF, v0, 0xFF55AA00); + TEST_ASSERT_BITS(0xFFFFFFFF, v0, v0); + TEST_ASSERT_BITS(0xF0F0F0F0, v0, 0xFC5DAE0F); + TEST_ASSERT_BITS_HIGH(v1, v0); + TEST_ASSERT_BITS_LOW(0x000055FF, v0); + TEST_ASSERT_BIT_HIGH(30, v0); + TEST_ASSERT_BIT_LOW(5, v0); +} + +void testEqualShorts(void) +{ + short v0, v1; + short *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(1837, 1837); + TEST_ASSERT_EQUAL_INT(-2987, -2987); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(19467, v1); + TEST_ASSERT_EQUAL_INT(v0, 19467); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 19467); +} + +void testEqualUShorts(void) +{ + unsigned short v0, v1; + unsigned short *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_UINT(1837, 1837); + TEST_ASSERT_EQUAL_UINT(2987, 2987); + TEST_ASSERT_EQUAL_UINT(v0, v1); + TEST_ASSERT_EQUAL_UINT(19467, v1); + TEST_ASSERT_EQUAL_UINT(v0, 19467); + TEST_ASSERT_EQUAL_UINT(*p0, v1); + TEST_ASSERT_EQUAL_UINT(*p0, *p1); + TEST_ASSERT_EQUAL_UINT(*p0, 19467); +} + +void testEqualChars(void) +{ + signed char v0, v1; + signed char *p0, *p1; + + v0 = 109; + v1 = 109; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(42, 42); + TEST_ASSERT_EQUAL_INT(-116, -116); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(109, v1); + TEST_ASSERT_EQUAL_INT(v0, 109); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 109); +} + +void testEqualUChars(void) +{ + unsigned char v0, v1; + unsigned char *p0, *p1; + + v0 = 251; + v1 = 251; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(42, 42); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(251, v1); + TEST_ASSERT_EQUAL_INT(v0, 251); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 251); +} + +void testEqualPointers(void) +{ + int v0, v1; + int *p0, *p1, *p2; + + v0 = 19467; + v1 = 18271; + p0 = &v0; + p1 = &v1; + p2 = &v1; + + TEST_ASSERT_EQUAL_PTR(p0, &v0); + TEST_ASSERT_EQUAL_PTR(&v1, p1); + TEST_ASSERT_EQUAL_PTR(p2, p1); + TEST_ASSERT_EQUAL_PTR(&v0, &v0); +} + +void testNotEqualPointers(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_PTR(0x12345678, 0x12345677); + VERIFY_FAILS_END +} + +void testIntsWithinDelta(void) +{ + TEST_ASSERT_INT_WITHIN(1, 5000, 5001); + TEST_ASSERT_INT_WITHIN(5, 5000, 4996); + TEST_ASSERT_INT_WITHIN(5, 5000, 5005); + TEST_ASSERT_INT_WITHIN(500, 50, -440); + + TEST_ASSERT_INT_WITHIN(2, -1, -1); + TEST_ASSERT_INT_WITHIN(5, 1, -1); + TEST_ASSERT_INT_WITHIN(5, -1, 1); +} + +void testIntsNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_INT_WITHIN(5, 5000, 5006); + VERIFY_FAILS_END +} + +void testUIntsWithinDelta(void) +{ + TEST_ASSERT_UINT_WITHIN(1, 5000, 5001); + TEST_ASSERT_UINT_WITHIN(5, 5000, 4996); + TEST_ASSERT_UINT_WITHIN(5, 5000, 5005); +} + +void testUIntsNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UINT_WITHIN(1, 2147483647u, 2147483649u); + VERIFY_FAILS_END +} + +void testUIntsNotWithinDeltaEvenThoughASignedIntWouldPassSmallFirst(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UINT_WITHIN(5, 1, -1); + VERIFY_FAILS_END +} + +void testUIntsNotWithinDeltaEvenThoughASignedIntWouldPassBigFirst(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UINT_WITHIN(5, -1, 1); + VERIFY_FAILS_END +} + +void testHEX32sWithinDelta(void) +{ + TEST_ASSERT_HEX32_WITHIN(1, 5000, 5001); + TEST_ASSERT_HEX32_WITHIN(5, 5000, 4996); + TEST_ASSERT_HEX32_WITHIN(5, 5000, 5005); +} + +void testHEX32sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX32_WITHIN(1, 2147483647u, 2147483649u); + VERIFY_FAILS_END +} + +void testHEX32sNotWithinDeltaEvenThoughASignedIntWouldPass(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX32_WITHIN(5, 1, -1); + VERIFY_FAILS_END +} + +void testHEX16sWithinDelta(void) +{ + TEST_ASSERT_HEX16_WITHIN(1, 5000, 5001); + TEST_ASSERT_HEX16_WITHIN(5, 5000, 4996); + TEST_ASSERT_HEX16_WITHIN(5, 5000, 5005); +} + +void testHEX16sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX16_WITHIN(2, 65535, 0); + VERIFY_FAILS_END +} + +void testHEX8sWithinDelta(void) +{ + TEST_ASSERT_HEX8_WITHIN(1, 254, 255); + TEST_ASSERT_HEX8_WITHIN(5, 251, 255); + TEST_ASSERT_HEX8_WITHIN(5, 1, 4); +} + +void testHEX8sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX8_WITHIN(2, 255, 0); + VERIFY_FAILS_END +} + +void testEqualStrings(void) +{ + const char *testString = "foo"; + + TEST_ASSERT_EQUAL_STRING(testString, testString); + TEST_ASSERT_EQUAL_STRING("foo", "foo"); + TEST_ASSERT_EQUAL_STRING("foo", testString); + TEST_ASSERT_EQUAL_STRING(testString, "foo"); + TEST_ASSERT_EQUAL_STRING("", ""); +} + +void testEqualStringsWithCarriageReturnsAndLineFeeds(void) +{ + const char *testString = "foo\r\nbar"; + + TEST_ASSERT_EQUAL_STRING(testString, testString); + TEST_ASSERT_EQUAL_STRING("foo\r\nbar", "foo\r\nbar"); + TEST_ASSERT_EQUAL_STRING("foo\r\nbar", testString); + TEST_ASSERT_EQUAL_STRING(testString, "foo\r\nbar"); + TEST_ASSERT_EQUAL_STRING("", ""); +} + +void testNotEqualString1(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("foo", "bar"); + VERIFY_FAILS_END +} + +void testNotEqualString2(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("foo", ""); + VERIFY_FAILS_END +} + +void testNotEqualString3(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("", "bar"); + VERIFY_FAILS_END +} + +void testNotEqualString4(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("bar\r", "bar\n"); + VERIFY_FAILS_END +} + +void testNotEqualString5(void) +{ + const char str1[] = { 0x41, 0x42, 0x03, 0x00 }; + const char str2[] = { 0x41, 0x42, 0x04, 0x00 }; + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING(str1, str2); + VERIFY_FAILS_END +} + +void testNotEqualString_ExpectedStringIsNull(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING(NULL, "bar"); + VERIFY_FAILS_END +} + +void testNotEqualString_ActualStringIsNull(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("foo", NULL); + VERIFY_FAILS_END +} + +void testEqualStringArrays(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, expStrings, 3); + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 3); + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 2); + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 1); +} + +void testNotEqualStringArray1(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray2(void) +{ + const char *testStrings[] = { "zoo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", "boo", "woo", "moo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray3(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", NULL }; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray4(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", NULL, "woo", "moo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray5(void) +{ + const char **testStrings = NULL; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray6(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "zoo" }; + const char **expStrings = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testEqualStringArrayIfBothNulls(void) +{ + const char **testStrings = NULL; + const char **expStrings = NULL; + + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); +} + +void testEqualMemory(void) +{ + const char *testString = "whatever"; + + TEST_ASSERT_EQUAL_MEMORY(testString, testString, 8); + TEST_ASSERT_EQUAL_MEMORY("whatever", "whatever", 8); + TEST_ASSERT_EQUAL_MEMORY("whatever", testString, 8); + TEST_ASSERT_EQUAL_MEMORY(testString, "whatever", 8); + TEST_ASSERT_EQUAL_MEMORY(testString, "whatever", 2); + TEST_ASSERT_EQUAL_MEMORY(NULL, NULL, 1); +} + +void testNotEqualMemory1(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY("foo", "bar", 3); + VERIFY_FAILS_END +} + +void testNotEqualMemory2(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY("fool", "food", 4); + VERIFY_FAILS_END +} + +void testNotEqualMemory3(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY(NULL, "food", 4); + VERIFY_FAILS_END +} + +void testNotEqualMemory4(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY("fool", NULL, 4); + VERIFY_FAILS_END +} + +void testEqualIntArrays(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, -2}; + int p2[] = {1, 8, 987, 2}; + int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p3, 1); +} + +void testNotEqualIntArraysNullExpected(void) +{ + int* p0 = NULL; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArraysNullActual(void) +{ + int* p1 = NULL; + int p0[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArrays1(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArrays2(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {2, 8, 987, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArrays3(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 986, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualInt8Arrays(void) +{ + _US8 p0[] = {1, 8, 117, -2}; + _US8 p1[] = {1, 8, 117, -2}; + _US8 p2[] = {1, 8, 117, 2}; + _US8 p3[] = {1, 50, 60, 70}; + + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p3, 1); +} + +void testNotEqualInt8Arrays(void) +{ + _US8 p0[] = {1, 8, 127, -2}; + _US8 p1[] = {1, 8, 127, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualUIntArrays(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65132u}; + unsigned int p2[] = {1, 8, 987, 2}; + unsigned int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p3, 1); +} + +void testNotEqualUIntArrays1(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUIntArrays2(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUIntArrays3(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualInt16Arrays(void) +{ + _UU16 p0[] = {1, 8, 117, 3}; + _UU16 p1[] = {1, 8, 117, 3}; + _UU16 p2[] = {1, 8, 117, 2}; + _UU16 p3[] = {1, 50, 60, 70}; + + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p3, 1); +} + +void testNotEqualInt16Arrays(void) +{ + _UU16 p0[] = {1, 8, 127, 3}; + _UU16 p1[] = {1, 8, 127, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualUINT16Arrays(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65132u}; + unsigned short p2[] = {1, 8, 987, 2}; + unsigned short p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p3, 1); +} + +void testNotEqualUINT16Arrays1(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUINT16Arrays2(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUINT16Arrays3(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualHEXArrays(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65132u}; + unsigned int p2[] = {1, 8, 987, 2}; + unsigned int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p3, 1); +} + +void testNotEqualHEXArrays1(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEXArrays2(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEXArrays3(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualHEX16Arrays(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65132u}; + unsigned short p2[] = {1, 8, 987, 2}; + unsigned short p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p3, 1); +} + +void testNotEqualHEX16Arrays1(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX16Arrays2(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX16Arrays3(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualHEX8Arrays(void) +{ + unsigned short p0[] = {1, 8, 254u, 123}; + unsigned short p1[] = {1, 8, 254u, 123}; + unsigned short p2[] = {1, 8, 254u, 2}; + unsigned short p3[] = {1, 23, 25, 26}; + + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p3, 1); +} + +void testNotEqualHEX8Arrays1(void) +{ + unsigned char p0[] = {1, 8, 254u, 253u}; + unsigned char p1[] = {1, 8, 254u, 252u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX8Arrays2(void) +{ + unsigned char p0[] = {1, 8, 254u, 253u}; + unsigned char p1[] = {2, 8, 254u, 253u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX8Arrays3(void) +{ + unsigned char p0[] = {1, 8, 254u, 253u}; + unsigned char p1[] = {1, 8, 255u, 253u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualMemoryArrays(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, -2}; + int p2[] = {1, 8, 987, 2}; + int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p0, 4, 1); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p0, 4, 4); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p2, 4, 3); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p3, 4, 1); +} + +void testNotEqualMemoryArraysExpectedNull(void) +{ + int* p0 = NULL; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArraysActualNull(void) +{ + int p0[] = {1, 8, 987, -2}; + int* p1 = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArrays1(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArrays2(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {2, 8, 987, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArrays3(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 986, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testProtection(void) +{ + volatile int mask = 0; + + if (TEST_PROTECT()) + { + mask |= 1; + TEST_ABORT(); + } + else + { + Unity.CurrentTestFailed = 0; + mask |= 2; + } + + TEST_ASSERT_EQUAL(3, mask); +} + +void testIgnoredAndThenFailInTearDown(void) +{ + SetToOneToFailInTearDown = 1; + TEST_IGNORE(); +} + +// ===================== THESE TEST WILL RUN IF YOUR CONFIG INCLUDES 64 BIT SUPPORT ================== +#ifdef UNITY_SUPPORT_64 + +void testEqualHex64s(void) +{ + _UU64 v0, v1; + _UU64 *p0, *p1; + + v0 = 0x9876543201234567; + v1 = 0x9876543201234567; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX64(0x9876543201234567, 0x9876543201234567); + TEST_ASSERT_EQUAL_HEX64(v0, v1); + TEST_ASSERT_EQUAL_HEX64(0x9876543201234567, v1); + TEST_ASSERT_EQUAL_HEX64(v0, 0x9876543201234567); + TEST_ASSERT_EQUAL_HEX64(*p0, v1); + TEST_ASSERT_EQUAL_HEX64(*p0, *p1); + TEST_ASSERT_EQUAL_HEX64(*p0, 0x9876543201234567); +} + +void testNotEqualHex64s(void) +{ + _UU64 v0, v1; + + v0 = 9000000000; + v1 = 9100000000; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex64sIfSigned(void) +{ + _US64 v0, v1; + + v0 = -9000000000; + v1 = 9000000000; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64(v0, v1); + VERIFY_FAILS_END +} + +void testHEX64sWithinDelta(void) +{ + TEST_ASSERT_HEX64_WITHIN(1, 0x7FFFFFFFFFFFFFFF,0x7FFFFFFFFFFFFFFE); + TEST_ASSERT_HEX64_WITHIN(5, 5000, 4996); + TEST_ASSERT_HEX64_WITHIN(5, 5000, 5005); +} + +void testHEX64sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX64_WITHIN(1, 0x7FFFFFFFFFFFFFFF, 0x7FFFFFFFFFFFFFFC); + VERIFY_FAILS_END +} + +void testHEX64sNotWithinDeltaEvenThoughASignedIntWouldPass(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX64_WITHIN(5, 1, -1); + VERIFY_FAILS_END +} + +void testEqualHEX64Arrays(void) +{ + _UU64 p0[] = {1, 8, 987, 65132u}; + _UU64 p1[] = {1, 8, 987, 65132u}; + _UU64 p2[] = {1, 8, 987, 2}; + _UU64 p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p3, 1); +} + +void testNotEqualHEX64Arrays1(void) +{ + _UU64 p0[] = {1, 8, 987, 65132u}; + _UU64 p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX64Arrays2(void) +{ + _UU64 p0[] = {1, 8, 987, 65132u}; + _UU64 p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +#endif //64-bit SUPPORT + +// ===================== THESE TEST WILL RUN IF YOUR CONFIG INCLUDES FLOAT SUPPORT ================== +#ifndef UNITY_EXCLUDE_FLOAT + +void testFloatsWithinDelta(void) +{ + TEST_ASSERT_FLOAT_WITHIN(0.00003f, 187245.03485f, 187245.03488f); + TEST_ASSERT_FLOAT_WITHIN(1.0f, 187245.0f, 187246.0f); + TEST_ASSERT_FLOAT_WITHIN(0.05f, 9273.2549f, 9273.2049f); + TEST_ASSERT_FLOAT_WITHIN(0.007f, -726.93724f, -726.94424f); +} + +void testFloatsNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_FLOAT_WITHIN(0.05f, 9273.2649f, 9273.2049f); + VERIFY_FAILS_END +} + +void testFloatsEqual(void) +{ + TEST_ASSERT_EQUAL_FLOAT(187245.0f, 187246.0f); + TEST_ASSERT_EQUAL_FLOAT(18724.5f, 18724.6f); + TEST_ASSERT_EQUAL_FLOAT(9273.2549f, 9273.2599f); + TEST_ASSERT_EQUAL_FLOAT(-726.93724f, -726.9374f); +} + +void testFloatsNotEqual(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT(9273.9649f, 9273.0049f); + VERIFY_FAILS_END +} + +void testFloatsNotEqualNegative1(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT(-9273.9649f, -9273.0049f); + VERIFY_FAILS_END +} + +void testFloatsNotEqualNegative2(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT(-9273.0049f, -9273.9649f); + VERIFY_FAILS_END +} + +void testEqualFloatArrays(void) +{ + float p0[] = {1.0, -8.0, 25.4, -0.123}; + float p1[] = {1.0, -8.0, 25.4, -0.123}; + float p2[] = {1.0, -8.0, 25.4, -0.2}; + float p3[] = {1.0, -23.0, 25.0, -0.26}; + + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p3, 1); +} + +void testNotEqualFloatArraysExpectedNull(void) +{ + float* p0 = NULL; + float p1[] = {1.0, 8.0, 25.4, 0.252}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysActualNull(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float* p1 = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArrays1(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float p1[] = {1.0, 8.0, 25.4, 0.252}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArrays2(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float p1[] = {2.0, 8.0, 25.4, 0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArrays3(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float p1[] = {1.0, 8.0, 25.5, 0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysNegative1(void) +{ + float p0[] = {-1.0, -8.0, -25.4, -0.253}; + float p1[] = {-1.0, -8.0, -25.4, -0.252}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysNegative2(void) +{ + float p0[] = {-1.0, -8.0, -25.4, -0.253}; + float p1[] = {-2.0, -8.0, -25.4, -0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysNegative3(void) +{ + float p0[] = {-1.0, -8.0, -25.4, -0.253}; + float p1[] = {-1.0, -8.0, -25.5, -0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +#endif //FLOAT SUPPORT diff --git a/flex-bison/clcalc/tools/ceedling/vendor/constructor/History.rdoc b/flex-bison/clcalc/tools/ceedling/vendor/constructor/History.rdoc new file mode 100644 index 0000000..b220b1d --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/constructor/History.rdoc @@ -0,0 +1,19 @@ +== 1.0.4 / 2009-12-01 + + * Building is now done with Jeweler. + +== 1.0.3 / 2009-11-30 + + * Quick release to include ConstructorStruct. + +== 1.0.2 / 2008-05-07 + + * An error is raised when constructor keys are passed in that already exist in the super class + +== 1.0.1 / 2007-12-21 + +* You can now pass a block to your constructor call; it gets executed after all the ivars get assigned. (This lets you write some initializer code if you need to.) + +== 1.0.0 / 2007-11-18 + +* Released! diff --git a/flex-bison/clcalc/tools/ceedling/vendor/constructor/README.rdoc b/flex-bison/clcalc/tools/ceedling/vendor/constructor/README.rdoc new file mode 100644 index 0000000..e6177de --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/constructor/README.rdoc @@ -0,0 +1,72 @@ +== Constructor + +* http://atomicobject.github.com/constructor + +== DESCRIPTION: + +Declarative means to define object properties by passing a hash +to the constructor, which will set the corresponding ivars. + +== SYNOPSIS: + + require 'constructor' + + class Horse + constructor :name, :breed, :weight + end + Horse.new :name => 'Ed', :breed => 'Mustang', :weight => 342 + +By default the ivars do not get accessors defined. +But you can get them auto-made if you want: + + class Horse + constructor :name, :breed, :weight, :accessors => true + end + ... + puts my_horse.weight + +Arguments specified are required by default. You can disable +strict argument checking with :strict option. This means that +the constructor will not raise an error if you pass more or +fewer arguments than declared. + + class Donkey + constructor :age, :odor, :strict => false + end + +... this allows you to pass either an age or odor key (or neither) +to the Donkey constructor. + + +== REQUIREMENTS: + +* rubygems + +== INSTALL: + +* sudo gem install constructor + +== LICENSE: + +(The MIT License) + +Copyright (c) 2007 Atomic Object + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/flex-bison/clcalc/tools/ceedling/vendor/constructor/Rakefile b/flex-bison/clcalc/tools/ceedling/vendor/constructor/Rakefile new file mode 100644 index 0000000..e1c3536 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/constructor/Rakefile @@ -0,0 +1,33 @@ +require 'rubygems' + +desc 'Default: run specs' +task :default => :spec + +require 'spec/rake/spectask' +desc 'Run constructor specs' +Spec::Rake::SpecTask.new(:spec) do |t| + t.spec_files = FileList['specs/*_spec.rb'] + t.spec_opts << '-c -f s' +end + +begin + require 'jeweler' + Jeweler::Tasks.new do |gemspec| + $: << "lib" + require 'constructor.rb' + gemspec.name = 'constructor' + gemspec.version = CONSTRUCTOR_VERSION + gemspec.summary = 'Declarative named-argument object initialization.' + gemspec.description = 'Declarative means to define object properties by passing a hash to the constructor, which will set the corresponding ivars.' + gemspec.homepage = 'http://atomicobject.github.com/constructor' + gemspec.authors = 'Atomic Object' + gemspec.email = 'github@atomicobject.com' + gemspec.test_files = FileList['specs/*_spec.rb'] + end + + Jeweler::GemcutterTasks.new + +rescue LoadError + puts "(jeweler not installed)" +end + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/constructor/homepage/Notes.txt b/flex-bison/clcalc/tools/ceedling/vendor/constructor/homepage/Notes.txt new file mode 100644 index 0000000..258d959 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/constructor/homepage/Notes.txt @@ -0,0 +1,27 @@ +Wed Nov 21 21:49:27 EST 2007 +crosby + +1. Edit page_header.graffle +2. Export as HTML imagemap +3. Open ../sample_code/synopsis.rb +4. Screen shot, save as sample_code.png +5. rake (rewrites index.html) +6. cd .. +7. rake publish_docs + +page_header.graffle + Export-as-HTML-Imagemap + Use png + Use 125% scale + Remember to use the style inspector to assign actions to things that should be links. + +rake index + Rewrites index.html using index.erb and page_header.html (and some values in the Rakefile) + +The code sample screenshot: + Taken with Snapz Pro X (this is important, as Snapz is providing the + dropshadow and about 28 extra pixels widthwise) + + Should be 650 px wide to line up with the page header. + + Transparency: be conscious of WHAT'S IN THE BACKGROUND diff --git a/flex-bison/clcalc/tools/ceedling/vendor/constructor/homepage/Rakefile b/flex-bison/clcalc/tools/ceedling/vendor/constructor/homepage/Rakefile new file mode 100644 index 0000000..c2bca7a --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/constructor/homepage/Rakefile @@ -0,0 +1,15 @@ +desc "Rewrite index.html using index.erb and publisher_homepage.html" +task :index do + require 'erb' + @title = "Constructor - atomicobject.rb" + @plugin_install = "$ script/plugin install svn://rubyforge.org/var/svn/atomicobjectrb/tags/constructor" + @header_html = File.read("page_header.html") + html = ERB.new(File.read("index.erb")).result(binding) + fname = "index.html" + File.open(fname,"w") do |f| + f.print html + end + puts "Wrote #{fname}" +end + +task :default => :index diff --git a/flex-bison/clcalc/tools/ceedling/vendor/constructor/homepage/index.erb b/flex-bison/clcalc/tools/ceedling/vendor/constructor/homepage/index.erb new file mode 100644 index 0000000..9af27c1 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/constructor/homepage/index.erb @@ -0,0 +1,27 @@ + + + <%= @title %> + + + + + +
+ + + + + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/constructor/homepage/index.html b/flex-bison/clcalc/tools/ceedling/vendor/constructor/homepage/index.html new file mode 100644 index 0000000..c2f8e64 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/constructor/homepage/index.html @@ -0,0 +1,36 @@ + + + Constructor - atomicobject.rb + + + + + +
+ + + + + + + + + + + + +
$ script/plugin install svn://rubyforge.org/var/svn/atomicobjectrb/tags/constructor
+ + +
+ + + + + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/constructor/homepage/page_header.graffle b/flex-bison/clcalc/tools/ceedling/vendor/constructor/homepage/page_header.graffle new file mode 100644 index 0000000..a910021 Binary files /dev/null and b/flex-bison/clcalc/tools/ceedling/vendor/constructor/homepage/page_header.graffle differ diff --git a/flex-bison/clcalc/tools/ceedling/vendor/constructor/homepage/page_header.html b/flex-bison/clcalc/tools/ceedling/vendor/constructor/homepage/page_header.html new file mode 100644 index 0000000..1530968 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/constructor/homepage/page_header.html @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/constructor/homepage/page_header.png b/flex-bison/clcalc/tools/ceedling/vendor/constructor/homepage/page_header.png new file mode 100644 index 0000000..82b3aae Binary files /dev/null and b/flex-bison/clcalc/tools/ceedling/vendor/constructor/homepage/page_header.png differ diff --git a/flex-bison/clcalc/tools/ceedling/vendor/constructor/homepage/sample_code.png b/flex-bison/clcalc/tools/ceedling/vendor/constructor/homepage/sample_code.png new file mode 100644 index 0000000..6084202 Binary files /dev/null and b/flex-bison/clcalc/tools/ceedling/vendor/constructor/homepage/sample_code.png differ diff --git a/flex-bison/clcalc/tools/ceedling/vendor/constructor/homepage/sample_code.rb b/flex-bison/clcalc/tools/ceedling/vendor/constructor/homepage/sample_code.rb new file mode 100644 index 0000000..2b6dc21 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/constructor/homepage/sample_code.rb @@ -0,0 +1,12 @@ +require 'rubygems' +require 'constructor' + +class Horse + constructor :name, :breed, :weight, :accessors => true +end + +ed = Horse.new(:name => 'Ed', :breed => 'Mustang', :weight => 342) +puts ed.name +puts ed.breed +puts ed.weight + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/constructor/lib/constructor.rb b/flex-bison/clcalc/tools/ceedling/vendor/constructor/lib/constructor.rb new file mode 100644 index 0000000..87eb6dd --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/constructor/lib/constructor.rb @@ -0,0 +1,127 @@ +CONSTRUCTOR_VERSION = '1.0.4' #:nodoc:# + +class Class #:nodoc:# + def constructor(*attrs, &block) + call_block = '' + if block_given? + @constructor_block = block + call_block = 'self.instance_eval(&self.class.constructor_block)' + end + # Look for embedded options in the listing: + opts = attrs.find { |a| a.kind_of?(Hash) and attrs.delete(a) } + do_acc = opts.nil? ? false : opts[:accessors] == true + do_reader = opts.nil? ? false : opts[:readers] == true + require_args = opts.nil? ? true : opts[:strict] != false + super_args = opts.nil? ? nil : opts[:super] + + # Incorporate superclass's constructor keys, if our superclass + if superclass.constructor_keys + similar_keys = superclass.constructor_keys & attrs + raise "Base class already has keys #{similar_keys.inspect}" unless similar_keys.empty? + attrs = [attrs,superclass.constructor_keys].flatten + end + # Generate ivar assigner code lines + assigns = '' + attrs.each do |k| + assigns += "@#{k.to_s} = args[:#{k.to_s}]\n" + end + + # If accessors option is on, declare accessors for the attributes: + if do_acc + add_accessors = "attr_accessor " + attrs.reject {|x| superclass.constructor_keys.include?(x.to_sym)}.map {|x| ":#{x.to_s}"}.join(',') + #add_accessors = "attr_accessor " + attrs.map {|x| ":#{x.to_s}"}.join(',') + self.class_eval add_accessors + end + + # If readers option is on, declare readers for the attributes: + if do_reader + self.class_eval "attr_reader " + attrs.reject {|x| superclass.constructor_keys.include?(x.to_sym)}.map {|x| ":#{x.to_s}"}.join(',') + end + + # If user supplied super-constructor hints: + super_call = '' + if super_args + list = super_args.map do |a| + case a + when String + %|"#{a}"| + when Symbol + %|:#{a}| + end + end + super_call = %|super(#{list.join(',')})| + end + + # If strict is on, define the constructor argument validator method, + # and setup the initializer to invoke the validator method. + # Otherwise, insert lax code into the initializer. + validation_code = "return if args.nil?" + if require_args + self.class_eval do + def _validate_constructor_args(args) + # First, make sure we've got args of some kind + unless args and args.keys and args.keys.size > 0 + raise ConstructorArgumentError.new(self.class.constructor_keys) + end + # Scan for missing keys in the argument hash + a_keys = args.keys + missing = [] + self.class.constructor_keys.each do |ck| + unless a_keys.member?(ck) + missing << ck + end + a_keys.delete(ck) # Delete inbound keys as we address them + end + if missing.size > 0 || a_keys.size > 0 + raise ConstructorArgumentError.new(missing,a_keys) + end + end + end + # Setup the code to insert into the initializer: + validation_code = "_validate_constructor_args args " + end + + # Generate the initializer code + self.class_eval %{ + def initialize(args=nil) + #{super_call} + #{validation_code} + #{assigns} + setup if respond_to?(:setup) + #{call_block} + end + } + + # Remember our constructor keys + @_ctor_keys = attrs + end + + # Access the constructor keys for this class + def constructor_keys; @_ctor_keys ||=[]; end + + def constructor_block #:nodoc:# + @constructor_block + end + +end + +# Fancy validation exception, based on missing and extraneous keys. +class ConstructorArgumentError < RuntimeError #:nodoc:# + def initialize(missing,rejected=[]) + err_msg = '' + if missing.size > 0 + err_msg = "Missing constructor args [#{missing.join(',')}]" + end + if rejected.size > 0 + # Some inbound keys were not addressed earlier; this means they're unwanted + if err_msg + err_msg << "; " # Appending to earlier message about missing items + else + err_msg = '' + end + # Enumerate the rejected key names + err_msg << "Rejected constructor args [#{rejected.join(',')}]" + end + super err_msg + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/constructor/lib/constructor_struct.rb b/flex-bison/clcalc/tools/ceedling/vendor/constructor/lib/constructor_struct.rb new file mode 100644 index 0000000..e97ff62 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/constructor/lib/constructor_struct.rb @@ -0,0 +1,33 @@ +class ConstructorStruct + def self.new(*accessors, &block) + defaults = {:accessors => true, :strict => false} + + accessor_names = accessors.dup + if accessors.last.is_a? Hash + accessor_names.pop + user_opts = accessors.last + user_opts.delete(:accessors) + defaults.each do |k,v| + user_opts[k] ||= v + end + else + accessors << defaults + end + + Class.new do + constructor *accessors + + class_eval(&block) if block + + comparator_code = accessor_names.map { |fname| "self.#{fname} == o.#{fname}" }.join(" && ") + eval %| + def ==(o) + (self.class == o.class) && #{comparator_code} + end + def eql?(o) + (self.class == o.class) && #{comparator_code} + end + | + end + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/constructor/specs/constructor_spec.rb b/flex-bison/clcalc/tools/ceedling/vendor/constructor/specs/constructor_spec.rb new file mode 100644 index 0000000..80345ae --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/constructor/specs/constructor_spec.rb @@ -0,0 +1,407 @@ +require File.expand_path(File.dirname(__FILE__) + '/../lib/constructor') + +describe 'standard constructor usage' do + it 'allows for object construction using a hash of named arguments' do + fuh = TestingClass.new( + :foo => 'my foo', + :bar => 'my bar', + :qux => 'my qux', + :why => 'lucky' + ) + + fuh.foo.should eql('my foo') + fuh.bar.should eql('my bar') + fuh.qux.should eql('my qux') + fuh.why.should eql('lucky') + fuh.to_pretty_pretty.should eql('my foo my bar') + end + + it 'calls setup method if defined' do + ralph = Llamma.new :hair => 'red' + ralph.hungry.should be_true + ralph.hair.should eql('red') + end +end + +describe "constructor's accessor option" do + it 'provides accessors for constructor arguments when accessor option is true' do + fuh = TestingAutoAccessors.new( + :foo => 'my foo', + :bar => 'my bar', + :qux => 'my qux', + :why => 'lucky' + ) + fuh.foo.should eql('my foo') + fuh.bar.should eql('my bar') + fuh.qux.should eql('my qux') + fuh.why.should eql('lucky') + fuh.to_pretty_pretty.should eql('my foo my bar') + end + + it 'does not provide accessors for constructor arguments when accessor option is false' do + fuh = TestingBlockedAccessors.new :foo => 'my foo', :bar => 'my bar' + lambda {fuh.foo}.should raise_error(NoMethodError) + lambda {fuh.bar}.should raise_error(NoMethodError) + fuh.to_pretty_pretty.should eql('my foo my bar') + end +end + +describe "constructor's reader option" do + it 'provides readers for constructor arguments when reader option is true' do + fuh = TestingAutoReaders.new( + :foo => 'my foo', + :why => 'lucky' + ) + fuh.foo.should eql('my foo') + fuh.why.should eql('lucky') + fuh.to_pretty_pretty.should eql('my foo lucky') + + lambda {fuh.why = 'no way'}.should raise_error(NoMethodError) + lambda {fuh.foo = 'uh uh'}.should raise_error(NoMethodError) + end + + it 'does not provide reader for constructor arguments when reader option is false' do + fuh = TestingBlockedReaders.new :foo => 'my foo', :why => 'my why' + lambda {fuh.foo}.should raise_error(NoMethodError) + lambda {fuh.bar}.should raise_error(NoMethodError) + fuh.to_pretty_pretty.should eql('my foo my why') + + lambda {fuh.why = 'no way'}.should raise_error(NoMethodError) + lambda {fuh.foo = 'uh uh'}.should raise_error(NoMethodError) + end +end + +describe 'using constructor with inheritance' do + it 'allows for inheritance of constructor arguments using a non-constructor defined subclass' do + fuh = SubclassOfTestingClass.new :foo => 'whu?' + fuh.foo.should eql('whu?') + fuh.bar.should be_nil + fuh.qux.should be_nil + fuh.why.should be_nil + end + + it 'allows for standard construction of a non-constructor subclass of a non-strict constuctor superclass' do + fuh = SubclassOfTestingClass2.new + fuh.foo.should be_nil + end + + it 'runs initialize method of a sublcass' do + fuh = SubclassOfTestingClass3.new + fuh.my_new_var.should eql('something') + fuh.foo.should be_nil + fuh.bar.should be_nil + fuh.qux.should be_nil + fuh.why.should be_nil + end + + it 'passes named constructor args to superclass when subclass calls super' do + fuh = SubclassOfTestingClass3.new :foo => 12 + fuh.my_new_var.should eql('something') + fuh.foo.should eql(12) + fuh.bar.should be_nil + fuh.qux.should be_nil + fuh.why.should be_nil + end + + it 'allows for inheritance of constructor arguments using a constructor defined subclass' do + s = Sonny.new :car => 'Nissan', :saw => 'Dewalt', :computer => 'Dell' + s.computer.should eql('Dell') + s.saw.should eql('Dewalt') + s.car.should eql('Nissan') + end + + it 'calls the setup method on superclass if subclass does not define a setup method' do + baby = Baby.new :cuteness => 'little', :age => 1 + baby.fat.should eql('much') + end + + it 'calls parent class setup when super is called from subclass setup' do + m = Mama.new :age => 55 + m.age.should eql(55) + m.fat.should eql('much') + + s = Sissy.new :age => 19, :beauty => 'medium', :fat => 'yeah' + s.age.should eql(19) + s.beauty.should eql('medium') + s.fat.should eql('much') + s.friends.should eql('many') + end + + it 'passes arguments given in the super option to the initializer of a non-constructor defined superclass' do + tsc = TestingSuperConstructor.new(:far => 'oo', :away => 'kk') + tsc.far.should eql('oo') + tsc.away.should eql('kk') + tsc.a.should eql("once") + tsc.b.should eql(:twice) + end + + it 'calls non-constructor defined superclass constructor when the super option is an empty array' do + tsc = TestingSuperConstructor2.new(:some => 'thing') + tsc.some.should eql('thing') + tsc.c.should eql('what a') + tsc.d.should eql('day for') + end + + it "raises an error if subclass tries to build a constructor with the keys as its parents" do + class1 = constructor_class(Object, :star, :wars) + class2 = constructor_class(class1, :space, :balls) + lambda { constructor_class(class2, :star, :space, :chewy) }.should raise_error("Base class already has keys [:space, :star]") + end + + it 'does not create accessors for superclass constructor arguments' do + tas = TestingAccessorSubclass.new(:far => 'thing') + tas.respond_to?(:cuteness).should be_false + end + + it 'does not create a reader for superclass constructor arguments' do + t1 = TestingReaderSubclass.new(:foo => 'thing') + t1.respond_to?(:foo).should be_false + end +end + +describe 'stict mode usage' do + it 'allows omission of arguments when strict is off' do + fuh = TestingClass.new :foo => 'my foo' + + fuh.foo.should eql('my foo') + fuh.bar.should be_nil + fuh.qux.should be_nil + fuh.why.should be_nil + end + + it 'allows no arguments to a constructor when strict is off' do + fuh = TestingClass.new + fuh.foo.should be_nil + fuh.bar.should be_nil + fuh.qux.should be_nil + fuh.why.should be_nil + end + + it 'does not interfere with normal object construction' do + require 'rexml/document' + d = REXML::Document.new '' + d.should_not be_nil + d.root.name.should eql('base') + end + + def see_strict_args_in_effect_for(clazz) + fuh = clazz.new :foo => 'my foo', :bar => 'my bar' + fuh.to_pretty_pretty.should eql('my foo my bar') + + # Omit foo + lambda { + TestingStrictArgsDefault.new :bar => 'ok,yeah' + }.should raise_error(ConstructorArgumentError, /foo/) + + # Omit bar + lambda { + TestingStrictArgsDefault.new :foo => 'ok,yeah' + }.should raise_error(ConstructorArgumentError, /bar/) + end + + it 'defaults to strict argument enforcement' do + see_strict_args_in_effect_for TestingStrictArgsDefault + end + + it 'enforces strict arguments when strict option is true' do + see_strict_args_in_effect_for TestingStrictArgs + end + + it 'does not allow empty constructor arguments when strict option is true' do + lambda {TestingStrictArgs.new {}}.should raise_error(ConstructorArgumentError,/foo,bar/) + lambda {TestingStrictArgs.new}.should raise_error(ConstructorArgumentError,/foo,bar/) + lambda {TestingStrictArgs.new nil}.should raise_error(ConstructorArgumentError,/foo,bar/) + end + + it 'does not allow extraneous arguments when strict option is true' do + [ /thing/, /other/ ].each do |rejected_arg| + lambda { + TestingStrictArgs.new(:foo => 1, :bar => 2, :other => 3, :thing => 4) + }.should raise_error(ConstructorArgumentError, rejected_arg) + end + end + + it 'allows for setting accessors option while in strict mode' do + t2 = TestingStrictArgs2.new :foo => 1, :bar => 2 + + # See that accessors work + t2.foo.should eql(1) + t2.bar.should eql(2) + + # See that strictness still applies + lambda {TestingStrictArgs2.new :no => 'good'}.should raise_error(ConstructorArgumentError) + end +end + +describe 'catching ConstructorArgumentError' do + it 'allows for generic rescuing of constructor argument errors' do + begin + TestingStrictArgs.new :broken => 'yoobetcha' + rescue => bad_news + bad_news.should be_kind_of(ConstructorArgumentError) + end + end +end + +describe 'block yielding' do + it 'executes a specified block after instantiating' do + TestingBlockYield.new(:a => false).a.should == true + end +end + +def constructor_class(base, *keys) + Class.new(base) do + constructor *keys + end +end + +class TestingClass + attr_accessor :foo, :bar, :why, :qux + constructor :foo, :bar, :why, :qux, :strict => false + + def to_pretty_pretty + "#{@foo} #{@bar}" + end + +end + +class Mama + attr_accessor :fat, :age + constructor :age, :strict => false + def setup + @fat = "much" + end +end + +class Baby < Mama + constructor :cuteness +end + +class Sissy < Mama + attr_accessor :friends, :beauty + constructor :beauty, :strict => false + def setup + super #IMPORTANT! + @friends = "many" + end +end + +class TestingStrictArgsDefault + constructor :foo, :bar + def to_pretty_pretty + "#{@foo} #{@bar}" + end +end + +class TestingStrictArgs + constructor :foo, :bar, :strict => true + def to_pretty_pretty + "#{@foo} #{@bar}" + end +end + +class TestingStrictArgs2 + constructor :foo, :bar, :accessors => true +end + +class SubclassOfTestingClass < TestingClass +end + +class SubclassOfTestingClass2 < TestingClass + def initialize; end +end + +class SubclassOfTestingClass3 < TestingClass + attr_reader :my_new_var + def initialize(hash = nil) + super + @my_new_var = "something" + end +end + +class TestingAutoAccessors + constructor :foo, :bar, :why, :qux, :accessors => true, :strict => false + def to_pretty_pretty + "#{@foo} #{@bar}" + end +end + +class TestingAutoReaders + constructor :foo, :why, :readers => true, :strict => false + def to_pretty_pretty + "#{@foo} #{@why}" + end +end + +class TestingReaderSuperclass + constructor :foo +end + +class TestingReaderSubclass < TestingReaderSuperclass + constructor :bar, :readers => true, :strict => false +end + +class TestingSuperConstructorBase + attr_reader :a, :b + def initialize(a,b) + @a = a + @b = b + end +end + +class TestingSuperConstructor < TestingSuperConstructorBase + constructor :far, :away, :accessors => true, :super => ["once", :twice], :strict => false +end + +class TestingSuperConstructorBase2 + attr_reader :c, :d + def initialize + @c = 'what a' + @d = 'day for' + end +end + +class TestingSuperConstructor2 < TestingSuperConstructorBase2 + constructor :some, :accessors => true, :super => [], :strict => false +end + +class TestingAccessorSubclass < Baby + constructor :foo, :accessors => true, :strict => false +end + +class TestingBlockedAccessors + constructor :foo, :bar, :accessors => false + def to_pretty_pretty + "#{@foo} #{@bar}" + end +end + +class TestingBlockedReaders + constructor :foo, :why, :readers => false + def to_pretty_pretty + "#{@foo} #{@why}" + end +end + +class Papa + constructor :car, :saw +end + +class Sonny < Papa + attr_accessor :car, :saw, :computer + constructor :computer +end + +class Llamma + attr_accessor :hungry, :hair + constructor :hair + def setup + @hungry = true + end +end + +class TestingBlockYield + constructor :a, :accessors => true do + @a = true + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/constructor/specs/constructor_struct_spec.rb b/flex-bison/clcalc/tools/ceedling/vendor/constructor/specs/constructor_struct_spec.rb new file mode 100644 index 0000000..2442da3 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/constructor/specs/constructor_struct_spec.rb @@ -0,0 +1,84 @@ +require File.dirname(__FILE__) + '/../lib/constructor_struct' + +describe ConstructorStruct, "#new" do + def struct(*accessors) + ConstructorStruct.new(*accessors) + end + + def instance_of(clazz, args=nil) + args = [args] || [] + clazz.new(*args) + end + + before do + AClass = struct(:hello, :world) unless defined?(AClass) + end + + it "creates a new class with accessors given a set of symbols or strings" do + instance_of(AClass, {:hello => "foo", :world => "bar"}).hello.should == "foo" + instance_of(AClass, {:hello => "foo", :world => "bar"}).world.should == "bar" + end + + it "creates a real class" do + instance_of(AClass).class.should == AClass + end + + it "has the option of creating a strict accessors" do + lambda { instance_of(struct(:foo, :strict => true)) }.should raise_error + end + + it "does not have the option of not creating accessors" do + instance_of(struct(:foo, :accessors => false), :foo => "bar").foo.should == "bar" + end + + describe "equivalence" do + before do + @hello = "Hello" + @world = "World" + @args = { :hello => @hello, :world => @world } + @target = AClass.new(@args) + end + + it "uses all accessors" do + [ nil, :hello, :world ].each do |field_to_alter| + alt = AClass.new(:hello => @hello, :world => @world) + + unless field_to_alter + # Base case: they should be equal + @target.should == alt + @target.eql?(alt).should be_true #should eql(alt) + else + # Change 1 field and see not equal + alt.send("#{field_to_alter}=", "other data") + @target.should_not == alt + @target.should_not eql(alt) + end + end + end + + it "will not compare to another class with same fields" do + BClass = ConstructorStruct.new(:hello, :world) + alt = BClass.new(:hello => @hello, :world => @world) + @target.should_not == alt + @target.should_not eql(alt) + end + end + + describe "extra method definitions" do + NightTrain = ConstructorStruct.new(:beer, :conductor) do + def setup + @conductor ||= "Bill" + end + end + + it "lets you declare instance methods within a block" do + night_train = NightTrain.new(:beer => "Founders") + night_train.beer.should == "Founders" + night_train.conductor.should == "Bill" + + other_train = NightTrain.new(:beer => "Bells", :conductor => "Dave") + other_train.conductor.should == "Dave" + end + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/deep_merge/MIT-LICENSE b/flex-bison/clcalc/tools/ceedling/vendor/deep_merge/MIT-LICENSE new file mode 100644 index 0000000..8eaf6db --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/deep_merge/MIT-LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2008 [name of plugin creator] + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/flex-bison/clcalc/tools/ceedling/vendor/deep_merge/README b/flex-bison/clcalc/tools/ceedling/vendor/deep_merge/README new file mode 100644 index 0000000..0302735 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/deep_merge/README @@ -0,0 +1,94 @@ +DeepMerge Overview +================== + +Deep Merge is a simple set of utility functions for Hash. It permits +you to merge elements inside a hash together recursively. The manner +by which it does this is somewhat arbitrary (since there is no defining +standard for this) but it should end up being pretty intuitive and do what +you expect. + +You can learn a lot more about this by reading the test file. It's pretty +well documented and has many examples of various merges from very simple +to pretty complex. + +The primary need that caused me to write this library is the merging of elements +coming from HTTP parameters and related stored parameters in session. This lets +a user build up a set of parameters over time, modifying individual items. + +Deep Merge Core Documentation +============================= + There are three key methods that are added to Hash when you require deep_merge: + + deep_merge!(new_hash[, opts]) -- merges and new_hash wins unmergeable situations + deep_merge(new_hash[, opts]) -- merges and "self" hash wins unmergeable situations + ko_deep_merge!(new_hash[, opts]) -- same as deep_merge! but "--" provides "knockout" functions + + deep_merge! method permits merging of arbitrary child elements. The two top level + elements must be hashes. These hashes can contain unlimited (to stack limit) levels + of child elements. These child elements to not have to be of the same types. + Where child elements are of the same type, deep_merge will attempt to merge them together. + Where child elements are not of the same type, deep_merge will skip or optionally overwrite + the destination element with the contents of the source element at that level. + So if you have two hashes like this: + source = {:x => [1,2,3], :y => 2} + dest = {:x => [4,5,'6'], :y => [7,8,9]} + dest.deep_merge!(source) + Results: {:x => [1,2,3,4,5,'6'], :y => 2} + By default, "deep_merge!" will overwrite any unmergeables and merge everything else. + To avoid this, use "deep_merge" (no bang/exclamation mark) + + Options: + Options are specified in the last parameter passed, which should be in hash format: + hash.deep_merge!({:x => [1,2]}, {:knockout_prefix => '--'}) + :preserve_unmergeables DEFAULT: false + Set to true to skip any unmergeable elements from source + :knockout_prefix DEFAULT: nil + Set to string value to signify prefix which deletes elements from existing element + :sort_merged_arrays DEFAULT: false + Set to true to sort all arrays that are merged together + :unpack_arrays DEFAULT: nil + Set to string value to run "Array::join" then "String::split" against all arrays + :merge_debug DEFAULT: false + Set to true to get console output of merge process for debugging + + Selected Options Details: + :knockout_prefix => The purpose of this is to provide a way to remove elements + from existing Hash by specifying them in a special way in incoming hash + source = {:x => ['--1', '2']} + dest = {:x => ['1', '3']} + dest.ko_deep_merge!(source) + Results: {:x => ['2','3']} + Additionally, if the knockout_prefix is passed alone as a string, it will cause + the entire element to be removed: + source = {:x => '--'} + dest = {:x => [1,2,3]} + dest.ko_deep_merge!(source) + Results: {:x => ""} + :unpack_arrays => The purpose of this is to permit compound elements to be passed + in as strings and to be converted into discrete array elements + irsource = {:x => ['1,2,3', '4']} + dest = {:x => ['5','6','7,8']} + dest.deep_merge!(source, {:unpack_arrays => ','}) + Results: {:x => ['1','2','3','4','5','6','7','8'} + Why: If receiving data from an HTML form, this makes it easy for a checkbox + to pass multiple values from within a single HTML element + + There are many tests for this library - and you can learn more about the features + and usages of deep_merge! by just browsing the test examples + + +Simple Example Code +=================== + +require 'deep_merge' +x = {:x => [3,4,5]} +y = {:x => [1,2,3]} +y.deep_merge!(x) +# results: y = {:x => [1,2,3,4,5]} + +Availablility +============= +SVN Repo here: http://trac.misuse.org/science/wiki/DeepMerge +Contact author: http://www.misuse.org/science + +Copyright (c) 2008 Steve Midgley, released under the MIT license diff --git a/flex-bison/clcalc/tools/ceedling/vendor/deep_merge/Rakefile b/flex-bison/clcalc/tools/ceedling/vendor/deep_merge/Rakefile new file mode 100644 index 0000000..82e43b3 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/deep_merge/Rakefile @@ -0,0 +1,28 @@ +require 'rubygems' +require 'lib/deep_merge' +Gem::manage_gems +require 'rake/gempackagetask' + +spec = Gem::Specification.new do |s| + s.platform = Gem::Platform::RUBY + s.name = "deep_merge" + s.version = DeepMerge::VERSION + s.author = "Steve Midgley" + s.email = "public@misuse.org" + s.summary = "Permits recursive/deep merges of arrays and hashes." + s.files = FileList['lib/*.rb', 'test/*'].to_a + s.require_path = "lib" + s.autorequire = "deep_merge" + s.test_files = Dir.glob('tests/*.rb') + s.has_rdoc = true + s.extra_rdoc_files = ["README"] +end + +Rake::GemPackageTask.new(spec) do |pkg| + pkg.need_tar = true +end + +task :default => "pkg/#{spec.name}-#{spec.version}.gem" do + puts "generated latest version" +end + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/deep_merge/lib/deep_merge.rb b/flex-bison/clcalc/tools/ceedling/vendor/deep_merge/lib/deep_merge.rb new file mode 100644 index 0000000..4c4b761 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/deep_merge/lib/deep_merge.rb @@ -0,0 +1,211 @@ +module DeepMerge + + MAJOR_VERSION = 0 + MINOR_VERSION = 1 + FIX_VERSION = 0 + VERSION = "#{MAJOR_VERSION}.#{MINOR_VERSION}.#{FIX_VERSION}" + + class InvalidParameter < StandardError; end + + DEFAULT_FIELD_KNOCKOUT_PREFIX = '--' + + module DeepMergeHash + # ko_hash_merge! will merge and knockout elements prefixed with DEFAULT_FIELD_KNOCKOUT_PREFIX + def ko_deep_merge!(source, options = {}) + default_opts = {:knockout_prefix => "--", :preserve_unmergeables => false} + DeepMerge::deep_merge!(source, self, default_opts.merge(options)) + end + + # deep_merge! will merge and overwrite any unmergeables in destination hash + def deep_merge!(source, options = {}) + default_opts = {:preserve_unmergeables => false} + DeepMerge::deep_merge!(source, self, default_opts.merge(options)) + end + + # deep_merge will merge and skip any unmergeables in destination hash + def deep_merge(source, options = {}) + default_opts = {:preserve_unmergeables => true} + DeepMerge::deep_merge!(source, self, default_opts.merge(options)) + end + + end # DeepMergeHashExt + + # Deep Merge core documentation. + # deep_merge! method permits merging of arbitrary child elements. The two top level + # elements must be hashes. These hashes can contain unlimited (to stack limit) levels + # of child elements. These child elements to not have to be of the same types. + # Where child elements are of the same type, deep_merge will attempt to merge them together. + # Where child elements are not of the same type, deep_merge will skip or optionally overwrite + # the destination element with the contents of the source element at that level. + # So if you have two hashes like this: + # source = {:x => [1,2,3], :y => 2} + # dest = {:x => [4,5,'6'], :y => [7,8,9]} + # dest.deep_merge!(source) + # Results: {:x => [1,2,3,4,5,'6'], :y => 2} + # By default, "deep_merge!" will overwrite any unmergeables and merge everything else. + # To avoid this, use "deep_merge" (no bang/exclamation mark) + # + # Options: + # Options are specified in the last parameter passed, which should be in hash format: + # hash.deep_merge!({:x => [1,2]}, {:knockout_prefix => '--'}) + # :preserve_unmergeables DEFAULT: false + # Set to true to skip any unmergeable elements from source + # :knockout_prefix DEFAULT: nil + # Set to string value to signify prefix which deletes elements from existing element + # :sort_merged_arrays DEFAULT: false + # Set to true to sort all arrays that are merged together + # :unpack_arrays DEFAULT: nil + # Set to string value to run "Array::join" then "String::split" against all arrays + # :merge_debug DEFAULT: false + # Set to true to get console output of merge process for debugging + # + # Selected Options Details: + # :knockout_prefix => The purpose of this is to provide a way to remove elements + # from existing Hash by specifying them in a special way in incoming hash + # source = {:x => ['--1', '2']} + # dest = {:x => ['1', '3']} + # dest.ko_deep_merge!(source) + # Results: {:x => ['2','3']} + # Additionally, if the knockout_prefix is passed alone as a string, it will cause + # the entire element to be removed: + # source = {:x => '--'} + # dest = {:x => [1,2,3]} + # dest.ko_deep_merge!(source) + # Results: {:x => ""} + # :unpack_arrays => The purpose of this is to permit compound elements to be passed + # in as strings and to be converted into discrete array elements + # irsource = {:x => ['1,2,3', '4']} + # dest = {:x => ['5','6','7,8']} + # dest.deep_merge!(source, {:unpack_arrays => ','}) + # Results: {:x => ['1','2','3','4','5','6','7','8'} + # Why: If receiving data from an HTML form, this makes it easy for a checkbox + # to pass multiple values from within a single HTML element + # + # There are many tests for this library - and you can learn more about the features + # and usages of deep_merge! by just browsing the test examples + def DeepMerge.deep_merge!(source, dest, options = {}) + # turn on this line for stdout debugging text + merge_debug = options[:merge_debug] || false + overwrite_unmergeable = !options[:preserve_unmergeables] + knockout_prefix = options[:knockout_prefix] || nil + if knockout_prefix == "" then raise InvalidParameter, "knockout_prefix cannot be an empty string in deep_merge!"; end + if knockout_prefix && !overwrite_unmergeable then raise InvalidParameter, "overwrite_unmergeable must be true if knockout_prefix is specified in deep_merge!"; end + # if present: we will split and join arrays on this char before merging + array_split_char = options[:unpack_arrays] || false + # request that we sort together any arrays when they are merged + sort_merged_arrays = options[:sort_merged_arrays] || false + di = options[:debug_indent] || '' + # do nothing if source is nil + if source.nil? || (source.respond_to?(:blank?) && source.blank?) then return dest; end + # if dest doesn't exist, then simply copy source to it + if dest.nil? && overwrite_unmergeable then dest = source; return dest; end + + puts "#{di}Source class: #{source.class.inspect} :: Dest class: #{dest.class.inspect}" if merge_debug + if source.kind_of?(Hash) + puts "#{di}Hashes: #{source.inspect} :: #{dest.inspect}" if merge_debug + source.each do |src_key, src_value| + if dest.kind_of?(Hash) + puts "#{di} looping: #{src_key.inspect} => #{src_value.inspect} :: #{dest.inspect}" if merge_debug + if not dest[src_key].nil? + puts "#{di} ==>merging: #{src_key.inspect} => #{src_value.inspect} :: #{dest[src_key].inspect}" if merge_debug + dest[src_key] = deep_merge!(src_value, dest[src_key], options.merge(:debug_indent => di + ' ')) + else # dest[src_key] doesn't exist so we want to create and overwrite it (but we do this via deep_merge!) + puts "#{di} ==>merging over: #{src_key.inspect} => #{src_value.inspect}" if merge_debug + # note: we rescue here b/c some classes respond to "dup" but don't implement it (Numeric, TrueClass, FalseClass, NilClass among maybe others) + begin + src_dup = src_value.dup # we dup src_value if possible because we're going to merge into it (since dest is empty) + rescue TypeError + src_dup = src_value + end + dest[src_key] = deep_merge!(src_value, src_dup, options.merge(:debug_indent => di + ' ')) + end + else # dest isn't a hash, so we overwrite it completely (if permitted) + if overwrite_unmergeable + puts "#{di} overwriting dest: #{src_key.inspect} => #{src_value.inspect} -over-> #{dest.inspect}" if merge_debug + dest = overwrite_unmergeables(source, dest, options) + end + end + end + elsif source.kind_of?(Array) + puts "#{di}Arrays: #{source.inspect} :: #{dest.inspect}" if merge_debug + # if we are instructed, join/split any source arrays before processing + if array_split_char + puts "#{di} split/join on source: #{source.inspect}" if merge_debug + source = source.join(array_split_char).split(array_split_char) + if dest.kind_of?(Array) then dest = dest.join(array_split_char).split(array_split_char); end + end + # if there's a naked knockout_prefix in source, that means we are to truncate dest + if source.index(knockout_prefix) then dest = clear_or_nil(dest); source.delete(knockout_prefix); end + if dest.kind_of?(Array) + if knockout_prefix + print "#{di} knocking out: " if merge_debug + # remove knockout prefix items from both source and dest + source.delete_if do |ko_item| + retval = false + item = ko_item.respond_to?(:gsub) ? ko_item.gsub(%r{^#{knockout_prefix}}, "") : ko_item + if item != ko_item + print "#{ko_item} - " if merge_debug + dest.delete(item) + dest.delete(ko_item) + retval = true + end + retval + end + puts if merge_debug + end + puts "#{di} merging arrays: #{source.inspect} :: #{dest.inspect}" if merge_debug + dest = dest | source + if sort_merged_arrays then dest.sort!; end + elsif overwrite_unmergeable + puts "#{di} overwriting dest: #{source.inspect} -over-> #{dest.inspect}" if merge_debug + dest = overwrite_unmergeables(source, dest, options) + end + else # src_hash is not an array or hash, so we'll have to overwrite dest + puts "#{di}Others: #{source.inspect} :: #{dest.inspect}" if merge_debug + dest = overwrite_unmergeables(source, dest, options) + end + puts "#{di}Returning #{dest.inspect}" if merge_debug + dest + end # deep_merge! + + # allows deep_merge! to uniformly handle overwriting of unmergeable entities + def DeepMerge::overwrite_unmergeables(source, dest, options) + merge_debug = options[:merge_debug] || false + overwrite_unmergeable = !options[:preserve_unmergeables] + knockout_prefix = options[:knockout_prefix] || false + di = options[:debug_indent] || '' + if knockout_prefix && overwrite_unmergeable + if source.kind_of?(String) # remove knockout string from source before overwriting dest + src_tmp = source.gsub(%r{^#{knockout_prefix}},"") + elsif source.kind_of?(Array) # remove all knockout elements before overwriting dest + src_tmp = source.delete_if {|ko_item| ko_item.kind_of?(String) && ko_item.match(%r{^#{knockout_prefix}}) } + else + src_tmp = source + end + if src_tmp == source # if we didn't find a knockout_prefix then we just overwrite dest + puts "#{di}#{src_tmp.inspect} -over-> #{dest.inspect}" if merge_debug + dest = src_tmp + else # if we do find a knockout_prefix, then we just delete dest + puts "#{di}\"\" -over-> #{dest.inspect}" if merge_debug + dest = "" + end + elsif overwrite_unmergeable + dest = source + end + dest + end + + def DeepMerge::clear_or_nil(obj) + if obj.respond_to?(:clear) + obj.clear + else + obj = nil + end + obj + end + +end # module DeepMerge + +class Hash + include DeepMerge::DeepMergeHash +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/deep_merge/pkg/deep_merge-0.1.0.gem b/flex-bison/clcalc/tools/ceedling/vendor/deep_merge/pkg/deep_merge-0.1.0.gem new file mode 100644 index 0000000..ffd2448 Binary files /dev/null and b/flex-bison/clcalc/tools/ceedling/vendor/deep_merge/pkg/deep_merge-0.1.0.gem differ diff --git a/flex-bison/clcalc/tools/ceedling/vendor/deep_merge/test/test_deep_merge.rb b/flex-bison/clcalc/tools/ceedling/vendor/deep_merge/test/test_deep_merge.rb new file mode 100644 index 0000000..7ebd918 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/deep_merge/test/test_deep_merge.rb @@ -0,0 +1,553 @@ +require 'test/unit' +require '../lib/deep_merge.rb' + +class TestDeepMerge < Test::Unit::TestCase + + def setup + end + + # show that Hash object has deep merge capabilities in form of three methods: + # ko_deep_merge! # uses '--' knockout and overwrites unmergeable + # deep_merge! # overwrites unmergeable + # deep_merge # skips unmergeable + def test_hash_deep_merge + x = {} + assert x.respond_to?('deep_merge!'.to_sym) + hash_src = {'id' => [3,4,5]} + hash_dest = {'id' => [1,2,3]} + assert hash_dest.ko_deep_merge!(hash_src) + assert_equal({'id' => [1,2,3,4,5]}, hash_dest) + + hash_src = {'id' => [3,4,5]} + hash_dest = {'id' => [1,2,3]} + assert hash_dest.deep_merge!(hash_src) + assert_equal({'id' => [1,2,3,4,5]}, hash_dest) + + hash_src = {'id' => 'xxx'} + hash_dest = {'id' => [1,2,3]} + assert hash_dest.deep_merge(hash_src) + assert_equal({'id' => [1,2,3]}, hash_dest) + end + + FIELD_KNOCKOUT_PREFIX = DeepMerge::DEFAULT_FIELD_KNOCKOUT_PREFIX + + # tests DeepMerge::deep_merge! function + def test_deep_merge + # merge tests (moving from basic to more complex) + + # test merging an hash w/array into blank hash + hash_src = {'id' => '2'} + hash_dst = {} + DeepMerge::deep_merge!(hash_src.dup, hash_dst, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal hash_src, hash_dst + + # test merging an hash w/array into blank hash + hash_src = {'region' => {'id' => ['227', '2']}} + hash_dst = {} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal hash_src, hash_dst + + # merge from empty hash + hash_src = {} + hash_dst = {"property" => ["2","4"]} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => ["2","4"]}, hash_dst) + + # merge to empty hash + hash_src = {"property" => ["2","4"]} + hash_dst = {} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => ["2","4"]}, hash_dst) + + # simple string overwrite + hash_src = {"name" => "value"} + hash_dst = {"name" => "value1"} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"name" => "value"}, hash_dst) + + # simple string overwrite of empty hash + hash_src = {"name" => "value"} + hash_dst = {} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal(hash_src, hash_dst) + + # hashes holding array + hash_src = {"property" => ["1","3"]} + hash_dst = {"property" => ["2","4"]} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal(["2","4","1","3"], hash_dst['property']) + + # hashes holding array (sorted) + hash_src = {"property" => ["1","3"]} + hash_dst = {"property" => ["2","4"]} + DeepMerge::deep_merge!(hash_src, hash_dst, {:sort_merged_arrays => true}) + assert_equal(["1","2","3","4"].sort, hash_dst['property']) + + # hashes holding hashes holding arrays (array with duplicate elements is merged with dest then src + hash_src = {"property" => {"bedroom_count" => ["1", "2"], "bathroom_count" => ["1", "4+"]}} + hash_dst = {"property" => {"bedroom_count" => ["3", "2"], "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => {"bedroom_count" => ["3","2","1"], "bathroom_count" => ["2", "1", "4+"]}}, hash_dst) + + # hash holding hash holding array v string (string is overwritten by array) + hash_src = {"property" => {"bedroom_count" => ["1", "2"], "bathroom_count" => ["1", "4+"]}} + hash_dst = {"property" => {"bedroom_count" => "3", "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => {"bedroom_count" => ["1", "2"], "bathroom_count" => ["2","1","4+"]}}, hash_dst) + + # hash holding hash holding array v string (string is NOT overwritten by array) + hash_src = {"property" => {"bedroom_count" => ["1", "2"], "bathroom_count" => ["1", "4+"]}} + hash_dst = {"property" => {"bedroom_count" => "3", "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst, {:preserve_unmergeables => true}) + assert_equal({"property" => {"bedroom_count" => "3", "bathroom_count" => ["2","1","4+"]}}, hash_dst) + + # hash holding hash holding string v array (array is overwritten by string) + hash_src = {"property" => {"bedroom_count" => "3", "bathroom_count" => ["1", "4+"]}} + hash_dst = {"property" => {"bedroom_count" => ["1", "2"], "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => {"bedroom_count" => "3", "bathroom_count" => ["2","1","4+"]}}, hash_dst) + + # hash holding hash holding string v array (array does NOT overwrite string) + hash_src = {"property" => {"bedroom_count" => "3", "bathroom_count" => ["1", "4+"]}} + hash_dst = {"property" => {"bedroom_count" => ["1", "2"], "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst, {:preserve_unmergeables => true}) + assert_equal({"property" => {"bedroom_count" => ["1", "2"], "bathroom_count" => ["2","1","4+"]}}, hash_dst) + + # hash holding hash holding hash v array (array is overwritten by hash) + hash_src = {"property" => {"bedroom_count" => {"king_bed" => 3, "queen_bed" => 1}, "bathroom_count" => ["1", "4+"]}} + hash_dst = {"property" => {"bedroom_count" => ["1", "2"], "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => {"bedroom_count" => {"king_bed" => 3, "queen_bed" => 1}, "bathroom_count" => ["2","1","4+"]}}, hash_dst) + + # hash holding hash holding hash v array (array is NOT overwritten by hash) + hash_src = {"property" => {"bedroom_count" => {"king_bed" => 3, "queen_bed" => 1}, "bathroom_count" => ["1", "4+"]}} + hash_dst = {"property" => {"bedroom_count" => ["1", "2"], "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst, {:preserve_unmergeables => true}) + assert_equal({"property" => {"bedroom_count" => ["1", "2"], "bathroom_count" => ["2","1","4+"]}}, hash_dst) + + # 3 hash layers holding integers (integers are overwritten by source) + hash_src = {"property" => {"bedroom_count" => {"king_bed" => 3, "queen_bed" => 1}, "bathroom_count" => ["1", "4+"]}} + hash_dst = {"property" => {"bedroom_count" => {"king_bed" => 2, "queen_bed" => 4}, "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => {"bedroom_count" => {"king_bed" => 3, "queen_bed" => 1}, "bathroom_count" => ["2","1","4+"]}}, hash_dst) + + # 3 hash layers holding arrays of int (arrays are merged) + hash_src = {"property" => {"bedroom_count" => {"king_bed" => [3], "queen_bed" => [1]}, "bathroom_count" => ["1", "4+"]}} + hash_dst = {"property" => {"bedroom_count" => {"king_bed" => [2], "queen_bed" => [4]}, "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => {"bedroom_count" => {"king_bed" => [2,3], "queen_bed" => [4,1]}, "bathroom_count" => ["2","1","4+"]}}, hash_dst) + + # 1 hash overwriting 3 hash layers holding arrays of int + hash_src = {"property" => "1"} + hash_dst = {"property" => {"bedroom_count" => {"king_bed" => [2], "queen_bed" => [4]}, "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => "1"}, hash_dst) + + # 1 hash NOT overwriting 3 hash layers holding arrays of int + hash_src = {"property" => "1"} + hash_dst = {"property" => {"bedroom_count" => {"king_bed" => [2], "queen_bed" => [4]}, "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst, {:preserve_unmergeables => true}) + assert_equal({"property" => {"bedroom_count" => {"king_bed" => [2], "queen_bed" => [4]}, "bathroom_count" => ["2"]}}, hash_dst) + + # 3 hash layers holding arrays of int (arrays are merged) but second hash's array is overwritten + hash_src = {"property" => {"bedroom_count" => {"king_bed" => [3], "queen_bed" => [1]}, "bathroom_count" => "1"}} + hash_dst = {"property" => {"bedroom_count" => {"king_bed" => [2], "queen_bed" => [4]}, "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => {"bedroom_count" => {"king_bed" => [2,3], "queen_bed" => [4,1]}, "bathroom_count" => "1"}}, hash_dst) + + # 3 hash layers holding arrays of int (arrays are merged) but second hash's array is NOT overwritten + hash_src = {"property" => {"bedroom_count" => {"king_bed" => [3], "queen_bed" => [1]}, "bathroom_count" => "1"}} + hash_dst = {"property" => {"bedroom_count" => {"king_bed" => [2], "queen_bed" => [4]}, "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst, {:preserve_unmergeables => true}) + assert_equal({"property" => {"bedroom_count" => {"king_bed" => [2,3], "queen_bed" => [4,1]}, "bathroom_count" => ["2"]}}, hash_dst) + + # 3 hash layers holding arrays of int, but one holds int. This one overwrites, but the rest merge + hash_src = {"property" => {"bedroom_count" => {"king_bed" => 3, "queen_bed" => [1]}, "bathroom_count" => ["1"]}} + hash_dst = {"property" => {"bedroom_count" => {"king_bed" => [2], "queen_bed" => [4]}, "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => {"bedroom_count" => {"king_bed" => 3, "queen_bed" => [4,1]}, "bathroom_count" => ["2","1"]}}, hash_dst) + + # 3 hash layers holding arrays of int, but source is incomplete. + hash_src = {"property" => {"bedroom_count" => {"king_bed" => [3]}, "bathroom_count" => ["1"]}} + hash_dst = {"property" => {"bedroom_count" => {"king_bed" => [2], "queen_bed" => [4]}, "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => {"bedroom_count" => {"king_bed" => [2,3], "queen_bed" => [4]}, "bathroom_count" => ["2","1"]}}, hash_dst) + + # 3 hash layers holding arrays of int, but source is shorter and has new 2nd level ints. + hash_src = {"property" => {"bedroom_count" => {2=>3, "king_bed" => [3]}, "bathroom_count" => ["1"]}} + hash_dst = {"property" => {"bedroom_count" => {"king_bed" => [2], "queen_bed" => [4]}, "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => {"bedroom_count" => {2=>3, "king_bed" => [2,3], "queen_bed" => [4]}, "bathroom_count" => ["2","1"]}}, hash_dst) + + # 3 hash layers holding arrays of int, but source is empty + hash_src = {} + hash_dst = {"property" => {"bedroom_count" => {"king_bed" => [2], "queen_bed" => [4]}, "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => {"bedroom_count" => {"king_bed" => [2], "queen_bed" => [4]}, "bathroom_count" => ["2"]}}, hash_dst) + + # 3 hash layers holding arrays of int, but dest is empty + hash_src = {"property" => {"bedroom_count" => {2=>3, "king_bed" => [3]}, "bathroom_count" => ["1"]}} + hash_dst = {} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => {"bedroom_count" => {2=>3, "king_bed" => [3]}, "bathroom_count" => ["1"]}}, hash_dst) + + # test parameter management for knockout_prefix and overwrite unmergable + assert_raise(DeepMerge::InvalidParameter) {DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => ""})} + assert_raise(DeepMerge::InvalidParameter) {DeepMerge::deep_merge!(hash_src, hash_dst, {:preserve_unmergeables => true, :knockout_prefix => ""})} + assert_raise(DeepMerge::InvalidParameter) {DeepMerge::deep_merge!(hash_src, hash_dst, {:preserve_unmergeables => true, :knockout_prefix => "--"})} + assert_nothing_raised(DeepMerge::InvalidParameter) {DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => "--"})} + assert_nothing_raised(DeepMerge::InvalidParameter) {DeepMerge::deep_merge!(hash_src, hash_dst)} + assert_nothing_raised(DeepMerge::InvalidParameter) {DeepMerge::deep_merge!(hash_src, hash_dst, {:preserve_unmergeables => true})} + + # hash holding arrays of arrays + hash_src = {["1", "2", "3"] => ["1", "2"]} + hash_dst = {["4", "5"] => ["3"]} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({["1","2","3"] => ["1", "2"], ["4", "5"] => ["3"]}, hash_dst) + + # test merging of hash with blank hash, and make sure that source array split still functions + hash_src = {'property' => {'bedroom_count' => ["1","2,3"]}} + hash_dst = {} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({'property' => {'bedroom_count' => ["1","2","3"]}}, hash_dst) + + # test merging of hash with blank hash, and make sure that source array split does not function when turned off + hash_src = {'property' => {'bedroom_count' => ["1","2,3"]}} + hash_dst = {} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX}) + assert_equal({'property' => {'bedroom_count' => ["1","2,3"]}}, hash_dst) + + # test merging into a blank hash with overwrite_unmergeables turned on + hash_src = {"action"=>"browse", "controller"=>"results"} + hash_dst = {} + DeepMerge::deep_merge!(hash_src, hash_dst, {:overwrite_unmergeables => true, :knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal hash_src, hash_dst + + # KNOCKOUT_PREFIX testing + # the next few tests are looking for correct behavior from specific real-world params/session merges + # using the custom modifiers built for param/session merges + + [nil, ","].each do |ko_split| + # typical params/session style hash with knockout_merge elements + hash_params = {"property"=>{"bedroom_count"=>[FIELD_KNOCKOUT_PREFIX+"1", "2", "3"]}} + hash_session = {"property"=>{"bedroom_count"=>["1", "2", "3"]}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ko_split}) + assert_equal({"property"=>{"bedroom_count"=>["2", "3"]}}, hash_session) + + # typical params/session style hash with knockout_merge elements + hash_params = {"property"=>{"bedroom_count"=>[FIELD_KNOCKOUT_PREFIX+"1", "2", "3"]}} + hash_session = {"property"=>{"bedroom_count"=>["3"]}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ko_split}) + assert_equal({"property"=>{"bedroom_count"=>["3","2"]}}, hash_session) + + # typical params/session style hash with knockout_merge elements + hash_params = {"property"=>{"bedroom_count"=>[FIELD_KNOCKOUT_PREFIX+"1", "2", "3"]}} + hash_session = {"property"=>{"bedroom_count"=>["4"]}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ko_split}) + assert_equal({"property"=>{"bedroom_count"=>["4","2","3"]}}, hash_session) + + # typical params/session style hash with knockout_merge elements + hash_params = {"property"=>{"bedroom_count"=>[FIELD_KNOCKOUT_PREFIX+"1", "2", "3"]}} + hash_session = {"property"=>{"bedroom_count"=>[FIELD_KNOCKOUT_PREFIX+"1", "4"]}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ko_split}) + assert_equal({"property"=>{"bedroom_count"=>["4","2","3"]}}, hash_session) + + # typical params/session style hash with knockout_merge elements + hash_params = {"amenity"=>{"id"=>[FIELD_KNOCKOUT_PREFIX+"1", FIELD_KNOCKOUT_PREFIX+"2", "3", "4"]}} + hash_session = {"amenity"=>{"id"=>["1", "2"]}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ko_split}) + assert_equal({"amenity"=>{"id"=>["3","4"]}}, hash_session) + end + + # special params/session style hash with knockout_merge elements in form src: ["1","2"] dest:["--1,--2", "3,4"] + hash_params = {"amenity"=>{"id"=>[FIELD_KNOCKOUT_PREFIX+"1,"+FIELD_KNOCKOUT_PREFIX+"2", "3,4"]}} + hash_session = {"amenity"=>{"id"=>["1", "2"]}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"amenity"=>{"id"=>["3","4"]}}, hash_session) + + # same as previous but without ko_split value, this merge should fail + hash_params = {"amenity"=>{"id"=>[FIELD_KNOCKOUT_PREFIX+"1,"+FIELD_KNOCKOUT_PREFIX+"2", "3,4"]}} + hash_session = {"amenity"=>{"id"=>["1", "2"]}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX}) + assert_equal({"amenity"=>{"id"=>["1","2","3,4"]}}, hash_session) + + # special params/session style hash with knockout_merge elements in form src: ["1","2"] dest:["--1,--2", "3,4"] + hash_params = {"amenity"=>{"id"=>[FIELD_KNOCKOUT_PREFIX+"1,2", "3,4", "--5", "6"]}} + hash_session = {"amenity"=>{"id"=>["1", "2"]}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"amenity"=>{"id"=>["2","3","4","6"]}}, hash_session) + + # special params/session style hash with knockout_merge elements in form src: ["--1,--2", "3,4", "--5", "6"] dest:["1,2", "3,4"] + hash_params = {"amenity"=>{"id"=>["#{FIELD_KNOCKOUT_PREFIX}1,#{FIELD_KNOCKOUT_PREFIX}2", "3,4", "#{FIELD_KNOCKOUT_PREFIX}5", "6"]}} + hash_session = {"amenity"=>{"id"=>["1", "2", "3", "4"]}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"amenity"=>{"id"=>["3","4","6"]}}, hash_session) + + + hash_src = {"url_regions"=>[], "region"=>{"ids"=>["227,233"]}, "action"=>"browse", "task"=>"browse", "controller"=>"results"} + hash_dst = {"region"=>{"ids"=>["227"]}} + DeepMerge::deep_merge!(hash_src.dup, hash_dst, {:overwrite_unmergeables => true, :knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"url_regions"=>[], "region"=>{"ids"=>["227","233"]}, "action"=>"browse", "task"=>"browse", "controller"=>"results"}, hash_dst) + + hash_src = {"region"=>{"ids"=>["--","227"], "id"=>"230"}} + hash_dst = {"region"=>{"ids"=>["227", "233", "324", "230", "230"], "id"=>"230"}} + DeepMerge::deep_merge!(hash_src, hash_dst, {:overwrite_unmergeables => true, :knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"region"=>{"ids"=>["227"], "id"=>"230"}}, hash_dst) + + hash_src = {"region"=>{"ids"=>["--","227", "232", "233"], "id"=>"232"}} + hash_dst = {"region"=>{"ids"=>["227", "233", "324", "230", "230"], "id"=>"230"}} + DeepMerge::deep_merge!(hash_src, hash_dst, {:overwrite_unmergeables => true, :knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"region"=>{"ids"=>["227", "232", "233"], "id"=>"232"}}, hash_dst) + + hash_src = {"region"=>{"ids"=>["--,227,232,233"], "id"=>"232"}} + hash_dst = {"region"=>{"ids"=>["227", "233", "324", "230", "230"], "id"=>"230"}} + DeepMerge::deep_merge!(hash_src, hash_dst, {:overwrite_unmergeables => true, :knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"region"=>{"ids"=>["227", "232", "233"], "id"=>"232"}}, hash_dst) + + hash_src = {"region"=>{"ids"=>["--,227,232","233"], "id"=>"232"}} + hash_dst = {"region"=>{"ids"=>["227", "233", "324", "230", "230"], "id"=>"230"}} + DeepMerge::deep_merge!(hash_src, hash_dst, {:overwrite_unmergeables => true, :knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"region"=>{"ids"=>["227", "232", "233"], "id"=>"232"}}, hash_dst) + + hash_src = {"region"=>{"ids"=>["--,227"], "id"=>"230"}} + hash_dst = {"region"=>{"ids"=>["227", "233", "324", "230", "230"], "id"=>"230"}} + DeepMerge::deep_merge!(hash_src, hash_dst, {:overwrite_unmergeables => true, :knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"region"=>{"ids"=>["227"], "id"=>"230"}}, hash_dst) + + hash_src = {"region"=>{"ids"=>["--,227"], "id"=>"230"}} + hash_dst = {"region"=>{"ids"=>["227", "233", "324", "230", "230"], "id"=>"230"}, "action"=>"browse", "task"=>"browse", "controller"=>"results", "property_order_by"=>"property_type.descr"} + DeepMerge::deep_merge!(hash_src, hash_dst, {:overwrite_unmergeables => true, :knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"region"=>{"ids"=>["227"], "id"=>"230"}, "action"=>"browse", "task"=>"browse", + "controller"=>"results", "property_order_by"=>"property_type.descr"}, hash_dst) + + hash_src = {"query_uuid"=>"6386333d-389b-ab5c-8943-6f3a2aa914d7", "region"=>{"ids"=>["--,227"], "id"=>"230"}} + hash_dst = {"query_uuid"=>"6386333d-389b-ab5c-8943-6f3a2aa914d7", "url_regions"=>[], "region"=>{"ids"=>["227", "233", "324", "230", "230"], "id"=>"230"}, "action"=>"browse", "task"=>"browse", "controller"=>"results", "property_order_by"=>"property_type.descr"} + DeepMerge::deep_merge!(hash_src, hash_dst, {:overwrite_unmergeables => true, :knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"query_uuid" => "6386333d-389b-ab5c-8943-6f3a2aa914d7", "url_regions"=>[], + "region"=>{"ids"=>["227"], "id"=>"230"}, "action"=>"browse", "task"=>"browse", + "controller"=>"results", "property_order_by"=>"property_type.descr"}, hash_dst) + + # knock out entire dest hash if "--" is passed for source + hash_params = {'amenity' => "--"} + hash_session = {"amenity" => "1"} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => "--", :unpack_arrays => ","}) + assert_equal({'amenity' => ""}, hash_session) + + # knock out entire dest hash if "--" is passed for source + hash_params = {'amenity' => ["--"]} + hash_session = {"amenity" => "1"} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => "--", :unpack_arrays => ","}) + assert_equal({'amenity' => []}, hash_session) + + # knock out entire dest hash if "--" is passed for source + hash_params = {'amenity' => "--"} + hash_session = {"amenity" => ["1"]} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => "--", :unpack_arrays => ","}) + assert_equal({'amenity' => ""}, hash_session) + + # knock out entire dest hash if "--" is passed for source + hash_params = {'amenity' => ["--"]} + hash_session = {"amenity" => ["1"]} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => "--", :unpack_arrays => ","}) + assert_equal({'amenity' => []}, hash_session) + + # knock out entire dest hash if "--" is passed for source + hash_params = {'amenity' => ["--"]} + hash_session = {"amenity" => "1"} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => "--", :unpack_arrays => ","}) + assert_equal({'amenity' => []}, hash_session) + + # knock out entire dest hash if "--" is passed for source + hash_params = {'amenity' => ["--", "2"]} + hash_session = {'amenity' => ["1", "3", "7+"]} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => "--", :unpack_arrays => ","}) + assert_equal({'amenity' => ["2"]}, hash_session) + + # knock out entire dest hash if "--" is passed for source + hash_params = {'amenity' => ["--", "2"]} + hash_session = {'amenity' => "5"} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => "--", :unpack_arrays => ","}) + assert_equal({'amenity' => ['2']}, hash_session) + + # knock out entire dest hash if "--" is passed for source + hash_params = {'amenity' => "--"} + hash_session = {"amenity"=>{"id"=>["1", "2", "3", "4"]}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => "--", :unpack_arrays => ","}) + assert_equal({'amenity' => ""}, hash_session) + + # knock out entire dest hash if "--" is passed for source + hash_params = {'amenity' => ["--"]} + hash_session = {"amenity"=>{"id"=>["1", "2", "3", "4"]}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => "--", :unpack_arrays => ","}) + assert_equal({'amenity' => []}, hash_session) + + # knock out dest array if "--" is passed for source + hash_params = {"region" => {'ids' => FIELD_KNOCKOUT_PREFIX}} + hash_session = {"region"=>{"ids"=>["1", "2", "3", "4"]}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({'region' => {'ids' => ""}}, hash_session) + + # knock out dest array but leave other elements of hash intact + hash_params = {"region" => {'ids' => FIELD_KNOCKOUT_PREFIX}} + hash_session = {"region"=>{"ids"=>["1", "2", "3", "4"], 'id'=>'11'}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({'region' => {'ids' => "", 'id'=>'11'}}, hash_session) + + # knock out entire tree of dest hash + hash_params = {"region" => FIELD_KNOCKOUT_PREFIX} + hash_session = {"region"=>{"ids"=>["1", "2", "3", "4"], 'id'=>'11'}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({'region' => ""}, hash_session) + + # knock out entire tree of dest hash - retaining array format + hash_params = {"region" => {'ids' => [FIELD_KNOCKOUT_PREFIX]}} + hash_session = {"region"=>{"ids"=>["1", "2", "3", "4"], 'id'=>'11'}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({'region' => {'ids' => [], 'id'=>'11'}}, hash_session) + + # knock out entire tree of dest hash & replace with new content + hash_params = {"region" => {'ids' => ["2", FIELD_KNOCKOUT_PREFIX, "6"]}} + hash_session = {"region"=>{"ids"=>["1", "2", "3", "4"], 'id'=>'11'}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({'region' => {'ids' => ["2", "6"], 'id'=>'11'}}, hash_session) + + # knock out entire tree of dest hash & replace with new content + hash_params = {"region" => {'ids' => ["7", FIELD_KNOCKOUT_PREFIX, "6"]}} + hash_session = {"region"=>{"ids"=>["1", "2", "3", "4"], 'id'=>'11'}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({'region' => {'ids' => ["7", "6"], 'id'=>'11'}}, hash_session) + + # edge test: make sure that when we turn off knockout_prefix that all values are processed correctly + hash_params = {"region" => {'ids' => ["7", "--", "2", "6,8"]}} + hash_session = {"region"=>{"ids"=>["1", "2", "3", "4"], 'id'=>'11'}} + DeepMerge::deep_merge!(hash_params, hash_session, {:unpack_arrays => ","}) + assert_equal({'region' => {'ids' => ["1", "2", "3", "4", "7", "--", "6", "8"], 'id'=>'11'}}, hash_session) + + # edge test 2: make sure that when we turn off source array split that all values are processed correctly + hash_params = {"region" => {'ids' => ["7", "3", "--", "6,8"]}} + hash_session = {"region"=>{"ids"=>["1", "2", "3", "4"], 'id'=>'11'}} + DeepMerge::deep_merge!(hash_params, hash_session) + assert_equal({'region' => {'ids' => ["1", "2", "3", "4", "7", "--", "6,8"], 'id'=>'11'}}, hash_session) + + # Example: src = {'key' => "--1"}, dst = {'key' => "1"} -> merges to {'key' => ""} + hash_params = {"amenity"=>"--1"} + hash_session = {"amenity"=>"1"} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX}) + assert_equal({"amenity"=>""}, hash_session) + + # Example: src = {'key' => "--1"}, dst = {'key' => "2"} -> merges to {'key' => ""} + hash_params = {"amenity"=>"--1"} + hash_session = {"amenity"=>"2"} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX}) + assert_equal({"amenity"=>""}, hash_session) + + # Example: src = {'key' => "--1"}, dst = {'key' => "1"} -> merges to {'key' => ""} + hash_params = {"amenity"=>["--1"]} + hash_session = {"amenity"=>"1"} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX}) + assert_equal({"amenity"=>[]}, hash_session) + + # Example: src = {'key' => "--1"}, dst = {'key' => "1"} -> merges to {'key' => ""} + hash_params = {"amenity"=>["--1"]} + hash_session = {"amenity"=>["1"]} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX}) + assert_equal({"amenity"=>[]}, hash_session) + + # Example: src = {'key' => "--1"}, dst = {'key' => "1"} -> merges to {'key' => ""} + hash_params = {"amenity"=>"--1"} + hash_session = {} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX}) + assert_equal({"amenity"=>""}, hash_session) + + + # Example: src = {'key' => "--1"}, dst = {'key' => "1"} -> merges to {'key' => ""} + hash_params = {"amenity"=>"--1"} + hash_session = {"amenity"=>["1"]} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX}) + assert_equal({"amenity"=>""}, hash_session) + + #are unmerged hashes passed unmodified w/out :unpack_arrays? + hash_params = {"amenity"=>{"id"=>["26,27"]}} + hash_session = {} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX}) + assert_equal({"amenity"=>{"id"=>["26,27"]}}, hash_session) + + #hash should be merged + hash_params = {"amenity"=>{"id"=>["26,27"]}} + hash_session = {} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"amenity"=>{"id"=>["26","27"]}}, hash_session) + + # second merge of same values should result in no change in output + hash_params = {"amenity"=>{"id"=>["26,27"]}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"amenity"=>{"id"=>["26","27"]}}, hash_session) + + #hashes with knockout values are suppressed + hash_params = {"amenity"=>{"id"=>["#{FIELD_KNOCKOUT_PREFIX}26,#{FIELD_KNOCKOUT_PREFIX}27,28"]}} + hash_session = {} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"amenity"=>{"id"=>["28"]}}, hash_session) + + hash_src= {'region' =>{'ids'=>['--']}, 'query_uuid' => 'zzz'} + hash_dst= {'region' =>{'ids'=>['227','2','3','3']}, 'query_uuid' => 'zzz'} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => '--', :unpack_arrays => ","}) + assert_equal({'region' =>{'ids'=>[]}, 'query_uuid' => 'zzz'}, hash_dst) + + hash_src= {'region' =>{'ids'=>['--']}, 'query_uuid' => 'zzz'} + hash_dst= {'region' =>{'ids'=>['227','2','3','3'], 'id' => '3'}, 'query_uuid' => 'zzz'} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => '--', :unpack_arrays => ","}) + assert_equal({'region' =>{'ids'=>[], 'id'=>'3'}, 'query_uuid' => 'zzz'}, hash_dst) + + hash_src= {'region' =>{'ids'=>['--']}, 'query_uuid' => 'zzz'} + hash_dst= {'region' =>{'muni_city_id' => '2244', 'ids'=>['227','2','3','3'], 'id'=>'3'}, 'query_uuid' => 'zzz'} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => '--', :unpack_arrays => ","}) + assert_equal({'region' =>{'muni_city_id' => '2244', 'ids'=>[], 'id'=>'3'}, 'query_uuid' => 'zzz'}, hash_dst) + + hash_src= {'region' =>{'ids'=>['--'], 'id' => '5'}, 'query_uuid' => 'zzz'} + hash_dst= {'region' =>{'muni_city_id' => '2244', 'ids'=>['227','2','3','3'], 'id'=>'3'}, 'query_uuid' => 'zzz'} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => '--', :unpack_arrays => ","}) + assert_equal({'region' =>{'muni_city_id' => '2244', 'ids'=>[], 'id'=>'5'}, 'query_uuid' => 'zzz'}, hash_dst) + + hash_src= {'region' =>{'ids'=>['--', '227'], 'id' => '5'}, 'query_uuid' => 'zzz'} + hash_dst= {'region' =>{'muni_city_id' => '2244', 'ids'=>['227','2','3','3'], 'id'=>'3'}, 'query_uuid' => 'zzz'} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => '--', :unpack_arrays => ","}) + assert_equal({'region' =>{'muni_city_id' => '2244', 'ids'=>['227'], 'id'=>'5'}, 'query_uuid' => 'zzz'}, hash_dst) + + hash_src= {'region' =>{'muni_city_id' => '--', 'ids'=>'--', 'id'=>'5'}, 'query_uuid' => 'zzz'} + hash_dst= {'region' =>{'muni_city_id' => '2244', 'ids'=>['227','2','3','3'], 'id'=>'3'}, 'query_uuid' => 'zzz'} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => '--', :unpack_arrays => ","}) + assert_equal({'region' =>{'muni_city_id' => '', 'ids'=>'', 'id'=>'5'}, 'query_uuid' => 'zzz'}, hash_dst) + + hash_src= {'region' =>{'muni_city_id' => '--', 'ids'=>['--'], 'id'=>'5'}, 'query_uuid' => 'zzz'} + hash_dst= {'region' =>{'muni_city_id' => '2244', 'ids'=>['227','2','3','3'], 'id'=>'3'}, 'query_uuid' => 'zzz'} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => '--', :unpack_arrays => ","}) + assert_equal({'region' =>{'muni_city_id' => '', 'ids'=>[], 'id'=>'5'}, 'query_uuid' => 'zzz'}, hash_dst) + + hash_src= {'region' =>{'muni_city_id' => '--', 'ids'=>['--','227'], 'id'=>'5'}, 'query_uuid' => 'zzz'} + hash_dst= {'region' =>{'muni_city_id' => '2244', 'ids'=>['227','2','3','3'], 'id'=>'3'}, 'query_uuid' => 'zzz'} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => '--', :unpack_arrays => ","}) + assert_equal({'region' =>{'muni_city_id' => '', 'ids'=>['227'], 'id'=>'5'}, 'query_uuid' => 'zzz'}, hash_dst) + + hash_src = {"muni_city_id"=>"--", "id"=>""} + hash_dst = {"muni_city_id"=>"", "id"=>""} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => '--', :unpack_arrays => ","}) + assert_equal({"muni_city_id"=>"", "id"=>""}, hash_dst) + + hash_src = {"region"=>{"muni_city_id"=>"--", "id"=>""}} + hash_dst = {"region"=>{"muni_city_id"=>"", "id"=>""}} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => '--', :unpack_arrays => ","}) + assert_equal({"region"=>{"muni_city_id"=>"", "id"=>""}}, hash_dst) + + hash_src = {"query_uuid"=>"a0dc3c84-ec7f-6756-bdb0-fff9157438ab", "url_regions"=>[], "region"=>{"muni_city_id"=>"--", "id"=>""}, "property"=>{"property_type_id"=>"", "search_rate_min"=>"", "search_rate_max"=>""}, "task"=>"search", "run_query"=>"Search"} + hash_dst = {"query_uuid"=>"a0dc3c84-ec7f-6756-bdb0-fff9157438ab", "url_regions"=>[], "region"=>{"muni_city_id"=>"", "id"=>""}, "property"=>{"property_type_id"=>"", "search_rate_min"=>"", "search_rate_max"=>""}, "task"=>"search", "run_query"=>"Search"} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => '--', :unpack_arrays => ","}) + assert_equal({"query_uuid"=>"a0dc3c84-ec7f-6756-bdb0-fff9157438ab", "url_regions"=>[], "region"=>{"muni_city_id"=>"", "id"=>""}, "property"=>{"property_type_id"=>"", "search_rate_min"=>"", "search_rate_max"=>""}, "task"=>"search", "run_query"=>"Search"}, hash_dst) + + # hash of array of hashes + hash_src = {"item" => [{"1" => "3"}, {"2" => "4"}]} + hash_dst = {"item" => [{"3" => "5"}]} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"item" => [{"3" => "5"}, {"1" => "3"}, {"2" => "4"}]}, hash_dst) + end # test_deep_merge +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/History.txt b/flex-bison/clcalc/tools/ceedling/vendor/diy/History.txt new file mode 100644 index 0000000..9833fd1 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/History.txt @@ -0,0 +1,28 @@ +== 1.1.2 / 2009-11-30 + * Converted to Jeweler for gem packaging + * diy/factory.rb was somehow missing from the 1.1.1 gem on gemcutter. This has been fixed as part of the Jeweler changeover. + * Rebuilt homepage http://atomicobject.github.com/diy + +== 1.1.1 / 2008-05-21 + * Fixed bug that did not allow a method to be properly injected into an object + +== 1.1 / 2008-05-20 + * Added 'method' directive for building a bounded method from an object defined in diy + +== 1.0.3 / 2007-12-11 + +* The 1.0.1 release had a load-path search in it that resulted in requiring files with full path names (rooted in loadpath entries). This is unintuitive, and will almost always result in a double "require" if the application code ever requires a library. The "require" for library loading now relies implicitly on the load path (just like normal human-coded requires.) + +== 1.0.1 / 2007-12-02 + +* Added 'using_namespace' directive for assuming a module for a group of object defs +* Added 'use_class_directly' option for configuring an ObjectDef. Instead of instantiating an instance + of the specified class, the class itself is referenced. (Good for injecting ActiveRecord classes into + other components in the guise of factories. +* Added DIY::Context.auto_require boolean setting. When false, the library of a + class is not autoloaded ahead of object construction. Is true by default. +* 'auto_require' can, if neccessary, be set in the YAML config for an individual object. + +== 1.0.0 / 2007-11-19 + +* Released! diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/README.rdoc b/flex-bison/clcalc/tools/ceedling/vendor/diy/README.rdoc new file mode 100644 index 0000000..6dfef2e --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/README.rdoc @@ -0,0 +1,233 @@ +== DIY + +* http://atomicobject.github.com/diy + +== DESCRIPTION: + +DIY (Dependency Injection in YAML) is a simple dependency injection library +which focuses on declarative composition of objects through constructor injection. + +== INSTALL: + +* gem install diy + +== SYNOPSIS: + +=== Common Usage + +Author a YAML file that describes your objects and how they fit together. +This means you're building a Hash whose keys are the object names, and whose +values are Hashes that define the object. + +The following context defines an automobile engine: + +context.yml: + --- + engine: + compose: throttle, block + throttle: + compose: cable, pedal + block: + cable: + pedal: + +In your code, use DIY to load the YAML, then access its parts: + + context = DIY::Context.from_file('context.yml') + context[:engine] => + +This approach assumes: + +* You've got classes for Engine, Throttle, Block, Cable and Pedal +* They're defined in engine.rb, throttle.rb, etc +* The library files are in your load-path +* Engine and Throttle both have a constructor that accepts a Hash. The Hash + will contain keys 'throttle', 'block' (for Engine) and 'cable, 'pedal' (for Throttle) + and the values will be references to their respective objects. +* Block, Cable and Pedal all have default constructors that accept no arguments + +Sample code for Engine's constructor: + + class Engine + def initialize(components) + @throttle = components['throttle'] + @block = components['block'] + end + end + +Writing code like that is repetetive; that's why we created the Constructor gem, which lets you +specify object components using the "constructor" class method: + +Using constructor, you can write Engine like this: + + class Engine + constructor :throttle, :block + end + +=== Special Cases + +If your object has a lot of components (or they have big names) you can specify an array of component names +as opposed to a comma-separated list: + + engine: + compose: + - throttle + - block + +Sometimes you won't be able to rely on DIY's basic assumptions about class names and library files. + +* You can specify the 'class' option +* You can specify the 'library' option. If you do not, the library is inferred from the class name. + (Eg, My::Train::Station will be sought in "my/train/station.rb" + + engine: + class: FourHorse::Base + library: general_engines/base + compose: throttle, block + +If the Hash coming into your constructor needs to have some keys that do not exactly match the official +object names, you can specify them one-by-one: + + engine: + the_throttle: throttle + the_block: block + +=== Non-singleton objects + +Non-singletons are named objects that provide a new instance every time you ask for them. +By default, DIY considers all objects to be singletons. To override, use the "singleton" setting and +set it to false: + + foo: + singleton: false + +=== Sub-Contexts + +Sub-contexts are useful for creating isolated object networks that may need to be instantiated +zero or many times in your application. Objects defined in subcontexts can reference "upward" to +their surroundings, as well as objects in the subcontext itself. + +If you wanted to be able to make more than one Engine from the preceding examples, you might try: + + --- + epa_regulations: + + +automotive_plant: + engine: + compose: block, throttle, epa_regulations + block: + throttle: + +Each time you delve into the automotive_plant, you get a solar system of the defined objects. +In this context, the objects are singleton-like. The next time you invoke the subcontext, however, +you'll be working with a fresh set of objects... another solar system with the same layout, so to speak. + +Subcontexts are not initialized until you call upon them, which you do using the "within" method: + + context = DIY::Context.from_file('context.yml') + context.within('automotive_plant') do |plant| + puts plant[:engine] + end + +=== Direct Class References + +Occasionally you will have a class at your disposal that you'd like to provide directly as components +to other objects (as opposed to getting _instances_ of that class, you want to reference the class itself, eg, +to use its factory methods). Enter the "use_class_directly" flag: + + --- + customer_order_finder: + class: CustomerOrder + use_class_directly: true + +This can be handy in Rails when you'd like to use some of class methods on an ActiveRecord subclass, but +you'd like to avoid direct ActiveRecord class usage in your code. In this case, the customer_order_finder +is actually the CustomerOrder class, and so, it has methods like "find" and "destroy_all". + +=== Namespace Convenience + +If you find yourself writing context entries like this: + + --- + engine: + class: Car::Parts::Engine + throttle: + class: Car::Parts::Block + cable: + class: Car::Parts::Cable + +You can set the "assumed" module for a group of objects like this: + + --- + using_namespace Car Parts: + engine: + + throttle: + + block: + +=== Preventing auto-requiring of library files + +Normally, DIY will "require" the library for an object just before it instantiates the object. +If this is not desired (in Rails, auto-require can lead to library double-load issues), you +can deactivate auto-require. There is a global default setting (handled in code) and +a per-object override (handled in the context YAML): + + DIY::Context.auto_require = false + + --- + engine: + auto_require: false + +=== Factories + +It is possible to create factories automatically with DIY: + + --- + car_dealer: + compose: car_factory + + car_factory: + builds: car + +Then you can use the factory to easily build objects: + + context = DIY::Context.from_file('context.yml') + context[:car_factory].create => + +=== Method Directive + +This introduces the concept of first class methods. An object can now be constructed with a method object +bound to a particular object in the diy context. + + --- + trinket_builder: + + method build_trinket: + object: trinket_builder + method: build + +== LICENSE: + +(The MIT License) + +Copyright (c) 2007 Atomic Object + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/Rakefile b/flex-bison/clcalc/tools/ceedling/vendor/diy/Rakefile new file mode 100644 index 0000000..0fb9c44 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/Rakefile @@ -0,0 +1,33 @@ +require 'rubygems' + +task :default => [ :test ] + +require 'rake/testtask' +Rake::TestTask.new do |t| + t.libs << "test" + t.test_files = FileList['test/**/*_test.rb'] + t.verbose = true +end + + +begin + require 'jeweler' + Jeweler::Tasks.new do |gemspec| + $: << "lib" + require 'diy.rb' + gemspec.name = 'diy' + gemspec.version = DIY::VERSION + gemspec.summary = 'Constructor-based dependency injection container using YAML input.' + gemspec.description = 'Constructor-based dependency injection container using YAML input.' + gemspec.homepage = 'http://atomicobject.github.com/diy' + gemspec.authors = 'Atomic Object' + gemspec.email = 'github@atomicobject.com' + gemspec.test_files = FileList['test/*_test.rb'] + gemspec.add_dependency 'constructor', '>= 1.0.0' + end + + Jeweler::GemcutterTasks.new + +rescue LoadError + puts "(jeweler not installed)" +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/TODO.txt b/flex-bison/clcalc/tools/ceedling/vendor/diy/TODO.txt new file mode 100644 index 0000000..8533234 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/TODO.txt @@ -0,0 +1,9 @@ +Sun Dec 2 19:59:16 EST 2007 +crosby + +Features from FRE's rogue diy.rb (inside Injection) that need to be +incorporated into trunk: + +* auto_require +* use_class_directly + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/diy.gemspec b/flex-bison/clcalc/tools/ceedling/vendor/diy/diy.gemspec new file mode 100644 index 0000000..fe9ac19 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/diy.gemspec @@ -0,0 +1,131 @@ +# Generated by jeweler +# DO NOT EDIT THIS FILE DIRECTLY +# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command +# -*- encoding: utf-8 -*- + +Gem::Specification.new do |s| + s.name = %q{diy} + s.version = "1.1.2" + + s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= + s.authors = ["Atomic Object"] + s.date = %q{2009-12-01} + s.description = %q{Constructor-based dependency injection container using YAML input.} + s.email = %q{github@atomicobject.com} + s.extra_rdoc_files = [ + "README.rdoc" + ] + s.files = [ + "History.txt", + "README.rdoc", + "Rakefile", + "TODO.txt", + "diy.gemspec", + "lib/diy.rb", + "lib/diy/factory.rb", + "sample_code/car.rb", + "sample_code/chassis.rb", + "sample_code/diy_example.rb", + "sample_code/engine.rb", + "sample_code/objects.yml", + "test/constructor.rb", + "test/diy_test.rb", + "test/factory_test.rb", + "test/files/broken_construction.yml", + "test/files/cat/cat.rb", + "test/files/cat/extra_conflict.yml", + "test/files/cat/heritage.rb", + "test/files/cat/needs_input.yml", + "test/files/cat/the_cat_lineage.rb", + "test/files/dog/dog_model.rb", + "test/files/dog/dog_presenter.rb", + "test/files/dog/dog_view.rb", + "test/files/dog/file_resolver.rb", + "test/files/dog/other_thing.rb", + "test/files/dog/simple.yml", + "test/files/donkey/foo.rb", + "test/files/donkey/foo/bar/qux.rb", + "test/files/factory/beef.rb", + "test/files/factory/dog.rb", + "test/files/factory/factory.yml", + "test/files/factory/farm/llama.rb", + "test/files/factory/farm/pork.rb", + "test/files/factory/kitten.rb", + "test/files/fud/objects.yml", + "test/files/fud/toy.rb", + "test/files/functions/attached_things_builder.rb", + "test/files/functions/invalid_method.yml", + "test/files/functions/method_extractor.rb", + "test/files/functions/nonsingleton_objects.yml", + "test/files/functions/objects.yml", + "test/files/functions/thing.rb", + "test/files/functions/thing_builder.rb", + "test/files/functions/things_builder.rb", + "test/files/gnu/objects.yml", + "test/files/gnu/thinger.rb", + "test/files/goat/base.rb", + "test/files/goat/can.rb", + "test/files/goat/goat.rb", + "test/files/goat/objects.yml", + "test/files/goat/paper.rb", + "test/files/goat/plane.rb", + "test/files/goat/shirt.rb", + "test/files/goat/wings.rb", + "test/files/horse/holder_thing.rb", + "test/files/horse/objects.yml", + "test/files/namespace/animal/bird.rb", + "test/files/namespace/animal/cat.rb", + "test/files/namespace/animal/reptile/hardshell/turtle.rb", + "test/files/namespace/animal/reptile/lizard.rb", + "test/files/namespace/bad_module_specified.yml", + "test/files/namespace/class_name_combine.yml", + "test/files/namespace/hello.txt", + "test/files/namespace/no_module_specified.yml", + "test/files/namespace/objects.yml", + "test/files/namespace/road.rb", + "test/files/namespace/sky.rb", + "test/files/namespace/subcontext.yml", + "test/files/non_singleton/air.rb", + "test/files/non_singleton/fat_cat.rb", + "test/files/non_singleton/objects.yml", + "test/files/non_singleton/pig.rb", + "test/files/non_singleton/thread_spinner.rb", + "test/files/non_singleton/tick.rb", + "test/files/non_singleton/yard.rb", + "test/files/yak/core_model.rb", + "test/files/yak/core_presenter.rb", + "test/files/yak/core_view.rb", + "test/files/yak/data_source.rb", + "test/files/yak/fringe_model.rb", + "test/files/yak/fringe_presenter.rb", + "test/files/yak/fringe_view.rb", + "test/files/yak/giant_squid.rb", + "test/files/yak/krill.rb", + "test/files/yak/my_objects.yml", + "test/files/yak/sub_sub_context_test.yml", + "test/test_helper.rb" + ] + s.homepage = %q{http://atomicobject.github.com/diy} + s.rdoc_options = ["--charset=UTF-8"] + s.require_paths = ["lib"] + s.rubygems_version = %q{1.3.5} + s.summary = %q{Constructor-based dependency injection container using YAML input.} + s.test_files = [ + "test/diy_test.rb", + "test/factory_test.rb" + ] + + if s.respond_to? :specification_version then + current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION + s.specification_version = 3 + + if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then + s.add_runtime_dependency(%q, [">= 1.0.0"]) + else + s.add_dependency(%q, [">= 1.0.0"]) + end + else + s.add_dependency(%q, [">= 1.0.0"]) + end +end + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/lib/diy.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/lib/diy.rb new file mode 100644 index 0000000..581afc7 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/lib/diy.rb @@ -0,0 +1,403 @@ +require 'diy/factory.rb' +require 'yaml' +require 'set' + +module DIY #:nodoc:# + VERSION = '1.1.2' + class Context + + class << self + # Enable / disable automatic requiring of libraries. Default: true + attr_accessor :auto_require + end + @auto_require = true + + # Accepts a Hash defining the object context (usually loaded from objects.yml), and an additional + # Hash containing objects to inject into the context. + def initialize(context_hash, extra_inputs={}) + raise "Nil context hash" unless context_hash + raise "Need a hash" unless context_hash.kind_of?(Hash) + [ "[]", "keys" ].each do |mname| + unless extra_inputs.respond_to?(mname) + raise "Extra inputs must respond to hash-like [] operator and methods #keys and #each" + end + end + + # store extra inputs + if extra_inputs.kind_of?(Hash) + @extra_inputs= {} + extra_inputs.each { |k,v| @extra_inputs[k.to_s] = v } # smooth out the names + else + @extra_inputs = extra_inputs + end + + collect_object_and_subcontext_defs context_hash + + # init the cache + @cache = {} + @cache['this_context'] = self + end + + + # Convenience: create a new DIY::Context by loading from a String (or open file handle.) + def self.from_yaml(io_or_string, extra_inputs={}) + raise "nil input to YAML" unless io_or_string + Context.new(YAML.load(io_or_string), extra_inputs) + end + + # Convenience: create a new DIY::Context by loading from the named file. + def self.from_file(fname, extra_inputs={}) + raise "nil file name" unless fname + self.from_yaml(File.read(fname), extra_inputs) + end + + # Return a reference to the object named. If necessary, the object will + # be instantiated on first use. If the object is non-singleton, a new + # object will be produced each time. + def get_object(obj_name) + key = obj_name.to_s + obj = @cache[key] + unless obj + if extra_inputs_has(key) + obj = @extra_inputs[key] + else + case @defs[key] + when MethodDef + obj = construct_method(key) + when FactoryDef + obj = construct_factory(key) + @cache[key] = obj + else + obj = construct_object(key) + @cache[key] = obj if @defs[key].singleton? + end + end + end + obj + end + alias :[] :get_object + + # Inject a named object into the Context. This must be done before the Context has instantiated the + # object in question. + def set_object(obj_name,obj) + key = obj_name.to_s + raise "object '#{key}' already exists in context" if @cache.keys.include?(key) + @cache[key] = obj + end + alias :[]= :set_object + + # Provide a listing of object names + def keys + (@defs.keys.to_set + @extra_inputs.keys.to_set).to_a + end + + # Instantiate and yield the named subcontext + def within(sub_context_name) + # Find the subcontext definitaion: + context_def = @sub_context_defs[sub_context_name.to_s] + raise "No sub-context named #{sub_context_name}" unless context_def + # Instantiate a new context using self as parent: + context = Context.new( context_def, self ) + + yield context + end + + # Returns true if the context contains an object with the given name + def contains_object(obj_name) + key = obj_name.to_s + @defs.keys.member?(key) or extra_inputs_has(key) + end + + # Every top level object in the Context is instantiated. This is especially useful for + # systems that have "floating observers"... objects that are never directly accessed, who + # would thus never be instantiated by coincedence. This does not build any subcontexts + # that may exist. + def build_everything + @defs.keys.each { |k| self[k] } + end + alias :build_all :build_everything + alias :preinstantiate_singletons :build_everything + + private + + def collect_object_and_subcontext_defs(context_hash) + @defs = {} + @sub_context_defs = {} + get_defs_from context_hash + end + + def get_defs_from(hash, namespace=nil) + hash.each do |name,info| + # we modify the info hash below so it's important to have a new + # instance to play with + info = info.dup if info + + # see if we are building a factory + if info and info.has_key?('builds') + unless info.has_key?('auto_require') + info['auto_require'] = self.class.auto_require + end + + if namespace + info['builds'] = namespace.build_classname(info['builds']) + end + @defs[name] = FactoryDef.new({:name => name, + :target => info['builds'], + :library => info['library'], + :auto_require => info['auto_require']}) + next + end + + name = name.to_s + case name + when /^\+/ + # subcontext + @sub_context_defs[name.gsub(/^\+/,'')] = info + + when /^using_namespace/ + # namespace: use a module(s) prefix for the classname of contained object defs + # NOTE: namespacing is NOT scope... it's just a convenient way to setup class names for a group of objects. + get_defs_from info, parse_namespace(name) + when /^method\s/ + key_name = name.gsub(/^method\s/, "") + @defs[key_name] = MethodDef.new(:name => key_name, + :object => info['object'], + :method => info['method'], + :attach => info['attach']) + else + # Normal object def + info ||= {} + if extra_inputs_has(name) + raise ConstructionError.new(name, "Object definition conflicts with parent context") + end + unless info.has_key?('auto_require') + info['auto_require'] = self.class.auto_require + end + if namespace + if info['class'] + info['class'] = namespace.build_classname(info['class']) + else + info['class'] = namespace.build_classname(name) + end + end + + @defs[name] = ObjectDef.new(:name => name, :info => info) + + end + end + end + + def construct_method(key) + method_definition = @defs[key] + object = get_object(method_definition.object) + method = object.method(method_definition.method) + + unless method_definition.attach.nil? + instance_var_name = "@__diy_#{method_definition.object}" + + method_definition.attach.each do |object_key| + get_object(object_key).instance_eval do + instance_variable_set(instance_var_name, object) + eval %|def #{key}(*args) + #{instance_var_name}.#{method_definition.method}(*args) + end| + end + end + end + + return method + rescue Exception => oops + build_and_raise_construction_error(key, oops) + end + + def construct_object(key) + # Find the object definition + obj_def = @defs[key] + raise "No object definition for '#{key}'" unless obj_def + # If object def mentions a library, load it + require obj_def.library if obj_def.library + + # Resolve all components for the object + arg_hash = {} + obj_def.components.each do |name,value| + case value + when Lookup + arg_hash[name.to_sym] = get_object(value.name) + when StringValue + arg_hash[name.to_sym] = value.literal_value + else + raise "Cannot cope with component definition '#{value.inspect}'" + end + end + # Get a reference to the class for the object + big_c = get_class_for_name_with_module_delimeters(obj_def.class_name) + # Make and return the instance + if obj_def.use_class_directly? + return big_c + elsif arg_hash.keys.size > 0 + return big_c.new(arg_hash) + else + return big_c.new + end + rescue Exception => oops + build_and_raise_construction_error(key, oops) + end + + def build_and_raise_construction_error(key, oops) + cerr = ConstructionError.new(key,oops) + cerr.set_backtrace(oops.backtrace) + raise cerr + end + + def get_class_for_name_with_module_delimeters(class_name) + class_name.split(/::/).inject(Object) do |mod,const_name| mod.const_get(const_name) end + end + + def extra_inputs_has(key) + if key.nil? or key.strip == '' + raise ArgumentError.new("Cannot lookup objects with nil keys") + end + @extra_inputs.keys.member?(key) or @extra_inputs.keys.member?(key.to_sym) + end + + def parse_namespace(str) + Namespace.new(str) + end + end + + class Namespace #:nodoc:# + def initialize(str) + # 'using_namespace Animal Reptile' + parts = str.split(/\s+/) + raise "Namespace definitions must begin with 'using_namespace'" unless parts[0] == 'using_namespace' + parts.shift + + if parts.length > 0 and parts[0] =~ /::/ + parts = parts[0].split(/::/) + end + + raise NamespaceError, "Namespace needs to indicate a module" if parts.empty? + + @module_nest = parts + end + + def build_classname(name) + [ @module_nest, Infl.camelize(name) ].flatten.join("::") + end + end + + class Lookup #:nodoc: + attr_reader :name + def initialize(obj_name) + @name = obj_name + end + end + + class MethodDef #:nodoc: + attr_accessor :name, :object, :method, :attach + + def initialize(opts) + @name, @object, @method, @attach = opts[:name], opts[:object], opts[:method], opts[:attach] + end + end + + class ObjectDef #:nodoc: + attr_accessor :name, :class_name, :library, :components + def initialize(opts) + name = opts[:name] + raise "Can't make an ObjectDef without a name" if name.nil? + + info = opts[:info] || {} + info = info.clone + + @components = {} + + # Object name + @name = name + + # Class name + @class_name = info.delete 'class' + @class_name ||= info.delete 'type' + @class_name ||= Infl.camelize(@name) + + # Auto Require + @auto_require = info.delete 'auto_require' + + # Library + @library = info.delete 'library' + @library ||= info.delete 'lib' + @library ||= Infl.underscore(@class_name) if @auto_require + + # Use Class Directly + @use_class_directly = info.delete 'use_class_directly' + + # Auto-compose + compose = info.delete 'compose' + if compose + case compose + when Array + auto_names = compose.map { |x| x.to_s } + when String + auto_names = compose.split(',').map { |x| x.to_s.strip } + when Symbol + auto_names = [ compose.to_s ] + else + raise "Cannot auto compose object #{@name}, bad 'compose' format: #{compose.inspect}" + end + end + auto_names ||= [] + auto_names.each do |cname| + @components[cname] = Lookup.new(cname) + end + + # Singleton status + if info['singleton'].nil? + @singleton = true + else + @singleton = info['singleton'] + end + info.delete 'singleton' + + # Remaining keys + info.each do |key,val| + @components[key.to_s] = Lookup.new(val.to_s) + end + + end + + def singleton? + @singleton + end + + def use_class_directly? + @use_class_directly == true + end + + end + + class ConstructionError < RuntimeError #:nodoc:# + def initialize(object_name, cause=nil) + object_name = object_name + cause = cause + m = "Failed to construct '#{object_name}'" + if cause + m << "\n ...caused by:\n >>> #{cause}" + end + super m + end + end + + class NamespaceError < RuntimeError #:nodoc:# + end + + module Infl #:nodoc:# + # Ganked this from Inflector: + def self.camelize(lower_case_and_underscored_word) + lower_case_and_underscored_word.to_s.gsub(/\/(.?)/) { "::" + $1.upcase }.gsub(/(^|_)(.)/) { $2.upcase } + end + # Ganked this from Inflector: + def self.underscore(camel_cased_word) + camel_cased_word.to_s.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z])/,'\1_\2').gsub(/([a-z\d])([A-Z])/,'\1_\2').downcase + end + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/lib/diy/factory.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/lib/diy/factory.rb new file mode 100644 index 0000000..d2566c5 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/lib/diy/factory.rb @@ -0,0 +1,36 @@ +module DIY #:nodoc:# + class FactoryDef #:nodoc: + attr_accessor :name, :target, :class_name, :library + + def initialize(opts) + @name, @target, @library, @auto_require = + opts[:name], opts[:target], opts[:library], opts[:auto_require] + + @class_name = Infl.camelize(@target) + @library ||= Infl.underscore(@class_name) if @auto_require + end + end + + class Context + def construct_factory(key) + factory_def = @defs[key] +# puts "requiring #{factory_def.library}" + require factory_def.library if factory_def.library + + big_c = get_class_for_name_with_module_delimeters(factory_def.class_name) + + FactoryFactory.new(big_c) + end + end + + class FactoryFactory + def initialize(clazz) + @class_to_create = clazz + end + + def create(*args) + @class_to_create.new(*args) + end + end +end + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/sample_code/car.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/sample_code/car.rb new file mode 100644 index 0000000..9a6a8ed --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/sample_code/car.rb @@ -0,0 +1,7 @@ +class Car + attr_reader :engine, :chassis + def initialize(arg_hash) + @engine = arg_hash[:engine] + @chassis = arg_hash[:chassis] + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/sample_code/chassis.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/sample_code/chassis.rb new file mode 100644 index 0000000..b745b0b --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/sample_code/chassis.rb @@ -0,0 +1,5 @@ +class Chassis + def to_s + "Chassis" + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/sample_code/diy_example.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/sample_code/diy_example.rb new file mode 100644 index 0000000..88d5b7e --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/sample_code/diy_example.rb @@ -0,0 +1,26 @@ +require "rubygems" +require "diy" + +class Car + attr_reader :engine, :chassis + def initialize(arg_hash) + @engine = arg_hash[:engine] + @chassis = arg_hash[:chassis] + end +end + +class Chassis + def to_s + "Chassis" + end +end + +class Engine + def to_s + "Engine" + end +end + +context = DIY::Context.from_file("objects.yml") +car = context['car'] +puts "Car is made of: #{car.engine} and #{car.chassis}" diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/sample_code/engine.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/sample_code/engine.rb new file mode 100644 index 0000000..65c2dd5 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/sample_code/engine.rb @@ -0,0 +1,5 @@ +class Engine + def to_s + "Engine" + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/sample_code/objects.yml b/flex-bison/clcalc/tools/ceedling/vendor/diy/sample_code/objects.yml new file mode 100644 index 0000000..6deb100 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/sample_code/objects.yml @@ -0,0 +1,10 @@ +--- +car: + compose: + - engine + - chassis + +engine: + +chassis: + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/constructor.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/constructor.rb new file mode 100644 index 0000000..5fe8f3a --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/constructor.rb @@ -0,0 +1,119 @@ +CONSTRUCTOR_VERSION = '1.0.2' #:nodoc:# + +class Class #:nodoc:# + def constructor(*attrs, &block) + call_block = '' + if block_given? + @constructor_block = block + call_block = 'self.instance_eval(&self.class.constructor_block)' + end + # Look for embedded options in the listing: + opts = attrs.find { |a| a.kind_of?(Hash) and attrs.delete(a) } + do_acc = opts.nil? ? false : opts[:accessors] == true + require_args = opts.nil? ? true : opts[:strict] != false + super_args = opts.nil? ? nil : opts[:super] + + # Incorporate superclass's constructor keys, if our superclass + if superclass.constructor_keys + similar_keys = superclass.constructor_keys & attrs + raise "Base class already has keys #{similar_keys.inspect}" unless similar_keys.empty? + attrs = [attrs,superclass.constructor_keys].flatten + end + # Generate ivar assigner code lines + assigns = '' + attrs.each do |k| + assigns += "@#{k.to_s} = args[:#{k.to_s}]\n" + end + + # If accessors option is on, declare accessors for the attributes: + if do_acc + self.class_eval "attr_accessor " + attrs.map {|x| ":#{x.to_s}"}.join(',') + end + + # If user supplied super-constructor hints: + super_call = '' + if super_args + list = super_args.map do |a| + case a + when String + %|"#{a}"| + when Symbol + %|:#{a}| + end + end + super_call = %|super(#{list.join(',')})| + end + + # If strict is on, define the constructor argument validator method, + # and setup the initializer to invoke the validator method. + # Otherwise, insert lax code into the initializer. + validation_code = "return if args.nil?" + if require_args + self.class_eval do + def _validate_constructor_args(args) + # First, make sure we've got args of some kind + unless args and args.keys and args.keys.size > 0 + raise ConstructorArgumentError.new(self.class.constructor_keys) + end + # Scan for missing keys in the argument hash + a_keys = args.keys + missing = [] + self.class.constructor_keys.each do |ck| + unless a_keys.member?(ck) + missing << ck + end + a_keys.delete(ck) # Delete inbound keys as we address them + end + if missing.size > 0 || a_keys.size > 0 + raise ConstructorArgumentError.new(missing,a_keys) + end + end + end + # Setup the code to insert into the initializer: + validation_code = "_validate_constructor_args args " + end + + # Generate the initializer code + self.class_eval %{ + def initialize(args=nil) + #{super_call} + #{validation_code} + #{assigns} + setup if respond_to?(:setup) + #{call_block} + end + } + + # Remember our constructor keys + @_ctor_keys = attrs + end + + # Access the constructor keys for this class + def constructor_keys; @_ctor_keys ||=[]; end + + def constructor_block #:nodoc:# + @constructor_block + end + +end + +# Fancy validation exception, based on missing and extraneous keys. +class ConstructorArgumentError < RuntimeError #:nodoc:# + def initialize(missing,rejected=[]) + err_msg = '' + if missing.size > 0 + err_msg = "Missing constructor args [#{missing.join(',')}]" + end + if rejected.size > 0 + # Some inbound keys were not addressed earlier; this means they're unwanted + if err_msg + err_msg << "; " # Appending to earlier message about missing items + else + err_msg = '' + end + # Enumerate the rejected key names + err_msg << "Rejected constructor args [#{rejected.join(',')}]" + end + super err_msg + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/diy_test.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/diy_test.rb new file mode 100644 index 0000000..3540200 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/diy_test.rb @@ -0,0 +1,608 @@ +require File.dirname(__FILE__) + "/test_helper" +require 'diy' +require 'fileutils' +include FileUtils + +class DIYTest < Test::Unit::TestCase + + def setup + # Add load paths: + %w|gnu dog cat yak donkey goat horse fud non_singleton namespace functions|.each do |p| + libdir = path_to_test_file(p) + $: << libdir unless $:.member?(libdir) + end + DIY::Context.auto_require = true # Restore default + end + + + # + # TESTS + # + + def test_essential_use_case + load_context "dog/simple.yml" + + # Check object defs + check_dog_objects @diy + + # Tweak the load-path + $: << path_to_test_file("dog") + + # Get the objects, use reference comparison to check composition + presenter = @diy.get_object('dog_presenter') + assert_not_nil presenter, 'nil dog_presenter' + + model = @diy.get_object('dog_model') + assert_not_nil model, 'nil dog_model' + assert_same presenter.model, model, "Different model came from context than found in presenter" + + view = @diy.get_object('dog_view') + assert_not_nil view, 'nil dog_view' + assert_same presenter.view, view, "Different view came from context than found in presenter" + + resolver = @diy.get_object('file_resolver') + assert_not_nil resolver, 'nil file_resolver' + assert_same model.file_resolver, resolver, "File resolver in model is different than one in context" + + # Check repeat access: + assert_same model, @diy.get_object('dog_model'), "Second access of model yielded different result" + assert_same view, @diy.get_object('dog_view'), "Second access of view yielded different result" + assert_same presenter, @diy.get_object('dog_presenter'), "Second access of presenter got difrnt result" + end + + def test_classname_inside_a_module + load_hash 'thinger' => {'class' => "DiyTesting::Bar::Foo", 'lib' => 'foo'} + @diy.build_everything + assert_not_nil @diy['thinger'], "Should have got my thinger (which is hiding in a couple modules)" + end + + def test_classname_inside_a_module_loads_from_directories_named_after_the_underscored_module_names + load_hash 'thinger' => {'class' => "Foo::Bar::Qux"} + # expect it to be loaded from: foo/bar/qux.rb + @diy.build_everything + assert_not_nil @diy['thinger'], "Should have got my thinger (which is hiding in a couple modules)" + end + + def test_use_class_directly + load_hash 'thinger' => {'class' => "DiyTesting::Bar::Foo", 'lib' => 'foo', 'use_class_directly' => true} + @diy.build_everything + assert_equal DiyTesting::Bar::Foo, @diy['thinger'], "Should be the class 'object'" + end + + def test_classname_inside_a_module_derives_the_namespaced_classname_from_the_underscored_object_def_key + load_hash 'foo/bar/qux' => nil + @diy.build_everything + assert_not_nil @diy['foo/bar/qux'], "Should have got my qux (which is hiding in a couple modules)" + end + + def test_keys + load_context "dog/simple.yml" + assert_equal %w|dog_model dog_presenter dog_view file_resolver other_thing|, @diy.keys.sort + end + + def test_subcontext_keys_should_include_parent_context_keys + load_context 'yak/sub_sub_context_test.yml' + main_keys = %w|core_presenter core_model core_view data_source|.sort + assert_equal main_keys, @diy.keys.sort, "Wrong keys in main context" + @diy.within :fringe_context do |fcontext| + fringe_keys = [main_keys, %w|fringe_model fringe_view fringe_presenter|].flatten.sort + assert_equal fringe_keys, fcontext.keys.sort, "Wrong keys in fringe context" + fcontext.within :deep_context do |dcontext| + deep_keys = [fringe_keys, %w|krill giant_squid|].flatten.sort + assert_equal deep_keys, dcontext.keys.sort + end + end + end + + def test_constructor_no_hash + assert_raise RuntimeError do DIY::Context.new(nil) end + end + + def test_constructor_bad_extra_inputs + err = assert_raise RuntimeError do + DIY::Context.new({}, Object.new) + end + assert_match(/extra inputs/i, err.message) + end + + def test_from_yaml + text = File.read(path_to_test_file("dog/simple.yml")) + diy = DIY::Context.from_yaml(text) + check_dog_objects diy + end + + def test_from_yaml_extra_inputs + extra = { 'the_cat_lineage' => 'siamese', :some_meat => 'horse' } + diy = DIY::Context.from_yaml(File.read(path_to_test_file('cat/needs_input.yml')), extra) + cat = diy['cat'] + assert_equal 'siamese', cat.heritage + assert_equal 'horse', cat.food + end + + def test_from_file + diy = DIY::Context.from_file(path_to_test_file("dog/simple.yml")) + check_dog_objects diy + end + + def test_from_file_bad + assert_raise RuntimeError do + DIY::Context.from_file(nil) + end + assert_raise Errno::ENOENT do + DIY::Context.from_file("bad file name") + end + end + + def test_from_file_extra_inputs + extra = { 'the_cat_lineage' => 'siamese', :some_meat => 'horse' } + diy = DIY::Context.from_file(path_to_test_file('cat/needs_input.yml'), extra) + cat = diy['cat'] + assert_equal 'siamese', cat.heritage + assert_equal 'horse', cat.food + end + + def test_contains_object + load_context "dog/simple.yml" + assert @diy.contains_object('dog_presenter'), "Should be true for dog_presenter" + assert !@diy.contains_object('woops'), "Should return false for 'woops'" + err = assert_raise ArgumentError do + @diy.contains_object(nil) + end + end + + def test_contains_object_extra_inputs + extra = { 'the_cat_lineage' => 'siamese', :some_meat => 'horse' } + main = YAML.load(File.read(path_to_test_file('cat/needs_input.yml'))) + diy = DIY::Context.new(main, extra) + + assert diy.contains_object('cat') + assert diy.contains_object('the_cat_lineage') + assert diy.contains_object('some_meat') + end + + def test_get_object + load_context "dog/simple.yml" + assert_not_nil @diy.get_object('file_resolver'), "nil resolver?" + assert_raise ArgumentError do + @diy.get_object(nil) + end + assert_raise DIY::ConstructionError do + @diy.get_object("no such object") + end + end + + def test_hash_style_access + load_context "dog/simple.yml" + assert_not_nil @diy['file_resolver'], "nil resolver?" + assert_raise ArgumentError do + @diy[nil] + end + assert_raise DIY::ConstructionError do + @diy["no such object"] + end + end + + def test_get_object_construction_error + load_context "broken_construction.yml" + err = assert_raise DIY::ConstructionError do + @diy.get_object 'dog_presenter' + end + assert_match(/dog_presenter/, err.message) + end + + def test_context_with_extra_inputs + extra = { 'the_cat_lineage' => 'siamese', :some_meat => 'horse' } + main = YAML.load(File.read(path_to_test_file('cat/needs_input.yml'))) + diy = DIY::Context.new(main, extra) + cat = diy['cat'] + assert_equal 'siamese', cat.heritage + assert_equal 'horse', cat.food + end + + def test_conflicting_extra_inputs + extra = { 'the_cat_lineage' => 'siamese', :some_meat => 'horse' } + main = YAML.load(File.read(path_to_test_file('cat/extra_conflict.yml'))) + + DIY::Context.new(main,extra) + flunk "Should have raised err" + rescue Exception => err + assert_match(/conflict/i, err.message) + end + + def test_sub_context + load_context 'yak/my_objects.yml' + + core_model = @diy['core_model'] + assert_not_nil core_model, "no core model in main context?" + + fmodel1 = nil + fview1 = nil + @diy.within('fringe_context') do |fc| + assert_not_nil fc["fringe_presenter"], "no fringe presenter" + fmodel1 = fc["fringe_model"] + fmodel1a = fc["fringe_model"] + assert_same fmodel1, fmodel1a, "Second fring model in fringe_context came out different" + assert_not_nil fmodel1, "no fringe_model" + fview1 = fc["fringe_view"] + assert_not_nil fview1, "no fringe_view" + assert_same core_model, fmodel1.connected + end + + fmodel2 = nil + fview2 = nil + @diy.within('fringe_context') do |fc| + assert_not_nil fc["fringe_presenter"], "2: no fringe presenter" + fmodel2 = fc["fringe_model"] + fmodel2a = fc["fringe_model"] + assert_same fmodel2, fmodel2a, "Second fringe model in fringe_context came out different" + assert_not_nil fmodel2, "2: no fringe_model" + fview2 = fc["fringe_view"] + assert_not_nil fview2, "2: no fringe_view" + assert_same core_model, fmodel2.connected + + assert fmodel1.object_id != fmodel2.object_id, "fringe models 1 and 2 are same!" + assert fview1.object_id != fview2.object_id, "fringe views 1 and 2 are same!" + end + end + + def test_sub_sub_context + load_context 'yak/sub_sub_context_test.yml' + + core_model = @diy['core_model'] + assert_not_nil core_model, "no core model in main context?" + + fmodel1 = nil + fview1 = nil + @diy.within('fringe_context') do |fc| + assert_not_nil fc["fringe_presenter"], "no fringe presenter" + fmodel1 = fc["fringe_model"] + fmodel1a = fc["fringe_model"] + assert_same fmodel1, fmodel1a, "Second fring model in fringe_context came out different" + assert_not_nil fmodel1, "no fringe_model" + fview1 = fc["fringe_view"] + assert_not_nil fview1, "no fringe_view" + assert_same core_model, fmodel1.connected + + fc.within :deep_context do |dc| + krill = dc['krill'] + assert_not_nil krill, "nil krill" + assert_same krill, dc['krill'], "krill was different second time" + giant_squid = dc['giant_squid'] + assert_same fview1, giant_squid.fringe_view, "wrong view in squid" + assert_same core_model, giant_squid.core_model, "wrong model in squid" + assert_same krill, giant_squid.krill, "wrong krill in squid" + end + end + + end + + def test_build_everything + # Singletons in the goat context will generate test output in their constructors. + # We just gotta tell em where: + ofile = path_to_test_file('goat/output.tmp') + $goat_test_output_file = ofile + + # Reusable setup for this test + prep_output = proc do + remove ofile if File.exist?(ofile) + end + + # Reusable assertion set and cleanup + examine_output = proc do + # Examine output file for expected construction + assert File.exist?(ofile), "no goat output created" + lines = File.readlines(ofile).map { |x| x.strip } + %w|can paper shirt goat|.each do |object| + assert lines.member?("#{object} built"), "Didn't see constructor output for #{object}" + end + assert_equal 4, lines.size, "wrong number of entries in output file" + + # Make sure the subcontext was not built + assert !lines.member?("plane built"), "plane should not have been built -- it's in the subcontext" + assert !lines.member?("wings built"), "wings should not have been built -- it's in the subcontext" + + # Check the objects in the context + %w|can paper shirt goat|.each do |object| + assert_same @diy[object], @diy[object], "Multiple accesses on #{object} yielded different refs" + end + + # Try the subcontext + @diy.within('the_sub_context') do |tsc| + %w|plane wings|.each do |object| + assert_same tsc[object], tsc[object], "Multiple accesses on #{object} (in subcontext) yielded different refs" + end + end + # cleanup + remove ofile if File.exist?(ofile) + end + + # Test all three methods + [:build_everything, :build_all, :preinstantiate_singletons].each do |method_name| + prep_output.call + load_context 'goat/objects.yml' + # go + @diy.send method_name + examine_output.call + end + ensure + # cleanup + remove ofile if File.exist?(ofile) + end + + # See that the current object factory context can be referenced within the yaml + def test_this_context + load_context 'horse/objects.yml' + + assert_same @diy, @diy['this_context'], "basic self-reference failed" + assert_same @diy, @diy['holder_thing'].thing_held, "composition self-reference failed" + end + + def test_this_context_works_for_subcontexts + load_context 'horse/objects.yml' + + @diy.within('repeater') do |ctx| + assert_same ctx, ctx['this_context'], "self-ref inside a subcontext doesn't work" + end + end + + def test_multiple_classes_in_one_file + load_context 'fud/objects.yml' + + toy = @diy['toy'] + widget = @diy['widget'] + thing = @diy['thing_ama_jack'] + trinket = @diy['trinket'] + + assert_same widget, toy.widget, "wrong widget in toy" + assert_same trinket, toy.trinket, "wrong trinket in toy" + assert_same thing, trinket.thing_ama_jack, "wrong thing_ama_jack in trinket" + end + + def test_objects_can_be_set_in_a_context_and_diy_will_not_attempt_to_build_it_as_a_dependency + load_context 'gnu/objects.yml' + + injected = 'boom' + @diy[:injected] = injected + thinger = @diy[:thinger] + assert_not_nil thinger + assert_same injected, thinger.injected + assert_same injected, @diy[:injected] + + inner_injected = 'slam' + @diy.within :inny do |sub| + sub.set_object :inner_injected, inner_injected + inner_thinger = sub[:inner_thinger] + assert_not_nil inner_thinger + assert_same inner_injected, inner_thinger.injected + assert_same inner_injected, sub[:inner_injected] + end + end + + def test_should_not_allow_setting_of_an_object_which_has_already_been_loaded + load_context 'gnu/objects.yml' + + injected = 'boom' + @diy[:injected] = injected + err = assert_raise RuntimeError do + @diy[:injected] = injected + end + assert_match(/object 'injected' already exists/i, err.message) + assert_same injected, @diy[:injected] + + thinger = @diy[:thinger] + err = assert_raise RuntimeError do + @diy[:thinger] = 'sdf' + end + assert_match(/object 'thinger' already exists/i, err.message) + assert_same thinger, @diy[:thinger] + end + + def test_should_be_able_to_turn_off_auto_require_for_all_objects + DIY::Context.auto_require = false + load_context 'horse/objects.yml' + + exception = assert_raise(DIY::ConstructionError) { @diy['holder_thing'] } + assert_match(/uninitialized constant/, exception.message) + end + + def test_should_cause_non_singletons_to_be_rebuilt_every_time_they_are_accessed + load_context 'non_singleton/objects.yml' + + air = @diy['air'] + assert_not_nil air, "No air" + assert_same air, @diy['air'], "Air should be a singleton" + + yard = @diy['yard'] + assert_not_nil yard, "No yard" + assert_same yard, @diy['yard'], "yard should be a singleton" + + pig = @diy['pig'] + assert_not_nil pig, "No pig" + assert_same pig, @diy['pig'], "Pig should be a singleton" + + thread_spinner1 = @diy['thread_spinner'] + assert_not_nil thread_spinner1, "Couldn't get thread spinner" + thread_spinner2 = @diy['thread_spinner'] + assert_not_nil thread_spinner2, "Couldn't get second thread spinner" + assert thread_spinner1.object_id != thread_spinner2.object_id, "Thread spinners should be different instances" + thread_spinner3 = pig.thread_spinner + assert_not_nil thread_spinner3, "Didn't get a spinner from the pig" + assert thread_spinner2.object_id != thread_spinner3.object_id, "Thread spinner from pig should be different instance than the others" + assert thread_spinner1.object_id != thread_spinner3.object_id, "Thread spinner from pig should be different instance than the others" + + assert_same air, thread_spinner1.air, "spinner 1 air should be singleton reference" + assert_same air, thread_spinner2.air, "spinner 2 air should be singleton reference" + assert_same air, thread_spinner3.air, "spinner 3 air should be singleton reference" + end + + def test_should_handle_nonsingletons_in_sub_contexts + load_context 'non_singleton/objects.yml' + + yard = @diy['yard'] + assert_not_nil yard, "No yard" + assert_same yard, @diy['yard'], "yard should be a singleton" + + thread_spinner1 = @diy['thread_spinner'] + assert_not_nil thread_spinner1, "Couldn't get thread spinner" + + air = @diy['air'] + assert_not_nil air, "No air" + assert_same air, @diy['air'], "Air should be a singleton" + + @diy.within :inner_sanctum do |sanct| + tick1 = sanct['tick'] + assert_not_nil tick1, "Couldn't get tick1 from inner sanctum" + tick2 = sanct['tick'] + assert_not_nil tick2, "Couldn't get tick2 from inner sanctum" + assert tick1.object_id != tick2.object_id, "Tick should not be a singleton" + + cat = sanct['fat_cat'] + assert_not_nil cat, "Couldn't get cat from sanctum" + assert_same cat, sanct['fat_cat'], "Cat SHOULD be singleton" + + tick3 = cat.tick + assert_not_nil tick3, "Couldn't get tick from cat" + assert tick1.object_id != tick3.object_id, "tick from cat matched an earlier tick; should not be so" + + assert_same yard, cat.yard, "Cat's yard should be same as other yard" + assert_not_nil cat.thread_spinner, "No thread spinner in cat?" + + assert_same air, cat.thread_spinner.air, "spinner 1 air should be singleton reference" + assert thread_spinner1.object_id != cat.thread_spinner.object_id, "cat's thread spinner matched the other spinner; should not be so" + end + end + + def test_should_provide_syntax_for_using_namespace + # This test exercises single and triple-level namespaces for nested + # modules, and their interaction with other namespaced-objects. + load_context "namespace/objects.yml" + + %w{road sky cat bird lizard turtle}.each do |obj| + assert @diy.contains_object(obj), "Context had no object '#{obj}'" + end + + road = @diy['road'] + sky = @diy['sky'] + cat = @diy['cat'] + bird = @diy['bird'] + lizard = @diy['lizard'] + turtle = @diy['turtle'] + + assert_same road, cat.road, "Cat has wrong Road" + assert_same sky, bird.sky, "Bird has wrong Sky" + assert_same bird, lizard.bird, "Lizard has wrong Bird" + end + + def test_should_combine_a_given_class_name_with_the_namespace + load_context "namespace/class_name_combine.yml" + assert_not_nil @diy['garfield'], "No garfield" + assert_kind_of Animal::Cat, @diy['garfield'], "Garfield wrong" + end + + def test_should_let_you_use_namespaces_in_subcontexts + load_context "namespace/subcontext.yml" + @diy.build_everything + %w{road sky cat turtle}.each do |obj| + assert @diy.contains_object(obj), "Main context had no object '#{obj}'" + end + sky = @diy['sky'] + + @diy.within("aviary") do |subc| + assert subc.contains_object("bird"), "Sub context didn't have 'bird'" + assert subc.contains_object("lizard"), "Sub context didn't have 'lizard'" + bird = subc['bird'] + lizard = subc['lizard'] + assert_same sky, bird.sky, "Bird has wrong Sky" + assert_same bird, lizard.bird, "Lizard has wrong Bird" + end + end + + def test_should_raise_for_namespace_w_no_modules_named + ex = assert_raises DIY::NamespaceError do + load_context "namespace/no_module_specified.yml" + end + assert_equal "Namespace needs to indicate a module", ex.message + end + + def test_should_raise_for_namespace_whose_modules_dont_exist + load_context "namespace/bad_module_specified.yml" + ex = assert_raises DIY::ConstructionError do + @diy['bird'] + end + assert_match(/failed to construct/i, ex.message) + assert_match(/no such file to load -- fuzzy_creature\/bird/, ex.message) + end + + def test_should_be_able_define_and_access_bounded_methods + load_context "functions/objects.yml" + @diy.build_everything + build_thing = @diy['build_thing'] + + assert_not_nil build_thing, "should not be nil" + assert_kind_of(Method, build_thing) + assert_equal(build_thing, @diy['build_thing']) + end + + def test_bounded_method_can_be_used + load_context "functions/objects.yml" + @diy.build_everything + build_thing = @diy['build_thing'] + + thing = build_thing["the name", "flying"] + + assert_equal("the name", thing.name) + assert_equal("flying", thing.ability) + end + + def test_building_bounded_method_uses_object_in_diy_context_correctly + load_context "functions/objects.yml" + @diy.build_everything + assert_equal(@diy['build_thing'], @diy['thing_builder'].method(:build)) + + load_context "functions/nonsingleton_objects.yml" + @diy.build_everything + assert_not_equal(@diy['build_thing'], @diy['thing_builder'].method(:build)) + end + + def test_composing_bounded_methods_into_other_objects + load_context "functions/objects.yml" + @diy.build_everything + assert_equal(@diy['build_thing'], @diy['things_builder'].build_thing) + end + + def test_raises_construction_error_if_invalid_method_specified + load_context "functions/invalid_method.yml" + assert_raises DIY::ConstructionError do + @diy.build_everything + end + end + + def test_can_optionally_attach_method_to_other_objects_in_context + load_context "functions/objects.yml" + @diy.build_everything + + thing = @diy['attached_things_builder'].build_thing("the name", "flying") + assert_kind_of(Thing, thing) + assert_equal("the name", thing.name) + assert_equal("flying", thing.ability) + + ["attached_things_builder", "things_builder"].each do |key| + thing = @diy[key].build_default_thing + assert_kind_of(Thing, thing) + assert_equal("Thing", thing.name) + assert_equal("nothing", thing.ability) + end + end + + # + # HELPERS + # + def check_dog_objects(context) + assert_not_nil context, "nil context" + names = %w|dog_presenter dog_model dog_view file_resolver| + names.each do |n| + assert context.contains_object(n), "Context had no object '#{n}'" + end + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/factory_test.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/factory_test.rb new file mode 100644 index 0000000..ed02f01 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/factory_test.rb @@ -0,0 +1,79 @@ +require File.dirname(__FILE__) + "/test_helper" +require 'diy' +require 'fileutils' +include FileUtils + +class FactoryTest < Test::Unit::TestCase + + def setup + # Add load paths: + %w|factory|.each do |p| + libdir = path_to_test_file(p) + $: << libdir unless $:.member?(libdir) + end + DIY::Context.auto_require = true # Restore default + end + + + # + # TESTS + # + + def test_creates_factory + load_context "factory/factory.yml" + + cat_factory = @diy.get_object(:cat_factory) + assert_not_nil cat_factory + + cat = cat_factory.create('a', 'b') + + assert cat.is_a?(Kitten) + assert_equal "meow", cat.meow + assert_equal 'a', cat.a + assert_equal 'b', cat.b + end + + def test_creates_factory_with_autorequire + load_context "factory/factory.yml" + + dog_factory = @diy.get_object(:dog_factory) + assert_not_nil dog_factory + + dog = dog_factory.create + + assert dog.is_a?(Dog) + assert_equal "woof", dog.woof + end + + def test_creates_factory_with_subcontext + load_context "factory/factory.yml" + + @diy.within :inny do |context| + bull_factory = context.get_object(:bull_factory) + beef = bull_factory.create + end + end + + def test_creates_factory_with_subcontext_and_namespace + load_context "factory/factory.yml" + + @diy.within :congress do |context| + politician = context.get_object(:politician) + pork = politician.create + assert pork.is_a?(Farm::Pork) + assert_equal "money!", pork.oink + end + end + + def test_creates_factory_with_namespace + load_context "factory/factory.yml" + + llama_factory = @diy.get_object(:llama_factory) + assert_not_nil llama_factory + + llama = llama_factory.create + + assert llama.is_a?(Farm::Llama) + assert_equal "?", llama.make_llama_noise + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/broken_construction.yml b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/broken_construction.yml new file mode 100644 index 0000000..1dacb01 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/broken_construction.yml @@ -0,0 +1,7 @@ + +dog_presenter: + model: dog_model + view: dog_view + +dog_model: +# VIEW IS MISSING, PRESENTER SHOULD CRASH diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/cat/cat.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/cat/cat.rb new file mode 100644 index 0000000..2d17514 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/cat/cat.rb @@ -0,0 +1,3 @@ +class Cat + constructor :heritage, :food, :strict => true, :accessors => true +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/cat/extra_conflict.yml b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/cat/extra_conflict.yml new file mode 100644 index 0000000..9c6b375 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/cat/extra_conflict.yml @@ -0,0 +1,5 @@ +the_cat_lineage: + +cat: + heritage: the_cat_lineage + food: some_meat diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/cat/heritage.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/cat/heritage.rb new file mode 100644 index 0000000..617d47a --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/cat/heritage.rb @@ -0,0 +1,2 @@ +class Heritage +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/cat/needs_input.yml b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/cat/needs_input.yml new file mode 100644 index 0000000..9f622f2 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/cat/needs_input.yml @@ -0,0 +1,3 @@ +cat: + heritage: the_cat_lineage + food: some_meat diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/cat/the_cat_lineage.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/cat/the_cat_lineage.rb new file mode 100644 index 0000000..b0f4308 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/cat/the_cat_lineage.rb @@ -0,0 +1 @@ +class TheCatLineage; end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/dog/dog_model.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/dog/dog_model.rb new file mode 100644 index 0000000..51e7df0 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/dog/dog_model.rb @@ -0,0 +1,3 @@ +class DogModel + constructor :file_resolver, :other_thing, :strict => true, :accessors => true +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/dog/dog_presenter.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/dog/dog_presenter.rb new file mode 100644 index 0000000..786977d --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/dog/dog_presenter.rb @@ -0,0 +1,3 @@ +class DogPresenter + constructor :model, :view, :strict => true, :accessors => true +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/dog/dog_view.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/dog/dog_view.rb new file mode 100644 index 0000000..aae86bc --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/dog/dog_view.rb @@ -0,0 +1,2 @@ +class DogView +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/dog/file_resolver.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/dog/file_resolver.rb new file mode 100644 index 0000000..09cf18a --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/dog/file_resolver.rb @@ -0,0 +1,2 @@ +class FileResolver +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/dog/other_thing.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/dog/other_thing.rb new file mode 100644 index 0000000..48e6a95 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/dog/other_thing.rb @@ -0,0 +1,2 @@ +class OtherThing +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/dog/simple.yml b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/dog/simple.yml new file mode 100644 index 0000000..7737236 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/dog/simple.yml @@ -0,0 +1,11 @@ +dog_presenter: + model: dog_model + view: dog_view + +file_resolver: +other_thing: + +dog_model: + compose: file_resolver, other_thing + +dog_view: diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/donkey/foo.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/donkey/foo.rb new file mode 100644 index 0000000..5182cf3 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/donkey/foo.rb @@ -0,0 +1,8 @@ + +module DiyTesting + module Bar + class Foo + end + end +end + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/donkey/foo/bar/qux.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/donkey/foo/bar/qux.rb new file mode 100644 index 0000000..bb05a02 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/donkey/foo/bar/qux.rb @@ -0,0 +1,7 @@ + +module Foo + module Bar + class Qux + end + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/factory/beef.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/factory/beef.rb new file mode 100644 index 0000000..2cd31a0 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/factory/beef.rb @@ -0,0 +1,5 @@ +class Beef + def cook + return "rare" + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/factory/dog.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/factory/dog.rb new file mode 100644 index 0000000..06b9daf --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/factory/dog.rb @@ -0,0 +1,6 @@ +class Dog + def woof + "woof" + end +end + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/factory/factory.yml b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/factory/factory.yml new file mode 100644 index 0000000..8264d37 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/factory/factory.yml @@ -0,0 +1,19 @@ +cat_factory: + builds: kitten + library: kitten + +dog_factory: + builds: dog + +using_namespace Farm: + llama_factory: + builds: llama + ++inny: + bull_factory: + builds: beef + ++congress: + using_namespace Farm: + politician: + builds: pork diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/factory/farm/llama.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/factory/farm/llama.rb new file mode 100644 index 0000000..40e9fa2 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/factory/farm/llama.rb @@ -0,0 +1,7 @@ +module Farm + class Llama + def make_llama_noise + "?" + end + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/factory/farm/pork.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/factory/farm/pork.rb new file mode 100644 index 0000000..a5aa4e5 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/factory/farm/pork.rb @@ -0,0 +1,7 @@ +module Farm + class Pork + def oink + "money!" + end + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/factory/kitten.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/factory/kitten.rb new file mode 100644 index 0000000..f27a3ef --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/factory/kitten.rb @@ -0,0 +1,13 @@ +class Kitten + attr_accessor :a,:b + + def initialize(a, b) + @a = a + @b = b + end + + def meow + "meow" + end +end + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/fud/objects.yml b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/fud/objects.yml new file mode 100644 index 0000000..1a152b9 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/fud/objects.yml @@ -0,0 +1,13 @@ +widget: + lib: toy + +trinket: + lib: toy + compose: thing_ama_jack + +thing_ama_jack: + lib: toy + +toy: + lib: toy + compose: widget, trinket diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/fud/toy.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/fud/toy.rb new file mode 100644 index 0000000..937b71d --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/fud/toy.rb @@ -0,0 +1,14 @@ + +class Toy + constructor :widget, :trinket, :accessors => true, :strict => true +end + +class Widget +end + +class ThingAmaJack +end + +class Trinket + constructor :thing_ama_jack, :accessors => true, :strict => true +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/functions/attached_things_builder.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/functions/attached_things_builder.rb new file mode 100644 index 0000000..f67888a --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/functions/attached_things_builder.rb @@ -0,0 +1,2 @@ +class AttachedThingsBuilder +end \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/functions/invalid_method.yml b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/functions/invalid_method.yml new file mode 100644 index 0000000..96690c3 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/functions/invalid_method.yml @@ -0,0 +1,5 @@ +thing_builder: + +method build_thing: + object: thing_builder + method: no_exist \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/functions/method_extractor.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/functions/method_extractor.rb new file mode 100644 index 0000000..55daf46 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/functions/method_extractor.rb @@ -0,0 +1,3 @@ +class MethodExtractor + +end \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/functions/nonsingleton_objects.yml b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/functions/nonsingleton_objects.yml new file mode 100644 index 0000000..39b6fd6 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/functions/nonsingleton_objects.yml @@ -0,0 +1,6 @@ +thing_builder: + singleton: false + +method build_thing: + object: thing_builder + method: build \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/functions/objects.yml b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/functions/objects.yml new file mode 100644 index 0000000..4d0a05a --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/functions/objects.yml @@ -0,0 +1,22 @@ +thing_builder: + +method_extractor: + +attached_things_builder: + +method build_thing: + object: thing_builder + method: build + attach: + - attached_things_builder + +method build_default_thing: + object: thing_builder + method: build_default + attach: + - attached_things_builder + - things_builder + +things_builder: + compose: + - build_thing \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/functions/thing.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/functions/thing.rb new file mode 100644 index 0000000..4bc652d --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/functions/thing.rb @@ -0,0 +1,3 @@ +class Thing + constructor :name, :ability, :accessors => true +end \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/functions/thing_builder.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/functions/thing_builder.rb new file mode 100644 index 0000000..288bab4 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/functions/thing_builder.rb @@ -0,0 +1,25 @@ +require 'thing' + +class ThingBuilder + @@builder_count = 0 + + def self.reset_builder_count + @@builder_count = 0 + end + + def self.builder_count + @@builder_count + end + + def initialize + @@builder_count += 1 + end + + def build(name, ability) + Thing.new(:name => name, :ability => ability) + end + + def build_default + Thing.new(:name => "Thing", :ability => "nothing") + end +end \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/functions/things_builder.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/functions/things_builder.rb new file mode 100644 index 0000000..198c85a --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/functions/things_builder.rb @@ -0,0 +1,3 @@ +class ThingsBuilder + constructor :build_thing, :accessors => true +end \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/gnu/objects.yml b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/gnu/objects.yml new file mode 100644 index 0000000..39581ef --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/gnu/objects.yml @@ -0,0 +1,14 @@ + +injected: + +thinger: + compose: injected + ++inny: + inner_injected: + + inner_thinger: + injected: inner_injected + lib: thinger + class: Thinger + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/gnu/thinger.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/gnu/thinger.rb new file mode 100644 index 0000000..1d332f6 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/gnu/thinger.rb @@ -0,0 +1,7 @@ + + +class Thinger + constructor :injected + attr_reader :injected +end + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/goat/base.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/goat/base.rb new file mode 100644 index 0000000..a4f5d0e --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/goat/base.rb @@ -0,0 +1,8 @@ +class Base + def test_output(name) + # See diy_context_test.rb + File.open($goat_test_output_file, "a") do |f| + f.puts "#{name} built" + end + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/goat/can.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/goat/can.rb new file mode 100644 index 0000000..0bd1eeb --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/goat/can.rb @@ -0,0 +1,6 @@ +require 'base' +class Can < Base + def initialize + test_output "can" + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/goat/goat.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/goat/goat.rb new file mode 100644 index 0000000..ad084d3 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/goat/goat.rb @@ -0,0 +1,6 @@ +require 'base' +class Goat < Base + def initialize + test_output "goat" + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/goat/objects.yml b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/goat/objects.yml new file mode 100644 index 0000000..a31123e --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/goat/objects.yml @@ -0,0 +1,12 @@ +can: + +paper: + +shirt: + +goat: + ++the_sub_context: + plane: + compose: wings + wings: diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/goat/paper.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/goat/paper.rb new file mode 100644 index 0000000..2068e41 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/goat/paper.rb @@ -0,0 +1,6 @@ +require 'base' +class Paper < Base + def initialize + test_output "paper" + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/goat/plane.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/goat/plane.rb new file mode 100644 index 0000000..712e904 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/goat/plane.rb @@ -0,0 +1,7 @@ +require 'base' +class Plane < Base + constructor :wings, :strict => true + def setup + test_output "plane" + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/goat/shirt.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/goat/shirt.rb new file mode 100644 index 0000000..7b28bec --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/goat/shirt.rb @@ -0,0 +1,6 @@ +require 'base' +class Shirt < Base + def initialize + test_output "shirt" + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/goat/wings.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/goat/wings.rb new file mode 100644 index 0000000..dc0e70c --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/goat/wings.rb @@ -0,0 +1,8 @@ +require 'base' +class Wings < Base + def initialize + test_output "wings" + end + def stay_on; end + def fall_off; end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/horse/holder_thing.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/horse/holder_thing.rb new file mode 100644 index 0000000..5480216 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/horse/holder_thing.rb @@ -0,0 +1,3 @@ +class HolderThing + constructor :thing_held, :strict => true, :accessors => true +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/horse/objects.yml b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/horse/objects.yml new file mode 100644 index 0000000..54a0e9c --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/horse/objects.yml @@ -0,0 +1,7 @@ +holder_thing: + thing_held: this_context + ++repeater: + other_thing: + class: HolderThing + thing_held: this_context diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/namespace/animal/bird.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/namespace/animal/bird.rb new file mode 100644 index 0000000..27be474 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/namespace/animal/bird.rb @@ -0,0 +1,5 @@ +module Animal + class Bird + constructor :sky, :accessors => true + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/namespace/animal/cat.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/namespace/animal/cat.rb new file mode 100644 index 0000000..632257e --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/namespace/animal/cat.rb @@ -0,0 +1,5 @@ +module Animal + class Cat + constructor :road, :accessors => true + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/namespace/animal/reptile/hardshell/turtle.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/namespace/animal/reptile/hardshell/turtle.rb new file mode 100644 index 0000000..fd05feb --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/namespace/animal/reptile/hardshell/turtle.rb @@ -0,0 +1,8 @@ +module Animal + module Reptile + module Hardshell + class Turtle + end + end + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/namespace/animal/reptile/lizard.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/namespace/animal/reptile/lizard.rb new file mode 100644 index 0000000..d2c6c96 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/namespace/animal/reptile/lizard.rb @@ -0,0 +1,7 @@ +module Animal + module Reptile + class Lizard + constructor :bird, :accessors => true + end + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/namespace/bad_module_specified.yml b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/namespace/bad_module_specified.yml new file mode 100644 index 0000000..7befcac --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/namespace/bad_module_specified.yml @@ -0,0 +1,8 @@ + +sky: + +using_namespace FuzzyCreature: + + bird: + compose: sky + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/namespace/class_name_combine.yml b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/namespace/class_name_combine.yml new file mode 100644 index 0000000..77f66fc --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/namespace/class_name_combine.yml @@ -0,0 +1,8 @@ +road: + +using_namespace Animal: + + garfield: + class: Cat + compose: road + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/namespace/hello.txt b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/namespace/hello.txt new file mode 100644 index 0000000..f6bfc02 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/namespace/hello.txt @@ -0,0 +1 @@ +this is the info \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/namespace/no_module_specified.yml b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/namespace/no_module_specified.yml new file mode 100644 index 0000000..065e83f --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/namespace/no_module_specified.yml @@ -0,0 +1,8 @@ + +sky: + +using_namespace: + + bird: + compose: sky + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/namespace/objects.yml b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/namespace/objects.yml new file mode 100644 index 0000000..55511be --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/namespace/objects.yml @@ -0,0 +1,21 @@ +road: + +sky: + +using_namespace Animal: + + cat: + compose: road + + bird: + compose: sky + +using_namespace Animal Reptile: + + lizard: + compose: bird + +using_namespace Animal::Reptile::Hardshell: + + turtle: + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/namespace/road.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/namespace/road.rb new file mode 100644 index 0000000..bb050fb --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/namespace/road.rb @@ -0,0 +1,2 @@ +class Road +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/namespace/sky.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/namespace/sky.rb new file mode 100644 index 0000000..fc1e2bb --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/namespace/sky.rb @@ -0,0 +1,2 @@ +class Sky +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/namespace/subcontext.yml b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/namespace/subcontext.yml new file mode 100644 index 0000000..da63311 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/namespace/subcontext.yml @@ -0,0 +1,22 @@ +road: + +sky: + +using_namespace Animal: + + cat: + compose: road + + ++aviary: + using_namespace Animal: + bird: + compose: sky + + using_namespace Animal Reptile: + lizard: + compose: bird + +using_namespace Animal::Reptile::Hardshell: + turtle: + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/non_singleton/air.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/non_singleton/air.rb new file mode 100644 index 0000000..63414af --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/non_singleton/air.rb @@ -0,0 +1,2 @@ +class Air +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/non_singleton/fat_cat.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/non_singleton/fat_cat.rb new file mode 100644 index 0000000..54c195c --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/non_singleton/fat_cat.rb @@ -0,0 +1,3 @@ +class FatCat + constructor :thread_spinner, :tick, :yard, :accessors => true +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/non_singleton/objects.yml b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/non_singleton/objects.yml new file mode 100644 index 0000000..77b4505 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/non_singleton/objects.yml @@ -0,0 +1,19 @@ +air: + +thread_spinner: + compose: air + singleton: false + +yard: + +pig: + compose: thread_spinner, yard + ++inner_sanctum: + tick: + compose: thread_spinner + singleton: false + + fat_cat: + compose: thread_spinner, tick, yard + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/non_singleton/pig.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/non_singleton/pig.rb new file mode 100644 index 0000000..9d75013 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/non_singleton/pig.rb @@ -0,0 +1,3 @@ +class Pig + constructor :thread_spinner, :yard, :accessors => true +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/non_singleton/thread_spinner.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/non_singleton/thread_spinner.rb new file mode 100644 index 0000000..384cd11 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/non_singleton/thread_spinner.rb @@ -0,0 +1,3 @@ +class ThreadSpinner + constructor :air, :accessors => true +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/non_singleton/tick.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/non_singleton/tick.rb new file mode 100644 index 0000000..e243c16 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/non_singleton/tick.rb @@ -0,0 +1,3 @@ +class Tick + constructor :thread_spinner, :accessors => true +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/non_singleton/yard.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/non_singleton/yard.rb new file mode 100644 index 0000000..43936a7 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/non_singleton/yard.rb @@ -0,0 +1,2 @@ +class Yard +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/yak/core_model.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/yak/core_model.rb new file mode 100644 index 0000000..539b56b --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/yak/core_model.rb @@ -0,0 +1,3 @@ +class CoreModel + constructor :data_source, :strict => true +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/yak/core_presenter.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/yak/core_presenter.rb new file mode 100644 index 0000000..6caca4d --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/yak/core_presenter.rb @@ -0,0 +1,3 @@ +class CorePresenter + constructor :model, :view, :strict => true +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/yak/core_view.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/yak/core_view.rb new file mode 100644 index 0000000..7e606da --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/yak/core_view.rb @@ -0,0 +1 @@ +class CoreView; end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/yak/data_source.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/yak/data_source.rb new file mode 100644 index 0000000..772d3f4 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/yak/data_source.rb @@ -0,0 +1 @@ +class DataSource; end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/yak/fringe_model.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/yak/fringe_model.rb new file mode 100644 index 0000000..255a22e --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/yak/fringe_model.rb @@ -0,0 +1,3 @@ +class FringeModel + constructor :connected, :accessors => true, :strict => true +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/yak/fringe_presenter.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/yak/fringe_presenter.rb new file mode 100644 index 0000000..e404435 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/yak/fringe_presenter.rb @@ -0,0 +1,3 @@ +class FringePresenter + constructor :fringe_model, :fringe_view, :strict => true +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/yak/fringe_view.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/yak/fringe_view.rb new file mode 100644 index 0000000..d406d3d --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/yak/fringe_view.rb @@ -0,0 +1 @@ +class FringeView; end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/yak/giant_squid.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/yak/giant_squid.rb new file mode 100644 index 0000000..2ddc2cc --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/yak/giant_squid.rb @@ -0,0 +1,3 @@ +class GiantSquid + constructor :fringe_view, :core_model, :krill, :accessors => true +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/yak/krill.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/yak/krill.rb new file mode 100644 index 0000000..5e79f91 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/yak/krill.rb @@ -0,0 +1,2 @@ +class Krill +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/yak/my_objects.yml b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/yak/my_objects.yml new file mode 100644 index 0000000..ddc8264 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/yak/my_objects.yml @@ -0,0 +1,21 @@ + +core_model: + compose: data_source + +core_view: + +core_presenter: + model: core_model + view: core_view + +data_source: + ++fringe_context: + + fringe_model: + connected: core_model + + fringe_view: + + fringe_presenter: + compose: fringe_model, fringe_view diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/yak/sub_sub_context_test.yml b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/yak/sub_sub_context_test.yml new file mode 100644 index 0000000..465418a --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/files/yak/sub_sub_context_test.yml @@ -0,0 +1,27 @@ + +core_model: + compose: data_source + +core_view: + +core_presenter: + model: core_model + view: core_view + +data_source: + ++fringe_context: + + fringe_model: + connected: core_model + + fringe_view: + + fringe_presenter: + compose: fringe_model, fringe_view + + +deep_context: + krill: + + giant_squid: + compose: fringe_view, core_model, krill diff --git a/flex-bison/clcalc/tools/ceedling/vendor/diy/test/test_helper.rb b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/test_helper.rb new file mode 100644 index 0000000..90089f0 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/diy/test/test_helper.rb @@ -0,0 +1,55 @@ +here = File.expand_path(File.dirname(__FILE__)) +PROJ_ROOT = File.expand_path("#{here}/..") +$: << "#{PROJ_ROOT}/lib" +require 'test/unit' +require 'fileutils' +require 'find' +require 'yaml' +require 'ostruct' +require "#{here}/constructor" + +class Test::Unit::TestCase + include FileUtils + + def path_to(file) + File.expand_path(File.dirname(__FILE__)) + file + end + + def not_done + flunk "IMPLEMENT ME" + end + alias :implement_me :not_done + + def poll(time_limit) + (time_limit * 10).to_i.times do + return true if yield + sleep 0.1 + end + return false + end + + def self.method_added(msym) + # Prevent duplicate test methods + if msym.to_s =~ /^test_/ + @_tracked_tests ||= {} + raise "Duplicate test #{msym}" if @_tracked_tests[msym] + @_tracked_tests[msym] = true + end + end + + # + # HELPERS + # + def path_to_test_file(fname) + path_to("/files/#{fname}") + end + + def load_context(file_name) + hash = YAML.load(File.read(path_to_test_file(file_name))) + load_hash(hash) + end + + def load_hash(hash) + @diy = DIY::Context.new(hash) + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/hardmock/CHANGES b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/CHANGES new file mode 100644 index 0000000..4b5184c --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/CHANGES @@ -0,0 +1,78 @@ +Hardmock 1.3.7 + +* BUG FIX: expects! could not setup expectations for more than one concrete method on an object, since the method aliasing and rewriting was only taking place when the background mock instance was first created. This logic has been updated and now you can do all the things you'd expect. + +Hardmock 1.3.6 + +* BUG FIX: In Rails apps (and others) Hardmock and Fixtures battled viciously over "setup" and "teardown" and "method_added" (and any other clever test enhancement tool, namely Mocha) causing unpredictable results, notably failure to auto-verify mocks after teardown (leading to false positive tests). + * The newly-added TestUnitBeforeAfter provides TestCase.before_setup and TestCase.after_teardown -- formal test wrapping hooks -- lets Hardmock provide its preparation and auto-verify behavior without contending for setup/teardown supremacy. + +Hardmock 1.3.5 + +* Aliased should_receive => expects and and_return => returns for easier transition from rspec mock and flexmock users. + +Hardmock 1.3.4 + +* Prevents accidental stubbing and mocking on NilClasses + +Hardmock 1.3.3 + +* stubs! and expects! no longer require that their target methods exist in reality (this used to prevent you from stubbing methods that "exist" by virtue of "method_missing" +* Tweaked inner metaclass code to avoid collisions with rspec's "metaid" stuff +* Moved this project's Rake tasks into rake_tasks... otherwise Rails will load them, if Hardmock is installed as a Rails plugin +* Alias added: 'verify_hardmocks' is now an alias for 'verify_mocks' (some internal projects were using this modified method name as a means of cooexisting with mocha) + +Hardmock 1.3.2 + +November 2007 + +* adds 'with' as an alternate syntax for specifying argument expectations. + +Hardmock 1.3.1 + +October 2007 + +* Can use stubs! on a mock object +* expects! now generates mocked methods that can safely transfer runtime blocks to the mock instance itself +* No longer need to call "prepare_hardmock_control" when using stubs in the absence of mocks +* Stubs of concrete class or instance methods are restored to original state in teardown + +Hardmock 1.3.0 + +October 2007 + +* Adds stubs! and expects! method to all objects and classes to support concrete stubbing/mocking. + +Hardmock 1.2.3 + +Sat Apr 28 01:16:15 EDT 2007 + +* Re-release of 1.2.2 (which was canceled)... tasks moved to lib/tasks + +Hardmock 1.2.2 + +Sat Apr 28 00:41:30 EDT 2007 + +* assert_error has been broken out into its own lib file +* Gem package can now run all tests successfully +* Internal code refactoring; a number of classes that were defined in hardmock.rb are now in their own files + +Hardmock 1.2.1 + +Sat Apr 28 00:41:30 EDT 2007 + +* (botched release, see 1.2.2) + +Hardmock 1.2.0 + +* You can now use "expect" in place of "expects" if you must. +* "inspect" has been added to the list of methods NOT erased by MethodCleanout. + +Hardmock 1.1.0 + +* "expects" replaces "expect" ("expect" now raises Hardmock::DeprecationError) +* "verify_mocks" is now implicit in teardown, you needn't call it anymore +* Mocking methods that Mock would otherwise inherit from Object (eg, to_s) is now possible +* require 'hardmock' is all that's required to use the library now; no need to include in TestCase + +(previously called CMock, translated to Hardmock on 2006-12-10) diff --git a/flex-bison/clcalc/tools/ceedling/vendor/hardmock/LICENSE b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/LICENSE new file mode 100644 index 0000000..396211e --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/LICENSE @@ -0,0 +1,7 @@ +Copyright (c) 2006,2007 David Crosby at Atomic Object, LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/flex-bison/clcalc/tools/ceedling/vendor/hardmock/README b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/README new file mode 100644 index 0000000..4650a2a --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/README @@ -0,0 +1,70 @@ +== Hardmock + +Strict, ordered mock objects using very lightweight syntax in your tests. + +== How + +The basic procedure for using Hardmock in your tests is: + +* require 'hardmock' (this happens automatically when being used as a Rails plugin) +* Create some mocks +* Setup some expectations +* Execute the target code +* Verification of calls is automatic in =teardown= + +The expectations you set when using mocks are strict and ordered. +Expectations you declare by creating and using mocks are all considered together. + +* Hardmock::Mock#expects will show you more examples +* Hardmock::SimpleExpectation will teach you more about expectation methods + +== Example + + create_mocks :garage, :car + + # Set some expectations + @garage.expects.open_door + @car.expects.start(:choke) + @car.expects.drive(:reverse, 5.mph) + + # Execute the code (this code is usually, obviously, in your class under test) + @garage.open_door + @car.start :choke + @car.drive :reverse, 5.mph + + verify_mocks # OPTIONAL, teardown will do this for you + +Expects @garage.open_door, @car.start(:choke) and @car.drive(:reverse, 5.mph) to be called in that order, with those specific arguments. +* Violations of expectations, such as mis-ordered calls, calls on wrong objects, or incorrect methods result in Hardmock::ExpectationError +* verify_mocks will raise VerifyError if not all expectations have been met. + +== Download and Install + +* Homepage: http://hardmock.rubyforge.org +* GEM or TGZ or ZIP: http://rubyforge.org/frs/?group_id=2742 +* Rails plugin: script/plugin install +* SVN access: svn co svn://rubyforge.org/var/svn/hardmock/trunk +* Developer SVN access: svn co svn://developername@rubyforge.org/var/svn/hardmock/trunk + +== Setup for Test::Unit + + require 'hardmock' + require 'assert_error' # OPTIONAL: this adds the TestUnit extension 'assert_error' + +NOTE: If installed as a Rails plugin, init.rb does this for you... nothing else is needed. + +== Setup for RSpec + +Get this into your spec helper or environment or Rakefile or wherever you prefer: + + Spec::Runner.configure do |configuration| + configuration.include Hardmock + configuration.after(:each) {verify_mocks} + end + +This puts the implicit conveniences into your spec context, like "create_mocks" etc, and also provides for automatic +"verify_mocks" after each Example is run. + +== Author +* David Crosby crosby at http://atomicobject.com +* (c) 2006,2007 Atomic Object LLC diff --git a/flex-bison/clcalc/tools/ceedling/vendor/hardmock/Rakefile b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/Rakefile new file mode 100644 index 0000000..aff126c --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/Rakefile @@ -0,0 +1,8 @@ +require 'rake' +require 'rubygems' + +HARDMOCK_VERSION = "1.3.7" + +Dir["rake_tasks/*.rake"].each { |f| load f } + +task :default => [ 'test:all' ] diff --git a/flex-bison/clcalc/tools/ceedling/vendor/hardmock/config/environment.rb b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/config/environment.rb new file mode 100644 index 0000000..a15e598 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/config/environment.rb @@ -0,0 +1,12 @@ +# The path to the root directory of your application. +APP_ROOT = File.join(File.dirname(__FILE__), '..') + +ADDITIONAL_LOAD_PATHS = [] +ADDITIONAL_LOAD_PATHS.concat %w( + lib +).map { |dir| "#{APP_ROOT}/#{dir}" }.select { |dir| File.directory?(dir) } + +# Prepend to $LOAD_PATH +ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) } + +# Require any additional libraries needed diff --git a/flex-bison/clcalc/tools/ceedling/vendor/hardmock/lib/assert_error.rb b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/lib/assert_error.rb new file mode 100644 index 0000000..6da61de --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/lib/assert_error.rb @@ -0,0 +1,23 @@ +require 'test/unit/assertions' + +module Test::Unit #:nodoc:# + module Assertions #:nodoc:# + # A better 'assert_raise'. +patterns+ can be one or more Regexps, or a literal String that + # must match the entire error message. + def assert_error(err_type,*patterns,&block) + assert_not_nil block, "assert_error requires a block" + assert((err_type and err_type.kind_of?(Class)), "First argument to assert_error has to be an error type") + err = assert_raise(err_type) do + block.call + end + patterns.each do |pattern| + case pattern + when Regexp + assert_match(pattern, err.message) + else + assert_equal pattern, err.message + end + end + end + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/hardmock/lib/extend_test_unit.rb b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/lib/extend_test_unit.rb new file mode 100644 index 0000000..3d7ef9d --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/lib/extend_test_unit.rb @@ -0,0 +1,14 @@ + +require 'test/unit/testcase' +class Test::Unit::TestCase + include Hardmock +end + +require 'test_unit_before_after' +Test::Unit::TestCase.before_setup do |test| + test.prepare_hardmock_control +end + +Test::Unit::TestCase.after_teardown do |test| + test.verify_mocks +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/hardmock/lib/hardmock.rb b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/lib/hardmock.rb new file mode 100644 index 0000000..50f9a94 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/lib/hardmock.rb @@ -0,0 +1,86 @@ +require 'hardmock/method_cleanout' +require 'hardmock/mock' +require 'hardmock/mock_control' +require 'hardmock/utils' +require 'hardmock/errors' +require 'hardmock/trapper' +require 'hardmock/expector' +require 'hardmock/expectation' +require 'hardmock/expectation_builder' +require 'hardmock/stubbing' + +module Hardmock + + # Create one or more new Mock instances in your test suite. + # Once created, the Mocks are accessible as instance variables in your test. + # Newly built Mocks are added to the full set of Mocks for this test, which will + # be verified when you call verify_mocks. + # + # create_mocks :donkey, :cat # Your test now has @donkey and @cat + # create_mock :dog # Test now has @donkey, @cat and @dog + # + # The first call returned a hash { :donkey => @donkey, :cat => @cat } + # and the second call returned { :dog => @dog } + # + # For more info on how to use your mocks, see Mock and Expectation + # + def create_mocks(*mock_names) + prepare_hardmock_control unless @main_mock_control + + mocks = {} + mock_names.each do |mock_name| + raise ArgumentError, "'nil' is not a valid name for a mock" if mock_name.nil? + mock_name = mock_name.to_s + mock_object = Mock.new(mock_name, @main_mock_control) + mocks[mock_name.to_sym] = mock_object + self.instance_variable_set "@#{mock_name}", mock_object + end + @all_mocks ||= {} + @all_mocks.merge! mocks + + return mocks.clone + end + + def prepare_hardmock_control + if @main_mock_control.nil? + @main_mock_control = MockControl.new + $main_mock_control = @main_mock_control + else + raise "@main_mock_control is already setup for this test!" + end + end + + alias :create_mock :create_mocks + + # Ensures that all expectations have been met. If not, VerifyException is + # raised. + # + # You normally won't need to call this yourself. Within Test::Unit::TestCase, this will be done automatically at teardown time. + # + # * +force+ -- if +false+, and a VerifyError or ExpectationError has already occurred, this method will not raise. This is to help you suppress repeated errors when if you're calling #verify_mocks in the teardown method of your test suite. BE WARNED - only use this if you're sure you aren't obscuring useful information. Eg, if your code handles exceptions internally, and an ExpectationError gets gobbled up by your +rescue+ block, the cause of failure for your test may be hidden from you. For this reason, #verify_mocks defaults to force=true as of Hardmock 1.0.1 + def verify_mocks(force=true) + return unless @main_mock_control + return if @main_mock_control.disappointed? and !force + @main_mock_control.verify + ensure + @main_mock_control.clear_expectations if @main_mock_control + $main_mock_control = nil + reset_stubs + end + + alias :verify_hardmocks :verify_mocks + + # Purge the main MockControl of all expectations, restore all concrete stubbed/mocked methods + def clear_expectations + @main_mock_control.clear_expectations if @main_mock_control + reset_stubs + $main_mock_control = nil + end + + def reset_stubs + Hardmock.restore_all_replaced_methods + end + +end + +require 'extend_test_unit' diff --git a/flex-bison/clcalc/tools/ceedling/vendor/hardmock/lib/hardmock/errors.rb b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/lib/hardmock/errors.rb new file mode 100644 index 0000000..48698a6 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/lib/hardmock/errors.rb @@ -0,0 +1,22 @@ +module Hardmock + # Raised when: + # * Unexpected method is called on a mock object + # * Bad arguments passed to an expected call + class ExpectationError < StandardError #:nodoc:# + end + + # Raised for methods that should no longer be called. Hopefully, the exception message contains helpful alternatives. + class DeprecationError < StandardError #:nodoc:# + end + + # Raised when stubbing fails + class StubbingError < StandardError #:nodoc:# + end + + # Raised when it is discovered that an expected method call was never made. + class VerifyError < StandardError #:nodoc:# + def initialize(msg,unmet_expectations) + super("#{msg}:" + unmet_expectations.map { |ex| "\n * #{ex.to_s}" }.join) + end + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/hardmock/lib/hardmock/expectation.rb b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/lib/hardmock/expectation.rb new file mode 100644 index 0000000..4d1db92 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/lib/hardmock/expectation.rb @@ -0,0 +1,229 @@ +require 'hardmock/utils' + +module Hardmock + class Expectation + include Utils + attr_reader :block_value + + def initialize(options) #:nodoc: + @options = options + end + + def apply_method_call(mock,mname,args,block) #:nodoc: + unless @options[:mock].equal?(mock) + raise anger("Wrong object", mock,mname,args) + end + unless @options[:method] == mname + raise anger("Wrong method",mock,mname,args) + end + + # Tester-defined block to invoke at method-call-time: + expectation_block = @options[:block] + + expected_args = @options[:arguments] + # if we have a block, we can skip the argument check if none were specified + unless (expected_args.nil? || expected_args.empty?) && expectation_block && !@options[:suppress_arguments_to_block] + unless expected_args == args + raise anger("Wrong arguments",mock,mname,args) + end + end + + relayed_args = args.dup + if block + if expectation_block.nil? + # Can't handle a runtime block without an expectation block + raise ExpectationError.new("Unexpected block provided to #{to_s}") + else + # Runtime blocks are passed as final argument to the expectation block + unless @options[:suppress_arguments_to_block] + relayed_args << block + else + # Arguments suppressed; send only the block + relayed_args = [block] + end + end + end + + # Run the expectation block: + @block_value = expectation_block.call(*relayed_args) if expectation_block + + raise @options[:raises] unless @options[:raises].nil? + + return_value = @options[:returns] + if return_value.nil? + return @block_value + else + return return_value + end + end + + # Set the return value for an expected method call. + # Eg, + # @cash_machine.expects.withdraw(20,:dollars).returns(20.00) + def returns(val) + @options[:returns] = val + self + end + alias_method :and_return, :returns + + # Set the arguments for an expected method call. + # Eg, + # @cash_machine.expects.deposit.with(20, "dollars").returns(:balance => "20") + def with(*args) + @options[:arguments] = args + self + end + + # Rig an expected method to raise an exception when the mock is invoked. + # + # Eg, + # @cash_machine.expects.withdraw(20,:dollars).raises "Insufficient funds" + # + # The argument can be: + # * an Exception -- will be used directly + # * a String -- will be used as the message for a RuntimeError + # * nothing -- RuntimeError.new("An Error") will be raised + def raises(err=nil) + case err + when Exception + @options[:raises] = err + when String + @options[:raises] = RuntimeError.new(err) + else + @options[:raises] = RuntimeError.new("An Error") + end + self + end + + # Convenience method: assumes +block_value+ is set, and is set to a Proc + # (or anything that responds to 'call') + # + # light_event = @traffic_light.trap.subscribe(:light_changes) + # + # # This code will meet the expectation: + # @traffic_light.subscribe :light_changes do |color| + # puts color + # end + # + # The color-handling block is now stored in light_event.block_value + # + # The block can be invoked like this: + # + # light_event.trigger :red + # + # See Mock#trap and Mock#expects for information on using expectation objects + # after they are set. + # + def trigger(*block_arguments) + unless block_value + raise ExpectationError.new("No block value is currently set for expectation #{to_s}") + end + unless block_value.respond_to?(:call) + raise ExpectationError.new("Can't apply trigger to #{block_value} for expectation #{to_s}") + end + block_value.call *block_arguments + end + + # Used when an expected method accepts a block at runtime. + # When the expected method is invoked, the block passed to + # that method will be invoked as well. + # + # NOTE: ExpectationError will be thrown upon running the expected method + # if the arguments you set up in +yields+ do not properly match up with + # the actual block that ends up getting passed. + # + # == Examples + # Single invocation: The block passed to +lock_down+ gets invoked + # once with no arguments: + # + # @safe_zone.expects.lock_down.yields + # + # # (works on code that looks like:) + # @safe_zone.lock_down do + # # ... this block invoked once + # end + # + # Multi-parameter blocks: The block passed to +each_item+ gets + # invoked twice, with :item1 the first time, and with + # :item2 the second time: + # + # @fruit_basket.expects.each_with_index.yields [:apple,1], [:orange,2] + # + # # (works on code that looks like:) + # @fruit_basket.each_with_index do |fruit,index| + # # ... this block invoked with fruit=:apple, index=1, + # # ... and then with fruit=:orange, index=2 + # end + # + # Arrays can be passed as arguments too... if the block + # takes a single argument and you want to pass a series of arrays into it, + # that will work as well: + # + # @list_provider.expects.each_list.yields [1,2,3], [4,5,6] + # + # # (works on code that looks like:) + # @list_provider.each_list do |list| + # # ... list is [1,2,3] the first time + # # ... list is [4,5,6] the second time + # end + # + # Return value: You can set the return value for the method that + # accepts the block like so: + # + # @cruncher.expects.do_things.yields(:bean1,:bean2).returns("The Results") + # + # Raising errors: You can set the raised exception for the method that + # accepts the block. NOTE: the error will be raised _after_ the block has + # been invoked. + # + # # :bean1 and :bean2 will be passed to the block, then an error is raised: + # @cruncher.expects.do_things.yields(:bean1,:bean2).raises("Too crunchy") + # + def yields(*items) + @options[:suppress_arguments_to_block] = true + if items.empty? + # Yield once + @options[:block] = lambda do |block| + if block.arity != 0 and block.arity != -1 + raise ExpectationError.new("The given block was expected to have no parameter count; instead, got #{block.arity} to <#{to_s}>") + end + block.call + end + else + # Yield one or more specific items + @options[:block] = lambda do |block| + items.each do |item| + if item.kind_of?(Array) + if block.arity == item.size + # Unfold the array into the block's arguments: + block.call *item + elsif block.arity == 1 + # Just pass the array in + block.call item + else + # Size mismatch + raise ExpectationError.new("Can't pass #{item.inspect} to block with arity #{block.arity} to <#{to_s}>") + end + else + if block.arity != 1 + # Size mismatch + raise ExpectationError.new("Can't pass #{item.inspect} to block with arity #{block.arity} to <#{to_s}>") + end + block.call item + end + end + end + end + self + end + + def to_s # :nodoc: + format_method_call_string(@options[:mock],@options[:method],@options[:arguments]) + end + + private + def anger(msg, mock,mname,args) + ExpectationError.new("#{msg}: expected call <#{to_s}> but was <#{format_method_call_string(mock,mname,args)}>") + end + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/hardmock/lib/hardmock/expectation_builder.rb b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/lib/hardmock/expectation_builder.rb new file mode 100644 index 0000000..7445fb1 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/lib/hardmock/expectation_builder.rb @@ -0,0 +1,9 @@ +require 'hardmock/expectation' + +module Hardmock + class ExpectationBuilder #:nodoc: + def build_expectation(options) + Expectation.new(options) + end + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/hardmock/lib/hardmock/expector.rb b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/lib/hardmock/expector.rb new file mode 100644 index 0000000..8055460 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/lib/hardmock/expector.rb @@ -0,0 +1,26 @@ +require 'hardmock/method_cleanout' +require 'hardmock/errors' + +module Hardmock + class Expector #:nodoc: + include MethodCleanout + + def initialize(mock,mock_control,expectation_builder) + @mock = mock + @mock_control = mock_control + @expectation_builder = expectation_builder + end + + def method_missing(mname, *args, &block) + expectation = @expectation_builder.build_expectation( + :mock => @mock, + :method => mname, + :arguments => args, + :block => block) + + @mock_control.add_expectation expectation + expectation + end + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/hardmock/lib/hardmock/method_cleanout.rb b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/lib/hardmock/method_cleanout.rb new file mode 100644 index 0000000..51797e6 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/lib/hardmock/method_cleanout.rb @@ -0,0 +1,33 @@ + +module Hardmock #:nodoc: + module MethodCleanout #:nodoc: + SACRED_METHODS = %w{ + __id__ + __send__ + equal? + object_id + send + nil? + class + kind_of? + respond_to? + inspect + method + to_s + instance_variables + instance_eval + == + hm_metaclass + hm_meta_eval + hm_meta_def + } + + def self.included(base) #:nodoc: + base.class_eval do + instance_methods.each do |m| + undef_method m unless SACRED_METHODS.include?(m.to_s) + end + end + end + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/hardmock/lib/hardmock/mock.rb b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/lib/hardmock/mock.rb new file mode 100644 index 0000000..928c432 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/lib/hardmock/mock.rb @@ -0,0 +1,180 @@ + +module Hardmock + # Mock is used to set expectations in your test. Most of the time you'll use + # #expects to create expectations. + # + # Aside from the scant few control methods (like +expects+, +trap+ and +_verify+) + # all calls made on a Mock instance will be immediately applied to the internal + # expectation mechanism. + # + # * If the method call was expected and all the parameters match properly, execution continues + # * If the expectation was configured with an expectation block, the block is invoked + # * If the expectation was set up to raise an error, the error is raised now + # * If the expectation was set up to return a value, it is returned + # * If the method call was _not_ expected, or the parameter values are wrong, an ExpectationError is raised. + class Mock + include Hardmock::MethodCleanout + + # Create a new Mock instance with a name and a MockControl to support it. + # If not given, a MockControl is made implicitly for this Mock alone; this means + # expectations for this mock are not tied to other expectations in your test. + # + # It's not recommended to use a Mock directly; see Hardmock and + # Hardmock#create_mocks for the more wholistic approach. + def initialize(name, mock_control=nil) + @name = name + @control = mock_control || MockControl.new + @expectation_builder = ExpectationBuilder.new + end + + def inspect + "" + end + + # Begin declaring an expectation for this Mock. + # + # == Simple Examples + # Expect the +customer+ to be queried for +account+, and return "The + # Account": + # @customer.expects.account.returns "The Account" + # + # Expect the +withdraw+ method to be called, and raise an exception when it + # is (see Expectation#raises for more info): + # @cash_machine.expects.withdraw(20,:dollars).raises("not enough money") + # + # Expect +customer+ to have its +user_name+ set + # @customer.expects.user_name = 'Big Boss' + # + # Expect +customer+ to have its +user_name+ set, and raise a RuntimeException when + # that happens: + # @customer.expects('user_name=', "Big Boss").raises "lost connection" + # + # Expect +evaluate+ to be passed a block, and when that happens, pass a value + # to the block (see Expectation#yields for more info): + # @cruncher.expects.evaluate.yields("some data").returns("some results") + # + # + # == Expectation Blocks + # To do special handling of expected method calls when they occur, you + # may pass a block to your expectation, like: + # @page_scraper.expects.handle_content do |address,request,status| + # assert_not_nil address, "Can't abide nil addresses" + # assert_equal "http-get", request.method, "Can only handle GET" + # assert status > 200 and status < 300, status, "Failed status" + # "Simulated results #{request.content.downcase}" + # end + # In this example, when page_scraper.handle_content is called, its + # three arguments are passed to the expectation block and evaluated + # using the above assertions. The last value in the block will be used + # as the return value for +handle_content+ + # + # You may specify arguments to the expected method call, just like any normal + # expectation, and those arguments will be pre-validated before being passed + # to the expectation block. This is useful when you know all of the + # expected values but still need to do something programmatic. + # + # If the method being invoked on the mock accepts a block, that block will be + # passed to your expectation block as the last (or only) argument. Eg, the + # convenience method +yields+ can be replaced with the more explicit: + # @cruncher.expects.evaluate do |block| + # block.call "some data" + # "some results" + # end + # + # The result value of the expectation block becomes the return value for the + # expected method call. This can be overidden by using the +returns+ method: + # @cruncher.expects.evaluate do |block| + # block.call "some data" + # "some results" + # end.returns("the actual value") + # + # Additionally, the resulting value of the expectation block is stored + # in the +block_value+ field on the expectation. If you've saved a reference + # to your expectation, you may retrieve the block value once the expectation + # has been met. + # + # evaluation_event = @cruncher.expects.evaluate do |block| + # block.call "some data" + # "some results" + # end.returns("the actual value") + # + # result = @cruncher.evaluate do |input| + # puts input # => 'some data' + # end + # # result is 'the actual value' + # + # evaluation_event.block_value # => 'some results' + # + def expects(*args, &block) + expector = Expector.new(self,@control,@expectation_builder) + # If there are no args, we return the Expector + return expector if args.empty? + # If there ARE args, we set up the expectation right here and return it + expector.send(args.shift.to_sym, *args, &block) + end + alias_method :expect, :expects + alias_method :should_receive, :expects + + # Special-case convenience: #trap sets up an expectation for a method + # that will take a block. That block, when sent to the expected method, will + # be trapped and stored in the expectation's +block_value+ field. + # The Expectation#trigger method may then be used to invoke that block. + # + # Like +expects+, the +trap+ mechanism can be followed by +raises+ or +returns+. + # + # _Unlike_ +expects+, you may not use an expectation block with +trap+. If + # the expected method takes arguments in addition to the block, they must + # be specified in the arguments to the +trap+ call itself. + # + # == Example + # + # create_mocks :address_book, :editor_form + # + # # Expect a subscription on the :person_added event for @address_book: + # person_event = @address_book.trap.subscribe(:person_added) + # + # # The runtime code would look like: + # @address_book.subscribe :person_added do |person_name| + # @editor_form.name = person_name + # end + # + # # At this point, the expectation for 'subscribe' is met and the + # # block has been captured. But we're not done: + # @editor_form.expects.name = "David" + # + # # Now invoke the block we trapped earlier: + # person_event.trigger "David" + # + # verify_mocks + def trap(*args) + Trapper.new(self,@control,ExpectationBuilder.new) + end + + def method_missing(mname,*args) #:nodoc: + block = nil + block = Proc.new if block_given? + @control.apply_method_call(self,mname,args,block) + end + + + def _control #:nodoc: + @control + end + + def _name #:nodoc: + @name + end + + # Verify that all expectations are fulfilled. NOTE: this method triggers + # validation on the _control_ for this mock, so all Mocks that share the + # MockControl with this instance will be included in the verification. + # + # Only use this method if you are managing your own Mocks and their controls. + # + # Normal usage of Hardmock doesn't require you to call this; let + # Hardmock#verify_mocks do it for you. + def _verify + @control.verify + end + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/hardmock/lib/hardmock/mock_control.rb b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/lib/hardmock/mock_control.rb new file mode 100644 index 0000000..302ebce --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/lib/hardmock/mock_control.rb @@ -0,0 +1,53 @@ +require 'hardmock/utils' + +module Hardmock + class MockControl #:nodoc: + include Utils + attr_accessor :name + + def initialize + clear_expectations + end + + def happy? + @expectations.empty? + end + + def disappointed? + @disappointed + end + + def add_expectation(expectation) +# puts "MockControl #{self.object_id.to_s(16)} adding expectation: #{expectation}" + @expectations << expectation + end + + def apply_method_call(mock,mname,args,block) + # Are we even expecting any sort of call? + if happy? + @disappointed = true + raise ExpectationError.new("Surprise call to #{format_method_call_string(mock,mname,args)}") + end + + begin + @expectations.shift.apply_method_call(mock,mname,args,block) + rescue Exception => ouch + @disappointed = true + raise ouch + end + end + + def verify +# puts "MockControl #{self.object_id.to_s(16)} verify: happy? #{happy?}" + @disappointed = !happy? + raise VerifyError.new("Unmet expectations", @expectations) unless happy? + end + + def clear_expectations + @expectations = [] + @disappointed = false + end + + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/hardmock/lib/hardmock/stubbing.rb b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/lib/hardmock/stubbing.rb new file mode 100644 index 0000000..0f8a293 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/lib/hardmock/stubbing.rb @@ -0,0 +1,210 @@ + + +# Stubbing support +# +# Stubs methods on classes and instances +# + +# Why's "metaid.rb" stuff crunched down: +class Object #:nodoc:# + def hm_metaclass #:nodoc:# + class << self + self + end + end + + def hm_meta_eval(&blk) #:nodoc:# + hm_metaclass.instance_eval(&blk) + end + + def hm_meta_def(name, &blk) #:nodoc:# + hm_meta_eval { define_method name, &blk } + end +end + + + +module Hardmock + + # == Hardmock: Stubbing and Mocking Concrete Methods + # + # Hardmock lets you stub and/or mock methods on concrete classes or objects. + # + # * To "stub" a concrete method is to rig it to return the same thing always, disregarding any arguments. + # * To "mock" a concrete method is to surplant its funcionality by delegating to a mock object who will cover this behavior. + # + # Mocked methods have their expectations considered along with all other mock object expectations. + # + # If you use stubbing or concrete mocking in the absence (or before creation) of other mocks, you need to invoke prepare_hardmock_control. + # Once verify_mocks or clear_expectaions is called, the overriden behavior in the target objects is restored. + # + # == Examples + # + # River.stubs!(:sounds_like).returns("gurgle") + # + # River.expects!(:jump).returns("splash") + # + # rogue.stubs!(:sounds_like).returns("pshshsh") + # + # rogue.expects!(:rawhide_tanning_solvents).returns("giant snapping turtles") + # + module Stubbing + # Exists only for documentation + end + + class ReplacedMethod #:nodoc:# + attr_reader :target, :method_name + + def initialize(target, method_name) + @target = target + @method_name = method_name + + Hardmock.track_replaced_method self + end + end + + class StubbedMethod < ReplacedMethod #:nodoc:# + def invoke(args) + raise @raises if @raises + @return_value + end + + def returns(stubbed_return) + @return_value = stubbed_return + end + + def raises(err) + err = RuntimeError.new(err) unless err.kind_of?(Exception) + @raises = err + end + end + + class ::Object + def stubs!(method_name) + method_name = method_name.to_s + already_stubbed = Hardmock.has_replaced_method?(self, method_name) + + stubbed_method = Hardmock::StubbedMethod.new(self, method_name) + + + unless _is_mock? or already_stubbed + if methods.include?(method_name.to_s) + hm_meta_eval do + alias_method "_hardmock_original_#{method_name}".to_sym, method_name.to_sym + end + end + end + + hm_meta_def method_name do |*args| + stubbed_method.invoke(args) + end + + stubbed_method + end + + def expects!(method_name, *args, &block) + if self._is_mock? + raise Hardmock::StubbingError, "Cannot use 'expects!(:#{method_name})' on a Mock object; try 'expects' instead" + end + + method_name = method_name.to_s + + @_my_mock = Mock.new(_my_name, $main_mock_control) if @_my_mock.nil? + + unless Hardmock.has_replaced_method?(self, method_name) + # Track the method as replaced + Hardmock::ReplacedMethod.new(self, method_name) + + # Preserver original implementation of the method by aliasing it away + if methods.include?(method_name) + hm_meta_eval do + alias_method "_hardmock_original_#{method_name}".to_sym, method_name.to_sym + end + end + + # Re-define the method to utilize our patron mock instance. + # (This global-temp-var thing is hokey but I was having difficulty generating + # code for the meta class.) + begin + $method_text_temp = %{ + def #{method_name}(*args,&block) + @_my_mock.__send__(:#{method_name}, *args, &block) + end + } + class << self + eval $method_text_temp + end + ensure + $method_text_temp = nil + end + end + + return @_my_mock.expects(method_name, *args, &block) + end + + def _is_mock? + self.kind_of?(Mock) + end + + def _my_name + self.kind_of?(Class) ? self.name : self.class.name + end + + def _clear_mock + @_my_mock = nil + end + + end + + class ::NilClass + # Use this only if you really mean it + alias_method :intentionally_stubs!, :stubs! + + # Use this only if you really mean it + alias_method :intentionally_expects!, :expects! + + # Overridden to protect against accidental nil reference self delusion + def stubs!(mname) + raise StubbingError, "Cannot stub #{mname} method on nil. (If you really mean to, try 'intentionally_stubs!')" + end + + # Overridden to protect against accidental nil reference self delusion + def expects!(mname, *args) + raise StubbingError, "Cannot mock #{mname} method on nil. (If you really mean to, try 'intentionally_expects!')" + end + end + + class << self + def track_replaced_method(replaced_method) + all_replaced_methods << replaced_method + end + + def all_replaced_methods + $all_replaced_methods ||= [] + end + + def has_replaced_method?(obj, method_name) + hits = all_replaced_methods.select do |replaced| + (replaced.target.object_id == obj.object_id) and (replaced.method_name.to_s == method_name.to_s) + end + return !hits.empty? + end + + def restore_all_replaced_methods + all_replaced_methods.each do |replaced| + unless replaced.target._is_mock? + backed_up = "_hardmock_original_#{replaced.method_name}" + if replaced.target.methods.include?(backed_up) + replaced.target.hm_meta_eval do + alias_method replaced.method_name.to_sym, backed_up.to_sym + end + end + replaced.target._clear_mock + end + end + all_replaced_methods.clear + end + end + +end + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/hardmock/lib/hardmock/trapper.rb b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/lib/hardmock/trapper.rb new file mode 100644 index 0000000..6aab176 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/lib/hardmock/trapper.rb @@ -0,0 +1,31 @@ +require 'test/unit/assertions' +require 'hardmock/errors' + +module Hardmock + class Trapper #:nodoc: + include Hardmock::MethodCleanout + + def initialize(mock,mock_control,expectation_builder) + @mock = mock + @mock_control = mock_control + @expectation_builder = expectation_builder + end + + def method_missing(mname, *args) + if block_given? + raise ExpectationError.new("Don't pass blocks when using 'trap' (setting exepectations for '#{mname}')") + end + + the_block = lambda { |target_block| target_block } + expectation = @expectation_builder.build_expectation( + :mock => @mock, + :method => mname, + :arguments => args, + :suppress_arguments_to_block => true, + :block => the_block) + + @mock_control.add_expectation expectation + expectation + end + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/hardmock/lib/hardmock/utils.rb b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/lib/hardmock/utils.rb new file mode 100644 index 0000000..1740577 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/lib/hardmock/utils.rb @@ -0,0 +1,9 @@ + +module Hardmock + module Utils #:nodoc: + def format_method_call_string(mock,mname,args) + arg_string = args.map { |a| a.inspect }.join(', ') + call_text = "#{mock._name}.#{mname}(#{arg_string})" + end + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/hardmock/lib/test_unit_before_after.rb b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/lib/test_unit_before_after.rb new file mode 100644 index 0000000..0499e39 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/lib/test_unit_before_after.rb @@ -0,0 +1,169 @@ +require 'test/unit' +require 'test/unit/testcase' +require 'test/unit/assertions' + +module Test #:nodoc:# + module Unit #:nodoc:# + + # == TestCase Modifications + # + # Monkey-patch to provide a formal mechanism for appending actions to be executed after teardown. + # Use after_teardown to define one or more actions to be executed after teardown for ALL tests. + # + # COMING SOON? + # * (maybe?) Hooks for before_teardown, after_setup, on_error + # * (maybe?) Options for positional control, eg, after_teardown :before_other_actions + # * (maybe?) Provide tagging/filtering so action execution can be controlled specifically? + # + # == Usage + # + # Invoke TestCase.after_teardown with optional parameter, which will be invoked with a reference + # to the test instance that has just been torn down. + # + # Example: + # + # Test::Unit::TestCase.after_teardown do |test| + # test.verify_mocks + # end + # + # == Justification + # + # There are a number of tools and libraries that play fast-n-loose with setup and teardown by + # wrapping them, and by overriding method_added as a means of upholding special setup/teardown + # behavior, usually by re-wrapping newly defined user-level setup/teardown methods. + # mocha and active_record/fixtures (and previously, hardmock) will fight for this + # territory with often unpredictable results. + # + # We wouldn't have to battle if Test::Unit provided a formal pre- and post- hook mechanism. + # + class TestCase + + class << self + + # Define an action to be run after teardown. Subsequent calls result in + # multiple actions. The block will be given a reference to the test + # being executed. + # + # Example: + # + # Test::Unit::TestCase.after_teardown do |test| + # test.verify_mocks + # end + def after_teardown(&block) + post_teardown_actions << block + end + + # Used internally. Access the list of post teardown actions for to be + # used by all tests. + def post_teardown_actions + @@post_teardown_actions ||= [] + end + + # Define an action to be run before setup. Subsequent calls result in + # multiple actions, EACH BEING PREPENDED TO THE PREVIOUS. + # The block will be given a reference to the test being executed. + # + # Example: + # + # Test::Unit::TestCase.before_setup do |test| + # test.prepare_hardmock_control + # end + def before_setup(&block) + pre_setup_actions.unshift block + end + + # Used internally. Access the list of post teardown actions for to be + # used by all tests. + def pre_setup_actions + @@pre_setup_actions ||= [] + end + end + + # OVERRIDE: This is a reimplementation of the default "run", updated to + # execute actions after teardown. + def run(result) + yield(STARTED, name) + @_result = result + begin + execute_pre_setup_actions(self) + setup + __send__(@method_name) + rescue Test::Unit::AssertionFailedError => e + add_failure(e.message, auxiliary_backtrace_filter(e.backtrace)) + rescue Exception + raise if should_passthru_exception($!) # See implementation; this is for pre-1.8.6 compat + add_error($!) + ensure + begin + teardown + rescue Test::Unit::AssertionFailedError => e + add_failure(e.message, auxiliary_backtrace_filter(e.backtrace)) + rescue Exception + raise if should_passthru_exception($!) # See implementation; this is for pre-1.8.6 compat + add_error($!) + ensure + execute_post_teardown_actions(self) + end + end + result.add_run + yield(FINISHED, name) + end + + private + + # Run through the after_teardown actions, treating failures and errors + # in the same way that "run" does: they are reported, and the remaining + # actions are executed. + def execute_post_teardown_actions(test_instance) + self.class.post_teardown_actions.each do |action| + begin + action.call test_instance + rescue Test::Unit::AssertionFailedError => e + add_failure(e.message, auxiliary_backtrace_filter(e.backtrace)) + rescue Exception + raise if should_passthru_exception($!) + add_error($!) + end + end + end + + # Run through the before_setup actions. + # Failures or errors cause execution to stop. + def execute_pre_setup_actions(test_instance) + self.class.pre_setup_actions.each do |action| +# begin + action.call test_instance +# rescue Test::Unit::AssertionFailedError => e +# add_failure(e.message, auxiliary_backtrace_filter(e.backtrace)) +# rescue Exception +# raise if should_passthru_exception($!) +# add_error($!) +# end + end + end + + # Make sure that this extension doesn't show up in failure backtraces + def auxiliary_backtrace_filter(trace) + trace.reject { |x| x =~ /test_unit_before_after/ } + end + + # Is the given error of the type that we allow to fly out (rather than catching it)? + def should_passthru_exception(ex) + return passthrough_exception_types.include?($!.class) + end + + # Provide a list of exception types that are to be allowed to explode out. + # Pre-ruby-1.8.6 doesn't use this functionality, so the PASSTHROUGH_EXCEPTIONS + # constant won't be defined. This methods defends against that and returns + # an empty list instead. + def passthrough_exception_types + begin + return PASSTHROUGH_EXCEPTIONS + rescue NameError + # older versions of test/unit do not have PASSTHROUGH_EXCEPTIONS constant + return [] + end + end + end + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/hardmock/rake_tasks/rdoc.rake b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/rake_tasks/rdoc.rake new file mode 100644 index 0000000..6a6d79f --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/rake_tasks/rdoc.rake @@ -0,0 +1,19 @@ +require 'rake/rdoctask' +require File.expand_path(File.dirname(__FILE__) + "/rdoc_options.rb") + +namespace :doc do + + desc "Generate RDoc documentation" + Rake::RDocTask.new { |rdoc| + rdoc.rdoc_dir = 'doc' + rdoc.title = "Hardmock: Strict expectation-based mock object library " + add_rdoc_options(rdoc.options) + rdoc.rdoc_files.include('lib/**/*.rb', 'README','CHANGES','LICENSE') + } + + task :show => [ 'doc:rerdoc' ] do + sh "open doc/index.html" + end + +end + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/hardmock/rake_tasks/rdoc_options.rb b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/rake_tasks/rdoc_options.rb new file mode 100644 index 0000000..85bf4ce --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/rake_tasks/rdoc_options.rb @@ -0,0 +1,4 @@ + +def add_rdoc_options(options) + options << '--line-numbers' << '--inline-source' << '--main' << 'README' << '--title' << 'Hardmock' +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/hardmock/rake_tasks/test.rake b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/rake_tasks/test.rake new file mode 100644 index 0000000..85a3753 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/rake_tasks/test.rake @@ -0,0 +1,22 @@ +require 'rake/testtask' + +namespace :test do + + desc "Run unit tests" + Rake::TestTask.new("units") { |t| + t.libs << "test" + t.pattern = 'test/unit/*_test.rb' + t.verbose = true + } + + desc "Run functional tests" + Rake::TestTask.new("functional") { |t| + t.libs << "test" + t.pattern = 'test/functional/*_test.rb' + t.verbose = true + } + + desc "Run all the tests" + task :all => [ 'test:units', 'test:functional' ] + +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/hardmock/test/functional/assert_error_test.rb b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/test/functional/assert_error_test.rb new file mode 100644 index 0000000..e4b35cf --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/test/functional/assert_error_test.rb @@ -0,0 +1,52 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'assert_error' + +class AssertErrorTest < Test::Unit::TestCase + + it "specfies an error type and message that should be raised" do + assert_error RuntimeError, "Too funky" do + raise RuntimeError.new("Too funky") + end + end + + it "flunks if the error message is wrong" do + err = assert_raise Test::Unit::AssertionFailedError do + assert_error RuntimeError, "not good" do + raise RuntimeError.new("Too funky") + end + end + assert_match(/not good/i, err.message) + assert_match(/too funky/i, err.message) + end + + it "flunks if the error type is wrong" do + err = assert_raise Test::Unit::AssertionFailedError do + assert_error StandardError, "Too funky" do + raise RuntimeError.new("Too funky") + end + end + assert_match(/StandardError/i, err.message) + assert_match(/RuntimeError/i, err.message) + end + + it "can match error message text using a series of Regexps" do + assert_error StandardError, /too/i, /funky/i do + raise StandardError.new("Too funky") + end + end + + it "flunks if the error message doesn't match all the Regexps" do + err = assert_raise Test::Unit::AssertionFailedError do + assert_error StandardError, /way/i, /too/i, /funky/i do + raise StandardError.new("Too funky") + end + end + assert_match(/way/i, err.message) + end + + it "can operate without any message specification" do + assert_error StandardError do + raise StandardError.new("ooof") + end + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/hardmock/test/functional/auto_verify_test.rb b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/test/functional/auto_verify_test.rb new file mode 100644 index 0000000..1b005bd --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/test/functional/auto_verify_test.rb @@ -0,0 +1,178 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'fileutils' + +class AutoVerifyTest < Test::Unit::TestCase + + def setup + @expect_unmet_expectations = true + end + + def teardown + remove_temp_test_file + end + + # + # TESTS + # + + it "auto-verifies all mocks in teardown" do + write_and_execute_test + end + + it "auto-verifies even if user defines own teardown" do + @teardown_code =<<-EOM + def teardown + # just in the way + end + EOM + write_and_execute_test + end + + should "not obscure normal failures when verification fails" do + @test_code =<<-EOM + def test_setup_doomed_expectation + create_mock :automobile + @automobile.expects.start + flunk "natural failure" + end + EOM + @expect_failures = 1 + write_and_execute_test + end + + should "not skip user-defined teardown when verification fails" do + @teardown_code =<<-EOM + def teardown + puts "User teardown" + end + EOM + write_and_execute_test + assert_output_contains(/User teardown/) + end + + it "is quiet when verification is ok" do + @test_code =<<-EOM + def test_ok + create_mock :automobile + @automobile.expects.start + @automobile.start + end + EOM + @teardown_code =<<-EOM + def teardown + puts "User teardown" + end + EOM + @expect_unmet_expectations = false + @expect_failures = 0 + @expect_errors = 0 + write_and_execute_test + assert_output_contains(/User teardown/) + end + + should "auto-verify even if user teardown explodes" do + @teardown_code =<<-EOM + def teardown + raise "self destruct" + end + EOM + @expect_errors = 2 + write_and_execute_test + assert_output_contains(/self destruct/) + end + + it "plays nice with inherited teardown methods" do + @full_code ||=<<-EOTEST + require File.expand_path(File.dirname(__FILE__) + "/../test_helper") + require 'hardmock' + class Test::Unit::TestCase + def teardown + puts "Test helper teardown" + end + end + class DummyTest < Test::Unit::TestCase + def test_prepare_to_die + create_mock :automobile + @automobile.expects.start + end + end + EOTEST + write_and_execute_test + assert_output_contains(/Test helper teardown/) + end + + # + # HELPERS + # + + def temp_test_file + File.expand_path(File.dirname(__FILE__) + "/tear_down_verification_test.rb") + end + + def run_test(tbody) + File.open(temp_test_file,"w") { |f| f.print(tbody) } + @test_output = `ruby #{temp_test_file} 2>&1` + end + + def formatted_test_output + if @test_output + @test_output.split(/\n/).map { |line| "> #{line}" }.join("\n") + else + "(NO TEST OUTPUT!)" + end + end + + def remove_temp_test_file + FileUtils::rm_f temp_test_file + end + + def assert_results(h) + if @test_output !~ /#{h[:tests]} tests, [0-9]+ assertions, #{h[:failures]} failures, #{h[:errors]} errors/ + flunk "Test results didn't match #{h.inspect}:\n#{formatted_test_output}" + end + end + + def assert_output_contains(*patterns) + patterns.each do |pattern| + if @test_output !~ pattern + flunk "Test output didn't match #{pattern.inspect}:\n#{formatted_test_output}" + end + end + end + + def assert_output_doesnt_contain(*patterns) + patterns.each do |pattern| + assert @test_output !~ pattern, "Output shouldn't match #{pattern.inspect} but it does." + end + end + + def write_and_execute_test + @test_code ||=<<-EOM + def test_setup_doomed_expectation + create_mock :automobile + @automobile.expects.start + end + EOM + @full_code ||=<<-EOTEST + require File.expand_path(File.dirname(__FILE__) + "/../test_helper") + require 'hardmock' + class DummyTest < Test::Unit::TestCase + #{@teardown_code} + #{@test_code} + end + EOTEST + run_test @full_code + + if @expect_unmet_expectations + assert_output_contains(/unmet expectations/i, /automobile/, /start/) + else + assert_output_doesnt_contain(/unmet expectations/i, /automobile/, /start/) + end + + @expect_tests ||= 1 + @expect_failures ||= 0 + @expect_errors ||= 1 + assert_results :tests => @expect_tests, :failures => @expect_failures, :errors => @expect_errors + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/hardmock/test/functional/direct_mock_usage_test.rb b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/test/functional/direct_mock_usage_test.rb new file mode 100644 index 0000000..dcf2b2a --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/test/functional/direct_mock_usage_test.rb @@ -0,0 +1,396 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock' + +class DirectMockUsageTest < Test::Unit::TestCase + + def setup + @bird = Mock.new('bird') + end + + def teardown + end + + # + # TESTS + # + + it "raises VerifyError if expected method not called" do + @bird.expects.flap_flap + + err = assert_raise VerifyError do + @bird._verify + end + assert_match(/unmet expectations/i, err.message) + end + + should "not raise when expected calls are made in order" do + @bird.expects.flap_flap + @bird.expects.bang + @bird.expects.plop + + @bird.flap_flap + @bird.bang + @bird.plop + + @bird._verify + end + + it "raises ExpectationError when unexpected method are called" do + @bird.expects.flap_flap + + err = assert_raise ExpectationError do + @bird.shoot + end + assert_match(/wrong method/i, err.message) + end + + it "raises ExpectationError on bad arguments" do + @bird.expects.flap_flap(:swoosh) + + err = assert_raise ExpectationError do + @bird.flap_flap(:rip) + end + assert_match(/wrong arguments/i, err.message) + end + + it "raises VerifyError when not all expected methods are called" do + @bird.expects.flap_flap + @bird.expects.bang + @bird.expects.plop + + @bird.flap_flap + + err = assert_raise VerifyError do + @bird._verify + end + assert_match(/unmet expectations/i, err.message) + end + + it "raises ExpectationError when calls are made out of order" do + @bird.expects.flap_flap + @bird.expects.bang + @bird.expects.plop + + @bird.flap_flap + err = assert_raise ExpectationError do + @bird.plop + end + assert_match(/wrong method/i, err.message) + end + + it "returns the configured value" do + @bird.expects.plop.returns(':P') + assert_equal ':P', @bird.plop + @bird._verify + + @bird.expects.plop.returns(':x') + assert_equal ':x', @bird.plop + @bird._verify + end + + it "returns nil when no return is specified" do + @bird.expects.plop + assert_nil @bird.plop + @bird._verify + end + + it "raises the configured exception" do + err = RuntimeError.new('shaq') + @bird.expects.plop.raises(err) + actual_err = assert_raise RuntimeError do + @bird.plop + end + assert_same err, actual_err, 'should be the same error' + @bird._verify + end + + it "raises a RuntimeError when told to 'raise' a string" do + @bird.expects.plop.raises('shaq') + err = assert_raise RuntimeError do + @bird.plop + end + assert_match(/shaq/i, err.message) + @bird._verify + end + + it "raises a default RuntimeError" do + @bird.expects.plop.raises + err = assert_raise RuntimeError do + @bird.plop + end + assert_match(/error/i, err.message) + @bird._verify + end + + it "is quiet when correct arguments given" do + thing = Object.new + @bird.expects.plop(:big,'one',thing) + @bird.plop(:big,'one',thing) + @bird._verify + end + + it "raises ExpectationError when wrong number of arguments specified" do + thing = Object.new + @bird.expects.plop(:big,'one',thing) + err = assert_raise ExpectationError do + # more + @bird.plop(:big,'one',thing,:other) + end + assert_match(/wrong arguments/i, err.message) + @bird._verify + + @bird.expects.plop(:big,'one',thing) + err = assert_raise ExpectationError do + # less + @bird.plop(:big,'one') + end + assert_match(/wrong arguments/i, err.message) + @bird._verify + + @bird.expects.plop + err = assert_raise ExpectationError do + # less + @bird.plop(:big) + end + assert_match(/wrong arguments/i, err.message) + @bird._verify + end + + it "raises ExpectationError when arguments don't match" do + thing = Object.new + @bird.expects.plop(:big,'one',thing) + err = assert_raise ExpectationError do + @bird.plop(:big,'two',thing,:other) + end + assert_match(/wrong arguments/i, err.message) + @bird._verify + end + + it "can use a block for custom reactions" do + mitt = nil + @bird.expects.plop { mitt = :ball } + assert_nil mitt + @bird.plop + assert_equal :ball, mitt, 'didnt catch the ball' + @bird._verify + + @bird.expects.plop { raise 'ball' } + err = assert_raise RuntimeError do + @bird.plop + end + assert_match(/ball/i, err.message) + @bird._verify + end + + it "passes mock-call arguments to the expectation block" do + ball = nil + mitt = nil + @bird.expects.plop {|arg1,arg2| + ball = arg1 + mitt = arg2 + } + assert_nil ball + assert_nil mitt + @bird.plop(:ball,:mitt) + assert_equal :ball, ball + assert_equal :mitt, mitt + @bird._verify + end + + it "validates arguments if specified in addition to a block" do + ball = nil + mitt = nil + @bird.expects.plop(:ball,:mitt) {|arg1,arg2| + ball = arg1 + mitt = arg2 + } + assert_nil ball + assert_nil mitt + @bird.plop(:ball,:mitt) + assert_equal :ball, ball + assert_equal :mitt, mitt + @bird._verify + + ball = nil + mitt = nil + @bird.expects.plop(:bad,:stupid) {|arg1,arg2| + ball = arg1 + mitt = arg2 + } + assert_nil ball + assert_nil mitt + err = assert_raise ExpectationError do + @bird.plop(:ball,:mitt) + end + assert_match(/wrong arguments/i, err.message) + assert_nil ball + assert_nil mitt + @bird._verify + + ball = nil + mitt = nil + @bird.expects.plop(:ball,:mitt) {|arg1,arg2| + ball = arg1 + mitt = arg2 + } + assert_nil ball + assert_nil mitt + err = assert_raise ExpectationError do + @bird.plop(:ball) + end + assert_match(/wrong arguments/i, err.message) + assert_nil ball + assert_nil mitt + @bird._verify + end + + it "passes runtime blocks to the expectation block as the final argument" do + runtime_block_called = false + got_arg = nil + + # Eg, bird expects someone to subscribe to :tweet using the 'when' method + @bird.expects.when(:tweet) { |arg1, block| + got_arg = arg1 + block.call + } + + @bird.when(:tweet) do + runtime_block_called = true + end + + assert_equal :tweet, got_arg, "Wrong arg" + assert runtime_block_called, "The runtime block should have been invoked by the user block" + + @bird.expects.when(:warnk) { |e,blk| } + + err = assert_raise ExpectationError do + @bird.when(:honk) { } + end + assert_match(/wrong arguments/i, err.message) + + @bird._verify + end + + it "passes the runtime block to the expectation block as sole argument if no other args come into play" do + runtime_block_called = false + @bird.expects.subscribe { |block| block.call } + @bird.subscribe do + runtime_block_called = true + end + assert runtime_block_called, "The runtime block should have been invoked by the user block" + end + + it "provides nil as final argument if expectation block seems to want a block" do + invoked = false + @bird.expects.kablam(:scatter) { |shot,block| + assert_equal :scatter, shot, "Wrong shot" + assert_nil block, "The expectation block should get a nil block when user neglects to pass one" + invoked = true + } + @bird.kablam :scatter + assert invoked, "Expectation block not invoked" + + @bird._verify + end + + it "can set explicit return after an expectation block" do + got = nil + @bird.expects.kablam(:scatter) { |shot| + got = shot + }.returns(:death) + + val = @bird.kablam :scatter + assert_equal :death, val, "Wrong return value" + assert_equal :scatter, got, "Wrong argument" + @bird._verify + end + + it "can raise after an expectation block" do + got = nil + @bird.expects.kablam(:scatter) do |shot| + got = shot + end.raises "hell" + + err = assert_raise RuntimeError do + @bird.kablam :scatter + end + assert_match(/hell/i, err.message) + + @bird._verify + end + + it "stores the semantic value of the expectation block after it executes" do + expectation = @bird.expects.kablam(:slug) { |shot| + "The shot was #{shot}" + } + + assert_not_nil expectation, "Expectation nil" + assert_nil expectation.block_value, "Block value should start out nil" + + ret_val = @bird.kablam :slug + + assert_equal "The shot was slug", expectation.block_value + assert_equal "The shot was slug", ret_val, "Block value should also be used for return" + + @bird._verify + end + + + it "uses the value of the expectation block as the default return value" do + @bird.expects.kablam(:scatter) { |shot| + "The shot was #{shot}" + } + val = @bird.kablam :scatter + assert_equal "The shot was scatter", val, "Wrong return value" + @bird._verify + end + + it "returns the Expectation even if 'returns' is used" do + expectation = @bird.expects.kablam(:slug) { |shot| + "The shot was #{shot}" + }.returns :hosed + + assert_not_nil expectation, "Expectation nil" + assert_nil expectation.block_value, "Block value should start out nil" + + ret_val = @bird.kablam :slug + + assert_equal "The shot was slug", expectation.block_value + assert_equal :hosed, ret_val, "Block value should also be used for return" + + @bird._verify + end + + it "returns the Expectation even if 'raises' is used" do + expectation = @bird.expects.kablam(:slug) { |shot| + "The shot was #{shot}" + }.raises "aiee!" + + assert_not_nil expectation, "Expectation nil" + assert_nil expectation.block_value, "Block value should start out nil" + + err = assert_raise RuntimeError do + @bird.kablam :slug + end + assert_match(/aiee!/i, err.message) + assert_equal "The shot was slug", expectation.block_value + @bird._verify + end + + + it "supports assignment-style methods" do + @bird.expects.size = "large" + @bird.size = "large" + @bird._verify + end + + it "supports assignments and raising (using explicit-method syntax)" do + @bird.expects('size=','large').raises "boom" + + err = assert_raise RuntimeError do + @bird.size = "large" + end + assert_match(/boom/i, err.message) + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/hardmock/test/functional/hardmock_test.rb b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/test/functional/hardmock_test.rb new file mode 100644 index 0000000..159d369 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/test/functional/hardmock_test.rb @@ -0,0 +1,434 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock' +require 'assert_error' + +class HardmockTest < Test::Unit::TestCase + + # + # TESTS + # + + it "conveniently creates mocks using create_mock and create_mocks" do + + h = create_mock :donkey + assert_equal [ :donkey ], h.keys + + assert_mock_exists :donkey + assert_same @donkey, h[:donkey] + + assert_equal [ :donkey ], @all_mocks.keys, "Wrong keyset for @all_mocks" + + h2 = create_mocks :cat, 'dog' # symbol/string indifference at this level + assert_equal [:cat,:dog].to_set, h2.keys.to_set, "Wrong keyset for second hash" + assert_equal [:cat,:dog,:donkey].to_set, @all_mocks.keys.to_set, "@all_mocks wrong" + + assert_mock_exists :cat + assert_same @cat, h2[:cat] + assert_mock_exists :dog + assert_same @dog, h2[:dog] + + assert_mock_exists :donkey + end + + it "provides literal 'expects' syntax" do + assert_nil @order, "Should be no @order yet" + create_mock :order + assert_not_nil @order, "@order should be built" + + # Setup an expectation + @order.expects.update_stuff :key1 => 'val1', :key2 => 'val2' + + # Use the mock + @order.update_stuff :key1 => 'val1', :key2 => 'val2' + + # Verify + verify_mocks + + # See that it's ok to do it again + verify_mocks + end + + it "supports 'with' for specifying argument expectations" do + create_mocks :car + @car.expects(:fill).with('gas','booze') + @car.fill('gas', 'booze') + verify_mocks + end + + it "supports several mocks at once" do + create_mocks :order_builder, :order, :customer + + @order_builder.expects.create_new_order.returns @order + @customer.expects.account_number.returns(1234) + @order.expects.account_no = 1234 + @order.expects.save! + + # Run "the code" + o = @order_builder.create_new_order + o.account_no = @customer.account_number + o.save! + + verify_mocks + end + + it "enforces inter-mock call ordering" do + create_mocks :order_builder, :order, :customer + + @order_builder.expects.create_new_order.returns @order + @customer.expects.account_number.returns(1234) + @order.expects.account_no = 1234 + @order.expects.save! + + # Run "the code" + o = @order_builder.create_new_order + err = assert_raise ExpectationError do + o.save! + end + assert_match(/wrong object/i, err.message) + assert_match(/order.save!/i, err.message) + assert_match(/customer.account_number/i, err.message) + + assert_error VerifyError, /unmet expectations/i do + verify_mocks + end + end + + class UserPresenter + def initialize(args) + view = args[:view] + model = args[:model] + model.when :data_changes do + view.user_name = model.user_name + end + view.when :user_edited do + model.user_name = view.user_name + end + end + end + + it "makes MVP testing simple" do + mox = create_mocks :model, :view + + data_change = @model.expects.when(:data_changes) { |evt,block| block } + user_edit = @view.expects.when(:user_edited) { |evt,block| block } + + UserPresenter.new mox + + # Expect user name transfer from model to view + @model.expects.user_name.returns 'Da Croz' + @view.expects.user_name = 'Da Croz' + # Trigger data change event in model + data_change.block_value.call + + # Expect user name transfer from view to model + @view.expects.user_name.returns '6:8' + @model.expects.user_name = '6:8' + # Trigger edit event in view + user_edit.block_value.call + + verify_mocks + end + + it "continues to function after verify, if verification error is controlled" do + mox = create_mocks :model, :view + data_change = @model.expects.when(:data_changes) { |evt,block| block } + user_edit = @view.expects.when(:user_edited) { |evt,block| block } + UserPresenter.new mox + + # Expect user name transfer from model to view + @model.expects.user_name.returns 'Da Croz' + @view.expects.user_name = 'Da Croz' + + assert_error ExpectationError, /model.monkey_wrench/i do + @model.monkey_wrench + end + + # This should raise because of unmet expectations + assert_error VerifyError, /unmet expectations/i, /user_name/i do + verify_mocks + end + + # See that the non-forced verification remains quiet + assert_nothing_raised VerifyError do + verify_mocks(false) + end + + @model.expects.never_gonna_happen + + assert_error VerifyError, /unmet expectations/i, /never_gonna_happen/i do + verify_mocks + end + end + + class UserPresenterBroken + def initialize(args) + view = args[:view] + model = args[:model] + model.when :data_changes do + view.user_name = model.user_name + end + # no view stuff, will break appropriately + end + end + + it "flunks for typical Presenter constructor wiring failure" do + mox = create_mocks :model, :view + + data_change = @model.expects.when(:data_changes) { |evt,block| block } + user_edit = @view.expects.when(:user_edited) { |evt,block| block } + + UserPresenterBroken.new mox + + err = assert_raise VerifyError do + verify_mocks + end + assert_match(/unmet expectations/i, err.message) + assert_match(/view.when\(:user_edited\)/i, err.message) + + end + + it "provides convenient event-subscription trap syntax for MVP testing" do + mox = create_mocks :model, :view + + data_change = @model.trap.when(:data_changes) + user_edit = @view.trap.when(:user_edited) + + UserPresenter.new mox + + # Expect user name transfer from model to view + @model.expects.user_name.returns 'Da Croz' + @view.expects.user_name = 'Da Croz' + # Trigger data change event in model + data_change.trigger + + # Expect user name transfer from view to model + @view.expects.user_name.returns '6:8' + @model.expects.user_name = '6:8' + # Trigger edit event in view + user_edit.trigger + + verify_mocks + end + + it "raises if you try to pass an expectation block to 'trap'" do + create_mock :model + assert_error Hardmock::ExpectationError, /blocks/i, /trap/i do + @model.trap.when(:some_event) do raise "huh?" end + end + end + + class Grinder + def initialize(objects) + @chute = objects[:chute] + @bucket = objects[:bucket] + @blade = objects[:blade] + end + + def grind(slot) + @chute.each_bean(slot) do |bean| + @bucket << @blade.chop(bean) + end + end + end + + it "lets you write clear iteration-oriented expectations" do + grinder = Grinder.new create_mocks(:blade, :chute, :bucket) + + # Style 1: assertions on method args is done explicitly in block + @chute.expects.each_bean { |slot,block| + assert_equal :side_slot, slot, "Wrong slot" + block.call :bean1 + block.call :bean2 + } + + @blade.expects.chop(:bean1).returns(:grounds1) + @bucket.expects('<<', :grounds1) + + @blade.expects.chop(:bean2).returns(:grounds2) + @bucket.expects('<<', :grounds2) + + # Run "the code" + grinder.grind(:side_slot) + + verify_mocks + + # Style 2: assertions on method arguments done implicitly in the expectation code + @chute.expects.each_bean(:main_slot) { |slot,block| + block.call :bean3 + } + @blade.expects.chop(:bean3).returns(:grounds3) + @bucket.expects('<<', :grounds3) + grinder.grind :main_slot + verify_mocks + end + + it "further supports iteration testing using 'yield'" do + grinder = Grinder.new create_mocks(:blade, :chute, :bucket) + + @chute.expects.each_bean(:side_slot).yields :bean1, :bean2 + + @blade.expects.chop(:bean1).returns(:grounds1) + @bucket.expects('<<', :grounds1) + + @blade.expects.chop(:bean2).returns(:grounds2) + @bucket.expects('<<', :grounds2) + + grinder.grind :side_slot + + verify_mocks + end + + class HurtLocker + attr_reader :caught + def initialize(opts) + @locker = opts[:locker] + @store = opts[:store] + end + + def do_the_thing(area,data) + @locker.with_lock(area) do + @store.eat(data) + end + rescue => oops + @caught = oops + end + end + + it "makes mutex-style locking scenarios easy to test" do + hurt = HurtLocker.new create_mocks(:locker, :store) + + @locker.expects.with_lock(:main).yields + @store.expects.eat("some info") + + hurt.do_the_thing(:main, "some info") + + verify_mocks + end + + it "makes it easy to simulate error in mutex-style locking scenarios" do + hurt = HurtLocker.new create_mocks(:locker, :store) + err = StandardError.new('fmshooop') + @locker.expects.with_lock(:main).yields + @store.expects.eat("some info").raises(err) + + hurt.do_the_thing(:main, "some info") + + assert_same err, hurt.caught, "Expected that error to be handled internally" + verify_mocks + end + + it "actually returns 'false' instead of nil when mocking boolean return values" do + create_mock :car + @car.expects.ignition_on?.returns(true) + assert_equal true, @car.ignition_on?, "Should be true" + @car.expects.ignition_on?.returns(false) + assert_equal false, @car.ignition_on?, "Should be false" + end + + it "can mock most methods inherited from object using literal syntax" do + target_methods = %w|id clone display dup eql? ==| + create_mock :foo + target_methods.each do |m| + eval %{@foo.expects(m, "some stuff")} + eval %{@foo.#{m} "some stuff"} + end + end + + it "provides 'expect' as an alias for 'expects'" do + create_mock :foo + @foo.expect.boomboom + @foo.boomboom + verify_mocks + end + + it "provides 'should_receive' as an alias for 'expects'" do + create_mock :foo + @foo.should_receive.boomboom + @foo.boomboom + verify_mocks + end + + it "provides 'and_return' as an alias for 'returns'" do + create_mock :foo + @foo.expects(:boomboom).and_return :brick + assert_equal :brick, @foo.boomboom + verify_mocks + end + + it "does not interfere with a core subset of Object methods" do + create_mock :foo + @foo.method(:inspect) + @foo.inspect + @foo.to_s + @foo.instance_variables + @foo.instance_eval("") + verify_mocks + end + + it "can raise errors from within an expectation block" do + create_mock :cat + @cat.expects.meow do |arg| + assert_equal "mix", arg + raise 'HAIRBALL' + end + assert_error RuntimeError, 'HAIRBALL' do + @cat.meow("mix") + end + end + + it "can raise errors AFTER an expectation block" do + create_mock :cat + @cat.expects.meow do |arg| + assert_equal "mix", arg + end.raises('HAIRBALL') + assert_error RuntimeError, 'HAIRBALL' do + @cat.meow("mix") + end + end + + it "raises an immediate error if a mock is created with a nil name (common mistake: create_mock @cat)" do + # I make this mistake all the time: Typing in an instance var name instead of a symbol in create_mocks. + # When you do that, you're effectively passing nil(s) in as mock names. + assert_error ArgumentError, /'nil' is not a valid name for a mock/ do + create_mocks @apples, @oranges + end + end + + it "overrides 'inspect' to make nice output" do + create_mock :hay_bailer + assert_equal "", @hay_bailer.inspect, "Wrong output from 'inspect'" + end + + it "raises if prepare_hardmock_control is invoked after create_mocks, or more than once" do + create_mock :hi_there + create_mocks :another, :one + assert_error RuntimeError, /already setup/ do + prepare_hardmock_control + end + end + + should "support alias verify_hardmocks" do + create_mock :tree + @tree.expects(:grow) + assert_error VerifyError, /unmet/i do + verify_hardmocks + end + end + + # + # HELPERS + # + + def assert_mock_exists(name) + assert_not_nil @all_mocks, "@all_mocks not here yet" + mo = @all_mocks[name] + assert_not_nil mo, "Mock '#{name}' not in @all_mocks" + assert_kind_of Mock, mo, "Wrong type of object, wanted a Mock" + assert_equal name.to_s, mo._name, "Mock '#{name}' had wrong name" + ivar = self.instance_variable_get("@#{name}") + assert_not_nil ivar, "Mock '#{name}' not set as ivar" + assert_same mo, ivar, "Mock '#{name}' ivar not same as instance in @all_mocks" + assert_same @main_mock_control, mo._control, "Mock '#{name}' doesn't share the main mock control" + end +end + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/hardmock/test/functional/stubbing_test.rb b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/test/functional/stubbing_test.rb new file mode 100644 index 0000000..f07a670 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/test/functional/stubbing_test.rb @@ -0,0 +1,479 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock' +require 'assert_error' + +class StubbingTest < Test::Unit::TestCase + + # + # TESTS + # + + it "stubs a class method (and un-stubs after reset_stubs)" do + assert_equal "stones and gravel", Concrete.pour + assert_equal "glug glug", Jug.pour + + Concrete.stubs!(:pour).returns("dust and plaster") + + 3.times do + assert_equal "dust and plaster", Concrete.pour + end + + assert_equal "glug glug", Jug.pour, "Jug's 'pour' method broken" + assert_equal "stones and gravel", Concrete._hardmock_original_pour, "Original 'pour' method not aliased" + + assert_equal "For roads", Concrete.describe, "'describe' method broken" + + reset_stubs + + assert_equal "stones and gravel", Concrete.pour, "'pour' method not restored" + assert_equal "For roads", Concrete.describe, "'describe' method broken after verify" + + end + + it "stubs several class methods" do + Concrete.stubs!(:pour).returns("sludge") + Concrete.stubs!(:describe).returns("awful") + Jug.stubs!(:pour).returns("milk") + + assert_equal "sludge", Concrete.pour + assert_equal "awful", Concrete.describe + assert_equal "milk", Jug.pour + + reset_stubs + + assert_equal "stones and gravel", Concrete.pour + assert_equal "For roads", Concrete.describe + assert_equal "glug glug", Jug.pour + end + + it "stubs instance methods" do + slab = Concrete.new + assert_equal "bonk", slab.hit + + slab.stubs!(:hit).returns("slap") + assert_equal "slap", slab.hit, "'hit' not stubbed" + + reset_stubs + + assert_equal "bonk", slab.hit, "'hit' not restored" + end + + it "stubs instance methods without breaking class methods or other instances" do + slab = Concrete.new + scrape = Concrete.new + assert_equal "an instance", slab.describe + assert_equal "an instance", scrape.describe + assert_equal "For roads", Concrete.describe + + slab.stubs!(:describe).returns("new instance describe") + assert_equal "new instance describe", slab.describe, "'describe' on instance not stubbed" + assert_equal "an instance", scrape.describe, "'describe' on 'scrape' instance broken" + assert_equal "For roads", Concrete.describe, "'describe' class method broken" + + reset_stubs + + assert_equal "an instance", slab.describe, "'describe' instance method not restored" + assert_equal "an instance", scrape.describe, "'describe' on 'scrape' instance broken after restore" + assert_equal "For roads", Concrete.describe, "'describe' class method broken after restore" + end + + should "allow stubbing of nonexistant class methods" do + Concrete.stubs!(:funky).returns('juice') + assert_equal 'juice', Concrete.funky + end + + should "allow stubbing of nonexistant instance methods" do + chunk = Concrete.new + chunk.stubs!(:shark).returns('bite') + assert_equal 'bite', chunk.shark + end + + should "allow re-stubbing" do + Concrete.stubs!(:pour).returns("one") + assert_equal "one", Concrete.pour + + Concrete.stubs!(:pour).raises("hell") + assert_error RuntimeError, /hell/ do + Concrete.pour + end + + Concrete.stubs!(:pour).returns("two") + assert_equal "two", Concrete.pour + + reset_stubs + + assert_equal "stones and gravel", Concrete.pour + end + + it "does nothing with a runtime block when simply stubbing" do + slab = Concrete.new + slab.stubs!(:hit) do |nothing| + raise "BOOOMM!" + end + slab.hit + reset_stubs + end + + it "can raise errors from a stubbed method" do + Concrete.stubs!(:pour).raises(StandardError.new("no!")) + assert_error StandardError, /no!/ do + Concrete.pour + end + end + + it "provides string syntax for convenient raising of RuntimeErrors" do + Concrete.stubs!(:pour).raises("never!") + assert_error RuntimeError, /never!/ do + Concrete.pour + end + end + + + # + # Per-method mocking on classes or instances + # + + it "mocks specific methods on existing classes, and returns the class method to normal after verification" do + + assert_equal "stones and gravel", Concrete.pour, "Concrete.pour is already messed up" + + Concrete.expects!(:pour).returns("ALIGATORS") + assert_equal "ALIGATORS", Concrete.pour + + verify_mocks + assert_equal "stones and gravel", Concrete.pour, "Concrete.pour not restored" + end + + it "flunks if expected class method is not invoked" do + + Concrete.expects!(:pour).returns("ALIGATORS") + assert_error(Hardmock::VerifyError, /Concrete.pour/, /unmet expectations/i) do + verify_mocks + end + clear_expectations + end + + it "supports all normal mock functionality for class methods" do + + Concrete.expects!(:pour, "two tons").returns("mice") + Concrete.expects!(:pour, "three tons").returns("cats") + Concrete.expects!(:pour, "four tons").raises("Can't do it") + Concrete.expects!(:pour) do |some, args| + "==#{some}+#{args}==" + end + + assert_equal "mice", Concrete.pour("two tons") + assert_equal "cats", Concrete.pour("three tons") + assert_error(RuntimeError, /Can't do it/) do + Concrete.pour("four tons") + end + assert_equal "==first+second==", Concrete.pour("first","second") + end + + + it "enforces inter-mock ordering when mocking class methods" do + create_mocks :truck, :foreman + + @truck.expects.backup + Concrete.expects!(:pour, "something") + @foreman.expects.shout + + @truck.backup + assert_error Hardmock::ExpectationError, /wrong/i, /expected call/i, /Concrete.pour/ do + @foreman.shout + end + assert_error Hardmock::VerifyError, /unmet expectations/i, /foreman.shout/ do + verify_mocks + end + clear_expectations + end + + should "allow mocking non-existant class methods" do + Concrete.expects!(:something).returns("else") + assert_equal "else", Concrete.something + end + + it "mocks specific methods on existing instances, then restore them after verify" do + + slab = Concrete.new + assert_equal "bonk", slab.hit + + slab.expects!(:hit).returns("slap") + assert_equal "slap", slab.hit, "'hit' not stubbed" + + verify_mocks + assert_equal "bonk", slab.hit, "'hit' not restored" + end + + it "flunks if expected instance method is not invoked" do + + slab = Concrete.new + slab.expects!(:hit) + + assert_error Hardmock::VerifyError, /unmet expectations/i, /Concrete.hit/ do + verify_mocks + end + clear_expectations + end + + it "supports all normal mock functionality for instance methods" do + + slab = Concrete.new + + slab.expects!(:hit, "soft").returns("hey") + slab.expects!(:hit, "hard").returns("OOF") + slab.expects!(:hit).raises("stoppit") + slab.expects!(:hit) do |some, args| + "==#{some}+#{args}==" + end + + assert_equal "hey", slab.hit("soft") + assert_equal "OOF", slab.hit("hard") + assert_error(RuntimeError, /stoppit/) do + slab.hit + end + assert_equal "==first+second==", slab.hit("first","second") + + end + + it "enforces inter-mock ordering when mocking instance methods" do + create_mocks :truck, :foreman + slab1 = Concrete.new + slab2 = Concrete.new + + @truck.expects.backup + slab1.expects!(:hit) + @foreman.expects.shout + slab2.expects!(:hit) + @foreman.expects.whatever + + @truck.backup + slab1.hit + @foreman.shout + assert_error Hardmock::ExpectationError, /wrong/i, /expected call/i, /Concrete.hit/ do + @foreman.whatever + end + assert_error Hardmock::VerifyError, /unmet expectations/i, /foreman.whatever/ do + verify_mocks + end + clear_expectations + end + + should "allow mocking non-existant instance methods" do + slab = Concrete.new + slab.expects!(:wholly).returns('happy') + assert_equal 'happy', slab.wholly + end + + should "support concrete expectations that deal with runtime blocks" do + + Concrete.expects!(:pour, "a lot") do |how_much, block| + assert_equal "a lot", how_much, "Wrong how_much arg" + assert_not_nil block, "nil runtime block" + assert_equal "the block value", block.call, "Wrong runtime block value" + end + + Concrete.pour("a lot") do + "the block value" + end + + end + + it "can stub methods on mock objects" do + create_mock :horse + @horse.stubs!(:speak).returns("silence") + @horse.stubs!(:hello).returns("nothing") + @horse.expects(:canter).returns("clip clop") + + assert_equal "silence", @horse.speak + assert_equal "clip clop", @horse.canter + assert_equal "silence", @horse.speak + assert_equal "silence", @horse.speak + assert_equal "nothing", @horse.hello + assert_equal "nothing", @horse.hello + + verify_mocks + reset_stubs + end + + it "can stub the new method and return values" do + Concrete.stubs!(:new).returns("this value") + assert_equal "this value", Concrete.new, "did not properly stub new class method" + reset_stubs + end + + it "can mock the new method and return values" do + Concrete.expects!(:new).with("foo").returns("hello") + Concrete.expects!(:new).with("bar").returns("world") + + assert_equal "hello", Concrete.new("foo"), "did not properly mock out new class method" + assert_equal "world", Concrete.new("bar"), "did not properly mock out new class method" + + verify_mocks + reset_stubs + end + + it "can mock several different class methods at once" do + sim_code = lambda do |input| + record = Multitool.find_record(input) + report = Multitool.generate_report(record) + Multitool.format_output(report) + end + + @identifier = "the id" + @record = "the record" + @report = "the report" + @output = "the output" + + Multitool.expects!(:find_record).with(@identifier).returns(@record) + Multitool.expects!(:generate_report).with(@record).returns(@report) + Multitool.expects!(:format_output).with(@report).returns(@output) + + result = sim_code.call(@identifier) + assert_equal @output, result, "Wrong output" + end + + it "can handle a mix of different and repeat class method mock calls" do + prep = lambda { + Multitool.expects!(:find_record).with("A").returns("1") + Multitool.expects!(:generate_report).with("1") + Multitool.expects!(:find_record).with("B").returns("2") + Multitool.expects!(:generate_report).with("2") + } + + prep[] + Multitool.generate_report(Multitool.find_record("A")) + Multitool.generate_report(Multitool.find_record("B")) + + prep[] + Multitool.generate_report(Multitool.find_record("A")) + assert_error Hardmock::ExpectationError, /Wrong arguments/, /find_record\("B"\)/, /find_record\("C"\)/ do + Multitool.generate_report(Multitool.find_record("C")) + end + clear_expectations + end + + it "can mock several concrete instance methods at once" do + inst = OtherMultitool.new + sim_code = lambda do |input| + record = inst.find_record(input) + report = inst.generate_report(record) + inst.format_output(report) + end + + @identifier = "the id" + @record = "the record" + @report = "the report" + @output = "the output" + + inst.expects!(:find_record).with(@identifier).returns(@record) + inst.expects!(:generate_report).with(@record).returns(@report) + inst.expects!(:format_output).with(@report).returns(@output) + + result = sim_code.call(@identifier) + assert_equal @output, result, "Wrong output" + end + + it "verifies all concrete expects! from several different expectations" do + Multitool.expects!(:find_record) + Multitool.expects!(:generate_report) + Multitool.expects!(:format_output) + + Multitool.find_record + Multitool.generate_report + + assert_error Hardmock::VerifyError, /unmet expectations/i, /format_output/i do + verify_mocks + end + end + + it "will not allow expects! to be used on a mock object" do + create_mock :cow + assert_error Hardmock::StubbingError, /expects!/, /mock/i, /something/ do + @cow.expects!(:something) + end + end + + it "does not allow stubbing on nil objects" do + [ nil, @this_is_nil ].each do |nil_obj| + assert_error Hardmock::StubbingError, /cannot/i, /nil/i, /intentionally/ do + nil_obj.stubs!(:wont_work) + end + end + end + + it "does not allow concrete method mocking on nil objects" do + [ nil, @this_is_nil ].each do |nil_obj| + assert_error Hardmock::StubbingError, /cannot/i, /nil/i, /intentionally/ do + nil_obj.expects!(:wont_work) + end + end + end + + it "provides an alternate method for stubbing on nil objects" do + @this_is_nil.intentionally_stubs!(:bogus).returns('output') + assert_equal 'output', @this_is_nil.bogus + end + + it "provides an alternate method for mocking concreate methods on nil objects" do + @this_is_nil.intentionally_expects!(:bogus).returns('output') + assert_error Hardmock::VerifyError, /unmet expectations/i, /NilClass.bogus/ do + verify_mocks + end + end + + # + # HELPERS + # + + class Concrete + def initialize; end + def self.pour + "stones and gravel" + end + + def self.describe + "For roads" + end + + def hit + "bonk" + end + + def describe + "an instance" + end + end + + class Jug + def self.pour + "glug glug" + end + end + + class Multitool + def self.find_record(*a) + raise "The real Multitool.find_record was called with #{a.inspect}" + end + def self.generate_report(*a) + raise "The real Multitool.generate_report was called with #{a.inspect}" + end + def self.format_output(*a) + raise "The real Multitool.format_output was called with #{a.inspect}" + end + end + + class OtherMultitool + def find_record(*a) + raise "The real OtherMultitool#find_record was called with #{a.inspect}" + end + def generate_report(*a) + raise "The real OtherMultitool#generate_report was called with #{a.inspect}" + end + def format_output(*a) + raise "The real OtherMultitool#format_output was called with #{a.inspect}" + end + end + +end + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/hardmock/test/test_helper.rb b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/test/test_helper.rb new file mode 100644 index 0000000..af159a4 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/test/test_helper.rb @@ -0,0 +1,43 @@ +here = File.expand_path(File.dirname(__FILE__)) +$: << here + +require "#{here}/../config/environment" +require 'test/unit' +require 'fileutils' +require 'logger' +require 'find' +require 'yaml' +require 'set' +require 'ostruct' + +class Test::Unit::TestCase + include FileUtils + + def poll(time_limit) + (time_limit * 10).to_i.times do + return true if yield + sleep 0.1 + end + return false + end + + def self.it(str, &block) + make_test_case "it", str, &block + end + + def self.should(str, &block) + make_test_case "should", str, &block + end + + def self.make_test_case(prefix, str, &block) + tname = self.name.sub(/Test$/,'') + if block + define_method "test #{prefix} #{str}" do + instance_eval &block + end + else + puts ">>> UNIMPLEMENTED CASE: #{tname}: #{str}" + end + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/hardmock/test/unit/expectation_builder_test.rb b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/test/unit/expectation_builder_test.rb new file mode 100644 index 0000000..f689f98 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/test/unit/expectation_builder_test.rb @@ -0,0 +1,19 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/expectation_builder' + +class ExpectationBuilderTest < Test::Unit::TestCase + include Hardmock + + def test_build_expectation + builder = ExpectationBuilder.new + + ex = builder.build_expectation( :stuff => 'inside' ) + assert_not_nil ex, "Didn't build an expectation" + assert_kind_of Expectation, ex, "Wrong type!" + + # Shhhh... fragile, yes, whatever. The functional tests do the + # real testing of this anyway + assert_equal({:stuff => 'inside'}, ex.instance_variable_get('@options'), "Hash not sent to SimpleExpectation constructor") + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/hardmock/test/unit/expectation_test.rb b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/test/unit/expectation_test.rb new file mode 100644 index 0000000..54bd204 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/test/unit/expectation_test.rb @@ -0,0 +1,372 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/expectation' +require 'hardmock/errors' +require 'assert_error' + +class ExpectationTest < Test::Unit::TestCase + include Hardmock + + def setup + @mock = TheMock.new + end + # + # HELPERS + # + + class TheMock + def _name; 'the_mock'; end + end + class OtherMock + def _name; 'other_mock'; end + end + + # + # TESTS + # + + def test_to_s + ex = Expectation.new( :mock => @mock, :method => 'a_func', :arguments => [1, "two", :three, { :four => 4 }] ) + assert_equal %|the_mock.a_func(1, "two", :three, {:four=>4})|, ex.to_s + end + + def test_apply_method_call + se = Expectation.new(:mock => @mock, :method => 'some_func', + :arguments => [1,'two',:three] ) + + # Try it good: + assert_nothing_raised ExpectationError do + se.apply_method_call( @mock, 'some_func', [1,'two',:three], nil ) + end + + # Bad func name: + err = assert_raise ExpectationError do + se.apply_method_call( @mock, 'wrong_func', [1,'two',:three], nil ) + end + assert_match(/wrong method/i, err.message) + assert_match(/wrong_func/i, err.message) + assert_match(/[1, "two", :three]/i, err.message) + assert_match(/some_func/i, err.message) + assert_match(/the_mock/i, err.message) + + # Wrong mock + err = assert_raise ExpectationError do + se.apply_method_call( OtherMock.new, 'some_func', [1,'two',:three], nil ) + end + assert_match(/[1, "two", :three]/i, err.message) + assert_match(/some_func/i, err.message) + assert_match(/the_mock/i, err.message) + assert_match(/other_mock/i, err.message) + + # Wrong args + err = assert_raise ExpectationError do + se.apply_method_call( @mock, 'some_func', [1,'two',:four], nil) + end + assert_match(/[1, "two", :three]/i, err.message) + assert_match(/[1, "two", :four]/i, err.message) + assert_match(/wrong arguments/i, err.message) + assert_match(/some_func/i, err.message) + end + + def test_apply_method_call_should_call_proc_when_given + # now with a proc + thinger = nil + the_proc = Proc.new { thinger = :shaq } + se = Expectation.new(:mock => @mock, :method => 'some_func', + :block => the_proc) + + # Try it good: + assert_nil thinger + assert_nothing_raised ExpectationError do + se.apply_method_call(@mock, 'some_func', [], nil) + end + assert_equal :shaq, thinger, 'wheres shaq??' + end + + def test_apply_method_call_passes_runtime_block_as_last_argument_to_expectation_block + + passed_block = nil + exp_block_called = false + exp_block = Proc.new { |blk| + exp_block_called = true + passed_block = blk + } + + se = Expectation.new(:mock => @mock, :method => 'some_func', :block => exp_block, + :arguments => []) + + set_flag = false + runtime_block = Proc.new { set_flag = true } + + assert_nil passed_block, "Passed block should be nil" + assert !set_flag, "set_flag should be off" + + # Go + se.apply_method_call( @mock, 'some_func', [], runtime_block) + + # Examine the passed block + assert exp_block_called, "Expectation block not called" + assert_not_nil passed_block, "Should have been passed a block" + assert !set_flag, "set_flag should still be off" + passed_block.call + assert set_flag, "set_flag should be on" + end + + def test_apply_method_call_fails_when_theres_no_expectation_block_to_handle_the_runtime_block + se = Expectation.new(:mock => @mock, :method => 'some_func', :arguments => []) + runtime_block = Proc.new { set_flag = true } + err = assert_raise ExpectationError do + se.apply_method_call( @mock, 'some_func', [], runtime_block) + end + assert_match(/unexpected block/i, err.message) + assert_match(/the_mock.some_func()/i, err.message) + end + + def test_returns + se = Expectation.new(:mock => @mock, :method => 'some_func', + :arguments => [1,'two',:three]) + + se.returns "A value" + + assert_equal "A value", se.apply_method_call(@mock, 'some_func', [1,'two',:three], nil) + end + + def test_apply_method_call_captures_block_value + the_proc = lambda { "in the block" } + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => [], :block => the_proc) + + assert_nil se.block_value, "Block value starts out nil" + + se.apply_method_call(@mock, 'do_it', [], nil) + + assert_equal "in the block", se.block_value, "Block value not captured" + end + + def test_trigger + # convenience method for block_value.call + target = false + inner_proc = lambda { target = true } + the_proc = lambda { inner_proc } + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => [], :block => the_proc) + + assert_nil se.block_value, "Block value starts out nil" + se.apply_method_call(@mock, 'do_it', [], nil) + assert_not_nil se.block_value, "Block value not set" + + assert !target, "Target should still be false" + se.trigger + assert target, "Target not true!" + end + + def test_trigger_with_arguments + # convenience method for block_value.call + target = nil + inner_proc = lambda { |one,two| target = [one,two] } + the_proc = lambda { inner_proc } + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => [], :block => the_proc) + + assert_nil se.block_value, "Block value starts out nil" + se.apply_method_call(@mock, 'do_it', [], nil) + assert_not_nil se.block_value, "Block value not set" + + assert_nil target, "target should still be nil" + se.trigger 'cat','dog' + assert_equal ['cat','dog'], target + end + + def test_trigger_nil_block_value + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => []) + + assert_nil se.block_value, "Block value starts out nil" + se.apply_method_call(@mock, 'do_it', [], nil) + assert_nil se.block_value, "Block value should still be nil" + + err = assert_raise ExpectationError do + se.trigger + end + assert_match(/do_it/i, err.message) + assert_match(/block value/i, err.message) + end + + def test_trigger_non_proc_block_value + the_block = lambda { "woops" } + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => [], :block => the_block) + + se.apply_method_call(@mock, 'do_it', [], nil) + assert_equal "woops", se.block_value + + err = assert_raise ExpectationError do + se.trigger + end + assert_match(/do_it/i, err.message) + assert_match(/trigger/i, err.message) + assert_match(/woops/i, err.message) + end + + + + def test_proc_used_for_return + the_proc = lambda { "in the block" } + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => [], :block => the_proc) + + assert_equal "in the block", se.apply_method_call(@mock, 'do_it', [], nil) + assert_equal "in the block", se.block_value, "Captured block value affected wrongly" + end + + def test_explicit_return_overrides_proc_return + the_proc = lambda { "in the block" } + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => [], :block => the_proc) + se.returns "the override" + assert_equal "the override", se.apply_method_call(@mock, 'do_it', [], nil) + assert_equal "in the block", se.block_value, "Captured block value affected wrongly" + end + + def test_yields + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] ) + se.yields :bean1, :bean2 + + things = [] + a_block = lambda { |thinger| things << thinger } + + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + assert_equal [:bean1,:bean2], things, "Wrong things" + end + + def test_yields_block_takes_no_arguments + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] ) + se.yields + + things = [] + a_block = lambda { things << 'OOF' } + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + assert_equal ['OOF'], things + end + + def test_yields_params_to_block_takes_no_arguments + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] ) + se.yields :wont_fit + + things = [] + a_block = lambda { things << 'WUP' } + + err = assert_raise ExpectationError do + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + end + assert_match(/wont_fit/i, err.message) + assert_match(/arity -1/i, err.message) + assert_equal [], things, "Wrong things" + end + + def test_yields_with_returns + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] , + :returns => 'the results') + + exp = se.yields :bean1, :bean2 + assert_same se, exp, "'yields' needs to return a reference to the expectation" + things = [] + a_block = lambda { |thinger| things << thinger } + returned = se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + assert_equal [:bean1,:bean2], things, "Wrong things" + assert_equal 'the results', returned, "Wrong return value" + end + + def test_yields_with_raises + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot], + :raises => RuntimeError.new("kerboom")) + + exp = se.yields :bean1, :bean2 + assert_same se, exp, "'yields' needs to return a reference to the expectation" + things = [] + a_block = lambda { |thinger| things << thinger } + err = assert_raise RuntimeError do + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + end + assert_match(/kerboom/i, err.message) + assert_equal [:bean1,:bean2], things, "Wrong things" + end + + def test_yields_and_inner_block_explodes + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot]) + + exp = se.yields :bean1, :bean2 + assert_same se, exp, "'yields' needs to return a reference to the expectation" + things = [] + a_block = lambda { |thinger| + things << thinger + raise "nasty" + } + err = assert_raise RuntimeError do + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + end + assert_match(/nasty/i, err.message) + assert_equal [:bean1], things, "Wrong things" + end + + def test_yields_with_several_arrays + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] ) + se.yields ['a','b'], ['c','d'] + + things = [] + a_block = lambda { |thinger| things << thinger } + + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + assert_equal [ ['a','b'], ['c','d'] ], things, "Wrong things" + end + + def test_yields_tuples + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] ) + se.yields ['a','b','c'], ['d','e','f'] + + things = [] + a_block = lambda { |left,mid,right| + things << { :left => left, :mid => mid, :right => right } + } + + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + assert_equal [ + {:left => 'a', :mid => 'b', :right => 'c' }, + {:left => 'd', :mid => 'e', :right => 'f' }, + ], things, "Wrong things" + end + + def test_yields_tuples_size_mismatch + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] ) + se.yields ['a','b','c'], ['d','e','f'] + + things = [] + a_block = lambda { |left,mid| + things << { :left => left, :mid => mid } + } + + err = assert_raise ExpectationError do + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + end + assert_match(/arity/i, err.message) + assert_match(/the_mock.each_bean/i, err.message) + assert_match(/"a", "b", "c"/i, err.message) + assert_equal [], things, "Wrong things" + end + + def test_yields_bad_block_arity + se = Expectation.new(:mock => @mock, :method => 'do_later', :arguments => [] ) + se.yields + + assert_error Hardmock::ExpectationError, /block/i, /expected/i, /no param/i, /got 2/i do + se.apply_method_call(@mock,'do_later',[],lambda { |doesnt,match| raise "Surprise!" } ) + end + end + + def test_that_arguments_can_be_added_to_expectation + expectation = Expectation.new(:mock => @mock, :method => "each_bean") + assert_same expectation, expectation.with("jello", "for", "cosby"), "should have returned the same expectation" + + err = assert_raise ExpectationError do + expectation.apply_method_call(@mock, 'each_bean', [], nil) + end + assert_match(/wrong arguments/i, err.message) + + assert_nothing_raised(ExpectationError) do + expectation.apply_method_call(@mock, 'each_bean', ["jello", "for", "cosby"], nil) + end + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/hardmock/test/unit/expector_test.rb b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/test/unit/expector_test.rb new file mode 100644 index 0000000..f420db2 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/test/unit/expector_test.rb @@ -0,0 +1,57 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/expector' + +class ExpectorTest < Test::Unit::TestCase + include Hardmock + + class MyControl + attr_reader :added + def add_expectation(expectation) + @added ||= [] + @added << expectation + end + end + + class ExpBuilder + attr_reader :options + def build_expectation(options) + @options = options + "dummy expectation" + end + end + + def try_it_with(method_name) + mock = Object.new + mock_control = MyControl.new + builder = ExpBuilder.new + + exp = Expector.new(mock, mock_control, builder) + output = exp.send(method_name,:with, 1, 'sauce') + + assert_same mock, builder.options[:mock] + assert_equal method_name, builder.options[:method].to_s + assert_equal [:with,1,'sauce'], builder.options[:arguments] + assert_nil builder.options[:block] + assert_equal [ "dummy expectation" ], mock_control.added, + "Wrong expectation added to control" + + assert_equal "dummy expectation", output, "Expectation should have been returned" + end + + # + # TESTS + # + def test_method_missing + try_it_with 'wonder_bread' + try_it_with 'whatever' + end + + def test_methods_that_wont_trigger_method_missing + mock = Object.new + mock_control = MyControl.new + builder = ExpBuilder.new + + exp = Expector.new(mock, mock_control, builder) + assert_equal mock, exp.instance_eval("@mock") + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/hardmock/test/unit/method_cleanout_test.rb b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/test/unit/method_cleanout_test.rb new file mode 100644 index 0000000..7aa6293 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/test/unit/method_cleanout_test.rb @@ -0,0 +1,36 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/method_cleanout' + +class MethodCleanoutTest < Test::Unit::TestCase + class Victim + OriginalMethods = instance_methods + include Hardmock::MethodCleanout + end + + def setup + @victim = Victim.new + end + + def test_should_remove_most_methods_from_a_class + expect_removed = Victim::OriginalMethods.reject { |m| + Hardmock::MethodCleanout::SACRED_METHODS.include?(m) + } + expect_removed.each do |m| + assert !@victim.respond_to?(m), "should not have method #{m}" + end + end + + def test_should_leave_the_sacred_methods_defined + Hardmock::MethodCleanout::SACRED_METHODS.each do |m| + next if m =~ /^hm_/ + assert @victim.respond_to?(m), "Sacred method '#{m}' was removed unexpectedly" + end + end + + def test_should_include_certain_important_methods_in_the_sacred_methods_list + %w|__id__ __send__ equal? object_id send nil? class kind_of? respond_to? inspect method to_s instance_variables instance_eval|.each do |m| + assert Hardmock::MethodCleanout::SACRED_METHODS.include?(m), "important method #{m} is not included in SACRED_METHODS" + end + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/hardmock/test/unit/mock_control_test.rb b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/test/unit/mock_control_test.rb new file mode 100644 index 0000000..3c52db6 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/test/unit/mock_control_test.rb @@ -0,0 +1,175 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/utils' +require 'hardmock/errors' +require 'hardmock/mock_control' + +class MockControlTest < Test::Unit::TestCase + include Hardmock + + def setup + @unmock = OpenStruct.new( :_name => 'fakemock' ) + + @control = MockControl.new + assert @control.happy?, "Control should start out happy" + end + + def teardown + end + + # + # HELPERS + # + + class MyExp + attr_reader :mock, :mname, :args, :block + def apply_method_call(mock, mname, args, block) + @mock = mock + @mname = mname + @args = args + @block = block + end + end + + class BoomExp < MyExp + def apply_method_call(mock, mname, args, block) + super + raise "BOOM" + end + end + + # + # TESTS + # + + def test_add_exepectation_and_apply_method_call + e1 = MyExp.new + + @control.add_expectation e1 + assert !@control.happy? + + @control.apply_method_call @unmock, 'some_func', [ 'the', :args ], nil + assert @control.happy? + + assert_same @unmock, e1.mock, "Wrong mock" + assert_equal 'some_func', e1.mname, "Wrong method" + assert_equal [ 'the', :args ], e1.args, "Wrong args" + + @control.verify + end + + def test_add_exepectation_and_apply_method_call_with_block + e1 = MyExp.new + + @control.add_expectation e1 + assert !@control.happy? + + runtime_block = Proc.new { "hello" } + @control.apply_method_call @unmock, 'some_func', [ 'the', :args ], runtime_block + assert @control.happy? + + assert_same @unmock, e1.mock, "Wrong mock" + assert_equal 'some_func', e1.mname, "Wrong method" + assert_equal [ 'the', :args ], e1.args, "Wrong args" + assert_equal "hello", e1.block.call, "Wrong block in expectation" + + @control.verify + end + + def test_add_expectation_then_verify + e1 = MyExp.new + + @control.add_expectation e1 + assert !@control.happy?, "Shoudn't be happy" + err = assert_raise VerifyError do + @control.verify + end + assert_match(/unmet expectations/i, err.message) + + @control.apply_method_call @unmock, 'some_func', [ 'the', :args ], nil + assert @control.happy? + + assert_same @unmock, e1.mock, "Wrong mock" + assert_equal 'some_func', e1.mname, "Wrong method" + assert_equal [ 'the', :args ], e1.args, "Wrong args" + + @control.verify + end + + def test_expectation_explosion + be1 = BoomExp.new + + @control.add_expectation be1 + + err = assert_raise RuntimeError do + @control.apply_method_call @unmock, 'a func', [:arg], nil + end + assert_match(/BOOM/i, err.message) + + assert_same @unmock, be1.mock + assert_equal 'a func', be1.mname + assert_equal [:arg], be1.args + end + + def test_disappointment_on_bad_verify + @control.add_expectation MyExp.new + assert !@control.happy?, "Shouldn't be happy" + assert !@control.disappointed?, "too early to be disappointed" + + # See verify fails + err = assert_raise VerifyError do + @control.verify + end + assert_match(/unmet expectations/i, err.message) + + assert !@control.happy?, "Still have unmet expectation" + assert @control.disappointed?, "We should be disappointed following that failure" + + @control.apply_method_call @unmock, 'something', [], nil + assert @control.happy?, "Should be happy" + assert @control.disappointed?, "We should be skeptical" + + @control.verify + + assert !@control.disappointed?, "Should be non-disappointed" + end + + def test_disappointment_from_surprise_calls + assert @control.happy?, "Should be happy" + assert !@control.disappointed?, "too early to be disappointed" + + # See verify fails + err = assert_raise ExpectationError do + @control.apply_method_call @unmock, "something", [], nil + end + assert_match(/surprise/i, err.message) + + assert @control.happy?, "Happiness is an empty list of expectations" + assert @control.disappointed?, "We should be disappointed following that failure" + + @control.verify + assert !@control.disappointed?, "Disappointment should be gone" + end + + def test_disappointment_from_bad_calls + be1 = BoomExp.new + assert !@control.disappointed?, "Shouldn't be disappointed" + @control.add_expectation be1 + assert !@control.disappointed?, "Shouldn't be disappointed" + + err = assert_raise RuntimeError do + @control.apply_method_call @unmock, 'a func', [:arg], nil + end + assert_match(/BOOM/i, err.message) + assert @control.disappointed?, "Should be disappointed" + + assert_same @unmock, be1.mock + assert_equal 'a func', be1.mname + assert_equal [:arg], be1.args + + assert @control.happy?, "Happiness is an empty list of expectations" + @control.verify + assert !@control.disappointed?, "Disappointment should be gone" + end + + +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/hardmock/test/unit/mock_test.rb b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/test/unit/mock_test.rb new file mode 100644 index 0000000..2579bcc --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/test/unit/mock_test.rb @@ -0,0 +1,279 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/method_cleanout' +require 'hardmock/mock' +require 'hardmock/mock_control' +require 'hardmock/expectation_builder' +require 'hardmock/expector' +require 'hardmock/trapper' + +class MockTest < Test::Unit::TestCase + include Hardmock + + def test_build_with_control + mc1 = MockControl.new + mock = Mock.new('hi', mc1) + assert_equal 'hi', mock._name, "Wrong name" + assert_same mc1, mock._control, "Wrong contol" + end + + def test_basics + mock = Mock.new('a name') + assert_equal 'a name', mock._name, "Wrong name for mock" + assert_not_nil mock._control, "Nil control in mock" + end + + def test_expects + mock = Mock.new('order') + control = mock._control + assert control.happy?, "Mock should start out satisfied" + + mock.expects.absorb_something(:location, 'garbage') + assert !control.happy?, "mock control should be unhappy" + + # Do the call + mock.absorb_something(:location, 'garbage') + assert control.happy?, "mock control should be happy again" + + # Verify + assert_nothing_raised Exception do + mock._verify + end + end + + def test_expects_using_arguments_for_method_and_arguments + mock = Mock.new('order') + mock.expects(:absorb_something, :location, 'garbage') + mock.absorb_something(:location, 'garbage') + mock._verify + end + + def test_expects_using_arguments_for_method_and_arguments_with_block + mock = Mock.new('order') + mock.expects(:absorb_something, :location, 'garbage') { |a,b,block| + assert_equal :location, a, "Wrong 'a' argument" + assert_equal 'garbage', b, "Wrong 'b' argument" + assert_equal 'innards', block.call, "Wrong block" + } + mock.absorb_something(:location, 'garbage') do "innards" end + mock._verify + end + + def test_expects_using_string_method_name + mock = Mock.new('order') + mock.expects('absorb_something', :location, 'garbage') + mock.absorb_something(:location, 'garbage') + mock._verify + end + + + def test_expects_assignment + mock = Mock.new('order') + mock.expects.account_number = 1234 + + mock.account_number = 1234 + + mock._verify + end + + def test_expects_assigment_using_arguments_for_method_and_arguments + mock = Mock.new('order') + mock.expects(:account_number=, 1234) + mock.account_number = 1234 + mock._verify + end + + def test_expects_assigment_using_string_method_name + mock = Mock.new('order') + mock.expects('account_number=', 1234) + mock.account_number = 1234 + mock._verify + end + + def test_expects_assignment_and_return_is_overruled_by_ruby_syntax + # Prove that we can set up a return but that it doesn't mean much, + # because ruby's parser will 'do the right thing' as regards semantic + # values for assignment. (That is, the rvalue of the assignment) + mock = Mock.new('order') + mock.expects(:account_number=, 1234).returns "gold" + got = mock.account_number = 1234 + mock._verify + assert_equal 1234, got, "Expected rvalue" + end + + def test_expects_assignment_and_raise + mock = Mock.new('order') + mock.expects(:account_number=, 1234).raises StandardError.new("kaboom") + err = assert_raise StandardError do + mock.account_number = 1234 + end + assert_match(/kaboom/i, err.message) + mock._verify + end + + + def test_expects_multiple + mock = Mock.new('order') + control = mock._control + + assert control.happy? + + mock.expects.one_thing :hi, { :goose => 'neck' } + mock.expects.another 5,6,7 + assert !control.happy? + + mock.one_thing :hi, { :goose => 'neck' } + assert !control.happy? + + mock.another 5,6,7 + assert control.happy? + end + + def test_surprise_call + mock = Mock.new('order') + err = assert_raise ExpectationError do + mock.uh_oh + end + assert_match(/surprise/i, err.message) + assert_match(/uh_oh/i, err.message) + + err = assert_raise ExpectationError do + mock.whoa :horse + end + assert_match(/surprise/i, err.message) + assert_match(/order\.whoa\(:horse\)/i, err.message) + end + + def test_wrong_call + mock = Mock.new('order') + mock.expects.pig 'arse' + err = assert_raise ExpectationError do + mock.whoa :horse + end + assert_match(/wrong method/i, err.message) + assert_match(/order\.whoa\(:horse\)/i, err.message) + assert_match(/order\.pig\("arse"\)/i, err.message) + end + + def test_wrong_arguments + mock = Mock.new('order') + mock.expects.go_fast(:a, 1, 'three') + + err = assert_raise ExpectationError do + mock.go_fast :a, 1, 'not right' + end + assert_match(/wrong argument/i, err.message) + assert_match(/order\.go_fast\(:a, 1, "three"\)/i, err.message) + assert_match(/order\.go_fast\(:a, 1, "not right"\)/i, err.message) + end + + def test_expects_and_return + mock = Mock.new('order') + mock.expects.delivery_date.returns Date.today + assert_equal Date.today, mock.delivery_date + mock._verify + end + + def test_expects_and_return_with_arguments + mock = Mock.new('order') + mock.expects.delivery_date(:arf,14).returns(Date.today) + assert_equal Date.today, mock.delivery_date(:arf,14) + mock._verify + end + + def test_expects_and_raise + mock = Mock.new('order') + mock.expects.delivery_date.raises StandardError.new("bloof") + + err = assert_raise StandardError do + mock.delivery_date + end + assert_match(/bloof/i, err.message) + + mock._verify + + # Try convenience argument String + mock.expects.pow.raises "hell" + err = assert_raise RuntimeError do + mock.pow + end + assert_match(/hell/i, err.message) + + mock._verify + + # Try convenience argument nothing + mock.expects.pow.raises + err = assert_raise RuntimeError do + mock.pow + end + assert_match(/an error/i, err.message) + + mock._verify + end + + def test_expects_a_runtime_block + mock = Mock.new('order') + got_val = nil + + mock.expects.when(:something) { |e,block| + got_val = block.call + } + + mock.when :something do "hi there" end + + assert_equal "hi there", got_val, "Expectation block not invoked" + mock._verify + end + + def test_trap_block + mock = Mock.new('order') + exp = mock.trap.observe + + # use it + mock.observe { "burp" } + + assert_equal "burp", exp.block_value.call + end + + def test_trap_arguments_and_block + mock = Mock.new('order') + exp = mock.trap.subscribe(:data_changed) + + # use it + mock.subscribe(:data_changed) { "burp" } + assert_equal "burp", exp.block_value.call + mock._verify + end + + def test_trap_arguments_and_block_wrong_num_args + mock = Mock.new('order') + exp = mock.trap.subscribe(:data_changed) + + assert_raise ExpectationError do + mock.subscribe(:data_changed,1) { "burp" } + end + mock._verify + end + + def test_trap_arguments_and_block_wrong_args + mock = Mock.new('order') + exp = mock.trap.subscribe(:data_changed) + + assert_raise ExpectationError do + mock.subscribe("no good") { "burp" } + end + + mock._verify + end + + def test_trap_is_not_leniant_about_arguments + mock = Mock.new('order') + exp = mock.trap.subscribe + + assert_raise ExpectationError do + mock.subscribe("no good") { "burp" } + end + + mock._verify + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/hardmock/test/unit/test_unit_before_after_test.rb b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/test/unit/test_unit_before_after_test.rb new file mode 100644 index 0000000..172f527 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/test/unit/test_unit_before_after_test.rb @@ -0,0 +1,452 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") + +class TestUnitBeforeAfter < Test::Unit::TestCase + + # + # after_teardown + # + + it "adds TestCase.after_teardown hook for appending post-teardown actions" do + write_and_run_test :use_after_teardown => true + + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "THE TEARDOWN", + "1st after_teardown", + "2nd after_teardown", + "Finished in" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 0 + end + + should "execute all after_teardowns, even if the main teardown flunks" do + write_and_run_test :use_after_teardown => true, :flunk_in_teardown => true + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "F", + "1st after_teardown", + "2nd after_teardown", + "Finished in", + "1) Failure:", + "test_something(MyExampleTest) [_test_file_temp.rb:20]:", + "FLUNK IN TEARDOWN" + see_results :tests => 1, :assertions => 1, :failures => 1, :errors => 0 + end + + should "execute all after_teardowns, even if the main teardown explodes" do + write_and_run_test :use_after_teardown => true, :raise_in_teardown => true + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "E", + "1st after_teardown", + "2nd after_teardown", + "Finished in", + "RuntimeError: ERROR IN TEARDOWN" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 1 + end + + should "execute all after_teardowns, even if some of them flunk" do + write_and_run_test :use_after_teardown => true, :flunk_in_after_teardown => true + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "THE TEARDOWN", + "1st after_teardown", + "F", + "2nd after_teardown", + "Finished in", + "1) Failure:", + "test_something(MyExampleTest) [_test_file_temp.rb:7]:", + "Flunk in first after_teardown", + "2) Failure:", + "test_something(MyExampleTest) [_test_file_temp.rb:10]:", + "Flunk in second after_teardown" + see_results :tests => 1, :assertions => 2, :failures => 2, :errors => 0 + end + + should "execute all after_teardowns, even if some of them explode" do + write_and_run_test :use_after_teardown => true, :raise_in_after_teardown => true + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "THE TEARDOWN", + "1st after_teardown", + "E", + "2nd after_teardown", + "Finished in", + "RuntimeError: Error in first after_teardown", + "RuntimeError: Error in second after_teardown" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 2 + end + + it "will run after_teardowns in the absence of a regular teardown" do + write_and_run_test :omit_teardown => true, :use_after_teardown => true + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "1st after_teardown", + "2nd after_teardown", + "Finished in" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 0 + end + + should "not interfere with normal test writing" do + write_and_run_test + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "THE TEARDOWN", + "Finished in" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 0 + end + + it "provides a cleaned-up backtrace" do + write_and_run_test :with_failure => true + see_in_order "Loaded suite", + "THE SETUP", + "A FAILING TEST", + "F", "THE TEARDOWN", + "Finished in", + "1) Failure:", + "test_something(MyExampleTest) [_test_file_temp.rb:17]:", + "Instrumented failure.", + " is not true." + see_results :tests => 1, :assertions => 1, :failures => 1, :errors => 0 + end + + it "provides a cleaned-up backtrace, but not TOO cleaned up" do + write_and_run_test :with_failure => true, :use_helpers => true + see_in_order "Loaded suite", + "THE SETUP", + "A FAILING TEST", + "F", "THE TEARDOWN", + "Finished in", + "1) Failure:", + "test_something(MyExampleTest)\n", + "[_test_file_temp.rb:25:in `tripwire'", + "_test_file_temp.rb:21:in `my_helper'", + "_test_file_temp.rb:17:in `test_something']:", + "Instrumented failure.", + " is not true." + see_results :tests => 1, :assertions => 1, :failures => 1, :errors => 0 + end + + should "not interfere with passthrough exception types" do + if is_modern_test_unit? + write_and_run_test :raise_nasty_in_test => true + see_in_no_particular_order "Loaded suite", + "THE TEARDOWN", + "_test_file_temp.rb:16:in `test_something': NASTY ERROR (NoMemoryError)" + see_no_results + end + end + + # + # before_setup + # + + it "adds TestCase.before_setup hook for prepending pre-setup actions" do + write_and_run_test :use_before_setup => true + see_in_order "Loaded suite", + "3rd before_setup", + "2nd before_setup", + "1st before_setup", + "THE SETUP", + "A TEST", + "THE TEARDOWN", + "Finished in" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 0 + end + + should "stop executing the test on the first failure withing a before_setup action" do + write_and_run_test :use_before_setup => true, :flunk_in_before_setup => true + see_in_order "Loaded suite", + "3rd before_setup", + "2nd before_setup", + "FTHE TEARDOWN", + "1) Failure:", + "test_something(MyExampleTest) [_test_file_temp.rb:10]:", + "Flunk in 2nd before_setup." + see_results :tests => 1, :assertions => 1, :failures => 1, :errors => 0 + end + + should "stop executing the test on the first error within a before_setup action" do + write_and_run_test :use_before_setup => true, :raise_in_before_setup => true + see_in_order "Loaded suite", + "3rd before_setup", + "2nd before_setup", + "ETHE TEARDOWN", + "Finished in", + "test_something(MyExampleTest):", + "RuntimeError: Error in 2nd before_setup", + "_test_file_temp.rb:10", + "/hardmock/lib/test_unit_before_after.rb:", ":in `call'" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 1 + end + + it "will run before_setup actions in the absence of a regular setup" do + write_and_run_test :omit_setup => true, :use_before_setup => true + see_in_order "Loaded suite", + "3rd before_setup", + "2nd before_setup", + "1st before_setup", + "A TEST", + "THE TEARDOWN", + "Finished in" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 0 + end + + it "allows before_setup and after_teardown to be used at the same time" do + write_and_run_test :use_before_setup => true, :use_after_teardown => true + see_in_order "Loaded suite", + "3rd before_setup", + "2nd before_setup", + "1st before_setup", + "A TEST", + "THE TEARDOWN", + "1st after_teardown", + "2nd after_teardown", + "Finished in" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 0 + end + + # + # HELPERS + # + + def teardown + remove_test + end + + def test_filename + "_test_file_temp.rb" + end + + def remove_test + rm_f test_filename + end + + def write_and_run_test(opts={}) + write(test_filename, generate_test_code(opts)) + run_test + end + + def run_test + @output = `ruby #{test_filename} 2>&1` + end + + + def write(fname, code) + File.open(fname,"w") do |f| + f.print code + end + end + + def show_output + puts "-- BEGIN TEST OUTPUT" + puts @output + puts "-- END TEST OUTPUT" + end + + def see_in_order(*phrases) + idx = 0 + phrases.each do |txt| + idx = @output.index(txt, idx) + if idx.nil? + if @output.index(txt) + flunk "Phrase '#{txt}' is out-of-order in test output:\n#{@output}" + else + flunk "Phrase '#{txt}' not found in test output:\n#{@output}" + end + end + end + end + + def see_in_no_particular_order(*phrases) + phrases.each do |txt| + assert_not_nil @output.index(txt), "Didn't see '#{txt}' in test output:\n#{@output}" + end + end + + def see_results(opts) + if @output =~ /(\d+) tests, (\d+) assertions, (\d+) failures, (\d+) errors/ + tests, assertions, failures, errors = [ $1, $2, $3, $4 ] + [:tests, :assertions, :failures, :errors].each do |key| + eval %{assert_equal(opts[:#{key}].to_s, #{key}, "Wrong number of #{key} in report") if opts[:#{key}]} + end + else + flunk "Didn't see the test results report line" + end + end + + def see_no_results + if @output =~ /\d+ tests, \d+ assertions, \d+ failures, \d+ errors/ + flunk "Should not have had a results line:\n#{@output}" + end + end + + def lib_dir + File.expand_path(File.dirname(__FILE__) + "/../../lib") + end + + def generate_test_code(opts={}) + + if opts[:with_failure] or opts[:raise_nasty_in_test] + test_method_code = generate_failing_test("test_something", opts) + else + test_method_code = generate_passing_test("test_something") + end + + + requires_for_ext = '' + if opts[:use_before_setup] or opts[:use_after_teardown] + requires_for_ext =<<-RFE + $: << "#{lib_dir}" + require 'test_unit_before_after' + RFE + end + + before_setups = '' + if opts[:use_before_setup] + add_on_two = "" + if opts[:flunk_in_before_setup] + add_on_two = %{; test.flunk "Flunk in 2nd before_setup"} + elsif opts[:raise_in_before_setup] + add_on_two = %{; raise "Error in 2nd before_setup"} + end + before_setups =<<-BSTS + Test::Unit::TestCase.before_setup do |test| + puts "1st before_setup" + end + Test::Unit::TestCase.before_setup do |test| + puts "2nd before_setup" #{add_on_two} + end + Test::Unit::TestCase.before_setup do |test| + puts "3rd before_setup" + end + + BSTS + end + + + setup_code =<<-SC + def setup + puts "THE SETUP" + end + SC + if opts[:omit_setup] + setup_code = "" + end + + after_teardowns = '' + if opts[:use_after_teardown] + add_on_one = "" + add_on_two = "" + if opts[:flunk_in_after_teardown] + add_on_one = %{; test.flunk "Flunk in first after_teardown"} + add_on_two = %{; test.flunk "Flunk in second after_teardown"} + elsif opts[:raise_in_after_teardown] + add_on_one = %{; raise "Error in first after_teardown"} + add_on_two = %{; raise "Error in second after_teardown"} + end + after_teardowns =<<-ATDS + Test::Unit::TestCase.after_teardown do |test| + puts "1st after_teardown" #{add_on_one} + end + Test::Unit::TestCase.after_teardown do |test| + puts "2nd after_teardown" #{add_on_two} + end + ATDS + end + + teardown_code =<<-TDC + def teardown + puts "THE TEARDOWN" + end + TDC + if opts[:flunk_in_teardown] + teardown_code =<<-TDC + def teardown + flunk "FLUNK IN TEARDOWN" + end + TDC + elsif opts[:raise_in_teardown] + teardown_code =<<-TDC + def teardown + raise "ERROR IN TEARDOWN" + end + TDC + end + if opts[:omit_teardown] + teardown_code = "" + end + + str = <<-TCODE + require 'test/unit' + #{requires_for_ext} + + #{before_setups} #{after_teardowns} + + class MyExampleTest < Test::Unit::TestCase + #{setup_code} + #{teardown_code} + #{test_method_code} + end + TCODE + end + + def generate_passing_test(tname) + str = <<-TMETH + def #{tname} + puts "A TEST" + end + TMETH + end + + def generate_failing_test(tname, opts={}) + str = "NOT DEFINED?" + if opts[:raise_nasty_in_test] + str = <<-TMETH + def #{tname} + raise NoMemoryError, "NASTY ERROR" + end + TMETH + + elsif opts[:use_helpers] + str = <<-TMETH + def #{tname} + puts "A FAILING TEST" + my_helper + end + + def my_helper + tripwire + end + + def tripwire + assert false, "Instrumented failure" + end + TMETH + else + str = <<-TMETH + def #{tname} + puts "A FAILING TEST" + assert false, "Instrumented failure" + end + TMETH + end + return str + end + + def is_modern_test_unit? + begin + Test::Unit::TestCase::PASSTHROUGH_EXCEPTIONS + return true + rescue NameError + return false + end + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/hardmock/test/unit/trapper_test.rb b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/test/unit/trapper_test.rb new file mode 100644 index 0000000..f7d4114 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/test/unit/trapper_test.rb @@ -0,0 +1,62 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/method_cleanout' +require 'hardmock/trapper' + +class TrapperTest < Test::Unit::TestCase + include Hardmock + + def setup + @mock = Object.new + @mock_control = MyControl.new + @builder = ExpBuilder.new + @trapper = Trapper.new(@mock, @mock_control, @builder) + end + + # + # HELPERS + # + + class MyControl + attr_reader :added + def add_expectation(expectation) + @added ||= [] + @added << expectation + end + end + + class ExpBuilder + attr_reader :options + def build_expectation(options) + @options = options + "dummy expectation" + end + end + + # + # TESTS + # + + def test_method_missing + + output = @trapper.change(:less) + + assert_same @mock, @builder.options[:mock] + assert_equal :change, @builder.options[:method] + assert_equal [:less], @builder.options[:arguments] + assert_not_nil @builder.options[:block] + assert @builder.options[:suppress_arguments_to_block], ":suppress_arguments_to_block should be set" + assert_equal [ "dummy expectation" ], @mock_control.added, + "Wrong expectation added to control" + + assert_equal "dummy expectation", output, "Expectation should have been returned" + + # Examine the block. It should take one argument and simply return + # that argument. because of the 'suppress arguments to block' + # setting, the argument can only end up being a block, in practice. + trapper_block = @builder.options[:block] + assert_equal "the argument", trapper_block.call("the argument"), + "The block should merely return the passed argument" + end + + +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/hardmock/test/unit/verify_error_test.rb b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/test/unit/verify_error_test.rb new file mode 100644 index 0000000..ecd23fd --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/hardmock/test/unit/verify_error_test.rb @@ -0,0 +1,40 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/method_cleanout' +require 'hardmock/mock_control' +require 'hardmock/errors' +require 'hardmock/expectation_builder' +require 'hardmock/expectation' +require 'hardmock/mock' + +class VerifyErrorTest < Test::Unit::TestCase + include Hardmock + + # + # TESTS + # + + def test_formatted_list_of_unmet_expectations + mock1 = Mock.new('mock1') + mock2 = Mock.new('mock2') + exp1 = Expectation.new( :mock => mock1, :method => 'send_parts', :arguments => [1,2,:a] ) + exp2 = Expectation.new( :mock => mock2, :method => 'grind_it', :arguments => [] ) + + exp_list = [ exp1, exp2 ] + + err = VerifyError.new("This is the error", exp_list) + assert_equal "This is the error:\n * #{exp1.to_s}\n * #{exp2.to_s}", err.message + end + + def test_empty_list_of_expectations + # this is not a normal case; not spending a lot of time to make this better + exp_list = [] + err = VerifyError.new("This is the error:\n", exp_list) + end + + def test_nil_expectation_list + # this is not a normal case; not spending a lot of time to make this better + exp_list = [] + err = VerifyError.new("This is the error:\n", exp_list) + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/auto/colour_prompt.rb b/flex-bison/clcalc/tools/ceedling/vendor/unity/auto/colour_prompt.rb new file mode 100644 index 0000000..81003dd --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/auto/colour_prompt.rb @@ -0,0 +1,94 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +if RUBY_PLATFORM =~/(win|w)32$/ + begin + require 'Win32API' + rescue LoadError + puts "ERROR! \"Win32API\" library not found" + puts "\"Win32API\" is required for colour on a windows machine" + puts " try => \"gem install Win32API\" on the command line" + puts + end + # puts + # puts 'Windows Environment Detected...' + # puts 'Win32API Library Found.' + # puts +end + +class ColourCommandLine + def initialize + if RUBY_PLATFORM =~/(win|w)32$/ + get_std_handle = Win32API.new("kernel32", "GetStdHandle", ['L'], 'L') + @set_console_txt_attrb = + Win32API.new("kernel32","SetConsoleTextAttribute",['L','N'], 'I') + @hout = get_std_handle.call(-11) + end + end + + def change_to(new_colour) + if RUBY_PLATFORM =~/(win|w)32$/ + @set_console_txt_attrb.call(@hout,self.win32_colour(new_colour)) + else + "\033[30;#{posix_colour(new_colour)};22m" + end + end + + def win32_colour(colour) + case colour + when :black then 0 + when :dark_blue then 1 + when :dark_green then 2 + when :dark_cyan then 3 + when :dark_red then 4 + when :dark_purple then 5 + when :dark_yellow, :narrative then 6 + when :default_white, :default, :dark_white then 7 + when :silver then 8 + when :blue then 9 + when :green, :success then 10 + when :cyan, :output then 11 + when :red, :failure then 12 + when :purple then 13 + when :yellow then 14 + when :white then 15 + else + 0 + end + end + + def posix_colour(colour) + case colour + when :black then 30 + when :red, :failure then 31 + when :green, :success then 32 + when :yellow then 33 + when :blue, :narrative then 34 + when :purple, :magenta then 35 + when :cyan, :output then 36 + when :white, :default_white, :default then 37 + else + 30 + end + end + + def out_c(mode, colour, str) + case RUBY_PLATFORM + when /(win|w)32$/ + change_to(colour) + $stdout.puts str if mode == :puts + $stdout.print str if mode == :print + change_to(:default_white) + else + $stdout.puts("#{change_to(colour)}#{str}\033[0m") if mode == :puts + $stdout.print("#{change_to(colour)}#{str}\033[0m") if mode == :print + end + end +end # ColourCommandLine + +def colour_puts(role,str) ColourCommandLine.new.out_c(:puts, role, str) end +def colour_print(role,str) ColourCommandLine.new.out_c(:print, role, str) end + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/auto/colour_reporter.rb b/flex-bison/clcalc/tools/ceedling/vendor/unity/auto/colour_reporter.rb new file mode 100644 index 0000000..5aa1d27 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/auto/colour_reporter.rb @@ -0,0 +1,39 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require "#{File.expand_path(File.dirname(__FILE__))}/colour_prompt" + +$colour_output = true + +def report(message) + if not $colour_output + $stdout.puts(message) + else + message = message.join('\n') if (message.class == Array) + message.each_line do |line| + line.chomp! + colour = case(line) + when /(?:total\s+)?tests:?\s+(\d+)\s+(?:total\s+)?failures:?\s+\d+\s+Ignored:?/i + ($1.to_i == 0) ? :green : :red + when /PASS/ + :green + when /^OK$/ + :green + when /(?:FAIL|ERROR)/ + :red + when /IGNORE/ + :yellow + when /^(?:Creating|Compiling|Linking)/ + :white + else + :silver + end + colour_puts(colour, line) + end + end + $stdout.flush + $stderr.flush +end \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/auto/generate_config.yml b/flex-bison/clcalc/tools/ceedling/vendor/unity/auto/generate_config.yml new file mode 100644 index 0000000..4a5e474 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/auto/generate_config.yml @@ -0,0 +1,36 @@ +#this is a sample configuration file for generate_module +#you would use it by calling generate_module with the -ygenerate_config.yml option +#files like this are useful for customizing generate_module to your environment +:generate_module: + :defaults: + #these defaults are used in place of any missing options at the command line + :path_src: ../src/ + :path_inc: ../src/ + :path_tst: ../test/ + :update_svn: true + :includes: + #use [] for no additional includes, otherwise list the includes on separate lines + :src: + - Defs.h + - Board.h + :inc: [] + :tst: + - Defs.h + - Board.h + - Exception.h + :boilerplates: + #these are inserted at the top of generated files. + #just comment out or remove if not desired. + #use %1$s where you would like the file name to appear (path/extension not included) + :src: | + //------------------------------------------- + // %1$s.c + //------------------------------------------- + :inc: | + //------------------------------------------- + // %1$s.h + //------------------------------------------- + :tst: | + //------------------------------------------- + // Test%1$s.c : Units tests for %1$s.c + //------------------------------------------- diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/auto/generate_module.rb b/flex-bison/clcalc/tools/ceedling/vendor/unity/auto/generate_module.rb new file mode 100644 index 0000000..3db1a98 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/auto/generate_module.rb @@ -0,0 +1,202 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +# This script creates all the files with start code necessary for a new module. +# A simple module only requires a source file, header file, and test file. +# Triad modules require a source, header, and test file for each triad type (like model, conductor, and hardware). + +require 'rubygems' +require 'fileutils' + +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +#help text when requested +HELP_TEXT = [ "\nGENERATE MODULE\n-------- ------", + "\nUsage: ruby generate_module [options] module_name", + " -i\"include\" sets the path to output headers to 'include' (DEFAULT ../src)", + " -s\"../src\" sets the path to output source to '../src' (DEFAULT ../src)", + " -t\"C:/test\" sets the path to output source to 'C:/test' (DEFAULT ../test)", + " -p\"MCH\" sets the output pattern to MCH.", + " dh - driver hardware.", + " dih - driver interrupt hardware.", + " mch - model conductor hardware.", + " mvp - model view presenter.", + " src - just a single source module. (DEFAULT)", + " -d destroy module instead of creating it.", + " -u update subversion too (requires subversion command line)", + " -y\"my.yml\" selects a different yaml config file for module generation", + "" ].join("\n") + +#Built in patterns +PATTERNS = { 'src' => {'' => { :inc => [] } }, + 'dh' => {'Driver' => { :inc => ['%1$sHardware.h'] }, + 'Hardware' => { :inc => [] } + }, + 'dih' => {'Driver' => { :inc => ['%1$sHardware.h', '%1$sInterrupt.h'] }, + 'Interrupt'=> { :inc => ['%1$sHardware.h'] }, + 'Hardware' => { :inc => [] } + }, + 'mch' => {'Model' => { :inc => [] }, + 'Conductor'=> { :inc => ['%1$sModel.h', '%1$sHardware.h'] }, + 'Hardware' => { :inc => [] } + }, + 'mvp' => {'Model' => { :inc => [] }, + 'Presenter'=> { :inc => ['%1$sModel.h', '%1$sView.h'] }, + 'View' => { :inc => [] } + } + } + +#TEMPLATE_TST +TEMPLATE_TST = %q[#include "unity.h" +%2$s#include "%1$s.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void test_%1$s_NeedToImplement(void) +{ + TEST_IGNORE(); +} +] + +#TEMPLATE_SRC +TEMPLATE_SRC = %q[%2$s#include "%1$s.h" +] + +#TEMPLATE_INC +TEMPLATE_INC = %q[#ifndef _%3$s_H +#define _%3$s_H%2$s + +#endif // _%3$s_H +] + +# Parse the command line parameters. +ARGV.each do |arg| + case(arg) + when /^-d/ then @destroy = true + when /^-u/ then @update_svn = true + when /^-p(\w+)/ then @pattern = $1 + when /^-s(.+)/ then @path_src = $1 + when /^-i(.+)/ then @path_inc = $1 + when /^-t(.+)/ then @path_tst = $1 + when /^-y(.+)/ then @yaml_config = $1 + when /^(\w+)/ + raise "ERROR: You can't have more than one Module name specified!" unless @module_name.nil? + @module_name = arg + when /^-(h|-help)/ + puts HELP_TEXT + exit + else + raise "ERROR: Unknown option specified '#{arg}'" + end +end +raise "ERROR: You must have a Module name specified! (use option -h for help)" if @module_name.nil? + +#load yaml file if one was requested +if @yaml_config + require 'yaml' + cfg = YAML.load_file(HERE + @yaml_config)[:generate_module] + @path_src = cfg[:defaults][:path_src] if @path_src.nil? + @path_inc = cfg[:defaults][:path_inc] if @path_inc.nil? + @path_tst = cfg[:defaults][:path_tst] if @path_tst.nil? + @update_svn = cfg[:defaults][:update_svn] if @update_svn.nil? + @extra_inc = cfg[:includes] + @boilerplates = cfg[:boilerplates] +else + @boilerplates = {} +end + +# Create default file paths if none were provided +@path_src = HERE + "../src/" if @path_src.nil? +@path_inc = @path_src if @path_inc.nil? +@path_tst = HERE + "../test/" if @path_tst.nil? +@path_src += '/' unless (@path_src[-1] == 47) +@path_inc += '/' unless (@path_inc[-1] == 47) +@path_tst += '/' unless (@path_tst[-1] == 47) +@pattern = 'src' if @pattern.nil? +@includes = { :src => [], :inc => [], :tst => [] } +@includes.merge!(@extra_inc) unless @extra_inc.nil? + +#create triad definition +TRIAD = [ { :ext => '.c', :path => @path_src, :template => TEMPLATE_SRC, :inc => :src, :boilerplate => @boilerplates[:src] }, + { :ext => '.h', :path => @path_inc, :template => TEMPLATE_INC, :inc => :inc, :boilerplate => @boilerplates[:inc] }, + { :ext => '.c', :path => @path_tst+'Test', :template => TEMPLATE_TST, :inc => :tst, :boilerplate => @boilerplates[:tst] }, + ] + +#prepare the pattern for use +@patterns = PATTERNS[@pattern.downcase] +raise "ERROR: The design pattern specified isn't one that I recognize!" if @patterns.nil? + +# Assemble the path/names of the files we need to work with. +files = [] +TRIAD.each do |triad| + @patterns.each_pair do |pattern_file, pattern_traits| + files << { + :path => "#{triad[:path]}#{@module_name}#{pattern_file}#{triad[:ext]}", + :name => "#{@module_name}#{pattern_file}", + :template => triad[:template], + :boilerplate => triad[:boilerplate], + :includes => case(triad[:inc]) + when :src then @includes[:src] | pattern_traits[:inc].map{|f| f % [@module_name]} + when :inc then @includes[:inc] + when :tst then @includes[:tst] | pattern_traits[:inc].map{|f| "Mock#{f}"% [@module_name]} + end + } + end +end + +# destroy files if that was what was requested +if @destroy + files.each do |filespec| + file = filespec[:path] + if File.exist?(file) + if @update_svn + `svn delete \"#{file}\" --force` + puts "File #{file} deleted and removed from source control" + else + FileUtils.remove(file) + puts "File #{file} deleted" + end + else + puts "File #{file} does not exist so cannot be removed." + end + end + puts "Destroy Complete" + exit +end + +#Abort if any module already exists +files.each do |file| + raise "ERROR: File #{file[:name]} already exists. Exiting." if File.exist?(file[:path]) +end + +# Create Source Modules +files.each_with_index do |file, i| + File.open(file[:path], 'w') do |f| + f.write(file[:boilerplate] % [file[:name]]) unless file[:boilerplate].nil? + f.write(file[:template] % [ file[:name], + file[:includes].map{|f| "#include \"#{f}\"\n"}.join, + file[:name].upcase ] + ) + end + if (@update_svn) + `svn add \"#{file[:path]}\"` + if $?.exitstatus == 0 + puts "File #{file[:path]} created and added to source control" + else + puts "File #{file[:path]} created but FAILED adding to source control!" + end + else + puts "File #{file[:path]} created" + end +end + +puts 'Generate Complete' diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/auto/generate_test_runner.rb b/flex-bison/clcalc/tools/ceedling/vendor/unity/auto/generate_test_runner.rb new file mode 100644 index 0000000..aff5053 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/auto/generate_test_runner.rb @@ -0,0 +1,303 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +File.expand_path(File.join(File.dirname(__FILE__),'colour_prompt')) + +class UnityTestRunnerGenerator + + def initialize(options = nil) + @options = { :includes => [], :plugins => [], :framework => :unity } + case(options) + when NilClass then @options + when String then @options.merge!(UnityTestRunnerGenerator.grab_config(options)) + when Hash then @options.merge!(options) + else raise "If you specify arguments, it should be a filename or a hash of options" + end + end + + def self.grab_config(config_file) + options = { :includes => [], :plugins => [], :framework => :unity } + unless (config_file.nil? or config_file.empty?) + require 'yaml' + yaml_guts = YAML.load_file(config_file) + options.merge!(yaml_guts[:unity] ? yaml_guts[:unity] : yaml_guts[:cmock]) + raise "No :unity or :cmock section found in #{config_file}" unless options + end + return(options) + end + + def run(input_file, output_file, options=nil) + tests = [] + includes = [] + used_mocks = [] + + @options.merge!(options) unless options.nil? + module_name = File.basename(input_file) + + #pull required data from source file + File.open(input_file, 'r') do |input| + tests = find_tests(input) + includes = find_includes(input) + used_mocks = find_mocks(includes) + end + + #build runner file + File.open(output_file, 'w') do |output| + create_header(output, used_mocks) + create_externs(output, tests, used_mocks) + create_mock_management(output, used_mocks) + create_suite_setup_and_teardown(output) + create_reset(output, used_mocks) + create_main(output, input_file, tests) + end + + all_files_used = [input_file, output_file] + all_files_used += includes.map {|filename| filename + '.c'} unless includes.empty? + all_files_used += @options[:includes] unless @options[:includes].empty? + return all_files_used.uniq + end + + def find_tests(input_file) + tests_raw = [] + tests_args = [] + tests_and_line_numbers = [] + + input_file.rewind + source_raw = input_file.read + source_scrubbed = source_raw.gsub(/\/\/.*$/, '') # remove line comments + source_scrubbed = source_scrubbed.gsub(/\/\*.*?\*\//m, '') # remove block comments + lines = source_scrubbed.split(/(^\s*\#.*$) # Treat preprocessor directives as a logical line + | (;|\{|\}) /x) # Match ;, {, and } as end of lines + + lines.each_with_index do |line, index| + #find tests + if line =~ /^((?:\s*TEST_CASE\s*\(.*?\)\s*)*)\s*void\s+(test.*?)\s*\(\s*(.*)\s*\)/ + arguments = $1 + name = $2 + call = $3 + args = nil + if (@options[:use_param_tests] and !arguments.empty?) + args = [] + arguments.scan(/\s*TEST_CASE\s*\((.*)\)\s*$/) {|a| args << a[0]} + end + tests_and_line_numbers << { :name => name, :args => args, :call => call, :line_number => 0 } + tests_args = [] + end + end + + #determine line numbers and create tests to run + source_lines = source_raw.split("\n") + source_index = 0; + tests_and_line_numbers.size.times do |i| + source_lines[source_index..-1].each_with_index do |line, index| + if (line =~ /#{tests_and_line_numbers[i][:name]}/) + source_index += index + tests_and_line_numbers[i][:line_number] = source_index + 1 + break + end + end + end + + return tests_and_line_numbers + end + + def find_includes(input_file) + input_file.rewind + includes = [] + input_file.readlines.each do |line| + scan_results = line.scan(/^\s*#include\s+\"\s*(.+)\.[hH]\s*\"/) + includes << scan_results[0][0] if (scan_results.size > 0) + end + return includes + end + + def find_mocks(includes) + mock_headers = [] + includes.each do |include_file| + mock_headers << File.basename(include_file) if (include_file =~ /^mock/i) + end + return mock_headers + end + + def create_header(output, mocks) + output.puts('/* AUTOGENERATED FILE. DO NOT EDIT. */') + create_runtest(output, mocks) + output.puts("\n//=======Automagically Detected Files To Include=====") + output.puts("#include \"#{@options[:framework].to_s}.h\"") + output.puts('#include "cmock.h"') unless (mocks.empty?) + @options[:includes].flatten.uniq.compact.each do |inc| + output.puts("#include #{inc.include?('<') ? inc : "\"#{inc.gsub('.h','')}.h\""}") + end + output.puts('#include ') + output.puts('#include ') + output.puts('#include "CException.h"') if @options[:plugins].include?(:cexception) + mocks.each do |mock| + output.puts("#include \"#{mock.gsub('.h','')}.h\"") + end + if @options[:enforce_strict_ordering] + output.puts('') + output.puts('int GlobalExpectCount;') + output.puts('int GlobalVerifyOrder;') + output.puts('char* GlobalOrderError;') + end + end + + def create_externs(output, tests, mocks) + output.puts("\n//=======External Functions This Runner Calls=====") + output.puts("extern void setUp(void);") + output.puts("extern void tearDown(void);") + tests.each do |test| + output.puts("extern void #{test[:name]}(#{test[:call]});") + end + output.puts('') + end + + def create_mock_management(output, mocks) + unless (mocks.empty?) + output.puts("\n//=======Mock Management=====") + output.puts("static void CMock_Init(void)") + output.puts("{") + if @options[:enforce_strict_ordering] + output.puts(" GlobalExpectCount = 0;") + output.puts(" GlobalVerifyOrder = 0;") + output.puts(" GlobalOrderError = NULL;") + end + mocks.each do |mock| + output.puts(" #{mock}_Init();") + end + output.puts("}\n") + + output.puts("static void CMock_Verify(void)") + output.puts("{") + mocks.each do |mock| + output.puts(" #{mock}_Verify();") + end + output.puts("}\n") + + output.puts("static void CMock_Destroy(void)") + output.puts("{") + mocks.each do |mock| + output.puts(" #{mock}_Destroy();") + end + output.puts("}\n") + end + end + + def create_suite_setup_and_teardown(output) + unless (@options[:suite_setup].nil?) + output.puts("\n//=======Suite Setup=====") + output.puts("static int suite_setup(void)") + output.puts("{") + output.puts(@options[:suite_setup]) + output.puts("}") + end + unless (@options[:suite_teardown].nil?) + output.puts("\n//=======Suite Teardown=====") + output.puts("static int suite_teardown(int num_failures)") + output.puts("{") + output.puts(@options[:suite_teardown]) + output.puts("}") + end + end + + def create_runtest(output, used_mocks) + cexception = @options[:plugins].include? :cexception + va_args1 = @options[:use_param_tests] ? ', ...' : '' + va_args2 = @options[:use_param_tests] ? '__VA_ARGS__' : '' + output.puts("\n//=======Test Runner Used To Run Each Test Below=====") + output.puts("#define RUN_TEST_NO_ARGS") if @options[:use_param_tests] + output.puts("#define RUN_TEST(TestFunc, TestLineNum#{va_args1}) \\") + output.puts("{ \\") + output.puts(" Unity.CurrentTestName = #TestFunc#{va_args2.empty? ? '' : " \"(\" ##{va_args2} \")\""}; \\") + output.puts(" Unity.CurrentTestLineNumber = TestLineNum; \\") + output.puts(" Unity.NumberOfTests++; \\") + output.puts(" if (TEST_PROTECT()) \\") + output.puts(" { \\") + output.puts(" CEXCEPTION_T e; \\") if cexception + output.puts(" Try { \\") if cexception + output.puts(" CMock_Init(); \\") unless (used_mocks.empty?) + output.puts(" setUp(); \\") + output.puts(" TestFunc(#{va_args2}); \\") + output.puts(" CMock_Verify(); \\") unless (used_mocks.empty?) + output.puts(" } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, \"Unhandled Exception!\"); } \\") if cexception + output.puts(" } \\") + output.puts(" CMock_Destroy(); \\") unless (used_mocks.empty?) + output.puts(" if (TEST_PROTECT() && !TEST_IS_IGNORED) \\") + output.puts(" { \\") + output.puts(" tearDown(); \\") + output.puts(" } \\") + output.puts(" UnityConcludeTest(); \\") + output.puts("}\n") + end + + def create_reset(output, used_mocks) + output.puts("\n//=======Test Reset Option=====") + output.puts("void resetTest()") + output.puts("{") + output.puts(" CMock_Verify();") unless (used_mocks.empty?) + output.puts(" CMock_Destroy();") unless (used_mocks.empty?) + output.puts(" tearDown();") + output.puts(" CMock_Init();") unless (used_mocks.empty?) + output.puts(" setUp();") + output.puts("}") + end + + def create_main(output, filename, tests) + output.puts("\n\n//=======MAIN=====") + output.puts("int main(void)") + output.puts("{") + output.puts(" suite_setup();") unless @options[:suite_setup].nil? + output.puts(" Unity.TestFile = \"#{filename}\";") + output.puts(" UnityBegin();") + if (@options[:use_param_tests]) + tests.each do |test| + if ((test[:args].nil?) or (test[:args].empty?)) + output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]}, RUN_TEST_NO_ARGS);") + else + test[:args].each {|args| output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]}, #{args});")} + end + end + else + tests.each { |test| output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]});") } + end + output.puts() + output.puts(" return #{@options[:suite_teardown].nil? ? "" : "suite_teardown"}(UnityEnd());") + output.puts("}") + end +end + + +if ($0 == __FILE__) + options = { :includes => [] } + yaml_file = nil + + #parse out all the options first + ARGV.reject! do |arg| + case(arg) + when '-cexception' + options[:plugins] = [:cexception]; true + when /\.*\.yml/ + options = UnityTestRunnerGenerator.grab_config(arg); true + else false + end + end + + #make sure there is at least one parameter left (the input file) + if !ARGV[0] + puts ["usage: ruby #{__FILE__} (yaml) (options) input_test_file output_test_runner (includes)", + " blah.yml - will use config options in the yml file (see docs)", + " -cexception - include cexception support"].join("\n") + exit 1 + end + + #create the default test runner name if not specified + ARGV[1] = ARGV[0].gsub(".c","_Runner.c") if (!ARGV[1]) + + #everything else is an include file + options[:includes] ||= (ARGV.slice(2..-1).flatten.compact) if (ARGV.size > 2) + + UnityTestRunnerGenerator.new(options).run(ARGV[0], ARGV[1]) +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/auto/test_file_filter.rb b/flex-bison/clcalc/tools/ceedling/vendor/unity/auto/test_file_filter.rb new file mode 100644 index 0000000..3dbc26a --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/auto/test_file_filter.rb @@ -0,0 +1,23 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require'yaml' + +module RakefileHelpers + class TestFileFilter + def initialize(all_files = false) + @all_files = all_files + if not @all_files == true + if File.exist?('test_file_filter.yml') + filters = YAML.load_file( 'test_file_filter.yml' ) + @all_files, @only_files, @exclude_files = + filters[:all_files], filters[:only_files], filters[:exclude_files] + end + end + end + attr_accessor :all_files, :only_files, :exclude_files + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/auto/unity_test_summary.rb b/flex-bison/clcalc/tools/ceedling/vendor/unity/auto/unity_test_summary.rb new file mode 100644 index 0000000..69ec2e8 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/auto/unity_test_summary.rb @@ -0,0 +1,126 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +#!/usr/bin/ruby +# +# unity_test_summary.rb +# +require 'fileutils' +require 'set' + +class UnityTestSummary + include FileUtils::Verbose + + attr_reader :report, :total_tests, :failures, :ignored + + def initialize + @report = '' + @total_tests = 0 + @failures = 0 + @ignored = 0 + end + + def run + # Clean up result file names + results = @targets.map {|target| target.gsub(/\\/,'/')} + + # Dig through each result file, looking for details on pass/fail: + failure_output = [] + ignore_output = [] + + results.each do |result_file| + lines = File.readlines(result_file).map { |line| line.chomp } + if lines.length == 0 + raise "Empty test result file: #{result_file}" + else + output = get_details(result_file, lines) + failure_output << output[:failures] unless output[:failures].empty? + ignore_output << output[:ignores] unless output[:ignores].empty? + tests,failures,ignored = parse_test_summary(lines) + @total_tests += tests + @failures += failures + @ignored += ignored + end + end + + if @ignored > 0 + @report += "\n" + @report += "--------------------------\n" + @report += "UNITY IGNORED TEST SUMMARY\n" + @report += "--------------------------\n" + @report += ignore_output.flatten.join("\n") + end + + if @failures > 0 + @report += "\n" + @report += "--------------------------\n" + @report += "UNITY FAILED TEST SUMMARY\n" + @report += "--------------------------\n" + @report += failure_output.flatten.join("\n") + end + + @report += "\n" + @report += "--------------------------\n" + @report += "OVERALL UNITY TEST SUMMARY\n" + @report += "--------------------------\n" + @report += "#{@total_tests} TOTAL TESTS #{@failures} TOTAL FAILURES #{@ignored} IGNORED\n" + @report += "\n" + end + + def set_targets(target_array) + @targets = target_array + end + + def set_root_path(path) + @root = path + end + + def usage(err_msg=nil) + puts err_msg if err_msg + puts "Usage: unity_test_summary.rb" + exit 1 + end + + protected + + @@targets=nil + @@path=nil + @@root=nil + + def get_details(result_file, lines) + results = { :failures => [], :ignores => [], :successes => [] } + lines.each do |line| + src_file,src_line,test_name,status,msg = line.split(/:/) + line_out = ((@root and (@root != 0)) ? "#{@root}#{line}" : line ).gsub(/\//, "\\") + case(status) + when 'IGNORE' then results[:ignores] << line_out + when 'FAIL' then results[:failures] << line_out + when 'PASS' then results[:successes] << line_out + end + end + return results + end + + def parse_test_summary(summary) + if summary[-3..-1].join("\n") =~ /(\d+) Tests (\d+) Failures (\d+) Ignored/ + [$1.to_i,$2.to_i,$3.to_i] + else + raise "Couldn't parse test results: #{summary}" + end + end + + def here; File.expand_path(File.dirname(__FILE__)); end + +end + +if $0 == __FILE__ + script = UnityTestSummary.new + begin + script.run + rescue Exception => e + script.usage e.message + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/docs/Unity Summary.odt b/flex-bison/clcalc/tools/ceedling/vendor/unity/docs/Unity Summary.odt new file mode 100644 index 0000000..f699661 Binary files /dev/null and b/flex-bison/clcalc/tools/ceedling/vendor/unity/docs/Unity Summary.odt differ diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/docs/Unity Summary.pdf b/flex-bison/clcalc/tools/ceedling/vendor/unity/docs/Unity Summary.pdf new file mode 100644 index 0000000..ad1a956 Binary files /dev/null and b/flex-bison/clcalc/tools/ceedling/vendor/unity/docs/Unity Summary.pdf differ diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/docs/Unity Summary.txt b/flex-bison/clcalc/tools/ceedling/vendor/unity/docs/Unity Summary.txt new file mode 100644 index 0000000..e0b179d --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/docs/Unity Summary.txt @@ -0,0 +1,217 @@ +============== +Unity Test API +============== + +[Copyright (c) 2007 - Unity Project by Mike Karlesky, Mark VanderVoord, and Greg Williams] + +------------- +Running Tests +------------- + +RUN_TEST(func, linenum) + +Each Test is run within the macro RUN_TEST. This macro performs necessary setup before the test is called and handles cleanup and result tabulation afterwards. + +-------------- +Ignoring Tests +-------------- + +There are times when a test is incomplete or not valid for some reason. At these times, TEST_IGNORE can be called. Control will immediately be returned to the caller of the test, and no failures will be returned. + +TEST_IGNORE() + +Ignore this test and return immediately + +TEST_IGNORE_MESSAGE (message) + +Ignore this test and return immediately. Output a message stating why the test was ignored. + +-------------- +Aborting Tests +-------------- + +There are times when a test will contain an infinite loop on error conditions, or there may be reason to escape from the test early without executing the rest of the test. A pair of macros support this functionality in Unity. The first (TEST_PROTECT) sets up the feature, and handles emergency abort cases. TEST_ABORT can then be used at any time within the tests to return to the last TEST_PROTECT call. + +TEST_PROTECT() + +Setup and Catch macro + +TEST_ABORT() + +Abort Test macro + +Example: + +main() +{ + if (TEST_PROTECT() == 0) + { + MyTest(); + } +} + +If MyTest calls TEST_ABORT, program control will immediately return to TEST_PROTECT with a non-zero return value. + + +======================= +Unity Assertion Summary +======================= + +-------------------- +Basic Validity Tests +-------------------- + +TEST_ASSERT_TRUE(condition) + +Evaluates whatever code is in condition and fails if it evaluates to false + +TEST_ASSERT_FALSE(condition) + +Evaluates whatever code is in condition and fails if it evaluates to true + +TEST_ASSERT(condition) + +Another way of calling TEST_ASSERT_TRUE + +TEST_ASSERT_UNLESS(condition) + +Another way of calling TEST_ASSERT_FALSE + +TEST_FAIL() +TEST_FAIL_MESSAGE(message) + +This test is automatically marked as a failure. The message is output stating why. + +------------------------------ +Numerical Assertions: Integers +------------------------------ + +TEST_ASSERT_EQUAL_INT(expected, actual) +TEST_ASSERT_EQUAL_INT8(expected, actual) +TEST_ASSERT_EQUAL_INT16(expected, actual) +TEST_ASSERT_EQUAL_INT32(expected, actual) +TEST_ASSERT_EQUAL_INT64(expected, actual) + +Compare two integers for equality and display errors as signed integers. A cast will be performed +to your natural integer size so often this can just be used. When you need to specify the exact size, +like when comparing arrays, you can use a specific version: + + + +TEST_ASSERT_EQUAL_UINT(expected, actual) + +Compare two integers for equality and display errors as unsigned integers. Like INT, there are +variants for different sizes also. + + + +TEST_ASSERT_EQUAL_HEX(expected, actual) + +Compares two integers for equality and display errors as hexadecimal. Like the other integer comparisons, +you can specify the size... here the size will also effect how many nibbles are shown (for example, HEX16 +will show 4 nibbles). + +_ARRAY + +You can append _ARRAY to any of these macros to make an array comparison of that type. Here you will +need to care a bit more about the actual size of the value being checked. You will also specify an +additional argument which is the number of elements to compare. For example: + +TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, elements) + + +TEST_ASSERT_EQUAL(expected, actual) + +Another way of calling TEST_ASSERT_EQUAL_INT + + + +TEST_ASSERT_INT_WITHIN(delta, expected, actual) + +Asserts that the actual value is within plus or minus delta of the expected value. This also comes in +size specific variants. + + +----------------------------- +Numerical Assertions: Bitwise +----------------------------- + +TEST_ASSERT_BITS(mask, expected, actual) + +Use an integer mask to specify which bits should be compared between two other integers. High bits in the mask are compared, low bits ignored. + +TEST_ASSERT_BITS_HIGH(mask, actual) + +Use an integer mask to specify which bits should be inspected to determine if they are all set high. High bits in the mask are compared, low bits ignored. + +TEST_ASSERT_BITS_LOW(mask, actual) + +Use an integer mask to specify which bits should be inspected to determine if they are all set low. High bits in the mask are compared, low bits ignored. + +TEST_ASSERT_BIT_HIGH(bit, actual) + +Test a single bit and verify that it is high. The bit is specified 0-31 for a 32-bit integer. + +TEST_ASSERT_BIT_LOW(bit, actual) + +Test a single bit and verify that it is low. The bit is specified 0-31 for a 32-bit integer. + +---------------------------- +Numerical Assertions: Floats +---------------------------- + +TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual) + +Asserts that the actual value is within plus or minus delta of the expected value. + +TEST_ASSERT_EQUAL_FLOAT(expected, actual) + +Asserts that two floating point values are "equal" within a small % delta of the expected value. + +----------------- +String Assertions +----------------- + +TEST_ASSERT_EQUAL_STRING(expected, actual) + +Compare two null-terminate strings. Fail if any character is different or if the lengths are different. + +TEST_ASSERT_EQUAL_STRING_MESSAGE(expected, actual, message) + +Compare two null-terminate strings. Fail if any character is different or if the lengths are different. Output a custom message on failure. + +------------------ +Pointer Assertions +------------------ + +Most pointer operations can be performed by simply using the integer comparisons above. However, a couple of special cases are added for clarity. + +TEST_ASSERT_NULL(pointer) + +Fails if the pointer is not equal to NULL + +TEST_ASSERT_NOT_NULL(pointer) + +Fails if the pointer is equal to NULL + + +----------------- +Memory Assertions +----------------- + +TEST_ASSERT_EQUAL_MEMORY(expected, actual, len) + +Compare two blocks of memory. This is a good generic assertion for types that can't be coerced into acting like +standard types... but since it's a memory compare, you have to be careful that your data types are packed. + +-------- +_MESSAGE +-------- + +you can append _MESSAGE to any of the macros to make them take an additional argument. This argument +is a string that will be printed at the end of the failure strings. This is useful for specifying more +information about the problem. + + + + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/docs/license.txt b/flex-bison/clcalc/tools/ceedling/vendor/unity/docs/license.txt new file mode 100644 index 0000000..c42e330 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/docs/license.txt @@ -0,0 +1,31 @@ + Copyright (c) 2007-2010 Mike Karlesky, Mark VanderVoord, Greg Williams + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + The end-user documentation included with the redistribution, if + any, must include the following acknowledgment: "This product + includes software developed for the Unity Project, by Mike Karlesky, + Mark VanderVoord, and Greg Williams and other contributors", in + the same place and form as other third-party acknowledgments. + Alternately, this acknowledgment may appear in the software + itself, in the same form and location as other such third-party + acknowledgments. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/examples/helper/UnityHelper.c b/flex-bison/clcalc/tools/ceedling/vendor/unity/examples/helper/UnityHelper.c new file mode 100644 index 0000000..9cf42c6 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/examples/helper/UnityHelper.c @@ -0,0 +1,10 @@ +#include "unity.h" +#include "UnityHelper.h" +#include +#include + +void AssertEqualExampleStruct(const EXAMPLE_STRUCT_T expected, const EXAMPLE_STRUCT_T actual, const unsigned short line) +{ + UNITY_TEST_ASSERT_EQUAL_INT(expected.x, actual.x, line, "Example Struct Failed For Field x"); + UNITY_TEST_ASSERT_EQUAL_INT(expected.y, actual.y, line, "Example Struct Failed For Field y"); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/examples/helper/UnityHelper.h b/flex-bison/clcalc/tools/ceedling/vendor/unity/examples/helper/UnityHelper.h new file mode 100644 index 0000000..1516111 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/examples/helper/UnityHelper.h @@ -0,0 +1,12 @@ +#ifndef _TESTHELPER_H +#define _TESTHELPER_H + +#include "Types.h" + +void AssertEqualExampleStruct(const EXAMPLE_STRUCT_T expected, const EXAMPLE_STRUCT_T actual, const unsigned short line); + +#define UNITY_TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(expected, actual, line, message) AssertEqualExampleStruct(expected, actual, line); + +#define TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(expected, actual) UNITY_TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(expected, actual, __LINE__, NULL); + +#endif // _TESTHELPER_H diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/examples/makefile b/flex-bison/clcalc/tools/ceedling/vendor/unity/examples/makefile new file mode 100644 index 0000000..723d390 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/examples/makefile @@ -0,0 +1,40 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +C_COMPILER=gcc +TARGET_BASE1=test1 +TARGET_BASE2=test2 +ifeq ($(OS),Windows_NT) + TARGET_EXTENSION=.exe +else + TARGET_EXTENSION=.out +endif +TARGET1 = $(TARGET_BASE1)$(TARGET_EXTENSION) +TARGET2 = $(TARGET_BASE2)$(TARGET_EXTENSION) +SRC_FILES1=../src/unity.c src/ProductionCode.c test/TestProductionCode.c test/no_ruby/TestProductionCode_Runner.c +SRC_FILES2=../src/unity.c src/ProductionCode2.c test/TestProductionCode2.c test/no_ruby/TestProductionCode2_Runner.c +INC_DIRS=-Isrc -I../src +SYMBOLS=-DTEST + +ifeq ($(OS),Windows_NT) + CLEANUP = del /F /Q build\* && del /F /Q $(TARGET1) && del /F /Q $(TARGET2) +else + CLEANUP = rm -f build/*.o ; rm -f $(TARGET1) ; rm -f $(TARGET2) +endif + +all: clean default + +default: +# ruby auto/generate_test_runner.rb test/TestProductionCode.c test/no_ruby/TestProductionCode_Runner.c +# ruby auto/generate_test_runner.rb test/TestProductionCode2.c test/no_ruby/TestProductionCode2_Runner.c + $(C_COMPILER) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES1) -o $(TARGET1) + $(C_COMPILER) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES2) -o $(TARGET2) + $(TARGET1) + $(TARGET2) + +clean: + $(CLEANUP) + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/examples/rakefile.rb b/flex-bison/clcalc/tools/ceedling/vendor/unity/examples/rakefile.rb new file mode 100644 index 0000000..0905b4b --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/examples/rakefile.rb @@ -0,0 +1,32 @@ +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require HERE+'rakefile_helper' + +include RakefileHelpers + +# Load default configuration, for now +DEFAULT_CONFIG_FILE = 'gcc.yml' +configure_toolchain(DEFAULT_CONFIG_FILE) + +task :unit do + run_tests get_unit_test_files +end + +desc "Generate test summary" +task :summary do + report_summary +end + +desc "Build and test Unity" +task :all => [:clean, :unit, :summary] +task :default => [:clobber, :all] +task :ci => [:default] +task :cruise => [:default] + +desc "Load configuration" +task :config, :config_file do |t, args| + configure_toolchain(args[:config_file]) +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/examples/rakefile_helper.rb b/flex-bison/clcalc/tools/ceedling/vendor/unity/examples/rakefile_helper.rb new file mode 100644 index 0000000..0127d69 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/examples/rakefile_helper.rb @@ -0,0 +1,260 @@ +require 'yaml' +require 'fileutils' +require HERE+'../auto/unity_test_summary' +require HERE+'../auto/generate_test_runner' +require HERE+'../auto/colour_reporter' + +module RakefileHelpers + + C_EXTENSION = '.c' + + def load_configuration(config_file) + $cfg_file = "../targets/#{config_file}" + $cfg = YAML.load(File.read($cfg_file)) + end + + def configure_clean + CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil? + end + + def configure_toolchain(config_file=DEFAULT_CONFIG_FILE) + config_file += '.yml' unless config_file =~ /\.yml$/ + load_configuration('../targets/'+config_file) + configure_clean + end + + def get_unit_test_files + path = $cfg['compiler']['unit_tests_path'] + 'Test*' + C_EXTENSION + path.gsub!(/\\/, '/') + FileList.new(path) + end + + def get_local_include_dirs + include_dirs = $cfg['compiler']['includes']['items'].dup + include_dirs.delete_if {|dir| dir.is_a?(Array)} + return include_dirs + end + + def extract_headers(filename) + includes = [] + lines = File.readlines(filename) + lines.each do |line| + m = line.match(/^\s*#include\s+\"\s*(.+\.[hH])\s*\"/) + if not m.nil? + includes << m[1] + end + end + return includes + end + + def find_source_file(header, paths) + paths.each do |dir| + src_file = dir + header.ext(C_EXTENSION) + if (File.exists?(src_file)) + return src_file + end + end + return nil + end + + def tackit(strings) + if strings.is_a?(Array) + result = "\"#{strings.join}\"" + else + result = strings + end + return result + end + + def squash(prefix, items) + result = '' + items.each { |item| result += " #{prefix}#{tackit(item)}" } + return result + end + + def build_compiler_fields + command = tackit($cfg['compiler']['path']) + if $cfg['compiler']['defines']['items'].nil? + defines = '' + else + defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items']) + end + options = squash('', $cfg['compiler']['options']) + includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :defines => defines, :options => options, :includes => includes} + end + + def compile(file, defines=[]) + compiler = build_compiler_fields + cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{file} " + + "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" + + "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" + execute(cmd_str) + end + + def build_linker_fields + command = tackit($cfg['linker']['path']) + if $cfg['linker']['options'].nil? + options = '' + else + options = squash('', $cfg['linker']['options']) + end + if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?) + includes = '' + else + includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) + end + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :options => options, :includes => includes} + end + + def link(exe_name, obj_list) + linker = build_linker_fields + cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + + (obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).join + + $cfg['linker']['bin_files']['prefix'] + ' ' + + $cfg['linker']['bin_files']['destination'] + + exe_name + $cfg['linker']['bin_files']['extension'] + execute(cmd_str) + end + + def build_simulator_fields + return nil if $cfg['simulator'].nil? + if $cfg['simulator']['path'].nil? + command = '' + else + command = (tackit($cfg['simulator']['path']) + ' ') + end + if $cfg['simulator']['pre_support'].nil? + pre_support = '' + else + pre_support = squash('', $cfg['simulator']['pre_support']) + end + if $cfg['simulator']['post_support'].nil? + post_support = '' + else + post_support = squash('', $cfg['simulator']['post_support']) + end + return {:command => command, :pre_support => pre_support, :post_support => post_support} + end + + def execute(command_string, verbose=true, raise_on_fail=true) + report command_string + output = `#{command_string}`.chomp + report(output) if (verbose && !output.nil? && (output.length > 0)) + if (($?.exitstatus != 0) and (raise_on_fail)) + raise "Command failed. (Returned #{$?.exitstatus})" + end + return output + end + + def report_summary + summary = UnityTestSummary.new + summary.set_root_path(HERE) + results_glob = "#{$cfg['compiler']['build_path']}*.test*" + results_glob.gsub!(/\\/, '/') + results = Dir[results_glob] + summary.set_targets(results) + summary.run + fail_out "FAIL: There were failures" if (summary.failures > 0) + end + + def run_tests(test_files) + + report 'Running system tests...' + + # Tack on TEST define for compiling unit tests + load_configuration($cfg_file) + test_defines = ['TEST'] + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + $cfg['compiler']['defines']['items'] << 'TEST' + + include_dirs = get_local_include_dirs + + # Build and execute each unit test + test_files.each do |test| + obj_list = [] + + # Detect dependencies and build required required modules + extract_headers(test).each do |header| + # Compile corresponding source file if it exists + src_file = find_source_file(header, include_dirs) + if !src_file.nil? + compile(src_file, test_defines) + obj_list << header.ext($cfg['compiler']['object_files']['extension']) + end + end + + # Build the test runner (generate if configured to do so) + test_base = File.basename(test, C_EXTENSION) + runner_name = test_base + '_Runner.c' + if $cfg['compiler']['runner_path'].nil? + runner_path = $cfg['compiler']['build_path'] + runner_name + test_gen = UnityTestRunnerGenerator.new($cfg_file) + test_gen.run(test, runner_path) + else + runner_path = $cfg['compiler']['runner_path'] + runner_name + end + + compile(runner_path, test_defines) + obj_list << runner_name.ext($cfg['compiler']['object_files']['extension']) + + # Build the test module + compile(test, test_defines) + obj_list << test_base.ext($cfg['compiler']['object_files']['extension']) + + # Link the test executable + link(test_base, obj_list) + + # Execute unit test and generate results file + simulator = build_simulator_fields + executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] + if simulator.nil? + cmd_str = executable + else + cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" + end + output = execute(cmd_str, true, false) + test_results = $cfg['compiler']['build_path'] + test_base + if output.match(/OK$/m).nil? + test_results += '.testfail' + else + test_results += '.testpass' + end + File.open(test_results, 'w') { |f| f.print output } + end + end + + def build_application(main) + + report "Building application..." + + obj_list = [] + load_configuration($cfg_file) + main_path = $cfg['compiler']['source_path'] + main + C_EXTENSION + + # Detect dependencies and build required required modules + include_dirs = get_local_include_dirs + extract_headers(main_path).each do |header| + src_file = find_source_file(header, include_dirs) + if !src_file.nil? + compile(src_file) + obj_list << header.ext($cfg['compiler']['object_files']['extension']) + end + end + + # Build the main source file + main_base = File.basename(main_path, C_EXTENSION) + compile(main_path) + obj_list << main_base.ext($cfg['compiler']['object_files']['extension']) + + # Create the executable + link(main_base, obj_list) + end + + def fail_out(msg) + puts msg + exit(-1) + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/examples/readme.txt b/flex-bison/clcalc/tools/ceedling/vendor/unity/examples/readme.txt new file mode 100644 index 0000000..6c7780e --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/examples/readme.txt @@ -0,0 +1,18 @@ +Example Project + +This example project gives an example of some passing, ignored, and failing tests. +It's simple and meant for you to look over and get an idea for what all of this stuff does. + +You can build and test using the makefile if you have gcc installed (you may need to tweak +the locations of some tools in the makefile). Otherwise, the rake version will let you +test with gcc or a couple versions of IAR. You can tweak the yaml files to get those versions +running. + +Ruby is required if you're using the rake version (obviously). This version shows off most of +Unity's advanced features (automatically creating test runners, fancy summaries, etc.) + +The makefile version doesn't require anything outside of your normal build tools, but won't do the +extras for you. So that you can test right away, we've written the test runners for you and +put them in the test\no_ruby subdirectory. If you make changes to the tests or source, you might +need to update these (like when you add or remove tests). Do that for a while and you'll learn +why you really want to start using the Ruby tools. \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/examples/src/ProductionCode.c b/flex-bison/clcalc/tools/ceedling/vendor/unity/examples/src/ProductionCode.c new file mode 100644 index 0000000..500b44b --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/examples/src/ProductionCode.c @@ -0,0 +1,24 @@ + +#include "ProductionCode.h" + +int Counter = 0; +int NumbersToFind[9] = { 0, 34, 55, 66, 32, 11, 1, 77, 888 }; //some obnoxious array to search that is 1-based indexing instead of 0. + +// This function is supposed to search through NumbersToFind and find a particular number. +// If it finds it, the index is returned. Otherwise 0 is returned which sorta makes sense since +// NumbersToFind is indexed from 1. Unfortunately it's broken +// (and should therefore be caught by our tests) +int FindFunction_WhichIsBroken(int NumberToFind) +{ + int i = 0; + while (i <= 8) //Notice I should have been in braces + i++; + if (NumbersToFind[i] == NumberToFind) //Yikes! I'm getting run after the loop finishes instead of during it! + return i; + return 0; +} + +int FunctionWhichReturnsLocalVariable(void) +{ + return Counter; +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/examples/src/ProductionCode.h b/flex-bison/clcalc/tools/ceedling/vendor/unity/examples/src/ProductionCode.h new file mode 100644 index 0000000..250ca0d --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/examples/src/ProductionCode.h @@ -0,0 +1,3 @@ + +int FindFunction_WhichIsBroken(int NumberToFind); +int FunctionWhichReturnsLocalVariable(void); diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/examples/src/ProductionCode2.c b/flex-bison/clcalc/tools/ceedling/vendor/unity/examples/src/ProductionCode2.c new file mode 100644 index 0000000..a8c72e1 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/examples/src/ProductionCode2.c @@ -0,0 +1,9 @@ + +#include "ProductionCode2.h" + +char* ThisFunctionHasNotBeenTested(int Poor, char* LittleFunction) +{ + //Since There Are No Tests Yet, This Function Could Be Empty For All We Know. + // Which isn't terribly useful... but at least we put in a TEST_IGNORE so we won't forget + return (char*)0; +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/examples/src/ProductionCode2.h b/flex-bison/clcalc/tools/ceedling/vendor/unity/examples/src/ProductionCode2.h new file mode 100644 index 0000000..34ae980 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/examples/src/ProductionCode2.h @@ -0,0 +1,2 @@ + +char* ThisFunctionHasNotBeenTested(int Poor, char* LittleFunction); diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/examples/test/TestProductionCode.c b/flex-bison/clcalc/tools/ceedling/vendor/unity/examples/test/TestProductionCode.c new file mode 100644 index 0000000..28a5581 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/examples/test/TestProductionCode.c @@ -0,0 +1,62 @@ + +#include "ProductionCode.h" +#include "unity.h" + +//sometimes you may want to get at local data in a module. +//for example: If you plan to pass by reference, this could be useful +//however, it should often be avoided +extern int Counter; + +void setUp(void) +{ + //This is run before EACH TEST + Counter = 0x5a5a; +} + +void tearDown(void) +{ +} + +void test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode(void) +{ + //All of these should pass + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(78)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(1)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(33)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(999)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(-1)); +} + +void test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken(void) +{ + // You should see this line fail in your test summary + TEST_ASSERT_EQUAL(1, FindFunction_WhichIsBroken(34)); + + // Notice the rest of these didn't get a chance to run because the line above failed. + // Unit tests abort each test function on the first sign of trouble. + // Then NEXT test function runs as normal. + TEST_ASSERT_EQUAL(8, FindFunction_WhichIsBroken(8888)); +} + +void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue(void) +{ + //This should be true because setUp set this up for us before this test + TEST_ASSERT_EQUAL_HEX(0x5a5a, FunctionWhichReturnsLocalVariable()); + + //This should be true because we can still change our answer + Counter = 0x1234; + TEST_ASSERT_EQUAL_HEX(0x1234, FunctionWhichReturnsLocalVariable()); +} + +void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain(void) +{ + //This should be true again because setup was rerun before this test (and after we changed it to 0x1234) + TEST_ASSERT_EQUAL_HEX(0x5a5a, FunctionWhichReturnsLocalVariable()); +} + +void test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed(void) +{ + //Sometimes you get the test wrong. When that happens, you get a failure too... and a quick look should tell + // you what actually happened...which in this case was a failure to setup the initial condition. + TEST_ASSERT_EQUAL_HEX(0x1234, FunctionWhichReturnsLocalVariable()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/examples/test/TestProductionCode2.c b/flex-bison/clcalc/tools/ceedling/vendor/unity/examples/test/TestProductionCode2.c new file mode 100644 index 0000000..20c9251 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/examples/test/TestProductionCode2.c @@ -0,0 +1,26 @@ + +#include "ProductionCode2.h" +#include "unity.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void test_IgnoredTest(void) +{ + TEST_IGNORE_MESSAGE("This Test Was Ignored On Purpose"); +} + +void test_AnotherIgnoredTest(void) +{ + TEST_IGNORE_MESSAGE("These Can Be Useful For Leaving Yourself Notes On What You Need To Do Yet"); +} + +void test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented(void) +{ + TEST_IGNORE(); //Like This +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/examples/test/no_ruby/TestProductionCode2_Runner.c b/flex-bison/clcalc/tools/ceedling/vendor/unity/examples/test/no_ruby/TestProductionCode2_Runner.c new file mode 100644 index 0000000..56515ae --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/examples/test/no_ruby/TestProductionCode2_Runner.c @@ -0,0 +1,46 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ +#include "unity.h" +#include +#include + +char MessageBuffer[50]; + +extern void setUp(void); +extern void tearDown(void); + +extern void test_IgnoredTest(void); +extern void test_AnotherIgnoredTest(void); +extern void test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented(void); + +static void runTest(UnityTestFunction test) +{ + if (TEST_PROTECT()) + { + setUp(); + test(); + } + if (TEST_PROTECT() && !TEST_IS_IGNORED) + { + tearDown(); + } +} +void resetTest() +{ + tearDown(); + setUp(); +} + + +int main(void) +{ + Unity.TestFile = "test/TestProductionCode2.c"; + UnityBegin(); + + // RUN_TEST calls runTest + RUN_TEST(test_IgnoredTest, 13); + RUN_TEST(test_AnotherIgnoredTest, 18); + RUN_TEST(test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented, 23); + + UnityEnd(); + return 0; +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/examples/test/no_ruby/TestProductionCode_Runner.c b/flex-bison/clcalc/tools/ceedling/vendor/unity/examples/test/no_ruby/TestProductionCode_Runner.c new file mode 100644 index 0000000..64112f3 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/examples/test/no_ruby/TestProductionCode_Runner.c @@ -0,0 +1,50 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ +#include "unity.h" +#include +#include + +char MessageBuffer[50]; + +extern void setUp(void); +extern void tearDown(void); + +extern void test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode(void); +extern void test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken(void); +extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue(void); +extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain(void); +extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed(void); + +static void runTest(UnityTestFunction test) +{ + if (TEST_PROTECT()) + { + setUp(); + test(); + } + if (TEST_PROTECT() && !TEST_IS_IGNORED) + { + tearDown(); + } +} +void resetTest() +{ + tearDown(); + setUp(); +} + + +int main(void) +{ + Unity.TestFile = "test/TestProductionCode.c"; + UnityBegin(); + + // RUN_TEST calls runTest + RUN_TEST(test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode, 20); + RUN_TEST(test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken, 30); + RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue, 41); + RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain, 51); + RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed, 57); + + UnityEnd(); + return 0; +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/extras/fixture/build/MakefileWorker.mk b/flex-bison/clcalc/tools/ceedling/vendor/unity/extras/fixture/build/MakefileWorker.mk new file mode 100644 index 0000000..9948751 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/extras/fixture/build/MakefileWorker.mk @@ -0,0 +1,331 @@ +#--------- +# +# MakefileWorker.mk +# +# Include this helper file in your makefile +# It makes +# A static library holding the application objs +# A test executable +# +# See this example for parameter settings +# examples/Makefile +# +#---------- +# Inputs - these variables describe what to build +# +# INCLUDE_DIRS - Directories used to search for include files. +# This generates a -I for each directory +# SRC_DIRS - Directories containing source file to built into the library +# SRC_FILES - Specific source files to build into library. Helpful when not all code +# in a directory can be built for test (hopefully a temporary situation) +# TEST_SRC_DIRS - Directories containing unit test code build into the unit test runner +# These do not go in a library. They are explicitly included in the test runner +# MOCKS_SRC_DIRS - Directories containing mock source files to build into the test runner +# These do not go in a library. They are explicitly included in the test runner +#---------- +# You can adjust these variables to influence how to build the test target +# and where to put and name outputs +# See below to determine defaults +# COMPONENT_NAME - the name of the thing being built +# UNITY_HOME - where Unity home dir found +# UNITY_BUILD_HOME - place for scripts +# UNITY_OBJS_DIR - a directory where o and d files go +# UNITY_LIB_DIR - a directory where libs go +# UNITY_ENABLE_DEBUG - build for debug +# UNITY_USE_MEM_LEAK_DETECTION - Links with overridden new and delete +# UNITY_USE_STD_CPP_LIB - Set to N to keep the standard C++ library out +# of the test harness +# UNITY_USE_GCOV - Turn on coverage analysis +# Clean then build with this flag set to Y, then 'make gcov' +# UNITY_TEST_RUNNER_FLAGS +# None by default +# UNITY_MAPFILE - generate a map file +# UNITY_WARNINGFLAGS - overly picky by default +# OTHER_MAKEFILE_TO_INCLUDE - a hook to use this makefile to make +# other targets. Like CSlim, which is part of fitnesse +#---------- +# +# Other flags users can initialize to sneak in their settings +# UNITY_CFLAGS - C complier +# UNITY_LDFLAGS - Linker flags +#---------- + + +ifndef COMPONENT_NAME + COMPONENT_NAME = name_this_in_the_makefile +endif + +# Debug on by default +ifndef UNITY_ENABLE_DEBUG + UNITY_ENABLE_DEBUG = Y +endif + +# new and delete for memory leak detection on by default +ifndef UNITY_USE_MEM_LEAK_DETECTION + UNITY_USE_MEM_LEAK_DETECTION = Y +endif + +# Use gcov, off by default +ifndef UNITY_USE_GCOV + UNITY_USE_GCOV = N +endif + +# Default warnings +ifndef UNITY_WARNINGFLAGS + UNITY_WARNINGFLAGS = -Wall -Werror -Wshadow -Wswitch-default +endif + +# Default dir for temporary files (d, o) +ifndef UNITY_OBJS_DIR + UNITY_OBJS_DIR = objs +endif + +# Default dir for the outout library +ifndef UNITY_LIB_DIR + UNITY_LIB_DIR = lib +endif + +# No map by default +ifndef UNITY_MAP_FILE + UNITY_MAP_FILE = N +endif + +#Not verbose by deafult +ifdef VERBOSE + UNITY_TEST_RUNNER_FLAGS += -v +endif + +ifdef GROUP + UNITY_TEST_RUNNER_FLAGS += -g $(GROUP) +endif + +ifdef NAME + UNITY_TEST_RUNNER_FLAGS += -n $(NAME) +endif + +ifdef REPEAT + UNITY_TEST_RUNNER_FLAGS += -r $(REPEAT) +endif + + +# -------------------------------------- +# derived flags in the following area +# -------------------------------------- +ifeq ($(UNITY_USE_MEM_LEAK_DETECTION), N) + UNITY_CFLAGS += -DUNITY_MEM_LEAK_DETECTION_DISABLED +else + UNITY_MEMLEAK_DETECTOR_MALLOC_MACRO_FILE = -include $(UNITY_HOME)/extras/fixture/src/unity_fixture_malloc_overrides.h +endif + +ifeq ($(UNITY_ENABLE_DEBUG), Y) + UNITY_CFLAGS += -g +endif + +ifeq ($(UNITY_USE_GCOV), Y) + UNITY_CFLAGS += -fprofile-arcs -ftest-coverage +endif + +UNITY_CFLAGS += $(UNITY_MEMLEAK_DETECTOR_MALLOC_MACRO_FILE) + +TARGET_MAP = $(COMPONENT_NAME).map.txt +ifeq ($(UNITY_MAP_FILE), Y) + UNITY_LDFLAGS += -Wl,-map,$(TARGET_MAP) +endif + +LD_LIBRARIES += -lgcov + +TARGET_LIB = \ + $(UNITY_LIB_DIR)/lib$(COMPONENT_NAME).a + +TEST_TARGET = \ + $(COMPONENT_NAME)_tests + +#Helper Functions +get_src_from_dir = $(wildcard $1/*.cpp) $(wildcard $1/*.c) +get_dirs_from_dirspec = $(wildcard $1) +get_src_from_dir_list = $(foreach dir, $1, $(call get_src_from_dir,$(dir))) +__src_to = $(subst .c,$1, $(subst .cpp,$1,$2)) +src_to = $(addprefix $(UNITY_OBJS_DIR)/,$(call __src_to,$1,$2)) +src_to_o = $(call src_to,.o,$1) +src_to_d = $(call src_to,.d,$1) +src_to_gcda = $(call src_to,.gcda,$1) +src_to_gcno = $(call src_to,.gcno,$1) +make_dotdot_a_subdir = $(subst ..,_dot_dot, $1) +time = $(shell date +%s) +delta_t = $(eval minus, $1, $2) +debug_print_list = $(foreach word,$1,echo " $(word)";) echo; + +#Derived +STUFF_TO_CLEAN += $(TEST_TARGET) $(TEST_TARGET).exe $(TARGET_LIB) $(TARGET_MAP) + +SRC += $(call get_src_from_dir_list, $(SRC_DIRS)) $(SRC_FILES) +OBJ = $(call src_to_o,$(SRC)) +OBJ2 = $(call make_dotdot_a_subdir. $(OBJ)) + +STUFF_TO_CLEAN += $(OBJ) + +TEST_SRC = $(call get_src_from_dir_list, $(TEST_SRC_DIRS)) +TEST_OBJS = $(call src_to_o,$(TEST_SRC)) +STUFF_TO_CLEAN += $(TEST_OBJS) + + +MOCKS_SRC = $(call get_src_from_dir_list, $(MOCKS_SRC_DIRS)) +MOCKS_OBJS = $(call src_to_o,$(MOCKS_SRC)) +STUFF_TO_CLEAN += $(MOCKS_OBJS) + +ALL_SRC = $(SRC) $(TEST_SRC) $(MOCKS_SRC) + +#Test coverage with gcov +GCOV_OUTPUT = gcov_output.txt +GCOV_REPORT = gcov_report.txt +GCOV_ERROR = gcov_error.txt +GCOV_GCDA_FILES = $(call src_to_gcda, $(ALL_SRC)) +GCOV_GCNO_FILES = $(call src_to_gcno, $(ALL_SRC)) +TEST_OUTPUT = $(TEST_TARGET).txt +STUFF_TO_CLEAN += \ + $(GCOV_OUTPUT)\ + $(GCOV_REPORT)\ + $(GCOV_REPORT).html\ + $(GCOV_ERROR)\ + $(GCOV_GCDA_FILES)\ + $(GCOV_GCNO_FILES)\ + $(TEST_OUTPUT) + + +#The gcda files for gcov need to be deleted before each run +#To avoid annoying messages. +GCOV_CLEAN = $(SILENCE)rm -f $(GCOV_GCDA_FILES) $(GCOV_OUTPUT) $(GCOV_REPORT) $(GCOV_ERROR) +RUN_TEST_TARGET = $(SILENCE) $(GCOV_CLEAN) ; echo "Running $(TEST_TARGET)"; ./$(TEST_TARGET) $(UNITY_TEST_RUNNER_FLAGS) + +INCLUDES_DIRS_EXPANDED = $(call get_dirs_from_dirspec, $(INCLUDE_DIRS)) +INCLUDES += $(foreach dir, $(INCLUDES_DIRS_EXPANDED), -I$(dir)) +MOCK_DIRS_EXPANDED = $(call get_dirs_from_dirspec, $(MOCKS_SRC_DIRS)) +INCLUDES += $(foreach dir, $(MOCK_DIRS_EXPANDED), -I$(dir)) + + +DEP_FILES = $(call src_to_d, $(ALL_SRC)) +STUFF_TO_CLEAN += $(DEP_FILES) $(PRODUCTION_CODE_START) $(PRODUCTION_CODE_END) +STUFF_TO_CLEAN += $(STDLIB_CODE_START) $(MAP_FILE) cpputest_*.xml junit_run_output + +# We'll use the UNITY_CFLAGS etc so that you can override AND add to the CppUTest flags +CFLAGS = $(UNITY_CFLAGS) $(UNITY_ADDITIONAL_CFLAGS) $(INCLUDES) $(UNITY_WARNINGFLAGS) +LDFLAGS = $(UNITY_LDFLAGS) $(UNITY_ADDITIONAL_LDFLAGS) + +# Targets + +.PHONY: all +all: start $(TEST_TARGET) + $(RUN_TEST_TARGET) + +.PHONY: start +start: $(TEST_TARGET) + $(SILENCE)START_TIME=$(call time) + +.PHONY: all_no_tests +all_no_tests: $(TEST_TARGET) + +.PHONY: flags +flags: + @echo + @echo "Compile C source with CFLAGS:" + @$(call debug_print_list,$(CFLAGS)) + @echo "Link with LDFLAGS:" + @$(call debug_print_list,$(LDFLAGS)) + @echo "Link with LD_LIBRARIES:" + @$(call debug_print_list,$(LD_LIBRARIES)) + @echo "Create libraries with ARFLAGS:" + @$(call debug_print_list,$(ARFLAGS)) + @echo "OBJ files:" + @$(call debug_print_list,$(OBJ2)) + + +$(TEST_TARGET): $(TEST_OBJS) $(MOCKS_OBJS) $(PRODUCTION_CODE_START) $(TARGET_LIB) $(USER_LIBS) $(PRODUCTION_CODE_END) $(STDLIB_CODE_START) + $(SILENCE)echo Linking $@ + $(SILENCE)$(LINK.o) -o $@ $^ $(LD_LIBRARIES) + +$(TARGET_LIB): $(OBJ) + $(SILENCE)echo Building archive $@ + $(SILENCE)mkdir -p lib + $(SILENCE)$(AR) $(ARFLAGS) $@ $^ + $(SILENCE)ranlib $@ + +test: $(TEST_TARGET) + $(RUN_TEST_TARGET) | tee $(TEST_OUTPUT) + +vtest: $(TEST_TARGET) + $(RUN_TEST_TARGET) -v | tee $(TEST_OUTPUT) + +$(UNITY_OBJS_DIR)/%.o: %.cpp + @echo compiling $(notdir $<) + $(SILENCE)mkdir -p $(dir $@) + $(SILENCE)$(COMPILE.cpp) -MMD -MP $(OUTPUT_OPTION) $< + +$(UNITY_OBJS_DIR)/%.o: %.c + @echo compiling $(notdir $<) + $(SILENCE)mkdir -p $(dir $@) + $(SILENCE)$(COMPILE.c) -MMD -MP $(OUTPUT_OPTION) $< + +ifneq "$(MAKECMDGOALS)" "clean" +-include $(DEP_FILES) +endif + +.PHONY: clean +clean: + $(SILENCE)echo Making clean + $(SILENCE)$(RM) $(STUFF_TO_CLEAN) + $(SILENCE)rm -rf gcov $(UNITY_OBJS_DIR) + $(SILENCE)find . -name "*.gcno" | xargs rm -f + $(SILENCE)find . -name "*.gcda" | xargs rm -f + +#realclean gets rid of all gcov, o and d files in the directory tree +#not just the ones made by this makefile +.PHONY: realclean +realclean: clean + $(SILENCE)rm -rf gcov + $(SILENCE)find . -name "*.gdcno" | xargs rm -f + $(SILENCE)find . -name "*.[do]" | xargs rm -f + +gcov: test + $(SILENCE)for d in $(SRC_DIRS) ; do \ + gcov --object-directory $(UNITY_OBJS_DIR)/$$d $$d/*.c $$d/*.cpp >> $(GCOV_OUTPUT) 2>>$(GCOV_ERROR) ; \ + done + $(SILENCE)for f in $(SRC_FILES) ; do \ + gcov --object-directory $(UNITY_OBJS_DIR)/$$f $$f >> $(GCOV_OUTPUT) 2>>$(GCOV_ERROR) ; \ + done + $(UNITY_BUILD_HOME)/filterGcov.sh $(GCOV_OUTPUT) $(GCOV_ERROR) $(GCOV_REPORT) $(TEST_OUTPUT) + $(SILENCE)cat $(GCOV_REPORT) + $(SILENCE)mkdir -p gcov + $(SILENCE)mv *.gcov gcov + $(SILENCE)mv gcov_* gcov + $(SILENCE)echo "See gcov directory for details" + +debug: + @echo + @echo "Target Source files:" + @$(call debug_print_list,$(SRC)) + @echo "Target Object files:" + @$(call debug_print_list,$(OBJ)) + @echo "Test Source files:" + @$(call debug_print_list,$(TEST_SRC)) + @echo "Test Object files:" + @$(call debug_print_list,$(TEST_OBJS)) + @echo "Mock Source files:" + @$(call debug_print_list,$(MOCKS_SRC)) + @echo "Mock Object files:" + @$(call debug_print_list,$(MOCKS_OBJS)) + @echo "All Input Dependency files:" + @$(call debug_print_list,$(DEP_FILES)) + @echo Stuff to clean: + @$(call debug_print_list,$(STUFF_TO_CLEAN)) + @echo Includes: + @$(call debug_print_list,$(INCLUDES)) + +ifneq "$(OTHER_MAKEFILE_TO_INCLUDE)" "" +-include $(OTHER_MAKEFILE_TO_INCLUDE) +endif + + + +st,$(TEST_SRC)) + @echo "Test Object files:" + @$(call debug_print \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/extras/fixture/build/filterGcov.sh b/flex-bison/clcalc/tools/ceedling/vendor/unity/extras/fixture/build/filterGcov.sh new file mode 100644 index 0000000..a861cf6 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/extras/fixture/build/filterGcov.sh @@ -0,0 +1,61 @@ +#!/bin/bash +INPUT_FILE=$1 +TEMP_FILE1=${INPUT_FILE}1.tmp +TEMP_FILE2=${INPUT_FILE}2.tmp +TEMP_FILE3=${INPUT_FILE}3.tmp +ERROR_FILE=$2 +OUTPUT_FILE=$3 +HTML_OUTPUT_FILE=$3.html +TEST_RESULTS=$4 + +flattenGcovOutput() { +while read line1 +do + read line2 + echo $line2 " " $line1 + read junk + read junk +done < ${INPUT_FILE} +} + +getRidOfCruft() { +sed '-e s/^Lines.*://g' \ + '-e s/^[0-9]\./ &/g' \ + '-e s/^[0-9][0-9]\./ &/g' \ + '-e s/of.*File/ /g' \ + "-e s/'//g" \ + '-e s/^.*\/usr\/.*$//g' \ + '-e s/^.*\.$//g' +} + +getFileNameRootFromErrorFile() { +sed '-e s/gc..:cannot open .* file//g' ${ERROR_FILE} +} + +writeEachNoTestCoverageFile() { +while read line +do + echo " 0.00% " ${line} +done +} + +createHtmlOutput() { + echo "" + echo "" + sed "-e s/.*% /
CoverageFile
&<\/td>/" \ + "-e s/[a-zA-Z0-9_]*\.[ch][a-z]*/&<\/a><\/td><\/tr>/" + echo "
" + sed "-e s/.*/&
/g" < ${TEST_RESULTS} +} + + +flattenGcovOutput | getRidOfCruft > ${TEMP_FILE1} +getFileNameRootFromErrorFile | writeEachNoTestCoverageFile > ${TEMP_FILE2} +cat ${TEMP_FILE1} ${TEMP_FILE2} | sort | uniq > ${OUTPUT_FILE} +createHtmlOutput < ${OUTPUT_FILE} > ${HTML_OUTPUT_FILE} +rm -f ${TEMP_FILE1} ${TEMP_FILE2} +erageFile" + sed "-e s/.*% /&<\/td>/" \ + "-e s/[a-zA-Z0-9_]*\.[ch][a-z]*/&<\/a><\/td><\/tr>/" + echo "" + sed "-e s/.*/&
/g" < ${TEST_RESULTS \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/extras/fixture/rakefile.rb b/flex-bison/clcalc/tools/ceedling/vendor/unity/extras/fixture/rakefile.rb new file mode 100644 index 0000000..6181707 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/extras/fixture/rakefile.rb @@ -0,0 +1,37 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require HERE + 'rakefile_helper' + +include RakefileHelpers + +# Load default configuration, for now +DEFAULT_CONFIG_FILE = 'gcc.yml' +configure_toolchain(DEFAULT_CONFIG_FILE) + +task :unit do + run_tests +end + +desc "Build and test Unity Framework" +task :all => [:clean, :unit] +task :default => [:clobber, :all] +task :ci => [:no_color, :default] +task :cruise => [:no_color, :default] + +desc "Load configuration" +task :config, :config_file do |t, args| + configure_toolchain(args[:config_file]) +end + +task :no_color do + $colour_output = false +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/extras/fixture/rakefile_helper.rb b/flex-bison/clcalc/tools/ceedling/vendor/unity/extras/fixture/rakefile_helper.rb new file mode 100644 index 0000000..a7f6a28 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/extras/fixture/rakefile_helper.rb @@ -0,0 +1,178 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require 'yaml' +require 'fileutils' +require HERE+'../../auto/unity_test_summary' +require HERE+'../../auto/generate_test_runner' +require HERE+'../../auto/colour_reporter' + +module RakefileHelpers + + C_EXTENSION = '.c' + + def load_configuration(config_file) + unless ($configured) + $cfg_file = HERE+"../../targets/#{config_file}" unless (config_file =~ /[\\|\/]/) + $cfg = YAML.load(File.read($cfg_file)) + $colour_output = false unless $cfg['colour'] + $configured = true if (config_file != DEFAULT_CONFIG_FILE) + end + end + + def configure_clean + CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil? + end + + def configure_toolchain(config_file=DEFAULT_CONFIG_FILE) + config_file += '.yml' unless config_file =~ /\.yml$/ + config_file = config_file unless config_file =~ /[\\|\/]/ + load_configuration(config_file) + configure_clean + end + + def tackit(strings) + if strings.is_a?(Array) + result = "\"#{strings.join}\"" + else + result = strings + end + return result + end + + def squash(prefix, items) + result = '' + items.each { |item| result += " #{prefix}#{tackit(item)}" } + return result + end + + def build_compiler_fields + command = tackit($cfg['compiler']['path']) + if $cfg['compiler']['defines']['items'].nil? + defines = '' + else + defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items'] + ['UNITY_OUTPUT_CHAR=UnityOutputCharSpy_OutputChar']) + end + options = squash('', $cfg['compiler']['options']) + includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :defines => defines, :options => options, :includes => includes} + end + + def compile(file, defines=[]) + compiler = build_compiler_fields + unity_include = $cfg['compiler']['includes']['prefix']+'../../src' + cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{unity_include} #{file} " + + "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" + + "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" + execute(cmd_str) + end + + def build_linker_fields + command = tackit($cfg['linker']['path']) + if $cfg['linker']['options'].nil? + options = '' + else + options = squash('', $cfg['linker']['options']) + end + if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?) + includes = '' + else + includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) + end + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :options => options, :includes => includes} + end + + def link(exe_name, obj_list) + linker = build_linker_fields + cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + + (obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).join + + $cfg['linker']['bin_files']['prefix'] + ' ' + + $cfg['linker']['bin_files']['destination'] + + exe_name + $cfg['linker']['bin_files']['extension'] + execute(cmd_str) + end + + def build_simulator_fields + return nil if $cfg['simulator'].nil? + if $cfg['simulator']['path'].nil? + command = '' + else + command = (tackit($cfg['simulator']['path']) + ' ') + end + if $cfg['simulator']['pre_support'].nil? + pre_support = '' + else + pre_support = squash('', $cfg['simulator']['pre_support']) + end + if $cfg['simulator']['post_support'].nil? + post_support = '' + else + post_support = squash('', $cfg['simulator']['post_support']) + end + return {:command => command, :pre_support => pre_support, :post_support => post_support} + end + + def execute(command_string, verbose=true) + report command_string + output = `#{command_string}`.chomp + report(output) if (verbose && !output.nil? && (output.length > 0)) + if ($?.exitstatus != 0) + raise "Command failed. (Returned #{$?.exitstatus})" + end + return output + end + + def report_summary + summary = UnityTestSummary.new + summary.set_root_path(HERE) + results_glob = "#{$cfg['compiler']['build_path']}*.test*" + results_glob.gsub!(/\\/, '/') + results = Dir[results_glob] + summary.set_targets(results) + summary.run + end + + def run_tests + report 'Running Unity system tests...' + + # Tack on TEST define for compiling unit tests + load_configuration($cfg_file) + test_defines = ['TEST'] + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + + # Get a list of all source files needed + src_files = Dir[HERE+'src/*.c'] + src_files += Dir[HERE+'test/*.c'] + src_files << '../../src/Unity.c' + + # Build object files + src_files.each { |f| compile(f, test_defines) } + obj_list = src_files.map {|f| File.basename(f.ext($cfg['compiler']['object_files']['extension'])) } + + # Link the test executable + test_base = "framework_test" + link(test_base, obj_list) + + # Execute unit test and generate results file + simulator = build_simulator_fields + executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] + if simulator.nil? + cmd_str = executable + " -v -r" + else + cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" + end + output = execute(cmd_str) + test_results = $cfg['compiler']['build_path'] + test_base + if output.match(/OK$/m).nil? + test_results += '.testfail' + else + test_results += '.testpass' + end + File.open(test_results, 'w') { |f| f.print output } + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/extras/fixture/readme.txt b/flex-bison/clcalc/tools/ceedling/vendor/unity/extras/fixture/readme.txt new file mode 100644 index 0000000..6b9a78c --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/extras/fixture/readme.txt @@ -0,0 +1,9 @@ +Copyright (c) 2010 James Grenning and Contributed to Unity Project + +Unity Project - A Test Framework for C +Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +[Released under MIT License. Please refer to license.txt for details] + +This Framework is an optional add-on to Unity. By including unity_framework.h in place of unity.h, +you may now work with Unity in a manner similar to CppUTest. This framework adds the concepts of +test groups and gives finer control of your tests over the command line. \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/extras/fixture/src/unity_fixture.c b/flex-bison/clcalc/tools/ceedling/vendor/unity/extras/fixture/src/unity_fixture.c new file mode 100644 index 0000000..1ba3e9a --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/extras/fixture/src/unity_fixture.c @@ -0,0 +1,381 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" +#include "unity_internals.h" +#include + +UNITY_FIXTURE_T UnityFixture; + +//If you decide to use the function pointer approach. +int (*outputChar)(int) = putchar; + +int verbose = 0; + +void setUp(void) { /*does nothing*/ } +void tearDown(void) { /*does nothing*/ } + +void announceTestRun(int runNumber) +{ + UnityPrint("Unity test run "); + UnityPrintNumber(runNumber+1); + UnityPrint(" of "); + UnityPrintNumber(UnityFixture.RepeatCount); + UNITY_OUTPUT_CHAR('\n'); +} + +int UnityMain(int argc, char* argv[], void (*runAllTests)()) +{ + int result = UnityGetCommandLineOptions(argc, argv); + int r; + if (result != 0) + return result; + + for (r = 0; r < UnityFixture.RepeatCount; r++) + { + announceTestRun(r); + UnityBegin(); + runAllTests(); + UNITY_OUTPUT_CHAR('\n'); + UnityEnd(); + } + + return UnityFailureCount(); +} + +static int selected(const char * filter, const char * name) +{ + if (filter == 0) + return 1; + return strstr(name, filter) ? 1 : 0; +} + +static int testSelected(const char* test) +{ + return selected(UnityFixture.NameFilter, test); +} + +static int groupSelected(const char* group) +{ + return selected(UnityFixture.GroupFilter, group); +} + +static void runTestCase() +{ + +} + +void UnityTestRunner(unityfunction* setup, + unityfunction* testBody, + unityfunction* teardown, + const char * printableName, + const char * group, + const char * name, + const char * file, int line) +{ + if (testSelected(name) && groupSelected(group)) + { + Unity.CurrentTestFailed = 0; + Unity.TestFile = file; + Unity.CurrentTestName = printableName; + Unity.CurrentTestLineNumber = line; + if (!UnityFixture.Verbose) + UNITY_OUTPUT_CHAR('.'); + else + UnityPrint(printableName); + + Unity.NumberOfTests++; + UnityMalloc_StartTest(); + UnityPointer_Init(); + + runTestCase(); + if (TEST_PROTECT()) + { + setup(); + testBody(); + } + if (TEST_PROTECT()) + { + teardown(); + } + if (TEST_PROTECT()) + { + UnityPointer_UndoAllSets(); + if (!Unity.CurrentTestFailed) + UnityMalloc_EndTest(); + UnityConcludeFixtureTest(); + } + else + { + //aborting - jwg - di i need these for the other TEST_PROTECTS? + } + } +} + +void UnityIgnoreTest() +{ + Unity.NumberOfTests++; + Unity.CurrentTestIgnored = 1; + UNITY_OUTPUT_CHAR('!'); +} + + +//------------------------------------------------- +//Malloc and free stuff +// +#define MALLOC_DONT_FAIL -1 +static int malloc_count; +static int malloc_fail_countdown = MALLOC_DONT_FAIL; + +void UnityMalloc_StartTest() +{ + malloc_count = 0; + malloc_fail_countdown = MALLOC_DONT_FAIL; +} + +void UnityMalloc_EndTest() +{ + malloc_fail_countdown = MALLOC_DONT_FAIL; + if (malloc_count != 0) + { + TEST_FAIL_MESSAGE("This test leaks!"); + } +} + +void UnityMalloc_MakeMallocFailAfterCount(int countdown) +{ + malloc_fail_countdown = countdown; +} + +#ifdef malloc +#undef malloc +#endif + +#ifdef free +#undef free +#endif + +#include +#include + +typedef struct GuardBytes +{ + int size; + char guard[sizeof(int)]; +} Guard; + + +static const char * end = "END"; + +void * unity_malloc(size_t size) +{ + char* mem; + Guard* guard; + + if (malloc_fail_countdown != MALLOC_DONT_FAIL) + { + if (malloc_fail_countdown == 0) + return 0; + malloc_fail_countdown--; + } + + malloc_count++; + + guard = (Guard*)malloc(size + sizeof(Guard) + 4); + guard->size = size; + mem = (char*)&(guard[1]); + memcpy(&mem[size], end, strlen(end) + 1); + + return (void*)mem; +} + +static int isOverrun(void * mem) +{ + Guard* guard = (Guard*)mem; + char* memAsChar = (char*)mem; + guard--; + + return strcmp(&memAsChar[guard->size], end) != 0; +} + +static void release_memory(void * mem) +{ + Guard* guard = (Guard*)mem; + guard--; + + malloc_count--; + free(guard); +} + +void unity_free(void * mem) +{ + int overrun = isOverrun(mem);//strcmp(&memAsChar[guard->size], end) != 0; + release_memory(mem); + if (overrun) + { + TEST_FAIL_MESSAGE("Buffer overrun detected during free()"); + } +} + +void* unity_calloc(size_t num, size_t size) +{ + void* mem = unity_malloc(num * size); + memset(mem, 0, num*size); + return mem; +} + +void* unity_realloc(void * oldMem, size_t size) +{ + Guard* guard = (Guard*)oldMem; +// char* memAsChar = (char*)oldMem; + void* newMem; + + if (oldMem == 0) + return unity_malloc(size); + + guard--; + if (isOverrun(oldMem)) + { + release_memory(oldMem); + TEST_FAIL_MESSAGE("Buffer overrun detected during realloc()"); + } + + if (size == 0) + { + release_memory(oldMem); + return 0; + } + + if (guard->size >= size) + return oldMem; + + newMem = unity_malloc(size); + memcpy(newMem, oldMem, size); + unity_free(oldMem); + return newMem; +} + + +//-------------------------------------------------------- +//Automatic pointer restoration functions +typedef struct _PointerPair +{ + struct _PointerPair * next; + void ** pointer; + void * old_value; +} PointerPair; + +enum {MAX_POINTERS=50}; +static PointerPair pointer_store[MAX_POINTERS]; +static int pointer_index = 0; + +void UnityPointer_Init() +{ + pointer_index = 0; +} + +void UnityPointer_Set(void ** pointer, void * newValue) +{ + if (pointer_index >= MAX_POINTERS) + TEST_FAIL_MESSAGE("Too many pointers set"); + + pointer_store[pointer_index].pointer = pointer; + pointer_store[pointer_index].old_value = *pointer; + *pointer = newValue; + pointer_index++; +} + +void UnityPointer_UndoAllSets() +{ + while (pointer_index > 0) + { + pointer_index--; + *(pointer_store[pointer_index].pointer) = + pointer_store[pointer_index].old_value; + + } +} + +int UnityFailureCount() +{ + return Unity.TestFailures; +} + +int UnityGetCommandLineOptions(int argc, char* argv[]) +{ + int i; + UnityFixture.Verbose = 0; + UnityFixture.GroupFilter = 0; + UnityFixture.NameFilter = 0; + UnityFixture.RepeatCount = 1; + + if (argc == 1) + return 0; + + for (i = 1; i < argc; ) + { + if (strcmp(argv[i], "-v") == 0) + { + UnityFixture.Verbose = 1; + i++; + } + else if (strcmp(argv[i], "-g") == 0) + { + i++; + if (i >= argc) + return 1; + UnityFixture.GroupFilter = argv[i]; + i++; + } + else if (strcmp(argv[i], "-n") == 0) + { + i++; + if (i >= argc) + return 1; + UnityFixture.NameFilter = argv[i]; + i++; + } + else if (strcmp(argv[i], "-r") == 0) + { + UnityFixture.RepeatCount = 2; + i++; + if (i < argc) + { + if (*(argv[i]) >= '0' && *(argv[i]) <= '9') + { + UnityFixture.RepeatCount = atoi(argv[i]); + i++; + } + } + } + } + return 0; +} + +void UnityConcludeFixtureTest() +{ + if (Unity.CurrentTestIgnored) + { + Unity.TestIgnores++; + } + else if (!Unity.CurrentTestFailed) + { + if (UnityFixture.Verbose) + { + UnityPrint(" PASS"); + UNITY_OUTPUT_CHAR('\n'); + } + } + else if (Unity.CurrentTestFailed) + { + Unity.TestFailures++; + } + + Unity.CurrentTestFailed = 0; + Unity.CurrentTestIgnored = 0; +} + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/extras/fixture/src/unity_fixture.h b/flex-bison/clcalc/tools/ceedling/vendor/unity/extras/fixture/src/unity_fixture.h new file mode 100644 index 0000000..da1f871 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/extras/fixture/src/unity_fixture.h @@ -0,0 +1,81 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FIXTURE_H_ +#define UNITY_FIXTURE_H_ + +#include "unity.h" +#include "unity_internals.h" +#include "unity_fixture_malloc_overrides.h" +#include "unity_fixture_internals.h" + +int UnityMain(int argc, char* argv[], void (*runAllTests)()); + + +#define TEST_GROUP(group)\ + int TEST_GROUP_##group = 0 + +#define TEST_SETUP(group) void TEST_##group##_SETUP() + +#define TEST_TEAR_DOWN(group) void TEST_##group##_TEAR_DOWN() + + +#define TEST(group, name) \ + void TEST_##group##_##name##_();\ + void TEST_##group##_##name##_run()\ + {\ + UnityTestRunner(TEST_##group##_SETUP,\ + TEST_##group##_##name##_,\ + TEST_##group##_TEAR_DOWN,\ + "TEST(" #group ", " #name ")",\ + #group, #name,\ + __FILE__, __LINE__);\ + }\ + void TEST_##group##_##name##_() + +#define IGNORE_TEST(group, name) \ + void TEST_##group##_##name##_();\ + void TEST_##group##_##name##_run()\ + {\ + UnityIgnoreTest();\ + }\ + void TEST_##group##_##name##_() + +#define DECLARE_TEST_CASE(group, name) \ + void TEST_##group##_##name##_run() + +#define RUN_TEST_CASE(group, name) \ + DECLARE_TEST_CASE(group, name);\ + TEST_##group##_##name##_run(); + +//This goes at the bottom of each test file or in a separate c file +#define TEST_GROUP_RUNNER(group)\ + void TEST_##group##_GROUP_RUNNER_runAll();\ + void TEST_##group##_GROUP_RUNNER()\ + {\ + TEST_##group##_GROUP_RUNNER_runAll();\ + }\ + void TEST_##group##_GROUP_RUNNER_runAll() + +//Call this from main +#define RUN_TEST_GROUP(group)\ + void TEST_##group##_GROUP_RUNNER();\ + TEST_##group##_GROUP_RUNNER(); + +//CppUTest Compatibility Macros +#define UT_PTR_SET(ptr, newPointerValue) UnityPointer_Set((void**)&ptr, (void*)newPointerValue) +#define TEST_ASSERT_POINTERS_EQUAL(expected, actual) TEST_ASSERT_EQUAL_PTR(expected, actual) +#define TEST_ASSERT_BYTES_EQUAL(expected, actual) TEST_ASSERT_EQUAL_HEX8(0xff & (expected), 0xff & (actual)) +#define FAIL(message) TEST_FAIL((message)) +#define CHECK(condition) TEST_ASSERT_TRUE((condition)) +#define LONGS_EQUAL(expected, actual) TEST_ASSERT_EQUAL_INT((expected), (actual)) +#define STRCMP_EQUAL(expected, actual) TEST_ASSERT_EQUAL_STRING((expected), (actual)) +#define DOUBLES_EQUAL(expected, actual, delta) TEST_ASSERT_FLOAT_WITHIN(((expected), (actual), (delta)) + +void UnityMalloc_MakeMallocFailAfterCount(int count); + +#endif /* UNITY_FIXTURE_H_ */ diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/extras/fixture/src/unity_fixture_internals.h b/flex-bison/clcalc/tools/ceedling/vendor/unity/extras/fixture/src/unity_fixture_internals.h new file mode 100644 index 0000000..db23f67 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/extras/fixture/src/unity_fixture_internals.h @@ -0,0 +1,44 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FIXTURE_INTERNALS_H_ +#define UNITY_FIXTURE_INTERNALS_H_ + +typedef struct _UNITY_FIXTURE_T +{ + int Verbose; + unsigned int RepeatCount; + const char* NameFilter; + const char* GroupFilter; +} UNITY_FIXTURE_T; + +typedef void unityfunction(); +void UnityTestRunner(unityfunction * setup, + unityfunction * body, + unityfunction * teardown, + const char * printableName, + const char * group, + const char * name, + const char * file, int line); + +void UnityIgnoreTest(); +void UnityMalloc_StartTest(); +void UnityMalloc_EndTest(); +int UnityFailureCount(); +int UnityGetCommandLineOptions(int argc, char* argv[]); +void UnityConcludeFixtureTest(); + +void UnityPointer_Set(void ** ptr, void * newValue); +void UnityPointer_UndoAllSets(); +void UnityPointer_Init(); + +void UnityAssertEqualPointer(const void * expected, + const void * actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +#endif /* UNITY_FIXTURE_INTERNALS_H_ */ diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h b/flex-bison/clcalc/tools/ceedling/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h new file mode 100644 index 0000000..38f8e34 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h @@ -0,0 +1,16 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FIXTURE_MALLOC_OVERRIDES_H_ +#define UNITY_FIXTURE_MALLOC_OVERRIDES_H_ + +#define malloc unity_malloc +#define calloc unity_calloc +#define realloc unity_realloc +#define free unity_free + +#endif /* UNITY_FIXTURE_MALLOC_OVERRIDES_H_ */ diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/extras/fixture/test/main/AllTests.c b/flex-bison/clcalc/tools/ceedling/vendor/unity/extras/fixture/test/main/AllTests.c new file mode 100644 index 0000000..ccb775b --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/extras/fixture/test/main/AllTests.c @@ -0,0 +1,21 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" + +static void runAllTests() +{ + RUN_TEST_GROUP(UnityFixture); + RUN_TEST_GROUP(UnityCommandOptions); + RUN_TEST_GROUP(LeakDetection) +} + +int main(int argc, char* argv[]) +{ + return UnityMain(argc, argv, runAllTests); +} + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/extras/fixture/test/testunity_fixture.c b/flex-bison/clcalc/tools/ceedling/vendor/unity/extras/fixture/test/testunity_fixture.c new file mode 100644 index 0000000..de0c04c --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/extras/fixture/test/testunity_fixture.c @@ -0,0 +1,39 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" + +static int data = -1; + +TEST_GROUP(mygroup); + +TEST_SETUP(mygroup) +{ + data = 0; +} + +TEST_TEAR_DOWN(mygroup) +{ + data = -1; +} + +TEST(mygroup, test1) +{ + TEST_ASSERT_EQUAL_INT(0, data); +} + +TEST(mygroup, test2) +{ + TEST_ASSERT_EQUAL_INT(0, data); + data = 5; +} + +TEST(mygroup, test3) +{ + data = 7; + TEST_ASSERT_EQUAL_INT(7, data); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/extras/fixture/test/unity_fixture_Test.c b/flex-bison/clcalc/tools/ceedling/vendor/unity/extras/fixture/test/unity_fixture_Test.c new file mode 100644 index 0000000..b8b4524 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/extras/fixture/test/unity_fixture_Test.c @@ -0,0 +1,321 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" +#include "unity_output_Spy.h" +#include +#include + +extern UNITY_FIXTURE_T UnityFixture; + +TEST_GROUP(UnityFixture); + +TEST_SETUP(UnityFixture) +{ +} + +TEST_TEAR_DOWN(UnityFixture) +{ +} + +int my_int; +int* pointer1 = 0; +int* pointer2 = (int*)2; +int* pointer3 = (int*)3; +int int1; +int int2; +int int3; +int int4; + +TEST(UnityFixture, PointerSetting) +{ + TEST_ASSERT_POINTERS_EQUAL(pointer1, 0); + UT_PTR_SET(pointer1, &int1); + UT_PTR_SET(pointer2, &int2); + UT_PTR_SET(pointer3, &int3); + TEST_ASSERT_POINTERS_EQUAL(pointer1, &int1); + TEST_ASSERT_POINTERS_EQUAL(pointer2, &int2); + TEST_ASSERT_POINTERS_EQUAL(pointer3, &int3); + UT_PTR_SET(pointer1, &int4); + UnityPointer_UndoAllSets(); + TEST_ASSERT_POINTERS_EQUAL(pointer1, 0); + TEST_ASSERT_POINTERS_EQUAL(pointer2, (int*)2); + TEST_ASSERT_POINTERS_EQUAL(pointer3, (int*)3); +} + +TEST(UnityFixture, ForceMallocFail) +{ + UnityMalloc_MakeMallocFailAfterCount(1); + void* m = malloc(10); + CHECK(m); + void* mfails = malloc(10); + TEST_ASSERT_POINTERS_EQUAL(0, mfails); + free(m); +} + +TEST(UnityFixture, ReallocSmallerIsUnchanged) +{ + void* m1 = malloc(10); + void* m2 = realloc(m1, 5); + TEST_ASSERT_POINTERS_EQUAL(m1, m2); + free(m2); +} + +TEST(UnityFixture, ReallocSameIsUnchanged) +{ + void* m1 = malloc(10); + void* m2 = realloc(m1, 10); + TEST_ASSERT_POINTERS_EQUAL(m1, m2); + free(m2); +} + +TEST(UnityFixture, ReallocLargerNeeded) +{ + void* m1 = malloc(10); + strcpy((char*)m1, "123456789"); + void* m2 = realloc(m1, 15); + CHECK(m1 != m2); + STRCMP_EQUAL("123456789", m2); + free(m2); +} + +TEST(UnityFixture, ReallocNullPointerIsLikeMalloc) +{ + void* m = realloc(0, 15); + CHECK(m != 0); + free(m); +} + +TEST(UnityFixture, ReallocSizeZeroFreesMemAndReturnsNullPointer) +{ + void* m1 = malloc(10); + void* m2 = realloc(m1, 0); + TEST_ASSERT_POINTERS_EQUAL(0, m2); +} + +TEST(UnityFixture, CallocFillsWithZero) +{ + void* m = calloc(3, sizeof(char)); + char* s = (char*)m; + TEST_ASSERT_BYTES_EQUAL(0, s[0]); + TEST_ASSERT_BYTES_EQUAL(0, s[1]); + TEST_ASSERT_BYTES_EQUAL(0, s[2]); + free(m); +} + +char *p1; +char *p2; + +TEST(UnityFixture, PointerSet) +{ + char c1; + char c2; + char newC1; + char newC2; + p1 = &c1; + p2 = &c2; + + UnityPointer_Init(10); + UT_PTR_SET(p1, &newC1); + UT_PTR_SET(p2, &newC2); + TEST_ASSERT_POINTERS_EQUAL(&newC1, p1); + TEST_ASSERT_POINTERS_EQUAL(&newC2, p2); + UnityPointer_UndoAllSets(); + TEST_ASSERT_POINTERS_EQUAL(&c1, p1); + TEST_ASSERT_POINTERS_EQUAL(&c2, p2); +} + +//------------------------------------------------------------ + +TEST_GROUP(UnityCommandOptions); + +int savedVerbose; +int savedRepeat; +const char* savedName; +const char* savedGroup; + +TEST_SETUP(UnityCommandOptions) +{ + savedVerbose = UnityFixture.Verbose; + savedRepeat = UnityFixture.RepeatCount; + savedName = UnityFixture.NameFilter; + savedGroup = UnityFixture.GroupFilter; +} + +TEST_TEAR_DOWN(UnityCommandOptions) +{ + UnityFixture.Verbose = savedVerbose; + UnityFixture.RepeatCount= savedRepeat; + UnityFixture.NameFilter = savedName; + UnityFixture.GroupFilter = savedGroup; +} + + +static char* noOptions[] = { + "testrunner.exe" +}; + +TEST(UnityCommandOptions, DefaultOptions) +{ + UnityGetCommandLineOptions(1, noOptions); + TEST_ASSERT_EQUAL(0, UnityFixture.Verbose); + TEST_ASSERT_POINTERS_EQUAL(0, UnityFixture.GroupFilter); + TEST_ASSERT_POINTERS_EQUAL(0, UnityFixture.NameFilter); + TEST_ASSERT_EQUAL(1, UnityFixture.RepeatCount); +} + +static char* verbose[] = { + "testrunner.exe", + "-v" +}; + +TEST(UnityCommandOptions, OptionVerbose) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(2, verbose)); + TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); +} + +static char* group[] = { + "testrunner.exe", + "-g", "groupname" +}; + +TEST(UnityCommandOptions, OptionSelectTestByGroup) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, group)); + STRCMP_EQUAL("groupname", UnityFixture.GroupFilter); +} + +static char* name[] = { + "testrunner.exe", + "-n", "testname" +}; + +TEST(UnityCommandOptions, OptionSelectTestByName) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, name)); + STRCMP_EQUAL("testname", UnityFixture.NameFilter); +} + +static char* repeat[] = { + "testrunner.exe", + "-r", "99" +}; + +TEST(UnityCommandOptions, OptionSelectRepeatTestsDefaultCount) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(2, repeat)); + TEST_ASSERT_EQUAL(2, UnityFixture.RepeatCount); +} + +TEST(UnityCommandOptions, OptionSelectRepeatTestsSpecificCount) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, repeat)); + TEST_ASSERT_EQUAL(99, UnityFixture.RepeatCount); +} + +static char* multiple[] = { + "testrunner.exe", + "-v", + "-g", "groupname", + "-n", "testname", + "-r", "98" +}; + +TEST(UnityCommandOptions, MultipleOptions) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(8, multiple)); + TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); + STRCMP_EQUAL("groupname", UnityFixture.GroupFilter); + STRCMP_EQUAL("testname", UnityFixture.NameFilter); + TEST_ASSERT_EQUAL(98, UnityFixture.RepeatCount); +} + +static char* dashRNotLast[] = { + "testrunner.exe", + "-v", + "-g", "gggg", + "-r", + "-n", "tttt", +}; + +TEST(UnityCommandOptions, MultipleOptionsDashRNotLastAndNoValueSpecified) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(7, dashRNotLast)); + TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); + STRCMP_EQUAL("gggg", UnityFixture.GroupFilter); + STRCMP_EQUAL("tttt", UnityFixture.NameFilter); + TEST_ASSERT_EQUAL(2, UnityFixture.RepeatCount); +} + + +//------------------------------------------------------------ + +TEST_GROUP(LeakDetection); + +TEST_SETUP(LeakDetection) +{ + UnityOutputCharSpy_Create(1000); +} + +TEST_TEAR_DOWN(LeakDetection) +{ + UnityOutputCharSpy_Destroy(); +} + +#define EXPECT_ABORT_BEGIN \ + { \ + jmp_buf TestAbortFrame; \ + memcpy(TestAbortFrame, Unity.AbortFrame, sizeof(jmp_buf)); \ + if (TEST_PROTECT()) \ + { + +#define EXPECT_ABORT_END \ + } \ + memcpy(Unity.AbortFrame, TestAbortFrame, sizeof(jmp_buf)); \ + } + +TEST(LeakDetection, DetectsLeak) +{ + void* m = malloc(10); + UnityOutputCharSpy_Enable(1); + EXPECT_ABORT_BEGIN + UnityMalloc_EndTest(); + EXPECT_ABORT_END + UnityOutputCharSpy_Enable(0); + CHECK(strstr(UnityOutputCharSpy_Get(), "This test leaks!")); + free(m); + Unity.CurrentTestFailed = 0; +} + +TEST(LeakDetection, BufferOverrunFoundDuringFree) +{ + void* m = malloc(10); + char* s = (char*)m; + s[10] = (char)0xFF; + UnityOutputCharSpy_Enable(1); + EXPECT_ABORT_BEGIN + free(m); + EXPECT_ABORT_END + UnityOutputCharSpy_Enable(0); + CHECK(strstr(UnityOutputCharSpy_Get(), "Buffer overrun detected during free()")); + Unity.CurrentTestFailed = 0; +} + +TEST(LeakDetection, BufferOverrunFoundDuringRealloc) +{ + void* m = malloc(10); + char* s = (char*)m; + s[10] = (char)0xFF; + UnityOutputCharSpy_Enable(1); + EXPECT_ABORT_BEGIN + m = realloc(m, 100); + EXPECT_ABORT_END + UnityOutputCharSpy_Enable(0); + CHECK(strstr(UnityOutputCharSpy_Get(), "Buffer overrun detected during realloc()")); + Unity.CurrentTestFailed = 0; +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c b/flex-bison/clcalc/tools/ceedling/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c new file mode 100644 index 0000000..80fec09 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c @@ -0,0 +1,40 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" + +TEST_GROUP_RUNNER(UnityFixture) +{ + RUN_TEST_CASE(UnityFixture, PointerSetting); + RUN_TEST_CASE(UnityFixture, ForceMallocFail); + RUN_TEST_CASE(UnityFixture, ReallocSmallerIsUnchanged); + RUN_TEST_CASE(UnityFixture, ReallocSameIsUnchanged); + RUN_TEST_CASE(UnityFixture, ReallocLargerNeeded); + RUN_TEST_CASE(UnityFixture, ReallocNullPointerIsLikeMalloc); + RUN_TEST_CASE(UnityFixture, ReallocSizeZeroFreesMemAndReturnsNullPointer); + RUN_TEST_CASE(UnityFixture, CallocFillsWithZero); + RUN_TEST_CASE(UnityFixture, PointerSet); +} + +TEST_GROUP_RUNNER(UnityCommandOptions) +{ + RUN_TEST_CASE(UnityCommandOptions, DefaultOptions); + RUN_TEST_CASE(UnityCommandOptions, OptionVerbose); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectTestByGroup); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectTestByName); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectRepeatTestsDefaultCount); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectRepeatTestsSpecificCount); + RUN_TEST_CASE(UnityCommandOptions, MultipleOptions); + RUN_TEST_CASE(UnityCommandOptions, MultipleOptionsDashRNotLastAndNoValueSpecified); +} + +TEST_GROUP_RUNNER(LeakDetection) +{ + RUN_TEST_CASE(LeakDetection, DetectsLeak); + RUN_TEST_CASE(LeakDetection, BufferOverrunFoundDuringFree); + RUN_TEST_CASE(LeakDetection, BufferOverrunFoundDuringRealloc); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/extras/fixture/test/unity_output_Spy.c b/flex-bison/clcalc/tools/ceedling/vendor/unity/extras/fixture/test/unity_output_Spy.c new file mode 100644 index 0000000..16faefa --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/extras/fixture/test/unity_output_Spy.c @@ -0,0 +1,56 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + + +#include "unity_output_Spy.h" +#include +#include +#include + +static int size; +static int count; +static char* buffer; +static int spy_enable; + +void UnityOutputCharSpy_Create(int s) +{ + size = s; + count = 0; + spy_enable = 0; + buffer = malloc(size); + memset(buffer, 0, size); +} + +void UnityOutputCharSpy_Destroy() +{ + size = 0; + free(buffer); +} + +int UnityOutputCharSpy_OutputChar(int c) +{ + if (spy_enable) + { + if (count < (size-1)) + buffer[count++] = c; + } + else + { + putchar(c); + } + return c; +} + +const char * UnityOutputCharSpy_Get() +{ + return buffer; +} + +void UnityOutputCharSpy_Enable(int enable) +{ + spy_enable = enable; +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/extras/fixture/test/unity_output_Spy.h b/flex-bison/clcalc/tools/ceedling/vendor/unity/extras/fixture/test/unity_output_Spy.h new file mode 100644 index 0000000..7c1590e --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/extras/fixture/test/unity_output_Spy.h @@ -0,0 +1,17 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef D_unity_output_Spy_H +#define D_unity_output_Spy_H + +void UnityOutputCharSpy_Create(int s); +void UnityOutputCharSpy_Destroy(); +int UnityOutputCharSpy_OutputChar(int c); +const char * UnityOutputCharSpy_Get(); +void UnityOutputCharSpy_Enable(int enable); + +#endif diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/makefile b/flex-bison/clcalc/tools/ceedling/vendor/unity/makefile new file mode 100644 index 0000000..8c8444b --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/makefile @@ -0,0 +1,35 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +C_COMPILER=gcc +TARGET_BASE = testunity +ifeq ($(OS),Windows_NT) + TARGET_EXTENSION=.exe +else + TARGET_EXTENSION=.out +endif +TARGET = $(TARGET_BASE)$(TARGET_EXTENSION) +OUT_FILE=-o $(TARGET) +SRC_FILES=src/unity.c test/testunity.c build/testunity_Runner.c +INC_DIRS=-Isrc +SYMBOLS=-DTEST -DUNITY_SUPPORT_64 + +ifeq ($(OS),Windows_NT) + CLEANUP = del /F /Q build\* && del /F /Q $(TARGET) +else + CLEANUP = rm -f build/*.o ; rm -f $(TARGET) +endif + +all: clean default + +default: + ruby auto/generate_test_runner.rb test/testunity.c build/testunity_Runner.c + $(C_COMPILER) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES) $(OUT_FILE) + $(TARGET) + +clean: + $(CLEANUP) + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/rakefile.rb b/flex-bison/clcalc/tools/ceedling/vendor/unity/rakefile.rb new file mode 100644 index 0000000..3ec5d5a --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/rakefile.rb @@ -0,0 +1,48 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require HERE + 'rakefile_helper' + +include RakefileHelpers + +# Load default configuration, for now +DEFAULT_CONFIG_FILE = 'gcc.yml' +configure_toolchain(DEFAULT_CONFIG_FILE) + +desc "Test unity with its own unit tests" +task :unit do + run_tests get_unit_test_files +end + +Rake::TestTask.new(:scripts) do |t| + t.pattern = 'test/test_*.rb' + t.verbose = true +end + +desc "Generate test summary" +task :summary do + report_summary +end + +desc "Build and test Unity" +task :all => [:clean, :scripts, :unit, :summary] +task :default => [:clobber, :all] +task :ci => [:no_color, :default] +task :cruise => [:no_color, :default] + +desc "Load configuration" +task :config, :config_file do |t, args| + configure_toolchain(args[:config_file]) +end + +task :no_color do + $colour_output = false +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/rakefile_helper.rb b/flex-bison/clcalc/tools/ceedling/vendor/unity/rakefile_helper.rb new file mode 100644 index 0000000..218fcaa --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/rakefile_helper.rb @@ -0,0 +1,243 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require 'yaml' +require 'fileutils' +require HERE+'auto/unity_test_summary' +require HERE+'auto/generate_test_runner' +require HERE+'auto/colour_reporter' + +module RakefileHelpers + + C_EXTENSION = '.c' + + def load_configuration(config_file) + unless ($configured) + $cfg_file = "targets/#{config_file}" unless (config_file =~ /[\\|\/]/) + $cfg = YAML.load(File.read($cfg_file)) + $colour_output = false unless $cfg['colour'] + $configured = true if (config_file != DEFAULT_CONFIG_FILE) + end + end + + def configure_clean + CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil? + end + + def configure_toolchain(config_file=DEFAULT_CONFIG_FILE) + config_file += '.yml' unless config_file =~ /\.yml$/ + config_file = config_file unless config_file =~ /[\\|\/]/ + load_configuration(config_file) + configure_clean + end + + def get_unit_test_files + path = $cfg['compiler']['unit_tests_path'] + 'test*' + C_EXTENSION + path.gsub!(/\\/, '/') + FileList.new(path) + end + + def get_local_include_dirs + include_dirs = $cfg['compiler']['includes']['items'].dup + include_dirs.delete_if {|dir| dir.is_a?(Array)} + return include_dirs + end + + def extract_headers(filename) + includes = [] + lines = File.readlines(filename) + lines.each do |line| + m = line.match(/^\s*#include\s+\"\s*(.+\.[hH])\s*\"/) + if not m.nil? + includes << m[1] + end + end + return includes + end + + def find_source_file(header, paths) + paths.each do |dir| + src_file = dir + header.ext(C_EXTENSION) + if (File.exists?(src_file)) + return src_file + end + end + return nil + end + + def tackit(strings) + if strings.is_a?(Array) + result = "\"#{strings.join}\"" + else + result = strings + end + return result + end + + def squash(prefix, items) + result = '' + items.each { |item| result += " #{prefix}#{tackit(item)}" } + return result + end + + def build_compiler_fields + command = tackit($cfg['compiler']['path']) + if $cfg['compiler']['defines']['items'].nil? + defines = '' + else + defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items']) + end + options = squash('', $cfg['compiler']['options']) + includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :defines => defines, :options => options, :includes => includes} + end + + def compile(file, defines=[]) + compiler = build_compiler_fields + cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{file} " + + "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" + + "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" + execute(cmd_str) + end + + def build_linker_fields + command = tackit($cfg['linker']['path']) + if $cfg['linker']['options'].nil? + options = '' + else + options = squash('', $cfg['linker']['options']) + end + if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?) + includes = '' + else + includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) + end + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :options => options, :includes => includes} + end + + def link(exe_name, obj_list) + linker = build_linker_fields + cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + + (obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).join + + $cfg['linker']['bin_files']['prefix'] + ' ' + + $cfg['linker']['bin_files']['destination'] + + exe_name + $cfg['linker']['bin_files']['extension'] + execute(cmd_str) + end + + def build_simulator_fields + return nil if $cfg['simulator'].nil? + if $cfg['simulator']['path'].nil? + command = '' + else + command = (tackit($cfg['simulator']['path']) + ' ') + end + if $cfg['simulator']['pre_support'].nil? + pre_support = '' + else + pre_support = squash('', $cfg['simulator']['pre_support']) + end + if $cfg['simulator']['post_support'].nil? + post_support = '' + else + post_support = squash('', $cfg['simulator']['post_support']) + end + return {:command => command, :pre_support => pre_support, :post_support => post_support} + end + + def execute(command_string, verbose=true) + report command_string + output = `#{command_string}`.chomp + report(output) if (verbose && !output.nil? && (output.length > 0)) + if $?.exitstatus != 0 + raise "Command failed. (Returned #{$?.exitstatus})" + end + return output + end + + def report_summary + summary = UnityTestSummary.new + summary.set_root_path(HERE) + results_glob = "#{$cfg['compiler']['build_path']}*.test*" + results_glob.gsub!(/\\/, '/') + results = Dir[results_glob] + summary.set_targets(results) + summary.run + end + + def run_tests(test_files) + report 'Running Unity system tests...' + + # Tack on TEST define for compiling unit tests + load_configuration($cfg_file) + test_defines = ['TEST'] + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + $cfg['compiler']['defines']['items'] << 'TEST' + + include_dirs = get_local_include_dirs + + # Build and execute each unit test + test_files.each do |test| + obj_list = [] + + # Detect dependencies and build required modules + extract_headers(test).each do |header| + # Compile corresponding source file if it exists + src_file = find_source_file(header, include_dirs) + if !src_file.nil? + compile(src_file, test_defines) + obj_list << header.ext($cfg['compiler']['object_files']['extension']) + end + end + + # Build the test runner (generate if configured to do so) + test_base = File.basename(test, C_EXTENSION) + + runner_name = test_base + '_Runner.c' + runner_path = '' + + if $cfg['compiler']['runner_path'].nil? + runner_path = $cfg['compiler']['build_path'] + runner_name + else + runner_path = $cfg['compiler']['runner_path'] + runner_name + end + + options = $cfg[:unity] + options[:use_param_tests] = (test =~ /parameterized/) ? true : false + UnityTestRunnerGenerator.new(options).run(test, runner_path) + + compile(runner_path, test_defines) + obj_list << runner_name.ext($cfg['compiler']['object_files']['extension']) + + # Build the test module + compile(test, test_defines) + obj_list << test_base.ext($cfg['compiler']['object_files']['extension']) + + # Link the test executable + link(test_base, obj_list) + + # Execute unit test and generate results file + simulator = build_simulator_fields + executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] + if simulator.nil? + cmd_str = executable + else + cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" + end + output = execute(cmd_str) + test_results = $cfg['compiler']['build_path'] + test_base + if output.match(/OK$/m).nil? + test_results += '.testfail' + else + test_results += '.testpass' + end + File.open(test_results, 'w') { |f| f.print output } + + end + end +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/release/build.info b/flex-bison/clcalc/tools/ceedling/vendor/unity/release/build.info new file mode 100644 index 0000000..7871b21 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/release/build.info @@ -0,0 +1,2 @@ +118 + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/release/version.info b/flex-bison/clcalc/tools/ceedling/vendor/unity/release/version.info new file mode 100644 index 0000000..0d71c08 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/release/version.info @@ -0,0 +1,2 @@ +2.0 + diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/src/unity.c b/flex-bison/clcalc/tools/ceedling/vendor/unity/src/unity.c new file mode 100644 index 0000000..fa712c7 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/src/unity.c @@ -0,0 +1,855 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity.h" +#include +#include + +#define UNITY_FAIL_AND_BAIL { Unity.CurrentTestFailed = 1; UNITY_OUTPUT_CHAR('\n'); longjmp(Unity.AbortFrame, 1); } +#define UNITY_IGNORE_AND_BAIL { Unity.CurrentTestIgnored = 1; UNITY_OUTPUT_CHAR('\n'); longjmp(Unity.AbortFrame, 1); } +/// return prematurely if we are already in failure or ignore state +#define UNITY_SKIP_EXECUTION { if ((Unity.CurrentTestFailed != 0) || (Unity.CurrentTestIgnored != 0)) {return;} } +#define UNITY_PRINT_EOL { UNITY_OUTPUT_CHAR('\n'); } + +struct _Unity Unity = { 0 }; + +const char* UnityStrNull = "NULL"; +const char* UnityStrSpacer = ". "; +const char* UnityStrExpected = " Expected "; +const char* UnityStrWas = " Was "; +const char* UnityStrTo = " To "; +const char* UnityStrElement = " Element "; +const char* UnityStrMemory = " Memory Mismatch"; +const char* UnityStrDelta = " Values Not Within Delta "; +const char* UnityStrPointless= " You Asked Me To Compare Nothing, Which Was Pointless."; +const char* UnityStrNullPointerForExpected= " Expected pointer to be NULL"; +const char* UnityStrNullPointerForActual = " Actual pointer was NULL"; + +const _U_UINT UnitySizeMask[] = +{ + 255, + 65535, + 65535, + 4294967295u, + 4294967295u, + 4294967295u, + 4294967295u +#ifdef UNITY_SUPPORT_64 + ,0xFFFFFFFFFFFFFFFF +#endif +}; + +//----------------------------------------------- +// Pretty Printers & Test Result Output Handlers +//----------------------------------------------- + +void UnityPrint(const char* string) +{ + const char* pch = string; + + if (pch != NULL) + { + while (*pch) + { + // printable characters plus CR & LF are printed + if ((*pch <= 126) && (*pch >= 32)) + { + UNITY_OUTPUT_CHAR(*pch); + } + //write escaped carriage returns + else if (*pch == 13) + { + UNITY_OUTPUT_CHAR('\\'); + UNITY_OUTPUT_CHAR('r'); + } + //write escaped line feeds + else if (*pch == 10) + { + UNITY_OUTPUT_CHAR('\\'); + UNITY_OUTPUT_CHAR('n'); + } + // unprintable characters are shown as codes + else + { + UNITY_OUTPUT_CHAR('\\'); + UnityPrintNumberHex((_U_SINT)*pch, 2); + } + pch++; + } + } +} + +//----------------------------------------------- +void UnityPrintNumberByStyle(const _U_SINT number, const UNITY_DISPLAY_STYLE_T style) +{ + if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT) + { + UnityPrintNumber(number); + } + else if ((style & UNITY_DISPLAY_RANGE_UINT) == UNITY_DISPLAY_RANGE_UINT) + { + UnityPrintNumberUnsigned( (_U_UINT)number & UnitySizeMask[((_U_UINT)style & (_U_UINT)0x0F) - 1] ); + } + else + { + UnityPrintNumberHex((_U_UINT)number, (style & 0x000F) << 1); + } +} + +//----------------------------------------------- +/// basically do an itoa using as little ram as possible +void UnityPrintNumber(const _U_SINT number_to_print) +{ + _U_SINT divisor = 1; + _U_SINT next_divisor; + _U_SINT number = number_to_print; + + if (number < 0) + { + UNITY_OUTPUT_CHAR('-'); + number = -number; + } + + // figure out initial divisor + while (number / divisor > 9) + { + next_divisor = divisor * 10; + if (next_divisor > divisor) + divisor = next_divisor; + else + break; + } + + // now mod and print, then divide divisor + do + { + UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10))); + divisor /= 10; + } + while (divisor > 0); +} + +//----------------------------------------------- +/// basically do an itoa using as little ram as possible +void UnityPrintNumberUnsigned(const _U_UINT number) +{ + _U_UINT divisor = 1; + _U_UINT next_divisor; + + // figure out initial divisor + while (number / divisor > 9) + { + next_divisor = divisor * 10; + if (next_divisor > divisor) + divisor = next_divisor; + else + break; + } + + // now mod and print, then divide divisor + do + { + UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10))); + divisor /= 10; + } + while (divisor > 0); +} + +//----------------------------------------------- +void UnityPrintNumberHex(const _U_UINT number, const char nibbles_to_print) +{ + _U_UINT nibble; + char nibbles = nibbles_to_print; + UNITY_OUTPUT_CHAR('0'); + UNITY_OUTPUT_CHAR('x'); + + while (nibbles > 0) + { + nibble = (number >> (--nibbles << 2)) & 0x0000000F; + if (nibble <= 9) + { + UNITY_OUTPUT_CHAR((char)('0' + nibble)); + } + else + { + UNITY_OUTPUT_CHAR((char)('A' - 10 + nibble)); + } + } +} + +//----------------------------------------------- +void UnityPrintMask(const _U_UINT mask, const _U_UINT number) +{ + _U_UINT current_bit = (_U_UINT)1 << (UNITY_INT_WIDTH - 1); + _US32 i; + + for (i = 0; i < UNITY_INT_WIDTH; i++) + { + if (current_bit & mask) + { + if (current_bit & number) + { + UNITY_OUTPUT_CHAR('1'); + } + else + { + UNITY_OUTPUT_CHAR('0'); + } + } + else + { + UNITY_OUTPUT_CHAR('X'); + } + current_bit = current_bit >> 1; + } +} + +//----------------------------------------------- +#ifdef UNITY_FLOAT_VERBOSE +void UnityPrintFloat(_UF number) +{ + char TempBuffer[32]; + sprintf(TempBuffer, "%.6f", number); + UnityPrint(TempBuffer); +} +#endif + +//----------------------------------------------- +void UnityTestResultsBegin(const char* file, const UNITY_LINE_TYPE line) +{ + UnityPrint(file); + UNITY_OUTPUT_CHAR(':'); + UnityPrintNumber(line); + UNITY_OUTPUT_CHAR(':'); + UnityPrint(Unity.CurrentTestName); + UNITY_OUTPUT_CHAR(':'); +} + +//----------------------------------------------- +void UnityTestResultsFailBegin(const UNITY_LINE_TYPE line) +{ + UnityTestResultsBegin(Unity.TestFile, line); + UnityPrint("FAIL:"); +} + +//----------------------------------------------- +void UnityConcludeTest(void) +{ + if (Unity.CurrentTestIgnored) + { + Unity.TestIgnores++; + } + else if (!Unity.CurrentTestFailed) + { + UnityTestResultsBegin(Unity.TestFile, Unity.CurrentTestLineNumber); + UnityPrint("PASS"); + UNITY_PRINT_EOL; + } + else + { + Unity.TestFailures++; + } + + Unity.CurrentTestFailed = 0; + Unity.CurrentTestIgnored = 0; +} + +//----------------------------------------------- +void UnityAddMsgIfSpecified(const char* msg) +{ + if (msg) + { + UnityPrint(UnityStrSpacer); + UnityPrint(msg); + } +} + +//----------------------------------------------- +void UnityPrintExpectedAndActualStrings(const char* expected, const char* actual) +{ + UnityPrint(UnityStrExpected); + if (expected != NULL) + { + UNITY_OUTPUT_CHAR('\''); + UnityPrint(expected); + UNITY_OUTPUT_CHAR('\''); + } + else + { + UnityPrint(UnityStrNull); + } + UnityPrint(UnityStrWas); + if (actual != NULL) + { + UNITY_OUTPUT_CHAR('\''); + UnityPrint(actual); + UNITY_OUTPUT_CHAR('\''); + } + else + { + UnityPrint(UnityStrNull); + } +} + +//----------------------------------------------- +// Assertion & Control Helpers +//----------------------------------------------- + +int UnityCheckArraysForNull(const void* expected, const void* actual, const UNITY_LINE_TYPE lineNumber, const char* msg) +{ + //return true if they are both NULL + if ((expected == NULL) && (actual == NULL)) + return 1; + + //throw error if just expected is NULL + if (expected == NULL) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrNullPointerForExpected); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + //throw error if just actual is NULL + if (actual == NULL) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrNullPointerForActual); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + //return false if neither is NULL + return 0; +} + +//----------------------------------------------- +// Assertion Functions +//----------------------------------------------- + +void UnityAssertBits(const _U_SINT mask, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + UNITY_SKIP_EXECUTION; + + if ((mask & expected) != (mask & actual)) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrExpected); + UnityPrintMask(mask, expected); + UnityPrint(UnityStrWas); + UnityPrintMask(mask, actual); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualNumber(const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style) +{ + UNITY_SKIP_EXECUTION; + + if (expected != actual) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(expected, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(actual, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualIntArray(const _U_SINT* expected, + const _U_SINT* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style) +{ + _UU32 elements = num_elements; + const _US8* ptr_exp = (_US8*)expected; + const _US8* ptr_act = (_US8*)actual; + + UNITY_SKIP_EXECUTION; + + if (elements == 0) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + switch(style) + { + case UNITY_DISPLAY_STYLE_HEX8: + case UNITY_DISPLAY_STYLE_INT8: + case UNITY_DISPLAY_STYLE_UINT8: + while (elements--) + { + if (*ptr_exp != *ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 1; + ptr_act += 1; + } + break; + case UNITY_DISPLAY_STYLE_HEX16: + case UNITY_DISPLAY_STYLE_INT16: + case UNITY_DISPLAY_STYLE_UINT16: + while (elements--) + { + if (*(_US16*)ptr_exp != *(_US16*)ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*(_US16*)ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*(_US16*)ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 2; + ptr_act += 2; + } + break; +#ifdef UNITY_SUPPORT_64 + case UNITY_DISPLAY_STYLE_HEX64: + case UNITY_DISPLAY_STYLE_INT64: + case UNITY_DISPLAY_STYLE_UINT64: + while (elements--) + { + if (*(_US64*)ptr_exp != *(_US64*)ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*(_US64*)ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*(_US64*)ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 8; + ptr_act += 8; + } + break; +#endif + default: + while (elements--) + { + if (*(_US32*)ptr_exp != *(_US32*)ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*(_US32*)ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*(_US32*)ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 4; + ptr_act += 4; + } + break; + } +} + +//----------------------------------------------- +#ifndef UNITY_EXCLUDE_FLOAT +void UnityAssertEqualFloatArray(const _UF* expected, + const _UF* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UU32 elements = num_elements; + const _UF* ptr_expected = expected; + const _UF* ptr_actual = actual; + _UF diff, tol; + + UNITY_SKIP_EXECUTION; + + if (elements == 0) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + while (elements--) + { + diff = *ptr_expected - *ptr_actual; + if (diff < 0.0) + diff = 0.0 - diff; + tol = UNITY_FLOAT_PRECISION * *ptr_expected; + if (tol < 0.0) + tol = 0.0 - tol; + if (diff > tol) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); +#ifdef UNITY_FLOAT_VERBOSE + UnityPrint(UnityStrExpected); + UnityPrintFloat(*ptr_expected); + UnityPrint(UnityStrWas); + UnityPrintFloat(*ptr_actual); +#else + UnityPrint(UnityStrDelta); +#endif + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_expected++; + ptr_actual++; + } +} + +//----------------------------------------------- +void UnityAssertFloatsWithin(const _UF delta, + const _UF expected, + const _UF actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UF diff = actual - expected; + _UF pos_delta = delta; + + UNITY_SKIP_EXECUTION; + + if (diff < 0) + { + diff = 0.0f - diff; + } + if (pos_delta < 0) + { + pos_delta = 0.0f - pos_delta; + } + + if (pos_delta < diff) + { + UnityTestResultsFailBegin(lineNumber); +#ifdef UNITY_FLOAT_VERBOSE + UnityPrint(UnityStrExpected); + UnityPrintFloat(expected); + UnityPrint(UnityStrWas); + UnityPrintFloat(actual); +#else + UnityPrint(UnityStrDelta); +#endif + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} +#endif + +//----------------------------------------------- +void UnityAssertNumbersWithin( const _U_SINT delta, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style) +{ + UNITY_SKIP_EXECUTION; + + if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT) + { + if (actual > expected) + Unity.CurrentTestFailed = ((actual - expected) > delta); + else + Unity.CurrentTestFailed = ((expected - actual) > delta); + } + else + { + if ((_U_UINT)actual > (_U_UINT)expected) + Unity.CurrentTestFailed = ((_U_UINT)(actual - expected) > (_U_UINT)delta); + else + Unity.CurrentTestFailed = ((_U_UINT)(expected - actual) > (_U_UINT)delta); + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrDelta); + UnityPrintNumberByStyle(delta, style); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(expected, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(actual, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualString(const char* expected, + const char* actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UU32 i; + + UNITY_SKIP_EXECUTION; + + // if both pointers not null compare the strings + if (expected && actual) + { + for (i = 0; expected[i] || actual[i]; i++) + { + if (expected[i] != actual[i]) + { + Unity.CurrentTestFailed = 1; + break; + } + } + } + else + { // handle case of one pointers being null (if both null, test should pass) + if (expected != actual) + { + Unity.CurrentTestFailed = 1; + } + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrintExpectedAndActualStrings(expected, actual); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualStringArray( const char** expected, + const char** actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UU32 i, j = 0; + + UNITY_SKIP_EXECUTION; + + // if no elements, it's an error + if (num_elements == 0) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + do + { + // if both pointers not null compare the strings + if (expected[j] && actual[j]) + { + for (i = 0; expected[j][i] || actual[j][i]; i++) + { + if (expected[j][i] != actual[j][i]) + { + Unity.CurrentTestFailed = 1; + break; + } + } + } + else + { // handle case of one pointers being null (if both null, test should pass) + if (expected[j] != actual[j]) + { + Unity.CurrentTestFailed = 1; + } + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + if (num_elements > 1) + { + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - j - 1), UNITY_DISPLAY_STYLE_UINT); + } + UnityPrintExpectedAndActualStrings((const char*)(expected[j]), (const char*)(actual[j])); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + } while (++j < num_elements); +} + +//----------------------------------------------- +void UnityAssertEqualMemory( const void* expected, + const void* actual, + _UU32 length, + _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + unsigned char* expected_ptr = (unsigned char*)expected; + unsigned char* actual_ptr = (unsigned char*)actual; + _UU32 elements = num_elements; + + UNITY_SKIP_EXECUTION; + + if ((elements == 0) || (length == 0)) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + while (elements--) + { + if (memcmp((const void*)expected_ptr, (const void*)actual_ptr, length) != 0) + { + Unity.CurrentTestFailed = 1; + break; + } + expected_ptr += length; + actual_ptr += length; + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + if (num_elements > 1) + { + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + } + UnityPrint(UnityStrMemory); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +// Control Functions +//----------------------------------------------- + +void UnityFail(const char* msg, const UNITY_LINE_TYPE line) +{ + UNITY_SKIP_EXECUTION; + + UnityTestResultsBegin(Unity.TestFile, line); + UnityPrint("FAIL"); + if (msg != NULL) + { + UNITY_OUTPUT_CHAR(':'); + if (msg[0] != ' ') + { + UNITY_OUTPUT_CHAR(' '); + } + UnityPrint(msg); + } + UNITY_FAIL_AND_BAIL; +} + +//----------------------------------------------- +void UnityIgnore(const char* msg, const UNITY_LINE_TYPE line) +{ + UNITY_SKIP_EXECUTION; + + UnityTestResultsBegin(Unity.TestFile, line); + UnityPrint("IGNORE"); + if (msg != NULL) + { + UNITY_OUTPUT_CHAR(':'); + UNITY_OUTPUT_CHAR(' '); + UnityPrint(msg); + } + UNITY_IGNORE_AND_BAIL; +} + +//----------------------------------------------- +void setUp(void); +void tearDown(void); +void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum) +{ + Unity.CurrentTestName = FuncName; + Unity.CurrentTestLineNumber = FuncLineNum; + Unity.NumberOfTests++; + if (TEST_PROTECT()) + { + setUp(); + Func(); + } + if (TEST_PROTECT() && !(Unity.CurrentTestIgnored)) + { + tearDown(); + } + UnityConcludeTest(); +} + +//----------------------------------------------- +void UnityBegin(void) +{ + Unity.NumberOfTests = 0; +} + +//----------------------------------------------- +int UnityEnd(void) +{ + UnityPrint("-----------------------"); + UNITY_PRINT_EOL; + UnityPrintNumber(Unity.NumberOfTests); + UnityPrint(" Tests "); + UnityPrintNumber(Unity.TestFailures); + UnityPrint(" Failures "); + UnityPrintNumber(Unity.TestIgnores); + UnityPrint(" Ignored"); + UNITY_PRINT_EOL; + if (Unity.TestFailures == 0U) + { + UnityPrint("OK"); + } + else + { + UnityPrint("FAIL"); + } + UNITY_PRINT_EOL; + return Unity.TestFailures; +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/src/unity.h b/flex-bison/clcalc/tools/ceedling/vendor/unity/src/unity.h new file mode 100644 index 0000000..0b1b187 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/src/unity.h @@ -0,0 +1,213 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FRAMEWORK_H +#define UNITY_FRAMEWORK_H + +#define UNITY + +#include "unity_internals.h" + +//------------------------------------------------------- +// Configuration Options +//------------------------------------------------------- + +// Integers +// - Unity assumes 32 bit integers by default +// - If your compiler treats ints of a different size, define UNITY_INT_WIDTH + +// Floats +// - define UNITY_EXCLUDE_FLOAT to disallow floating point comparisons +// - define UNITY_FLOAT_PRECISION to specify the precision to use when doing TEST_ASSERT_EQUAL_FLOAT +// - define UNITY_FLOAT_TYPE to specify doubles instead of single precision floats +// - define UNITY_FLOAT_VERBOSE to print floating point values in errors (uses sprintf) + +// Output +// - by default, Unity prints to standard out with putchar. define UNITY_OUTPUT_CHAR(a) with a different function if desired + +// Optimization +// - by default, line numbers are stored in unsigned shorts. Define UNITY_LINE_TYPE with a different type if your files are huge +// - by default, test and failure counters are unsigned shorts. Define UNITY_COUNTER_TYPE with a different type if you want to save space or have more than 65535 Tests. + +// Test Cases +// - define UNITY_SUPPORT_TEST_CASES to include the TEST_CASE macro, though really it's mostly about the runner generator script + +// Parameterized Tests +// - you'll want to create a define of TEST_CASE(...) which basically evaluates to nothing + +//------------------------------------------------------- +// Test Running Macros +//------------------------------------------------------- + +#define TEST_PROTECT() (setjmp(Unity.AbortFrame) == 0) + +#define TEST_ABORT() {longjmp(Unity.AbortFrame, 1);} + +#ifndef RUN_TEST +#define RUN_TEST(func, line_num) UnityDefaultTestRun(func, #func, line_num) +#endif + +#define TEST_LINE_NUM (Unity.CurrentTestLineNumber) +#define TEST_IS_IGNORED (Unity.CurrentTestIgnored) + +//------------------------------------------------------- +// Basic Fail and Ignore +//------------------------------------------------------- + +#define TEST_FAIL_MESSAGE(message) UNITY_TEST_FAIL(__LINE__, message) +#define TEST_FAIL() UNITY_TEST_FAIL(__LINE__, NULL) +#define TEST_IGNORE_MESSAGE(message) UNITY_TEST_IGNORE(__LINE__, message) +#define TEST_IGNORE() UNITY_TEST_IGNORE(__LINE__, NULL) +#define TEST_ONLY() + +//------------------------------------------------------- +// Test Asserts (simple) +//------------------------------------------------------- + +//Boolean +#define TEST_ASSERT(condition) UNITY_TEST_ASSERT( (condition), __LINE__, " Expression Evaluated To FALSE") +#define TEST_ASSERT_TRUE(condition) UNITY_TEST_ASSERT( (condition), __LINE__, " Expected TRUE Was FALSE") +#define TEST_ASSERT_UNLESS(condition) UNITY_TEST_ASSERT( !(condition), __LINE__, " Expression Evaluated To TRUE") +#define TEST_ASSERT_FALSE(condition) UNITY_TEST_ASSERT( !(condition), __LINE__, " Expected FALSE Was TRUE") +#define TEST_ASSERT_NULL(pointer) UNITY_TEST_ASSERT_NULL( (pointer), __LINE__, " Expected NULL") +#define TEST_ASSERT_NOT_NULL(pointer) UNITY_TEST_ASSERT_NOT_NULL((pointer), __LINE__, " Expected Non-NULL") + +//Integers (of all sizes) +#define TEST_ASSERT_EQUAL_INT(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT8(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT8((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT16(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT16((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT32(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT32((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT64(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT64((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_NOT_EQUAL(expected, actual) UNITY_TEST_ASSERT(((expected) != (actual)), __LINE__, " Expected Not-Equal") +#define TEST_ASSERT_EQUAL_UINT(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT8(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT8( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT16(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT16( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT32(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT32( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT64(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT64( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX8(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX8( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX16(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX16((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX32(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX64(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX64((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_BITS(mask, expected, actual) UNITY_TEST_ASSERT_BITS((mask), (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_BITS_HIGH(mask, actual) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(-1), (actual), __LINE__, NULL) +#define TEST_ASSERT_BITS_LOW(mask, actual) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(0), (actual), __LINE__, NULL) +#define TEST_ASSERT_BIT_HIGH(bit, actual) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(-1), (actual), __LINE__, NULL) +#define TEST_ASSERT_BIT_LOW(bit, actual) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(0), (actual), __LINE__, NULL) + +//Integer Ranges (of all sizes) +#define TEST_ASSERT_INT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_UINT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX8_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX16_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX32_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX64_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, __LINE__, NULL) + +//Structs and Strings +#define TEST_ASSERT_EQUAL_PTR(expected, actual) UNITY_TEST_ASSERT_EQUAL_PTR((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_STRING(expected, actual) UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_MEMORY(expected, actual, len) UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, __LINE__, NULL) + +//Arrays +#define TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements) UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, __LINE__, NULL) + +//Floating Point (If Enabled) +#define TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_FLOAT(expected, actual) UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, __LINE__, NULL) + +//------------------------------------------------------- +// Test Asserts (with additional messages) +//------------------------------------------------------- + +//Boolean +#define TEST_ASSERT_MESSAGE(condition, message) UNITY_TEST_ASSERT( (condition), __LINE__, message) +#define TEST_ASSERT_TRUE_MESSAGE(condition, message) UNITY_TEST_ASSERT( (condition), __LINE__, message) +#define TEST_ASSERT_UNLESS_MESSAGE(condition, message) UNITY_TEST_ASSERT( !(condition), __LINE__, message) +#define TEST_ASSERT_FALSE_MESSAGE(condition, message) UNITY_TEST_ASSERT( !(condition), __LINE__, message) +#define TEST_ASSERT_NULL_MESSAGE(pointer, message) UNITY_TEST_ASSERT_NULL( (pointer), __LINE__, message) +#define TEST_ASSERT_NOT_NULL_MESSAGE(pointer, message) UNITY_TEST_ASSERT_NOT_NULL((pointer), __LINE__, message) + +//Integers (of all sizes) +#define TEST_ASSERT_EQUAL_INT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT8((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT16((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT32((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT64((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, message) +#define TEST_ASSERT_NOT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT(((expected) != (actual)), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT8( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT16( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT32( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT64( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX8( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX16((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX64((expected), (actual), __LINE__, message) +#define TEST_ASSERT_BITS_MESSAGE(mask, expected, actual, message) UNITY_TEST_ASSERT_BITS((mask), (expected), (actual), __LINE__, message) +#define TEST_ASSERT_BITS_HIGH_MESSAGE(mask, actual, message) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(-1), (actual), __LINE__, message) +#define TEST_ASSERT_BITS_LOW_MESSAGE(mask, actual, message) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(0), (actual), __LINE__, message) +#define TEST_ASSERT_BIT_HIGH_MESSAGE(bit, actual, message) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(-1), (actual), __LINE__, message) +#define TEST_ASSERT_BIT_LOW_MESSAGE(bit, actual, message) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(0), (actual), __LINE__, message) + +//Integer Ranges (of all sizes) +#define TEST_ASSERT_INT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_UINT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX8_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX16_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX32_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX64_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, __LINE__, message) + +//Structs and Strings +#define TEST_ASSERT_EQUAL_PTR_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_PTR(expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_STRING_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_MEMORY_MESSAGE(expected, actual, len, message) UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, __LINE__, message) + +//Arrays +#define TEST_ASSERT_EQUAL_INT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_STRING_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_MEMORY_ARRAY_MESSAGE(expected, actual, len, num_elements, message) UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, __LINE__, message) + +//Floating Point (If Enabled) +#define TEST_ASSERT_FLOAT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_FLOAT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_FLOAT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, __LINE__, message) +#endif diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/src/unity_internals.h b/flex-bison/clcalc/tools/ceedling/vendor/unity/src/unity_internals.h new file mode 100644 index 0000000..29c9d1d --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/src/unity_internals.h @@ -0,0 +1,355 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_INTERNALS_H +#define UNITY_INTERNALS_H + +#include +#include + +//------------------------------------------------------- +// Int Support +//------------------------------------------------------- + +#ifndef UNITY_INT_WIDTH +#define UNITY_INT_WIDTH (32) +#endif + +#ifndef UNITY_LONG_WIDTH +#define UNITY_LONG_WIDTH (32) +#endif + +#if (UNITY_INT_WIDTH == 32) + typedef unsigned char _UU8; + typedef unsigned short _UU16; + typedef unsigned int _UU32; + typedef signed char _US8; + typedef signed short _US16; + typedef signed int _US32; +#elif (UNITY_INT_WIDTH == 16) + typedef unsigned char _UU8; + typedef unsigned int _UU16; + typedef unsigned long _UU32; + typedef signed char _US8; + typedef signed int _US16; + typedef signed long _US32; +#else + #error Invalid UNITY_INT_WIDTH specified! (16 or 32 are supported) +#endif + +//------------------------------------------------------- +// 64-bit Support +//------------------------------------------------------- + +#ifndef UNITY_SUPPORT_64 + +//No 64-bit Support +typedef _UU32 _U_UINT; +typedef _US32 _U_SINT; + +#else + +//64-bit Support +#if (UNITY_LONG_WIDTH == 32) + typedef unsigned long long _UU64; + typedef signed long long _US64; +#elif (UNITY_LONG_WIDTH == 64) + typedef unsigned long _UU64; + typedef signed long _US64; +#else + #error Invalid UNITY_LONG_WIDTH specified! (32 or 64 are supported) +#endif +typedef _UU64 _U_UINT; +typedef _US64 _U_SINT; + +#endif + +//------------------------------------------------------- +// Pointer Support +//------------------------------------------------------- + +#ifndef UNITY_POINTER_WIDTH +#define UNITY_POINTER_WIDTH (32) +#endif + +#if (UNITY_POINTER_WIDTH == 32) + typedef _UU32 _UP; +#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX32 +#elif (UNITY_POINTER_WIDTH == 64) + typedef _UU64 _UP; +#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX64 +#elif (UNITY_POINTER_WIDTH == 16) + typedef _UU16 _UP; +#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX16 +#else + #error Invalid UNITY_POINTER_WIDTH specified! (16, 32 or 64 are supported) +#endif + +//------------------------------------------------------- +// Float Support +//------------------------------------------------------- + +#ifdef UNITY_EXCLUDE_FLOAT + +//No Floating Point Support +#undef UNITY_FLOAT_PRECISION +#undef UNITY_FLOAT_TYPE +#undef UNITY_FLOAT_VERBOSE + +#else + +//Floating Point Support +#ifndef UNITY_FLOAT_PRECISION +#define UNITY_FLOAT_PRECISION (0.00001f) +#endif +#ifndef UNITY_FLOAT_TYPE +#define UNITY_FLOAT_TYPE float +#endif +typedef UNITY_FLOAT_TYPE _UF; + +#endif + +//------------------------------------------------------- +// Output Method +//------------------------------------------------------- + +#ifndef UNITY_OUTPUT_CHAR +//Default to using putchar, which is defined in stdio.h above +#define UNITY_OUTPUT_CHAR(a) putchar(a) +#else +//If defined as something else, make sure we declare it here so it's ready for use +extern int UNITY_OUTPUT_CHAR(int); +#endif + +//------------------------------------------------------- +// Footprint +//------------------------------------------------------- + +#ifndef UNITY_LINE_TYPE +#define UNITY_LINE_TYPE unsigned short +#endif + +#ifndef UNITY_COUNTER_TYPE +#define UNITY_COUNTER_TYPE unsigned short +#endif + +//------------------------------------------------------- +// Internal Structs Needed +//------------------------------------------------------- + +typedef void (*UnityTestFunction)(void); + +#define UNITY_DISPLAY_RANGE_INT (0x10) +#define UNITY_DISPLAY_RANGE_UINT (0x20) +#define UNITY_DISPLAY_RANGE_HEX (0x40) +#define UNITY_DISPLAY_RANGE_AUTO (0x80) + +typedef enum +{ + UNITY_DISPLAY_STYLE_INT = 4 + UNITY_DISPLAY_RANGE_INT + UNITY_DISPLAY_RANGE_AUTO, + UNITY_DISPLAY_STYLE_INT8 = 1 + UNITY_DISPLAY_RANGE_INT, + UNITY_DISPLAY_STYLE_INT16 = 2 + UNITY_DISPLAY_RANGE_INT, + UNITY_DISPLAY_STYLE_INT32 = 4 + UNITY_DISPLAY_RANGE_INT, +#ifdef UNITY_SUPPORT_64 + UNITY_DISPLAY_STYLE_INT64 = 8 + UNITY_DISPLAY_RANGE_INT, +#endif + UNITY_DISPLAY_STYLE_UINT = 4 + UNITY_DISPLAY_RANGE_UINT + UNITY_DISPLAY_RANGE_AUTO, + UNITY_DISPLAY_STYLE_UINT8 = 1 + UNITY_DISPLAY_RANGE_UINT, + UNITY_DISPLAY_STYLE_UINT16 = 2 + UNITY_DISPLAY_RANGE_UINT, + UNITY_DISPLAY_STYLE_UINT32 = 4 + UNITY_DISPLAY_RANGE_UINT, +#ifdef UNITY_SUPPORT_64 + UNITY_DISPLAY_STYLE_UINT64 = 8 + UNITY_DISPLAY_RANGE_UINT, +#endif + UNITY_DISPLAY_STYLE_HEX8 = 1 + UNITY_DISPLAY_RANGE_HEX, + UNITY_DISPLAY_STYLE_HEX16 = 2 + UNITY_DISPLAY_RANGE_HEX, + UNITY_DISPLAY_STYLE_HEX32 = 4 + UNITY_DISPLAY_RANGE_HEX, +#ifdef UNITY_SUPPORT_64 + UNITY_DISPLAY_STYLE_HEX64 = 8 + UNITY_DISPLAY_RANGE_HEX, +#endif +} UNITY_DISPLAY_STYLE_T; + +struct _Unity +{ + const char* TestFile; + const char* CurrentTestName; + _UU32 CurrentTestLineNumber; + UNITY_COUNTER_TYPE NumberOfTests; + UNITY_COUNTER_TYPE TestFailures; + UNITY_COUNTER_TYPE TestIgnores; + UNITY_COUNTER_TYPE CurrentTestFailed; + UNITY_COUNTER_TYPE CurrentTestIgnored; + jmp_buf AbortFrame; +}; + +extern struct _Unity Unity; + +//------------------------------------------------------- +// Test Suite Management +//------------------------------------------------------- + +void UnityBegin(void); +int UnityEnd(void); +void UnityConcludeTest(void); +void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum); + +//------------------------------------------------------- +// Test Output +//------------------------------------------------------- + +void UnityPrint(const char* string); +void UnityPrintMask(const _U_UINT mask, const _U_UINT number); +void UnityPrintNumberByStyle(const _U_SINT number, const UNITY_DISPLAY_STYLE_T style); +void UnityPrintNumber(const _U_SINT number); +void UnityPrintNumberUnsigned(const _U_UINT number); +void UnityPrintNumberHex(const _U_UINT number, const char nibbles); + +#ifdef UNITY_FLOAT_VERBOSE +void UnityPrintFloat(const _UF number); +#endif + +//------------------------------------------------------- +// Test Assertion Fuctions +//------------------------------------------------------- +// Use the macros below this section instead of calling +// these directly. The macros have a consistent naming +// convention and will pull in file and line information +// for you. + +void UnityAssertEqualNumber(const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style); + +void UnityAssertEqualIntArray(const _U_SINT* expected, + const _U_SINT* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style); + +void UnityAssertBits(const _U_SINT mask, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualString(const char* expected, + const char* actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualStringArray( const char** expected, + const char** actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualMemory( const void* expected, + const void* actual, + const _UU32 length, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertNumbersWithin(const _U_SINT delta, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style); + +void UnityFail(const char* message, const UNITY_LINE_TYPE line); + +void UnityIgnore(const char* message, const UNITY_LINE_TYPE line); + +#ifndef UNITY_EXCLUDE_FLOAT +void UnityAssertFloatsWithin(const _UF delta, + const _UF expected, + const _UF actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualFloatArray(const _UF* expected, + const _UF* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber); +#endif + +//------------------------------------------------------- +// Basic Fail and Ignore +//------------------------------------------------------- + +#define UNITY_TEST_FAIL(line, message) UnityFail( (message), (UNITY_LINE_TYPE)line); +#define UNITY_TEST_IGNORE(line, message) UnityIgnore( (message), (UNITY_LINE_TYPE)line); + +//------------------------------------------------------- +// Test Asserts +//------------------------------------------------------- + +#define UNITY_TEST_ASSERT(condition, line, message) if (condition) {} else {UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, message);} +#define UNITY_TEST_ASSERT_NULL(pointer, line, message) UNITY_TEST_ASSERT(((pointer) == NULL), (UNITY_LINE_TYPE)line, message) +#define UNITY_TEST_ASSERT_NOT_NULL(pointer, line, message) UNITY_TEST_ASSERT(((pointer) != NULL), (UNITY_LINE_TYPE)line, message) + +#define UNITY_TEST_ASSERT_EQUAL_INT(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_UINT(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_HEX8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX8) +#define UNITY_TEST_ASSERT_EQUAL_HEX16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX16) +#define UNITY_TEST_ASSERT_EQUAL_HEX32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX32) +#define UNITY_TEST_ASSERT_BITS(mask, expected, actual, line, message) UnityAssertBits((_U_SINT)(mask), (_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line) + +#define UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX8) +#define UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX16) +#define UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX32) +#define UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64) + +#define UNITY_TEST_ASSERT_EQUAL_PTR(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(_UP)(expected), (_U_SINT)(_UP)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_POINTER) +#define UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, line, message) UnityAssertEqualString((const char*)(expected), (const char*)(actual), (message), (UNITY_LINE_TYPE)line) +#define UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, line, message) UnityAssertEqualMemory((void*)(expected), (void*)(actual), (_UU32)(len), 1, (message), (UNITY_LINE_TYPE)line) + +#define UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT8) +#define UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT16) +#define UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT32) +#define UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT8) +#define UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT16) +#define UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT32) +#define UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX8) +#define UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX16) +#define UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX32) +#define UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualStringArray((const char**)(expected), (const char**)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line) +#define UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, line, message) UnityAssertEqualMemory((void*)(expected), (void*)(actual), (_UU32)(len), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line) + +#ifdef UNITY_SUPPORT_64 +#define UNITY_TEST_ASSERT_EQUAL_INT64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT64) +#define UNITY_TEST_ASSERT_EQUAL_UINT64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT64) +#define UNITY_TEST_ASSERT_EQUAL_HEX64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64) +#define UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT64) +#define UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT64) +#define UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64) +#endif + +#ifdef UNITY_EXCLUDE_FLOAT +#define UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled") +#define UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled") +#define UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled") +#else +#define UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, line, message) UnityAssertFloatsWithin((_UF)(delta), (_UF)(expected), (_UF)(actual), (message), (UNITY_LINE_TYPE)line) +#define UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, line, message) UNITY_TEST_ASSERT_FLOAT_WITHIN((_UF)(expected) * (_UF)UNITY_FLOAT_PRECISION, (_UF)expected, (_UF)actual, (UNITY_LINE_TYPE)line, message) +#define UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualFloatArray((_UF*)(expected), (_UF*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line) +#endif + +#endif diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/targets/gcc.yml b/flex-bison/clcalc/tools/ceedling/vendor/unity/targets/gcc.yml new file mode 100644 index 0000000..0f18c6c --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/targets/gcc.yml @@ -0,0 +1,42 @@ +compiler: + path: gcc + source_path: 'src/' + unit_tests_path: &unit_tests_path 'test/' + build_path: &build_path 'build/' + options: + - '-c' + - '-Wall' + - '-Wno-address' + - '-std=c99' + - '-pedantic' + includes: + prefix: '-I' + items: + - 'src/' + - '../src/' + - *unit_tests_path + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - UNITY_SUPPORT_TEST_CASES + object_files: + prefix: '-o' + extension: '.o' + destination: *build_path +linker: + path: gcc + options: + - -lm + includes: + prefix: '-I' + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.exe' + destination: *build_path +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/targets/gcc_64.yml b/flex-bison/clcalc/tools/ceedling/vendor/unity/targets/gcc_64.yml new file mode 100644 index 0000000..97cb958 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/targets/gcc_64.yml @@ -0,0 +1,43 @@ +compiler: + path: gcc + source_path: 'src/' + unit_tests_path: &unit_tests_path 'test/' + build_path: &build_path 'build/' + options: + - '-c' + - '-Wall' + - '-Wno-address' + - '-std=c99' + - '-pedantic' + includes: + prefix: '-I' + items: + - 'src/' + - '../src/' + - *unit_tests_path + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - UNITY_SUPPORT_TEST_CASES + - 'UNITY_POINTER_WIDTH=64' + object_files: + prefix: '-o' + extension: '.o' + destination: *build_path +linker: + path: gcc + options: + - -lm + includes: + prefix: '-I' + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.exe' + destination: *build_path +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/targets/hitech_picc18.yml b/flex-bison/clcalc/tools/ceedling/vendor/unity/targets/hitech_picc18.yml new file mode 100644 index 0000000..210d944 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/targets/hitech_picc18.yml @@ -0,0 +1,101 @@ +# rumor has it that this yaml file works for the standard edition of the +# hitech PICC18 compiler, but not the pro version. +# +compiler: + path: cd build && picc18 + source_path: 'c:\Projects\NexGen\Prototypes\CMockTest\src\' + unit_tests_path: &unit_tests_path 'c:\Projects\NexGen\Prototypes\CMockTest\test\' + build_path: &build_path 'c:\Projects\NexGen\Prototypes\CMockTest\build\' + options: + - --chip=18F87J10 + - --ide=hitide + - --q #quiet please + - --asmlist + - --codeoffset=0 + - --emi=wordwrite # External memory interface protocol + - --warn=0 # allow all normal warning messages + - --errors=10 # Number of errors before aborting compile + - --char=unsigned + - -Bl # Large memory model + - -G # generate symbol file + - --cp=16 # 16-bit pointers + - --double=24 + - -N255 # 255-char symbol names + - --opt=none # Do not use any compiler optimziations + - -c # compile only + - -M + includes: + prefix: '-I' + items: + - 'c:/Projects/NexGen/Prototypes/CMockTest/src/' + - 'c:/Projects/NexGen/Prototypes/CMockTest/mocks/' + - 'c:/CMock/src/' + - 'c:/CMock/examples/src/' + - 'c:/CMock/vendor/unity/src/' + - 'c:/CMock/vendor/unity/examples/helper/' + - *unit_tests_path + defines: + prefix: '-D' + items: + - UNITY_INT_WIDTH=16 + - UNITY_POINTER_WIDTH=16 + - CMOCK_MEM_STATIC + - CMOCK_MEM_SIZE=3000 + - UNITY_SUPPORT_TEST_CASES + - _PICC18 + object_files: + # prefix: '-O' # Hi-Tech doesn't want a prefix. They key off of filename .extensions, instead + extension: '.obj' + destination: *build_path + +linker: + path: cd build && picc18 + options: + - --chip=18F87J10 + - --ide=hitide + - --cp=24 # 24-bit pointers. Is this needed for linker?? + - --double=24 # Is this needed for linker?? + - -Lw # Scan the pic87*w.lib in the lib/ of the compiler installation directory + - --summary=mem,file # info listing + - --summary=+psect + - --summary=+hex + - --output=+intel + - --output=+mcof + - --runtime=+init # Directs startup code to copy idata, ibigdata and ifardata psects from ROM to RAM. + - --runtime=+clear # Directs startup code to clear bss, bigbss, rbss and farbss psects + - --runtime=+clib # link in the c-runtime + - --runtime=+keep # Keep the generated startup src after its obj is linked + - -G # Generate src-level symbol file + - -MIWasTheLastToBuild.map + - --warn=0 # allow all normal warning messages + - -Bl # Large memory model (probably not needed for linking) + includes: + prefix: '-I' + object_files: + path: *build_path + extension: '.obj' + bin_files: + prefix: '-O' + extension: '.hex' + destination: *build_path + +simulator: + path: + pre_support: + - 'java -client -jar ' # note space + - ['C:\Program Files\HI-TECH Software\HI-TIDE\3.15\lib\', 'simpic18.jar'] + - 18F87J10 + post_support: + +:cmock: + :plugins: [] + :includes: + - Types.h + :suite_teardown: | + if (num_failures) + _FAILED_TEST(); + else + _PASSED_TESTS(); + return 0; + +colour: true \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/targets/iar_arm_v4.yml b/flex-bison/clcalc/tools/ceedling/vendor/unity/targets/iar_arm_v4.yml new file mode 100644 index 0000000..c2e7f18 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/targets/iar_arm_v4.yml @@ -0,0 +1,89 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 4.0 Kickstart\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\lib\dl4tptinl8n.h'] + - -z3 + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian little + - --cpu ARM7TDMI + - --stack_align 4 + - --interwork + - -e + - --silent + - --warnings_are_errors + - --fpu None + - --diag_suppress Pa050 + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'common\bin\xlink.exe'] + options: + - -rt + - [*tools_root, 'arm\lib\dl4tptinl8n.r79'] + - -D_L_EXTMEM_START=0 + - -D_L_EXTMEM_SIZE=0 + - -D_L_HEAP_SIZE=120 + - -D_L_STACK_SIZE=32 + - -e_small_write=_formatted_write + - -s + - __program_start + - -f + - [*tools_root, '\arm\config\lnkarm.xcl'] + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\config\'] + - [*tools_root, 'arm\lib\'] + object_files: + path: *build_path + extension: '.r79' + bin_files: + prefix: '-o' + extension: '.d79' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\ioat91sam7X256.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/targets/iar_arm_v5.yml b/flex-bison/clcalc/tools/ceedling/vendor/unity/targets/iar_arm_v5.yml new file mode 100644 index 0000000..0549d8e --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/targets/iar_arm_v5.yml @@ -0,0 +1,79 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian=little + - --cpu=ARM7TDMI + - --interwork + - --warnings_are_errors + - --fpu=None + - --diag_suppress=Pa050 + - --diag_suppress=Pe111 + - -e + - -On + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\debugger\atmel\ioat91sam7X256.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/targets/iar_arm_v5_3.yml b/flex-bison/clcalc/tools/ceedling/vendor/unity/targets/iar_arm_v5_3.yml new file mode 100644 index 0000000..0549d8e --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/targets/iar_arm_v5_3.yml @@ -0,0 +1,79 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian=little + - --cpu=ARM7TDMI + - --interwork + - --warnings_are_errors + - --fpu=None + - --diag_suppress=Pa050 + - --diag_suppress=Pe111 + - -e + - -On + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\debugger\atmel\ioat91sam7X256.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml b/flex-bison/clcalc/tools/ceedling/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml new file mode 100644 index 0000000..eb0785c --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml @@ -0,0 +1,93 @@ +#Default tool path for IAR 5.4 on Windows XP 64bit +tools_root: &tools_root 'C:\Program Files (x86)\IAR Systems\Embedded Workbench 5.4 Kickstart\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --diag_suppress=Pa050 + #- --diag_suppress=Pe111 + - --debug + - --endian=little + - --cpu=Cortex-M3 + - --no_path_in_file_macros + - -e + - --fpu=None + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + #- --preinclude --preinclude C:\Vss\T2 Working\common\system.h + - --interwork + - --warnings_are_errors +# - Ohz + - -Oh +# - --no_cse +# - --no_unroll +# - --no_inline +# - --no_code_motion +# - --no_tbaa +# - --no_clustering +# - --no_scheduling + + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - ewarm + - PART_LM3S9B92 + - TARGET_IS_TEMPEST_RB1 + - USE_ROM_DRIVERS + - UART_BUFFERED + - UNITY_SUPPORT_64 + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic.icf'] +# - ['C:\Temp\lm3s9b92.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + #- --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim2.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - --endian=little + - --cpu=Cortex-M3 + - --fpu=None + - -p + - [*tools_root, 'arm\config\debugger\TexasInstruments\iolm3sxxxx.ddf'] + - --semihosting + - --device=LM3SxBxx + #- -d + #- sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/targets/iar_cortexm3_v5.yml b/flex-bison/clcalc/tools/ceedling/vendor/unity/targets/iar_cortexm3_v5.yml new file mode 100644 index 0000000..cf0d1d0 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/targets/iar_cortexm3_v5.yml @@ -0,0 +1,83 @@ +# unit testing under iar compiler / simulator for STM32 Cortex-M3 + +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.4\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian=little + - --cpu=Cortex-M3 + - --interwork + - --warnings_are_errors + - --fpu=None + - --diag_suppress=Pa050 + - --diag_suppress=Pe111 + - -e + - -On + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - 'IAR' + - 'UNITY_SUPPORT_64' + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic_cortex.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\debugger\ST\iostm32f107xx.ddf'] + - --cpu=Cortex-M3 + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/targets/iar_msp430.yml b/flex-bison/clcalc/tools/ceedling/vendor/unity/targets/iar_msp430.yml new file mode 100644 index 0000000..e022647 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/targets/iar_msp430.yml @@ -0,0 +1,94 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3 MSP430\' +core_root: &core_root [*tools_root, '430\'] +core_bin: &core_bin [*core_root, 'bin\'] +core_config: &core_config [*core_root, 'config\'] +core_lib: &core_lib [*core_root, 'lib\'] +core_inc: &core_inc [*core_root, 'inc\'] +core_config: &core_config [*core_root, 'config\'] + +compiler: + path: [*core_bin, 'icc430.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*core_lib, 'dlib\dl430fn.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --debug + - -e + - -Ol + - --multiplier=16 + - --double=32 + - --diag_suppress Pa050 + - --diag_suppress Pe111 + includes: + prefix: '-I' + items: + - *core_inc + - [*core_inc, 'dlib'] + - [*core_lib, 'dlib'] + - 'src\' + - '../src/' + - *unit_tests_path + - 'vendor\unity\src' + defines: + prefix: '-D' + items: + - '__MSP430F149__' + - 'INT_WIDTH=16' + - 'UNITY_EXCLUDE_FLOAT' + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r43' + destination: *build_path +linker: + path: [*core_bin, 'xlink.exe'] + options: + - -rt + - [*core_lib, 'dlib\dl430fn.r43'] + - -e_PrintfTiny=_Printf + - -e_ScanfSmall=_Scanf + - -s __program_start + - -D_STACK_SIZE=50 + - -D_DATA16_HEAP_SIZE=50 + - -D_DATA20_HEAP_SIZE=50 + - -f + - [*core_config, 'lnk430f5438.xcl'] + - -f + - [*core_config, 'multiplier.xcl'] + includes: + prefix: '-I' + items: + - *core_config + - *core_lib + - [*core_lib, 'dlib'] + object_files: + path: *build_path + extension: '.r79' + bin_files: + prefix: '-o' + extension: '.d79' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*core_bin, '430proc.dll'] + - [*core_bin, '430sim.dll'] + post_support: + - --plugin + - [*core_bin, '430bat.dll'] + - --backend -B + - --cpu MSP430F5438 + - -p + - [*core_config, 'MSP430F5438.ddf'] + - -d sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/targets/iar_sh2a_v6.yml b/flex-bison/clcalc/tools/ceedling/vendor/unity/targets/iar_sh2a_v6.yml new file mode 100644 index 0000000..ddc5603 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/targets/iar_sh2a_v6.yml @@ -0,0 +1,85 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 6.0\' +compiler: + path: [*tools_root, 'sh\bin\iccsh.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - -e + - --char_is_signed + - -Ol + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_scheduling + - --no_clustering + - --debug + - --dlib_config + - [*tools_root, 'sh\inc\DLib_Product.h'] + - --double=32 + - --code_model=huge + - --data_model=huge + - --core=sh2afpu + - --warnings_affect_exit_code + - --warnings_are_errors + - --mfc + - --use_unix_directory_separators + - --diag_suppress=Pe161 + includes: + prefix: '-I' + items: + - [*tools_root, 'sh\inc\'] + - [*tools_root, 'sh\inc\c'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.o' + destination: *build_path +linker: + path: [*tools_root, 'sh\bin\ilinksh.exe'] + options: + - --redirect __Printf=__PrintfSmall + - --redirect __Scanf=__ScanfSmall + - --config + - [*tools_root, 'sh\config\generic.icf'] + - --config_def _CSTACK_SIZE=0x800 + - --config_def _HEAP_SIZE=0x800 + - --config_def _INT_TABLE=0x10 + - --entry __iar_program_start + - --debug_lib + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'sh\bin\shproc.dll'] + - [*tools_root, 'sh\bin\shsim.dll'] + post_support: + - --plugin + - [*tools_root, 'sh\bin\shbat.dll'] + - --backend + - -B + - --core sh2afpu + - -p + - [*tools_root, 'sh\config\debugger\io7264.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/test/expectdata/testsample_cmd.c b/flex-bison/clcalc/tools/ceedling/vendor/unity/test/expectdata/testsample_cmd.c new file mode 100644 index 0000000..42841d8 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/test/expectdata/testsample_cmd.c @@ -0,0 +1,54 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include +#include "CException.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/test/expectdata/testsample_def.c b/flex-bison/clcalc/tools/ceedling/vendor/unity/test/expectdata/testsample_def.c new file mode 100644 index 0000000..8280804 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/test/expectdata/testsample_def.c @@ -0,0 +1,50 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_cmd.c b/flex-bison/clcalc/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_cmd.c new file mode 100644 index 0000000..e47b31c --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_cmd.c @@ -0,0 +1,76 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_def.c b/flex-bison/clcalc/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_def.c new file mode 100644 index 0000000..3ca9dba --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_def.c @@ -0,0 +1,72 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_new1.c b/flex-bison/clcalc/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_new1.c new file mode 100644 index 0000000..a7cbcd8 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_new1.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + GlobalExpectCount = 0; + GlobalVerifyOrder = 0; + GlobalOrderError = NULL; + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_new2.c b/flex-bison/clcalc/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_new2.c new file mode 100644 index 0000000..2c76bf2 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_new2.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_param.c b/flex-bison/clcalc/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_param.c new file mode 100644 index 0000000..23c04f4 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_param.c @@ -0,0 +1,73 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST_NO_ARGS +#define RUN_TEST(TestFunc, TestLineNum, ...) \ +{ \ + Unity.CurrentTestName = #TestFunc "(" #__VA_ARGS__ ")"; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(__VA_ARGS__); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21, RUN_TEST_NO_ARGS); + RUN_TEST(test_TheSecondThingToTest, 43, RUN_TEST_NO_ARGS); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_run1.c b/flex-bison/clcalc/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_run1.c new file mode 100644 index 0000000..a7cbcd8 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_run1.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + GlobalExpectCount = 0; + GlobalVerifyOrder = 0; + GlobalOrderError = NULL; + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_run2.c b/flex-bison/clcalc/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_run2.c new file mode 100644 index 0000000..2c76bf2 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_run2.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_yaml.c b/flex-bison/clcalc/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_yaml.c new file mode 100644 index 0000000..68b545a --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_yaml.c @@ -0,0 +1,86 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include "two.h" +#include "three.h" +#include +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_yaml_setup(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/test/expectdata/testsample_new1.c b/flex-bison/clcalc/tools/ceedling/vendor/unity/test/expectdata/testsample_new1.c new file mode 100644 index 0000000..e5bcac2 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/test/expectdata/testsample_new1.c @@ -0,0 +1,60 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/test/expectdata/testsample_new2.c b/flex-bison/clcalc/tools/ceedling/vendor/unity/test/expectdata/testsample_new2.c new file mode 100644 index 0000000..b7c7e5b --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/test/expectdata/testsample_new2.c @@ -0,0 +1,63 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/test/expectdata/testsample_param.c b/flex-bison/clcalc/tools/ceedling/vendor/unity/test/expectdata/testsample_param.c new file mode 100644 index 0000000..4157007 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/test/expectdata/testsample_param.c @@ -0,0 +1,51 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST_NO_ARGS +#define RUN_TEST(TestFunc, TestLineNum, ...) \ +{ \ + Unity.CurrentTestName = #TestFunc "(" #__VA_ARGS__ ")"; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(__VA_ARGS__); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21, RUN_TEST_NO_ARGS); + RUN_TEST(test_TheSecondThingToTest, 43, RUN_TEST_NO_ARGS); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/test/expectdata/testsample_run1.c b/flex-bison/clcalc/tools/ceedling/vendor/unity/test/expectdata/testsample_run1.c new file mode 100644 index 0000000..e5bcac2 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/test/expectdata/testsample_run1.c @@ -0,0 +1,60 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/test/expectdata/testsample_run2.c b/flex-bison/clcalc/tools/ceedling/vendor/unity/test/expectdata/testsample_run2.c new file mode 100644 index 0000000..b7c7e5b --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/test/expectdata/testsample_run2.c @@ -0,0 +1,63 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/test/expectdata/testsample_yaml.c b/flex-bison/clcalc/tools/ceedling/vendor/unity/test/expectdata/testsample_yaml.c new file mode 100644 index 0000000..d109287 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/test/expectdata/testsample_yaml.c @@ -0,0 +1,64 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "two.h" +#include "three.h" +#include +#include +#include +#include "CException.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_yaml_setup(); +} + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/test/test_generate_test_runner.rb b/flex-bison/clcalc/tools/ceedling/vendor/unity/test/test_generate_test_runner.rb new file mode 100644 index 0000000..61c8df9 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/test/test_generate_test_runner.rb @@ -0,0 +1,94 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +ruby_version = RUBY_VERSION.split('.') +if (ruby_version[1].to_i == 9) and (ruby_version[2].to_i > 1) + require 'rubygems' + gem 'test-unit' +end +require 'test/unit' +require './auto/generate_test_runner.rb' + +TEST_FILE = 'test/testdata/testsample.c' +TEST_MOCK = 'test/testdata/mocksample.c' +OUT_FILE = 'build/testsample_' +EXP_FILE = 'test/expectdata/testsample_' + +class TestGenerateTestRunner < Test::Unit::TestCase + def setup + end + + def teardown + end + + def verify_output_equal(subtest) + expected = File.read(EXP_FILE + subtest + '.c').gsub(/\r\n/,"\n") + actual = File.read(OUT_FILE + subtest + '.c').gsub(/\r\n/,"\n") + assert_equal(expected, actual, "Generated File Sub-Test '#{subtest}' Failed") + end + + def test_ShouldGenerateARunnerByCreatingRunnerWithOptions + sets = { 'def' => nil, + 'new1' => { :plugins => [:cexception], :includes => ['one.h', 'two.h'], :enforce_strict_ordering => true }, + 'new2' => { :plugins => [:ignore], :suite_setup => "a_custom_setup();", :suite_teardown => "a_custom_teardown();" } + } + + sets.each_pair do |subtest, options| + UnityTestRunnerGenerator.new(options).run(TEST_FILE, OUT_FILE + subtest + '.c') + verify_output_equal(subtest) + UnityTestRunnerGenerator.new(options).run(TEST_MOCK, OUT_FILE + 'mock_' + subtest + '.c') + verify_output_equal('mock_' + subtest) + end + end + + def test_ShouldGenerateARunnerByRunningRunnerWithOptions + sets = { 'run1' => { :plugins => [:cexception], :includes => ['one.h', 'two.h'], :enforce_strict_ordering => true }, + 'run2' => { :plugins => [:ignore], :suite_setup => "a_custom_setup();", :suite_teardown => "a_custom_teardown();" } + } + + sets.each_pair do |subtest, options| + UnityTestRunnerGenerator.new.run(TEST_FILE, OUT_FILE + subtest + '.c', options) + verify_output_equal(subtest) + UnityTestRunnerGenerator.new.run(TEST_MOCK, OUT_FILE + 'mock_' + subtest + '.c', options) + verify_output_equal('mock_' + subtest) + end + end + + def test_ShouldGenerateARunnerByPullingYamlOptions + subtest = 'yaml' + cmdstr = "ruby auto/generate_test_runner.rb test/testdata/sample.yml \"#{TEST_FILE}\" \"#{OUT_FILE + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal(subtest) + + cmdstr = "ruby auto/generate_test_runner.rb test/testdata/sample.yml \"#{TEST_MOCK}\" \"#{OUT_FILE + 'mock_' + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal('mock_' + subtest) + end + + def test_ShouldGenerateARunnerByPullingCommandlineOptions + subtest = 'cmd' + cmdstr = "ruby auto/generate_test_runner.rb -cexception \"#{TEST_FILE}\" \"#{OUT_FILE + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal(subtest) + + cmdstr = "ruby auto/generate_test_runner.rb -cexception \"#{TEST_MOCK}\" \"#{OUT_FILE + 'mock_' + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal('mock_' + subtest) + end + + def test_ShouldGenerateARunnerThatUsesParameterizedTests + sets = { 'param' => { :plugins => [:ignore], :use_param_tests => true } + } + + sets.each_pair do |subtest, options| + UnityTestRunnerGenerator.new(options).run(TEST_FILE, OUT_FILE + subtest + '.c') + verify_output_equal(subtest) + UnityTestRunnerGenerator.new(options).run(TEST_MOCK, OUT_FILE + 'mock_' + subtest + '.c') + verify_output_equal('mock_' + subtest) + end + end + +end diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/test/testdata/mocksample.c b/flex-bison/clcalc/tools/ceedling/vendor/unity/test/testdata/mocksample.c new file mode 100644 index 0000000..b709438 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/test/testdata/mocksample.c @@ -0,0 +1,51 @@ +// This is just a sample test file to be used to test the generator script +#ifndef TEST_SAMPLE_H +#define TEST_SAMPLE_H + +#include +#include "unity.h" +#include "funky.h" +#include "Mockstanky.h" + +void setUp(void) +{ + CustomSetupStuff(); +} + +void tearDown(void) +{ + CustomTeardownStuff +} + +//Yup, nice comment +void test_TheFirstThingToTest(void) +{ + TEST_ASSERT(1); + + TEST_ASSERT_TRUE(1); +} + +/* +void test_ShouldBeIgnored(void) +{ + DoesStuff(); +} +*/ + +//void test_ShouldAlsoNotBeTested(void) +//{ +// Call_An_Expect(); +// +// CallAFunction(); +// test_CallAFunctionThatLooksLikeATest(); +//} + +void test_TheSecondThingToTest(void) +{ + Call_An_Expect(); + + CallAFunction(); + test_CallAFunctionThatLooksLikeATest(); +} + +#endif //TEST_SAMPLE_H diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/test/testdata/sample.yml b/flex-bison/clcalc/tools/ceedling/vendor/unity/test/testdata/sample.yml new file mode 100644 index 0000000..9e5eece --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/test/testdata/sample.yml @@ -0,0 +1,9 @@ +:unity: + :includes: + - two.h + - three.h + - + :plugins: + - :cexception + :suite_setup: | + a_yaml_setup(); \ No newline at end of file diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/test/testdata/testsample.c b/flex-bison/clcalc/tools/ceedling/vendor/unity/test/testdata/testsample.c new file mode 100644 index 0000000..4f30ec7 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/test/testdata/testsample.c @@ -0,0 +1,51 @@ +// This is just a sample test file to be used to test the generator script +#ifndef TEST_SAMPLE_H +#define TEST_SAMPLE_H + +#include +#include "unity.h" +#include "funky.h" +#include "stanky.h" + +void setUp(void) +{ + CustomSetupStuff(); +} + +void tearDown(void) +{ + CustomTeardownStuff +} + +//Yup, nice comment +void test_TheFirstThingToTest(void) +{ + TEST_ASSERT(1); + + TEST_ASSERT_TRUE(1); +} + +/* +void test_ShouldBeIgnored(void) +{ + DoesStuff(); +} +*/ + +//void test_ShouldAlsoNotBeTested(void) +//{ +// Call_An_Expect(); +// +// CallAFunction(); +// test_CallAFunctionThatLooksLikeATest(); +//} + +void test_TheSecondThingToTest(void) +{ + Call_An_Expect(); + + CallAFunction(); + test_CallAFunctionThatLooksLikeATest(); +} + +#endif //TEST_SAMPLE_H diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/test/testparameterized.c b/flex-bison/clcalc/tools/ceedling/vendor/unity/test/testparameterized.c new file mode 100644 index 0000000..037cd21 --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/test/testparameterized.c @@ -0,0 +1,101 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include +#include "unity.h" + +#define TEST_CASE(...) + +#define EXPECT_ABORT_BEGIN \ + if (TEST_PROTECT()) \ + { + +#define VERIFY_FAILS_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestFailed == 1) ? 0 : 1; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Failed But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +#define VERIFY_IGNORES_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestIgnored == 1) ? 0 : 1; \ + Unity.CurrentTestIgnored = 0; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Ignored But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +int SetToOneToFailInTearDown; +int SetToOneMeanWeAlreadyCheckedThisGuy; + +void setUp(void) +{ + SetToOneToFailInTearDown = 0; + SetToOneMeanWeAlreadyCheckedThisGuy = 0; +} + +void tearDown(void) +{ + if (SetToOneToFailInTearDown == 1) + TEST_FAIL_MESSAGE("<= Failed in tearDown"); + if ((SetToOneMeanWeAlreadyCheckedThisGuy == 0) && (Unity.CurrentTestFailed > 0)) + { + UnityPrint("[[[[ Previous Test Should Have Passed But Did Not ]]]]"); + UNITY_OUTPUT_CHAR('\n'); + } +} + +TEST_CASE(0) +TEST_CASE(44) +TEST_CASE((90)+9) +void test_TheseShouldAllPass(int Num) +{ + TEST_ASSERT_TRUE(Num < 100); +} + +TEST_CASE(3) +TEST_CASE(77) +TEST_CASE( (99) + 1 - (1)) +void test_TheseShouldAllFail(int Num) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(Num > 100); + VERIFY_FAILS_END +} + +TEST_CASE(1) +TEST_CASE(44) +TEST_CASE(99) +TEST_CASE(98) +void test_TheseAreEveryOther(int Num) +{ + if (Num & 1) + { + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(Num > 100); + VERIFY_FAILS_END + } + else + { + TEST_ASSERT_TRUE(Num < 100); + } +} + +void test_NormalPassesStillWork(void) +{ + TEST_ASSERT_TRUE(1); +} + +void test_NormalFailsStillWork(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(0); + VERIFY_FAILS_END +} diff --git a/flex-bison/clcalc/tools/ceedling/vendor/unity/test/testunity.c b/flex-bison/clcalc/tools/ceedling/vendor/unity/test/testunity.c new file mode 100644 index 0000000..9f826dc --- /dev/null +++ b/flex-bison/clcalc/tools/ceedling/vendor/unity/test/testunity.c @@ -0,0 +1,1510 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include +#include "unity.h" + +#define EXPECT_ABORT_BEGIN \ + if (TEST_PROTECT()) \ + { + +#define VERIFY_FAILS_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestFailed == 1) ? 0 : 1; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Failed But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +#define VERIFY_IGNORES_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestIgnored == 1) ? 0 : 1; \ + Unity.CurrentTestIgnored = 0; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Ignored But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +int SetToOneToFailInTearDown; +int SetToOneMeanWeAlreadyCheckedThisGuy; + +void setUp(void) +{ + SetToOneToFailInTearDown = 0; + SetToOneMeanWeAlreadyCheckedThisGuy = 0; +} + +void tearDown(void) +{ + if (SetToOneToFailInTearDown == 1) + TEST_FAIL_MESSAGE("<= Failed in tearDown"); + if ((SetToOneMeanWeAlreadyCheckedThisGuy == 0) && (Unity.CurrentTestFailed > 0)) + { + UnityPrint("[[[[ Previous Test Should Have Passed But Did Not ]]]]"); + UNITY_OUTPUT_CHAR('\n'); + } +} + +void testTrue(void) +{ + TEST_ASSERT(1); + + TEST_ASSERT_TRUE(1); +} + +void testFalse(void) +{ + TEST_ASSERT_FALSE(0); + + TEST_ASSERT_UNLESS(0); +} + +void testPreviousPass(void) +{ + TEST_ASSERT_EQUAL_INT(0U, Unity.TestFailures); +} + +void testNotVanilla(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT(0); + VERIFY_FAILS_END +} + +void testNotTrue(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(0); + VERIFY_FAILS_END +} + +void testNotFalse(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_FALSE(1); + VERIFY_FAILS_END +} + +void testNotUnless(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UNLESS(1); + VERIFY_FAILS_END +} + +void testNotNotEqual(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_NOT_EQUAL(10, 10); + VERIFY_FAILS_END +} + +void testFail(void) +{ + EXPECT_ABORT_BEGIN + TEST_FAIL_MESSAGE("Expected for testing"); + VERIFY_FAILS_END +} + +void testIsNull(void) +{ + char* ptr1 = NULL; + char* ptr2 = "hello"; + + TEST_ASSERT_NULL(ptr1); + TEST_ASSERT_NOT_NULL(ptr2); +} + +void testIsNullShouldFailIfNot(void) +{ + char* ptr1 = "hello"; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_NULL(ptr1); + VERIFY_FAILS_END +} + +void testNotNullShouldFailIfNULL(void) +{ + char* ptr1 = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_NOT_NULL(ptr1); + VERIFY_FAILS_END +} + +void testIgnore(void) +{ + EXPECT_ABORT_BEGIN + TEST_IGNORE(); + TEST_FAIL_MESSAGE("This should not be reached"); + VERIFY_IGNORES_END +} + +void testIgnoreMessage(void) +{ + EXPECT_ABORT_BEGIN + TEST_IGNORE_MESSAGE("This is an expected TEST_IGNORE_MESSAGE string!"); + TEST_FAIL_MESSAGE("This should not be reached"); + VERIFY_IGNORES_END +} + +void testNotEqualInts(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT(3982, 3983); + VERIFY_FAILS_END +} + +void testNotEqualInt8s(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT8(-127, -126); + VERIFY_FAILS_END +} + +void testNotEqualInt16s(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT16(-16383, -16382); + VERIFY_FAILS_END +} + +void testNotEqualInt32s(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT32(-2147483647, -2147483646); + VERIFY_FAILS_END +} + +void testNotEqualBits(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_BITS(0xFF00, 0x5555, 0x5A55); + VERIFY_FAILS_END +} + +void testNotEqualUInts(void) +{ + _UU16 v0, v1; + + v0 = 9000; + v1 = 9001; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualUInt8s(void) +{ + _UU8 v0, v1; + + v0 = 254; + v1 = 255; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT8(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualUInt16s(void) +{ + _UU16 v0, v1; + + v0 = 65535; + v1 = 65534; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualUInt32s(void) +{ + _UU32 v0, v1; + + v0 = 4294967295; + v1 = 4294967294; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT32(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex8s(void) +{ + _UU8 v0, v1; + + v0 = 0x23; + v1 = 0x22; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex8sIfSigned(void) +{ + _US8 v0, v1; + + v0 = -2; + v1 = 2; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex16s(void) +{ + _UU16 v0, v1; + + v0 = 0x1234; + v1 = 0x1235; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex16sIfSigned(void) +{ + _US16 v0, v1; + + v0 = -1024; + v1 = -1028; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex32s(void) +{ + _UU32 v0, v1; + + v0 = 900000; + v1 = 900001; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex32sIfSigned(void) +{ + _US32 v0, v1; + + v0 = -900000; + v1 = 900001; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32(v0, v1); + VERIFY_FAILS_END +} + +void testEqualInts(void) +{ + int v0, v1; + int *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(1837, 1837); + TEST_ASSERT_EQUAL_INT(-27365, -27365); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(19467, v1); + TEST_ASSERT_EQUAL_INT(v0, 19467); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 19467); +} + +void testEqualUints(void) +{ + unsigned int v0, v1; + unsigned int *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_UINT(1837, 1837); + TEST_ASSERT_EQUAL_UINT(v0, v1); + TEST_ASSERT_EQUAL_UINT(19467, v1); + TEST_ASSERT_EQUAL_UINT(v0, 19467); + TEST_ASSERT_EQUAL_UINT(*p0, v1); + TEST_ASSERT_EQUAL_UINT(*p0, *p1); + TEST_ASSERT_EQUAL_UINT(*p0, 19467); + TEST_ASSERT_EQUAL_UINT(60872u, 60872u); +} + +void testNotEqual(void) +{ + TEST_ASSERT_NOT_EQUAL(0, 1); + TEST_ASSERT_NOT_EQUAL(1, 0); + TEST_ASSERT_NOT_EQUAL(100, 101); + TEST_ASSERT_NOT_EQUAL(0, -1); + TEST_ASSERT_NOT_EQUAL(65535, -65535); + TEST_ASSERT_NOT_EQUAL(75, 900); + TEST_ASSERT_NOT_EQUAL(-100, -101); +} + +void testEqualHex8s(void) +{ + _UU8 v0, v1; + _UU8 *p0, *p1; + + v0 = 0x22; + v1 = 0x22; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX8(0x22, 0x22); + TEST_ASSERT_EQUAL_HEX8(v0, v1); + TEST_ASSERT_EQUAL_HEX8(0x22, v1); + TEST_ASSERT_EQUAL_HEX8(v0, 0x22); + TEST_ASSERT_EQUAL_HEX8(*p0, v1); + TEST_ASSERT_EQUAL_HEX8(*p0, *p1); + TEST_ASSERT_EQUAL_HEX8(*p0, 0x22); +} + +void testEqualHex8sNegatives(void) +{ + _UU8 v0, v1; + _UU8 *p0, *p1; + + v0 = 0xDD; + v1 = 0xDD; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX8(0xDD, 0xDD); + TEST_ASSERT_EQUAL_HEX8(v0, v1); + TEST_ASSERT_EQUAL_HEX8(0xDD, v1); + TEST_ASSERT_EQUAL_HEX8(v0, 0xDD); + TEST_ASSERT_EQUAL_HEX8(*p0, v1); + TEST_ASSERT_EQUAL_HEX8(*p0, *p1); + TEST_ASSERT_EQUAL_HEX8(*p0, 0xDD); +} + +void testEqualHex16s(void) +{ + _UU16 v0, v1; + _UU16 *p0, *p1; + + v0 = 0x9876; + v1 = 0x9876; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX16(0x9876, 0x9876); + TEST_ASSERT_EQUAL_HEX16(v0, v1); + TEST_ASSERT_EQUAL_HEX16(0x9876, v1); + TEST_ASSERT_EQUAL_HEX16(v0, 0x9876); + TEST_ASSERT_EQUAL_HEX16(*p0, v1); + TEST_ASSERT_EQUAL_HEX16(*p0, *p1); + TEST_ASSERT_EQUAL_HEX16(*p0, 0x9876); +} + +void testEqualHex32s(void) +{ + _UU32 v0, v1; + _UU32 *p0, *p1; + + v0 = 0x98765432ul; + v1 = 0x98765432ul; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX32(0x98765432ul, 0x98765432ul); + TEST_ASSERT_EQUAL_HEX32(v0, v1); + TEST_ASSERT_EQUAL_HEX32(0x98765432ul, v1); + TEST_ASSERT_EQUAL_HEX32(v0, 0x98765432ul); + TEST_ASSERT_EQUAL_HEX32(*p0, v1); + TEST_ASSERT_EQUAL_HEX32(*p0, *p1); + TEST_ASSERT_EQUAL_HEX32(*p0, 0x98765432ul); +} + +void testEqualBits(void) +{ + _UU32 v0 = 0xFF55AA00; + _UU32 v1 = 0x55550000; + + TEST_ASSERT_BITS(v1, v0, 0x55550000); + TEST_ASSERT_BITS(v1, v0, 0xFF55CC00); + TEST_ASSERT_BITS(0xFFFFFFFF, v0, 0xFF55AA00); + TEST_ASSERT_BITS(0xFFFFFFFF, v0, v0); + TEST_ASSERT_BITS(0xF0F0F0F0, v0, 0xFC5DAE0F); + TEST_ASSERT_BITS_HIGH(v1, v0); + TEST_ASSERT_BITS_LOW(0x000055FF, v0); + TEST_ASSERT_BIT_HIGH(30, v0); + TEST_ASSERT_BIT_LOW(5, v0); +} + +void testEqualShorts(void) +{ + short v0, v1; + short *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(1837, 1837); + TEST_ASSERT_EQUAL_INT(-2987, -2987); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(19467, v1); + TEST_ASSERT_EQUAL_INT(v0, 19467); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 19467); +} + +void testEqualUShorts(void) +{ + unsigned short v0, v1; + unsigned short *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_UINT(1837, 1837); + TEST_ASSERT_EQUAL_UINT(2987, 2987); + TEST_ASSERT_EQUAL_UINT(v0, v1); + TEST_ASSERT_EQUAL_UINT(19467, v1); + TEST_ASSERT_EQUAL_UINT(v0, 19467); + TEST_ASSERT_EQUAL_UINT(*p0, v1); + TEST_ASSERT_EQUAL_UINT(*p0, *p1); + TEST_ASSERT_EQUAL_UINT(*p0, 19467); +} + +void testEqualChars(void) +{ + signed char v0, v1; + signed char *p0, *p1; + + v0 = 109; + v1 = 109; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(42, 42); + TEST_ASSERT_EQUAL_INT(-116, -116); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(109, v1); + TEST_ASSERT_EQUAL_INT(v0, 109); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 109); +} + +void testEqualUChars(void) +{ + unsigned char v0, v1; + unsigned char *p0, *p1; + + v0 = 251; + v1 = 251; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(42, 42); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(251, v1); + TEST_ASSERT_EQUAL_INT(v0, 251); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 251); +} + +void testEqualPointers(void) +{ + int v0, v1; + int *p0, *p1, *p2; + + v0 = 19467; + v1 = 18271; + p0 = &v0; + p1 = &v1; + p2 = &v1; + + TEST_ASSERT_EQUAL_PTR(p0, &v0); + TEST_ASSERT_EQUAL_PTR(&v1, p1); + TEST_ASSERT_EQUAL_PTR(p2, p1); + TEST_ASSERT_EQUAL_PTR(&v0, &v0); +} + +void testNotEqualPointers(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_PTR(0x12345678, 0x12345677); + VERIFY_FAILS_END +} + +void testIntsWithinDelta(void) +{ + TEST_ASSERT_INT_WITHIN(1, 5000, 5001); + TEST_ASSERT_INT_WITHIN(5, 5000, 4996); + TEST_ASSERT_INT_WITHIN(5, 5000, 5005); + TEST_ASSERT_INT_WITHIN(500, 50, -440); + + TEST_ASSERT_INT_WITHIN(2, -1, -1); + TEST_ASSERT_INT_WITHIN(5, 1, -1); + TEST_ASSERT_INT_WITHIN(5, -1, 1); +} + +void testIntsNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_INT_WITHIN(5, 5000, 5006); + VERIFY_FAILS_END +} + +void testUIntsWithinDelta(void) +{ + TEST_ASSERT_UINT_WITHIN(1, 5000, 5001); + TEST_ASSERT_UINT_WITHIN(5, 5000, 4996); + TEST_ASSERT_UINT_WITHIN(5, 5000, 5005); +} + +void testUIntsNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UINT_WITHIN(1, 2147483647u, 2147483649u); + VERIFY_FAILS_END +} + +void testUIntsNotWithinDeltaEvenThoughASignedIntWouldPassSmallFirst(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UINT_WITHIN(5, 1, -1); + VERIFY_FAILS_END +} + +void testUIntsNotWithinDeltaEvenThoughASignedIntWouldPassBigFirst(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UINT_WITHIN(5, -1, 1); + VERIFY_FAILS_END +} + +void testHEX32sWithinDelta(void) +{ + TEST_ASSERT_HEX32_WITHIN(1, 5000, 5001); + TEST_ASSERT_HEX32_WITHIN(5, 5000, 4996); + TEST_ASSERT_HEX32_WITHIN(5, 5000, 5005); +} + +void testHEX32sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX32_WITHIN(1, 2147483647u, 2147483649u); + VERIFY_FAILS_END +} + +void testHEX32sNotWithinDeltaEvenThoughASignedIntWouldPass(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX32_WITHIN(5, 1, -1); + VERIFY_FAILS_END +} + +void testHEX16sWithinDelta(void) +{ + TEST_ASSERT_HEX16_WITHIN(1, 5000, 5001); + TEST_ASSERT_HEX16_WITHIN(5, 5000, 4996); + TEST_ASSERT_HEX16_WITHIN(5, 5000, 5005); +} + +void testHEX16sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX16_WITHIN(2, 65535, 0); + VERIFY_FAILS_END +} + +void testHEX8sWithinDelta(void) +{ + TEST_ASSERT_HEX8_WITHIN(1, 254, 255); + TEST_ASSERT_HEX8_WITHIN(5, 251, 255); + TEST_ASSERT_HEX8_WITHIN(5, 1, 4); +} + +void testHEX8sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX8_WITHIN(2, 255, 0); + VERIFY_FAILS_END +} + +void testEqualStrings(void) +{ + const char *testString = "foo"; + + TEST_ASSERT_EQUAL_STRING(testString, testString); + TEST_ASSERT_EQUAL_STRING("foo", "foo"); + TEST_ASSERT_EQUAL_STRING("foo", testString); + TEST_ASSERT_EQUAL_STRING(testString, "foo"); + TEST_ASSERT_EQUAL_STRING("", ""); +} + +void testEqualStringsWithCarriageReturnsAndLineFeeds(void) +{ + const char *testString = "foo\r\nbar"; + + TEST_ASSERT_EQUAL_STRING(testString, testString); + TEST_ASSERT_EQUAL_STRING("foo\r\nbar", "foo\r\nbar"); + TEST_ASSERT_EQUAL_STRING("foo\r\nbar", testString); + TEST_ASSERT_EQUAL_STRING(testString, "foo\r\nbar"); + TEST_ASSERT_EQUAL_STRING("", ""); +} + +void testNotEqualString1(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("foo", "bar"); + VERIFY_FAILS_END +} + +void testNotEqualString2(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("foo", ""); + VERIFY_FAILS_END +} + +void testNotEqualString3(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("", "bar"); + VERIFY_FAILS_END +} + +void testNotEqualString4(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("bar\r", "bar\n"); + VERIFY_FAILS_END +} + +void testNotEqualString5(void) +{ + const char str1[] = { 0x41, 0x42, 0x03, 0x00 }; + const char str2[] = { 0x41, 0x42, 0x04, 0x00 }; + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING(str1, str2); + VERIFY_FAILS_END +} + +void testNotEqualString_ExpectedStringIsNull(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING(NULL, "bar"); + VERIFY_FAILS_END +} + +void testNotEqualString_ActualStringIsNull(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("foo", NULL); + VERIFY_FAILS_END +} + +void testEqualStringArrays(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, expStrings, 3); + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 3); + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 2); + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 1); +} + +void testNotEqualStringArray1(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray2(void) +{ + const char *testStrings[] = { "zoo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", "boo", "woo", "moo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray3(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", NULL }; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray4(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", NULL, "woo", "moo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray5(void) +{ + const char **testStrings = NULL; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray6(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "zoo" }; + const char **expStrings = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testEqualStringArrayIfBothNulls(void) +{ + const char **testStrings = NULL; + const char **expStrings = NULL; + + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); +} + +void testEqualMemory(void) +{ + const char *testString = "whatever"; + + TEST_ASSERT_EQUAL_MEMORY(testString, testString, 8); + TEST_ASSERT_EQUAL_MEMORY("whatever", "whatever", 8); + TEST_ASSERT_EQUAL_MEMORY("whatever", testString, 8); + TEST_ASSERT_EQUAL_MEMORY(testString, "whatever", 8); + TEST_ASSERT_EQUAL_MEMORY(testString, "whatever", 2); + TEST_ASSERT_EQUAL_MEMORY(NULL, NULL, 1); +} + +void testNotEqualMemory1(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY("foo", "bar", 3); + VERIFY_FAILS_END +} + +void testNotEqualMemory2(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY("fool", "food", 4); + VERIFY_FAILS_END +} + +void testNotEqualMemory3(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY(NULL, "food", 4); + VERIFY_FAILS_END +} + +void testNotEqualMemory4(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY("fool", NULL, 4); + VERIFY_FAILS_END +} + +void testEqualIntArrays(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, -2}; + int p2[] = {1, 8, 987, 2}; + int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p3, 1); +} + +void testNotEqualIntArraysNullExpected(void) +{ + int* p0 = NULL; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArraysNullActual(void) +{ + int* p1 = NULL; + int p0[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArrays1(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArrays2(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {2, 8, 987, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArrays3(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 986, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualInt8Arrays(void) +{ + _US8 p0[] = {1, 8, 117, -2}; + _US8 p1[] = {1, 8, 117, -2}; + _US8 p2[] = {1, 8, 117, 2}; + _US8 p3[] = {1, 50, 60, 70}; + + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p3, 1); +} + +void testNotEqualInt8Arrays(void) +{ + _US8 p0[] = {1, 8, 127, -2}; + _US8 p1[] = {1, 8, 127, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualUIntArrays(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65132u}; + unsigned int p2[] = {1, 8, 987, 2}; + unsigned int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p3, 1); +} + +void testNotEqualUIntArrays1(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUIntArrays2(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUIntArrays3(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualInt16Arrays(void) +{ + _UU16 p0[] = {1, 8, 117, 3}; + _UU16 p1[] = {1, 8, 117, 3}; + _UU16 p2[] = {1, 8, 117, 2}; + _UU16 p3[] = {1, 50, 60, 70}; + + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p3, 1); +} + +void testNotEqualInt16Arrays(void) +{ + _UU16 p0[] = {1, 8, 127, 3}; + _UU16 p1[] = {1, 8, 127, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualUINT16Arrays(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65132u}; + unsigned short p2[] = {1, 8, 987, 2}; + unsigned short p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p3, 1); +} + +void testNotEqualUINT16Arrays1(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUINT16Arrays2(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUINT16Arrays3(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualHEXArrays(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65132u}; + unsigned int p2[] = {1, 8, 987, 2}; + unsigned int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p3, 1); +} + +void testNotEqualHEXArrays1(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEXArrays2(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEXArrays3(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualHEX16Arrays(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65132u}; + unsigned short p2[] = {1, 8, 987, 2}; + unsigned short p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p3, 1); +} + +void testNotEqualHEX16Arrays1(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX16Arrays2(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX16Arrays3(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualHEX8Arrays(void) +{ + unsigned short p0[] = {1, 8, 254u, 123}; + unsigned short p1[] = {1, 8, 254u, 123}; + unsigned short p2[] = {1, 8, 254u, 2}; + unsigned short p3[] = {1, 23, 25, 26}; + + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p3, 1); +} + +void testNotEqualHEX8Arrays1(void) +{ + unsigned char p0[] = {1, 8, 254u, 253u}; + unsigned char p1[] = {1, 8, 254u, 252u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX8Arrays2(void) +{ + unsigned char p0[] = {1, 8, 254u, 253u}; + unsigned char p1[] = {2, 8, 254u, 253u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX8Arrays3(void) +{ + unsigned char p0[] = {1, 8, 254u, 253u}; + unsigned char p1[] = {1, 8, 255u, 253u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualMemoryArrays(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, -2}; + int p2[] = {1, 8, 987, 2}; + int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p0, 4, 1); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p0, 4, 4); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p2, 4, 3); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p3, 4, 1); +} + +void testNotEqualMemoryArraysExpectedNull(void) +{ + int* p0 = NULL; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArraysActualNull(void) +{ + int p0[] = {1, 8, 987, -2}; + int* p1 = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArrays1(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArrays2(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {2, 8, 987, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArrays3(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 986, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testProtection(void) +{ + volatile int mask = 0; + + if (TEST_PROTECT()) + { + mask |= 1; + TEST_ABORT(); + } + else + { + Unity.CurrentTestFailed = 0; + mask |= 2; + } + + TEST_ASSERT_EQUAL(3, mask); +} + +void testIgnoredAndThenFailInTearDown(void) +{ + SetToOneToFailInTearDown = 1; + TEST_IGNORE(); +} + +// ===================== THESE TEST WILL RUN IF YOUR CONFIG INCLUDES 64 BIT SUPPORT ================== +#ifdef UNITY_SUPPORT_64 + +void testEqualHex64s(void) +{ + _UU64 v0, v1; + _UU64 *p0, *p1; + + v0 = 0x9876543201234567; + v1 = 0x9876543201234567; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX64(0x9876543201234567, 0x9876543201234567); + TEST_ASSERT_EQUAL_HEX64(v0, v1); + TEST_ASSERT_EQUAL_HEX64(0x9876543201234567, v1); + TEST_ASSERT_EQUAL_HEX64(v0, 0x9876543201234567); + TEST_ASSERT_EQUAL_HEX64(*p0, v1); + TEST_ASSERT_EQUAL_HEX64(*p0, *p1); + TEST_ASSERT_EQUAL_HEX64(*p0, 0x9876543201234567); +} + +void testNotEqualHex64s(void) +{ + _UU64 v0, v1; + + v0 = 9000000000; + v1 = 9100000000; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex64sIfSigned(void) +{ + _US64 v0, v1; + + v0 = -9000000000; + v1 = 9000000000; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64(v0, v1); + VERIFY_FAILS_END +} + +void testHEX64sWithinDelta(void) +{ + TEST_ASSERT_HEX64_WITHIN(1, 0x7FFFFFFFFFFFFFFF,0x7FFFFFFFFFFFFFFE); + TEST_ASSERT_HEX64_WITHIN(5, 5000, 4996); + TEST_ASSERT_HEX64_WITHIN(5, 5000, 5005); +} + +void testHEX64sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX64_WITHIN(1, 0x7FFFFFFFFFFFFFFF, 0x7FFFFFFFFFFFFFFC); + VERIFY_FAILS_END +} + +void testHEX64sNotWithinDeltaEvenThoughASignedIntWouldPass(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX64_WITHIN(5, 1, -1); + VERIFY_FAILS_END +} + +void testEqualHEX64Arrays(void) +{ + _UU64 p0[] = {1, 8, 987, 65132u}; + _UU64 p1[] = {1, 8, 987, 65132u}; + _UU64 p2[] = {1, 8, 987, 2}; + _UU64 p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p3, 1); +} + +void testNotEqualHEX64Arrays1(void) +{ + _UU64 p0[] = {1, 8, 987, 65132u}; + _UU64 p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX64Arrays2(void) +{ + _UU64 p0[] = {1, 8, 987, 65132u}; + _UU64 p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +#endif //64-bit SUPPORT + +// ===================== THESE TEST WILL RUN IF YOUR CONFIG INCLUDES FLOAT SUPPORT ================== +#ifndef UNITY_EXCLUDE_FLOAT + +void testFloatsWithinDelta(void) +{ + TEST_ASSERT_FLOAT_WITHIN(0.00003f, 187245.03485f, 187245.03488f); + TEST_ASSERT_FLOAT_WITHIN(1.0f, 187245.0f, 187246.0f); + TEST_ASSERT_FLOAT_WITHIN(0.05f, 9273.2549f, 9273.2049f); + TEST_ASSERT_FLOAT_WITHIN(0.007f, -726.93724f, -726.94424f); +} + +void testFloatsNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_FLOAT_WITHIN(0.05f, 9273.2649f, 9273.2049f); + VERIFY_FAILS_END +} + +void testFloatsEqual(void) +{ + TEST_ASSERT_EQUAL_FLOAT(187245.0f, 187246.0f); + TEST_ASSERT_EQUAL_FLOAT(18724.5f, 18724.6f); + TEST_ASSERT_EQUAL_FLOAT(9273.2549f, 9273.2599f); + TEST_ASSERT_EQUAL_FLOAT(-726.93724f, -726.9374f); +} + +void testFloatsNotEqual(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT(9273.9649f, 9273.0049f); + VERIFY_FAILS_END +} + +void testFloatsNotEqualNegative1(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT(-9273.9649f, -9273.0049f); + VERIFY_FAILS_END +} + +void testFloatsNotEqualNegative2(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT(-9273.0049f, -9273.9649f); + VERIFY_FAILS_END +} + +void testEqualFloatArrays(void) +{ + float p0[] = {1.0, -8.0, 25.4, -0.123}; + float p1[] = {1.0, -8.0, 25.4, -0.123}; + float p2[] = {1.0, -8.0, 25.4, -0.2}; + float p3[] = {1.0, -23.0, 25.0, -0.26}; + + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p3, 1); +} + +void testNotEqualFloatArraysExpectedNull(void) +{ + float* p0 = NULL; + float p1[] = {1.0, 8.0, 25.4, 0.252}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysActualNull(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float* p1 = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArrays1(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float p1[] = {1.0, 8.0, 25.4, 0.252}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArrays2(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float p1[] = {2.0, 8.0, 25.4, 0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArrays3(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float p1[] = {1.0, 8.0, 25.5, 0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysNegative1(void) +{ + float p0[] = {-1.0, -8.0, -25.4, -0.253}; + float p1[] = {-1.0, -8.0, -25.4, -0.252}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysNegative2(void) +{ + float p0[] = {-1.0, -8.0, -25.4, -0.253}; + float p1[] = {-2.0, -8.0, -25.4, -0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysNegative3(void) +{ + float p0[] = {-1.0, -8.0, -25.4, -0.253}; + float p1[] = {-1.0, -8.0, -25.5, -0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +#endif //FLOAT SUPPORT diff --git a/flex-bison/clcalc/tools/scripts/generate_ast_graph.bat b/flex-bison/clcalc/tools/scripts/generate_ast_graph.bat new file mode 100644 index 0000000..9bcb43a --- /dev/null +++ b/flex-bison/clcalc/tools/scripts/generate_ast_graph.bat @@ -0,0 +1,3 @@ +@echo off +echo %* | parser.exe | dot -Tbmp > test.bmp +test.bmp diff --git a/flex-bison/clcalc/tools/scripts/parse_file.bat b/flex-bison/clcalc/tools/scripts/parse_file.bat new file mode 100644 index 0000000..5129684 --- /dev/null +++ b/flex-bison/clcalc/tools/scripts/parse_file.bat @@ -0,0 +1,3 @@ +@echo off +cat %* | parser.exe | dot -Tbmp > test.bmp +test.bmp diff --git a/flex-bison/ducky/config.rake b/flex-bison/ducky/config.rake new file mode 100644 index 0000000..e45bbde --- /dev/null +++ b/flex-bison/ducky/config.rake @@ -0,0 +1,47 @@ +PROJECT_ROOT = File.expand_path(File.dirname(__FILE__)) + +# Application +APP_NAME = 'ducky' +APP_EXT = '.exe' +APP_OUT = "#{APP_NAME}#{APP_EXT}" + +# GNU Flex Settings +FLEX_BIN = 'flex' +FLEX_OPTS = '' +FLEX_IN = 'src/lexer/lexer.l' +FLEX_OUT = 'src/lexer/lex.yy.c' + +# GNU Bison Settings +BISON_BIN = 'bison' +BISON_OPTS = '-d' +BISON_IN = 'src/grammar/grammar.y' +BISON_OUT = 'src/grammar/grammar.tab.c' + +# Compiler Settings +COMPILER_BIN = 'g++' +COMPILER_OPTS = '-c -Wall -Werror' + +# Linker Settings +LINKER_BIN = 'g++' +LINKER_OPTS = '' + +# Source Code Settings +SRC_FILES = (FileList['src/**/*.c*'] + [ FLEX_OUT, BISON_OUT ]).uniq +INCLUDE_DIRS = FileList['src/**/'] +DEFINES = [ + #'DEBUG_LEXER', + #'DETECT_MEM_LEAKS', + 'PURE_PARSER' +] + +# Generated Lists +OBJ_FILES = SRC_FILES.collect{|src| "build/#{File.basename(src).ext('o')}" } +DEFINE_LIST = DEFINES.collect{|define| "-D#{define}" } +INCLUDE_LIST = INCLUDE_DIRS.collect{|x| "-I#{x} "} + +# Clean Task +CLEAN.include( 'build/*.o' ) +CLEAN.include( FLEX_OUT ) +CLEAN.include( BISON_OUT ) +CLEAN.include( APP_OUT ) + diff --git a/flex-bison/ducky/docs/example.ll b/flex-bison/ducky/docs/example.ll new file mode 100644 index 0000000..1a160bb --- /dev/null +++ b/flex-bison/ducky/docs/example.ll @@ -0,0 +1,7 @@ +; define foo as an int and initialize to 1 +; define bar as a constant int and initialize to 1 +%0 = type i32 1 +%1 = add float 1.0, i32 1 +%2 = add float 1.0, float 1.0 +%result = add i32 1, i32 2 + diff --git a/flex-bison/ducky/docs/fib.c b/flex-bison/ducky/docs/fib.c new file mode 100644 index 0000000..46fcca9 --- /dev/null +++ b/flex-bison/ducky/docs/fib.c @@ -0,0 +1,28 @@ +#include +int recursive_fib(int n) +{ + int ret = n; + if(ret >= 2) + ret = recursive_fib(n-1) + recursive_fib(n-2); + return ret; +} + +int iterative_fib(int n) +{ + int first = 0; + int second = 1; + int tmp = 0; + while(n--) + { + tmp = first + second; + first = second; + second = tmp; + } + return first; +} + +int main(int argc, char** argv) +{ + printf("%d\n", recursive_fib(10)); + printf("%d\n", iterative_fib(10)); +} diff --git a/flex-bison/ducky/docs/fib.dc b/flex-bison/ducky/docs/fib.dc new file mode 100644 index 0000000..ef42c09 --- /dev/null +++ b/flex-bison/ducky/docs/fib.dc @@ -0,0 +1,28 @@ +#import io + +#func recursive_fib(n) + #var ret = n +# if n >=2 +# ret = recursive_fib(n-1) + recursive_fib(n-2) +# end +# return ret +#end + +#func iterative_fib(n) + #var i = n + #var first = 0 + #var second = 1 + #var tmp = 0 +# while i > 0 + # tmp = first + second + # first = second + # second = tmp + # i = i - 1 +# end +# return first +#end + +#func main(args) + #puts recursive_fib(10) + #puts iterative_fib(10) +#end diff --git a/flex-bison/ducky/foo.lang b/flex-bison/ducky/foo.lang new file mode 100644 index 0000000..4251e71 --- /dev/null +++ b/flex-bison/ducky/foo.lang @@ -0,0 +1,57 @@ +foo = 1 +bar = 1 +1 + 1 +1.1 + 1 +1.0 + 1.1 +foo + bar +1 + 2 - 3 / 4 * 5 % 6 +"foo" +2 * 2 + 1 +2 * (2 + 1) + +#1 ** 2 +#2 ** (2 + 1) + +if 1 - 1 + 1+1 +end + +if foo + "foo" +else + "bar" +end + +func add(a,b) + a + b +end + +add(41,1) +print("hello World!") + +1 == 1 +#1 != 1 +1 < 1 +1 > 1 +1 <= 1 +1 >= 1 + +1 && 1 +1 and 1 + +1 || 1 +1 or 1 + +!1 +not 1 + +func fib(n) + if n < 2 + n + else + fib( n - 1 ) + fib( n - 2 ) + end +end + +print(fib(10)) + diff --git a/flex-bison/ducky/rakefile.rb b/flex-bison/ducky/rakefile.rb new file mode 100644 index 0000000..7efb24c --- /dev/null +++ b/flex-bison/ducky/rakefile.rb @@ -0,0 +1,34 @@ +require 'rake' +require 'rake/clean' + +# Load the dependencies +load 'config.rake' + +task :default => [:release] +task :release => [:generated, APP_OUT] + +# Generate the lexer and parser +task :generated => [FLEX_OUT, BISON_OUT] +file FLEX_OUT => [FLEX_IN] do + sh "#{FLEX_BIN} #{FLEX_OPTS} -o#{FLEX_OUT} #{FLEX_IN}" +end +file BISON_OUT => [BISON_IN] do + sh "#{BISON_BIN} #{BISON_OPTS} -o#{BISON_OUT} #{BISON_IN}" +end + +# Find and compile all source files +def FindSourceByObj(obj) + return SRC_FILES.find { |s| + (File.basename(s, '.c') == File.basename(obj, '.o')) || + (File.basename(s, '.cpp') == File.basename(obj, '.o')) + } +end +rule '.o' => lambda{|obj| FindSourceByObj(obj) } do |t| + sh "#{COMPILER_BIN} #{COMPILER_OPTS} #{INCLUDE_LIST} #{DEFINE_LIST} -o #{t.name} #{t.source}" +end + +# Link the object files together +task APP_OUT => OBJ_FILES do + puts "Linking #{APP_OUT}..." + sh "#{LINKER_BIN} #{LINKER_OPTS} -o #{APP_NAME} #{OBJ_FILES.collect{|x| x + ' '}}" +end diff --git a/flex-bison/ducky/runtime/rakefile.rb b/flex-bison/ducky/runtime/rakefile.rb new file mode 100644 index 0000000..e69de29 diff --git a/flex-bison/ducky/runtime/src/runtime.c b/flex-bison/ducky/runtime/src/runtime.c new file mode 100644 index 0000000..5e55343 --- /dev/null +++ b/flex-bison/ducky/runtime/src/runtime.c @@ -0,0 +1,22 @@ +#include "runtime.h" + +DuckyType T_INT = { "integer" }; +DuckyType T_FLOAT = { "float" }; +DuckyType T_STRING = { "string" }; +DuckyType T_ARRAY = { "array" }; +DuckyType T_MAP = { "map" }; + +DuckyVar Ducky_DeclareVar(DuckyType* type, U32 size) +{ + DuckyVar temp = (DuckyVar)malloc( TYPE_PTR_SIZE + size ); + TYPE(temp) = type; + return temp; +} + +int main() +{ + DuckyVar foo = Ducky_DeclareVar(&T_INT, sizeof(int)); + VALUE(int,foo) = 5; + return 0; +} + diff --git a/flex-bison/ducky/runtime/src/runtime.h b/flex-bison/ducky/runtime/src/runtime.h new file mode 100644 index 0000000..28f5830 --- /dev/null +++ b/flex-bison/ducky/runtime/src/runtime.h @@ -0,0 +1,20 @@ +#ifndef RUNTIME_H +#define RUNTIME_H + +typedef unsigned char Byte; +typedef unsigned int U32; +typedef Byte* DuckyVar; +typedef struct DuckyType { + Byte* name; + DuckyType* parent_type; +} DuckyType; + +#define TYPE_PTR_SIZE 4u + +DuckyVar Ducky_DeclareVar(DuckyType* type, U32 size); +#define TYPE(name) *((DuckyType**)name) +#define TYPE_PTR(name) (((DuckyType**)name)[0]) +#define VALUE(type,name) *((type*)(name + TYPE_PTR_SIZE)) +#define VALUE_PTR(type,name) ((type*)(name + TYPE_PTR_SIZE)) + +#endif diff --git a/flex-bison/ducky/runtime/src/runtime.s b/flex-bison/ducky/runtime/src/runtime.s new file mode 100644 index 0000000..5c33ccf --- /dev/null +++ b/flex-bison/ducky/runtime/src/runtime.s @@ -0,0 +1,49 @@ +; ModuleID = 'runtime.c' +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f80:128:128-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32" +target triple = "i386-pc-mingw32" + +%struct.DuckyType = type { i8* } + +@.str = private unnamed_addr constant [8 x i8] c"integer\00" +@T_INT = global %struct.DuckyType { i8* getelementptr inbounds ([8 x i8]* @.str, i32 0, i32 0) }, align 4 +@.str1 = private unnamed_addr constant [6 x i8] c"float\00" +@T_FLOAT = global %struct.DuckyType { i8* getelementptr inbounds ([6 x i8]* @.str1, i32 0, i32 0) }, align 4 +@.str2 = private unnamed_addr constant [7 x i8] c"string\00" +@T_STRING = global %struct.DuckyType { i8* getelementptr inbounds ([7 x i8]* @.str2, i32 0, i32 0) }, align 4 +@.str3 = private unnamed_addr constant [6 x i8] c"array\00" +@T_ARRAY = global %struct.DuckyType { i8* getelementptr inbounds ([6 x i8]* @.str3, i32 0, i32 0) }, align 4 +@.str4 = private unnamed_addr constant [4 x i8] c"map\00" +@T_MAP = global %struct.DuckyType { i8* getelementptr inbounds ([4 x i8]* @.str4, i32 0, i32 0) }, align 4 + +define i8* @Ducky_DeclareVar(%struct.DuckyType* %type, i32 %size) nounwind { + %1 = alloca %struct.DuckyType*, align 4 + %2 = alloca i32, align 4 + %temp = alloca i8*, align 4 + store %struct.DuckyType* %type, %struct.DuckyType** %1, align 4 + store i32 %size, i32* %2, align 4 + %3 = load i32* %2, align 4 + %4 = add i32 4, %3 + %5 = call i8* @malloc(i32 %4) + store i8* %5, i8** %temp, align 4 + %6 = load %struct.DuckyType** %1, align 4 + %7 = load i8** %temp, align 4 + %8 = bitcast i8* %7 to %struct.DuckyType** + store %struct.DuckyType* %6, %struct.DuckyType** %8 + %9 = load i8** %temp, align 4 + ret i8* %9 +} + +declare i8* @malloc(i32) + +define i32 @main() nounwind { + %1 = alloca i32, align 4 + %foo = alloca i8*, align 4 + store i32 0, i32* %1 + %2 = call i8* @Ducky_DeclareVar(%struct.DuckyType* @T_INT, i32 4) + store i8* %2, i8** %foo, align 4 + %3 = load i8** %foo, align 4 + %4 = getelementptr inbounds i8* %3, i32 4 + %5 = bitcast i8* %4 to i32* + store i32 5, i32* %5 + ret i32 0 +} diff --git a/flex-bison/ducky/src/cl_options/cl_options.cpp b/flex-bison/ducky/src/cl_options/cl_options.cpp new file mode 100644 index 0000000..1b662f7 --- /dev/null +++ b/flex-bison/ducky/src/cl_options/cl_options.cpp @@ -0,0 +1,140 @@ +/****************************************************************************** + * Copyright (C) 2011 Michael D. Lowis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ +#include +#include +#include "cl_options.h" +#include + +STATIC void HandleLongOption(U8 opt_index); +STATIC void HandleShortOption(U8 opt); +STATIC void BuildFileList(U32 argc, String* argv); + +using namespace std; + +/****************************************************************************** + * Globals + *****************************************************************************/ +const string Help_String( +"Usage: mark1 [options] file...\n" +"Options:\n" +" --help Prints available options\n" +" --debug-ast Enables debug printing of the abstract syntax tree.\n" +" --debug-scm Enables debug printing of the generated scheme code.\n" +); + +// Short Options List +const string Short_Options(""); + +// Long Options List +const struct option Long_Options[] = { + {"help", 0, 0, 0}, + {"debug-ast", 0, 0, 0}, + {"debug-scm", 0, 0, 0}, + {"interpret", 0, 0, 0}, + {0,0,0,0} +}; +#define IDX_HELP ((U8)0) +#define IDX_DEBUG_AST ((U8)1) +#define IDX_DEBUG_SCM ((U8)2) +#define IDX_INTERPRET ((U8)3) + +STATIC list* FileList = NULL; + +// Option Variables +DECLARE(BOOL,DebugAST); +DECLARE(BOOL,DebugSCM); +DECLARE(BOOL,InterpretMode); + +/****************************************************************************** + * Private Functions + *****************************************************************************/ +void HandleLongOption(U8 opt_index) +{ + switch( opt_index ) + { + case IDX_HELP: + cout << Help_String; + exit(0); + break; + case IDX_DEBUG_AST: + CLO_SET(DebugAST,TRUE); + break; + case IDX_DEBUG_SCM: + CLO_SET(DebugSCM,TRUE); + break; + case IDX_INTERPRET: + CLO_SET(InterpretMode,TRUE); + default: + break; + } +} + +void HandleShortOption(U8 opt) +{ + switch( opt ) + { + default: + break; + } +} + +void BuildFileList(U32 argc, String* argv) +{ + FileList = _new list(); + while ((U32)optind < argc) + { + FileList->push_back( argv[optind++] ); + } +} + +/****************************************************************************** + * Public Functions + *****************************************************************************/ +void CLO_ParseOptions(U32 argc, String* argv) +{ + S8 opt = 0; + U8 opt_index = 0; + while(1) + { + opt = getopt_long(argc, argv, Short_Options.c_str(), Long_Options, (int*)&opt_index); + if (opt == -1) + { + break; + } + + if(opt == 0) + { + HandleLongOption(opt_index); + } + else + { + HandleShortOption(opt); + } + } + BuildFileList(argc,argv); +} + +void CLO_Cleanup(void) +{ + delete FileList; +} + +list* CLO_GetFileList(void) +{ + return FileList; +} + diff --git a/flex-bison/ducky/src/cl_options/cl_options.h b/flex-bison/ducky/src/cl_options/cl_options.h new file mode 100644 index 0000000..e657687 --- /dev/null +++ b/flex-bison/ducky/src/cl_options/cl_options.h @@ -0,0 +1,44 @@ +/****************************************************************************** + * Copyright (C) 2011 Michael D. Lowis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ +#ifndef CL_OPTIONS_H +#define CL_OPTIONS_H + +#include "common.h" +#include + +void CLO_ParseOptions(U32 argc, String* argv); +void CLO_Cleanup(void); +std::list* CLO_GetFileList(void); + +#define PROTOTYPE(type,name) \ + type CLO_Get##name(void); \ + void CLO_Set##name(type) + +#define DECLARE(type,name) \ + static type name; \ + type CLO_Get##name(void) { return name; } \ + void CLO_Set##name(type x) { name = x; } + +#define CLO_GET(name) CLO_Get##name() +#define CLO_SET(name,value) CLO_Set##name(value) + + +PROTOTYPE(BOOL,DebugAST); +PROTOTYPE(BOOL,DebugSCM); +PROTOTYPE(BOOL,InterpretMode); + +#endif diff --git a/flex-bison/ducky/src/common.h b/flex-bison/ducky/src/common.h new file mode 100644 index 0000000..5932748 --- /dev/null +++ b/flex-bison/ducky/src/common.h @@ -0,0 +1,138 @@ +/****************************************************************************** + * Copyright (C) 2011 Michael D. Lowis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ +#ifndef COMMON_H +#define COMMON_H + +#include "cork.h" + +/****************************************************************************** + * Types + *****************************************************************************/ +//! Boolean enum definition +typedef enum +{ + TRUE = 1, + FALSE = 0 +} BOOL; + +/**** Unsigned Integers ****/ +//! 8-bit unsigned integer +typedef unsigned char U8; + +//! 16-bit unsigned integer +typedef unsigned short int U16; + +//! 32-bit unsigned integer +typedef unsigned long U32; + +/**** Signed Integers ****/ +//! 8-bit signed integer +typedef signed char S8; + +//! 16-bit signed integer +typedef short int S16; + +//! 32-bit signed integer +typedef long int S32; + +//! 64-bit signed integer +typedef long long int S64; + +// Floating Point +//! 32-bit floating point number +typedef float F32; + +//! 64-bit floating point number +typedef double F64; + +/**** String ****/ +//! String definition +typedef char * String; + +/****************************************************************************** + * Defines + *****************************************************************************/ + +#ifdef TEST + #define STATIC +#else + #define STATIC static +#endif + +#ifndef NULL + #define NULL ((U8)0) +#endif +#define NULL_PTR ((void *)0u) + +#define BIT_0 0x01u +#define BIT_1 0x02u +#define BIT_2 0x04u +#define BIT_3 0x08u +#define BIT_4 0x10u +#define BIT_5 0x20u +#define BIT_6 0x40u +#define BIT_7 0x80u + +#define BIT_8 0x0100u +#define BIT_9 0x0200u +#define BIT_10 0x0400u +#define BIT_11 0x0800u +#define BIT_12 0x1000u +#define BIT_13 0x2000u +#define BIT_14 0x4000u +#define BIT_15 0x8000u + +#define BIT_16 0x010000u +#define BIT_17 0x020000u +#define BIT_18 0x040000u +#define BIT_19 0x080000u +#define BIT_20 0x100000u +#define BIT_21 0x200000u +#define BIT_22 0x400000u +#define BIT_23 0x800000u + +#define BIT_24 0x01000000u +#define BIT_25 0x02000000u +#define BIT_26 0x04000000u +#define BIT_27 0x08000000u +#define BIT_28 0x10000000u +#define BIT_29 0x20000000u +#define BIT_30 0x40000000u +#define BIT_31 0x80000000u + +/****************************************************************************** + * Macros + *****************************************************************************/ + +#define VERIFY_RANGE(x, Min, Max) ((((x)>=(Min)) && ((x)<=(Max)))? (TRUE) : (FALSE)) +#define VERIFY_RANGE_VALUE(x, Default, Min, Max) (VERIFY_RANGE((x), (Min), (Max))? (x) : (Default)) +#define VERIFY_MAX_VALUE(x, Default, Max) (((x)<=(Max)) ? (x) : (Default)) +#define VERIFY_MIN_VALUE(x, Default, Min) (((x)>=(Min)) ? (x) : (Default)) +#define _ABS(x, type) (((x) < (type)0) ? (type)-(x):(x)) +#define ABS(x) (((x) < 0) ? -(x):(x)) +#define MAX(a,b) (((a) > (b)) ? (a):(b)) +#define MIN(a,b) (((a) < (b)) ? (a):(b)) +#define SIGN(x,y) (((y) < 0) ? (-(x)):(x)) +#define NUM_ELEMENTS(x) (sizeof(x)/sizeof(x[0])) +#define LIMIT_RANGE(x,Min,Max) (MAX(MIN((x),(Max)),(Min))) +#define LOW_BYTE(x) ((U8)((x) & 0x00FFu)) +#define HIGH_BYTE(x) ((U8)(((x)>>8u) & 0x00FFu)) +#define LOW_WORD(x) ((U16)((x) & 0x0000FFFFUL)) +#define HIGH_WORD(x) ((U16)(((x)>>16) & 0x0000FFFFUL)) +#define QUOTE(x) #x + +#endif diff --git a/flex-bison/ducky/src/cork/cork.cpp b/flex-bison/ducky/src/cork/cork.cpp new file mode 100644 index 0000000..5fb3e09 --- /dev/null +++ b/flex-bison/ducky/src/cork/cork.cpp @@ -0,0 +1,183 @@ +#include "cork.h" + +#ifdef DETECT_MEM_LEAKS + +// We want to use the real malloc and free in this file +#undef malloc +#undef free + +#include +#include // for std::bad_alloc +#include // for malloc() and free() +#include + +// Set the namespace +using namespace std; +/****************************************************************************** + * Typedefs + *****************************************************************************/ +typedef struct BlockTableEntry +{ + void * ptr; + unsigned int size; + const char* file; + int line; + void * next; +} BlockTableEntry_T; + +typedef struct BlockTable +{ + unsigned int size; + BlockTableEntry_T* blocks[TBL_SIZE]; +} BlockTable_T; + +/****************************************************************************** + * Prototypes + *****************************************************************************/ +void insert_record(void * ptr, BlockTable_T* entry); +void erase_record(void * ptr); + +/****************************************************************************** + * Globals + *****************************************************************************/ +unsigned int allocated; +static BlockTable_T Block_Table = { 0, {0} }; + +/****************************************************************************** + * Function Definitions + *****************************************************************************/ +void insert_record(void * ptr, BlockTableEntry_T* entry) +{ + unsigned int index = ((unsigned int)ptr) % TBL_SIZE; + BlockTableEntry_T* last = Block_Table.blocks[ index ]; + BlockTableEntry_T* curr = last; + + while (curr != NULL) + { + if ( curr->ptr == ptr ) + { + curr->size = entry->size; + free(entry); + break; + } + last = curr; + curr = (BlockTableEntry_T*)curr->next; + } + + if(curr == NULL) + { + if (last != NULL) + { + last->next = entry; + } + else + { + Block_Table.blocks[index] = entry; + } + Block_Table.size++; + } +} + +void erase_record(void * ptr) +{ + int depth = 0; + unsigned int index = ((unsigned int)ptr) % TBL_SIZE; + BlockTableEntry_T* last = Block_Table.blocks[ index ]; + BlockTableEntry_T* curr = last; + + while( curr != NULL ) + { + depth = 1; + if( curr->ptr == ptr ) + { + depth = 2; + if(last == curr) + { + depth = 3; + Block_Table.blocks[ index ] = (BlockTableEntry_T*)curr->next; + } + else + { + depth = 4; + last->next = curr->next; + } + free(curr); + Block_Table.size--; + break; + } + last = curr; + curr = (BlockTableEntry_T*)curr->next; + } +} + +void Cork_ReportMemoryLeaks(void) +{ + unsigned int index = 0; + cout << "-----------------------------------------------------------------" << endl; + cout << "Cork: Memory Allocation Analysis" << endl; + cout << "-----------------------------------------------------------------" << endl; + cout << "You have " << Block_Table.size << " Unclaimed objects." << endl; + + for(; index < TBL_SIZE; index++) + { + BlockTableEntry_T* entry = Block_Table.blocks[ index ]; + while(entry != NULL) + { + cout << "\t" << entry->size << "\t" << entry->ptr; + if( entry->file != NULL ) + { + cout << "\t" << entry->line << "\t" << entry->file; + } + cout << endl; + entry = (BlockTableEntry_T*)entry->next; + } + } +} + +void * operator new (size_t size, string file, unsigned int line) +{ + void * ptr = malloc(size); + char * fname = (char*)malloc(file.length()); + if(ptr == NULL) + { + throw bad_alloc(); + } + else + { + BlockTableEntry_T* entry = (BlockTableEntry_T*)malloc(sizeof(BlockTableEntry_T)); + strcpy( fname, file.c_str() ); + entry->ptr = ptr; + entry->size = size; + entry->file = fname; + entry->line = line; + entry->next = NULL; + insert_record(ptr,entry); + } + return ptr; +} + +void * operator new(size_t size) throw(bad_alloc) { + void * ptr = malloc(size); + if(ptr == NULL) + { + throw bad_alloc(); + } + else + { + BlockTableEntry_T* entry = (BlockTableEntry_T*)malloc(sizeof(BlockTableEntry_T)); + entry->ptr = ptr; + entry->size = size; + entry->file = NULL; + entry->line = 0; + entry->next = NULL; + insert_record(ptr,entry); + } + return ptr; +} + +void operator delete(void * p) { + free(p); + erase_record(p); +} + +#endif diff --git a/flex-bison/ducky/src/cork/cork.h b/flex-bison/ducky/src/cork/cork.h new file mode 100644 index 0000000..1aa8ab6 --- /dev/null +++ b/flex-bison/ducky/src/cork/cork.h @@ -0,0 +1,18 @@ +#ifndef CORK_H +#define CORK_H + +#ifdef DETECT_MEM_LEAKS + #include + typedef unsigned int size_t; + + void Cork_ReportMemoryLeaks(void); + void * operator new (size_t size, std::string file, unsigned int line); + #define TBL_SIZE 512 + #define REPORT_LEAKS() Cork_ReportMemoryLeaks() + #define _new new (__FILE__,__LINE__) +#else + #define REPORT_LEAKS() + #define _new new +#endif + +#endif diff --git a/flex-bison/ducky/src/grammar/grammar.tab.h b/flex-bison/ducky/src/grammar/grammar.tab.h new file mode 100644 index 0000000..94e63df --- /dev/null +++ b/flex-bison/ducky/src/grammar/grammar.tab.h @@ -0,0 +1,116 @@ + +/* A Bison parser, made by GNU Bison 2.4.1. */ + +/* Skeleton interface for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* "%code requires" blocks. */ + +/* Line 1676 of yacc.c */ +#line 14 "src/grammar/grammar.y" + +#include +#include "ast.h" + +string typeToString(unsigned int type); + + + +/* Line 1676 of yacc.c */ +#line 49 "src/grammar/grammar.tab.h" + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + tCONST = 258, + tVAR = 259, + tFUNC = 260, + tWHILE = 261, + tIF = 262, + tELSE = 263, + tEND = 264, + tRET = 265, + tINT = 266, + tFLOAT = 267, + tID = 268, + tSTRING = 269, + tADD = 270, + tSUB = 271, + tMUL = 272, + tDIV = 273, + tMOD = 274, + tPOW = 275, + tAND = 276, + tOR = 277, + tNOT = 278, + tEQ = 279, + tNE = 280, + tGT = 281, + tLT = 282, + tGTE = 283, + tLTE = 284, + tASSIGN = 285, + tROOT = 286, + tDECL = 287, + tBLOCK = 288, + tPARMLST = 289, + tEXPLST = 290, + tCALL = 291 + }; +#endif + + + +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef union YYSTYPE +{ + +/* Line 1676 of yacc.c */ +#line 31 "src/grammar/grammar.y" + + void* Node; + + + +/* Line 1676 of yacc.c */ +#line 108 "src/grammar/grammar.tab.h" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +#endif + + + + diff --git a/flex-bison/ducky/src/grammar/grammar.y b/flex-bison/ducky/src/grammar/grammar.y new file mode 100644 index 0000000..87e95e9 --- /dev/null +++ b/flex-bison/ducky/src/grammar/grammar.y @@ -0,0 +1,203 @@ +%{ + +#include +#include +#include +#include "parser.h" +#include "common.h" + +typedef void* yyscan_t; +#define YYLEX_PARAM context->lexinfo +void yyerror(ParseContext_T* context, const char * s); +%} + +%code requires { +#include +#include "ast.h" + +string typeToString(unsigned int type); +} + +/****************************************************************************** +* Parser Options +******************************************************************************/ +%define api.pure +%parse-param { ParseContext_T* context } + +/****************************************************************************** +* Syntax Tree Values +******************************************************************************/ +%union +{ + void* Node; +} + +%code{ +extern int yylex(YYSTYPE * yylval_param ,yyscan_t yyscanner); +} + +/****************************************************************************** +* Tokens +******************************************************************************/ +/* Keywords */ +%token tCONST tVAR tFUNC tWHILE tIF tELSE tEND tRET + +/* Literal Types */ +%token tINT +%token tFLOAT +%token tID +%token tSTRING + +/* Math Operators */ +%token tADD tSUB tMUL tDIV tMOD +%token '+' '-' '*' '/' '%' +%token tPOW + +/* Logical Operators */ +%token tAND tOR tNOT + +/* Comparison Operators */ +%token tEQ tNE tGT tLT tGTE tLTE + +/* Statement Operators */ +%token tASSIGN +%token '=' + +/* Braces and Parens */ +%token '(' ')' ',' + +/* Imaginary Node Types */ +%token tROOT tDECL tBLOCK tPARMLST tEXPLST tCALL + +/****************************************************************************** +* Rule Return Types +******************************************************************************/ +%type block +%type stmnt +%type if_stmnt +%type param_list +%type exp_list +%type function +%type exp +%type literal + +/****************************************************************************** +* Operator Precedence +******************************************************************************/ +%nonassoc tEQ tNE tGT tLT tGTE tLTE +%left '+' '-' +%left '*' '/' '%' +%left tPOW +%nonassoc tNOT +%left tAND tOR + +/****************************************************************************** +* Starting Rule +******************************************************************************/ +%start program + +%% + +program + : /* Nothing */ + | program stmnt { context->parser->processAST((AST*)$2); } + ; + +block + : stmnt { $$ = _new AST(tBLOCK, 1, $1); } + | block stmnt { $$ = $1; ((AST*)$$)->addChild((AST*)$2); } + +param_list + : tID { $$ = _new AST(tPARMLST, 1, $1); } + | param_list ',' tID { $$ = $1; ((AST*)$$)->addChild((AST*)$3); } + ; + +exp_list + : exp { $$ = _new AST(tEXPLST, 1, $1); } + | exp_list ',' exp { $$ = $1; ((AST*)$$)->addChild((AST*)$3); } + ; + +stmnt + : tID '=' exp { $$ = _new AST(tASSIGN, 2, $1, $3); } + | if_stmnt { $$ = $1; } + | function { $$ = $1; } + | exp { $$ = $1; } + ; + +if_stmnt + : tIF exp block tEND { $$ = _new AST(tIF, 2, $2, $3); } + | tIF exp block tELSE block tEND { $$ = _new AST(tIF, 3, $2, $3, $5); } + ; + +function + : tFUNC tID '(' param_list ')' block tEND { $$ = _new AST(tASSIGN, 2, $2, _new AST(tFUNC, 2, $4, $6)); } + ; + +exp + /* Mathematical Operators */ + : exp '+' exp { $$ = _new AST(tADD, 2, $1, $3); } + | exp '-' exp { $$ = _new AST(tSUB, 2, $1, $3); } + | exp '*' exp { $$ = _new AST(tMUL, 2, $1, $3); } + | exp '/' exp { $$ = _new AST(tDIV, 2, $1, $3); } + | exp '%' exp { $$ = _new AST(tMOD, 2, $1, $3); } + | exp tPOW exp { $$ = _new AST(tPOW, 2, $1, $3); } + + | exp tEQ exp { $$ = _new AST(tEQ, 2, $1, $3); } + | exp tNE exp { $$ = _new AST(tNE, 2, $1, $3); } + | exp tLT exp { $$ = _new AST(tLT, 2, $1, $3); } + | exp tGT exp { $$ = _new AST(tGT, 2, $1, $3); } + | exp tLTE exp { $$ = _new AST(tLTE, 2, $1, $3); } + | exp tGTE exp { $$ = _new AST(tGTE, 2, $1, $3); } + + | exp tAND exp { $$ = _new AST(tAND, 2, $1, $3); } + | exp tOR exp { $$ = _new AST(tOR, 2, $1, $3); } + | tNOT exp { $$ = _new AST(tNOT, 1, $2); } + + | tID '(' exp_list ')' { $$ = _new AST(tCALL, 2, $1, $3); } + | '(' exp ')' { $$ = $2; } + + /* Literal Values */ + | literal { $$ = $1; } + ; + +literal + : tINT { $$ = $1; } + | tFLOAT { $$ = $1; } + | tID { $$ = $1; } + | tSTRING { $$ = $1; } + ; + +%% + +void yyerror(ParseContext_T* context, const char * s) +{ + fprintf(stderr,"Error: %s\n", s); +} + +std::string typeToString(unsigned int type) +{ + ostringstream oss; + switch(type) + { + case tBLOCK: oss << "BLOCK" ; break; + case tVAR: oss << "VAR" ; break; + case tCONST: oss << "CONST" ; break; + case tADD: oss << "ADD" ; break; + case tSUB: oss << "SUB" ; break; + case tMUL: oss << "MUL" ; break; + case tDIV: oss << "DIV" ; break; + case tMOD: oss << "MOD" ; break; + case tPOW: oss << "POW" ; break; + case tASSIGN: oss << "ASSIGN" ; break; + case tDECL: oss << "DECL" ; break; + case tINT: oss << "INTEGER"; break; + case tFLOAT: oss << "FLOAT" ; break; + case tID: oss << "ID" ; break; + case tSTRING: oss << "STRING" ; break; + case tIF: oss << "IF" ; break; + case tWHILE: oss << "WHILE" ; break; + default: oss << type ; break; + } + return oss.str(); +} + diff --git a/flex-bison/ducky/src/lexer/lexer.l b/flex-bison/ducky/src/lexer/lexer.l new file mode 100644 index 0000000..a48e97d --- /dev/null +++ b/flex-bison/ducky/src/lexer/lexer.l @@ -0,0 +1,96 @@ +/* Pattern Macros */ +NUM [0-9] +AL [a-zA-Z] +HEX [a-fA-F0-9] +ALNUM [a-zA-Z0-9] +S [ \n\t] + +%{ + +/* Includes */ +#include +#include "ast.h" +#include "parser.h" +#include "grammar.tab.h" + +extern void yyerror(ParseContext_T* context, const char * s); + +#ifdef DEBUG_LEXER + #define RET_ENUM(retval) \ + printf("%s\n",#retval); \ + return retval; + #define RET_CHAR() \ + printf("%c\n", yytext[0]); \ + return yytext[0]; + #define RET_AST(type,retval) \ + printf("%s\n",#type); \ + yylval->Node = new AST( type, yytext ); \ + return type; +#else + #define RET_ENUM(retval) return retval; + #define RET_CHAR() return yytext[0]; + #define RET_AST(type) \ + yylval->Node = new AST( type, yytext ); \ + return type; +#endif + +%} + +%option reentrant +%option bison-bridge +%option noyywrap +%option nounput +%option noinput + +%% + /* Keywords */ +"const" { RET_ENUM(tCONST); } +"var" { RET_ENUM(tVAR); } +"func" { RET_ENUM(tFUNC); } +"while" { RET_ENUM(tWHILE); } +"if" { RET_ENUM(tIF); } +"else" { RET_ENUM(tELSE); } +"end" { RET_ENUM(tEND); } +"return" { RET_ENUM(tRET); } + + /* Math Operators*/ +"+" | +"-" | +"*" | +"/" | +"%" | + +"(" | +")" | +"," | + +"=" { RET_CHAR(); } +"**" { RET_ENUM(tPOW); } + +"!=" { RET_ENUM( tNE ); } +"==" { RET_ENUM( tEQ ); } +">" { RET_ENUM( tGT ); } +"<" { RET_ENUM( tLT ); } +">=" { RET_ENUM( tGTE ); } +"<=" { RET_ENUM( tLTE ); } + +"&&" | +"and" { RET_ENUM( tAND ); } +"||" | +"or" { RET_ENUM( tOR ); } +"!" | +"not" { RET_ENUM( tNOT ); } + +-?{NUM}+ { RET_AST(tINT); } +-?{NUM}+\.{NUM}{NUM}* { RET_AST(tFLOAT); } +{AL}{ALNUM}* { RET_AST(tID); } +[a-zA-Z_]?\"(\\.|[^\\"])*\" { RET_AST(tSTRING); } + +#.*\n ;/* Ignore Comments */ +{S} ;/* Ignore Whitespace */ +. { yyerror((ParseContext_T*)yyscanner, yytext); } + +%% + + + diff --git a/flex-bison/ducky/src/main.cpp b/flex-bison/ducky/src/main.cpp new file mode 100644 index 0000000..622b5b3 --- /dev/null +++ b/flex-bison/ducky/src/main.cpp @@ -0,0 +1,48 @@ +/****************************************************************************** + * Copyright (C) 2011 Michael D. Lowis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ +#include +#include +#include +#include "common.h" +#include "cl_options.h" +#include "parser.h" +#include "scheme.h" + +using namespace std; + +const string Compiler_Cmd("csc -I/c/chicken/include/chicken/ -"); +const string Interpreter_Cmd("csi"); + +int main(int argc, char** argv) +{ + U8 ret = 0; + list* files; + Parser* parser = _new Parser(_new SchemeFactory()); + CLO_ParseOptions(argc,argv); + files = CLO_GetFileList(); + + if(!files->empty()) + { + parser->parseFile( _new string(files->front()) ); + } + + delete parser; + CLO_Cleanup(); + REPORT_LEAKS(); + return (int)ret; +} + diff --git a/flex-bison/ducky/src/parser/ast/ast.cpp b/flex-bison/ducky/src/parser/ast/ast.cpp new file mode 100644 index 0000000..8683e97 --- /dev/null +++ b/flex-bison/ducky/src/parser/ast/ast.cpp @@ -0,0 +1,69 @@ +#include "ast.h" +#include +#include + +AST::AST(ASTNodeType type) +{ + node_type = type; + node_text = NULL; + node_children = new list(); +} + +AST::~AST() +{ + list::iterator it = node_children->begin(); + for(; it != node_children->end(); it++) + { + delete *(it); + } + delete node_children; + delete node_text; +} + +AST::AST(ASTNodeType type, char* text) +{ + node_type = type; + node_text = new string(text); + node_children = new list(); +} + +AST::AST(ASTNodeType type, int child_count, ...) +{ + va_list arg_list; + int i = 0; + node_type = type; + node_text = NULL; + node_children = new list(); + va_start (arg_list, child_count); + for (i = 0; i < child_count ; i++) + { + node_children->push_back( (AST*)va_arg(arg_list, AST*) ); + } + va_end(arg_list); +} + +ASTNodeType AST::type() +{ + return node_type; +} + +list* AST::children() +{ + return node_children; +} + +string AST::text() +{ + ostringstream oss; + if(node_text != NULL) + { + oss << node_text->c_str(); + } + return oss.str(); +} + +void AST::addChild(AST* node) +{ + node_children->push_back(node); +} + diff --git a/flex-bison/ducky/src/parser/ast/ast.h b/flex-bison/ducky/src/parser/ast/ast.h new file mode 100644 index 0000000..6877fdf --- /dev/null +++ b/flex-bison/ducky/src/parser/ast/ast.h @@ -0,0 +1,28 @@ +#ifndef AST_H +#define AST_H + +#include +#include +#include + +using namespace std; + +typedef unsigned int ASTNodeType; + +class AST { + protected: + ASTNodeType node_type; + string* node_text; + list* node_children; + public: + AST(ASTNodeType type); + ~AST(); + AST(ASTNodeType type, char* text); + AST(ASTNodeType type, int child_count, ...); + ASTNodeType type(); + string text(); + list* children(); + void addChild(AST* node); +}; + +#endif diff --git a/flex-bison/ducky/src/parser/parser.cpp b/flex-bison/ducky/src/parser/parser.cpp new file mode 100644 index 0000000..84eb3f0 --- /dev/null +++ b/flex-bison/ducky/src/parser/parser.cpp @@ -0,0 +1,69 @@ +/****************************************************************************** + * Copyright (C) 2001 Michael D. Lowis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ +/****************************************************************************** + * Includes and Prototypes + *****************************************************************************/ +#include +#include "parser.h" + +using namespace std; + +#ifdef PURE_PARSER +typedef void* yyscan_t; +extern int yyparse(ParseContext_T* context); +extern int yylex_init(yyscan_t* ptr_yy_globals); +extern void yyset_in (FILE* in_str , yyscan_t yyscanner); +#else +#endif + +/****************************************************************************** + * Public Functions + *****************************************************************************/ +Parser::~Parser() +{ + delete factory; +} + +void Parser::parseInput(FILE* in_file) +{ + if ( in_file != NULL ) + { + #ifdef PURE_PARSER + ParseContext_T context = { NULL, this}; + yylex_init( &(context.lexinfo) ); + yyset_in( in_file, context.lexinfo ); + yyparse( &context ); + #else + #endif + } +} + +void Parser::parseFile(string* in_file) +{ + FILE* input_file = fopen( in_file->c_str() ,"r"); + parseInput( input_file ); + delete in_file; +} + +void Parser::processAST(AST* root) +{ + Visitor* translator = factory->createVisitor(root); + translator->visit(); + cout << translator->str(); + delete translator; +} + diff --git a/flex-bison/ducky/src/parser/parser.h b/flex-bison/ducky/src/parser/parser.h new file mode 100644 index 0000000..b2e146c --- /dev/null +++ b/flex-bison/ducky/src/parser/parser.h @@ -0,0 +1,46 @@ +/****************************************************************************** + * Copyright (C) 2001 Michael D. Lowis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ +#ifndef PARSER_H +#define PARSER_H + +#include +#include "ast.h" +#include "visitor.h" + +using namespace std; + +class Parser { + protected: + VisitorFactory* factory; + private: + public: + Parser(VisitorFactory* trans_fact) : factory(trans_fact) {} + ~Parser(); + void parseFile(string* in_file); + void parseInput(FILE* in_file); + void processAST(AST* root); +}; + +#ifdef PURE_PARSER +typedef struct +{ + void* lexinfo; + Parser* parser; +} ParseContext_T; +#endif + +#endif diff --git a/flex-bison/ducky/src/parser/visitor/visitor.cpp b/flex-bison/ducky/src/parser/visitor/visitor.cpp new file mode 100644 index 0000000..71c3ccf --- /dev/null +++ b/flex-bison/ducky/src/parser/visitor/visitor.cpp @@ -0,0 +1,35 @@ +#include "visitor.h" +#include + +using namespace std; + +void Visitor::visit(AST* cur, int depth) +{ + list* children; + list::iterator it; + + // If we are just starting then use the global tree + if(cur == NULL) cur = ast; + + // Execute or pre-walk actions + if(depth == 0) beforeVisit( cur, depth ); + + // Setup our locals + children = cur->children(); + it = children->begin(); + + // Visit the tree + beforeChildren(cur,depth); + depth++; + for(; it != children->end(); it++) + { + beforeChild( *it, depth ); + visit( *it, depth ); + afterChild( *it, depth ); + } + afterChildren(cur,depth); + + // Execute our post-walk actions + if(depth == 1) afterVisit( cur, depth ); +} + diff --git a/flex-bison/ducky/src/parser/visitor/visitor.h b/flex-bison/ducky/src/parser/visitor/visitor.h new file mode 100644 index 0000000..61fdde0 --- /dev/null +++ b/flex-bison/ducky/src/parser/visitor/visitor.h @@ -0,0 +1,30 @@ +#ifndef TRANSLATOR_H +#define TRANSLATOR_H + +#include "ast.h" +#include +#include + +class Visitor { + protected: + AST* ast; + public: + Visitor(AST* tree) : ast(tree) {}; + ~Visitor() { delete ast; } + void visit(AST* cur = NULL, int depth = 0); + virtual string str() = 0; + private: + virtual void beforeVisit(AST* cur, int depth) = 0; + virtual void afterVisit(AST* cur, int depth) = 0; + virtual void beforeChildren(AST* cur, int depth) = 0; + virtual void afterChildren(AST* cur, int depth) = 0; + virtual void beforeChild(AST* cur, int depth) = 0; + virtual void afterChild(AST* cur, int depth) = 0; +}; + +class VisitorFactory { + public: + virtual Visitor* createVisitor(AST* root) = 0; +}; + +#endif diff --git a/flex-bison/ducky/src/visitors/dot/dot.cpp b/flex-bison/ducky/src/visitors/dot/dot.cpp new file mode 100644 index 0000000..d39bb62 --- /dev/null +++ b/flex-bison/ducky/src/visitors/dot/dot.cpp @@ -0,0 +1,53 @@ +#include "dot.h" +#include "grammar.tab.h" + +using namespace std; + +string DOT::str() +{ + return stream.str(); +} + +void DOT::beforeVisit(AST* cur, int depth) +{ + stream << "digraph {" << endl; +} + +void DOT::afterVisit(AST* cur, int depth) +{ + stream << "}" << endl; +} + +void DOT::beforeChildren(AST* cur, int depth) +{ + list* children = cur->children(); + stream << "\t" << current_id++ << " [label=\""; + if ( children->empty() && (!cur->text().empty())) + { + stream << cur->text() << "\"]" << endl; + } + else + { + stream << typeToString(cur->type()) << "\"]" << endl; + } + + if(!parents.empty()) + { + stream << "\t" << parents.top() << "->" << current_id-1 << endl; + } + parents.push(current_id-1); +} + +void DOT::afterChildren(AST* cur, int depth) +{ + parents.pop(); +} + +void DOT::beforeChild(AST* cur, int depth) +{ +} + +void DOT::afterChild(AST* cur, int depth) +{ +} + diff --git a/flex-bison/ducky/src/visitors/dot/dot.h b/flex-bison/ducky/src/visitors/dot/dot.h new file mode 100644 index 0000000..7ce5ce6 --- /dev/null +++ b/flex-bison/ducky/src/visitors/dot/dot.h @@ -0,0 +1,26 @@ +#ifndef DOT_H +#define DOT_H + +#include "visitor.h" +#include +#include +#include + +class DOT : public Visitor { + protected: + stack parents; + ostringstream stream; + int current_id; + public: + DOT(AST* root) : Visitor(root), current_id(0) {}; + string str(); + private: + void beforeVisit(AST* cur, int depth); + void afterVisit(AST* cur, int depth); + void beforeChildren(AST* cur, int depth); + void afterChildren(AST* cur, int depth); + void beforeChild(AST* cur, int depth); + void afterChild(AST* cur, int depth); +}; + +#endif diff --git a/flex-bison/ducky/src/visitors/llvm/llvm.cpp b/flex-bison/ducky/src/visitors/llvm/llvm.cpp new file mode 100644 index 0000000..5c2410f --- /dev/null +++ b/flex-bison/ducky/src/visitors/llvm/llvm.cpp @@ -0,0 +1,156 @@ +#include "llvm.h" +#include "grammar.tab.h" +using namespace std; + +string LLVM::str() +{ + return stream.str(); +} + +void LLVM::beforeVisit(AST* cur, int depth) +{ +} + +void LLVM::afterVisit(AST* cur, int depth) +{ +} + +void LLVM::beforeChildren(AST* cur, int depth) +{ +} + +void LLVM::afterChildren(AST* cur, int depth) +{ + cout << "stack: " << buffer.size() << endl; + switch((int)cur->type()) + { + // Attributes + case tVAR: + case tCONST: + // These are attributes used by later rules + break; + + // Arithmetic + case tADD: + case tSUB: + case tMUL: + case tDIV: + case tMOD: + case tPOW: + // Evaluate Expression + evaluateExpression(cur); + break; + + // Operators + case '=': + assignValue(cur); + break; + case tDECL: + declareValue(cur); + break; + + // Types + case tINT: + case tFLOAT: + case tID: + case tSTRING: + translateLiteral(cur); + break; + + // If we got a node we don't recognize + default: + //displayError(); + break; + } +} + +void LLVM::beforeChild(AST* cur, int depth) +{ +} + +void LLVM::afterChild(AST* cur, int depth) +{ +} + +/****************************************************************************** + * Rule Actions + *****************************************************************************/ + void LLVM::translateLiteral(AST* cur) + { + ostringstream oss; + switch(cur->type()) + { + case tINT: + oss << "i32 " << cur->text(); + break; + case tFLOAT: + oss << "float " << cur->text(); + break; + case tID: + oss << "$" << cur->text(); + break; + case tSTRING: + oss << "string c" << cur->text(); + break; + default: + //displayError(); + break; + } + cout << "pushing: " << oss.str() << endl; + buffer.push(oss.str()); + } + +void LLVM::evaluateExpression(AST* cur) +{ + string reg = getTempRegister(); + string src1 = buffer.top(); + buffer.pop(); + string src2 = buffer.top(); + buffer.pop(); + + cout << "popping 2 items for: " << typeToString(cur->type()) << endl; + stream << reg << " = " << getInstruction(cur->type()) << " "; + stream << src2 << ", " << src1 << endl; + buffer.push(reg); +} + +void LLVM::assignValue(AST* cur) +{ +} + +void LLVM::declareValue(AST* cur) +{ +} + +void LLVM::displayError(AST* cur, string msg) +{ +} + +/****************************************************************************** + * Helper Functions + *****************************************************************************/ +string LLVM::getTempRegister() +{ + ostringstream oss; + oss << "$" << temp_register++; + return oss.str(); +} + +string LLVM::getInstruction(ASTNodeType type) +{ + ostringstream oss; + switch(type) + { + case tADD: oss << "add"; break; + case tSUB: oss << "sub"; break; + case tMUL: oss << "mul"; break; + case tDIV: oss << "div"; break; + case tMOD: oss << "mod"; break; + case tPOW: oss << "pow"; break; + default: + // displayError(); + break; + } + return oss.str(); +} + diff --git a/flex-bison/ducky/src/visitors/llvm/llvm.h b/flex-bison/ducky/src/visitors/llvm/llvm.h new file mode 100644 index 0000000..2da8632 --- /dev/null +++ b/flex-bison/ducky/src/visitors/llvm/llvm.h @@ -0,0 +1,37 @@ +#ifndef LLVM_H +#define LLVM_H + +#include "visitor.h" +#include +#include + +class LLVM : public Visitor { + protected: + ostringstream stream; + stack buffer; + int temp_register; + public: + LLVM(AST* root) : Visitor(root), temp_register(0) {}; + string str(); + private: + // Visitor Actions + void beforeVisit(AST* cur, int depth); + void afterVisit(AST* cur, int depth); + void beforeChildren(AST* cur, int depth); + void afterChildren(AST* cur, int depth); + void beforeChild(AST* cur, int depth); + void afterChild(AST* cur, int depth); + + // Tree Parsing Actions + void translateLiteral(AST* cur); + void evaluateExpression(AST* cur); + void assignValue(AST* cur); + void declareValue(AST* cur); + void displayError(AST* cur, string msg); + + // Helper Methods + string getTempRegister(); + string getInstruction(ASTNodeType type); +}; + +#endif diff --git a/flex-bison/ducky/src/visitors/scheme/scheme.cpp b/flex-bison/ducky/src/visitors/scheme/scheme.cpp new file mode 100644 index 0000000..39523f7 --- /dev/null +++ b/flex-bison/ducky/src/visitors/scheme/scheme.cpp @@ -0,0 +1,98 @@ +#include "scheme.h" +#include "grammar.tab.h" + +using namespace std; + +string Scheme::str() +{ + return stream.str(); +} + +void Scheme::beforeVisit(AST* cur, int depth) +{ +} + +void Scheme::afterVisit(AST* cur, int depth) +{ + stream << endl; +} + +void Scheme::beforeChildren(AST* cur, int depth) +{ + if(isLiteral(cur)) + { + stream << cur->text(); + } + else + { + stream << "(" << typeToString(cur) << " " << cur->text(); + } +} + +void Scheme::afterChildren(AST* cur, int depth) +{ + if(!isLiteral(cur)) + { + stream << ")"; + } +} + +void Scheme::beforeChild(AST* cur, int depth) +{ + stream << endl; + for(int i = 0; i< depth; i++) + { + stream << " "; + } +} + +void Scheme::afterChild(AST* cur, int depth) +{ +} + +string Scheme::typeToString(AST* cur) +{ + ostringstream oss; + switch((int)cur->type()) + { + case tFUNC: oss << "lambda"; break; + case tWHILE: oss << "while"; break; + case tIF: oss << "if"; break; + case tADD: oss << "+"; break; + case tSUB: oss << "-"; break; + case tMUL: oss << "*"; break; + case tDIV: oss << "/"; break; + case tMOD: oss << "modulo"; break; + case tPOW: oss << "pow"; break; + case tASSIGN: oss << "define"; break; + case tBLOCK: oss << "begin"; break; + case tCALL: oss << "apply"; break; + case tEXPLST: oss << "list"; break; + + case tEQ: oss << "eq?"; break; + case tNE: oss << "!="; break; + case tLT: oss << "<"; break; + case tGT: oss << ">"; break; + case tLTE: oss << "<="; break; + case tGTE: oss << ">="; break; + case tAND: oss << "and"; break; + case tOR: oss << "or"; break; + case tNOT: oss << "not"; break; + } + return oss.str(); +} + +BOOL Scheme::isLiteral(AST* cur) +{ + BOOL ret = FALSE; + switch(cur->type()) + { + case tINT: + case tFLOAT: + case tSTRING: + case tID: ret = TRUE; break; + default: break; + } + return ret; +} + diff --git a/flex-bison/ducky/src/visitors/scheme/scheme.h b/flex-bison/ducky/src/visitors/scheme/scheme.h new file mode 100644 index 0000000..4281d11 --- /dev/null +++ b/flex-bison/ducky/src/visitors/scheme/scheme.h @@ -0,0 +1,32 @@ +#ifndef Scheme_H +#define Scheme_H + +#include +#include +#include "visitor.h" +#include "common.h" + +class Scheme : public Visitor { + protected: + ostringstream stream; + public: + Scheme(AST* root) : Visitor(root) {}; + string str(); + private: + string typeToString(); + void beforeVisit(AST* cur, int depth); + void afterVisit(AST* cur, int depth); + void beforeChildren(AST* cur, int depth); + void afterChildren(AST* cur, int depth); + void beforeChild(AST* cur, int depth); + void afterChild(AST* cur, int depth); + string typeToString(AST* cur); + BOOL isLiteral(AST* cur); +}; + +class SchemeFactory : public VisitorFactory { + public: + Visitor* createVisitor(AST* root) { return new Scheme(root); } +}; + +#endif diff --git a/flex-bison/ducky/src/visitors/sexp/sexp.cpp b/flex-bison/ducky/src/visitors/sexp/sexp.cpp new file mode 100644 index 0000000..d396e08 --- /dev/null +++ b/flex-bison/ducky/src/visitors/sexp/sexp.cpp @@ -0,0 +1,42 @@ +#include "sexp.h" +#include "grammar.tab.h" + +using namespace std; + +string SEXP::str() +{ + return stream.str(); +} + +void SEXP::beforeVisit(AST* cur, int depth) +{ +} + +void SEXP::afterVisit(AST* cur, int depth) +{ + stream << endl; +} + +void SEXP::beforeChildren(AST* cur, int depth) +{ + stream << "(" << typeToString(cur->type()) << " " << cur->text(); +} + +void SEXP::afterChildren(AST* cur, int depth) +{ + stream << ")"; +} + +void SEXP::beforeChild(AST* cur, int depth) +{ + stream << endl; + for(int i = 0; i< depth; i++) + { + stream << " "; + } +} + +void SEXP::afterChild(AST* cur, int depth) +{ +} + diff --git a/flex-bison/ducky/src/visitors/sexp/sexp.h b/flex-bison/ducky/src/visitors/sexp/sexp.h new file mode 100644 index 0000000..16cf992 --- /dev/null +++ b/flex-bison/ducky/src/visitors/sexp/sexp.h @@ -0,0 +1,23 @@ +#ifndef SEXP_H +#define SEXP_H + +#include "visitor.h" +#include +#include + +class SEXP : public Visitor { + protected: + ostringstream stream; + public: + SEXP(AST* root) : Visitor(root) {}; + string str(); + private: + void beforeVisit(AST* cur, int depth); + void afterVisit(AST* cur, int depth); + void beforeChildren(AST* cur, int depth); + void afterChildren(AST* cur, int depth); + void beforeChild(AST* cur, int depth); + void afterChild(AST* cur, int depth); +}; + +#endif diff --git a/flex-bison/ducky/submodules/cork/README.txt b/flex-bison/ducky/submodules/cork/README.txt new file mode 100644 index 0000000..15a01b7 --- /dev/null +++ b/flex-bison/ducky/submodules/cork/README.txt @@ -0,0 +1,6 @@ +Overview +------------------------------------------------------------------------------- +Cork is a compiled in memory leak detector for C++. It provides overloaded new +and delete operators that track when and where objects are allocated and +deallocated. + diff --git a/flex-bison/ducky/submodules/cork/src/cork.cpp b/flex-bison/ducky/submodules/cork/src/cork.cpp new file mode 100644 index 0000000..5fb3e09 --- /dev/null +++ b/flex-bison/ducky/submodules/cork/src/cork.cpp @@ -0,0 +1,183 @@ +#include "cork.h" + +#ifdef DETECT_MEM_LEAKS + +// We want to use the real malloc and free in this file +#undef malloc +#undef free + +#include +#include // for std::bad_alloc +#include // for malloc() and free() +#include + +// Set the namespace +using namespace std; +/****************************************************************************** + * Typedefs + *****************************************************************************/ +typedef struct BlockTableEntry +{ + void * ptr; + unsigned int size; + const char* file; + int line; + void * next; +} BlockTableEntry_T; + +typedef struct BlockTable +{ + unsigned int size; + BlockTableEntry_T* blocks[TBL_SIZE]; +} BlockTable_T; + +/****************************************************************************** + * Prototypes + *****************************************************************************/ +void insert_record(void * ptr, BlockTable_T* entry); +void erase_record(void * ptr); + +/****************************************************************************** + * Globals + *****************************************************************************/ +unsigned int allocated; +static BlockTable_T Block_Table = { 0, {0} }; + +/****************************************************************************** + * Function Definitions + *****************************************************************************/ +void insert_record(void * ptr, BlockTableEntry_T* entry) +{ + unsigned int index = ((unsigned int)ptr) % TBL_SIZE; + BlockTableEntry_T* last = Block_Table.blocks[ index ]; + BlockTableEntry_T* curr = last; + + while (curr != NULL) + { + if ( curr->ptr == ptr ) + { + curr->size = entry->size; + free(entry); + break; + } + last = curr; + curr = (BlockTableEntry_T*)curr->next; + } + + if(curr == NULL) + { + if (last != NULL) + { + last->next = entry; + } + else + { + Block_Table.blocks[index] = entry; + } + Block_Table.size++; + } +} + +void erase_record(void * ptr) +{ + int depth = 0; + unsigned int index = ((unsigned int)ptr) % TBL_SIZE; + BlockTableEntry_T* last = Block_Table.blocks[ index ]; + BlockTableEntry_T* curr = last; + + while( curr != NULL ) + { + depth = 1; + if( curr->ptr == ptr ) + { + depth = 2; + if(last == curr) + { + depth = 3; + Block_Table.blocks[ index ] = (BlockTableEntry_T*)curr->next; + } + else + { + depth = 4; + last->next = curr->next; + } + free(curr); + Block_Table.size--; + break; + } + last = curr; + curr = (BlockTableEntry_T*)curr->next; + } +} + +void Cork_ReportMemoryLeaks(void) +{ + unsigned int index = 0; + cout << "-----------------------------------------------------------------" << endl; + cout << "Cork: Memory Allocation Analysis" << endl; + cout << "-----------------------------------------------------------------" << endl; + cout << "You have " << Block_Table.size << " Unclaimed objects." << endl; + + for(; index < TBL_SIZE; index++) + { + BlockTableEntry_T* entry = Block_Table.blocks[ index ]; + while(entry != NULL) + { + cout << "\t" << entry->size << "\t" << entry->ptr; + if( entry->file != NULL ) + { + cout << "\t" << entry->line << "\t" << entry->file; + } + cout << endl; + entry = (BlockTableEntry_T*)entry->next; + } + } +} + +void * operator new (size_t size, string file, unsigned int line) +{ + void * ptr = malloc(size); + char * fname = (char*)malloc(file.length()); + if(ptr == NULL) + { + throw bad_alloc(); + } + else + { + BlockTableEntry_T* entry = (BlockTableEntry_T*)malloc(sizeof(BlockTableEntry_T)); + strcpy( fname, file.c_str() ); + entry->ptr = ptr; + entry->size = size; + entry->file = fname; + entry->line = line; + entry->next = NULL; + insert_record(ptr,entry); + } + return ptr; +} + +void * operator new(size_t size) throw(bad_alloc) { + void * ptr = malloc(size); + if(ptr == NULL) + { + throw bad_alloc(); + } + else + { + BlockTableEntry_T* entry = (BlockTableEntry_T*)malloc(sizeof(BlockTableEntry_T)); + entry->ptr = ptr; + entry->size = size; + entry->file = NULL; + entry->line = 0; + entry->next = NULL; + insert_record(ptr,entry); + } + return ptr; +} + +void operator delete(void * p) { + free(p); + erase_record(p); +} + +#endif diff --git a/flex-bison/ducky/submodules/cork/src/cork.h b/flex-bison/ducky/submodules/cork/src/cork.h new file mode 100644 index 0000000..1aa8ab6 --- /dev/null +++ b/flex-bison/ducky/submodules/cork/src/cork.h @@ -0,0 +1,18 @@ +#ifndef CORK_H +#define CORK_H + +#ifdef DETECT_MEM_LEAKS + #include + typedef unsigned int size_t; + + void Cork_ReportMemoryLeaks(void); + void * operator new (size_t size, std::string file, unsigned int line); + #define TBL_SIZE 512 + #define REPORT_LEAKS() Cork_ReportMemoryLeaks() + #define _new new (__FILE__,__LINE__) +#else + #define REPORT_LEAKS() + #define _new new +#endif + +#endif diff --git a/flex-bison/ducky/submodules/parse-utils/README.txt b/flex-bison/ducky/submodules/parse-utils/README.txt new file mode 100644 index 0000000..2b07464 --- /dev/null +++ b/flex-bison/ducky/submodules/parse-utils/README.txt @@ -0,0 +1,5 @@ +Overview +------------------------------------------------------------------------------- +This module provides a collection of C++ classes for implementing parsers in +C and C++. Among the classes provided are a homogenous abstract syntax tree +and an tree visitor. diff --git a/flex-bison/ducky/submodules/parse-utils/src/ast/ast.cpp b/flex-bison/ducky/submodules/parse-utils/src/ast/ast.cpp new file mode 100644 index 0000000..8683e97 --- /dev/null +++ b/flex-bison/ducky/submodules/parse-utils/src/ast/ast.cpp @@ -0,0 +1,69 @@ +#include "ast.h" +#include +#include + +AST::AST(ASTNodeType type) +{ + node_type = type; + node_text = NULL; + node_children = new list(); +} + +AST::~AST() +{ + list::iterator it = node_children->begin(); + for(; it != node_children->end(); it++) + { + delete *(it); + } + delete node_children; + delete node_text; +} + +AST::AST(ASTNodeType type, char* text) +{ + node_type = type; + node_text = new string(text); + node_children = new list(); +} + +AST::AST(ASTNodeType type, int child_count, ...) +{ + va_list arg_list; + int i = 0; + node_type = type; + node_text = NULL; + node_children = new list(); + va_start (arg_list, child_count); + for (i = 0; i < child_count ; i++) + { + node_children->push_back( (AST*)va_arg(arg_list, AST*) ); + } + va_end(arg_list); +} + +ASTNodeType AST::type() +{ + return node_type; +} + +list* AST::children() +{ + return node_children; +} + +string AST::text() +{ + ostringstream oss; + if(node_text != NULL) + { + oss << node_text->c_str(); + } + return oss.str(); +} + +void AST::addChild(AST* node) +{ + node_children->push_back(node); +} + diff --git a/flex-bison/ducky/submodules/parse-utils/src/ast/ast.h b/flex-bison/ducky/submodules/parse-utils/src/ast/ast.h new file mode 100644 index 0000000..6877fdf --- /dev/null +++ b/flex-bison/ducky/submodules/parse-utils/src/ast/ast.h @@ -0,0 +1,28 @@ +#ifndef AST_H +#define AST_H + +#include +#include +#include + +using namespace std; + +typedef unsigned int ASTNodeType; + +class AST { + protected: + ASTNodeType node_type; + string* node_text; + list* node_children; + public: + AST(ASTNodeType type); + ~AST(); + AST(ASTNodeType type, char* text); + AST(ASTNodeType type, int child_count, ...); + ASTNodeType type(); + string text(); + list* children(); + void addChild(AST* node); +}; + +#endif diff --git a/flex-bison/ducky/submodules/parse-utils/src/parser.cpp b/flex-bison/ducky/submodules/parse-utils/src/parser.cpp new file mode 100644 index 0000000..84eb3f0 --- /dev/null +++ b/flex-bison/ducky/submodules/parse-utils/src/parser.cpp @@ -0,0 +1,69 @@ +/****************************************************************************** + * Copyright (C) 2001 Michael D. Lowis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ +/****************************************************************************** + * Includes and Prototypes + *****************************************************************************/ +#include +#include "parser.h" + +using namespace std; + +#ifdef PURE_PARSER +typedef void* yyscan_t; +extern int yyparse(ParseContext_T* context); +extern int yylex_init(yyscan_t* ptr_yy_globals); +extern void yyset_in (FILE* in_str , yyscan_t yyscanner); +#else +#endif + +/****************************************************************************** + * Public Functions + *****************************************************************************/ +Parser::~Parser() +{ + delete factory; +} + +void Parser::parseInput(FILE* in_file) +{ + if ( in_file != NULL ) + { + #ifdef PURE_PARSER + ParseContext_T context = { NULL, this}; + yylex_init( &(context.lexinfo) ); + yyset_in( in_file, context.lexinfo ); + yyparse( &context ); + #else + #endif + } +} + +void Parser::parseFile(string* in_file) +{ + FILE* input_file = fopen( in_file->c_str() ,"r"); + parseInput( input_file ); + delete in_file; +} + +void Parser::processAST(AST* root) +{ + Visitor* translator = factory->createVisitor(root); + translator->visit(); + cout << translator->str(); + delete translator; +} + diff --git a/flex-bison/ducky/submodules/parse-utils/src/parser.h b/flex-bison/ducky/submodules/parse-utils/src/parser.h new file mode 100644 index 0000000..b2e146c --- /dev/null +++ b/flex-bison/ducky/submodules/parse-utils/src/parser.h @@ -0,0 +1,46 @@ +/****************************************************************************** + * Copyright (C) 2001 Michael D. Lowis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ +#ifndef PARSER_H +#define PARSER_H + +#include +#include "ast.h" +#include "visitor.h" + +using namespace std; + +class Parser { + protected: + VisitorFactory* factory; + private: + public: + Parser(VisitorFactory* trans_fact) : factory(trans_fact) {} + ~Parser(); + void parseFile(string* in_file); + void parseInput(FILE* in_file); + void processAST(AST* root); +}; + +#ifdef PURE_PARSER +typedef struct +{ + void* lexinfo; + Parser* parser; +} ParseContext_T; +#endif + +#endif diff --git a/flex-bison/ducky/submodules/parse-utils/src/visitor/visitor.cpp b/flex-bison/ducky/submodules/parse-utils/src/visitor/visitor.cpp new file mode 100644 index 0000000..71c3ccf --- /dev/null +++ b/flex-bison/ducky/submodules/parse-utils/src/visitor/visitor.cpp @@ -0,0 +1,35 @@ +#include "visitor.h" +#include + +using namespace std; + +void Visitor::visit(AST* cur, int depth) +{ + list* children; + list::iterator it; + + // If we are just starting then use the global tree + if(cur == NULL) cur = ast; + + // Execute or pre-walk actions + if(depth == 0) beforeVisit( cur, depth ); + + // Setup our locals + children = cur->children(); + it = children->begin(); + + // Visit the tree + beforeChildren(cur,depth); + depth++; + for(; it != children->end(); it++) + { + beforeChild( *it, depth ); + visit( *it, depth ); + afterChild( *it, depth ); + } + afterChildren(cur,depth); + + // Execute our post-walk actions + if(depth == 1) afterVisit( cur, depth ); +} + diff --git a/flex-bison/ducky/submodules/parse-utils/src/visitor/visitor.h b/flex-bison/ducky/submodules/parse-utils/src/visitor/visitor.h new file mode 100644 index 0000000..61fdde0 --- /dev/null +++ b/flex-bison/ducky/submodules/parse-utils/src/visitor/visitor.h @@ -0,0 +1,30 @@ +#ifndef TRANSLATOR_H +#define TRANSLATOR_H + +#include "ast.h" +#include +#include + +class Visitor { + protected: + AST* ast; + public: + Visitor(AST* tree) : ast(tree) {}; + ~Visitor() { delete ast; } + void visit(AST* cur = NULL, int depth = 0); + virtual string str() = 0; + private: + virtual void beforeVisit(AST* cur, int depth) = 0; + virtual void afterVisit(AST* cur, int depth) = 0; + virtual void beforeChildren(AST* cur, int depth) = 0; + virtual void afterChildren(AST* cur, int depth) = 0; + virtual void beforeChild(AST* cur, int depth) = 0; + virtual void afterChild(AST* cur, int depth) = 0; +}; + +class VisitorFactory { + public: + virtual Visitor* createVisitor(AST* root) = 0; +}; + +#endif diff --git a/flex-bison/grammar_test/foo.lang b/flex-bison/grammar_test/foo.lang new file mode 100644 index 0000000..4e140ee --- /dev/null +++ b/flex-bison/grammar_test/foo.lang @@ -0,0 +1,6 @@ +asd +:foo +1 +1.0 +'a' +1 + 1 diff --git a/flex-bison/grammar_test/rakefile.rb b/flex-bison/grammar_test/rakefile.rb new file mode 100644 index 0000000..53b2fe9 --- /dev/null +++ b/flex-bison/grammar_test/rakefile.rb @@ -0,0 +1,79 @@ +require 'rake' +require 'rake/clean' + + +# Application +APP_NAME = 'grammar' +APP_EXT = '.exe' +APP_OUT = "#{APP_NAME}#{APP_EXT}" + +# GNU Flex Settings +FLEX_BIN = 'flex' +FLEX_OPTS = '' +FLEX_IN = 'src/lexer.l' +FLEX_OUT = 'src/lex.yy.c' + +# GNU Bison Settings +BISON_BIN = 'bison' +BISON_OPTS = '-d' +BISON_IN = 'src/grammar.y' +BISON_OUT = 'src/grammar.tab.c' + +# Compiler Settings +COMPILER_BIN = 'g++' +COMPILER_OPTS = '-c -Wall' + +# Linker Settings +LINKER_BIN = 'g++' +LINKER_OPTS = '' + +# Source Code Settings +SRC_FILES = [FLEX_OUT,BISON_OUT, 'src/ast.cpp'] +INCLUDE_DIRS = FileList['src/**/'] +DEFINES = [] + +# Generated Options +OBJ_FILES = SRC_FILES.collect{|src| "build/#{File.basename(src).ext('o')}" } +DEFINE_LIST = DEFINES.collect{|define| "-D#{define}" } +INCLUDE_LIST = INCLUDE_DIRS.collect{|x| "-I#{x} "} + +# Clean Task +CLEAN.include( 'build/*.o' ) +CLEAN.include( 'src/grammar.tab.c' ) +CLEAN.include( 'src/grammar.tab.h' ) +CLEAN.include( 'src/lex.yy.c' ) +CLEAN.include( 'src/lex.yy.h' ) +CLEAN.include( APP_OUT ) + +#------------------------------------------------------------------------------ + +task :default => [:release] +task :release => [:generated, APP_OUT] +task :generated => [FLEX_OUT,BISON_OUT] + +# Generate Lexer +file FLEX_OUT => [FLEX_IN] do + sh "#{FLEX_BIN} #{FLEX_OPTS} -o#{FLEX_OUT} #{FLEX_IN}" +end + +# Generate Parser +file BISON_OUT => [BISON_IN] do + sh "#{BISON_BIN} #{BISON_OPTS} -o#{BISON_OUT} #{BISON_IN}" +end + +# Find and compile all source files +def FindSourceByObj(obj) + return SRC_FILES.find { |s| + (File.basename(s, '.c') == File.basename(obj, '.o')) || + (File.basename(s, '.cpp') == File.basename(obj, '.o')) + } +end +rule '.o' => lambda{|obj| FindSourceByObj(obj) } do |t| + sh "#{COMPILER_BIN} #{COMPILER_OPTS} #{INCLUDE_LIST} #{DEFINE_LIST} -o #{t.name} #{t.source}" +end + +# Link the object files together +task APP_OUT => OBJ_FILES do + puts "Linking #{APP_OUT}..." + sh "#{LINKER_BIN} #{LINKER_OPTS} -o #{APP_NAME} #{OBJ_FILES.collect{|x| x + ' '}}" +end diff --git a/flex-bison/grammar_test/sample.lang b/flex-bison/grammar_test/sample.lang new file mode 100644 index 0000000..513361e --- /dev/null +++ b/flex-bison/grammar_test/sample.lang @@ -0,0 +1,116 @@ +#------------------------------------------------------------------------------ +# Literals +#------------------------------------------------------------------------------ +# Number Literals +let a = 1 +let b = -1 +let c = 1.0 +let d = -1.0 + +# Atom Literals +let e = :some_atom + +# String and Char Literals +# String +let f = "" +let g = "Some string" + +# Char +let h = '' +let i = 'C' + +# Func Literals +let j = (a,b){} + +# Vector Literals +let k = [] +let l = [0,1,2,3,4] +let m = [0, 'A', "foo", :bar] + +# List Literals +let p = () +let q = (0,1,2,3,4) +let r = (0, 'A', "foo", :bar) + +#------------------------------------------------------------------------------ +# Arithmetic +#------------------------------------------------------------------------------ +# Addition +let s = 1 + 1 +let t = 1 + -1 +let u = -1 + 1 +let v = -1 + -1 +let w = 1+1 +let x = 1+-1 +let y = -1+1 +let z = -1+-1 + +# Subtraction +let aa = 1 - 1 +let ab = 1 - -1 +let ac = -1 - 1 +let ad = -1 - -1 +let ae = 1-1 +let af = 1--1 +let ag = -1-1 +let ah = -1--1 + +# Multiplication +let ai = 1 * 1 +let aj = 1 * -1 +let ak = -1 * 1 +let al = -1 * -1 +let am = 1*1 +let an = 1*-1 +let ao = -1*1 +let ap = -1*-1 + +# Division +let aq = 1 / 1 +let ar = 1 / -1 +let as = -1 / 1 +let at = -1 / -1 +let au = 1/1 +let av = 1/-1 +let aw = -1/1 +let ax = -1/-1 + +#------------------------------------------------------------------------------ +# Now for the solution to a "real" problem +#------------------------------------------------------------------------------ + +#(define (balanced-brackets string) +# (define (b chars sum) +# (cond ((and (null? chars) (= 0 sum)) +# #t) +# ((null? chars) +# #f) +# ((char=? #\[ (car chars)) +# (b (cdr chars) (+ sum 1))) +# ((= sum 0) +# #f) +# (else +# (b (cdr chars) (- sum 1))))) +# (b (string->list string) 0)) + +let balanced_brackets = (str) { + +} + +#(balanced-brackets "") +# +#(balanced-brackets "[]") +#(balanced-brackets "[][]") +#(balanced-brackets "[[][]]") +# +#(balanced-brackets "][") +#(balanced-brackets "][][") +#(balanced-brackets "[]][[]") + +print( balanced_brackets("") ) +print( balanced_brackets("[]") ) +print( balanced_brackets("[][]") ) +print( balanced_brackets("[[][]]") ) +print( balanced_brackets("][") ) +print( balanced_brackets("][][") ) +print( balanced_brackets("[]][[]") ) diff --git a/flex-bison/grammar_test/src/ast.cpp b/flex-bison/grammar_test/src/ast.cpp new file mode 100644 index 0000000..531d1cd --- /dev/null +++ b/flex-bison/grammar_test/src/ast.cpp @@ -0,0 +1,74 @@ +#include "ast.h" +#include +#include + +AST::AST(ASTNodeType type) +{ + node_type = type; + node_text = NULL; + node_children = new list(); +} + +AST::~AST() +{ + list::iterator it = node_children->begin(); + for(; it != node_children->end(); it++) + { + delete *(it); + } + delete node_children; + delete node_text; +} + +AST::AST(ASTNodeType type, char* text) +{ + node_type = type; + node_text = new string(text); + node_children = new list(); +} + +AST::AST(ASTNodeType type, int child_count, ...) +{ + va_list arg_list; + int i = 0; + node_type = type; + node_text = NULL; + node_children = new list(); + va_start (arg_list, child_count); + for (i = 0; i < child_count ; i++) + { + node_children->push_back( (AST*)va_arg(arg_list, AST*) ); + } + va_end(arg_list); +} + +ASTNodeType AST::type() +{ + return node_type; +} + +void AST::setType(ASTNodeType type) +{ + node_type = type; +} + +list* AST::children() +{ + return node_children; +} + +string AST::text() +{ + ostringstream oss; + if(node_text != NULL) + { + oss << node_text->c_str(); + } + return oss.str(); +} + +void AST::addChild(AST* node) +{ + node_children->push_back(node); +} + diff --git a/flex-bison/grammar_test/src/ast.h b/flex-bison/grammar_test/src/ast.h new file mode 100644 index 0000000..20bc1b0 --- /dev/null +++ b/flex-bison/grammar_test/src/ast.h @@ -0,0 +1,29 @@ +#ifndef AST_H +#define AST_H + +#include +#include +#include + +using namespace std; + +typedef unsigned int ASTNodeType; + +class AST { + protected: + ASTNodeType node_type; + string* node_text; + list* node_children; + public: + AST(ASTNodeType type); + AST(ASTNodeType type, char* text); + AST(ASTNodeType type, int child_count, ...); + ~AST(); + ASTNodeType type(); + void setType(ASTNodeType type); + string text(); + list* children(); + void addChild(AST* node); +}; + +#endif diff --git a/flex-bison/grammar_test/src/grammar.tab.c b/flex-bison/grammar_test/src/grammar.tab.c new file mode 100644 index 0000000..0705632 --- /dev/null +++ b/flex-bison/grammar_test/src/grammar.tab.c @@ -0,0 +1,1673 @@ + +/* A Bison parser, made by GNU Bison 2.4.1. */ + +/* Skeleton implementation for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Bison version. */ +#define YYBISON_VERSION "2.4.1" + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 0 + +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + +/* Using locations. */ +#define YYLSP_NEEDED 0 + + + +/* Copy the first part of user declarations. */ + +/* Line 189 of yacc.c */ +#line 1 "src/grammar.y" + + +#include +#include "ast.h" + +// Text from the lexer +extern char yytext[]; + +// Function Prototypes +int yylex(); +void yyerror(char* s); +void type_to_string(int type); +void print_ast(AST* ast, int depth); + +list Expressions; + + + +/* Line 189 of yacc.c */ +#line 92 "src/grammar.tab.c" + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 0 +#endif + +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE 0 +#endif + + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + CHAR = 258, + NUM = 259, + ID = 260, + ATOM = 261, + APPLY = 262, + FUNC = 263, + BLOCK = 264, + ADD = 265, + LIST = 266, + VECTOR = 267, + ELIST = 268, + EBLOCK = 269 + }; +#endif + + + +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef union YYSTYPE +{ + +/* Line 214 of yacc.c */ +#line 20 "src/grammar.y" + + void* Node; + + + +/* Line 214 of yacc.c */ +#line 148 "src/grammar.tab.c" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +#endif + + +/* Copy the second part of user declarations. */ + + +/* Line 264 of yacc.c */ +#line 160 "src/grammar.tab.c" + +#ifdef short +# undef short +#endif + +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else +typedef unsigned char yytype_uint8; +#endif + +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; +#elif (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +typedef signed char yytype_int8; +#else +typedef short int yytype_int8; +#endif + +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; +#else +typedef unsigned short int yytype_uint16; +#endif + +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; +#endif + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int +# endif +#endif + +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) + +#ifndef YY_ +# if YYENABLE_NLS +# if ENABLE_NLS +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_(msgid) dgettext ("bison-runtime", msgid) +# endif +# endif +# ifndef YY_ +# define YY_(msgid) msgid +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(e) ((void) (e)) +#else +# define YYUSE(e) /* empty */ +#endif + +/* Identity function, used to suppress warnings about constant conditions. */ +#ifndef lint +# define YYID(n) (n) +#else +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static int +YYID (int yyi) +#else +static int +YYID (yyi) + int yyi; +#endif +{ + return yyi; +} +#endif + +#if ! defined yyoverflow || YYERROR_VERBOSE + +/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include /* INFRINGES ON USER NAME SPACE */ +# define alloca _alloca +# else +# define YYSTACK_ALLOC alloca +# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ +# endif +# else +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# endif +# if (defined __cplusplus && ! defined _STDLIB_H \ + && ! ((defined YYMALLOC || defined malloc) \ + && (defined YYFREE || defined free))) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE free +# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void free (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# endif +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ + + +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; +}; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + + YYSTACK_GAP_MAXIMUM) + +/* Copy COUNT objects from FROM to TO. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# else +# define YYCOPY(To, From, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (YYID (0)) +# endif +# endif + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (YYID (0)) + +#endif + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 2 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 10 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 18 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 4 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 9 +/* YYNRULES -- Number of states. */ +#define YYNSTATES 11 + +/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 269 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +static const yytype_uint8 yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 15, 2, 2, 16, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 17, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 +}; + +#if YYDEBUG +/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in + YYRHS. */ +static const yytype_uint8 yyprhs[] = +{ + 0, 0, 3, 4, 7, 11, 13, 15, 17, 19 +}; + +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const yytype_int8 yyrhs[] = +{ + 19, 0, -1, -1, 19, 20, -1, 21, 15, 21, + -1, 21, -1, 5, -1, 4, -1, 3, -1, 6, + -1 +}; + +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ +static const yytype_uint8 yyrline[] = +{ + 0, 55, 55, 57, 61, 62, 66, 67, 68, 69 +}; +#endif + +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "$end", "error", "$undefined", "CHAR", "NUM", "ID", "ATOM", "APPLY", + "FUNC", "BLOCK", "ADD", "LIST", "VECTOR", "ELIST", "EBLOCK", "'+'", + "'.'", "':'", "$accept", "program", "expression", "literal", 0 +}; +#endif + +# ifdef YYPRINT +/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to + token YYLEX-NUM. */ +static const yytype_uint16 yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 43, 46, 58 +}; +# endif + +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = +{ + 0, 18, 19, 19, 20, 20, 21, 21, 21, 21 +}; + +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 0, 2, 3, 1, 1, 1, 1, 1 +}; + +/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state + STATE-NUM when YYTABLE doesn't specify something else to do. Zero + means the default is an error. */ +static const yytype_uint8 yydefact[] = +{ + 2, 0, 1, 8, 7, 6, 9, 3, 5, 0, + 4 +}; + +/* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int8 yydefgoto[] = +{ + -1, 1, 7, 8 +}; + +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +#define YYPACT_NINF -15 +static const yytype_int8 yypact[] = +{ + -15, 0, -15, -15, -15, -15, -15, -15, -14, 4, + -15 +}; + +/* YYPGOTO[NTERM-NUM]. */ +static const yytype_int8 yypgoto[] = +{ + -15, -15, -15, -7 +}; + +/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule which + number is the opposite. If zero, do what YYDEFACT says. + If YYTABLE_NINF, syntax error. */ +#define YYTABLE_NINF -1 +static const yytype_uint8 yytable[] = +{ + 2, 9, 10, 3, 4, 5, 6, 3, 4, 5, + 6 +}; + +static const yytype_uint8 yycheck[] = +{ + 0, 15, 9, 3, 4, 5, 6, 3, 4, 5, + 6 +}; + +/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const yytype_uint8 yystos[] = +{ + 0, 19, 0, 3, 4, 5, 6, 20, 21, 15, + 21 +}; + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab + + +/* Like YYERROR except do call yyerror. This remains here temporarily + to ease the transition to the new meaning of YYERROR, for GCC. + Once GCC version 2 has supplanted version 1, this can go. */ + +#define YYFAIL goto yyerrlab + +#define YYRECOVERING() (!!yyerrstatus) + +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + yytoken = YYTRANSLATE (yychar); \ + YYPOPSTACK (1); \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ +while (YYID (0)) + + +#define YYTERROR 1 +#define YYERRCODE 256 + + +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. + If N is 0, then set CURRENT to the empty location which ends + the previous symbol: RHS[0] (always defined). */ + +#define YYRHSLOC(Rhs, K) ((Rhs)[K]) +#ifndef YYLLOC_DEFAULT +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (YYID (N)) \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ + while (YYID (0)) +#endif + + +/* YY_LOCATION_PRINT -- Print the location on the stream. + This macro was not mandated originally: define only if we know + we won't break user code: when these are the locations we know. */ + +#ifndef YY_LOCATION_PRINT +# if YYLTYPE_IS_TRIVIAL +# define YY_LOCATION_PRINT(File, Loc) \ + fprintf (File, "%d.%d-%d.%d", \ + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) +# else +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +# endif +#endif + + +/* YYLEX -- calling `yylex' with the right arguments. */ + +#ifdef YYLEX_PARAM +# define YYLEX yylex (YYLEX_PARAM) +#else +# define YYLEX yylex () +#endif + +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (YYID (0)) + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (YYID (0)) + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +#else +static void +yy_symbol_value_print (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; +#endif +{ + if (!yyvaluep) + return; +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# else + YYUSE (yyoutput); +# endif + switch (yytype) + { + default: + break; + } +} + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +#else +static void +yy_symbol_print (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; +#endif +{ + if (yytype < YYNTOKENS) + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); + else + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + + yy_symbol_value_print (yyoutput, yytype, yyvaluep); + YYFPRINTF (yyoutput, ")"); +} + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +#else +static void +yy_stack_print (yybottom, yytop) + yytype_int16 *yybottom; + yytype_int16 *yytop; +#endif +{ + YYFPRINTF (stderr, "Stack now"); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } + YYFPRINTF (stderr, "\n"); +} + +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (YYID (0)) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_reduce_print (YYSTYPE *yyvsp, int yyrule) +#else +static void +yy_reduce_print (yyvsp, yyrule) + YYSTYPE *yyvsp; + int yyrule; +#endif +{ + int yynrhs = yyr2[yyrule]; + int yyi; + unsigned long int yylno = yyrline[yyrule]; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + YYFPRINTF (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], + &(yyvsp[(yyi + 1) - (yynrhs)]) + ); + YYFPRINTF (stderr, "\n"); + } +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyvsp, Rule); \ +} while (YYID (0)) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !YYDEBUG */ + + +/* YYINITDEPTH -- initial size of the parser's stacks. */ +#ifndef YYINITDEPTH +# define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH 10000 +#endif + + + +#if YYERROR_VERBOSE + +# ifndef yystrlen +# if defined __GLIBC__ && defined _STRING_H +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static YYSIZE_T +yystrlen (const char *yystr) +#else +static YYSIZE_T +yystrlen (yystr) + const char *yystr; +#endif +{ + YYSIZE_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) + continue; + return yylen; +} +# endif +# endif + +# ifndef yystpcpy +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static char * +yystpcpy (char *yydest, const char *yysrc) +#else +static char * +yystpcpy (yydest, yysrc) + char *yydest; + const char *yysrc; +#endif +{ + char *yyd = yydest; + const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + YYSIZE_T yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (! yyres) + return yystrlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; +} +# endif + +/* Copy into YYRESULT an error message about the unexpected token + YYCHAR while in state YYSTATE. Return the number of bytes copied, + including the terminating null byte. If YYRESULT is null, do not + copy anything; just return the number of bytes that would be + copied. As a special case, return 0 if an ordinary "syntax error" + message will do. Return YYSIZE_MAXIMUM if overflow occurs during + size calculation. */ +static YYSIZE_T +yysyntax_error (char *yyresult, int yystate, int yychar) +{ + int yyn = yypact[yystate]; + + if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) + return 0; + else + { + int yytype = YYTRANSLATE (yychar); + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + int yysize_overflow = 0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + int yyx; + +# if 0 + /* This is so xgettext sees the translatable formats that are + constructed on the fly. */ + YY_("syntax error, unexpected %s"); + YY_("syntax error, unexpected %s, expecting %s"); + YY_("syntax error, unexpected %s, expecting %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); +# endif + char *yyfmt; + char const *yyf; + static char const yyunexpected[] = "syntax error, unexpected %s"; + static char const yyexpecting[] = ", expecting %s"; + static char const yyor[] = " or %s"; + char yyformat[sizeof yyunexpected + + sizeof yyexpecting - 1 + + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) + * (sizeof yyor - 1))]; + char const *yyprefix = yyexpecting; + + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yycount = 1; + + yyarg[0] = yytname[yytype]; + yyfmt = yystpcpy (yyformat, yyunexpected); + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + yyformat[sizeof yyunexpected - 1] = '\0'; + break; + } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + yyfmt = yystpcpy (yyfmt, yyprefix); + yyprefix = yyor; + } + + yyf = YY_(yyformat); + yysize1 = yysize + yystrlen (yyf); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + + if (yysize_overflow) + return YYSIZE_MAXIMUM; + + if (yyresult) + { + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + char *yyp = yyresult; + int yyi = 0; + while ((*yyp = *yyf) != '\0') + { + if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyf += 2; + } + else + { + yyp++; + yyf++; + } + } + } + return yysize; + } +} +#endif /* YYERROR_VERBOSE */ + + +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) +#else +static void +yydestruct (yymsg, yytype, yyvaluep) + const char *yymsg; + int yytype; + YYSTYPE *yyvaluep; +#endif +{ + YYUSE (yyvaluep); + + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + + switch (yytype) + { + + default: + break; + } +} + +/* Prevent warnings from -Wmissing-prototypes. */ +#ifdef YYPARSE_PARAM +#if defined __STDC__ || defined __cplusplus +int yyparse (void *YYPARSE_PARAM); +#else +int yyparse (); +#endif +#else /* ! YYPARSE_PARAM */ +#if defined __STDC__ || defined __cplusplus +int yyparse (void); +#else +int yyparse (); +#endif +#endif /* ! YYPARSE_PARAM */ + + +/* The lookahead symbol. */ +int yychar; + +/* The semantic value of the lookahead symbol. */ +YYSTYPE yylval; + +/* Number of syntax errors so far. */ +int yynerrs; + + + +/*-------------------------. +| yyparse or yypush_parse. | +`-------------------------*/ + +#ifdef YYPARSE_PARAM +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (void *YYPARSE_PARAM) +#else +int +yyparse (YYPARSE_PARAM) + void *YYPARSE_PARAM; +#endif +#else /* ! YYPARSE_PARAM */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (void) +#else +int +yyparse () + +#endif +#endif +{ + + + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + + /* The stacks and their tools: + `yyss': related to states. + `yyvs': related to semantic values. + + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; + + YYSIZE_T yystacksize; + + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken; + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; + + yytoken = 0; + yyss = yyssa; + yyvs = yyvsa; + yystacksize = YYINITDEPTH; + + YYDPRINTF ((stderr, "Starting parse\n")); + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + + /* Initialize stack pointers. + Waste one element of value and location stack + so that they stay on the same level as the state stack. + The wasted elements are never initialized. */ + yyssp = yyss; + yyvsp = yyvs; + + goto yysetstate; + +/*------------------------------------------------------------. +| yynewstate -- Push a new state, which is found in yystate. | +`------------------------------------------------------------*/ + yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. So pushing a state here evens the stacks. */ + yyssp++; + + yysetstate: + *yyssp = yystate; + + if (yyss + yystacksize - 1 <= yyssp) + { + /* Get the current used size of the three stacks, in elements. */ + YYSIZE_T yysize = yyssp - yyss + 1; + +#ifdef yyoverflow + { + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yystacksize); + + yyss = yyss1; + yyvs = yyvs1; + } +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyexhaustedlab; +# else + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + goto yyexhaustedlab; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif +#endif /* no yyoverflow */ + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; + + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; + } + + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + + if (yystate == YYFINAL) + YYACCEPT; + + goto yybackup; + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: + + /* Do appropriate processing given the current state. Read a + lookahead token if we need one and don't already have one. */ + + /* First try to decide what to do without reference to lookahead token. */ + yyn = yypact[yystate]; + if (yyn == YYPACT_NINF) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = YYLEX; + } + + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + goto yydefault; + yyn = yytable[yyn]; + if (yyn <= 0) + { + if (yyn == 0 || yyn == YYTABLE_NINF) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + /* Shift the lookahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the shifted token. */ + yychar = YYEMPTY; + + yystate = yyn; + *++yyvsp = yylval; + + goto yynewstate; + + +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + +/*-----------------------------. +| yyreduce -- Do a reduction. | +`-----------------------------*/ +yyreduce: + /* yyn is the number of a rule to reduce with. */ + yylen = yyr2[yyn]; + + /* If YYLEN is nonzero, implement the default value of the action: + `$$ = $1'. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; + + + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 3: + +/* Line 1455 of yacc.c */ +#line 57 "src/grammar.y" + { Expressions.push_back((AST*)(yyvsp[(2) - (2)].Node)); ;} + break; + + case 4: + +/* Line 1455 of yacc.c */ +#line 61 "src/grammar.y" + { (yyval.Node) = new AST(ADD, 2, (yyvsp[(1) - (3)].Node), (yyvsp[(3) - (3)].Node)); ;} + break; + + case 5: + +/* Line 1455 of yacc.c */ +#line 62 "src/grammar.y" + { (yyval.Node) = (yyvsp[(1) - (1)].Node); ;} + break; + + case 6: + +/* Line 1455 of yacc.c */ +#line 66 "src/grammar.y" + { (yyval.Node) = (yyvsp[(1) - (1)].Node); ;} + break; + + case 7: + +/* Line 1455 of yacc.c */ +#line 67 "src/grammar.y" + { (yyval.Node) = (yyvsp[(1) - (1)].Node); ;} + break; + + case 8: + +/* Line 1455 of yacc.c */ +#line 68 "src/grammar.y" + { (yyval.Node) = (yyvsp[(1) - (1)].Node); ;} + break; + + case 9: + +/* Line 1455 of yacc.c */ +#line 69 "src/grammar.y" + { (yyval.Node) = (yyvsp[(1) - (1)].Node); ;} + break; + + + +/* Line 1455 of yacc.c */ +#line 1396 "src/grammar.tab.c" + default: break; + } + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + + *++yyvsp = yyval; + + /* Now `shift' the result of the reduction. Determine what state + that goes to, based on the state we popped back to and the rule + number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTOKENS]; + + goto yynewstate; + + +/*------------------------------------. +| yyerrlab -- here on detecting error | +`------------------------------------*/ +yyerrlab: + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; +#if ! YYERROR_VERBOSE + yyerror (YY_("syntax error")); +#else + { + YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); + if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) + { + YYSIZE_T yyalloc = 2 * yysize; + if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) + yyalloc = YYSTACK_ALLOC_MAXIMUM; + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yyalloc); + if (yymsg) + yymsg_alloc = yyalloc; + else + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + } + } + + if (0 < yysize && yysize <= yymsg_alloc) + { + (void) yysyntax_error (yymsg, yystate, yychar); + yyerror (yymsg); + } + else + { + yyerror (YY_("syntax error")); + if (yysize != 0) + goto yyexhaustedlab; + } + } +#endif + } + + + + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + if (yychar <= YYEOF) + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } + else + { + yydestruct ("Error: discarding", + yytoken, &yylval); + yychar = YYEMPTY; + } + } + + /* Else will try to reuse lookahead token after shifting the error + token. */ + goto yyerrlab1; + + +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (/*CONSTCOND*/ 0) + goto yyerrorlab; + + /* Do not reclaim the symbols of the rule which action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + yystate = *yyssp; + goto yyerrlab1; + + +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ +yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ + + for (;;) + { + yyn = yypact[yystate]; + if (yyn != YYPACT_NINF) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; + + + yydestruct ("Error: popping", + yystos[yystate], yyvsp); + YYPOPSTACK (1); + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); + } + + *++yyvsp = yylval; + + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + + yystate = yyn; + goto yynewstate; + + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + +#if !defined(yyoverflow) || YYERROR_VERBOSE +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (YY_("memory exhausted")); + yyresult = 2; + /* Fall through. */ +#endif + +yyreturn: + if (yychar != YYEMPTY) + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval); + /* Do not reclaim the symbols of the rule which action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp); + YYPOPSTACK (1); + } +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif +#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); +#endif + /* Make sure YYID is used. */ + return YYID (yyresult); +} + + + +/* Line 1675 of yacc.c */ +#line 72 "src/grammar.y" + + +void print_ast(AST* ast, int depth) +{ + list* children; + list::iterator it; + + // Setup our locals + children = ast->children(); + it = children->begin(); + + printf("("); + type_to_string(ast->type()); + depth++; + for(; it != children->end(); it++) + { + printf(" "); + print_ast( *it, depth ); + } + printf(")\n"); +} + +void type_to_string(int type) +{ + #define CASE(val) \ + case val: \ + printf("%s", #val); \ + break; + switch( type ) + { + CASE(CHAR); + CASE(NUM); + CASE(ID); + CASE(ATOM); + CASE(APPLY); + CASE(FUNC); + CASE(BLOCK); + CASE(ADD); + CASE(LIST); + CASE(VECTOR); + CASE(ELIST); + CASE(EBLOCK); + default: + printf("%d", type); + break; + } +} + +void yyerror(char* s) +{ + fflush(stdout); + printf("\n%s\n%s\n", "^", s); +} + +int main(int argc, char** argv) +{ + yyparse(); + list::iterator it; + it = Expressions.begin(); + for(; it != Expressions.end(); it++) + { + print_ast(*it,0); + } + return 0; +} + diff --git a/flex-bison/grammar_test/src/grammar.tab.h b/flex-bison/grammar_test/src/grammar.tab.h new file mode 100644 index 0000000..b5835ec --- /dev/null +++ b/flex-bison/grammar_test/src/grammar.tab.h @@ -0,0 +1,80 @@ + +/* A Bison parser, made by GNU Bison 2.4.1. */ + +/* Skeleton interface for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + CHAR = 258, + NUM = 259, + ID = 260, + ATOM = 261, + APPLY = 262, + FUNC = 263, + BLOCK = 264, + ADD = 265, + LIST = 266, + VECTOR = 267, + ELIST = 268, + EBLOCK = 269 + }; +#endif + + + +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef union YYSTYPE +{ + +/* Line 1676 of yacc.c */ +#line 20 "src/grammar.y" + + void* Node; + + + +/* Line 1676 of yacc.c */ +#line 72 "src/grammar.tab.h" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +#endif + +extern YYSTYPE yylval; + + diff --git a/flex-bison/grammar_test/src/grammar.y b/flex-bison/grammar_test/src/grammar.y new file mode 100644 index 0000000..048a7a6 --- /dev/null +++ b/flex-bison/grammar_test/src/grammar.y @@ -0,0 +1,136 @@ +%{ + +#include +#include "ast.h" + +// Text from the lexer +extern char yytext[]; + +// Function Prototypes +int yylex(); +void yyerror(char* s); +void type_to_string(int type); +void print_ast(AST* ast, int depth); + +list Expressions; + +%} + +%union +{ + void* Node; +} + +/****************************************************************************** +* Tokens +******************************************************************************/ +/* Literal Types */ +%token CHAR +%token NUM +%token ID +%token ATOM + +/* Virtual Tokens */ +%token APPLY FUNC BLOCK ADD LIST VECTOR ELIST EBLOCK + +/****************************************************************************** +* Rule Return Types +******************************************************************************/ +%type expression +%type literal + +/****************************************************************************** +* Operator Precedence +******************************************************************************/ +%left '+' +%left '.' ':' + +/****************************************************************************** +* Starting Rule +******************************************************************************/ +%start program + +%% + +program + : + | program expression { Expressions.push_back((AST*)$2); } + ; + +expression + : literal '+' literal { $$ = new AST(ADD, 2, $1, $3); } + | literal { $$ = $1; } + ; + +literal + : ID { $$ = $1; } + | NUM { $$ = $1; } + | CHAR { $$ = $1; } + | ATOM { $$ = $1; } + ; + +%% + +void print_ast(AST* ast, int depth) +{ + list* children; + list::iterator it; + + // Setup our locals + children = ast->children(); + it = children->begin(); + + printf("("); + type_to_string(ast->type()); + depth++; + for(; it != children->end(); it++) + { + printf(" "); + print_ast( *it, depth ); + } + printf(")\n"); +} + +void type_to_string(int type) +{ + #define CASE(val) \ + case val: \ + printf("%s", #val); \ + break; + switch( type ) + { + CASE(CHAR); + CASE(NUM); + CASE(ID); + CASE(ATOM); + CASE(APPLY); + CASE(FUNC); + CASE(BLOCK); + CASE(ADD); + CASE(LIST); + CASE(VECTOR); + CASE(ELIST); + CASE(EBLOCK); + default: + printf("%d", type); + break; + } +} + +void yyerror(char* s) +{ + fflush(stdout); + printf("\n%s\n%s\n", "^", s); +} + +int main(int argc, char** argv) +{ + yyparse(); + list::iterator it; + it = Expressions.begin(); + for(; it != Expressions.end(); it++) + { + print_ast(*it,0); + } + return 0; +} diff --git a/flex-bison/grammar_test/src/lex.yy.c b/flex-bison/grammar_test/src/lex.yy.c new file mode 100644 index 0000000..8607dc8 --- /dev/null +++ b/flex-bison/grammar_test/src/lex.yy.c @@ -0,0 +1,1795 @@ +#line 2 "src/lex.yy.c" + +#line 4 "src/lex.yy.c" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 35 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +#include +#include +#include +#include + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have . Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! C99 */ + +#endif /* ! FLEXINT_H */ + +#ifdef __cplusplus + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) + +#define YY_USE_CONST + +#endif /* defined (__STDC__) */ +#endif /* ! __cplusplus */ + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN (yy_start) = 1 + 2 * + +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START (((yy_start) - 1) / 2) +#define YYSTATE YY_START + +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE yyrestart(yyin ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else +#define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ +#endif + +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +extern int yyleng; + +extern FILE *yyin, *yyout; + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + + #define YY_LESS_LINENO(n) + +/* Return all but the first "n" matched characters back to the input stream. */ +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = (yy_hold_char); \ + YY_RESTORE_YY_MORE_OFFSET \ + (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, (yytext_ptr) ) + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* Stack of input buffers. */ +static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ +static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ +static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + * + * Returns the top of the stack, or NULL. + */ +#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ + ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ + : NULL) + +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] + +/* yy_hold_char holds the character lost when yytext is formed. */ +static char yy_hold_char; +static int yy_n_chars; /* number of characters read into yy_ch_buf */ +int yyleng; + +/* Points to current character in buffer. */ +static char *yy_c_buf_p = (char *) 0; +static int yy_init = 0; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ + +/* Flag which is used to allow yywrap()'s to do buffer switches + * instead of setting up a fresh yyin. A bit of a hack ... + */ +static int yy_did_buffer_switch_on_eof; + +void yyrestart (FILE *input_file ); +void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); +void yy_delete_buffer (YY_BUFFER_STATE b ); +void yy_flush_buffer (YY_BUFFER_STATE b ); +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); +void yypop_buffer_state (void ); + +static void yyensure_buffer_stack (void ); +static void yy_load_buffer_state (void ); +static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); + +#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) + +YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); +YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); +YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); + +void *yyalloc (yy_size_t ); +void *yyrealloc (void *,yy_size_t ); +void yyfree (void * ); + +#define yy_new_buffer yy_create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer(yyin,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! YY_CURRENT_BUFFER ){\ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer(yyin,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + +/* Begin user sect3 */ + +#define yywrap(n) 1 +#define YY_SKIP_YYWRAP + +typedef unsigned char YY_CHAR; + +FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; + +typedef int yy_state_type; + +extern int yylineno; + +int yylineno = 1; + +extern char *yytext; +#define yytext_ptr yytext + +static yy_state_type yy_get_previous_state (void ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); +static int yy_get_next_buffer (void ); +static void yy_fatal_error (yyconst char msg[] ); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + (yytext_ptr) = yy_bp; \ + yyleng = (size_t) (yy_cp - yy_bp); \ + (yy_hold_char) = *yy_cp; \ + *yy_cp = '\0'; \ + (yy_c_buf_p) = yy_cp; + +#define YY_NUM_RULES 12 +#define YY_END_OF_BUFFER 13 +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int16_t yy_accept[28] = + { 0, + 0, 0, 13, 11, 10, 10, 11, 11, 4, 11, + 1, 7, 2, 3, 8, 0, 9, 0, 7, 0, + 6, 8, 5, 7, 6, 7, 0 + } ; + +static yyconst flex_int32_t yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 1, 1, 4, 1, 1, 1, 5, 6, + 6, 1, 1, 1, 7, 8, 1, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 10, 11, 1, + 1, 1, 1, 1, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 6, 1, 6, 1, 1, 1, 12, 12, 12, 12, + + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 6, 1, 6, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static yyconst flex_int32_t yy_meta[13] = + { 0, + 1, 1, 2, 1, 1, 1, 1, 1, 3, 1, + 1, 3 + } ; + +static yyconst flex_int16_t yy_base[32] = + { 0, + 0, 0, 30, 31, 31, 31, 26, 0, 31, 19, + 31, 5, 15, 31, 0, 23, 31, 20, 0, 15, + 0, 0, 31, 14, 0, 13, 31, 14, 17, 18, + 16 + } ; + +static yyconst flex_int16_t yy_def[32] = + { 0, + 27, 1, 27, 27, 27, 27, 28, 29, 27, 27, + 27, 27, 27, 27, 30, 28, 27, 27, 12, 27, + 31, 30, 27, 27, 31, 27, 0, 27, 27, 27, + 27 + } ; + +static yyconst flex_int16_t yy_nxt[44] = + { 0, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 20, 19, 16, 16, 16, 18, 25, 18, + 22, 26, 26, 24, 23, 17, 21, 19, 17, 27, + 3, 27, 27, 27, 27, 27, 27, 27, 27, 27, + 27, 27, 27 + } ; + +static yyconst flex_int16_t yy_chk[44] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 12, 12, 28, 28, 28, 29, 31, 29, + 30, 26, 24, 20, 18, 16, 13, 10, 7, 3, + 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, + 27, 27, 27 + } ; + +static yy_state_type yy_last_accepting_state; +static char *yy_last_accepting_cpos; + +extern int yy_flex_debug; +int yy_flex_debug = 0; + +/* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +#define REJECT reject_used_but_not_detected +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET +char *yytext; +#line 1 "src/lexer.l" +#line 8 "src/lexer.l" + +#include +#include "grammar.tab.h" +#include "ast.h" +#if DEBUG_LEXER + #define RET_ENUM(retval) printf("%s",#retval); return retval; + #define RET_CHAR() printf("%c",yytext[0]); return yytext[0]; + #define RET_AST(retval) \ + yylval.Node = (void*)new AST(retval, yytext); \ + printf("%s",#retval); return retval; +#else + #define RET_ENUM(retval) return retval; + #define RET_CHAR() return yytext[0]; + #define RET_AST(retval) \ + yylval.Node = (void*)new AST(retval, yytext); \ + return retval; +#endif +#define YY_NO_INPUT 1 +#line 498 "src/lex.yy.c" + +#define INITIAL 0 + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +static int yy_init_globals (void ); + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int yylex_destroy (void ); + +int yyget_debug (void ); + +void yyset_debug (int debug_flag ); + +YY_EXTRA_TYPE yyget_extra (void ); + +void yyset_extra (YY_EXTRA_TYPE user_defined ); + +FILE *yyget_in (void ); + +void yyset_in (FILE * in_str ); + +FILE *yyget_out (void ); + +void yyset_out (FILE * out_str ); + +int yyget_leng (void ); + +char *yyget_text (void ); + +int yyget_lineno (void ); + +void yyset_lineno (int line_number ); + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int yywrap (void ); +#else +extern int yywrap (void ); +#endif +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy (char *,yyconst char *,int ); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * ); +#endif + +#ifndef YY_NO_INPUT + +#ifdef __cplusplus +static int yyinput (void ); +#else +static int input (void ); +#endif + +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else +#define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ +#endif + +/* Copy whatever the last rule matched to the standard output. */ +#ifndef ECHO +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + size_t n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(yyin); \ + } \ + }\ +\ + +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) +#endif + +/* end tables serialization structures and prototypes */ + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 + +extern int yylex (void); + +#define YY_DECL int yylex (void) +#endif /* !YY_DECL */ + +/* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK break; +#endif + +#define YY_RULE_SETUP \ + YY_USER_ACTION + +/** The main scanner function which does all the work. + */ +YY_DECL +{ + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + +#line 31 "src/lexer.l" + + +#line 686 "src/lex.yy.c" + + if ( !(yy_init) ) + { + (yy_init) = 1; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! (yy_start) ) + (yy_start) = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( ! YY_CURRENT_BUFFER ) { + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer(yyin,YY_BUF_SIZE ); + } + + yy_load_buffer_state( ); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = (yy_c_buf_p); + + /* Support of yytext. */ + *yy_cp = (yy_hold_char); + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = (yy_start); +yy_match: + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 28 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 31 ); + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + yy_act = yy_accept[yy_current_state]; + } + + YY_DO_BEFORE_ACTION; + +do_action: /* This label is used only to access EOF actions. */ + + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = (yy_hold_char); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + goto yy_find_action; + +case 1: +YY_RULE_SETUP +#line 33 "src/lexer.l" +{ RET_CHAR(); } + YY_BREAK +case 2: +YY_RULE_SETUP +#line 34 "src/lexer.l" +{ RET_CHAR(); } + YY_BREAK +case 3: +YY_RULE_SETUP +#line 35 "src/lexer.l" +{ RET_CHAR(); } + YY_BREAK +case 4: +YY_RULE_SETUP +#line 36 "src/lexer.l" +{ RET_CHAR(); } + YY_BREAK +case 5: +YY_RULE_SETUP +#line 38 "src/lexer.l" +{ RET_AST( CHAR ); } + YY_BREAK +case 6: +YY_RULE_SETUP +#line 39 "src/lexer.l" +{ RET_AST( ATOM ); } + YY_BREAK +case 7: +YY_RULE_SETUP +#line 40 "src/lexer.l" +{ RET_AST( NUM ); } + YY_BREAK +case 8: +YY_RULE_SETUP +#line 41 "src/lexer.l" +{ RET_AST( ID ); } + YY_BREAK +case 9: +/* rule 9 can match eol */ +YY_RULE_SETUP +#line 43 "src/lexer.l" +; + YY_BREAK +case 10: +/* rule 10 can match eol */ +YY_RULE_SETUP +#line 44 "src/lexer.l" +; //{ printf("%s", yytext); } + YY_BREAK +case 11: +YY_RULE_SETUP +#line 45 "src/lexer.l" +; + YY_BREAK +case 12: +YY_RULE_SETUP +#line 47 "src/lexer.l" +ECHO; + YY_BREAK +#line 831 "src/lex.yy.c" +case YY_STATE_EOF(INITIAL): + yyterminate(); + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = (yy_hold_char); + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++(yy_c_buf_p); + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = (yy_c_buf_p); + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_END_OF_FILE: + { + (yy_did_buffer_switch_on_eof) = 0; + + if ( yywrap( ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = + (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + (yy_c_buf_p) = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ +} /* end of yylex */ + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ +static int yy_get_next_buffer (void) +{ + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = (yytext_ptr); + register int number_to_move, i; + int ret_val; + + if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; + + else + { + int num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + + int yy_c_buf_p_offset = + (int) ((yy_c_buf_p) - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + (yy_n_chars), (size_t) num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + if ( (yy_n_chars) == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart(yyin ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + } + + (yy_n_chars) += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; + + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +} + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + + static yy_state_type yy_get_previous_state (void) +{ + register yy_state_type yy_current_state; + register char *yy_cp; + + yy_current_state = (yy_start); + + for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) + { + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 28 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + } + + return yy_current_state; +} + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) +{ + register int yy_is_jam; + register char *yy_cp = (yy_c_buf_p); + + register YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 28 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 27); + + return yy_is_jam ? 0 : yy_current_state; +} + +#ifndef YY_NO_INPUT +#ifdef __cplusplus + static int yyinput (void) +#else + static int input (void) +#endif + +{ + int c; + + *(yy_c_buf_p) = (yy_hold_char); + + if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + /* This was really a NUL. */ + *(yy_c_buf_p) = '\0'; + + else + { /* need more input */ + int offset = (yy_c_buf_p) - (yytext_ptr); + ++(yy_c_buf_p); + + switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + yyrestart(yyin ); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( yywrap( ) ) + return EOF; + + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(); +#else + return input(); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = (yytext_ptr) + offset; + break; + } + } + } + + c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ + *(yy_c_buf_p) = '\0'; /* preserve yytext */ + (yy_hold_char) = *++(yy_c_buf_p); + + return c; +} +#endif /* ifndef YY_NO_INPUT */ + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * + * @note This function does not reset the start condition to @c INITIAL . + */ + void yyrestart (FILE * input_file ) +{ + + if ( ! YY_CURRENT_BUFFER ){ + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer(yyin,YY_BUF_SIZE ); + } + + yy_init_buffer(YY_CURRENT_BUFFER,input_file ); + yy_load_buffer_state( ); +} + +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * + */ + void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) +{ + + /* TODO. We should be able to replace this entire function body + * with + * yypop_buffer_state(); + * yypush_buffer_state(new_buffer); + */ + yyensure_buffer_stack (); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + yy_load_buffer_state( ); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + (yy_did_buffer_switch_on_eof) = 1; +} + +static void yy_load_buffer_state (void) +{ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + (yy_hold_char) = *(yy_c_buf_p); +} + +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * + * @return the allocated buffer state. + */ + YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + yy_init_buffer(b,file ); + + return b; +} + +/** Destroy the buffer. + * @param b a buffer created with yy_create_buffer() + * + */ + void yy_delete_buffer (YY_BUFFER_STATE b ) +{ + + if ( ! b ) + return; + + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + yyfree((void *) b->yy_ch_buf ); + + yyfree((void *) b ); +} + +#ifndef __cplusplus +extern int isatty (int ); +#endif /* __cplusplus */ + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a yyrestart() or at EOF. + */ + static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) + +{ + int oerrno = errno; + + yy_flush_buffer(b ); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + + /* If b is the current buffer, then yy_init_buffer was _probably_ + * called from yyrestart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; + + errno = oerrno; +} + +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * + */ + void yy_flush_buffer (YY_BUFFER_STATE b ) +{ + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == YY_CURRENT_BUFFER ) + yy_load_buffer_state( ); +} + +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * + */ +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) +{ + if (new_buffer == NULL) + return; + + yyensure_buffer_stack(); + + /* This block is copied from yy_switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + (yy_buffer_stack_top)++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from yy_switch_to_buffer. */ + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * + */ +void yypop_buffer_state (void) +{ + if (!YY_CURRENT_BUFFER) + return; + + yy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + if ((yy_buffer_stack_top) > 0) + --(yy_buffer_stack_top); + + if (YY_CURRENT_BUFFER) { + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; + } +} + +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void yyensure_buffer_stack (void) +{ + int num_to_alloc; + + if (!(yy_buffer_stack)) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; + (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + (yy_buffer_stack_max) = num_to_alloc; + (yy_buffer_stack_top) = 0; + return; + } + + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = (yy_buffer_stack_max) + grow_size; + (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc + ((yy_buffer_stack), + num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); + (yy_buffer_stack_max) = num_to_alloc; + } +} + +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) +{ + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + yy_switch_to_buffer(b ); + + return b; +} + +/** Setup the input buffer state to scan a string. The next call to yylex() will + * scan from a @e copy of @a str. + * @param yystr a NUL-terminated string to scan + * + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * yy_scan_bytes() instead. + */ +YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) +{ + + return yy_scan_bytes(yystr,strlen(yystr) ); +} + +/** Setup the input buffer state to scan the given bytes. The next call to yylex() will + * scan from a @e copy of @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) +{ + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = _yybytes_len + 2; + buf = (char *) yyalloc(n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; + + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + + b = yy_scan_buffer(buf,n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; +} + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +static void yy_fatal_error (yyconst char* msg ) +{ + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); +} + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + yytext[yyleng] = (yy_hold_char); \ + (yy_c_buf_p) = yytext + yyless_macro_arg; \ + (yy_hold_char) = *(yy_c_buf_p); \ + *(yy_c_buf_p) = '\0'; \ + yyleng = yyless_macro_arg; \ + } \ + while ( 0 ) + +/* Accessor methods (get/set functions) to struct members. */ + +/** Get the current line number. + * + */ +int yyget_lineno (void) +{ + + return yylineno; +} + +/** Get the input stream. + * + */ +FILE *yyget_in (void) +{ + return yyin; +} + +/** Get the output stream. + * + */ +FILE *yyget_out (void) +{ + return yyout; +} + +/** Get the length of the current token. + * + */ +int yyget_leng (void) +{ + return yyleng; +} + +/** Get the current token. + * + */ + +char *yyget_text (void) +{ + return yytext; +} + +/** Set the current line number. + * @param line_number + * + */ +void yyset_lineno (int line_number ) +{ + + yylineno = line_number; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param in_str A readable stream. + * + * @see yy_switch_to_buffer + */ +void yyset_in (FILE * in_str ) +{ + yyin = in_str ; +} + +void yyset_out (FILE * out_str ) +{ + yyout = out_str ; +} + +int yyget_debug (void) +{ + return yy_flex_debug; +} + +void yyset_debug (int bdebug ) +{ + yy_flex_debug = bdebug ; +} + +static int yy_init_globals (void) +{ + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from yylex_destroy(), so don't allocate here. + */ + + (yy_buffer_stack) = 0; + (yy_buffer_stack_top) = 0; + (yy_buffer_stack_max) = 0; + (yy_c_buf_p) = (char *) 0; + (yy_init) = 0; + (yy_start) = 0; + +/* Defined in main.c */ +#ifdef YY_STDINIT + yyin = stdin; + yyout = stdout; +#else + yyin = (FILE *) 0; + yyout = (FILE *) 0; +#endif + + /* For future reference: Set errno on error, since we are called by + * yylex_init() + */ + return 0; +} + +/* yylex_destroy is for both reentrant and non-reentrant scanners. */ +int yylex_destroy (void) +{ + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + yy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + yypop_buffer_state(); + } + + /* Destroy the stack itself. */ + yyfree((yy_buffer_stack) ); + (yy_buffer_stack) = NULL; + + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * yylex() is called, initialization will occur. */ + yy_init_globals( ); + + return 0; +} + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) +{ + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +} +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * s ) +{ + register int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; +} +#endif + +void *yyalloc (yy_size_t size ) +{ + return (void *) malloc( size ); +} + +void *yyrealloc (void * ptr, yy_size_t size ) +{ + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); +} + +void yyfree (void * ptr ) +{ + free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ +} + +#define YYTABLES_NAME "yytables" + +#line 47 "src/lexer.l" + + + + diff --git a/flex-bison/grammar_test/src/lexer.l b/flex-bison/grammar_test/src/lexer.l new file mode 100644 index 0000000..05cd85d --- /dev/null +++ b/flex-bison/grammar_test/src/lexer.l @@ -0,0 +1,48 @@ +NUM [0-9] +AL [a-zA-Z] +HEX [a-fA-F0-9] +ALNUM [a-zA-Z0-9] +S [ \n\t] + +%{ + +#include +#include "grammar.tab.h" +#include "ast.h" +#if DEBUG_LEXER + #define RET_ENUM(retval) printf("%s",#retval); return retval; + #define RET_CHAR() printf("%c",yytext[0]); return yytext[0]; + #define RET_AST(retval) \ + yylval.Node = (void*)new AST(retval, yytext); \ + printf("%s",#retval); return retval; +#else + #define RET_ENUM(retval) return retval; + #define RET_CHAR() return yytext[0]; + #define RET_AST(retval) \ + yylval.Node = (void*)new AST(retval, yytext); \ + return retval; +#endif +%} + +%option noyywrap +%option nounput +%option noinput + +%% + +\. { RET_CHAR(); } +: { RET_CHAR(); } +; { RET_CHAR(); } +[\[\]\{\}\(\)] { RET_CHAR(); } + +'.' { RET_AST( CHAR ); } +:{AL}{ALNUM}* { RET_AST( ATOM ); } +-?{NUM}+(\.{NUM}{NUM}*)? { RET_AST( NUM ); } +{AL}{ALNUM}* { RET_AST( ID ); } + +#.*\n ; +{S} ; //{ printf("%s", yytext); } +. ; + +%% + diff --git a/flex-bison/mantella/config.rake b/flex-bison/mantella/config.rake new file mode 100644 index 0000000..e45bbde --- /dev/null +++ b/flex-bison/mantella/config.rake @@ -0,0 +1,47 @@ +PROJECT_ROOT = File.expand_path(File.dirname(__FILE__)) + +# Application +APP_NAME = 'ducky' +APP_EXT = '.exe' +APP_OUT = "#{APP_NAME}#{APP_EXT}" + +# GNU Flex Settings +FLEX_BIN = 'flex' +FLEX_OPTS = '' +FLEX_IN = 'src/lexer/lexer.l' +FLEX_OUT = 'src/lexer/lex.yy.c' + +# GNU Bison Settings +BISON_BIN = 'bison' +BISON_OPTS = '-d' +BISON_IN = 'src/grammar/grammar.y' +BISON_OUT = 'src/grammar/grammar.tab.c' + +# Compiler Settings +COMPILER_BIN = 'g++' +COMPILER_OPTS = '-c -Wall -Werror' + +# Linker Settings +LINKER_BIN = 'g++' +LINKER_OPTS = '' + +# Source Code Settings +SRC_FILES = (FileList['src/**/*.c*'] + [ FLEX_OUT, BISON_OUT ]).uniq +INCLUDE_DIRS = FileList['src/**/'] +DEFINES = [ + #'DEBUG_LEXER', + #'DETECT_MEM_LEAKS', + 'PURE_PARSER' +] + +# Generated Lists +OBJ_FILES = SRC_FILES.collect{|src| "build/#{File.basename(src).ext('o')}" } +DEFINE_LIST = DEFINES.collect{|define| "-D#{define}" } +INCLUDE_LIST = INCLUDE_DIRS.collect{|x| "-I#{x} "} + +# Clean Task +CLEAN.include( 'build/*.o' ) +CLEAN.include( FLEX_OUT ) +CLEAN.include( BISON_OUT ) +CLEAN.include( APP_OUT ) + diff --git a/flex-bison/mantella/docs/example.ll b/flex-bison/mantella/docs/example.ll new file mode 100644 index 0000000..1a160bb --- /dev/null +++ b/flex-bison/mantella/docs/example.ll @@ -0,0 +1,7 @@ +; define foo as an int and initialize to 1 +; define bar as a constant int and initialize to 1 +%0 = type i32 1 +%1 = add float 1.0, i32 1 +%2 = add float 1.0, float 1.0 +%result = add i32 1, i32 2 + diff --git a/flex-bison/mantella/docs/fib.c b/flex-bison/mantella/docs/fib.c new file mode 100644 index 0000000..46fcca9 --- /dev/null +++ b/flex-bison/mantella/docs/fib.c @@ -0,0 +1,28 @@ +#include +int recursive_fib(int n) +{ + int ret = n; + if(ret >= 2) + ret = recursive_fib(n-1) + recursive_fib(n-2); + return ret; +} + +int iterative_fib(int n) +{ + int first = 0; + int second = 1; + int tmp = 0; + while(n--) + { + tmp = first + second; + first = second; + second = tmp; + } + return first; +} + +int main(int argc, char** argv) +{ + printf("%d\n", recursive_fib(10)); + printf("%d\n", iterative_fib(10)); +} diff --git a/flex-bison/mantella/docs/fib.dc b/flex-bison/mantella/docs/fib.dc new file mode 100644 index 0000000..ef42c09 --- /dev/null +++ b/flex-bison/mantella/docs/fib.dc @@ -0,0 +1,28 @@ +#import io + +#func recursive_fib(n) + #var ret = n +# if n >=2 +# ret = recursive_fib(n-1) + recursive_fib(n-2) +# end +# return ret +#end + +#func iterative_fib(n) + #var i = n + #var first = 0 + #var second = 1 + #var tmp = 0 +# while i > 0 + # tmp = first + second + # first = second + # second = tmp + # i = i - 1 +# end +# return first +#end + +#func main(args) + #puts recursive_fib(10) + #puts iterative_fib(10) +#end diff --git a/flex-bison/mantella/foo.lang b/flex-bison/mantella/foo.lang new file mode 100644 index 0000000..4251e71 --- /dev/null +++ b/flex-bison/mantella/foo.lang @@ -0,0 +1,57 @@ +foo = 1 +bar = 1 +1 + 1 +1.1 + 1 +1.0 + 1.1 +foo + bar +1 + 2 - 3 / 4 * 5 % 6 +"foo" +2 * 2 + 1 +2 * (2 + 1) + +#1 ** 2 +#2 ** (2 + 1) + +if 1 - 1 + 1+1 +end + +if foo + "foo" +else + "bar" +end + +func add(a,b) + a + b +end + +add(41,1) +print("hello World!") + +1 == 1 +#1 != 1 +1 < 1 +1 > 1 +1 <= 1 +1 >= 1 + +1 && 1 +1 and 1 + +1 || 1 +1 or 1 + +!1 +not 1 + +func fib(n) + if n < 2 + n + else + fib( n - 1 ) + fib( n - 2 ) + end +end + +print(fib(10)) + diff --git a/flex-bison/mantella/rakefile.rb b/flex-bison/mantella/rakefile.rb new file mode 100644 index 0000000..7efb24c --- /dev/null +++ b/flex-bison/mantella/rakefile.rb @@ -0,0 +1,34 @@ +require 'rake' +require 'rake/clean' + +# Load the dependencies +load 'config.rake' + +task :default => [:release] +task :release => [:generated, APP_OUT] + +# Generate the lexer and parser +task :generated => [FLEX_OUT, BISON_OUT] +file FLEX_OUT => [FLEX_IN] do + sh "#{FLEX_BIN} #{FLEX_OPTS} -o#{FLEX_OUT} #{FLEX_IN}" +end +file BISON_OUT => [BISON_IN] do + sh "#{BISON_BIN} #{BISON_OPTS} -o#{BISON_OUT} #{BISON_IN}" +end + +# Find and compile all source files +def FindSourceByObj(obj) + return SRC_FILES.find { |s| + (File.basename(s, '.c') == File.basename(obj, '.o')) || + (File.basename(s, '.cpp') == File.basename(obj, '.o')) + } +end +rule '.o' => lambda{|obj| FindSourceByObj(obj) } do |t| + sh "#{COMPILER_BIN} #{COMPILER_OPTS} #{INCLUDE_LIST} #{DEFINE_LIST} -o #{t.name} #{t.source}" +end + +# Link the object files together +task APP_OUT => OBJ_FILES do + puts "Linking #{APP_OUT}..." + sh "#{LINKER_BIN} #{LINKER_OPTS} -o #{APP_NAME} #{OBJ_FILES.collect{|x| x + ' '}}" +end diff --git a/flex-bison/mantella/runtime/rakefile.rb b/flex-bison/mantella/runtime/rakefile.rb new file mode 100644 index 0000000..e69de29 diff --git a/flex-bison/mantella/runtime/src/runtime.c b/flex-bison/mantella/runtime/src/runtime.c new file mode 100644 index 0000000..5e55343 --- /dev/null +++ b/flex-bison/mantella/runtime/src/runtime.c @@ -0,0 +1,22 @@ +#include "runtime.h" + +DuckyType T_INT = { "integer" }; +DuckyType T_FLOAT = { "float" }; +DuckyType T_STRING = { "string" }; +DuckyType T_ARRAY = { "array" }; +DuckyType T_MAP = { "map" }; + +DuckyVar Ducky_DeclareVar(DuckyType* type, U32 size) +{ + DuckyVar temp = (DuckyVar)malloc( TYPE_PTR_SIZE + size ); + TYPE(temp) = type; + return temp; +} + +int main() +{ + DuckyVar foo = Ducky_DeclareVar(&T_INT, sizeof(int)); + VALUE(int,foo) = 5; + return 0; +} + diff --git a/flex-bison/mantella/runtime/src/runtime.h b/flex-bison/mantella/runtime/src/runtime.h new file mode 100644 index 0000000..28f5830 --- /dev/null +++ b/flex-bison/mantella/runtime/src/runtime.h @@ -0,0 +1,20 @@ +#ifndef RUNTIME_H +#define RUNTIME_H + +typedef unsigned char Byte; +typedef unsigned int U32; +typedef Byte* DuckyVar; +typedef struct DuckyType { + Byte* name; + DuckyType* parent_type; +} DuckyType; + +#define TYPE_PTR_SIZE 4u + +DuckyVar Ducky_DeclareVar(DuckyType* type, U32 size); +#define TYPE(name) *((DuckyType**)name) +#define TYPE_PTR(name) (((DuckyType**)name)[0]) +#define VALUE(type,name) *((type*)(name + TYPE_PTR_SIZE)) +#define VALUE_PTR(type,name) ((type*)(name + TYPE_PTR_SIZE)) + +#endif diff --git a/flex-bison/mantella/runtime/src/runtime.s b/flex-bison/mantella/runtime/src/runtime.s new file mode 100644 index 0000000..5c33ccf --- /dev/null +++ b/flex-bison/mantella/runtime/src/runtime.s @@ -0,0 +1,49 @@ +; ModuleID = 'runtime.c' +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f80:128:128-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32" +target triple = "i386-pc-mingw32" + +%struct.DuckyType = type { i8* } + +@.str = private unnamed_addr constant [8 x i8] c"integer\00" +@T_INT = global %struct.DuckyType { i8* getelementptr inbounds ([8 x i8]* @.str, i32 0, i32 0) }, align 4 +@.str1 = private unnamed_addr constant [6 x i8] c"float\00" +@T_FLOAT = global %struct.DuckyType { i8* getelementptr inbounds ([6 x i8]* @.str1, i32 0, i32 0) }, align 4 +@.str2 = private unnamed_addr constant [7 x i8] c"string\00" +@T_STRING = global %struct.DuckyType { i8* getelementptr inbounds ([7 x i8]* @.str2, i32 0, i32 0) }, align 4 +@.str3 = private unnamed_addr constant [6 x i8] c"array\00" +@T_ARRAY = global %struct.DuckyType { i8* getelementptr inbounds ([6 x i8]* @.str3, i32 0, i32 0) }, align 4 +@.str4 = private unnamed_addr constant [4 x i8] c"map\00" +@T_MAP = global %struct.DuckyType { i8* getelementptr inbounds ([4 x i8]* @.str4, i32 0, i32 0) }, align 4 + +define i8* @Ducky_DeclareVar(%struct.DuckyType* %type, i32 %size) nounwind { + %1 = alloca %struct.DuckyType*, align 4 + %2 = alloca i32, align 4 + %temp = alloca i8*, align 4 + store %struct.DuckyType* %type, %struct.DuckyType** %1, align 4 + store i32 %size, i32* %2, align 4 + %3 = load i32* %2, align 4 + %4 = add i32 4, %3 + %5 = call i8* @malloc(i32 %4) + store i8* %5, i8** %temp, align 4 + %6 = load %struct.DuckyType** %1, align 4 + %7 = load i8** %temp, align 4 + %8 = bitcast i8* %7 to %struct.DuckyType** + store %struct.DuckyType* %6, %struct.DuckyType** %8 + %9 = load i8** %temp, align 4 + ret i8* %9 +} + +declare i8* @malloc(i32) + +define i32 @main() nounwind { + %1 = alloca i32, align 4 + %foo = alloca i8*, align 4 + store i32 0, i32* %1 + %2 = call i8* @Ducky_DeclareVar(%struct.DuckyType* @T_INT, i32 4) + store i8* %2, i8** %foo, align 4 + %3 = load i8** %foo, align 4 + %4 = getelementptr inbounds i8* %3, i32 4 + %5 = bitcast i8* %4 to i32* + store i32 5, i32* %5 + ret i32 0 +} diff --git a/flex-bison/mantella/src/cl_options/cl_options.cpp b/flex-bison/mantella/src/cl_options/cl_options.cpp new file mode 100644 index 0000000..1b662f7 --- /dev/null +++ b/flex-bison/mantella/src/cl_options/cl_options.cpp @@ -0,0 +1,140 @@ +/****************************************************************************** + * Copyright (C) 2011 Michael D. Lowis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ +#include +#include +#include "cl_options.h" +#include + +STATIC void HandleLongOption(U8 opt_index); +STATIC void HandleShortOption(U8 opt); +STATIC void BuildFileList(U32 argc, String* argv); + +using namespace std; + +/****************************************************************************** + * Globals + *****************************************************************************/ +const string Help_String( +"Usage: mark1 [options] file...\n" +"Options:\n" +" --help Prints available options\n" +" --debug-ast Enables debug printing of the abstract syntax tree.\n" +" --debug-scm Enables debug printing of the generated scheme code.\n" +); + +// Short Options List +const string Short_Options(""); + +// Long Options List +const struct option Long_Options[] = { + {"help", 0, 0, 0}, + {"debug-ast", 0, 0, 0}, + {"debug-scm", 0, 0, 0}, + {"interpret", 0, 0, 0}, + {0,0,0,0} +}; +#define IDX_HELP ((U8)0) +#define IDX_DEBUG_AST ((U8)1) +#define IDX_DEBUG_SCM ((U8)2) +#define IDX_INTERPRET ((U8)3) + +STATIC list* FileList = NULL; + +// Option Variables +DECLARE(BOOL,DebugAST); +DECLARE(BOOL,DebugSCM); +DECLARE(BOOL,InterpretMode); + +/****************************************************************************** + * Private Functions + *****************************************************************************/ +void HandleLongOption(U8 opt_index) +{ + switch( opt_index ) + { + case IDX_HELP: + cout << Help_String; + exit(0); + break; + case IDX_DEBUG_AST: + CLO_SET(DebugAST,TRUE); + break; + case IDX_DEBUG_SCM: + CLO_SET(DebugSCM,TRUE); + break; + case IDX_INTERPRET: + CLO_SET(InterpretMode,TRUE); + default: + break; + } +} + +void HandleShortOption(U8 opt) +{ + switch( opt ) + { + default: + break; + } +} + +void BuildFileList(U32 argc, String* argv) +{ + FileList = _new list(); + while ((U32)optind < argc) + { + FileList->push_back( argv[optind++] ); + } +} + +/****************************************************************************** + * Public Functions + *****************************************************************************/ +void CLO_ParseOptions(U32 argc, String* argv) +{ + S8 opt = 0; + U8 opt_index = 0; + while(1) + { + opt = getopt_long(argc, argv, Short_Options.c_str(), Long_Options, (int*)&opt_index); + if (opt == -1) + { + break; + } + + if(opt == 0) + { + HandleLongOption(opt_index); + } + else + { + HandleShortOption(opt); + } + } + BuildFileList(argc,argv); +} + +void CLO_Cleanup(void) +{ + delete FileList; +} + +list* CLO_GetFileList(void) +{ + return FileList; +} + diff --git a/flex-bison/mantella/src/cl_options/cl_options.h b/flex-bison/mantella/src/cl_options/cl_options.h new file mode 100644 index 0000000..e657687 --- /dev/null +++ b/flex-bison/mantella/src/cl_options/cl_options.h @@ -0,0 +1,44 @@ +/****************************************************************************** + * Copyright (C) 2011 Michael D. Lowis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ +#ifndef CL_OPTIONS_H +#define CL_OPTIONS_H + +#include "common.h" +#include + +void CLO_ParseOptions(U32 argc, String* argv); +void CLO_Cleanup(void); +std::list* CLO_GetFileList(void); + +#define PROTOTYPE(type,name) \ + type CLO_Get##name(void); \ + void CLO_Set##name(type) + +#define DECLARE(type,name) \ + static type name; \ + type CLO_Get##name(void) { return name; } \ + void CLO_Set##name(type x) { name = x; } + +#define CLO_GET(name) CLO_Get##name() +#define CLO_SET(name,value) CLO_Set##name(value) + + +PROTOTYPE(BOOL,DebugAST); +PROTOTYPE(BOOL,DebugSCM); +PROTOTYPE(BOOL,InterpretMode); + +#endif diff --git a/flex-bison/mantella/src/common.h b/flex-bison/mantella/src/common.h new file mode 100644 index 0000000..5932748 --- /dev/null +++ b/flex-bison/mantella/src/common.h @@ -0,0 +1,138 @@ +/****************************************************************************** + * Copyright (C) 2011 Michael D. Lowis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ +#ifndef COMMON_H +#define COMMON_H + +#include "cork.h" + +/****************************************************************************** + * Types + *****************************************************************************/ +//! Boolean enum definition +typedef enum +{ + TRUE = 1, + FALSE = 0 +} BOOL; + +/**** Unsigned Integers ****/ +//! 8-bit unsigned integer +typedef unsigned char U8; + +//! 16-bit unsigned integer +typedef unsigned short int U16; + +//! 32-bit unsigned integer +typedef unsigned long U32; + +/**** Signed Integers ****/ +//! 8-bit signed integer +typedef signed char S8; + +//! 16-bit signed integer +typedef short int S16; + +//! 32-bit signed integer +typedef long int S32; + +//! 64-bit signed integer +typedef long long int S64; + +// Floating Point +//! 32-bit floating point number +typedef float F32; + +//! 64-bit floating point number +typedef double F64; + +/**** String ****/ +//! String definition +typedef char * String; + +/****************************************************************************** + * Defines + *****************************************************************************/ + +#ifdef TEST + #define STATIC +#else + #define STATIC static +#endif + +#ifndef NULL + #define NULL ((U8)0) +#endif +#define NULL_PTR ((void *)0u) + +#define BIT_0 0x01u +#define BIT_1 0x02u +#define BIT_2 0x04u +#define BIT_3 0x08u +#define BIT_4 0x10u +#define BIT_5 0x20u +#define BIT_6 0x40u +#define BIT_7 0x80u + +#define BIT_8 0x0100u +#define BIT_9 0x0200u +#define BIT_10 0x0400u +#define BIT_11 0x0800u +#define BIT_12 0x1000u +#define BIT_13 0x2000u +#define BIT_14 0x4000u +#define BIT_15 0x8000u + +#define BIT_16 0x010000u +#define BIT_17 0x020000u +#define BIT_18 0x040000u +#define BIT_19 0x080000u +#define BIT_20 0x100000u +#define BIT_21 0x200000u +#define BIT_22 0x400000u +#define BIT_23 0x800000u + +#define BIT_24 0x01000000u +#define BIT_25 0x02000000u +#define BIT_26 0x04000000u +#define BIT_27 0x08000000u +#define BIT_28 0x10000000u +#define BIT_29 0x20000000u +#define BIT_30 0x40000000u +#define BIT_31 0x80000000u + +/****************************************************************************** + * Macros + *****************************************************************************/ + +#define VERIFY_RANGE(x, Min, Max) ((((x)>=(Min)) && ((x)<=(Max)))? (TRUE) : (FALSE)) +#define VERIFY_RANGE_VALUE(x, Default, Min, Max) (VERIFY_RANGE((x), (Min), (Max))? (x) : (Default)) +#define VERIFY_MAX_VALUE(x, Default, Max) (((x)<=(Max)) ? (x) : (Default)) +#define VERIFY_MIN_VALUE(x, Default, Min) (((x)>=(Min)) ? (x) : (Default)) +#define _ABS(x, type) (((x) < (type)0) ? (type)-(x):(x)) +#define ABS(x) (((x) < 0) ? -(x):(x)) +#define MAX(a,b) (((a) > (b)) ? (a):(b)) +#define MIN(a,b) (((a) < (b)) ? (a):(b)) +#define SIGN(x,y) (((y) < 0) ? (-(x)):(x)) +#define NUM_ELEMENTS(x) (sizeof(x)/sizeof(x[0])) +#define LIMIT_RANGE(x,Min,Max) (MAX(MIN((x),(Max)),(Min))) +#define LOW_BYTE(x) ((U8)((x) & 0x00FFu)) +#define HIGH_BYTE(x) ((U8)(((x)>>8u) & 0x00FFu)) +#define LOW_WORD(x) ((U16)((x) & 0x0000FFFFUL)) +#define HIGH_WORD(x) ((U16)(((x)>>16) & 0x0000FFFFUL)) +#define QUOTE(x) #x + +#endif diff --git a/flex-bison/mantella/src/cork/cork.cpp b/flex-bison/mantella/src/cork/cork.cpp new file mode 100644 index 0000000..5fb3e09 --- /dev/null +++ b/flex-bison/mantella/src/cork/cork.cpp @@ -0,0 +1,183 @@ +#include "cork.h" + +#ifdef DETECT_MEM_LEAKS + +// We want to use the real malloc and free in this file +#undef malloc +#undef free + +#include +#include // for std::bad_alloc +#include // for malloc() and free() +#include + +// Set the namespace +using namespace std; +/****************************************************************************** + * Typedefs + *****************************************************************************/ +typedef struct BlockTableEntry +{ + void * ptr; + unsigned int size; + const char* file; + int line; + void * next; +} BlockTableEntry_T; + +typedef struct BlockTable +{ + unsigned int size; + BlockTableEntry_T* blocks[TBL_SIZE]; +} BlockTable_T; + +/****************************************************************************** + * Prototypes + *****************************************************************************/ +void insert_record(void * ptr, BlockTable_T* entry); +void erase_record(void * ptr); + +/****************************************************************************** + * Globals + *****************************************************************************/ +unsigned int allocated; +static BlockTable_T Block_Table = { 0, {0} }; + +/****************************************************************************** + * Function Definitions + *****************************************************************************/ +void insert_record(void * ptr, BlockTableEntry_T* entry) +{ + unsigned int index = ((unsigned int)ptr) % TBL_SIZE; + BlockTableEntry_T* last = Block_Table.blocks[ index ]; + BlockTableEntry_T* curr = last; + + while (curr != NULL) + { + if ( curr->ptr == ptr ) + { + curr->size = entry->size; + free(entry); + break; + } + last = curr; + curr = (BlockTableEntry_T*)curr->next; + } + + if(curr == NULL) + { + if (last != NULL) + { + last->next = entry; + } + else + { + Block_Table.blocks[index] = entry; + } + Block_Table.size++; + } +} + +void erase_record(void * ptr) +{ + int depth = 0; + unsigned int index = ((unsigned int)ptr) % TBL_SIZE; + BlockTableEntry_T* last = Block_Table.blocks[ index ]; + BlockTableEntry_T* curr = last; + + while( curr != NULL ) + { + depth = 1; + if( curr->ptr == ptr ) + { + depth = 2; + if(last == curr) + { + depth = 3; + Block_Table.blocks[ index ] = (BlockTableEntry_T*)curr->next; + } + else + { + depth = 4; + last->next = curr->next; + } + free(curr); + Block_Table.size--; + break; + } + last = curr; + curr = (BlockTableEntry_T*)curr->next; + } +} + +void Cork_ReportMemoryLeaks(void) +{ + unsigned int index = 0; + cout << "-----------------------------------------------------------------" << endl; + cout << "Cork: Memory Allocation Analysis" << endl; + cout << "-----------------------------------------------------------------" << endl; + cout << "You have " << Block_Table.size << " Unclaimed objects." << endl; + + for(; index < TBL_SIZE; index++) + { + BlockTableEntry_T* entry = Block_Table.blocks[ index ]; + while(entry != NULL) + { + cout << "\t" << entry->size << "\t" << entry->ptr; + if( entry->file != NULL ) + { + cout << "\t" << entry->line << "\t" << entry->file; + } + cout << endl; + entry = (BlockTableEntry_T*)entry->next; + } + } +} + +void * operator new (size_t size, string file, unsigned int line) +{ + void * ptr = malloc(size); + char * fname = (char*)malloc(file.length()); + if(ptr == NULL) + { + throw bad_alloc(); + } + else + { + BlockTableEntry_T* entry = (BlockTableEntry_T*)malloc(sizeof(BlockTableEntry_T)); + strcpy( fname, file.c_str() ); + entry->ptr = ptr; + entry->size = size; + entry->file = fname; + entry->line = line; + entry->next = NULL; + insert_record(ptr,entry); + } + return ptr; +} + +void * operator new(size_t size) throw(bad_alloc) { + void * ptr = malloc(size); + if(ptr == NULL) + { + throw bad_alloc(); + } + else + { + BlockTableEntry_T* entry = (BlockTableEntry_T*)malloc(sizeof(BlockTableEntry_T)); + entry->ptr = ptr; + entry->size = size; + entry->file = NULL; + entry->line = 0; + entry->next = NULL; + insert_record(ptr,entry); + } + return ptr; +} + +void operator delete(void * p) { + free(p); + erase_record(p); +} + +#endif diff --git a/flex-bison/mantella/src/cork/cork.h b/flex-bison/mantella/src/cork/cork.h new file mode 100644 index 0000000..1aa8ab6 --- /dev/null +++ b/flex-bison/mantella/src/cork/cork.h @@ -0,0 +1,18 @@ +#ifndef CORK_H +#define CORK_H + +#ifdef DETECT_MEM_LEAKS + #include + typedef unsigned int size_t; + + void Cork_ReportMemoryLeaks(void); + void * operator new (size_t size, std::string file, unsigned int line); + #define TBL_SIZE 512 + #define REPORT_LEAKS() Cork_ReportMemoryLeaks() + #define _new new (__FILE__,__LINE__) +#else + #define REPORT_LEAKS() + #define _new new +#endif + +#endif diff --git a/flex-bison/mantella/src/grammar/grammar.tab.c b/flex-bison/mantella/src/grammar/grammar.tab.c new file mode 100644 index 0000000..86de6ca --- /dev/null +++ b/flex-bison/mantella/src/grammar/grammar.tab.c @@ -0,0 +1,1982 @@ + +/* A Bison parser, made by GNU Bison 2.4.1. */ + +/* Skeleton implementation for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Bison version. */ +#define YYBISON_VERSION "2.4.1" + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 1 + +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + +/* Using locations. */ +#define YYLSP_NEEDED 0 + + + +/* Copy the first part of user declarations. */ + +/* Line 189 of yacc.c */ +#line 1 "src/grammar/grammar.y" + + +#include +#include +#include +#include "parser.h" +#include "common.h" + +typedef void* yyscan_t; +#define YYLEX_PARAM context->lexinfo +void yyerror(ParseContext_T* context, const char * s); + + +/* Line 189 of yacc.c */ +#line 87 "src/grammar/grammar.tab.c" + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 0 +#endif + +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE 0 +#endif + +/* "%code requires" blocks. */ + +/* Line 209 of yacc.c */ +#line 14 "src/grammar/grammar.y" + +#include +#include "ast.h" + +string typeToString(unsigned int type); + + + +/* Line 209 of yacc.c */ +#line 120 "src/grammar/grammar.tab.c" + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + tCONST = 258, + tVAR = 259, + tFUNC = 260, + tWHILE = 261, + tIF = 262, + tELSE = 263, + tEND = 264, + tRET = 265, + tINT = 266, + tFLOAT = 267, + tID = 268, + tSTRING = 269, + tADD = 270, + tSUB = 271, + tMUL = 272, + tDIV = 273, + tMOD = 274, + tPOW = 275, + tAND = 276, + tOR = 277, + tNOT = 278, + tEQ = 279, + tNE = 280, + tGT = 281, + tLT = 282, + tGTE = 283, + tLTE = 284, + tASSIGN = 285, + tROOT = 286, + tDECL = 287, + tBLOCK = 288, + tPARMLST = 289, + tEXPLST = 290, + tCALL = 291 + }; +#endif + + + +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef union YYSTYPE +{ + +/* Line 214 of yacc.c */ +#line 31 "src/grammar/grammar.y" + + void* Node; + + + +/* Line 214 of yacc.c */ +#line 179 "src/grammar/grammar.tab.c" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +#endif + + +/* Copy the second part of user declarations. */ + + +/* Line 264 of yacc.c */ +#line 191 "src/grammar/grammar.tab.c" +/* Unqualified %code blocks. */ + +/* Line 265 of yacc.c */ +#line 35 "src/grammar/grammar.y" + +extern int yylex(YYSTYPE * yylval_param ,yyscan_t yyscanner); + + + +/* Line 265 of yacc.c */ +#line 202 "src/grammar/grammar.tab.c" + +#ifdef short +# undef short +#endif + +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else +typedef unsigned char yytype_uint8; +#endif + +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; +#elif (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +typedef signed char yytype_int8; +#else +typedef short int yytype_int8; +#endif + +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; +#else +typedef unsigned short int yytype_uint16; +#endif + +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; +#endif + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int +# endif +#endif + +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) + +#ifndef YY_ +# if YYENABLE_NLS +# if ENABLE_NLS +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_(msgid) dgettext ("bison-runtime", msgid) +# endif +# endif +# ifndef YY_ +# define YY_(msgid) msgid +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(e) ((void) (e)) +#else +# define YYUSE(e) /* empty */ +#endif + +/* Identity function, used to suppress warnings about constant conditions. */ +#ifndef lint +# define YYID(n) (n) +#else +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static int +YYID (int yyi) +#else +static int +YYID (yyi) + int yyi; +#endif +{ + return yyi; +} +#endif + +#if ! defined yyoverflow || YYERROR_VERBOSE + +/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include /* INFRINGES ON USER NAME SPACE */ +# define alloca _alloca +# else +# define YYSTACK_ALLOC alloca +# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ +# endif +# else +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# endif +# if (defined __cplusplus && ! defined _STDLIB_H \ + && ! ((defined YYMALLOC || defined malloc) \ + && (defined YYFREE || defined free))) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE free +# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void free (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# endif +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ + + +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; +}; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + + YYSTACK_GAP_MAXIMUM) + +/* Copy COUNT objects from FROM to TO. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# else +# define YYCOPY(To, From, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (YYID (0)) +# endif +# endif + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (YYID (0)) + +#endif + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 2 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 207 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 46 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 10 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 38 +/* YYNRULES -- Number of states. */ +#define YYNSTATES 73 + +/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 291 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +static const yytype_uint8 yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 24, 2, 2, + 37, 38, 22, 20, 39, 21, 2, 23, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 36, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 40, 41, 42, 43, + 44, 45 +}; + +#if YYDEBUG +/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in + YYRHS. */ +static const yytype_uint8 yyprhs[] = +{ + 0, 0, 3, 4, 7, 9, 12, 14, 18, 20, + 24, 28, 30, 32, 34, 39, 46, 54, 58, 62, + 66, 70, 74, 78, 82, 86, 90, 94, 98, 102, + 106, 110, 113, 118, 122, 124, 126, 128, 130 +}; + +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const yytype_int8 yyrhs[] = +{ + 47, 0, -1, -1, 47, 51, -1, 51, -1, 48, + 51, -1, 13, -1, 49, 39, 13, -1, 54, -1, + 50, 39, 54, -1, 13, 36, 54, -1, 52, -1, + 53, -1, 54, -1, 7, 54, 48, 9, -1, 7, + 54, 48, 8, 48, 9, -1, 5, 13, 37, 49, + 38, 48, 9, -1, 54, 20, 54, -1, 54, 21, + 54, -1, 54, 22, 54, -1, 54, 23, 54, -1, + 54, 24, 54, -1, 54, 25, 54, -1, 54, 29, + 54, -1, 54, 30, 54, -1, 54, 32, 54, -1, + 54, 31, 54, -1, 54, 34, 54, -1, 54, 33, + 54, -1, 54, 26, 54, -1, 54, 27, 54, -1, + 28, 54, -1, 13, 37, 50, 38, -1, 37, 54, + 38, -1, 55, -1, 11, -1, 12, -1, 13, -1, + 14, -1 +}; + +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ +static const yytype_uint8 yyrline[] = +{ + 0, 101, 101, 103, 107, 108, 111, 112, 116, 117, + 121, 122, 123, 124, 128, 129, 133, 138, 139, 140, + 141, 142, 143, 145, 146, 147, 148, 149, 150, 152, + 153, 154, 156, 157, 160, 164, 165, 166, 167 +}; +#endif + +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "$end", "error", "$undefined", "tCONST", "tVAR", "tFUNC", "tWHILE", + "tIF", "tELSE", "tEND", "tRET", "tINT", "tFLOAT", "tID", "tSTRING", + "tADD", "tSUB", "tMUL", "tDIV", "tMOD", "'+'", "'-'", "'*'", "'/'", + "'%'", "tPOW", "tAND", "tOR", "tNOT", "tEQ", "tNE", "tGT", "tLT", "tGTE", + "tLTE", "tASSIGN", "'='", "'('", "')'", "','", "tROOT", "tDECL", + "tBLOCK", "tPARMLST", "tEXPLST", "tCALL", "$accept", "program", "block", + "param_list", "exp_list", "stmnt", "if_stmnt", "function", "exp", + "literal", 0 +}; +#endif + +# ifdef YYPRINT +/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to + token YYLEX-NUM. */ +static const yytype_uint16 yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 43, 45, 42, 47, 37, 275, 276, 277, 278, 279, + 280, 281, 282, 283, 284, 285, 61, 40, 41, 44, + 286, 287, 288, 289, 290, 291 +}; +# endif + +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = +{ + 0, 46, 47, 47, 48, 48, 49, 49, 50, 50, + 51, 51, 51, 51, 52, 52, 53, 54, 54, 54, + 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, + 54, 54, 54, 54, 54, 55, 55, 55, 55 +}; + +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 0, 2, 1, 2, 1, 3, 1, 3, + 3, 1, 1, 1, 4, 6, 7, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 2, 4, 3, 1, 1, 1, 1, 1 +}; + +/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state + STATE-NUM when YYTABLE doesn't specify something else to do. Zero + means the default is an error. */ +static const yytype_uint8 yydefact[] = +{ + 2, 0, 1, 0, 0, 35, 36, 37, 38, 0, + 0, 3, 11, 12, 13, 34, 0, 37, 0, 0, + 0, 31, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, + 10, 0, 8, 33, 17, 18, 19, 20, 21, 22, + 29, 30, 23, 24, 26, 25, 28, 27, 6, 0, + 0, 14, 5, 32, 0, 0, 0, 0, 9, 0, + 7, 15, 16 +}; + +/* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int8 yydefgoto[] = +{ + -1, 1, 38, 59, 41, 39, 12, 13, 14, 15 +}; + +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +#define YYPACT_NINF -47 +static const yytype_int16 yypact[] = +{ + -47, 34, -47, -8, 121, -47, -47, 6, -47, 121, + 121, -47, -47, -47, 158, -47, -22, -19, 62, 121, + 121, 9, 139, 121, 121, 121, 121, 121, 121, 121, + 121, 121, 121, 121, 121, 121, 121, 27, 44, -47, + 158, 21, 158, -47, -14, -14, -23, -23, -23, 9, + -47, -47, 173, 173, 173, 173, 173, 173, -47, 25, + 113, -47, -47, -47, 121, 113, 31, 93, 158, 103, + -47, -47, -47 +}; + +/* YYPGOTO[NTERM-NUM]. */ +static const yytype_int8 yypgoto[] = +{ + -47, -47, -46, -47, -47, -1, -47, -47, -3, -47 +}; + +/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule which + number is the opposite. If zero, do what YYDEFACT says. + If YYTABLE_NINF, syntax error. */ +#define YYTABLE_NINF -1 +static const yytype_int8 yytable[] = +{ + 11, 18, 28, 29, 30, 16, 21, 22, 25, 26, + 27, 28, 29, 30, 67, 37, 40, 42, 20, 69, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 2, 29, 30, 62, 0, 3, + 58, 4, 19, 20, 70, 5, 6, 7, 8, 3, + 0, 4, 60, 61, 0, 5, 6, 7, 8, 63, + 64, 68, 9, 65, 66, 0, 62, 3, 62, 4, + 0, 10, 9, 5, 6, 7, 8, 0, 0, 0, + 0, 10, 23, 24, 25, 26, 27, 28, 29, 30, + 9, 31, 32, 33, 34, 35, 36, 0, 3, 10, + 4, 0, 71, 0, 5, 6, 7, 8, 3, 0, + 4, 0, 72, 0, 5, 6, 7, 8, 3, 0, + 4, 9, 0, 0, 5, 6, 7, 8, 0, 0, + 10, 9, 5, 6, 17, 8, 0, 0, 0, 0, + 10, 9, 0, 0, 0, 0, 0, 0, 0, 9, + 10, 0, 0, 0, 0, 0, 0, 0, 10, 23, + 24, 25, 26, 27, 28, 29, 30, 0, 31, 32, + 33, 34, 35, 36, 0, 0, 0, 43, 23, 24, + 25, 26, 27, 28, 29, 30, 0, 31, 32, 33, + 34, 35, 36, 23, 24, 25, 26, 27, 28, 29, + 30, 0, -1, -1, -1, -1, -1, -1 +}; + +static const yytype_int8 yycheck[] = +{ + 1, 4, 25, 26, 27, 13, 9, 10, 22, 23, + 24, 25, 26, 27, 60, 37, 19, 20, 37, 65, + 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, + 33, 34, 35, 36, 0, 26, 27, 38, -1, 5, + 13, 7, 36, 37, 13, 11, 12, 13, 14, 5, + -1, 7, 8, 9, -1, 11, 12, 13, 14, 38, + 39, 64, 28, 38, 39, -1, 67, 5, 69, 7, + -1, 37, 28, 11, 12, 13, 14, -1, -1, -1, + -1, 37, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, -1, 5, 37, + 7, -1, 9, -1, 11, 12, 13, 14, 5, -1, + 7, -1, 9, -1, 11, 12, 13, 14, 5, -1, + 7, 28, -1, -1, 11, 12, 13, 14, -1, -1, + 37, 28, 11, 12, 13, 14, -1, -1, -1, -1, + 37, 28, -1, -1, -1, -1, -1, -1, -1, 28, + 37, -1, -1, -1, -1, -1, -1, -1, 37, 20, + 21, 22, 23, 24, 25, 26, 27, -1, 29, 30, + 31, 32, 33, 34, -1, -1, -1, 38, 20, 21, + 22, 23, 24, 25, 26, 27, -1, 29, 30, 31, + 32, 33, 34, 20, 21, 22, 23, 24, 25, 26, + 27, -1, 29, 30, 31, 32, 33, 34 +}; + +/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const yytype_uint8 yystos[] = +{ + 0, 47, 0, 5, 7, 11, 12, 13, 14, 28, + 37, 51, 52, 53, 54, 55, 13, 13, 54, 36, + 37, 54, 54, 20, 21, 22, 23, 24, 25, 26, + 27, 29, 30, 31, 32, 33, 34, 37, 48, 51, + 54, 50, 54, 38, 54, 54, 54, 54, 54, 54, + 54, 54, 54, 54, 54, 54, 54, 54, 13, 49, + 8, 9, 51, 38, 39, 38, 39, 48, 54, 48, + 13, 9, 9 +}; + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab + + +/* Like YYERROR except do call yyerror. This remains here temporarily + to ease the transition to the new meaning of YYERROR, for GCC. + Once GCC version 2 has supplanted version 1, this can go. */ + +#define YYFAIL goto yyerrlab + +#define YYRECOVERING() (!!yyerrstatus) + +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + yytoken = YYTRANSLATE (yychar); \ + YYPOPSTACK (1); \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (context, YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ +while (YYID (0)) + + +#define YYTERROR 1 +#define YYERRCODE 256 + + +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. + If N is 0, then set CURRENT to the empty location which ends + the previous symbol: RHS[0] (always defined). */ + +#define YYRHSLOC(Rhs, K) ((Rhs)[K]) +#ifndef YYLLOC_DEFAULT +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (YYID (N)) \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ + while (YYID (0)) +#endif + + +/* YY_LOCATION_PRINT -- Print the location on the stream. + This macro was not mandated originally: define only if we know + we won't break user code: when these are the locations we know. */ + +#ifndef YY_LOCATION_PRINT +# if YYLTYPE_IS_TRIVIAL +# define YY_LOCATION_PRINT(File, Loc) \ + fprintf (File, "%d.%d-%d.%d", \ + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) +# else +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +# endif +#endif + + +/* YYLEX -- calling `yylex' with the right arguments. */ + +#ifdef YYLEX_PARAM +# define YYLEX yylex (&yylval, YYLEX_PARAM) +#else +# define YYLEX yylex (&yylval) +#endif + +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (YYID (0)) + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value, context); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (YYID (0)) + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, ParseContext_T* context) +#else +static void +yy_symbol_value_print (yyoutput, yytype, yyvaluep, context) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; + ParseContext_T* context; +#endif +{ + if (!yyvaluep) + return; + YYUSE (context); +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# else + YYUSE (yyoutput); +# endif + switch (yytype) + { + default: + break; + } +} + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, ParseContext_T* context) +#else +static void +yy_symbol_print (yyoutput, yytype, yyvaluep, context) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; + ParseContext_T* context; +#endif +{ + if (yytype < YYNTOKENS) + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); + else + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + + yy_symbol_value_print (yyoutput, yytype, yyvaluep, context); + YYFPRINTF (yyoutput, ")"); +} + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +#else +static void +yy_stack_print (yybottom, yytop) + yytype_int16 *yybottom; + yytype_int16 *yytop; +#endif +{ + YYFPRINTF (stderr, "Stack now"); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } + YYFPRINTF (stderr, "\n"); +} + +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (YYID (0)) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_reduce_print (YYSTYPE *yyvsp, int yyrule, ParseContext_T* context) +#else +static void +yy_reduce_print (yyvsp, yyrule, context) + YYSTYPE *yyvsp; + int yyrule; + ParseContext_T* context; +#endif +{ + int yynrhs = yyr2[yyrule]; + int yyi; + unsigned long int yylno = yyrline[yyrule]; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + YYFPRINTF (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], + &(yyvsp[(yyi + 1) - (yynrhs)]) + , context); + YYFPRINTF (stderr, "\n"); + } +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyvsp, Rule, context); \ +} while (YYID (0)) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !YYDEBUG */ + + +/* YYINITDEPTH -- initial size of the parser's stacks. */ +#ifndef YYINITDEPTH +# define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH 10000 +#endif + + + +#if YYERROR_VERBOSE + +# ifndef yystrlen +# if defined __GLIBC__ && defined _STRING_H +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static YYSIZE_T +yystrlen (const char *yystr) +#else +static YYSIZE_T +yystrlen (yystr) + const char *yystr; +#endif +{ + YYSIZE_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) + continue; + return yylen; +} +# endif +# endif + +# ifndef yystpcpy +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static char * +yystpcpy (char *yydest, const char *yysrc) +#else +static char * +yystpcpy (yydest, yysrc) + char *yydest; + const char *yysrc; +#endif +{ + char *yyd = yydest; + const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + YYSIZE_T yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (! yyres) + return yystrlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; +} +# endif + +/* Copy into YYRESULT an error message about the unexpected token + YYCHAR while in state YYSTATE. Return the number of bytes copied, + including the terminating null byte. If YYRESULT is null, do not + copy anything; just return the number of bytes that would be + copied. As a special case, return 0 if an ordinary "syntax error" + message will do. Return YYSIZE_MAXIMUM if overflow occurs during + size calculation. */ +static YYSIZE_T +yysyntax_error (char *yyresult, int yystate, int yychar) +{ + int yyn = yypact[yystate]; + + if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) + return 0; + else + { + int yytype = YYTRANSLATE (yychar); + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + int yysize_overflow = 0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + int yyx; + +# if 0 + /* This is so xgettext sees the translatable formats that are + constructed on the fly. */ + YY_("syntax error, unexpected %s"); + YY_("syntax error, unexpected %s, expecting %s"); + YY_("syntax error, unexpected %s, expecting %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); +# endif + char *yyfmt; + char const *yyf; + static char const yyunexpected[] = "syntax error, unexpected %s"; + static char const yyexpecting[] = ", expecting %s"; + static char const yyor[] = " or %s"; + char yyformat[sizeof yyunexpected + + sizeof yyexpecting - 1 + + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) + * (sizeof yyor - 1))]; + char const *yyprefix = yyexpecting; + + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yycount = 1; + + yyarg[0] = yytname[yytype]; + yyfmt = yystpcpy (yyformat, yyunexpected); + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + yyformat[sizeof yyunexpected - 1] = '\0'; + break; + } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + yyfmt = yystpcpy (yyfmt, yyprefix); + yyprefix = yyor; + } + + yyf = YY_(yyformat); + yysize1 = yysize + yystrlen (yyf); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + + if (yysize_overflow) + return YYSIZE_MAXIMUM; + + if (yyresult) + { + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + char *yyp = yyresult; + int yyi = 0; + while ((*yyp = *yyf) != '\0') + { + if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyf += 2; + } + else + { + yyp++; + yyf++; + } + } + } + return yysize; + } +} +#endif /* YYERROR_VERBOSE */ + + +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, ParseContext_T* context) +#else +static void +yydestruct (yymsg, yytype, yyvaluep, context) + const char *yymsg; + int yytype; + YYSTYPE *yyvaluep; + ParseContext_T* context; +#endif +{ + YYUSE (yyvaluep); + YYUSE (context); + + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + + switch (yytype) + { + + default: + break; + } +} + +/* Prevent warnings from -Wmissing-prototypes. */ +#ifdef YYPARSE_PARAM +#if defined __STDC__ || defined __cplusplus +int yyparse (void *YYPARSE_PARAM); +#else +int yyparse (); +#endif +#else /* ! YYPARSE_PARAM */ +#if defined __STDC__ || defined __cplusplus +int yyparse (ParseContext_T* context); +#else +int yyparse (); +#endif +#endif /* ! YYPARSE_PARAM */ + + + + + +/*-------------------------. +| yyparse or yypush_parse. | +`-------------------------*/ + +#ifdef YYPARSE_PARAM +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (void *YYPARSE_PARAM) +#else +int +yyparse (YYPARSE_PARAM) + void *YYPARSE_PARAM; +#endif +#else /* ! YYPARSE_PARAM */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (ParseContext_T* context) +#else +int +yyparse (context) + ParseContext_T* context; +#endif +#endif +{ +/* The lookahead symbol. */ +int yychar; + +/* The semantic value of the lookahead symbol. */ +YYSTYPE yylval; + + /* Number of syntax errors so far. */ + int yynerrs; + + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + + /* The stacks and their tools: + `yyss': related to states. + `yyvs': related to semantic values. + + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; + + YYSIZE_T yystacksize; + + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken; + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; + + yytoken = 0; + yyss = yyssa; + yyvs = yyvsa; + yystacksize = YYINITDEPTH; + + YYDPRINTF ((stderr, "Starting parse\n")); + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + + /* Initialize stack pointers. + Waste one element of value and location stack + so that they stay on the same level as the state stack. + The wasted elements are never initialized. */ + yyssp = yyss; + yyvsp = yyvs; + + goto yysetstate; + +/*------------------------------------------------------------. +| yynewstate -- Push a new state, which is found in yystate. | +`------------------------------------------------------------*/ + yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. So pushing a state here evens the stacks. */ + yyssp++; + + yysetstate: + *yyssp = yystate; + + if (yyss + yystacksize - 1 <= yyssp) + { + /* Get the current used size of the three stacks, in elements. */ + YYSIZE_T yysize = yyssp - yyss + 1; + +#ifdef yyoverflow + { + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yystacksize); + + yyss = yyss1; + yyvs = yyvs1; + } +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyexhaustedlab; +# else + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + goto yyexhaustedlab; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif +#endif /* no yyoverflow */ + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; + + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; + } + + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + + if (yystate == YYFINAL) + YYACCEPT; + + goto yybackup; + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: + + /* Do appropriate processing given the current state. Read a + lookahead token if we need one and don't already have one. */ + + /* First try to decide what to do without reference to lookahead token. */ + yyn = yypact[yystate]; + if (yyn == YYPACT_NINF) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = YYLEX; + } + + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + goto yydefault; + yyn = yytable[yyn]; + if (yyn <= 0) + { + if (yyn == 0 || yyn == YYTABLE_NINF) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + /* Shift the lookahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the shifted token. */ + yychar = YYEMPTY; + + yystate = yyn; + *++yyvsp = yylval; + + goto yynewstate; + + +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + +/*-----------------------------. +| yyreduce -- Do a reduction. | +`-----------------------------*/ +yyreduce: + /* yyn is the number of a rule to reduce with. */ + yylen = yyr2[yyn]; + + /* If YYLEN is nonzero, implement the default value of the action: + `$$ = $1'. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; + + + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 3: + +/* Line 1455 of yacc.c */ +#line 103 "src/grammar/grammar.y" + { context->parser->processAST((AST*)(yyvsp[(2) - (2)].Node)); ;} + break; + + case 4: + +/* Line 1455 of yacc.c */ +#line 107 "src/grammar/grammar.y" + { (yyval.Node) = _new AST(tBLOCK, 1, (yyvsp[(1) - (1)].Node)); ;} + break; + + case 5: + +/* Line 1455 of yacc.c */ +#line 108 "src/grammar/grammar.y" + { (yyval.Node) = (yyvsp[(1) - (2)].Node); ((AST*)(yyval.Node))->addChild((AST*)(yyvsp[(2) - (2)].Node)); ;} + break; + + case 6: + +/* Line 1455 of yacc.c */ +#line 111 "src/grammar/grammar.y" + { (yyval.Node) = _new AST(tPARMLST, 1, (yyvsp[(1) - (1)].Node)); ;} + break; + + case 7: + +/* Line 1455 of yacc.c */ +#line 112 "src/grammar/grammar.y" + { (yyval.Node) = (yyvsp[(1) - (3)].Node); ((AST*)(yyval.Node))->addChild((AST*)(yyvsp[(3) - (3)].Node)); ;} + break; + + case 8: + +/* Line 1455 of yacc.c */ +#line 116 "src/grammar/grammar.y" + { (yyval.Node) = _new AST(tEXPLST, 1, (yyvsp[(1) - (1)].Node)); ;} + break; + + case 9: + +/* Line 1455 of yacc.c */ +#line 117 "src/grammar/grammar.y" + { (yyval.Node) = (yyvsp[(1) - (3)].Node); ((AST*)(yyval.Node))->addChild((AST*)(yyvsp[(3) - (3)].Node)); ;} + break; + + case 10: + +/* Line 1455 of yacc.c */ +#line 121 "src/grammar/grammar.y" + { (yyval.Node) = _new AST(tASSIGN, 2, (yyvsp[(1) - (3)].Node), (yyvsp[(3) - (3)].Node)); ;} + break; + + case 11: + +/* Line 1455 of yacc.c */ +#line 122 "src/grammar/grammar.y" + { (yyval.Node) = (yyvsp[(1) - (1)].Node); ;} + break; + + case 12: + +/* Line 1455 of yacc.c */ +#line 123 "src/grammar/grammar.y" + { (yyval.Node) = (yyvsp[(1) - (1)].Node); ;} + break; + + case 13: + +/* Line 1455 of yacc.c */ +#line 124 "src/grammar/grammar.y" + { (yyval.Node) = (yyvsp[(1) - (1)].Node); ;} + break; + + case 14: + +/* Line 1455 of yacc.c */ +#line 128 "src/grammar/grammar.y" + { (yyval.Node) = _new AST(tIF, 2, (yyvsp[(2) - (4)].Node), (yyvsp[(3) - (4)].Node)); ;} + break; + + case 15: + +/* Line 1455 of yacc.c */ +#line 129 "src/grammar/grammar.y" + { (yyval.Node) = _new AST(tIF, 3, (yyvsp[(2) - (6)].Node), (yyvsp[(3) - (6)].Node), (yyvsp[(5) - (6)].Node)); ;} + break; + + case 16: + +/* Line 1455 of yacc.c */ +#line 133 "src/grammar/grammar.y" + { (yyval.Node) = _new AST(tASSIGN, 2, (yyvsp[(2) - (7)].Node), _new AST(tFUNC, 2, (yyvsp[(4) - (7)].Node), (yyvsp[(6) - (7)].Node))); ;} + break; + + case 17: + +/* Line 1455 of yacc.c */ +#line 138 "src/grammar/grammar.y" + { (yyval.Node) = _new AST(tADD, 2, (yyvsp[(1) - (3)].Node), (yyvsp[(3) - (3)].Node)); ;} + break; + + case 18: + +/* Line 1455 of yacc.c */ +#line 139 "src/grammar/grammar.y" + { (yyval.Node) = _new AST(tSUB, 2, (yyvsp[(1) - (3)].Node), (yyvsp[(3) - (3)].Node)); ;} + break; + + case 19: + +/* Line 1455 of yacc.c */ +#line 140 "src/grammar/grammar.y" + { (yyval.Node) = _new AST(tMUL, 2, (yyvsp[(1) - (3)].Node), (yyvsp[(3) - (3)].Node)); ;} + break; + + case 20: + +/* Line 1455 of yacc.c */ +#line 141 "src/grammar/grammar.y" + { (yyval.Node) = _new AST(tDIV, 2, (yyvsp[(1) - (3)].Node), (yyvsp[(3) - (3)].Node)); ;} + break; + + case 21: + +/* Line 1455 of yacc.c */ +#line 142 "src/grammar/grammar.y" + { (yyval.Node) = _new AST(tMOD, 2, (yyvsp[(1) - (3)].Node), (yyvsp[(3) - (3)].Node)); ;} + break; + + case 22: + +/* Line 1455 of yacc.c */ +#line 143 "src/grammar/grammar.y" + { (yyval.Node) = _new AST(tPOW, 2, (yyvsp[(1) - (3)].Node), (yyvsp[(3) - (3)].Node)); ;} + break; + + case 23: + +/* Line 1455 of yacc.c */ +#line 145 "src/grammar/grammar.y" + { (yyval.Node) = _new AST(tEQ, 2, (yyvsp[(1) - (3)].Node), (yyvsp[(3) - (3)].Node)); ;} + break; + + case 24: + +/* Line 1455 of yacc.c */ +#line 146 "src/grammar/grammar.y" + { (yyval.Node) = _new AST(tNE, 2, (yyvsp[(1) - (3)].Node), (yyvsp[(3) - (3)].Node)); ;} + break; + + case 25: + +/* Line 1455 of yacc.c */ +#line 147 "src/grammar/grammar.y" + { (yyval.Node) = _new AST(tLT, 2, (yyvsp[(1) - (3)].Node), (yyvsp[(3) - (3)].Node)); ;} + break; + + case 26: + +/* Line 1455 of yacc.c */ +#line 148 "src/grammar/grammar.y" + { (yyval.Node) = _new AST(tGT, 2, (yyvsp[(1) - (3)].Node), (yyvsp[(3) - (3)].Node)); ;} + break; + + case 27: + +/* Line 1455 of yacc.c */ +#line 149 "src/grammar/grammar.y" + { (yyval.Node) = _new AST(tLTE, 2, (yyvsp[(1) - (3)].Node), (yyvsp[(3) - (3)].Node)); ;} + break; + + case 28: + +/* Line 1455 of yacc.c */ +#line 150 "src/grammar/grammar.y" + { (yyval.Node) = _new AST(tGTE, 2, (yyvsp[(1) - (3)].Node), (yyvsp[(3) - (3)].Node)); ;} + break; + + case 29: + +/* Line 1455 of yacc.c */ +#line 152 "src/grammar/grammar.y" + { (yyval.Node) = _new AST(tAND, 2, (yyvsp[(1) - (3)].Node), (yyvsp[(3) - (3)].Node)); ;} + break; + + case 30: + +/* Line 1455 of yacc.c */ +#line 153 "src/grammar/grammar.y" + { (yyval.Node) = _new AST(tOR, 2, (yyvsp[(1) - (3)].Node), (yyvsp[(3) - (3)].Node)); ;} + break; + + case 31: + +/* Line 1455 of yacc.c */ +#line 154 "src/grammar/grammar.y" + { (yyval.Node) = _new AST(tNOT, 1, (yyvsp[(2) - (2)].Node)); ;} + break; + + case 32: + +/* Line 1455 of yacc.c */ +#line 156 "src/grammar/grammar.y" + { (yyval.Node) = _new AST(tCALL, 2, (yyvsp[(1) - (4)].Node), (yyvsp[(3) - (4)].Node)); ;} + break; + + case 33: + +/* Line 1455 of yacc.c */ +#line 157 "src/grammar/grammar.y" + { (yyval.Node) = (yyvsp[(2) - (3)].Node); ;} + break; + + case 34: + +/* Line 1455 of yacc.c */ +#line 160 "src/grammar/grammar.y" + { (yyval.Node) = (yyvsp[(1) - (1)].Node); ;} + break; + + case 35: + +/* Line 1455 of yacc.c */ +#line 164 "src/grammar/grammar.y" + { (yyval.Node) = (yyvsp[(1) - (1)].Node); ;} + break; + + case 36: + +/* Line 1455 of yacc.c */ +#line 165 "src/grammar/grammar.y" + { (yyval.Node) = (yyvsp[(1) - (1)].Node); ;} + break; + + case 37: + +/* Line 1455 of yacc.c */ +#line 166 "src/grammar/grammar.y" + { (yyval.Node) = (yyvsp[(1) - (1)].Node); ;} + break; + + case 38: + +/* Line 1455 of yacc.c */ +#line 167 "src/grammar/grammar.y" + { (yyval.Node) = (yyvsp[(1) - (1)].Node); ;} + break; + + + +/* Line 1455 of yacc.c */ +#line 1736 "src/grammar/grammar.tab.c" + default: break; + } + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + + *++yyvsp = yyval; + + /* Now `shift' the result of the reduction. Determine what state + that goes to, based on the state we popped back to and the rule + number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTOKENS]; + + goto yynewstate; + + +/*------------------------------------. +| yyerrlab -- here on detecting error | +`------------------------------------*/ +yyerrlab: + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; +#if ! YYERROR_VERBOSE + yyerror (context, YY_("syntax error")); +#else + { + YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); + if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) + { + YYSIZE_T yyalloc = 2 * yysize; + if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) + yyalloc = YYSTACK_ALLOC_MAXIMUM; + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yyalloc); + if (yymsg) + yymsg_alloc = yyalloc; + else + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + } + } + + if (0 < yysize && yysize <= yymsg_alloc) + { + (void) yysyntax_error (yymsg, yystate, yychar); + yyerror (context, yymsg); + } + else + { + yyerror (context, YY_("syntax error")); + if (yysize != 0) + goto yyexhaustedlab; + } + } +#endif + } + + + + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + if (yychar <= YYEOF) + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } + else + { + yydestruct ("Error: discarding", + yytoken, &yylval, context); + yychar = YYEMPTY; + } + } + + /* Else will try to reuse lookahead token after shifting the error + token. */ + goto yyerrlab1; + + +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (/*CONSTCOND*/ 0) + goto yyerrorlab; + + /* Do not reclaim the symbols of the rule which action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + yystate = *yyssp; + goto yyerrlab1; + + +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ +yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ + + for (;;) + { + yyn = yypact[yystate]; + if (yyn != YYPACT_NINF) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; + + + yydestruct ("Error: popping", + yystos[yystate], yyvsp, context); + YYPOPSTACK (1); + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); + } + + *++yyvsp = yylval; + + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + + yystate = yyn; + goto yynewstate; + + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + +#if !defined(yyoverflow) || YYERROR_VERBOSE +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (context, YY_("memory exhausted")); + yyresult = 2; + /* Fall through. */ +#endif + +yyreturn: + if (yychar != YYEMPTY) + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval, context); + /* Do not reclaim the symbols of the rule which action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp, context); + YYPOPSTACK (1); + } +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif +#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); +#endif + /* Make sure YYID is used. */ + return YYID (yyresult); +} + + + +/* Line 1675 of yacc.c */ +#line 170 "src/grammar/grammar.y" + + +void yyerror(ParseContext_T* context, const char * s) +{ + fprintf(stderr,"Error: %s\n", s); +} + +std::string typeToString(unsigned int type) +{ + ostringstream oss; + switch(type) + { + case tBLOCK: oss << "BLOCK" ; break; + case tVAR: oss << "VAR" ; break; + case tCONST: oss << "CONST" ; break; + case tADD: oss << "ADD" ; break; + case tSUB: oss << "SUB" ; break; + case tMUL: oss << "MUL" ; break; + case tDIV: oss << "DIV" ; break; + case tMOD: oss << "MOD" ; break; + case tPOW: oss << "POW" ; break; + case tASSIGN: oss << "ASSIGN" ; break; + case tDECL: oss << "DECL" ; break; + case tINT: oss << "INTEGER"; break; + case tFLOAT: oss << "FLOAT" ; break; + case tID: oss << "ID" ; break; + case tSTRING: oss << "STRING" ; break; + case tIF: oss << "IF" ; break; + case tWHILE: oss << "WHILE" ; break; + default: oss << type ; break; + } + return oss.str(); +} + + diff --git a/flex-bison/mantella/src/grammar/grammar.tab.h b/flex-bison/mantella/src/grammar/grammar.tab.h new file mode 100644 index 0000000..94e63df --- /dev/null +++ b/flex-bison/mantella/src/grammar/grammar.tab.h @@ -0,0 +1,116 @@ + +/* A Bison parser, made by GNU Bison 2.4.1. */ + +/* Skeleton interface for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* "%code requires" blocks. */ + +/* Line 1676 of yacc.c */ +#line 14 "src/grammar/grammar.y" + +#include +#include "ast.h" + +string typeToString(unsigned int type); + + + +/* Line 1676 of yacc.c */ +#line 49 "src/grammar/grammar.tab.h" + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + tCONST = 258, + tVAR = 259, + tFUNC = 260, + tWHILE = 261, + tIF = 262, + tELSE = 263, + tEND = 264, + tRET = 265, + tINT = 266, + tFLOAT = 267, + tID = 268, + tSTRING = 269, + tADD = 270, + tSUB = 271, + tMUL = 272, + tDIV = 273, + tMOD = 274, + tPOW = 275, + tAND = 276, + tOR = 277, + tNOT = 278, + tEQ = 279, + tNE = 280, + tGT = 281, + tLT = 282, + tGTE = 283, + tLTE = 284, + tASSIGN = 285, + tROOT = 286, + tDECL = 287, + tBLOCK = 288, + tPARMLST = 289, + tEXPLST = 290, + tCALL = 291 + }; +#endif + + + +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef union YYSTYPE +{ + +/* Line 1676 of yacc.c */ +#line 31 "src/grammar/grammar.y" + + void* Node; + + + +/* Line 1676 of yacc.c */ +#line 108 "src/grammar/grammar.tab.h" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +#endif + + + + diff --git a/flex-bison/mantella/src/grammar/grammar.y b/flex-bison/mantella/src/grammar/grammar.y new file mode 100644 index 0000000..87e95e9 --- /dev/null +++ b/flex-bison/mantella/src/grammar/grammar.y @@ -0,0 +1,203 @@ +%{ + +#include +#include +#include +#include "parser.h" +#include "common.h" + +typedef void* yyscan_t; +#define YYLEX_PARAM context->lexinfo +void yyerror(ParseContext_T* context, const char * s); +%} + +%code requires { +#include +#include "ast.h" + +string typeToString(unsigned int type); +} + +/****************************************************************************** +* Parser Options +******************************************************************************/ +%define api.pure +%parse-param { ParseContext_T* context } + +/****************************************************************************** +* Syntax Tree Values +******************************************************************************/ +%union +{ + void* Node; +} + +%code{ +extern int yylex(YYSTYPE * yylval_param ,yyscan_t yyscanner); +} + +/****************************************************************************** +* Tokens +******************************************************************************/ +/* Keywords */ +%token tCONST tVAR tFUNC tWHILE tIF tELSE tEND tRET + +/* Literal Types */ +%token tINT +%token tFLOAT +%token tID +%token tSTRING + +/* Math Operators */ +%token tADD tSUB tMUL tDIV tMOD +%token '+' '-' '*' '/' '%' +%token tPOW + +/* Logical Operators */ +%token tAND tOR tNOT + +/* Comparison Operators */ +%token tEQ tNE tGT tLT tGTE tLTE + +/* Statement Operators */ +%token tASSIGN +%token '=' + +/* Braces and Parens */ +%token '(' ')' ',' + +/* Imaginary Node Types */ +%token tROOT tDECL tBLOCK tPARMLST tEXPLST tCALL + +/****************************************************************************** +* Rule Return Types +******************************************************************************/ +%type block +%type stmnt +%type if_stmnt +%type param_list +%type exp_list +%type function +%type exp +%type literal + +/****************************************************************************** +* Operator Precedence +******************************************************************************/ +%nonassoc tEQ tNE tGT tLT tGTE tLTE +%left '+' '-' +%left '*' '/' '%' +%left tPOW +%nonassoc tNOT +%left tAND tOR + +/****************************************************************************** +* Starting Rule +******************************************************************************/ +%start program + +%% + +program + : /* Nothing */ + | program stmnt { context->parser->processAST((AST*)$2); } + ; + +block + : stmnt { $$ = _new AST(tBLOCK, 1, $1); } + | block stmnt { $$ = $1; ((AST*)$$)->addChild((AST*)$2); } + +param_list + : tID { $$ = _new AST(tPARMLST, 1, $1); } + | param_list ',' tID { $$ = $1; ((AST*)$$)->addChild((AST*)$3); } + ; + +exp_list + : exp { $$ = _new AST(tEXPLST, 1, $1); } + | exp_list ',' exp { $$ = $1; ((AST*)$$)->addChild((AST*)$3); } + ; + +stmnt + : tID '=' exp { $$ = _new AST(tASSIGN, 2, $1, $3); } + | if_stmnt { $$ = $1; } + | function { $$ = $1; } + | exp { $$ = $1; } + ; + +if_stmnt + : tIF exp block tEND { $$ = _new AST(tIF, 2, $2, $3); } + | tIF exp block tELSE block tEND { $$ = _new AST(tIF, 3, $2, $3, $5); } + ; + +function + : tFUNC tID '(' param_list ')' block tEND { $$ = _new AST(tASSIGN, 2, $2, _new AST(tFUNC, 2, $4, $6)); } + ; + +exp + /* Mathematical Operators */ + : exp '+' exp { $$ = _new AST(tADD, 2, $1, $3); } + | exp '-' exp { $$ = _new AST(tSUB, 2, $1, $3); } + | exp '*' exp { $$ = _new AST(tMUL, 2, $1, $3); } + | exp '/' exp { $$ = _new AST(tDIV, 2, $1, $3); } + | exp '%' exp { $$ = _new AST(tMOD, 2, $1, $3); } + | exp tPOW exp { $$ = _new AST(tPOW, 2, $1, $3); } + + | exp tEQ exp { $$ = _new AST(tEQ, 2, $1, $3); } + | exp tNE exp { $$ = _new AST(tNE, 2, $1, $3); } + | exp tLT exp { $$ = _new AST(tLT, 2, $1, $3); } + | exp tGT exp { $$ = _new AST(tGT, 2, $1, $3); } + | exp tLTE exp { $$ = _new AST(tLTE, 2, $1, $3); } + | exp tGTE exp { $$ = _new AST(tGTE, 2, $1, $3); } + + | exp tAND exp { $$ = _new AST(tAND, 2, $1, $3); } + | exp tOR exp { $$ = _new AST(tOR, 2, $1, $3); } + | tNOT exp { $$ = _new AST(tNOT, 1, $2); } + + | tID '(' exp_list ')' { $$ = _new AST(tCALL, 2, $1, $3); } + | '(' exp ')' { $$ = $2; } + + /* Literal Values */ + | literal { $$ = $1; } + ; + +literal + : tINT { $$ = $1; } + | tFLOAT { $$ = $1; } + | tID { $$ = $1; } + | tSTRING { $$ = $1; } + ; + +%% + +void yyerror(ParseContext_T* context, const char * s) +{ + fprintf(stderr,"Error: %s\n", s); +} + +std::string typeToString(unsigned int type) +{ + ostringstream oss; + switch(type) + { + case tBLOCK: oss << "BLOCK" ; break; + case tVAR: oss << "VAR" ; break; + case tCONST: oss << "CONST" ; break; + case tADD: oss << "ADD" ; break; + case tSUB: oss << "SUB" ; break; + case tMUL: oss << "MUL" ; break; + case tDIV: oss << "DIV" ; break; + case tMOD: oss << "MOD" ; break; + case tPOW: oss << "POW" ; break; + case tASSIGN: oss << "ASSIGN" ; break; + case tDECL: oss << "DECL" ; break; + case tINT: oss << "INTEGER"; break; + case tFLOAT: oss << "FLOAT" ; break; + case tID: oss << "ID" ; break; + case tSTRING: oss << "STRING" ; break; + case tIF: oss << "IF" ; break; + case tWHILE: oss << "WHILE" ; break; + default: oss << type ; break; + } + return oss.str(); +} + diff --git a/flex-bison/mantella/src/lexer/lex.yy.c b/flex-bison/mantella/src/lexer/lex.yy.c new file mode 100644 index 0000000..2084a32 --- /dev/null +++ b/flex-bison/mantella/src/lexer/lex.yy.c @@ -0,0 +1,2156 @@ +#line 2 "src/lexer/lex.yy.c" + +#line 4 "src/lexer/lex.yy.c" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 35 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +#include +#include +#include +#include + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have . Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! C99 */ + +#endif /* ! FLEXINT_H */ + +#ifdef __cplusplus + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) + +#define YY_USE_CONST + +#endif /* defined (__STDC__) */ +#endif /* ! __cplusplus */ + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) + +/* An opaque pointer. */ +#ifndef YY_TYPEDEF_YY_SCANNER_T +#define YY_TYPEDEF_YY_SCANNER_T +typedef void* yyscan_t; +#endif + +/* For convenience, these vars (plus the bison vars far below) + are macros in the reentrant scanner. */ +#define yyin yyg->yyin_r +#define yyout yyg->yyout_r +#define yyextra yyg->yyextra_r +#define yyleng yyg->yyleng_r +#define yytext yyg->yytext_r +#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno) +#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column) +#define yy_flex_debug yyg->yy_flex_debug_r + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN yyg->yy_start = 1 + 2 * + +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START ((yyg->yy_start - 1) / 2) +#define YYSTATE YY_START + +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE yyrestart(yyin ,yyscanner ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else +#define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ +#endif + +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + + #define YY_LESS_LINENO(n) + +/* Return all but the first "n" matched characters back to the input stream. */ +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = yyg->yy_hold_char; \ + YY_RESTORE_YY_MORE_OFFSET \ + yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + * + * Returns the top of the stack, or NULL. + */ +#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \ + ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \ + : NULL) + +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] + +void yyrestart (FILE *input_file ,yyscan_t yyscanner ); +void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); +YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner ); +void yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); +void yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); +void yypop_buffer_state (yyscan_t yyscanner ); + +static void yyensure_buffer_stack (yyscan_t yyscanner ); +static void yy_load_buffer_state (yyscan_t yyscanner ); +static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner ); + +#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ,yyscanner) + +YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); +YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); +YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); + +void *yyalloc (yy_size_t ,yyscan_t yyscanner ); +void *yyrealloc (void *,yy_size_t ,yyscan_t yyscanner ); +void yyfree (void * ,yyscan_t yyscanner ); + +#define yy_new_buffer yy_create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + yyensure_buffer_stack (yyscanner); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! YY_CURRENT_BUFFER ){\ + yyensure_buffer_stack (yyscanner); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + +/* Begin user sect3 */ + +#define yywrap(n) 1 +#define YY_SKIP_YYWRAP + +typedef unsigned char YY_CHAR; + +typedef int yy_state_type; + +#define yytext_ptr yytext_r + +static yy_state_type yy_get_previous_state (yyscan_t yyscanner ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner); +static int yy_get_next_buffer (yyscan_t yyscanner ); +static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + yyg->yytext_ptr = yy_bp; \ + yyleng = (size_t) (yy_cp - yy_bp); \ + yyg->yy_hold_char = *yy_cp; \ + *yy_cp = '\0'; \ + yyg->yy_c_buf_p = yy_cp; + +#define YY_NUM_RULES 38 +#define YY_END_OF_BUFFER 39 +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int16_t yy_accept[84] = + { 0, + 0, 0, 39, 37, 36, 36, 29, 37, 37, 13, + 37, 14, 15, 11, 9, 16, 10, 12, 31, 22, + 17, 21, 33, 37, 33, 33, 33, 33, 33, 33, + 33, 33, 33, 33, 37, 19, 0, 34, 0, 0, + 35, 25, 18, 31, 0, 24, 20, 23, 0, 33, + 33, 33, 33, 33, 33, 5, 33, 28, 33, 33, + 33, 27, 32, 26, 33, 33, 7, 33, 30, 33, + 2, 33, 32, 33, 6, 3, 33, 33, 1, 33, + 4, 8, 0 + } ; + +static yyconst flex_int32_t yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 4, 5, 6, 1, 7, 8, 1, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 1, 1, 18, + 19, 20, 1, 1, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 1, 22, 1, 1, 23, 1, 24, 21, 25, 26, + + 27, 28, 21, 29, 30, 21, 21, 31, 21, 32, + 33, 21, 21, 34, 35, 36, 37, 38, 39, 21, + 21, 21, 1, 40, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static yyconst flex_int32_t yy_meta[41] = + { 0, + 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, + 2, 1, 1, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 1 + } ; + +static yyconst flex_int16_t yy_base[87] = + { 0, + 0, 0, 141, 142, 142, 142, 121, 36, 136, 142, + 130, 142, 142, 126, 142, 142, 119, 142, 27, 116, + 115, 114, 127, 126, 38, 40, 43, 41, 44, 46, + 42, 50, 45, 51, 90, 142, 49, 142, 126, 116, + 142, 142, 142, 42, 101, 142, 142, 142, 59, 111, + 56, 55, 48, 58, 57, 110, 60, 108, 61, 80, + 62, 142, 95, 106, 63, 81, 104, 85, 102, 83, + 101, 86, 88, 88, 99, 98, 89, 94, 97, 90, + 96, 95, 142, 124, 126, 50 + } ; + +static yyconst flex_int16_t yy_def[87] = + { 0, + 83, 1, 83, 83, 83, 83, 83, 84, 85, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 86, 83, 86, 86, 86, 86, 86, 86, + 86, 86, 86, 86, 83, 83, 84, 83, 84, 85, + 83, 83, 83, 83, 83, 83, 83, 83, 84, 86, + 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, + 86, 83, 83, 86, 86, 86, 86, 86, 86, 86, + 86, 86, 83, 86, 86, 86, 86, 86, 86, 86, + 86, 86, 0, 83, 83, 83 + } ; + +static yyconst flex_int16_t yy_nxt[183] = + { 0, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 4, 18, 19, 20, 21, 22, + 23, 4, 24, 25, 26, 23, 27, 28, 23, 29, + 23, 30, 31, 32, 23, 23, 23, 33, 34, 35, + 38, 45, 49, 44, 49, 49, 49, 49, 49, 49, + 49, 50, 83, 38, 49, 49, 45, 39, 44, 83, + 83, 83, 83, 38, 83, 83, 83, 83, 60, 51, + 39, 56, 52, 53, 54, 58, 59, 55, 57, 61, + 39, 64, 66, 67, 83, 83, 65, 83, 68, 83, + 83, 72, 83, 83, 83, 69, 70, 74, 83, 83, + + 83, 83, 83, 83, 73, 83, 83, 75, 83, 76, + 83, 73, 83, 71, 83, 83, 78, 63, 41, 77, + 81, 82, 80, 79, 37, 37, 40, 40, 83, 62, + 49, 49, 48, 47, 46, 44, 43, 42, 41, 36, + 83, 3, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83 + } ; + +static yyconst flex_int16_t yy_chk[183] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 8, 19, 25, 19, 26, 28, 31, 27, 29, 33, + 30, 86, 53, 37, 32, 34, 44, 8, 44, 52, + 51, 55, 54, 49, 57, 59, 61, 65, 33, 25, + 37, 29, 26, 27, 27, 31, 32, 28, 30, 34, + 49, 51, 53, 54, 60, 66, 52, 70, 55, 68, + 72, 61, 74, 77, 80, 57, 59, 65, 78, 82, + + 81, 79, 76, 75, 73, 71, 69, 66, 67, 68, + 64, 63, 58, 60, 56, 50, 72, 45, 40, 70, + 78, 80, 77, 74, 84, 84, 85, 85, 39, 35, + 24, 23, 22, 21, 20, 17, 14, 11, 9, 7, + 3, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83 + } ; + +/* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +#define REJECT reject_used_but_not_detected +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET +#line 1 "src/lexer/lexer.l" +/* Pattern Macros */ +#line 9 "src/lexer/lexer.l" + +/* Includes */ +#include +#include "ast.h" +#include "parser.h" +#include "grammar.tab.h" + +extern void yyerror(ParseContext_T* context, const char * s); + +#ifdef DEBUG_LEXER + #define RET_ENUM(retval) \ + printf("%s\n",#retval); \ + return retval; + #define RET_CHAR() \ + printf("%c\n", yytext[0]); \ + return yytext[0]; + #define RET_AST(type,retval) \ + printf("%s\n",#type); \ + yylval->Node = new AST( type, yytext ); \ + return type; +#else + #define RET_ENUM(retval) return retval; + #define RET_CHAR() return yytext[0]; + #define RET_AST(type) \ + yylval->Node = new AST( type, yytext ); \ + return type; +#endif + +#define YY_NO_INPUT 1 +#line 537 "src/lexer/lex.yy.c" + +#define INITIAL 0 + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +/* Holds the entire state of the reentrant scanner. */ +struct yyguts_t + { + + /* User-defined. Not touched by flex. */ + YY_EXTRA_TYPE yyextra_r; + + /* The rest are the same as the globals declared in the non-reentrant scanner. */ + FILE *yyin_r, *yyout_r; + size_t yy_buffer_stack_top; /**< index of top of stack. */ + size_t yy_buffer_stack_max; /**< capacity of stack. */ + YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ + char yy_hold_char; + int yy_n_chars; + int yyleng_r; + char *yy_c_buf_p; + int yy_init; + int yy_start; + int yy_did_buffer_switch_on_eof; + int yy_start_stack_ptr; + int yy_start_stack_depth; + int *yy_start_stack; + yy_state_type yy_last_accepting_state; + char* yy_last_accepting_cpos; + + int yylineno_r; + int yy_flex_debug_r; + + char *yytext_r; + int yy_more_flag; + int yy_more_len; + + YYSTYPE * yylval_r; + + }; /* end struct yyguts_t */ + +static int yy_init_globals (yyscan_t yyscanner ); + + /* This must go here because YYSTYPE and YYLTYPE are included + * from bison output in section 1.*/ + # define yylval yyg->yylval_r + +int yylex_init (yyscan_t* scanner); + +int yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner); + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int yylex_destroy (yyscan_t yyscanner ); + +int yyget_debug (yyscan_t yyscanner ); + +void yyset_debug (int debug_flag ,yyscan_t yyscanner ); + +YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner ); + +void yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); + +FILE *yyget_in (yyscan_t yyscanner ); + +void yyset_in (FILE * in_str ,yyscan_t yyscanner ); + +FILE *yyget_out (yyscan_t yyscanner ); + +void yyset_out (FILE * out_str ,yyscan_t yyscanner ); + +int yyget_leng (yyscan_t yyscanner ); + +char *yyget_text (yyscan_t yyscanner ); + +int yyget_lineno (yyscan_t yyscanner ); + +void yyset_lineno (int line_number ,yyscan_t yyscanner ); + +YYSTYPE * yyget_lval (yyscan_t yyscanner ); + +void yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner ); + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int yywrap (yyscan_t yyscanner ); +#else +extern int yywrap (yyscan_t yyscanner ); +#endif +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner); +#endif + +#ifndef YY_NO_INPUT + +#ifdef __cplusplus +static int yyinput (yyscan_t yyscanner ); +#else +static int input (yyscan_t yyscanner ); +#endif + +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else +#define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ +#endif + +/* Copy whatever the last rule matched to the standard output. */ +#ifndef ECHO +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + size_t n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(yyin); \ + } \ + }\ +\ + +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner) +#endif + +/* end tables serialization structures and prototypes */ + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 + +extern int yylex \ + (YYSTYPE * yylval_param ,yyscan_t yyscanner); + +#define YY_DECL int yylex \ + (YYSTYPE * yylval_param , yyscan_t yyscanner) +#endif /* !YY_DECL */ + +/* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK break; +#endif + +#define YY_RULE_SETUP \ + YY_USER_ACTION + +/** The main scanner function which does all the work. + */ +YY_DECL +{ + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + +#line 45 "src/lexer/lexer.l" + + /* Keywords */ +#line 776 "src/lexer/lex.yy.c" + + yylval = yylval_param; + + if ( !yyg->yy_init ) + { + yyg->yy_init = 1; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! yyg->yy_start ) + yyg->yy_start = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( ! YY_CURRENT_BUFFER ) { + yyensure_buffer_stack (yyscanner); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); + } + + yy_load_buffer_state(yyscanner ); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = yyg->yy_c_buf_p; + + /* Support of yytext. */ + *yy_cp = yyg->yy_hold_char; + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = yyg->yy_start; +yy_match: + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if ( yy_accept[yy_current_state] ) + { + yyg->yy_last_accepting_state = yy_current_state; + yyg->yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 84 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 142 ); + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = yyg->yy_last_accepting_cpos; + yy_current_state = yyg->yy_last_accepting_state; + yy_act = yy_accept[yy_current_state]; + } + + YY_DO_BEFORE_ACTION; + +do_action: /* This label is used only to access EOF actions. */ + + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = yyg->yy_hold_char; + yy_cp = yyg->yy_last_accepting_cpos; + yy_current_state = yyg->yy_last_accepting_state; + goto yy_find_action; + +case 1: +YY_RULE_SETUP +#line 47 "src/lexer/lexer.l" +{ RET_ENUM(tCONST); } + YY_BREAK +case 2: +YY_RULE_SETUP +#line 48 "src/lexer/lexer.l" +{ RET_ENUM(tVAR); } + YY_BREAK +case 3: +YY_RULE_SETUP +#line 49 "src/lexer/lexer.l" +{ RET_ENUM(tFUNC); } + YY_BREAK +case 4: +YY_RULE_SETUP +#line 50 "src/lexer/lexer.l" +{ RET_ENUM(tWHILE); } + YY_BREAK +case 5: +YY_RULE_SETUP +#line 51 "src/lexer/lexer.l" +{ RET_ENUM(tIF); } + YY_BREAK +case 6: +YY_RULE_SETUP +#line 52 "src/lexer/lexer.l" +{ RET_ENUM(tELSE); } + YY_BREAK +case 7: +YY_RULE_SETUP +#line 53 "src/lexer/lexer.l" +{ RET_ENUM(tEND); } + YY_BREAK +case 8: +YY_RULE_SETUP +#line 54 "src/lexer/lexer.l" +{ RET_ENUM(tRET); } + YY_BREAK +/* Math Operators*/ +case 9: +#line 58 "src/lexer/lexer.l" +case 10: +#line 59 "src/lexer/lexer.l" +case 11: +#line 60 "src/lexer/lexer.l" +case 12: +#line 61 "src/lexer/lexer.l" +case 13: +#line 62 "src/lexer/lexer.l" +case 14: +#line 64 "src/lexer/lexer.l" +case 15: +#line 65 "src/lexer/lexer.l" +case 16: +#line 66 "src/lexer/lexer.l" +case 17: +YY_RULE_SETUP +#line 67 "src/lexer/lexer.l" +{ RET_CHAR(); } + YY_BREAK +case 18: +YY_RULE_SETUP +#line 68 "src/lexer/lexer.l" +{ RET_ENUM(tPOW); } + YY_BREAK +case 19: +YY_RULE_SETUP +#line 70 "src/lexer/lexer.l" +{ RET_ENUM( tNE ); } + YY_BREAK +case 20: +YY_RULE_SETUP +#line 71 "src/lexer/lexer.l" +{ RET_ENUM( tEQ ); } + YY_BREAK +case 21: +YY_RULE_SETUP +#line 72 "src/lexer/lexer.l" +{ RET_ENUM( tGT ); } + YY_BREAK +case 22: +YY_RULE_SETUP +#line 73 "src/lexer/lexer.l" +{ RET_ENUM( tLT ); } + YY_BREAK +case 23: +YY_RULE_SETUP +#line 74 "src/lexer/lexer.l" +{ RET_ENUM( tGTE ); } + YY_BREAK +case 24: +YY_RULE_SETUP +#line 75 "src/lexer/lexer.l" +{ RET_ENUM( tLTE ); } + YY_BREAK +case 25: +#line 78 "src/lexer/lexer.l" +case 26: +YY_RULE_SETUP +#line 78 "src/lexer/lexer.l" +{ RET_ENUM( tAND ); } + YY_BREAK +case 27: +#line 80 "src/lexer/lexer.l" +case 28: +YY_RULE_SETUP +#line 80 "src/lexer/lexer.l" +{ RET_ENUM( tOR ); } + YY_BREAK +case 29: +#line 82 "src/lexer/lexer.l" +case 30: +YY_RULE_SETUP +#line 82 "src/lexer/lexer.l" +{ RET_ENUM( tNOT ); } + YY_BREAK +case 31: +YY_RULE_SETUP +#line 84 "src/lexer/lexer.l" +{ RET_AST(tINT); } + YY_BREAK +case 32: +YY_RULE_SETUP +#line 85 "src/lexer/lexer.l" +{ RET_AST(tFLOAT); } + YY_BREAK +case 33: +YY_RULE_SETUP +#line 86 "src/lexer/lexer.l" +{ RET_AST(tID); } + YY_BREAK +case 34: +/* rule 34 can match eol */ +YY_RULE_SETUP +#line 87 "src/lexer/lexer.l" +{ RET_AST(tSTRING); } + YY_BREAK +case 35: +/* rule 35 can match eol */ +YY_RULE_SETUP +#line 89 "src/lexer/lexer.l" +;/* Ignore Comments */ + YY_BREAK +case 36: +/* rule 36 can match eol */ +YY_RULE_SETUP +#line 90 "src/lexer/lexer.l" +;/* Ignore Whitespace */ + YY_BREAK +case 37: +YY_RULE_SETUP +#line 91 "src/lexer/lexer.l" +{ yyerror((ParseContext_T*)yyscanner, yytext); } + YY_BREAK +case 38: +YY_RULE_SETUP +#line 93 "src/lexer/lexer.l" +ECHO; + YY_BREAK +#line 1022 "src/lexer/lex.yy.c" +case YY_STATE_EOF(INITIAL): + yyterminate(); + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = yyg->yy_hold_char; + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( yyscanner ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner); + + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++yyg->yy_c_buf_p; + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = yyg->yy_c_buf_p; + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( yyscanner ) ) + { + case EOB_ACT_END_OF_FILE: + { + yyg->yy_did_buffer_switch_on_eof = 0; + + if ( yywrap(yyscanner ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! yyg->yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + yyg->yy_c_buf_p = + yyg->yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( yyscanner ); + + yy_cp = yyg->yy_c_buf_p; + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + yyg->yy_c_buf_p = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars]; + + yy_current_state = yy_get_previous_state( yyscanner ); + + yy_cp = yyg->yy_c_buf_p; + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ +} /* end of yylex */ + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ +static int yy_get_next_buffer (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = yyg->yytext_ptr; + register int number_to_move, i; + int ret_val; + + if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0; + + else + { + int num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + + int yy_c_buf_p_offset = + (int) (yyg->yy_c_buf_p - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + yyg->yy_n_chars, (size_t) num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + if ( yyg->yy_n_chars == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart(yyin ,yyscanner); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + } + + yyg->yy_n_chars += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; + + yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +} + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + + static yy_state_type yy_get_previous_state (yyscan_t yyscanner) +{ + register yy_state_type yy_current_state; + register char *yy_cp; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + yy_current_state = yyg->yy_start; + + for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) + { + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + yyg->yy_last_accepting_state = yy_current_state; + yyg->yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 84 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + } + + return yy_current_state; +} + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner) +{ + register int yy_is_jam; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */ + register char *yy_cp = yyg->yy_c_buf_p; + + register YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + yyg->yy_last_accepting_state = yy_current_state; + yyg->yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 84 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 83); + + return yy_is_jam ? 0 : yy_current_state; +} + +#ifndef YY_NO_INPUT +#ifdef __cplusplus + static int yyinput (yyscan_t yyscanner) +#else + static int input (yyscan_t yyscanner) +#endif + +{ + int c; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + *yyg->yy_c_buf_p = yyg->yy_hold_char; + + if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) + /* This was really a NUL. */ + *yyg->yy_c_buf_p = '\0'; + + else + { /* need more input */ + int offset = yyg->yy_c_buf_p - yyg->yytext_ptr; + ++yyg->yy_c_buf_p; + + switch ( yy_get_next_buffer( yyscanner ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + yyrestart(yyin ,yyscanner); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( yywrap(yyscanner ) ) + return EOF; + + if ( ! yyg->yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(yyscanner); +#else + return input(yyscanner); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + yyg->yy_c_buf_p = yyg->yytext_ptr + offset; + break; + } + } + } + + c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */ + *yyg->yy_c_buf_p = '\0'; /* preserve yytext */ + yyg->yy_hold_char = *++yyg->yy_c_buf_p; + + return c; +} +#endif /* ifndef YY_NO_INPUT */ + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * @param yyscanner The scanner object. + * @note This function does not reset the start condition to @c INITIAL . + */ + void yyrestart (FILE * input_file , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if ( ! YY_CURRENT_BUFFER ){ + yyensure_buffer_stack (yyscanner); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); + } + + yy_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner); + yy_load_buffer_state(yyscanner ); +} + +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * @param yyscanner The scanner object. + */ + void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* TODO. We should be able to replace this entire function body + * with + * yypop_buffer_state(); + * yypush_buffer_state(new_buffer); + */ + yyensure_buffer_stack (yyscanner); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *yyg->yy_c_buf_p = yyg->yy_hold_char; + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + yy_load_buffer_state(yyscanner ); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + yyg->yy_did_buffer_switch_on_eof = 1; +} + +static void yy_load_buffer_state (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + yyg->yy_hold_char = *yyg->yy_c_buf_p; +} + +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * @param yyscanner The scanner object. + * @return the allocated buffer state. + */ + YY_BUFFER_STATE yy_create_buffer (FILE * file, int size , yyscan_t yyscanner) +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ,yyscanner ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + yy_init_buffer(b,file ,yyscanner); + + return b; +} + +/** Destroy the buffer. + * @param b a buffer created with yy_create_buffer() + * @param yyscanner The scanner object. + */ + void yy_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if ( ! b ) + return; + + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + yyfree((void *) b->yy_ch_buf ,yyscanner ); + + yyfree((void *) b ,yyscanner ); +} + +#ifndef __cplusplus +extern int isatty (int ); +#endif /* __cplusplus */ + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a yyrestart() or at EOF. + */ + static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner) + +{ + int oerrno = errno; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + yy_flush_buffer(b ,yyscanner); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + + /* If b is the current buffer, then yy_init_buffer was _probably_ + * called from yyrestart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; + + errno = oerrno; +} + +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * @param yyscanner The scanner object. + */ + void yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == YY_CURRENT_BUFFER ) + yy_load_buffer_state(yyscanner ); +} + +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * @param yyscanner The scanner object. + */ +void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if (new_buffer == NULL) + return; + + yyensure_buffer_stack(yyscanner); + + /* This block is copied from yy_switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *yyg->yy_c_buf_p = yyg->yy_hold_char; + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + yyg->yy_buffer_stack_top++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from yy_switch_to_buffer. */ + yy_load_buffer_state(yyscanner ); + yyg->yy_did_buffer_switch_on_eof = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * @param yyscanner The scanner object. + */ +void yypop_buffer_state (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if (!YY_CURRENT_BUFFER) + return; + + yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner); + YY_CURRENT_BUFFER_LVALUE = NULL; + if (yyg->yy_buffer_stack_top > 0) + --yyg->yy_buffer_stack_top; + + if (YY_CURRENT_BUFFER) { + yy_load_buffer_state(yyscanner ); + yyg->yy_did_buffer_switch_on_eof = 1; + } +} + +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void yyensure_buffer_stack (yyscan_t yyscanner) +{ + int num_to_alloc; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if (!yyg->yy_buffer_stack) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; + yyg->yy_buffer_stack = (struct yy_buffer_state**)yyalloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + , yyscanner); + if ( ! yyg->yy_buffer_stack ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + yyg->yy_buffer_stack_max = num_to_alloc; + yyg->yy_buffer_stack_top = 0; + return; + } + + if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = yyg->yy_buffer_stack_max + grow_size; + yyg->yy_buffer_stack = (struct yy_buffer_state**)yyrealloc + (yyg->yy_buffer_stack, + num_to_alloc * sizeof(struct yy_buffer_state*) + , yyscanner); + if ( ! yyg->yy_buffer_stack ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*)); + yyg->yy_buffer_stack_max = num_to_alloc; + } +} + +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * @param yyscanner The scanner object. + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) +{ + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + yy_switch_to_buffer(b ,yyscanner ); + + return b; +} + +/** Setup the input buffer state to scan a string. The next call to yylex() will + * scan from a @e copy of @a str. + * @param yystr a NUL-terminated string to scan + * @param yyscanner The scanner object. + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * yy_scan_bytes() instead. + */ +YY_BUFFER_STATE yy_scan_string (yyconst char * yystr , yyscan_t yyscanner) +{ + + return yy_scan_bytes(yystr,strlen(yystr) ,yyscanner); +} + +/** Setup the input buffer state to scan the given bytes. The next call to yylex() will + * scan from a @e copy of @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. + * @param yyscanner The scanner object. + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner) +{ + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = _yybytes_len + 2; + buf = (char *) yyalloc(n ,yyscanner ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; + + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + + b = yy_scan_buffer(buf,n ,yyscanner); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; +} + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner) +{ + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); +} + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + yytext[yyleng] = yyg->yy_hold_char; \ + yyg->yy_c_buf_p = yytext + yyless_macro_arg; \ + yyg->yy_hold_char = *yyg->yy_c_buf_p; \ + *yyg->yy_c_buf_p = '\0'; \ + yyleng = yyless_macro_arg; \ + } \ + while ( 0 ) + +/* Accessor methods (get/set functions) to struct members. */ + +/** Get the user-defined data for this scanner. + * @param yyscanner The scanner object. + */ +YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyextra; +} + +/** Get the current line number. + * @param yyscanner The scanner object. + */ +int yyget_lineno (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if (! YY_CURRENT_BUFFER) + return 0; + + return yylineno; +} + +/** Get the current column number. + * @param yyscanner The scanner object. + */ +int yyget_column (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if (! YY_CURRENT_BUFFER) + return 0; + + return yycolumn; +} + +/** Get the input stream. + * @param yyscanner The scanner object. + */ +FILE *yyget_in (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyin; +} + +/** Get the output stream. + * @param yyscanner The scanner object. + */ +FILE *yyget_out (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyout; +} + +/** Get the length of the current token. + * @param yyscanner The scanner object. + */ +int yyget_leng (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyleng; +} + +/** Get the current token. + * @param yyscanner The scanner object. + */ + +char *yyget_text (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yytext; +} + +/** Set the user-defined data. This data is never touched by the scanner. + * @param user_defined The data to be associated with this scanner. + * @param yyscanner The scanner object. + */ +void yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyextra = user_defined ; +} + +/** Set the current line number. + * @param line_number + * @param yyscanner The scanner object. + */ +void yyset_lineno (int line_number , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* lineno is only valid if an input buffer exists. */ + if (! YY_CURRENT_BUFFER ) + yy_fatal_error( "yyset_lineno called with no buffer" , yyscanner); + + yylineno = line_number; +} + +/** Set the current column. + * @param line_number + * @param yyscanner The scanner object. + */ +void yyset_column (int column_no , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* column is only valid if an input buffer exists. */ + if (! YY_CURRENT_BUFFER ) + yy_fatal_error( "yyset_column called with no buffer" , yyscanner); + + yycolumn = column_no; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param in_str A readable stream. + * @param yyscanner The scanner object. + * @see yy_switch_to_buffer + */ +void yyset_in (FILE * in_str , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyin = in_str ; +} + +void yyset_out (FILE * out_str , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyout = out_str ; +} + +int yyget_debug (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yy_flex_debug; +} + +void yyset_debug (int bdebug , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yy_flex_debug = bdebug ; +} + +/* Accessor methods for yylval and yylloc */ + +YYSTYPE * yyget_lval (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yylval; +} + +void yyset_lval (YYSTYPE * yylval_param , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yylval = yylval_param; +} + +/* User-visible API */ + +/* yylex_init is special because it creates the scanner itself, so it is + * the ONLY reentrant function that doesn't take the scanner as the last argument. + * That's why we explicitly handle the declaration, instead of using our macros. + */ + +int yylex_init(yyscan_t* ptr_yy_globals) + +{ + if (ptr_yy_globals == NULL){ + errno = EINVAL; + return 1; + } + + *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL ); + + if (*ptr_yy_globals == NULL){ + errno = ENOMEM; + return 1; + } + + /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */ + memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); + + return yy_init_globals ( *ptr_yy_globals ); +} + +/* yylex_init_extra has the same functionality as yylex_init, but follows the + * convention of taking the scanner as the last argument. Note however, that + * this is a *pointer* to a scanner, as it will be allocated by this call (and + * is the reason, too, why this function also must handle its own declaration). + * The user defined value in the first argument will be available to yyalloc in + * the yyextra field. + */ + +int yylex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals ) + +{ + struct yyguts_t dummy_yyguts; + + yyset_extra (yy_user_defined, &dummy_yyguts); + + if (ptr_yy_globals == NULL){ + errno = EINVAL; + return 1; + } + + *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts ); + + if (*ptr_yy_globals == NULL){ + errno = ENOMEM; + return 1; + } + + /* By setting to 0xAA, we expose bugs in + yy_init_globals. Leave at 0x00 for releases. */ + memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); + + yyset_extra (yy_user_defined, *ptr_yy_globals); + + return yy_init_globals ( *ptr_yy_globals ); +} + +static int yy_init_globals (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from yylex_destroy(), so don't allocate here. + */ + + yyg->yy_buffer_stack = 0; + yyg->yy_buffer_stack_top = 0; + yyg->yy_buffer_stack_max = 0; + yyg->yy_c_buf_p = (char *) 0; + yyg->yy_init = 0; + yyg->yy_start = 0; + + yyg->yy_start_stack_ptr = 0; + yyg->yy_start_stack_depth = 0; + yyg->yy_start_stack = NULL; + +/* Defined in main.c */ +#ifdef YY_STDINIT + yyin = stdin; + yyout = stdout; +#else + yyin = (FILE *) 0; + yyout = (FILE *) 0; +#endif + + /* For future reference: Set errno on error, since we are called by + * yylex_init() + */ + return 0; +} + +/* yylex_destroy is for both reentrant and non-reentrant scanners. */ +int yylex_destroy (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner ); + YY_CURRENT_BUFFER_LVALUE = NULL; + yypop_buffer_state(yyscanner); + } + + /* Destroy the stack itself. */ + yyfree(yyg->yy_buffer_stack ,yyscanner); + yyg->yy_buffer_stack = NULL; + + /* Destroy the start condition stack. */ + yyfree(yyg->yy_start_stack ,yyscanner ); + yyg->yy_start_stack = NULL; + + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * yylex() is called, initialization will occur. */ + yy_init_globals( yyscanner); + + /* Destroy the main struct (reentrant only). */ + yyfree ( yyscanner , yyscanner ); + yyscanner = NULL; + return 0; +} + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner) +{ + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +} +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) +{ + register int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; +} +#endif + +void *yyalloc (yy_size_t size , yyscan_t yyscanner) +{ + return (void *) malloc( size ); +} + +void *yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner) +{ + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); +} + +void yyfree (void * ptr , yyscan_t yyscanner) +{ + free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ +} + +#define YYTABLES_NAME "yytables" + +#line 93 "src/lexer/lexer.l" + + + + + + diff --git a/flex-bison/mantella/src/lexer/lexer.l b/flex-bison/mantella/src/lexer/lexer.l new file mode 100644 index 0000000..a48e97d --- /dev/null +++ b/flex-bison/mantella/src/lexer/lexer.l @@ -0,0 +1,96 @@ +/* Pattern Macros */ +NUM [0-9] +AL [a-zA-Z] +HEX [a-fA-F0-9] +ALNUM [a-zA-Z0-9] +S [ \n\t] + +%{ + +/* Includes */ +#include +#include "ast.h" +#include "parser.h" +#include "grammar.tab.h" + +extern void yyerror(ParseContext_T* context, const char * s); + +#ifdef DEBUG_LEXER + #define RET_ENUM(retval) \ + printf("%s\n",#retval); \ + return retval; + #define RET_CHAR() \ + printf("%c\n", yytext[0]); \ + return yytext[0]; + #define RET_AST(type,retval) \ + printf("%s\n",#type); \ + yylval->Node = new AST( type, yytext ); \ + return type; +#else + #define RET_ENUM(retval) return retval; + #define RET_CHAR() return yytext[0]; + #define RET_AST(type) \ + yylval->Node = new AST( type, yytext ); \ + return type; +#endif + +%} + +%option reentrant +%option bison-bridge +%option noyywrap +%option nounput +%option noinput + +%% + /* Keywords */ +"const" { RET_ENUM(tCONST); } +"var" { RET_ENUM(tVAR); } +"func" { RET_ENUM(tFUNC); } +"while" { RET_ENUM(tWHILE); } +"if" { RET_ENUM(tIF); } +"else" { RET_ENUM(tELSE); } +"end" { RET_ENUM(tEND); } +"return" { RET_ENUM(tRET); } + + /* Math Operators*/ +"+" | +"-" | +"*" | +"/" | +"%" | + +"(" | +")" | +"," | + +"=" { RET_CHAR(); } +"**" { RET_ENUM(tPOW); } + +"!=" { RET_ENUM( tNE ); } +"==" { RET_ENUM( tEQ ); } +">" { RET_ENUM( tGT ); } +"<" { RET_ENUM( tLT ); } +">=" { RET_ENUM( tGTE ); } +"<=" { RET_ENUM( tLTE ); } + +"&&" | +"and" { RET_ENUM( tAND ); } +"||" | +"or" { RET_ENUM( tOR ); } +"!" | +"not" { RET_ENUM( tNOT ); } + +-?{NUM}+ { RET_AST(tINT); } +-?{NUM}+\.{NUM}{NUM}* { RET_AST(tFLOAT); } +{AL}{ALNUM}* { RET_AST(tID); } +[a-zA-Z_]?\"(\\.|[^\\"])*\" { RET_AST(tSTRING); } + +#.*\n ;/* Ignore Comments */ +{S} ;/* Ignore Whitespace */ +. { yyerror((ParseContext_T*)yyscanner, yytext); } + +%% + + + diff --git a/flex-bison/mantella/src/main.cpp b/flex-bison/mantella/src/main.cpp new file mode 100644 index 0000000..622b5b3 --- /dev/null +++ b/flex-bison/mantella/src/main.cpp @@ -0,0 +1,48 @@ +/****************************************************************************** + * Copyright (C) 2011 Michael D. Lowis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ +#include +#include +#include +#include "common.h" +#include "cl_options.h" +#include "parser.h" +#include "scheme.h" + +using namespace std; + +const string Compiler_Cmd("csc -I/c/chicken/include/chicken/ -"); +const string Interpreter_Cmd("csi"); + +int main(int argc, char** argv) +{ + U8 ret = 0; + list* files; + Parser* parser = _new Parser(_new SchemeFactory()); + CLO_ParseOptions(argc,argv); + files = CLO_GetFileList(); + + if(!files->empty()) + { + parser->parseFile( _new string(files->front()) ); + } + + delete parser; + CLO_Cleanup(); + REPORT_LEAKS(); + return (int)ret; +} + diff --git a/flex-bison/mantella/src/parser/ast/ast.cpp b/flex-bison/mantella/src/parser/ast/ast.cpp new file mode 100644 index 0000000..8683e97 --- /dev/null +++ b/flex-bison/mantella/src/parser/ast/ast.cpp @@ -0,0 +1,69 @@ +#include "ast.h" +#include +#include + +AST::AST(ASTNodeType type) +{ + node_type = type; + node_text = NULL; + node_children = new list(); +} + +AST::~AST() +{ + list::iterator it = node_children->begin(); + for(; it != node_children->end(); it++) + { + delete *(it); + } + delete node_children; + delete node_text; +} + +AST::AST(ASTNodeType type, char* text) +{ + node_type = type; + node_text = new string(text); + node_children = new list(); +} + +AST::AST(ASTNodeType type, int child_count, ...) +{ + va_list arg_list; + int i = 0; + node_type = type; + node_text = NULL; + node_children = new list(); + va_start (arg_list, child_count); + for (i = 0; i < child_count ; i++) + { + node_children->push_back( (AST*)va_arg(arg_list, AST*) ); + } + va_end(arg_list); +} + +ASTNodeType AST::type() +{ + return node_type; +} + +list* AST::children() +{ + return node_children; +} + +string AST::text() +{ + ostringstream oss; + if(node_text != NULL) + { + oss << node_text->c_str(); + } + return oss.str(); +} + +void AST::addChild(AST* node) +{ + node_children->push_back(node); +} + diff --git a/flex-bison/mantella/src/parser/ast/ast.h b/flex-bison/mantella/src/parser/ast/ast.h new file mode 100644 index 0000000..6877fdf --- /dev/null +++ b/flex-bison/mantella/src/parser/ast/ast.h @@ -0,0 +1,28 @@ +#ifndef AST_H +#define AST_H + +#include +#include +#include + +using namespace std; + +typedef unsigned int ASTNodeType; + +class AST { + protected: + ASTNodeType node_type; + string* node_text; + list* node_children; + public: + AST(ASTNodeType type); + ~AST(); + AST(ASTNodeType type, char* text); + AST(ASTNodeType type, int child_count, ...); + ASTNodeType type(); + string text(); + list* children(); + void addChild(AST* node); +}; + +#endif diff --git a/flex-bison/mantella/src/parser/parser.cpp b/flex-bison/mantella/src/parser/parser.cpp new file mode 100644 index 0000000..84eb3f0 --- /dev/null +++ b/flex-bison/mantella/src/parser/parser.cpp @@ -0,0 +1,69 @@ +/****************************************************************************** + * Copyright (C) 2001 Michael D. Lowis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ +/****************************************************************************** + * Includes and Prototypes + *****************************************************************************/ +#include +#include "parser.h" + +using namespace std; + +#ifdef PURE_PARSER +typedef void* yyscan_t; +extern int yyparse(ParseContext_T* context); +extern int yylex_init(yyscan_t* ptr_yy_globals); +extern void yyset_in (FILE* in_str , yyscan_t yyscanner); +#else +#endif + +/****************************************************************************** + * Public Functions + *****************************************************************************/ +Parser::~Parser() +{ + delete factory; +} + +void Parser::parseInput(FILE* in_file) +{ + if ( in_file != NULL ) + { + #ifdef PURE_PARSER + ParseContext_T context = { NULL, this}; + yylex_init( &(context.lexinfo) ); + yyset_in( in_file, context.lexinfo ); + yyparse( &context ); + #else + #endif + } +} + +void Parser::parseFile(string* in_file) +{ + FILE* input_file = fopen( in_file->c_str() ,"r"); + parseInput( input_file ); + delete in_file; +} + +void Parser::processAST(AST* root) +{ + Visitor* translator = factory->createVisitor(root); + translator->visit(); + cout << translator->str(); + delete translator; +} + diff --git a/flex-bison/mantella/src/parser/parser.h b/flex-bison/mantella/src/parser/parser.h new file mode 100644 index 0000000..b2e146c --- /dev/null +++ b/flex-bison/mantella/src/parser/parser.h @@ -0,0 +1,46 @@ +/****************************************************************************** + * Copyright (C) 2001 Michael D. Lowis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ +#ifndef PARSER_H +#define PARSER_H + +#include +#include "ast.h" +#include "visitor.h" + +using namespace std; + +class Parser { + protected: + VisitorFactory* factory; + private: + public: + Parser(VisitorFactory* trans_fact) : factory(trans_fact) {} + ~Parser(); + void parseFile(string* in_file); + void parseInput(FILE* in_file); + void processAST(AST* root); +}; + +#ifdef PURE_PARSER +typedef struct +{ + void* lexinfo; + Parser* parser; +} ParseContext_T; +#endif + +#endif diff --git a/flex-bison/mantella/src/parser/visitor/visitor.cpp b/flex-bison/mantella/src/parser/visitor/visitor.cpp new file mode 100644 index 0000000..71c3ccf --- /dev/null +++ b/flex-bison/mantella/src/parser/visitor/visitor.cpp @@ -0,0 +1,35 @@ +#include "visitor.h" +#include + +using namespace std; + +void Visitor::visit(AST* cur, int depth) +{ + list* children; + list::iterator it; + + // If we are just starting then use the global tree + if(cur == NULL) cur = ast; + + // Execute or pre-walk actions + if(depth == 0) beforeVisit( cur, depth ); + + // Setup our locals + children = cur->children(); + it = children->begin(); + + // Visit the tree + beforeChildren(cur,depth); + depth++; + for(; it != children->end(); it++) + { + beforeChild( *it, depth ); + visit( *it, depth ); + afterChild( *it, depth ); + } + afterChildren(cur,depth); + + // Execute our post-walk actions + if(depth == 1) afterVisit( cur, depth ); +} + diff --git a/flex-bison/mantella/src/parser/visitor/visitor.h b/flex-bison/mantella/src/parser/visitor/visitor.h new file mode 100644 index 0000000..61fdde0 --- /dev/null +++ b/flex-bison/mantella/src/parser/visitor/visitor.h @@ -0,0 +1,30 @@ +#ifndef TRANSLATOR_H +#define TRANSLATOR_H + +#include "ast.h" +#include +#include + +class Visitor { + protected: + AST* ast; + public: + Visitor(AST* tree) : ast(tree) {}; + ~Visitor() { delete ast; } + void visit(AST* cur = NULL, int depth = 0); + virtual string str() = 0; + private: + virtual void beforeVisit(AST* cur, int depth) = 0; + virtual void afterVisit(AST* cur, int depth) = 0; + virtual void beforeChildren(AST* cur, int depth) = 0; + virtual void afterChildren(AST* cur, int depth) = 0; + virtual void beforeChild(AST* cur, int depth) = 0; + virtual void afterChild(AST* cur, int depth) = 0; +}; + +class VisitorFactory { + public: + virtual Visitor* createVisitor(AST* root) = 0; +}; + +#endif diff --git a/flex-bison/mantella/src/visitors/dot/dot.cpp b/flex-bison/mantella/src/visitors/dot/dot.cpp new file mode 100644 index 0000000..d39bb62 --- /dev/null +++ b/flex-bison/mantella/src/visitors/dot/dot.cpp @@ -0,0 +1,53 @@ +#include "dot.h" +#include "grammar.tab.h" + +using namespace std; + +string DOT::str() +{ + return stream.str(); +} + +void DOT::beforeVisit(AST* cur, int depth) +{ + stream << "digraph {" << endl; +} + +void DOT::afterVisit(AST* cur, int depth) +{ + stream << "}" << endl; +} + +void DOT::beforeChildren(AST* cur, int depth) +{ + list* children = cur->children(); + stream << "\t" << current_id++ << " [label=\""; + if ( children->empty() && (!cur->text().empty())) + { + stream << cur->text() << "\"]" << endl; + } + else + { + stream << typeToString(cur->type()) << "\"]" << endl; + } + + if(!parents.empty()) + { + stream << "\t" << parents.top() << "->" << current_id-1 << endl; + } + parents.push(current_id-1); +} + +void DOT::afterChildren(AST* cur, int depth) +{ + parents.pop(); +} + +void DOT::beforeChild(AST* cur, int depth) +{ +} + +void DOT::afterChild(AST* cur, int depth) +{ +} + diff --git a/flex-bison/mantella/src/visitors/dot/dot.h b/flex-bison/mantella/src/visitors/dot/dot.h new file mode 100644 index 0000000..7ce5ce6 --- /dev/null +++ b/flex-bison/mantella/src/visitors/dot/dot.h @@ -0,0 +1,26 @@ +#ifndef DOT_H +#define DOT_H + +#include "visitor.h" +#include +#include +#include + +class DOT : public Visitor { + protected: + stack parents; + ostringstream stream; + int current_id; + public: + DOT(AST* root) : Visitor(root), current_id(0) {}; + string str(); + private: + void beforeVisit(AST* cur, int depth); + void afterVisit(AST* cur, int depth); + void beforeChildren(AST* cur, int depth); + void afterChildren(AST* cur, int depth); + void beforeChild(AST* cur, int depth); + void afterChild(AST* cur, int depth); +}; + +#endif diff --git a/flex-bison/mantella/src/visitors/llvm/llvm.cpp b/flex-bison/mantella/src/visitors/llvm/llvm.cpp new file mode 100644 index 0000000..5c2410f --- /dev/null +++ b/flex-bison/mantella/src/visitors/llvm/llvm.cpp @@ -0,0 +1,156 @@ +#include "llvm.h" +#include "grammar.tab.h" +using namespace std; + +string LLVM::str() +{ + return stream.str(); +} + +void LLVM::beforeVisit(AST* cur, int depth) +{ +} + +void LLVM::afterVisit(AST* cur, int depth) +{ +} + +void LLVM::beforeChildren(AST* cur, int depth) +{ +} + +void LLVM::afterChildren(AST* cur, int depth) +{ + cout << "stack: " << buffer.size() << endl; + switch((int)cur->type()) + { + // Attributes + case tVAR: + case tCONST: + // These are attributes used by later rules + break; + + // Arithmetic + case tADD: + case tSUB: + case tMUL: + case tDIV: + case tMOD: + case tPOW: + // Evaluate Expression + evaluateExpression(cur); + break; + + // Operators + case '=': + assignValue(cur); + break; + case tDECL: + declareValue(cur); + break; + + // Types + case tINT: + case tFLOAT: + case tID: + case tSTRING: + translateLiteral(cur); + break; + + // If we got a node we don't recognize + default: + //displayError(); + break; + } +} + +void LLVM::beforeChild(AST* cur, int depth) +{ +} + +void LLVM::afterChild(AST* cur, int depth) +{ +} + +/****************************************************************************** + * Rule Actions + *****************************************************************************/ + void LLVM::translateLiteral(AST* cur) + { + ostringstream oss; + switch(cur->type()) + { + case tINT: + oss << "i32 " << cur->text(); + break; + case tFLOAT: + oss << "float " << cur->text(); + break; + case tID: + oss << "$" << cur->text(); + break; + case tSTRING: + oss << "string c" << cur->text(); + break; + default: + //displayError(); + break; + } + cout << "pushing: " << oss.str() << endl; + buffer.push(oss.str()); + } + +void LLVM::evaluateExpression(AST* cur) +{ + string reg = getTempRegister(); + string src1 = buffer.top(); + buffer.pop(); + string src2 = buffer.top(); + buffer.pop(); + + cout << "popping 2 items for: " << typeToString(cur->type()) << endl; + stream << reg << " = " << getInstruction(cur->type()) << " "; + stream << src2 << ", " << src1 << endl; + buffer.push(reg); +} + +void LLVM::assignValue(AST* cur) +{ +} + +void LLVM::declareValue(AST* cur) +{ +} + +void LLVM::displayError(AST* cur, string msg) +{ +} + +/****************************************************************************** + * Helper Functions + *****************************************************************************/ +string LLVM::getTempRegister() +{ + ostringstream oss; + oss << "$" << temp_register++; + return oss.str(); +} + +string LLVM::getInstruction(ASTNodeType type) +{ + ostringstream oss; + switch(type) + { + case tADD: oss << "add"; break; + case tSUB: oss << "sub"; break; + case tMUL: oss << "mul"; break; + case tDIV: oss << "div"; break; + case tMOD: oss << "mod"; break; + case tPOW: oss << "pow"; break; + default: + // displayError(); + break; + } + return oss.str(); +} + diff --git a/flex-bison/mantella/src/visitors/llvm/llvm.h b/flex-bison/mantella/src/visitors/llvm/llvm.h new file mode 100644 index 0000000..2da8632 --- /dev/null +++ b/flex-bison/mantella/src/visitors/llvm/llvm.h @@ -0,0 +1,37 @@ +#ifndef LLVM_H +#define LLVM_H + +#include "visitor.h" +#include +#include + +class LLVM : public Visitor { + protected: + ostringstream stream; + stack buffer; + int temp_register; + public: + LLVM(AST* root) : Visitor(root), temp_register(0) {}; + string str(); + private: + // Visitor Actions + void beforeVisit(AST* cur, int depth); + void afterVisit(AST* cur, int depth); + void beforeChildren(AST* cur, int depth); + void afterChildren(AST* cur, int depth); + void beforeChild(AST* cur, int depth); + void afterChild(AST* cur, int depth); + + // Tree Parsing Actions + void translateLiteral(AST* cur); + void evaluateExpression(AST* cur); + void assignValue(AST* cur); + void declareValue(AST* cur); + void displayError(AST* cur, string msg); + + // Helper Methods + string getTempRegister(); + string getInstruction(ASTNodeType type); +}; + +#endif diff --git a/flex-bison/mantella/src/visitors/scheme/scheme.cpp b/flex-bison/mantella/src/visitors/scheme/scheme.cpp new file mode 100644 index 0000000..39523f7 --- /dev/null +++ b/flex-bison/mantella/src/visitors/scheme/scheme.cpp @@ -0,0 +1,98 @@ +#include "scheme.h" +#include "grammar.tab.h" + +using namespace std; + +string Scheme::str() +{ + return stream.str(); +} + +void Scheme::beforeVisit(AST* cur, int depth) +{ +} + +void Scheme::afterVisit(AST* cur, int depth) +{ + stream << endl; +} + +void Scheme::beforeChildren(AST* cur, int depth) +{ + if(isLiteral(cur)) + { + stream << cur->text(); + } + else + { + stream << "(" << typeToString(cur) << " " << cur->text(); + } +} + +void Scheme::afterChildren(AST* cur, int depth) +{ + if(!isLiteral(cur)) + { + stream << ")"; + } +} + +void Scheme::beforeChild(AST* cur, int depth) +{ + stream << endl; + for(int i = 0; i< depth; i++) + { + stream << " "; + } +} + +void Scheme::afterChild(AST* cur, int depth) +{ +} + +string Scheme::typeToString(AST* cur) +{ + ostringstream oss; + switch((int)cur->type()) + { + case tFUNC: oss << "lambda"; break; + case tWHILE: oss << "while"; break; + case tIF: oss << "if"; break; + case tADD: oss << "+"; break; + case tSUB: oss << "-"; break; + case tMUL: oss << "*"; break; + case tDIV: oss << "/"; break; + case tMOD: oss << "modulo"; break; + case tPOW: oss << "pow"; break; + case tASSIGN: oss << "define"; break; + case tBLOCK: oss << "begin"; break; + case tCALL: oss << "apply"; break; + case tEXPLST: oss << "list"; break; + + case tEQ: oss << "eq?"; break; + case tNE: oss << "!="; break; + case tLT: oss << "<"; break; + case tGT: oss << ">"; break; + case tLTE: oss << "<="; break; + case tGTE: oss << ">="; break; + case tAND: oss << "and"; break; + case tOR: oss << "or"; break; + case tNOT: oss << "not"; break; + } + return oss.str(); +} + +BOOL Scheme::isLiteral(AST* cur) +{ + BOOL ret = FALSE; + switch(cur->type()) + { + case tINT: + case tFLOAT: + case tSTRING: + case tID: ret = TRUE; break; + default: break; + } + return ret; +} + diff --git a/flex-bison/mantella/src/visitors/scheme/scheme.h b/flex-bison/mantella/src/visitors/scheme/scheme.h new file mode 100644 index 0000000..4281d11 --- /dev/null +++ b/flex-bison/mantella/src/visitors/scheme/scheme.h @@ -0,0 +1,32 @@ +#ifndef Scheme_H +#define Scheme_H + +#include +#include +#include "visitor.h" +#include "common.h" + +class Scheme : public Visitor { + protected: + ostringstream stream; + public: + Scheme(AST* root) : Visitor(root) {}; + string str(); + private: + string typeToString(); + void beforeVisit(AST* cur, int depth); + void afterVisit(AST* cur, int depth); + void beforeChildren(AST* cur, int depth); + void afterChildren(AST* cur, int depth); + void beforeChild(AST* cur, int depth); + void afterChild(AST* cur, int depth); + string typeToString(AST* cur); + BOOL isLiteral(AST* cur); +}; + +class SchemeFactory : public VisitorFactory { + public: + Visitor* createVisitor(AST* root) { return new Scheme(root); } +}; + +#endif diff --git a/flex-bison/mantella/src/visitors/sexp/sexp.cpp b/flex-bison/mantella/src/visitors/sexp/sexp.cpp new file mode 100644 index 0000000..d396e08 --- /dev/null +++ b/flex-bison/mantella/src/visitors/sexp/sexp.cpp @@ -0,0 +1,42 @@ +#include "sexp.h" +#include "grammar.tab.h" + +using namespace std; + +string SEXP::str() +{ + return stream.str(); +} + +void SEXP::beforeVisit(AST* cur, int depth) +{ +} + +void SEXP::afterVisit(AST* cur, int depth) +{ + stream << endl; +} + +void SEXP::beforeChildren(AST* cur, int depth) +{ + stream << "(" << typeToString(cur->type()) << " " << cur->text(); +} + +void SEXP::afterChildren(AST* cur, int depth) +{ + stream << ")"; +} + +void SEXP::beforeChild(AST* cur, int depth) +{ + stream << endl; + for(int i = 0; i< depth; i++) + { + stream << " "; + } +} + +void SEXP::afterChild(AST* cur, int depth) +{ +} + diff --git a/flex-bison/mantella/src/visitors/sexp/sexp.h b/flex-bison/mantella/src/visitors/sexp/sexp.h new file mode 100644 index 0000000..16cf992 --- /dev/null +++ b/flex-bison/mantella/src/visitors/sexp/sexp.h @@ -0,0 +1,23 @@ +#ifndef SEXP_H +#define SEXP_H + +#include "visitor.h" +#include +#include + +class SEXP : public Visitor { + protected: + ostringstream stream; + public: + SEXP(AST* root) : Visitor(root) {}; + string str(); + private: + void beforeVisit(AST* cur, int depth); + void afterVisit(AST* cur, int depth); + void beforeChildren(AST* cur, int depth); + void afterChildren(AST* cur, int depth); + void beforeChild(AST* cur, int depth); + void afterChild(AST* cur, int depth); +}; + +#endif diff --git a/flex-bison/mantella/submodules/cork b/flex-bison/mantella/submodules/cork new file mode 160000 index 0000000..10dcf65 --- /dev/null +++ b/flex-bison/mantella/submodules/cork @@ -0,0 +1 @@ +Subproject commit 10dcf65a3a631d9cf8e1a8987720254d1f92b641 diff --git a/flex-bison/mantella/submodules/parse-utils b/flex-bison/mantella/submodules/parse-utils new file mode 160000 index 0000000..dc01d16 --- /dev/null +++ b/flex-bison/mantella/submodules/parse-utils @@ -0,0 +1 @@ +Subproject commit dc01d1682cbb736643ed294a92338dcddcd13ddd diff --git a/flex-bison/mark1/Doxyfile b/flex-bison/mark1/Doxyfile new file mode 100644 index 0000000..1ad0495 --- /dev/null +++ b/flex-bison/mark1/Doxyfile @@ -0,0 +1,1719 @@ +# Doxyfile 1.7.3 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# http://www.gnu.org/software/libiconv for the list of possible encodings. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = Mark1 + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = 0.1 + +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer +# a quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = "Experimental Programming Language" + +# With the PROJECT_LOGO tag one can specify an logo or icon that is +# included in the documentation. The maximum height of the logo should not +# exceed 55 pixels and the maximum width should not exceed 200 pixels. +# Doxygen will copy the logo to the output directory. + +PROJECT_LOGO = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = docs + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, +# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, +# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English +# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, +# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, +# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = YES + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful if your file system +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like regular Qt-style comments +# (thus requiring an explicit @brief command for a brief description.) + +JAVADOC_AUTOBRIEF = NO + +# If the QT_AUTOBRIEF tag is set to YES then Doxygen will +# interpret the first line (until the first dot) of a Qt-style +# comment as the brief description. If set to NO, the comments +# will behave just like regular Qt-style comments (thus requiring +# an explicit \brief command for a brief description.) + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 8 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = YES + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for +# Java. For instance, namespaces will be presented as packages, qualified +# scopes will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources only. Doxygen will then generate output that is more tailored for +# Fortran. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for +# VHDL. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given extension. +# Doxygen has a built-in mapping, but you can override or extend it using this +# tag. The format is ext=language, where ext is a file extension, and language +# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C, +# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make +# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C +# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions +# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. + +EXTENSION_MAPPING = + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also makes the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. +# Doxygen will parse them like normal C++ but will assume all classes use public +# instead of private inheritance when no explicit protection keyword is present. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate getter +# and setter methods for a property. Setting this option to YES (the default) +# will make doxygen replace the get and set methods by a property in the +# documentation. This will only work if the methods are indeed getting or +# setting a simple type. If this is not the case, or you want to show the +# methods anyway, you should set this option to NO. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum +# is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically +# be useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. + +TYPEDEF_HIDES_STRUCT = NO + +# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to +# determine which symbols to keep in memory and which to flush to disk. +# When the cache is full, less often used symbols will be written to disk. +# For small to medium size projects (<1000 input files) the default value is +# probably good enough. For larger projects a too small cache size can cause +# doxygen to be busy swapping symbols to and from disk most of the time +# causing a significant performance penalty. +# If the system has enough physical memory increasing the cache will improve the +# performance by keeping more symbols in memory. Note that the value works on +# a logarithmic scale so increasing the size by one will roughly double the +# memory usage. The cache size is given by this formula: +# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, +# corresponding to a cache size of 2^16 = 65536 symbols + +SYMBOL_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = YES + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base +# name of the file that contains the anonymous namespace. By default +# anonymous namespaces are hidden. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = NO + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = YES + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen +# will list include files with double quotes in the documentation +# rather than with sharp brackets. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen +# will sort the (brief and detailed) documentation of class members so that +# constructors and destructors are listed first. If set to NO (the default) +# the constructors will appear in the respective orders defined by +# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. +# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO +# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the +# hierarchy of group names into alphabetical order. If set to NO (the default) +# the group names will appear in their defined order. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to +# do proper type resolution of all parameters of a function it will reject a +# match between the prototype and the implementation of a member function even +# if there is only one candidate or it is obvious which candidate to choose +# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen +# will still accept a match between prototype and implementation in such cases. + +STRICT_PROTO_MATCHING = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or macro consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and macros in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +# If the sources in your project are distributed over multiple directories +# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy +# in the documentation. The default is NO. + +SHOW_DIRECTORIES = NO + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. +# This will remove the Files entry from the Quick Index and from the +# Folder Tree View (if specified). The default is YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the +# Namespaces page. This will remove the Namespaces entry from the Quick Index +# and from the Folder Tree View (if specified). The default is YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command , where is the value of +# the FILE_VERSION_FILTER tag, and is the name of an input file +# provided by doxygen. Whatever the program writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. The create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. +# You can optionally specify a file name after the option, if omitted +# DoxygenLayout.xml will be used as the name of the layout file. + +LAYOUT_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# The WARN_NO_PARAMDOC option can be enabled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = src + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is +# also the default input encoding. Doxygen uses libiconv (or the iconv built +# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for +# the list of possible encodings. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh +# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py +# *.f90 *.f *.for *.vhd *.vhdl + +FILE_PATTERNS = *.c \ + *.cc \ + *.cxx \ + *.cpp \ + *.c++ \ + *.d \ + *.java \ + *.ii \ + *.ixx \ + *.ipp \ + *.i++ \ + *.inl \ + *.h \ + *.hh \ + *.hxx \ + *.hpp \ + *.h++ \ + *.idl \ + *.odl \ + *.cs \ + *.php \ + *.php3 \ + *.inc \ + *.m \ + *.mm \ + *.dox \ + *.py \ + *.f90 \ + *.f \ + *.for \ + *.vhd \ + *.vhdl + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = * + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty or if +# non of the patterns match the file name, INPUT_FILTER is applied. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) +# and it is also possible to disable source filtering for a specific pattern +# using *.ext= (so without naming a filter). This option only has effect when +# FILTER_SOURCE_FILES is enabled. + +FILTER_SOURCE_PATTERNS = + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. + +SOURCE_BROWSER = YES + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. Otherwise they will link to the documentation. + +REFERENCES_LINK_SOURCE = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = YES + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own +# stylesheet in the HTML output directory as well, or it will be erased! + +HTML_STYLESHEET = + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. +# Doxygen will adjust the colors in the stylesheet and background images +# according to this color. Hue is specified as an angle on a colorwheel, +# see http://en.wikipedia.org/wiki/Hue for more information. +# For instance the value 0 represents red, 60 is yellow, 120 is green, +# 180 is cyan, 240 is blue, 300 purple, and 360 is red again. +# The allowed range is 0 to 359. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of +# the colors in the HTML output. For a value of 0 the output will use +# grayscales only. A value of 255 will produce the most vivid colors. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to +# the luminance component of the colors in the HTML output. Values below +# 100 gradually make the output lighter, whereas values above 100 make +# the output darker. The value divided by 100 is the actual gamma applied, +# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, +# and 100 does not change the gamma. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting +# this to NO can help when comparing the output of multiple runs. + +HTML_TIMESTAMP = YES + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +HTML_ALIGN_MEMBERS = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. For this to work a browser that supports +# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox +# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). + +HTML_DYNAMIC_SECTIONS = NO + +# If the GENERATE_DOCSET tag is set to YES, additional index files +# will be generated that can be used as input for Apple's Xcode 3 +# integrated development environment, introduced with OSX 10.5 (Leopard). +# To create a documentation set, doxygen will generate a Makefile in the +# HTML output directory. Running make will produce the docset in that +# directory and running "make install" will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find +# it at startup. +# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html +# for more information. + +GENERATE_DOCSET = NO + +# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the +# feed. A documentation feed provides an umbrella under which multiple +# documentation sets from a single provider (such as a company or product suite) +# can be grouped. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that +# should uniquely identify the documentation set bundle. This should be a +# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen +# will append .docset to the name. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify +# the documentation publisher. This should be a reverse domain-name style +# string, e.g. com.mycompany.MyDocSet.documentation. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING +# is used to encode HtmlHelp index (hhk), content (hhc) and project file +# content. + +CHM_INDEX_ENCODING = + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated +# that can be used as input for Qt's qhelpgenerator to generate a +# Qt Compressed Help (.qch) of the generated HTML documentation. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can +# be used to specify the file name of the resulting .qch file. +# The path specified is relative to the HTML output folder. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#namespace + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#virtual-folders + +QHP_VIRTUAL_FOLDER = doc + +# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to +# add. For more information please see +# http://doc.trolltech.com/qthelpproject.html#custom-filters + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see +#
+# Qt Help Project / Custom Filters. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's +# filter section matches. +# +# Qt Help Project / Filter Attributes. + +QHP_SECT_FILTER_ATTRS = + +# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can +# be used to specify the location of Qt's qhelpgenerator. +# If non-empty doxygen will try to run qhelpgenerator on the generated +# .qhp file. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files +# will be generated, which together with the HTML files, form an Eclipse help +# plugin. To install this plugin and make it available under the help contents +# menu in Eclipse, the contents of the directory containing the HTML and XML +# files needs to be copied into the plugins directory of eclipse. The name of +# the directory within the plugins directory should be the same as +# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before +# the help appears. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have +# this name. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + +DISABLE_INDEX = NO + +# This tag can be used to set the number of enum values (range [0,1..20]) +# that doxygen will group on one line in the generated HTML documentation. +# Note that a value of 0 will completely suppress the enum values from +# appearing in the overview section. + +ENUM_VALUES_PER_LINE = 4 + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. +# If the tag value is set to YES, a side panel will be generated +# containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). +# Windows users are probably better off using the HTML help feature. + +GENERATE_TREEVIEW = YES + +# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, +# and Class Hierarchy pages using a tree view instead of an ordered list. + +USE_INLINE_TREES = NO + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open +# links to external symbols imported via tag files in a separate window. + +EXT_LINKS_IN_WINDOW = NO + +# Use this tag to change the font size of Latex formulas included +# as images in the HTML documentation. The default is 10. Note that +# when you change the font size after a successful doxygen run you need +# to manually remove any form_*.png images from the HTML output directory +# to force them to be regenerated. + +FORMULA_FONTSIZE = 10 + +# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# generated for formulas are transparent PNGs. Transparent PNGs are +# not supported properly for IE 6.0, but are supported on all modern browsers. +# Note that when changing this option you need to delete any form_*.png files +# in the HTML output before the changes have effect. + +FORMULA_TRANSPARENT = YES + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax +# (see http://www.mathjax.org) which uses client side Javascript for the +# rendering instead of using prerendered bitmaps. Use this if you do not +# have LaTeX installed or if you want to formulas look prettier in the HTML +# output. When enabled you also need to install MathJax separately and +# configure the path to it using the MATHJAX_RELPATH option. + +USE_MATHJAX = NO + +# When MathJax is enabled you need to specify the location relative to the +# HTML output directory using the MATHJAX_RELPATH option. The destination +# directory should contain the MathJax.js script. For instance, if the mathjax +# directory is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to the +# mathjax.org site, so you can quickly see the result without installing +# MathJax, but it is strongly recommended to install a local copy of MathJax +# before deployment. + +MATHJAX_RELPATH = http://www.mathjax.org/mathjax + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box +# for the HTML output. The underlying search engine uses javascript +# and DHTML and should work on any modern browser. Note that when using +# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets +# (GENERATE_DOCSET) there is already a search function so this one should +# typically be disabled. For large projects the javascript based search engine +# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. + +SEARCHENGINE = YES + +# When the SERVER_BASED_SEARCH tag is enabled the search engine will be +# implemented using a PHP enabled web server instead of at the web client +# using Javascript. Doxygen will generate the search PHP script and index +# file to put on the web server. The advantage of the server +# based approach is that it scales better to large projects and allows +# full text search. The disadvantages are that it is more difficult to setup +# and does not have live searching capabilities. + +SERVER_BASED_SEARCH = NO + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = NO + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. +# Note that when enabling USE_PDFLATEX this option is only used for +# generating bitmaps for formulas in the HTML output, but not in the +# Makefile that is written to the output directory. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4 + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = YES + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = YES + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +# If LATEX_SOURCE_CODE is set to YES then doxygen will include +# source code with syntax highlighting in the LaTeX output. +# Note that which sources are shown also depends on other settings +# such as SOURCE_BROWSER. + +LATEX_SOURCE_CODE = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. This is useful +# if you want to understand what is going on. On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_DEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# in the INCLUDE_PATH (see below) will be search if a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition that +# overrules the definition found in the source code. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all references to function-like macros +# that are alone on a line, have an all uppercase name, and do not end with a +# semicolon, because these will confuse the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. +# Optionally an initial location of the external documentation +# can be added for each tagfile. The format of a tag file without +# this location is as follows: +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths or +# URLs. If a location is present for each tag, the installdox tool +# does not have to be run to correct the links. +# Note that each tag file must have a unique name +# (where the name does NOT include the path) +# If a tag file is not located in the directory in which doxygen +# is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option also works with HAVE_DOT disabled, but it is recommended to +# install and use dot, since it yields more powerful graphs. + +CLASS_DIAGRAMS = NO + +# You can define message sequence charts within doxygen comments using the \msc +# command. Doxygen will then run the mscgen tool (see +# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the +# documentation. The MSCGEN_PATH tag allows you to specify the directory where +# the mscgen tool resides. If left empty the tool is assumed to be found in the +# default search path. + +MSCGEN_PATH = + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = YES + +# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is +# allowed to run in parallel. When set to 0 (the default) doxygen will +# base this on the number of processors available in the system. You can set it +# explicitly to a value larger than 0 to get control over the balance +# between CPU load and processing speed. + +DOT_NUM_THREADS = 0 + +# By default doxygen will write a font called Helvetica to the output +# directory and reference it in all dot files that doxygen generates. +# When you want a differently looking font you can specify the font name +# using DOT_FONTNAME. You need to make sure dot is able to find the font, +# which can be done by putting it in a standard location or by setting the +# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory +# containing the font. + +DOT_FONTNAME = Helvetica + +# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. +# The default size is 10pt. + +DOT_FONTSIZE = 10 + +# By default doxygen will tell dot to use the output directory to look for the +# FreeSans.ttf font (which doxygen will put there itself). If you specify a +# different font using DOT_FONTNAME you can set the path where dot +# can find it using this tag. + +DOT_FONTPATH = + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# the CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + +GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = NO + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = NO + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH and HAVE_DOT options are set to YES then +# doxygen will generate a call dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable call graphs +# for selected functions only using the \callgraph command. + +CALL_GRAPH = YES + +# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then +# doxygen will generate a caller dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable caller +# graphs for selected functions only using the \callergraph command. + +CALLER_GRAPH = YES + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will generate a graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are png, svg, gif or svg. +# If left blank png will be used. + +DOT_IMAGE_FORMAT = png + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The MSCFILE_DIRS tag can be used to specify one or more directories that +# contain msc files that are included in the documentation (see the +# \mscfile command). + +MSCFILE_DIRS = + +# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of +# nodes that will be shown in the graph. If the number of nodes in a graph +# becomes larger than this value, doxygen will truncate the graph, which is +# visualized by representing a node as a red box. Note that doxygen if the +# number of direct children of the root node in a graph is already larger than +# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note +# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. + +DOT_GRAPH_MAX_NODES = 50 + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes +# that lay further from the root node will be omitted. Note that setting this +# option to 1 or 2 may greatly reduce the computation time needed for large +# code bases. Also note that the size of a graph can be further restricted by +# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. + +MAX_DOT_GRAPH_DEPTH = 0 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, because dot on Windows does not +# seem to support this out of the box. Warning: Depending on the platform used, +# enabling this option may lead to badly anti-aliased labels on the edges of +# a graph (i.e. they become hard to read). + +DOT_TRANSPARENT = NO + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = NO + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES diff --git a/flex-bison/mark1/LICENSE b/flex-bison/mark1/LICENSE new file mode 100644 index 0000000..94a9ed0 --- /dev/null +++ b/flex-bison/mark1/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/flex-bison/mark1/README b/flex-bison/mark1/README new file mode 100644 index 0000000..a5f9105 --- /dev/null +++ b/flex-bison/mark1/README @@ -0,0 +1,25 @@ +=============================================================================== +Project Goals +=============================================================================== + +=============================================================================== +Build Requirements +=============================================================================== + +=============================================================================== +Build Instructions +=============================================================================== + +=============================================================================== +Installation Instructions +=============================================================================== + +=============================================================================== +Unit Tests +=============================================================================== + +=============================================================================== +TODO +=============================================================================== + + diff --git a/flex-bison/mark1/TODO b/flex-bison/mark1/TODO new file mode 100644 index 0000000..14d527c --- /dev/null +++ b/flex-bison/mark1/TODO @@ -0,0 +1,8 @@ +Feature and Maintenance TODO List +------------------------------------------------------------------------------- +ASM translation +Integrate Assembler +Integrate Linker + +document source +gcov ceedling plugin diff --git a/flex-bison/mark1/build/DUMMY b/flex-bison/mark1/build/DUMMY new file mode 100644 index 0000000..e69de29 diff --git a/flex-bison/mark1/docs/design/phases.dot b/flex-bison/mark1/docs/design/phases.dot new file mode 100644 index 0000000..3cd861f --- /dev/null +++ b/flex-bison/mark1/docs/design/phases.dot @@ -0,0 +1,14 @@ +digraph { + 0 [label="Phase 1: Parse"] + 1 [label="Phase 2: Translate"] + 2 [label="Phase 3: Optimize"] + 3 [label="Phase 4: Assemble"] + 4 [label="Phase 5: Link"] + + 0->1 + 0->0 + 1->2 + 2->3 + 3->4 + 3->0 +} diff --git a/flex-bison/mark1/docs/html/annotated.html b/flex-bison/mark1/docs/html/annotated.html new file mode 100644 index 0000000..5eecfee --- /dev/null +++ b/flex-bison/mark1/docs/html/annotated.html @@ -0,0 +1,123 @@ + + + + +Mark1: Data Structures + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + +
+
+ +
+
+
+ +
+
+
+

Data Structures

+
+
+
Here are the data structures with brief descriptions:
+ + + + + + + + + + + +
LinkedList
Node_TA parent node that contains an operator
OpcodeInfo_T
ParserContext_T
Value_TThe value portion of a node in the tree
ValueNode_TA child node that contains a value
yy_buffer_state
yy_trans_info
yyalloc
yyguts_t
YYSTYPE
+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/ast_8c.html b/flex-bison/mark1/docs/html/ast_8c.html new file mode 100644 index 0000000..f4b181c --- /dev/null +++ b/flex-bison/mark1/docs/html/ast_8c.html @@ -0,0 +1,364 @@ + + + + +Mark1: src/data_structures/ast/ast.c File Reference + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + +
+
+ +
+
+
+ +
+
+ +
+

src/data_structures/ast/ast.c File Reference

+
+
+
#include "ast.h"
+#include <stdlib.h>
+#include <string.h>
+
+Include dependency graph for ast.c:
+
+
+ + +
+
+

Go to the source code of this file.

+ + + + + + + + + + + + + +

+Functions

Node_TNODE (NodeType_T type, int child_count,...)
 Creates a new operator node with the specified number of children.
Node_TNODE_APPEND (Node_T *node, Node_T *child)
Node_TVAL_BOOL (char *value)
 Creates and returns a new Boolean value node.
Node_TVAL_INT (char *value)
 Creates and returns a new Integer value node.
Node_TVAL_FLOAT (char *value)
 Creates and returns a new Float value node.
Node_TVAL_STRING (char *value)
 Creates and returns a new String value node.
+

Function Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Node_T* NODE (NodeType_T type,
int child_count,
 ... 
)
+
+
+ +

Creates a new operator node with the specified number of children.

+

This is a variadic function that takes a node type, a number of children, and a variable number of NODE_T pointers representing the children of the newly created node.

+
Parameters:
+ + + + +
typeThe type of node to create.
child_countThe number of children you are passing in.
...A variable number of NODE_T pointers representing children.
+
+
+
Returns:
Returns a pointer to the newly created node.
+ +

Definition at line 29 of file ast.c.

+ +

+Here is the call graph for this function:
+
+
+ + +
+

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
Node_T* NODE_APPEND (Node_Tnode,
Node_Tchild 
)
+
+
+ +

Definition at line 55 of file ast.c.

+ +

+Here is the call graph for this function:
+
+
+ + +
+

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + +
Node_T* VAL_BOOL (char * value)
+
+
+ +

Creates and returns a new Boolean value node.

+

This function takes the input string and converts it into a boolean value. The boolean value is then stored as the contents of the newly created node. A pointer to the newly created node is then returned to the caller.

+
Parameters:
+ + +
valueString containing that data to use for this node.
+
+
+ +

Definition at line 69 of file ast.c.

+ +
+
+ +
+
+ + + + + + + + +
Node_T* VAL_FLOAT (char * value)
+
+
+ +

Creates and returns a new Float value node.

+

This function takes the input string and converts it to a float using atof(). The floating point value is then used as the value of the newly created node. A pointer to the newly created node is then returned to the caller.

+
Parameters:
+ + +
valueString containing that data to use for this node.
+
+
+ +

Definition at line 85 of file ast.c.

+ +
+
+ +
+
+ + + + + + + + +
Node_T* VAL_INT (char * value)
+
+
+ +

Creates and returns a new Integer value node.

+

This function takes the input string and converts it to a float using atoi(). The integer value is then used as the value of the newly created node. A pointer to the newly created node is then returned to the caller.

+
Parameters:
+ + +
valueString containing that data to use for this node.
+
+
+ +

Definition at line 77 of file ast.c.

+ +
+
+ +
+
+ + + + + + + + +
Node_T* VAL_STRING (char * value)
+
+
+ +

Creates and returns a new String value node.

+

This function takes the input string and uses it as the value of the newly created node. A pointer to the newly created node is then returned to the caller.

+
Parameters:
+ + +
valueString containing that data to use for this node.
+
+
+ +

Definition at line 93 of file ast.c.

+ +
+
+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/ast_8c__incl.map b/flex-bison/mark1/docs/html/ast_8c__incl.map new file mode 100644 index 0000000..b94f8d2 --- /dev/null +++ b/flex-bison/mark1/docs/html/ast_8c__incl.map @@ -0,0 +1,3 @@ + + + diff --git a/flex-bison/mark1/docs/html/ast_8c__incl.md5 b/flex-bison/mark1/docs/html/ast_8c__incl.md5 new file mode 100644 index 0000000..65fc3aa --- /dev/null +++ b/flex-bison/mark1/docs/html/ast_8c__incl.md5 @@ -0,0 +1 @@ +a365a295755374917ed1548f81498021 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/ast_8c__incl.png b/flex-bison/mark1/docs/html/ast_8c__incl.png new file mode 100644 index 0000000..afeae70 Binary files /dev/null and b/flex-bison/mark1/docs/html/ast_8c__incl.png differ diff --git a/flex-bison/mark1/docs/html/ast_8c_a05a9e42bdac458c24be5a929807cc5f4_cgraph.map b/flex-bison/mark1/docs/html/ast_8c_a05a9e42bdac458c24be5a929807cc5f4_cgraph.map new file mode 100644 index 0000000..37e0d09 --- /dev/null +++ b/flex-bison/mark1/docs/html/ast_8c_a05a9e42bdac458c24be5a929807cc5f4_cgraph.map @@ -0,0 +1,5 @@ + + + + + diff --git a/flex-bison/mark1/docs/html/ast_8c_a05a9e42bdac458c24be5a929807cc5f4_cgraph.md5 b/flex-bison/mark1/docs/html/ast_8c_a05a9e42bdac458c24be5a929807cc5f4_cgraph.md5 new file mode 100644 index 0000000..1d22966 --- /dev/null +++ b/flex-bison/mark1/docs/html/ast_8c_a05a9e42bdac458c24be5a929807cc5f4_cgraph.md5 @@ -0,0 +1 @@ +dab2715884453d262c762da9442ca7a4 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/ast_8c_a05a9e42bdac458c24be5a929807cc5f4_cgraph.png b/flex-bison/mark1/docs/html/ast_8c_a05a9e42bdac458c24be5a929807cc5f4_cgraph.png new file mode 100644 index 0000000..8a9a4bf Binary files /dev/null and b/flex-bison/mark1/docs/html/ast_8c_a05a9e42bdac458c24be5a929807cc5f4_cgraph.png differ diff --git a/flex-bison/mark1/docs/html/ast_8c_a05a9e42bdac458c24be5a929807cc5f4_icgraph.map b/flex-bison/mark1/docs/html/ast_8c_a05a9e42bdac458c24be5a929807cc5f4_icgraph.map new file mode 100644 index 0000000..679b141 --- /dev/null +++ b/flex-bison/mark1/docs/html/ast_8c_a05a9e42bdac458c24be5a929807cc5f4_icgraph.map @@ -0,0 +1,3 @@ + + + diff --git a/flex-bison/mark1/docs/html/ast_8c_a05a9e42bdac458c24be5a929807cc5f4_icgraph.md5 b/flex-bison/mark1/docs/html/ast_8c_a05a9e42bdac458c24be5a929807cc5f4_icgraph.md5 new file mode 100644 index 0000000..e2ad282 --- /dev/null +++ b/flex-bison/mark1/docs/html/ast_8c_a05a9e42bdac458c24be5a929807cc5f4_icgraph.md5 @@ -0,0 +1 @@ +52a0662b746a2a05a8522ca43df875a8 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/ast_8c_a05a9e42bdac458c24be5a929807cc5f4_icgraph.png b/flex-bison/mark1/docs/html/ast_8c_a05a9e42bdac458c24be5a929807cc5f4_icgraph.png new file mode 100644 index 0000000..734a6f8 Binary files /dev/null and b/flex-bison/mark1/docs/html/ast_8c_a05a9e42bdac458c24be5a929807cc5f4_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/ast_8c_af4c88b0b7ed5dc9ecd52854dbbf08cd5_cgraph.map b/flex-bison/mark1/docs/html/ast_8c_af4c88b0b7ed5dc9ecd52854dbbf08cd5_cgraph.map new file mode 100644 index 0000000..a03ceea --- /dev/null +++ b/flex-bison/mark1/docs/html/ast_8c_af4c88b0b7ed5dc9ecd52854dbbf08cd5_cgraph.map @@ -0,0 +1,5 @@ + + + + + diff --git a/flex-bison/mark1/docs/html/ast_8c_af4c88b0b7ed5dc9ecd52854dbbf08cd5_cgraph.md5 b/flex-bison/mark1/docs/html/ast_8c_af4c88b0b7ed5dc9ecd52854dbbf08cd5_cgraph.md5 new file mode 100644 index 0000000..88c8cc8 --- /dev/null +++ b/flex-bison/mark1/docs/html/ast_8c_af4c88b0b7ed5dc9ecd52854dbbf08cd5_cgraph.md5 @@ -0,0 +1 @@ +b66c48a4454455b983bdc67665fef6fd \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/ast_8c_af4c88b0b7ed5dc9ecd52854dbbf08cd5_cgraph.png b/flex-bison/mark1/docs/html/ast_8c_af4c88b0b7ed5dc9ecd52854dbbf08cd5_cgraph.png new file mode 100644 index 0000000..15e294e Binary files /dev/null and b/flex-bison/mark1/docs/html/ast_8c_af4c88b0b7ed5dc9ecd52854dbbf08cd5_cgraph.png differ diff --git a/flex-bison/mark1/docs/html/ast_8c_af4c88b0b7ed5dc9ecd52854dbbf08cd5_icgraph.map b/flex-bison/mark1/docs/html/ast_8c_af4c88b0b7ed5dc9ecd52854dbbf08cd5_icgraph.map new file mode 100644 index 0000000..a26df9d --- /dev/null +++ b/flex-bison/mark1/docs/html/ast_8c_af4c88b0b7ed5dc9ecd52854dbbf08cd5_icgraph.map @@ -0,0 +1,3 @@ + + + diff --git a/flex-bison/mark1/docs/html/ast_8c_af4c88b0b7ed5dc9ecd52854dbbf08cd5_icgraph.md5 b/flex-bison/mark1/docs/html/ast_8c_af4c88b0b7ed5dc9ecd52854dbbf08cd5_icgraph.md5 new file mode 100644 index 0000000..aea7c20 --- /dev/null +++ b/flex-bison/mark1/docs/html/ast_8c_af4c88b0b7ed5dc9ecd52854dbbf08cd5_icgraph.md5 @@ -0,0 +1 @@ +5a0fcd58dc286b9934554819e4c35ef6 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/ast_8c_af4c88b0b7ed5dc9ecd52854dbbf08cd5_icgraph.png b/flex-bison/mark1/docs/html/ast_8c_af4c88b0b7ed5dc9ecd52854dbbf08cd5_icgraph.png new file mode 100644 index 0000000..d1fa16e Binary files /dev/null and b/flex-bison/mark1/docs/html/ast_8c_af4c88b0b7ed5dc9ecd52854dbbf08cd5_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/ast_8c_source.html b/flex-bison/mark1/docs/html/ast_8c_source.html new file mode 100644 index 0000000..ad34ce7 --- /dev/null +++ b/flex-bison/mark1/docs/html/ast_8c_source.html @@ -0,0 +1,210 @@ + + + + +Mark1: src/data_structures/ast/ast.c Source File + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + +
+
+ +
+
+
+ +
+
+
+

src/data_structures/ast/ast.c

+
+
+Go to the documentation of this file.
00001 /******************************************************************************
+00002  * Includes and Prototypes
+00003  ******************************************************************************/
+00004 
+00005 #include "ast.h"
+00006 #include <stdlib.h>
+00007 #include <string.h>
+00008 
+00009 static Node_T* New_ASTValNode(NodeType_T type, Value_T value);
+00010 
+00011 /******************************************************************************
+00012  * Private Functions
+00013  ******************************************************************************/
+00014 
+00015 // New_ASTValNode -------------------------------------------------------------
+00016 static Node_T* New_ASTValNode(NodeType_T type, Value_T value)
+00017 {
+00018         ValueNode_T* node = (ValueNode_T*) malloc( sizeof(ValueNode_T) );
+00019         node->node_type = type;
+00020         node->value = value;
+00021         return (Node_T *) node;
+00022 }
+00023 
+00024 /******************************************************************************
+00025  * Public Functions
+00026  ******************************************************************************/
+00027 
+00028 // NODE -----------------------------------------------------------------------
+00029 Node_T* NODE(NodeType_T type, int child_count, ...)
+00030 {
+00031         va_list arg_list;
+00032         int i = 0;
+00033         Node_T* node = (Node_T*) malloc( sizeof(Node_T) );
+00034         node->node_type = type;
+00035         node->children = NULL;
+00036         
+00037         va_start (arg_list, child_count); 
+00038         for (i = 0; i < child_count ; i++)
+00039         {
+00040                 if (node->children == NULL)
+00041                 {
+00042                         node->children = LL_New( va_arg(arg_list, Node_T*) );
+00043                 }
+00044                 else
+00045                 {
+00046                         LL_Add(node->children, va_arg(arg_list, Node_T*));
+00047                 }
+00048         }
+00049         va_end(arg_list);
+00050         
+00051         return (Node_T*) node;
+00052 }
+00053 
+00054 // NODE_APPEND ----------------------------------------------------------------
+00055 Node_T* NODE_APPEND(Node_T* node, Node_T* child)
+00056 {
+00057         if (node->children == NULL)
+00058         {
+00059                 node->children = LL_New( child );
+00060         }
+00061         else
+00062         {
+00063                 LL_Add(node->children, child);
+00064         }
+00065         return node;
+00066 }
+00067 
+00068 // VAL_FLOAT ------------------------------------------------------------------
+00069 Node_T* VAL_BOOL(char* value)
+00070 {
+00071         Value_T val;
+00072         val.Boolean = (strcmp(value,"true") == 0) ? TRUE : FALSE;
+00073         return New_ASTValNode(FLOAT, val);
+00074 }
+00075 
+00076 // VAL_INT --------------------------------------------------------------------
+00077 Node_T* VAL_INT(char* value)
+00078 {
+00079         Value_T val;
+00080         val.Integer = atoi(value);
+00081         return New_ASTValNode(INT, val);
+00082 }
+00083 
+00084 // VAL_FLOAT ------------------------------------------------------------------
+00085 Node_T* VAL_FLOAT(char* value)
+00086 {
+00087         Value_T val;
+00088         val.Float = atof(value);
+00089         return New_ASTValNode(FLOAT, val);
+00090 }
+00091 
+00092 // VAL_STRING -----------------------------------------------------------------
+00093 Node_T* VAL_STRING(char* value)
+00094 {
+00095         Value_T val;
+00096         val.String = (char *) malloc( strlen( value ) );
+00097         strcpy( val.String, value );
+00098         return New_ASTValNode(STRING, val);
+00099 }
+00100 
+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/ast_8h.html b/flex-bison/mark1/docs/html/ast_8h.html new file mode 100644 index 0000000..330b5e2 --- /dev/null +++ b/flex-bison/mark1/docs/html/ast_8h.html @@ -0,0 +1,402 @@ + + + + +Mark1: src/data_structures/ast/ast.h File Reference + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + +
+
+ +
+
+
+ +
+
+ +
+

src/data_structures/ast/ast.h File Reference

+
+
+
#include <stdarg.h>
+#include "common.h"
+#include "il_opcodes.h"
+#include "linked_list.h"
+
+Include dependency graph for ast.h:
+
+
+
+
+This graph shows which files directly or indirectly include this file:
+
+
+ + +
+
+

Go to the source code of this file.

+ + + + + + + + + + + + + + + + + + + + + + + +

+Data Structures

union  Value_T
 The value portion of a node in the tree. More...
struct  Node_T
 A parent node that contains an operator. More...
struct  ValueNode_T
 A child node that contains a value. More...

+Typedefs

typedef Opcode_T NodeType_T
 Definition of the node type.

+Functions

Node_TNODE (NodeType_T type, int child_count,...)
 Creates a new operator node with the specified number of children.
Node_TNODE_APPEND (Node_T *node, Node_T *child)
Node_TVAL_BOOL (char *value)
 Creates and returns a new Boolean value node.
Node_TVAL_INT (char *value)
 Creates and returns a new Integer value node.
Node_TVAL_FLOAT (char *value)
 Creates and returns a new Float value node.
Node_TVAL_STRING (char *value)
 Creates and returns a new String value node.
+

Typedef Documentation

+ +
+
+ + + + +
typedef Opcode_T NodeType_T
+
+
+ +

Definition of the node type.

+ +

Definition at line 11 of file ast.h.

+ +
+
+

Function Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Node_T* NODE (NodeType_T type,
int child_count,
 ... 
)
+
+
+ +

Creates a new operator node with the specified number of children.

+

This is a variadic function that takes a node type, a number of children, and a variable number of NODE_T pointers representing the children of the newly created node.

+
Parameters:
+ + + + +
typeThe type of node to create.
child_countThe number of children you are passing in.
...A variable number of NODE_T pointers representing children.
+
+
+
Returns:
Returns a pointer to the newly created node.
+ +

Definition at line 29 of file ast.c.

+ +

+Here is the call graph for this function:
+
+
+ + +
+

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
Node_T* NODE_APPEND (Node_Tnode,
Node_Tchild 
)
+
+
+ +

Definition at line 55 of file ast.c.

+ +

+Here is the call graph for this function:
+
+
+ + +
+

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + +
Node_T* VAL_BOOL (char * value)
+
+
+ +

Creates and returns a new Boolean value node.

+

This function takes the input string and converts it into a boolean value. The boolean value is then stored as the contents of the newly created node. A pointer to the newly created node is then returned to the caller.

+
Parameters:
+ + +
valueString containing that data to use for this node.
+
+
+ +

Definition at line 69 of file ast.c.

+ +
+
+ +
+
+ + + + + + + + +
Node_T* VAL_FLOAT (char * value)
+
+
+ +

Creates and returns a new Float value node.

+

This function takes the input string and converts it to a float using atof(). The floating point value is then used as the value of the newly created node. A pointer to the newly created node is then returned to the caller.

+
Parameters:
+ + +
valueString containing that data to use for this node.
+
+
+ +

Definition at line 85 of file ast.c.

+ +
+
+ +
+
+ + + + + + + + +
Node_T* VAL_INT (char * value)
+
+
+ +

Creates and returns a new Integer value node.

+

This function takes the input string and converts it to a float using atoi(). The integer value is then used as the value of the newly created node. A pointer to the newly created node is then returned to the caller.

+
Parameters:
+ + +
valueString containing that data to use for this node.
+
+
+ +

Definition at line 77 of file ast.c.

+ +
+
+ +
+
+ + + + + + + + +
Node_T* VAL_STRING (char * value)
+
+
+ +

Creates and returns a new String value node.

+

This function takes the input string and uses it as the value of the newly created node. A pointer to the newly created node is then returned to the caller.

+
Parameters:
+ + +
valueString containing that data to use for this node.
+
+
+ +

Definition at line 93 of file ast.c.

+ +
+
+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/ast_8h__dep__incl.map b/flex-bison/mark1/docs/html/ast_8h__dep__incl.map new file mode 100644 index 0000000..c8c33f4 --- /dev/null +++ b/flex-bison/mark1/docs/html/ast_8h__dep__incl.map @@ -0,0 +1,5 @@ + + + + + diff --git a/flex-bison/mark1/docs/html/ast_8h__dep__incl.md5 b/flex-bison/mark1/docs/html/ast_8h__dep__incl.md5 new file mode 100644 index 0000000..0677811 --- /dev/null +++ b/flex-bison/mark1/docs/html/ast_8h__dep__incl.md5 @@ -0,0 +1 @@ +aca0bf06d3bffeba27fbd8c2b81ae1e8 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/ast_8h__dep__incl.png b/flex-bison/mark1/docs/html/ast_8h__dep__incl.png new file mode 100644 index 0000000..6edaaf8 Binary files /dev/null and b/flex-bison/mark1/docs/html/ast_8h__dep__incl.png differ diff --git a/flex-bison/mark1/docs/html/ast_8h__incl.map b/flex-bison/mark1/docs/html/ast_8h__incl.map new file mode 100644 index 0000000..8be6a30 --- /dev/null +++ b/flex-bison/mark1/docs/html/ast_8h__incl.map @@ -0,0 +1,2 @@ + + diff --git a/flex-bison/mark1/docs/html/ast_8h__incl.md5 b/flex-bison/mark1/docs/html/ast_8h__incl.md5 new file mode 100644 index 0000000..9db9375 --- /dev/null +++ b/flex-bison/mark1/docs/html/ast_8h__incl.md5 @@ -0,0 +1 @@ +816c99b430cac494f2cb806de11442cd \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/ast_8h__incl.png b/flex-bison/mark1/docs/html/ast_8h__incl.png new file mode 100644 index 0000000..4935e1c Binary files /dev/null and b/flex-bison/mark1/docs/html/ast_8h__incl.png differ diff --git a/flex-bison/mark1/docs/html/ast_8h_a05a9e42bdac458c24be5a929807cc5f4_cgraph.map b/flex-bison/mark1/docs/html/ast_8h_a05a9e42bdac458c24be5a929807cc5f4_cgraph.map new file mode 100644 index 0000000..37e0d09 --- /dev/null +++ b/flex-bison/mark1/docs/html/ast_8h_a05a9e42bdac458c24be5a929807cc5f4_cgraph.map @@ -0,0 +1,5 @@ + + + + + diff --git a/flex-bison/mark1/docs/html/ast_8h_a05a9e42bdac458c24be5a929807cc5f4_cgraph.md5 b/flex-bison/mark1/docs/html/ast_8h_a05a9e42bdac458c24be5a929807cc5f4_cgraph.md5 new file mode 100644 index 0000000..1d22966 --- /dev/null +++ b/flex-bison/mark1/docs/html/ast_8h_a05a9e42bdac458c24be5a929807cc5f4_cgraph.md5 @@ -0,0 +1 @@ +dab2715884453d262c762da9442ca7a4 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/ast_8h_a05a9e42bdac458c24be5a929807cc5f4_cgraph.png b/flex-bison/mark1/docs/html/ast_8h_a05a9e42bdac458c24be5a929807cc5f4_cgraph.png new file mode 100644 index 0000000..32d54f8 Binary files /dev/null and b/flex-bison/mark1/docs/html/ast_8h_a05a9e42bdac458c24be5a929807cc5f4_cgraph.png differ diff --git a/flex-bison/mark1/docs/html/ast_8h_a05a9e42bdac458c24be5a929807cc5f4_icgraph.map b/flex-bison/mark1/docs/html/ast_8h_a05a9e42bdac458c24be5a929807cc5f4_icgraph.map new file mode 100644 index 0000000..679b141 --- /dev/null +++ b/flex-bison/mark1/docs/html/ast_8h_a05a9e42bdac458c24be5a929807cc5f4_icgraph.map @@ -0,0 +1,3 @@ + + + diff --git a/flex-bison/mark1/docs/html/ast_8h_a05a9e42bdac458c24be5a929807cc5f4_icgraph.md5 b/flex-bison/mark1/docs/html/ast_8h_a05a9e42bdac458c24be5a929807cc5f4_icgraph.md5 new file mode 100644 index 0000000..e2ad282 --- /dev/null +++ b/flex-bison/mark1/docs/html/ast_8h_a05a9e42bdac458c24be5a929807cc5f4_icgraph.md5 @@ -0,0 +1 @@ +52a0662b746a2a05a8522ca43df875a8 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/ast_8h_a05a9e42bdac458c24be5a929807cc5f4_icgraph.png b/flex-bison/mark1/docs/html/ast_8h_a05a9e42bdac458c24be5a929807cc5f4_icgraph.png new file mode 100644 index 0000000..2f0df20 Binary files /dev/null and b/flex-bison/mark1/docs/html/ast_8h_a05a9e42bdac458c24be5a929807cc5f4_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/ast_8h_af4c88b0b7ed5dc9ecd52854dbbf08cd5_cgraph.map b/flex-bison/mark1/docs/html/ast_8h_af4c88b0b7ed5dc9ecd52854dbbf08cd5_cgraph.map new file mode 100644 index 0000000..a03ceea --- /dev/null +++ b/flex-bison/mark1/docs/html/ast_8h_af4c88b0b7ed5dc9ecd52854dbbf08cd5_cgraph.map @@ -0,0 +1,5 @@ + + + + + diff --git a/flex-bison/mark1/docs/html/ast_8h_af4c88b0b7ed5dc9ecd52854dbbf08cd5_cgraph.md5 b/flex-bison/mark1/docs/html/ast_8h_af4c88b0b7ed5dc9ecd52854dbbf08cd5_cgraph.md5 new file mode 100644 index 0000000..88c8cc8 --- /dev/null +++ b/flex-bison/mark1/docs/html/ast_8h_af4c88b0b7ed5dc9ecd52854dbbf08cd5_cgraph.md5 @@ -0,0 +1 @@ +b66c48a4454455b983bdc67665fef6fd \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/ast_8h_af4c88b0b7ed5dc9ecd52854dbbf08cd5_cgraph.png b/flex-bison/mark1/docs/html/ast_8h_af4c88b0b7ed5dc9ecd52854dbbf08cd5_cgraph.png new file mode 100644 index 0000000..d1f3ea5 Binary files /dev/null and b/flex-bison/mark1/docs/html/ast_8h_af4c88b0b7ed5dc9ecd52854dbbf08cd5_cgraph.png differ diff --git a/flex-bison/mark1/docs/html/ast_8h_af4c88b0b7ed5dc9ecd52854dbbf08cd5_icgraph.map b/flex-bison/mark1/docs/html/ast_8h_af4c88b0b7ed5dc9ecd52854dbbf08cd5_icgraph.map new file mode 100644 index 0000000..a26df9d --- /dev/null +++ b/flex-bison/mark1/docs/html/ast_8h_af4c88b0b7ed5dc9ecd52854dbbf08cd5_icgraph.map @@ -0,0 +1,3 @@ + + + diff --git a/flex-bison/mark1/docs/html/ast_8h_af4c88b0b7ed5dc9ecd52854dbbf08cd5_icgraph.md5 b/flex-bison/mark1/docs/html/ast_8h_af4c88b0b7ed5dc9ecd52854dbbf08cd5_icgraph.md5 new file mode 100644 index 0000000..aea7c20 --- /dev/null +++ b/flex-bison/mark1/docs/html/ast_8h_af4c88b0b7ed5dc9ecd52854dbbf08cd5_icgraph.md5 @@ -0,0 +1 @@ +5a0fcd58dc286b9934554819e4c35ef6 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/ast_8h_af4c88b0b7ed5dc9ecd52854dbbf08cd5_icgraph.png b/flex-bison/mark1/docs/html/ast_8h_af4c88b0b7ed5dc9ecd52854dbbf08cd5_icgraph.png new file mode 100644 index 0000000..0d52c28 Binary files /dev/null and b/flex-bison/mark1/docs/html/ast_8h_af4c88b0b7ed5dc9ecd52854dbbf08cd5_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/ast_8h_source.html b/flex-bison/mark1/docs/html/ast_8h_source.html new file mode 100644 index 0000000..d6f9bf4 --- /dev/null +++ b/flex-bison/mark1/docs/html/ast_8h_source.html @@ -0,0 +1,154 @@ + + + + +Mark1: src/data_structures/ast/ast.h Source File + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + +
+
+ +
+
+
+ +
+
+
+

src/data_structures/ast/ast.h

+
+
+Go to the documentation of this file.
00001 #ifndef AST_H
+00002 #define AST_H
+00003 
+00004 #include <stdarg.h>
+00005 #include "common.h"
+00006 #include "il_opcodes.h"
+00007 #include "linked_list.h"
+00008 
+00009 
+00011 typedef Opcode_T NodeType_T;
+00012 
+00014 typedef union
+00015 {
+00016         BOOL     Boolean;
+00017         int      Integer;
+00018         double   Float;
+00019         char*    String;
+00020 } Value_T;
+00021 
+00023 typedef struct
+00024 {
+00025         NodeType_T    node_type;
+00026         LinkedList_T* children;
+00027 } Node_T;
+00028 
+00030 typedef struct
+00031 {
+00032         NodeType_T node_type;
+00033         Value_T    value;
+00034 } ValueNode_T;
+00035 
+00049 Node_T* NODE(NodeType_T type, int child_count, ...);
+00050 
+00054 Node_T* NODE_APPEND(Node_T* node, Node_T* child);
+00055 
+00065 Node_T* VAL_BOOL(char* value);
+00066 
+00076 Node_T* VAL_INT(char* value);
+00077 
+00087 Node_T* VAL_FLOAT(char* value);
+00088 
+00098 Node_T* VAL_STRING(char* value);
+00099 
+00100 #endif
+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/ast__debug_8c.html b/flex-bison/mark1/docs/html/ast__debug_8c.html new file mode 100644 index 0000000..a96a797 --- /dev/null +++ b/flex-bison/mark1/docs/html/ast__debug_8c.html @@ -0,0 +1,320 @@ + + + + +Mark1: src/data_structures/ast/ast_debug.c File Reference + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + +
+
+ +
+
+
+ +
+
+ +
+

src/data_structures/ast/ast_debug.c File Reference

+
+
+
#include "ast_debug.h"
+#include <stdio.h>
+
+Include dependency graph for ast_debug.c:
+
+
+ + +
+
+

Go to the source code of this file.

+ + + + + + + +

+Functions

STATIC void PrintNodeDefinition (Node_T *tree)
STATIC BOOL HasChildren (Node_T *tree)
STATIC void PrintChildNode (Node_T *tree, int parent)
STATIC void PrintNode (Node_T *tree, int parent)
void PrintAST (Node_T *tree)
+

Function Documentation

+ +
+
+ + + + + + + + +
BOOL HasChildren (Node_Ttree)
+
+
+ +

Definition at line 55 of file ast_debug.c.

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + +
void PrintAST (Node_Ttree)
+
+
+ +

Definition at line 91 of file ast_debug.c.

+ +

+Here is the call graph for this function:
+
+
+ + +
+

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void PrintChildNode (Node_Ttree,
int parent 
)
+
+
+ +

Definition at line 61 of file ast_debug.c.

+ +

+Here is the call graph for this function:
+
+
+ + +
+

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void PrintNode (Node_Ttree,
int parent 
)
+
+
+ +

Definition at line 71 of file ast_debug.c.

+ +

+Here is the call graph for this function:
+
+
+ + +
+

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + +
void PrintNodeDefinition (Node_Ttree)
+
+
+ +

Definition at line 24 of file ast_debug.c.

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/ast__debug_8c__incl.map b/flex-bison/mark1/docs/html/ast__debug_8c__incl.map new file mode 100644 index 0000000..ccaaac8 --- /dev/null +++ b/flex-bison/mark1/docs/html/ast__debug_8c__incl.map @@ -0,0 +1,4 @@ + + + + diff --git a/flex-bison/mark1/docs/html/ast__debug_8c__incl.md5 b/flex-bison/mark1/docs/html/ast__debug_8c__incl.md5 new file mode 100644 index 0000000..59b5906 --- /dev/null +++ b/flex-bison/mark1/docs/html/ast__debug_8c__incl.md5 @@ -0,0 +1 @@ +74754c2fbb504a765d5c5c52726c8289 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/ast__debug_8c__incl.png b/flex-bison/mark1/docs/html/ast__debug_8c__incl.png new file mode 100644 index 0000000..49a2e29 Binary files /dev/null and b/flex-bison/mark1/docs/html/ast__debug_8c__incl.png differ diff --git a/flex-bison/mark1/docs/html/ast__debug_8c_aa779ddfcce769d0b3aea2827884cff87_icgraph.map b/flex-bison/mark1/docs/html/ast__debug_8c_aa779ddfcce769d0b3aea2827884cff87_icgraph.map new file mode 100644 index 0000000..9059d71 --- /dev/null +++ b/flex-bison/mark1/docs/html/ast__debug_8c_aa779ddfcce769d0b3aea2827884cff87_icgraph.map @@ -0,0 +1,6 @@ + + + + + + diff --git a/flex-bison/mark1/docs/html/ast__debug_8c_aa779ddfcce769d0b3aea2827884cff87_icgraph.md5 b/flex-bison/mark1/docs/html/ast__debug_8c_aa779ddfcce769d0b3aea2827884cff87_icgraph.md5 new file mode 100644 index 0000000..0407921 --- /dev/null +++ b/flex-bison/mark1/docs/html/ast__debug_8c_aa779ddfcce769d0b3aea2827884cff87_icgraph.md5 @@ -0,0 +1 @@ +07fa0cbd78cc2933aec42022e4958544 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/ast__debug_8c_aa779ddfcce769d0b3aea2827884cff87_icgraph.png b/flex-bison/mark1/docs/html/ast__debug_8c_aa779ddfcce769d0b3aea2827884cff87_icgraph.png new file mode 100644 index 0000000..1372ecc Binary files /dev/null and b/flex-bison/mark1/docs/html/ast__debug_8c_aa779ddfcce769d0b3aea2827884cff87_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/ast__debug_8c_ab0a53dd9af60c7cb774cad93f6c3ff80_cgraph.map b/flex-bison/mark1/docs/html/ast__debug_8c_ab0a53dd9af60c7cb774cad93f6c3ff80_cgraph.map new file mode 100644 index 0000000..71ae8a3 --- /dev/null +++ b/flex-bison/mark1/docs/html/ast__debug_8c_ab0a53dd9af60c7cb774cad93f6c3ff80_cgraph.map @@ -0,0 +1,6 @@ + + + + + + diff --git a/flex-bison/mark1/docs/html/ast__debug_8c_ab0a53dd9af60c7cb774cad93f6c3ff80_cgraph.md5 b/flex-bison/mark1/docs/html/ast__debug_8c_ab0a53dd9af60c7cb774cad93f6c3ff80_cgraph.md5 new file mode 100644 index 0000000..ff8610c --- /dev/null +++ b/flex-bison/mark1/docs/html/ast__debug_8c_ab0a53dd9af60c7cb774cad93f6c3ff80_cgraph.md5 @@ -0,0 +1 @@ +94b5b4790cac5c2dfbc34bade5aa9bb4 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/ast__debug_8c_ab0a53dd9af60c7cb774cad93f6c3ff80_cgraph.png b/flex-bison/mark1/docs/html/ast__debug_8c_ab0a53dd9af60c7cb774cad93f6c3ff80_cgraph.png new file mode 100644 index 0000000..976fa97 Binary files /dev/null and b/flex-bison/mark1/docs/html/ast__debug_8c_ab0a53dd9af60c7cb774cad93f6c3ff80_cgraph.png differ diff --git a/flex-bison/mark1/docs/html/ast__debug_8c_ab0a53dd9af60c7cb774cad93f6c3ff80_icgraph.map b/flex-bison/mark1/docs/html/ast__debug_8c_ab0a53dd9af60c7cb774cad93f6c3ff80_icgraph.map new file mode 100644 index 0000000..f6d2f8d --- /dev/null +++ b/flex-bison/mark1/docs/html/ast__debug_8c_ab0a53dd9af60c7cb774cad93f6c3ff80_icgraph.map @@ -0,0 +1,3 @@ + + + diff --git a/flex-bison/mark1/docs/html/ast__debug_8c_ab0a53dd9af60c7cb774cad93f6c3ff80_icgraph.md5 b/flex-bison/mark1/docs/html/ast__debug_8c_ab0a53dd9af60c7cb774cad93f6c3ff80_icgraph.md5 new file mode 100644 index 0000000..88ac45c --- /dev/null +++ b/flex-bison/mark1/docs/html/ast__debug_8c_ab0a53dd9af60c7cb774cad93f6c3ff80_icgraph.md5 @@ -0,0 +1 @@ +28a60ce78aa26365186427eff5d35ee6 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/ast__debug_8c_ab0a53dd9af60c7cb774cad93f6c3ff80_icgraph.png b/flex-bison/mark1/docs/html/ast__debug_8c_ab0a53dd9af60c7cb774cad93f6c3ff80_icgraph.png new file mode 100644 index 0000000..38bc85e Binary files /dev/null and b/flex-bison/mark1/docs/html/ast__debug_8c_ab0a53dd9af60c7cb774cad93f6c3ff80_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/ast__debug_8c_ae5cb2c5680fc441abb244186bca17ad6_icgraph.map b/flex-bison/mark1/docs/html/ast__debug_8c_ae5cb2c5680fc441abb244186bca17ad6_icgraph.map new file mode 100644 index 0000000..c050625 --- /dev/null +++ b/flex-bison/mark1/docs/html/ast__debug_8c_ae5cb2c5680fc441abb244186bca17ad6_icgraph.map @@ -0,0 +1,6 @@ + + + + + + diff --git a/flex-bison/mark1/docs/html/ast__debug_8c_ae5cb2c5680fc441abb244186bca17ad6_icgraph.md5 b/flex-bison/mark1/docs/html/ast__debug_8c_ae5cb2c5680fc441abb244186bca17ad6_icgraph.md5 new file mode 100644 index 0000000..e74cfba --- /dev/null +++ b/flex-bison/mark1/docs/html/ast__debug_8c_ae5cb2c5680fc441abb244186bca17ad6_icgraph.md5 @@ -0,0 +1 @@ +6ddcccec3e663993c367d76dbc7227e3 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/ast__debug_8c_ae5cb2c5680fc441abb244186bca17ad6_icgraph.png b/flex-bison/mark1/docs/html/ast__debug_8c_ae5cb2c5680fc441abb244186bca17ad6_icgraph.png new file mode 100644 index 0000000..eec2a86 Binary files /dev/null and b/flex-bison/mark1/docs/html/ast__debug_8c_ae5cb2c5680fc441abb244186bca17ad6_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/ast__debug_8c_ae67c4263ba486940bcbfe24b0cdbbec4_cgraph.map b/flex-bison/mark1/docs/html/ast__debug_8c_ae67c4263ba486940bcbfe24b0cdbbec4_cgraph.map new file mode 100644 index 0000000..e549a84 --- /dev/null +++ b/flex-bison/mark1/docs/html/ast__debug_8c_ae67c4263ba486940bcbfe24b0cdbbec4_cgraph.map @@ -0,0 +1,5 @@ + + + + + diff --git a/flex-bison/mark1/docs/html/ast__debug_8c_ae67c4263ba486940bcbfe24b0cdbbec4_cgraph.md5 b/flex-bison/mark1/docs/html/ast__debug_8c_ae67c4263ba486940bcbfe24b0cdbbec4_cgraph.md5 new file mode 100644 index 0000000..f777163 --- /dev/null +++ b/flex-bison/mark1/docs/html/ast__debug_8c_ae67c4263ba486940bcbfe24b0cdbbec4_cgraph.md5 @@ -0,0 +1 @@ +bc4442209d190e797f7e76aa1d0fb87a \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/ast__debug_8c_ae67c4263ba486940bcbfe24b0cdbbec4_cgraph.png b/flex-bison/mark1/docs/html/ast__debug_8c_ae67c4263ba486940bcbfe24b0cdbbec4_cgraph.png new file mode 100644 index 0000000..3afffc9 Binary files /dev/null and b/flex-bison/mark1/docs/html/ast__debug_8c_ae67c4263ba486940bcbfe24b0cdbbec4_cgraph.png differ diff --git a/flex-bison/mark1/docs/html/ast__debug_8c_ae67c4263ba486940bcbfe24b0cdbbec4_icgraph.map b/flex-bison/mark1/docs/html/ast__debug_8c_ae67c4263ba486940bcbfe24b0cdbbec4_icgraph.map new file mode 100644 index 0000000..6b4a5cc --- /dev/null +++ b/flex-bison/mark1/docs/html/ast__debug_8c_ae67c4263ba486940bcbfe24b0cdbbec4_icgraph.map @@ -0,0 +1,5 @@ + + + + + diff --git a/flex-bison/mark1/docs/html/ast__debug_8c_ae67c4263ba486940bcbfe24b0cdbbec4_icgraph.md5 b/flex-bison/mark1/docs/html/ast__debug_8c_ae67c4263ba486940bcbfe24b0cdbbec4_icgraph.md5 new file mode 100644 index 0000000..739bbc0 --- /dev/null +++ b/flex-bison/mark1/docs/html/ast__debug_8c_ae67c4263ba486940bcbfe24b0cdbbec4_icgraph.md5 @@ -0,0 +1 @@ +4872c20fe5cd13ce3f2bfb4505c0e325 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/ast__debug_8c_ae67c4263ba486940bcbfe24b0cdbbec4_icgraph.png b/flex-bison/mark1/docs/html/ast__debug_8c_ae67c4263ba486940bcbfe24b0cdbbec4_icgraph.png new file mode 100644 index 0000000..1946eeb Binary files /dev/null and b/flex-bison/mark1/docs/html/ast__debug_8c_ae67c4263ba486940bcbfe24b0cdbbec4_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/ast__debug_8c_afe88dd86d160acc9da2002171ee436ba_cgraph.map b/flex-bison/mark1/docs/html/ast__debug_8c_afe88dd86d160acc9da2002171ee436ba_cgraph.map new file mode 100644 index 0000000..c777ded --- /dev/null +++ b/flex-bison/mark1/docs/html/ast__debug_8c_afe88dd86d160acc9da2002171ee436ba_cgraph.map @@ -0,0 +1,5 @@ + + + + + diff --git a/flex-bison/mark1/docs/html/ast__debug_8c_afe88dd86d160acc9da2002171ee436ba_cgraph.md5 b/flex-bison/mark1/docs/html/ast__debug_8c_afe88dd86d160acc9da2002171ee436ba_cgraph.md5 new file mode 100644 index 0000000..141eeda --- /dev/null +++ b/flex-bison/mark1/docs/html/ast__debug_8c_afe88dd86d160acc9da2002171ee436ba_cgraph.md5 @@ -0,0 +1 @@ +8fa1a074b5d0ab299ec24bb8106d8ed7 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/ast__debug_8c_afe88dd86d160acc9da2002171ee436ba_cgraph.png b/flex-bison/mark1/docs/html/ast__debug_8c_afe88dd86d160acc9da2002171ee436ba_cgraph.png new file mode 100644 index 0000000..bddc576 Binary files /dev/null and b/flex-bison/mark1/docs/html/ast__debug_8c_afe88dd86d160acc9da2002171ee436ba_cgraph.png differ diff --git a/flex-bison/mark1/docs/html/ast__debug_8c_afe88dd86d160acc9da2002171ee436ba_icgraph.map b/flex-bison/mark1/docs/html/ast__debug_8c_afe88dd86d160acc9da2002171ee436ba_icgraph.map new file mode 100644 index 0000000..8cf16ee --- /dev/null +++ b/flex-bison/mark1/docs/html/ast__debug_8c_afe88dd86d160acc9da2002171ee436ba_icgraph.map @@ -0,0 +1,5 @@ + + + + + diff --git a/flex-bison/mark1/docs/html/ast__debug_8c_afe88dd86d160acc9da2002171ee436ba_icgraph.md5 b/flex-bison/mark1/docs/html/ast__debug_8c_afe88dd86d160acc9da2002171ee436ba_icgraph.md5 new file mode 100644 index 0000000..1a557ec --- /dev/null +++ b/flex-bison/mark1/docs/html/ast__debug_8c_afe88dd86d160acc9da2002171ee436ba_icgraph.md5 @@ -0,0 +1 @@ +38ad696cb79f4df1bb868b1309388e63 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/ast__debug_8c_afe88dd86d160acc9da2002171ee436ba_icgraph.png b/flex-bison/mark1/docs/html/ast__debug_8c_afe88dd86d160acc9da2002171ee436ba_icgraph.png new file mode 100644 index 0000000..9765950 Binary files /dev/null and b/flex-bison/mark1/docs/html/ast__debug_8c_afe88dd86d160acc9da2002171ee436ba_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/ast__debug_8c_source.html b/flex-bison/mark1/docs/html/ast__debug_8c_source.html new file mode 100644 index 0000000..85676cd --- /dev/null +++ b/flex-bison/mark1/docs/html/ast__debug_8c_source.html @@ -0,0 +1,208 @@ + + + + +Mark1: src/data_structures/ast/ast_debug.c Source File + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + +
+
+ +
+
+
+ +
+
+
+

src/data_structures/ast/ast_debug.c

+
+
+Go to the documentation of this file.
00001 /******************************************************************************
+00002  * Includes and Prototypes
+00003  ******************************************************************************/
+00004 
+00005 #include "ast_debug.h"
+00006 #include <stdio.h>
+00007 
+00008 STATIC void PrintNodeDefinition(Node_T* tree);
+00009 STATIC BOOL HasChildren(Node_T* tree);
+00010 STATIC void PrintChildNode(Node_T* tree, int parent);
+00011 STATIC void PrintNode(Node_T* tree, int parent);
+00012 
+00013 /******************************************************************************
+00014  * Globals
+00015  ******************************************************************************/
+00016 
+00017 static int Node_Count = 0;
+00018 
+00019 /******************************************************************************
+00020  * Private Functions
+00021  ******************************************************************************/
+00022 
+00023 // PrintNodeDefinition --------------------------------------------------------
+00024 void PrintNodeDefinition(Node_T* tree)
+00025 {
+00026         switch(tree->node_type)
+00027         {
+00028                 case ID:
+00029                         printf("\t%d [label=\"%s\"]\n", Node_Count, ((ValueNode_T*)tree)->value.String);
+00030                         break;
+00031 
+00032                 case BOOLEAN:
+00033                         printf("\t%d [label=\"%d\"]\n", Node_Count, ((ValueNode_T*)tree)->value.Boolean);
+00034                         break;
+00035 
+00036                 case INT:
+00037                         printf("\t%d [label=\"%d\"]\n", Node_Count, ((ValueNode_T*)tree)->value.Integer);
+00038                         break;
+00039 
+00040                 case FLOAT:
+00041                         printf("\t%d [label=\"%f\"]\n", Node_Count, ((ValueNode_T*)tree)->value.Float);
+00042                         break;
+00043 
+00044                 case STRING:
+00045                         printf("\t%d [label=\"%s\"]\n", Node_Count, ((ValueNode_T*)tree)->value.String);
+00046                         break;
+00047 
+00048                 default:
+00049                         printf("\t%d [label=\"%d\"]\n", Node_Count, tree->node_type);
+00050                         break;
+00051         }
+00052 }
+00053 
+00054 // HasChildren ----------------------------------------------------------------
+00055 BOOL HasChildren(Node_T* tree)
+00056 {
+00057         return (tree->node_type < 240) ? TRUE : FALSE;
+00058 }
+00059 
+00060 // PrintChildNode -------------------------------------------------------------
+00061 void PrintChildNode(Node_T* tree, int parent)
+00062 {
+00063         if (tree != NULL)
+00064         {
+00065                 printf("\t%d->%d\n", parent, ++Node_Count);
+00066                 PrintNode( tree, parent);
+00067         }
+00068 }
+00069 
+00070 // PrintNode ------------------------------------------------------------------
+00071 void PrintNode(Node_T* tree, int parent)
+00072 {
+00073         int current_node = Node_Count;
+00074         PrintNodeDefinition(tree);
+00075         if ( HasChildren(tree) )
+00076         {
+00077                 LinkedList_T* child = tree->children;
+00078                 while (child != NULL)
+00079                 {
+00080                         PrintChildNode( (Node_T*)child->contents, current_node );
+00081                         child = child->next;
+00082                 }
+00083         }
+00084 }
+00085 
+00086 /******************************************************************************
+00087  * Public Functions
+00088  ******************************************************************************/
+00089 
+00090 // PrintAST -------------------------------------------------------------------
+00091 void PrintAST(Node_T* tree)
+00092 {
+00093         Node_Count = 0;
+00094         printf("digraph {\n");
+00095         PrintNode(tree, 0);
+00096         printf("}\n");
+00097 }
+00098 
+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/ast__debug_8h.html b/flex-bison/mark1/docs/html/ast__debug_8h.html new file mode 100644 index 0000000..cc1caa6 --- /dev/null +++ b/flex-bison/mark1/docs/html/ast__debug_8h.html @@ -0,0 +1,172 @@ + + + + +Mark1: src/data_structures/ast/ast_debug.h File Reference + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + +
+
+ +
+
+
+ +
+
+ +
+

src/data_structures/ast/ast_debug.h File Reference

+
+
+
#include "ast.h"
+
+Include dependency graph for ast_debug.h:
+
+
+ + +
+
+This graph shows which files directly or indirectly include this file:
+
+
+ + +
+
+

Go to the source code of this file.

+ + + +

+Functions

void PrintAST (Node_T *tree)
+

Function Documentation

+ +
+
+ + + + + + + + +
void PrintAST (Node_Ttree)
+
+
+ +

Definition at line 91 of file ast_debug.c.

+ +

+Here is the call graph for this function:
+
+
+ + +
+

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/ast__debug_8h__dep__incl.map b/flex-bison/mark1/docs/html/ast__debug_8h__dep__incl.map new file mode 100644 index 0000000..fa816d3 --- /dev/null +++ b/flex-bison/mark1/docs/html/ast__debug_8h__dep__incl.map @@ -0,0 +1,3 @@ + + + diff --git a/flex-bison/mark1/docs/html/ast__debug_8h__dep__incl.md5 b/flex-bison/mark1/docs/html/ast__debug_8h__dep__incl.md5 new file mode 100644 index 0000000..f6202ac --- /dev/null +++ b/flex-bison/mark1/docs/html/ast__debug_8h__dep__incl.md5 @@ -0,0 +1 @@ +e5a1c44ebf78d0bc1a48411a44eb6f75 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/ast__debug_8h__dep__incl.png b/flex-bison/mark1/docs/html/ast__debug_8h__dep__incl.png new file mode 100644 index 0000000..d85bb34 Binary files /dev/null and b/flex-bison/mark1/docs/html/ast__debug_8h__dep__incl.png differ diff --git a/flex-bison/mark1/docs/html/ast__debug_8h__incl.map b/flex-bison/mark1/docs/html/ast__debug_8h__incl.map new file mode 100644 index 0000000..b94f8d2 --- /dev/null +++ b/flex-bison/mark1/docs/html/ast__debug_8h__incl.map @@ -0,0 +1,3 @@ + + + diff --git a/flex-bison/mark1/docs/html/ast__debug_8h__incl.md5 b/flex-bison/mark1/docs/html/ast__debug_8h__incl.md5 new file mode 100644 index 0000000..57d2177 --- /dev/null +++ b/flex-bison/mark1/docs/html/ast__debug_8h__incl.md5 @@ -0,0 +1 @@ +c73436bcd9835cd20d137ce15e34def3 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/ast__debug_8h__incl.png b/flex-bison/mark1/docs/html/ast__debug_8h__incl.png new file mode 100644 index 0000000..90288b4 Binary files /dev/null and b/flex-bison/mark1/docs/html/ast__debug_8h__incl.png differ diff --git a/flex-bison/mark1/docs/html/ast__debug_8h_ab0a53dd9af60c7cb774cad93f6c3ff80_cgraph.map b/flex-bison/mark1/docs/html/ast__debug_8h_ab0a53dd9af60c7cb774cad93f6c3ff80_cgraph.map new file mode 100644 index 0000000..71ae8a3 --- /dev/null +++ b/flex-bison/mark1/docs/html/ast__debug_8h_ab0a53dd9af60c7cb774cad93f6c3ff80_cgraph.map @@ -0,0 +1,6 @@ + + + + + + diff --git a/flex-bison/mark1/docs/html/ast__debug_8h_ab0a53dd9af60c7cb774cad93f6c3ff80_cgraph.md5 b/flex-bison/mark1/docs/html/ast__debug_8h_ab0a53dd9af60c7cb774cad93f6c3ff80_cgraph.md5 new file mode 100644 index 0000000..ff8610c --- /dev/null +++ b/flex-bison/mark1/docs/html/ast__debug_8h_ab0a53dd9af60c7cb774cad93f6c3ff80_cgraph.md5 @@ -0,0 +1 @@ +94b5b4790cac5c2dfbc34bade5aa9bb4 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/ast__debug_8h_ab0a53dd9af60c7cb774cad93f6c3ff80_cgraph.png b/flex-bison/mark1/docs/html/ast__debug_8h_ab0a53dd9af60c7cb774cad93f6c3ff80_cgraph.png new file mode 100644 index 0000000..8760c57 Binary files /dev/null and b/flex-bison/mark1/docs/html/ast__debug_8h_ab0a53dd9af60c7cb774cad93f6c3ff80_cgraph.png differ diff --git a/flex-bison/mark1/docs/html/ast__debug_8h_ab0a53dd9af60c7cb774cad93f6c3ff80_icgraph.map b/flex-bison/mark1/docs/html/ast__debug_8h_ab0a53dd9af60c7cb774cad93f6c3ff80_icgraph.map new file mode 100644 index 0000000..f6d2f8d --- /dev/null +++ b/flex-bison/mark1/docs/html/ast__debug_8h_ab0a53dd9af60c7cb774cad93f6c3ff80_icgraph.map @@ -0,0 +1,3 @@ + + + diff --git a/flex-bison/mark1/docs/html/ast__debug_8h_ab0a53dd9af60c7cb774cad93f6c3ff80_icgraph.md5 b/flex-bison/mark1/docs/html/ast__debug_8h_ab0a53dd9af60c7cb774cad93f6c3ff80_icgraph.md5 new file mode 100644 index 0000000..88ac45c --- /dev/null +++ b/flex-bison/mark1/docs/html/ast__debug_8h_ab0a53dd9af60c7cb774cad93f6c3ff80_icgraph.md5 @@ -0,0 +1 @@ +28a60ce78aa26365186427eff5d35ee6 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/ast__debug_8h_ab0a53dd9af60c7cb774cad93f6c3ff80_icgraph.png b/flex-bison/mark1/docs/html/ast__debug_8h_ab0a53dd9af60c7cb774cad93f6c3ff80_icgraph.png new file mode 100644 index 0000000..0cf3843 Binary files /dev/null and b/flex-bison/mark1/docs/html/ast__debug_8h_ab0a53dd9af60c7cb774cad93f6c3ff80_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/ast__debug_8h_source.html b/flex-bison/mark1/docs/html/ast__debug_8h_source.html new file mode 100644 index 0000000..aa78a2b --- /dev/null +++ b/flex-bison/mark1/docs/html/ast__debug_8h_source.html @@ -0,0 +1,118 @@ + + + + +Mark1: src/data_structures/ast/ast_debug.h Source File + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + +
+
+ +
+
+
+ +
+
+
+

src/data_structures/ast/ast_debug.h

+
+
+Go to the documentation of this file.
00001 #ifndef AST_DEBUG_H
+00002 #define AST_DEBUG_H
+00003 
+00004 #include "ast.h"
+00005 
+00006 void PrintAST(Node_T* tree);
+00007 
+00008 #endif
+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/bc_s.png b/flex-bison/mark1/docs/html/bc_s.png new file mode 100644 index 0000000..51ba006 Binary files /dev/null and b/flex-bison/mark1/docs/html/bc_s.png differ diff --git a/flex-bison/mark1/docs/html/cl__options_8c.html b/flex-bison/mark1/docs/html/cl__options_8c.html new file mode 100644 index 0000000..477d4b6 --- /dev/null +++ b/flex-bison/mark1/docs/html/cl__options_8c.html @@ -0,0 +1,661 @@ + + + + +Mark1: src/cl_options/cl_options.c File Reference + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + +
+
+ +
+
+
+ +
+
+ +
+

src/cl_options/cl_options.c File Reference

+
+
+
#include <getopt.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include "cl_options.h"
+#include "linked_list.h"
+
+Include dependency graph for cl_options.c:
+
+
+ + +
+
+

Go to the source code of this file.

+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+Defines

#define IDX_HELP   ((U8)0)
#define IDX_DEBUG_AST   ((U8)1)
#define IDX_DEBUG_TAC   ((U8)2)
#define IDX_DEBUG_ASM   ((U8)3)

+Functions

STATIC void HandleLongOption (U8 opt_index)
STATIC void HandleShortOption (U8 opt)
STATIC void BuildFileList (U32 argc, String *argv)
void CLO_ParseOptions (U32 argc, String *argv)
LinkedList_TCLO_GetFileList (void)
void CLO_SetDebugAST (BOOL enabled)
BOOL CLO_GetDebugAST ()
void CLO_SetDebugTAC (BOOL enabled)
BOOL CLO_GetDebugTAC ()
void CLO_SetDebugASM (BOOL enabled)
BOOL CLO_GetDebugASM ()

+Variables

const String Help_String = " --debug-asm Enables debug printing of the generated assembly code.\n"
const String Short_Options = ""
struct option Long_Options []
STATIC BOOL DebugAST = FALSE
STATIC BOOL DebugTAC = FALSE
STATIC BOOL DebugASM = FALSE
STATIC LinkedList_TFileList = NULL
+

Define Documentation

+ +
+
+ + + + +
#define IDX_DEBUG_ASM   ((U8)3)
+
+
+ +

Definition at line 40 of file cl_options.c.

+ +
+
+ +
+
+ + + + +
#define IDX_DEBUG_AST   ((U8)1)
+
+
+ +

Definition at line 38 of file cl_options.c.

+ +
+
+ +
+
+ + + + +
#define IDX_DEBUG_TAC   ((U8)2)
+
+
+ +

Definition at line 39 of file cl_options.c.

+ +
+
+ +
+
+ + + + +
#define IDX_HELP   ((U8)0)
+
+
+ +

Definition at line 37 of file cl_options.c.

+ +
+
+

Function Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + +
void BuildFileList (U32 argc,
Stringargv 
)
+
+
+ +

Definition at line 82 of file cl_options.c.

+ +

+Here is the call graph for this function:
+
+
+ + +
+

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + +
BOOL CLO_GetDebugASM (void )
+
+
+ +

Definition at line 158 of file cl_options.c.

+ +
+
+ +
+
+ + + + + + + + +
BOOL CLO_GetDebugAST (void )
+
+
+ +

Definition at line 134 of file cl_options.c.

+ +
+
+ +
+
+ + + + + + + + +
BOOL CLO_GetDebugTAC (void )
+
+
+ +

Definition at line 146 of file cl_options.c.

+ +
+
+ +
+
+ + + + + + + + +
LinkedList_T* CLO_GetFileList (void )
+
+
+ +

Definition at line 124 of file cl_options.c.

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void CLO_ParseOptions (U32 argc,
Stringargv 
)
+
+
+ +

Definition at line 100 of file cl_options.c.

+ +

+Here is the call graph for this function:
+
+
+ + +
+

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + +
void CLO_SetDebugASM (BOOL enabled)
+
+
+ +

Definition at line 152 of file cl_options.c.

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + +
void CLO_SetDebugAST (BOOL enabled)
+
+
+ +

Definition at line 129 of file cl_options.c.

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + +
void CLO_SetDebugTAC (BOOL enabled)
+
+
+ +

Definition at line 140 of file cl_options.c.

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + +
void HandleLongOption (U8 opt_index)
+
+
+ +

Definition at line 51 of file cl_options.c.

+ +

+Here is the call graph for this function:
+
+
+ + +
+

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + +
void HandleShortOption (U8 opt)
+
+
+ +

Definition at line 73 of file cl_options.c.

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+

Variable Documentation

+ +
+
+ + + + +
STATIC BOOL DebugASM = FALSE
+
+
+ +

Definition at line 45 of file cl_options.c.

+ +
+
+ +
+
+ + + + +
STATIC BOOL DebugAST = FALSE
+
+
+ +

Definition at line 43 of file cl_options.c.

+ +
+
+ +
+
+ + + + +
STATIC BOOL DebugTAC = FALSE
+
+
+ +

Definition at line 44 of file cl_options.c.

+ +
+
+ +
+
+ + + + +
STATIC LinkedList_T* FileList = NULL
+
+
+ +

Definition at line 46 of file cl_options.c.

+ +
+
+ +
+
+ + + + +
const String Help_String = " --debug-asm Enables debug printing of the generated assembly code.\n"
+
+
+ +

Definition at line 17 of file cl_options.c.

+ +
+
+ +
+
+ + + + +
struct option Long_Options[]
+
+
+Initial value:
 {
+        {"help",      0, 0, 0},
+        {"debug-ast", 0, 0, 0},
+        {"debug-tac", 0, 0, 0},
+        {"debug-asm", 0, 0, 0},
+        {0,0,0,0}
+}
+
+

Definition at line 30 of file cl_options.c.

+ +
+
+ +
+
+ + + + +
const String Short_Options = ""
+
+
+ +

Definition at line 27 of file cl_options.c.

+ +
+
+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/cl__options_8c__incl.map b/flex-bison/mark1/docs/html/cl__options_8c__incl.map new file mode 100644 index 0000000..ac1a506 --- /dev/null +++ b/flex-bison/mark1/docs/html/cl__options_8c__incl.map @@ -0,0 +1,3 @@ + + + diff --git a/flex-bison/mark1/docs/html/cl__options_8c__incl.md5 b/flex-bison/mark1/docs/html/cl__options_8c__incl.md5 new file mode 100644 index 0000000..4c37379 --- /dev/null +++ b/flex-bison/mark1/docs/html/cl__options_8c__incl.md5 @@ -0,0 +1 @@ +68f259bcd6329ce96bd89dab0901a347 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/cl__options_8c__incl.png b/flex-bison/mark1/docs/html/cl__options_8c__incl.png new file mode 100644 index 0000000..57b1e32 Binary files /dev/null and b/flex-bison/mark1/docs/html/cl__options_8c__incl.png differ diff --git a/flex-bison/mark1/docs/html/cl__options_8c_a05b2fb76129a951433a33d45df145365_cgraph.map b/flex-bison/mark1/docs/html/cl__options_8c_a05b2fb76129a951433a33d45df145365_cgraph.map new file mode 100644 index 0000000..60ee081 --- /dev/null +++ b/flex-bison/mark1/docs/html/cl__options_8c_a05b2fb76129a951433a33d45df145365_cgraph.map @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/flex-bison/mark1/docs/html/cl__options_8c_a05b2fb76129a951433a33d45df145365_cgraph.md5 b/flex-bison/mark1/docs/html/cl__options_8c_a05b2fb76129a951433a33d45df145365_cgraph.md5 new file mode 100644 index 0000000..749aa5b --- /dev/null +++ b/flex-bison/mark1/docs/html/cl__options_8c_a05b2fb76129a951433a33d45df145365_cgraph.md5 @@ -0,0 +1 @@ +262c50818b9ff233bc0a1fabc94c9e94 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/cl__options_8c_a05b2fb76129a951433a33d45df145365_cgraph.png b/flex-bison/mark1/docs/html/cl__options_8c_a05b2fb76129a951433a33d45df145365_cgraph.png new file mode 100644 index 0000000..ebce57a Binary files /dev/null and b/flex-bison/mark1/docs/html/cl__options_8c_a05b2fb76129a951433a33d45df145365_cgraph.png differ diff --git a/flex-bison/mark1/docs/html/cl__options_8c_a05b2fb76129a951433a33d45df145365_icgraph.map b/flex-bison/mark1/docs/html/cl__options_8c_a05b2fb76129a951433a33d45df145365_icgraph.map new file mode 100644 index 0000000..1622867 --- /dev/null +++ b/flex-bison/mark1/docs/html/cl__options_8c_a05b2fb76129a951433a33d45df145365_icgraph.map @@ -0,0 +1,3 @@ + + + diff --git a/flex-bison/mark1/docs/html/cl__options_8c_a05b2fb76129a951433a33d45df145365_icgraph.md5 b/flex-bison/mark1/docs/html/cl__options_8c_a05b2fb76129a951433a33d45df145365_icgraph.md5 new file mode 100644 index 0000000..4450742 --- /dev/null +++ b/flex-bison/mark1/docs/html/cl__options_8c_a05b2fb76129a951433a33d45df145365_icgraph.md5 @@ -0,0 +1 @@ +f7e1ed72a184e06eb6c83852a19ea5b5 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/cl__options_8c_a05b2fb76129a951433a33d45df145365_icgraph.png b/flex-bison/mark1/docs/html/cl__options_8c_a05b2fb76129a951433a33d45df145365_icgraph.png new file mode 100644 index 0000000..5333acc Binary files /dev/null and b/flex-bison/mark1/docs/html/cl__options_8c_a05b2fb76129a951433a33d45df145365_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/cl__options_8c_a21925a7a138f516516d8e2f322a6ee51_icgraph.map b/flex-bison/mark1/docs/html/cl__options_8c_a21925a7a138f516516d8e2f322a6ee51_icgraph.map new file mode 100644 index 0000000..67cec3d --- /dev/null +++ b/flex-bison/mark1/docs/html/cl__options_8c_a21925a7a138f516516d8e2f322a6ee51_icgraph.map @@ -0,0 +1,5 @@ + + + + + diff --git a/flex-bison/mark1/docs/html/cl__options_8c_a21925a7a138f516516d8e2f322a6ee51_icgraph.md5 b/flex-bison/mark1/docs/html/cl__options_8c_a21925a7a138f516516d8e2f322a6ee51_icgraph.md5 new file mode 100644 index 0000000..3867180 --- /dev/null +++ b/flex-bison/mark1/docs/html/cl__options_8c_a21925a7a138f516516d8e2f322a6ee51_icgraph.md5 @@ -0,0 +1 @@ +641c65eab39669630d32cad49d02bbbf \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/cl__options_8c_a21925a7a138f516516d8e2f322a6ee51_icgraph.png b/flex-bison/mark1/docs/html/cl__options_8c_a21925a7a138f516516d8e2f322a6ee51_icgraph.png new file mode 100644 index 0000000..bdf582e Binary files /dev/null and b/flex-bison/mark1/docs/html/cl__options_8c_a21925a7a138f516516d8e2f322a6ee51_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/cl__options_8c_a59cada9ad3d3cb7d1b7364d1be231a03_cgraph.map b/flex-bison/mark1/docs/html/cl__options_8c_a59cada9ad3d3cb7d1b7364d1be231a03_cgraph.map new file mode 100644 index 0000000..625d690 --- /dev/null +++ b/flex-bison/mark1/docs/html/cl__options_8c_a59cada9ad3d3cb7d1b7364d1be231a03_cgraph.map @@ -0,0 +1,5 @@ + + + + + diff --git a/flex-bison/mark1/docs/html/cl__options_8c_a59cada9ad3d3cb7d1b7364d1be231a03_cgraph.md5 b/flex-bison/mark1/docs/html/cl__options_8c_a59cada9ad3d3cb7d1b7364d1be231a03_cgraph.md5 new file mode 100644 index 0000000..b83de9c --- /dev/null +++ b/flex-bison/mark1/docs/html/cl__options_8c_a59cada9ad3d3cb7d1b7364d1be231a03_cgraph.md5 @@ -0,0 +1 @@ +11b2add4f5cf683ecd0b2babf9173930 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/cl__options_8c_a59cada9ad3d3cb7d1b7364d1be231a03_cgraph.png b/flex-bison/mark1/docs/html/cl__options_8c_a59cada9ad3d3cb7d1b7364d1be231a03_cgraph.png new file mode 100644 index 0000000..bd7742b Binary files /dev/null and b/flex-bison/mark1/docs/html/cl__options_8c_a59cada9ad3d3cb7d1b7364d1be231a03_cgraph.png differ diff --git a/flex-bison/mark1/docs/html/cl__options_8c_a59cada9ad3d3cb7d1b7364d1be231a03_icgraph.map b/flex-bison/mark1/docs/html/cl__options_8c_a59cada9ad3d3cb7d1b7364d1be231a03_icgraph.map new file mode 100644 index 0000000..5206b53 --- /dev/null +++ b/flex-bison/mark1/docs/html/cl__options_8c_a59cada9ad3d3cb7d1b7364d1be231a03_icgraph.map @@ -0,0 +1,4 @@ + + + + diff --git a/flex-bison/mark1/docs/html/cl__options_8c_a59cada9ad3d3cb7d1b7364d1be231a03_icgraph.md5 b/flex-bison/mark1/docs/html/cl__options_8c_a59cada9ad3d3cb7d1b7364d1be231a03_icgraph.md5 new file mode 100644 index 0000000..9dce472 --- /dev/null +++ b/flex-bison/mark1/docs/html/cl__options_8c_a59cada9ad3d3cb7d1b7364d1be231a03_icgraph.md5 @@ -0,0 +1 @@ +b7a12c4810ec15f7d08b9f5210f8d10c \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/cl__options_8c_a59cada9ad3d3cb7d1b7364d1be231a03_icgraph.png b/flex-bison/mark1/docs/html/cl__options_8c_a59cada9ad3d3cb7d1b7364d1be231a03_icgraph.png new file mode 100644 index 0000000..1499495 Binary files /dev/null and b/flex-bison/mark1/docs/html/cl__options_8c_a59cada9ad3d3cb7d1b7364d1be231a03_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/cl__options_8c_a6f3ebce4a0fc1931c6f94dea7686e32b_cgraph.map b/flex-bison/mark1/docs/html/cl__options_8c_a6f3ebce4a0fc1931c6f94dea7686e32b_cgraph.map new file mode 100644 index 0000000..f754187 --- /dev/null +++ b/flex-bison/mark1/docs/html/cl__options_8c_a6f3ebce4a0fc1931c6f94dea7686e32b_cgraph.map @@ -0,0 +1,5 @@ + + + + + diff --git a/flex-bison/mark1/docs/html/cl__options_8c_a6f3ebce4a0fc1931c6f94dea7686e32b_cgraph.md5 b/flex-bison/mark1/docs/html/cl__options_8c_a6f3ebce4a0fc1931c6f94dea7686e32b_cgraph.md5 new file mode 100644 index 0000000..41a97f4 --- /dev/null +++ b/flex-bison/mark1/docs/html/cl__options_8c_a6f3ebce4a0fc1931c6f94dea7686e32b_cgraph.md5 @@ -0,0 +1 @@ +97ebaa3cff72e1f2cf8ef2e589d18f65 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/cl__options_8c_a6f3ebce4a0fc1931c6f94dea7686e32b_cgraph.png b/flex-bison/mark1/docs/html/cl__options_8c_a6f3ebce4a0fc1931c6f94dea7686e32b_cgraph.png new file mode 100644 index 0000000..03144c1 Binary files /dev/null and b/flex-bison/mark1/docs/html/cl__options_8c_a6f3ebce4a0fc1931c6f94dea7686e32b_cgraph.png differ diff --git a/flex-bison/mark1/docs/html/cl__options_8c_a6f3ebce4a0fc1931c6f94dea7686e32b_icgraph.map b/flex-bison/mark1/docs/html/cl__options_8c_a6f3ebce4a0fc1931c6f94dea7686e32b_icgraph.map new file mode 100644 index 0000000..c4e231d --- /dev/null +++ b/flex-bison/mark1/docs/html/cl__options_8c_a6f3ebce4a0fc1931c6f94dea7686e32b_icgraph.map @@ -0,0 +1,4 @@ + + + + diff --git a/flex-bison/mark1/docs/html/cl__options_8c_a6f3ebce4a0fc1931c6f94dea7686e32b_icgraph.md5 b/flex-bison/mark1/docs/html/cl__options_8c_a6f3ebce4a0fc1931c6f94dea7686e32b_icgraph.md5 new file mode 100644 index 0000000..02bf700 --- /dev/null +++ b/flex-bison/mark1/docs/html/cl__options_8c_a6f3ebce4a0fc1931c6f94dea7686e32b_icgraph.md5 @@ -0,0 +1 @@ +91ee60f2ad7cd0225cea0d90f41785d4 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/cl__options_8c_a6f3ebce4a0fc1931c6f94dea7686e32b_icgraph.png b/flex-bison/mark1/docs/html/cl__options_8c_a6f3ebce4a0fc1931c6f94dea7686e32b_icgraph.png new file mode 100644 index 0000000..323270b Binary files /dev/null and b/flex-bison/mark1/docs/html/cl__options_8c_a6f3ebce4a0fc1931c6f94dea7686e32b_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/cl__options_8c_a7e46ebdf9ee3ca7153f9163cea6fa9d1_icgraph.map b/flex-bison/mark1/docs/html/cl__options_8c_a7e46ebdf9ee3ca7153f9163cea6fa9d1_icgraph.map new file mode 100644 index 0000000..faf705d --- /dev/null +++ b/flex-bison/mark1/docs/html/cl__options_8c_a7e46ebdf9ee3ca7153f9163cea6fa9d1_icgraph.map @@ -0,0 +1,4 @@ + + + + diff --git a/flex-bison/mark1/docs/html/cl__options_8c_a7e46ebdf9ee3ca7153f9163cea6fa9d1_icgraph.md5 b/flex-bison/mark1/docs/html/cl__options_8c_a7e46ebdf9ee3ca7153f9163cea6fa9d1_icgraph.md5 new file mode 100644 index 0000000..f8512b0 --- /dev/null +++ b/flex-bison/mark1/docs/html/cl__options_8c_a7e46ebdf9ee3ca7153f9163cea6fa9d1_icgraph.md5 @@ -0,0 +1 @@ +dd6e19c8fd841b939ce07f510e88253f \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/cl__options_8c_a7e46ebdf9ee3ca7153f9163cea6fa9d1_icgraph.png b/flex-bison/mark1/docs/html/cl__options_8c_a7e46ebdf9ee3ca7153f9163cea6fa9d1_icgraph.png new file mode 100644 index 0000000..8358ed0 Binary files /dev/null and b/flex-bison/mark1/docs/html/cl__options_8c_a7e46ebdf9ee3ca7153f9163cea6fa9d1_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/cl__options_8c_a99c008f306f7042195ce6e206a4cc454_icgraph.map b/flex-bison/mark1/docs/html/cl__options_8c_a99c008f306f7042195ce6e206a4cc454_icgraph.map new file mode 100644 index 0000000..6027ab5 --- /dev/null +++ b/flex-bison/mark1/docs/html/cl__options_8c_a99c008f306f7042195ce6e206a4cc454_icgraph.map @@ -0,0 +1,5 @@ + + + + + diff --git a/flex-bison/mark1/docs/html/cl__options_8c_a99c008f306f7042195ce6e206a4cc454_icgraph.md5 b/flex-bison/mark1/docs/html/cl__options_8c_a99c008f306f7042195ce6e206a4cc454_icgraph.md5 new file mode 100644 index 0000000..02f1a53 --- /dev/null +++ b/flex-bison/mark1/docs/html/cl__options_8c_a99c008f306f7042195ce6e206a4cc454_icgraph.md5 @@ -0,0 +1 @@ +a6621831ca50aeadf14f0def8d654158 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/cl__options_8c_a99c008f306f7042195ce6e206a4cc454_icgraph.png b/flex-bison/mark1/docs/html/cl__options_8c_a99c008f306f7042195ce6e206a4cc454_icgraph.png new file mode 100644 index 0000000..712e6be Binary files /dev/null and b/flex-bison/mark1/docs/html/cl__options_8c_a99c008f306f7042195ce6e206a4cc454_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/cl__options_8c_a9cffa5b8a66484358c9e67f27e88901f_icgraph.map b/flex-bison/mark1/docs/html/cl__options_8c_a9cffa5b8a66484358c9e67f27e88901f_icgraph.map new file mode 100644 index 0000000..67cec3d --- /dev/null +++ b/flex-bison/mark1/docs/html/cl__options_8c_a9cffa5b8a66484358c9e67f27e88901f_icgraph.map @@ -0,0 +1,5 @@ + + + + + diff --git a/flex-bison/mark1/docs/html/cl__options_8c_a9cffa5b8a66484358c9e67f27e88901f_icgraph.md5 b/flex-bison/mark1/docs/html/cl__options_8c_a9cffa5b8a66484358c9e67f27e88901f_icgraph.md5 new file mode 100644 index 0000000..f042aa6 --- /dev/null +++ b/flex-bison/mark1/docs/html/cl__options_8c_a9cffa5b8a66484358c9e67f27e88901f_icgraph.md5 @@ -0,0 +1 @@ +21135163c550d59460075e833a2595a8 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/cl__options_8c_a9cffa5b8a66484358c9e67f27e88901f_icgraph.png b/flex-bison/mark1/docs/html/cl__options_8c_a9cffa5b8a66484358c9e67f27e88901f_icgraph.png new file mode 100644 index 0000000..d4de150 Binary files /dev/null and b/flex-bison/mark1/docs/html/cl__options_8c_a9cffa5b8a66484358c9e67f27e88901f_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/cl__options_8c_ab4494a79dab5266e31d1126eee64b8e6_icgraph.map b/flex-bison/mark1/docs/html/cl__options_8c_ab4494a79dab5266e31d1126eee64b8e6_icgraph.map new file mode 100644 index 0000000..7c132b9 --- /dev/null +++ b/flex-bison/mark1/docs/html/cl__options_8c_ab4494a79dab5266e31d1126eee64b8e6_icgraph.map @@ -0,0 +1,3 @@ + + + diff --git a/flex-bison/mark1/docs/html/cl__options_8c_ab4494a79dab5266e31d1126eee64b8e6_icgraph.md5 b/flex-bison/mark1/docs/html/cl__options_8c_ab4494a79dab5266e31d1126eee64b8e6_icgraph.md5 new file mode 100644 index 0000000..4191c64 --- /dev/null +++ b/flex-bison/mark1/docs/html/cl__options_8c_ab4494a79dab5266e31d1126eee64b8e6_icgraph.md5 @@ -0,0 +1 @@ +9078558c4b1153552fe4fe29af287831 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/cl__options_8c_ab4494a79dab5266e31d1126eee64b8e6_icgraph.png b/flex-bison/mark1/docs/html/cl__options_8c_ab4494a79dab5266e31d1126eee64b8e6_icgraph.png new file mode 100644 index 0000000..cfeaee6 Binary files /dev/null and b/flex-bison/mark1/docs/html/cl__options_8c_ab4494a79dab5266e31d1126eee64b8e6_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/cl__options_8c_source.html b/flex-bison/mark1/docs/html/cl__options_8c_source.html new file mode 100644 index 0000000..f7b6f44 --- /dev/null +++ b/flex-bison/mark1/docs/html/cl__options_8c_source.html @@ -0,0 +1,273 @@ + + + + +Mark1: src/cl_options/cl_options.c Source File + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + +
+
+ +
+
+
+ +
+
+
+

src/cl_options/cl_options.c

+
+
+Go to the documentation of this file.
00001 /******************************************************************************
+00002  * Includes and Prototypes
+00003  *****************************************************************************/
+00004 #include <getopt.h>
+00005 #include <stdio.h>
+00006 #include <stdlib.h>
+00007 #include "cl_options.h"
+00008 #include "linked_list.h"
+00009 
+00010 STATIC void HandleLongOption(U8 opt_index);
+00011 STATIC void HandleShortOption(U8 opt);
+00012 STATIC void BuildFileList(U32 argc, String* argv);
+00013 
+00014 /******************************************************************************
+00015  * Globals
+00016  *****************************************************************************/
+00017 const String Help_String =
+00018 "Usage: mark1 [options] file...\n"
+00019 "Options:\n"
+00020 "  --help            Prints available options\n"
+00021 "  --debug-ast       Enables debug printing of the abstract syntax tree.\n"
+00022 "  --debug-tac       Enables debug printing of the intermediat three address code.\n"
+00023 "  --debug-asm       Enables debug printing of the generated assembly code.\n"
+00024 ;
+00025 
+00026 // Short Options List
+00027 const String Short_Options = "";
+00028 
+00029 // Long Options List
+00030 const struct option Long_Options[] = {
+00031         {"help",      0, 0, 0},
+00032         {"debug-ast", 0, 0, 0},
+00033         {"debug-tac", 0, 0, 0},
+00034         {"debug-asm", 0, 0, 0},
+00035         {0,0,0,0}
+00036 };
+00037 #define IDX_HELP      ((U8)0)
+00038 #define IDX_DEBUG_AST ((U8)1)
+00039 #define IDX_DEBUG_TAC ((U8)2)
+00040 #define IDX_DEBUG_ASM ((U8)3)
+00041 
+00042 // Option Variables
+00043 STATIC BOOL DebugAST = FALSE;
+00044 STATIC BOOL DebugTAC = FALSE;
+00045 STATIC BOOL DebugASM = FALSE;
+00046 STATIC LinkedList_T* FileList = NULL;
+00047 
+00048 /******************************************************************************
+00049  * Private Functions
+00050  *****************************************************************************/
+00051 void HandleLongOption(U8 opt_index)
+00052 {
+00053         switch( opt_index )
+00054         {
+00055                 case IDX_HELP:
+00056                         printf("%s",Help_String);
+00057                         exit(0);
+00058                         break;
+00059                 case IDX_DEBUG_AST:
+00060                         CLO_SetDebugAST( TRUE );
+00061                         break;
+00062                 case IDX_DEBUG_TAC:
+00063                         CLO_SetDebugTAC( TRUE );
+00064                         break;
+00065                 case IDX_DEBUG_ASM:
+00066                         CLO_SetDebugASM( TRUE );
+00067                         break;
+00068                 default:
+00069                         break;
+00070         }
+00071 }
+00072 
+00073 void HandleShortOption(U8 opt)
+00074 {
+00075         switch( opt )
+00076         {
+00077                 default:
+00078                         break;
+00079         }
+00080 }
+00081 
+00082 void BuildFileList(U32 argc, String* argv)
+00083 {
+00084         while (optind < argc)
+00085         {
+00086                 if (FileList == NULL)
+00087                 {
+00088                         FileList = LL_New( argv[optind++] );
+00089                 }
+00090                 else
+00091                 {
+00092                         LL_Add( FileList, argv[optind++] );
+00093                 }
+00094         }
+00095 }
+00096 
+00097 /******************************************************************************
+00098  * Public Functions
+00099  *****************************************************************************/
+00100 void CLO_ParseOptions(U32 argc, String* argv)
+00101 {
+00102         S8 opt = 0;
+00103         U8 opt_index = 0;
+00104         while(1)
+00105         {
+00106                 opt = getopt_long(argc, argv, Short_Options, Long_Options, (int*)&opt_index);
+00107                 if (opt == -1)
+00108                 {
+00109                         break;
+00110                 }
+00111 
+00112                 if(opt == 0)
+00113                 {
+00114                         HandleLongOption(opt_index);
+00115                 }
+00116                 else
+00117                 {
+00118                         HandleShortOption(opt);
+00119                 }
+00120         }
+00121         BuildFileList(argc,argv);
+00122 }
+00123 
+00124 LinkedList_T* CLO_GetFileList(void)
+00125 {
+00126         return FileList;
+00127 }
+00128 
+00129 void CLO_SetDebugAST(BOOL enabled)
+00130 {
+00131         DebugAST = enabled; 
+00132 }
+00133 
+00134 BOOL CLO_GetDebugAST()
+00135 {
+00136         return DebugAST;
+00137 }
+00138 
+00139 
+00140 void CLO_SetDebugTAC(BOOL enabled)
+00141 {
+00142         DebugTAC = enabled;
+00143 }
+00144 
+00145 
+00146 BOOL CLO_GetDebugTAC()
+00147 {
+00148         return DebugTAC;
+00149 }
+00150 
+00151 
+00152 void CLO_SetDebugASM(BOOL enabled)
+00153 {
+00154         DebugASM = enabled;
+00155 }
+00156 
+00157 
+00158 BOOL CLO_GetDebugASM()
+00159 {
+00160         return DebugASM;
+00161 }
+00162 
+00163 
+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/cl__options_8h.html b/flex-bison/mark1/docs/html/cl__options_8h.html new file mode 100644 index 0000000..d4c4f39 --- /dev/null +++ b/flex-bison/mark1/docs/html/cl__options_8h.html @@ -0,0 +1,357 @@ + + + + +Mark1: src/cl_options/cl_options.h File Reference + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + +
+
+ +
+
+
+ +
+
+ +
+

src/cl_options/cl_options.h File Reference

+
+
+
#include "common.h"
+#include "linked_list.h"
+
+Include dependency graph for cl_options.h:
+
+
+
+
+This graph shows which files directly or indirectly include this file:
+
+
+ + +
+
+

Go to the source code of this file.

+ + + + + + + + + + +

+Functions

void CLO_ParseOptions (U32 argc, String *argv)
LinkedList_TCLO_GetFileList (void)
void CLO_SetDebugAST (BOOL enabled)
BOOL CLO_GetDebugAST (void)
void CLO_SetDebugTAC (BOOL enabled)
BOOL CLO_GetDebugTAC (void)
void CLO_SetDebugASM (BOOL enabled)
BOOL CLO_GetDebugASM (void)
+

Function Documentation

+ +
+
+ + + + + + + + +
BOOL CLO_GetDebugASM (void )
+
+
+ +

Definition at line 158 of file cl_options.c.

+ +
+
+ +
+
+ + + + + + + + +
BOOL CLO_GetDebugAST (void )
+
+
+ +

Definition at line 134 of file cl_options.c.

+ +
+
+ +
+
+ + + + + + + + +
BOOL CLO_GetDebugTAC (void )
+
+
+ +

Definition at line 146 of file cl_options.c.

+ +
+
+ +
+
+ + + + + + + + +
LinkedList_T* CLO_GetFileList (void )
+
+
+ +

Definition at line 124 of file cl_options.c.

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void CLO_ParseOptions (U32 argc,
Stringargv 
)
+
+
+ +

Definition at line 100 of file cl_options.c.

+ +

+Here is the call graph for this function:
+
+
+ + +
+

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + +
void CLO_SetDebugASM (BOOL enabled)
+
+
+ +

Definition at line 152 of file cl_options.c.

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + +
void CLO_SetDebugAST (BOOL enabled)
+
+
+ +

Definition at line 129 of file cl_options.c.

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + +
void CLO_SetDebugTAC (BOOL enabled)
+
+
+ +

Definition at line 140 of file cl_options.c.

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/cl__options_8h__dep__incl.map b/flex-bison/mark1/docs/html/cl__options_8h__dep__incl.map new file mode 100644 index 0000000..66c5e56 --- /dev/null +++ b/flex-bison/mark1/docs/html/cl__options_8h__dep__incl.map @@ -0,0 +1,3 @@ + + + diff --git a/flex-bison/mark1/docs/html/cl__options_8h__dep__incl.md5 b/flex-bison/mark1/docs/html/cl__options_8h__dep__incl.md5 new file mode 100644 index 0000000..0fcb998 --- /dev/null +++ b/flex-bison/mark1/docs/html/cl__options_8h__dep__incl.md5 @@ -0,0 +1 @@ +6b40d674f271788f8ca88ba30c896676 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/cl__options_8h__dep__incl.png b/flex-bison/mark1/docs/html/cl__options_8h__dep__incl.png new file mode 100644 index 0000000..371f98d Binary files /dev/null and b/flex-bison/mark1/docs/html/cl__options_8h__dep__incl.png differ diff --git a/flex-bison/mark1/docs/html/cl__options_8h__incl.map b/flex-bison/mark1/docs/html/cl__options_8h__incl.map new file mode 100644 index 0000000..8be6a30 --- /dev/null +++ b/flex-bison/mark1/docs/html/cl__options_8h__incl.map @@ -0,0 +1,2 @@ + + diff --git a/flex-bison/mark1/docs/html/cl__options_8h__incl.md5 b/flex-bison/mark1/docs/html/cl__options_8h__incl.md5 new file mode 100644 index 0000000..ca82eee --- /dev/null +++ b/flex-bison/mark1/docs/html/cl__options_8h__incl.md5 @@ -0,0 +1 @@ +bba99878cedab3e30261888a11a7a673 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/cl__options_8h__incl.png b/flex-bison/mark1/docs/html/cl__options_8h__incl.png new file mode 100644 index 0000000..20612fc Binary files /dev/null and b/flex-bison/mark1/docs/html/cl__options_8h__incl.png differ diff --git a/flex-bison/mark1/docs/html/cl__options_8h_a05b2fb76129a951433a33d45df145365_cgraph.map b/flex-bison/mark1/docs/html/cl__options_8h_a05b2fb76129a951433a33d45df145365_cgraph.map new file mode 100644 index 0000000..60ee081 --- /dev/null +++ b/flex-bison/mark1/docs/html/cl__options_8h_a05b2fb76129a951433a33d45df145365_cgraph.map @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/flex-bison/mark1/docs/html/cl__options_8h_a05b2fb76129a951433a33d45df145365_cgraph.md5 b/flex-bison/mark1/docs/html/cl__options_8h_a05b2fb76129a951433a33d45df145365_cgraph.md5 new file mode 100644 index 0000000..749aa5b --- /dev/null +++ b/flex-bison/mark1/docs/html/cl__options_8h_a05b2fb76129a951433a33d45df145365_cgraph.md5 @@ -0,0 +1 @@ +262c50818b9ff233bc0a1fabc94c9e94 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/cl__options_8h_a05b2fb76129a951433a33d45df145365_cgraph.png b/flex-bison/mark1/docs/html/cl__options_8h_a05b2fb76129a951433a33d45df145365_cgraph.png new file mode 100644 index 0000000..4a828e2 Binary files /dev/null and b/flex-bison/mark1/docs/html/cl__options_8h_a05b2fb76129a951433a33d45df145365_cgraph.png differ diff --git a/flex-bison/mark1/docs/html/cl__options_8h_a05b2fb76129a951433a33d45df145365_icgraph.map b/flex-bison/mark1/docs/html/cl__options_8h_a05b2fb76129a951433a33d45df145365_icgraph.map new file mode 100644 index 0000000..1622867 --- /dev/null +++ b/flex-bison/mark1/docs/html/cl__options_8h_a05b2fb76129a951433a33d45df145365_icgraph.map @@ -0,0 +1,3 @@ + + + diff --git a/flex-bison/mark1/docs/html/cl__options_8h_a05b2fb76129a951433a33d45df145365_icgraph.md5 b/flex-bison/mark1/docs/html/cl__options_8h_a05b2fb76129a951433a33d45df145365_icgraph.md5 new file mode 100644 index 0000000..4450742 --- /dev/null +++ b/flex-bison/mark1/docs/html/cl__options_8h_a05b2fb76129a951433a33d45df145365_icgraph.md5 @@ -0,0 +1 @@ +f7e1ed72a184e06eb6c83852a19ea5b5 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/cl__options_8h_a05b2fb76129a951433a33d45df145365_icgraph.png b/flex-bison/mark1/docs/html/cl__options_8h_a05b2fb76129a951433a33d45df145365_icgraph.png new file mode 100644 index 0000000..1709eb0 Binary files /dev/null and b/flex-bison/mark1/docs/html/cl__options_8h_a05b2fb76129a951433a33d45df145365_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/cl__options_8h_a21925a7a138f516516d8e2f322a6ee51_icgraph.map b/flex-bison/mark1/docs/html/cl__options_8h_a21925a7a138f516516d8e2f322a6ee51_icgraph.map new file mode 100644 index 0000000..67cec3d --- /dev/null +++ b/flex-bison/mark1/docs/html/cl__options_8h_a21925a7a138f516516d8e2f322a6ee51_icgraph.map @@ -0,0 +1,5 @@ + + + + + diff --git a/flex-bison/mark1/docs/html/cl__options_8h_a21925a7a138f516516d8e2f322a6ee51_icgraph.md5 b/flex-bison/mark1/docs/html/cl__options_8h_a21925a7a138f516516d8e2f322a6ee51_icgraph.md5 new file mode 100644 index 0000000..3867180 --- /dev/null +++ b/flex-bison/mark1/docs/html/cl__options_8h_a21925a7a138f516516d8e2f322a6ee51_icgraph.md5 @@ -0,0 +1 @@ +641c65eab39669630d32cad49d02bbbf \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/cl__options_8h_a21925a7a138f516516d8e2f322a6ee51_icgraph.png b/flex-bison/mark1/docs/html/cl__options_8h_a21925a7a138f516516d8e2f322a6ee51_icgraph.png new file mode 100644 index 0000000..c7abc38 Binary files /dev/null and b/flex-bison/mark1/docs/html/cl__options_8h_a21925a7a138f516516d8e2f322a6ee51_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/cl__options_8h_a99c008f306f7042195ce6e206a4cc454_icgraph.map b/flex-bison/mark1/docs/html/cl__options_8h_a99c008f306f7042195ce6e206a4cc454_icgraph.map new file mode 100644 index 0000000..6027ab5 --- /dev/null +++ b/flex-bison/mark1/docs/html/cl__options_8h_a99c008f306f7042195ce6e206a4cc454_icgraph.map @@ -0,0 +1,5 @@ + + + + + diff --git a/flex-bison/mark1/docs/html/cl__options_8h_a99c008f306f7042195ce6e206a4cc454_icgraph.md5 b/flex-bison/mark1/docs/html/cl__options_8h_a99c008f306f7042195ce6e206a4cc454_icgraph.md5 new file mode 100644 index 0000000..02f1a53 --- /dev/null +++ b/flex-bison/mark1/docs/html/cl__options_8h_a99c008f306f7042195ce6e206a4cc454_icgraph.md5 @@ -0,0 +1 @@ +a6621831ca50aeadf14f0def8d654158 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/cl__options_8h_a99c008f306f7042195ce6e206a4cc454_icgraph.png b/flex-bison/mark1/docs/html/cl__options_8h_a99c008f306f7042195ce6e206a4cc454_icgraph.png new file mode 100644 index 0000000..e48f165 Binary files /dev/null and b/flex-bison/mark1/docs/html/cl__options_8h_a99c008f306f7042195ce6e206a4cc454_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/cl__options_8h_a9cffa5b8a66484358c9e67f27e88901f_icgraph.map b/flex-bison/mark1/docs/html/cl__options_8h_a9cffa5b8a66484358c9e67f27e88901f_icgraph.map new file mode 100644 index 0000000..67cec3d --- /dev/null +++ b/flex-bison/mark1/docs/html/cl__options_8h_a9cffa5b8a66484358c9e67f27e88901f_icgraph.map @@ -0,0 +1,5 @@ + + + + + diff --git a/flex-bison/mark1/docs/html/cl__options_8h_a9cffa5b8a66484358c9e67f27e88901f_icgraph.md5 b/flex-bison/mark1/docs/html/cl__options_8h_a9cffa5b8a66484358c9e67f27e88901f_icgraph.md5 new file mode 100644 index 0000000..f042aa6 --- /dev/null +++ b/flex-bison/mark1/docs/html/cl__options_8h_a9cffa5b8a66484358c9e67f27e88901f_icgraph.md5 @@ -0,0 +1 @@ +21135163c550d59460075e833a2595a8 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/cl__options_8h_a9cffa5b8a66484358c9e67f27e88901f_icgraph.png b/flex-bison/mark1/docs/html/cl__options_8h_a9cffa5b8a66484358c9e67f27e88901f_icgraph.png new file mode 100644 index 0000000..c07481b Binary files /dev/null and b/flex-bison/mark1/docs/html/cl__options_8h_a9cffa5b8a66484358c9e67f27e88901f_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/cl__options_8h_ab4494a79dab5266e31d1126eee64b8e6_icgraph.map b/flex-bison/mark1/docs/html/cl__options_8h_ab4494a79dab5266e31d1126eee64b8e6_icgraph.map new file mode 100644 index 0000000..7c132b9 --- /dev/null +++ b/flex-bison/mark1/docs/html/cl__options_8h_ab4494a79dab5266e31d1126eee64b8e6_icgraph.map @@ -0,0 +1,3 @@ + + + diff --git a/flex-bison/mark1/docs/html/cl__options_8h_ab4494a79dab5266e31d1126eee64b8e6_icgraph.md5 b/flex-bison/mark1/docs/html/cl__options_8h_ab4494a79dab5266e31d1126eee64b8e6_icgraph.md5 new file mode 100644 index 0000000..4191c64 --- /dev/null +++ b/flex-bison/mark1/docs/html/cl__options_8h_ab4494a79dab5266e31d1126eee64b8e6_icgraph.md5 @@ -0,0 +1 @@ +9078558c4b1153552fe4fe29af287831 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/cl__options_8h_ab4494a79dab5266e31d1126eee64b8e6_icgraph.png b/flex-bison/mark1/docs/html/cl__options_8h_ab4494a79dab5266e31d1126eee64b8e6_icgraph.png new file mode 100644 index 0000000..97c99d6 Binary files /dev/null and b/flex-bison/mark1/docs/html/cl__options_8h_ab4494a79dab5266e31d1126eee64b8e6_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/cl__options_8h_source.html b/flex-bison/mark1/docs/html/cl__options_8h_source.html new file mode 100644 index 0000000..2f14692 --- /dev/null +++ b/flex-bison/mark1/docs/html/cl__options_8h_source.html @@ -0,0 +1,126 @@ + + + + +Mark1: src/cl_options/cl_options.h Source File + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + +
+
+ +
+
+
+ +
+
+
+

src/cl_options/cl_options.h

+
+
+Go to the documentation of this file.
00001 #ifndef CL_OPTIONS_H
+00002 #define CL_OPTIONS_H
+00003 
+00004 #include "common.h"
+00005 #include "linked_list.h"
+00006 
+00007 void CLO_ParseOptions(U32 argc, String* argv);
+00008 LinkedList_T* CLO_GetFileList(void);
+00009 void CLO_SetDebugAST(BOOL enabled);
+00010 BOOL CLO_GetDebugAST(void);
+00011 void CLO_SetDebugTAC(BOOL enabled);
+00012 BOOL CLO_GetDebugTAC(void);
+00013 void CLO_SetDebugASM(BOOL enabled);
+00014 BOOL CLO_GetDebugASM(void);
+00015 
+00016 #endif
+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/classes.html b/flex-bison/mark1/docs/html/classes.html new file mode 100644 index 0000000..bbd4d5d --- /dev/null +++ b/flex-bison/mark1/docs/html/classes.html @@ -0,0 +1,119 @@ + + + + +Mark1: Data Structure Index + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + +
+
+ +
+
+
+ +
+
+
+

Data Structure Index

+
+
+
L | N | O | P | V | Y
+ +
  L  
+
  O  
+
  V  
+
  Y  
+
yyalloc   
LinkedList   OpcodeInfo_T   Value_T   yy_buffer_state   yyguts_t   
  N  
+
  P  
+
ValueNode_T   yy_trans_info   YYSTYPE   
Node_T   ParserContext_T   
L | N | O | P | V | Y
+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/closed.png b/flex-bison/mark1/docs/html/closed.png new file mode 100644 index 0000000..b7d4bd9 Binary files /dev/null and b/flex-bison/mark1/docs/html/closed.png differ diff --git a/flex-bison/mark1/docs/html/common_8h.html b/flex-bison/mark1/docs/html/common_8h.html new file mode 100644 index 0000000..c7eb339 --- /dev/null +++ b/flex-bison/mark1/docs/html/common_8h.html @@ -0,0 +1,1353 @@ + + + + +Mark1: src/common.h File Reference + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + +
+
+ +
+
+
+ +
+
+ +
+

src/common.h File Reference

+
+
+ +

Go to the source code of this file.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Defines

#define STATIC   static
#define NULL   ((U8)0)
#define NULL_PTR   ((void *)0u)
#define BIT_0   0x01u
#define BIT_1   0x02u
#define BIT_2   0x04u
#define BIT_3   0x08u
#define BIT_4   0x10u
#define BIT_5   0x20u
#define BIT_6   0x40u
#define BIT_7   0x80u
#define BIT_8   0x0100u
#define BIT_9   0x0200u
#define BIT_10   0x0400u
#define BIT_11   0x0800u
#define BIT_12   0x1000u
#define BIT_13   0x2000u
#define BIT_14   0x4000u
#define BIT_15   0x8000u
#define BIT_16   0x010000u
#define BIT_17   0x020000u
#define BIT_18   0x040000u
#define BIT_19   0x080000u
#define BIT_20   0x100000u
#define BIT_21   0x200000u
#define BIT_22   0x400000u
#define BIT_23   0x800000u
#define BIT_24   0x01000000u
#define BIT_25   0x02000000u
#define BIT_26   0x04000000u
#define BIT_27   0x08000000u
#define BIT_28   0x10000000u
#define BIT_29   0x20000000u
#define BIT_30   0x40000000u
#define BIT_31   0x80000000u
#define VERIFY_RANGE(x, Min, Max)   ((((x)>=(Min)) && ((x)<=(Max)))? (TRUE) : (FALSE))
#define VERIFY_RANGE_VALUE(x, Default, Min, Max)   (VERIFY_RANGE((x), (Min), (Max))? (x) : (Default))
#define VERIFY_MAX_VALUE(x, Default, Max)   (((x)<=(Max)) ? (x) : (Default))
#define VERIFY_MIN_VALUE(x, Default, Min)   (((x)>=(Min)) ? (x) : (Default))
#define _ABS(x, type)   (((x) < (type)0) ? (type)-(x):(x))
#define ABS(x)   (((x) < 0) ? -(x):(x))
#define MAX(a, b)   (((a) > (b)) ? (a):(b))
#define MIN(a, b)   (((a) < (b)) ? (a):(b))
#define SIGN(x, y)   (((y) < 0) ? (-(x)):(x))
#define NUM_ELEMENTS(x)   (sizeof(x)/sizeof(x[0]))
#define LIMIT_RANGE(x, Min, Max)   (MAX(MIN((x),(Max)),(Min)))
#define LOW_BYTE(x)   ((U8)((x) & 0x00FFu))
#define HIGH_BYTE(x)   ((U8)(((x)>>8u) & 0x00FFu))
#define LOW_WORD(x)   ((U16)((x) & 0x0000FFFFUL))
#define HIGH_WORD(x)   ((U16)(((x)>>16) & 0x0000FFFFUL))
#define QUOTE(x)   #x

+Typedefs

typedef unsigned char U8
 8-bit unsigned integer
typedef unsigned short int U16
 16-bit unsigned integer
typedef unsigned long U32
 32-bit unsigned integer
typedef signed char S8
 8-bit signed integer
typedef short int S16
 16-bit signed integer
typedef long int S32
 32-bit signed integer
typedef long long int S64
 64-bit signed integer
typedef float F32
 32-bit floating point number
typedef double F64
 64-bit floating point number
typedef char * String
 String definition.

+Enumerations

enum  BOOL { TRUE = 1, +FALSE = 0 + }
 

Boolean enum definition.

+ More...
+

Define Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + +
#define _ABS( x,
 type 
)   (((x) < (type)0) ? (type)-(x):(x))
+
+
+ +

Definition at line 107 of file common.h.

+ +
+
+ +
+
+ + + + + + + + +
#define ABS( x)   (((x) < 0) ? -(x):(x))
+
+
+ +

Definition at line 108 of file common.h.

+ +
+
+ +
+
+ + + + +
#define BIT_0   0x01u
+
+
+ +

Definition at line 63 of file common.h.

+ +
+
+ +
+
+ + + + +
#define BIT_1   0x02u
+
+
+ +

Definition at line 64 of file common.h.

+ +
+
+ +
+
+ + + + +
#define BIT_10   0x0400u
+
+
+ +

Definition at line 74 of file common.h.

+ +
+
+ +
+
+ + + + +
#define BIT_11   0x0800u
+
+
+ +

Definition at line 75 of file common.h.

+ +
+
+ +
+
+ + + + +
#define BIT_12   0x1000u
+
+
+ +

Definition at line 76 of file common.h.

+ +
+
+ +
+
+ + + + +
#define BIT_13   0x2000u
+
+
+ +

Definition at line 77 of file common.h.

+ +
+
+ +
+
+ + + + +
#define BIT_14   0x4000u
+
+
+ +

Definition at line 78 of file common.h.

+ +
+
+ +
+
+ + + + +
#define BIT_15   0x8000u
+
+
+ +

Definition at line 79 of file common.h.

+ +
+
+ +
+
+ + + + +
#define BIT_16   0x010000u
+
+
+ +

Definition at line 81 of file common.h.

+ +
+
+ +
+
+ + + + +
#define BIT_17   0x020000u
+
+
+ +

Definition at line 82 of file common.h.

+ +
+
+ +
+
+ + + + +
#define BIT_18   0x040000u
+
+
+ +

Definition at line 83 of file common.h.

+ +
+
+ +
+
+ + + + +
#define BIT_19   0x080000u
+
+
+ +

Definition at line 84 of file common.h.

+ +
+
+ +
+
+ + + + +
#define BIT_2   0x04u
+
+
+ +

Definition at line 65 of file common.h.

+ +
+
+ +
+
+ + + + +
#define BIT_20   0x100000u
+
+
+ +

Definition at line 85 of file common.h.

+ +
+
+ +
+
+ + + + +
#define BIT_21   0x200000u
+
+
+ +

Definition at line 86 of file common.h.

+ +
+
+ +
+
+ + + + +
#define BIT_22   0x400000u
+
+
+ +

Definition at line 87 of file common.h.

+ +
+
+ +
+
+ + + + +
#define BIT_23   0x800000u
+
+
+ +

Definition at line 88 of file common.h.

+ +
+
+ +
+
+ + + + +
#define BIT_24   0x01000000u
+
+
+ +

Definition at line 90 of file common.h.

+ +
+
+ +
+
+ + + + +
#define BIT_25   0x02000000u
+
+
+ +

Definition at line 91 of file common.h.

+ +
+
+ +
+
+ + + + +
#define BIT_26   0x04000000u
+
+
+ +

Definition at line 92 of file common.h.

+ +
+
+ +
+
+ + + + +
#define BIT_27   0x08000000u
+
+
+ +

Definition at line 93 of file common.h.

+ +
+
+ +
+
+ + + + +
#define BIT_28   0x10000000u
+
+
+ +

Definition at line 94 of file common.h.

+ +
+
+ +
+
+ + + + +
#define BIT_29   0x20000000u
+
+
+ +

Definition at line 95 of file common.h.

+ +
+
+ +
+
+ + + + +
#define BIT_3   0x08u
+
+
+ +

Definition at line 66 of file common.h.

+ +
+
+ +
+
+ + + + +
#define BIT_30   0x40000000u
+
+
+ +

Definition at line 96 of file common.h.

+ +
+
+ +
+
+ + + + +
#define BIT_31   0x80000000u
+
+
+ +

Definition at line 97 of file common.h.

+ +
+
+ +
+
+ + + + +
#define BIT_4   0x10u
+
+
+ +

Definition at line 67 of file common.h.

+ +
+
+ +
+
+ + + + +
#define BIT_5   0x20u
+
+
+ +

Definition at line 68 of file common.h.

+ +
+
+ +
+
+ + + + +
#define BIT_6   0x40u
+
+
+ +

Definition at line 69 of file common.h.

+ +
+
+ +
+
+ + + + +
#define BIT_7   0x80u
+
+
+ +

Definition at line 70 of file common.h.

+ +
+
+ +
+
+ + + + +
#define BIT_8   0x0100u
+
+
+ +

Definition at line 72 of file common.h.

+ +
+
+ +
+
+ + + + +
#define BIT_9   0x0200u
+
+
+ +

Definition at line 73 of file common.h.

+ +
+
+ +
+
+ + + + + + + + +
#define HIGH_BYTE( x)   ((U8)(((x)>>8u) & 0x00FFu))
+
+
+ +

Definition at line 115 of file common.h.

+ +
+
+ +
+
+ + + + + + + + +
#define HIGH_WORD( x)   ((U16)(((x)>>16) & 0x0000FFFFUL))
+
+
+ +

Definition at line 117 of file common.h.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
#define LIMIT_RANGE( x,
 Min,
 Max 
)   (MAX(MIN((x),(Max)),(Min)))
+
+
+ +

Definition at line 113 of file common.h.

+ +
+
+ +
+
+ + + + + + + + +
#define LOW_BYTE( x)   ((U8)((x) & 0x00FFu))
+
+
+ +

Definition at line 114 of file common.h.

+ +
+
+ +
+
+ + + + + + + + +
#define LOW_WORD( x)   ((U16)((x) & 0x0000FFFFUL))
+
+
+ +

Definition at line 116 of file common.h.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
#define MAX( a,
 
)   (((a) > (b)) ? (a):(b))
+
+
+ +

Definition at line 109 of file common.h.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
#define MIN( a,
 
)   (((a) < (b)) ? (a):(b))
+
+
+ +

Definition at line 110 of file common.h.

+ +
+
+ +
+
+ + + + +
#define NULL   ((U8)0)
+
+
+ +

Definition at line 59 of file common.h.

+ +
+
+ +
+
+ + + + +
#define NULL_PTR   ((void *)0u)
+
+
+ +

Definition at line 61 of file common.h.

+ +
+
+ +
+
+ + + + + + + + +
#define NUM_ELEMENTS( x)   (sizeof(x)/sizeof(x[0]))
+
+
+ +

Definition at line 112 of file common.h.

+ +
+
+ +
+
+ + + + + + + + +
#define QUOTE( x)   #x
+
+
+ +

Definition at line 118 of file common.h.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
#define SIGN( x,
 
)   (((y) < 0) ? (-(x)):(x))
+
+
+ +

Definition at line 111 of file common.h.

+ +
+
+ +
+
+ + + + +
#define STATIC   static
+
+
+ +

Definition at line 55 of file common.h.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
#define VERIFY_MAX_VALUE( x,
 Default,
 Max 
)   (((x)<=(Max)) ? (x) : (Default))
+
+
+ +

Definition at line 105 of file common.h.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
#define VERIFY_MIN_VALUE( x,
 Default,
 Min 
)   (((x)>=(Min)) ? (x) : (Default))
+
+
+ +

Definition at line 106 of file common.h.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
#define VERIFY_RANGE( x,
 Min,
 Max 
)   ((((x)>=(Min)) && ((x)<=(Max)))? (TRUE) : (FALSE))
+
+
+ +

Definition at line 103 of file common.h.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#define VERIFY_RANGE_VALUE( x,
 Default,
 Min,
 Max 
)   (VERIFY_RANGE((x), (Min), (Max))? (x) : (Default))
+
+
+ +

Definition at line 104 of file common.h.

+ +
+
+

Typedef Documentation

+ +
+
+ + + + +
typedef float F32
+
+
+ +

32-bit floating point number

+ +

Definition at line 39 of file common.h.

+ +
+
+ +
+
+ + + + +
typedef double F64
+
+
+ +

64-bit floating point number

+ +

Definition at line 42 of file common.h.

+ +
+
+ +
+
+ + + + +
typedef short int S16
+
+
+ +

16-bit signed integer

+ +

Definition at line 29 of file common.h.

+ +
+
+ +
+
+ + + + +
typedef long int S32
+
+
+ +

32-bit signed integer

+ +

Definition at line 32 of file common.h.

+ +
+
+ +
+
+ + + + +
typedef long long int S64
+
+
+ +

64-bit signed integer

+ +

Definition at line 35 of file common.h.

+ +
+
+ +
+
+ + + + +
typedef signed char S8
+
+
+ +

8-bit signed integer

+ +

Definition at line 26 of file common.h.

+ +
+
+ +
+
+ + + + +
typedef char* String
+
+
+ +

String definition.

+ +

Definition at line 46 of file common.h.

+ +
+
+ +
+
+ + + + +
typedef unsigned short int U16
+
+
+ +

16-bit unsigned integer

+ +

Definition at line 19 of file common.h.

+ +
+
+ +
+
+ + + + +
typedef unsigned long U32
+
+
+ +

32-bit unsigned integer

+ +

Definition at line 22 of file common.h.

+ +
+
+ +
+
+ + + + +
typedef unsigned char U8
+
+
+ +

8-bit unsigned integer

+ +

Definition at line 16 of file common.h.

+ +
+
+

Enumeration Type Documentation

+ +
+
+ + + + +
enum BOOL
+
+
+ +

Boolean enum definition.

+
Enumerator:
+ + +
TRUE  +
FALSE  +
+
+
+ +

Definition at line 8 of file common.h.

+ +
+
+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/common_8h_source.html b/flex-bison/mark1/docs/html/common_8h_source.html new file mode 100644 index 0000000..54480a9 --- /dev/null +++ b/flex-bison/mark1/docs/html/common_8h_source.html @@ -0,0 +1,219 @@ + + + + +Mark1: src/common.h Source File + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + +
+
+ +
+
+
+ +
+
+
+

src/common.h

+
+
+Go to the documentation of this file.
00001 #ifndef COMMON_H
+00002 #define COMMON_H
+00003 
+00004 /******************************************************************************
+00005  * Types
+00006  *****************************************************************************/
+00008 typedef enum
+00009 {
+00010         TRUE = 1,
+00011         FALSE = 0
+00012 } BOOL;
+00013 
+00014 /**** Unsigned Integers ****/
+00016 typedef unsigned char           U8;      
+00017 
+00019 typedef unsigned short int      U16;     
+00020 
+00022 typedef unsigned long           U32;     
+00023 
+00024 /**** Signed Integers ****/
+00026 typedef signed char                     S8;
+00027 
+00029 typedef short int                       S16;     
+00030 
+00032 typedef long int                        S32;     
+00033 
+00035 typedef long long int       S64;     
+00036 
+00037 // Floating Point
+00039 typedef float                           F32;     
+00040 
+00042 typedef double                          F64;     
+00043 
+00044 /**** String ****/
+00046 typedef char *              String;  
+00047 
+00048 /******************************************************************************
+00049  * Defines
+00050  *****************************************************************************/
+00051 
+00052 #ifdef TEST
+00053         #define STATIC
+00054 #else
+00055         #define STATIC static
+00056 #endif
+00057 
+00058 #ifndef NULL
+00059         #define NULL ((U8)0)
+00060 #endif
+00061 #define NULL_PTR ((void *)0u)
+00062 
+00063 #define BIT_0   0x01u
+00064 #define BIT_1   0x02u
+00065 #define BIT_2   0x04u
+00066 #define BIT_3   0x08u
+00067 #define BIT_4   0x10u
+00068 #define BIT_5   0x20u
+00069 #define BIT_6   0x40u
+00070 #define BIT_7   0x80u
+00071 
+00072 #define BIT_8   0x0100u
+00073 #define BIT_9   0x0200u
+00074 #define BIT_10  0x0400u
+00075 #define BIT_11  0x0800u
+00076 #define BIT_12  0x1000u
+00077 #define BIT_13  0x2000u
+00078 #define BIT_14  0x4000u
+00079 #define BIT_15  0x8000u
+00080 
+00081 #define BIT_16  0x010000u
+00082 #define BIT_17  0x020000u
+00083 #define BIT_18  0x040000u
+00084 #define BIT_19  0x080000u
+00085 #define BIT_20  0x100000u
+00086 #define BIT_21  0x200000u
+00087 #define BIT_22  0x400000u
+00088 #define BIT_23  0x800000u
+00089 
+00090 #define BIT_24  0x01000000u
+00091 #define BIT_25  0x02000000u
+00092 #define BIT_26  0x04000000u
+00093 #define BIT_27  0x08000000u
+00094 #define BIT_28  0x10000000u
+00095 #define BIT_29  0x20000000u
+00096 #define BIT_30  0x40000000u
+00097 #define BIT_31  0x80000000u
+00098 
+00099 /******************************************************************************
+00100  * Macros
+00101  *****************************************************************************/
+00102 
+00103 #define VERIFY_RANGE(x, Min, Max)                 ((((x)>=(Min)) && ((x)<=(Max)))? (TRUE) : (FALSE))
+00104 #define VERIFY_RANGE_VALUE(x, Default, Min, Max)  (VERIFY_RANGE((x), (Min), (Max))? (x) : (Default))
+00105 #define VERIFY_MAX_VALUE(x, Default, Max)         (((x)<=(Max)) ? (x) : (Default))
+00106 #define VERIFY_MIN_VALUE(x, Default, Min)         (((x)>=(Min)) ? (x) : (Default))
+00107 #define _ABS(x, type)                             (((x) < (type)0) ? (type)-(x):(x))
+00108 #define ABS(x)                                    (((x) < 0) ? -(x):(x))
+00109 #define MAX(a,b)                                  (((a) > (b)) ? (a):(b))
+00110 #define MIN(a,b)                                  (((a) < (b)) ? (a):(b))
+00111 #define SIGN(x,y)                                 (((y) < 0) ? (-(x)):(x))
+00112 #define NUM_ELEMENTS(x)                           (sizeof(x)/sizeof(x[0]))
+00113 #define LIMIT_RANGE(x,Min,Max)                    (MAX(MIN((x),(Max)),(Min)))
+00114 #define LOW_BYTE(x)                               ((U8)((x) & 0x00FFu))
+00115 #define HIGH_BYTE(x)                              ((U8)(((x)>>8u) & 0x00FFu))
+00116 #define LOW_WORD(x)                               ((U16)((x) & 0x0000FFFFUL))
+00117 #define HIGH_WORD(x)                              ((U16)(((x)>>16) & 0x0000FFFFUL))
+00118 #define QUOTE(x)                                  #x
+00119 
+00120 #endif
+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/dbg_8c.html b/flex-bison/mark1/docs/html/dbg_8c.html new file mode 100644 index 0000000..dff1e44 --- /dev/null +++ b/flex-bison/mark1/docs/html/dbg_8c.html @@ -0,0 +1,201 @@ + + + + +Mark1: src/dbg/dbg.c File Reference + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + +
+
+ +
+
+
+ +
+
+ +
+

src/dbg/dbg.c File Reference

+
+
+
#include "dbg.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+Include dependency graph for dbg.c:
+
+
+ + +
+
+

Go to the source code of this file.

+ + + + +

+Functions

void DBG_Breakpoint (String file, U32 line)
void DBG_Assert (String file, U32 line, String cond_text, BOOL condition)
+

Function Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void DBG_Assert (String file,
U32 line,
String cond_text,
BOOL condition 
) [inline]
+
+
+ +

Definition at line 13 of file dbg.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void DBG_Breakpoint (String file,
U32 line 
) [inline]
+
+
+ +

Definition at line 6 of file dbg.c.

+ +
+
+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/dbg_8c__incl.map b/flex-bison/mark1/docs/html/dbg_8c__incl.map new file mode 100644 index 0000000..e8f2e88 --- /dev/null +++ b/flex-bison/mark1/docs/html/dbg_8c__incl.map @@ -0,0 +1,3 @@ + + + diff --git a/flex-bison/mark1/docs/html/dbg_8c__incl.md5 b/flex-bison/mark1/docs/html/dbg_8c__incl.md5 new file mode 100644 index 0000000..e80c6bc --- /dev/null +++ b/flex-bison/mark1/docs/html/dbg_8c__incl.md5 @@ -0,0 +1 @@ +142982d3adcce69778c91659ec31e1e4 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/dbg_8c__incl.png b/flex-bison/mark1/docs/html/dbg_8c__incl.png new file mode 100644 index 0000000..56207ed Binary files /dev/null and b/flex-bison/mark1/docs/html/dbg_8c__incl.png differ diff --git a/flex-bison/mark1/docs/html/dbg_8c_source.html b/flex-bison/mark1/docs/html/dbg_8c_source.html new file mode 100644 index 0000000..05adf7c --- /dev/null +++ b/flex-bison/mark1/docs/html/dbg_8c_source.html @@ -0,0 +1,130 @@ + + + + +Mark1: src/dbg/dbg.c Source File + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + +
+
+ +
+
+
+ +
+
+
+

src/dbg/dbg.c

+
+
+Go to the documentation of this file.
00001 #include "dbg.h"
+00002 
+00003 #include <stdio.h>
+00004 #include <stdlib.h>
+00005 
+00006 inline void DBG_Breakpoint(String file, U32 line)
+00007 {
+00008         U8 c = 0;
+00009         printf("Breakpoint [%s line %d] ", file, (int)line);
+00010         c = getchar();
+00011 }
+00012 
+00013 inline void DBG_Assert(String file, U32 line, String cond_text, BOOL condition)
+00014 {
+00015         if(!condition)
+00016         {
+00017                 printf("Assertion Failure [%s line %d] (%s)\n", file, (int)line, cond_text);
+00018                 exit(1);
+00019         }
+00020 }
+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/dbg_8h.html b/flex-bison/mark1/docs/html/dbg_8h.html new file mode 100644 index 0000000..b32b7b0 --- /dev/null +++ b/flex-bison/mark1/docs/html/dbg_8h.html @@ -0,0 +1,282 @@ + + + + +Mark1: src/dbg/dbg.h File Reference + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + +
+
+ +
+
+
+ +
+
+ +
+

src/dbg/dbg.h File Reference

+
+
+
#include "common.h"
+
+Include dependency graph for dbg.h:
+
+
+
+
+This graph shows which files directly or indirectly include this file:
+
+
+ + +
+
+

Go to the source code of this file.

+ + + + + + + + + +

+Defines

#define DEBUG
#define DBG_BREAKPOINT()   DBG_Breakpoint(__FILE__, __LINE__)
#define DBG_ASSERT(cond)   DBG_Assert(__FILE__, __LINE__, QUOTE(cond), cond)
#define DBG_WATCH()

+Functions

void DBG_Breakpoint (String file, U32 line)
void DBG_Assert (String file, U32 line, String cond_text, BOOL condition)
+

Define Documentation

+ +
+
+ + + + + + + + +
#define DBG_ASSERT( cond)   DBG_Assert(__FILE__, __LINE__, QUOTE(cond), cond)
+
+
+ +

Definition at line 9 of file dbg.h.

+ +
+
+ +
+
+ + + + + + + +
#define DBG_BREAKPOINT()   DBG_Breakpoint(__FILE__, __LINE__)
+
+
+ +

Definition at line 8 of file dbg.h.

+ +
+
+ +
+
+ + + + + + + +
#define DBG_WATCH()
+
+
+ +

Definition at line 10 of file dbg.h.

+ +
+
+ +
+
+ + + + +
#define DEBUG
+
+
+ +

Definition at line 6 of file dbg.h.

+ +
+
+

Function Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void DBG_Assert (String file,
U32 line,
String cond_text,
BOOL condition 
) [inline]
+
+
+ +

Definition at line 13 of file dbg.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void DBG_Breakpoint (String file,
U32 line 
) [inline]
+
+
+ +

Definition at line 6 of file dbg.c.

+ +
+
+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/dbg_8h__dep__incl.map b/flex-bison/mark1/docs/html/dbg_8h__dep__incl.map new file mode 100644 index 0000000..9d8cae7 --- /dev/null +++ b/flex-bison/mark1/docs/html/dbg_8h__dep__incl.map @@ -0,0 +1,3 @@ + + + diff --git a/flex-bison/mark1/docs/html/dbg_8h__dep__incl.md5 b/flex-bison/mark1/docs/html/dbg_8h__dep__incl.md5 new file mode 100644 index 0000000..11ffdee --- /dev/null +++ b/flex-bison/mark1/docs/html/dbg_8h__dep__incl.md5 @@ -0,0 +1 @@ +a9427d58787ee184b914bafea8d32a5d \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/dbg_8h__dep__incl.png b/flex-bison/mark1/docs/html/dbg_8h__dep__incl.png new file mode 100644 index 0000000..6de98bd Binary files /dev/null and b/flex-bison/mark1/docs/html/dbg_8h__dep__incl.png differ diff --git a/flex-bison/mark1/docs/html/dbg_8h__incl.map b/flex-bison/mark1/docs/html/dbg_8h__incl.map new file mode 100644 index 0000000..8be6a30 --- /dev/null +++ b/flex-bison/mark1/docs/html/dbg_8h__incl.map @@ -0,0 +1,2 @@ + + diff --git a/flex-bison/mark1/docs/html/dbg_8h__incl.md5 b/flex-bison/mark1/docs/html/dbg_8h__incl.md5 new file mode 100644 index 0000000..8fdf11b --- /dev/null +++ b/flex-bison/mark1/docs/html/dbg_8h__incl.md5 @@ -0,0 +1 @@ +436ced73c453ad9b364bd168401d24e1 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/dbg_8h__incl.png b/flex-bison/mark1/docs/html/dbg_8h__incl.png new file mode 100644 index 0000000..2cda27b Binary files /dev/null and b/flex-bison/mark1/docs/html/dbg_8h__incl.png differ diff --git a/flex-bison/mark1/docs/html/dbg_8h_source.html b/flex-bison/mark1/docs/html/dbg_8h_source.html new file mode 100644 index 0000000..17a447b --- /dev/null +++ b/flex-bison/mark1/docs/html/dbg_8h_source.html @@ -0,0 +1,130 @@ + + + + +Mark1: src/dbg/dbg.h Source File + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + +
+
+ +
+
+
+ +
+
+
+

src/dbg/dbg.h

+
+
+Go to the documentation of this file.
00001 #ifndef DBG_H
+00002 #define DBG_H
+00003 
+00004 #include "common.h"
+00005 
+00006 #define DEBUG
+00007 #ifdef DEBUG
+00008         #define DBG_BREAKPOINT() DBG_Breakpoint(__FILE__, __LINE__)
+00009         #define DBG_ASSERT(cond) DBG_Assert(__FILE__, __LINE__, QUOTE(cond), cond)
+00010         #define DBG_WATCH()
+00011 #else
+00012         #define DBG_BREAKPOINT()
+00013         #define DBG_ASSERT()
+00014         #define DBG_WATCH()
+00015 #endif
+00016 
+00017 inline void DBG_Breakpoint(String file, U32 line);
+00018 inline void DBG_Assert(String file, U32 line, String cond_text, BOOL condition);
+00019 
+00020 #endif
+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/doxygen.css b/flex-bison/mark1/docs/html/doxygen.css new file mode 100644 index 0000000..101c7a5 --- /dev/null +++ b/flex-bison/mark1/docs/html/doxygen.css @@ -0,0 +1,800 @@ +/* The standard CSS for doxygen */ + +body, table, div, p, dl { + font-family: Lucida Grande, Verdana, Geneva, Arial, sans-serif; + font-size: 12px; +} + +/* @group Heading Levels */ + +h1 { + font-size: 150%; +} + +h2 { + font-size: 120%; +} + +h3 { + font-size: 100%; +} + +dt { + font-weight: bold; +} + +div.multicol { + -moz-column-gap: 1em; + -webkit-column-gap: 1em; + -moz-column-count: 3; + -webkit-column-count: 3; +} + +p.startli, p.startdd, p.starttd { + margin-top: 2px; +} + +p.endli { + margin-bottom: 0px; +} + +p.enddd { + margin-bottom: 4px; +} + +p.endtd { + margin-bottom: 2px; +} + +/* @end */ + +caption { + font-weight: bold; +} + +span.legend { + font-size: 70%; + text-align: center; +} + +h3.version { + font-size: 90%; + text-align: center; +} + +div.qindex, div.navtab{ + background-color: #EBEFF6; + border: 1px solid #A3B4D7; + text-align: center; + margin: 2px; + padding: 2px; +} + +div.qindex, div.navpath { + width: 100%; + line-height: 140%; +} + +div.navtab { + margin-right: 15px; +} + +/* @group Link Styling */ + +a { + color: #3D578C; + font-weight: normal; + text-decoration: none; +} + +.contents a:visited { + color: #4665A2; +} + +a:hover { + text-decoration: underline; +} + +a.qindex { + font-weight: bold; +} + +a.qindexHL { + font-weight: bold; + background-color: #9CAFD4; + color: #ffffff; + border: 1px double #869DCA; +} + +.contents a.qindexHL:visited { + color: #ffffff; +} + +a.el { + font-weight: bold; +} + +a.elRef { +} + +a.code { + color: #4665A2; +} + +a.codeRef { + color: #4665A2; +} + +/* @end */ + +dl.el { + margin-left: -1cm; +} + +.fragment { + font-family: monospace, fixed; + font-size: 105%; +} + +pre.fragment { + border: 1px solid #C4CFE5; + background-color: #FBFCFD; + padding: 4px 6px; + margin: 4px 8px 4px 2px; + overflow: auto; + word-wrap: break-word; + font-size: 9pt; + line-height: 125%; +} + +div.ah { + background-color: black; + font-weight: bold; + color: #ffffff; + margin-bottom: 3px; + margin-top: 3px; + padding: 0.2em; + border: solid thin #333; + border-radius: 0.5em; + -webkit-border-radius: .5em; + -moz-border-radius: .5em; + box-shadow: 2px 2px 3px #999; + -webkit-box-shadow: 2px 2px 3px #999; + -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px; + background-image: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#000),color-stop(0.3, #444)); + background-image: -moz-linear-gradient(center top, #eee 0%, #444 40%, #000); +} + +div.groupHeader { + margin-left: 16px; + margin-top: 12px; + font-weight: bold; +} + +div.groupText { + margin-left: 16px; + font-style: italic; +} + +body { + background: white; + color: black; + margin: 0; +} + +div.contents { + margin-top: 10px; + margin-left: 10px; + margin-right: 10px; +} + +td.indexkey { + background-color: #EBEFF6; + font-weight: bold; + border: 1px solid #C4CFE5; + margin: 2px 0px 2px 0; + padding: 2px 10px; +} + +td.indexvalue { + background-color: #EBEFF6; + border: 1px solid #C4CFE5; + padding: 2px 10px; + margin: 2px 0px; +} + +tr.memlist { + background-color: #EEF1F7; +} + +p.formulaDsp { + text-align: center; +} + +img.formulaDsp { + +} + +img.formulaInl { + vertical-align: middle; +} + +div.center { + text-align: center; + margin-top: 0px; + margin-bottom: 0px; + padding: 0px; +} + +div.center img { + border: 0px; +} + +address.footer { + text-align: right; + padding-right: 12px; +} + +img.footer { + border: 0px; + vertical-align: middle; +} + +/* @group Code Colorization */ + +span.keyword { + color: #008000 +} + +span.keywordtype { + color: #604020 +} + +span.keywordflow { + color: #e08000 +} + +span.comment { + color: #800000 +} + +span.preprocessor { + color: #806020 +} + +span.stringliteral { + color: #002080 +} + +span.charliteral { + color: #008080 +} + +span.vhdldigit { + color: #ff00ff +} + +span.vhdlchar { + color: #000000 +} + +span.vhdlkeyword { + color: #700070 +} + +span.vhdllogic { + color: #ff0000 +} + +/* @end */ + +/* +.search { + color: #003399; + font-weight: bold; +} + +form.search { + margin-bottom: 0px; + margin-top: 0px; +} + +input.search { + font-size: 75%; + color: #000080; + font-weight: normal; + background-color: #e8eef2; +} +*/ + +td.tiny { + font-size: 75%; +} + +.dirtab { + padding: 4px; + border-collapse: collapse; + border: 1px solid #A3B4D7; +} + +th.dirtab { + background: #EBEFF6; + font-weight: bold; +} + +hr { + height: 0px; + border: none; + border-top: 1px solid #4A6AAA; +} + +hr.footer { + height: 1px; +} + +/* @group Member Descriptions */ + +table.memberdecls { + border-spacing: 0px; + padding: 0px; +} + +.mdescLeft, .mdescRight, +.memItemLeft, .memItemRight, +.memTemplItemLeft, .memTemplItemRight, .memTemplParams { + background-color: #F9FAFC; + border: none; + margin: 4px; + padding: 1px 0 0 8px; +} + +.mdescLeft, .mdescRight { + padding: 0px 8px 4px 8px; + color: #555; +} + +.memItemLeft, .memItemRight, .memTemplParams { + border-top: 1px solid #C4CFE5; +} + +.memItemLeft, .memTemplItemLeft { + white-space: nowrap; +} + +.memTemplParams { + color: #4665A2; + white-space: nowrap; +} + +/* @end */ + +/* @group Member Details */ + +/* Styles for detailed member documentation */ + +.memtemplate { + font-size: 80%; + color: #4665A2; + font-weight: normal; + margin-left: 9px; +} + +.memnav { + background-color: #EBEFF6; + border: 1px solid #A3B4D7; + text-align: center; + margin: 2px; + margin-right: 15px; + padding: 2px; +} + +.memitem { + padding: 0; + margin-bottom: 10px; +} + +.memname { + white-space: nowrap; + font-weight: bold; + margin-left: 6px; +} + +.memproto { + border-top: 1px solid #A8B8D9; + border-left: 1px solid #A8B8D9; + border-right: 1px solid #A8B8D9; + padding: 6px 0px 6px 0px; + color: #253555; + font-weight: bold; + text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); + /* opera specific markup */ + box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); + border-top-right-radius: 8px; + border-top-left-radius: 8px; + /* firefox specific markup */ + -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; + -moz-border-radius-topright: 8px; + -moz-border-radius-topleft: 8px; + /* webkit specific markup */ + -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); + -webkit-border-top-right-radius: 8px; + -webkit-border-top-left-radius: 8px; + background-image:url('nav_f.png'); + background-repeat:repeat-x; + background-color: #E2E8F2; + +} + +.memdoc { + border-bottom: 1px solid #A8B8D9; + border-left: 1px solid #A8B8D9; + border-right: 1px solid #A8B8D9; + padding: 2px 5px; + background-color: #FBFCFD; + border-top-width: 0; + /* opera specific markup */ + border-bottom-left-radius: 8px; + border-bottom-right-radius: 8px; + box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); + /* firefox specific markup */ + -moz-border-radius-bottomleft: 8px; + -moz-border-radius-bottomright: 8px; + -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; + background-image: -moz-linear-gradient(center top, #FFFFFF 0%, #FFFFFF 60%, #F7F8FB 95%, #EEF1F7); + /* webkit specific markup */ + -webkit-border-bottom-left-radius: 8px; + -webkit-border-bottom-right-radius: 8px; + -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); + background-image: -webkit-gradient(linear,center top,center bottom,from(#FFFFFF), color-stop(0.6,#FFFFFF), color-stop(0.60,#FFFFFF), color-stop(0.95,#F7F8FB), to(#EEF1F7)); +} + +.paramkey { + text-align: right; +} + +.paramtype { + white-space: nowrap; +} + +.paramname { + color: #602020; + white-space: nowrap; +} +.paramname em { + font-style: normal; +} + +.params, .retval, .exception, .tparams { + border-spacing: 6px 2px; +} + +.params .paramname, .retval .paramname { + font-weight: bold; + vertical-align: top; +} + +.params .paramtype { + font-style: italic; + vertical-align: top; +} + +.params .paramdir { + font-family: "courier new",courier,monospace; + vertical-align: top; +} + + + + +/* @end */ + +/* @group Directory (tree) */ + +/* for the tree view */ + +.ftvtree { + font-family: sans-serif; + margin: 0px; +} + +/* these are for tree view when used as main index */ + +.directory { + font-size: 9pt; + font-weight: bold; + margin: 5px; +} + +.directory h3 { + margin: 0px; + margin-top: 1em; + font-size: 11pt; +} + +/* +The following two styles can be used to replace the root node title +with an image of your choice. Simply uncomment the next two styles, +specify the name of your image and be sure to set 'height' to the +proper pixel height of your image. +*/ + +/* +.directory h3.swap { + height: 61px; + background-repeat: no-repeat; + background-image: url("yourimage.gif"); +} +.directory h3.swap span { + display: none; +} +*/ + +.directory > h3 { + margin-top: 0; +} + +.directory p { + margin: 0px; + white-space: nowrap; +} + +.directory div { + display: none; + margin: 0px; +} + +.directory img { + vertical-align: -30%; +} + +/* these are for tree view when not used as main index */ + +.directory-alt { + font-size: 100%; + font-weight: bold; +} + +.directory-alt h3 { + margin: 0px; + margin-top: 1em; + font-size: 11pt; +} + +.directory-alt > h3 { + margin-top: 0; +} + +.directory-alt p { + margin: 0px; + white-space: nowrap; +} + +.directory-alt div { + display: none; + margin: 0px; +} + +.directory-alt img { + vertical-align: -30%; +} + +/* @end */ + +div.dynheader { + margin-top: 8px; +} + +address { + font-style: normal; + color: #2A3D61; +} + +table.doxtable { + border-collapse:collapse; +} + +table.doxtable td, table.doxtable th { + border: 1px solid #2D4068; + padding: 3px 7px 2px; +} + +table.doxtable th { + background-color: #374F7F; + color: #FFFFFF; + font-size: 110%; + padding-bottom: 4px; + padding-top: 5px; + text-align:left; +} + +.tabsearch { + top: 0px; + left: 10px; + height: 36px; + background-image: url('tab_b.png'); + z-index: 101; + overflow: hidden; + font-size: 13px; +} + +.navpath ul +{ + font-size: 11px; + background-image:url('tab_b.png'); + background-repeat:repeat-x; + height:30px; + line-height:30px; + color:#8AA0CC; + border:solid 1px #C2CDE4; + overflow:hidden; + margin:0px; + padding:0px; +} + +.navpath li +{ + list-style-type:none; + float:left; + padding-left:10px; + padding-right:15px; + background-image:url('bc_s.png'); + background-repeat:no-repeat; + background-position:right; + color:#364D7C; +} + +.navpath li.navelem a +{ + height:32px; + display:block; + text-decoration: none; + outline: none; +} + +.navpath li.navelem a:hover +{ + color:#6884BD; +} + +.navpath li.footer +{ + list-style-type:none; + float:right; + padding-left:10px; + padding-right:15px; + background-image:none; + background-repeat:no-repeat; + background-position:right; + color:#364D7C; + font-size: 8pt; +} + + +div.summary +{ + float: right; + font-size: 8pt; + padding-right: 5px; + width: 50%; + text-align: right; +} + +div.summary a +{ + white-space: nowrap; +} + +div.ingroups +{ + font-size: 8pt; + padding-left: 5px; + width: 50%; + text-align: left; +} + +div.ingroups a +{ + white-space: nowrap; +} + +div.header +{ + background-image:url('nav_h.png'); + background-repeat:repeat-x; + background-color: #F9FAFC; + margin: 0px; + border-bottom: 1px solid #C4CFE5; +} + +div.headertitle +{ + padding: 5px 5px 5px 10px; +} + +dl +{ + padding: 0 0 0 10px; +} + +dl.note, dl.warning, dl.attention, dl.pre, dl.post, dl.invariant, dl.deprecated, dl.todo, dl.test, dl.bug +{ + border-left:4px solid; + padding: 0 0 0 6px; +} + +dl.note +{ + border-color: #D0D000; +} + +dl.warning, dl.attention +{ + border-color: #FF0000; +} + +dl.pre, dl.post, dl.invariant +{ + border-color: #00D000; +} + +dl.deprecated +{ + border-color: #505050; +} + +dl.todo +{ + border-color: #00C0E0; +} + +dl.test +{ + border-color: #3030E0; +} + +dl.bug +{ + border-color: #C08050; +} + +#projectlogo +{ + text-align: center; + vertical-align: bottom; + border-collapse: separate; +} + +#projectlogo img +{ + border: 0px none; +} + +#projectname +{ + font: 300% arial,sans-serif; + margin: 0px; + padding: 0px; +} + +#projectbrief +{ + font: 120% arial,sans-serif; + margin: 0px; + padding: 0px; +} + +#projectnumber +{ + font: 50% arial,sans-serif; + margin: 0px; + padding: 0px; +} + +#titlearea +{ + padding: 0px; + margin: 0px; + width: 100%; + border-bottom: 1px solid #5373B4; +} + diff --git a/flex-bison/mark1/docs/html/doxygen.png b/flex-bison/mark1/docs/html/doxygen.png new file mode 100644 index 0000000..635ed52 Binary files /dev/null and b/flex-bison/mark1/docs/html/doxygen.png differ diff --git a/flex-bison/mark1/docs/html/files.html b/flex-bison/mark1/docs/html/files.html new file mode 100644 index 0000000..6359509 --- /dev/null +++ b/flex-bison/mark1/docs/html/files.html @@ -0,0 +1,131 @@ + + + + +Mark1: File List + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + +
+
+ +
+
+
+ +
+
+
+

File List

+
+
+
Here is a list of all files with brief descriptions:
+ + + + + + + + + + + + + + + + + + + + +
src/common.h [code]
src/main.c [code]
src/cl_options/cl_options.c [code]
src/cl_options/cl_options.h [code]
src/data_structures/ast/ast.c [code]
src/data_structures/ast/ast.h [code]
src/data_structures/ast/ast_debug.c [code]
src/data_structures/ast/ast_debug.h [code]
src/data_structures/linked_list/linked_list.c [code]
src/data_structures/linked_list/linked_list.h [code]
src/dbg/dbg.c [code]
src/dbg/dbg.h [code]
src/il_opcodes/il_opcodes.c [code]
src/il_opcodes/il_opcodes.h [code]
src/parser/parser.c [code]
src/parser/parser.h [code]
src/parser/grammar/grammar.tab.c [code]
src/parser/grammar/grammar.tab.h [code]
src/parser/lexer/lex.yy.c [code]
src/parser/lexer/lex.yy.h [code]
+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/ftv2blank.png b/flex-bison/mark1/docs/html/ftv2blank.png new file mode 100644 index 0000000..3b7a29c Binary files /dev/null and b/flex-bison/mark1/docs/html/ftv2blank.png differ diff --git a/flex-bison/mark1/docs/html/ftv2doc.png b/flex-bison/mark1/docs/html/ftv2doc.png new file mode 100644 index 0000000..310e441 Binary files /dev/null and b/flex-bison/mark1/docs/html/ftv2doc.png differ diff --git a/flex-bison/mark1/docs/html/ftv2folderclosed.png b/flex-bison/mark1/docs/html/ftv2folderclosed.png new file mode 100644 index 0000000..79aeaf7 Binary files /dev/null and b/flex-bison/mark1/docs/html/ftv2folderclosed.png differ diff --git a/flex-bison/mark1/docs/html/ftv2folderopen.png b/flex-bison/mark1/docs/html/ftv2folderopen.png new file mode 100644 index 0000000..1b703dd Binary files /dev/null and b/flex-bison/mark1/docs/html/ftv2folderopen.png differ diff --git a/flex-bison/mark1/docs/html/ftv2lastnode.png b/flex-bison/mark1/docs/html/ftv2lastnode.png new file mode 100644 index 0000000..3b7a29c Binary files /dev/null and b/flex-bison/mark1/docs/html/ftv2lastnode.png differ diff --git a/flex-bison/mark1/docs/html/ftv2link.png b/flex-bison/mark1/docs/html/ftv2link.png new file mode 100644 index 0000000..310e441 Binary files /dev/null and b/flex-bison/mark1/docs/html/ftv2link.png differ diff --git a/flex-bison/mark1/docs/html/ftv2mlastnode.png b/flex-bison/mark1/docs/html/ftv2mlastnode.png new file mode 100644 index 0000000..ec51f17 Binary files /dev/null and b/flex-bison/mark1/docs/html/ftv2mlastnode.png differ diff --git a/flex-bison/mark1/docs/html/ftv2mnode.png b/flex-bison/mark1/docs/html/ftv2mnode.png new file mode 100644 index 0000000..ec51f17 Binary files /dev/null and b/flex-bison/mark1/docs/html/ftv2mnode.png differ diff --git a/flex-bison/mark1/docs/html/ftv2node.png b/flex-bison/mark1/docs/html/ftv2node.png new file mode 100644 index 0000000..3b7a29c Binary files /dev/null and b/flex-bison/mark1/docs/html/ftv2node.png differ diff --git a/flex-bison/mark1/docs/html/ftv2plastnode.png b/flex-bison/mark1/docs/html/ftv2plastnode.png new file mode 100644 index 0000000..270a965 Binary files /dev/null and b/flex-bison/mark1/docs/html/ftv2plastnode.png differ diff --git a/flex-bison/mark1/docs/html/ftv2pnode.png b/flex-bison/mark1/docs/html/ftv2pnode.png new file mode 100644 index 0000000..270a965 Binary files /dev/null and b/flex-bison/mark1/docs/html/ftv2pnode.png differ diff --git a/flex-bison/mark1/docs/html/ftv2splitbar.png b/flex-bison/mark1/docs/html/ftv2splitbar.png new file mode 100644 index 0000000..f60a527 Binary files /dev/null and b/flex-bison/mark1/docs/html/ftv2splitbar.png differ diff --git a/flex-bison/mark1/docs/html/ftv2vertline.png b/flex-bison/mark1/docs/html/ftv2vertline.png new file mode 100644 index 0000000..3b7a29c Binary files /dev/null and b/flex-bison/mark1/docs/html/ftv2vertline.png differ diff --git a/flex-bison/mark1/docs/html/functions.html b/flex-bison/mark1/docs/html/functions.html new file mode 100644 index 0000000..36c617b --- /dev/null +++ b/flex-bison/mark1/docs/html/functions.html @@ -0,0 +1,345 @@ + + + + +Mark1: Data Fields + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + + + +
+
+ +
+
+
+ +
+
+
Here is a list of all struct and union fields with links to the structures/unions they belong to:
+ +

- a -

+ + +

- b -

+ + +

- c -

+ + +

- d -

+ + +

- f -

+ + +

- i -

+ + +

- l -

+ + +

- m -

+ + +

- n -

+ + +

- o -

+ + +

- s -

+ + +

- v -

+ + +

- y -

+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/functions_vars.html b/flex-bison/mark1/docs/html/functions_vars.html new file mode 100644 index 0000000..4e4c4bd --- /dev/null +++ b/flex-bison/mark1/docs/html/functions_vars.html @@ -0,0 +1,345 @@ + + + + +Mark1: Data Fields - Variables + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + + + +
+
+ +
+
+
+ +
+
+  + +

- a -

+ + +

- b -

+ + +

- c -

+ + +

- d -

+ + +

- f -

+ + +

- i -

+ + +

- l -

+ + +

- m -

+ + +

- n -

+ + +

- o -

+ + +

- s -

+ + +

- v -

+ + +

- y -

+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/globals.html b/flex-bison/mark1/docs/html/globals.html new file mode 100644 index 0000000..43fdf46 --- /dev/null +++ b/flex-bison/mark1/docs/html/globals.html @@ -0,0 +1,149 @@ + + + + +Mark1: Globals + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + + + +
+
+ +
+
+
+ +
+
+
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:
+ +

- _ -

+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/globals_0x61.html b/flex-bison/mark1/docs/html/globals_0x61.html new file mode 100644 index 0000000..ea69f34 --- /dev/null +++ b/flex-bison/mark1/docs/html/globals_0x61.html @@ -0,0 +1,161 @@ + + + + +Mark1: Globals + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + + + +
+
+ +
+
+
+ +
+
+
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:
+ +

- a -

+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/globals_0x62.html b/flex-bison/mark1/docs/html/globals_0x62.html new file mode 100644 index 0000000..c384696 --- /dev/null +++ b/flex-bison/mark1/docs/html/globals_0x62.html @@ -0,0 +1,254 @@ + + + + +Mark1: Globals + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + + + +
+
+ +
+
+
+ +
+
+
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:
+ +

- b -

+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/globals_0x63.html b/flex-bison/mark1/docs/html/globals_0x63.html new file mode 100644 index 0000000..a0cafdb --- /dev/null +++ b/flex-bison/mark1/docs/html/globals_0x63.html @@ -0,0 +1,178 @@ + + + + +Mark1: Globals + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + + + +
+
+ +
+
+
+ +
+
+
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:
+ +

- c -

+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/globals_0x64.html b/flex-bison/mark1/docs/html/globals_0x64.html new file mode 100644 index 0000000..d45c6da --- /dev/null +++ b/flex-bison/mark1/docs/html/globals_0x64.html @@ -0,0 +1,178 @@ + + + + +Mark1: Globals + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + + + +
+
+ +
+
+
+ +
+
+
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:
+ +

- d -

+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/globals_0x65.html b/flex-bison/mark1/docs/html/globals_0x65.html new file mode 100644 index 0000000..753cdcb --- /dev/null +++ b/flex-bison/mark1/docs/html/globals_0x65.html @@ -0,0 +1,161 @@ + + + + +Mark1: Globals + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + + + +
+
+ +
+
+
+ +
+
+
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:
+ +

- e -

+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/globals_0x66.html b/flex-bison/mark1/docs/html/globals_0x66.html new file mode 100644 index 0000000..ab7b6bc --- /dev/null +++ b/flex-bison/mark1/docs/html/globals_0x66.html @@ -0,0 +1,199 @@ + + + + +Mark1: Globals + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + + + +
+
+ +
+
+
+ +
+
+
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:
+ +

- f -

+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/globals_0x67.html b/flex-bison/mark1/docs/html/globals_0x67.html new file mode 100644 index 0000000..6355634 --- /dev/null +++ b/flex-bison/mark1/docs/html/globals_0x67.html @@ -0,0 +1,152 @@ + + + + +Mark1: Globals + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + + + +
+
+ +
+
+
+ +
+
+
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:
+ +

- g -

+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/globals_0x68.html b/flex-bison/mark1/docs/html/globals_0x68.html new file mode 100644 index 0000000..bf843bd --- /dev/null +++ b/flex-bison/mark1/docs/html/globals_0x68.html @@ -0,0 +1,164 @@ + + + + +Mark1: Globals + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + + + +
+
+ +
+
+
+ +
+
+
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:
+ +

- h -

+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/globals_0x69.html b/flex-bison/mark1/docs/html/globals_0x69.html new file mode 100644 index 0000000..1a83b8b --- /dev/null +++ b/flex-bison/mark1/docs/html/globals_0x69.html @@ -0,0 +1,203 @@ + + + + +Mark1: Globals + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + + + +
+
+ +
+
+
+ +
+
+
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:
+ +

- i -

+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/globals_0x6c.html b/flex-bison/mark1/docs/html/globals_0x6c.html new file mode 100644 index 0000000..d1d2177 --- /dev/null +++ b/flex-bison/mark1/docs/html/globals_0x6c.html @@ -0,0 +1,198 @@ + + + + +Mark1: Globals + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + + + +
+
+ +
+
+
+ +
+
+
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:
+ +

- l -

+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/globals_0x6d.html b/flex-bison/mark1/docs/html/globals_0x6d.html new file mode 100644 index 0000000..6bbee6d --- /dev/null +++ b/flex-bison/mark1/docs/html/globals_0x6d.html @@ -0,0 +1,164 @@ + + + + +Mark1: Globals + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + + + +
+
+ +
+
+
+ +
+
+
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:
+ +

- m -

+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/globals_0x6e.html b/flex-bison/mark1/docs/html/globals_0x6e.html new file mode 100644 index 0000000..f745d56 --- /dev/null +++ b/flex-bison/mark1/docs/html/globals_0x6e.html @@ -0,0 +1,172 @@ + + + + +Mark1: Globals + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + + + +
+
+ +
+
+
+ +
+
+
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:
+ +

- n -

+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/globals_0x6f.html b/flex-bison/mark1/docs/html/globals_0x6f.html new file mode 100644 index 0000000..75f77ef --- /dev/null +++ b/flex-bison/mark1/docs/html/globals_0x6f.html @@ -0,0 +1,155 @@ + + + + +Mark1: Globals + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + + + +
+
+ +
+
+
+ +
+
+
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:
+ +

- o -

+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/globals_0x70.html b/flex-bison/mark1/docs/html/globals_0x70.html new file mode 100644 index 0000000..a0a98fe --- /dev/null +++ b/flex-bison/mark1/docs/html/globals_0x70.html @@ -0,0 +1,169 @@ + + + + +Mark1: Globals + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + + + +
+
+ +
+
+
+ +
+
+
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:
+ +

- p -

+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/globals_0x71.html b/flex-bison/mark1/docs/html/globals_0x71.html new file mode 100644 index 0000000..8bd201e --- /dev/null +++ b/flex-bison/mark1/docs/html/globals_0x71.html @@ -0,0 +1,149 @@ + + + + +Mark1: Globals + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + + + +
+
+ +
+
+
+ +
+
+
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:
+ +

- q -

+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/globals_0x72.html b/flex-bison/mark1/docs/html/globals_0x72.html new file mode 100644 index 0000000..3d056b0 --- /dev/null +++ b/flex-bison/mark1/docs/html/globals_0x72.html @@ -0,0 +1,152 @@ + + + + +Mark1: Globals + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + + + +
+
+ +
+
+
+ +
+
+
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:
+ +

- r -

+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/globals_0x73.html b/flex-bison/mark1/docs/html/globals_0x73.html new file mode 100644 index 0000000..39c401f --- /dev/null +++ b/flex-bison/mark1/docs/html/globals_0x73.html @@ -0,0 +1,176 @@ + + + + +Mark1: Globals + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + + + +
+
+ +
+
+
+ +
+
+
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:
+ +

- s -

+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/globals_0x74.html b/flex-bison/mark1/docs/html/globals_0x74.html new file mode 100644 index 0000000..9a2cabd --- /dev/null +++ b/flex-bison/mark1/docs/html/globals_0x74.html @@ -0,0 +1,204 @@ + + + + +Mark1: Globals + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + + + +
+
+ +
+
+
+ +
+
+
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:
+ +

- t -

+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/globals_0x75.html b/flex-bison/mark1/docs/html/globals_0x75.html new file mode 100644 index 0000000..4e01e1c --- /dev/null +++ b/flex-bison/mark1/docs/html/globals_0x75.html @@ -0,0 +1,170 @@ + + + + +Mark1: Globals + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + + + +
+
+ +
+
+
+ +
+
+
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:
+ +

- u -

+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/globals_0x76.html b/flex-bison/mark1/docs/html/globals_0x76.html new file mode 100644 index 0000000..b8a1f59 --- /dev/null +++ b/flex-bison/mark1/docs/html/globals_0x76.html @@ -0,0 +1,174 @@ + + + + +Mark1: Globals + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + + + +
+
+ +
+
+
+ +
+
+
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:
+ +

- v -

+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/globals_0x79.html b/flex-bison/mark1/docs/html/globals_0x79.html new file mode 100644 index 0000000..a797735 --- /dev/null +++ b/flex-bison/mark1/docs/html/globals_0x79.html @@ -0,0 +1,735 @@ + + + + +Mark1: Globals + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + + + +
+
+ +
+
+
+ +
+
+
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:
+ +

- y -

+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/globals_defs.html b/flex-bison/mark1/docs/html/globals_defs.html new file mode 100644 index 0000000..0f001cd --- /dev/null +++ b/flex-bison/mark1/docs/html/globals_defs.html @@ -0,0 +1,145 @@ + + + + +Mark1: Globals + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + + + +
+
+ +
+
+
+ +
+
+  + +

- _ -

+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/globals_defs_0x61.html b/flex-bison/mark1/docs/html/globals_defs_0x61.html new file mode 100644 index 0000000..9773066 --- /dev/null +++ b/flex-bison/mark1/docs/html/globals_defs_0x61.html @@ -0,0 +1,145 @@ + + + + +Mark1: Globals + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + + + +
+
+ +
+
+
+ +
+
+  + +

- a -

+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/globals_defs_0x62.html b/flex-bison/mark1/docs/html/globals_defs_0x62.html new file mode 100644 index 0000000..68ba041 --- /dev/null +++ b/flex-bison/mark1/docs/html/globals_defs_0x62.html @@ -0,0 +1,241 @@ + + + + +Mark1: Globals + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + + + +
+
+ +
+
+
+ +
+
+  + +

- b -

+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/globals_defs_0x64.html b/flex-bison/mark1/docs/html/globals_defs_0x64.html new file mode 100644 index 0000000..0e31d92 --- /dev/null +++ b/flex-bison/mark1/docs/html/globals_defs_0x64.html @@ -0,0 +1,154 @@ + + + + +Mark1: Globals + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + + + +
+
+ +
+
+
+ +
+
+  + +

- d -

+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/globals_defs_0x65.html b/flex-bison/mark1/docs/html/globals_defs_0x65.html new file mode 100644 index 0000000..88d5570 --- /dev/null +++ b/flex-bison/mark1/docs/html/globals_defs_0x65.html @@ -0,0 +1,154 @@ + + + + +Mark1: Globals + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + + + +
+
+ +
+
+
+ +
+
+  + +

- e -

+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/globals_defs_0x66.html b/flex-bison/mark1/docs/html/globals_defs_0x66.html new file mode 100644 index 0000000..b0b1595 --- /dev/null +++ b/flex-bison/mark1/docs/html/globals_defs_0x66.html @@ -0,0 +1,153 @@ + + + + +Mark1: Globals + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + + + +
+
+ +
+
+
+ +
+
+  + +

- f -

+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/globals_defs_0x68.html b/flex-bison/mark1/docs/html/globals_defs_0x68.html new file mode 100644 index 0000000..e944ce2 --- /dev/null +++ b/flex-bison/mark1/docs/html/globals_defs_0x68.html @@ -0,0 +1,148 @@ + + + + +Mark1: Globals + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + + + +
+
+ +
+
+
+ +
+
+  + +

- h -

+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/globals_defs_0x69.html b/flex-bison/mark1/docs/html/globals_defs_0x69.html new file mode 100644 index 0000000..93622ae --- /dev/null +++ b/flex-bison/mark1/docs/html/globals_defs_0x69.html @@ -0,0 +1,181 @@ + + + + +Mark1: Globals + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + + + +
+
+ +
+
+
+ +
+
+  + +

- i -

+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/globals_defs_0x6c.html b/flex-bison/mark1/docs/html/globals_defs_0x6c.html new file mode 100644 index 0000000..938a501 --- /dev/null +++ b/flex-bison/mark1/docs/html/globals_defs_0x6c.html @@ -0,0 +1,154 @@ + + + + +Mark1: Globals + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + + + +
+
+ +
+
+
+ +
+
+  + +

- l -

+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/globals_defs_0x6d.html b/flex-bison/mark1/docs/html/globals_defs_0x6d.html new file mode 100644 index 0000000..fabb16b --- /dev/null +++ b/flex-bison/mark1/docs/html/globals_defs_0x6d.html @@ -0,0 +1,148 @@ + + + + +Mark1: Globals + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + + + +
+
+ +
+
+
+ +
+
+  + +

- m -

+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/globals_defs_0x6e.html b/flex-bison/mark1/docs/html/globals_defs_0x6e.html new file mode 100644 index 0000000..dffdef0 --- /dev/null +++ b/flex-bison/mark1/docs/html/globals_defs_0x6e.html @@ -0,0 +1,151 @@ + + + + +Mark1: Globals + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + + + +
+
+ +
+
+
+ +
+
+  + +

- n -

+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/globals_defs_0x70.html b/flex-bison/mark1/docs/html/globals_defs_0x70.html new file mode 100644 index 0000000..1353f7f --- /dev/null +++ b/flex-bison/mark1/docs/html/globals_defs_0x70.html @@ -0,0 +1,145 @@ + + + + +Mark1: Globals + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + + + +
+
+ +
+
+
+ +
+
+  + +

- p -

+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/globals_defs_0x71.html b/flex-bison/mark1/docs/html/globals_defs_0x71.html new file mode 100644 index 0000000..da18e00 --- /dev/null +++ b/flex-bison/mark1/docs/html/globals_defs_0x71.html @@ -0,0 +1,145 @@ + + + + +Mark1: Globals + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + + + +
+
+ +
+
+
+ +
+
+  + +

- q -

+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/globals_defs_0x72.html b/flex-bison/mark1/docs/html/globals_defs_0x72.html new file mode 100644 index 0000000..6ec1bf9 --- /dev/null +++ b/flex-bison/mark1/docs/html/globals_defs_0x72.html @@ -0,0 +1,145 @@ + + + + +Mark1: Globals + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + + + +
+
+ +
+
+
+ +
+
+  + +

- r -

+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/globals_defs_0x73.html b/flex-bison/mark1/docs/html/globals_defs_0x73.html new file mode 100644 index 0000000..dd74ad2 --- /dev/null +++ b/flex-bison/mark1/docs/html/globals_defs_0x73.html @@ -0,0 +1,148 @@ + + + + +Mark1: Globals + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + + + +
+
+ +
+
+
+ +
+
+  + +

- s -

+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/globals_defs_0x75.html b/flex-bison/mark1/docs/html/globals_defs_0x75.html new file mode 100644 index 0000000..f90c193 --- /dev/null +++ b/flex-bison/mark1/docs/html/globals_defs_0x75.html @@ -0,0 +1,157 @@ + + + + +Mark1: Globals + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + + + +
+
+ +
+
+
+ +
+
+  + +

- u -

+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/globals_defs_0x76.html b/flex-bison/mark1/docs/html/globals_defs_0x76.html new file mode 100644 index 0000000..cf02a5c --- /dev/null +++ b/flex-bison/mark1/docs/html/globals_defs_0x76.html @@ -0,0 +1,154 @@ + + + + +Mark1: Globals + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + + + +
+
+ +
+
+
+ +
+
+  + +

- v -

+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/globals_defs_0x79.html b/flex-bison/mark1/docs/html/globals_defs_0x79.html new file mode 100644 index 0000000..f9663cd --- /dev/null +++ b/flex-bison/mark1/docs/html/globals_defs_0x79.html @@ -0,0 +1,549 @@ + + + + +Mark1: Globals + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + + + +
+
+ +
+
+
+ +
+
+  + +

- y -

+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/globals_enum.html b/flex-bison/mark1/docs/html/globals_enum.html new file mode 100644 index 0000000..6dabfc1 --- /dev/null +++ b/flex-bison/mark1/docs/html/globals_enum.html @@ -0,0 +1,128 @@ + + + + +Mark1: Globals + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + + +
+
+ +
+
+
+ +
+
+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/globals_eval.html b/flex-bison/mark1/docs/html/globals_eval.html new file mode 100644 index 0000000..77c35cf --- /dev/null +++ b/flex-bison/mark1/docs/html/globals_eval.html @@ -0,0 +1,323 @@ + + + + +Mark1: Globals + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + + + +
+
+ +
+
+
+ +
+
+  + +

- a -

+ + +

- b -

+ + +

- d -

+ + +

- e -

+ + +

- f -

+ + +

- g -

+ + +

- i -

+ + +

- l -

+ + +

- m -

+ + +

- n -

+ + +

- o -

+ + +

- r -

+ + +

- s -

+ + +

- t -

+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/globals_func.html b/flex-bison/mark1/docs/html/globals_func.html new file mode 100644 index 0000000..f134172 --- /dev/null +++ b/flex-bison/mark1/docs/html/globals_func.html @@ -0,0 +1,456 @@ + + + + +Mark1: Globals + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + + + +
+
+ +
+
+
+ +
+
+  + +

- b -

+ + +

- c -

+ + +

- d -

+ + +

- h -

+ + +

- i -

+ + +

- l -

+ + +

- m -

+ + +

- n -

+ + +

- p -

+ + +

- v -

+ + +

- y -

+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/globals_type.html b/flex-bison/mark1/docs/html/globals_type.html new file mode 100644 index 0000000..f254fca --- /dev/null +++ b/flex-bison/mark1/docs/html/globals_type.html @@ -0,0 +1,244 @@ + + + + +Mark1: Globals + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + + + +
+
+ +
+
+
+ +
+
+  + +

- f -

+ + +

- l -

+ + +

- n -

    +
  • NodeType_T +: ast.h +
  • +
+ + +

- s -

+ + +

- u -

+ + +

- y -

+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/globals_vars.html b/flex-bison/mark1/docs/html/globals_vars.html new file mode 100644 index 0000000..58e64fb --- /dev/null +++ b/flex-bison/mark1/docs/html/globals_vars.html @@ -0,0 +1,142 @@ + + + + +Mark1: Globals + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + + +
+
+ +
+
+
+ +
+
+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/grammar_8tab_8c.html b/flex-bison/mark1/docs/html/grammar_8tab_8c.html new file mode 100644 index 0000000..a7cae65 --- /dev/null +++ b/flex-bison/mark1/docs/html/grammar_8tab_8c.html @@ -0,0 +1,1611 @@ + + + + +Mark1: src/parser/grammar/grammar.tab.c File Reference + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + +
+
+ +
+
+
+ +
+
+ +
+

src/parser/grammar/grammar.tab.c File Reference

+
+
+
#include <stdio.h>
+#include "ast.h"
+#include "ast_debug.h"
+#include "parser.h"
+#include "lex.yy.h"
+
+Include dependency graph for grammar.tab.c:
+
+
+
+
+

Go to the source code of this file.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Data Structures

union  YYSTYPE
union  yyalloc

+Defines

#define YYBISON   1
#define YYBISON_VERSION   "2.4.2"
#define YYSKELETON_NAME   "yacc.c"
#define YYPURE   1
#define YYPUSH   0
#define YYPULL   1
#define YYLSP_NEEDED   0
#define YYLEX_PARAM   context->lexinfo
#define YYDEBUG   0
#define YYERROR_VERBOSE   0
#define YYTOKEN_TABLE   0
#define YYTOKENTYPE
#define YYSTYPE_IS_TRIVIAL   1
#define yystype   YYSTYPE
#define YYSTYPE_IS_DECLARED   1
#define YYSIZE_T   unsigned int
#define YYSIZE_MAXIMUM   ((YYSIZE_T) -1)
#define YY_(msgid)   msgid
#define YYUSE(e)   ((void) (e))
#define YYID(n)   (n)
#define YYSTACK_ALLOC   YYMALLOC
#define YYSTACK_FREE   YYFREE
#define YYSTACK_ALLOC_MAXIMUM   YYSIZE_MAXIMUM
#define YYMALLOC   malloc
#define YYFREE   free
#define YYSTACK_GAP_MAXIMUM   (sizeof (union yyalloc) - 1)
#define YYSTACK_BYTES(N)
#define YYCOPY(To, From, Count)
#define YYSTACK_RELOCATE(Stack_alloc, Stack)
#define YYFINAL   2
#define YYLAST   166
#define YYNTOKENS   32
#define YYNNTS   5
#define YYNRULES   25
#define YYNSTATES   49
#define YYUNDEFTOK   2
#define YYMAXUTOK   270
#define YYTRANSLATE(YYX)   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
#define YYPACT_NINF   -23
#define YYTABLE_NINF   -1
#define yyerrok   (yyerrstatus = 0)
#define yyclearin   (yychar = YYEMPTY)
#define YYEMPTY   (-2)
#define YYEOF   0
#define YYACCEPT   goto yyacceptlab
#define YYABORT   goto yyabortlab
#define YYERROR   goto yyerrorlab
#define YYFAIL   goto yyerrlab
#define YYRECOVERING()   (!!yyerrstatus)
#define YYBACKUP(Token, Value)
#define YYTERROR   1
#define YYERRCODE   256
#define YYRHSLOC(Rhs, K)   ((Rhs)[K])
#define YYLLOC_DEFAULT(Current, Rhs, N)
#define YY_LOCATION_PRINT(File, Loc)   ((void) 0)
#define YYLEX   yylex (&yylval, YYLEX_PARAM)
#define YYDPRINTF(Args)
#define YY_SYMBOL_PRINT(Title, Type, Value, Location)
#define YY_STACK_PRINT(Bottom, Top)
#define YY_REDUCE_PRINT(Rule)
#define YYINITDEPTH   200
#define YYMAXDEPTH   10000
#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))

+Typedefs

typedef union YYSTYPE YYSTYPE
typedef unsigned char yytype_uint8
typedef short int yytype_int8
typedef unsigned short int yytype_uint16
typedef short int yytype_int16

+Enumerations

enum  yytokentype {
+  tBOOL = 258, +tFLOAT = 259, +tSTRING = 260, +tID = 261, +
+  tAND = 262, +tOR = 263, +tNOT = 264, +tEQ = 265, +
+  tNE = 266, +tGT = 267, +tLT = 268, +tGTE = 269, +
+  tLTE = 270, +tBOOL = 258, +tFLOAT = 259, +tSTRING = 260, +
+  tID = 261, +tAND = 262, +tOR = 263, +tNOT = 264, +
+  tEQ = 265, +tNE = 266, +tGT = 267, +tLT = 268, +
+  tGTE = 269, +tLTE = 270 +
+ }

+Functions

int yyparse ()
int yyparse (ParserContext_T *context)
+

Define Documentation

+ +
+
+ + + + + + + + +
#define YY_( msgid)   msgid
+
+
+ +

Definition at line 210 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
#define YY_LOCATION_PRINT( File,
 Loc 
)   ((void) 0)
+
+
+ +

Definition at line 673 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + + + + + +
#define YY_REDUCE_PRINT( Rule)
+
+
+ +

Definition at line 850 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
#define YY_STACK_PRINT( Bottom,
 Top 
)
+
+
+ +

Definition at line 849 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#define YY_SYMBOL_PRINT( Title,
 Type,
 Value,
 Location 
)
+
+
+ +

Definition at line 848 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + +
#define YYABORT   goto yyabortlab
+
+
+ +

Definition at line 593 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + +
#define YYACCEPT   goto yyacceptlab
+
+
+ +

Definition at line 592 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
#define YYBACKUP( Token,
 Value 
)
+
+
+Value:
do                                                              \
+  if (yychar == YYEMPTY && yylen == 1)                          \
+    {                                                           \
+      yychar = (Token);                                         \
+      yylval = (Value);                                         \
+      yytoken = YYTRANSLATE (yychar);                           \
+      YYPOPSTACK (1);                                           \
+      goto yybackup;                                            \
+    }                                                           \
+  else                                                          \
+    {                                                           \
+      yyerror (context, YY_("syntax error: cannot back up")); \
+      YYERROR;                                                  \
+    }                                                           \
+while (YYID (0))
+
+

Definition at line 614 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + +
#define YYBISON   1
+
+
+ +

Definition at line 45 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + +
#define YYBISON_VERSION   "2.4.2"
+
+
+ +

Definition at line 48 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + +
#define yyclearin   (yychar = YYEMPTY)
+
+
+ +

Definition at line 588 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
#define YYCOPY( To,
 From,
 Count 
)
+
+
+Value:
do                                      \
+        {                                       \
+          YYSIZE_T yyi;                         \
+          for (yyi = 0; yyi < (Count); yyi++)   \
+            (To)[yyi] = (From)[yyi];            \
+        }                                       \
+      while (YYID (0))
+
+

Definition at line 336 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + +
#define YYDEBUG   0
+
+
+ +

Definition at line 88 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + + + + + +
#define YYDPRINTF( Args)
+
+
+ +

Definition at line 847 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + +
#define YYEMPTY   (-2)
+
+
+ +

Definition at line 589 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + +
#define YYEOF   0
+
+
+ +

Definition at line 590 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + +
#define YYERRCODE   256
+
+
+ +

Definition at line 633 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + +
#define yyerrok   (yyerrstatus = 0)
+
+
+ +

Definition at line 587 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + +
#define YYERROR   goto yyerrorlab
+
+
+ +

Definition at line 594 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + +
#define YYERROR_VERBOSE   0
+
+
+ +

Definition at line 96 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + +
#define YYFAIL   goto yyerrlab
+
+
+ +

Definition at line 604 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + +
#define YYFINAL   2
+
+
+ +

Definition at line 366 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + +
#define YYFREE   free
+
+
+ +

Definition at line 299 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + + + + + +
#define YYID( n)   (n)
+
+
+ +

Definition at line 223 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + +
#define YYINITDEPTH   200
+
+
+ +

Definition at line 856 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + +
#define YYLAST   166
+
+
+ +

Definition at line 368 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + +
#define YYLEX   yylex (&yylval, YYLEX_PARAM)
+
+
+ +

Definition at line 681 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + +
#define YYLEX_PARAM   context->lexinfo
+
+
+ +

Definition at line 79 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
#define YYLLOC_DEFAULT( Current,
 Rhs,
 
)
+
+
+Value:
do                                                                      \
+      if (YYID (N))                                                    \
+        {                                                               \
+          (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;        \
+          (Current).first_column = YYRHSLOC (Rhs, 1).first_column;      \
+          (Current).last_line    = YYRHSLOC (Rhs, N).last_line;         \
+          (Current).last_column  = YYRHSLOC (Rhs, N).last_column;       \
+        }                                                               \
+      else                                                              \
+        {                                                               \
+          (Current).first_line   = (Current).last_line   =              \
+            YYRHSLOC (Rhs, 0).last_line;                                \
+          (Current).first_column = (Current).last_column =              \
+            YYRHSLOC (Rhs, 0).last_column;                              \
+        }                                                               \
+    while (YYID (0))
+
+

Definition at line 642 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + +
#define YYLSP_NEEDED   0
+
+
+ +

Definition at line 63 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + +
#define YYMALLOC   malloc
+
+
+ +

Definition at line 292 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + +
#define YYMAXDEPTH   10000
+
+
+ +

Definition at line 867 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + +
#define YYMAXUTOK   270
+
+
+ +

Definition at line 381 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + +
#define YYNNTS   5
+
+
+ +

Definition at line 373 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + +
#define YYNRULES   25
+
+
+ +

Definition at line 375 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + +
#define YYNSTATES   49
+
+
+ +

Definition at line 377 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + +
#define YYNTOKENS   32
+
+
+ +

Definition at line 371 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + +
#define YYPACT_NINF   -23
+
+
+ +

Definition at line 513 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + + + + + +
#define YYPOPSTACK( N)   (yyvsp -= (N), yyssp -= (N))
+
+
+ +
+
+ +
+
+ + + + +
#define YYPULL   1
+
+
+ +

Definition at line 60 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + +
#define YYPURE   1
+
+
+ +

Definition at line 54 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + +
#define YYPUSH   0
+
+
+ +

Definition at line 57 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + + + + +
#define YYRECOVERING()   (!!yyerrstatus)
+
+
+ +

Definition at line 612 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
#define YYRHSLOC( Rhs,
 
)   ((Rhs)[K])
+
+
+ +

Definition at line 640 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + +
#define YYSIZE_MAXIMUM   ((YYSIZE_T) -1)
+
+
+ +

Definition at line 200 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + +
#define YYSIZE_T   unsigned int
+
+
+ +

Definition at line 196 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + +
#define YYSKELETON_NAME   "yacc.c"
+
+
+ +

Definition at line 51 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + +
#define YYSTACK_ALLOC   YYMALLOC
+
+
+ +

Definition at line 278 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + +
#define YYSTACK_ALLOC_MAXIMUM   YYSIZE_MAXIMUM
+
+
+ +

Definition at line 281 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + + + + + +
#define YYSTACK_BYTES( N)
+
+
+Value:
((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
+      + YYSTACK_GAP_MAXIMUM)
+
+

Definition at line 325 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + +
#define YYSTACK_FREE   YYFREE
+
+
+ +

Definition at line 279 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + +
#define YYSTACK_GAP_MAXIMUM   (sizeof (union yyalloc) - 1)
+
+
+ +

Definition at line 321 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
#define YYSTACK_RELOCATE( Stack_alloc,
 Stack 
)
+
+
+Value:
do                                                                      \
+      {                                                                 \
+        YYSIZE_T yynewbytes;                                            \
+        YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
+        Stack = &yyptr->Stack_alloc;                                    \
+        yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
+        yyptr += yynewbytes / sizeof (*yyptr);                          \
+      }                                                                 \
+    while (YYID (0))
+
+

Definition at line 352 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + +
#define yystype   YYSTYPE
+
+
+ +

Definition at line 144 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + +
#define YYSTYPE_IS_DECLARED   1
+
+
+ +

Definition at line 145 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + +
#define YYSTYPE_IS_TRIVIAL   1
+
+
+ +

Definition at line 143 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + +
#define YYTABLE_NINF   -1
+
+
+ +

Definition at line 533 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + +
#define YYTERROR   1
+
+
+ +

Definition at line 632 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + +
#define YYTOKEN_TABLE   0
+
+
+ +

Definition at line 101 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + +
#define YYTOKENTYPE
+
+
+ +

Definition at line 107 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + + + + + +
#define YYTRANSLATE( YYX)   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
+
+
+ +

Definition at line 383 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + +
#define YYUNDEFTOK   2
+
+
+ +

Definition at line 380 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + + + + + +
#define YYUSE( e)   ((void) (e))
+
+
+ +

Definition at line 216 of file grammar.tab.c.

+ +
+
+

Typedef Documentation

+ +
+
+ + + + +
typedef union YYSTYPE YYSTYPE
+
+
+ +
+
+ +
+
+ + + + +
typedef short int yytype_int16
+
+
+ +

Definition at line 183 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + +
typedef short int yytype_int8
+
+
+ +

Definition at line 171 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + +
typedef unsigned short int yytype_uint16
+
+
+ +

Definition at line 177 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + +
typedef unsigned char yytype_uint8
+
+
+ +

Definition at line 162 of file grammar.tab.c.

+ +
+
+

Enumeration Type Documentation

+ +
+
+ + + + +
enum yytokentype
+
+
+
Enumerator:
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
tBOOL  +
tFLOAT  +
tSTRING  +
tID  +
tAND  +
tOR  +
tNOT  +
tEQ  +
tNE  +
tGT  +
tLT  +
tGTE  +
tLTE  +
tBOOL  +
tFLOAT  +
tSTRING  +
tID  +
tAND  +
tOR  +
tNOT  +
tEQ  +
tNE  +
tGT  +
tLT  +
tGTE  +
tLTE  +
+
+
+ +

Definition at line 110 of file grammar.tab.c.

+ +
+
+

Function Documentation

+ +
+
+ + + + + + + + +
int yyparse (ParserContext_Tcontext)
+
+
+ +

Definition at line 1156 of file grammar.tab.c.

+ +

+Here is the call graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + +
int yyparse ()
+
+
+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/grammar_8tab_8c__incl.map b/flex-bison/mark1/docs/html/grammar_8tab_8c__incl.map new file mode 100644 index 0000000..8be6a30 --- /dev/null +++ b/flex-bison/mark1/docs/html/grammar_8tab_8c__incl.map @@ -0,0 +1,2 @@ + + diff --git a/flex-bison/mark1/docs/html/grammar_8tab_8c__incl.md5 b/flex-bison/mark1/docs/html/grammar_8tab_8c__incl.md5 new file mode 100644 index 0000000..df73f02 --- /dev/null +++ b/flex-bison/mark1/docs/html/grammar_8tab_8c__incl.md5 @@ -0,0 +1 @@ +f2619d496e5c72c344e7c490b7e5e560 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/grammar_8tab_8c__incl.png b/flex-bison/mark1/docs/html/grammar_8tab_8c__incl.png new file mode 100644 index 0000000..9a98a7a Binary files /dev/null and b/flex-bison/mark1/docs/html/grammar_8tab_8c__incl.png differ diff --git a/flex-bison/mark1/docs/html/grammar_8tab_8c_a532dba64f9aad4f70498207a3395cd9e_cgraph.map b/flex-bison/mark1/docs/html/grammar_8tab_8c_a532dba64f9aad4f70498207a3395cd9e_cgraph.map new file mode 100644 index 0000000..052bbc7 --- /dev/null +++ b/flex-bison/mark1/docs/html/grammar_8tab_8c_a532dba64f9aad4f70498207a3395cd9e_cgraph.map @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/flex-bison/mark1/docs/html/grammar_8tab_8c_a532dba64f9aad4f70498207a3395cd9e_cgraph.md5 b/flex-bison/mark1/docs/html/grammar_8tab_8c_a532dba64f9aad4f70498207a3395cd9e_cgraph.md5 new file mode 100644 index 0000000..87c0417 --- /dev/null +++ b/flex-bison/mark1/docs/html/grammar_8tab_8c_a532dba64f9aad4f70498207a3395cd9e_cgraph.md5 @@ -0,0 +1 @@ +a405a54d7b71f6a8c6bdac931216de8f \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/grammar_8tab_8c_a532dba64f9aad4f70498207a3395cd9e_cgraph.png b/flex-bison/mark1/docs/html/grammar_8tab_8c_a532dba64f9aad4f70498207a3395cd9e_cgraph.png new file mode 100644 index 0000000..d96f4c0 Binary files /dev/null and b/flex-bison/mark1/docs/html/grammar_8tab_8c_a532dba64f9aad4f70498207a3395cd9e_cgraph.png differ diff --git a/flex-bison/mark1/docs/html/grammar_8tab_8c_acd8617a8f2ac0de8bc1cc032cf449e19_icgraph.map b/flex-bison/mark1/docs/html/grammar_8tab_8c_acd8617a8f2ac0de8bc1cc032cf449e19_icgraph.map new file mode 100644 index 0000000..745354a --- /dev/null +++ b/flex-bison/mark1/docs/html/grammar_8tab_8c_acd8617a8f2ac0de8bc1cc032cf449e19_icgraph.map @@ -0,0 +1,5 @@ + + + + + diff --git a/flex-bison/mark1/docs/html/grammar_8tab_8c_acd8617a8f2ac0de8bc1cc032cf449e19_icgraph.md5 b/flex-bison/mark1/docs/html/grammar_8tab_8c_acd8617a8f2ac0de8bc1cc032cf449e19_icgraph.md5 new file mode 100644 index 0000000..62335be --- /dev/null +++ b/flex-bison/mark1/docs/html/grammar_8tab_8c_acd8617a8f2ac0de8bc1cc032cf449e19_icgraph.md5 @@ -0,0 +1 @@ +857259f53a53d4ddb6d44a362c56a9c4 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/grammar_8tab_8c_acd8617a8f2ac0de8bc1cc032cf449e19_icgraph.png b/flex-bison/mark1/docs/html/grammar_8tab_8c_acd8617a8f2ac0de8bc1cc032cf449e19_icgraph.png new file mode 100644 index 0000000..6b01799 Binary files /dev/null and b/flex-bison/mark1/docs/html/grammar_8tab_8c_acd8617a8f2ac0de8bc1cc032cf449e19_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/grammar_8tab_8c_source.html b/flex-bison/mark1/docs/html/grammar_8tab_8c_source.html new file mode 100644 index 0000000..51f947b --- /dev/null +++ b/flex-bison/mark1/docs/html/grammar_8tab_8c_source.html @@ -0,0 +1,1898 @@ + + + + +Mark1: src/parser/grammar/grammar.tab.c Source File + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + +
+
+ +
+
+
+ +
+
+
+

src/parser/grammar/grammar.tab.c

+
+
+Go to the documentation of this file.
00001 /* A Bison parser, made by GNU Bison 2.4.2.  */
+00002 
+00003 /* Skeleton implementation for Bison's Yacc-like parsers in C
+00004    
+00005       Copyright (C) 1984, 1989-1990, 2000-2006, 2009-2010 Free Software
+00006    Foundation, Inc.
+00007    
+00008    This program is free software: you can redistribute it and/or modify
+00009    it under the terms of the GNU General Public License as published by
+00010    the Free Software Foundation, either version 3 of the License, or
+00011    (at your option) any later version.
+00012    
+00013    This program is distributed in the hope that it will be useful,
+00014    but WITHOUT ANY WARRANTY; without even the implied warranty of
+00015    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+00016    GNU General Public License for more details.
+00017    
+00018    You should have received a copy of the GNU General Public License
+00019    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+00020 
+00021 /* As a special exception, you may create a larger work that contains
+00022    part or all of the Bison parser skeleton and distribute that work
+00023    under terms of your choice, so long as that work isn't itself a
+00024    parser generator using the skeleton or a modified version thereof
+00025    as a parser skeleton.  Alternatively, if you modify or redistribute
+00026    the parser skeleton itself, you may (at your option) remove this
+00027    special exception, which will cause the skeleton and the resulting
+00028    Bison output files to be licensed under the GNU General Public
+00029    License without this special exception.
+00030    
+00031    This special exception was added by the Free Software Foundation in
+00032    version 2.2 of Bison.  */
+00033 
+00034 /* C LALR(1) parser skeleton written by Richard Stallman, by
+00035    simplifying the original so-called "semantic" parser.  */
+00036 
+00037 /* All symbols defined below should begin with yy or YY, to avoid
+00038    infringing on user name space.  This should be done even for local
+00039    variables, as they might otherwise be expanded by user macros.
+00040    There are some unavoidable exceptions within include files to
+00041    define necessary library symbols; they are noted "INFRINGES ON
+00042    USER NAME SPACE" below.  */
+00043 
+00044 /* Identify Bison output.  */
+00045 #define YYBISON 1
+00046 
+00047 /* Bison version.  */
+00048 #define YYBISON_VERSION "2.4.2"
+00049 
+00050 /* Skeleton name.  */
+00051 #define YYSKELETON_NAME "yacc.c"
+00052 
+00053 /* Pure parsers.  */
+00054 #define YYPURE 1
+00055 
+00056 /* Push parsers.  */
+00057 #define YYPUSH 0
+00058 
+00059 /* Pull parsers.  */
+00060 #define YYPULL 1
+00061 
+00062 /* Using locations.  */
+00063 #define YYLSP_NEEDED 0
+00064 
+00065 
+00066 
+00067 /* Copy the first part of user declarations.  */
+00068 
+00069 /* Line 189 of yacc.c  */
+00070 #line 1 "src/parser/grammar/grammar.y"
+00071 
+00072 
+00073 #include <stdio.h>
+00074 #include "ast.h"
+00075 #include "ast_debug.h"
+00076 #include "parser.h"
+00077 #include "lex.yy.h"
+00078 
+00079 #define YYLEX_PARAM context->lexinfo
+00080 
+00081 
+00082 
+00083 /* Line 189 of yacc.c  */
+00084 #line 85 "src/parser/grammar/grammar.tab.c"
+00085 
+00086 /* Enabling traces.  */
+00087 #ifndef YYDEBUG
+00088 # define YYDEBUG 0
+00089 #endif
+00090 
+00091 /* Enabling verbose error messages.  */
+00092 #ifdef YYERROR_VERBOSE
+00093 # undef YYERROR_VERBOSE
+00094 # define YYERROR_VERBOSE 1
+00095 #else
+00096 # define YYERROR_VERBOSE 0
+00097 #endif
+00098 
+00099 /* Enabling the token table.  */
+00100 #ifndef YYTOKEN_TABLE
+00101 # define YYTOKEN_TABLE 0
+00102 #endif
+00103 
+00104 
+00105 /* Tokens.  */
+00106 #ifndef YYTOKENTYPE
+00107 # define YYTOKENTYPE
+00108    /* Put the tokens into the symbol table, so that GDB and other debuggers
+00109       know about them.  */
+00110    enum yytokentype {
+00111      tBOOL = 258,
+00112      tFLOAT = 259,
+00113      tSTRING = 260,
+00114      tID = 261,
+00115      tAND = 262,
+00116      tOR = 263,
+00117      tNOT = 264,
+00118      tEQ = 265,
+00119      tNE = 266,
+00120      tGT = 267,
+00121      tLT = 268,
+00122      tGTE = 269,
+00123      tLTE = 270
+00124    };
+00125 #endif
+00126 
+00127 
+00128 
+00129 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
+00130 typedef union YYSTYPE
+00131 {
+00132 
+00133 /* Line 214 of yacc.c  */
+00134 #line 23 "src/parser/grammar/grammar.y"
+00135 
+00136         void * Node;
+00137 
+00138 
+00139 
+00140 /* Line 214 of yacc.c  */
+00141 #line 142 "src/parser/grammar/grammar.tab.c"
+00142 } YYSTYPE;
+00143 # define YYSTYPE_IS_TRIVIAL 1
+00144 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
+00145 # define YYSTYPE_IS_DECLARED 1
+00146 #endif
+00147 
+00148 
+00149 /* Copy the second part of user declarations.  */
+00150 
+00151 
+00152 /* Line 264 of yacc.c  */
+00153 #line 154 "src/parser/grammar/grammar.tab.c"
+00154 
+00155 #ifdef short
+00156 # undef short
+00157 #endif
+00158 
+00159 #ifdef YYTYPE_UINT8
+00160 typedef YYTYPE_UINT8 yytype_uint8;
+00161 #else
+00162 typedef unsigned char yytype_uint8;
+00163 #endif
+00164 
+00165 #ifdef YYTYPE_INT8
+00166 typedef YYTYPE_INT8 yytype_int8;
+00167 #elif (defined __STDC__ || defined __C99__FUNC__ \
+00168      || defined __cplusplus || defined _MSC_VER)
+00169 typedef signed char yytype_int8;
+00170 #else
+00171 typedef short int yytype_int8;
+00172 #endif
+00173 
+00174 #ifdef YYTYPE_UINT16
+00175 typedef YYTYPE_UINT16 yytype_uint16;
+00176 #else
+00177 typedef unsigned short int yytype_uint16;
+00178 #endif
+00179 
+00180 #ifdef YYTYPE_INT16
+00181 typedef YYTYPE_INT16 yytype_int16;
+00182 #else
+00183 typedef short int yytype_int16;
+00184 #endif
+00185 
+00186 #ifndef YYSIZE_T
+00187 # ifdef __SIZE_TYPE__
+00188 #  define YYSIZE_T __SIZE_TYPE__
+00189 # elif defined size_t
+00190 #  define YYSIZE_T size_t
+00191 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
+00192      || defined __cplusplus || defined _MSC_VER)
+00193 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
+00194 #  define YYSIZE_T size_t
+00195 # else
+00196 #  define YYSIZE_T unsigned int
+00197 # endif
+00198 #endif
+00199 
+00200 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
+00201 
+00202 #ifndef YY_
+00203 # if defined YYENABLE_NLS && YYENABLE_NLS
+00204 #  if ENABLE_NLS
+00205 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
+00206 #   define YY_(msgid) dgettext ("bison-runtime", msgid)
+00207 #  endif
+00208 # endif
+00209 # ifndef YY_
+00210 #  define YY_(msgid) msgid
+00211 # endif
+00212 #endif
+00213 
+00214 /* Suppress unused-variable warnings by "using" E.  */
+00215 #if ! defined lint || defined __GNUC__
+00216 # define YYUSE(e) ((void) (e))
+00217 #else
+00218 # define YYUSE(e) /* empty */
+00219 #endif
+00220 
+00221 /* Identity function, used to suppress warnings about constant conditions.  */
+00222 #ifndef lint
+00223 # define YYID(n) (n)
+00224 #else
+00225 #if (defined __STDC__ || defined __C99__FUNC__ \
+00226      || defined __cplusplus || defined _MSC_VER)
+00227 static int
+00228 YYID (int yyi)
+00229 #else
+00230 static int
+00231 YYID (yyi)
+00232     int yyi;
+00233 #endif
+00234 {
+00235   return yyi;
+00236 }
+00237 #endif
+00238 
+00239 #if ! defined yyoverflow || YYERROR_VERBOSE
+00240 
+00241 /* The parser invokes alloca or malloc; define the necessary symbols.  */
+00242 
+00243 # ifdef YYSTACK_USE_ALLOCA
+00244 #  if YYSTACK_USE_ALLOCA
+00245 #   ifdef __GNUC__
+00246 #    define YYSTACK_ALLOC __builtin_alloca
+00247 #   elif defined __BUILTIN_VA_ARG_INCR
+00248 #    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
+00249 #   elif defined _AIX
+00250 #    define YYSTACK_ALLOC __alloca
+00251 #   elif defined _MSC_VER
+00252 #    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
+00253 #    define alloca _alloca
+00254 #   else
+00255 #    define YYSTACK_ALLOC alloca
+00256 #    if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+00257      || defined __cplusplus || defined _MSC_VER)
+00258 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+00259 #     ifndef _STDLIB_H
+00260 #      define _STDLIB_H 1
+00261 #     endif
+00262 #    endif
+00263 #   endif
+00264 #  endif
+00265 # endif
+00266 
+00267 # ifdef YYSTACK_ALLOC
+00268    /* Pacify GCC's `empty if-body' warning.  */
+00269 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
+00270 #  ifndef YYSTACK_ALLOC_MAXIMUM
+00271     /* The OS might guarantee only one guard page at the bottom of the stack,
+00272        and a page size can be as small as 4096 bytes.  So we cannot safely
+00273        invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
+00274        to allow for a few compiler-allocated temporary stack slots.  */
+00275 #   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
+00276 #  endif
+00277 # else
+00278 #  define YYSTACK_ALLOC YYMALLOC
+00279 #  define YYSTACK_FREE YYFREE
+00280 #  ifndef YYSTACK_ALLOC_MAXIMUM
+00281 #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
+00282 #  endif
+00283 #  if (defined __cplusplus && ! defined _STDLIB_H \
+00284        && ! ((defined YYMALLOC || defined malloc) \
+00285              && (defined YYFREE || defined free)))
+00286 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+00287 #   ifndef _STDLIB_H
+00288 #    define _STDLIB_H 1
+00289 #   endif
+00290 #  endif
+00291 #  ifndef YYMALLOC
+00292 #   define YYMALLOC malloc
+00293 #   if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+00294      || defined __cplusplus || defined _MSC_VER)
+00295 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
+00296 #   endif
+00297 #  endif
+00298 #  ifndef YYFREE
+00299 #   define YYFREE free
+00300 #   if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+00301      || defined __cplusplus || defined _MSC_VER)
+00302 void free (void *); /* INFRINGES ON USER NAME SPACE */
+00303 #   endif
+00304 #  endif
+00305 # endif
+00306 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
+00307 
+00308 
+00309 #if (! defined yyoverflow \
+00310      && (! defined __cplusplus \
+00311          || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
+00312 
+00313 /* A type that is properly aligned for any stack member.  */
+00314 union yyalloc
+00315 {
+00316   yytype_int16 yyss_alloc;
+00317   YYSTYPE yyvs_alloc;
+00318 };
+00319 
+00320 /* The size of the maximum gap between one aligned stack and the next.  */
+00321 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
+00322 
+00323 /* The size of an array large to enough to hold all stacks, each with
+00324    N elements.  */
+00325 # define YYSTACK_BYTES(N) \
+00326      ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
+00327       + YYSTACK_GAP_MAXIMUM)
+00328 
+00329 /* Copy COUNT objects from FROM to TO.  The source and destination do
+00330    not overlap.  */
+00331 # ifndef YYCOPY
+00332 #  if defined __GNUC__ && 1 < __GNUC__
+00333 #   define YYCOPY(To, From, Count) \
+00334       __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
+00335 #  else
+00336 #   define YYCOPY(To, From, Count)              \
+00337       do                                        \
+00338         {                                       \
+00339           YYSIZE_T yyi;                         \
+00340           for (yyi = 0; yyi < (Count); yyi++)   \
+00341             (To)[yyi] = (From)[yyi];            \
+00342         }                                       \
+00343       while (YYID (0))
+00344 #  endif
+00345 # endif
+00346 
+00347 /* Relocate STACK from its old location to the new one.  The
+00348    local variables YYSIZE and YYSTACKSIZE give the old and new number of
+00349    elements in the stack, and YYPTR gives the new location of the
+00350    stack.  Advance YYPTR to a properly aligned location for the next
+00351    stack.  */
+00352 # define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
+00353     do                                                                  \
+00354       {                                                                 \
+00355         YYSIZE_T yynewbytes;                                            \
+00356         YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
+00357         Stack = &yyptr->Stack_alloc;                                    \
+00358         yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
+00359         yyptr += yynewbytes / sizeof (*yyptr);                          \
+00360       }                                                                 \
+00361     while (YYID (0))
+00362 
+00363 #endif
+00364 
+00365 /* YYFINAL -- State number of the termination state.  */
+00366 #define YYFINAL  2
+00367 /* YYLAST -- Last index in YYTABLE.  */
+00368 #define YYLAST   166
+00369 
+00370 /* YYNTOKENS -- Number of terminals.  */
+00371 #define YYNTOKENS  32
+00372 /* YYNNTS -- Number of nonterminals.  */
+00373 #define YYNNTS  5
+00374 /* YYNRULES -- Number of rules.  */
+00375 #define YYNRULES  25
+00376 /* YYNRULES -- Number of states.  */
+00377 #define YYNSTATES  49
+00378 
+00379 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
+00380 #define YYUNDEFTOK  2
+00381 #define YYMAXUTOK   270
+00382 
+00383 #define YYTRANSLATE(YYX)                                                \
+00384   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
+00385 
+00386 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
+00387 static const yytype_uint8 yytranslate[] =
+00388 {
+00389        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+00390        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+00391        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+00392        2,     2,     2,     2,     2,     2,     2,    11,     2,     2,
+00393       26,    27,     9,     7,    22,     8,     2,    10,     2,     2,
+00394        2,     2,     2,     2,     2,     2,     2,     2,    24,    23,
+00395        2,    21,     2,    25,     2,     2,     2,     2,     2,     2,
+00396        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+00397        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+00398        2,    28,     2,    29,     2,     2,     2,     2,     2,     2,
+00399        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+00400        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+00401        2,     2,     2,    30,     2,    31,     2,     2,     2,     2,
+00402        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+00403        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+00404        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+00405        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+00406        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+00407        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+00408        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+00409        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+00410        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+00411        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+00412        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+00413        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+00414        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
+00415        5,     6,    12,    13,    14,    15,    16,    17,    18,    19,
+00416       20
+00417 };
+00418 
+00419 #if YYDEBUG
+00420 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
+00421    YYRHS.  */
+00422 static const yytype_uint8 yyprhs[] =
+00423 {
+00424        0,     0,     3,     4,     7,    12,    15,    19,    23,    27,
+00425       31,    35,    39,    43,    46,    50,    54,    58,    62,    66,
+00426       70,    74,    76,    82,    84,    86
+00427 };
+00428 
+00429 /* YYRHS -- A `-1'-separated list of the rules' RHS.  */
+00430 static const yytype_int8 yyrhs[] =
+00431 {
+00432       33,     0,    -1,    -1,    33,    34,    -1,     6,    21,    35,
+00433       23,    -1,    35,    23,    -1,    35,     7,    35,    -1,    35,
+00434        8,    35,    -1,    35,     9,    35,    -1,    35,    10,    35,
+00435       -1,    35,    11,    35,    -1,    35,    12,    35,    -1,    35,
+00436       13,    35,    -1,    14,    35,    -1,    35,    15,    35,    -1,
+00437       35,    16,    35,    -1,    35,    18,    35,    -1,    35,    17,
+00438       35,    -1,    35,    20,    35,    -1,    35,    19,    35,    -1,
+00439       26,    35,    27,    -1,     6,    -1,    35,    25,    35,    24,
+00440       35,    -1,    36,    -1,     3,    -1,     4,    -1
+00441 };
+00442 
+00443 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
+00444 static const yytype_uint8 yyrline[] =
+00445 {
+00446        0,    75,    75,    77,    81,    82,    86,    87,    88,    89,
+00447       90,    93,    94,    95,    98,    99,   100,   101,   102,   103,
+00448      106,   107,   108,   109,   113,   114
+00449 };
+00450 #endif
+00451 
+00452 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
+00453 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
+00454    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
+00455 static const char *const yytname[] =
+00456 {
+00457   "$end", "error", "$undefined", "tBOOL", "tFLOAT", "tSTRING", "tID",
+00458   "'+'", "'-'", "'*'", "'/'", "'%'", "tAND", "tOR", "tNOT", "tEQ", "tNE",
+00459   "tGT", "tLT", "tGTE", "tLTE", "'='", "','", "';'", "':'", "'?'", "'('",
+00460   "')'", "'['", "']'", "'{'", "'}'", "$accept", "program", "stmnt", "exp",
+00461   "literal", 0
+00462 };
+00463 #endif
+00464 
+00465 # ifdef YYPRINT
+00466 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
+00467    token YYLEX-NUM.  */
+00468 static const yytype_uint16 yytoknum[] =
+00469 {
+00470        0,   256,   257,   258,   259,   260,   261,    43,    45,    42,
+00471       47,    37,   262,   263,   264,   265,   266,   267,   268,   269,
+00472      270,    61,    44,    59,    58,    63,    40,    41,    91,    93,
+00473      123,   125
+00474 };
+00475 # endif
+00476 
+00477 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
+00478 static const yytype_uint8 yyr1[] =
+00479 {
+00480        0,    32,    33,    33,    34,    34,    35,    35,    35,    35,
+00481       35,    35,    35,    35,    35,    35,    35,    35,    35,    35,
+00482       35,    35,    35,    35,    36,    36
+00483 };
+00484 
+00485 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
+00486 static const yytype_uint8 yyr2[] =
+00487 {
+00488        0,     2,     0,     2,     4,     2,     3,     3,     3,     3,
+00489        3,     3,     3,     2,     3,     3,     3,     3,     3,     3,
+00490        3,     1,     5,     1,     1,     1
+00491 };
+00492 
+00493 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
+00494    STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
+00495    means the default is an error.  */
+00496 static const yytype_uint8 yydefact[] =
+00497 {
+00498        2,     0,     1,    24,    25,    21,     0,     0,     3,     0,
+00499       23,     0,    21,    13,     0,     0,     0,     0,     0,     0,
+00500        0,     0,     0,     0,     0,     0,     0,     0,     5,     0,
+00501        0,    20,     6,     7,     8,     9,    10,    11,    12,    14,
+00502       15,    17,    16,    19,    18,     0,     4,     0,    22
+00503 };
+00504 
+00505 /* YYDEFGOTO[NTERM-NUM].  */
+00506 static const yytype_int8 yydefgoto[] =
+00507 {
+00508       -1,     1,     8,     9,    10
+00509 };
+00510 
+00511 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+00512    STATE-NUM.  */
+00513 #define YYPACT_NINF -23
+00514 static const yytype_int16 yypact[] =
+00515 {
+00516      -23,    22,   -23,   -23,   -23,   -19,    26,    26,   -23,    67,
+00517      -23,    26,   -23,    21,    46,    26,    26,    26,    26,    26,
+00518       26,    26,    26,    26,    26,    26,    26,    26,   -23,    26,
+00519       86,   -23,   141,   141,    21,    21,    21,   -22,   -22,   124,
+00520      124,   124,   124,   124,   124,   105,   -23,    26,   -23
+00521 };
+00522 
+00523 /* YYPGOTO[NTERM-NUM].  */
+00524 static const yytype_int8 yypgoto[] =
+00525 {
+00526      -23,   -23,   -23,    -6,   -23
+00527 };
+00528 
+00529 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
+00530    positive, shift that token.  If negative, reduce the rule which
+00531    number is the opposite.  If zero, do what YYDEFACT says.
+00532    If YYTABLE_NINF, syntax error.  */
+00533 #define YYTABLE_NINF -1
+00534 static const yytype_int8 yytable[] =
+00535 {
+00536       13,    14,    11,    29,     0,    30,     0,     0,     0,    32,
+00537       33,    34,    35,    36,    37,    38,    39,    40,    41,    42,
+00538       43,    44,     2,    45,     0,     3,     4,     0,     5,     3,
+00539        4,     0,    12,    20,    21,     0,     6,     0,     0,     0,
+00540        6,    48,     0,     0,     0,     0,    29,     0,     7,     0,
+00541        0,     0,     7,    15,    16,    17,    18,    19,    20,    21,
+00542        0,    22,    23,    24,    25,    26,    27,     0,     0,     0,
+00543        0,    29,     0,    31,    15,    16,    17,    18,    19,    20,
+00544       21,     0,    22,    23,    24,    25,    26,    27,     0,     0,
+00545       28,     0,    29,    15,    16,    17,    18,    19,    20,    21,
+00546        0,    22,    23,    24,    25,    26,    27,     0,     0,    46,
+00547        0,    29,    15,    16,    17,    18,    19,    20,    21,     0,
+00548       22,    23,    24,    25,    26,    27,     0,     0,     0,    47,
+00549       29,    15,    16,    17,    18,    19,    20,    21,     0,    -1,
+00550       -1,    -1,    -1,    -1,    -1,     0,     0,     0,     0,    29,
+00551       17,    18,    19,    20,    21,     0,     0,     0,     0,     0,
+00552        0,     0,     0,     0,     0,     0,    29
+00553 };
+00554 
+00555 static const yytype_int8 yycheck[] =
+00556 {
+00557        6,     7,    21,    25,    -1,    11,    -1,    -1,    -1,    15,
+00558       16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
+00559       26,    27,     0,    29,    -1,     3,     4,    -1,     6,     3,
+00560        4,    -1,     6,    12,    13,    -1,    14,    -1,    -1,    -1,
+00561       14,    47,    -1,    -1,    -1,    -1,    25,    -1,    26,    -1,
+00562       -1,    -1,    26,     7,     8,     9,    10,    11,    12,    13,
+00563       -1,    15,    16,    17,    18,    19,    20,    -1,    -1,    -1,
+00564       -1,    25,    -1,    27,     7,     8,     9,    10,    11,    12,
+00565       13,    -1,    15,    16,    17,    18,    19,    20,    -1,    -1,
+00566       23,    -1,    25,     7,     8,     9,    10,    11,    12,    13,
+00567       -1,    15,    16,    17,    18,    19,    20,    -1,    -1,    23,
+00568       -1,    25,     7,     8,     9,    10,    11,    12,    13,    -1,
+00569       15,    16,    17,    18,    19,    20,    -1,    -1,    -1,    24,
+00570       25,     7,     8,     9,    10,    11,    12,    13,    -1,    15,
+00571       16,    17,    18,    19,    20,    -1,    -1,    -1,    -1,    25,
+00572        9,    10,    11,    12,    13,    -1,    -1,    -1,    -1,    -1,
+00573       -1,    -1,    -1,    -1,    -1,    -1,    25
+00574 };
+00575 
+00576 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
+00577    symbol of state STATE-NUM.  */
+00578 static const yytype_uint8 yystos[] =
+00579 {
+00580        0,    33,     0,     3,     4,     6,    14,    26,    34,    35,
+00581       36,    21,     6,    35,    35,     7,     8,     9,    10,    11,
+00582       12,    13,    15,    16,    17,    18,    19,    20,    23,    25,
+00583       35,    27,    35,    35,    35,    35,    35,    35,    35,    35,
+00584       35,    35,    35,    35,    35,    35,    23,    24,    35
+00585 };
+00586 
+00587 #define yyerrok         (yyerrstatus = 0)
+00588 #define yyclearin       (yychar = YYEMPTY)
+00589 #define YYEMPTY         (-2)
+00590 #define YYEOF           0
+00591 
+00592 #define YYACCEPT        goto yyacceptlab
+00593 #define YYABORT         goto yyabortlab
+00594 #define YYERROR         goto yyerrorlab
+00595 
+00596 
+00597 /* Like YYERROR except do call yyerror.  This remains here temporarily
+00598    to ease the transition to the new meaning of YYERROR, for GCC.
+00599    Once GCC version 2 has supplanted version 1, this can go.  However,
+00600    YYFAIL appears to be in use.  Nevertheless, it is formally deprecated
+00601    in Bison 2.4.2's NEWS entry, where a plan to phase it out is
+00602    discussed.  */
+00603 
+00604 #define YYFAIL          goto yyerrlab
+00605 #if defined YYFAIL
+00606   /* This is here to suppress warnings from the GCC cpp's
+00607      -Wunused-macros.  Normally we don't worry about that warning, but
+00608      some users do, and we want to make it easy for users to remove
+00609      YYFAIL uses, which will produce warnings from Bison 2.5.  */
+00610 #endif
+00611 
+00612 #define YYRECOVERING()  (!!yyerrstatus)
+00613 
+00614 #define YYBACKUP(Token, Value)                                  \
+00615 do                                                              \
+00616   if (yychar == YYEMPTY && yylen == 1)                          \
+00617     {                                                           \
+00618       yychar = (Token);                                         \
+00619       yylval = (Value);                                         \
+00620       yytoken = YYTRANSLATE (yychar);                           \
+00621       YYPOPSTACK (1);                                           \
+00622       goto yybackup;                                            \
+00623     }                                                           \
+00624   else                                                          \
+00625     {                                                           \
+00626       yyerror (context, YY_("syntax error: cannot back up")); \
+00627       YYERROR;                                                  \
+00628     }                                                           \
+00629 while (YYID (0))
+00630 
+00631 
+00632 #define YYTERROR        1
+00633 #define YYERRCODE       256
+00634 
+00635 
+00636 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
+00637    If N is 0, then set CURRENT to the empty location which ends
+00638    the previous symbol: RHS[0] (always defined).  */
+00639 
+00640 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
+00641 #ifndef YYLLOC_DEFAULT
+00642 # define YYLLOC_DEFAULT(Current, Rhs, N)                                \
+00643     do                                                                  \
+00644       if (YYID (N))                                                    \
+00645         {                                                               \
+00646           (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;        \
+00647           (Current).first_column = YYRHSLOC (Rhs, 1).first_column;      \
+00648           (Current).last_line    = YYRHSLOC (Rhs, N).last_line;         \
+00649           (Current).last_column  = YYRHSLOC (Rhs, N).last_column;       \
+00650         }                                                               \
+00651       else                                                              \
+00652         {                                                               \
+00653           (Current).first_line   = (Current).last_line   =              \
+00654             YYRHSLOC (Rhs, 0).last_line;                                \
+00655           (Current).first_column = (Current).last_column =              \
+00656             YYRHSLOC (Rhs, 0).last_column;                              \
+00657         }                                                               \
+00658     while (YYID (0))
+00659 #endif
+00660 
+00661 
+00662 /* YY_LOCATION_PRINT -- Print the location on the stream.
+00663    This macro was not mandated originally: define only if we know
+00664    we won't break user code: when these are the locations we know.  */
+00665 
+00666 #ifndef YY_LOCATION_PRINT
+00667 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
+00668 #  define YY_LOCATION_PRINT(File, Loc)                  \
+00669      fprintf (File, "%d.%d-%d.%d",                      \
+00670               (Loc).first_line, (Loc).first_column,     \
+00671               (Loc).last_line,  (Loc).last_column)
+00672 # else
+00673 #  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
+00674 # endif
+00675 #endif
+00676 
+00677 
+00678 /* YYLEX -- calling `yylex' with the right arguments.  */
+00679 
+00680 #ifdef YYLEX_PARAM
+00681 # define YYLEX yylex (&yylval, YYLEX_PARAM)
+00682 #else
+00683 # define YYLEX yylex (&yylval)
+00684 #endif
+00685 
+00686 /* Enable debugging if requested.  */
+00687 #if YYDEBUG
+00688 
+00689 # ifndef YYFPRINTF
+00690 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
+00691 #  define YYFPRINTF fprintf
+00692 # endif
+00693 
+00694 # define YYDPRINTF(Args)                        \
+00695 do {                                            \
+00696   if (yydebug)                                  \
+00697     YYFPRINTF Args;                             \
+00698 } while (YYID (0))
+00699 
+00700 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
+00701 do {                                                                      \
+00702   if (yydebug)                                                            \
+00703     {                                                                     \
+00704       YYFPRINTF (stderr, "%s ", Title);                                   \
+00705       yy_symbol_print (stderr,                                            \
+00706                   Type, Value, context); \
+00707       YYFPRINTF (stderr, "\n");                                           \
+00708     }                                                                     \
+00709 } while (YYID (0))
+00710 
+00711 
+00712 /*--------------------------------.
+00713 | Print this symbol on YYOUTPUT.  |
+00714 `--------------------------------*/
+00715 
+00716 /*ARGSUSED*/
+00717 #if (defined __STDC__ || defined __C99__FUNC__ \
+00718      || defined __cplusplus || defined _MSC_VER)
+00719 static void
+00720 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, ParserContext_T* context)
+00721 #else
+00722 static void
+00723 yy_symbol_value_print (yyoutput, yytype, yyvaluep, context)
+00724     FILE *yyoutput;
+00725     int yytype;
+00726     YYSTYPE const * const yyvaluep;
+00727     ParserContext_T* context;
+00728 #endif
+00729 {
+00730   if (!yyvaluep)
+00731     return;
+00732   YYUSE (context);
+00733 # ifdef YYPRINT
+00734   if (yytype < YYNTOKENS)
+00735     YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
+00736 # else
+00737   YYUSE (yyoutput);
+00738 # endif
+00739   switch (yytype)
+00740     {
+00741       default:
+00742         break;
+00743     }
+00744 }
+00745 
+00746 
+00747 /*--------------------------------.
+00748 | Print this symbol on YYOUTPUT.  |
+00749 `--------------------------------*/
+00750 
+00751 #if (defined __STDC__ || defined __C99__FUNC__ \
+00752      || defined __cplusplus || defined _MSC_VER)
+00753 static void
+00754 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, ParserContext_T* context)
+00755 #else
+00756 static void
+00757 yy_symbol_print (yyoutput, yytype, yyvaluep, context)
+00758     FILE *yyoutput;
+00759     int yytype;
+00760     YYSTYPE const * const yyvaluep;
+00761     ParserContext_T* context;
+00762 #endif
+00763 {
+00764   if (yytype < YYNTOKENS)
+00765     YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
+00766   else
+00767     YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
+00768 
+00769   yy_symbol_value_print (yyoutput, yytype, yyvaluep, context);
+00770   YYFPRINTF (yyoutput, ")");
+00771 }
+00772 
+00773 /*------------------------------------------------------------------.
+00774 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
+00775 | TOP (included).                                                   |
+00776 `------------------------------------------------------------------*/
+00777 
+00778 #if (defined __STDC__ || defined __C99__FUNC__ \
+00779      || defined __cplusplus || defined _MSC_VER)
+00780 static void
+00781 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
+00782 #else
+00783 static void
+00784 yy_stack_print (yybottom, yytop)
+00785     yytype_int16 *yybottom;
+00786     yytype_int16 *yytop;
+00787 #endif
+00788 {
+00789   YYFPRINTF (stderr, "Stack now");
+00790   for (; yybottom <= yytop; yybottom++)
+00791     {
+00792       int yybot = *yybottom;
+00793       YYFPRINTF (stderr, " %d", yybot);
+00794     }
+00795   YYFPRINTF (stderr, "\n");
+00796 }
+00797 
+00798 # define YY_STACK_PRINT(Bottom, Top)                            \
+00799 do {                                                            \
+00800   if (yydebug)                                                  \
+00801     yy_stack_print ((Bottom), (Top));                           \
+00802 } while (YYID (0))
+00803 
+00804 
+00805 /*------------------------------------------------.
+00806 | Report that the YYRULE is going to be reduced.  |
+00807 `------------------------------------------------*/
+00808 
+00809 #if (defined __STDC__ || defined __C99__FUNC__ \
+00810      || defined __cplusplus || defined _MSC_VER)
+00811 static void
+00812 yy_reduce_print (YYSTYPE *yyvsp, int yyrule, ParserContext_T* context)
+00813 #else
+00814 static void
+00815 yy_reduce_print (yyvsp, yyrule, context)
+00816     YYSTYPE *yyvsp;
+00817     int yyrule;
+00818     ParserContext_T* context;
+00819 #endif
+00820 {
+00821   int yynrhs = yyr2[yyrule];
+00822   int yyi;
+00823   unsigned long int yylno = yyrline[yyrule];
+00824   YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
+00825              yyrule - 1, yylno);
+00826   /* The symbols being reduced.  */
+00827   for (yyi = 0; yyi < yynrhs; yyi++)
+00828     {
+00829       YYFPRINTF (stderr, "   $%d = ", yyi + 1);
+00830       yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
+00831                        &(yyvsp[(yyi + 1) - (yynrhs)])
+00832                                        , context);
+00833       YYFPRINTF (stderr, "\n");
+00834     }
+00835 }
+00836 
+00837 # define YY_REDUCE_PRINT(Rule)          \
+00838 do {                                    \
+00839   if (yydebug)                          \
+00840     yy_reduce_print (yyvsp, Rule, context); \
+00841 } while (YYID (0))
+00842 
+00843 /* Nonzero means print parse trace.  It is left uninitialized so that
+00844    multiple parsers can coexist.  */
+00845 int yydebug;
+00846 #else /* !YYDEBUG */
+00847 # define YYDPRINTF(Args)
+00848 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
+00849 # define YY_STACK_PRINT(Bottom, Top)
+00850 # define YY_REDUCE_PRINT(Rule)
+00851 #endif /* !YYDEBUG */
+00852 
+00853 
+00854 /* YYINITDEPTH -- initial size of the parser's stacks.  */
+00855 #ifndef YYINITDEPTH
+00856 # define YYINITDEPTH 200
+00857 #endif
+00858 
+00859 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
+00860    if the built-in stack extension method is used).
+00861 
+00862    Do not make this value too large; the results are undefined if
+00863    YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
+00864    evaluated with infinite-precision integer arithmetic.  */
+00865 
+00866 #ifndef YYMAXDEPTH
+00867 # define YYMAXDEPTH 10000
+00868 #endif
+00869 
+00870 
+00871 
+00872 #if YYERROR_VERBOSE
+00873 
+00874 # ifndef yystrlen
+00875 #  if defined __GLIBC__ && defined _STRING_H
+00876 #   define yystrlen strlen
+00877 #  else
+00878 /* Return the length of YYSTR.  */
+00879 #if (defined __STDC__ || defined __C99__FUNC__ \
+00880      || defined __cplusplus || defined _MSC_VER)
+00881 static YYSIZE_T
+00882 yystrlen (const char *yystr)
+00883 #else
+00884 static YYSIZE_T
+00885 yystrlen (yystr)
+00886     const char *yystr;
+00887 #endif
+00888 {
+00889   YYSIZE_T yylen;
+00890   for (yylen = 0; yystr[yylen]; yylen++)
+00891     continue;
+00892   return yylen;
+00893 }
+00894 #  endif
+00895 # endif
+00896 
+00897 # ifndef yystpcpy
+00898 #  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
+00899 #   define yystpcpy stpcpy
+00900 #  else
+00901 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
+00902    YYDEST.  */
+00903 #if (defined __STDC__ || defined __C99__FUNC__ \
+00904      || defined __cplusplus || defined _MSC_VER)
+00905 static char *
+00906 yystpcpy (char *yydest, const char *yysrc)
+00907 #else
+00908 static char *
+00909 yystpcpy (yydest, yysrc)
+00910     char *yydest;
+00911     const char *yysrc;
+00912 #endif
+00913 {
+00914   char *yyd = yydest;
+00915   const char *yys = yysrc;
+00916 
+00917   while ((*yyd++ = *yys++) != '\0')
+00918     continue;
+00919 
+00920   return yyd - 1;
+00921 }
+00922 #  endif
+00923 # endif
+00924 
+00925 # ifndef yytnamerr
+00926 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
+00927    quotes and backslashes, so that it's suitable for yyerror.  The
+00928    heuristic is that double-quoting is unnecessary unless the string
+00929    contains an apostrophe, a comma, or backslash (other than
+00930    backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
+00931    null, do not copy; instead, return the length of what the result
+00932    would have been.  */
+00933 static YYSIZE_T
+00934 yytnamerr (char *yyres, const char *yystr)
+00935 {
+00936   if (*yystr == '"')
+00937     {
+00938       YYSIZE_T yyn = 0;
+00939       char const *yyp = yystr;
+00940 
+00941       for (;;)
+00942         switch (*++yyp)
+00943           {
+00944           case '\'':
+00945           case ',':
+00946             goto do_not_strip_quotes;
+00947 
+00948           case '\\':
+00949             if (*++yyp != '\\')
+00950               goto do_not_strip_quotes;
+00951             /* Fall through.  */
+00952           default:
+00953             if (yyres)
+00954               yyres[yyn] = *yyp;
+00955             yyn++;
+00956             break;
+00957 
+00958           case '"':
+00959             if (yyres)
+00960               yyres[yyn] = '\0';
+00961             return yyn;
+00962           }
+00963     do_not_strip_quotes: ;
+00964     }
+00965 
+00966   if (! yyres)
+00967     return yystrlen (yystr);
+00968 
+00969   return yystpcpy (yyres, yystr) - yyres;
+00970 }
+00971 # endif
+00972 
+00973 /* Copy into YYRESULT an error message about the unexpected token
+00974    YYCHAR while in state YYSTATE.  Return the number of bytes copied,
+00975    including the terminating null byte.  If YYRESULT is null, do not
+00976    copy anything; just return the number of bytes that would be
+00977    copied.  As a special case, return 0 if an ordinary "syntax error"
+00978    message will do.  Return YYSIZE_MAXIMUM if overflow occurs during
+00979    size calculation.  */
+00980 static YYSIZE_T
+00981 yysyntax_error (char *yyresult, int yystate, int yychar)
+00982 {
+00983   int yyn = yypact[yystate];
+00984 
+00985   if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
+00986     return 0;
+00987   else
+00988     {
+00989       int yytype = YYTRANSLATE (yychar);
+00990       YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
+00991       YYSIZE_T yysize = yysize0;
+00992       YYSIZE_T yysize1;
+00993       int yysize_overflow = 0;
+00994       enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
+00995       char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
+00996       int yyx;
+00997 
+00998 # if 0
+00999       /* This is so xgettext sees the translatable formats that are
+01000          constructed on the fly.  */
+01001       YY_("syntax error, unexpected %s");
+01002       YY_("syntax error, unexpected %s, expecting %s");
+01003       YY_("syntax error, unexpected %s, expecting %s or %s");
+01004       YY_("syntax error, unexpected %s, expecting %s or %s or %s");
+01005       YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
+01006 # endif
+01007       char *yyfmt;
+01008       char const *yyf;
+01009       static char const yyunexpected[] = "syntax error, unexpected %s";
+01010       static char const yyexpecting[] = ", expecting %s";
+01011       static char const yyor[] = " or %s";
+01012       char yyformat[sizeof yyunexpected
+01013                     + sizeof yyexpecting - 1
+01014                     + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
+01015                        * (sizeof yyor - 1))];
+01016       char const *yyprefix = yyexpecting;
+01017 
+01018       /* Start YYX at -YYN if negative to avoid negative indexes in
+01019          YYCHECK.  */
+01020       int yyxbegin = yyn < 0 ? -yyn : 0;
+01021 
+01022       /* Stay within bounds of both yycheck and yytname.  */
+01023       int yychecklim = YYLAST - yyn + 1;
+01024       int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
+01025       int yycount = 1;
+01026 
+01027       yyarg[0] = yytname[yytype];
+01028       yyfmt = yystpcpy (yyformat, yyunexpected);
+01029 
+01030       for (yyx = yyxbegin; yyx < yyxend; ++yyx)
+01031         if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
+01032           {
+01033             if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
+01034               {
+01035                 yycount = 1;
+01036                 yysize = yysize0;
+01037                 yyformat[sizeof yyunexpected - 1] = '\0';
+01038                 break;
+01039               }
+01040             yyarg[yycount++] = yytname[yyx];
+01041             yysize1 = yysize + yytnamerr (0, yytname[yyx]);
+01042             yysize_overflow |= (yysize1 < yysize);
+01043             yysize = yysize1;
+01044             yyfmt = yystpcpy (yyfmt, yyprefix);
+01045             yyprefix = yyor;
+01046           }
+01047 
+01048       yyf = YY_(yyformat);
+01049       yysize1 = yysize + yystrlen (yyf);
+01050       yysize_overflow |= (yysize1 < yysize);
+01051       yysize = yysize1;
+01052 
+01053       if (yysize_overflow)
+01054         return YYSIZE_MAXIMUM;
+01055 
+01056       if (yyresult)
+01057         {
+01058           /* Avoid sprintf, as that infringes on the user's name space.
+01059              Don't have undefined behavior even if the translation
+01060              produced a string with the wrong number of "%s"s.  */
+01061           char *yyp = yyresult;
+01062           int yyi = 0;
+01063           while ((*yyp = *yyf) != '\0')
+01064             {
+01065               if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
+01066                 {
+01067                   yyp += yytnamerr (yyp, yyarg[yyi++]);
+01068                   yyf += 2;
+01069                 }
+01070               else
+01071                 {
+01072                   yyp++;
+01073                   yyf++;
+01074                 }
+01075             }
+01076         }
+01077       return yysize;
+01078     }
+01079 }
+01080 #endif /* YYERROR_VERBOSE */
+01081 
+01082 
+01083 /*-----------------------------------------------.
+01084 | Release the memory associated to this symbol.  |
+01085 `-----------------------------------------------*/
+01086 
+01087 /*ARGSUSED*/
+01088 #if (defined __STDC__ || defined __C99__FUNC__ \
+01089      || defined __cplusplus || defined _MSC_VER)
+01090 static void
+01091 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, ParserContext_T* context)
+01092 #else
+01093 static void
+01094 yydestruct (yymsg, yytype, yyvaluep, context)
+01095     const char *yymsg;
+01096     int yytype;
+01097     YYSTYPE *yyvaluep;
+01098     ParserContext_T* context;
+01099 #endif
+01100 {
+01101   YYUSE (yyvaluep);
+01102   YYUSE (context);
+01103 
+01104   if (!yymsg)
+01105     yymsg = "Deleting";
+01106   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
+01107 
+01108   switch (yytype)
+01109     {
+01110 
+01111       default:
+01112         break;
+01113     }
+01114 }
+01115 
+01116 /* Prevent warnings from -Wmissing-prototypes.  */
+01117 #ifdef YYPARSE_PARAM
+01118 #if defined __STDC__ || defined __cplusplus
+01119 int yyparse (void *YYPARSE_PARAM);
+01120 #else
+01121 int yyparse ();
+01122 #endif
+01123 #else /* ! YYPARSE_PARAM */
+01124 #if defined __STDC__ || defined __cplusplus
+01125 int yyparse (ParserContext_T* context);
+01126 #else
+01127 int yyparse ();
+01128 #endif
+01129 #endif /* ! YYPARSE_PARAM */
+01130 
+01131 
+01132 
+01133 
+01134 
+01135 /*-------------------------.
+01136 | yyparse or yypush_parse.  |
+01137 `-------------------------*/
+01138 
+01139 #ifdef YYPARSE_PARAM
+01140 #if (defined __STDC__ || defined __C99__FUNC__ \
+01141      || defined __cplusplus || defined _MSC_VER)
+01142 int
+01143 yyparse (void *YYPARSE_PARAM)
+01144 #else
+01145 int
+01146 yyparse (YYPARSE_PARAM)
+01147     void *YYPARSE_PARAM;
+01148 #endif
+01149 #else /* ! YYPARSE_PARAM */
+01150 #if (defined __STDC__ || defined __C99__FUNC__ \
+01151      || defined __cplusplus || defined _MSC_VER)
+01152 int
+01153 yyparse (ParserContext_T* context)
+01154 #else
+01155 int
+01156 yyparse (context)
+01157     ParserContext_T* context;
+01158 #endif
+01159 #endif
+01160 {
+01161 /* The lookahead symbol.  */
+01162 int yychar;
+01163 
+01164 /* The semantic value of the lookahead symbol.  */
+01165 YYSTYPE yylval;
+01166 
+01167     /* Number of syntax errors so far.  */
+01168     int yynerrs;
+01169 
+01170     int yystate;
+01171     /* Number of tokens to shift before error messages enabled.  */
+01172     int yyerrstatus;
+01173 
+01174     /* The stacks and their tools:
+01175        `yyss': related to states.
+01176        `yyvs': related to semantic values.
+01177 
+01178        Refer to the stacks thru separate pointers, to allow yyoverflow
+01179        to reallocate them elsewhere.  */
+01180 
+01181     /* The state stack.  */
+01182     yytype_int16 yyssa[YYINITDEPTH];
+01183     yytype_int16 *yyss;
+01184     yytype_int16 *yyssp;
+01185 
+01186     /* The semantic value stack.  */
+01187     YYSTYPE yyvsa[YYINITDEPTH];
+01188     YYSTYPE *yyvs;
+01189     YYSTYPE *yyvsp;
+01190 
+01191     YYSIZE_T yystacksize;
+01192 
+01193   int yyn;
+01194   int yyresult;
+01195   /* Lookahead token as an internal (translated) token number.  */
+01196   int yytoken;
+01197   /* The variables used to return semantic value and location from the
+01198      action routines.  */
+01199   YYSTYPE yyval;
+01200 
+01201 #if YYERROR_VERBOSE
+01202   /* Buffer for error messages, and its allocated size.  */
+01203   char yymsgbuf[128];
+01204   char *yymsg = yymsgbuf;
+01205   YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
+01206 #endif
+01207 
+01208 #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
+01209 
+01210   /* The number of symbols on the RHS of the reduced rule.
+01211      Keep to zero when no symbol should be popped.  */
+01212   int yylen = 0;
+01213 
+01214   yytoken = 0;
+01215   yyss = yyssa;
+01216   yyvs = yyvsa;
+01217   yystacksize = YYINITDEPTH;
+01218 
+01219   YYDPRINTF ((stderr, "Starting parse\n"));
+01220 
+01221   yystate = 0;
+01222   yyerrstatus = 0;
+01223   yynerrs = 0;
+01224   yychar = YYEMPTY; /* Cause a token to be read.  */
+01225 
+01226   /* Initialize stack pointers.
+01227      Waste one element of value and location stack
+01228      so that they stay on the same level as the state stack.
+01229      The wasted elements are never initialized.  */
+01230   yyssp = yyss;
+01231   yyvsp = yyvs;
+01232 
+01233   goto yysetstate;
+01234 
+01235 /*------------------------------------------------------------.
+01236 | yynewstate -- Push a new state, which is found in yystate.  |
+01237 `------------------------------------------------------------*/
+01238  yynewstate:
+01239   /* In all cases, when you get here, the value and location stacks
+01240      have just been pushed.  So pushing a state here evens the stacks.  */
+01241   yyssp++;
+01242 
+01243  yysetstate:
+01244   *yyssp = yystate;
+01245 
+01246   if (yyss + yystacksize - 1 <= yyssp)
+01247     {
+01248       /* Get the current used size of the three stacks, in elements.  */
+01249       YYSIZE_T yysize = yyssp - yyss + 1;
+01250 
+01251 #ifdef yyoverflow
+01252       {
+01253         /* Give user a chance to reallocate the stack.  Use copies of
+01254            these so that the &'s don't force the real ones into
+01255            memory.  */
+01256         YYSTYPE *yyvs1 = yyvs;
+01257         yytype_int16 *yyss1 = yyss;
+01258 
+01259         /* Each stack pointer address is followed by the size of the
+01260            data in use in that stack, in bytes.  This used to be a
+01261            conditional around just the two extra args, but that might
+01262            be undefined if yyoverflow is a macro.  */
+01263         yyoverflow (YY_("memory exhausted"),
+01264                     &yyss1, yysize * sizeof (*yyssp),
+01265                     &yyvs1, yysize * sizeof (*yyvsp),
+01266                     &yystacksize);
+01267 
+01268         yyss = yyss1;
+01269         yyvs = yyvs1;
+01270       }
+01271 #else /* no yyoverflow */
+01272 # ifndef YYSTACK_RELOCATE
+01273       goto yyexhaustedlab;
+01274 # else
+01275       /* Extend the stack our own way.  */
+01276       if (YYMAXDEPTH <= yystacksize)
+01277         goto yyexhaustedlab;
+01278       yystacksize *= 2;
+01279       if (YYMAXDEPTH < yystacksize)
+01280         yystacksize = YYMAXDEPTH;
+01281 
+01282       {
+01283         yytype_int16 *yyss1 = yyss;
+01284         union yyalloc *yyptr =
+01285           (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
+01286         if (! yyptr)
+01287           goto yyexhaustedlab;
+01288         YYSTACK_RELOCATE (yyss_alloc, yyss);
+01289         YYSTACK_RELOCATE (yyvs_alloc, yyvs);
+01290 #  undef YYSTACK_RELOCATE
+01291         if (yyss1 != yyssa)
+01292           YYSTACK_FREE (yyss1);
+01293       }
+01294 # endif
+01295 #endif /* no yyoverflow */
+01296 
+01297       yyssp = yyss + yysize - 1;
+01298       yyvsp = yyvs + yysize - 1;
+01299 
+01300       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
+01301                   (unsigned long int) yystacksize));
+01302 
+01303       if (yyss + yystacksize - 1 <= yyssp)
+01304         YYABORT;
+01305     }
+01306 
+01307   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
+01308 
+01309   if (yystate == YYFINAL)
+01310     YYACCEPT;
+01311 
+01312   goto yybackup;
+01313 
+01314 /*-----------.
+01315 | yybackup.  |
+01316 `-----------*/
+01317 yybackup:
+01318 
+01319   /* Do appropriate processing given the current state.  Read a
+01320      lookahead token if we need one and don't already have one.  */
+01321 
+01322   /* First try to decide what to do without reference to lookahead token.  */
+01323   yyn = yypact[yystate];
+01324   if (yyn == YYPACT_NINF)
+01325     goto yydefault;
+01326 
+01327   /* Not known => get a lookahead token if don't already have one.  */
+01328 
+01329   /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
+01330   if (yychar == YYEMPTY)
+01331     {
+01332       YYDPRINTF ((stderr, "Reading a token: "));
+01333       yychar = YYLEX;
+01334     }
+01335 
+01336   if (yychar <= YYEOF)
+01337     {
+01338       yychar = yytoken = YYEOF;
+01339       YYDPRINTF ((stderr, "Now at end of input.\n"));
+01340     }
+01341   else
+01342     {
+01343       yytoken = YYTRANSLATE (yychar);
+01344       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
+01345     }
+01346 
+01347   /* If the proper action on seeing token YYTOKEN is to reduce or to
+01348      detect an error, take that action.  */
+01349   yyn += yytoken;
+01350   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
+01351     goto yydefault;
+01352   yyn = yytable[yyn];
+01353   if (yyn <= 0)
+01354     {
+01355       if (yyn == 0 || yyn == YYTABLE_NINF)
+01356         goto yyerrlab;
+01357       yyn = -yyn;
+01358       goto yyreduce;
+01359     }
+01360 
+01361   /* Count tokens shifted since error; after three, turn off error
+01362      status.  */
+01363   if (yyerrstatus)
+01364     yyerrstatus--;
+01365 
+01366   /* Shift the lookahead token.  */
+01367   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
+01368 
+01369   /* Discard the shifted token.  */
+01370   yychar = YYEMPTY;
+01371 
+01372   yystate = yyn;
+01373   *++yyvsp = yylval;
+01374 
+01375   goto yynewstate;
+01376 
+01377 
+01378 /*-----------------------------------------------------------.
+01379 | yydefault -- do the default action for the current state.  |
+01380 `-----------------------------------------------------------*/
+01381 yydefault:
+01382   yyn = yydefact[yystate];
+01383   if (yyn == 0)
+01384     goto yyerrlab;
+01385   goto yyreduce;
+01386 
+01387 
+01388 /*-----------------------------.
+01389 | yyreduce -- Do a reduction.  |
+01390 `-----------------------------*/
+01391 yyreduce:
+01392   /* yyn is the number of a rule to reduce with.  */
+01393   yylen = yyr2[yyn];
+01394 
+01395   /* If YYLEN is nonzero, implement the default value of the action:
+01396      `$$ = $1'.
+01397 
+01398      Otherwise, the following line sets YYVAL to garbage.
+01399      This behavior is undocumented and Bison
+01400      users should not rely upon it.  Assigning to YYVAL
+01401      unconditionally makes the parser a bit smaller, and it avoids a
+01402      GCC warning that YYVAL may be used uninitialized.  */
+01403   yyval = yyvsp[1-yylen];
+01404 
+01405 
+01406   YY_REDUCE_PRINT (yyn);
+01407   switch (yyn)
+01408     {
+01409         case 3:
+01410 
+01411 /* Line 1464 of yacc.c  */
+01412 #line 77 "src/parser/grammar/grammar.y"
+01413     { NODE_APPEND(context->ast, (yyvsp[(2) - (2)].Node)); ;}
+01414     break;
+01415 
+01416   case 4:
+01417 
+01418 /* Line 1464 of yacc.c  */
+01419 #line 81 "src/parser/grammar/grammar.y"
+01420     { (yyval.Node) = NODE(ASSIGN, 2, (yyvsp[(1) - (4)].Node), (yyvsp[(3) - (4)].Node) ); ;}
+01421     break;
+01422 
+01423   case 5:
+01424 
+01425 /* Line 1464 of yacc.c  */
+01426 #line 82 "src/parser/grammar/grammar.y"
+01427     { (yyval.Node) = (yyvsp[(1) - (2)].Node); ;}
+01428     break;
+01429 
+01430   case 6:
+01431 
+01432 /* Line 1464 of yacc.c  */
+01433 #line 86 "src/parser/grammar/grammar.y"
+01434     { (yyval.Node) = NODE(ADD, 2, (yyvsp[(1) - (3)].Node), (yyvsp[(3) - (3)].Node)); ;}
+01435     break;
+01436 
+01437   case 7:
+01438 
+01439 /* Line 1464 of yacc.c  */
+01440 #line 87 "src/parser/grammar/grammar.y"
+01441     { (yyval.Node) = NODE(SUB, 2, (yyvsp[(1) - (3)].Node), (yyvsp[(3) - (3)].Node)); ;}
+01442     break;
+01443 
+01444   case 8:
+01445 
+01446 /* Line 1464 of yacc.c  */
+01447 #line 88 "src/parser/grammar/grammar.y"
+01448     { (yyval.Node) = NODE(MUL, 2, (yyvsp[(1) - (3)].Node), (yyvsp[(3) - (3)].Node)); ;}
+01449     break;
+01450 
+01451   case 9:
+01452 
+01453 /* Line 1464 of yacc.c  */
+01454 #line 89 "src/parser/grammar/grammar.y"
+01455     { (yyval.Node) = NODE(DIV, 2, (yyvsp[(1) - (3)].Node), (yyvsp[(3) - (3)].Node)); ;}
+01456     break;
+01457 
+01458   case 10:
+01459 
+01460 /* Line 1464 of yacc.c  */
+01461 #line 90 "src/parser/grammar/grammar.y"
+01462     { (yyval.Node) = NODE(MOD, 2, (yyvsp[(1) - (3)].Node), (yyvsp[(3) - (3)].Node)); ;}
+01463     break;
+01464 
+01465   case 11:
+01466 
+01467 /* Line 1464 of yacc.c  */
+01468 #line 93 "src/parser/grammar/grammar.y"
+01469     { (yyval.Node) = NODE(AND, 2, (yyvsp[(1) - (3)].Node), (yyvsp[(3) - (3)].Node)); ;}
+01470     break;
+01471 
+01472   case 12:
+01473 
+01474 /* Line 1464 of yacc.c  */
+01475 #line 94 "src/parser/grammar/grammar.y"
+01476     { (yyval.Node) = NODE(OR, 2, (yyvsp[(1) - (3)].Node), (yyvsp[(3) - (3)].Node)); ;}
+01477     break;
+01478 
+01479   case 13:
+01480 
+01481 /* Line 1464 of yacc.c  */
+01482 #line 95 "src/parser/grammar/grammar.y"
+01483     { (yyval.Node) = NODE(NOT, 1, (yyvsp[(2) - (2)].Node)); ;}
+01484     break;
+01485 
+01486   case 14:
+01487 
+01488 /* Line 1464 of yacc.c  */
+01489 #line 98 "src/parser/grammar/grammar.y"
+01490     { (yyval.Node) = NODE(EQ, 2, (yyvsp[(1) - (3)].Node), (yyvsp[(3) - (3)].Node)); ;}
+01491     break;
+01492 
+01493   case 15:
+01494 
+01495 /* Line 1464 of yacc.c  */
+01496 #line 99 "src/parser/grammar/grammar.y"
+01497     { (yyval.Node) = NODE(NE, 2, (yyvsp[(1) - (3)].Node), (yyvsp[(3) - (3)].Node)); ;}
+01498     break;
+01499 
+01500   case 16:
+01501 
+01502 /* Line 1464 of yacc.c  */
+01503 #line 100 "src/parser/grammar/grammar.y"
+01504     { (yyval.Node) = NODE(LT, 2, (yyvsp[(1) - (3)].Node), (yyvsp[(3) - (3)].Node)); ;}
+01505     break;
+01506 
+01507   case 17:
+01508 
+01509 /* Line 1464 of yacc.c  */
+01510 #line 101 "src/parser/grammar/grammar.y"
+01511     { (yyval.Node) = NODE(GT, 2, (yyvsp[(1) - (3)].Node), (yyvsp[(3) - (3)].Node)); ;}
+01512     break;
+01513 
+01514   case 18:
+01515 
+01516 /* Line 1464 of yacc.c  */
+01517 #line 102 "src/parser/grammar/grammar.y"
+01518     { (yyval.Node) = NODE(LTE, 2, (yyvsp[(1) - (3)].Node), (yyvsp[(3) - (3)].Node)); ;}
+01519     break;
+01520 
+01521   case 19:
+01522 
+01523 /* Line 1464 of yacc.c  */
+01524 #line 103 "src/parser/grammar/grammar.y"
+01525     { (yyval.Node) = NODE(GTE, 2, (yyvsp[(1) - (3)].Node), (yyvsp[(3) - (3)].Node)); ;}
+01526     break;
+01527 
+01528   case 20:
+01529 
+01530 /* Line 1464 of yacc.c  */
+01531 #line 106 "src/parser/grammar/grammar.y"
+01532     { (yyval.Node) = (yyvsp[(2) - (3)].Node); ;}
+01533     break;
+01534 
+01535   case 21:
+01536 
+01537 /* Line 1464 of yacc.c  */
+01538 #line 107 "src/parser/grammar/grammar.y"
+01539     { (yyval.Node) = (yyvsp[(1) - (1)].Node); ;}
+01540     break;
+01541 
+01542   case 22:
+01543 
+01544 /* Line 1464 of yacc.c  */
+01545 #line 108 "src/parser/grammar/grammar.y"
+01546     { (yyval.Node) = NODE(TERN, 3, (yyvsp[(1) - (5)].Node), (yyvsp[(3) - (5)].Node), (yyvsp[(5) - (5)].Node)); ;}
+01547     break;
+01548 
+01549   case 23:
+01550 
+01551 /* Line 1464 of yacc.c  */
+01552 #line 109 "src/parser/grammar/grammar.y"
+01553     { (yyval.Node) = (yyvsp[(1) - (1)].Node); ;}
+01554     break;
+01555 
+01556   case 24:
+01557 
+01558 /* Line 1464 of yacc.c  */
+01559 #line 113 "src/parser/grammar/grammar.y"
+01560     { (yyval.Node) = (yyvsp[(1) - (1)].Node); ;}
+01561     break;
+01562 
+01563   case 25:
+01564 
+01565 /* Line 1464 of yacc.c  */
+01566 #line 114 "src/parser/grammar/grammar.y"
+01567     { (yyval.Node) = (yyvsp[(1) - (1)].Node); ;}
+01568     break;
+01569 
+01570 
+01571 
+01572 /* Line 1464 of yacc.c  */
+01573 #line 1574 "src/parser/grammar/grammar.tab.c"
+01574       default: break;
+01575     }
+01576   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
+01577 
+01578   YYPOPSTACK (yylen);
+01579   yylen = 0;
+01580   YY_STACK_PRINT (yyss, yyssp);
+01581 
+01582   *++yyvsp = yyval;
+01583 
+01584   /* Now `shift' the result of the reduction.  Determine what state
+01585      that goes to, based on the state we popped back to and the rule
+01586      number reduced by.  */
+01587 
+01588   yyn = yyr1[yyn];
+01589 
+01590   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
+01591   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
+01592     yystate = yytable[yystate];
+01593   else
+01594     yystate = yydefgoto[yyn - YYNTOKENS];
+01595 
+01596   goto yynewstate;
+01597 
+01598 
+01599 /*------------------------------------.
+01600 | yyerrlab -- here on detecting error |
+01601 `------------------------------------*/
+01602 yyerrlab:
+01603   /* If not already recovering from an error, report this error.  */
+01604   if (!yyerrstatus)
+01605     {
+01606       ++yynerrs;
+01607 #if ! YYERROR_VERBOSE
+01608       yyerror (context, YY_("syntax error"));
+01609 #else
+01610       {
+01611         YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
+01612         if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
+01613           {
+01614             YYSIZE_T yyalloc = 2 * yysize;
+01615             if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
+01616               yyalloc = YYSTACK_ALLOC_MAXIMUM;
+01617             if (yymsg != yymsgbuf)
+01618               YYSTACK_FREE (yymsg);
+01619             yymsg = (char *) YYSTACK_ALLOC (yyalloc);
+01620             if (yymsg)
+01621               yymsg_alloc = yyalloc;
+01622             else
+01623               {
+01624                 yymsg = yymsgbuf;
+01625                 yymsg_alloc = sizeof yymsgbuf;
+01626               }
+01627           }
+01628 
+01629         if (0 < yysize && yysize <= yymsg_alloc)
+01630           {
+01631             (void) yysyntax_error (yymsg, yystate, yychar);
+01632             yyerror (context, yymsg);
+01633           }
+01634         else
+01635           {
+01636             yyerror (context, YY_("syntax error"));
+01637             if (yysize != 0)
+01638               goto yyexhaustedlab;
+01639           }
+01640       }
+01641 #endif
+01642     }
+01643 
+01644 
+01645 
+01646   if (yyerrstatus == 3)
+01647     {
+01648       /* If just tried and failed to reuse lookahead token after an
+01649          error, discard it.  */
+01650 
+01651       if (yychar <= YYEOF)
+01652         {
+01653           /* Return failure if at end of input.  */
+01654           if (yychar == YYEOF)
+01655             YYABORT;
+01656         }
+01657       else
+01658         {
+01659           yydestruct ("Error: discarding",
+01660                       yytoken, &yylval, context);
+01661           yychar = YYEMPTY;
+01662         }
+01663     }
+01664 
+01665   /* Else will try to reuse lookahead token after shifting the error
+01666      token.  */
+01667   goto yyerrlab1;
+01668 
+01669 
+01670 /*---------------------------------------------------.
+01671 | yyerrorlab -- error raised explicitly by YYERROR.  |
+01672 `---------------------------------------------------*/
+01673 yyerrorlab:
+01674 
+01675   /* Pacify compilers like GCC when the user code never invokes
+01676      YYERROR and the label yyerrorlab therefore never appears in user
+01677      code.  */
+01678   if (/*CONSTCOND*/ 0)
+01679      goto yyerrorlab;
+01680 
+01681   /* Do not reclaim the symbols of the rule which action triggered
+01682      this YYERROR.  */
+01683   YYPOPSTACK (yylen);
+01684   yylen = 0;
+01685   YY_STACK_PRINT (yyss, yyssp);
+01686   yystate = *yyssp;
+01687   goto yyerrlab1;
+01688 
+01689 
+01690 /*-------------------------------------------------------------.
+01691 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
+01692 `-------------------------------------------------------------*/
+01693 yyerrlab1:
+01694   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
+01695 
+01696   for (;;)
+01697     {
+01698       yyn = yypact[yystate];
+01699       if (yyn != YYPACT_NINF)
+01700         {
+01701           yyn += YYTERROR;
+01702           if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
+01703             {
+01704               yyn = yytable[yyn];
+01705               if (0 < yyn)
+01706                 break;
+01707             }
+01708         }
+01709 
+01710       /* Pop the current state because it cannot handle the error token.  */
+01711       if (yyssp == yyss)
+01712         YYABORT;
+01713 
+01714 
+01715       yydestruct ("Error: popping",
+01716                   yystos[yystate], yyvsp, context);
+01717       YYPOPSTACK (1);
+01718       yystate = *yyssp;
+01719       YY_STACK_PRINT (yyss, yyssp);
+01720     }
+01721 
+01722   *++yyvsp = yylval;
+01723 
+01724 
+01725   /* Shift the error token.  */
+01726   YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
+01727 
+01728   yystate = yyn;
+01729   goto yynewstate;
+01730 
+01731 
+01732 /*-------------------------------------.
+01733 | yyacceptlab -- YYACCEPT comes here.  |
+01734 `-------------------------------------*/
+01735 yyacceptlab:
+01736   yyresult = 0;
+01737   goto yyreturn;
+01738 
+01739 /*-----------------------------------.
+01740 | yyabortlab -- YYABORT comes here.  |
+01741 `-----------------------------------*/
+01742 yyabortlab:
+01743   yyresult = 1;
+01744   goto yyreturn;
+01745 
+01746 #if !defined(yyoverflow) || YYERROR_VERBOSE
+01747 /*-------------------------------------------------.
+01748 | yyexhaustedlab -- memory exhaustion comes here.  |
+01749 `-------------------------------------------------*/
+01750 yyexhaustedlab:
+01751   yyerror (context, YY_("memory exhausted"));
+01752   yyresult = 2;
+01753   /* Fall through.  */
+01754 #endif
+01755 
+01756 yyreturn:
+01757   if (yychar != YYEMPTY)
+01758      yydestruct ("Cleanup: discarding lookahead",
+01759                  yytoken, &yylval, context);
+01760   /* Do not reclaim the symbols of the rule which action triggered
+01761      this YYABORT or YYACCEPT.  */
+01762   YYPOPSTACK (yylen);
+01763   YY_STACK_PRINT (yyss, yyssp);
+01764   while (yyssp != yyss)
+01765     {
+01766       yydestruct ("Cleanup: popping",
+01767                   yystos[*yyssp], yyvsp, context);
+01768       YYPOPSTACK (1);
+01769     }
+01770 #ifndef yyoverflow
+01771   if (yyss != yyssa)
+01772     YYSTACK_FREE (yyss);
+01773 #endif
+01774 #if YYERROR_VERBOSE
+01775   if (yymsg != yymsgbuf)
+01776     YYSTACK_FREE (yymsg);
+01777 #endif
+01778   /* Make sure YYID is used.  */
+01779   return YYID (yyresult);
+01780 }
+01781 
+01782 
+01783 
+01784 /* Line 1684 of yacc.c  */
+01785 #line 117 "src/parser/grammar/grammar.y"
+01786 
+01787 
+01788 
+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/grammar_8tab_8h.html b/flex-bison/mark1/docs/html/grammar_8tab_8h.html new file mode 100644 index 0000000..5780464 --- /dev/null +++ b/flex-bison/mark1/docs/html/grammar_8tab_8h.html @@ -0,0 +1,299 @@ + + + + +Mark1: src/parser/grammar/grammar.tab.h File Reference + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + +
+
+ +
+
+
+ +
+
+ +
+

src/parser/grammar/grammar.tab.h File Reference

+
+
+ +

Go to the source code of this file.

+ + + + + + + + + + + +

+Data Structures

union  YYSTYPE

+Defines

#define YYSTYPE_IS_TRIVIAL   1
#define yystype   YYSTYPE
#define YYSTYPE_IS_DECLARED   1

+Typedefs

typedef union YYSTYPE YYSTYPE

+Enumerations

enum  yytokentype {
+  tBOOL = 258, +tFLOAT = 259, +tSTRING = 260, +tID = 261, +
+  tAND = 262, +tOR = 263, +tNOT = 264, +tEQ = 265, +
+  tNE = 266, +tGT = 267, +tLT = 268, +tGTE = 269, +
+  tLTE = 270, +tBOOL = 258, +tFLOAT = 259, +tSTRING = 260, +
+  tID = 261, +tAND = 262, +tOR = 263, +tNOT = 264, +
+  tEQ = 265, +tNE = 266, +tGT = 267, +tLT = 268, +
+  tGTE = 269, +tLTE = 270 +
+ }
+

Define Documentation

+ +
+
+ + + + +
#define yystype   YYSTYPE
+
+
+ +

Definition at line 74 of file grammar.tab.h.

+ +
+
+ +
+
+ + + + +
#define YYSTYPE_IS_DECLARED   1
+
+
+ +

Definition at line 75 of file grammar.tab.h.

+ +
+
+ +
+
+ + + + +
#define YYSTYPE_IS_TRIVIAL   1
+
+
+ +

Definition at line 73 of file grammar.tab.h.

+ +
+
+

Typedef Documentation

+ +
+
+ + + + +
typedef union YYSTYPE YYSTYPE
+
+
+ +
+
+

Enumeration Type Documentation

+ +
+
+ + + + +
enum yytokentype
+
+
+
Enumerator:
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
tBOOL  +
tFLOAT  +
tSTRING  +
tID  +
tAND  +
tOR  +
tNOT  +
tEQ  +
tNE  +
tGT  +
tLT  +
tGTE  +
tLTE  +
tBOOL  +
tFLOAT  +
tSTRING  +
tID  +
tAND  +
tOR  +
tNOT  +
tEQ  +
tNE  +
tGT  +
tLT  +
tGTE  +
tLTE  +
+
+
+ +

Definition at line 40 of file grammar.tab.h.

+ +
+
+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/grammar_8tab_8h_source.html b/flex-bison/mark1/docs/html/grammar_8tab_8h_source.html new file mode 100644 index 0000000..17130d6 --- /dev/null +++ b/flex-bison/mark1/docs/html/grammar_8tab_8h_source.html @@ -0,0 +1,190 @@ + + + + +Mark1: src/parser/grammar/grammar.tab.h Source File + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + +
+
+ +
+
+
+ +
+
+
+

src/parser/grammar/grammar.tab.h

+
+
+Go to the documentation of this file.
00001 /* A Bison parser, made by GNU Bison 2.4.2.  */
+00002 
+00003 /* Skeleton interface for Bison's Yacc-like parsers in C
+00004    
+00005       Copyright (C) 1984, 1989-1990, 2000-2006, 2009-2010 Free Software
+00006    Foundation, Inc.
+00007    
+00008    This program is free software: you can redistribute it and/or modify
+00009    it under the terms of the GNU General Public License as published by
+00010    the Free Software Foundation, either version 3 of the License, or
+00011    (at your option) any later version.
+00012    
+00013    This program is distributed in the hope that it will be useful,
+00014    but WITHOUT ANY WARRANTY; without even the implied warranty of
+00015    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+00016    GNU General Public License for more details.
+00017    
+00018    You should have received a copy of the GNU General Public License
+00019    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+00020 
+00021 /* As a special exception, you may create a larger work that contains
+00022    part or all of the Bison parser skeleton and distribute that work
+00023    under terms of your choice, so long as that work isn't itself a
+00024    parser generator using the skeleton or a modified version thereof
+00025    as a parser skeleton.  Alternatively, if you modify or redistribute
+00026    the parser skeleton itself, you may (at your option) remove this
+00027    special exception, which will cause the skeleton and the resulting
+00028    Bison output files to be licensed under the GNU General Public
+00029    License without this special exception.
+00030    
+00031    This special exception was added by the Free Software Foundation in
+00032    version 2.2 of Bison.  */
+00033 
+00034 
+00035 /* Tokens.  */
+00036 #ifndef YYTOKENTYPE
+00037 # define YYTOKENTYPE
+00038    /* Put the tokens into the symbol table, so that GDB and other debuggers
+00039       know about them.  */
+00040    enum yytokentype {
+00041      tBOOL = 258,
+00042      tFLOAT = 259,
+00043      tSTRING = 260,
+00044      tID = 261,
+00045      tAND = 262,
+00046      tOR = 263,
+00047      tNOT = 264,
+00048      tEQ = 265,
+00049      tNE = 266,
+00050      tGT = 267,
+00051      tLT = 268,
+00052      tGTE = 269,
+00053      tLTE = 270
+00054    };
+00055 #endif
+00056 
+00057 
+00058 
+00059 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
+00060 typedef union YYSTYPE
+00061 {
+00062 
+00063 /* Line 1685 of yacc.c  */
+00064 #line 23 "src/parser/grammar/grammar.y"
+00065 
+00066         void * Node;
+00067 
+00068 
+00069 
+00070 /* Line 1685 of yacc.c  */
+00071 #line 72 "src/parser/grammar/grammar.tab.h"
+00072 } YYSTYPE;
+00073 # define YYSTYPE_IS_TRIVIAL 1
+00074 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
+00075 # define YYSTYPE_IS_DECLARED 1
+00076 #endif
+00077 
+00078 
+00079 
+00080 
+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/graph_legend.html b/flex-bison/mark1/docs/html/graph_legend.html new file mode 100644 index 0000000..88b07c4 --- /dev/null +++ b/flex-bison/mark1/docs/html/graph_legend.html @@ -0,0 +1,167 @@ + + + + +Mark1: Graph Legend + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ +
+
+ +
+
+
+ +
+
+
+

Graph Legend

+
+
+

This page explains how to interpret the graphs that are generated by doxygen.

+

Consider the following example:

+
/*! Invisible class because of truncation */
+class Invisible { };
+
+/*! Truncated class, inheritance relation is hidden */
+class Truncated : public Invisible { };
+
+/* Class not documented with doxygen comments */
+class Undocumented { };
+
+/*! Class that is inherited using public inheritance */
+class PublicBase : public Truncated { };
+
+/*! A template class */
+template<class T> class Templ { };
+
+/*! Class that is inherited using protected inheritance */
+class ProtectedBase { };
+
+/*! Class that is inherited using private inheritance */
+class PrivateBase { };
+
+/*! Class that is used by the Inherited class */
+class Used { };
+
+/*! Super class that inherits a number of other classes */
+class Inherited : public PublicBase,
+                  protected ProtectedBase,
+                  private PrivateBase,
+                  public Undocumented,
+                  public Templ<int>
+{
+  private:
+    Used *m_usedClass;
+};
+

This will result in the following graph:

+
+graph_legend.png +
+

The boxes in the above graph have the following meaning:

+
    +
  • +A filled gray box represents the struct or class for which the graph is generated.
  • +
  • +A box with a black border denotes a documented struct or class.
  • +
  • +A box with a grey border denotes an undocumented struct or class.
  • +
  • +A box with a red border denotes a documented struct or class forwhich not all inheritance/containment relations are shown. A graph is truncated if it does not fit within the specified boundaries.
  • +
+

The arrows have the following meaning:

+
    +
  • +A dark blue arrow is used to visualize a public inheritance relation between two classes.
  • +
  • +A dark green arrow is used for protected inheritance.
  • +
  • +A dark red arrow is used for private inheritance.
  • +
  • +A purple dashed arrow is used if a class is contained or used by another class. The arrow is labeled with the variable(s) through which the pointed class or struct is accessible.
  • +
  • +A yellow dashed arrow denotes a relation between a template instance and the template class it was instantiated from. The arrow is labeled with the template parameters of the instance.
  • +
+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/graph_legend.md5 b/flex-bison/mark1/docs/html/graph_legend.md5 new file mode 100644 index 0000000..9d509f3 --- /dev/null +++ b/flex-bison/mark1/docs/html/graph_legend.md5 @@ -0,0 +1 @@ +9fbb782f23f919c0064b8f454a56ede8 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/graph_legend.png b/flex-bison/mark1/docs/html/graph_legend.png new file mode 100644 index 0000000..5ad43c9 Binary files /dev/null and b/flex-bison/mark1/docs/html/graph_legend.png differ diff --git a/flex-bison/mark1/docs/html/il__opcodes_8c.html b/flex-bison/mark1/docs/html/il__opcodes_8c.html new file mode 100644 index 0000000..9642fd1 --- /dev/null +++ b/flex-bison/mark1/docs/html/il__opcodes_8c.html @@ -0,0 +1,263 @@ + + + + +Mark1: src/il_opcodes/il_opcodes.c File Reference + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + +
+
+ +
+
+
+ +
+
+ +
+

src/il_opcodes/il_opcodes.c File Reference

+
+
+
#include "il_opcodes.h"
+
+Include dependency graph for il_opcodes.c:
+
+
+ + +
+
+

Go to the source code of this file.

+ + + + + + + +

+Functions

OpcodeInfo_TIL_LookupOpcodeDefinition (Opcode_T opcode)
String IL_LookupDisplayText (Opcode_T opcode)
String IL_LookupMacroText (Opcode_T opcode)

+Variables

STATIC const OpcodeInfo_T Opcode_Info_Lookup []
+

Function Documentation

+ +
+
+ + + + + + + + +
String IL_LookupDisplayText (Opcode_T opcode)
+
+
+ +

Definition at line 63 of file il_opcodes.c.

+ +

+Here is the call graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + +
String IL_LookupMacroText (Opcode_T opcode)
+
+
+ +

Definition at line 69 of file il_opcodes.c.

+ +

+Here is the call graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + +
OpcodeInfo_T* IL_LookupOpcodeDefinition (Opcode_T opcode)
+
+
+ +

Definition at line 35 of file il_opcodes.c.

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+

Variable Documentation

+ +
+
+ + + + +
STATIC const OpcodeInfo_T Opcode_Info_Lookup[]
+
+
+Initial value:
 {
+        { ROOT,    "ROOT",    "ModuleStart" },
+        { ADD,     "ADD",     "Add" },
+        { SUB,     "SUB",     "Subtract" },
+        { MUL,     "MUL",     "Multiply" },
+        { DIV,     "DIV",     "Divide" },
+        { MOD,     "MOD",     "Modulus" },
+        { AND,     "AND",     "And" },
+        { OR,      "OR",      "Or" },
+        { NOT,     "NOT",     "Not" },
+        { EQ,      "EQ",      "Equal" },
+        { NE,      "NE",      "NotEqual" },
+        { LT,      "LT",      "LessThan" },
+        { GT,      "GT",      "GreaterThan" },
+        { LTE,     "LTE",     "LessOrEqual" },
+        { GTE,     "GTE",     "GreatOrEqual" },
+        { ASSIGN,  "ASSIGN",  "Assign" },
+
+        { TERN,    "TERN",    NULL },
+        { ARRAY,   "ARRAY",   NULL },
+        { MAP,     "MAP",     NULL },
+        { FUNC,    "FUNC",    NULL },
+
+        { ID,      "ID",      NULL },
+        { INT,     "INT",     NULL },
+        { FLOAT,   "FLOAT",   NULL },
+        { STRING,  "STRING",  NULL },
+        { BOOLEAN, "BOOLEAN", NULL }
+}
+
+

Definition at line 4 of file il_opcodes.c.

+ +
+
+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/il__opcodes_8c__incl.map b/flex-bison/mark1/docs/html/il__opcodes_8c__incl.map new file mode 100644 index 0000000..c374e66 --- /dev/null +++ b/flex-bison/mark1/docs/html/il__opcodes_8c__incl.map @@ -0,0 +1,3 @@ + + + diff --git a/flex-bison/mark1/docs/html/il__opcodes_8c__incl.md5 b/flex-bison/mark1/docs/html/il__opcodes_8c__incl.md5 new file mode 100644 index 0000000..9a3a97b --- /dev/null +++ b/flex-bison/mark1/docs/html/il__opcodes_8c__incl.md5 @@ -0,0 +1 @@ +a1c86ea06e8f6f11193b322a043b367c \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/il__opcodes_8c__incl.png b/flex-bison/mark1/docs/html/il__opcodes_8c__incl.png new file mode 100644 index 0000000..ce8bc6c Binary files /dev/null and b/flex-bison/mark1/docs/html/il__opcodes_8c__incl.png differ diff --git a/flex-bison/mark1/docs/html/il__opcodes_8c_a14d5d1c5c42df6a170157e9749c27911_cgraph.map b/flex-bison/mark1/docs/html/il__opcodes_8c_a14d5d1c5c42df6a170157e9749c27911_cgraph.map new file mode 100644 index 0000000..8f2115c --- /dev/null +++ b/flex-bison/mark1/docs/html/il__opcodes_8c_a14d5d1c5c42df6a170157e9749c27911_cgraph.map @@ -0,0 +1,3 @@ + + + diff --git a/flex-bison/mark1/docs/html/il__opcodes_8c_a14d5d1c5c42df6a170157e9749c27911_cgraph.md5 b/flex-bison/mark1/docs/html/il__opcodes_8c_a14d5d1c5c42df6a170157e9749c27911_cgraph.md5 new file mode 100644 index 0000000..dcfddc2 --- /dev/null +++ b/flex-bison/mark1/docs/html/il__opcodes_8c_a14d5d1c5c42df6a170157e9749c27911_cgraph.md5 @@ -0,0 +1 @@ +0d854ba21b6a502f7a5d405829e73b37 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/il__opcodes_8c_a14d5d1c5c42df6a170157e9749c27911_cgraph.png b/flex-bison/mark1/docs/html/il__opcodes_8c_a14d5d1c5c42df6a170157e9749c27911_cgraph.png new file mode 100644 index 0000000..073c6a8 Binary files /dev/null and b/flex-bison/mark1/docs/html/il__opcodes_8c_a14d5d1c5c42df6a170157e9749c27911_cgraph.png differ diff --git a/flex-bison/mark1/docs/html/il__opcodes_8c_a2a6a76c96d76b57e091bbe7a11d7a8e9_cgraph.map b/flex-bison/mark1/docs/html/il__opcodes_8c_a2a6a76c96d76b57e091bbe7a11d7a8e9_cgraph.map new file mode 100644 index 0000000..daf5f28 --- /dev/null +++ b/flex-bison/mark1/docs/html/il__opcodes_8c_a2a6a76c96d76b57e091bbe7a11d7a8e9_cgraph.map @@ -0,0 +1,3 @@ + + + diff --git a/flex-bison/mark1/docs/html/il__opcodes_8c_a2a6a76c96d76b57e091bbe7a11d7a8e9_cgraph.md5 b/flex-bison/mark1/docs/html/il__opcodes_8c_a2a6a76c96d76b57e091bbe7a11d7a8e9_cgraph.md5 new file mode 100644 index 0000000..2fa4e9a --- /dev/null +++ b/flex-bison/mark1/docs/html/il__opcodes_8c_a2a6a76c96d76b57e091bbe7a11d7a8e9_cgraph.md5 @@ -0,0 +1 @@ +882b10959004b25583afa82066f82211 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/il__opcodes_8c_a2a6a76c96d76b57e091bbe7a11d7a8e9_cgraph.png b/flex-bison/mark1/docs/html/il__opcodes_8c_a2a6a76c96d76b57e091bbe7a11d7a8e9_cgraph.png new file mode 100644 index 0000000..deed51b Binary files /dev/null and b/flex-bison/mark1/docs/html/il__opcodes_8c_a2a6a76c96d76b57e091bbe7a11d7a8e9_cgraph.png differ diff --git a/flex-bison/mark1/docs/html/il__opcodes_8c_a3611fb212f40ac7761e39b45c7c78586_icgraph.map b/flex-bison/mark1/docs/html/il__opcodes_8c_a3611fb212f40ac7761e39b45c7c78586_icgraph.map new file mode 100644 index 0000000..93bc1d8 --- /dev/null +++ b/flex-bison/mark1/docs/html/il__opcodes_8c_a3611fb212f40ac7761e39b45c7c78586_icgraph.map @@ -0,0 +1,4 @@ + + + + diff --git a/flex-bison/mark1/docs/html/il__opcodes_8c_a3611fb212f40ac7761e39b45c7c78586_icgraph.md5 b/flex-bison/mark1/docs/html/il__opcodes_8c_a3611fb212f40ac7761e39b45c7c78586_icgraph.md5 new file mode 100644 index 0000000..ed92038 --- /dev/null +++ b/flex-bison/mark1/docs/html/il__opcodes_8c_a3611fb212f40ac7761e39b45c7c78586_icgraph.md5 @@ -0,0 +1 @@ +7d110518dc8d655cec43c99accb7b923 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/il__opcodes_8c_a3611fb212f40ac7761e39b45c7c78586_icgraph.png b/flex-bison/mark1/docs/html/il__opcodes_8c_a3611fb212f40ac7761e39b45c7c78586_icgraph.png new file mode 100644 index 0000000..ffd8b6d Binary files /dev/null and b/flex-bison/mark1/docs/html/il__opcodes_8c_a3611fb212f40ac7761e39b45c7c78586_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/il__opcodes_8c_source.html b/flex-bison/mark1/docs/html/il__opcodes_8c_source.html new file mode 100644 index 0000000..49b3963 --- /dev/null +++ b/flex-bison/mark1/docs/html/il__opcodes_8c_source.html @@ -0,0 +1,184 @@ + + + + +Mark1: src/il_opcodes/il_opcodes.c Source File + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + +
+
+ +
+
+
+ +
+
+
+

src/il_opcodes/il_opcodes.c

+
+
+Go to the documentation of this file.
00001 #include "il_opcodes.h"
+00002 
+00003 /*STATIC const OpcodeInfo_T Opcode_Info_Lookup[] = {*/
+00004 STATIC const OpcodeInfo_T Opcode_Info_Lookup[] = {
+00005         { ROOT,    "ROOT",    "ModuleStart" },
+00006         { ADD,     "ADD",     "Add" },
+00007         { SUB,     "SUB",     "Subtract" },
+00008         { MUL,     "MUL",     "Multiply" },
+00009         { DIV,     "DIV",     "Divide" },
+00010         { MOD,     "MOD",     "Modulus" },
+00011         { AND,     "AND",     "And" },
+00012         { OR,      "OR",      "Or" },
+00013         { NOT,     "NOT",     "Not" },
+00014         { EQ,      "EQ",      "Equal" },
+00015         { NE,      "NE",      "NotEqual" },
+00016         { LT,      "LT",      "LessThan" },
+00017         { GT,      "GT",      "GreaterThan" },
+00018         { LTE,     "LTE",     "LessOrEqual" },
+00019         { GTE,     "GTE",     "GreatOrEqual" },
+00020         { ASSIGN,  "ASSIGN",  "Assign" },
+00021 
+00022         { TERN,    "TERN",    NULL },
+00023         { ARRAY,   "ARRAY",   NULL },
+00024         { MAP,     "MAP",     NULL },
+00025         { FUNC,    "FUNC",    NULL },
+00026 
+00027         { ID,      "ID",      NULL },
+00028         { INT,     "INT",     NULL },
+00029         { FLOAT,   "FLOAT",   NULL },
+00030         { STRING,  "STRING",  NULL },
+00031         { BOOLEAN, "BOOLEAN", NULL }
+00032 };
+00033 
+00034 
+00035 OpcodeInfo_T* IL_LookupOpcodeDefinition( Opcode_T opcode )
+00036 {
+00037         U32 lower = 0;
+00038         U32 upper = NUM_ELEMENTS(Opcode_Info_Lookup);
+00039         OpcodeInfo_T* found_item = NULL;
+00040 
+00041         while( lower <= upper )
+00042         {
+00043                 U32 index = ((upper - lower) / 2) + lower;
+00044                 OpcodeInfo_T* item = (OpcodeInfo_T*)&Opcode_Info_Lookup[index];
+00045                 
+00046                 if(opcode == item->opcode)
+00047                 {
+00048                         found_item = item;
+00049                         break;
+00050                 }
+00051                 else if(opcode > item->opcode)
+00052                 {
+00053                         lower = index;
+00054                 }
+00055                 else
+00056                 {
+00057                         upper = index;
+00058                 }
+00059         }
+00060         return found_item;
+00061 }
+00062 
+00063 String IL_LookupDisplayText( Opcode_T opcode )
+00064 {
+00065         OpcodeInfo_T* info = IL_LookupOpcodeDefinition( opcode );
+00066         return (info == NULL) ? NULL : info->display_txt;
+00067 }
+00068 
+00069 String IL_LookupMacroText( Opcode_T opcode )
+00070 {
+00071         OpcodeInfo_T* info = IL_LookupOpcodeDefinition( opcode );
+00072         return (info == NULL) ? NULL : info->macro_txt;
+00073 }
+00074 
+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/il__opcodes_8h.html b/flex-bison/mark1/docs/html/il__opcodes_8h.html new file mode 100644 index 0000000..5626794 --- /dev/null +++ b/flex-bison/mark1/docs/html/il__opcodes_8h.html @@ -0,0 +1,330 @@ + + + + +Mark1: src/il_opcodes/il_opcodes.h File Reference + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + +
+
+ +
+
+
+ +
+
+ +
+

src/il_opcodes/il_opcodes.h File Reference

+
+
+
#include "common.h"
+
+Include dependency graph for il_opcodes.h:
+
+
+
+
+This graph shows which files directly or indirectly include this file:
+
+
+ + +
+
+

Go to the source code of this file.

+ + + + + + + + + +

+Data Structures

struct  OpcodeInfo_T

+Enumerations

enum  Opcode_T {
+  ROOT = 0, +ADD = 1, +SUB = 2, +MUL = 3, +
+  DIV = 4, +MOD = 5, +AND = 6, +OR = 7, +
+  NOT = 8, +EQ = 9, +NE = 10, +LT = 11, +
+  GT = 12, +LTE = 13, +GTE = 14, +ASSIGN = 15, +
+  TERN = 16, +ARRAY = 17, +MAP = 18, +FUNC = 19, +
+  ID = 251, +INT = 252, +FLOAT = 253, +STRING = 254, +
+  BOOLEAN = 255 +
+ }

+Functions

OpcodeInfo_TIL_LookupOpcodeDefinition (Opcode_T opcode)
String IL_LookupDisplayText (Opcode_T opcode)
String IL_LookupMacroText (Opcode_T opcode)
+

Enumeration Type Documentation

+ +
+
+ + + + +
enum Opcode_T
+
+
+
Enumerator:
+ + + + + + + + + + + + + + + + + + + + + + + + + +
ROOT  +
ADD  +
SUB  +
MUL  +
DIV  +
MOD  +
AND  +
OR  +
NOT  +
EQ  +
NE  +
LT  +
GT  +
LTE  +
GTE  +
ASSIGN  +
TERN  +
ARRAY  +
MAP  +
FUNC  +
ID  +
INT  +
FLOAT  +
STRING  +
BOOLEAN  +
+
+
+ +

Definition at line 6 of file il_opcodes.h.

+ +
+
+

Function Documentation

+ +
+
+ + + + + + + + +
String IL_LookupDisplayText (Opcode_T opcode)
+
+
+ +

Definition at line 63 of file il_opcodes.c.

+ +

+Here is the call graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + +
String IL_LookupMacroText (Opcode_T opcode)
+
+
+ +

Definition at line 69 of file il_opcodes.c.

+ +

+Here is the call graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + +
OpcodeInfo_T* IL_LookupOpcodeDefinition (Opcode_T opcode)
+
+
+ +

Definition at line 35 of file il_opcodes.c.

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/il__opcodes_8h__dep__incl.map b/flex-bison/mark1/docs/html/il__opcodes_8h__dep__incl.map new file mode 100644 index 0000000..d987e55 --- /dev/null +++ b/flex-bison/mark1/docs/html/il__opcodes_8h__dep__incl.map @@ -0,0 +1,3 @@ + + + diff --git a/flex-bison/mark1/docs/html/il__opcodes_8h__dep__incl.md5 b/flex-bison/mark1/docs/html/il__opcodes_8h__dep__incl.md5 new file mode 100644 index 0000000..8a9fc5b --- /dev/null +++ b/flex-bison/mark1/docs/html/il__opcodes_8h__dep__incl.md5 @@ -0,0 +1 @@ +a3540f7747802ea95abf06ae7d23e8cc \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/il__opcodes_8h__dep__incl.png b/flex-bison/mark1/docs/html/il__opcodes_8h__dep__incl.png new file mode 100644 index 0000000..e1e60b8 Binary files /dev/null and b/flex-bison/mark1/docs/html/il__opcodes_8h__dep__incl.png differ diff --git a/flex-bison/mark1/docs/html/il__opcodes_8h__incl.map b/flex-bison/mark1/docs/html/il__opcodes_8h__incl.map new file mode 100644 index 0000000..8be6a30 --- /dev/null +++ b/flex-bison/mark1/docs/html/il__opcodes_8h__incl.map @@ -0,0 +1,2 @@ + + diff --git a/flex-bison/mark1/docs/html/il__opcodes_8h__incl.md5 b/flex-bison/mark1/docs/html/il__opcodes_8h__incl.md5 new file mode 100644 index 0000000..31a2df4 --- /dev/null +++ b/flex-bison/mark1/docs/html/il__opcodes_8h__incl.md5 @@ -0,0 +1 @@ +e8715b9715471de2f7ab9c042a329243 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/il__opcodes_8h__incl.png b/flex-bison/mark1/docs/html/il__opcodes_8h__incl.png new file mode 100644 index 0000000..d500c56 Binary files /dev/null and b/flex-bison/mark1/docs/html/il__opcodes_8h__incl.png differ diff --git a/flex-bison/mark1/docs/html/il__opcodes_8h_a14d5d1c5c42df6a170157e9749c27911_cgraph.map b/flex-bison/mark1/docs/html/il__opcodes_8h_a14d5d1c5c42df6a170157e9749c27911_cgraph.map new file mode 100644 index 0000000..8f2115c --- /dev/null +++ b/flex-bison/mark1/docs/html/il__opcodes_8h_a14d5d1c5c42df6a170157e9749c27911_cgraph.map @@ -0,0 +1,3 @@ + + + diff --git a/flex-bison/mark1/docs/html/il__opcodes_8h_a14d5d1c5c42df6a170157e9749c27911_cgraph.md5 b/flex-bison/mark1/docs/html/il__opcodes_8h_a14d5d1c5c42df6a170157e9749c27911_cgraph.md5 new file mode 100644 index 0000000..dcfddc2 --- /dev/null +++ b/flex-bison/mark1/docs/html/il__opcodes_8h_a14d5d1c5c42df6a170157e9749c27911_cgraph.md5 @@ -0,0 +1 @@ +0d854ba21b6a502f7a5d405829e73b37 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/il__opcodes_8h_a14d5d1c5c42df6a170157e9749c27911_cgraph.png b/flex-bison/mark1/docs/html/il__opcodes_8h_a14d5d1c5c42df6a170157e9749c27911_cgraph.png new file mode 100644 index 0000000..073c6a8 Binary files /dev/null and b/flex-bison/mark1/docs/html/il__opcodes_8h_a14d5d1c5c42df6a170157e9749c27911_cgraph.png differ diff --git a/flex-bison/mark1/docs/html/il__opcodes_8h_a2a6a76c96d76b57e091bbe7a11d7a8e9_cgraph.map b/flex-bison/mark1/docs/html/il__opcodes_8h_a2a6a76c96d76b57e091bbe7a11d7a8e9_cgraph.map new file mode 100644 index 0000000..daf5f28 --- /dev/null +++ b/flex-bison/mark1/docs/html/il__opcodes_8h_a2a6a76c96d76b57e091bbe7a11d7a8e9_cgraph.map @@ -0,0 +1,3 @@ + + + diff --git a/flex-bison/mark1/docs/html/il__opcodes_8h_a2a6a76c96d76b57e091bbe7a11d7a8e9_cgraph.md5 b/flex-bison/mark1/docs/html/il__opcodes_8h_a2a6a76c96d76b57e091bbe7a11d7a8e9_cgraph.md5 new file mode 100644 index 0000000..2fa4e9a --- /dev/null +++ b/flex-bison/mark1/docs/html/il__opcodes_8h_a2a6a76c96d76b57e091bbe7a11d7a8e9_cgraph.md5 @@ -0,0 +1 @@ +882b10959004b25583afa82066f82211 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/il__opcodes_8h_a2a6a76c96d76b57e091bbe7a11d7a8e9_cgraph.png b/flex-bison/mark1/docs/html/il__opcodes_8h_a2a6a76c96d76b57e091bbe7a11d7a8e9_cgraph.png new file mode 100644 index 0000000..deed51b Binary files /dev/null and b/flex-bison/mark1/docs/html/il__opcodes_8h_a2a6a76c96d76b57e091bbe7a11d7a8e9_cgraph.png differ diff --git a/flex-bison/mark1/docs/html/il__opcodes_8h_a3611fb212f40ac7761e39b45c7c78586_icgraph.map b/flex-bison/mark1/docs/html/il__opcodes_8h_a3611fb212f40ac7761e39b45c7c78586_icgraph.map new file mode 100644 index 0000000..93bc1d8 --- /dev/null +++ b/flex-bison/mark1/docs/html/il__opcodes_8h_a3611fb212f40ac7761e39b45c7c78586_icgraph.map @@ -0,0 +1,4 @@ + + + + diff --git a/flex-bison/mark1/docs/html/il__opcodes_8h_a3611fb212f40ac7761e39b45c7c78586_icgraph.md5 b/flex-bison/mark1/docs/html/il__opcodes_8h_a3611fb212f40ac7761e39b45c7c78586_icgraph.md5 new file mode 100644 index 0000000..ed92038 --- /dev/null +++ b/flex-bison/mark1/docs/html/il__opcodes_8h_a3611fb212f40ac7761e39b45c7c78586_icgraph.md5 @@ -0,0 +1 @@ +7d110518dc8d655cec43c99accb7b923 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/il__opcodes_8h_a3611fb212f40ac7761e39b45c7c78586_icgraph.png b/flex-bison/mark1/docs/html/il__opcodes_8h_a3611fb212f40ac7761e39b45c7c78586_icgraph.png new file mode 100644 index 0000000..ffd8b6d Binary files /dev/null and b/flex-bison/mark1/docs/html/il__opcodes_8h_a3611fb212f40ac7761e39b45c7c78586_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/il__opcodes_8h_source.html b/flex-bison/mark1/docs/html/il__opcodes_8h_source.html new file mode 100644 index 0000000..2c9609c --- /dev/null +++ b/flex-bison/mark1/docs/html/il__opcodes_8h_source.html @@ -0,0 +1,158 @@ + + + + +Mark1: src/il_opcodes/il_opcodes.h Source File + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + +
+
+ +
+
+
+ +
+
+
+

src/il_opcodes/il_opcodes.h

+
+
+Go to the documentation of this file.
00001 #ifndef IL_OPCODES_H
+00002 #define IL_OPCODES_H
+00003 
+00004 #include "common.h"
+00005 
+00006 typedef enum
+00007 {
+00008         ROOT    = 0,
+00009         ADD     = 1,
+00010         SUB     = 2,
+00011         MUL     = 3,
+00012         DIV     = 4,
+00013         MOD     = 5,
+00014         AND     = 6,
+00015         OR      = 7,
+00016         NOT     = 8,
+00017         EQ      = 9,
+00018         NE      = 10,
+00019         LT      = 11,
+00020         GT      = 12,
+00021         LTE     = 13,
+00022         GTE     = 14,
+00023         ASSIGN  = 15,
+00024 
+00025         TERN    = 16,
+00026         ARRAY   = 17,
+00027         MAP     = 18,
+00028         FUNC    = 19,
+00029 
+00030         ID      = 251,
+00031         INT     = 252,
+00032         FLOAT   = 253,
+00033         STRING  = 254,
+00034         BOOLEAN = 255,
+00035 } Opcode_T;
+00036 
+00037 typedef struct
+00038 {
+00039         Opcode_T opcode;
+00040         String   display_txt;
+00041         String   macro_txt;
+00042 } OpcodeInfo_T;
+00043 
+00044 OpcodeInfo_T* IL_LookupOpcodeDefinition( Opcode_T opcode );
+00045 String IL_LookupDisplayText( Opcode_T opcode );
+00046 String IL_LookupMacroText( Opcode_T opcode );
+00047 
+00048 #endif
+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/index.html b/flex-bison/mark1/docs/html/index.html new file mode 100644 index 0000000..763391f --- /dev/null +++ b/flex-bison/mark1/docs/html/index.html @@ -0,0 +1,103 @@ + + + + +Mark1: Main Page + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ +
+
+ +
+
+
+ +
+
+
+

Mark1 Documentation

+
+
+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/installdox b/flex-bison/mark1/docs/html/installdox new file mode 100644 index 0000000..edf5bbf --- /dev/null +++ b/flex-bison/mark1/docs/html/installdox @@ -0,0 +1,112 @@ +#!/usr/bin/perl + +%subst = ( ); +$quiet = 0; + +while ( @ARGV ) { + $_ = shift @ARGV; + if ( s/^-// ) { + if ( /^l(.*)/ ) { + $v = ($1 eq "") ? shift @ARGV : $1; + ($v =~ /\/$/) || ($v .= "/"); + $_ = $v; + if ( /(.+)\@(.+)/ ) { + if ( exists $subst{$1} ) { + $subst{$1} = $2; + } else { + print STDERR "Unknown tag file $1 given with option -l\n"; + &usage(); + } + } else { + print STDERR "Argument $_ is invalid for option -l\n"; + &usage(); + } + } + elsif ( /^q/ ) { + $quiet = 1; + } + elsif ( /^\?|^h/ ) { + &usage(); + } + else { + print STDERR "Illegal option -$_\n"; + &usage(); + } + } + else { + push (@files, $_ ); + } +} + +foreach $sub (keys %subst) +{ + if ( $subst{$sub} eq "" ) + { + print STDERR "No substitute given for tag file `$sub'\n"; + &usage(); + } + elsif ( ! $quiet && $sub ne "_doc" && $sub ne "_cgi" ) + { + print "Substituting $subst{$sub} for each occurrence of tag file $sub\n"; + } +} + +if ( ! @files ) { + if (opendir(D,".")) { + foreach $file ( readdir(D) ) { + $match = ".html"; + next if ( $file =~ /^\.\.?$/ ); + ($file =~ /$match/) && (push @files, $file); + ($file =~ /\.svg/) && (push @files, $file); + ($file =~ "navtree.js") && (push @files, $file); + } + closedir(D); + } +} + +if ( ! @files ) { + print STDERR "Warning: No input files given and none found!\n"; +} + +foreach $f (@files) +{ + if ( ! $quiet ) { + print "Editing: $f...\n"; + } + $oldf = $f; + $f .= ".bak"; + unless (rename $oldf,$f) { + print STDERR "Error: cannot rename file $oldf\n"; + exit 1; + } + if (open(F,"<$f")) { + unless (open(G,">$oldf")) { + print STDERR "Error: opening file $oldf for writing\n"; + exit 1; + } + if ($oldf ne "tree.js") { + while () { + s/doxygen\=\"([^ \"\:\t\>\<]*)\:([^ \"\t\>\<]*)\" (xlink:href|href|src)=\"\2/doxygen\=\"$1:$subst{$1}\" \3=\"$subst{$1}/g; + print G "$_"; + } + } + else { + while () { + s/\"([^ \"\:\t\>\<]*)\:([^ \"\t\>\<]*)\", \"\2/\"$1:$subst{$1}\" ,\"$subst{$1}/g; + print G "$_"; + } + } + } + else { + print STDERR "Warning file $f does not exist\n"; + } + unlink $f; +} + +sub usage { + print STDERR "Usage: installdox [options] [html-file [html-file ...]]\n"; + print STDERR "Options:\n"; + print STDERR " -l tagfile\@linkName tag file + URL or directory \n"; + print STDERR " -q Quiet mode\n\n"; + exit 1; +} diff --git a/flex-bison/mark1/docs/html/jquery.js b/flex-bison/mark1/docs/html/jquery.js new file mode 100644 index 0000000..c052173 --- /dev/null +++ b/flex-bison/mark1/docs/html/jquery.js @@ -0,0 +1,54 @@ +/* + * jQuery JavaScript Library v1.3.2 + * http://jquery.com/ + * + * Copyright (c) 2009 John Resig + * Dual licensed under the MIT and GPL licenses. + * http://docs.jquery.com/License + * + * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009) + * Revision: 6246 + */ +(function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("",""]||!O.indexOf("",""]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"","
"]||!O.indexOf("",""]||(!O.indexOf("",""]||!O.indexOf("",""]||!o.support.htmlSerialize&&[1,"div
","
"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}}); +/* + * Sizzle CSS Selector Engine - v0.9.3 + * Copyright 2009, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * More information: http://sizzlejs.com/ + */ +(function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return UT[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="

";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="
";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0) +{I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("
").append(M.responseText.replace(//g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function() +{G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='
';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})(); +/* + * jQuery UI 1.7.2 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI + */ +jQuery.ui||(function(c){var i=c.fn.remove,d=c.browser.mozilla&&(parseFloat(c.browser.version)<1.9);c.ui={version:"1.7.2",plugin:{add:function(k,l,n){var m=c.ui[k].prototype;for(var j in n){m.plugins[j]=m.plugins[j]||[];m.plugins[j].push([l,n[j]])}},call:function(j,l,k){var n=j.plugins[l];if(!n||!j.element[0].parentNode){return}for(var m=0;m0){return true}m[j]=1;l=(m[j]>0);m[j]=0;return l},isOverAxis:function(k,j,l){return(k>j)&&(k<(j+l))},isOver:function(o,k,n,m,j,l){return c.ui.isOverAxis(o,n,j)&&c.ui.isOverAxis(k,m,l)},keyCode:{BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38}};if(d){var f=c.attr,e=c.fn.removeAttr,h="http://www.w3.org/2005/07/aaa",a=/^aria-/,b=/^wairole:/;c.attr=function(k,j,l){var m=l!==undefined;return(j=="role"?(m?f.call(this,k,j,"wairole:"+l):(f.apply(this,arguments)||"").replace(b,"")):(a.test(j)?(m?k.setAttributeNS(h,j.replace(a,"aaa:"),l):f.call(this,k,j.replace(a,"aaa:"))):f.apply(this,arguments)))};c.fn.removeAttr=function(j){return(a.test(j)?this.each(function(){this.removeAttributeNS(h,j.replace(a,""))}):e.call(this,j))}}c.fn.extend({remove:function(){c("*",this).add(this).each(function(){c(this).triggerHandler("remove")});return i.apply(this,arguments)},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","").unbind("selectstart.ui")},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false})},scrollParent:function(){var j;if((c.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){j=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(c.curCSS(this,"position",1))&&(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}else{j=this.parents().filter(function(){return(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}return(/fixed/).test(this.css("position"))||!j.length?c(document):j}});c.extend(c.expr[":"],{data:function(l,k,j){return !!c.data(l,j[3])},focusable:function(k){var l=k.nodeName.toLowerCase(),j=c.attr(k,"tabindex");return(/input|select|textarea|button|object/.test(l)?!k.disabled:"a"==l||"area"==l?k.href||!isNaN(j):!isNaN(j))&&!c(k)["area"==l?"parents":"closest"](":hidden").length},tabbable:function(k){var j=c.attr(k,"tabindex");return(isNaN(j)||j>=0)&&c(k).is(":focusable")}});function g(m,n,o,l){function k(q){var p=c[m][n][q]||[];return(typeof p=="string"?p.split(/,?\s+/):p)}var j=k("getter");if(l.length==1&&typeof l[0]=="string"){j=j.concat(k("getterSetter"))}return(c.inArray(o,j)!=-1)}c.widget=function(k,j){var l=k.split(".")[0];k=k.split(".")[1];c.fn[k]=function(p){var n=(typeof p=="string"),o=Array.prototype.slice.call(arguments,1);if(n&&p.substring(0,1)=="_"){return this}if(n&&g(l,k,p,o)){var m=c.data(this[0],k);return(m?m[p].apply(m,o):undefined)}return this.each(function(){var q=c.data(this,k);(!q&&!n&&c.data(this,k,new c[l][k](this,p))._init());(q&&n&&c.isFunction(q[p])&&q[p].apply(q,o))})};c[l]=c[l]||{};c[l][k]=function(o,n){var m=this;this.namespace=l;this.widgetName=k;this.widgetEventPrefix=c[l][k].eventPrefix||k;this.widgetBaseClass=l+"-"+k;this.options=c.extend({},c.widget.defaults,c[l][k].defaults,c.metadata&&c.metadata.get(o)[k],n);this.element=c(o).bind("setData."+k,function(q,p,r){if(q.target==o){return m._setData(p,r)}}).bind("getData."+k,function(q,p){if(q.target==o){return m._getData(p)}}).bind("remove",function(){return m.destroy()})};c[l][k].prototype=c.extend({},c.widget.prototype,j);c[l][k].getterSetter="option"};c.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").removeAttr("aria-disabled")},option:function(l,m){var k=l,j=this;if(typeof l=="string"){if(m===undefined){return this._getData(l)}k={};k[l]=m}c.each(k,function(n,o){j._setData(n,o)})},_getData:function(j){return this.options[j]},_setData:function(j,k){this.options[j]=k;if(j=="disabled"){this.element[k?"addClass":"removeClass"](this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").attr("aria-disabled",k)}},enable:function(){this._setData("disabled",false)},disable:function(){this._setData("disabled",true)},_trigger:function(l,m,n){var p=this.options[l],j=(l==this.widgetEventPrefix?l:this.widgetEventPrefix+l);m=c.Event(m);m.type=j;if(m.originalEvent){for(var k=c.event.props.length,o;k;){o=c.event.props[--k];m[o]=m.originalEvent[o]}}this.element.trigger(m,n);return !(c.isFunction(p)&&p.call(this.element[0],m,n)===false||m.isDefaultPrevented())}};c.widget.defaults={disabled:false};c.ui.mouse={_mouseInit:function(){var j=this;this.element.bind("mousedown."+this.widgetName,function(k){return j._mouseDown(k)}).bind("click."+this.widgetName,function(k){if(j._preventClickEvent){j._preventClickEvent=false;k.stopImmediatePropagation();return false}});if(c.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");this.element.attr("unselectable","on")}this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);(c.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable))},_mouseDown:function(l){l.originalEvent=l.originalEvent||{};if(l.originalEvent.mouseHandled){return}(this._mouseStarted&&this._mouseUp(l));this._mouseDownEvent=l;var k=this,m=(l.which==1),j=(typeof this.options.cancel=="string"?c(l.target).parents().add(l.target).filter(this.options.cancel).length:false);if(!m||j||!this._mouseCapture(l)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){k.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(l)&&this._mouseDelayMet(l)){this._mouseStarted=(this._mouseStart(l)!==false);if(!this._mouseStarted){l.preventDefault();return true}}this._mouseMoveDelegate=function(n){return k._mouseMove(n)};this._mouseUpDelegate=function(n){return k._mouseUp(n)};c(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);(c.browser.safari||l.preventDefault());l.originalEvent.mouseHandled=true;return true},_mouseMove:function(j){if(c.browser.msie&&!j.button){return this._mouseUp(j)}if(this._mouseStarted){this._mouseDrag(j);return j.preventDefault()}if(this._mouseDistanceMet(j)&&this._mouseDelayMet(j)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,j)!==false);(this._mouseStarted?this._mouseDrag(j):this._mouseUp(j))}return !this._mouseStarted},_mouseUp:function(j){c(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=(j.target==this._mouseDownEvent.target);this._mouseStop(j)}return false},_mouseDistanceMet:function(j){return(Math.max(Math.abs(this._mouseDownEvent.pageX-j.pageX),Math.abs(this._mouseDownEvent.pageY-j.pageY))>=this.options.distance)},_mouseDelayMet:function(j){return this.mouseDelayMet},_mouseStart:function(j){},_mouseDrag:function(j){},_mouseStop:function(j){},_mouseCapture:function(j){return true}};c.ui.mouse.defaults={cancel:null,distance:1,delay:0}})(jQuery);;/* * jQuery UI Resizable 1.7.2 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Resizables + * + * Depends: + * ui.core.js + */ +(function(c){c.widget("ui.resizable",c.extend({},c.ui.mouse,{_init:function(){var e=this,j=this.options;this.element.addClass("ui-resizable");c.extend(this,{_aspectRatio:!!(j.aspectRatio),aspectRatio:j.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:j.helper||j.ghost||j.animate?j.helper||"ui-resizable-helper":null});if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)){if(/relative/.test(this.element.css("position"))&&c.browser.opera){this.element.css({position:"relative",top:"auto",left:"auto"})}this.element.wrap(c('
').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")}));this.element=this.element.parent().data("resizable",this.element.data("resizable"));this.elementIsWrapper=true;this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")});this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});this.originalResizeStyle=this.originalElement.css("resize");this.originalElement.css("resize","none");this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"}));this.originalElement.css({margin:this.originalElement.css("margin")});this._proportionallyResize()}this.handles=j.handles||(!c(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"});if(this.handles.constructor==String){if(this.handles=="all"){this.handles="n,e,s,w,se,sw,ne,nw"}var k=this.handles.split(",");this.handles={};for(var f=0;f
');if(/sw|se|ne|nw/.test(h)){g.css({zIndex:++j.zIndex})}if("se"==h){g.addClass("ui-icon ui-icon-gripsmall-diagonal-se")}this.handles[h]=".ui-resizable-"+h;this.element.append(g)}}this._renderAxis=function(p){p=p||this.element;for(var m in this.handles){if(this.handles[m].constructor==String){this.handles[m]=c(this.handles[m],this.element).show()}if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var n=c(this.handles[m],this.element),o=0;o=/sw|ne|nw|se|n|s/.test(m)?n.outerHeight():n.outerWidth();var l=["padding",/ne|nw|n/.test(m)?"Top":/se|sw|s/.test(m)?"Bottom":/^e$/.test(m)?"Right":"Left"].join("");p.css(l,o);this._proportionallyResize()}if(!c(this.handles[m]).length){continue}}};this._renderAxis(this.element);this._handles=c(".ui-resizable-handle",this.element).disableSelection();this._handles.mouseover(function(){if(!e.resizing){if(this.className){var i=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)}e.axis=i&&i[1]?i[1]:"se"}});if(j.autoHide){this._handles.hide();c(this.element).addClass("ui-resizable-autohide").hover(function(){c(this).removeClass("ui-resizable-autohide");e._handles.show()},function(){if(!e.resizing){c(this).addClass("ui-resizable-autohide");e._handles.hide()}})}this._mouseInit()},destroy:function(){this._mouseDestroy();var d=function(f){c(f).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};if(this.elementIsWrapper){d(this.element);var e=this.element;e.parent().append(this.originalElement.css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")})).end().remove()}this.originalElement.css("resize",this.originalResizeStyle);d(this.originalElement)},_mouseCapture:function(e){var f=false;for(var d in this.handles){if(c(this.handles[d])[0]==e.target){f=true}}return this.options.disabled||!!f},_mouseStart:function(f){var i=this.options,e=this.element.position(),d=this.element;this.resizing=true;this.documentScroll={top:c(document).scrollTop(),left:c(document).scrollLeft()};if(d.is(".ui-draggable")||(/absolute/).test(d.css("position"))){d.css({position:"absolute",top:e.top,left:e.left})}if(c.browser.opera&&(/relative/).test(d.css("position"))){d.css({position:"relative",top:"auto",left:"auto"})}this._renderProxy();var j=b(this.helper.css("left")),g=b(this.helper.css("top"));if(i.containment){j+=c(i.containment).scrollLeft()||0;g+=c(i.containment).scrollTop()||0}this.offset=this.helper.offset();this.position={left:j,top:g};this.size=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalSize=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalPosition={left:j,top:g};this.sizeDiff={width:d.outerWidth()-d.width(),height:d.outerHeight()-d.height()};this.originalMousePosition={left:f.pageX,top:f.pageY};this.aspectRatio=(typeof i.aspectRatio=="number")?i.aspectRatio:((this.originalSize.width/this.originalSize.height)||1);var h=c(".ui-resizable-"+this.axis).css("cursor");c("body").css("cursor",h=="auto"?this.axis+"-resize":h);d.addClass("ui-resizable-resizing");this._propagate("start",f);return true},_mouseDrag:function(d){var g=this.helper,f=this.options,l={},p=this,i=this.originalMousePosition,m=this.axis;var q=(d.pageX-i.left)||0,n=(d.pageY-i.top)||0;var h=this._change[m];if(!h){return false}var k=h.apply(this,[d,q,n]),j=c.browser.msie&&c.browser.version<7,e=this.sizeDiff;if(this._aspectRatio||d.shiftKey){k=this._updateRatio(k,d)}k=this._respectSize(k,d);this._propagate("resize",d);g.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});if(!this._helper&&this._proportionallyResizeElements.length){this._proportionallyResize()}this._updateCache(k);this._trigger("resize",d,this.ui());return false},_mouseStop:function(g){this.resizing=false;var h=this.options,l=this;if(this._helper){var f=this._proportionallyResizeElements,d=f.length&&(/textarea/i).test(f[0].nodeName),e=d&&c.ui.hasScroll(f[0],"left")?0:l.sizeDiff.height,j=d?0:l.sizeDiff.width;var m={width:(l.size.width-j),height:(l.size.height-e)},i=(parseInt(l.element.css("left"),10)+(l.position.left-l.originalPosition.left))||null,k=(parseInt(l.element.css("top"),10)+(l.position.top-l.originalPosition.top))||null;if(!h.animate){this.element.css(c.extend(m,{top:k,left:i}))}l.helper.height(l.size.height);l.helper.width(l.size.width);if(this._helper&&!h.animate){this._proportionallyResize()}}c("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing");this._propagate("stop",g);if(this._helper){this.helper.remove()}return false},_updateCache:function(d){var e=this.options;this.offset=this.helper.offset();if(a(d.left)){this.position.left=d.left}if(a(d.top)){this.position.top=d.top}if(a(d.height)){this.size.height=d.height}if(a(d.width)){this.size.width=d.width}},_updateRatio:function(g,f){var h=this.options,i=this.position,e=this.size,d=this.axis;if(g.height){g.width=(e.height*this.aspectRatio)}else{if(g.width){g.height=(e.width/this.aspectRatio)}}if(d=="sw"){g.left=i.left+(e.width-g.width);g.top=null}if(d=="nw"){g.top=i.top+(e.height-g.height);g.left=i.left+(e.width-g.width)}return g},_respectSize:function(k,f){var i=this.helper,h=this.options,q=this._aspectRatio||f.shiftKey,p=this.axis,s=a(k.width)&&h.maxWidth&&(h.maxWidthk.width),r=a(k.height)&&h.minHeight&&(h.minHeight>k.height);if(g){k.width=h.minWidth}if(r){k.height=h.minHeight}if(s){k.width=h.maxWidth}if(l){k.height=h.maxHeight}var e=this.originalPosition.left+this.originalSize.width,n=this.position.top+this.size.height;var j=/sw|nw|w/.test(p),d=/nw|ne|n/.test(p);if(g&&j){k.left=e-h.minWidth}if(s&&j){k.left=e-h.maxWidth}if(r&&d){k.top=n-h.minHeight}if(l&&d){k.top=n-h.maxHeight}var m=!k.width&&!k.height;if(m&&!k.left&&k.top){k.top=null}else{if(m&&!k.top&&k.left){k.left=null}}return k},_proportionallyResize:function(){var j=this.options;if(!this._proportionallyResizeElements.length){return}var f=this.helper||this.element;for(var e=0;e');var d=c.browser.msie&&c.browser.version<7,f=(d?1:0),g=(d?2:-1);this.helper.addClass(this._helper).css({width:this.element.outerWidth()+g,height:this.element.outerHeight()+g,position:"absolute",left:this.elementOffset.left-f+"px",top:this.elementOffset.top-f+"px",zIndex:++h.zIndex});this.helper.appendTo("body").disableSelection()}else{this.helper=this.element}},_change:{e:function(f,e,d){return{width:this.originalSize.width+e}},w:function(g,e,d){var i=this.options,f=this.originalSize,h=this.originalPosition;return{left:h.left+e,width:f.width-e}},n:function(g,e,d){var i=this.options,f=this.originalSize,h=this.originalPosition;return{top:h.top+d,height:f.height-d}},s:function(f,e,d){return{height:this.originalSize.height+d}},se:function(f,e,d){return c.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[f,e,d]))},sw:function(f,e,d){return c.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[f,e,d]))},ne:function(f,e,d){return c.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[f,e,d]))},nw:function(f,e,d){return c.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[f,e,d]))}},_propagate:function(e,d){c.ui.plugin.call(this,e,[d,this.ui()]);(e!="resize"&&this._trigger(e,d,this.ui()))},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}));c.extend(c.ui.resizable,{version:"1.7.2",eventPrefix:"resize",defaults:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,cancel:":input,option",containment:false,delay:0,distance:1,ghost:false,grid:false,handles:"e,s,se",helper:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1000}});c.ui.plugin.add("resizable","alsoResize",{start:function(e,f){var d=c(this).data("resizable"),g=d.options;_store=function(h){c(h).each(function(){c(this).data("resizable-alsoresize",{width:parseInt(c(this).width(),10),height:parseInt(c(this).height(),10),left:parseInt(c(this).css("left"),10),top:parseInt(c(this).css("top"),10)})})};if(typeof(g.alsoResize)=="object"&&!g.alsoResize.parentNode){if(g.alsoResize.length){g.alsoResize=g.alsoResize[0];_store(g.alsoResize)}else{c.each(g.alsoResize,function(h,i){_store(h)})}}else{_store(g.alsoResize)}},resize:function(f,h){var e=c(this).data("resizable"),i=e.options,g=e.originalSize,k=e.originalPosition;var j={height:(e.size.height-g.height)||0,width:(e.size.width-g.width)||0,top:(e.position.top-k.top)||0,left:(e.position.left-k.left)||0},d=function(l,m){c(l).each(function(){var p=c(this),q=c(this).data("resizable-alsoresize"),o={},n=m&&m.length?m:["width","height","top","left"];c.each(n||["width","height","top","left"],function(r,t){var s=(q[t]||0)+(j[t]||0);if(s&&s>=0){o[t]=s||null}});if(/relative/.test(p.css("position"))&&c.browser.opera){e._revertToRelativePosition=true;p.css({position:"absolute",top:"auto",left:"auto"})}p.css(o)})};if(typeof(i.alsoResize)=="object"&&!i.alsoResize.nodeType){c.each(i.alsoResize,function(l,m){d(l,m)})}else{d(i.alsoResize)}},stop:function(e,f){var d=c(this).data("resizable");if(d._revertToRelativePosition&&c.browser.opera){d._revertToRelativePosition=false;el.css({position:"relative"})}c(this).removeData("resizable-alsoresize-start")}});c.ui.plugin.add("resizable","animate",{stop:function(h,m){var n=c(this).data("resizable"),i=n.options;var g=n._proportionallyResizeElements,d=g.length&&(/textarea/i).test(g[0].nodeName),e=d&&c.ui.hasScroll(g[0],"left")?0:n.sizeDiff.height,k=d?0:n.sizeDiff.width;var f={width:(n.size.width-k),height:(n.size.height-e)},j=(parseInt(n.element.css("left"),10)+(n.position.left-n.originalPosition.left))||null,l=(parseInt(n.element.css("top"),10)+(n.position.top-n.originalPosition.top))||null;n.element.animate(c.extend(f,l&&j?{top:l,left:j}:{}),{duration:i.animateDuration,easing:i.animateEasing,step:function(){var o={width:parseInt(n.element.css("width"),10),height:parseInt(n.element.css("height"),10),top:parseInt(n.element.css("top"),10),left:parseInt(n.element.css("left"),10)};if(g&&g.length){c(g[0]).css({width:o.width,height:o.height})}n._updateCache(o);n._propagate("resize",h)}})}});c.ui.plugin.add("resizable","containment",{start:function(e,q){var s=c(this).data("resizable"),i=s.options,k=s.element;var f=i.containment,j=(f instanceof c)?f.get(0):(/parent/.test(f))?k.parent().get(0):f;if(!j){return}s.containerElement=c(j);if(/document/.test(f)||f==document){s.containerOffset={left:0,top:0};s.containerPosition={left:0,top:0};s.parentData={element:c(document),left:0,top:0,width:c(document).width(),height:c(document).height()||document.body.parentNode.scrollHeight}}else{var m=c(j),h=[];c(["Top","Right","Left","Bottom"]).each(function(p,o){h[p]=b(m.css("padding"+o))});s.containerOffset=m.offset();s.containerPosition=m.position();s.containerSize={height:(m.innerHeight()-h[3]),width:(m.innerWidth()-h[1])};var n=s.containerOffset,d=s.containerSize.height,l=s.containerSize.width,g=(c.ui.hasScroll(j,"left")?j.scrollWidth:l),r=(c.ui.hasScroll(j)?j.scrollHeight:d);s.parentData={element:j,left:n.left,top:n.top,width:g,height:r}}},resize:function(f,p){var s=c(this).data("resizable"),h=s.options,e=s.containerSize,n=s.containerOffset,l=s.size,m=s.position,q=s._aspectRatio||f.shiftKey,d={top:0,left:0},g=s.containerElement;if(g[0]!=document&&(/static/).test(g.css("position"))){d=n}if(m.left<(s._helper?n.left:0)){s.size.width=s.size.width+(s._helper?(s.position.left-n.left):(s.position.left-d.left));if(q){s.size.height=s.size.width/h.aspectRatio}s.position.left=h.helper?n.left:0}if(m.top<(s._helper?n.top:0)) +{s.size.height=s.size.height+(s._helper?(s.position.top-n.top):s.position.top);if(q){s.size.width=s.size.height*h.aspectRatio}s.position.top=s._helper?n.top:0}s.offset.left=s.parentData.left+s.position.left;s.offset.top=s.parentData.top+s.position.top;var k=Math.abs((s._helper?s.offset.left-d.left:(s.offset.left-d.left))+s.sizeDiff.width),r=Math.abs((s._helper?s.offset.top-d.top:(s.offset.top-n.top))+s.sizeDiff.height);var j=s.containerElement.get(0)==s.element.parent().get(0),i=/relative|absolute/.test(s.containerElement.css("position"));if(j&&i){k-=s.parentData.left}if(k+s.size.width>=s.parentData.width){s.size.width=s.parentData.width-k;if(q){s.size.height=s.size.width/s.aspectRatio}}if(r+s.size.height>=s.parentData.height){s.size.height=s.parentData.height-r;if(q){s.size.width=s.size.height*s.aspectRatio}}},stop:function(e,m){var p=c(this).data("resizable"),f=p.options,k=p.position,l=p.containerOffset,d=p.containerPosition,g=p.containerElement;var i=c(p.helper),q=i.offset(),n=i.outerWidth()-p.sizeDiff.width,j=i.outerHeight()-p.sizeDiff.height;if(p._helper&&!f.animate&&(/relative/).test(g.css("position"))){c(this).css({left:q.left-d.left-l.left,width:n,height:j})}if(p._helper&&!f.animate&&(/static/).test(g.css("position"))){c(this).css({left:q.left-d.left-l.left,width:n,height:j})}}});c.ui.plugin.add("resizable","ghost",{start:function(f,g){var d=c(this).data("resizable"),h=d.options,e=d.size;d.ghost=d.originalElement.clone();d.ghost.css({opacity:0.25,display:"block",position:"relative",height:e.height,width:e.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof h.ghost=="string"?h.ghost:"");d.ghost.appendTo(d.helper)},resize:function(e,f){var d=c(this).data("resizable"),g=d.options;if(d.ghost){d.ghost.css({position:"relative",height:d.size.height,width:d.size.width})}},stop:function(e,f){var d=c(this).data("resizable"),g=d.options;if(d.ghost&&d.helper){d.helper.get(0).removeChild(d.ghost.get(0))}}});c.ui.plugin.add("resizable","grid",{resize:function(d,l){var n=c(this).data("resizable"),g=n.options,j=n.size,h=n.originalSize,i=n.originalPosition,m=n.axis,k=g._aspectRatio||d.shiftKey;g.grid=typeof g.grid=="number"?[g.grid,g.grid]:g.grid;var f=Math.round((j.width-h.width)/(g.grid[0]||1))*(g.grid[0]||1),e=Math.round((j.height-h.height)/(g.grid[1]||1))*(g.grid[1]||1);if(/^(se|s|e)$/.test(m)){n.size.width=h.width+f;n.size.height=h.height+e}else{if(/^(ne)$/.test(m)){n.size.width=h.width+f;n.size.height=h.height+e;n.position.top=i.top-e}else{if(/^(sw)$/.test(m)){n.size.width=h.width+f;n.size.height=h.height+e;n.position.left=i.left-f}else{n.size.width=h.width+f;n.size.height=h.height+e;n.position.top=i.top-e;n.position.left=i.left-f}}}}});var b=function(d){return parseInt(d,10)||0};var a=function(d){return !isNaN(parseInt(d,10))}})(jQuery);; +/** + * jQuery.ScrollTo - Easy element scrolling using jQuery. + * Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com + * Licensed under GPL license (http://www.opensource.org/licenses/gpl-license.php). + * Date: 2/8/2008 + * @author Ariel Flesler + * @version 1.3.2 + */ +;(function($){var o=$.scrollTo=function(a,b,c){o.window().scrollTo(a,b,c)};o.defaults={axis:'y',duration:1};o.window=function(){return $($.browser.safari?'body':'html')};$.fn.scrollTo=function(l,m,n){if(typeof m=='object'){n=m;m=0}n=$.extend({},o.defaults,n);m=m||n.speed||n.duration;n.queue=n.queue&&n.axis.length>1;if(n.queue)m/=2;n.offset=j(n.offset);n.over=j(n.over);return this.each(function(){var a=this,b=$(a),t=l,c,d={},w=b.is('html,body');switch(typeof t){case'number':case'string':if(/^([+-]=)?\d+(px)?$/.test(t)){t=j(t);break}t=$(t,this);case'object':if(t.is||t.style)c=(t=$(t)).offset()}$.each(n.axis.split(''),function(i,f){var P=f=='x'?'Left':'Top',p=P.toLowerCase(),k='scroll'+P,e=a[k],D=f=='x'?'Width':'Height';if(c){d[k]=c[p]+(w?0:e-b.offset()[p]);if(n.margin){d[k]-=parseInt(t.css('margin'+P))||0;d[k]-=parseInt(t.css('border'+P+'Width'))||0}d[k]+=n.offset[p]||0;if(n.over[p])d[k]+=t[D.toLowerCase()]()*n.over[p]}else d[k]=t[p];if(/^\d+$/.test(d[k]))d[k]=d[k]<=0?0:Math.min(d[k],h(D));if(!i&&n.queue){if(e!=d[k])g(n.onAfterFirst);delete d[k]}});g(n.onAfter);function g(a){b.animate(d,m,n.easing,a&&function(){a.call(this,l)})};function h(D){var b=w?$.browser.opera?document.body:document.documentElement:a;return b['scroll'+D]-b['client'+D]}})};function j(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery); + diff --git a/flex-bison/mark1/docs/html/lex_8yy_8c.html b/flex-bison/mark1/docs/html/lex_8yy_8c.html new file mode 100644 index 0000000..9efadb2 --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8c.html @@ -0,0 +1,2958 @@ + + + + +Mark1: src/parser/lexer/lex.yy.c File Reference + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + +
+
+ +
+
+
+ +
+
+ +
+

src/parser/lexer/lex.yy.c File Reference

+
+
+
#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <stdlib.h>
+#include "ast.h"
+#include "parser.h"
+#include <unistd.h>
+
+Include dependency graph for lex.yy.c:
+
+
+
+
+

Go to the source code of this file.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Data Structures

struct  yy_buffer_state
struct  yy_trans_info
struct  yyguts_t

+Defines

#define YY_INT_ALIGNED   short int
#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION   2
#define YY_FLEX_MINOR_VERSION   5
#define YY_FLEX_SUBMINOR_VERSION   35
#define FLEX_BETA
#define FLEXINT_H
#define INT8_MIN   (-128)
#define INT16_MIN   (-32767-1)
#define INT32_MIN   (-2147483647-1)
#define INT8_MAX   (127)
#define INT16_MAX   (32767)
#define INT32_MAX   (2147483647)
#define UINT8_MAX   (255U)
#define UINT16_MAX   (65535U)
#define UINT32_MAX   (4294967295U)
#define yyconst
#define YY_NULL   0
#define YY_SC_TO_UI(c)   ((unsigned int) (unsigned char) c)
#define YY_TYPEDEF_YY_SCANNER_T
#define yyin   yyg->yyin_r
#define yyout   yyg->yyout_r
#define yyextra   yyg->yyextra_r
#define yyleng   yyg->yyleng_r
#define yytext   yyg->yytext_r
#define yylineno   (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
#define yycolumn   (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
#define yy_flex_debug   yyg->yy_flex_debug_r
#define BEGIN   yyg->yy_start = 1 + 2 *
#define YY_START   ((yyg->yy_start - 1) / 2)
#define YYSTATE   YY_START
#define YY_STATE_EOF(state)   (YY_END_OF_BUFFER + state + 1)
#define YY_NEW_FILE   yyrestart(yyin ,yyscanner )
#define YY_END_OF_BUFFER_CHAR   0
#define YY_BUF_SIZE   16384
#define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
#define YY_TYPEDEF_YY_BUFFER_STATE
#define EOB_ACT_CONTINUE_SCAN   0
#define EOB_ACT_END_OF_FILE   1
#define EOB_ACT_LAST_MATCH   2
#define YY_LESS_LINENO(n)
#define yyless(n)
#define unput(c)   yyunput( c, yyg->yytext_ptr , yyscanner )
#define YY_TYPEDEF_YY_SIZE_T
#define YY_STRUCT_YY_BUFFER_STATE
#define YY_BUFFER_NEW   0
#define YY_BUFFER_NORMAL   1
#define YY_BUFFER_EOF_PENDING   2
#define YY_CURRENT_BUFFER
#define YY_CURRENT_BUFFER_LVALUE   yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
#define YY_FLUSH_BUFFER   yy_flush_buffer(YY_CURRENT_BUFFER ,yyscanner)
#define yy_new_buffer   yy_create_buffer
#define yy_set_interactive(is_interactive)
#define yy_set_bol(at_bol)
#define YY_AT_BOL()   (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
#define yywrap(n)   1
#define YY_SKIP_YYWRAP
#define yytext_ptr   yytext_r
#define YY_DO_BEFORE_ACTION
#define YY_NUM_RULES   37
#define YY_END_OF_BUFFER   38
#define REJECT   reject_used_but_not_detected
#define yymore()   yymore_used_but_not_detected
#define YY_MORE_ADJ   0
#define YY_RESTORE_YY_MORE_OFFSET
#define YY_NO_INPUT   1
#define INITIAL   0
#define YY_EXTRA_TYPE   void *
#define yylval   yyg->yylval_r
#define YY_READ_BUF_SIZE   8192
#define ECHO   fwrite( yytext, yyleng, 1, yyout )
#define YY_INPUT(buf, result, max_size)
#define yyterminate()   return YY_NULL
#define YY_START_STACK_INCR   25
#define YY_FATAL_ERROR(msg)   yy_fatal_error( msg , yyscanner)
#define YY_DECL_IS_OURS   1
#define YY_DECL
#define YY_USER_ACTION
#define YY_BREAK   break;
#define YY_RULE_SETUP   YY_USER_ACTION
#define YY_EXIT_FAILURE   2
#define yyless(n)
#define YYTABLES_NAME   "yytables"

+Typedefs

typedef signed char flex_int8_t
typedef short int flex_int16_t
typedef int flex_int32_t
typedef unsigned char flex_uint8_t
typedef unsigned short int flex_uint16_t
typedef unsigned int flex_uint32_t
typedef void * yyscan_t
typedef struct yy_buffer_stateYY_BUFFER_STATE
typedef size_t yy_size_t
typedef unsigned char YY_CHAR
typedef int yy_state_type

+Functions

void yyrestart (FILE *input_file, yyscan_t yyscanner)
void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer, yyscan_t yyscanner)
YY_BUFFER_STATE yy_create_buffer (FILE *file, int size, yyscan_t yyscanner)
void yy_delete_buffer (YY_BUFFER_STATE b, yyscan_t yyscanner)
void yy_flush_buffer (YY_BUFFER_STATE b, yyscan_t yyscanner)
void yypush_buffer_state (YY_BUFFER_STATE new_buffer, yyscan_t yyscanner)
void yypop_buffer_state (yyscan_t yyscanner)
YY_BUFFER_STATE yy_scan_buffer (char *base, yy_size_t size, yyscan_t yyscanner)
YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str, yyscan_t yyscanner)
YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes, int len, yyscan_t yyscanner)
void * yyalloc (yy_size_t, yyscan_t yyscanner)
void * yyrealloc (void *, yy_size_t, yyscan_t yyscanner)
void yyfree (void *, yyscan_t yyscanner)
int yylex_init (yyscan_t *scanner)
int yylex_init_extra (YY_EXTRA_TYPE user_defined, yyscan_t *scanner)
int yylex_destroy (yyscan_t yyscanner)
int yyget_debug (yyscan_t yyscanner)
void yyset_debug (int debug_flag, yyscan_t yyscanner)
YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner)
void yyset_extra (YY_EXTRA_TYPE user_defined, yyscan_t yyscanner)
FILE * yyget_in (yyscan_t yyscanner)
void yyset_in (FILE *in_str, yyscan_t yyscanner)
FILE * yyget_out (yyscan_t yyscanner)
void yyset_out (FILE *out_str, yyscan_t yyscanner)
int yyget_leng (yyscan_t yyscanner)
char * yyget_text (yyscan_t yyscanner)
int yyget_lineno (yyscan_t yyscanner)
void yyset_lineno (int line_number, yyscan_t yyscanner)
YYSTYPEyyget_lval (yyscan_t yyscanner)
void yyset_lval (YYSTYPE *yylval_param, yyscan_t yyscanner)
int yylex (YYSTYPE *yylval_param, yyscan_t yyscanner)
int yyget_column (yyscan_t yyscanner)
void yyset_column (int column_no, yyscan_t yyscanner)
+

Define Documentation

+ +
+
+ + + + +
#define BEGIN   yyg->yy_start = 1 + 2 *
+
+
+ +

Definition at line 142 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define ECHO   fwrite( yytext, yyleng, 1, yyout )
+
+
+ +

Definition at line 620 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define EOB_ACT_CONTINUE_SCAN   0
+
+
+ +

Definition at line 173 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define EOB_ACT_END_OF_FILE   1
+
+
+ +

Definition at line 174 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define EOB_ACT_LAST_MATCH   2
+
+
+ +

Definition at line 175 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define FLEX_BETA
+
+
+ +

Definition at line 14 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define FLEX_SCANNER
+
+
+ +

Definition at line 9 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define FLEXINT_H
+
+
+ +

Definition at line 30 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define INITIAL   0
+
+
+ +

Definition at line 487 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define INT16_MAX   (32767)
+
+
+ +

Definition at line 73 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define INT16_MIN   (-32767-1)
+
+
+ +

Definition at line 64 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define INT32_MAX   (2147483647)
+
+
+ +

Definition at line 76 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define INT32_MIN   (-2147483647-1)
+
+
+ +

Definition at line 67 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define INT8_MAX   (127)
+
+
+ +

Definition at line 70 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define INT8_MIN   (-128)
+
+
+ +

Definition at line 61 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define REJECT   reject_used_but_not_detected
+
+
+ +

Definition at line 471 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define UINT16_MAX   (65535U)
+
+
+ +

Definition at line 82 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define UINT32_MAX   (4294967295U)
+
+
+ +

Definition at line 85 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define UINT8_MAX   (255U)
+
+
+ +

Definition at line 79 of file lex.yy.c.

+ +
+
+ +
+
+ + + + + + + + +
#define unput( c)   yyunput( c, yyg->yytext_ptr , yyscanner )
+
+
+ +

Definition at line 193 of file lex.yy.c.

+ +
+
+ +
+
+ + + + + + + +
#define YY_AT_BOL()   (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
+
+
+ +

Definition at line 324 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define YY_BREAK   break;
+
+
+ +

Definition at line 701 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define YY_BUF_SIZE   16384
+
+
+ +

Definition at line 161 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define YY_BUFFER_EOF_PENDING   2
+
+
+ +

Definition at line 260 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define YY_BUFFER_NEW   0
+
+
+ +

Definition at line 248 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define YY_BUFFER_NORMAL   1
+
+
+ +

Definition at line 249 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define YY_CURRENT_BUFFER
+
+
+Value:
( yyg->yy_buffer_stack \
+                          ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
+                          : NULL)
+
+

Definition at line 271 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define YY_CURRENT_BUFFER_LVALUE   yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
+
+
+ +

Definition at line 278 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define YY_DECL
+
+
+Value:
int yylex \
+               (YYSTYPE * yylval_param , yyscan_t yyscanner)
+
+

Definition at line 688 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define YY_DECL_IS_OURS   1
+
+
+ +

Definition at line 683 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define YY_DO_BEFORE_ACTION
+
+
+Value:
yyg->yytext_ptr = yy_bp; \
+        yyleng = (size_t) (yy_cp - yy_bp); \
+        yyg->yy_hold_char = *yy_cp; \
+        *yy_cp = '\0'; \
+        yyg->yy_c_buf_p = yy_cp;
+
+

Definition at line 345 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define YY_END_OF_BUFFER   38
+
+
+ +

Definition at line 353 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define YY_END_OF_BUFFER_CHAR   0
+
+
+ +

Definition at line 157 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define YY_EXIT_FAILURE   2
+
+
+ +

Definition at line 1709 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define YY_EXTRA_TYPE   void *
+
+
+ +

Definition at line 498 of file lex.yy.c.

+ +
+
+ +
+
+ + + + + + + + +
#define YY_FATAL_ERROR( msg)   yy_fatal_error( msg , yyscanner)
+
+
+ +

Definition at line 674 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define yy_flex_debug   yyg->yy_flex_debug_r
+
+
+ +

Definition at line 136 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define YY_FLEX_MAJOR_VERSION   2
+
+
+ +

Definition at line 10 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define YY_FLEX_MINOR_VERSION   5
+
+
+ +

Definition at line 11 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define YY_FLEX_SUBMINOR_VERSION   35
+
+
+ +

Definition at line 12 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define YY_FLUSH_BUFFER   yy_flush_buffer(YY_CURRENT_BUFFER ,yyscanner)
+
+
+ +

Definition at line 292 of file lex.yy.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
#define YY_INPUT( buf,
 result,
 max_size 
)
+
+
+Value:
if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
+                { \
+                int c = '*'; \
+                int n; \
+                for ( n = 0; n < max_size && \
+                             (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
+                        buf[n] = (char) c; \
+                if ( c == '\n' ) \
+                        buf[n++] = (char) c; \
+                if ( c == EOF && ferror( yyin ) ) \
+                        YY_FATAL_ERROR( "input in flex scanner failed" ); \
+                result = n; \
+                } \
+        else \
+                { \
+                errno=0; \
+                while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
+                        { \
+                        if( errno != EINTR) \
+                                { \
+                                YY_FATAL_ERROR( "input in flex scanner failed" ); \
+                                break; \
+                                } \
+                        errno=0; \
+                        clearerr(yyin); \
+                        } \
+                }\
+\
+
+

Definition at line 627 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define YY_INT_ALIGNED   short int
+
+
+ +

Definition at line 5 of file lex.yy.c.

+ +
+
+ +
+
+ + + + + + + + +
#define YY_LESS_LINENO( n)
+
+
+ +

Definition at line 177 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define YY_MORE_ADJ   0
+
+
+ +

Definition at line 473 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define yy_new_buffer   yy_create_buffer
+
+
+ +

Definition at line 302 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define YY_NEW_FILE   yyrestart(yyin ,yyscanner )
+
+
+ +

Definition at line 155 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define YY_NO_INPUT   1
+
+
+ +

Definition at line 484 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define YY_NULL   0
+
+
+ +

Definition at line 112 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define YY_NUM_RULES   37
+
+
+ +

Definition at line 352 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define YY_READ_BUF_SIZE   8192
+
+
+ +

Definition at line 612 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define YY_RESTORE_YY_MORE_OFFSET
+
+
+ +

Definition at line 474 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define YY_RULE_SETUP   YY_USER_ACTION
+
+
+ +

Definition at line 704 of file lex.yy.c.

+ +
+
+ +
+
+ + + + + + + + +
#define YY_SC_TO_UI( c)   ((unsigned int) (unsigned char) c)
+
+
+ +

Definition at line 119 of file lex.yy.c.

+ +
+
+ +
+
+ + + + + + + + +
#define yy_set_bol( at_bol)
+
+
+Value:
{ \
+        if ( ! YY_CURRENT_BUFFER ){\
+        yyensure_buffer_stack (yyscanner); \
+                YY_CURRENT_BUFFER_LVALUE =    \
+            yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
+        } \
+        YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
+        }
+
+

Definition at line 314 of file lex.yy.c.

+ +
+
+ +
+
+ + + + + + + + +
#define yy_set_interactive( is_interactive)
+
+
+Value:
{ \
+        if ( ! YY_CURRENT_BUFFER ){ \
+        yyensure_buffer_stack (yyscanner); \
+                YY_CURRENT_BUFFER_LVALUE =    \
+            yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
+        } \
+        YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
+        }
+
+

Definition at line 304 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define YY_SKIP_YYWRAP
+
+
+ +

Definition at line 329 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define YY_START   ((yyg->yy_start - 1) / 2)
+
+
+ +

Definition at line 148 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define YY_START_STACK_INCR   25
+
+
+ +

Definition at line 669 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
+
+
+ +

Definition at line 166 of file lex.yy.c.

+ +
+
+ +
+
+ + + + + + + + +
#define YY_STATE_EOF( state)   (YY_END_OF_BUFFER + state + 1)
+
+
+ +

Definition at line 152 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define YY_STRUCT_YY_BUFFER_STATE
+
+
+ +

Definition at line 201 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define YY_TYPEDEF_YY_BUFFER_STATE
+
+
+ +

Definition at line 169 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define YY_TYPEDEF_YY_SCANNER_T
+
+
+ +

Definition at line 123 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define YY_TYPEDEF_YY_SIZE_T
+
+
+ +

Definition at line 196 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define YY_USER_ACTION
+
+
+ +

Definition at line 696 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define yycolumn   (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
+
+
+ +

Definition at line 135 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define yyconst
+
+
+ +

Definition at line 108 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define yyextra   yyg->yyextra_r
+
+
+ +

Definition at line 131 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define yyin   yyg->yyin_r
+
+
+ +

Definition at line 129 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define yyleng   yyg->yyleng_r
+
+
+ +

Definition at line 132 of file lex.yy.c.

+ +
+
+ +
+
+ + + + + + + + +
#define yyless( n)
+
+
+Value:
do \
+                { \
+                /* Undo effects of setting up yytext. */ \
+        int yyless_macro_arg = (n); \
+        YY_LESS_LINENO(yyless_macro_arg);\
+                *yy_cp = yyg->yy_hold_char; \
+                YY_RESTORE_YY_MORE_OFFSET \
+                yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
+                YY_DO_BEFORE_ACTION; /* set up yytext again */ \
+                } \
+        while ( 0 )
+
+

Definition at line 1721 of file lex.yy.c.

+ +
+
+ +
+
+ + + + + + + + +
#define yyless( n)
+
+
+Value:
do \
+                { \
+                /* Undo effects of setting up yytext. */ \
+        int yyless_macro_arg = (n); \
+        YY_LESS_LINENO(yyless_macro_arg);\
+                yytext[yyleng] = yyg->yy_hold_char; \
+                yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
+                yyg->yy_hold_char = *yyg->yy_c_buf_p; \
+                *yyg->yy_c_buf_p = '\0'; \
+                yyleng = yyless_macro_arg; \
+                } \
+        while ( 0 )
+
+

Definition at line 1721 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define yylineno   (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
+
+
+ +

Definition at line 134 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define yylval   yyg->yylval_r
+
+
+ +

Definition at line 541 of file lex.yy.c.

+ +
+
+ +
+
+ + + + + + + +
#define yymore()   yymore_used_but_not_detected
+
+
+ +

Definition at line 472 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define yyout   yyg->yyout_r
+
+
+ +

Definition at line 130 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define YYSTATE   YY_START
+
+
+ +

Definition at line 149 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define YYTABLES_NAME   "yytables"
+
+
+ +

Definition at line 2066 of file lex.yy.c.

+ +
+
+ +
+
+ + + + + + + +
#define yyterminate()   return YY_NULL
+
+
+ +

Definition at line 664 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define yytext   yyg->yytext_r
+
+
+ +

Definition at line 133 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
#define yytext_ptr   yytext_r
+
+
+ +

Definition at line 335 of file lex.yy.c.

+ +
+
+ +
+
+ + + + + + + + +
#define yywrap( n)   1
+
+
+ +

Definition at line 328 of file lex.yy.c.

+ +
+
+

Typedef Documentation

+ +
+
+ + + + +
typedef short int flex_int16_t
+
+
+ +

Definition at line 52 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
typedef int flex_int32_t
+
+
+ +

Definition at line 53 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
typedef signed char flex_int8_t
+
+
+ +

Definition at line 51 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
typedef unsigned short int flex_uint16_t
+
+
+ +

Definition at line 55 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
typedef unsigned int flex_uint32_t
+
+
+ +

Definition at line 56 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
typedef unsigned char flex_uint8_t
+
+
+ +

Definition at line 54 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
typedef struct yy_buffer_state* YY_BUFFER_STATE
+
+
+ +

Definition at line 170 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
typedef unsigned char YY_CHAR
+
+
+ +

Definition at line 331 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
typedef size_t yy_size_t
+
+
+ +

Definition at line 197 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
typedef int yy_state_type
+
+
+ +

Definition at line 333 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
typedef void* yyscan_t
+
+
+ +

Definition at line 124 of file lex.yy.c.

+ +
+
+

Function Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
YY_BUFFER_STATE yy_create_buffer (FILE * file,
int size,
yyscan_t yyscanner 
)
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void yy_delete_buffer (YY_BUFFER_STATE b,
yyscan_t yyscanner 
)
+
+
+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void yy_flush_buffer (YY_BUFFER_STATE b,
yyscan_t yyscanner 
)
+
+
+

Discard all buffered characters. On the next scan, YY_INPUT will be called.

+
Parameters:
+ + + +
bthe buffer state to be flushed, usually YY_CURRENT_BUFFER.
yyscannerThe scanner object.
+
+
+ +

Definition at line 1497 of file lex.yy.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
YY_BUFFER_STATE yy_scan_buffer (char * base,
yy_size_t size,
yyscan_t yyscanner 
)
+
+
+

Setup the input buffer state to scan directly from a user-specified character buffer.

+
Parameters:
+ + + + +
basethe character buffer
sizethe size in bytes of the character buffer
yyscannerThe scanner object.
+
+
+
Returns:
the newly allocated buffer state object.
+ +

Definition at line 1628 of file lex.yy.c.

+ +

+Here is the call graph for this function:
+
+
+ + +
+

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes,
int _yybytes_len,
yyscan_t yyscanner 
)
+
+
+

Setup the input buffer state to scan the given bytes. The next call to yylex() will scan from a copy of bytes.

+
Parameters:
+ + + + +
bytesthe byte buffer to scan
lenthe number of bytes in the buffer pointed to by bytes.
yyscannerThe scanner object.
+
+
+
Returns:
the newly allocated buffer state object.
+ +

Definition at line 1678 of file lex.yy.c.

+ +

+Here is the call graph for this function:
+
+
+ + +
+

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
YY_BUFFER_STATE yy_scan_string (yyconst char * yystr,
yyscan_t yyscanner 
)
+
+
+

Setup the input buffer state to scan a string. The next call to yylex() will scan from a copy of str.

+
Parameters:
+ + + +
yystra NUL-terminated string to scan
yyscannerThe scanner object.
+
+
+
Returns:
the newly allocated buffer state object.
+
Note:
If you want to scan bytes that may contain NUL values, then use yy_scan_bytes() instead.
+ +

Definition at line 1665 of file lex.yy.c.

+ +

+Here is the call graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer,
yyscan_t yyscanner 
)
+
+
+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void * yyalloc (yy_size_t size,
yyscan_t yyscanner 
)
+
+
+ +

Definition at line 2044 of file lex.yy.c.

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void yyfree (void * ptr,
yyscan_t yyscanner 
)
+
+
+ +

Definition at line 2061 of file lex.yy.c.

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + +
int yyget_column (yyscan_t yyscanner)
+
+
+

Get the current column number.

+
Parameters:
+ + +
yyscannerThe scanner object.
+
+
+ +

Definition at line 1762 of file lex.yy.c.

+ +
+
+ +
+
+ + + + + + + + +
int yyget_debug (yyscan_t yyscanner)
+
+
+ +

Definition at line 1867 of file lex.yy.c.

+ +
+
+ +
+
+ + + + + + + + +
YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner)
+
+
+

Get the user-defined data for this scanner.

+
Parameters:
+ + +
yyscannerThe scanner object.
+
+
+ +

Definition at line 1740 of file lex.yy.c.

+ +
+
+ +
+
+ + + + + + + + +
FILE * yyget_in (yyscan_t yyscanner)
+
+
+

Get the input stream.

+
Parameters:
+ + +
yyscannerThe scanner object.
+
+
+ +

Definition at line 1775 of file lex.yy.c.

+ +
+
+ +
+
+ + + + + + + + +
int yyget_leng (yyscan_t yyscanner)
+
+
+

Get the length of the current token.

+
Parameters:
+ + +
yyscannerThe scanner object.
+
+
+ +

Definition at line 1793 of file lex.yy.c.

+ +
+
+ +
+
+ + + + + + + + +
int yyget_lineno (yyscan_t yyscanner)
+
+
+

Get the current line number.

+
Parameters:
+ + +
yyscannerThe scanner object.
+
+
+ +

Definition at line 1749 of file lex.yy.c.

+ +
+
+ +
+
+ + + + + + + + +
YYSTYPE * yyget_lval (yyscan_t yyscanner)
+
+
+ +

Definition at line 1881 of file lex.yy.c.

+ +
+
+ +
+
+ + + + + + + + +
FILE * yyget_out (yyscan_t yyscanner)
+
+
+

Get the output stream.

+
Parameters:
+ + +
yyscannerThe scanner object.
+
+
+ +

Definition at line 1784 of file lex.yy.c.

+ +
+
+ +
+
+ + + + + + + + +
char * yyget_text (yyscan_t yyscanner)
+
+
+

Get the current token.

+
Parameters:
+ + +
yyscannerThe scanner object.
+
+
+ +

Definition at line 1803 of file lex.yy.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
int yylex (YYSTYPEyylval_param,
yyscan_t yyscanner 
)
+
+
+ +
+
+ +
+
+ + + + + + + + +
int yylex_destroy (yyscan_t yyscanner)
+
+
+ +

Definition at line 1991 of file lex.yy.c.

+ +

+Here is the call graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + +
int yylex_init (yyscan_tscanner)
+
+
+ +

Definition at line 1900 of file lex.yy.c.

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
int yylex_init_extra (YY_EXTRA_TYPE user_defined,
yyscan_tscanner 
)
+
+
+ +

Definition at line 1929 of file lex.yy.c.

+ +

+Here is the call graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + +
void yypop_buffer_state (yyscan_t yyscanner)
+
+
+

Removes and deletes the top of the stack, if present. The next element becomes the new top.

+
Parameters:
+ + +
yyscannerThe scanner object.
+
+
+ +

Definition at line 1558 of file lex.yy.c.

+ +

+Here is the call graph for this function:
+
+
+ + +
+

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void yypush_buffer_state (YY_BUFFER_STATE new_buffer,
yyscan_t yyscanner 
)
+
+
+

Pushes the new state onto the stack. The new state becomes the current state. This function will allocate the stack if necessary.

+
Parameters:
+ + + +
new_bufferThe new state.
yyscannerThe scanner object.
+
+
+ +

Definition at line 1527 of file lex.yy.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
void * yyrealloc (void * ptr,
yy_size_t size,
yyscan_t yyscanner 
)
+
+
+ +

Definition at line 2049 of file lex.yy.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void yyrestart (FILE * input_file,
yyscan_t yyscanner 
)
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void yyset_column (int column_no,
yyscan_t yyscanner 
)
+
+
+

Set the current column.

+
Parameters:
+ + + +
line_number
yyscannerThe scanner object.
+
+
+ +

Definition at line 1838 of file lex.yy.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void yyset_debug (int debug_flag,
yyscan_t yyscanner 
)
+
+
+ +

Definition at line 1873 of file lex.yy.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void yyset_extra (YY_EXTRA_TYPE user_defined,
yyscan_t yyscanner 
)
+
+
+

Set the user-defined data. This data is never touched by the scanner.

+
Parameters:
+ + + +
user_definedThe data to be associated with this scanner.
yyscannerThe scanner object.
+
+
+ +

Definition at line 1813 of file lex.yy.c.

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void yyset_in (FILE * in_str,
yyscan_t yyscanner 
)
+
+
+

Set the input stream. This does not discard the current input buffer.

+
Parameters:
+ + + +
in_strA readable stream.
yyscannerThe scanner object.
+
+
+
See also:
yy_switch_to_buffer
+ +

Definition at line 1855 of file lex.yy.c.

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void yyset_lineno (int line_number,
yyscan_t yyscanner 
)
+
+
+

Set the current line number.

+
Parameters:
+ + + +
line_number
yyscannerThe scanner object.
+
+
+ +

Definition at line 1823 of file lex.yy.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void yyset_lval (YYSTYPEyylval_param,
yyscan_t yyscanner 
)
+
+
+ +

Definition at line 1887 of file lex.yy.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void yyset_out (FILE * out_str,
yyscan_t yyscanner 
)
+
+
+ +

Definition at line 1861 of file lex.yy.c.

+ +
+
+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/lex_8yy_8c__incl.map b/flex-bison/mark1/docs/html/lex_8yy_8c__incl.map new file mode 100644 index 0000000..8be6a30 --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8c__incl.map @@ -0,0 +1,2 @@ + + diff --git a/flex-bison/mark1/docs/html/lex_8yy_8c__incl.md5 b/flex-bison/mark1/docs/html/lex_8yy_8c__incl.md5 new file mode 100644 index 0000000..f784045 --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8c__incl.md5 @@ -0,0 +1 @@ +9048fb80fd7a130600dbc887f109f334 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/lex_8yy_8c__incl.png b/flex-bison/mark1/docs/html/lex_8yy_8c__incl.png new file mode 100644 index 0000000..f3935ec Binary files /dev/null and b/flex-bison/mark1/docs/html/lex_8yy_8c__incl.png differ diff --git a/flex-bison/mark1/docs/html/lex_8yy_8c_a1c76c5a3bf3778ab371e3022a3b6b95d_cgraph.map b/flex-bison/mark1/docs/html/lex_8yy_8c_a1c76c5a3bf3778ab371e3022a3b6b95d_cgraph.map new file mode 100644 index 0000000..5baaa66 --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8c_a1c76c5a3bf3778ab371e3022a3b6b95d_cgraph.map @@ -0,0 +1,6 @@ + + + + + + diff --git a/flex-bison/mark1/docs/html/lex_8yy_8c_a1c76c5a3bf3778ab371e3022a3b6b95d_cgraph.md5 b/flex-bison/mark1/docs/html/lex_8yy_8c_a1c76c5a3bf3778ab371e3022a3b6b95d_cgraph.md5 new file mode 100644 index 0000000..9a3c008 --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8c_a1c76c5a3bf3778ab371e3022a3b6b95d_cgraph.md5 @@ -0,0 +1 @@ +bae8360fa97731b4ff2cd634e9c125d9 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/lex_8yy_8c_a1c76c5a3bf3778ab371e3022a3b6b95d_cgraph.png b/flex-bison/mark1/docs/html/lex_8yy_8c_a1c76c5a3bf3778ab371e3022a3b6b95d_cgraph.png new file mode 100644 index 0000000..5ee2de4 Binary files /dev/null and b/flex-bison/mark1/docs/html/lex_8yy_8c_a1c76c5a3bf3778ab371e3022a3b6b95d_cgraph.png differ diff --git a/flex-bison/mark1/docs/html/lex_8yy_8c_a6d4d9baf5ca416f7f4028dc309aeaa02_cgraph.map b/flex-bison/mark1/docs/html/lex_8yy_8c_a6d4d9baf5ca416f7f4028dc309aeaa02_cgraph.map new file mode 100644 index 0000000..a5524c1 --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8c_a6d4d9baf5ca416f7f4028dc309aeaa02_cgraph.map @@ -0,0 +1,3 @@ + + + diff --git a/flex-bison/mark1/docs/html/lex_8yy_8c_a6d4d9baf5ca416f7f4028dc309aeaa02_cgraph.md5 b/flex-bison/mark1/docs/html/lex_8yy_8c_a6d4d9baf5ca416f7f4028dc309aeaa02_cgraph.md5 new file mode 100644 index 0000000..6984f86 --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8c_a6d4d9baf5ca416f7f4028dc309aeaa02_cgraph.md5 @@ -0,0 +1 @@ +f12f9f4865008caa8d17376f87dc2dbf \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/lex_8yy_8c_a6d4d9baf5ca416f7f4028dc309aeaa02_cgraph.png b/flex-bison/mark1/docs/html/lex_8yy_8c_a6d4d9baf5ca416f7f4028dc309aeaa02_cgraph.png new file mode 100644 index 0000000..2c95675 Binary files /dev/null and b/flex-bison/mark1/docs/html/lex_8yy_8c_a6d4d9baf5ca416f7f4028dc309aeaa02_cgraph.png differ diff --git a/flex-bison/mark1/docs/html/lex_8yy_8c_a7cdbe6260339833a504479ae8e1ea279_icgraph.map b/flex-bison/mark1/docs/html/lex_8yy_8c_a7cdbe6260339833a504479ae8e1ea279_icgraph.map new file mode 100644 index 0000000..5473866 --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8c_a7cdbe6260339833a504479ae8e1ea279_icgraph.map @@ -0,0 +1,5 @@ + + + + + diff --git a/flex-bison/mark1/docs/html/lex_8yy_8c_a7cdbe6260339833a504479ae8e1ea279_icgraph.md5 b/flex-bison/mark1/docs/html/lex_8yy_8c_a7cdbe6260339833a504479ae8e1ea279_icgraph.md5 new file mode 100644 index 0000000..a043795 --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8c_a7cdbe6260339833a504479ae8e1ea279_icgraph.md5 @@ -0,0 +1 @@ +7d987207c2480a3a0bc1caaf3ee20169 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/lex_8yy_8c_a7cdbe6260339833a504479ae8e1ea279_icgraph.png b/flex-bison/mark1/docs/html/lex_8yy_8c_a7cdbe6260339833a504479ae8e1ea279_icgraph.png new file mode 100644 index 0000000..430aed1 Binary files /dev/null and b/flex-bison/mark1/docs/html/lex_8yy_8c_a7cdbe6260339833a504479ae8e1ea279_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/lex_8yy_8c_a878e1d6fe61658bf7d1c34a366989079_cgraph.map b/flex-bison/mark1/docs/html/lex_8yy_8c_a878e1d6fe61658bf7d1c34a366989079_cgraph.map new file mode 100644 index 0000000..639ab2b --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8c_a878e1d6fe61658bf7d1c34a366989079_cgraph.map @@ -0,0 +1,3 @@ + + + diff --git a/flex-bison/mark1/docs/html/lex_8yy_8c_a878e1d6fe61658bf7d1c34a366989079_cgraph.md5 b/flex-bison/mark1/docs/html/lex_8yy_8c_a878e1d6fe61658bf7d1c34a366989079_cgraph.md5 new file mode 100644 index 0000000..3899676 --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8c_a878e1d6fe61658bf7d1c34a366989079_cgraph.md5 @@ -0,0 +1 @@ +b6243c611e5ab373eba96d2775925a50 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/lex_8yy_8c_a878e1d6fe61658bf7d1c34a366989079_cgraph.png b/flex-bison/mark1/docs/html/lex_8yy_8c_a878e1d6fe61658bf7d1c34a366989079_cgraph.png new file mode 100644 index 0000000..43528f4 Binary files /dev/null and b/flex-bison/mark1/docs/html/lex_8yy_8c_a878e1d6fe61658bf7d1c34a366989079_cgraph.png differ diff --git a/flex-bison/mark1/docs/html/lex_8yy_8c_a878e1d6fe61658bf7d1c34a366989079_icgraph.map b/flex-bison/mark1/docs/html/lex_8yy_8c_a878e1d6fe61658bf7d1c34a366989079_icgraph.map new file mode 100644 index 0000000..c35e54b --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8c_a878e1d6fe61658bf7d1c34a366989079_icgraph.map @@ -0,0 +1,3 @@ + + + diff --git a/flex-bison/mark1/docs/html/lex_8yy_8c_a878e1d6fe61658bf7d1c34a366989079_icgraph.md5 b/flex-bison/mark1/docs/html/lex_8yy_8c_a878e1d6fe61658bf7d1c34a366989079_icgraph.md5 new file mode 100644 index 0000000..1e9c9c5 --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8c_a878e1d6fe61658bf7d1c34a366989079_icgraph.md5 @@ -0,0 +1 @@ +b04954071b4ab3f6cbf6d308ac1f868f \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/lex_8yy_8c_a878e1d6fe61658bf7d1c34a366989079_icgraph.png b/flex-bison/mark1/docs/html/lex_8yy_8c_a878e1d6fe61658bf7d1c34a366989079_icgraph.png new file mode 100644 index 0000000..21f36e2 Binary files /dev/null and b/flex-bison/mark1/docs/html/lex_8yy_8c_a878e1d6fe61658bf7d1c34a366989079_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/lex_8yy_8c_a90d20294722d171c4bf004fda3cd9403_icgraph.map b/flex-bison/mark1/docs/html/lex_8yy_8c_a90d20294722d171c4bf004fda3cd9403_icgraph.map new file mode 100644 index 0000000..d57dab1 --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8c_a90d20294722d171c4bf004fda3cd9403_icgraph.map @@ -0,0 +1,3 @@ + + + diff --git a/flex-bison/mark1/docs/html/lex_8yy_8c_a90d20294722d171c4bf004fda3cd9403_icgraph.md5 b/flex-bison/mark1/docs/html/lex_8yy_8c_a90d20294722d171c4bf004fda3cd9403_icgraph.md5 new file mode 100644 index 0000000..c0995c5 --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8c_a90d20294722d171c4bf004fda3cd9403_icgraph.md5 @@ -0,0 +1 @@ +9d3182003bdc5e3eb41a039914eb9396 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/lex_8yy_8c_a90d20294722d171c4bf004fda3cd9403_icgraph.png b/flex-bison/mark1/docs/html/lex_8yy_8c_a90d20294722d171c4bf004fda3cd9403_icgraph.png new file mode 100644 index 0000000..a10017d Binary files /dev/null and b/flex-bison/mark1/docs/html/lex_8yy_8c_a90d20294722d171c4bf004fda3cd9403_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/lex_8yy_8c_a9660b57f0bd852377eadbd84dc9df68b_cgraph.map b/flex-bison/mark1/docs/html/lex_8yy_8c_a9660b57f0bd852377eadbd84dc9df68b_cgraph.map new file mode 100644 index 0000000..3ca71c9 --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8c_a9660b57f0bd852377eadbd84dc9df68b_cgraph.map @@ -0,0 +1,4 @@ + + + + diff --git a/flex-bison/mark1/docs/html/lex_8yy_8c_a9660b57f0bd852377eadbd84dc9df68b_cgraph.md5 b/flex-bison/mark1/docs/html/lex_8yy_8c_a9660b57f0bd852377eadbd84dc9df68b_cgraph.md5 new file mode 100644 index 0000000..99c306a --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8c_a9660b57f0bd852377eadbd84dc9df68b_cgraph.md5 @@ -0,0 +1 @@ +121dc6d85f2224b2549a699400b53c4c \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/lex_8yy_8c_a9660b57f0bd852377eadbd84dc9df68b_cgraph.png b/flex-bison/mark1/docs/html/lex_8yy_8c_a9660b57f0bd852377eadbd84dc9df68b_cgraph.png new file mode 100644 index 0000000..82cd0da Binary files /dev/null and b/flex-bison/mark1/docs/html/lex_8yy_8c_a9660b57f0bd852377eadbd84dc9df68b_cgraph.png differ diff --git a/flex-bison/mark1/docs/html/lex_8yy_8c_a9660b57f0bd852377eadbd84dc9df68b_icgraph.map b/flex-bison/mark1/docs/html/lex_8yy_8c_a9660b57f0bd852377eadbd84dc9df68b_icgraph.map new file mode 100644 index 0000000..89f6f73 --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8c_a9660b57f0bd852377eadbd84dc9df68b_icgraph.map @@ -0,0 +1,4 @@ + + + + diff --git a/flex-bison/mark1/docs/html/lex_8yy_8c_a9660b57f0bd852377eadbd84dc9df68b_icgraph.md5 b/flex-bison/mark1/docs/html/lex_8yy_8c_a9660b57f0bd852377eadbd84dc9df68b_icgraph.md5 new file mode 100644 index 0000000..d15b2b5 --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8c_a9660b57f0bd852377eadbd84dc9df68b_icgraph.md5 @@ -0,0 +1 @@ +db1b7393f99c0db2ea9f0bb0d4cb16a1 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/lex_8yy_8c_a9660b57f0bd852377eadbd84dc9df68b_icgraph.png b/flex-bison/mark1/docs/html/lex_8yy_8c_a9660b57f0bd852377eadbd84dc9df68b_icgraph.png new file mode 100644 index 0000000..cf23a19 Binary files /dev/null and b/flex-bison/mark1/docs/html/lex_8yy_8c_a9660b57f0bd852377eadbd84dc9df68b_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/lex_8yy_8c_a9b71d87d640fa8c946c70204acc3fb50_icgraph.map b/flex-bison/mark1/docs/html/lex_8yy_8c_a9b71d87d640fa8c946c70204acc3fb50_icgraph.map new file mode 100644 index 0000000..6053de5 --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8c_a9b71d87d640fa8c946c70204acc3fb50_icgraph.map @@ -0,0 +1,5 @@ + + + + + diff --git a/flex-bison/mark1/docs/html/lex_8yy_8c_a9b71d87d640fa8c946c70204acc3fb50_icgraph.md5 b/flex-bison/mark1/docs/html/lex_8yy_8c_a9b71d87d640fa8c946c70204acc3fb50_icgraph.md5 new file mode 100644 index 0000000..569c103 --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8c_a9b71d87d640fa8c946c70204acc3fb50_icgraph.md5 @@ -0,0 +1 @@ +27560625953bb7ab6e3350bd57e911e9 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/lex_8yy_8c_a9b71d87d640fa8c946c70204acc3fb50_icgraph.png b/flex-bison/mark1/docs/html/lex_8yy_8c_a9b71d87d640fa8c946c70204acc3fb50_icgraph.png new file mode 100644 index 0000000..8b56fc2 Binary files /dev/null and b/flex-bison/mark1/docs/html/lex_8yy_8c_a9b71d87d640fa8c946c70204acc3fb50_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/lex_8yy_8c_aa8eea774d26ff452d9bfccd90101f794_cgraph.map b/flex-bison/mark1/docs/html/lex_8yy_8c_aa8eea774d26ff452d9bfccd90101f794_cgraph.map new file mode 100644 index 0000000..5e38650 --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8c_aa8eea774d26ff452d9bfccd90101f794_cgraph.map @@ -0,0 +1,5 @@ + + + + + diff --git a/flex-bison/mark1/docs/html/lex_8yy_8c_aa8eea774d26ff452d9bfccd90101f794_cgraph.md5 b/flex-bison/mark1/docs/html/lex_8yy_8c_aa8eea774d26ff452d9bfccd90101f794_cgraph.md5 new file mode 100644 index 0000000..d2810f9 --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8c_aa8eea774d26ff452d9bfccd90101f794_cgraph.md5 @@ -0,0 +1 @@ +0d88846ac49e6e939e3691901c819d0b \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/lex_8yy_8c_aa8eea774d26ff452d9bfccd90101f794_cgraph.png b/flex-bison/mark1/docs/html/lex_8yy_8c_aa8eea774d26ff452d9bfccd90101f794_cgraph.png new file mode 100644 index 0000000..7eb8aa1 Binary files /dev/null and b/flex-bison/mark1/docs/html/lex_8yy_8c_aa8eea774d26ff452d9bfccd90101f794_cgraph.png differ diff --git a/flex-bison/mark1/docs/html/lex_8yy_8c_aa8eea774d26ff452d9bfccd90101f794_icgraph.map b/flex-bison/mark1/docs/html/lex_8yy_8c_aa8eea774d26ff452d9bfccd90101f794_icgraph.map new file mode 100644 index 0000000..c5829ca --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8c_aa8eea774d26ff452d9bfccd90101f794_icgraph.map @@ -0,0 +1,3 @@ + + + diff --git a/flex-bison/mark1/docs/html/lex_8yy_8c_aa8eea774d26ff452d9bfccd90101f794_icgraph.md5 b/flex-bison/mark1/docs/html/lex_8yy_8c_aa8eea774d26ff452d9bfccd90101f794_icgraph.md5 new file mode 100644 index 0000000..5eafb82 --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8c_aa8eea774d26ff452d9bfccd90101f794_icgraph.md5 @@ -0,0 +1 @@ +f664c11062df09178698dd6915475f30 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/lex_8yy_8c_aa8eea774d26ff452d9bfccd90101f794_icgraph.png b/flex-bison/mark1/docs/html/lex_8yy_8c_aa8eea774d26ff452d9bfccd90101f794_icgraph.png new file mode 100644 index 0000000..8ce4742 Binary files /dev/null and b/flex-bison/mark1/docs/html/lex_8yy_8c_aa8eea774d26ff452d9bfccd90101f794_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/lex_8yy_8c_aaea60d8102c2afdd7d8e07bc43c530c3_cgraph.map b/flex-bison/mark1/docs/html/lex_8yy_8c_aaea60d8102c2afdd7d8e07bc43c530c3_cgraph.map new file mode 100644 index 0000000..94a085b --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8c_aaea60d8102c2afdd7d8e07bc43c530c3_cgraph.map @@ -0,0 +1,5 @@ + + + + + diff --git a/flex-bison/mark1/docs/html/lex_8yy_8c_aaea60d8102c2afdd7d8e07bc43c530c3_cgraph.md5 b/flex-bison/mark1/docs/html/lex_8yy_8c_aaea60d8102c2afdd7d8e07bc43c530c3_cgraph.md5 new file mode 100644 index 0000000..05a8be6 --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8c_aaea60d8102c2afdd7d8e07bc43c530c3_cgraph.md5 @@ -0,0 +1 @@ +8faa84ef9335fe1c24200bbf3c0af641 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/lex_8yy_8c_aaea60d8102c2afdd7d8e07bc43c530c3_cgraph.png b/flex-bison/mark1/docs/html/lex_8yy_8c_aaea60d8102c2afdd7d8e07bc43c530c3_cgraph.png new file mode 100644 index 0000000..2e774c6 Binary files /dev/null and b/flex-bison/mark1/docs/html/lex_8yy_8c_aaea60d8102c2afdd7d8e07bc43c530c3_cgraph.png differ diff --git a/flex-bison/mark1/docs/html/lex_8yy_8c_ac4cfd138acaf1638bbed26360e3a36ba_icgraph.map b/flex-bison/mark1/docs/html/lex_8yy_8c_ac4cfd138acaf1638bbed26360e3a36ba_icgraph.map new file mode 100644 index 0000000..048bd63 --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8c_ac4cfd138acaf1638bbed26360e3a36ba_icgraph.map @@ -0,0 +1,6 @@ + + + + + + diff --git a/flex-bison/mark1/docs/html/lex_8yy_8c_ac4cfd138acaf1638bbed26360e3a36ba_icgraph.md5 b/flex-bison/mark1/docs/html/lex_8yy_8c_ac4cfd138acaf1638bbed26360e3a36ba_icgraph.md5 new file mode 100644 index 0000000..9f1d38e --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8c_ac4cfd138acaf1638bbed26360e3a36ba_icgraph.md5 @@ -0,0 +1 @@ +0799e3d3ff276ad7247b59757a115861 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/lex_8yy_8c_ac4cfd138acaf1638bbed26360e3a36ba_icgraph.png b/flex-bison/mark1/docs/html/lex_8yy_8c_ac4cfd138acaf1638bbed26360e3a36ba_icgraph.png new file mode 100644 index 0000000..92357e5 Binary files /dev/null and b/flex-bison/mark1/docs/html/lex_8yy_8c_ac4cfd138acaf1638bbed26360e3a36ba_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/lex_8yy_8c_ace3a0458b901e4a503a33b6411ef5fa1_icgraph.map b/flex-bison/mark1/docs/html/lex_8yy_8c_ace3a0458b901e4a503a33b6411ef5fa1_icgraph.map new file mode 100644 index 0000000..18094ec --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8c_ace3a0458b901e4a503a33b6411ef5fa1_icgraph.map @@ -0,0 +1,3 @@ + + + diff --git a/flex-bison/mark1/docs/html/lex_8yy_8c_ace3a0458b901e4a503a33b6411ef5fa1_icgraph.md5 b/flex-bison/mark1/docs/html/lex_8yy_8c_ace3a0458b901e4a503a33b6411ef5fa1_icgraph.md5 new file mode 100644 index 0000000..10385f2 --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8c_ace3a0458b901e4a503a33b6411ef5fa1_icgraph.md5 @@ -0,0 +1 @@ +61f95f7cc3b957acb0c5093746309d9c \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/lex_8yy_8c_ace3a0458b901e4a503a33b6411ef5fa1_icgraph.png b/flex-bison/mark1/docs/html/lex_8yy_8c_ace3a0458b901e4a503a33b6411ef5fa1_icgraph.png new file mode 100644 index 0000000..0102157 Binary files /dev/null and b/flex-bison/mark1/docs/html/lex_8yy_8c_ace3a0458b901e4a503a33b6411ef5fa1_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/lex_8yy_8c_af84a23034d0c924a3e9ce920f4ec58d2_icgraph.map b/flex-bison/mark1/docs/html/lex_8yy_8c_af84a23034d0c924a3e9ce920f4ec58d2_icgraph.map new file mode 100644 index 0000000..134c9db --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8c_af84a23034d0c924a3e9ce920f4ec58d2_icgraph.map @@ -0,0 +1,4 @@ + + + + diff --git a/flex-bison/mark1/docs/html/lex_8yy_8c_af84a23034d0c924a3e9ce920f4ec58d2_icgraph.md5 b/flex-bison/mark1/docs/html/lex_8yy_8c_af84a23034d0c924a3e9ce920f4ec58d2_icgraph.md5 new file mode 100644 index 0000000..95b9e77 --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8c_af84a23034d0c924a3e9ce920f4ec58d2_icgraph.md5 @@ -0,0 +1 @@ +2962d3531722083b80326662031156ec \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/lex_8yy_8c_af84a23034d0c924a3e9ce920f4ec58d2_icgraph.png b/flex-bison/mark1/docs/html/lex_8yy_8c_af84a23034d0c924a3e9ce920f4ec58d2_icgraph.png new file mode 100644 index 0000000..6490af3 Binary files /dev/null and b/flex-bison/mark1/docs/html/lex_8yy_8c_af84a23034d0c924a3e9ce920f4ec58d2_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/lex_8yy_8c_afbcda44be0f721a1c8f2f280aabb74f6_icgraph.map b/flex-bison/mark1/docs/html/lex_8yy_8c_afbcda44be0f721a1c8f2f280aabb74f6_icgraph.map new file mode 100644 index 0000000..618a73f --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8c_afbcda44be0f721a1c8f2f280aabb74f6_icgraph.map @@ -0,0 +1,5 @@ + + + + + diff --git a/flex-bison/mark1/docs/html/lex_8yy_8c_afbcda44be0f721a1c8f2f280aabb74f6_icgraph.md5 b/flex-bison/mark1/docs/html/lex_8yy_8c_afbcda44be0f721a1c8f2f280aabb74f6_icgraph.md5 new file mode 100644 index 0000000..f6aab9e --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8c_afbcda44be0f721a1c8f2f280aabb74f6_icgraph.md5 @@ -0,0 +1 @@ +d3f1c922b94186f67d20f3b8df9fb1f3 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/lex_8yy_8c_afbcda44be0f721a1c8f2f280aabb74f6_icgraph.png b/flex-bison/mark1/docs/html/lex_8yy_8c_afbcda44be0f721a1c8f2f280aabb74f6_icgraph.png new file mode 100644 index 0000000..9f99ff8 Binary files /dev/null and b/flex-bison/mark1/docs/html/lex_8yy_8c_afbcda44be0f721a1c8f2f280aabb74f6_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/lex_8yy_8c_source.html b/flex-bison/mark1/docs/html/lex_8yy_8c_source.html new file mode 100644 index 0000000..3d4d8ae --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8c_source.html @@ -0,0 +1,2087 @@ + + + + +Mark1: src/parser/lexer/lex.yy.c Source File + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + +
+
+ +
+
+
+ +
+
+
+

src/parser/lexer/lex.yy.c

+
+
+Go to the documentation of this file.
00001 #line 2 "src/parser/lexer/lex.yy.c"
+00002 
+00003 #line 4 "src/parser/lexer/lex.yy.c"
+00004 
+00005 #define  YY_INT_ALIGNED short int
+00006 
+00007 /* A lexical scanner generated by flex */
+00008 
+00009 #define FLEX_SCANNER
+00010 #define YY_FLEX_MAJOR_VERSION 2
+00011 #define YY_FLEX_MINOR_VERSION 5
+00012 #define YY_FLEX_SUBMINOR_VERSION 35
+00013 #if YY_FLEX_SUBMINOR_VERSION > 0
+00014 #define FLEX_BETA
+00015 #endif
+00016 
+00017 /* First, we deal with  platform-specific or compiler-specific issues. */
+00018 
+00019 /* begin standard C headers. */
+00020 #include <stdio.h>
+00021 #include <string.h>
+00022 #include <errno.h>
+00023 #include <stdlib.h>
+00024 
+00025 /* end standard C headers. */
+00026 
+00027 /* flex integer type definitions */
+00028 
+00029 #ifndef FLEXINT_H
+00030 #define FLEXINT_H
+00031 
+00032 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
+00033 
+00034 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+00035 
+00036 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
+00037  * if you want the limit (max/min) macros for int types. 
+00038  */
+00039 #ifndef __STDC_LIMIT_MACROS
+00040 #define __STDC_LIMIT_MACROS 1
+00041 #endif
+00042 
+00043 #include <inttypes.h>
+00044 typedef int8_t flex_int8_t;
+00045 typedef uint8_t flex_uint8_t;
+00046 typedef int16_t flex_int16_t;
+00047 typedef uint16_t flex_uint16_t;
+00048 typedef int32_t flex_int32_t;
+00049 typedef uint32_t flex_uint32_t;
+00050 #else
+00051 typedef signed char flex_int8_t;
+00052 typedef short int flex_int16_t;
+00053 typedef int flex_int32_t;
+00054 typedef unsigned char flex_uint8_t; 
+00055 typedef unsigned short int flex_uint16_t;
+00056 typedef unsigned int flex_uint32_t;
+00057 #endif /* ! C99 */
+00058 
+00059 /* Limits of integral types. */
+00060 #ifndef INT8_MIN
+00061 #define INT8_MIN               (-128)
+00062 #endif
+00063 #ifndef INT16_MIN
+00064 #define INT16_MIN              (-32767-1)
+00065 #endif
+00066 #ifndef INT32_MIN
+00067 #define INT32_MIN              (-2147483647-1)
+00068 #endif
+00069 #ifndef INT8_MAX
+00070 #define INT8_MAX               (127)
+00071 #endif
+00072 #ifndef INT16_MAX
+00073 #define INT16_MAX              (32767)
+00074 #endif
+00075 #ifndef INT32_MAX
+00076 #define INT32_MAX              (2147483647)
+00077 #endif
+00078 #ifndef UINT8_MAX
+00079 #define UINT8_MAX              (255U)
+00080 #endif
+00081 #ifndef UINT16_MAX
+00082 #define UINT16_MAX             (65535U)
+00083 #endif
+00084 #ifndef UINT32_MAX
+00085 #define UINT32_MAX             (4294967295U)
+00086 #endif
+00087 
+00088 #endif /* ! FLEXINT_H */
+00089 
+00090 #ifdef __cplusplus
+00091 
+00092 /* The "const" storage-class-modifier is valid. */
+00093 #define YY_USE_CONST
+00094 
+00095 #else   /* ! __cplusplus */
+00096 
+00097 /* C99 requires __STDC__ to be defined as 1. */
+00098 #if defined (__STDC__)
+00099 
+00100 #define YY_USE_CONST
+00101 
+00102 #endif  /* defined (__STDC__) */
+00103 #endif  /* ! __cplusplus */
+00104 
+00105 #ifdef YY_USE_CONST
+00106 #define yyconst const
+00107 #else
+00108 #define yyconst
+00109 #endif
+00110 
+00111 /* Returned upon end-of-file. */
+00112 #define YY_NULL 0
+00113 
+00114 /* Promotes a possibly negative, possibly signed char to an unsigned
+00115  * integer for use as an array index.  If the signed char is negative,
+00116  * we want to instead treat it as an 8-bit unsigned char, hence the
+00117  * double cast.
+00118  */
+00119 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
+00120 
+00121 /* An opaque pointer. */
+00122 #ifndef YY_TYPEDEF_YY_SCANNER_T
+00123 #define YY_TYPEDEF_YY_SCANNER_T
+00124 typedef void* yyscan_t;
+00125 #endif
+00126 
+00127 /* For convenience, these vars (plus the bison vars far below)
+00128    are macros in the reentrant scanner. */
+00129 #define yyin yyg->yyin_r
+00130 #define yyout yyg->yyout_r
+00131 #define yyextra yyg->yyextra_r
+00132 #define yyleng yyg->yyleng_r
+00133 #define yytext yyg->yytext_r
+00134 #define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
+00135 #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
+00136 #define yy_flex_debug yyg->yy_flex_debug_r
+00137 
+00138 /* Enter a start condition.  This macro really ought to take a parameter,
+00139  * but we do it the disgusting crufty way forced on us by the ()-less
+00140  * definition of BEGIN.
+00141  */
+00142 #define BEGIN yyg->yy_start = 1 + 2 *
+00143 
+00144 /* Translate the current start state into a value that can be later handed
+00145  * to BEGIN to return to the state.  The YYSTATE alias is for lex
+00146  * compatibility.
+00147  */
+00148 #define YY_START ((yyg->yy_start - 1) / 2)
+00149 #define YYSTATE YY_START
+00150 
+00151 /* Action number for EOF rule of a given start state. */
+00152 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
+00153 
+00154 /* Special action meaning "start processing a new file". */
+00155 #define YY_NEW_FILE yyrestart(yyin ,yyscanner )
+00156 
+00157 #define YY_END_OF_BUFFER_CHAR 0
+00158 
+00159 /* Size of default input buffer. */
+00160 #ifndef YY_BUF_SIZE
+00161 #define YY_BUF_SIZE 16384
+00162 #endif
+00163 
+00164 /* The state buf must be large enough to hold one state per character in the main buffer.
+00165  */
+00166 #define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
+00167 
+00168 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
+00169 #define YY_TYPEDEF_YY_BUFFER_STATE
+00170 typedef struct yy_buffer_state *YY_BUFFER_STATE;
+00171 #endif
+00172 
+00173 #define EOB_ACT_CONTINUE_SCAN 0
+00174 #define EOB_ACT_END_OF_FILE 1
+00175 #define EOB_ACT_LAST_MATCH 2
+00176 
+00177     #define YY_LESS_LINENO(n)
+00178     
+00179 /* Return all but the first "n" matched characters back to the input stream. */
+00180 #define yyless(n) \
+00181         do \
+00182                 { \
+00183                 /* Undo effects of setting up yytext. */ \
+00184         int yyless_macro_arg = (n); \
+00185         YY_LESS_LINENO(yyless_macro_arg);\
+00186                 *yy_cp = yyg->yy_hold_char; \
+00187                 YY_RESTORE_YY_MORE_OFFSET \
+00188                 yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
+00189                 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
+00190                 } \
+00191         while ( 0 )
+00192 
+00193 #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
+00194 
+00195 #ifndef YY_TYPEDEF_YY_SIZE_T
+00196 #define YY_TYPEDEF_YY_SIZE_T
+00197 typedef size_t yy_size_t;
+00198 #endif
+00199 
+00200 #ifndef YY_STRUCT_YY_BUFFER_STATE
+00201 #define YY_STRUCT_YY_BUFFER_STATE
+00202 struct yy_buffer_state
+00203         {
+00204         FILE *yy_input_file;
+00205 
+00206         char *yy_ch_buf;                /* input buffer */
+00207         char *yy_buf_pos;               /* current position in input buffer */
+00208 
+00209         /* Size of input buffer in bytes, not including room for EOB
+00210          * characters.
+00211          */
+00212         yy_size_t yy_buf_size;
+00213 
+00214         /* Number of characters read into yy_ch_buf, not including EOB
+00215          * characters.
+00216          */
+00217         int yy_n_chars;
+00218 
+00219         /* Whether we "own" the buffer - i.e., we know we created it,
+00220          * and can realloc() it to grow it, and should free() it to
+00221          * delete it.
+00222          */
+00223         int yy_is_our_buffer;
+00224 
+00225         /* Whether this is an "interactive" input source; if so, and
+00226          * if we're using stdio for input, then we want to use getc()
+00227          * instead of fread(), to make sure we stop fetching input after
+00228          * each newline.
+00229          */
+00230         int yy_is_interactive;
+00231 
+00232         /* Whether we're considered to be at the beginning of a line.
+00233          * If so, '^' rules will be active on the next match, otherwise
+00234          * not.
+00235          */
+00236         int yy_at_bol;
+00237 
+00238     int yy_bs_lineno; 
+00239     int yy_bs_column; 
+00241         /* Whether to try to fill the input buffer when we reach the
+00242          * end of it.
+00243          */
+00244         int yy_fill_buffer;
+00245 
+00246         int yy_buffer_status;
+00247 
+00248 #define YY_BUFFER_NEW 0
+00249 #define YY_BUFFER_NORMAL 1
+00250         /* When an EOF's been seen but there's still some text to process
+00251          * then we mark the buffer as YY_EOF_PENDING, to indicate that we
+00252          * shouldn't try reading from the input source any more.  We might
+00253          * still have a bunch of tokens to match, though, because of
+00254          * possible backing-up.
+00255          *
+00256          * When we actually see the EOF, we change the status to "new"
+00257          * (via yyrestart()), so that the user can continue scanning by
+00258          * just pointing yyin at a new input file.
+00259          */
+00260 #define YY_BUFFER_EOF_PENDING 2
+00261 
+00262         };
+00263 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
+00264 
+00265 /* We provide macros for accessing buffer states in case in the
+00266  * future we want to put the buffer states in a more general
+00267  * "scanner state".
+00268  *
+00269  * Returns the top of the stack, or NULL.
+00270  */
+00271 #define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
+00272                           ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
+00273                           : NULL)
+00274 
+00275 /* Same as previous macro, but useful when we know that the buffer stack is not
+00276  * NULL or when we need an lvalue. For internal use only.
+00277  */
+00278 #define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
+00279 
+00280 void yyrestart (FILE *input_file ,yyscan_t yyscanner );
+00281 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
+00282 YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner );
+00283 void yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
+00284 void yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
+00285 void yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
+00286 void yypop_buffer_state (yyscan_t yyscanner );
+00287 
+00288 static void yyensure_buffer_stack (yyscan_t yyscanner );
+00289 static void yy_load_buffer_state (yyscan_t yyscanner );
+00290 static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner );
+00291 
+00292 #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ,yyscanner)
+00293 
+00294 YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
+00295 YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
+00296 YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner );
+00297 
+00298 void *yyalloc (yy_size_t ,yyscan_t yyscanner );
+00299 void *yyrealloc (void *,yy_size_t ,yyscan_t yyscanner );
+00300 void yyfree (void * ,yyscan_t yyscanner );
+00301 
+00302 #define yy_new_buffer yy_create_buffer
+00303 
+00304 #define yy_set_interactive(is_interactive) \
+00305         { \
+00306         if ( ! YY_CURRENT_BUFFER ){ \
+00307         yyensure_buffer_stack (yyscanner); \
+00308                 YY_CURRENT_BUFFER_LVALUE =    \
+00309             yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
+00310         } \
+00311         YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
+00312         }
+00313 
+00314 #define yy_set_bol(at_bol) \
+00315         { \
+00316         if ( ! YY_CURRENT_BUFFER ){\
+00317         yyensure_buffer_stack (yyscanner); \
+00318                 YY_CURRENT_BUFFER_LVALUE =    \
+00319             yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
+00320         } \
+00321         YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
+00322         }
+00323 
+00324 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
+00325 
+00326 /* Begin user sect3 */
+00327 
+00328 #define yywrap(n) 1
+00329 #define YY_SKIP_YYWRAP
+00330 
+00331 typedef unsigned char YY_CHAR;
+00332 
+00333 typedef int yy_state_type;
+00334 
+00335 #define yytext_ptr yytext_r
+00336 
+00337 static yy_state_type yy_get_previous_state (yyscan_t yyscanner );
+00338 static yy_state_type yy_try_NUL_trans (yy_state_type current_state  ,yyscan_t yyscanner);
+00339 static int yy_get_next_buffer (yyscan_t yyscanner );
+00340 static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
+00341 
+00342 /* Done after the current pattern has been matched and before the
+00343  * corresponding action - sets up yytext.
+00344  */
+00345 #define YY_DO_BEFORE_ACTION \
+00346         yyg->yytext_ptr = yy_bp; \
+00347         yyleng = (size_t) (yy_cp - yy_bp); \
+00348         yyg->yy_hold_char = *yy_cp; \
+00349         *yy_cp = '\0'; \
+00350         yyg->yy_c_buf_p = yy_cp;
+00351 
+00352 #define YY_NUM_RULES 37
+00353 #define YY_END_OF_BUFFER 38
+00354 /* This struct is not used in this scanner,
+00355    but its presence is necessary. */
+00356 struct yy_trans_info
+00357         {
+00358         flex_int32_t yy_verify;
+00359         flex_int32_t yy_nxt;
+00360         };
+00361 static yyconst flex_int16_t yy_accept[65] =
+00362     {   0,
+00363         0,    0,   38,   36,   35,   35,   21,   36,    5,   36,
+00364        11,   12,    3,    1,    7,    2,    4,   31,    9,    8,
+00365        26,    6,   25,   10,   33,   15,   16,   33,   33,   33,
+00366        33,   33,   13,   36,   14,   24,    0,   32,   17,    0,
+00367         0,   31,   28,   23,   27,   33,   33,   33,   33,   20,
+00368        33,   19,    0,   34,   31,   18,   33,   22,   33,   31,
+00369        33,   29,   30,    0
+00370     } ;
+00371 
+00372 static yyconst flex_int32_t yy_ec[256] =
+00373     {   0,
+00374         1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
+00375         1,    1,    4,    1,    1,    1,    1,    1,    1,    1,
+00376         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+00377         1,    2,    5,    6,    1,    1,    7,    8,    1,    9,
+00378        10,   11,   12,   13,   14,   15,   16,   17,   17,   17,
+00379        17,   17,   17,   17,   17,   17,   17,   18,   19,   20,
+00380        21,   22,   23,    1,   24,   24,   24,   24,   24,   24,
+00381        24,   24,   24,   24,   24,   24,   24,   24,   24,   24,
+00382        24,   24,   24,   24,   24,   24,   24,   24,   24,   24,
+00383        25,    1,   26,    1,    1,    1,   27,   24,   24,   28,
+00384 
+00385        29,   30,   24,   24,   24,   24,   24,   31,   24,   32,
+00386        33,   24,   24,   34,   35,   36,   37,   24,   24,   24,
+00387        24,   24,   38,   39,   40,    1,    1,    1,    1,    1,
+00388         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+00389         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+00390         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+00391         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+00392         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+00393         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+00394         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+00395 
+00396         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+00397         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+00398         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+00399         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+00400         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+00401         1,    1,    1,    1,    1
+00402     } ;
+00403 
+00404 static yyconst flex_int32_t yy_meta[41] =
+00405     {   0,
+00406         1,    1,    2,    2,    1,    1,    1,    1,    1,    1,
+00407         1,    1,    1,    1,    1,    1,    3,    1,    1,    1,
+00408         1,    1,    1,    3,    1,    1,    3,    3,    3,    3,
+00409         3,    3,    3,    3,    3,    3,    3,    1,    1,    1
+00410     } ;
+00411 
+00412 static yyconst flex_int16_t yy_base[68] =
+00413     {   0,
+00414         0,    0,   77,   78,   78,   78,   55,   69,   78,   66,
+00415        78,   78,   78,   78,   78,   78,   57,   26,   78,   78,
+00416        51,   50,   49,   78,    0,   78,   78,   37,   41,   34,
+00417        32,   31,   78,   25,   78,   78,   57,   78,   78,   59,
+00418        44,   27,   78,   78,   78,    0,   32,   28,   22,    0,
+00419        20,   78,   53,   78,   38,    0,   19,    0,   24,   35,
+00420        22,    0,    0,   78,   44,   43,   47
+00421     } ;
+00422 
+00423 static yyconst flex_int16_t yy_def[68] =
+00424     {   0,
+00425        64,    1,   64,   64,   64,   64,   64,   65,   64,   64,
+00426        64,   64,   64,   64,   64,   64,   64,   64,   64,   64,
+00427        64,   64,   64,   64,   66,   64,   64,   66,   66,   66,
+00428        66,   66,   64,   64,   64,   64,   65,   64,   64,   67,
+00429        64,   64,   64,   64,   64,   66,   66,   66,   66,   66,
+00430        66,   64,   67,   64,   64,   66,   66,   66,   66,   64,
+00431        66,   66,   66,    0,   64,   64,   64
+00432     } ;
+00433 
+00434 static yyconst flex_int16_t yy_nxt[119] =
+00435     {   0,
+00436         4,    5,    6,    4,    7,    8,    9,   10,   11,   12,
+00437        13,   14,   15,   16,    4,   17,   18,   19,   20,   21,
+00438        22,   23,   24,   25,   26,   27,   28,   25,   25,   29,
+00439        25,   30,   31,   25,   25,   32,   25,   33,   34,   35,
+00440        41,   41,   42,   42,   37,   46,   37,   53,   53,   53,
+00441        63,   60,   62,   61,   60,   54,   59,   58,   57,   56,
+00442        55,   54,   38,   52,   51,   50,   49,   48,   47,   45,
+00443        44,   43,   40,   39,   38,   36,   64,    3,   64,   64,
+00444        64,   64,   64,   64,   64,   64,   64,   64,   64,   64,
+00445        64,   64,   64,   64,   64,   64,   64,   64,   64,   64,
+00446 
+00447        64,   64,   64,   64,   64,   64,   64,   64,   64,   64,
+00448        64,   64,   64,   64,   64,   64,   64,   64
+00449     } ;
+00450 
+00451 static yyconst flex_int16_t yy_chk[119] =
+00452     {   0,
+00453         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+00454         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+00455         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+00456         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+00457        18,   42,   18,   42,   65,   66,   65,   67,   67,   67,
+00458        61,   60,   59,   57,   55,   53,   51,   49,   48,   47,
+00459        41,   40,   37,   34,   32,   31,   30,   29,   28,   23,
+00460        22,   21,   17,   10,    8,    7,    3,   64,   64,   64,
+00461        64,   64,   64,   64,   64,   64,   64,   64,   64,   64,
+00462        64,   64,   64,   64,   64,   64,   64,   64,   64,   64,
+00463 
+00464        64,   64,   64,   64,   64,   64,   64,   64,   64,   64,
+00465        64,   64,   64,   64,   64,   64,   64,   64
+00466     } ;
+00467 
+00468 /* The intent behind this definition is that it'll catch
+00469  * any uses of REJECT which flex missed.
+00470  */
+00471 #define REJECT reject_used_but_not_detected
+00472 #define yymore() yymore_used_but_not_detected
+00473 #define YY_MORE_ADJ 0
+00474 #define YY_RESTORE_YY_MORE_OFFSET
+00475 #line 1 "src/parser/lexer/lexer.l"
+00476 /* Pattern Macros */
+00477 #line 9 "src/parser/lexer/lexer.l"
+00478 
+00479 /* Includes */
+00480 #include "ast.h"
+00481 #include "parser.h"
+00482 #include <string.h>
+00483 
+00484 #define YY_NO_INPUT 1
+00485 #line 486 "src/parser/lexer/lex.yy.c"
+00486 
+00487 #define INITIAL 0
+00488 
+00489 #ifndef YY_NO_UNISTD_H
+00490 /* Special case for "unistd.h", since it is non-ANSI. We include it way
+00491  * down here because we want the user's section 1 to have been scanned first.
+00492  * The user has a chance to override it with an option.
+00493  */
+00494 #include <unistd.h>
+00495 #endif
+00496 
+00497 #ifndef YY_EXTRA_TYPE
+00498 #define YY_EXTRA_TYPE void *
+00499 #endif
+00500 
+00501 /* Holds the entire state of the reentrant scanner. */
+00502 struct yyguts_t
+00503     {
+00504 
+00505     /* User-defined. Not touched by flex. */
+00506     YY_EXTRA_TYPE yyextra_r;
+00507 
+00508     /* The rest are the same as the globals declared in the non-reentrant scanner. */
+00509     FILE *yyin_r, *yyout_r;
+00510     size_t yy_buffer_stack_top; 
+00511     size_t yy_buffer_stack_max; 
+00512     YY_BUFFER_STATE * yy_buffer_stack; 
+00513     char yy_hold_char;
+00514     int yy_n_chars;
+00515     int yyleng_r;
+00516     char *yy_c_buf_p;
+00517     int yy_init;
+00518     int yy_start;
+00519     int yy_did_buffer_switch_on_eof;
+00520     int yy_start_stack_ptr;
+00521     int yy_start_stack_depth;
+00522     int *yy_start_stack;
+00523     yy_state_type yy_last_accepting_state;
+00524     char* yy_last_accepting_cpos;
+00525 
+00526     int yylineno_r;
+00527     int yy_flex_debug_r;
+00528 
+00529     char *yytext_r;
+00530     int yy_more_flag;
+00531     int yy_more_len;
+00532 
+00533     YYSTYPE * yylval_r;
+00534 
+00535     }; /* end struct yyguts_t */
+00536 
+00537 static int yy_init_globals (yyscan_t yyscanner );
+00538 
+00539     /* This must go here because YYSTYPE and YYLTYPE are included
+00540      * from bison output in section 1.*/
+00541     #    define yylval yyg->yylval_r
+00542     
+00543 int yylex_init (yyscan_t* scanner);
+00544 
+00545 int yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
+00546 
+00547 /* Accessor methods to globals.
+00548    These are made visible to non-reentrant scanners for convenience. */
+00549 
+00550 int yylex_destroy (yyscan_t yyscanner );
+00551 
+00552 int yyget_debug (yyscan_t yyscanner );
+00553 
+00554 void yyset_debug (int debug_flag ,yyscan_t yyscanner );
+00555 
+00556 YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner );
+00557 
+00558 void yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
+00559 
+00560 FILE *yyget_in (yyscan_t yyscanner );
+00561 
+00562 void yyset_in  (FILE * in_str ,yyscan_t yyscanner );
+00563 
+00564 FILE *yyget_out (yyscan_t yyscanner );
+00565 
+00566 void yyset_out  (FILE * out_str ,yyscan_t yyscanner );
+00567 
+00568 int yyget_leng (yyscan_t yyscanner );
+00569 
+00570 char *yyget_text (yyscan_t yyscanner );
+00571 
+00572 int yyget_lineno (yyscan_t yyscanner );
+00573 
+00574 void yyset_lineno (int line_number ,yyscan_t yyscanner );
+00575 
+00576 YYSTYPE * yyget_lval (yyscan_t yyscanner );
+00577 
+00578 void yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
+00579 
+00580 /* Macros after this point can all be overridden by user definitions in
+00581  * section 1.
+00582  */
+00583 
+00584 #ifndef YY_SKIP_YYWRAP
+00585 #ifdef __cplusplus
+00586 extern "C" int yywrap (yyscan_t yyscanner );
+00587 #else
+00588 extern int yywrap (yyscan_t yyscanner );
+00589 #endif
+00590 #endif
+00591 
+00592 #ifndef yytext_ptr
+00593 static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
+00594 #endif
+00595 
+00596 #ifdef YY_NEED_STRLEN
+00597 static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
+00598 #endif
+00599 
+00600 #ifndef YY_NO_INPUT
+00601 
+00602 #ifdef __cplusplus
+00603 static int yyinput (yyscan_t yyscanner );
+00604 #else
+00605 static int input (yyscan_t yyscanner );
+00606 #endif
+00607 
+00608 #endif
+00609 
+00610 /* Amount of stuff to slurp up with each read. */
+00611 #ifndef YY_READ_BUF_SIZE
+00612 #define YY_READ_BUF_SIZE 8192
+00613 #endif
+00614 
+00615 /* Copy whatever the last rule matched to the standard output. */
+00616 #ifndef ECHO
+00617 /* This used to be an fputs(), but since the string might contain NUL's,
+00618  * we now use fwrite().
+00619  */
+00620 #define ECHO fwrite( yytext, yyleng, 1, yyout )
+00621 #endif
+00622 
+00623 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
+00624  * is returned in "result".
+00625  */
+00626 #ifndef YY_INPUT
+00627 #define YY_INPUT(buf,result,max_size) \
+00628         if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
+00629                 { \
+00630                 int c = '*'; \
+00631                 int n; \
+00632                 for ( n = 0; n < max_size && \
+00633                              (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
+00634                         buf[n] = (char) c; \
+00635                 if ( c == '\n' ) \
+00636                         buf[n++] = (char) c; \
+00637                 if ( c == EOF && ferror( yyin ) ) \
+00638                         YY_FATAL_ERROR( "input in flex scanner failed" ); \
+00639                 result = n; \
+00640                 } \
+00641         else \
+00642                 { \
+00643                 errno=0; \
+00644                 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
+00645                         { \
+00646                         if( errno != EINTR) \
+00647                                 { \
+00648                                 YY_FATAL_ERROR( "input in flex scanner failed" ); \
+00649                                 break; \
+00650                                 } \
+00651                         errno=0; \
+00652                         clearerr(yyin); \
+00653                         } \
+00654                 }\
+00655 \
+00656 
+00657 #endif
+00658 
+00659 /* No semi-colon after return; correct usage is to write "yyterminate();" -
+00660  * we don't want an extra ';' after the "return" because that will cause
+00661  * some compilers to complain about unreachable statements.
+00662  */
+00663 #ifndef yyterminate
+00664 #define yyterminate() return YY_NULL
+00665 #endif
+00666 
+00667 /* Number of entries by which start-condition stack grows. */
+00668 #ifndef YY_START_STACK_INCR
+00669 #define YY_START_STACK_INCR 25
+00670 #endif
+00671 
+00672 /* Report a fatal error. */
+00673 #ifndef YY_FATAL_ERROR
+00674 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
+00675 #endif
+00676 
+00677 /* end tables serialization structures and prototypes */
+00678 
+00679 /* Default declaration of generated scanner - a define so the user can
+00680  * easily add parameters.
+00681  */
+00682 #ifndef YY_DECL
+00683 #define YY_DECL_IS_OURS 1
+00684 
+00685 extern int yylex \
+00686                (YYSTYPE * yylval_param ,yyscan_t yyscanner);
+00687 
+00688 #define YY_DECL int yylex \
+00689                (YYSTYPE * yylval_param , yyscan_t yyscanner)
+00690 #endif /* !YY_DECL */
+00691 
+00692 /* Code executed at the beginning of each rule, after yytext and yyleng
+00693  * have been set up.
+00694  */
+00695 #ifndef YY_USER_ACTION
+00696 #define YY_USER_ACTION
+00697 #endif
+00698 
+00699 /* Code executed at the end of each rule. */
+00700 #ifndef YY_BREAK
+00701 #define YY_BREAK break;
+00702 #endif
+00703 
+00704 #define YY_RULE_SETUP \
+00705         YY_USER_ACTION
+00706 
+00709 YY_DECL
+00710 {
+00711         register yy_state_type yy_current_state;
+00712         register char *yy_cp, *yy_bp;
+00713         register int yy_act;
+00714     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+00715 
+00716 #line 23 "src/parser/lexer/lexer.l"
+00717 
+00718 
+00719  /* Math Operators*/
+00720 #line 721 "src/parser/lexer/lex.yy.c"
+00721 
+00722     yylval = yylval_param;
+00723 
+00724         if ( !yyg->yy_init )
+00725                 {
+00726                 yyg->yy_init = 1;
+00727 
+00728 #ifdef YY_USER_INIT
+00729                 YY_USER_INIT;
+00730 #endif
+00731 
+00732                 if ( ! yyg->yy_start )
+00733                         yyg->yy_start = 1;      /* first start state */
+00734 
+00735                 if ( ! yyin )
+00736                         yyin = stdin;
+00737 
+00738                 if ( ! yyout )
+00739                         yyout = stdout;
+00740 
+00741                 if ( ! YY_CURRENT_BUFFER ) {
+00742                         yyensure_buffer_stack (yyscanner);
+00743                         YY_CURRENT_BUFFER_LVALUE =
+00744                                 yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
+00745                 }
+00746 
+00747                 yy_load_buffer_state(yyscanner );
+00748                 }
+00749 
+00750         while ( 1 )             /* loops until end-of-file is reached */
+00751                 {
+00752                 yy_cp = yyg->yy_c_buf_p;
+00753 
+00754                 /* Support of yytext. */
+00755                 *yy_cp = yyg->yy_hold_char;
+00756 
+00757                 /* yy_bp points to the position in yy_ch_buf of the start of
+00758                  * the current run.
+00759                  */
+00760                 yy_bp = yy_cp;
+00761 
+00762                 yy_current_state = yyg->yy_start;
+00763 yy_match:
+00764                 do
+00765                         {
+00766                         register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
+00767                         if ( yy_accept[yy_current_state] )
+00768                                 {
+00769                                 yyg->yy_last_accepting_state = yy_current_state;
+00770                                 yyg->yy_last_accepting_cpos = yy_cp;
+00771                                 }
+00772                         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+00773                                 {
+00774                                 yy_current_state = (int) yy_def[yy_current_state];
+00775                                 if ( yy_current_state >= 65 )
+00776                                         yy_c = yy_meta[(unsigned int) yy_c];
+00777                                 }
+00778                         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+00779                         ++yy_cp;
+00780                         }
+00781                 while ( yy_base[yy_current_state] != 78 );
+00782 
+00783 yy_find_action:
+00784                 yy_act = yy_accept[yy_current_state];
+00785                 if ( yy_act == 0 )
+00786                         { /* have to back up */
+00787                         yy_cp = yyg->yy_last_accepting_cpos;
+00788                         yy_current_state = yyg->yy_last_accepting_state;
+00789                         yy_act = yy_accept[yy_current_state];
+00790                         }
+00791 
+00792                 YY_DO_BEFORE_ACTION;
+00793 
+00794 do_action:      /* This label is used only to access EOF actions. */
+00795 
+00796                 switch ( yy_act )
+00797         { /* beginning of action switch */
+00798                         case 0: /* must back up */
+00799                         /* undo the effects of YY_DO_BEFORE_ACTION */
+00800                         *yy_cp = yyg->yy_hold_char;
+00801                         yy_cp = yyg->yy_last_accepting_cpos;
+00802                         yy_current_state = yyg->yy_last_accepting_state;
+00803                         goto yy_find_action;
+00804 
+00805 case 1:
+00806 #line 27 "src/parser/lexer/lexer.l"
+00807 case 2:
+00808 #line 28 "src/parser/lexer/lexer.l"
+00809 case 3:
+00810 #line 29 "src/parser/lexer/lexer.l"
+00811 case 4:
+00812 #line 30 "src/parser/lexer/lexer.l"
+00813 case 5:
+00814 #line 31 "src/parser/lexer/lexer.l"
+00815 /* Statement Operators */
+00816 case 6:
+00817 #line 33 "src/parser/lexer/lexer.l"
+00818 case 7:
+00819 #line 34 "src/parser/lexer/lexer.l"
+00820 case 8:
+00821 #line 35 "src/parser/lexer/lexer.l"
+00822 case 9:
+00823 #line 36 "src/parser/lexer/lexer.l"
+00824 case 10:
+00825 #line 37 "src/parser/lexer/lexer.l"
+00826 /* Braces and Parens */
+00827 case 11:
+00828 #line 39 "src/parser/lexer/lexer.l"
+00829 case 12:
+00830 #line 40 "src/parser/lexer/lexer.l"
+00831 case 13:
+00832 #line 41 "src/parser/lexer/lexer.l"
+00833 case 14:
+00834 #line 42 "src/parser/lexer/lexer.l"
+00835 case 15:
+00836 #line 43 "src/parser/lexer/lexer.l"
+00837 case 16:
+00838 YY_RULE_SETUP
+00839 #line 43 "src/parser/lexer/lexer.l"
+00840 { return yytext[0]; }
+00841         YY_BREAK
+00842 /* Logical Operators */
+00843 case 17:
+00844 #line 47 "src/parser/lexer/lexer.l"
+00845 case 18:
+00846 YY_RULE_SETUP
+00847 #line 47 "src/parser/lexer/lexer.l"
+00848 { return tAND; }
+00849         YY_BREAK
+00850 case 19:
+00851 #line 49 "src/parser/lexer/lexer.l"
+00852 case 20:
+00853 YY_RULE_SETUP
+00854 #line 49 "src/parser/lexer/lexer.l"
+00855 { return tOR; }
+00856         YY_BREAK
+00857 case 21:
+00858 #line 51 "src/parser/lexer/lexer.l"
+00859 case 22:
+00860 YY_RULE_SETUP
+00861 #line 51 "src/parser/lexer/lexer.l"
+00862 { return tNOT; }
+00863         YY_BREAK
+00864 /* Comparison Operators */
+00865 case 23:
+00866 YY_RULE_SETUP
+00867 #line 54 "src/parser/lexer/lexer.l"
+00868 { return tEQ; }
+00869         YY_BREAK
+00870 case 24:
+00871 YY_RULE_SETUP
+00872 #line 55 "src/parser/lexer/lexer.l"
+00873 { return tNE; }
+00874         YY_BREAK
+00875 case 25:
+00876 YY_RULE_SETUP
+00877 #line 56 "src/parser/lexer/lexer.l"
+00878 { return tGT; }
+00879         YY_BREAK
+00880 case 26:
+00881 YY_RULE_SETUP
+00882 #line 57 "src/parser/lexer/lexer.l"
+00883 { return tLT; }
+00884         YY_BREAK
+00885 case 27:
+00886 YY_RULE_SETUP
+00887 #line 58 "src/parser/lexer/lexer.l"
+00888 { return tGTE; }
+00889         YY_BREAK
+00890 case 28:
+00891 YY_RULE_SETUP
+00892 #line 59 "src/parser/lexer/lexer.l"
+00893 { return tLTE; }
+00894         YY_BREAK
+00895 case 29:
+00896 #line 62 "src/parser/lexer/lexer.l"
+00897 case 30:
+00898 YY_RULE_SETUP
+00899 #line 62 "src/parser/lexer/lexer.l"
+00900 { yylval->Node = VAL_BOOL( yytext ); return tBOOL; }
+00901         YY_BREAK
+00902 case 31:
+00903 YY_RULE_SETUP
+00904 #line 63 "src/parser/lexer/lexer.l"
+00905 { yylval->Node = VAL_FLOAT( yytext ); return tFLOAT; }
+00906         YY_BREAK
+00907 case 32:
+00908 YY_RULE_SETUP
+00909 #line 64 "src/parser/lexer/lexer.l"
+00910 { yylval->Node = VAL_STRING( yytext ); return tSTRING; }
+00911         YY_BREAK
+00912 case 33:
+00913 YY_RULE_SETUP
+00914 #line 65 "src/parser/lexer/lexer.l"
+00915 { yylval->Node = VAL_STRING( yytext ); return tID; }
+00916         YY_BREAK
+00917 case 34:
+00918 /* rule 34 can match eol */
+00919 YY_RULE_SETUP
+00920 #line 67 "src/parser/lexer/lexer.l"
+00921 ;/* Ignore Comments */
+00922         YY_BREAK
+00923 case 35:
+00924 /* rule 35 can match eol */
+00925 YY_RULE_SETUP
+00926 #line 68 "src/parser/lexer/lexer.l"
+00927 ;/* Ignore Whitespace */
+00928         YY_BREAK
+00929 case 36:
+00930 YY_RULE_SETUP
+00931 #line 69 "src/parser/lexer/lexer.l"
+00932 { yyerror(yyscanner, yytext); }
+00933         YY_BREAK
+00934 case 37:
+00935 YY_RULE_SETUP
+00936 #line 71 "src/parser/lexer/lexer.l"
+00937 ECHO;
+00938         YY_BREAK
+00939 #line 940 "src/parser/lexer/lex.yy.c"
+00940 case YY_STATE_EOF(INITIAL):
+00941         yyterminate();
+00942 
+00943         case YY_END_OF_BUFFER:
+00944                 {
+00945                 /* Amount of text matched not including the EOB char. */
+00946                 int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
+00947 
+00948                 /* Undo the effects of YY_DO_BEFORE_ACTION. */
+00949                 *yy_cp = yyg->yy_hold_char;
+00950                 YY_RESTORE_YY_MORE_OFFSET
+00951 
+00952                 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
+00953                         {
+00954                         /* We're scanning a new file or input source.  It's
+00955                          * possible that this happened because the user
+00956                          * just pointed yyin at a new source and called
+00957                          * yylex().  If so, then we have to assure
+00958                          * consistency between YY_CURRENT_BUFFER and our
+00959                          * globals.  Here is the right place to do so, because
+00960                          * this is the first action (other than possibly a
+00961                          * back-up) that will match for the new input source.
+00962                          */
+00963                         yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+00964                         YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
+00965                         YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
+00966                         }
+00967 
+00968                 /* Note that here we test for yy_c_buf_p "<=" to the position
+00969                  * of the first EOB in the buffer, since yy_c_buf_p will
+00970                  * already have been incremented past the NUL character
+00971                  * (since all states make transitions on EOB to the
+00972                  * end-of-buffer state).  Contrast this with the test
+00973                  * in input().
+00974                  */
+00975                 if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
+00976                         { /* This was really a NUL. */
+00977                         yy_state_type yy_next_state;
+00978 
+00979                         yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
+00980 
+00981                         yy_current_state = yy_get_previous_state( yyscanner );
+00982 
+00983                         /* Okay, we're now positioned to make the NUL
+00984                          * transition.  We couldn't have
+00985                          * yy_get_previous_state() go ahead and do it
+00986                          * for us because it doesn't know how to deal
+00987                          * with the possibility of jamming (and we don't
+00988                          * want to build jamming into it because then it
+00989                          * will run more slowly).
+00990                          */
+00991 
+00992                         yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
+00993 
+00994                         yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
+00995 
+00996                         if ( yy_next_state )
+00997                                 {
+00998                                 /* Consume the NUL. */
+00999                                 yy_cp = ++yyg->yy_c_buf_p;
+01000                                 yy_current_state = yy_next_state;
+01001                                 goto yy_match;
+01002                                 }
+01003 
+01004                         else
+01005                                 {
+01006                                 yy_cp = yyg->yy_c_buf_p;
+01007                                 goto yy_find_action;
+01008                                 }
+01009                         }
+01010 
+01011                 else switch ( yy_get_next_buffer( yyscanner ) )
+01012                         {
+01013                         case EOB_ACT_END_OF_FILE:
+01014                                 {
+01015                                 yyg->yy_did_buffer_switch_on_eof = 0;
+01016 
+01017                                 if ( yywrap(yyscanner ) )
+01018                                         {
+01019                                         /* Note: because we've taken care in
+01020                                          * yy_get_next_buffer() to have set up
+01021                                          * yytext, we can now set up
+01022                                          * yy_c_buf_p so that if some total
+01023                                          * hoser (like flex itself) wants to
+01024                                          * call the scanner after we return the
+01025                                          * YY_NULL, it'll still work - another
+01026                                          * YY_NULL will get returned.
+01027                                          */
+01028                                         yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
+01029 
+01030                                         yy_act = YY_STATE_EOF(YY_START);
+01031                                         goto do_action;
+01032                                         }
+01033 
+01034                                 else
+01035                                         {
+01036                                         if ( ! yyg->yy_did_buffer_switch_on_eof )
+01037                                                 YY_NEW_FILE;
+01038                                         }
+01039                                 break;
+01040                                 }
+01041 
+01042                         case EOB_ACT_CONTINUE_SCAN:
+01043                                 yyg->yy_c_buf_p =
+01044                                         yyg->yytext_ptr + yy_amount_of_matched_text;
+01045 
+01046                                 yy_current_state = yy_get_previous_state( yyscanner );
+01047 
+01048                                 yy_cp = yyg->yy_c_buf_p;
+01049                                 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
+01050                                 goto yy_match;
+01051 
+01052                         case EOB_ACT_LAST_MATCH:
+01053                                 yyg->yy_c_buf_p =
+01054                                 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
+01055 
+01056                                 yy_current_state = yy_get_previous_state( yyscanner );
+01057 
+01058                                 yy_cp = yyg->yy_c_buf_p;
+01059                                 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
+01060                                 goto yy_find_action;
+01061                         }
+01062                 break;
+01063                 }
+01064 
+01065         default:
+01066                 YY_FATAL_ERROR(
+01067                         "fatal flex scanner internal error--no action found" );
+01068         } /* end of action switch */
+01069                 } /* end of scanning one token */
+01070 } /* end of yylex */
+01071 
+01072 /* yy_get_next_buffer - try to read in a new buffer
+01073  *
+01074  * Returns a code representing an action:
+01075  *      EOB_ACT_LAST_MATCH -
+01076  *      EOB_ACT_CONTINUE_SCAN - continue scanning from current position
+01077  *      EOB_ACT_END_OF_FILE - end of file
+01078  */
+01079 static int yy_get_next_buffer (yyscan_t yyscanner)
+01080 {
+01081     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+01082         register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
+01083         register char *source = yyg->yytext_ptr;
+01084         register int number_to_move, i;
+01085         int ret_val;
+01086 
+01087         if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
+01088                 YY_FATAL_ERROR(
+01089                 "fatal flex scanner internal error--end of buffer missed" );
+01090 
+01091         if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
+01092                 { /* Don't try to fill the buffer, so this is an EOF. */
+01093                 if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
+01094                         {
+01095                         /* We matched a single character, the EOB, so
+01096                          * treat this as a final EOF.
+01097                          */
+01098                         return EOB_ACT_END_OF_FILE;
+01099                         }
+01100 
+01101                 else
+01102                         {
+01103                         /* We matched some text prior to the EOB, first
+01104                          * process it.
+01105                          */
+01106                         return EOB_ACT_LAST_MATCH;
+01107                         }
+01108                 }
+01109 
+01110         /* Try to read more data. */
+01111 
+01112         /* First move last chars to start of buffer. */
+01113         number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1;
+01114 
+01115         for ( i = 0; i < number_to_move; ++i )
+01116                 *(dest++) = *(source++);
+01117 
+01118         if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
+01119                 /* don't do the read, it's not guaranteed to return an EOF,
+01120                  * just force an EOF
+01121                  */
+01122                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
+01123 
+01124         else
+01125                 {
+01126                         int num_to_read =
+01127                         YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
+01128 
+01129                 while ( num_to_read <= 0 )
+01130                         { /* Not enough room in the buffer - grow it. */
+01131 
+01132                         /* just a shorter name for the current buffer */
+01133                         YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
+01134 
+01135                         int yy_c_buf_p_offset =
+01136                                 (int) (yyg->yy_c_buf_p - b->yy_ch_buf);
+01137 
+01138                         if ( b->yy_is_our_buffer )
+01139                                 {
+01140                                 int new_size = b->yy_buf_size * 2;
+01141 
+01142                                 if ( new_size <= 0 )
+01143                                         b->yy_buf_size += b->yy_buf_size / 8;
+01144                                 else
+01145                                         b->yy_buf_size *= 2;
+01146 
+01147                                 b->yy_ch_buf = (char *)
+01148                                         /* Include room in for 2 EOB chars. */
+01149                                         yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner );
+01150                                 }
+01151                         else
+01152                                 /* Can't grow it, we don't own it. */
+01153                                 b->yy_ch_buf = 0;
+01154 
+01155                         if ( ! b->yy_ch_buf )
+01156                                 YY_FATAL_ERROR(
+01157                                 "fatal error - scanner input buffer overflow" );
+01158 
+01159                         yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
+01160 
+01161                         num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
+01162                                                 number_to_move - 1;
+01163 
+01164                         }
+01165 
+01166                 if ( num_to_read > YY_READ_BUF_SIZE )
+01167                         num_to_read = YY_READ_BUF_SIZE;
+01168 
+01169                 /* Read in more data. */
+01170                 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
+01171                         yyg->yy_n_chars, (size_t) num_to_read );
+01172 
+01173                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
+01174                 }
+01175 
+01176         if ( yyg->yy_n_chars == 0 )
+01177                 {
+01178                 if ( number_to_move == YY_MORE_ADJ )
+01179                         {
+01180                         ret_val = EOB_ACT_END_OF_FILE;
+01181                         yyrestart(yyin  ,yyscanner);
+01182                         }
+01183 
+01184                 else
+01185                         {
+01186                         ret_val = EOB_ACT_LAST_MATCH;
+01187                         YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
+01188                                 YY_BUFFER_EOF_PENDING;
+01189                         }
+01190                 }
+01191 
+01192         else
+01193                 ret_val = EOB_ACT_CONTINUE_SCAN;
+01194 
+01195         if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
+01196                 /* Extend the array by 50%, plus the number we really need. */
+01197                 yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
+01198                 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner );
+01199                 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+01200                         YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
+01201         }
+01202 
+01203         yyg->yy_n_chars += number_to_move;
+01204         YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
+01205         YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
+01206 
+01207         yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
+01208 
+01209         return ret_val;
+01210 }
+01211 
+01212 /* yy_get_previous_state - get the state just before the EOB char was reached */
+01213 
+01214     static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
+01215 {
+01216         register yy_state_type yy_current_state;
+01217         register char *yy_cp;
+01218     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+01219 
+01220         yy_current_state = yyg->yy_start;
+01221 
+01222         for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
+01223                 {
+01224                 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
+01225                 if ( yy_accept[yy_current_state] )
+01226                         {
+01227                         yyg->yy_last_accepting_state = yy_current_state;
+01228                         yyg->yy_last_accepting_cpos = yy_cp;
+01229                         }
+01230                 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+01231                         {
+01232                         yy_current_state = (int) yy_def[yy_current_state];
+01233                         if ( yy_current_state >= 65 )
+01234                                 yy_c = yy_meta[(unsigned int) yy_c];
+01235                         }
+01236                 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+01237                 }
+01238 
+01239         return yy_current_state;
+01240 }
+01241 
+01242 /* yy_try_NUL_trans - try to make a transition on the NUL character
+01243  *
+01244  * synopsis
+01245  *      next_state = yy_try_NUL_trans( current_state );
+01246  */
+01247     static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state , yyscan_t yyscanner)
+01248 {
+01249         register int yy_is_jam;
+01250     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
+01251         register char *yy_cp = yyg->yy_c_buf_p;
+01252 
+01253         register YY_CHAR yy_c = 1;
+01254         if ( yy_accept[yy_current_state] )
+01255                 {
+01256                 yyg->yy_last_accepting_state = yy_current_state;
+01257                 yyg->yy_last_accepting_cpos = yy_cp;
+01258                 }
+01259         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+01260                 {
+01261                 yy_current_state = (int) yy_def[yy_current_state];
+01262                 if ( yy_current_state >= 65 )
+01263                         yy_c = yy_meta[(unsigned int) yy_c];
+01264                 }
+01265         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+01266         yy_is_jam = (yy_current_state == 64);
+01267 
+01268         return yy_is_jam ? 0 : yy_current_state;
+01269 }
+01270 
+01271 #ifndef YY_NO_INPUT
+01272 #ifdef __cplusplus
+01273     static int yyinput (yyscan_t yyscanner)
+01274 #else
+01275     static int input  (yyscan_t yyscanner)
+01276 #endif
+01277 
+01278 {
+01279         int c;
+01280     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+01281 
+01282         *yyg->yy_c_buf_p = yyg->yy_hold_char;
+01283 
+01284         if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
+01285                 {
+01286                 /* yy_c_buf_p now points to the character we want to return.
+01287                  * If this occurs *before* the EOB characters, then it's a
+01288                  * valid NUL; if not, then we've hit the end of the buffer.
+01289                  */
+01290                 if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
+01291                         /* This was really a NUL. */
+01292                         *yyg->yy_c_buf_p = '\0';
+01293 
+01294                 else
+01295                         { /* need more input */
+01296                         int offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
+01297                         ++yyg->yy_c_buf_p;
+01298 
+01299                         switch ( yy_get_next_buffer( yyscanner ) )
+01300                                 {
+01301                                 case EOB_ACT_LAST_MATCH:
+01302                                         /* This happens because yy_g_n_b()
+01303                                          * sees that we've accumulated a
+01304                                          * token and flags that we need to
+01305                                          * try matching the token before
+01306                                          * proceeding.  But for input(),
+01307                                          * there's no matching to consider.
+01308                                          * So convert the EOB_ACT_LAST_MATCH
+01309                                          * to EOB_ACT_END_OF_FILE.
+01310                                          */
+01311 
+01312                                         /* Reset buffer status. */
+01313                                         yyrestart(yyin ,yyscanner);
+01314 
+01315                                         /*FALLTHROUGH*/
+01316 
+01317                                 case EOB_ACT_END_OF_FILE:
+01318                                         {
+01319                                         if ( yywrap(yyscanner ) )
+01320                                                 return EOF;
+01321 
+01322                                         if ( ! yyg->yy_did_buffer_switch_on_eof )
+01323                                                 YY_NEW_FILE;
+01324 #ifdef __cplusplus
+01325                                         return yyinput(yyscanner);
+01326 #else
+01327                                         return input(yyscanner);
+01328 #endif
+01329                                         }
+01330 
+01331                                 case EOB_ACT_CONTINUE_SCAN:
+01332                                         yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
+01333                                         break;
+01334                                 }
+01335                         }
+01336                 }
+01337 
+01338         c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */
+01339         *yyg->yy_c_buf_p = '\0';        /* preserve yytext */
+01340         yyg->yy_hold_char = *++yyg->yy_c_buf_p;
+01341 
+01342         return c;
+01343 }
+01344 #endif  /* ifndef YY_NO_INPUT */
+01345 
+01351     void yyrestart  (FILE * input_file , yyscan_t yyscanner)
+01352 {
+01353     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+01354 
+01355         if ( ! YY_CURRENT_BUFFER ){
+01356         yyensure_buffer_stack (yyscanner);
+01357                 YY_CURRENT_BUFFER_LVALUE =
+01358             yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
+01359         }
+01360 
+01361         yy_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner);
+01362         yy_load_buffer_state(yyscanner );
+01363 }
+01364 
+01369     void yy_switch_to_buffer  (YY_BUFFER_STATE  new_buffer , yyscan_t yyscanner)
+01370 {
+01371     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+01372 
+01373         /* TODO. We should be able to replace this entire function body
+01374          * with
+01375          *              yypop_buffer_state();
+01376          *              yypush_buffer_state(new_buffer);
+01377      */
+01378         yyensure_buffer_stack (yyscanner);
+01379         if ( YY_CURRENT_BUFFER == new_buffer )
+01380                 return;
+01381 
+01382         if ( YY_CURRENT_BUFFER )
+01383                 {
+01384                 /* Flush out information for old buffer. */
+01385                 *yyg->yy_c_buf_p = yyg->yy_hold_char;
+01386                 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
+01387                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
+01388                 }
+01389 
+01390         YY_CURRENT_BUFFER_LVALUE = new_buffer;
+01391         yy_load_buffer_state(yyscanner );
+01392 
+01393         /* We don't actually know whether we did this switch during
+01394          * EOF (yywrap()) processing, but the only time this flag
+01395          * is looked at is after yywrap() is called, so it's safe
+01396          * to go ahead and always set it.
+01397          */
+01398         yyg->yy_did_buffer_switch_on_eof = 1;
+01399 }
+01400 
+01401 static void yy_load_buffer_state  (yyscan_t yyscanner)
+01402 {
+01403     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+01404         yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+01405         yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
+01406         yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
+01407         yyg->yy_hold_char = *yyg->yy_c_buf_p;
+01408 }
+01409 
+01416     YY_BUFFER_STATE yy_create_buffer  (FILE * file, int  size , yyscan_t yyscanner)
+01417 {
+01418         YY_BUFFER_STATE b;
+01419     
+01420         b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
+01421         if ( ! b )
+01422                 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+01423 
+01424         b->yy_buf_size = size;
+01425 
+01426         /* yy_ch_buf has to be 2 characters longer than the size given because
+01427          * we need to put in 2 end-of-buffer characters.
+01428          */
+01429         b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ,yyscanner );
+01430         if ( ! b->yy_ch_buf )
+01431                 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+01432 
+01433         b->yy_is_our_buffer = 1;
+01434 
+01435         yy_init_buffer(b,file ,yyscanner);
+01436 
+01437         return b;
+01438 }
+01439 
+01444     void yy_delete_buffer (YY_BUFFER_STATE  b , yyscan_t yyscanner)
+01445 {
+01446     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+01447 
+01448         if ( ! b )
+01449                 return;
+01450 
+01451         if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
+01452                 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
+01453 
+01454         if ( b->yy_is_our_buffer )
+01455                 yyfree((void *) b->yy_ch_buf ,yyscanner );
+01456 
+01457         yyfree((void *) b ,yyscanner );
+01458 }
+01459 
+01460 #ifndef __cplusplus
+01461 extern int isatty (int );
+01462 #endif /* __cplusplus */
+01463     
+01464 /* Initializes or reinitializes a buffer.
+01465  * This function is sometimes called more than once on the same buffer,
+01466  * such as during a yyrestart() or at EOF.
+01467  */
+01468     static void yy_init_buffer  (YY_BUFFER_STATE  b, FILE * file , yyscan_t yyscanner)
+01469 
+01470 {
+01471         int oerrno = errno;
+01472     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+01473 
+01474         yy_flush_buffer(b ,yyscanner);
+01475 
+01476         b->yy_input_file = file;
+01477         b->yy_fill_buffer = 1;
+01478 
+01479     /* If b is the current buffer, then yy_init_buffer was _probably_
+01480      * called from yyrestart() or through yy_get_next_buffer.
+01481      * In that case, we don't want to reset the lineno or column.
+01482      */
+01483     if (b != YY_CURRENT_BUFFER){
+01484         b->yy_bs_lineno = 1;
+01485         b->yy_bs_column = 0;
+01486     }
+01487 
+01488         b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
+01489     
+01490         errno = oerrno;
+01491 }
+01492 
+01497     void yy_flush_buffer (YY_BUFFER_STATE  b , yyscan_t yyscanner)
+01498 {
+01499     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+01500         if ( ! b )
+01501                 return;
+01502 
+01503         b->yy_n_chars = 0;
+01504 
+01505         /* We always need two end-of-buffer characters.  The first causes
+01506          * a transition to the end-of-buffer state.  The second causes
+01507          * a jam in that state.
+01508          */
+01509         b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
+01510         b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
+01511 
+01512         b->yy_buf_pos = &b->yy_ch_buf[0];
+01513 
+01514         b->yy_at_bol = 1;
+01515         b->yy_buffer_status = YY_BUFFER_NEW;
+01516 
+01517         if ( b == YY_CURRENT_BUFFER )
+01518                 yy_load_buffer_state(yyscanner );
+01519 }
+01520 
+01527 void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
+01528 {
+01529     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+01530         if (new_buffer == NULL)
+01531                 return;
+01532 
+01533         yyensure_buffer_stack(yyscanner);
+01534 
+01535         /* This block is copied from yy_switch_to_buffer. */
+01536         if ( YY_CURRENT_BUFFER )
+01537                 {
+01538                 /* Flush out information for old buffer. */
+01539                 *yyg->yy_c_buf_p = yyg->yy_hold_char;
+01540                 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
+01541                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
+01542                 }
+01543 
+01544         /* Only push if top exists. Otherwise, replace top. */
+01545         if (YY_CURRENT_BUFFER)
+01546                 yyg->yy_buffer_stack_top++;
+01547         YY_CURRENT_BUFFER_LVALUE = new_buffer;
+01548 
+01549         /* copied from yy_switch_to_buffer. */
+01550         yy_load_buffer_state(yyscanner );
+01551         yyg->yy_did_buffer_switch_on_eof = 1;
+01552 }
+01553 
+01558 void yypop_buffer_state (yyscan_t yyscanner)
+01559 {
+01560     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+01561         if (!YY_CURRENT_BUFFER)
+01562                 return;
+01563 
+01564         yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner);
+01565         YY_CURRENT_BUFFER_LVALUE = NULL;
+01566         if (yyg->yy_buffer_stack_top > 0)
+01567                 --yyg->yy_buffer_stack_top;
+01568 
+01569         if (YY_CURRENT_BUFFER) {
+01570                 yy_load_buffer_state(yyscanner );
+01571                 yyg->yy_did_buffer_switch_on_eof = 1;
+01572         }
+01573 }
+01574 
+01575 /* Allocates the stack if it does not exist.
+01576  *  Guarantees space for at least one push.
+01577  */
+01578 static void yyensure_buffer_stack (yyscan_t yyscanner)
+01579 {
+01580         int num_to_alloc;
+01581     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+01582 
+01583         if (!yyg->yy_buffer_stack) {
+01584 
+01585                 /* First allocation is just for 2 elements, since we don't know if this
+01586                  * scanner will even need a stack. We use 2 instead of 1 to avoid an
+01587                  * immediate realloc on the next call.
+01588          */
+01589                 num_to_alloc = 1;
+01590                 yyg->yy_buffer_stack = (struct yy_buffer_state**)yyalloc
+01591                                                                 (num_to_alloc * sizeof(struct yy_buffer_state*)
+01592                                                                 , yyscanner);
+01593                 if ( ! yyg->yy_buffer_stack )
+01594                         YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
+01595                                                                   
+01596                 memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
+01597                                 
+01598                 yyg->yy_buffer_stack_max = num_to_alloc;
+01599                 yyg->yy_buffer_stack_top = 0;
+01600                 return;
+01601         }
+01602 
+01603         if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
+01604 
+01605                 /* Increase the buffer to prepare for a possible push. */
+01606                 int grow_size = 8 /* arbitrary grow size */;
+01607 
+01608                 num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
+01609                 yyg->yy_buffer_stack = (struct yy_buffer_state**)yyrealloc
+01610                                                                 (yyg->yy_buffer_stack,
+01611                                                                 num_to_alloc * sizeof(struct yy_buffer_state*)
+01612                                                                 , yyscanner);
+01613                 if ( ! yyg->yy_buffer_stack )
+01614                         YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
+01615 
+01616                 /* zero only the new slots.*/
+01617                 memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
+01618                 yyg->yy_buffer_stack_max = num_to_alloc;
+01619         }
+01620 }
+01621 
+01628 YY_BUFFER_STATE yy_scan_buffer  (char * base, yy_size_t  size , yyscan_t yyscanner)
+01629 {
+01630         YY_BUFFER_STATE b;
+01631     
+01632         if ( size < 2 ||
+01633              base[size-2] != YY_END_OF_BUFFER_CHAR ||
+01634              base[size-1] != YY_END_OF_BUFFER_CHAR )
+01635                 /* They forgot to leave room for the EOB's. */
+01636                 return 0;
+01637 
+01638         b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
+01639         if ( ! b )
+01640                 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
+01641 
+01642         b->yy_buf_size = size - 2;      /* "- 2" to take care of EOB's */
+01643         b->yy_buf_pos = b->yy_ch_buf = base;
+01644         b->yy_is_our_buffer = 0;
+01645         b->yy_input_file = 0;
+01646         b->yy_n_chars = b->yy_buf_size;
+01647         b->yy_is_interactive = 0;
+01648         b->yy_at_bol = 1;
+01649         b->yy_fill_buffer = 0;
+01650         b->yy_buffer_status = YY_BUFFER_NEW;
+01651 
+01652         yy_switch_to_buffer(b ,yyscanner );
+01653 
+01654         return b;
+01655 }
+01656 
+01665 YY_BUFFER_STATE yy_scan_string (yyconst char * yystr , yyscan_t yyscanner)
+01666 {
+01667     
+01668         return yy_scan_bytes(yystr,strlen(yystr) ,yyscanner);
+01669 }
+01670 
+01678 YY_BUFFER_STATE yy_scan_bytes  (yyconst char * yybytes, int  _yybytes_len , yyscan_t yyscanner)
+01679 {
+01680         YY_BUFFER_STATE b;
+01681         char *buf;
+01682         yy_size_t n;
+01683         int i;
+01684     
+01685         /* Get memory for full buffer, including space for trailing EOB's. */
+01686         n = _yybytes_len + 2;
+01687         buf = (char *) yyalloc(n ,yyscanner );
+01688         if ( ! buf )
+01689                 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
+01690 
+01691         for ( i = 0; i < _yybytes_len; ++i )
+01692                 buf[i] = yybytes[i];
+01693 
+01694         buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
+01695 
+01696         b = yy_scan_buffer(buf,n ,yyscanner);
+01697         if ( ! b )
+01698                 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
+01699 
+01700         /* It's okay to grow etc. this buffer, and we should throw it
+01701          * away when we're done.
+01702          */
+01703         b->yy_is_our_buffer = 1;
+01704 
+01705         return b;
+01706 }
+01707 
+01708 #ifndef YY_EXIT_FAILURE
+01709 #define YY_EXIT_FAILURE 2
+01710 #endif
+01711 
+01712 static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
+01713 {
+01714         (void) fprintf( stderr, "%s\n", msg );
+01715         exit( YY_EXIT_FAILURE );
+01716 }
+01717 
+01718 /* Redefine yyless() so it works in section 3 code. */
+01719 
+01720 #undef yyless
+01721 #define yyless(n) \
+01722         do \
+01723                 { \
+01724                 /* Undo effects of setting up yytext. */ \
+01725         int yyless_macro_arg = (n); \
+01726         YY_LESS_LINENO(yyless_macro_arg);\
+01727                 yytext[yyleng] = yyg->yy_hold_char; \
+01728                 yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
+01729                 yyg->yy_hold_char = *yyg->yy_c_buf_p; \
+01730                 *yyg->yy_c_buf_p = '\0'; \
+01731                 yyleng = yyless_macro_arg; \
+01732                 } \
+01733         while ( 0 )
+01734 
+01735 /* Accessor  methods (get/set functions) to struct members. */
+01736 
+01740 YY_EXTRA_TYPE yyget_extra  (yyscan_t yyscanner)
+01741 {
+01742     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+01743     return yyextra;
+01744 }
+01745 
+01749 int yyget_lineno  (yyscan_t yyscanner)
+01750 {
+01751     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+01752     
+01753         if (! YY_CURRENT_BUFFER)
+01754             return 0;
+01755     
+01756     return yylineno;
+01757 }
+01758 
+01762 int yyget_column  (yyscan_t yyscanner)
+01763 {
+01764     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+01765     
+01766         if (! YY_CURRENT_BUFFER)
+01767             return 0;
+01768     
+01769     return yycolumn;
+01770 }
+01771 
+01775 FILE *yyget_in  (yyscan_t yyscanner)
+01776 {
+01777     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+01778     return yyin;
+01779 }
+01780 
+01784 FILE *yyget_out  (yyscan_t yyscanner)
+01785 {
+01786     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+01787     return yyout;
+01788 }
+01789 
+01793 int yyget_leng  (yyscan_t yyscanner)
+01794 {
+01795     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+01796     return yyleng;
+01797 }
+01798 
+01803 char *yyget_text  (yyscan_t yyscanner)
+01804 {
+01805     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+01806     return yytext;
+01807 }
+01808 
+01813 void yyset_extra (YY_EXTRA_TYPE  user_defined , yyscan_t yyscanner)
+01814 {
+01815     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+01816     yyextra = user_defined ;
+01817 }
+01818 
+01823 void yyset_lineno (int  line_number , yyscan_t yyscanner)
+01824 {
+01825     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+01826 
+01827         /* lineno is only valid if an input buffer exists. */
+01828         if (! YY_CURRENT_BUFFER )
+01829            yy_fatal_error( "yyset_lineno called with no buffer" , yyscanner); 
+01830     
+01831     yylineno = line_number;
+01832 }
+01833 
+01838 void yyset_column (int  column_no , yyscan_t yyscanner)
+01839 {
+01840     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+01841 
+01842         /* column is only valid if an input buffer exists. */
+01843         if (! YY_CURRENT_BUFFER )
+01844            yy_fatal_error( "yyset_column called with no buffer" , yyscanner); 
+01845     
+01846     yycolumn = column_no;
+01847 }
+01848 
+01855 void yyset_in (FILE *  in_str , yyscan_t yyscanner)
+01856 {
+01857     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+01858     yyin = in_str ;
+01859 }
+01860 
+01861 void yyset_out (FILE *  out_str , yyscan_t yyscanner)
+01862 {
+01863     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+01864     yyout = out_str ;
+01865 }
+01866 
+01867 int yyget_debug  (yyscan_t yyscanner)
+01868 {
+01869     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+01870     return yy_flex_debug;
+01871 }
+01872 
+01873 void yyset_debug (int  bdebug , yyscan_t yyscanner)
+01874 {
+01875     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+01876     yy_flex_debug = bdebug ;
+01877 }
+01878 
+01879 /* Accessor methods for yylval and yylloc */
+01880 
+01881 YYSTYPE * yyget_lval  (yyscan_t yyscanner)
+01882 {
+01883     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+01884     return yylval;
+01885 }
+01886 
+01887 void yyset_lval (YYSTYPE *  yylval_param , yyscan_t yyscanner)
+01888 {
+01889     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+01890     yylval = yylval_param;
+01891 }
+01892 
+01893 /* User-visible API */
+01894 
+01895 /* yylex_init is special because it creates the scanner itself, so it is
+01896  * the ONLY reentrant function that doesn't take the scanner as the last argument.
+01897  * That's why we explicitly handle the declaration, instead of using our macros.
+01898  */
+01899 
+01900 int yylex_init(yyscan_t* ptr_yy_globals)
+01901 
+01902 {
+01903     if (ptr_yy_globals == NULL){
+01904         errno = EINVAL;
+01905         return 1;
+01906     }
+01907 
+01908     *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL );
+01909 
+01910     if (*ptr_yy_globals == NULL){
+01911         errno = ENOMEM;
+01912         return 1;
+01913     }
+01914 
+01915     /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
+01916     memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
+01917 
+01918     return yy_init_globals ( *ptr_yy_globals );
+01919 }
+01920 
+01921 /* yylex_init_extra has the same functionality as yylex_init, but follows the
+01922  * convention of taking the scanner as the last argument. Note however, that
+01923  * this is a *pointer* to a scanner, as it will be allocated by this call (and
+01924  * is the reason, too, why this function also must handle its own declaration).
+01925  * The user defined value in the first argument will be available to yyalloc in
+01926  * the yyextra field.
+01927  */
+01928 
+01929 int yylex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals )
+01930 
+01931 {
+01932     struct yyguts_t dummy_yyguts;
+01933 
+01934     yyset_extra (yy_user_defined, &dummy_yyguts);
+01935 
+01936     if (ptr_yy_globals == NULL){
+01937         errno = EINVAL;
+01938         return 1;
+01939     }
+01940         
+01941     *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
+01942         
+01943     if (*ptr_yy_globals == NULL){
+01944         errno = ENOMEM;
+01945         return 1;
+01946     }
+01947     
+01948     /* By setting to 0xAA, we expose bugs in
+01949     yy_init_globals. Leave at 0x00 for releases. */
+01950     memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
+01951     
+01952     yyset_extra (yy_user_defined, *ptr_yy_globals);
+01953     
+01954     return yy_init_globals ( *ptr_yy_globals );
+01955 }
+01956 
+01957 static int yy_init_globals (yyscan_t yyscanner)
+01958 {
+01959     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+01960     /* Initialization is the same as for the non-reentrant scanner.
+01961      * This function is called from yylex_destroy(), so don't allocate here.
+01962      */
+01963 
+01964     yyg->yy_buffer_stack = 0;
+01965     yyg->yy_buffer_stack_top = 0;
+01966     yyg->yy_buffer_stack_max = 0;
+01967     yyg->yy_c_buf_p = (char *) 0;
+01968     yyg->yy_init = 0;
+01969     yyg->yy_start = 0;
+01970 
+01971     yyg->yy_start_stack_ptr = 0;
+01972     yyg->yy_start_stack_depth = 0;
+01973     yyg->yy_start_stack =  NULL;
+01974 
+01975 /* Defined in main.c */
+01976 #ifdef YY_STDINIT
+01977     yyin = stdin;
+01978     yyout = stdout;
+01979 #else
+01980     yyin = (FILE *) 0;
+01981     yyout = (FILE *) 0;
+01982 #endif
+01983 
+01984     /* For future reference: Set errno on error, since we are called by
+01985      * yylex_init()
+01986      */
+01987     return 0;
+01988 }
+01989 
+01990 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
+01991 int yylex_destroy  (yyscan_t yyscanner)
+01992 {
+01993     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+01994 
+01995     /* Pop the buffer stack, destroying each element. */
+01996         while(YY_CURRENT_BUFFER){
+01997                 yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner );
+01998                 YY_CURRENT_BUFFER_LVALUE = NULL;
+01999                 yypop_buffer_state(yyscanner);
+02000         }
+02001 
+02002         /* Destroy the stack itself. */
+02003         yyfree(yyg->yy_buffer_stack ,yyscanner);
+02004         yyg->yy_buffer_stack = NULL;
+02005 
+02006     /* Destroy the start condition stack. */
+02007         yyfree(yyg->yy_start_stack ,yyscanner );
+02008         yyg->yy_start_stack = NULL;
+02009 
+02010     /* Reset the globals. This is important in a non-reentrant scanner so the next time
+02011      * yylex() is called, initialization will occur. */
+02012     yy_init_globals( yyscanner);
+02013 
+02014     /* Destroy the main struct (reentrant only). */
+02015     yyfree ( yyscanner , yyscanner );
+02016     yyscanner = NULL;
+02017     return 0;
+02018 }
+02019 
+02020 /*
+02021  * Internal utility routines.
+02022  */
+02023 
+02024 #ifndef yytext_ptr
+02025 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner)
+02026 {
+02027         register int i;
+02028         for ( i = 0; i < n; ++i )
+02029                 s1[i] = s2[i];
+02030 }
+02031 #endif
+02032 
+02033 #ifdef YY_NEED_STRLEN
+02034 static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
+02035 {
+02036         register int n;
+02037         for ( n = 0; s[n]; ++n )
+02038                 ;
+02039 
+02040         return n;
+02041 }
+02042 #endif
+02043 
+02044 void *yyalloc (yy_size_t  size , yyscan_t yyscanner)
+02045 {
+02046         return (void *) malloc( size );
+02047 }
+02048 
+02049 void *yyrealloc  (void * ptr, yy_size_t  size , yyscan_t yyscanner)
+02050 {
+02051         /* The cast to (char *) in the following accommodates both
+02052          * implementations that use char* generic pointers, and those
+02053          * that use void* generic pointers.  It works with the latter
+02054          * because both ANSI C and C++ allow castless assignment from
+02055          * any pointer type to void*, and deal with argument conversions
+02056          * as though doing an assignment.
+02057          */
+02058         return (void *) realloc( (char *) ptr, size );
+02059 }
+02060 
+02061 void yyfree (void * ptr , yyscan_t yyscanner)
+02062 {
+02063         free( (char *) ptr );   /* see yyrealloc() for (char *) cast */
+02064 }
+02065 
+02066 #define YYTABLES_NAME "yytables"
+02067 
+02068 #line 71 "src/parser/lexer/lexer.l"
+02069 
+02070 
+02071 
+02072 
+02073 
+02074 
+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/lex_8yy_8h.html b/flex-bison/mark1/docs/html/lex_8yy_8h.html new file mode 100644 index 0000000..f56f4a4 --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8h.html @@ -0,0 +1,1997 @@ + + + + +Mark1: src/parser/lexer/lex.yy.h File Reference + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + +
+
+ +
+
+
+ +
+
+ +
+

src/parser/lexer/lex.yy.h File Reference

+
+
+
#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+Include dependency graph for lex.yy.h:
+
+
+
+
+

Go to the source code of this file.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Data Structures

struct  yy_buffer_state

+Defines

#define yyIN_HEADER   1
#define YY_INT_ALIGNED   short int
#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION   2
#define YY_FLEX_MINOR_VERSION   5
#define YY_FLEX_SUBMINOR_VERSION   35
#define FLEXINT_H
#define INT8_MIN   (-128)
#define INT16_MIN   (-32767-1)
#define INT32_MIN   (-2147483647-1)
#define INT8_MAX   (127)
#define INT16_MAX   (32767)
#define INT32_MAX   (2147483647)
#define UINT8_MAX   (255U)
#define UINT16_MAX   (65535U)
#define UINT32_MAX   (4294967295U)
#define yyconst
#define YY_TYPEDEF_YY_SCANNER_T
#define yyin   yyg->yyin_r
#define yyout   yyg->yyout_r
#define yyextra   yyg->yyextra_r
#define yyleng   yyg->yyleng_r
#define yytext   yyg->yytext_r
#define yylineno   (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
#define yycolumn   (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
#define yy_flex_debug   yyg->yy_flex_debug_r
#define YY_BUF_SIZE   16384
#define YY_TYPEDEF_YY_BUFFER_STATE
#define YY_TYPEDEF_YY_SIZE_T
#define YY_STRUCT_YY_BUFFER_STATE
#define yywrap(n)   1
#define YY_SKIP_YYWRAP
#define yytext_ptr   yytext_r
#define YY_EXTRA_TYPE   void *
#define YY_READ_BUF_SIZE   8192
#define YY_START_STACK_INCR   25
#define YY_DECL_IS_OURS   1
#define YY_DECL

+Typedefs

typedef signed char flex_int8_t
typedef short int flex_int16_t
typedef int flex_int32_t
typedef unsigned char flex_uint8_t
typedef unsigned short int flex_uint16_t
typedef unsigned int flex_uint32_t
typedef void * yyscan_t
typedef struct yy_buffer_stateYY_BUFFER_STATE
typedef size_t yy_size_t

+Functions

void yyrestart (FILE *input_file, yyscan_t yyscanner)
void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer, yyscan_t yyscanner)
YY_BUFFER_STATE yy_create_buffer (FILE *file, int size, yyscan_t yyscanner)
void yy_delete_buffer (YY_BUFFER_STATE b, yyscan_t yyscanner)
void yy_flush_buffer (YY_BUFFER_STATE b, yyscan_t yyscanner)
void yypush_buffer_state (YY_BUFFER_STATE new_buffer, yyscan_t yyscanner)
void yypop_buffer_state (yyscan_t yyscanner)
YY_BUFFER_STATE yy_scan_buffer (char *base, yy_size_t size, yyscan_t yyscanner)
YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str, yyscan_t yyscanner)
YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes, int len, yyscan_t yyscanner)
void * yyalloc (yy_size_t, yyscan_t yyscanner)
void * yyrealloc (void *, yy_size_t, yyscan_t yyscanner)
void yyfree (void *, yyscan_t yyscanner)
int yylex_init (yyscan_t *scanner)
int yylex_init_extra (YY_EXTRA_TYPE user_defined, yyscan_t *scanner)
int yylex_destroy (yyscan_t yyscanner)
int yyget_debug (yyscan_t yyscanner)
void yyset_debug (int debug_flag, yyscan_t yyscanner)
YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner)
void yyset_extra (YY_EXTRA_TYPE user_defined, yyscan_t yyscanner)
FILE * yyget_in (yyscan_t yyscanner)
void yyset_in (FILE *in_str, yyscan_t yyscanner)
FILE * yyget_out (yyscan_t yyscanner)
void yyset_out (FILE *out_str, yyscan_t yyscanner)
int yyget_leng (yyscan_t yyscanner)
char * yyget_text (yyscan_t yyscanner)
int yyget_lineno (yyscan_t yyscanner)
void yyset_lineno (int line_number, yyscan_t yyscanner)
YYSTYPEyyget_lval (yyscan_t yyscanner)
void yyset_lval (YYSTYPE *yylval_param, yyscan_t yyscanner)
int yywrap (yyscan_t yyscanner)
int yylex (YYSTYPE *yylval_param, yyscan_t yyscanner)
+

Define Documentation

+ +
+
+ + + + +
#define FLEX_SCANNER
+
+
+ +

Definition at line 13 of file lex.yy.h.

+ +
+
+ +
+
+ + + + +
#define FLEXINT_H
+
+
+ +

Definition at line 34 of file lex.yy.h.

+ +
+
+ +
+
+ + + + +
#define INT16_MAX   (32767)
+
+
+ +

Definition at line 77 of file lex.yy.h.

+ +
+
+ +
+
+ + + + +
#define INT16_MIN   (-32767-1)
+
+
+ +

Definition at line 68 of file lex.yy.h.

+ +
+
+ +
+
+ + + + +
#define INT32_MAX   (2147483647)
+
+
+ +

Definition at line 80 of file lex.yy.h.

+ +
+
+ +
+
+ + + + +
#define INT32_MIN   (-2147483647-1)
+
+
+ +

Definition at line 71 of file lex.yy.h.

+ +
+
+ +
+
+ + + + +
#define INT8_MAX   (127)
+
+
+ +

Definition at line 74 of file lex.yy.h.

+ +
+
+ +
+
+ + + + +
#define INT8_MIN   (-128)
+
+
+ +

Definition at line 65 of file lex.yy.h.

+ +
+
+ +
+
+ + + + +
#define UINT16_MAX   (65535U)
+
+
+ +

Definition at line 86 of file lex.yy.h.

+ +
+
+ +
+
+ + + + +
#define UINT32_MAX   (4294967295U)
+
+
+ +

Definition at line 89 of file lex.yy.h.

+ +
+
+ +
+
+ + + + +
#define UINT8_MAX   (255U)
+
+
+ +

Definition at line 83 of file lex.yy.h.

+ +
+
+ +
+
+ + + + +
#define YY_BUF_SIZE   16384
+
+
+ +

Definition at line 134 of file lex.yy.h.

+ +
+
+ +
+
+ + + + +
#define YY_DECL
+
+
+Value:
int yylex \
+               (YYSTYPE * yylval_param , yyscan_t yyscanner)
+
+

Definition at line 318 of file lex.yy.h.

+ +
+
+ +
+
+ + + + +
#define YY_DECL_IS_OURS   1
+
+
+ +

Definition at line 313 of file lex.yy.h.

+ +
+
+ +
+
+ + + + +
#define YY_EXTRA_TYPE   void *
+
+
+ +

Definition at line 235 of file lex.yy.h.

+ +
+
+ +
+
+ + + + +
#define yy_flex_debug   yyg->yy_flex_debug_r
+
+
+ +

Definition at line 130 of file lex.yy.h.

+ +
+
+ +
+
+ + + + +
#define YY_FLEX_MAJOR_VERSION   2
+
+
+ +

Definition at line 14 of file lex.yy.h.

+ +
+
+ +
+
+ + + + +
#define YY_FLEX_MINOR_VERSION   5
+
+
+ +

Definition at line 15 of file lex.yy.h.

+ +
+
+ +
+
+ + + + +
#define YY_FLEX_SUBMINOR_VERSION   35
+
+
+ +

Definition at line 16 of file lex.yy.h.

+ +
+
+ +
+
+ + + + +
#define YY_INT_ALIGNED   short int
+
+
+ +

Definition at line 9 of file lex.yy.h.

+ +
+
+ +
+
+ + + + +
#define YY_READ_BUF_SIZE   8192
+
+
+ +

Definition at line 301 of file lex.yy.h.

+ +
+
+ +
+
+ + + + +
#define YY_SKIP_YYWRAP
+
+
+ +

Definition at line 217 of file lex.yy.h.

+ +
+
+ +
+
+ + + + +
#define YY_START_STACK_INCR   25
+
+
+ +

Definition at line 306 of file lex.yy.h.

+ +
+
+ +
+
+ + + + +
#define YY_STRUCT_YY_BUFFER_STATE
+
+
+ +

Definition at line 148 of file lex.yy.h.

+ +
+
+ +
+
+ + + + +
#define YY_TYPEDEF_YY_BUFFER_STATE
+
+
+ +

Definition at line 138 of file lex.yy.h.

+ +
+
+ +
+
+ + + + +
#define YY_TYPEDEF_YY_SCANNER_T
+
+
+ +

Definition at line 117 of file lex.yy.h.

+ +
+
+ +
+
+ + + + +
#define YY_TYPEDEF_YY_SIZE_T
+
+
+ +

Definition at line 143 of file lex.yy.h.

+ +
+
+ +
+
+ + + + +
#define yycolumn   (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
+
+
+ +

Definition at line 129 of file lex.yy.h.

+ +
+
+ +
+
+ + + + +
#define yyconst
+
+
+ +

Definition at line 112 of file lex.yy.h.

+ +
+
+ +
+
+ + + + +
#define yyextra   yyg->yyextra_r
+
+
+ +

Definition at line 125 of file lex.yy.h.

+ +
+
+ +
+
+ + + + +
#define yyin   yyg->yyin_r
+
+
+ +

Definition at line 123 of file lex.yy.h.

+ +
+
+ +
+
+ + + + +
#define yyIN_HEADER   1
+
+
+ +

Definition at line 3 of file lex.yy.h.

+ +
+
+ +
+
+ + + + +
#define yyleng   yyg->yyleng_r
+
+
+ +

Definition at line 126 of file lex.yy.h.

+ +
+
+ +
+
+ + + + +
#define yylineno   (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
+
+
+ +

Definition at line 128 of file lex.yy.h.

+ +
+
+ +
+
+ + + + +
#define yyout   yyg->yyout_r
+
+
+ +

Definition at line 124 of file lex.yy.h.

+ +
+
+ +
+
+ + + + +
#define yytext   yyg->yytext_r
+
+
+ +

Definition at line 127 of file lex.yy.h.

+ +
+
+ +
+
+ + + + +
#define yytext_ptr   yytext_r
+
+
+ +

Definition at line 219 of file lex.yy.h.

+ +
+
+ +
+
+ + + + + + + + +
#define yywrap( n)   1
+
+
+ +

Definition at line 216 of file lex.yy.h.

+ +
+
+

Typedef Documentation

+ +
+
+ + + + +
typedef short int flex_int16_t
+
+
+ +

Definition at line 56 of file lex.yy.h.

+ +
+
+ +
+
+ + + + +
typedef int flex_int32_t
+
+
+ +

Definition at line 57 of file lex.yy.h.

+ +
+
+ +
+
+ + + + +
typedef signed char flex_int8_t
+
+
+ +

Definition at line 55 of file lex.yy.h.

+ +
+
+ +
+
+ + + + +
typedef unsigned short int flex_uint16_t
+
+
+ +

Definition at line 59 of file lex.yy.h.

+ +
+
+ +
+
+ + + + +
typedef unsigned int flex_uint32_t
+
+
+ +

Definition at line 60 of file lex.yy.h.

+ +
+
+ +
+
+ + + + +
typedef unsigned char flex_uint8_t
+
+
+ +

Definition at line 58 of file lex.yy.h.

+ +
+
+ +
+
+ + + + +
typedef struct yy_buffer_state* YY_BUFFER_STATE
+
+
+ +

Definition at line 139 of file lex.yy.h.

+ +
+
+ +
+
+ + + + +
typedef size_t yy_size_t
+
+
+ +

Definition at line 144 of file lex.yy.h.

+ +
+
+ +
+
+ + + + +
typedef void* yyscan_t
+
+
+ +

Definition at line 118 of file lex.yy.h.

+ +
+
+

Function Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
YY_BUFFER_STATE yy_create_buffer (FILE * file,
int size,
yyscan_t yyscanner 
)
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void yy_delete_buffer (YY_BUFFER_STATE b,
yyscan_t yyscanner 
)
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void yy_flush_buffer (YY_BUFFER_STATE b,
yyscan_t yyscanner 
)
+
+
+

Discard all buffered characters. On the next scan, YY_INPUT will be called.

+
Parameters:
+ + + +
bthe buffer state to be flushed, usually YY_CURRENT_BUFFER.
yyscannerThe scanner object.
+
+
+ +

Definition at line 1497 of file lex.yy.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
YY_BUFFER_STATE yy_scan_buffer (char * base,
yy_size_t size,
yyscan_t yyscanner 
)
+
+
+

Setup the input buffer state to scan directly from a user-specified character buffer.

+
Parameters:
+ + + + +
basethe character buffer
sizethe size in bytes of the character buffer
yyscannerThe scanner object.
+
+
+
Returns:
the newly allocated buffer state object.
+ +

Definition at line 1628 of file lex.yy.c.

+ +

+Here is the call graph for this function:
+
+
+ + +
+

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
YY_BUFFER_STATE yy_scan_bytes (yyconst char * bytes,
int len,
yyscan_t yyscanner 
)
+
+
+

Setup the input buffer state to scan the given bytes. The next call to yylex() will scan from a copy of bytes.

+
Parameters:
+ + + + +
bytesthe byte buffer to scan
lenthe number of bytes in the buffer pointed to by bytes.
yyscannerThe scanner object.
+
+
+
Returns:
the newly allocated buffer state object.
+ +

Definition at line 1678 of file lex.yy.c.

+ +

+Here is the call graph for this function:
+
+
+ + +
+

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
YY_BUFFER_STATE yy_scan_string (yyconst char * yy_str,
yyscan_t yyscanner 
)
+
+
+

Setup the input buffer state to scan a string. The next call to yylex() will scan from a copy of str.

+
Parameters:
+ + + +
yystra NUL-terminated string to scan
yyscannerThe scanner object.
+
+
+
Returns:
the newly allocated buffer state object.
+
Note:
If you want to scan bytes that may contain NUL values, then use yy_scan_bytes() instead.
+ +

Definition at line 1665 of file lex.yy.c.

+ +

+Here is the call graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer,
yyscan_t yyscanner 
)
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void* yyalloc (yy_size_t ,
yyscan_t yyscanner 
)
+
+
+ +

Definition at line 2044 of file lex.yy.c.

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void yyfree (void * ,
yyscan_t yyscanner 
)
+
+
+ +

Definition at line 2061 of file lex.yy.c.

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + +
int yyget_debug (yyscan_t yyscanner)
+
+
+ +

Definition at line 1867 of file lex.yy.c.

+ +
+
+ +
+
+ + + + + + + + +
YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner)
+
+
+

Get the user-defined data for this scanner.

+
Parameters:
+ + +
yyscannerThe scanner object.
+
+
+ +

Definition at line 1740 of file lex.yy.c.

+ +
+
+ +
+
+ + + + + + + + +
FILE* yyget_in (yyscan_t yyscanner)
+
+
+

Get the input stream.

+
Parameters:
+ + +
yyscannerThe scanner object.
+
+
+ +

Definition at line 1775 of file lex.yy.c.

+ +
+
+ +
+
+ + + + + + + + +
int yyget_leng (yyscan_t yyscanner)
+
+
+

Get the length of the current token.

+
Parameters:
+ + +
yyscannerThe scanner object.
+
+
+ +

Definition at line 1793 of file lex.yy.c.

+ +
+
+ +
+
+ + + + + + + + +
int yyget_lineno (yyscan_t yyscanner)
+
+
+

Get the current line number.

+
Parameters:
+ + +
yyscannerThe scanner object.
+
+
+ +

Definition at line 1749 of file lex.yy.c.

+ +
+
+ +
+
+ + + + + + + + +
YYSTYPE* yyget_lval (yyscan_t yyscanner)
+
+
+ +

Definition at line 1881 of file lex.yy.c.

+ +
+
+ +
+
+ + + + + + + + +
FILE* yyget_out (yyscan_t yyscanner)
+
+
+

Get the output stream.

+
Parameters:
+ + +
yyscannerThe scanner object.
+
+
+ +

Definition at line 1784 of file lex.yy.c.

+ +
+
+ +
+
+ + + + + + + + +
char* yyget_text (yyscan_t yyscanner)
+
+
+

Get the current token.

+
Parameters:
+ + +
yyscannerThe scanner object.
+
+
+ +

Definition at line 1803 of file lex.yy.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
int yylex (YYSTYPEyylval_param,
yyscan_t yyscanner 
)
+
+
+ +
+
+ +
+
+ + + + + + + + +
int yylex_destroy (yyscan_t yyscanner)
+
+
+ +

Definition at line 1991 of file lex.yy.c.

+ +

+Here is the call graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + +
int yylex_init (yyscan_tscanner)
+
+
+ +

Definition at line 1900 of file lex.yy.c.

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
int yylex_init_extra (YY_EXTRA_TYPE user_defined,
yyscan_tscanner 
)
+
+
+ +

Definition at line 1929 of file lex.yy.c.

+ +

+Here is the call graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + +
void yypop_buffer_state (yyscan_t yyscanner)
+
+
+

Removes and deletes the top of the stack, if present. The next element becomes the new top.

+
Parameters:
+ + +
yyscannerThe scanner object.
+
+
+ +

Definition at line 1558 of file lex.yy.c.

+ +

+Here is the call graph for this function:
+
+
+ + +
+

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void yypush_buffer_state (YY_BUFFER_STATE new_buffer,
yyscan_t yyscanner 
)
+
+
+

Pushes the new state onto the stack. The new state becomes the current state. This function will allocate the stack if necessary.

+
Parameters:
+ + + +
new_bufferThe new state.
yyscannerThe scanner object.
+
+
+ +

Definition at line 1527 of file lex.yy.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
void* yyrealloc (void * ,
yy_size_t ,
yyscan_t yyscanner 
)
+
+
+ +

Definition at line 2049 of file lex.yy.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void yyrestart (FILE * input_file,
yyscan_t yyscanner 
)
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void yyset_debug (int debug_flag,
yyscan_t yyscanner 
)
+
+
+ +

Definition at line 1873 of file lex.yy.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void yyset_extra (YY_EXTRA_TYPE user_defined,
yyscan_t yyscanner 
)
+
+
+

Set the user-defined data. This data is never touched by the scanner.

+
Parameters:
+ + + +
user_definedThe data to be associated with this scanner.
yyscannerThe scanner object.
+
+
+ +

Definition at line 1813 of file lex.yy.c.

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void yyset_in (FILE * in_str,
yyscan_t yyscanner 
)
+
+
+

Set the input stream. This does not discard the current input buffer.

+
Parameters:
+ + + +
in_strA readable stream.
yyscannerThe scanner object.
+
+
+
See also:
yy_switch_to_buffer
+ +

Definition at line 1855 of file lex.yy.c.

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void yyset_lineno (int line_number,
yyscan_t yyscanner 
)
+
+
+

Set the current line number.

+
Parameters:
+ + + +
line_number
yyscannerThe scanner object.
+
+
+ +

Definition at line 1823 of file lex.yy.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void yyset_lval (YYSTYPEyylval_param,
yyscan_t yyscanner 
)
+
+
+ +

Definition at line 1887 of file lex.yy.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void yyset_out (FILE * out_str,
yyscan_t yyscanner 
)
+
+
+ +

Definition at line 1861 of file lex.yy.c.

+ +
+
+ +
+
+ + + + + + + + +
int yywrap (yyscan_t yyscanner)
+
+
+ +
+
+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/lex_8yy_8h__incl.map b/flex-bison/mark1/docs/html/lex_8yy_8h__incl.map new file mode 100644 index 0000000..8be6a30 --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8h__incl.map @@ -0,0 +1,2 @@ + + diff --git a/flex-bison/mark1/docs/html/lex_8yy_8h__incl.md5 b/flex-bison/mark1/docs/html/lex_8yy_8h__incl.md5 new file mode 100644 index 0000000..c6fd9dc --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8h__incl.md5 @@ -0,0 +1 @@ +986305c3b17cb1e1a55ce324367fc056 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/lex_8yy_8h__incl.png b/flex-bison/mark1/docs/html/lex_8yy_8h__incl.png new file mode 100644 index 0000000..79ae86a Binary files /dev/null and b/flex-bison/mark1/docs/html/lex_8yy_8h__incl.png differ diff --git a/flex-bison/mark1/docs/html/lex_8yy_8h_a1c76c5a3bf3778ab371e3022a3b6b95d_cgraph.map b/flex-bison/mark1/docs/html/lex_8yy_8h_a1c76c5a3bf3778ab371e3022a3b6b95d_cgraph.map new file mode 100644 index 0000000..5baaa66 --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8h_a1c76c5a3bf3778ab371e3022a3b6b95d_cgraph.map @@ -0,0 +1,6 @@ + + + + + + diff --git a/flex-bison/mark1/docs/html/lex_8yy_8h_a1c76c5a3bf3778ab371e3022a3b6b95d_cgraph.md5 b/flex-bison/mark1/docs/html/lex_8yy_8h_a1c76c5a3bf3778ab371e3022a3b6b95d_cgraph.md5 new file mode 100644 index 0000000..9a3c008 --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8h_a1c76c5a3bf3778ab371e3022a3b6b95d_cgraph.md5 @@ -0,0 +1 @@ +bae8360fa97731b4ff2cd634e9c125d9 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/lex_8yy_8h_a1c76c5a3bf3778ab371e3022a3b6b95d_cgraph.png b/flex-bison/mark1/docs/html/lex_8yy_8h_a1c76c5a3bf3778ab371e3022a3b6b95d_cgraph.png new file mode 100644 index 0000000..f03a93e Binary files /dev/null and b/flex-bison/mark1/docs/html/lex_8yy_8h_a1c76c5a3bf3778ab371e3022a3b6b95d_cgraph.png differ diff --git a/flex-bison/mark1/docs/html/lex_8yy_8h_a6d4d9baf5ca416f7f4028dc309aeaa02_cgraph.map b/flex-bison/mark1/docs/html/lex_8yy_8h_a6d4d9baf5ca416f7f4028dc309aeaa02_cgraph.map new file mode 100644 index 0000000..a5524c1 --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8h_a6d4d9baf5ca416f7f4028dc309aeaa02_cgraph.map @@ -0,0 +1,3 @@ + + + diff --git a/flex-bison/mark1/docs/html/lex_8yy_8h_a6d4d9baf5ca416f7f4028dc309aeaa02_cgraph.md5 b/flex-bison/mark1/docs/html/lex_8yy_8h_a6d4d9baf5ca416f7f4028dc309aeaa02_cgraph.md5 new file mode 100644 index 0000000..6984f86 --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8h_a6d4d9baf5ca416f7f4028dc309aeaa02_cgraph.md5 @@ -0,0 +1 @@ +f12f9f4865008caa8d17376f87dc2dbf \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/lex_8yy_8h_a6d4d9baf5ca416f7f4028dc309aeaa02_cgraph.png b/flex-bison/mark1/docs/html/lex_8yy_8h_a6d4d9baf5ca416f7f4028dc309aeaa02_cgraph.png new file mode 100644 index 0000000..4ea5b74 Binary files /dev/null and b/flex-bison/mark1/docs/html/lex_8yy_8h_a6d4d9baf5ca416f7f4028dc309aeaa02_cgraph.png differ diff --git a/flex-bison/mark1/docs/html/lex_8yy_8h_a878e1d6fe61658bf7d1c34a366989079_cgraph.map b/flex-bison/mark1/docs/html/lex_8yy_8h_a878e1d6fe61658bf7d1c34a366989079_cgraph.map new file mode 100644 index 0000000..639ab2b --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8h_a878e1d6fe61658bf7d1c34a366989079_cgraph.map @@ -0,0 +1,3 @@ + + + diff --git a/flex-bison/mark1/docs/html/lex_8yy_8h_a878e1d6fe61658bf7d1c34a366989079_cgraph.md5 b/flex-bison/mark1/docs/html/lex_8yy_8h_a878e1d6fe61658bf7d1c34a366989079_cgraph.md5 new file mode 100644 index 0000000..3899676 --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8h_a878e1d6fe61658bf7d1c34a366989079_cgraph.md5 @@ -0,0 +1 @@ +b6243c611e5ab373eba96d2775925a50 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/lex_8yy_8h_a878e1d6fe61658bf7d1c34a366989079_cgraph.png b/flex-bison/mark1/docs/html/lex_8yy_8h_a878e1d6fe61658bf7d1c34a366989079_cgraph.png new file mode 100644 index 0000000..d7d40f0 Binary files /dev/null and b/flex-bison/mark1/docs/html/lex_8yy_8h_a878e1d6fe61658bf7d1c34a366989079_cgraph.png differ diff --git a/flex-bison/mark1/docs/html/lex_8yy_8h_a878e1d6fe61658bf7d1c34a366989079_icgraph.map b/flex-bison/mark1/docs/html/lex_8yy_8h_a878e1d6fe61658bf7d1c34a366989079_icgraph.map new file mode 100644 index 0000000..c35e54b --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8h_a878e1d6fe61658bf7d1c34a366989079_icgraph.map @@ -0,0 +1,3 @@ + + + diff --git a/flex-bison/mark1/docs/html/lex_8yy_8h_a878e1d6fe61658bf7d1c34a366989079_icgraph.md5 b/flex-bison/mark1/docs/html/lex_8yy_8h_a878e1d6fe61658bf7d1c34a366989079_icgraph.md5 new file mode 100644 index 0000000..1e9c9c5 --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8h_a878e1d6fe61658bf7d1c34a366989079_icgraph.md5 @@ -0,0 +1 @@ +b04954071b4ab3f6cbf6d308ac1f868f \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/lex_8yy_8h_a878e1d6fe61658bf7d1c34a366989079_icgraph.png b/flex-bison/mark1/docs/html/lex_8yy_8h_a878e1d6fe61658bf7d1c34a366989079_icgraph.png new file mode 100644 index 0000000..abafdda Binary files /dev/null and b/flex-bison/mark1/docs/html/lex_8yy_8h_a878e1d6fe61658bf7d1c34a366989079_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/lex_8yy_8h_a8ed916a3de3e1c01305e55cef415ba1e_icgraph.map b/flex-bison/mark1/docs/html/lex_8yy_8h_a8ed916a3de3e1c01305e55cef415ba1e_icgraph.map new file mode 100644 index 0000000..048bd63 --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8h_a8ed916a3de3e1c01305e55cef415ba1e_icgraph.map @@ -0,0 +1,6 @@ + + + + + + diff --git a/flex-bison/mark1/docs/html/lex_8yy_8h_a8ed916a3de3e1c01305e55cef415ba1e_icgraph.md5 b/flex-bison/mark1/docs/html/lex_8yy_8h_a8ed916a3de3e1c01305e55cef415ba1e_icgraph.md5 new file mode 100644 index 0000000..9f1d38e --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8h_a8ed916a3de3e1c01305e55cef415ba1e_icgraph.md5 @@ -0,0 +1 @@ +0799e3d3ff276ad7247b59757a115861 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/lex_8yy_8h_a8ed916a3de3e1c01305e55cef415ba1e_icgraph.png b/flex-bison/mark1/docs/html/lex_8yy_8h_a8ed916a3de3e1c01305e55cef415ba1e_icgraph.png new file mode 100644 index 0000000..8f50dad Binary files /dev/null and b/flex-bison/mark1/docs/html/lex_8yy_8h_a8ed916a3de3e1c01305e55cef415ba1e_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/lex_8yy_8h_a90d20294722d171c4bf004fda3cd9403_icgraph.map b/flex-bison/mark1/docs/html/lex_8yy_8h_a90d20294722d171c4bf004fda3cd9403_icgraph.map new file mode 100644 index 0000000..d57dab1 --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8h_a90d20294722d171c4bf004fda3cd9403_icgraph.map @@ -0,0 +1,3 @@ + + + diff --git a/flex-bison/mark1/docs/html/lex_8yy_8h_a90d20294722d171c4bf004fda3cd9403_icgraph.md5 b/flex-bison/mark1/docs/html/lex_8yy_8h_a90d20294722d171c4bf004fda3cd9403_icgraph.md5 new file mode 100644 index 0000000..c0995c5 --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8h_a90d20294722d171c4bf004fda3cd9403_icgraph.md5 @@ -0,0 +1 @@ +9d3182003bdc5e3eb41a039914eb9396 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/lex_8yy_8h_a90d20294722d171c4bf004fda3cd9403_icgraph.png b/flex-bison/mark1/docs/html/lex_8yy_8h_a90d20294722d171c4bf004fda3cd9403_icgraph.png new file mode 100644 index 0000000..5d98b71 Binary files /dev/null and b/flex-bison/mark1/docs/html/lex_8yy_8h_a90d20294722d171c4bf004fda3cd9403_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/lex_8yy_8h_a9660b57f0bd852377eadbd84dc9df68b_cgraph.map b/flex-bison/mark1/docs/html/lex_8yy_8h_a9660b57f0bd852377eadbd84dc9df68b_cgraph.map new file mode 100644 index 0000000..3ca71c9 --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8h_a9660b57f0bd852377eadbd84dc9df68b_cgraph.map @@ -0,0 +1,4 @@ + + + + diff --git a/flex-bison/mark1/docs/html/lex_8yy_8h_a9660b57f0bd852377eadbd84dc9df68b_cgraph.md5 b/flex-bison/mark1/docs/html/lex_8yy_8h_a9660b57f0bd852377eadbd84dc9df68b_cgraph.md5 new file mode 100644 index 0000000..99c306a --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8h_a9660b57f0bd852377eadbd84dc9df68b_cgraph.md5 @@ -0,0 +1 @@ +121dc6d85f2224b2549a699400b53c4c \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/lex_8yy_8h_a9660b57f0bd852377eadbd84dc9df68b_cgraph.png b/flex-bison/mark1/docs/html/lex_8yy_8h_a9660b57f0bd852377eadbd84dc9df68b_cgraph.png new file mode 100644 index 0000000..93fd8e2 Binary files /dev/null and b/flex-bison/mark1/docs/html/lex_8yy_8h_a9660b57f0bd852377eadbd84dc9df68b_cgraph.png differ diff --git a/flex-bison/mark1/docs/html/lex_8yy_8h_a9660b57f0bd852377eadbd84dc9df68b_icgraph.map b/flex-bison/mark1/docs/html/lex_8yy_8h_a9660b57f0bd852377eadbd84dc9df68b_icgraph.map new file mode 100644 index 0000000..89f6f73 --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8h_a9660b57f0bd852377eadbd84dc9df68b_icgraph.map @@ -0,0 +1,4 @@ + + + + diff --git a/flex-bison/mark1/docs/html/lex_8yy_8h_a9660b57f0bd852377eadbd84dc9df68b_icgraph.md5 b/flex-bison/mark1/docs/html/lex_8yy_8h_a9660b57f0bd852377eadbd84dc9df68b_icgraph.md5 new file mode 100644 index 0000000..d15b2b5 --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8h_a9660b57f0bd852377eadbd84dc9df68b_icgraph.md5 @@ -0,0 +1 @@ +db1b7393f99c0db2ea9f0bb0d4cb16a1 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/lex_8yy_8h_a9660b57f0bd852377eadbd84dc9df68b_icgraph.png b/flex-bison/mark1/docs/html/lex_8yy_8h_a9660b57f0bd852377eadbd84dc9df68b_icgraph.png new file mode 100644 index 0000000..fee5ff1 Binary files /dev/null and b/flex-bison/mark1/docs/html/lex_8yy_8h_a9660b57f0bd852377eadbd84dc9df68b_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/lex_8yy_8h_a9b71d87d640fa8c946c70204acc3fb50_icgraph.map b/flex-bison/mark1/docs/html/lex_8yy_8h_a9b71d87d640fa8c946c70204acc3fb50_icgraph.map new file mode 100644 index 0000000..6053de5 --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8h_a9b71d87d640fa8c946c70204acc3fb50_icgraph.map @@ -0,0 +1,5 @@ + + + + + diff --git a/flex-bison/mark1/docs/html/lex_8yy_8h_a9b71d87d640fa8c946c70204acc3fb50_icgraph.md5 b/flex-bison/mark1/docs/html/lex_8yy_8h_a9b71d87d640fa8c946c70204acc3fb50_icgraph.md5 new file mode 100644 index 0000000..569c103 --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8h_a9b71d87d640fa8c946c70204acc3fb50_icgraph.md5 @@ -0,0 +1 @@ +27560625953bb7ab6e3350bd57e911e9 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/lex_8yy_8h_a9b71d87d640fa8c946c70204acc3fb50_icgraph.png b/flex-bison/mark1/docs/html/lex_8yy_8h_a9b71d87d640fa8c946c70204acc3fb50_icgraph.png new file mode 100644 index 0000000..c2ff7b3 Binary files /dev/null and b/flex-bison/mark1/docs/html/lex_8yy_8h_a9b71d87d640fa8c946c70204acc3fb50_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/lex_8yy_8h_aa8eea774d26ff452d9bfccd90101f794_cgraph.map b/flex-bison/mark1/docs/html/lex_8yy_8h_aa8eea774d26ff452d9bfccd90101f794_cgraph.map new file mode 100644 index 0000000..5e38650 --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8h_aa8eea774d26ff452d9bfccd90101f794_cgraph.map @@ -0,0 +1,5 @@ + + + + + diff --git a/flex-bison/mark1/docs/html/lex_8yy_8h_aa8eea774d26ff452d9bfccd90101f794_cgraph.md5 b/flex-bison/mark1/docs/html/lex_8yy_8h_aa8eea774d26ff452d9bfccd90101f794_cgraph.md5 new file mode 100644 index 0000000..d2810f9 --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8h_aa8eea774d26ff452d9bfccd90101f794_cgraph.md5 @@ -0,0 +1 @@ +0d88846ac49e6e939e3691901c819d0b \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/lex_8yy_8h_aa8eea774d26ff452d9bfccd90101f794_cgraph.png b/flex-bison/mark1/docs/html/lex_8yy_8h_aa8eea774d26ff452d9bfccd90101f794_cgraph.png new file mode 100644 index 0000000..97b6a6a Binary files /dev/null and b/flex-bison/mark1/docs/html/lex_8yy_8h_aa8eea774d26ff452d9bfccd90101f794_cgraph.png differ diff --git a/flex-bison/mark1/docs/html/lex_8yy_8h_aa8eea774d26ff452d9bfccd90101f794_icgraph.map b/flex-bison/mark1/docs/html/lex_8yy_8h_aa8eea774d26ff452d9bfccd90101f794_icgraph.map new file mode 100644 index 0000000..c5829ca --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8h_aa8eea774d26ff452d9bfccd90101f794_icgraph.map @@ -0,0 +1,3 @@ + + + diff --git a/flex-bison/mark1/docs/html/lex_8yy_8h_aa8eea774d26ff452d9bfccd90101f794_icgraph.md5 b/flex-bison/mark1/docs/html/lex_8yy_8h_aa8eea774d26ff452d9bfccd90101f794_icgraph.md5 new file mode 100644 index 0000000..5eafb82 --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8h_aa8eea774d26ff452d9bfccd90101f794_icgraph.md5 @@ -0,0 +1 @@ +f664c11062df09178698dd6915475f30 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/lex_8yy_8h_aa8eea774d26ff452d9bfccd90101f794_icgraph.png b/flex-bison/mark1/docs/html/lex_8yy_8h_aa8eea774d26ff452d9bfccd90101f794_icgraph.png new file mode 100644 index 0000000..51f3586 Binary files /dev/null and b/flex-bison/mark1/docs/html/lex_8yy_8h_aa8eea774d26ff452d9bfccd90101f794_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/lex_8yy_8h_aaea60d8102c2afdd7d8e07bc43c530c3_cgraph.map b/flex-bison/mark1/docs/html/lex_8yy_8h_aaea60d8102c2afdd7d8e07bc43c530c3_cgraph.map new file mode 100644 index 0000000..94a085b --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8h_aaea60d8102c2afdd7d8e07bc43c530c3_cgraph.map @@ -0,0 +1,5 @@ + + + + + diff --git a/flex-bison/mark1/docs/html/lex_8yy_8h_aaea60d8102c2afdd7d8e07bc43c530c3_cgraph.md5 b/flex-bison/mark1/docs/html/lex_8yy_8h_aaea60d8102c2afdd7d8e07bc43c530c3_cgraph.md5 new file mode 100644 index 0000000..05a8be6 --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8h_aaea60d8102c2afdd7d8e07bc43c530c3_cgraph.md5 @@ -0,0 +1 @@ +8faa84ef9335fe1c24200bbf3c0af641 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/lex_8yy_8h_aaea60d8102c2afdd7d8e07bc43c530c3_cgraph.png b/flex-bison/mark1/docs/html/lex_8yy_8h_aaea60d8102c2afdd7d8e07bc43c530c3_cgraph.png new file mode 100644 index 0000000..948958a Binary files /dev/null and b/flex-bison/mark1/docs/html/lex_8yy_8h_aaea60d8102c2afdd7d8e07bc43c530c3_cgraph.png differ diff --git a/flex-bison/mark1/docs/html/lex_8yy_8h_ace3a0458b901e4a503a33b6411ef5fa1_icgraph.map b/flex-bison/mark1/docs/html/lex_8yy_8h_ace3a0458b901e4a503a33b6411ef5fa1_icgraph.map new file mode 100644 index 0000000..18094ec --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8h_ace3a0458b901e4a503a33b6411ef5fa1_icgraph.map @@ -0,0 +1,3 @@ + + + diff --git a/flex-bison/mark1/docs/html/lex_8yy_8h_ace3a0458b901e4a503a33b6411ef5fa1_icgraph.md5 b/flex-bison/mark1/docs/html/lex_8yy_8h_ace3a0458b901e4a503a33b6411ef5fa1_icgraph.md5 new file mode 100644 index 0000000..10385f2 --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8h_ace3a0458b901e4a503a33b6411ef5fa1_icgraph.md5 @@ -0,0 +1 @@ +61f95f7cc3b957acb0c5093746309d9c \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/lex_8yy_8h_ace3a0458b901e4a503a33b6411ef5fa1_icgraph.png b/flex-bison/mark1/docs/html/lex_8yy_8h_ace3a0458b901e4a503a33b6411ef5fa1_icgraph.png new file mode 100644 index 0000000..511d1f8 Binary files /dev/null and b/flex-bison/mark1/docs/html/lex_8yy_8h_ace3a0458b901e4a503a33b6411ef5fa1_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/lex_8yy_8h_afbcda44be0f721a1c8f2f280aabb74f6_icgraph.map b/flex-bison/mark1/docs/html/lex_8yy_8h_afbcda44be0f721a1c8f2f280aabb74f6_icgraph.map new file mode 100644 index 0000000..618a73f --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8h_afbcda44be0f721a1c8f2f280aabb74f6_icgraph.map @@ -0,0 +1,5 @@ + + + + + diff --git a/flex-bison/mark1/docs/html/lex_8yy_8h_afbcda44be0f721a1c8f2f280aabb74f6_icgraph.md5 b/flex-bison/mark1/docs/html/lex_8yy_8h_afbcda44be0f721a1c8f2f280aabb74f6_icgraph.md5 new file mode 100644 index 0000000..f6aab9e --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8h_afbcda44be0f721a1c8f2f280aabb74f6_icgraph.md5 @@ -0,0 +1 @@ +d3f1c922b94186f67d20f3b8df9fb1f3 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/lex_8yy_8h_afbcda44be0f721a1c8f2f280aabb74f6_icgraph.png b/flex-bison/mark1/docs/html/lex_8yy_8h_afbcda44be0f721a1c8f2f280aabb74f6_icgraph.png new file mode 100644 index 0000000..f20c123 Binary files /dev/null and b/flex-bison/mark1/docs/html/lex_8yy_8h_afbcda44be0f721a1c8f2f280aabb74f6_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/lex_8yy_8h_source.html b/flex-bison/mark1/docs/html/lex_8yy_8h_source.html new file mode 100644 index 0000000..741d724 --- /dev/null +++ b/flex-bison/mark1/docs/html/lex_8yy_8h_source.html @@ -0,0 +1,450 @@ + + + + +Mark1: src/parser/lexer/lex.yy.h Source File + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + +
+
+ +
+
+
+ +
+
+
+

src/parser/lexer/lex.yy.h

+
+
+Go to the documentation of this file.
00001 #ifndef yyHEADER_H
+00002 #define yyHEADER_H 1
+00003 #define yyIN_HEADER 1
+00004 
+00005 #line 6 "src/parser/lexer/lex.yy.h"
+00006 
+00007 #line 8 "src/parser/lexer/lex.yy.h"
+00008 
+00009 #define  YY_INT_ALIGNED short int
+00010 
+00011 /* A lexical scanner generated by flex */
+00012 
+00013 #define FLEX_SCANNER
+00014 #define YY_FLEX_MAJOR_VERSION 2
+00015 #define YY_FLEX_MINOR_VERSION 5
+00016 #define YY_FLEX_SUBMINOR_VERSION 35
+00017 #if YY_FLEX_SUBMINOR_VERSION > 0
+00018 #define FLEX_BETA
+00019 #endif
+00020 
+00021 /* First, we deal with  platform-specific or compiler-specific issues. */
+00022 
+00023 /* begin standard C headers. */
+00024 #include <stdio.h>
+00025 #include <string.h>
+00026 #include <errno.h>
+00027 #include <stdlib.h>
+00028 
+00029 /* end standard C headers. */
+00030 
+00031 /* flex integer type definitions */
+00032 
+00033 #ifndef FLEXINT_H
+00034 #define FLEXINT_H
+00035 
+00036 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
+00037 
+00038 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+00039 
+00040 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
+00041  * if you want the limit (max/min) macros for int types. 
+00042  */
+00043 #ifndef __STDC_LIMIT_MACROS
+00044 #define __STDC_LIMIT_MACROS 1
+00045 #endif
+00046 
+00047 #include <inttypes.h>
+00048 typedef int8_t flex_int8_t;
+00049 typedef uint8_t flex_uint8_t;
+00050 typedef int16_t flex_int16_t;
+00051 typedef uint16_t flex_uint16_t;
+00052 typedef int32_t flex_int32_t;
+00053 typedef uint32_t flex_uint32_t;
+00054 #else
+00055 typedef signed char flex_int8_t;
+00056 typedef short int flex_int16_t;
+00057 typedef int flex_int32_t;
+00058 typedef unsigned char flex_uint8_t; 
+00059 typedef unsigned short int flex_uint16_t;
+00060 typedef unsigned int flex_uint32_t;
+00061 #endif /* ! C99 */
+00062 
+00063 /* Limits of integral types. */
+00064 #ifndef INT8_MIN
+00065 #define INT8_MIN               (-128)
+00066 #endif
+00067 #ifndef INT16_MIN
+00068 #define INT16_MIN              (-32767-1)
+00069 #endif
+00070 #ifndef INT32_MIN
+00071 #define INT32_MIN              (-2147483647-1)
+00072 #endif
+00073 #ifndef INT8_MAX
+00074 #define INT8_MAX               (127)
+00075 #endif
+00076 #ifndef INT16_MAX
+00077 #define INT16_MAX              (32767)
+00078 #endif
+00079 #ifndef INT32_MAX
+00080 #define INT32_MAX              (2147483647)
+00081 #endif
+00082 #ifndef UINT8_MAX
+00083 #define UINT8_MAX              (255U)
+00084 #endif
+00085 #ifndef UINT16_MAX
+00086 #define UINT16_MAX             (65535U)
+00087 #endif
+00088 #ifndef UINT32_MAX
+00089 #define UINT32_MAX             (4294967295U)
+00090 #endif
+00091 
+00092 #endif /* ! FLEXINT_H */
+00093 
+00094 #ifdef __cplusplus
+00095 
+00096 /* The "const" storage-class-modifier is valid. */
+00097 #define YY_USE_CONST
+00098 
+00099 #else   /* ! __cplusplus */
+00100 
+00101 /* C99 requires __STDC__ to be defined as 1. */
+00102 #if defined (__STDC__)
+00103 
+00104 #define YY_USE_CONST
+00105 
+00106 #endif  /* defined (__STDC__) */
+00107 #endif  /* ! __cplusplus */
+00108 
+00109 #ifdef YY_USE_CONST
+00110 #define yyconst const
+00111 #else
+00112 #define yyconst
+00113 #endif
+00114 
+00115 /* An opaque pointer. */
+00116 #ifndef YY_TYPEDEF_YY_SCANNER_T
+00117 #define YY_TYPEDEF_YY_SCANNER_T
+00118 typedef void* yyscan_t;
+00119 #endif
+00120 
+00121 /* For convenience, these vars (plus the bison vars far below)
+00122    are macros in the reentrant scanner. */
+00123 #define yyin yyg->yyin_r
+00124 #define yyout yyg->yyout_r
+00125 #define yyextra yyg->yyextra_r
+00126 #define yyleng yyg->yyleng_r
+00127 #define yytext yyg->yytext_r
+00128 #define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
+00129 #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
+00130 #define yy_flex_debug yyg->yy_flex_debug_r
+00131 
+00132 /* Size of default input buffer. */
+00133 #ifndef YY_BUF_SIZE
+00134 #define YY_BUF_SIZE 16384
+00135 #endif
+00136 
+00137 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
+00138 #define YY_TYPEDEF_YY_BUFFER_STATE
+00139 typedef struct yy_buffer_state *YY_BUFFER_STATE;
+00140 #endif
+00141 
+00142 #ifndef YY_TYPEDEF_YY_SIZE_T
+00143 #define YY_TYPEDEF_YY_SIZE_T
+00144 typedef size_t yy_size_t;
+00145 #endif
+00146 
+00147 #ifndef YY_STRUCT_YY_BUFFER_STATE
+00148 #define YY_STRUCT_YY_BUFFER_STATE
+00149 struct yy_buffer_state
+00150         {
+00151         FILE *yy_input_file;
+00152 
+00153         char *yy_ch_buf;                /* input buffer */
+00154         char *yy_buf_pos;               /* current position in input buffer */
+00155 
+00156         /* Size of input buffer in bytes, not including room for EOB
+00157          * characters.
+00158          */
+00159         yy_size_t yy_buf_size;
+00160 
+00161         /* Number of characters read into yy_ch_buf, not including EOB
+00162          * characters.
+00163          */
+00164         int yy_n_chars;
+00165 
+00166         /* Whether we "own" the buffer - i.e., we know we created it,
+00167          * and can realloc() it to grow it, and should free() it to
+00168          * delete it.
+00169          */
+00170         int yy_is_our_buffer;
+00171 
+00172         /* Whether this is an "interactive" input source; if so, and
+00173          * if we're using stdio for input, then we want to use getc()
+00174          * instead of fread(), to make sure we stop fetching input after
+00175          * each newline.
+00176          */
+00177         int yy_is_interactive;
+00178 
+00179         /* Whether we're considered to be at the beginning of a line.
+00180          * If so, '^' rules will be active on the next match, otherwise
+00181          * not.
+00182          */
+00183         int yy_at_bol;
+00184 
+00185     int yy_bs_lineno; 
+00186     int yy_bs_column; 
+00188         /* Whether to try to fill the input buffer when we reach the
+00189          * end of it.
+00190          */
+00191         int yy_fill_buffer;
+00192 
+00193         int yy_buffer_status;
+00194 
+00195         };
+00196 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
+00197 
+00198 void yyrestart (FILE *input_file ,yyscan_t yyscanner );
+00199 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
+00200 YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner );
+00201 void yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
+00202 void yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
+00203 void yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
+00204 void yypop_buffer_state (yyscan_t yyscanner );
+00205 
+00206 YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
+00207 YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
+00208 YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner );
+00209 
+00210 void *yyalloc (yy_size_t ,yyscan_t yyscanner );
+00211 void *yyrealloc (void *,yy_size_t ,yyscan_t yyscanner );
+00212 void yyfree (void * ,yyscan_t yyscanner );
+00213 
+00214 /* Begin user sect3 */
+00215 
+00216 #define yywrap(n) 1
+00217 #define YY_SKIP_YYWRAP
+00218 
+00219 #define yytext_ptr yytext_r
+00220 
+00221 #ifdef YY_HEADER_EXPORT_START_CONDITIONS
+00222 #define INITIAL 0
+00223 
+00224 #endif
+00225 
+00226 #ifndef YY_NO_UNISTD_H
+00227 /* Special case for "unistd.h", since it is non-ANSI. We include it way
+00228  * down here because we want the user's section 1 to have been scanned first.
+00229  * The user has a chance to override it with an option.
+00230  */
+00231 #include <unistd.h>
+00232 #endif
+00233 
+00234 #ifndef YY_EXTRA_TYPE
+00235 #define YY_EXTRA_TYPE void *
+00236 #endif
+00237 
+00238 int yylex_init (yyscan_t* scanner);
+00239 
+00240 int yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
+00241 
+00242 /* Accessor methods to globals.
+00243    These are made visible to non-reentrant scanners for convenience. */
+00244 
+00245 int yylex_destroy (yyscan_t yyscanner );
+00246 
+00247 int yyget_debug (yyscan_t yyscanner );
+00248 
+00249 void yyset_debug (int debug_flag ,yyscan_t yyscanner );
+00250 
+00251 YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner );
+00252 
+00253 void yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
+00254 
+00255 FILE *yyget_in (yyscan_t yyscanner );
+00256 
+00257 void yyset_in  (FILE * in_str ,yyscan_t yyscanner );
+00258 
+00259 FILE *yyget_out (yyscan_t yyscanner );
+00260 
+00261 void yyset_out  (FILE * out_str ,yyscan_t yyscanner );
+00262 
+00263 int yyget_leng (yyscan_t yyscanner );
+00264 
+00265 char *yyget_text (yyscan_t yyscanner );
+00266 
+00267 int yyget_lineno (yyscan_t yyscanner );
+00268 
+00269 void yyset_lineno (int line_number ,yyscan_t yyscanner );
+00270 
+00271 YYSTYPE * yyget_lval (yyscan_t yyscanner );
+00272 
+00273 void yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
+00274 
+00275 /* Macros after this point can all be overridden by user definitions in
+00276  * section 1.
+00277  */
+00278 
+00279 #ifndef YY_SKIP_YYWRAP
+00280 #ifdef __cplusplus
+00281 extern "C" int yywrap (yyscan_t yyscanner );
+00282 #else
+00283 extern int yywrap (yyscan_t yyscanner );
+00284 #endif
+00285 #endif
+00286 
+00287 #ifndef yytext_ptr
+00288 static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
+00289 #endif
+00290 
+00291 #ifdef YY_NEED_STRLEN
+00292 static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
+00293 #endif
+00294 
+00295 #ifndef YY_NO_INPUT
+00296 
+00297 #endif
+00298 
+00299 /* Amount of stuff to slurp up with each read. */
+00300 #ifndef YY_READ_BUF_SIZE
+00301 #define YY_READ_BUF_SIZE 8192
+00302 #endif
+00303 
+00304 /* Number of entries by which start-condition stack grows. */
+00305 #ifndef YY_START_STACK_INCR
+00306 #define YY_START_STACK_INCR 25
+00307 #endif
+00308 
+00309 /* Default declaration of generated scanner - a define so the user can
+00310  * easily add parameters.
+00311  */
+00312 #ifndef YY_DECL
+00313 #define YY_DECL_IS_OURS 1
+00314 
+00315 extern int yylex \
+00316                (YYSTYPE * yylval_param ,yyscan_t yyscanner);
+00317 
+00318 #define YY_DECL int yylex \
+00319                (YYSTYPE * yylval_param , yyscan_t yyscanner)
+00320 #endif /* !YY_DECL */
+00321 
+00322 /* yy_get_previous_state - get the state just before the EOB char was reached */
+00323 
+00324 #undef YY_NEW_FILE
+00325 #undef YY_FLUSH_BUFFER
+00326 #undef yy_set_bol
+00327 #undef yy_new_buffer
+00328 #undef yy_set_interactive
+00329 #undef YY_DO_BEFORE_ACTION
+00330 
+00331 #ifdef YY_DECL_IS_OURS
+00332 #undef YY_DECL_IS_OURS
+00333 #undef YY_DECL
+00334 #endif
+00335 
+00336 #line 71 "src/parser/lexer/lexer.l"
+00337 
+00338 
+00339 #line 340 "src/parser/lexer/lex.yy.h"
+00340 #undef yyIN_HEADER
+00341 #endif /* yyHEADER_H */
+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/linked__list_8c.html b/flex-bison/mark1/docs/html/linked__list_8c.html new file mode 100644 index 0000000..aad05cc --- /dev/null +++ b/flex-bison/mark1/docs/html/linked__list_8c.html @@ -0,0 +1,480 @@ + + + + +Mark1: src/data_structures/linked_list/linked_list.c File Reference + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + +
+
+ +
+
+
+ +
+
+ +
+

src/data_structures/linked_list/linked_list.c File Reference

+
+
+
#include "linked_list.h"
+#include <stdlib.h>
+
+Include dependency graph for linked_list.c:
+
+
+ + +
+
+

Go to the source code of this file.

+ + + + + + + + + + + + + + + + +

+Functions

LinkedList_TLL_New (PTR_TYPE contents)
 Creates a new linked list node with the supplied value.
LinkedList_TLL_Last (LinkedList_T *list)
 Finds and returns the last node in the supplied linked list.
LinkedList_TLL_Get (LinkedList_T *list, int index)
 Return the node at the specified index in a linked list.
void LL_Add (LinkedList_T *list, PTR_TYPE contents)
 Adds a new node to an existing linked list.
LinkedList_TLL_Insert (LinkedList_T *list, int index, PTR_TYPE contents)
 Inserts a new node in a linked list at the specified index.
void LL_Delete (LinkedList_T *list, int index, BOOL free_contents)
 Deletes a node from the supplied list.
void LL_Free (LinkedList_T *list, BOOL free_contents)
 Frees all memory used by a linked list.
+

Function Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + +
void LL_Add (LinkedList_Tlist,
PTR_TYPE contents 
)
+
+
+ +

Adds a new node to an existing linked list.

+
Parameters:
+ + + +
list
contents
+
+
+ +

Definition at line 52 of file linked_list.c.

+ +

+Here is the call graph for this function:
+
+
+ + +
+

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
void LL_Delete (LinkedList_Tlist,
int index,
BOOL free_contents 
)
+
+
+ +

Deletes a node from the supplied list.

+

Deletes the node found at the supplied index from the supplied list and frees the memory used by the node and its contents.

+
Parameters:
+ + + + +
list
index
free_contentsWhether or not to also free the contents of the node.
+
+
+ +

Definition at line 74 of file linked_list.c.

+ +

+Here is the call graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void LL_Free (LinkedList_Tlist,
BOOL free_contents 
)
+
+
+ +

Frees all memory used by a linked list.

+

Loops through the supplied list and frees all nodes. Also frees contents if free_contents is passed TRUE. This is to avoid trying to free memory allocated on the stack.

+
Parameters:
+ + + +
listThe list to be freed.
free_contentsWhether or not to also free the contents of each node.
+
+
+ +

Definition at line 90 of file linked_list.c.

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
LinkedList_T* LL_Get (LinkedList_Tlist,
int index 
)
+
+
+ +

Return the node at the specified index in a linked list.

+

Loops through the linked list and returns the node in the list at the specified index. Returns NULL if the index is out of range.

+
Parameters:
+ + + +
listThe list to search for the supplied index.
indexThe index of the node to return.
+
+
+
Returns:
A pointer to the node and the supplied index, NULL if out of range.
+ +

Definition at line 33 of file linked_list.c.

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
LinkedList_T* LL_Insert (LinkedList_Tlist,
int index,
PTR_TYPE contents 
)
+
+
+ +

Inserts a new node in a linked list at the specified index.

+
Parameters:
+ + + + +
list
index
contents
+
+
+
Returns:
Pointer to the newly inserted node, NULL if index is out of range.
+ +

Definition at line 59 of file linked_list.c.

+ +

+Here is the call graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + +
LinkedList_T* LL_Last (LinkedList_Tlist)
+
+
+ +

Finds and returns the last node in the supplied linked list.

+
Parameters:
+ + +
listThe linked list to search.
+
+
+
Returns:
Pointer to the last node in the supplied list.
+ +

Definition at line 22 of file linked_list.c.

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + +
LinkedList_T* LL_New (PTR_TYPE contents)
+
+
+ +

Creates a new linked list node with the supplied value.

+

Allocates a new node on the heap and populates the node contents with the supplied contents pointer.

+
Parameters:
+ + +
contentsThe contents of the newly created node.
+
+
+
Returns:
A pointer to the newly created node.
+ +

Definition at line 13 of file linked_list.c.

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/linked__list_8c__incl.map b/flex-bison/mark1/docs/html/linked__list_8c__incl.map new file mode 100644 index 0000000..d43cdf5 --- /dev/null +++ b/flex-bison/mark1/docs/html/linked__list_8c__incl.map @@ -0,0 +1,3 @@ + + + diff --git a/flex-bison/mark1/docs/html/linked__list_8c__incl.md5 b/flex-bison/mark1/docs/html/linked__list_8c__incl.md5 new file mode 100644 index 0000000..5a0b5e5 --- /dev/null +++ b/flex-bison/mark1/docs/html/linked__list_8c__incl.md5 @@ -0,0 +1 @@ +57ac556ed5795104dfb5bc8178e294fa \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/linked__list_8c__incl.png b/flex-bison/mark1/docs/html/linked__list_8c__incl.png new file mode 100644 index 0000000..86fe125 Binary files /dev/null and b/flex-bison/mark1/docs/html/linked__list_8c__incl.png differ diff --git a/flex-bison/mark1/docs/html/linked__list_8c_a0a2d62002a2faacb71e05a5e67bd14e5_icgraph.map b/flex-bison/mark1/docs/html/linked__list_8c_a0a2d62002a2faacb71e05a5e67bd14e5_icgraph.map new file mode 100644 index 0000000..6d40758 --- /dev/null +++ b/flex-bison/mark1/docs/html/linked__list_8c_a0a2d62002a2faacb71e05a5e67bd14e5_icgraph.map @@ -0,0 +1,3 @@ + + + diff --git a/flex-bison/mark1/docs/html/linked__list_8c_a0a2d62002a2faacb71e05a5e67bd14e5_icgraph.md5 b/flex-bison/mark1/docs/html/linked__list_8c_a0a2d62002a2faacb71e05a5e67bd14e5_icgraph.md5 new file mode 100644 index 0000000..ca3900c --- /dev/null +++ b/flex-bison/mark1/docs/html/linked__list_8c_a0a2d62002a2faacb71e05a5e67bd14e5_icgraph.md5 @@ -0,0 +1 @@ +a925f4414c7c7bd27103f3f636779663 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/linked__list_8c_a0a2d62002a2faacb71e05a5e67bd14e5_icgraph.png b/flex-bison/mark1/docs/html/linked__list_8c_a0a2d62002a2faacb71e05a5e67bd14e5_icgraph.png new file mode 100644 index 0000000..e646381 Binary files /dev/null and b/flex-bison/mark1/docs/html/linked__list_8c_a0a2d62002a2faacb71e05a5e67bd14e5_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/linked__list_8c_a0aeddcbf480893000c0b307d1aae5bf9_cgraph.map b/flex-bison/mark1/docs/html/linked__list_8c_a0aeddcbf480893000c0b307d1aae5bf9_cgraph.map new file mode 100644 index 0000000..8416a15 --- /dev/null +++ b/flex-bison/mark1/docs/html/linked__list_8c_a0aeddcbf480893000c0b307d1aae5bf9_cgraph.map @@ -0,0 +1,4 @@ + + + + diff --git a/flex-bison/mark1/docs/html/linked__list_8c_a0aeddcbf480893000c0b307d1aae5bf9_cgraph.md5 b/flex-bison/mark1/docs/html/linked__list_8c_a0aeddcbf480893000c0b307d1aae5bf9_cgraph.md5 new file mode 100644 index 0000000..f3a53d0 --- /dev/null +++ b/flex-bison/mark1/docs/html/linked__list_8c_a0aeddcbf480893000c0b307d1aae5bf9_cgraph.md5 @@ -0,0 +1 @@ +2e52260791ca1c0c900d437831981662 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/linked__list_8c_a0aeddcbf480893000c0b307d1aae5bf9_cgraph.png b/flex-bison/mark1/docs/html/linked__list_8c_a0aeddcbf480893000c0b307d1aae5bf9_cgraph.png new file mode 100644 index 0000000..cda1310 Binary files /dev/null and b/flex-bison/mark1/docs/html/linked__list_8c_a0aeddcbf480893000c0b307d1aae5bf9_cgraph.png differ diff --git a/flex-bison/mark1/docs/html/linked__list_8c_a0aeddcbf480893000c0b307d1aae5bf9_icgraph.map b/flex-bison/mark1/docs/html/linked__list_8c_a0aeddcbf480893000c0b307d1aae5bf9_icgraph.map new file mode 100644 index 0000000..f10e535 --- /dev/null +++ b/flex-bison/mark1/docs/html/linked__list_8c_a0aeddcbf480893000c0b307d1aae5bf9_icgraph.map @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/flex-bison/mark1/docs/html/linked__list_8c_a0aeddcbf480893000c0b307d1aae5bf9_icgraph.md5 b/flex-bison/mark1/docs/html/linked__list_8c_a0aeddcbf480893000c0b307d1aae5bf9_icgraph.md5 new file mode 100644 index 0000000..fa1ce1b --- /dev/null +++ b/flex-bison/mark1/docs/html/linked__list_8c_a0aeddcbf480893000c0b307d1aae5bf9_icgraph.md5 @@ -0,0 +1 @@ +9f5b27e4a07ebc7864aeb1215783bbc6 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/linked__list_8c_a0aeddcbf480893000c0b307d1aae5bf9_icgraph.png b/flex-bison/mark1/docs/html/linked__list_8c_a0aeddcbf480893000c0b307d1aae5bf9_icgraph.png new file mode 100644 index 0000000..256297e Binary files /dev/null and b/flex-bison/mark1/docs/html/linked__list_8c_a0aeddcbf480893000c0b307d1aae5bf9_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/linked__list_8c_a2690e9b5c6cab736036211986c1eee8a_icgraph.map b/flex-bison/mark1/docs/html/linked__list_8c_a2690e9b5c6cab736036211986c1eee8a_icgraph.map new file mode 100644 index 0000000..888ae91 --- /dev/null +++ b/flex-bison/mark1/docs/html/linked__list_8c_a2690e9b5c6cab736036211986c1eee8a_icgraph.map @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/flex-bison/mark1/docs/html/linked__list_8c_a2690e9b5c6cab736036211986c1eee8a_icgraph.md5 b/flex-bison/mark1/docs/html/linked__list_8c_a2690e9b5c6cab736036211986c1eee8a_icgraph.md5 new file mode 100644 index 0000000..911ea25 --- /dev/null +++ b/flex-bison/mark1/docs/html/linked__list_8c_a2690e9b5c6cab736036211986c1eee8a_icgraph.md5 @@ -0,0 +1 @@ +e944ae3a04d9b25453cd3d5676c50a03 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/linked__list_8c_a2690e9b5c6cab736036211986c1eee8a_icgraph.png b/flex-bison/mark1/docs/html/linked__list_8c_a2690e9b5c6cab736036211986c1eee8a_icgraph.png new file mode 100644 index 0000000..26bac80 Binary files /dev/null and b/flex-bison/mark1/docs/html/linked__list_8c_a2690e9b5c6cab736036211986c1eee8a_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/linked__list_8c_a3b525e4de0ea5ccf72b6537a32208330_icgraph.map b/flex-bison/mark1/docs/html/linked__list_8c_a3b525e4de0ea5ccf72b6537a32208330_icgraph.map new file mode 100644 index 0000000..6c400c3 --- /dev/null +++ b/flex-bison/mark1/docs/html/linked__list_8c_a3b525e4de0ea5ccf72b6537a32208330_icgraph.map @@ -0,0 +1,4 @@ + + + + diff --git a/flex-bison/mark1/docs/html/linked__list_8c_a3b525e4de0ea5ccf72b6537a32208330_icgraph.md5 b/flex-bison/mark1/docs/html/linked__list_8c_a3b525e4de0ea5ccf72b6537a32208330_icgraph.md5 new file mode 100644 index 0000000..2b2fa4c --- /dev/null +++ b/flex-bison/mark1/docs/html/linked__list_8c_a3b525e4de0ea5ccf72b6537a32208330_icgraph.md5 @@ -0,0 +1 @@ +b5fa5655af882616e18c5fd7d82f6795 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/linked__list_8c_a3b525e4de0ea5ccf72b6537a32208330_icgraph.png b/flex-bison/mark1/docs/html/linked__list_8c_a3b525e4de0ea5ccf72b6537a32208330_icgraph.png new file mode 100644 index 0000000..1ef127c Binary files /dev/null and b/flex-bison/mark1/docs/html/linked__list_8c_a3b525e4de0ea5ccf72b6537a32208330_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/linked__list_8c_a532eb65119c59d03bef0e1d37709681b_icgraph.map b/flex-bison/mark1/docs/html/linked__list_8c_a532eb65119c59d03bef0e1d37709681b_icgraph.map new file mode 100644 index 0000000..d2a74df --- /dev/null +++ b/flex-bison/mark1/docs/html/linked__list_8c_a532eb65119c59d03bef0e1d37709681b_icgraph.map @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/flex-bison/mark1/docs/html/linked__list_8c_a532eb65119c59d03bef0e1d37709681b_icgraph.md5 b/flex-bison/mark1/docs/html/linked__list_8c_a532eb65119c59d03bef0e1d37709681b_icgraph.md5 new file mode 100644 index 0000000..fce4282 --- /dev/null +++ b/flex-bison/mark1/docs/html/linked__list_8c_a532eb65119c59d03bef0e1d37709681b_icgraph.md5 @@ -0,0 +1 @@ +8743fd2829e7e14d8b14e7f97ff20120 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/linked__list_8c_a532eb65119c59d03bef0e1d37709681b_icgraph.png b/flex-bison/mark1/docs/html/linked__list_8c_a532eb65119c59d03bef0e1d37709681b_icgraph.png new file mode 100644 index 0000000..5a65cbc Binary files /dev/null and b/flex-bison/mark1/docs/html/linked__list_8c_a532eb65119c59d03bef0e1d37709681b_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/linked__list_8c_a9dfb9859e31881e8d08f7d09abcfe24e_cgraph.map b/flex-bison/mark1/docs/html/linked__list_8c_a9dfb9859e31881e8d08f7d09abcfe24e_cgraph.map new file mode 100644 index 0000000..cc65197 --- /dev/null +++ b/flex-bison/mark1/docs/html/linked__list_8c_a9dfb9859e31881e8d08f7d09abcfe24e_cgraph.map @@ -0,0 +1,3 @@ + + + diff --git a/flex-bison/mark1/docs/html/linked__list_8c_a9dfb9859e31881e8d08f7d09abcfe24e_cgraph.md5 b/flex-bison/mark1/docs/html/linked__list_8c_a9dfb9859e31881e8d08f7d09abcfe24e_cgraph.md5 new file mode 100644 index 0000000..e2488d7 --- /dev/null +++ b/flex-bison/mark1/docs/html/linked__list_8c_a9dfb9859e31881e8d08f7d09abcfe24e_cgraph.md5 @@ -0,0 +1 @@ +c71524397b3357b03dde59e9246a1b94 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/linked__list_8c_a9dfb9859e31881e8d08f7d09abcfe24e_cgraph.png b/flex-bison/mark1/docs/html/linked__list_8c_a9dfb9859e31881e8d08f7d09abcfe24e_cgraph.png new file mode 100644 index 0000000..889ab70 Binary files /dev/null and b/flex-bison/mark1/docs/html/linked__list_8c_a9dfb9859e31881e8d08f7d09abcfe24e_cgraph.png differ diff --git a/flex-bison/mark1/docs/html/linked__list_8c_ae6c3771fc65df2892b41d6f494df5676_cgraph.map b/flex-bison/mark1/docs/html/linked__list_8c_ae6c3771fc65df2892b41d6f494df5676_cgraph.map new file mode 100644 index 0000000..de27208 --- /dev/null +++ b/flex-bison/mark1/docs/html/linked__list_8c_ae6c3771fc65df2892b41d6f494df5676_cgraph.map @@ -0,0 +1,4 @@ + + + + diff --git a/flex-bison/mark1/docs/html/linked__list_8c_ae6c3771fc65df2892b41d6f494df5676_cgraph.md5 b/flex-bison/mark1/docs/html/linked__list_8c_ae6c3771fc65df2892b41d6f494df5676_cgraph.md5 new file mode 100644 index 0000000..70332b4 --- /dev/null +++ b/flex-bison/mark1/docs/html/linked__list_8c_ae6c3771fc65df2892b41d6f494df5676_cgraph.md5 @@ -0,0 +1 @@ +36f49727641c1d98988bc7efb733517e \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/linked__list_8c_ae6c3771fc65df2892b41d6f494df5676_cgraph.png b/flex-bison/mark1/docs/html/linked__list_8c_ae6c3771fc65df2892b41d6f494df5676_cgraph.png new file mode 100644 index 0000000..03e1cfb Binary files /dev/null and b/flex-bison/mark1/docs/html/linked__list_8c_ae6c3771fc65df2892b41d6f494df5676_cgraph.png differ diff --git a/flex-bison/mark1/docs/html/linked__list_8c_source.html b/flex-bison/mark1/docs/html/linked__list_8c_source.html new file mode 100644 index 0000000..92669af --- /dev/null +++ b/flex-bison/mark1/docs/html/linked__list_8c_source.html @@ -0,0 +1,216 @@ + + + + +Mark1: src/data_structures/linked_list/linked_list.c Source File + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + +
+
+ +
+
+
+ +
+
+
+

src/data_structures/linked_list/linked_list.c

+
+
+Go to the documentation of this file.
00001 /******************************************************************************
+00002  * Includes and Prototypes
+00003  ******************************************************************************/
+00004 
+00005 #include "linked_list.h"
+00006 #include <stdlib.h>
+00007 
+00008 /******************************************************************************
+00009  * Public Functions
+00010  ******************************************************************************/
+00011 
+00012 // LL_New ---------------------------------------------------------------------
+00013 LinkedList_T* LL_New( PTR_TYPE contents )
+00014 {
+00015         LinkedList_T* list = (LinkedList_T*)malloc( sizeof(LinkedList_T) );
+00016         list->contents = contents;
+00017         list->next = NULL;
+00018         return list;
+00019 }
+00020 
+00021 // LL_Last --------------------------------------------------------------------
+00022 LinkedList_T* LL_Last( LinkedList_T* list )
+00023 {
+00024         LinkedList_T* node = list;
+00025         while((node != NULL) && (node->next != NULL))
+00026         {
+00027                 node = node->next;
+00028         }
+00029         return node;
+00030 }
+00031 
+00032 // LL_Get ---------------------------------------------------------------------
+00033 LinkedList_T* LL_Get( LinkedList_T* list, int index )
+00034 {
+00035         int current = 0;
+00036         LinkedList_T* node = list;
+00037         LinkedList_T* indexed_node = NULL;
+00038         while ((node != NULL) && (node->next != NULL))
+00039         {
+00040                 if ( current == index )
+00041                 {
+00042                         indexed_node = node;
+00043                         break;
+00044                 }
+00045                 node = node->next;
+00046                 current++;
+00047         }
+00048         return indexed_node;
+00049 }
+00050 
+00051 // LL_Add ---------------------------------------------------------------------
+00052 void LL_Add( LinkedList_T* list, PTR_TYPE contents )
+00053 {
+00054         LinkedList_T* node = LL_Last( list );
+00055         node->next = LL_New( contents );
+00056 }
+00057 
+00058 // LL_Insert ------------------------------------------------------------------
+00059 LinkedList_T* LL_Insert( LinkedList_T* list, int index, PTR_TYPE contents )
+00060 {
+00061         int req_index = ((index-1) < 0) ? 0 : index-1;
+00062         LinkedList_T* node = LL_Get( list, req_index );
+00063         if(node != NULL)
+00064         {
+00065                 LinkedList_T* next_next = node->next;
+00066                 node->next = LL_New( contents );
+00067                 node->next->next = next_next;
+00068                 node = node->next;
+00069         }
+00070         return node;
+00071 }
+00072 
+00073 // LL_Delete ------------------------------------------------------------------
+00074 void LL_Delete( LinkedList_T* list, int index, BOOL free_contents)
+00075 {
+00076         LinkedList_T* node = LL_Get( list, (index-1));
+00077         if((node != NULL) && (node->next != NULL))
+00078         {
+00079                 LinkedList_T* node_to_delete = node->next;
+00080                 node->next = node_to_delete->next;
+00081                 if (free_contents)
+00082                 {
+00083                         free(node_to_delete->contents);
+00084                 }
+00085                 free(node_to_delete);
+00086         }
+00087 }
+00088 
+00089 // LL_Free --------------------------------------------------------------------
+00090 void LL_Free( LinkedList_T* list, BOOL free_contents)
+00091 {
+00092         LinkedList_T* node = list;
+00093         while( node != NULL )
+00094         {
+00095                 LinkedList_T* next = node->next;
+00096                 if (free_contents)
+00097                         {
+00098                         free(node->contents);
+00099                         }
+00100                 free(node);
+00101                 node = next;
+00102         }
+00103 }
+00104 
+00105 //-----------------------------------------------------------------------------
+00106 
+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/linked__list_8h.html b/flex-bison/mark1/docs/html/linked__list_8h.html new file mode 100644 index 0000000..9fe2785 --- /dev/null +++ b/flex-bison/mark1/docs/html/linked__list_8h.html @@ -0,0 +1,556 @@ + + + + +Mark1: src/data_structures/linked_list/linked_list.h File Reference + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + +
+
+ +
+
+
+ +
+
+ +
+

src/data_structures/linked_list/linked_list.h File Reference

+
+
+
#include "common.h"
+
+Include dependency graph for linked_list.h:
+
+
+
+
+This graph shows which files directly or indirectly include this file:
+
+
+ + +
+
+

Go to the source code of this file.

+ + + + + + + + + + + + + + + + + + + + + + + +

+Data Structures

struct  LinkedList

+Defines

#define PTR_TYPE   void *
#define LL_FOREACH(item, list)   for( item = list; item != NULL; item = item->next )

+Typedefs

typedef struct LinkedList LinkedList_T

+Functions

LinkedList_TLL_New (PTR_TYPE contents)
 Creates a new linked list node with the supplied value.
LinkedList_TLL_Last (LinkedList_T *list)
 Finds and returns the last node in the supplied linked list.
LinkedList_TLL_Get (LinkedList_T *list, int index)
 Return the node at the specified index in a linked list.
void LL_Add (LinkedList_T *list, PTR_TYPE contents)
 Adds a new node to an existing linked list.
LinkedList_TLL_Insert (LinkedList_T *list, int index, PTR_TYPE contents)
 Inserts a new node in a linked list at the specified index.
void LL_Delete (LinkedList_T *list, int index, BOOL free_contents)
 Deletes a node from the supplied list.
void LL_Free (LinkedList_T *list, BOOL free_contents)
 Frees all memory used by a linked list.
+

Define Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + +
#define LL_FOREACH( item,
 list 
)   for( item = list; item != NULL; item = item->next )
+
+
+ +

Definition at line 91 of file linked_list.h.

+ +
+
+ +
+
+ + + + +
#define PTR_TYPE   void *
+
+
+ +

Definition at line 6 of file linked_list.h.

+ +
+
+

Typedef Documentation

+ +
+
+ + + + +
typedef struct LinkedList LinkedList_T
+
+
+ +
+
+

Function Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + +
void LL_Add (LinkedList_Tlist,
PTR_TYPE contents 
)
+
+
+ +

Adds a new node to an existing linked list.

+
Parameters:
+ + + +
list
contents
+
+
+ +

Definition at line 52 of file linked_list.c.

+ +

+Here is the call graph for this function:
+
+
+ + +
+

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
void LL_Delete (LinkedList_Tlist,
int index,
BOOL free_contents 
)
+
+
+ +

Deletes a node from the supplied list.

+

Deletes the node found at the supplied index from the supplied list and frees the memory used by the node and its contents.

+
Parameters:
+ + + + +
list
index
free_contentsWhether or not to also free the contents of the node.
+
+
+ +

Definition at line 74 of file linked_list.c.

+ +

+Here is the call graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void LL_Free (LinkedList_Tlist,
BOOL free_contents 
)
+
+
+ +

Frees all memory used by a linked list.

+

Loops through the supplied list and frees all nodes. Also frees contents if free_contents is passed TRUE. This is to avoid trying to free memory allocated on the stack.

+
Parameters:
+ + + +
listThe list to be freed.
free_contentsWhether or not to also free the contents of each node.
+
+
+ +

Definition at line 90 of file linked_list.c.

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
LinkedList_T* LL_Get (LinkedList_Tlist,
int index 
)
+
+
+ +

Return the node at the specified index in a linked list.

+

Loops through the linked list and returns the node in the list at the specified index. Returns NULL if the index is out of range.

+
Parameters:
+ + + +
listThe list to search for the supplied index.
indexThe index of the node to return.
+
+
+
Returns:
A pointer to the node and the supplied index, NULL if out of range.
+ +

Definition at line 33 of file linked_list.c.

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
LinkedList_T* LL_Insert (LinkedList_Tlist,
int index,
PTR_TYPE contents 
)
+
+
+ +

Inserts a new node in a linked list at the specified index.

+
Parameters:
+ + + + +
list
index
contents
+
+
+
Returns:
Pointer to the newly inserted node, NULL if index is out of range.
+ +

Definition at line 59 of file linked_list.c.

+ +

+Here is the call graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + +
LinkedList_T* LL_Last (LinkedList_Tlist)
+
+
+ +

Finds and returns the last node in the supplied linked list.

+
Parameters:
+ + +
listThe linked list to search.
+
+
+
Returns:
Pointer to the last node in the supplied list.
+ +

Definition at line 22 of file linked_list.c.

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + +
LinkedList_T* LL_New (PTR_TYPE contents)
+
+
+ +

Creates a new linked list node with the supplied value.

+

Allocates a new node on the heap and populates the node contents with the supplied contents pointer.

+
Parameters:
+ + +
contentsThe contents of the newly created node.
+
+
+
Returns:
A pointer to the newly created node.
+ +

Definition at line 13 of file linked_list.c.

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/linked__list_8h__dep__incl.map b/flex-bison/mark1/docs/html/linked__list_8h__dep__incl.map new file mode 100644 index 0000000..fc2cc1d --- /dev/null +++ b/flex-bison/mark1/docs/html/linked__list_8h__dep__incl.map @@ -0,0 +1,3 @@ + + + diff --git a/flex-bison/mark1/docs/html/linked__list_8h__dep__incl.md5 b/flex-bison/mark1/docs/html/linked__list_8h__dep__incl.md5 new file mode 100644 index 0000000..5590d1e --- /dev/null +++ b/flex-bison/mark1/docs/html/linked__list_8h__dep__incl.md5 @@ -0,0 +1 @@ +23123f2dae920186b65b20e3f236c4db \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/linked__list_8h__dep__incl.png b/flex-bison/mark1/docs/html/linked__list_8h__dep__incl.png new file mode 100644 index 0000000..cbc95c7 Binary files /dev/null and b/flex-bison/mark1/docs/html/linked__list_8h__dep__incl.png differ diff --git a/flex-bison/mark1/docs/html/linked__list_8h__incl.map b/flex-bison/mark1/docs/html/linked__list_8h__incl.map new file mode 100644 index 0000000..8be6a30 --- /dev/null +++ b/flex-bison/mark1/docs/html/linked__list_8h__incl.map @@ -0,0 +1,2 @@ + + diff --git a/flex-bison/mark1/docs/html/linked__list_8h__incl.md5 b/flex-bison/mark1/docs/html/linked__list_8h__incl.md5 new file mode 100644 index 0000000..3e4907a --- /dev/null +++ b/flex-bison/mark1/docs/html/linked__list_8h__incl.md5 @@ -0,0 +1 @@ +d2bb7b74040d6ea40fe0fb233c562669 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/linked__list_8h__incl.png b/flex-bison/mark1/docs/html/linked__list_8h__incl.png new file mode 100644 index 0000000..20c9a82 Binary files /dev/null and b/flex-bison/mark1/docs/html/linked__list_8h__incl.png differ diff --git a/flex-bison/mark1/docs/html/linked__list_8h_a0a2d62002a2faacb71e05a5e67bd14e5_icgraph.map b/flex-bison/mark1/docs/html/linked__list_8h_a0a2d62002a2faacb71e05a5e67bd14e5_icgraph.map new file mode 100644 index 0000000..6d40758 --- /dev/null +++ b/flex-bison/mark1/docs/html/linked__list_8h_a0a2d62002a2faacb71e05a5e67bd14e5_icgraph.map @@ -0,0 +1,3 @@ + + + diff --git a/flex-bison/mark1/docs/html/linked__list_8h_a0a2d62002a2faacb71e05a5e67bd14e5_icgraph.md5 b/flex-bison/mark1/docs/html/linked__list_8h_a0a2d62002a2faacb71e05a5e67bd14e5_icgraph.md5 new file mode 100644 index 0000000..ca3900c --- /dev/null +++ b/flex-bison/mark1/docs/html/linked__list_8h_a0a2d62002a2faacb71e05a5e67bd14e5_icgraph.md5 @@ -0,0 +1 @@ +a925f4414c7c7bd27103f3f636779663 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/linked__list_8h_a0a2d62002a2faacb71e05a5e67bd14e5_icgraph.png b/flex-bison/mark1/docs/html/linked__list_8h_a0a2d62002a2faacb71e05a5e67bd14e5_icgraph.png new file mode 100644 index 0000000..cb98db4 Binary files /dev/null and b/flex-bison/mark1/docs/html/linked__list_8h_a0a2d62002a2faacb71e05a5e67bd14e5_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/linked__list_8h_a0aeddcbf480893000c0b307d1aae5bf9_cgraph.map b/flex-bison/mark1/docs/html/linked__list_8h_a0aeddcbf480893000c0b307d1aae5bf9_cgraph.map new file mode 100644 index 0000000..8416a15 --- /dev/null +++ b/flex-bison/mark1/docs/html/linked__list_8h_a0aeddcbf480893000c0b307d1aae5bf9_cgraph.map @@ -0,0 +1,4 @@ + + + + diff --git a/flex-bison/mark1/docs/html/linked__list_8h_a0aeddcbf480893000c0b307d1aae5bf9_cgraph.md5 b/flex-bison/mark1/docs/html/linked__list_8h_a0aeddcbf480893000c0b307d1aae5bf9_cgraph.md5 new file mode 100644 index 0000000..f3a53d0 --- /dev/null +++ b/flex-bison/mark1/docs/html/linked__list_8h_a0aeddcbf480893000c0b307d1aae5bf9_cgraph.md5 @@ -0,0 +1 @@ +2e52260791ca1c0c900d437831981662 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/linked__list_8h_a0aeddcbf480893000c0b307d1aae5bf9_cgraph.png b/flex-bison/mark1/docs/html/linked__list_8h_a0aeddcbf480893000c0b307d1aae5bf9_cgraph.png new file mode 100644 index 0000000..55dbdb6 Binary files /dev/null and b/flex-bison/mark1/docs/html/linked__list_8h_a0aeddcbf480893000c0b307d1aae5bf9_cgraph.png differ diff --git a/flex-bison/mark1/docs/html/linked__list_8h_a0aeddcbf480893000c0b307d1aae5bf9_icgraph.map b/flex-bison/mark1/docs/html/linked__list_8h_a0aeddcbf480893000c0b307d1aae5bf9_icgraph.map new file mode 100644 index 0000000..f10e535 --- /dev/null +++ b/flex-bison/mark1/docs/html/linked__list_8h_a0aeddcbf480893000c0b307d1aae5bf9_icgraph.map @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/flex-bison/mark1/docs/html/linked__list_8h_a0aeddcbf480893000c0b307d1aae5bf9_icgraph.md5 b/flex-bison/mark1/docs/html/linked__list_8h_a0aeddcbf480893000c0b307d1aae5bf9_icgraph.md5 new file mode 100644 index 0000000..fa1ce1b --- /dev/null +++ b/flex-bison/mark1/docs/html/linked__list_8h_a0aeddcbf480893000c0b307d1aae5bf9_icgraph.md5 @@ -0,0 +1 @@ +9f5b27e4a07ebc7864aeb1215783bbc6 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/linked__list_8h_a0aeddcbf480893000c0b307d1aae5bf9_icgraph.png b/flex-bison/mark1/docs/html/linked__list_8h_a0aeddcbf480893000c0b307d1aae5bf9_icgraph.png new file mode 100644 index 0000000..cd9853c Binary files /dev/null and b/flex-bison/mark1/docs/html/linked__list_8h_a0aeddcbf480893000c0b307d1aae5bf9_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/linked__list_8h_a2690e9b5c6cab736036211986c1eee8a_icgraph.map b/flex-bison/mark1/docs/html/linked__list_8h_a2690e9b5c6cab736036211986c1eee8a_icgraph.map new file mode 100644 index 0000000..888ae91 --- /dev/null +++ b/flex-bison/mark1/docs/html/linked__list_8h_a2690e9b5c6cab736036211986c1eee8a_icgraph.map @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/flex-bison/mark1/docs/html/linked__list_8h_a2690e9b5c6cab736036211986c1eee8a_icgraph.md5 b/flex-bison/mark1/docs/html/linked__list_8h_a2690e9b5c6cab736036211986c1eee8a_icgraph.md5 new file mode 100644 index 0000000..911ea25 --- /dev/null +++ b/flex-bison/mark1/docs/html/linked__list_8h_a2690e9b5c6cab736036211986c1eee8a_icgraph.md5 @@ -0,0 +1 @@ +e944ae3a04d9b25453cd3d5676c50a03 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/linked__list_8h_a2690e9b5c6cab736036211986c1eee8a_icgraph.png b/flex-bison/mark1/docs/html/linked__list_8h_a2690e9b5c6cab736036211986c1eee8a_icgraph.png new file mode 100644 index 0000000..26bac80 Binary files /dev/null and b/flex-bison/mark1/docs/html/linked__list_8h_a2690e9b5c6cab736036211986c1eee8a_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/linked__list_8h_a3b525e4de0ea5ccf72b6537a32208330_icgraph.map b/flex-bison/mark1/docs/html/linked__list_8h_a3b525e4de0ea5ccf72b6537a32208330_icgraph.map new file mode 100644 index 0000000..6c400c3 --- /dev/null +++ b/flex-bison/mark1/docs/html/linked__list_8h_a3b525e4de0ea5ccf72b6537a32208330_icgraph.map @@ -0,0 +1,4 @@ + + + + diff --git a/flex-bison/mark1/docs/html/linked__list_8h_a3b525e4de0ea5ccf72b6537a32208330_icgraph.md5 b/flex-bison/mark1/docs/html/linked__list_8h_a3b525e4de0ea5ccf72b6537a32208330_icgraph.md5 new file mode 100644 index 0000000..2b2fa4c --- /dev/null +++ b/flex-bison/mark1/docs/html/linked__list_8h_a3b525e4de0ea5ccf72b6537a32208330_icgraph.md5 @@ -0,0 +1 @@ +b5fa5655af882616e18c5fd7d82f6795 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/linked__list_8h_a3b525e4de0ea5ccf72b6537a32208330_icgraph.png b/flex-bison/mark1/docs/html/linked__list_8h_a3b525e4de0ea5ccf72b6537a32208330_icgraph.png new file mode 100644 index 0000000..29cf35e Binary files /dev/null and b/flex-bison/mark1/docs/html/linked__list_8h_a3b525e4de0ea5ccf72b6537a32208330_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/linked__list_8h_a532eb65119c59d03bef0e1d37709681b_icgraph.map b/flex-bison/mark1/docs/html/linked__list_8h_a532eb65119c59d03bef0e1d37709681b_icgraph.map new file mode 100644 index 0000000..d2a74df --- /dev/null +++ b/flex-bison/mark1/docs/html/linked__list_8h_a532eb65119c59d03bef0e1d37709681b_icgraph.map @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/flex-bison/mark1/docs/html/linked__list_8h_a532eb65119c59d03bef0e1d37709681b_icgraph.md5 b/flex-bison/mark1/docs/html/linked__list_8h_a532eb65119c59d03bef0e1d37709681b_icgraph.md5 new file mode 100644 index 0000000..fce4282 --- /dev/null +++ b/flex-bison/mark1/docs/html/linked__list_8h_a532eb65119c59d03bef0e1d37709681b_icgraph.md5 @@ -0,0 +1 @@ +8743fd2829e7e14d8b14e7f97ff20120 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/linked__list_8h_a532eb65119c59d03bef0e1d37709681b_icgraph.png b/flex-bison/mark1/docs/html/linked__list_8h_a532eb65119c59d03bef0e1d37709681b_icgraph.png new file mode 100644 index 0000000..5a65cbc Binary files /dev/null and b/flex-bison/mark1/docs/html/linked__list_8h_a532eb65119c59d03bef0e1d37709681b_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/linked__list_8h_a9dfb9859e31881e8d08f7d09abcfe24e_cgraph.map b/flex-bison/mark1/docs/html/linked__list_8h_a9dfb9859e31881e8d08f7d09abcfe24e_cgraph.map new file mode 100644 index 0000000..cc65197 --- /dev/null +++ b/flex-bison/mark1/docs/html/linked__list_8h_a9dfb9859e31881e8d08f7d09abcfe24e_cgraph.map @@ -0,0 +1,3 @@ + + + diff --git a/flex-bison/mark1/docs/html/linked__list_8h_a9dfb9859e31881e8d08f7d09abcfe24e_cgraph.md5 b/flex-bison/mark1/docs/html/linked__list_8h_a9dfb9859e31881e8d08f7d09abcfe24e_cgraph.md5 new file mode 100644 index 0000000..e2488d7 --- /dev/null +++ b/flex-bison/mark1/docs/html/linked__list_8h_a9dfb9859e31881e8d08f7d09abcfe24e_cgraph.md5 @@ -0,0 +1 @@ +c71524397b3357b03dde59e9246a1b94 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/linked__list_8h_a9dfb9859e31881e8d08f7d09abcfe24e_cgraph.png b/flex-bison/mark1/docs/html/linked__list_8h_a9dfb9859e31881e8d08f7d09abcfe24e_cgraph.png new file mode 100644 index 0000000..3eed38b Binary files /dev/null and b/flex-bison/mark1/docs/html/linked__list_8h_a9dfb9859e31881e8d08f7d09abcfe24e_cgraph.png differ diff --git a/flex-bison/mark1/docs/html/linked__list_8h_ae6c3771fc65df2892b41d6f494df5676_cgraph.map b/flex-bison/mark1/docs/html/linked__list_8h_ae6c3771fc65df2892b41d6f494df5676_cgraph.map new file mode 100644 index 0000000..de27208 --- /dev/null +++ b/flex-bison/mark1/docs/html/linked__list_8h_ae6c3771fc65df2892b41d6f494df5676_cgraph.map @@ -0,0 +1,4 @@ + + + + diff --git a/flex-bison/mark1/docs/html/linked__list_8h_ae6c3771fc65df2892b41d6f494df5676_cgraph.md5 b/flex-bison/mark1/docs/html/linked__list_8h_ae6c3771fc65df2892b41d6f494df5676_cgraph.md5 new file mode 100644 index 0000000..70332b4 --- /dev/null +++ b/flex-bison/mark1/docs/html/linked__list_8h_ae6c3771fc65df2892b41d6f494df5676_cgraph.md5 @@ -0,0 +1 @@ +36f49727641c1d98988bc7efb733517e \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/linked__list_8h_ae6c3771fc65df2892b41d6f494df5676_cgraph.png b/flex-bison/mark1/docs/html/linked__list_8h_ae6c3771fc65df2892b41d6f494df5676_cgraph.png new file mode 100644 index 0000000..858b957 Binary files /dev/null and b/flex-bison/mark1/docs/html/linked__list_8h_ae6c3771fc65df2892b41d6f494df5676_cgraph.png differ diff --git a/flex-bison/mark1/docs/html/linked__list_8h_source.html b/flex-bison/mark1/docs/html/linked__list_8h_source.html new file mode 100644 index 0000000..d531b34 --- /dev/null +++ b/flex-bison/mark1/docs/html/linked__list_8h_source.html @@ -0,0 +1,140 @@ + + + + +Mark1: src/data_structures/linked_list/linked_list.h Source File + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + +
+
+ +
+
+
+ +
+
+
+

src/data_structures/linked_list/linked_list.h

+
+
+Go to the documentation of this file.
00001 #ifndef LINKED_LIST_H
+00002 #define LINKED_LIST_H
+00003 
+00004 #include "common.h"
+00005 
+00006 #define   PTR_TYPE  void *
+00007 
+00008 typedef struct LinkedList
+00009 {
+00010         PTR_TYPE contents;
+00011         struct LinkedList * next;
+00012 } LinkedList_T;
+00013 
+00024 LinkedList_T* LL_New( PTR_TYPE contents );
+00025 
+00033 LinkedList_T* LL_Last(LinkedList_T* list);
+00034 
+00046 LinkedList_T* LL_Get(LinkedList_T* list, int index);
+00047 
+00054 void LL_Add( LinkedList_T* list, PTR_TYPE contents );
+00055 
+00065 LinkedList_T* LL_Insert( LinkedList_T* list, int index, PTR_TYPE contents);
+00066 
+00077 void LL_Delete( LinkedList_T* list, int index, BOOL free_contents);
+00078 
+00089 void LL_Free( LinkedList_T* list, BOOL free_contents);
+00090 
+00091 #define LL_FOREACH(item,list) for( item = list; item != NULL; item = item->next )
+00092 
+00093 #endif
+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/main_8c.html b/flex-bison/mark1/docs/html/main_8c.html new file mode 100644 index 0000000..1c6bbb7 --- /dev/null +++ b/flex-bison/mark1/docs/html/main_8c.html @@ -0,0 +1,168 @@ + + + + +Mark1: src/main.c File Reference + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + +
+
+ +
+
+
+ +
+
+ +
+

src/main.c File Reference

+
+
+
#include <stdio.h>
+#include "cl_options.h"
+#include "parser.h"
+#include "dbg.h"
+#include "ast_debug.h"
+
+Include dependency graph for main.c:
+
+
+
+
+

Go to the source code of this file.

+ + + +

+Functions

int main (int argc, char **argv)
+

Function Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + +
int main (int argc,
char ** argv 
)
+
+
+ +

Definition at line 8 of file main.c.

+ +

+Here is the call graph for this function:
+
+
+ + +
+

+ +
+
+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/main_8c__incl.map b/flex-bison/mark1/docs/html/main_8c__incl.map new file mode 100644 index 0000000..8be6a30 --- /dev/null +++ b/flex-bison/mark1/docs/html/main_8c__incl.map @@ -0,0 +1,2 @@ + + diff --git a/flex-bison/mark1/docs/html/main_8c__incl.md5 b/flex-bison/mark1/docs/html/main_8c__incl.md5 new file mode 100644 index 0000000..25d1707 --- /dev/null +++ b/flex-bison/mark1/docs/html/main_8c__incl.md5 @@ -0,0 +1 @@ +de7cbd0e121ef4d201eef6d920759f6b \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/main_8c__incl.png b/flex-bison/mark1/docs/html/main_8c__incl.png new file mode 100644 index 0000000..6bee7ea Binary files /dev/null and b/flex-bison/mark1/docs/html/main_8c__incl.png differ diff --git a/flex-bison/mark1/docs/html/main_8c_a3c04138a5bfe5d72780bb7e82a18e627_cgraph.map b/flex-bison/mark1/docs/html/main_8c_a3c04138a5bfe5d72780bb7e82a18e627_cgraph.map new file mode 100644 index 0000000..2ebee44 --- /dev/null +++ b/flex-bison/mark1/docs/html/main_8c_a3c04138a5bfe5d72780bb7e82a18e627_cgraph.map @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/flex-bison/mark1/docs/html/main_8c_a3c04138a5bfe5d72780bb7e82a18e627_cgraph.md5 b/flex-bison/mark1/docs/html/main_8c_a3c04138a5bfe5d72780bb7e82a18e627_cgraph.md5 new file mode 100644 index 0000000..b9cc518 --- /dev/null +++ b/flex-bison/mark1/docs/html/main_8c_a3c04138a5bfe5d72780bb7e82a18e627_cgraph.md5 @@ -0,0 +1 @@ +c424a9fb72a835f3b5f7eb49db0dcaba \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/main_8c_a3c04138a5bfe5d72780bb7e82a18e627_cgraph.png b/flex-bison/mark1/docs/html/main_8c_a3c04138a5bfe5d72780bb7e82a18e627_cgraph.png new file mode 100644 index 0000000..b2b4fa9 Binary files /dev/null and b/flex-bison/mark1/docs/html/main_8c_a3c04138a5bfe5d72780bb7e82a18e627_cgraph.png differ diff --git a/flex-bison/mark1/docs/html/main_8c_source.html b/flex-bison/mark1/docs/html/main_8c_source.html new file mode 100644 index 0000000..bda13cd --- /dev/null +++ b/flex-bison/mark1/docs/html/main_8c_source.html @@ -0,0 +1,131 @@ + + + + +Mark1: src/main.c Source File + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + +
+
+ +
+
+
+ +
+
+
+

src/main.c

+
+
+Go to the documentation of this file.
00001 #include <stdio.h>
+00002 #include "cl_options.h"
+00003 #include "parser.h"
+00004 #include "dbg.h"
+00005 #include "ast_debug.h"
+00006 
+00007 
+00008 int main(int argc, char** argv)
+00009 {
+00010         CLO_ParseOptions(argc,argv);
+00011         LinkedList_T* in_files = CLO_GetFileList();
+00012         LinkedList_T* file = NULL;
+00013         LL_FOREACH( file, in_files )
+00014         {
+00015                 Node_T* tree = Parser_ParseFile( (String)file->contents );
+00016                 PrintAST(tree);
+00017         }
+00018         LL_Free( in_files, FALSE);
+00019         return 0;
+00020 }
+00021 
+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/nav_f.png b/flex-bison/mark1/docs/html/nav_f.png new file mode 100644 index 0000000..1b07a16 Binary files /dev/null and b/flex-bison/mark1/docs/html/nav_f.png differ diff --git a/flex-bison/mark1/docs/html/nav_h.png b/flex-bison/mark1/docs/html/nav_h.png new file mode 100644 index 0000000..01f5fa6 Binary files /dev/null and b/flex-bison/mark1/docs/html/nav_h.png differ diff --git a/flex-bison/mark1/docs/html/navtree.css b/flex-bison/mark1/docs/html/navtree.css new file mode 100644 index 0000000..e46ffcd --- /dev/null +++ b/flex-bison/mark1/docs/html/navtree.css @@ -0,0 +1,123 @@ +#nav-tree .children_ul { + margin:0; + padding:4px; +} + +#nav-tree ul { + list-style:none outside none; + margin:0px; + padding:0px; +} + +#nav-tree li { + white-space:nowrap; + margin:0px; + padding:0px; +} + +#nav-tree .plus { + margin:0px; +} + +#nav-tree .selected { + background-image: url('tab_a.png'); + background-repeat:repeat-x; + color: #fff; + text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); +} + +#nav-tree img { + margin:0px; + padding:0px; + border:0px; + vertical-align: middle; +} + +#nav-tree a { + text-decoration:none; + padding:0px; + margin:0px; + outline:none; +} + +#nav-tree .label { + margin:0px; + padding:0px; +} + +#nav-tree .label a { + padding:2px; +} + +#nav-tree .selected a { + text-decoration:none; + padding:2px; + margin:0px; + color:#fff; +} + +#nav-tree .children_ul { + margin:0px; + padding:0px; +} + +#nav-tree .item { + margin:0px; + padding:0px; +} + +#nav-tree { + padding: 0px 0px; + background-color: #FAFAFF; + font-size:14px; + overflow:auto; +} + +#doc-content { + overflow:auto; + display:block; + padding:0px; + margin:0px; +} + +#side-nav { + padding:0 6px 0 0; + margin: 0px; + display:block; + position: absolute; + left: 0px; + width: 300px; +} + +.ui-resizable .ui-resizable-handle { + display:block; +} + +.ui-resizable-e { + background:url("ftv2splitbar.png") repeat scroll right center transparent; + cursor:e-resize; + height:100%; + right:0; + top:0; + width:6px; +} + +.ui-resizable-handle { + display:none; + font-size:0.1px; + position:absolute; + z-index:1; +} + +#nav-tree-contents { + margin: 6px 0px 0px 0px; +} + +#nav-tree { + background-image:url('nav_h.png'); + background-repeat:repeat-x; + background-color: #F9FAFC; +} + + + diff --git a/flex-bison/mark1/docs/html/navtree.js b/flex-bison/mark1/docs/html/navtree.js new file mode 100644 index 0000000..fb7e2ad --- /dev/null +++ b/flex-bison/mark1/docs/html/navtree.js @@ -0,0 +1,289 @@ +var NAVTREE = +[ + [ "Mark1", "index.html", [ + [ "Data Structures", "annotated.html", [ + [ "LinkedList", "struct_linked_list.html", null ], + [ "Node_T", "struct_node___t.html", null ], + [ "OpcodeInfo_T", "struct_opcode_info___t.html", null ], + [ "ParserContext_T", "struct_parser_context___t.html", null ], + [ "Value_T", "union_value___t.html", null ], + [ "ValueNode_T", "struct_value_node___t.html", null ], + [ "yy_buffer_state", "structyy__buffer__state.html", null ], + [ "yy_trans_info", "structyy__trans__info.html", null ], + [ "yyalloc", "unionyyalloc.html", null ], + [ "yyguts_t", "structyyguts__t.html", null ], + [ "YYSTYPE", "union_y_y_s_t_y_p_e.html", null ] + ] ], + [ "Data Structure Index", "classes.html", null ], + [ "Data Fields", "functions.html", null ], + [ "File List", "files.html", [ + [ "src/common.h", "common_8h.html", null ], + [ "src/main.c", "main_8c.html", null ], + [ "src/cl_options/cl_options.c", "cl__options_8c.html", null ], + [ "src/cl_options/cl_options.h", "cl__options_8h.html", null ], + [ "src/data_structures/ast/ast.c", "ast_8c.html", null ], + [ "src/data_structures/ast/ast.h", "ast_8h.html", null ], + [ "src/data_structures/ast/ast_debug.c", "ast__debug_8c.html", null ], + [ "src/data_structures/ast/ast_debug.h", "ast__debug_8h.html", null ], + [ "src/data_structures/linked_list/linked_list.c", "linked__list_8c.html", null ], + [ "src/data_structures/linked_list/linked_list.h", "linked__list_8h.html", null ], + [ "src/dbg/dbg.c", "dbg_8c.html", null ], + [ "src/dbg/dbg.h", "dbg_8h.html", null ], + [ "src/il_opcodes/il_opcodes.c", "il__opcodes_8c.html", null ], + [ "src/il_opcodes/il_opcodes.h", "il__opcodes_8h.html", null ], + [ "src/parser/parser.c", "parser_8c.html", null ], + [ "src/parser/parser.h", "parser_8h.html", null ], + [ "src/parser/grammar/grammar.tab.c", "grammar_8tab_8c.html", null ], + [ "src/parser/grammar/grammar.tab.h", "grammar_8tab_8h.html", null ], + [ "src/parser/lexer/lex.yy.c", "lex_8yy_8c.html", null ], + [ "src/parser/lexer/lex.yy.h", "lex_8yy_8h.html", null ] + ] ], + [ "Globals", "globals.html", null ] + ] ] +]; + +function createIndent(o,domNode,node,level) +{ + if (node.parentNode && node.parentNode.parentNode) + { + createIndent(o,domNode,node.parentNode,level+1); + } + var imgNode = document.createElement("img"); + if (level==0 && node.childrenData) + { + node.plus_img = imgNode; + node.expandToggle = document.createElement("a"); + node.expandToggle.href = "javascript:void(0)"; + node.expandToggle.onclick = function() + { + if (node.expanded) + { + $(node.getChildrenUL()).slideUp("fast"); + if (node.isLast) + { + node.plus_img.src = node.relpath+"ftv2plastnode.png"; + } + else + { + node.plus_img.src = node.relpath+"ftv2pnode.png"; + } + node.expanded = false; + } + else + { + expandNode(o, node, false); + } + } + node.expandToggle.appendChild(imgNode); + domNode.appendChild(node.expandToggle); + } + else + { + domNode.appendChild(imgNode); + } + if (level==0) + { + if (node.isLast) + { + if (node.childrenData) + { + imgNode.src = node.relpath+"ftv2plastnode.png"; + } + else + { + imgNode.src = node.relpath+"ftv2lastnode.png"; + domNode.appendChild(imgNode); + } + } + else + { + if (node.childrenData) + { + imgNode.src = node.relpath+"ftv2pnode.png"; + } + else + { + imgNode.src = node.relpath+"ftv2node.png"; + domNode.appendChild(imgNode); + } + } + } + else + { + if (node.isLast) + { + imgNode.src = node.relpath+"ftv2blank.png"; + } + else + { + imgNode.src = node.relpath+"ftv2vertline.png"; + } + } + imgNode.border = "0"; +} + +function newNode(o, po, text, link, childrenData, lastNode) +{ + var node = new Object(); + node.children = Array(); + node.childrenData = childrenData; + node.depth = po.depth + 1; + node.relpath = po.relpath; + node.isLast = lastNode; + + node.li = document.createElement("li"); + po.getChildrenUL().appendChild(node.li); + node.parentNode = po; + + node.itemDiv = document.createElement("div"); + node.itemDiv.className = "item"; + + node.labelSpan = document.createElement("span"); + node.labelSpan.className = "label"; + + createIndent(o,node.itemDiv,node,0); + node.itemDiv.appendChild(node.labelSpan); + node.li.appendChild(node.itemDiv); + + var a = document.createElement("a"); + node.labelSpan.appendChild(a); + node.label = document.createTextNode(text); + a.appendChild(node.label); + if (link) + { + a.href = node.relpath+link; + } + else + { + if (childrenData != null) + { + a.className = "nolink"; + a.href = "javascript:void(0)"; + a.onclick = node.expandToggle.onclick; + node.expanded = false; + } + } + + node.childrenUL = null; + node.getChildrenUL = function() + { + if (!node.childrenUL) + { + node.childrenUL = document.createElement("ul"); + node.childrenUL.className = "children_ul"; + node.childrenUL.style.display = "none"; + node.li.appendChild(node.childrenUL); + } + return node.childrenUL; + }; + + return node; +} + +function showRoot() +{ + var headerHeight = $("#top").height(); + var footerHeight = $("#nav-path").height(); + var windowHeight = $(window).height() - headerHeight - footerHeight; + navtree.scrollTo('#selected',0,{offset:-windowHeight/2}); +} + +function expandNode(o, node, imm) +{ + if (node.childrenData && !node.expanded) + { + if (!node.childrenVisited) + { + getNode(o, node); + } + if (imm) + { + $(node.getChildrenUL()).show(); + } + else + { + $(node.getChildrenUL()).slideDown("fast",showRoot); + } + if (node.isLast) + { + node.plus_img.src = node.relpath+"ftv2mlastnode.png"; + } + else + { + node.plus_img.src = node.relpath+"ftv2mnode.png"; + } + node.expanded = true; + } +} + +function getNode(o, po) +{ + po.childrenVisited = true; + var l = po.childrenData.length-1; + for (var i in po.childrenData) + { + var nodeData = po.childrenData[i]; + po.children[i] = newNode(o, po, nodeData[0], nodeData[1], nodeData[2], + i==l); + } +} + +function findNavTreePage(url, data) +{ + var nodes = data; + var result = null; + for (var i in nodes) + { + var d = nodes[i]; + if (d[1] == url) + { + return new Array(i); + } + else if (d[2] != null) // array of children + { + result = findNavTreePage(url, d[2]); + if (result != null) + { + return (new Array(i).concat(result)); + } + } + } + return null; +} + +function initNavTree(toroot,relpath) +{ + var o = new Object(); + o.toroot = toroot; + o.node = new Object(); + o.node.li = document.getElementById("nav-tree-contents"); + o.node.childrenData = NAVTREE; + o.node.children = new Array(); + o.node.childrenUL = document.createElement("ul"); + o.node.getChildrenUL = function() { return o.node.childrenUL; }; + o.node.li.appendChild(o.node.childrenUL); + o.node.depth = 0; + o.node.relpath = relpath; + + getNode(o, o.node); + + o.breadcrumbs = findNavTreePage(toroot, NAVTREE); + if (o.breadcrumbs == null) + { + o.breadcrumbs = findNavTreePage("index.html",NAVTREE); + } + if (o.breadcrumbs != null && o.breadcrumbs.length>0) + { + var p = o.node; + for (var i in o.breadcrumbs) + { + var j = o.breadcrumbs[i]; + p = p.children[j]; + expandNode(o,p,true); + } + p.itemDiv.className = p.itemDiv.className + " selected"; + p.itemDiv.id = "selected"; + $(window).load(showRoot); + } +} + diff --git a/flex-bison/mark1/docs/html/open.png b/flex-bison/mark1/docs/html/open.png new file mode 100644 index 0000000..7b35d2c Binary files /dev/null and b/flex-bison/mark1/docs/html/open.png differ diff --git a/flex-bison/mark1/docs/html/parser_8c.html b/flex-bison/mark1/docs/html/parser_8c.html new file mode 100644 index 0000000..9638b70 --- /dev/null +++ b/flex-bison/mark1/docs/html/parser_8c.html @@ -0,0 +1,244 @@ + + + + +Mark1: src/parser/parser.c File Reference + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + +
+
+ +
+
+
+ +
+
+ +
+

src/parser/parser.c File Reference

+
+
+
#include <stdio.h>
+#include "parser.h"
+#include "lex.yy.h"
+
+Include dependency graph for parser.c:
+
+
+ + +
+
+

Go to the source code of this file.

+ + + + + +

+Functions

Node_TParser_ParseInput (FILE *in_file)
Node_TParser_ParseFile (String in_file)
void yyerror (ParserContext_T *context, String s)
+

Function Documentation

+ +
+
+ + + + + + + + +
Node_T* Parser_ParseFile (String in_file)
+
+
+ +

Definition at line 33 of file parser.c.

+ +

+Here is the call graph for this function:
+
+
+ + +
+

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + +
Node_T * Parser_ParseInput (FILE * in_file)
+
+
+ +

Definition at line 13 of file parser.c.

+ +

+Here is the call graph for this function:
+
+
+ + +
+

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void yyerror (ParserContext_Tcontext,
String s 
)
+
+
+ +

Definition at line 39 of file parser.c.

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/parser_8c__incl.map b/flex-bison/mark1/docs/html/parser_8c__incl.map new file mode 100644 index 0000000..8bfa50d --- /dev/null +++ b/flex-bison/mark1/docs/html/parser_8c__incl.map @@ -0,0 +1,3 @@ + + + diff --git a/flex-bison/mark1/docs/html/parser_8c__incl.md5 b/flex-bison/mark1/docs/html/parser_8c__incl.md5 new file mode 100644 index 0000000..fb838bb --- /dev/null +++ b/flex-bison/mark1/docs/html/parser_8c__incl.md5 @@ -0,0 +1 @@ +3719240a4b86427fb56661616367d99b \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/parser_8c__incl.png b/flex-bison/mark1/docs/html/parser_8c__incl.png new file mode 100644 index 0000000..c76f54b Binary files /dev/null and b/flex-bison/mark1/docs/html/parser_8c__incl.png differ diff --git a/flex-bison/mark1/docs/html/parser_8c_a48fdd12b69cfc7e1a1e3099887715a4c_cgraph.map b/flex-bison/mark1/docs/html/parser_8c_a48fdd12b69cfc7e1a1e3099887715a4c_cgraph.map new file mode 100644 index 0000000..3608a31 --- /dev/null +++ b/flex-bison/mark1/docs/html/parser_8c_a48fdd12b69cfc7e1a1e3099887715a4c_cgraph.map @@ -0,0 +1,6 @@ + + + + + + diff --git a/flex-bison/mark1/docs/html/parser_8c_a48fdd12b69cfc7e1a1e3099887715a4c_cgraph.md5 b/flex-bison/mark1/docs/html/parser_8c_a48fdd12b69cfc7e1a1e3099887715a4c_cgraph.md5 new file mode 100644 index 0000000..51d2915 --- /dev/null +++ b/flex-bison/mark1/docs/html/parser_8c_a48fdd12b69cfc7e1a1e3099887715a4c_cgraph.md5 @@ -0,0 +1 @@ +ba99e314f71934661c10a0719ddd0fd0 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/parser_8c_a48fdd12b69cfc7e1a1e3099887715a4c_cgraph.png b/flex-bison/mark1/docs/html/parser_8c_a48fdd12b69cfc7e1a1e3099887715a4c_cgraph.png new file mode 100644 index 0000000..d41297f Binary files /dev/null and b/flex-bison/mark1/docs/html/parser_8c_a48fdd12b69cfc7e1a1e3099887715a4c_cgraph.png differ diff --git a/flex-bison/mark1/docs/html/parser_8c_a48fdd12b69cfc7e1a1e3099887715a4c_icgraph.map b/flex-bison/mark1/docs/html/parser_8c_a48fdd12b69cfc7e1a1e3099887715a4c_icgraph.map new file mode 100644 index 0000000..87548cb --- /dev/null +++ b/flex-bison/mark1/docs/html/parser_8c_a48fdd12b69cfc7e1a1e3099887715a4c_icgraph.map @@ -0,0 +1,3 @@ + + + diff --git a/flex-bison/mark1/docs/html/parser_8c_a48fdd12b69cfc7e1a1e3099887715a4c_icgraph.md5 b/flex-bison/mark1/docs/html/parser_8c_a48fdd12b69cfc7e1a1e3099887715a4c_icgraph.md5 new file mode 100644 index 0000000..0f4bca8 --- /dev/null +++ b/flex-bison/mark1/docs/html/parser_8c_a48fdd12b69cfc7e1a1e3099887715a4c_icgraph.md5 @@ -0,0 +1 @@ +6726e1272bf7d049ee7c4e812e3014ef \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/parser_8c_a48fdd12b69cfc7e1a1e3099887715a4c_icgraph.png b/flex-bison/mark1/docs/html/parser_8c_a48fdd12b69cfc7e1a1e3099887715a4c_icgraph.png new file mode 100644 index 0000000..bb1e3cb Binary files /dev/null and b/flex-bison/mark1/docs/html/parser_8c_a48fdd12b69cfc7e1a1e3099887715a4c_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/parser_8c_aa316ef323acac9c698b5b69100f32d97_icgraph.map b/flex-bison/mark1/docs/html/parser_8c_aa316ef323acac9c698b5b69100f32d97_icgraph.map new file mode 100644 index 0000000..3f3b9ba --- /dev/null +++ b/flex-bison/mark1/docs/html/parser_8c_aa316ef323acac9c698b5b69100f32d97_icgraph.map @@ -0,0 +1,3 @@ + + + diff --git a/flex-bison/mark1/docs/html/parser_8c_aa316ef323acac9c698b5b69100f32d97_icgraph.md5 b/flex-bison/mark1/docs/html/parser_8c_aa316ef323acac9c698b5b69100f32d97_icgraph.md5 new file mode 100644 index 0000000..dd34efb --- /dev/null +++ b/flex-bison/mark1/docs/html/parser_8c_aa316ef323acac9c698b5b69100f32d97_icgraph.md5 @@ -0,0 +1 @@ +45cd2ee24b69c05cbb1fdac4260b92bc \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/parser_8c_aa316ef323acac9c698b5b69100f32d97_icgraph.png b/flex-bison/mark1/docs/html/parser_8c_aa316ef323acac9c698b5b69100f32d97_icgraph.png new file mode 100644 index 0000000..eba538f Binary files /dev/null and b/flex-bison/mark1/docs/html/parser_8c_aa316ef323acac9c698b5b69100f32d97_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/parser_8c_ab88d217215e0c62d1883650d5101b1dd_cgraph.map b/flex-bison/mark1/docs/html/parser_8c_ab88d217215e0c62d1883650d5101b1dd_cgraph.map new file mode 100644 index 0000000..01c86e1 --- /dev/null +++ b/flex-bison/mark1/docs/html/parser_8c_ab88d217215e0c62d1883650d5101b1dd_cgraph.map @@ -0,0 +1,5 @@ + + + + + diff --git a/flex-bison/mark1/docs/html/parser_8c_ab88d217215e0c62d1883650d5101b1dd_cgraph.md5 b/flex-bison/mark1/docs/html/parser_8c_ab88d217215e0c62d1883650d5101b1dd_cgraph.md5 new file mode 100644 index 0000000..b8430c1 --- /dev/null +++ b/flex-bison/mark1/docs/html/parser_8c_ab88d217215e0c62d1883650d5101b1dd_cgraph.md5 @@ -0,0 +1 @@ +91722be209ce8e134b185d2794d105ae \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/parser_8c_ab88d217215e0c62d1883650d5101b1dd_cgraph.png b/flex-bison/mark1/docs/html/parser_8c_ab88d217215e0c62d1883650d5101b1dd_cgraph.png new file mode 100644 index 0000000..682f8ef Binary files /dev/null and b/flex-bison/mark1/docs/html/parser_8c_ab88d217215e0c62d1883650d5101b1dd_cgraph.png differ diff --git a/flex-bison/mark1/docs/html/parser_8c_ab88d217215e0c62d1883650d5101b1dd_icgraph.map b/flex-bison/mark1/docs/html/parser_8c_ab88d217215e0c62d1883650d5101b1dd_icgraph.map new file mode 100644 index 0000000..4a6b9d6 --- /dev/null +++ b/flex-bison/mark1/docs/html/parser_8c_ab88d217215e0c62d1883650d5101b1dd_icgraph.map @@ -0,0 +1,4 @@ + + + + diff --git a/flex-bison/mark1/docs/html/parser_8c_ab88d217215e0c62d1883650d5101b1dd_icgraph.md5 b/flex-bison/mark1/docs/html/parser_8c_ab88d217215e0c62d1883650d5101b1dd_icgraph.md5 new file mode 100644 index 0000000..dd66680 --- /dev/null +++ b/flex-bison/mark1/docs/html/parser_8c_ab88d217215e0c62d1883650d5101b1dd_icgraph.md5 @@ -0,0 +1 @@ +76e9d9bcbf03e920304e565ff8c7ccda \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/parser_8c_ab88d217215e0c62d1883650d5101b1dd_icgraph.png b/flex-bison/mark1/docs/html/parser_8c_ab88d217215e0c62d1883650d5101b1dd_icgraph.png new file mode 100644 index 0000000..729f55f Binary files /dev/null and b/flex-bison/mark1/docs/html/parser_8c_ab88d217215e0c62d1883650d5101b1dd_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/parser_8c_source.html b/flex-bison/mark1/docs/html/parser_8c_source.html new file mode 100644 index 0000000..4a26c32 --- /dev/null +++ b/flex-bison/mark1/docs/html/parser_8c_source.html @@ -0,0 +1,155 @@ + + + + +Mark1: src/parser/parser.c Source File + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + +
+
+ +
+
+
+ +
+
+
+

src/parser/parser.c

+
+
+Go to the documentation of this file.
00001 /******************************************************************************
+00002  * Includes and Prototypes
+00003  *****************************************************************************/
+00004 #include <stdio.h>
+00005 #include "parser.h"
+00006 #include "lex.yy.h"
+00007 
+00008 Node_T* Parser_ParseInput(FILE* in_file);
+00009 
+00010 /******************************************************************************
+00011  * Private Functions
+00012  *****************************************************************************/
+00013 Node_T* Parser_ParseInput(FILE* in_file)
+00014 {
+00015         Node_T* ast = (Node_T*)malloc(sizeof(Node_T));
+00016         ast->node_type = ROOT;
+00017         ast->children = NULL;
+00018 
+00019         if ( in_file != NULL )
+00020         {
+00021                 ParserContext_T context = { NULL, ast};
+00022                 yylex_init( &(context.lexinfo) );
+00023                 yyset_in( in_file, context.lexinfo );
+00024                 yyparse( &context );
+00025         }
+00026 
+00027         return ast;
+00028 }
+00029 
+00030 /******************************************************************************
+00031  * Public Functions
+00032  *****************************************************************************/
+00033 Node_T* Parser_ParseFile(String in_file)
+00034 {
+00035         FILE* input_file = fopen( in_file ,"r");
+00036         return Parser_ParseInput( input_file );
+00037 }
+00038 
+00039 void yyerror(ParserContext_T* context, String s)
+00040 {
+00041         fprintf(stderr,"Error: %s\n",s);
+00042 }
+00043 
+00044 //-----------------------------------------------------------------------------
+00045 
+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/parser_8h.html b/flex-bison/mark1/docs/html/parser_8h.html new file mode 100644 index 0000000..ae74ccd --- /dev/null +++ b/flex-bison/mark1/docs/html/parser_8h.html @@ -0,0 +1,245 @@ + + + + +Mark1: src/parser/parser.h File Reference + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + +
+
+ +
+
+
+ +
+
+ +
+

src/parser/parser.h File Reference

+
+
+
#include "common.h"
+#include "grammar.tab.h"
+#include "ast.h"
+#include "dbg.h"
+
+Include dependency graph for parser.h:
+
+
+
+
+This graph shows which files directly or indirectly include this file:
+
+
+ + +
+
+

Go to the source code of this file.

+ + + + + + + +

+Data Structures

struct  ParserContext_T

+Functions

Node_TParser_ParseFile (String in_file)
void yyerror (ParserContext_T *context, String s)
int yyparse (ParserContext_T *context)
+

Function Documentation

+ +
+
+ + + + + + + + +
Node_T* Parser_ParseFile (String in_file)
+
+
+ +

Definition at line 33 of file parser.c.

+ +

+Here is the call graph for this function:
+
+
+ + +
+

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void yyerror (ParserContext_Tcontext,
String s 
)
+
+
+ +

Definition at line 39 of file parser.c.

+ +

+Here is the caller graph for this function:
+
+
+ + +
+

+ +
+
+ +
+
+ + + + + + + + +
int yyparse (ParserContext_Tcontext)
+
+
+ +

Definition at line 1156 of file grammar.tab.c.

+ +

+Here is the call graph for this function:
+
+
+ + +
+

+ +
+
+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/parser_8h__dep__incl.map b/flex-bison/mark1/docs/html/parser_8h__dep__incl.map new file mode 100644 index 0000000..a9fc73d --- /dev/null +++ b/flex-bison/mark1/docs/html/parser_8h__dep__incl.map @@ -0,0 +1,3 @@ + + + diff --git a/flex-bison/mark1/docs/html/parser_8h__dep__incl.md5 b/flex-bison/mark1/docs/html/parser_8h__dep__incl.md5 new file mode 100644 index 0000000..a3e9acb --- /dev/null +++ b/flex-bison/mark1/docs/html/parser_8h__dep__incl.md5 @@ -0,0 +1 @@ +47b28a4b051454119010308b3d47bfcf \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/parser_8h__dep__incl.png b/flex-bison/mark1/docs/html/parser_8h__dep__incl.png new file mode 100644 index 0000000..a4db688 Binary files /dev/null and b/flex-bison/mark1/docs/html/parser_8h__dep__incl.png differ diff --git a/flex-bison/mark1/docs/html/parser_8h__incl.map b/flex-bison/mark1/docs/html/parser_8h__incl.map new file mode 100644 index 0000000..8be6a30 --- /dev/null +++ b/flex-bison/mark1/docs/html/parser_8h__incl.map @@ -0,0 +1,2 @@ + + diff --git a/flex-bison/mark1/docs/html/parser_8h__incl.md5 b/flex-bison/mark1/docs/html/parser_8h__incl.md5 new file mode 100644 index 0000000..2b75857 --- /dev/null +++ b/flex-bison/mark1/docs/html/parser_8h__incl.md5 @@ -0,0 +1 @@ +36b6ea4876a186de27c0f6a3ea13f30f \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/parser_8h__incl.png b/flex-bison/mark1/docs/html/parser_8h__incl.png new file mode 100644 index 0000000..48bad65 Binary files /dev/null and b/flex-bison/mark1/docs/html/parser_8h__incl.png differ diff --git a/flex-bison/mark1/docs/html/parser_8h_a48fdd12b69cfc7e1a1e3099887715a4c_cgraph.map b/flex-bison/mark1/docs/html/parser_8h_a48fdd12b69cfc7e1a1e3099887715a4c_cgraph.map new file mode 100644 index 0000000..3608a31 --- /dev/null +++ b/flex-bison/mark1/docs/html/parser_8h_a48fdd12b69cfc7e1a1e3099887715a4c_cgraph.map @@ -0,0 +1,6 @@ + + + + + + diff --git a/flex-bison/mark1/docs/html/parser_8h_a48fdd12b69cfc7e1a1e3099887715a4c_cgraph.md5 b/flex-bison/mark1/docs/html/parser_8h_a48fdd12b69cfc7e1a1e3099887715a4c_cgraph.md5 new file mode 100644 index 0000000..51d2915 --- /dev/null +++ b/flex-bison/mark1/docs/html/parser_8h_a48fdd12b69cfc7e1a1e3099887715a4c_cgraph.md5 @@ -0,0 +1 @@ +ba99e314f71934661c10a0719ddd0fd0 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/parser_8h_a48fdd12b69cfc7e1a1e3099887715a4c_cgraph.png b/flex-bison/mark1/docs/html/parser_8h_a48fdd12b69cfc7e1a1e3099887715a4c_cgraph.png new file mode 100644 index 0000000..d4b97da Binary files /dev/null and b/flex-bison/mark1/docs/html/parser_8h_a48fdd12b69cfc7e1a1e3099887715a4c_cgraph.png differ diff --git a/flex-bison/mark1/docs/html/parser_8h_a48fdd12b69cfc7e1a1e3099887715a4c_icgraph.map b/flex-bison/mark1/docs/html/parser_8h_a48fdd12b69cfc7e1a1e3099887715a4c_icgraph.map new file mode 100644 index 0000000..87548cb --- /dev/null +++ b/flex-bison/mark1/docs/html/parser_8h_a48fdd12b69cfc7e1a1e3099887715a4c_icgraph.map @@ -0,0 +1,3 @@ + + + diff --git a/flex-bison/mark1/docs/html/parser_8h_a48fdd12b69cfc7e1a1e3099887715a4c_icgraph.md5 b/flex-bison/mark1/docs/html/parser_8h_a48fdd12b69cfc7e1a1e3099887715a4c_icgraph.md5 new file mode 100644 index 0000000..0f4bca8 --- /dev/null +++ b/flex-bison/mark1/docs/html/parser_8h_a48fdd12b69cfc7e1a1e3099887715a4c_icgraph.md5 @@ -0,0 +1 @@ +6726e1272bf7d049ee7c4e812e3014ef \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/parser_8h_a48fdd12b69cfc7e1a1e3099887715a4c_icgraph.png b/flex-bison/mark1/docs/html/parser_8h_a48fdd12b69cfc7e1a1e3099887715a4c_icgraph.png new file mode 100644 index 0000000..c12e92b Binary files /dev/null and b/flex-bison/mark1/docs/html/parser_8h_a48fdd12b69cfc7e1a1e3099887715a4c_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/parser_8h_a532dba64f9aad4f70498207a3395cd9e_cgraph.map b/flex-bison/mark1/docs/html/parser_8h_a532dba64f9aad4f70498207a3395cd9e_cgraph.map new file mode 100644 index 0000000..052bbc7 --- /dev/null +++ b/flex-bison/mark1/docs/html/parser_8h_a532dba64f9aad4f70498207a3395cd9e_cgraph.map @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/flex-bison/mark1/docs/html/parser_8h_a532dba64f9aad4f70498207a3395cd9e_cgraph.md5 b/flex-bison/mark1/docs/html/parser_8h_a532dba64f9aad4f70498207a3395cd9e_cgraph.md5 new file mode 100644 index 0000000..87c0417 --- /dev/null +++ b/flex-bison/mark1/docs/html/parser_8h_a532dba64f9aad4f70498207a3395cd9e_cgraph.md5 @@ -0,0 +1 @@ +a405a54d7b71f6a8c6bdac931216de8f \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/parser_8h_a532dba64f9aad4f70498207a3395cd9e_cgraph.png b/flex-bison/mark1/docs/html/parser_8h_a532dba64f9aad4f70498207a3395cd9e_cgraph.png new file mode 100644 index 0000000..b17759e Binary files /dev/null and b/flex-bison/mark1/docs/html/parser_8h_a532dba64f9aad4f70498207a3395cd9e_cgraph.png differ diff --git a/flex-bison/mark1/docs/html/parser_8h_aa316ef323acac9c698b5b69100f32d97_icgraph.map b/flex-bison/mark1/docs/html/parser_8h_aa316ef323acac9c698b5b69100f32d97_icgraph.map new file mode 100644 index 0000000..3f3b9ba --- /dev/null +++ b/flex-bison/mark1/docs/html/parser_8h_aa316ef323acac9c698b5b69100f32d97_icgraph.map @@ -0,0 +1,3 @@ + + + diff --git a/flex-bison/mark1/docs/html/parser_8h_aa316ef323acac9c698b5b69100f32d97_icgraph.md5 b/flex-bison/mark1/docs/html/parser_8h_aa316ef323acac9c698b5b69100f32d97_icgraph.md5 new file mode 100644 index 0000000..dd34efb --- /dev/null +++ b/flex-bison/mark1/docs/html/parser_8h_aa316ef323acac9c698b5b69100f32d97_icgraph.md5 @@ -0,0 +1 @@ +45cd2ee24b69c05cbb1fdac4260b92bc \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/parser_8h_aa316ef323acac9c698b5b69100f32d97_icgraph.png b/flex-bison/mark1/docs/html/parser_8h_aa316ef323acac9c698b5b69100f32d97_icgraph.png new file mode 100644 index 0000000..a496133 Binary files /dev/null and b/flex-bison/mark1/docs/html/parser_8h_aa316ef323acac9c698b5b69100f32d97_icgraph.png differ diff --git a/flex-bison/mark1/docs/html/parser_8h_source.html b/flex-bison/mark1/docs/html/parser_8h_source.html new file mode 100644 index 0000000..2217aed --- /dev/null +++ b/flex-bison/mark1/docs/html/parser_8h_source.html @@ -0,0 +1,130 @@ + + + + +Mark1: src/parser/parser.h Source File + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + +
+
+ +
+
+
+ +
+
+
+

src/parser/parser.h

+
+
+Go to the documentation of this file.
00001 #ifndef PARSER_H
+00002 #define PARSER_H
+00003 
+00004 #include "common.h"
+00005 #include "grammar.tab.h"
+00006 #include "ast.h"
+00007 #include "dbg.h"
+00008 
+00009 typedef struct 
+00010 {
+00011         void*   lexinfo;
+00012         Node_T* ast;
+00013 } ParserContext_T;
+00014 
+00015 Node_T* Parser_ParseFile(String in_file);
+00016 void yyerror(ParserContext_T* context, String s);
+00017 
+00018 extern int yyparse(ParserContext_T* context);
+00019 
+00020 #endif
+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/resize.js b/flex-bison/mark1/docs/html/resize.js new file mode 100644 index 0000000..04fa95c --- /dev/null +++ b/flex-bison/mark1/docs/html/resize.js @@ -0,0 +1,81 @@ +var cookie_namespace = 'doxygen'; +var sidenav,navtree,content,header; + +function readCookie(cookie) +{ + var myCookie = cookie_namespace+"_"+cookie+"="; + if (document.cookie) + { + var index = document.cookie.indexOf(myCookie); + if (index != -1) + { + var valStart = index + myCookie.length; + var valEnd = document.cookie.indexOf(";", valStart); + if (valEnd == -1) + { + valEnd = document.cookie.length; + } + var val = document.cookie.substring(valStart, valEnd); + return val; + } + } + return 0; +} + +function writeCookie(cookie, val, expiration) +{ + if (val==undefined) return; + if (expiration == null) + { + var date = new Date(); + date.setTime(date.getTime()+(10*365*24*60*60*1000)); // default expiration is one week + expiration = date.toGMTString(); + } + document.cookie = cookie_namespace + "_" + cookie + "=" + val + "; expires=" + expiration+"; path=/"; +} + +function resizeWidth() +{ + var windowWidth = $(window).width() + "px"; + var sidenavWidth = $(sidenav).width(); + content.css({marginLeft:parseInt(sidenavWidth)+6+"px"}); //account for 6px-wide handle-bar + writeCookie('width',sidenavWidth, null); +} + +function restoreWidth(navWidth) +{ + var windowWidth = $(window).width() + "px"; + content.css({marginLeft:parseInt(navWidth)+6+"px"}); + sidenav.css({width:navWidth + "px"}); +} + +function resizeHeight() +{ + var headerHeight = header.height(); + var footerHeight = footer.height(); + var windowHeight = $(window).height() - headerHeight - footerHeight; + content.css({height:windowHeight + "px"}); + navtree.css({height:windowHeight + "px"}); + sidenav.css({height:windowHeight + "px",top: headerHeight+"px"}); +} + +function initResizable() +{ + header = $("#top"); + sidenav = $("#side-nav"); + content = $("#doc-content"); + navtree = $("#nav-tree"); + footer = $("#nav-path"); + $(".side-nav-resizable").resizable({resize: function(e, ui) { resizeWidth(); } }); + $(window).resize(function() { resizeHeight(); }); + var width = readCookie('width'); + if (width) { restoreWidth(width); } else { resizeWidth(); } + resizeHeight(); + var url = location.href; + var i=url.indexOf("#"); + if (i>=0) window.location.hash=url.substr(i); + var _preventDefault = function(evt) { evt.preventDefault(); }; + $("#splitbar").bind("dragstart", _preventDefault).bind("selectstart", _preventDefault); +} + + diff --git a/flex-bison/mark1/docs/html/search/all_5f.html b/flex-bison/mark1/docs/html/search/all_5f.html new file mode 100644 index 0000000..43eeddd --- /dev/null +++ b/flex-bison/mark1/docs/html/search/all_5f.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ _ABS + common.h +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/all_61.html b/flex-bison/mark1/docs/html/search/all_61.html new file mode 100644 index 0000000..2f609d7 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/all_61.html @@ -0,0 +1,76 @@ + + + + + + + +
+
Loading...
+
+
+ ABS + common.h +
+
+
+
+ ADD + il_opcodes.h +
+
+
+
+ AND + il_opcodes.h +
+
+
+
+ ARRAY + il_opcodes.h +
+
+
+
+ ASSIGN + il_opcodes.h +
+
+
+
+ ast + ParserContext_T +
+
+
+
+ ast.c +
+
+
+
+ ast.h +
+
+
+ +
+
+ +
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/all_62.html b/flex-bison/mark1/docs/html/search/all_62.html new file mode 100644 index 0000000..45ff189 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/all_62.html @@ -0,0 +1,239 @@ + + + + + + + +
+
Loading...
+
+
+ BEGIN + lex.yy.c +
+
+
+
+ BIT_0 + common.h +
+
+
+
+ BIT_1 + common.h +
+
+
+
+ BIT_10 + common.h +
+
+
+
+ BIT_11 + common.h +
+
+
+
+ BIT_12 + common.h +
+
+
+
+ BIT_13 + common.h +
+
+
+
+ BIT_14 + common.h +
+
+
+
+ BIT_15 + common.h +
+
+
+
+ BIT_16 + common.h +
+
+
+
+ BIT_17 + common.h +
+
+
+
+ BIT_18 + common.h +
+
+
+
+ BIT_19 + common.h +
+
+
+
+ BIT_2 + common.h +
+
+
+
+ BIT_20 + common.h +
+
+
+
+ BIT_21 + common.h +
+
+
+
+ BIT_22 + common.h +
+
+
+
+ BIT_23 + common.h +
+
+
+
+ BIT_24 + common.h +
+
+
+
+ BIT_25 + common.h +
+
+
+
+ BIT_26 + common.h +
+
+
+
+ BIT_27 + common.h +
+
+
+
+ BIT_28 + common.h +
+
+
+
+ BIT_29 + common.h +
+
+
+
+ BIT_3 + common.h +
+
+
+
+ BIT_30 + common.h +
+
+
+
+ BIT_31 + common.h +
+
+
+
+ BIT_4 + common.h +
+
+
+
+ BIT_5 + common.h +
+
+
+
+ BIT_6 + common.h +
+
+
+
+ BIT_7 + common.h +
+
+
+
+ BIT_8 + common.h +
+
+
+
+ BIT_9 + common.h +
+
+
+
+ BOOL + common.h +
+
+ +
+
+ BuildFileList + cl_options.c +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/all_63.html b/flex-bison/mark1/docs/html/search/all_63.html new file mode 100644 index 0000000..9fb3d87 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/all_63.html @@ -0,0 +1,119 @@ + + + + + + + + + + diff --git a/flex-bison/mark1/docs/html/search/all_64.html b/flex-bison/mark1/docs/html/search/all_64.html new file mode 100644 index 0000000..4c93c22 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/all_64.html @@ -0,0 +1,92 @@ + + + + + + + +
+
Loading...
+
+
+ dbg.c +
+
+
+
+ dbg.h +
+
+ + +
+
+ DBG_WATCH + dbg.h +
+
+
+
+ DEBUG + dbg.h +
+
+
+
+ DebugASM + cl_options.c +
+
+
+
+ DebugAST + cl_options.c +
+
+
+
+ DebugTAC + cl_options.c +
+
+
+
+ display_txt + OpcodeInfo_T +
+
+
+
+ DIV + il_opcodes.h +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/all_65.html b/flex-bison/mark1/docs/html/search/all_65.html new file mode 100644 index 0000000..f1d2926 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/all_65.html @@ -0,0 +1,50 @@ + + + + + + + +
+
Loading...
+
+
+ ECHO + lex.yy.c +
+
+
+
+ EOB_ACT_CONTINUE_SCAN + lex.yy.c +
+
+
+
+ EOB_ACT_END_OF_FILE + lex.yy.c +
+
+
+
+ EOB_ACT_LAST_MATCH + lex.yy.c +
+
+
+
+ EQ + il_opcodes.h +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/all_66.html b/flex-bison/mark1/docs/html/search/all_66.html new file mode 100644 index 0000000..ce63bb3 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/all_66.html @@ -0,0 +1,137 @@ + + + + + + + +
+
Loading...
+
+
+ F32 + common.h +
+
+
+
+ F64 + common.h +
+
+
+
+ FALSE + common.h +
+
+
+
+ FileList + cl_options.c +
+
+
+
+ FLEX_BETA + lex.yy.c +
+
+ + + + + + + + + +
+
+ FUNC + il_opcodes.h +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/all_67.html b/flex-bison/mark1/docs/html/search/all_67.html new file mode 100644 index 0000000..489d9bf --- /dev/null +++ b/flex-bison/mark1/docs/html/search/all_67.html @@ -0,0 +1,42 @@ + + + + + + + +
+
Loading...
+
+ +
+
+ +
+
+
+ GT + il_opcodes.h +
+
+
+
+ GTE + il_opcodes.h +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/all_68.html b/flex-bison/mark1/docs/html/search/all_68.html new file mode 100644 index 0000000..06afd9c --- /dev/null +++ b/flex-bison/mark1/docs/html/search/all_68.html @@ -0,0 +1,56 @@ + + + + + + + +
+
Loading...
+
+
+ HandleLongOption + cl_options.c +
+
+
+
+ HandleShortOption + cl_options.c +
+
+
+
+ HasChildren + ast_debug.c +
+
+
+
+ Help_String + cl_options.c +
+
+
+
+ HIGH_BYTE + common.h +
+
+
+
+ HIGH_WORD + common.h +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/all_69.html b/flex-bison/mark1/docs/html/search/all_69.html new file mode 100644 index 0000000..b1b7533 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/all_69.html @@ -0,0 +1,159 @@ + + + + + + + +
+
Loading...
+
+
+ ID + il_opcodes.h +
+
+
+
+ IDX_DEBUG_ASM + cl_options.c +
+
+
+
+ IDX_DEBUG_AST + cl_options.c +
+
+
+
+ IDX_DEBUG_TAC + cl_options.c +
+
+
+
+ IDX_HELP + cl_options.c +
+
+ + + +
+ +
+
+ +
+
+
+ INITIAL + lex.yy.c +
+
+
+
+ INT + il_opcodes.h +
+
+ + + + + + +
+
+ Integer + Value_T +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/all_6c.html b/flex-bison/mark1/docs/html/search/all_6c.html new file mode 100644 index 0000000..c4fa685 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/all_6c.html @@ -0,0 +1,162 @@ + + + + + + + +
+
Loading...
+
+
+ lex.yy.c +
+
+
+
+ lex.yy.h +
+
+
+
+ lexinfo + ParserContext_T +
+
+
+
+ LIMIT_RANGE + common.h +
+
+
+ +
+
+ +
+
+ +
+
+
+ LinkedList_T + linked_list.h +
+
+ + +
+
+ LL_FOREACH + linked_list.h +
+
+ + + + + +
+
+ Long_Options + cl_options.c +
+
+
+
+ LOW_BYTE + common.h +
+
+
+
+ LOW_WORD + common.h +
+
+
+
+ LT + il_opcodes.h +
+
+
+
+ LTE + il_opcodes.h +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/all_6d.html b/flex-bison/mark1/docs/html/search/all_6d.html new file mode 100644 index 0000000..58eae28 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/all_6d.html @@ -0,0 +1,67 @@ + + + + + + + +
+
Loading...
+
+
+ macro_txt + OpcodeInfo_T +
+
+
+
+ main + main.c +
+
+
+
+ main.c +
+
+
+
+ MAP + il_opcodes.h +
+
+
+
+ MAX + common.h +
+
+
+
+ MIN + common.h +
+
+
+
+ MOD + il_opcodes.h +
+
+
+
+ MUL + il_opcodes.h +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/all_6e.html b/flex-bison/mark1/docs/html/search/all_6e.html new file mode 100644 index 0000000..b85450e --- /dev/null +++ b/flex-bison/mark1/docs/html/search/all_6e.html @@ -0,0 +1,95 @@ + + + + + + + +
+
Loading...
+
+
+ NE + il_opcodes.h +
+
+
+
+ next + LinkedList +
+
+ + +
+
+ Node_T +
+
+ +
+
+ NodeType_T + ast.h +
+
+
+
+ NOT + il_opcodes.h +
+
+
+
+ NULL + common.h +
+
+
+
+ NULL_PTR + common.h +
+
+
+
+ NUM_ELEMENTS + common.h +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/all_6f.html b/flex-bison/mark1/docs/html/search/all_6f.html new file mode 100644 index 0000000..0ef792a --- /dev/null +++ b/flex-bison/mark1/docs/html/search/all_6f.html @@ -0,0 +1,49 @@ + + + + + + + +
+
Loading...
+
+
+ opcode + OpcodeInfo_T +
+
+
+
+ Opcode_Info_Lookup + il_opcodes.c +
+
+
+
+ Opcode_T + il_opcodes.h +
+
+
+ +
+
+
+ OR + il_opcodes.h +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/all_70.html b/flex-bison/mark1/docs/html/search/all_70.html new file mode 100644 index 0000000..de085fb --- /dev/null +++ b/flex-bison/mark1/docs/html/search/all_70.html @@ -0,0 +1,83 @@ + + + + + + + +
+
Loading...
+
+
+ parser.c +
+
+
+
+ parser.h +
+
+ +
+
+ Parser_ParseInput + parser.c +
+
+ + +
+
+ PrintChildNode + ast_debug.c +
+
+
+
+ PrintNode + ast_debug.c +
+
+
+
+ PrintNodeDefinition + ast_debug.c +
+
+
+
+ PTR_TYPE + linked_list.h +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/all_71.html b/flex-bison/mark1/docs/html/search/all_71.html new file mode 100644 index 0000000..c8a787a --- /dev/null +++ b/flex-bison/mark1/docs/html/search/all_71.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ QUOTE + common.h +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/all_72.html b/flex-bison/mark1/docs/html/search/all_72.html new file mode 100644 index 0000000..ff25fc2 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/all_72.html @@ -0,0 +1,32 @@ + + + + + + + +
+
Loading...
+
+
+ REJECT + lex.yy.c +
+
+
+
+ ROOT + il_opcodes.h +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/all_73.html b/flex-bison/mark1/docs/html/search/all_73.html new file mode 100644 index 0000000..3959d87 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/all_73.html @@ -0,0 +1,78 @@ + + + + + + + +
+
Loading...
+
+
+ S16 + common.h +
+
+
+
+ S32 + common.h +
+
+
+
+ S64 + common.h +
+
+
+
+ S8 + common.h +
+
+
+
+ Short_Options + cl_options.c +
+
+
+
+ SIGN + common.h +
+
+
+
+ STATIC + common.h +
+
+ +
+
+ SUB + il_opcodes.h +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/all_74.html b/flex-bison/mark1/docs/html/search/all_74.html new file mode 100644 index 0000000..32e5072 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/all_74.html @@ -0,0 +1,149 @@ + + + + + + + +
+
Loading...
+ + + +
+
+ TERN + il_opcodes.h +
+
+ + + + + + + + + +
+
+ TRUE + common.h +
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/all_75.html b/flex-bison/mark1/docs/html/search/all_75.html new file mode 100644 index 0000000..7951358 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/all_75.html @@ -0,0 +1,71 @@ + + + + + + + +
+
Loading...
+
+
+ U16 + common.h +
+
+
+
+ U32 + common.h +
+
+
+
+ U8 + common.h +
+
+ + + +
+
+ unput + lex.yy.c +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/all_76.html b/flex-bison/mark1/docs/html/search/all_76.html new file mode 100644 index 0000000..4e7b859 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/all_76.html @@ -0,0 +1,96 @@ + + + + + + + +
+
Loading...
+ + + + +
+
+ value + ValueNode_T +
+
+
+
+ Value_T +
+
+
+ +
+
+
+ VERIFY_MAX_VALUE + common.h +
+
+
+
+ VERIFY_MIN_VALUE + common.h +
+
+
+
+ VERIFY_RANGE + common.h +
+
+
+
+ VERIFY_RANGE_VALUE + common.h +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/all_79.html b/flex-bison/mark1/docs/html/search/all_79.html new file mode 100644 index 0000000..76753c5 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/all_79.html @@ -0,0 +1,1465 @@ + + + + + + + +
+
Loading...
+
+
+ YY_ + grammar.tab.c +
+
+ +
+
+ YY_BREAK + lex.yy.c +
+
+
+
+ yy_bs_column + yy_buffer_state +
+
+
+
+ yy_bs_lineno + yy_buffer_state +
+
+
+
+ yy_buf_pos + yy_buffer_state +
+
+ +
+
+ YY_BUFFER_EOF_PENDING + lex.yy.c +
+
+
+
+ YY_BUFFER_NEW + lex.yy.c +
+
+
+
+ YY_BUFFER_NORMAL + lex.yy.c +
+
+
+
+ yy_buffer_stack + yyguts_t +
+
+
+
+ yy_buffer_stack_max + yyguts_t +
+
+
+
+ yy_buffer_stack_top + yyguts_t +
+
+ +
+
+ yy_buffer_status + yy_buffer_state +
+
+
+
+ yy_c_buf_p + yyguts_t +
+
+
+
+ yy_ch_buf + yy_buffer_state +
+
+
+
+ YY_CHAR + lex.yy.c +
+
+ +
+
+ YY_CURRENT_BUFFER + lex.yy.c +
+
+
+
+ YY_CURRENT_BUFFER_LVALUE + lex.yy.c +
+
+ + + +
+ +
+
+
+ YY_DO_BEFORE_ACTION + lex.yy.c +
+
+
+
+ YY_END_OF_BUFFER + lex.yy.c +
+
+
+
+ YY_END_OF_BUFFER_CHAR + lex.yy.c +
+
+
+
+ YY_EXIT_FAILURE + lex.yy.c +
+
+ +
+
+ YY_FATAL_ERROR + lex.yy.c +
+
+
+
+ yy_fill_buffer + yy_buffer_state +
+
+ +
+
+ yy_flex_debug_r + yyguts_t +
+
+ + + + +
+
+ yy_hold_char + yyguts_t +
+
+
+
+ yy_init + yyguts_t +
+
+
+
+ YY_INPUT + lex.yy.c +
+
+
+
+ yy_input_file + yy_buffer_state +
+
+ +
+
+ yy_is_interactive + yy_buffer_state +
+
+
+
+ yy_is_our_buffer + yy_buffer_state +
+
+
+
+ yy_last_accepting_cpos + yyguts_t +
+
+
+
+ yy_last_accepting_state + yyguts_t +
+
+
+
+ YY_LESS_LINENO + lex.yy.c +
+
+
+
+ YY_LOCATION_PRINT + grammar.tab.c +
+
+
+
+ YY_MORE_ADJ + lex.yy.c +
+
+
+
+ yy_more_flag + yyguts_t +
+
+
+
+ yy_more_len + yyguts_t +
+
+ +
+
+ yy_new_buffer + lex.yy.c +
+
+
+
+ YY_NEW_FILE + lex.yy.c +
+
+
+
+ YY_NO_INPUT + lex.yy.c +
+
+
+
+ YY_NULL + lex.yy.c +
+
+
+
+ YY_NUM_RULES + lex.yy.c +
+
+
+
+ yy_nxt + yy_trans_info +
+
+ +
+
+ YY_REDUCE_PRINT + grammar.tab.c +
+
+
+
+ YY_RESTORE_YY_MORE_OFFSET + lex.yy.c +
+
+
+
+ YY_RULE_SETUP + lex.yy.c +
+
+
+
+ YY_SC_TO_UI + lex.yy.c +
+
+ + + +
+
+ yy_set_bol + lex.yy.c +
+
+
+
+ yy_set_interactive + lex.yy.c +
+
+ + +
+
+ YY_STACK_PRINT + grammar.tab.c +
+
+ +
+
+ yy_start_stack + yyguts_t +
+
+
+
+ yy_start_stack_depth + yyguts_t +
+
+ +
+
+ yy_start_stack_ptr + yyguts_t +
+
+
+
+ YY_STATE_BUF_SIZE + lex.yy.c +
+
+
+
+ YY_STATE_EOF + lex.yy.c +
+
+
+
+ yy_state_type + lex.yy.c +
+
+ + +
+
+ YY_SYMBOL_PRINT + grammar.tab.c +
+
+
+ +
+ + + +
+
+ YY_USER_ACTION + lex.yy.c +
+
+
+
+ yy_verify + yy_trans_info +
+
+
+
+ YYABORT + grammar.tab.c +
+
+
+
+ YYACCEPT + grammar.tab.c +
+
+ +
+
+ YYBACKUP + grammar.tab.c +
+
+
+
+ YYBISON + grammar.tab.c +
+
+
+
+ YYBISON_VERSION + grammar.tab.c +
+
+
+
+ yyclearin + grammar.tab.c +
+
+ + +
+
+ YYCOPY + grammar.tab.c +
+
+
+
+ YYDEBUG + grammar.tab.c +
+
+
+
+ YYDPRINTF + grammar.tab.c +
+
+
+
+ YYEMPTY + grammar.tab.c +
+
+
+
+ YYEOF + grammar.tab.c +
+
+
+
+ YYERRCODE + grammar.tab.c +
+
+
+
+ yyerrok + grammar.tab.c +
+
+ +
+
+ YYERROR_VERBOSE + grammar.tab.c +
+
+ +
+
+ yyextra_r + yyguts_t +
+
+
+
+ YYFAIL + grammar.tab.c +
+
+
+
+ YYFINAL + grammar.tab.c +
+
+ +
+
+ yyget_column + lex.yy.c +
+
+ + + + + + + + +
+
+ yyguts_t +
+
+
+
+ YYID + grammar.tab.c +
+
+ +
+
+ yyIN_HEADER + lex.yy.h +
+
+
+
+ yyin_r + yyguts_t +
+
+
+
+ YYINITDEPTH + grammar.tab.c +
+
+
+
+ YYLAST + grammar.tab.c +
+
+ +
+
+ yyleng_r + yyguts_t +
+
+ + + + + +
+
+ YYLEX_PARAM + grammar.tab.c +
+
+ +
+
+ yylineno_r + yyguts_t +
+
+
+
+ YYLLOC_DEFAULT + grammar.tab.c +
+
+
+
+ YYLSP_NEEDED + grammar.tab.c +
+
+
+
+ yylval + lex.yy.c +
+
+
+
+ yylval_r + yyguts_t +
+
+
+
+ YYMALLOC + grammar.tab.c +
+
+
+
+ YYMAXDEPTH + grammar.tab.c +
+
+
+
+ YYMAXUTOK + grammar.tab.c +
+
+
+
+ yymore + lex.yy.c +
+
+
+
+ YYNNTS + grammar.tab.c +
+
+
+
+ YYNRULES + grammar.tab.c +
+
+
+
+ YYNSTATES + grammar.tab.c +
+
+
+
+ YYNTOKENS + grammar.tab.c +
+
+ +
+
+ yyout_r + yyguts_t +
+
+
+
+ YYPACT_NINF + grammar.tab.c +
+
+ + +
+
+ YYPOPSTACK + grammar.tab.c +
+
+
+
+ YYPULL + grammar.tab.c +
+
+
+
+ YYPURE + grammar.tab.c +
+
+
+
+ YYPUSH + grammar.tab.c +
+
+ + +
+
+ YYRECOVERING + grammar.tab.c +
+
+ +
+
+ YYRHSLOC + grammar.tab.c +
+
+ +
+
+ yyset_column + lex.yy.c +
+
+ + + + + + +
+
+ YYSIZE_MAXIMUM + grammar.tab.c +
+
+
+
+ YYSIZE_T + grammar.tab.c +
+
+
+
+ YYSKELETON_NAME + grammar.tab.c +
+
+
+
+ yyss_alloc + yyalloc +
+
+
+
+ YYSTACK_ALLOC + grammar.tab.c +
+
+
+
+ YYSTACK_ALLOC_MAXIMUM + grammar.tab.c +
+
+
+
+ YYSTACK_BYTES + grammar.tab.c +
+
+
+
+ YYSTACK_FREE + grammar.tab.c +
+
+
+
+ YYSTACK_GAP_MAXIMUM + grammar.tab.c +
+
+
+
+ YYSTACK_RELOCATE + grammar.tab.c +
+
+
+
+ YYSTATE + lex.yy.c +
+
+ + + +
+
+ YYTABLE_NINF + grammar.tab.c +
+
+
+
+ YYTABLES_NAME + lex.yy.c +
+
+
+
+ yyterminate + lex.yy.c +
+
+
+
+ YYTERROR + grammar.tab.c +
+
+ + +
+
+ yytext_r + yyguts_t +
+
+
+
+ YYTOKEN_TABLE + grammar.tab.c +
+
+ +
+
+ YYTRANSLATE + grammar.tab.c +
+
+
+
+ yytype_int16 + grammar.tab.c +
+
+
+
+ yytype_int8 + grammar.tab.c +
+
+
+
+ yytype_uint16 + grammar.tab.c +
+
+
+
+ yytype_uint8 + grammar.tab.c +
+
+
+
+ YYUNDEFTOK + grammar.tab.c +
+
+
+
+ YYUSE + grammar.tab.c +
+
+
+
+ yyvs_alloc + yyalloc +
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/classes_6c.html b/flex-bison/mark1/docs/html/search/classes_6c.html new file mode 100644 index 0000000..ae10375 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/classes_6c.html @@ -0,0 +1,25 @@ + + + + + + + +
+
Loading...
+
+ +
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/classes_6e.html b/flex-bison/mark1/docs/html/search/classes_6e.html new file mode 100644 index 0000000..922898f --- /dev/null +++ b/flex-bison/mark1/docs/html/search/classes_6e.html @@ -0,0 +1,25 @@ + + + + + + + +
+
Loading...
+
+
+ Node_T +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/classes_6f.html b/flex-bison/mark1/docs/html/search/classes_6f.html new file mode 100644 index 0000000..55615da --- /dev/null +++ b/flex-bison/mark1/docs/html/search/classes_6f.html @@ -0,0 +1,25 @@ + + + + + + + +
+
Loading...
+
+ +
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/classes_70.html b/flex-bison/mark1/docs/html/search/classes_70.html new file mode 100644 index 0000000..7453f3a --- /dev/null +++ b/flex-bison/mark1/docs/html/search/classes_70.html @@ -0,0 +1,25 @@ + + + + + + + +
+
Loading...
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/classes_76.html b/flex-bison/mark1/docs/html/search/classes_76.html new file mode 100644 index 0000000..cc6da07 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/classes_76.html @@ -0,0 +1,30 @@ + + + + + + + +
+
Loading...
+
+
+ Value_T +
+
+
+ +
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/classes_79.html b/flex-bison/mark1/docs/html/search/classes_79.html new file mode 100644 index 0000000..db4e00e --- /dev/null +++ b/flex-bison/mark1/docs/html/search/classes_79.html @@ -0,0 +1,45 @@ + + + + + + + +
+
Loading...
+ +
+ +
+
+
+ yyalloc +
+
+
+
+ yyguts_t +
+
+
+
+ YYSTYPE +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/close.png b/flex-bison/mark1/docs/html/search/close.png new file mode 100644 index 0000000..9342d3d Binary files /dev/null and b/flex-bison/mark1/docs/html/search/close.png differ diff --git a/flex-bison/mark1/docs/html/search/defines_5f.html b/flex-bison/mark1/docs/html/search/defines_5f.html new file mode 100644 index 0000000..43eeddd --- /dev/null +++ b/flex-bison/mark1/docs/html/search/defines_5f.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ _ABS + common.h +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/defines_61.html b/flex-bison/mark1/docs/html/search/defines_61.html new file mode 100644 index 0000000..9b7b7d2 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/defines_61.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ ABS + common.h +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/defines_62.html b/flex-bison/mark1/docs/html/search/defines_62.html new file mode 100644 index 0000000..ce4a5f2 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/defines_62.html @@ -0,0 +1,218 @@ + + + + + + + +
+
Loading...
+
+
+ BEGIN + lex.yy.c +
+
+
+
+ BIT_0 + common.h +
+
+
+
+ BIT_1 + common.h +
+
+
+
+ BIT_10 + common.h +
+
+
+
+ BIT_11 + common.h +
+
+
+
+ BIT_12 + common.h +
+
+
+
+ BIT_13 + common.h +
+
+
+
+ BIT_14 + common.h +
+
+
+
+ BIT_15 + common.h +
+
+
+
+ BIT_16 + common.h +
+
+
+
+ BIT_17 + common.h +
+
+
+
+ BIT_18 + common.h +
+
+
+
+ BIT_19 + common.h +
+
+
+
+ BIT_2 + common.h +
+
+
+
+ BIT_20 + common.h +
+
+
+
+ BIT_21 + common.h +
+
+
+
+ BIT_22 + common.h +
+
+
+
+ BIT_23 + common.h +
+
+
+
+ BIT_24 + common.h +
+
+
+
+ BIT_25 + common.h +
+
+
+
+ BIT_26 + common.h +
+
+
+
+ BIT_27 + common.h +
+
+
+
+ BIT_28 + common.h +
+
+
+
+ BIT_29 + common.h +
+
+
+
+ BIT_3 + common.h +
+
+
+
+ BIT_30 + common.h +
+
+
+
+ BIT_31 + common.h +
+
+
+
+ BIT_4 + common.h +
+
+
+
+ BIT_5 + common.h +
+
+
+
+ BIT_6 + common.h +
+
+
+
+ BIT_7 + common.h +
+
+
+
+ BIT_8 + common.h +
+
+
+
+ BIT_9 + common.h +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/defines_64.html b/flex-bison/mark1/docs/html/search/defines_64.html new file mode 100644 index 0000000..7645b64 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/defines_64.html @@ -0,0 +1,44 @@ + + + + + + + +
+
Loading...
+
+
+ DBG_ASSERT + dbg.h +
+
+
+
+ DBG_BREAKPOINT + dbg.h +
+
+
+
+ DBG_WATCH + dbg.h +
+
+
+
+ DEBUG + dbg.h +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/defines_65.html b/flex-bison/mark1/docs/html/search/defines_65.html new file mode 100644 index 0000000..dfe8ec0 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/defines_65.html @@ -0,0 +1,44 @@ + + + + + + + +
+
Loading...
+
+
+ ECHO + lex.yy.c +
+
+
+
+ EOB_ACT_CONTINUE_SCAN + lex.yy.c +
+
+
+
+ EOB_ACT_END_OF_FILE + lex.yy.c +
+
+
+
+ EOB_ACT_LAST_MATCH + lex.yy.c +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/defines_66.html b/flex-bison/mark1/docs/html/search/defines_66.html new file mode 100644 index 0000000..08773dd --- /dev/null +++ b/flex-bison/mark1/docs/html/search/defines_66.html @@ -0,0 +1,44 @@ + + + + + + + +
+
Loading...
+
+
+ FLEX_BETA + lex.yy.c +
+
+ + +
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/defines_68.html b/flex-bison/mark1/docs/html/search/defines_68.html new file mode 100644 index 0000000..e8f0874 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/defines_68.html @@ -0,0 +1,32 @@ + + + + + + + +
+
Loading...
+
+
+ HIGH_BYTE + common.h +
+
+
+
+ HIGH_WORD + common.h +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/defines_69.html b/flex-bison/mark1/docs/html/search/defines_69.html new file mode 100644 index 0000000..6b76238 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/defines_69.html @@ -0,0 +1,104 @@ + + + + + + + +
+
Loading...
+
+
+ IDX_DEBUG_ASM + cl_options.c +
+
+
+
+ IDX_DEBUG_AST + cl_options.c +
+
+
+
+ IDX_DEBUG_TAC + cl_options.c +
+
+
+
+ IDX_HELP + cl_options.c +
+
+
+
+ INITIAL + lex.yy.c +
+
+ + + + + + +
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/defines_6c.html b/flex-bison/mark1/docs/html/search/defines_6c.html new file mode 100644 index 0000000..0de769a --- /dev/null +++ b/flex-bison/mark1/docs/html/search/defines_6c.html @@ -0,0 +1,44 @@ + + + + + + + +
+
Loading...
+
+
+ LIMIT_RANGE + common.h +
+
+
+
+ LL_FOREACH + linked_list.h +
+
+
+
+ LOW_BYTE + common.h +
+
+
+
+ LOW_WORD + common.h +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/defines_6d.html b/flex-bison/mark1/docs/html/search/defines_6d.html new file mode 100644 index 0000000..3bdbc3b --- /dev/null +++ b/flex-bison/mark1/docs/html/search/defines_6d.html @@ -0,0 +1,32 @@ + + + + + + + +
+
Loading...
+
+
+ MAX + common.h +
+
+
+
+ MIN + common.h +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/defines_6e.html b/flex-bison/mark1/docs/html/search/defines_6e.html new file mode 100644 index 0000000..2ce3bfe --- /dev/null +++ b/flex-bison/mark1/docs/html/search/defines_6e.html @@ -0,0 +1,38 @@ + + + + + + + +
+
Loading...
+
+
+ NULL + common.h +
+
+
+
+ NULL_PTR + common.h +
+
+
+
+ NUM_ELEMENTS + common.h +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/defines_70.html b/flex-bison/mark1/docs/html/search/defines_70.html new file mode 100644 index 0000000..4df509d --- /dev/null +++ b/flex-bison/mark1/docs/html/search/defines_70.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ PTR_TYPE + linked_list.h +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/defines_71.html b/flex-bison/mark1/docs/html/search/defines_71.html new file mode 100644 index 0000000..c8a787a --- /dev/null +++ b/flex-bison/mark1/docs/html/search/defines_71.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ QUOTE + common.h +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/defines_72.html b/flex-bison/mark1/docs/html/search/defines_72.html new file mode 100644 index 0000000..db5a108 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/defines_72.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ REJECT + lex.yy.c +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/defines_73.html b/flex-bison/mark1/docs/html/search/defines_73.html new file mode 100644 index 0000000..5ef20a4 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/defines_73.html @@ -0,0 +1,32 @@ + + + + + + + +
+
Loading...
+
+
+ SIGN + common.h +
+
+
+
+ STATIC + common.h +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/defines_75.html b/flex-bison/mark1/docs/html/search/defines_75.html new file mode 100644 index 0000000..efe6cc6 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/defines_75.html @@ -0,0 +1,53 @@ + + + + + + + +
+
Loading...
+ + + +
+
+ unput + lex.yy.c +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/defines_76.html b/flex-bison/mark1/docs/html/search/defines_76.html new file mode 100644 index 0000000..1282e08 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/defines_76.html @@ -0,0 +1,44 @@ + + + + + + + +
+
Loading...
+
+
+ VERIFY_MAX_VALUE + common.h +
+
+
+
+ VERIFY_MIN_VALUE + common.h +
+
+
+
+ VERIFY_RANGE + common.h +
+
+
+
+ VERIFY_RANGE_VALUE + common.h +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/defines_79.html b/flex-bison/mark1/docs/html/search/defines_79.html new file mode 100644 index 0000000..83e41fa --- /dev/null +++ b/flex-bison/mark1/docs/html/search/defines_79.html @@ -0,0 +1,866 @@ + + + + + + + +
+
Loading...
+
+
+ YY_ + grammar.tab.c +
+
+
+
+ YY_AT_BOL + lex.yy.c +
+
+
+
+ YY_BREAK + lex.yy.c +
+
+ +
+
+ YY_BUFFER_EOF_PENDING + lex.yy.c +
+
+
+
+ YY_BUFFER_NEW + lex.yy.c +
+
+
+
+ YY_BUFFER_NORMAL + lex.yy.c +
+
+
+
+ YY_CURRENT_BUFFER + lex.yy.c +
+
+
+
+ YY_CURRENT_BUFFER_LVALUE + lex.yy.c +
+
+ + +
+
+ YY_DO_BEFORE_ACTION + lex.yy.c +
+
+
+
+ YY_END_OF_BUFFER + lex.yy.c +
+
+
+
+ YY_END_OF_BUFFER_CHAR + lex.yy.c +
+
+
+
+ YY_EXIT_FAILURE + lex.yy.c +
+
+ +
+
+ YY_FATAL_ERROR + lex.yy.c +
+
+ + + + +
+
+ YY_FLUSH_BUFFER + lex.yy.c +
+
+
+
+ YY_INPUT + lex.yy.c +
+
+ +
+
+ YY_LESS_LINENO + lex.yy.c +
+
+
+
+ YY_LOCATION_PRINT + grammar.tab.c +
+
+
+
+ YY_MORE_ADJ + lex.yy.c +
+
+
+
+ yy_new_buffer + lex.yy.c +
+
+
+
+ YY_NEW_FILE + lex.yy.c +
+
+
+
+ YY_NO_INPUT + lex.yy.c +
+
+
+
+ YY_NULL + lex.yy.c +
+
+
+
+ YY_NUM_RULES + lex.yy.c +
+
+ +
+
+ YY_REDUCE_PRINT + grammar.tab.c +
+
+
+
+ YY_RESTORE_YY_MORE_OFFSET + lex.yy.c +
+
+
+
+ YY_RULE_SETUP + lex.yy.c +
+
+
+
+ YY_SC_TO_UI + lex.yy.c +
+
+
+
+ yy_set_bol + lex.yy.c +
+
+
+
+ yy_set_interactive + lex.yy.c +
+
+ +
+
+ YY_STACK_PRINT + grammar.tab.c +
+
+
+
+ YY_START + lex.yy.c +
+
+ +
+
+ YY_STATE_BUF_SIZE + lex.yy.c +
+
+
+
+ YY_STATE_EOF + lex.yy.c +
+
+ +
+
+ YY_SYMBOL_PRINT + grammar.tab.c +
+
+ + + +
+
+ YY_USER_ACTION + lex.yy.c +
+
+
+
+ YYABORT + grammar.tab.c +
+
+
+
+ YYACCEPT + grammar.tab.c +
+
+
+
+ YYBACKUP + grammar.tab.c +
+
+
+
+ YYBISON + grammar.tab.c +
+
+
+
+ YYBISON_VERSION + grammar.tab.c +
+
+
+
+ yyclearin + grammar.tab.c +
+
+ + +
+
+ YYCOPY + grammar.tab.c +
+
+
+
+ YYDEBUG + grammar.tab.c +
+
+
+
+ YYDPRINTF + grammar.tab.c +
+
+
+
+ YYEMPTY + grammar.tab.c +
+
+
+
+ YYEOF + grammar.tab.c +
+
+
+
+ YYERRCODE + grammar.tab.c +
+
+
+
+ yyerrok + grammar.tab.c +
+
+
+
+ YYERROR + grammar.tab.c +
+
+
+
+ YYERROR_VERBOSE + grammar.tab.c +
+
+ +
+
+ YYFAIL + grammar.tab.c +
+
+
+
+ YYFINAL + grammar.tab.c +
+
+
+
+ YYFREE + grammar.tab.c +
+
+
+
+ YYID + grammar.tab.c +
+
+ +
+
+ yyIN_HEADER + lex.yy.h +
+
+
+
+ YYINITDEPTH + grammar.tab.c +
+
+
+
+ YYLAST + grammar.tab.c +
+
+ + +
+
+ YYLEX + grammar.tab.c +
+
+
+
+ YYLEX_PARAM + grammar.tab.c +
+
+ +
+
+ YYLLOC_DEFAULT + grammar.tab.c +
+
+
+
+ YYLSP_NEEDED + grammar.tab.c +
+
+
+
+ yylval + lex.yy.c +
+
+
+
+ YYMALLOC + grammar.tab.c +
+
+
+
+ YYMAXDEPTH + grammar.tab.c +
+
+
+
+ YYMAXUTOK + grammar.tab.c +
+
+
+
+ yymore + lex.yy.c +
+
+
+
+ YYNNTS + grammar.tab.c +
+
+
+
+ YYNRULES + grammar.tab.c +
+
+
+
+ YYNSTATES + grammar.tab.c +
+
+
+
+ YYNTOKENS + grammar.tab.c +
+
+ +
+
+ YYPACT_NINF + grammar.tab.c +
+
+
+
+ YYPOPSTACK + grammar.tab.c +
+
+
+
+ YYPULL + grammar.tab.c +
+
+
+
+ YYPURE + grammar.tab.c +
+
+
+
+ YYPUSH + grammar.tab.c +
+
+
+
+ YYRECOVERING + grammar.tab.c +
+
+
+
+ YYRHSLOC + grammar.tab.c +
+
+
+
+ YYSIZE_MAXIMUM + grammar.tab.c +
+
+
+
+ YYSIZE_T + grammar.tab.c +
+
+
+
+ YYSKELETON_NAME + grammar.tab.c +
+
+
+
+ YYSTACK_ALLOC + grammar.tab.c +
+
+
+
+ YYSTACK_ALLOC_MAXIMUM + grammar.tab.c +
+
+
+
+ YYSTACK_BYTES + grammar.tab.c +
+
+
+
+ YYSTACK_FREE + grammar.tab.c +
+
+
+
+ YYSTACK_GAP_MAXIMUM + grammar.tab.c +
+
+
+
+ YYSTACK_RELOCATE + grammar.tab.c +
+
+
+
+ YYSTATE + lex.yy.c +
+
+ + + +
+
+ YYTABLE_NINF + grammar.tab.c +
+
+
+
+ YYTABLES_NAME + lex.yy.c +
+
+
+
+ yyterminate + lex.yy.c +
+
+
+
+ YYTERROR + grammar.tab.c +
+
+ + +
+
+ YYTOKEN_TABLE + grammar.tab.c +
+
+
+
+ YYTOKENTYPE + grammar.tab.c +
+
+
+
+ YYTRANSLATE + grammar.tab.c +
+
+
+
+ YYUNDEFTOK + grammar.tab.c +
+
+
+
+ YYUSE + grammar.tab.c +
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/enums_62.html b/flex-bison/mark1/docs/html/search/enums_62.html new file mode 100644 index 0000000..aad4552 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/enums_62.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ BOOL + common.h +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/enums_6f.html b/flex-bison/mark1/docs/html/search/enums_6f.html new file mode 100644 index 0000000..876b3df --- /dev/null +++ b/flex-bison/mark1/docs/html/search/enums_6f.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ Opcode_T + il_opcodes.h +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/enums_79.html b/flex-bison/mark1/docs/html/search/enums_79.html new file mode 100644 index 0000000..1c5df26 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/enums_79.html @@ -0,0 +1,29 @@ + + + + + + + +
+
Loading...
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/enumvalues_61.html b/flex-bison/mark1/docs/html/search/enumvalues_61.html new file mode 100644 index 0000000..4a38186 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/enumvalues_61.html @@ -0,0 +1,44 @@ + + + + + + + +
+
Loading...
+
+
+ ADD + il_opcodes.h +
+
+
+
+ AND + il_opcodes.h +
+
+
+
+ ARRAY + il_opcodes.h +
+
+
+
+ ASSIGN + il_opcodes.h +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/enumvalues_62.html b/flex-bison/mark1/docs/html/search/enumvalues_62.html new file mode 100644 index 0000000..a1ecf67 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/enumvalues_62.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ BOOLEAN + il_opcodes.h +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/enumvalues_64.html b/flex-bison/mark1/docs/html/search/enumvalues_64.html new file mode 100644 index 0000000..16f5c31 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/enumvalues_64.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ DIV + il_opcodes.h +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/enumvalues_65.html b/flex-bison/mark1/docs/html/search/enumvalues_65.html new file mode 100644 index 0000000..2d3381e --- /dev/null +++ b/flex-bison/mark1/docs/html/search/enumvalues_65.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ EQ + il_opcodes.h +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/enumvalues_66.html b/flex-bison/mark1/docs/html/search/enumvalues_66.html new file mode 100644 index 0000000..4a16c54 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/enumvalues_66.html @@ -0,0 +1,38 @@ + + + + + + + +
+
Loading...
+
+
+ FALSE + common.h +
+
+
+
+ FLOAT + il_opcodes.h +
+
+
+
+ FUNC + il_opcodes.h +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/enumvalues_67.html b/flex-bison/mark1/docs/html/search/enumvalues_67.html new file mode 100644 index 0000000..68fde70 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/enumvalues_67.html @@ -0,0 +1,32 @@ + + + + + + + +
+
Loading...
+
+
+ GT + il_opcodes.h +
+
+
+
+ GTE + il_opcodes.h +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/enumvalues_69.html b/flex-bison/mark1/docs/html/search/enumvalues_69.html new file mode 100644 index 0000000..658fd71 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/enumvalues_69.html @@ -0,0 +1,32 @@ + + + + + + + +
+
Loading...
+
+
+ ID + il_opcodes.h +
+
+
+
+ INT + il_opcodes.h +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/enumvalues_6c.html b/flex-bison/mark1/docs/html/search/enumvalues_6c.html new file mode 100644 index 0000000..3ef0179 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/enumvalues_6c.html @@ -0,0 +1,32 @@ + + + + + + + +
+
Loading...
+
+
+ LT + il_opcodes.h +
+
+
+
+ LTE + il_opcodes.h +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/enumvalues_6d.html b/flex-bison/mark1/docs/html/search/enumvalues_6d.html new file mode 100644 index 0000000..38b9e03 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/enumvalues_6d.html @@ -0,0 +1,38 @@ + + + + + + + +
+
Loading...
+
+
+ MAP + il_opcodes.h +
+
+
+
+ MOD + il_opcodes.h +
+
+
+
+ MUL + il_opcodes.h +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/enumvalues_6e.html b/flex-bison/mark1/docs/html/search/enumvalues_6e.html new file mode 100644 index 0000000..75617da --- /dev/null +++ b/flex-bison/mark1/docs/html/search/enumvalues_6e.html @@ -0,0 +1,32 @@ + + + + + + + +
+
Loading...
+
+
+ NE + il_opcodes.h +
+
+
+
+ NOT + il_opcodes.h +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/enumvalues_6f.html b/flex-bison/mark1/docs/html/search/enumvalues_6f.html new file mode 100644 index 0000000..bf61f22 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/enumvalues_6f.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ OR + il_opcodes.h +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/enumvalues_72.html b/flex-bison/mark1/docs/html/search/enumvalues_72.html new file mode 100644 index 0000000..9eac08d --- /dev/null +++ b/flex-bison/mark1/docs/html/search/enumvalues_72.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ ROOT + il_opcodes.h +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/enumvalues_73.html b/flex-bison/mark1/docs/html/search/enumvalues_73.html new file mode 100644 index 0000000..d462d92 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/enumvalues_73.html @@ -0,0 +1,32 @@ + + + + + + + +
+
Loading...
+
+
+ STRING + il_opcodes.h +
+
+
+
+ SUB + il_opcodes.h +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/enumvalues_74.html b/flex-bison/mark1/docs/html/search/enumvalues_74.html new file mode 100644 index 0000000..32e5072 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/enumvalues_74.html @@ -0,0 +1,149 @@ + + + + + + + +
+
Loading...
+ + + +
+
+ TERN + il_opcodes.h +
+
+ + + + + + + + + +
+
+ TRUE + common.h +
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/files_61.html b/flex-bison/mark1/docs/html/search/files_61.html new file mode 100644 index 0000000..b4a6521 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/files_61.html @@ -0,0 +1,40 @@ + + + + + + + +
+
Loading...
+
+
+ ast.c +
+
+
+
+ ast.h +
+
+
+ +
+
+ +
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/files_63.html b/flex-bison/mark1/docs/html/search/files_63.html new file mode 100644 index 0000000..c0f6abe --- /dev/null +++ b/flex-bison/mark1/docs/html/search/files_63.html @@ -0,0 +1,35 @@ + + + + + + + +
+
Loading...
+
+ +
+
+ +
+
+
+ common.h +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/files_64.html b/flex-bison/mark1/docs/html/search/files_64.html new file mode 100644 index 0000000..c336ca2 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/files_64.html @@ -0,0 +1,30 @@ + + + + + + + +
+
Loading...
+
+
+ dbg.c +
+
+
+
+ dbg.h +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/files_67.html b/flex-bison/mark1/docs/html/search/files_67.html new file mode 100644 index 0000000..25b4f8c --- /dev/null +++ b/flex-bison/mark1/docs/html/search/files_67.html @@ -0,0 +1,30 @@ + + + + + + + +
+
Loading...
+
+ +
+
+ +
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/files_69.html b/flex-bison/mark1/docs/html/search/files_69.html new file mode 100644 index 0000000..da2488b --- /dev/null +++ b/flex-bison/mark1/docs/html/search/files_69.html @@ -0,0 +1,30 @@ + + + + + + + +
+
Loading...
+
+ +
+
+ +
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/files_6c.html b/flex-bison/mark1/docs/html/search/files_6c.html new file mode 100644 index 0000000..4cf1645 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/files_6c.html @@ -0,0 +1,40 @@ + + + + + + + +
+
Loading...
+
+
+ lex.yy.c +
+
+
+
+ lex.yy.h +
+
+
+ +
+
+ +
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/files_6d.html b/flex-bison/mark1/docs/html/search/files_6d.html new file mode 100644 index 0000000..ba84dcb --- /dev/null +++ b/flex-bison/mark1/docs/html/search/files_6d.html @@ -0,0 +1,25 @@ + + + + + + + +
+
Loading...
+
+
+ main.c +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/files_70.html b/flex-bison/mark1/docs/html/search/files_70.html new file mode 100644 index 0000000..b0ee553 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/files_70.html @@ -0,0 +1,30 @@ + + + + + + + +
+
Loading...
+
+
+ parser.c +
+
+
+
+ parser.h +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/functions_62.html b/flex-bison/mark1/docs/html/search/functions_62.html new file mode 100644 index 0000000..660bf44 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/functions_62.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ BuildFileList + cl_options.c +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/functions_63.html b/flex-bison/mark1/docs/html/search/functions_63.html new file mode 100644 index 0000000..aa12e42 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/functions_63.html @@ -0,0 +1,92 @@ + + + + + + + + + + diff --git a/flex-bison/mark1/docs/html/search/functions_64.html b/flex-bison/mark1/docs/html/search/functions_64.html new file mode 100644 index 0000000..211a1ae --- /dev/null +++ b/flex-bison/mark1/docs/html/search/functions_64.html @@ -0,0 +1,38 @@ + + + + + + + +
+
Loading...
+ + +
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/functions_68.html b/flex-bison/mark1/docs/html/search/functions_68.html new file mode 100644 index 0000000..3eff365 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/functions_68.html @@ -0,0 +1,38 @@ + + + + + + + +
+
Loading...
+
+
+ HandleLongOption + cl_options.c +
+
+
+
+ HandleShortOption + cl_options.c +
+
+
+
+ HasChildren + ast_debug.c +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/functions_69.html b/flex-bison/mark1/docs/html/search/functions_69.html new file mode 100644 index 0000000..88c2ca0 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/functions_69.html @@ -0,0 +1,47 @@ + + + + + + + +
+
Loading...
+ + + +
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/functions_6c.html b/flex-bison/mark1/docs/html/search/functions_6c.html new file mode 100644 index 0000000..da57bed --- /dev/null +++ b/flex-bison/mark1/docs/html/search/functions_6c.html @@ -0,0 +1,83 @@ + + + + + + + + + + diff --git a/flex-bison/mark1/docs/html/search/functions_6d.html b/flex-bison/mark1/docs/html/search/functions_6d.html new file mode 100644 index 0000000..931d960 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/functions_6d.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ main + main.c +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/functions_6e.html b/flex-bison/mark1/docs/html/search/functions_6e.html new file mode 100644 index 0000000..64828de --- /dev/null +++ b/flex-bison/mark1/docs/html/search/functions_6e.html @@ -0,0 +1,38 @@ + + + + + + + +
+
Loading...
+ + +
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/functions_70.html b/flex-bison/mark1/docs/html/search/functions_70.html new file mode 100644 index 0000000..08850ac --- /dev/null +++ b/flex-bison/mark1/docs/html/search/functions_70.html @@ -0,0 +1,62 @@ + + + + + + + +
+
Loading...
+ +
+
+ Parser_ParseInput + parser.c +
+
+ +
+
+ PrintChildNode + ast_debug.c +
+
+
+
+ PrintNode + ast_debug.c +
+
+
+
+ PrintNodeDefinition + ast_debug.c +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/functions_76.html b/flex-bison/mark1/docs/html/search/functions_76.html new file mode 100644 index 0000000..26136c0 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/functions_76.html @@ -0,0 +1,56 @@ + + + + + + + +
+
Loading...
+ + + + +
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/functions_79.html b/flex-bison/mark1/docs/html/search/functions_79.html new file mode 100644 index 0000000..49c21bd --- /dev/null +++ b/flex-bison/mark1/docs/html/search/functions_79.html @@ -0,0 +1,336 @@ + + + + + + + +
+
Loading...
+ + + + + + + + + + +
+
+ yyget_column + lex.yy.c +
+
+ + + + + + + + + + + + + + + + + +
+
+ yyset_column + lex.yy.c +
+
+ + + + + + +
+
+ yywrap + lex.yy.h +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/mag_sel.png b/flex-bison/mark1/docs/html/search/mag_sel.png new file mode 100644 index 0000000..81f6040 Binary files /dev/null and b/flex-bison/mark1/docs/html/search/mag_sel.png differ diff --git a/flex-bison/mark1/docs/html/search/nomatches.html b/flex-bison/mark1/docs/html/search/nomatches.html new file mode 100644 index 0000000..b1ded27 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/nomatches.html @@ -0,0 +1,12 @@ + + + + + + + +
+
No Matches
+
+ + diff --git a/flex-bison/mark1/docs/html/search/search.css b/flex-bison/mark1/docs/html/search/search.css new file mode 100644 index 0000000..50249e5 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/search.css @@ -0,0 +1,240 @@ +/*---------------- Search Box */ + +#FSearchBox { + float: left; +} + +#searchli { + float: right; + display: block; + width: 170px; + height: 36px; +} + +#MSearchBox { + white-space : nowrap; + position: absolute; + float: none; + display: inline; + margin-top: 8px; + right: 0px; + width: 170px; + z-index: 102; +} + +#MSearchBox .left +{ + display:block; + position:absolute; + left:10px; + width:20px; + height:19px; + background:url('search_l.png') no-repeat; + background-position:right; +} + +#MSearchSelect { + display:block; + position:absolute; + width:20px; + height:19px; +} + +.left #MSearchSelect { + left:4px; +} + +.right #MSearchSelect { + right:5px; +} + +#MSearchField { + display:block; + position:absolute; + height:19px; + background:url('search_m.png') repeat-x; + border:none; + width:116px; + margin-left:20px; + padding-left:4px; + color: #909090; + outline: none; + font: 9pt Arial, Verdana, sans-serif; +} + +#FSearchBox #MSearchField { + margin-left:15px; +} + +#MSearchBox .right { + display:block; + position:absolute; + right:10px; + top:0px; + width:20px; + height:19px; + background:url('search_r.png') no-repeat; + background-position:left; +} + +#MSearchClose { + display: none; + position: absolute; + top: 4px; + background : none; + border: none; + margin: 0px 4px 0px 0px; + padding: 0px 0px; + outline: none; +} + +.left #MSearchClose { + left: 6px; +} + +.right #MSearchClose { + right: 2px; +} + +.MSearchBoxActive #MSearchField { + color: #000000; +} + +/*---------------- Search filter selection */ + +#MSearchSelectWindow { + display: none; + position: absolute; + left: 0; top: 0; + border: 1px solid #90A5CE; + background-color: #F9FAFC; + z-index: 1; + padding-top: 4px; + padding-bottom: 4px; + -moz-border-radius: 4px; + -webkit-border-top-left-radius: 4px; + -webkit-border-top-right-radius: 4px; + -webkit-border-bottom-left-radius: 4px; + -webkit-border-bottom-right-radius: 4px; + -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); +} + +.SelectItem { + font: 8pt Arial, Verdana, sans-serif; + padding-left: 2px; + padding-right: 12px; + border: 0px; +} + +span.SelectionMark { + margin-right: 4px; + font-family: monospace; + outline-style: none; + text-decoration: none; +} + +a.SelectItem { + display: block; + outline-style: none; + color: #000000; + text-decoration: none; + padding-left: 6px; + padding-right: 12px; +} + +a.SelectItem:focus, +a.SelectItem:active { + color: #000000; + outline-style: none; + text-decoration: none; +} + +a.SelectItem:hover { + color: #FFFFFF; + background-color: #3D578C; + outline-style: none; + text-decoration: none; + cursor: pointer; + display: block; +} + +/*---------------- Search results window */ + +iframe#MSearchResults { + width: 60ex; + height: 15em; +} + +#MSearchResultsWindow { + display: none; + position: absolute; + left: 0; top: 0; + border: 1px solid #000; + background-color: #EEF1F7; +} + +/* ----------------------------------- */ + + +#SRIndex { + clear:both; + padding-bottom: 15px; +} + +.SREntry { + font-size: 10pt; + padding-left: 1ex; +} + +.SRPage .SREntry { + font-size: 8pt; + padding: 1px 5px; +} + +body.SRPage { + margin: 5px 2px; +} + +.SRChildren { + padding-left: 3ex; padding-bottom: .5em +} + +.SRPage .SRChildren { + display: none; +} + +.SRSymbol { + font-weight: bold; + color: #425E97; + font-family: Arial, Verdana, sans-serif; + text-decoration: none; + outline: none; +} + +a.SRScope { + display: block; + color: #425E97; + font-family: Arial, Verdana, sans-serif; + text-decoration: none; + outline: none; +} + +a.SRSymbol:focus, a.SRSymbol:active, +a.SRScope:focus, a.SRScope:active { + text-decoration: underline; +} + +.SRPage .SRStatus { + padding: 2px 5px; + font-size: 8pt; + font-style: italic; +} + +.SRResult { + display: none; +} + +DIV.searchresults { + margin-left: 10px; + margin-right: 10px; +} diff --git a/flex-bison/mark1/docs/html/search/search.js b/flex-bison/mark1/docs/html/search/search.js new file mode 100644 index 0000000..21e7c0c --- /dev/null +++ b/flex-bison/mark1/docs/html/search/search.js @@ -0,0 +1,742 @@ +// Search script generated by doxygen +// Copyright (C) 2009 by Dimitri van Heesch. + +// The code in this file is loosly based on main.js, part of Natural Docs, +// which is Copyright (C) 2003-2008 Greg Valure +// Natural Docs is licensed under the GPL. + +var indexSectionsWithContent = +{ + 0: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010111111111001111111111100100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + 1: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001011100000100100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + 2: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000101100101001100100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + 3: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011100011001110100000100100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + 4: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111101011001111000100100100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + 5: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000001010000101000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + 6: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000001000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + 7: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000110111101001111001110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + 8: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010110111011001110111101100100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" +}; + +var indexSectionNames = +{ + 0: "all", + 1: "classes", + 2: "files", + 3: "functions", + 4: "variables", + 5: "typedefs", + 6: "enums", + 7: "enumvalues", + 8: "defines" +}; + +function convertToId(search) +{ + var result = ''; + for (i=0;i do a search + { + this.Search(); + } + } + + this.OnSearchSelectKey = function(evt) + { + var e = (evt) ? evt : window.event; // for IE + if (e.keyCode==40 && this.searchIndex0) // Up + { + this.searchIndex--; + this.OnSelectItem(this.searchIndex); + } + else if (e.keyCode==13 || e.keyCode==27) + { + this.OnSelectItem(this.searchIndex); + this.CloseSelectionWindow(); + this.DOMSearchField().focus(); + } + return false; + } + + // --------- Actions + + // Closes the results window. + this.CloseResultsWindow = function() + { + this.DOMPopupSearchResultsWindow().style.display = 'none'; + this.DOMSearchClose().style.display = 'none'; + this.Activate(false); + } + + this.CloseSelectionWindow = function() + { + this.DOMSearchSelectWindow().style.display = 'none'; + } + + // Performs a search. + this.Search = function() + { + this.keyTimeout = 0; + + // strip leading whitespace + var searchValue = this.DOMSearchField().value.replace(/^ +/, ""); + + var code = searchValue.toLowerCase().charCodeAt(0); + var hexCode; + if (code<16) + { + hexCode="0"+code.toString(16); + } + else + { + hexCode=code.toString(16); + } + + var resultsPage; + var resultsPageWithSearch; + var hasResultsPage; + + if (indexSectionsWithContent[this.searchIndex].charAt(code) == '1') + { + resultsPage = this.resultsPath + '/' + indexSectionNames[this.searchIndex] + '_' + hexCode + '.html'; + resultsPageWithSearch = resultsPage+'?'+escape(searchValue); + hasResultsPage = true; + } + else // nothing available for this search term + { + resultsPage = this.resultsPath + '/nomatches.html'; + resultsPageWithSearch = resultsPage; + hasResultsPage = false; + } + + window.frames.MSearchResults.location.href = resultsPageWithSearch; + var domPopupSearchResultsWindow = this.DOMPopupSearchResultsWindow(); + + if (domPopupSearchResultsWindow.style.display!='block') + { + var domSearchBox = this.DOMSearchBox(); + this.DOMSearchClose().style.display = 'inline'; + if (this.insideFrame) + { + var domPopupSearchResults = this.DOMPopupSearchResults(); + domPopupSearchResultsWindow.style.position = 'relative'; + domPopupSearchResultsWindow.style.display = 'block'; + var width = document.body.clientWidth - 8; // the -8 is for IE :-( + domPopupSearchResultsWindow.style.width = width + 'px'; + domPopupSearchResults.style.width = width + 'px'; + } + else + { + var domPopupSearchResults = this.DOMPopupSearchResults(); + var left = getXPos(domSearchBox) + 150; // domSearchBox.offsetWidth; + var top = getYPos(domSearchBox) + 20; // domSearchBox.offsetHeight + 1; + domPopupSearchResultsWindow.style.display = 'block'; + left -= domPopupSearchResults.offsetWidth; + domPopupSearchResultsWindow.style.top = top + 'px'; + domPopupSearchResultsWindow.style.left = left + 'px'; + } + } + + this.lastSearchValue = searchValue; + this.lastResultsPage = resultsPage; + } + + // -------- Activation Functions + + // Activates or deactivates the search panel, resetting things to + // their default values if necessary. + this.Activate = function(isActive) + { + if (isActive || // open it + this.DOMPopupSearchResultsWindow().style.display == 'block' + ) + { + this.DOMSearchBox().className = 'MSearchBoxActive'; + + var searchField = this.DOMSearchField(); + + if (searchField.value == this.searchLabel) // clear "Search" term upon entry + { + searchField.value = ''; + this.searchActive = true; + } + } + else if (!isActive) // directly remove the panel + { + this.DOMSearchBox().className = 'MSearchBoxInactive'; + this.DOMSearchField().value = this.searchLabel; + this.searchActive = false; + this.lastSearchValue = '' + this.lastResultsPage = ''; + } + } +} + +// ----------------------------------------------------------------------- + +// The class that handles everything on the search results page. +function SearchResults(name) +{ + // The number of matches from the last run of . + this.lastMatchCount = 0; + this.lastKey = 0; + this.repeatOn = false; + + // Toggles the visibility of the passed element ID. + this.FindChildElement = function(id) + { + var parentElement = document.getElementById(id); + var element = parentElement.firstChild; + + while (element && element!=parentElement) + { + if (element.nodeName == 'DIV' && element.className == 'SRChildren') + { + return element; + } + + if (element.nodeName == 'DIV' && element.hasChildNodes()) + { + element = element.firstChild; + } + else if (element.nextSibling) + { + element = element.nextSibling; + } + else + { + do + { + element = element.parentNode; + } + while (element && element!=parentElement && !element.nextSibling); + + if (element && element!=parentElement) + { + element = element.nextSibling; + } + } + } + } + + this.Toggle = function(id) + { + var element = this.FindChildElement(id); + if (element) + { + if (element.style.display == 'block') + { + element.style.display = 'none'; + } + else + { + element.style.display = 'block'; + } + } + } + + // Searches for the passed string. If there is no parameter, + // it takes it from the URL query. + // + // Always returns true, since other documents may try to call it + // and that may or may not be possible. + this.Search = function(search) + { + if (!search) // get search word from URL + { + search = window.location.search; + search = search.substring(1); // Remove the leading '?' + search = unescape(search); + } + + search = search.replace(/^ +/, ""); // strip leading spaces + search = search.replace(/ +$/, ""); // strip trailing spaces + search = search.toLowerCase(); + search = convertToId(search); + + var resultRows = document.getElementsByTagName("div"); + var matches = 0; + + var i = 0; + while (i < resultRows.length) + { + var row = resultRows.item(i); + if (row.className == "SRResult") + { + var rowMatchName = row.id.toLowerCase(); + rowMatchName = rowMatchName.replace(/^sr\d*_/, ''); // strip 'sr123_' + + if (search.length<=rowMatchName.length && + rowMatchName.substr(0, search.length)==search) + { + row.style.display = 'block'; + matches++; + } + else + { + row.style.display = 'none'; + } + } + i++; + } + document.getElementById("Searching").style.display='none'; + if (matches == 0) // no results + { + document.getElementById("NoMatches").style.display='block'; + } + else // at least one result + { + document.getElementById("NoMatches").style.display='none'; + } + this.lastMatchCount = matches; + return true; + } + + // return the first item with index index or higher that is visible + this.NavNext = function(index) + { + var focusItem; + while (1) + { + var focusName = 'Item'+index; + focusItem = document.getElementById(focusName); + if (focusItem && focusItem.parentNode.parentNode.style.display=='block') + { + break; + } + else if (!focusItem) // last element + { + break; + } + focusItem=null; + index++; + } + return focusItem; + } + + this.NavPrev = function(index) + { + var focusItem; + while (1) + { + var focusName = 'Item'+index; + focusItem = document.getElementById(focusName); + if (focusItem && focusItem.parentNode.parentNode.style.display=='block') + { + break; + } + else if (!focusItem) // last element + { + break; + } + focusItem=null; + index--; + } + return focusItem; + } + + this.ProcessKeys = function(e) + { + if (e.type == "keydown") + { + this.repeatOn = false; + this.lastKey = e.keyCode; + } + else if (e.type == "keypress") + { + if (!this.repeatOn) + { + if (this.lastKey) this.repeatOn = true; + return false; // ignore first keypress after keydown + } + } + else if (e.type == "keyup") + { + this.lastKey = 0; + this.repeatOn = false; + } + return this.lastKey!=0; + } + + this.Nav = function(evt,itemIndex) + { + var e = (evt) ? evt : window.event; // for IE + if (e.keyCode==13) return true; + if (!this.ProcessKeys(e)) return false; + + if (this.lastKey==38) // Up + { + var newIndex = itemIndex-1; + var focusItem = this.NavPrev(newIndex); + if (focusItem) + { + var child = this.FindChildElement(focusItem.parentNode.parentNode.id); + if (child && child.style.display == 'block') // children visible + { + var n=0; + var tmpElem; + while (1) // search for last child + { + tmpElem = document.getElementById('Item'+newIndex+'_c'+n); + if (tmpElem) + { + focusItem = tmpElem; + } + else // found it! + { + break; + } + n++; + } + } + } + if (focusItem) + { + focusItem.focus(); + } + else // return focus to search field + { + parent.document.getElementById("MSearchField").focus(); + } + } + else if (this.lastKey==40) // Down + { + var newIndex = itemIndex+1; + var focusItem; + var item = document.getElementById('Item'+itemIndex); + var elem = this.FindChildElement(item.parentNode.parentNode.id); + if (elem && elem.style.display == 'block') // children visible + { + focusItem = document.getElementById('Item'+itemIndex+'_c0'); + } + if (!focusItem) focusItem = this.NavNext(newIndex); + if (focusItem) focusItem.focus(); + } + else if (this.lastKey==39) // Right + { + var item = document.getElementById('Item'+itemIndex); + var elem = this.FindChildElement(item.parentNode.parentNode.id); + if (elem) elem.style.display = 'block'; + } + else if (this.lastKey==37) // Left + { + var item = document.getElementById('Item'+itemIndex); + var elem = this.FindChildElement(item.parentNode.parentNode.id); + if (elem) elem.style.display = 'none'; + } + else if (this.lastKey==27) // Escape + { + parent.searchBox.CloseResultsWindow(); + parent.document.getElementById("MSearchField").focus(); + } + else if (this.lastKey==13) // Enter + { + return true; + } + return false; + } + + this.NavChild = function(evt,itemIndex,childIndex) + { + var e = (evt) ? evt : window.event; // for IE + if (e.keyCode==13) return true; + if (!this.ProcessKeys(e)) return false; + + if (this.lastKey==38) // Up + { + if (childIndex>0) + { + var newIndex = childIndex-1; + document.getElementById('Item'+itemIndex+'_c'+newIndex).focus(); + } + else // already at first child, jump to parent + { + document.getElementById('Item'+itemIndex).focus(); + } + } + else if (this.lastKey==40) // Down + { + var newIndex = childIndex+1; + var elem = document.getElementById('Item'+itemIndex+'_c'+newIndex); + if (!elem) // last child, jump to parent next parent + { + elem = this.NavNext(itemIndex+1); + } + if (elem) + { + elem.focus(); + } + } + else if (this.lastKey==27) // Escape + { + parent.searchBox.CloseResultsWindow(); + parent.document.getElementById("MSearchField").focus(); + } + else if (this.lastKey==13) // Enter + { + return true; + } + return false; + } +} diff --git a/flex-bison/mark1/docs/html/search/search_l.png b/flex-bison/mark1/docs/html/search/search_l.png new file mode 100644 index 0000000..c872f4d Binary files /dev/null and b/flex-bison/mark1/docs/html/search/search_l.png differ diff --git a/flex-bison/mark1/docs/html/search/search_m.png b/flex-bison/mark1/docs/html/search/search_m.png new file mode 100644 index 0000000..b429a16 Binary files /dev/null and b/flex-bison/mark1/docs/html/search/search_m.png differ diff --git a/flex-bison/mark1/docs/html/search/search_r.png b/flex-bison/mark1/docs/html/search/search_r.png new file mode 100644 index 0000000..97ee8b4 Binary files /dev/null and b/flex-bison/mark1/docs/html/search/search_r.png differ diff --git a/flex-bison/mark1/docs/html/search/typedefs_66.html b/flex-bison/mark1/docs/html/search/typedefs_66.html new file mode 100644 index 0000000..8cc2f83 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/typedefs_66.html @@ -0,0 +1,86 @@ + + + + + + + +
+
Loading...
+
+
+ F32 + common.h +
+
+
+
+ F64 + common.h +
+
+ + + + + + +
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/typedefs_6c.html b/flex-bison/mark1/docs/html/search/typedefs_6c.html new file mode 100644 index 0000000..7f22299 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/typedefs_6c.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ LinkedList_T + linked_list.h +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/typedefs_6e.html b/flex-bison/mark1/docs/html/search/typedefs_6e.html new file mode 100644 index 0000000..9412623 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/typedefs_6e.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ NodeType_T + ast.h +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/typedefs_73.html b/flex-bison/mark1/docs/html/search/typedefs_73.html new file mode 100644 index 0000000..0e77e9d --- /dev/null +++ b/flex-bison/mark1/docs/html/search/typedefs_73.html @@ -0,0 +1,50 @@ + + + + + + + +
+
Loading...
+
+
+ S16 + common.h +
+
+
+
+ S32 + common.h +
+
+
+
+ S64 + common.h +
+
+
+
+ S8 + common.h +
+
+
+
+ String + common.h +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/typedefs_75.html b/flex-bison/mark1/docs/html/search/typedefs_75.html new file mode 100644 index 0000000..07092d4 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/typedefs_75.html @@ -0,0 +1,38 @@ + + + + + + + +
+
Loading...
+
+
+ U16 + common.h +
+
+
+
+ U32 + common.h +
+
+
+
+ U8 + common.h +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/typedefs_79.html b/flex-bison/mark1/docs/html/search/typedefs_79.html new file mode 100644 index 0000000..b8f0a7e --- /dev/null +++ b/flex-bison/mark1/docs/html/search/typedefs_79.html @@ -0,0 +1,92 @@ + + + + + + + +
+
Loading...
+ +
+
+ YY_CHAR + lex.yy.c +
+
+ +
+
+ yy_state_type + lex.yy.c +
+
+ + +
+
+ yytype_int16 + grammar.tab.c +
+
+
+
+ yytype_int8 + grammar.tab.c +
+
+
+
+ yytype_uint16 + grammar.tab.c +
+
+
+
+ yytype_uint8 + grammar.tab.c +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/variables_61.html b/flex-bison/mark1/docs/html/search/variables_61.html new file mode 100644 index 0000000..fe227c9 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/variables_61.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ ast + ParserContext_T +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/variables_62.html b/flex-bison/mark1/docs/html/search/variables_62.html new file mode 100644 index 0000000..a07d4b6 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/variables_62.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ Boolean + Value_T +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/variables_63.html b/flex-bison/mark1/docs/html/search/variables_63.html new file mode 100644 index 0000000..17201b9 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/variables_63.html @@ -0,0 +1,32 @@ + + + + + + + +
+
Loading...
+
+
+ children + Node_T +
+
+
+
+ contents + LinkedList +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/variables_64.html b/flex-bison/mark1/docs/html/search/variables_64.html new file mode 100644 index 0000000..f9903d9 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/variables_64.html @@ -0,0 +1,44 @@ + + + + + + + +
+
Loading...
+
+
+ DebugASM + cl_options.c +
+
+
+
+ DebugAST + cl_options.c +
+
+
+
+ DebugTAC + cl_options.c +
+
+
+
+ display_txt + OpcodeInfo_T +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/variables_66.html b/flex-bison/mark1/docs/html/search/variables_66.html new file mode 100644 index 0000000..7de9ecd --- /dev/null +++ b/flex-bison/mark1/docs/html/search/variables_66.html @@ -0,0 +1,32 @@ + + + + + + + +
+
Loading...
+
+
+ FileList + cl_options.c +
+
+
+
+ Float + Value_T +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/variables_68.html b/flex-bison/mark1/docs/html/search/variables_68.html new file mode 100644 index 0000000..13ba28e --- /dev/null +++ b/flex-bison/mark1/docs/html/search/variables_68.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ Help_String + cl_options.c +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/variables_69.html b/flex-bison/mark1/docs/html/search/variables_69.html new file mode 100644 index 0000000..3c735fe --- /dev/null +++ b/flex-bison/mark1/docs/html/search/variables_69.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ Integer + Value_T +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/variables_6c.html b/flex-bison/mark1/docs/html/search/variables_6c.html new file mode 100644 index 0000000..740df14 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/variables_6c.html @@ -0,0 +1,32 @@ + + + + + + + +
+
Loading...
+
+
+ lexinfo + ParserContext_T +
+
+
+
+ Long_Options + cl_options.c +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/variables_6d.html b/flex-bison/mark1/docs/html/search/variables_6d.html new file mode 100644 index 0000000..8dc9439 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/variables_6d.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ macro_txt + OpcodeInfo_T +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/variables_6e.html b/flex-bison/mark1/docs/html/search/variables_6e.html new file mode 100644 index 0000000..3b4a358 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/variables_6e.html @@ -0,0 +1,41 @@ + + + + + + + +
+
Loading...
+
+
+ next + LinkedList +
+
+
+
+ Node + YYSTYPE +
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/variables_6f.html b/flex-bison/mark1/docs/html/search/variables_6f.html new file mode 100644 index 0000000..435a9e5 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/variables_6f.html @@ -0,0 +1,32 @@ + + + + + + + +
+
Loading...
+
+
+ opcode + OpcodeInfo_T +
+
+
+
+ Opcode_Info_Lookup + il_opcodes.c +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/variables_73.html b/flex-bison/mark1/docs/html/search/variables_73.html new file mode 100644 index 0000000..be641eb --- /dev/null +++ b/flex-bison/mark1/docs/html/search/variables_73.html @@ -0,0 +1,32 @@ + + + + + + + +
+
Loading...
+
+
+ Short_Options + cl_options.c +
+
+
+
+ String + Value_T +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/variables_76.html b/flex-bison/mark1/docs/html/search/variables_76.html new file mode 100644 index 0000000..3a4e115 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/variables_76.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ value + ValueNode_T +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/search/variables_79.html b/flex-bison/mark1/docs/html/search/variables_79.html new file mode 100644 index 0000000..9d7bcb0 --- /dev/null +++ b/flex-bison/mark1/docs/html/search/variables_79.html @@ -0,0 +1,257 @@ + + + + + + + +
+
Loading...
+
+
+ yy_at_bol + yy_buffer_state +
+
+
+
+ yy_bs_column + yy_buffer_state +
+
+
+
+ yy_bs_lineno + yy_buffer_state +
+
+
+
+ yy_buf_pos + yy_buffer_state +
+
+
+
+ yy_buf_size + yy_buffer_state +
+
+
+
+ yy_buffer_stack + yyguts_t +
+
+
+
+ yy_buffer_stack_max + yyguts_t +
+
+
+
+ yy_buffer_stack_top + yyguts_t +
+
+
+
+ yy_buffer_status + yy_buffer_state +
+
+
+
+ yy_c_buf_p + yyguts_t +
+
+
+
+ yy_ch_buf + yy_buffer_state +
+
+
+ +
+
+
+ yy_fill_buffer + yy_buffer_state +
+
+
+
+ yy_flex_debug_r + yyguts_t +
+
+
+
+ yy_hold_char + yyguts_t +
+
+
+
+ yy_init + yyguts_t +
+
+
+
+ yy_input_file + yy_buffer_state +
+
+
+
+ yy_is_interactive + yy_buffer_state +
+
+
+
+ yy_is_our_buffer + yy_buffer_state +
+
+
+
+ yy_last_accepting_cpos + yyguts_t +
+
+
+
+ yy_last_accepting_state + yyguts_t +
+
+
+
+ yy_more_flag + yyguts_t +
+
+
+
+ yy_more_len + yyguts_t +
+
+ +
+
+ yy_nxt + yy_trans_info +
+
+
+
+ yy_start + yyguts_t +
+
+
+
+ yy_start_stack + yyguts_t +
+
+
+
+ yy_start_stack_depth + yyguts_t +
+
+
+
+ yy_start_stack_ptr + yyguts_t +
+
+
+
+ yy_verify + yy_trans_info +
+
+
+
+ yyextra_r + yyguts_t +
+
+
+
+ yyin_r + yyguts_t +
+
+
+
+ yyleng_r + yyguts_t +
+
+
+
+ yylineno_r + yyguts_t +
+
+
+
+ yylval_r + yyguts_t +
+
+
+
+ yyout_r + yyguts_t +
+
+
+
+ yyss_alloc + yyalloc +
+
+
+
+ yytext_r + yyguts_t +
+
+
+
+ yyvs_alloc + yyalloc +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/flex-bison/mark1/docs/html/struct_linked_list.html b/flex-bison/mark1/docs/html/struct_linked_list.html new file mode 100644 index 0000000..005c23b --- /dev/null +++ b/flex-bison/mark1/docs/html/struct_linked_list.html @@ -0,0 +1,163 @@ + + + + +Mark1: LinkedList Struct Reference + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + +
+
+ +
+
+
+ +
+
+ +
+

LinkedList Struct Reference

+
+
+ +

#include <linked_list.h>

+
+Collaboration diagram for LinkedList:
+
+
Collaboration graph
+
[legend]
+ + + + +

+Data Fields

PTR_TYPE contents
struct LinkedListnext
+

Detailed Description

+
+

Definition at line 8 of file linked_list.h.

+

Field Documentation

+ +
+
+ + + + +
PTR_TYPE contents
+
+
+ +

Definition at line 10 of file linked_list.h.

+ +
+
+ +
+
+ + + + +
struct LinkedList* next
+
+
+ +

Definition at line 11 of file linked_list.h.

+ +
+
+
The documentation for this struct was generated from the following file: +
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/struct_linked_list__coll__graph.map b/flex-bison/mark1/docs/html/struct_linked_list__coll__graph.map new file mode 100644 index 0000000..8be6a30 --- /dev/null +++ b/flex-bison/mark1/docs/html/struct_linked_list__coll__graph.map @@ -0,0 +1,2 @@ + + diff --git a/flex-bison/mark1/docs/html/struct_linked_list__coll__graph.md5 b/flex-bison/mark1/docs/html/struct_linked_list__coll__graph.md5 new file mode 100644 index 0000000..f2c58af --- /dev/null +++ b/flex-bison/mark1/docs/html/struct_linked_list__coll__graph.md5 @@ -0,0 +1 @@ +de49062eaf6a50ad07893b1e0c0d67fd \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/struct_linked_list__coll__graph.png b/flex-bison/mark1/docs/html/struct_linked_list__coll__graph.png new file mode 100644 index 0000000..67e0938 Binary files /dev/null and b/flex-bison/mark1/docs/html/struct_linked_list__coll__graph.png differ diff --git a/flex-bison/mark1/docs/html/struct_node___t.html b/flex-bison/mark1/docs/html/struct_node___t.html new file mode 100644 index 0000000..94fc193 --- /dev/null +++ b/flex-bison/mark1/docs/html/struct_node___t.html @@ -0,0 +1,169 @@ + + + + +Mark1: Node_T Struct Reference + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + +
+
+ +
+
+
+ +
+
+ +
+

Node_T Struct Reference

+
+
+ +

A parent node that contains an operator. +More...

+ +

#include <ast.h>

+
+Collaboration diagram for Node_T:
+
+
Collaboration graph
+ + +
[legend]
+ + + + +

+Data Fields

NodeType_T node_type
LinkedList_Tchildren
+

Detailed Description

+

A parent node that contains an operator.

+ +

Definition at line 23 of file ast.h.

+

Field Documentation

+ +
+
+ + + + +
LinkedList_T* children
+
+
+ +

Definition at line 26 of file ast.h.

+ +
+
+ +
+
+ + + + +
NodeType_T node_type
+
+
+ +

Definition at line 25 of file ast.h.

+ +
+
+
The documentation for this struct was generated from the following file:
    +
  • src/data_structures/ast/ast.h
  • +
+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/struct_node___t__coll__graph.map b/flex-bison/mark1/docs/html/struct_node___t__coll__graph.map new file mode 100644 index 0000000..7fe2a99 --- /dev/null +++ b/flex-bison/mark1/docs/html/struct_node___t__coll__graph.map @@ -0,0 +1,3 @@ + + + diff --git a/flex-bison/mark1/docs/html/struct_node___t__coll__graph.md5 b/flex-bison/mark1/docs/html/struct_node___t__coll__graph.md5 new file mode 100644 index 0000000..3e56936 --- /dev/null +++ b/flex-bison/mark1/docs/html/struct_node___t__coll__graph.md5 @@ -0,0 +1 @@ +5d482b27f0266e7f98f97cb5021c80fb \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/struct_node___t__coll__graph.png b/flex-bison/mark1/docs/html/struct_node___t__coll__graph.png new file mode 100644 index 0000000..912ecfa Binary files /dev/null and b/flex-bison/mark1/docs/html/struct_node___t__coll__graph.png differ diff --git a/flex-bison/mark1/docs/html/struct_opcode_info___t.html b/flex-bison/mark1/docs/html/struct_opcode_info___t.html new file mode 100644 index 0000000..abd725b --- /dev/null +++ b/flex-bison/mark1/docs/html/struct_opcode_info___t.html @@ -0,0 +1,174 @@ + + + + +Mark1: OpcodeInfo_T Struct Reference + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + +
+
+ +
+
+
+ +
+
+ +
+

OpcodeInfo_T Struct Reference

+
+
+ +

#include <il_opcodes.h>

+ + + + + +

+Data Fields

Opcode_T opcode
String display_txt
String macro_txt
+

Detailed Description

+
+

Definition at line 37 of file il_opcodes.h.

+

Field Documentation

+ +
+
+ + + + +
String display_txt
+
+
+ +

Definition at line 40 of file il_opcodes.h.

+ +
+
+ +
+
+ + + + +
String macro_txt
+
+
+ +

Definition at line 41 of file il_opcodes.h.

+ +
+
+ +
+
+ + + + +
Opcode_T opcode
+
+
+ +

Definition at line 39 of file il_opcodes.h.

+ +
+
+
The documentation for this struct was generated from the following file: +
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/struct_parser_context___t.html b/flex-bison/mark1/docs/html/struct_parser_context___t.html new file mode 100644 index 0000000..3c88a73 --- /dev/null +++ b/flex-bison/mark1/docs/html/struct_parser_context___t.html @@ -0,0 +1,165 @@ + + + + +Mark1: ParserContext_T Struct Reference + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + +
+
+ +
+
+
+ +
+
+ +
+

ParserContext_T Struct Reference

+
+
+ +

#include <parser.h>

+
+Collaboration diagram for ParserContext_T:
+
+
Collaboration graph
+ + +
[legend]
+ + + + +

+Data Fields

void * lexinfo
Node_Tast
+

Detailed Description

+
+

Definition at line 9 of file parser.h.

+

Field Documentation

+ +
+
+ + + + +
Node_T* ast
+
+
+ +

Definition at line 12 of file parser.h.

+ +
+
+ +
+
+ + + + +
void* lexinfo
+
+
+ +

Definition at line 11 of file parser.h.

+ +
+
+
The documentation for this struct was generated from the following file: +
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/struct_parser_context___t__coll__graph.map b/flex-bison/mark1/docs/html/struct_parser_context___t__coll__graph.map new file mode 100644 index 0000000..cc380fe --- /dev/null +++ b/flex-bison/mark1/docs/html/struct_parser_context___t__coll__graph.map @@ -0,0 +1,4 @@ + + + + diff --git a/flex-bison/mark1/docs/html/struct_parser_context___t__coll__graph.md5 b/flex-bison/mark1/docs/html/struct_parser_context___t__coll__graph.md5 new file mode 100644 index 0000000..3b46393 --- /dev/null +++ b/flex-bison/mark1/docs/html/struct_parser_context___t__coll__graph.md5 @@ -0,0 +1 @@ +97045286e1ee250771345895abd0d71b \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/struct_parser_context___t__coll__graph.png b/flex-bison/mark1/docs/html/struct_parser_context___t__coll__graph.png new file mode 100644 index 0000000..d815181 Binary files /dev/null and b/flex-bison/mark1/docs/html/struct_parser_context___t__coll__graph.png differ diff --git a/flex-bison/mark1/docs/html/struct_value_node___t.html b/flex-bison/mark1/docs/html/struct_value_node___t.html new file mode 100644 index 0000000..720f75f --- /dev/null +++ b/flex-bison/mark1/docs/html/struct_value_node___t.html @@ -0,0 +1,169 @@ + + + + +Mark1: ValueNode_T Struct Reference + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + +
+
+ +
+
+
+ +
+
+ +
+

ValueNode_T Struct Reference

+
+
+ +

A child node that contains a value. +More...

+ +

#include <ast.h>

+
+Collaboration diagram for ValueNode_T:
+
+
Collaboration graph
+ + +
[legend]
+ + + + +

+Data Fields

NodeType_T node_type
Value_T value
+

Detailed Description

+

A child node that contains a value.

+ +

Definition at line 30 of file ast.h.

+

Field Documentation

+ +
+
+ + + + +
NodeType_T node_type
+
+
+ +

Definition at line 32 of file ast.h.

+ +
+
+ +
+
+ + + + +
Value_T value
+
+
+ +

Definition at line 33 of file ast.h.

+ +
+
+
The documentation for this struct was generated from the following file:
    +
  • src/data_structures/ast/ast.h
  • +
+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/struct_value_node___t__coll__graph.map b/flex-bison/mark1/docs/html/struct_value_node___t__coll__graph.map new file mode 100644 index 0000000..c5a3fb6 --- /dev/null +++ b/flex-bison/mark1/docs/html/struct_value_node___t__coll__graph.map @@ -0,0 +1,3 @@ + + + diff --git a/flex-bison/mark1/docs/html/struct_value_node___t__coll__graph.md5 b/flex-bison/mark1/docs/html/struct_value_node___t__coll__graph.md5 new file mode 100644 index 0000000..b4fd9c6 --- /dev/null +++ b/flex-bison/mark1/docs/html/struct_value_node___t__coll__graph.md5 @@ -0,0 +1 @@ +24c5dab3ce88479bc66a7b55b519184a \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/struct_value_node___t__coll__graph.png b/flex-bison/mark1/docs/html/struct_value_node___t__coll__graph.png new file mode 100644 index 0000000..48075c1 Binary files /dev/null and b/flex-bison/mark1/docs/html/struct_value_node___t__coll__graph.png differ diff --git a/flex-bison/mark1/docs/html/structyy__buffer__state.html b/flex-bison/mark1/docs/html/structyy__buffer__state.html new file mode 100644 index 0000000..f6cdc04 --- /dev/null +++ b/flex-bison/mark1/docs/html/structyy__buffer__state.html @@ -0,0 +1,321 @@ + + + + +Mark1: yy_buffer_state Struct Reference + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + +
+
+ +
+
+
+ +
+
+ +
+

yy_buffer_state Struct Reference

+
+
+ +

#include <lex.yy.h>

+ + + + + + + + + + + + + + +

+Data Fields

FILE * yy_input_file
char * yy_ch_buf
char * yy_buf_pos
yy_size_t yy_buf_size
int yy_n_chars
int yy_is_our_buffer
int yy_is_interactive
int yy_at_bol
int yy_bs_lineno
int yy_bs_column
int yy_fill_buffer
int yy_buffer_status
+

Detailed Description

+
+

Definition at line 202 of file lex.yy.c.

+

Field Documentation

+ +
+
+ + + + +
int yy_at_bol
+
+
+ +

Definition at line 236 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
int yy_bs_column
+
+
+

The column count.

+ +

Definition at line 239 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
int yy_bs_lineno
+
+
+

The line count.

+ +

Definition at line 238 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
char * yy_buf_pos
+
+
+ +

Definition at line 207 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
yy_size_t yy_buf_size
+
+
+ +

Definition at line 212 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
int yy_buffer_status
+
+
+ +

Definition at line 246 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
char * yy_ch_buf
+
+
+ +

Definition at line 206 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
int yy_fill_buffer
+
+
+ +

Definition at line 244 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
FILE * yy_input_file
+
+
+ +

Definition at line 204 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
int yy_is_interactive
+
+
+ +

Definition at line 230 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
int yy_is_our_buffer
+
+
+ +

Definition at line 223 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
int yy_n_chars
+
+
+ +

Definition at line 217 of file lex.yy.c.

+ +
+
+
The documentation for this struct was generated from the following files: +
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/structyy__trans__info.html b/flex-bison/mark1/docs/html/structyy__trans__info.html new file mode 100644 index 0000000..b9b80e1 --- /dev/null +++ b/flex-bison/mark1/docs/html/structyy__trans__info.html @@ -0,0 +1,156 @@ + + + + +Mark1: yy_trans_info Struct Reference + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + +
+
+ +
+
+
+ +
+
+ +
+

yy_trans_info Struct Reference

+
+
+ + + + +

+Data Fields

flex_int32_t yy_verify
flex_int32_t yy_nxt
+

Detailed Description

+
+

Definition at line 356 of file lex.yy.c.

+

Field Documentation

+ +
+
+ + + + +
flex_int32_t yy_nxt
+
+
+ +

Definition at line 359 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
flex_int32_t yy_verify
+
+
+ +

Definition at line 358 of file lex.yy.c.

+ +
+
+
The documentation for this struct was generated from the following file: +
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/structyyguts__t.html b/flex-bison/mark1/docs/html/structyyguts__t.html new file mode 100644 index 0000000..117e269 --- /dev/null +++ b/flex-bison/mark1/docs/html/structyyguts__t.html @@ -0,0 +1,518 @@ + + + + +Mark1: yyguts_t Struct Reference + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + +
+
+ +
+
+
+ +
+
+ +
+

yyguts_t Struct Reference

+
+
+
+Collaboration diagram for yyguts_t:
+
+
Collaboration graph
+ + +
[legend]
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+Data Fields

YY_EXTRA_TYPE yyextra_r
FILE * yyin_r
FILE * yyout_r
size_t yy_buffer_stack_top
size_t yy_buffer_stack_max
YY_BUFFER_STATEyy_buffer_stack
char yy_hold_char
int yy_n_chars
int yyleng_r
char * yy_c_buf_p
int yy_init
int yy_start
int yy_did_buffer_switch_on_eof
int yy_start_stack_ptr
int yy_start_stack_depth
int * yy_start_stack
yy_state_type yy_last_accepting_state
char * yy_last_accepting_cpos
int yylineno_r
int yy_flex_debug_r
char * yytext_r
int yy_more_flag
int yy_more_len
YYSTYPEyylval_r
+

Detailed Description

+
+

Definition at line 502 of file lex.yy.c.

+

Field Documentation

+ +
+ +
+

Stack as an array.

+ +

Definition at line 512 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
size_t yy_buffer_stack_max
+
+
+

capacity of stack.

+ +

Definition at line 511 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
size_t yy_buffer_stack_top
+
+
+

index of top of stack.

+ +

Definition at line 510 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
char* yy_c_buf_p
+
+
+ +

Definition at line 516 of file lex.yy.c.

+ +
+
+ +
+ +
+ +

Definition at line 519 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
int yy_flex_debug_r
+
+
+ +

Definition at line 527 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
char yy_hold_char
+
+
+ +

Definition at line 513 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
int yy_init
+
+
+ +

Definition at line 517 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
char* yy_last_accepting_cpos
+
+
+ +

Definition at line 524 of file lex.yy.c.

+ +
+
+ +
+ +
+ +

Definition at line 523 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
int yy_more_flag
+
+
+ +

Definition at line 530 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
int yy_more_len
+
+
+ +

Definition at line 531 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
int yy_n_chars
+
+
+ +

Definition at line 514 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
int yy_start
+
+
+ +

Definition at line 518 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
int* yy_start_stack
+
+
+ +

Definition at line 522 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
int yy_start_stack_depth
+
+
+ +

Definition at line 521 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
int yy_start_stack_ptr
+
+
+ +

Definition at line 520 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
YY_EXTRA_TYPE yyextra_r
+
+
+ +

Definition at line 506 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
FILE* yyin_r
+
+
+ +

Definition at line 509 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
int yyleng_r
+
+
+ +

Definition at line 515 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
int yylineno_r
+
+
+ +

Definition at line 526 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
YYSTYPE* yylval_r
+
+
+ +

Definition at line 533 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
FILE * yyout_r
+
+
+ +

Definition at line 509 of file lex.yy.c.

+ +
+
+ +
+
+ + + + +
char* yytext_r
+
+
+ +

Definition at line 529 of file lex.yy.c.

+ +
+
+
The documentation for this struct was generated from the following file: +
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/structyyguts__t__coll__graph.map b/flex-bison/mark1/docs/html/structyyguts__t__coll__graph.map new file mode 100644 index 0000000..16533f4 --- /dev/null +++ b/flex-bison/mark1/docs/html/structyyguts__t__coll__graph.map @@ -0,0 +1,4 @@ + + + + diff --git a/flex-bison/mark1/docs/html/structyyguts__t__coll__graph.md5 b/flex-bison/mark1/docs/html/structyyguts__t__coll__graph.md5 new file mode 100644 index 0000000..48c107b --- /dev/null +++ b/flex-bison/mark1/docs/html/structyyguts__t__coll__graph.md5 @@ -0,0 +1 @@ +68bb839d31db0cf3316cd7f4968e51f0 \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/structyyguts__t__coll__graph.png b/flex-bison/mark1/docs/html/structyyguts__t__coll__graph.png new file mode 100644 index 0000000..474c94a Binary files /dev/null and b/flex-bison/mark1/docs/html/structyyguts__t__coll__graph.png differ diff --git a/flex-bison/mark1/docs/html/tab_a.png b/flex-bison/mark1/docs/html/tab_a.png new file mode 100644 index 0000000..2d99ef2 Binary files /dev/null and b/flex-bison/mark1/docs/html/tab_a.png differ diff --git a/flex-bison/mark1/docs/html/tab_b.png b/flex-bison/mark1/docs/html/tab_b.png new file mode 100644 index 0000000..b2c3d2b Binary files /dev/null and b/flex-bison/mark1/docs/html/tab_b.png differ diff --git a/flex-bison/mark1/docs/html/tab_h.png b/flex-bison/mark1/docs/html/tab_h.png new file mode 100644 index 0000000..c11f48f Binary files /dev/null and b/flex-bison/mark1/docs/html/tab_h.png differ diff --git a/flex-bison/mark1/docs/html/tab_s.png b/flex-bison/mark1/docs/html/tab_s.png new file mode 100644 index 0000000..978943a Binary files /dev/null and b/flex-bison/mark1/docs/html/tab_s.png differ diff --git a/flex-bison/mark1/docs/html/tabs.css b/flex-bison/mark1/docs/html/tabs.css new file mode 100644 index 0000000..2192056 --- /dev/null +++ b/flex-bison/mark1/docs/html/tabs.css @@ -0,0 +1,59 @@ +.tabs, .tabs2, .tabs3 { + background-image: url('tab_b.png'); + width: 100%; + z-index: 101; + font-size: 13px; +} + +.tabs2 { + font-size: 10px; +} +.tabs3 { + font-size: 9px; +} + +.tablist { + margin: 0; + padding: 0; + display: table; +} + +.tablist li { + float: left; + display: table-cell; + background-image: url('tab_b.png'); + line-height: 36px; + list-style: none; +} + +.tablist a { + display: block; + padding: 0 20px; + font-weight: bold; + background-image:url('tab_s.png'); + background-repeat:no-repeat; + background-position:right; + color: #283A5D; + text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); + text-decoration: none; + outline: none; +} + +.tabs3 .tablist a { + padding: 0 10px; +} + +.tablist a:hover { + background-image: url('tab_h.png'); + background-repeat:repeat-x; + color: #fff; + text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); + text-decoration: none; +} + +.tablist li.current a { + background-image: url('tab_a.png'); + background-repeat:repeat-x; + color: #fff; + text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); +} diff --git a/flex-bison/mark1/docs/html/union_value___t.html b/flex-bison/mark1/docs/html/union_value___t.html new file mode 100644 index 0000000..8090cbd --- /dev/null +++ b/flex-bison/mark1/docs/html/union_value___t.html @@ -0,0 +1,194 @@ + + + + +Mark1: Value_T Union Reference + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + +
+
+ +
+
+
+ +
+
+ +
+

Value_T Union Reference

+
+
+ +

The value portion of a node in the tree. +More...

+ +

#include <ast.h>

+ + + + + + +

+Data Fields

BOOL Boolean
int Integer
double Float
char * String
+

Detailed Description

+

The value portion of a node in the tree.

+ +

Definition at line 14 of file ast.h.

+

Field Documentation

+ +
+
+ + + + +
BOOL Boolean
+
+
+ +

Definition at line 16 of file ast.h.

+ +
+
+ +
+
+ + + + +
double Float
+
+
+ +

Definition at line 18 of file ast.h.

+ +
+
+ +
+
+ + + + +
int Integer
+
+
+ +

Definition at line 17 of file ast.h.

+ +
+
+ +
+
+ + + + +
char* String
+
+
+ +

Definition at line 19 of file ast.h.

+ +
+
+
The documentation for this union was generated from the following file:
    +
  • src/data_structures/ast/ast.h
  • +
+
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/union_y_y_s_t_y_p_e.html b/flex-bison/mark1/docs/html/union_y_y_s_t_y_p_e.html new file mode 100644 index 0000000..536de8c --- /dev/null +++ b/flex-bison/mark1/docs/html/union_y_y_s_t_y_p_e.html @@ -0,0 +1,143 @@ + + + + +Mark1: YYSTYPE Union Reference + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + +
+
+ +
+
+
+ +
+
+ +
+

YYSTYPE Union Reference

+
+
+ +

#include <grammar.tab.h>

+ + + +

+Data Fields

void * Node
+

Detailed Description

+
+

Definition at line 130 of file grammar.tab.c.

+

Field Documentation

+ +
+
+ + + + +
void * Node
+
+
+ +

Definition at line 136 of file grammar.tab.c.

+ +
+
+
The documentation for this union was generated from the following files: +
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/unionyyalloc.html b/flex-bison/mark1/docs/html/unionyyalloc.html new file mode 100644 index 0000000..d44f8ad --- /dev/null +++ b/flex-bison/mark1/docs/html/unionyyalloc.html @@ -0,0 +1,163 @@ + + + + +Mark1: yyalloc Union Reference + + + + + + + + + + + + + +
+
+ + + + + + +
+
Mark1 0.1
+
Experimental Programming Language
+
+
+ + +
+
+ +
+
+
+ +
+
+ +
+

yyalloc Union Reference

+
+
+
+Collaboration diagram for yyalloc:
+
+
Collaboration graph
+ + +
[legend]
+ + + + +

+Data Fields

yytype_int16 yyss_alloc
YYSTYPE yyvs_alloc
+

Detailed Description

+
+

Definition at line 314 of file grammar.tab.c.

+

Field Documentation

+ +
+ +
+ +

Definition at line 316 of file grammar.tab.c.

+ +
+
+ +
+
+ + + + +
YYSTYPE yyvs_alloc
+
+
+ +

Definition at line 317 of file grammar.tab.c.

+ +
+
+
The documentation for this union was generated from the following file: +
+
+ + + + + +
+ +
+ + + + diff --git a/flex-bison/mark1/docs/html/unionyyalloc__coll__graph.map b/flex-bison/mark1/docs/html/unionyyalloc__coll__graph.map new file mode 100644 index 0000000..d1eea7e --- /dev/null +++ b/flex-bison/mark1/docs/html/unionyyalloc__coll__graph.map @@ -0,0 +1,3 @@ + + + diff --git a/flex-bison/mark1/docs/html/unionyyalloc__coll__graph.md5 b/flex-bison/mark1/docs/html/unionyyalloc__coll__graph.md5 new file mode 100644 index 0000000..f5caad3 --- /dev/null +++ b/flex-bison/mark1/docs/html/unionyyalloc__coll__graph.md5 @@ -0,0 +1 @@ +5817c88d8c61c52d3351d0ff6e49905f \ No newline at end of file diff --git a/flex-bison/mark1/docs/html/unionyyalloc__coll__graph.png b/flex-bison/mark1/docs/html/unionyyalloc__coll__graph.png new file mode 100644 index 0000000..82f7ec0 Binary files /dev/null and b/flex-bison/mark1/docs/html/unionyyalloc__coll__graph.png differ diff --git a/flex-bison/mark1/docs/lang.txt b/flex-bison/mark1/docs/lang.txt new file mode 100644 index 0000000..b009714 --- /dev/null +++ b/flex-bison/mark1/docs/lang.txt @@ -0,0 +1,17 @@ +Implement: + Numbers + Strings + Boolean + Function + +????: + Tables + List + Tuple + Dictionary + + Symbols + Lists + Vectors + Maps + diff --git a/flex-bison/mark1/docs/literals.lang b/flex-bison/mark1/docs/literals.lang new file mode 100644 index 0000000..1d55877 --- /dev/null +++ b/flex-bison/mark1/docs/literals.lang @@ -0,0 +1,29 @@ +// Integers +a = 1; + +// Floats +b = 1.0; + +// Numbers + + +// Strings +c = "foo"; + +// Arrays +d = []; +d = [1.0, 2.0, 3.0, 4.0, 5.0]; + +// Maps +e = {}; +e = { + "foo1": "bar" + ,"foo2": 1.0 + ,"foo3": a +}; +f = e["foo1"]; + +// Functions +max a,b = + 1; +end diff --git a/flex-bison/mark1/docs/test.lang b/flex-bison/mark1/docs/test.lang new file mode 100644 index 0000000..3d913eb --- /dev/null +++ b/flex-bison/mark1/docs/test.lang @@ -0,0 +1,34 @@ +1 + 1. +1 - 1. +1 * 1. +1 / 1. +1 % 1. +1 + 2 * 3 - 4 / 5. +(1 + 1) * 1. + +1 && 1. +1 || 1. +! 1. +! 1 || 1 && 1. + +1 == 1. +1 != 1. +1 < 1. +1 > 1. +1 <= 1. +1 >= 1. + +1 == (1 != 1). + +a = 1. +a = 1 + 1. + +foo(a). +max a,b = + if b > a: + b. + else: + a. + end +end + diff --git a/flex-bison/mark1/ex.lang b/flex-bison/mark1/ex.lang new file mode 100644 index 0000000..915b71b --- /dev/null +++ b/flex-bison/mark1/ex.lang @@ -0,0 +1,7 @@ +// Example assignment statement +foo1 = 1 + 1; +foo2 = 1 - 1; +foo3 = 1 * 1; +foo4 = 1 / 1; +foo5 = 1 % 1; + diff --git a/flex-bison/mark1/project.yml b/flex-bison/mark1/project.yml new file mode 100644 index 0000000..a2fc78b --- /dev/null +++ b/flex-bison/mark1/project.yml @@ -0,0 +1,38 @@ +--- + +:project: + :use_exceptions: FALSE + :use_test_preprocessor: TRUE + :use_auxiliary_dependencies: TRUE + :build_root: build + :test_file_prefix: test_ + +:paths: + :test: + - tests/** + :source: + - src/** + +:defines: + :commmon: &common_defines + :test: + - *common_defines + - TEST + :test_preprocess: + - *common_defines + - TEST + +:cmock: + :mock_prefix: mock_ + :when_no_prototypes: :warn + :enforce_strict_ordering: TRUE + :plugins: + - :ignore + +:plugins: + :load_paths: + - tools/ceedling/plugins + :enabled: + - stdout_pretty_tests_report + +... diff --git a/flex-bison/mark1/rakefile.rb b/flex-bison/mark1/rakefile.rb new file mode 100644 index 0000000..43c4424 --- /dev/null +++ b/flex-bison/mark1/rakefile.rb @@ -0,0 +1,79 @@ +require 'rake' + +PROJECT_ROOT = File.expand_path(File.dirname(__FILE__)) + +APP_NAME = 'mark1' +APP_EXT = '.exe' +APP_OUT = "#{APP_NAME}#{APP_EXT}" + +FLEX_BIN = 'flex' +FLEX_OPTS = '--header-file=src/phases/parse/lexer/lex.yy.h' +FLEX_IN = 'src/phases/parse/lexer/lexer.l' +FLEX_OUT = 'src/phases/parse/lexer/lex.yy.c' + +BISON_BIN = 'bison' +BISON_OPTS = '-d' +BISON_IN = 'src/phases/parse/grammar/grammar.y' +BISON_OUT = 'src/phases/parse/grammar/grammar.tab.c' + +COMPILER_BIN = 'gcc' +COMPILER_OPTS = '-c -Wall -Werror' + +LINKER_BIN = 'gcc' +LINKER_OPTS = '' + +SRC_FILES = (FileList['src/**/*.c'] + [ BISON_OUT, FLEX_OUT ]).uniq +INCLUDE_DIRS = FileList['src/**/'] +OBJ_FILES = SRC_FILES.collect{|src| "build/#{File.basename(src).ext('o')}" } + +#------------------------------------------------------------------------------ + +load 'tools/ceedling/lib/rakefile.rb' + +def FindSourceByObj(obj) + puts obj + return SRC_FILES.find { |s| File.basename(s, '.c') == File.basename(obj, '.o') } +end + +task :default => [:clobber, 'build:all'] + +namespace :build do + includes = INCLUDE_DIRS.collect{|x| "-I#{x} "} + + desc "Run all tasks in the 'build' namespace" + task :all => [ :generated, :test, :bin, :docs] + + desc "Run all unit tests" + task :test => [ :generated, 'test:all' ] + + desc "Generate all auto-generated source files" + task :generated => [ BISON_IN, FLEX_IN ] do + sh "#{BISON_BIN} #{BISON_OPTS} -o#{BISON_OUT} #{BISON_IN}" + sh "#{FLEX_BIN} #{FLEX_OPTS} -o#{FLEX_OUT} #{FLEX_IN}" + end + + desc "Link object files to build application" + task :bin => [:generated, APP_OUT] + task APP_OUT => OBJ_FILES do + puts "Linking #{APP_OUT}..." + sh "#{LINKER_BIN} #{LINKER_OPTS} #{includes} -o #{APP_NAME} #{OBJ_FILES.collect{|x| x + ' '}}" + end + + rule '.o' => lambda{|obj| FindSourceByObj(obj) } do |t| + sh "#{COMPILER_BIN} #{COMPILER_OPTS} #{includes} -o #{t.name} #{t.source}" + end + + desc "Generate doxygen documentation" + task :docs => [:generated] do + sh 'doxygen' + end +end + +# Clean Task +CLEAN.include( BISON_OUT ) +CLEAN.include( BISON_OUT.ext('h') ) +CLEAN.include( FLEX_OUT ) +CLEAN.include( FLEX_OUT.ext('h') ) +CLEAN.include( 'build/*.o' ) +CLEAN.include( APP_OUT ) + diff --git a/flex-bison/mark1/src/cl_options/cl_options.c b/flex-bison/mark1/src/cl_options/cl_options.c new file mode 100644 index 0000000..d454a01 --- /dev/null +++ b/flex-bison/mark1/src/cl_options/cl_options.c @@ -0,0 +1,176 @@ +/****************************************************************************** + * Copyright (C) 2011 Michael D. Lowis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ +#include +#include +#include +#include "cl_options.h" +#include "linked_list.h" + +STATIC void HandleLongOption(U8 opt_index); +STATIC void HandleShortOption(U8 opt); +STATIC void BuildFileList(U32 argc, String* argv); + +/****************************************************************************** + * Globals + *****************************************************************************/ +const String Help_String = +"Usage: mark1 [options] file...\n" +"Options:\n" +" --help Prints available options\n" +" --debug-ast Enables debug printing of the abstract syntax tree.\n" +" --debug-tac Enables debug printing of the intermediat three address code.\n" +" --debug-asm Enables debug printing of the generated assembly code.\n" +; + +// Short Options List +const String Short_Options = ""; + +// Long Options List +const struct option Long_Options[] = { + {"help", 0, 0, 0}, + {"debug-ast", 0, 0, 0}, + {"debug-tac", 0, 0, 0}, + {"debug-asm", 0, 0, 0}, + {0,0,0,0} +}; +#define IDX_HELP ((U8)0) +#define IDX_DEBUG_AST ((U8)1) +#define IDX_DEBUG_TAC ((U8)2) +#define IDX_DEBUG_ASM ((U8)3) + +// Option Variables +STATIC BOOL DebugAST = FALSE; +STATIC BOOL DebugTAC = FALSE; +STATIC BOOL DebugASM = FALSE; +STATIC LinkedList_T* FileList = NULL; + +/****************************************************************************** + * Private Functions + *****************************************************************************/ +void HandleLongOption(U8 opt_index) +{ + switch( opt_index ) + { + case IDX_HELP: + printf("%s",Help_String); + exit(0); + break; + case IDX_DEBUG_AST: + CLO_SetDebugAST( TRUE ); + break; + case IDX_DEBUG_TAC: + CLO_SetDebugTAC( TRUE ); + break; + case IDX_DEBUG_ASM: + CLO_SetDebugASM( TRUE ); + break; + default: + break; + } +} + +void HandleShortOption(U8 opt) +{ + switch( opt ) + { + default: + break; + } +} + +void BuildFileList(U32 argc, String* argv) +{ + while (optind < argc) + { + if (FileList == NULL) + { + FileList = LL_New( argv[optind++] ); + } + else + { + LL_Add( FileList, argv[optind++] ); + } + } +} + +/****************************************************************************** + * Public Functions + *****************************************************************************/ +void CLO_ParseOptions(U32 argc, String* argv) +{ + S8 opt = 0; + U8 opt_index = 0; + while(1) + { + opt = getopt_long(argc, argv, Short_Options, Long_Options, (int*)&opt_index); + if (opt == -1) + { + break; + } + + if(opt == 0) + { + HandleLongOption(opt_index); + } + else + { + HandleShortOption(opt); + } + } + BuildFileList(argc,argv); +} + +LinkedList_T* CLO_GetFileList(void) +{ + return FileList; +} + +void CLO_SetDebugAST(BOOL enabled) +{ + DebugAST = enabled; +} + +BOOL CLO_GetDebugAST() +{ + return DebugAST; +} + + +void CLO_SetDebugTAC(BOOL enabled) +{ + DebugTAC = enabled; +} + + +BOOL CLO_GetDebugTAC() +{ + return DebugTAC; +} + + +void CLO_SetDebugASM(BOOL enabled) +{ + DebugASM = enabled; +} + + +BOOL CLO_GetDebugASM() +{ + return DebugASM; +} + + diff --git a/flex-bison/mark1/src/cl_options/cl_options.h b/flex-bison/mark1/src/cl_options/cl_options.h new file mode 100644 index 0000000..6974aba --- /dev/null +++ b/flex-bison/mark1/src/cl_options/cl_options.h @@ -0,0 +1,32 @@ +/****************************************************************************** + * Copyright (C) 2011 Michael D. Lowis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ +#ifndef CL_OPTIONS_H +#define CL_OPTIONS_H + +#include "common.h" +#include "linked_list.h" + +void CLO_ParseOptions(U32 argc, String* argv); +LinkedList_T* CLO_GetFileList(void); +void CLO_SetDebugAST(BOOL enabled); +BOOL CLO_GetDebugAST(void); +void CLO_SetDebugTAC(BOOL enabled); +BOOL CLO_GetDebugTAC(void); +void CLO_SetDebugASM(BOOL enabled); +BOOL CLO_GetDebugASM(void); + +#endif diff --git a/flex-bison/mark1/src/common.h b/flex-bison/mark1/src/common.h new file mode 100644 index 0000000..78736d8 --- /dev/null +++ b/flex-bison/mark1/src/common.h @@ -0,0 +1,136 @@ +/****************************************************************************** + * Copyright (C) 2011 Michael D. Lowis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ +#ifndef COMMON_H +#define COMMON_H + +/****************************************************************************** + * Types + *****************************************************************************/ +//! Boolean enum definition +typedef enum +{ + TRUE = 1, + FALSE = 0 +} BOOL; + +/**** Unsigned Integers ****/ +//! 8-bit unsigned integer +typedef unsigned char U8; + +//! 16-bit unsigned integer +typedef unsigned short int U16; + +//! 32-bit unsigned integer +typedef unsigned long U32; + +/**** Signed Integers ****/ +//! 8-bit signed integer +typedef signed char S8; + +//! 16-bit signed integer +typedef short int S16; + +//! 32-bit signed integer +typedef long int S32; + +//! 64-bit signed integer +typedef long long int S64; + +// Floating Point +//! 32-bit floating point number +typedef float F32; + +//! 64-bit floating point number +typedef double F64; + +/**** String ****/ +//! String definition +typedef char * String; + +/****************************************************************************** + * Defines + *****************************************************************************/ + +#ifdef TEST + #define STATIC +#else + #define STATIC static +#endif + +#ifndef NULL + #define NULL ((U8)0) +#endif +#define NULL_PTR ((void *)0u) + +#define BIT_0 0x01u +#define BIT_1 0x02u +#define BIT_2 0x04u +#define BIT_3 0x08u +#define BIT_4 0x10u +#define BIT_5 0x20u +#define BIT_6 0x40u +#define BIT_7 0x80u + +#define BIT_8 0x0100u +#define BIT_9 0x0200u +#define BIT_10 0x0400u +#define BIT_11 0x0800u +#define BIT_12 0x1000u +#define BIT_13 0x2000u +#define BIT_14 0x4000u +#define BIT_15 0x8000u + +#define BIT_16 0x010000u +#define BIT_17 0x020000u +#define BIT_18 0x040000u +#define BIT_19 0x080000u +#define BIT_20 0x100000u +#define BIT_21 0x200000u +#define BIT_22 0x400000u +#define BIT_23 0x800000u + +#define BIT_24 0x01000000u +#define BIT_25 0x02000000u +#define BIT_26 0x04000000u +#define BIT_27 0x08000000u +#define BIT_28 0x10000000u +#define BIT_29 0x20000000u +#define BIT_30 0x40000000u +#define BIT_31 0x80000000u + +/****************************************************************************** + * Macros + *****************************************************************************/ + +#define VERIFY_RANGE(x, Min, Max) ((((x)>=(Min)) && ((x)<=(Max)))? (TRUE) : (FALSE)) +#define VERIFY_RANGE_VALUE(x, Default, Min, Max) (VERIFY_RANGE((x), (Min), (Max))? (x) : (Default)) +#define VERIFY_MAX_VALUE(x, Default, Max) (((x)<=(Max)) ? (x) : (Default)) +#define VERIFY_MIN_VALUE(x, Default, Min) (((x)>=(Min)) ? (x) : (Default)) +#define _ABS(x, type) (((x) < (type)0) ? (type)-(x):(x)) +#define ABS(x) (((x) < 0) ? -(x):(x)) +#define MAX(a,b) (((a) > (b)) ? (a):(b)) +#define MIN(a,b) (((a) < (b)) ? (a):(b)) +#define SIGN(x,y) (((y) < 0) ? (-(x)):(x)) +#define NUM_ELEMENTS(x) (sizeof(x)/sizeof(x[0])) +#define LIMIT_RANGE(x,Min,Max) (MAX(MIN((x),(Max)),(Min))) +#define LOW_BYTE(x) ((U8)((x) & 0x00FFu)) +#define HIGH_BYTE(x) ((U8)(((x)>>8u) & 0x00FFu)) +#define LOW_WORD(x) ((U16)((x) & 0x0000FFFFUL)) +#define HIGH_WORD(x) ((U16)(((x)>>16) & 0x0000FFFFUL)) +#define QUOTE(x) #x + +#endif diff --git a/flex-bison/mark1/src/data_structures/ast/ast.c b/flex-bison/mark1/src/data_structures/ast/ast.c new file mode 100644 index 0000000..1361f4b --- /dev/null +++ b/flex-bison/mark1/src/data_structures/ast/ast.c @@ -0,0 +1,106 @@ +/****************************************************************************** + * Copyright (C) 2011 Michael D. Lowis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ +/****************************************************************************** + * Includes and Prototypes + ******************************************************************************/ + +#include "ast.h" +#include +#include + +static Node_T* New_ASTValNode(NodeType_T type, Value_T value); + +/****************************************************************************** + * Private Functions + ******************************************************************************/ +static Node_T* New_ASTValNode(NodeType_T type, Value_T value) +{ + ValueNode_T* node = (ValueNode_T*) malloc( sizeof(ValueNode_T) ); + node->node_type = type; + node->value = value; + return (Node_T *) node; +} + +/****************************************************************************** + * Public Functions + ******************************************************************************/ +Node_T* NODE(NodeType_T type, int child_count, ...) +{ + va_list arg_list; + int i = 0; + Node_T* node = (Node_T*) malloc( sizeof(Node_T) ); + node->node_type = type; + node->children = NULL; + + va_start (arg_list, child_count); + for (i = 0; i < child_count ; i++) + { + if (node->children == NULL) + { + node->children = LL_New( va_arg(arg_list, Node_T*) ); + } + else + { + LL_Add(node->children, va_arg(arg_list, Node_T*)); + } + } + va_end(arg_list); + + return (Node_T*) node; +} + +Node_T* NODE_APPEND(Node_T* node, Node_T* child) +{ + if (node->children == NULL) + { + node->children = LL_New( child ); + } + else + { + LL_Add(node->children, child); + } + return node; +} + +Node_T* VAL_BOOL(char* value) +{ + Value_T val; + val.Boolean = (strcmp(value,"true") == 0) ? TRUE : FALSE; + return New_ASTValNode(FLOAT, val); +} + +Node_T* VAL_INT(char* value) +{ + Value_T val; + val.Integer = atoi(value); + return New_ASTValNode(INT, val); +} + +Node_T* VAL_FLOAT(char* value) +{ + Value_T val; + val.Float = atof(value); + return New_ASTValNode(FLOAT, val); +} + +Node_T* VAL_STRING(char* value) +{ + Value_T val; + val.String = strdup( value ); + return New_ASTValNode(STRING, val); +} + diff --git a/flex-bison/mark1/src/data_structures/ast/ast.h b/flex-bison/mark1/src/data_structures/ast/ast.h new file mode 100644 index 0000000..4630dfa --- /dev/null +++ b/flex-bison/mark1/src/data_structures/ast/ast.h @@ -0,0 +1,116 @@ +/****************************************************************************** + * Copyright (C) 2011 Michael D. Lowis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ +#ifndef AST_H +#define AST_H + +#include +#include "common.h" +#include "il_opcodes.h" +#include "linked_list.h" + + +/// Definition of the node type. +typedef Opcode_T NodeType_T; + +/// The value portion of a node in the tree. +typedef union +{ + BOOL Boolean; + int Integer; + double Float; + char* String; +} Value_T; + +/// A parent node that contains an operator. +typedef struct +{ + NodeType_T node_type; + LinkedList_T* children; +} Node_T; + +/// A child node that contains a value. +typedef struct +{ + NodeType_T node_type; + Value_T value; +} ValueNode_T; + +/** + * @brief Creates a new operator node with the specified number of children. + * + * This is a variadic function that takes a node type, a number of children, + * and a variable number of NODE_T pointers representing the children of the + * newly created node. + * + * @param type The type of node to create. + * @param child_count The number of children you are passing in. + * @param ... A variable number of NODE_T pointers representing children. + * + * @return Returns a pointer to the newly created node. + **/ +Node_T* NODE(NodeType_T type, int child_count, ...); + +/** + * + **/ +Node_T* NODE_APPEND(Node_T* node, Node_T* child); + +/** + * @brief Creates and returns a new Boolean value node. + * + * This function takes the input string and converts it into a boolean value. + * The boolean value is then stored as the contents of the newly created node. + * A pointer to the newly created node is then returned to the caller. + * + * @param value String containing that data to use for this node. + **/ +Node_T* VAL_BOOL(char* value); + +/** + * @brief Creates and returns a new Integer value node. + * + * This function takes the input string and converts it to a float using atoi(). + * The integer value is then used as the value of the newly created node. A + * pointer to the newly created node is then returned to the caller. + * + * @param value String containing that data to use for this node. + **/ +Node_T* VAL_INT(char* value); + +/** + * @brief Creates and returns a new Float value node. + * + * This function takes the input string and converts it to a float using atof(). + * The floating point value is then used as the value of the newly created node. + * A pointer to the newly created node is then returned to the caller. + * + * @param value String containing that data to use for this node. + **/ +Node_T* VAL_FLOAT(char* value); + +/** + * @brief Creates and returns a new String value node. + * + * This function takes the input string and uses it as the value of the newly + * created node. A pointer to the newly created node is then returned to the + * caller. + * + * @param value String containing that data to use for this node. + **/ +Node_T* VAL_STRING(char* value); + +#endif diff --git a/flex-bison/mark1/src/data_structures/ast/ast_debug.c b/flex-bison/mark1/src/data_structures/ast/ast_debug.c new file mode 100644 index 0000000..56da9e7 --- /dev/null +++ b/flex-bison/mark1/src/data_structures/ast/ast_debug.c @@ -0,0 +1,102 @@ +/****************************************************************************** + * Copyright (C) 2011 Michael D. Lowis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ +#include "ast_debug.h" +#include + +STATIC void PrintNodeDefinition(Node_T* tree); +STATIC BOOL HasChildren(Node_T* tree); +STATIC void PrintChildNode(Node_T* tree, int parent); +STATIC void PrintNode(Node_T* tree, int parent); + +/****************************************************************************** + * Globals + ******************************************************************************/ +static int Node_Count = 0; + +/****************************************************************************** + * Private Functions + ******************************************************************************/ +void PrintNodeDefinition(Node_T* tree) +{ + switch(tree->node_type) + { + case ID: + printf("\t%d [label=\"%s\"]\n", Node_Count, ((ValueNode_T*)tree)->value.String); + break; + + case BOOLEAN: + printf("\t%d [label=\"%d\"]\n", Node_Count, ((ValueNode_T*)tree)->value.Boolean); + break; + + case INT: + printf("\t%d [label=\"%d\"]\n", Node_Count, ((ValueNode_T*)tree)->value.Integer); + break; + + case FLOAT: + printf("\t%d [label=\"%f\"]\n", Node_Count, ((ValueNode_T*)tree)->value.Float); + break; + + case STRING: + printf("\t%d [label=\"%s\"]\n", Node_Count, ((ValueNode_T*)tree)->value.String); + break; + + default: + printf("\t%d [label=\"%d\"]\n", Node_Count, tree->node_type); + break; + } +} + +BOOL HasChildren(Node_T* tree) +{ + return (tree->node_type < 240) ? TRUE : FALSE; +} + +void PrintChildNode(Node_T* tree, int parent) +{ + if (tree != NULL) + { + printf("\t%d->%d\n", parent, ++Node_Count); + PrintNode( tree, parent); + } +} + +void PrintNode(Node_T* tree, int parent) +{ + int current_node = Node_Count; + PrintNodeDefinition(tree); + if ( HasChildren(tree) ) + { + LinkedList_T* child = tree->children; + while (child != NULL) + { + PrintChildNode( (Node_T*)child->contents, current_node ); + child = child->next; + } + } +} + +/****************************************************************************** + * Public Functions + ******************************************************************************/ +void PrintAST(Node_T* tree) +{ + Node_Count = 0; + printf("digraph {\n"); + PrintNode(tree, 0); + printf("}\n"); +} + diff --git a/flex-bison/mark1/src/data_structures/ast/ast_debug.h b/flex-bison/mark1/src/data_structures/ast/ast_debug.h new file mode 100644 index 0000000..96c40e4 --- /dev/null +++ b/flex-bison/mark1/src/data_structures/ast/ast_debug.h @@ -0,0 +1,24 @@ +/****************************************************************************** + * Copyright (C) 2011 Michael D. Lowis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ +#ifndef AST_DEBUG_H +#define AST_DEBUG_H + +#include "ast.h" + +void PrintAST(Node_T* tree); + +#endif diff --git a/flex-bison/mark1/src/data_structures/hashtable/hashtable.c b/flex-bison/mark1/src/data_structures/hashtable/hashtable.c new file mode 100644 index 0000000..1363849 --- /dev/null +++ b/flex-bison/mark1/src/data_structures/hashtable/hashtable.c @@ -0,0 +1,132 @@ +/****************************************************************************** + * Copyright (C) 2011 Michael D. Lowis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ +#include "hashtable.h" +#include +#include +#include + +STATIC U32 Hash_HashString(String key); + +/****************************************************************************** + * Private Functions + *****************************************************************************/ +U32 Hash_HashString(String key) +{ + U32 hash = 0; + U8 i = 0; + for (i = 0; key[i] != '\0'; i++) + { + hash += key[i]; + } + return hash; +} + +/****************************************************************************** + * Public Functions + *****************************************************************************/ +HashTable_T* Hash_New(U32 size, HashFuncPtr_T fn) +{ + U32 table_size = size * sizeof(HashNode_T*); + HashTable_T* table = (HashTable_T*) malloc( sizeof(HashTable_T) ); + table->size = size; + table->table = (HashNode_T**) malloc( table_size ); + table->hash_func = (fn != NULL) ? fn : (HashFuncPtr_T) Hash_HashString; + memset(table->table, 0, table_size); + return table; +} + +void Hash_Free(HashTable_T* table) +{ + U8 i = 0; + for (i = 0; i < table->size; i++) + { + HashNode_T* cur = table->table[i]; + while (cur != NULL) + { + printf("Index: %d\tKey: %s\tVal: %#x\tNext: %#x\n", i, cur->key, (int)cur->val, (int)cur->next); + HashNode_T* next = cur->next; + free( cur->key ); + free( cur->val ); + free( cur ); + cur = next; + } + } +} + +BOOL Hash_Put(HashTable_T* table, String key, void* val) +{ + U32 index = table->hash_func( key ) % table->size; + HashNode_T* cur = table->table[index]; + HashNode_T* last = cur; + + while (cur != NULL) + { + if ( !strcmp( key, cur->key ) ) + { + cur->val = val; + break; + } + last = cur; + cur = cur->next; + } + + if (cur == NULL) + { + HashNode_T* node = (HashNode_T*) malloc( sizeof(HashNode_T) ); + node->key = (String) strdup( key ); + node->val = val; + node->next = NULL; + + if (last != NULL) + { + last->next = node; + } + else + { + table->table[ index ] = node; + } + } + return TRUE; +} + +void* Hash_Get(HashTable_T* table, String key) +{ + void* ret = NULL; + U32 index= table->hash_func( key ) % table->size; + HashNode_T* node = table->table[ index ]; + while ( node != NULL ) + { + if ( !strcmp( key, node->key ) ) + { + ret = node->val; + break; + } + node = node->next; + } + return ret; +} + +U32 Hash_Delete(HashTable_T* table, String key) +{ + return 0; +} + +U32 Hash_Resize(HashTable_T* table, U32 size) +{ + return 0; +} + diff --git a/flex-bison/mark1/src/data_structures/hashtable/hashtable.h b/flex-bison/mark1/src/data_structures/hashtable/hashtable.h new file mode 100644 index 0000000..ab31b54 --- /dev/null +++ b/flex-bison/mark1/src/data_structures/hashtable/hashtable.h @@ -0,0 +1,44 @@ +/****************************************************************************** + * Copyright (C) 2011 Michael D. Lowis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ +#ifndef HASHTABLE_H +#define HASHTABLE_H + +#include "common.h" + +typedef U32 (*HashFuncPtr_T) (String) ; +typedef struct HashNode +{ + String key; + void* val; + struct HashNode* next; +} HashNode_T; + +typedef struct +{ + U32 size; + HashNode_T** table; + HashFuncPtr_T hash_func; +} HashTable_T; + +HashTable_T* Hash_New(U32 size, HashFuncPtr_T fn); +void Hash_Free(HashTable_T* table); +BOOL Hash_Put(HashTable_T* table, String key, void* val); +void* Hash_Get(HashTable_T* table, String key); +U32 Hash_Delete(HashTable_T* table, String key); +U32 Hash_Resize(HashTable_T* table, U32 size); + +#endif diff --git a/flex-bison/mark1/src/data_structures/linked_list/linked_list.c b/flex-bison/mark1/src/data_structures/linked_list/linked_list.c new file mode 100644 index 0000000..3cab7bb --- /dev/null +++ b/flex-bison/mark1/src/data_structures/linked_list/linked_list.c @@ -0,0 +1,108 @@ +/****************************************************************************** + * Copyright (C) 2011 Michael D. Lowis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ +#include "linked_list.h" +#include + +/****************************************************************************** + * Public Functions + ******************************************************************************/ +LinkedList_T* LL_New( PTR_TYPE contents ) +{ + LinkedList_T* list = (LinkedList_T*)malloc( sizeof(LinkedList_T) ); + list->contents = contents; + list->next = NULL; + return list; +} + +LinkedList_T* LL_Last( LinkedList_T* list ) +{ + LinkedList_T* node = list; + while((node != NULL) && (node->next != NULL)) + { + node = node->next; + } + return node; +} + +LinkedList_T* LL_Get( LinkedList_T* list, int index ) +{ + int current = 0; + LinkedList_T* node = list; + LinkedList_T* indexed_node = NULL; + while ((node != NULL) && (node->next != NULL)) + { + if ( current == index ) + { + indexed_node = node; + break; + } + node = node->next; + current++; + } + return indexed_node; +} + +void LL_Add( LinkedList_T* list, PTR_TYPE contents ) +{ + LinkedList_T* node = LL_Last( list ); + node->next = LL_New( contents ); +} + +LinkedList_T* LL_Insert( LinkedList_T* list, int index, PTR_TYPE contents ) +{ + int req_index = ((index-1) < 0) ? 0 : index-1; + LinkedList_T* node = LL_Get( list, req_index ); + if(node != NULL) + { + LinkedList_T* next_next = node->next; + node->next = LL_New( contents ); + node->next->next = next_next; + node = node->next; + } + return node; +} + +void LL_Delete( LinkedList_T* list, int index, BOOL free_contents) +{ + LinkedList_T* node = LL_Get( list, (index-1)); + if((node != NULL) && (node->next != NULL)) + { + LinkedList_T* node_to_delete = node->next; + node->next = node_to_delete->next; + if (free_contents) + { + free(node_to_delete->contents); + } + free(node_to_delete); + } +} + +void LL_Free( LinkedList_T* list, BOOL free_contents) +{ + LinkedList_T* node = list; + while( node != NULL ) + { + LinkedList_T* next = node->next; + if (free_contents) + { + free(node->contents); + } + free(node); + node = next; + } +} + diff --git a/flex-bison/mark1/src/data_structures/linked_list/linked_list.h b/flex-bison/mark1/src/data_structures/linked_list/linked_list.h new file mode 100644 index 0000000..881b1aa --- /dev/null +++ b/flex-bison/mark1/src/data_structures/linked_list/linked_list.h @@ -0,0 +1,109 @@ +/****************************************************************************** + * Copyright (C) 2011 Michael D. Lowis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ +#ifndef LINKED_LIST_H +#define LINKED_LIST_H + +#include "common.h" + +#define PTR_TYPE void * + +typedef struct LinkedList +{ + PTR_TYPE contents; + struct LinkedList * next; +} LinkedList_T; + +/** + * @brief Creates a new linked list node with the supplied value. + * + * Allocates a new node on the heap and populates the node contents with the + * supplied contents pointer. + * + * @param contents The contents of the newly created node. + * + * @return A pointer to the newly created node. + * */ +LinkedList_T* LL_New( PTR_TYPE contents ); + +/** + * @brief Finds and returns the last node in the supplied linked list. + * + * @param list The linked list to search. + * + * @return Pointer to the last node in the supplied list. + * */ +LinkedList_T* LL_Last(LinkedList_T* list); + +/** + * @brief Return the node at the specified index in a linked list. + * + * Loops through the linked list and returns the node in the list at the + * specified index. Returns NULL if the index is out of range. + * + * @param list The list to search for the supplied index. + * @param index The index of the node to return. + * + * @return A pointer to the node and the supplied index, NULL if out of range. + * */ +LinkedList_T* LL_Get(LinkedList_T* list, int index); + +/** + * @brief Adds a new node to an existing linked list. + * + * @param list + * @param contents + * */ +void LL_Add( LinkedList_T* list, PTR_TYPE contents ); + +/** + * @brief Inserts a new node in a linked list at the specified index. + * + * @param list + * @param index + * @param contents + * + * @return Pointer to the newly inserted node, NULL if index is out of range. + * */ +LinkedList_T* LL_Insert( LinkedList_T* list, int index, PTR_TYPE contents); + +/** + * @brief Deletes a node from the supplied list. + * + * Deletes the node found at the supplied index from the supplied list and frees + * the memory used by the node and its contents. + * + * @param list + * @param index + * @param free_contents Whether or not to also free the contents of the node. + * */ +void LL_Delete( LinkedList_T* list, int index, BOOL free_contents); + +/** + * @brief Frees all memory used by a linked list. + * + * Loops through the supplied list and frees all nodes. Also frees contents if + * free_contents is passed TRUE. This is to avoid trying to free memory + * allocated on the stack. + * + * @param list The list to be freed. + * @param free_contents Whether or not to also free the contents of each node. + * */ +void LL_Free( LinkedList_T* list, BOOL free_contents); + +#define LL_FOREACH(item,list) for( item = list; item != NULL; item = item->next ) + +#endif diff --git a/flex-bison/mark1/src/il_opcodes/il_opcodes.c b/flex-bison/mark1/src/il_opcodes/il_opcodes.c new file mode 100644 index 0000000..085ecbc --- /dev/null +++ b/flex-bison/mark1/src/il_opcodes/il_opcodes.c @@ -0,0 +1,94 @@ +/****************************************************************************** + * Copyright (C) 2011 Michael D. Lowis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ +#include "il_opcodes.h" + +/****************************************************************************** + * Globals + *****************************************************************************/ +STATIC const OpcodeInfo_T Opcode_Info_Lookup[] = { + { ROOT, "ROOT", "ModuleStart" }, + { ADD, "ADD", "Add" }, + { SUB, "SUB", "Subtract" }, + { MUL, "MUL", "Multiply" }, + { DIV, "DIV", "Divide" }, + { MOD, "MOD", "Modulus" }, + { AND, "AND", "And" }, + { OR, "OR", "Or" }, + { NOT, "NOT", "Not" }, + { EQ, "EQ", "Equal" }, + { NE, "NE", "NotEqual" }, + { LT, "LT", "LessThan" }, + { GT, "GT", "GreaterThan" }, + { LTE, "LTE", "LessOrEqual" }, + { GTE, "GTE", "GreatOrEqual" }, + { ASSIGN, "ASSIGN", "Assign" }, + + { TERN, "TERN", NULL }, + { ARRAY, "ARRAY", NULL }, + { MAP, "MAP", NULL }, + { FUNC, "FUNC", NULL }, + + { ID, "ID", NULL }, + { INT, "INT", NULL }, + { FLOAT, "FLOAT", NULL }, + { STRING, "STRING", NULL }, + { BOOLEAN, "BOOLEAN", NULL } +}; + +/****************************************************************************** + * Public Functions + *****************************************************************************/ +OpcodeInfo_T* IL_LookupOpcodeDefinition( Opcode_T opcode ) +{ + U32 lower = 0; + U32 upper = NUM_ELEMENTS(Opcode_Info_Lookup); + OpcodeInfo_T* found_item = NULL; + + while( lower <= upper ) + { + U32 index = ((upper - lower) / 2) + lower; + OpcodeInfo_T* item = (OpcodeInfo_T*)&Opcode_Info_Lookup[index]; + + if(opcode == item->opcode) + { + found_item = item; + break; + } + else if(opcode > item->opcode) + { + lower = index; + } + else + { + upper = index; + } + } + return found_item; +} + +String IL_LookupDisplayText( Opcode_T opcode ) +{ + OpcodeInfo_T* info = IL_LookupOpcodeDefinition( opcode ); + return (info == NULL) ? NULL : info->display_txt; +} + +String IL_LookupMacroText( Opcode_T opcode ) +{ + OpcodeInfo_T* info = IL_LookupOpcodeDefinition( opcode ); + return (info == NULL) ? NULL : info->macro_txt; +} + diff --git a/flex-bison/mark1/src/il_opcodes/il_opcodes.h b/flex-bison/mark1/src/il_opcodes/il_opcodes.h new file mode 100644 index 0000000..13f5d51 --- /dev/null +++ b/flex-bison/mark1/src/il_opcodes/il_opcodes.h @@ -0,0 +1,64 @@ +/****************************************************************************** + * Copyright (C) 2011 Michael D. Lowis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ +#ifndef IL_OPCODES_H +#define IL_OPCODES_H + +#include "common.h" + +typedef enum +{ + ROOT = 0, + ADD = 1, + SUB = 2, + MUL = 3, + DIV = 4, + MOD = 5, + AND = 6, + OR = 7, + NOT = 8, + EQ = 9, + NE = 10, + LT = 11, + GT = 12, + LTE = 13, + GTE = 14, + ASSIGN = 15, + + TERN = 16, + ARRAY = 17, + MAP = 18, + FUNC = 19, + + ID = 251, + INT = 252, + FLOAT = 253, + STRING = 254, + BOOLEAN = 255, +} Opcode_T; + +typedef struct +{ + Opcode_T opcode; + String display_txt; + String macro_txt; +} OpcodeInfo_T; + +OpcodeInfo_T* IL_LookupOpcodeDefinition( Opcode_T opcode ); +String IL_LookupDisplayText( Opcode_T opcode ); +String IL_LookupMacroText( Opcode_T opcode ); + +#endif diff --git a/flex-bison/mark1/src/main.c b/flex-bison/mark1/src/main.c new file mode 100644 index 0000000..a4407be --- /dev/null +++ b/flex-bison/mark1/src/main.c @@ -0,0 +1,37 @@ +/****************************************************************************** + * Copyright (C) 2011 Michael D. Lowis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ +#include +#include "cl_options.h" +#include "phases.h" +#include "hashtable.h" + +int main(int argc, char** argv) +{ + U8 ret = 0; + CLO_ParseOptions(argc,argv); + + LinkedList_T* in_files = CLO_GetFileList(); + LinkedList_T* file = NULL; + LL_FOREACH( file, in_files ) + { + Phases_Compile( (String)file->contents ); + } + LL_Free( in_files, FALSE); + + return (int)ret; +} + diff --git a/flex-bison/mark1/src/phases/asm/asm.c b/flex-bison/mark1/src/phases/asm/asm.c new file mode 100644 index 0000000..e69de29 diff --git a/flex-bison/mark1/src/phases/asm/asm.h b/flex-bison/mark1/src/phases/asm/asm.h new file mode 100644 index 0000000..e69de29 diff --git a/flex-bison/mark1/src/phases/assemble/assemble.c b/flex-bison/mark1/src/phases/assemble/assemble.c new file mode 100644 index 0000000..e69de29 diff --git a/flex-bison/mark1/src/phases/assemble/assemble.h b/flex-bison/mark1/src/phases/assemble/assemble.h new file mode 100644 index 0000000..e69de29 diff --git a/flex-bison/mark1/src/phases/link/link.c b/flex-bison/mark1/src/phases/link/link.c new file mode 100644 index 0000000..e69de29 diff --git a/flex-bison/mark1/src/phases/link/link.h b/flex-bison/mark1/src/phases/link/link.h new file mode 100644 index 0000000..e69de29 diff --git a/flex-bison/mark1/src/phases/optimize/optimize.c b/flex-bison/mark1/src/phases/optimize/optimize.c new file mode 100644 index 0000000..e69de29 diff --git a/flex-bison/mark1/src/phases/optimize/optimize.h b/flex-bison/mark1/src/phases/optimize/optimize.h new file mode 100644 index 0000000..e69de29 diff --git a/flex-bison/mark1/src/phases/parse/grammar/grammar.y b/flex-bison/mark1/src/phases/parse/grammar/grammar.y new file mode 100644 index 0000000..b31b1bb --- /dev/null +++ b/flex-bison/mark1/src/phases/parse/grammar/grammar.y @@ -0,0 +1,118 @@ +%{ + +#include +#include "ast.h" +#include "ast_debug.h" +#include "parse.h" +#include "lex.yy.h" + +#define YYLEX_PARAM context->lexinfo + +%} + +/****************************************************************************** +* Parser Options +******************************************************************************/ +%define api.pure +%parse-param { ParseContext_T* context } + +/****************************************************************************** +* Syntax Tree Values +******************************************************************************/ +%union +{ + void * Node; +} + +/****************************************************************************** +* Tokens +******************************************************************************/ +/* Literal Types */ +%token tBOOL +%token tFLOAT +%token tSTRING +%token tID + +/* Math Operators */ +%token '+' '-' '*' '/' '%' + +/* Logical Operators */ +%token tAND tOR tNOT + +/* Comparison Operators */ +%token tEQ tNE tGT tLT tGTE tLTE + +/* Statement Operators */ +%token '=' ',' ';' ':' '?' + +/* Braces and Parens */ +%token '(' ')' '[' ']' '{' '}' + +/****************************************************************************** +* Rule Return Types +******************************************************************************/ +%type stmnt +%type exp +%type literal + +/****************************************************************************** +* Operator Precedence +******************************************************************************/ +%nonassoc tEQ tNE tGT tLT tGTE tLTE +%left '+' '-' +%left '*' '/' '%' +%nonassoc tNOT +%left tAND tOR +%left '?' ':' + +/****************************************************************************** +* Starting Rule +******************************************************************************/ +%start program + +%% + +program: + /* Nothing */ + | program stmnt { NODE_APPEND(context->ast, $2); } + ; + +stmnt: + tID '=' exp ';' { $$ = NODE(ASSIGN, 2, $1, $3 ); } + | exp ';' { $$ = $1; } + ; +exp: + /* Mathematical Operators */ + exp '+' exp { $$ = NODE(ADD, 2, $1, $3); } + | exp '-' exp { $$ = NODE(SUB, 2, $1, $3); } + | exp '*' exp { $$ = NODE(MUL, 2, $1, $3); } + | exp '/' exp { $$ = NODE(DIV, 2, $1, $3); } + | exp '%' exp { $$ = NODE(MOD, 2, $1, $3); } + + /* Logical Operators */ + | exp tAND exp { $$ = NODE(AND, 2, $1, $3); } + | exp tOR exp { $$ = NODE(OR, 2, $1, $3); } + | tNOT exp { $$ = NODE(NOT, 1, $2); } + + /* Comparison Operators */ + | exp tEQ exp { $$ = NODE(EQ, 2, $1, $3); } + | exp tNE exp { $$ = NODE(NE, 2, $1, $3); } + | exp tLT exp { $$ = NODE(LT, 2, $1, $3); } + | exp tGT exp { $$ = NODE(GT, 2, $1, $3); } + | exp tLTE exp { $$ = NODE(LTE, 2, $1, $3); } + | exp tGTE exp { $$ = NODE(GTE, 2, $1, $3); } + + /* Misc */ + | '(' exp ')' { $$ = $2; } + | tID { $$ = $1; } + | exp '?' exp ':' exp { $$ = NODE(TERN, 3, $1, $3, $5); } + | literal { $$ = $1; } + ; + +literal: + tBOOL { $$ = $1; } + | tFLOAT { $$ = $1; } + ; + +%% + diff --git a/flex-bison/mark1/src/phases/parse/lexer/lexer.l b/flex-bison/mark1/src/phases/parse/lexer/lexer.l new file mode 100644 index 0000000..5bf6da8 --- /dev/null +++ b/flex-bison/mark1/src/phases/parse/lexer/lexer.l @@ -0,0 +1,74 @@ +/* Pattern Macros */ +NUM [0-9] +AL [a-zA-Z] +HEX [a-fA-F0-9] +ALNUM [a-zA-Z0-9] +S [ \n\t] + +%{ + +/* Includes */ +#include "ast.h" +#include "parse.h" +#include + +%} + +%option reentrant +%option bison-bridge +%option noyywrap +%option nounput +%option noinput + +%% + + /* Math Operators*/ +"+" | +"-" | +"*" | +"/" | +"%" | + /* Statement Operators */ +"=" | +"," | +";" | +":" | +"?" | + /* Braces and Parens */ +"(" | +")" | +"{" | +"}" | +"[" | +"]" { return yytext[0]; } + + /* Logical Operators */ +"&&" | +"and" { return tAND; } +"||" | +"or" { return tOR; } +"!" | +"not" { return tNOT; } + + /* Comparison Operators */ +"==" { return tEQ; } +"!=" { return tNE; } +">" { return tGT; } +"<" { return tLT; } +">=" { return tGTE; } +"<=" { return tLTE; } + +"true" | +"false" { yylval->Node = VAL_BOOL( yytext ); return tBOOL; } +{NUM}+(\.{NUM}{NUM}*)? { yylval->Node = VAL_FLOAT( yytext ); return tFLOAT; } +\"[^\n\r"]*\" { yylval->Node = VAL_STRING( yytext ); return tSTRING; } +{AL}{ALNUM}* { yylval->Node = VAL_STRING( yytext ); return tID; } + +\/{2}.*\n ;/* Ignore Comments */ +{S} ;/* Ignore Whitespace */ +. { yyerror(yyscanner, yytext); } + +%% + + + diff --git a/flex-bison/mark1/src/phases/parse/parse.c b/flex-bison/mark1/src/phases/parse/parse.c new file mode 100644 index 0000000..00510ef --- /dev/null +++ b/flex-bison/mark1/src/phases/parse/parse.c @@ -0,0 +1,61 @@ +/****************************************************************************** + * Copyright (C) 2001 Michael D. Lowis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ +/****************************************************************************** + * Includes and Prototypes + *****************************************************************************/ +#include +#include "parse.h" +#include "lex.yy.h" + +Node_T* Parse_ParseInput(FILE* in_file); + +/****************************************************************************** + * Private Functions + *****************************************************************************/ +Node_T* Parse_ParseInput(FILE* in_file) +{ + Node_T* ast = (Node_T*)malloc(sizeof(Node_T)); + ast->node_type = ROOT; + ast->children = NULL; + + if ( in_file != NULL ) + { + ParseContext_T context = { NULL, ast}; + yylex_init( &(context.lexinfo) ); + yyset_in( in_file, context.lexinfo ); + yyparse( &context ); + } + + return ast; +} + +/****************************************************************************** + * Public Functions + *****************************************************************************/ +Node_T* Parse_ParseFile(String in_file) +{ + FILE* input_file = fopen( in_file ,"r"); + return Parse_ParseInput( input_file ); +} + +void yyerror(ParseContext_T* context, String s) +{ + fprintf(stderr,"Error: %s\n",s); +} + +//----------------------------------------------------------------------------- + diff --git a/flex-bison/mark1/src/phases/parse/parse.h b/flex-bison/mark1/src/phases/parse/parse.h new file mode 100644 index 0000000..b42f88f --- /dev/null +++ b/flex-bison/mark1/src/phases/parse/parse.h @@ -0,0 +1,36 @@ +/****************************************************************************** + * Copyright (C) 2001 Michael D. Lowis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ +#ifndef PARSER_H +#define PARSER_H + +#include "common.h" +#include "grammar.tab.h" +#include "ast.h" +#include "dbg.h" + +typedef struct +{ + void* lexinfo; + Node_T* ast; +} ParseContext_T; + +Node_T* Parse_ParseFile(String in_file); +void yyerror(ParseContext_T* context, String s); + +extern int yyparse(ParseContext_T* context); + +#endif diff --git a/flex-bison/mark1/src/phases/phases.c b/flex-bison/mark1/src/phases/phases.c new file mode 100644 index 0000000..714430b --- /dev/null +++ b/flex-bison/mark1/src/phases/phases.c @@ -0,0 +1,63 @@ +/****************************************************************************** + * Copyright (C) 2011 Michael D. Lowis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ +#include "phases.h" +#include "parse.h" +#include "ast_debug.h" +#include "cl_options.h" + +void Phases_Compile(String filename) +{ + // Parsing Phase + Node_T* tree = Phases_Parse( filename ); + (void)tree; + // AST_Free( tree ); + + // Translation Phase + // Optimization Phase + // Assembly Phase +} + +Node_T* Phases_Parse(String filename) +{ + Node_T* tree = Parse_ParseFile( filename ); + if ( CLO_GetDebugAST() ) + { + PrintAST(tree); + } + return tree; +} + +void Phases_Translate(Node_T* ast) +{ + /* code */ +} + +void Phases_Optimize(void) +{ + /* code */ +} + +void Phases_Assemble(void) +{ + /* code */ +} + +void Phases_Link(void) +{ + /* code */ +} + diff --git a/flex-bison/mark1/src/phases/phases.h b/flex-bison/mark1/src/phases/phases.h new file mode 100644 index 0000000..70297d2 --- /dev/null +++ b/flex-bison/mark1/src/phases/phases.h @@ -0,0 +1,31 @@ +/****************************************************************************** + * Copyright (C) 2011 Michael D. Lowis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ + #ifndef PHASES_H + #define PHASES_H + +#include "common.h" +#include "linked_list.h" +#include "ast.h" + +void Phases_Compile(String filename); +Node_T* Phases_Parse(String filename); +void Phases_Translate(Node_T* ast); +void Phase_Optimize(void); +void Phases_Assemble(void); +void Phases_Link(void); + + #endif diff --git a/flex-bison/mark1/src/phases/tac/tac.c b/flex-bison/mark1/src/phases/tac/tac.c new file mode 100644 index 0000000..e69de29 diff --git a/flex-bison/mark1/src/phases/tac/tac.h b/flex-bison/mark1/src/phases/tac/tac.h new file mode 100644 index 0000000..e69de29 diff --git a/flex-bison/mark1/src/utils/dbg/dbg.c b/flex-bison/mark1/src/utils/dbg/dbg.c new file mode 100644 index 0000000..041c0f9 --- /dev/null +++ b/flex-bison/mark1/src/utils/dbg/dbg.c @@ -0,0 +1,39 @@ +/****************************************************************************** + * Copyright (C) 2011 Michael D. Lowis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ +#include "dbg.h" + +#include +#include + +/****************************************************************************** + * Public Functions + *****************************************************************************/ +inline void DBG_Breakpoint(String file, U32 line) +{ + U8 c = 0; + printf("Breakpoint [%s line %d] ", file, (int)line); + c = getchar(); +} + +inline void DBG_Assert(String file, U32 line, String cond_text, BOOL condition) +{ + if(!condition) + { + printf("Assertion Failure [%s line %d] (%s)\n", file, (int)line, cond_text); + exit(1); + } +} diff --git a/flex-bison/mark1/src/utils/dbg/dbg.h b/flex-bison/mark1/src/utils/dbg/dbg.h new file mode 100644 index 0000000..b3952c4 --- /dev/null +++ b/flex-bison/mark1/src/utils/dbg/dbg.h @@ -0,0 +1,36 @@ +/****************************************************************************** + * Copyright (C) 2011 Michael D. Lowis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ +#ifndef DBG_H +#define DBG_H + +#include "common.h" + +#define DEBUG +#ifdef DEBUG + #define DBG_BREAKPOINT() DBG_Breakpoint(__FILE__, __LINE__) + #define DBG_ASSERT(cond) DBG_Assert(__FILE__, __LINE__, QUOTE(cond), cond) + #define DBG_WATCH() +#else + #define DBG_BREAKPOINT() + #define DBG_ASSERT() + #define DBG_WATCH() +#endif + +inline void DBG_Breakpoint(String file, U32 line); +inline void DBG_Assert(String file, U32 line, String cond_text, BOOL condition); + +#endif diff --git a/flex-bison/mark1/src/utils/memutils/memutils.c b/flex-bison/mark1/src/utils/memutils/memutils.c new file mode 100644 index 0000000..e69de29 diff --git a/flex-bison/mark1/src/utils/memutils/memutils.h b/flex-bison/mark1/src/utils/memutils/memutils.h new file mode 100644 index 0000000..e69de29 diff --git a/flex-bison/mark1/tests/src/ast/test_ast.c b/flex-bison/mark1/tests/src/ast/test_ast.c new file mode 100644 index 0000000..db11e38 --- /dev/null +++ b/flex-bison/mark1/tests/src/ast/test_ast.c @@ -0,0 +1,16 @@ +#include "unity.h" + +#include "ast.h" + +#include "mock_linked_list.h" + +void setUp(void) +{ + +} + +void tearDown(void) +{ + +} + diff --git a/flex-bison/mark1/tests/src/ast/test_ast_debug.c b/flex-bison/mark1/tests/src/ast/test_ast_debug.c new file mode 100644 index 0000000..8fdc24d --- /dev/null +++ b/flex-bison/mark1/tests/src/ast/test_ast_debug.c @@ -0,0 +1,14 @@ +#include "unity.h" + +#include "ast_debug.h" + +void setUp(void) +{ + +} + +void tearDown(void) +{ + +} + diff --git a/flex-bison/mark1/tests/src/linked_list/test_linked_list.c b/flex-bison/mark1/tests/src/linked_list/test_linked_list.c new file mode 100644 index 0000000..9116130 --- /dev/null +++ b/flex-bison/mark1/tests/src/linked_list/test_linked_list.c @@ -0,0 +1,194 @@ +#include "unity.h" +#include + +// File to Test +#include "linked_list.h" + +//----------------------------------------------------------------------------- + +int* num1; +int* num2; +int* num3; +LinkedList_T* node1; +LinkedList_T* node2; +LinkedList_T* node3; + +//----------------------------------------------------------------------------- + +void setUp(void) +{ + num1 = (int*) malloc( sizeof(int) ); + num2 = (int*) malloc( sizeof(int) ); + num3 = (int*) malloc( sizeof(int) ); + *num1 = 0; + *num2 = 1; + *num3 = 2; + node1 = (LinkedList_T*) malloc( sizeof(LinkedList_T) ); + node2 = (LinkedList_T*) malloc( sizeof(LinkedList_T) ); + node3 = (LinkedList_T*) malloc( sizeof(LinkedList_T) ); + node1->next = node2; + node1->contents = num1; + node2->next = node3; + node2->contents = num2; + node3->next = NULL; + node3->contents = num3; +} + +void tearDown(void) +{ + if( num1 != NULL ) free( num1 ); + if( num2 != NULL ) free( num2 ); + if( num3 != NULL ) free( num3 ); + if( node1 != NULL ) free( node1 ); + if( node2 != NULL ) free( node2 ); + if( node3 != NULL ) free( node3 ); +} + +//----------------------------------------------------------------------------- +void test_LL_New_should_return_a_new_linked_list_with_the_supplied_contents(void) +{ +// Setup + int num = 42; +// Expected Function Calls +// Function to Test + LinkedList_T* list = LL_New(&num); +// Asserts + TEST_ASSERT_NOT_EQUAL(NULL, list); + TEST_ASSERT_EQUAL(&num, list->contents); + TEST_ASSERT_EQUAL(NULL, list->next); +} + +//----------------------------------------------------------------------------- +void test_LL_Last_should_return_a_pointer_to_the_last_element_in_the_linked_list_for_a_NULL_list(void) +{ +// Setup +// Expected Function Calls +// Function to Test + LinkedList_T* node = LL_Last(NULL); +// Asserts + TEST_ASSERT_EQUAL( NULL, node ); +} + +void test_LL_Last_should_return_a_pointer_to_the_last_element_in_the_linked_list_for_a_list_of_length_1(void) +{ +// Setup +// Expected Function Calls +// Function to Test + LinkedList_T* node = LL_Last(node3); +// Asserts + TEST_ASSERT_EQUAL(num3,node->contents); +} + +void test_LL_Last_should_return_a_pointer_to_the_last_element_in_the_linked_list_for_a_list_of_length_2(void) +{ +// Setup +// Expected Function Calls +// Function to Test + LinkedList_T* node = LL_Last(node2); +// Asserts + TEST_ASSERT_EQUAL(num3,node->contents); +} + +void test_LL_Last_should_return_a_pointer_to_the_last_element_in_the_linked_list_for_a_list_of_length_3(void) +{ +// Setup +// Expected Function Calls +// Function to Test + LinkedList_T* node = LL_Last(node1); +// Asserts + TEST_ASSERT_EQUAL(num3,node->contents); +} + +//----------------------------------------------------------------------------- +void test_LL_Get_should_return_a_pointer_to_the_item_at_the_supplied_index_within_a_list_of_size_1(void) +{ +// Setup +// Expected Function Calls +// Function to Test + LinkedList_T* node = LL_Get(node3,0); +// Asserts + /*TEST_ASSERT_EQUAL(num3,node->contents);*/ +} + +void test_LL_Get_should_return_a_pointer_to_the_item_at_the_supplied_index_within_a_list_of_size_3(void) +{ +// Setup +// Expected Function Calls +// Function to Test + LinkedList_T* node = LL_Get(node1,1); +// Asserts + TEST_ASSERT_EQUAL(num2,node->contents); +} + +void test_LL_Get_should_return_NULL_if_the_supplied_index_is_out_of_range(void) +{ +// Setup +// Expected Function Calls +// Function to Test + LinkedList_T* node = LL_Get(node1,6); +// Asserts + TEST_ASSERT_EQUAL(NULL,node); +} + +void test_LL_Get_should_return_NULL_if_a_null_list_is_supplied(void) +{ +// Setup +// Expected Function Calls +// Function to Test + LinkedList_T* node = LL_Get(NULL,6); +// Asserts + TEST_ASSERT_EQUAL(NULL,node); +} + +//----------------------------------------------------------------------------- +void test_LL_Add_should_add_a_new_node_containing_the_specified_pointer_to_the_end_of_the_supplied_list(void) +{ +// Setup +// Expected Function Calls +// Function to Test + LL_Add(node1,num2); +// Asserts + TEST_ASSERT_NOT_EQUAL( NULL, node1->next ); + TEST_ASSERT_EQUAL( num2, (node1->next)->contents ); +} + +//----------------------------------------------------------------------------- +void test_LL_Insert(void) +{ +// Setup +// Expected Function Calls +// Function to Test + LinkedList_T* node = LL_Insert(node1,1,num3); +// Asserts + TEST_ASSERT_NOT_EQUAL( NULL, node ); + TEST_ASSERT_EQUAL( node, node1->next ); + TEST_ASSERT_EQUAL( num3, node->contents ); +} + +//----------------------------------------------------------------------------- +void test_Delete_should_remove_and_free_the_first_element_in_the_linked_list(void) +{ +// Setup +// Expected Function Calls + +// Function to Test + LL_Delete(node1,0); +// Asserts + /*TEST_ASSERT_EQUAL( NULL, node1 );*/ +} + +//----------------------------------------------------------------------------- +void test_Free(void) +{ +// Setup + +// Expected Function Calls + +// Function to Test + +// Asserts + +} + +//----------------------------------------------------------------------------- + diff --git a/flex-bison/mark1/tests/src/test_main.c b/flex-bison/mark1/tests/src/test_main.c new file mode 100644 index 0000000..1effaa5 --- /dev/null +++ b/flex-bison/mark1/tests/src/test_main.c @@ -0,0 +1,12 @@ +#include "unity.h" + +void setUp(void) +{ + +} + +void tearDown(void) +{ + +} + diff --git a/flex-bison/mark1/tools/ceedling/config/test_environment.rb b/flex-bison/mark1/tools/ceedling/config/test_environment.rb new file mode 100644 index 0000000..2290f29 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/config/test_environment.rb @@ -0,0 +1,12 @@ + +# Setup our load path: +[ + 'lib', + 'test', + 'vendor/behaviors/lib', + 'vendor/hardmock/lib', + 'vendor/constructor/lib', + 'vendor/deep_merge/lib', +].each do |dir| + $LOAD_PATH.unshift( File.join( File.expand_path(File.dirname(__FILE__) + "/../"), dir) ) +end diff --git a/flex-bison/mark1/tools/ceedling/docs/Ceedling Packet.odt b/flex-bison/mark1/tools/ceedling/docs/Ceedling Packet.odt new file mode 100644 index 0000000..3e9902d Binary files /dev/null and b/flex-bison/mark1/tools/ceedling/docs/Ceedling Packet.odt differ diff --git a/flex-bison/mark1/tools/ceedling/docs/Ceedling Packet.pdf b/flex-bison/mark1/tools/ceedling/docs/Ceedling Packet.pdf new file mode 100644 index 0000000..1c9cce8 Binary files /dev/null and b/flex-bison/mark1/tools/ceedling/docs/Ceedling Packet.pdf differ diff --git a/flex-bison/mark1/tools/ceedling/docs/CeedlingLogo.png b/flex-bison/mark1/tools/ceedling/docs/CeedlingLogo.png new file mode 100644 index 0000000..52f1ce6 Binary files /dev/null and b/flex-bison/mark1/tools/ceedling/docs/CeedlingLogo.png differ diff --git a/flex-bison/mark1/tools/ceedling/lib/cacheinator.rb b/flex-bison/mark1/tools/ceedling/lib/cacheinator.rb new file mode 100644 index 0000000..47953dd --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/cacheinator.rb @@ -0,0 +1,42 @@ + +class Cacheinator + + constructor :cacheinator_helper, :file_path_utils, :file_wrapper, :yaml_wrapper + + def cache_test_config(hash) + @yaml_wrapper.dump( @file_path_utils.form_test_build_cache_path( INPUT_CONFIGURATION_CACHE_FILE), hash ) + end + + def cache_release_config(hash) + @yaml_wrapper.dump( @file_path_utils.form_release_build_cache_path( INPUT_CONFIGURATION_CACHE_FILE ), hash ) + end + + + def diff_cached_test_file( filepath ) + cached_filepath = @file_path_utils.form_test_build_cache_path( filepath ) + + if (@file_wrapper.exist?( cached_filepath ) and (!@file_wrapper.compare( filepath, cached_filepath ))) + @file_wrapper.cp(filepath, cached_filepath, {:preserve => false}) + return filepath + elsif (!@file_wrapper.exist?( cached_filepath )) + @file_wrapper.cp(filepath, cached_filepath, {:preserve => false}) + return filepath + end + + return cached_filepath + end + + + def diff_cached_test_config?(hash) + cached_filepath = @file_path_utils.form_test_build_cache_path(INPUT_CONFIGURATION_CACHE_FILE) + + return @cacheinator_helper.diff_cached_config?( cached_filepath, hash ) + end + + def diff_cached_release_config?(hash) + cached_filepath = @file_path_utils.form_release_build_cache_path(INPUT_CONFIGURATION_CACHE_FILE) + + return @cacheinator_helper.diff_cached_config?( cached_filepath, hash ) + end + +end diff --git a/flex-bison/mark1/tools/ceedling/lib/cacheinator_helper.rb b/flex-bison/mark1/tools/ceedling/lib/cacheinator_helper.rb new file mode 100644 index 0000000..cb0ef78 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/cacheinator_helper.rb @@ -0,0 +1,12 @@ + +class CacheinatorHelper + + constructor :file_wrapper, :yaml_wrapper + + def diff_cached_config?(cached_filepath, hash) + return true if ( not @file_wrapper.exist?(cached_filepath) ) + return true if ( (@file_wrapper.exist?(cached_filepath)) and (!(@yaml_wrapper.load(cached_filepath) == hash)) ) + return false + end + +end diff --git a/flex-bison/mark1/tools/ceedling/lib/cmock_builder.rb b/flex-bison/mark1/tools/ceedling/lib/cmock_builder.rb new file mode 100644 index 0000000..4a74aa8 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/cmock_builder.rb @@ -0,0 +1,15 @@ +require 'cmock' + +class CmockBuilder + + attr_accessor :cmock + + def setup + @cmock = nil + end + + def manufacture(cmock_config) + @cmock = CMock.new(cmock_config) + end + +end diff --git a/flex-bison/mark1/tools/ceedling/lib/configurator.rb b/flex-bison/mark1/tools/ceedling/lib/configurator.rb new file mode 100644 index 0000000..82b1e61 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/configurator.rb @@ -0,0 +1,248 @@ +require 'defaults' +require 'constants' +require 'file_path_utils' +require 'deep_merge' + + + +class Configurator + + attr_reader :project_config_hash, :environment, :script_plugins, :rake_plugins + attr_accessor :project_logging, :project_debug, :project_verbosity, :sanity_checks + + constructor(:configurator_setup, :configurator_builder, :configurator_plugins, :cmock_builder, :yaml_wrapper, :system_wrapper) do + @project_logging = false + @project_debug = false + @project_verbosity = Verbosity::NORMAL + @sanity_checks = TestResultsSanityChecks::NORMAL + end + + + def setup + # special copy of cmock config to provide to cmock for construction + @cmock_config_hash = {} + + # capture our source config for later merge operations + @source_config_hash = {} + + # note: project_config_hash is an instance variable so constants and accessors created + # in eval() statements in build() have something of proper scope and persistence to reference + @project_config_hash = {} + @project_config_hash_backup = {} + + @script_plugins = [] + @rake_plugins = [] + end + + + def replace_flattened_config(config) + @project_config_hash.merge!(config) + @configurator_setup.build_constants_and_accessors(@project_config_hash, binding()) + end + + + def store_config + @project_config_hash_backup = @project_config_hash.clone + end + + + def restore_config + @project_config_hash = @project_config_hash_backup + @configurator_setup.build_constants_and_accessors(@project_config_hash, binding()) + end + + + def reset_defaults(config) + [:test_compiler, + :test_linker, + :test_fixture, + :test_includes_preprocessor, + :test_file_preprocessor, + :test_dependencies_generator, + :release_compiler, + :release_assembler, + :release_linker, + :release_dependencies_generator].each do |tool| + config[:tools].delete(tool) if (not (config[:tools][tool].nil?)) + end + end + + + def populate_defaults(config) + new_config = DEFAULT_CEEDLING_CONFIG.clone + new_config.deep_merge!(config) + config.replace(new_config) + + @configurator_builder.populate_defaults( config, DEFAULT_TOOLS_TEST ) + @configurator_builder.populate_defaults( config, DEFAULT_TOOLS_TEST_PREPROCESSORS ) if (config[:project][:use_test_preprocessor]) + @configurator_builder.populate_defaults( config, DEFAULT_TOOLS_TEST_DEPENDENCIES ) if (config[:project][:use_auxiliary_dependencies]) + + @configurator_builder.populate_defaults( config, DEFAULT_TOOLS_RELEASE ) if (config[:project][:release_build]) + @configurator_builder.populate_defaults( config, DEFAULT_TOOLS_RELEASE_ASSEMBLER ) if (config[:project][:release_build] and config[:release_build][:use_assembly]) + @configurator_builder.populate_defaults( config, DEFAULT_TOOLS_RELEASE_DEPENDENCIES ) if (config[:project][:release_build] and config[:project][:use_auxiliary_dependencies]) + end + + + def populate_unity_defines(config) + run_test = true + + config[:unity][:defines].each do |define| + if (define =~ /RUN_TEST\s*\(.+\)\s*=/) + run_test = false + break + end + end + + if (run_test) + config[:unity][:defines] << "\"RUN_TEST(func, line_num)=TestRun(func, #func, line_num)\"" + end + end + + + def populate_cmock_defaults(config) + # cmock has its own internal defaults handling, but we need to set these specific values + # so they're present for the build environment to access; + # note: these need to end up in the hash given to initialize cmock for this to be successful + cmock = config[:cmock] + + # yes, we're duplicating the default mock_prefix in cmock, but it's because we need CMOCK_MOCK_PREFIX always available in Ceedling's environment + cmock[:mock_prefix] = 'Mock' if (cmock[:mock_prefix].nil?) + + # just because strict ordering is the way to go + cmock[:enforce_strict_ordering] = true if (cmock[:enforce_strict_ordering].nil?) + + cmock[:mock_path] = File.join(config[:project][:build_root], TESTS_BASE_PATH, 'mocks') if (cmock[:mock_path].nil?) + cmock[:verbosity] = @project_verbosity if (cmock[:verbosity].nil?) + + cmock[:plugins] = [] if (cmock[:plugins].nil?) + cmock[:plugins].map! { |plugin| plugin.to_sym } + cmock[:plugins] << (:cexception) if (!cmock[:plugins].include?(:cexception) and (config[:project][:use_exceptions])) + cmock[:plugins].uniq! + + cmock[:unity_helper] = false if (cmock[:unity_helper].nil?) + + if (cmock[:unity_helper]) + cmock[:includes] << File.basename(cmock[:unity_helper]) + cmock[:includes].uniq! + end + + @cmock_builder.manufacture(cmock) + end + + + # grab tool names from yaml and insert into tool structures so available for error messages + def populate_tool_names_and_stderr_redirect(config) + config[:tools].each_key do |name| + tool = config[:tools][name] + + # populate name if not given + tool[:name] = name.to_s if (tool[:name].nil?) + + # populate stderr redirect option + tool[:stderr_redirect] = StdErrRedirect::NONE if (tool[:stderr_redirect].nil?) + end + end + + + def find_and_merge_plugins(config) + @configurator_plugins.add_load_paths(config) + + @rake_plugins = @configurator_plugins.find_rake_plugins(config) + @script_plugins = @configurator_plugins.find_script_plugins(config) + config_plugins = @configurator_plugins.find_config_plugins(config) + plugin_defaults = @configurator_plugins.find_plugin_defaults(config) + + config_plugins.each do |plugin| + config.deep_merge( @yaml_wrapper.load(plugin) ) + end + + plugin_defaults.each do |defaults| + @configurator_builder.populate_defaults( config, @yaml_wrapper.load(defaults) ) + end + + # special plugin setting for results printing + config[:plugins][:display_raw_test_results] = true if (config[:plugins][:display_raw_test_results].nil?) + end + + + def eval_environment_variables(config) + config[:environment].each do |hash| + key = hash.keys[0] + value_string = hash[key].to_s + if (value_string =~ RUBY_STRING_REPLACEMENT_PATTERN) + value_string.replace(@system_wrapper.module_eval(value_string)) + end + @system_wrapper.env_set(key.to_s.upcase, value_string) + end + end + + + def eval_paths(config) + individual_paths = [ + config[:project][:build_root], + config[:project][:options_paths], + config[:plugins][:load_paths]] + + individual_paths.flatten.each do |path| + path.replace(@system_wrapper.module_eval(path)) if (path =~ RUBY_STRING_REPLACEMENT_PATTERN) + end + + config[:paths].each_pair do |key, list| + list.each { |path_entry| path_entry.replace(@system_wrapper.module_eval(path_entry)) if (path_entry =~ RUBY_STRING_REPLACEMENT_PATTERN) } + end + end + + + def standardize_paths(config) + individual_paths = [ + config[:project][:build_root], + config[:project][:options_paths], + config[:plugins][:load_paths], + config[:cmock][:mock_path]] # cmock path in case it was explicitly set in config + + individual_paths.flatten.each { |path| FilePathUtils::standardize(path) } + + config[:paths].each_pair do |key, list| + list.each{|path| FilePathUtils::standardize(path)} + # ensure that list is an array (i.e. handle case of list being a single string) + config[:paths][key] = [list].flatten + end + + config[:tools].each_pair do |key, tool_config| + FilePathUtils::standardize(tool_config[:executable]) + end + end + + + def validate(config) + # collect felonies and go straight to jail + raise if (not @configurator_setup.validate_required_sections(config)) + + # collect all misdemeanors, everybody on probation + blotter = [] + blotter << @configurator_setup.validate_required_section_values(config) + blotter << @configurator_setup.validate_paths(config) + blotter << @configurator_setup.validate_tools(config) + + raise if (blotter.include?(false)) + end + + + def build(config) + built_config = @configurator_setup.build_project_config(config) + + @source_config_hash = config.clone + @project_config_hash = built_config.clone + store_config() + + @configurator_setup.build_constants_and_accessors(built_config, binding()) + end + + + def insert_rake_plugins(plugins) + plugins.each do |plugin| + @project_config_hash[:project_rakefile_component_files] << plugin + end + end + +end diff --git a/flex-bison/mark1/tools/ceedling/lib/configurator_builder.rb b/flex-bison/mark1/tools/ceedling/lib/configurator_builder.rb new file mode 100644 index 0000000..48d99eb --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/configurator_builder.rb @@ -0,0 +1,408 @@ +require 'rubygems' +require 'rake' # for ext() method +require 'file_path_utils' # for class methods +require 'defaults' +require 'constants' # for Verbosity constants class & base file paths + + + +class ConfiguratorBuilder + + constructor :file_system_utils, :file_wrapper, :system_wrapper + + + def build_global_constants(config) + config.each_pair do |key, value| + formatted_key = key.to_s.upcase + # undefine global constant if it already exists + Object.send(:remove_const, formatted_key.to_sym) if @system_wrapper.constants_include?(formatted_key) + # create global constant + Object.module_eval("#{formatted_key} = value") + end + end + + + def build_accessor_methods(config, context) + config.each_pair do |key, value| + # fill configurator object with accessor methods + eval("def #{key.to_s.downcase}() return @project_config_hash[:#{key.to_s}] end", context) + end + end + + + # create a flattened hash from the original configuration structure + def flattenify(config) + new_hash = {} + + config.each_key do | parent | + + # gracefully handle empty top-level entries + next if (config[parent].nil?) + + case config[parent] + when Array + config[parent].each do |hash| + key = "#{parent.to_s.downcase}_#{hash.keys[0].to_s.downcase}".to_sym + new_hash[key] = hash[hash.keys[0]] + end + when Hash + config[parent].each_pair do | child, value | + key = "#{parent.to_s.downcase}_#{child.to_s.downcase}".to_sym + new_hash[key] = value + end + # handle entries with no children, only values + else + new_hash["#{parent.to_s.downcase}".to_sym] = config[parent] + end + + end + + return new_hash + end + + + def populate_defaults(config, defaults) + defaults.keys.sort.each do |section| + defaults[section].keys.sort.each do |entry| + config[section][entry] = defaults[section][entry] if (config[section].nil? or config[section][entry].nil?) + end + end + end + + + def clean(in_hash) + # ensure that include files inserted into test runners have file extensions & proper ones at that + in_hash[:test_runner_includes].map!{|include| include.ext(in_hash[:extension_header])} + end + + + def set_build_paths(in_hash) + out_hash = {} + + project_build_artifacts_root = File.join(in_hash[:project_build_root], 'artifacts') + project_build_tests_root = File.join(in_hash[:project_build_root], TESTS_BASE_PATH) + project_build_release_root = File.join(in_hash[:project_build_root], RELEASE_BASE_PATH) + + paths = [ + [:project_build_artifacts_root, project_build_artifacts_root, true ], + [:project_build_tests_root, project_build_tests_root, true ], + [:project_build_release_root, project_build_release_root, in_hash[:project_release_build] ], + + [:project_test_artifacts_path, File.join(project_build_artifacts_root, TESTS_BASE_PATH), true ], + [:project_test_runners_path, File.join(project_build_tests_root, 'runners'), true ], + [:project_test_results_path, File.join(project_build_tests_root, 'results'), true ], + [:project_test_build_output_path, File.join(project_build_tests_root, 'out'), true ], + [:project_test_build_cache_path, File.join(project_build_tests_root, 'cache'), true ], + [:project_test_dependencies_path, File.join(project_build_tests_root, 'dependencies'), true ], + + [:project_release_artifacts_path, File.join(project_build_artifacts_root, RELEASE_BASE_PATH), in_hash[:project_release_build] ], + [:project_release_build_cache_path, File.join(project_build_release_root, 'cache'), in_hash[:project_release_build] ], + [:project_release_build_output_path, File.join(project_build_release_root, 'out'), in_hash[:project_release_build] ], + [:project_release_build_output_asm_path, File.join(project_build_release_root, 'out', 'asm'), in_hash[:project_release_build] ], + [:project_release_build_output_c_path, File.join(project_build_release_root, 'out', 'c'), in_hash[:project_release_build] ], + [:project_release_dependencies_path, File.join(project_build_release_root, 'dependencies'), in_hash[:project_release_build] ], + + [:project_log_path, File.join(in_hash[:project_build_root], 'logs'), true ], + [:project_temp_path, File.join(in_hash[:project_build_root], 'temp'), true ], + + [:project_test_preprocess_includes_path, File.join(project_build_tests_root, 'preprocess/includes'), in_hash[:project_use_test_preprocessor] ], + [:project_test_preprocess_files_path, File.join(project_build_tests_root, 'preprocess/files'), in_hash[:project_use_test_preprocessor] ], + ] + + out_hash[:project_build_paths] = [] + + # fetch already set mock path + out_hash[:project_build_paths] << in_hash[:cmock_mock_path] if (in_hash[:project_use_mocks]) + + paths.each do |path| + build_path_name = path[0] + build_path = path[1] + build_path_add_condition = path[2] + + # insert path into build paths if associated with true condition + out_hash[:project_build_paths] << build_path if build_path_add_condition + # set path symbol name and path for each entry in paths array + out_hash[build_path_name] = build_path + end + + return out_hash + end + + + def set_force_build_filepaths(in_hash) + out_hash = {} + + out_hash[:project_test_force_rebuild_filepath] = File.join( in_hash[:project_test_dependencies_path], 'force_build' ) + out_hash[:project_release_force_rebuild_filepath] = File.join( in_hash[:project_release_dependencies_path], 'force_build' ) if (in_hash[:project_release_build]) + + return out_hash + end + + + def set_rakefile_components(in_hash) + out_hash = { + :project_rakefile_component_files => + [File.join(CEEDLING_LIB, 'tasks_base.rake'), + File.join(CEEDLING_LIB, 'tasks_filesystem.rake'), + File.join(CEEDLING_LIB, 'tasks_tests.rake'), + File.join(CEEDLING_LIB, 'tasks_vendor.rake'), + File.join(CEEDLING_LIB, 'rules_tests.rake')]} + + out_hash[:project_rakefile_component_files] << File.join(CEEDLING_LIB, 'rules_cmock.rake') if (in_hash[:project_use_mocks]) + out_hash[:project_rakefile_component_files] << File.join(CEEDLING_LIB, 'rules_preprocess.rake') if (in_hash[:project_use_test_preprocessor]) + out_hash[:project_rakefile_component_files] << File.join(CEEDLING_LIB, 'rules_tests_aux_dependencies.rake') if (in_hash[:project_use_auxiliary_dependencies]) + + out_hash[:project_rakefile_component_files] << File.join(CEEDLING_LIB, 'rules_release_aux_dependencies.rake') if (in_hash[:project_release_build] and in_hash[:project_use_auxiliary_dependencies]) + out_hash[:project_rakefile_component_files] << File.join(CEEDLING_LIB, 'rules_release.rake') if (in_hash[:project_release_build]) + out_hash[:project_rakefile_component_files] << File.join(CEEDLING_LIB, 'tasks_release.rake') if (in_hash[:project_release_build]) + + return out_hash + end + + + def set_library_build_info_filepaths(hash) + + # Notes: + # - Dependency on a change to our input configuration hash is handled elsewhere as it is + # dynamically formed during ceedling's execution + # - Compiled vendor dependencies like cmock.o, unity.o, cexception.o are handled below; + # here we're interested only in ceedling-based code generation dependencies + + ceedling_build_info_filepath = File.join(CEEDLING_RELEASE, 'build.info') + cmock_build_info_filepath = FilePathUtils::form_ceedling_vendor_path('cmock/release', 'build.info') + + out_hash = { + :ceedling_build_info_filepath => ceedling_build_info_filepath, + :cmock_build_info_filepath => cmock_build_info_filepath + } + + return out_hash + end + + + def set_release_target(in_hash) + return {} if (not in_hash[:project_release_build]) + + release_target_file = ((in_hash[:release_build_output].nil?) ? (DEFAULT_RELEASE_TARGET_NAME.ext(in_hash[:extension_executable])) : in_hash[:release_build_output]) + + return { + # tempted to make a helper method in file_path_utils? stop right there, pal. you'll introduce a cyclical dependency + :project_release_build_target => File.join(in_hash[:project_release_artifacts_path], release_target_file) + } + end + + + def collect_environment_variables(in_hash) + return { + :collection_environment => in_hash[:environment] + } + end + + + def collect_project_options(in_hash) + options = [] + + in_hash[:project_options_paths].each do |path| + options << @file_wrapper.directory_listing( File.join(path, '*.yml') ) + end + + return { + :collection_project_options => options.flatten + } + end + + + def expand_all_path_globs(in_hash) + out_hash = {} + path_keys = [] + + in_hash.each_key do |key| + next if (not key.to_s[0..4] == 'paths') + path_keys << key + end + + # sorted to provide assured order of traversal in test calls on mocks + path_keys.sort.each do |key| + out_hash["collection_#{key.to_s}".to_sym] = @file_system_utils.collect_paths( in_hash[key] ) + end + + return out_hash + end + + + def collect_source_and_include_paths(in_hash) + return { + :collection_paths_source_and_include => + in_hash[:collection_paths_source] + + in_hash[:collection_paths_include] + } + end + + + def collect_source_include_vendor_paths(in_hash) + extra_paths = [] + extra_paths << FilePathUtils::form_ceedling_vendor_path(CEXCEPTION_LIB_PATH) if (in_hash[:project_use_exceptions]) + + return { + :collection_paths_source_include_vendor => + in_hash[:collection_paths_source_and_include] + + extra_paths + } + end + + + def collect_test_support_source_include_paths(in_hash) + return { + :collection_paths_test_support_source_include => + in_hash[:collection_paths_test] + + in_hash[:collection_paths_support] + + in_hash[:collection_paths_source] + + in_hash[:collection_paths_include] + } + end + + + def collect_test_support_source_include_vendor_paths(in_hash) + extra_paths = [] + extra_paths << FilePathUtils::form_ceedling_vendor_path(UNITY_LIB_PATH) + extra_paths << FilePathUtils::form_ceedling_vendor_path(CEXCEPTION_LIB_PATH) if (in_hash[:project_use_exceptions]) + extra_paths << FilePathUtils::form_ceedling_vendor_path(CMOCK_LIB_PATH) if (in_hash[:project_use_mocks]) + extra_paths << in_hash[:cmock_mock_path] if (in_hash[:project_use_mocks]) + + return { + :collection_paths_test_support_source_include_vendor => + in_hash[:collection_paths_test_support_source_include] + + extra_paths + } + end + + + def collect_tests(in_hash) + all_tests = @file_wrapper.instantiate_file_list + + in_hash[:collection_paths_test].each do |path| + all_tests.include( File.join(path, "#{in_hash[:project_test_file_prefix]}*#{in_hash[:extension_source]}") ) + end + + return {:collection_all_tests => all_tests} + end + + + def collect_assembly(in_hash) + all_assembly = @file_wrapper.instantiate_file_list + + return {:collection_all_assembly => all_assembly} if (not in_hash[:release_build_use_assembly]) + + in_hash[:collection_paths_source].each do |path| + all_assembly.include( File.join(path, "*#{in_hash[:extension_assembly]}") ) + end + + return {:collection_all_assembly => all_assembly} + end + + + def collect_source(in_hash) + all_source = @file_wrapper.instantiate_file_list + + in_hash[:collection_paths_source].each do |path| + all_source.include( File.join(path, "*#{in_hash[:extension_source]}") ) + end + + return {:collection_all_source => all_source} + end + + + def collect_headers(in_hash) + all_headers = @file_wrapper.instantiate_file_list + + paths = + in_hash[:collection_paths_test] + + in_hash[:collection_paths_support] + + in_hash[:collection_paths_source] + + in_hash[:collection_paths_include] + + (paths).each do |path| + all_headers.include( File.join(path, "*#{in_hash[:extension_header]}") ) + end + + return {:collection_all_headers => all_headers} + end + + + def collect_all_existing_compilation_input(in_hash) + all_input = @file_wrapper.instantiate_file_list + + paths = + in_hash[:collection_paths_test] + + in_hash[:collection_paths_support] + + in_hash[:collection_paths_source] + + in_hash[:collection_paths_include] + + [FilePathUtils::form_ceedling_vendor_path(UNITY_LIB_PATH)] + + paths << FilePathUtils::form_ceedling_vendor_path(CEXCEPTION_LIB_PATH) if (in_hash[:project_use_exceptions]) + paths << FilePathUtils::form_ceedling_vendor_path(CMOCK_LIB_PATH) if (in_hash[:project_use_mocks]) + + (paths).each do |path| + all_input.include( File.join(path, "*#{in_hash[:extension_header]}") ) + all_input.include( File.join(path, "*#{in_hash[:extension_source]}") ) + end + + return {:collection_all_existing_compilation_input => all_input} + end + + + def collect_test_and_vendor_defines(in_hash) + test_defines = in_hash[:defines_test].clone + + test_defines.concat(in_hash[:unity_defines]) + test_defines.concat(in_hash[:cmock_defines]) if (in_hash[:project_use_mocks]) + test_defines.concat(in_hash[:cexception_defines]) if (in_hash[:project_use_exceptions]) + + return {:collection_defines_test_and_vendor => test_defines} + end + + + def collect_release_and_vendor_defines(in_hash) + release_defines = in_hash[:defines_release].clone + + release_defines.concat(in_hash[:cexception_defines]) if (in_hash[:project_use_exceptions]) + + return {:collection_defines_release_and_vendor => release_defines} + end + + + def collect_release_artifact_extra_link_objects(in_hash) + objects = [] + + # no build paths here so plugins can remap if necessary (i.e. path mapping happens at runtime) + objects << CEXCEPTION_C_FILE.ext( in_hash[:extension_object] ) if (in_hash[:project_use_exceptions]) + + return {:collection_release_artifact_extra_link_objects => objects} + end + + + def collect_test_fixture_extra_link_objects(in_hash) + # Note: Symbols passed to compiler at command line can change Unity and CException behavior / configuration; + # we also handle those dependencies elsewhere in compilation dependencies + + objects = [UNITY_C_FILE] + + # we don't include paths here because use of plugins or mixing different compilers may require different build paths + objects << CEXCEPTION_C_FILE if (in_hash[:project_use_exceptions]) + objects << CMOCK_C_FILE if (in_hash[:project_use_mocks]) + + # if we're using mocks & a unity helper is defined & that unity helper includes a source file component (not only a header of macros), + # then link in the unity_helper object file too + if ( in_hash[:project_use_mocks] and + in_hash[:cmock_unity_helper] and + @file_wrapper.exist?(in_hash[:cmock_unity_helper].ext(in_hash[:extension_source])) ) + objects << File.basename(in_hash[:cmock_unity_helper]) + end + + # no build paths here so plugins can remap if necessary (i.e. path mapping happens at runtime) + objects.map! { |object| object.ext(in_hash[:extension_object]) } + + return { :collection_test_fixture_extra_link_objects => objects } + end + +end diff --git a/flex-bison/mark1/tools/ceedling/lib/configurator_plugins.rb b/flex-bison/mark1/tools/ceedling/lib/configurator_plugins.rb new file mode 100644 index 0000000..4a65579 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/configurator_plugins.rb @@ -0,0 +1,96 @@ +require 'constants' + +class ConfiguratorPlugins + + constructor :stream_wrapper, :file_wrapper, :system_wrapper + + def setup + @rake_plugins = [] + @script_plugins = [] + end + + + def add_load_paths(config) + config[:plugins][:load_paths].each do |root| + @system_wrapper.add_load_path( root ) if ( not @file_wrapper.directory_listing( File.join( root, '*.rb' ) ).empty? ) + + config[:plugins][:enabled].each do |plugin| + path = File.join( root, plugin ) + @system_wrapper.add_load_path( path ) if ( not @file_wrapper.directory_listing( File.join( path, '*.rb' ) ).empty? ) + end + end + end + + + # gather up and return .rake filepaths that exist on-disk + def find_rake_plugins(config) + plugins_with_path = [] + + config[:plugins][:load_paths].each do |root| + config[:plugins][:enabled].each do |plugin| + rake_plugin_path = File.join(root, plugin, "#{plugin}.rake") + if (@file_wrapper.exist?(rake_plugin_path)) + plugins_with_path << rake_plugin_path + @rake_plugins << plugin + end + end + end + + return plugins_with_path + end + + + # gather up and return just names of .rb classes that exist on-disk + def find_script_plugins(config) + config[:plugins][:load_paths].each do |root| + config[:plugins][:enabled].each do |plugin| + script_plugin_path = File.join(root, plugin, "#{plugin}.rb") + @script_plugins << plugin if @file_wrapper.exist?(script_plugin_path) + end + end + + return @script_plugins + end + + + # gather up and return configuration .yml filepaths that exist on-disk + def find_config_plugins(config) + plugins_with_path = [] + + config[:plugins][:load_paths].each do |root| + config[:plugins][:enabled].each do |plugin| + config_plugin_path = File.join(root, plugin, "#{plugin}.yml") + plugins_with_path << config_plugin_path if @file_wrapper.exist?(config_plugin_path) + end + end + + return plugins_with_path + end + + + # gather up and return default .yml filepaths that exist on-disk + def find_plugin_defaults(config) + defaults_with_path = [] + + config[:plugins][:load_paths].each do |root| + config[:plugins][:enabled].each do |plugin| + default_path = File.join(root, plugin, 'defaults.yml') + defaults_with_path << default_path if @file_wrapper.exist?(default_path) + end + end + + return defaults_with_path + end + + + def validate_plugins(enabled_plugins) + missing_plugins = Set.new(enabled_plugins) - Set.new(@rake_plugins) - Set.new(@script_plugins) + + missing_plugins.each do |plugin| + @stream_wrapper.stdout_puts.stderr_puts("ERROR: Ceedling plugin '#{plugin}' contains no rake or ruby class entry point. (Misspelled or missing files?)") + end + + raise if (missing_plugins.size > 0) + end + +end diff --git a/flex-bison/mark1/tools/ceedling/lib/configurator_setup.rb b/flex-bison/mark1/tools/ceedling/lib/configurator_setup.rb new file mode 100644 index 0000000..e404727 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/configurator_setup.rb @@ -0,0 +1,114 @@ + +# add sort-ability to symbol so we can order keys array in hash for test-ability +class Symbol + include Comparable + + def <=>(other) + self.to_s <=> other.to_s + end +end + + +class ConfiguratorSetup + + constructor :configurator_builder, :configurator_validator + + + def build_project_config(config) + # convert config object to flattened hash + new_config = @configurator_builder.flattenify(config) + + # flesh out config + @configurator_builder.clean(new_config) + + # add to hash values we build up from configuration & file system contents + new_config.merge!(@configurator_builder.set_build_paths(new_config)) + new_config.merge!(@configurator_builder.set_force_build_filepaths(new_config)) + new_config.merge!(@configurator_builder.set_rakefile_components(new_config)) + new_config.merge!(@configurator_builder.set_library_build_info_filepaths(new_config)) + new_config.merge!(@configurator_builder.set_release_target(new_config)) + new_config.merge!(@configurator_builder.collect_project_options(new_config)) + new_config.merge!(@configurator_builder.collect_environment_variables(config)) + + # iterate through all entries in paths section and expand any & all globs to actual paths + new_config.merge!(@configurator_builder.expand_all_path_globs(new_config)) + + new_config.merge!(@configurator_builder.collect_source_and_include_paths(new_config)) + new_config.merge!(@configurator_builder.collect_source_include_vendor_paths(new_config)) + new_config.merge!(@configurator_builder.collect_test_support_source_include_paths(new_config)) + new_config.merge!(@configurator_builder.collect_test_support_source_include_vendor_paths(new_config)) + new_config.merge!(@configurator_builder.collect_tests(new_config)) + new_config.merge!(@configurator_builder.collect_assembly(new_config)) + new_config.merge!(@configurator_builder.collect_source(new_config)) + new_config.merge!(@configurator_builder.collect_headers(new_config)) + new_config.merge!(@configurator_builder.collect_all_existing_compilation_input(new_config)) + new_config.merge!(@configurator_builder.collect_test_and_vendor_defines(new_config)) + new_config.merge!(@configurator_builder.collect_release_and_vendor_defines(new_config)) + new_config.merge!(@configurator_builder.collect_release_artifact_extra_link_objects(new_config)) + new_config.merge!(@configurator_builder.collect_test_fixture_extra_link_objects(new_config)) + + return new_config + end + + + def build_constants_and_accessors(config, context) + @configurator_builder.build_global_constants(config) + @configurator_builder.build_accessor_methods(config, context) + end + + + def validate_required_sections(config) + validation = [] + validation << @configurator_validator.exists?(config, :project) + validation << @configurator_validator.exists?(config, :paths) + + return false if (validation.include?(false)) + return true + end + + def validate_required_section_values(config) + validation = [] + validation << @configurator_validator.exists?(config, :project, :build_root) + validation << @configurator_validator.exists?(config, :paths, :test) + validation << @configurator_validator.exists?(config, :paths, :source) + + return false if (validation.include?(false)) + return true + end + + def validate_paths(config) + validation = [] + + validation << @configurator_validator.validate_filepath(config, {:search_system_path => false}, :project, :build_root) + validation << @configurator_validator.validate_filepath(config, {:search_system_path => false}, :cmock, :unity_helper) if config[:cmock][:unity_helper] + + config[:project][:options_paths].each do |path| + validation << @configurator_validator.validate_filepath_simple( path, :project, :options_paths ) + end + + config[:plugins][:load_paths].each do |path| + validation << @configurator_validator.validate_filepath_simple( path, :plugins, :load_paths ) + end + + config[:paths].keys.sort.each do |key| + validation << @configurator_validator.validate_path_list(config, :paths, key) + end + + return false if (validation.include?(false)) + return true + end + + def validate_tools(config) + validation = [] + + config[:tools].keys.sort.each do |key| + validation << @configurator_validator.exists?(config, :tools, key, :executable) + validation << @configurator_validator.validate_filepath(config, {:search_system_path => true}, :tools, key, :executable) + validation << @configurator_validator.validate_tool_stderr_redirect(config, :tools, key) + end + + return false if (validation.include?(false)) + return true + end + +end diff --git a/flex-bison/mark1/tools/ceedling/lib/configurator_validator.rb b/flex-bison/mark1/tools/ceedling/lib/configurator_validator.rb new file mode 100644 index 0000000..e50c0d4 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/configurator_validator.rb @@ -0,0 +1,154 @@ +require 'constants' +require 'tool_executor' # for argument replacement pattern +require 'file_path_utils' # for glob handling class methods + + +class ConfiguratorValidator + + constructor :file_wrapper, :stream_wrapper, :system_wrapper + + # walk into config hash verify existence of data at key depth + def exists?(config, *keys) + hash = retrieve_value(config, keys) + exist = !hash[:value].nil? + + if (not exist) + # no verbosity checking since this is lowest level anyhow & verbosity checking depends on configurator + @stream_wrapper.stderr_puts("ERROR: Required config file entry #{format_key_sequence(keys, hash[:depth])} does not exist.") + end + + return exist + end + + + # walk into config hash. verify directory path(s) at given key depth + def validate_path_list(config, *keys) + hash = retrieve_value(config, keys) + list = hash[:value] + + # return early if we couldn't walk into hash and find a value + return false if (list.nil?) + + path_list = [] + exist = true + + case list + when String then path_list << list + when Array then path_list = list + end + + path_list.each do |path| + base_path = FilePathUtils::extract_path(path) # lop off add/subtract notation & glob specifiers + + if (not @file_wrapper.exist?(base_path)) + # no verbosity checking since this is lowest level anyhow & verbosity checking depends on configurator + @stream_wrapper.stderr_puts("ERROR: Config path #{format_key_sequence(keys, hash[:depth])}['#{base_path}'] does not exist on disk.") + exist = false + end + end + + return exist + end + + + # simple path verification + def validate_filepath_simple(path, *keys) + validate_path = path + + if (not @file_wrapper.exist?(validate_path)) + # no verbosity checking since this is lowest level anyhow & verbosity checking depends on configurator + @stream_wrapper.stderr_puts("ERROR: Config path '#{validate_path}' associated with #{format_key_sequence(keys, keys.size)} does not exist on disk.") + return false + end + + return true + end + + + # walk into config hash. verify specified file exists. + def validate_filepath(config, options, *keys) + hash = retrieve_value(config, keys) + filepath = hash[:value] + + # return early if we couldn't walk into hash and find a value + return false if (filepath.nil?) + + # skip everything if we've got an argument replacement pattern + return true if (filepath =~ TOOL_EXECUTOR_ARGUMENT_REPLACEMENT_PATTERN) + + # if there's no path included, verify file exists somewhere in system search paths + if (not filepath.include?('/') and options[:search_system_path]) + exists = false + + @system_wrapper.search_paths.each do |path| + if (@file_wrapper.exist?(File.join(path, filepath))) + exists = true + break + end + end + + if (not exists) + # no verbosity checking since this is lowest level anyhow & verbosity checking depends on configurator + @stream_wrapper.stderr_puts("ERROR: Config filepath #{format_key_sequence(keys, hash[:depth])}['#{filepath}'] does not exist in system search paths.") + return false + end + + # if there is a path included, check that explicit filepath exists + else + if (not @file_wrapper.exist?(filepath)) + # no verbosity checking since this is lowest level anyhow & verbosity checking depends on configurator + @stream_wrapper.stderr_puts("ERROR: Config filepath #{format_key_sequence(keys, hash[:depth])}['#{filepath}'] does not exist on disk.") + return false + end + end + + return true + end + + def validate_tool_stderr_redirect(config, tools, tool) + redirect = config[tools][tool][:stderr_redirect] + if (redirect.class == Symbol) + # map constants and force to array of strings for runtime universality across ruby versions + if (not StdErrRedirect.constants.map{|constant| constant.to_s}.include?(redirect.to_s.upcase)) + error = "ERROR: [:#{tools}][:#{tool}][:stderr_redirect][:#{redirect}] is not a recognized option " + + "{#{StdErrRedirect.constants.map{|constant| ':' + constant.to_s.downcase}.join(', ')}}." + @stream_wrapper.stderr_puts(error) + return false + end + end + + return true + end + + private ######################################### + + + def retrieve_value(config, keys) + value = nil + hash = config + depth = 0 + + # walk into hash & extract value at requested key sequence + keys.each do |symbol| + depth += 1 + if (not hash[symbol].nil?) + hash = hash[symbol] + value = hash + else + value = nil + break + end + end + + return {:value => value, :depth => depth} + end + + + def format_key_sequence(keys, depth) + walked_keys = keys.slice(0, depth) + formatted_keys = walked_keys.map{|key| "[:#{key.to_s}]"} + + return formatted_keys.join + end + +end diff --git a/flex-bison/mark1/tools/ceedling/lib/constants.rb b/flex-bison/mark1/tools/ceedling/lib/constants.rb new file mode 100644 index 0000000..634a7e4 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/constants.rb @@ -0,0 +1,62 @@ + +class Verbosity + SILENT = 0 # as silent as possible (though there are some messages that must be spit out) + ERRORS = 1 # only errors + COMPLAIN = 2 # spit out errors and warnings/notices + NORMAL = 3 # errors, warnings/notices, standard status messages + OBNOXIOUS = 4 # all messages including extra verbose output (used for lite debugging / verification) + DEBUG = 5 # special extra verbose output for hardcore debugging +end + + +class TestResultsSanityChecks + NONE = 0 # no sanity checking of test results + NORMAL = 1 # perform non-problematic checks + THOROUGH = 2 # perform checks that require inside knowledge of system workings +end + + +class StdErrRedirect + NONE = :none + AUTO = :auto + WIN = :win + UNIX = :unix + TCSH = :tcsh +end + +CEXCEPTION_ROOT_PATH = 'c_exception' +CEXCEPTION_LIB_PATH = "#{CEXCEPTION_ROOT_PATH}/lib" +CEXCEPTION_C_FILE = 'CException.c' +CEXCEPTION_H_FILE = 'CException.h' + +UNITY_ROOT_PATH = 'unity' +UNITY_LIB_PATH = "#{UNITY_ROOT_PATH}/src" +UNITY_C_FILE = 'unity.c' +UNITY_H_FILE = 'unity.h' +UNITY_INTERNALS_H_FILE = 'unity_internals.h' + +CMOCK_ROOT_PATH = 'cmock' +CMOCK_LIB_PATH = "#{CMOCK_ROOT_PATH}/src" +CMOCK_C_FILE = 'cmock.c' +CMOCK_H_FILE = 'cmock.h' + + +DEFAULT_CEEDLING_MAIN_PROJECT_FILE = 'project.yml' # main project file +DEFAULT_CEEDLING_USER_PROJECT_FILE = 'user.yml' # supplemental user config file + +INPUT_CONFIGURATION_CACHE_FILE = 'input.yml' # input configuration file dump + + +TEST_ROOT_NAME = 'test' +TEST_TASK_ROOT = TEST_ROOT_NAME + ':' +TEST_CONTEXT = TEST_ROOT_NAME.to_sym +RELEASE_ROOT_NAME = 'release' + +RUBY_STRING_REPLACEMENT_PATTERN = /#\{.+\}/ +RUBY_EVAL_REPLACEMENT_PATTERN = /^\{(.+)\}$/ +TOOL_EXECUTOR_ARGUMENT_REPLACEMENT_PATTERN = /(\$\{(\d+)\})/ + +NULL_FILE_PATH = '/dev/null' + +TESTS_BASE_PATH = 'tests' +RELEASE_BASE_PATH = 'release' diff --git a/flex-bison/mark1/tools/ceedling/lib/defaults.rb b/flex-bison/mark1/tools/ceedling/lib/defaults.rb new file mode 100644 index 0000000..78cbcbd --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/defaults.rb @@ -0,0 +1,349 @@ +require 'constants' +require 'system_wrapper' +require 'file_path_utils' + + +DEFAULT_TEST_COMPILER_TOOL = { + :executable => FilePathUtils.os_executable_ext('gcc'), + :name => 'default_test_compiler', + :stderr_redirect => StdErrRedirect::NONE, + :arguments => [ + {"-I\"$\"" => 'COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR'}, + {"-I\"$\"" => 'COLLECTION_PATHS_TEST_TOOLCHAIN_INCLUDE'}, + {"-D$" => 'COLLECTION_DEFINES_TEST_AND_VENDOR'}, + "-DGNU_COMPILER", + {"$" => 'TEST_COMPILER_ARGUMENTS'}, + "-c \"${1}\"", + "-o \"${2}\"", + ] + } + +DEFAULT_TEST_LINKER_TOOL = { + :executable => FilePathUtils.os_executable_ext('gcc'), + :name => 'default_test_linker', + :stderr_redirect => StdErrRedirect::NONE, + :arguments => [ + {"$" => 'TEST_LINKER_ARGUMENTS'}, + "\"${1}\"", + "-o \"${2}\"", + ] + } + +DEFAULT_TEST_FIXTURE_TOOL = { + :executable => '${1}', + :name => 'default_test_fixture', + :stderr_redirect => StdErrRedirect::AUTO, + :arguments => [ + {"$" => 'TEST_FIXTURE_ARGUMENTS'}, + ] + } + + + +DEFAULT_TEST_INCLUDES_PREPROCESSOR_TOOL = { + :executable => FilePathUtils.os_executable_ext('cpp'), + :name => 'default_test_includes_preprocessor', + :stderr_redirect => StdErrRedirect::NONE, + :arguments => [ + '-MM', '-MG', + # avoid some possibility of deep system lib header file complications by omitting vendor paths + # if cpp is run on *nix system, escape spaces in paths; if cpp on windows just use the paths collection as is + {"-I\"$\"" => "{SystemWrapper.is_windows? ? COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE : COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE.map{|path| path.gsub(\/ \/, \'\\\\ \') }}"}, + {"-D$" => 'COLLECTION_DEFINES_TEST_AND_VENDOR'}, + {"-D$" => 'DEFINES_TEST_PREPROCESS'}, + "-DGNU_PREPROCESSOR", + {"$" => 'TEST_INCLUDES_PREPROCESSOR_ARGUMENTS'}, + '-w', + '-nostdinc', + "\"${1}\"" + ] + } + +DEFAULT_TEST_FILE_PREPROCESSOR_TOOL = { + :executable => FilePathUtils.os_executable_ext('gcc'), + :name => 'default_test_file_preprocessor', + :stderr_redirect => StdErrRedirect::NONE, + :arguments => [ + '-E', + {"-I\"$\"" => 'COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR'}, + {"-I\"$\"" => 'PATHS_TEST_TOOLCHAIN_INCLUDE'}, + {"-D$" => 'COLLECTION_DEFINES_TEST_AND_VENDOR'}, + {"-D$" => 'DEFINES_TEST_PREPROCESS'}, + "-DGNU_PREPROCESSOR", + {"$" => 'TEST_FILE_PREPROCESSOR_ARGUMENTS'}, + "\"${1}\"", + "-o \"${2}\"" + ] + } + +DEFAULT_TEST_DEPENDENCIES_GENERATOR_TOOL = { + :executable => FilePathUtils.os_executable_ext('gcc'), + :name => 'default_test_dependencies_generator', + :stderr_redirect => StdErrRedirect::NONE, + :arguments => [ + {"-I\"$\"" => 'COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR'}, + {"-I\"$\"" => 'COLLECTION_PATHS_TEST_TOOLCHAIN_INCLUDE'}, + {"-D$" => 'COLLECTION_DEFINES_TEST_AND_VENDOR'}, + {"-D$" => 'DEFINES_TEST_PREPROCESS'}, + "-DGNU_PREPROCESSOR", + "-MT \"${3}\"", + '-MM', '-MD', '-MG', + "-MF \"${2}\"", + {"$" => 'TEST_DEPENDENCIES_GENERATOR_ARGUMENTS'}, + "-c \"${1}\"", + ] + } + +DEFAULT_RELEASE_DEPENDENCIES_GENERATOR_TOOL = { + :executable => FilePathUtils.os_executable_ext('gcc'), + :name => 'default_release_dependencies_generator', + :stderr_redirect => StdErrRedirect::NONE, + :arguments => [ + {"-I\"$\"" => 'COLLECTION_PATHS_SOURCE_AND_INCLUDE'}, + {"-I\"$\"" => 'COLLECTION_PATHS_RELEASE_TOOLCHAIN_INCLUDE'}, + {"-D$" => 'COLLECTION_DEFINES_RELEASE_AND_VENDOR'}, + {"-D$" => 'DEFINES_RELEASE_PREPROCESS'}, + "-DGNU_PREPROCESSOR", + "-MT \"${3}\"", + '-MM', '-MD', '-MG', + "-MF \"${2}\"", + {"$" => 'RELEASE_DEPENDENCIES_GENERATOR_ARGUMENTS'}, + "-c \"${1}\"", + ] + } + + +DEFAULT_RELEASE_COMPILER_TOOL = { + :executable => FilePathUtils.os_executable_ext('gcc'), + :name => 'default_release_compiler', + :stderr_redirect => StdErrRedirect::NONE, + :arguments => [ + {"-I\"$\"" => 'COLLECTION_PATHS_SOURCE_INCLUDE_VENDOR'}, + {"-I\"$\"" => 'COLLECTION_PATHS_RELEASE_TOOLCHAIN_INCLUDE'}, + {"-D$" => 'COLLECTION_DEFINES_RELEASE_AND_VENDOR'}, + "-DGNU_COMPILER", + {"$" => 'RELEASE_COMPILER_ARGUMENTS'}, + "-c \"${1}\"", + "-o \"${2}\"", + ] + } + +DEFAULT_RELEASE_ASSEMBLER_TOOL = { + :executable => FilePathUtils.os_executable_ext('as'), + :name => 'default_release_assembler', + :stderr_redirect => StdErrRedirect::NONE, + :arguments => [ + {"-I\"$\"" => 'COLLECTION_PATHS_SOURCE_AND_INCLUDE'}, + {"$" => 'RELEASE_ASSEMBLER_ARGUMENTS'}, + "\"${1}\"", + "-o \"${2}\"", + ] + } + +DEFAULT_RELEASE_LINKER_TOOL = { + :executable => FilePathUtils.os_executable_ext('gcc'), + :name => 'default_release_linker', + :stderr_redirect => StdErrRedirect::NONE, + :arguments => [ + {"$" => 'RELEASE_LINKER_ARGUMENTS'}, + "\"${1}\"", + "-o \"${2}\"", + ] + } + + +DEFAULT_TOOLS_TEST = { + :tools => { + :test_compiler => DEFAULT_TEST_COMPILER_TOOL, + :test_linker => DEFAULT_TEST_LINKER_TOOL, + :test_fixture => DEFAULT_TEST_FIXTURE_TOOL, + } + } + +DEFAULT_TOOLS_TEST_PREPROCESSORS = { + :tools => { + :test_includes_preprocessor => DEFAULT_TEST_INCLUDES_PREPROCESSOR_TOOL, + :test_file_preprocessor => DEFAULT_TEST_FILE_PREPROCESSOR_TOOL, + } + } + +DEFAULT_TOOLS_TEST_DEPENDENCIES = { + :tools => { + :test_dependencies_generator => DEFAULT_TEST_DEPENDENCIES_GENERATOR_TOOL, + } + } + + +DEFAULT_TOOLS_RELEASE = { + :tools => { + :release_compiler => DEFAULT_RELEASE_COMPILER_TOOL, + :release_linker => DEFAULT_RELEASE_LINKER_TOOL, + } + } + +DEFAULT_TOOLS_RELEASE_ASSEMBLER = { + :tools => { + :release_assembler => DEFAULT_RELEASE_ASSEMBLER_TOOL, + } + } + +DEFAULT_TOOLS_RELEASE_DEPENDENCIES = { + :tools => { + :release_dependencies_generator => DEFAULT_RELEASE_DEPENDENCIES_GENERATOR_TOOL, + } + } + + +DEFAULT_RELEASE_TARGET_NAME = 'project' + +DEFAULT_CEEDLING_CONFIG = { + :project => { + # :build_root must be set by user + :use_exceptions => true, + :use_mocks => true, + :use_test_preprocessor => false, + :use_auxiliary_dependencies => false, + :test_file_prefix => 'test_', + :options_paths => [], + :release_build => false, + }, + + :release_build => { + # :output is set while building configuration -- allows smart default system-dependent file extension handling + :use_assembly => false, + }, + + :paths => { + :test => [], # must be populated by user + :source => [], # must be populated by user + :support => [], + :include => [], + :test_toolchain_include => [], + :release_toolchain_include => [], + }, + + # unlike other top-level entries, environment's value is an array to preserve order + :environment => [ + # when evaluated, this provides wider text field for rake task comments + {:rake_columns => '120'}, + ], + + :defines => { + :test => [], + :test_preprocess => [], + :release => [], + :release_preprocess => [], + }, + + :extension => { + :header => '.h', + :source => '.c', + :assembly => '.s', + :object => '.o', + :executable => ( SystemWrapper.is_windows? ? '.exe' : '.out' ), + :testpass => '.pass', + :testfail => '.fail', + :dependencies => '.d', + }, + + :unity => { + :defines => [] + }, + + :cmock => { + :defines => [] + }, + + :cexception => { + :defines => [] + }, + + :test_runner => { + :includes => [], + :file_suffix => '_runner', + }, + + # all tools populated while building up config structure + :tools => {}, + + # empty argument lists for default tools + # (these can be overridden in project file to add arguments to tools without totally redefining tools) + :test_compiler => { :arguments => [] }, + :test_linker => { :arguments => [] }, + :test_fixture => { + :arguments => [], + :link_objects => [], # compiled object files to always be linked in (e.g. cmock.o if using mocks) + }, + :test_includes_preprocessor => { :arguments => [] }, + :test_file_preprocessor => { :arguments => [] }, + :test_dependencies_generator => { :arguments => [] }, + :release_compiler => { :arguments => [] }, + :release_linker => { :arguments => [] }, + :release_assembler => { :arguments => [] }, + :release_dependencies_generator => { :arguments => [] }, + + :plugins => { + :load_paths => [], + :enabled => [], + } + } + + +DEFAULT_TESTS_RESULTS_REPORT_TEMPLATE = %q{ +% ignored = hash[:results][:counts][:ignored] +% failed = hash[:results][:counts][:failed] +% stdout_count = hash[:results][:counts][:stdout] +% header_prepend = ((hash[:header].length > 0) ? "#{hash[:header]}: " : '') +% banner_width = 25 + header_prepend.length # widest message + +% if (ignored > 0) +<%=@ceedling[:plugin_reportinator].generate_banner(header_prepend + 'IGNORED UNIT TEST SUMMARY')%> +% hash[:results][:ignores].each do |ignore| +% ignore[:collection].each do |item| +<%=ignore[:source][:path]%><%=File::SEPARATOR%><%=ignore[:source][:file]%>:<%=item[:line]%>:<%=item[:test]%> +% if (item[:message].length > 0) +: "<%=item[:message]%>" +% else +<%="\n"%> +% end +% end +% end + +% end +% if (failed > 0) +<%=@ceedling[:plugin_reportinator].generate_banner(header_prepend + 'FAILED UNIT TEST SUMMARY')%> +% hash[:results][:failures].each do |failure| +% failure[:collection].each do |item| +<%=failure[:source][:path]%><%=File::SEPARATOR%><%=failure[:source][:file]%>:<%=item[:line]%>:<%=item[:test]%> +% if (item[:message].length > 0) +: "<%=item[:message]%>" +% else +<%="\n"%> +% end +% end +% end + +% end +% if (stdout_count > 0) +<%=@ceedling[:plugin_reportinator].generate_banner(header_prepend + 'UNIT TEST OTHER OUTPUT')%> +% hash[:results][:stdout].each do |string| +% string[:collection].each do |item| +<%=string[:source][:path]%><%=File::SEPARATOR%><%=string[:source][:file]%>: "<%=item%>" +% end +% end + +% end +% total_string = hash[:results][:counts][:total].to_s +% format_string = "%#{total_string.length}i" +<%=@ceedling[:plugin_reportinator].generate_banner(header_prepend + 'OVERALL UNIT TEST SUMMARY')%> +% if (hash[:results][:counts][:total] > 0) +TESTED: <%=hash[:results][:counts][:total].to_s%> +PASSED: <%=sprintf(format_string, hash[:results][:counts][:passed])%> +FAILED: <%=sprintf(format_string, failed)%> +IGNORED: <%=sprintf(format_string, ignored)%> +% else + +No tests executed. +% end + +} diff --git a/flex-bison/mark1/tools/ceedling/lib/dependinator.rb b/flex-bison/mark1/tools/ceedling/lib/dependinator.rb new file mode 100644 index 0000000..061caee --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/dependinator.rb @@ -0,0 +1,92 @@ + +class Dependinator + + constructor :configurator, :project_config_manager, :test_includes_extractor, :file_path_utils, :rake_wrapper, :file_wrapper + + def touch_force_rebuild_files + @file_wrapper.touch( @configurator.project_test_force_rebuild_filepath ) + @file_wrapper.touch( @configurator.project_release_force_rebuild_filepath ) if (@configurator.project_release_build) + end + + + + def load_release_object_deep_dependencies(dependencies_list) + dependencies_list.each { |dependencies_file| @rake_wrapper.load_dependencies( dependencies_file ) } + end + + + def enhance_release_file_dependencies(files) + files.each do |filepath| + @rake_wrapper[filepath].enhance( [@configurator.project_release_force_rebuild_filepath] ) if (@project_config_manager.release_config_changed) + @rake_wrapper[filepath].enhance( [@configurator.ceedling_build_info_filepath] ) + end + end + + + + def load_test_object_deep_dependencies(files_list) + dependencies_list = @file_path_utils.form_test_dependencies_filelist(files_list) + dependencies_list.each { |dependencies_file| @rake_wrapper.load_dependencies(dependencies_file) } + end + + + def enhance_runner_dependencies(runner_filepath) + @rake_wrapper[runner_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed) + @rake_wrapper[runner_filepath].enhance( [@configurator.ceedling_build_info_filepath] ) + end + + + def enhance_shallow_include_lists_dependencies(include_lists) + include_lists.each do |include_list_filepath| + @rake_wrapper[include_list_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed) + @rake_wrapper[include_list_filepath].enhance( [@configurator.ceedling_build_info_filepath] ) + end + end + + + def enhance_preprocesed_file_dependencies(files) + files.each do |filepath| + @rake_wrapper[filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed) + @rake_wrapper[filepath].enhance( [@configurator.ceedling_build_info_filepath] ) + end + end + + + def enhance_mock_dependencies(mocks_list) + # if input configuration or ceedling changes, make sure these guys get rebuilt + mocks_list.each do |mock_filepath| + @rake_wrapper[mock_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed) + @rake_wrapper[mock_filepath].enhance( [@configurator.cmock_unity_helper] ) if (@configurator.cmock_unity_helper) + @rake_wrapper[mock_filepath].enhance( [@configurator.ceedling_build_info_filepath] ) + @rake_wrapper[mock_filepath].enhance( [@configurator.cmock_build_info_filepath] ) + end + end + + + def enhance_dependencies_dependencies(dependencies) + dependencies.each do |dependencies_filepath| + @rake_wrapper[dependencies_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed) + @rake_wrapper[dependencies_filepath].enhance( [@configurator.ceedling_build_info_filepath] ) + end + end + + + def enhance_test_build_object_dependencies(objects) + objects.each do |object_filepath| + @rake_wrapper[object_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed) + @rake_wrapper[object_filepath].enhance( [@configurator.ceedling_build_info_filepath] ) + end + end + + + def enhance_results_dependencies(result_filepath) + @rake_wrapper[result_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed) + @rake_wrapper[result_filepath].enhance( [@configurator.ceedling_build_info_filepath] ) + end + + + def setup_test_executable_dependencies(test, objects) + @rake_wrapper.create_file_task( @file_path_utils.form_test_executable_filepath(test), objects) + end + +end diff --git a/flex-bison/mark1/tools/ceedling/lib/file_finder.rb b/flex-bison/mark1/tools/ceedling/lib/file_finder.rb new file mode 100644 index 0000000..752d6bd --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/file_finder.rb @@ -0,0 +1,132 @@ +require 'rubygems' +require 'rake' # for adding ext() method to string + +class FileFinder + + constructor :configurator, :file_finder_helper, :cacheinator, :file_path_utils, :file_wrapper, :yaml_wrapper + + def prepare_search_sources + @all_test_source_and_header_file_collection = + @configurator.collection_all_tests + + @configurator.collection_all_source + + @configurator.collection_all_headers + end + + + def find_header_file(mock_file) + header = File.basename(mock_file).sub(/#{@configurator.cmock_mock_prefix}/, '').ext(@configurator.extension_header) + + found_path = @file_finder_helper.find_file_in_collection(header, @configurator.collection_all_headers, :error) + + return found_path + end + + + def find_header_input_for_mock_file(mock_file) + found_path = find_header_file(mock_file) + mock_input = found_path + + if (@configurator.project_use_test_preprocessor) + mock_input = @cacheinator.diff_cached_test_file( @file_path_utils.form_preprocessed_file_filepath( found_path ) ) + end + + return mock_input + end + + + def find_source_from_test(test, complain) + test_prefix = @configurator.project_test_file_prefix + source_paths = @configurator.collection_all_source + + source = File.basename(test).sub(/#{test_prefix}/, '') + + # we don't blow up if a test file has no corresponding source file + return @file_finder_helper.find_file_in_collection(source, source_paths, complain) + end + + + def find_test_from_runner_path(runner_path) + extension_source = @configurator.extension_source + + test_file = File.basename(runner_path).sub(/#{@configurator.test_runner_file_suffix}#{'\\'+extension_source}/, extension_source) + + found_path = @file_finder_helper.find_file_in_collection(test_file, @configurator.collection_all_tests, :error) + + return found_path + end + + + def find_test_input_for_runner_file(runner_path) + found_path = find_test_from_runner_path(runner_path) + runner_input = found_path + + if (@configurator.project_use_test_preprocessor) + runner_input = @cacheinator.diff_cached_test_file( @file_path_utils.form_preprocessed_file_filepath( found_path ) ) + end + + return runner_input + end + + + def find_test_from_file_path(file_path) + test_file = File.basename(file_path).ext(@configurator.extension_source) + + found_path = @file_finder_helper.find_file_in_collection(test_file, @configurator.collection_all_tests, :error) + + return found_path + end + + + def find_test_or_source_or_header_file(file_path) + file = File.basename(file_path) + return @file_finder_helper.find_file_in_collection(file, @all_test_source_and_header_file_collection, :error) + end + + + def find_compilation_input_file(file_path) + found_file = '' + + source_file = File.basename(file_path).ext(@configurator.extension_source) + + # We only collect files that already exist when we start up. + # FileLists can produce undesired results for dynamically generated files depending on when they're accessed. + # So collect mocks and runners separately and right now. + if (source_file =~ /#{@configurator.test_runner_file_suffix}/) + found_file = + @file_finder_helper.find_file_in_collection( + source_file, + @file_wrapper.directory_listing( File.join(@configurator.project_test_runners_path, '*') ), + :error) + + elsif (@configurator.project_use_mocks and (source_file =~ /#{@configurator.cmock_mock_prefix}/)) + found_file = + @file_finder_helper.find_file_in_collection( + source_file, + @file_wrapper.directory_listing( File.join(@configurator.cmock_mock_path, '*') ), + :error) + + else + found_file = + @file_finder_helper.find_file_in_collection( + source_file, + @configurator.collection_all_existing_compilation_input, + :error) + end + + return found_file + end + + + def find_source_file(file_path, complain) + source_file = File.basename(file_path).ext(@configurator.extension_source) + return @file_finder_helper.find_file_in_collection(source_file, @configurator.collection_all_source, complain) + end + + + def find_assembly_file(file_path) + assembly_file = File.basename(file_path).ext(@configurator.extension_assembly) + return @file_finder_helper.find_file_in_collection(assembly_file, @configurator.collection_all_assembly, :error) + end + +end + diff --git a/flex-bison/mark1/tools/ceedling/lib/file_finder_helper.rb b/flex-bison/mark1/tools/ceedling/lib/file_finder_helper.rb new file mode 100644 index 0000000..487f0fe --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/file_finder_helper.rb @@ -0,0 +1,54 @@ +require 'fileutils' +require 'constants' # for Verbosity enumeration + +class FileFinderHelper + + constructor :streaminator + + + def find_file_in_collection(file_name, file_list, complain, extra_message="") + file_to_find = nil + + file_list.each do |item| + base_file = File.basename(item) + + # case insensitive comparison + if (base_file.casecmp(file_name) == 0) + # case sensitive check + if (base_file == file_name) + file_to_find = item + break + else + blow_up(file_name, "However, a filename having different capitalization was found: '#{item}'.") + end + end + + end + + case (complain) + when :error then blow_up(file_name, extra_message) if (file_to_find.nil?) + when :warn then gripe(file_name, extra_message) if (file_to_find.nil?) + #when :ignore then + end + + return file_to_find + end + + private + + def blow_up(file_name, extra_message="") + error = "ERROR: Found no file '#{file_name}' in search paths." + error += ' ' if (extra_message.length > 0) + @streaminator.stderr_puts(error + extra_message, Verbosity::ERRORS) + raise + end + + def gripe(file_name, extra_message="") + warning = "WARNING: Found no file '#{file_name}' in search paths." + warning += ' ' if (extra_message.length > 0) + @streaminator.stderr_puts(warning + extra_message, Verbosity::COMPLAIN) + end + +end + + diff --git a/flex-bison/mark1/tools/ceedling/lib/file_path_utils.rb b/flex-bison/mark1/tools/ceedling/lib/file_path_utils.rb new file mode 100644 index 0000000..cb029f9 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/file_path_utils.rb @@ -0,0 +1,177 @@ +require 'rubygems' +require 'rake' # for ext() +require 'fileutils' +require 'system_wrapper' + +# global utility methods (for plugins, project files, etc.) +def ceedling_form_filepath(destination_path, original_filepath, new_extension=nil) + filename = File.basename(original_filepath) + filename.replace(filename.ext(new_extension)) if (!new_extension.nil?) + return File.join( destination_path.gsub(/\\/, '/'), filename ) +end + +class FilePathUtils + + GLOB_MATCHER = /[\*\?\{\}\[\]]/ + + constructor :configurator, :file_wrapper + + + ######### class methods ########## + + # standardize path to use '/' path separator & begin with './' & have no trailing path separator + def self.standardize(path) + path.strip! + path.gsub!(/\\/, '/') + path.gsub!(/^((\+|-):)?\.\//, '') + path.chomp!('/') + return path + end + + def self.os_executable_ext(executable) + return executable.ext('.exe') if SystemWrapper.is_windows? + return executable + end + + # extract directory path from between optional add/subtract aggregation modifiers and up to glob specifiers + # note: slightly different than File.dirname in that /files/foo remains /files/foo and does not become /files + def self.extract_path(path) + path = path.sub(/^(\+|-):/, '') + + # find first occurrence of path separator followed by directory glob specifier: *, ?, {, }, [, ] + find_index = (path =~ GLOB_MATCHER) + + # no changes needed (lop off final path separator) + return path.chomp('/') if (find_index.nil?) + + # extract up to first glob specifier + path = path[0..(find_index-1)] + + # lop off everything up to and including final path separator + find_index = path.rindex('/') + return path[0..(find_index-1)] if (not find_index.nil?) + + # return string up to first glob specifier if no path separator found + return path + end + + # return whether the given path is to be aggregated (no aggregation modifier defaults to same as +:) + def self.add_path?(path) + return (path =~ /^-:/).nil? + end + + # get path (and glob) lopping off optional +: / -: prefixed aggregation modifiers + def self.extract_path_no_aggregation_operators(path) + return path.sub(/^(\+|-):/, '') + end + + # all the globs that may be in a path string work fine with one exception; + # to recurse through all subdirectories, the glob is dir/**/** but our paths use + # convention of only dir/** + def self.reform_glob(path) + return path if (path =~ /\/\*\*$/).nil? + return path + '/**' + end + + def self.form_ceedling_vendor_path(*filepaths) + return File.join( CEEDLING_VENDOR, filepaths ) + end + + ######### instance methods ########## + + def form_temp_path(filepath, prefix='') + return File.join( @configurator.project_temp_path, prefix + File.basename(filepath) ) + end + + ### release ### + def form_release_build_cache_path(filepath) + return File.join( @configurator.project_release_build_cache_path, File.basename(filepath) ) + end + + def form_release_dependencies_filepath(filepath) + return File.join( @configurator.project_release_dependencies_path, File.basename(filepath).ext(@configurator.extension_dependencies) ) + end + + def form_release_build_c_object_filepath(filepath) + return File.join( @configurator.project_release_build_output_c_path, File.basename(filepath).ext(@configurator.extension_object) ) + end + + def form_release_build_asm_object_filepath(filepath) + return File.join( @configurator.project_release_build_output_asm_path, File.basename(filepath).ext(@configurator.extension_object) ) + end + + def form_release_build_c_objects_filelist(files) + return (@file_wrapper.instantiate_file_list(files)).pathmap("#{@configurator.project_release_build_output_c_path}/%n#{@configurator.extension_object}") + end + + def form_release_build_asm_objects_filelist(files) + return (@file_wrapper.instantiate_file_list(files)).pathmap("#{@configurator.project_release_build_output_asm_path}/%n#{@configurator.extension_object}") + end + + def form_release_dependencies_filelist(files) + return (@file_wrapper.instantiate_file_list(files)).pathmap("#{@configurator.project_release_dependencies_path}/%n#{@configurator.extension_dependencies}") + end + + ### tests ### + def form_test_build_cache_path(filepath) + return File.join( @configurator.project_test_build_cache_path, File.basename(filepath) ) + end + + def form_pass_results_filepath(filepath) + return File.join( @configurator.project_test_results_path, File.basename(filepath).ext(@configurator.extension_testpass) ) + end + + def form_fail_results_filepath(filepath) + return File.join( @configurator.project_test_results_path, File.basename(filepath).ext(@configurator.extension_testfail) ) + end + + def form_runner_filepath_from_test(filepath) + return File.join( @configurator.project_test_runners_path, File.basename(filepath, @configurator.extension_source)) + @configurator.test_runner_file_suffix + @configurator.extension_source + end + + def form_test_filepath_from_runner(filepath) + return filepath.sub(/#{TEST_RUNNER_FILE_SUFFIX}/, '') + end + + def form_runner_object_filepath_from_test(filepath) + return (form_test_build_object_filepath(filepath)).sub(/(#{@configurator.extension_object})$/, "#{@configurator.test_runner_file_suffix}\\1") + end + + def form_test_build_object_filepath(filepath) + return File.join( @configurator.project_test_build_output_path, File.basename(filepath).ext(@configurator.extension_object) ) + end + + def form_test_executable_filepath(filepath) + return File.join( @configurator.project_test_build_output_path, File.basename(filepath).ext(@configurator.extension_executable) ) + end + + def form_preprocessed_file_filepath(filepath) + return File.join( @configurator.project_test_preprocess_files_path, File.basename(filepath) ) + end + + def form_preprocessed_includes_list_filepath(filepath) + return File.join( @configurator.project_test_preprocess_includes_path, File.basename(filepath) ) + end + + def form_test_build_objects_filelist(sources) + return (@file_wrapper.instantiate_file_list(sources)).pathmap("#{@configurator.project_test_build_output_path}/%n#{@configurator.extension_object}") + end + + def form_preprocessed_mockable_headers_filelist(mocks) + # pathmapping note: "%{#{@configurator.cmock_mock_prefix},}n" replaces mock_prefix with nothing (signified by absence of anything after comma inside replacement brackets) + return (@file_wrapper.instantiate_file_list(mocks)).pathmap("#{@configurator.project_test_preprocess_files_path}/%{#{@configurator.cmock_mock_prefix},}n#{@configurator.extension_header}") + end + + def form_mocks_source_filelist(mocks) + return (@file_wrapper.instantiate_file_list(mocks)).pathmap("#{@configurator.cmock_mock_path}/%n#{@configurator.extension_source}") + end + + def form_test_dependencies_filelist(files) + return (@file_wrapper.instantiate_file_list(files)).pathmap("#{@configurator.project_test_dependencies_path}/%n#{@configurator.extension_dependencies}") + end + + def form_pass_results_filelist(path, files) + return (@file_wrapper.instantiate_file_list(files)).pathmap("#{path}/%n#{@configurator.extension_testpass}") + end + +end diff --git a/flex-bison/mark1/tools/ceedling/lib/file_system_utils.rb b/flex-bison/mark1/tools/ceedling/lib/file_system_utils.rb new file mode 100644 index 0000000..2c286ca --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/file_system_utils.rb @@ -0,0 +1,59 @@ +require 'rubygems' +require 'rake' +require 'set' +require 'fileutils' +require 'file_path_utils.rb' + + +class FileSystemUtils + + constructor :file_wrapper + + # build up path list from input of one or more strings or arrays of (+/-) paths & globs + def collect_paths(*paths) + raw = [] # all paths and globs + plus = Set.new # all paths to expand and add + minus = Set.new # all paths to remove from plus set + + # assemble all globs and simple paths, reforming our glob notation to ruby globs + paths.each do |paths_container| + case (paths_container) + when String then raw << (FilePathUtils::reform_glob(paths_container)) + when Array then paths_container.each {|path| raw << (FilePathUtils::reform_glob(path))} + else raise "Don't know how to handle #{paths_container.class}" + end + end + + # iterate through each path and glob + raw.each do |path| + + dirs = [] # container for only (expanded) paths + + # if a glob, expand it and slurp up all non-file paths + if path.include?('*') + # grab base directory only if globs are snug up to final path separator + if (path =~ /\/\*+$/) + dirs << FilePathUtils.extract_path(path) + end + + # grab expanded sub-directory globs + expanded = @file_wrapper.directory_listing( FilePathUtils.extract_path_no_aggregation_operators(path) ) + expanded.each do |entry| + dirs << entry if @file_wrapper.directory?(entry) + end + + # else just grab simple path + # note: we could just run this through glob expansion but such an + # approach doesn't handle a path not yet on disk) + else + dirs << FilePathUtils.extract_path_no_aggregation_operators(path) + end + + # add dirs to the appropriate set based on path aggregation modifier if present + FilePathUtils.add_path?(path) ? plus.merge(dirs) : minus.merge(dirs) + end + + return (plus - minus).to_a.uniq + end + +end diff --git a/flex-bison/mark1/tools/ceedling/lib/file_wrapper.rb b/flex-bison/mark1/tools/ceedling/lib/file_wrapper.rb new file mode 100644 index 0000000..04e1007 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/file_wrapper.rb @@ -0,0 +1,74 @@ +require 'rubygems' +require 'rake' # for FileList +require 'constants' +require 'fileutils' + + +class FileWrapper + + def get_expanded_path(path) + return File.expand_path(path) + end + + def exist?(filepath) + return true if (filepath == NULL_FILE_PATH) + return File.exist?(filepath) + end + + def directory?(path) + return File.directory?(path) + end + + def dirname(path) + return File.dirname(path) + end + + def directory_listing(glob) + return Dir.glob(glob) + end + + def rm_f(filepath, options={}) + FileUtils.rm_f(filepath, options) + end + + def rm_r(filepath, options={}) + FileUtils.rm_r(filepath, options={}) + end + + def cp(source, destination, options={}) + FileUtils.cp(source, destination, options) + end + + def compare(from, to) + return FileUtils.compare_file(from, to) + end + + def open(filepath, flags) + File.open(filepath, flags) do |file| + yield(file) + end + end + + def read(filepath) + return File.read(filepath) + end + + def touch(filepath, options={}) + FileUtils.touch(filepath, options) + end + + def write(filepath, contents, flags='w') + File.open(filepath, flags) do |file| + file.write(contents) + end + end + + def readlines(filepath) + return File.readlines(filepath) + end + + def instantiate_file_list(files=[]) + return FileList.new(files) + end + +end diff --git a/flex-bison/mark1/tools/ceedling/lib/generator.rb b/flex-bison/mark1/tools/ceedling/lib/generator.rb new file mode 100644 index 0000000..f620ee4 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/generator.rb @@ -0,0 +1,131 @@ +require 'constants' # for Verbosity constants class + + +class Generator + + constructor :configurator, :preprocessinator, :cmock_builder, :generator_test_runner, :generator_test_results, :test_includes_extractor, :tool_executor, :file_finder, :file_path_utils, :streaminator, :plugin_manager, :file_wrapper + + + def generate_shallow_includes_list(context, file) + @preprocessinator.preprocess_shallow_includes(file) + end + + def generate_preprocessed_file(context, file) + @streaminator.stdout_puts("Preprocessing #{File.basename(file)}...", Verbosity::NORMAL) + @preprocessinator.preprocess_file(file) + end + + def generate_dependencies_file(tool, context, source, object, dependencies) + @streaminator.stdout_puts("Generating dependencies for #{File.basename(source)}...", Verbosity::NORMAL) + + command_line = + @tool_executor.build_command_line( + tool, + source, + dependencies, + object) + + @tool_executor.exec(command_line) + end + + def generate_mock(context, header_filepath) + arg_hash = {:header_file => header_filepath, :context => context} + @plugin_manager.pre_mock_execute(arg_hash) + + @cmock_builder.cmock.setup_mocks( arg_hash[:header_file] ) + + @plugin_manager.post_mock_execute(arg_hash) + end + + # test_filepath may be either preprocessed test file or original test file + def generate_test_runner(context, test_filepath, runner_filepath) + arg_hash = {:context => context, :test_file => test_filepath, :runner_file => runner_filepath} + + @plugin_manager.pre_runner_execute(arg_hash) + + # collect info we need + module_name = File.basename(arg_hash[:test_file]) + test_cases = @generator_test_runner.find_test_cases( @file_finder.find_test_from_runner_path(runner_filepath) ) + mock_list = @test_includes_extractor.lookup_raw_mock_list(arg_hash[:test_file]) + + @streaminator.stdout_puts("Generating runner for #{module_name}...", Verbosity::NORMAL) + + # build runner file + @file_wrapper.open(runner_filepath, 'w') do |output| + @generator_test_runner.create_header(output, mock_list) + @generator_test_runner.create_externs(output, test_cases) + @generator_test_runner.create_mock_management(output, mock_list) + @generator_test_runner.create_runtest(output, mock_list, test_cases) + @generator_test_runner.create_main(output, module_name, test_cases) + end + + @plugin_manager.post_runner_execute(arg_hash) + end + + def generate_object_file(tool, context, source, object) + arg_hash = {:tool => tool, :context => context, :source => source, :object => object} + @plugin_manager.pre_compile_execute(arg_hash) + + @streaminator.stdout_puts("Compiling #{File.basename(arg_hash[:source])}...", Verbosity::NORMAL) + shell_result = @tool_executor.exec( @tool_executor.build_command_line(arg_hash[:tool], arg_hash[:source], arg_hash[:object]) ) + + arg_hash[:shell_result] = shell_result + @plugin_manager.post_compile_execute(arg_hash) + end + + def generate_executable_file(tool, context, objects, executable) + shell_result = {} + arg_hash = {:tool => tool, :context => context, :objects => objects, :executable => executable} + @plugin_manager.pre_link_execute(arg_hash) + + @streaminator.stdout_puts("Linking #{File.basename(arg_hash[:executable])}...", Verbosity::NORMAL) + + begin + shell_result = @tool_executor.exec( @tool_executor.build_command_line(arg_hash[:tool], arg_hash[:objects], arg_hash[:executable]) ) + rescue + notice = "\n" + + "NOTICE: If the linker reports missing symbols, the following may be to blame:\n" + + " 1. Test lacks #include statements corresponding to needed source files.\n" + + " 2. Project search paths do not contain source files corresponding to #include statements in the test.\n" + + if (@configurator.project_use_mocks) + notice += " 3. Test does not #include needed mocks.\n\n" + else + notice += "\n" + end + + @streaminator.stderr_puts(notice, Verbosity::COMPLAIN) + raise + end + + arg_hash[:shell_result] = shell_result + @plugin_manager.post_link_execute(arg_hash) + end + + def generate_test_results(tool, context, executable, result) + arg_hash = {:tool => tool, :context => context, :executable => executable, :result_file => result} + @plugin_manager.pre_test_execute(arg_hash) + + @streaminator.stdout_puts("Running #{File.basename(arg_hash[:executable])}...", Verbosity::NORMAL) + + # Unity's exit code is equivalent to the number of failed tests, so we tell @tool_executor not to fail out if there are failures + # so that we can run all tests and collect all results + shell_result = @tool_executor.exec( @tool_executor.build_command_line(arg_hash[:tool], arg_hash[:executable]), [], {:boom => false} ) + + if (shell_result[:output].nil? or shell_result[:output].strip.empty?) + @streaminator.stderr_puts("ERROR: Test executable \"#{File.basename(executable)}\" did not produce any results.", Verbosity::ERRORS) + raise + end + + processed = @generator_test_results.process_and_write_results( shell_result, + arg_hash[:result_file], + @file_finder.find_test_from_file_path(arg_hash[:executable]) ) + + arg_hash[:result_file] = processed[:result_file] + arg_hash[:results] = processed[:results] + arg_hash[:shell_result] = shell_result # for raw output display if no plugins for formatted display + + @plugin_manager.post_test_execute(arg_hash) + end + +end diff --git a/flex-bison/mark1/tools/ceedling/lib/generator_test_results.rb b/flex-bison/mark1/tools/ceedling/lib/generator_test_results.rb new file mode 100644 index 0000000..3ac79e2 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/generator_test_results.rb @@ -0,0 +1,90 @@ +require 'rubygems' +require 'rake' # for .ext() +require 'constants' + + +class GeneratorTestResults + TEST_STATISTICS_REGEX = /-+\s+(\d+)\s+Tests\s+(\d+)\s+Failures\s+(\d+)\s+Ignored\s+(OK|FAIL)\s*/i + + constructor :configurator, :generator_test_results_sanity_checker, :yaml_wrapper + + def process_and_write_results(unity_shell_result, results_file, test_file) + output_file = results_file + + results = get_results_structure + + results[:source][:path] = File.dirname(test_file) + results[:source][:file] = File.basename(test_file) + + # process test statistics + if (unity_shell_result[:output] =~ TEST_STATISTICS_REGEX) + results[:counts][:total] = $1.to_i + results[:counts][:failed] = $2.to_i + results[:counts][:ignored] = $3.to_i + results[:counts][:passed] = (results[:counts][:total] - results[:counts][:failed] - results[:counts][:ignored]) + end + + # remove test statistics lines + unity_shell_result[:output].sub!(TEST_STATISTICS_REGEX, '') + + # bust up the output into individual lines + raw_unity_lines = unity_shell_result[:output].split(/\n|\r\n/) + + raw_unity_lines.each do |line| + # process unity output + case line + when /(:IGNORE)/ + elements = extract_line_elements(line, results[:source][:file]) + results[:ignores] << elements[0] + results[:stdout] << elements[1] if (!elements[1].nil?) + when /(:PASS$)/ + elements = extract_line_elements(line, results[:source][:file]) + results[:successes] << elements[0] + results[:stdout] << elements[1] if (!elements[1].nil?) + when /(:FAIL)/ + elements = extract_line_elements(line, results[:source][:file]) + results[:failures] << elements[0] + results[:stdout] << elements[1] if (!elements[1].nil?) + else # collect up all other + results[:stdout] << line.chomp + end + end + + @generator_test_results_sanity_checker.verify(results, unity_shell_result[:exit_code]) + + output_file = results_file.ext(@configurator.extension_testfail) if (results[:counts][:failed] > 0) + + @yaml_wrapper.dump(output_file, results) + + return { :result_file => output_file, :result => results } + end + + private + + def get_results_structure + return { + :source => {:path => '', :file => ''}, + :successes => [], + :failures => [], + :ignores => [], + :counts => {:total => 0, :passed => 0, :failed => 0, :ignored => 0}, + :stdout => [], + } + end + + def extract_line_elements(line, filename) + # handle anything preceding filename in line as extra output to be collected + stdout = nil + stdout_regex = /(.+)#{Regexp.escape(filename)}.+/i + + if (line =~ stdout_regex) + stdout = $1.clone + line.sub!(/#{Regexp.escape(stdout)}/, '') + end + + # collect up test results minus and extra output + elements = (line.strip.split(':'))[1..-1] + return {:test => elements[1], :line => elements[0].to_i, :message => (elements[3..-1].join(':')).strip}, stdout + end + +end diff --git a/flex-bison/mark1/tools/ceedling/lib/generator_test_results_sanity_checker.rb b/flex-bison/mark1/tools/ceedling/lib/generator_test_results_sanity_checker.rb new file mode 100644 index 0000000..9f1b65c --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/generator_test_results_sanity_checker.rb @@ -0,0 +1,62 @@ +require 'constants' +require 'rubygems' +require 'rake' # for ext() method + + +class GeneratorTestResultsSanityChecker + + constructor :configurator, :streaminator + + def verify(results, unity_exit_code) + + # do no sanity checking if it's disabled + return if (@configurator.sanity_checks == TestResultsSanityChecks::NONE) + + ceedling_ignores_count = results[:ignores].size + ceedling_failures_count = results[:failures].size + ceedling_tests_summation = (ceedling_ignores_count + ceedling_failures_count + results[:successes].size) + + # Exit code handling is not a sanity check that can always be performed because + # command line simulators may or may not pass through Unity's exit code + if (@configurator.sanity_checks >= TestResultsSanityChecks::THOROUGH) + # many platforms limit exit codes to a maximum of 255 + if ((ceedling_failures_count != unity_exit_code) and (unity_exit_code < 255)) + sanity_check_warning(results[:source][:file], "Unity's exit code (#{unity_exit_code}) does not match Ceedling's summation of failed test cases (#{ceedling_failures_count}).") + end + + if ((ceedling_failures_count < 255) and (unity_exit_code == 255)) + sanity_check_warning(results[:source][:file], "Ceedling's summation of failed test cases (#{ceedling_failures_count}) is less than Unity's exit code (255 or more).") + end + end + + if (ceedling_ignores_count != results[:counts][:ignored]) + sanity_check_warning(results[:source][:file], "Unity's final ignore count (#{results[:counts][:ignored]}) does not match Ceedling's summation of ignored test cases (#{ceedling_ignores_count}).") + end + + if (ceedling_failures_count != results[:counts][:failed]) + sanity_check_warning(results[:source][:file], "Unity's final fail count (#{results[:counts][:failed]}) does not match Ceedling's summation of failed test cases (#{ceedling_failures_count}).") + end + + if (ceedling_tests_summation != results[:counts][:total]) + sanity_check_warning(results[:source][:file], "Unity's final test count (#{results[:counts][:total]}) does not match Ceedling's summation of all test cases (#{ceedling_tests_summation}).") + end + + end + + private + + def sanity_check_warning(file, message) + notice = "\n" + + "ERROR: Internal sanity check for test fixture '#{file.ext(@configurator.extension_executable)}' finds that #{message}\n" + + " Possible causes:\n" + + " 1. Your test + source dereferenced a null pointer.\n" + + " 2. Your test + source indexed past the end of a buffer.\n" + + " 3. Your test + source committed a memory access violation.\n" + + " 4. Your test fixture produced an exit code of 0 despite execution ending prematurely.\n" + + " Sanity check failures of test results are usually a symptom of interrupted test execution.\n\n" + + @streaminator.stderr_puts( notice ) + raise + end + +end diff --git a/flex-bison/mark1/tools/ceedling/lib/generator_test_runner.rb b/flex-bison/mark1/tools/ceedling/lib/generator_test_runner.rb new file mode 100644 index 0000000..361be61 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/generator_test_runner.rb @@ -0,0 +1,206 @@ + +class GeneratorTestRunner + + constructor :configurator, :file_path_utils, :file_wrapper + + + def find_test_cases(test_file) + tests = [] + tests_and_line_numbers = [] + lines = [] + + # if we don't have preprocessor assistance, do some basic preprocessing of our own + if (not @configurator.project_use_test_preprocessor) + source = @file_wrapper.read(test_file) + + # remove line comments + source = source.gsub(/\/\/.*$/, '') + # remove block comments + source = source.gsub(/\/\*.*?\*\//m, '') + + # treat preprocessor directives as a logical line + lines = source.split(/(^\s*\#.*$) | (;|\{|\}) /x) # match ;, {, and } as end of lines + # otherwise, read the preprocessed file raw + else + lines = @file_wrapper.read( @file_path_utils.form_preprocessed_file_filepath(test_file) ).split(/;|\{|\}/) + end + + # step 1. find test functions in (possibly preprocessed) file + # (note that lines are not broken up at end of lines) + lines.each do |line| + if (line =~ /^\s*void\s+((T|t)est.*)\s*\(\s*(void)?\s*\)/m) + tests << ($1.strip) + end + end + + # step 2. associate test functions with line numbers in (non-preprocessed) original file + # (note that this time we must scan file contents broken up by end of lines) + raw_lines = @file_wrapper.read(test_file).split("\n") + raw_index = 0 + + tests.each do |test| + raw_lines[raw_index..-1].each_with_index do |line, index| + # test function might be declared across lines; look for it by its name followed + # by a few tell-tale signs + if (line =~ /#{test}\s*($|\(|\()/) + raw_index += (index + 1) + tests_and_line_numbers << {:test => test, :line_number => raw_index} + break + end + end + end + + return tests_and_line_numbers + end + + + def create_header(output, mock_list) + output << "/* AUTOGENERATED FILE. DO NOT EDIT. */\n" + output << "#include \"unity.h\"\n" + + @configurator.test_runner_includes.each do |include| + output << "#include \"#{include}\"\n" + end + + output << "#include \n" + output << "#include \n" + + if (@configurator.project_use_exceptions == true) + output << "#include \"CException.h\"\n" + end + + unless (mock_list.empty?) + header_extension = @configurator.extension_header + mock_list.each do |mock| + output << "#include \"#{mock}#{header_extension}\"\n" + end + if (@configurator.cmock_enforce_strict_ordering == true) + output << "\n" + output << "int GlobalExpectCount;\n" + output << "int GlobalVerifyOrder;\n" + output << "char* GlobalOrderError;\n" + end + end + + output << "\n" + output << "char MessageBuffer[50];\n" + end + + + def create_externs(output, test_cases) + output << "\n" + output << "extern void setUp(void);\n" + output << "extern void tearDown(void);\n" + output << "\n" if not test_cases.empty? + + test_cases.each do |item| + output << "extern void #{item[:test]}(void);\n" + end + end + + + def create_mock_management(output, mock_list) + + unless (mock_list.empty?) + header_extension = @configurator.extension_header + + output << "\n" + output << "static void CMock_Init(void)\n" + output << "{\n" + + if (@configurator.cmock_enforce_strict_ordering == true) + output << " GlobalExpectCount = 0;\n" + output << " GlobalVerifyOrder = 0;\n" + output << " GlobalOrderError = NULL;\n" + end + + mock_list.each do |mock| + output << " #{mock.sub(/#{'\\'+header_extension}/, '')}_Init();\n" + end + output << "}\n" + output << "\n" + + output << "static void CMock_Verify(void)\n" + output << "{\n" + mock_list.each do |mock| + output << " #{mock.sub(/#{'\\'+header_extension}/, '')}_Verify();\n" + end + output << "}\n" + output << "\n" + + output << "static void CMock_Destroy(void)\n" + output << "{\n" + mock_list.each do |mock| + output << " #{mock.sub(/#{'\\'+header_extension}/, '')}_Destroy();\n" + end + output << "}\n" + output << "\n" + + output << "void CMock_VerifyAndReset(void)\n" + output << "{\n" + output << " CMock_Verify();\n" + output << " CMock_Destroy();\n" + output << " CMock_Init();\n" + output << "}\n" + output << "\n" + end + + end + + + def create_runtest(output, mock_list, test_cases) + + unless(test_cases.empty?) + use_exceptions = @configurator.project_use_exceptions + + tab = ' ' # default spacing + tab = ' ' if (use_exceptions) + + output << "\n" + output << "static void TestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum)\n" + output << "{\n" + output << " Unity.CurrentTestName = FuncName;\n" + output << " Unity.CurrentTestLineNumber = FuncLineNum;\n" + output << " Unity.NumberOfTests++;\n" + output << " if (TEST_PROTECT())\n" + output << " {\n" + output << " CEXCEPTION_T e;\n" if use_exceptions + output << " Try {\n" if use_exceptions + output << "#{tab}CMock_Init();\n" unless (mock_list.empty?) + output << "#{tab}setUp();\n" + output << "#{tab}Func();\n" + output << "#{tab}CMock_Verify();\n" unless (mock_list.empty?) + output << " } Catch(e) { TEST_FAIL_MESSAGE(\"Unhandled Exception!\"); }\n" if use_exceptions + output << " }\n" + output << " CMock_Destroy();\n" unless (mock_list.empty?) + output << " if (TEST_PROTECT() && !(Unity.CurrentTestIgnored))\n" + output << " {\n" + output << " tearDown();\n" + output << " }\n" + output << " UnityConcludeTest();\n" + output << "}\n" + end + + end + + + def create_main(output, module_name, test_cases) + output << "\n" + output << "int main(void)\n" + output << "{\n" + output << " UnityBegin();\n" + output << " Unity.TestFile = \"#{module_name}\";\n" + output << "\n" + + output << " // RUN_TEST calls runTest\n" unless (test_cases.empty?) + test_cases.each do |item| + output << " RUN_TEST(#{item[:test]}, #{item[:line_number]});\n" + end + + output << "\n" + output << " return UnityEnd();\n" + output << "}\n" + output << "\n" + end + +end diff --git a/flex-bison/mark1/tools/ceedling/lib/loginator.rb b/flex-bison/mark1/tools/ceedling/lib/loginator.rb new file mode 100644 index 0000000..92276e1 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/loginator.rb @@ -0,0 +1,31 @@ + +class Loginator + + constructor :configurator, :project_file_loader, :project_config_manager, :file_wrapper, :system_wrapper + + + def setup_log_filepath + config_files = [] + config_files << @project_file_loader.main_file + config_files << @project_file_loader.user_file + config_files.concat( @project_config_manager.options_files ) + config_files.compact! + config_files.map! { |file| file.ext('') } + + log_name = config_files.join( '_' ) + + @project_log_filepath = File.join( @configurator.project_log_path, log_name.ext('.log') ) + end + + + def log(string, heading=nil) + return if (not @configurator.project_logging) + + output = "\n[#{@system_wrapper.time_now}]" + output += " :: #{heading}" if (not heading.nil?) + output += "\n#{string.strip}\n" + + @file_wrapper.write(@project_log_filepath, output, 'a') + end + +end diff --git a/flex-bison/mark1/tools/ceedling/lib/makefile.rb b/flex-bison/mark1/tools/ceedling/lib/makefile.rb new file mode 100644 index 0000000..a1ff9bd --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/makefile.rb @@ -0,0 +1,44 @@ + +# modified version of Rake's provided make-style dependency loader +# customizations: (1) handles windows drives in paths -- colons don't confuse task demarcation (2) handles spaces in directory paths + +module Rake + + # Makefile loader to be used with the import file loader. + class MakefileLoader + + # Load the makefile dependencies in +fn+. + def load(fn) + open(fn) do |mf| + lines = mf.read + lines.gsub!(/#[^\n]*\n/m, "") # remove comments + lines.gsub!(/\\\n/, ' ') # string together line continuations into single line + lines.split("\n").each do |line| + process_line(line) + end + end + end + + private + + # Process one logical line of makefile data. + def process_line(line) + # split on presence of task demaractor followed by space (i.e don't get confused by a colon in a win path) + file_tasks, args = line.split(/:\s/) + + return if args.nil? + + # split at non-escaped space boundary between files (i.e. escaped spaces in paths are left alone) + dependents = args.split(/\b\s+/) + # replace escaped spaces and clean up any extra whitespace + dependents.map! { |path| path.gsub(/\\ /, ' ').strip } + + file_tasks.strip.split.each do |file_task| + file file_task => dependents + end + end + end + + # Install the handler + Rake.application.add_loader('mf', MakefileLoader.new) +end diff --git a/flex-bison/mark1/tools/ceedling/lib/objects.yml b/flex-bison/mark1/tools/ceedling/lib/objects.yml new file mode 100644 index 0000000..95a6d9b --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/objects.yml @@ -0,0 +1,278 @@ + +file_wrapper: + +stream_wrapper: + +rake_wrapper: + +yaml_wrapper: + +system_wrapper: + +cmock_builder: + +reportinator: + +rake_utils: + compose: + - rake_wrapper + +file_path_utils: + compose: + - configurator + - file_wrapper + +file_system_utils: + compose: file_wrapper + +project_file_loader: + compose: + - yaml_wrapper + - stream_wrapper + - system_wrapper + - file_wrapper + +project_config_manager: + compose: + - cacheinator + - yaml_wrapper + +cacheinator: + compose: + - cacheinator_helper + - file_path_utils + - file_wrapper + - yaml_wrapper + +cacheinator_helper: + compose: + - file_wrapper + - yaml_wrapper + +tool_executor: + compose: + - configurator + - tool_executor_helper + - streaminator + - system_wrapper + +tool_executor_helper: + compose: + - streaminator + - system_wrapper + +configurator: + compose: + - configurator_setup + - configurator_plugins + - configurator_builder + - cmock_builder + - yaml_wrapper + - system_wrapper + +configurator_setup: + compose: + - configurator_builder + - configurator_validator + +configurator_plugins: + compose: + - stream_wrapper + - file_wrapper + - system_wrapper + +configurator_validator: + compose: + - file_wrapper + - stream_wrapper + - system_wrapper + +configurator_builder: + compose: + - file_system_utils + - file_wrapper + - system_wrapper + +loginator: + compose: + - configurator + - project_file_loader + - project_config_manager + - file_wrapper + - system_wrapper + +streaminator: + compose: + - streaminator_helper + - verbosinator + - loginator + - stream_wrapper + +streaminator_helper: + +setupinator: + +plugin_manager: + compose: + - configurator + - plugin_manager_helper + - streaminator + - reportinator + - system_wrapper + +plugin_manager_helper: + +plugin_reportinator: + compose: + - plugin_reportinator_helper + - plugin_manager + - reportinator + +plugin_reportinator_helper: + compose: + - configurator + - streaminator + - yaml_wrapper + - file_wrapper + +verbosinator: + compose: configurator + +file_finder: + compose: + - configurator + - file_finder_helper + - cacheinator + - file_path_utils + - file_wrapper + - yaml_wrapper + +file_finder_helper: + compose: streaminator + +test_includes_extractor: + compose: + - configurator + - yaml_wrapper + - file_wrapper + +task_invoker: + compose: + - dependinator + - rake_utils + - rake_wrapper + +generator: + compose: + - configurator + - preprocessinator + - cmock_builder + - generator_test_runner + - generator_test_results + - test_includes_extractor + - tool_executor + - file_finder + - file_path_utils + - streaminator + - plugin_manager + - file_wrapper + +generator_test_results: + compose: + - configurator + - generator_test_results_sanity_checker + - yaml_wrapper + +generator_test_results_sanity_checker: + compose: + - configurator + - streaminator + +generator_test_runner: + compose: + - configurator + - file_path_utils + - file_wrapper + +dependinator: + compose: + - configurator + - project_config_manager + - test_includes_extractor + - file_path_utils + - rake_wrapper + - file_wrapper + +preprocessinator: + compose: + - preprocessinator_helper + - preprocessinator_includes_handler + - preprocessinator_file_handler + - task_invoker + - file_path_utils + - yaml_wrapper + +preprocessinator_helper: + compose: + - configurator + - test_includes_extractor + - task_invoker + - file_finder + - file_path_utils + +preprocessinator_includes_handler: + compose: + - configurator + - tool_executor + - task_invoker + - file_path_utils + - yaml_wrapper + - file_wrapper + +preprocessinator_file_handler: + compose: + - preprocessinator_extractor + - configurator + - tool_executor + - file_path_utils + - file_wrapper + +preprocessinator_extractor: + compose: + - file_wrapper + +test_invoker: + compose: + - configurator + - test_invoker_helper + - streaminator + - preprocessinator + - task_invoker + - dependinator + - project_config_manager + - file_path_utils + +test_invoker_helper: + compose: + - configurator + - task_invoker + - dependinator + - test_includes_extractor + - file_finder + - file_path_utils + - streaminator + - file_wrapper + +release_invoker: + compose: + - release_invoker_helper + - configurator + - dependinator + - task_invoker + - file_path_utils + +release_invoker_helper: + compose: + - configurator + - dependinator + - task_invoker diff --git a/flex-bison/mark1/tools/ceedling/lib/plugin.rb b/flex-bison/mark1/tools/ceedling/lib/plugin.rb new file mode 100644 index 0000000..a412555 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/plugin.rb @@ -0,0 +1,63 @@ + +class String + def left_margin(margin=0) + non_whitespace_column = 0 + new_lines = [] + + # find first line with non-whitespace and count left columns of whitespace + self.each_line do |line| + if (line =~ /^\s*\S/) + non_whitespace_column = $&.length - 1 + break + end + end + + # iterate through each line, chopping off leftmost whitespace columns and add back the desired whitespace margin + self.each_line do |line| + columns = [] + margin.times{columns << ' '} + # handle special case of line being narrower than width to be lopped off + if (non_whitespace_column < line.length) + new_lines << "#{columns.join}#{line[non_whitespace_column..-1]}" + else + new_lines << "\n" + end + end + + return new_lines.join + end +end + +class Plugin + attr_reader :name + + def initialize(system_objects, name) + @ceedling = system_objects + @name = name + self.setup + end + + def setup; end + + def pre_build; end + + def pre_mock_execute(arg_hash); end + def post_mock_execute(arg_hash); end + + def pre_runner_execute(arg_hash); end + def post_runner_execute(arg_hash); end + + def pre_compile_execute(arg_hash); end + def post_compile_execute(arg_hash); end + + def pre_link_execute(arg_hash); end + def post_link_execute(arg_hash); end + + def pre_test_execute(arg_hash); end + def post_test_execute(arg_hash); end + + def post_build; end + + def summary; end + +end diff --git a/flex-bison/mark1/tools/ceedling/lib/plugin_manager.rb b/flex-bison/mark1/tools/ceedling/lib/plugin_manager.rb new file mode 100644 index 0000000..0ec22ec --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/plugin_manager.rb @@ -0,0 +1,85 @@ +require 'constants' +require 'set' + +class PluginManager + + constructor :configurator, :plugin_manager_helper, :streaminator, :reportinator, :system_wrapper + + def setup + @build_fail_registry = [] + @plugin_objects = [] # so we can preserve order + end + + def load_plugin_scripts(script_plugins, system_objects) + script_plugins.each do |plugin| + # protect against instantiating object multiple times due to processing config multiple times (options, etc) + next if (@plugin_manager_helper.include?(@plugin_objects, plugin)) + @system_wrapper.require_file( "#{plugin}.rb" ) + object = @plugin_manager_helper.instantiate_plugin_script( camelize(plugin), system_objects, plugin ) + @plugin_objects << object + + # add plugins to hash of all system objects + system_objects[plugin.downcase.to_sym] = object + end + end + + def plugins_failed? + return (@build_fail_registry.size > 0) + end + + def print_plugin_failures + if (@build_fail_registry.size > 0) + report = @reportinator.generate_banner('BUILD FAILURE SUMMARY') + + @build_fail_registry.each do |failure| + report += "#{' - ' if (@build_fail_registry.size > 1)}#{failure}\n" + end + + report += "\n" + + @streaminator.stderr_puts(report, Verbosity::ERRORS) + end + end + + def register_build_failure(message) + @build_fail_registry << message if (message and not message.empty?) + end + + #### execute all plugin methods #### + + def pre_build; execute_plugins(:pre_build); end + + def pre_mock_execute(arg_hash); execute_plugins(:pre_mock_execute, arg_hash); end + def post_mock_execute(arg_hash); execute_plugins(:post_mock_execute, arg_hash); end + + def pre_runner_execute(arg_hash); execute_plugins(:pre_runner_execute, arg_hash); end + def post_runner_execute(arg_hash); execute_plugins(:post_runner_execute, arg_hash); end + + def pre_compile_execute(arg_hash); execute_plugins(:pre_compile_execute, arg_hash); end + def post_compile_execute(arg_hash); execute_plugins(:post_compile_execute, arg_hash); end + + def pre_link_execute(arg_hash); execute_plugins(:pre_link_execute, arg_hash); end + def post_link_execute(arg_hash); execute_plugins(:post_link_execute, arg_hash); end + + def pre_test_execute(arg_hash); execute_plugins(:pre_test_execute, arg_hash); end + def post_test_execute(arg_hash) + # special arbitration: raw test results are printed or taken over by plugins handling the job + @streaminator.stdout_puts(arg_hash[:shell_result][:output]) if (@configurator.plugins_display_raw_test_results) + execute_plugins(:post_test_execute, arg_hash) + end + + def post_build; execute_plugins(:post_build); end + + def summary; execute_plugins(:summary); end + + private #################################### + + def camelize(underscored_name) + return underscored_name.gsub(/(_|^)([a-z0-9])/) {$2.upcase} + end + + def execute_plugins(method, *args) + @plugin_objects.each {|plugin| plugin.send(method, *args) } + end + +end diff --git a/flex-bison/mark1/tools/ceedling/lib/plugin_manager_helper.rb b/flex-bison/mark1/tools/ceedling/lib/plugin_manager_helper.rb new file mode 100644 index 0000000..b18248a --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/plugin_manager_helper.rb @@ -0,0 +1,19 @@ + +class PluginManagerHelper + + def include?(plugins, name) + include = false + plugins.each do |plugin| + if (plugin.name == name) + include = true + break + end + end + return include + end + + def instantiate_plugin_script(plugin, system_objects, name) + return eval("#{plugin}.new(system_objects, name)") + end + +end diff --git a/flex-bison/mark1/tools/ceedling/lib/plugin_reportinator.rb b/flex-bison/mark1/tools/ceedling/lib/plugin_reportinator.rb new file mode 100644 index 0000000..b08801a --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/plugin_reportinator.rb @@ -0,0 +1,75 @@ +require 'constants' +require 'defaults' + +class PluginReportinator + + constructor :plugin_reportinator_helper, :plugin_manager, :reportinator + + def setup + @test_results_template = nil + end + + + def set_system_objects(system_objects) + @plugin_reportinator_helper.ceedling = system_objects + end + + + def fetch_results(results_path, test, options={:boom => false}) + return @plugin_reportinator_helper.fetch_results( File.join(results_path, test), options ) + end + + + def generate_banner(message) + return @reportinator.generate_banner(message) + end + + + def assemble_test_results(results_list, options={:boom => false}) + aggregated_results = get_results_structure + + results_list.each do |result_path| + results = @plugin_reportinator_helper.fetch_results( result_path, options ) + @plugin_reportinator_helper.process_results(aggregated_results, results) + end + + return aggregated_results + end + + + def register_test_results_template(template) + @test_results_template = template if (@test_results_template.nil?) + end + + + def run_test_results_report(hash, verbosity=Verbosity::NORMAL, &block) + run_report( $stdout, + ((@test_results_template.nil?) ? DEFAULT_TESTS_RESULTS_REPORT_TEMPLATE : @test_results_template), + hash, + verbosity, + &block ) + end + + + def run_report(stream, template, hash=nil, verbosity=Verbosity::NORMAL) + failure = nil + failure = yield() if block_given? + + @plugin_manager.register_build_failure( failure ) + + @plugin_reportinator_helper.run_report( stream, template, hash, verbosity ) + end + + private ############################### + + def get_results_structure + return { + :successes => [], + :failures => [], + :ignores => [], + :stdout => [], + :counts => {:total => 0, :passed => 0, :failed => 0, :ignored => 0, :stdout => 0} + } + end + +end \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/lib/plugin_reportinator_helper.rb b/flex-bison/mark1/tools/ceedling/lib/plugin_reportinator_helper.rb new file mode 100644 index 0000000..c30a833 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/plugin_reportinator_helper.rb @@ -0,0 +1,52 @@ +require 'constants' +require 'erb' +require 'rubygems' +require 'rake' # for ext() + + +class PluginReportinatorHelper + + attr_writer :ceedling + + constructor :configurator, :streaminator, :yaml_wrapper, :file_wrapper + + def fetch_results(results_path, options) + pass_path = File.join(results_path.ext( @configurator.extension_testpass )) + fail_path = File.join(results_path.ext( @configurator.extension_testfail )) + + if (@file_wrapper.exist?(fail_path)) + return @yaml_wrapper.load(fail_path) + elsif (@file_wrapper.exist?(pass_path)) + return @yaml_wrapper.load(pass_path) + else + if (options[:boom]) + @streaminator.stderr_puts("Could find no test results for '#{File.basename(results_path).ext(@configurator.extension_source)}'", Verbosity::ERRORS) + raise + end + end + + return {} + end + + + def process_results(aggregate_results, results) + return if (results.empty?) + + aggregate_results[:successes] << { :source => results[:source].clone, :collection => results[:successes].clone } if (results[:successes].size > 0) + aggregate_results[:failures] << { :source => results[:source].clone, :collection => results[:failures].clone } if (results[:failures].size > 0) + aggregate_results[:ignores] << { :source => results[:source].clone, :collection => results[:ignores].clone } if (results[:ignores].size > 0) + aggregate_results[:stdout] << { :source => results[:source].clone, :collection => results[:stdout].clone } if (results[:stdout].size > 0) + aggregate_results[:counts][:total] += results[:counts][:total] + aggregate_results[:counts][:passed] += results[:counts][:passed] + aggregate_results[:counts][:failed] += results[:counts][:failed] + aggregate_results[:counts][:ignored] += results[:counts][:ignored] + aggregate_results[:counts][:stdout] += results[:stdout].size + end + + + def run_report(stream, template, hash, verbosity) + output = ERB.new(template, 0, "%<>") + @streaminator.stream_puts(stream, output.result(binding()), verbosity) + end + +end \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/lib/preprocessinator.rb b/flex-bison/mark1/tools/ceedling/lib/preprocessinator.rb new file mode 100644 index 0000000..e5c46c3 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/preprocessinator.rb @@ -0,0 +1,43 @@ + +class Preprocessinator + + attr_reader :preprocess_file_proc + + constructor :preprocessinator_helper, :preprocessinator_includes_handler, :preprocessinator_file_handler, :task_invoker, :file_path_utils, :yaml_wrapper + + + def setup + # fashion ourselves callbacks @preprocessinator_helper can use + @preprocess_includes_proc = Proc.new { |filepath| self.preprocess_shallow_includes(filepath) } + @preprocess_file_proc = Proc.new { |filepath| self.preprocess_file(filepath) } + end + + + def preprocess_test_and_invoke_test_mocks(test) + @preprocessinator_helper.preprocess_includes(test, @preprocess_includes_proc) + + mocks_list = @preprocessinator_helper.assemble_mocks_list(test) + + @preprocessinator_helper.preprocess_mockable_headers(mocks_list, @preprocess_file_proc) + + @task_invoker.invoke_test_mocks(mocks_list) + + @preprocessinator_helper.preprocess_test_file(test, @preprocess_file_proc) + + return mocks_list + end + + def preprocess_shallow_includes(filepath) + dependencies_rule = @preprocessinator_includes_handler.form_shallow_dependencies_rule(filepath) + includes = @preprocessinator_includes_handler.extract_shallow_includes(dependencies_rule) + + @preprocessinator_includes_handler.write_shallow_includes_list( + @file_path_utils.form_preprocessed_includes_list_filepath(filepath), includes) + end + + def preprocess_file(filepath) + @preprocessinator_includes_handler.invoke_shallow_includes_list(filepath) + @preprocessinator_file_handler.preprocess_file( filepath, @yaml_wrapper.load(@file_path_utils.form_preprocessed_includes_list_filepath(filepath)) ) + end + +end diff --git a/flex-bison/mark1/tools/ceedling/lib/preprocessinator_extractor.rb b/flex-bison/mark1/tools/ceedling/lib/preprocessinator_extractor.rb new file mode 100644 index 0000000..947d5af --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/preprocessinator_extractor.rb @@ -0,0 +1,27 @@ + + +class PreprocessinatorExtractor + + constructor :file_wrapper + + # extract from cpp-processed file only content of file we care about + def extract_base_file_from_preprocessed_expansion(filepath) + contents = [] + extract = false + + @file_wrapper.readlines(filepath).each do |line| + if (extract) + if (line =~ /^#/) + extract = false + else + contents << line + end + end + # extract = true if (line =~ /^#.*#{Regexp.escape(File.basename(filepath))}/) + extract = true if (line =~ /^#.*(\s|\/|\\|\")#{Regexp.escape(File.basename(filepath))}/) + end + + return contents + end + +end diff --git a/flex-bison/mark1/tools/ceedling/lib/preprocessinator_file_handler.rb b/flex-bison/mark1/tools/ceedling/lib/preprocessinator_file_handler.rb new file mode 100644 index 0000000..cc84e7f --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/preprocessinator_file_handler.rb @@ -0,0 +1,21 @@ + + +class PreprocessinatorFileHandler + + constructor :preprocessinator_extractor, :configurator, :tool_executor, :file_path_utils, :file_wrapper + + + def preprocess_file(filepath, includes) + preprocessed_filepath = @file_path_utils.form_preprocessed_file_filepath(filepath) + + command_line = @tool_executor.build_command_line(@configurator.tools_test_file_preprocessor, filepath, preprocessed_filepath) + @tool_executor.exec(command_line) + + contents = @preprocessinator_extractor.extract_base_file_from_preprocessed_expansion(preprocessed_filepath) + + includes.each{|include| contents.unshift("#include \"#{include}\"")} + + @file_wrapper.write(preprocessed_filepath, contents.join("\n")) + end + +end diff --git a/flex-bison/mark1/tools/ceedling/lib/preprocessinator_helper.rb b/flex-bison/mark1/tools/ceedling/lib/preprocessinator_helper.rb new file mode 100644 index 0000000..6175637 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/preprocessinator_helper.rb @@ -0,0 +1,46 @@ + + +class PreprocessinatorHelper + + constructor :configurator, :test_includes_extractor, :task_invoker, :file_finder, :file_path_utils + + + def preprocess_includes(test, preprocess_includes_proc) + if (@configurator.project_use_test_preprocessor) + preprocessed_includes_list = @file_path_utils.form_preprocessed_includes_list_filepath(test) + preprocess_includes_proc.call( @file_finder.find_test_from_file_path(preprocessed_includes_list) ) + @test_includes_extractor.parse_includes_list(preprocessed_includes_list) + else + @test_includes_extractor.parse_test_file(test) + end + end + + def assemble_mocks_list(test) + return @file_path_utils.form_mocks_source_filelist( @test_includes_extractor.lookup_raw_mock_list(test) ) + end + + def preprocess_mockable_headers(mock_list, preprocess_file_proc) + if (@configurator.project_use_test_preprocessor) + preprocess_files_smartly( + @file_path_utils.form_preprocessed_mockable_headers_filelist(mock_list), + preprocess_file_proc ) { |file| @file_finder.find_header_file(file) } + end + end + + def preprocess_test_file(test, preprocess_file_proc) + return if (!@configurator.project_use_test_preprocessor) + + preprocess_file_proc.call(test) + end + + private ############################ + + def preprocess_files_smartly(file_list, preprocess_file_proc) + if (@configurator.project_use_auxiliary_dependencies) + @task_invoker.invoke_test_preprocessed_files(file_list) + else + file_list.each { |file| preprocess_file_proc.call( yield(file) ) } + end + end + +end diff --git a/flex-bison/mark1/tools/ceedling/lib/preprocessinator_includes_handler.rb b/flex-bison/mark1/tools/ceedling/lib/preprocessinator_includes_handler.rb new file mode 100644 index 0000000..3cca916 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/preprocessinator_includes_handler.rb @@ -0,0 +1,55 @@ + + +class PreprocessinatorIncludesHandler + + constructor :configurator, :tool_executor, :task_invoker, :file_path_utils, :yaml_wrapper, :file_wrapper + + # shallow includes: only those headers a source file explicitly includes + + def invoke_shallow_includes_list(filepath) + @task_invoker.invoke_test_shallow_include_lists( [@file_path_utils.form_preprocessed_includes_list_filepath(filepath)] ) + end + + # ask the preprocessor for a make-style dependency rule of only the headers the source file immediately includes + def form_shallow_dependencies_rule(filepath) + # change filename (prefix of '_') to prevent preprocessor from finding include files in temp directory containing file it's scanning + temp_filepath = @file_path_utils.form_temp_path(filepath, '_') + + # read the file and replace all include statements with a decorated version + # (decorating the names creates file names that don't exist, thus preventing the preprocessor + # from snaking out and discovering the entire include path that winds through the code) + contents = @file_wrapper.read(filepath) + contents.gsub!( /#include\s+\"\s*(\S+)\s*\"/, "#include \"\\1\"\n#include \"@@@@\\1\"" ) + @file_wrapper.write( temp_filepath, contents ) + + # extract the make-style dependency rule telling the preprocessor to + # ignore the fact that it can't find the included files + command_line = @tool_executor.build_command_line(@configurator.tools_test_includes_preprocessor, temp_filepath) + shell_result = @tool_executor.exec(command_line) + + return shell_result[:output] + end + + # headers only; ignore any crazy .c includes + def extract_shallow_includes(make_rule) + list = [] + header_extension = @configurator.extension_header + + headers = make_rule.scan(/(\S+#{'\\'+header_extension})/).flatten # escape slashes before dot file extension + headers.uniq! + headers.map! { |header| header.sub(/(@@@@)|(.+\/)/, '') } + headers.sort! + + headers.each_with_index do |header, index| + break if (headers.size == (index-1)) + list << header if (header == headers[index + 1]) + end + + return list + end + + def write_shallow_includes_list(filepath, list) + @yaml_wrapper.dump(filepath, list) + end + +end diff --git a/flex-bison/mark1/tools/ceedling/lib/project_config_manager.rb b/flex-bison/mark1/tools/ceedling/lib/project_config_manager.rb new file mode 100644 index 0000000..3599689 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/project_config_manager.rb @@ -0,0 +1,38 @@ +require 'constants' + + +class ProjectConfigManager + + attr_reader :options_files, :release_config_changed, :test_config_changed + attr_accessor :config_hash + + constructor :cacheinator, :yaml_wrapper + + + def setup + @options_files = [] + @release_config_changed = false + @test_config_changed = false + end + + + def merge_options(config_hash, option_filepath) + @options_files << File.basename( option_filepath ) + config_hash.deep_merge( @yaml_wrapper.load( option_filepath ) ) + return config_hash + end + + + + def process_release_config_change + # has project configuration changed since last release build + @release_config_changed = @cacheinator.diff_cached_release_config?( @config_hash ) + end + + + def process_test_config_change + # has project configuration changed since last test build + @test_config_changed = @cacheinator.diff_cached_test_config?( @config_hash ) + end + +end diff --git a/flex-bison/mark1/tools/ceedling/lib/project_file_loader.rb b/flex-bison/mark1/tools/ceedling/lib/project_file_loader.rb new file mode 100644 index 0000000..182d23a --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/project_file_loader.rb @@ -0,0 +1,64 @@ +require 'constants' + + +class ProjectFileLoader + + attr_reader :main_file, :user_file + + constructor :yaml_wrapper, :stream_wrapper, :system_wrapper, :file_wrapper + + def setup + @main_file = nil + @user_file = nil + + @main_project_filepath = '' + @user_project_filepath = '' + end + + + def find_project_files + # first go hunting for optional user project file by looking for environment variable and then default location on disk + user_filepath = @system_wrapper.env_get('CEEDLING_USER_PROJECT_FILE') + + if ( not user_filepath.nil? and @file_wrapper.exist?(user_filepath) ) + @user_project_filepath = user_filepath + elsif (@file_wrapper.exist?(DEFAULT_CEEDLING_USER_PROJECT_FILE)) + @user_project_filepath = DEFAULT_CEEDLING_USER_PROJECT_FILE + end + + # next check for main project file by looking for environment variable and then default location on disk; + # blow up if we don't find this guy -- like, he's so totally important + main_filepath = @system_wrapper.env_get('CEEDLING_MAIN_PROJECT_FILE') + + if ( not main_filepath.nil? and @file_wrapper.exist?(main_filepath) ) + @main_project_filepath = main_filepath + elsif (@file_wrapper.exist?(DEFAULT_CEEDLING_MAIN_PROJECT_FILE)) + @main_project_filepath = DEFAULT_CEEDLING_MAIN_PROJECT_FILE + else + # no verbosity checking since this is lowest level reporting anyhow & + # verbosity checking depends on configurator which in turns needs this class (circular dependency) + @stream_wrapper.stderr_puts('Found no Ceedling project file (*.yml)') + raise + end + + @main_file = File.basename( @main_project_filepath ) + @user_file = File.basename( @user_project_filepath ) if ( not @user_project_filepath.empty? ) + end + + + def load_project_config + config_hash = {} + + # if there's no user project file, then just provide hash from project file + if (@user_project_filepath.empty?) + config_hash = @yaml_wrapper.load(@main_project_filepath) + # if there is a user project file, load it too and merge it on top of the project file, + # superseding anything that's common between them + else + config_hash = (@yaml_wrapper.load(@main_project_filepath)).merge(@yaml_wrapper.load(@user_project_filepath)) + end + + return config_hash + end + +end diff --git a/flex-bison/mark1/tools/ceedling/lib/rake_utils.rb b/flex-bison/mark1/tools/ceedling/lib/rake_utils.rb new file mode 100644 index 0000000..3f667c8 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/rake_utils.rb @@ -0,0 +1,17 @@ + +class RakeUtils + + constructor :rake_wrapper + + def task_invoked?(task_regex) + task_invoked = false + @rake_wrapper.task_list.each do |task| + if ((task.already_invoked) and (task.to_s =~ task_regex)) + task_invoked = true + break + end + end + return task_invoked + end + +end diff --git a/flex-bison/mark1/tools/ceedling/lib/rake_wrapper.rb b/flex-bison/mark1/tools/ceedling/lib/rake_wrapper.rb new file mode 100644 index 0000000..d4d9e25 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/rake_wrapper.rb @@ -0,0 +1,31 @@ +require 'rubygems' +require 'rake' +require 'makefile' # our replacement for rake's make-style dependency loader + +class Rake::Task + attr_reader :already_invoked +end + +class RakeWrapper + + def initialize + @makefile_loader = Rake::MakefileLoader.new # use our custom replacement noted above + end + + def [](task) + return Rake::Task[task] + end + + def task_list + return Rake::Task.tasks + end + + def create_file_task(file_task, dependencies) + file(file_task => dependencies) + end + + def load_dependencies(dependencies_path) + @makefile_loader.load(dependencies_path) + end + +end diff --git a/flex-bison/mark1/tools/ceedling/lib/rakefile.rb b/flex-bison/mark1/tools/ceedling/lib/rakefile.rb new file mode 100644 index 0000000..0c22e33 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/rakefile.rb @@ -0,0 +1,60 @@ +require 'fileutils' + +# get directory containing this here file, back up one directory, and expand to full path +CEEDLING_ROOT = File.expand_path(File.dirname(__FILE__) + '/..') +CEEDLING_LIB = File.join(CEEDLING_ROOT, 'lib') +CEEDLING_VENDOR = File.join(CEEDLING_ROOT, 'vendor') +CEEDLING_RELEASE = File.join(CEEDLING_ROOT, 'release') + +$LOAD_PATH.unshift( CEEDLING_LIB ) +$LOAD_PATH.unshift( File.join(CEEDLING_VENDOR, 'diy/lib') ) +$LOAD_PATH.unshift( File.join(CEEDLING_VENDOR, 'constructor/lib') ) +$LOAD_PATH.unshift( File.join(CEEDLING_VENDOR, 'cmock/lib') ) +$LOAD_PATH.unshift( File.join(CEEDLING_VENDOR, 'deep_merge/lib') ) + +require 'rake' + +require 'diy' +require 'constructor' + +require 'constants' + + +# construct all our objects +@ceedling = DIY::Context.from_yaml( File.read( File.join(CEEDLING_LIB, 'objects.yml') ) ) +@ceedling.build_everything + +# one-stop shopping for all our setup and such after construction +@ceedling[:setupinator].ceedling = @ceedling +@ceedling[:setupinator].do_setup( @ceedling[:setupinator].load_project_files ) + +# tell all our plugins we're about to do something +@ceedling[:plugin_manager].pre_build + +# load rakefile component files (*.rake) +PROJECT_RAKEFILE_COMPONENT_FILES.each { |component| load(component) } + +# tell rake to shut up by default (overridden in verbosity / debug tasks as appropriate) +verbose(false) + + +# end block always executed following rake run +END { + # cache our input configurations to use in comparison upon next execution + @ceedling[:cacheinator].cache_test_config( @ceedling[:setupinator].config_hash ) if (@ceedling[:task_invoker].test_invoked?) + @ceedling[:cacheinator].cache_release_config( @ceedling[:setupinator].config_hash ) if (@ceedling[:task_invoker].release_invoked?) + + # delete all temp files unless we're in debug mode + if (not @ceedling[:configurator].project_debug) + @ceedling[:file_wrapper].rm_f( @ceedling[:file_wrapper].directory_listing( File.join(@ceedling[:configurator].project_temp_path, '*') )) + end + + # only perform these final steps if we got here without runtime exceptions or errors + if (@ceedling[:system_wrapper].ruby_success) + + # tell all our plugins the build is done and process results + @ceedling[:plugin_manager].post_build + @ceedling[:plugin_manager].print_plugin_failures + exit(1) if (@ceedling[:plugin_manager].plugins_failed?) + end +} diff --git a/flex-bison/mark1/tools/ceedling/lib/release_invoker.rb b/flex-bison/mark1/tools/ceedling/lib/release_invoker.rb new file mode 100644 index 0000000..2df2e68 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/release_invoker.rb @@ -0,0 +1,29 @@ + + +class ReleaseInvoker + + constructor :configurator, :release_invoker_helper, :dependinator, :task_invoker, :file_path_utils + + + def setup_and_invoke_c_objects(c_files) + objects = ( @file_path_utils.form_release_build_c_objects_filelist( c_files ) ) + + @release_invoker_helper.process_auxiliary_dependencies( @file_path_utils.form_release_dependencies_filelist( c_files ) ) + + @dependinator.enhance_release_file_dependencies( objects ) + @task_invoker.invoke_release_objects( objects ) + + return objects + end + + + def setup_and_invoke_asm_objects(asm_files) + objects = @file_path_utils.form_release_build_asm_objects_filelist( asm_files ) + + @dependinator.enhance_release_file_dependencies( objects ) + @task_invoker.invoke_release_objects( objects ) + + return objects + end + +end diff --git a/flex-bison/mark1/tools/ceedling/lib/release_invoker_helper.rb b/flex-bison/mark1/tools/ceedling/lib/release_invoker_helper.rb new file mode 100644 index 0000000..2843f2e --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/release_invoker_helper.rb @@ -0,0 +1,16 @@ + + +class ReleaseInvokerHelper + + constructor :configurator, :dependinator, :task_invoker + + + def process_auxiliary_dependencies(dependencies_list) + return if (not @configurator.project_use_auxiliary_dependencies) + + @dependinator.enhance_release_file_dependencies( dependencies_list ) + @task_invoker.invoke_release_dependencies_files( dependencies_list ) + @dependinator.load_release_object_deep_dependencies( dependencies_list ) + end + +end diff --git a/flex-bison/mark1/tools/ceedling/lib/reportinator.rb b/flex-bison/mark1/tools/ceedling/lib/reportinator.rb new file mode 100644 index 0000000..a41e9a0 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/reportinator.rb @@ -0,0 +1,9 @@ + +class Reportinator + + def generate_banner(message, width=nil) + dash_count = ((width.nil?) ? message.strip.length : width) + return "#{'-' * dash_count}\n#{message}\n#{'-' * dash_count}\n" + end + +end diff --git a/flex-bison/mark1/tools/ceedling/lib/rules_cmock.rake b/flex-bison/mark1/tools/ceedling/lib/rules_cmock.rake new file mode 100644 index 0000000..ab29e85 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/rules_cmock.rake @@ -0,0 +1,9 @@ + + +rule(/#{CMOCK_MOCK_PREFIX}.+#{'\\'+EXTENSION_SOURCE}$/ => [ + proc do |task_name| + @ceedling[:file_finder].find_header_input_for_mock_file(task_name) + end + ]) do |mock| + @ceedling[:generator].generate_mock(TEST_CONTEXT, mock.source) +end diff --git a/flex-bison/mark1/tools/ceedling/lib/rules_preprocess.rake b/flex-bison/mark1/tools/ceedling/lib/rules_preprocess.rake new file mode 100644 index 0000000..fda14dc --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/rules_preprocess.rake @@ -0,0 +1,26 @@ + + +# invocations against this rule should only happen when enhanced dependencies are enabled; +# otherwise, dependency tracking will be too shallow and preprocessed files could intermittently +# fail to be updated when they actually need to be. +rule(/#{PROJECT_TEST_PREPROCESS_FILES_PATH}\/.+/ => [ + proc do |task_name| + @ceedling[:file_finder].find_test_or_source_or_header_file(task_name) + end + ]) do |file| + if (not @ceedling[:configurator].project_use_auxiliary_dependencies) + raise 'ERROR: Ceedling preprocessing rule invoked though neccessary auxiliary dependency support not enabled.' + end + @ceedling[:generator].generate_preprocessed_file(TEST_CONTEXT, file.source) +end + + +# invocations against this rule can always happen as there are no deeper dependencies to consider +rule(/#{PROJECT_TEST_PREPROCESS_INCLUDES_PATH}\/.+/ => [ + proc do |task_name| + @ceedling[:file_finder].find_test_or_source_or_header_file(task_name) + end + ]) do |file| + @ceedling[:generator].generate_shallow_includes_list(TEST_CONTEXT, file.source) +end + diff --git a/flex-bison/mark1/tools/ceedling/lib/rules_release.rake b/flex-bison/mark1/tools/ceedling/lib/rules_release.rake new file mode 100644 index 0000000..f8dc29a --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/rules_release.rake @@ -0,0 +1,24 @@ + +rule(/#{PROJECT_RELEASE_BUILD_OUTPUT_ASM_PATH}\/#{'.+\\'+EXTENSION_OBJECT}$/ => [ + proc do |task_name| + @ceedling[:file_finder].find_assembly_file(task_name) + end + ]) do |object| + @ceedling[:generator].generate_object_file(TOOLS_RELEASE_ASSEMBLER, object.source, object.name) +end + + +rule(/#{PROJECT_RELEASE_BUILD_OUTPUT_C_PATH}\/#{'.+\\'+EXTENSION_OBJECT}$/ => [ + proc do |task_name| + @ceedling[:file_finder].find_compilation_input_file(task_name) + end + ]) do |object| + @ceedling[:generator].generate_object_file(TOOLS_RELEASE_COMPILER, object.source, object.name) +end + + +rule(/#{PROJECT_RELEASE_BUILD_TARGET}/) do |bin_file| + @ceedling[:generator].generate_executable_file(TOOLS_RELEASE_LINKER, bin_file.prerequisites, bin_file.name) +end + + diff --git a/flex-bison/mark1/tools/ceedling/lib/rules_release_aux_dependencies.rake b/flex-bison/mark1/tools/ceedling/lib/rules_release_aux_dependencies.rake new file mode 100644 index 0000000..485973f --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/rules_release_aux_dependencies.rake @@ -0,0 +1,14 @@ + + +rule(/#{PROJECT_RELEASE_DEPENDENCIES_PATH}\/#{'.+\\'+EXTENSION_DEPENDENCIES}$/ => [ + proc do |task_name| + @ceedling[:file_finder].find_compilation_input_file(task_name) + end + ]) do |dep| + @ceedling[:generator].generate_dependencies_file( + TOOLS_RELEASE_DEPENDENCIES_GENERATOR, + dep.source, + @ceedling[:file_path_utils].form_release_build_c_object_filepath(dep.source), + dep.name) +end + diff --git a/flex-bison/mark1/tools/ceedling/lib/rules_tests.rake b/flex-bison/mark1/tools/ceedling/lib/rules_tests.rake new file mode 100644 index 0000000..a3902b7 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/rules_tests.rake @@ -0,0 +1,49 @@ + + +rule(/#{PROJECT_TEST_FILE_PREFIX}#{'.+'+TEST_RUNNER_FILE_SUFFIX}#{'\\'+EXTENSION_SOURCE}$/ => [ + proc do |task_name| + @ceedling[:file_finder].find_test_input_for_runner_file(task_name) + end + ]) do |runner| + @ceedling[:generator].generate_test_runner(TEST_CONTEXT, runner.source, runner.name) +end + + +rule(/#{PROJECT_TEST_BUILD_OUTPUT_PATH}\/#{'.+\\'+EXTENSION_OBJECT}$/ => [ + proc do |task_name| + @ceedling[:file_finder].find_compilation_input_file(task_name) + end + ]) do |object| + @ceedling[:generator].generate_object_file(TOOLS_TEST_COMPILER, TEST_CONTEXT, object.source, object.name) +end + + +rule(/#{PROJECT_TEST_BUILD_OUTPUT_PATH}\/#{'.+\\'+EXTENSION_EXECUTABLE}$/) do |bin_file| + @ceedling[:generator].generate_executable_file(TOOLS_TEST_LINKER, TEST_CONTEXT, bin_file.prerequisites, bin_file.name) +end + + +rule(/#{PROJECT_TEST_RESULTS_PATH}\/#{'.+\\'+EXTENSION_TESTPASS}$/ => [ + proc do |task_name| + @ceedling[:file_path_utils].form_test_executable_filepath(task_name) + end + ]) do |test_result| + @ceedling[:generator].generate_test_results(TOOLS_TEST_FIXTURE, TEST_CONTEXT, test_result.source, test_result.name) +end + + +namespace TEST_CONTEXT do + # use a rule to increase efficiency for large projects + # test tasks by regex + rule(/^#{TEST_TASK_ROOT}\S+$/ => [ + proc do |task_name| + test = task_name.sub(/#{TEST_TASK_ROOT}/, '') + test = "#{PROJECT_TEST_FILE_PREFIX}#{test}" if not (test.start_with?(PROJECT_TEST_FILE_PREFIX)) + @ceedling[:file_finder].find_test_from_file_path(test) + end + ]) do |test| + @ceedling[:rake_wrapper][:directories].invoke + @ceedling[:test_invoker].setup_and_invoke([test.source]) + end +end + diff --git a/flex-bison/mark1/tools/ceedling/lib/rules_tests_aux_dependencies.rake b/flex-bison/mark1/tools/ceedling/lib/rules_tests_aux_dependencies.rake new file mode 100644 index 0000000..db9a92b --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/rules_tests_aux_dependencies.rake @@ -0,0 +1,15 @@ + + +rule(/#{PROJECT_TEST_DEPENDENCIES_PATH}\/#{'.+\\'+EXTENSION_DEPENDENCIES}$/ => [ + proc do |task_name| + @ceedling[:file_finder].find_compilation_input_file(task_name) + end + ]) do |dep| + @ceedling[:generator].generate_dependencies_file( + TOOLS_TEST_DEPENDENCIES_GENERATOR, + TEST_CONTEXT, + dep.source, + @ceedling[:file_path_utils].form_test_build_object_filepath(dep.source), + dep.name) +end + diff --git a/flex-bison/mark1/tools/ceedling/lib/setupinator.rb b/flex-bison/mark1/tools/ceedling/lib/setupinator.rb new file mode 100644 index 0000000..ffe141d --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/setupinator.rb @@ -0,0 +1,45 @@ + +class Setupinator + + attr_reader :config_hash + attr_writer :ceedling + + def setup + @ceedling = {} + @config_hash = {} + end + + def load_project_files + @ceedling[:project_file_loader].find_project_files + return @ceedling[:project_file_loader].load_project_config + end + + def do_setup(config_hash) + @config_hash = config_hash + + # load up all the constants and accessors our rake files, objects, & external scripts will need; + # note: configurator modifies the cmock section of the hash with a couple defaults to tie + # project together - the modified hash is used to build cmock object + @ceedling[:configurator].populate_defaults( config_hash ) + @ceedling[:configurator].populate_unity_defines( config_hash ) + @ceedling[:configurator].populate_cmock_defaults( config_hash ) + @ceedling[:configurator].find_and_merge_plugins( config_hash ) + @ceedling[:configurator].populate_tool_names_and_stderr_redirect( config_hash ) + @ceedling[:configurator].eval_environment_variables( config_hash ) + @ceedling[:configurator].eval_paths( config_hash ) + @ceedling[:configurator].standardize_paths( config_hash ) + @ceedling[:configurator].validate( config_hash ) + @ceedling[:configurator].build( config_hash ) + @ceedling[:configurator].insert_rake_plugins( @ceedling[:configurator].rake_plugins ) + + @ceedling[:plugin_manager].load_plugin_scripts( @ceedling[:configurator].script_plugins, @ceedling ) + @ceedling[:plugin_reportinator].set_system_objects( @ceedling ) + @ceedling[:file_finder].prepare_search_sources + @ceedling[:loginator].setup_log_filepath + @ceedling[:project_config_manager].config_hash = config_hash + end + + def reset_defaults(config_hash) + @ceedling[:configurator].reset_defaults( config_hash ) + end +end diff --git a/flex-bison/mark1/tools/ceedling/lib/stream_wrapper.rb b/flex-bison/mark1/tools/ceedling/lib/stream_wrapper.rb new file mode 100644 index 0000000..33d3c10 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/stream_wrapper.rb @@ -0,0 +1,20 @@ + +class StreamWrapper + + def stdout_puts(string) + $stdout.puts(string) + end + + def stdout_flush + $stdout.flush + end + + def stderr_puts(string) + $stderr.puts(string) + end + + def stderr_flush + $stderr.flush + end + +end diff --git a/flex-bison/mark1/tools/ceedling/lib/streaminator.rb b/flex-bison/mark1/tools/ceedling/lib/streaminator.rb new file mode 100644 index 0000000..abbc9b8 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/streaminator.rb @@ -0,0 +1,41 @@ + +class Streaminator + + require 'constants' + + constructor :streaminator_helper, :verbosinator, :loginator, :stream_wrapper + + # for those objects for whom the configurator has already been instantiated, + # Streaminator is a convenience object for handling verbosity and writing to the std streams + + def stdout_puts(string, verbosity=Verbosity::NORMAL) + if (@verbosinator.should_output?(verbosity)) + @stream_wrapper.stdout_puts(string) + @stream_wrapper.stdout_flush + end + + # write to log as though Verbosity::OBNOXIOUS + @loginator.log( string, @streaminator_helper.extract_name($stdout) ) + end + + def stderr_puts(string, verbosity=Verbosity::NORMAL) + if (@verbosinator.should_output?(verbosity)) + @stream_wrapper.stderr_puts(string) + @stream_wrapper.stderr_flush + end + + # write to log as though Verbosity::OBNOXIOUS + @loginator.log( string, @streaminator_helper.extract_name($stderr) ) + end + + def stream_puts(stream, string, verbosity=Verbosity::NORMAL) + if (@verbosinator.should_output?(verbosity)) + stream.puts(string) + stream.flush + end + + # write to log as though Verbosity::OBNOXIOUS + @loginator.log( string, @streaminator_helper.extract_name(stream) ) + end + +end diff --git a/flex-bison/mark1/tools/ceedling/lib/streaminator_helper.rb b/flex-bison/mark1/tools/ceedling/lib/streaminator_helper.rb new file mode 100644 index 0000000..9fb5cc0 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/streaminator_helper.rb @@ -0,0 +1,15 @@ + +class StreaminatorHelper + + def extract_name(stream) + name = case (stream.fileno) + when 0 then '#' + when 1 then '#' + when 2 then '#' + else stream.inspect + end + + return name + end + +end diff --git a/flex-bison/mark1/tools/ceedling/lib/system_wrapper.rb b/flex-bison/mark1/tools/ceedling/lib/system_wrapper.rb new file mode 100644 index 0000000..631be36 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/system_wrapper.rb @@ -0,0 +1,67 @@ +require 'rbconfig' + +class SystemWrapper + + # static method for use in defaults + def self.is_windows? + return ((Config::CONFIG['host_os'] =~ /mswin|mingw/) ? true : false) + end + + # class method so as to be mockable for tests + def is_windows? + return SystemWrapper.is_windows? + end + + def module_eval(string) + return Object.module_eval("\"" + string + "\"") + end + + def eval(string) + return eval(string) + end + + def search_paths + return ENV['PATH'].split(File::PATH_SEPARATOR) + end + + def cmdline_args + return ARGV + end + + def env_set(name, value) + ENV[name] = value + end + + def env_get(name) + return ENV[name] + end + + def time_now + return Time.now.asctime + end + + def shell_execute(command) + return { + :output => `#{command}`, + :exit_code => ($?.exitstatus) + } + end + + def add_load_path(path) + $LOAD_PATH.unshift(path) + end + + def require_file(path) + require(path) + end + + def ruby_success + return ($!.nil? || $!.is_a?(SystemExit) && $!.success?) + end + + def constants_include?(item) + # forcing to strings provides consistency across Ruby versions + return Object.constants.map{|constant| constant.to_s}.include?(item.to_s) + end + +end diff --git a/flex-bison/mark1/tools/ceedling/lib/task_invoker.rb b/flex-bison/mark1/tools/ceedling/lib/task_invoker.rb new file mode 100644 index 0000000..92f3854 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/task_invoker.rb @@ -0,0 +1,85 @@ + +class TaskInvoker + + constructor :dependinator, :rake_utils, :rake_wrapper + + def setup + @test_regexs = [/^#{TEST_ROOT_NAME}:/] + @release_regexs = [/^#{RELEASE_ROOT_NAME}(:|$)/] + end + + def add_test_task_regex(regex) + @test_regexs << regex + end + + def add_release_task_regex(regex) + @release_regexs << regex + end + + def test_invoked? + invoked = false + + @test_regexs.each do |regex| + invoked = true if (@rake_utils.task_invoked?(regex)) + break if invoked + end + + return invoked + end + + def release_invoked? + invoked = false + + @release_regexs.each do |regex| + invoked = true if (@rake_utils.task_invoked?(regex)) + break if invoked + end + + return invoked + end + + def invoked?(regex) + return @rake_utils.task_invoked?(regex) + end + + + def invoke_test_mocks(mocks) + @dependinator.enhance_mock_dependencies( mocks ) + mocks.each { |mock| @rake_wrapper[mock].invoke } + end + + def invoke_test_runner(runner) + @dependinator.enhance_runner_dependencies( runner ) + @rake_wrapper[runner].invoke + end + + def invoke_test_shallow_include_lists(files) + @dependinator.enhance_shallow_include_lists_dependencies( files ) + files.each { |file| @rake_wrapper[file].invoke } + end + + def invoke_test_preprocessed_files(files) + @dependinator.enhance_preprocesed_file_dependencies( files ) + files.each { |file| @rake_wrapper[file].invoke } + end + + def invoke_test_dependencies_files(files) + @dependinator.enhance_dependencies_dependencies( files ) + files.each { |file| @rake_wrapper[file].invoke } + end + + def invoke_test_results(result) + @dependinator.enhance_results_dependencies( result ) + @rake_wrapper[result].invoke + end + + + def invoke_release_dependencies_files(files) + files.each { |file| @rake_wrapper[file].invoke } + end + + def invoke_release_objects(objects) + objects.each { |object| @rake_wrapper[object].invoke } + end + +end diff --git a/flex-bison/mark1/tools/ceedling/lib/tasks_base.rake b/flex-bison/mark1/tools/ceedling/lib/tasks_base.rake new file mode 100644 index 0000000..fbe4081 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/tasks_base.rake @@ -0,0 +1,104 @@ +require 'constants' +require 'file_path_utils' + + +desc "Display build environment version info." +task :version do + tools = [ + [' Ceedling', CEEDLING_ROOT], + ['CException', File.join( CEEDLING_VENDOR, CEXCEPTION_ROOT_PATH)], + [' CMock', File.join( CEEDLING_VENDOR, CMOCK_ROOT_PATH)], + [' Unity', File.join( CEEDLING_VENDOR, UNITY_ROOT_PATH)], + ] + + tools.each do |tool| + name = tool[0] + base_path = tool[1] + + version_string = @ceedling[:file_wrapper].read( File.join(base_path, 'release', 'version.info') ).strip + build_string = @ceedling[:file_wrapper].read( File.join(base_path, 'release', 'build.info') ).strip + puts "#{name}:: #{version_string.empty? ? '#.#.' : (version_string + '.')}#{build_string.empty? ? '?' : build_string}" + end +end + + +desc "Set verbose output (silent:[#{Verbosity::SILENT}] - obnoxious:[#{Verbosity::OBNOXIOUS}])." +task :verbosity, :level do |t, args| + verbosity_level = args.level.to_i + + if (PROJECT_USE_MOCKS) + # don't store verbosity level in setupinator's config hash, use a copy; + # otherwise, the input configuration will change and trigger entire project rebuilds + hash = @ceedling[:setupinator].config_hash[:cmock].clone + hash[:verbosity] = verbosity_level + + @ceedling[:cmock_builder].manufacture( hash ) + end + + @ceedling[:configurator].project_verbosity = verbosity_level + + # control rake's verbosity with new setting + verbose( ((verbosity_level >= Verbosity::OBNOXIOUS) ? true : false) ) +end + + +desc "Enable logging" +task :logging do + @ceedling[:configurator].project_logging = true +end + + +# non advertised debug task +task :debug do + Rake::Task[:verbosity].invoke(Verbosity::DEBUG) + Rake.application.options.trace = true + @ceedling[:configurator].project_debug = true +end + + +# non advertised sanity checking task +task :sanity_checks, :level do |t, args| + check_level = args.level.to_i + @ceedling[:configurator].sanity_checks = check_level +end + + +# list expanded environment variables +if (not COLLECTION_ENVIRONMENT.empty?) +desc "List all configured environment variables." +task :environment do + COLLECTION_ENVIRONMENT.each do |env| + env.each_key do |key| + name = key.to_s.upcase + puts " - #{name}: \"#{env[key]}\"" + end + end +end +end + + +namespace :options do + + COLLECTION_PROJECT_OPTIONS.each do |option_path| + option = File.basename(option_path, '.yml') + + desc "Merge #{option} project options." + task option.downcase.to_sym do + @ceedling[:setupinator].reset_defaults( @ceedling[:setupinator].config_hash ) + hash = @ceedling[:project_config_manager].merge_options( @ceedling[:setupinator].config_hash, option_path ) + @ceedling[:setupinator].do_setup( hash ) + end + end + +end + + +# do not present task if there's no plugins +if (not PLUGINS_ENABLED.empty?) +desc "Execute plugin result summaries (no build triggering)." +task :summary do + @ceedling[:plugin_manager].summary + puts "\nNOTE: Summaries may be out of date with project sources.\n\n" +end +end + diff --git a/flex-bison/mark1/tools/ceedling/lib/tasks_filesystem.rake b/flex-bison/mark1/tools/ceedling/lib/tasks_filesystem.rake new file mode 100644 index 0000000..e119d64 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/tasks_filesystem.rake @@ -0,0 +1,89 @@ + +# rather than require 'rake/clean' & try to override, we replicate for finer control +CLEAN = Rake::FileList["**/*~", "**/*.bak"] +CLOBBER = Rake::FileList.new + +CLEAN.clear_exclude.exclude { |fn| fn.pathmap("%f") == 'core' && File.directory?(fn) } + +CLEAN.include(File.join(PROJECT_TEST_BUILD_OUTPUT_PATH, '*')) +CLEAN.include(File.join(PROJECT_TEST_RESULTS_PATH, '*')) +CLEAN.include(File.join(PROJECT_TEST_DEPENDENCIES_PATH, '*')) +CLEAN.include(File.join(PROJECT_RELEASE_BUILD_OUTPUT_PATH, '*')) + +CLOBBER.include(File.join(PROJECT_BUILD_ARTIFACTS_ROOT, '**/*')) +CLOBBER.include(File.join(PROJECT_BUILD_TESTS_ROOT, '**/*')) +CLOBBER.include(File.join(PROJECT_BUILD_RELEASE_ROOT, '**/*')) +CLOBBER.include(File.join(PROJECT_LOG_PATH, '**/*')) +CLOBBER.include(File.join(PROJECT_TEMP_PATH, '**/*')) + +# because of cmock config, mock path can optionally exist apart from standard test build paths +CLOBBER.include(File.join(CMOCK_MOCK_PATH, '*')) + +REMOVE_FILE_PROC = Proc.new { |fn| rm_r fn rescue nil } + +# redefine clean so we can override how it advertises itself +desc "Delete all build artifacts and temporary products." +task(:clean) do + # because :clean is a prerequisite for :clobber, intelligently display the progress message + if (not @ceedling[:task_invoker].invoked?(/^clobber$/)) + @ceedling[:streaminator].stdout_puts("\nCleaning build artifacts...\n(For large projects, this task may take a long time to complete)\n\n") + end + CLEAN.each { |fn| REMOVE_FILE_PROC.call(fn) } +end + +# redefine clobber so we can override how it advertises itself +desc "Delete all generated files (and build artifacts)." +task(:clobber => [:clean]) do + @ceedling[:streaminator].stdout_puts("\nClobbering all generated files...\n(For large projects, this task may take a long time to complete)\n\n") + CLOBBER.each { |fn| REMOVE_FILE_PROC.call(fn) } +end + + +PROJECT_BUILD_PATHS.each { |path| directory(path) } + +# create directories that hold build output and generated files & touching rebuild dependency sources +task(:directories => PROJECT_BUILD_PATHS) { @ceedling[:dependinator].touch_force_rebuild_files } + + +# list paths discovered at load time +namespace :paths do + + paths = @ceedling[:setupinator].config_hash[:paths] + paths.each_key do |section| + name = section.to_s.downcase + path_list = Object.const_get("COLLECTION_PATHS_#{name.upcase}") + + if (path_list.size != 0) + desc "List all collected #{name} paths." + task(name.to_sym) { puts "#{name} paths:"; path_list.sort.each {|path| puts " - #{path}" } } + end + end + +end + + +# list files & file counts discovered at load time +namespace :files do + + categories = [ + ['test', COLLECTION_ALL_TESTS], + ['source', COLLECTION_ALL_SOURCE], + ['header', COLLECTION_ALL_HEADERS] + ] + categories << ['assembly', COLLECTION_ALL_ASSEMBLY] if (RELEASE_BUILD_USE_ASSEMBLY) + + categories.each do |category| + name = category[0] + collection = category[1] + + desc "List all collected #{name} files." + task(name.to_sym) do + puts "#{name} files:" + collection.sort.each { |filepath| puts " - #{filepath}" } + puts "file count: #{collection.size}" + end + end + +end + + diff --git a/flex-bison/mark1/tools/ceedling/lib/tasks_release.rake b/flex-bison/mark1/tools/ceedling/lib/tasks_release.rake new file mode 100644 index 0000000..88aa678 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/tasks_release.rake @@ -0,0 +1,44 @@ +require 'constants' +require 'file_path_utils' + + +desc "Build release target." +task :release => [:directories] do + header = "Release build '#{File.basename(PROJECT_RELEASE_BUILD_TARGET)}'" + @ceedling[:streaminator].stdout_puts("\n\n#{header}\n#{'-' * header.length}") + + core_objects = [] + extra_objects = @ceedling[:file_path_utils].form_release_build_c_objects_filelist( COLLECTION_RELEASE_ARTIFACT_EXTRA_LINK_OBJECTS ) + + @ceedling[:project_config_manager].process_release_config_change + core_objects.concat( @ceedling[:release_invoker].setup_and_invoke_c_objects( COLLECTION_ALL_SOURCE ) ) + core_objects.concat( @ceedling[:release_invoker].setup_and_invoke_asm_objects( COLLECTION_ALL_ASSEMBLY ) ) + + file( PROJECT_RELEASE_BUILD_TARGET => (core_objects + extra_objects) ) + Rake::Task[PROJECT_RELEASE_BUILD_TARGET].invoke +end + + +namespace :release do + + namespace :compile do + COLLECTION_ALL_SOURCE.each do |source| + name = File.basename( source ) + task name.to_sym => [:directories] do + @ceedling[:project_config_manager].process_release_config_change + @ceedling[:release_invoker].setup_and_invoke_c_objects( [source] ) + end + end + end + + namespace :assemble do + COLLECTION_ALL_ASSEMBLY.each do |source| + name = File.basename( source ) + task name.to_sym => [:directories] do + @ceedling[:project_config_manager].process_release_config_change + @ceedling[:release_invoker].setup_and_invoke_asm_objects( [source] ) + end + end + end + +end \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/lib/tasks_tests.rake b/flex-bison/mark1/tools/ceedling/lib/tasks_tests.rake new file mode 100644 index 0000000..a1845ac --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/tasks_tests.rake @@ -0,0 +1,49 @@ + +namespace TEST_CONTEXT do + + desc "Run all unit tests." + task :all => [:directories] do + @ceedling[:test_invoker].setup_and_invoke(COLLECTION_ALL_TESTS) + end + + desc "Run single test ([*] real test or source file name, no path)." + task :* do + message = "\nOops! '#{TEST_ROOT_NAME}:*' isn't a real task. " + + "Use a real test or source file name (no path) in place of the wildcard.\n" + + "Example: rake #{TEST_ROOT_NAME}:foo.c\n\n" + + @ceedling[:streaminator].stdout_puts( message ) + end + + desc "Run tests for changed files." + task :delta => [:directories] do + @ceedling[:test_invoker].setup_and_invoke(COLLECTION_ALL_TESTS, {:force_run => false}) + end + + desc "Run tests by matching regular expression pattern." + task :pattern, [:regex] => [:directories] do |t, args| + matches = [] + + COLLECTION_ALL_TESTS.each { |test| matches << test if (test =~ /#{args.regex}/) } + + if (matches.size > 0) + @ceedling[:test_invoker].setup_and_invoke(matches, {:force_run => false}) + else + @ceedling[:streaminator].stdout_puts("\nFound no tests matching pattern /#{args.regex}/.") + end + end + + desc "Run tests whose test path contains [dir] or [dir] substring." + task :path, [:dir] => [:directories] do |t, args| + matches = [] + + COLLECTION_ALL_TESTS.each { |test| matches << test if File.dirname(test).include?(args.dir.gsub(/\\/, '/')) } + + if (matches.size > 0) + @ceedling[:test_invoker].setup_and_invoke(matches, {:force_run => false}) + else + @ceedling[:streaminator].stdout_puts("\nFound no tests including the given path or path component.") + end + end + +end diff --git a/flex-bison/mark1/tools/ceedling/lib/tasks_vendor.rake b/flex-bison/mark1/tools/ceedling/lib/tasks_vendor.rake new file mode 100644 index 0000000..0d07154 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/tasks_vendor.rake @@ -0,0 +1,36 @@ +require 'constants' +require 'file_path_utils' + +# create file dependencies to ensure C-based components of vendor tools are recompiled when they are updated with new versions +# forming these explicitly rather than depend on auxiliary dependencies so all scenarios are explicitly covered + +file( @ceedling[:file_path_utils].form_test_build_object_filepath( UNITY_C_FILE ) => [ + FilePathUtils.form_ceedling_vendor_path( UNITY_LIB_PATH, UNITY_C_FILE ), + FilePathUtils.form_ceedling_vendor_path( UNITY_LIB_PATH, UNITY_H_FILE ), + FilePathUtils.form_ceedling_vendor_path( UNITY_LIB_PATH, UNITY_INTERNALS_H_FILE ) ] + ) + + +if (PROJECT_USE_MOCKS) +file( @ceedling[:file_path_utils].form_test_build_object_filepath( CMOCK_C_FILE ) => [ + FilePathUtils.form_ceedling_vendor_path( CMOCK_LIB_PATH, CMOCK_C_FILE ), + FilePathUtils.form_ceedling_vendor_path( CMOCK_LIB_PATH, CMOCK_H_FILE ) ] + ) +end + + +if (PROJECT_USE_EXCEPTIONS) +file( @ceedling[:file_path_utils].form_test_build_object_filepath( CEXCEPTION_C_FILE ) => [ + FilePathUtils.form_ceedling_vendor_path( CEXCEPTION_LIB_PATH, CEXCEPTION_C_FILE ), + FilePathUtils.form_ceedling_vendor_path( CEXCEPTION_LIB_PATH, CEXCEPTION_H_FILE ) ] + ) +end + + +if (PROJECT_USE_EXCEPTIONS and PROJECT_RELEASE_BUILD) +file( @ceedling[:file_path_utils].form_release_build_c_object_filepath( CEXCEPTION_C_FILE ) => [ + FilePathUtils.form_ceedling_vendor_path( CEXCEPTION_LIB_PATH, CEXCEPTION_C_FILE ), + FilePathUtils.form_ceedling_vendor_path( CEXCEPTION_LIB_PATH, CEXCEPTION_H_FILE ) ] + ) +end + diff --git a/flex-bison/mark1/tools/ceedling/lib/test_includes_extractor.rb b/flex-bison/mark1/tools/ceedling/lib/test_includes_extractor.rb new file mode 100644 index 0000000..35f7c53 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/test_includes_extractor.rb @@ -0,0 +1,81 @@ + +class TestIncludesExtractor + + constructor :configurator, :yaml_wrapper, :file_wrapper + + + def setup + @includes = {} + @mocks = {} + end + + + # for includes_list file, slurp up array from yaml file and sort & store includes + def parse_includes_list(includes_list) + gather_and_store_includes( includes_list, @yaml_wrapper.load(includes_list) ) + end + + # open, scan for, and sort & store includes of test file + def parse_test_file(test) + gather_and_store_includes( test, extract_from_file(test) ) + end + + # mocks with no file extension + def lookup_raw_mock_list(test) + file_key = form_file_key(test) + return [] if @mocks[file_key].nil? + return @mocks[file_key] + end + + # includes with file extension + def lookup_includes_list(file) + file_key = form_file_key(file) + return [] if (@includes[file_key]).nil? + return @includes[file_key] + end + + private ################################# + + def form_file_key(filepath) + return File.basename(filepath).to_sym + end + + def extract_from_file(file) + includes = [] + header_extension = @configurator.extension_header + + contents = @file_wrapper.read(file) + + # remove line comments + contents = contents.gsub(/\/\/.*$/, '') + # remove block comments + contents = contents.gsub(/\/\*.*?\*\//m, '') + + contents.split("\n").each do |line| + # look for include statement + scan_results = line.scan(/#include\s+\"\s*(.+#{'\\'+header_extension})\s*\"/) + + includes << scan_results[0][0] if (scan_results.size > 0) + end + + return includes.uniq + end + + def gather_and_store_includes(file, includes) + mock_prefix = @configurator.cmock_mock_prefix + header_extension = @configurator.extension_header + file_key = form_file_key(file) + @mocks[file_key] = [] + + # add includes to lookup hash + @includes[file_key] = includes + + includes.each do |include_file| + # check if include is a mock + scan_results = include_file.scan(/(#{mock_prefix}.+)#{'\\'+header_extension}/) + # add mock to lookup hash + @mocks[file_key] << scan_results[0][0] if (scan_results.size > 0) + end + end + +end diff --git a/flex-bison/mark1/tools/ceedling/lib/test_invoker.rb b/flex-bison/mark1/tools/ceedling/lib/test_invoker.rb new file mode 100644 index 0000000..b80d91e --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/test_invoker.rb @@ -0,0 +1,72 @@ +require 'rubygems' +require 'rake' # for ext() + + +class TestInvoker + + attr_reader :sources, :tests, :mocks + + constructor :configurator, :test_invoker_helper, :streaminator, :preprocessinator, :task_invoker, :dependinator, :project_config_manager, :file_path_utils + + def setup + @sources = [] + @tests = [] + @mocks = [] + end + + def setup_and_invoke(tests, options={:force_run => true}) + + @tests = tests + + @project_config_manager.process_test_config_change + + @tests.each do |test| + # announce beginning of test run + header = "Test '#{File.basename(test)}'" + @streaminator.stdout_puts("\n\n#{header}\n#{'-' * header.length}") + + begin + # collect up test fixture pieces & parts + runner = @file_path_utils.form_runner_filepath_from_test( test ) + mock_list = @preprocessinator.preprocess_test_and_invoke_test_mocks( test ) + sources = @test_invoker_helper.extract_sources( test ) + extras = @configurator.collection_test_fixture_extra_link_objects + core = [test] + mock_list + sources + objects = @file_path_utils.form_test_build_objects_filelist( [runner] + core + extras ) + results_pass = @file_path_utils.form_pass_results_filepath( test ) + results_fail = @file_path_utils.form_fail_results_filepath( test ) + + # clean results files so we have a missing file with which to kick off rake's dependency rules + @test_invoker_helper.clean_results( {:pass => results_pass, :fail => results_fail}, options ) + + # load up auxiliary dependencies so deep changes cause rebuilding appropriately + @test_invoker_helper.process_auxiliary_dependencies( core ) + + # tell rake to create test runner if needed + @task_invoker.invoke_test_runner( runner ) + + # enhance object file dependencies to capture externalities influencing regeneration + @dependinator.enhance_test_build_object_dependencies( objects ) + + # associate object files with executable + @dependinator.setup_test_executable_dependencies( test, objects ) + + # 3, 2, 1... launch + @task_invoker.invoke_test_results( results_pass ) + rescue => e + @test_invoker_helper.process_exception(e) + end + + # store away what's been processed + @mocks.concat( mock_list ) + @sources.concat( sources ) + end + + # post-process collected mock list + @mocks.uniq! + + # post-process collected sources list + @sources.uniq! + end + +end diff --git a/flex-bison/mark1/tools/ceedling/lib/test_invoker_helper.rb b/flex-bison/mark1/tools/ceedling/lib/test_invoker_helper.rb new file mode 100644 index 0000000..f7d848d --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/test_invoker_helper.rb @@ -0,0 +1,41 @@ +require 'rubygems' +require 'rake' # for ext() + + +class TestInvokerHelper + + constructor :configurator, :task_invoker, :dependinator, :test_includes_extractor, :file_finder, :file_path_utils, :streaminator, :file_wrapper + + def clean_results(results, options) + @file_wrapper.rm_f( results[:fail] ) + @file_wrapper.rm_f( results[:pass] ) if (options[:force_run]) + end + + def process_auxiliary_dependencies(files) + return if (not @configurator.project_use_auxiliary_dependencies) + + dependencies_list = @file_path_utils.form_test_dependencies_filelist( files ) + @task_invoker.invoke_test_dependencies_files( dependencies_list ) + @dependinator.load_test_object_deep_dependencies( dependencies_list ) + end + + def extract_sources(test) + sources = [] + includes = @test_includes_extractor.lookup_includes_list(test) + + includes.each { |include| sources << @file_finder.find_source_file(include, :ignore) } + + return sources.compact + end + + def process_exception(exception) + if (exception.message =~ /Don't know how to build task '(.+)'/i) + @streaminator.stderr_puts("ERROR: Rake could not find file referenced in source or test: '#{$1}'.") + @streaminator.stderr_puts("Possible stale dependency due to a file name change, etc. Execute 'clean' task and try again.") if (@configurator.project_use_auxiliary_dependencies) + raise '' + else + raise exception + end + end + +end diff --git a/flex-bison/mark1/tools/ceedling/lib/tool_executor.rb b/flex-bison/mark1/tools/ceedling/lib/tool_executor.rb new file mode 100644 index 0000000..fcd4d42 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/tool_executor.rb @@ -0,0 +1,178 @@ +require 'constants' + + +class ToolExecutor + + constructor :configurator, :tool_executor_helper, :streaminator, :system_wrapper + + def setup + @tool_name = '' + @executable = '' + end + + # build up a command line from yaml provided config + def build_command_line(tool_config, *args) + @tool_name = tool_config[:name] + @executable = tool_config[:executable] + + # basic premise is to iterate top to bottom through arguments using '$' as + # a string replacement indicator to expand globals or inline yaml arrays + # into command line arguments via substitution strings + return [ + @tool_executor_helper.osify_path_separators( expandify_element(@executable, *args) ), + build_arguments(tool_config[:arguments], *args), + @tool_executor_helper.stderr_redirect_addendum(tool_config) ].compact.join(' ') + end + + + # shell out, execute command, and return response + def exec(command, args=[], options={:boom => true}) + command_str = "#{command} #{args.join(' ')}".strip + + shell_result = @system_wrapper.shell_execute(command_str) + + @tool_executor_helper.print_happy_results(command_str, shell_result) + @tool_executor_helper.print_error_results(command_str, shell_result) if (options[:boom]) + + raise if ((shell_result[:exit_code] != 0) and options[:boom]) + + return shell_result + end + + + private ############################# + + + def build_arguments(config, *args) + build_string = '' + + return nil if (config.nil?) + + # iterate through each argument + + # the yaml blob array needs to be flattened so that yaml substitution + # is handled correctly, since it creates a nested array when an anchor is + # dereferenced + config.flatten.each do |element| + argument = '' + + case(element) + # if we find a simple string then look for string replacement operators + # and expand with the parameters in this method's argument list + when String then argument = expandify_element(element, *args) + # if we find a hash, then we grab the key as a substitution string and expand the + # hash's value(s) within that substitution string + when Hash then argument = dehashify_argument_elements(element) + end + + build_string.concat("#{argument} ") if (argument.length > 0) + end + + build_string.strip! + return build_string if (build_string.length > 0) + return nil + end + + + # handle simple text string argument & argument array string replacement operators + def expandify_element(element, *args) + match = // + to_process = nil + args_index = 0 + + # handle ${#} input replacement + if (element =~ TOOL_EXECUTOR_ARGUMENT_REPLACEMENT_PATTERN) + args_index = ($2.to_i - 1) + + if (args.nil? or args[args_index].nil?) + @streaminator.stderr_puts("ERROR: Tool '#{@tool_name}' expected valid argument data to accompany replacement operator #{$1}.", Verbosity::ERRORS) + raise + end + + match = /#{Regexp.escape($1)}/ + to_process = args[args_index] + end + + # simple string argument: replace escaped '\$' and strip + element.sub!(/\\\$/, '$') + element.strip! + + # handle inline ruby execution + if (element =~ RUBY_EVAL_REPLACEMENT_PATTERN) + element.replace(eval($1)) + end + + build_string = '' + + # handle array or anything else passed into method to be expanded in place of replacement operators + case (to_process) + when Array then to_process.each {|value| build_string.concat( "#{element.sub(match, value.to_s)} " ) } if (to_process.size > 0) + else build_string.concat( element.sub(match, to_process.to_s) ) + end + + # handle inline ruby string substitution + if (build_string =~ RUBY_STRING_REPLACEMENT_PATTERN) + build_string.replace(@system_wrapper.module_eval(build_string)) + end + + return build_string.strip + end + + + # handle argument hash: keys are substitution strings, values are data to be expanded within substitution strings + def dehashify_argument_elements(hash) + build_string = '' + elements = [] + + # grab the substitution string (hash key) + substitution = hash.keys[0].to_s + # grab the string(s) to squirt into the substitution string (hash value) + expand = hash[hash.keys[0]] + + if (expand.nil?) + @streaminator.stderr_puts("ERROR: Tool '#{@tool_name}' could not expand nil elements for substitution string '#{substitution}'.", Verbosity::ERRORS) + raise + end + + # array-ify expansion input if only a single string + expansion = ((expand.class == String) ? [expand] : expand) + + expansion.each do |item| + # code eval substitution + if (item =~ RUBY_EVAL_REPLACEMENT_PATTERN) + elements << eval($1) + # string eval substitution + elsif (item =~ RUBY_STRING_REPLACEMENT_PATTERN) + elements << @system_wrapper.module_eval(item) + # global constants + elsif (@system_wrapper.constants_include?(item)) + const = Object.const_get(item) + if (const.nil?) + @streaminator.stderr_puts("ERROR: Tool '#{@tool_name}' found constant '#{item}' to be nil.", Verbosity::ERRORS) + raise + else + elements << const + end + elsif (item.class == Array) + elements << item + elsif (item.class == String) + @streaminator.stderr_puts("ERROR: Tool '#{@tool_name}' cannot expand nonexistent value '#{item}' for substitution string '#{substitution}'.", Verbosity::ERRORS) + raise + else + @streaminator.stderr_puts("ERROR: Tool '#{@tool_name}' cannot expand value having type '#{item.class}' for substitution string '#{substitution}'.", Verbosity::ERRORS) + raise + end + end + + # expand elements (whether string or array) into substitution string & replace escaped '\$' + elements.flatten! + elements.each do |element| + build_string.concat( substitution.sub(/([^\\]*)\$/, "\\1#{element}") ) # don't replace escaped '\$' but allow us to replace just a lonesome '$' + build_string.gsub!(/\\\$/, '$') + build_string.concat(' ') + end + + return build_string.strip + end + +end diff --git a/flex-bison/mark1/tools/ceedling/lib/tool_executor_helper.rb b/flex-bison/mark1/tools/ceedling/lib/tool_executor_helper.rb new file mode 100644 index 0000000..c9f9ca2 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/tool_executor_helper.rb @@ -0,0 +1,57 @@ +require 'constants' # for Verbosity enumeration & $stderr redirect enumeration + +class ToolExecutorHelper + + constructor :streaminator, :system_wrapper + + def osify_path_separators(executable) + return executable.gsub(/\//, '\\') if (@system_wrapper.is_windows?) + return executable + end + + def stderr_redirect_addendum(tool_config) + return nil if (tool_config[:stderr_redirect].nil?) + + redirect = tool_config[:stderr_redirect] + + case redirect + # we may need more complicated processing after some learning with various environments + when StdErrRedirect::NONE then nil + when StdErrRedirect::AUTO then '2>&1' + when StdErrRedirect::WIN then '2>&1' + when StdErrRedirect::UNIX then '2>&1' + when StdErrRedirect::TCSH then '|&' + else redirect.to_s + end + end + + # if command succeeded and we have verbosity cranked up, spill our guts + def print_happy_results(command_str, shell_result) + if (shell_result[:exit_code] == 0) + output = "> Shell executed command:\n" + output += "#{command_str}\n" + output += "> Produced response:\n" if (not shell_result[:output].empty?) + output += "#{shell_result[:output].strip}\n" if (not shell_result[:output].empty?) + output += "\n" + + @streaminator.stdout_puts(output, Verbosity::OBNOXIOUS) + end + end + + # if command failed and we have verbosity set to minimum error level, spill our guts + def print_error_results(command_str, shell_result) + if (shell_result[:exit_code] != 0) + output = "ERROR: Shell command failed.\n" + output += "> Shell executed command:\n" + output += "'#{command_str}'\n" + output += "> Produced response:\n" if (not shell_result[:output].empty?) + output += "#{shell_result[:output].strip}\n" if (not shell_result[:output].empty?) + output += "> And exited with status: [#{shell_result[:exit_code]}].\n" if (shell_result[:exit_code] != nil) + output += "> And then likely crashed.\n" if (shell_result[:exit_code] == nil) + output += "\n" + + @streaminator.stderr_puts(output, Verbosity::ERRORS) + end + end + +end diff --git a/flex-bison/mark1/tools/ceedling/lib/verbosinator.rb b/flex-bison/mark1/tools/ceedling/lib/verbosinator.rb new file mode 100644 index 0000000..e8ed38d --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/verbosinator.rb @@ -0,0 +1,10 @@ + +class Verbosinator + + constructor :configurator + + def should_output?(level) + return (level <= @configurator.project_verbosity) + end + +end diff --git a/flex-bison/mark1/tools/ceedling/lib/yaml_wrapper.rb b/flex-bison/mark1/tools/ceedling/lib/yaml_wrapper.rb new file mode 100644 index 0000000..77cef59 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/lib/yaml_wrapper.rb @@ -0,0 +1,16 @@ +require 'yaml' + + +class YamlWrapper + + def load(filepath) + return YAML.load(File.read(filepath)) + end + + def dump(filepath, structure) + File.open(filepath, 'w') do |output| + YAML.dump(structure, output) + end + end + +end diff --git a/flex-bison/mark1/tools/ceedling/plugins/stdout_ide_tests_report/stdout_ide_tests_report.rb b/flex-bison/mark1/tools/ceedling/plugins/stdout_ide_tests_report/stdout_ide_tests_report.rb new file mode 100644 index 0000000..f76ec14 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/plugins/stdout_ide_tests_report/stdout_ide_tests_report.rb @@ -0,0 +1,44 @@ +require 'plugin' +require 'defaults' + +class StdoutIdeTestsReport < Plugin + + def setup + @result_list = [] + end + + def post_test_execute(arg_hash) + return if not (arg_hash[:context] == TEST_CONTEXT) + + @result_list << arg_hash[:result_file] + end + + def post_build + return if (not @ceedling[:task_invoker].test_invoked?) + + results = @ceedling[:plugin_reportinator].assemble_test_results(@result_list) + hash = { + :header => '', + :results => results + } + + @ceedling[:plugin_reportinator].run_test_results_report(hash) do + message = '' + message = 'Unit test failures.' if (hash[:results[:counts][:failed] > 0) + message + end + end + + def summary + result_list = @ceedling[:file_path_utils].form_pass_results_filelist( PROJECT_TEST_RESULTS_PATH, COLLECTION_ALL_TESTS ) + + # get test results for only those tests in our configuration and of those only tests with results on disk + hash = { + :header => '', + :results => @ceedling[:plugin_reportinator].assemble_test_results(result_list, {:boom => false}) + } + + @ceedling[:plugin_reportinator].run_test_results_report(hash) + end + +end \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/plugins/stdout_ide_tests_report/stdout_ide_tests_report.yml b/flex-bison/mark1/tools/ceedling/plugins/stdout_ide_tests_report/stdout_ide_tests_report.yml new file mode 100644 index 0000000..c25acf5 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/plugins/stdout_ide_tests_report/stdout_ide_tests_report.yml @@ -0,0 +1,4 @@ +--- +:plugins: + # tell Ceedling we got results display taken care of + :display_raw_test_results: FALSE diff --git a/flex-bison/mark1/tools/ceedling/plugins/stdout_pretty_tests_report/stdout_pretty_tests_report.rb b/flex-bison/mark1/tools/ceedling/plugins/stdout_pretty_tests_report/stdout_pretty_tests_report.rb new file mode 100644 index 0000000..1213a19 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/plugins/stdout_pretty_tests_report/stdout_pretty_tests_report.rb @@ -0,0 +1,108 @@ +require 'plugin' +require 'defaults' + +class StdoutPrettyTestsReport < Plugin + + def setup + @result_list = [] + + template = %q{ + % ignored = hash[:results][:counts][:ignored] + % failed = hash[:results][:counts][:failed] + % stdout_count = hash[:results][:counts][:stdout] + % header_prepend = ((hash[:header].length > 0) ? "#{hash[:header]}: " : '') + % banner_width = 25 + header_prepend.length # widest message + + % if (ignored > 0) + <%=@ceedling[:plugin_reportinator].generate_banner(header_prepend + 'IGNORED UNIT TEST SUMMARY')%> + % hash[:results][:ignores].each do |ignore| + [<%=ignore[:source][:file]%>] + % ignore[:collection].each do |item| + Test: <%=item[:test]%> + % if (not item[:message].empty?) + At line (<%=item[:line]%>): "<%=item[:message]%>" + % else + At line (<%=item[:line]%>) + % end + + % end + % end + % end + % if (failed > 0) + <%=@ceedling[:plugin_reportinator].generate_banner(header_prepend + 'FAILED UNIT TEST SUMMARY')%> + % hash[:results][:failures].each do |failure| + [<%=failure[:source][:file]%>] + % failure[:collection].each do |item| + Test: <%=item[:test]%> + % if (not item[:message].empty?) + At line (<%=item[:line]%>): "<%=item[:message]%>" + % else + At line (<%=item[:line]%>) + % end + + % end + % end + % end + % if (stdout_count > 0) + <%=@ceedling[:plugin_reportinator].generate_banner(header_prepend + 'UNIT TEST OTHER OUTPUT')%> + % hash[:results][:stdout].each do |string| + [<%=string[:source][:file]%>] + % string[:collection].each do |item| + - "<%=item%>" + % end + + % end + % end + % total_string = hash[:results][:counts][:total].to_s + % format_string = "%#{total_string.length}i" + <%=@ceedling[:plugin_reportinator].generate_banner(header_prepend + 'OVERALL UNIT TEST SUMMARY')%> + % if (hash[:results][:counts][:total] > 0) + TESTED: <%=hash[:results][:counts][:total].to_s%> + PASSED: <%=sprintf(format_string, hash[:results][:counts][:passed])%> + FAILED: <%=sprintf(format_string, failed)%> + IGNORED: <%=sprintf(format_string, ignored)%> + % else + + No tests executed. + % end + + }.left_margin + + @ceedling[:plugin_reportinator].register_test_results_template( template ) + end + + def post_test_execute(arg_hash) + return if not (arg_hash[:context] == TEST_CONTEXT) + + @result_list << arg_hash[:result_file] + end + + def post_build + return if not (@ceedling[:task_invoker].test_invoked?) + + results = @ceedling[:plugin_reportinator].assemble_test_results(@result_list) + hash = { + :header => '', + :results => results + } + + @ceedling[:plugin_reportinator].run_test_results_report(hash) do + message = '' + message = 'Unit test failures.' if (results[:counts][:failed] > 0) + message + end + end + + def summary + result_list = @ceedling[:file_path_utils].form_pass_results_filelist( PROJECT_TEST_RESULTS_PATH, COLLECTION_ALL_TESTS ) + + # get test results for only those tests in our configuration and of those only tests with results on disk + hash = { + :header => '', + :results => @ceedling[:plugin_reportinator].assemble_test_results(result_list, {:boom => false}) + } + + @ceedling[:plugin_reportinator].run_test_results_report(hash) + end + +end \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/plugins/stdout_pretty_tests_report/stdout_pretty_tests_report.yml b/flex-bison/mark1/tools/ceedling/plugins/stdout_pretty_tests_report/stdout_pretty_tests_report.yml new file mode 100644 index 0000000..c25acf5 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/plugins/stdout_pretty_tests_report/stdout_pretty_tests_report.yml @@ -0,0 +1,4 @@ +--- +:plugins: + # tell Ceedling we got results display taken care of + :display_raw_test_results: FALSE diff --git a/flex-bison/mark1/tools/ceedling/plugins/xml_tests_report/xml_tests_report.rb b/flex-bison/mark1/tools/ceedling/plugins/xml_tests_report/xml_tests_report.rb new file mode 100644 index 0000000..4aa4f77 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/plugins/xml_tests_report/xml_tests_report.rb @@ -0,0 +1,106 @@ +require 'plugin' +require 'constants' + +class XmlTestsReport < Plugin + + def setup + @file_path = File.join( PROJECT_TEST_ARTIFACTS_PATH, 'report.xml' ) + @results_list = [] + @test_counter = 1 + end + + def post_test_execute(arg_hash) + return if not (arg_hash[:context] == TEST_TASKS_CONTEXT) + + @results_list << arg_hash[:result_file] + end + + def post_build + return if (not @ceedling[:task_invoker].test_invoked?) + + results = @ceedling[:plugin_reportinator].assemble_test_results(@results_list) + + @ceedling[:file_wrapper].open( @file_path, 'w' ) do |f| + write_results( results, f ) + end + end + + private + + def write_results( results, stream ) + write_header( stream ) + write_failures( results[:failures], stream ) + write_tests( results[:successes], stream, 'SuccessfulTests' ) + write_tests( results[:ignores], stream, 'IgnoredTests' ) + write_statistics( results[:counts], stream ) + write_footer( stream ) + end + + def write_header( stream ) + stream.puts "" + stream.puts "" + end + + def write_failures( results, stream ) + if (results.size == 0) + stream.puts "\t" + return + end + + stream.puts "\t" + + results.each do |result| + result[:collection].each do |item| + filename = File.join( result[:source][:path], result[:source][:file] ) + + stream.puts "\t\t" + stream.puts "\t\t\t#{filename}::#{item[:test]}" + stream.puts "\t\t\tAssertion" + stream.puts "\t\t\t" + stream.puts "\t\t\t\t#{filename}" + stream.puts "\t\t\t\t#{item[:line]}" + stream.puts "\t\t\t" + stream.puts "\t\t\t#{item[:message]}" + stream.puts "\t\t" + @test_counter += 1 + end + end + + stream.puts "\t" + end + + def write_tests( results, stream, tag ) + if (results.size == 0) + stream.puts "\t<#{tag}/>" + return + end + + stream.puts "\t<#{tag}>" + + results.each do |result| + result[:collection].each do |item| + stream.puts "\t\t" + stream.puts "\t\t\t#{File.join( result[:source][:path], result[:source][:file] )}::#{item[:test]}" + stream.puts "\t\t" + @test_counter += 1 + end + end + + stream.puts "\t" + end + + def write_statistics( counts, stream ) + stream.puts "\t" + stream.puts "\t\t#{counts[:total]}" + stream.puts "\t\t#{counts[:ignored]}" + stream.puts "\t\t#{counts[:failed]}" + stream.puts "\t\t0" + stream.puts "\t\t#{counts[:failed]}" + stream.puts "\t" + end + + def write_footer( stream ) + stream.puts "" + end + +end \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/release/build.info b/flex-bison/mark1/tools/ceedling/release/build.info new file mode 100644 index 0000000..fa8f08c --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/release/build.info @@ -0,0 +1 @@ +150 diff --git a/flex-bison/mark1/tools/ceedling/release/version.info b/flex-bison/mark1/tools/ceedling/release/version.info new file mode 100644 index 0000000..9a7d84f --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/release/version.info @@ -0,0 +1 @@ +0.9 \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/behaviors/Manifest.txt b/flex-bison/mark1/tools/ceedling/vendor/behaviors/Manifest.txt new file mode 100644 index 0000000..6c954ec --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/behaviors/Manifest.txt @@ -0,0 +1,9 @@ +Manifest.txt +Rakefile +lib/behaviors.rb +lib/behaviors/reporttask.rb +test/behaviors_tasks_test.rb +test/behaviors_test.rb +test/tasks_test/lib/user.rb +test/tasks_test/Rakefile +test/tasks_test/test/user_test.rb diff --git a/flex-bison/mark1/tools/ceedling/vendor/behaviors/Rakefile b/flex-bison/mark1/tools/ceedling/vendor/behaviors/Rakefile new file mode 100644 index 0000000..d4d68b9 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/behaviors/Rakefile @@ -0,0 +1,19 @@ +require 'rake' +require 'rubygems' +require 'hoe' + +Hoe.new('behaviors','1.0.3') do |p| + p.author = "Atomic Object LLC" + p.email = "dev@atomicobject.com" + p.url = "http://behaviors.rubyforge.org" + p.summary = "behavior-driven unit test helper" + p.description = <<-EOS +Behaviors allows for Test::Unit test case methods to be defined as +human-readable descriptions of program behavior. It also provides +Rake tasks to list the behaviors of your project. + EOS + p.test_globs = ['test/*_test.rb'] + + p.changes = <<-EOS + EOS +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/behaviors/lib/behaviors.rb b/flex-bison/mark1/tools/ceedling/vendor/behaviors/lib/behaviors.rb new file mode 100644 index 0000000..d8d70f7 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/behaviors/lib/behaviors.rb @@ -0,0 +1,76 @@ +=begin rdoc += Usage +Behaviors provides a single method: should. + +Instead of naming test methods like: + + def test_something + end + +You declare test methods like: + + should "perform action" do + end + +You may omit the body of a should method to describe unimplemented behavior. + + should "perform other action" + +When you run your unit tests, empty should methods will appear as an 'UNIMPLEMENTED CASE' along with the described behavior. +This is useful for sketching out planned behavior quickly. + +Simply extend Behaviors in your TestCase to start using behaviors. + + require 'test/unit' + require 'behaviors' + require 'user' + + class UserTest < Test::Unit::TestCase + extend Behaviors + ... + end + += Motivation +Test methods typically focus on the name of the method under test instead of its behavior. +Creating test methods with should statements focuses on the behavior of an object. +This helps you to think about the role of the object under test. + +Using a behavior-driven approach prevents the danger in assuming a one-to-one mapping of method names to +test method names. +As always, you get the most value by writing the tests first. + +For a more complete BDD framework, try RSpec http://rspec.rubyforge.org/ + += Rake tasks + +You can define a Behaviors::ReportTask in your Rakefile to generate rake tasks that +summarize the behavior of your project. + +These tasks are named behaviors and behaviors_html. They will output to the +console or an html file in the doc directory with a list all of your should tests. + Behaviors::ReportTask.new do |t| + t.pattern = 'test/**/*_test.rb' + end + +You may also initialize the ReportTask with a custom name to associate with a particular suite of tests. + Behaviors::ReportTask.new(:widget_subsystem) do |t| + t.pattern = 'test/widgets/*_test.rb' + end + +The html report will be placed in the doc directory by default. +You can override this default by setting the html_dir in the ReportTask. + Behaviors::ReportTask.new do |t| + t.pattern = 'test/**/*_test.rb' + t.html_dir = 'behaviors_html_reports' + end +=end +module Behaviors + def should(behave,&block) + mname = "test_should_#{behave}" + if block + define_method mname, &block + else + puts ">>> UNIMPLEMENTED CASE: #{name.sub(/Test$/,'')} should #{behave}" + end + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/behaviors/lib/behaviors/reporttask.rb b/flex-bison/mark1/tools/ceedling/vendor/behaviors/lib/behaviors/reporttask.rb new file mode 100644 index 0000000..51c0eca --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/behaviors/lib/behaviors/reporttask.rb @@ -0,0 +1,158 @@ +require 'rake' +require 'rake/tasklib' + +module Behaviors +include Rake + + class ReportTask < TaskLib + attr_accessor :pattern + attr_accessor :html_dir + + def initialize(name=:behaviors) + @name = name + @html_dir = 'doc' + yield self if block_given? + define + end + + def define + desc "List behavioral definitions for the classes specified (use for= to further limit files included in report)" + task @name do + specifications.each do |spec| + puts "#{spec.name} should:\n" + spec.requirements.each do |req| + puts " - #{req}" + end + end + end + + desc "Generate html report of behavioral definitions for the classes specified (use for= to further limit files included in report)" + task "#{@name}_html" do + require 'erb' + txt =<<-EOS + + + + + +
Specifications
+<% specifications.each do |spec| %> +
+<%= spec.name %> should: +
    +<% spec.requirements.each do |req| %> +
  • <%= req %>
  • +<% end %> +
+
+<% end %> + + + EOS + output_dir = File.expand_path(@html_dir) + mkdir_p output_dir + output_filename = output_dir + "/behaviors.html" + File.open(output_filename,"w") do |f| + f.write ERB.new(txt).result(binding) + end + puts "(Wrote #{output_filename})" + end + end + + private + def test_files + test_list = FileList[@pattern] + if ENV['for'] + test_list = test_list.grep(/#{ENV['for']}/i) + end + test_list + end + + def specifications + test_files.map do |file| + spec = OpenStruct.new + m = %r".*/([^/].*)_test.rb".match(file) + class_name = titleize(m[1]) if m[1] + spec.name = class_name + spec.requirements = [] + File::readlines(file).each do |line| + if line =~ /^\s*should\s+\(?\s*["'](.*)["']/ + spec.requirements << $1 + end + end + spec + end + end + + ############################################################ + # STOLEN FROM inflector.rb + ############################################################ + #-- + # Copyright (c) 2005 David Heinemeier Hansson + # + # Permission is hereby granted, free of charge, to any person obtaining + # a copy of this software and associated documentation files (the + # "Software"), to deal in the Software without restriction, including + # without limitation the rights to use, copy, modify, merge, publish, + # distribute, sublicense, and/or sell copies of the Software, and to + # permit persons to whom the Software is furnished to do so, subject to + # the following conditions: + # + # The above copyright notice and this permission notice shall be + # included in all copies or substantial portions of the Software. + # + # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + #++ + def titleize(word) + humanize(underscore(word)).gsub(/\b([a-z])/) { $1.capitalize } + end + + def underscore(camel_cased_word) camel_cased_word.to_s.gsub(/::/, '/'). + gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').gsub(/([a-z\d])([A-Z])/,'\1_\2').tr("-", "_").downcase + end + + def humanize(lower_case_and_underscored_word) + lower_case_and_underscored_word.to_s.gsub(/_id$/, "").gsub(/_/, " ").capitalize + end + + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/behaviors/test/behaviors_tasks_test.rb b/flex-bison/mark1/tools/ceedling/vendor/behaviors/test/behaviors_tasks_test.rb new file mode 100644 index 0000000..9382e07 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/behaviors/test/behaviors_tasks_test.rb @@ -0,0 +1,73 @@ +require 'test/unit' +require 'fileutils' + +class BehaviorsTasksTest < Test::Unit::TestCase + include FileUtils + + def setup + @here = File.expand_path(File.dirname(__FILE__)) + @base_cmd = RUBY_PLATFORM[/mswin/] ? 'rake.cmd ' : 'rake ' + end + + # + # HELPERS + # + def run_behaviors_task + run_cmd "behaviors" + end + + def run_behaviors_html_task + run_cmd "behaviors_html" + end + + def run_cmd(cmd) + cd "#{@here}/tasks_test" do + @report = %x[ #{@base_cmd} #{cmd} ] + end + end + + def see_html_task_output_message + @html_output_filename = "#{@here}/tasks_test/behaviors_doc/behaviors.html" + assert_match(/Wrote #{@html_output_filename}/, @report) + end + + def see_that_html_report_file_exits + assert File.exists?(@html_output_filename), "html output file should exist" + end + + def html_report_file_should_contain(user_behaviors) + file_contents = File.read(@html_output_filename) + user_behaviors.each do |line| + assert_match(/#{line}/, file_contents) + end + rm_rf File.dirname(@html_output_filename) + end + + # + # TESTS + # + def test_that_behaviors_tasks_should_list_behavioral_definitions_for_the_classes_under_test + run_behaviors_task + user_behaviors = [ + "User should:", + " - be able set user name and age during construction", + " - be able to get user name and age", + " - be able to ask if a user is an adult" + ] + assert_match(/#{user_behaviors.join("\n")}/, @report) + end + + def test_that_behaviors_tasks_should_list_behavioral_definitions_for_the_classes_under_test_in_html_output + run_behaviors_html_task + see_html_task_output_message + see_that_html_report_file_exits + user_behaviors = [ + "User should:", + "be able set user name and age during construction", + "be able to get user name and age", + "be able to ask if a user is an adult" + ] + html_report_file_should_contain user_behaviors + end + +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/behaviors/test/behaviors_test.rb b/flex-bison/mark1/tools/ceedling/vendor/behaviors/test/behaviors_test.rb new file mode 100644 index 0000000..fd0a77f --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/behaviors/test/behaviors_test.rb @@ -0,0 +1,50 @@ +require 'test/unit' +require File.expand_path(File.dirname(__FILE__)) + '/../lib/behaviors' +require 'stringio' + +loading_developer_test_class_stdout = StringIO.new +saved_stdout = $stdout.dup +$stdout = loading_developer_test_class_stdout + +class DeveloperTest + extend Behaviors + attr_accessor :flunk_msg, :tested_code + + should "test their code" do + @tested_code = true + end + should "go to meetings" +end + +$stdout = saved_stdout +loading_developer_test_class_stdout.rewind +$loading_developer_test_class_output = loading_developer_test_class_stdout.read + +class BehaviorsTest < Test::Unit::TestCase + + + def setup + @target = DeveloperTest.new + assert_nil @target.tested_code, "block called too early" + end + + # + # TESTS + # + def test_should_called_with_a_block_defines_a_test + assert @target.methods.include?("test_should_test their code"), "Missing test method" + + @target.send("test_should_test their code") + + assert @target.tested_code, "block not called" + end + + def test_should_called_without_a_block_does_not_create_a_test_method + assert !@target.methods.include?("test_should_go to meetings"), "Should not have method" + end + + def test_should_called_without_a_block_will_give_unimplemented_output_when_class_loads + unimplemented_output = "UNIMPLEMENTED CASE: Developer should go to meetings" + assert_match(/#{unimplemented_output}/, $loading_developer_test_class_output) + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/behaviors/test/tasks_test/Rakefile b/flex-bison/mark1/tools/ceedling/vendor/behaviors/test/tasks_test/Rakefile new file mode 100644 index 0000000..ba71f71 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/behaviors/test/tasks_test/Rakefile @@ -0,0 +1,19 @@ +require 'rake' +require 'rake/testtask' + +here = File.expand_path(File.dirname(__FILE__)) +require "#{here}/../../lib/behaviors/reporttask" + +desc 'Default: run unit tests.' +task :default => :test + +Rake::TestTask.new(:test) do |t| + t.libs << "#{here}/../../lib" + t.pattern = 'test/**/*_test.rb' + t.verbose = true +end + +Behaviors::ReportTask.new(:behaviors) do |t| + t.pattern = 'test/**/*_test.rb' + t.html_dir = 'behaviors_doc' +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/behaviors/test/tasks_test/lib/user.rb b/flex-bison/mark1/tools/ceedling/vendor/behaviors/test/tasks_test/lib/user.rb new file mode 100644 index 0000000..40bc07c --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/behaviors/test/tasks_test/lib/user.rb @@ -0,0 +1,2 @@ +class User +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/behaviors/test/tasks_test/test/user_test.rb b/flex-bison/mark1/tools/ceedling/vendor/behaviors/test/tasks_test/test/user_test.rb new file mode 100644 index 0000000..ad3cd1b --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/behaviors/test/tasks_test/test/user_test.rb @@ -0,0 +1,17 @@ +require 'test/unit' +require 'behaviors' + +require 'user' + +class UserTest < Test::Unit::TestCase + extend Behaviors + + def setup + end + + should "be able set user name and age during construction" + should "be able to get user name and age" + should "be able to ask if a user is an adult" + def test_DELETEME + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/docs/CExceptionSummary.odt b/flex-bison/mark1/tools/ceedling/vendor/c_exception/docs/CExceptionSummary.odt new file mode 100644 index 0000000..ea852a0 Binary files /dev/null and b/flex-bison/mark1/tools/ceedling/vendor/c_exception/docs/CExceptionSummary.odt differ diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/docs/CExceptionSummary.pdf b/flex-bison/mark1/tools/ceedling/vendor/c_exception/docs/CExceptionSummary.pdf new file mode 100644 index 0000000..a838337 Binary files /dev/null and b/flex-bison/mark1/tools/ceedling/vendor/c_exception/docs/CExceptionSummary.pdf differ diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/docs/license.txt b/flex-bison/mark1/tools/ceedling/vendor/c_exception/docs/license.txt new file mode 100644 index 0000000..561e5f2 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/docs/license.txt @@ -0,0 +1,30 @@ + Copyright (c) 2007 Mark VanderVoord + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + The end-user documentation included with the redistribution, if + any, must include the following acknowledgment: "This product + includes software developed for the CEXCeption Project, by Mark + VanderVoord and other contributors", in the same place and form + as other third-party acknowledgments. Alternately, this + acknowledgment may appear in the software itself, in the same + form and location as other such third-party acknowledgments. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/docs/readme.txt b/flex-bison/mark1/tools/ceedling/vendor/c_exception/docs/readme.txt new file mode 100644 index 0000000..92cac38 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/docs/readme.txt @@ -0,0 +1,236 @@ +==================================================================== +CException +==================================================================== + +CException is a basic exception framework for C, suitable for use in +embedded applications. It provides an exception framework similar in +use to C++, but with much less overhead. + +CException uses C standard library functions setjmp and longjmp to +operate. As long as the target system has these two functions defined, +this library should be useable with very little configuration. It +even supports environments where multiple program flows are in use, +such as real-time operating systems. + +There are about a gabillion exception frameworks using a similar +setjmp/longjmp method out there... and there will probably be more +in the future. Unfortunately, when we started our last embedded +project, all those that existed either (a) did not support multiple +tasks (therefore multiple stacks) or (b) were way more complex than +we really wanted. CException was born. + +Why use CException? + +0. It's ANSI C, and it beats passing error codes around. + +1. You want something simple... CException throws a single id. You can + define those ID's to be whatever you like. You might even choose which + type that number is for your project. But that's as far as it goes. + We weren't interested in passing objects or structs or strings... + just simple error codes. + +2. Performance... CException can be configured for single tasking or + multitasking. In single tasking, there is very little overhead past + the setjmp/longjmp calls (which are already fast). In multitasking, + your only additional overhead is the time it takes you to determine + a unique task id 0 - num_tasks. + +For the latest version, go to http://cexception.sourceforge.net + +-------------------------------------------------------------------- +CONTENTS OF THIS DOCUMENT +-------------------------------------------------------------------- + +Usage +Limitations +API +Configuration +Testing +License + +-------------------------------------------------------------------- +Usage +-------------------------------------------------------------------- + +Code that is to be protected are wrapped in Try { } Catch { } blocks. +The code directly following the Try call is "protected", meaning that +if any Throws occur, program control is directly transferred to the +start of the Catch block. + +A numerical exception ID is included with Throw, and is made accessible +from the Catch block. + +Throws can occur from within function calls (nested as deeply as you +like) or directly from within the function itself. + +-------------------------------------------------------------------- +Limitations +-------------------------------------------------------------------- + +This library was made to be as fast as possible, and provide basic +exception handling. It is not a full-blown exception library. Because +of this, there are a few limitations that should be observed in order +to successfully utilize this library: + +1. Do not directly "return" from within a Try block, nor "goto" + into or out of a Try block. + + Why? + + The "Try" macro allocates some local memory and alters a global + pointer. These are cleaned up at the top of the "Catch" macro. + Gotos and returns would bypass some of these steps, resulting in + memory leaks or unpredictable behavior. + +2. If (a) you change local (stack) variables within your Try block, + AND (b) wish to make use of the updated values after an exception + is thrown, those variables should be made volatile. Note that this + is ONLY for locals and ONLY when you need access to them after a + throw. + + Why? + + Compilers optimize. There is no way to guarantee that the actual + memory location was updated and not just a register unless the + variable is marked volatile. + +3. Memory which is malloc'd or new'd is not automatically released + when an error is thrown. This will sometimes be desirable, and + othertimes may not. It will be the responsibility of the Catch + block to perform this kind of cleanup. + + Why? + + There's just no easy way to track malloc'd memory, etc., without + replacing or wrapping malloc calls or something like that. This + is a light framework, so these options were not desirable. + +-------------------------------------------------------------------- +API +-------------------------------------------------------------------- + +Try +--- + +Try is a macro which starts a protected block. It MUST be followed by +a pair of braces or a single protected line (similar to an 'if'), +enclosing the data that is to be protected. It MUST be followed by a +Catch block (don't worry, you'll get compiler errors to let you know if +you mess any of that up). + +Catch(e) +-------- + +Catch is a macro which ends the Try block and starts the error handling +block. The catch block is called if and only if an exception was thrown +while within the Try block. This error was thrown by a Throw call +somewhere within Try (or within a function called within Try, or a function +called by a function called within Try, etc). + +The single parameter 'e' is filled with the error code which was thrown. +This can be used for reporting, conditional cleanup, etc. (or you can just +ignore it if you really want... people ignore return codes all the time, +right?). 'e' should be of type EXCEPTION_T; + +Throw(e) +-------- + +The method of throwing an error. Throws should only occur from within a +protected (Try...Catch) block, though it may easily be nested many function +calls deep without an impact on performance or functionality. Throw takes +a single argument, which is an exception id which will be passed to Catch +as the reason for the error. + +If you wish to Rethrow an error, this can be done by calling Throw(e) with +the error code you just caught. It IS valid to throw from a catch block. + +-------------------------------------------------------------------- +CONFIGURATION +-------------------------------------------------------------------- + +CException is a mostly portable library. It has one universal +dependency, and some macros which are required if working in a +multi-tasking environment. + +1. The standard C library setjmp must be available. Since this is part + of the standard library, chances are good that you'll be fine. + +2. If working in a multitasking environment, methods for obtaining an + index into an array of frames and to get the overall number of + id's are required. If the OS supports a method to retrieve Task + ID's, and those Tasks are number 0, 1, 2... you are in an ideal + situation. Otherwise, a more creative mapping function may be + required. Note that this function is likely to be called twice + for each protected block and once during a throw. This is the + only overhead in the system. + +Exception.h +----------------- +By convention, most projects include Exception.h which defines any +further requirements, then calls CException.h to do the gruntwork. All +of these are optional. You could directly include CException.h if +you wanted and just use the defaults provided. + +EXCEPTION_T - Set this to the type you want your exception id's + to be. Defaults to 'unsigned int'. + +EXCEPTION_NONE - Set this to a number which will never be an + exception id in your system. Defaults to 0x5a5a5a5a. + +EXCEPTION_GET_ID - If in a multi-tasking environment, this should be + set to be a call to the function described in #2 above. + Defaults to just return 0 all the time (good for + single tasking environments) + +EXCEPTION_NUM_ID - If in a multi-tasking environment, this should be set + to the number of ID's required (usually the number of + tasks in the system). Defaults to 1 (for single + tasking environments). + +You may also want to include any header files which will commonly be +needed by the rest of your application where it uses exception handling +here. For example, OS header files or exception codes would be useful. + +-------------------------------------------------------------------- +TESTING +-------------------------------------------------------------------- + +If you want to validate that CException works with your tools or that +it works with your custom configuration, you may want to run the test +suite. + +The test suite included makes use of the Unity Test Framework. It will +require a native C compiler. The example makefile uses MinGW's gcc. +Modify the makefile to include the proper paths to tools, then run 'make' +to compile and run the test application. + +C_COMPILER - The C compiler to use to perform the tests +C_LIBS - The path to the C libraries (including setjmp) +UNITY_DIR - The path to the Unity framework (required to run tests) + (get it at http://embunity.sourceforge.net) + +-------------------------------------------------------------------- +LICENSE +-------------------------------------------------------------------- + +This software is licensed under the MIT License + +Copyright (c) 2007 Mark VanderVoord + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/lib/CException.c b/flex-bison/mark1/tools/ceedling/vendor/c_exception/lib/CException.c new file mode 100644 index 0000000..57f5353 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/lib/CException.c @@ -0,0 +1,39 @@ +#include "CException.h" + +volatile CEXCEPTION_FRAME_T CExceptionFrames[CEXCEPTION_NUM_ID]; + +//------------------------------------------------------------------------------------------ +// Throw +//------------------------------------------------------------------------------------------ +void Throw(CEXCEPTION_T ExceptionID) +{ + unsigned int MY_ID = CEXCEPTION_GET_ID; + CExceptionFrames[MY_ID].Exception = ExceptionID; + longjmp(*CExceptionFrames[MY_ID].pFrame, 1); +} + +//------------------------------------------------------------------------------------------ +// Explaination of what it's all for: +//------------------------------------------------------------------------------------------ +/* +#define Try + { <- give us some local scope. most compilers are happy with this + jmp_buf *PrevFrame, NewFrame; <- prev frame points to the last try block's frame. new frame gets created on stack for this Try block + unsigned int MY_ID = CEXCEPTION_GET_ID; <- look up this task's id for use in frame array. always 0 if single-tasking + PrevFrame = CExceptionFrames[CEXCEPTION_GET_ID].pFrame; <- set pointer to point at old frame (which array is currently pointing at) + CExceptionFrames[MY_ID].pFrame = &NewFrame; <- set array to point at my new frame instead, now + CExceptionFrames[MY_ID].Exception = CEXCEPTION_NONE; <- initialize my exception id to be NONE + if (setjmp(NewFrame) == 0) { <- do setjmp. it returns 1 if longjump called, otherwise 0 + if (&PrevFrame) <- this is here to force proper scoping. it requires braces or a single line to be but after Try, otherwise won't compile. This is always true at this point. + +#define Catch(e) + else { } <- this also forces proper scoping. Without this they could stick their own 'else' in and it would get ugly + CExceptionFrames[MY_ID].Exception = CEXCEPTION_NONE; <- no errors happened, so just set the exception id to NONE (in case it was corrupted) + } + else <- an exception occurred + { e = CExceptionFrames[MY_ID].Exception; e=e;} <- assign the caught exception id to the variable passed in. + CExceptionFrames[MY_ID].pFrame = PrevFrame; <- make the pointer in the array point at the previous frame again, as if NewFrame never existed. + } <- finish off that local scope we created to have our own variables + if (CExceptionFrames[CEXCEPTION_GET_ID].Exception != CEXCEPTION_NONE) <- start the actual 'catch' processing if we have an exception id saved away + */ + diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/lib/CException.h b/flex-bison/mark1/tools/ceedling/vendor/c_exception/lib/CException.h new file mode 100644 index 0000000..40c6fc7 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/lib/CException.h @@ -0,0 +1,70 @@ +#ifndef _CEXCEPTION_H +#define _CEXCEPTION_H + +#include + +//To Use CException, you have a number of options: +//1. Just include it and run with the defaults +//2. Define any of the following symbols at the command line to override them +//3. Include a header file before CException.h everywhere which defines any of these +//4. Create an Exception.h in your path, and just define EXCEPTION_USE_CONFIG_FILE first + +#ifdef CEXCEPTION_USE_CONFIG_FILE +#include "CExceptionConfig.h" +#endif + +//This is the value to assign when there isn't an exception +#ifndef CEXCEPTION_NONE +#define CEXCEPTION_NONE (0x5A5A5A5A) +#endif + +//This is number of exception stacks to keep track of (one per task) +#ifndef CEXCEPTION_NUM_ID +#define CEXCEPTION_NUM_ID (1) //there is only the one stack by default +#endif + +//This is the method of getting the current exception stack index (0 if only one stack) +#ifndef CEXCEPTION_GET_ID +#define CEXCEPTION_GET_ID (0) //use the first index always because there is only one anyway +#endif + +//The type to use to store the exception values. +#ifndef CEXCEPTION_T +#define CEXCEPTION_T unsigned int +#endif + +//exception frame structures +typedef struct { + jmp_buf* pFrame; + volatile CEXCEPTION_T Exception; +} CEXCEPTION_FRAME_T; + +//actual root frame storage (only one if single-tasking) +extern volatile CEXCEPTION_FRAME_T CExceptionFrames[]; + +//Try (see C file for explanation) +#define Try \ + { \ + jmp_buf *PrevFrame, NewFrame; \ + unsigned int MY_ID = CEXCEPTION_GET_ID; \ + PrevFrame = CExceptionFrames[CEXCEPTION_GET_ID].pFrame; \ + CExceptionFrames[MY_ID].pFrame = (jmp_buf*)(&NewFrame); \ + CExceptionFrames[MY_ID].Exception = CEXCEPTION_NONE; \ + if (setjmp(NewFrame) == 0) { \ + if (&PrevFrame) + +//Catch (see C file for explanation) +#define Catch(e) \ + else { } \ + CExceptionFrames[MY_ID].Exception = CEXCEPTION_NONE; \ + } \ + else \ + { e = CExceptionFrames[MY_ID].Exception; e=e; } \ + CExceptionFrames[MY_ID].pFrame = PrevFrame; \ + } \ + if (CExceptionFrames[CEXCEPTION_GET_ID].Exception != CEXCEPTION_NONE) + +//Throw an Error +void Throw(CEXCEPTION_T ExceptionID); + +#endif // _CEXCEPTION_H diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/makefile b/flex-bison/mark1/tools/ceedling/vendor/c_exception/makefile new file mode 100644 index 0000000..c168a41 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/makefile @@ -0,0 +1,24 @@ +#Tool and Lib Locations +C_COMPILER=gcc +C_LIBS=C:/MinGW/lib +UNITY_DIR=vendor/unity/src + +#Test File To Be Created +OUT_FILE=test_cexceptions +ifeq ($(OS),Windows_NT) +OUT_EXTENSION=.exe +else +OUT_EXTENSION=.out +endif + +#Options +SRC_FILES=lib/CException.c test/TestException.c test/TestException_Runner.c $(UNITY_DIR)/unity.c +INC_DIRS=-Ilib -Itest -I$(UNITY_DIR) +LIB_DIRS=-L$(C_LIBS) +SYMBOLS=-DTEST -DEXCEPTION_USE_CONFIG_FILE + +#Default Task: Compile And Run Tests +default: + $(C_COMPILER) $(INC_DIRS) $(LIB_DIRS) $(SYMBOLS) $(SRC_FILES) -o $(OUT_FILE)$(OUT_EXTENSION) + $(OUT_FILE)$(OUT_EXTENSION) + \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/rakefile.rb b/flex-bison/mark1/tools/ceedling/vendor/c_exception/rakefile.rb new file mode 100644 index 0000000..2458c6f --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/rakefile.rb @@ -0,0 +1,41 @@ +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require HERE+'vendor/unity/auto/colour_reporter.rb' + +#Tool and Lib Locations +C_COMPILER = 'gcc' +C_LIBS = '' +UNITY_DIR = 'vendor/unity/src' + +#Test File To Be Created +OUT_FILE = 'test_cexceptions' +OUT_EXTENSION = '.out' + +#Options +SRC_FILES = "lib/CException.c test/TestException.c test/TestException_Runner.c #{UNITY_DIR}/unity.c" +INC_DIRS = "-Ilib -Itest -I#{UNITY_DIR}" +LIB_DIRS = C_LIBS.empty? ? '' : "-L#{C_LIBS}" +SYMBOLS = '-DTEST -DEXCEPTION_USE_CONFIG_FILE' + +CLEAN.include("#{HERE}*.out") + +task :default => [:clobber, :test] +task :cruise => [:no_color, :default] + +desc "performs a quick set of unit tests to confirm you're ready to go" +task :test do + report "#{C_COMPILER} #{INC_DIRS} #{LIB_DIRS} #{SYMBOLS} #{SRC_FILES} -o #{OUT_FILE}#{OUT_EXTENSION}" + output = `#{C_COMPILER} #{INC_DIRS} #{LIB_DIRS} #{SYMBOLS} #{SRC_FILES} -o #{OUT_FILE}#{OUT_EXTENSION}` + report output + + report "#{HERE}#{OUT_FILE}#{OUT_EXTENSION}" + output = `#{HERE}#{OUT_FILE}#{OUT_EXTENSION}` + report output +end + +task :no_color do + $colour_output = false +end \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/release/build.info b/flex-bison/mark1/tools/ceedling/vendor/c_exception/release/build.info new file mode 100644 index 0000000..b5794c5 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/release/build.info @@ -0,0 +1,2 @@ +16 + diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/release/version.info b/flex-bison/mark1/tools/ceedling/vendor/c_exception/release/version.info new file mode 100644 index 0000000..cb7e5f6 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/release/version.info @@ -0,0 +1,2 @@ +1.2.0 + diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/test/CExceptionConfig.h b/flex-bison/mark1/tools/ceedling/vendor/c_exception/test/CExceptionConfig.h new file mode 100644 index 0000000..79b085d --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/test/CExceptionConfig.h @@ -0,0 +1,27 @@ +#ifndef _EXCEPTION_H +#define _EXCEPTION_H + +//Optionally define the exception type (something like an int which can be directly assigned) +#define CEXCEPTION_T int + +// Optionally define the reserved value representing NO EXCEPTION +#define CEXCEPTION_NONE (1234) + +// Multi-Tasking environments will need a couple of macros defined to make this library +// properly handle multiple exception stacks. You will need to include and required +// definitions, then define the following macros: +// EXCEPTION_GET_ID - returns the id of the current task indexed 0 to (numtasks - 1) +// EXCEPTION_NUM_ID - returns the number of tasks that might be returned +// +// For example, Quadros might include the following implementation: +#ifndef TEST +#include "OSAPI.h" +#define CEXCEPTION_GET_ID (KS_GetTaskID()) +#define CEXCEPTION_NUM_ID (NTASKS + 1) +#endif + +//This could be a good place to define/include some error ID's: +#define ERROR_ID_EVERYTHING_IS_BROKEN (0x88) +#define ERROR_ID_ONLY_THIS_IS_BROKEN (0x77) + +#endif // _EXCEPTION_H diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/test/TestException.c b/flex-bison/mark1/tools/ceedling/vendor/c_exception/test/TestException.c new file mode 100644 index 0000000..704cfdb --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/test/TestException.c @@ -0,0 +1,291 @@ +#include "unity.h" +#include "CException.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void test_BasicTryDoesNothingIfNoThrow(void) +{ + int i; + CEXCEPTION_T e = 0x5a; + + Try + { + i += 1; + } + Catch(e) + { + TEST_FAIL_MESSAGE("Should Not Enter Catch If Not Thrown") + } + + //verify that e was untouched + TEST_ASSERT_EQUAL(0x5a, e); +} + +void test_BasicThrowAndCatch(void) +{ + CEXCEPTION_T e; + + Try + { + Throw(0xBE); + TEST_FAIL_MESSAGE("Should Have Thrown An Error") + } + Catch(e) + { + //verify that e has the right data + TEST_ASSERT_EQUAL(0xBE, e); + } + + //verify that e STILL has the right data + TEST_ASSERT_EQUAL(0xBE, e); +} + +void test_BasicThrowAndCatch_WithMiniSyntax(void) +{ + CEXCEPTION_T e; + + //Mini Throw and Catch + Try + Throw(0xEF); + Catch(e) + TEST_ASSERT_EQUAL(0xEF, e); + TEST_ASSERT_EQUAL(0xEF, e); + + //Mini Passthrough + Try + e = 0; + Catch(e) + TEST_FAIL_MESSAGE("I shouldn't be caught because there was no throw"); + + TEST_ASSERT_EQUAL(0, e); +} + +void test_VerifyVolatilesSurviveThrowAndCatch(void) +{ + volatile unsigned int VolVal = 0; + CEXCEPTION_T e; + + Try + { + VolVal = 2; + Throw(0xBF); + TEST_FAIL_MESSAGE("Should Have Thrown An Error") + } + Catch(e) + { + VolVal += 2; + TEST_ASSERT_EQUAL(0xBF, e); + } + + TEST_ASSERT_EQUAL(4, VolVal); + TEST_ASSERT_EQUAL(0xBF, e); +} + +void HappyExceptionThrower(unsigned int ID) +{ + if (ID != 0) + { + Throw(ID); + } +} + +void test_ThrowFromASubFunctionAndCatchInRootFunc(void) +{ + volatile unsigned int ID = 0; + CEXCEPTION_T e; + + Try + { + + HappyExceptionThrower(0xBA); + TEST_FAIL_MESSAGE("Should Have Thrown An Exception"); + } + Catch(e) + { + ID = e; + } + + //verify that I can pass that value to something else + TEST_ASSERT_EQUAL(0xBA, e); +} + +void HappyExceptionRethrower(unsigned int ID) +{ + CEXCEPTION_T e; + + Try + { + Throw(ID); + } + Catch(e) + { + switch (e) + { + case 0xBD: + Throw(0xBF); + break; + default: + break; + } + } +} + +void test_ThrowAndCatchFromASubFunctionAndRethrowToCatchInRootFunc(void) +{ + volatile unsigned int ID = 0; + CEXCEPTION_T e; + + Try + { + HappyExceptionRethrower(0xBD); + TEST_FAIL_MESSAGE("Should Have Rethrown Exception"); + } + Catch(e) + { + ID = 1; + } + + TEST_ASSERT_EQUAL(0xBF, e); + TEST_ASSERT_EQUAL(1, ID); +} + +void test_ThrowAndCatchFromASubFunctionAndNoRethrowToCatchInRootFunc(void) +{ + CEXCEPTION_T e = 3; + + Try + { + HappyExceptionRethrower(0xBF); + } + Catch(e) + { + TEST_FAIL_MESSAGE("Should Not Have Re-thrown Error (it should have already been caught)"); + } + + //verify that THIS e is still untouched, even though subfunction was touched + TEST_ASSERT_EQUAL(3, e); +} + +void test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThisDoesntCorruptExceptionId(void) +{ + CEXCEPTION_T e; + + Try + { + HappyExceptionThrower(0xBF); + TEST_FAIL_MESSAGE("Should Have Thrown Exception"); + } + Catch(e) + { + TEST_ASSERT_EQUAL(0xBF, e); + HappyExceptionRethrower(0x12); + TEST_ASSERT_EQUAL(0xBF, e); + } + TEST_ASSERT_EQUAL(0xBF, e); +} + +void test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThatEachExceptionIdIndependent(void) +{ + CEXCEPTION_T e1, e2; + + Try + { + HappyExceptionThrower(0xBF); + TEST_FAIL_MESSAGE("Should Have Thrown Exception"); + } + Catch(e1) + { + TEST_ASSERT_EQUAL(0xBF, e1); + Try + { + HappyExceptionThrower(0x12); + } + Catch(e2) + { + TEST_ASSERT_EQUAL(0x12, e2); + } + TEST_ASSERT_EQUAL(0x12, e2); + TEST_ASSERT_EQUAL(0xBF, e1); + } + TEST_ASSERT_EQUAL(0x12, e2); + TEST_ASSERT_EQUAL(0xBF, e1); +} + +void test_CanHaveMultipleTryBlocksInASingleFunction(void) +{ + CEXCEPTION_T e; + + Try + { + HappyExceptionThrower(0x01); + TEST_FAIL_MESSAGE("Should Have Thrown Exception"); + } + Catch(e) + { + TEST_ASSERT_EQUAL(0x01, e); + } + + Try + { + HappyExceptionThrower(0xF0); + TEST_FAIL_MESSAGE("Should Have Thrown Exception"); + } + Catch(e) + { + TEST_ASSERT_EQUAL(0xF0, e); + } +} + +void test_CanHaveNestedTryBlocksInASingleFunction_ThrowInside(void) +{ + int i = 0; + CEXCEPTION_T e; + + Try + { + Try + { + HappyExceptionThrower(0x01); + i = 1; + TEST_FAIL_MESSAGE("Should Have Rethrown Exception"); + } + Catch(e) + { + TEST_ASSERT_EQUAL(0x01, e); + } + } + Catch(e) + { + TEST_FAIL_MESSAGE("Should Have Been Caught By Inside Catch"); + } +} + +void test_CanHaveNestedTryBlocksInASingleFunction_ThrowOutside(void) +{ + int i = 0; + CEXCEPTION_T e; + + Try + { + Try + { + i = 2; + } + Catch(e) + { + TEST_FAIL_MESSAGE("Should NotBe Caught Here"); + } + HappyExceptionThrower(0x01); + TEST_FAIL_MESSAGE("Should Have Rethrown Exception"); + } + Catch(e) + { + TEST_ASSERT_EQUAL(0x01, e); + } +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/test/TestException_Runner.c b/flex-bison/mark1/tools/ceedling/vendor/c_exception/test/TestException_Runner.c new file mode 100644 index 0000000..1697a0e --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/test/TestException_Runner.c @@ -0,0 +1,62 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ +#include "unity.h" +#include "CException.h" + +extern void setUp(void); +extern void tearDown(void); + +extern void test_BasicTryDoesNothingIfNoThrow(void); +extern void test_BasicThrowAndCatch(void); +extern void test_BasicThrowAndCatch_WithMiniSyntax(void); +extern void test_VerifyVolatilesSurviveThrowAndCatch(void); +extern void test_ThrowFromASubFunctionAndCatchInRootFunc(void); +extern void test_ThrowAndCatchFromASubFunctionAndRethrowToCatchInRootFunc(void); +extern void test_ThrowAndCatchFromASubFunctionAndNoRethrowToCatchInRootFunc(void); +extern void test_CanHaveMultipleTryBlocksInASingleFunction(void); +extern void test_CanHaveNestedTryBlocksInASingleFunction_ThrowInside(void); +extern void test_CanHaveNestedTryBlocksInASingleFunction_ThrowOutside(void); +extern void test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThisDoesntCorruptExceptionId(void); +extern void test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThatEachExceptionIdIndependent(void); + +static void runTest(UnityTestFunction test) +{ + CEXCEPTION_T e; + if (TEST_PROTECT()) + { + setUp(); + Try + { + test(); + } + Catch(e) + { + TEST_FAIL_MESSAGE("Unexpected exception!") + } + } + tearDown(); +} + + +int main(void) +{ + Unity.TestFile = __FILE__; + UnityBegin(); + + // RUN_TEST calls runTest + RUN_TEST(test_BasicTryDoesNothingIfNoThrow, 12); + RUN_TEST(test_BasicThrowAndCatch, 30); + RUN_TEST(test_BasicThrowAndCatch_WithMiniSyntax, 49); + RUN_TEST(test_VerifyVolatilesSurviveThrowAndCatch, 69); + RUN_TEST(test_ThrowFromASubFunctionAndCatchInRootFunc, 98); + RUN_TEST(test_ThrowAndCatchFromASubFunctionAndRethrowToCatchInRootFunc, 139); + RUN_TEST(test_ThrowAndCatchFromASubFunctionAndNoRethrowToCatchInRootFunc, 158); + RUN_TEST(test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThisDoesntCorruptExceptionId, 175); + RUN_TEST(test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThatEachExceptionIdIndependent, 193); + RUN_TEST(test_CanHaveMultipleTryBlocksInASingleFunction, 220); + RUN_TEST(test_CanHaveNestedTryBlocksInASingleFunction_ThrowInside, 245); + RUN_TEST(test_CanHaveNestedTryBlocksInASingleFunction_ThrowOutside, 269); + + UnityEnd(); + + return 0; +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/auto/colour_prompt.rb b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/auto/colour_prompt.rb new file mode 100644 index 0000000..81003dd --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/auto/colour_prompt.rb @@ -0,0 +1,94 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +if RUBY_PLATFORM =~/(win|w)32$/ + begin + require 'Win32API' + rescue LoadError + puts "ERROR! \"Win32API\" library not found" + puts "\"Win32API\" is required for colour on a windows machine" + puts " try => \"gem install Win32API\" on the command line" + puts + end + # puts + # puts 'Windows Environment Detected...' + # puts 'Win32API Library Found.' + # puts +end + +class ColourCommandLine + def initialize + if RUBY_PLATFORM =~/(win|w)32$/ + get_std_handle = Win32API.new("kernel32", "GetStdHandle", ['L'], 'L') + @set_console_txt_attrb = + Win32API.new("kernel32","SetConsoleTextAttribute",['L','N'], 'I') + @hout = get_std_handle.call(-11) + end + end + + def change_to(new_colour) + if RUBY_PLATFORM =~/(win|w)32$/ + @set_console_txt_attrb.call(@hout,self.win32_colour(new_colour)) + else + "\033[30;#{posix_colour(new_colour)};22m" + end + end + + def win32_colour(colour) + case colour + when :black then 0 + when :dark_blue then 1 + when :dark_green then 2 + when :dark_cyan then 3 + when :dark_red then 4 + when :dark_purple then 5 + when :dark_yellow, :narrative then 6 + when :default_white, :default, :dark_white then 7 + when :silver then 8 + when :blue then 9 + when :green, :success then 10 + when :cyan, :output then 11 + when :red, :failure then 12 + when :purple then 13 + when :yellow then 14 + when :white then 15 + else + 0 + end + end + + def posix_colour(colour) + case colour + when :black then 30 + when :red, :failure then 31 + when :green, :success then 32 + when :yellow then 33 + when :blue, :narrative then 34 + when :purple, :magenta then 35 + when :cyan, :output then 36 + when :white, :default_white, :default then 37 + else + 30 + end + end + + def out_c(mode, colour, str) + case RUBY_PLATFORM + when /(win|w)32$/ + change_to(colour) + $stdout.puts str if mode == :puts + $stdout.print str if mode == :print + change_to(:default_white) + else + $stdout.puts("#{change_to(colour)}#{str}\033[0m") if mode == :puts + $stdout.print("#{change_to(colour)}#{str}\033[0m") if mode == :print + end + end +end # ColourCommandLine + +def colour_puts(role,str) ColourCommandLine.new.out_c(:puts, role, str) end +def colour_print(role,str) ColourCommandLine.new.out_c(:print, role, str) end + diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/auto/colour_reporter.rb b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/auto/colour_reporter.rb new file mode 100644 index 0000000..5aa1d27 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/auto/colour_reporter.rb @@ -0,0 +1,39 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require "#{File.expand_path(File.dirname(__FILE__))}/colour_prompt" + +$colour_output = true + +def report(message) + if not $colour_output + $stdout.puts(message) + else + message = message.join('\n') if (message.class == Array) + message.each_line do |line| + line.chomp! + colour = case(line) + when /(?:total\s+)?tests:?\s+(\d+)\s+(?:total\s+)?failures:?\s+\d+\s+Ignored:?/i + ($1.to_i == 0) ? :green : :red + when /PASS/ + :green + when /^OK$/ + :green + when /(?:FAIL|ERROR)/ + :red + when /IGNORE/ + :yellow + when /^(?:Creating|Compiling|Linking)/ + :white + else + :silver + end + colour_puts(colour, line) + end + end + $stdout.flush + $stderr.flush +end \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/auto/generate_config.yml b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/auto/generate_config.yml new file mode 100644 index 0000000..4a5e474 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/auto/generate_config.yml @@ -0,0 +1,36 @@ +#this is a sample configuration file for generate_module +#you would use it by calling generate_module with the -ygenerate_config.yml option +#files like this are useful for customizing generate_module to your environment +:generate_module: + :defaults: + #these defaults are used in place of any missing options at the command line + :path_src: ../src/ + :path_inc: ../src/ + :path_tst: ../test/ + :update_svn: true + :includes: + #use [] for no additional includes, otherwise list the includes on separate lines + :src: + - Defs.h + - Board.h + :inc: [] + :tst: + - Defs.h + - Board.h + - Exception.h + :boilerplates: + #these are inserted at the top of generated files. + #just comment out or remove if not desired. + #use %1$s where you would like the file name to appear (path/extension not included) + :src: | + //------------------------------------------- + // %1$s.c + //------------------------------------------- + :inc: | + //------------------------------------------- + // %1$s.h + //------------------------------------------- + :tst: | + //------------------------------------------- + // Test%1$s.c : Units tests for %1$s.c + //------------------------------------------- diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/auto/generate_module.rb b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/auto/generate_module.rb new file mode 100644 index 0000000..3db1a98 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/auto/generate_module.rb @@ -0,0 +1,202 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +# This script creates all the files with start code necessary for a new module. +# A simple module only requires a source file, header file, and test file. +# Triad modules require a source, header, and test file for each triad type (like model, conductor, and hardware). + +require 'rubygems' +require 'fileutils' + +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +#help text when requested +HELP_TEXT = [ "\nGENERATE MODULE\n-------- ------", + "\nUsage: ruby generate_module [options] module_name", + " -i\"include\" sets the path to output headers to 'include' (DEFAULT ../src)", + " -s\"../src\" sets the path to output source to '../src' (DEFAULT ../src)", + " -t\"C:/test\" sets the path to output source to 'C:/test' (DEFAULT ../test)", + " -p\"MCH\" sets the output pattern to MCH.", + " dh - driver hardware.", + " dih - driver interrupt hardware.", + " mch - model conductor hardware.", + " mvp - model view presenter.", + " src - just a single source module. (DEFAULT)", + " -d destroy module instead of creating it.", + " -u update subversion too (requires subversion command line)", + " -y\"my.yml\" selects a different yaml config file for module generation", + "" ].join("\n") + +#Built in patterns +PATTERNS = { 'src' => {'' => { :inc => [] } }, + 'dh' => {'Driver' => { :inc => ['%1$sHardware.h'] }, + 'Hardware' => { :inc => [] } + }, + 'dih' => {'Driver' => { :inc => ['%1$sHardware.h', '%1$sInterrupt.h'] }, + 'Interrupt'=> { :inc => ['%1$sHardware.h'] }, + 'Hardware' => { :inc => [] } + }, + 'mch' => {'Model' => { :inc => [] }, + 'Conductor'=> { :inc => ['%1$sModel.h', '%1$sHardware.h'] }, + 'Hardware' => { :inc => [] } + }, + 'mvp' => {'Model' => { :inc => [] }, + 'Presenter'=> { :inc => ['%1$sModel.h', '%1$sView.h'] }, + 'View' => { :inc => [] } + } + } + +#TEMPLATE_TST +TEMPLATE_TST = %q[#include "unity.h" +%2$s#include "%1$s.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void test_%1$s_NeedToImplement(void) +{ + TEST_IGNORE(); +} +] + +#TEMPLATE_SRC +TEMPLATE_SRC = %q[%2$s#include "%1$s.h" +] + +#TEMPLATE_INC +TEMPLATE_INC = %q[#ifndef _%3$s_H +#define _%3$s_H%2$s + +#endif // _%3$s_H +] + +# Parse the command line parameters. +ARGV.each do |arg| + case(arg) + when /^-d/ then @destroy = true + when /^-u/ then @update_svn = true + when /^-p(\w+)/ then @pattern = $1 + when /^-s(.+)/ then @path_src = $1 + when /^-i(.+)/ then @path_inc = $1 + when /^-t(.+)/ then @path_tst = $1 + when /^-y(.+)/ then @yaml_config = $1 + when /^(\w+)/ + raise "ERROR: You can't have more than one Module name specified!" unless @module_name.nil? + @module_name = arg + when /^-(h|-help)/ + puts HELP_TEXT + exit + else + raise "ERROR: Unknown option specified '#{arg}'" + end +end +raise "ERROR: You must have a Module name specified! (use option -h for help)" if @module_name.nil? + +#load yaml file if one was requested +if @yaml_config + require 'yaml' + cfg = YAML.load_file(HERE + @yaml_config)[:generate_module] + @path_src = cfg[:defaults][:path_src] if @path_src.nil? + @path_inc = cfg[:defaults][:path_inc] if @path_inc.nil? + @path_tst = cfg[:defaults][:path_tst] if @path_tst.nil? + @update_svn = cfg[:defaults][:update_svn] if @update_svn.nil? + @extra_inc = cfg[:includes] + @boilerplates = cfg[:boilerplates] +else + @boilerplates = {} +end + +# Create default file paths if none were provided +@path_src = HERE + "../src/" if @path_src.nil? +@path_inc = @path_src if @path_inc.nil? +@path_tst = HERE + "../test/" if @path_tst.nil? +@path_src += '/' unless (@path_src[-1] == 47) +@path_inc += '/' unless (@path_inc[-1] == 47) +@path_tst += '/' unless (@path_tst[-1] == 47) +@pattern = 'src' if @pattern.nil? +@includes = { :src => [], :inc => [], :tst => [] } +@includes.merge!(@extra_inc) unless @extra_inc.nil? + +#create triad definition +TRIAD = [ { :ext => '.c', :path => @path_src, :template => TEMPLATE_SRC, :inc => :src, :boilerplate => @boilerplates[:src] }, + { :ext => '.h', :path => @path_inc, :template => TEMPLATE_INC, :inc => :inc, :boilerplate => @boilerplates[:inc] }, + { :ext => '.c', :path => @path_tst+'Test', :template => TEMPLATE_TST, :inc => :tst, :boilerplate => @boilerplates[:tst] }, + ] + +#prepare the pattern for use +@patterns = PATTERNS[@pattern.downcase] +raise "ERROR: The design pattern specified isn't one that I recognize!" if @patterns.nil? + +# Assemble the path/names of the files we need to work with. +files = [] +TRIAD.each do |triad| + @patterns.each_pair do |pattern_file, pattern_traits| + files << { + :path => "#{triad[:path]}#{@module_name}#{pattern_file}#{triad[:ext]}", + :name => "#{@module_name}#{pattern_file}", + :template => triad[:template], + :boilerplate => triad[:boilerplate], + :includes => case(triad[:inc]) + when :src then @includes[:src] | pattern_traits[:inc].map{|f| f % [@module_name]} + when :inc then @includes[:inc] + when :tst then @includes[:tst] | pattern_traits[:inc].map{|f| "Mock#{f}"% [@module_name]} + end + } + end +end + +# destroy files if that was what was requested +if @destroy + files.each do |filespec| + file = filespec[:path] + if File.exist?(file) + if @update_svn + `svn delete \"#{file}\" --force` + puts "File #{file} deleted and removed from source control" + else + FileUtils.remove(file) + puts "File #{file} deleted" + end + else + puts "File #{file} does not exist so cannot be removed." + end + end + puts "Destroy Complete" + exit +end + +#Abort if any module already exists +files.each do |file| + raise "ERROR: File #{file[:name]} already exists. Exiting." if File.exist?(file[:path]) +end + +# Create Source Modules +files.each_with_index do |file, i| + File.open(file[:path], 'w') do |f| + f.write(file[:boilerplate] % [file[:name]]) unless file[:boilerplate].nil? + f.write(file[:template] % [ file[:name], + file[:includes].map{|f| "#include \"#{f}\"\n"}.join, + file[:name].upcase ] + ) + end + if (@update_svn) + `svn add \"#{file[:path]}\"` + if $?.exitstatus == 0 + puts "File #{file[:path]} created and added to source control" + else + puts "File #{file[:path]} created but FAILED adding to source control!" + end + else + puts "File #{file[:path]} created" + end +end + +puts 'Generate Complete' diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb new file mode 100644 index 0000000..aff5053 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb @@ -0,0 +1,303 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +File.expand_path(File.join(File.dirname(__FILE__),'colour_prompt')) + +class UnityTestRunnerGenerator + + def initialize(options = nil) + @options = { :includes => [], :plugins => [], :framework => :unity } + case(options) + when NilClass then @options + when String then @options.merge!(UnityTestRunnerGenerator.grab_config(options)) + when Hash then @options.merge!(options) + else raise "If you specify arguments, it should be a filename or a hash of options" + end + end + + def self.grab_config(config_file) + options = { :includes => [], :plugins => [], :framework => :unity } + unless (config_file.nil? or config_file.empty?) + require 'yaml' + yaml_guts = YAML.load_file(config_file) + options.merge!(yaml_guts[:unity] ? yaml_guts[:unity] : yaml_guts[:cmock]) + raise "No :unity or :cmock section found in #{config_file}" unless options + end + return(options) + end + + def run(input_file, output_file, options=nil) + tests = [] + includes = [] + used_mocks = [] + + @options.merge!(options) unless options.nil? + module_name = File.basename(input_file) + + #pull required data from source file + File.open(input_file, 'r') do |input| + tests = find_tests(input) + includes = find_includes(input) + used_mocks = find_mocks(includes) + end + + #build runner file + File.open(output_file, 'w') do |output| + create_header(output, used_mocks) + create_externs(output, tests, used_mocks) + create_mock_management(output, used_mocks) + create_suite_setup_and_teardown(output) + create_reset(output, used_mocks) + create_main(output, input_file, tests) + end + + all_files_used = [input_file, output_file] + all_files_used += includes.map {|filename| filename + '.c'} unless includes.empty? + all_files_used += @options[:includes] unless @options[:includes].empty? + return all_files_used.uniq + end + + def find_tests(input_file) + tests_raw = [] + tests_args = [] + tests_and_line_numbers = [] + + input_file.rewind + source_raw = input_file.read + source_scrubbed = source_raw.gsub(/\/\/.*$/, '') # remove line comments + source_scrubbed = source_scrubbed.gsub(/\/\*.*?\*\//m, '') # remove block comments + lines = source_scrubbed.split(/(^\s*\#.*$) # Treat preprocessor directives as a logical line + | (;|\{|\}) /x) # Match ;, {, and } as end of lines + + lines.each_with_index do |line, index| + #find tests + if line =~ /^((?:\s*TEST_CASE\s*\(.*?\)\s*)*)\s*void\s+(test.*?)\s*\(\s*(.*)\s*\)/ + arguments = $1 + name = $2 + call = $3 + args = nil + if (@options[:use_param_tests] and !arguments.empty?) + args = [] + arguments.scan(/\s*TEST_CASE\s*\((.*)\)\s*$/) {|a| args << a[0]} + end + tests_and_line_numbers << { :name => name, :args => args, :call => call, :line_number => 0 } + tests_args = [] + end + end + + #determine line numbers and create tests to run + source_lines = source_raw.split("\n") + source_index = 0; + tests_and_line_numbers.size.times do |i| + source_lines[source_index..-1].each_with_index do |line, index| + if (line =~ /#{tests_and_line_numbers[i][:name]}/) + source_index += index + tests_and_line_numbers[i][:line_number] = source_index + 1 + break + end + end + end + + return tests_and_line_numbers + end + + def find_includes(input_file) + input_file.rewind + includes = [] + input_file.readlines.each do |line| + scan_results = line.scan(/^\s*#include\s+\"\s*(.+)\.[hH]\s*\"/) + includes << scan_results[0][0] if (scan_results.size > 0) + end + return includes + end + + def find_mocks(includes) + mock_headers = [] + includes.each do |include_file| + mock_headers << File.basename(include_file) if (include_file =~ /^mock/i) + end + return mock_headers + end + + def create_header(output, mocks) + output.puts('/* AUTOGENERATED FILE. DO NOT EDIT. */') + create_runtest(output, mocks) + output.puts("\n//=======Automagically Detected Files To Include=====") + output.puts("#include \"#{@options[:framework].to_s}.h\"") + output.puts('#include "cmock.h"') unless (mocks.empty?) + @options[:includes].flatten.uniq.compact.each do |inc| + output.puts("#include #{inc.include?('<') ? inc : "\"#{inc.gsub('.h','')}.h\""}") + end + output.puts('#include ') + output.puts('#include ') + output.puts('#include "CException.h"') if @options[:plugins].include?(:cexception) + mocks.each do |mock| + output.puts("#include \"#{mock.gsub('.h','')}.h\"") + end + if @options[:enforce_strict_ordering] + output.puts('') + output.puts('int GlobalExpectCount;') + output.puts('int GlobalVerifyOrder;') + output.puts('char* GlobalOrderError;') + end + end + + def create_externs(output, tests, mocks) + output.puts("\n//=======External Functions This Runner Calls=====") + output.puts("extern void setUp(void);") + output.puts("extern void tearDown(void);") + tests.each do |test| + output.puts("extern void #{test[:name]}(#{test[:call]});") + end + output.puts('') + end + + def create_mock_management(output, mocks) + unless (mocks.empty?) + output.puts("\n//=======Mock Management=====") + output.puts("static void CMock_Init(void)") + output.puts("{") + if @options[:enforce_strict_ordering] + output.puts(" GlobalExpectCount = 0;") + output.puts(" GlobalVerifyOrder = 0;") + output.puts(" GlobalOrderError = NULL;") + end + mocks.each do |mock| + output.puts(" #{mock}_Init();") + end + output.puts("}\n") + + output.puts("static void CMock_Verify(void)") + output.puts("{") + mocks.each do |mock| + output.puts(" #{mock}_Verify();") + end + output.puts("}\n") + + output.puts("static void CMock_Destroy(void)") + output.puts("{") + mocks.each do |mock| + output.puts(" #{mock}_Destroy();") + end + output.puts("}\n") + end + end + + def create_suite_setup_and_teardown(output) + unless (@options[:suite_setup].nil?) + output.puts("\n//=======Suite Setup=====") + output.puts("static int suite_setup(void)") + output.puts("{") + output.puts(@options[:suite_setup]) + output.puts("}") + end + unless (@options[:suite_teardown].nil?) + output.puts("\n//=======Suite Teardown=====") + output.puts("static int suite_teardown(int num_failures)") + output.puts("{") + output.puts(@options[:suite_teardown]) + output.puts("}") + end + end + + def create_runtest(output, used_mocks) + cexception = @options[:plugins].include? :cexception + va_args1 = @options[:use_param_tests] ? ', ...' : '' + va_args2 = @options[:use_param_tests] ? '__VA_ARGS__' : '' + output.puts("\n//=======Test Runner Used To Run Each Test Below=====") + output.puts("#define RUN_TEST_NO_ARGS") if @options[:use_param_tests] + output.puts("#define RUN_TEST(TestFunc, TestLineNum#{va_args1}) \\") + output.puts("{ \\") + output.puts(" Unity.CurrentTestName = #TestFunc#{va_args2.empty? ? '' : " \"(\" ##{va_args2} \")\""}; \\") + output.puts(" Unity.CurrentTestLineNumber = TestLineNum; \\") + output.puts(" Unity.NumberOfTests++; \\") + output.puts(" if (TEST_PROTECT()) \\") + output.puts(" { \\") + output.puts(" CEXCEPTION_T e; \\") if cexception + output.puts(" Try { \\") if cexception + output.puts(" CMock_Init(); \\") unless (used_mocks.empty?) + output.puts(" setUp(); \\") + output.puts(" TestFunc(#{va_args2}); \\") + output.puts(" CMock_Verify(); \\") unless (used_mocks.empty?) + output.puts(" } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, \"Unhandled Exception!\"); } \\") if cexception + output.puts(" } \\") + output.puts(" CMock_Destroy(); \\") unless (used_mocks.empty?) + output.puts(" if (TEST_PROTECT() && !TEST_IS_IGNORED) \\") + output.puts(" { \\") + output.puts(" tearDown(); \\") + output.puts(" } \\") + output.puts(" UnityConcludeTest(); \\") + output.puts("}\n") + end + + def create_reset(output, used_mocks) + output.puts("\n//=======Test Reset Option=====") + output.puts("void resetTest()") + output.puts("{") + output.puts(" CMock_Verify();") unless (used_mocks.empty?) + output.puts(" CMock_Destroy();") unless (used_mocks.empty?) + output.puts(" tearDown();") + output.puts(" CMock_Init();") unless (used_mocks.empty?) + output.puts(" setUp();") + output.puts("}") + end + + def create_main(output, filename, tests) + output.puts("\n\n//=======MAIN=====") + output.puts("int main(void)") + output.puts("{") + output.puts(" suite_setup();") unless @options[:suite_setup].nil? + output.puts(" Unity.TestFile = \"#{filename}\";") + output.puts(" UnityBegin();") + if (@options[:use_param_tests]) + tests.each do |test| + if ((test[:args].nil?) or (test[:args].empty?)) + output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]}, RUN_TEST_NO_ARGS);") + else + test[:args].each {|args| output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]}, #{args});")} + end + end + else + tests.each { |test| output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]});") } + end + output.puts() + output.puts(" return #{@options[:suite_teardown].nil? ? "" : "suite_teardown"}(UnityEnd());") + output.puts("}") + end +end + + +if ($0 == __FILE__) + options = { :includes => [] } + yaml_file = nil + + #parse out all the options first + ARGV.reject! do |arg| + case(arg) + when '-cexception' + options[:plugins] = [:cexception]; true + when /\.*\.yml/ + options = UnityTestRunnerGenerator.grab_config(arg); true + else false + end + end + + #make sure there is at least one parameter left (the input file) + if !ARGV[0] + puts ["usage: ruby #{__FILE__} (yaml) (options) input_test_file output_test_runner (includes)", + " blah.yml - will use config options in the yml file (see docs)", + " -cexception - include cexception support"].join("\n") + exit 1 + end + + #create the default test runner name if not specified + ARGV[1] = ARGV[0].gsub(".c","_Runner.c") if (!ARGV[1]) + + #everything else is an include file + options[:includes] ||= (ARGV.slice(2..-1).flatten.compact) if (ARGV.size > 2) + + UnityTestRunnerGenerator.new(options).run(ARGV[0], ARGV[1]) +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/auto/test_file_filter.rb b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/auto/test_file_filter.rb new file mode 100644 index 0000000..3dbc26a --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/auto/test_file_filter.rb @@ -0,0 +1,23 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require'yaml' + +module RakefileHelpers + class TestFileFilter + def initialize(all_files = false) + @all_files = all_files + if not @all_files == true + if File.exist?('test_file_filter.yml') + filters = YAML.load_file( 'test_file_filter.yml' ) + @all_files, @only_files, @exclude_files = + filters[:all_files], filters[:only_files], filters[:exclude_files] + end + end + end + attr_accessor :all_files, :only_files, :exclude_files + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/auto/unity_test_summary.rb b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/auto/unity_test_summary.rb new file mode 100644 index 0000000..69ec2e8 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/auto/unity_test_summary.rb @@ -0,0 +1,126 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +#!/usr/bin/ruby +# +# unity_test_summary.rb +# +require 'fileutils' +require 'set' + +class UnityTestSummary + include FileUtils::Verbose + + attr_reader :report, :total_tests, :failures, :ignored + + def initialize + @report = '' + @total_tests = 0 + @failures = 0 + @ignored = 0 + end + + def run + # Clean up result file names + results = @targets.map {|target| target.gsub(/\\/,'/')} + + # Dig through each result file, looking for details on pass/fail: + failure_output = [] + ignore_output = [] + + results.each do |result_file| + lines = File.readlines(result_file).map { |line| line.chomp } + if lines.length == 0 + raise "Empty test result file: #{result_file}" + else + output = get_details(result_file, lines) + failure_output << output[:failures] unless output[:failures].empty? + ignore_output << output[:ignores] unless output[:ignores].empty? + tests,failures,ignored = parse_test_summary(lines) + @total_tests += tests + @failures += failures + @ignored += ignored + end + end + + if @ignored > 0 + @report += "\n" + @report += "--------------------------\n" + @report += "UNITY IGNORED TEST SUMMARY\n" + @report += "--------------------------\n" + @report += ignore_output.flatten.join("\n") + end + + if @failures > 0 + @report += "\n" + @report += "--------------------------\n" + @report += "UNITY FAILED TEST SUMMARY\n" + @report += "--------------------------\n" + @report += failure_output.flatten.join("\n") + end + + @report += "\n" + @report += "--------------------------\n" + @report += "OVERALL UNITY TEST SUMMARY\n" + @report += "--------------------------\n" + @report += "#{@total_tests} TOTAL TESTS #{@failures} TOTAL FAILURES #{@ignored} IGNORED\n" + @report += "\n" + end + + def set_targets(target_array) + @targets = target_array + end + + def set_root_path(path) + @root = path + end + + def usage(err_msg=nil) + puts err_msg if err_msg + puts "Usage: unity_test_summary.rb" + exit 1 + end + + protected + + @@targets=nil + @@path=nil + @@root=nil + + def get_details(result_file, lines) + results = { :failures => [], :ignores => [], :successes => [] } + lines.each do |line| + src_file,src_line,test_name,status,msg = line.split(/:/) + line_out = ((@root and (@root != 0)) ? "#{@root}#{line}" : line ).gsub(/\//, "\\") + case(status) + when 'IGNORE' then results[:ignores] << line_out + when 'FAIL' then results[:failures] << line_out + when 'PASS' then results[:successes] << line_out + end + end + return results + end + + def parse_test_summary(summary) + if summary[-3..-1].join("\n") =~ /(\d+) Tests (\d+) Failures (\d+) Ignored/ + [$1.to_i,$2.to_i,$3.to_i] + else + raise "Couldn't parse test results: #{summary}" + end + end + + def here; File.expand_path(File.dirname(__FILE__)); end + +end + +if $0 == __FILE__ + script = UnityTestSummary.new + begin + script.run + rescue Exception => e + script.usage e.message + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/docs/Unity Summary.odt b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/docs/Unity Summary.odt new file mode 100644 index 0000000..f699661 Binary files /dev/null and b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/docs/Unity Summary.odt differ diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/docs/Unity Summary.pdf b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/docs/Unity Summary.pdf new file mode 100644 index 0000000..ad1a956 Binary files /dev/null and b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/docs/Unity Summary.pdf differ diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/docs/Unity Summary.txt b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/docs/Unity Summary.txt new file mode 100644 index 0000000..e0b179d --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/docs/Unity Summary.txt @@ -0,0 +1,217 @@ +============== +Unity Test API +============== + +[Copyright (c) 2007 - Unity Project by Mike Karlesky, Mark VanderVoord, and Greg Williams] + +------------- +Running Tests +------------- + +RUN_TEST(func, linenum) + +Each Test is run within the macro RUN_TEST. This macro performs necessary setup before the test is called and handles cleanup and result tabulation afterwards. + +-------------- +Ignoring Tests +-------------- + +There are times when a test is incomplete or not valid for some reason. At these times, TEST_IGNORE can be called. Control will immediately be returned to the caller of the test, and no failures will be returned. + +TEST_IGNORE() + +Ignore this test and return immediately + +TEST_IGNORE_MESSAGE (message) + +Ignore this test and return immediately. Output a message stating why the test was ignored. + +-------------- +Aborting Tests +-------------- + +There are times when a test will contain an infinite loop on error conditions, or there may be reason to escape from the test early without executing the rest of the test. A pair of macros support this functionality in Unity. The first (TEST_PROTECT) sets up the feature, and handles emergency abort cases. TEST_ABORT can then be used at any time within the tests to return to the last TEST_PROTECT call. + +TEST_PROTECT() + +Setup and Catch macro + +TEST_ABORT() + +Abort Test macro + +Example: + +main() +{ + if (TEST_PROTECT() == 0) + { + MyTest(); + } +} + +If MyTest calls TEST_ABORT, program control will immediately return to TEST_PROTECT with a non-zero return value. + + +======================= +Unity Assertion Summary +======================= + +-------------------- +Basic Validity Tests +-------------------- + +TEST_ASSERT_TRUE(condition) + +Evaluates whatever code is in condition and fails if it evaluates to false + +TEST_ASSERT_FALSE(condition) + +Evaluates whatever code is in condition and fails if it evaluates to true + +TEST_ASSERT(condition) + +Another way of calling TEST_ASSERT_TRUE + +TEST_ASSERT_UNLESS(condition) + +Another way of calling TEST_ASSERT_FALSE + +TEST_FAIL() +TEST_FAIL_MESSAGE(message) + +This test is automatically marked as a failure. The message is output stating why. + +------------------------------ +Numerical Assertions: Integers +------------------------------ + +TEST_ASSERT_EQUAL_INT(expected, actual) +TEST_ASSERT_EQUAL_INT8(expected, actual) +TEST_ASSERT_EQUAL_INT16(expected, actual) +TEST_ASSERT_EQUAL_INT32(expected, actual) +TEST_ASSERT_EQUAL_INT64(expected, actual) + +Compare two integers for equality and display errors as signed integers. A cast will be performed +to your natural integer size so often this can just be used. When you need to specify the exact size, +like when comparing arrays, you can use a specific version: + + + +TEST_ASSERT_EQUAL_UINT(expected, actual) + +Compare two integers for equality and display errors as unsigned integers. Like INT, there are +variants for different sizes also. + + + +TEST_ASSERT_EQUAL_HEX(expected, actual) + +Compares two integers for equality and display errors as hexadecimal. Like the other integer comparisons, +you can specify the size... here the size will also effect how many nibbles are shown (for example, HEX16 +will show 4 nibbles). + +_ARRAY + +You can append _ARRAY to any of these macros to make an array comparison of that type. Here you will +need to care a bit more about the actual size of the value being checked. You will also specify an +additional argument which is the number of elements to compare. For example: + +TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, elements) + + +TEST_ASSERT_EQUAL(expected, actual) + +Another way of calling TEST_ASSERT_EQUAL_INT + + + +TEST_ASSERT_INT_WITHIN(delta, expected, actual) + +Asserts that the actual value is within plus or minus delta of the expected value. This also comes in +size specific variants. + + +----------------------------- +Numerical Assertions: Bitwise +----------------------------- + +TEST_ASSERT_BITS(mask, expected, actual) + +Use an integer mask to specify which bits should be compared between two other integers. High bits in the mask are compared, low bits ignored. + +TEST_ASSERT_BITS_HIGH(mask, actual) + +Use an integer mask to specify which bits should be inspected to determine if they are all set high. High bits in the mask are compared, low bits ignored. + +TEST_ASSERT_BITS_LOW(mask, actual) + +Use an integer mask to specify which bits should be inspected to determine if they are all set low. High bits in the mask are compared, low bits ignored. + +TEST_ASSERT_BIT_HIGH(bit, actual) + +Test a single bit and verify that it is high. The bit is specified 0-31 for a 32-bit integer. + +TEST_ASSERT_BIT_LOW(bit, actual) + +Test a single bit and verify that it is low. The bit is specified 0-31 for a 32-bit integer. + +---------------------------- +Numerical Assertions: Floats +---------------------------- + +TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual) + +Asserts that the actual value is within plus or minus delta of the expected value. + +TEST_ASSERT_EQUAL_FLOAT(expected, actual) + +Asserts that two floating point values are "equal" within a small % delta of the expected value. + +----------------- +String Assertions +----------------- + +TEST_ASSERT_EQUAL_STRING(expected, actual) + +Compare two null-terminate strings. Fail if any character is different or if the lengths are different. + +TEST_ASSERT_EQUAL_STRING_MESSAGE(expected, actual, message) + +Compare two null-terminate strings. Fail if any character is different or if the lengths are different. Output a custom message on failure. + +------------------ +Pointer Assertions +------------------ + +Most pointer operations can be performed by simply using the integer comparisons above. However, a couple of special cases are added for clarity. + +TEST_ASSERT_NULL(pointer) + +Fails if the pointer is not equal to NULL + +TEST_ASSERT_NOT_NULL(pointer) + +Fails if the pointer is equal to NULL + + +----------------- +Memory Assertions +----------------- + +TEST_ASSERT_EQUAL_MEMORY(expected, actual, len) + +Compare two blocks of memory. This is a good generic assertion for types that can't be coerced into acting like +standard types... but since it's a memory compare, you have to be careful that your data types are packed. + +-------- +_MESSAGE +-------- + +you can append _MESSAGE to any of the macros to make them take an additional argument. This argument +is a string that will be printed at the end of the failure strings. This is useful for specifying more +information about the problem. + + + + diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/docs/license.txt b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/docs/license.txt new file mode 100644 index 0000000..c42e330 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/docs/license.txt @@ -0,0 +1,31 @@ + Copyright (c) 2007-2010 Mike Karlesky, Mark VanderVoord, Greg Williams + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + The end-user documentation included with the redistribution, if + any, must include the following acknowledgment: "This product + includes software developed for the Unity Project, by Mike Karlesky, + Mark VanderVoord, and Greg Williams and other contributors", in + the same place and form as other third-party acknowledgments. + Alternately, this acknowledgment may appear in the software + itself, in the same form and location as other such third-party + acknowledgments. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.c b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.c new file mode 100644 index 0000000..9cf42c6 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.c @@ -0,0 +1,10 @@ +#include "unity.h" +#include "UnityHelper.h" +#include +#include + +void AssertEqualExampleStruct(const EXAMPLE_STRUCT_T expected, const EXAMPLE_STRUCT_T actual, const unsigned short line) +{ + UNITY_TEST_ASSERT_EQUAL_INT(expected.x, actual.x, line, "Example Struct Failed For Field x"); + UNITY_TEST_ASSERT_EQUAL_INT(expected.y, actual.y, line, "Example Struct Failed For Field y"); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.h b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.h new file mode 100644 index 0000000..1516111 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.h @@ -0,0 +1,12 @@ +#ifndef _TESTHELPER_H +#define _TESTHELPER_H + +#include "Types.h" + +void AssertEqualExampleStruct(const EXAMPLE_STRUCT_T expected, const EXAMPLE_STRUCT_T actual, const unsigned short line); + +#define UNITY_TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(expected, actual, line, message) AssertEqualExampleStruct(expected, actual, line); + +#define TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(expected, actual) UNITY_TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(expected, actual, __LINE__, NULL); + +#endif // _TESTHELPER_H diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/examples/makefile b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/examples/makefile new file mode 100644 index 0000000..723d390 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/examples/makefile @@ -0,0 +1,40 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +C_COMPILER=gcc +TARGET_BASE1=test1 +TARGET_BASE2=test2 +ifeq ($(OS),Windows_NT) + TARGET_EXTENSION=.exe +else + TARGET_EXTENSION=.out +endif +TARGET1 = $(TARGET_BASE1)$(TARGET_EXTENSION) +TARGET2 = $(TARGET_BASE2)$(TARGET_EXTENSION) +SRC_FILES1=../src/unity.c src/ProductionCode.c test/TestProductionCode.c test/no_ruby/TestProductionCode_Runner.c +SRC_FILES2=../src/unity.c src/ProductionCode2.c test/TestProductionCode2.c test/no_ruby/TestProductionCode2_Runner.c +INC_DIRS=-Isrc -I../src +SYMBOLS=-DTEST + +ifeq ($(OS),Windows_NT) + CLEANUP = del /F /Q build\* && del /F /Q $(TARGET1) && del /F /Q $(TARGET2) +else + CLEANUP = rm -f build/*.o ; rm -f $(TARGET1) ; rm -f $(TARGET2) +endif + +all: clean default + +default: +# ruby auto/generate_test_runner.rb test/TestProductionCode.c test/no_ruby/TestProductionCode_Runner.c +# ruby auto/generate_test_runner.rb test/TestProductionCode2.c test/no_ruby/TestProductionCode2_Runner.c + $(C_COMPILER) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES1) -o $(TARGET1) + $(C_COMPILER) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES2) -o $(TARGET2) + $(TARGET1) + $(TARGET2) + +clean: + $(CLEANUP) + diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/examples/rakefile.rb b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/examples/rakefile.rb new file mode 100644 index 0000000..0905b4b --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/examples/rakefile.rb @@ -0,0 +1,32 @@ +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require HERE+'rakefile_helper' + +include RakefileHelpers + +# Load default configuration, for now +DEFAULT_CONFIG_FILE = 'gcc.yml' +configure_toolchain(DEFAULT_CONFIG_FILE) + +task :unit do + run_tests get_unit_test_files +end + +desc "Generate test summary" +task :summary do + report_summary +end + +desc "Build and test Unity" +task :all => [:clean, :unit, :summary] +task :default => [:clobber, :all] +task :ci => [:default] +task :cruise => [:default] + +desc "Load configuration" +task :config, :config_file do |t, args| + configure_toolchain(args[:config_file]) +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/examples/rakefile_helper.rb b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/examples/rakefile_helper.rb new file mode 100644 index 0000000..0127d69 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/examples/rakefile_helper.rb @@ -0,0 +1,260 @@ +require 'yaml' +require 'fileutils' +require HERE+'../auto/unity_test_summary' +require HERE+'../auto/generate_test_runner' +require HERE+'../auto/colour_reporter' + +module RakefileHelpers + + C_EXTENSION = '.c' + + def load_configuration(config_file) + $cfg_file = "../targets/#{config_file}" + $cfg = YAML.load(File.read($cfg_file)) + end + + def configure_clean + CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil? + end + + def configure_toolchain(config_file=DEFAULT_CONFIG_FILE) + config_file += '.yml' unless config_file =~ /\.yml$/ + load_configuration('../targets/'+config_file) + configure_clean + end + + def get_unit_test_files + path = $cfg['compiler']['unit_tests_path'] + 'Test*' + C_EXTENSION + path.gsub!(/\\/, '/') + FileList.new(path) + end + + def get_local_include_dirs + include_dirs = $cfg['compiler']['includes']['items'].dup + include_dirs.delete_if {|dir| dir.is_a?(Array)} + return include_dirs + end + + def extract_headers(filename) + includes = [] + lines = File.readlines(filename) + lines.each do |line| + m = line.match(/^\s*#include\s+\"\s*(.+\.[hH])\s*\"/) + if not m.nil? + includes << m[1] + end + end + return includes + end + + def find_source_file(header, paths) + paths.each do |dir| + src_file = dir + header.ext(C_EXTENSION) + if (File.exists?(src_file)) + return src_file + end + end + return nil + end + + def tackit(strings) + if strings.is_a?(Array) + result = "\"#{strings.join}\"" + else + result = strings + end + return result + end + + def squash(prefix, items) + result = '' + items.each { |item| result += " #{prefix}#{tackit(item)}" } + return result + end + + def build_compiler_fields + command = tackit($cfg['compiler']['path']) + if $cfg['compiler']['defines']['items'].nil? + defines = '' + else + defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items']) + end + options = squash('', $cfg['compiler']['options']) + includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :defines => defines, :options => options, :includes => includes} + end + + def compile(file, defines=[]) + compiler = build_compiler_fields + cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{file} " + + "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" + + "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" + execute(cmd_str) + end + + def build_linker_fields + command = tackit($cfg['linker']['path']) + if $cfg['linker']['options'].nil? + options = '' + else + options = squash('', $cfg['linker']['options']) + end + if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?) + includes = '' + else + includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) + end + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :options => options, :includes => includes} + end + + def link(exe_name, obj_list) + linker = build_linker_fields + cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + + (obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).join + + $cfg['linker']['bin_files']['prefix'] + ' ' + + $cfg['linker']['bin_files']['destination'] + + exe_name + $cfg['linker']['bin_files']['extension'] + execute(cmd_str) + end + + def build_simulator_fields + return nil if $cfg['simulator'].nil? + if $cfg['simulator']['path'].nil? + command = '' + else + command = (tackit($cfg['simulator']['path']) + ' ') + end + if $cfg['simulator']['pre_support'].nil? + pre_support = '' + else + pre_support = squash('', $cfg['simulator']['pre_support']) + end + if $cfg['simulator']['post_support'].nil? + post_support = '' + else + post_support = squash('', $cfg['simulator']['post_support']) + end + return {:command => command, :pre_support => pre_support, :post_support => post_support} + end + + def execute(command_string, verbose=true, raise_on_fail=true) + report command_string + output = `#{command_string}`.chomp + report(output) if (verbose && !output.nil? && (output.length > 0)) + if (($?.exitstatus != 0) and (raise_on_fail)) + raise "Command failed. (Returned #{$?.exitstatus})" + end + return output + end + + def report_summary + summary = UnityTestSummary.new + summary.set_root_path(HERE) + results_glob = "#{$cfg['compiler']['build_path']}*.test*" + results_glob.gsub!(/\\/, '/') + results = Dir[results_glob] + summary.set_targets(results) + summary.run + fail_out "FAIL: There were failures" if (summary.failures > 0) + end + + def run_tests(test_files) + + report 'Running system tests...' + + # Tack on TEST define for compiling unit tests + load_configuration($cfg_file) + test_defines = ['TEST'] + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + $cfg['compiler']['defines']['items'] << 'TEST' + + include_dirs = get_local_include_dirs + + # Build and execute each unit test + test_files.each do |test| + obj_list = [] + + # Detect dependencies and build required required modules + extract_headers(test).each do |header| + # Compile corresponding source file if it exists + src_file = find_source_file(header, include_dirs) + if !src_file.nil? + compile(src_file, test_defines) + obj_list << header.ext($cfg['compiler']['object_files']['extension']) + end + end + + # Build the test runner (generate if configured to do so) + test_base = File.basename(test, C_EXTENSION) + runner_name = test_base + '_Runner.c' + if $cfg['compiler']['runner_path'].nil? + runner_path = $cfg['compiler']['build_path'] + runner_name + test_gen = UnityTestRunnerGenerator.new($cfg_file) + test_gen.run(test, runner_path) + else + runner_path = $cfg['compiler']['runner_path'] + runner_name + end + + compile(runner_path, test_defines) + obj_list << runner_name.ext($cfg['compiler']['object_files']['extension']) + + # Build the test module + compile(test, test_defines) + obj_list << test_base.ext($cfg['compiler']['object_files']['extension']) + + # Link the test executable + link(test_base, obj_list) + + # Execute unit test and generate results file + simulator = build_simulator_fields + executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] + if simulator.nil? + cmd_str = executable + else + cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" + end + output = execute(cmd_str, true, false) + test_results = $cfg['compiler']['build_path'] + test_base + if output.match(/OK$/m).nil? + test_results += '.testfail' + else + test_results += '.testpass' + end + File.open(test_results, 'w') { |f| f.print output } + end + end + + def build_application(main) + + report "Building application..." + + obj_list = [] + load_configuration($cfg_file) + main_path = $cfg['compiler']['source_path'] + main + C_EXTENSION + + # Detect dependencies and build required required modules + include_dirs = get_local_include_dirs + extract_headers(main_path).each do |header| + src_file = find_source_file(header, include_dirs) + if !src_file.nil? + compile(src_file) + obj_list << header.ext($cfg['compiler']['object_files']['extension']) + end + end + + # Build the main source file + main_base = File.basename(main_path, C_EXTENSION) + compile(main_path) + obj_list << main_base.ext($cfg['compiler']['object_files']['extension']) + + # Create the executable + link(main_base, obj_list) + end + + def fail_out(msg) + puts msg + exit(-1) + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/examples/readme.txt b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/examples/readme.txt new file mode 100644 index 0000000..6c7780e --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/examples/readme.txt @@ -0,0 +1,18 @@ +Example Project + +This example project gives an example of some passing, ignored, and failing tests. +It's simple and meant for you to look over and get an idea for what all of this stuff does. + +You can build and test using the makefile if you have gcc installed (you may need to tweak +the locations of some tools in the makefile). Otherwise, the rake version will let you +test with gcc or a couple versions of IAR. You can tweak the yaml files to get those versions +running. + +Ruby is required if you're using the rake version (obviously). This version shows off most of +Unity's advanced features (automatically creating test runners, fancy summaries, etc.) + +The makefile version doesn't require anything outside of your normal build tools, but won't do the +extras for you. So that you can test right away, we've written the test runners for you and +put them in the test\no_ruby subdirectory. If you make changes to the tests or source, you might +need to update these (like when you add or remove tests). Do that for a while and you'll learn +why you really want to start using the Ruby tools. \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/examples/src/ProductionCode.c b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/examples/src/ProductionCode.c new file mode 100644 index 0000000..500b44b --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/examples/src/ProductionCode.c @@ -0,0 +1,24 @@ + +#include "ProductionCode.h" + +int Counter = 0; +int NumbersToFind[9] = { 0, 34, 55, 66, 32, 11, 1, 77, 888 }; //some obnoxious array to search that is 1-based indexing instead of 0. + +// This function is supposed to search through NumbersToFind and find a particular number. +// If it finds it, the index is returned. Otherwise 0 is returned which sorta makes sense since +// NumbersToFind is indexed from 1. Unfortunately it's broken +// (and should therefore be caught by our tests) +int FindFunction_WhichIsBroken(int NumberToFind) +{ + int i = 0; + while (i <= 8) //Notice I should have been in braces + i++; + if (NumbersToFind[i] == NumberToFind) //Yikes! I'm getting run after the loop finishes instead of during it! + return i; + return 0; +} + +int FunctionWhichReturnsLocalVariable(void) +{ + return Counter; +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/examples/src/ProductionCode.h b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/examples/src/ProductionCode.h new file mode 100644 index 0000000..250ca0d --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/examples/src/ProductionCode.h @@ -0,0 +1,3 @@ + +int FindFunction_WhichIsBroken(int NumberToFind); +int FunctionWhichReturnsLocalVariable(void); diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/examples/src/ProductionCode2.c b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/examples/src/ProductionCode2.c new file mode 100644 index 0000000..a8c72e1 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/examples/src/ProductionCode2.c @@ -0,0 +1,9 @@ + +#include "ProductionCode2.h" + +char* ThisFunctionHasNotBeenTested(int Poor, char* LittleFunction) +{ + //Since There Are No Tests Yet, This Function Could Be Empty For All We Know. + // Which isn't terribly useful... but at least we put in a TEST_IGNORE so we won't forget + return (char*)0; +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/examples/src/ProductionCode2.h b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/examples/src/ProductionCode2.h new file mode 100644 index 0000000..34ae980 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/examples/src/ProductionCode2.h @@ -0,0 +1,2 @@ + +char* ThisFunctionHasNotBeenTested(int Poor, char* LittleFunction); diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/examples/test/TestProductionCode.c b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/examples/test/TestProductionCode.c new file mode 100644 index 0000000..28a5581 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/examples/test/TestProductionCode.c @@ -0,0 +1,62 @@ + +#include "ProductionCode.h" +#include "unity.h" + +//sometimes you may want to get at local data in a module. +//for example: If you plan to pass by reference, this could be useful +//however, it should often be avoided +extern int Counter; + +void setUp(void) +{ + //This is run before EACH TEST + Counter = 0x5a5a; +} + +void tearDown(void) +{ +} + +void test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode(void) +{ + //All of these should pass + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(78)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(1)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(33)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(999)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(-1)); +} + +void test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken(void) +{ + // You should see this line fail in your test summary + TEST_ASSERT_EQUAL(1, FindFunction_WhichIsBroken(34)); + + // Notice the rest of these didn't get a chance to run because the line above failed. + // Unit tests abort each test function on the first sign of trouble. + // Then NEXT test function runs as normal. + TEST_ASSERT_EQUAL(8, FindFunction_WhichIsBroken(8888)); +} + +void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue(void) +{ + //This should be true because setUp set this up for us before this test + TEST_ASSERT_EQUAL_HEX(0x5a5a, FunctionWhichReturnsLocalVariable()); + + //This should be true because we can still change our answer + Counter = 0x1234; + TEST_ASSERT_EQUAL_HEX(0x1234, FunctionWhichReturnsLocalVariable()); +} + +void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain(void) +{ + //This should be true again because setup was rerun before this test (and after we changed it to 0x1234) + TEST_ASSERT_EQUAL_HEX(0x5a5a, FunctionWhichReturnsLocalVariable()); +} + +void test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed(void) +{ + //Sometimes you get the test wrong. When that happens, you get a failure too... and a quick look should tell + // you what actually happened...which in this case was a failure to setup the initial condition. + TEST_ASSERT_EQUAL_HEX(0x1234, FunctionWhichReturnsLocalVariable()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/examples/test/TestProductionCode2.c b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/examples/test/TestProductionCode2.c new file mode 100644 index 0000000..20c9251 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/examples/test/TestProductionCode2.c @@ -0,0 +1,26 @@ + +#include "ProductionCode2.h" +#include "unity.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void test_IgnoredTest(void) +{ + TEST_IGNORE_MESSAGE("This Test Was Ignored On Purpose"); +} + +void test_AnotherIgnoredTest(void) +{ + TEST_IGNORE_MESSAGE("These Can Be Useful For Leaving Yourself Notes On What You Need To Do Yet"); +} + +void test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented(void) +{ + TEST_IGNORE(); //Like This +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode2_Runner.c b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode2_Runner.c new file mode 100644 index 0000000..56515ae --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode2_Runner.c @@ -0,0 +1,46 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ +#include "unity.h" +#include +#include + +char MessageBuffer[50]; + +extern void setUp(void); +extern void tearDown(void); + +extern void test_IgnoredTest(void); +extern void test_AnotherIgnoredTest(void); +extern void test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented(void); + +static void runTest(UnityTestFunction test) +{ + if (TEST_PROTECT()) + { + setUp(); + test(); + } + if (TEST_PROTECT() && !TEST_IS_IGNORED) + { + tearDown(); + } +} +void resetTest() +{ + tearDown(); + setUp(); +} + + +int main(void) +{ + Unity.TestFile = "test/TestProductionCode2.c"; + UnityBegin(); + + // RUN_TEST calls runTest + RUN_TEST(test_IgnoredTest, 13); + RUN_TEST(test_AnotherIgnoredTest, 18); + RUN_TEST(test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented, 23); + + UnityEnd(); + return 0; +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode_Runner.c b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode_Runner.c new file mode 100644 index 0000000..64112f3 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode_Runner.c @@ -0,0 +1,50 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ +#include "unity.h" +#include +#include + +char MessageBuffer[50]; + +extern void setUp(void); +extern void tearDown(void); + +extern void test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode(void); +extern void test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken(void); +extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue(void); +extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain(void); +extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed(void); + +static void runTest(UnityTestFunction test) +{ + if (TEST_PROTECT()) + { + setUp(); + test(); + } + if (TEST_PROTECT() && !TEST_IS_IGNORED) + { + tearDown(); + } +} +void resetTest() +{ + tearDown(); + setUp(); +} + + +int main(void) +{ + Unity.TestFile = "test/TestProductionCode.c"; + UnityBegin(); + + // RUN_TEST calls runTest + RUN_TEST(test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode, 20); + RUN_TEST(test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken, 30); + RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue, 41); + RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain, 51); + RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed, 57); + + UnityEnd(); + return 0; +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/build/MakefileWorker.mk b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/build/MakefileWorker.mk new file mode 100644 index 0000000..9948751 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/build/MakefileWorker.mk @@ -0,0 +1,331 @@ +#--------- +# +# MakefileWorker.mk +# +# Include this helper file in your makefile +# It makes +# A static library holding the application objs +# A test executable +# +# See this example for parameter settings +# examples/Makefile +# +#---------- +# Inputs - these variables describe what to build +# +# INCLUDE_DIRS - Directories used to search for include files. +# This generates a -I for each directory +# SRC_DIRS - Directories containing source file to built into the library +# SRC_FILES - Specific source files to build into library. Helpful when not all code +# in a directory can be built for test (hopefully a temporary situation) +# TEST_SRC_DIRS - Directories containing unit test code build into the unit test runner +# These do not go in a library. They are explicitly included in the test runner +# MOCKS_SRC_DIRS - Directories containing mock source files to build into the test runner +# These do not go in a library. They are explicitly included in the test runner +#---------- +# You can adjust these variables to influence how to build the test target +# and where to put and name outputs +# See below to determine defaults +# COMPONENT_NAME - the name of the thing being built +# UNITY_HOME - where Unity home dir found +# UNITY_BUILD_HOME - place for scripts +# UNITY_OBJS_DIR - a directory where o and d files go +# UNITY_LIB_DIR - a directory where libs go +# UNITY_ENABLE_DEBUG - build for debug +# UNITY_USE_MEM_LEAK_DETECTION - Links with overridden new and delete +# UNITY_USE_STD_CPP_LIB - Set to N to keep the standard C++ library out +# of the test harness +# UNITY_USE_GCOV - Turn on coverage analysis +# Clean then build with this flag set to Y, then 'make gcov' +# UNITY_TEST_RUNNER_FLAGS +# None by default +# UNITY_MAPFILE - generate a map file +# UNITY_WARNINGFLAGS - overly picky by default +# OTHER_MAKEFILE_TO_INCLUDE - a hook to use this makefile to make +# other targets. Like CSlim, which is part of fitnesse +#---------- +# +# Other flags users can initialize to sneak in their settings +# UNITY_CFLAGS - C complier +# UNITY_LDFLAGS - Linker flags +#---------- + + +ifndef COMPONENT_NAME + COMPONENT_NAME = name_this_in_the_makefile +endif + +# Debug on by default +ifndef UNITY_ENABLE_DEBUG + UNITY_ENABLE_DEBUG = Y +endif + +# new and delete for memory leak detection on by default +ifndef UNITY_USE_MEM_LEAK_DETECTION + UNITY_USE_MEM_LEAK_DETECTION = Y +endif + +# Use gcov, off by default +ifndef UNITY_USE_GCOV + UNITY_USE_GCOV = N +endif + +# Default warnings +ifndef UNITY_WARNINGFLAGS + UNITY_WARNINGFLAGS = -Wall -Werror -Wshadow -Wswitch-default +endif + +# Default dir for temporary files (d, o) +ifndef UNITY_OBJS_DIR + UNITY_OBJS_DIR = objs +endif + +# Default dir for the outout library +ifndef UNITY_LIB_DIR + UNITY_LIB_DIR = lib +endif + +# No map by default +ifndef UNITY_MAP_FILE + UNITY_MAP_FILE = N +endif + +#Not verbose by deafult +ifdef VERBOSE + UNITY_TEST_RUNNER_FLAGS += -v +endif + +ifdef GROUP + UNITY_TEST_RUNNER_FLAGS += -g $(GROUP) +endif + +ifdef NAME + UNITY_TEST_RUNNER_FLAGS += -n $(NAME) +endif + +ifdef REPEAT + UNITY_TEST_RUNNER_FLAGS += -r $(REPEAT) +endif + + +# -------------------------------------- +# derived flags in the following area +# -------------------------------------- +ifeq ($(UNITY_USE_MEM_LEAK_DETECTION), N) + UNITY_CFLAGS += -DUNITY_MEM_LEAK_DETECTION_DISABLED +else + UNITY_MEMLEAK_DETECTOR_MALLOC_MACRO_FILE = -include $(UNITY_HOME)/extras/fixture/src/unity_fixture_malloc_overrides.h +endif + +ifeq ($(UNITY_ENABLE_DEBUG), Y) + UNITY_CFLAGS += -g +endif + +ifeq ($(UNITY_USE_GCOV), Y) + UNITY_CFLAGS += -fprofile-arcs -ftest-coverage +endif + +UNITY_CFLAGS += $(UNITY_MEMLEAK_DETECTOR_MALLOC_MACRO_FILE) + +TARGET_MAP = $(COMPONENT_NAME).map.txt +ifeq ($(UNITY_MAP_FILE), Y) + UNITY_LDFLAGS += -Wl,-map,$(TARGET_MAP) +endif + +LD_LIBRARIES += -lgcov + +TARGET_LIB = \ + $(UNITY_LIB_DIR)/lib$(COMPONENT_NAME).a + +TEST_TARGET = \ + $(COMPONENT_NAME)_tests + +#Helper Functions +get_src_from_dir = $(wildcard $1/*.cpp) $(wildcard $1/*.c) +get_dirs_from_dirspec = $(wildcard $1) +get_src_from_dir_list = $(foreach dir, $1, $(call get_src_from_dir,$(dir))) +__src_to = $(subst .c,$1, $(subst .cpp,$1,$2)) +src_to = $(addprefix $(UNITY_OBJS_DIR)/,$(call __src_to,$1,$2)) +src_to_o = $(call src_to,.o,$1) +src_to_d = $(call src_to,.d,$1) +src_to_gcda = $(call src_to,.gcda,$1) +src_to_gcno = $(call src_to,.gcno,$1) +make_dotdot_a_subdir = $(subst ..,_dot_dot, $1) +time = $(shell date +%s) +delta_t = $(eval minus, $1, $2) +debug_print_list = $(foreach word,$1,echo " $(word)";) echo; + +#Derived +STUFF_TO_CLEAN += $(TEST_TARGET) $(TEST_TARGET).exe $(TARGET_LIB) $(TARGET_MAP) + +SRC += $(call get_src_from_dir_list, $(SRC_DIRS)) $(SRC_FILES) +OBJ = $(call src_to_o,$(SRC)) +OBJ2 = $(call make_dotdot_a_subdir. $(OBJ)) + +STUFF_TO_CLEAN += $(OBJ) + +TEST_SRC = $(call get_src_from_dir_list, $(TEST_SRC_DIRS)) +TEST_OBJS = $(call src_to_o,$(TEST_SRC)) +STUFF_TO_CLEAN += $(TEST_OBJS) + + +MOCKS_SRC = $(call get_src_from_dir_list, $(MOCKS_SRC_DIRS)) +MOCKS_OBJS = $(call src_to_o,$(MOCKS_SRC)) +STUFF_TO_CLEAN += $(MOCKS_OBJS) + +ALL_SRC = $(SRC) $(TEST_SRC) $(MOCKS_SRC) + +#Test coverage with gcov +GCOV_OUTPUT = gcov_output.txt +GCOV_REPORT = gcov_report.txt +GCOV_ERROR = gcov_error.txt +GCOV_GCDA_FILES = $(call src_to_gcda, $(ALL_SRC)) +GCOV_GCNO_FILES = $(call src_to_gcno, $(ALL_SRC)) +TEST_OUTPUT = $(TEST_TARGET).txt +STUFF_TO_CLEAN += \ + $(GCOV_OUTPUT)\ + $(GCOV_REPORT)\ + $(GCOV_REPORT).html\ + $(GCOV_ERROR)\ + $(GCOV_GCDA_FILES)\ + $(GCOV_GCNO_FILES)\ + $(TEST_OUTPUT) + + +#The gcda files for gcov need to be deleted before each run +#To avoid annoying messages. +GCOV_CLEAN = $(SILENCE)rm -f $(GCOV_GCDA_FILES) $(GCOV_OUTPUT) $(GCOV_REPORT) $(GCOV_ERROR) +RUN_TEST_TARGET = $(SILENCE) $(GCOV_CLEAN) ; echo "Running $(TEST_TARGET)"; ./$(TEST_TARGET) $(UNITY_TEST_RUNNER_FLAGS) + +INCLUDES_DIRS_EXPANDED = $(call get_dirs_from_dirspec, $(INCLUDE_DIRS)) +INCLUDES += $(foreach dir, $(INCLUDES_DIRS_EXPANDED), -I$(dir)) +MOCK_DIRS_EXPANDED = $(call get_dirs_from_dirspec, $(MOCKS_SRC_DIRS)) +INCLUDES += $(foreach dir, $(MOCK_DIRS_EXPANDED), -I$(dir)) + + +DEP_FILES = $(call src_to_d, $(ALL_SRC)) +STUFF_TO_CLEAN += $(DEP_FILES) $(PRODUCTION_CODE_START) $(PRODUCTION_CODE_END) +STUFF_TO_CLEAN += $(STDLIB_CODE_START) $(MAP_FILE) cpputest_*.xml junit_run_output + +# We'll use the UNITY_CFLAGS etc so that you can override AND add to the CppUTest flags +CFLAGS = $(UNITY_CFLAGS) $(UNITY_ADDITIONAL_CFLAGS) $(INCLUDES) $(UNITY_WARNINGFLAGS) +LDFLAGS = $(UNITY_LDFLAGS) $(UNITY_ADDITIONAL_LDFLAGS) + +# Targets + +.PHONY: all +all: start $(TEST_TARGET) + $(RUN_TEST_TARGET) + +.PHONY: start +start: $(TEST_TARGET) + $(SILENCE)START_TIME=$(call time) + +.PHONY: all_no_tests +all_no_tests: $(TEST_TARGET) + +.PHONY: flags +flags: + @echo + @echo "Compile C source with CFLAGS:" + @$(call debug_print_list,$(CFLAGS)) + @echo "Link with LDFLAGS:" + @$(call debug_print_list,$(LDFLAGS)) + @echo "Link with LD_LIBRARIES:" + @$(call debug_print_list,$(LD_LIBRARIES)) + @echo "Create libraries with ARFLAGS:" + @$(call debug_print_list,$(ARFLAGS)) + @echo "OBJ files:" + @$(call debug_print_list,$(OBJ2)) + + +$(TEST_TARGET): $(TEST_OBJS) $(MOCKS_OBJS) $(PRODUCTION_CODE_START) $(TARGET_LIB) $(USER_LIBS) $(PRODUCTION_CODE_END) $(STDLIB_CODE_START) + $(SILENCE)echo Linking $@ + $(SILENCE)$(LINK.o) -o $@ $^ $(LD_LIBRARIES) + +$(TARGET_LIB): $(OBJ) + $(SILENCE)echo Building archive $@ + $(SILENCE)mkdir -p lib + $(SILENCE)$(AR) $(ARFLAGS) $@ $^ + $(SILENCE)ranlib $@ + +test: $(TEST_TARGET) + $(RUN_TEST_TARGET) | tee $(TEST_OUTPUT) + +vtest: $(TEST_TARGET) + $(RUN_TEST_TARGET) -v | tee $(TEST_OUTPUT) + +$(UNITY_OBJS_DIR)/%.o: %.cpp + @echo compiling $(notdir $<) + $(SILENCE)mkdir -p $(dir $@) + $(SILENCE)$(COMPILE.cpp) -MMD -MP $(OUTPUT_OPTION) $< + +$(UNITY_OBJS_DIR)/%.o: %.c + @echo compiling $(notdir $<) + $(SILENCE)mkdir -p $(dir $@) + $(SILENCE)$(COMPILE.c) -MMD -MP $(OUTPUT_OPTION) $< + +ifneq "$(MAKECMDGOALS)" "clean" +-include $(DEP_FILES) +endif + +.PHONY: clean +clean: + $(SILENCE)echo Making clean + $(SILENCE)$(RM) $(STUFF_TO_CLEAN) + $(SILENCE)rm -rf gcov $(UNITY_OBJS_DIR) + $(SILENCE)find . -name "*.gcno" | xargs rm -f + $(SILENCE)find . -name "*.gcda" | xargs rm -f + +#realclean gets rid of all gcov, o and d files in the directory tree +#not just the ones made by this makefile +.PHONY: realclean +realclean: clean + $(SILENCE)rm -rf gcov + $(SILENCE)find . -name "*.gdcno" | xargs rm -f + $(SILENCE)find . -name "*.[do]" | xargs rm -f + +gcov: test + $(SILENCE)for d in $(SRC_DIRS) ; do \ + gcov --object-directory $(UNITY_OBJS_DIR)/$$d $$d/*.c $$d/*.cpp >> $(GCOV_OUTPUT) 2>>$(GCOV_ERROR) ; \ + done + $(SILENCE)for f in $(SRC_FILES) ; do \ + gcov --object-directory $(UNITY_OBJS_DIR)/$$f $$f >> $(GCOV_OUTPUT) 2>>$(GCOV_ERROR) ; \ + done + $(UNITY_BUILD_HOME)/filterGcov.sh $(GCOV_OUTPUT) $(GCOV_ERROR) $(GCOV_REPORT) $(TEST_OUTPUT) + $(SILENCE)cat $(GCOV_REPORT) + $(SILENCE)mkdir -p gcov + $(SILENCE)mv *.gcov gcov + $(SILENCE)mv gcov_* gcov + $(SILENCE)echo "See gcov directory for details" + +debug: + @echo + @echo "Target Source files:" + @$(call debug_print_list,$(SRC)) + @echo "Target Object files:" + @$(call debug_print_list,$(OBJ)) + @echo "Test Source files:" + @$(call debug_print_list,$(TEST_SRC)) + @echo "Test Object files:" + @$(call debug_print_list,$(TEST_OBJS)) + @echo "Mock Source files:" + @$(call debug_print_list,$(MOCKS_SRC)) + @echo "Mock Object files:" + @$(call debug_print_list,$(MOCKS_OBJS)) + @echo "All Input Dependency files:" + @$(call debug_print_list,$(DEP_FILES)) + @echo Stuff to clean: + @$(call debug_print_list,$(STUFF_TO_CLEAN)) + @echo Includes: + @$(call debug_print_list,$(INCLUDES)) + +ifneq "$(OTHER_MAKEFILE_TO_INCLUDE)" "" +-include $(OTHER_MAKEFILE_TO_INCLUDE) +endif + + + +st,$(TEST_SRC)) + @echo "Test Object files:" + @$(call debug_print \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/build/filterGcov.sh b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/build/filterGcov.sh new file mode 100644 index 0000000..a861cf6 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/build/filterGcov.sh @@ -0,0 +1,61 @@ +#!/bin/bash +INPUT_FILE=$1 +TEMP_FILE1=${INPUT_FILE}1.tmp +TEMP_FILE2=${INPUT_FILE}2.tmp +TEMP_FILE3=${INPUT_FILE}3.tmp +ERROR_FILE=$2 +OUTPUT_FILE=$3 +HTML_OUTPUT_FILE=$3.html +TEST_RESULTS=$4 + +flattenGcovOutput() { +while read line1 +do + read line2 + echo $line2 " " $line1 + read junk + read junk +done < ${INPUT_FILE} +} + +getRidOfCruft() { +sed '-e s/^Lines.*://g' \ + '-e s/^[0-9]\./ &/g' \ + '-e s/^[0-9][0-9]\./ &/g' \ + '-e s/of.*File/ /g' \ + "-e s/'//g" \ + '-e s/^.*\/usr\/.*$//g' \ + '-e s/^.*\.$//g' +} + +getFileNameRootFromErrorFile() { +sed '-e s/gc..:cannot open .* file//g' ${ERROR_FILE} +} + +writeEachNoTestCoverageFile() { +while read line +do + echo " 0.00% " ${line} +done +} + +createHtmlOutput() { + echo "" + echo "" + sed "-e s/.*% /
CoverageFile
&<\/td>/" \ + "-e s/[a-zA-Z0-9_]*\.[ch][a-z]*/&<\/a><\/td><\/tr>/" + echo "
" + sed "-e s/.*/&
/g" < ${TEST_RESULTS} +} + + +flattenGcovOutput | getRidOfCruft > ${TEMP_FILE1} +getFileNameRootFromErrorFile | writeEachNoTestCoverageFile > ${TEMP_FILE2} +cat ${TEMP_FILE1} ${TEMP_FILE2} | sort | uniq > ${OUTPUT_FILE} +createHtmlOutput < ${OUTPUT_FILE} > ${HTML_OUTPUT_FILE} +rm -f ${TEMP_FILE1} ${TEMP_FILE2} +erageFile" + sed "-e s/.*% /&<\/td>/" \ + "-e s/[a-zA-Z0-9_]*\.[ch][a-z]*/&<\/a><\/td><\/tr>/" + echo "" + sed "-e s/.*/&
/g" < ${TEST_RESULTS \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/rakefile.rb b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/rakefile.rb new file mode 100644 index 0000000..6181707 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/rakefile.rb @@ -0,0 +1,37 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require HERE + 'rakefile_helper' + +include RakefileHelpers + +# Load default configuration, for now +DEFAULT_CONFIG_FILE = 'gcc.yml' +configure_toolchain(DEFAULT_CONFIG_FILE) + +task :unit do + run_tests +end + +desc "Build and test Unity Framework" +task :all => [:clean, :unit] +task :default => [:clobber, :all] +task :ci => [:no_color, :default] +task :cruise => [:no_color, :default] + +desc "Load configuration" +task :config, :config_file do |t, args| + configure_toolchain(args[:config_file]) +end + +task :no_color do + $colour_output = false +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/rakefile_helper.rb b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/rakefile_helper.rb new file mode 100644 index 0000000..a7f6a28 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/rakefile_helper.rb @@ -0,0 +1,178 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require 'yaml' +require 'fileutils' +require HERE+'../../auto/unity_test_summary' +require HERE+'../../auto/generate_test_runner' +require HERE+'../../auto/colour_reporter' + +module RakefileHelpers + + C_EXTENSION = '.c' + + def load_configuration(config_file) + unless ($configured) + $cfg_file = HERE+"../../targets/#{config_file}" unless (config_file =~ /[\\|\/]/) + $cfg = YAML.load(File.read($cfg_file)) + $colour_output = false unless $cfg['colour'] + $configured = true if (config_file != DEFAULT_CONFIG_FILE) + end + end + + def configure_clean + CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil? + end + + def configure_toolchain(config_file=DEFAULT_CONFIG_FILE) + config_file += '.yml' unless config_file =~ /\.yml$/ + config_file = config_file unless config_file =~ /[\\|\/]/ + load_configuration(config_file) + configure_clean + end + + def tackit(strings) + if strings.is_a?(Array) + result = "\"#{strings.join}\"" + else + result = strings + end + return result + end + + def squash(prefix, items) + result = '' + items.each { |item| result += " #{prefix}#{tackit(item)}" } + return result + end + + def build_compiler_fields + command = tackit($cfg['compiler']['path']) + if $cfg['compiler']['defines']['items'].nil? + defines = '' + else + defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items'] + ['UNITY_OUTPUT_CHAR=UnityOutputCharSpy_OutputChar']) + end + options = squash('', $cfg['compiler']['options']) + includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :defines => defines, :options => options, :includes => includes} + end + + def compile(file, defines=[]) + compiler = build_compiler_fields + unity_include = $cfg['compiler']['includes']['prefix']+'../../src' + cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{unity_include} #{file} " + + "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" + + "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" + execute(cmd_str) + end + + def build_linker_fields + command = tackit($cfg['linker']['path']) + if $cfg['linker']['options'].nil? + options = '' + else + options = squash('', $cfg['linker']['options']) + end + if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?) + includes = '' + else + includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) + end + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :options => options, :includes => includes} + end + + def link(exe_name, obj_list) + linker = build_linker_fields + cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + + (obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).join + + $cfg['linker']['bin_files']['prefix'] + ' ' + + $cfg['linker']['bin_files']['destination'] + + exe_name + $cfg['linker']['bin_files']['extension'] + execute(cmd_str) + end + + def build_simulator_fields + return nil if $cfg['simulator'].nil? + if $cfg['simulator']['path'].nil? + command = '' + else + command = (tackit($cfg['simulator']['path']) + ' ') + end + if $cfg['simulator']['pre_support'].nil? + pre_support = '' + else + pre_support = squash('', $cfg['simulator']['pre_support']) + end + if $cfg['simulator']['post_support'].nil? + post_support = '' + else + post_support = squash('', $cfg['simulator']['post_support']) + end + return {:command => command, :pre_support => pre_support, :post_support => post_support} + end + + def execute(command_string, verbose=true) + report command_string + output = `#{command_string}`.chomp + report(output) if (verbose && !output.nil? && (output.length > 0)) + if ($?.exitstatus != 0) + raise "Command failed. (Returned #{$?.exitstatus})" + end + return output + end + + def report_summary + summary = UnityTestSummary.new + summary.set_root_path(HERE) + results_glob = "#{$cfg['compiler']['build_path']}*.test*" + results_glob.gsub!(/\\/, '/') + results = Dir[results_glob] + summary.set_targets(results) + summary.run + end + + def run_tests + report 'Running Unity system tests...' + + # Tack on TEST define for compiling unit tests + load_configuration($cfg_file) + test_defines = ['TEST'] + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + + # Get a list of all source files needed + src_files = Dir[HERE+'src/*.c'] + src_files += Dir[HERE+'test/*.c'] + src_files << '../../src/Unity.c' + + # Build object files + src_files.each { |f| compile(f, test_defines) } + obj_list = src_files.map {|f| File.basename(f.ext($cfg['compiler']['object_files']['extension'])) } + + # Link the test executable + test_base = "framework_test" + link(test_base, obj_list) + + # Execute unit test and generate results file + simulator = build_simulator_fields + executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] + if simulator.nil? + cmd_str = executable + " -v -r" + else + cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" + end + output = execute(cmd_str) + test_results = $cfg['compiler']['build_path'] + test_base + if output.match(/OK$/m).nil? + test_results += '.testfail' + else + test_results += '.testpass' + end + File.open(test_results, 'w') { |f| f.print output } + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/readme.txt b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/readme.txt new file mode 100644 index 0000000..6b9a78c --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/readme.txt @@ -0,0 +1,9 @@ +Copyright (c) 2010 James Grenning and Contributed to Unity Project + +Unity Project - A Test Framework for C +Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +[Released under MIT License. Please refer to license.txt for details] + +This Framework is an optional add-on to Unity. By including unity_framework.h in place of unity.h, +you may now work with Unity in a manner similar to CppUTest. This framework adds the concepts of +test groups and gives finer control of your tests over the command line. \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c new file mode 100644 index 0000000..1ba3e9a --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c @@ -0,0 +1,381 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" +#include "unity_internals.h" +#include + +UNITY_FIXTURE_T UnityFixture; + +//If you decide to use the function pointer approach. +int (*outputChar)(int) = putchar; + +int verbose = 0; + +void setUp(void) { /*does nothing*/ } +void tearDown(void) { /*does nothing*/ } + +void announceTestRun(int runNumber) +{ + UnityPrint("Unity test run "); + UnityPrintNumber(runNumber+1); + UnityPrint(" of "); + UnityPrintNumber(UnityFixture.RepeatCount); + UNITY_OUTPUT_CHAR('\n'); +} + +int UnityMain(int argc, char* argv[], void (*runAllTests)()) +{ + int result = UnityGetCommandLineOptions(argc, argv); + int r; + if (result != 0) + return result; + + for (r = 0; r < UnityFixture.RepeatCount; r++) + { + announceTestRun(r); + UnityBegin(); + runAllTests(); + UNITY_OUTPUT_CHAR('\n'); + UnityEnd(); + } + + return UnityFailureCount(); +} + +static int selected(const char * filter, const char * name) +{ + if (filter == 0) + return 1; + return strstr(name, filter) ? 1 : 0; +} + +static int testSelected(const char* test) +{ + return selected(UnityFixture.NameFilter, test); +} + +static int groupSelected(const char* group) +{ + return selected(UnityFixture.GroupFilter, group); +} + +static void runTestCase() +{ + +} + +void UnityTestRunner(unityfunction* setup, + unityfunction* testBody, + unityfunction* teardown, + const char * printableName, + const char * group, + const char * name, + const char * file, int line) +{ + if (testSelected(name) && groupSelected(group)) + { + Unity.CurrentTestFailed = 0; + Unity.TestFile = file; + Unity.CurrentTestName = printableName; + Unity.CurrentTestLineNumber = line; + if (!UnityFixture.Verbose) + UNITY_OUTPUT_CHAR('.'); + else + UnityPrint(printableName); + + Unity.NumberOfTests++; + UnityMalloc_StartTest(); + UnityPointer_Init(); + + runTestCase(); + if (TEST_PROTECT()) + { + setup(); + testBody(); + } + if (TEST_PROTECT()) + { + teardown(); + } + if (TEST_PROTECT()) + { + UnityPointer_UndoAllSets(); + if (!Unity.CurrentTestFailed) + UnityMalloc_EndTest(); + UnityConcludeFixtureTest(); + } + else + { + //aborting - jwg - di i need these for the other TEST_PROTECTS? + } + } +} + +void UnityIgnoreTest() +{ + Unity.NumberOfTests++; + Unity.CurrentTestIgnored = 1; + UNITY_OUTPUT_CHAR('!'); +} + + +//------------------------------------------------- +//Malloc and free stuff +// +#define MALLOC_DONT_FAIL -1 +static int malloc_count; +static int malloc_fail_countdown = MALLOC_DONT_FAIL; + +void UnityMalloc_StartTest() +{ + malloc_count = 0; + malloc_fail_countdown = MALLOC_DONT_FAIL; +} + +void UnityMalloc_EndTest() +{ + malloc_fail_countdown = MALLOC_DONT_FAIL; + if (malloc_count != 0) + { + TEST_FAIL_MESSAGE("This test leaks!"); + } +} + +void UnityMalloc_MakeMallocFailAfterCount(int countdown) +{ + malloc_fail_countdown = countdown; +} + +#ifdef malloc +#undef malloc +#endif + +#ifdef free +#undef free +#endif + +#include +#include + +typedef struct GuardBytes +{ + int size; + char guard[sizeof(int)]; +} Guard; + + +static const char * end = "END"; + +void * unity_malloc(size_t size) +{ + char* mem; + Guard* guard; + + if (malloc_fail_countdown != MALLOC_DONT_FAIL) + { + if (malloc_fail_countdown == 0) + return 0; + malloc_fail_countdown--; + } + + malloc_count++; + + guard = (Guard*)malloc(size + sizeof(Guard) + 4); + guard->size = size; + mem = (char*)&(guard[1]); + memcpy(&mem[size], end, strlen(end) + 1); + + return (void*)mem; +} + +static int isOverrun(void * mem) +{ + Guard* guard = (Guard*)mem; + char* memAsChar = (char*)mem; + guard--; + + return strcmp(&memAsChar[guard->size], end) != 0; +} + +static void release_memory(void * mem) +{ + Guard* guard = (Guard*)mem; + guard--; + + malloc_count--; + free(guard); +} + +void unity_free(void * mem) +{ + int overrun = isOverrun(mem);//strcmp(&memAsChar[guard->size], end) != 0; + release_memory(mem); + if (overrun) + { + TEST_FAIL_MESSAGE("Buffer overrun detected during free()"); + } +} + +void* unity_calloc(size_t num, size_t size) +{ + void* mem = unity_malloc(num * size); + memset(mem, 0, num*size); + return mem; +} + +void* unity_realloc(void * oldMem, size_t size) +{ + Guard* guard = (Guard*)oldMem; +// char* memAsChar = (char*)oldMem; + void* newMem; + + if (oldMem == 0) + return unity_malloc(size); + + guard--; + if (isOverrun(oldMem)) + { + release_memory(oldMem); + TEST_FAIL_MESSAGE("Buffer overrun detected during realloc()"); + } + + if (size == 0) + { + release_memory(oldMem); + return 0; + } + + if (guard->size >= size) + return oldMem; + + newMem = unity_malloc(size); + memcpy(newMem, oldMem, size); + unity_free(oldMem); + return newMem; +} + + +//-------------------------------------------------------- +//Automatic pointer restoration functions +typedef struct _PointerPair +{ + struct _PointerPair * next; + void ** pointer; + void * old_value; +} PointerPair; + +enum {MAX_POINTERS=50}; +static PointerPair pointer_store[MAX_POINTERS]; +static int pointer_index = 0; + +void UnityPointer_Init() +{ + pointer_index = 0; +} + +void UnityPointer_Set(void ** pointer, void * newValue) +{ + if (pointer_index >= MAX_POINTERS) + TEST_FAIL_MESSAGE("Too many pointers set"); + + pointer_store[pointer_index].pointer = pointer; + pointer_store[pointer_index].old_value = *pointer; + *pointer = newValue; + pointer_index++; +} + +void UnityPointer_UndoAllSets() +{ + while (pointer_index > 0) + { + pointer_index--; + *(pointer_store[pointer_index].pointer) = + pointer_store[pointer_index].old_value; + + } +} + +int UnityFailureCount() +{ + return Unity.TestFailures; +} + +int UnityGetCommandLineOptions(int argc, char* argv[]) +{ + int i; + UnityFixture.Verbose = 0; + UnityFixture.GroupFilter = 0; + UnityFixture.NameFilter = 0; + UnityFixture.RepeatCount = 1; + + if (argc == 1) + return 0; + + for (i = 1; i < argc; ) + { + if (strcmp(argv[i], "-v") == 0) + { + UnityFixture.Verbose = 1; + i++; + } + else if (strcmp(argv[i], "-g") == 0) + { + i++; + if (i >= argc) + return 1; + UnityFixture.GroupFilter = argv[i]; + i++; + } + else if (strcmp(argv[i], "-n") == 0) + { + i++; + if (i >= argc) + return 1; + UnityFixture.NameFilter = argv[i]; + i++; + } + else if (strcmp(argv[i], "-r") == 0) + { + UnityFixture.RepeatCount = 2; + i++; + if (i < argc) + { + if (*(argv[i]) >= '0' && *(argv[i]) <= '9') + { + UnityFixture.RepeatCount = atoi(argv[i]); + i++; + } + } + } + } + return 0; +} + +void UnityConcludeFixtureTest() +{ + if (Unity.CurrentTestIgnored) + { + Unity.TestIgnores++; + } + else if (!Unity.CurrentTestFailed) + { + if (UnityFixture.Verbose) + { + UnityPrint(" PASS"); + UNITY_OUTPUT_CHAR('\n'); + } + } + else if (Unity.CurrentTestFailed) + { + Unity.TestFailures++; + } + + Unity.CurrentTestFailed = 0; + Unity.CurrentTestIgnored = 0; +} + diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.h b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.h new file mode 100644 index 0000000..da1f871 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.h @@ -0,0 +1,81 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FIXTURE_H_ +#define UNITY_FIXTURE_H_ + +#include "unity.h" +#include "unity_internals.h" +#include "unity_fixture_malloc_overrides.h" +#include "unity_fixture_internals.h" + +int UnityMain(int argc, char* argv[], void (*runAllTests)()); + + +#define TEST_GROUP(group)\ + int TEST_GROUP_##group = 0 + +#define TEST_SETUP(group) void TEST_##group##_SETUP() + +#define TEST_TEAR_DOWN(group) void TEST_##group##_TEAR_DOWN() + + +#define TEST(group, name) \ + void TEST_##group##_##name##_();\ + void TEST_##group##_##name##_run()\ + {\ + UnityTestRunner(TEST_##group##_SETUP,\ + TEST_##group##_##name##_,\ + TEST_##group##_TEAR_DOWN,\ + "TEST(" #group ", " #name ")",\ + #group, #name,\ + __FILE__, __LINE__);\ + }\ + void TEST_##group##_##name##_() + +#define IGNORE_TEST(group, name) \ + void TEST_##group##_##name##_();\ + void TEST_##group##_##name##_run()\ + {\ + UnityIgnoreTest();\ + }\ + void TEST_##group##_##name##_() + +#define DECLARE_TEST_CASE(group, name) \ + void TEST_##group##_##name##_run() + +#define RUN_TEST_CASE(group, name) \ + DECLARE_TEST_CASE(group, name);\ + TEST_##group##_##name##_run(); + +//This goes at the bottom of each test file or in a separate c file +#define TEST_GROUP_RUNNER(group)\ + void TEST_##group##_GROUP_RUNNER_runAll();\ + void TEST_##group##_GROUP_RUNNER()\ + {\ + TEST_##group##_GROUP_RUNNER_runAll();\ + }\ + void TEST_##group##_GROUP_RUNNER_runAll() + +//Call this from main +#define RUN_TEST_GROUP(group)\ + void TEST_##group##_GROUP_RUNNER();\ + TEST_##group##_GROUP_RUNNER(); + +//CppUTest Compatibility Macros +#define UT_PTR_SET(ptr, newPointerValue) UnityPointer_Set((void**)&ptr, (void*)newPointerValue) +#define TEST_ASSERT_POINTERS_EQUAL(expected, actual) TEST_ASSERT_EQUAL_PTR(expected, actual) +#define TEST_ASSERT_BYTES_EQUAL(expected, actual) TEST_ASSERT_EQUAL_HEX8(0xff & (expected), 0xff & (actual)) +#define FAIL(message) TEST_FAIL((message)) +#define CHECK(condition) TEST_ASSERT_TRUE((condition)) +#define LONGS_EQUAL(expected, actual) TEST_ASSERT_EQUAL_INT((expected), (actual)) +#define STRCMP_EQUAL(expected, actual) TEST_ASSERT_EQUAL_STRING((expected), (actual)) +#define DOUBLES_EQUAL(expected, actual, delta) TEST_ASSERT_FLOAT_WITHIN(((expected), (actual), (delta)) + +void UnityMalloc_MakeMallocFailAfterCount(int count); + +#endif /* UNITY_FIXTURE_H_ */ diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h new file mode 100644 index 0000000..db23f67 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h @@ -0,0 +1,44 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FIXTURE_INTERNALS_H_ +#define UNITY_FIXTURE_INTERNALS_H_ + +typedef struct _UNITY_FIXTURE_T +{ + int Verbose; + unsigned int RepeatCount; + const char* NameFilter; + const char* GroupFilter; +} UNITY_FIXTURE_T; + +typedef void unityfunction(); +void UnityTestRunner(unityfunction * setup, + unityfunction * body, + unityfunction * teardown, + const char * printableName, + const char * group, + const char * name, + const char * file, int line); + +void UnityIgnoreTest(); +void UnityMalloc_StartTest(); +void UnityMalloc_EndTest(); +int UnityFailureCount(); +int UnityGetCommandLineOptions(int argc, char* argv[]); +void UnityConcludeFixtureTest(); + +void UnityPointer_Set(void ** ptr, void * newValue); +void UnityPointer_UndoAllSets(); +void UnityPointer_Init(); + +void UnityAssertEqualPointer(const void * expected, + const void * actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +#endif /* UNITY_FIXTURE_INTERNALS_H_ */ diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h new file mode 100644 index 0000000..38f8e34 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h @@ -0,0 +1,16 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FIXTURE_MALLOC_OVERRIDES_H_ +#define UNITY_FIXTURE_MALLOC_OVERRIDES_H_ + +#define malloc unity_malloc +#define calloc unity_calloc +#define realloc unity_realloc +#define free unity_free + +#endif /* UNITY_FIXTURE_MALLOC_OVERRIDES_H_ */ diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/main/AllTests.c b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/main/AllTests.c new file mode 100644 index 0000000..ccb775b --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/main/AllTests.c @@ -0,0 +1,21 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" + +static void runAllTests() +{ + RUN_TEST_GROUP(UnityFixture); + RUN_TEST_GROUP(UnityCommandOptions); + RUN_TEST_GROUP(LeakDetection) +} + +int main(int argc, char* argv[]) +{ + return UnityMain(argc, argv, runAllTests); +} + diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/testunity_fixture.c b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/testunity_fixture.c new file mode 100644 index 0000000..de0c04c --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/testunity_fixture.c @@ -0,0 +1,39 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" + +static int data = -1; + +TEST_GROUP(mygroup); + +TEST_SETUP(mygroup) +{ + data = 0; +} + +TEST_TEAR_DOWN(mygroup) +{ + data = -1; +} + +TEST(mygroup, test1) +{ + TEST_ASSERT_EQUAL_INT(0, data); +} + +TEST(mygroup, test2) +{ + TEST_ASSERT_EQUAL_INT(0, data); + data = 5; +} + +TEST(mygroup, test3) +{ + data = 7; + TEST_ASSERT_EQUAL_INT(7, data); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c new file mode 100644 index 0000000..b8b4524 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c @@ -0,0 +1,321 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" +#include "unity_output_Spy.h" +#include +#include + +extern UNITY_FIXTURE_T UnityFixture; + +TEST_GROUP(UnityFixture); + +TEST_SETUP(UnityFixture) +{ +} + +TEST_TEAR_DOWN(UnityFixture) +{ +} + +int my_int; +int* pointer1 = 0; +int* pointer2 = (int*)2; +int* pointer3 = (int*)3; +int int1; +int int2; +int int3; +int int4; + +TEST(UnityFixture, PointerSetting) +{ + TEST_ASSERT_POINTERS_EQUAL(pointer1, 0); + UT_PTR_SET(pointer1, &int1); + UT_PTR_SET(pointer2, &int2); + UT_PTR_SET(pointer3, &int3); + TEST_ASSERT_POINTERS_EQUAL(pointer1, &int1); + TEST_ASSERT_POINTERS_EQUAL(pointer2, &int2); + TEST_ASSERT_POINTERS_EQUAL(pointer3, &int3); + UT_PTR_SET(pointer1, &int4); + UnityPointer_UndoAllSets(); + TEST_ASSERT_POINTERS_EQUAL(pointer1, 0); + TEST_ASSERT_POINTERS_EQUAL(pointer2, (int*)2); + TEST_ASSERT_POINTERS_EQUAL(pointer3, (int*)3); +} + +TEST(UnityFixture, ForceMallocFail) +{ + UnityMalloc_MakeMallocFailAfterCount(1); + void* m = malloc(10); + CHECK(m); + void* mfails = malloc(10); + TEST_ASSERT_POINTERS_EQUAL(0, mfails); + free(m); +} + +TEST(UnityFixture, ReallocSmallerIsUnchanged) +{ + void* m1 = malloc(10); + void* m2 = realloc(m1, 5); + TEST_ASSERT_POINTERS_EQUAL(m1, m2); + free(m2); +} + +TEST(UnityFixture, ReallocSameIsUnchanged) +{ + void* m1 = malloc(10); + void* m2 = realloc(m1, 10); + TEST_ASSERT_POINTERS_EQUAL(m1, m2); + free(m2); +} + +TEST(UnityFixture, ReallocLargerNeeded) +{ + void* m1 = malloc(10); + strcpy((char*)m1, "123456789"); + void* m2 = realloc(m1, 15); + CHECK(m1 != m2); + STRCMP_EQUAL("123456789", m2); + free(m2); +} + +TEST(UnityFixture, ReallocNullPointerIsLikeMalloc) +{ + void* m = realloc(0, 15); + CHECK(m != 0); + free(m); +} + +TEST(UnityFixture, ReallocSizeZeroFreesMemAndReturnsNullPointer) +{ + void* m1 = malloc(10); + void* m2 = realloc(m1, 0); + TEST_ASSERT_POINTERS_EQUAL(0, m2); +} + +TEST(UnityFixture, CallocFillsWithZero) +{ + void* m = calloc(3, sizeof(char)); + char* s = (char*)m; + TEST_ASSERT_BYTES_EQUAL(0, s[0]); + TEST_ASSERT_BYTES_EQUAL(0, s[1]); + TEST_ASSERT_BYTES_EQUAL(0, s[2]); + free(m); +} + +char *p1; +char *p2; + +TEST(UnityFixture, PointerSet) +{ + char c1; + char c2; + char newC1; + char newC2; + p1 = &c1; + p2 = &c2; + + UnityPointer_Init(10); + UT_PTR_SET(p1, &newC1); + UT_PTR_SET(p2, &newC2); + TEST_ASSERT_POINTERS_EQUAL(&newC1, p1); + TEST_ASSERT_POINTERS_EQUAL(&newC2, p2); + UnityPointer_UndoAllSets(); + TEST_ASSERT_POINTERS_EQUAL(&c1, p1); + TEST_ASSERT_POINTERS_EQUAL(&c2, p2); +} + +//------------------------------------------------------------ + +TEST_GROUP(UnityCommandOptions); + +int savedVerbose; +int savedRepeat; +const char* savedName; +const char* savedGroup; + +TEST_SETUP(UnityCommandOptions) +{ + savedVerbose = UnityFixture.Verbose; + savedRepeat = UnityFixture.RepeatCount; + savedName = UnityFixture.NameFilter; + savedGroup = UnityFixture.GroupFilter; +} + +TEST_TEAR_DOWN(UnityCommandOptions) +{ + UnityFixture.Verbose = savedVerbose; + UnityFixture.RepeatCount= savedRepeat; + UnityFixture.NameFilter = savedName; + UnityFixture.GroupFilter = savedGroup; +} + + +static char* noOptions[] = { + "testrunner.exe" +}; + +TEST(UnityCommandOptions, DefaultOptions) +{ + UnityGetCommandLineOptions(1, noOptions); + TEST_ASSERT_EQUAL(0, UnityFixture.Verbose); + TEST_ASSERT_POINTERS_EQUAL(0, UnityFixture.GroupFilter); + TEST_ASSERT_POINTERS_EQUAL(0, UnityFixture.NameFilter); + TEST_ASSERT_EQUAL(1, UnityFixture.RepeatCount); +} + +static char* verbose[] = { + "testrunner.exe", + "-v" +}; + +TEST(UnityCommandOptions, OptionVerbose) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(2, verbose)); + TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); +} + +static char* group[] = { + "testrunner.exe", + "-g", "groupname" +}; + +TEST(UnityCommandOptions, OptionSelectTestByGroup) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, group)); + STRCMP_EQUAL("groupname", UnityFixture.GroupFilter); +} + +static char* name[] = { + "testrunner.exe", + "-n", "testname" +}; + +TEST(UnityCommandOptions, OptionSelectTestByName) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, name)); + STRCMP_EQUAL("testname", UnityFixture.NameFilter); +} + +static char* repeat[] = { + "testrunner.exe", + "-r", "99" +}; + +TEST(UnityCommandOptions, OptionSelectRepeatTestsDefaultCount) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(2, repeat)); + TEST_ASSERT_EQUAL(2, UnityFixture.RepeatCount); +} + +TEST(UnityCommandOptions, OptionSelectRepeatTestsSpecificCount) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, repeat)); + TEST_ASSERT_EQUAL(99, UnityFixture.RepeatCount); +} + +static char* multiple[] = { + "testrunner.exe", + "-v", + "-g", "groupname", + "-n", "testname", + "-r", "98" +}; + +TEST(UnityCommandOptions, MultipleOptions) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(8, multiple)); + TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); + STRCMP_EQUAL("groupname", UnityFixture.GroupFilter); + STRCMP_EQUAL("testname", UnityFixture.NameFilter); + TEST_ASSERT_EQUAL(98, UnityFixture.RepeatCount); +} + +static char* dashRNotLast[] = { + "testrunner.exe", + "-v", + "-g", "gggg", + "-r", + "-n", "tttt", +}; + +TEST(UnityCommandOptions, MultipleOptionsDashRNotLastAndNoValueSpecified) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(7, dashRNotLast)); + TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); + STRCMP_EQUAL("gggg", UnityFixture.GroupFilter); + STRCMP_EQUAL("tttt", UnityFixture.NameFilter); + TEST_ASSERT_EQUAL(2, UnityFixture.RepeatCount); +} + + +//------------------------------------------------------------ + +TEST_GROUP(LeakDetection); + +TEST_SETUP(LeakDetection) +{ + UnityOutputCharSpy_Create(1000); +} + +TEST_TEAR_DOWN(LeakDetection) +{ + UnityOutputCharSpy_Destroy(); +} + +#define EXPECT_ABORT_BEGIN \ + { \ + jmp_buf TestAbortFrame; \ + memcpy(TestAbortFrame, Unity.AbortFrame, sizeof(jmp_buf)); \ + if (TEST_PROTECT()) \ + { + +#define EXPECT_ABORT_END \ + } \ + memcpy(Unity.AbortFrame, TestAbortFrame, sizeof(jmp_buf)); \ + } + +TEST(LeakDetection, DetectsLeak) +{ + void* m = malloc(10); + UnityOutputCharSpy_Enable(1); + EXPECT_ABORT_BEGIN + UnityMalloc_EndTest(); + EXPECT_ABORT_END + UnityOutputCharSpy_Enable(0); + CHECK(strstr(UnityOutputCharSpy_Get(), "This test leaks!")); + free(m); + Unity.CurrentTestFailed = 0; +} + +TEST(LeakDetection, BufferOverrunFoundDuringFree) +{ + void* m = malloc(10); + char* s = (char*)m; + s[10] = (char)0xFF; + UnityOutputCharSpy_Enable(1); + EXPECT_ABORT_BEGIN + free(m); + EXPECT_ABORT_END + UnityOutputCharSpy_Enable(0); + CHECK(strstr(UnityOutputCharSpy_Get(), "Buffer overrun detected during free()")); + Unity.CurrentTestFailed = 0; +} + +TEST(LeakDetection, BufferOverrunFoundDuringRealloc) +{ + void* m = malloc(10); + char* s = (char*)m; + s[10] = (char)0xFF; + UnityOutputCharSpy_Enable(1); + EXPECT_ABORT_BEGIN + m = realloc(m, 100); + EXPECT_ABORT_END + UnityOutputCharSpy_Enable(0); + CHECK(strstr(UnityOutputCharSpy_Get(), "Buffer overrun detected during realloc()")); + Unity.CurrentTestFailed = 0; +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c new file mode 100644 index 0000000..80fec09 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c @@ -0,0 +1,40 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" + +TEST_GROUP_RUNNER(UnityFixture) +{ + RUN_TEST_CASE(UnityFixture, PointerSetting); + RUN_TEST_CASE(UnityFixture, ForceMallocFail); + RUN_TEST_CASE(UnityFixture, ReallocSmallerIsUnchanged); + RUN_TEST_CASE(UnityFixture, ReallocSameIsUnchanged); + RUN_TEST_CASE(UnityFixture, ReallocLargerNeeded); + RUN_TEST_CASE(UnityFixture, ReallocNullPointerIsLikeMalloc); + RUN_TEST_CASE(UnityFixture, ReallocSizeZeroFreesMemAndReturnsNullPointer); + RUN_TEST_CASE(UnityFixture, CallocFillsWithZero); + RUN_TEST_CASE(UnityFixture, PointerSet); +} + +TEST_GROUP_RUNNER(UnityCommandOptions) +{ + RUN_TEST_CASE(UnityCommandOptions, DefaultOptions); + RUN_TEST_CASE(UnityCommandOptions, OptionVerbose); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectTestByGroup); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectTestByName); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectRepeatTestsDefaultCount); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectRepeatTestsSpecificCount); + RUN_TEST_CASE(UnityCommandOptions, MultipleOptions); + RUN_TEST_CASE(UnityCommandOptions, MultipleOptionsDashRNotLastAndNoValueSpecified); +} + +TEST_GROUP_RUNNER(LeakDetection) +{ + RUN_TEST_CASE(LeakDetection, DetectsLeak); + RUN_TEST_CASE(LeakDetection, BufferOverrunFoundDuringFree); + RUN_TEST_CASE(LeakDetection, BufferOverrunFoundDuringRealloc); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.c b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.c new file mode 100644 index 0000000..16faefa --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.c @@ -0,0 +1,56 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + + +#include "unity_output_Spy.h" +#include +#include +#include + +static int size; +static int count; +static char* buffer; +static int spy_enable; + +void UnityOutputCharSpy_Create(int s) +{ + size = s; + count = 0; + spy_enable = 0; + buffer = malloc(size); + memset(buffer, 0, size); +} + +void UnityOutputCharSpy_Destroy() +{ + size = 0; + free(buffer); +} + +int UnityOutputCharSpy_OutputChar(int c) +{ + if (spy_enable) + { + if (count < (size-1)) + buffer[count++] = c; + } + else + { + putchar(c); + } + return c; +} + +const char * UnityOutputCharSpy_Get() +{ + return buffer; +} + +void UnityOutputCharSpy_Enable(int enable) +{ + spy_enable = enable; +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.h b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.h new file mode 100644 index 0000000..7c1590e --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.h @@ -0,0 +1,17 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef D_unity_output_Spy_H +#define D_unity_output_Spy_H + +void UnityOutputCharSpy_Create(int s); +void UnityOutputCharSpy_Destroy(); +int UnityOutputCharSpy_OutputChar(int c); +const char * UnityOutputCharSpy_Get(); +void UnityOutputCharSpy_Enable(int enable); + +#endif diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/makefile b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/makefile new file mode 100644 index 0000000..8c8444b --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/makefile @@ -0,0 +1,35 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +C_COMPILER=gcc +TARGET_BASE = testunity +ifeq ($(OS),Windows_NT) + TARGET_EXTENSION=.exe +else + TARGET_EXTENSION=.out +endif +TARGET = $(TARGET_BASE)$(TARGET_EXTENSION) +OUT_FILE=-o $(TARGET) +SRC_FILES=src/unity.c test/testunity.c build/testunity_Runner.c +INC_DIRS=-Isrc +SYMBOLS=-DTEST -DUNITY_SUPPORT_64 + +ifeq ($(OS),Windows_NT) + CLEANUP = del /F /Q build\* && del /F /Q $(TARGET) +else + CLEANUP = rm -f build/*.o ; rm -f $(TARGET) +endif + +all: clean default + +default: + ruby auto/generate_test_runner.rb test/testunity.c build/testunity_Runner.c + $(C_COMPILER) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES) $(OUT_FILE) + $(TARGET) + +clean: + $(CLEANUP) + diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/rakefile.rb b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/rakefile.rb new file mode 100644 index 0000000..3ec5d5a --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/rakefile.rb @@ -0,0 +1,48 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require HERE + 'rakefile_helper' + +include RakefileHelpers + +# Load default configuration, for now +DEFAULT_CONFIG_FILE = 'gcc.yml' +configure_toolchain(DEFAULT_CONFIG_FILE) + +desc "Test unity with its own unit tests" +task :unit do + run_tests get_unit_test_files +end + +Rake::TestTask.new(:scripts) do |t| + t.pattern = 'test/test_*.rb' + t.verbose = true +end + +desc "Generate test summary" +task :summary do + report_summary +end + +desc "Build and test Unity" +task :all => [:clean, :scripts, :unit, :summary] +task :default => [:clobber, :all] +task :ci => [:no_color, :default] +task :cruise => [:no_color, :default] + +desc "Load configuration" +task :config, :config_file do |t, args| + configure_toolchain(args[:config_file]) +end + +task :no_color do + $colour_output = false +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/rakefile_helper.rb b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/rakefile_helper.rb new file mode 100644 index 0000000..218fcaa --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/rakefile_helper.rb @@ -0,0 +1,243 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require 'yaml' +require 'fileutils' +require HERE+'auto/unity_test_summary' +require HERE+'auto/generate_test_runner' +require HERE+'auto/colour_reporter' + +module RakefileHelpers + + C_EXTENSION = '.c' + + def load_configuration(config_file) + unless ($configured) + $cfg_file = "targets/#{config_file}" unless (config_file =~ /[\\|\/]/) + $cfg = YAML.load(File.read($cfg_file)) + $colour_output = false unless $cfg['colour'] + $configured = true if (config_file != DEFAULT_CONFIG_FILE) + end + end + + def configure_clean + CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil? + end + + def configure_toolchain(config_file=DEFAULT_CONFIG_FILE) + config_file += '.yml' unless config_file =~ /\.yml$/ + config_file = config_file unless config_file =~ /[\\|\/]/ + load_configuration(config_file) + configure_clean + end + + def get_unit_test_files + path = $cfg['compiler']['unit_tests_path'] + 'test*' + C_EXTENSION + path.gsub!(/\\/, '/') + FileList.new(path) + end + + def get_local_include_dirs + include_dirs = $cfg['compiler']['includes']['items'].dup + include_dirs.delete_if {|dir| dir.is_a?(Array)} + return include_dirs + end + + def extract_headers(filename) + includes = [] + lines = File.readlines(filename) + lines.each do |line| + m = line.match(/^\s*#include\s+\"\s*(.+\.[hH])\s*\"/) + if not m.nil? + includes << m[1] + end + end + return includes + end + + def find_source_file(header, paths) + paths.each do |dir| + src_file = dir + header.ext(C_EXTENSION) + if (File.exists?(src_file)) + return src_file + end + end + return nil + end + + def tackit(strings) + if strings.is_a?(Array) + result = "\"#{strings.join}\"" + else + result = strings + end + return result + end + + def squash(prefix, items) + result = '' + items.each { |item| result += " #{prefix}#{tackit(item)}" } + return result + end + + def build_compiler_fields + command = tackit($cfg['compiler']['path']) + if $cfg['compiler']['defines']['items'].nil? + defines = '' + else + defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items']) + end + options = squash('', $cfg['compiler']['options']) + includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :defines => defines, :options => options, :includes => includes} + end + + def compile(file, defines=[]) + compiler = build_compiler_fields + cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{file} " + + "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" + + "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" + execute(cmd_str) + end + + def build_linker_fields + command = tackit($cfg['linker']['path']) + if $cfg['linker']['options'].nil? + options = '' + else + options = squash('', $cfg['linker']['options']) + end + if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?) + includes = '' + else + includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) + end + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :options => options, :includes => includes} + end + + def link(exe_name, obj_list) + linker = build_linker_fields + cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + + (obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).join + + $cfg['linker']['bin_files']['prefix'] + ' ' + + $cfg['linker']['bin_files']['destination'] + + exe_name + $cfg['linker']['bin_files']['extension'] + execute(cmd_str) + end + + def build_simulator_fields + return nil if $cfg['simulator'].nil? + if $cfg['simulator']['path'].nil? + command = '' + else + command = (tackit($cfg['simulator']['path']) + ' ') + end + if $cfg['simulator']['pre_support'].nil? + pre_support = '' + else + pre_support = squash('', $cfg['simulator']['pre_support']) + end + if $cfg['simulator']['post_support'].nil? + post_support = '' + else + post_support = squash('', $cfg['simulator']['post_support']) + end + return {:command => command, :pre_support => pre_support, :post_support => post_support} + end + + def execute(command_string, verbose=true) + report command_string + output = `#{command_string}`.chomp + report(output) if (verbose && !output.nil? && (output.length > 0)) + if $?.exitstatus != 0 + raise "Command failed. (Returned #{$?.exitstatus})" + end + return output + end + + def report_summary + summary = UnityTestSummary.new + summary.set_root_path(HERE) + results_glob = "#{$cfg['compiler']['build_path']}*.test*" + results_glob.gsub!(/\\/, '/') + results = Dir[results_glob] + summary.set_targets(results) + summary.run + end + + def run_tests(test_files) + report 'Running Unity system tests...' + + # Tack on TEST define for compiling unit tests + load_configuration($cfg_file) + test_defines = ['TEST'] + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + $cfg['compiler']['defines']['items'] << 'TEST' + + include_dirs = get_local_include_dirs + + # Build and execute each unit test + test_files.each do |test| + obj_list = [] + + # Detect dependencies and build required modules + extract_headers(test).each do |header| + # Compile corresponding source file if it exists + src_file = find_source_file(header, include_dirs) + if !src_file.nil? + compile(src_file, test_defines) + obj_list << header.ext($cfg['compiler']['object_files']['extension']) + end + end + + # Build the test runner (generate if configured to do so) + test_base = File.basename(test, C_EXTENSION) + + runner_name = test_base + '_Runner.c' + runner_path = '' + + if $cfg['compiler']['runner_path'].nil? + runner_path = $cfg['compiler']['build_path'] + runner_name + else + runner_path = $cfg['compiler']['runner_path'] + runner_name + end + + options = $cfg[:unity] + options[:use_param_tests] = (test =~ /parameterized/) ? true : false + UnityTestRunnerGenerator.new(options).run(test, runner_path) + + compile(runner_path, test_defines) + obj_list << runner_name.ext($cfg['compiler']['object_files']['extension']) + + # Build the test module + compile(test, test_defines) + obj_list << test_base.ext($cfg['compiler']['object_files']['extension']) + + # Link the test executable + link(test_base, obj_list) + + # Execute unit test and generate results file + simulator = build_simulator_fields + executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] + if simulator.nil? + cmd_str = executable + else + cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" + end + output = execute(cmd_str) + test_results = $cfg['compiler']['build_path'] + test_base + if output.match(/OK$/m).nil? + test_results += '.testfail' + else + test_results += '.testpass' + end + File.open(test_results, 'w') { |f| f.print output } + + end + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/release/build.info b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/release/build.info new file mode 100644 index 0000000..7871b21 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/release/build.info @@ -0,0 +1,2 @@ +118 + diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/release/version.info b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/release/version.info new file mode 100644 index 0000000..0d71c08 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/release/version.info @@ -0,0 +1,2 @@ +2.0 + diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/src/unity.c b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/src/unity.c new file mode 100644 index 0000000..d85b880 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/src/unity.c @@ -0,0 +1,855 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity.h" +#include +#include + +#define UNITY_FAIL_AND_BAIL { Unity.CurrentTestFailed = 1; UNITY_OUTPUT_CHAR('\n'); longjmp(Unity.AbortFrame, 1); } +#define UNITY_IGNORE_AND_BAIL { Unity.CurrentTestIgnored = 1; UNITY_OUTPUT_CHAR('\n'); longjmp(Unity.AbortFrame, 1); } +/// return prematurely if we are already in failure or ignore state +#define UNITY_SKIP_EXECUTION { if ((Unity.CurrentTestFailed != 0) || (Unity.CurrentTestIgnored != 0)) {return;} } +#define UNITY_PRINT_EOL { UNITY_OUTPUT_CHAR('\n'); } + +struct _Unity Unity = { 0 }; + +const char* UnityStrNull = "NULL"; +const char* UnityStrSpacer = ". "; +const char* UnityStrExpected = " Expected "; +const char* UnityStrWas = " Was "; +const char* UnityStrTo = " To "; +const char* UnityStrElement = " Element "; +const char* UnityStrMemory = " Memory Mismatch"; +const char* UnityStrDelta = " Values Not Within Delta "; +const char* UnityStrPointless= " You Asked Me To Compare Nothing, Which Was Pointless."; +const char* UnityStrNullPointerForExpected= " Expected pointer to be NULL"; +const char* UnityStrNullPointerForActual = " Actual pointer was NULL"; + +const _U_UINT UnitySizeMask[] = +{ + 255, + 65535, + 65535, + 4294967295, + 4294967295, + 4294967295, + 4294967295 +#ifdef UNITY_SUPPORT_64 + ,0xFFFFFFFFFFFFFFFF +#endif +}; + +//----------------------------------------------- +// Pretty Printers & Test Result Output Handlers +//----------------------------------------------- + +void UnityPrint(const char* string) +{ + const char* pch = string; + + if (pch != NULL) + { + while (*pch) + { + // printable characters plus CR & LF are printed + if ((*pch <= 126) && (*pch >= 32)) + { + UNITY_OUTPUT_CHAR(*pch); + } + //write escaped carriage returns + else if (*pch == 13) + { + UNITY_OUTPUT_CHAR('\\'); + UNITY_OUTPUT_CHAR('r'); + } + //write escaped line feeds + else if (*pch == 10) + { + UNITY_OUTPUT_CHAR('\\'); + UNITY_OUTPUT_CHAR('n'); + } + // unprintable characters are shown as codes + else + { + UNITY_OUTPUT_CHAR('\\'); + UnityPrintNumberHex((_U_SINT)*pch, 2); + } + pch++; + } + } +} + +//----------------------------------------------- +void UnityPrintNumberByStyle(const _U_SINT number, const UNITY_DISPLAY_STYLE_T style) +{ + if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT) + { + UnityPrintNumber(number); + } + else if ((style & UNITY_DISPLAY_RANGE_UINT) == UNITY_DISPLAY_RANGE_UINT) + { + UnityPrintNumberUnsigned( (_U_UINT)number & UnitySizeMask[((_U_UINT)style & (_U_UINT)0x0F) - 1] ); + } + else + { + UnityPrintNumberHex((_U_UINT)number, (style & 0x000F) << 1); + } +} + +//----------------------------------------------- +/// basically do an itoa using as little ram as possible +void UnityPrintNumber(const _U_SINT number_to_print) +{ + _U_SINT divisor = 1; + _U_SINT next_divisor; + _U_SINT number = number_to_print; + + if (number < 0) + { + UNITY_OUTPUT_CHAR('-'); + number = -number; + } + + // figure out initial divisor + while (number / divisor > 9) + { + next_divisor = divisor * 10; + if (next_divisor > divisor) + divisor = next_divisor; + else + break; + } + + // now mod and print, then divide divisor + do + { + UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10))); + divisor /= 10; + } + while (divisor > 0); +} + +//----------------------------------------------- +/// basically do an itoa using as little ram as possible +void UnityPrintNumberUnsigned(const _U_UINT number) +{ + _U_UINT divisor = 1; + _U_UINT next_divisor; + + // figure out initial divisor + while (number / divisor > 9) + { + next_divisor = divisor * 10; + if (next_divisor > divisor) + divisor = next_divisor; + else + break; + } + + // now mod and print, then divide divisor + do + { + UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10))); + divisor /= 10; + } + while (divisor > 0); +} + +//----------------------------------------------- +void UnityPrintNumberHex(const _U_UINT number, const char nibbles_to_print) +{ + _U_UINT nibble; + char nibbles = nibbles_to_print; + UNITY_OUTPUT_CHAR('0'); + UNITY_OUTPUT_CHAR('x'); + + while (nibbles > 0) + { + nibble = (number >> (--nibbles << 2)) & 0x0000000F; + if (nibble <= 9) + { + UNITY_OUTPUT_CHAR((char)('0' + nibble)); + } + else + { + UNITY_OUTPUT_CHAR((char)('A' - 10 + nibble)); + } + } +} + +//----------------------------------------------- +void UnityPrintMask(const _U_UINT mask, const _U_UINT number) +{ + _U_UINT current_bit = (_U_UINT)1 << (UNITY_INT_WIDTH - 1); + _US32 i; + + for (i = 0; i < UNITY_INT_WIDTH; i++) + { + if (current_bit & mask) + { + if (current_bit & number) + { + UNITY_OUTPUT_CHAR('1'); + } + else + { + UNITY_OUTPUT_CHAR('0'); + } + } + else + { + UNITY_OUTPUT_CHAR('X'); + } + current_bit = current_bit >> 1; + } +} + +//----------------------------------------------- +#ifdef UNITY_FLOAT_VERBOSE +void UnityPrintFloat(_UF number) +{ + char TempBuffer[32]; + sprintf(TempBuffer, "%.6f", number); + UnityPrint(TempBuffer); +} +#endif + +//----------------------------------------------- +void UnityTestResultsBegin(const char* file, const UNITY_LINE_TYPE line) +{ + UnityPrint(file); + UNITY_OUTPUT_CHAR(':'); + UnityPrintNumber(line); + UNITY_OUTPUT_CHAR(':'); + UnityPrint(Unity.CurrentTestName); + UNITY_OUTPUT_CHAR(':'); +} + +//----------------------------------------------- +void UnityTestResultsFailBegin(const UNITY_LINE_TYPE line) +{ + UnityTestResultsBegin(Unity.TestFile, line); + UnityPrint("FAIL:"); +} + +//----------------------------------------------- +void UnityConcludeTest(void) +{ + if (Unity.CurrentTestIgnored) + { + Unity.TestIgnores++; + } + else if (!Unity.CurrentTestFailed) + { + UnityTestResultsBegin(Unity.TestFile, Unity.CurrentTestLineNumber); + UnityPrint("PASS"); + UNITY_PRINT_EOL; + } + else + { + Unity.TestFailures++; + } + + Unity.CurrentTestFailed = 0; + Unity.CurrentTestIgnored = 0; +} + +//----------------------------------------------- +void UnityAddMsgIfSpecified(const char* msg) +{ + if (msg) + { + UnityPrint(UnityStrSpacer); + UnityPrint(msg); + } +} + +//----------------------------------------------- +void UnityPrintExpectedAndActualStrings(const char* expected, const char* actual) +{ + UnityPrint(UnityStrExpected); + if (expected != NULL) + { + UNITY_OUTPUT_CHAR('\''); + UnityPrint(expected); + UNITY_OUTPUT_CHAR('\''); + } + else + { + UnityPrint(UnityStrNull); + } + UnityPrint(UnityStrWas); + if (actual != NULL) + { + UNITY_OUTPUT_CHAR('\''); + UnityPrint(actual); + UNITY_OUTPUT_CHAR('\''); + } + else + { + UnityPrint(UnityStrNull); + } +} + +//----------------------------------------------- +// Assertion & Control Helpers +//----------------------------------------------- + +int UnityCheckArraysForNull(const void* expected, const void* actual, const UNITY_LINE_TYPE lineNumber, const char* msg) +{ + //return true if they are both NULL + if ((expected == NULL) && (actual == NULL)) + return 1; + + //throw error if just expected is NULL + if (expected == NULL) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrNullPointerForExpected); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + //throw error if just actual is NULL + if (actual == NULL) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrNullPointerForActual); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + //return false if neither is NULL + return 0; +} + +//----------------------------------------------- +// Assertion Functions +//----------------------------------------------- + +void UnityAssertBits(const _U_SINT mask, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + UNITY_SKIP_EXECUTION; + + if ((mask & expected) != (mask & actual)) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrExpected); + UnityPrintMask(mask, expected); + UnityPrint(UnityStrWas); + UnityPrintMask(mask, actual); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualNumber(const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style) +{ + UNITY_SKIP_EXECUTION; + + if (expected != actual) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(expected, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(actual, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualIntArray(const _U_SINT* expected, + const _U_SINT* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style) +{ + _UU32 elements = num_elements; + const _US8* ptr_exp = (_US8*)expected; + const _US8* ptr_act = (_US8*)actual; + + UNITY_SKIP_EXECUTION; + + if (elements == 0) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + switch(style) + { + case UNITY_DISPLAY_STYLE_HEX8: + case UNITY_DISPLAY_STYLE_INT8: + case UNITY_DISPLAY_STYLE_UINT8: + while (elements--) + { + if (*ptr_exp != *ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 1; + ptr_act += 1; + } + break; + case UNITY_DISPLAY_STYLE_HEX16: + case UNITY_DISPLAY_STYLE_INT16: + case UNITY_DISPLAY_STYLE_UINT16: + while (elements--) + { + if (*(_US16*)ptr_exp != *(_US16*)ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*(_US16*)ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*(_US16*)ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 2; + ptr_act += 2; + } + break; +#ifdef UNITY_SUPPORT_64 + case UNITY_DISPLAY_STYLE_HEX64: + case UNITY_DISPLAY_STYLE_INT64: + case UNITY_DISPLAY_STYLE_UINT64: + while (elements--) + { + if (*(_US64*)ptr_exp != *(_US64*)ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*(_US64*)ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*(_US64*)ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 8; + ptr_act += 8; + } + break; +#endif + default: + while (elements--) + { + if (*(_US32*)ptr_exp != *(_US32*)ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*(_US32*)ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*(_US32*)ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 4; + ptr_act += 4; + } + break; + } +} + +//----------------------------------------------- +#ifndef UNITY_EXCLUDE_FLOAT +void UnityAssertEqualFloatArray(const _UF* expected, + const _UF* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UU32 elements = num_elements; + const _UF* ptr_expected = expected; + const _UF* ptr_actual = actual; + _UF diff, tol; + + UNITY_SKIP_EXECUTION; + + if (elements == 0) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + while (elements--) + { + diff = *ptr_expected - *ptr_actual; + if (diff < 0.0) + diff = 0.0 - diff; + tol = UNITY_FLOAT_PRECISION * *ptr_expected; + if (tol < 0.0) + tol = 0.0 - tol; + if (diff > tol) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); +#ifdef UNITY_FLOAT_VERBOSE + UnityPrint(UnityStrExpected); + UnityPrintFloat(*ptr_expected); + UnityPrint(UnityStrWas); + UnityPrintFloat(*ptr_actual); +#else + UnityPrint(UnityStrDelta); +#endif + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_expected++; + ptr_actual++; + } +} + +//----------------------------------------------- +void UnityAssertFloatsWithin(const _UF delta, + const _UF expected, + const _UF actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UF diff = actual - expected; + _UF pos_delta = delta; + + UNITY_SKIP_EXECUTION; + + if (diff < 0) + { + diff = 0.0f - diff; + } + if (pos_delta < 0) + { + pos_delta = 0.0f - pos_delta; + } + + if (pos_delta < diff) + { + UnityTestResultsFailBegin(lineNumber); +#ifdef UNITY_FLOAT_VERBOSE + UnityPrint(UnityStrExpected); + UnityPrintFloat(expected); + UnityPrint(UnityStrWas); + UnityPrintFloat(actual); +#else + UnityPrint(UnityStrDelta); +#endif + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} +#endif + +//----------------------------------------------- +void UnityAssertNumbersWithin( const _U_SINT delta, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style) +{ + UNITY_SKIP_EXECUTION; + + if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT) + { + if (actual > expected) + Unity.CurrentTestFailed = ((actual - expected) > delta); + else + Unity.CurrentTestFailed = ((expected - actual) > delta); + } + else + { + if ((_U_UINT)actual > (_U_UINT)expected) + Unity.CurrentTestFailed = ((_U_UINT)(actual - expected) > (_U_UINT)delta); + else + Unity.CurrentTestFailed = ((_U_UINT)(expected - actual) > (_U_UINT)delta); + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrDelta); + UnityPrintNumberByStyle(delta, style); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(expected, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(actual, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualString(const char* expected, + const char* actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UU32 i; + + UNITY_SKIP_EXECUTION; + + // if both pointers not null compare the strings + if (expected && actual) + { + for (i = 0; expected[i] || actual[i]; i++) + { + if (expected[i] != actual[i]) + { + Unity.CurrentTestFailed = 1; + break; + } + } + } + else + { // handle case of one pointers being null (if both null, test should pass) + if (expected != actual) + { + Unity.CurrentTestFailed = 1; + } + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrintExpectedAndActualStrings(expected, actual); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualStringArray( const char** expected, + const char** actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UU32 i, j = 0; + + UNITY_SKIP_EXECUTION; + + // if no elements, it's an error + if (num_elements == 0) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + do + { + // if both pointers not null compare the strings + if (expected[j] && actual[j]) + { + for (i = 0; expected[j][i] || actual[j][i]; i++) + { + if (expected[j][i] != actual[j][i]) + { + Unity.CurrentTestFailed = 1; + break; + } + } + } + else + { // handle case of one pointers being null (if both null, test should pass) + if (expected[j] != actual[j]) + { + Unity.CurrentTestFailed = 1; + } + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + if (num_elements > 1) + { + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - j - 1), UNITY_DISPLAY_STYLE_UINT); + } + UnityPrintExpectedAndActualStrings((const char*)(expected[j]), (const char*)(actual[j])); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + } while (++j < num_elements); +} + +//----------------------------------------------- +void UnityAssertEqualMemory( const void* expected, + const void* actual, + _UU32 length, + _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + unsigned char* expected_ptr = (unsigned char*)expected; + unsigned char* actual_ptr = (unsigned char*)actual; + _UU32 elements = num_elements; + + UNITY_SKIP_EXECUTION; + + if ((elements == 0) || (length == 0)) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + while (elements--) + { + if (memcmp((const void*)expected_ptr, (const void*)actual_ptr, length) != 0) + { + Unity.CurrentTestFailed = 1; + break; + } + expected_ptr += length; + actual_ptr += length; + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + if (num_elements > 1) + { + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + } + UnityPrint(UnityStrMemory); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +// Control Functions +//----------------------------------------------- + +void UnityFail(const char* msg, const UNITY_LINE_TYPE line) +{ + UNITY_SKIP_EXECUTION; + + UnityTestResultsBegin(Unity.TestFile, line); + UnityPrint("FAIL"); + if (msg != NULL) + { + UNITY_OUTPUT_CHAR(':'); + if (msg[0] != ' ') + { + UNITY_OUTPUT_CHAR(' '); + } + UnityPrint(msg); + } + UNITY_FAIL_AND_BAIL; +} + +//----------------------------------------------- +void UnityIgnore(const char* msg, const UNITY_LINE_TYPE line) +{ + UNITY_SKIP_EXECUTION; + + UnityTestResultsBegin(Unity.TestFile, line); + UnityPrint("IGNORE"); + if (msg != NULL) + { + UNITY_OUTPUT_CHAR(':'); + UNITY_OUTPUT_CHAR(' '); + UnityPrint(msg); + } + UNITY_IGNORE_AND_BAIL; +} + +//----------------------------------------------- +void setUp(void); +void tearDown(void); +void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum) +{ + Unity.CurrentTestName = FuncName; + Unity.CurrentTestLineNumber = FuncLineNum; + Unity.NumberOfTests++; + if (TEST_PROTECT()) + { + setUp(); + Func(); + } + if (TEST_PROTECT() && !(Unity.CurrentTestIgnored)) + { + tearDown(); + } + UnityConcludeTest(); +} + +//----------------------------------------------- +void UnityBegin(void) +{ + Unity.NumberOfTests = 0; +} + +//----------------------------------------------- +int UnityEnd(void) +{ + UnityPrint("-----------------------"); + UNITY_PRINT_EOL; + UnityPrintNumber(Unity.NumberOfTests); + UnityPrint(" Tests "); + UnityPrintNumber(Unity.TestFailures); + UnityPrint(" Failures "); + UnityPrintNumber(Unity.TestIgnores); + UnityPrint(" Ignored"); + UNITY_PRINT_EOL; + if (Unity.TestFailures == 0U) + { + UnityPrint("OK"); + } + else + { + UnityPrint("FAIL"); + } + UNITY_PRINT_EOL; + return Unity.TestFailures; +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/src/unity.h b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/src/unity.h new file mode 100644 index 0000000..0b1b187 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/src/unity.h @@ -0,0 +1,213 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FRAMEWORK_H +#define UNITY_FRAMEWORK_H + +#define UNITY + +#include "unity_internals.h" + +//------------------------------------------------------- +// Configuration Options +//------------------------------------------------------- + +// Integers +// - Unity assumes 32 bit integers by default +// - If your compiler treats ints of a different size, define UNITY_INT_WIDTH + +// Floats +// - define UNITY_EXCLUDE_FLOAT to disallow floating point comparisons +// - define UNITY_FLOAT_PRECISION to specify the precision to use when doing TEST_ASSERT_EQUAL_FLOAT +// - define UNITY_FLOAT_TYPE to specify doubles instead of single precision floats +// - define UNITY_FLOAT_VERBOSE to print floating point values in errors (uses sprintf) + +// Output +// - by default, Unity prints to standard out with putchar. define UNITY_OUTPUT_CHAR(a) with a different function if desired + +// Optimization +// - by default, line numbers are stored in unsigned shorts. Define UNITY_LINE_TYPE with a different type if your files are huge +// - by default, test and failure counters are unsigned shorts. Define UNITY_COUNTER_TYPE with a different type if you want to save space or have more than 65535 Tests. + +// Test Cases +// - define UNITY_SUPPORT_TEST_CASES to include the TEST_CASE macro, though really it's mostly about the runner generator script + +// Parameterized Tests +// - you'll want to create a define of TEST_CASE(...) which basically evaluates to nothing + +//------------------------------------------------------- +// Test Running Macros +//------------------------------------------------------- + +#define TEST_PROTECT() (setjmp(Unity.AbortFrame) == 0) + +#define TEST_ABORT() {longjmp(Unity.AbortFrame, 1);} + +#ifndef RUN_TEST +#define RUN_TEST(func, line_num) UnityDefaultTestRun(func, #func, line_num) +#endif + +#define TEST_LINE_NUM (Unity.CurrentTestLineNumber) +#define TEST_IS_IGNORED (Unity.CurrentTestIgnored) + +//------------------------------------------------------- +// Basic Fail and Ignore +//------------------------------------------------------- + +#define TEST_FAIL_MESSAGE(message) UNITY_TEST_FAIL(__LINE__, message) +#define TEST_FAIL() UNITY_TEST_FAIL(__LINE__, NULL) +#define TEST_IGNORE_MESSAGE(message) UNITY_TEST_IGNORE(__LINE__, message) +#define TEST_IGNORE() UNITY_TEST_IGNORE(__LINE__, NULL) +#define TEST_ONLY() + +//------------------------------------------------------- +// Test Asserts (simple) +//------------------------------------------------------- + +//Boolean +#define TEST_ASSERT(condition) UNITY_TEST_ASSERT( (condition), __LINE__, " Expression Evaluated To FALSE") +#define TEST_ASSERT_TRUE(condition) UNITY_TEST_ASSERT( (condition), __LINE__, " Expected TRUE Was FALSE") +#define TEST_ASSERT_UNLESS(condition) UNITY_TEST_ASSERT( !(condition), __LINE__, " Expression Evaluated To TRUE") +#define TEST_ASSERT_FALSE(condition) UNITY_TEST_ASSERT( !(condition), __LINE__, " Expected FALSE Was TRUE") +#define TEST_ASSERT_NULL(pointer) UNITY_TEST_ASSERT_NULL( (pointer), __LINE__, " Expected NULL") +#define TEST_ASSERT_NOT_NULL(pointer) UNITY_TEST_ASSERT_NOT_NULL((pointer), __LINE__, " Expected Non-NULL") + +//Integers (of all sizes) +#define TEST_ASSERT_EQUAL_INT(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT8(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT8((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT16(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT16((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT32(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT32((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT64(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT64((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_NOT_EQUAL(expected, actual) UNITY_TEST_ASSERT(((expected) != (actual)), __LINE__, " Expected Not-Equal") +#define TEST_ASSERT_EQUAL_UINT(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT8(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT8( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT16(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT16( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT32(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT32( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT64(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT64( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX8(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX8( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX16(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX16((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX32(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX64(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX64((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_BITS(mask, expected, actual) UNITY_TEST_ASSERT_BITS((mask), (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_BITS_HIGH(mask, actual) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(-1), (actual), __LINE__, NULL) +#define TEST_ASSERT_BITS_LOW(mask, actual) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(0), (actual), __LINE__, NULL) +#define TEST_ASSERT_BIT_HIGH(bit, actual) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(-1), (actual), __LINE__, NULL) +#define TEST_ASSERT_BIT_LOW(bit, actual) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(0), (actual), __LINE__, NULL) + +//Integer Ranges (of all sizes) +#define TEST_ASSERT_INT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_UINT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX8_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX16_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX32_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX64_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, __LINE__, NULL) + +//Structs and Strings +#define TEST_ASSERT_EQUAL_PTR(expected, actual) UNITY_TEST_ASSERT_EQUAL_PTR((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_STRING(expected, actual) UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_MEMORY(expected, actual, len) UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, __LINE__, NULL) + +//Arrays +#define TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements) UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, __LINE__, NULL) + +//Floating Point (If Enabled) +#define TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_FLOAT(expected, actual) UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, __LINE__, NULL) + +//------------------------------------------------------- +// Test Asserts (with additional messages) +//------------------------------------------------------- + +//Boolean +#define TEST_ASSERT_MESSAGE(condition, message) UNITY_TEST_ASSERT( (condition), __LINE__, message) +#define TEST_ASSERT_TRUE_MESSAGE(condition, message) UNITY_TEST_ASSERT( (condition), __LINE__, message) +#define TEST_ASSERT_UNLESS_MESSAGE(condition, message) UNITY_TEST_ASSERT( !(condition), __LINE__, message) +#define TEST_ASSERT_FALSE_MESSAGE(condition, message) UNITY_TEST_ASSERT( !(condition), __LINE__, message) +#define TEST_ASSERT_NULL_MESSAGE(pointer, message) UNITY_TEST_ASSERT_NULL( (pointer), __LINE__, message) +#define TEST_ASSERT_NOT_NULL_MESSAGE(pointer, message) UNITY_TEST_ASSERT_NOT_NULL((pointer), __LINE__, message) + +//Integers (of all sizes) +#define TEST_ASSERT_EQUAL_INT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT8((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT16((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT32((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT64((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, message) +#define TEST_ASSERT_NOT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT(((expected) != (actual)), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT8( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT16( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT32( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT64( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX8( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX16((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX64((expected), (actual), __LINE__, message) +#define TEST_ASSERT_BITS_MESSAGE(mask, expected, actual, message) UNITY_TEST_ASSERT_BITS((mask), (expected), (actual), __LINE__, message) +#define TEST_ASSERT_BITS_HIGH_MESSAGE(mask, actual, message) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(-1), (actual), __LINE__, message) +#define TEST_ASSERT_BITS_LOW_MESSAGE(mask, actual, message) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(0), (actual), __LINE__, message) +#define TEST_ASSERT_BIT_HIGH_MESSAGE(bit, actual, message) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(-1), (actual), __LINE__, message) +#define TEST_ASSERT_BIT_LOW_MESSAGE(bit, actual, message) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(0), (actual), __LINE__, message) + +//Integer Ranges (of all sizes) +#define TEST_ASSERT_INT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_UINT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX8_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX16_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX32_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX64_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, __LINE__, message) + +//Structs and Strings +#define TEST_ASSERT_EQUAL_PTR_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_PTR(expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_STRING_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_MEMORY_MESSAGE(expected, actual, len, message) UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, __LINE__, message) + +//Arrays +#define TEST_ASSERT_EQUAL_INT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_STRING_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_MEMORY_ARRAY_MESSAGE(expected, actual, len, num_elements, message) UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, __LINE__, message) + +//Floating Point (If Enabled) +#define TEST_ASSERT_FLOAT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_FLOAT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_FLOAT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, __LINE__, message) +#endif diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/src/unity_internals.h b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/src/unity_internals.h new file mode 100644 index 0000000..29c9d1d --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/src/unity_internals.h @@ -0,0 +1,355 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_INTERNALS_H +#define UNITY_INTERNALS_H + +#include +#include + +//------------------------------------------------------- +// Int Support +//------------------------------------------------------- + +#ifndef UNITY_INT_WIDTH +#define UNITY_INT_WIDTH (32) +#endif + +#ifndef UNITY_LONG_WIDTH +#define UNITY_LONG_WIDTH (32) +#endif + +#if (UNITY_INT_WIDTH == 32) + typedef unsigned char _UU8; + typedef unsigned short _UU16; + typedef unsigned int _UU32; + typedef signed char _US8; + typedef signed short _US16; + typedef signed int _US32; +#elif (UNITY_INT_WIDTH == 16) + typedef unsigned char _UU8; + typedef unsigned int _UU16; + typedef unsigned long _UU32; + typedef signed char _US8; + typedef signed int _US16; + typedef signed long _US32; +#else + #error Invalid UNITY_INT_WIDTH specified! (16 or 32 are supported) +#endif + +//------------------------------------------------------- +// 64-bit Support +//------------------------------------------------------- + +#ifndef UNITY_SUPPORT_64 + +//No 64-bit Support +typedef _UU32 _U_UINT; +typedef _US32 _U_SINT; + +#else + +//64-bit Support +#if (UNITY_LONG_WIDTH == 32) + typedef unsigned long long _UU64; + typedef signed long long _US64; +#elif (UNITY_LONG_WIDTH == 64) + typedef unsigned long _UU64; + typedef signed long _US64; +#else + #error Invalid UNITY_LONG_WIDTH specified! (32 or 64 are supported) +#endif +typedef _UU64 _U_UINT; +typedef _US64 _U_SINT; + +#endif + +//------------------------------------------------------- +// Pointer Support +//------------------------------------------------------- + +#ifndef UNITY_POINTER_WIDTH +#define UNITY_POINTER_WIDTH (32) +#endif + +#if (UNITY_POINTER_WIDTH == 32) + typedef _UU32 _UP; +#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX32 +#elif (UNITY_POINTER_WIDTH == 64) + typedef _UU64 _UP; +#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX64 +#elif (UNITY_POINTER_WIDTH == 16) + typedef _UU16 _UP; +#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX16 +#else + #error Invalid UNITY_POINTER_WIDTH specified! (16, 32 or 64 are supported) +#endif + +//------------------------------------------------------- +// Float Support +//------------------------------------------------------- + +#ifdef UNITY_EXCLUDE_FLOAT + +//No Floating Point Support +#undef UNITY_FLOAT_PRECISION +#undef UNITY_FLOAT_TYPE +#undef UNITY_FLOAT_VERBOSE + +#else + +//Floating Point Support +#ifndef UNITY_FLOAT_PRECISION +#define UNITY_FLOAT_PRECISION (0.00001f) +#endif +#ifndef UNITY_FLOAT_TYPE +#define UNITY_FLOAT_TYPE float +#endif +typedef UNITY_FLOAT_TYPE _UF; + +#endif + +//------------------------------------------------------- +// Output Method +//------------------------------------------------------- + +#ifndef UNITY_OUTPUT_CHAR +//Default to using putchar, which is defined in stdio.h above +#define UNITY_OUTPUT_CHAR(a) putchar(a) +#else +//If defined as something else, make sure we declare it here so it's ready for use +extern int UNITY_OUTPUT_CHAR(int); +#endif + +//------------------------------------------------------- +// Footprint +//------------------------------------------------------- + +#ifndef UNITY_LINE_TYPE +#define UNITY_LINE_TYPE unsigned short +#endif + +#ifndef UNITY_COUNTER_TYPE +#define UNITY_COUNTER_TYPE unsigned short +#endif + +//------------------------------------------------------- +// Internal Structs Needed +//------------------------------------------------------- + +typedef void (*UnityTestFunction)(void); + +#define UNITY_DISPLAY_RANGE_INT (0x10) +#define UNITY_DISPLAY_RANGE_UINT (0x20) +#define UNITY_DISPLAY_RANGE_HEX (0x40) +#define UNITY_DISPLAY_RANGE_AUTO (0x80) + +typedef enum +{ + UNITY_DISPLAY_STYLE_INT = 4 + UNITY_DISPLAY_RANGE_INT + UNITY_DISPLAY_RANGE_AUTO, + UNITY_DISPLAY_STYLE_INT8 = 1 + UNITY_DISPLAY_RANGE_INT, + UNITY_DISPLAY_STYLE_INT16 = 2 + UNITY_DISPLAY_RANGE_INT, + UNITY_DISPLAY_STYLE_INT32 = 4 + UNITY_DISPLAY_RANGE_INT, +#ifdef UNITY_SUPPORT_64 + UNITY_DISPLAY_STYLE_INT64 = 8 + UNITY_DISPLAY_RANGE_INT, +#endif + UNITY_DISPLAY_STYLE_UINT = 4 + UNITY_DISPLAY_RANGE_UINT + UNITY_DISPLAY_RANGE_AUTO, + UNITY_DISPLAY_STYLE_UINT8 = 1 + UNITY_DISPLAY_RANGE_UINT, + UNITY_DISPLAY_STYLE_UINT16 = 2 + UNITY_DISPLAY_RANGE_UINT, + UNITY_DISPLAY_STYLE_UINT32 = 4 + UNITY_DISPLAY_RANGE_UINT, +#ifdef UNITY_SUPPORT_64 + UNITY_DISPLAY_STYLE_UINT64 = 8 + UNITY_DISPLAY_RANGE_UINT, +#endif + UNITY_DISPLAY_STYLE_HEX8 = 1 + UNITY_DISPLAY_RANGE_HEX, + UNITY_DISPLAY_STYLE_HEX16 = 2 + UNITY_DISPLAY_RANGE_HEX, + UNITY_DISPLAY_STYLE_HEX32 = 4 + UNITY_DISPLAY_RANGE_HEX, +#ifdef UNITY_SUPPORT_64 + UNITY_DISPLAY_STYLE_HEX64 = 8 + UNITY_DISPLAY_RANGE_HEX, +#endif +} UNITY_DISPLAY_STYLE_T; + +struct _Unity +{ + const char* TestFile; + const char* CurrentTestName; + _UU32 CurrentTestLineNumber; + UNITY_COUNTER_TYPE NumberOfTests; + UNITY_COUNTER_TYPE TestFailures; + UNITY_COUNTER_TYPE TestIgnores; + UNITY_COUNTER_TYPE CurrentTestFailed; + UNITY_COUNTER_TYPE CurrentTestIgnored; + jmp_buf AbortFrame; +}; + +extern struct _Unity Unity; + +//------------------------------------------------------- +// Test Suite Management +//------------------------------------------------------- + +void UnityBegin(void); +int UnityEnd(void); +void UnityConcludeTest(void); +void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum); + +//------------------------------------------------------- +// Test Output +//------------------------------------------------------- + +void UnityPrint(const char* string); +void UnityPrintMask(const _U_UINT mask, const _U_UINT number); +void UnityPrintNumberByStyle(const _U_SINT number, const UNITY_DISPLAY_STYLE_T style); +void UnityPrintNumber(const _U_SINT number); +void UnityPrintNumberUnsigned(const _U_UINT number); +void UnityPrintNumberHex(const _U_UINT number, const char nibbles); + +#ifdef UNITY_FLOAT_VERBOSE +void UnityPrintFloat(const _UF number); +#endif + +//------------------------------------------------------- +// Test Assertion Fuctions +//------------------------------------------------------- +// Use the macros below this section instead of calling +// these directly. The macros have a consistent naming +// convention and will pull in file and line information +// for you. + +void UnityAssertEqualNumber(const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style); + +void UnityAssertEqualIntArray(const _U_SINT* expected, + const _U_SINT* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style); + +void UnityAssertBits(const _U_SINT mask, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualString(const char* expected, + const char* actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualStringArray( const char** expected, + const char** actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualMemory( const void* expected, + const void* actual, + const _UU32 length, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertNumbersWithin(const _U_SINT delta, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style); + +void UnityFail(const char* message, const UNITY_LINE_TYPE line); + +void UnityIgnore(const char* message, const UNITY_LINE_TYPE line); + +#ifndef UNITY_EXCLUDE_FLOAT +void UnityAssertFloatsWithin(const _UF delta, + const _UF expected, + const _UF actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualFloatArray(const _UF* expected, + const _UF* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber); +#endif + +//------------------------------------------------------- +// Basic Fail and Ignore +//------------------------------------------------------- + +#define UNITY_TEST_FAIL(line, message) UnityFail( (message), (UNITY_LINE_TYPE)line); +#define UNITY_TEST_IGNORE(line, message) UnityIgnore( (message), (UNITY_LINE_TYPE)line); + +//------------------------------------------------------- +// Test Asserts +//------------------------------------------------------- + +#define UNITY_TEST_ASSERT(condition, line, message) if (condition) {} else {UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, message);} +#define UNITY_TEST_ASSERT_NULL(pointer, line, message) UNITY_TEST_ASSERT(((pointer) == NULL), (UNITY_LINE_TYPE)line, message) +#define UNITY_TEST_ASSERT_NOT_NULL(pointer, line, message) UNITY_TEST_ASSERT(((pointer) != NULL), (UNITY_LINE_TYPE)line, message) + +#define UNITY_TEST_ASSERT_EQUAL_INT(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_UINT(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_HEX8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX8) +#define UNITY_TEST_ASSERT_EQUAL_HEX16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX16) +#define UNITY_TEST_ASSERT_EQUAL_HEX32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX32) +#define UNITY_TEST_ASSERT_BITS(mask, expected, actual, line, message) UnityAssertBits((_U_SINT)(mask), (_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line) + +#define UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX8) +#define UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX16) +#define UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX32) +#define UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64) + +#define UNITY_TEST_ASSERT_EQUAL_PTR(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(_UP)(expected), (_U_SINT)(_UP)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_POINTER) +#define UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, line, message) UnityAssertEqualString((const char*)(expected), (const char*)(actual), (message), (UNITY_LINE_TYPE)line) +#define UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, line, message) UnityAssertEqualMemory((void*)(expected), (void*)(actual), (_UU32)(len), 1, (message), (UNITY_LINE_TYPE)line) + +#define UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT8) +#define UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT16) +#define UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT32) +#define UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT8) +#define UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT16) +#define UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT32) +#define UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX8) +#define UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX16) +#define UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX32) +#define UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualStringArray((const char**)(expected), (const char**)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line) +#define UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, line, message) UnityAssertEqualMemory((void*)(expected), (void*)(actual), (_UU32)(len), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line) + +#ifdef UNITY_SUPPORT_64 +#define UNITY_TEST_ASSERT_EQUAL_INT64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT64) +#define UNITY_TEST_ASSERT_EQUAL_UINT64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT64) +#define UNITY_TEST_ASSERT_EQUAL_HEX64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64) +#define UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT64) +#define UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT64) +#define UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64) +#endif + +#ifdef UNITY_EXCLUDE_FLOAT +#define UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled") +#define UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled") +#define UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled") +#else +#define UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, line, message) UnityAssertFloatsWithin((_UF)(delta), (_UF)(expected), (_UF)(actual), (message), (UNITY_LINE_TYPE)line) +#define UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, line, message) UNITY_TEST_ASSERT_FLOAT_WITHIN((_UF)(expected) * (_UF)UNITY_FLOAT_PRECISION, (_UF)expected, (_UF)actual, (UNITY_LINE_TYPE)line, message) +#define UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualFloatArray((_UF*)(expected), (_UF*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line) +#endif + +#endif diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/targets/gcc.yml b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/targets/gcc.yml new file mode 100644 index 0000000..0f18c6c --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/targets/gcc.yml @@ -0,0 +1,42 @@ +compiler: + path: gcc + source_path: 'src/' + unit_tests_path: &unit_tests_path 'test/' + build_path: &build_path 'build/' + options: + - '-c' + - '-Wall' + - '-Wno-address' + - '-std=c99' + - '-pedantic' + includes: + prefix: '-I' + items: + - 'src/' + - '../src/' + - *unit_tests_path + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - UNITY_SUPPORT_TEST_CASES + object_files: + prefix: '-o' + extension: '.o' + destination: *build_path +linker: + path: gcc + options: + - -lm + includes: + prefix: '-I' + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.exe' + destination: *build_path +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/targets/gcc_64.yml b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/targets/gcc_64.yml new file mode 100644 index 0000000..97cb958 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/targets/gcc_64.yml @@ -0,0 +1,43 @@ +compiler: + path: gcc + source_path: 'src/' + unit_tests_path: &unit_tests_path 'test/' + build_path: &build_path 'build/' + options: + - '-c' + - '-Wall' + - '-Wno-address' + - '-std=c99' + - '-pedantic' + includes: + prefix: '-I' + items: + - 'src/' + - '../src/' + - *unit_tests_path + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - UNITY_SUPPORT_TEST_CASES + - 'UNITY_POINTER_WIDTH=64' + object_files: + prefix: '-o' + extension: '.o' + destination: *build_path +linker: + path: gcc + options: + - -lm + includes: + prefix: '-I' + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.exe' + destination: *build_path +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/targets/hitech_picc18.yml b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/targets/hitech_picc18.yml new file mode 100644 index 0000000..210d944 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/targets/hitech_picc18.yml @@ -0,0 +1,101 @@ +# rumor has it that this yaml file works for the standard edition of the +# hitech PICC18 compiler, but not the pro version. +# +compiler: + path: cd build && picc18 + source_path: 'c:\Projects\NexGen\Prototypes\CMockTest\src\' + unit_tests_path: &unit_tests_path 'c:\Projects\NexGen\Prototypes\CMockTest\test\' + build_path: &build_path 'c:\Projects\NexGen\Prototypes\CMockTest\build\' + options: + - --chip=18F87J10 + - --ide=hitide + - --q #quiet please + - --asmlist + - --codeoffset=0 + - --emi=wordwrite # External memory interface protocol + - --warn=0 # allow all normal warning messages + - --errors=10 # Number of errors before aborting compile + - --char=unsigned + - -Bl # Large memory model + - -G # generate symbol file + - --cp=16 # 16-bit pointers + - --double=24 + - -N255 # 255-char symbol names + - --opt=none # Do not use any compiler optimziations + - -c # compile only + - -M + includes: + prefix: '-I' + items: + - 'c:/Projects/NexGen/Prototypes/CMockTest/src/' + - 'c:/Projects/NexGen/Prototypes/CMockTest/mocks/' + - 'c:/CMock/src/' + - 'c:/CMock/examples/src/' + - 'c:/CMock/vendor/unity/src/' + - 'c:/CMock/vendor/unity/examples/helper/' + - *unit_tests_path + defines: + prefix: '-D' + items: + - UNITY_INT_WIDTH=16 + - UNITY_POINTER_WIDTH=16 + - CMOCK_MEM_STATIC + - CMOCK_MEM_SIZE=3000 + - UNITY_SUPPORT_TEST_CASES + - _PICC18 + object_files: + # prefix: '-O' # Hi-Tech doesn't want a prefix. They key off of filename .extensions, instead + extension: '.obj' + destination: *build_path + +linker: + path: cd build && picc18 + options: + - --chip=18F87J10 + - --ide=hitide + - --cp=24 # 24-bit pointers. Is this needed for linker?? + - --double=24 # Is this needed for linker?? + - -Lw # Scan the pic87*w.lib in the lib/ of the compiler installation directory + - --summary=mem,file # info listing + - --summary=+psect + - --summary=+hex + - --output=+intel + - --output=+mcof + - --runtime=+init # Directs startup code to copy idata, ibigdata and ifardata psects from ROM to RAM. + - --runtime=+clear # Directs startup code to clear bss, bigbss, rbss and farbss psects + - --runtime=+clib # link in the c-runtime + - --runtime=+keep # Keep the generated startup src after its obj is linked + - -G # Generate src-level symbol file + - -MIWasTheLastToBuild.map + - --warn=0 # allow all normal warning messages + - -Bl # Large memory model (probably not needed for linking) + includes: + prefix: '-I' + object_files: + path: *build_path + extension: '.obj' + bin_files: + prefix: '-O' + extension: '.hex' + destination: *build_path + +simulator: + path: + pre_support: + - 'java -client -jar ' # note space + - ['C:\Program Files\HI-TECH Software\HI-TIDE\3.15\lib\', 'simpic18.jar'] + - 18F87J10 + post_support: + +:cmock: + :plugins: [] + :includes: + - Types.h + :suite_teardown: | + if (num_failures) + _FAILED_TEST(); + else + _PASSED_TESTS(); + return 0; + +colour: true \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_arm_v4.yml b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_arm_v4.yml new file mode 100644 index 0000000..c2e7f18 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_arm_v4.yml @@ -0,0 +1,89 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 4.0 Kickstart\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\lib\dl4tptinl8n.h'] + - -z3 + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian little + - --cpu ARM7TDMI + - --stack_align 4 + - --interwork + - -e + - --silent + - --warnings_are_errors + - --fpu None + - --diag_suppress Pa050 + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'common\bin\xlink.exe'] + options: + - -rt + - [*tools_root, 'arm\lib\dl4tptinl8n.r79'] + - -D_L_EXTMEM_START=0 + - -D_L_EXTMEM_SIZE=0 + - -D_L_HEAP_SIZE=120 + - -D_L_STACK_SIZE=32 + - -e_small_write=_formatted_write + - -s + - __program_start + - -f + - [*tools_root, '\arm\config\lnkarm.xcl'] + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\config\'] + - [*tools_root, 'arm\lib\'] + object_files: + path: *build_path + extension: '.r79' + bin_files: + prefix: '-o' + extension: '.d79' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\ioat91sam7X256.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_arm_v5.yml b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_arm_v5.yml new file mode 100644 index 0000000..0549d8e --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_arm_v5.yml @@ -0,0 +1,79 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian=little + - --cpu=ARM7TDMI + - --interwork + - --warnings_are_errors + - --fpu=None + - --diag_suppress=Pa050 + - --diag_suppress=Pe111 + - -e + - -On + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\debugger\atmel\ioat91sam7X256.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_arm_v5_3.yml b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_arm_v5_3.yml new file mode 100644 index 0000000..0549d8e --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_arm_v5_3.yml @@ -0,0 +1,79 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian=little + - --cpu=ARM7TDMI + - --interwork + - --warnings_are_errors + - --fpu=None + - --diag_suppress=Pa050 + - --diag_suppress=Pe111 + - -e + - -On + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\debugger\atmel\ioat91sam7X256.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml new file mode 100644 index 0000000..eb0785c --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml @@ -0,0 +1,93 @@ +#Default tool path for IAR 5.4 on Windows XP 64bit +tools_root: &tools_root 'C:\Program Files (x86)\IAR Systems\Embedded Workbench 5.4 Kickstart\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --diag_suppress=Pa050 + #- --diag_suppress=Pe111 + - --debug + - --endian=little + - --cpu=Cortex-M3 + - --no_path_in_file_macros + - -e + - --fpu=None + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + #- --preinclude --preinclude C:\Vss\T2 Working\common\system.h + - --interwork + - --warnings_are_errors +# - Ohz + - -Oh +# - --no_cse +# - --no_unroll +# - --no_inline +# - --no_code_motion +# - --no_tbaa +# - --no_clustering +# - --no_scheduling + + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - ewarm + - PART_LM3S9B92 + - TARGET_IS_TEMPEST_RB1 + - USE_ROM_DRIVERS + - UART_BUFFERED + - UNITY_SUPPORT_64 + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic.icf'] +# - ['C:\Temp\lm3s9b92.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + #- --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim2.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - --endian=little + - --cpu=Cortex-M3 + - --fpu=None + - -p + - [*tools_root, 'arm\config\debugger\TexasInstruments\iolm3sxxxx.ddf'] + - --semihosting + - --device=LM3SxBxx + #- -d + #- sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_cortexm3_v5.yml b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_cortexm3_v5.yml new file mode 100644 index 0000000..cf0d1d0 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_cortexm3_v5.yml @@ -0,0 +1,83 @@ +# unit testing under iar compiler / simulator for STM32 Cortex-M3 + +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.4\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian=little + - --cpu=Cortex-M3 + - --interwork + - --warnings_are_errors + - --fpu=None + - --diag_suppress=Pa050 + - --diag_suppress=Pe111 + - -e + - -On + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - 'IAR' + - 'UNITY_SUPPORT_64' + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic_cortex.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\debugger\ST\iostm32f107xx.ddf'] + - --cpu=Cortex-M3 + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_msp430.yml b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_msp430.yml new file mode 100644 index 0000000..e022647 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_msp430.yml @@ -0,0 +1,94 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3 MSP430\' +core_root: &core_root [*tools_root, '430\'] +core_bin: &core_bin [*core_root, 'bin\'] +core_config: &core_config [*core_root, 'config\'] +core_lib: &core_lib [*core_root, 'lib\'] +core_inc: &core_inc [*core_root, 'inc\'] +core_config: &core_config [*core_root, 'config\'] + +compiler: + path: [*core_bin, 'icc430.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*core_lib, 'dlib\dl430fn.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --debug + - -e + - -Ol + - --multiplier=16 + - --double=32 + - --diag_suppress Pa050 + - --diag_suppress Pe111 + includes: + prefix: '-I' + items: + - *core_inc + - [*core_inc, 'dlib'] + - [*core_lib, 'dlib'] + - 'src\' + - '../src/' + - *unit_tests_path + - 'vendor\unity\src' + defines: + prefix: '-D' + items: + - '__MSP430F149__' + - 'INT_WIDTH=16' + - 'UNITY_EXCLUDE_FLOAT' + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r43' + destination: *build_path +linker: + path: [*core_bin, 'xlink.exe'] + options: + - -rt + - [*core_lib, 'dlib\dl430fn.r43'] + - -e_PrintfTiny=_Printf + - -e_ScanfSmall=_Scanf + - -s __program_start + - -D_STACK_SIZE=50 + - -D_DATA16_HEAP_SIZE=50 + - -D_DATA20_HEAP_SIZE=50 + - -f + - [*core_config, 'lnk430f5438.xcl'] + - -f + - [*core_config, 'multiplier.xcl'] + includes: + prefix: '-I' + items: + - *core_config + - *core_lib + - [*core_lib, 'dlib'] + object_files: + path: *build_path + extension: '.r79' + bin_files: + prefix: '-o' + extension: '.d79' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*core_bin, '430proc.dll'] + - [*core_bin, '430sim.dll'] + post_support: + - --plugin + - [*core_bin, '430bat.dll'] + - --backend -B + - --cpu MSP430F5438 + - -p + - [*core_config, 'MSP430F5438.ddf'] + - -d sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_sh2a_v6.yml b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_sh2a_v6.yml new file mode 100644 index 0000000..ddc5603 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/targets/iar_sh2a_v6.yml @@ -0,0 +1,85 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 6.0\' +compiler: + path: [*tools_root, 'sh\bin\iccsh.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - -e + - --char_is_signed + - -Ol + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_scheduling + - --no_clustering + - --debug + - --dlib_config + - [*tools_root, 'sh\inc\DLib_Product.h'] + - --double=32 + - --code_model=huge + - --data_model=huge + - --core=sh2afpu + - --warnings_affect_exit_code + - --warnings_are_errors + - --mfc + - --use_unix_directory_separators + - --diag_suppress=Pe161 + includes: + prefix: '-I' + items: + - [*tools_root, 'sh\inc\'] + - [*tools_root, 'sh\inc\c'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.o' + destination: *build_path +linker: + path: [*tools_root, 'sh\bin\ilinksh.exe'] + options: + - --redirect __Printf=__PrintfSmall + - --redirect __Scanf=__ScanfSmall + - --config + - [*tools_root, 'sh\config\generic.icf'] + - --config_def _CSTACK_SIZE=0x800 + - --config_def _HEAP_SIZE=0x800 + - --config_def _INT_TABLE=0x10 + - --entry __iar_program_start + - --debug_lib + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'sh\bin\shproc.dll'] + - [*tools_root, 'sh\bin\shsim.dll'] + post_support: + - --plugin + - [*tools_root, 'sh\bin\shbat.dll'] + - --backend + - -B + - --core sh2afpu + - -p + - [*tools_root, 'sh\config\debugger\io7264.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_cmd.c b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_cmd.c new file mode 100644 index 0000000..42841d8 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_cmd.c @@ -0,0 +1,54 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include +#include "CException.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_def.c b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_def.c new file mode 100644 index 0000000..8280804 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_def.c @@ -0,0 +1,50 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_cmd.c b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_cmd.c new file mode 100644 index 0000000..e47b31c --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_cmd.c @@ -0,0 +1,76 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_def.c b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_def.c new file mode 100644 index 0000000..3ca9dba --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_def.c @@ -0,0 +1,72 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new1.c b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new1.c new file mode 100644 index 0000000..a7cbcd8 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new1.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + GlobalExpectCount = 0; + GlobalVerifyOrder = 0; + GlobalOrderError = NULL; + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new2.c b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new2.c new file mode 100644 index 0000000..2c76bf2 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new2.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_param.c b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_param.c new file mode 100644 index 0000000..23c04f4 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_param.c @@ -0,0 +1,73 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST_NO_ARGS +#define RUN_TEST(TestFunc, TestLineNum, ...) \ +{ \ + Unity.CurrentTestName = #TestFunc "(" #__VA_ARGS__ ")"; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(__VA_ARGS__); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21, RUN_TEST_NO_ARGS); + RUN_TEST(test_TheSecondThingToTest, 43, RUN_TEST_NO_ARGS); + + return (UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run1.c b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run1.c new file mode 100644 index 0000000..a7cbcd8 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run1.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + GlobalExpectCount = 0; + GlobalVerifyOrder = 0; + GlobalOrderError = NULL; + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run2.c b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run2.c new file mode 100644 index 0000000..2c76bf2 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run2.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_yaml.c b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_yaml.c new file mode 100644 index 0000000..68b545a --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_yaml.c @@ -0,0 +1,86 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include "two.h" +#include "three.h" +#include +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_yaml_setup(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_new1.c b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_new1.c new file mode 100644 index 0000000..e5bcac2 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_new1.c @@ -0,0 +1,60 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_new2.c b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_new2.c new file mode 100644 index 0000000..b7c7e5b --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_new2.c @@ -0,0 +1,63 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_param.c b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_param.c new file mode 100644 index 0000000..4157007 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_param.c @@ -0,0 +1,51 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST_NO_ARGS +#define RUN_TEST(TestFunc, TestLineNum, ...) \ +{ \ + Unity.CurrentTestName = #TestFunc "(" #__VA_ARGS__ ")"; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(__VA_ARGS__); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21, RUN_TEST_NO_ARGS); + RUN_TEST(test_TheSecondThingToTest, 43, RUN_TEST_NO_ARGS); + + return (UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_run1.c b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_run1.c new file mode 100644 index 0000000..e5bcac2 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_run1.c @@ -0,0 +1,60 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_run2.c b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_run2.c new file mode 100644 index 0000000..b7c7e5b --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_run2.c @@ -0,0 +1,63 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_yaml.c b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_yaml.c new file mode 100644 index 0000000..d109287 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/expectdata/testsample_yaml.c @@ -0,0 +1,64 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "two.h" +#include "three.h" +#include +#include +#include +#include "CException.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_yaml_setup(); +} + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/test_generate_test_runner.rb b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/test_generate_test_runner.rb new file mode 100644 index 0000000..61c8df9 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/test_generate_test_runner.rb @@ -0,0 +1,94 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +ruby_version = RUBY_VERSION.split('.') +if (ruby_version[1].to_i == 9) and (ruby_version[2].to_i > 1) + require 'rubygems' + gem 'test-unit' +end +require 'test/unit' +require './auto/generate_test_runner.rb' + +TEST_FILE = 'test/testdata/testsample.c' +TEST_MOCK = 'test/testdata/mocksample.c' +OUT_FILE = 'build/testsample_' +EXP_FILE = 'test/expectdata/testsample_' + +class TestGenerateTestRunner < Test::Unit::TestCase + def setup + end + + def teardown + end + + def verify_output_equal(subtest) + expected = File.read(EXP_FILE + subtest + '.c').gsub(/\r\n/,"\n") + actual = File.read(OUT_FILE + subtest + '.c').gsub(/\r\n/,"\n") + assert_equal(expected, actual, "Generated File Sub-Test '#{subtest}' Failed") + end + + def test_ShouldGenerateARunnerByCreatingRunnerWithOptions + sets = { 'def' => nil, + 'new1' => { :plugins => [:cexception], :includes => ['one.h', 'two.h'], :enforce_strict_ordering => true }, + 'new2' => { :plugins => [:ignore], :suite_setup => "a_custom_setup();", :suite_teardown => "a_custom_teardown();" } + } + + sets.each_pair do |subtest, options| + UnityTestRunnerGenerator.new(options).run(TEST_FILE, OUT_FILE + subtest + '.c') + verify_output_equal(subtest) + UnityTestRunnerGenerator.new(options).run(TEST_MOCK, OUT_FILE + 'mock_' + subtest + '.c') + verify_output_equal('mock_' + subtest) + end + end + + def test_ShouldGenerateARunnerByRunningRunnerWithOptions + sets = { 'run1' => { :plugins => [:cexception], :includes => ['one.h', 'two.h'], :enforce_strict_ordering => true }, + 'run2' => { :plugins => [:ignore], :suite_setup => "a_custom_setup();", :suite_teardown => "a_custom_teardown();" } + } + + sets.each_pair do |subtest, options| + UnityTestRunnerGenerator.new.run(TEST_FILE, OUT_FILE + subtest + '.c', options) + verify_output_equal(subtest) + UnityTestRunnerGenerator.new.run(TEST_MOCK, OUT_FILE + 'mock_' + subtest + '.c', options) + verify_output_equal('mock_' + subtest) + end + end + + def test_ShouldGenerateARunnerByPullingYamlOptions + subtest = 'yaml' + cmdstr = "ruby auto/generate_test_runner.rb test/testdata/sample.yml \"#{TEST_FILE}\" \"#{OUT_FILE + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal(subtest) + + cmdstr = "ruby auto/generate_test_runner.rb test/testdata/sample.yml \"#{TEST_MOCK}\" \"#{OUT_FILE + 'mock_' + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal('mock_' + subtest) + end + + def test_ShouldGenerateARunnerByPullingCommandlineOptions + subtest = 'cmd' + cmdstr = "ruby auto/generate_test_runner.rb -cexception \"#{TEST_FILE}\" \"#{OUT_FILE + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal(subtest) + + cmdstr = "ruby auto/generate_test_runner.rb -cexception \"#{TEST_MOCK}\" \"#{OUT_FILE + 'mock_' + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal('mock_' + subtest) + end + + def test_ShouldGenerateARunnerThatUsesParameterizedTests + sets = { 'param' => { :plugins => [:ignore], :use_param_tests => true } + } + + sets.each_pair do |subtest, options| + UnityTestRunnerGenerator.new(options).run(TEST_FILE, OUT_FILE + subtest + '.c') + verify_output_equal(subtest) + UnityTestRunnerGenerator.new(options).run(TEST_MOCK, OUT_FILE + 'mock_' + subtest + '.c') + verify_output_equal('mock_' + subtest) + end + end + +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/testdata/mocksample.c b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/testdata/mocksample.c new file mode 100644 index 0000000..b709438 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/testdata/mocksample.c @@ -0,0 +1,51 @@ +// This is just a sample test file to be used to test the generator script +#ifndef TEST_SAMPLE_H +#define TEST_SAMPLE_H + +#include +#include "unity.h" +#include "funky.h" +#include "Mockstanky.h" + +void setUp(void) +{ + CustomSetupStuff(); +} + +void tearDown(void) +{ + CustomTeardownStuff +} + +//Yup, nice comment +void test_TheFirstThingToTest(void) +{ + TEST_ASSERT(1); + + TEST_ASSERT_TRUE(1); +} + +/* +void test_ShouldBeIgnored(void) +{ + DoesStuff(); +} +*/ + +//void test_ShouldAlsoNotBeTested(void) +//{ +// Call_An_Expect(); +// +// CallAFunction(); +// test_CallAFunctionThatLooksLikeATest(); +//} + +void test_TheSecondThingToTest(void) +{ + Call_An_Expect(); + + CallAFunction(); + test_CallAFunctionThatLooksLikeATest(); +} + +#endif //TEST_SAMPLE_H diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/testdata/sample.yml b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/testdata/sample.yml new file mode 100644 index 0000000..9e5eece --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/testdata/sample.yml @@ -0,0 +1,9 @@ +:unity: + :includes: + - two.h + - three.h + - + :plugins: + - :cexception + :suite_setup: | + a_yaml_setup(); \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/testdata/testsample.c b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/testdata/testsample.c new file mode 100644 index 0000000..4f30ec7 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/testdata/testsample.c @@ -0,0 +1,51 @@ +// This is just a sample test file to be used to test the generator script +#ifndef TEST_SAMPLE_H +#define TEST_SAMPLE_H + +#include +#include "unity.h" +#include "funky.h" +#include "stanky.h" + +void setUp(void) +{ + CustomSetupStuff(); +} + +void tearDown(void) +{ + CustomTeardownStuff +} + +//Yup, nice comment +void test_TheFirstThingToTest(void) +{ + TEST_ASSERT(1); + + TEST_ASSERT_TRUE(1); +} + +/* +void test_ShouldBeIgnored(void) +{ + DoesStuff(); +} +*/ + +//void test_ShouldAlsoNotBeTested(void) +//{ +// Call_An_Expect(); +// +// CallAFunction(); +// test_CallAFunctionThatLooksLikeATest(); +//} + +void test_TheSecondThingToTest(void) +{ + Call_An_Expect(); + + CallAFunction(); + test_CallAFunctionThatLooksLikeATest(); +} + +#endif //TEST_SAMPLE_H diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/testparameterized.c b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/testparameterized.c new file mode 100644 index 0000000..037cd21 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/testparameterized.c @@ -0,0 +1,101 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include +#include "unity.h" + +#define TEST_CASE(...) + +#define EXPECT_ABORT_BEGIN \ + if (TEST_PROTECT()) \ + { + +#define VERIFY_FAILS_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestFailed == 1) ? 0 : 1; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Failed But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +#define VERIFY_IGNORES_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestIgnored == 1) ? 0 : 1; \ + Unity.CurrentTestIgnored = 0; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Ignored But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +int SetToOneToFailInTearDown; +int SetToOneMeanWeAlreadyCheckedThisGuy; + +void setUp(void) +{ + SetToOneToFailInTearDown = 0; + SetToOneMeanWeAlreadyCheckedThisGuy = 0; +} + +void tearDown(void) +{ + if (SetToOneToFailInTearDown == 1) + TEST_FAIL_MESSAGE("<= Failed in tearDown"); + if ((SetToOneMeanWeAlreadyCheckedThisGuy == 0) && (Unity.CurrentTestFailed > 0)) + { + UnityPrint("[[[[ Previous Test Should Have Passed But Did Not ]]]]"); + UNITY_OUTPUT_CHAR('\n'); + } +} + +TEST_CASE(0) +TEST_CASE(44) +TEST_CASE((90)+9) +void test_TheseShouldAllPass(int Num) +{ + TEST_ASSERT_TRUE(Num < 100); +} + +TEST_CASE(3) +TEST_CASE(77) +TEST_CASE( (99) + 1 - (1)) +void test_TheseShouldAllFail(int Num) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(Num > 100); + VERIFY_FAILS_END +} + +TEST_CASE(1) +TEST_CASE(44) +TEST_CASE(99) +TEST_CASE(98) +void test_TheseAreEveryOther(int Num) +{ + if (Num & 1) + { + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(Num > 100); + VERIFY_FAILS_END + } + else + { + TEST_ASSERT_TRUE(Num < 100); + } +} + +void test_NormalPassesStillWork(void) +{ + TEST_ASSERT_TRUE(1); +} + +void test_NormalFailsStillWork(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(0); + VERIFY_FAILS_END +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/testunity.c b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/testunity.c new file mode 100644 index 0000000..9f826dc --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/c_exception/vendor/unity/test/testunity.c @@ -0,0 +1,1510 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include +#include "unity.h" + +#define EXPECT_ABORT_BEGIN \ + if (TEST_PROTECT()) \ + { + +#define VERIFY_FAILS_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestFailed == 1) ? 0 : 1; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Failed But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +#define VERIFY_IGNORES_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestIgnored == 1) ? 0 : 1; \ + Unity.CurrentTestIgnored = 0; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Ignored But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +int SetToOneToFailInTearDown; +int SetToOneMeanWeAlreadyCheckedThisGuy; + +void setUp(void) +{ + SetToOneToFailInTearDown = 0; + SetToOneMeanWeAlreadyCheckedThisGuy = 0; +} + +void tearDown(void) +{ + if (SetToOneToFailInTearDown == 1) + TEST_FAIL_MESSAGE("<= Failed in tearDown"); + if ((SetToOneMeanWeAlreadyCheckedThisGuy == 0) && (Unity.CurrentTestFailed > 0)) + { + UnityPrint("[[[[ Previous Test Should Have Passed But Did Not ]]]]"); + UNITY_OUTPUT_CHAR('\n'); + } +} + +void testTrue(void) +{ + TEST_ASSERT(1); + + TEST_ASSERT_TRUE(1); +} + +void testFalse(void) +{ + TEST_ASSERT_FALSE(0); + + TEST_ASSERT_UNLESS(0); +} + +void testPreviousPass(void) +{ + TEST_ASSERT_EQUAL_INT(0U, Unity.TestFailures); +} + +void testNotVanilla(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT(0); + VERIFY_FAILS_END +} + +void testNotTrue(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(0); + VERIFY_FAILS_END +} + +void testNotFalse(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_FALSE(1); + VERIFY_FAILS_END +} + +void testNotUnless(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UNLESS(1); + VERIFY_FAILS_END +} + +void testNotNotEqual(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_NOT_EQUAL(10, 10); + VERIFY_FAILS_END +} + +void testFail(void) +{ + EXPECT_ABORT_BEGIN + TEST_FAIL_MESSAGE("Expected for testing"); + VERIFY_FAILS_END +} + +void testIsNull(void) +{ + char* ptr1 = NULL; + char* ptr2 = "hello"; + + TEST_ASSERT_NULL(ptr1); + TEST_ASSERT_NOT_NULL(ptr2); +} + +void testIsNullShouldFailIfNot(void) +{ + char* ptr1 = "hello"; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_NULL(ptr1); + VERIFY_FAILS_END +} + +void testNotNullShouldFailIfNULL(void) +{ + char* ptr1 = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_NOT_NULL(ptr1); + VERIFY_FAILS_END +} + +void testIgnore(void) +{ + EXPECT_ABORT_BEGIN + TEST_IGNORE(); + TEST_FAIL_MESSAGE("This should not be reached"); + VERIFY_IGNORES_END +} + +void testIgnoreMessage(void) +{ + EXPECT_ABORT_BEGIN + TEST_IGNORE_MESSAGE("This is an expected TEST_IGNORE_MESSAGE string!"); + TEST_FAIL_MESSAGE("This should not be reached"); + VERIFY_IGNORES_END +} + +void testNotEqualInts(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT(3982, 3983); + VERIFY_FAILS_END +} + +void testNotEqualInt8s(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT8(-127, -126); + VERIFY_FAILS_END +} + +void testNotEqualInt16s(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT16(-16383, -16382); + VERIFY_FAILS_END +} + +void testNotEqualInt32s(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT32(-2147483647, -2147483646); + VERIFY_FAILS_END +} + +void testNotEqualBits(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_BITS(0xFF00, 0x5555, 0x5A55); + VERIFY_FAILS_END +} + +void testNotEqualUInts(void) +{ + _UU16 v0, v1; + + v0 = 9000; + v1 = 9001; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualUInt8s(void) +{ + _UU8 v0, v1; + + v0 = 254; + v1 = 255; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT8(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualUInt16s(void) +{ + _UU16 v0, v1; + + v0 = 65535; + v1 = 65534; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualUInt32s(void) +{ + _UU32 v0, v1; + + v0 = 4294967295; + v1 = 4294967294; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT32(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex8s(void) +{ + _UU8 v0, v1; + + v0 = 0x23; + v1 = 0x22; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex8sIfSigned(void) +{ + _US8 v0, v1; + + v0 = -2; + v1 = 2; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex16s(void) +{ + _UU16 v0, v1; + + v0 = 0x1234; + v1 = 0x1235; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex16sIfSigned(void) +{ + _US16 v0, v1; + + v0 = -1024; + v1 = -1028; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex32s(void) +{ + _UU32 v0, v1; + + v0 = 900000; + v1 = 900001; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex32sIfSigned(void) +{ + _US32 v0, v1; + + v0 = -900000; + v1 = 900001; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32(v0, v1); + VERIFY_FAILS_END +} + +void testEqualInts(void) +{ + int v0, v1; + int *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(1837, 1837); + TEST_ASSERT_EQUAL_INT(-27365, -27365); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(19467, v1); + TEST_ASSERT_EQUAL_INT(v0, 19467); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 19467); +} + +void testEqualUints(void) +{ + unsigned int v0, v1; + unsigned int *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_UINT(1837, 1837); + TEST_ASSERT_EQUAL_UINT(v0, v1); + TEST_ASSERT_EQUAL_UINT(19467, v1); + TEST_ASSERT_EQUAL_UINT(v0, 19467); + TEST_ASSERT_EQUAL_UINT(*p0, v1); + TEST_ASSERT_EQUAL_UINT(*p0, *p1); + TEST_ASSERT_EQUAL_UINT(*p0, 19467); + TEST_ASSERT_EQUAL_UINT(60872u, 60872u); +} + +void testNotEqual(void) +{ + TEST_ASSERT_NOT_EQUAL(0, 1); + TEST_ASSERT_NOT_EQUAL(1, 0); + TEST_ASSERT_NOT_EQUAL(100, 101); + TEST_ASSERT_NOT_EQUAL(0, -1); + TEST_ASSERT_NOT_EQUAL(65535, -65535); + TEST_ASSERT_NOT_EQUAL(75, 900); + TEST_ASSERT_NOT_EQUAL(-100, -101); +} + +void testEqualHex8s(void) +{ + _UU8 v0, v1; + _UU8 *p0, *p1; + + v0 = 0x22; + v1 = 0x22; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX8(0x22, 0x22); + TEST_ASSERT_EQUAL_HEX8(v0, v1); + TEST_ASSERT_EQUAL_HEX8(0x22, v1); + TEST_ASSERT_EQUAL_HEX8(v0, 0x22); + TEST_ASSERT_EQUAL_HEX8(*p0, v1); + TEST_ASSERT_EQUAL_HEX8(*p0, *p1); + TEST_ASSERT_EQUAL_HEX8(*p0, 0x22); +} + +void testEqualHex8sNegatives(void) +{ + _UU8 v0, v1; + _UU8 *p0, *p1; + + v0 = 0xDD; + v1 = 0xDD; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX8(0xDD, 0xDD); + TEST_ASSERT_EQUAL_HEX8(v0, v1); + TEST_ASSERT_EQUAL_HEX8(0xDD, v1); + TEST_ASSERT_EQUAL_HEX8(v0, 0xDD); + TEST_ASSERT_EQUAL_HEX8(*p0, v1); + TEST_ASSERT_EQUAL_HEX8(*p0, *p1); + TEST_ASSERT_EQUAL_HEX8(*p0, 0xDD); +} + +void testEqualHex16s(void) +{ + _UU16 v0, v1; + _UU16 *p0, *p1; + + v0 = 0x9876; + v1 = 0x9876; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX16(0x9876, 0x9876); + TEST_ASSERT_EQUAL_HEX16(v0, v1); + TEST_ASSERT_EQUAL_HEX16(0x9876, v1); + TEST_ASSERT_EQUAL_HEX16(v0, 0x9876); + TEST_ASSERT_EQUAL_HEX16(*p0, v1); + TEST_ASSERT_EQUAL_HEX16(*p0, *p1); + TEST_ASSERT_EQUAL_HEX16(*p0, 0x9876); +} + +void testEqualHex32s(void) +{ + _UU32 v0, v1; + _UU32 *p0, *p1; + + v0 = 0x98765432ul; + v1 = 0x98765432ul; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX32(0x98765432ul, 0x98765432ul); + TEST_ASSERT_EQUAL_HEX32(v0, v1); + TEST_ASSERT_EQUAL_HEX32(0x98765432ul, v1); + TEST_ASSERT_EQUAL_HEX32(v0, 0x98765432ul); + TEST_ASSERT_EQUAL_HEX32(*p0, v1); + TEST_ASSERT_EQUAL_HEX32(*p0, *p1); + TEST_ASSERT_EQUAL_HEX32(*p0, 0x98765432ul); +} + +void testEqualBits(void) +{ + _UU32 v0 = 0xFF55AA00; + _UU32 v1 = 0x55550000; + + TEST_ASSERT_BITS(v1, v0, 0x55550000); + TEST_ASSERT_BITS(v1, v0, 0xFF55CC00); + TEST_ASSERT_BITS(0xFFFFFFFF, v0, 0xFF55AA00); + TEST_ASSERT_BITS(0xFFFFFFFF, v0, v0); + TEST_ASSERT_BITS(0xF0F0F0F0, v0, 0xFC5DAE0F); + TEST_ASSERT_BITS_HIGH(v1, v0); + TEST_ASSERT_BITS_LOW(0x000055FF, v0); + TEST_ASSERT_BIT_HIGH(30, v0); + TEST_ASSERT_BIT_LOW(5, v0); +} + +void testEqualShorts(void) +{ + short v0, v1; + short *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(1837, 1837); + TEST_ASSERT_EQUAL_INT(-2987, -2987); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(19467, v1); + TEST_ASSERT_EQUAL_INT(v0, 19467); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 19467); +} + +void testEqualUShorts(void) +{ + unsigned short v0, v1; + unsigned short *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_UINT(1837, 1837); + TEST_ASSERT_EQUAL_UINT(2987, 2987); + TEST_ASSERT_EQUAL_UINT(v0, v1); + TEST_ASSERT_EQUAL_UINT(19467, v1); + TEST_ASSERT_EQUAL_UINT(v0, 19467); + TEST_ASSERT_EQUAL_UINT(*p0, v1); + TEST_ASSERT_EQUAL_UINT(*p0, *p1); + TEST_ASSERT_EQUAL_UINT(*p0, 19467); +} + +void testEqualChars(void) +{ + signed char v0, v1; + signed char *p0, *p1; + + v0 = 109; + v1 = 109; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(42, 42); + TEST_ASSERT_EQUAL_INT(-116, -116); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(109, v1); + TEST_ASSERT_EQUAL_INT(v0, 109); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 109); +} + +void testEqualUChars(void) +{ + unsigned char v0, v1; + unsigned char *p0, *p1; + + v0 = 251; + v1 = 251; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(42, 42); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(251, v1); + TEST_ASSERT_EQUAL_INT(v0, 251); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 251); +} + +void testEqualPointers(void) +{ + int v0, v1; + int *p0, *p1, *p2; + + v0 = 19467; + v1 = 18271; + p0 = &v0; + p1 = &v1; + p2 = &v1; + + TEST_ASSERT_EQUAL_PTR(p0, &v0); + TEST_ASSERT_EQUAL_PTR(&v1, p1); + TEST_ASSERT_EQUAL_PTR(p2, p1); + TEST_ASSERT_EQUAL_PTR(&v0, &v0); +} + +void testNotEqualPointers(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_PTR(0x12345678, 0x12345677); + VERIFY_FAILS_END +} + +void testIntsWithinDelta(void) +{ + TEST_ASSERT_INT_WITHIN(1, 5000, 5001); + TEST_ASSERT_INT_WITHIN(5, 5000, 4996); + TEST_ASSERT_INT_WITHIN(5, 5000, 5005); + TEST_ASSERT_INT_WITHIN(500, 50, -440); + + TEST_ASSERT_INT_WITHIN(2, -1, -1); + TEST_ASSERT_INT_WITHIN(5, 1, -1); + TEST_ASSERT_INT_WITHIN(5, -1, 1); +} + +void testIntsNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_INT_WITHIN(5, 5000, 5006); + VERIFY_FAILS_END +} + +void testUIntsWithinDelta(void) +{ + TEST_ASSERT_UINT_WITHIN(1, 5000, 5001); + TEST_ASSERT_UINT_WITHIN(5, 5000, 4996); + TEST_ASSERT_UINT_WITHIN(5, 5000, 5005); +} + +void testUIntsNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UINT_WITHIN(1, 2147483647u, 2147483649u); + VERIFY_FAILS_END +} + +void testUIntsNotWithinDeltaEvenThoughASignedIntWouldPassSmallFirst(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UINT_WITHIN(5, 1, -1); + VERIFY_FAILS_END +} + +void testUIntsNotWithinDeltaEvenThoughASignedIntWouldPassBigFirst(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UINT_WITHIN(5, -1, 1); + VERIFY_FAILS_END +} + +void testHEX32sWithinDelta(void) +{ + TEST_ASSERT_HEX32_WITHIN(1, 5000, 5001); + TEST_ASSERT_HEX32_WITHIN(5, 5000, 4996); + TEST_ASSERT_HEX32_WITHIN(5, 5000, 5005); +} + +void testHEX32sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX32_WITHIN(1, 2147483647u, 2147483649u); + VERIFY_FAILS_END +} + +void testHEX32sNotWithinDeltaEvenThoughASignedIntWouldPass(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX32_WITHIN(5, 1, -1); + VERIFY_FAILS_END +} + +void testHEX16sWithinDelta(void) +{ + TEST_ASSERT_HEX16_WITHIN(1, 5000, 5001); + TEST_ASSERT_HEX16_WITHIN(5, 5000, 4996); + TEST_ASSERT_HEX16_WITHIN(5, 5000, 5005); +} + +void testHEX16sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX16_WITHIN(2, 65535, 0); + VERIFY_FAILS_END +} + +void testHEX8sWithinDelta(void) +{ + TEST_ASSERT_HEX8_WITHIN(1, 254, 255); + TEST_ASSERT_HEX8_WITHIN(5, 251, 255); + TEST_ASSERT_HEX8_WITHIN(5, 1, 4); +} + +void testHEX8sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX8_WITHIN(2, 255, 0); + VERIFY_FAILS_END +} + +void testEqualStrings(void) +{ + const char *testString = "foo"; + + TEST_ASSERT_EQUAL_STRING(testString, testString); + TEST_ASSERT_EQUAL_STRING("foo", "foo"); + TEST_ASSERT_EQUAL_STRING("foo", testString); + TEST_ASSERT_EQUAL_STRING(testString, "foo"); + TEST_ASSERT_EQUAL_STRING("", ""); +} + +void testEqualStringsWithCarriageReturnsAndLineFeeds(void) +{ + const char *testString = "foo\r\nbar"; + + TEST_ASSERT_EQUAL_STRING(testString, testString); + TEST_ASSERT_EQUAL_STRING("foo\r\nbar", "foo\r\nbar"); + TEST_ASSERT_EQUAL_STRING("foo\r\nbar", testString); + TEST_ASSERT_EQUAL_STRING(testString, "foo\r\nbar"); + TEST_ASSERT_EQUAL_STRING("", ""); +} + +void testNotEqualString1(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("foo", "bar"); + VERIFY_FAILS_END +} + +void testNotEqualString2(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("foo", ""); + VERIFY_FAILS_END +} + +void testNotEqualString3(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("", "bar"); + VERIFY_FAILS_END +} + +void testNotEqualString4(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("bar\r", "bar\n"); + VERIFY_FAILS_END +} + +void testNotEqualString5(void) +{ + const char str1[] = { 0x41, 0x42, 0x03, 0x00 }; + const char str2[] = { 0x41, 0x42, 0x04, 0x00 }; + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING(str1, str2); + VERIFY_FAILS_END +} + +void testNotEqualString_ExpectedStringIsNull(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING(NULL, "bar"); + VERIFY_FAILS_END +} + +void testNotEqualString_ActualStringIsNull(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("foo", NULL); + VERIFY_FAILS_END +} + +void testEqualStringArrays(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, expStrings, 3); + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 3); + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 2); + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 1); +} + +void testNotEqualStringArray1(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray2(void) +{ + const char *testStrings[] = { "zoo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", "boo", "woo", "moo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray3(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", NULL }; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray4(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", NULL, "woo", "moo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray5(void) +{ + const char **testStrings = NULL; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray6(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "zoo" }; + const char **expStrings = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testEqualStringArrayIfBothNulls(void) +{ + const char **testStrings = NULL; + const char **expStrings = NULL; + + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); +} + +void testEqualMemory(void) +{ + const char *testString = "whatever"; + + TEST_ASSERT_EQUAL_MEMORY(testString, testString, 8); + TEST_ASSERT_EQUAL_MEMORY("whatever", "whatever", 8); + TEST_ASSERT_EQUAL_MEMORY("whatever", testString, 8); + TEST_ASSERT_EQUAL_MEMORY(testString, "whatever", 8); + TEST_ASSERT_EQUAL_MEMORY(testString, "whatever", 2); + TEST_ASSERT_EQUAL_MEMORY(NULL, NULL, 1); +} + +void testNotEqualMemory1(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY("foo", "bar", 3); + VERIFY_FAILS_END +} + +void testNotEqualMemory2(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY("fool", "food", 4); + VERIFY_FAILS_END +} + +void testNotEqualMemory3(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY(NULL, "food", 4); + VERIFY_FAILS_END +} + +void testNotEqualMemory4(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY("fool", NULL, 4); + VERIFY_FAILS_END +} + +void testEqualIntArrays(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, -2}; + int p2[] = {1, 8, 987, 2}; + int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p3, 1); +} + +void testNotEqualIntArraysNullExpected(void) +{ + int* p0 = NULL; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArraysNullActual(void) +{ + int* p1 = NULL; + int p0[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArrays1(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArrays2(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {2, 8, 987, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArrays3(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 986, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualInt8Arrays(void) +{ + _US8 p0[] = {1, 8, 117, -2}; + _US8 p1[] = {1, 8, 117, -2}; + _US8 p2[] = {1, 8, 117, 2}; + _US8 p3[] = {1, 50, 60, 70}; + + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p3, 1); +} + +void testNotEqualInt8Arrays(void) +{ + _US8 p0[] = {1, 8, 127, -2}; + _US8 p1[] = {1, 8, 127, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualUIntArrays(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65132u}; + unsigned int p2[] = {1, 8, 987, 2}; + unsigned int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p3, 1); +} + +void testNotEqualUIntArrays1(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUIntArrays2(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUIntArrays3(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualInt16Arrays(void) +{ + _UU16 p0[] = {1, 8, 117, 3}; + _UU16 p1[] = {1, 8, 117, 3}; + _UU16 p2[] = {1, 8, 117, 2}; + _UU16 p3[] = {1, 50, 60, 70}; + + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p3, 1); +} + +void testNotEqualInt16Arrays(void) +{ + _UU16 p0[] = {1, 8, 127, 3}; + _UU16 p1[] = {1, 8, 127, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualUINT16Arrays(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65132u}; + unsigned short p2[] = {1, 8, 987, 2}; + unsigned short p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p3, 1); +} + +void testNotEqualUINT16Arrays1(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUINT16Arrays2(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUINT16Arrays3(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualHEXArrays(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65132u}; + unsigned int p2[] = {1, 8, 987, 2}; + unsigned int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p3, 1); +} + +void testNotEqualHEXArrays1(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEXArrays2(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEXArrays3(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualHEX16Arrays(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65132u}; + unsigned short p2[] = {1, 8, 987, 2}; + unsigned short p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p3, 1); +} + +void testNotEqualHEX16Arrays1(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX16Arrays2(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX16Arrays3(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualHEX8Arrays(void) +{ + unsigned short p0[] = {1, 8, 254u, 123}; + unsigned short p1[] = {1, 8, 254u, 123}; + unsigned short p2[] = {1, 8, 254u, 2}; + unsigned short p3[] = {1, 23, 25, 26}; + + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p3, 1); +} + +void testNotEqualHEX8Arrays1(void) +{ + unsigned char p0[] = {1, 8, 254u, 253u}; + unsigned char p1[] = {1, 8, 254u, 252u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX8Arrays2(void) +{ + unsigned char p0[] = {1, 8, 254u, 253u}; + unsigned char p1[] = {2, 8, 254u, 253u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX8Arrays3(void) +{ + unsigned char p0[] = {1, 8, 254u, 253u}; + unsigned char p1[] = {1, 8, 255u, 253u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualMemoryArrays(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, -2}; + int p2[] = {1, 8, 987, 2}; + int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p0, 4, 1); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p0, 4, 4); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p2, 4, 3); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p3, 4, 1); +} + +void testNotEqualMemoryArraysExpectedNull(void) +{ + int* p0 = NULL; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArraysActualNull(void) +{ + int p0[] = {1, 8, 987, -2}; + int* p1 = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArrays1(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArrays2(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {2, 8, 987, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArrays3(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 986, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testProtection(void) +{ + volatile int mask = 0; + + if (TEST_PROTECT()) + { + mask |= 1; + TEST_ABORT(); + } + else + { + Unity.CurrentTestFailed = 0; + mask |= 2; + } + + TEST_ASSERT_EQUAL(3, mask); +} + +void testIgnoredAndThenFailInTearDown(void) +{ + SetToOneToFailInTearDown = 1; + TEST_IGNORE(); +} + +// ===================== THESE TEST WILL RUN IF YOUR CONFIG INCLUDES 64 BIT SUPPORT ================== +#ifdef UNITY_SUPPORT_64 + +void testEqualHex64s(void) +{ + _UU64 v0, v1; + _UU64 *p0, *p1; + + v0 = 0x9876543201234567; + v1 = 0x9876543201234567; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX64(0x9876543201234567, 0x9876543201234567); + TEST_ASSERT_EQUAL_HEX64(v0, v1); + TEST_ASSERT_EQUAL_HEX64(0x9876543201234567, v1); + TEST_ASSERT_EQUAL_HEX64(v0, 0x9876543201234567); + TEST_ASSERT_EQUAL_HEX64(*p0, v1); + TEST_ASSERT_EQUAL_HEX64(*p0, *p1); + TEST_ASSERT_EQUAL_HEX64(*p0, 0x9876543201234567); +} + +void testNotEqualHex64s(void) +{ + _UU64 v0, v1; + + v0 = 9000000000; + v1 = 9100000000; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex64sIfSigned(void) +{ + _US64 v0, v1; + + v0 = -9000000000; + v1 = 9000000000; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64(v0, v1); + VERIFY_FAILS_END +} + +void testHEX64sWithinDelta(void) +{ + TEST_ASSERT_HEX64_WITHIN(1, 0x7FFFFFFFFFFFFFFF,0x7FFFFFFFFFFFFFFE); + TEST_ASSERT_HEX64_WITHIN(5, 5000, 4996); + TEST_ASSERT_HEX64_WITHIN(5, 5000, 5005); +} + +void testHEX64sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX64_WITHIN(1, 0x7FFFFFFFFFFFFFFF, 0x7FFFFFFFFFFFFFFC); + VERIFY_FAILS_END +} + +void testHEX64sNotWithinDeltaEvenThoughASignedIntWouldPass(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX64_WITHIN(5, 1, -1); + VERIFY_FAILS_END +} + +void testEqualHEX64Arrays(void) +{ + _UU64 p0[] = {1, 8, 987, 65132u}; + _UU64 p1[] = {1, 8, 987, 65132u}; + _UU64 p2[] = {1, 8, 987, 2}; + _UU64 p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p3, 1); +} + +void testNotEqualHEX64Arrays1(void) +{ + _UU64 p0[] = {1, 8, 987, 65132u}; + _UU64 p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX64Arrays2(void) +{ + _UU64 p0[] = {1, 8, 987, 65132u}; + _UU64 p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +#endif //64-bit SUPPORT + +// ===================== THESE TEST WILL RUN IF YOUR CONFIG INCLUDES FLOAT SUPPORT ================== +#ifndef UNITY_EXCLUDE_FLOAT + +void testFloatsWithinDelta(void) +{ + TEST_ASSERT_FLOAT_WITHIN(0.00003f, 187245.03485f, 187245.03488f); + TEST_ASSERT_FLOAT_WITHIN(1.0f, 187245.0f, 187246.0f); + TEST_ASSERT_FLOAT_WITHIN(0.05f, 9273.2549f, 9273.2049f); + TEST_ASSERT_FLOAT_WITHIN(0.007f, -726.93724f, -726.94424f); +} + +void testFloatsNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_FLOAT_WITHIN(0.05f, 9273.2649f, 9273.2049f); + VERIFY_FAILS_END +} + +void testFloatsEqual(void) +{ + TEST_ASSERT_EQUAL_FLOAT(187245.0f, 187246.0f); + TEST_ASSERT_EQUAL_FLOAT(18724.5f, 18724.6f); + TEST_ASSERT_EQUAL_FLOAT(9273.2549f, 9273.2599f); + TEST_ASSERT_EQUAL_FLOAT(-726.93724f, -726.9374f); +} + +void testFloatsNotEqual(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT(9273.9649f, 9273.0049f); + VERIFY_FAILS_END +} + +void testFloatsNotEqualNegative1(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT(-9273.9649f, -9273.0049f); + VERIFY_FAILS_END +} + +void testFloatsNotEqualNegative2(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT(-9273.0049f, -9273.9649f); + VERIFY_FAILS_END +} + +void testEqualFloatArrays(void) +{ + float p0[] = {1.0, -8.0, 25.4, -0.123}; + float p1[] = {1.0, -8.0, 25.4, -0.123}; + float p2[] = {1.0, -8.0, 25.4, -0.2}; + float p3[] = {1.0, -23.0, 25.0, -0.26}; + + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p3, 1); +} + +void testNotEqualFloatArraysExpectedNull(void) +{ + float* p0 = NULL; + float p1[] = {1.0, 8.0, 25.4, 0.252}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysActualNull(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float* p1 = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArrays1(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float p1[] = {1.0, 8.0, 25.4, 0.252}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArrays2(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float p1[] = {2.0, 8.0, 25.4, 0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArrays3(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float p1[] = {1.0, 8.0, 25.5, 0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysNegative1(void) +{ + float p0[] = {-1.0, -8.0, -25.4, -0.253}; + float p1[] = {-1.0, -8.0, -25.4, -0.252}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysNegative2(void) +{ + float p0[] = {-1.0, -8.0, -25.4, -0.253}; + float p1[] = {-2.0, -8.0, -25.4, -0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysNegative3(void) +{ + float p0[] = {-1.0, -8.0, -25.4, -0.253}; + float p1[] = {-1.0, -8.0, -25.5, -0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +#endif //FLOAT SUPPORT diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/config/production_environment.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/config/production_environment.rb new file mode 100644 index 0000000..915582b --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/config/production_environment.rb @@ -0,0 +1,14 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +# Setup our load path: +[ + 'lib', +].each do |dir| + $LOAD_PATH.unshift( File.join( File.expand_path(File.dirname(__FILE__)) + '/../', dir) ) +end + + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/config/test_environment.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/config/test_environment.rb new file mode 100644 index 0000000..442e110 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/config/test_environment.rb @@ -0,0 +1,16 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +# Setup our load path: +[ + 'lib', + 'vendor/behaviors/lib', + 'vendor/hardmock/lib', + 'vendor/unity/auto/', + 'test/system/' +].each do |dir| + $LOAD_PATH.unshift( File.join( File.expand_path(File.dirname(__FILE__) + "/../"), dir) ) +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/docs/CMock Summary.odt b/flex-bison/mark1/tools/ceedling/vendor/cmock/docs/CMock Summary.odt new file mode 100644 index 0000000..6126075 Binary files /dev/null and b/flex-bison/mark1/tools/ceedling/vendor/cmock/docs/CMock Summary.odt differ diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/docs/CMock Summary.pdf b/flex-bison/mark1/tools/ceedling/vendor/cmock/docs/CMock Summary.pdf new file mode 100644 index 0000000..98f8ea1 Binary files /dev/null and b/flex-bison/mark1/tools/ceedling/vendor/cmock/docs/CMock Summary.pdf differ diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/docs/license.txt b/flex-bison/mark1/tools/ceedling/vendor/cmock/docs/license.txt new file mode 100644 index 0000000..8eb75ad --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/docs/license.txt @@ -0,0 +1,31 @@ + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + The end-user documentation included with the redistribution, if + any, must include the following acknowledgment: "This product + includes software developed for the CMock Project, by Mike Karlesky, + Mark VanderVoord, and Greg Williams and other contributors", in + the same place and form as other third-party acknowledgments. + Alternately, this acknowledgment may appear in the software + itself, in the same form and location as other such third-party + acknowledgments. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/gcc.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/gcc.yml new file mode 100644 index 0000000..07ecf9a --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/gcc.yml @@ -0,0 +1,43 @@ +compiler: + path: gcc + source_path: 'src/' + unit_tests_path: &unit_tests_path 'test/' + build_path: &build_path 'build/' + options: + - -c + includes: + prefix: '-I' + items: + - 'src/' + - '../src/' + - '../vendor/unity/src/' + - '../vendor/unity/examples/helper/' + - 'mocks/' + - *unit_tests_path + defines: + prefix: '-D' + items: + - __monitor + object_files: + prefix: '-o' + extension: '.o' + destination: *build_path +linker: + path: gcc + options: + - -lm + includes: + prefix: '-I' + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.exe' + destination: *build_path +:cmock: + :plugins: [] + :includes: + - Types.h + +colour: true \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/iar_v4.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/iar_v4.yml new file mode 100644 index 0000000..4c13425 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/iar_v4.yml @@ -0,0 +1,91 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 4.0 Kickstart\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\lib\dl4tptinl8n.h'] + - -z3 + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian little + - --cpu ARM7TDMI + - --stack_align 4 + - --interwork + - -e + - --silent + - --warnings_are_errors + - --fpu None + - --diag_suppress Pa050 + includes: + prefix: '-I' + items: + - 'src/' + - '../src/' + - '../vendor/unity/src/' + - '../vendor/unity/examples/helper/' + - 'mocks/' + - [*tools_root, 'arm\inc\'] + - *unit_tests_path + defines: + prefix: '-D' + items: + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'common\bin\xlink.exe'] + options: + - -rt + - [*tools_root, 'arm\lib\dl4tptinl8n.r79'] + - -D_L_EXTMEM_START=0 + - -D_L_EXTMEM_SIZE=0 + - -D_L_HEAP_SIZE=120 + - -D_L_STACK_SIZE=32 + - -e_small_write=_formatted_write + - -s + - __program_start + - -f + - [*tools_root, '\arm\config\lnkarm.xcl'] + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\config\'] + - [*tools_root, 'arm\lib\'] + object_files: + path: *build_path + extension: '.r79' + bin_files: + prefix: '-o' + extension: '.d79' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\ioat91sam7X256.ddf'] + - -d + - sim +:cmock: + :plugins: [] + :includes: + - Types.h + \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/iar_v5.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/iar_v5.yml new file mode 100644 index 0000000..839936b --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/iar_v5.yml @@ -0,0 +1,80 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian=little + - --cpu=ARM7TDMI + - --interwork + - --warnings_are_errors + - --fpu=None + - --diag_suppress=Pa050 + - --diag_suppress=Pe111 + - -e + - -On + includes: + prefix: '-I' + items: + - 'src/' + - '../src/' + - '../vendor/unity/src/' + - '../vendor/unity/examples/helper/' + - 'mocks/' + - [*tools_root, 'arm\inc\'] + - *unit_tests_path + defines: + prefix: '-D' + items: + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\debugger\atmel\ioat91sam7X256.ddf'] + - -d + - sim +:cmock: + :plugins: [] + :includes: + - Types.h + \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/rakefile.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/rakefile.rb new file mode 100644 index 0000000..0c6a7ca --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/rakefile.rb @@ -0,0 +1,32 @@ +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require './rakefile_helper' + +include RakefileHelpers + +# Load default configuration, for now +DEFAULT_CONFIG_FILE = 'gcc.yml' +configure_toolchain(DEFAULT_CONFIG_FILE) + +task :unit do + run_tests(get_unit_test_files) +end + +desc "Generate test summary" +task :summary do + report_summary +end + +desc "Build and test Unity" +task :all => [:clean, :unit, :summary] +task :default => [:clobber, :all] +task :ci => [:default] +task :cruise => [:default] + +desc "Load configuration" +task :config, :config_file do |t, args| + configure_toolchain(args[:config_file]) +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/rakefile_helper.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/rakefile_helper.rb new file mode 100644 index 0000000..b7626b3 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/rakefile_helper.rb @@ -0,0 +1,274 @@ +require 'yaml' +require 'fileutils' +require '../vendor/unity/auto/unity_test_summary' +require '../vendor/unity/auto/generate_test_runner' +require '../vendor/unity/auto/colour_reporter' + +module RakefileHelpers + + C_EXTENSION = '.c' + + def load_configuration(config_file) + $cfg_file = config_file + $cfg = YAML.load(File.read($cfg_file)) + $colour_output = false unless $cfg['colour'] + end + + def configure_clean + CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil? + end + + def configure_toolchain(config_file=DEFAULT_CONFIG_FILE) + config_file += '.yml' unless config_file =~ /\.yml$/ + load_configuration(config_file) + configure_clean + end + + def get_unit_test_files + path = $cfg['compiler']['unit_tests_path'] + 'Test*' + C_EXTENSION + path.gsub!(/\\/, '/') + FileList.new(path) + end + + def get_local_include_dirs + include_dirs = $cfg['compiler']['includes']['items'].dup + include_dirs.delete_if {|dir| dir.is_a?(Array)} + return include_dirs + end + + def extract_headers(filename) + includes = [] + lines = File.readlines(filename) + lines.each do |line| + m = line.match(/^\s*#include\s+\"\s*(.+\.[hH])\s*\"/) + if not m.nil? + includes << m[1] + end + end + return includes + end + + def find_source_file(header, paths) + paths.each do |dir| + src_file = dir + header.ext(C_EXTENSION) + if (File.exists?(src_file)) + return src_file + end + end + return nil + end + + def tackit(strings) + case(strings) + when Array + "\"#{strings.join}\"" + when /^-/ + strings + when /\s/ + "\"#{strings}\"" + else + strings + end + end + + def squash(prefix, items) + result = '' + items.each { |item| result += " #{prefix}#{tackit(item)}" } + return result + end + + def build_compiler_fields + command = tackit($cfg['compiler']['path']) + if $cfg['compiler']['defines']['items'].nil? + defines = '' + else + defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items']) + end + options = squash('', $cfg['compiler']['options']) + includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :defines => defines, :options => options, :includes => includes} + end + + def compile(file, defines=[]) + compiler = build_compiler_fields + cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{file} " + + "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" + + "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" + execute(cmd_str) + end + + def build_linker_fields + command = tackit($cfg['linker']['path']) + if $cfg['linker']['options'].nil? + options = '' + else + options = squash('', $cfg['linker']['options']) + end + if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?) + includes = '' + else + includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) + end + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :options => options, :includes => includes} + end + + def link(exe_name, obj_list) + linker = build_linker_fields + cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + + (obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).join + + $cfg['linker']['bin_files']['prefix'] + ' ' + + $cfg['linker']['bin_files']['destination'] + + exe_name + $cfg['linker']['bin_files']['extension'] + execute(cmd_str) + end + + def build_simulator_fields + return nil if $cfg['simulator'].nil? + if $cfg['simulator']['path'].nil? + command = '' + else + command = (tackit($cfg['simulator']['path']) + ' ') + end + if $cfg['simulator']['pre_support'].nil? + pre_support = '' + else + pre_support = squash('', $cfg['simulator']['pre_support']) + end + if $cfg['simulator']['post_support'].nil? + post_support = '' + else + post_support = squash('', $cfg['simulator']['post_support']) + end + return {:command => command, :pre_support => pre_support, :post_support => post_support} + end + + def execute(command_string, verbose=true) + report command_string + output = `#{command_string}`.chomp + report(output) if (verbose && !output.nil? && (output.length > 0)) + if $?.exitstatus != 0 + raise "Command failed. (Returned #{$?.exitstatus})" + end + return output + end + + def report_summary + summary = UnityTestSummary.new + summary.set_root_path(HERE) + results_glob = "#{$cfg['compiler']['build_path']}*.test*" + results_glob.gsub!(/\\/, '/') + results = Dir[results_glob] + summary.set_targets(results) + report summary.run + raise "There were failures" if (summary.failures > 0) + end + + def run_tests(test_files) + + report 'Running system tests...' + + # Tack on TEST define for compiling unit tests + load_configuration($cfg_file) + test_defines = ['TEST'] + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + $cfg['compiler']['defines']['items'] << 'TEST' + + include_dirs = get_local_include_dirs + + # Build and execute each unit test + test_files.each do |test| + obj_list = [] + + # Detect dependencies and build required required modules + header_list = extract_headers(test) + ['cmock.h'] + header_list.each do |header| + + #create mocks if needed + if (header =~ /Mock/) + require "../lib/cmock.rb" + @cmock ||= CMock.new($cfg_file) + @cmock.setup_mocks([$cfg['compiler']['source_path']+header.gsub('Mock','')]) + end + + end + + #compile all mocks + header_list.each do |header| + #compile source file header if it exists + src_file = find_source_file(header, include_dirs) + if !src_file.nil? + compile(src_file, test_defines) + obj_list << header.ext($cfg['compiler']['object_files']['extension']) + end + end + + # Build the test runner (generate if configured to do so) + test_base = File.basename(test, C_EXTENSION) + runner_name = test_base + '_Runner.c' + if $cfg['compiler']['runner_path'].nil? + runner_path = $cfg['compiler']['build_path'] + runner_name + test_gen = UnityTestRunnerGenerator.new($cfg_file) + test_gen.run(test, runner_path) + else + runner_path = $cfg['compiler']['runner_path'] + runner_name + end + + compile(runner_path, test_defines) + obj_list << runner_name.ext($cfg['compiler']['object_files']['extension']) + + # Build the test module + compile(test, test_defines) + obj_list << test_base.ext($cfg['compiler']['object_files']['extension']) + + # Link the test executable + link(test_base, obj_list) + + # Execute unit test and generate results file + simulator = build_simulator_fields + executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] + if simulator.nil? + cmd_str = executable + else + cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" + end + output = execute(cmd_str) + test_results = $cfg['compiler']['build_path'] + test_base + if output.match(/OK$/m).nil? + test_results += '.testfail' + else + test_results += '.testpass' + end + File.open(test_results, 'w') { |f| f.print output } + end + end + + def build_application(main) + + report "Building application..." + + obj_list = [] + load_configuration($cfg_file) + main_path = $cfg['compiler']['source_path'] + main + C_EXTENSION + + # Detect dependencies and build required required modules + include_dirs = get_local_include_dirs + extract_headers(main_path).each do |header| + src_file = find_source_file(header, include_dirs) + if !src_file.nil? + compile(src_file) + obj_list << header.ext($cfg['compiler']['object_files']['extension']) + end + end + + # Build the main source file + main_base = File.basename(main_path, C_EXTENSION) + compile(main_path) + obj_list << main_base.ext($cfg['compiler']['object_files']['extension']) + + # Create the executable + link(main_base, obj_list) + end + +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/AT91SAM7X256.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/AT91SAM7X256.h new file mode 100644 index 0000000..baa0313 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/AT91SAM7X256.h @@ -0,0 +1,2556 @@ +// ---------------------------------------------------------------------------- +// ATMEL Microcontroller Software Support - ROUSSET - +// ---------------------------------------------------------------------------- +// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// ---------------------------------------------------------------------------- +// File Name : AT91SAM7X256.h +// Object : AT91SAM7X256 definitions +// Generated : AT91 SW Application Group 01/16/2006 (16:36:21) +// +// CVS Reference : /AT91SAM7X256.pl/1.15/Wed Nov 2 13:56:49 2005// +// CVS Reference : /SYS_SAM7X.pl/1.3/Tue Feb 1 17:01:43 2005// +// CVS Reference : /MC_SAM7X.pl/1.2/Fri May 20 14:13:04 2005// +// CVS Reference : /PMC_SAM7X.pl/1.4/Tue Feb 8 13:58:10 2005// +// CVS Reference : /RSTC_SAM7X.pl/1.2/Wed Jul 13 14:57:50 2005// +// CVS Reference : /UDP_SAM7X.pl/1.1/Tue May 10 11:35:35 2005// +// CVS Reference : /PWM_SAM7X.pl/1.1/Tue May 10 11:53:07 2005// +// CVS Reference : /AIC_6075B.pl/1.3/Fri May 20 14:01:30 2005// +// CVS Reference : /PIO_6057A.pl/1.2/Thu Feb 3 10:18:28 2005// +// CVS Reference : /RTTC_6081A.pl/1.2/Tue Nov 9 14:43:58 2004// +// CVS Reference : /PITC_6079A.pl/1.2/Tue Nov 9 14:43:56 2004// +// CVS Reference : /WDTC_6080A.pl/1.3/Tue Nov 9 14:44:00 2004// +// CVS Reference : /VREG_6085B.pl/1.1/Tue Feb 1 16:05:48 2005// +// CVS Reference : /PDC_6074C.pl/1.2/Thu Feb 3 08:48:54 2005// +// CVS Reference : /DBGU_6059D.pl/1.1/Mon Jan 31 13:15:32 2005// +// CVS Reference : /SPI_6088D.pl/1.3/Fri May 20 14:08:59 2005// +// CVS Reference : /US_6089C.pl/1.1/Mon Jul 12 18:23:26 2004// +// CVS Reference : /SSC_6078B.pl/1.1/Wed Jul 13 15:19:19 2005// +// CVS Reference : /TWI_6061A.pl/1.1/Tue Jul 13 07:38:06 2004// +// CVS Reference : /TC_6082A.pl/1.7/Fri Mar 11 12:52:17 2005// +// CVS Reference : /CAN_6019B.pl/1.1/Tue Mar 8 12:42:22 2005// +// CVS Reference : /EMACB_6119A.pl/1.6/Wed Jul 13 15:05:35 2005// +// CVS Reference : /ADC_6051C.pl/1.1/Fri Oct 17 09:12:38 2003// +// ---------------------------------------------------------------------------- + +#ifndef AT91SAM7X256_H +#define AT91SAM7X256_H + +typedef volatile unsigned int AT91_REG;// Hardware register definition + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR System Peripherals +// ***************************************************************************** +typedef struct _AT91S_SYS { + AT91_REG AIC_SMR[32]; // Source Mode Register + AT91_REG AIC_SVR[32]; // Source Vector Register + AT91_REG AIC_IVR; // IRQ Vector Register + AT91_REG AIC_FVR; // FIQ Vector Register + AT91_REG AIC_ISR; // Interrupt Status Register + AT91_REG AIC_IPR; // Interrupt Pending Register + AT91_REG AIC_IMR; // Interrupt Mask Register + AT91_REG AIC_CISR; // Core Interrupt Status Register + AT91_REG Reserved0[2]; // + AT91_REG AIC_IECR; // Interrupt Enable Command Register + AT91_REG AIC_IDCR; // Interrupt Disable Command Register + AT91_REG AIC_ICCR; // Interrupt Clear Command Register + AT91_REG AIC_ISCR; // Interrupt Set Command Register + AT91_REG AIC_EOICR; // End of Interrupt Command Register + AT91_REG AIC_SPU; // Spurious Vector Register + AT91_REG AIC_DCR; // Debug Control Register (Protect) + AT91_REG Reserved1[1]; // + AT91_REG AIC_FFER; // Fast Forcing Enable Register + AT91_REG AIC_FFDR; // Fast Forcing Disable Register + AT91_REG AIC_FFSR; // Fast Forcing Status Register + AT91_REG Reserved2[45]; // + AT91_REG DBGU_CR; // Control Register + AT91_REG DBGU_MR; // Mode Register + AT91_REG DBGU_IER; // Interrupt Enable Register + AT91_REG DBGU_IDR; // Interrupt Disable Register + AT91_REG DBGU_IMR; // Interrupt Mask Register + AT91_REG DBGU_CSR; // Channel Status Register + AT91_REG DBGU_RHR; // Receiver Holding Register + AT91_REG DBGU_THR; // Transmitter Holding Register + AT91_REG DBGU_BRGR; // Baud Rate Generator Register + AT91_REG Reserved3[7]; // + AT91_REG DBGU_CIDR; // Chip ID Register + AT91_REG DBGU_EXID; // Chip ID Extension Register + AT91_REG DBGU_FNTR; // Force NTRST Register + AT91_REG Reserved4[45]; // + AT91_REG DBGU_RPR; // Receive Pointer Register + AT91_REG DBGU_RCR; // Receive Counter Register + AT91_REG DBGU_TPR; // Transmit Pointer Register + AT91_REG DBGU_TCR; // Transmit Counter Register + AT91_REG DBGU_RNPR; // Receive Next Pointer Register + AT91_REG DBGU_RNCR; // Receive Next Counter Register + AT91_REG DBGU_TNPR; // Transmit Next Pointer Register + AT91_REG DBGU_TNCR; // Transmit Next Counter Register + AT91_REG DBGU_PTCR; // PDC Transfer Control Register + AT91_REG DBGU_PTSR; // PDC Transfer Status Register + AT91_REG Reserved5[54]; // + AT91_REG PIOA_PER; // PIO Enable Register + AT91_REG PIOA_PDR; // PIO Disable Register + AT91_REG PIOA_PSR; // PIO Status Register + AT91_REG Reserved6[1]; // + AT91_REG PIOA_OER; // Output Enable Register + AT91_REG PIOA_ODR; // Output Disable Registerr + AT91_REG PIOA_OSR; // Output Status Register + AT91_REG Reserved7[1]; // + AT91_REG PIOA_IFER; // Input Filter Enable Register + AT91_REG PIOA_IFDR; // Input Filter Disable Register + AT91_REG PIOA_IFSR; // Input Filter Status Register + AT91_REG Reserved8[1]; // + AT91_REG PIOA_SODR; // Set Output Data Register + AT91_REG PIOA_CODR; // Clear Output Data Register + AT91_REG PIOA_ODSR; // Output Data Status Register + AT91_REG PIOA_PDSR; // Pin Data Status Register + AT91_REG PIOA_IER; // Interrupt Enable Register + AT91_REG PIOA_IDR; // Interrupt Disable Register + AT91_REG PIOA_IMR; // Interrupt Mask Register + AT91_REG PIOA_ISR; // Interrupt Status Register + AT91_REG PIOA_MDER; // Multi-driver Enable Register + AT91_REG PIOA_MDDR; // Multi-driver Disable Register + AT91_REG PIOA_MDSR; // Multi-driver Status Register + AT91_REG Reserved9[1]; // + AT91_REG PIOA_PPUDR; // Pull-up Disable Register + AT91_REG PIOA_PPUER; // Pull-up Enable Register + AT91_REG PIOA_PPUSR; // Pull-up Status Register + AT91_REG Reserved10[1]; // + AT91_REG PIOA_ASR; // Select A Register + AT91_REG PIOA_BSR; // Select B Register + AT91_REG PIOA_ABSR; // AB Select Status Register + AT91_REG Reserved11[9]; // + AT91_REG PIOA_OWER; // Output Write Enable Register + AT91_REG PIOA_OWDR; // Output Write Disable Register + AT91_REG PIOA_OWSR; // Output Write Status Register + AT91_REG Reserved12[85]; // + AT91_REG PIOB_PER; // PIO Enable Register + AT91_REG PIOB_PDR; // PIO Disable Register + AT91_REG PIOB_PSR; // PIO Status Register + AT91_REG Reserved13[1]; // + AT91_REG PIOB_OER; // Output Enable Register + AT91_REG PIOB_ODR; // Output Disable Registerr + AT91_REG PIOB_OSR; // Output Status Register + AT91_REG Reserved14[1]; // + AT91_REG PIOB_IFER; // Input Filter Enable Register + AT91_REG PIOB_IFDR; // Input Filter Disable Register + AT91_REG PIOB_IFSR; // Input Filter Status Register + AT91_REG Reserved15[1]; // + AT91_REG PIOB_SODR; // Set Output Data Register + AT91_REG PIOB_CODR; // Clear Output Data Register + AT91_REG PIOB_ODSR; // Output Data Status Register + AT91_REG PIOB_PDSR; // Pin Data Status Register + AT91_REG PIOB_IER; // Interrupt Enable Register + AT91_REG PIOB_IDR; // Interrupt Disable Register + AT91_REG PIOB_IMR; // Interrupt Mask Register + AT91_REG PIOB_ISR; // Interrupt Status Register + AT91_REG PIOB_MDER; // Multi-driver Enable Register + AT91_REG PIOB_MDDR; // Multi-driver Disable Register + AT91_REG PIOB_MDSR; // Multi-driver Status Register + AT91_REG Reserved16[1]; // + AT91_REG PIOB_PPUDR; // Pull-up Disable Register + AT91_REG PIOB_PPUER; // Pull-up Enable Register + AT91_REG PIOB_PPUSR; // Pull-up Status Register + AT91_REG Reserved17[1]; // + AT91_REG PIOB_ASR; // Select A Register + AT91_REG PIOB_BSR; // Select B Register + AT91_REG PIOB_ABSR; // AB Select Status Register + AT91_REG Reserved18[9]; // + AT91_REG PIOB_OWER; // Output Write Enable Register + AT91_REG PIOB_OWDR; // Output Write Disable Register + AT91_REG PIOB_OWSR; // Output Write Status Register + AT91_REG Reserved19[341]; // + AT91_REG PMC_SCER; // System Clock Enable Register + AT91_REG PMC_SCDR; // System Clock Disable Register + AT91_REG PMC_SCSR; // System Clock Status Register + AT91_REG Reserved20[1]; // + AT91_REG PMC_PCER; // Peripheral Clock Enable Register + AT91_REG PMC_PCDR; // Peripheral Clock Disable Register + AT91_REG PMC_PCSR; // Peripheral Clock Status Register + AT91_REG Reserved21[1]; // + AT91_REG PMC_MOR; // Main Oscillator Register + AT91_REG PMC_MCFR; // Main Clock Frequency Register + AT91_REG Reserved22[1]; // + AT91_REG PMC_PLLR; // PLL Register + AT91_REG PMC_MCKR; // Master Clock Register + AT91_REG Reserved23[3]; // + AT91_REG PMC_PCKR[4]; // Programmable Clock Register + AT91_REG Reserved24[4]; // + AT91_REG PMC_IER; // Interrupt Enable Register + AT91_REG PMC_IDR; // Interrupt Disable Register + AT91_REG PMC_SR; // Status Register + AT91_REG PMC_IMR; // Interrupt Mask Register + AT91_REG Reserved25[36]; // + AT91_REG RSTC_RCR; // Reset Control Register + AT91_REG RSTC_RSR; // Reset Status Register + AT91_REG RSTC_RMR; // Reset Mode Register + AT91_REG Reserved26[5]; // + AT91_REG RTTC_RTMR; // Real-time Mode Register + AT91_REG RTTC_RTAR; // Real-time Alarm Register + AT91_REG RTTC_RTVR; // Real-time Value Register + AT91_REG RTTC_RTSR; // Real-time Status Register + AT91_REG PITC_PIMR; // Period Interval Mode Register + AT91_REG PITC_PISR; // Period Interval Status Register + AT91_REG PITC_PIVR; // Period Interval Value Register + AT91_REG PITC_PIIR; // Period Interval Image Register + AT91_REG WDTC_WDCR; // Watchdog Control Register + AT91_REG WDTC_WDMR; // Watchdog Mode Register + AT91_REG WDTC_WDSR; // Watchdog Status Register + AT91_REG Reserved27[5]; // + AT91_REG VREG_MR; // Voltage Regulator Mode Register +} AT91S_SYS, *AT91PS_SYS; + + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Advanced Interrupt Controller +// ***************************************************************************** +typedef struct _AT91S_AIC { + AT91_REG AIC_SMR[32]; // Source Mode Register + AT91_REG AIC_SVR[32]; // Source Vector Register + AT91_REG AIC_IVR; // IRQ Vector Register + AT91_REG AIC_FVR; // FIQ Vector Register + AT91_REG AIC_ISR; // Interrupt Status Register + AT91_REG AIC_IPR; // Interrupt Pending Register + AT91_REG AIC_IMR; // Interrupt Mask Register + AT91_REG AIC_CISR; // Core Interrupt Status Register + AT91_REG Reserved0[2]; // + AT91_REG AIC_IECR; // Interrupt Enable Command Register + AT91_REG AIC_IDCR; // Interrupt Disable Command Register + AT91_REG AIC_ICCR; // Interrupt Clear Command Register + AT91_REG AIC_ISCR; // Interrupt Set Command Register + AT91_REG AIC_EOICR; // End of Interrupt Command Register + AT91_REG AIC_SPU; // Spurious Vector Register + AT91_REG AIC_DCR; // Debug Control Register (Protect) + AT91_REG Reserved1[1]; // + AT91_REG AIC_FFER; // Fast Forcing Enable Register + AT91_REG AIC_FFDR; // Fast Forcing Disable Register + AT91_REG AIC_FFSR; // Fast Forcing Status Register +} AT91S_AIC, *AT91PS_AIC; + +// -------- AIC_SMR : (AIC Offset: 0x0) Control Register -------- +#define AT91C_AIC_PRIOR ((unsigned int) 0x7 << 0) // (AIC) Priority Level +#define AT91C_AIC_PRIOR_LOWEST ((unsigned int) 0x0) // (AIC) Lowest priority level +#define AT91C_AIC_PRIOR_HIGHEST ((unsigned int) 0x7) // (AIC) Highest priority level +#define AT91C_AIC_SRCTYPE ((unsigned int) 0x3 << 5) // (AIC) Interrupt Source Type +#define AT91C_AIC_SRCTYPE_EXT_LOW_LEVEL ((unsigned int) 0x0 << 5) // (AIC) External Sources Code Label Low-level Sensitive +#define AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL ((unsigned int) 0x0 << 5) // (AIC) Internal Sources Code Label High-level Sensitive +#define AT91C_AIC_SRCTYPE_INT_POSITIVE_EDGE ((unsigned int) 0x1 << 5) // (AIC) Internal Sources Code Label Positive Edge triggered +#define AT91C_AIC_SRCTYPE_EXT_NEGATIVE_EDGE ((unsigned int) 0x1 << 5) // (AIC) External Sources Code Label Negative Edge triggered +#define AT91C_AIC_SRCTYPE_HIGH_LEVEL ((unsigned int) 0x2 << 5) // (AIC) Internal Or External Sources Code Label High-level Sensitive +#define AT91C_AIC_SRCTYPE_POSITIVE_EDGE ((unsigned int) 0x3 << 5) // (AIC) Internal Or External Sources Code Label Positive Edge triggered +// -------- AIC_CISR : (AIC Offset: 0x114) AIC Core Interrupt Status Register -------- +#define AT91C_AIC_NFIQ ((unsigned int) 0x1 << 0) // (AIC) NFIQ Status +#define AT91C_AIC_NIRQ ((unsigned int) 0x1 << 1) // (AIC) NIRQ Status +// -------- AIC_DCR : (AIC Offset: 0x138) AIC Debug Control Register (Protect) -------- +#define AT91C_AIC_DCR_PROT ((unsigned int) 0x1 << 0) // (AIC) Protection Mode +#define AT91C_AIC_DCR_GMSK ((unsigned int) 0x1 << 1) // (AIC) General Mask + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Peripheral DMA Controller +// ***************************************************************************** +typedef struct _AT91S_PDC { + AT91_REG PDC_RPR; // Receive Pointer Register + AT91_REG PDC_RCR; // Receive Counter Register + AT91_REG PDC_TPR; // Transmit Pointer Register + AT91_REG PDC_TCR; // Transmit Counter Register + AT91_REG PDC_RNPR; // Receive Next Pointer Register + AT91_REG PDC_RNCR; // Receive Next Counter Register + AT91_REG PDC_TNPR; // Transmit Next Pointer Register + AT91_REG PDC_TNCR; // Transmit Next Counter Register + AT91_REG PDC_PTCR; // PDC Transfer Control Register + AT91_REG PDC_PTSR; // PDC Transfer Status Register +} AT91S_PDC, *AT91PS_PDC; + +// -------- PDC_PTCR : (PDC Offset: 0x20) PDC Transfer Control Register -------- +#define AT91C_PDC_RXTEN ((unsigned int) 0x1 << 0) // (PDC) Receiver Transfer Enable +#define AT91C_PDC_RXTDIS ((unsigned int) 0x1 << 1) // (PDC) Receiver Transfer Disable +#define AT91C_PDC_TXTEN ((unsigned int) 0x1 << 8) // (PDC) Transmitter Transfer Enable +#define AT91C_PDC_TXTDIS ((unsigned int) 0x1 << 9) // (PDC) Transmitter Transfer Disable +// -------- PDC_PTSR : (PDC Offset: 0x24) PDC Transfer Status Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Debug Unit +// ***************************************************************************** +typedef struct _AT91S_DBGU { + AT91_REG DBGU_CR; // Control Register + AT91_REG DBGU_MR; // Mode Register + AT91_REG DBGU_IER; // Interrupt Enable Register + AT91_REG DBGU_IDR; // Interrupt Disable Register + AT91_REG DBGU_IMR; // Interrupt Mask Register + AT91_REG DBGU_CSR; // Channel Status Register + AT91_REG DBGU_RHR; // Receiver Holding Register + AT91_REG DBGU_THR; // Transmitter Holding Register + AT91_REG DBGU_BRGR; // Baud Rate Generator Register + AT91_REG Reserved0[7]; // + AT91_REG DBGU_CIDR; // Chip ID Register + AT91_REG DBGU_EXID; // Chip ID Extension Register + AT91_REG DBGU_FNTR; // Force NTRST Register + AT91_REG Reserved1[45]; // + AT91_REG DBGU_RPR; // Receive Pointer Register + AT91_REG DBGU_RCR; // Receive Counter Register + AT91_REG DBGU_TPR; // Transmit Pointer Register + AT91_REG DBGU_TCR; // Transmit Counter Register + AT91_REG DBGU_RNPR; // Receive Next Pointer Register + AT91_REG DBGU_RNCR; // Receive Next Counter Register + AT91_REG DBGU_TNPR; // Transmit Next Pointer Register + AT91_REG DBGU_TNCR; // Transmit Next Counter Register + AT91_REG DBGU_PTCR; // PDC Transfer Control Register + AT91_REG DBGU_PTSR; // PDC Transfer Status Register +} AT91S_DBGU, *AT91PS_DBGU; + +// -------- DBGU_CR : (DBGU Offset: 0x0) Debug Unit Control Register -------- +#define AT91C_US_RSTRX ((unsigned int) 0x1 << 2) // (DBGU) Reset Receiver +#define AT91C_US_RSTTX ((unsigned int) 0x1 << 3) // (DBGU) Reset Transmitter +#define AT91C_US_RXEN ((unsigned int) 0x1 << 4) // (DBGU) Receiver Enable +#define AT91C_US_RXDIS ((unsigned int) 0x1 << 5) // (DBGU) Receiver Disable +#define AT91C_US_TXEN ((unsigned int) 0x1 << 6) // (DBGU) Transmitter Enable +#define AT91C_US_TXDIS ((unsigned int) 0x1 << 7) // (DBGU) Transmitter Disable +#define AT91C_US_RSTSTA ((unsigned int) 0x1 << 8) // (DBGU) Reset Status Bits +// -------- DBGU_MR : (DBGU Offset: 0x4) Debug Unit Mode Register -------- +#define AT91C_US_PAR ((unsigned int) 0x7 << 9) // (DBGU) Parity type +#define AT91C_US_PAR_EVEN ((unsigned int) 0x0 << 9) // (DBGU) Even Parity +#define AT91C_US_PAR_ODD ((unsigned int) 0x1 << 9) // (DBGU) Odd Parity +#define AT91C_US_PAR_SPACE ((unsigned int) 0x2 << 9) // (DBGU) Parity forced to 0 (Space) +#define AT91C_US_PAR_MARK ((unsigned int) 0x3 << 9) // (DBGU) Parity forced to 1 (Mark) +#define AT91C_US_PAR_NONE ((unsigned int) 0x4 << 9) // (DBGU) No Parity +#define AT91C_US_PAR_MULTI_DROP ((unsigned int) 0x6 << 9) // (DBGU) Multi-drop mode +#define AT91C_US_CHMODE ((unsigned int) 0x3 << 14) // (DBGU) Channel Mode +#define AT91C_US_CHMODE_NORMAL ((unsigned int) 0x0 << 14) // (DBGU) Normal Mode: The USART channel operates as an RX/TX USART. +#define AT91C_US_CHMODE_AUTO ((unsigned int) 0x1 << 14) // (DBGU) Automatic Echo: Receiver Data Input is connected to the TXD pin. +#define AT91C_US_CHMODE_LOCAL ((unsigned int) 0x2 << 14) // (DBGU) Local Loopback: Transmitter Output Signal is connected to Receiver Input Signal. +#define AT91C_US_CHMODE_REMOTE ((unsigned int) 0x3 << 14) // (DBGU) Remote Loopback: RXD pin is internally connected to TXD pin. +// -------- DBGU_IER : (DBGU Offset: 0x8) Debug Unit Interrupt Enable Register -------- +#define AT91C_US_RXRDY ((unsigned int) 0x1 << 0) // (DBGU) RXRDY Interrupt +#define AT91C_US_TXRDY ((unsigned int) 0x1 << 1) // (DBGU) TXRDY Interrupt +#define AT91C_US_ENDRX ((unsigned int) 0x1 << 3) // (DBGU) End of Receive Transfer Interrupt +#define AT91C_US_ENDTX ((unsigned int) 0x1 << 4) // (DBGU) End of Transmit Interrupt +#define AT91C_US_OVRE ((unsigned int) 0x1 << 5) // (DBGU) Overrun Interrupt +#define AT91C_US_FRAME ((unsigned int) 0x1 << 6) // (DBGU) Framing Error Interrupt +#define AT91C_US_PARE ((unsigned int) 0x1 << 7) // (DBGU) Parity Error Interrupt +#define AT91C_US_TXEMPTY ((unsigned int) 0x1 << 9) // (DBGU) TXEMPTY Interrupt +#define AT91C_US_TXBUFE ((unsigned int) 0x1 << 11) // (DBGU) TXBUFE Interrupt +#define AT91C_US_RXBUFF ((unsigned int) 0x1 << 12) // (DBGU) RXBUFF Interrupt +#define AT91C_US_COMM_TX ((unsigned int) 0x1 << 30) // (DBGU) COMM_TX Interrupt +#define AT91C_US_COMM_RX ((unsigned int) 0x1 << 31) // (DBGU) COMM_RX Interrupt +// -------- DBGU_IDR : (DBGU Offset: 0xc) Debug Unit Interrupt Disable Register -------- +// -------- DBGU_IMR : (DBGU Offset: 0x10) Debug Unit Interrupt Mask Register -------- +// -------- DBGU_CSR : (DBGU Offset: 0x14) Debug Unit Channel Status Register -------- +// -------- DBGU_FNTR : (DBGU Offset: 0x48) Debug Unit FORCE_NTRST Register -------- +#define AT91C_US_FORCE_NTRST ((unsigned int) 0x1 << 0) // (DBGU) Force NTRST in JTAG + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Parallel Input Output Controler +// ***************************************************************************** +typedef struct _AT91S_PIO { + AT91_REG PIO_PER; // PIO Enable Register + AT91_REG PIO_PDR; // PIO Disable Register + AT91_REG PIO_PSR; // PIO Status Register + AT91_REG Reserved0[1]; // + AT91_REG PIO_OER; // Output Enable Register + AT91_REG PIO_ODR; // Output Disable Registerr + AT91_REG PIO_OSR; // Output Status Register + AT91_REG Reserved1[1]; // + AT91_REG PIO_IFER; // Input Filter Enable Register + AT91_REG PIO_IFDR; // Input Filter Disable Register + AT91_REG PIO_IFSR; // Input Filter Status Register + AT91_REG Reserved2[1]; // + AT91_REG PIO_SODR; // Set Output Data Register + AT91_REG PIO_CODR; // Clear Output Data Register + AT91_REG PIO_ODSR; // Output Data Status Register + AT91_REG PIO_PDSR; // Pin Data Status Register + AT91_REG PIO_IER; // Interrupt Enable Register + AT91_REG PIO_IDR; // Interrupt Disable Register + AT91_REG PIO_IMR; // Interrupt Mask Register + AT91_REG PIO_ISR; // Interrupt Status Register + AT91_REG PIO_MDER; // Multi-driver Enable Register + AT91_REG PIO_MDDR; // Multi-driver Disable Register + AT91_REG PIO_MDSR; // Multi-driver Status Register + AT91_REG Reserved3[1]; // + AT91_REG PIO_PPUDR; // Pull-up Disable Register + AT91_REG PIO_PPUER; // Pull-up Enable Register + AT91_REG PIO_PPUSR; // Pull-up Status Register + AT91_REG Reserved4[1]; // + AT91_REG PIO_ASR; // Select A Register + AT91_REG PIO_BSR; // Select B Register + AT91_REG PIO_ABSR; // AB Select Status Register + AT91_REG Reserved5[9]; // + AT91_REG PIO_OWER; // Output Write Enable Register + AT91_REG PIO_OWDR; // Output Write Disable Register + AT91_REG PIO_OWSR; // Output Write Status Register +} AT91S_PIO, *AT91PS_PIO; + + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Clock Generator Controler +// ***************************************************************************** +typedef struct _AT91S_CKGR { + AT91_REG CKGR_MOR; // Main Oscillator Register + AT91_REG CKGR_MCFR; // Main Clock Frequency Register + AT91_REG Reserved0[1]; // + AT91_REG CKGR_PLLR; // PLL Register +} AT91S_CKGR, *AT91PS_CKGR; + +// -------- CKGR_MOR : (CKGR Offset: 0x0) Main Oscillator Register -------- +#define AT91C_CKGR_MOSCEN ((unsigned int) 0x1 << 0) // (CKGR) Main Oscillator Enable +#define AT91C_CKGR_OSCBYPASS ((unsigned int) 0x1 << 1) // (CKGR) Main Oscillator Bypass +#define AT91C_CKGR_OSCOUNT ((unsigned int) 0xFF << 8) // (CKGR) Main Oscillator Start-up Time +// -------- CKGR_MCFR : (CKGR Offset: 0x4) Main Clock Frequency Register -------- +#define AT91C_CKGR_MAINF ((unsigned int) 0xFFFF << 0) // (CKGR) Main Clock Frequency +#define AT91C_CKGR_MAINRDY ((unsigned int) 0x1 << 16) // (CKGR) Main Clock Ready +// -------- CKGR_PLLR : (CKGR Offset: 0xc) PLL B Register -------- +#define AT91C_CKGR_DIV ((unsigned int) 0xFF << 0) // (CKGR) Divider Selected +#define AT91C_CKGR_DIV_0 ((unsigned int) 0x0) // (CKGR) Divider output is 0 +#define AT91C_CKGR_DIV_BYPASS ((unsigned int) 0x1) // (CKGR) Divider is bypassed +#define AT91C_CKGR_PLLCOUNT ((unsigned int) 0x3F << 8) // (CKGR) PLL Counter +#define AT91C_CKGR_OUT ((unsigned int) 0x3 << 14) // (CKGR) PLL Output Frequency Range +#define AT91C_CKGR_OUT_0 ((unsigned int) 0x0 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_OUT_1 ((unsigned int) 0x1 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_OUT_2 ((unsigned int) 0x2 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_OUT_3 ((unsigned int) 0x3 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_MUL ((unsigned int) 0x7FF << 16) // (CKGR) PLL Multiplier +#define AT91C_CKGR_USBDIV ((unsigned int) 0x3 << 28) // (CKGR) Divider for USB Clocks +#define AT91C_CKGR_USBDIV_0 ((unsigned int) 0x0 << 28) // (CKGR) Divider output is PLL clock output +#define AT91C_CKGR_USBDIV_1 ((unsigned int) 0x1 << 28) // (CKGR) Divider output is PLL clock output divided by 2 +#define AT91C_CKGR_USBDIV_2 ((unsigned int) 0x2 << 28) // (CKGR) Divider output is PLL clock output divided by 4 + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Power Management Controler +// ***************************************************************************** +typedef struct _AT91S_PMC { + AT91_REG PMC_SCER; // System Clock Enable Register + AT91_REG PMC_SCDR; // System Clock Disable Register + AT91_REG PMC_SCSR; // System Clock Status Register + AT91_REG Reserved0[1]; // + AT91_REG PMC_PCER; // Peripheral Clock Enable Register + AT91_REG PMC_PCDR; // Peripheral Clock Disable Register + AT91_REG PMC_PCSR; // Peripheral Clock Status Register + AT91_REG Reserved1[1]; // + AT91_REG PMC_MOR; // Main Oscillator Register + AT91_REG PMC_MCFR; // Main Clock Frequency Register + AT91_REG Reserved2[1]; // + AT91_REG PMC_PLLR; // PLL Register + AT91_REG PMC_MCKR; // Master Clock Register + AT91_REG Reserved3[3]; // + AT91_REG PMC_PCKR[4]; // Programmable Clock Register + AT91_REG Reserved4[4]; // + AT91_REG PMC_IER; // Interrupt Enable Register + AT91_REG PMC_IDR; // Interrupt Disable Register + AT91_REG PMC_SR; // Status Register + AT91_REG PMC_IMR; // Interrupt Mask Register +} AT91S_PMC, *AT91PS_PMC; + +// -------- PMC_SCER : (PMC Offset: 0x0) System Clock Enable Register -------- +#define AT91C_PMC_PCK ((unsigned int) 0x1 << 0) // (PMC) Processor Clock +#define AT91C_PMC_UDP ((unsigned int) 0x1 << 7) // (PMC) USB Device Port Clock +#define AT91C_PMC_PCK0 ((unsigned int) 0x1 << 8) // (PMC) Programmable Clock Output +#define AT91C_PMC_PCK1 ((unsigned int) 0x1 << 9) // (PMC) Programmable Clock Output +#define AT91C_PMC_PCK2 ((unsigned int) 0x1 << 10) // (PMC) Programmable Clock Output +#define AT91C_PMC_PCK3 ((unsigned int) 0x1 << 11) // (PMC) Programmable Clock Output +// -------- PMC_SCDR : (PMC Offset: 0x4) System Clock Disable Register -------- +// -------- PMC_SCSR : (PMC Offset: 0x8) System Clock Status Register -------- +// -------- CKGR_MOR : (PMC Offset: 0x20) Main Oscillator Register -------- +// -------- CKGR_MCFR : (PMC Offset: 0x24) Main Clock Frequency Register -------- +// -------- CKGR_PLLR : (PMC Offset: 0x2c) PLL B Register -------- +// -------- PMC_MCKR : (PMC Offset: 0x30) Master Clock Register -------- +#define AT91C_PMC_CSS ((unsigned int) 0x3 << 0) // (PMC) Programmable Clock Selection +#define AT91C_PMC_CSS_SLOW_CLK ((unsigned int) 0x0) // (PMC) Slow Clock is selected +#define AT91C_PMC_CSS_MAIN_CLK ((unsigned int) 0x1) // (PMC) Main Clock is selected +#define AT91C_PMC_CSS_PLL_CLK ((unsigned int) 0x3) // (PMC) Clock from PLL is selected +#define AT91C_PMC_PRES ((unsigned int) 0x7 << 2) // (PMC) Programmable Clock Prescaler +#define AT91C_PMC_PRES_CLK ((unsigned int) 0x0 << 2) // (PMC) Selected clock +#define AT91C_PMC_PRES_CLK_2 ((unsigned int) 0x1 << 2) // (PMC) Selected clock divided by 2 +#define AT91C_PMC_PRES_CLK_4 ((unsigned int) 0x2 << 2) // (PMC) Selected clock divided by 4 +#define AT91C_PMC_PRES_CLK_8 ((unsigned int) 0x3 << 2) // (PMC) Selected clock divided by 8 +#define AT91C_PMC_PRES_CLK_16 ((unsigned int) 0x4 << 2) // (PMC) Selected clock divided by 16 +#define AT91C_PMC_PRES_CLK_32 ((unsigned int) 0x5 << 2) // (PMC) Selected clock divided by 32 +#define AT91C_PMC_PRES_CLK_64 ((unsigned int) 0x6 << 2) // (PMC) Selected clock divided by 64 +// -------- PMC_PCKR : (PMC Offset: 0x40) Programmable Clock Register -------- +// -------- PMC_IER : (PMC Offset: 0x60) PMC Interrupt Enable Register -------- +#define AT91C_PMC_MOSCS ((unsigned int) 0x1 << 0) // (PMC) MOSC Status/Enable/Disable/Mask +#define AT91C_PMC_LOCK ((unsigned int) 0x1 << 2) // (PMC) PLL Status/Enable/Disable/Mask +#define AT91C_PMC_MCKRDY ((unsigned int) 0x1 << 3) // (PMC) MCK_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK0RDY ((unsigned int) 0x1 << 8) // (PMC) PCK0_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK1RDY ((unsigned int) 0x1 << 9) // (PMC) PCK1_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK2RDY ((unsigned int) 0x1 << 10) // (PMC) PCK2_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK3RDY ((unsigned int) 0x1 << 11) // (PMC) PCK3_RDY Status/Enable/Disable/Mask +// -------- PMC_IDR : (PMC Offset: 0x64) PMC Interrupt Disable Register -------- +// -------- PMC_SR : (PMC Offset: 0x68) PMC Status Register -------- +// -------- PMC_IMR : (PMC Offset: 0x6c) PMC Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Reset Controller Interface +// ***************************************************************************** +typedef struct _AT91S_RSTC { + AT91_REG RSTC_RCR; // Reset Control Register + AT91_REG RSTC_RSR; // Reset Status Register + AT91_REG RSTC_RMR; // Reset Mode Register +} AT91S_RSTC, *AT91PS_RSTC; + +// -------- RSTC_RCR : (RSTC Offset: 0x0) Reset Control Register -------- +#define AT91C_RSTC_PROCRST ((unsigned int) 0x1 << 0) // (RSTC) Processor Reset +#define AT91C_RSTC_PERRST ((unsigned int) 0x1 << 2) // (RSTC) Peripheral Reset +#define AT91C_RSTC_EXTRST ((unsigned int) 0x1 << 3) // (RSTC) External Reset +#define AT91C_RSTC_KEY ((unsigned int) 0xFF << 24) // (RSTC) Password +// -------- RSTC_RSR : (RSTC Offset: 0x4) Reset Status Register -------- +#define AT91C_RSTC_URSTS ((unsigned int) 0x1 << 0) // (RSTC) User Reset Status +#define AT91C_RSTC_BODSTS ((unsigned int) 0x1 << 1) // (RSTC) Brownout Detection Status +#define AT91C_RSTC_RSTTYP ((unsigned int) 0x7 << 8) // (RSTC) Reset Type +#define AT91C_RSTC_RSTTYP_POWERUP ((unsigned int) 0x0 << 8) // (RSTC) Power-up Reset. VDDCORE rising. +#define AT91C_RSTC_RSTTYP_WAKEUP ((unsigned int) 0x1 << 8) // (RSTC) WakeUp Reset. VDDCORE rising. +#define AT91C_RSTC_RSTTYP_WATCHDOG ((unsigned int) 0x2 << 8) // (RSTC) Watchdog Reset. Watchdog overflow occured. +#define AT91C_RSTC_RSTTYP_SOFTWARE ((unsigned int) 0x3 << 8) // (RSTC) Software Reset. Processor reset required by the software. +#define AT91C_RSTC_RSTTYP_USER ((unsigned int) 0x4 << 8) // (RSTC) User Reset. NRST pin detected low. +#define AT91C_RSTC_RSTTYP_BROWNOUT ((unsigned int) 0x5 << 8) // (RSTC) Brownout Reset occured. +#define AT91C_RSTC_NRSTL ((unsigned int) 0x1 << 16) // (RSTC) NRST pin level +#define AT91C_RSTC_SRCMP ((unsigned int) 0x1 << 17) // (RSTC) Software Reset Command in Progress. +// -------- RSTC_RMR : (RSTC Offset: 0x8) Reset Mode Register -------- +#define AT91C_RSTC_URSTEN ((unsigned int) 0x1 << 0) // (RSTC) User Reset Enable +#define AT91C_RSTC_URSTIEN ((unsigned int) 0x1 << 4) // (RSTC) User Reset Interrupt Enable +#define AT91C_RSTC_ERSTL ((unsigned int) 0xF << 8) // (RSTC) User Reset Length +#define AT91C_RSTC_BODIEN ((unsigned int) 0x1 << 16) // (RSTC) Brownout Detection Interrupt Enable + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Real Time Timer Controller Interface +// ***************************************************************************** +typedef struct _AT91S_RTTC { + AT91_REG RTTC_RTMR; // Real-time Mode Register + AT91_REG RTTC_RTAR; // Real-time Alarm Register + AT91_REG RTTC_RTVR; // Real-time Value Register + AT91_REG RTTC_RTSR; // Real-time Status Register +} AT91S_RTTC, *AT91PS_RTTC; + +// -------- RTTC_RTMR : (RTTC Offset: 0x0) Real-time Mode Register -------- +#define AT91C_RTTC_RTPRES ((unsigned int) 0xFFFF << 0) // (RTTC) Real-time Timer Prescaler Value +#define AT91C_RTTC_ALMIEN ((unsigned int) 0x1 << 16) // (RTTC) Alarm Interrupt Enable +#define AT91C_RTTC_RTTINCIEN ((unsigned int) 0x1 << 17) // (RTTC) Real Time Timer Increment Interrupt Enable +#define AT91C_RTTC_RTTRST ((unsigned int) 0x1 << 18) // (RTTC) Real Time Timer Restart +// -------- RTTC_RTAR : (RTTC Offset: 0x4) Real-time Alarm Register -------- +#define AT91C_RTTC_ALMV ((unsigned int) 0x0 << 0) // (RTTC) Alarm Value +// -------- RTTC_RTVR : (RTTC Offset: 0x8) Current Real-time Value Register -------- +#define AT91C_RTTC_CRTV ((unsigned int) 0x0 << 0) // (RTTC) Current Real-time Value +// -------- RTTC_RTSR : (RTTC Offset: 0xc) Real-time Status Register -------- +#define AT91C_RTTC_ALMS ((unsigned int) 0x1 << 0) // (RTTC) Real-time Alarm Status +#define AT91C_RTTC_RTTINC ((unsigned int) 0x1 << 1) // (RTTC) Real-time Timer Increment + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Periodic Interval Timer Controller Interface +// ***************************************************************************** +typedef struct _AT91S_PITC { + AT91_REG PITC_PIMR; // Period Interval Mode Register + AT91_REG PITC_PISR; // Period Interval Status Register + AT91_REG PITC_PIVR; // Period Interval Value Register + AT91_REG PITC_PIIR; // Period Interval Image Register +} AT91S_PITC, *AT91PS_PITC; + +// -------- PITC_PIMR : (PITC Offset: 0x0) Periodic Interval Mode Register -------- +#define AT91C_PITC_PIV ((unsigned int) 0xFFFFF << 0) // (PITC) Periodic Interval Value +#define AT91C_PITC_PITEN ((unsigned int) 0x1 << 24) // (PITC) Periodic Interval Timer Enabled +#define AT91C_PITC_PITIEN ((unsigned int) 0x1 << 25) // (PITC) Periodic Interval Timer Interrupt Enable +// -------- PITC_PISR : (PITC Offset: 0x4) Periodic Interval Status Register -------- +#define AT91C_PITC_PITS ((unsigned int) 0x1 << 0) // (PITC) Periodic Interval Timer Status +// -------- PITC_PIVR : (PITC Offset: 0x8) Periodic Interval Value Register -------- +#define AT91C_PITC_CPIV ((unsigned int) 0xFFFFF << 0) // (PITC) Current Periodic Interval Value +#define AT91C_PITC_PICNT ((unsigned int) 0xFFF << 20) // (PITC) Periodic Interval Counter +// -------- PITC_PIIR : (PITC Offset: 0xc) Periodic Interval Image Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Watchdog Timer Controller Interface +// ***************************************************************************** +typedef struct _AT91S_WDTC { + AT91_REG WDTC_WDCR; // Watchdog Control Register + AT91_REG WDTC_WDMR; // Watchdog Mode Register + AT91_REG WDTC_WDSR; // Watchdog Status Register +} AT91S_WDTC, *AT91PS_WDTC; + +// -------- WDTC_WDCR : (WDTC Offset: 0x0) Periodic Interval Image Register -------- +#define AT91C_WDTC_WDRSTT ((unsigned int) 0x1 << 0) // (WDTC) Watchdog Restart +#define AT91C_WDTC_KEY ((unsigned int) 0xFF << 24) // (WDTC) Watchdog KEY Password +// -------- WDTC_WDMR : (WDTC Offset: 0x4) Watchdog Mode Register -------- +#define AT91C_WDTC_WDV ((unsigned int) 0xFFF << 0) // (WDTC) Watchdog Timer Restart +#define AT91C_WDTC_WDFIEN ((unsigned int) 0x1 << 12) // (WDTC) Watchdog Fault Interrupt Enable +#define AT91C_WDTC_WDRSTEN ((unsigned int) 0x1 << 13) // (WDTC) Watchdog Reset Enable +#define AT91C_WDTC_WDRPROC ((unsigned int) 0x1 << 14) // (WDTC) Watchdog Timer Restart +#define AT91C_WDTC_WDDIS ((unsigned int) 0x1 << 15) // (WDTC) Watchdog Disable +#define AT91C_WDTC_WDD ((unsigned int) 0xFFF << 16) // (WDTC) Watchdog Delta Value +#define AT91C_WDTC_WDDBGHLT ((unsigned int) 0x1 << 28) // (WDTC) Watchdog Debug Halt +#define AT91C_WDTC_WDIDLEHLT ((unsigned int) 0x1 << 29) // (WDTC) Watchdog Idle Halt +// -------- WDTC_WDSR : (WDTC Offset: 0x8) Watchdog Status Register -------- +#define AT91C_WDTC_WDUNF ((unsigned int) 0x1 << 0) // (WDTC) Watchdog Underflow +#define AT91C_WDTC_WDERR ((unsigned int) 0x1 << 1) // (WDTC) Watchdog Error + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Voltage Regulator Mode Controller Interface +// ***************************************************************************** +typedef struct _AT91S_VREG { + AT91_REG VREG_MR; // Voltage Regulator Mode Register +} AT91S_VREG, *AT91PS_VREG; + +// -------- VREG_MR : (VREG Offset: 0x0) Voltage Regulator Mode Register -------- +#define AT91C_VREG_PSTDBY ((unsigned int) 0x1 << 0) // (VREG) Voltage Regulator Power Standby Mode + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Memory Controller Interface +// ***************************************************************************** +typedef struct _AT91S_MC { + AT91_REG MC_RCR; // MC Remap Control Register + AT91_REG MC_ASR; // MC Abort Status Register + AT91_REG MC_AASR; // MC Abort Address Status Register + AT91_REG Reserved0[21]; // + AT91_REG MC_FMR; // MC Flash Mode Register + AT91_REG MC_FCR; // MC Flash Command Register + AT91_REG MC_FSR; // MC Flash Status Register +} AT91S_MC, *AT91PS_MC; + +// -------- MC_RCR : (MC Offset: 0x0) MC Remap Control Register -------- +#define AT91C_MC_RCB ((unsigned int) 0x1 << 0) // (MC) Remap Command Bit +// -------- MC_ASR : (MC Offset: 0x4) MC Abort Status Register -------- +#define AT91C_MC_UNDADD ((unsigned int) 0x1 << 0) // (MC) Undefined Addess Abort Status +#define AT91C_MC_MISADD ((unsigned int) 0x1 << 1) // (MC) Misaligned Addess Abort Status +#define AT91C_MC_ABTSZ ((unsigned int) 0x3 << 8) // (MC) Abort Size Status +#define AT91C_MC_ABTSZ_BYTE ((unsigned int) 0x0 << 8) // (MC) Byte +#define AT91C_MC_ABTSZ_HWORD ((unsigned int) 0x1 << 8) // (MC) Half-word +#define AT91C_MC_ABTSZ_WORD ((unsigned int) 0x2 << 8) // (MC) Word +#define AT91C_MC_ABTTYP ((unsigned int) 0x3 << 10) // (MC) Abort Type Status +#define AT91C_MC_ABTTYP_DATAR ((unsigned int) 0x0 << 10) // (MC) Data Read +#define AT91C_MC_ABTTYP_DATAW ((unsigned int) 0x1 << 10) // (MC) Data Write +#define AT91C_MC_ABTTYP_FETCH ((unsigned int) 0x2 << 10) // (MC) Code Fetch +#define AT91C_MC_MST0 ((unsigned int) 0x1 << 16) // (MC) Master 0 Abort Source +#define AT91C_MC_MST1 ((unsigned int) 0x1 << 17) // (MC) Master 1 Abort Source +#define AT91C_MC_SVMST0 ((unsigned int) 0x1 << 24) // (MC) Saved Master 0 Abort Source +#define AT91C_MC_SVMST1 ((unsigned int) 0x1 << 25) // (MC) Saved Master 1 Abort Source +// -------- MC_FMR : (MC Offset: 0x60) MC Flash Mode Register -------- +#define AT91C_MC_FRDY ((unsigned int) 0x1 << 0) // (MC) Flash Ready +#define AT91C_MC_LOCKE ((unsigned int) 0x1 << 2) // (MC) Lock Error +#define AT91C_MC_PROGE ((unsigned int) 0x1 << 3) // (MC) Programming Error +#define AT91C_MC_NEBP ((unsigned int) 0x1 << 7) // (MC) No Erase Before Programming +#define AT91C_MC_FWS ((unsigned int) 0x3 << 8) // (MC) Flash Wait State +#define AT91C_MC_FWS_0FWS ((unsigned int) 0x0 << 8) // (MC) 1 cycle for Read, 2 for Write operations +#define AT91C_MC_FWS_1FWS ((unsigned int) 0x1 << 8) // (MC) 2 cycles for Read, 3 for Write operations +#define AT91C_MC_FWS_2FWS ((unsigned int) 0x2 << 8) // (MC) 3 cycles for Read, 4 for Write operations +#define AT91C_MC_FWS_3FWS ((unsigned int) 0x3 << 8) // (MC) 4 cycles for Read, 4 for Write operations +#define AT91C_MC_FMCN ((unsigned int) 0xFF << 16) // (MC) Flash Microsecond Cycle Number +// -------- MC_FCR : (MC Offset: 0x64) MC Flash Command Register -------- +#define AT91C_MC_FCMD ((unsigned int) 0xF << 0) // (MC) Flash Command +#define AT91C_MC_FCMD_START_PROG ((unsigned int) 0x1) // (MC) Starts the programming of th epage specified by PAGEN. +#define AT91C_MC_FCMD_LOCK ((unsigned int) 0x2) // (MC) Starts a lock sequence of the sector defined by the bits 4 to 7 of the field PAGEN. +#define AT91C_MC_FCMD_PROG_AND_LOCK ((unsigned int) 0x3) // (MC) The lock sequence automatically happens after the programming sequence is completed. +#define AT91C_MC_FCMD_UNLOCK ((unsigned int) 0x4) // (MC) Starts an unlock sequence of the sector defined by the bits 4 to 7 of the field PAGEN. +#define AT91C_MC_FCMD_ERASE_ALL ((unsigned int) 0x8) // (MC) Starts the erase of the entire flash.If at least a page is locked, the command is cancelled. +#define AT91C_MC_FCMD_SET_GP_NVM ((unsigned int) 0xB) // (MC) Set General Purpose NVM bits. +#define AT91C_MC_FCMD_CLR_GP_NVM ((unsigned int) 0xD) // (MC) Clear General Purpose NVM bits. +#define AT91C_MC_FCMD_SET_SECURITY ((unsigned int) 0xF) // (MC) Set Security Bit. +#define AT91C_MC_PAGEN ((unsigned int) 0x3FF << 8) // (MC) Page Number +#define AT91C_MC_KEY ((unsigned int) 0xFF << 24) // (MC) Writing Protect Key +// -------- MC_FSR : (MC Offset: 0x68) MC Flash Command Register -------- +#define AT91C_MC_SECURITY ((unsigned int) 0x1 << 4) // (MC) Security Bit Status +#define AT91C_MC_GPNVM0 ((unsigned int) 0x1 << 8) // (MC) Sector 0 Lock Status +#define AT91C_MC_GPNVM1 ((unsigned int) 0x1 << 9) // (MC) Sector 1 Lock Status +#define AT91C_MC_GPNVM2 ((unsigned int) 0x1 << 10) // (MC) Sector 2 Lock Status +#define AT91C_MC_GPNVM3 ((unsigned int) 0x1 << 11) // (MC) Sector 3 Lock Status +#define AT91C_MC_GPNVM4 ((unsigned int) 0x1 << 12) // (MC) Sector 4 Lock Status +#define AT91C_MC_GPNVM5 ((unsigned int) 0x1 << 13) // (MC) Sector 5 Lock Status +#define AT91C_MC_GPNVM6 ((unsigned int) 0x1 << 14) // (MC) Sector 6 Lock Status +#define AT91C_MC_GPNVM7 ((unsigned int) 0x1 << 15) // (MC) Sector 7 Lock Status +#define AT91C_MC_LOCKS0 ((unsigned int) 0x1 << 16) // (MC) Sector 0 Lock Status +#define AT91C_MC_LOCKS1 ((unsigned int) 0x1 << 17) // (MC) Sector 1 Lock Status +#define AT91C_MC_LOCKS2 ((unsigned int) 0x1 << 18) // (MC) Sector 2 Lock Status +#define AT91C_MC_LOCKS3 ((unsigned int) 0x1 << 19) // (MC) Sector 3 Lock Status +#define AT91C_MC_LOCKS4 ((unsigned int) 0x1 << 20) // (MC) Sector 4 Lock Status +#define AT91C_MC_LOCKS5 ((unsigned int) 0x1 << 21) // (MC) Sector 5 Lock Status +#define AT91C_MC_LOCKS6 ((unsigned int) 0x1 << 22) // (MC) Sector 6 Lock Status +#define AT91C_MC_LOCKS7 ((unsigned int) 0x1 << 23) // (MC) Sector 7 Lock Status +#define AT91C_MC_LOCKS8 ((unsigned int) 0x1 << 24) // (MC) Sector 8 Lock Status +#define AT91C_MC_LOCKS9 ((unsigned int) 0x1 << 25) // (MC) Sector 9 Lock Status +#define AT91C_MC_LOCKS10 ((unsigned int) 0x1 << 26) // (MC) Sector 10 Lock Status +#define AT91C_MC_LOCKS11 ((unsigned int) 0x1 << 27) // (MC) Sector 11 Lock Status +#define AT91C_MC_LOCKS12 ((unsigned int) 0x1 << 28) // (MC) Sector 12 Lock Status +#define AT91C_MC_LOCKS13 ((unsigned int) 0x1 << 29) // (MC) Sector 13 Lock Status +#define AT91C_MC_LOCKS14 ((unsigned int) 0x1 << 30) // (MC) Sector 14 Lock Status +#define AT91C_MC_LOCKS15 ((unsigned int) 0x1 << 31) // (MC) Sector 15 Lock Status + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Serial Parallel Interface +// ***************************************************************************** +typedef struct _AT91S_SPI { + AT91_REG SPI_CR; // Control Register + AT91_REG SPI_MR; // Mode Register + AT91_REG SPI_RDR; // Receive Data Register + AT91_REG SPI_TDR; // Transmit Data Register + AT91_REG SPI_SR; // Status Register + AT91_REG SPI_IER; // Interrupt Enable Register + AT91_REG SPI_IDR; // Interrupt Disable Register + AT91_REG SPI_IMR; // Interrupt Mask Register + AT91_REG Reserved0[4]; // + AT91_REG SPI_CSR[4]; // Chip Select Register + AT91_REG Reserved1[48]; // + AT91_REG SPI_RPR; // Receive Pointer Register + AT91_REG SPI_RCR; // Receive Counter Register + AT91_REG SPI_TPR; // Transmit Pointer Register + AT91_REG SPI_TCR; // Transmit Counter Register + AT91_REG SPI_RNPR; // Receive Next Pointer Register + AT91_REG SPI_RNCR; // Receive Next Counter Register + AT91_REG SPI_TNPR; // Transmit Next Pointer Register + AT91_REG SPI_TNCR; // Transmit Next Counter Register + AT91_REG SPI_PTCR; // PDC Transfer Control Register + AT91_REG SPI_PTSR; // PDC Transfer Status Register +} AT91S_SPI, *AT91PS_SPI; + +// -------- SPI_CR : (SPI Offset: 0x0) SPI Control Register -------- +#define AT91C_SPI_SPIEN ((unsigned int) 0x1 << 0) // (SPI) SPI Enable +#define AT91C_SPI_SPIDIS ((unsigned int) 0x1 << 1) // (SPI) SPI Disable +#define AT91C_SPI_SWRST ((unsigned int) 0x1 << 7) // (SPI) SPI Software reset +#define AT91C_SPI_LASTXFER ((unsigned int) 0x1 << 24) // (SPI) SPI Last Transfer +// -------- SPI_MR : (SPI Offset: 0x4) SPI Mode Register -------- +#define AT91C_SPI_MSTR ((unsigned int) 0x1 << 0) // (SPI) Master/Slave Mode +#define AT91C_SPI_PS ((unsigned int) 0x1 << 1) // (SPI) Peripheral Select +#define AT91C_SPI_PS_FIXED ((unsigned int) 0x0 << 1) // (SPI) Fixed Peripheral Select +#define AT91C_SPI_PS_VARIABLE ((unsigned int) 0x1 << 1) // (SPI) Variable Peripheral Select +#define AT91C_SPI_PCSDEC ((unsigned int) 0x1 << 2) // (SPI) Chip Select Decode +#define AT91C_SPI_FDIV ((unsigned int) 0x1 << 3) // (SPI) Clock Selection +#define AT91C_SPI_MODFDIS ((unsigned int) 0x1 << 4) // (SPI) Mode Fault Detection +#define AT91C_SPI_LLB ((unsigned int) 0x1 << 7) // (SPI) Clock Selection +#define AT91C_SPI_PCS ((unsigned int) 0xF << 16) // (SPI) Peripheral Chip Select +#define AT91C_SPI_DLYBCS ((unsigned int) 0xFF << 24) // (SPI) Delay Between Chip Selects +// -------- SPI_RDR : (SPI Offset: 0x8) Receive Data Register -------- +#define AT91C_SPI_RD ((unsigned int) 0xFFFF << 0) // (SPI) Receive Data +#define AT91C_SPI_RPCS ((unsigned int) 0xF << 16) // (SPI) Peripheral Chip Select Status +// -------- SPI_TDR : (SPI Offset: 0xc) Transmit Data Register -------- +#define AT91C_SPI_TD ((unsigned int) 0xFFFF << 0) // (SPI) Transmit Data +#define AT91C_SPI_TPCS ((unsigned int) 0xF << 16) // (SPI) Peripheral Chip Select Status +// -------- SPI_SR : (SPI Offset: 0x10) Status Register -------- +#define AT91C_SPI_RDRF ((unsigned int) 0x1 << 0) // (SPI) Receive Data Register Full +#define AT91C_SPI_TDRE ((unsigned int) 0x1 << 1) // (SPI) Transmit Data Register Empty +#define AT91C_SPI_MODF ((unsigned int) 0x1 << 2) // (SPI) Mode Fault Error +#define AT91C_SPI_OVRES ((unsigned int) 0x1 << 3) // (SPI) Overrun Error Status +#define AT91C_SPI_ENDRX ((unsigned int) 0x1 << 4) // (SPI) End of Receiver Transfer +#define AT91C_SPI_ENDTX ((unsigned int) 0x1 << 5) // (SPI) End of Receiver Transfer +#define AT91C_SPI_RXBUFF ((unsigned int) 0x1 << 6) // (SPI) RXBUFF Interrupt +#define AT91C_SPI_TXBUFE ((unsigned int) 0x1 << 7) // (SPI) TXBUFE Interrupt +#define AT91C_SPI_NSSR ((unsigned int) 0x1 << 8) // (SPI) NSSR Interrupt +#define AT91C_SPI_TXEMPTY ((unsigned int) 0x1 << 9) // (SPI) TXEMPTY Interrupt +#define AT91C_SPI_SPIENS ((unsigned int) 0x1 << 16) // (SPI) Enable Status +// -------- SPI_IER : (SPI Offset: 0x14) Interrupt Enable Register -------- +// -------- SPI_IDR : (SPI Offset: 0x18) Interrupt Disable Register -------- +// -------- SPI_IMR : (SPI Offset: 0x1c) Interrupt Mask Register -------- +// -------- SPI_CSR : (SPI Offset: 0x30) Chip Select Register -------- +#define AT91C_SPI_CPOL ((unsigned int) 0x1 << 0) // (SPI) Clock Polarity +#define AT91C_SPI_NCPHA ((unsigned int) 0x1 << 1) // (SPI) Clock Phase +#define AT91C_SPI_CSAAT ((unsigned int) 0x1 << 3) // (SPI) Chip Select Active After Transfer +#define AT91C_SPI_BITS ((unsigned int) 0xF << 4) // (SPI) Bits Per Transfer +#define AT91C_SPI_BITS_8 ((unsigned int) 0x0 << 4) // (SPI) 8 Bits Per transfer +#define AT91C_SPI_BITS_9 ((unsigned int) 0x1 << 4) // (SPI) 9 Bits Per transfer +#define AT91C_SPI_BITS_10 ((unsigned int) 0x2 << 4) // (SPI) 10 Bits Per transfer +#define AT91C_SPI_BITS_11 ((unsigned int) 0x3 << 4) // (SPI) 11 Bits Per transfer +#define AT91C_SPI_BITS_12 ((unsigned int) 0x4 << 4) // (SPI) 12 Bits Per transfer +#define AT91C_SPI_BITS_13 ((unsigned int) 0x5 << 4) // (SPI) 13 Bits Per transfer +#define AT91C_SPI_BITS_14 ((unsigned int) 0x6 << 4) // (SPI) 14 Bits Per transfer +#define AT91C_SPI_BITS_15 ((unsigned int) 0x7 << 4) // (SPI) 15 Bits Per transfer +#define AT91C_SPI_BITS_16 ((unsigned int) 0x8 << 4) // (SPI) 16 Bits Per transfer +#define AT91C_SPI_SCBR ((unsigned int) 0xFF << 8) // (SPI) Serial Clock Baud Rate +#define AT91C_SPI_DLYBS ((unsigned int) 0xFF << 16) // (SPI) Delay Before SPCK +#define AT91C_SPI_DLYBCT ((unsigned int) 0xFF << 24) // (SPI) Delay Between Consecutive Transfers + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Usart +// ***************************************************************************** +typedef struct _AT91S_USART { + AT91_REG US_CR; // Control Register + AT91_REG US_MR; // Mode Register + AT91_REG US_IER; // Interrupt Enable Register + AT91_REG US_IDR; // Interrupt Disable Register + AT91_REG US_IMR; // Interrupt Mask Register + AT91_REG US_CSR; // Channel Status Register + AT91_REG US_RHR; // Receiver Holding Register + AT91_REG US_THR; // Transmitter Holding Register + AT91_REG US_BRGR; // Baud Rate Generator Register + AT91_REG US_RTOR; // Receiver Time-out Register + AT91_REG US_TTGR; // Transmitter Time-guard Register + AT91_REG Reserved0[5]; // + AT91_REG US_FIDI; // FI_DI_Ratio Register + AT91_REG US_NER; // Nb Errors Register + AT91_REG Reserved1[1]; // + AT91_REG US_IF; // IRDA_FILTER Register + AT91_REG Reserved2[44]; // + AT91_REG US_RPR; // Receive Pointer Register + AT91_REG US_RCR; // Receive Counter Register + AT91_REG US_TPR; // Transmit Pointer Register + AT91_REG US_TCR; // Transmit Counter Register + AT91_REG US_RNPR; // Receive Next Pointer Register + AT91_REG US_RNCR; // Receive Next Counter Register + AT91_REG US_TNPR; // Transmit Next Pointer Register + AT91_REG US_TNCR; // Transmit Next Counter Register + AT91_REG US_PTCR; // PDC Transfer Control Register + AT91_REG US_PTSR; // PDC Transfer Status Register +} AT91S_USART, *AT91PS_USART; + +// -------- US_CR : (USART Offset: 0x0) Debug Unit Control Register -------- +#define AT91C_US_STTBRK ((unsigned int) 0x1 << 9) // (USART) Start Break +#define AT91C_US_STPBRK ((unsigned int) 0x1 << 10) // (USART) Stop Break +#define AT91C_US_STTTO ((unsigned int) 0x1 << 11) // (USART) Start Time-out +#define AT91C_US_SENDA ((unsigned int) 0x1 << 12) // (USART) Send Address +#define AT91C_US_RSTIT ((unsigned int) 0x1 << 13) // (USART) Reset Iterations +#define AT91C_US_RSTNACK ((unsigned int) 0x1 << 14) // (USART) Reset Non Acknowledge +#define AT91C_US_RETTO ((unsigned int) 0x1 << 15) // (USART) Rearm Time-out +#define AT91C_US_DTREN ((unsigned int) 0x1 << 16) // (USART) Data Terminal ready Enable +#define AT91C_US_DTRDIS ((unsigned int) 0x1 << 17) // (USART) Data Terminal ready Disable +#define AT91C_US_RTSEN ((unsigned int) 0x1 << 18) // (USART) Request to Send enable +#define AT91C_US_RTSDIS ((unsigned int) 0x1 << 19) // (USART) Request to Send Disable +// -------- US_MR : (USART Offset: 0x4) Debug Unit Mode Register -------- +#define AT91C_US_USMODE ((unsigned int) 0xF << 0) // (USART) Usart mode +#define AT91C_US_USMODE_NORMAL ((unsigned int) 0x0) // (USART) Normal +#define AT91C_US_USMODE_RS485 ((unsigned int) 0x1) // (USART) RS485 +#define AT91C_US_USMODE_HWHSH ((unsigned int) 0x2) // (USART) Hardware Handshaking +#define AT91C_US_USMODE_MODEM ((unsigned int) 0x3) // (USART) Modem +#define AT91C_US_USMODE_ISO7816_0 ((unsigned int) 0x4) // (USART) ISO7816 protocol: T = 0 +#define AT91C_US_USMODE_ISO7816_1 ((unsigned int) 0x6) // (USART) ISO7816 protocol: T = 1 +#define AT91C_US_USMODE_IRDA ((unsigned int) 0x8) // (USART) IrDA +#define AT91C_US_USMODE_SWHSH ((unsigned int) 0xC) // (USART) Software Handshaking +#define AT91C_US_CLKS ((unsigned int) 0x3 << 4) // (USART) Clock Selection (Baud Rate generator Input Clock +#define AT91C_US_CLKS_CLOCK ((unsigned int) 0x0 << 4) // (USART) Clock +#define AT91C_US_CLKS_FDIV1 ((unsigned int) 0x1 << 4) // (USART) fdiv1 +#define AT91C_US_CLKS_SLOW ((unsigned int) 0x2 << 4) // (USART) slow_clock (ARM) +#define AT91C_US_CLKS_EXT ((unsigned int) 0x3 << 4) // (USART) External (SCK) +#define AT91C_US_CHRL ((unsigned int) 0x3 << 6) // (USART) Clock Selection (Baud Rate generator Input Clock +#define AT91C_US_CHRL_5_BITS ((unsigned int) 0x0 << 6) // (USART) Character Length: 5 bits +#define AT91C_US_CHRL_6_BITS ((unsigned int) 0x1 << 6) // (USART) Character Length: 6 bits +#define AT91C_US_CHRL_7_BITS ((unsigned int) 0x2 << 6) // (USART) Character Length: 7 bits +#define AT91C_US_CHRL_8_BITS ((unsigned int) 0x3 << 6) // (USART) Character Length: 8 bits +#define AT91C_US_SYNC ((unsigned int) 0x1 << 8) // (USART) Synchronous Mode Select +#define AT91C_US_NBSTOP ((unsigned int) 0x3 << 12) // (USART) Number of Stop bits +#define AT91C_US_NBSTOP_1_BIT ((unsigned int) 0x0 << 12) // (USART) 1 stop bit +#define AT91C_US_NBSTOP_15_BIT ((unsigned int) 0x1 << 12) // (USART) Asynchronous (SYNC=0) 2 stop bits Synchronous (SYNC=1) 2 stop bits +#define AT91C_US_NBSTOP_2_BIT ((unsigned int) 0x2 << 12) // (USART) 2 stop bits +#define AT91C_US_MSBF ((unsigned int) 0x1 << 16) // (USART) Bit Order +#define AT91C_US_MODE9 ((unsigned int) 0x1 << 17) // (USART) 9-bit Character length +#define AT91C_US_CKLO ((unsigned int) 0x1 << 18) // (USART) Clock Output Select +#define AT91C_US_OVER ((unsigned int) 0x1 << 19) // (USART) Over Sampling Mode +#define AT91C_US_INACK ((unsigned int) 0x1 << 20) // (USART) Inhibit Non Acknowledge +#define AT91C_US_DSNACK ((unsigned int) 0x1 << 21) // (USART) Disable Successive NACK +#define AT91C_US_MAX_ITER ((unsigned int) 0x1 << 24) // (USART) Number of Repetitions +#define AT91C_US_FILTER ((unsigned int) 0x1 << 28) // (USART) Receive Line Filter +// -------- US_IER : (USART Offset: 0x8) Debug Unit Interrupt Enable Register -------- +#define AT91C_US_RXBRK ((unsigned int) 0x1 << 2) // (USART) Break Received/End of Break +#define AT91C_US_TIMEOUT ((unsigned int) 0x1 << 8) // (USART) Receiver Time-out +#define AT91C_US_ITERATION ((unsigned int) 0x1 << 10) // (USART) Max number of Repetitions Reached +#define AT91C_US_NACK ((unsigned int) 0x1 << 13) // (USART) Non Acknowledge +#define AT91C_US_RIIC ((unsigned int) 0x1 << 16) // (USART) Ring INdicator Input Change Flag +#define AT91C_US_DSRIC ((unsigned int) 0x1 << 17) // (USART) Data Set Ready Input Change Flag +#define AT91C_US_DCDIC ((unsigned int) 0x1 << 18) // (USART) Data Carrier Flag +#define AT91C_US_CTSIC ((unsigned int) 0x1 << 19) // (USART) Clear To Send Input Change Flag +// -------- US_IDR : (USART Offset: 0xc) Debug Unit Interrupt Disable Register -------- +// -------- US_IMR : (USART Offset: 0x10) Debug Unit Interrupt Mask Register -------- +// -------- US_CSR : (USART Offset: 0x14) Debug Unit Channel Status Register -------- +#define AT91C_US_RI ((unsigned int) 0x1 << 20) // (USART) Image of RI Input +#define AT91C_US_DSR ((unsigned int) 0x1 << 21) // (USART) Image of DSR Input +#define AT91C_US_DCD ((unsigned int) 0x1 << 22) // (USART) Image of DCD Input +#define AT91C_US_CTS ((unsigned int) 0x1 << 23) // (USART) Image of CTS Input + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Synchronous Serial Controller Interface +// ***************************************************************************** +typedef struct _AT91S_SSC { + AT91_REG SSC_CR; // Control Register + AT91_REG SSC_CMR; // Clock Mode Register + AT91_REG Reserved0[2]; // + AT91_REG SSC_RCMR; // Receive Clock ModeRegister + AT91_REG SSC_RFMR; // Receive Frame Mode Register + AT91_REG SSC_TCMR; // Transmit Clock Mode Register + AT91_REG SSC_TFMR; // Transmit Frame Mode Register + AT91_REG SSC_RHR; // Receive Holding Register + AT91_REG SSC_THR; // Transmit Holding Register + AT91_REG Reserved1[2]; // + AT91_REG SSC_RSHR; // Receive Sync Holding Register + AT91_REG SSC_TSHR; // Transmit Sync Holding Register + AT91_REG Reserved2[2]; // + AT91_REG SSC_SR; // Status Register + AT91_REG SSC_IER; // Interrupt Enable Register + AT91_REG SSC_IDR; // Interrupt Disable Register + AT91_REG SSC_IMR; // Interrupt Mask Register + AT91_REG Reserved3[44]; // + AT91_REG SSC_RPR; // Receive Pointer Register + AT91_REG SSC_RCR; // Receive Counter Register + AT91_REG SSC_TPR; // Transmit Pointer Register + AT91_REG SSC_TCR; // Transmit Counter Register + AT91_REG SSC_RNPR; // Receive Next Pointer Register + AT91_REG SSC_RNCR; // Receive Next Counter Register + AT91_REG SSC_TNPR; // Transmit Next Pointer Register + AT91_REG SSC_TNCR; // Transmit Next Counter Register + AT91_REG SSC_PTCR; // PDC Transfer Control Register + AT91_REG SSC_PTSR; // PDC Transfer Status Register +} AT91S_SSC, *AT91PS_SSC; + +// -------- SSC_CR : (SSC Offset: 0x0) SSC Control Register -------- +#define AT91C_SSC_RXEN ((unsigned int) 0x1 << 0) // (SSC) Receive Enable +#define AT91C_SSC_RXDIS ((unsigned int) 0x1 << 1) // (SSC) Receive Disable +#define AT91C_SSC_TXEN ((unsigned int) 0x1 << 8) // (SSC) Transmit Enable +#define AT91C_SSC_TXDIS ((unsigned int) 0x1 << 9) // (SSC) Transmit Disable +#define AT91C_SSC_SWRST ((unsigned int) 0x1 << 15) // (SSC) Software Reset +// -------- SSC_RCMR : (SSC Offset: 0x10) SSC Receive Clock Mode Register -------- +#define AT91C_SSC_CKS ((unsigned int) 0x3 << 0) // (SSC) Receive/Transmit Clock Selection +#define AT91C_SSC_CKS_DIV ((unsigned int) 0x0) // (SSC) Divided Clock +#define AT91C_SSC_CKS_TK ((unsigned int) 0x1) // (SSC) TK Clock signal +#define AT91C_SSC_CKS_RK ((unsigned int) 0x2) // (SSC) RK pin +#define AT91C_SSC_CKO ((unsigned int) 0x7 << 2) // (SSC) Receive/Transmit Clock Output Mode Selection +#define AT91C_SSC_CKO_NONE ((unsigned int) 0x0 << 2) // (SSC) Receive/Transmit Clock Output Mode: None RK pin: Input-only +#define AT91C_SSC_CKO_CONTINOUS ((unsigned int) 0x1 << 2) // (SSC) Continuous Receive/Transmit Clock RK pin: Output +#define AT91C_SSC_CKO_DATA_TX ((unsigned int) 0x2 << 2) // (SSC) Receive/Transmit Clock only during data transfers RK pin: Output +#define AT91C_SSC_CKI ((unsigned int) 0x1 << 5) // (SSC) Receive/Transmit Clock Inversion +#define AT91C_SSC_CKG ((unsigned int) 0x3 << 6) // (SSC) Receive/Transmit Clock Gating Selection +#define AT91C_SSC_CKG_NONE ((unsigned int) 0x0 << 6) // (SSC) Receive/Transmit Clock Gating: None, continuous clock +#define AT91C_SSC_CKG_LOW ((unsigned int) 0x1 << 6) // (SSC) Receive/Transmit Clock enabled only if RF Low +#define AT91C_SSC_CKG_HIGH ((unsigned int) 0x2 << 6) // (SSC) Receive/Transmit Clock enabled only if RF High +#define AT91C_SSC_START ((unsigned int) 0xF << 8) // (SSC) Receive/Transmit Start Selection +#define AT91C_SSC_START_CONTINOUS ((unsigned int) 0x0 << 8) // (SSC) Continuous, as soon as the receiver is enabled, and immediately after the end of transfer of the previous data. +#define AT91C_SSC_START_TX ((unsigned int) 0x1 << 8) // (SSC) Transmit/Receive start +#define AT91C_SSC_START_LOW_RF ((unsigned int) 0x2 << 8) // (SSC) Detection of a low level on RF input +#define AT91C_SSC_START_HIGH_RF ((unsigned int) 0x3 << 8) // (SSC) Detection of a high level on RF input +#define AT91C_SSC_START_FALL_RF ((unsigned int) 0x4 << 8) // (SSC) Detection of a falling edge on RF input +#define AT91C_SSC_START_RISE_RF ((unsigned int) 0x5 << 8) // (SSC) Detection of a rising edge on RF input +#define AT91C_SSC_START_LEVEL_RF ((unsigned int) 0x6 << 8) // (SSC) Detection of any level change on RF input +#define AT91C_SSC_START_EDGE_RF ((unsigned int) 0x7 << 8) // (SSC) Detection of any edge on RF input +#define AT91C_SSC_START_0 ((unsigned int) 0x8 << 8) // (SSC) Compare 0 +#define AT91C_SSC_STOP ((unsigned int) 0x1 << 12) // (SSC) Receive Stop Selection +#define AT91C_SSC_STTDLY ((unsigned int) 0xFF << 16) // (SSC) Receive/Transmit Start Delay +#define AT91C_SSC_PERIOD ((unsigned int) 0xFF << 24) // (SSC) Receive/Transmit Period Divider Selection +// -------- SSC_RFMR : (SSC Offset: 0x14) SSC Receive Frame Mode Register -------- +#define AT91C_SSC_DATLEN ((unsigned int) 0x1F << 0) // (SSC) Data Length +#define AT91C_SSC_LOOP ((unsigned int) 0x1 << 5) // (SSC) Loop Mode +#define AT91C_SSC_MSBF ((unsigned int) 0x1 << 7) // (SSC) Most Significant Bit First +#define AT91C_SSC_DATNB ((unsigned int) 0xF << 8) // (SSC) Data Number per Frame +#define AT91C_SSC_FSLEN ((unsigned int) 0xF << 16) // (SSC) Receive/Transmit Frame Sync length +#define AT91C_SSC_FSOS ((unsigned int) 0x7 << 20) // (SSC) Receive/Transmit Frame Sync Output Selection +#define AT91C_SSC_FSOS_NONE ((unsigned int) 0x0 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: None RK pin Input-only +#define AT91C_SSC_FSOS_NEGATIVE ((unsigned int) 0x1 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Negative Pulse +#define AT91C_SSC_FSOS_POSITIVE ((unsigned int) 0x2 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Positive Pulse +#define AT91C_SSC_FSOS_LOW ((unsigned int) 0x3 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Driver Low during data transfer +#define AT91C_SSC_FSOS_HIGH ((unsigned int) 0x4 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Driver High during data transfer +#define AT91C_SSC_FSOS_TOGGLE ((unsigned int) 0x5 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Toggling at each start of data transfer +#define AT91C_SSC_FSEDGE ((unsigned int) 0x1 << 24) // (SSC) Frame Sync Edge Detection +// -------- SSC_TCMR : (SSC Offset: 0x18) SSC Transmit Clock Mode Register -------- +// -------- SSC_TFMR : (SSC Offset: 0x1c) SSC Transmit Frame Mode Register -------- +#define AT91C_SSC_DATDEF ((unsigned int) 0x1 << 5) // (SSC) Data Default Value +#define AT91C_SSC_FSDEN ((unsigned int) 0x1 << 23) // (SSC) Frame Sync Data Enable +// -------- SSC_SR : (SSC Offset: 0x40) SSC Status Register -------- +#define AT91C_SSC_TXRDY ((unsigned int) 0x1 << 0) // (SSC) Transmit Ready +#define AT91C_SSC_TXEMPTY ((unsigned int) 0x1 << 1) // (SSC) Transmit Empty +#define AT91C_SSC_ENDTX ((unsigned int) 0x1 << 2) // (SSC) End Of Transmission +#define AT91C_SSC_TXBUFE ((unsigned int) 0x1 << 3) // (SSC) Transmit Buffer Empty +#define AT91C_SSC_RXRDY ((unsigned int) 0x1 << 4) // (SSC) Receive Ready +#define AT91C_SSC_OVRUN ((unsigned int) 0x1 << 5) // (SSC) Receive Overrun +#define AT91C_SSC_ENDRX ((unsigned int) 0x1 << 6) // (SSC) End of Reception +#define AT91C_SSC_RXBUFF ((unsigned int) 0x1 << 7) // (SSC) Receive Buffer Full +#define AT91C_SSC_CP0 ((unsigned int) 0x1 << 8) // (SSC) Compare 0 +#define AT91C_SSC_CP1 ((unsigned int) 0x1 << 9) // (SSC) Compare 1 +#define AT91C_SSC_TXSYN ((unsigned int) 0x1 << 10) // (SSC) Transmit Sync +#define AT91C_SSC_RXSYN ((unsigned int) 0x1 << 11) // (SSC) Receive Sync +#define AT91C_SSC_TXENA ((unsigned int) 0x1 << 16) // (SSC) Transmit Enable +#define AT91C_SSC_RXENA ((unsigned int) 0x1 << 17) // (SSC) Receive Enable +// -------- SSC_IER : (SSC Offset: 0x44) SSC Interrupt Enable Register -------- +// -------- SSC_IDR : (SSC Offset: 0x48) SSC Interrupt Disable Register -------- +// -------- SSC_IMR : (SSC Offset: 0x4c) SSC Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Two-wire Interface +// ***************************************************************************** +typedef struct _AT91S_TWI { + AT91_REG TWI_CR; // Control Register + AT91_REG TWI_MMR; // Master Mode Register + AT91_REG Reserved0[1]; // + AT91_REG TWI_IADR; // Internal Address Register + AT91_REG TWI_CWGR; // Clock Waveform Generator Register + AT91_REG Reserved1[3]; // + AT91_REG TWI_SR; // Status Register + AT91_REG TWI_IER; // Interrupt Enable Register + AT91_REG TWI_IDR; // Interrupt Disable Register + AT91_REG TWI_IMR; // Interrupt Mask Register + AT91_REG TWI_RHR; // Receive Holding Register + AT91_REG TWI_THR; // Transmit Holding Register +} AT91S_TWI, *AT91PS_TWI; + +// -------- TWI_CR : (TWI Offset: 0x0) TWI Control Register -------- +#define AT91C_TWI_START ((unsigned int) 0x1 << 0) // (TWI) Send a START Condition +#define AT91C_TWI_STOP ((unsigned int) 0x1 << 1) // (TWI) Send a STOP Condition +#define AT91C_TWI_MSEN ((unsigned int) 0x1 << 2) // (TWI) TWI Master Transfer Enabled +#define AT91C_TWI_MSDIS ((unsigned int) 0x1 << 3) // (TWI) TWI Master Transfer Disabled +#define AT91C_TWI_SWRST ((unsigned int) 0x1 << 7) // (TWI) Software Reset +// -------- TWI_MMR : (TWI Offset: 0x4) TWI Master Mode Register -------- +#define AT91C_TWI_IADRSZ ((unsigned int) 0x3 << 8) // (TWI) Internal Device Address Size +#define AT91C_TWI_IADRSZ_NO ((unsigned int) 0x0 << 8) // (TWI) No internal device address +#define AT91C_TWI_IADRSZ_1_BYTE ((unsigned int) 0x1 << 8) // (TWI) One-byte internal device address +#define AT91C_TWI_IADRSZ_2_BYTE ((unsigned int) 0x2 << 8) // (TWI) Two-byte internal device address +#define AT91C_TWI_IADRSZ_3_BYTE ((unsigned int) 0x3 << 8) // (TWI) Three-byte internal device address +#define AT91C_TWI_MREAD ((unsigned int) 0x1 << 12) // (TWI) Master Read Direction +#define AT91C_TWI_DADR ((unsigned int) 0x7F << 16) // (TWI) Device Address +// -------- TWI_CWGR : (TWI Offset: 0x10) TWI Clock Waveform Generator Register -------- +#define AT91C_TWI_CLDIV ((unsigned int) 0xFF << 0) // (TWI) Clock Low Divider +#define AT91C_TWI_CHDIV ((unsigned int) 0xFF << 8) // (TWI) Clock High Divider +#define AT91C_TWI_CKDIV ((unsigned int) 0x7 << 16) // (TWI) Clock Divider +// -------- TWI_SR : (TWI Offset: 0x20) TWI Status Register -------- +#define AT91C_TWI_TXCOMP ((unsigned int) 0x1 << 0) // (TWI) Transmission Completed +#define AT91C_TWI_RXRDY ((unsigned int) 0x1 << 1) // (TWI) Receive holding register ReaDY +#define AT91C_TWI_TXRDY ((unsigned int) 0x1 << 2) // (TWI) Transmit holding register ReaDY +#define AT91C_TWI_OVRE ((unsigned int) 0x1 << 6) // (TWI) Overrun Error +#define AT91C_TWI_UNRE ((unsigned int) 0x1 << 7) // (TWI) Underrun Error +#define AT91C_TWI_NACK ((unsigned int) 0x1 << 8) // (TWI) Not Acknowledged +// -------- TWI_IER : (TWI Offset: 0x24) TWI Interrupt Enable Register -------- +// -------- TWI_IDR : (TWI Offset: 0x28) TWI Interrupt Disable Register -------- +// -------- TWI_IMR : (TWI Offset: 0x2c) TWI Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR PWMC Channel Interface +// ***************************************************************************** +typedef struct _AT91S_PWMC_CH { + AT91_REG PWMC_CMR; // Channel Mode Register + AT91_REG PWMC_CDTYR; // Channel Duty Cycle Register + AT91_REG PWMC_CPRDR; // Channel Period Register + AT91_REG PWMC_CCNTR; // Channel Counter Register + AT91_REG PWMC_CUPDR; // Channel Update Register + AT91_REG PWMC_Reserved[3]; // Reserved +} AT91S_PWMC_CH, *AT91PS_PWMC_CH; + +// -------- PWMC_CMR : (PWMC_CH Offset: 0x0) PWMC Channel Mode Register -------- +#define AT91C_PWMC_CPRE ((unsigned int) 0xF << 0) // (PWMC_CH) Channel Pre-scaler : PWMC_CLKx +#define AT91C_PWMC_CPRE_MCK ((unsigned int) 0x0) // (PWMC_CH) +#define AT91C_PWMC_CPRE_MCKA ((unsigned int) 0xB) // (PWMC_CH) +#define AT91C_PWMC_CPRE_MCKB ((unsigned int) 0xC) // (PWMC_CH) +#define AT91C_PWMC_CALG ((unsigned int) 0x1 << 8) // (PWMC_CH) Channel Alignment +#define AT91C_PWMC_CPOL ((unsigned int) 0x1 << 9) // (PWMC_CH) Channel Polarity +#define AT91C_PWMC_CPD ((unsigned int) 0x1 << 10) // (PWMC_CH) Channel Update Period +// -------- PWMC_CDTYR : (PWMC_CH Offset: 0x4) PWMC Channel Duty Cycle Register -------- +#define AT91C_PWMC_CDTY ((unsigned int) 0x0 << 0) // (PWMC_CH) Channel Duty Cycle +// -------- PWMC_CPRDR : (PWMC_CH Offset: 0x8) PWMC Channel Period Register -------- +#define AT91C_PWMC_CPRD ((unsigned int) 0x0 << 0) // (PWMC_CH) Channel Period +// -------- PWMC_CCNTR : (PWMC_CH Offset: 0xc) PWMC Channel Counter Register -------- +#define AT91C_PWMC_CCNT ((unsigned int) 0x0 << 0) // (PWMC_CH) Channel Counter +// -------- PWMC_CUPDR : (PWMC_CH Offset: 0x10) PWMC Channel Update Register -------- +#define AT91C_PWMC_CUPD ((unsigned int) 0x0 << 0) // (PWMC_CH) Channel Update + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Pulse Width Modulation Controller Interface +// ***************************************************************************** +typedef struct _AT91S_PWMC { + AT91_REG PWMC_MR; // PWMC Mode Register + AT91_REG PWMC_ENA; // PWMC Enable Register + AT91_REG PWMC_DIS; // PWMC Disable Register + AT91_REG PWMC_SR; // PWMC Status Register + AT91_REG PWMC_IER; // PWMC Interrupt Enable Register + AT91_REG PWMC_IDR; // PWMC Interrupt Disable Register + AT91_REG PWMC_IMR; // PWMC Interrupt Mask Register + AT91_REG PWMC_ISR; // PWMC Interrupt Status Register + AT91_REG Reserved0[55]; // + AT91_REG PWMC_VR; // PWMC Version Register + AT91_REG Reserved1[64]; // + AT91S_PWMC_CH PWMC_CH[4]; // PWMC Channel +} AT91S_PWMC, *AT91PS_PWMC; + +// -------- PWMC_MR : (PWMC Offset: 0x0) PWMC Mode Register -------- +#define AT91C_PWMC_DIVA ((unsigned int) 0xFF << 0) // (PWMC) CLKA divide factor. +#define AT91C_PWMC_PREA ((unsigned int) 0xF << 8) // (PWMC) Divider Input Clock Prescaler A +#define AT91C_PWMC_PREA_MCK ((unsigned int) 0x0 << 8) // (PWMC) +#define AT91C_PWMC_DIVB ((unsigned int) 0xFF << 16) // (PWMC) CLKB divide factor. +#define AT91C_PWMC_PREB ((unsigned int) 0xF << 24) // (PWMC) Divider Input Clock Prescaler B +#define AT91C_PWMC_PREB_MCK ((unsigned int) 0x0 << 24) // (PWMC) +// -------- PWMC_ENA : (PWMC Offset: 0x4) PWMC Enable Register -------- +#define AT91C_PWMC_CHID0 ((unsigned int) 0x1 << 0) // (PWMC) Channel ID 0 +#define AT91C_PWMC_CHID1 ((unsigned int) 0x1 << 1) // (PWMC) Channel ID 1 +#define AT91C_PWMC_CHID2 ((unsigned int) 0x1 << 2) // (PWMC) Channel ID 2 +#define AT91C_PWMC_CHID3 ((unsigned int) 0x1 << 3) // (PWMC) Channel ID 3 +// -------- PWMC_DIS : (PWMC Offset: 0x8) PWMC Disable Register -------- +// -------- PWMC_SR : (PWMC Offset: 0xc) PWMC Status Register -------- +// -------- PWMC_IER : (PWMC Offset: 0x10) PWMC Interrupt Enable Register -------- +// -------- PWMC_IDR : (PWMC Offset: 0x14) PWMC Interrupt Disable Register -------- +// -------- PWMC_IMR : (PWMC Offset: 0x18) PWMC Interrupt Mask Register -------- +// -------- PWMC_ISR : (PWMC Offset: 0x1c) PWMC Interrupt Status Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR USB Device Interface +// ***************************************************************************** +typedef struct _AT91S_UDP { + AT91_REG UDP_NUM; // Frame Number Register + AT91_REG UDP_GLBSTATE; // Global State Register + AT91_REG UDP_FADDR; // Function Address Register + AT91_REG Reserved0[1]; // + AT91_REG UDP_IER; // Interrupt Enable Register + AT91_REG UDP_IDR; // Interrupt Disable Register + AT91_REG UDP_IMR; // Interrupt Mask Register + AT91_REG UDP_ISR; // Interrupt Status Register + AT91_REG UDP_ICR; // Interrupt Clear Register + AT91_REG Reserved1[1]; // + AT91_REG UDP_RSTEP; // Reset Endpoint Register + AT91_REG Reserved2[1]; // + AT91_REG UDP_CSR[6]; // Endpoint Control and Status Register + AT91_REG Reserved3[2]; // + AT91_REG UDP_FDR[6]; // Endpoint FIFO Data Register + AT91_REG Reserved4[3]; // + AT91_REG UDP_TXVC; // Transceiver Control Register +} AT91S_UDP, *AT91PS_UDP; + +// -------- UDP_FRM_NUM : (UDP Offset: 0x0) USB Frame Number Register -------- +#define AT91C_UDP_FRM_NUM ((unsigned int) 0x7FF << 0) // (UDP) Frame Number as Defined in the Packet Field Formats +#define AT91C_UDP_FRM_ERR ((unsigned int) 0x1 << 16) // (UDP) Frame Error +#define AT91C_UDP_FRM_OK ((unsigned int) 0x1 << 17) // (UDP) Frame OK +// -------- UDP_GLB_STATE : (UDP Offset: 0x4) USB Global State Register -------- +#define AT91C_UDP_FADDEN ((unsigned int) 0x1 << 0) // (UDP) Function Address Enable +#define AT91C_UDP_CONFG ((unsigned int) 0x1 << 1) // (UDP) Configured +#define AT91C_UDP_ESR ((unsigned int) 0x1 << 2) // (UDP) Enable Send Resume +#define AT91C_UDP_RSMINPR ((unsigned int) 0x1 << 3) // (UDP) A Resume Has Been Sent to the Host +#define AT91C_UDP_RMWUPE ((unsigned int) 0x1 << 4) // (UDP) Remote Wake Up Enable +// -------- UDP_FADDR : (UDP Offset: 0x8) USB Function Address Register -------- +#define AT91C_UDP_FADD ((unsigned int) 0xFF << 0) // (UDP) Function Address Value +#define AT91C_UDP_FEN ((unsigned int) 0x1 << 8) // (UDP) Function Enable +// -------- UDP_IER : (UDP Offset: 0x10) USB Interrupt Enable Register -------- +#define AT91C_UDP_EPINT0 ((unsigned int) 0x1 << 0) // (UDP) Endpoint 0 Interrupt +#define AT91C_UDP_EPINT1 ((unsigned int) 0x1 << 1) // (UDP) Endpoint 0 Interrupt +#define AT91C_UDP_EPINT2 ((unsigned int) 0x1 << 2) // (UDP) Endpoint 2 Interrupt +#define AT91C_UDP_EPINT3 ((unsigned int) 0x1 << 3) // (UDP) Endpoint 3 Interrupt +#define AT91C_UDP_EPINT4 ((unsigned int) 0x1 << 4) // (UDP) Endpoint 4 Interrupt +#define AT91C_UDP_EPINT5 ((unsigned int) 0x1 << 5) // (UDP) Endpoint 5 Interrupt +#define AT91C_UDP_RXSUSP ((unsigned int) 0x1 << 8) // (UDP) USB Suspend Interrupt +#define AT91C_UDP_RXRSM ((unsigned int) 0x1 << 9) // (UDP) USB Resume Interrupt +#define AT91C_UDP_EXTRSM ((unsigned int) 0x1 << 10) // (UDP) USB External Resume Interrupt +#define AT91C_UDP_SOFINT ((unsigned int) 0x1 << 11) // (UDP) USB Start Of frame Interrupt +#define AT91C_UDP_WAKEUP ((unsigned int) 0x1 << 13) // (UDP) USB Resume Interrupt +// -------- UDP_IDR : (UDP Offset: 0x14) USB Interrupt Disable Register -------- +// -------- UDP_IMR : (UDP Offset: 0x18) USB Interrupt Mask Register -------- +// -------- UDP_ISR : (UDP Offset: 0x1c) USB Interrupt Status Register -------- +#define AT91C_UDP_ENDBUSRES ((unsigned int) 0x1 << 12) // (UDP) USB End Of Bus Reset Interrupt +// -------- UDP_ICR : (UDP Offset: 0x20) USB Interrupt Clear Register -------- +// -------- UDP_RST_EP : (UDP Offset: 0x28) USB Reset Endpoint Register -------- +#define AT91C_UDP_EP0 ((unsigned int) 0x1 << 0) // (UDP) Reset Endpoint 0 +#define AT91C_UDP_EP1 ((unsigned int) 0x1 << 1) // (UDP) Reset Endpoint 1 +#define AT91C_UDP_EP2 ((unsigned int) 0x1 << 2) // (UDP) Reset Endpoint 2 +#define AT91C_UDP_EP3 ((unsigned int) 0x1 << 3) // (UDP) Reset Endpoint 3 +#define AT91C_UDP_EP4 ((unsigned int) 0x1 << 4) // (UDP) Reset Endpoint 4 +#define AT91C_UDP_EP5 ((unsigned int) 0x1 << 5) // (UDP) Reset Endpoint 5 +// -------- UDP_CSR : (UDP Offset: 0x30) USB Endpoint Control and Status Register -------- +#define AT91C_UDP_TXCOMP ((unsigned int) 0x1 << 0) // (UDP) Generates an IN packet with data previously written in the DPR +#define AT91C_UDP_RX_DATA_BK0 ((unsigned int) 0x1 << 1) // (UDP) Receive Data Bank 0 +#define AT91C_UDP_RXSETUP ((unsigned int) 0x1 << 2) // (UDP) Sends STALL to the Host (Control endpoints) +#define AT91C_UDP_ISOERROR ((unsigned int) 0x1 << 3) // (UDP) Isochronous error (Isochronous endpoints) +#define AT91C_UDP_TXPKTRDY ((unsigned int) 0x1 << 4) // (UDP) Transmit Packet Ready +#define AT91C_UDP_FORCESTALL ((unsigned int) 0x1 << 5) // (UDP) Force Stall (used by Control, Bulk and Isochronous endpoints). +#define AT91C_UDP_RX_DATA_BK1 ((unsigned int) 0x1 << 6) // (UDP) Receive Data Bank 1 (only used by endpoints with ping-pong attributes). +#define AT91C_UDP_DIR ((unsigned int) 0x1 << 7) // (UDP) Transfer Direction +#define AT91C_UDP_EPTYPE ((unsigned int) 0x7 << 8) // (UDP) Endpoint type +#define AT91C_UDP_EPTYPE_CTRL ((unsigned int) 0x0 << 8) // (UDP) Control +#define AT91C_UDP_EPTYPE_ISO_OUT ((unsigned int) 0x1 << 8) // (UDP) Isochronous OUT +#define AT91C_UDP_EPTYPE_BULK_OUT ((unsigned int) 0x2 << 8) // (UDP) Bulk OUT +#define AT91C_UDP_EPTYPE_INT_OUT ((unsigned int) 0x3 << 8) // (UDP) Interrupt OUT +#define AT91C_UDP_EPTYPE_ISO_IN ((unsigned int) 0x5 << 8) // (UDP) Isochronous IN +#define AT91C_UDP_EPTYPE_BULK_IN ((unsigned int) 0x6 << 8) // (UDP) Bulk IN +#define AT91C_UDP_EPTYPE_INT_IN ((unsigned int) 0x7 << 8) // (UDP) Interrupt IN +#define AT91C_UDP_DTGLE ((unsigned int) 0x1 << 11) // (UDP) Data Toggle +#define AT91C_UDP_EPEDS ((unsigned int) 0x1 << 15) // (UDP) Endpoint Enable Disable +#define AT91C_UDP_RXBYTECNT ((unsigned int) 0x7FF << 16) // (UDP) Number Of Bytes Available in the FIFO +// -------- UDP_TXVC : (UDP Offset: 0x74) Transceiver Control Register -------- +#define AT91C_UDP_TXVDIS ((unsigned int) 0x1 << 8) // (UDP) +#define AT91C_UDP_PUON ((unsigned int) 0x1 << 9) // (UDP) Pull-up ON + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Timer Counter Channel Interface +// ***************************************************************************** +typedef struct _AT91S_TC { + AT91_REG TC_CCR; // Channel Control Register + AT91_REG TC_CMR; // Channel Mode Register (Capture Mode / Waveform Mode) + AT91_REG Reserved0[2]; // + AT91_REG TC_CV; // Counter Value + AT91_REG TC_RA; // Register A + AT91_REG TC_RB; // Register B + AT91_REG TC_RC; // Register C + AT91_REG TC_SR; // Status Register + AT91_REG TC_IER; // Interrupt Enable Register + AT91_REG TC_IDR; // Interrupt Disable Register + AT91_REG TC_IMR; // Interrupt Mask Register +} AT91S_TC, *AT91PS_TC; + +// -------- TC_CCR : (TC Offset: 0x0) TC Channel Control Register -------- +#define AT91C_TC_CLKEN ((unsigned int) 0x1 << 0) // (TC) Counter Clock Enable Command +#define AT91C_TC_CLKDIS ((unsigned int) 0x1 << 1) // (TC) Counter Clock Disable Command +#define AT91C_TC_SWTRG ((unsigned int) 0x1 << 2) // (TC) Software Trigger Command +// -------- TC_CMR : (TC Offset: 0x4) TC Channel Mode Register: Capture Mode / Waveform Mode -------- +#define AT91C_TC_CLKS ((unsigned int) 0x7 << 0) // (TC) Clock Selection +#define AT91C_TC_CLKS_TIMER_DIV1_CLOCK ((unsigned int) 0x0) // (TC) Clock selected: TIMER_DIV1_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV2_CLOCK ((unsigned int) 0x1) // (TC) Clock selected: TIMER_DIV2_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV3_CLOCK ((unsigned int) 0x2) // (TC) Clock selected: TIMER_DIV3_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV4_CLOCK ((unsigned int) 0x3) // (TC) Clock selected: TIMER_DIV4_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV5_CLOCK ((unsigned int) 0x4) // (TC) Clock selected: TIMER_DIV5_CLOCK +#define AT91C_TC_CLKS_XC0 ((unsigned int) 0x5) // (TC) Clock selected: XC0 +#define AT91C_TC_CLKS_XC1 ((unsigned int) 0x6) // (TC) Clock selected: XC1 +#define AT91C_TC_CLKS_XC2 ((unsigned int) 0x7) // (TC) Clock selected: XC2 +#define AT91C_TC_CLKI ((unsigned int) 0x1 << 3) // (TC) Clock Invert +#define AT91C_TC_BURST ((unsigned int) 0x3 << 4) // (TC) Burst Signal Selection +#define AT91C_TC_BURST_NONE ((unsigned int) 0x0 << 4) // (TC) The clock is not gated by an external signal +#define AT91C_TC_BURST_XC0 ((unsigned int) 0x1 << 4) // (TC) XC0 is ANDed with the selected clock +#define AT91C_TC_BURST_XC1 ((unsigned int) 0x2 << 4) // (TC) XC1 is ANDed with the selected clock +#define AT91C_TC_BURST_XC2 ((unsigned int) 0x3 << 4) // (TC) XC2 is ANDed with the selected clock +#define AT91C_TC_CPCSTOP ((unsigned int) 0x1 << 6) // (TC) Counter Clock Stopped with RC Compare +#define AT91C_TC_LDBSTOP ((unsigned int) 0x1 << 6) // (TC) Counter Clock Stopped with RB Loading +#define AT91C_TC_LDBDIS ((unsigned int) 0x1 << 7) // (TC) Counter Clock Disabled with RB Loading +#define AT91C_TC_CPCDIS ((unsigned int) 0x1 << 7) // (TC) Counter Clock Disable with RC Compare +#define AT91C_TC_ETRGEDG ((unsigned int) 0x3 << 8) // (TC) External Trigger Edge Selection +#define AT91C_TC_ETRGEDG_NONE ((unsigned int) 0x0 << 8) // (TC) Edge: None +#define AT91C_TC_ETRGEDG_RISING ((unsigned int) 0x1 << 8) // (TC) Edge: rising edge +#define AT91C_TC_ETRGEDG_FALLING ((unsigned int) 0x2 << 8) // (TC) Edge: falling edge +#define AT91C_TC_ETRGEDG_BOTH ((unsigned int) 0x3 << 8) // (TC) Edge: each edge +#define AT91C_TC_EEVTEDG ((unsigned int) 0x3 << 8) // (TC) External Event Edge Selection +#define AT91C_TC_EEVTEDG_NONE ((unsigned int) 0x0 << 8) // (TC) Edge: None +#define AT91C_TC_EEVTEDG_RISING ((unsigned int) 0x1 << 8) // (TC) Edge: rising edge +#define AT91C_TC_EEVTEDG_FALLING ((unsigned int) 0x2 << 8) // (TC) Edge: falling edge +#define AT91C_TC_EEVTEDG_BOTH ((unsigned int) 0x3 << 8) // (TC) Edge: each edge +#define AT91C_TC_ABETRG ((unsigned int) 0x1 << 10) // (TC) TIOA or TIOB External Trigger Selection +#define AT91C_TC_EEVT ((unsigned int) 0x3 << 10) // (TC) External Event Selection +#define AT91C_TC_EEVT_TIOB ((unsigned int) 0x0 << 10) // (TC) Signal selected as external event: TIOB TIOB direction: input +#define AT91C_TC_EEVT_XC0 ((unsigned int) 0x1 << 10) // (TC) Signal selected as external event: XC0 TIOB direction: output +#define AT91C_TC_EEVT_XC1 ((unsigned int) 0x2 << 10) // (TC) Signal selected as external event: XC1 TIOB direction: output +#define AT91C_TC_EEVT_XC2 ((unsigned int) 0x3 << 10) // (TC) Signal selected as external event: XC2 TIOB direction: output +#define AT91C_TC_ENETRG ((unsigned int) 0x1 << 12) // (TC) External Event Trigger enable +#define AT91C_TC_WAVESEL ((unsigned int) 0x3 << 13) // (TC) Waveform Selection +#define AT91C_TC_WAVESEL_UP ((unsigned int) 0x0 << 13) // (TC) UP mode without atomatic trigger on RC Compare +#define AT91C_TC_WAVESEL_UPDOWN ((unsigned int) 0x1 << 13) // (TC) UPDOWN mode without automatic trigger on RC Compare +#define AT91C_TC_WAVESEL_UP_AUTO ((unsigned int) 0x2 << 13) // (TC) UP mode with automatic trigger on RC Compare +#define AT91C_TC_WAVESEL_UPDOWN_AUTO ((unsigned int) 0x3 << 13) // (TC) UPDOWN mode with automatic trigger on RC Compare +#define AT91C_TC_CPCTRG ((unsigned int) 0x1 << 14) // (TC) RC Compare Trigger Enable +#define AT91C_TC_WAVE ((unsigned int) 0x1 << 15) // (TC) +#define AT91C_TC_LDRA ((unsigned int) 0x3 << 16) // (TC) RA Loading Selection +#define AT91C_TC_LDRA_NONE ((unsigned int) 0x0 << 16) // (TC) Edge: None +#define AT91C_TC_LDRA_RISING ((unsigned int) 0x1 << 16) // (TC) Edge: rising edge of TIOA +#define AT91C_TC_LDRA_FALLING ((unsigned int) 0x2 << 16) // (TC) Edge: falling edge of TIOA +#define AT91C_TC_LDRA_BOTH ((unsigned int) 0x3 << 16) // (TC) Edge: each edge of TIOA +#define AT91C_TC_ACPA ((unsigned int) 0x3 << 16) // (TC) RA Compare Effect on TIOA +#define AT91C_TC_ACPA_NONE ((unsigned int) 0x0 << 16) // (TC) Effect: none +#define AT91C_TC_ACPA_SET ((unsigned int) 0x1 << 16) // (TC) Effect: set +#define AT91C_TC_ACPA_CLEAR ((unsigned int) 0x2 << 16) // (TC) Effect: clear +#define AT91C_TC_ACPA_TOGGLE ((unsigned int) 0x3 << 16) // (TC) Effect: toggle +#define AT91C_TC_LDRB ((unsigned int) 0x3 << 18) // (TC) RB Loading Selection +#define AT91C_TC_LDRB_NONE ((unsigned int) 0x0 << 18) // (TC) Edge: None +#define AT91C_TC_LDRB_RISING ((unsigned int) 0x1 << 18) // (TC) Edge: rising edge of TIOA +#define AT91C_TC_LDRB_FALLING ((unsigned int) 0x2 << 18) // (TC) Edge: falling edge of TIOA +#define AT91C_TC_LDRB_BOTH ((unsigned int) 0x3 << 18) // (TC) Edge: each edge of TIOA +#define AT91C_TC_ACPC ((unsigned int) 0x3 << 18) // (TC) RC Compare Effect on TIOA +#define AT91C_TC_ACPC_NONE ((unsigned int) 0x0 << 18) // (TC) Effect: none +#define AT91C_TC_ACPC_SET ((unsigned int) 0x1 << 18) // (TC) Effect: set +#define AT91C_TC_ACPC_CLEAR ((unsigned int) 0x2 << 18) // (TC) Effect: clear +#define AT91C_TC_ACPC_TOGGLE ((unsigned int) 0x3 << 18) // (TC) Effect: toggle +#define AT91C_TC_AEEVT ((unsigned int) 0x3 << 20) // (TC) External Event Effect on TIOA +#define AT91C_TC_AEEVT_NONE ((unsigned int) 0x0 << 20) // (TC) Effect: none +#define AT91C_TC_AEEVT_SET ((unsigned int) 0x1 << 20) // (TC) Effect: set +#define AT91C_TC_AEEVT_CLEAR ((unsigned int) 0x2 << 20) // (TC) Effect: clear +#define AT91C_TC_AEEVT_TOGGLE ((unsigned int) 0x3 << 20) // (TC) Effect: toggle +#define AT91C_TC_ASWTRG ((unsigned int) 0x3 << 22) // (TC) Software Trigger Effect on TIOA +#define AT91C_TC_ASWTRG_NONE ((unsigned int) 0x0 << 22) // (TC) Effect: none +#define AT91C_TC_ASWTRG_SET ((unsigned int) 0x1 << 22) // (TC) Effect: set +#define AT91C_TC_ASWTRG_CLEAR ((unsigned int) 0x2 << 22) // (TC) Effect: clear +#define AT91C_TC_ASWTRG_TOGGLE ((unsigned int) 0x3 << 22) // (TC) Effect: toggle +#define AT91C_TC_BCPB ((unsigned int) 0x3 << 24) // (TC) RB Compare Effect on TIOB +#define AT91C_TC_BCPB_NONE ((unsigned int) 0x0 << 24) // (TC) Effect: none +#define AT91C_TC_BCPB_SET ((unsigned int) 0x1 << 24) // (TC) Effect: set +#define AT91C_TC_BCPB_CLEAR ((unsigned int) 0x2 << 24) // (TC) Effect: clear +#define AT91C_TC_BCPB_TOGGLE ((unsigned int) 0x3 << 24) // (TC) Effect: toggle +#define AT91C_TC_BCPC ((unsigned int) 0x3 << 26) // (TC) RC Compare Effect on TIOB +#define AT91C_TC_BCPC_NONE ((unsigned int) 0x0 << 26) // (TC) Effect: none +#define AT91C_TC_BCPC_SET ((unsigned int) 0x1 << 26) // (TC) Effect: set +#define AT91C_TC_BCPC_CLEAR ((unsigned int) 0x2 << 26) // (TC) Effect: clear +#define AT91C_TC_BCPC_TOGGLE ((unsigned int) 0x3 << 26) // (TC) Effect: toggle +#define AT91C_TC_BEEVT ((unsigned int) 0x3 << 28) // (TC) External Event Effect on TIOB +#define AT91C_TC_BEEVT_NONE ((unsigned int) 0x0 << 28) // (TC) Effect: none +#define AT91C_TC_BEEVT_SET ((unsigned int) 0x1 << 28) // (TC) Effect: set +#define AT91C_TC_BEEVT_CLEAR ((unsigned int) 0x2 << 28) // (TC) Effect: clear +#define AT91C_TC_BEEVT_TOGGLE ((unsigned int) 0x3 << 28) // (TC) Effect: toggle +#define AT91C_TC_BSWTRG ((unsigned int) 0x3 << 30) // (TC) Software Trigger Effect on TIOB +#define AT91C_TC_BSWTRG_NONE ((unsigned int) 0x0 << 30) // (TC) Effect: none +#define AT91C_TC_BSWTRG_SET ((unsigned int) 0x1 << 30) // (TC) Effect: set +#define AT91C_TC_BSWTRG_CLEAR ((unsigned int) 0x2 << 30) // (TC) Effect: clear +#define AT91C_TC_BSWTRG_TOGGLE ((unsigned int) 0x3 << 30) // (TC) Effect: toggle +// -------- TC_SR : (TC Offset: 0x20) TC Channel Status Register -------- +#define AT91C_TC_COVFS ((unsigned int) 0x1 << 0) // (TC) Counter Overflow +#define AT91C_TC_LOVRS ((unsigned int) 0x1 << 1) // (TC) Load Overrun +#define AT91C_TC_CPAS ((unsigned int) 0x1 << 2) // (TC) RA Compare +#define AT91C_TC_CPBS ((unsigned int) 0x1 << 3) // (TC) RB Compare +#define AT91C_TC_CPCS ((unsigned int) 0x1 << 4) // (TC) RC Compare +#define AT91C_TC_LDRAS ((unsigned int) 0x1 << 5) // (TC) RA Loading +#define AT91C_TC_LDRBS ((unsigned int) 0x1 << 6) // (TC) RB Loading +#define AT91C_TC_ETRGS ((unsigned int) 0x1 << 7) // (TC) External Trigger +#define AT91C_TC_CLKSTA ((unsigned int) 0x1 << 16) // (TC) Clock Enabling +#define AT91C_TC_MTIOA ((unsigned int) 0x1 << 17) // (TC) TIOA Mirror +#define AT91C_TC_MTIOB ((unsigned int) 0x1 << 18) // (TC) TIOA Mirror +// -------- TC_IER : (TC Offset: 0x24) TC Channel Interrupt Enable Register -------- +// -------- TC_IDR : (TC Offset: 0x28) TC Channel Interrupt Disable Register -------- +// -------- TC_IMR : (TC Offset: 0x2c) TC Channel Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Timer Counter Interface +// ***************************************************************************** +typedef struct _AT91S_TCB { + AT91S_TC TCB_TC0; // TC Channel 0 + AT91_REG Reserved0[4]; // + AT91S_TC TCB_TC1; // TC Channel 1 + AT91_REG Reserved1[4]; // + AT91S_TC TCB_TC2; // TC Channel 2 + AT91_REG Reserved2[4]; // + AT91_REG TCB_BCR; // TC Block Control Register + AT91_REG TCB_BMR; // TC Block Mode Register +} AT91S_TCB, *AT91PS_TCB; + +// -------- TCB_BCR : (TCB Offset: 0xc0) TC Block Control Register -------- +#define AT91C_TCB_SYNC ((unsigned int) 0x1 << 0) // (TCB) Synchro Command +// -------- TCB_BMR : (TCB Offset: 0xc4) TC Block Mode Register -------- +#define AT91C_TCB_TC0XC0S ((unsigned int) 0x3 << 0) // (TCB) External Clock Signal 0 Selection +#define AT91C_TCB_TC0XC0S_TCLK0 ((unsigned int) 0x0) // (TCB) TCLK0 connected to XC0 +#define AT91C_TCB_TC0XC0S_NONE ((unsigned int) 0x1) // (TCB) None signal connected to XC0 +#define AT91C_TCB_TC0XC0S_TIOA1 ((unsigned int) 0x2) // (TCB) TIOA1 connected to XC0 +#define AT91C_TCB_TC0XC0S_TIOA2 ((unsigned int) 0x3) // (TCB) TIOA2 connected to XC0 +#define AT91C_TCB_TC1XC1S ((unsigned int) 0x3 << 2) // (TCB) External Clock Signal 1 Selection +#define AT91C_TCB_TC1XC1S_TCLK1 ((unsigned int) 0x0 << 2) // (TCB) TCLK1 connected to XC1 +#define AT91C_TCB_TC1XC1S_NONE ((unsigned int) 0x1 << 2) // (TCB) None signal connected to XC1 +#define AT91C_TCB_TC1XC1S_TIOA0 ((unsigned int) 0x2 << 2) // (TCB) TIOA0 connected to XC1 +#define AT91C_TCB_TC1XC1S_TIOA2 ((unsigned int) 0x3 << 2) // (TCB) TIOA2 connected to XC1 +#define AT91C_TCB_TC2XC2S ((unsigned int) 0x3 << 4) // (TCB) External Clock Signal 2 Selection +#define AT91C_TCB_TC2XC2S_TCLK2 ((unsigned int) 0x0 << 4) // (TCB) TCLK2 connected to XC2 +#define AT91C_TCB_TC2XC2S_NONE ((unsigned int) 0x1 << 4) // (TCB) None signal connected to XC2 +#define AT91C_TCB_TC2XC2S_TIOA0 ((unsigned int) 0x2 << 4) // (TCB) TIOA0 connected to XC2 +#define AT91C_TCB_TC2XC2S_TIOA1 ((unsigned int) 0x3 << 4) // (TCB) TIOA2 connected to XC2 + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Control Area Network MailBox Interface +// ***************************************************************************** +typedef struct _AT91S_CAN_MB { + AT91_REG CAN_MB_MMR; // MailBox Mode Register + AT91_REG CAN_MB_MAM; // MailBox Acceptance Mask Register + AT91_REG CAN_MB_MID; // MailBox ID Register + AT91_REG CAN_MB_MFID; // MailBox Family ID Register + AT91_REG CAN_MB_MSR; // MailBox Status Register + AT91_REG CAN_MB_MDL; // MailBox Data Low Register + AT91_REG CAN_MB_MDH; // MailBox Data High Register + AT91_REG CAN_MB_MCR; // MailBox Control Register +} AT91S_CAN_MB, *AT91PS_CAN_MB; + +// -------- CAN_MMR : (CAN_MB Offset: 0x0) CAN Message Mode Register -------- +#define AT91C_CAN_MTIMEMARK ((unsigned int) 0xFFFF << 0) // (CAN_MB) Mailbox Timemark +#define AT91C_CAN_PRIOR ((unsigned int) 0xF << 16) // (CAN_MB) Mailbox Priority +#define AT91C_CAN_MOT ((unsigned int) 0x7 << 24) // (CAN_MB) Mailbox Object Type +#define AT91C_CAN_MOT_DIS ((unsigned int) 0x0 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_RX ((unsigned int) 0x1 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_RXOVERWRITE ((unsigned int) 0x2 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_TX ((unsigned int) 0x3 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_CONSUMER ((unsigned int) 0x4 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_PRODUCER ((unsigned int) 0x5 << 24) // (CAN_MB) +// -------- CAN_MAM : (CAN_MB Offset: 0x4) CAN Message Acceptance Mask Register -------- +#define AT91C_CAN_MIDvB ((unsigned int) 0x3FFFF << 0) // (CAN_MB) Complementary bits for identifier in extended mode +#define AT91C_CAN_MIDvA ((unsigned int) 0x7FF << 18) // (CAN_MB) Identifier for standard frame mode +#define AT91C_CAN_MIDE ((unsigned int) 0x1 << 29) // (CAN_MB) Identifier Version +// -------- CAN_MID : (CAN_MB Offset: 0x8) CAN Message ID Register -------- +// -------- CAN_MFID : (CAN_MB Offset: 0xc) CAN Message Family ID Register -------- +// -------- CAN_MSR : (CAN_MB Offset: 0x10) CAN Message Status Register -------- +#define AT91C_CAN_MTIMESTAMP ((unsigned int) 0xFFFF << 0) // (CAN_MB) Timer Value +#define AT91C_CAN_MDLC ((unsigned int) 0xF << 16) // (CAN_MB) Mailbox Data Length Code +#define AT91C_CAN_MRTR ((unsigned int) 0x1 << 20) // (CAN_MB) Mailbox Remote Transmission Request +#define AT91C_CAN_MABT ((unsigned int) 0x1 << 22) // (CAN_MB) Mailbox Message Abort +#define AT91C_CAN_MRDY ((unsigned int) 0x1 << 23) // (CAN_MB) Mailbox Ready +#define AT91C_CAN_MMI ((unsigned int) 0x1 << 24) // (CAN_MB) Mailbox Message Ignored +// -------- CAN_MDL : (CAN_MB Offset: 0x14) CAN Message Data Low Register -------- +// -------- CAN_MDH : (CAN_MB Offset: 0x18) CAN Message Data High Register -------- +// -------- CAN_MCR : (CAN_MB Offset: 0x1c) CAN Message Control Register -------- +#define AT91C_CAN_MACR ((unsigned int) 0x1 << 22) // (CAN_MB) Abort Request for Mailbox +#define AT91C_CAN_MTCR ((unsigned int) 0x1 << 23) // (CAN_MB) Mailbox Transfer Command + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Control Area Network Interface +// ***************************************************************************** +typedef struct _AT91S_CAN { + AT91_REG CAN_MR; // Mode Register + AT91_REG CAN_IER; // Interrupt Enable Register + AT91_REG CAN_IDR; // Interrupt Disable Register + AT91_REG CAN_IMR; // Interrupt Mask Register + AT91_REG CAN_SR; // Status Register + AT91_REG CAN_BR; // Baudrate Register + AT91_REG CAN_TIM; // Timer Register + AT91_REG CAN_TIMESTP; // Time Stamp Register + AT91_REG CAN_ECR; // Error Counter Register + AT91_REG CAN_TCR; // Transfer Command Register + AT91_REG CAN_ACR; // Abort Command Register + AT91_REG Reserved0[52]; // + AT91_REG CAN_VR; // Version Register + AT91_REG Reserved1[64]; // + AT91S_CAN_MB CAN_MB0; // CAN Mailbox 0 + AT91S_CAN_MB CAN_MB1; // CAN Mailbox 1 + AT91S_CAN_MB CAN_MB2; // CAN Mailbox 2 + AT91S_CAN_MB CAN_MB3; // CAN Mailbox 3 + AT91S_CAN_MB CAN_MB4; // CAN Mailbox 4 + AT91S_CAN_MB CAN_MB5; // CAN Mailbox 5 + AT91S_CAN_MB CAN_MB6; // CAN Mailbox 6 + AT91S_CAN_MB CAN_MB7; // CAN Mailbox 7 + AT91S_CAN_MB CAN_MB8; // CAN Mailbox 8 + AT91S_CAN_MB CAN_MB9; // CAN Mailbox 9 + AT91S_CAN_MB CAN_MB10; // CAN Mailbox 10 + AT91S_CAN_MB CAN_MB11; // CAN Mailbox 11 + AT91S_CAN_MB CAN_MB12; // CAN Mailbox 12 + AT91S_CAN_MB CAN_MB13; // CAN Mailbox 13 + AT91S_CAN_MB CAN_MB14; // CAN Mailbox 14 + AT91S_CAN_MB CAN_MB15; // CAN Mailbox 15 +} AT91S_CAN, *AT91PS_CAN; + +// -------- CAN_MR : (CAN Offset: 0x0) CAN Mode Register -------- +#define AT91C_CAN_CANEN ((unsigned int) 0x1 << 0) // (CAN) CAN Controller Enable +#define AT91C_CAN_LPM ((unsigned int) 0x1 << 1) // (CAN) Disable/Enable Low Power Mode +#define AT91C_CAN_ABM ((unsigned int) 0x1 << 2) // (CAN) Disable/Enable Autobaud/Listen Mode +#define AT91C_CAN_OVL ((unsigned int) 0x1 << 3) // (CAN) Disable/Enable Overload Frame +#define AT91C_CAN_TEOF ((unsigned int) 0x1 << 4) // (CAN) Time Stamp messages at each end of Frame +#define AT91C_CAN_TTM ((unsigned int) 0x1 << 5) // (CAN) Disable/Enable Time Trigger Mode +#define AT91C_CAN_TIMFRZ ((unsigned int) 0x1 << 6) // (CAN) Enable Timer Freeze +#define AT91C_CAN_DRPT ((unsigned int) 0x1 << 7) // (CAN) Disable Repeat +// -------- CAN_IER : (CAN Offset: 0x4) CAN Interrupt Enable Register -------- +#define AT91C_CAN_MB0 ((unsigned int) 0x1 << 0) // (CAN) Mailbox 0 Flag +#define AT91C_CAN_MB1 ((unsigned int) 0x1 << 1) // (CAN) Mailbox 1 Flag +#define AT91C_CAN_MB2 ((unsigned int) 0x1 << 2) // (CAN) Mailbox 2 Flag +#define AT91C_CAN_MB3 ((unsigned int) 0x1 << 3) // (CAN) Mailbox 3 Flag +#define AT91C_CAN_MB4 ((unsigned int) 0x1 << 4) // (CAN) Mailbox 4 Flag +#define AT91C_CAN_MB5 ((unsigned int) 0x1 << 5) // (CAN) Mailbox 5 Flag +#define AT91C_CAN_MB6 ((unsigned int) 0x1 << 6) // (CAN) Mailbox 6 Flag +#define AT91C_CAN_MB7 ((unsigned int) 0x1 << 7) // (CAN) Mailbox 7 Flag +#define AT91C_CAN_MB8 ((unsigned int) 0x1 << 8) // (CAN) Mailbox 8 Flag +#define AT91C_CAN_MB9 ((unsigned int) 0x1 << 9) // (CAN) Mailbox 9 Flag +#define AT91C_CAN_MB10 ((unsigned int) 0x1 << 10) // (CAN) Mailbox 10 Flag +#define AT91C_CAN_MB11 ((unsigned int) 0x1 << 11) // (CAN) Mailbox 11 Flag +#define AT91C_CAN_MB12 ((unsigned int) 0x1 << 12) // (CAN) Mailbox 12 Flag +#define AT91C_CAN_MB13 ((unsigned int) 0x1 << 13) // (CAN) Mailbox 13 Flag +#define AT91C_CAN_MB14 ((unsigned int) 0x1 << 14) // (CAN) Mailbox 14 Flag +#define AT91C_CAN_MB15 ((unsigned int) 0x1 << 15) // (CAN) Mailbox 15 Flag +#define AT91C_CAN_ERRA ((unsigned int) 0x1 << 16) // (CAN) Error Active Mode Flag +#define AT91C_CAN_WARN ((unsigned int) 0x1 << 17) // (CAN) Warning Limit Flag +#define AT91C_CAN_ERRP ((unsigned int) 0x1 << 18) // (CAN) Error Passive Mode Flag +#define AT91C_CAN_BOFF ((unsigned int) 0x1 << 19) // (CAN) Bus Off Mode Flag +#define AT91C_CAN_SLEEP ((unsigned int) 0x1 << 20) // (CAN) Sleep Flag +#define AT91C_CAN_WAKEUP ((unsigned int) 0x1 << 21) // (CAN) Wakeup Flag +#define AT91C_CAN_TOVF ((unsigned int) 0x1 << 22) // (CAN) Timer Overflow Flag +#define AT91C_CAN_TSTP ((unsigned int) 0x1 << 23) // (CAN) Timestamp Flag +#define AT91C_CAN_CERR ((unsigned int) 0x1 << 24) // (CAN) CRC Error +#define AT91C_CAN_SERR ((unsigned int) 0x1 << 25) // (CAN) Stuffing Error +#define AT91C_CAN_AERR ((unsigned int) 0x1 << 26) // (CAN) Acknowledgment Error +#define AT91C_CAN_FERR ((unsigned int) 0x1 << 27) // (CAN) Form Error +#define AT91C_CAN_BERR ((unsigned int) 0x1 << 28) // (CAN) Bit Error +// -------- CAN_IDR : (CAN Offset: 0x8) CAN Interrupt Disable Register -------- +// -------- CAN_IMR : (CAN Offset: 0xc) CAN Interrupt Mask Register -------- +// -------- CAN_SR : (CAN Offset: 0x10) CAN Status Register -------- +#define AT91C_CAN_RBSY ((unsigned int) 0x1 << 29) // (CAN) Receiver Busy +#define AT91C_CAN_TBSY ((unsigned int) 0x1 << 30) // (CAN) Transmitter Busy +#define AT91C_CAN_OVLY ((unsigned int) 0x1 << 31) // (CAN) Overload Busy +// -------- CAN_BR : (CAN Offset: 0x14) CAN Baudrate Register -------- +#define AT91C_CAN_PHASE2 ((unsigned int) 0x7 << 0) // (CAN) Phase 2 segment +#define AT91C_CAN_PHASE1 ((unsigned int) 0x7 << 4) // (CAN) Phase 1 segment +#define AT91C_CAN_PROPAG ((unsigned int) 0x7 << 8) // (CAN) Programmation time segment +#define AT91C_CAN_SYNC ((unsigned int) 0x3 << 12) // (CAN) Re-synchronization jump width segment +#define AT91C_CAN_BRP ((unsigned int) 0x7F << 16) // (CAN) Baudrate Prescaler +#define AT91C_CAN_SMP ((unsigned int) 0x1 << 24) // (CAN) Sampling mode +// -------- CAN_TIM : (CAN Offset: 0x18) CAN Timer Register -------- +#define AT91C_CAN_TIMER ((unsigned int) 0xFFFF << 0) // (CAN) Timer field +// -------- CAN_TIMESTP : (CAN Offset: 0x1c) CAN Timestamp Register -------- +// -------- CAN_ECR : (CAN Offset: 0x20) CAN Error Counter Register -------- +#define AT91C_CAN_REC ((unsigned int) 0xFF << 0) // (CAN) Receive Error Counter +#define AT91C_CAN_TEC ((unsigned int) 0xFF << 16) // (CAN) Transmit Error Counter +// -------- CAN_TCR : (CAN Offset: 0x24) CAN Transfer Command Register -------- +#define AT91C_CAN_TIMRST ((unsigned int) 0x1 << 31) // (CAN) Timer Reset Field +// -------- CAN_ACR : (CAN Offset: 0x28) CAN Abort Command Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Ethernet MAC 10/100 +// ***************************************************************************** +typedef struct _AT91S_EMAC { + AT91_REG EMAC_NCR; // Network Control Register + AT91_REG EMAC_NCFGR; // Network Configuration Register + AT91_REG EMAC_NSR; // Network Status Register + AT91_REG Reserved0[2]; // + AT91_REG EMAC_TSR; // Transmit Status Register + AT91_REG EMAC_RBQP; // Receive Buffer Queue Pointer + AT91_REG EMAC_TBQP; // Transmit Buffer Queue Pointer + AT91_REG EMAC_RSR; // Receive Status Register + AT91_REG EMAC_ISR; // Interrupt Status Register + AT91_REG EMAC_IER; // Interrupt Enable Register + AT91_REG EMAC_IDR; // Interrupt Disable Register + AT91_REG EMAC_IMR; // Interrupt Mask Register + AT91_REG EMAC_MAN; // PHY Maintenance Register + AT91_REG EMAC_PTR; // Pause Time Register + AT91_REG EMAC_PFR; // Pause Frames received Register + AT91_REG EMAC_FTO; // Frames Transmitted OK Register + AT91_REG EMAC_SCF; // Single Collision Frame Register + AT91_REG EMAC_MCF; // Multiple Collision Frame Register + AT91_REG EMAC_FRO; // Frames Received OK Register + AT91_REG EMAC_FCSE; // Frame Check Sequence Error Register + AT91_REG EMAC_ALE; // Alignment Error Register + AT91_REG EMAC_DTF; // Deferred Transmission Frame Register + AT91_REG EMAC_LCOL; // Late Collision Register + AT91_REG EMAC_ECOL; // Excessive Collision Register + AT91_REG EMAC_TUND; // Transmit Underrun Error Register + AT91_REG EMAC_CSE; // Carrier Sense Error Register + AT91_REG EMAC_RRE; // Receive Ressource Error Register + AT91_REG EMAC_ROV; // Receive Overrun Errors Register + AT91_REG EMAC_RSE; // Receive Symbol Errors Register + AT91_REG EMAC_ELE; // Excessive Length Errors Register + AT91_REG EMAC_RJA; // Receive Jabbers Register + AT91_REG EMAC_USF; // Undersize Frames Register + AT91_REG EMAC_STE; // SQE Test Error Register + AT91_REG EMAC_RLE; // Receive Length Field Mismatch Register + AT91_REG EMAC_TPF; // Transmitted Pause Frames Register + AT91_REG EMAC_HRB; // Hash Address Bottom[31:0] + AT91_REG EMAC_HRT; // Hash Address Top[63:32] + AT91_REG EMAC_SA1L; // Specific Address 1 Bottom, First 4 bytes + AT91_REG EMAC_SA1H; // Specific Address 1 Top, Last 2 bytes + AT91_REG EMAC_SA2L; // Specific Address 2 Bottom, First 4 bytes + AT91_REG EMAC_SA2H; // Specific Address 2 Top, Last 2 bytes + AT91_REG EMAC_SA3L; // Specific Address 3 Bottom, First 4 bytes + AT91_REG EMAC_SA3H; // Specific Address 3 Top, Last 2 bytes + AT91_REG EMAC_SA4L; // Specific Address 4 Bottom, First 4 bytes + AT91_REG EMAC_SA4H; // Specific Address 4 Top, Last 2 bytes + AT91_REG EMAC_TID; // Type ID Checking Register + AT91_REG EMAC_TPQ; // Transmit Pause Quantum Register + AT91_REG EMAC_USRIO; // USER Input/Output Register + AT91_REG EMAC_WOL; // Wake On LAN Register + AT91_REG Reserved1[13]; // + AT91_REG EMAC_REV; // Revision Register +} AT91S_EMAC, *AT91PS_EMAC; + +// -------- EMAC_NCR : (EMAC Offset: 0x0) -------- +#define AT91C_EMAC_LB ((unsigned int) 0x1 << 0) // (EMAC) Loopback. Optional. When set, loopback signal is at high level. +#define AT91C_EMAC_LLB ((unsigned int) 0x1 << 1) // (EMAC) Loopback local. +#define AT91C_EMAC_RE ((unsigned int) 0x1 << 2) // (EMAC) Receive enable. +#define AT91C_EMAC_TE ((unsigned int) 0x1 << 3) // (EMAC) Transmit enable. +#define AT91C_EMAC_MPE ((unsigned int) 0x1 << 4) // (EMAC) Management port enable. +#define AT91C_EMAC_CLRSTAT ((unsigned int) 0x1 << 5) // (EMAC) Clear statistics registers. +#define AT91C_EMAC_INCSTAT ((unsigned int) 0x1 << 6) // (EMAC) Increment statistics registers. +#define AT91C_EMAC_WESTAT ((unsigned int) 0x1 << 7) // (EMAC) Write enable for statistics registers. +#define AT91C_EMAC_BP ((unsigned int) 0x1 << 8) // (EMAC) Back pressure. +#define AT91C_EMAC_TSTART ((unsigned int) 0x1 << 9) // (EMAC) Start Transmission. +#define AT91C_EMAC_THALT ((unsigned int) 0x1 << 10) // (EMAC) Transmission Halt. +#define AT91C_EMAC_TPFR ((unsigned int) 0x1 << 11) // (EMAC) Transmit pause frame +#define AT91C_EMAC_TZQ ((unsigned int) 0x1 << 12) // (EMAC) Transmit zero quantum pause frame +// -------- EMAC_NCFGR : (EMAC Offset: 0x4) Network Configuration Register -------- +#define AT91C_EMAC_SPD ((unsigned int) 0x1 << 0) // (EMAC) Speed. +#define AT91C_EMAC_FD ((unsigned int) 0x1 << 1) // (EMAC) Full duplex. +#define AT91C_EMAC_JFRAME ((unsigned int) 0x1 << 3) // (EMAC) Jumbo Frames. +#define AT91C_EMAC_CAF ((unsigned int) 0x1 << 4) // (EMAC) Copy all frames. +#define AT91C_EMAC_NBC ((unsigned int) 0x1 << 5) // (EMAC) No broadcast. +#define AT91C_EMAC_MTI ((unsigned int) 0x1 << 6) // (EMAC) Multicast hash event enable +#define AT91C_EMAC_UNI ((unsigned int) 0x1 << 7) // (EMAC) Unicast hash enable. +#define AT91C_EMAC_BIG ((unsigned int) 0x1 << 8) // (EMAC) Receive 1522 bytes. +#define AT91C_EMAC_EAE ((unsigned int) 0x1 << 9) // (EMAC) External address match enable. +#define AT91C_EMAC_CLK ((unsigned int) 0x3 << 10) // (EMAC) +#define AT91C_EMAC_CLK_HCLK_8 ((unsigned int) 0x0 << 10) // (EMAC) HCLK divided by 8 +#define AT91C_EMAC_CLK_HCLK_16 ((unsigned int) 0x1 << 10) // (EMAC) HCLK divided by 16 +#define AT91C_EMAC_CLK_HCLK_32 ((unsigned int) 0x2 << 10) // (EMAC) HCLK divided by 32 +#define AT91C_EMAC_CLK_HCLK_64 ((unsigned int) 0x3 << 10) // (EMAC) HCLK divided by 64 +#define AT91C_EMAC_RTY ((unsigned int) 0x1 << 12) // (EMAC) +#define AT91C_EMAC_PAE ((unsigned int) 0x1 << 13) // (EMAC) +#define AT91C_EMAC_RBOF ((unsigned int) 0x3 << 14) // (EMAC) +#define AT91C_EMAC_RBOF_OFFSET_0 ((unsigned int) 0x0 << 14) // (EMAC) no offset from start of receive buffer +#define AT91C_EMAC_RBOF_OFFSET_1 ((unsigned int) 0x1 << 14) // (EMAC) one byte offset from start of receive buffer +#define AT91C_EMAC_RBOF_OFFSET_2 ((unsigned int) 0x2 << 14) // (EMAC) two bytes offset from start of receive buffer +#define AT91C_EMAC_RBOF_OFFSET_3 ((unsigned int) 0x3 << 14) // (EMAC) three bytes offset from start of receive buffer +#define AT91C_EMAC_RLCE ((unsigned int) 0x1 << 16) // (EMAC) Receive Length field Checking Enable +#define AT91C_EMAC_DRFCS ((unsigned int) 0x1 << 17) // (EMAC) Discard Receive FCS +#define AT91C_EMAC_EFRHD ((unsigned int) 0x1 << 18) // (EMAC) +#define AT91C_EMAC_IRXFCS ((unsigned int) 0x1 << 19) // (EMAC) Ignore RX FCS +// -------- EMAC_NSR : (EMAC Offset: 0x8) Network Status Register -------- +#define AT91C_EMAC_LINKR ((unsigned int) 0x1 << 0) // (EMAC) +#define AT91C_EMAC_MDIO ((unsigned int) 0x1 << 1) // (EMAC) +#define AT91C_EMAC_IDLE ((unsigned int) 0x1 << 2) // (EMAC) +// -------- EMAC_TSR : (EMAC Offset: 0x14) Transmit Status Register -------- +#define AT91C_EMAC_UBR ((unsigned int) 0x1 << 0) // (EMAC) +#define AT91C_EMAC_COL ((unsigned int) 0x1 << 1) // (EMAC) +#define AT91C_EMAC_RLES ((unsigned int) 0x1 << 2) // (EMAC) +#define AT91C_EMAC_TGO ((unsigned int) 0x1 << 3) // (EMAC) Transmit Go +#define AT91C_EMAC_BEX ((unsigned int) 0x1 << 4) // (EMAC) Buffers exhausted mid frame +#define AT91C_EMAC_COMP ((unsigned int) 0x1 << 5) // (EMAC) +#define AT91C_EMAC_UND ((unsigned int) 0x1 << 6) // (EMAC) +// -------- EMAC_RSR : (EMAC Offset: 0x20) Receive Status Register -------- +#define AT91C_EMAC_BNA ((unsigned int) 0x1 << 0) // (EMAC) +#define AT91C_EMAC_REC ((unsigned int) 0x1 << 1) // (EMAC) +#define AT91C_EMAC_OVR ((unsigned int) 0x1 << 2) // (EMAC) +// -------- EMAC_ISR : (EMAC Offset: 0x24) Interrupt Status Register -------- +#define AT91C_EMAC_MFD ((unsigned int) 0x1 << 0) // (EMAC) +#define AT91C_EMAC_RCOMP ((unsigned int) 0x1 << 1) // (EMAC) +#define AT91C_EMAC_RXUBR ((unsigned int) 0x1 << 2) // (EMAC) +#define AT91C_EMAC_TXUBR ((unsigned int) 0x1 << 3) // (EMAC) +#define AT91C_EMAC_TUNDR ((unsigned int) 0x1 << 4) // (EMAC) +#define AT91C_EMAC_RLEX ((unsigned int) 0x1 << 5) // (EMAC) +#define AT91C_EMAC_TXERR ((unsigned int) 0x1 << 6) // (EMAC) +#define AT91C_EMAC_TCOMP ((unsigned int) 0x1 << 7) // (EMAC) +#define AT91C_EMAC_LINK ((unsigned int) 0x1 << 9) // (EMAC) +#define AT91C_EMAC_ROVR ((unsigned int) 0x1 << 10) // (EMAC) +#define AT91C_EMAC_HRESP ((unsigned int) 0x1 << 11) // (EMAC) +#define AT91C_EMAC_PFRE ((unsigned int) 0x1 << 12) // (EMAC) +#define AT91C_EMAC_PTZ ((unsigned int) 0x1 << 13) // (EMAC) +// -------- EMAC_IER : (EMAC Offset: 0x28) Interrupt Enable Register -------- +// -------- EMAC_IDR : (EMAC Offset: 0x2c) Interrupt Disable Register -------- +// -------- EMAC_IMR : (EMAC Offset: 0x30) Interrupt Mask Register -------- +// -------- EMAC_MAN : (EMAC Offset: 0x34) PHY Maintenance Register -------- +#define AT91C_EMAC_DATA ((unsigned int) 0xFFFF << 0) // (EMAC) +#define AT91C_EMAC_CODE ((unsigned int) 0x3 << 16) // (EMAC) +#define AT91C_EMAC_REGA ((unsigned int) 0x1F << 18) // (EMAC) +#define AT91C_EMAC_PHYA ((unsigned int) 0x1F << 23) // (EMAC) +#define AT91C_EMAC_RW ((unsigned int) 0x3 << 28) // (EMAC) +#define AT91C_EMAC_SOF ((unsigned int) 0x3 << 30) // (EMAC) +// -------- EMAC_USRIO : (EMAC Offset: 0xc0) USER Input Output Register -------- +#define AT91C_EMAC_RMII ((unsigned int) 0x1 << 0) // (EMAC) Reduce MII +#define AT91C_EMAC_CLKEN ((unsigned int) 0x1 << 1) // (EMAC) Clock Enable +// -------- EMAC_WOL : (EMAC Offset: 0xc4) Wake On LAN Register -------- +#define AT91C_EMAC_IP ((unsigned int) 0xFFFF << 0) // (EMAC) ARP request IP address +#define AT91C_EMAC_MAG ((unsigned int) 0x1 << 16) // (EMAC) Magic packet event enable +#define AT91C_EMAC_ARP ((unsigned int) 0x1 << 17) // (EMAC) ARP request event enable +#define AT91C_EMAC_SA1 ((unsigned int) 0x1 << 18) // (EMAC) Specific address register 1 event enable +// -------- EMAC_REV : (EMAC Offset: 0xfc) Revision Register -------- +#define AT91C_EMAC_REVREF ((unsigned int) 0xFFFF << 0) // (EMAC) +#define AT91C_EMAC_PARTREF ((unsigned int) 0xFFFF << 16) // (EMAC) + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Analog to Digital Convertor +// ***************************************************************************** +typedef struct _AT91S_ADC { + AT91_REG ADC_CR; // ADC Control Register + AT91_REG ADC_MR; // ADC Mode Register + AT91_REG Reserved0[2]; // + AT91_REG ADC_CHER; // ADC Channel Enable Register + AT91_REG ADC_CHDR; // ADC Channel Disable Register + AT91_REG ADC_CHSR; // ADC Channel Status Register + AT91_REG ADC_SR; // ADC Status Register + AT91_REG ADC_LCDR; // ADC Last Converted Data Register + AT91_REG ADC_IER; // ADC Interrupt Enable Register + AT91_REG ADC_IDR; // ADC Interrupt Disable Register + AT91_REG ADC_IMR; // ADC Interrupt Mask Register + AT91_REG ADC_CDR0; // ADC Channel Data Register 0 + AT91_REG ADC_CDR1; // ADC Channel Data Register 1 + AT91_REG ADC_CDR2; // ADC Channel Data Register 2 + AT91_REG ADC_CDR3; // ADC Channel Data Register 3 + AT91_REG ADC_CDR4; // ADC Channel Data Register 4 + AT91_REG ADC_CDR5; // ADC Channel Data Register 5 + AT91_REG ADC_CDR6; // ADC Channel Data Register 6 + AT91_REG ADC_CDR7; // ADC Channel Data Register 7 + AT91_REG Reserved1[44]; // + AT91_REG ADC_RPR; // Receive Pointer Register + AT91_REG ADC_RCR; // Receive Counter Register + AT91_REG ADC_TPR; // Transmit Pointer Register + AT91_REG ADC_TCR; // Transmit Counter Register + AT91_REG ADC_RNPR; // Receive Next Pointer Register + AT91_REG ADC_RNCR; // Receive Next Counter Register + AT91_REG ADC_TNPR; // Transmit Next Pointer Register + AT91_REG ADC_TNCR; // Transmit Next Counter Register + AT91_REG ADC_PTCR; // PDC Transfer Control Register + AT91_REG ADC_PTSR; // PDC Transfer Status Register +} AT91S_ADC, *AT91PS_ADC; + +// -------- ADC_CR : (ADC Offset: 0x0) ADC Control Register -------- +#define AT91C_ADC_SWRST ((unsigned int) 0x1 << 0) // (ADC) Software Reset +#define AT91C_ADC_START ((unsigned int) 0x1 << 1) // (ADC) Start Conversion +// -------- ADC_MR : (ADC Offset: 0x4) ADC Mode Register -------- +#define AT91C_ADC_TRGEN ((unsigned int) 0x1 << 0) // (ADC) Trigger Enable +#define AT91C_ADC_TRGEN_DIS ((unsigned int) 0x0) // (ADC) Hradware triggers are disabled. Starting a conversion is only possible by software +#define AT91C_ADC_TRGEN_EN ((unsigned int) 0x1) // (ADC) Hardware trigger selected by TRGSEL field is enabled. +#define AT91C_ADC_TRGSEL ((unsigned int) 0x7 << 1) // (ADC) Trigger Selection +#define AT91C_ADC_TRGSEL_TIOA0 ((unsigned int) 0x0 << 1) // (ADC) Selected TRGSEL = TIAO0 +#define AT91C_ADC_TRGSEL_TIOA1 ((unsigned int) 0x1 << 1) // (ADC) Selected TRGSEL = TIAO1 +#define AT91C_ADC_TRGSEL_TIOA2 ((unsigned int) 0x2 << 1) // (ADC) Selected TRGSEL = TIAO2 +#define AT91C_ADC_TRGSEL_TIOA3 ((unsigned int) 0x3 << 1) // (ADC) Selected TRGSEL = TIAO3 +#define AT91C_ADC_TRGSEL_TIOA4 ((unsigned int) 0x4 << 1) // (ADC) Selected TRGSEL = TIAO4 +#define AT91C_ADC_TRGSEL_TIOA5 ((unsigned int) 0x5 << 1) // (ADC) Selected TRGSEL = TIAO5 +#define AT91C_ADC_TRGSEL_EXT ((unsigned int) 0x6 << 1) // (ADC) Selected TRGSEL = External Trigger +#define AT91C_ADC_LOWRES ((unsigned int) 0x1 << 4) // (ADC) Resolution. +#define AT91C_ADC_LOWRES_10_BIT ((unsigned int) 0x0 << 4) // (ADC) 10-bit resolution +#define AT91C_ADC_LOWRES_8_BIT ((unsigned int) 0x1 << 4) // (ADC) 8-bit resolution +#define AT91C_ADC_SLEEP ((unsigned int) 0x1 << 5) // (ADC) Sleep Mode +#define AT91C_ADC_SLEEP_NORMAL_MODE ((unsigned int) 0x0 << 5) // (ADC) Normal Mode +#define AT91C_ADC_SLEEP_MODE ((unsigned int) 0x1 << 5) // (ADC) Sleep Mode +#define AT91C_ADC_PRESCAL ((unsigned int) 0x3F << 8) // (ADC) Prescaler rate selection +#define AT91C_ADC_STARTUP ((unsigned int) 0x1F << 16) // (ADC) Startup Time +#define AT91C_ADC_SHTIM ((unsigned int) 0xF << 24) // (ADC) Sample & Hold Time +// -------- ADC_CHER : (ADC Offset: 0x10) ADC Channel Enable Register -------- +#define AT91C_ADC_CH0 ((unsigned int) 0x1 << 0) // (ADC) Channel 0 +#define AT91C_ADC_CH1 ((unsigned int) 0x1 << 1) // (ADC) Channel 1 +#define AT91C_ADC_CH2 ((unsigned int) 0x1 << 2) // (ADC) Channel 2 +#define AT91C_ADC_CH3 ((unsigned int) 0x1 << 3) // (ADC) Channel 3 +#define AT91C_ADC_CH4 ((unsigned int) 0x1 << 4) // (ADC) Channel 4 +#define AT91C_ADC_CH5 ((unsigned int) 0x1 << 5) // (ADC) Channel 5 +#define AT91C_ADC_CH6 ((unsigned int) 0x1 << 6) // (ADC) Channel 6 +#define AT91C_ADC_CH7 ((unsigned int) 0x1 << 7) // (ADC) Channel 7 +// -------- ADC_CHDR : (ADC Offset: 0x14) ADC Channel Disable Register -------- +// -------- ADC_CHSR : (ADC Offset: 0x18) ADC Channel Status Register -------- +// -------- ADC_SR : (ADC Offset: 0x1c) ADC Status Register -------- +#define AT91C_ADC_EOC0 ((unsigned int) 0x1 << 0) // (ADC) End of Conversion +#define AT91C_ADC_EOC1 ((unsigned int) 0x1 << 1) // (ADC) End of Conversion +#define AT91C_ADC_EOC2 ((unsigned int) 0x1 << 2) // (ADC) End of Conversion +#define AT91C_ADC_EOC3 ((unsigned int) 0x1 << 3) // (ADC) End of Conversion +#define AT91C_ADC_EOC4 ((unsigned int) 0x1 << 4) // (ADC) End of Conversion +#define AT91C_ADC_EOC5 ((unsigned int) 0x1 << 5) // (ADC) End of Conversion +#define AT91C_ADC_EOC6 ((unsigned int) 0x1 << 6) // (ADC) End of Conversion +#define AT91C_ADC_EOC7 ((unsigned int) 0x1 << 7) // (ADC) End of Conversion +#define AT91C_ADC_OVRE0 ((unsigned int) 0x1 << 8) // (ADC) Overrun Error +#define AT91C_ADC_OVRE1 ((unsigned int) 0x1 << 9) // (ADC) Overrun Error +#define AT91C_ADC_OVRE2 ((unsigned int) 0x1 << 10) // (ADC) Overrun Error +#define AT91C_ADC_OVRE3 ((unsigned int) 0x1 << 11) // (ADC) Overrun Error +#define AT91C_ADC_OVRE4 ((unsigned int) 0x1 << 12) // (ADC) Overrun Error +#define AT91C_ADC_OVRE5 ((unsigned int) 0x1 << 13) // (ADC) Overrun Error +#define AT91C_ADC_OVRE6 ((unsigned int) 0x1 << 14) // (ADC) Overrun Error +#define AT91C_ADC_OVRE7 ((unsigned int) 0x1 << 15) // (ADC) Overrun Error +#define AT91C_ADC_DRDY ((unsigned int) 0x1 << 16) // (ADC) Data Ready +#define AT91C_ADC_GOVRE ((unsigned int) 0x1 << 17) // (ADC) General Overrun +#define AT91C_ADC_ENDRX ((unsigned int) 0x1 << 18) // (ADC) End of Receiver Transfer +#define AT91C_ADC_RXBUFF ((unsigned int) 0x1 << 19) // (ADC) RXBUFF Interrupt +// -------- ADC_LCDR : (ADC Offset: 0x20) ADC Last Converted Data Register -------- +#define AT91C_ADC_LDATA ((unsigned int) 0x3FF << 0) // (ADC) Last Data Converted +// -------- ADC_IER : (ADC Offset: 0x24) ADC Interrupt Enable Register -------- +// -------- ADC_IDR : (ADC Offset: 0x28) ADC Interrupt Disable Register -------- +// -------- ADC_IMR : (ADC Offset: 0x2c) ADC Interrupt Mask Register -------- +// -------- ADC_CDR0 : (ADC Offset: 0x30) ADC Channel Data Register 0 -------- +#define AT91C_ADC_DATA ((unsigned int) 0x3FF << 0) // (ADC) Converted Data +// -------- ADC_CDR1 : (ADC Offset: 0x34) ADC Channel Data Register 1 -------- +// -------- ADC_CDR2 : (ADC Offset: 0x38) ADC Channel Data Register 2 -------- +// -------- ADC_CDR3 : (ADC Offset: 0x3c) ADC Channel Data Register 3 -------- +// -------- ADC_CDR4 : (ADC Offset: 0x40) ADC Channel Data Register 4 -------- +// -------- ADC_CDR5 : (ADC Offset: 0x44) ADC Channel Data Register 5 -------- +// -------- ADC_CDR6 : (ADC Offset: 0x48) ADC Channel Data Register 6 -------- +// -------- ADC_CDR7 : (ADC Offset: 0x4c) ADC Channel Data Register 7 -------- + +// ***************************************************************************** +// REGISTER ADDRESS DEFINITION FOR AT91SAM7X256 +// ***************************************************************************** +// ========== Register definition for SYS peripheral ========== +// ========== Register definition for AIC peripheral ========== +#define AT91C_AIC_ICCR ((AT91_REG *) 0xFFFFF128) // (AIC) Interrupt Clear Command Register +#define AT91C_AIC_IECR ((AT91_REG *) 0xFFFFF120) // (AIC) Interrupt Enable Command Register +#define AT91C_AIC_SMR ((AT91_REG *) 0xFFFFF000) // (AIC) Source Mode Register +#define AT91C_AIC_ISCR ((AT91_REG *) 0xFFFFF12C) // (AIC) Interrupt Set Command Register +#define AT91C_AIC_EOICR ((AT91_REG *) 0xFFFFF130) // (AIC) End of Interrupt Command Register +#define AT91C_AIC_DCR ((AT91_REG *) 0xFFFFF138) // (AIC) Debug Control Register (Protect) +#define AT91C_AIC_FFER ((AT91_REG *) 0xFFFFF140) // (AIC) Fast Forcing Enable Register +#define AT91C_AIC_SVR ((AT91_REG *) 0xFFFFF080) // (AIC) Source Vector Register +#define AT91C_AIC_SPU ((AT91_REG *) 0xFFFFF134) // (AIC) Spurious Vector Register +#define AT91C_AIC_FFDR ((AT91_REG *) 0xFFFFF144) // (AIC) Fast Forcing Disable Register +#define AT91C_AIC_FVR ((AT91_REG *) 0xFFFFF104) // (AIC) FIQ Vector Register +#define AT91C_AIC_FFSR ((AT91_REG *) 0xFFFFF148) // (AIC) Fast Forcing Status Register +#define AT91C_AIC_IMR ((AT91_REG *) 0xFFFFF110) // (AIC) Interrupt Mask Register +#define AT91C_AIC_ISR ((AT91_REG *) 0xFFFFF108) // (AIC) Interrupt Status Register +#define AT91C_AIC_IVR ((AT91_REG *) 0xFFFFF100) // (AIC) IRQ Vector Register +#define AT91C_AIC_IDCR ((AT91_REG *) 0xFFFFF124) // (AIC) Interrupt Disable Command Register +#define AT91C_AIC_CISR ((AT91_REG *) 0xFFFFF114) // (AIC) Core Interrupt Status Register +#define AT91C_AIC_IPR ((AT91_REG *) 0xFFFFF10C) // (AIC) Interrupt Pending Register +// ========== Register definition for PDC_DBGU peripheral ========== +#define AT91C_DBGU_TNCR ((AT91_REG *) 0xFFFFF31C) // (PDC_DBGU) Transmit Next Counter Register +#define AT91C_DBGU_RNCR ((AT91_REG *) 0xFFFFF314) // (PDC_DBGU) Receive Next Counter Register +#define AT91C_DBGU_PTCR ((AT91_REG *) 0xFFFFF320) // (PDC_DBGU) PDC Transfer Control Register +#define AT91C_DBGU_PTSR ((AT91_REG *) 0xFFFFF324) // (PDC_DBGU) PDC Transfer Status Register +#define AT91C_DBGU_RCR ((AT91_REG *) 0xFFFFF304) // (PDC_DBGU) Receive Counter Register +#define AT91C_DBGU_TCR ((AT91_REG *) 0xFFFFF30C) // (PDC_DBGU) Transmit Counter Register +#define AT91C_DBGU_RPR ((AT91_REG *) 0xFFFFF300) // (PDC_DBGU) Receive Pointer Register +#define AT91C_DBGU_TPR ((AT91_REG *) 0xFFFFF308) // (PDC_DBGU) Transmit Pointer Register +#define AT91C_DBGU_RNPR ((AT91_REG *) 0xFFFFF310) // (PDC_DBGU) Receive Next Pointer Register +#define AT91C_DBGU_TNPR ((AT91_REG *) 0xFFFFF318) // (PDC_DBGU) Transmit Next Pointer Register +// ========== Register definition for DBGU peripheral ========== +#define AT91C_DBGU_EXID ((AT91_REG *) 0xFFFFF244) // (DBGU) Chip ID Extension Register +#define AT91C_DBGU_THR ((AT91_REG *) 0xFFFFF21C) // (DBGU) Transmitter Holding Register +#define AT91C_DBGU_CSR ((AT91_REG *) 0xFFFFF214) // (DBGU) Channel Status Register +#define AT91C_DBGU_IDR ((AT91_REG *) 0xFFFFF20C) // (DBGU) Interrupt Disable Register +#define AT91C_DBGU_MR ((AT91_REG *) 0xFFFFF204) // (DBGU) Mode Register +#define AT91C_DBGU_FNTR ((AT91_REG *) 0xFFFFF248) // (DBGU) Force NTRST Register +#define AT91C_DBGU_CIDR ((AT91_REG *) 0xFFFFF240) // (DBGU) Chip ID Register +#define AT91C_DBGU_BRGR ((AT91_REG *) 0xFFFFF220) // (DBGU) Baud Rate Generator Register +#define AT91C_DBGU_RHR ((AT91_REG *) 0xFFFFF218) // (DBGU) Receiver Holding Register +#define AT91C_DBGU_IMR ((AT91_REG *) 0xFFFFF210) // (DBGU) Interrupt Mask Register +#define AT91C_DBGU_IER ((AT91_REG *) 0xFFFFF208) // (DBGU) Interrupt Enable Register +#define AT91C_DBGU_CR ((AT91_REG *) 0xFFFFF200) // (DBGU) Control Register +// ========== Register definition for PIOA peripheral ========== +#define AT91C_PIOA_IMR ((AT91_REG *) 0xFFFFF448) // (PIOA) Interrupt Mask Register +#define AT91C_PIOA_IER ((AT91_REG *) 0xFFFFF440) // (PIOA) Interrupt Enable Register +#define AT91C_PIOA_OWDR ((AT91_REG *) 0xFFFFF4A4) // (PIOA) Output Write Disable Register +#define AT91C_PIOA_ISR ((AT91_REG *) 0xFFFFF44C) // (PIOA) Interrupt Status Register +#define AT91C_PIOA_PPUDR ((AT91_REG *) 0xFFFFF460) // (PIOA) Pull-up Disable Register +#define AT91C_PIOA_MDSR ((AT91_REG *) 0xFFFFF458) // (PIOA) Multi-driver Status Register +#define AT91C_PIOA_MDER ((AT91_REG *) 0xFFFFF450) // (PIOA) Multi-driver Enable Register +#define AT91C_PIOA_PER ((AT91_REG *) 0xFFFFF400) // (PIOA) PIO Enable Register +#define AT91C_PIOA_PSR ((AT91_REG *) 0xFFFFF408) // (PIOA) PIO Status Register +#define AT91C_PIOA_OER ((AT91_REG *) 0xFFFFF410) // (PIOA) Output Enable Register +#define AT91C_PIOA_BSR ((AT91_REG *) 0xFFFFF474) // (PIOA) Select B Register +#define AT91C_PIOA_PPUER ((AT91_REG *) 0xFFFFF464) // (PIOA) Pull-up Enable Register +#define AT91C_PIOA_MDDR ((AT91_REG *) 0xFFFFF454) // (PIOA) Multi-driver Disable Register +#define AT91C_PIOA_PDR ((AT91_REG *) 0xFFFFF404) // (PIOA) PIO Disable Register +#define AT91C_PIOA_ODR ((AT91_REG *) 0xFFFFF414) // (PIOA) Output Disable Registerr +#define AT91C_PIOA_IFDR ((AT91_REG *) 0xFFFFF424) // (PIOA) Input Filter Disable Register +#define AT91C_PIOA_ABSR ((AT91_REG *) 0xFFFFF478) // (PIOA) AB Select Status Register +#define AT91C_PIOA_ASR ((AT91_REG *) 0xFFFFF470) // (PIOA) Select A Register +#define AT91C_PIOA_PPUSR ((AT91_REG *) 0xFFFFF468) // (PIOA) Pull-up Status Register +#define AT91C_PIOA_ODSR ((AT91_REG *) 0xFFFFF438) // (PIOA) Output Data Status Register +#define AT91C_PIOA_SODR ((AT91_REG *) 0xFFFFF430) // (PIOA) Set Output Data Register +#define AT91C_PIOA_IFSR ((AT91_REG *) 0xFFFFF428) // (PIOA) Input Filter Status Register +#define AT91C_PIOA_IFER ((AT91_REG *) 0xFFFFF420) // (PIOA) Input Filter Enable Register +#define AT91C_PIOA_OSR ((AT91_REG *) 0xFFFFF418) // (PIOA) Output Status Register +#define AT91C_PIOA_IDR ((AT91_REG *) 0xFFFFF444) // (PIOA) Interrupt Disable Register +#define AT91C_PIOA_PDSR ((AT91_REG *) 0xFFFFF43C) // (PIOA) Pin Data Status Register +#define AT91C_PIOA_CODR ((AT91_REG *) 0xFFFFF434) // (PIOA) Clear Output Data Register +#define AT91C_PIOA_OWSR ((AT91_REG *) 0xFFFFF4A8) // (PIOA) Output Write Status Register +#define AT91C_PIOA_OWER ((AT91_REG *) 0xFFFFF4A0) // (PIOA) Output Write Enable Register +// ========== Register definition for PIOB peripheral ========== +#define AT91C_PIOB_OWSR ((AT91_REG *) 0xFFFFF6A8) // (PIOB) Output Write Status Register +#define AT91C_PIOB_PPUSR ((AT91_REG *) 0xFFFFF668) // (PIOB) Pull-up Status Register +#define AT91C_PIOB_PPUDR ((AT91_REG *) 0xFFFFF660) // (PIOB) Pull-up Disable Register +#define AT91C_PIOB_MDSR ((AT91_REG *) 0xFFFFF658) // (PIOB) Multi-driver Status Register +#define AT91C_PIOB_MDER ((AT91_REG *) 0xFFFFF650) // (PIOB) Multi-driver Enable Register +#define AT91C_PIOB_IMR ((AT91_REG *) 0xFFFFF648) // (PIOB) Interrupt Mask Register +#define AT91C_PIOB_OSR ((AT91_REG *) 0xFFFFF618) // (PIOB) Output Status Register +#define AT91C_PIOB_OER ((AT91_REG *) 0xFFFFF610) // (PIOB) Output Enable Register +#define AT91C_PIOB_PSR ((AT91_REG *) 0xFFFFF608) // (PIOB) PIO Status Register +#define AT91C_PIOB_PER ((AT91_REG *) 0xFFFFF600) // (PIOB) PIO Enable Register +#define AT91C_PIOB_BSR ((AT91_REG *) 0xFFFFF674) // (PIOB) Select B Register +#define AT91C_PIOB_PPUER ((AT91_REG *) 0xFFFFF664) // (PIOB) Pull-up Enable Register +#define AT91C_PIOB_IFDR ((AT91_REG *) 0xFFFFF624) // (PIOB) Input Filter Disable Register +#define AT91C_PIOB_ODR ((AT91_REG *) 0xFFFFF614) // (PIOB) Output Disable Registerr +#define AT91C_PIOB_ABSR ((AT91_REG *) 0xFFFFF678) // (PIOB) AB Select Status Register +#define AT91C_PIOB_ASR ((AT91_REG *) 0xFFFFF670) // (PIOB) Select A Register +#define AT91C_PIOB_IFER ((AT91_REG *) 0xFFFFF620) // (PIOB) Input Filter Enable Register +#define AT91C_PIOB_IFSR ((AT91_REG *) 0xFFFFF628) // (PIOB) Input Filter Status Register +#define AT91C_PIOB_SODR ((AT91_REG *) 0xFFFFF630) // (PIOB) Set Output Data Register +#define AT91C_PIOB_ODSR ((AT91_REG *) 0xFFFFF638) // (PIOB) Output Data Status Register +#define AT91C_PIOB_CODR ((AT91_REG *) 0xFFFFF634) // (PIOB) Clear Output Data Register +#define AT91C_PIOB_PDSR ((AT91_REG *) 0xFFFFF63C) // (PIOB) Pin Data Status Register +#define AT91C_PIOB_OWER ((AT91_REG *) 0xFFFFF6A0) // (PIOB) Output Write Enable Register +#define AT91C_PIOB_IER ((AT91_REG *) 0xFFFFF640) // (PIOB) Interrupt Enable Register +#define AT91C_PIOB_OWDR ((AT91_REG *) 0xFFFFF6A4) // (PIOB) Output Write Disable Register +#define AT91C_PIOB_MDDR ((AT91_REG *) 0xFFFFF654) // (PIOB) Multi-driver Disable Register +#define AT91C_PIOB_ISR ((AT91_REG *) 0xFFFFF64C) // (PIOB) Interrupt Status Register +#define AT91C_PIOB_IDR ((AT91_REG *) 0xFFFFF644) // (PIOB) Interrupt Disable Register +#define AT91C_PIOB_PDR ((AT91_REG *) 0xFFFFF604) // (PIOB) PIO Disable Register +// ========== Register definition for CKGR peripheral ========== +#define AT91C_CKGR_PLLR ((AT91_REG *) 0xFFFFFC2C) // (CKGR) PLL Register +#define AT91C_CKGR_MCFR ((AT91_REG *) 0xFFFFFC24) // (CKGR) Main Clock Frequency Register +#define AT91C_CKGR_MOR ((AT91_REG *) 0xFFFFFC20) // (CKGR) Main Oscillator Register +// ========== Register definition for PMC peripheral ========== +#define AT91C_PMC_SCSR ((AT91_REG *) 0xFFFFFC08) // (PMC) System Clock Status Register +#define AT91C_PMC_SCER ((AT91_REG *) 0xFFFFFC00) // (PMC) System Clock Enable Register +#define AT91C_PMC_IMR ((AT91_REG *) 0xFFFFFC6C) // (PMC) Interrupt Mask Register +#define AT91C_PMC_IDR ((AT91_REG *) 0xFFFFFC64) // (PMC) Interrupt Disable Register +#define AT91C_PMC_PCDR ((AT91_REG *) 0xFFFFFC14) // (PMC) Peripheral Clock Disable Register +#define AT91C_PMC_SCDR ((AT91_REG *) 0xFFFFFC04) // (PMC) System Clock Disable Register +#define AT91C_PMC_SR ((AT91_REG *) 0xFFFFFC68) // (PMC) Status Register +#define AT91C_PMC_IER ((AT91_REG *) 0xFFFFFC60) // (PMC) Interrupt Enable Register +#define AT91C_PMC_MCKR ((AT91_REG *) 0xFFFFFC30) // (PMC) Master Clock Register +#define AT91C_PMC_MOR ((AT91_REG *) 0xFFFFFC20) // (PMC) Main Oscillator Register +#define AT91C_PMC_PCER ((AT91_REG *) 0xFFFFFC10) // (PMC) Peripheral Clock Enable Register +#define AT91C_PMC_PCSR ((AT91_REG *) 0xFFFFFC18) // (PMC) Peripheral Clock Status Register +#define AT91C_PMC_PLLR ((AT91_REG *) 0xFFFFFC2C) // (PMC) PLL Register +#define AT91C_PMC_MCFR ((AT91_REG *) 0xFFFFFC24) // (PMC) Main Clock Frequency Register +#define AT91C_PMC_PCKR ((AT91_REG *) 0xFFFFFC40) // (PMC) Programmable Clock Register +// ========== Register definition for RSTC peripheral ========== +#define AT91C_RSTC_RSR ((AT91_REG *) 0xFFFFFD04) // (RSTC) Reset Status Register +#define AT91C_RSTC_RMR ((AT91_REG *) 0xFFFFFD08) // (RSTC) Reset Mode Register +#define AT91C_RSTC_RCR ((AT91_REG *) 0xFFFFFD00) // (RSTC) Reset Control Register +// ========== Register definition for RTTC peripheral ========== +#define AT91C_RTTC_RTSR ((AT91_REG *) 0xFFFFFD2C) // (RTTC) Real-time Status Register +#define AT91C_RTTC_RTAR ((AT91_REG *) 0xFFFFFD24) // (RTTC) Real-time Alarm Register +#define AT91C_RTTC_RTVR ((AT91_REG *) 0xFFFFFD28) // (RTTC) Real-time Value Register +#define AT91C_RTTC_RTMR ((AT91_REG *) 0xFFFFFD20) // (RTTC) Real-time Mode Register +// ========== Register definition for PITC peripheral ========== +#define AT91C_PITC_PIIR ((AT91_REG *) 0xFFFFFD3C) // (PITC) Period Interval Image Register +#define AT91C_PITC_PISR ((AT91_REG *) 0xFFFFFD34) // (PITC) Period Interval Status Register +#define AT91C_PITC_PIVR ((AT91_REG *) 0xFFFFFD38) // (PITC) Period Interval Value Register +#define AT91C_PITC_PIMR ((AT91_REG *) 0xFFFFFD30) // (PITC) Period Interval Mode Register +// ========== Register definition for WDTC peripheral ========== +#define AT91C_WDTC_WDMR ((AT91_REG *) 0xFFFFFD44) // (WDTC) Watchdog Mode Register +#define AT91C_WDTC_WDSR ((AT91_REG *) 0xFFFFFD48) // (WDTC) Watchdog Status Register +#define AT91C_WDTC_WDCR ((AT91_REG *) 0xFFFFFD40) // (WDTC) Watchdog Control Register +// ========== Register definition for VREG peripheral ========== +#define AT91C_VREG_MR ((AT91_REG *) 0xFFFFFD60) // (VREG) Voltage Regulator Mode Register +// ========== Register definition for MC peripheral ========== +#define AT91C_MC_FCR ((AT91_REG *) 0xFFFFFF64) // (MC) MC Flash Command Register +#define AT91C_MC_ASR ((AT91_REG *) 0xFFFFFF04) // (MC) MC Abort Status Register +#define AT91C_MC_FSR ((AT91_REG *) 0xFFFFFF68) // (MC) MC Flash Status Register +#define AT91C_MC_FMR ((AT91_REG *) 0xFFFFFF60) // (MC) MC Flash Mode Register +#define AT91C_MC_AASR ((AT91_REG *) 0xFFFFFF08) // (MC) MC Abort Address Status Register +#define AT91C_MC_RCR ((AT91_REG *) 0xFFFFFF00) // (MC) MC Remap Control Register +// ========== Register definition for PDC_SPI1 peripheral ========== +#define AT91C_SPI1_RNPR ((AT91_REG *) 0xFFFE4110) // (PDC_SPI1) Receive Next Pointer Register +#define AT91C_SPI1_TPR ((AT91_REG *) 0xFFFE4108) // (PDC_SPI1) Transmit Pointer Register +#define AT91C_SPI1_RPR ((AT91_REG *) 0xFFFE4100) // (PDC_SPI1) Receive Pointer Register +#define AT91C_SPI1_PTSR ((AT91_REG *) 0xFFFE4124) // (PDC_SPI1) PDC Transfer Status Register +#define AT91C_SPI1_RCR ((AT91_REG *) 0xFFFE4104) // (PDC_SPI1) Receive Counter Register +#define AT91C_SPI1_TCR ((AT91_REG *) 0xFFFE410C) // (PDC_SPI1) Transmit Counter Register +#define AT91C_SPI1_RNCR ((AT91_REG *) 0xFFFE4114) // (PDC_SPI1) Receive Next Counter Register +#define AT91C_SPI1_TNCR ((AT91_REG *) 0xFFFE411C) // (PDC_SPI1) Transmit Next Counter Register +#define AT91C_SPI1_TNPR ((AT91_REG *) 0xFFFE4118) // (PDC_SPI1) Transmit Next Pointer Register +#define AT91C_SPI1_PTCR ((AT91_REG *) 0xFFFE4120) // (PDC_SPI1) PDC Transfer Control Register +// ========== Register definition for SPI1 peripheral ========== +#define AT91C_SPI1_CSR ((AT91_REG *) 0xFFFE4030) // (SPI1) Chip Select Register +#define AT91C_SPI1_IDR ((AT91_REG *) 0xFFFE4018) // (SPI1) Interrupt Disable Register +#define AT91C_SPI1_SR ((AT91_REG *) 0xFFFE4010) // (SPI1) Status Register +#define AT91C_SPI1_RDR ((AT91_REG *) 0xFFFE4008) // (SPI1) Receive Data Register +#define AT91C_SPI1_CR ((AT91_REG *) 0xFFFE4000) // (SPI1) Control Register +#define AT91C_SPI1_IMR ((AT91_REG *) 0xFFFE401C) // (SPI1) Interrupt Mask Register +#define AT91C_SPI1_IER ((AT91_REG *) 0xFFFE4014) // (SPI1) Interrupt Enable Register +#define AT91C_SPI1_TDR ((AT91_REG *) 0xFFFE400C) // (SPI1) Transmit Data Register +#define AT91C_SPI1_MR ((AT91_REG *) 0xFFFE4004) // (SPI1) Mode Register +// ========== Register definition for PDC_SPI0 peripheral ========== +#define AT91C_SPI0_PTCR ((AT91_REG *) 0xFFFE0120) // (PDC_SPI0) PDC Transfer Control Register +#define AT91C_SPI0_TNPR ((AT91_REG *) 0xFFFE0118) // (PDC_SPI0) Transmit Next Pointer Register +#define AT91C_SPI0_RNPR ((AT91_REG *) 0xFFFE0110) // (PDC_SPI0) Receive Next Pointer Register +#define AT91C_SPI0_TPR ((AT91_REG *) 0xFFFE0108) // (PDC_SPI0) Transmit Pointer Register +#define AT91C_SPI0_RPR ((AT91_REG *) 0xFFFE0100) // (PDC_SPI0) Receive Pointer Register +#define AT91C_SPI0_PTSR ((AT91_REG *) 0xFFFE0124) // (PDC_SPI0) PDC Transfer Status Register +#define AT91C_SPI0_TNCR ((AT91_REG *) 0xFFFE011C) // (PDC_SPI0) Transmit Next Counter Register +#define AT91C_SPI0_RNCR ((AT91_REG *) 0xFFFE0114) // (PDC_SPI0) Receive Next Counter Register +#define AT91C_SPI0_TCR ((AT91_REG *) 0xFFFE010C) // (PDC_SPI0) Transmit Counter Register +#define AT91C_SPI0_RCR ((AT91_REG *) 0xFFFE0104) // (PDC_SPI0) Receive Counter Register +// ========== Register definition for SPI0 peripheral ========== +#define AT91C_SPI0_CSR ((AT91_REG *) 0xFFFE0030) // (SPI0) Chip Select Register +#define AT91C_SPI0_IDR ((AT91_REG *) 0xFFFE0018) // (SPI0) Interrupt Disable Register +#define AT91C_SPI0_SR ((AT91_REG *) 0xFFFE0010) // (SPI0) Status Register +#define AT91C_SPI0_RDR ((AT91_REG *) 0xFFFE0008) // (SPI0) Receive Data Register +#define AT91C_SPI0_CR ((AT91_REG *) 0xFFFE0000) // (SPI0) Control Register +#define AT91C_SPI0_IMR ((AT91_REG *) 0xFFFE001C) // (SPI0) Interrupt Mask Register +#define AT91C_SPI0_IER ((AT91_REG *) 0xFFFE0014) // (SPI0) Interrupt Enable Register +#define AT91C_SPI0_TDR ((AT91_REG *) 0xFFFE000C) // (SPI0) Transmit Data Register +#define AT91C_SPI0_MR ((AT91_REG *) 0xFFFE0004) // (SPI0) Mode Register +// ========== Register definition for PDC_US1 peripheral ========== +#define AT91C_US1_PTSR ((AT91_REG *) 0xFFFC4124) // (PDC_US1) PDC Transfer Status Register +#define AT91C_US1_TNCR ((AT91_REG *) 0xFFFC411C) // (PDC_US1) Transmit Next Counter Register +#define AT91C_US1_RNCR ((AT91_REG *) 0xFFFC4114) // (PDC_US1) Receive Next Counter Register +#define AT91C_US1_TCR ((AT91_REG *) 0xFFFC410C) // (PDC_US1) Transmit Counter Register +#define AT91C_US1_RCR ((AT91_REG *) 0xFFFC4104) // (PDC_US1) Receive Counter Register +#define AT91C_US1_PTCR ((AT91_REG *) 0xFFFC4120) // (PDC_US1) PDC Transfer Control Register +#define AT91C_US1_TNPR ((AT91_REG *) 0xFFFC4118) // (PDC_US1) Transmit Next Pointer Register +#define AT91C_US1_RNPR ((AT91_REG *) 0xFFFC4110) // (PDC_US1) Receive Next Pointer Register +#define AT91C_US1_TPR ((AT91_REG *) 0xFFFC4108) // (PDC_US1) Transmit Pointer Register +#define AT91C_US1_RPR ((AT91_REG *) 0xFFFC4100) // (PDC_US1) Receive Pointer Register +// ========== Register definition for US1 peripheral ========== +#define AT91C_US1_RHR ((AT91_REG *) 0xFFFC4018) // (US1) Receiver Holding Register +#define AT91C_US1_IMR ((AT91_REG *) 0xFFFC4010) // (US1) Interrupt Mask Register +#define AT91C_US1_IER ((AT91_REG *) 0xFFFC4008) // (US1) Interrupt Enable Register +#define AT91C_US1_CR ((AT91_REG *) 0xFFFC4000) // (US1) Control Register +#define AT91C_US1_RTOR ((AT91_REG *) 0xFFFC4024) // (US1) Receiver Time-out Register +#define AT91C_US1_THR ((AT91_REG *) 0xFFFC401C) // (US1) Transmitter Holding Register +#define AT91C_US1_CSR ((AT91_REG *) 0xFFFC4014) // (US1) Channel Status Register +#define AT91C_US1_IDR ((AT91_REG *) 0xFFFC400C) // (US1) Interrupt Disable Register +#define AT91C_US1_FIDI ((AT91_REG *) 0xFFFC4040) // (US1) FI_DI_Ratio Register +#define AT91C_US1_BRGR ((AT91_REG *) 0xFFFC4020) // (US1) Baud Rate Generator Register +#define AT91C_US1_TTGR ((AT91_REG *) 0xFFFC4028) // (US1) Transmitter Time-guard Register +#define AT91C_US1_IF ((AT91_REG *) 0xFFFC404C) // (US1) IRDA_FILTER Register +#define AT91C_US1_NER ((AT91_REG *) 0xFFFC4044) // (US1) Nb Errors Register +#define AT91C_US1_MR ((AT91_REG *) 0xFFFC4004) // (US1) Mode Register +// ========== Register definition for PDC_US0 peripheral ========== +#define AT91C_US0_PTCR ((AT91_REG *) 0xFFFC0120) // (PDC_US0) PDC Transfer Control Register +#define AT91C_US0_TNPR ((AT91_REG *) 0xFFFC0118) // (PDC_US0) Transmit Next Pointer Register +#define AT91C_US0_RNPR ((AT91_REG *) 0xFFFC0110) // (PDC_US0) Receive Next Pointer Register +#define AT91C_US0_TPR ((AT91_REG *) 0xFFFC0108) // (PDC_US0) Transmit Pointer Register +#define AT91C_US0_RPR ((AT91_REG *) 0xFFFC0100) // (PDC_US0) Receive Pointer Register +#define AT91C_US0_PTSR ((AT91_REG *) 0xFFFC0124) // (PDC_US0) PDC Transfer Status Register +#define AT91C_US0_TNCR ((AT91_REG *) 0xFFFC011C) // (PDC_US0) Transmit Next Counter Register +#define AT91C_US0_RNCR ((AT91_REG *) 0xFFFC0114) // (PDC_US0) Receive Next Counter Register +#define AT91C_US0_TCR ((AT91_REG *) 0xFFFC010C) // (PDC_US0) Transmit Counter Register +#define AT91C_US0_RCR ((AT91_REG *) 0xFFFC0104) // (PDC_US0) Receive Counter Register +// ========== Register definition for US0 peripheral ========== +#define AT91C_US0_TTGR ((AT91_REG *) 0xFFFC0028) // (US0) Transmitter Time-guard Register +#define AT91C_US0_BRGR ((AT91_REG *) 0xFFFC0020) // (US0) Baud Rate Generator Register +#define AT91C_US0_RHR ((AT91_REG *) 0xFFFC0018) // (US0) Receiver Holding Register +#define AT91C_US0_IMR ((AT91_REG *) 0xFFFC0010) // (US0) Interrupt Mask Register +#define AT91C_US0_NER ((AT91_REG *) 0xFFFC0044) // (US0) Nb Errors Register +#define AT91C_US0_RTOR ((AT91_REG *) 0xFFFC0024) // (US0) Receiver Time-out Register +#define AT91C_US0_FIDI ((AT91_REG *) 0xFFFC0040) // (US0) FI_DI_Ratio Register +#define AT91C_US0_CR ((AT91_REG *) 0xFFFC0000) // (US0) Control Register +#define AT91C_US0_IER ((AT91_REG *) 0xFFFC0008) // (US0) Interrupt Enable Register +#define AT91C_US0_IF ((AT91_REG *) 0xFFFC004C) // (US0) IRDA_FILTER Register +#define AT91C_US0_MR ((AT91_REG *) 0xFFFC0004) // (US0) Mode Register +#define AT91C_US0_IDR ((AT91_REG *) 0xFFFC000C) // (US0) Interrupt Disable Register +#define AT91C_US0_CSR ((AT91_REG *) 0xFFFC0014) // (US0) Channel Status Register +#define AT91C_US0_THR ((AT91_REG *) 0xFFFC001C) // (US0) Transmitter Holding Register +// ========== Register definition for PDC_SSC peripheral ========== +#define AT91C_SSC_PTCR ((AT91_REG *) 0xFFFD4120) // (PDC_SSC) PDC Transfer Control Register +#define AT91C_SSC_TNPR ((AT91_REG *) 0xFFFD4118) // (PDC_SSC) Transmit Next Pointer Register +#define AT91C_SSC_RNPR ((AT91_REG *) 0xFFFD4110) // (PDC_SSC) Receive Next Pointer Register +#define AT91C_SSC_TPR ((AT91_REG *) 0xFFFD4108) // (PDC_SSC) Transmit Pointer Register +#define AT91C_SSC_RPR ((AT91_REG *) 0xFFFD4100) // (PDC_SSC) Receive Pointer Register +#define AT91C_SSC_PTSR ((AT91_REG *) 0xFFFD4124) // (PDC_SSC) PDC Transfer Status Register +#define AT91C_SSC_TNCR ((AT91_REG *) 0xFFFD411C) // (PDC_SSC) Transmit Next Counter Register +#define AT91C_SSC_RNCR ((AT91_REG *) 0xFFFD4114) // (PDC_SSC) Receive Next Counter Register +#define AT91C_SSC_TCR ((AT91_REG *) 0xFFFD410C) // (PDC_SSC) Transmit Counter Register +#define AT91C_SSC_RCR ((AT91_REG *) 0xFFFD4104) // (PDC_SSC) Receive Counter Register +// ========== Register definition for SSC peripheral ========== +#define AT91C_SSC_RFMR ((AT91_REG *) 0xFFFD4014) // (SSC) Receive Frame Mode Register +#define AT91C_SSC_CMR ((AT91_REG *) 0xFFFD4004) // (SSC) Clock Mode Register +#define AT91C_SSC_IDR ((AT91_REG *) 0xFFFD4048) // (SSC) Interrupt Disable Register +#define AT91C_SSC_SR ((AT91_REG *) 0xFFFD4040) // (SSC) Status Register +#define AT91C_SSC_RSHR ((AT91_REG *) 0xFFFD4030) // (SSC) Receive Sync Holding Register +#define AT91C_SSC_RHR ((AT91_REG *) 0xFFFD4020) // (SSC) Receive Holding Register +#define AT91C_SSC_TCMR ((AT91_REG *) 0xFFFD4018) // (SSC) Transmit Clock Mode Register +#define AT91C_SSC_RCMR ((AT91_REG *) 0xFFFD4010) // (SSC) Receive Clock ModeRegister +#define AT91C_SSC_CR ((AT91_REG *) 0xFFFD4000) // (SSC) Control Register +#define AT91C_SSC_IMR ((AT91_REG *) 0xFFFD404C) // (SSC) Interrupt Mask Register +#define AT91C_SSC_IER ((AT91_REG *) 0xFFFD4044) // (SSC) Interrupt Enable Register +#define AT91C_SSC_TSHR ((AT91_REG *) 0xFFFD4034) // (SSC) Transmit Sync Holding Register +#define AT91C_SSC_THR ((AT91_REG *) 0xFFFD4024) // (SSC) Transmit Holding Register +#define AT91C_SSC_TFMR ((AT91_REG *) 0xFFFD401C) // (SSC) Transmit Frame Mode Register +// ========== Register definition for TWI peripheral ========== +#define AT91C_TWI_RHR ((AT91_REG *) 0xFFFB8030) // (TWI) Receive Holding Register +#define AT91C_TWI_IDR ((AT91_REG *) 0xFFFB8028) // (TWI) Interrupt Disable Register +#define AT91C_TWI_SR ((AT91_REG *) 0xFFFB8020) // (TWI) Status Register +#define AT91C_TWI_CWGR ((AT91_REG *) 0xFFFB8010) // (TWI) Clock Waveform Generator Register +#define AT91C_TWI_CR ((AT91_REG *) 0xFFFB8000) // (TWI) Control Register +#define AT91C_TWI_THR ((AT91_REG *) 0xFFFB8034) // (TWI) Transmit Holding Register +#define AT91C_TWI_IMR ((AT91_REG *) 0xFFFB802C) // (TWI) Interrupt Mask Register +#define AT91C_TWI_IER ((AT91_REG *) 0xFFFB8024) // (TWI) Interrupt Enable Register +#define AT91C_TWI_IADR ((AT91_REG *) 0xFFFB800C) // (TWI) Internal Address Register +#define AT91C_TWI_MMR ((AT91_REG *) 0xFFFB8004) // (TWI) Master Mode Register +// ========== Register definition for PWMC_CH3 peripheral ========== +#define AT91C_PWMC_CH3_CUPDR ((AT91_REG *) 0xFFFCC270) // (PWMC_CH3) Channel Update Register +#define AT91C_PWMC_CH3_CPRDR ((AT91_REG *) 0xFFFCC268) // (PWMC_CH3) Channel Period Register +#define AT91C_PWMC_CH3_CMR ((AT91_REG *) 0xFFFCC260) // (PWMC_CH3) Channel Mode Register +#define AT91C_PWMC_CH3_Reserved ((AT91_REG *) 0xFFFCC274) // (PWMC_CH3) Reserved +#define AT91C_PWMC_CH3_CCNTR ((AT91_REG *) 0xFFFCC26C) // (PWMC_CH3) Channel Counter Register +#define AT91C_PWMC_CH3_CDTYR ((AT91_REG *) 0xFFFCC264) // (PWMC_CH3) Channel Duty Cycle Register +// ========== Register definition for PWMC_CH2 peripheral ========== +#define AT91C_PWMC_CH2_CUPDR ((AT91_REG *) 0xFFFCC250) // (PWMC_CH2) Channel Update Register +#define AT91C_PWMC_CH2_CPRDR ((AT91_REG *) 0xFFFCC248) // (PWMC_CH2) Channel Period Register +#define AT91C_PWMC_CH2_CMR ((AT91_REG *) 0xFFFCC240) // (PWMC_CH2) Channel Mode Register +#define AT91C_PWMC_CH2_Reserved ((AT91_REG *) 0xFFFCC254) // (PWMC_CH2) Reserved +#define AT91C_PWMC_CH2_CCNTR ((AT91_REG *) 0xFFFCC24C) // (PWMC_CH2) Channel Counter Register +#define AT91C_PWMC_CH2_CDTYR ((AT91_REG *) 0xFFFCC244) // (PWMC_CH2) Channel Duty Cycle Register +// ========== Register definition for PWMC_CH1 peripheral ========== +#define AT91C_PWMC_CH1_CUPDR ((AT91_REG *) 0xFFFCC230) // (PWMC_CH1) Channel Update Register +#define AT91C_PWMC_CH1_CPRDR ((AT91_REG *) 0xFFFCC228) // (PWMC_CH1) Channel Period Register +#define AT91C_PWMC_CH1_CMR ((AT91_REG *) 0xFFFCC220) // (PWMC_CH1) Channel Mode Register +#define AT91C_PWMC_CH1_Reserved ((AT91_REG *) 0xFFFCC234) // (PWMC_CH1) Reserved +#define AT91C_PWMC_CH1_CCNTR ((AT91_REG *) 0xFFFCC22C) // (PWMC_CH1) Channel Counter Register +#define AT91C_PWMC_CH1_CDTYR ((AT91_REG *) 0xFFFCC224) // (PWMC_CH1) Channel Duty Cycle Register +// ========== Register definition for PWMC_CH0 peripheral ========== +#define AT91C_PWMC_CH0_CUPDR ((AT91_REG *) 0xFFFCC210) // (PWMC_CH0) Channel Update Register +#define AT91C_PWMC_CH0_CPRDR ((AT91_REG *) 0xFFFCC208) // (PWMC_CH0) Channel Period Register +#define AT91C_PWMC_CH0_CMR ((AT91_REG *) 0xFFFCC200) // (PWMC_CH0) Channel Mode Register +#define AT91C_PWMC_CH0_Reserved ((AT91_REG *) 0xFFFCC214) // (PWMC_CH0) Reserved +#define AT91C_PWMC_CH0_CCNTR ((AT91_REG *) 0xFFFCC20C) // (PWMC_CH0) Channel Counter Register +#define AT91C_PWMC_CH0_CDTYR ((AT91_REG *) 0xFFFCC204) // (PWMC_CH0) Channel Duty Cycle Register +// ========== Register definition for PWMC peripheral ========== +#define AT91C_PWMC_VR ((AT91_REG *) 0xFFFCC0FC) // (PWMC) PWMC Version Register +#define AT91C_PWMC_ISR ((AT91_REG *) 0xFFFCC01C) // (PWMC) PWMC Interrupt Status Register +#define AT91C_PWMC_IDR ((AT91_REG *) 0xFFFCC014) // (PWMC) PWMC Interrupt Disable Register +#define AT91C_PWMC_SR ((AT91_REG *) 0xFFFCC00C) // (PWMC) PWMC Status Register +#define AT91C_PWMC_ENA ((AT91_REG *) 0xFFFCC004) // (PWMC) PWMC Enable Register +#define AT91C_PWMC_IMR ((AT91_REG *) 0xFFFCC018) // (PWMC) PWMC Interrupt Mask Register +#define AT91C_PWMC_MR ((AT91_REG *) 0xFFFCC000) // (PWMC) PWMC Mode Register +#define AT91C_PWMC_DIS ((AT91_REG *) 0xFFFCC008) // (PWMC) PWMC Disable Register +#define AT91C_PWMC_IER ((AT91_REG *) 0xFFFCC010) // (PWMC) PWMC Interrupt Enable Register +// ========== Register definition for UDP peripheral ========== +#define AT91C_UDP_TXVC ((AT91_REG *) 0xFFFB0074) // (UDP) Transceiver Control Register +#define AT91C_UDP_ISR ((AT91_REG *) 0xFFFB001C) // (UDP) Interrupt Status Register +#define AT91C_UDP_IDR ((AT91_REG *) 0xFFFB0014) // (UDP) Interrupt Disable Register +#define AT91C_UDP_CSR ((AT91_REG *) 0xFFFB0030) // (UDP) Endpoint Control and Status Register +#define AT91C_UDP_RSTEP ((AT91_REG *) 0xFFFB0028) // (UDP) Reset Endpoint Register +#define AT91C_UDP_ICR ((AT91_REG *) 0xFFFB0020) // (UDP) Interrupt Clear Register +#define AT91C_UDP_GLBSTATE ((AT91_REG *) 0xFFFB0004) // (UDP) Global State Register +#define AT91C_UDP_NUM ((AT91_REG *) 0xFFFB0000) // (UDP) Frame Number Register +#define AT91C_UDP_FADDR ((AT91_REG *) 0xFFFB0008) // (UDP) Function Address Register +#define AT91C_UDP_IER ((AT91_REG *) 0xFFFB0010) // (UDP) Interrupt Enable Register +#define AT91C_UDP_IMR ((AT91_REG *) 0xFFFB0018) // (UDP) Interrupt Mask Register +#define AT91C_UDP_FDR ((AT91_REG *) 0xFFFB0050) // (UDP) Endpoint FIFO Data Register +// ========== Register definition for TC0 peripheral ========== +#define AT91C_TC0_IMR ((AT91_REG *) 0xFFFA002C) // (TC0) Interrupt Mask Register +#define AT91C_TC0_IER ((AT91_REG *) 0xFFFA0024) // (TC0) Interrupt Enable Register +#define AT91C_TC0_RC ((AT91_REG *) 0xFFFA001C) // (TC0) Register C +#define AT91C_TC0_RA ((AT91_REG *) 0xFFFA0014) // (TC0) Register A +#define AT91C_TC0_CMR ((AT91_REG *) 0xFFFA0004) // (TC0) Channel Mode Register (Capture Mode / Waveform Mode) +#define AT91C_TC0_IDR ((AT91_REG *) 0xFFFA0028) // (TC0) Interrupt Disable Register +#define AT91C_TC0_SR ((AT91_REG *) 0xFFFA0020) // (TC0) Status Register +#define AT91C_TC0_RB ((AT91_REG *) 0xFFFA0018) // (TC0) Register B +#define AT91C_TC0_CV ((AT91_REG *) 0xFFFA0010) // (TC0) Counter Value +#define AT91C_TC0_CCR ((AT91_REG *) 0xFFFA0000) // (TC0) Channel Control Register +// ========== Register definition for TC1 peripheral ========== +#define AT91C_TC1_IMR ((AT91_REG *) 0xFFFA006C) // (TC1) Interrupt Mask Register +#define AT91C_TC1_IER ((AT91_REG *) 0xFFFA0064) // (TC1) Interrupt Enable Register +#define AT91C_TC1_RC ((AT91_REG *) 0xFFFA005C) // (TC1) Register C +#define AT91C_TC1_RA ((AT91_REG *) 0xFFFA0054) // (TC1) Register A +#define AT91C_TC1_CMR ((AT91_REG *) 0xFFFA0044) // (TC1) Channel Mode Register (Capture Mode / Waveform Mode) +#define AT91C_TC1_IDR ((AT91_REG *) 0xFFFA0068) // (TC1) Interrupt Disable Register +#define AT91C_TC1_SR ((AT91_REG *) 0xFFFA0060) // (TC1) Status Register +#define AT91C_TC1_RB ((AT91_REG *) 0xFFFA0058) // (TC1) Register B +#define AT91C_TC1_CV ((AT91_REG *) 0xFFFA0050) // (TC1) Counter Value +#define AT91C_TC1_CCR ((AT91_REG *) 0xFFFA0040) // (TC1) Channel Control Register +// ========== Register definition for TC2 peripheral ========== +#define AT91C_TC2_IMR ((AT91_REG *) 0xFFFA00AC) // (TC2) Interrupt Mask Register +#define AT91C_TC2_IER ((AT91_REG *) 0xFFFA00A4) // (TC2) Interrupt Enable Register +#define AT91C_TC2_RC ((AT91_REG *) 0xFFFA009C) // (TC2) Register C +#define AT91C_TC2_RA ((AT91_REG *) 0xFFFA0094) // (TC2) Register A +#define AT91C_TC2_CMR ((AT91_REG *) 0xFFFA0084) // (TC2) Channel Mode Register (Capture Mode / Waveform Mode) +#define AT91C_TC2_IDR ((AT91_REG *) 0xFFFA00A8) // (TC2) Interrupt Disable Register +#define AT91C_TC2_SR ((AT91_REG *) 0xFFFA00A0) // (TC2) Status Register +#define AT91C_TC2_RB ((AT91_REG *) 0xFFFA0098) // (TC2) Register B +#define AT91C_TC2_CV ((AT91_REG *) 0xFFFA0090) // (TC2) Counter Value +#define AT91C_TC2_CCR ((AT91_REG *) 0xFFFA0080) // (TC2) Channel Control Register +// ========== Register definition for TCB peripheral ========== +#define AT91C_TCB_BMR ((AT91_REG *) 0xFFFA00C4) // (TCB) TC Block Mode Register +#define AT91C_TCB_BCR ((AT91_REG *) 0xFFFA00C0) // (TCB) TC Block Control Register +// ========== Register definition for CAN_MB0 peripheral ========== +#define AT91C_CAN_MB0_MCR ((AT91_REG *) 0xFFFD021C) // (CAN_MB0) MailBox Control Register +#define AT91C_CAN_MB0_MDL ((AT91_REG *) 0xFFFD0214) // (CAN_MB0) MailBox Data Low Register +#define AT91C_CAN_MB0_MFID ((AT91_REG *) 0xFFFD020C) // (CAN_MB0) MailBox Family ID Register +#define AT91C_CAN_MB0_MAM ((AT91_REG *) 0xFFFD0204) // (CAN_MB0) MailBox Acceptance Mask Register +#define AT91C_CAN_MB0_MDH ((AT91_REG *) 0xFFFD0218) // (CAN_MB0) MailBox Data High Register +#define AT91C_CAN_MB0_MSR ((AT91_REG *) 0xFFFD0210) // (CAN_MB0) MailBox Status Register +#define AT91C_CAN_MB0_MID ((AT91_REG *) 0xFFFD0208) // (CAN_MB0) MailBox ID Register +#define AT91C_CAN_MB0_MMR ((AT91_REG *) 0xFFFD0200) // (CAN_MB0) MailBox Mode Register +// ========== Register definition for CAN_MB1 peripheral ========== +#define AT91C_CAN_MB1_MCR ((AT91_REG *) 0xFFFD023C) // (CAN_MB1) MailBox Control Register +#define AT91C_CAN_MB1_MDL ((AT91_REG *) 0xFFFD0234) // (CAN_MB1) MailBox Data Low Register +#define AT91C_CAN_MB1_MFID ((AT91_REG *) 0xFFFD022C) // (CAN_MB1) MailBox Family ID Register +#define AT91C_CAN_MB1_MAM ((AT91_REG *) 0xFFFD0224) // (CAN_MB1) MailBox Acceptance Mask Register +#define AT91C_CAN_MB1_MDH ((AT91_REG *) 0xFFFD0238) // (CAN_MB1) MailBox Data High Register +#define AT91C_CAN_MB1_MSR ((AT91_REG *) 0xFFFD0230) // (CAN_MB1) MailBox Status Register +#define AT91C_CAN_MB1_MID ((AT91_REG *) 0xFFFD0228) // (CAN_MB1) MailBox ID Register +#define AT91C_CAN_MB1_MMR ((AT91_REG *) 0xFFFD0220) // (CAN_MB1) MailBox Mode Register +// ========== Register definition for CAN_MB2 peripheral ========== +#define AT91C_CAN_MB2_MCR ((AT91_REG *) 0xFFFD025C) // (CAN_MB2) MailBox Control Register +#define AT91C_CAN_MB2_MDL ((AT91_REG *) 0xFFFD0254) // (CAN_MB2) MailBox Data Low Register +#define AT91C_CAN_MB2_MFID ((AT91_REG *) 0xFFFD024C) // (CAN_MB2) MailBox Family ID Register +#define AT91C_CAN_MB2_MAM ((AT91_REG *) 0xFFFD0244) // (CAN_MB2) MailBox Acceptance Mask Register +#define AT91C_CAN_MB2_MDH ((AT91_REG *) 0xFFFD0258) // (CAN_MB2) MailBox Data High Register +#define AT91C_CAN_MB2_MSR ((AT91_REG *) 0xFFFD0250) // (CAN_MB2) MailBox Status Register +#define AT91C_CAN_MB2_MID ((AT91_REG *) 0xFFFD0248) // (CAN_MB2) MailBox ID Register +#define AT91C_CAN_MB2_MMR ((AT91_REG *) 0xFFFD0240) // (CAN_MB2) MailBox Mode Register +// ========== Register definition for CAN_MB3 peripheral ========== +#define AT91C_CAN_MB3_MCR ((AT91_REG *) 0xFFFD027C) // (CAN_MB3) MailBox Control Register +#define AT91C_CAN_MB3_MDL ((AT91_REG *) 0xFFFD0274) // (CAN_MB3) MailBox Data Low Register +#define AT91C_CAN_MB3_MFID ((AT91_REG *) 0xFFFD026C) // (CAN_MB3) MailBox Family ID Register +#define AT91C_CAN_MB3_MAM ((AT91_REG *) 0xFFFD0264) // (CAN_MB3) MailBox Acceptance Mask Register +#define AT91C_CAN_MB3_MDH ((AT91_REG *) 0xFFFD0278) // (CAN_MB3) MailBox Data High Register +#define AT91C_CAN_MB3_MSR ((AT91_REG *) 0xFFFD0270) // (CAN_MB3) MailBox Status Register +#define AT91C_CAN_MB3_MID ((AT91_REG *) 0xFFFD0268) // (CAN_MB3) MailBox ID Register +#define AT91C_CAN_MB3_MMR ((AT91_REG *) 0xFFFD0260) // (CAN_MB3) MailBox Mode Register +// ========== Register definition for CAN_MB4 peripheral ========== +#define AT91C_CAN_MB4_MCR ((AT91_REG *) 0xFFFD029C) // (CAN_MB4) MailBox Control Register +#define AT91C_CAN_MB4_MDL ((AT91_REG *) 0xFFFD0294) // (CAN_MB4) MailBox Data Low Register +#define AT91C_CAN_MB4_MFID ((AT91_REG *) 0xFFFD028C) // (CAN_MB4) MailBox Family ID Register +#define AT91C_CAN_MB4_MAM ((AT91_REG *) 0xFFFD0284) // (CAN_MB4) MailBox Acceptance Mask Register +#define AT91C_CAN_MB4_MDH ((AT91_REG *) 0xFFFD0298) // (CAN_MB4) MailBox Data High Register +#define AT91C_CAN_MB4_MSR ((AT91_REG *) 0xFFFD0290) // (CAN_MB4) MailBox Status Register +#define AT91C_CAN_MB4_MID ((AT91_REG *) 0xFFFD0288) // (CAN_MB4) MailBox ID Register +#define AT91C_CAN_MB4_MMR ((AT91_REG *) 0xFFFD0280) // (CAN_MB4) MailBox Mode Register +// ========== Register definition for CAN_MB5 peripheral ========== +#define AT91C_CAN_MB5_MCR ((AT91_REG *) 0xFFFD02BC) // (CAN_MB5) MailBox Control Register +#define AT91C_CAN_MB5_MDL ((AT91_REG *) 0xFFFD02B4) // (CAN_MB5) MailBox Data Low Register +#define AT91C_CAN_MB5_MFID ((AT91_REG *) 0xFFFD02AC) // (CAN_MB5) MailBox Family ID Register +#define AT91C_CAN_MB5_MAM ((AT91_REG *) 0xFFFD02A4) // (CAN_MB5) MailBox Acceptance Mask Register +#define AT91C_CAN_MB5_MDH ((AT91_REG *) 0xFFFD02B8) // (CAN_MB5) MailBox Data High Register +#define AT91C_CAN_MB5_MSR ((AT91_REG *) 0xFFFD02B0) // (CAN_MB5) MailBox Status Register +#define AT91C_CAN_MB5_MID ((AT91_REG *) 0xFFFD02A8) // (CAN_MB5) MailBox ID Register +#define AT91C_CAN_MB5_MMR ((AT91_REG *) 0xFFFD02A0) // (CAN_MB5) MailBox Mode Register +// ========== Register definition for CAN_MB6 peripheral ========== +#define AT91C_CAN_MB6_MAM ((AT91_REG *) 0xFFFD02C4) // (CAN_MB6) MailBox Acceptance Mask Register +#define AT91C_CAN_MB6_MDH ((AT91_REG *) 0xFFFD02D8) // (CAN_MB6) MailBox Data High Register +#define AT91C_CAN_MB6_MSR ((AT91_REG *) 0xFFFD02D0) // (CAN_MB6) MailBox Status Register +#define AT91C_CAN_MB6_MID ((AT91_REG *) 0xFFFD02C8) // (CAN_MB6) MailBox ID Register +#define AT91C_CAN_MB6_MMR ((AT91_REG *) 0xFFFD02C0) // (CAN_MB6) MailBox Mode Register +#define AT91C_CAN_MB6_MCR ((AT91_REG *) 0xFFFD02DC) // (CAN_MB6) MailBox Control Register +#define AT91C_CAN_MB6_MDL ((AT91_REG *) 0xFFFD02D4) // (CAN_MB6) MailBox Data Low Register +#define AT91C_CAN_MB6_MFID ((AT91_REG *) 0xFFFD02CC) // (CAN_MB6) MailBox Family ID Register +// ========== Register definition for CAN_MB7 peripheral ========== +#define AT91C_CAN_MB7_MDH ((AT91_REG *) 0xFFFD02F8) // (CAN_MB7) MailBox Data High Register +#define AT91C_CAN_MB7_MSR ((AT91_REG *) 0xFFFD02F0) // (CAN_MB7) MailBox Status Register +#define AT91C_CAN_MB7_MID ((AT91_REG *) 0xFFFD02E8) // (CAN_MB7) MailBox ID Register +#define AT91C_CAN_MB7_MMR ((AT91_REG *) 0xFFFD02E0) // (CAN_MB7) MailBox Mode Register +#define AT91C_CAN_MB7_MCR ((AT91_REG *) 0xFFFD02FC) // (CAN_MB7) MailBox Control Register +#define AT91C_CAN_MB7_MDL ((AT91_REG *) 0xFFFD02F4) // (CAN_MB7) MailBox Data Low Register +#define AT91C_CAN_MB7_MFID ((AT91_REG *) 0xFFFD02EC) // (CAN_MB7) MailBox Family ID Register +#define AT91C_CAN_MB7_MAM ((AT91_REG *) 0xFFFD02E4) // (CAN_MB7) MailBox Acceptance Mask Register +// ========== Register definition for CAN peripheral ========== +#define AT91C_CAN_IMR ((AT91_REG *) 0xFFFD000C) // (CAN) Interrupt Mask Register +#define AT91C_CAN_IER ((AT91_REG *) 0xFFFD0004) // (CAN) Interrupt Enable Register +#define AT91C_CAN_ECR ((AT91_REG *) 0xFFFD0020) // (CAN) Error Counter Register +#define AT91C_CAN_TIM ((AT91_REG *) 0xFFFD0018) // (CAN) Timer Register +#define AT91C_CAN_SR ((AT91_REG *) 0xFFFD0010) // (CAN) Status Register +#define AT91C_CAN_IDR ((AT91_REG *) 0xFFFD0008) // (CAN) Interrupt Disable Register +#define AT91C_CAN_MR ((AT91_REG *) 0xFFFD0000) // (CAN) Mode Register +#define AT91C_CAN_BR ((AT91_REG *) 0xFFFD0014) // (CAN) Baudrate Register +#define AT91C_CAN_TIMESTP ((AT91_REG *) 0xFFFD001C) // (CAN) Time Stamp Register +#define AT91C_CAN_TCR ((AT91_REG *) 0xFFFD0024) // (CAN) Transfer Command Register +#define AT91C_CAN_ACR ((AT91_REG *) 0xFFFD0028) // (CAN) Abort Command Register +#define AT91C_CAN_VR ((AT91_REG *) 0xFFFD00FC) // (CAN) Version Register +// ========== Register definition for EMAC peripheral ========== +#define AT91C_EMAC_TID ((AT91_REG *) 0xFFFDC0B8) // (EMAC) Type ID Checking Register +#define AT91C_EMAC_SA3L ((AT91_REG *) 0xFFFDC0A8) // (EMAC) Specific Address 3 Bottom, First 4 bytes +#define AT91C_EMAC_STE ((AT91_REG *) 0xFFFDC084) // (EMAC) SQE Test Error Register +#define AT91C_EMAC_RSE ((AT91_REG *) 0xFFFDC074) // (EMAC) Receive Symbol Errors Register +#define AT91C_EMAC_IDR ((AT91_REG *) 0xFFFDC02C) // (EMAC) Interrupt Disable Register +#define AT91C_EMAC_TBQP ((AT91_REG *) 0xFFFDC01C) // (EMAC) Transmit Buffer Queue Pointer +#define AT91C_EMAC_TPQ ((AT91_REG *) 0xFFFDC0BC) // (EMAC) Transmit Pause Quantum Register +#define AT91C_EMAC_SA1L ((AT91_REG *) 0xFFFDC098) // (EMAC) Specific Address 1 Bottom, First 4 bytes +#define AT91C_EMAC_RLE ((AT91_REG *) 0xFFFDC088) // (EMAC) Receive Length Field Mismatch Register +#define AT91C_EMAC_IMR ((AT91_REG *) 0xFFFDC030) // (EMAC) Interrupt Mask Register +#define AT91C_EMAC_SA1H ((AT91_REG *) 0xFFFDC09C) // (EMAC) Specific Address 1 Top, Last 2 bytes +#define AT91C_EMAC_PFR ((AT91_REG *) 0xFFFDC03C) // (EMAC) Pause Frames received Register +#define AT91C_EMAC_FCSE ((AT91_REG *) 0xFFFDC050) // (EMAC) Frame Check Sequence Error Register +#define AT91C_EMAC_FTO ((AT91_REG *) 0xFFFDC040) // (EMAC) Frames Transmitted OK Register +#define AT91C_EMAC_TUND ((AT91_REG *) 0xFFFDC064) // (EMAC) Transmit Underrun Error Register +#define AT91C_EMAC_ALE ((AT91_REG *) 0xFFFDC054) // (EMAC) Alignment Error Register +#define AT91C_EMAC_SCF ((AT91_REG *) 0xFFFDC044) // (EMAC) Single Collision Frame Register +#define AT91C_EMAC_SA3H ((AT91_REG *) 0xFFFDC0AC) // (EMAC) Specific Address 3 Top, Last 2 bytes +#define AT91C_EMAC_ELE ((AT91_REG *) 0xFFFDC078) // (EMAC) Excessive Length Errors Register +#define AT91C_EMAC_CSE ((AT91_REG *) 0xFFFDC068) // (EMAC) Carrier Sense Error Register +#define AT91C_EMAC_DTF ((AT91_REG *) 0xFFFDC058) // (EMAC) Deferred Transmission Frame Register +#define AT91C_EMAC_RSR ((AT91_REG *) 0xFFFDC020) // (EMAC) Receive Status Register +#define AT91C_EMAC_USRIO ((AT91_REG *) 0xFFFDC0C0) // (EMAC) USER Input/Output Register +#define AT91C_EMAC_SA4L ((AT91_REG *) 0xFFFDC0B0) // (EMAC) Specific Address 4 Bottom, First 4 bytes +#define AT91C_EMAC_RRE ((AT91_REG *) 0xFFFDC06C) // (EMAC) Receive Ressource Error Register +#define AT91C_EMAC_RJA ((AT91_REG *) 0xFFFDC07C) // (EMAC) Receive Jabbers Register +#define AT91C_EMAC_TPF ((AT91_REG *) 0xFFFDC08C) // (EMAC) Transmitted Pause Frames Register +#define AT91C_EMAC_ISR ((AT91_REG *) 0xFFFDC024) // (EMAC) Interrupt Status Register +#define AT91C_EMAC_MAN ((AT91_REG *) 0xFFFDC034) // (EMAC) PHY Maintenance Register +#define AT91C_EMAC_WOL ((AT91_REG *) 0xFFFDC0C4) // (EMAC) Wake On LAN Register +#define AT91C_EMAC_USF ((AT91_REG *) 0xFFFDC080) // (EMAC) Undersize Frames Register +#define AT91C_EMAC_HRB ((AT91_REG *) 0xFFFDC090) // (EMAC) Hash Address Bottom[31:0] +#define AT91C_EMAC_PTR ((AT91_REG *) 0xFFFDC038) // (EMAC) Pause Time Register +#define AT91C_EMAC_HRT ((AT91_REG *) 0xFFFDC094) // (EMAC) Hash Address Top[63:32] +#define AT91C_EMAC_REV ((AT91_REG *) 0xFFFDC0FC) // (EMAC) Revision Register +#define AT91C_EMAC_MCF ((AT91_REG *) 0xFFFDC048) // (EMAC) Multiple Collision Frame Register +#define AT91C_EMAC_SA2L ((AT91_REG *) 0xFFFDC0A0) // (EMAC) Specific Address 2 Bottom, First 4 bytes +#define AT91C_EMAC_NCR ((AT91_REG *) 0xFFFDC000) // (EMAC) Network Control Register +#define AT91C_EMAC_FRO ((AT91_REG *) 0xFFFDC04C) // (EMAC) Frames Received OK Register +#define AT91C_EMAC_LCOL ((AT91_REG *) 0xFFFDC05C) // (EMAC) Late Collision Register +#define AT91C_EMAC_SA4H ((AT91_REG *) 0xFFFDC0B4) // (EMAC) Specific Address 4 Top, Last 2 bytes +#define AT91C_EMAC_NCFGR ((AT91_REG *) 0xFFFDC004) // (EMAC) Network Configuration Register +#define AT91C_EMAC_TSR ((AT91_REG *) 0xFFFDC014) // (EMAC) Transmit Status Register +#define AT91C_EMAC_SA2H ((AT91_REG *) 0xFFFDC0A4) // (EMAC) Specific Address 2 Top, Last 2 bytes +#define AT91C_EMAC_ECOL ((AT91_REG *) 0xFFFDC060) // (EMAC) Excessive Collision Register +#define AT91C_EMAC_ROV ((AT91_REG *) 0xFFFDC070) // (EMAC) Receive Overrun Errors Register +#define AT91C_EMAC_NSR ((AT91_REG *) 0xFFFDC008) // (EMAC) Network Status Register +#define AT91C_EMAC_RBQP ((AT91_REG *) 0xFFFDC018) // (EMAC) Receive Buffer Queue Pointer +#define AT91C_EMAC_IER ((AT91_REG *) 0xFFFDC028) // (EMAC) Interrupt Enable Register +// ========== Register definition for PDC_ADC peripheral ========== +#define AT91C_ADC_PTCR ((AT91_REG *) 0xFFFD8120) // (PDC_ADC) PDC Transfer Control Register +#define AT91C_ADC_TNPR ((AT91_REG *) 0xFFFD8118) // (PDC_ADC) Transmit Next Pointer Register +#define AT91C_ADC_RNPR ((AT91_REG *) 0xFFFD8110) // (PDC_ADC) Receive Next Pointer Register +#define AT91C_ADC_TPR ((AT91_REG *) 0xFFFD8108) // (PDC_ADC) Transmit Pointer Register +#define AT91C_ADC_RPR ((AT91_REG *) 0xFFFD8100) // (PDC_ADC) Receive Pointer Register +#define AT91C_ADC_PTSR ((AT91_REG *) 0xFFFD8124) // (PDC_ADC) PDC Transfer Status Register +#define AT91C_ADC_TNCR ((AT91_REG *) 0xFFFD811C) // (PDC_ADC) Transmit Next Counter Register +#define AT91C_ADC_RNCR ((AT91_REG *) 0xFFFD8114) // (PDC_ADC) Receive Next Counter Register +#define AT91C_ADC_TCR ((AT91_REG *) 0xFFFD810C) // (PDC_ADC) Transmit Counter Register +#define AT91C_ADC_RCR ((AT91_REG *) 0xFFFD8104) // (PDC_ADC) Receive Counter Register +// ========== Register definition for ADC peripheral ========== +#define AT91C_ADC_IMR ((AT91_REG *) 0xFFFD802C) // (ADC) ADC Interrupt Mask Register +#define AT91C_ADC_CDR4 ((AT91_REG *) 0xFFFD8040) // (ADC) ADC Channel Data Register 4 +#define AT91C_ADC_CDR2 ((AT91_REG *) 0xFFFD8038) // (ADC) ADC Channel Data Register 2 +#define AT91C_ADC_CDR0 ((AT91_REG *) 0xFFFD8030) // (ADC) ADC Channel Data Register 0 +#define AT91C_ADC_CDR7 ((AT91_REG *) 0xFFFD804C) // (ADC) ADC Channel Data Register 7 +#define AT91C_ADC_CDR1 ((AT91_REG *) 0xFFFD8034) // (ADC) ADC Channel Data Register 1 +#define AT91C_ADC_CDR3 ((AT91_REG *) 0xFFFD803C) // (ADC) ADC Channel Data Register 3 +#define AT91C_ADC_CDR5 ((AT91_REG *) 0xFFFD8044) // (ADC) ADC Channel Data Register 5 +#define AT91C_ADC_MR ((AT91_REG *) 0xFFFD8004) // (ADC) ADC Mode Register +#define AT91C_ADC_CDR6 ((AT91_REG *) 0xFFFD8048) // (ADC) ADC Channel Data Register 6 +#define AT91C_ADC_CR ((AT91_REG *) 0xFFFD8000) // (ADC) ADC Control Register +#define AT91C_ADC_CHER ((AT91_REG *) 0xFFFD8010) // (ADC) ADC Channel Enable Register +#define AT91C_ADC_CHSR ((AT91_REG *) 0xFFFD8018) // (ADC) ADC Channel Status Register +#define AT91C_ADC_IER ((AT91_REG *) 0xFFFD8024) // (ADC) ADC Interrupt Enable Register +#define AT91C_ADC_SR ((AT91_REG *) 0xFFFD801C) // (ADC) ADC Status Register +#define AT91C_ADC_CHDR ((AT91_REG *) 0xFFFD8014) // (ADC) ADC Channel Disable Register +#define AT91C_ADC_IDR ((AT91_REG *) 0xFFFD8028) // (ADC) ADC Interrupt Disable Register +#define AT91C_ADC_LCDR ((AT91_REG *) 0xFFFD8020) // (ADC) ADC Last Converted Data Register + +// ***************************************************************************** +// PIO DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** +#define AT91C_PIO_PA0 ((unsigned int) 1 << 0) // Pin Controlled by PA0 +#define AT91C_PA0_RXD0 ((unsigned int) AT91C_PIO_PA0) // USART 0 Receive Data +#define AT91C_PIO_PA1 ((unsigned int) 1 << 1) // Pin Controlled by PA1 +#define AT91C_PA1_TXD0 ((unsigned int) AT91C_PIO_PA1) // USART 0 Transmit Data +#define AT91C_PIO_PA10 ((unsigned int) 1 << 10) // Pin Controlled by PA10 +#define AT91C_PA10_TWD ((unsigned int) AT91C_PIO_PA10) // TWI Two-wire Serial Data +#define AT91C_PIO_PA11 ((unsigned int) 1 << 11) // Pin Controlled by PA11 +#define AT91C_PA11_TWCK ((unsigned int) AT91C_PIO_PA11) // TWI Two-wire Serial Clock +#define AT91C_PIO_PA12 ((unsigned int) 1 << 12) // Pin Controlled by PA12 +#define AT91C_PA12_SPI0_NPCS0 ((unsigned int) AT91C_PIO_PA12) // SPI 0 Peripheral Chip Select 0 +#define AT91C_PIO_PA13 ((unsigned int) 1 << 13) // Pin Controlled by PA13 +#define AT91C_PA13_SPI0_NPCS1 ((unsigned int) AT91C_PIO_PA13) // SPI 0 Peripheral Chip Select 1 +#define AT91C_PA13_PCK1 ((unsigned int) AT91C_PIO_PA13) // PMC Programmable Clock Output 1 +#define AT91C_PIO_PA14 ((unsigned int) 1 << 14) // Pin Controlled by PA14 +#define AT91C_PA14_SPI0_NPCS2 ((unsigned int) AT91C_PIO_PA14) // SPI 0 Peripheral Chip Select 2 +#define AT91C_PA14_IRQ1 ((unsigned int) AT91C_PIO_PA14) // External Interrupt 1 +#define AT91C_PIO_PA15 ((unsigned int) 1 << 15) // Pin Controlled by PA15 +#define AT91C_PA15_SPI0_NPCS3 ((unsigned int) AT91C_PIO_PA15) // SPI 0 Peripheral Chip Select 3 +#define AT91C_PA15_TCLK2 ((unsigned int) AT91C_PIO_PA15) // Timer Counter 2 external clock input +#define AT91C_PIO_PA16 ((unsigned int) 1 << 16) // Pin Controlled by PA16 +#define AT91C_PA16_SPI0_MISO ((unsigned int) AT91C_PIO_PA16) // SPI 0 Master In Slave +#define AT91C_PIO_PA17 ((unsigned int) 1 << 17) // Pin Controlled by PA17 +#define AT91C_PA17_SPI0_MOSI ((unsigned int) AT91C_PIO_PA17) // SPI 0 Master Out Slave +#define AT91C_PIO_PA18 ((unsigned int) 1 << 18) // Pin Controlled by PA18 +#define AT91C_PA18_SPI0_SPCK ((unsigned int) AT91C_PIO_PA18) // SPI 0 Serial Clock +#define AT91C_PIO_PA19 ((unsigned int) 1 << 19) // Pin Controlled by PA19 +#define AT91C_PA19_CANRX ((unsigned int) AT91C_PIO_PA19) // CAN Receive +#define AT91C_PIO_PA2 ((unsigned int) 1 << 2) // Pin Controlled by PA2 +#define AT91C_PA2_SCK0 ((unsigned int) AT91C_PIO_PA2) // USART 0 Serial Clock +#define AT91C_PA2_SPI1_NPCS1 ((unsigned int) AT91C_PIO_PA2) // SPI 1 Peripheral Chip Select 1 +#define AT91C_PIO_PA20 ((unsigned int) 1 << 20) // Pin Controlled by PA20 +#define AT91C_PA20_CANTX ((unsigned int) AT91C_PIO_PA20) // CAN Transmit +#define AT91C_PIO_PA21 ((unsigned int) 1 << 21) // Pin Controlled by PA21 +#define AT91C_PA21_TF ((unsigned int) AT91C_PIO_PA21) // SSC Transmit Frame Sync +#define AT91C_PA21_SPI1_NPCS0 ((unsigned int) AT91C_PIO_PA21) // SPI 1 Peripheral Chip Select 0 +#define AT91C_PIO_PA22 ((unsigned int) 1 << 22) // Pin Controlled by PA22 +#define AT91C_PA22_TK ((unsigned int) AT91C_PIO_PA22) // SSC Transmit Clock +#define AT91C_PA22_SPI1_SPCK ((unsigned int) AT91C_PIO_PA22) // SPI 1 Serial Clock +#define AT91C_PIO_PA23 ((unsigned int) 1 << 23) // Pin Controlled by PA23 +#define AT91C_PA23_TD ((unsigned int) AT91C_PIO_PA23) // SSC Transmit data +#define AT91C_PA23_SPI1_MOSI ((unsigned int) AT91C_PIO_PA23) // SPI 1 Master Out Slave +#define AT91C_PIO_PA24 ((unsigned int) 1 << 24) // Pin Controlled by PA24 +#define AT91C_PA24_RD ((unsigned int) AT91C_PIO_PA24) // SSC Receive Data +#define AT91C_PA24_SPI1_MISO ((unsigned int) AT91C_PIO_PA24) // SPI 1 Master In Slave +#define AT91C_PIO_PA25 ((unsigned int) 1 << 25) // Pin Controlled by PA25 +#define AT91C_PA25_RK ((unsigned int) AT91C_PIO_PA25) // SSC Receive Clock +#define AT91C_PA25_SPI1_NPCS1 ((unsigned int) AT91C_PIO_PA25) // SPI 1 Peripheral Chip Select 1 +#define AT91C_PIO_PA26 ((unsigned int) 1 << 26) // Pin Controlled by PA26 +#define AT91C_PA26_RF ((unsigned int) AT91C_PIO_PA26) // SSC Receive Frame Sync +#define AT91C_PA26_SPI1_NPCS2 ((unsigned int) AT91C_PIO_PA26) // SPI 1 Peripheral Chip Select 2 +#define AT91C_PIO_PA27 ((unsigned int) 1 << 27) // Pin Controlled by PA27 +#define AT91C_PA27_DRXD ((unsigned int) AT91C_PIO_PA27) // DBGU Debug Receive Data +#define AT91C_PA27_PCK3 ((unsigned int) AT91C_PIO_PA27) // PMC Programmable Clock Output 3 +#define AT91C_PIO_PA28 ((unsigned int) 1 << 28) // Pin Controlled by PA28 +#define AT91C_PA28_DTXD ((unsigned int) AT91C_PIO_PA28) // DBGU Debug Transmit Data +#define AT91C_PIO_PA29 ((unsigned int) 1 << 29) // Pin Controlled by PA29 +#define AT91C_PA29_FIQ ((unsigned int) AT91C_PIO_PA29) // AIC Fast Interrupt Input +#define AT91C_PA29_SPI1_NPCS3 ((unsigned int) AT91C_PIO_PA29) // SPI 1 Peripheral Chip Select 3 +#define AT91C_PIO_PA3 ((unsigned int) 1 << 3) // Pin Controlled by PA3 +#define AT91C_PA3_RTS0 ((unsigned int) AT91C_PIO_PA3) // USART 0 Ready To Send +#define AT91C_PA3_SPI1_NPCS2 ((unsigned int) AT91C_PIO_PA3) // SPI 1 Peripheral Chip Select 2 +#define AT91C_PIO_PA30 ((unsigned int) 1 << 30) // Pin Controlled by PA30 +#define AT91C_PA30_IRQ0 ((unsigned int) AT91C_PIO_PA30) // External Interrupt 0 +#define AT91C_PA30_PCK2 ((unsigned int) AT91C_PIO_PA30) // PMC Programmable Clock Output 2 +#define AT91C_PIO_PA4 ((unsigned int) 1 << 4) // Pin Controlled by PA4 +#define AT91C_PA4_CTS0 ((unsigned int) AT91C_PIO_PA4) // USART 0 Clear To Send +#define AT91C_PA4_SPI1_NPCS3 ((unsigned int) AT91C_PIO_PA4) // SPI 1 Peripheral Chip Select 3 +#define AT91C_PIO_PA5 ((unsigned int) 1 << 5) // Pin Controlled by PA5 +#define AT91C_PA5_RXD1 ((unsigned int) AT91C_PIO_PA5) // USART 1 Receive Data +#define AT91C_PIO_PA6 ((unsigned int) 1 << 6) // Pin Controlled by PA6 +#define AT91C_PA6_TXD1 ((unsigned int) AT91C_PIO_PA6) // USART 1 Transmit Data +#define AT91C_PIO_PA7 ((unsigned int) 1 << 7) // Pin Controlled by PA7 +#define AT91C_PA7_SCK1 ((unsigned int) AT91C_PIO_PA7) // USART 1 Serial Clock +#define AT91C_PA7_SPI0_NPCS1 ((unsigned int) AT91C_PIO_PA7) // SPI 0 Peripheral Chip Select 1 +#define AT91C_PIO_PA8 ((unsigned int) 1 << 8) // Pin Controlled by PA8 +#define AT91C_PA8_RTS1 ((unsigned int) AT91C_PIO_PA8) // USART 1 Ready To Send +#define AT91C_PA8_SPI0_NPCS2 ((unsigned int) AT91C_PIO_PA8) // SPI 0 Peripheral Chip Select 2 +#define AT91C_PIO_PA9 ((unsigned int) 1 << 9) // Pin Controlled by PA9 +#define AT91C_PA9_CTS1 ((unsigned int) AT91C_PIO_PA9) // USART 1 Clear To Send +#define AT91C_PA9_SPI0_NPCS3 ((unsigned int) AT91C_PIO_PA9) // SPI 0 Peripheral Chip Select 3 +#define AT91C_PIO_PB0 ((unsigned int) 1 << 0) // Pin Controlled by PB0 +#define AT91C_PB0_ETXCK_EREFCK ((unsigned int) AT91C_PIO_PB0) // Ethernet MAC Transmit Clock/Reference Clock +#define AT91C_PB0_PCK0 ((unsigned int) AT91C_PIO_PB0) // PMC Programmable Clock Output 0 +#define AT91C_PIO_PB1 ((unsigned int) 1 << 1) // Pin Controlled by PB1 +#define AT91C_PB1_ETXEN ((unsigned int) AT91C_PIO_PB1) // Ethernet MAC Transmit Enable +#define AT91C_PIO_PB10 ((unsigned int) 1 << 10) // Pin Controlled by PB10 +#define AT91C_PB10_ETX2 ((unsigned int) AT91C_PIO_PB10) // Ethernet MAC Transmit Data 2 +#define AT91C_PB10_SPI1_NPCS1 ((unsigned int) AT91C_PIO_PB10) // SPI 1 Peripheral Chip Select 1 +#define AT91C_PIO_PB11 ((unsigned int) 1 << 11) // Pin Controlled by PB11 +#define AT91C_PB11_ETX3 ((unsigned int) AT91C_PIO_PB11) // Ethernet MAC Transmit Data 3 +#define AT91C_PB11_SPI1_NPCS2 ((unsigned int) AT91C_PIO_PB11) // SPI 1 Peripheral Chip Select 2 +#define AT91C_PIO_PB12 ((unsigned int) 1 << 12) // Pin Controlled by PB12 +#define AT91C_PB12_ETXER ((unsigned int) AT91C_PIO_PB12) // Ethernet MAC Transmikt Coding Error +#define AT91C_PB12_TCLK0 ((unsigned int) AT91C_PIO_PB12) // Timer Counter 0 external clock input +#define AT91C_PIO_PB13 ((unsigned int) 1 << 13) // Pin Controlled by PB13 +#define AT91C_PB13_ERX2 ((unsigned int) AT91C_PIO_PB13) // Ethernet MAC Receive Data 2 +#define AT91C_PB13_SPI0_NPCS1 ((unsigned int) AT91C_PIO_PB13) // SPI 0 Peripheral Chip Select 1 +#define AT91C_PIO_PB14 ((unsigned int) 1 << 14) // Pin Controlled by PB14 +#define AT91C_PB14_ERX3 ((unsigned int) AT91C_PIO_PB14) // Ethernet MAC Receive Data 3 +#define AT91C_PB14_SPI0_NPCS2 ((unsigned int) AT91C_PIO_PB14) // SPI 0 Peripheral Chip Select 2 +#define AT91C_PIO_PB15 ((unsigned int) 1 << 15) // Pin Controlled by PB15 +#define AT91C_PB15_ERXDV_ECRSDV ((unsigned int) AT91C_PIO_PB15) // Ethernet MAC Receive Data Valid +#define AT91C_PIO_PB16 ((unsigned int) 1 << 16) // Pin Controlled by PB16 +#define AT91C_PB16_ECOL ((unsigned int) AT91C_PIO_PB16) // Ethernet MAC Collision Detected +#define AT91C_PB16_SPI1_NPCS3 ((unsigned int) AT91C_PIO_PB16) // SPI 1 Peripheral Chip Select 3 +#define AT91C_PIO_PB17 ((unsigned int) 1 << 17) // Pin Controlled by PB17 +#define AT91C_PB17_ERXCK ((unsigned int) AT91C_PIO_PB17) // Ethernet MAC Receive Clock +#define AT91C_PB17_SPI0_NPCS3 ((unsigned int) AT91C_PIO_PB17) // SPI 0 Peripheral Chip Select 3 +#define AT91C_PIO_PB18 ((unsigned int) 1 << 18) // Pin Controlled by PB18 +#define AT91C_PB18_EF100 ((unsigned int) AT91C_PIO_PB18) // Ethernet MAC Force 100 Mbits/sec +#define AT91C_PB18_ADTRG ((unsigned int) AT91C_PIO_PB18) // ADC External Trigger +#define AT91C_PIO_PB19 ((unsigned int) 1 << 19) // Pin Controlled by PB19 +#define AT91C_PB19_PWM0 ((unsigned int) AT91C_PIO_PB19) // PWM Channel 0 +#define AT91C_PB19_TCLK1 ((unsigned int) AT91C_PIO_PB19) // Timer Counter 1 external clock input +#define AT91C_PIO_PB2 ((unsigned int) 1 << 2) // Pin Controlled by PB2 +#define AT91C_PB2_ETX0 ((unsigned int) AT91C_PIO_PB2) // Ethernet MAC Transmit Data 0 +#define AT91C_PIO_PB20 ((unsigned int) 1 << 20) // Pin Controlled by PB20 +#define AT91C_PB20_PWM1 ((unsigned int) AT91C_PIO_PB20) // PWM Channel 1 +#define AT91C_PB20_PCK0 ((unsigned int) AT91C_PIO_PB20) // PMC Programmable Clock Output 0 +#define AT91C_PIO_PB21 ((unsigned int) 1 << 21) // Pin Controlled by PB21 +#define AT91C_PB21_PWM2 ((unsigned int) AT91C_PIO_PB21) // PWM Channel 2 +#define AT91C_PB21_PCK1 ((unsigned int) AT91C_PIO_PB21) // PMC Programmable Clock Output 1 +#define AT91C_PIO_PB22 ((unsigned int) 1 << 22) // Pin Controlled by PB22 +#define AT91C_PB22_PWM3 ((unsigned int) AT91C_PIO_PB22) // PWM Channel 3 +#define AT91C_PB22_PCK2 ((unsigned int) AT91C_PIO_PB22) // PMC Programmable Clock Output 2 +#define AT91C_PIO_PB23 ((unsigned int) 1 << 23) // Pin Controlled by PB23 +#define AT91C_PB23_TIOA0 ((unsigned int) AT91C_PIO_PB23) // Timer Counter 0 Multipurpose Timer I/O Pin A +#define AT91C_PB23_DCD1 ((unsigned int) AT91C_PIO_PB23) // USART 1 Data Carrier Detect +#define AT91C_PIO_PB24 ((unsigned int) 1 << 24) // Pin Controlled by PB24 +#define AT91C_PB24_TIOB0 ((unsigned int) AT91C_PIO_PB24) // Timer Counter 0 Multipurpose Timer I/O Pin B +#define AT91C_PB24_DSR1 ((unsigned int) AT91C_PIO_PB24) // USART 1 Data Set ready +#define AT91C_PIO_PB25 ((unsigned int) 1 << 25) // Pin Controlled by PB25 +#define AT91C_PB25_TIOA1 ((unsigned int) AT91C_PIO_PB25) // Timer Counter 1 Multipurpose Timer I/O Pin A +#define AT91C_PB25_DTR1 ((unsigned int) AT91C_PIO_PB25) // USART 1 Data Terminal ready +#define AT91C_PIO_PB26 ((unsigned int) 1 << 26) // Pin Controlled by PB26 +#define AT91C_PB26_TIOB1 ((unsigned int) AT91C_PIO_PB26) // Timer Counter 1 Multipurpose Timer I/O Pin B +#define AT91C_PB26_RI1 ((unsigned int) AT91C_PIO_PB26) // USART 1 Ring Indicator +#define AT91C_PIO_PB27 ((unsigned int) 1 << 27) // Pin Controlled by PB27 +#define AT91C_PB27_TIOA2 ((unsigned int) AT91C_PIO_PB27) // Timer Counter 2 Multipurpose Timer I/O Pin A +#define AT91C_PB27_PWM0 ((unsigned int) AT91C_PIO_PB27) // PWM Channel 0 +#define AT91C_PIO_PB28 ((unsigned int) 1 << 28) // Pin Controlled by PB28 +#define AT91C_PB28_TIOB2 ((unsigned int) AT91C_PIO_PB28) // Timer Counter 2 Multipurpose Timer I/O Pin B +#define AT91C_PB28_PWM1 ((unsigned int) AT91C_PIO_PB28) // PWM Channel 1 +#define AT91C_PIO_PB29 ((unsigned int) 1 << 29) // Pin Controlled by PB29 +#define AT91C_PB29_PCK1 ((unsigned int) AT91C_PIO_PB29) // PMC Programmable Clock Output 1 +#define AT91C_PB29_PWM2 ((unsigned int) AT91C_PIO_PB29) // PWM Channel 2 +#define AT91C_PIO_PB3 ((unsigned int) 1 << 3) // Pin Controlled by PB3 +#define AT91C_PB3_ETX1 ((unsigned int) AT91C_PIO_PB3) // Ethernet MAC Transmit Data 1 +#define AT91C_PIO_PB30 ((unsigned int) 1 << 30) // Pin Controlled by PB30 +#define AT91C_PB30_PCK2 ((unsigned int) AT91C_PIO_PB30) // PMC Programmable Clock Output 2 +#define AT91C_PB30_PWM3 ((unsigned int) AT91C_PIO_PB30) // PWM Channel 3 +#define AT91C_PIO_PB4 ((unsigned int) 1 << 4) // Pin Controlled by PB4 +#define AT91C_PB4_ECRS ((unsigned int) AT91C_PIO_PB4) // Ethernet MAC Carrier Sense/Carrier Sense and Data Valid +#define AT91C_PIO_PB5 ((unsigned int) 1 << 5) // Pin Controlled by PB5 +#define AT91C_PB5_ERX0 ((unsigned int) AT91C_PIO_PB5) // Ethernet MAC Receive Data 0 +#define AT91C_PIO_PB6 ((unsigned int) 1 << 6) // Pin Controlled by PB6 +#define AT91C_PB6_ERX1 ((unsigned int) AT91C_PIO_PB6) // Ethernet MAC Receive Data 1 +#define AT91C_PIO_PB7 ((unsigned int) 1 << 7) // Pin Controlled by PB7 +#define AT91C_PB7_ERXER ((unsigned int) AT91C_PIO_PB7) // Ethernet MAC Receive Error +#define AT91C_PIO_PB8 ((unsigned int) 1 << 8) // Pin Controlled by PB8 +#define AT91C_PB8_EMDC ((unsigned int) AT91C_PIO_PB8) // Ethernet MAC Management Data Clock +#define AT91C_PIO_PB9 ((unsigned int) 1 << 9) // Pin Controlled by PB9 +#define AT91C_PB9_EMDIO ((unsigned int) AT91C_PIO_PB9) // Ethernet MAC Management Data Input/Output + +// ***************************************************************************** +// PERIPHERAL ID DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** +#define AT91C_ID_FIQ ((unsigned int) 0) // Advanced Interrupt Controller (FIQ) +#define AT91C_ID_SYS ((unsigned int) 1) // System Peripheral +#define AT91C_ID_PIOA ((unsigned int) 2) // Parallel IO Controller A +#define AT91C_ID_PIOB ((unsigned int) 3) // Parallel IO Controller B +#define AT91C_ID_SPI0 ((unsigned int) 4) // Serial Peripheral Interface 0 +#define AT91C_ID_SPI1 ((unsigned int) 5) // Serial Peripheral Interface 1 +#define AT91C_ID_US0 ((unsigned int) 6) // USART 0 +#define AT91C_ID_US1 ((unsigned int) 7) // USART 1 +#define AT91C_ID_SSC ((unsigned int) 8) // Serial Synchronous Controller +#define AT91C_ID_TWI ((unsigned int) 9) // Two-Wire Interface +#define AT91C_ID_PWMC ((unsigned int) 10) // PWM Controller +#define AT91C_ID_UDP ((unsigned int) 11) // USB Device Port +#define AT91C_ID_TC0 ((unsigned int) 12) // Timer Counter 0 +#define AT91C_ID_TC1 ((unsigned int) 13) // Timer Counter 1 +#define AT91C_ID_TC2 ((unsigned int) 14) // Timer Counter 2 +#define AT91C_ID_CAN ((unsigned int) 15) // Control Area Network Controller +#define AT91C_ID_EMAC ((unsigned int) 16) // Ethernet MAC +#define AT91C_ID_ADC ((unsigned int) 17) // Analog-to-Digital Converter +#define AT91C_ID_18_Reserved ((unsigned int) 18) // Reserved +#define AT91C_ID_19_Reserved ((unsigned int) 19) // Reserved +#define AT91C_ID_20_Reserved ((unsigned int) 20) // Reserved +#define AT91C_ID_21_Reserved ((unsigned int) 21) // Reserved +#define AT91C_ID_22_Reserved ((unsigned int) 22) // Reserved +#define AT91C_ID_23_Reserved ((unsigned int) 23) // Reserved +#define AT91C_ID_24_Reserved ((unsigned int) 24) // Reserved +#define AT91C_ID_25_Reserved ((unsigned int) 25) // Reserved +#define AT91C_ID_26_Reserved ((unsigned int) 26) // Reserved +#define AT91C_ID_27_Reserved ((unsigned int) 27) // Reserved +#define AT91C_ID_28_Reserved ((unsigned int) 28) // Reserved +#define AT91C_ID_29_Reserved ((unsigned int) 29) // Reserved +#define AT91C_ID_IRQ0 ((unsigned int) 30) // Advanced Interrupt Controller (IRQ0) +#define AT91C_ID_IRQ1 ((unsigned int) 31) // Advanced Interrupt Controller (IRQ1) +#define AT91C_ALL_INT ((unsigned int) 0xC003FFFF) // ALL VALID INTERRUPTS + +// ***************************************************************************** +// BASE ADDRESS DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** + +#ifdef TEST + +extern AT91S_AIC AicPeripheral; +extern AT91S_PIO PioAPeripheral; +extern AT91S_PIO PioBPeripheral; +extern AT91S_PMC PmcPeripheral; +extern AT91S_USART Usart0Peripheral; +extern AT91S_TC TimerCounter0Peripheral; +extern AT91S_ADC AdcPeripheral; + +#define AIC_ADDR &AicPeripheral +#define PIOA_ADDR &PioAPeripheral +#define PIOB_ADDR &PioBPeripheral +#define PMC_ADDR &PmcPeripheral +#define US0_ADDR &Usart0Peripheral +#define TC0_ADDR &TimerCounter0Peripheral +#define ADC_ADDR &AdcPeripheral + +#else + +#define AIC_ADDR 0xFFFFF000 +#define PIOA_ADDR 0xFFFFF400 +#define PIOB_ADDR 0xFFFFF600 +#define PMC_ADDR 0xFFFFFC00 +#define US0_ADDR 0xFFFC0000 +#define TC0_ADDR 0xFFFA0000 +#define ADC_ADDR 0xFFFD8000 + +#endif // TEST + +#define AT91C_BASE_SYS ((AT91PS_SYS) 0xFFFFF000) // (SYS) Base Address +#define AT91C_BASE_AIC ((AT91PS_AIC) AIC_ADDR) // (AIC) Base Address +#define AT91C_BASE_PDC_DBGU ((AT91PS_PDC) 0xFFFFF300) // (PDC_DBGU) Base Address +#define AT91C_BASE_DBGU ((AT91PS_DBGU) 0xFFFFF200) // (DBGU) Base Address +#define AT91C_BASE_PIOA ((AT91PS_PIO) PIOA_ADDR) // (PIOA) Base Address +#define AT91C_BASE_PIOB ((AT91PS_PIO) PIOB_ADDR) // (PIOB) Base Address +#define AT91C_BASE_PMC ((AT91PS_PMC) PMC_ADDR) // (PMC) Base Address +#define AT91C_BASE_CKGR ((AT91PS_CKGR) 0xFFFFFC20) // (CKGR) Base Address +#define AT91C_BASE_RSTC ((AT91PS_RSTC) 0xFFFFFD00) // (RSTC) Base Address +#define AT91C_BASE_RTTC ((AT91PS_RTTC) 0xFFFFFD20) // (RTTC) Base Address +#define AT91C_BASE_PITC ((AT91PS_PITC) 0xFFFFFD30) // (PITC) Base Address +#define AT91C_BASE_WDTC ((AT91PS_WDTC) 0xFFFFFD40) // (WDTC) Base Address +#define AT91C_BASE_VREG ((AT91PS_VREG) 0xFFFFFD60) // (VREG) Base Address +#define AT91C_BASE_MC ((AT91PS_MC) 0xFFFFFF00) // (MC) Base Address +#define AT91C_BASE_PDC_SPI1 ((AT91PS_PDC) 0xFFFE4100) // (PDC_SPI1) Base Address +#define AT91C_BASE_SPI1 ((AT91PS_SPI) 0xFFFE4000) // (SPI1) Base Address +#define AT91C_BASE_PDC_SPI0 ((AT91PS_PDC) 0xFFFE0100) // (PDC_SPI0) Base Address +#define AT91C_BASE_SPI0 ((AT91PS_SPI) 0xFFFE0000) // (SPI0) Base Address +#define AT91C_BASE_PDC_US1 ((AT91PS_PDC) 0xFFFC4100) // (PDC_US1) Base Address +#define AT91C_BASE_US1 ((AT91PS_USART) 0xFFFC4000) // (US1) Base Address +#define AT91C_BASE_PDC_US0 ((AT91PS_PDC) 0xFFFC0100) // (PDC_US0) Base Address +#define AT91C_BASE_US0 ((AT91PS_USART) US0_ADDR) // (US0) Base Address +#define AT91C_BASE_PDC_SSC ((AT91PS_PDC) 0xFFFD4100) // (PDC_SSC) Base Address +#define AT91C_BASE_SSC ((AT91PS_SSC) 0xFFFD4000) // (SSC) Base Address +#define AT91C_BASE_TWI ((AT91PS_TWI) 0xFFFB8000) // (TWI) Base Address +#define AT91C_BASE_PWMC_CH3 ((AT91PS_PWMC_CH) 0xFFFCC260) // (PWMC_CH3) Base Address +#define AT91C_BASE_PWMC_CH2 ((AT91PS_PWMC_CH) 0xFFFCC240) // (PWMC_CH2) Base Address +#define AT91C_BASE_PWMC_CH1 ((AT91PS_PWMC_CH) 0xFFFCC220) // (PWMC_CH1) Base Address +#define AT91C_BASE_PWMC_CH0 ((AT91PS_PWMC_CH) 0xFFFCC200) // (PWMC_CH0) Base Address +#define AT91C_BASE_PWMC ((AT91PS_PWMC) 0xFFFCC000) // (PWMC) Base Address +#define AT91C_BASE_UDP ((AT91PS_UDP) 0xFFFB0000) // (UDP) Base Address +#define AT91C_BASE_TC0 ((AT91PS_TC) TC0_ADDR) // (TC0) Base Address +#define AT91C_BASE_TC1 ((AT91PS_TC) 0xFFFA0040) // (TC1) Base Address +#define AT91C_BASE_TC2 ((AT91PS_TC) 0xFFFA0080) // (TC2) Base Address +#define AT91C_BASE_TCB ((AT91PS_TCB) 0xFFFA0000) // (TCB) Base Address +#define AT91C_BASE_CAN_MB0 ((AT91PS_CAN_MB) 0xFFFD0200) // (CAN_MB0) Base Address +#define AT91C_BASE_CAN_MB1 ((AT91PS_CAN_MB) 0xFFFD0220) // (CAN_MB1) Base Address +#define AT91C_BASE_CAN_MB2 ((AT91PS_CAN_MB) 0xFFFD0240) // (CAN_MB2) Base Address +#define AT91C_BASE_CAN_MB3 ((AT91PS_CAN_MB) 0xFFFD0260) // (CAN_MB3) Base Address +#define AT91C_BASE_CAN_MB4 ((AT91PS_CAN_MB) 0xFFFD0280) // (CAN_MB4) Base Address +#define AT91C_BASE_CAN_MB5 ((AT91PS_CAN_MB) 0xFFFD02A0) // (CAN_MB5) Base Address +#define AT91C_BASE_CAN_MB6 ((AT91PS_CAN_MB) 0xFFFD02C0) // (CAN_MB6) Base Address +#define AT91C_BASE_CAN_MB7 ((AT91PS_CAN_MB) 0xFFFD02E0) // (CAN_MB7) Base Address +#define AT91C_BASE_CAN ((AT91PS_CAN) 0xFFFD0000) // (CAN) Base Address +#define AT91C_BASE_ADC ((AT91PS_ADC) ADC_ADDR) // (ADC) Base Address +#define AT91C_BASE_EMAC ((AT91PS_EMAC) 0xFFFDC000) // (EMAC) Base Address +#define AT91C_BASE_PDC_ADC ((AT91PS_PDC) 0xFFFD8100) // (PDC_ADC) Base Address + +// ***************************************************************************** +// MEMORY MAPPING DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** +// ISRAM +#define AT91C_ISRAM ((char *) 0x00200000) // Internal SRAM base address +#define AT91C_ISRAM_SIZE ((unsigned int) 0x00010000) // Internal SRAM size in byte (64 Kbytes) +// IFLASH +#define AT91C_IFLASH ((char *) 0x00100000) // Internal FLASH base address +#define AT91C_IFLASH_SIZE ((unsigned int) 0x00040000) // Internal FLASH size in byte (256 Kbytes) +#define AT91C_IFLASH_PAGE_SIZE ((unsigned int) 256) // Internal FLASH Page Size: 256 bytes +#define AT91C_IFLASH_LOCK_REGION_SIZE ((unsigned int) 16384) // Internal FLASH Lock Region Size: 16 Kbytes +#define AT91C_IFLASH_NB_OF_PAGES ((unsigned int) 1024) // Internal FLASH Number of Pages: 1024 bytes +#define AT91C_IFLASH_NB_OF_LOCK_BITS ((unsigned int) 16) // Internal FLASH Number of Lock Bits: 16 bytes + +#endif diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/AdcConductor.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/AdcConductor.c new file mode 100644 index 0000000..28d9d20 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/AdcConductor.c @@ -0,0 +1,42 @@ +#include "Types.h" +#include "AdcConductor.h" +#include "AdcModel.h" +#include "AdcHardware.h" + +void AdcConductor_Init(void) +{ + AdcHardware_Init(); +} + +void AdcConductor_Run(void) +{ + if (AdcModel_DoGetSample() && AdcHardware_GetSampleComplete()) + { + AdcModel_ProcessInput(AdcHardware_GetSample()); + AdcHardware_StartConversion(); + } +} + +bool AdcConductor_JustHereToTest(void) +{ + EXAMPLE_STRUCT_T ExampleStruct; + ExampleStruct.x = 5; + ExampleStruct.y = 7; + + return AdcModel_DoNothingExceptTestASpecialType(ExampleStruct); +} + +bool AdcConductor_AlsoHereToTest(void) +{ + EXAMPLE_STRUCT_T example = AdcModel_DoNothingExceptReturnASpecialType(); + + return ((example.x == 99) && (example.y == 1)); +} + +bool AdcConductor_YetAnotherTest(void) +{ + uint32 example = 3; + + return AdModel_DoNothingExceptTestPointers(&example); +} + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/AdcConductor.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/AdcConductor.h new file mode 100644 index 0000000..4280da3 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/AdcConductor.h @@ -0,0 +1,11 @@ +#ifndef _ADCCONDUCTOR_H +#define _ADCCONDUCTOR_H + +void AdcConductor_Init(void); +void AdcConductor_Run(void); + +bool AdcConductor_JustHereToTest(void); +bool AdcConductor_AlsoHereToTest(void); +bool AdcConductor_YetAnotherTest(void); + +#endif // _ADCCONDUCTOR_H diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/AdcHardware.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/AdcHardware.c new file mode 100644 index 0000000..9807641 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/AdcHardware.c @@ -0,0 +1,27 @@ +#include "Types.h" +#include "AdcHardware.h" +#include "AdcHardwareConfigurator.h" +#include "AdcTemperatureSensor.h" + +void AdcHardware_Init(void) +{ + Adc_Reset(); + Adc_ConfigureMode(); + Adc_EnableTemperatureChannel(); + Adc_StartTemperatureSensorConversion(); +} + +void AdcHardware_StartConversion(void) +{ + Adc_StartTemperatureSensorConversion(); +} + +bool AdcHardware_GetSampleComplete(void) +{ + return Adc_TemperatureSensorSampleReady(); +} + +uint16 AdcHardware_GetSample(void) +{ + return Adc_ReadTemperatureSensor(); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/AdcHardware.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/AdcHardware.h new file mode 100644 index 0000000..3209a4c --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/AdcHardware.h @@ -0,0 +1,9 @@ +#ifndef _ADCHARDWARE_H +#define _ADCHARDWARE_H + +void AdcHardware_Init(void); +void AdcHardware_StartConversion(void); +bool AdcHardware_GetSampleComplete(void); +uint16 AdcHardware_GetSample(void); + +#endif // _ADCHARDWARE_H diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/AdcHardwareConfigurator.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/AdcHardwareConfigurator.c new file mode 100644 index 0000000..f7e08a2 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/AdcHardwareConfigurator.c @@ -0,0 +1,18 @@ +#include "Types.h" +#include "AdcHardwareConfigurator.h" +#include "ModelConfig.h" + +void Adc_Reset(void) +{ + AT91C_BASE_ADC->ADC_CR = AT91C_ADC_SWRST; +} + +void Adc_ConfigureMode(void) +{ + AT91C_BASE_ADC->ADC_MR = (((uint32)11) << 8) | (((uint32)4) << 16); +} + +void Adc_EnableTemperatureChannel(void) +{ + AT91C_BASE_ADC->ADC_CHER = 0x10; +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/AdcHardwareConfigurator.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/AdcHardwareConfigurator.h new file mode 100644 index 0000000..78b9e9f --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/AdcHardwareConfigurator.h @@ -0,0 +1,10 @@ +#ifndef _ADCHARDWARECONFIGURATOR_H +#define _ADCHARDWARECONFIGURATOR_H + +#include "Types.h" + +void Adc_Reset(void); +void Adc_ConfigureMode(void); +void Adc_EnableTemperatureChannel(void); + +#endif // _ADCHARDWARECONFIGURATOR_H diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/AdcModel.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/AdcModel.c new file mode 100644 index 0000000..ad9111d --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/AdcModel.c @@ -0,0 +1,33 @@ +#include "AdcModel.h" +#include "TaskScheduler.h" +#include "TemperatureCalculator.h" +#include "TemperatureFilter.h" + +bool AdcModel_DoGetSample(void) +{ + return TaskScheduler_DoAdc(); +} + +void AdcModel_ProcessInput(uint16 millivolts) +{ + TemperatureFilter_ProcessInput(TemperatureCalculator_Calculate(millivolts)); +} + +bool AdcModel_DoNothingExceptTestASpecialType(EXAMPLE_STRUCT_T ExampleStruct) +{ + //This doesn't really do anything. it's only here to make sure I can compare a struct. + return FALSE; +} +bool AdModel_DoNothingExceptTestPointers(uint32* pExample) +{ + //This doesn't really do anything. it's only here to make sure I can compare a pointer value. + return FALSE; +} + +EXAMPLE_STRUCT_T AdcModel_DoNothingExceptReturnASpecialType(void) +{ + EXAMPLE_STRUCT_T example; //again, this just is here to test that I can return a struct + example.x = 99; + example.y = 1; + return example; +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/AdcModel.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/AdcModel.h new file mode 100644 index 0000000..6b871fd --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/AdcModel.h @@ -0,0 +1,13 @@ +#ifndef _ADCMODEL_H +#define _ADCMODEL_H + +#include "Types.h" + +bool AdcModel_DoGetSample(void); +void AdcModel_ProcessInput(uint16 millivolts); + +bool AdcModel_DoNothingExceptTestASpecialType(EXAMPLE_STRUCT_T ExampleStruct); +bool AdModel_DoNothingExceptTestPointers(uint32* pExample); +EXAMPLE_STRUCT_T AdcModel_DoNothingExceptReturnASpecialType(void); + +#endif // _ADCMODEL_H diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/AdcTemperatureSensor.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/AdcTemperatureSensor.c new file mode 100644 index 0000000..b2a3f2c --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/AdcTemperatureSensor.c @@ -0,0 +1,51 @@ +#include "Types.h" +#include "AdcTemperatureSensor.h" + +static inline uint32 ConvertAdcCountsToPicovolts(uint32 counts); +static inline uint16 ConvertPicovoltsToMillivolts(uint32 picovolts); + +// +// PUBLIC METHODS +// + +void Adc_StartTemperatureSensorConversion(void) +{ + AT91C_BASE_ADC->ADC_CR = AT91C_ADC_START; +} + +bool Adc_TemperatureSensorSampleReady(void) +{ + return ((AT91C_BASE_ADC->ADC_SR & AT91C_ADC_EOC4) == AT91C_ADC_EOC4); +} + +uint16 Adc_ReadTemperatureSensor(void) +{ + uint32 picovolts = ConvertAdcCountsToPicovolts(AT91C_BASE_ADC->ADC_CDR4); + return ConvertPicovoltsToMillivolts(picovolts); +} + +// +// PRIVATE HELPERS +// + +static inline uint32 ConvertAdcCountsToPicovolts(uint32 counts) +{ + // ADC bit weight at 10-bit resolution with 3.0V reference = 2.9296875 mV/LSB + uint32 picovoltsPerAdcCount = 2929688; + + // Shift decimal point by 6 places to preserve accuracy in fixed-point math + return counts * picovoltsPerAdcCount; +} + +static inline uint16 ConvertPicovoltsToMillivolts(uint32 picovolts) +{ + const uint32 halfMillivoltInPicovolts = 500000; + const uint32 picovoltsPerMillivolt = 1000000; + + // Add 0.5 mV to result so that truncation yields properly rounded result + picovolts += halfMillivoltInPicovolts; + + // Divide appropriately to convert to millivolts + return (uint16)(picovolts / picovoltsPerMillivolt); +} + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/AdcTemperatureSensor.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/AdcTemperatureSensor.h new file mode 100644 index 0000000..bf2cc5b --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/AdcTemperatureSensor.h @@ -0,0 +1,10 @@ +#ifndef _ADCTEMPERATURESENSOR_H +#define _ADCTEMPERATURESENSOR_H + +#include "Types.h" + +void Adc_StartTemperatureSensorConversion(void); +bool Adc_TemperatureSensorSampleReady(void); +uint16 Adc_ReadTemperatureSensor(void); + +#endif // _ADCTEMPERATURESENSOR_H diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/Executor.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/Executor.c new file mode 100644 index 0000000..7e45c3e --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/Executor.c @@ -0,0 +1,25 @@ +#include "Types.h" +#include "Executor.h" +#include "Model.h" +#include "UsartConductor.h" +#include "TimerConductor.h" +#include "AdcConductor.h" +#include "IntrinsicsWrapper.h" + + +void Executor_Init(void) +{ + Model_Init(); + UsartConductor_Init(); + AdcConductor_Init(); + TimerConductor_Init(); + Interrupt_Enable(); +} + +bool Executor_Run(void) +{ + UsartConductor_Run(); + TimerConductor_Run(); + AdcConductor_Run(); + return TRUE; +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/Executor.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/Executor.h new file mode 100644 index 0000000..51a61a9 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/Executor.h @@ -0,0 +1,9 @@ +#ifndef _EXECUTOR_H +#define _EXECUTOR_H + +#include "Types.h" + +void Executor_Init(void); +bool Executor_Run(void); + +#endif // _EXECUTOR_H diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/IntrinsicsWrapper.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/IntrinsicsWrapper.c new file mode 100644 index 0000000..8b082ae --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/IntrinsicsWrapper.c @@ -0,0 +1,18 @@ +#include "IntrinsicsWrapper.h" +#ifdef __ICCARM__ +#include +#endif + +void Interrupt_Enable(void) +{ +#ifdef __ICCARM__ + __enable_interrupt(); +#endif +} + +void Interrupt_Disable(void) +{ +#ifdef __ICCARM__ + __disable_interrupt(); +#endif +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/IntrinsicsWrapper.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/IntrinsicsWrapper.h new file mode 100644 index 0000000..9273317 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/IntrinsicsWrapper.h @@ -0,0 +1,7 @@ +#ifndef _INTRINSICS_WRAPPER_H +#define _INTRINSICS_WRAPPER_H + +void Interrupt_Enable(void); +void Interrupt_Disable(void); + +#endif // _INTRINSICS_WRAPPER_H diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/Main.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/Main.c new file mode 100644 index 0000000..a784f47 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/Main.c @@ -0,0 +1,46 @@ +#include "Types.h" + +#include "IntrinsicsWrapper.h" +#include "Executor.h" + +#include "Model.h" +#include "TaskScheduler.h" +#include "TemperatureCalculator.h" +#include "TemperatureFilter.h" + +#include "UsartConductor.h" +#include "UsartHardware.h" +#include "UsartConfigurator.h" +#include "UsartPutChar.h" +#include "UsartModel.h" +#include "UsartBaudRateRegisterCalculator.h" +#include "UsartTransmitBufferStatus.h" + +#include "TimerConductor.h" +#include "TimerHardware.h" +#include "TimerConfigurator.h" +#include "TimerInterruptConfigurator.h" +#include "TimerInterruptHandler.h" +#include "TimerModel.h" + +#include "AdcConductor.h" +#include "AdcHardware.h" +#include "AdcHardwareConfigurator.h" +#include "AdcTemperatureSensor.h" +#include "AdcModel.h" + +int AppMain(void) +{ + Executor_Init(); + + while(Executor_Run()); + + return 0; +} + +#ifndef TEST +int main(void) +{ + return AppMain(); +} +#endif // TEST diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/Main.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/Main.h new file mode 100644 index 0000000..6cbe5f4 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/Main.h @@ -0,0 +1,7 @@ +#ifndef _MAIN_H_ +#define _MAIN_H_ + +int AppMain(void); +int main(void); + +#endif // _MAIN_H_ diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/Model.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/Model.c new file mode 100644 index 0000000..5b34c40 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/Model.c @@ -0,0 +1,10 @@ +#include "Model.h" +#include "TaskScheduler.h" +#include "TemperatureFilter.h" + +void Model_Init(void) +{ + TaskScheduler_Init(); + TemperatureFilter_Init(); +} + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/Model.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/Model.h new file mode 100644 index 0000000..d130938 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/Model.h @@ -0,0 +1,8 @@ +#ifndef _MODEL_H +#define _MODEL_H + +#include "Types.h" + +void Model_Init(void); + +#endif // _MODEL_H diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/ModelConfig.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/ModelConfig.h new file mode 100644 index 0000000..edc8e8d --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/ModelConfig.h @@ -0,0 +1,7 @@ +#ifndef _MODELCONFIG_H +#define _MODELCONFIG_H + +#define MASTER_CLOCK 48054857 // Master Clock +#define USART0_BAUDRATE 115200 // USART Baudrate + +#endif // _MODELCONFIG_H diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/TaskScheduler.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/TaskScheduler.c new file mode 100644 index 0000000..bcc0e64 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/TaskScheduler.c @@ -0,0 +1,72 @@ +#include "Types.h" +#include "TaskScheduler.h" + +typedef struct _Task +{ + bool doIt; + uint32 period; + uint32 startTime; +} Task; + +typedef struct _TaskSchedulerInstance +{ + Task usart; + Task adc; +} TaskSchedulerInstance; + +static TaskSchedulerInstance this; + +void TaskScheduler_Init(void) +{ + this.usart.doIt = FALSE; + this.usart.startTime = 0; + + //The correct period + this.usart.period = 1000; + + this.adc.doIt = FALSE; + this.adc.startTime = 0; + this.adc.period = 100; +} + +void TaskScheduler_Update(uint32 time) +{ + if ((time - this.usart.startTime) >= this.usart.period) + { + this.usart.doIt = TRUE; + this.usart.startTime = time - (time % this.usart.period); + } + + if ((time - this.adc.startTime) >= this.adc.period) + { + this.adc.doIt = TRUE; + this.adc.startTime = time - (time % this.adc.period); + } +} + +bool TaskScheduler_DoUsart(void) +{ + bool doIt = FALSE; + + if (this.usart.doIt) + { + doIt = TRUE; + this.usart.doIt = FALSE; + } + + return doIt; +} + +bool TaskScheduler_DoAdc(void) +{ + bool doIt = FALSE; + + if (this.adc.doIt) + { + doIt = TRUE; + this.adc.doIt = FALSE; + } + + return doIt; +} + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/TaskScheduler.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/TaskScheduler.h new file mode 100644 index 0000000..cc58342 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/TaskScheduler.h @@ -0,0 +1,11 @@ +#ifndef _TASKSCHEDULER_H +#define _TASKSCHEDULER_H + +#include "Types.h" + +void TaskScheduler_Init(void); +void TaskScheduler_Update(uint32 time); +bool TaskScheduler_DoUsart(void); +bool TaskScheduler_DoAdc(void); + +#endif // _TASKSCHEDULER_H diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/TemperatureCalculator.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/TemperatureCalculator.c new file mode 100644 index 0000000..04cec59 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/TemperatureCalculator.c @@ -0,0 +1,27 @@ +#include "Types.h" +#include "TemperatureCalculator.h" +#include + +#ifndef logl +#define logl log +#endif + +float TemperatureCalculator_Calculate(uint16 millivolts) +{ + const double supply_voltage = 3.0; + const double series_resistance = 5000; + const double coefficient_A = 316589.698; + const double coefficient_B = -0.1382009; + double sensor_voltage = ((double)millivolts / 1000); + double resistance; + + if (millivolts == 0) + { + return -INFINITY; + } + + // Series resistor is 5k Ohms; Reference voltage is 3.0V + // R(t) = A * e^(B*t); R is resistance of thermisor; t is temperature in C + resistance = ((supply_voltage * series_resistance) / sensor_voltage) - series_resistance; + return (float)(logl(resistance / coefficient_A) / coefficient_B); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/TemperatureCalculator.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/TemperatureCalculator.h new file mode 100644 index 0000000..b606c2d --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/TemperatureCalculator.h @@ -0,0 +1,6 @@ +#ifndef _TEMPERATURECALCULATOR_H +#define _TEMPERATURECALCULATOR_H + +float TemperatureCalculator_Calculate(uint16 millivolts); + +#endif // _TEMPERATURECALCULATOR_H diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/TemperatureFilter.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/TemperatureFilter.c new file mode 100644 index 0000000..02fc045 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/TemperatureFilter.c @@ -0,0 +1,39 @@ +#include "Types.h" +#include "TemperatureFilter.h" +#include + +static bool initialized; +static float temperatureInCelcius; + +void TemperatureFilter_Init(void) +{ + initialized = FALSE; + temperatureInCelcius = -INFINITY; +} + +float TemperatureFilter_GetTemperatureInCelcius(void) +{ + return temperatureInCelcius; +} + +void TemperatureFilter_ProcessInput(float temperature) +{ + if (!initialized) + { + temperatureInCelcius = temperature; + initialized = TRUE; + } + else + { + if (temperature == +INFINITY || + temperature == -INFINITY || + temperature == +NAN || + temperature == -NAN) + { + initialized = FALSE; + temperature = -INFINITY; + } + + temperatureInCelcius = (temperatureInCelcius * 0.75f) + (temperature * 0.25); + } +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/TemperatureFilter.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/TemperatureFilter.h new file mode 100644 index 0000000..31413f4 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/TemperatureFilter.h @@ -0,0 +1,10 @@ +#ifndef _TEMPERATUREFILTER_H +#define _TEMPERATUREFILTER_H + +#include "Types.h" + +void TemperatureFilter_Init(void); +float TemperatureFilter_GetTemperatureInCelcius(void); +void TemperatureFilter_ProcessInput(float temperature); + +#endif // _TEMPERATUREFILTER_H diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/TimerConductor.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/TimerConductor.c new file mode 100644 index 0000000..569b489 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/TimerConductor.c @@ -0,0 +1,15 @@ +#include "Types.h" +#include "TimerConductor.h" +#include "TimerModel.h" +#include "TimerHardware.h" +#include "TimerInterruptHandler.h" + +void TimerConductor_Init(void) +{ + TimerHardware_Init(); +} + +void TimerConductor_Run(void) +{ + TimerModel_UpdateTime(Timer_GetSystemTime()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/TimerConductor.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/TimerConductor.h new file mode 100644 index 0000000..7cd4109 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/TimerConductor.h @@ -0,0 +1,9 @@ +#ifndef _TIMERCONDUCTOR_H +#define _TIMERCONDUCTOR_H + +#include "Types.h" + +void TimerConductor_Init(void); +void TimerConductor_Run(void); + +#endif // _TIMERCONDUCTOR_H diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/TimerConfigurator.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/TimerConfigurator.c new file mode 100644 index 0000000..996cede --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/TimerConfigurator.c @@ -0,0 +1,51 @@ +#include "Types.h" +#include "TimerConfigurator.h" +#include "TimerInterruptConfigurator.h" + +void Timer_EnablePeripheralClocks(void) +{ + AT91C_BASE_PMC->PMC_PCER = TIMER0_CLOCK_ENABLE | PIOB_CLOCK_ENABLE; +} + +void Timer_Reset(void) +{ + uint32 dummy; + AT91C_BASE_TC0->TC_CCR = AT91C_TC_CLKDIS; + AT91C_BASE_TC0->TC_IDR = 0xffffffff; + dummy = AT91C_BASE_TC0->TC_SR; + dummy = dummy; +} + +void Timer_ConfigureMode(void) +{ + AT91C_BASE_TC0->TC_CMR = 0x000CC004; // ACPC=toggle TIOA on RC compare; mode=WAVE; WAVE_SEL=UP w/auto-trigger on RC compare; clock=MCK/1024 +} + +void Timer_ConfigurePeriod(void) +{ + AT91C_BASE_TC0->TC_RC = 469; // 10ms period for timer clock source of MCK/1024 with MCK=48054857 +} + +void Timer_EnableOutputPin(void) +{ + AT91C_BASE_PIOB->PIO_PDR = TIOA0_PIN_MASK; +} + +void Timer_Enable(void) +{ + AT91C_BASE_TC0->TC_CCR = AT91C_TC_CLKEN; +} + +void Timer_ConfigureInterruptHandler(void) +{ + Timer_DisableInterrupt(); + Timer_ResetSystemTime(); + Timer_ConfigureInterrupt(); + Timer_EnableInterrupt(); +} + +void Timer_Start(void) +{ + AT91C_BASE_TC0->TC_CCR = AT91C_TC_SWTRG; +} + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/TimerConfigurator.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/TimerConfigurator.h new file mode 100644 index 0000000..d078c54 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/TimerConfigurator.h @@ -0,0 +1,15 @@ +#ifndef _TIMERCONFIGURATOR_H +#define _TIMERCONFIGURATOR_H + +#include "Types.h" + +void Timer_EnablePeripheralClocks(void); +void Timer_Reset(void); +void Timer_ConfigureMode(void); +void Timer_ConfigurePeriod(void); +void Timer_EnableOutputPin(void); +void Timer_Enable(void); +void Timer_ConfigureInterruptHandler(void); +void Timer_Start(void); + +#endif // _TIMERCONFIGURATOR_H diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/TimerHardware.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/TimerHardware.c new file mode 100644 index 0000000..d5e983f --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/TimerHardware.c @@ -0,0 +1,15 @@ +#include "Types.h" +#include "TimerHardware.h" +#include "TimerConfigurator.h" + +void TimerHardware_Init(void) +{ + Timer_EnablePeripheralClocks(); + Timer_Reset(); + Timer_ConfigureMode(); + Timer_ConfigurePeriod(); + Timer_EnableOutputPin(); + Timer_Enable(); + Timer_ConfigureInterruptHandler(); + Timer_Start(); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/TimerHardware.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/TimerHardware.h new file mode 100644 index 0000000..92fa287 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/TimerHardware.h @@ -0,0 +1,8 @@ +#ifndef _TIMERHARDWARE_H +#define _TIMERHARDWARE_H + +#include "Types.h" + +void TimerHardware_Init(void); + +#endif // _TIMERHARDWARE_H diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/TimerInterruptConfigurator.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/TimerInterruptConfigurator.c new file mode 100644 index 0000000..fe603ef --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/TimerInterruptConfigurator.c @@ -0,0 +1,55 @@ +#include "Types.h" +#include "TimerInterruptConfigurator.h" +#include "TimerInterruptHandler.h" + +static inline void SetInterruptHandler(void); +static inline void ConfigureInterruptSourceModeRegister(void); +static inline void ClearInterrupt(void); +static inline void EnableCompareInterruptForRegisterC(void); + +void Timer_DisableInterrupt(void) +{ + AT91C_BASE_AIC->AIC_IDCR = TIMER0_ID_MASK; +} + +void Timer_ResetSystemTime(void) +{ + Timer_SetSystemTime(0); +} + +void Timer_ConfigureInterrupt(void) +{ + SetInterruptHandler(); + ConfigureInterruptSourceModeRegister(); + ClearInterrupt(); + EnableCompareInterruptForRegisterC(); +} + +void Timer_EnableInterrupt(void) +{ + AT91C_BASE_AIC->AIC_IECR = TIMER0_ID_MASK; +} + +// +// Helpers +// + +static inline void SetInterruptHandler(void) +{ + AT91C_BASE_AIC->AIC_SVR[AT91C_ID_TC0] = (uint32)Timer_InterruptHandler; +} + +static inline void ConfigureInterruptSourceModeRegister(void) +{ + AT91C_BASE_AIC->AIC_SMR[AT91C_ID_TC0] = 1; +} + +static inline void ClearInterrupt(void) +{ + AT91C_BASE_AIC->AIC_ICCR = TIMER0_ID_MASK; +} + +static inline void EnableCompareInterruptForRegisterC(void) +{ + AT91C_BASE_TC0->TC_IER = AT91C_TC_CPCS; +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/TimerInterruptConfigurator.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/TimerInterruptConfigurator.h new file mode 100644 index 0000000..301110d --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/TimerInterruptConfigurator.h @@ -0,0 +1,13 @@ +#ifndef _TIMERINTERRUPTCONFIGURATOR_H +#define _TIMERINTERRUPCONFIGURATOR_H + +#include "Types.h" + +#define TIMER0_ID_MASK (((uint32)0x1) << AT91C_ID_TC0) + +void Timer_DisableInterrupt(void); +void Timer_ResetSystemTime(void); +void Timer_ConfigureInterrupt(void); +void Timer_EnableInterrupt(void); + +#endif // _TIMERINTERRUPTCONFIGURATOR_H diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/TimerInterruptHandler.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/TimerInterruptHandler.c new file mode 100644 index 0000000..ebb543d --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/TimerInterruptHandler.c @@ -0,0 +1,25 @@ +#include "Types.h" +#include "TimerInterruptHandler.h" +#include "TimerInterruptConfigurator.h" + +static uint32 systemTime; + +void Timer_SetSystemTime(uint32 time) +{ + systemTime = time; +} + +uint32 Timer_GetSystemTime(void) +{ + return systemTime; +} + +void Timer_InterruptHandler(void) +{ + uint32 status = AT91C_BASE_TC0->TC_SR; + if (status & AT91C_TC_CPCS) + { + systemTime += 10; + } +} + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/TimerInterruptHandler.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/TimerInterruptHandler.h new file mode 100644 index 0000000..29c0413 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/TimerInterruptHandler.h @@ -0,0 +1,10 @@ +#ifndef _TIMERINTERRUPTHANDLER_H +#define _TIMERINTERRUPTHANDLER_H + +#include "Types.h" + +void Timer_SetSystemTime(uint32 time); +uint32 Timer_GetSystemTime(void); +void Timer_InterruptHandler(void); + +#endif // _TIMERINTERRUPTHANDLER_H diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/TimerModel.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/TimerModel.c new file mode 100644 index 0000000..fcc9db9 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/TimerModel.c @@ -0,0 +1,9 @@ +#include "Types.h" +#include "TimerModel.h" +#include "TaskScheduler.h" + +void TimerModel_UpdateTime(uint32 systemTime) +{ + TaskScheduler_Update(systemTime); +} + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/TimerModel.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/TimerModel.h new file mode 100644 index 0000000..54be21a --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/TimerModel.h @@ -0,0 +1,8 @@ +#ifndef _TIMERMODEL_H +#define _TIMERMODEL_H + +#include "Types.h" + +void TimerModel_UpdateTime(uint32 systemTime); + +#endif // _TIMERMODEL_H diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/Types.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/Types.h new file mode 100644 index 0000000..6a0f824 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/Types.h @@ -0,0 +1,103 @@ +#ifndef _MYTYPES_H_ +#define _MYTYPES_H_ + +#include "AT91SAM7X256.h" +#include + +#ifndef __monitor +#define __monitor +#endif + +// Peripheral Helper Definitions +#define USART0_CLOCK_ENABLE (AT91C_ID_US0) +#define USART0_TX_PIN (AT91C_PA1_TXD0) +#define TIMER0_CLOCK_ENABLE (((uint32)0x1) << AT91C_ID_TC0) +#define PIOA_CLOCK_ENABLE (((uint32)0x1) << AT91C_ID_PIOA) +#define PIOB_CLOCK_ENABLE (((uint32)0x1) << AT91C_ID_PIOB) +#define TIOA0_PIN_MASK (((uint32)0x1) << 23) // Timer/Counter Output Pin + +// Application Type Definitions +typedef unsigned int uint32; +typedef int int32; +typedef unsigned short uint16; +typedef short int16; +typedef unsigned char uint8; +typedef char int8; +typedef char bool; + +// Application Special Value Definitions +#ifndef TRUE +#define TRUE (1) +#endif +#ifndef FALSE +#define FALSE (0) +#endif +#ifndef NULL +#define NULL (0) +#endif // NULL +#define DONT_CARE (0) + +#ifndef INFINITY +#define INFINITY (1.0 / 0.0) +#endif + +#ifndef NAN +#define NAN (0.0 / 0.0) +#endif + +// MIN/MAX Definitions for Standard Types +#ifndef INT8_MAX +#define INT8_MAX 127 +#endif + +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif + +#ifndef UINT8_MAX +#define UINT8_MAX 0xFFU +#endif + +#ifndef UINT8_MIN +#define UINT8_MIN 0x00U +#endif + +#ifndef INT16_MAX +#define INT16_MAX 32767 +#endif + +#ifndef INT16_MIN +#define INT16_MIN (-32768) +#endif + +#ifndef UINT16_MAX +#define UINT16_MAX 0xFFFFU +#endif + +#ifndef UINT16_MIN +#define UINT16_MIN 0x0000U +#endif + +#ifndef INT32_MAX +#define INT32_MAX 0x7FFFFFFF +#endif + +#ifndef INT32_MIN +#define INT32_MIN (-INT32_MAX - 1) +#endif + +#ifndef UINT32_MAX +#define UINT32_MAX 0xFFFFFFFFU +#endif + +#ifndef UINT32_MIN +#define UINT32_MIN 0x00000000U +#endif + +typedef struct _EXAMPLE_STRUCT_T +{ + int x; + int y; +} EXAMPLE_STRUCT_T; + +#endif // _MYTYPES_H_ diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/UsartBaudRateRegisterCalculator.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/UsartBaudRateRegisterCalculator.c new file mode 100644 index 0000000..f4ad147 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/UsartBaudRateRegisterCalculator.c @@ -0,0 +1,18 @@ +#include "Types.h" +#include "UsartBaudRateRegisterCalculator.h" + +uint8 UsartModel_CalculateBaudRateRegisterSetting(uint32 masterClock, uint32 baudRate) +{ + uint32 registerSetting = ((masterClock * 10) / (baudRate * 16)); + + if ((registerSetting % 10) >= 5) + { + registerSetting = (registerSetting / 10) + 1; + } + else + { + registerSetting /= 10; + } + + return (uint8)registerSetting; +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/UsartBaudRateRegisterCalculator.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/UsartBaudRateRegisterCalculator.h new file mode 100644 index 0000000..50e9048 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/UsartBaudRateRegisterCalculator.h @@ -0,0 +1,6 @@ +#ifndef _USARTBAUDRATEREGISTERCALCULATOR_H +#define _USARTBAUDRATEREGISTERCALCULATOR_H + +uint8 UsartModel_CalculateBaudRateRegisterSetting(uint32 masterClock, uint32 baudRate); + +#endif // _USARTBAUDRATEREGISTERCALCULATOR_H diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/UsartConductor.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/UsartConductor.c new file mode 100644 index 0000000..3eeec3c --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/UsartConductor.c @@ -0,0 +1,21 @@ +#include "Types.h" +#include "UsartConductor.h" +#include "UsartHardware.h" +#include "UsartModel.h" +#include "TaskScheduler.h" + +void UsartConductor_Init(void) +{ + UsartHardware_Init(UsartModel_GetBaudRateRegisterSetting()); + UsartHardware_TransmitString(UsartModel_GetWakeupMessage()); +} + +void UsartConductor_Run(void) +{ + char* temp; + if (TaskScheduler_DoUsart()) + { + temp = UsartModel_GetFormattedTemperature(); + UsartHardware_TransmitString(temp); + } +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/UsartConductor.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/UsartConductor.h new file mode 100644 index 0000000..f420736 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/UsartConductor.h @@ -0,0 +1,7 @@ +#ifndef _USARTCONDUCTOR_H +#define _USARTCONDUCTOR_H + +void UsartConductor_Init(void); +void UsartConductor_Run(void); + +#endif // _USARTCONDUCTOR_H diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/UsartConfigurator.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/UsartConfigurator.c new file mode 100644 index 0000000..b8c2cdc --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/UsartConfigurator.c @@ -0,0 +1,39 @@ +#include "Types.h" +#include "UsartConfigurator.h" + +void Usart_ConfigureUsartIO(void) +{ + AT91C_BASE_PIOA->PIO_ASR = USART0_TX_PIN; + AT91C_BASE_PIOA->PIO_BSR = 0; + AT91C_BASE_PIOA->PIO_PDR = USART0_TX_PIN; +} + +void Usart_EnablePeripheralClock(void) +{ + AT91C_BASE_PMC->PMC_PCER = ((uint32)1) << USART0_CLOCK_ENABLE; +} + +void Usart_Reset(void) +{ + AT91C_BASE_US0->US_IDR = 0xffffffff; + AT91C_BASE_US0->US_CR = AT91C_US_RSTRX | AT91C_US_RSTTX | AT91C_US_RXDIS | AT91C_US_TXDIS; +} + +void Usart_ConfigureMode(void) +{ + AT91C_BASE_US0->US_MR = AT91C_US_USMODE_NORMAL | + AT91C_US_NBSTOP_1_BIT | + AT91C_US_PAR_NONE | + AT91C_US_CHRL_8_BITS | + AT91C_US_CLKS_CLOCK; +} + +void Usart_SetBaudRateRegister(uint8 baudRateRegisterSetting) +{ + AT91C_BASE_US0->US_BRGR = baudRateRegisterSetting; +} + +void Usart_Enable(void) +{ + AT91C_BASE_US0->US_CR = AT91C_US_TXEN; +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/UsartConfigurator.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/UsartConfigurator.h new file mode 100644 index 0000000..02bede2 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/UsartConfigurator.h @@ -0,0 +1,13 @@ +#ifndef _USARTCONFIGURATOR_H +#define _USARTCONFIGURATOR_H + +#include "Types.h" + +void Usart_ConfigureUsartIO(void); +void Usart_EnablePeripheralClock(void); +void Usart_Reset(void); +void Usart_ConfigureMode(void); +void Usart_SetBaudRateRegister(uint8 baudRateRegisterSetting); +void Usart_Enable(void); + +#endif // _USARTCONFIGURATOR_H diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/UsartHardware.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/UsartHardware.c new file mode 100644 index 0000000..e37c2c6 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/UsartHardware.c @@ -0,0 +1,22 @@ +#include "Types.h" +#include "UsartHardware.h" +#include "UsartConfigurator.h" +#include "UsartPutChar.h" + +void UsartHardware_Init(uint8 baudRateRegisterSetting) +{ + Usart_ConfigureUsartIO(); + Usart_EnablePeripheralClock(); + Usart_Reset(); + Usart_ConfigureMode(); + Usart_SetBaudRateRegister(baudRateRegisterSetting); + Usart_Enable(); +} + +void UsartHardware_TransmitString(char* data) +{ + while(*data != NULL) + { + Usart_PutChar(*data++); + } +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/UsartHardware.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/UsartHardware.h new file mode 100644 index 0000000..041e280 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/UsartHardware.h @@ -0,0 +1,9 @@ +#ifndef _USARTHARDWARE_H +#define _USARTHARDWARE_H + +#include "Types.h" + +void UsartHardware_Init(uint8 baudRateRegisterSetting); +void UsartHardware_TransmitString(char* data); + +#endif // _USARTHARDWARE_H diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/UsartModel.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/UsartModel.c new file mode 100644 index 0000000..d722a2f --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/UsartModel.c @@ -0,0 +1,34 @@ +#include "Types.h" +#include "UsartModel.h" +#include "ModelConfig.h" +#include "UsartBaudRateRegisterCalculator.h" +#include "TemperatureFilter.h" +#include +#include + +char formattedTemperature[32]; +char* wakeup = "It's Awesome Time!\n"; + +uint8 UsartModel_GetBaudRateRegisterSetting(void) +{ + return UsartModel_CalculateBaudRateRegisterSetting(MASTER_CLOCK, USART0_BAUDRATE); +} + +char* UsartModel_GetFormattedTemperature(void) +{ + float temperature = TemperatureFilter_GetTemperatureInCelcius(); + if (temperature == -INFINITY) + { + sprintf(formattedTemperature, "%s", "Temperature sensor failure!\n"); + } + else + { + sprintf(formattedTemperature, "%.1f C\n", temperature); + } + return formattedTemperature; +} + +char* UsartModel_GetWakeupMessage(void) +{ + return wakeup; +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/UsartModel.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/UsartModel.h new file mode 100644 index 0000000..7d94854 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/UsartModel.h @@ -0,0 +1,10 @@ +#ifndef _USARTMODEL_H +#define _USARTMODEL_H + +#include "Types.h" + +uint8 UsartModel_GetBaudRateRegisterSetting(void); +char* UsartModel_GetFormattedTemperature(void); +char* UsartModel_GetWakeupMessage(void); + +#endif // _USARTMODEL_H diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/UsartPutChar.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/UsartPutChar.c new file mode 100644 index 0000000..9e3ce2c --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/UsartPutChar.c @@ -0,0 +1,16 @@ +#include "Types.h" +#include "UsartPutChar.h" +#include "UsartTransmitBufferStatus.h" +#ifdef SIMULATE +#include +#endif + +void Usart_PutChar(char data) +{ + while(!Usart_ReadyToTransmit()); +#ifdef SIMULATE + printf("%c", data); +#else + AT91C_BASE_US0->US_THR = data; +#endif +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/UsartPutChar.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/UsartPutChar.h new file mode 100644 index 0000000..924446a --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/UsartPutChar.h @@ -0,0 +1,8 @@ +#ifndef _USARTPUT_HAR_H +#define _USARTPUT_HAR_H + +#include "Types.h" + +void Usart_PutChar(char data); + +#endif // _USARTPUT_HAR_H diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/UsartTransmitBufferStatus.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/UsartTransmitBufferStatus.c new file mode 100644 index 0000000..914b2e1 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/UsartTransmitBufferStatus.c @@ -0,0 +1,7 @@ +#include "Types.h" +#include "UsartTransmitBufferStatus.h" + +bool Usart_ReadyToTransmit(void) +{ + return (AT91C_BASE_US0->US_CSR & AT91C_US_TXRDY) > 0; +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/UsartTransmitBufferStatus.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/UsartTransmitBufferStatus.h new file mode 100644 index 0000000..b5925ba --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/src/UsartTransmitBufferStatus.h @@ -0,0 +1,8 @@ +#ifndef _USARTTRANSMITBUFFERSTATUS_H +#define _USARTTRANSMITBUFFERSTATUS_H + +#include "Types.h" + +bool Usart_ReadyToTransmit(void); + +#endif // _USARTTRANSMITBUFFERSTATUS_H diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestAdcConductor.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestAdcConductor.c new file mode 100644 index 0000000..a15d7d1 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestAdcConductor.c @@ -0,0 +1,121 @@ +#include "unity.h" +#include "UnityHelper.h" +#include "Types.h" +#include "Types.h" +#include "AdcConductor.h" +#include "MockAdcModel.h" +#include "MockAdcHardware.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void testInitShouldCallHardwareInit(void) +{ + AdcHardware_Init_Expect(); + AdcConductor_Init(); +} + +void testRunShouldNotDoAnythingIfItIsNotTime(void) +{ + AdcModel_DoGetSample_ExpectAndReturn(FALSE); + + AdcConductor_Run(); +} + +void testRunShouldNotPassAdcResultToModelIfSampleIsNotComplete(void) +{ + AdcModel_DoGetSample_ExpectAndReturn(TRUE); + AdcHardware_GetSampleComplete_ExpectAndReturn(FALSE); + + AdcConductor_Run(); +} + +void testRunShouldGetLatestSampleFromAdcAndPassItToModelAndStartNewConversionWhenItIsTime(void) +{ + AdcModel_DoGetSample_ExpectAndReturn(TRUE); + AdcHardware_GetSampleComplete_ExpectAndReturn(TRUE); + AdcHardware_GetSample_ExpectAndReturn(293U); + AdcModel_ProcessInput_Expect(293U); + AdcHardware_StartConversion_Expect(); + + AdcConductor_Run(); +} + +void testJustHereToTest_Should_ProperlyPassAStructAndVerifyIt(void) +{ + EXAMPLE_STRUCT_T TestStruct; + TestStruct.x = 5; + TestStruct.y = 7; + + AdcModel_DoNothingExceptTestASpecialType_ExpectAndReturn(TestStruct, TRUE); + + TEST_ASSERT_TRUE(AdcConductor_JustHereToTest()); +} + +//void testJustHereToTest_Should_FailThisTestIfYouUncommentXIsBecauseItsWrong(void) +//{ +// EXAMPLE_STRUCT_T TestStruct; +// TestStruct.x = 6; +// TestStruct.y = 7; +// +// AdcModel_DoNothingExceptTestASpecialType_ExpectAndReturn(TestStruct, TRUE); +// +// TEST_ASSERT_TRUE(AdcConductor_JustHereToTest()); +//} +// +//void testJustHereToTest_Should_FailThisTestIfYouUncommentYIsBecauseItsWrong(void) +//{ +// EXAMPLE_STRUCT_T TestStruct; +// TestStruct.x = 5; +// TestStruct.y = 8; +// +// AdcModel_DoNothingExceptTestASpecialType_ExpectAndReturn(TestStruct, TRUE); +// +// TEST_ASSERT_TRUE(AdcConductor_JustHereToTest()); +//} + +void test_AdcConductor_AlsoHereToTest_Should_ProperlyReturnAStructAsExpected1(void) +{ + EXAMPLE_STRUCT_T TestStruct; + TestStruct.x = 99; + TestStruct.y = 1; + + AdcModel_DoNothingExceptReturnASpecialType_ExpectAndReturn(TestStruct); + + TEST_ASSERT_TRUE(AdcConductor_AlsoHereToTest()); +} + +void test_AdcConductor_AlsoHereToTest_Should_ProperlyReturnAStructAsExpected2(void) +{ + EXAMPLE_STRUCT_T TestStruct; + TestStruct.x = 98; + TestStruct.y = 1; + + AdcModel_DoNothingExceptReturnASpecialType_ExpectAndReturn(TestStruct); + + TEST_ASSERT_FALSE(AdcConductor_AlsoHereToTest()); +} + +void test_AdcConductor_YetAnotherTest_Should_VerifyThatPointersToStructsAreTestable(void) +{ + uint32 TestNum = 3; + + AdModel_DoNothingExceptTestPointers_ExpectAndReturn(&TestNum, TRUE); + + TEST_ASSERT_TRUE(AdcConductor_YetAnotherTest()); +} + +//void test_AdcConductor_YetAnotherTest_Should_FailIfYouUncommentThisTestBecauseTheValuePointedToIsWrong(void) +//{ +// uint32 TestNum = 7; +// +// AdModel_DoNothingExceptTestPointers_ExpectAndReturn(&TestNum, FALSE); +// +// TEST_ASSERT_FALSE(AdcConductor_YetAnotherTest()); +//} + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestAdcHardware.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestAdcHardware.c new file mode 100644 index 0000000..7aabaa7 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestAdcHardware.c @@ -0,0 +1,44 @@ +#include "unity.h" +#include "Types.h" +#include "AdcHardware.h" +#include "MockAdcHardwareConfigurator.h" +#include "MockAdcTemperatureSensor.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void testInitShouldDelegateToConfiguratorAndTemperatureSensor(void) +{ + Adc_Reset_Expect(); + Adc_ConfigureMode_Expect(); + Adc_EnableTemperatureChannel_Expect(); + Adc_StartTemperatureSensorConversion_Expect(); + + AdcHardware_Init(); +} + +void testGetSampleCompleteShouldReturn_FALSE_WhenTemperatureSensorSampleReadyReturns_FALSE(void) +{ + Adc_TemperatureSensorSampleReady_ExpectAndReturn(FALSE); + TEST_ASSERT(!AdcHardware_GetSampleComplete()); +} + +void testGetSampleCompleteShouldReturn_TRUE_WhenTemperatureSensorSampleReadyReturns_TRUE(void) +{ + Adc_TemperatureSensorSampleReady_ExpectAndReturn(TRUE); + TEST_ASSERT(AdcHardware_GetSampleComplete()); +} + +void testGetSampleShouldDelegateToAdcTemperatureSensor(void) +{ + uint16 sample; + Adc_ReadTemperatureSensor_ExpectAndReturn(847); + + sample = AdcHardware_GetSample(); + TEST_ASSERT_EQUAL(847, sample); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestAdcHardwareConfigurator.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestAdcHardwareConfigurator.c new file mode 100644 index 0000000..c1feceb --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestAdcHardwareConfigurator.c @@ -0,0 +1,43 @@ +#include "unity.h" +#include "Types.h" +#include "AdcHardwareConfigurator.h" +#include "AT91SAM7X256.h" +#include "ModelConfig.h" + +AT91S_ADC AdcPeripheral; + +void setUp(void) +{ + +} + +void tearDown(void) +{ +} + +void testResetShouldResetTheAdcConverterPeripheral(void) +{ + AT91C_BASE_ADC->ADC_CR = 0; + Adc_Reset(); + TEST_ASSERT_EQUAL(AT91C_ADC_SWRST, AT91C_BASE_ADC->ADC_CR); +} + +void testConfigureModeShouldSetAdcModeRegisterAppropriately(void) +{ + uint32 prescaler = (MASTER_CLOCK / (2 * 2000000)) - 1; // 5MHz ADC clock + + AT91C_BASE_ADC->ADC_MR = 0; + + Adc_ConfigureMode(); + + TEST_ASSERT_EQUAL(prescaler, (AT91C_BASE_ADC->ADC_MR & AT91C_ADC_PRESCAL) >> 8); +} + +void testEnableTemperatureChannelShouldEnableTheAppropriateAdcInput(void) +{ + AT91C_BASE_ADC->ADC_CHER = 0; + + Adc_EnableTemperatureChannel(); + + TEST_ASSERT_EQUAL(0x1 << 4, AT91C_BASE_ADC->ADC_CHER); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestAdcModel.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestAdcModel.c new file mode 100644 index 0000000..f1dcb4a --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestAdcModel.c @@ -0,0 +1,33 @@ +#include "unity.h" +#include "Types.h" +#include "AdcModel.h" +#include "MockTaskScheduler.h" +#include "MockTemperatureCalculator.h" +#include "MockTemperatureFilter.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void testDoGetSampleShouldReturn_FALSE_WhenTaskSchedulerReturns_FALSE(void) +{ + TaskScheduler_DoAdc_ExpectAndReturn(FALSE); + TEST_ASSERT_EQUAL(FALSE, AdcModel_DoGetSample()); +} + +void testDoGetSampleShouldReturn_TRUE_WhenTaskSchedulerReturns_TRUE(void) +{ + TaskScheduler_DoAdc_ExpectAndReturn(TRUE); + TEST_ASSERT_EQUAL(TRUE, AdcModel_DoGetSample()); +} + +void testProcessInputShouldDelegateToTemperatureCalculatorAndPassResultToFilter(void) +{ + TemperatureCalculator_Calculate_ExpectAndReturn(21473, 23.5f); + TemperatureFilter_ProcessInput_Expect(23.5f); + AdcModel_ProcessInput(21473); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestAdcTemperatureSensor.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestAdcTemperatureSensor.c new file mode 100644 index 0000000..0be339f --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestAdcTemperatureSensor.c @@ -0,0 +1,47 @@ +#include "unity.h" +#include "Types.h" +#include "AdcTemperatureSensor.h" +#include "AT91SAM7X256.h" + +AT91S_ADC AdcPeripheral; + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void testShouldStartTemperatureSensorConversionWhenTriggered(void) +{ + AT91C_BASE_ADC->ADC_CR = 0; + Adc_StartTemperatureSensorConversion(); + TEST_ASSERT_EQUAL(AT91C_ADC_START, AT91C_BASE_ADC->ADC_CR); +} + +void testTemperatureSensorSampleReadyShouldReturnChannelConversionCompletionStatus(void) +{ + AT91C_BASE_ADC->ADC_SR = 0; + TEST_ASSERT_EQUAL(FALSE, Adc_TemperatureSensorSampleReady()); + AT91C_BASE_ADC->ADC_SR = ~AT91C_ADC_EOC4; + TEST_ASSERT_EQUAL(FALSE, Adc_TemperatureSensorSampleReady()); + AT91C_BASE_ADC->ADC_SR = AT91C_ADC_EOC4; + TEST_ASSERT_EQUAL(TRUE, Adc_TemperatureSensorSampleReady()); + AT91C_BASE_ADC->ADC_SR = 0xffffffff; + TEST_ASSERT_EQUAL(TRUE, Adc_TemperatureSensorSampleReady()); +} + +void testReadTemperatureSensorShouldFetchAndTranslateLatestReadingToMillivolts(void) +{ + uint16 result; + + // ADC bit weight at 10-bit resolution with 3.0V reference = 2.9296875 mV/LSB + AT91C_BASE_ADC->ADC_CDR4 = 138; + result = Adc_ReadTemperatureSensor(); + TEST_ASSERT_EQUAL(404, result); + + AT91C_BASE_ADC->ADC_CDR4 = 854; + result = Adc_ReadTemperatureSensor(); + TEST_ASSERT_EQUAL(2502, result); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestExecutor.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestExecutor.c new file mode 100644 index 0000000..8e48326 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestExecutor.c @@ -0,0 +1,36 @@ +#include "unity.h" +#include "Types.h" +#include "Executor.h" +#include "MockModel.h" +#include "MockUsartConductor.h" +#include "MockAdcConductor.h" +#include "MockTimerConductor.h" +#include "MockIntrinsicsWrapper.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void testInitShouldCallInitOfAllConductorsAndTheModel(void) +{ + Model_Init_Expect(); + UsartConductor_Init_Expect(); + AdcConductor_Init_Expect(); + TimerConductor_Init_Expect(); + Interrupt_Enable_Expect(); + + Executor_Init(); +} + +void testRunShouldCallRunForEachConductorAndReturnTrueAlways(void) +{ + UsartConductor_Run_Expect(); + TimerConductor_Run_Expect(); + AdcConductor_Run_Expect(); + + TEST_ASSERT_EQUAL(TRUE, Executor_Run()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestMain.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestMain.c new file mode 100644 index 0000000..baf3382 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestMain.c @@ -0,0 +1,24 @@ +#include "unity.h" +#include "Types.h" +#include "MockExecutor.h" +#include "Main.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void testMainShouldCallExecutorInitAndContinueToCallExecutorRunUntilHalted(void) +{ + Executor_Init_Expect(); + Executor_Run_ExpectAndReturn(TRUE); + Executor_Run_ExpectAndReturn(TRUE); + Executor_Run_ExpectAndReturn(TRUE); + Executor_Run_ExpectAndReturn(TRUE); + Executor_Run_ExpectAndReturn(FALSE); + + AppMain(); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestModel.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestModel.c new file mode 100644 index 0000000..59dda1d --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestModel.c @@ -0,0 +1,20 @@ +#include "unity.h" +#include "Types.h" +#include "Model.h" +#include "MockTaskScheduler.h" +#include "MockTemperatureFilter.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void testInitShouldCallSchedulerAndTemperatureFilterInit(void) +{ + TaskScheduler_Init_Expect(); + TemperatureFilter_Init_Expect(); + Model_Init(); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestTaskScheduler.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestTaskScheduler.c new file mode 100644 index 0000000..29d1edf --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestTaskScheduler.c @@ -0,0 +1,104 @@ +#include "unity.h" +#include "Types.h" +#include "TaskScheduler.h" + +void setUp(void) +{ + TaskScheduler_Init(); +} + +void tearDown(void) +{ +} + +void testShouldScheduleUsartTaskAfter1000ms(void) +{ + TEST_ASSERT_EQUAL(FALSE, TaskScheduler_DoUsart()); + + TaskScheduler_Update(999); + TEST_ASSERT_EQUAL(FALSE, TaskScheduler_DoUsart()); + + TaskScheduler_Update(1000); + TEST_ASSERT_EQUAL(TRUE, TaskScheduler_DoUsart()); +} + +void testShouldClearUsartDoFlagAfterReported(void) +{ + TEST_ASSERT_EQUAL(FALSE, TaskScheduler_DoUsart()); + TaskScheduler_Update(1000); + TEST_ASSERT_EQUAL(TRUE, TaskScheduler_DoUsart()); + TEST_ASSERT_EQUAL(FALSE, TaskScheduler_DoUsart()); +} + +void testShouldScheduleUsartTaskEvery1000ms(void) +{ + TEST_ASSERT_EQUAL(FALSE, TaskScheduler_DoUsart()); + + TaskScheduler_Update(1300); + TEST_ASSERT_EQUAL(TRUE, TaskScheduler_DoUsart()); + + TaskScheduler_Update(2000); + TEST_ASSERT_EQUAL(TRUE, TaskScheduler_DoUsart()); + + TaskScheduler_Update(3100); + TEST_ASSERT_EQUAL(TRUE, TaskScheduler_DoUsart()); +} + +void testShouldScheduleUsartTaskOnlyOncePerPeriod(void) +{ + TEST_ASSERT_EQUAL(FALSE, TaskScheduler_DoUsart()); + TaskScheduler_Update(1000); + TEST_ASSERT_EQUAL(TRUE, TaskScheduler_DoUsart()); + TaskScheduler_Update(1001); + TEST_ASSERT_EQUAL(FALSE, TaskScheduler_DoUsart()); + TaskScheduler_Update(1999); + TEST_ASSERT_EQUAL(FALSE, TaskScheduler_DoUsart()); + TaskScheduler_Update(2000); + TEST_ASSERT_EQUAL(TRUE, TaskScheduler_DoUsart()); +} + +void testShouldScheduleAdcTaskAfter100ms(void) +{ + TEST_ASSERT_EQUAL(FALSE, TaskScheduler_DoAdc()); + + TaskScheduler_Update(99); + TEST_ASSERT_EQUAL(FALSE, TaskScheduler_DoAdc()); + + TaskScheduler_Update(100); + TEST_ASSERT_EQUAL(TRUE, TaskScheduler_DoAdc()); +} + +void testShouldClearAdcDoFlagAfterReported(void) +{ + TEST_ASSERT_EQUAL(FALSE, TaskScheduler_DoAdc()); + TaskScheduler_Update(100); + TEST_ASSERT_EQUAL(TRUE, TaskScheduler_DoAdc()); + TEST_ASSERT_EQUAL(FALSE, TaskScheduler_DoAdc()); +} + +void testShouldScheduleAdcTaskEvery100ms(void) +{ + TEST_ASSERT_EQUAL(FALSE, TaskScheduler_DoAdc()); + + TaskScheduler_Update(121); + TEST_ASSERT_EQUAL(TRUE, TaskScheduler_DoAdc()); + + TaskScheduler_Update(200); + TEST_ASSERT_EQUAL(TRUE, TaskScheduler_DoAdc()); + + TaskScheduler_Update(356); + TEST_ASSERT_EQUAL(TRUE, TaskScheduler_DoAdc()); +} + +void testShouldScheduleAdcTaskOnlyOncePerPeriod(void) +{ + TEST_ASSERT_EQUAL(FALSE, TaskScheduler_DoAdc()); + TaskScheduler_Update(100); + TEST_ASSERT_EQUAL(TRUE, TaskScheduler_DoAdc()); + TaskScheduler_Update(101); + TEST_ASSERT_EQUAL(FALSE, TaskScheduler_DoAdc()); + TaskScheduler_Update(199); + TEST_ASSERT_EQUAL(FALSE, TaskScheduler_DoAdc()); + TaskScheduler_Update(200); + TEST_ASSERT_EQUAL(TRUE, TaskScheduler_DoAdc()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestTemperatureCalculator.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestTemperatureCalculator.c new file mode 100644 index 0000000..dbb7dea --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestTemperatureCalculator.c @@ -0,0 +1,33 @@ +#include "unity.h" +#include "Types.h" +#include "TemperatureCalculator.h" +#include + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void testTemperatureCalculatorShouldCalculateTemperatureFromMillivolts(void) +{ + float result; + + // Series resistor is 5k Ohms; Reference voltage is 3.0V + // R(t) = A * e^(B*t); R is resistance of thermisor; t is temperature in C + result = TemperatureCalculator_Calculate(1000); + TEST_ASSERT_FLOAT_WITHIN(0.01f, 25.0f, result); + + result = TemperatureCalculator_Calculate(2985); + TEST_ASSERT_FLOAT_WITHIN(0.01f, 68.317f, result); + + result = TemperatureCalculator_Calculate(3); + TEST_ASSERT_FLOAT_WITHIN(0.01f, -19.96f, result); +} + +void testShouldReturnNegativeInfinityWhen_0_millivoltsInput(void) +{ + TEST_ASSERT_FLOAT_WITHIN(0.0000001f, -INFINITY, TemperatureCalculator_Calculate(0)); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestTemperatureFilter.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestTemperatureFilter.c new file mode 100644 index 0000000..58fb178 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestTemperatureFilter.c @@ -0,0 +1,69 @@ +#include "unity.h" +#include "Types.h" +#include "TemperatureFilter.h" +#include + +void setUp(void) +{ + TemperatureFilter_Init(); +} + +void tearDown(void) +{ +} + +void testShouldInitializeTemeratureToInvalidValue(void) +{ + TemperatureFilter_Init(); + TEST_ASSERT_FLOAT_WITHIN(0.0001f, -INFINITY, TemperatureFilter_GetTemperatureInCelcius()); +} + +void testShouldInitializeTemperatureAfterCallToInit(void) +{ + TemperatureFilter_Init(); + TemperatureFilter_ProcessInput(17.8f); + TEST_ASSERT_FLOAT_WITHIN(0.0001f, 17.8f, TemperatureFilter_GetTemperatureInCelcius()); + + TemperatureFilter_Init(); + TemperatureFilter_ProcessInput(32.6f); + TEST_ASSERT_FLOAT_WITHIN(0.0001f, 32.6f, TemperatureFilter_GetTemperatureInCelcius()); +} + +void setValueAndVerifyResponse(float input, float response) +{ + float actual; + TemperatureFilter_ProcessInput(input); + actual = TemperatureFilter_GetTemperatureInCelcius(); + TEST_ASSERT_FLOAT_WITHIN(0.0001f, response, actual); +} + +void testShouldWeightEachSubsequentValueBy25PercentAfterInitialValue(void) +{ + TemperatureFilter_Init(); + setValueAndVerifyResponse(0.0f, 0.0f); + setValueAndVerifyResponse(10.0f, 2.5f); + setValueAndVerifyResponse(10.0f, 4.375f); + setValueAndVerifyResponse(10.0f, 5.78125f); + + TemperatureFilter_Init(); + setValueAndVerifyResponse(100.0f, 100.0f); + setValueAndVerifyResponse(0.0f, 75.0f); + setValueAndVerifyResponse(0.0f, 56.25f); + setValueAndVerifyResponse(0.0f, 42.1875f); +} + +void setInvalidTemperatureAndVerifyReinitialized(float invalidTemperature) +{ + TemperatureFilter_Init(); + setValueAndVerifyResponse(100.0f, 100.0f); + setValueAndVerifyResponse(invalidTemperature, -INFINITY); + setValueAndVerifyResponse(14.3f, 14.3f); +} + +void testShouldResetAverageIfPassedInfinityOrInvalidValue(void) +{ + setInvalidTemperatureAndVerifyReinitialized(-INFINITY); + setInvalidTemperatureAndVerifyReinitialized(+INFINITY); + setInvalidTemperatureAndVerifyReinitialized(+NAN); + setInvalidTemperatureAndVerifyReinitialized(-NAN); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestTimerConductor.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestTimerConductor.c new file mode 100644 index 0000000..8064a8c --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestTimerConductor.c @@ -0,0 +1,32 @@ +#include "unity.h" +#include "Types.h" +#include "TimerConductor.h" +#include "MockTimerHardware.h" +#include "MockTimerModel.h" +#include "MockTimerInterruptHandler.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void testInitShouldCallHardwareInit(void) +{ + TimerHardware_Init_Expect(); + + TimerConductor_Init(); +} + +void testRunShouldGetSystemTimeAndPassOnToModelForEventScheduling(void) +{ + Timer_GetSystemTime_ExpectAndReturn(1230); + TimerModel_UpdateTime_Expect(1230); + TimerConductor_Run(); + + Timer_GetSystemTime_ExpectAndReturn(837460); + TimerModel_UpdateTime_Expect(837460); + TimerConductor_Run(); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestTimerConfigurator.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestTimerConfigurator.c new file mode 100644 index 0000000..5c7d4e0 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestTimerConfigurator.c @@ -0,0 +1,112 @@ +#include "unity.h" +#include "Types.h" +#include "TimerConfigurator.h" +#include "AT91SAM7X256.h" +#include "MockTimerInterruptConfigurator.h" + +AT91S_PMC PmcPeripheral; +AT91S_TC TimerCounter0Peripheral; +AT91S_PIO PioBPeripheral; + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void testEnablePeripheralClocksShouldEnableClockToTimer0Peripheral(void) +{ + AT91C_BASE_PMC->PMC_PCER = 0; + Timer_EnablePeripheralClocks(); + TEST_ASSERT_EQUAL( + TIMER0_CLOCK_ENABLE, + AT91C_BASE_PMC->PMC_PCER & TIMER0_CLOCK_ENABLE); +} + +void testEnablePeripheralClocksShouldEnableClockToPIOBPeripheral(void) +{ + AT91C_BASE_PMC->PMC_PCER = 0; + Timer_EnablePeripheralClocks(); + TEST_ASSERT_EQUAL( + PIOB_CLOCK_ENABLE, + AT91C_BASE_PMC->PMC_PCER & PIOB_CLOCK_ENABLE); +} + +void testResetShouldSetTimer0ClockDisableBit_DisableTimer0Interrupts_ClearStatusRegister(void) +{ + AT91C_BASE_TC0->TC_CCR = 0; + AT91C_BASE_TC0->TC_IDR = 0; + AT91C_BASE_TC0->TC_SR = 0xFFFFFFFF; + Timer_Reset(); + TEST_ASSERT_EQUAL(0x00000002, AT91C_BASE_TC0->TC_CCR); + TEST_ASSERT_EQUAL(0xffffffff, AT91C_BASE_TC0->TC_IDR); + // CANNOT BE VERIFIED!! TEST_ASSERT_EQUAL(0X00000000, AT91C_BASE_TC0->TC_SR); +} + +void testEnableOutputPinShouldEnable_TIOA0_DigitalOutput(void) +{ + AT91C_BASE_PIOB->PIO_PDR = 0; + Timer_EnableOutputPin(); + TEST_ASSERT_EQUAL(TIOA0_PIN_MASK, AT91C_BASE_PIOB->PIO_PDR); +} + +void testConfigureModeShouldConfigureTimer0ClockSourceForMasterClockDividedBy1024(void) +{ + AT91C_BASE_TC0->TC_CMR = 0; + Timer_ConfigureMode(); + TEST_ASSERT_EQUAL(0x00000004, AT91C_BASE_TC0->TC_CMR & 0x00000007); +} + +void testConfigureModeShouldConfigureTimer0ForWaveGeneration(void) +{ + AT91C_BASE_TC0->TC_CMR = 0; + Timer_ConfigureMode(); + TEST_ASSERT_EQUAL(0x00008000, AT91C_BASE_TC0->TC_CMR & 0x00008000); +} + +void testConfigureModeShouldConfigureTimer0ForUpModeWithAutomaticTriggerOnRCCompare(void) +{ + AT91C_BASE_TC0->TC_CMR = 0; + Timer_ConfigureMode(); + TEST_ASSERT_EQUAL(0x00004000, AT91C_BASE_TC0->TC_CMR & 0x00006000); +} + +void testConfigureModeShouldConfigureTimer0ToToggleTIOAOnRCCompare(void) +{ + AT91C_BASE_TC0->TC_CMR = 0; + Timer_ConfigureMode(); + TEST_ASSERT_EQUAL(0x000C0000, AT91C_BASE_TC0->TC_CMR & 0x000C0000); +} + +void testConfigurePeriodShouldConfigureRegisterCFor10msInterval(void) +{ + AT91C_BASE_TC0->TC_RC = 0; + Timer_ConfigurePeriod(); + TEST_ASSERT_EQUAL(469, AT91C_BASE_TC0->TC_RC); +} + +void testEnableShouldSetEnableFlagForTimer0(void) +{ + AT91C_BASE_TC0->TC_CCR = 0; + Timer_Enable(); + TEST_ASSERT_EQUAL_INT(1, AT91C_BASE_TC0->TC_CCR); +} + +void testConfigureInterruptHandler(void) +{ + Timer_DisableInterrupt_Expect(); + Timer_ResetSystemTime_Expect(); + Timer_ConfigureInterrupt_Expect(); + Timer_EnableInterrupt_Expect(); + + Timer_ConfigureInterruptHandler(); +} + +void testStartShouldSetSoftwareTriggerFlag(void) +{ + AT91C_BASE_TC0->TC_CCR = 0; + Timer_Start(); + TEST_ASSERT_EQUAL(0x04, AT91C_BASE_TC0->TC_CCR); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestTimerHardware.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestTimerHardware.c new file mode 100644 index 0000000..16339d0 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestTimerHardware.c @@ -0,0 +1,26 @@ +#include "unity.h" +#include "Types.h" +#include "TimerHardware.h" +#include "MockTimerConfigurator.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void testInitShouldDelegateAppropriatelyToConfigurator(void) +{ + Timer_EnablePeripheralClocks_Expect(); + Timer_Reset_Expect(); + Timer_ConfigureMode_Expect(); + Timer_ConfigurePeriod_Expect(); + Timer_EnableOutputPin_Expect(); + Timer_Enable_Expect(); + Timer_ConfigureInterruptHandler_Expect(); + Timer_Start_Expect(); + + TimerHardware_Init(); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestTimerInterruptConfigurator.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestTimerInterruptConfigurator.c new file mode 100644 index 0000000..13c35f4 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestTimerInterruptConfigurator.c @@ -0,0 +1,78 @@ +#include "unity.h" +#include "Types.h" +#include "TimerInterruptConfigurator.h" +#include "MockTimerInterruptHandler.h" +#include "AT91SAM7X256.h" + +AT91S_AIC AicPeripheral; +AT91S_TC TimerCounter0Peripheral; + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void test_TIMER0_ID_MASK_ShouldBeCorrect(void) +{ + TEST_ASSERT_EQUAL(((uint32)0x1) << AT91C_ID_TC0, TIMER0_ID_MASK); +} + +void testDisableInterruptDisablesTimer0InterruptInTheInterruptController(void) +{ + AT91C_BASE_AIC->AIC_IDCR = 0; + Timer_DisableInterrupt(); + TEST_ASSERT_EQUAL(TIMER0_ID_MASK, AT91C_BASE_AIC->AIC_IDCR); +} + +void testResetSystemTimeDelegatesTo_Timer_SetSystemTime_Appropriately(void) +{ + Timer_SetSystemTime_Expect(0); + Timer_ResetSystemTime(); +} + +void testConfigureInterruptShouldSetInterruptHandlerAppropriately(void) +{ + AT91C_BASE_AIC->AIC_SVR[AT91C_ID_TC0] = (uint32)NULL; + Timer_ConfigureInterrupt(); + TEST_ASSERT_EQUAL((uint32)Timer_InterruptHandler, AT91C_BASE_AIC->AIC_SVR[AT91C_ID_TC0]); +} + +void testConfigureInterruptShouldSetInterruptLevelInSourceModeRegisterAppropriately(void) +{ + AT91C_BASE_AIC->AIC_SMR[AT91C_ID_TC0] = 0; + Timer_ConfigureInterrupt(); + TEST_ASSERT_EQUAL( + AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL, + AT91C_BASE_AIC->AIC_SMR[AT91C_ID_TC0] & 0x00000060); +} + +void testConfigureInterruptShouldSetInterruptPriorityInSourceModeRegisterAppropriately(void) +{ + AT91C_BASE_AIC->AIC_SMR[AT91C_ID_TC0] = 0; + Timer_ConfigureInterrupt(); + TEST_ASSERT_EQUAL(1, AT91C_BASE_AIC->AIC_SMR[AT91C_ID_TC0] & 0x00000007); +} + +void testConfigureInterruptShouldClearTimer0InterruptOnTheInterruptController(void) +{ + AT91C_BASE_AIC->AIC_ICCR = 0; + Timer_ConfigureInterrupt(); + TEST_ASSERT_EQUAL(TIMER0_ID_MASK, AT91C_BASE_AIC->AIC_ICCR); +} + +void testConfigureInterruptShouldEnableCompareInterruptForRegisterC(void) +{ + AT91C_BASE_TC0->TC_IER = 0; + Timer_ConfigureInterrupt(); + TEST_ASSERT_EQUAL(AT91C_TC_CPCS, AT91C_BASE_TC0->TC_IER); +} + +void testEnableInterruptShouldEnableTimer0InterruptsInInterruptCotroller(void) +{ + AT91C_BASE_AIC->AIC_IECR = 0; + Timer_EnableInterrupt(); + TEST_ASSERT_EQUAL(TIMER0_ID_MASK, AT91C_BASE_AIC->AIC_IECR); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestTimerInterruptHandler.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestTimerInterruptHandler.c new file mode 100644 index 0000000..8e2e64e --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestTimerInterruptHandler.c @@ -0,0 +1,66 @@ +#include "unity.h" +#include "Types.h" +#include "TimerInterruptHandler.h" +#include "AT91SAM7X256.h" + +AT91S_TC TimerCounter0Peripheral; + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void testSetAndGetSystemTime(void) +{ + Timer_SetSystemTime(0); + TEST_ASSERT_EQUAL(0, Timer_GetSystemTime()); + + Timer_SetSystemTime(129837); + TEST_ASSERT_EQUAL(129837, Timer_GetSystemTime()); + + Timer_SetSystemTime(UINT32_MAX); + TEST_ASSERT_EQUAL(UINT32_MAX, Timer_GetSystemTime()); +} + +void testInterruptHandlerShouldIncrementSystemTimeOnlyIfStatusHasCompareRegisterCOverflowBitSet(void) +{ + Timer_SetSystemTime(0); + AT91C_BASE_TC0->TC_SR = 0; + Timer_InterruptHandler(); + TEST_ASSERT_EQUAL(0, Timer_GetSystemTime()); + + Timer_SetSystemTime(0); + AT91C_BASE_TC0->TC_SR = ~AT91C_TC_CPCS; + Timer_InterruptHandler(); + TEST_ASSERT_EQUAL(0, Timer_GetSystemTime()); + + Timer_SetSystemTime(0); + AT91C_BASE_TC0->TC_SR = AT91C_TC_CPCS; + Timer_InterruptHandler(); + TEST_ASSERT(Timer_GetSystemTime() > 0); + + Timer_SetSystemTime(0); + AT91C_BASE_TC0->TC_SR = 0xffffffff; + Timer_InterruptHandler(); + TEST_ASSERT(Timer_GetSystemTime() > 0); +} + +void testInterruptHandlerShouldIncrementSystemTimerBy_10(void) +{ + Timer_SetSystemTime(0); + AT91C_BASE_TC0->TC_SR = AT91C_TC_CPCS; + Timer_InterruptHandler(); + TEST_ASSERT_EQUAL(10, Timer_GetSystemTime()); + + AT91C_BASE_TC0->TC_SR = AT91C_TC_CPCS; + Timer_InterruptHandler(); + TEST_ASSERT_EQUAL(20, Timer_GetSystemTime()); + + Timer_SetSystemTime(39426857); + AT91C_BASE_TC0->TC_SR = AT91C_TC_CPCS; + Timer_InterruptHandler(); + TEST_ASSERT_EQUAL(39426867, Timer_GetSystemTime()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestTimerModel.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestTimerModel.c new file mode 100644 index 0000000..e92a96a --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestTimerModel.c @@ -0,0 +1,18 @@ +#include "unity.h" +#include "Types.h" +#include "TimerModel.h" +#include "MockTaskScheduler.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void testUpdateTimeShouldDelegateToTaskScheduler(void) +{ + TaskScheduler_Update_Expect(19387L); + TimerModel_UpdateTime(19387L); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestUsartBaudRateRegisterCalculator.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestUsartBaudRateRegisterCalculator.c new file mode 100644 index 0000000..08dc045 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestUsartBaudRateRegisterCalculator.c @@ -0,0 +1,21 @@ +#include "unity.h" +#include "Types.h" +#include "UsartBaudRateRegisterCalculator.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void testCalculateBaudRateRegisterSettingShouldCalculateRegisterSettingAppropriately(void) +{ + // BaudRate = MCK / (CD x 16) - per datasheet section 30.6.1.2 "Baud Rate Calculation Example" + TEST_ASSERT_EQUAL(26, UsartModel_CalculateBaudRateRegisterSetting(48000000, 115200)); + TEST_ASSERT_EQUAL(6, UsartModel_CalculateBaudRateRegisterSetting(3686400, 38400)); + TEST_ASSERT_EQUAL(23, UsartModel_CalculateBaudRateRegisterSetting(14318180, 38400)); + TEST_ASSERT_EQUAL(20, UsartModel_CalculateBaudRateRegisterSetting(12000000, 38400)); + TEST_ASSERT_EQUAL(13, UsartModel_CalculateBaudRateRegisterSetting(12000000, 56800)); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestUsartConductor.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestUsartConductor.c new file mode 100644 index 0000000..fd6de6e --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestUsartConductor.c @@ -0,0 +1,40 @@ +#include "unity.h" +#include "Types.h" +#include "UsartConductor.h" +#include "MockUsartModel.h" +#include "MockUsartHardware.h" +#include "MockTaskScheduler.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void testShouldInitializeHardwareWhenInitCalled(void) +{ + UsartModel_GetBaudRateRegisterSetting_ExpectAndReturn(4); + UsartModel_GetWakeupMessage_ExpectAndReturn("Hey there!"); + UsartHardware_TransmitString_Expect("Hey there!"); + UsartHardware_Init_Expect(4); + + UsartConductor_Init(); +} + +void testRunShouldNotDoAnythingIfSchedulerSaysItIsNotTimeYet(void) +{ + TaskScheduler_DoUsart_ExpectAndReturn(FALSE); + + UsartConductor_Run(); +} + +void testRunShouldGetCurrentTemperatureAndTransmitIfSchedulerSaysItIsTime(void) +{ + TaskScheduler_DoUsart_ExpectAndReturn(TRUE); + UsartModel_GetFormattedTemperature_ExpectAndReturn("hey there"); + UsartHardware_TransmitString_Expect("hey there"); + + UsartConductor_Run(); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestUsartConfigurator.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestUsartConfigurator.c new file mode 100644 index 0000000..b23029e --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestUsartConfigurator.c @@ -0,0 +1,77 @@ +#include "unity.h" +#include "Types.h" +#include "UsartConfigurator.h" + +AT91S_PIO PioAPeripheral; +AT91S_PMC PmcPeripheral; +AT91S_USART Usart0Peripheral; + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void testConfigureUsartIOShouldConfigureUsartTxPinfForPeripheralIO(void) +{ + AT91C_BASE_PIOA->PIO_ASR = 0; + AT91C_BASE_PIOA->PIO_BSR = 0xffffffff; + AT91C_BASE_PIOA->PIO_PDR = 0; + Usart_ConfigureUsartIO(); + TEST_ASSERT_EQUAL(USART0_TX_PIN, AT91C_BASE_PIOA->PIO_ASR); + TEST_ASSERT_EQUAL(0, AT91C_BASE_PIOA->PIO_BSR); + TEST_ASSERT_EQUAL(USART0_TX_PIN, AT91C_BASE_PIOA->PIO_PDR); +} + +void testEnablePeripheralClockShouldEnableClockToUsartPeripheral(void) +{ + AT91C_BASE_PMC->PMC_PCER = 0; + Usart_EnablePeripheralClock(); + TEST_ASSERT_EQUAL(((uint32)1) << USART0_CLOCK_ENABLE, AT91C_BASE_PMC->PMC_PCER); +} + +void testResetShouldDisableAllUsartInterrupts(void) +{ + AT91C_BASE_US0->US_IDR = 0; + Usart_Reset(); + TEST_ASSERT_EQUAL(0xffffffff, AT91C_BASE_US0->US_IDR); +} + +void testResetShouldResetUsartTransmitterAndReceiver(void) +{ + AT91C_BASE_US0->US_CR = 0; + Usart_Reset(); + TEST_ASSERT_EQUAL(AT91C_US_RSTRX | AT91C_US_RSTTX | AT91C_US_RXDIS | AT91C_US_TXDIS, AT91C_BASE_US0->US_CR); +} + +void testConfigureModeShouldSetUsartModeToAsynchronous(void) +{ + uint32 asyncMode = (AT91C_US_USMODE_NORMAL | + AT91C_US_NBSTOP_1_BIT | + AT91C_US_PAR_NONE | + AT91C_US_CHRL_8_BITS | + AT91C_US_CLKS_CLOCK); + + AT91C_BASE_US0->US_MR = ~asyncMode; + Usart_ConfigureMode(); + TEST_ASSERT_EQUAL(asyncMode, AT91C_BASE_US0->US_MR); +} + +void testSetBaudRateRegisterShouldSetUsartBaudRateRegisterToValuePassedAsParameter(void) +{ + AT91C_BASE_US0->US_BRGR = 0; + Usart_SetBaudRateRegister(3); + TEST_ASSERT_EQUAL(3, AT91C_BASE_US0->US_BRGR); + Usart_SetBaudRateRegister(251); + TEST_ASSERT_EQUAL(251, AT91C_BASE_US0->US_BRGR); +} + + +void testEnableShouldEnableUsart0Transmitter(void) +{ + AT91C_BASE_US0->US_CR = 0; + Usart_Enable(); + TEST_ASSERT_EQUAL(AT91C_US_TXEN, AT91C_BASE_US0->US_CR); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestUsartHardware.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestUsartHardware.c new file mode 100644 index 0000000..b4a0d0c --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestUsartHardware.c @@ -0,0 +1,37 @@ +#include "unity.h" +#include "Types.h" +#include "UsartHardware.h" +#include "AT91SAM7X256.h" +#include "MockUsartConfigurator.h" +#include "MockUsartPutChar.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void testInitShouldConfigureUsartPeripheralByCallingConfiguratorAppropriately(void) +{ + Usart_ConfigureUsartIO_Expect(); + Usart_EnablePeripheralClock_Expect(); + Usart_Reset_Expect(); + Usart_ConfigureMode_Expect(); + Usart_SetBaudRateRegister_Expect(73); + Usart_Enable_Expect(); + + UsartHardware_Init(73); +} + +void testTransmitStringShouldSendDesiredStringOutUsingUsart(void) +{ + Usart_PutChar_Expect('h'); + Usart_PutChar_Expect('e'); + Usart_PutChar_Expect('l'); + Usart_PutChar_Expect('l'); + Usart_PutChar_Expect('o'); + + UsartHardware_TransmitString("hello"); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestUsartModel.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestUsartModel.c new file mode 100644 index 0000000..6ab23bc --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestUsartModel.c @@ -0,0 +1,40 @@ +#include "unity.h" +#include "Types.h" +#include "UsartModel.h" +#include "ModelConfig.h" +#include "MockTemperatureFilter.h" +#include "MockUsartBaudRateRegisterCalculator.h" +#include + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void testGetBaudRateRegisterSettingShouldReturnAppropriateBaudRateRegisterSetting(void) +{ + uint8 dummyRegisterSetting = 17; + UsartModel_CalculateBaudRateRegisterSetting_ExpectAndReturn(MASTER_CLOCK, USART0_BAUDRATE, dummyRegisterSetting); + + TEST_ASSERT_EQUAL(dummyRegisterSetting, UsartModel_GetBaudRateRegisterSetting()); +} + +void testGetFormattedTemperatureFormatsTemperatureFromCalculatorAppropriately(void) +{ + TemperatureFilter_GetTemperatureInCelcius_ExpectAndReturn(25.0f); + TEST_ASSERT_EQUAL_STRING("25.0 C\n", UsartModel_GetFormattedTemperature()); +} + +void testShouldReturnErrorMessageUponInvalidTemperatureValue(void) +{ + TemperatureFilter_GetTemperatureInCelcius_ExpectAndReturn(-INFINITY); + TEST_ASSERT_EQUAL_STRING("Temperature sensor failure!\n", UsartModel_GetFormattedTemperature()); +} + +void testShouldReturnWakeupMessage(void) +{ + TEST_ASSERT_EQUAL_STRING("It's Awesome Time!\n", UsartModel_GetWakeupMessage()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestUsartPutChar.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestUsartPutChar.c new file mode 100644 index 0000000..766a889 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestUsartPutChar.c @@ -0,0 +1,43 @@ +#include "unity.h" +#include "Types.h" +#include "UsartPutChar.h" +#include "MockUsartTransmitBufferStatus.h" + +AT91S_USART Usart0Peripheral; + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void testPutCharShouldWriteDesiredCharacterToUsartTransmitBuffer(void) +{ + AT91C_BASE_US0->US_THR = 0; + + Usart_ReadyToTransmit_ExpectAndReturn(TRUE); + Usart_PutChar('x'); + TEST_ASSERT_EQUAL('x', AT91C_BASE_US0->US_THR); + + Usart_ReadyToTransmit_ExpectAndReturn(TRUE); + Usart_PutChar('1'); + TEST_ASSERT_EQUAL('1', AT91C_BASE_US0->US_THR); + + Usart_ReadyToTransmit_ExpectAndReturn(TRUE); + Usart_PutChar(':'); + TEST_ASSERT_EQUAL(':', AT91C_BASE_US0->US_THR); +} + +void testPutCharShouldWaitUntilReadyToTransmitBeforeLoadingTransmitBufffer(void) +{ + AT91C_BASE_US0->US_THR = 0; + + Usart_ReadyToTransmit_ExpectAndReturn(FALSE); + Usart_ReadyToTransmit_ExpectAndReturn(FALSE); + Usart_ReadyToTransmit_ExpectAndReturn(FALSE); + Usart_ReadyToTransmit_ExpectAndReturn(TRUE); + Usart_PutChar('x'); + TEST_ASSERT_EQUAL('x', AT91C_BASE_US0->US_THR); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestUsartTransmitBufferStatus.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestUsartTransmitBufferStatus.c new file mode 100644 index 0000000..c06084f --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/examples/test/TestUsartTransmitBufferStatus.c @@ -0,0 +1,22 @@ +#include "unity.h" +#include "Types.h" +#include "UsartTransmitBufferStatus.h" + +AT91S_USART Usart0Peripheral; + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void testReadyToTransmitShouldReturnStatusPerTransmitBufferReadyStatus(void) +{ + AT91C_BASE_US0->US_CSR = 0; + TEST_ASSERT(!Usart_ReadyToTransmit()); + + AT91C_BASE_US0->US_CSR = AT91C_US_TXRDY; + TEST_ASSERT(Usart_ReadyToTransmit()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/SAM7_FLASH.mac b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/SAM7_FLASH.mac new file mode 100644 index 0000000..407acb2 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/SAM7_FLASH.mac @@ -0,0 +1,71 @@ +// ---------------------------------------------------------------------------- +// ATMEL Microcontroller Software Support - ROUSSET - +// ---------------------------------------------------------------------------- +// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// ---------------------------------------------------------------------------- +// File Name : SAM7_FLASH.mac +// Object : Generic Macro File for IAR +// 1.0 17/Aug/05 FBr : Creation +// ---------------------------------------------------------------------------- + +/********************************************************************* +* +* _InitRSTC() +* +* Function description +* Initializes the RSTC (Reset controller). +* This makes sense since the default is to not allow user resets, which makes it impossible to +* apply a second RESET via J-Link +*/ +_InitRSTC() { + __writeMemory32(0xA5000001, 0xFFFFFD08,"Memory"); // Allow user reset +} + +/********************************************************************* +* +* _InitPLL() +* Function description +* Initializes the PMC. +* 1. Enable the Main Oscillator +* 2. Configure PLL to 96MHz +* 3. Switch Master Clock (MCK) on PLL/2 = 48MHz +*/ + _InitPLL() { + + __message "Enable Main Oscillator"; + __writeMemory32(0x00000601,0xFFFFFc20,"Memory"); // MOSC + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x1) ); + + __message "Set PLL to 96MHz"; + __writeMemory32(0x10191c05,0xFFFFFc2c,"Memory"); // LOCK + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x4) ); + + __message "Set Master Clock to 48MHz"; + __writeMemory32(0x00000004,0xFFFFFc30,"Memory"); // MCKRDY + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x8) ); + __writeMemory32(0x00000007,0xFFFFFc30,"Memory"); // MCKRDY + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x8) ); +} + +/********************************************************************* +* +* execUserReset() : JTAG set initially to Full Speed +*/ +execUserReset() { + __message "execUserReset()"; + __emulatorSpeed(30000); // Set JTAG speed to 30kHz to make a hardware reset + __hwReset(0); // Hardware Reset: CPU is automatically halted after the reset (JTAG is already configured to 32kHz) + _InitPLL(); // Allow to debug at JTAG Full Speed + _InitRSTC(); // Enable User Reset to allow execUserReset() execution + __emulatorSpeed(0); // Set JTAG speed to full speed +} + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/SAM7_RAM.mac b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/SAM7_RAM.mac new file mode 100644 index 0000000..a2b8a01 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/SAM7_RAM.mac @@ -0,0 +1,94 @@ +// ---------------------------------------------------------------------------- +// ATMEL Microcontroller Software Support - ROUSSET - +// ---------------------------------------------------------------------------- +// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// ---------------------------------------------------------------------------- +// File Name : SAM7_RAM.mac +// Object : Generic Macro File for IAR +// 1.0 17/Aug/05 FBr : Creation +// ---------------------------------------------------------------------------- + +/********************************************************************* +* +* _MapRAMAt0() +* +* Function description +* Maps RAM at 0. +*/ +_MapRAMAt0(){ + __message "Changing mapping: RAM mapped to 0"; + __writeMemory32(0x00000001,0xFFFFFF00,"Memory"); +} + +/********************************************************************* +* +* _InitRSTC() +* +* Function description +* Initializes the RSTC (Reset controller). +* This makes sense since the default is to not allow user resets, which makes it impossible to +* apply a second RESET via J-Link +*/ +_InitRSTC() { + __writeMemory32(0xA5000001, 0xFFFFFD08,"Memory"); // Allow user reset +} + +/********************************************************************* +* +* _InitPLL() +* Function description +* Initializes the PMC. +* 1. Enable the Main Oscillator +* 2. Configure PLL to 96MHz +* 3. Switch Master Clock (MCK) on PLL/2 = 48MHz +*/ + _InitPLL() { + + __message "Set Main Oscillator"; + __writeMemory32(0x00004001,0xFFFFFc20,"Memory"); // MOSC + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x1) ); + + __message "Set PLL to 96MHz"; + __writeMemory32(0x10483f0e,0xFFFFFc2c,"Memory"); // LOCK + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x4) ); + + __message "Set Master Clock to 48MHz"; + __writeMemory32(0x00000004,0xFFFFFc30,"Memory"); // MCKRDY + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x8) ); + __writeMemory32(0x00000007,0xFFFFFc30,"Memory"); // MCKRDY + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x8) ); +} + +/********************************************************************* +* +* execUserReset() : JTAG set initially to Full Speed +*/ +execUserReset() { + __message "execUserReset()"; + __emulatorSpeed(30000); // Set JTAG speed to 30kHz to make a hardware reset + __hwReset(0); // Hardware Reset: CPU is automatically halted after the reset + _InitPLL(); // Allow to debug at JTAG Full Speed + _MapRAMAt0(); // Remap RAM to address 0 + __emulatorSpeed(0); // Set JTAG speed to full speed +} + +/********************************************************************* +* +* execUserPreload() : JTAG set initially to 32kHz +*/ +execUserPreload() { + __message "execUserPreload()"; + __hwReset(0); // Hardware Reset: CPU is automatically halted after the reset (JTAG is already configured to 32kHz) + _InitPLL(); // Allow to load Code at JTAG Full Speed + _MapRAMAt0(); // Remap RAM to address 0 + _InitRSTC(); // Enable User Reset to allow execUserReset() execution +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/SAM7_SIM.mac b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/SAM7_SIM.mac new file mode 100644 index 0000000..418a2c3 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/SAM7_SIM.mac @@ -0,0 +1,67 @@ +//========================================================= +// Simulation setup file for esc07_demo project +//========================================================= + +__var _timer0_interrupt_ID; + +irqBreak() +{ + __var __AIC_SMR; + __var __AIC_IECR; + __var __AIC_IVR; + + // read AIC_IECR instead, since not fully supported by simulator + __AIC_IECR = __readMemory32(0xFFFFF120, "Memory"); + if(__AIC_IECR & 0x1000) + { + __AIC_SMR = __readMemory32(0xFFFFF060, "Memory"); + __AIC_IVR = __readMemory32(0xFFFFF0B0, "Memory"); //AIC_IVR = AIC_SVR[x] + __writeMemory32(__AIC_IVR, 0xFFFFF100, "Memory"); //AIC_IVR + __writeMemory32(0x1000, 0xFFFFF10C, "Memory"); //AIC_IPR + __writeMemory32(0x2, 0xFFFFF114, "Memory"); //AIC_CISR + } + + return 0; +} + +setupProcessorRegisters() +{ + // Write TC0_SR.CPCS with correct status for ISR (Clock enabled; RC Compare Flag = TRUE) + __writeMemory32(0x00010010, 0xfffa0020, "Memory"); + + // Set TX ready flag in USART0 status register + // USART0_BASE->US_CSR = AT91C_US_TXRDY + __writeMemory32(0x00000002, 0xfffc0014, "Memory"); +} + +configureTimer0Interrupt() +{ + __var _master_clock_frequency; + __var _timer0_period_cycles; + + // Calculate timer0 frequency in master clock cycles + _master_clock_frequency = 48054857; + _timer0_period_cycles = _master_clock_frequency / 100; + if((_master_clock_frequency % 100) >= 50) + { + _timer0_period_cycles++; + } + + __cancelAllInterrupts(); + __enableInterrupts(); + + _timer0_interrupt_ID = __orderInterrupt("IRQ", _timer0_period_cycles, _timer0_period_cycles, 0, 0, 0, 100); + + if(-1 == _timer0_interrupt_ID) + { + __message "ERROR: failed to order timer 0 interrupt"; + } + + __setCodeBreak("0x18", 0, "irqBreak()", "TRUE", ""); +} + +execUserReset() +{ + setupProcessorRegisters(); + configureTimer0Interrupt(); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/at91SAM7X256_FLASH.xcl b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/at91SAM7X256_FLASH.xcl new file mode 100644 index 0000000..02eaec7 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/at91SAM7X256_FLASH.xcl @@ -0,0 +1,185 @@ +// ---------------------------------------------------------------------------- +// ATMEL Microcontroller Software Support - ROUSSET - +// ---------------------------------------------------------------------------- +// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// ---------------------------------------------------------------------------- +// File Name : at91SAM7X256_FLASH.xcl +// Object : Generic Linker Command File for IAR +// 1.0 30/Aug/05 FBr : Creation for 4.30A +// ---------------------------------------------------------------------------- + +//************************************************************************* +// XLINK command file template for EWARM/ICCARM +// +// Usage: xlink -f lnkarm +// -s +//************************************************************************* +// +// ------------- +// Code segments - may be placed anywhere in memory. +// ------------- +// +// INTVEC -- Exception vector table. +// SWITAB -- Software interrupt vector table. +// ICODE -- Startup (cstartup) and exception code. +// DIFUNCT -- Dynamic initialization vectors used by C++. +// CODE -- Compiler generated code. +// CODE_I -- Compiler generated code declared __ramfunc (executes in RAM) +// CODE_ID -- Initializer for CODE_I (ROM). +// +// ------------- +// Data segments - may be placed anywhere in memory. +// ------------- +// +// CSTACK -- The stack used by C/C++ programs (system and user mode). +// IRQ_STACK -- The stack used by IRQ service routines. +// SVC_STACK -- The stack used in supervisor mode +// (Define other exception stacks as needed for +// FIQ, ABT, UND). +// HEAP -- The heap used by malloc and free in C and new and +// delete in C++. +// INITTAB -- Table containing addresses and sizes of segments that +// need to be initialized at startup (by cstartup). +// CHECKSUM -- The linker places checksum byte(s) in this segment, +// when the -J linker command line option is used. +// DATA_y -- Data objects. +// +// Where _y can be one of: +// +// _AN -- Holds uninitialized located objects, i.e. objects with +// an absolute location given by the @ operator or the +// #pragma location directive. Since these segments +// contain objects which already have a fixed address, +// they should not be mentioned in this linker command +// file. +// _C -- Constants (ROM). +// _I -- Initialized data (RAM). +// _ID -- The original content of _I (copied to _I by cstartup) (ROM). +// _N -- Uninitialized data (RAM). +// _Z -- Zero initialized data (RAM). +// +// Note: Be sure to use end values for the defined address ranges. +// Otherwise, the linker may allocate space outside the +// intended memory range. +//************************************************************************* + +//************************************************************************* +// Inform the linker about the CPU family used. +// AT91SAM7X256 Memory mapping +// No remap +// ROMSTART +// Start address 0x0000 0000 +// Size 256 Kbo 0x0004 0000 +// RAMSTART +// Start address 0x0020 0000 +// Size 64 Kbo 0x0001 0000 +// Remap done +// RAMSTART +// Start address 0x0000 0000 +// Size 64 Kbo 0x0001 0000 +// ROMSTART +// Start address 0x0010 0000 +// Size 256 Kbo 0x0004 0000 + +//************************************************************************* +-carm + +//************************************************************************* +// Internal Ram segments mapped AFTER REMAP 64 K. +//************************************************************************* +-Z(CONST)INTRAMSTART_REMAP=00200000 +-Z(CONST)INTRAMEND_REMAP=0020FFFF + +//************************************************************************* +// Read-only segments mapped to Flash 256 K. +//************************************************************************* +-DROMSTART=00000000 +-DROMEND=0003FFFF +//************************************************************************* +// Read/write segments mapped to 64 K RAM. +//************************************************************************* +-DRAMSTART=00200000 +-DRAMEND=0020FFFF + +//************************************************************************* +// Address range for reset and exception +// vectors (INTVEC). +// The vector area is 32 bytes, +// an additional 32 bytes is allocated for the +// constant table used by ldr PC in cstartup.s79. +//************************************************************************* +-Z(CODE)INTVEC=00-3F + +//************************************************************************* +// Startup code and exception routines (ICODE). +//************************************************************************* +-Z(CODE)ICODE,DIFUNCT=ROMSTART-ROMEND +-Z(CODE)SWITAB=ROMSTART-ROMEND + +//************************************************************************* +// Code segments may be placed anywhere. +//************************************************************************* +-Z(CODE)CODE=ROMSTART-ROMEND + +//************************************************************************* +// Various constants and initializers. +//************************************************************************* +-Z(CONST)INITTAB,DATA_ID,DATA_C=ROMSTART-ROMEND +-Z(CONST)CHECKSUM=ROMSTART-ROMEND + +//************************************************************************* +// Data segments. +//************************************************************************* +-Z(DATA)DATA_I,DATA_Z,DATA_N=RAMSTART-RAMEND + +//************************************************************************* +// __ramfunc code copied to and executed from RAM. +//************************************************************************* +-Z(DATA)CODE_I=RAMSTART-RAMEND +-Z(CONST)CODE_ID=ROMSTART-ROMEND // Initializer for +-QCODE_I=CODE_ID + +//************************************************************************* +// ICCARM produces code for __ramfunc functions in +// CODE_I segments. The -Q XLINK command line +// option redirects XLINK to emit the code in the +// debug information associated with the CODE_I +// segment, where the code will execute. +//************************************************************************* + +//************************************************************************* +// Stack and heap segments. +//************************************************************************* +-D_CSTACK_SIZE=(100*4) +-D_IRQ_STACK_SIZE=(3*8*4) +-D_HEAP_SIZE=(1024*1) + +-Z(DATA)CSTACK+_CSTACK_SIZE=RAMSTART-RAMEND +-Z(DATA)IRQ_STACK+_IRQ_STACK_SIZE=RAMSTART-RAMEND +-Z(DATA)HEAP+_HEAP_SIZE=RAMSTART-RAMEND + +//************************************************************************* +// ELF/DWARF support. +// +// Uncomment the line "-Felf" below to generate ELF/DWARF output. +// Available format specifiers are: +// +// "-yn": Suppress DWARF debug output +// "-yp": Multiple ELF program sections +// "-yas": Format suitable for debuggers from ARM Ltd (also sets -p flag) +// +// "-Felf" and the format specifiers can also be supplied directly as +// command line options, or selected from the Xlink Output tab in the +// IAR Embedded Workbench. +//************************************************************************* + +// -Felf diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/at91SAM7X256_RAM.xcl b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/at91SAM7X256_RAM.xcl new file mode 100644 index 0000000..adcec10 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/at91SAM7X256_RAM.xcl @@ -0,0 +1,185 @@ +// ---------------------------------------------------------------------------- +// ATMEL Microcontroller Software Support - ROUSSET - +// ---------------------------------------------------------------------------- +// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// ---------------------------------------------------------------------------- +// File Name : at91SAM7X256_RAM.xcl +// Object : Generic Linker Command File for IAR +// 1.0 30/Aug/05 FBr : Creation for 4.30A +// ---------------------------------------------------------------------------- + +//************************************************************************* +// XLINK command file template for EWARM/ICCARM +// +// Usage: xlink -f lnkarm +// -s +//************************************************************************* +// +// ------------- +// Code segments - may be placed anywhere in memory. +// ------------- +// +// INTVEC -- Exception vector table. +// SWITAB -- Software interrupt vector table. +// ICODE -- Startup (cstartup) and exception code. +// DIFUNCT -- Dynamic initialization vectors used by C++. +// CODE -- Compiler generated code. +// CODE_I -- Compiler generated code declared __ramfunc (executes in RAM) +// CODE_ID -- Initializer for CODE_I (ROM). +// +// ------------- +// Data segments - may be placed anywhere in memory. +// ------------- +// +// CSTACK -- The stack used by C/C++ programs (system and user mode). +// IRQ_STACK -- The stack used by IRQ service routines. +// SVC_STACK -- The stack used in supervisor mode +// (Define other exception stacks as needed for +// FIQ, ABT, UND). +// HEAP -- The heap used by malloc and free in C and new and +// delete in C++. +// INITTAB -- Table containing addresses and sizes of segments that +// need to be initialized at startup (by cstartup). +// CHECKSUM -- The linker places checksum byte(s) in this segment, +// when the -J linker command line option is used. +// DATA_y -- Data objects. +// +// Where _y can be one of: +// +// _AN -- Holds uninitialized located objects, i.e. objects with +// an absolute location given by the @ operator or the +// #pragma location directive. Since these segments +// contain objects which already have a fixed address, +// they should not be mentioned in this linker command +// file. +// _C -- Constants (ROM). +// _I -- Initialized data (RAM). +// _ID -- The original content of _I (copied to _I by cstartup) (ROM). +// _N -- Uninitialized data (RAM). +// _Z -- Zero initialized data (RAM). +// +// Note: Be sure to use end values for the defined address ranges. +// Otherwise, the linker may allocate space outside the +// intended memory range. +//************************************************************************* + +//************************************************************************* +// Inform the linker about the CPU family used. +// AT91SAM7X256 Memory mapping +// No remap +// ROMSTART +// Start address 0x0000 0000 +// Size 256 Kbo 0x0004 0000 +// RAMSTART +// Start address 0x0020 0000 +// Size 64 Kbo 0x0001 0000 +// Remap done +// RAMSTART +// Start address 0x0000 0000 +// Size 64 Kbo 0x0001 0000 +// ROMSTART +// Start address 0x0010 0000 +// Size 256 Kbo 0x0004 0000 + +//************************************************************************* +-carm + +//************************************************************************* +// Internal Ram segments mapped AFTER REMAP 64 K. +//************************************************************************* +-Z(CONST)INTRAMSTART_REMAP=00000000 +-Z(CONST)INTRAMEND_REMAP=0000FFFF + +//************************************************************************* +// Read-only segments mapped to Flash 256 K. +//************************************************************************* +-DROMSTART=00000000 +-DROMEND=0003FFFF +//************************************************************************* +// Read/write segments mapped to 64 K RAM. +//************************************************************************* +-DRAMSTART=00000000 +-DRAMEND=0000FFFF + +//************************************************************************* +// Address range for reset and exception +// vectors (INTVEC). +// The vector area is 32 bytes, +// an additional 32 bytes is allocated for the +// constant table used by ldr PC in cstartup.s79. +//************************************************************************* +-Z(CODE)INTVEC=00-3F + +//************************************************************************* +// Startup code and exception routines (ICODE). +//************************************************************************* +-Z(CODE)ICODE,DIFUNCT=ROMSTART-ROMEND +-Z(CODE)SWITAB=ROMSTART-ROMEND + +//************************************************************************* +// Code segments may be placed anywhere. +//************************************************************************* +-Z(CODE)CODE=ROMSTART-ROMEND + +//************************************************************************* +// Various constants and initializers. +//************************************************************************* +-Z(CONST)INITTAB,DATA_ID,DATA_C=ROMSTART-ROMEND +-Z(CONST)CHECKSUM=ROMSTART-ROMEND + +//************************************************************************* +// Data segments. +//************************************************************************* +-Z(DATA)DATA_I,DATA_Z,DATA_N=RAMSTART-RAMEND + +//************************************************************************* +// __ramfunc code copied to and executed from RAM. +//************************************************************************* +-Z(DATA)CODE_I=RAMSTART-RAMEND +-Z(CONST)CODE_ID=ROMSTART-ROMEND // Initializer for +-QCODE_I=CODE_ID + +//************************************************************************* +// ICCARM produces code for __ramfunc functions in +// CODE_I segments. The -Q XLINK command line +// option redirects XLINK to emit the code in the +// debug information associated with the CODE_I +// segment, where the code will execute. +//************************************************************************* + +//************************************************************************* +// Stack and heap segments. +//************************************************************************* +-D_CSTACK_SIZE=(100*4) +-D_IRQ_STACK_SIZE=(3*8*4) +-D_HEAP_SIZE=(1024*2) + +-Z(DATA)CSTACK+_CSTACK_SIZE=RAMSTART-RAMEND +-Z(DATA)IRQ_STACK+_IRQ_STACK_SIZE=RAMSTART-RAMEND +-Z(DATA)HEAP+_HEAP_SIZE=RAMSTART-RAMEND + +//************************************************************************* +// ELF/DWARF support. +// +// Uncomment the line "-Felf" below to generate ELF/DWARF output. +// Available format specifiers are: +// +// "-yn": Suppress DWARF debug output +// "-yp": Multiple ELF program sections +// "-yas": Format suitable for debuggers from ARM Ltd (also sets -p flag) +// +// "-Felf" and the format specifiers can also be supplied directly as +// command line options, or selected from the Xlink Output tab in the +// IAR Embedded Workbench. +//************************************************************************* + +// -Felf diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/ioat91sam7x256.ddf b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/ioat91sam7x256.ddf new file mode 100644 index 0000000..c9fcf32 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/Resource/ioat91sam7x256.ddf @@ -0,0 +1,2259 @@ +; ---------------------------------------------------------------------------- +; ATMEL Microcontroller Software Support - ROUSSET - +; ---------------------------------------------------------------------------- +; DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +; DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +; INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +; OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +; LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +; EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +; ---------------------------------------------------------------------------- +; File Name : AT91SAM7X256.ddf +; Object : AT91SAM7X256 definitions +; Generated : AT91 SW Application Group 11/02/2005 (15:17:30) +; +; CVS Reference : /AT91SAM7X256.pl/1.14/Tue Sep 13 15:06:52 2005// +; CVS Reference : /SYS_SAM7X.pl/1.3/Tue Feb 1 17:01:43 2005// +; CVS Reference : /MC_SAM7X.pl/1.2/Fri May 20 14:13:04 2005// +; CVS Reference : /PMC_SAM7X.pl/1.4/Tue Feb 8 13:58:10 2005// +; CVS Reference : /RSTC_SAM7X.pl/1.2/Wed Jul 13 14:57:50 2005// +; CVS Reference : /UDP_SAM7X.pl/1.1/Tue May 10 11:35:35 2005// +; CVS Reference : /PWM_SAM7X.pl/1.1/Tue May 10 11:53:07 2005// +; CVS Reference : /AIC_6075B.pl/1.3/Fri May 20 14:01:30 2005// +; CVS Reference : /PIO_6057A.pl/1.2/Thu Feb 3 10:18:28 2005// +; CVS Reference : /RTTC_6081A.pl/1.2/Tue Nov 9 14:43:58 2004// +; CVS Reference : /PITC_6079A.pl/1.2/Tue Nov 9 14:43:56 2004// +; CVS Reference : /WDTC_6080A.pl/1.3/Tue Nov 9 14:44:00 2004// +; CVS Reference : /VREG_6085B.pl/1.1/Tue Feb 1 16:05:48 2005// +; CVS Reference : /PDC_6074C.pl/1.2/Thu Feb 3 08:48:54 2005// +; CVS Reference : /DBGU_6059D.pl/1.1/Mon Jan 31 13:15:32 2005// +; CVS Reference : /SPI_6088D.pl/1.3/Fri May 20 14:08:59 2005// +; CVS Reference : /US_6089C.pl/1.1/Mon Jul 12 18:23:26 2004// +; CVS Reference : /SSC_6078B.pl/1.1/Wed Jul 13 15:19:19 2005// +; CVS Reference : /TWI_6061A.pl/1.1/Tue Jul 13 07:38:06 2004// +; CVS Reference : /TC_6082A.pl/1.7/Fri Mar 11 12:52:17 2005// +; CVS Reference : /CAN_6019B.pl/1.1/Tue Mar 8 12:42:22 2005// +; CVS Reference : /EMACB_6119A.pl/1.6/Wed Jul 13 15:05:35 2005// +; CVS Reference : /ADC_6051C.pl/1.1/Fri Oct 17 09:12:38 2003// +; ---------------------------------------------------------------------------- + +[Sfr] + +; ========== Register definition for SYS peripheral ========== +; ========== Register definition for AIC peripheral ========== +sfr = "AIC_SMR", "Memory", 0xfffff000, 4, base=16 +sfr = "AIC_SMR.PRIOR", "Memory", 0xfffff000, 4, base=16, bitRange=0-2 +sfr = "AIC_SMR.SRCTYPE", "Memory", 0xfffff000, 4, base=16, bitRange=5-6 +sfr = "AIC_SVR", "Memory", 0xfffff080, 4, base=16 +sfr = "AIC_IVR", "Memory", 0xfffff100, 4, base=16 +sfr = "AIC_FVR", "Memory", 0xfffff104, 4, base=16 +sfr = "AIC_ISR", "Memory", 0xfffff108, 4, base=16 +sfr = "AIC_IPR", "Memory", 0xfffff10c, 4, base=16 +sfr = "AIC_IMR", "Memory", 0xfffff110, 4, base=16 +sfr = "AIC_CISR", "Memory", 0xfffff114, 4, base=16 +sfr = "AIC_CISR.NFIQ", "Memory", 0xfffff114, 4, base=16, bitRange=0 +sfr = "AIC_CISR.NIRQ", "Memory", 0xfffff114, 4, base=16, bitRange=1 +sfr = "AIC_IECR", "Memory", 0xfffff120, 4, base=16 +sfr = "AIC_IDCR", "Memory", 0xfffff124, 4, base=16 +sfr = "AIC_ICCR", "Memory", 0xfffff128, 4, base=16 +sfr = "AIC_ISCR", "Memory", 0xfffff12c, 4, base=16 +sfr = "AIC_EOICR", "Memory", 0xfffff130, 4, base=16 +sfr = "AIC_SPU", "Memory", 0xfffff134, 4, base=16 +sfr = "AIC_DCR", "Memory", 0xfffff138, 4, base=16 +sfr = "AIC_DCR.PROT", "Memory", 0xfffff138, 4, base=16, bitRange=0 +sfr = "AIC_DCR.GMSK", "Memory", 0xfffff138, 4, base=16, bitRange=1 +sfr = "AIC_FFER", "Memory", 0xfffff140, 4, base=16 +sfr = "AIC_FFDR", "Memory", 0xfffff144, 4, base=16 +sfr = "AIC_FFSR", "Memory", 0xfffff148, 4, base=16 +; ========== Register definition for PDC_DBGU peripheral ========== +sfr = "DBGU_RPR", "Memory", 0xfffff300, 4, base=16 +sfr = "DBGU_RCR", "Memory", 0xfffff304, 4, base=16 +sfr = "DBGU_TPR", "Memory", 0xfffff308, 4, base=16 +sfr = "DBGU_TCR", "Memory", 0xfffff30c, 4, base=16 +sfr = "DBGU_RNPR", "Memory", 0xfffff310, 4, base=16 +sfr = "DBGU_RNCR", "Memory", 0xfffff314, 4, base=16 +sfr = "DBGU_TNPR", "Memory", 0xfffff318, 4, base=16 +sfr = "DBGU_TNCR", "Memory", 0xfffff31c, 4, base=16 +sfr = "DBGU_PTCR", "Memory", 0xfffff320, 4, base=16 +sfr = "DBGU_PTCR.RXTEN", "Memory", 0xfffff320, 4, base=16, bitRange=0 +sfr = "DBGU_PTCR.RXTDIS", "Memory", 0xfffff320, 4, base=16, bitRange=1 +sfr = "DBGU_PTCR.TXTEN", "Memory", 0xfffff320, 4, base=16, bitRange=8 +sfr = "DBGU_PTCR.TXTDIS", "Memory", 0xfffff320, 4, base=16, bitRange=9 +sfr = "DBGU_PTSR", "Memory", 0xfffff324, 4, base=16 +sfr = "DBGU_PTSR.RXTEN", "Memory", 0xfffff324, 4, base=16, bitRange=0 +sfr = "DBGU_PTSR.TXTEN", "Memory", 0xfffff324, 4, base=16, bitRange=8 +; ========== Register definition for DBGU peripheral ========== +sfr = "DBGU_CR", "Memory", 0xfffff200, 4, base=16 +sfr = "DBGU_CR.RSTRX", "Memory", 0xfffff200, 4, base=16, bitRange=2 +sfr = "DBGU_CR.RSTTX", "Memory", 0xfffff200, 4, base=16, bitRange=3 +sfr = "DBGU_CR.RXEN", "Memory", 0xfffff200, 4, base=16, bitRange=4 +sfr = "DBGU_CR.RXDIS", "Memory", 0xfffff200, 4, base=16, bitRange=5 +sfr = "DBGU_CR.TXEN", "Memory", 0xfffff200, 4, base=16, bitRange=6 +sfr = "DBGU_CR.TXDIS", "Memory", 0xfffff200, 4, base=16, bitRange=7 +sfr = "DBGU_CR.RSTSTA", "Memory", 0xfffff200, 4, base=16, bitRange=8 +sfr = "DBGU_MR", "Memory", 0xfffff204, 4, base=16 +sfr = "DBGU_MR.PAR", "Memory", 0xfffff204, 4, base=16, bitRange=9-11 +sfr = "DBGU_MR.CHMODE", "Memory", 0xfffff204, 4, base=16, bitRange=14-15 +sfr = "DBGU_IER", "Memory", 0xfffff208, 4, base=16 +sfr = "DBGU_IER.RXRDY", "Memory", 0xfffff208, 4, base=16, bitRange=0 +sfr = "DBGU_IER.TXRDY", "Memory", 0xfffff208, 4, base=16, bitRange=1 +sfr = "DBGU_IER.ENDRX", "Memory", 0xfffff208, 4, base=16, bitRange=3 +sfr = "DBGU_IER.ENDTX", "Memory", 0xfffff208, 4, base=16, bitRange=4 +sfr = "DBGU_IER.OVRE", "Memory", 0xfffff208, 4, base=16, bitRange=5 +sfr = "DBGU_IER.FRAME", "Memory", 0xfffff208, 4, base=16, bitRange=6 +sfr = "DBGU_IER.PARE", "Memory", 0xfffff208, 4, base=16, bitRange=7 +sfr = "DBGU_IER.TXEMPTY", "Memory", 0xfffff208, 4, base=16, bitRange=9 +sfr = "DBGU_IER.TXBUFE", "Memory", 0xfffff208, 4, base=16, bitRange=11 +sfr = "DBGU_IER.RXBUFF", "Memory", 0xfffff208, 4, base=16, bitRange=12 +sfr = "DBGU_IER.TX", "Memory", 0xfffff208, 4, base=16, bitRange=30 +sfr = "DBGU_IER.RX", "Memory", 0xfffff208, 4, base=16, bitRange=31 +sfr = "DBGU_IDR", "Memory", 0xfffff20c, 4, base=16 +sfr = "DBGU_IDR.RXRDY", "Memory", 0xfffff20c, 4, base=16, bitRange=0 +sfr = "DBGU_IDR.TXRDY", "Memory", 0xfffff20c, 4, base=16, bitRange=1 +sfr = "DBGU_IDR.ENDRX", "Memory", 0xfffff20c, 4, base=16, bitRange=3 +sfr = "DBGU_IDR.ENDTX", "Memory", 0xfffff20c, 4, base=16, bitRange=4 +sfr = "DBGU_IDR.OVRE", "Memory", 0xfffff20c, 4, base=16, bitRange=5 +sfr = "DBGU_IDR.FRAME", "Memory", 0xfffff20c, 4, base=16, bitRange=6 +sfr = "DBGU_IDR.PARE", "Memory", 0xfffff20c, 4, base=16, bitRange=7 +sfr = "DBGU_IDR.TXEMPTY", "Memory", 0xfffff20c, 4, base=16, bitRange=9 +sfr = "DBGU_IDR.TXBUFE", "Memory", 0xfffff20c, 4, base=16, bitRange=11 +sfr = "DBGU_IDR.RXBUFF", "Memory", 0xfffff20c, 4, base=16, bitRange=12 +sfr = "DBGU_IDR.TX", "Memory", 0xfffff20c, 4, base=16, bitRange=30 +sfr = "DBGU_IDR.RX", "Memory", 0xfffff20c, 4, base=16, bitRange=31 +sfr = "DBGU_IMR", "Memory", 0xfffff210, 4, base=16 +sfr = "DBGU_IMR.RXRDY", "Memory", 0xfffff210, 4, base=16, bitRange=0 +sfr = "DBGU_IMR.TXRDY", "Memory", 0xfffff210, 4, base=16, bitRange=1 +sfr = "DBGU_IMR.ENDRX", "Memory", 0xfffff210, 4, base=16, bitRange=3 +sfr = "DBGU_IMR.ENDTX", "Memory", 0xfffff210, 4, base=16, bitRange=4 +sfr = "DBGU_IMR.OVRE", "Memory", 0xfffff210, 4, base=16, bitRange=5 +sfr = "DBGU_IMR.FRAME", "Memory", 0xfffff210, 4, base=16, bitRange=6 +sfr = "DBGU_IMR.PARE", "Memory", 0xfffff210, 4, base=16, bitRange=7 +sfr = "DBGU_IMR.TXEMPTY", "Memory", 0xfffff210, 4, base=16, bitRange=9 +sfr = "DBGU_IMR.TXBUFE", "Memory", 0xfffff210, 4, base=16, bitRange=11 +sfr = "DBGU_IMR.RXBUFF", "Memory", 0xfffff210, 4, base=16, bitRange=12 +sfr = "DBGU_IMR.TX", "Memory", 0xfffff210, 4, base=16, bitRange=30 +sfr = "DBGU_IMR.RX", "Memory", 0xfffff210, 4, base=16, bitRange=31 +sfr = "DBGU_CSR", "Memory", 0xfffff214, 4, base=16 +sfr = "DBGU_CSR.RXRDY", "Memory", 0xfffff214, 4, base=16, bitRange=0 +sfr = "DBGU_CSR.TXRDY", "Memory", 0xfffff214, 4, base=16, bitRange=1 +sfr = "DBGU_CSR.ENDRX", "Memory", 0xfffff214, 4, base=16, bitRange=3 +sfr = "DBGU_CSR.ENDTX", "Memory", 0xfffff214, 4, base=16, bitRange=4 +sfr = "DBGU_CSR.OVRE", "Memory", 0xfffff214, 4, base=16, bitRange=5 +sfr = "DBGU_CSR.FRAME", "Memory", 0xfffff214, 4, base=16, bitRange=6 +sfr = "DBGU_CSR.PARE", "Memory", 0xfffff214, 4, base=16, bitRange=7 +sfr = "DBGU_CSR.TXEMPTY", "Memory", 0xfffff214, 4, base=16, bitRange=9 +sfr = "DBGU_CSR.TXBUFE", "Memory", 0xfffff214, 4, base=16, bitRange=11 +sfr = "DBGU_CSR.RXBUFF", "Memory", 0xfffff214, 4, base=16, bitRange=12 +sfr = "DBGU_CSR.TX", "Memory", 0xfffff214, 4, base=16, bitRange=30 +sfr = "DBGU_CSR.RX", "Memory", 0xfffff214, 4, base=16, bitRange=31 +sfr = "DBGU_RHR", "Memory", 0xfffff218, 4, base=16 +sfr = "DBGU_THR", "Memory", 0xfffff21c, 4, base=16 +sfr = "DBGU_BRGR", "Memory", 0xfffff220, 4, base=16 +sfr = "DBGU_CIDR", "Memory", 0xfffff240, 4, base=16 +sfr = "DBGU_EXID", "Memory", 0xfffff244, 4, base=16 +sfr = "DBGU_FNTR", "Memory", 0xfffff248, 4, base=16 +sfr = "DBGU_FNTR.NTRST", "Memory", 0xfffff248, 4, base=16, bitRange=0 +; ========== Register definition for PIOA peripheral ========== +sfr = "PIOA_PER", "Memory", 0xfffff400, 4, base=16 +sfr = "PIOA_PDR", "Memory", 0xfffff404, 4, base=16 +sfr = "PIOA_PSR", "Memory", 0xfffff408, 4, base=16 +sfr = "PIOA_OER", "Memory", 0xfffff410, 4, base=16 +sfr = "PIOA_ODR", "Memory", 0xfffff414, 4, base=16 +sfr = "PIOA_OSR", "Memory", 0xfffff418, 4, base=16 +sfr = "PIOA_IFER", "Memory", 0xfffff420, 4, base=16 +sfr = "PIOA_IFDR", "Memory", 0xfffff424, 4, base=16 +sfr = "PIOA_IFSR", "Memory", 0xfffff428, 4, base=16 +sfr = "PIOA_SODR", "Memory", 0xfffff430, 4, base=16 +sfr = "PIOA_CODR", "Memory", 0xfffff434, 4, base=16 +sfr = "PIOA_ODSR", "Memory", 0xfffff438, 4, base=16 +sfr = "PIOA_PDSR", "Memory", 0xfffff43c, 4, base=16 +sfr = "PIOA_IER", "Memory", 0xfffff440, 4, base=16 +sfr = "PIOA_IDR", "Memory", 0xfffff444, 4, base=16 +sfr = "PIOA_IMR", "Memory", 0xfffff448, 4, base=16 +sfr = "PIOA_ISR", "Memory", 0xfffff44c, 4, base=16 +sfr = "PIOA_MDER", "Memory", 0xfffff450, 4, base=16 +sfr = "PIOA_MDDR", "Memory", 0xfffff454, 4, base=16 +sfr = "PIOA_MDSR", "Memory", 0xfffff458, 4, base=16 +sfr = "PIOA_PPUDR", "Memory", 0xfffff460, 4, base=16 +sfr = "PIOA_PPUER", "Memory", 0xfffff464, 4, base=16 +sfr = "PIOA_PPUSR", "Memory", 0xfffff468, 4, base=16 +sfr = "PIOA_ASR", "Memory", 0xfffff470, 4, base=16 +sfr = "PIOA_BSR", "Memory", 0xfffff474, 4, base=16 +sfr = "PIOA_ABSR", "Memory", 0xfffff478, 4, base=16 +sfr = "PIOA_OWER", "Memory", 0xfffff4a0, 4, base=16 +sfr = "PIOA_OWDR", "Memory", 0xfffff4a4, 4, base=16 +sfr = "PIOA_OWSR", "Memory", 0xfffff4a8, 4, base=16 +; ========== Register definition for PIOB peripheral ========== +sfr = "PIOB_PER", "Memory", 0xfffff600, 4, base=16 +sfr = "PIOB_PDR", "Memory", 0xfffff604, 4, base=16 +sfr = "PIOB_PSR", "Memory", 0xfffff608, 4, base=16 +sfr = "PIOB_OER", "Memory", 0xfffff610, 4, base=16 +sfr = "PIOB_ODR", "Memory", 0xfffff614, 4, base=16 +sfr = "PIOB_OSR", "Memory", 0xfffff618, 4, base=16 +sfr = "PIOB_IFER", "Memory", 0xfffff620, 4, base=16 +sfr = "PIOB_IFDR", "Memory", 0xfffff624, 4, base=16 +sfr = "PIOB_IFSR", "Memory", 0xfffff628, 4, base=16 +sfr = "PIOB_SODR", "Memory", 0xfffff630, 4, base=16 +sfr = "PIOB_CODR", "Memory", 0xfffff634, 4, base=16 +sfr = "PIOB_ODSR", "Memory", 0xfffff638, 4, base=16 +sfr = "PIOB_PDSR", "Memory", 0xfffff63c, 4, base=16 +sfr = "PIOB_IER", "Memory", 0xfffff640, 4, base=16 +sfr = "PIOB_IDR", "Memory", 0xfffff644, 4, base=16 +sfr = "PIOB_IMR", "Memory", 0xfffff648, 4, base=16 +sfr = "PIOB_ISR", "Memory", 0xfffff64c, 4, base=16 +sfr = "PIOB_MDER", "Memory", 0xfffff650, 4, base=16 +sfr = "PIOB_MDDR", "Memory", 0xfffff654, 4, base=16 +sfr = "PIOB_MDSR", "Memory", 0xfffff658, 4, base=16 +sfr = "PIOB_PPUDR", "Memory", 0xfffff660, 4, base=16 +sfr = "PIOB_PPUER", "Memory", 0xfffff664, 4, base=16 +sfr = "PIOB_PPUSR", "Memory", 0xfffff668, 4, base=16 +sfr = "PIOB_ASR", "Memory", 0xfffff670, 4, base=16 +sfr = "PIOB_BSR", "Memory", 0xfffff674, 4, base=16 +sfr = "PIOB_ABSR", "Memory", 0xfffff678, 4, base=16 +sfr = "PIOB_OWER", "Memory", 0xfffff6a0, 4, base=16 +sfr = "PIOB_OWDR", "Memory", 0xfffff6a4, 4, base=16 +sfr = "PIOB_OWSR", "Memory", 0xfffff6a8, 4, base=16 +; ========== Register definition for CKGR peripheral ========== +sfr = "CKGR_MOR", "Memory", 0xfffffc20, 4, base=16 +sfr = "CKGR_MOR.MOSCEN", "Memory", 0xfffffc20, 4, base=16, bitRange=0 +sfr = "CKGR_MOR.OSCBYPASS", "Memory", 0xfffffc20, 4, base=16, bitRange=1 +sfr = "CKGR_MOR.OSCOUNT", "Memory", 0xfffffc20, 4, base=16, bitRange=8-15 +sfr = "CKGR_MCFR", "Memory", 0xfffffc24, 4, base=16 +sfr = "CKGR_MCFR.MAINF", "Memory", 0xfffffc24, 4, base=16, bitRange=0-15 +sfr = "CKGR_MCFR.MAINRDY", "Memory", 0xfffffc24, 4, base=16, bitRange=16 +sfr = "CKGR_PLLR", "Memory", 0xfffffc2c, 4, base=16 +sfr = "CKGR_PLLR.DIV", "Memory", 0xfffffc2c, 4, base=16, bitRange=0-7 +sfr = "CKGR_PLLR.PLLCOUNT", "Memory", 0xfffffc2c, 4, base=16, bitRange=8-13 +sfr = "CKGR_PLLR.OUT", "Memory", 0xfffffc2c, 4, base=16, bitRange=14-15 +sfr = "CKGR_PLLR.MUL", "Memory", 0xfffffc2c, 4, base=16, bitRange=16-26 +sfr = "CKGR_PLLR.USBDIV", "Memory", 0xfffffc2c, 4, base=16, bitRange=28-29 +; ========== Register definition for PMC peripheral ========== +sfr = "PMC_SCER", "Memory", 0xfffffc00, 4, base=16 +sfr = "PMC_SCER.PCK", "Memory", 0xfffffc00, 4, base=16, bitRange=0 +sfr = "PMC_SCER.UDP", "Memory", 0xfffffc00, 4, base=16, bitRange=7 +sfr = "PMC_SCER.PCK0", "Memory", 0xfffffc00, 4, base=16, bitRange=8 +sfr = "PMC_SCER.PCK1", "Memory", 0xfffffc00, 4, base=16, bitRange=9 +sfr = "PMC_SCER.PCK2", "Memory", 0xfffffc00, 4, base=16, bitRange=10 +sfr = "PMC_SCER.PCK3", "Memory", 0xfffffc00, 4, base=16, bitRange=11 +sfr = "PMC_SCDR", "Memory", 0xfffffc04, 4, base=16 +sfr = "PMC_SCDR.PCK", "Memory", 0xfffffc04, 4, base=16, bitRange=0 +sfr = "PMC_SCDR.UDP", "Memory", 0xfffffc04, 4, base=16, bitRange=7 +sfr = "PMC_SCDR.PCK0", "Memory", 0xfffffc04, 4, base=16, bitRange=8 +sfr = "PMC_SCDR.PCK1", "Memory", 0xfffffc04, 4, base=16, bitRange=9 +sfr = "PMC_SCDR.PCK2", "Memory", 0xfffffc04, 4, base=16, bitRange=10 +sfr = "PMC_SCDR.PCK3", "Memory", 0xfffffc04, 4, base=16, bitRange=11 +sfr = "PMC_SCSR", "Memory", 0xfffffc08, 4, base=16 +sfr = "PMC_SCSR.PCK", "Memory", 0xfffffc08, 4, base=16, bitRange=0 +sfr = "PMC_SCSR.UDP", "Memory", 0xfffffc08, 4, base=16, bitRange=7 +sfr = "PMC_SCSR.PCK0", "Memory", 0xfffffc08, 4, base=16, bitRange=8 +sfr = "PMC_SCSR.PCK1", "Memory", 0xfffffc08, 4, base=16, bitRange=9 +sfr = "PMC_SCSR.PCK2", "Memory", 0xfffffc08, 4, base=16, bitRange=10 +sfr = "PMC_SCSR.PCK3", "Memory", 0xfffffc08, 4, base=16, bitRange=11 +sfr = "PMC_PCER", "Memory", 0xfffffc10, 4, base=16 +sfr = "PMC_PCDR", "Memory", 0xfffffc14, 4, base=16 +sfr = "PMC_PCSR", "Memory", 0xfffffc18, 4, base=16 +sfr = "PMC_MOR", "Memory", 0xfffffc20, 4, base=16 +sfr = "PMC_MOR.MOSCEN", "Memory", 0xfffffc20, 4, base=16, bitRange=0 +sfr = "PMC_MOR.OSCBYPASS", "Memory", 0xfffffc20, 4, base=16, bitRange=1 +sfr = "PMC_MOR.OSCOUNT", "Memory", 0xfffffc20, 4, base=16, bitRange=8-15 +sfr = "PMC_MCFR", "Memory", 0xfffffc24, 4, base=16 +sfr = "PMC_MCFR.MAINF", "Memory", 0xfffffc24, 4, base=16, bitRange=0-15 +sfr = "PMC_MCFR.MAINRDY", "Memory", 0xfffffc24, 4, base=16, bitRange=16 +sfr = "PMC_PLLR", "Memory", 0xfffffc2c, 4, base=16 +sfr = "PMC_PLLR.DIV", "Memory", 0xfffffc2c, 4, base=16, bitRange=0-7 +sfr = "PMC_PLLR.PLLCOUNT", "Memory", 0xfffffc2c, 4, base=16, bitRange=8-13 +sfr = "PMC_PLLR.OUT", "Memory", 0xfffffc2c, 4, base=16, bitRange=14-15 +sfr = "PMC_PLLR.MUL", "Memory", 0xfffffc2c, 4, base=16, bitRange=16-26 +sfr = "PMC_PLLR.USBDIV", "Memory", 0xfffffc2c, 4, base=16, bitRange=28-29 +sfr = "PMC_MCKR", "Memory", 0xfffffc30, 4, base=16 +sfr = "PMC_MCKR.CSS", "Memory", 0xfffffc30, 4, base=16, bitRange=0-1 +sfr = "PMC_MCKR.PRES", "Memory", 0xfffffc30, 4, base=16, bitRange=2-4 +sfr = "PMC_PCKR", "Memory", 0xfffffc40, 4, base=16 +sfr = "PMC_PCKR.CSS", "Memory", 0xfffffc40, 4, base=16, bitRange=0-1 +sfr = "PMC_PCKR.PRES", "Memory", 0xfffffc40, 4, base=16, bitRange=2-4 +sfr = "PMC_IER", "Memory", 0xfffffc60, 4, base=16 +sfr = "PMC_IER.MOSCS", "Memory", 0xfffffc60, 4, base=16, bitRange=0 +sfr = "PMC_IER.LOCK", "Memory", 0xfffffc60, 4, base=16, bitRange=2 +sfr = "PMC_IER.MCKRDY", "Memory", 0xfffffc60, 4, base=16, bitRange=3 +sfr = "PMC_IER.PCK0RDY", "Memory", 0xfffffc60, 4, base=16, bitRange=8 +sfr = "PMC_IER.PCK1RDY", "Memory", 0xfffffc60, 4, base=16, bitRange=9 +sfr = "PMC_IER.PCK2RDY", "Memory", 0xfffffc60, 4, base=16, bitRange=10 +sfr = "PMC_IER.PCK3RDY", "Memory", 0xfffffc60, 4, base=16, bitRange=11 +sfr = "PMC_IDR", "Memory", 0xfffffc64, 4, base=16 +sfr = "PMC_IDR.MOSCS", "Memory", 0xfffffc64, 4, base=16, bitRange=0 +sfr = "PMC_IDR.LOCK", "Memory", 0xfffffc64, 4, base=16, bitRange=2 +sfr = "PMC_IDR.MCKRDY", "Memory", 0xfffffc64, 4, base=16, bitRange=3 +sfr = "PMC_IDR.PCK0RDY", "Memory", 0xfffffc64, 4, base=16, bitRange=8 +sfr = "PMC_IDR.PCK1RDY", "Memory", 0xfffffc64, 4, base=16, bitRange=9 +sfr = "PMC_IDR.PCK2RDY", "Memory", 0xfffffc64, 4, base=16, bitRange=10 +sfr = "PMC_IDR.PCK3RDY", "Memory", 0xfffffc64, 4, base=16, bitRange=11 +sfr = "PMC_SR", "Memory", 0xfffffc68, 4, base=16 +sfr = "PMC_SR.MOSCS", "Memory", 0xfffffc68, 4, base=16, bitRange=0 +sfr = "PMC_SR.LOCK", "Memory", 0xfffffc68, 4, base=16, bitRange=2 +sfr = "PMC_SR.MCKRDY", "Memory", 0xfffffc68, 4, base=16, bitRange=3 +sfr = "PMC_SR.PCK0RDY", "Memory", 0xfffffc68, 4, base=16, bitRange=8 +sfr = "PMC_SR.PCK1RDY", "Memory", 0xfffffc68, 4, base=16, bitRange=9 +sfr = "PMC_SR.PCK2RDY", "Memory", 0xfffffc68, 4, base=16, bitRange=10 +sfr = "PMC_SR.PCK3RDY", "Memory", 0xfffffc68, 4, base=16, bitRange=11 +sfr = "PMC_IMR", "Memory", 0xfffffc6c, 4, base=16 +sfr = "PMC_IMR.MOSCS", "Memory", 0xfffffc6c, 4, base=16, bitRange=0 +sfr = "PMC_IMR.LOCK", "Memory", 0xfffffc6c, 4, base=16, bitRange=2 +sfr = "PMC_IMR.MCKRDY", "Memory", 0xfffffc6c, 4, base=16, bitRange=3 +sfr = "PMC_IMR.PCK0RDY", "Memory", 0xfffffc6c, 4, base=16, bitRange=8 +sfr = "PMC_IMR.PCK1RDY", "Memory", 0xfffffc6c, 4, base=16, bitRange=9 +sfr = "PMC_IMR.PCK2RDY", "Memory", 0xfffffc6c, 4, base=16, bitRange=10 +sfr = "PMC_IMR.PCK3RDY", "Memory", 0xfffffc6c, 4, base=16, bitRange=11 +; ========== Register definition for RSTC peripheral ========== +sfr = "RSTC_RCR", "Memory", 0xfffffd00, 4, base=16 +sfr = "RSTC_RCR.PROCRST", "Memory", 0xfffffd00, 4, base=16, bitRange=0 +sfr = "RSTC_RCR.PERRST", "Memory", 0xfffffd00, 4, base=16, bitRange=2 +sfr = "RSTC_RCR.EXTRST", "Memory", 0xfffffd00, 4, base=16, bitRange=3 +sfr = "RSTC_RCR.KEY", "Memory", 0xfffffd00, 4, base=16, bitRange=24-31 +sfr = "RSTC_RSR", "Memory", 0xfffffd04, 4, base=16 +sfr = "RSTC_RSR.URSTS", "Memory", 0xfffffd04, 4, base=16, bitRange=0 +sfr = "RSTC_RSR.BODSTS", "Memory", 0xfffffd04, 4, base=16, bitRange=1 +sfr = "RSTC_RSR.RSTTYP", "Memory", 0xfffffd04, 4, base=16, bitRange=8-10 +sfr = "RSTC_RSR.NRSTL", "Memory", 0xfffffd04, 4, base=16, bitRange=16 +sfr = "RSTC_RSR.SRCMP", "Memory", 0xfffffd04, 4, base=16, bitRange=17 +sfr = "RSTC_RMR", "Memory", 0xfffffd08, 4, base=16 +sfr = "RSTC_RMR.URSTEN", "Memory", 0xfffffd08, 4, base=16, bitRange=0 +sfr = "RSTC_RMR.URSTIEN", "Memory", 0xfffffd08, 4, base=16, bitRange=4 +sfr = "RSTC_RMR.ERSTL", "Memory", 0xfffffd08, 4, base=16, bitRange=8-11 +sfr = "RSTC_RMR.BODIEN", "Memory", 0xfffffd08, 4, base=16, bitRange=16 +sfr = "RSTC_RMR.KEY", "Memory", 0xfffffd08, 4, base=16, bitRange=24-31 +; ========== Register definition for RTTC peripheral ========== +sfr = "RTTC_RTMR", "Memory", 0xfffffd20, 4, base=16 +sfr = "RTTC_RTMR.RTPRES", "Memory", 0xfffffd20, 4, base=16, bitRange=0-15 +sfr = "RTTC_RTMR.ALMIEN", "Memory", 0xfffffd20, 4, base=16, bitRange=16 +sfr = "RTTC_RTMR.RTTINCIEN", "Memory", 0xfffffd20, 4, base=16, bitRange=17 +sfr = "RTTC_RTMR.RTTRST", "Memory", 0xfffffd20, 4, base=16, bitRange=18 +sfr = "RTTC_RTAR", "Memory", 0xfffffd24, 4, base=16 +sfr = "RTTC_RTAR.ALMV", "Memory", 0xfffffd24, 4, base=16, bitRange=0-31 +sfr = "RTTC_RTVR", "Memory", 0xfffffd28, 4, base=16 +sfr = "RTTC_RTVR.CRTV", "Memory", 0xfffffd28, 4, base=16, bitRange=0-31 +sfr = "RTTC_RTSR", "Memory", 0xfffffd2c, 4, base=16 +sfr = "RTTC_RTSR.ALMS", "Memory", 0xfffffd2c, 4, base=16, bitRange=0 +sfr = "RTTC_RTSR.RTTINC", "Memory", 0xfffffd2c, 4, base=16, bitRange=1 +; ========== Register definition for PITC peripheral ========== +sfr = "PITC_PIMR", "Memory", 0xfffffd30, 4, base=16 +sfr = "PITC_PIMR.PIV", "Memory", 0xfffffd30, 4, base=16, bitRange=0-19 +sfr = "PITC_PIMR.PITEN", "Memory", 0xfffffd30, 4, base=16, bitRange=24 +sfr = "PITC_PIMR.PITIEN", "Memory", 0xfffffd30, 4, base=16, bitRange=25 +sfr = "PITC_PISR", "Memory", 0xfffffd34, 4, base=16 +sfr = "PITC_PISR.PITS", "Memory", 0xfffffd34, 4, base=16, bitRange=0 +sfr = "PITC_PIVR", "Memory", 0xfffffd38, 4, base=16 +sfr = "PITC_PIVR.CPIV", "Memory", 0xfffffd38, 4, base=16, bitRange=0-19 +sfr = "PITC_PIVR.PICNT", "Memory", 0xfffffd38, 4, base=16, bitRange=20-31 +sfr = "PITC_PIIR", "Memory", 0xfffffd3c, 4, base=16 +sfr = "PITC_PIIR.CPIV", "Memory", 0xfffffd3c, 4, base=16, bitRange=0-19 +sfr = "PITC_PIIR.PICNT", "Memory", 0xfffffd3c, 4, base=16, bitRange=20-31 +; ========== Register definition for WDTC peripheral ========== +sfr = "WDTC_WDCR", "Memory", 0xfffffd40, 4, base=16 +sfr = "WDTC_WDCR.WDRSTT", "Memory", 0xfffffd40, 4, base=16, bitRange=0 +sfr = "WDTC_WDCR.KEY", "Memory", 0xfffffd40, 4, base=16, bitRange=24-31 +sfr = "WDTC_WDMR", "Memory", 0xfffffd44, 4, base=16 +sfr = "WDTC_WDMR.WDV", "Memory", 0xfffffd44, 4, base=16, bitRange=0-11 +sfr = "WDTC_WDMR.WDFIEN", "Memory", 0xfffffd44, 4, base=16, bitRange=12 +sfr = "WDTC_WDMR.WDRSTEN", "Memory", 0xfffffd44, 4, base=16, bitRange=13 +sfr = "WDTC_WDMR.WDRPROC", "Memory", 0xfffffd44, 4, base=16, bitRange=14 +sfr = "WDTC_WDMR.WDDIS", "Memory", 0xfffffd44, 4, base=16, bitRange=15 +sfr = "WDTC_WDMR.WDD", "Memory", 0xfffffd44, 4, base=16, bitRange=16-27 +sfr = "WDTC_WDMR.WDDBGHLT", "Memory", 0xfffffd44, 4, base=16, bitRange=28 +sfr = "WDTC_WDMR.WDIDLEHLT", "Memory", 0xfffffd44, 4, base=16, bitRange=29 +sfr = "WDTC_WDSR", "Memory", 0xfffffd48, 4, base=16 +sfr = "WDTC_WDSR.WDUNF", "Memory", 0xfffffd48, 4, base=16, bitRange=0 +sfr = "WDTC_WDSR.WDERR", "Memory", 0xfffffd48, 4, base=16, bitRange=1 +; ========== Register definition for VREG peripheral ========== +sfr = "VREG_MR", "Memory", 0xfffffd60, 4, base=16 +sfr = "VREG_MR.PSTDBY", "Memory", 0xfffffd60, 4, base=16, bitRange=0 +; ========== Register definition for MC peripheral ========== +sfr = "MC_RCR", "Memory", 0xffffff00, 4, base=16 +sfr = "MC_RCR.RCB", "Memory", 0xffffff00, 4, base=16, bitRange=0 +sfr = "MC_ASR", "Memory", 0xffffff04, 4, base=16 +sfr = "MC_ASR.UNDADD", "Memory", 0xffffff04, 4, base=16, bitRange=0 +sfr = "MC_ASR.MISADD", "Memory", 0xffffff04, 4, base=16, bitRange=1 +sfr = "MC_ASR.ABTSZ", "Memory", 0xffffff04, 4, base=16, bitRange=8-9 +sfr = "MC_ASR.ABTTYP", "Memory", 0xffffff04, 4, base=16, bitRange=10-11 +sfr = "MC_ASR.MST0", "Memory", 0xffffff04, 4, base=16, bitRange=16 +sfr = "MC_ASR.MST1", "Memory", 0xffffff04, 4, base=16, bitRange=17 +sfr = "MC_ASR.SVMST0", "Memory", 0xffffff04, 4, base=16, bitRange=24 +sfr = "MC_ASR.SVMST1", "Memory", 0xffffff04, 4, base=16, bitRange=25 +sfr = "MC_AASR", "Memory", 0xffffff08, 4, base=16 +sfr = "MC_FMR", "Memory", 0xffffff60, 4, base=16 +sfr = "MC_FMR.FRDY", "Memory", 0xffffff60, 4, base=16, bitRange=0 +sfr = "MC_FMR.LOCKE", "Memory", 0xffffff60, 4, base=16, bitRange=2 +sfr = "MC_FMR.PROGE", "Memory", 0xffffff60, 4, base=16, bitRange=3 +sfr = "MC_FMR.NEBP", "Memory", 0xffffff60, 4, base=16, bitRange=7 +sfr = "MC_FMR.FWS", "Memory", 0xffffff60, 4, base=16, bitRange=8-9 +sfr = "MC_FMR.FMCN", "Memory", 0xffffff60, 4, base=16, bitRange=16-23 +sfr = "MC_FCR", "Memory", 0xffffff64, 4, base=16 +sfr = "MC_FCR.FCMD", "Memory", 0xffffff64, 4, base=16, bitRange=0-3 +sfr = "MC_FCR.PAGEN", "Memory", 0xffffff64, 4, base=16, bitRange=8-17 +sfr = "MC_FCR.KEY", "Memory", 0xffffff64, 4, base=16, bitRange=24-31 +sfr = "MC_FSR", "Memory", 0xffffff68, 4, base=16 +sfr = "MC_FSR.FRDY", "Memory", 0xffffff68, 4, base=16, bitRange=0 +sfr = "MC_FSR.LOCKE", "Memory", 0xffffff68, 4, base=16, bitRange=2 +sfr = "MC_FSR.PROGE", "Memory", 0xffffff68, 4, base=16, bitRange=3 +sfr = "MC_FSR.SECURITY", "Memory", 0xffffff68, 4, base=16, bitRange=4 +sfr = "MC_FSR.GPNVM0", "Memory", 0xffffff68, 4, base=16, bitRange=8 +sfr = "MC_FSR.GPNVM1", "Memory", 0xffffff68, 4, base=16, bitRange=9 +sfr = "MC_FSR.GPNVM2", "Memory", 0xffffff68, 4, base=16, bitRange=10 +sfr = "MC_FSR.GPNVM3", "Memory", 0xffffff68, 4, base=16, bitRange=11 +sfr = "MC_FSR.GPNVM4", "Memory", 0xffffff68, 4, base=16, bitRange=12 +sfr = "MC_FSR.GPNVM5", "Memory", 0xffffff68, 4, base=16, bitRange=13 +sfr = "MC_FSR.GPNVM6", "Memory", 0xffffff68, 4, base=16, bitRange=14 +sfr = "MC_FSR.GPNVM7", "Memory", 0xffffff68, 4, base=16, bitRange=15 +sfr = "MC_FSR.LOCKS0", "Memory", 0xffffff68, 4, base=16, bitRange=16 +sfr = "MC_FSR.LOCKS1", "Memory", 0xffffff68, 4, base=16, bitRange=17 +sfr = "MC_FSR.LOCKS2", "Memory", 0xffffff68, 4, base=16, bitRange=18 +sfr = "MC_FSR.LOCKS3", "Memory", 0xffffff68, 4, base=16, bitRange=19 +sfr = "MC_FSR.LOCKS4", "Memory", 0xffffff68, 4, base=16, bitRange=20 +sfr = "MC_FSR.LOCKS5", "Memory", 0xffffff68, 4, base=16, bitRange=21 +sfr = "MC_FSR.LOCKS6", "Memory", 0xffffff68, 4, base=16, bitRange=22 +sfr = "MC_FSR.LOCKS7", "Memory", 0xffffff68, 4, base=16, bitRange=23 +sfr = "MC_FSR.LOCKS8", "Memory", 0xffffff68, 4, base=16, bitRange=24 +sfr = "MC_FSR.LOCKS9", "Memory", 0xffffff68, 4, base=16, bitRange=25 +sfr = "MC_FSR.LOCKS10", "Memory", 0xffffff68, 4, base=16, bitRange=26 +sfr = "MC_FSR.LOCKS11", "Memory", 0xffffff68, 4, base=16, bitRange=27 +sfr = "MC_FSR.LOCKS12", "Memory", 0xffffff68, 4, base=16, bitRange=28 +sfr = "MC_FSR.LOCKS13", "Memory", 0xffffff68, 4, base=16, bitRange=29 +sfr = "MC_FSR.LOCKS14", "Memory", 0xffffff68, 4, base=16, bitRange=30 +sfr = "MC_FSR.LOCKS15", "Memory", 0xffffff68, 4, base=16, bitRange=31 +; ========== Register definition for PDC_SPI1 peripheral ========== +sfr = "SPI1_RPR", "Memory", 0xfffe4100, 4, base=16 +sfr = "SPI1_RCR", "Memory", 0xfffe4104, 4, base=16 +sfr = "SPI1_TPR", "Memory", 0xfffe4108, 4, base=16 +sfr = "SPI1_TCR", "Memory", 0xfffe410c, 4, base=16 +sfr = "SPI1_RNPR", "Memory", 0xfffe4110, 4, base=16 +sfr = "SPI1_RNCR", "Memory", 0xfffe4114, 4, base=16 +sfr = "SPI1_TNPR", "Memory", 0xfffe4118, 4, base=16 +sfr = "SPI1_TNCR", "Memory", 0xfffe411c, 4, base=16 +sfr = "SPI1_PTCR", "Memory", 0xfffe4120, 4, base=16 +sfr = "SPI1_PTCR.RXTEN", "Memory", 0xfffe4120, 4, base=16, bitRange=0 +sfr = "SPI1_PTCR.RXTDIS", "Memory", 0xfffe4120, 4, base=16, bitRange=1 +sfr = "SPI1_PTCR.TXTEN", "Memory", 0xfffe4120, 4, base=16, bitRange=8 +sfr = "SPI1_PTCR.TXTDIS", "Memory", 0xfffe4120, 4, base=16, bitRange=9 +sfr = "SPI1_PTSR", "Memory", 0xfffe4124, 4, base=16 +sfr = "SPI1_PTSR.RXTEN", "Memory", 0xfffe4124, 4, base=16, bitRange=0 +sfr = "SPI1_PTSR.TXTEN", "Memory", 0xfffe4124, 4, base=16, bitRange=8 +; ========== Register definition for SPI1 peripheral ========== +sfr = "SPI1_CR", "Memory", 0xfffe4000, 4, base=16 +sfr = "SPI1_CR.SPIEN", "Memory", 0xfffe4000, 4, base=16, bitRange=0 +sfr = "SPI1_CR.SPIDIS", "Memory", 0xfffe4000, 4, base=16, bitRange=1 +sfr = "SPI1_CR.SWRST", "Memory", 0xfffe4000, 4, base=16, bitRange=7 +sfr = "SPI1_CR.LASTXFER", "Memory", 0xfffe4000, 4, base=16, bitRange=24 +sfr = "SPI1_MR", "Memory", 0xfffe4004, 4, base=16 +sfr = "SPI1_MR.MSTR", "Memory", 0xfffe4004, 4, base=16, bitRange=0 +sfr = "SPI1_MR.PS", "Memory", 0xfffe4004, 4, base=16, bitRange=1 +sfr = "SPI1_MR.PCSDEC", "Memory", 0xfffe4004, 4, base=16, bitRange=2 +sfr = "SPI1_MR.FDIV", "Memory", 0xfffe4004, 4, base=16, bitRange=3 +sfr = "SPI1_MR.MODFDIS", "Memory", 0xfffe4004, 4, base=16, bitRange=4 +sfr = "SPI1_MR.LLB", "Memory", 0xfffe4004, 4, base=16, bitRange=7 +sfr = "SPI1_MR.PCS", "Memory", 0xfffe4004, 4, base=16, bitRange=16-19 +sfr = "SPI1_MR.DLYBCS", "Memory", 0xfffe4004, 4, base=16, bitRange=24-31 +sfr = "SPI1_RDR", "Memory", 0xfffe4008, 4, base=16 +sfr = "SPI1_RDR.RD", "Memory", 0xfffe4008, 4, base=16, bitRange=0-15 +sfr = "SPI1_RDR.RPCS", "Memory", 0xfffe4008, 4, base=16, bitRange=16-19 +sfr = "SPI1_TDR", "Memory", 0xfffe400c, 4, base=16 +sfr = "SPI1_TDR.TD", "Memory", 0xfffe400c, 4, base=16, bitRange=0-15 +sfr = "SPI1_TDR.TPCS", "Memory", 0xfffe400c, 4, base=16, bitRange=16-19 +sfr = "SPI1_TDR.LASTXFER", "Memory", 0xfffe400c, 4, base=16, bitRange=24 +sfr = "SPI1_SR", "Memory", 0xfffe4010, 4, base=16 +sfr = "SPI1_SR.RDRF", "Memory", 0xfffe4010, 4, base=16, bitRange=0 +sfr = "SPI1_SR.TDRE", "Memory", 0xfffe4010, 4, base=16, bitRange=1 +sfr = "SPI1_SR.MODF", "Memory", 0xfffe4010, 4, base=16, bitRange=2 +sfr = "SPI1_SR.OVRES", "Memory", 0xfffe4010, 4, base=16, bitRange=3 +sfr = "SPI1_SR.ENDRX", "Memory", 0xfffe4010, 4, base=16, bitRange=4 +sfr = "SPI1_SR.ENDTX", "Memory", 0xfffe4010, 4, base=16, bitRange=5 +sfr = "SPI1_SR.RXBUFF", "Memory", 0xfffe4010, 4, base=16, bitRange=6 +sfr = "SPI1_SR.TXBUFE", "Memory", 0xfffe4010, 4, base=16, bitRange=7 +sfr = "SPI1_SR.NSSR", "Memory", 0xfffe4010, 4, base=16, bitRange=8 +sfr = "SPI1_SR.TXEMPTY", "Memory", 0xfffe4010, 4, base=16, bitRange=9 +sfr = "SPI1_SR.SPIENS", "Memory", 0xfffe4010, 4, base=16, bitRange=16 +sfr = "SPI1_IER", "Memory", 0xfffe4014, 4, base=16 +sfr = "SPI1_IER.RDRF", "Memory", 0xfffe4014, 4, base=16, bitRange=0 +sfr = "SPI1_IER.TDRE", "Memory", 0xfffe4014, 4, base=16, bitRange=1 +sfr = "SPI1_IER.MODF", "Memory", 0xfffe4014, 4, base=16, bitRange=2 +sfr = "SPI1_IER.OVRES", "Memory", 0xfffe4014, 4, base=16, bitRange=3 +sfr = "SPI1_IER.ENDRX", "Memory", 0xfffe4014, 4, base=16, bitRange=4 +sfr = "SPI1_IER.ENDTX", "Memory", 0xfffe4014, 4, base=16, bitRange=5 +sfr = "SPI1_IER.RXBUFF", "Memory", 0xfffe4014, 4, base=16, bitRange=6 +sfr = "SPI1_IER.TXBUFE", "Memory", 0xfffe4014, 4, base=16, bitRange=7 +sfr = "SPI1_IER.NSSR", "Memory", 0xfffe4014, 4, base=16, bitRange=8 +sfr = "SPI1_IER.TXEMPTY", "Memory", 0xfffe4014, 4, base=16, bitRange=9 +sfr = "SPI1_IDR", "Memory", 0xfffe4018, 4, base=16 +sfr = "SPI1_IDR.RDRF", "Memory", 0xfffe4018, 4, base=16, bitRange=0 +sfr = "SPI1_IDR.TDRE", "Memory", 0xfffe4018, 4, base=16, bitRange=1 +sfr = "SPI1_IDR.MODF", "Memory", 0xfffe4018, 4, base=16, bitRange=2 +sfr = "SPI1_IDR.OVRES", "Memory", 0xfffe4018, 4, base=16, bitRange=3 +sfr = "SPI1_IDR.ENDRX", "Memory", 0xfffe4018, 4, base=16, bitRange=4 +sfr = "SPI1_IDR.ENDTX", "Memory", 0xfffe4018, 4, base=16, bitRange=5 +sfr = "SPI1_IDR.RXBUFF", "Memory", 0xfffe4018, 4, base=16, bitRange=6 +sfr = "SPI1_IDR.TXBUFE", "Memory", 0xfffe4018, 4, base=16, bitRange=7 +sfr = "SPI1_IDR.NSSR", "Memory", 0xfffe4018, 4, base=16, bitRange=8 +sfr = "SPI1_IDR.TXEMPTY", "Memory", 0xfffe4018, 4, base=16, bitRange=9 +sfr = "SPI1_IMR", "Memory", 0xfffe401c, 4, base=16 +sfr = "SPI1_IMR.RDRF", "Memory", 0xfffe401c, 4, base=16, bitRange=0 +sfr = "SPI1_IMR.TDRE", "Memory", 0xfffe401c, 4, base=16, bitRange=1 +sfr = "SPI1_IMR.MODF", "Memory", 0xfffe401c, 4, base=16, bitRange=2 +sfr = "SPI1_IMR.OVRES", "Memory", 0xfffe401c, 4, base=16, bitRange=3 +sfr = "SPI1_IMR.ENDRX", "Memory", 0xfffe401c, 4, base=16, bitRange=4 +sfr = "SPI1_IMR.ENDTX", "Memory", 0xfffe401c, 4, base=16, bitRange=5 +sfr = "SPI1_IMR.RXBUFF", "Memory", 0xfffe401c, 4, base=16, bitRange=6 +sfr = "SPI1_IMR.TXBUFE", "Memory", 0xfffe401c, 4, base=16, bitRange=7 +sfr = "SPI1_IMR.NSSR", "Memory", 0xfffe401c, 4, base=16, bitRange=8 +sfr = "SPI1_IMR.TXEMPTY", "Memory", 0xfffe401c, 4, base=16, bitRange=9 +sfr = "SPI1_CSR", "Memory", 0xfffe4030, 4, base=16 +sfr = "SPI1_CSR.CPOL", "Memory", 0xfffe4030, 4, base=16, bitRange=0 +sfr = "SPI1_CSR.NCPHA", "Memory", 0xfffe4030, 4, base=16, bitRange=1 +sfr = "SPI1_CSR.CSAAT", "Memory", 0xfffe4030, 4, base=16, bitRange=3 +sfr = "SPI1_CSR.BITS", "Memory", 0xfffe4030, 4, base=16, bitRange=4-7 +sfr = "SPI1_CSR.SCBR", "Memory", 0xfffe4030, 4, base=16, bitRange=8-15 +sfr = "SPI1_CSR.DLYBS", "Memory", 0xfffe4030, 4, base=16, bitRange=16-23 +sfr = "SPI1_CSR.DLYBCT", "Memory", 0xfffe4030, 4, base=16, bitRange=24-31 +; ========== Register definition for PDC_SPI0 peripheral ========== +sfr = "SPI0_RPR", "Memory", 0xfffe0100, 4, base=16 +sfr = "SPI0_RCR", "Memory", 0xfffe0104, 4, base=16 +sfr = "SPI0_TPR", "Memory", 0xfffe0108, 4, base=16 +sfr = "SPI0_TCR", "Memory", 0xfffe010c, 4, base=16 +sfr = "SPI0_RNPR", "Memory", 0xfffe0110, 4, base=16 +sfr = "SPI0_RNCR", "Memory", 0xfffe0114, 4, base=16 +sfr = "SPI0_TNPR", "Memory", 0xfffe0118, 4, base=16 +sfr = "SPI0_TNCR", "Memory", 0xfffe011c, 4, base=16 +sfr = "SPI0_PTCR", "Memory", 0xfffe0120, 4, base=16 +sfr = "SPI0_PTCR.RXTEN", "Memory", 0xfffe0120, 4, base=16, bitRange=0 +sfr = "SPI0_PTCR.RXTDIS", "Memory", 0xfffe0120, 4, base=16, bitRange=1 +sfr = "SPI0_PTCR.TXTEN", "Memory", 0xfffe0120, 4, base=16, bitRange=8 +sfr = "SPI0_PTCR.TXTDIS", "Memory", 0xfffe0120, 4, base=16, bitRange=9 +sfr = "SPI0_PTSR", "Memory", 0xfffe0124, 4, base=16 +sfr = "SPI0_PTSR.RXTEN", "Memory", 0xfffe0124, 4, base=16, bitRange=0 +sfr = "SPI0_PTSR.TXTEN", "Memory", 0xfffe0124, 4, base=16, bitRange=8 +; ========== Register definition for SPI0 peripheral ========== +sfr = "SPI0_CR", "Memory", 0xfffe0000, 4, base=16 +sfr = "SPI0_CR.SPIEN", "Memory", 0xfffe0000, 4, base=16, bitRange=0 +sfr = "SPI0_CR.SPIDIS", "Memory", 0xfffe0000, 4, base=16, bitRange=1 +sfr = "SPI0_CR.SWRST", "Memory", 0xfffe0000, 4, base=16, bitRange=7 +sfr = "SPI0_CR.LASTXFER", "Memory", 0xfffe0000, 4, base=16, bitRange=24 +sfr = "SPI0_MR", "Memory", 0xfffe0004, 4, base=16 +sfr = "SPI0_MR.MSTR", "Memory", 0xfffe0004, 4, base=16, bitRange=0 +sfr = "SPI0_MR.PS", "Memory", 0xfffe0004, 4, base=16, bitRange=1 +sfr = "SPI0_MR.PCSDEC", "Memory", 0xfffe0004, 4, base=16, bitRange=2 +sfr = "SPI0_MR.FDIV", "Memory", 0xfffe0004, 4, base=16, bitRange=3 +sfr = "SPI0_MR.MODFDIS", "Memory", 0xfffe0004, 4, base=16, bitRange=4 +sfr = "SPI0_MR.LLB", "Memory", 0xfffe0004, 4, base=16, bitRange=7 +sfr = "SPI0_MR.PCS", "Memory", 0xfffe0004, 4, base=16, bitRange=16-19 +sfr = "SPI0_MR.DLYBCS", "Memory", 0xfffe0004, 4, base=16, bitRange=24-31 +sfr = "SPI0_RDR", "Memory", 0xfffe0008, 4, base=16 +sfr = "SPI0_RDR.RD", "Memory", 0xfffe0008, 4, base=16, bitRange=0-15 +sfr = "SPI0_RDR.RPCS", "Memory", 0xfffe0008, 4, base=16, bitRange=16-19 +sfr = "SPI0_TDR", "Memory", 0xfffe000c, 4, base=16 +sfr = "SPI0_TDR.TD", "Memory", 0xfffe000c, 4, base=16, bitRange=0-15 +sfr = "SPI0_TDR.TPCS", "Memory", 0xfffe000c, 4, base=16, bitRange=16-19 +sfr = "SPI0_TDR.LASTXFER", "Memory", 0xfffe000c, 4, base=16, bitRange=24 +sfr = "SPI0_SR", "Memory", 0xfffe0010, 4, base=16 +sfr = "SPI0_SR.RDRF", "Memory", 0xfffe0010, 4, base=16, bitRange=0 +sfr = "SPI0_SR.TDRE", "Memory", 0xfffe0010, 4, base=16, bitRange=1 +sfr = "SPI0_SR.MODF", "Memory", 0xfffe0010, 4, base=16, bitRange=2 +sfr = "SPI0_SR.OVRES", "Memory", 0xfffe0010, 4, base=16, bitRange=3 +sfr = "SPI0_SR.ENDRX", "Memory", 0xfffe0010, 4, base=16, bitRange=4 +sfr = "SPI0_SR.ENDTX", "Memory", 0xfffe0010, 4, base=16, bitRange=5 +sfr = "SPI0_SR.RXBUFF", "Memory", 0xfffe0010, 4, base=16, bitRange=6 +sfr = "SPI0_SR.TXBUFE", "Memory", 0xfffe0010, 4, base=16, bitRange=7 +sfr = "SPI0_SR.NSSR", "Memory", 0xfffe0010, 4, base=16, bitRange=8 +sfr = "SPI0_SR.TXEMPTY", "Memory", 0xfffe0010, 4, base=16, bitRange=9 +sfr = "SPI0_SR.SPIENS", "Memory", 0xfffe0010, 4, base=16, bitRange=16 +sfr = "SPI0_IER", "Memory", 0xfffe0014, 4, base=16 +sfr = "SPI0_IER.RDRF", "Memory", 0xfffe0014, 4, base=16, bitRange=0 +sfr = "SPI0_IER.TDRE", "Memory", 0xfffe0014, 4, base=16, bitRange=1 +sfr = "SPI0_IER.MODF", "Memory", 0xfffe0014, 4, base=16, bitRange=2 +sfr = "SPI0_IER.OVRES", "Memory", 0xfffe0014, 4, base=16, bitRange=3 +sfr = "SPI0_IER.ENDRX", "Memory", 0xfffe0014, 4, base=16, bitRange=4 +sfr = "SPI0_IER.ENDTX", "Memory", 0xfffe0014, 4, base=16, bitRange=5 +sfr = "SPI0_IER.RXBUFF", "Memory", 0xfffe0014, 4, base=16, bitRange=6 +sfr = "SPI0_IER.TXBUFE", "Memory", 0xfffe0014, 4, base=16, bitRange=7 +sfr = "SPI0_IER.NSSR", "Memory", 0xfffe0014, 4, base=16, bitRange=8 +sfr = "SPI0_IER.TXEMPTY", "Memory", 0xfffe0014, 4, base=16, bitRange=9 +sfr = "SPI0_IDR", "Memory", 0xfffe0018, 4, base=16 +sfr = "SPI0_IDR.RDRF", "Memory", 0xfffe0018, 4, base=16, bitRange=0 +sfr = "SPI0_IDR.TDRE", "Memory", 0xfffe0018, 4, base=16, bitRange=1 +sfr = "SPI0_IDR.MODF", "Memory", 0xfffe0018, 4, base=16, bitRange=2 +sfr = "SPI0_IDR.OVRES", "Memory", 0xfffe0018, 4, base=16, bitRange=3 +sfr = "SPI0_IDR.ENDRX", "Memory", 0xfffe0018, 4, base=16, bitRange=4 +sfr = "SPI0_IDR.ENDTX", "Memory", 0xfffe0018, 4, base=16, bitRange=5 +sfr = "SPI0_IDR.RXBUFF", "Memory", 0xfffe0018, 4, base=16, bitRange=6 +sfr = "SPI0_IDR.TXBUFE", "Memory", 0xfffe0018, 4, base=16, bitRange=7 +sfr = "SPI0_IDR.NSSR", "Memory", 0xfffe0018, 4, base=16, bitRange=8 +sfr = "SPI0_IDR.TXEMPTY", "Memory", 0xfffe0018, 4, base=16, bitRange=9 +sfr = "SPI0_IMR", "Memory", 0xfffe001c, 4, base=16 +sfr = "SPI0_IMR.RDRF", "Memory", 0xfffe001c, 4, base=16, bitRange=0 +sfr = "SPI0_IMR.TDRE", "Memory", 0xfffe001c, 4, base=16, bitRange=1 +sfr = "SPI0_IMR.MODF", "Memory", 0xfffe001c, 4, base=16, bitRange=2 +sfr = "SPI0_IMR.OVRES", "Memory", 0xfffe001c, 4, base=16, bitRange=3 +sfr = "SPI0_IMR.ENDRX", "Memory", 0xfffe001c, 4, base=16, bitRange=4 +sfr = "SPI0_IMR.ENDTX", "Memory", 0xfffe001c, 4, base=16, bitRange=5 +sfr = "SPI0_IMR.RXBUFF", "Memory", 0xfffe001c, 4, base=16, bitRange=6 +sfr = "SPI0_IMR.TXBUFE", "Memory", 0xfffe001c, 4, base=16, bitRange=7 +sfr = "SPI0_IMR.NSSR", "Memory", 0xfffe001c, 4, base=16, bitRange=8 +sfr = "SPI0_IMR.TXEMPTY", "Memory", 0xfffe001c, 4, base=16, bitRange=9 +sfr = "SPI0_CSR", "Memory", 0xfffe0030, 4, base=16 +sfr = "SPI0_CSR.CPOL", "Memory", 0xfffe0030, 4, base=16, bitRange=0 +sfr = "SPI0_CSR.NCPHA", "Memory", 0xfffe0030, 4, base=16, bitRange=1 +sfr = "SPI0_CSR.CSAAT", "Memory", 0xfffe0030, 4, base=16, bitRange=3 +sfr = "SPI0_CSR.BITS", "Memory", 0xfffe0030, 4, base=16, bitRange=4-7 +sfr = "SPI0_CSR.SCBR", "Memory", 0xfffe0030, 4, base=16, bitRange=8-15 +sfr = "SPI0_CSR.DLYBS", "Memory", 0xfffe0030, 4, base=16, bitRange=16-23 +sfr = "SPI0_CSR.DLYBCT", "Memory", 0xfffe0030, 4, base=16, bitRange=24-31 +; ========== Register definition for PDC_US1 peripheral ========== +sfr = "US1_RPR", "Memory", 0xfffc4100, 4, base=16 +sfr = "US1_RCR", "Memory", 0xfffc4104, 4, base=16 +sfr = "US1_TPR", "Memory", 0xfffc4108, 4, base=16 +sfr = "US1_TCR", "Memory", 0xfffc410c, 4, base=16 +sfr = "US1_RNPR", "Memory", 0xfffc4110, 4, base=16 +sfr = "US1_RNCR", "Memory", 0xfffc4114, 4, base=16 +sfr = "US1_TNPR", "Memory", 0xfffc4118, 4, base=16 +sfr = "US1_TNCR", "Memory", 0xfffc411c, 4, base=16 +sfr = "US1_PTCR", "Memory", 0xfffc4120, 4, base=16 +sfr = "US1_PTCR.RXTEN", "Memory", 0xfffc4120, 4, base=16, bitRange=0 +sfr = "US1_PTCR.RXTDIS", "Memory", 0xfffc4120, 4, base=16, bitRange=1 +sfr = "US1_PTCR.TXTEN", "Memory", 0xfffc4120, 4, base=16, bitRange=8 +sfr = "US1_PTCR.TXTDIS", "Memory", 0xfffc4120, 4, base=16, bitRange=9 +sfr = "US1_PTSR", "Memory", 0xfffc4124, 4, base=16 +sfr = "US1_PTSR.RXTEN", "Memory", 0xfffc4124, 4, base=16, bitRange=0 +sfr = "US1_PTSR.TXTEN", "Memory", 0xfffc4124, 4, base=16, bitRange=8 +; ========== Register definition for US1 peripheral ========== +sfr = "US1_CR", "Memory", 0xfffc4000, 4, base=16 +sfr = "US1_CR.RSTRX", "Memory", 0xfffc4000, 4, base=16, bitRange=2 +sfr = "US1_CR.RSTTX", "Memory", 0xfffc4000, 4, base=16, bitRange=3 +sfr = "US1_CR.RXEN", "Memory", 0xfffc4000, 4, base=16, bitRange=4 +sfr = "US1_CR.RXDIS", "Memory", 0xfffc4000, 4, base=16, bitRange=5 +sfr = "US1_CR.TXEN", "Memory", 0xfffc4000, 4, base=16, bitRange=6 +sfr = "US1_CR.TXDIS", "Memory", 0xfffc4000, 4, base=16, bitRange=7 +sfr = "US1_CR.RSTSTA", "Memory", 0xfffc4000, 4, base=16, bitRange=8 +sfr = "US1_CR.STTBRK", "Memory", 0xfffc4000, 4, base=16, bitRange=9 +sfr = "US1_CR.STPBRK", "Memory", 0xfffc4000, 4, base=16, bitRange=10 +sfr = "US1_CR.STTTO", "Memory", 0xfffc4000, 4, base=16, bitRange=11 +sfr = "US1_CR.SENDA", "Memory", 0xfffc4000, 4, base=16, bitRange=12 +sfr = "US1_CR.RSTIT", "Memory", 0xfffc4000, 4, base=16, bitRange=13 +sfr = "US1_CR.RSTNACK", "Memory", 0xfffc4000, 4, base=16, bitRange=14 +sfr = "US1_CR.RETTO", "Memory", 0xfffc4000, 4, base=16, bitRange=15 +sfr = "US1_CR.DTREN", "Memory", 0xfffc4000, 4, base=16, bitRange=16 +sfr = "US1_CR.DTRDIS", "Memory", 0xfffc4000, 4, base=16, bitRange=17 +sfr = "US1_CR.RTSEN", "Memory", 0xfffc4000, 4, base=16, bitRange=18 +sfr = "US1_CR.RTSDIS", "Memory", 0xfffc4000, 4, base=16, bitRange=19 +sfr = "US1_MR", "Memory", 0xfffc4004, 4, base=16 +sfr = "US1_MR.USMODE", "Memory", 0xfffc4004, 4, base=16, bitRange=0-3 +sfr = "US1_MR.CLKS", "Memory", 0xfffc4004, 4, base=16, bitRange=4-5 +sfr = "US1_MR.CHRL", "Memory", 0xfffc4004, 4, base=16, bitRange=6-7 +sfr = "US1_MR.SYNC", "Memory", 0xfffc4004, 4, base=16, bitRange=8 +sfr = "US1_MR.PAR", "Memory", 0xfffc4004, 4, base=16, bitRange=9-11 +sfr = "US1_MR.NBSTOP", "Memory", 0xfffc4004, 4, base=16, bitRange=12-13 +sfr = "US1_MR.CHMODE", "Memory", 0xfffc4004, 4, base=16, bitRange=14-15 +sfr = "US1_MR.MSBF", "Memory", 0xfffc4004, 4, base=16, bitRange=16 +sfr = "US1_MR.MODE9", "Memory", 0xfffc4004, 4, base=16, bitRange=17 +sfr = "US1_MR.CKLO", "Memory", 0xfffc4004, 4, base=16, bitRange=18 +sfr = "US1_MR.OVER", "Memory", 0xfffc4004, 4, base=16, bitRange=19 +sfr = "US1_MR.INACK", "Memory", 0xfffc4004, 4, base=16, bitRange=20 +sfr = "US1_MR.DSNACK", "Memory", 0xfffc4004, 4, base=16, bitRange=21 +sfr = "US1_MR.ITER", "Memory", 0xfffc4004, 4, base=16, bitRange=24 +sfr = "US1_MR.FILTER", "Memory", 0xfffc4004, 4, base=16, bitRange=28 +sfr = "US1_IER", "Memory", 0xfffc4008, 4, base=16 +sfr = "US1_IER.RXRDY", "Memory", 0xfffc4008, 4, base=16, bitRange=0 +sfr = "US1_IER.TXRDY", "Memory", 0xfffc4008, 4, base=16, bitRange=1 +sfr = "US1_IER.RXBRK", "Memory", 0xfffc4008, 4, base=16, bitRange=2 +sfr = "US1_IER.ENDRX", "Memory", 0xfffc4008, 4, base=16, bitRange=3 +sfr = "US1_IER.ENDTX", "Memory", 0xfffc4008, 4, base=16, bitRange=4 +sfr = "US1_IER.OVRE", "Memory", 0xfffc4008, 4, base=16, bitRange=5 +sfr = "US1_IER.FRAME", "Memory", 0xfffc4008, 4, base=16, bitRange=6 +sfr = "US1_IER.PARE", "Memory", 0xfffc4008, 4, base=16, bitRange=7 +sfr = "US1_IER.TIMEOUT", "Memory", 0xfffc4008, 4, base=16, bitRange=8 +sfr = "US1_IER.TXEMPTY", "Memory", 0xfffc4008, 4, base=16, bitRange=9 +sfr = "US1_IER.ITERATION", "Memory", 0xfffc4008, 4, base=16, bitRange=10 +sfr = "US1_IER.TXBUFE", "Memory", 0xfffc4008, 4, base=16, bitRange=11 +sfr = "US1_IER.RXBUFF", "Memory", 0xfffc4008, 4, base=16, bitRange=12 +sfr = "US1_IER.NACK", "Memory", 0xfffc4008, 4, base=16, bitRange=13 +sfr = "US1_IER.RIIC", "Memory", 0xfffc4008, 4, base=16, bitRange=16 +sfr = "US1_IER.DSRIC", "Memory", 0xfffc4008, 4, base=16, bitRange=17 +sfr = "US1_IER.DCDIC", "Memory", 0xfffc4008, 4, base=16, bitRange=18 +sfr = "US1_IER.CTSIC", "Memory", 0xfffc4008, 4, base=16, bitRange=19 +sfr = "US1_IDR", "Memory", 0xfffc400c, 4, base=16 +sfr = "US1_IDR.RXRDY", "Memory", 0xfffc400c, 4, base=16, bitRange=0 +sfr = "US1_IDR.TXRDY", "Memory", 0xfffc400c, 4, base=16, bitRange=1 +sfr = "US1_IDR.RXBRK", "Memory", 0xfffc400c, 4, base=16, bitRange=2 +sfr = "US1_IDR.ENDRX", "Memory", 0xfffc400c, 4, base=16, bitRange=3 +sfr = "US1_IDR.ENDTX", "Memory", 0xfffc400c, 4, base=16, bitRange=4 +sfr = "US1_IDR.OVRE", "Memory", 0xfffc400c, 4, base=16, bitRange=5 +sfr = "US1_IDR.FRAME", "Memory", 0xfffc400c, 4, base=16, bitRange=6 +sfr = "US1_IDR.PARE", "Memory", 0xfffc400c, 4, base=16, bitRange=7 +sfr = "US1_IDR.TIMEOUT", "Memory", 0xfffc400c, 4, base=16, bitRange=8 +sfr = "US1_IDR.TXEMPTY", "Memory", 0xfffc400c, 4, base=16, bitRange=9 +sfr = "US1_IDR.ITERATION", "Memory", 0xfffc400c, 4, base=16, bitRange=10 +sfr = "US1_IDR.TXBUFE", "Memory", 0xfffc400c, 4, base=16, bitRange=11 +sfr = "US1_IDR.RXBUFF", "Memory", 0xfffc400c, 4, base=16, bitRange=12 +sfr = "US1_IDR.NACK", "Memory", 0xfffc400c, 4, base=16, bitRange=13 +sfr = "US1_IDR.RIIC", "Memory", 0xfffc400c, 4, base=16, bitRange=16 +sfr = "US1_IDR.DSRIC", "Memory", 0xfffc400c, 4, base=16, bitRange=17 +sfr = "US1_IDR.DCDIC", "Memory", 0xfffc400c, 4, base=16, bitRange=18 +sfr = "US1_IDR.CTSIC", "Memory", 0xfffc400c, 4, base=16, bitRange=19 +sfr = "US1_IMR", "Memory", 0xfffc4010, 4, base=16 +sfr = "US1_IMR.RXRDY", "Memory", 0xfffc4010, 4, base=16, bitRange=0 +sfr = "US1_IMR.TXRDY", "Memory", 0xfffc4010, 4, base=16, bitRange=1 +sfr = "US1_IMR.RXBRK", "Memory", 0xfffc4010, 4, base=16, bitRange=2 +sfr = "US1_IMR.ENDRX", "Memory", 0xfffc4010, 4, base=16, bitRange=3 +sfr = "US1_IMR.ENDTX", "Memory", 0xfffc4010, 4, base=16, bitRange=4 +sfr = "US1_IMR.OVRE", "Memory", 0xfffc4010, 4, base=16, bitRange=5 +sfr = "US1_IMR.FRAME", "Memory", 0xfffc4010, 4, base=16, bitRange=6 +sfr = "US1_IMR.PARE", "Memory", 0xfffc4010, 4, base=16, bitRange=7 +sfr = "US1_IMR.TIMEOUT", "Memory", 0xfffc4010, 4, base=16, bitRange=8 +sfr = "US1_IMR.TXEMPTY", "Memory", 0xfffc4010, 4, base=16, bitRange=9 +sfr = "US1_IMR.ITERATION", "Memory", 0xfffc4010, 4, base=16, bitRange=10 +sfr = "US1_IMR.TXBUFE", "Memory", 0xfffc4010, 4, base=16, bitRange=11 +sfr = "US1_IMR.RXBUFF", "Memory", 0xfffc4010, 4, base=16, bitRange=12 +sfr = "US1_IMR.NACK", "Memory", 0xfffc4010, 4, base=16, bitRange=13 +sfr = "US1_IMR.RIIC", "Memory", 0xfffc4010, 4, base=16, bitRange=16 +sfr = "US1_IMR.DSRIC", "Memory", 0xfffc4010, 4, base=16, bitRange=17 +sfr = "US1_IMR.DCDIC", "Memory", 0xfffc4010, 4, base=16, bitRange=18 +sfr = "US1_IMR.CTSIC", "Memory", 0xfffc4010, 4, base=16, bitRange=19 +sfr = "US1_CSR", "Memory", 0xfffc4014, 4, base=16 +sfr = "US1_CSR.RXRDY", "Memory", 0xfffc4014, 4, base=16, bitRange=0 +sfr = "US1_CSR.TXRDY", "Memory", 0xfffc4014, 4, base=16, bitRange=1 +sfr = "US1_CSR.RXBRK", "Memory", 0xfffc4014, 4, base=16, bitRange=2 +sfr = "US1_CSR.ENDRX", "Memory", 0xfffc4014, 4, base=16, bitRange=3 +sfr = "US1_CSR.ENDTX", "Memory", 0xfffc4014, 4, base=16, bitRange=4 +sfr = "US1_CSR.OVRE", "Memory", 0xfffc4014, 4, base=16, bitRange=5 +sfr = "US1_CSR.FRAME", "Memory", 0xfffc4014, 4, base=16, bitRange=6 +sfr = "US1_CSR.PARE", "Memory", 0xfffc4014, 4, base=16, bitRange=7 +sfr = "US1_CSR.TIMEOUT", "Memory", 0xfffc4014, 4, base=16, bitRange=8 +sfr = "US1_CSR.TXEMPTY", "Memory", 0xfffc4014, 4, base=16, bitRange=9 +sfr = "US1_CSR.ITERATION", "Memory", 0xfffc4014, 4, base=16, bitRange=10 +sfr = "US1_CSR.TXBUFE", "Memory", 0xfffc4014, 4, base=16, bitRange=11 +sfr = "US1_CSR.RXBUFF", "Memory", 0xfffc4014, 4, base=16, bitRange=12 +sfr = "US1_CSR.NACK", "Memory", 0xfffc4014, 4, base=16, bitRange=13 +sfr = "US1_CSR.RIIC", "Memory", 0xfffc4014, 4, base=16, bitRange=16 +sfr = "US1_CSR.DSRIC", "Memory", 0xfffc4014, 4, base=16, bitRange=17 +sfr = "US1_CSR.DCDIC", "Memory", 0xfffc4014, 4, base=16, bitRange=18 +sfr = "US1_CSR.CTSIC", "Memory", 0xfffc4014, 4, base=16, bitRange=19 +sfr = "US1_CSR.RI", "Memory", 0xfffc4014, 4, base=16, bitRange=20 +sfr = "US1_CSR.DSR", "Memory", 0xfffc4014, 4, base=16, bitRange=21 +sfr = "US1_CSR.DCD", "Memory", 0xfffc4014, 4, base=16, bitRange=22 +sfr = "US1_CSR.CTS", "Memory", 0xfffc4014, 4, base=16, bitRange=23 +sfr = "US1_RHR", "Memory", 0xfffc4018, 4, base=16 +sfr = "US1_THR", "Memory", 0xfffc401c, 4, base=16 +sfr = "US1_BRGR", "Memory", 0xfffc4020, 4, base=16 +sfr = "US1_RTOR", "Memory", 0xfffc4024, 4, base=16 +sfr = "US1_TTGR", "Memory", 0xfffc4028, 4, base=16 +sfr = "US1_FIDI", "Memory", 0xfffc4040, 4, base=16 +sfr = "US1_NER", "Memory", 0xfffc4044, 4, base=16 +sfr = "US1_IF", "Memory", 0xfffc404c, 4, base=16 +; ========== Register definition for PDC_US0 peripheral ========== +sfr = "US0_RPR", "Memory", 0xfffc0100, 4, base=16 +sfr = "US0_RCR", "Memory", 0xfffc0104, 4, base=16 +sfr = "US0_TPR", "Memory", 0xfffc0108, 4, base=16 +sfr = "US0_TCR", "Memory", 0xfffc010c, 4, base=16 +sfr = "US0_RNPR", "Memory", 0xfffc0110, 4, base=16 +sfr = "US0_RNCR", "Memory", 0xfffc0114, 4, base=16 +sfr = "US0_TNPR", "Memory", 0xfffc0118, 4, base=16 +sfr = "US0_TNCR", "Memory", 0xfffc011c, 4, base=16 +sfr = "US0_PTCR", "Memory", 0xfffc0120, 4, base=16 +sfr = "US0_PTCR.RXTEN", "Memory", 0xfffc0120, 4, base=16, bitRange=0 +sfr = "US0_PTCR.RXTDIS", "Memory", 0xfffc0120, 4, base=16, bitRange=1 +sfr = "US0_PTCR.TXTEN", "Memory", 0xfffc0120, 4, base=16, bitRange=8 +sfr = "US0_PTCR.TXTDIS", "Memory", 0xfffc0120, 4, base=16, bitRange=9 +sfr = "US0_PTSR", "Memory", 0xfffc0124, 4, base=16 +sfr = "US0_PTSR.RXTEN", "Memory", 0xfffc0124, 4, base=16, bitRange=0 +sfr = "US0_PTSR.TXTEN", "Memory", 0xfffc0124, 4, base=16, bitRange=8 +; ========== Register definition for US0 peripheral ========== +sfr = "US0_CR", "Memory", 0xfffc0000, 4, base=16 +sfr = "US0_CR.RSTRX", "Memory", 0xfffc0000, 4, base=16, bitRange=2 +sfr = "US0_CR.RSTTX", "Memory", 0xfffc0000, 4, base=16, bitRange=3 +sfr = "US0_CR.RXEN", "Memory", 0xfffc0000, 4, base=16, bitRange=4 +sfr = "US0_CR.RXDIS", "Memory", 0xfffc0000, 4, base=16, bitRange=5 +sfr = "US0_CR.TXEN", "Memory", 0xfffc0000, 4, base=16, bitRange=6 +sfr = "US0_CR.TXDIS", "Memory", 0xfffc0000, 4, base=16, bitRange=7 +sfr = "US0_CR.RSTSTA", "Memory", 0xfffc0000, 4, base=16, bitRange=8 +sfr = "US0_CR.STTBRK", "Memory", 0xfffc0000, 4, base=16, bitRange=9 +sfr = "US0_CR.STPBRK", "Memory", 0xfffc0000, 4, base=16, bitRange=10 +sfr = "US0_CR.STTTO", "Memory", 0xfffc0000, 4, base=16, bitRange=11 +sfr = "US0_CR.SENDA", "Memory", 0xfffc0000, 4, base=16, bitRange=12 +sfr = "US0_CR.RSTIT", "Memory", 0xfffc0000, 4, base=16, bitRange=13 +sfr = "US0_CR.RSTNACK", "Memory", 0xfffc0000, 4, base=16, bitRange=14 +sfr = "US0_CR.RETTO", "Memory", 0xfffc0000, 4, base=16, bitRange=15 +sfr = "US0_CR.DTREN", "Memory", 0xfffc0000, 4, base=16, bitRange=16 +sfr = "US0_CR.DTRDIS", "Memory", 0xfffc0000, 4, base=16, bitRange=17 +sfr = "US0_CR.RTSEN", "Memory", 0xfffc0000, 4, base=16, bitRange=18 +sfr = "US0_CR.RTSDIS", "Memory", 0xfffc0000, 4, base=16, bitRange=19 +sfr = "US0_MR", "Memory", 0xfffc0004, 4, base=16 +sfr = "US0_MR.USMODE", "Memory", 0xfffc0004, 4, base=16, bitRange=0-3 +sfr = "US0_MR.CLKS", "Memory", 0xfffc0004, 4, base=16, bitRange=4-5 +sfr = "US0_MR.CHRL", "Memory", 0xfffc0004, 4, base=16, bitRange=6-7 +sfr = "US0_MR.SYNC", "Memory", 0xfffc0004, 4, base=16, bitRange=8 +sfr = "US0_MR.PAR", "Memory", 0xfffc0004, 4, base=16, bitRange=9-11 +sfr = "US0_MR.NBSTOP", "Memory", 0xfffc0004, 4, base=16, bitRange=12-13 +sfr = "US0_MR.CHMODE", "Memory", 0xfffc0004, 4, base=16, bitRange=14-15 +sfr = "US0_MR.MSBF", "Memory", 0xfffc0004, 4, base=16, bitRange=16 +sfr = "US0_MR.MODE9", "Memory", 0xfffc0004, 4, base=16, bitRange=17 +sfr = "US0_MR.CKLO", "Memory", 0xfffc0004, 4, base=16, bitRange=18 +sfr = "US0_MR.OVER", "Memory", 0xfffc0004, 4, base=16, bitRange=19 +sfr = "US0_MR.INACK", "Memory", 0xfffc0004, 4, base=16, bitRange=20 +sfr = "US0_MR.DSNACK", "Memory", 0xfffc0004, 4, base=16, bitRange=21 +sfr = "US0_MR.ITER", "Memory", 0xfffc0004, 4, base=16, bitRange=24 +sfr = "US0_MR.FILTER", "Memory", 0xfffc0004, 4, base=16, bitRange=28 +sfr = "US0_IER", "Memory", 0xfffc0008, 4, base=16 +sfr = "US0_IER.RXRDY", "Memory", 0xfffc0008, 4, base=16, bitRange=0 +sfr = "US0_IER.TXRDY", "Memory", 0xfffc0008, 4, base=16, bitRange=1 +sfr = "US0_IER.RXBRK", "Memory", 0xfffc0008, 4, base=16, bitRange=2 +sfr = "US0_IER.ENDRX", "Memory", 0xfffc0008, 4, base=16, bitRange=3 +sfr = "US0_IER.ENDTX", "Memory", 0xfffc0008, 4, base=16, bitRange=4 +sfr = "US0_IER.OVRE", "Memory", 0xfffc0008, 4, base=16, bitRange=5 +sfr = "US0_IER.FRAME", "Memory", 0xfffc0008, 4, base=16, bitRange=6 +sfr = "US0_IER.PARE", "Memory", 0xfffc0008, 4, base=16, bitRange=7 +sfr = "US0_IER.TIMEOUT", "Memory", 0xfffc0008, 4, base=16, bitRange=8 +sfr = "US0_IER.TXEMPTY", "Memory", 0xfffc0008, 4, base=16, bitRange=9 +sfr = "US0_IER.ITERATION", "Memory", 0xfffc0008, 4, base=16, bitRange=10 +sfr = "US0_IER.TXBUFE", "Memory", 0xfffc0008, 4, base=16, bitRange=11 +sfr = "US0_IER.RXBUFF", "Memory", 0xfffc0008, 4, base=16, bitRange=12 +sfr = "US0_IER.NACK", "Memory", 0xfffc0008, 4, base=16, bitRange=13 +sfr = "US0_IER.RIIC", "Memory", 0xfffc0008, 4, base=16, bitRange=16 +sfr = "US0_IER.DSRIC", "Memory", 0xfffc0008, 4, base=16, bitRange=17 +sfr = "US0_IER.DCDIC", "Memory", 0xfffc0008, 4, base=16, bitRange=18 +sfr = "US0_IER.CTSIC", "Memory", 0xfffc0008, 4, base=16, bitRange=19 +sfr = "US0_IDR", "Memory", 0xfffc000c, 4, base=16 +sfr = "US0_IDR.RXRDY", "Memory", 0xfffc000c, 4, base=16, bitRange=0 +sfr = "US0_IDR.TXRDY", "Memory", 0xfffc000c, 4, base=16, bitRange=1 +sfr = "US0_IDR.RXBRK", "Memory", 0xfffc000c, 4, base=16, bitRange=2 +sfr = "US0_IDR.ENDRX", "Memory", 0xfffc000c, 4, base=16, bitRange=3 +sfr = "US0_IDR.ENDTX", "Memory", 0xfffc000c, 4, base=16, bitRange=4 +sfr = "US0_IDR.OVRE", "Memory", 0xfffc000c, 4, base=16, bitRange=5 +sfr = "US0_IDR.FRAME", "Memory", 0xfffc000c, 4, base=16, bitRange=6 +sfr = "US0_IDR.PARE", "Memory", 0xfffc000c, 4, base=16, bitRange=7 +sfr = "US0_IDR.TIMEOUT", "Memory", 0xfffc000c, 4, base=16, bitRange=8 +sfr = "US0_IDR.TXEMPTY", "Memory", 0xfffc000c, 4, base=16, bitRange=9 +sfr = "US0_IDR.ITERATION", "Memory", 0xfffc000c, 4, base=16, bitRange=10 +sfr = "US0_IDR.TXBUFE", "Memory", 0xfffc000c, 4, base=16, bitRange=11 +sfr = "US0_IDR.RXBUFF", "Memory", 0xfffc000c, 4, base=16, bitRange=12 +sfr = "US0_IDR.NACK", "Memory", 0xfffc000c, 4, base=16, bitRange=13 +sfr = "US0_IDR.RIIC", "Memory", 0xfffc000c, 4, base=16, bitRange=16 +sfr = "US0_IDR.DSRIC", "Memory", 0xfffc000c, 4, base=16, bitRange=17 +sfr = "US0_IDR.DCDIC", "Memory", 0xfffc000c, 4, base=16, bitRange=18 +sfr = "US0_IDR.CTSIC", "Memory", 0xfffc000c, 4, base=16, bitRange=19 +sfr = "US0_IMR", "Memory", 0xfffc0010, 4, base=16 +sfr = "US0_IMR.RXRDY", "Memory", 0xfffc0010, 4, base=16, bitRange=0 +sfr = "US0_IMR.TXRDY", "Memory", 0xfffc0010, 4, base=16, bitRange=1 +sfr = "US0_IMR.RXBRK", "Memory", 0xfffc0010, 4, base=16, bitRange=2 +sfr = "US0_IMR.ENDRX", "Memory", 0xfffc0010, 4, base=16, bitRange=3 +sfr = "US0_IMR.ENDTX", "Memory", 0xfffc0010, 4, base=16, bitRange=4 +sfr = "US0_IMR.OVRE", "Memory", 0xfffc0010, 4, base=16, bitRange=5 +sfr = "US0_IMR.FRAME", "Memory", 0xfffc0010, 4, base=16, bitRange=6 +sfr = "US0_IMR.PARE", "Memory", 0xfffc0010, 4, base=16, bitRange=7 +sfr = "US0_IMR.TIMEOUT", "Memory", 0xfffc0010, 4, base=16, bitRange=8 +sfr = "US0_IMR.TXEMPTY", "Memory", 0xfffc0010, 4, base=16, bitRange=9 +sfr = "US0_IMR.ITERATION", "Memory", 0xfffc0010, 4, base=16, bitRange=10 +sfr = "US0_IMR.TXBUFE", "Memory", 0xfffc0010, 4, base=16, bitRange=11 +sfr = "US0_IMR.RXBUFF", "Memory", 0xfffc0010, 4, base=16, bitRange=12 +sfr = "US0_IMR.NACK", "Memory", 0xfffc0010, 4, base=16, bitRange=13 +sfr = "US0_IMR.RIIC", "Memory", 0xfffc0010, 4, base=16, bitRange=16 +sfr = "US0_IMR.DSRIC", "Memory", 0xfffc0010, 4, base=16, bitRange=17 +sfr = "US0_IMR.DCDIC", "Memory", 0xfffc0010, 4, base=16, bitRange=18 +sfr = "US0_IMR.CTSIC", "Memory", 0xfffc0010, 4, base=16, bitRange=19 +sfr = "US0_CSR", "Memory", 0xfffc0014, 4, base=16 +sfr = "US0_CSR.RXRDY", "Memory", 0xfffc0014, 4, base=16, bitRange=0 +sfr = "US0_CSR.TXRDY", "Memory", 0xfffc0014, 4, base=16, bitRange=1 +sfr = "US0_CSR.RXBRK", "Memory", 0xfffc0014, 4, base=16, bitRange=2 +sfr = "US0_CSR.ENDRX", "Memory", 0xfffc0014, 4, base=16, bitRange=3 +sfr = "US0_CSR.ENDTX", "Memory", 0xfffc0014, 4, base=16, bitRange=4 +sfr = "US0_CSR.OVRE", "Memory", 0xfffc0014, 4, base=16, bitRange=5 +sfr = "US0_CSR.FRAME", "Memory", 0xfffc0014, 4, base=16, bitRange=6 +sfr = "US0_CSR.PARE", "Memory", 0xfffc0014, 4, base=16, bitRange=7 +sfr = "US0_CSR.TIMEOUT", "Memory", 0xfffc0014, 4, base=16, bitRange=8 +sfr = "US0_CSR.TXEMPTY", "Memory", 0xfffc0014, 4, base=16, bitRange=9 +sfr = "US0_CSR.ITERATION", "Memory", 0xfffc0014, 4, base=16, bitRange=10 +sfr = "US0_CSR.TXBUFE", "Memory", 0xfffc0014, 4, base=16, bitRange=11 +sfr = "US0_CSR.RXBUFF", "Memory", 0xfffc0014, 4, base=16, bitRange=12 +sfr = "US0_CSR.NACK", "Memory", 0xfffc0014, 4, base=16, bitRange=13 +sfr = "US0_CSR.RIIC", "Memory", 0xfffc0014, 4, base=16, bitRange=16 +sfr = "US0_CSR.DSRIC", "Memory", 0xfffc0014, 4, base=16, bitRange=17 +sfr = "US0_CSR.DCDIC", "Memory", 0xfffc0014, 4, base=16, bitRange=18 +sfr = "US0_CSR.CTSIC", "Memory", 0xfffc0014, 4, base=16, bitRange=19 +sfr = "US0_CSR.RI", "Memory", 0xfffc0014, 4, base=16, bitRange=20 +sfr = "US0_CSR.DSR", "Memory", 0xfffc0014, 4, base=16, bitRange=21 +sfr = "US0_CSR.DCD", "Memory", 0xfffc0014, 4, base=16, bitRange=22 +sfr = "US0_CSR.CTS", "Memory", 0xfffc0014, 4, base=16, bitRange=23 +sfr = "US0_RHR", "Memory", 0xfffc0018, 4, base=16 +sfr = "US0_THR", "Memory", 0xfffc001c, 4, base=16 +sfr = "US0_BRGR", "Memory", 0xfffc0020, 4, base=16 +sfr = "US0_RTOR", "Memory", 0xfffc0024, 4, base=16 +sfr = "US0_TTGR", "Memory", 0xfffc0028, 4, base=16 +sfr = "US0_FIDI", "Memory", 0xfffc0040, 4, base=16 +sfr = "US0_NER", "Memory", 0xfffc0044, 4, base=16 +sfr = "US0_IF", "Memory", 0xfffc004c, 4, base=16 +; ========== Register definition for PDC_SSC peripheral ========== +sfr = "SSC_RPR", "Memory", 0xfffd4100, 4, base=16 +sfr = "SSC_RCR", "Memory", 0xfffd4104, 4, base=16 +sfr = "SSC_TPR", "Memory", 0xfffd4108, 4, base=16 +sfr = "SSC_TCR", "Memory", 0xfffd410c, 4, base=16 +sfr = "SSC_RNPR", "Memory", 0xfffd4110, 4, base=16 +sfr = "SSC_RNCR", "Memory", 0xfffd4114, 4, base=16 +sfr = "SSC_TNPR", "Memory", 0xfffd4118, 4, base=16 +sfr = "SSC_TNCR", "Memory", 0xfffd411c, 4, base=16 +sfr = "SSC_PTCR", "Memory", 0xfffd4120, 4, base=16 +sfr = "SSC_PTCR.RXTEN", "Memory", 0xfffd4120, 4, base=16, bitRange=0 +sfr = "SSC_PTCR.RXTDIS", "Memory", 0xfffd4120, 4, base=16, bitRange=1 +sfr = "SSC_PTCR.TXTEN", "Memory", 0xfffd4120, 4, base=16, bitRange=8 +sfr = "SSC_PTCR.TXTDIS", "Memory", 0xfffd4120, 4, base=16, bitRange=9 +sfr = "SSC_PTSR", "Memory", 0xfffd4124, 4, base=16 +sfr = "SSC_PTSR.RXTEN", "Memory", 0xfffd4124, 4, base=16, bitRange=0 +sfr = "SSC_PTSR.TXTEN", "Memory", 0xfffd4124, 4, base=16, bitRange=8 +; ========== Register definition for SSC peripheral ========== +sfr = "SSC_CR", "Memory", 0xfffd4000, 4, base=16 +sfr = "SSC_CR.RXEN", "Memory", 0xfffd4000, 4, base=16, bitRange=0 +sfr = "SSC_CR.RXDIS", "Memory", 0xfffd4000, 4, base=16, bitRange=1 +sfr = "SSC_CR.TXEN", "Memory", 0xfffd4000, 4, base=16, bitRange=8 +sfr = "SSC_CR.TXDIS", "Memory", 0xfffd4000, 4, base=16, bitRange=9 +sfr = "SSC_CR.SWRST", "Memory", 0xfffd4000, 4, base=16, bitRange=15 +sfr = "SSC_CMR", "Memory", 0xfffd4004, 4, base=16 +sfr = "SSC_RCMR", "Memory", 0xfffd4010, 4, base=16 +sfr = "SSC_RCMR.CKS", "Memory", 0xfffd4010, 4, base=16, bitRange=0-1 +sfr = "SSC_RCMR.CKO", "Memory", 0xfffd4010, 4, base=16, bitRange=2-4 +sfr = "SSC_RCMR.CKI", "Memory", 0xfffd4010, 4, base=16, bitRange=5 +sfr = "SSC_RCMR.CKG", "Memory", 0xfffd4010, 4, base=16, bitRange=6-7 +sfr = "SSC_RCMR.START", "Memory", 0xfffd4010, 4, base=16, bitRange=8-11 +sfr = "SSC_RCMR.STOP", "Memory", 0xfffd4010, 4, base=16, bitRange=12 +sfr = "SSC_RCMR.STTDLY", "Memory", 0xfffd4010, 4, base=16, bitRange=16-23 +sfr = "SSC_RCMR.PERIOD", "Memory", 0xfffd4010, 4, base=16, bitRange=24-31 +sfr = "SSC_RFMR", "Memory", 0xfffd4014, 4, base=16 +sfr = "SSC_RFMR.DATLEN", "Memory", 0xfffd4014, 4, base=16, bitRange=0-4 +sfr = "SSC_RFMR.LOOP", "Memory", 0xfffd4014, 4, base=16, bitRange=5 +sfr = "SSC_RFMR.MSBF", "Memory", 0xfffd4014, 4, base=16, bitRange=7 +sfr = "SSC_RFMR.DATNB", "Memory", 0xfffd4014, 4, base=16, bitRange=8-11 +sfr = "SSC_RFMR.FSLEN", "Memory", 0xfffd4014, 4, base=16, bitRange=16-19 +sfr = "SSC_RFMR.FSOS", "Memory", 0xfffd4014, 4, base=16, bitRange=20-22 +sfr = "SSC_RFMR.FSEDGE", "Memory", 0xfffd4014, 4, base=16, bitRange=24 +sfr = "SSC_TCMR", "Memory", 0xfffd4018, 4, base=16 +sfr = "SSC_TCMR.CKS", "Memory", 0xfffd4018, 4, base=16, bitRange=0-1 +sfr = "SSC_TCMR.CKO", "Memory", 0xfffd4018, 4, base=16, bitRange=2-4 +sfr = "SSC_TCMR.CKI", "Memory", 0xfffd4018, 4, base=16, bitRange=5 +sfr = "SSC_TCMR.CKG", "Memory", 0xfffd4018, 4, base=16, bitRange=6-7 +sfr = "SSC_TCMR.START", "Memory", 0xfffd4018, 4, base=16, bitRange=8-11 +sfr = "SSC_TCMR.STTDLY", "Memory", 0xfffd4018, 4, base=16, bitRange=16-23 +sfr = "SSC_TCMR.PERIOD", "Memory", 0xfffd4018, 4, base=16, bitRange=24-31 +sfr = "SSC_TFMR", "Memory", 0xfffd401c, 4, base=16 +sfr = "SSC_TFMR.DATLEN", "Memory", 0xfffd401c, 4, base=16, bitRange=0-4 +sfr = "SSC_TFMR.DATDEF", "Memory", 0xfffd401c, 4, base=16, bitRange=5 +sfr = "SSC_TFMR.MSBF", "Memory", 0xfffd401c, 4, base=16, bitRange=7 +sfr = "SSC_TFMR.DATNB", "Memory", 0xfffd401c, 4, base=16, bitRange=8-11 +sfr = "SSC_TFMR.FSLEN", "Memory", 0xfffd401c, 4, base=16, bitRange=16-19 +sfr = "SSC_TFMR.FSOS", "Memory", 0xfffd401c, 4, base=16, bitRange=20-22 +sfr = "SSC_TFMR.FSDEN", "Memory", 0xfffd401c, 4, base=16, bitRange=23 +sfr = "SSC_TFMR.FSEDGE", "Memory", 0xfffd401c, 4, base=16, bitRange=24 +sfr = "SSC_RHR", "Memory", 0xfffd4020, 4, base=16 +sfr = "SSC_THR", "Memory", 0xfffd4024, 4, base=16 +sfr = "SSC_RSHR", "Memory", 0xfffd4030, 4, base=16 +sfr = "SSC_TSHR", "Memory", 0xfffd4034, 4, base=16 +sfr = "SSC_SR", "Memory", 0xfffd4040, 4, base=16 +sfr = "SSC_SR.TXRDY", "Memory", 0xfffd4040, 4, base=16, bitRange=0 +sfr = "SSC_SR.TXEMPTY", "Memory", 0xfffd4040, 4, base=16, bitRange=1 +sfr = "SSC_SR.ENDTX", "Memory", 0xfffd4040, 4, base=16, bitRange=2 +sfr = "SSC_SR.TXBUFE", "Memory", 0xfffd4040, 4, base=16, bitRange=3 +sfr = "SSC_SR.RXRDY", "Memory", 0xfffd4040, 4, base=16, bitRange=4 +sfr = "SSC_SR.OVRUN", "Memory", 0xfffd4040, 4, base=16, bitRange=5 +sfr = "SSC_SR.ENDRX", "Memory", 0xfffd4040, 4, base=16, bitRange=6 +sfr = "SSC_SR.RXBUFF", "Memory", 0xfffd4040, 4, base=16, bitRange=7 +sfr = "SSC_SR.CP0", "Memory", 0xfffd4040, 4, base=16, bitRange=8 +sfr = "SSC_SR.CP1", "Memory", 0xfffd4040, 4, base=16, bitRange=9 +sfr = "SSC_SR.TXSYN", "Memory", 0xfffd4040, 4, base=16, bitRange=10 +sfr = "SSC_SR.RXSYN", "Memory", 0xfffd4040, 4, base=16, bitRange=11 +sfr = "SSC_SR.TXENA", "Memory", 0xfffd4040, 4, base=16, bitRange=16 +sfr = "SSC_SR.RXENA", "Memory", 0xfffd4040, 4, base=16, bitRange=17 +sfr = "SSC_IER", "Memory", 0xfffd4044, 4, base=16 +sfr = "SSC_IER.TXRDY", "Memory", 0xfffd4044, 4, base=16, bitRange=0 +sfr = "SSC_IER.TXEMPTY", "Memory", 0xfffd4044, 4, base=16, bitRange=1 +sfr = "SSC_IER.ENDTX", "Memory", 0xfffd4044, 4, base=16, bitRange=2 +sfr = "SSC_IER.TXBUFE", "Memory", 0xfffd4044, 4, base=16, bitRange=3 +sfr = "SSC_IER.RXRDY", "Memory", 0xfffd4044, 4, base=16, bitRange=4 +sfr = "SSC_IER.OVRUN", "Memory", 0xfffd4044, 4, base=16, bitRange=5 +sfr = "SSC_IER.ENDRX", "Memory", 0xfffd4044, 4, base=16, bitRange=6 +sfr = "SSC_IER.RXBUFF", "Memory", 0xfffd4044, 4, base=16, bitRange=7 +sfr = "SSC_IER.CP0", "Memory", 0xfffd4044, 4, base=16, bitRange=8 +sfr = "SSC_IER.CP1", "Memory", 0xfffd4044, 4, base=16, bitRange=9 +sfr = "SSC_IER.TXSYN", "Memory", 0xfffd4044, 4, base=16, bitRange=10 +sfr = "SSC_IER.RXSYN", "Memory", 0xfffd4044, 4, base=16, bitRange=11 +sfr = "SSC_IDR", "Memory", 0xfffd4048, 4, base=16 +sfr = "SSC_IDR.TXRDY", "Memory", 0xfffd4048, 4, base=16, bitRange=0 +sfr = "SSC_IDR.TXEMPTY", "Memory", 0xfffd4048, 4, base=16, bitRange=1 +sfr = "SSC_IDR.ENDTX", "Memory", 0xfffd4048, 4, base=16, bitRange=2 +sfr = "SSC_IDR.TXBUFE", "Memory", 0xfffd4048, 4, base=16, bitRange=3 +sfr = "SSC_IDR.RXRDY", "Memory", 0xfffd4048, 4, base=16, bitRange=4 +sfr = "SSC_IDR.OVRUN", "Memory", 0xfffd4048, 4, base=16, bitRange=5 +sfr = "SSC_IDR.ENDRX", "Memory", 0xfffd4048, 4, base=16, bitRange=6 +sfr = "SSC_IDR.RXBUFF", "Memory", 0xfffd4048, 4, base=16, bitRange=7 +sfr = "SSC_IDR.CP0", "Memory", 0xfffd4048, 4, base=16, bitRange=8 +sfr = "SSC_IDR.CP1", "Memory", 0xfffd4048, 4, base=16, bitRange=9 +sfr = "SSC_IDR.TXSYN", "Memory", 0xfffd4048, 4, base=16, bitRange=10 +sfr = "SSC_IDR.RXSYN", "Memory", 0xfffd4048, 4, base=16, bitRange=11 +sfr = "SSC_IMR", "Memory", 0xfffd404c, 4, base=16 +sfr = "SSC_IMR.TXRDY", "Memory", 0xfffd404c, 4, base=16, bitRange=0 +sfr = "SSC_IMR.TXEMPTY", "Memory", 0xfffd404c, 4, base=16, bitRange=1 +sfr = "SSC_IMR.ENDTX", "Memory", 0xfffd404c, 4, base=16, bitRange=2 +sfr = "SSC_IMR.TXBUFE", "Memory", 0xfffd404c, 4, base=16, bitRange=3 +sfr = "SSC_IMR.RXRDY", "Memory", 0xfffd404c, 4, base=16, bitRange=4 +sfr = "SSC_IMR.OVRUN", "Memory", 0xfffd404c, 4, base=16, bitRange=5 +sfr = "SSC_IMR.ENDRX", "Memory", 0xfffd404c, 4, base=16, bitRange=6 +sfr = "SSC_IMR.RXBUFF", "Memory", 0xfffd404c, 4, base=16, bitRange=7 +sfr = "SSC_IMR.CP0", "Memory", 0xfffd404c, 4, base=16, bitRange=8 +sfr = "SSC_IMR.CP1", "Memory", 0xfffd404c, 4, base=16, bitRange=9 +sfr = "SSC_IMR.TXSYN", "Memory", 0xfffd404c, 4, base=16, bitRange=10 +sfr = "SSC_IMR.RXSYN", "Memory", 0xfffd404c, 4, base=16, bitRange=11 +; ========== Register definition for TWI peripheral ========== +sfr = "TWI_CR", "Memory", 0xfffb8000, 4, base=16 +sfr = "TWI_CR.START", "Memory", 0xfffb8000, 4, base=16, bitRange=0 +sfr = "TWI_CR.STOP", "Memory", 0xfffb8000, 4, base=16, bitRange=1 +sfr = "TWI_CR.MSEN", "Memory", 0xfffb8000, 4, base=16, bitRange=2 +sfr = "TWI_CR.MSDIS", "Memory", 0xfffb8000, 4, base=16, bitRange=3 +sfr = "TWI_CR.SWRST", "Memory", 0xfffb8000, 4, base=16, bitRange=7 +sfr = "TWI_MMR", "Memory", 0xfffb8004, 4, base=16 +sfr = "TWI_MMR.IADRSZ", "Memory", 0xfffb8004, 4, base=16, bitRange=8-9 +sfr = "TWI_MMR.MREAD", "Memory", 0xfffb8004, 4, base=16, bitRange=12 +sfr = "TWI_MMR.DADR", "Memory", 0xfffb8004, 4, base=16, bitRange=16-22 +sfr = "TWI_IADR", "Memory", 0xfffb800c, 4, base=16 +sfr = "TWI_CWGR", "Memory", 0xfffb8010, 4, base=16 +sfr = "TWI_CWGR.CLDIV", "Memory", 0xfffb8010, 4, base=16, bitRange=0-7 +sfr = "TWI_CWGR.CHDIV", "Memory", 0xfffb8010, 4, base=16, bitRange=8-15 +sfr = "TWI_CWGR.CKDIV", "Memory", 0xfffb8010, 4, base=16, bitRange=16-18 +sfr = "TWI_SR", "Memory", 0xfffb8020, 4, base=16 +sfr = "TWI_SR.TXCOMP", "Memory", 0xfffb8020, 4, base=16, bitRange=0 +sfr = "TWI_SR.RXRDY", "Memory", 0xfffb8020, 4, base=16, bitRange=1 +sfr = "TWI_SR.TXRDY", "Memory", 0xfffb8020, 4, base=16, bitRange=2 +sfr = "TWI_SR.OVRE", "Memory", 0xfffb8020, 4, base=16, bitRange=6 +sfr = "TWI_SR.UNRE", "Memory", 0xfffb8020, 4, base=16, bitRange=7 +sfr = "TWI_SR.NACK", "Memory", 0xfffb8020, 4, base=16, bitRange=8 +sfr = "TWI_IER", "Memory", 0xfffb8024, 4, base=16 +sfr = "TWI_IER.TXCOMP", "Memory", 0xfffb8024, 4, base=16, bitRange=0 +sfr = "TWI_IER.RXRDY", "Memory", 0xfffb8024, 4, base=16, bitRange=1 +sfr = "TWI_IER.TXRDY", "Memory", 0xfffb8024, 4, base=16, bitRange=2 +sfr = "TWI_IER.OVRE", "Memory", 0xfffb8024, 4, base=16, bitRange=6 +sfr = "TWI_IER.UNRE", "Memory", 0xfffb8024, 4, base=16, bitRange=7 +sfr = "TWI_IER.NACK", "Memory", 0xfffb8024, 4, base=16, bitRange=8 +sfr = "TWI_IDR", "Memory", 0xfffb8028, 4, base=16 +sfr = "TWI_IDR.TXCOMP", "Memory", 0xfffb8028, 4, base=16, bitRange=0 +sfr = "TWI_IDR.RXRDY", "Memory", 0xfffb8028, 4, base=16, bitRange=1 +sfr = "TWI_IDR.TXRDY", "Memory", 0xfffb8028, 4, base=16, bitRange=2 +sfr = "TWI_IDR.OVRE", "Memory", 0xfffb8028, 4, base=16, bitRange=6 +sfr = "TWI_IDR.UNRE", "Memory", 0xfffb8028, 4, base=16, bitRange=7 +sfr = "TWI_IDR.NACK", "Memory", 0xfffb8028, 4, base=16, bitRange=8 +sfr = "TWI_IMR", "Memory", 0xfffb802c, 4, base=16 +sfr = "TWI_IMR.TXCOMP", "Memory", 0xfffb802c, 4, base=16, bitRange=0 +sfr = "TWI_IMR.RXRDY", "Memory", 0xfffb802c, 4, base=16, bitRange=1 +sfr = "TWI_IMR.TXRDY", "Memory", 0xfffb802c, 4, base=16, bitRange=2 +sfr = "TWI_IMR.OVRE", "Memory", 0xfffb802c, 4, base=16, bitRange=6 +sfr = "TWI_IMR.UNRE", "Memory", 0xfffb802c, 4, base=16, bitRange=7 +sfr = "TWI_IMR.NACK", "Memory", 0xfffb802c, 4, base=16, bitRange=8 +sfr = "TWI_RHR", "Memory", 0xfffb8030, 4, base=16 +sfr = "TWI_THR", "Memory", 0xfffb8034, 4, base=16 +; ========== Register definition for PWMC_CH3 peripheral ========== +sfr = "PWMC_CH3_CMR", "Memory", 0xfffcc260, 4, base=16 +sfr = "PWMC_CH3_CMR.CPRE", "Memory", 0xfffcc260, 4, base=16, bitRange=0-3 +sfr = "PWMC_CH3_CMR.CALG", "Memory", 0xfffcc260, 4, base=16, bitRange=8 +sfr = "PWMC_CH3_CMR.CPOL", "Memory", 0xfffcc260, 4, base=16, bitRange=9 +sfr = "PWMC_CH3_CMR.CPD", "Memory", 0xfffcc260, 4, base=16, bitRange=10 +sfr = "PWMC_CH3_CDTYR", "Memory", 0xfffcc264, 4, base=16 +sfr = "PWMC_CH3_CDTYR.CDTY", "Memory", 0xfffcc264, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH3_CPRDR", "Memory", 0xfffcc268, 4, base=16 +sfr = "PWMC_CH3_CPRDR.CPRD", "Memory", 0xfffcc268, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH3_CCNTR", "Memory", 0xfffcc26c, 4, base=16 +sfr = "PWMC_CH3_CCNTR.CCNT", "Memory", 0xfffcc26c, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH3_CUPDR", "Memory", 0xfffcc270, 4, base=16 +sfr = "PWMC_CH3_CUPDR.CUPD", "Memory", 0xfffcc270, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH3_Reserved", "Memory", 0xfffcc274, 4, base=16 +; ========== Register definition for PWMC_CH2 peripheral ========== +sfr = "PWMC_CH2_CMR", "Memory", 0xfffcc240, 4, base=16 +sfr = "PWMC_CH2_CMR.CPRE", "Memory", 0xfffcc240, 4, base=16, bitRange=0-3 +sfr = "PWMC_CH2_CMR.CALG", "Memory", 0xfffcc240, 4, base=16, bitRange=8 +sfr = "PWMC_CH2_CMR.CPOL", "Memory", 0xfffcc240, 4, base=16, bitRange=9 +sfr = "PWMC_CH2_CMR.CPD", "Memory", 0xfffcc240, 4, base=16, bitRange=10 +sfr = "PWMC_CH2_CDTYR", "Memory", 0xfffcc244, 4, base=16 +sfr = "PWMC_CH2_CDTYR.CDTY", "Memory", 0xfffcc244, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH2_CPRDR", "Memory", 0xfffcc248, 4, base=16 +sfr = "PWMC_CH2_CPRDR.CPRD", "Memory", 0xfffcc248, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH2_CCNTR", "Memory", 0xfffcc24c, 4, base=16 +sfr = "PWMC_CH2_CCNTR.CCNT", "Memory", 0xfffcc24c, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH2_CUPDR", "Memory", 0xfffcc250, 4, base=16 +sfr = "PWMC_CH2_CUPDR.CUPD", "Memory", 0xfffcc250, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH2_Reserved", "Memory", 0xfffcc254, 4, base=16 +; ========== Register definition for PWMC_CH1 peripheral ========== +sfr = "PWMC_CH1_CMR", "Memory", 0xfffcc220, 4, base=16 +sfr = "PWMC_CH1_CMR.CPRE", "Memory", 0xfffcc220, 4, base=16, bitRange=0-3 +sfr = "PWMC_CH1_CMR.CALG", "Memory", 0xfffcc220, 4, base=16, bitRange=8 +sfr = "PWMC_CH1_CMR.CPOL", "Memory", 0xfffcc220, 4, base=16, bitRange=9 +sfr = "PWMC_CH1_CMR.CPD", "Memory", 0xfffcc220, 4, base=16, bitRange=10 +sfr = "PWMC_CH1_CDTYR", "Memory", 0xfffcc224, 4, base=16 +sfr = "PWMC_CH1_CDTYR.CDTY", "Memory", 0xfffcc224, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH1_CPRDR", "Memory", 0xfffcc228, 4, base=16 +sfr = "PWMC_CH1_CPRDR.CPRD", "Memory", 0xfffcc228, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH1_CCNTR", "Memory", 0xfffcc22c, 4, base=16 +sfr = "PWMC_CH1_CCNTR.CCNT", "Memory", 0xfffcc22c, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH1_CUPDR", "Memory", 0xfffcc230, 4, base=16 +sfr = "PWMC_CH1_CUPDR.CUPD", "Memory", 0xfffcc230, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH1_Reserved", "Memory", 0xfffcc234, 4, base=16 +; ========== Register definition for PWMC_CH0 peripheral ========== +sfr = "PWMC_CH0_CMR", "Memory", 0xfffcc200, 4, base=16 +sfr = "PWMC_CH0_CMR.CPRE", "Memory", 0xfffcc200, 4, base=16, bitRange=0-3 +sfr = "PWMC_CH0_CMR.CALG", "Memory", 0xfffcc200, 4, base=16, bitRange=8 +sfr = "PWMC_CH0_CMR.CPOL", "Memory", 0xfffcc200, 4, base=16, bitRange=9 +sfr = "PWMC_CH0_CMR.CPD", "Memory", 0xfffcc200, 4, base=16, bitRange=10 +sfr = "PWMC_CH0_CDTYR", "Memory", 0xfffcc204, 4, base=16 +sfr = "PWMC_CH0_CDTYR.CDTY", "Memory", 0xfffcc204, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH0_CPRDR", "Memory", 0xfffcc208, 4, base=16 +sfr = "PWMC_CH0_CPRDR.CPRD", "Memory", 0xfffcc208, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH0_CCNTR", "Memory", 0xfffcc20c, 4, base=16 +sfr = "PWMC_CH0_CCNTR.CCNT", "Memory", 0xfffcc20c, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH0_CUPDR", "Memory", 0xfffcc210, 4, base=16 +sfr = "PWMC_CH0_CUPDR.CUPD", "Memory", 0xfffcc210, 4, base=16, bitRange=0-31 +sfr = "PWMC_CH0_Reserved", "Memory", 0xfffcc214, 4, base=16 +; ========== Register definition for PWMC peripheral ========== +sfr = "PWMC_MR", "Memory", 0xfffcc000, 4, base=16 +sfr = "PWMC_MR.DIVA", "Memory", 0xfffcc000, 4, base=16, bitRange=0-7 +sfr = "PWMC_MR.PREA", "Memory", 0xfffcc000, 4, base=16, bitRange=8-11 +sfr = "PWMC_MR.DIVB", "Memory", 0xfffcc000, 4, base=16, bitRange=16-23 +sfr = "PWMC_MR.PREB", "Memory", 0xfffcc000, 4, base=16, bitRange=24-27 +sfr = "PWMC_ENA", "Memory", 0xfffcc004, 4, base=16 +sfr = "PWMC_ENA.CHID0", "Memory", 0xfffcc004, 4, base=16, bitRange=0 +sfr = "PWMC_ENA.CHID1", "Memory", 0xfffcc004, 4, base=16, bitRange=1 +sfr = "PWMC_ENA.CHID2", "Memory", 0xfffcc004, 4, base=16, bitRange=2 +sfr = "PWMC_ENA.CHID3", "Memory", 0xfffcc004, 4, base=16, bitRange=3 +sfr = "PWMC_DIS", "Memory", 0xfffcc008, 4, base=16 +sfr = "PWMC_DIS.CHID0", "Memory", 0xfffcc008, 4, base=16, bitRange=0 +sfr = "PWMC_DIS.CHID1", "Memory", 0xfffcc008, 4, base=16, bitRange=1 +sfr = "PWMC_DIS.CHID2", "Memory", 0xfffcc008, 4, base=16, bitRange=2 +sfr = "PWMC_DIS.CHID3", "Memory", 0xfffcc008, 4, base=16, bitRange=3 +sfr = "PWMC_SR", "Memory", 0xfffcc00c, 4, base=16 +sfr = "PWMC_SR.CHID0", "Memory", 0xfffcc00c, 4, base=16, bitRange=0 +sfr = "PWMC_SR.CHID1", "Memory", 0xfffcc00c, 4, base=16, bitRange=1 +sfr = "PWMC_SR.CHID2", "Memory", 0xfffcc00c, 4, base=16, bitRange=2 +sfr = "PWMC_SR.CHID3", "Memory", 0xfffcc00c, 4, base=16, bitRange=3 +sfr = "PWMC_IER", "Memory", 0xfffcc010, 4, base=16 +sfr = "PWMC_IER.CHID0", "Memory", 0xfffcc010, 4, base=16, bitRange=0 +sfr = "PWMC_IER.CHID1", "Memory", 0xfffcc010, 4, base=16, bitRange=1 +sfr = "PWMC_IER.CHID2", "Memory", 0xfffcc010, 4, base=16, bitRange=2 +sfr = "PWMC_IER.CHID3", "Memory", 0xfffcc010, 4, base=16, bitRange=3 +sfr = "PWMC_IDR", "Memory", 0xfffcc014, 4, base=16 +sfr = "PWMC_IDR.CHID0", "Memory", 0xfffcc014, 4, base=16, bitRange=0 +sfr = "PWMC_IDR.CHID1", "Memory", 0xfffcc014, 4, base=16, bitRange=1 +sfr = "PWMC_IDR.CHID2", "Memory", 0xfffcc014, 4, base=16, bitRange=2 +sfr = "PWMC_IDR.CHID3", "Memory", 0xfffcc014, 4, base=16, bitRange=3 +sfr = "PWMC_IMR", "Memory", 0xfffcc018, 4, base=16 +sfr = "PWMC_IMR.CHID0", "Memory", 0xfffcc018, 4, base=16, bitRange=0 +sfr = "PWMC_IMR.CHID1", "Memory", 0xfffcc018, 4, base=16, bitRange=1 +sfr = "PWMC_IMR.CHID2", "Memory", 0xfffcc018, 4, base=16, bitRange=2 +sfr = "PWMC_IMR.CHID3", "Memory", 0xfffcc018, 4, base=16, bitRange=3 +sfr = "PWMC_ISR", "Memory", 0xfffcc01c, 4, base=16 +sfr = "PWMC_ISR.CHID0", "Memory", 0xfffcc01c, 4, base=16, bitRange=0 +sfr = "PWMC_ISR.CHID1", "Memory", 0xfffcc01c, 4, base=16, bitRange=1 +sfr = "PWMC_ISR.CHID2", "Memory", 0xfffcc01c, 4, base=16, bitRange=2 +sfr = "PWMC_ISR.CHID3", "Memory", 0xfffcc01c, 4, base=16, bitRange=3 +sfr = "PWMC_VR", "Memory", 0xfffcc0fc, 4, base=16 +; ========== Register definition for UDP peripheral ========== +sfr = "UDP_NUM", "Memory", 0xfffb0000, 4, base=16 +sfr = "UDP_NUM.NUM", "Memory", 0xfffb0000, 4, base=16, bitRange=0-10 +sfr = "UDP_NUM.ERR", "Memory", 0xfffb0000, 4, base=16, bitRange=16 +sfr = "UDP_NUM.OK", "Memory", 0xfffb0000, 4, base=16, bitRange=17 +sfr = "UDP_GLBSTATE", "Memory", 0xfffb0004, 4, base=16 +sfr = "UDP_GLBSTATE.FADDEN", "Memory", 0xfffb0004, 4, base=16, bitRange=0 +sfr = "UDP_GLBSTATE.CONFG", "Memory", 0xfffb0004, 4, base=16, bitRange=1 +sfr = "UDP_GLBSTATE.ESR", "Memory", 0xfffb0004, 4, base=16, bitRange=2 +sfr = "UDP_GLBSTATE.RSMINPR", "Memory", 0xfffb0004, 4, base=16, bitRange=3 +sfr = "UDP_GLBSTATE.RMWUPE", "Memory", 0xfffb0004, 4, base=16, bitRange=4 +sfr = "UDP_FADDR", "Memory", 0xfffb0008, 4, base=16 +sfr = "UDP_FADDR.FADD", "Memory", 0xfffb0008, 4, base=16, bitRange=0-7 +sfr = "UDP_FADDR.FEN", "Memory", 0xfffb0008, 4, base=16, bitRange=8 +sfr = "UDP_IER", "Memory", 0xfffb0010, 4, base=16 +sfr = "UDP_IER.EPINT0", "Memory", 0xfffb0010, 4, base=16, bitRange=0 +sfr = "UDP_IER.EPINT1", "Memory", 0xfffb0010, 4, base=16, bitRange=1 +sfr = "UDP_IER.EPINT2", "Memory", 0xfffb0010, 4, base=16, bitRange=2 +sfr = "UDP_IER.EPINT3", "Memory", 0xfffb0010, 4, base=16, bitRange=3 +sfr = "UDP_IER.EPINT4", "Memory", 0xfffb0010, 4, base=16, bitRange=4 +sfr = "UDP_IER.EPINT5", "Memory", 0xfffb0010, 4, base=16, bitRange=5 +sfr = "UDP_IER.RXSUSP", "Memory", 0xfffb0010, 4, base=16, bitRange=8 +sfr = "UDP_IER.RXRSM", "Memory", 0xfffb0010, 4, base=16, bitRange=9 +sfr = "UDP_IER.EXTRSM", "Memory", 0xfffb0010, 4, base=16, bitRange=10 +sfr = "UDP_IER.SOFINT", "Memory", 0xfffb0010, 4, base=16, bitRange=11 +sfr = "UDP_IER.WAKEUP", "Memory", 0xfffb0010, 4, base=16, bitRange=13 +sfr = "UDP_IDR", "Memory", 0xfffb0014, 4, base=16 +sfr = "UDP_IDR.EPINT0", "Memory", 0xfffb0014, 4, base=16, bitRange=0 +sfr = "UDP_IDR.EPINT1", "Memory", 0xfffb0014, 4, base=16, bitRange=1 +sfr = "UDP_IDR.EPINT2", "Memory", 0xfffb0014, 4, base=16, bitRange=2 +sfr = "UDP_IDR.EPINT3", "Memory", 0xfffb0014, 4, base=16, bitRange=3 +sfr = "UDP_IDR.EPINT4", "Memory", 0xfffb0014, 4, base=16, bitRange=4 +sfr = "UDP_IDR.EPINT5", "Memory", 0xfffb0014, 4, base=16, bitRange=5 +sfr = "UDP_IDR.RXSUSP", "Memory", 0xfffb0014, 4, base=16, bitRange=8 +sfr = "UDP_IDR.RXRSM", "Memory", 0xfffb0014, 4, base=16, bitRange=9 +sfr = "UDP_IDR.EXTRSM", "Memory", 0xfffb0014, 4, base=16, bitRange=10 +sfr = "UDP_IDR.SOFINT", "Memory", 0xfffb0014, 4, base=16, bitRange=11 +sfr = "UDP_IDR.WAKEUP", "Memory", 0xfffb0014, 4, base=16, bitRange=13 +sfr = "UDP_IMR", "Memory", 0xfffb0018, 4, base=16 +sfr = "UDP_IMR.EPINT0", "Memory", 0xfffb0018, 4, base=16, bitRange=0 +sfr = "UDP_IMR.EPINT1", "Memory", 0xfffb0018, 4, base=16, bitRange=1 +sfr = "UDP_IMR.EPINT2", "Memory", 0xfffb0018, 4, base=16, bitRange=2 +sfr = "UDP_IMR.EPINT3", "Memory", 0xfffb0018, 4, base=16, bitRange=3 +sfr = "UDP_IMR.EPINT4", "Memory", 0xfffb0018, 4, base=16, bitRange=4 +sfr = "UDP_IMR.EPINT5", "Memory", 0xfffb0018, 4, base=16, bitRange=5 +sfr = "UDP_IMR.RXSUSP", "Memory", 0xfffb0018, 4, base=16, bitRange=8 +sfr = "UDP_IMR.RXRSM", "Memory", 0xfffb0018, 4, base=16, bitRange=9 +sfr = "UDP_IMR.EXTRSM", "Memory", 0xfffb0018, 4, base=16, bitRange=10 +sfr = "UDP_IMR.SOFINT", "Memory", 0xfffb0018, 4, base=16, bitRange=11 +sfr = "UDP_IMR.WAKEUP", "Memory", 0xfffb0018, 4, base=16, bitRange=13 +sfr = "UDP_ISR", "Memory", 0xfffb001c, 4, base=16 +sfr = "UDP_ISR.EPINT0", "Memory", 0xfffb001c, 4, base=16, bitRange=0 +sfr = "UDP_ISR.EPINT1", "Memory", 0xfffb001c, 4, base=16, bitRange=1 +sfr = "UDP_ISR.EPINT2", "Memory", 0xfffb001c, 4, base=16, bitRange=2 +sfr = "UDP_ISR.EPINT3", "Memory", 0xfffb001c, 4, base=16, bitRange=3 +sfr = "UDP_ISR.EPINT4", "Memory", 0xfffb001c, 4, base=16, bitRange=4 +sfr = "UDP_ISR.EPINT5", "Memory", 0xfffb001c, 4, base=16, bitRange=5 +sfr = "UDP_ISR.RXSUSP", "Memory", 0xfffb001c, 4, base=16, bitRange=8 +sfr = "UDP_ISR.RXRSM", "Memory", 0xfffb001c, 4, base=16, bitRange=9 +sfr = "UDP_ISR.EXTRSM", "Memory", 0xfffb001c, 4, base=16, bitRange=10 +sfr = "UDP_ISR.SOFINT", "Memory", 0xfffb001c, 4, base=16, bitRange=11 +sfr = "UDP_ISR.ENDBUSRES", "Memory", 0xfffb001c, 4, base=16, bitRange=12 +sfr = "UDP_ISR.WAKEUP", "Memory", 0xfffb001c, 4, base=16, bitRange=13 +sfr = "UDP_ICR", "Memory", 0xfffb0020, 4, base=16 +sfr = "UDP_ICR.EPINT0", "Memory", 0xfffb0020, 4, base=16, bitRange=0 +sfr = "UDP_ICR.EPINT1", "Memory", 0xfffb0020, 4, base=16, bitRange=1 +sfr = "UDP_ICR.EPINT2", "Memory", 0xfffb0020, 4, base=16, bitRange=2 +sfr = "UDP_ICR.EPINT3", "Memory", 0xfffb0020, 4, base=16, bitRange=3 +sfr = "UDP_ICR.EPINT4", "Memory", 0xfffb0020, 4, base=16, bitRange=4 +sfr = "UDP_ICR.EPINT5", "Memory", 0xfffb0020, 4, base=16, bitRange=5 +sfr = "UDP_ICR.RXSUSP", "Memory", 0xfffb0020, 4, base=16, bitRange=8 +sfr = "UDP_ICR.RXRSM", "Memory", 0xfffb0020, 4, base=16, bitRange=9 +sfr = "UDP_ICR.EXTRSM", "Memory", 0xfffb0020, 4, base=16, bitRange=10 +sfr = "UDP_ICR.SOFINT", "Memory", 0xfffb0020, 4, base=16, bitRange=11 +sfr = "UDP_ICR.WAKEUP", "Memory", 0xfffb0020, 4, base=16, bitRange=13 +sfr = "UDP_RSTEP", "Memory", 0xfffb0028, 4, base=16 +sfr = "UDP_RSTEP.EP0", "Memory", 0xfffb0028, 4, base=16, bitRange=0 +sfr = "UDP_RSTEP.EP1", "Memory", 0xfffb0028, 4, base=16, bitRange=1 +sfr = "UDP_RSTEP.EP2", "Memory", 0xfffb0028, 4, base=16, bitRange=2 +sfr = "UDP_RSTEP.EP3", "Memory", 0xfffb0028, 4, base=16, bitRange=3 +sfr = "UDP_RSTEP.EP4", "Memory", 0xfffb0028, 4, base=16, bitRange=4 +sfr = "UDP_RSTEP.EP5", "Memory", 0xfffb0028, 4, base=16, bitRange=5 +sfr = "UDP_CSR", "Memory", 0xfffb0030, 4, base=16 +sfr = "UDP_CSR.TXCOMP", "Memory", 0xfffb0030, 4, base=16, bitRange=0 +sfr = "UDP_CSR.BK0", "Memory", 0xfffb0030, 4, base=16, bitRange=1 +sfr = "UDP_CSR.RXSETUP", "Memory", 0xfffb0030, 4, base=16, bitRange=2 +sfr = "UDP_CSR.ISOERROR", "Memory", 0xfffb0030, 4, base=16, bitRange=3 +sfr = "UDP_CSR.TXPKTRDY", "Memory", 0xfffb0030, 4, base=16, bitRange=4 +sfr = "UDP_CSR.FORCESTALL", "Memory", 0xfffb0030, 4, base=16, bitRange=5 +sfr = "UDP_CSR.BK1", "Memory", 0xfffb0030, 4, base=16, bitRange=6 +sfr = "UDP_CSR.DIR", "Memory", 0xfffb0030, 4, base=16, bitRange=7 +sfr = "UDP_CSR.EPTYPE", "Memory", 0xfffb0030, 4, base=16, bitRange=8-10 +sfr = "UDP_CSR.DTGLE", "Memory", 0xfffb0030, 4, base=16, bitRange=11 +sfr = "UDP_CSR.EPEDS", "Memory", 0xfffb0030, 4, base=16, bitRange=15 +sfr = "UDP_CSR.RXBYTECNT", "Memory", 0xfffb0030, 4, base=16, bitRange=16-26 +sfr = "UDP_FDR", "Memory", 0xfffb0050, 4, base=16 +sfr = "UDP_TXVC", "Memory", 0xfffb0074, 4, base=16 +sfr = "UDP_TXVC.TXVDIS", "Memory", 0xfffb0074, 4, base=16, bitRange=8 +sfr = "UDP_TXVC.PUON", "Memory", 0xfffb0074, 4, base=16, bitRange=9 +; ========== Register definition for TC0 peripheral ========== +sfr = "TC0_CCR", "Memory", 0xfffa0000, 4, base=16 +sfr = "TC0_CCR.CLKEN", "Memory", 0xfffa0000, 4, base=16, bitRange=0 +sfr = "TC0_CCR.CLKDIS", "Memory", 0xfffa0000, 4, base=16, bitRange=1 +sfr = "TC0_CCR.SWTRG", "Memory", 0xfffa0000, 4, base=16, bitRange=2 +sfr = "TC0_CMR", "Memory", 0xfffa0004, 4, base=16 +sfr = "TC0_CMR.CLKS", "Memory", 0xfffa0004, 4, base=16, bitRange=0-2 +sfr = "TC0_CMR.CLKI", "Memory", 0xfffa0004, 4, base=16, bitRange=3 +sfr = "TC0_CMR.BURST", "Memory", 0xfffa0004, 4, base=16, bitRange=4-5 +sfr = "TC0_CMR.CPCSTOP", "Memory", 0xfffa0004, 4, base=16, bitRange=6 +sfr = "TC0_CMR.LDBSTOP", "Memory", 0xfffa0004, 4, base=16, bitRange=6 +sfr = "TC0_CMR.CPCDIS", "Memory", 0xfffa0004, 4, base=16, bitRange=7 +sfr = "TC0_CMR.LDBDIS", "Memory", 0xfffa0004, 4, base=16, bitRange=7 +sfr = "TC0_CMR.ETRGEDG", "Memory", 0xfffa0004, 4, base=16, bitRange=8-9 +sfr = "TC0_CMR.EEVTEDG", "Memory", 0xfffa0004, 4, base=16, bitRange=8-9 +sfr = "TC0_CMR.EEVT", "Memory", 0xfffa0004, 4, base=16, bitRange=10-11 +sfr = "TC0_CMR.ABETRG", "Memory", 0xfffa0004, 4, base=16, bitRange=10 +sfr = "TC0_CMR.ENETRG", "Memory", 0xfffa0004, 4, base=16, bitRange=12 +sfr = "TC0_CMR.WAVESEL", "Memory", 0xfffa0004, 4, base=16, bitRange=13-14 +sfr = "TC0_CMR.CPCTRG", "Memory", 0xfffa0004, 4, base=16, bitRange=14 +sfr = "TC0_CMR.WAVE", "Memory", 0xfffa0004, 4, base=16, bitRange=15 +sfr = "TC0_CMR.ACPA", "Memory", 0xfffa0004, 4, base=16, bitRange=16-17 +sfr = "TC0_CMR.LDRA", "Memory", 0xfffa0004, 4, base=16, bitRange=16-17 +sfr = "TC0_CMR.ACPC", "Memory", 0xfffa0004, 4, base=16, bitRange=18-19 +sfr = "TC0_CMR.LDRB", "Memory", 0xfffa0004, 4, base=16, bitRange=18-19 +sfr = "TC0_CMR.AEEVT", "Memory", 0xfffa0004, 4, base=16, bitRange=20-21 +sfr = "TC0_CMR.ASWTRG", "Memory", 0xfffa0004, 4, base=16, bitRange=22-23 +sfr = "TC0_CMR.BCPB", "Memory", 0xfffa0004, 4, base=16, bitRange=24-25 +sfr = "TC0_CMR.BCPC", "Memory", 0xfffa0004, 4, base=16, bitRange=26-27 +sfr = "TC0_CMR.BEEVT", "Memory", 0xfffa0004, 4, base=16, bitRange=28-29 +sfr = "TC0_CMR.BSWTRG", "Memory", 0xfffa0004, 4, base=16, bitRange=30-31 +sfr = "TC0_CV", "Memory", 0xfffa0010, 4, base=16 +sfr = "TC0_RA", "Memory", 0xfffa0014, 4, base=16 +sfr = "TC0_RB", "Memory", 0xfffa0018, 4, base=16 +sfr = "TC0_RC", "Memory", 0xfffa001c, 4, base=16 +sfr = "TC0_SR", "Memory", 0xfffa0020, 4, base=16 +sfr = "TC0_SR.COVFS", "Memory", 0xfffa0020, 4, base=16, bitRange=0 +sfr = "TC0_SR.LOVRS", "Memory", 0xfffa0020, 4, base=16, bitRange=1 +sfr = "TC0_SR.CPAS", "Memory", 0xfffa0020, 4, base=16, bitRange=2 +sfr = "TC0_SR.CPBS", "Memory", 0xfffa0020, 4, base=16, bitRange=3 +sfr = "TC0_SR.CPCS", "Memory", 0xfffa0020, 4, base=16, bitRange=4 +sfr = "TC0_SR.LDRAS", "Memory", 0xfffa0020, 4, base=16, bitRange=5 +sfr = "TC0_SR.LDRBS", "Memory", 0xfffa0020, 4, base=16, bitRange=6 +sfr = "TC0_SR.ETRGS", "Memory", 0xfffa0020, 4, base=16, bitRange=7 +sfr = "TC0_SR.CLKSTA", "Memory", 0xfffa0020, 4, base=16, bitRange=16 +sfr = "TC0_SR.MTIOA", "Memory", 0xfffa0020, 4, base=16, bitRange=17 +sfr = "TC0_SR.MTIOB", "Memory", 0xfffa0020, 4, base=16, bitRange=18 +sfr = "TC0_IER", "Memory", 0xfffa0024, 4, base=16 +sfr = "TC0_IER.COVFS", "Memory", 0xfffa0024, 4, base=16, bitRange=0 +sfr = "TC0_IER.LOVRS", "Memory", 0xfffa0024, 4, base=16, bitRange=1 +sfr = "TC0_IER.CPAS", "Memory", 0xfffa0024, 4, base=16, bitRange=2 +sfr = "TC0_IER.CPBS", "Memory", 0xfffa0024, 4, base=16, bitRange=3 +sfr = "TC0_IER.CPCS", "Memory", 0xfffa0024, 4, base=16, bitRange=4 +sfr = "TC0_IER.LDRAS", "Memory", 0xfffa0024, 4, base=16, bitRange=5 +sfr = "TC0_IER.LDRBS", "Memory", 0xfffa0024, 4, base=16, bitRange=6 +sfr = "TC0_IER.ETRGS", "Memory", 0xfffa0024, 4, base=16, bitRange=7 +sfr = "TC0_IDR", "Memory", 0xfffa0028, 4, base=16 +sfr = "TC0_IDR.COVFS", "Memory", 0xfffa0028, 4, base=16, bitRange=0 +sfr = "TC0_IDR.LOVRS", "Memory", 0xfffa0028, 4, base=16, bitRange=1 +sfr = "TC0_IDR.CPAS", "Memory", 0xfffa0028, 4, base=16, bitRange=2 +sfr = "TC0_IDR.CPBS", "Memory", 0xfffa0028, 4, base=16, bitRange=3 +sfr = "TC0_IDR.CPCS", "Memory", 0xfffa0028, 4, base=16, bitRange=4 +sfr = "TC0_IDR.LDRAS", "Memory", 0xfffa0028, 4, base=16, bitRange=5 +sfr = "TC0_IDR.LDRBS", "Memory", 0xfffa0028, 4, base=16, bitRange=6 +sfr = "TC0_IDR.ETRGS", "Memory", 0xfffa0028, 4, base=16, bitRange=7 +sfr = "TC0_IMR", "Memory", 0xfffa002c, 4, base=16 +sfr = "TC0_IMR.COVFS", "Memory", 0xfffa002c, 4, base=16, bitRange=0 +sfr = "TC0_IMR.LOVRS", "Memory", 0xfffa002c, 4, base=16, bitRange=1 +sfr = "TC0_IMR.CPAS", "Memory", 0xfffa002c, 4, base=16, bitRange=2 +sfr = "TC0_IMR.CPBS", "Memory", 0xfffa002c, 4, base=16, bitRange=3 +sfr = "TC0_IMR.CPCS", "Memory", 0xfffa002c, 4, base=16, bitRange=4 +sfr = "TC0_IMR.LDRAS", "Memory", 0xfffa002c, 4, base=16, bitRange=5 +sfr = "TC0_IMR.LDRBS", "Memory", 0xfffa002c, 4, base=16, bitRange=6 +sfr = "TC0_IMR.ETRGS", "Memory", 0xfffa002c, 4, base=16, bitRange=7 +; ========== Register definition for TC1 peripheral ========== +sfr = "TC1_CCR", "Memory", 0xfffa0040, 4, base=16 +sfr = "TC1_CCR.CLKEN", "Memory", 0xfffa0040, 4, base=16, bitRange=0 +sfr = "TC1_CCR.CLKDIS", "Memory", 0xfffa0040, 4, base=16, bitRange=1 +sfr = "TC1_CCR.SWTRG", "Memory", 0xfffa0040, 4, base=16, bitRange=2 +sfr = "TC1_CMR", "Memory", 0xfffa0044, 4, base=16 +sfr = "TC1_CMR.CLKS", "Memory", 0xfffa0044, 4, base=16, bitRange=0-2 +sfr = "TC1_CMR.CLKI", "Memory", 0xfffa0044, 4, base=16, bitRange=3 +sfr = "TC1_CMR.BURST", "Memory", 0xfffa0044, 4, base=16, bitRange=4-5 +sfr = "TC1_CMR.CPCSTOP", "Memory", 0xfffa0044, 4, base=16, bitRange=6 +sfr = "TC1_CMR.LDBSTOP", "Memory", 0xfffa0044, 4, base=16, bitRange=6 +sfr = "TC1_CMR.CPCDIS", "Memory", 0xfffa0044, 4, base=16, bitRange=7 +sfr = "TC1_CMR.LDBDIS", "Memory", 0xfffa0044, 4, base=16, bitRange=7 +sfr = "TC1_CMR.ETRGEDG", "Memory", 0xfffa0044, 4, base=16, bitRange=8-9 +sfr = "TC1_CMR.EEVTEDG", "Memory", 0xfffa0044, 4, base=16, bitRange=8-9 +sfr = "TC1_CMR.EEVT", "Memory", 0xfffa0044, 4, base=16, bitRange=10-11 +sfr = "TC1_CMR.ABETRG", "Memory", 0xfffa0044, 4, base=16, bitRange=10 +sfr = "TC1_CMR.ENETRG", "Memory", 0xfffa0044, 4, base=16, bitRange=12 +sfr = "TC1_CMR.WAVESEL", "Memory", 0xfffa0044, 4, base=16, bitRange=13-14 +sfr = "TC1_CMR.CPCTRG", "Memory", 0xfffa0044, 4, base=16, bitRange=14 +sfr = "TC1_CMR.WAVE", "Memory", 0xfffa0044, 4, base=16, bitRange=15 +sfr = "TC1_CMR.ACPA", "Memory", 0xfffa0044, 4, base=16, bitRange=16-17 +sfr = "TC1_CMR.LDRA", "Memory", 0xfffa0044, 4, base=16, bitRange=16-17 +sfr = "TC1_CMR.ACPC", "Memory", 0xfffa0044, 4, base=16, bitRange=18-19 +sfr = "TC1_CMR.LDRB", "Memory", 0xfffa0044, 4, base=16, bitRange=18-19 +sfr = "TC1_CMR.AEEVT", "Memory", 0xfffa0044, 4, base=16, bitRange=20-21 +sfr = "TC1_CMR.ASWTRG", "Memory", 0xfffa0044, 4, base=16, bitRange=22-23 +sfr = "TC1_CMR.BCPB", "Memory", 0xfffa0044, 4, base=16, bitRange=24-25 +sfr = "TC1_CMR.BCPC", "Memory", 0xfffa0044, 4, base=16, bitRange=26-27 +sfr = "TC1_CMR.BEEVT", "Memory", 0xfffa0044, 4, base=16, bitRange=28-29 +sfr = "TC1_CMR.BSWTRG", "Memory", 0xfffa0044, 4, base=16, bitRange=30-31 +sfr = "TC1_CV", "Memory", 0xfffa0050, 4, base=16 +sfr = "TC1_RA", "Memory", 0xfffa0054, 4, base=16 +sfr = "TC1_RB", "Memory", 0xfffa0058, 4, base=16 +sfr = "TC1_RC", "Memory", 0xfffa005c, 4, base=16 +sfr = "TC1_SR", "Memory", 0xfffa0060, 4, base=16 +sfr = "TC1_SR.COVFS", "Memory", 0xfffa0060, 4, base=16, bitRange=0 +sfr = "TC1_SR.LOVRS", "Memory", 0xfffa0060, 4, base=16, bitRange=1 +sfr = "TC1_SR.CPAS", "Memory", 0xfffa0060, 4, base=16, bitRange=2 +sfr = "TC1_SR.CPBS", "Memory", 0xfffa0060, 4, base=16, bitRange=3 +sfr = "TC1_SR.CPCS", "Memory", 0xfffa0060, 4, base=16, bitRange=4 +sfr = "TC1_SR.LDRAS", "Memory", 0xfffa0060, 4, base=16, bitRange=5 +sfr = "TC1_SR.LDRBS", "Memory", 0xfffa0060, 4, base=16, bitRange=6 +sfr = "TC1_SR.ETRGS", "Memory", 0xfffa0060, 4, base=16, bitRange=7 +sfr = "TC1_SR.CLKSTA", "Memory", 0xfffa0060, 4, base=16, bitRange=16 +sfr = "TC1_SR.MTIOA", "Memory", 0xfffa0060, 4, base=16, bitRange=17 +sfr = "TC1_SR.MTIOB", "Memory", 0xfffa0060, 4, base=16, bitRange=18 +sfr = "TC1_IER", "Memory", 0xfffa0064, 4, base=16 +sfr = "TC1_IER.COVFS", "Memory", 0xfffa0064, 4, base=16, bitRange=0 +sfr = "TC1_IER.LOVRS", "Memory", 0xfffa0064, 4, base=16, bitRange=1 +sfr = "TC1_IER.CPAS", "Memory", 0xfffa0064, 4, base=16, bitRange=2 +sfr = "TC1_IER.CPBS", "Memory", 0xfffa0064, 4, base=16, bitRange=3 +sfr = "TC1_IER.CPCS", "Memory", 0xfffa0064, 4, base=16, bitRange=4 +sfr = "TC1_IER.LDRAS", "Memory", 0xfffa0064, 4, base=16, bitRange=5 +sfr = "TC1_IER.LDRBS", "Memory", 0xfffa0064, 4, base=16, bitRange=6 +sfr = "TC1_IER.ETRGS", "Memory", 0xfffa0064, 4, base=16, bitRange=7 +sfr = "TC1_IDR", "Memory", 0xfffa0068, 4, base=16 +sfr = "TC1_IDR.COVFS", "Memory", 0xfffa0068, 4, base=16, bitRange=0 +sfr = "TC1_IDR.LOVRS", "Memory", 0xfffa0068, 4, base=16, bitRange=1 +sfr = "TC1_IDR.CPAS", "Memory", 0xfffa0068, 4, base=16, bitRange=2 +sfr = "TC1_IDR.CPBS", "Memory", 0xfffa0068, 4, base=16, bitRange=3 +sfr = "TC1_IDR.CPCS", "Memory", 0xfffa0068, 4, base=16, bitRange=4 +sfr = "TC1_IDR.LDRAS", "Memory", 0xfffa0068, 4, base=16, bitRange=5 +sfr = "TC1_IDR.LDRBS", "Memory", 0xfffa0068, 4, base=16, bitRange=6 +sfr = "TC1_IDR.ETRGS", "Memory", 0xfffa0068, 4, base=16, bitRange=7 +sfr = "TC1_IMR", "Memory", 0xfffa006c, 4, base=16 +sfr = "TC1_IMR.COVFS", "Memory", 0xfffa006c, 4, base=16, bitRange=0 +sfr = "TC1_IMR.LOVRS", "Memory", 0xfffa006c, 4, base=16, bitRange=1 +sfr = "TC1_IMR.CPAS", "Memory", 0xfffa006c, 4, base=16, bitRange=2 +sfr = "TC1_IMR.CPBS", "Memory", 0xfffa006c, 4, base=16, bitRange=3 +sfr = "TC1_IMR.CPCS", "Memory", 0xfffa006c, 4, base=16, bitRange=4 +sfr = "TC1_IMR.LDRAS", "Memory", 0xfffa006c, 4, base=16, bitRange=5 +sfr = "TC1_IMR.LDRBS", "Memory", 0xfffa006c, 4, base=16, bitRange=6 +sfr = "TC1_IMR.ETRGS", "Memory", 0xfffa006c, 4, base=16, bitRange=7 +; ========== Register definition for TC2 peripheral ========== +sfr = "TC2_CCR", "Memory", 0xfffa0080, 4, base=16 +sfr = "TC2_CCR.CLKEN", "Memory", 0xfffa0080, 4, base=16, bitRange=0 +sfr = "TC2_CCR.CLKDIS", "Memory", 0xfffa0080, 4, base=16, bitRange=1 +sfr = "TC2_CCR.SWTRG", "Memory", 0xfffa0080, 4, base=16, bitRange=2 +sfr = "TC2_CMR", "Memory", 0xfffa0084, 4, base=16 +sfr = "TC2_CMR.CLKS", "Memory", 0xfffa0084, 4, base=16, bitRange=0-2 +sfr = "TC2_CMR.CLKI", "Memory", 0xfffa0084, 4, base=16, bitRange=3 +sfr = "TC2_CMR.BURST", "Memory", 0xfffa0084, 4, base=16, bitRange=4-5 +sfr = "TC2_CMR.CPCSTOP", "Memory", 0xfffa0084, 4, base=16, bitRange=6 +sfr = "TC2_CMR.LDBSTOP", "Memory", 0xfffa0084, 4, base=16, bitRange=6 +sfr = "TC2_CMR.CPCDIS", "Memory", 0xfffa0084, 4, base=16, bitRange=7 +sfr = "TC2_CMR.LDBDIS", "Memory", 0xfffa0084, 4, base=16, bitRange=7 +sfr = "TC2_CMR.ETRGEDG", "Memory", 0xfffa0084, 4, base=16, bitRange=8-9 +sfr = "TC2_CMR.EEVTEDG", "Memory", 0xfffa0084, 4, base=16, bitRange=8-9 +sfr = "TC2_CMR.EEVT", "Memory", 0xfffa0084, 4, base=16, bitRange=10-11 +sfr = "TC2_CMR.ABETRG", "Memory", 0xfffa0084, 4, base=16, bitRange=10 +sfr = "TC2_CMR.ENETRG", "Memory", 0xfffa0084, 4, base=16, bitRange=12 +sfr = "TC2_CMR.WAVESEL", "Memory", 0xfffa0084, 4, base=16, bitRange=13-14 +sfr = "TC2_CMR.CPCTRG", "Memory", 0xfffa0084, 4, base=16, bitRange=14 +sfr = "TC2_CMR.WAVE", "Memory", 0xfffa0084, 4, base=16, bitRange=15 +sfr = "TC2_CMR.ACPA", "Memory", 0xfffa0084, 4, base=16, bitRange=16-17 +sfr = "TC2_CMR.LDRA", "Memory", 0xfffa0084, 4, base=16, bitRange=16-17 +sfr = "TC2_CMR.ACPC", "Memory", 0xfffa0084, 4, base=16, bitRange=18-19 +sfr = "TC2_CMR.LDRB", "Memory", 0xfffa0084, 4, base=16, bitRange=18-19 +sfr = "TC2_CMR.AEEVT", "Memory", 0xfffa0084, 4, base=16, bitRange=20-21 +sfr = "TC2_CMR.ASWTRG", "Memory", 0xfffa0084, 4, base=16, bitRange=22-23 +sfr = "TC2_CMR.BCPB", "Memory", 0xfffa0084, 4, base=16, bitRange=24-25 +sfr = "TC2_CMR.BCPC", "Memory", 0xfffa0084, 4, base=16, bitRange=26-27 +sfr = "TC2_CMR.BEEVT", "Memory", 0xfffa0084, 4, base=16, bitRange=28-29 +sfr = "TC2_CMR.BSWTRG", "Memory", 0xfffa0084, 4, base=16, bitRange=30-31 +sfr = "TC2_CV", "Memory", 0xfffa0090, 4, base=16 +sfr = "TC2_RA", "Memory", 0xfffa0094, 4, base=16 +sfr = "TC2_RB", "Memory", 0xfffa0098, 4, base=16 +sfr = "TC2_RC", "Memory", 0xfffa009c, 4, base=16 +sfr = "TC2_SR", "Memory", 0xfffa00a0, 4, base=16 +sfr = "TC2_SR.COVFS", "Memory", 0xfffa00a0, 4, base=16, bitRange=0 +sfr = "TC2_SR.LOVRS", "Memory", 0xfffa00a0, 4, base=16, bitRange=1 +sfr = "TC2_SR.CPAS", "Memory", 0xfffa00a0, 4, base=16, bitRange=2 +sfr = "TC2_SR.CPBS", "Memory", 0xfffa00a0, 4, base=16, bitRange=3 +sfr = "TC2_SR.CPCS", "Memory", 0xfffa00a0, 4, base=16, bitRange=4 +sfr = "TC2_SR.LDRAS", "Memory", 0xfffa00a0, 4, base=16, bitRange=5 +sfr = "TC2_SR.LDRBS", "Memory", 0xfffa00a0, 4, base=16, bitRange=6 +sfr = "TC2_SR.ETRGS", "Memory", 0xfffa00a0, 4, base=16, bitRange=7 +sfr = "TC2_SR.CLKSTA", "Memory", 0xfffa00a0, 4, base=16, bitRange=16 +sfr = "TC2_SR.MTIOA", "Memory", 0xfffa00a0, 4, base=16, bitRange=17 +sfr = "TC2_SR.MTIOB", "Memory", 0xfffa00a0, 4, base=16, bitRange=18 +sfr = "TC2_IER", "Memory", 0xfffa00a4, 4, base=16 +sfr = "TC2_IER.COVFS", "Memory", 0xfffa00a4, 4, base=16, bitRange=0 +sfr = "TC2_IER.LOVRS", "Memory", 0xfffa00a4, 4, base=16, bitRange=1 +sfr = "TC2_IER.CPAS", "Memory", 0xfffa00a4, 4, base=16, bitRange=2 +sfr = "TC2_IER.CPBS", "Memory", 0xfffa00a4, 4, base=16, bitRange=3 +sfr = "TC2_IER.CPCS", "Memory", 0xfffa00a4, 4, base=16, bitRange=4 +sfr = "TC2_IER.LDRAS", "Memory", 0xfffa00a4, 4, base=16, bitRange=5 +sfr = "TC2_IER.LDRBS", "Memory", 0xfffa00a4, 4, base=16, bitRange=6 +sfr = "TC2_IER.ETRGS", "Memory", 0xfffa00a4, 4, base=16, bitRange=7 +sfr = "TC2_IDR", "Memory", 0xfffa00a8, 4, base=16 +sfr = "TC2_IDR.COVFS", "Memory", 0xfffa00a8, 4, base=16, bitRange=0 +sfr = "TC2_IDR.LOVRS", "Memory", 0xfffa00a8, 4, base=16, bitRange=1 +sfr = "TC2_IDR.CPAS", "Memory", 0xfffa00a8, 4, base=16, bitRange=2 +sfr = "TC2_IDR.CPBS", "Memory", 0xfffa00a8, 4, base=16, bitRange=3 +sfr = "TC2_IDR.CPCS", "Memory", 0xfffa00a8, 4, base=16, bitRange=4 +sfr = "TC2_IDR.LDRAS", "Memory", 0xfffa00a8, 4, base=16, bitRange=5 +sfr = "TC2_IDR.LDRBS", "Memory", 0xfffa00a8, 4, base=16, bitRange=6 +sfr = "TC2_IDR.ETRGS", "Memory", 0xfffa00a8, 4, base=16, bitRange=7 +sfr = "TC2_IMR", "Memory", 0xfffa00ac, 4, base=16 +sfr = "TC2_IMR.COVFS", "Memory", 0xfffa00ac, 4, base=16, bitRange=0 +sfr = "TC2_IMR.LOVRS", "Memory", 0xfffa00ac, 4, base=16, bitRange=1 +sfr = "TC2_IMR.CPAS", "Memory", 0xfffa00ac, 4, base=16, bitRange=2 +sfr = "TC2_IMR.CPBS", "Memory", 0xfffa00ac, 4, base=16, bitRange=3 +sfr = "TC2_IMR.CPCS", "Memory", 0xfffa00ac, 4, base=16, bitRange=4 +sfr = "TC2_IMR.LDRAS", "Memory", 0xfffa00ac, 4, base=16, bitRange=5 +sfr = "TC2_IMR.LDRBS", "Memory", 0xfffa00ac, 4, base=16, bitRange=6 +sfr = "TC2_IMR.ETRGS", "Memory", 0xfffa00ac, 4, base=16, bitRange=7 +; ========== Register definition for TCB peripheral ========== +sfr = "TCB_BCR", "Memory", 0xfffa00c0, 4, base=16 +sfr = "TCB_BCR.SYNC", "Memory", 0xfffa00c0, 4, base=16, bitRange=0 +sfr = "TCB_BMR", "Memory", 0xfffa00c4, 4, base=16 +sfr = "TCB_BMR.TC0XC0S", "Memory", 0xfffa00c4, 4, base=16, bitRange=0-1 +sfr = "TCB_BMR.TC1XC1S", "Memory", 0xfffa00c4, 4, base=16, bitRange=2-3 +sfr = "TCB_BMR.TC2XC2S", "Memory", 0xfffa00c4, 4, base=16, bitRange=4-5 +; ========== Register definition for CAN_MB0 peripheral ========== +sfr = "CAN_MB0_MMR", "Memory", 0xfffd0200, 4, base=16 +sfr = "CAN_MB0_MMR.MTIMEMARK", "Memory", 0xfffd0200, 4, base=16, bitRange=0-15 +sfr = "CAN_MB0_MMR.PRIOR", "Memory", 0xfffd0200, 4, base=16, bitRange=16-19 +sfr = "CAN_MB0_MMR.MOT", "Memory", 0xfffd0200, 4, base=16, bitRange=24-26 +sfr = "CAN_MB0_MAM", "Memory", 0xfffd0204, 4, base=16 +sfr = "CAN_MB0_MAM.MIDvB", "Memory", 0xfffd0204, 4, base=16, bitRange=0-17 +sfr = "CAN_MB0_MAM.MIDvA", "Memory", 0xfffd0204, 4, base=16, bitRange=18-28 +sfr = "CAN_MB0_MAM.MIDE", "Memory", 0xfffd0204, 4, base=16, bitRange=29 +sfr = "CAN_MB0_MID", "Memory", 0xfffd0208, 4, base=16 +sfr = "CAN_MB0_MID.MIDvB", "Memory", 0xfffd0208, 4, base=16, bitRange=0-17 +sfr = "CAN_MB0_MID.MIDvA", "Memory", 0xfffd0208, 4, base=16, bitRange=18-28 +sfr = "CAN_MB0_MID.MIDE", "Memory", 0xfffd0208, 4, base=16, bitRange=29 +sfr = "CAN_MB0_MFID", "Memory", 0xfffd020c, 4, base=16 +sfr = "CAN_MB0_MSR", "Memory", 0xfffd0210, 4, base=16 +sfr = "CAN_MB0_MSR.MTIMESTAMP", "Memory", 0xfffd0210, 4, base=16, bitRange=0-15 +sfr = "CAN_MB0_MSR.MDLC", "Memory", 0xfffd0210, 4, base=16, bitRange=16-19 +sfr = "CAN_MB0_MSR.MRTR", "Memory", 0xfffd0210, 4, base=16, bitRange=20 +sfr = "CAN_MB0_MSR.MABT", "Memory", 0xfffd0210, 4, base=16, bitRange=22 +sfr = "CAN_MB0_MSR.MRDY", "Memory", 0xfffd0210, 4, base=16, bitRange=23 +sfr = "CAN_MB0_MSR.MMI", "Memory", 0xfffd0210, 4, base=16, bitRange=24 +sfr = "CAN_MB0_MDL", "Memory", 0xfffd0214, 4, base=16 +sfr = "CAN_MB0_MDH", "Memory", 0xfffd0218, 4, base=16 +sfr = "CAN_MB0_MCR", "Memory", 0xfffd021c, 4, base=16 +sfr = "CAN_MB0_MCR.MDLC", "Memory", 0xfffd021c, 4, base=16, bitRange=16-19 +sfr = "CAN_MB0_MCR.MRTR", "Memory", 0xfffd021c, 4, base=16, bitRange=20 +sfr = "CAN_MB0_MCR.MACR", "Memory", 0xfffd021c, 4, base=16, bitRange=22 +sfr = "CAN_MB0_MCR.MTCR", "Memory", 0xfffd021c, 4, base=16, bitRange=23 +; ========== Register definition for CAN_MB1 peripheral ========== +sfr = "CAN_MB1_MMR", "Memory", 0xfffd0220, 4, base=16 +sfr = "CAN_MB1_MMR.MTIMEMARK", "Memory", 0xfffd0220, 4, base=16, bitRange=0-15 +sfr = "CAN_MB1_MMR.PRIOR", "Memory", 0xfffd0220, 4, base=16, bitRange=16-19 +sfr = "CAN_MB1_MMR.MOT", "Memory", 0xfffd0220, 4, base=16, bitRange=24-26 +sfr = "CAN_MB1_MAM", "Memory", 0xfffd0224, 4, base=16 +sfr = "CAN_MB1_MAM.MIDvB", "Memory", 0xfffd0224, 4, base=16, bitRange=0-17 +sfr = "CAN_MB1_MAM.MIDvA", "Memory", 0xfffd0224, 4, base=16, bitRange=18-28 +sfr = "CAN_MB1_MAM.MIDE", "Memory", 0xfffd0224, 4, base=16, bitRange=29 +sfr = "CAN_MB1_MID", "Memory", 0xfffd0228, 4, base=16 +sfr = "CAN_MB1_MID.MIDvB", "Memory", 0xfffd0228, 4, base=16, bitRange=0-17 +sfr = "CAN_MB1_MID.MIDvA", "Memory", 0xfffd0228, 4, base=16, bitRange=18-28 +sfr = "CAN_MB1_MID.MIDE", "Memory", 0xfffd0228, 4, base=16, bitRange=29 +sfr = "CAN_MB1_MFID", "Memory", 0xfffd022c, 4, base=16 +sfr = "CAN_MB1_MSR", "Memory", 0xfffd0230, 4, base=16 +sfr = "CAN_MB1_MSR.MTIMESTAMP", "Memory", 0xfffd0230, 4, base=16, bitRange=0-15 +sfr = "CAN_MB1_MSR.MDLC", "Memory", 0xfffd0230, 4, base=16, bitRange=16-19 +sfr = "CAN_MB1_MSR.MRTR", "Memory", 0xfffd0230, 4, base=16, bitRange=20 +sfr = "CAN_MB1_MSR.MABT", "Memory", 0xfffd0230, 4, base=16, bitRange=22 +sfr = "CAN_MB1_MSR.MRDY", "Memory", 0xfffd0230, 4, base=16, bitRange=23 +sfr = "CAN_MB1_MSR.MMI", "Memory", 0xfffd0230, 4, base=16, bitRange=24 +sfr = "CAN_MB1_MDL", "Memory", 0xfffd0234, 4, base=16 +sfr = "CAN_MB1_MDH", "Memory", 0xfffd0238, 4, base=16 +sfr = "CAN_MB1_MCR", "Memory", 0xfffd023c, 4, base=16 +sfr = "CAN_MB1_MCR.MDLC", "Memory", 0xfffd023c, 4, base=16, bitRange=16-19 +sfr = "CAN_MB1_MCR.MRTR", "Memory", 0xfffd023c, 4, base=16, bitRange=20 +sfr = "CAN_MB1_MCR.MACR", "Memory", 0xfffd023c, 4, base=16, bitRange=22 +sfr = "CAN_MB1_MCR.MTCR", "Memory", 0xfffd023c, 4, base=16, bitRange=23 +; ========== Register definition for CAN_MB2 peripheral ========== +sfr = "CAN_MB2_MMR", "Memory", 0xfffd0240, 4, base=16 +sfr = "CAN_MB2_MMR.MTIMEMARK", "Memory", 0xfffd0240, 4, base=16, bitRange=0-15 +sfr = "CAN_MB2_MMR.PRIOR", "Memory", 0xfffd0240, 4, base=16, bitRange=16-19 +sfr = "CAN_MB2_MMR.MOT", "Memory", 0xfffd0240, 4, base=16, bitRange=24-26 +sfr = "CAN_MB2_MAM", "Memory", 0xfffd0244, 4, base=16 +sfr = "CAN_MB2_MAM.MIDvB", "Memory", 0xfffd0244, 4, base=16, bitRange=0-17 +sfr = "CAN_MB2_MAM.MIDvA", "Memory", 0xfffd0244, 4, base=16, bitRange=18-28 +sfr = "CAN_MB2_MAM.MIDE", "Memory", 0xfffd0244, 4, base=16, bitRange=29 +sfr = "CAN_MB2_MID", "Memory", 0xfffd0248, 4, base=16 +sfr = "CAN_MB2_MID.MIDvB", "Memory", 0xfffd0248, 4, base=16, bitRange=0-17 +sfr = "CAN_MB2_MID.MIDvA", "Memory", 0xfffd0248, 4, base=16, bitRange=18-28 +sfr = "CAN_MB2_MID.MIDE", "Memory", 0xfffd0248, 4, base=16, bitRange=29 +sfr = "CAN_MB2_MFID", "Memory", 0xfffd024c, 4, base=16 +sfr = "CAN_MB2_MSR", "Memory", 0xfffd0250, 4, base=16 +sfr = "CAN_MB2_MSR.MTIMESTAMP", "Memory", 0xfffd0250, 4, base=16, bitRange=0-15 +sfr = "CAN_MB2_MSR.MDLC", "Memory", 0xfffd0250, 4, base=16, bitRange=16-19 +sfr = "CAN_MB2_MSR.MRTR", "Memory", 0xfffd0250, 4, base=16, bitRange=20 +sfr = "CAN_MB2_MSR.MABT", "Memory", 0xfffd0250, 4, base=16, bitRange=22 +sfr = "CAN_MB2_MSR.MRDY", "Memory", 0xfffd0250, 4, base=16, bitRange=23 +sfr = "CAN_MB2_MSR.MMI", "Memory", 0xfffd0250, 4, base=16, bitRange=24 +sfr = "CAN_MB2_MDL", "Memory", 0xfffd0254, 4, base=16 +sfr = "CAN_MB2_MDH", "Memory", 0xfffd0258, 4, base=16 +sfr = "CAN_MB2_MCR", "Memory", 0xfffd025c, 4, base=16 +sfr = "CAN_MB2_MCR.MDLC", "Memory", 0xfffd025c, 4, base=16, bitRange=16-19 +sfr = "CAN_MB2_MCR.MRTR", "Memory", 0xfffd025c, 4, base=16, bitRange=20 +sfr = "CAN_MB2_MCR.MACR", "Memory", 0xfffd025c, 4, base=16, bitRange=22 +sfr = "CAN_MB2_MCR.MTCR", "Memory", 0xfffd025c, 4, base=16, bitRange=23 +; ========== Register definition for CAN_MB3 peripheral ========== +sfr = "CAN_MB3_MMR", "Memory", 0xfffd0260, 4, base=16 +sfr = "CAN_MB3_MMR.MTIMEMARK", "Memory", 0xfffd0260, 4, base=16, bitRange=0-15 +sfr = "CAN_MB3_MMR.PRIOR", "Memory", 0xfffd0260, 4, base=16, bitRange=16-19 +sfr = "CAN_MB3_MMR.MOT", "Memory", 0xfffd0260, 4, base=16, bitRange=24-26 +sfr = "CAN_MB3_MAM", "Memory", 0xfffd0264, 4, base=16 +sfr = "CAN_MB3_MAM.MIDvB", "Memory", 0xfffd0264, 4, base=16, bitRange=0-17 +sfr = "CAN_MB3_MAM.MIDvA", "Memory", 0xfffd0264, 4, base=16, bitRange=18-28 +sfr = "CAN_MB3_MAM.MIDE", "Memory", 0xfffd0264, 4, base=16, bitRange=29 +sfr = "CAN_MB3_MID", "Memory", 0xfffd0268, 4, base=16 +sfr = "CAN_MB3_MID.MIDvB", "Memory", 0xfffd0268, 4, base=16, bitRange=0-17 +sfr = "CAN_MB3_MID.MIDvA", "Memory", 0xfffd0268, 4, base=16, bitRange=18-28 +sfr = "CAN_MB3_MID.MIDE", "Memory", 0xfffd0268, 4, base=16, bitRange=29 +sfr = "CAN_MB3_MFID", "Memory", 0xfffd026c, 4, base=16 +sfr = "CAN_MB3_MSR", "Memory", 0xfffd0270, 4, base=16 +sfr = "CAN_MB3_MSR.MTIMESTAMP", "Memory", 0xfffd0270, 4, base=16, bitRange=0-15 +sfr = "CAN_MB3_MSR.MDLC", "Memory", 0xfffd0270, 4, base=16, bitRange=16-19 +sfr = "CAN_MB3_MSR.MRTR", "Memory", 0xfffd0270, 4, base=16, bitRange=20 +sfr = "CAN_MB3_MSR.MABT", "Memory", 0xfffd0270, 4, base=16, bitRange=22 +sfr = "CAN_MB3_MSR.MRDY", "Memory", 0xfffd0270, 4, base=16, bitRange=23 +sfr = "CAN_MB3_MSR.MMI", "Memory", 0xfffd0270, 4, base=16, bitRange=24 +sfr = "CAN_MB3_MDL", "Memory", 0xfffd0274, 4, base=16 +sfr = "CAN_MB3_MDH", "Memory", 0xfffd0278, 4, base=16 +sfr = "CAN_MB3_MCR", "Memory", 0xfffd027c, 4, base=16 +sfr = "CAN_MB3_MCR.MDLC", "Memory", 0xfffd027c, 4, base=16, bitRange=16-19 +sfr = "CAN_MB3_MCR.MRTR", "Memory", 0xfffd027c, 4, base=16, bitRange=20 +sfr = "CAN_MB3_MCR.MACR", "Memory", 0xfffd027c, 4, base=16, bitRange=22 +sfr = "CAN_MB3_MCR.MTCR", "Memory", 0xfffd027c, 4, base=16, bitRange=23 +; ========== Register definition for CAN_MB4 peripheral ========== +sfr = "CAN_MB4_MMR", "Memory", 0xfffd0280, 4, base=16 +sfr = "CAN_MB4_MMR.MTIMEMARK", "Memory", 0xfffd0280, 4, base=16, bitRange=0-15 +sfr = "CAN_MB4_MMR.PRIOR", "Memory", 0xfffd0280, 4, base=16, bitRange=16-19 +sfr = "CAN_MB4_MMR.MOT", "Memory", 0xfffd0280, 4, base=16, bitRange=24-26 +sfr = "CAN_MB4_MAM", "Memory", 0xfffd0284, 4, base=16 +sfr = "CAN_MB4_MAM.MIDvB", "Memory", 0xfffd0284, 4, base=16, bitRange=0-17 +sfr = "CAN_MB4_MAM.MIDvA", "Memory", 0xfffd0284, 4, base=16, bitRange=18-28 +sfr = "CAN_MB4_MAM.MIDE", "Memory", 0xfffd0284, 4, base=16, bitRange=29 +sfr = "CAN_MB4_MID", "Memory", 0xfffd0288, 4, base=16 +sfr = "CAN_MB4_MID.MIDvB", "Memory", 0xfffd0288, 4, base=16, bitRange=0-17 +sfr = "CAN_MB4_MID.MIDvA", "Memory", 0xfffd0288, 4, base=16, bitRange=18-28 +sfr = "CAN_MB4_MID.MIDE", "Memory", 0xfffd0288, 4, base=16, bitRange=29 +sfr = "CAN_MB4_MFID", "Memory", 0xfffd028c, 4, base=16 +sfr = "CAN_MB4_MSR", "Memory", 0xfffd0290, 4, base=16 +sfr = "CAN_MB4_MSR.MTIMESTAMP", "Memory", 0xfffd0290, 4, base=16, bitRange=0-15 +sfr = "CAN_MB4_MSR.MDLC", "Memory", 0xfffd0290, 4, base=16, bitRange=16-19 +sfr = "CAN_MB4_MSR.MRTR", "Memory", 0xfffd0290, 4, base=16, bitRange=20 +sfr = "CAN_MB4_MSR.MABT", "Memory", 0xfffd0290, 4, base=16, bitRange=22 +sfr = "CAN_MB4_MSR.MRDY", "Memory", 0xfffd0290, 4, base=16, bitRange=23 +sfr = "CAN_MB4_MSR.MMI", "Memory", 0xfffd0290, 4, base=16, bitRange=24 +sfr = "CAN_MB4_MDL", "Memory", 0xfffd0294, 4, base=16 +sfr = "CAN_MB4_MDH", "Memory", 0xfffd0298, 4, base=16 +sfr = "CAN_MB4_MCR", "Memory", 0xfffd029c, 4, base=16 +sfr = "CAN_MB4_MCR.MDLC", "Memory", 0xfffd029c, 4, base=16, bitRange=16-19 +sfr = "CAN_MB4_MCR.MRTR", "Memory", 0xfffd029c, 4, base=16, bitRange=20 +sfr = "CAN_MB4_MCR.MACR", "Memory", 0xfffd029c, 4, base=16, bitRange=22 +sfr = "CAN_MB4_MCR.MTCR", "Memory", 0xfffd029c, 4, base=16, bitRange=23 +; ========== Register definition for CAN_MB5 peripheral ========== +sfr = "CAN_MB5_MMR", "Memory", 0xfffd02a0, 4, base=16 +sfr = "CAN_MB5_MMR.MTIMEMARK", "Memory", 0xfffd02a0, 4, base=16, bitRange=0-15 +sfr = "CAN_MB5_MMR.PRIOR", "Memory", 0xfffd02a0, 4, base=16, bitRange=16-19 +sfr = "CAN_MB5_MMR.MOT", "Memory", 0xfffd02a0, 4, base=16, bitRange=24-26 +sfr = "CAN_MB5_MAM", "Memory", 0xfffd02a4, 4, base=16 +sfr = "CAN_MB5_MAM.MIDvB", "Memory", 0xfffd02a4, 4, base=16, bitRange=0-17 +sfr = "CAN_MB5_MAM.MIDvA", "Memory", 0xfffd02a4, 4, base=16, bitRange=18-28 +sfr = "CAN_MB5_MAM.MIDE", "Memory", 0xfffd02a4, 4, base=16, bitRange=29 +sfr = "CAN_MB5_MID", "Memory", 0xfffd02a8, 4, base=16 +sfr = "CAN_MB5_MID.MIDvB", "Memory", 0xfffd02a8, 4, base=16, bitRange=0-17 +sfr = "CAN_MB5_MID.MIDvA", "Memory", 0xfffd02a8, 4, base=16, bitRange=18-28 +sfr = "CAN_MB5_MID.MIDE", "Memory", 0xfffd02a8, 4, base=16, bitRange=29 +sfr = "CAN_MB5_MFID", "Memory", 0xfffd02ac, 4, base=16 +sfr = "CAN_MB5_MSR", "Memory", 0xfffd02b0, 4, base=16 +sfr = "CAN_MB5_MSR.MTIMESTAMP", "Memory", 0xfffd02b0, 4, base=16, bitRange=0-15 +sfr = "CAN_MB5_MSR.MDLC", "Memory", 0xfffd02b0, 4, base=16, bitRange=16-19 +sfr = "CAN_MB5_MSR.MRTR", "Memory", 0xfffd02b0, 4, base=16, bitRange=20 +sfr = "CAN_MB5_MSR.MABT", "Memory", 0xfffd02b0, 4, base=16, bitRange=22 +sfr = "CAN_MB5_MSR.MRDY", "Memory", 0xfffd02b0, 4, base=16, bitRange=23 +sfr = "CAN_MB5_MSR.MMI", "Memory", 0xfffd02b0, 4, base=16, bitRange=24 +sfr = "CAN_MB5_MDL", "Memory", 0xfffd02b4, 4, base=16 +sfr = "CAN_MB5_MDH", "Memory", 0xfffd02b8, 4, base=16 +sfr = "CAN_MB5_MCR", "Memory", 0xfffd02bc, 4, base=16 +sfr = "CAN_MB5_MCR.MDLC", "Memory", 0xfffd02bc, 4, base=16, bitRange=16-19 +sfr = "CAN_MB5_MCR.MRTR", "Memory", 0xfffd02bc, 4, base=16, bitRange=20 +sfr = "CAN_MB5_MCR.MACR", "Memory", 0xfffd02bc, 4, base=16, bitRange=22 +sfr = "CAN_MB5_MCR.MTCR", "Memory", 0xfffd02bc, 4, base=16, bitRange=23 +; ========== Register definition for CAN_MB6 peripheral ========== +sfr = "CAN_MB6_MMR", "Memory", 0xfffd02c0, 4, base=16 +sfr = "CAN_MB6_MMR.MTIMEMARK", "Memory", 0xfffd02c0, 4, base=16, bitRange=0-15 +sfr = "CAN_MB6_MMR.PRIOR", "Memory", 0xfffd02c0, 4, base=16, bitRange=16-19 +sfr = "CAN_MB6_MMR.MOT", "Memory", 0xfffd02c0, 4, base=16, bitRange=24-26 +sfr = "CAN_MB6_MAM", "Memory", 0xfffd02c4, 4, base=16 +sfr = "CAN_MB6_MAM.MIDvB", "Memory", 0xfffd02c4, 4, base=16, bitRange=0-17 +sfr = "CAN_MB6_MAM.MIDvA", "Memory", 0xfffd02c4, 4, base=16, bitRange=18-28 +sfr = "CAN_MB6_MAM.MIDE", "Memory", 0xfffd02c4, 4, base=16, bitRange=29 +sfr = "CAN_MB6_MID", "Memory", 0xfffd02c8, 4, base=16 +sfr = "CAN_MB6_MID.MIDvB", "Memory", 0xfffd02c8, 4, base=16, bitRange=0-17 +sfr = "CAN_MB6_MID.MIDvA", "Memory", 0xfffd02c8, 4, base=16, bitRange=18-28 +sfr = "CAN_MB6_MID.MIDE", "Memory", 0xfffd02c8, 4, base=16, bitRange=29 +sfr = "CAN_MB6_MFID", "Memory", 0xfffd02cc, 4, base=16 +sfr = "CAN_MB6_MSR", "Memory", 0xfffd02d0, 4, base=16 +sfr = "CAN_MB6_MSR.MTIMESTAMP", "Memory", 0xfffd02d0, 4, base=16, bitRange=0-15 +sfr = "CAN_MB6_MSR.MDLC", "Memory", 0xfffd02d0, 4, base=16, bitRange=16-19 +sfr = "CAN_MB6_MSR.MRTR", "Memory", 0xfffd02d0, 4, base=16, bitRange=20 +sfr = "CAN_MB6_MSR.MABT", "Memory", 0xfffd02d0, 4, base=16, bitRange=22 +sfr = "CAN_MB6_MSR.MRDY", "Memory", 0xfffd02d0, 4, base=16, bitRange=23 +sfr = "CAN_MB6_MSR.MMI", "Memory", 0xfffd02d0, 4, base=16, bitRange=24 +sfr = "CAN_MB6_MDL", "Memory", 0xfffd02d4, 4, base=16 +sfr = "CAN_MB6_MDH", "Memory", 0xfffd02d8, 4, base=16 +sfr = "CAN_MB6_MCR", "Memory", 0xfffd02dc, 4, base=16 +sfr = "CAN_MB6_MCR.MDLC", "Memory", 0xfffd02dc, 4, base=16, bitRange=16-19 +sfr = "CAN_MB6_MCR.MRTR", "Memory", 0xfffd02dc, 4, base=16, bitRange=20 +sfr = "CAN_MB6_MCR.MACR", "Memory", 0xfffd02dc, 4, base=16, bitRange=22 +sfr = "CAN_MB6_MCR.MTCR", "Memory", 0xfffd02dc, 4, base=16, bitRange=23 +; ========== Register definition for CAN_MB7 peripheral ========== +sfr = "CAN_MB7_MMR", "Memory", 0xfffd02e0, 4, base=16 +sfr = "CAN_MB7_MMR.MTIMEMARK", "Memory", 0xfffd02e0, 4, base=16, bitRange=0-15 +sfr = "CAN_MB7_MMR.PRIOR", "Memory", 0xfffd02e0, 4, base=16, bitRange=16-19 +sfr = "CAN_MB7_MMR.MOT", "Memory", 0xfffd02e0, 4, base=16, bitRange=24-26 +sfr = "CAN_MB7_MAM", "Memory", 0xfffd02e4, 4, base=16 +sfr = "CAN_MB7_MAM.MIDvB", "Memory", 0xfffd02e4, 4, base=16, bitRange=0-17 +sfr = "CAN_MB7_MAM.MIDvA", "Memory", 0xfffd02e4, 4, base=16, bitRange=18-28 +sfr = "CAN_MB7_MAM.MIDE", "Memory", 0xfffd02e4, 4, base=16, bitRange=29 +sfr = "CAN_MB7_MID", "Memory", 0xfffd02e8, 4, base=16 +sfr = "CAN_MB7_MID.MIDvB", "Memory", 0xfffd02e8, 4, base=16, bitRange=0-17 +sfr = "CAN_MB7_MID.MIDvA", "Memory", 0xfffd02e8, 4, base=16, bitRange=18-28 +sfr = "CAN_MB7_MID.MIDE", "Memory", 0xfffd02e8, 4, base=16, bitRange=29 +sfr = "CAN_MB7_MFID", "Memory", 0xfffd02ec, 4, base=16 +sfr = "CAN_MB7_MSR", "Memory", 0xfffd02f0, 4, base=16 +sfr = "CAN_MB7_MSR.MTIMESTAMP", "Memory", 0xfffd02f0, 4, base=16, bitRange=0-15 +sfr = "CAN_MB7_MSR.MDLC", "Memory", 0xfffd02f0, 4, base=16, bitRange=16-19 +sfr = "CAN_MB7_MSR.MRTR", "Memory", 0xfffd02f0, 4, base=16, bitRange=20 +sfr = "CAN_MB7_MSR.MABT", "Memory", 0xfffd02f0, 4, base=16, bitRange=22 +sfr = "CAN_MB7_MSR.MRDY", "Memory", 0xfffd02f0, 4, base=16, bitRange=23 +sfr = "CAN_MB7_MSR.MMI", "Memory", 0xfffd02f0, 4, base=16, bitRange=24 +sfr = "CAN_MB7_MDL", "Memory", 0xfffd02f4, 4, base=16 +sfr = "CAN_MB7_MDH", "Memory", 0xfffd02f8, 4, base=16 +sfr = "CAN_MB7_MCR", "Memory", 0xfffd02fc, 4, base=16 +sfr = "CAN_MB7_MCR.MDLC", "Memory", 0xfffd02fc, 4, base=16, bitRange=16-19 +sfr = "CAN_MB7_MCR.MRTR", "Memory", 0xfffd02fc, 4, base=16, bitRange=20 +sfr = "CAN_MB7_MCR.MACR", "Memory", 0xfffd02fc, 4, base=16, bitRange=22 +sfr = "CAN_MB7_MCR.MTCR", "Memory", 0xfffd02fc, 4, base=16, bitRange=23 +; ========== Register definition for CAN peripheral ========== +sfr = "CAN_MR", "Memory", 0xfffd0000, 4, base=16 +sfr = "CAN_MR.CANEN", "Memory", 0xfffd0000, 4, base=16, bitRange=0 +sfr = "CAN_MR.LPM", "Memory", 0xfffd0000, 4, base=16, bitRange=1 +sfr = "CAN_MR.ABM", "Memory", 0xfffd0000, 4, base=16, bitRange=2 +sfr = "CAN_MR.OVL", "Memory", 0xfffd0000, 4, base=16, bitRange=3 +sfr = "CAN_MR.TEOF", "Memory", 0xfffd0000, 4, base=16, bitRange=4 +sfr = "CAN_MR.TTM", "Memory", 0xfffd0000, 4, base=16, bitRange=5 +sfr = "CAN_MR.TIMFRZ", "Memory", 0xfffd0000, 4, base=16, bitRange=6 +sfr = "CAN_MR.DRPT", "Memory", 0xfffd0000, 4, base=16, bitRange=7 +sfr = "CAN_IER", "Memory", 0xfffd0004, 4, base=16 +sfr = "CAN_IER.MB0", "Memory", 0xfffd0004, 4, base=16, bitRange=0 +sfr = "CAN_IER.MB1", "Memory", 0xfffd0004, 4, base=16, bitRange=1 +sfr = "CAN_IER.MB2", "Memory", 0xfffd0004, 4, base=16, bitRange=2 +sfr = "CAN_IER.MB3", "Memory", 0xfffd0004, 4, base=16, bitRange=3 +sfr = "CAN_IER.MB4", "Memory", 0xfffd0004, 4, base=16, bitRange=4 +sfr = "CAN_IER.MB5", "Memory", 0xfffd0004, 4, base=16, bitRange=5 +sfr = "CAN_IER.MB6", "Memory", 0xfffd0004, 4, base=16, bitRange=6 +sfr = "CAN_IER.MB7", "Memory", 0xfffd0004, 4, base=16, bitRange=7 +sfr = "CAN_IER.MB8", "Memory", 0xfffd0004, 4, base=16, bitRange=8 +sfr = "CAN_IER.MB9", "Memory", 0xfffd0004, 4, base=16, bitRange=9 +sfr = "CAN_IER.MB10", "Memory", 0xfffd0004, 4, base=16, bitRange=10 +sfr = "CAN_IER.MB11", "Memory", 0xfffd0004, 4, base=16, bitRange=11 +sfr = "CAN_IER.MB12", "Memory", 0xfffd0004, 4, base=16, bitRange=12 +sfr = "CAN_IER.MB13", "Memory", 0xfffd0004, 4, base=16, bitRange=13 +sfr = "CAN_IER.MB14", "Memory", 0xfffd0004, 4, base=16, bitRange=14 +sfr = "CAN_IER.MB15", "Memory", 0xfffd0004, 4, base=16, bitRange=15 +sfr = "CAN_IER.ERRA", "Memory", 0xfffd0004, 4, base=16, bitRange=16 +sfr = "CAN_IER.WARN", "Memory", 0xfffd0004, 4, base=16, bitRange=17 +sfr = "CAN_IER.ERRP", "Memory", 0xfffd0004, 4, base=16, bitRange=18 +sfr = "CAN_IER.BOFF", "Memory", 0xfffd0004, 4, base=16, bitRange=19 +sfr = "CAN_IER.SLEEP", "Memory", 0xfffd0004, 4, base=16, bitRange=20 +sfr = "CAN_IER.WAKEUP", "Memory", 0xfffd0004, 4, base=16, bitRange=21 +sfr = "CAN_IER.TOVF", "Memory", 0xfffd0004, 4, base=16, bitRange=22 +sfr = "CAN_IER.TSTP", "Memory", 0xfffd0004, 4, base=16, bitRange=23 +sfr = "CAN_IER.CERR", "Memory", 0xfffd0004, 4, base=16, bitRange=24 +sfr = "CAN_IER.SERR", "Memory", 0xfffd0004, 4, base=16, bitRange=25 +sfr = "CAN_IER.AERR", "Memory", 0xfffd0004, 4, base=16, bitRange=26 +sfr = "CAN_IER.FERR", "Memory", 0xfffd0004, 4, base=16, bitRange=27 +sfr = "CAN_IER.BERR", "Memory", 0xfffd0004, 4, base=16, bitRange=28 +sfr = "CAN_IDR", "Memory", 0xfffd0008, 4, base=16 +sfr = "CAN_IDR.MB0", "Memory", 0xfffd0008, 4, base=16, bitRange=0 +sfr = "CAN_IDR.MB1", "Memory", 0xfffd0008, 4, base=16, bitRange=1 +sfr = "CAN_IDR.MB2", "Memory", 0xfffd0008, 4, base=16, bitRange=2 +sfr = "CAN_IDR.MB3", "Memory", 0xfffd0008, 4, base=16, bitRange=3 +sfr = "CAN_IDR.MB4", "Memory", 0xfffd0008, 4, base=16, bitRange=4 +sfr = "CAN_IDR.MB5", "Memory", 0xfffd0008, 4, base=16, bitRange=5 +sfr = "CAN_IDR.MB6", "Memory", 0xfffd0008, 4, base=16, bitRange=6 +sfr = "CAN_IDR.MB7", "Memory", 0xfffd0008, 4, base=16, bitRange=7 +sfr = "CAN_IDR.MB8", "Memory", 0xfffd0008, 4, base=16, bitRange=8 +sfr = "CAN_IDR.MB9", "Memory", 0xfffd0008, 4, base=16, bitRange=9 +sfr = "CAN_IDR.MB10", "Memory", 0xfffd0008, 4, base=16, bitRange=10 +sfr = "CAN_IDR.MB11", "Memory", 0xfffd0008, 4, base=16, bitRange=11 +sfr = "CAN_IDR.MB12", "Memory", 0xfffd0008, 4, base=16, bitRange=12 +sfr = "CAN_IDR.MB13", "Memory", 0xfffd0008, 4, base=16, bitRange=13 +sfr = "CAN_IDR.MB14", "Memory", 0xfffd0008, 4, base=16, bitRange=14 +sfr = "CAN_IDR.MB15", "Memory", 0xfffd0008, 4, base=16, bitRange=15 +sfr = "CAN_IDR.ERRA", "Memory", 0xfffd0008, 4, base=16, bitRange=16 +sfr = "CAN_IDR.WARN", "Memory", 0xfffd0008, 4, base=16, bitRange=17 +sfr = "CAN_IDR.ERRP", "Memory", 0xfffd0008, 4, base=16, bitRange=18 +sfr = "CAN_IDR.BOFF", "Memory", 0xfffd0008, 4, base=16, bitRange=19 +sfr = "CAN_IDR.SLEEP", "Memory", 0xfffd0008, 4, base=16, bitRange=20 +sfr = "CAN_IDR.WAKEUP", "Memory", 0xfffd0008, 4, base=16, bitRange=21 +sfr = "CAN_IDR.TOVF", "Memory", 0xfffd0008, 4, base=16, bitRange=22 +sfr = "CAN_IDR.TSTP", "Memory", 0xfffd0008, 4, base=16, bitRange=23 +sfr = "CAN_IDR.CERR", "Memory", 0xfffd0008, 4, base=16, bitRange=24 +sfr = "CAN_IDR.SERR", "Memory", 0xfffd0008, 4, base=16, bitRange=25 +sfr = "CAN_IDR.AERR", "Memory", 0xfffd0008, 4, base=16, bitRange=26 +sfr = "CAN_IDR.FERR", "Memory", 0xfffd0008, 4, base=16, bitRange=27 +sfr = "CAN_IDR.BERR", "Memory", 0xfffd0008, 4, base=16, bitRange=28 +sfr = "CAN_IMR", "Memory", 0xfffd000c, 4, base=16 +sfr = "CAN_IMR.MB0", "Memory", 0xfffd000c, 4, base=16, bitRange=0 +sfr = "CAN_IMR.MB1", "Memory", 0xfffd000c, 4, base=16, bitRange=1 +sfr = "CAN_IMR.MB2", "Memory", 0xfffd000c, 4, base=16, bitRange=2 +sfr = "CAN_IMR.MB3", "Memory", 0xfffd000c, 4, base=16, bitRange=3 +sfr = "CAN_IMR.MB4", "Memory", 0xfffd000c, 4, base=16, bitRange=4 +sfr = "CAN_IMR.MB5", "Memory", 0xfffd000c, 4, base=16, bitRange=5 +sfr = "CAN_IMR.MB6", "Memory", 0xfffd000c, 4, base=16, bitRange=6 +sfr = "CAN_IMR.MB7", "Memory", 0xfffd000c, 4, base=16, bitRange=7 +sfr = "CAN_IMR.MB8", "Memory", 0xfffd000c, 4, base=16, bitRange=8 +sfr = "CAN_IMR.MB9", "Memory", 0xfffd000c, 4, base=16, bitRange=9 +sfr = "CAN_IMR.MB10", "Memory", 0xfffd000c, 4, base=16, bitRange=10 +sfr = "CAN_IMR.MB11", "Memory", 0xfffd000c, 4, base=16, bitRange=11 +sfr = "CAN_IMR.MB12", "Memory", 0xfffd000c, 4, base=16, bitRange=12 +sfr = "CAN_IMR.MB13", "Memory", 0xfffd000c, 4, base=16, bitRange=13 +sfr = "CAN_IMR.MB14", "Memory", 0xfffd000c, 4, base=16, bitRange=14 +sfr = "CAN_IMR.MB15", "Memory", 0xfffd000c, 4, base=16, bitRange=15 +sfr = "CAN_IMR.ERRA", "Memory", 0xfffd000c, 4, base=16, bitRange=16 +sfr = "CAN_IMR.WARN", "Memory", 0xfffd000c, 4, base=16, bitRange=17 +sfr = "CAN_IMR.ERRP", "Memory", 0xfffd000c, 4, base=16, bitRange=18 +sfr = "CAN_IMR.BOFF", "Memory", 0xfffd000c, 4, base=16, bitRange=19 +sfr = "CAN_IMR.SLEEP", "Memory", 0xfffd000c, 4, base=16, bitRange=20 +sfr = "CAN_IMR.WAKEUP", "Memory", 0xfffd000c, 4, base=16, bitRange=21 +sfr = "CAN_IMR.TOVF", "Memory", 0xfffd000c, 4, base=16, bitRange=22 +sfr = "CAN_IMR.TSTP", "Memory", 0xfffd000c, 4, base=16, bitRange=23 +sfr = "CAN_IMR.CERR", "Memory", 0xfffd000c, 4, base=16, bitRange=24 +sfr = "CAN_IMR.SERR", "Memory", 0xfffd000c, 4, base=16, bitRange=25 +sfr = "CAN_IMR.AERR", "Memory", 0xfffd000c, 4, base=16, bitRange=26 +sfr = "CAN_IMR.FERR", "Memory", 0xfffd000c, 4, base=16, bitRange=27 +sfr = "CAN_IMR.BERR", "Memory", 0xfffd000c, 4, base=16, bitRange=28 +sfr = "CAN_SR", "Memory", 0xfffd0010, 4, base=16 +sfr = "CAN_SR.MB0", "Memory", 0xfffd0010, 4, base=16, bitRange=0 +sfr = "CAN_SR.MB1", "Memory", 0xfffd0010, 4, base=16, bitRange=1 +sfr = "CAN_SR.MB2", "Memory", 0xfffd0010, 4, base=16, bitRange=2 +sfr = "CAN_SR.MB3", "Memory", 0xfffd0010, 4, base=16, bitRange=3 +sfr = "CAN_SR.MB4", "Memory", 0xfffd0010, 4, base=16, bitRange=4 +sfr = "CAN_SR.MB5", "Memory", 0xfffd0010, 4, base=16, bitRange=5 +sfr = "CAN_SR.MB6", "Memory", 0xfffd0010, 4, base=16, bitRange=6 +sfr = "CAN_SR.MB7", "Memory", 0xfffd0010, 4, base=16, bitRange=7 +sfr = "CAN_SR.MB8", "Memory", 0xfffd0010, 4, base=16, bitRange=8 +sfr = "CAN_SR.MB9", "Memory", 0xfffd0010, 4, base=16, bitRange=9 +sfr = "CAN_SR.MB10", "Memory", 0xfffd0010, 4, base=16, bitRange=10 +sfr = "CAN_SR.MB11", "Memory", 0xfffd0010, 4, base=16, bitRange=11 +sfr = "CAN_SR.MB12", "Memory", 0xfffd0010, 4, base=16, bitRange=12 +sfr = "CAN_SR.MB13", "Memory", 0xfffd0010, 4, base=16, bitRange=13 +sfr = "CAN_SR.MB14", "Memory", 0xfffd0010, 4, base=16, bitRange=14 +sfr = "CAN_SR.MB15", "Memory", 0xfffd0010, 4, base=16, bitRange=15 +sfr = "CAN_SR.ERRA", "Memory", 0xfffd0010, 4, base=16, bitRange=16 +sfr = "CAN_SR.WARN", "Memory", 0xfffd0010, 4, base=16, bitRange=17 +sfr = "CAN_SR.ERRP", "Memory", 0xfffd0010, 4, base=16, bitRange=18 +sfr = "CAN_SR.BOFF", "Memory", 0xfffd0010, 4, base=16, bitRange=19 +sfr = "CAN_SR.SLEEP", "Memory", 0xfffd0010, 4, base=16, bitRange=20 +sfr = "CAN_SR.WAKEUP", "Memory", 0xfffd0010, 4, base=16, bitRange=21 +sfr = "CAN_SR.TOVF", "Memory", 0xfffd0010, 4, base=16, bitRange=22 +sfr = "CAN_SR.TSTP", "Memory", 0xfffd0010, 4, base=16, bitRange=23 +sfr = "CAN_SR.CERR", "Memory", 0xfffd0010, 4, base=16, bitRange=24 +sfr = "CAN_SR.SERR", "Memory", 0xfffd0010, 4, base=16, bitRange=25 +sfr = "CAN_SR.AERR", "Memory", 0xfffd0010, 4, base=16, bitRange=26 +sfr = "CAN_SR.FERR", "Memory", 0xfffd0010, 4, base=16, bitRange=27 +sfr = "CAN_SR.BERR", "Memory", 0xfffd0010, 4, base=16, bitRange=28 +sfr = "CAN_SR.RBSY", "Memory", 0xfffd0010, 4, base=16, bitRange=29 +sfr = "CAN_SR.TBSY", "Memory", 0xfffd0010, 4, base=16, bitRange=30 +sfr = "CAN_SR.OVLY", "Memory", 0xfffd0010, 4, base=16, bitRange=31 +sfr = "CAN_BR", "Memory", 0xfffd0014, 4, base=16 +sfr = "CAN_BR.PHASE2", "Memory", 0xfffd0014, 4, base=16, bitRange=0-2 +sfr = "CAN_BR.PHASE1", "Memory", 0xfffd0014, 4, base=16, bitRange=4-6 +sfr = "CAN_BR.PROPAG", "Memory", 0xfffd0014, 4, base=16, bitRange=8-10 +sfr = "CAN_BR.SYNC", "Memory", 0xfffd0014, 4, base=16, bitRange=12-13 +sfr = "CAN_BR.BRP", "Memory", 0xfffd0014, 4, base=16, bitRange=16-22 +sfr = "CAN_BR.SMP", "Memory", 0xfffd0014, 4, base=16, bitRange=24 +sfr = "CAN_TIM", "Memory", 0xfffd0018, 4, base=16 +sfr = "CAN_TIM.TIMER", "Memory", 0xfffd0018, 4, base=16, bitRange=0-15 +sfr = "CAN_TIMESTP", "Memory", 0xfffd001c, 4, base=16 +sfr = "CAN_TIMESTP.MTIMESTAMP", "Memory", 0xfffd001c, 4, base=16, bitRange=0-15 +sfr = "CAN_ECR", "Memory", 0xfffd0020, 4, base=16 +sfr = "CAN_ECR.REC", "Memory", 0xfffd0020, 4, base=16, bitRange=0-7 +sfr = "CAN_ECR.TEC", "Memory", 0xfffd0020, 4, base=16, bitRange=16-23 +sfr = "CAN_TCR", "Memory", 0xfffd0024, 4, base=16 +sfr = "CAN_TCR.MB0", "Memory", 0xfffd0024, 4, base=16, bitRange=0 +sfr = "CAN_TCR.MB1", "Memory", 0xfffd0024, 4, base=16, bitRange=1 +sfr = "CAN_TCR.MB2", "Memory", 0xfffd0024, 4, base=16, bitRange=2 +sfr = "CAN_TCR.MB3", "Memory", 0xfffd0024, 4, base=16, bitRange=3 +sfr = "CAN_TCR.MB4", "Memory", 0xfffd0024, 4, base=16, bitRange=4 +sfr = "CAN_TCR.MB5", "Memory", 0xfffd0024, 4, base=16, bitRange=5 +sfr = "CAN_TCR.MB6", "Memory", 0xfffd0024, 4, base=16, bitRange=6 +sfr = "CAN_TCR.MB7", "Memory", 0xfffd0024, 4, base=16, bitRange=7 +sfr = "CAN_TCR.MB8", "Memory", 0xfffd0024, 4, base=16, bitRange=8 +sfr = "CAN_TCR.MB9", "Memory", 0xfffd0024, 4, base=16, bitRange=9 +sfr = "CAN_TCR.MB10", "Memory", 0xfffd0024, 4, base=16, bitRange=10 +sfr = "CAN_TCR.MB11", "Memory", 0xfffd0024, 4, base=16, bitRange=11 +sfr = "CAN_TCR.MB12", "Memory", 0xfffd0024, 4, base=16, bitRange=12 +sfr = "CAN_TCR.MB13", "Memory", 0xfffd0024, 4, base=16, bitRange=13 +sfr = "CAN_TCR.MB14", "Memory", 0xfffd0024, 4, base=16, bitRange=14 +sfr = "CAN_TCR.MB15", "Memory", 0xfffd0024, 4, base=16, bitRange=15 +sfr = "CAN_TCR.TIMRST", "Memory", 0xfffd0024, 4, base=16, bitRange=31 +sfr = "CAN_ACR", "Memory", 0xfffd0028, 4, base=16 +sfr = "CAN_ACR.MB0", "Memory", 0xfffd0028, 4, base=16, bitRange=0 +sfr = "CAN_ACR.MB1", "Memory", 0xfffd0028, 4, base=16, bitRange=1 +sfr = "CAN_ACR.MB2", "Memory", 0xfffd0028, 4, base=16, bitRange=2 +sfr = "CAN_ACR.MB3", "Memory", 0xfffd0028, 4, base=16, bitRange=3 +sfr = "CAN_ACR.MB4", "Memory", 0xfffd0028, 4, base=16, bitRange=4 +sfr = "CAN_ACR.MB5", "Memory", 0xfffd0028, 4, base=16, bitRange=5 +sfr = "CAN_ACR.MB6", "Memory", 0xfffd0028, 4, base=16, bitRange=6 +sfr = "CAN_ACR.MB7", "Memory", 0xfffd0028, 4, base=16, bitRange=7 +sfr = "CAN_ACR.MB8", "Memory", 0xfffd0028, 4, base=16, bitRange=8 +sfr = "CAN_ACR.MB9", "Memory", 0xfffd0028, 4, base=16, bitRange=9 +sfr = "CAN_ACR.MB10", "Memory", 0xfffd0028, 4, base=16, bitRange=10 +sfr = "CAN_ACR.MB11", "Memory", 0xfffd0028, 4, base=16, bitRange=11 +sfr = "CAN_ACR.MB12", "Memory", 0xfffd0028, 4, base=16, bitRange=12 +sfr = "CAN_ACR.MB13", "Memory", 0xfffd0028, 4, base=16, bitRange=13 +sfr = "CAN_ACR.MB14", "Memory", 0xfffd0028, 4, base=16, bitRange=14 +sfr = "CAN_ACR.MB15", "Memory", 0xfffd0028, 4, base=16, bitRange=15 +sfr = "CAN_VR", "Memory", 0xfffd00fc, 4, base=16 +; ========== Register definition for EMAC peripheral ========== +sfr = "EMAC_NCR", "Memory", 0xfffdc000, 4, base=16 +sfr = "EMAC_NCR.LB", "Memory", 0xfffdc000, 4, base=16, bitRange=0 +sfr = "EMAC_NCR.LLB", "Memory", 0xfffdc000, 4, base=16, bitRange=1 +sfr = "EMAC_NCR.RE", "Memory", 0xfffdc000, 4, base=16, bitRange=2 +sfr = "EMAC_NCR.TE", "Memory", 0xfffdc000, 4, base=16, bitRange=3 +sfr = "EMAC_NCR.MPE", "Memory", 0xfffdc000, 4, base=16, bitRange=4 +sfr = "EMAC_NCR.CLRSTAT", "Memory", 0xfffdc000, 4, base=16, bitRange=5 +sfr = "EMAC_NCR.INCSTAT", "Memory", 0xfffdc000, 4, base=16, bitRange=6 +sfr = "EMAC_NCR.WESTAT", "Memory", 0xfffdc000, 4, base=16, bitRange=7 +sfr = "EMAC_NCR.BP", "Memory", 0xfffdc000, 4, base=16, bitRange=8 +sfr = "EMAC_NCR.TSTART", "Memory", 0xfffdc000, 4, base=16, bitRange=9 +sfr = "EMAC_NCR.THALT", "Memory", 0xfffdc000, 4, base=16, bitRange=10 +sfr = "EMAC_NCR.TPFR", "Memory", 0xfffdc000, 4, base=16, bitRange=11 +sfr = "EMAC_NCR.TZQ", "Memory", 0xfffdc000, 4, base=16, bitRange=12 +sfr = "EMAC_NCFGR", "Memory", 0xfffdc004, 4, base=16 +sfr = "EMAC_NCFGR.SPD", "Memory", 0xfffdc004, 4, base=16, bitRange=0 +sfr = "EMAC_NCFGR.FD", "Memory", 0xfffdc004, 4, base=16, bitRange=1 +sfr = "EMAC_NCFGR.JFRAME", "Memory", 0xfffdc004, 4, base=16, bitRange=3 +sfr = "EMAC_NCFGR.CAF", "Memory", 0xfffdc004, 4, base=16, bitRange=4 +sfr = "EMAC_NCFGR.NBC", "Memory", 0xfffdc004, 4, base=16, bitRange=5 +sfr = "EMAC_NCFGR.MTI", "Memory", 0xfffdc004, 4, base=16, bitRange=6 +sfr = "EMAC_NCFGR.UNI", "Memory", 0xfffdc004, 4, base=16, bitRange=7 +sfr = "EMAC_NCFGR.BIG", "Memory", 0xfffdc004, 4, base=16, bitRange=8 +sfr = "EMAC_NCFGR.EAE", "Memory", 0xfffdc004, 4, base=16, bitRange=9 +sfr = "EMAC_NCFGR.CLK", "Memory", 0xfffdc004, 4, base=16, bitRange=10-11 +sfr = "EMAC_NCFGR.RTY", "Memory", 0xfffdc004, 4, base=16, bitRange=12 +sfr = "EMAC_NCFGR.PAE", "Memory", 0xfffdc004, 4, base=16, bitRange=13 +sfr = "EMAC_NCFGR.RBOF", "Memory", 0xfffdc004, 4, base=16, bitRange=14-15 +sfr = "EMAC_NCFGR.RLCE", "Memory", 0xfffdc004, 4, base=16, bitRange=16 +sfr = "EMAC_NCFGR.DRFCS", "Memory", 0xfffdc004, 4, base=16, bitRange=17 +sfr = "EMAC_NCFGR.EFRHD", "Memory", 0xfffdc004, 4, base=16, bitRange=18 +sfr = "EMAC_NCFGR.IRXFCS", "Memory", 0xfffdc004, 4, base=16, bitRange=19 +sfr = "EMAC_NSR", "Memory", 0xfffdc008, 4, base=16 +sfr = "EMAC_NSR.LINKR", "Memory", 0xfffdc008, 4, base=16, bitRange=0 +sfr = "EMAC_NSR.MDIO", "Memory", 0xfffdc008, 4, base=16, bitRange=1 +sfr = "EMAC_NSR.IDLE", "Memory", 0xfffdc008, 4, base=16, bitRange=2 +sfr = "EMAC_TSR", "Memory", 0xfffdc014, 4, base=16 +sfr = "EMAC_TSR.UBR", "Memory", 0xfffdc014, 4, base=16, bitRange=0 +sfr = "EMAC_TSR.COL", "Memory", 0xfffdc014, 4, base=16, bitRange=1 +sfr = "EMAC_TSR.RLES", "Memory", 0xfffdc014, 4, base=16, bitRange=2 +sfr = "EMAC_TSR.TGO", "Memory", 0xfffdc014, 4, base=16, bitRange=3 +sfr = "EMAC_TSR.BEX", "Memory", 0xfffdc014, 4, base=16, bitRange=4 +sfr = "EMAC_TSR.COMP", "Memory", 0xfffdc014, 4, base=16, bitRange=5 +sfr = "EMAC_TSR.UND", "Memory", 0xfffdc014, 4, base=16, bitRange=6 +sfr = "EMAC_RBQP", "Memory", 0xfffdc018, 4, base=16 +sfr = "EMAC_TBQP", "Memory", 0xfffdc01c, 4, base=16 +sfr = "EMAC_RSR", "Memory", 0xfffdc020, 4, base=16 +sfr = "EMAC_RSR.BNA", "Memory", 0xfffdc020, 4, base=16, bitRange=0 +sfr = "EMAC_RSR.REC", "Memory", 0xfffdc020, 4, base=16, bitRange=1 +sfr = "EMAC_RSR.OVR", "Memory", 0xfffdc020, 4, base=16, bitRange=2 +sfr = "EMAC_ISR", "Memory", 0xfffdc024, 4, base=16 +sfr = "EMAC_ISR.MFD", "Memory", 0xfffdc024, 4, base=16, bitRange=0 +sfr = "EMAC_ISR.RCOMP", "Memory", 0xfffdc024, 4, base=16, bitRange=1 +sfr = "EMAC_ISR.RXUBR", "Memory", 0xfffdc024, 4, base=16, bitRange=2 +sfr = "EMAC_ISR.TXUBR", "Memory", 0xfffdc024, 4, base=16, bitRange=3 +sfr = "EMAC_ISR.TUNDR", "Memory", 0xfffdc024, 4, base=16, bitRange=4 +sfr = "EMAC_ISR.RLEX", "Memory", 0xfffdc024, 4, base=16, bitRange=5 +sfr = "EMAC_ISR.TXERR", "Memory", 0xfffdc024, 4, base=16, bitRange=6 +sfr = "EMAC_ISR.TCOMP", "Memory", 0xfffdc024, 4, base=16, bitRange=7 +sfr = "EMAC_ISR.LINK", "Memory", 0xfffdc024, 4, base=16, bitRange=9 +sfr = "EMAC_ISR.ROVR", "Memory", 0xfffdc024, 4, base=16, bitRange=10 +sfr = "EMAC_ISR.HRESP", "Memory", 0xfffdc024, 4, base=16, bitRange=11 +sfr = "EMAC_ISR.PFRE", "Memory", 0xfffdc024, 4, base=16, bitRange=12 +sfr = "EMAC_ISR.PTZ", "Memory", 0xfffdc024, 4, base=16, bitRange=13 +sfr = "EMAC_IER", "Memory", 0xfffdc028, 4, base=16 +sfr = "EMAC_IER.MFD", "Memory", 0xfffdc028, 4, base=16, bitRange=0 +sfr = "EMAC_IER.RCOMP", "Memory", 0xfffdc028, 4, base=16, bitRange=1 +sfr = "EMAC_IER.RXUBR", "Memory", 0xfffdc028, 4, base=16, bitRange=2 +sfr = "EMAC_IER.TXUBR", "Memory", 0xfffdc028, 4, base=16, bitRange=3 +sfr = "EMAC_IER.TUNDR", "Memory", 0xfffdc028, 4, base=16, bitRange=4 +sfr = "EMAC_IER.RLEX", "Memory", 0xfffdc028, 4, base=16, bitRange=5 +sfr = "EMAC_IER.TXERR", "Memory", 0xfffdc028, 4, base=16, bitRange=6 +sfr = "EMAC_IER.TCOMP", "Memory", 0xfffdc028, 4, base=16, bitRange=7 +sfr = "EMAC_IER.LINK", "Memory", 0xfffdc028, 4, base=16, bitRange=9 +sfr = "EMAC_IER.ROVR", "Memory", 0xfffdc028, 4, base=16, bitRange=10 +sfr = "EMAC_IER.HRESP", "Memory", 0xfffdc028, 4, base=16, bitRange=11 +sfr = "EMAC_IER.PFRE", "Memory", 0xfffdc028, 4, base=16, bitRange=12 +sfr = "EMAC_IER.PTZ", "Memory", 0xfffdc028, 4, base=16, bitRange=13 +sfr = "EMAC_IDR", "Memory", 0xfffdc02c, 4, base=16 +sfr = "EMAC_IDR.MFD", "Memory", 0xfffdc02c, 4, base=16, bitRange=0 +sfr = "EMAC_IDR.RCOMP", "Memory", 0xfffdc02c, 4, base=16, bitRange=1 +sfr = "EMAC_IDR.RXUBR", "Memory", 0xfffdc02c, 4, base=16, bitRange=2 +sfr = "EMAC_IDR.TXUBR", "Memory", 0xfffdc02c, 4, base=16, bitRange=3 +sfr = "EMAC_IDR.TUNDR", "Memory", 0xfffdc02c, 4, base=16, bitRange=4 +sfr = "EMAC_IDR.RLEX", "Memory", 0xfffdc02c, 4, base=16, bitRange=5 +sfr = "EMAC_IDR.TXERR", "Memory", 0xfffdc02c, 4, base=16, bitRange=6 +sfr = "EMAC_IDR.TCOMP", "Memory", 0xfffdc02c, 4, base=16, bitRange=7 +sfr = "EMAC_IDR.LINK", "Memory", 0xfffdc02c, 4, base=16, bitRange=9 +sfr = "EMAC_IDR.ROVR", "Memory", 0xfffdc02c, 4, base=16, bitRange=10 +sfr = "EMAC_IDR.HRESP", "Memory", 0xfffdc02c, 4, base=16, bitRange=11 +sfr = "EMAC_IDR.PFRE", "Memory", 0xfffdc02c, 4, base=16, bitRange=12 +sfr = "EMAC_IDR.PTZ", "Memory", 0xfffdc02c, 4, base=16, bitRange=13 +sfr = "EMAC_IMR", "Memory", 0xfffdc030, 4, base=16 +sfr = "EMAC_IMR.MFD", "Memory", 0xfffdc030, 4, base=16, bitRange=0 +sfr = "EMAC_IMR.RCOMP", "Memory", 0xfffdc030, 4, base=16, bitRange=1 +sfr = "EMAC_IMR.RXUBR", "Memory", 0xfffdc030, 4, base=16, bitRange=2 +sfr = "EMAC_IMR.TXUBR", "Memory", 0xfffdc030, 4, base=16, bitRange=3 +sfr = "EMAC_IMR.TUNDR", "Memory", 0xfffdc030, 4, base=16, bitRange=4 +sfr = "EMAC_IMR.RLEX", "Memory", 0xfffdc030, 4, base=16, bitRange=5 +sfr = "EMAC_IMR.TXERR", "Memory", 0xfffdc030, 4, base=16, bitRange=6 +sfr = "EMAC_IMR.TCOMP", "Memory", 0xfffdc030, 4, base=16, bitRange=7 +sfr = "EMAC_IMR.LINK", "Memory", 0xfffdc030, 4, base=16, bitRange=9 +sfr = "EMAC_IMR.ROVR", "Memory", 0xfffdc030, 4, base=16, bitRange=10 +sfr = "EMAC_IMR.HRESP", "Memory", 0xfffdc030, 4, base=16, bitRange=11 +sfr = "EMAC_IMR.PFRE", "Memory", 0xfffdc030, 4, base=16, bitRange=12 +sfr = "EMAC_IMR.PTZ", "Memory", 0xfffdc030, 4, base=16, bitRange=13 +sfr = "EMAC_MAN", "Memory", 0xfffdc034, 4, base=16 +sfr = "EMAC_MAN.DATA", "Memory", 0xfffdc034, 4, base=16, bitRange=0-15 +sfr = "EMAC_MAN.CODE", "Memory", 0xfffdc034, 4, base=16, bitRange=16-17 +sfr = "EMAC_MAN.REGA", "Memory", 0xfffdc034, 4, base=16, bitRange=18-22 +sfr = "EMAC_MAN.PHYA", "Memory", 0xfffdc034, 4, base=16, bitRange=23-27 +sfr = "EMAC_MAN.RW", "Memory", 0xfffdc034, 4, base=16, bitRange=28-29 +sfr = "EMAC_MAN.SOF", "Memory", 0xfffdc034, 4, base=16, bitRange=30-31 +sfr = "EMAC_PTR", "Memory", 0xfffdc038, 4, base=16 +sfr = "EMAC_PFR", "Memory", 0xfffdc03c, 4, base=16 +sfr = "EMAC_FTO", "Memory", 0xfffdc040, 4, base=16 +sfr = "EMAC_SCF", "Memory", 0xfffdc044, 4, base=16 +sfr = "EMAC_MCF", "Memory", 0xfffdc048, 4, base=16 +sfr = "EMAC_FRO", "Memory", 0xfffdc04c, 4, base=16 +sfr = "EMAC_FCSE", "Memory", 0xfffdc050, 4, base=16 +sfr = "EMAC_ALE", "Memory", 0xfffdc054, 4, base=16 +sfr = "EMAC_DTF", "Memory", 0xfffdc058, 4, base=16 +sfr = "EMAC_LCOL", "Memory", 0xfffdc05c, 4, base=16 +sfr = "EMAC_ECOL", "Memory", 0xfffdc060, 4, base=16 +sfr = "EMAC_TUND", "Memory", 0xfffdc064, 4, base=16 +sfr = "EMAC_CSE", "Memory", 0xfffdc068, 4, base=16 +sfr = "EMAC_RRE", "Memory", 0xfffdc06c, 4, base=16 +sfr = "EMAC_ROV", "Memory", 0xfffdc070, 4, base=16 +sfr = "EMAC_RSE", "Memory", 0xfffdc074, 4, base=16 +sfr = "EMAC_ELE", "Memory", 0xfffdc078, 4, base=16 +sfr = "EMAC_RJA", "Memory", 0xfffdc07c, 4, base=16 +sfr = "EMAC_USF", "Memory", 0xfffdc080, 4, base=16 +sfr = "EMAC_STE", "Memory", 0xfffdc084, 4, base=16 +sfr = "EMAC_RLE", "Memory", 0xfffdc088, 4, base=16 +sfr = "EMAC_TPF", "Memory", 0xfffdc08c, 4, base=16 +sfr = "EMAC_HRB", "Memory", 0xfffdc090, 4, base=16 +sfr = "EMAC_HRT", "Memory", 0xfffdc094, 4, base=16 +sfr = "EMAC_SA1L", "Memory", 0xfffdc098, 4, base=16 +sfr = "EMAC_SA1H", "Memory", 0xfffdc09c, 4, base=16 +sfr = "EMAC_SA2L", "Memory", 0xfffdc0a0, 4, base=16 +sfr = "EMAC_SA2H", "Memory", 0xfffdc0a4, 4, base=16 +sfr = "EMAC_SA3L", "Memory", 0xfffdc0a8, 4, base=16 +sfr = "EMAC_SA3H", "Memory", 0xfffdc0ac, 4, base=16 +sfr = "EMAC_SA4L", "Memory", 0xfffdc0b0, 4, base=16 +sfr = "EMAC_SA4H", "Memory", 0xfffdc0b4, 4, base=16 +sfr = "EMAC_TID", "Memory", 0xfffdc0b8, 4, base=16 +sfr = "EMAC_TPQ", "Memory", 0xfffdc0bc, 4, base=16 +sfr = "EMAC_USRIO", "Memory", 0xfffdc0c0, 4, base=16 +sfr = "EMAC_USRIO.RMII", "Memory", 0xfffdc0c0, 4, base=16, bitRange=0 +sfr = "EMAC_USRIO.CLKEN", "Memory", 0xfffdc0c0, 4, base=16, bitRange=1 +sfr = "EMAC_WOL", "Memory", 0xfffdc0c4, 4, base=16 +sfr = "EMAC_WOL.IP", "Memory", 0xfffdc0c4, 4, base=16, bitRange=0-15 +sfr = "EMAC_WOL.MAG", "Memory", 0xfffdc0c4, 4, base=16, bitRange=16 +sfr = "EMAC_WOL.ARP", "Memory", 0xfffdc0c4, 4, base=16, bitRange=17 +sfr = "EMAC_WOL.SA1", "Memory", 0xfffdc0c4, 4, base=16, bitRange=18 +sfr = "EMAC_WOL.MTI", "Memory", 0xfffdc0c4, 4, base=16, bitRange=19 +sfr = "EMAC_REV", "Memory", 0xfffdc0fc, 4, base=16 +sfr = "EMAC_REV.REVREF", "Memory", 0xfffdc0fc, 4, base=16, bitRange=0-15 +sfr = "EMAC_REV.PARTREF", "Memory", 0xfffdc0fc, 4, base=16, bitRange=16-31 +; ========== Register definition for PDC_ADC peripheral ========== +sfr = "ADC_RPR", "Memory", 0xfffd8100, 4, base=16 +sfr = "ADC_RCR", "Memory", 0xfffd8104, 4, base=16 +sfr = "ADC_TPR", "Memory", 0xfffd8108, 4, base=16 +sfr = "ADC_TCR", "Memory", 0xfffd810c, 4, base=16 +sfr = "ADC_RNPR", "Memory", 0xfffd8110, 4, base=16 +sfr = "ADC_RNCR", "Memory", 0xfffd8114, 4, base=16 +sfr = "ADC_TNPR", "Memory", 0xfffd8118, 4, base=16 +sfr = "ADC_TNCR", "Memory", 0xfffd811c, 4, base=16 +sfr = "ADC_PTCR", "Memory", 0xfffd8120, 4, base=16 +sfr = "ADC_PTCR.RXTEN", "Memory", 0xfffd8120, 4, base=16, bitRange=0 +sfr = "ADC_PTCR.RXTDIS", "Memory", 0xfffd8120, 4, base=16, bitRange=1 +sfr = "ADC_PTCR.TXTEN", "Memory", 0xfffd8120, 4, base=16, bitRange=8 +sfr = "ADC_PTCR.TXTDIS", "Memory", 0xfffd8120, 4, base=16, bitRange=9 +sfr = "ADC_PTSR", "Memory", 0xfffd8124, 4, base=16 +sfr = "ADC_PTSR.RXTEN", "Memory", 0xfffd8124, 4, base=16, bitRange=0 +sfr = "ADC_PTSR.TXTEN", "Memory", 0xfffd8124, 4, base=16, bitRange=8 +; ========== Register definition for ADC peripheral ========== +sfr = "ADC_CR", "Memory", 0xfffd8000, 4, base=16 +sfr = "ADC_CR.SWRST", "Memory", 0xfffd8000, 4, base=16, bitRange=0 +sfr = "ADC_CR.START", "Memory", 0xfffd8000, 4, base=16, bitRange=1 +sfr = "ADC_MR", "Memory", 0xfffd8004, 4, base=16 +sfr = "ADC_MR.TRGEN", "Memory", 0xfffd8004, 4, base=16, bitRange=0 +sfr = "ADC_MR.TRGSEL", "Memory", 0xfffd8004, 4, base=16, bitRange=1-3 +sfr = "ADC_MR.LOWRES", "Memory", 0xfffd8004, 4, base=16, bitRange=4 +sfr = "ADC_MR.SLEEP", "Memory", 0xfffd8004, 4, base=16, bitRange=5 +sfr = "ADC_MR.PRESCAL", "Memory", 0xfffd8004, 4, base=16, bitRange=8-13 +sfr = "ADC_MR.STARTUP", "Memory", 0xfffd8004, 4, base=16, bitRange=16-20 +sfr = "ADC_MR.SHTIM", "Memory", 0xfffd8004, 4, base=16, bitRange=24-27 +sfr = "ADC_CHER", "Memory", 0xfffd8010, 4, base=16 +sfr = "ADC_CHER.CH0", "Memory", 0xfffd8010, 4, base=16, bitRange=0 +sfr = "ADC_CHER.CH1", "Memory", 0xfffd8010, 4, base=16, bitRange=1 +sfr = "ADC_CHER.CH2", "Memory", 0xfffd8010, 4, base=16, bitRange=2 +sfr = "ADC_CHER.CH3", "Memory", 0xfffd8010, 4, base=16, bitRange=3 +sfr = "ADC_CHER.CH4", "Memory", 0xfffd8010, 4, base=16, bitRange=4 +sfr = "ADC_CHER.CH5", "Memory", 0xfffd8010, 4, base=16, bitRange=5 +sfr = "ADC_CHER.CH6", "Memory", 0xfffd8010, 4, base=16, bitRange=6 +sfr = "ADC_CHER.CH7", "Memory", 0xfffd8010, 4, base=16, bitRange=7 +sfr = "ADC_CHDR", "Memory", 0xfffd8014, 4, base=16 +sfr = "ADC_CHDR.CH0", "Memory", 0xfffd8014, 4, base=16, bitRange=0 +sfr = "ADC_CHDR.CH1", "Memory", 0xfffd8014, 4, base=16, bitRange=1 +sfr = "ADC_CHDR.CH2", "Memory", 0xfffd8014, 4, base=16, bitRange=2 +sfr = "ADC_CHDR.CH3", "Memory", 0xfffd8014, 4, base=16, bitRange=3 +sfr = "ADC_CHDR.CH4", "Memory", 0xfffd8014, 4, base=16, bitRange=4 +sfr = "ADC_CHDR.CH5", "Memory", 0xfffd8014, 4, base=16, bitRange=5 +sfr = "ADC_CHDR.CH6", "Memory", 0xfffd8014, 4, base=16, bitRange=6 +sfr = "ADC_CHDR.CH7", "Memory", 0xfffd8014, 4, base=16, bitRange=7 +sfr = "ADC_CHSR", "Memory", 0xfffd8018, 4, base=16 +sfr = "ADC_CHSR.CH0", "Memory", 0xfffd8018, 4, base=16, bitRange=0 +sfr = "ADC_CHSR.CH1", "Memory", 0xfffd8018, 4, base=16, bitRange=1 +sfr = "ADC_CHSR.CH2", "Memory", 0xfffd8018, 4, base=16, bitRange=2 +sfr = "ADC_CHSR.CH3", "Memory", 0xfffd8018, 4, base=16, bitRange=3 +sfr = "ADC_CHSR.CH4", "Memory", 0xfffd8018, 4, base=16, bitRange=4 +sfr = "ADC_CHSR.CH5", "Memory", 0xfffd8018, 4, base=16, bitRange=5 +sfr = "ADC_CHSR.CH6", "Memory", 0xfffd8018, 4, base=16, bitRange=6 +sfr = "ADC_CHSR.CH7", "Memory", 0xfffd8018, 4, base=16, bitRange=7 +sfr = "ADC_SR", "Memory", 0xfffd801c, 4, base=16 +sfr = "ADC_SR.EOC0", "Memory", 0xfffd801c, 4, base=16, bitRange=0 +sfr = "ADC_SR.EOC1", "Memory", 0xfffd801c, 4, base=16, bitRange=1 +sfr = "ADC_SR.EOC2", "Memory", 0xfffd801c, 4, base=16, bitRange=2 +sfr = "ADC_SR.EOC3", "Memory", 0xfffd801c, 4, base=16, bitRange=3 +sfr = "ADC_SR.EOC4", "Memory", 0xfffd801c, 4, base=16, bitRange=4 +sfr = "ADC_SR.EOC5", "Memory", 0xfffd801c, 4, base=16, bitRange=5 +sfr = "ADC_SR.EOC6", "Memory", 0xfffd801c, 4, base=16, bitRange=6 +sfr = "ADC_SR.EOC7", "Memory", 0xfffd801c, 4, base=16, bitRange=7 +sfr = "ADC_SR.OVRE0", "Memory", 0xfffd801c, 4, base=16, bitRange=8 +sfr = "ADC_SR.OVRE1", "Memory", 0xfffd801c, 4, base=16, bitRange=9 +sfr = "ADC_SR.OVRE2", "Memory", 0xfffd801c, 4, base=16, bitRange=10 +sfr = "ADC_SR.OVRE3", "Memory", 0xfffd801c, 4, base=16, bitRange=11 +sfr = "ADC_SR.OVRE4", "Memory", 0xfffd801c, 4, base=16, bitRange=12 +sfr = "ADC_SR.OVRE5", "Memory", 0xfffd801c, 4, base=16, bitRange=13 +sfr = "ADC_SR.OVRE6", "Memory", 0xfffd801c, 4, base=16, bitRange=14 +sfr = "ADC_SR.OVRE7", "Memory", 0xfffd801c, 4, base=16, bitRange=15 +sfr = "ADC_SR.DRDY", "Memory", 0xfffd801c, 4, base=16, bitRange=16 +sfr = "ADC_SR.GOVRE", "Memory", 0xfffd801c, 4, base=16, bitRange=17 +sfr = "ADC_SR.ENDRX", "Memory", 0xfffd801c, 4, base=16, bitRange=18 +sfr = "ADC_SR.RXBUFF", "Memory", 0xfffd801c, 4, base=16, bitRange=19 +sfr = "ADC_LCDR", "Memory", 0xfffd8020, 4, base=16 +sfr = "ADC_LCDR.LDATA", "Memory", 0xfffd8020, 4, base=16, bitRange=0-9 +sfr = "ADC_IER", "Memory", 0xfffd8024, 4, base=16 +sfr = "ADC_IER.EOC0", "Memory", 0xfffd8024, 4, base=16, bitRange=0 +sfr = "ADC_IER.EOC1", "Memory", 0xfffd8024, 4, base=16, bitRange=1 +sfr = "ADC_IER.EOC2", "Memory", 0xfffd8024, 4, base=16, bitRange=2 +sfr = "ADC_IER.EOC3", "Memory", 0xfffd8024, 4, base=16, bitRange=3 +sfr = "ADC_IER.EOC4", "Memory", 0xfffd8024, 4, base=16, bitRange=4 +sfr = "ADC_IER.EOC5", "Memory", 0xfffd8024, 4, base=16, bitRange=5 +sfr = "ADC_IER.EOC6", "Memory", 0xfffd8024, 4, base=16, bitRange=6 +sfr = "ADC_IER.EOC7", "Memory", 0xfffd8024, 4, base=16, bitRange=7 +sfr = "ADC_IER.OVRE0", "Memory", 0xfffd8024, 4, base=16, bitRange=8 +sfr = "ADC_IER.OVRE1", "Memory", 0xfffd8024, 4, base=16, bitRange=9 +sfr = "ADC_IER.OVRE2", "Memory", 0xfffd8024, 4, base=16, bitRange=10 +sfr = "ADC_IER.OVRE3", "Memory", 0xfffd8024, 4, base=16, bitRange=11 +sfr = "ADC_IER.OVRE4", "Memory", 0xfffd8024, 4, base=16, bitRange=12 +sfr = "ADC_IER.OVRE5", "Memory", 0xfffd8024, 4, base=16, bitRange=13 +sfr = "ADC_IER.OVRE6", "Memory", 0xfffd8024, 4, base=16, bitRange=14 +sfr = "ADC_IER.OVRE7", "Memory", 0xfffd8024, 4, base=16, bitRange=15 +sfr = "ADC_IER.DRDY", "Memory", 0xfffd8024, 4, base=16, bitRange=16 +sfr = "ADC_IER.GOVRE", "Memory", 0xfffd8024, 4, base=16, bitRange=17 +sfr = "ADC_IER.ENDRX", "Memory", 0xfffd8024, 4, base=16, bitRange=18 +sfr = "ADC_IER.RXBUFF", "Memory", 0xfffd8024, 4, base=16, bitRange=19 +sfr = "ADC_IDR", "Memory", 0xfffd8028, 4, base=16 +sfr = "ADC_IDR.EOC0", "Memory", 0xfffd8028, 4, base=16, bitRange=0 +sfr = "ADC_IDR.EOC1", "Memory", 0xfffd8028, 4, base=16, bitRange=1 +sfr = "ADC_IDR.EOC2", "Memory", 0xfffd8028, 4, base=16, bitRange=2 +sfr = "ADC_IDR.EOC3", "Memory", 0xfffd8028, 4, base=16, bitRange=3 +sfr = "ADC_IDR.EOC4", "Memory", 0xfffd8028, 4, base=16, bitRange=4 +sfr = "ADC_IDR.EOC5", "Memory", 0xfffd8028, 4, base=16, bitRange=5 +sfr = "ADC_IDR.EOC6", "Memory", 0xfffd8028, 4, base=16, bitRange=6 +sfr = "ADC_IDR.EOC7", "Memory", 0xfffd8028, 4, base=16, bitRange=7 +sfr = "ADC_IDR.OVRE0", "Memory", 0xfffd8028, 4, base=16, bitRange=8 +sfr = "ADC_IDR.OVRE1", "Memory", 0xfffd8028, 4, base=16, bitRange=9 +sfr = "ADC_IDR.OVRE2", "Memory", 0xfffd8028, 4, base=16, bitRange=10 +sfr = "ADC_IDR.OVRE3", "Memory", 0xfffd8028, 4, base=16, bitRange=11 +sfr = "ADC_IDR.OVRE4", "Memory", 0xfffd8028, 4, base=16, bitRange=12 +sfr = "ADC_IDR.OVRE5", "Memory", 0xfffd8028, 4, base=16, bitRange=13 +sfr = "ADC_IDR.OVRE6", "Memory", 0xfffd8028, 4, base=16, bitRange=14 +sfr = "ADC_IDR.OVRE7", "Memory", 0xfffd8028, 4, base=16, bitRange=15 +sfr = "ADC_IDR.DRDY", "Memory", 0xfffd8028, 4, base=16, bitRange=16 +sfr = "ADC_IDR.GOVRE", "Memory", 0xfffd8028, 4, base=16, bitRange=17 +sfr = "ADC_IDR.ENDRX", "Memory", 0xfffd8028, 4, base=16, bitRange=18 +sfr = "ADC_IDR.RXBUFF", "Memory", 0xfffd8028, 4, base=16, bitRange=19 +sfr = "ADC_IMR", "Memory", 0xfffd802c, 4, base=16 +sfr = "ADC_IMR.EOC0", "Memory", 0xfffd802c, 4, base=16, bitRange=0 +sfr = "ADC_IMR.EOC1", "Memory", 0xfffd802c, 4, base=16, bitRange=1 +sfr = "ADC_IMR.EOC2", "Memory", 0xfffd802c, 4, base=16, bitRange=2 +sfr = "ADC_IMR.EOC3", "Memory", 0xfffd802c, 4, base=16, bitRange=3 +sfr = "ADC_IMR.EOC4", "Memory", 0xfffd802c, 4, base=16, bitRange=4 +sfr = "ADC_IMR.EOC5", "Memory", 0xfffd802c, 4, base=16, bitRange=5 +sfr = "ADC_IMR.EOC6", "Memory", 0xfffd802c, 4, base=16, bitRange=6 +sfr = "ADC_IMR.EOC7", "Memory", 0xfffd802c, 4, base=16, bitRange=7 +sfr = "ADC_IMR.OVRE0", "Memory", 0xfffd802c, 4, base=16, bitRange=8 +sfr = "ADC_IMR.OVRE1", "Memory", 0xfffd802c, 4, base=16, bitRange=9 +sfr = "ADC_IMR.OVRE2", "Memory", 0xfffd802c, 4, base=16, bitRange=10 +sfr = "ADC_IMR.OVRE3", "Memory", 0xfffd802c, 4, base=16, bitRange=11 +sfr = "ADC_IMR.OVRE4", "Memory", 0xfffd802c, 4, base=16, bitRange=12 +sfr = "ADC_IMR.OVRE5", "Memory", 0xfffd802c, 4, base=16, bitRange=13 +sfr = "ADC_IMR.OVRE6", "Memory", 0xfffd802c, 4, base=16, bitRange=14 +sfr = "ADC_IMR.OVRE7", "Memory", 0xfffd802c, 4, base=16, bitRange=15 +sfr = "ADC_IMR.DRDY", "Memory", 0xfffd802c, 4, base=16, bitRange=16 +sfr = "ADC_IMR.GOVRE", "Memory", 0xfffd802c, 4, base=16, bitRange=17 +sfr = "ADC_IMR.ENDRX", "Memory", 0xfffd802c, 4, base=16, bitRange=18 +sfr = "ADC_IMR.RXBUFF", "Memory", 0xfffd802c, 4, base=16, bitRange=19 +sfr = "ADC_CDR0", "Memory", 0xfffd8030, 4, base=16 +sfr = "ADC_CDR0.DATA", "Memory", 0xfffd8030, 4, base=16, bitRange=0-9 +sfr = "ADC_CDR1", "Memory", 0xfffd8034, 4, base=16 +sfr = "ADC_CDR1.DATA", "Memory", 0xfffd8034, 4, base=16, bitRange=0-9 +sfr = "ADC_CDR2", "Memory", 0xfffd8038, 4, base=16 +sfr = "ADC_CDR2.DATA", "Memory", 0xfffd8038, 4, base=16, bitRange=0-9 +sfr = "ADC_CDR3", "Memory", 0xfffd803c, 4, base=16 +sfr = "ADC_CDR3.DATA", "Memory", 0xfffd803c, 4, base=16, bitRange=0-9 +sfr = "ADC_CDR4", "Memory", 0xfffd8040, 4, base=16 +sfr = "ADC_CDR4.DATA", "Memory", 0xfffd8040, 4, base=16, bitRange=0-9 +sfr = "ADC_CDR5", "Memory", 0xfffd8044, 4, base=16 +sfr = "ADC_CDR5.DATA", "Memory", 0xfffd8044, 4, base=16, bitRange=0-9 +sfr = "ADC_CDR6", "Memory", 0xfffd8048, 4, base=16 +sfr = "ADC_CDR6.DATA", "Memory", 0xfffd8048, 4, base=16, bitRange=0-9 +sfr = "ADC_CDR7", "Memory", 0xfffd804c, 4, base=16 +sfr = "ADC_CDR7.DATA", "Memory", 0xfffd804c, 4, base=16, bitRange=0-9 + + +[SfrGroupInfo] +group = "TC0", "TC0_CCR", "TC0_CMR", "TC0_CV", "TC0_RA", "TC0_RB", "TC0_RC", "TC0_SR", "TC0_IER", "TC0_IDR", "TC0_IMR" +group = "TCB", "TCB_BCR", "TCB_BMR" +group = "TC1", "TC1_CCR", "TC1_CMR", "TC1_CV", "TC1_RA", "TC1_RB", "TC1_RC", "TC1_SR", "TC1_IER", "TC1_IDR", "TC1_IMR" +group = "TC2", "TC2_CCR", "TC2_CMR", "TC2_CV", "TC2_RA", "TC2_RB", "TC2_RC", "TC2_SR", "TC2_IER", "TC2_IDR", "TC2_IMR" +group = "UDP", "UDP_NUM", "UDP_GLBSTATE", "UDP_FADDR", "UDP_IER", "UDP_IDR", "UDP_IMR", "UDP_ISR", "UDP_ICR", "UDP_RSTEP", "UDP_CSR", "UDP_FDR", "UDP_TXVC" +group = "TWI", "TWI_CR", "TWI_MMR", "TWI_IADR", "TWI_CWGR", "TWI_SR", "TWI_IER", "TWI_IDR", "TWI_IMR", "TWI_RHR", "TWI_THR" +group = "US0", "US0_CR", "US0_MR", "US0_IER", "US0_IDR", "US0_IMR", "US0_CSR", "US0_RHR", "US0_THR", "US0_BRGR", "US0_RTOR", "US0_TTGR", "US0_FIDI", "US0_NER", "US0_IF" +group = "PDC_US0", "US0_RPR", "US0_RCR", "US0_TPR", "US0_TCR", "US0_RNPR", "US0_RNCR", "US0_TNPR", "US0_TNCR", "US0_PTCR", "US0_PTSR" +group = "US1", "US1_CR", "US1_MR", "US1_IER", "US1_IDR", "US1_IMR", "US1_CSR", "US1_RHR", "US1_THR", "US1_BRGR", "US1_RTOR", "US1_TTGR", "US1_FIDI", "US1_NER", "US1_IF" +group = "PDC_US1", "US1_RPR", "US1_RCR", "US1_TPR", "US1_TCR", "US1_RNPR", "US1_RNCR", "US1_TNPR", "US1_TNCR", "US1_PTCR", "US1_PTSR" +group = "PWMC", "PWMC_MR", "PWMC_ENA", "PWMC_DIS", "PWMC_SR", "PWMC_IER", "PWMC_IDR", "PWMC_IMR", "PWMC_ISR", "PWMC_VR" +group = "PWMC_CH0", "PWMC_CH0_CMR", "PWMC_CH0_CDTYR", "PWMC_CH0_CPRDR", "PWMC_CH0_CCNTR", "PWMC_CH0_CUPDR", "PWMC_CH0_Reserved" +group = "PWMC_CH1", "PWMC_CH1_CMR", "PWMC_CH1_CDTYR", "PWMC_CH1_CPRDR", "PWMC_CH1_CCNTR", "PWMC_CH1_CUPDR", "PWMC_CH1_Reserved" +group = "PWMC_CH2", "PWMC_CH2_CMR", "PWMC_CH2_CDTYR", "PWMC_CH2_CPRDR", "PWMC_CH2_CCNTR", "PWMC_CH2_CUPDR", "PWMC_CH2_Reserved" +group = "PWMC_CH3", "PWMC_CH3_CMR", "PWMC_CH3_CDTYR", "PWMC_CH3_CPRDR", "PWMC_CH3_CCNTR", "PWMC_CH3_CUPDR", "PWMC_CH3_Reserved" +group = "CAN", "CAN_MR", "CAN_IER", "CAN_IDR", "CAN_IMR", "CAN_SR", "CAN_BR", "CAN_TIM", "CAN_TIMESTP", "CAN_ECR", "CAN_TCR", "CAN_ACR", "CAN_VR" +group = "CAN_MB0", "CAN_MB0_MMR", "CAN_MB0_MAM", "CAN_MB0_MID", "CAN_MB0_MFID", "CAN_MB0_MSR", "CAN_MB0_MDL", "CAN_MB0_MDH", "CAN_MB0_MCR" +group = "CAN_MB1", "CAN_MB1_MMR", "CAN_MB1_MAM", "CAN_MB1_MID", "CAN_MB1_MFID", "CAN_MB1_MSR", "CAN_MB1_MDL", "CAN_MB1_MDH", "CAN_MB1_MCR" +group = "CAN_MB2", "CAN_MB2_MMR", "CAN_MB2_MAM", "CAN_MB2_MID", "CAN_MB2_MFID", "CAN_MB2_MSR", "CAN_MB2_MDL", "CAN_MB2_MDH", "CAN_MB2_MCR" +group = "CAN_MB3", "CAN_MB3_MMR", "CAN_MB3_MAM", "CAN_MB3_MID", "CAN_MB3_MFID", "CAN_MB3_MSR", "CAN_MB3_MDL", "CAN_MB3_MDH", "CAN_MB3_MCR" +group = "CAN_MB4", "CAN_MB4_MMR", "CAN_MB4_MAM", "CAN_MB4_MID", "CAN_MB4_MFID", "CAN_MB4_MSR", "CAN_MB4_MDL", "CAN_MB4_MDH", "CAN_MB4_MCR" +group = "CAN_MB5", "CAN_MB5_MMR", "CAN_MB5_MAM", "CAN_MB5_MID", "CAN_MB5_MFID", "CAN_MB5_MSR", "CAN_MB5_MDL", "CAN_MB5_MDH", "CAN_MB5_MCR" +group = "CAN_MB6", "CAN_MB6_MMR", "CAN_MB6_MAM", "CAN_MB6_MID", "CAN_MB6_MFID", "CAN_MB6_MSR", "CAN_MB6_MDL", "CAN_MB6_MDH", "CAN_MB6_MCR" +group = "CAN_MB7", "CAN_MB7_MMR", "CAN_MB7_MAM", "CAN_MB7_MID", "CAN_MB7_MFID", "CAN_MB7_MSR", "CAN_MB7_MDL", "CAN_MB7_MDH", "CAN_MB7_MCR" +group = "SSC", "SSC_CR", "SSC_CMR", "SSC_RCMR", "SSC_RFMR", "SSC_TCMR", "SSC_TFMR", "SSC_RHR", "SSC_THR", "SSC_RSHR", "SSC_TSHR", "SSC_SR", "SSC_IER", "SSC_IDR", "SSC_IMR" +group = "PDC_SSC", "SSC_RPR", "SSC_RCR", "SSC_TPR", "SSC_TCR", "SSC_RNPR", "SSC_RNCR", "SSC_TNPR", "SSC_TNCR", "SSC_PTCR", "SSC_PTSR" +group = "ADC", "ADC_CR", "ADC_MR", "ADC_CHER", "ADC_CHDR", "ADC_CHSR", "ADC_SR", "ADC_LCDR", "ADC_IER", "ADC_IDR", "ADC_IMR", "ADC_CDR0", "ADC_CDR1", "ADC_CDR2", "ADC_CDR3", "ADC_CDR4", "ADC_CDR5", "ADC_CDR6", "ADC_CDR7" +group = "PDC_ADC", "ADC_RPR", "ADC_RCR", "ADC_TPR", "ADC_TCR", "ADC_RNPR", "ADC_RNCR", "ADC_TNPR", "ADC_TNCR", "ADC_PTCR", "ADC_PTSR" +group = "EMAC", "EMAC_NCR", "EMAC_NCFGR", "EMAC_NSR", "EMAC_TSR", "EMAC_RBQP", "EMAC_TBQP", "EMAC_RSR", "EMAC_ISR", "EMAC_IER", "EMAC_IDR", "EMAC_IMR", "EMAC_MAN", "EMAC_PTR", "EMAC_PFR", "EMAC_FTO", "EMAC_SCF", "EMAC_MCF", "EMAC_FRO", "EMAC_FCSE", "EMAC_ALE", "EMAC_DTF", "EMAC_LCOL", "EMAC_ECOL", "EMAC_TUND", "EMAC_CSE", "EMAC_RRE", "EMAC_ROV", "EMAC_RSE", "EMAC_ELE", "EMAC_RJA", "EMAC_USF", "EMAC_STE", "EMAC_RLE", "EMAC_TPF", "EMAC_HRB", "EMAC_HRT", "EMAC_SA1L", "EMAC_SA1H", "EMAC_SA2L", "EMAC_SA2H", "EMAC_SA3L", "EMAC_SA3H", "EMAC_SA4L", "EMAC_SA4H", "EMAC_TID", "EMAC_TPQ", "EMAC_USRIO", "EMAC_WOL", "EMAC_REV" +group = "SPI0", "SPI0_CR", "SPI0_MR", "SPI0_RDR", "SPI0_TDR", "SPI0_SR", "SPI0_IER", "SPI0_IDR", "SPI0_IMR", "SPI0_CSR" +group = "PDC_SPI0", "SPI0_RPR", "SPI0_RCR", "SPI0_TPR", "SPI0_TCR", "SPI0_RNPR", "SPI0_RNCR", "SPI0_TNPR", "SPI0_TNCR", "SPI0_PTCR", "SPI0_PTSR" +group = "SPI1", "SPI1_CR", "SPI1_MR", "SPI1_RDR", "SPI1_TDR", "SPI1_SR", "SPI1_IER", "SPI1_IDR", "SPI1_IMR", "SPI1_CSR" +group = "PDC_SPI1", "SPI1_RPR", "SPI1_RCR", "SPI1_TPR", "SPI1_TCR", "SPI1_RNPR", "SPI1_RNCR", "SPI1_TNPR", "SPI1_TNCR", "SPI1_PTCR", "SPI1_PTSR" +group = "SYS" +group = "AIC", "AIC_SMR", "AIC_SVR", "AIC_IVR", "AIC_FVR", "AIC_ISR", "AIC_IPR", "AIC_IMR", "AIC_CISR", "AIC_IECR", "AIC_IDCR", "AIC_ICCR", "AIC_ISCR", "AIC_EOICR", "AIC_SPU", "AIC_DCR", "AIC_FFER", "AIC_FFDR", "AIC_FFSR" +group = "DBGU", "DBGU_CR", "DBGU_MR", "DBGU_IER", "DBGU_IDR", "DBGU_IMR", "DBGU_CSR", "DBGU_RHR", "DBGU_THR", "DBGU_BRGR", "DBGU_CIDR", "DBGU_EXID", "DBGU_FNTR" +group = "PDC_DBGU", "DBGU_RPR", "DBGU_RCR", "DBGU_TPR", "DBGU_TCR", "DBGU_RNPR", "DBGU_RNCR", "DBGU_TNPR", "DBGU_TNCR", "DBGU_PTCR", "DBGU_PTSR" +group = "PIOA", "PIOA_PER", "PIOA_PDR", "PIOA_PSR", "PIOA_OER", "PIOA_ODR", "PIOA_OSR", "PIOA_IFER", "PIOA_IFDR", "PIOA_IFSR", "PIOA_SODR", "PIOA_CODR", "PIOA_ODSR", "PIOA_PDSR", "PIOA_IER", "PIOA_IDR", "PIOA_IMR", "PIOA_ISR", "PIOA_MDER", "PIOA_MDDR", "PIOA_MDSR", "PIOA_PPUDR", "PIOA_PPUER", "PIOA_PPUSR", "PIOA_ASR", "PIOA_BSR", "PIOA_ABSR", "PIOA_OWER", "PIOA_OWDR", "PIOA_OWSR" +group = "PIOB", "PIOB_PER", "PIOB_PDR", "PIOB_PSR", "PIOB_OER", "PIOB_ODR", "PIOB_OSR", "PIOB_IFER", "PIOB_IFDR", "PIOB_IFSR", "PIOB_SODR", "PIOB_CODR", "PIOB_ODSR", "PIOB_PDSR", "PIOB_IER", "PIOB_IDR", "PIOB_IMR", "PIOB_ISR", "PIOB_MDER", "PIOB_MDDR", "PIOB_MDSR", "PIOB_PPUDR", "PIOB_PPUER", "PIOB_PPUSR", "PIOB_ASR", "PIOB_BSR", "PIOB_ABSR", "PIOB_OWER", "PIOB_OWDR", "PIOB_OWSR" +group = "PMC", "PMC_SCER", "PMC_SCDR", "PMC_SCSR", "PMC_PCER", "PMC_PCDR", "PMC_PCSR", "PMC_MOR", "PMC_MCFR", "PMC_PLLR", "PMC_MCKR", "PMC_PCKR", "PMC_IER", "PMC_IDR", "PMC_SR", "PMC_IMR" +group = "CKGR", "CKGR_MOR", "CKGR_MCFR", "CKGR_PLLR" +group = "RSTC", "RSTC_RCR", "RSTC_RSR", "RSTC_RMR" +group = "RTTC", "RTTC_RTMR", "RTTC_RTAR", "RTTC_RTVR", "RTTC_RTSR" +group = "PITC", "PITC_PIMR", "PITC_PISR", "PITC_PIVR", "PITC_PIIR" +group = "WDTC", "WDTC_WDCR", "WDTC_WDMR", "WDTC_WDSR" +group = "VREG", "VREG_MR" +group = "MC", "MC_RCR", "MC_ASR", "MC_AASR", "MC_FMR", "MC_FCR", "MC_FSR" diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/cmock_demo.dep b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/cmock_demo.dep new file mode 100644 index 0000000..ed68769 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/cmock_demo.dep @@ -0,0 +1,3691 @@ + + + + 2 + + Debug + + $PROJ_DIR$\Debug\Obj\Main.r79 + $PROJ_DIR$\Debug\Obj\IntrinsicsWrapper.r79 + $PROJ_DIR$\Debug\Obj\cmock_demo.pbd + $PROJ_DIR$\Debug\Obj\TimerInterruptConfigurator.r79 + $PROJ_DIR$\Debug\Obj\AdcConductor.r79 + $PROJ_DIR$\Debug\Obj\AdcModel.pbi + $PROJ_DIR$\Debug\Obj\Model.pbi + $PROJ_DIR$\Debug\Obj\AdcModel.r79 + $PROJ_DIR$\Debug\Obj\UsartModel.r79 + $PROJ_DIR$\Debug\Obj\TemperatureFilter.pbi + $PROJ_DIR$\Debug\List\AdcHardwareConfigurator.lst + $PROJ_DIR$\Debug\Obj\UsartConductor.pbi + $PROJ_DIR$\..\..\examples\src\Types.h + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.h + $TOOLKIT_DIR$\inc\DLib_Defaults.h + $PROJ_DIR$\..\..\examples\src\AT91SAM7X256.h + $PROJ_DIR$\..\..\examples\src\AdcConductor.h + $PROJ_DIR$\Debug\List\TimerInterruptHandler.lst + $PROJ_DIR$\..\..\examples\src\TaskScheduler.h + $PROJ_DIR$\..\..\examples\src\UsartConductor.h + $PROJ_DIR$\..\..\examples\src\Model.h + $TOOLKIT_DIR$\inc\intrinsics.h + $PROJ_DIR$\Debug\Obj\UsartHardware.pbi + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.h + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.h + $PROJ_DIR$\Debug\Exe\cmock_demo.d79 + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.h + $PROJ_DIR$\..\..\examples\src\AdcHardware.h + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.h + $PROJ_DIR$\..\..\examples\src\TimerConductor.h + $PROJ_DIR$\..\..\examples\src\UsartPutChar.h + $PROJ_DIR$\Debug\Obj\Executor.pbi + $PROJ_DIR$\..\..\examples\src\UsartModel.h + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.h + $PROJ_DIR$\Debug\List\UsartBaudRateRegisterCalculator.lst + $PROJ_DIR$\..\..\examples\src\UsartHardware.h + $PROJ_DIR$\Debug\List\UsartModel.lst + $PROJ_DIR$\Debug\List\Executor.lst + $PROJ_DIR$\Debug\List\UsartTransmitBufferStatus.lst + $PROJ_DIR$\Debug\Exe\cmock_demo.sim + $PROJ_DIR$\Debug\List\TimerModel.lst + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.h + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.h + $PROJ_DIR$\Debug\List\TimerHardware.lst + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.h + $PROJ_DIR$\Debug\Obj\UsartTransmitBufferStatus.r79 + $PROJ_DIR$\..\..\examples\src\TimerModel.h + $PROJ_DIR$\Debug\List\IntrinsicsWrapper.lst + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.h + $PROJ_DIR$\..\..\examples\src\TimerHardware.h + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.h + $PROJ_DIR$\Debug\List\Cstartup_SAM7.lst + $TOOLKIT_DIR$\inc\DLib_Product.h + $PROJ_DIR$\Debug\Obj\UsartModel.pbi + $TOOLKIT_DIR$\inc\math.h + $PROJ_DIR$\Debug\Obj\AdcHardware.r79 + $PROJ_DIR$\Debug\Obj\TimerModel.r79 + $TOOLKIT_DIR$\inc\stdio.h + $PROJ_DIR$\Debug\Obj\UsartConfigurator.pbi + $PROJ_DIR$\Debug\List\AdcModel.lst + $PROJ_DIR$\Debug\List\AdcConductor.lst + $PROJ_DIR$\Debug\List\UsartConductor.lst + $PROJ_DIR$\Debug\List\Model.lst + $PROJ_DIR$\Debug\List\TaskScheduler.lst + $PROJ_DIR$\Debug\List\UsartHardware.lst + $PROJ_DIR$\Debug\List\AdcHardware.lst + $PROJ_DIR$\Debug\List\Main.lst + $PROJ_DIR$\Debug\Obj\UsartBaudRateRegisterCalculator.r79 + $PROJ_DIR$\Debug\Obj\AdcConductor.pbi + $PROJ_DIR$\Debug\Obj\TaskScheduler.pbi + $PROJ_DIR$\Debug\List\UsartConfigurator.lst + $PROJ_DIR$\Debug\Obj\TaskScheduler.r79 + $TOOLKIT_DIR$\inc\ymath.h + $PROJ_DIR$\Debug\Obj\TemperatureFilter.r79 + $TOOLKIT_DIR$\inc\ysizet.h + $PROJ_DIR$\Debug\Obj\TimerHardware.pbi + $PROJ_DIR$\Debug\Obj\TemperatureCalculator.r79 + $PROJ_DIR$\Debug\Obj\AdcTemperatureSensor.pbi + $PROJ_DIR$\Debug\List\TemperatureCalculator.lst + $PROJ_DIR$\Debug\List\AdcTemperatureSensor.lst + $TOOLKIT_DIR$\lib\dl4tptinl8n.h + $PROJ_DIR$\Debug\Obj\AdcHardware.pbi + $PROJ_DIR$\Debug\Obj\UsartConfigurator.r79 + $TOOLKIT_DIR$\inc\xencoding_limits.h + $PROJ_DIR$\Debug\Obj\TimerConfigurator.r79 + $PROJ_DIR$\Debug\Obj\AdcTemperatureSensor.r79 + $PROJ_DIR$\Debug\Obj\Main.pbi + $TOOLKIT_DIR$\lib\dl4tptinl8n.r79 + $PROJ_DIR$\Debug\Obj\TimerInterruptHandler.r79 + $PROJ_DIR$\Debug\Obj\UsartHardware.r79 + $PROJ_DIR$\Debug\Obj\UsartPutChar.pbi + $PROJ_DIR$\Debug\Obj\TimerInterruptConfigurator.pbi + $TOOLKIT_DIR$\inc\yvals.h + $PROJ_DIR$\Debug\Obj\UsartTransmitBufferStatus.pbi + $PROJ_DIR$\Debug\Obj\IntrinsicsWrapper.pbi + $PROJ_DIR$\Debug\Obj\AdcHardwareConfigurator.r79 + $PROJ_DIR$\incIAR\AT91SAM7X256_inc.h + $TOOLKIT_DIR$\inc\DLib_Threads.h + $PROJ_DIR$\Debug\Obj\TimerConfigurator.pbi + $PROJ_DIR$\Debug\Obj\TimerConductor.pbi + $PROJ_DIR$\Debug\Obj\TimerInterruptHandler.pbi + $PROJ_DIR$\Debug\Obj\UsartPutChar.r79 + $PROJ_DIR$\Debug\Obj\UsartConductor.r79 + $PROJ_DIR$\Debug\Obj\TimerHardware.r79 + $PROJ_DIR$\Debug\Obj\Cstartup_SAM7.r79 + $PROJ_DIR$\Debug\List\cmock_demo.map + $PROJ_DIR$\Debug\List\TimerInterruptConfigurator.lst + $PROJ_DIR$\Debug\Obj\TimerConductor.r79 + $PROJ_DIR$\Debug\Obj\Model.r79 + $PROJ_DIR$\Debug\Obj\UsartBaudRateRegisterCalculator.pbi + $PROJ_DIR$\Debug\Obj\AdcHardwareConfigurator.pbi + $PROJ_DIR$\Debug\Obj\TemperatureCalculator.pbi + $PROJ_DIR$\Debug\Obj\Cstartup_SAM7.pbi + $PROJ_DIR$\Resource\at91SAM7X256_FLASH.xcl + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + $PROJ_DIR$\..\..\examples\src\TimerModel.c + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + $PROJ_DIR$\..\..\examples\src\UsartModel.c + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + $PROJ_DIR$\Cstartup.s79 + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + $PROJ_DIR$\Cstartup_SAM7.c + $PROJ_DIR$\..\..\examples\src\AdcModel.c + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + $PROJ_DIR$\..\..\examples\src\Executor.c + $PROJ_DIR$\..\..\examples\src\Main.c + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + $PROJ_DIR$\..\..\examples\src\Model.c + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + $PROJ_DIR$\Debug\Obj\Cstartup.r79 + $PROJ_DIR$\Debug\List\TimerConfigurator.lst + $PROJ_DIR$\..\..\examples\src\Executor.h + $PROJ_DIR$\Debug\List\TimerConductor.lst + $PROJ_DIR$\..\..\examples\src\AdcModel.h + $PROJ_DIR$\..\..\examples\src\ModelConfig.h + $PROJ_DIR$\Debug\Obj\Executor.r79 + $PROJ_DIR$\Debug\List\UsartPutChar.lst + $PROJ_DIR$\Debug\List\TemperatureFilter.lst + $PROJ_DIR$\Debug\Obj\TimerModel.pbi + $PROJ_DIR$\srcIAR\Cstartup.s79 + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + + + [ROOT_NODE] + + + XLINK + 25 105 39 + + + + + $PROJ_DIR$\Debug\Obj\cmock_demo.pbd + + + BILINK + 68 81 110 5 77 112 31 94 86 6 69 111 9 99 98 75 91 100 150 109 11 58 22 53 90 93 + + + + + $PROJ_DIR$\Debug\Exe\cmock_demo.d79 + + + XLINK + 105 39 + + + + + XLINK + 113 4 55 95 7 85 141 104 147 1 0 108 71 76 73 107 84 103 3 88 56 67 102 82 89 8 101 45 87 + + + + + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + + + ICCARM + 107 144 + + + BICOMP + 99 + + + + + ICCARM + 12 15 29 46 49 44 + + + BICOMP + 12 15 29 46 49 44 + + + + + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + + + ICCARM + 84 142 + + + BICOMP + 98 + + + + + ICCARM + 12 15 48 42 + + + BICOMP + 12 15 48 42 + + + + + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + + + ICCARM + 103 43 + + + BICOMP + 75 + + + + + ICCARM + 12 15 49 48 + + + BICOMP + 12 15 49 48 + + + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + + + ICCARM + 3 106 + + + BICOMP + 91 + + + + + ICCARM + 12 15 42 44 + + + BICOMP + 12 15 42 44 + + + + + $PROJ_DIR$\..\..\examples\src\TimerModel.c + + + ICCARM + 56 40 + + + BICOMP + 150 + + + + + ICCARM + 12 15 46 18 + + + BICOMP + 12 15 46 18 + + + + + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + + + ICCARM + 67 34 + + + BICOMP + 109 + + + + + ICCARM + 12 15 50 + + + BICOMP + 12 15 50 + + + + + $PROJ_DIR$\..\..\examples\src\UsartModel.c + + + ICCARM + 8 36 + + + BICOMP + 53 + + + + + ICCARM + 12 15 32 146 50 28 57 92 14 80 52 83 97 74 54 72 + + + BICOMP + 12 15 32 146 50 28 57 92 14 52 83 97 74 54 72 + + + + + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + + + ICCARM + 102 61 + + + BICOMP + 11 + + + + + ICCARM + 12 15 19 35 32 18 + + + BICOMP + 12 15 19 35 32 18 + + + + + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + + + ICCARM + 82 70 + + + BICOMP + 58 + + + + + ICCARM + 12 15 26 + + + BICOMP + 12 15 26 + + + + + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + + + ICCARM + 89 64 + + + BICOMP + 22 + + + + + ICCARM + 12 15 35 26 30 + + + BICOMP + 12 15 35 26 30 + + + + + $PROJ_DIR$\Cstartup.s79 + + + AARM + 141 + + + + + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + + + ICCARM + 101 148 + + + BICOMP + 90 + + + + + ICCARM + 12 15 30 41 + + + BICOMP + 12 15 30 41 + + + + + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + + + ICCARM + 45 38 + + + BICOMP + 93 + + + + + ICCARM + 12 15 41 + + + BICOMP + 12 15 41 + + + + + $PROJ_DIR$\Cstartup_SAM7.c + + + ICCARM + 104 51 + + + BICOMP + 112 + + + + + ICCARM + 15 + + + + + $PROJ_DIR$\..\..\examples\src\AdcModel.c + + + ICCARM + 7 59 + + + BICOMP + 5 + + + + + ICCARM + 12 15 145 18 23 28 + + + BICOMP + 12 15 145 18 23 28 + + + + + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + + + ICCARM + 85 79 + + + BICOMP + 77 + + + + + ICCARM + 12 15 24 + + + BICOMP + 12 15 24 + + + + + $PROJ_DIR$\..\..\examples\src\Executor.c + + + ICCARM + 147 37 + + + BICOMP + 31 + + + + + ICCARM + 12 15 143 20 19 29 16 33 + + + BICOMP + 12 15 143 20 19 29 16 33 + + + + + $PROJ_DIR$\..\..\examples\src\Main.c + + + ICCARM + 0 66 + + + BICOMP + 86 + + + + + ICCARM + 12 15 33 143 20 18 23 28 19 35 26 30 32 50 41 29 49 48 42 44 46 16 27 13 24 145 + + + BICOMP + 12 15 33 143 20 18 23 28 19 35 26 30 32 50 41 29 49 48 42 44 46 16 27 13 24 145 + + + + + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + + + ICCARM + 1 47 + + + BICOMP + 94 + + + + + ICCARM + 33 21 + + + BICOMP + 33 21 + + + + + $PROJ_DIR$\..\..\examples\src\Model.c + + + ICCARM + 108 62 + + + BICOMP + 6 + + + + + ICCARM + 20 12 15 18 28 + + + BICOMP + 20 12 15 18 28 + + + + + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + + + ICCARM + 76 78 + + + BICOMP + 111 + + + + + ICCARM + 12 15 23 54 72 92 14 80 52 83 97 + + + BICOMP + 12 15 23 54 72 92 14 52 83 97 + + + + + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + + + ICCARM + 71 63 + + + BICOMP + 69 + + + + + ICCARM + 12 15 18 + + + BICOMP + 12 15 18 + + + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + + + ICCARM + 88 17 + + + BICOMP + 100 + + + + + ICCARM + 12 15 44 42 + + + BICOMP + 12 15 44 42 + + + + + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + + + ICCARM + 73 149 + + + BICOMP + 9 + + + + + ICCARM + 12 15 28 54 72 92 14 80 52 83 97 + + + BICOMP + 12 15 28 54 72 92 14 52 83 97 + + + + + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + + + ICCARM + 95 10 + + + BICOMP + 110 + + + + + ICCARM + 12 15 13 146 + + + BICOMP + 12 15 13 146 + + + + + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + + + ICCARM + 4 60 + + + BICOMP + 68 + + + + + ICCARM + 12 15 16 145 27 + + + BICOMP + 12 15 16 145 27 + + + + + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + + + ICCARM + 55 65 + + + BICOMP + 81 + + + + + ICCARM + 12 15 27 13 24 + + + BICOMP + 12 15 27 13 24 + + + + + $PROJ_DIR$\srcIAR\Cstartup.s79 + + + AARM + 141 + + + + + AARM + 96 + + + + + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + + + ICCARM + 104 51 + + + BICOMP + 112 + + + + + ICCARM + 15 + + + + + + Release + + $PROJ_DIR$\..\test\system\src\TemperatureCalculator.h + $PROJ_DIR$\..\..\examples\src\Types.h + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.h + $TOOLKIT_DIR$\inc\DLib_Defaults.h + $PROJ_DIR$\..\..\examples\src\AT91SAM7X256.h + $PROJ_DIR$\..\..\examples\src\AdcConductor.h + $PROJ_DIR$\..\..\examples\src\TaskScheduler.h + $PROJ_DIR$\..\..\examples\src\UsartConductor.h + $PROJ_DIR$\..\..\examples\src\Model.h + $TOOLKIT_DIR$\inc\intrinsics.h + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.h + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.h + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.h + $PROJ_DIR$\..\..\examples\src\AdcHardware.h + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.h + $PROJ_DIR$\..\..\examples\src\TimerConductor.h + $PROJ_DIR$\..\..\examples\src\UsartPutChar.h + $PROJ_DIR$\..\..\examples\src\UsartModel.h + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.h + $PROJ_DIR$\..\..\examples\src\UsartHardware.h + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.h + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.h + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.h + $PROJ_DIR$\..\..\examples\src\TimerModel.h + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.h + $PROJ_DIR$\..\..\examples\src\TimerHardware.h + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.h + $TOOLKIT_DIR$\inc\DLib_Product.h + $TOOLKIT_DIR$\inc\math.h + $TOOLKIT_DIR$\inc\stdio.h + $TOOLKIT_DIR$\inc\ymath.h + $TOOLKIT_DIR$\inc\ysizet.h + $TOOLKIT_DIR$\lib\dl4tptinl8n.h + $PROJ_DIR$\..\test\system\src\UsartPutChar.h + $PROJ_DIR$\..\test\system\src\AdcTemperatureSensor.h + $PROJ_DIR$\..\test\system\src\TaskScheduler.h + $PROJ_DIR$\..\test\system\src\UsartTransmitBufferStatus.h + $PROJ_DIR$\..\test\system\src\UsartConfigurator.h + $PROJ_DIR$\..\test\system\src\TimerConfigurator.h + $PROJ_DIR$\..\test\system\src\AT91SAM7X256.h + $PROJ_DIR$\..\test\system\src\UsartBaudRateRegisterCalculator.h + $PROJ_DIR$\..\test\system\src\Executor.h + $PROJ_DIR$\..\test\system\src\ModelConfig.h + $PROJ_DIR$\..\test\system\src\TimerModel.h + $PROJ_DIR$\..\test\system\src\TimerInterruptHandler.h + $PROJ_DIR$\..\test\system\src\Main.c + $PROJ_DIR$\..\test\system\src\Model.c + $PROJ_DIR$\..\test\system\src\AdcHardwareConfigurator.c + $PROJ_DIR$\..\test\system\src\TimerModel.c + $PROJ_DIR$\..\test\system\src\UsartModel.c + $PROJ_DIR$\..\test\system\src\UsartHardware.c + $PROJ_DIR$\..\test\system\src\UsartTransmitBufferStatus.c + $PROJ_DIR$\..\test\system\src\UsartPutChar.c + $PROJ_DIR$\..\test\system\src\TimerInterruptConfigurator.c + $PROJ_DIR$\..\test\system\src\UsartBaudRateRegisterCalculator.c + $PROJ_DIR$\..\test\system\src\TaskScheduler.c + $PROJ_DIR$\..\test\system\src\AdcConductor.h + $PROJ_DIR$\..\test\system\src\TimerInterruptConfigurator.h + $PROJ_DIR$\..\test\system\src\Model.h + $PROJ_DIR$\..\test\system\src\TemperatureFilter.h + $PROJ_DIR$\..\test\system\src\AdcModel.c + $PROJ_DIR$\..\test\system\src\TimerHardware.h + $PROJ_DIR$\..\test\system\src\AdcTemperatureSensor.c + $PROJ_DIR$\..\test\system\src\AdcConductor.c + $PROJ_DIR$\..\test\system\src\AdcHardware.c + $PROJ_DIR$\..\test\system\src\AdcHardware.h + $PROJ_DIR$\..\test\system\src\Executor.c + $TOOLKIT_DIR$\inc\xencoding_limits.h + $TOOLKIT_DIR$\lib\dl4tptinl8n.r79 + $PROJ_DIR$\..\test\system\src\TemperatureCalculator.c + $PROJ_DIR$\..\test\system\src\Types.h + $PROJ_DIR$\..\test\system\src\TemperatureFilter.c + $PROJ_DIR$\..\test\system\src\TimerConductor.c + $PROJ_DIR$\..\test\system\src\TimerConfigurator.c + $PROJ_DIR$\..\test\system\src\TimerHardware.c + $PROJ_DIR$\..\test\system\src\TimerInterruptHandler.c + $PROJ_DIR$\..\test\system\src\UsartConductor.c + $PROJ_DIR$\..\test\system\src\UsartConfigurator.c + $PROJ_DIR$\..\test\system\src\UsartHardware.h + $PROJ_DIR$\..\test\system\src\TimerConductor.h + $PROJ_DIR$\..\test\system\src\AdcModel.h + $PROJ_DIR$\..\test\system\src\AdcHardwareConfigurator.h + $PROJ_DIR$\..\test\system\src\UsartConductor.h + $PROJ_DIR$\Release\Obj\Executor.pbi + $PROJ_DIR$\..\test\system\src\UsartModel.h + $PROJ_DIR$\Release\Obj\Model.pbi + $PROJ_DIR$\Release\Obj\Cstartup_SAM7.pbi + $PROJ_DIR$\Release\Obj\UsartConductor.pbi + $PROJ_DIR$\Release\Obj\AdcConductor.r79 + $PROJ_DIR$\Release\Obj\AdcHardware.r79 + $PROJ_DIR$\Release\Obj\TimerModel.pbi + $PROJ_DIR$\Release\Obj\AdcTemperatureSensor.pbi + $PROJ_DIR$\Release\Obj\UsartHardware.r79 + $PROJ_DIR$\Release\Obj\TemperatureFilter.pbi + $PROJ_DIR$\Release\Obj\UsartPutChar.pbi + $PROJ_DIR$\Release\Obj\TemperatureCalculator.r79 + $PROJ_DIR$\Release\Obj\AdcHardwareConfigurator.r79 + $PROJ_DIR$\Release\Obj\cmock_demo.pbd + $PROJ_DIR$\Release\Obj\UsartModel.r79 + $PROJ_DIR$\Release\Obj\UsartBaudRateRegisterCalculator.r79 + $PROJ_DIR$\Release\Obj\Model.r79 + $PROJ_DIR$\Release\Obj\AdcModel.r79 + $PROJ_DIR$\Release\Obj\AdcHardware.pbi + $PROJ_DIR$\Release\Obj\TimerModel.r79 + $PROJ_DIR$\Release\Obj\TimerHardware.r79 + $PROJ_DIR$\Release\Obj\UsartPutChar.r79 + $PROJ_DIR$\Release\Obj\AdcHardwareConfigurator.pbi + $PROJ_DIR$\Release\Obj\TimerInterruptConfigurator.r79 + $PROJ_DIR$\Release\Obj\TaskScheduler.pbi + $PROJ_DIR$\Release\List\cmock_demo.map + $PROJ_DIR$\Release\Obj\UsartTransmitBufferStatus.pbi + $PROJ_DIR$\Release\Exe\cmock_demo.d79 + $PROJ_DIR$\Release\Obj\AdcTemperatureSensor.r79 + $PROJ_DIR$\Release\Obj\TimerConductor.r79 + $PROJ_DIR$\Release\Obj\TimerConfigurator.r79 + $PROJ_DIR$\Release\Obj\Main.pbi + $PROJ_DIR$\Release\Obj\TimerInterruptConfigurator.pbi + $PROJ_DIR$\Release\Obj\UsartTransmitBufferStatus.r79 + $PROJ_DIR$\Release\Obj\AdcModel.pbi + $PROJ_DIR$\Release\Obj\TemperatureFilter.r79 + $PROJ_DIR$\Release\Obj\UsartHardware.pbi + $PROJ_DIR$\Release\Obj\Cstartup.r79 + $PROJ_DIR$\Release\Obj\UsartConductor.r79 + $PROJ_DIR$\Release\Obj\TimerInterruptHandler.pbi + $PROJ_DIR$\Release\Obj\TimerConductor.pbi + $PROJ_DIR$\Release\Obj\Main.r79 + $PROJ_DIR$\Release\Obj\UsartConfigurator.pbi + $PROJ_DIR$\Release\Obj\Executor.r79 + $PROJ_DIR$\Release\Obj\Cstartup_SAM7.r79 + $PROJ_DIR$\Release\Obj\TemperatureCalculator.pbi + $PROJ_DIR$\Release\Obj\TimerHardware.pbi + $PROJ_DIR$\Release\Exe\cmock_demo.sim + $PROJ_DIR$\Release\Obj\TimerConfigurator.pbi + $PROJ_DIR$\Release\Obj\UsartModel.pbi + $PROJ_DIR$\Release\Obj\TaskScheduler.r79 + $PROJ_DIR$\Release\Obj\UsartBaudRateRegisterCalculator.pbi + $PROJ_DIR$\Release\Obj\AdcConductor.pbi + $PROJ_DIR$\Release\Obj\TimerInterruptHandler.r79 + $PROJ_DIR$\Release\Obj\UsartConfigurator.r79 + $PROJ_DIR$\Release\Obj\IntrinsicsWrapper.pbi + $PROJ_DIR$\Release\Obj\IntrinsicsWrapper.r79 + $TOOLKIT_DIR$\inc\yvals.h + $PROJ_DIR$\incIAR\AT91SAM7X256_inc.h + $TOOLKIT_DIR$\inc\DLib_Threads.h + $PROJ_DIR$\Resource\at91SAM7X256_FLASH.xcl + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + $PROJ_DIR$\..\..\examples\src\TimerModel.c + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + $PROJ_DIR$\..\..\examples\src\UsartModel.c + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + $PROJ_DIR$\Cstartup.s79 + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + $PROJ_DIR$\Cstartup_SAM7.c + $PROJ_DIR$\..\..\examples\src\AdcModel.c + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + $PROJ_DIR$\..\..\examples\src\Executor.c + $PROJ_DIR$\..\..\examples\src\Main.c + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + $PROJ_DIR$\..\..\examples\src\Model.c + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + $PROJ_DIR$\..\..\examples\src\Executor.h + $PROJ_DIR$\..\..\examples\src\AdcModel.h + $PROJ_DIR$\..\..\examples\src\ModelConfig.h + $PROJ_DIR$\srcIAR\Cstartup.s79 + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + + + [ROOT_NODE] + + + XLINK + 111 109 131 + + + + + $PROJ_DIR$\..\test\system\src\Main.c + + + ICCARM + 125 + + + BICOMP + 115 + + + + + ICCARM + 70 39 41 58 35 0 59 82 78 37 33 84 40 36 79 61 38 57 44 43 56 65 81 34 80 + + + + + $PROJ_DIR$\..\test\system\src\Model.c + + + ICCARM + 100 + + + BICOMP + 85 + + + + + ICCARM + 58 70 39 35 59 + + + + + $PROJ_DIR$\..\test\system\src\AdcHardwareConfigurator.c + + + ICCARM + 96 + + + BICOMP + 106 + + + + + ICCARM + 70 39 81 42 + + + + + $PROJ_DIR$\..\test\system\src\TimerModel.c + + + ICCARM + 103 + + + BICOMP + 90 + + + + + ICCARM + 70 39 43 35 + + + + + $PROJ_DIR$\..\test\system\src\UsartModel.c + + + ICCARM + 98 + + + BICOMP + 133 + + + + + ICCARM + 70 39 84 42 40 59 29 141 3 32 27 67 143 31 28 30 + + + + + $PROJ_DIR$\..\test\system\src\UsartHardware.c + + + ICCARM + 92 + + + BICOMP + 120 + + + + + ICCARM + 70 39 78 37 33 + + + + + $PROJ_DIR$\..\test\system\src\UsartTransmitBufferStatus.c + + + ICCARM + 117 + + + BICOMP + 110 + + + + + ICCARM + 70 39 36 + + + + + $PROJ_DIR$\..\test\system\src\UsartPutChar.c + + + ICCARM + 105 + + + BICOMP + 94 + + + + + ICCARM + 70 39 33 36 + + + + + $PROJ_DIR$\..\test\system\src\TimerInterruptConfigurator.c + + + ICCARM + 107 + + + BICOMP + 116 + + + + + ICCARM + 70 39 57 44 + + + + + $PROJ_DIR$\..\test\system\src\UsartBaudRateRegisterCalculator.c + + + ICCARM + 99 + + + BICOMP + 135 + + + + + ICCARM + 70 39 40 + + + + + $PROJ_DIR$\..\test\system\src\TaskScheduler.c + + + ICCARM + 134 + + + BICOMP + 108 + + + + + ICCARM + 70 39 35 + + + + + $PROJ_DIR$\..\test\system\src\AdcModel.c + + + ICCARM + 101 + + + BICOMP + 118 + + + + + ICCARM + 70 39 80 35 0 59 + + + + + $PROJ_DIR$\..\test\system\src\AdcTemperatureSensor.c + + + ICCARM + 112 + + + BICOMP + 91 + + + + + ICCARM + 70 39 34 + + + + + $PROJ_DIR$\..\test\system\src\AdcConductor.c + + + ICCARM + 88 + + + BICOMP + 136 + + + + + $PROJ_DIR$\..\test\system\src\AdcHardware.c + + + ICCARM + 89 + + + BICOMP + 102 + + + + + ICCARM + 70 39 65 81 34 + + + + + $PROJ_DIR$\..\test\system\src\Executor.c + + + ICCARM + 127 + + + BICOMP + 83 + + + + + ICCARM + 70 39 41 58 82 79 56 + + + + + $PROJ_DIR$\..\test\system\src\TemperatureCalculator.c + + + ICCARM + 95 + + + BICOMP + 129 + + + + + ICCARM + 70 39 0 28 30 141 3 32 27 67 143 + + + + + $PROJ_DIR$\..\test\system\src\TemperatureFilter.c + + + ICCARM + 119 + + + BICOMP + 93 + + + + + ICCARM + 70 39 59 28 30 141 3 32 27 67 143 + + + + + $PROJ_DIR$\..\test\system\src\TimerConductor.c + + + ICCARM + 113 + + + BICOMP + 124 + + + + + ICCARM + 70 39 79 43 61 44 + + + + + $PROJ_DIR$\..\test\system\src\TimerConfigurator.c + + + ICCARM + 114 + + + BICOMP + 132 + + + + + ICCARM + 70 39 38 57 + + + + + $PROJ_DIR$\..\test\system\src\TimerHardware.c + + + ICCARM + 104 + + + BICOMP + 130 + + + + + ICCARM + 70 39 61 38 + + + + + $PROJ_DIR$\..\test\system\src\TimerInterruptHandler.c + + + ICCARM + 137 + + + BICOMP + 123 + + + + + ICCARM + 70 39 44 57 + + + + + $PROJ_DIR$\..\test\system\src\UsartConductor.c + + + ICCARM + 122 + + + BICOMP + 87 + + + + + ICCARM + 70 39 82 78 84 35 + + + + + $PROJ_DIR$\..\test\system\src\UsartConfigurator.c + + + ICCARM + 138 + + + BICOMP + 126 + + + + + ICCARM + 70 39 37 + + + + + $PROJ_DIR$\Release\Obj\cmock_demo.pbd + + + BILINK + 136 102 106 118 91 86 83 139 115 85 108 129 93 124 132 130 116 123 90 135 87 126 120 133 94 110 + + + + + $PROJ_DIR$\Release\Exe\cmock_demo.d79 + + + XLINK + 109 131 + + + + + XLINK + 144 88 89 96 101 112 121 128 127 140 125 100 134 95 119 113 114 104 107 137 103 99 122 138 92 98 105 117 68 + + + + + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + + + ICCARM + 113 + + + BICOMP + 124 + + + + + ICCARM + 1 4 15 23 25 22 + + + BICOMP + 1 4 15 23 25 22 + + + + + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + + + ICCARM + 114 + + + BICOMP + 132 + + + + + ICCARM + 1 4 24 21 + + + BICOMP + 1 4 24 21 + + + + + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + + + ICCARM + 104 + + + BICOMP + 130 + + + + + ICCARM + 1 4 25 24 + + + BICOMP + 1 4 25 24 + + + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + + + ICCARM + 107 + + + BICOMP + 116 + + + + + ICCARM + 1 4 21 22 + + + BICOMP + 1 4 21 22 + + + + + $PROJ_DIR$\..\..\examples\src\TimerModel.c + + + ICCARM + 103 + + + BICOMP + 90 + + + + + ICCARM + 1 4 23 6 + + + BICOMP + 1 4 23 6 + + + + + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + + + ICCARM + 99 + + + BICOMP + 135 + + + + + ICCARM + 1 4 26 + + + BICOMP + 1 4 26 + + + + + $PROJ_DIR$\..\..\examples\src\UsartModel.c + + + ICCARM + 98 + + + BICOMP + 133 + + + + + ICCARM + 1 4 17 174 26 14 29 141 3 32 27 67 143 31 28 30 + + + BICOMP + 1 4 17 174 26 14 29 141 3 27 67 143 31 28 30 + + + + + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + + + ICCARM + 122 + + + BICOMP + 87 + + + + + ICCARM + 1 4 7 19 17 6 + + + BICOMP + 1 4 7 19 17 6 + + + + + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + + + ICCARM + 138 + + + BICOMP + 126 + + + + + ICCARM + 1 4 12 + + + BICOMP + 1 4 12 + + + + + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + + + ICCARM + 92 + + + BICOMP + 120 + + + + + ICCARM + 1 4 19 12 16 + + + BICOMP + 1 4 19 12 16 + + + + + $PROJ_DIR$\Cstartup.s79 + + + AARM + 121 + + + + + AARM + 142 + + + + + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + + + ICCARM + 105 + + + BICOMP + 94 + + + + + ICCARM + 1 4 16 20 + + + BICOMP + 1 4 16 20 + + + + + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + + + ICCARM + 117 + + + BICOMP + 110 + + + + + ICCARM + 1 4 20 + + + BICOMP + 1 4 20 + + + + + $PROJ_DIR$\Cstartup_SAM7.c + + + ICCARM + 128 + + + BICOMP + 86 + + + + + ICCARM + 4 + + + BICOMP + 4 + + + + + $PROJ_DIR$\..\..\examples\src\AdcModel.c + + + ICCARM + 101 + + + BICOMP + 118 + + + + + ICCARM + 1 4 173 6 10 14 + + + BICOMP + 1 4 173 6 10 14 + + + + + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + + + ICCARM + 112 + + + BICOMP + 91 + + + + + ICCARM + 1 4 11 + + + BICOMP + 1 4 11 + + + + + $PROJ_DIR$\..\..\examples\src\Executor.c + + + ICCARM + 127 + + + BICOMP + 83 + + + + + ICCARM + 1 4 172 8 7 15 5 18 + + + BICOMP + 1 4 172 8 7 15 5 18 + + + + + $PROJ_DIR$\..\..\examples\src\Main.c + + + ICCARM + 125 + + + BICOMP + 115 + + + + + ICCARM + 1 4 18 172 8 6 10 14 7 19 12 16 17 26 20 15 25 24 21 22 23 5 13 2 11 173 + + + BICOMP + 1 4 18 172 8 6 10 14 7 19 12 16 17 26 20 15 25 24 21 22 23 5 13 2 11 173 + + + + + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + + + ICCARM + 140 + + + BICOMP + 139 + + + + + ICCARM + 18 9 + + + BICOMP + 18 9 + + + + + $PROJ_DIR$\..\..\examples\src\Model.c + + + ICCARM + 100 + + + BICOMP + 85 + + + + + ICCARM + 8 1 4 6 14 + + + BICOMP + 8 1 4 6 14 + + + + + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + + + ICCARM + 95 + + + BICOMP + 129 + + + + + ICCARM + 1 4 10 28 30 141 3 32 27 67 143 + + + BICOMP + 1 4 10 28 30 141 3 27 67 143 + + + + + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + + + ICCARM + 134 + + + BICOMP + 108 + + + + + ICCARM + 1 4 6 + + + BICOMP + 1 4 6 + + + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + + + ICCARM + 137 + + + BICOMP + 123 + + + + + ICCARM + 1 4 22 21 + + + BICOMP + 1 4 22 21 + + + + + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + + + ICCARM + 119 + + + BICOMP + 93 + + + + + ICCARM + 1 4 14 28 30 141 3 32 27 67 143 + + + BICOMP + 1 4 14 28 30 141 3 27 67 143 + + + + + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + + + ICCARM + 96 + + + BICOMP + 106 + + + + + ICCARM + 1 4 2 174 + + + BICOMP + 1 4 2 174 + + + + + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + + + ICCARM + 88 + + + BICOMP + 136 + + + + + ICCARM + 1 4 5 173 13 + + + BICOMP + 1 4 5 173 13 + + + + + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + + + ICCARM + 89 + + + BICOMP + 102 + + + + + ICCARM + 1 4 13 2 11 + + + BICOMP + 1 4 13 2 11 + + + + + $PROJ_DIR$\srcIAR\Cstartup.s79 + + + AARM + 121 + + + + + AARM + 142 + + + + + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + + + ICCARM + 128 + + + BICOMP + 86 + + + + + ICCARM + 4 + + + BICOMP + 4 + + + + + $PROJ_DIR$\..\test\system\src\Main.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\Model.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\AdcHardwareConfigurator.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\TimerModel.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\UsartModel.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\UsartHardware.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\UsartTransmitBufferStatus.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\UsartPutChar.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\TimerInterruptConfigurator.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\UsartBaudRateRegisterCalculator.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\TaskScheduler.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\AdcModel.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\AdcTemperatureSensor.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\AdcConductor.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\AdcHardware.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\Executor.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\TemperatureCalculator.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\TemperatureFilter.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\TimerConductor.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\TimerConfigurator.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\TimerHardware.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\TimerInterruptHandler.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\UsartConductor.c + ICCARM + + + $PROJ_DIR$\..\test\system\src\UsartConfigurator.c + ICCARM + + + + Simulate + + $PROJ_DIR$\..\test\system\src\TemperatureCalculator.h + $PROJ_DIR$\..\..\examples\src\Types.h + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.h + $TOOLKIT_DIR$\inc\DLib_Defaults.h + $PROJ_DIR$\..\..\examples\src\AT91SAM7X256.h + $PROJ_DIR$\..\..\examples\src\AdcConductor.h + $PROJ_DIR$\..\..\examples\src\TaskScheduler.h + $PROJ_DIR$\..\..\examples\src\UsartConductor.h + $PROJ_DIR$\..\..\examples\src\Model.h + $TOOLKIT_DIR$\inc\intrinsics.h + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.h + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.h + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.h + $PROJ_DIR$\..\..\examples\src\AdcHardware.h + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.h + $PROJ_DIR$\..\..\examples\src\TimerConductor.h + $PROJ_DIR$\..\..\examples\src\UsartPutChar.h + $PROJ_DIR$\..\..\examples\src\UsartModel.h + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.h + $PROJ_DIR$\..\..\examples\src\UsartHardware.h + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.h + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.h + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.h + $PROJ_DIR$\..\..\examples\src\TimerModel.h + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.h + $PROJ_DIR$\..\..\examples\src\TimerHardware.h + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.h + $TOOLKIT_DIR$\inc\DLib_Product.h + $TOOLKIT_DIR$\inc\math.h + $TOOLKIT_DIR$\inc\stdio.h + $TOOLKIT_DIR$\inc\ymath.h + $TOOLKIT_DIR$\inc\ysizet.h + $TOOLKIT_DIR$\lib\dl4tptinl8n.h + $PROJ_DIR$\..\test\system\src\UsartPutChar.h + $PROJ_DIR$\..\test\system\src\AdcTemperatureSensor.h + $PROJ_DIR$\Simulate\Obj\cmock_demo.pbd + $PROJ_DIR$\..\test\system\src\TaskScheduler.h + $PROJ_DIR$\..\test\system\src\UsartTransmitBufferStatus.h + $PROJ_DIR$\..\test\system\src\UsartConfigurator.h + $PROJ_DIR$\..\test\system\src\TimerConfigurator.h + $PROJ_DIR$\..\test\system\src\AT91SAM7X256.h + $PROJ_DIR$\..\test\system\src\UsartBaudRateRegisterCalculator.h + $PROJ_DIR$\..\test\system\src\Executor.h + $PROJ_DIR$\..\test\system\src\ModelConfig.h + $PROJ_DIR$\..\test\system\src\TimerModel.h + $PROJ_DIR$\..\test\system\src\TimerInterruptHandler.h + $PROJ_DIR$\..\test\system\src\Main.c + $PROJ_DIR$\..\test\system\src\Model.c + $PROJ_DIR$\..\test\system\src\AdcHardwareConfigurator.c + $PROJ_DIR$\..\test\system\src\TimerModel.c + $PROJ_DIR$\..\test\system\src\UsartModel.c + $PROJ_DIR$\..\test\system\src\UsartHardware.c + $PROJ_DIR$\..\test\system\src\UsartTransmitBufferStatus.c + $PROJ_DIR$\..\test\system\src\UsartPutChar.c + $PROJ_DIR$\..\test\system\src\TimerInterruptConfigurator.c + $PROJ_DIR$\..\test\system\src\UsartBaudRateRegisterCalculator.c + $PROJ_DIR$\..\test\system\src\TaskScheduler.c + $PROJ_DIR$\..\test\system\src\AdcConductor.h + $PROJ_DIR$\..\test\system\src\TimerInterruptConfigurator.h + $PROJ_DIR$\..\test\system\src\Model.h + $PROJ_DIR$\..\test\system\src\TemperatureFilter.h + $PROJ_DIR$\..\test\system\src\AdcModel.c + $PROJ_DIR$\..\test\system\src\TimerHardware.h + $PROJ_DIR$\..\test\system\src\AdcTemperatureSensor.c + $PROJ_DIR$\..\test\system\src\AdcConductor.c + $PROJ_DIR$\..\test\system\src\AdcHardware.c + $PROJ_DIR$\..\test\system\src\AdcHardware.h + $PROJ_DIR$\..\test\system\src\Executor.c + $TOOLKIT_DIR$\inc\xencoding_limits.h + $TOOLKIT_DIR$\lib\dl4tptinl8n.r79 + $PROJ_DIR$\..\test\system\src\TemperatureCalculator.c + $PROJ_DIR$\..\test\system\src\Types.h + $PROJ_DIR$\..\test\system\src\TemperatureFilter.c + $PROJ_DIR$\..\test\system\src\TimerConductor.c + $PROJ_DIR$\..\test\system\src\TimerConfigurator.c + $PROJ_DIR$\..\test\system\src\TimerHardware.c + $PROJ_DIR$\..\test\system\src\TimerInterruptHandler.c + $PROJ_DIR$\..\test\system\src\UsartConductor.c + $PROJ_DIR$\..\test\system\src\UsartConfigurator.c + $PROJ_DIR$\..\test\system\src\UsartHardware.h + $PROJ_DIR$\..\test\system\src\TimerConductor.h + $PROJ_DIR$\..\test\system\src\AdcModel.h + $PROJ_DIR$\..\test\system\src\AdcHardwareConfigurator.h + $PROJ_DIR$\..\test\system\src\UsartConductor.h + $PROJ_DIR$\..\test\system\src\UsartModel.h + $PROJ_DIR$\Simulate\Obj\AdcConductor.r79 + $PROJ_DIR$\Simulate\Obj\Cstartup_SAM7.pbi + $PROJ_DIR$\Simulate\Obj\UsartHardware.r79 + $TOOLKIT_DIR$\inc\yvals.h + $PROJ_DIR$\incIAR\AT91SAM7X256_inc.h + $PROJ_DIR$\Simulate\List\TimerModel.lst + $PROJ_DIR$\Simulate\Obj\Executor.r79 + $PROJ_DIR$\Simulate\Obj\TimerHardware.pbi + $PROJ_DIR$\Simulate\Obj\UsartModel.pbi + $PROJ_DIR$\Simulate\Obj\IntrinsicsWrapper.r79 + $PROJ_DIR$\Simulate\Obj\TimerConductor.pbi + $PROJ_DIR$\Simulate\List\UsartConductor.lst + $PROJ_DIR$\Simulate\Obj\Main.pbi + $TOOLKIT_DIR$\inc\DLib_Threads.h + $PROJ_DIR$\Simulate\Obj\AdcHardwareConfigurator.pbi + $PROJ_DIR$\Simulate\Obj\TimerConfigurator.pbi + $PROJ_DIR$\Simulate\Exe\cmock_demo.sim + $PROJ_DIR$\Simulate\Obj\UsartTransmitBufferStatus.pbi + $PROJ_DIR$\Simulate\Obj\AdcHardware.r79 + $PROJ_DIR$\Simulate\Obj\Main.r79 + $PROJ_DIR$\Simulate\Obj\AdcTemperatureSensor.pbi + $PROJ_DIR$\Simulate\Obj\UsartPutChar.r79 + $PROJ_DIR$\Simulate\Obj\AdcHardwareConfigurator.r79 + $PROJ_DIR$\Simulate\Obj\UsartConductor.r79 + $PROJ_DIR$\Simulate\Obj\TimerHardware.r79 + $PROJ_DIR$\Simulate\Obj\TemperatureFilter.r79 + $PROJ_DIR$\Simulate\Obj\TemperatureCalculator.pbi + $PROJ_DIR$\Simulate\Obj\TimerInterruptConfigurator.r79 + $PROJ_DIR$\Simulate\Obj\UsartTransmitBufferStatus.r79 + $PROJ_DIR$\Simulate\Obj\TimerConductor.r79 + $PROJ_DIR$\Simulate\Obj\Executor.pbi + $PROJ_DIR$\Simulate\Obj\UsartConductor.pbi + $PROJ_DIR$\Simulate\Obj\TimerModel.pbi + $PROJ_DIR$\Simulate\Obj\AdcModel.pbi + $PROJ_DIR$\Simulate\List\TaskScheduler.lst + $PROJ_DIR$\Simulate\Obj\TimerModel.r79 + $PROJ_DIR$\Simulate\Obj\TemperatureFilter.pbi + $PROJ_DIR$\Simulate\Obj\UsartBaudRateRegisterCalculator.pbi + $PROJ_DIR$\Simulate\Obj\UsartHardware.pbi + $PROJ_DIR$\Simulate\Obj\TaskScheduler.pbi + $PROJ_DIR$\Simulate\Obj\AdcConductor.pbi + $PROJ_DIR$\Simulate\Obj\TimerConfigurator.r79 + $PROJ_DIR$\Simulate\Obj\Cstartup.r79 + $PROJ_DIR$\Simulate\Obj\TimerInterruptHandler.pbi + $PROJ_DIR$\Simulate\Obj\AdcModel.r79 + $PROJ_DIR$\Simulate\Obj\IntrinsicsWrapper.pbi + $PROJ_DIR$\Simulate\List\cmock_demo.map + $PROJ_DIR$\Simulate\Obj\TimerInterruptConfigurator.pbi + $PROJ_DIR$\Simulate\Exe\cmock_demo.d79 + $PROJ_DIR$\Simulate\Obj\TaskScheduler.r79 + $PROJ_DIR$\Simulate\Obj\Model.r79 + $PROJ_DIR$\Simulate\Obj\UsartConfigurator.pbi + $PROJ_DIR$\Simulate\Obj\UsartModel.r79 + $PROJ_DIR$\Simulate\Obj\Cstartup_SAM7.r79 + $PROJ_DIR$\Simulate\Obj\TemperatureCalculator.r79 + $PROJ_DIR$\Simulate\Obj\UsartPutChar.pbi + $PROJ_DIR$\Simulate\Obj\UsartConfigurator.r79 + $PROJ_DIR$\Simulate\Obj\AdcHardware.pbi + $PROJ_DIR$\Simulate\Obj\AdcTemperatureSensor.r79 + $PROJ_DIR$\Simulate\Obj\Model.pbi + $PROJ_DIR$\Simulate\Obj\UsartBaudRateRegisterCalculator.r79 + $PROJ_DIR$\Simulate\List\UsartBaudRateRegisterCalculator.lst + $PROJ_DIR$\Simulate\List\UsartTransmitBufferStatus.lst + $PROJ_DIR$\Simulate\List\AdcHardware.lst + $PROJ_DIR$\Simulate\List\TimerInterruptConfigurator.lst + $PROJ_DIR$\Simulate\List\Model.lst + $PROJ_DIR$\Simulate\Obj\TimerInterruptHandler.r79 + $PROJ_DIR$\Simulate\List\UsartPutChar.lst + $PROJ_DIR$\Simulate\List\UsartHardware.lst + $PROJ_DIR$\Simulate\List\Executor.lst + $PROJ_DIR$\Simulate\List\TimerConfigurator.lst + $PROJ_DIR$\Simulate\List\AdcTemperatureSensor.lst + $PROJ_DIR$\Simulate\List\Cstartup_SAM7.lst + $PROJ_DIR$\Simulate\List\AdcHardwareConfigurator.lst + $PROJ_DIR$\Simulate\List\AdcModel.lst + $PROJ_DIR$\Simulate\List\TemperatureFilter.lst + $PROJ_DIR$\Simulate\List\AdcConductor.lst + $PROJ_DIR$\Simulate\List\UsartConfigurator.lst + $PROJ_DIR$\Simulate\List\IntrinsicsWrapper.lst + $PROJ_DIR$\Simulate\List\TimerHardware.lst + $PROJ_DIR$\Simulate\List\TemperatureCalculator.lst + $PROJ_DIR$\Simulate\List\TimerInterruptHandler.lst + $PROJ_DIR$\Simulate\List\UsartModel.lst + $PROJ_DIR$\Simulate\List\Main.lst + $PROJ_DIR$\Simulate\List\TimerConductor.lst + $PROJ_DIR$\Resource\at91SAM7X256_FLASH.xcl + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + $PROJ_DIR$\..\..\examples\src\TimerModel.c + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + $PROJ_DIR$\..\..\examples\src\UsartModel.c + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + $PROJ_DIR$\Cstartup.s79 + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + $PROJ_DIR$\Cstartup_SAM7.c + $PROJ_DIR$\..\..\examples\src\AdcModel.c + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + $PROJ_DIR$\..\..\examples\src\Executor.c + $PROJ_DIR$\..\..\examples\src\Main.c + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + $PROJ_DIR$\..\..\examples\src\Model.c + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + $PROJ_DIR$\..\..\examples\src\Executor.h + $PROJ_DIR$\..\..\examples\src\AdcModel.h + $PROJ_DIR$\..\..\examples\src\ModelConfig.h + $PROJ_DIR$\srcIAR\Cstartup.s79 + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + + + [ROOT_NODE] + + + XLINK + 133 131 101 + + + + + $PROJ_DIR$\Simulate\Obj\cmock_demo.pbd + + + BILINK + 125 142 99 118 105 86 115 130 97 144 124 111 121 95 100 92 132 128 117 122 116 136 123 93 140 102 + + + + + $PROJ_DIR$\..\test\system\src\Main.c + + + ICCARM + 104 + + + BICOMP + 97 + + + + + ICCARM + 71 40 42 59 36 0 60 83 79 38 33 84 41 37 80 62 39 58 45 44 57 66 82 34 81 + + + BICOMP + 71 40 42 59 36 0 60 83 79 38 33 84 41 37 80 62 39 58 45 44 57 66 82 34 81 + + + + + $PROJ_DIR$\..\test\system\src\Model.c + + + ICCARM + 135 + + + BICOMP + 144 + + + + + ICCARM + 59 71 40 36 60 + + + BICOMP + 59 71 40 36 60 + + + + + $PROJ_DIR$\..\test\system\src\AdcHardwareConfigurator.c + + + ICCARM + 107 + + + BICOMP + 99 + + + + + ICCARM + 71 40 82 43 + + + BICOMP + 71 40 82 43 + + + + + $PROJ_DIR$\..\test\system\src\TimerModel.c + + + ICCARM + 120 + + + BICOMP + 117 + + + + + ICCARM + 71 40 44 36 + + + BICOMP + 71 40 44 36 + + + + + $PROJ_DIR$\..\test\system\src\UsartModel.c + + + ICCARM + 137 + + + BICOMP + 93 + + + + + ICCARM + 71 40 84 43 41 60 29 88 3 32 27 68 98 31 28 30 + + + BICOMP + 71 40 84 43 41 60 29 88 3 27 68 98 31 28 30 + + + + + $PROJ_DIR$\..\test\system\src\UsartHardware.c + + + ICCARM + 87 + + + BICOMP + 123 + + + + + ICCARM + 71 40 79 38 33 + + + BICOMP + 71 40 79 38 33 + + + + + $PROJ_DIR$\..\test\system\src\UsartTransmitBufferStatus.c + + + ICCARM + 113 + + + BICOMP + 102 + + + + + ICCARM + 71 40 37 + + + BICOMP + 71 40 37 + + + + + $PROJ_DIR$\..\test\system\src\UsartPutChar.c + + + ICCARM + 106 + + + BICOMP + 140 + + + + + ICCARM + 71 40 33 37 29 88 3 32 27 68 98 31 + + + BICOMP + 71 40 33 37 29 88 3 27 68 98 31 + + + + + $PROJ_DIR$\..\test\system\src\TimerInterruptConfigurator.c + + + ICCARM + 112 + + + BICOMP + 132 + + + + + ICCARM + 71 40 58 45 + + + BICOMP + 71 40 58 45 + + + + + $PROJ_DIR$\..\test\system\src\UsartBaudRateRegisterCalculator.c + + + ICCARM + 145 + + + BICOMP + 122 + + + + + ICCARM + 71 40 41 + + + BICOMP + 71 40 41 + + + + + $PROJ_DIR$\..\test\system\src\TaskScheduler.c + + + ICCARM + 134 + + + BICOMP + 124 + + + + + ICCARM + 71 40 36 + + + BICOMP + 71 40 36 + + + + + $PROJ_DIR$\..\test\system\src\AdcModel.c + + + ICCARM + 129 + + + BICOMP + 118 + + + + + ICCARM + 71 40 81 36 0 60 + + + BICOMP + 71 40 81 36 0 60 + + + + + $PROJ_DIR$\..\test\system\src\AdcTemperatureSensor.c + + + ICCARM + 143 + + + BICOMP + 105 + + + + + ICCARM + 71 40 34 + + + BICOMP + 71 40 34 + + + + + $PROJ_DIR$\..\test\system\src\AdcConductor.c + + + ICCARM + 85 + + + BICOMP + 125 + + + + + ICCARM + 71 40 57 81 66 + + + BICOMP + 71 40 57 81 66 + + + + + $PROJ_DIR$\..\test\system\src\AdcHardware.c + + + ICCARM + 103 + + + BICOMP + 142 + + + + + ICCARM + 71 40 66 82 34 + + + BICOMP + 71 40 66 82 34 + + + + + $PROJ_DIR$\..\test\system\src\Executor.c + + + ICCARM + 91 + + + BICOMP + 115 + + + + + ICCARM + 71 40 42 59 83 80 57 + + + BICOMP + 71 40 42 59 83 80 57 + + + + + $PROJ_DIR$\..\test\system\src\TemperatureCalculator.c + + + ICCARM + 139 + + + BICOMP + 111 + + + + + ICCARM + 71 40 0 28 30 88 3 32 27 68 98 + + + BICOMP + 71 40 0 28 30 88 3 27 68 98 + + + + + $PROJ_DIR$\..\test\system\src\TemperatureFilter.c + + + ICCARM + 110 + + + BICOMP + 121 + + + + + ICCARM + 71 40 60 28 30 88 3 32 27 68 98 + + + BICOMP + 71 40 60 28 30 88 3 27 68 98 + + + + + $PROJ_DIR$\..\test\system\src\TimerConductor.c + + + ICCARM + 114 + + + BICOMP + 95 + + + + + ICCARM + 71 40 80 44 62 45 + + + BICOMP + 71 40 80 44 62 45 + + + + + $PROJ_DIR$\..\test\system\src\TimerConfigurator.c + + + ICCARM + 126 + + + BICOMP + 100 + + + + + ICCARM + 71 40 39 58 + + + BICOMP + 71 40 39 58 + + + + + $PROJ_DIR$\..\test\system\src\TimerHardware.c + + + ICCARM + 109 + + + BICOMP + 92 + + + + + ICCARM + 71 40 62 39 + + + BICOMP + 71 40 62 39 + + + + + $PROJ_DIR$\..\test\system\src\TimerInterruptHandler.c + + + ICCARM + 151 + + + BICOMP + 128 + + + + + ICCARM + 71 40 45 58 + + + BICOMP + 71 40 45 58 + + + + + $PROJ_DIR$\..\test\system\src\UsartConductor.c + + + ICCARM + 108 + + + BICOMP + 116 + + + + + ICCARM + 71 40 83 79 84 36 + + + BICOMP + 71 40 83 79 84 36 + + + + + $PROJ_DIR$\..\test\system\src\UsartConfigurator.c + + + ICCARM + 141 + + + BICOMP + 136 + + + + + ICCARM + 71 40 38 + + + BICOMP + 71 40 38 + + + + + $PROJ_DIR$\Simulate\Exe\cmock_demo.d79 + + + XLINK + 131 101 + + + + + XLINK + 170 85 103 107 129 143 127 138 91 94 104 135 134 139 110 114 126 109 112 151 120 145 108 141 87 137 106 113 69 + + + + + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + + + ICCARM + 114 169 + + + BICOMP + 95 + + + + + ICCARM + 1 4 15 23 25 22 + + + BICOMP + 1 4 15 23 25 22 + + + + + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + + + ICCARM + 126 155 + + + BICOMP + 100 + + + + + ICCARM + 1 4 24 21 + + + BICOMP + 1 4 24 21 + + + + + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + + + ICCARM + 109 164 + + + BICOMP + 92 + + + + + ICCARM + 1 4 25 24 + + + BICOMP + 1 4 25 24 + + + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + + + ICCARM + 112 149 + + + BICOMP + 132 + + + + + ICCARM + 1 4 21 22 + + + BICOMP + 1 4 21 22 + + + + + $PROJ_DIR$\..\..\examples\src\TimerModel.c + + + ICCARM + 120 90 + + + BICOMP + 117 + + + + + ICCARM + 1 4 23 6 + + + BICOMP + 1 4 23 6 + + + + + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + + + ICCARM + 145 146 + + + BICOMP + 122 + + + + + ICCARM + 1 4 26 + + + BICOMP + 1 4 26 + + + + + $PROJ_DIR$\..\..\examples\src\UsartModel.c + + + ICCARM + 137 167 + + + BICOMP + 93 + + + + + ICCARM + 1 4 17 200 26 14 29 88 3 32 27 68 98 31 28 30 + + + BICOMP + 1 4 17 200 26 14 29 88 3 27 68 98 31 28 30 + + + + + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + + + ICCARM + 108 96 + + + BICOMP + 116 + + + + + ICCARM + 1 4 7 19 17 6 + + + BICOMP + 1 4 7 19 17 6 + + + + + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + + + ICCARM + 141 162 + + + BICOMP + 136 + + + + + ICCARM + 1 4 12 + + + BICOMP + 1 4 12 + + + + + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + + + ICCARM + 87 153 + + + BICOMP + 123 + + + + + ICCARM + 1 4 19 12 16 + + + BICOMP + 1 4 19 12 16 + + + + + $PROJ_DIR$\Cstartup.s79 + + + AARM + 127 + + + + + AARM + 89 + + + + + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + + + ICCARM + 106 152 + + + BICOMP + 140 + + + + + ICCARM + 1 4 16 20 29 88 3 32 27 68 98 31 + + + BICOMP + 1 4 16 20 29 88 3 27 68 98 31 + + + + + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + + + ICCARM + 113 147 + + + BICOMP + 102 + + + + + ICCARM + 1 4 20 + + + BICOMP + 1 4 20 + + + + + $PROJ_DIR$\Cstartup_SAM7.c + + + ICCARM + 138 157 + + + BICOMP + 86 + + + + + ICCARM + 4 + + + BICOMP + 4 + + + + + $PROJ_DIR$\..\..\examples\src\AdcModel.c + + + ICCARM + 129 159 + + + BICOMP + 118 + + + + + ICCARM + 1 4 199 6 10 14 + + + BICOMP + 1 4 199 6 10 14 + + + + + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + + + ICCARM + 143 156 + + + BICOMP + 105 + + + + + ICCARM + 1 4 11 + + + BICOMP + 1 4 11 + + + + + $PROJ_DIR$\..\..\examples\src\Executor.c + + + ICCARM + 91 154 + + + BICOMP + 115 + + + + + ICCARM + 1 4 198 8 7 15 5 18 + + + BICOMP + 1 4 198 8 7 15 5 18 + + + + + $PROJ_DIR$\..\..\examples\src\Main.c + + + ICCARM + 104 168 + + + BICOMP + 97 + + + + + ICCARM + 1 4 18 198 8 6 10 14 7 19 12 16 17 26 20 15 25 24 21 22 23 5 13 2 11 199 + + + BICOMP + 1 4 18 198 8 6 10 14 7 19 12 16 17 26 20 15 25 24 21 22 23 5 13 2 11 199 + + + + + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + + + ICCARM + 94 163 + + + BICOMP + 130 + + + + + ICCARM + 18 9 + + + BICOMP + 18 9 + + + + + $PROJ_DIR$\..\..\examples\src\Model.c + + + ICCARM + 135 150 + + + BICOMP + 144 + + + + + ICCARM + 8 1 4 6 14 + + + BICOMP + 8 1 4 6 14 + + + + + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + + + ICCARM + 139 165 + + + BICOMP + 111 + + + + + ICCARM + 1 4 10 28 30 88 3 32 27 68 98 + + + BICOMP + 1 4 10 28 30 88 3 27 68 98 + + + + + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + + + ICCARM + 134 119 + + + BICOMP + 124 + + + + + ICCARM + 1 4 6 + + + BICOMP + 1 4 6 + + + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + + + ICCARM + 151 166 + + + BICOMP + 128 + + + + + ICCARM + 1 4 22 21 + + + BICOMP + 1 4 22 21 + + + + + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + + + ICCARM + 110 160 + + + BICOMP + 121 + + + + + ICCARM + 1 4 14 28 30 88 3 32 27 68 98 + + + BICOMP + 1 4 14 28 30 88 3 27 68 98 + + + + + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + + + ICCARM + 107 158 + + + BICOMP + 99 + + + + + ICCARM + 1 4 2 200 + + + BICOMP + 1 4 2 200 + + + + + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + + + ICCARM + 85 161 + + + BICOMP + 125 + + + + + ICCARM + 1 4 5 199 13 + + + BICOMP + 1 4 5 199 13 + + + + + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + + + ICCARM + 103 148 + + + BICOMP + 142 + + + + + ICCARM + 1 4 13 2 11 + + + BICOMP + 1 4 13 2 11 + + + + + $PROJ_DIR$\srcIAR\Cstartup.s79 + + + AARM + 127 + + + + + AARM + 89 + + + + + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + + + ICCARM + 138 157 + + + BICOMP + 86 + + + + + ICCARM + 4 + + + BICOMP + 4 + + + + + + + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/cmock_demo.ewd b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/cmock_demo.ewd new file mode 100644 index 0000000..37a724d --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/cmock_demo.ewd @@ -0,0 +1,1696 @@ + + + + 1 + + Debug + + ARM + + 1 + + C-SPY + 2 + + 13 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 0 + 1 + 1 + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + JLINK_ID + 2 + + 6 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + MACRAIGOR_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ewplugin + 1 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CMXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CMXTinyArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + + + Simulate + + ARM + + 1 + + C-SPY + 2 + + 13 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 0 + 1 + 1 + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + JLINK_ID + 2 + + 6 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + MACRAIGOR_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ewplugin + 1 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CMXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CMXTinyArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + + + Release + + ARM + + 0 + + C-SPY + 2 + + 13 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 0 + 1 + 0 + + + + + ANGEL_ID + 2 + + 0 + 1 + 0 + + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 0 + + + + + + + + + + JLINK_ID + 2 + + 6 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 0 + 1 + 0 + + + + + + + + + + + + MACRAIGOR_ID + 2 + + 2 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 0 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 0 + + + + + + + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ewplugin + 1 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CMXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CMXTinyArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + + + + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/cmock_demo.ewp b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/cmock_demo.ewp new file mode 100644 index 0000000..ec55fbe --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/cmock_demo.ewp @@ -0,0 +1,2581 @@ + + + + 1 + + Debug + + ARM + + 1 + + General + 2 + + 9 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 14 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + XLINK + 2 + + 18 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + XAR + 2 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + Simulate + + ARM + + 1 + + General + 2 + + 9 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 14 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + XLINK + 2 + + 18 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + XAR + 2 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + Release + + ARM + + 0 + + General + 2 + + 9 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 14 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + XLINK + 2 + + 18 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + XAR + 2 + + 0 + 1 + 0 + + + + + + + BILINK + 0 + + + + + Resource + + $PROJ_DIR$\Resource\at91SAM7X256_FLASH.xcl + + + $PROJ_DIR$\Resource\at91SAM7X256_RAM.xcl + + + $PROJ_DIR$\Resource\SAM7_FLASH.mac + + + $PROJ_DIR$\Resource\SAM7_RAM.mac + + + $PROJ_DIR$\Resource\SAM7_SIM.mac + + + + Source + + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + + + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + + + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + + + $PROJ_DIR$\..\..\examples\src\AdcModel.c + + + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + + + $PROJ_DIR$\..\..\examples\src\Executor.c + + + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + + + $PROJ_DIR$\..\..\examples\src\Main.c + + + $PROJ_DIR$\..\..\examples\src\Model.c + + + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + + + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + + + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + + + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + + + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + + + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + + + $PROJ_DIR$\..\..\examples\src\TimerModel.c + + + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + + + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + + + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + + + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + + + $PROJ_DIR$\..\..\examples\src\UsartModel.c + + + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + + + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + + + + Startup + + $PROJ_DIR$\srcIAR\Cstartup.s79 + + + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + + + + + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/cmock_demo.eww b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/cmock_demo.eww new file mode 100644 index 0000000..5f78f6e --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/cmock_demo.eww @@ -0,0 +1,10 @@ + + + + + $WS_DIR$\cmock_demo.ewp + + + + + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X-EK.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X-EK.h new file mode 100644 index 0000000..9834675 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X-EK.h @@ -0,0 +1,61 @@ +// ---------------------------------------------------------------------------- +// ATMEL Microcontroller Software Support - ROUSSET - +// ---------------------------------------------------------------------------- +// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// ---------------------------------------------------------------------------- +// File Name : AT91SAM7X-EK.h +// Object : AT91SAM7X-EK Evaluation Board Features Definition File +// +// ---------------------------------------------------------------------------- + +#ifndef AT91SAM7X_EK_H +#define AT91SAM7X_EK_H + +/*-----------------*/ +/* LEDs Definition */ +/*-----------------*/ +#define AT91B_LED1 (1<<19) // AT91C_PIO_PB19 AT91C_PB19_PWM0 AT91C_PB19_TCLK1 +#define AT91B_LED2 (1<<20) // AT91C_PIO_PB20 AT91C_PB20_PWM1 AT91C_PB20_PWM1 +#define AT91B_LED3 (AT91C_PIO_PB21) // AT91C_PIO_PB21 AT91C_PB21_PWM2 AT91C_PB21_PCK1 +#define AT91B_LED4 (AT91C_PIO_PB22) // AT91C_PIO_PB22 AT91C_PB22_PWM3 AT91C_PB22_PCK2 +#define AT91B_NB_LEB 4 +#define AT91B_LED_MASK (AT91B_LED1|AT91B_LED2|AT91B_LED3|AT91B_LED4) +#define AT91D_BASE_PIO_LED (AT91C_BASE_PIOB) + +#define AT91B_POWERLED (1<<25) // PB25 + + +/*-------------------------------*/ +/* JOYSTICK Position Definition */ +/*-------------------------------*/ +#define AT91B_SW1 (1<<21) // PA21 Up Button AT91C_PA21_TF AT91C_PA21_NPCS10 +#define AT91B_SW2 (1<<22) // PA22 Down Button AT91C_PA22_TK AT91C_PA22_SPCK1 +#define AT91B_SW3 (1<<23) // PA23 Left Button AT91C_PA23_TD AT91C_PA23_MOSI1 +#define AT91B_SW4 (1<<24) // PA24 Right Button AT91C_PA24_RD AT91C_PA24_MISO1 +#define AT91B_SW5 (1<<25) // PA25 Push Button AT91C_PA25_RK AT91C_PA25_NPCS11 +#define AT91B_SW_MASK (AT91B_SW1|AT91B_SW2|AT91B_SW3|AT91B_SW4|AT91B_SW5) + + +#define AT91D_BASE_PIO_SW (AT91C_BASE_PIOA) + +/*------------------*/ +/* CAN Definition */ +/*------------------*/ +#define AT91B_CAN_TRANSCEIVER_RS (1<<2) // PA2 + +/*--------------*/ +/* Clocks */ +/*--------------*/ +#define AT91B_MAIN_OSC 18432000 // Main Oscillator MAINCK +#define AT91B_MCK ((18432000*73/14)/2) // Output PLL Clock + +#endif /* AT91SAM7X-EK_H */ diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.inc b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.inc new file mode 100644 index 0000000..da33985 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.inc @@ -0,0 +1,2314 @@ +;- ---------------------------------------------------------------------------- +;- ATMEL Microcontroller Software Support - ROUSSET - +;- ---------------------------------------------------------------------------- +;- DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +;- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +;- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +;- DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +;- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +;- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +;- OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +;- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +;- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +;- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +;- ---------------------------------------------------------------------------- +;- File Name : AT91SAM7X256.h +;- Object : AT91SAM7X256 definitions +;- Generated : AT91 SW Application Group 11/02/2005 (15:17:24) +;- +;- CVS Reference : /AT91SAM7X256.pl/1.14/Tue Sep 13 15:06:52 2005// +;- CVS Reference : /SYS_SAM7X.pl/1.3/Tue Feb 1 17:01:43 2005// +;- CVS Reference : /MC_SAM7X.pl/1.2/Fri May 20 14:13:04 2005// +;- CVS Reference : /PMC_SAM7X.pl/1.4/Tue Feb 8 13:58:10 2005// +;- CVS Reference : /RSTC_SAM7X.pl/1.2/Wed Jul 13 14:57:50 2005// +;- CVS Reference : /UDP_SAM7X.pl/1.1/Tue May 10 11:35:35 2005// +;- CVS Reference : /PWM_SAM7X.pl/1.1/Tue May 10 11:53:07 2005// +;- CVS Reference : /AIC_6075B.pl/1.3/Fri May 20 14:01:30 2005// +;- CVS Reference : /PIO_6057A.pl/1.2/Thu Feb 3 10:18:28 2005// +;- CVS Reference : /RTTC_6081A.pl/1.2/Tue Nov 9 14:43:58 2004// +;- CVS Reference : /PITC_6079A.pl/1.2/Tue Nov 9 14:43:56 2004// +;- CVS Reference : /WDTC_6080A.pl/1.3/Tue Nov 9 14:44:00 2004// +;- CVS Reference : /VREG_6085B.pl/1.1/Tue Feb 1 16:05:48 2005// +;- CVS Reference : /PDC_6074C.pl/1.2/Thu Feb 3 08:48:54 2005// +;- CVS Reference : /DBGU_6059D.pl/1.1/Mon Jan 31 13:15:32 2005// +;- CVS Reference : /SPI_6088D.pl/1.3/Fri May 20 14:08:59 2005// +;- CVS Reference : /US_6089C.pl/1.1/Mon Jul 12 18:23:26 2004// +;- CVS Reference : /SSC_6078B.pl/1.1/Wed Jul 13 15:19:19 2005// +;- CVS Reference : /TWI_6061A.pl/1.1/Tue Jul 13 07:38:06 2004// +;- CVS Reference : /TC_6082A.pl/1.7/Fri Mar 11 12:52:17 2005// +;- CVS Reference : /CAN_6019B.pl/1.1/Tue Mar 8 12:42:22 2005// +;- CVS Reference : /EMACB_6119A.pl/1.6/Wed Jul 13 15:05:35 2005// +;- CVS Reference : /ADC_6051C.pl/1.1/Fri Oct 17 09:12:38 2003// +;- ---------------------------------------------------------------------------- + +;- Hardware register definition + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR System Peripherals +;- ***************************************************************************** + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Advanced Interrupt Controller +;- ***************************************************************************** + ^ 0 ;- AT91S_AIC +AIC_SMR # 128 ;- Source Mode Register +AIC_SVR # 128 ;- Source Vector Register +AIC_IVR # 4 ;- IRQ Vector Register +AIC_FVR # 4 ;- FIQ Vector Register +AIC_ISR # 4 ;- Interrupt Status Register +AIC_IPR # 4 ;- Interrupt Pending Register +AIC_IMR # 4 ;- Interrupt Mask Register +AIC_CISR # 4 ;- Core Interrupt Status Register + # 8 ;- Reserved +AIC_IECR # 4 ;- Interrupt Enable Command Register +AIC_IDCR # 4 ;- Interrupt Disable Command Register +AIC_ICCR # 4 ;- Interrupt Clear Command Register +AIC_ISCR # 4 ;- Interrupt Set Command Register +AIC_EOICR # 4 ;- End of Interrupt Command Register +AIC_SPU # 4 ;- Spurious Vector Register +AIC_DCR # 4 ;- Debug Control Register (Protect) + # 4 ;- Reserved +AIC_FFER # 4 ;- Fast Forcing Enable Register +AIC_FFDR # 4 ;- Fast Forcing Disable Register +AIC_FFSR # 4 ;- Fast Forcing Status Register +;- -------- AIC_SMR : (AIC Offset: 0x0) Control Register -------- +AT91C_AIC_PRIOR EQU (0x7:SHL:0) ;- (AIC) Priority Level +AT91C_AIC_PRIOR_LOWEST EQU (0x0) ;- (AIC) Lowest priority level +AT91C_AIC_PRIOR_HIGHEST EQU (0x7) ;- (AIC) Highest priority level +AT91C_AIC_SRCTYPE EQU (0x3:SHL:5) ;- (AIC) Interrupt Source Type +AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL EQU (0x0:SHL:5) ;- (AIC) Internal Sources Code Label High-level Sensitive +AT91C_AIC_SRCTYPE_EXT_LOW_LEVEL EQU (0x0:SHL:5) ;- (AIC) External Sources Code Label Low-level Sensitive +AT91C_AIC_SRCTYPE_INT_POSITIVE_EDGE EQU (0x1:SHL:5) ;- (AIC) Internal Sources Code Label Positive Edge triggered +AT91C_AIC_SRCTYPE_EXT_NEGATIVE_EDGE EQU (0x1:SHL:5) ;- (AIC) External Sources Code Label Negative Edge triggered +AT91C_AIC_SRCTYPE_HIGH_LEVEL EQU (0x2:SHL:5) ;- (AIC) Internal Or External Sources Code Label High-level Sensitive +AT91C_AIC_SRCTYPE_POSITIVE_EDGE EQU (0x3:SHL:5) ;- (AIC) Internal Or External Sources Code Label Positive Edge triggered +;- -------- AIC_CISR : (AIC Offset: 0x114) AIC Core Interrupt Status Register -------- +AT91C_AIC_NFIQ EQU (0x1:SHL:0) ;- (AIC) NFIQ Status +AT91C_AIC_NIRQ EQU (0x1:SHL:1) ;- (AIC) NIRQ Status +;- -------- AIC_DCR : (AIC Offset: 0x138) AIC Debug Control Register (Protect) -------- +AT91C_AIC_DCR_PROT EQU (0x1:SHL:0) ;- (AIC) Protection Mode +AT91C_AIC_DCR_GMSK EQU (0x1:SHL:1) ;- (AIC) General Mask + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Peripheral DMA Controller +;- ***************************************************************************** + ^ 0 ;- AT91S_PDC +PDC_RPR # 4 ;- Receive Pointer Register +PDC_RCR # 4 ;- Receive Counter Register +PDC_TPR # 4 ;- Transmit Pointer Register +PDC_TCR # 4 ;- Transmit Counter Register +PDC_RNPR # 4 ;- Receive Next Pointer Register +PDC_RNCR # 4 ;- Receive Next Counter Register +PDC_TNPR # 4 ;- Transmit Next Pointer Register +PDC_TNCR # 4 ;- Transmit Next Counter Register +PDC_PTCR # 4 ;- PDC Transfer Control Register +PDC_PTSR # 4 ;- PDC Transfer Status Register +;- -------- PDC_PTCR : (PDC Offset: 0x20) PDC Transfer Control Register -------- +AT91C_PDC_RXTEN EQU (0x1:SHL:0) ;- (PDC) Receiver Transfer Enable +AT91C_PDC_RXTDIS EQU (0x1:SHL:1) ;- (PDC) Receiver Transfer Disable +AT91C_PDC_TXTEN EQU (0x1:SHL:8) ;- (PDC) Transmitter Transfer Enable +AT91C_PDC_TXTDIS EQU (0x1:SHL:9) ;- (PDC) Transmitter Transfer Disable +;- -------- PDC_PTSR : (PDC Offset: 0x24) PDC Transfer Status Register -------- + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Debug Unit +;- ***************************************************************************** + ^ 0 ;- AT91S_DBGU +DBGU_CR # 4 ;- Control Register +DBGU_MR # 4 ;- Mode Register +DBGU_IER # 4 ;- Interrupt Enable Register +DBGU_IDR # 4 ;- Interrupt Disable Register +DBGU_IMR # 4 ;- Interrupt Mask Register +DBGU_CSR # 4 ;- Channel Status Register +DBGU_RHR # 4 ;- Receiver Holding Register +DBGU_THR # 4 ;- Transmitter Holding Register +DBGU_BRGR # 4 ;- Baud Rate Generator Register + # 28 ;- Reserved +DBGU_CIDR # 4 ;- Chip ID Register +DBGU_EXID # 4 ;- Chip ID Extension Register +DBGU_FNTR # 4 ;- Force NTRST Register + # 180 ;- Reserved +DBGU_RPR # 4 ;- Receive Pointer Register +DBGU_RCR # 4 ;- Receive Counter Register +DBGU_TPR # 4 ;- Transmit Pointer Register +DBGU_TCR # 4 ;- Transmit Counter Register +DBGU_RNPR # 4 ;- Receive Next Pointer Register +DBGU_RNCR # 4 ;- Receive Next Counter Register +DBGU_TNPR # 4 ;- Transmit Next Pointer Register +DBGU_TNCR # 4 ;- Transmit Next Counter Register +DBGU_PTCR # 4 ;- PDC Transfer Control Register +DBGU_PTSR # 4 ;- PDC Transfer Status Register +;- -------- DBGU_CR : (DBGU Offset: 0x0) Debug Unit Control Register -------- +AT91C_US_RSTRX EQU (0x1:SHL:2) ;- (DBGU) Reset Receiver +AT91C_US_RSTTX EQU (0x1:SHL:3) ;- (DBGU) Reset Transmitter +AT91C_US_RXEN EQU (0x1:SHL:4) ;- (DBGU) Receiver Enable +AT91C_US_RXDIS EQU (0x1:SHL:5) ;- (DBGU) Receiver Disable +AT91C_US_TXEN EQU (0x1:SHL:6) ;- (DBGU) Transmitter Enable +AT91C_US_TXDIS EQU (0x1:SHL:7) ;- (DBGU) Transmitter Disable +AT91C_US_RSTSTA EQU (0x1:SHL:8) ;- (DBGU) Reset Status Bits +;- -------- DBGU_MR : (DBGU Offset: 0x4) Debug Unit Mode Register -------- +AT91C_US_PAR EQU (0x7:SHL:9) ;- (DBGU) Parity type +AT91C_US_PAR_EVEN EQU (0x0:SHL:9) ;- (DBGU) Even Parity +AT91C_US_PAR_ODD EQU (0x1:SHL:9) ;- (DBGU) Odd Parity +AT91C_US_PAR_SPACE EQU (0x2:SHL:9) ;- (DBGU) Parity forced to 0 (Space) +AT91C_US_PAR_MARK EQU (0x3:SHL:9) ;- (DBGU) Parity forced to 1 (Mark) +AT91C_US_PAR_NONE EQU (0x4:SHL:9) ;- (DBGU) No Parity +AT91C_US_PAR_MULTI_DROP EQU (0x6:SHL:9) ;- (DBGU) Multi-drop mode +AT91C_US_CHMODE EQU (0x3:SHL:14) ;- (DBGU) Channel Mode +AT91C_US_CHMODE_NORMAL EQU (0x0:SHL:14) ;- (DBGU) Normal Mode: The USART channel operates as an RX/TX USART. +AT91C_US_CHMODE_AUTO EQU (0x1:SHL:14) ;- (DBGU) Automatic Echo: Receiver Data Input is connected to the TXD pin. +AT91C_US_CHMODE_LOCAL EQU (0x2:SHL:14) ;- (DBGU) Local Loopback: Transmitter Output Signal is connected to Receiver Input Signal. +AT91C_US_CHMODE_REMOTE EQU (0x3:SHL:14) ;- (DBGU) Remote Loopback: RXD pin is internally connected to TXD pin. +;- -------- DBGU_IER : (DBGU Offset: 0x8) Debug Unit Interrupt Enable Register -------- +AT91C_US_RXRDY EQU (0x1:SHL:0) ;- (DBGU) RXRDY Interrupt +AT91C_US_TXRDY EQU (0x1:SHL:1) ;- (DBGU) TXRDY Interrupt +AT91C_US_ENDRX EQU (0x1:SHL:3) ;- (DBGU) End of Receive Transfer Interrupt +AT91C_US_ENDTX EQU (0x1:SHL:4) ;- (DBGU) End of Transmit Interrupt +AT91C_US_OVRE EQU (0x1:SHL:5) ;- (DBGU) Overrun Interrupt +AT91C_US_FRAME EQU (0x1:SHL:6) ;- (DBGU) Framing Error Interrupt +AT91C_US_PARE EQU (0x1:SHL:7) ;- (DBGU) Parity Error Interrupt +AT91C_US_TXEMPTY EQU (0x1:SHL:9) ;- (DBGU) TXEMPTY Interrupt +AT91C_US_TXBUFE EQU (0x1:SHL:11) ;- (DBGU) TXBUFE Interrupt +AT91C_US_RXBUFF EQU (0x1:SHL:12) ;- (DBGU) RXBUFF Interrupt +AT91C_US_COMM_TX EQU (0x1:SHL:30) ;- (DBGU) COMM_TX Interrupt +AT91C_US_COMM_RX EQU (0x1:SHL:31) ;- (DBGU) COMM_RX Interrupt +;- -------- DBGU_IDR : (DBGU Offset: 0xc) Debug Unit Interrupt Disable Register -------- +;- -------- DBGU_IMR : (DBGU Offset: 0x10) Debug Unit Interrupt Mask Register -------- +;- -------- DBGU_CSR : (DBGU Offset: 0x14) Debug Unit Channel Status Register -------- +;- -------- DBGU_FNTR : (DBGU Offset: 0x48) Debug Unit FORCE_NTRST Register -------- +AT91C_US_FORCE_NTRST EQU (0x1:SHL:0) ;- (DBGU) Force NTRST in JTAG + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Parallel Input Output Controler +;- ***************************************************************************** + ^ 0 ;- AT91S_PIO +PIO_PER # 4 ;- PIO Enable Register +PIO_PDR # 4 ;- PIO Disable Register +PIO_PSR # 4 ;- PIO Status Register + # 4 ;- Reserved +PIO_OER # 4 ;- Output Enable Register +PIO_ODR # 4 ;- Output Disable Registerr +PIO_OSR # 4 ;- Output Status Register + # 4 ;- Reserved +PIO_IFER # 4 ;- Input Filter Enable Register +PIO_IFDR # 4 ;- Input Filter Disable Register +PIO_IFSR # 4 ;- Input Filter Status Register + # 4 ;- Reserved +PIO_SODR # 4 ;- Set Output Data Register +PIO_CODR # 4 ;- Clear Output Data Register +PIO_ODSR # 4 ;- Output Data Status Register +PIO_PDSR # 4 ;- Pin Data Status Register +PIO_IER # 4 ;- Interrupt Enable Register +PIO_IDR # 4 ;- Interrupt Disable Register +PIO_IMR # 4 ;- Interrupt Mask Register +PIO_ISR # 4 ;- Interrupt Status Register +PIO_MDER # 4 ;- Multi-driver Enable Register +PIO_MDDR # 4 ;- Multi-driver Disable Register +PIO_MDSR # 4 ;- Multi-driver Status Register + # 4 ;- Reserved +PIO_PPUDR # 4 ;- Pull-up Disable Register +PIO_PPUER # 4 ;- Pull-up Enable Register +PIO_PPUSR # 4 ;- Pull-up Status Register + # 4 ;- Reserved +PIO_ASR # 4 ;- Select A Register +PIO_BSR # 4 ;- Select B Register +PIO_ABSR # 4 ;- AB Select Status Register + # 36 ;- Reserved +PIO_OWER # 4 ;- Output Write Enable Register +PIO_OWDR # 4 ;- Output Write Disable Register +PIO_OWSR # 4 ;- Output Write Status Register + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Clock Generator Controler +;- ***************************************************************************** + ^ 0 ;- AT91S_CKGR +CKGR_MOR # 4 ;- Main Oscillator Register +CKGR_MCFR # 4 ;- Main Clock Frequency Register + # 4 ;- Reserved +CKGR_PLLR # 4 ;- PLL Register +;- -------- CKGR_MOR : (CKGR Offset: 0x0) Main Oscillator Register -------- +AT91C_CKGR_MOSCEN EQU (0x1:SHL:0) ;- (CKGR) Main Oscillator Enable +AT91C_CKGR_OSCBYPASS EQU (0x1:SHL:1) ;- (CKGR) Main Oscillator Bypass +AT91C_CKGR_OSCOUNT EQU (0xFF:SHL:8) ;- (CKGR) Main Oscillator Start-up Time +;- -------- CKGR_MCFR : (CKGR Offset: 0x4) Main Clock Frequency Register -------- +AT91C_CKGR_MAINF EQU (0xFFFF:SHL:0) ;- (CKGR) Main Clock Frequency +AT91C_CKGR_MAINRDY EQU (0x1:SHL:16) ;- (CKGR) Main Clock Ready +;- -------- CKGR_PLLR : (CKGR Offset: 0xc) PLL B Register -------- +AT91C_CKGR_DIV EQU (0xFF:SHL:0) ;- (CKGR) Divider Selected +AT91C_CKGR_DIV_0 EQU (0x0) ;- (CKGR) Divider output is 0 +AT91C_CKGR_DIV_BYPASS EQU (0x1) ;- (CKGR) Divider is bypassed +AT91C_CKGR_PLLCOUNT EQU (0x3F:SHL:8) ;- (CKGR) PLL Counter +AT91C_CKGR_OUT EQU (0x3:SHL:14) ;- (CKGR) PLL Output Frequency Range +AT91C_CKGR_OUT_0 EQU (0x0:SHL:14) ;- (CKGR) Please refer to the PLL datasheet +AT91C_CKGR_OUT_1 EQU (0x1:SHL:14) ;- (CKGR) Please refer to the PLL datasheet +AT91C_CKGR_OUT_2 EQU (0x2:SHL:14) ;- (CKGR) Please refer to the PLL datasheet +AT91C_CKGR_OUT_3 EQU (0x3:SHL:14) ;- (CKGR) Please refer to the PLL datasheet +AT91C_CKGR_MUL EQU (0x7FF:SHL:16) ;- (CKGR) PLL Multiplier +AT91C_CKGR_USBDIV EQU (0x3:SHL:28) ;- (CKGR) Divider for USB Clocks +AT91C_CKGR_USBDIV_0 EQU (0x0:SHL:28) ;- (CKGR) Divider output is PLL clock output +AT91C_CKGR_USBDIV_1 EQU (0x1:SHL:28) ;- (CKGR) Divider output is PLL clock output divided by 2 +AT91C_CKGR_USBDIV_2 EQU (0x2:SHL:28) ;- (CKGR) Divider output is PLL clock output divided by 4 + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Power Management Controler +;- ***************************************************************************** + ^ 0 ;- AT91S_PMC +PMC_SCER # 4 ;- System Clock Enable Register +PMC_SCDR # 4 ;- System Clock Disable Register +PMC_SCSR # 4 ;- System Clock Status Register + # 4 ;- Reserved +PMC_PCER # 4 ;- Peripheral Clock Enable Register +PMC_PCDR # 4 ;- Peripheral Clock Disable Register +PMC_PCSR # 4 ;- Peripheral Clock Status Register + # 4 ;- Reserved +PMC_MOR # 4 ;- Main Oscillator Register +PMC_MCFR # 4 ;- Main Clock Frequency Register + # 4 ;- Reserved +PMC_PLLR # 4 ;- PLL Register +PMC_MCKR # 4 ;- Master Clock Register + # 12 ;- Reserved +PMC_PCKR # 16 ;- Programmable Clock Register + # 16 ;- Reserved +PMC_IER # 4 ;- Interrupt Enable Register +PMC_IDR # 4 ;- Interrupt Disable Register +PMC_SR # 4 ;- Status Register +PMC_IMR # 4 ;- Interrupt Mask Register +;- -------- PMC_SCER : (PMC Offset: 0x0) System Clock Enable Register -------- +AT91C_PMC_PCK EQU (0x1:SHL:0) ;- (PMC) Processor Clock +AT91C_PMC_UDP EQU (0x1:SHL:7) ;- (PMC) USB Device Port Clock +AT91C_PMC_PCK0 EQU (0x1:SHL:8) ;- (PMC) Programmable Clock Output +AT91C_PMC_PCK1 EQU (0x1:SHL:9) ;- (PMC) Programmable Clock Output +AT91C_PMC_PCK2 EQU (0x1:SHL:10) ;- (PMC) Programmable Clock Output +AT91C_PMC_PCK3 EQU (0x1:SHL:11) ;- (PMC) Programmable Clock Output +;- -------- PMC_SCDR : (PMC Offset: 0x4) System Clock Disable Register -------- +;- -------- PMC_SCSR : (PMC Offset: 0x8) System Clock Status Register -------- +;- -------- CKGR_MOR : (PMC Offset: 0x20) Main Oscillator Register -------- +;- -------- CKGR_MCFR : (PMC Offset: 0x24) Main Clock Frequency Register -------- +;- -------- CKGR_PLLR : (PMC Offset: 0x2c) PLL B Register -------- +;- -------- PMC_MCKR : (PMC Offset: 0x30) Master Clock Register -------- +AT91C_PMC_CSS EQU (0x3:SHL:0) ;- (PMC) Programmable Clock Selection +AT91C_PMC_CSS_SLOW_CLK EQU (0x0) ;- (PMC) Slow Clock is selected +AT91C_PMC_CSS_MAIN_CLK EQU (0x1) ;- (PMC) Main Clock is selected +AT91C_PMC_CSS_PLL_CLK EQU (0x3) ;- (PMC) Clock from PLL is selected +AT91C_PMC_PRES EQU (0x7:SHL:2) ;- (PMC) Programmable Clock Prescaler +AT91C_PMC_PRES_CLK EQU (0x0:SHL:2) ;- (PMC) Selected clock +AT91C_PMC_PRES_CLK_2 EQU (0x1:SHL:2) ;- (PMC) Selected clock divided by 2 +AT91C_PMC_PRES_CLK_4 EQU (0x2:SHL:2) ;- (PMC) Selected clock divided by 4 +AT91C_PMC_PRES_CLK_8 EQU (0x3:SHL:2) ;- (PMC) Selected clock divided by 8 +AT91C_PMC_PRES_CLK_16 EQU (0x4:SHL:2) ;- (PMC) Selected clock divided by 16 +AT91C_PMC_PRES_CLK_32 EQU (0x5:SHL:2) ;- (PMC) Selected clock divided by 32 +AT91C_PMC_PRES_CLK_64 EQU (0x6:SHL:2) ;- (PMC) Selected clock divided by 64 +;- -------- PMC_PCKR : (PMC Offset: 0x40) Programmable Clock Register -------- +;- -------- PMC_IER : (PMC Offset: 0x60) PMC Interrupt Enable Register -------- +AT91C_PMC_MOSCS EQU (0x1:SHL:0) ;- (PMC) MOSC Status/Enable/Disable/Mask +AT91C_PMC_LOCK EQU (0x1:SHL:2) ;- (PMC) PLL Status/Enable/Disable/Mask +AT91C_PMC_MCKRDY EQU (0x1:SHL:3) ;- (PMC) MCK_RDY Status/Enable/Disable/Mask +AT91C_PMC_PCK0RDY EQU (0x1:SHL:8) ;- (PMC) PCK0_RDY Status/Enable/Disable/Mask +AT91C_PMC_PCK1RDY EQU (0x1:SHL:9) ;- (PMC) PCK1_RDY Status/Enable/Disable/Mask +AT91C_PMC_PCK2RDY EQU (0x1:SHL:10) ;- (PMC) PCK2_RDY Status/Enable/Disable/Mask +AT91C_PMC_PCK3RDY EQU (0x1:SHL:11) ;- (PMC) PCK3_RDY Status/Enable/Disable/Mask +;- -------- PMC_IDR : (PMC Offset: 0x64) PMC Interrupt Disable Register -------- +;- -------- PMC_SR : (PMC Offset: 0x68) PMC Status Register -------- +;- -------- PMC_IMR : (PMC Offset: 0x6c) PMC Interrupt Mask Register -------- + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Reset Controller Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_RSTC +RSTC_RCR # 4 ;- Reset Control Register +RSTC_RSR # 4 ;- Reset Status Register +RSTC_RMR # 4 ;- Reset Mode Register +;- -------- RSTC_RCR : (RSTC Offset: 0x0) Reset Control Register -------- +AT91C_RSTC_PROCRST EQU (0x1:SHL:0) ;- (RSTC) Processor Reset +AT91C_RSTC_PERRST EQU (0x1:SHL:2) ;- (RSTC) Peripheral Reset +AT91C_RSTC_EXTRST EQU (0x1:SHL:3) ;- (RSTC) External Reset +AT91C_RSTC_KEY EQU (0xFF:SHL:24) ;- (RSTC) Password +;- -------- RSTC_RSR : (RSTC Offset: 0x4) Reset Status Register -------- +AT91C_RSTC_URSTS EQU (0x1:SHL:0) ;- (RSTC) User Reset Status +AT91C_RSTC_BODSTS EQU (0x1:SHL:1) ;- (RSTC) Brownout Detection Status +AT91C_RSTC_RSTTYP EQU (0x7:SHL:8) ;- (RSTC) Reset Type +AT91C_RSTC_RSTTYP_POWERUP EQU (0x0:SHL:8) ;- (RSTC) Power-up Reset. VDDCORE rising. +AT91C_RSTC_RSTTYP_WAKEUP EQU (0x1:SHL:8) ;- (RSTC) WakeUp Reset. VDDCORE rising. +AT91C_RSTC_RSTTYP_WATCHDOG EQU (0x2:SHL:8) ;- (RSTC) Watchdog Reset. Watchdog overflow occured. +AT91C_RSTC_RSTTYP_SOFTWARE EQU (0x3:SHL:8) ;- (RSTC) Software Reset. Processor reset required by the software. +AT91C_RSTC_RSTTYP_USER EQU (0x4:SHL:8) ;- (RSTC) User Reset. NRST pin detected low. +AT91C_RSTC_RSTTYP_BROWNOUT EQU (0x5:SHL:8) ;- (RSTC) Brownout Reset occured. +AT91C_RSTC_NRSTL EQU (0x1:SHL:16) ;- (RSTC) NRST pin level +AT91C_RSTC_SRCMP EQU (0x1:SHL:17) ;- (RSTC) Software Reset Command in Progress. +;- -------- RSTC_RMR : (RSTC Offset: 0x8) Reset Mode Register -------- +AT91C_RSTC_URSTEN EQU (0x1:SHL:0) ;- (RSTC) User Reset Enable +AT91C_RSTC_URSTIEN EQU (0x1:SHL:4) ;- (RSTC) User Reset Interrupt Enable +AT91C_RSTC_ERSTL EQU (0xF:SHL:8) ;- (RSTC) User Reset Length +AT91C_RSTC_BODIEN EQU (0x1:SHL:16) ;- (RSTC) Brownout Detection Interrupt Enable + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Real Time Timer Controller Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_RTTC +RTTC_RTMR # 4 ;- Real-time Mode Register +RTTC_RTAR # 4 ;- Real-time Alarm Register +RTTC_RTVR # 4 ;- Real-time Value Register +RTTC_RTSR # 4 ;- Real-time Status Register +;- -------- RTTC_RTMR : (RTTC Offset: 0x0) Real-time Mode Register -------- +AT91C_RTTC_RTPRES EQU (0xFFFF:SHL:0) ;- (RTTC) Real-time Timer Prescaler Value +AT91C_RTTC_ALMIEN EQU (0x1:SHL:16) ;- (RTTC) Alarm Interrupt Enable +AT91C_RTTC_RTTINCIEN EQU (0x1:SHL:17) ;- (RTTC) Real Time Timer Increment Interrupt Enable +AT91C_RTTC_RTTRST EQU (0x1:SHL:18) ;- (RTTC) Real Time Timer Restart +;- -------- RTTC_RTAR : (RTTC Offset: 0x4) Real-time Alarm Register -------- +AT91C_RTTC_ALMV EQU (0x0:SHL:0) ;- (RTTC) Alarm Value +;- -------- RTTC_RTVR : (RTTC Offset: 0x8) Current Real-time Value Register -------- +AT91C_RTTC_CRTV EQU (0x0:SHL:0) ;- (RTTC) Current Real-time Value +;- -------- RTTC_RTSR : (RTTC Offset: 0xc) Real-time Status Register -------- +AT91C_RTTC_ALMS EQU (0x1:SHL:0) ;- (RTTC) Real-time Alarm Status +AT91C_RTTC_RTTINC EQU (0x1:SHL:1) ;- (RTTC) Real-time Timer Increment + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Periodic Interval Timer Controller Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_PITC +PITC_PIMR # 4 ;- Period Interval Mode Register +PITC_PISR # 4 ;- Period Interval Status Register +PITC_PIVR # 4 ;- Period Interval Value Register +PITC_PIIR # 4 ;- Period Interval Image Register +;- -------- PITC_PIMR : (PITC Offset: 0x0) Periodic Interval Mode Register -------- +AT91C_PITC_PIV EQU (0xFFFFF:SHL:0) ;- (PITC) Periodic Interval Value +AT91C_PITC_PITEN EQU (0x1:SHL:24) ;- (PITC) Periodic Interval Timer Enabled +AT91C_PITC_PITIEN EQU (0x1:SHL:25) ;- (PITC) Periodic Interval Timer Interrupt Enable +;- -------- PITC_PISR : (PITC Offset: 0x4) Periodic Interval Status Register -------- +AT91C_PITC_PITS EQU (0x1:SHL:0) ;- (PITC) Periodic Interval Timer Status +;- -------- PITC_PIVR : (PITC Offset: 0x8) Periodic Interval Value Register -------- +AT91C_PITC_CPIV EQU (0xFFFFF:SHL:0) ;- (PITC) Current Periodic Interval Value +AT91C_PITC_PICNT EQU (0xFFF:SHL:20) ;- (PITC) Periodic Interval Counter +;- -------- PITC_PIIR : (PITC Offset: 0xc) Periodic Interval Image Register -------- + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Watchdog Timer Controller Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_WDTC +WDTC_WDCR # 4 ;- Watchdog Control Register +WDTC_WDMR # 4 ;- Watchdog Mode Register +WDTC_WDSR # 4 ;- Watchdog Status Register +;- -------- WDTC_WDCR : (WDTC Offset: 0x0) Periodic Interval Image Register -------- +AT91C_WDTC_WDRSTT EQU (0x1:SHL:0) ;- (WDTC) Watchdog Restart +AT91C_WDTC_KEY EQU (0xFF:SHL:24) ;- (WDTC) Watchdog KEY Password +;- -------- WDTC_WDMR : (WDTC Offset: 0x4) Watchdog Mode Register -------- +AT91C_WDTC_WDV EQU (0xFFF:SHL:0) ;- (WDTC) Watchdog Timer Restart +AT91C_WDTC_WDFIEN EQU (0x1:SHL:12) ;- (WDTC) Watchdog Fault Interrupt Enable +AT91C_WDTC_WDRSTEN EQU (0x1:SHL:13) ;- (WDTC) Watchdog Reset Enable +AT91C_WDTC_WDRPROC EQU (0x1:SHL:14) ;- (WDTC) Watchdog Timer Restart +AT91C_WDTC_WDDIS EQU (0x1:SHL:15) ;- (WDTC) Watchdog Disable +AT91C_WDTC_WDD EQU (0xFFF:SHL:16) ;- (WDTC) Watchdog Delta Value +AT91C_WDTC_WDDBGHLT EQU (0x1:SHL:28) ;- (WDTC) Watchdog Debug Halt +AT91C_WDTC_WDIDLEHLT EQU (0x1:SHL:29) ;- (WDTC) Watchdog Idle Halt +;- -------- WDTC_WDSR : (WDTC Offset: 0x8) Watchdog Status Register -------- +AT91C_WDTC_WDUNF EQU (0x1:SHL:0) ;- (WDTC) Watchdog Underflow +AT91C_WDTC_WDERR EQU (0x1:SHL:1) ;- (WDTC) Watchdog Error + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Voltage Regulator Mode Controller Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_VREG +VREG_MR # 4 ;- Voltage Regulator Mode Register +;- -------- VREG_MR : (VREG Offset: 0x0) Voltage Regulator Mode Register -------- +AT91C_VREG_PSTDBY EQU (0x1:SHL:0) ;- (VREG) Voltage Regulator Power Standby Mode + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Memory Controller Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_MC +MC_RCR # 4 ;- MC Remap Control Register +MC_ASR # 4 ;- MC Abort Status Register +MC_AASR # 4 ;- MC Abort Address Status Register + # 84 ;- Reserved +MC_FMR # 4 ;- MC Flash Mode Register +MC_FCR # 4 ;- MC Flash Command Register +MC_FSR # 4 ;- MC Flash Status Register +;- -------- MC_RCR : (MC Offset: 0x0) MC Remap Control Register -------- +AT91C_MC_RCB EQU (0x1:SHL:0) ;- (MC) Remap Command Bit +;- -------- MC_ASR : (MC Offset: 0x4) MC Abort Status Register -------- +AT91C_MC_UNDADD EQU (0x1:SHL:0) ;- (MC) Undefined Addess Abort Status +AT91C_MC_MISADD EQU (0x1:SHL:1) ;- (MC) Misaligned Addess Abort Status +AT91C_MC_ABTSZ EQU (0x3:SHL:8) ;- (MC) Abort Size Status +AT91C_MC_ABTSZ_BYTE EQU (0x0:SHL:8) ;- (MC) Byte +AT91C_MC_ABTSZ_HWORD EQU (0x1:SHL:8) ;- (MC) Half-word +AT91C_MC_ABTSZ_WORD EQU (0x2:SHL:8) ;- (MC) Word +AT91C_MC_ABTTYP EQU (0x3:SHL:10) ;- (MC) Abort Type Status +AT91C_MC_ABTTYP_DATAR EQU (0x0:SHL:10) ;- (MC) Data Read +AT91C_MC_ABTTYP_DATAW EQU (0x1:SHL:10) ;- (MC) Data Write +AT91C_MC_ABTTYP_FETCH EQU (0x2:SHL:10) ;- (MC) Code Fetch +AT91C_MC_MST0 EQU (0x1:SHL:16) ;- (MC) Master 0 Abort Source +AT91C_MC_MST1 EQU (0x1:SHL:17) ;- (MC) Master 1 Abort Source +AT91C_MC_SVMST0 EQU (0x1:SHL:24) ;- (MC) Saved Master 0 Abort Source +AT91C_MC_SVMST1 EQU (0x1:SHL:25) ;- (MC) Saved Master 1 Abort Source +;- -------- MC_FMR : (MC Offset: 0x60) MC Flash Mode Register -------- +AT91C_MC_FRDY EQU (0x1:SHL:0) ;- (MC) Flash Ready +AT91C_MC_LOCKE EQU (0x1:SHL:2) ;- (MC) Lock Error +AT91C_MC_PROGE EQU (0x1:SHL:3) ;- (MC) Programming Error +AT91C_MC_NEBP EQU (0x1:SHL:7) ;- (MC) No Erase Before Programming +AT91C_MC_FWS EQU (0x3:SHL:8) ;- (MC) Flash Wait State +AT91C_MC_FWS_0FWS EQU (0x0:SHL:8) ;- (MC) 1 cycle for Read, 2 for Write operations +AT91C_MC_FWS_1FWS EQU (0x1:SHL:8) ;- (MC) 2 cycles for Read, 3 for Write operations +AT91C_MC_FWS_2FWS EQU (0x2:SHL:8) ;- (MC) 3 cycles for Read, 4 for Write operations +AT91C_MC_FWS_3FWS EQU (0x3:SHL:8) ;- (MC) 4 cycles for Read, 4 for Write operations +AT91C_MC_FMCN EQU (0xFF:SHL:16) ;- (MC) Flash Microsecond Cycle Number +;- -------- MC_FCR : (MC Offset: 0x64) MC Flash Command Register -------- +AT91C_MC_FCMD EQU (0xF:SHL:0) ;- (MC) Flash Command +AT91C_MC_FCMD_START_PROG EQU (0x1) ;- (MC) Starts the programming of th epage specified by PAGEN. +AT91C_MC_FCMD_LOCK EQU (0x2) ;- (MC) Starts a lock sequence of the sector defined by the bits 4 to 7 of the field PAGEN. +AT91C_MC_FCMD_PROG_AND_LOCK EQU (0x3) ;- (MC) The lock sequence automatically happens after the programming sequence is completed. +AT91C_MC_FCMD_UNLOCK EQU (0x4) ;- (MC) Starts an unlock sequence of the sector defined by the bits 4 to 7 of the field PAGEN. +AT91C_MC_FCMD_ERASE_ALL EQU (0x8) ;- (MC) Starts the erase of the entire flash.If at least a page is locked, the command is cancelled. +AT91C_MC_FCMD_SET_GP_NVM EQU (0xB) ;- (MC) Set General Purpose NVM bits. +AT91C_MC_FCMD_CLR_GP_NVM EQU (0xD) ;- (MC) Clear General Purpose NVM bits. +AT91C_MC_FCMD_SET_SECURITY EQU (0xF) ;- (MC) Set Security Bit. +AT91C_MC_PAGEN EQU (0x3FF:SHL:8) ;- (MC) Page Number +AT91C_MC_KEY EQU (0xFF:SHL:24) ;- (MC) Writing Protect Key +;- -------- MC_FSR : (MC Offset: 0x68) MC Flash Command Register -------- +AT91C_MC_SECURITY EQU (0x1:SHL:4) ;- (MC) Security Bit Status +AT91C_MC_GPNVM0 EQU (0x1:SHL:8) ;- (MC) Sector 0 Lock Status +AT91C_MC_GPNVM1 EQU (0x1:SHL:9) ;- (MC) Sector 1 Lock Status +AT91C_MC_GPNVM2 EQU (0x1:SHL:10) ;- (MC) Sector 2 Lock Status +AT91C_MC_GPNVM3 EQU (0x1:SHL:11) ;- (MC) Sector 3 Lock Status +AT91C_MC_GPNVM4 EQU (0x1:SHL:12) ;- (MC) Sector 4 Lock Status +AT91C_MC_GPNVM5 EQU (0x1:SHL:13) ;- (MC) Sector 5 Lock Status +AT91C_MC_GPNVM6 EQU (0x1:SHL:14) ;- (MC) Sector 6 Lock Status +AT91C_MC_GPNVM7 EQU (0x1:SHL:15) ;- (MC) Sector 7 Lock Status +AT91C_MC_LOCKS0 EQU (0x1:SHL:16) ;- (MC) Sector 0 Lock Status +AT91C_MC_LOCKS1 EQU (0x1:SHL:17) ;- (MC) Sector 1 Lock Status +AT91C_MC_LOCKS2 EQU (0x1:SHL:18) ;- (MC) Sector 2 Lock Status +AT91C_MC_LOCKS3 EQU (0x1:SHL:19) ;- (MC) Sector 3 Lock Status +AT91C_MC_LOCKS4 EQU (0x1:SHL:20) ;- (MC) Sector 4 Lock Status +AT91C_MC_LOCKS5 EQU (0x1:SHL:21) ;- (MC) Sector 5 Lock Status +AT91C_MC_LOCKS6 EQU (0x1:SHL:22) ;- (MC) Sector 6 Lock Status +AT91C_MC_LOCKS7 EQU (0x1:SHL:23) ;- (MC) Sector 7 Lock Status +AT91C_MC_LOCKS8 EQU (0x1:SHL:24) ;- (MC) Sector 8 Lock Status +AT91C_MC_LOCKS9 EQU (0x1:SHL:25) ;- (MC) Sector 9 Lock Status +AT91C_MC_LOCKS10 EQU (0x1:SHL:26) ;- (MC) Sector 10 Lock Status +AT91C_MC_LOCKS11 EQU (0x1:SHL:27) ;- (MC) Sector 11 Lock Status +AT91C_MC_LOCKS12 EQU (0x1:SHL:28) ;- (MC) Sector 12 Lock Status +AT91C_MC_LOCKS13 EQU (0x1:SHL:29) ;- (MC) Sector 13 Lock Status +AT91C_MC_LOCKS14 EQU (0x1:SHL:30) ;- (MC) Sector 14 Lock Status +AT91C_MC_LOCKS15 EQU (0x1:SHL:31) ;- (MC) Sector 15 Lock Status + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Serial Parallel Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_SPI +SPI_CR # 4 ;- Control Register +SPI_MR # 4 ;- Mode Register +SPI_RDR # 4 ;- Receive Data Register +SPI_TDR # 4 ;- Transmit Data Register +SPI_SR # 4 ;- Status Register +SPI_IER # 4 ;- Interrupt Enable Register +SPI_IDR # 4 ;- Interrupt Disable Register +SPI_IMR # 4 ;- Interrupt Mask Register + # 16 ;- Reserved +SPI_CSR # 16 ;- Chip Select Register + # 192 ;- Reserved +SPI_RPR # 4 ;- Receive Pointer Register +SPI_RCR # 4 ;- Receive Counter Register +SPI_TPR # 4 ;- Transmit Pointer Register +SPI_TCR # 4 ;- Transmit Counter Register +SPI_RNPR # 4 ;- Receive Next Pointer Register +SPI_RNCR # 4 ;- Receive Next Counter Register +SPI_TNPR # 4 ;- Transmit Next Pointer Register +SPI_TNCR # 4 ;- Transmit Next Counter Register +SPI_PTCR # 4 ;- PDC Transfer Control Register +SPI_PTSR # 4 ;- PDC Transfer Status Register +;- -------- SPI_CR : (SPI Offset: 0x0) SPI Control Register -------- +AT91C_SPI_SPIEN EQU (0x1:SHL:0) ;- (SPI) SPI Enable +AT91C_SPI_SPIDIS EQU (0x1:SHL:1) ;- (SPI) SPI Disable +AT91C_SPI_SWRST EQU (0x1:SHL:7) ;- (SPI) SPI Software reset +AT91C_SPI_LASTXFER EQU (0x1:SHL:24) ;- (SPI) SPI Last Transfer +;- -------- SPI_MR : (SPI Offset: 0x4) SPI Mode Register -------- +AT91C_SPI_MSTR EQU (0x1:SHL:0) ;- (SPI) Master/Slave Mode +AT91C_SPI_PS EQU (0x1:SHL:1) ;- (SPI) Peripheral Select +AT91C_SPI_PS_FIXED EQU (0x0:SHL:1) ;- (SPI) Fixed Peripheral Select +AT91C_SPI_PS_VARIABLE EQU (0x1:SHL:1) ;- (SPI) Variable Peripheral Select +AT91C_SPI_PCSDEC EQU (0x1:SHL:2) ;- (SPI) Chip Select Decode +AT91C_SPI_FDIV EQU (0x1:SHL:3) ;- (SPI) Clock Selection +AT91C_SPI_MODFDIS EQU (0x1:SHL:4) ;- (SPI) Mode Fault Detection +AT91C_SPI_LLB EQU (0x1:SHL:7) ;- (SPI) Clock Selection +AT91C_SPI_PCS EQU (0xF:SHL:16) ;- (SPI) Peripheral Chip Select +AT91C_SPI_DLYBCS EQU (0xFF:SHL:24) ;- (SPI) Delay Between Chip Selects +;- -------- SPI_RDR : (SPI Offset: 0x8) Receive Data Register -------- +AT91C_SPI_RD EQU (0xFFFF:SHL:0) ;- (SPI) Receive Data +AT91C_SPI_RPCS EQU (0xF:SHL:16) ;- (SPI) Peripheral Chip Select Status +;- -------- SPI_TDR : (SPI Offset: 0xc) Transmit Data Register -------- +AT91C_SPI_TD EQU (0xFFFF:SHL:0) ;- (SPI) Transmit Data +AT91C_SPI_TPCS EQU (0xF:SHL:16) ;- (SPI) Peripheral Chip Select Status +;- -------- SPI_SR : (SPI Offset: 0x10) Status Register -------- +AT91C_SPI_RDRF EQU (0x1:SHL:0) ;- (SPI) Receive Data Register Full +AT91C_SPI_TDRE EQU (0x1:SHL:1) ;- (SPI) Transmit Data Register Empty +AT91C_SPI_MODF EQU (0x1:SHL:2) ;- (SPI) Mode Fault Error +AT91C_SPI_OVRES EQU (0x1:SHL:3) ;- (SPI) Overrun Error Status +AT91C_SPI_ENDRX EQU (0x1:SHL:4) ;- (SPI) End of Receiver Transfer +AT91C_SPI_ENDTX EQU (0x1:SHL:5) ;- (SPI) End of Receiver Transfer +AT91C_SPI_RXBUFF EQU (0x1:SHL:6) ;- (SPI) RXBUFF Interrupt +AT91C_SPI_TXBUFE EQU (0x1:SHL:7) ;- (SPI) TXBUFE Interrupt +AT91C_SPI_NSSR EQU (0x1:SHL:8) ;- (SPI) NSSR Interrupt +AT91C_SPI_TXEMPTY EQU (0x1:SHL:9) ;- (SPI) TXEMPTY Interrupt +AT91C_SPI_SPIENS EQU (0x1:SHL:16) ;- (SPI) Enable Status +;- -------- SPI_IER : (SPI Offset: 0x14) Interrupt Enable Register -------- +;- -------- SPI_IDR : (SPI Offset: 0x18) Interrupt Disable Register -------- +;- -------- SPI_IMR : (SPI Offset: 0x1c) Interrupt Mask Register -------- +;- -------- SPI_CSR : (SPI Offset: 0x30) Chip Select Register -------- +AT91C_SPI_CPOL EQU (0x1:SHL:0) ;- (SPI) Clock Polarity +AT91C_SPI_NCPHA EQU (0x1:SHL:1) ;- (SPI) Clock Phase +AT91C_SPI_CSAAT EQU (0x1:SHL:3) ;- (SPI) Chip Select Active After Transfer +AT91C_SPI_BITS EQU (0xF:SHL:4) ;- (SPI) Bits Per Transfer +AT91C_SPI_BITS_8 EQU (0x0:SHL:4) ;- (SPI) 8 Bits Per transfer +AT91C_SPI_BITS_9 EQU (0x1:SHL:4) ;- (SPI) 9 Bits Per transfer +AT91C_SPI_BITS_10 EQU (0x2:SHL:4) ;- (SPI) 10 Bits Per transfer +AT91C_SPI_BITS_11 EQU (0x3:SHL:4) ;- (SPI) 11 Bits Per transfer +AT91C_SPI_BITS_12 EQU (0x4:SHL:4) ;- (SPI) 12 Bits Per transfer +AT91C_SPI_BITS_13 EQU (0x5:SHL:4) ;- (SPI) 13 Bits Per transfer +AT91C_SPI_BITS_14 EQU (0x6:SHL:4) ;- (SPI) 14 Bits Per transfer +AT91C_SPI_BITS_15 EQU (0x7:SHL:4) ;- (SPI) 15 Bits Per transfer +AT91C_SPI_BITS_16 EQU (0x8:SHL:4) ;- (SPI) 16 Bits Per transfer +AT91C_SPI_SCBR EQU (0xFF:SHL:8) ;- (SPI) Serial Clock Baud Rate +AT91C_SPI_DLYBS EQU (0xFF:SHL:16) ;- (SPI) Delay Before SPCK +AT91C_SPI_DLYBCT EQU (0xFF:SHL:24) ;- (SPI) Delay Between Consecutive Transfers + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Usart +;- ***************************************************************************** + ^ 0 ;- AT91S_USART +US_CR # 4 ;- Control Register +US_MR # 4 ;- Mode Register +US_IER # 4 ;- Interrupt Enable Register +US_IDR # 4 ;- Interrupt Disable Register +US_IMR # 4 ;- Interrupt Mask Register +US_CSR # 4 ;- Channel Status Register +US_RHR # 4 ;- Receiver Holding Register +US_THR # 4 ;- Transmitter Holding Register +US_BRGR # 4 ;- Baud Rate Generator Register +US_RTOR # 4 ;- Receiver Time-out Register +US_TTGR # 4 ;- Transmitter Time-guard Register + # 20 ;- Reserved +US_FIDI # 4 ;- FI_DI_Ratio Register +US_NER # 4 ;- Nb Errors Register + # 4 ;- Reserved +US_IF # 4 ;- IRDA_FILTER Register + # 176 ;- Reserved +US_RPR # 4 ;- Receive Pointer Register +US_RCR # 4 ;- Receive Counter Register +US_TPR # 4 ;- Transmit Pointer Register +US_TCR # 4 ;- Transmit Counter Register +US_RNPR # 4 ;- Receive Next Pointer Register +US_RNCR # 4 ;- Receive Next Counter Register +US_TNPR # 4 ;- Transmit Next Pointer Register +US_TNCR # 4 ;- Transmit Next Counter Register +US_PTCR # 4 ;- PDC Transfer Control Register +US_PTSR # 4 ;- PDC Transfer Status Register +;- -------- US_CR : (USART Offset: 0x0) Debug Unit Control Register -------- +AT91C_US_STTBRK EQU (0x1:SHL:9) ;- (USART) Start Break +AT91C_US_STPBRK EQU (0x1:SHL:10) ;- (USART) Stop Break +AT91C_US_STTTO EQU (0x1:SHL:11) ;- (USART) Start Time-out +AT91C_US_SENDA EQU (0x1:SHL:12) ;- (USART) Send Address +AT91C_US_RSTIT EQU (0x1:SHL:13) ;- (USART) Reset Iterations +AT91C_US_RSTNACK EQU (0x1:SHL:14) ;- (USART) Reset Non Acknowledge +AT91C_US_RETTO EQU (0x1:SHL:15) ;- (USART) Rearm Time-out +AT91C_US_DTREN EQU (0x1:SHL:16) ;- (USART) Data Terminal ready Enable +AT91C_US_DTRDIS EQU (0x1:SHL:17) ;- (USART) Data Terminal ready Disable +AT91C_US_RTSEN EQU (0x1:SHL:18) ;- (USART) Request to Send enable +AT91C_US_RTSDIS EQU (0x1:SHL:19) ;- (USART) Request to Send Disable +;- -------- US_MR : (USART Offset: 0x4) Debug Unit Mode Register -------- +AT91C_US_USMODE EQU (0xF:SHL:0) ;- (USART) Usart mode +AT91C_US_USMODE_NORMAL EQU (0x0) ;- (USART) Normal +AT91C_US_USMODE_RS485 EQU (0x1) ;- (USART) RS485 +AT91C_US_USMODE_HWHSH EQU (0x2) ;- (USART) Hardware Handshaking +AT91C_US_USMODE_MODEM EQU (0x3) ;- (USART) Modem +AT91C_US_USMODE_ISO7816_0 EQU (0x4) ;- (USART) ISO7816 protocol: T = 0 +AT91C_US_USMODE_ISO7816_1 EQU (0x6) ;- (USART) ISO7816 protocol: T = 1 +AT91C_US_USMODE_IRDA EQU (0x8) ;- (USART) IrDA +AT91C_US_USMODE_SWHSH EQU (0xC) ;- (USART) Software Handshaking +AT91C_US_CLKS EQU (0x3:SHL:4) ;- (USART) Clock Selection (Baud Rate generator Input Clock +AT91C_US_CLKS_CLOCK EQU (0x0:SHL:4) ;- (USART) Clock +AT91C_US_CLKS_FDIV1 EQU (0x1:SHL:4) ;- (USART) fdiv1 +AT91C_US_CLKS_SLOW EQU (0x2:SHL:4) ;- (USART) slow_clock (ARM) +AT91C_US_CLKS_EXT EQU (0x3:SHL:4) ;- (USART) External (SCK) +AT91C_US_CHRL EQU (0x3:SHL:6) ;- (USART) Clock Selection (Baud Rate generator Input Clock +AT91C_US_CHRL_5_BITS EQU (0x0:SHL:6) ;- (USART) Character Length: 5 bits +AT91C_US_CHRL_6_BITS EQU (0x1:SHL:6) ;- (USART) Character Length: 6 bits +AT91C_US_CHRL_7_BITS EQU (0x2:SHL:6) ;- (USART) Character Length: 7 bits +AT91C_US_CHRL_8_BITS EQU (0x3:SHL:6) ;- (USART) Character Length: 8 bits +AT91C_US_SYNC EQU (0x1:SHL:8) ;- (USART) Synchronous Mode Select +AT91C_US_NBSTOP EQU (0x3:SHL:12) ;- (USART) Number of Stop bits +AT91C_US_NBSTOP_1_BIT EQU (0x0:SHL:12) ;- (USART) 1 stop bit +AT91C_US_NBSTOP_15_BIT EQU (0x1:SHL:12) ;- (USART) Asynchronous (SYNC=0) 2 stop bits Synchronous (SYNC=1) 2 stop bits +AT91C_US_NBSTOP_2_BIT EQU (0x2:SHL:12) ;- (USART) 2 stop bits +AT91C_US_MSBF EQU (0x1:SHL:16) ;- (USART) Bit Order +AT91C_US_MODE9 EQU (0x1:SHL:17) ;- (USART) 9-bit Character length +AT91C_US_CKLO EQU (0x1:SHL:18) ;- (USART) Clock Output Select +AT91C_US_OVER EQU (0x1:SHL:19) ;- (USART) Over Sampling Mode +AT91C_US_INACK EQU (0x1:SHL:20) ;- (USART) Inhibit Non Acknowledge +AT91C_US_DSNACK EQU (0x1:SHL:21) ;- (USART) Disable Successive NACK +AT91C_US_MAX_ITER EQU (0x1:SHL:24) ;- (USART) Number of Repetitions +AT91C_US_FILTER EQU (0x1:SHL:28) ;- (USART) Receive Line Filter +;- -------- US_IER : (USART Offset: 0x8) Debug Unit Interrupt Enable Register -------- +AT91C_US_RXBRK EQU (0x1:SHL:2) ;- (USART) Break Received/End of Break +AT91C_US_TIMEOUT EQU (0x1:SHL:8) ;- (USART) Receiver Time-out +AT91C_US_ITERATION EQU (0x1:SHL:10) ;- (USART) Max number of Repetitions Reached +AT91C_US_NACK EQU (0x1:SHL:13) ;- (USART) Non Acknowledge +AT91C_US_RIIC EQU (0x1:SHL:16) ;- (USART) Ring INdicator Input Change Flag +AT91C_US_DSRIC EQU (0x1:SHL:17) ;- (USART) Data Set Ready Input Change Flag +AT91C_US_DCDIC EQU (0x1:SHL:18) ;- (USART) Data Carrier Flag +AT91C_US_CTSIC EQU (0x1:SHL:19) ;- (USART) Clear To Send Input Change Flag +;- -------- US_IDR : (USART Offset: 0xc) Debug Unit Interrupt Disable Register -------- +;- -------- US_IMR : (USART Offset: 0x10) Debug Unit Interrupt Mask Register -------- +;- -------- US_CSR : (USART Offset: 0x14) Debug Unit Channel Status Register -------- +AT91C_US_RI EQU (0x1:SHL:20) ;- (USART) Image of RI Input +AT91C_US_DSR EQU (0x1:SHL:21) ;- (USART) Image of DSR Input +AT91C_US_DCD EQU (0x1:SHL:22) ;- (USART) Image of DCD Input +AT91C_US_CTS EQU (0x1:SHL:23) ;- (USART) Image of CTS Input + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Synchronous Serial Controller Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_SSC +SSC_CR # 4 ;- Control Register +SSC_CMR # 4 ;- Clock Mode Register + # 8 ;- Reserved +SSC_RCMR # 4 ;- Receive Clock ModeRegister +SSC_RFMR # 4 ;- Receive Frame Mode Register +SSC_TCMR # 4 ;- Transmit Clock Mode Register +SSC_TFMR # 4 ;- Transmit Frame Mode Register +SSC_RHR # 4 ;- Receive Holding Register +SSC_THR # 4 ;- Transmit Holding Register + # 8 ;- Reserved +SSC_RSHR # 4 ;- Receive Sync Holding Register +SSC_TSHR # 4 ;- Transmit Sync Holding Register + # 8 ;- Reserved +SSC_SR # 4 ;- Status Register +SSC_IER # 4 ;- Interrupt Enable Register +SSC_IDR # 4 ;- Interrupt Disable Register +SSC_IMR # 4 ;- Interrupt Mask Register + # 176 ;- Reserved +SSC_RPR # 4 ;- Receive Pointer Register +SSC_RCR # 4 ;- Receive Counter Register +SSC_TPR # 4 ;- Transmit Pointer Register +SSC_TCR # 4 ;- Transmit Counter Register +SSC_RNPR # 4 ;- Receive Next Pointer Register +SSC_RNCR # 4 ;- Receive Next Counter Register +SSC_TNPR # 4 ;- Transmit Next Pointer Register +SSC_TNCR # 4 ;- Transmit Next Counter Register +SSC_PTCR # 4 ;- PDC Transfer Control Register +SSC_PTSR # 4 ;- PDC Transfer Status Register +;- -------- SSC_CR : (SSC Offset: 0x0) SSC Control Register -------- +AT91C_SSC_RXEN EQU (0x1:SHL:0) ;- (SSC) Receive Enable +AT91C_SSC_RXDIS EQU (0x1:SHL:1) ;- (SSC) Receive Disable +AT91C_SSC_TXEN EQU (0x1:SHL:8) ;- (SSC) Transmit Enable +AT91C_SSC_TXDIS EQU (0x1:SHL:9) ;- (SSC) Transmit Disable +AT91C_SSC_SWRST EQU (0x1:SHL:15) ;- (SSC) Software Reset +;- -------- SSC_RCMR : (SSC Offset: 0x10) SSC Receive Clock Mode Register -------- +AT91C_SSC_CKS EQU (0x3:SHL:0) ;- (SSC) Receive/Transmit Clock Selection +AT91C_SSC_CKS_DIV EQU (0x0) ;- (SSC) Divided Clock +AT91C_SSC_CKS_TK EQU (0x1) ;- (SSC) TK Clock signal +AT91C_SSC_CKS_RK EQU (0x2) ;- (SSC) RK pin +AT91C_SSC_CKO EQU (0x7:SHL:2) ;- (SSC) Receive/Transmit Clock Output Mode Selection +AT91C_SSC_CKO_NONE EQU (0x0:SHL:2) ;- (SSC) Receive/Transmit Clock Output Mode: None RK pin: Input-only +AT91C_SSC_CKO_CONTINOUS EQU (0x1:SHL:2) ;- (SSC) Continuous Receive/Transmit Clock RK pin: Output +AT91C_SSC_CKO_DATA_TX EQU (0x2:SHL:2) ;- (SSC) Receive/Transmit Clock only during data transfers RK pin: Output +AT91C_SSC_CKI EQU (0x1:SHL:5) ;- (SSC) Receive/Transmit Clock Inversion +AT91C_SSC_CKG EQU (0x3:SHL:6) ;- (SSC) Receive/Transmit Clock Gating Selection +AT91C_SSC_CKG_NONE EQU (0x0:SHL:6) ;- (SSC) Receive/Transmit Clock Gating: None, continuous clock +AT91C_SSC_CKG_LOW EQU (0x1:SHL:6) ;- (SSC) Receive/Transmit Clock enabled only if RF Low +AT91C_SSC_CKG_HIGH EQU (0x2:SHL:6) ;- (SSC) Receive/Transmit Clock enabled only if RF High +AT91C_SSC_START EQU (0xF:SHL:8) ;- (SSC) Receive/Transmit Start Selection +AT91C_SSC_START_CONTINOUS EQU (0x0:SHL:8) ;- (SSC) Continuous, as soon as the receiver is enabled, and immediately after the end of transfer of the previous data. +AT91C_SSC_START_TX EQU (0x1:SHL:8) ;- (SSC) Transmit/Receive start +AT91C_SSC_START_LOW_RF EQU (0x2:SHL:8) ;- (SSC) Detection of a low level on RF input +AT91C_SSC_START_HIGH_RF EQU (0x3:SHL:8) ;- (SSC) Detection of a high level on RF input +AT91C_SSC_START_FALL_RF EQU (0x4:SHL:8) ;- (SSC) Detection of a falling edge on RF input +AT91C_SSC_START_RISE_RF EQU (0x5:SHL:8) ;- (SSC) Detection of a rising edge on RF input +AT91C_SSC_START_LEVEL_RF EQU (0x6:SHL:8) ;- (SSC) Detection of any level change on RF input +AT91C_SSC_START_EDGE_RF EQU (0x7:SHL:8) ;- (SSC) Detection of any edge on RF input +AT91C_SSC_START_0 EQU (0x8:SHL:8) ;- (SSC) Compare 0 +AT91C_SSC_STOP EQU (0x1:SHL:12) ;- (SSC) Receive Stop Selection +AT91C_SSC_STTDLY EQU (0xFF:SHL:16) ;- (SSC) Receive/Transmit Start Delay +AT91C_SSC_PERIOD EQU (0xFF:SHL:24) ;- (SSC) Receive/Transmit Period Divider Selection +;- -------- SSC_RFMR : (SSC Offset: 0x14) SSC Receive Frame Mode Register -------- +AT91C_SSC_DATLEN EQU (0x1F:SHL:0) ;- (SSC) Data Length +AT91C_SSC_LOOP EQU (0x1:SHL:5) ;- (SSC) Loop Mode +AT91C_SSC_MSBF EQU (0x1:SHL:7) ;- (SSC) Most Significant Bit First +AT91C_SSC_DATNB EQU (0xF:SHL:8) ;- (SSC) Data Number per Frame +AT91C_SSC_FSLEN EQU (0xF:SHL:16) ;- (SSC) Receive/Transmit Frame Sync length +AT91C_SSC_FSOS EQU (0x7:SHL:20) ;- (SSC) Receive/Transmit Frame Sync Output Selection +AT91C_SSC_FSOS_NONE EQU (0x0:SHL:20) ;- (SSC) Selected Receive/Transmit Frame Sync Signal: None RK pin Input-only +AT91C_SSC_FSOS_NEGATIVE EQU (0x1:SHL:20) ;- (SSC) Selected Receive/Transmit Frame Sync Signal: Negative Pulse +AT91C_SSC_FSOS_POSITIVE EQU (0x2:SHL:20) ;- (SSC) Selected Receive/Transmit Frame Sync Signal: Positive Pulse +AT91C_SSC_FSOS_LOW EQU (0x3:SHL:20) ;- (SSC) Selected Receive/Transmit Frame Sync Signal: Driver Low during data transfer +AT91C_SSC_FSOS_HIGH EQU (0x4:SHL:20) ;- (SSC) Selected Receive/Transmit Frame Sync Signal: Driver High during data transfer +AT91C_SSC_FSOS_TOGGLE EQU (0x5:SHL:20) ;- (SSC) Selected Receive/Transmit Frame Sync Signal: Toggling at each start of data transfer +AT91C_SSC_FSEDGE EQU (0x1:SHL:24) ;- (SSC) Frame Sync Edge Detection +;- -------- SSC_TCMR : (SSC Offset: 0x18) SSC Transmit Clock Mode Register -------- +;- -------- SSC_TFMR : (SSC Offset: 0x1c) SSC Transmit Frame Mode Register -------- +AT91C_SSC_DATDEF EQU (0x1:SHL:5) ;- (SSC) Data Default Value +AT91C_SSC_FSDEN EQU (0x1:SHL:23) ;- (SSC) Frame Sync Data Enable +;- -------- SSC_SR : (SSC Offset: 0x40) SSC Status Register -------- +AT91C_SSC_TXRDY EQU (0x1:SHL:0) ;- (SSC) Transmit Ready +AT91C_SSC_TXEMPTY EQU (0x1:SHL:1) ;- (SSC) Transmit Empty +AT91C_SSC_ENDTX EQU (0x1:SHL:2) ;- (SSC) End Of Transmission +AT91C_SSC_TXBUFE EQU (0x1:SHL:3) ;- (SSC) Transmit Buffer Empty +AT91C_SSC_RXRDY EQU (0x1:SHL:4) ;- (SSC) Receive Ready +AT91C_SSC_OVRUN EQU (0x1:SHL:5) ;- (SSC) Receive Overrun +AT91C_SSC_ENDRX EQU (0x1:SHL:6) ;- (SSC) End of Reception +AT91C_SSC_RXBUFF EQU (0x1:SHL:7) ;- (SSC) Receive Buffer Full +AT91C_SSC_CP0 EQU (0x1:SHL:8) ;- (SSC) Compare 0 +AT91C_SSC_CP1 EQU (0x1:SHL:9) ;- (SSC) Compare 1 +AT91C_SSC_TXSYN EQU (0x1:SHL:10) ;- (SSC) Transmit Sync +AT91C_SSC_RXSYN EQU (0x1:SHL:11) ;- (SSC) Receive Sync +AT91C_SSC_TXENA EQU (0x1:SHL:16) ;- (SSC) Transmit Enable +AT91C_SSC_RXENA EQU (0x1:SHL:17) ;- (SSC) Receive Enable +;- -------- SSC_IER : (SSC Offset: 0x44) SSC Interrupt Enable Register -------- +;- -------- SSC_IDR : (SSC Offset: 0x48) SSC Interrupt Disable Register -------- +;- -------- SSC_IMR : (SSC Offset: 0x4c) SSC Interrupt Mask Register -------- + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Two-wire Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_TWI +TWI_CR # 4 ;- Control Register +TWI_MMR # 4 ;- Master Mode Register + # 4 ;- Reserved +TWI_IADR # 4 ;- Internal Address Register +TWI_CWGR # 4 ;- Clock Waveform Generator Register + # 12 ;- Reserved +TWI_SR # 4 ;- Status Register +TWI_IER # 4 ;- Interrupt Enable Register +TWI_IDR # 4 ;- Interrupt Disable Register +TWI_IMR # 4 ;- Interrupt Mask Register +TWI_RHR # 4 ;- Receive Holding Register +TWI_THR # 4 ;- Transmit Holding Register +;- -------- TWI_CR : (TWI Offset: 0x0) TWI Control Register -------- +AT91C_TWI_START EQU (0x1:SHL:0) ;- (TWI) Send a START Condition +AT91C_TWI_STOP EQU (0x1:SHL:1) ;- (TWI) Send a STOP Condition +AT91C_TWI_MSEN EQU (0x1:SHL:2) ;- (TWI) TWI Master Transfer Enabled +AT91C_TWI_MSDIS EQU (0x1:SHL:3) ;- (TWI) TWI Master Transfer Disabled +AT91C_TWI_SWRST EQU (0x1:SHL:7) ;- (TWI) Software Reset +;- -------- TWI_MMR : (TWI Offset: 0x4) TWI Master Mode Register -------- +AT91C_TWI_IADRSZ EQU (0x3:SHL:8) ;- (TWI) Internal Device Address Size +AT91C_TWI_IADRSZ_NO EQU (0x0:SHL:8) ;- (TWI) No internal device address +AT91C_TWI_IADRSZ_1_BYTE EQU (0x1:SHL:8) ;- (TWI) One-byte internal device address +AT91C_TWI_IADRSZ_2_BYTE EQU (0x2:SHL:8) ;- (TWI) Two-byte internal device address +AT91C_TWI_IADRSZ_3_BYTE EQU (0x3:SHL:8) ;- (TWI) Three-byte internal device address +AT91C_TWI_MREAD EQU (0x1:SHL:12) ;- (TWI) Master Read Direction +AT91C_TWI_DADR EQU (0x7F:SHL:16) ;- (TWI) Device Address +;- -------- TWI_CWGR : (TWI Offset: 0x10) TWI Clock Waveform Generator Register -------- +AT91C_TWI_CLDIV EQU (0xFF:SHL:0) ;- (TWI) Clock Low Divider +AT91C_TWI_CHDIV EQU (0xFF:SHL:8) ;- (TWI) Clock High Divider +AT91C_TWI_CKDIV EQU (0x7:SHL:16) ;- (TWI) Clock Divider +;- -------- TWI_SR : (TWI Offset: 0x20) TWI Status Register -------- +AT91C_TWI_TXCOMP EQU (0x1:SHL:0) ;- (TWI) Transmission Completed +AT91C_TWI_RXRDY EQU (0x1:SHL:1) ;- (TWI) Receive holding register ReaDY +AT91C_TWI_TXRDY EQU (0x1:SHL:2) ;- (TWI) Transmit holding register ReaDY +AT91C_TWI_OVRE EQU (0x1:SHL:6) ;- (TWI) Overrun Error +AT91C_TWI_UNRE EQU (0x1:SHL:7) ;- (TWI) Underrun Error +AT91C_TWI_NACK EQU (0x1:SHL:8) ;- (TWI) Not Acknowledged +;- -------- TWI_IER : (TWI Offset: 0x24) TWI Interrupt Enable Register -------- +;- -------- TWI_IDR : (TWI Offset: 0x28) TWI Interrupt Disable Register -------- +;- -------- TWI_IMR : (TWI Offset: 0x2c) TWI Interrupt Mask Register -------- + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR PWMC Channel Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_PWMC_CH +PWMC_CMR # 4 ;- Channel Mode Register +PWMC_CDTYR # 4 ;- Channel Duty Cycle Register +PWMC_CPRDR # 4 ;- Channel Period Register +PWMC_CCNTR # 4 ;- Channel Counter Register +PWMC_CUPDR # 4 ;- Channel Update Register +PWMC_Reserved # 12 ;- Reserved +;- -------- PWMC_CMR : (PWMC_CH Offset: 0x0) PWMC Channel Mode Register -------- +AT91C_PWMC_CPRE EQU (0xF:SHL:0) ;- (PWMC_CH) Channel Pre-scaler : PWMC_CLKx +AT91C_PWMC_CPRE_MCK EQU (0x0) ;- (PWMC_CH) +AT91C_PWMC_CPRE_MCKA EQU (0xB) ;- (PWMC_CH) +AT91C_PWMC_CPRE_MCKB EQU (0xC) ;- (PWMC_CH) +AT91C_PWMC_CALG EQU (0x1:SHL:8) ;- (PWMC_CH) Channel Alignment +AT91C_PWMC_CPOL EQU (0x1:SHL:9) ;- (PWMC_CH) Channel Polarity +AT91C_PWMC_CPD EQU (0x1:SHL:10) ;- (PWMC_CH) Channel Update Period +;- -------- PWMC_CDTYR : (PWMC_CH Offset: 0x4) PWMC Channel Duty Cycle Register -------- +AT91C_PWMC_CDTY EQU (0x0:SHL:0) ;- (PWMC_CH) Channel Duty Cycle +;- -------- PWMC_CPRDR : (PWMC_CH Offset: 0x8) PWMC Channel Period Register -------- +AT91C_PWMC_CPRD EQU (0x0:SHL:0) ;- (PWMC_CH) Channel Period +;- -------- PWMC_CCNTR : (PWMC_CH Offset: 0xc) PWMC Channel Counter Register -------- +AT91C_PWMC_CCNT EQU (0x0:SHL:0) ;- (PWMC_CH) Channel Counter +;- -------- PWMC_CUPDR : (PWMC_CH Offset: 0x10) PWMC Channel Update Register -------- +AT91C_PWMC_CUPD EQU (0x0:SHL:0) ;- (PWMC_CH) Channel Update + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Pulse Width Modulation Controller Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_PWMC +PWMC_MR # 4 ;- PWMC Mode Register +PWMC_ENA # 4 ;- PWMC Enable Register +PWMC_DIS # 4 ;- PWMC Disable Register +PWMC_SR # 4 ;- PWMC Status Register +PWMC_IER # 4 ;- PWMC Interrupt Enable Register +PWMC_IDR # 4 ;- PWMC Interrupt Disable Register +PWMC_IMR # 4 ;- PWMC Interrupt Mask Register +PWMC_ISR # 4 ;- PWMC Interrupt Status Register + # 220 ;- Reserved +PWMC_VR # 4 ;- PWMC Version Register + # 256 ;- Reserved +PWMC_CH # 96 ;- PWMC Channel +;- -------- PWMC_MR : (PWMC Offset: 0x0) PWMC Mode Register -------- +AT91C_PWMC_DIVA EQU (0xFF:SHL:0) ;- (PWMC) CLKA divide factor. +AT91C_PWMC_PREA EQU (0xF:SHL:8) ;- (PWMC) Divider Input Clock Prescaler A +AT91C_PWMC_PREA_MCK EQU (0x0:SHL:8) ;- (PWMC) +AT91C_PWMC_DIVB EQU (0xFF:SHL:16) ;- (PWMC) CLKB divide factor. +AT91C_PWMC_PREB EQU (0xF:SHL:24) ;- (PWMC) Divider Input Clock Prescaler B +AT91C_PWMC_PREB_MCK EQU (0x0:SHL:24) ;- (PWMC) +;- -------- PWMC_ENA : (PWMC Offset: 0x4) PWMC Enable Register -------- +AT91C_PWMC_CHID0 EQU (0x1:SHL:0) ;- (PWMC) Channel ID 0 +AT91C_PWMC_CHID1 EQU (0x1:SHL:1) ;- (PWMC) Channel ID 1 +AT91C_PWMC_CHID2 EQU (0x1:SHL:2) ;- (PWMC) Channel ID 2 +AT91C_PWMC_CHID3 EQU (0x1:SHL:3) ;- (PWMC) Channel ID 3 +;- -------- PWMC_DIS : (PWMC Offset: 0x8) PWMC Disable Register -------- +;- -------- PWMC_SR : (PWMC Offset: 0xc) PWMC Status Register -------- +;- -------- PWMC_IER : (PWMC Offset: 0x10) PWMC Interrupt Enable Register -------- +;- -------- PWMC_IDR : (PWMC Offset: 0x14) PWMC Interrupt Disable Register -------- +;- -------- PWMC_IMR : (PWMC Offset: 0x18) PWMC Interrupt Mask Register -------- +;- -------- PWMC_ISR : (PWMC Offset: 0x1c) PWMC Interrupt Status Register -------- + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR USB Device Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_UDP +UDP_NUM # 4 ;- Frame Number Register +UDP_GLBSTATE # 4 ;- Global State Register +UDP_FADDR # 4 ;- Function Address Register + # 4 ;- Reserved +UDP_IER # 4 ;- Interrupt Enable Register +UDP_IDR # 4 ;- Interrupt Disable Register +UDP_IMR # 4 ;- Interrupt Mask Register +UDP_ISR # 4 ;- Interrupt Status Register +UDP_ICR # 4 ;- Interrupt Clear Register + # 4 ;- Reserved +UDP_RSTEP # 4 ;- Reset Endpoint Register + # 4 ;- Reserved +UDP_CSR # 24 ;- Endpoint Control and Status Register + # 8 ;- Reserved +UDP_FDR # 24 ;- Endpoint FIFO Data Register + # 12 ;- Reserved +UDP_TXVC # 4 ;- Transceiver Control Register +;- -------- UDP_FRM_NUM : (UDP Offset: 0x0) USB Frame Number Register -------- +AT91C_UDP_FRM_NUM EQU (0x7FF:SHL:0) ;- (UDP) Frame Number as Defined in the Packet Field Formats +AT91C_UDP_FRM_ERR EQU (0x1:SHL:16) ;- (UDP) Frame Error +AT91C_UDP_FRM_OK EQU (0x1:SHL:17) ;- (UDP) Frame OK +;- -------- UDP_GLB_STATE : (UDP Offset: 0x4) USB Global State Register -------- +AT91C_UDP_FADDEN EQU (0x1:SHL:0) ;- (UDP) Function Address Enable +AT91C_UDP_CONFG EQU (0x1:SHL:1) ;- (UDP) Configured +AT91C_UDP_ESR EQU (0x1:SHL:2) ;- (UDP) Enable Send Resume +AT91C_UDP_RSMINPR EQU (0x1:SHL:3) ;- (UDP) A Resume Has Been Sent to the Host +AT91C_UDP_RMWUPE EQU (0x1:SHL:4) ;- (UDP) Remote Wake Up Enable +;- -------- UDP_FADDR : (UDP Offset: 0x8) USB Function Address Register -------- +AT91C_UDP_FADD EQU (0xFF:SHL:0) ;- (UDP) Function Address Value +AT91C_UDP_FEN EQU (0x1:SHL:8) ;- (UDP) Function Enable +;- -------- UDP_IER : (UDP Offset: 0x10) USB Interrupt Enable Register -------- +AT91C_UDP_EPINT0 EQU (0x1:SHL:0) ;- (UDP) Endpoint 0 Interrupt +AT91C_UDP_EPINT1 EQU (0x1:SHL:1) ;- (UDP) Endpoint 0 Interrupt +AT91C_UDP_EPINT2 EQU (0x1:SHL:2) ;- (UDP) Endpoint 2 Interrupt +AT91C_UDP_EPINT3 EQU (0x1:SHL:3) ;- (UDP) Endpoint 3 Interrupt +AT91C_UDP_EPINT4 EQU (0x1:SHL:4) ;- (UDP) Endpoint 4 Interrupt +AT91C_UDP_EPINT5 EQU (0x1:SHL:5) ;- (UDP) Endpoint 5 Interrupt +AT91C_UDP_RXSUSP EQU (0x1:SHL:8) ;- (UDP) USB Suspend Interrupt +AT91C_UDP_RXRSM EQU (0x1:SHL:9) ;- (UDP) USB Resume Interrupt +AT91C_UDP_EXTRSM EQU (0x1:SHL:10) ;- (UDP) USB External Resume Interrupt +AT91C_UDP_SOFINT EQU (0x1:SHL:11) ;- (UDP) USB Start Of frame Interrupt +AT91C_UDP_WAKEUP EQU (0x1:SHL:13) ;- (UDP) USB Resume Interrupt +;- -------- UDP_IDR : (UDP Offset: 0x14) USB Interrupt Disable Register -------- +;- -------- UDP_IMR : (UDP Offset: 0x18) USB Interrupt Mask Register -------- +;- -------- UDP_ISR : (UDP Offset: 0x1c) USB Interrupt Status Register -------- +AT91C_UDP_ENDBUSRES EQU (0x1:SHL:12) ;- (UDP) USB End Of Bus Reset Interrupt +;- -------- UDP_ICR : (UDP Offset: 0x20) USB Interrupt Clear Register -------- +;- -------- UDP_RST_EP : (UDP Offset: 0x28) USB Reset Endpoint Register -------- +AT91C_UDP_EP0 EQU (0x1:SHL:0) ;- (UDP) Reset Endpoint 0 +AT91C_UDP_EP1 EQU (0x1:SHL:1) ;- (UDP) Reset Endpoint 1 +AT91C_UDP_EP2 EQU (0x1:SHL:2) ;- (UDP) Reset Endpoint 2 +AT91C_UDP_EP3 EQU (0x1:SHL:3) ;- (UDP) Reset Endpoint 3 +AT91C_UDP_EP4 EQU (0x1:SHL:4) ;- (UDP) Reset Endpoint 4 +AT91C_UDP_EP5 EQU (0x1:SHL:5) ;- (UDP) Reset Endpoint 5 +;- -------- UDP_CSR : (UDP Offset: 0x30) USB Endpoint Control and Status Register -------- +AT91C_UDP_TXCOMP EQU (0x1:SHL:0) ;- (UDP) Generates an IN packet with data previously written in the DPR +AT91C_UDP_RX_DATA_BK0 EQU (0x1:SHL:1) ;- (UDP) Receive Data Bank 0 +AT91C_UDP_RXSETUP EQU (0x1:SHL:2) ;- (UDP) Sends STALL to the Host (Control endpoints) +AT91C_UDP_ISOERROR EQU (0x1:SHL:3) ;- (UDP) Isochronous error (Isochronous endpoints) +AT91C_UDP_TXPKTRDY EQU (0x1:SHL:4) ;- (UDP) Transmit Packet Ready +AT91C_UDP_FORCESTALL EQU (0x1:SHL:5) ;- (UDP) Force Stall (used by Control, Bulk and Isochronous endpoints). +AT91C_UDP_RX_DATA_BK1 EQU (0x1:SHL:6) ;- (UDP) Receive Data Bank 1 (only used by endpoints with ping-pong attributes). +AT91C_UDP_DIR EQU (0x1:SHL:7) ;- (UDP) Transfer Direction +AT91C_UDP_EPTYPE EQU (0x7:SHL:8) ;- (UDP) Endpoint type +AT91C_UDP_EPTYPE_CTRL EQU (0x0:SHL:8) ;- (UDP) Control +AT91C_UDP_EPTYPE_ISO_OUT EQU (0x1:SHL:8) ;- (UDP) Isochronous OUT +AT91C_UDP_EPTYPE_BULK_OUT EQU (0x2:SHL:8) ;- (UDP) Bulk OUT +AT91C_UDP_EPTYPE_INT_OUT EQU (0x3:SHL:8) ;- (UDP) Interrupt OUT +AT91C_UDP_EPTYPE_ISO_IN EQU (0x5:SHL:8) ;- (UDP) Isochronous IN +AT91C_UDP_EPTYPE_BULK_IN EQU (0x6:SHL:8) ;- (UDP) Bulk IN +AT91C_UDP_EPTYPE_INT_IN EQU (0x7:SHL:8) ;- (UDP) Interrupt IN +AT91C_UDP_DTGLE EQU (0x1:SHL:11) ;- (UDP) Data Toggle +AT91C_UDP_EPEDS EQU (0x1:SHL:15) ;- (UDP) Endpoint Enable Disable +AT91C_UDP_RXBYTECNT EQU (0x7FF:SHL:16) ;- (UDP) Number Of Bytes Available in the FIFO +;- -------- UDP_TXVC : (UDP Offset: 0x74) Transceiver Control Register -------- +AT91C_UDP_TXVDIS EQU (0x1:SHL:8) ;- (UDP) +AT91C_UDP_PUON EQU (0x1:SHL:9) ;- (UDP) Pull-up ON + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Timer Counter Channel Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_TC +TC_CCR # 4 ;- Channel Control Register +TC_CMR # 4 ;- Channel Mode Register (Capture Mode / Waveform Mode) + # 8 ;- Reserved +TC_CV # 4 ;- Counter Value +TC_RA # 4 ;- Register A +TC_RB # 4 ;- Register B +TC_RC # 4 ;- Register C +TC_SR # 4 ;- Status Register +TC_IER # 4 ;- Interrupt Enable Register +TC_IDR # 4 ;- Interrupt Disable Register +TC_IMR # 4 ;- Interrupt Mask Register +;- -------- TC_CCR : (TC Offset: 0x0) TC Channel Control Register -------- +AT91C_TC_CLKEN EQU (0x1:SHL:0) ;- (TC) Counter Clock Enable Command +AT91C_TC_CLKDIS EQU (0x1:SHL:1) ;- (TC) Counter Clock Disable Command +AT91C_TC_SWTRG EQU (0x1:SHL:2) ;- (TC) Software Trigger Command +;- -------- TC_CMR : (TC Offset: 0x4) TC Channel Mode Register: Capture Mode / Waveform Mode -------- +AT91C_TC_CLKS EQU (0x7:SHL:0) ;- (TC) Clock Selection +AT91C_TC_CLKS_TIMER_DIV1_CLOCK EQU (0x0) ;- (TC) Clock selected: TIMER_DIV1_CLOCK +AT91C_TC_CLKS_TIMER_DIV2_CLOCK EQU (0x1) ;- (TC) Clock selected: TIMER_DIV2_CLOCK +AT91C_TC_CLKS_TIMER_DIV3_CLOCK EQU (0x2) ;- (TC) Clock selected: TIMER_DIV3_CLOCK +AT91C_TC_CLKS_TIMER_DIV4_CLOCK EQU (0x3) ;- (TC) Clock selected: TIMER_DIV4_CLOCK +AT91C_TC_CLKS_TIMER_DIV5_CLOCK EQU (0x4) ;- (TC) Clock selected: TIMER_DIV5_CLOCK +AT91C_TC_CLKS_XC0 EQU (0x5) ;- (TC) Clock selected: XC0 +AT91C_TC_CLKS_XC1 EQU (0x6) ;- (TC) Clock selected: XC1 +AT91C_TC_CLKS_XC2 EQU (0x7) ;- (TC) Clock selected: XC2 +AT91C_TC_CLKI EQU (0x1:SHL:3) ;- (TC) Clock Invert +AT91C_TC_BURST EQU (0x3:SHL:4) ;- (TC) Burst Signal Selection +AT91C_TC_BURST_NONE EQU (0x0:SHL:4) ;- (TC) The clock is not gated by an external signal +AT91C_TC_BURST_XC0 EQU (0x1:SHL:4) ;- (TC) XC0 is ANDed with the selected clock +AT91C_TC_BURST_XC1 EQU (0x2:SHL:4) ;- (TC) XC1 is ANDed with the selected clock +AT91C_TC_BURST_XC2 EQU (0x3:SHL:4) ;- (TC) XC2 is ANDed with the selected clock +AT91C_TC_CPCSTOP EQU (0x1:SHL:6) ;- (TC) Counter Clock Stopped with RC Compare +AT91C_TC_LDBSTOP EQU (0x1:SHL:6) ;- (TC) Counter Clock Stopped with RB Loading +AT91C_TC_CPCDIS EQU (0x1:SHL:7) ;- (TC) Counter Clock Disable with RC Compare +AT91C_TC_LDBDIS EQU (0x1:SHL:7) ;- (TC) Counter Clock Disabled with RB Loading +AT91C_TC_ETRGEDG EQU (0x3:SHL:8) ;- (TC) External Trigger Edge Selection +AT91C_TC_ETRGEDG_NONE EQU (0x0:SHL:8) ;- (TC) Edge: None +AT91C_TC_ETRGEDG_RISING EQU (0x1:SHL:8) ;- (TC) Edge: rising edge +AT91C_TC_ETRGEDG_FALLING EQU (0x2:SHL:8) ;- (TC) Edge: falling edge +AT91C_TC_ETRGEDG_BOTH EQU (0x3:SHL:8) ;- (TC) Edge: each edge +AT91C_TC_EEVTEDG EQU (0x3:SHL:8) ;- (TC) External Event Edge Selection +AT91C_TC_EEVTEDG_NONE EQU (0x0:SHL:8) ;- (TC) Edge: None +AT91C_TC_EEVTEDG_RISING EQU (0x1:SHL:8) ;- (TC) Edge: rising edge +AT91C_TC_EEVTEDG_FALLING EQU (0x2:SHL:8) ;- (TC) Edge: falling edge +AT91C_TC_EEVTEDG_BOTH EQU (0x3:SHL:8) ;- (TC) Edge: each edge +AT91C_TC_EEVT EQU (0x3:SHL:10) ;- (TC) External Event Selection +AT91C_TC_EEVT_TIOB EQU (0x0:SHL:10) ;- (TC) Signal selected as external event: TIOB TIOB direction: input +AT91C_TC_EEVT_XC0 EQU (0x1:SHL:10) ;- (TC) Signal selected as external event: XC0 TIOB direction: output +AT91C_TC_EEVT_XC1 EQU (0x2:SHL:10) ;- (TC) Signal selected as external event: XC1 TIOB direction: output +AT91C_TC_EEVT_XC2 EQU (0x3:SHL:10) ;- (TC) Signal selected as external event: XC2 TIOB direction: output +AT91C_TC_ABETRG EQU (0x1:SHL:10) ;- (TC) TIOA or TIOB External Trigger Selection +AT91C_TC_ENETRG EQU (0x1:SHL:12) ;- (TC) External Event Trigger enable +AT91C_TC_WAVESEL EQU (0x3:SHL:13) ;- (TC) Waveform Selection +AT91C_TC_WAVESEL_UP EQU (0x0:SHL:13) ;- (TC) UP mode without atomatic trigger on RC Compare +AT91C_TC_WAVESEL_UPDOWN EQU (0x1:SHL:13) ;- (TC) UPDOWN mode without automatic trigger on RC Compare +AT91C_TC_WAVESEL_UP_AUTO EQU (0x2:SHL:13) ;- (TC) UP mode with automatic trigger on RC Compare +AT91C_TC_WAVESEL_UPDOWN_AUTO EQU (0x3:SHL:13) ;- (TC) UPDOWN mode with automatic trigger on RC Compare +AT91C_TC_CPCTRG EQU (0x1:SHL:14) ;- (TC) RC Compare Trigger Enable +AT91C_TC_WAVE EQU (0x1:SHL:15) ;- (TC) +AT91C_TC_ACPA EQU (0x3:SHL:16) ;- (TC) RA Compare Effect on TIOA +AT91C_TC_ACPA_NONE EQU (0x0:SHL:16) ;- (TC) Effect: none +AT91C_TC_ACPA_SET EQU (0x1:SHL:16) ;- (TC) Effect: set +AT91C_TC_ACPA_CLEAR EQU (0x2:SHL:16) ;- (TC) Effect: clear +AT91C_TC_ACPA_TOGGLE EQU (0x3:SHL:16) ;- (TC) Effect: toggle +AT91C_TC_LDRA EQU (0x3:SHL:16) ;- (TC) RA Loading Selection +AT91C_TC_LDRA_NONE EQU (0x0:SHL:16) ;- (TC) Edge: None +AT91C_TC_LDRA_RISING EQU (0x1:SHL:16) ;- (TC) Edge: rising edge of TIOA +AT91C_TC_LDRA_FALLING EQU (0x2:SHL:16) ;- (TC) Edge: falling edge of TIOA +AT91C_TC_LDRA_BOTH EQU (0x3:SHL:16) ;- (TC) Edge: each edge of TIOA +AT91C_TC_ACPC EQU (0x3:SHL:18) ;- (TC) RC Compare Effect on TIOA +AT91C_TC_ACPC_NONE EQU (0x0:SHL:18) ;- (TC) Effect: none +AT91C_TC_ACPC_SET EQU (0x1:SHL:18) ;- (TC) Effect: set +AT91C_TC_ACPC_CLEAR EQU (0x2:SHL:18) ;- (TC) Effect: clear +AT91C_TC_ACPC_TOGGLE EQU (0x3:SHL:18) ;- (TC) Effect: toggle +AT91C_TC_LDRB EQU (0x3:SHL:18) ;- (TC) RB Loading Selection +AT91C_TC_LDRB_NONE EQU (0x0:SHL:18) ;- (TC) Edge: None +AT91C_TC_LDRB_RISING EQU (0x1:SHL:18) ;- (TC) Edge: rising edge of TIOA +AT91C_TC_LDRB_FALLING EQU (0x2:SHL:18) ;- (TC) Edge: falling edge of TIOA +AT91C_TC_LDRB_BOTH EQU (0x3:SHL:18) ;- (TC) Edge: each edge of TIOA +AT91C_TC_AEEVT EQU (0x3:SHL:20) ;- (TC) External Event Effect on TIOA +AT91C_TC_AEEVT_NONE EQU (0x0:SHL:20) ;- (TC) Effect: none +AT91C_TC_AEEVT_SET EQU (0x1:SHL:20) ;- (TC) Effect: set +AT91C_TC_AEEVT_CLEAR EQU (0x2:SHL:20) ;- (TC) Effect: clear +AT91C_TC_AEEVT_TOGGLE EQU (0x3:SHL:20) ;- (TC) Effect: toggle +AT91C_TC_ASWTRG EQU (0x3:SHL:22) ;- (TC) Software Trigger Effect on TIOA +AT91C_TC_ASWTRG_NONE EQU (0x0:SHL:22) ;- (TC) Effect: none +AT91C_TC_ASWTRG_SET EQU (0x1:SHL:22) ;- (TC) Effect: set +AT91C_TC_ASWTRG_CLEAR EQU (0x2:SHL:22) ;- (TC) Effect: clear +AT91C_TC_ASWTRG_TOGGLE EQU (0x3:SHL:22) ;- (TC) Effect: toggle +AT91C_TC_BCPB EQU (0x3:SHL:24) ;- (TC) RB Compare Effect on TIOB +AT91C_TC_BCPB_NONE EQU (0x0:SHL:24) ;- (TC) Effect: none +AT91C_TC_BCPB_SET EQU (0x1:SHL:24) ;- (TC) Effect: set +AT91C_TC_BCPB_CLEAR EQU (0x2:SHL:24) ;- (TC) Effect: clear +AT91C_TC_BCPB_TOGGLE EQU (0x3:SHL:24) ;- (TC) Effect: toggle +AT91C_TC_BCPC EQU (0x3:SHL:26) ;- (TC) RC Compare Effect on TIOB +AT91C_TC_BCPC_NONE EQU (0x0:SHL:26) ;- (TC) Effect: none +AT91C_TC_BCPC_SET EQU (0x1:SHL:26) ;- (TC) Effect: set +AT91C_TC_BCPC_CLEAR EQU (0x2:SHL:26) ;- (TC) Effect: clear +AT91C_TC_BCPC_TOGGLE EQU (0x3:SHL:26) ;- (TC) Effect: toggle +AT91C_TC_BEEVT EQU (0x3:SHL:28) ;- (TC) External Event Effect on TIOB +AT91C_TC_BEEVT_NONE EQU (0x0:SHL:28) ;- (TC) Effect: none +AT91C_TC_BEEVT_SET EQU (0x1:SHL:28) ;- (TC) Effect: set +AT91C_TC_BEEVT_CLEAR EQU (0x2:SHL:28) ;- (TC) Effect: clear +AT91C_TC_BEEVT_TOGGLE EQU (0x3:SHL:28) ;- (TC) Effect: toggle +AT91C_TC_BSWTRG EQU (0x3:SHL:30) ;- (TC) Software Trigger Effect on TIOB +AT91C_TC_BSWTRG_NONE EQU (0x0:SHL:30) ;- (TC) Effect: none +AT91C_TC_BSWTRG_SET EQU (0x1:SHL:30) ;- (TC) Effect: set +AT91C_TC_BSWTRG_CLEAR EQU (0x2:SHL:30) ;- (TC) Effect: clear +AT91C_TC_BSWTRG_TOGGLE EQU (0x3:SHL:30) ;- (TC) Effect: toggle +;- -------- TC_SR : (TC Offset: 0x20) TC Channel Status Register -------- +AT91C_TC_COVFS EQU (0x1:SHL:0) ;- (TC) Counter Overflow +AT91C_TC_LOVRS EQU (0x1:SHL:1) ;- (TC) Load Overrun +AT91C_TC_CPAS EQU (0x1:SHL:2) ;- (TC) RA Compare +AT91C_TC_CPBS EQU (0x1:SHL:3) ;- (TC) RB Compare +AT91C_TC_CPCS EQU (0x1:SHL:4) ;- (TC) RC Compare +AT91C_TC_LDRAS EQU (0x1:SHL:5) ;- (TC) RA Loading +AT91C_TC_LDRBS EQU (0x1:SHL:6) ;- (TC) RB Loading +AT91C_TC_ETRGS EQU (0x1:SHL:7) ;- (TC) External Trigger +AT91C_TC_CLKSTA EQU (0x1:SHL:16) ;- (TC) Clock Enabling +AT91C_TC_MTIOA EQU (0x1:SHL:17) ;- (TC) TIOA Mirror +AT91C_TC_MTIOB EQU (0x1:SHL:18) ;- (TC) TIOA Mirror +;- -------- TC_IER : (TC Offset: 0x24) TC Channel Interrupt Enable Register -------- +;- -------- TC_IDR : (TC Offset: 0x28) TC Channel Interrupt Disable Register -------- +;- -------- TC_IMR : (TC Offset: 0x2c) TC Channel Interrupt Mask Register -------- + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Timer Counter Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_TCB +TCB_TC0 # 48 ;- TC Channel 0 + # 16 ;- Reserved +TCB_TC1 # 48 ;- TC Channel 1 + # 16 ;- Reserved +TCB_TC2 # 48 ;- TC Channel 2 + # 16 ;- Reserved +TCB_BCR # 4 ;- TC Block Control Register +TCB_BMR # 4 ;- TC Block Mode Register +;- -------- TCB_BCR : (TCB Offset: 0xc0) TC Block Control Register -------- +AT91C_TCB_SYNC EQU (0x1:SHL:0) ;- (TCB) Synchro Command +;- -------- TCB_BMR : (TCB Offset: 0xc4) TC Block Mode Register -------- +AT91C_TCB_TC0XC0S EQU (0x3:SHL:0) ;- (TCB) External Clock Signal 0 Selection +AT91C_TCB_TC0XC0S_TCLK0 EQU (0x0) ;- (TCB) TCLK0 connected to XC0 +AT91C_TCB_TC0XC0S_NONE EQU (0x1) ;- (TCB) None signal connected to XC0 +AT91C_TCB_TC0XC0S_TIOA1 EQU (0x2) ;- (TCB) TIOA1 connected to XC0 +AT91C_TCB_TC0XC0S_TIOA2 EQU (0x3) ;- (TCB) TIOA2 connected to XC0 +AT91C_TCB_TC1XC1S EQU (0x3:SHL:2) ;- (TCB) External Clock Signal 1 Selection +AT91C_TCB_TC1XC1S_TCLK1 EQU (0x0:SHL:2) ;- (TCB) TCLK1 connected to XC1 +AT91C_TCB_TC1XC1S_NONE EQU (0x1:SHL:2) ;- (TCB) None signal connected to XC1 +AT91C_TCB_TC1XC1S_TIOA0 EQU (0x2:SHL:2) ;- (TCB) TIOA0 connected to XC1 +AT91C_TCB_TC1XC1S_TIOA2 EQU (0x3:SHL:2) ;- (TCB) TIOA2 connected to XC1 +AT91C_TCB_TC2XC2S EQU (0x3:SHL:4) ;- (TCB) External Clock Signal 2 Selection +AT91C_TCB_TC2XC2S_TCLK2 EQU (0x0:SHL:4) ;- (TCB) TCLK2 connected to XC2 +AT91C_TCB_TC2XC2S_NONE EQU (0x1:SHL:4) ;- (TCB) None signal connected to XC2 +AT91C_TCB_TC2XC2S_TIOA0 EQU (0x2:SHL:4) ;- (TCB) TIOA0 connected to XC2 +AT91C_TCB_TC2XC2S_TIOA1 EQU (0x3:SHL:4) ;- (TCB) TIOA2 connected to XC2 + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Control Area Network MailBox Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_CAN_MB +CAN_MB_MMR # 4 ;- MailBox Mode Register +CAN_MB_MAM # 4 ;- MailBox Acceptance Mask Register +CAN_MB_MID # 4 ;- MailBox ID Register +CAN_MB_MFID # 4 ;- MailBox Family ID Register +CAN_MB_MSR # 4 ;- MailBox Status Register +CAN_MB_MDL # 4 ;- MailBox Data Low Register +CAN_MB_MDH # 4 ;- MailBox Data High Register +CAN_MB_MCR # 4 ;- MailBox Control Register +;- -------- CAN_MMR : (CAN_MB Offset: 0x0) CAN Message Mode Register -------- +AT91C_CAN_MTIMEMARK EQU (0xFFFF:SHL:0) ;- (CAN_MB) Mailbox Timemark +AT91C_CAN_PRIOR EQU (0xF:SHL:16) ;- (CAN_MB) Mailbox Priority +AT91C_CAN_MOT EQU (0x7:SHL:24) ;- (CAN_MB) Mailbox Object Type +AT91C_CAN_MOT_DIS EQU (0x0:SHL:24) ;- (CAN_MB) +AT91C_CAN_MOT_RX EQU (0x1:SHL:24) ;- (CAN_MB) +AT91C_CAN_MOT_RXOVERWRITE EQU (0x2:SHL:24) ;- (CAN_MB) +AT91C_CAN_MOT_TX EQU (0x3:SHL:24) ;- (CAN_MB) +AT91C_CAN_MOT_CONSUMER EQU (0x4:SHL:24) ;- (CAN_MB) +AT91C_CAN_MOT_PRODUCER EQU (0x5:SHL:24) ;- (CAN_MB) +;- -------- CAN_MAM : (CAN_MB Offset: 0x4) CAN Message Acceptance Mask Register -------- +AT91C_CAN_MIDvB EQU (0x3FFFF:SHL:0) ;- (CAN_MB) Complementary bits for identifier in extended mode +AT91C_CAN_MIDvA EQU (0x7FF:SHL:18) ;- (CAN_MB) Identifier for standard frame mode +AT91C_CAN_MIDE EQU (0x1:SHL:29) ;- (CAN_MB) Identifier Version +;- -------- CAN_MID : (CAN_MB Offset: 0x8) CAN Message ID Register -------- +;- -------- CAN_MFID : (CAN_MB Offset: 0xc) CAN Message Family ID Register -------- +;- -------- CAN_MSR : (CAN_MB Offset: 0x10) CAN Message Status Register -------- +AT91C_CAN_MTIMESTAMP EQU (0xFFFF:SHL:0) ;- (CAN_MB) Timer Value +AT91C_CAN_MDLC EQU (0xF:SHL:16) ;- (CAN_MB) Mailbox Data Length Code +AT91C_CAN_MRTR EQU (0x1:SHL:20) ;- (CAN_MB) Mailbox Remote Transmission Request +AT91C_CAN_MABT EQU (0x1:SHL:22) ;- (CAN_MB) Mailbox Message Abort +AT91C_CAN_MRDY EQU (0x1:SHL:23) ;- (CAN_MB) Mailbox Ready +AT91C_CAN_MMI EQU (0x1:SHL:24) ;- (CAN_MB) Mailbox Message Ignored +;- -------- CAN_MDL : (CAN_MB Offset: 0x14) CAN Message Data Low Register -------- +;- -------- CAN_MDH : (CAN_MB Offset: 0x18) CAN Message Data High Register -------- +;- -------- CAN_MCR : (CAN_MB Offset: 0x1c) CAN Message Control Register -------- +AT91C_CAN_MACR EQU (0x1:SHL:22) ;- (CAN_MB) Abort Request for Mailbox +AT91C_CAN_MTCR EQU (0x1:SHL:23) ;- (CAN_MB) Mailbox Transfer Command + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Control Area Network Interface +;- ***************************************************************************** + ^ 0 ;- AT91S_CAN +CAN_MR # 4 ;- Mode Register +CAN_IER # 4 ;- Interrupt Enable Register +CAN_IDR # 4 ;- Interrupt Disable Register +CAN_IMR # 4 ;- Interrupt Mask Register +CAN_SR # 4 ;- Status Register +CAN_BR # 4 ;- Baudrate Register +CAN_TIM # 4 ;- Timer Register +CAN_TIMESTP # 4 ;- Time Stamp Register +CAN_ECR # 4 ;- Error Counter Register +CAN_TCR # 4 ;- Transfer Command Register +CAN_ACR # 4 ;- Abort Command Register + # 208 ;- Reserved +CAN_VR # 4 ;- Version Register + # 256 ;- Reserved +CAN_MB0 # 32 ;- CAN Mailbox 0 +CAN_MB1 # 32 ;- CAN Mailbox 1 +CAN_MB2 # 32 ;- CAN Mailbox 2 +CAN_MB3 # 32 ;- CAN Mailbox 3 +CAN_MB4 # 32 ;- CAN Mailbox 4 +CAN_MB5 # 32 ;- CAN Mailbox 5 +CAN_MB6 # 32 ;- CAN Mailbox 6 +CAN_MB7 # 32 ;- CAN Mailbox 7 +CAN_MB8 # 32 ;- CAN Mailbox 8 +CAN_MB9 # 32 ;- CAN Mailbox 9 +CAN_MB10 # 32 ;- CAN Mailbox 10 +CAN_MB11 # 32 ;- CAN Mailbox 11 +CAN_MB12 # 32 ;- CAN Mailbox 12 +CAN_MB13 # 32 ;- CAN Mailbox 13 +CAN_MB14 # 32 ;- CAN Mailbox 14 +CAN_MB15 # 32 ;- CAN Mailbox 15 +;- -------- CAN_MR : (CAN Offset: 0x0) CAN Mode Register -------- +AT91C_CAN_CANEN EQU (0x1:SHL:0) ;- (CAN) CAN Controller Enable +AT91C_CAN_LPM EQU (0x1:SHL:1) ;- (CAN) Disable/Enable Low Power Mode +AT91C_CAN_ABM EQU (0x1:SHL:2) ;- (CAN) Disable/Enable Autobaud/Listen Mode +AT91C_CAN_OVL EQU (0x1:SHL:3) ;- (CAN) Disable/Enable Overload Frame +AT91C_CAN_TEOF EQU (0x1:SHL:4) ;- (CAN) Time Stamp messages at each end of Frame +AT91C_CAN_TTM EQU (0x1:SHL:5) ;- (CAN) Disable/Enable Time Trigger Mode +AT91C_CAN_TIMFRZ EQU (0x1:SHL:6) ;- (CAN) Enable Timer Freeze +AT91C_CAN_DRPT EQU (0x1:SHL:7) ;- (CAN) Disable Repeat +;- -------- CAN_IER : (CAN Offset: 0x4) CAN Interrupt Enable Register -------- +AT91C_CAN_MB0 EQU (0x1:SHL:0) ;- (CAN) Mailbox 0 Flag +AT91C_CAN_MB1 EQU (0x1:SHL:1) ;- (CAN) Mailbox 1 Flag +AT91C_CAN_MB2 EQU (0x1:SHL:2) ;- (CAN) Mailbox 2 Flag +AT91C_CAN_MB3 EQU (0x1:SHL:3) ;- (CAN) Mailbox 3 Flag +AT91C_CAN_MB4 EQU (0x1:SHL:4) ;- (CAN) Mailbox 4 Flag +AT91C_CAN_MB5 EQU (0x1:SHL:5) ;- (CAN) Mailbox 5 Flag +AT91C_CAN_MB6 EQU (0x1:SHL:6) ;- (CAN) Mailbox 6 Flag +AT91C_CAN_MB7 EQU (0x1:SHL:7) ;- (CAN) Mailbox 7 Flag +AT91C_CAN_MB8 EQU (0x1:SHL:8) ;- (CAN) Mailbox 8 Flag +AT91C_CAN_MB9 EQU (0x1:SHL:9) ;- (CAN) Mailbox 9 Flag +AT91C_CAN_MB10 EQU (0x1:SHL:10) ;- (CAN) Mailbox 10 Flag +AT91C_CAN_MB11 EQU (0x1:SHL:11) ;- (CAN) Mailbox 11 Flag +AT91C_CAN_MB12 EQU (0x1:SHL:12) ;- (CAN) Mailbox 12 Flag +AT91C_CAN_MB13 EQU (0x1:SHL:13) ;- (CAN) Mailbox 13 Flag +AT91C_CAN_MB14 EQU (0x1:SHL:14) ;- (CAN) Mailbox 14 Flag +AT91C_CAN_MB15 EQU (0x1:SHL:15) ;- (CAN) Mailbox 15 Flag +AT91C_CAN_ERRA EQU (0x1:SHL:16) ;- (CAN) Error Active Mode Flag +AT91C_CAN_WARN EQU (0x1:SHL:17) ;- (CAN) Warning Limit Flag +AT91C_CAN_ERRP EQU (0x1:SHL:18) ;- (CAN) Error Passive Mode Flag +AT91C_CAN_BOFF EQU (0x1:SHL:19) ;- (CAN) Bus Off Mode Flag +AT91C_CAN_SLEEP EQU (0x1:SHL:20) ;- (CAN) Sleep Flag +AT91C_CAN_WAKEUP EQU (0x1:SHL:21) ;- (CAN) Wakeup Flag +AT91C_CAN_TOVF EQU (0x1:SHL:22) ;- (CAN) Timer Overflow Flag +AT91C_CAN_TSTP EQU (0x1:SHL:23) ;- (CAN) Timestamp Flag +AT91C_CAN_CERR EQU (0x1:SHL:24) ;- (CAN) CRC Error +AT91C_CAN_SERR EQU (0x1:SHL:25) ;- (CAN) Stuffing Error +AT91C_CAN_AERR EQU (0x1:SHL:26) ;- (CAN) Acknowledgment Error +AT91C_CAN_FERR EQU (0x1:SHL:27) ;- (CAN) Form Error +AT91C_CAN_BERR EQU (0x1:SHL:28) ;- (CAN) Bit Error +;- -------- CAN_IDR : (CAN Offset: 0x8) CAN Interrupt Disable Register -------- +;- -------- CAN_IMR : (CAN Offset: 0xc) CAN Interrupt Mask Register -------- +;- -------- CAN_SR : (CAN Offset: 0x10) CAN Status Register -------- +AT91C_CAN_RBSY EQU (0x1:SHL:29) ;- (CAN) Receiver Busy +AT91C_CAN_TBSY EQU (0x1:SHL:30) ;- (CAN) Transmitter Busy +AT91C_CAN_OVLY EQU (0x1:SHL:31) ;- (CAN) Overload Busy +;- -------- CAN_BR : (CAN Offset: 0x14) CAN Baudrate Register -------- +AT91C_CAN_PHASE2 EQU (0x7:SHL:0) ;- (CAN) Phase 2 segment +AT91C_CAN_PHASE1 EQU (0x7:SHL:4) ;- (CAN) Phase 1 segment +AT91C_CAN_PROPAG EQU (0x7:SHL:8) ;- (CAN) Programmation time segment +AT91C_CAN_SYNC EQU (0x3:SHL:12) ;- (CAN) Re-synchronization jump width segment +AT91C_CAN_BRP EQU (0x7F:SHL:16) ;- (CAN) Baudrate Prescaler +AT91C_CAN_SMP EQU (0x1:SHL:24) ;- (CAN) Sampling mode +;- -------- CAN_TIM : (CAN Offset: 0x18) CAN Timer Register -------- +AT91C_CAN_TIMER EQU (0xFFFF:SHL:0) ;- (CAN) Timer field +;- -------- CAN_TIMESTP : (CAN Offset: 0x1c) CAN Timestamp Register -------- +;- -------- CAN_ECR : (CAN Offset: 0x20) CAN Error Counter Register -------- +AT91C_CAN_REC EQU (0xFF:SHL:0) ;- (CAN) Receive Error Counter +AT91C_CAN_TEC EQU (0xFF:SHL:16) ;- (CAN) Transmit Error Counter +;- -------- CAN_TCR : (CAN Offset: 0x24) CAN Transfer Command Register -------- +AT91C_CAN_TIMRST EQU (0x1:SHL:31) ;- (CAN) Timer Reset Field +;- -------- CAN_ACR : (CAN Offset: 0x28) CAN Abort Command Register -------- + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Ethernet MAC 10/100 +;- ***************************************************************************** + ^ 0 ;- AT91S_EMAC +EMAC_NCR # 4 ;- Network Control Register +EMAC_NCFGR # 4 ;- Network Configuration Register +EMAC_NSR # 4 ;- Network Status Register + # 8 ;- Reserved +EMAC_TSR # 4 ;- Transmit Status Register +EMAC_RBQP # 4 ;- Receive Buffer Queue Pointer +EMAC_TBQP # 4 ;- Transmit Buffer Queue Pointer +EMAC_RSR # 4 ;- Receive Status Register +EMAC_ISR # 4 ;- Interrupt Status Register +EMAC_IER # 4 ;- Interrupt Enable Register +EMAC_IDR # 4 ;- Interrupt Disable Register +EMAC_IMR # 4 ;- Interrupt Mask Register +EMAC_MAN # 4 ;- PHY Maintenance Register +EMAC_PTR # 4 ;- Pause Time Register +EMAC_PFR # 4 ;- Pause Frames received Register +EMAC_FTO # 4 ;- Frames Transmitted OK Register +EMAC_SCF # 4 ;- Single Collision Frame Register +EMAC_MCF # 4 ;- Multiple Collision Frame Register +EMAC_FRO # 4 ;- Frames Received OK Register +EMAC_FCSE # 4 ;- Frame Check Sequence Error Register +EMAC_ALE # 4 ;- Alignment Error Register +EMAC_DTF # 4 ;- Deferred Transmission Frame Register +EMAC_LCOL # 4 ;- Late Collision Register +EMAC_ECOL # 4 ;- Excessive Collision Register +EMAC_TUND # 4 ;- Transmit Underrun Error Register +EMAC_CSE # 4 ;- Carrier Sense Error Register +EMAC_RRE # 4 ;- Receive Ressource Error Register +EMAC_ROV # 4 ;- Receive Overrun Errors Register +EMAC_RSE # 4 ;- Receive Symbol Errors Register +EMAC_ELE # 4 ;- Excessive Length Errors Register +EMAC_RJA # 4 ;- Receive Jabbers Register +EMAC_USF # 4 ;- Undersize Frames Register +EMAC_STE # 4 ;- SQE Test Error Register +EMAC_RLE # 4 ;- Receive Length Field Mismatch Register +EMAC_TPF # 4 ;- Transmitted Pause Frames Register +EMAC_HRB # 4 ;- Hash Address Bottom[31:0] +EMAC_HRT # 4 ;- Hash Address Top[63:32] +EMAC_SA1L # 4 ;- Specific Address 1 Bottom, First 4 bytes +EMAC_SA1H # 4 ;- Specific Address 1 Top, Last 2 bytes +EMAC_SA2L # 4 ;- Specific Address 2 Bottom, First 4 bytes +EMAC_SA2H # 4 ;- Specific Address 2 Top, Last 2 bytes +EMAC_SA3L # 4 ;- Specific Address 3 Bottom, First 4 bytes +EMAC_SA3H # 4 ;- Specific Address 3 Top, Last 2 bytes +EMAC_SA4L # 4 ;- Specific Address 4 Bottom, First 4 bytes +EMAC_SA4H # 4 ;- Specific Address 4 Top, Last 2 bytes +EMAC_TID # 4 ;- Type ID Checking Register +EMAC_TPQ # 4 ;- Transmit Pause Quantum Register +EMAC_USRIO # 4 ;- USER Input/Output Register +EMAC_WOL # 4 ;- Wake On LAN Register + # 52 ;- Reserved +EMAC_REV # 4 ;- Revision Register +;- -------- EMAC_NCR : (EMAC Offset: 0x0) -------- +AT91C_EMAC_LB EQU (0x1:SHL:0) ;- (EMAC) Loopback. Optional. When set, loopback signal is at high level. +AT91C_EMAC_LLB EQU (0x1:SHL:1) ;- (EMAC) Loopback local. +AT91C_EMAC_RE EQU (0x1:SHL:2) ;- (EMAC) Receive enable. +AT91C_EMAC_TE EQU (0x1:SHL:3) ;- (EMAC) Transmit enable. +AT91C_EMAC_MPE EQU (0x1:SHL:4) ;- (EMAC) Management port enable. +AT91C_EMAC_CLRSTAT EQU (0x1:SHL:5) ;- (EMAC) Clear statistics registers. +AT91C_EMAC_INCSTAT EQU (0x1:SHL:6) ;- (EMAC) Increment statistics registers. +AT91C_EMAC_WESTAT EQU (0x1:SHL:7) ;- (EMAC) Write enable for statistics registers. +AT91C_EMAC_BP EQU (0x1:SHL:8) ;- (EMAC) Back pressure. +AT91C_EMAC_TSTART EQU (0x1:SHL:9) ;- (EMAC) Start Transmission. +AT91C_EMAC_THALT EQU (0x1:SHL:10) ;- (EMAC) Transmission Halt. +AT91C_EMAC_TPFR EQU (0x1:SHL:11) ;- (EMAC) Transmit pause frame +AT91C_EMAC_TZQ EQU (0x1:SHL:12) ;- (EMAC) Transmit zero quantum pause frame +;- -------- EMAC_NCFGR : (EMAC Offset: 0x4) Network Configuration Register -------- +AT91C_EMAC_SPD EQU (0x1:SHL:0) ;- (EMAC) Speed. +AT91C_EMAC_FD EQU (0x1:SHL:1) ;- (EMAC) Full duplex. +AT91C_EMAC_JFRAME EQU (0x1:SHL:3) ;- (EMAC) Jumbo Frames. +AT91C_EMAC_CAF EQU (0x1:SHL:4) ;- (EMAC) Copy all frames. +AT91C_EMAC_NBC EQU (0x1:SHL:5) ;- (EMAC) No broadcast. +AT91C_EMAC_MTI EQU (0x1:SHL:6) ;- (EMAC) Multicast hash event enable +AT91C_EMAC_UNI EQU (0x1:SHL:7) ;- (EMAC) Unicast hash enable. +AT91C_EMAC_BIG EQU (0x1:SHL:8) ;- (EMAC) Receive 1522 bytes. +AT91C_EMAC_EAE EQU (0x1:SHL:9) ;- (EMAC) External address match enable. +AT91C_EMAC_CLK EQU (0x3:SHL:10) ;- (EMAC) +AT91C_EMAC_CLK_HCLK_8 EQU (0x0:SHL:10) ;- (EMAC) HCLK divided by 8 +AT91C_EMAC_CLK_HCLK_16 EQU (0x1:SHL:10) ;- (EMAC) HCLK divided by 16 +AT91C_EMAC_CLK_HCLK_32 EQU (0x2:SHL:10) ;- (EMAC) HCLK divided by 32 +AT91C_EMAC_CLK_HCLK_64 EQU (0x3:SHL:10) ;- (EMAC) HCLK divided by 64 +AT91C_EMAC_RTY EQU (0x1:SHL:12) ;- (EMAC) +AT91C_EMAC_PAE EQU (0x1:SHL:13) ;- (EMAC) +AT91C_EMAC_RBOF EQU (0x3:SHL:14) ;- (EMAC) +AT91C_EMAC_RBOF_OFFSET_0 EQU (0x0:SHL:14) ;- (EMAC) no offset from start of receive buffer +AT91C_EMAC_RBOF_OFFSET_1 EQU (0x1:SHL:14) ;- (EMAC) one byte offset from start of receive buffer +AT91C_EMAC_RBOF_OFFSET_2 EQU (0x2:SHL:14) ;- (EMAC) two bytes offset from start of receive buffer +AT91C_EMAC_RBOF_OFFSET_3 EQU (0x3:SHL:14) ;- (EMAC) three bytes offset from start of receive buffer +AT91C_EMAC_RLCE EQU (0x1:SHL:16) ;- (EMAC) Receive Length field Checking Enable +AT91C_EMAC_DRFCS EQU (0x1:SHL:17) ;- (EMAC) Discard Receive FCS +AT91C_EMAC_EFRHD EQU (0x1:SHL:18) ;- (EMAC) +AT91C_EMAC_IRXFCS EQU (0x1:SHL:19) ;- (EMAC) Ignore RX FCS +;- -------- EMAC_NSR : (EMAC Offset: 0x8) Network Status Register -------- +AT91C_EMAC_LINKR EQU (0x1:SHL:0) ;- (EMAC) +AT91C_EMAC_MDIO EQU (0x1:SHL:1) ;- (EMAC) +AT91C_EMAC_IDLE EQU (0x1:SHL:2) ;- (EMAC) +;- -------- EMAC_TSR : (EMAC Offset: 0x14) Transmit Status Register -------- +AT91C_EMAC_UBR EQU (0x1:SHL:0) ;- (EMAC) +AT91C_EMAC_COL EQU (0x1:SHL:1) ;- (EMAC) +AT91C_EMAC_RLES EQU (0x1:SHL:2) ;- (EMAC) +AT91C_EMAC_TGO EQU (0x1:SHL:3) ;- (EMAC) Transmit Go +AT91C_EMAC_BEX EQU (0x1:SHL:4) ;- (EMAC) Buffers exhausted mid frame +AT91C_EMAC_COMP EQU (0x1:SHL:5) ;- (EMAC) +AT91C_EMAC_UND EQU (0x1:SHL:6) ;- (EMAC) +;- -------- EMAC_RSR : (EMAC Offset: 0x20) Receive Status Register -------- +AT91C_EMAC_BNA EQU (0x1:SHL:0) ;- (EMAC) +AT91C_EMAC_REC EQU (0x1:SHL:1) ;- (EMAC) +AT91C_EMAC_OVR EQU (0x1:SHL:2) ;- (EMAC) +;- -------- EMAC_ISR : (EMAC Offset: 0x24) Interrupt Status Register -------- +AT91C_EMAC_MFD EQU (0x1:SHL:0) ;- (EMAC) +AT91C_EMAC_RCOMP EQU (0x1:SHL:1) ;- (EMAC) +AT91C_EMAC_RXUBR EQU (0x1:SHL:2) ;- (EMAC) +AT91C_EMAC_TXUBR EQU (0x1:SHL:3) ;- (EMAC) +AT91C_EMAC_TUNDR EQU (0x1:SHL:4) ;- (EMAC) +AT91C_EMAC_RLEX EQU (0x1:SHL:5) ;- (EMAC) +AT91C_EMAC_TXERR EQU (0x1:SHL:6) ;- (EMAC) +AT91C_EMAC_TCOMP EQU (0x1:SHL:7) ;- (EMAC) +AT91C_EMAC_LINK EQU (0x1:SHL:9) ;- (EMAC) +AT91C_EMAC_ROVR EQU (0x1:SHL:10) ;- (EMAC) +AT91C_EMAC_HRESP EQU (0x1:SHL:11) ;- (EMAC) +AT91C_EMAC_PFRE EQU (0x1:SHL:12) ;- (EMAC) +AT91C_EMAC_PTZ EQU (0x1:SHL:13) ;- (EMAC) +;- -------- EMAC_IER : (EMAC Offset: 0x28) Interrupt Enable Register -------- +;- -------- EMAC_IDR : (EMAC Offset: 0x2c) Interrupt Disable Register -------- +;- -------- EMAC_IMR : (EMAC Offset: 0x30) Interrupt Mask Register -------- +;- -------- EMAC_MAN : (EMAC Offset: 0x34) PHY Maintenance Register -------- +AT91C_EMAC_DATA EQU (0xFFFF:SHL:0) ;- (EMAC) +AT91C_EMAC_CODE EQU (0x3:SHL:16) ;- (EMAC) +AT91C_EMAC_REGA EQU (0x1F:SHL:18) ;- (EMAC) +AT91C_EMAC_PHYA EQU (0x1F:SHL:23) ;- (EMAC) +AT91C_EMAC_RW EQU (0x3:SHL:28) ;- (EMAC) +AT91C_EMAC_SOF EQU (0x3:SHL:30) ;- (EMAC) +;- -------- EMAC_USRIO : (EMAC Offset: 0xc0) USER Input Output Register -------- +AT91C_EMAC_RMII EQU (0x1:SHL:0) ;- (EMAC) Reduce MII +AT91C_EMAC_CLKEN EQU (0x1:SHL:1) ;- (EMAC) Clock Enable +;- -------- EMAC_WOL : (EMAC Offset: 0xc4) Wake On LAN Register -------- +AT91C_EMAC_IP EQU (0xFFFF:SHL:0) ;- (EMAC) ARP request IP address +AT91C_EMAC_MAG EQU (0x1:SHL:16) ;- (EMAC) Magic packet event enable +AT91C_EMAC_ARP EQU (0x1:SHL:17) ;- (EMAC) ARP request event enable +AT91C_EMAC_SA1 EQU (0x1:SHL:18) ;- (EMAC) Specific address register 1 event enable +;- -------- EMAC_REV : (EMAC Offset: 0xfc) Revision Register -------- +AT91C_EMAC_REVREF EQU (0xFFFF:SHL:0) ;- (EMAC) +AT91C_EMAC_PARTREF EQU (0xFFFF:SHL:16) ;- (EMAC) + +;- ***************************************************************************** +;- SOFTWARE API DEFINITION FOR Analog to Digital Convertor +;- ***************************************************************************** + ^ 0 ;- AT91S_ADC +ADC_CR # 4 ;- ADC Control Register +ADC_MR # 4 ;- ADC Mode Register + # 8 ;- Reserved +ADC_CHER # 4 ;- ADC Channel Enable Register +ADC_CHDR # 4 ;- ADC Channel Disable Register +ADC_CHSR # 4 ;- ADC Channel Status Register +ADC_SR # 4 ;- ADC Status Register +ADC_LCDR # 4 ;- ADC Last Converted Data Register +ADC_IER # 4 ;- ADC Interrupt Enable Register +ADC_IDR # 4 ;- ADC Interrupt Disable Register +ADC_IMR # 4 ;- ADC Interrupt Mask Register +ADC_CDR0 # 4 ;- ADC Channel Data Register 0 +ADC_CDR1 # 4 ;- ADC Channel Data Register 1 +ADC_CDR2 # 4 ;- ADC Channel Data Register 2 +ADC_CDR3 # 4 ;- ADC Channel Data Register 3 +ADC_CDR4 # 4 ;- ADC Channel Data Register 4 +ADC_CDR5 # 4 ;- ADC Channel Data Register 5 +ADC_CDR6 # 4 ;- ADC Channel Data Register 6 +ADC_CDR7 # 4 ;- ADC Channel Data Register 7 + # 176 ;- Reserved +ADC_RPR # 4 ;- Receive Pointer Register +ADC_RCR # 4 ;- Receive Counter Register +ADC_TPR # 4 ;- Transmit Pointer Register +ADC_TCR # 4 ;- Transmit Counter Register +ADC_RNPR # 4 ;- Receive Next Pointer Register +ADC_RNCR # 4 ;- Receive Next Counter Register +ADC_TNPR # 4 ;- Transmit Next Pointer Register +ADC_TNCR # 4 ;- Transmit Next Counter Register +ADC_PTCR # 4 ;- PDC Transfer Control Register +ADC_PTSR # 4 ;- PDC Transfer Status Register +;- -------- ADC_CR : (ADC Offset: 0x0) ADC Control Register -------- +AT91C_ADC_SWRST EQU (0x1:SHL:0) ;- (ADC) Software Reset +AT91C_ADC_START EQU (0x1:SHL:1) ;- (ADC) Start Conversion +;- -------- ADC_MR : (ADC Offset: 0x4) ADC Mode Register -------- +AT91C_ADC_TRGEN EQU (0x1:SHL:0) ;- (ADC) Trigger Enable +AT91C_ADC_TRGEN_DIS EQU (0x0) ;- (ADC) Hradware triggers are disabled. Starting a conversion is only possible by software +AT91C_ADC_TRGEN_EN EQU (0x1) ;- (ADC) Hardware trigger selected by TRGSEL field is enabled. +AT91C_ADC_TRGSEL EQU (0x7:SHL:1) ;- (ADC) Trigger Selection +AT91C_ADC_TRGSEL_TIOA0 EQU (0x0:SHL:1) ;- (ADC) Selected TRGSEL = TIAO0 +AT91C_ADC_TRGSEL_TIOA1 EQU (0x1:SHL:1) ;- (ADC) Selected TRGSEL = TIAO1 +AT91C_ADC_TRGSEL_TIOA2 EQU (0x2:SHL:1) ;- (ADC) Selected TRGSEL = TIAO2 +AT91C_ADC_TRGSEL_TIOA3 EQU (0x3:SHL:1) ;- (ADC) Selected TRGSEL = TIAO3 +AT91C_ADC_TRGSEL_TIOA4 EQU (0x4:SHL:1) ;- (ADC) Selected TRGSEL = TIAO4 +AT91C_ADC_TRGSEL_TIOA5 EQU (0x5:SHL:1) ;- (ADC) Selected TRGSEL = TIAO5 +AT91C_ADC_TRGSEL_EXT EQU (0x6:SHL:1) ;- (ADC) Selected TRGSEL = External Trigger +AT91C_ADC_LOWRES EQU (0x1:SHL:4) ;- (ADC) Resolution. +AT91C_ADC_LOWRES_10_BIT EQU (0x0:SHL:4) ;- (ADC) 10-bit resolution +AT91C_ADC_LOWRES_8_BIT EQU (0x1:SHL:4) ;- (ADC) 8-bit resolution +AT91C_ADC_SLEEP EQU (0x1:SHL:5) ;- (ADC) Sleep Mode +AT91C_ADC_SLEEP_NORMAL_MODE EQU (0x0:SHL:5) ;- (ADC) Normal Mode +AT91C_ADC_SLEEP_MODE EQU (0x1:SHL:5) ;- (ADC) Sleep Mode +AT91C_ADC_PRESCAL EQU (0x3F:SHL:8) ;- (ADC) Prescaler rate selection +AT91C_ADC_STARTUP EQU (0x1F:SHL:16) ;- (ADC) Startup Time +AT91C_ADC_SHTIM EQU (0xF:SHL:24) ;- (ADC) Sample & Hold Time +;- -------- ADC_CHER : (ADC Offset: 0x10) ADC Channel Enable Register -------- +AT91C_ADC_CH0 EQU (0x1:SHL:0) ;- (ADC) Channel 0 +AT91C_ADC_CH1 EQU (0x1:SHL:1) ;- (ADC) Channel 1 +AT91C_ADC_CH2 EQU (0x1:SHL:2) ;- (ADC) Channel 2 +AT91C_ADC_CH3 EQU (0x1:SHL:3) ;- (ADC) Channel 3 +AT91C_ADC_CH4 EQU (0x1:SHL:4) ;- (ADC) Channel 4 +AT91C_ADC_CH5 EQU (0x1:SHL:5) ;- (ADC) Channel 5 +AT91C_ADC_CH6 EQU (0x1:SHL:6) ;- (ADC) Channel 6 +AT91C_ADC_CH7 EQU (0x1:SHL:7) ;- (ADC) Channel 7 +;- -------- ADC_CHDR : (ADC Offset: 0x14) ADC Channel Disable Register -------- +;- -------- ADC_CHSR : (ADC Offset: 0x18) ADC Channel Status Register -------- +;- -------- ADC_SR : (ADC Offset: 0x1c) ADC Status Register -------- +AT91C_ADC_EOC0 EQU (0x1:SHL:0) ;- (ADC) End of Conversion +AT91C_ADC_EOC1 EQU (0x1:SHL:1) ;- (ADC) End of Conversion +AT91C_ADC_EOC2 EQU (0x1:SHL:2) ;- (ADC) End of Conversion +AT91C_ADC_EOC3 EQU (0x1:SHL:3) ;- (ADC) End of Conversion +AT91C_ADC_EOC4 EQU (0x1:SHL:4) ;- (ADC) End of Conversion +AT91C_ADC_EOC5 EQU (0x1:SHL:5) ;- (ADC) End of Conversion +AT91C_ADC_EOC6 EQU (0x1:SHL:6) ;- (ADC) End of Conversion +AT91C_ADC_EOC7 EQU (0x1:SHL:7) ;- (ADC) End of Conversion +AT91C_ADC_OVRE0 EQU (0x1:SHL:8) ;- (ADC) Overrun Error +AT91C_ADC_OVRE1 EQU (0x1:SHL:9) ;- (ADC) Overrun Error +AT91C_ADC_OVRE2 EQU (0x1:SHL:10) ;- (ADC) Overrun Error +AT91C_ADC_OVRE3 EQU (0x1:SHL:11) ;- (ADC) Overrun Error +AT91C_ADC_OVRE4 EQU (0x1:SHL:12) ;- (ADC) Overrun Error +AT91C_ADC_OVRE5 EQU (0x1:SHL:13) ;- (ADC) Overrun Error +AT91C_ADC_OVRE6 EQU (0x1:SHL:14) ;- (ADC) Overrun Error +AT91C_ADC_OVRE7 EQU (0x1:SHL:15) ;- (ADC) Overrun Error +AT91C_ADC_DRDY EQU (0x1:SHL:16) ;- (ADC) Data Ready +AT91C_ADC_GOVRE EQU (0x1:SHL:17) ;- (ADC) General Overrun +AT91C_ADC_ENDRX EQU (0x1:SHL:18) ;- (ADC) End of Receiver Transfer +AT91C_ADC_RXBUFF EQU (0x1:SHL:19) ;- (ADC) RXBUFF Interrupt +;- -------- ADC_LCDR : (ADC Offset: 0x20) ADC Last Converted Data Register -------- +AT91C_ADC_LDATA EQU (0x3FF:SHL:0) ;- (ADC) Last Data Converted +;- -------- ADC_IER : (ADC Offset: 0x24) ADC Interrupt Enable Register -------- +;- -------- ADC_IDR : (ADC Offset: 0x28) ADC Interrupt Disable Register -------- +;- -------- ADC_IMR : (ADC Offset: 0x2c) ADC Interrupt Mask Register -------- +;- -------- ADC_CDR0 : (ADC Offset: 0x30) ADC Channel Data Register 0 -------- +AT91C_ADC_DATA EQU (0x3FF:SHL:0) ;- (ADC) Converted Data +;- -------- ADC_CDR1 : (ADC Offset: 0x34) ADC Channel Data Register 1 -------- +;- -------- ADC_CDR2 : (ADC Offset: 0x38) ADC Channel Data Register 2 -------- +;- -------- ADC_CDR3 : (ADC Offset: 0x3c) ADC Channel Data Register 3 -------- +;- -------- ADC_CDR4 : (ADC Offset: 0x40) ADC Channel Data Register 4 -------- +;- -------- ADC_CDR5 : (ADC Offset: 0x44) ADC Channel Data Register 5 -------- +;- -------- ADC_CDR6 : (ADC Offset: 0x48) ADC Channel Data Register 6 -------- +;- -------- ADC_CDR7 : (ADC Offset: 0x4c) ADC Channel Data Register 7 -------- + +;- ***************************************************************************** +;- REGISTER ADDRESS DEFINITION FOR AT91SAM7X256 +;- ***************************************************************************** +;- ========== Register definition for SYS peripheral ========== +;- ========== Register definition for AIC peripheral ========== +AT91C_AIC_IVR EQU (0xFFFFF100) ;- (AIC) IRQ Vector Register +AT91C_AIC_SMR EQU (0xFFFFF000) ;- (AIC) Source Mode Register +AT91C_AIC_FVR EQU (0xFFFFF104) ;- (AIC) FIQ Vector Register +AT91C_AIC_DCR EQU (0xFFFFF138) ;- (AIC) Debug Control Register (Protect) +AT91C_AIC_EOICR EQU (0xFFFFF130) ;- (AIC) End of Interrupt Command Register +AT91C_AIC_SVR EQU (0xFFFFF080) ;- (AIC) Source Vector Register +AT91C_AIC_FFSR EQU (0xFFFFF148) ;- (AIC) Fast Forcing Status Register +AT91C_AIC_ICCR EQU (0xFFFFF128) ;- (AIC) Interrupt Clear Command Register +AT91C_AIC_ISR EQU (0xFFFFF108) ;- (AIC) Interrupt Status Register +AT91C_AIC_IMR EQU (0xFFFFF110) ;- (AIC) Interrupt Mask Register +AT91C_AIC_IPR EQU (0xFFFFF10C) ;- (AIC) Interrupt Pending Register +AT91C_AIC_FFER EQU (0xFFFFF140) ;- (AIC) Fast Forcing Enable Register +AT91C_AIC_IECR EQU (0xFFFFF120) ;- (AIC) Interrupt Enable Command Register +AT91C_AIC_ISCR EQU (0xFFFFF12C) ;- (AIC) Interrupt Set Command Register +AT91C_AIC_FFDR EQU (0xFFFFF144) ;- (AIC) Fast Forcing Disable Register +AT91C_AIC_CISR EQU (0xFFFFF114) ;- (AIC) Core Interrupt Status Register +AT91C_AIC_IDCR EQU (0xFFFFF124) ;- (AIC) Interrupt Disable Command Register +AT91C_AIC_SPU EQU (0xFFFFF134) ;- (AIC) Spurious Vector Register +;- ========== Register definition for PDC_DBGU peripheral ========== +AT91C_DBGU_TCR EQU (0xFFFFF30C) ;- (PDC_DBGU) Transmit Counter Register +AT91C_DBGU_RNPR EQU (0xFFFFF310) ;- (PDC_DBGU) Receive Next Pointer Register +AT91C_DBGU_TNPR EQU (0xFFFFF318) ;- (PDC_DBGU) Transmit Next Pointer Register +AT91C_DBGU_TPR EQU (0xFFFFF308) ;- (PDC_DBGU) Transmit Pointer Register +AT91C_DBGU_RPR EQU (0xFFFFF300) ;- (PDC_DBGU) Receive Pointer Register +AT91C_DBGU_RCR EQU (0xFFFFF304) ;- (PDC_DBGU) Receive Counter Register +AT91C_DBGU_RNCR EQU (0xFFFFF314) ;- (PDC_DBGU) Receive Next Counter Register +AT91C_DBGU_PTCR EQU (0xFFFFF320) ;- (PDC_DBGU) PDC Transfer Control Register +AT91C_DBGU_PTSR EQU (0xFFFFF324) ;- (PDC_DBGU) PDC Transfer Status Register +AT91C_DBGU_TNCR EQU (0xFFFFF31C) ;- (PDC_DBGU) Transmit Next Counter Register +;- ========== Register definition for DBGU peripheral ========== +AT91C_DBGU_EXID EQU (0xFFFFF244) ;- (DBGU) Chip ID Extension Register +AT91C_DBGU_BRGR EQU (0xFFFFF220) ;- (DBGU) Baud Rate Generator Register +AT91C_DBGU_IDR EQU (0xFFFFF20C) ;- (DBGU) Interrupt Disable Register +AT91C_DBGU_CSR EQU (0xFFFFF214) ;- (DBGU) Channel Status Register +AT91C_DBGU_CIDR EQU (0xFFFFF240) ;- (DBGU) Chip ID Register +AT91C_DBGU_MR EQU (0xFFFFF204) ;- (DBGU) Mode Register +AT91C_DBGU_IMR EQU (0xFFFFF210) ;- (DBGU) Interrupt Mask Register +AT91C_DBGU_CR EQU (0xFFFFF200) ;- (DBGU) Control Register +AT91C_DBGU_FNTR EQU (0xFFFFF248) ;- (DBGU) Force NTRST Register +AT91C_DBGU_THR EQU (0xFFFFF21C) ;- (DBGU) Transmitter Holding Register +AT91C_DBGU_RHR EQU (0xFFFFF218) ;- (DBGU) Receiver Holding Register +AT91C_DBGU_IER EQU (0xFFFFF208) ;- (DBGU) Interrupt Enable Register +;- ========== Register definition for PIOA peripheral ========== +AT91C_PIOA_ODR EQU (0xFFFFF414) ;- (PIOA) Output Disable Registerr +AT91C_PIOA_SODR EQU (0xFFFFF430) ;- (PIOA) Set Output Data Register +AT91C_PIOA_ISR EQU (0xFFFFF44C) ;- (PIOA) Interrupt Status Register +AT91C_PIOA_ABSR EQU (0xFFFFF478) ;- (PIOA) AB Select Status Register +AT91C_PIOA_IER EQU (0xFFFFF440) ;- (PIOA) Interrupt Enable Register +AT91C_PIOA_PPUDR EQU (0xFFFFF460) ;- (PIOA) Pull-up Disable Register +AT91C_PIOA_IMR EQU (0xFFFFF448) ;- (PIOA) Interrupt Mask Register +AT91C_PIOA_PER EQU (0xFFFFF400) ;- (PIOA) PIO Enable Register +AT91C_PIOA_IFDR EQU (0xFFFFF424) ;- (PIOA) Input Filter Disable Register +AT91C_PIOA_OWDR EQU (0xFFFFF4A4) ;- (PIOA) Output Write Disable Register +AT91C_PIOA_MDSR EQU (0xFFFFF458) ;- (PIOA) Multi-driver Status Register +AT91C_PIOA_IDR EQU (0xFFFFF444) ;- (PIOA) Interrupt Disable Register +AT91C_PIOA_ODSR EQU (0xFFFFF438) ;- (PIOA) Output Data Status Register +AT91C_PIOA_PPUSR EQU (0xFFFFF468) ;- (PIOA) Pull-up Status Register +AT91C_PIOA_OWSR EQU (0xFFFFF4A8) ;- (PIOA) Output Write Status Register +AT91C_PIOA_BSR EQU (0xFFFFF474) ;- (PIOA) Select B Register +AT91C_PIOA_OWER EQU (0xFFFFF4A0) ;- (PIOA) Output Write Enable Register +AT91C_PIOA_IFER EQU (0xFFFFF420) ;- (PIOA) Input Filter Enable Register +AT91C_PIOA_PDSR EQU (0xFFFFF43C) ;- (PIOA) Pin Data Status Register +AT91C_PIOA_PPUER EQU (0xFFFFF464) ;- (PIOA) Pull-up Enable Register +AT91C_PIOA_OSR EQU (0xFFFFF418) ;- (PIOA) Output Status Register +AT91C_PIOA_ASR EQU (0xFFFFF470) ;- (PIOA) Select A Register +AT91C_PIOA_MDDR EQU (0xFFFFF454) ;- (PIOA) Multi-driver Disable Register +AT91C_PIOA_CODR EQU (0xFFFFF434) ;- (PIOA) Clear Output Data Register +AT91C_PIOA_MDER EQU (0xFFFFF450) ;- (PIOA) Multi-driver Enable Register +AT91C_PIOA_PDR EQU (0xFFFFF404) ;- (PIOA) PIO Disable Register +AT91C_PIOA_IFSR EQU (0xFFFFF428) ;- (PIOA) Input Filter Status Register +AT91C_PIOA_OER EQU (0xFFFFF410) ;- (PIOA) Output Enable Register +AT91C_PIOA_PSR EQU (0xFFFFF408) ;- (PIOA) PIO Status Register +;- ========== Register definition for PIOB peripheral ========== +AT91C_PIOB_OWDR EQU (0xFFFFF6A4) ;- (PIOB) Output Write Disable Register +AT91C_PIOB_MDER EQU (0xFFFFF650) ;- (PIOB) Multi-driver Enable Register +AT91C_PIOB_PPUSR EQU (0xFFFFF668) ;- (PIOB) Pull-up Status Register +AT91C_PIOB_IMR EQU (0xFFFFF648) ;- (PIOB) Interrupt Mask Register +AT91C_PIOB_ASR EQU (0xFFFFF670) ;- (PIOB) Select A Register +AT91C_PIOB_PPUDR EQU (0xFFFFF660) ;- (PIOB) Pull-up Disable Register +AT91C_PIOB_PSR EQU (0xFFFFF608) ;- (PIOB) PIO Status Register +AT91C_PIOB_IER EQU (0xFFFFF640) ;- (PIOB) Interrupt Enable Register +AT91C_PIOB_CODR EQU (0xFFFFF634) ;- (PIOB) Clear Output Data Register +AT91C_PIOB_OWER EQU (0xFFFFF6A0) ;- (PIOB) Output Write Enable Register +AT91C_PIOB_ABSR EQU (0xFFFFF678) ;- (PIOB) AB Select Status Register +AT91C_PIOB_IFDR EQU (0xFFFFF624) ;- (PIOB) Input Filter Disable Register +AT91C_PIOB_PDSR EQU (0xFFFFF63C) ;- (PIOB) Pin Data Status Register +AT91C_PIOB_IDR EQU (0xFFFFF644) ;- (PIOB) Interrupt Disable Register +AT91C_PIOB_OWSR EQU (0xFFFFF6A8) ;- (PIOB) Output Write Status Register +AT91C_PIOB_PDR EQU (0xFFFFF604) ;- (PIOB) PIO Disable Register +AT91C_PIOB_ODR EQU (0xFFFFF614) ;- (PIOB) Output Disable Registerr +AT91C_PIOB_IFSR EQU (0xFFFFF628) ;- (PIOB) Input Filter Status Register +AT91C_PIOB_PPUER EQU (0xFFFFF664) ;- (PIOB) Pull-up Enable Register +AT91C_PIOB_SODR EQU (0xFFFFF630) ;- (PIOB) Set Output Data Register +AT91C_PIOB_ISR EQU (0xFFFFF64C) ;- (PIOB) Interrupt Status Register +AT91C_PIOB_ODSR EQU (0xFFFFF638) ;- (PIOB) Output Data Status Register +AT91C_PIOB_OSR EQU (0xFFFFF618) ;- (PIOB) Output Status Register +AT91C_PIOB_MDSR EQU (0xFFFFF658) ;- (PIOB) Multi-driver Status Register +AT91C_PIOB_IFER EQU (0xFFFFF620) ;- (PIOB) Input Filter Enable Register +AT91C_PIOB_BSR EQU (0xFFFFF674) ;- (PIOB) Select B Register +AT91C_PIOB_MDDR EQU (0xFFFFF654) ;- (PIOB) Multi-driver Disable Register +AT91C_PIOB_OER EQU (0xFFFFF610) ;- (PIOB) Output Enable Register +AT91C_PIOB_PER EQU (0xFFFFF600) ;- (PIOB) PIO Enable Register +;- ========== Register definition for CKGR peripheral ========== +AT91C_CKGR_MOR EQU (0xFFFFFC20) ;- (CKGR) Main Oscillator Register +AT91C_CKGR_PLLR EQU (0xFFFFFC2C) ;- (CKGR) PLL Register +AT91C_CKGR_MCFR EQU (0xFFFFFC24) ;- (CKGR) Main Clock Frequency Register +;- ========== Register definition for PMC peripheral ========== +AT91C_PMC_IDR EQU (0xFFFFFC64) ;- (PMC) Interrupt Disable Register +AT91C_PMC_MOR EQU (0xFFFFFC20) ;- (PMC) Main Oscillator Register +AT91C_PMC_PLLR EQU (0xFFFFFC2C) ;- (PMC) PLL Register +AT91C_PMC_PCER EQU (0xFFFFFC10) ;- (PMC) Peripheral Clock Enable Register +AT91C_PMC_PCKR EQU (0xFFFFFC40) ;- (PMC) Programmable Clock Register +AT91C_PMC_MCKR EQU (0xFFFFFC30) ;- (PMC) Master Clock Register +AT91C_PMC_SCDR EQU (0xFFFFFC04) ;- (PMC) System Clock Disable Register +AT91C_PMC_PCDR EQU (0xFFFFFC14) ;- (PMC) Peripheral Clock Disable Register +AT91C_PMC_SCSR EQU (0xFFFFFC08) ;- (PMC) System Clock Status Register +AT91C_PMC_PCSR EQU (0xFFFFFC18) ;- (PMC) Peripheral Clock Status Register +AT91C_PMC_MCFR EQU (0xFFFFFC24) ;- (PMC) Main Clock Frequency Register +AT91C_PMC_SCER EQU (0xFFFFFC00) ;- (PMC) System Clock Enable Register +AT91C_PMC_IMR EQU (0xFFFFFC6C) ;- (PMC) Interrupt Mask Register +AT91C_PMC_IER EQU (0xFFFFFC60) ;- (PMC) Interrupt Enable Register +AT91C_PMC_SR EQU (0xFFFFFC68) ;- (PMC) Status Register +;- ========== Register definition for RSTC peripheral ========== +AT91C_RSTC_RCR EQU (0xFFFFFD00) ;- (RSTC) Reset Control Register +AT91C_RSTC_RMR EQU (0xFFFFFD08) ;- (RSTC) Reset Mode Register +AT91C_RSTC_RSR EQU (0xFFFFFD04) ;- (RSTC) Reset Status Register +;- ========== Register definition for RTTC peripheral ========== +AT91C_RTTC_RTSR EQU (0xFFFFFD2C) ;- (RTTC) Real-time Status Register +AT91C_RTTC_RTMR EQU (0xFFFFFD20) ;- (RTTC) Real-time Mode Register +AT91C_RTTC_RTVR EQU (0xFFFFFD28) ;- (RTTC) Real-time Value Register +AT91C_RTTC_RTAR EQU (0xFFFFFD24) ;- (RTTC) Real-time Alarm Register +;- ========== Register definition for PITC peripheral ========== +AT91C_PITC_PIVR EQU (0xFFFFFD38) ;- (PITC) Period Interval Value Register +AT91C_PITC_PISR EQU (0xFFFFFD34) ;- (PITC) Period Interval Status Register +AT91C_PITC_PIIR EQU (0xFFFFFD3C) ;- (PITC) Period Interval Image Register +AT91C_PITC_PIMR EQU (0xFFFFFD30) ;- (PITC) Period Interval Mode Register +;- ========== Register definition for WDTC peripheral ========== +AT91C_WDTC_WDCR EQU (0xFFFFFD40) ;- (WDTC) Watchdog Control Register +AT91C_WDTC_WDSR EQU (0xFFFFFD48) ;- (WDTC) Watchdog Status Register +AT91C_WDTC_WDMR EQU (0xFFFFFD44) ;- (WDTC) Watchdog Mode Register +;- ========== Register definition for VREG peripheral ========== +AT91C_VREG_MR EQU (0xFFFFFD60) ;- (VREG) Voltage Regulator Mode Register +;- ========== Register definition for MC peripheral ========== +AT91C_MC_ASR EQU (0xFFFFFF04) ;- (MC) MC Abort Status Register +AT91C_MC_RCR EQU (0xFFFFFF00) ;- (MC) MC Remap Control Register +AT91C_MC_FCR EQU (0xFFFFFF64) ;- (MC) MC Flash Command Register +AT91C_MC_AASR EQU (0xFFFFFF08) ;- (MC) MC Abort Address Status Register +AT91C_MC_FSR EQU (0xFFFFFF68) ;- (MC) MC Flash Status Register +AT91C_MC_FMR EQU (0xFFFFFF60) ;- (MC) MC Flash Mode Register +;- ========== Register definition for PDC_SPI1 peripheral ========== +AT91C_SPI1_PTCR EQU (0xFFFE4120) ;- (PDC_SPI1) PDC Transfer Control Register +AT91C_SPI1_RPR EQU (0xFFFE4100) ;- (PDC_SPI1) Receive Pointer Register +AT91C_SPI1_TNCR EQU (0xFFFE411C) ;- (PDC_SPI1) Transmit Next Counter Register +AT91C_SPI1_TPR EQU (0xFFFE4108) ;- (PDC_SPI1) Transmit Pointer Register +AT91C_SPI1_TNPR EQU (0xFFFE4118) ;- (PDC_SPI1) Transmit Next Pointer Register +AT91C_SPI1_TCR EQU (0xFFFE410C) ;- (PDC_SPI1) Transmit Counter Register +AT91C_SPI1_RCR EQU (0xFFFE4104) ;- (PDC_SPI1) Receive Counter Register +AT91C_SPI1_RNPR EQU (0xFFFE4110) ;- (PDC_SPI1) Receive Next Pointer Register +AT91C_SPI1_RNCR EQU (0xFFFE4114) ;- (PDC_SPI1) Receive Next Counter Register +AT91C_SPI1_PTSR EQU (0xFFFE4124) ;- (PDC_SPI1) PDC Transfer Status Register +;- ========== Register definition for SPI1 peripheral ========== +AT91C_SPI1_IMR EQU (0xFFFE401C) ;- (SPI1) Interrupt Mask Register +AT91C_SPI1_IER EQU (0xFFFE4014) ;- (SPI1) Interrupt Enable Register +AT91C_SPI1_MR EQU (0xFFFE4004) ;- (SPI1) Mode Register +AT91C_SPI1_RDR EQU (0xFFFE4008) ;- (SPI1) Receive Data Register +AT91C_SPI1_IDR EQU (0xFFFE4018) ;- (SPI1) Interrupt Disable Register +AT91C_SPI1_SR EQU (0xFFFE4010) ;- (SPI1) Status Register +AT91C_SPI1_TDR EQU (0xFFFE400C) ;- (SPI1) Transmit Data Register +AT91C_SPI1_CR EQU (0xFFFE4000) ;- (SPI1) Control Register +AT91C_SPI1_CSR EQU (0xFFFE4030) ;- (SPI1) Chip Select Register +;- ========== Register definition for PDC_SPI0 peripheral ========== +AT91C_SPI0_PTCR EQU (0xFFFE0120) ;- (PDC_SPI0) PDC Transfer Control Register +AT91C_SPI0_TPR EQU (0xFFFE0108) ;- (PDC_SPI0) Transmit Pointer Register +AT91C_SPI0_TCR EQU (0xFFFE010C) ;- (PDC_SPI0) Transmit Counter Register +AT91C_SPI0_RCR EQU (0xFFFE0104) ;- (PDC_SPI0) Receive Counter Register +AT91C_SPI0_PTSR EQU (0xFFFE0124) ;- (PDC_SPI0) PDC Transfer Status Register +AT91C_SPI0_RNPR EQU (0xFFFE0110) ;- (PDC_SPI0) Receive Next Pointer Register +AT91C_SPI0_RPR EQU (0xFFFE0100) ;- (PDC_SPI0) Receive Pointer Register +AT91C_SPI0_TNCR EQU (0xFFFE011C) ;- (PDC_SPI0) Transmit Next Counter Register +AT91C_SPI0_RNCR EQU (0xFFFE0114) ;- (PDC_SPI0) Receive Next Counter Register +AT91C_SPI0_TNPR EQU (0xFFFE0118) ;- (PDC_SPI0) Transmit Next Pointer Register +;- ========== Register definition for SPI0 peripheral ========== +AT91C_SPI0_IER EQU (0xFFFE0014) ;- (SPI0) Interrupt Enable Register +AT91C_SPI0_SR EQU (0xFFFE0010) ;- (SPI0) Status Register +AT91C_SPI0_IDR EQU (0xFFFE0018) ;- (SPI0) Interrupt Disable Register +AT91C_SPI0_CR EQU (0xFFFE0000) ;- (SPI0) Control Register +AT91C_SPI0_MR EQU (0xFFFE0004) ;- (SPI0) Mode Register +AT91C_SPI0_IMR EQU (0xFFFE001C) ;- (SPI0) Interrupt Mask Register +AT91C_SPI0_TDR EQU (0xFFFE000C) ;- (SPI0) Transmit Data Register +AT91C_SPI0_RDR EQU (0xFFFE0008) ;- (SPI0) Receive Data Register +AT91C_SPI0_CSR EQU (0xFFFE0030) ;- (SPI0) Chip Select Register +;- ========== Register definition for PDC_US1 peripheral ========== +AT91C_US1_RNCR EQU (0xFFFC4114) ;- (PDC_US1) Receive Next Counter Register +AT91C_US1_PTCR EQU (0xFFFC4120) ;- (PDC_US1) PDC Transfer Control Register +AT91C_US1_TCR EQU (0xFFFC410C) ;- (PDC_US1) Transmit Counter Register +AT91C_US1_PTSR EQU (0xFFFC4124) ;- (PDC_US1) PDC Transfer Status Register +AT91C_US1_TNPR EQU (0xFFFC4118) ;- (PDC_US1) Transmit Next Pointer Register +AT91C_US1_RCR EQU (0xFFFC4104) ;- (PDC_US1) Receive Counter Register +AT91C_US1_RNPR EQU (0xFFFC4110) ;- (PDC_US1) Receive Next Pointer Register +AT91C_US1_RPR EQU (0xFFFC4100) ;- (PDC_US1) Receive Pointer Register +AT91C_US1_TNCR EQU (0xFFFC411C) ;- (PDC_US1) Transmit Next Counter Register +AT91C_US1_TPR EQU (0xFFFC4108) ;- (PDC_US1) Transmit Pointer Register +;- ========== Register definition for US1 peripheral ========== +AT91C_US1_IF EQU (0xFFFC404C) ;- (US1) IRDA_FILTER Register +AT91C_US1_NER EQU (0xFFFC4044) ;- (US1) Nb Errors Register +AT91C_US1_RTOR EQU (0xFFFC4024) ;- (US1) Receiver Time-out Register +AT91C_US1_CSR EQU (0xFFFC4014) ;- (US1) Channel Status Register +AT91C_US1_IDR EQU (0xFFFC400C) ;- (US1) Interrupt Disable Register +AT91C_US1_IER EQU (0xFFFC4008) ;- (US1) Interrupt Enable Register +AT91C_US1_THR EQU (0xFFFC401C) ;- (US1) Transmitter Holding Register +AT91C_US1_TTGR EQU (0xFFFC4028) ;- (US1) Transmitter Time-guard Register +AT91C_US1_RHR EQU (0xFFFC4018) ;- (US1) Receiver Holding Register +AT91C_US1_BRGR EQU (0xFFFC4020) ;- (US1) Baud Rate Generator Register +AT91C_US1_IMR EQU (0xFFFC4010) ;- (US1) Interrupt Mask Register +AT91C_US1_FIDI EQU (0xFFFC4040) ;- (US1) FI_DI_Ratio Register +AT91C_US1_CR EQU (0xFFFC4000) ;- (US1) Control Register +AT91C_US1_MR EQU (0xFFFC4004) ;- (US1) Mode Register +;- ========== Register definition for PDC_US0 peripheral ========== +AT91C_US0_TNPR EQU (0xFFFC0118) ;- (PDC_US0) Transmit Next Pointer Register +AT91C_US0_RNPR EQU (0xFFFC0110) ;- (PDC_US0) Receive Next Pointer Register +AT91C_US0_TCR EQU (0xFFFC010C) ;- (PDC_US0) Transmit Counter Register +AT91C_US0_PTCR EQU (0xFFFC0120) ;- (PDC_US0) PDC Transfer Control Register +AT91C_US0_PTSR EQU (0xFFFC0124) ;- (PDC_US0) PDC Transfer Status Register +AT91C_US0_TNCR EQU (0xFFFC011C) ;- (PDC_US0) Transmit Next Counter Register +AT91C_US0_TPR EQU (0xFFFC0108) ;- (PDC_US0) Transmit Pointer Register +AT91C_US0_RCR EQU (0xFFFC0104) ;- (PDC_US0) Receive Counter Register +AT91C_US0_RPR EQU (0xFFFC0100) ;- (PDC_US0) Receive Pointer Register +AT91C_US0_RNCR EQU (0xFFFC0114) ;- (PDC_US0) Receive Next Counter Register +;- ========== Register definition for US0 peripheral ========== +AT91C_US0_BRGR EQU (0xFFFC0020) ;- (US0) Baud Rate Generator Register +AT91C_US0_NER EQU (0xFFFC0044) ;- (US0) Nb Errors Register +AT91C_US0_CR EQU (0xFFFC0000) ;- (US0) Control Register +AT91C_US0_IMR EQU (0xFFFC0010) ;- (US0) Interrupt Mask Register +AT91C_US0_FIDI EQU (0xFFFC0040) ;- (US0) FI_DI_Ratio Register +AT91C_US0_TTGR EQU (0xFFFC0028) ;- (US0) Transmitter Time-guard Register +AT91C_US0_MR EQU (0xFFFC0004) ;- (US0) Mode Register +AT91C_US0_RTOR EQU (0xFFFC0024) ;- (US0) Receiver Time-out Register +AT91C_US0_CSR EQU (0xFFFC0014) ;- (US0) Channel Status Register +AT91C_US0_RHR EQU (0xFFFC0018) ;- (US0) Receiver Holding Register +AT91C_US0_IDR EQU (0xFFFC000C) ;- (US0) Interrupt Disable Register +AT91C_US0_THR EQU (0xFFFC001C) ;- (US0) Transmitter Holding Register +AT91C_US0_IF EQU (0xFFFC004C) ;- (US0) IRDA_FILTER Register +AT91C_US0_IER EQU (0xFFFC0008) ;- (US0) Interrupt Enable Register +;- ========== Register definition for PDC_SSC peripheral ========== +AT91C_SSC_TNCR EQU (0xFFFD411C) ;- (PDC_SSC) Transmit Next Counter Register +AT91C_SSC_RPR EQU (0xFFFD4100) ;- (PDC_SSC) Receive Pointer Register +AT91C_SSC_RNCR EQU (0xFFFD4114) ;- (PDC_SSC) Receive Next Counter Register +AT91C_SSC_TPR EQU (0xFFFD4108) ;- (PDC_SSC) Transmit Pointer Register +AT91C_SSC_PTCR EQU (0xFFFD4120) ;- (PDC_SSC) PDC Transfer Control Register +AT91C_SSC_TCR EQU (0xFFFD410C) ;- (PDC_SSC) Transmit Counter Register +AT91C_SSC_RCR EQU (0xFFFD4104) ;- (PDC_SSC) Receive Counter Register +AT91C_SSC_RNPR EQU (0xFFFD4110) ;- (PDC_SSC) Receive Next Pointer Register +AT91C_SSC_TNPR EQU (0xFFFD4118) ;- (PDC_SSC) Transmit Next Pointer Register +AT91C_SSC_PTSR EQU (0xFFFD4124) ;- (PDC_SSC) PDC Transfer Status Register +;- ========== Register definition for SSC peripheral ========== +AT91C_SSC_RHR EQU (0xFFFD4020) ;- (SSC) Receive Holding Register +AT91C_SSC_RSHR EQU (0xFFFD4030) ;- (SSC) Receive Sync Holding Register +AT91C_SSC_TFMR EQU (0xFFFD401C) ;- (SSC) Transmit Frame Mode Register +AT91C_SSC_IDR EQU (0xFFFD4048) ;- (SSC) Interrupt Disable Register +AT91C_SSC_THR EQU (0xFFFD4024) ;- (SSC) Transmit Holding Register +AT91C_SSC_RCMR EQU (0xFFFD4010) ;- (SSC) Receive Clock ModeRegister +AT91C_SSC_IER EQU (0xFFFD4044) ;- (SSC) Interrupt Enable Register +AT91C_SSC_TSHR EQU (0xFFFD4034) ;- (SSC) Transmit Sync Holding Register +AT91C_SSC_SR EQU (0xFFFD4040) ;- (SSC) Status Register +AT91C_SSC_CMR EQU (0xFFFD4004) ;- (SSC) Clock Mode Register +AT91C_SSC_TCMR EQU (0xFFFD4018) ;- (SSC) Transmit Clock Mode Register +AT91C_SSC_CR EQU (0xFFFD4000) ;- (SSC) Control Register +AT91C_SSC_IMR EQU (0xFFFD404C) ;- (SSC) Interrupt Mask Register +AT91C_SSC_RFMR EQU (0xFFFD4014) ;- (SSC) Receive Frame Mode Register +;- ========== Register definition for TWI peripheral ========== +AT91C_TWI_IER EQU (0xFFFB8024) ;- (TWI) Interrupt Enable Register +AT91C_TWI_CR EQU (0xFFFB8000) ;- (TWI) Control Register +AT91C_TWI_SR EQU (0xFFFB8020) ;- (TWI) Status Register +AT91C_TWI_IMR EQU (0xFFFB802C) ;- (TWI) Interrupt Mask Register +AT91C_TWI_THR EQU (0xFFFB8034) ;- (TWI) Transmit Holding Register +AT91C_TWI_IDR EQU (0xFFFB8028) ;- (TWI) Interrupt Disable Register +AT91C_TWI_IADR EQU (0xFFFB800C) ;- (TWI) Internal Address Register +AT91C_TWI_MMR EQU (0xFFFB8004) ;- (TWI) Master Mode Register +AT91C_TWI_CWGR EQU (0xFFFB8010) ;- (TWI) Clock Waveform Generator Register +AT91C_TWI_RHR EQU (0xFFFB8030) ;- (TWI) Receive Holding Register +;- ========== Register definition for PWMC_CH3 peripheral ========== +AT91C_PWMC_CH3_CUPDR EQU (0xFFFCC270) ;- (PWMC_CH3) Channel Update Register +AT91C_PWMC_CH3_Reserved EQU (0xFFFCC274) ;- (PWMC_CH3) Reserved +AT91C_PWMC_CH3_CPRDR EQU (0xFFFCC268) ;- (PWMC_CH3) Channel Period Register +AT91C_PWMC_CH3_CDTYR EQU (0xFFFCC264) ;- (PWMC_CH3) Channel Duty Cycle Register +AT91C_PWMC_CH3_CCNTR EQU (0xFFFCC26C) ;- (PWMC_CH3) Channel Counter Register +AT91C_PWMC_CH3_CMR EQU (0xFFFCC260) ;- (PWMC_CH3) Channel Mode Register +;- ========== Register definition for PWMC_CH2 peripheral ========== +AT91C_PWMC_CH2_Reserved EQU (0xFFFCC254) ;- (PWMC_CH2) Reserved +AT91C_PWMC_CH2_CMR EQU (0xFFFCC240) ;- (PWMC_CH2) Channel Mode Register +AT91C_PWMC_CH2_CCNTR EQU (0xFFFCC24C) ;- (PWMC_CH2) Channel Counter Register +AT91C_PWMC_CH2_CPRDR EQU (0xFFFCC248) ;- (PWMC_CH2) Channel Period Register +AT91C_PWMC_CH2_CUPDR EQU (0xFFFCC250) ;- (PWMC_CH2) Channel Update Register +AT91C_PWMC_CH2_CDTYR EQU (0xFFFCC244) ;- (PWMC_CH2) Channel Duty Cycle Register +;- ========== Register definition for PWMC_CH1 peripheral ========== +AT91C_PWMC_CH1_Reserved EQU (0xFFFCC234) ;- (PWMC_CH1) Reserved +AT91C_PWMC_CH1_CUPDR EQU (0xFFFCC230) ;- (PWMC_CH1) Channel Update Register +AT91C_PWMC_CH1_CPRDR EQU (0xFFFCC228) ;- (PWMC_CH1) Channel Period Register +AT91C_PWMC_CH1_CCNTR EQU (0xFFFCC22C) ;- (PWMC_CH1) Channel Counter Register +AT91C_PWMC_CH1_CDTYR EQU (0xFFFCC224) ;- (PWMC_CH1) Channel Duty Cycle Register +AT91C_PWMC_CH1_CMR EQU (0xFFFCC220) ;- (PWMC_CH1) Channel Mode Register +;- ========== Register definition for PWMC_CH0 peripheral ========== +AT91C_PWMC_CH0_Reserved EQU (0xFFFCC214) ;- (PWMC_CH0) Reserved +AT91C_PWMC_CH0_CPRDR EQU (0xFFFCC208) ;- (PWMC_CH0) Channel Period Register +AT91C_PWMC_CH0_CDTYR EQU (0xFFFCC204) ;- (PWMC_CH0) Channel Duty Cycle Register +AT91C_PWMC_CH0_CMR EQU (0xFFFCC200) ;- (PWMC_CH0) Channel Mode Register +AT91C_PWMC_CH0_CUPDR EQU (0xFFFCC210) ;- (PWMC_CH0) Channel Update Register +AT91C_PWMC_CH0_CCNTR EQU (0xFFFCC20C) ;- (PWMC_CH0) Channel Counter Register +;- ========== Register definition for PWMC peripheral ========== +AT91C_PWMC_IDR EQU (0xFFFCC014) ;- (PWMC) PWMC Interrupt Disable Register +AT91C_PWMC_DIS EQU (0xFFFCC008) ;- (PWMC) PWMC Disable Register +AT91C_PWMC_IER EQU (0xFFFCC010) ;- (PWMC) PWMC Interrupt Enable Register +AT91C_PWMC_VR EQU (0xFFFCC0FC) ;- (PWMC) PWMC Version Register +AT91C_PWMC_ISR EQU (0xFFFCC01C) ;- (PWMC) PWMC Interrupt Status Register +AT91C_PWMC_SR EQU (0xFFFCC00C) ;- (PWMC) PWMC Status Register +AT91C_PWMC_IMR EQU (0xFFFCC018) ;- (PWMC) PWMC Interrupt Mask Register +AT91C_PWMC_MR EQU (0xFFFCC000) ;- (PWMC) PWMC Mode Register +AT91C_PWMC_ENA EQU (0xFFFCC004) ;- (PWMC) PWMC Enable Register +;- ========== Register definition for UDP peripheral ========== +AT91C_UDP_IMR EQU (0xFFFB0018) ;- (UDP) Interrupt Mask Register +AT91C_UDP_FADDR EQU (0xFFFB0008) ;- (UDP) Function Address Register +AT91C_UDP_NUM EQU (0xFFFB0000) ;- (UDP) Frame Number Register +AT91C_UDP_FDR EQU (0xFFFB0050) ;- (UDP) Endpoint FIFO Data Register +AT91C_UDP_ISR EQU (0xFFFB001C) ;- (UDP) Interrupt Status Register +AT91C_UDP_CSR EQU (0xFFFB0030) ;- (UDP) Endpoint Control and Status Register +AT91C_UDP_IDR EQU (0xFFFB0014) ;- (UDP) Interrupt Disable Register +AT91C_UDP_ICR EQU (0xFFFB0020) ;- (UDP) Interrupt Clear Register +AT91C_UDP_RSTEP EQU (0xFFFB0028) ;- (UDP) Reset Endpoint Register +AT91C_UDP_TXVC EQU (0xFFFB0074) ;- (UDP) Transceiver Control Register +AT91C_UDP_GLBSTATE EQU (0xFFFB0004) ;- (UDP) Global State Register +AT91C_UDP_IER EQU (0xFFFB0010) ;- (UDP) Interrupt Enable Register +;- ========== Register definition for TC0 peripheral ========== +AT91C_TC0_SR EQU (0xFFFA0020) ;- (TC0) Status Register +AT91C_TC0_RC EQU (0xFFFA001C) ;- (TC0) Register C +AT91C_TC0_RB EQU (0xFFFA0018) ;- (TC0) Register B +AT91C_TC0_CCR EQU (0xFFFA0000) ;- (TC0) Channel Control Register +AT91C_TC0_CMR EQU (0xFFFA0004) ;- (TC0) Channel Mode Register (Capture Mode / Waveform Mode) +AT91C_TC0_IER EQU (0xFFFA0024) ;- (TC0) Interrupt Enable Register +AT91C_TC0_RA EQU (0xFFFA0014) ;- (TC0) Register A +AT91C_TC0_IDR EQU (0xFFFA0028) ;- (TC0) Interrupt Disable Register +AT91C_TC0_CV EQU (0xFFFA0010) ;- (TC0) Counter Value +AT91C_TC0_IMR EQU (0xFFFA002C) ;- (TC0) Interrupt Mask Register +;- ========== Register definition for TC1 peripheral ========== +AT91C_TC1_RB EQU (0xFFFA0058) ;- (TC1) Register B +AT91C_TC1_CCR EQU (0xFFFA0040) ;- (TC1) Channel Control Register +AT91C_TC1_IER EQU (0xFFFA0064) ;- (TC1) Interrupt Enable Register +AT91C_TC1_IDR EQU (0xFFFA0068) ;- (TC1) Interrupt Disable Register +AT91C_TC1_SR EQU (0xFFFA0060) ;- (TC1) Status Register +AT91C_TC1_CMR EQU (0xFFFA0044) ;- (TC1) Channel Mode Register (Capture Mode / Waveform Mode) +AT91C_TC1_RA EQU (0xFFFA0054) ;- (TC1) Register A +AT91C_TC1_RC EQU (0xFFFA005C) ;- (TC1) Register C +AT91C_TC1_IMR EQU (0xFFFA006C) ;- (TC1) Interrupt Mask Register +AT91C_TC1_CV EQU (0xFFFA0050) ;- (TC1) Counter Value +;- ========== Register definition for TC2 peripheral ========== +AT91C_TC2_CMR EQU (0xFFFA0084) ;- (TC2) Channel Mode Register (Capture Mode / Waveform Mode) +AT91C_TC2_CCR EQU (0xFFFA0080) ;- (TC2) Channel Control Register +AT91C_TC2_CV EQU (0xFFFA0090) ;- (TC2) Counter Value +AT91C_TC2_RA EQU (0xFFFA0094) ;- (TC2) Register A +AT91C_TC2_RB EQU (0xFFFA0098) ;- (TC2) Register B +AT91C_TC2_IDR EQU (0xFFFA00A8) ;- (TC2) Interrupt Disable Register +AT91C_TC2_IMR EQU (0xFFFA00AC) ;- (TC2) Interrupt Mask Register +AT91C_TC2_RC EQU (0xFFFA009C) ;- (TC2) Register C +AT91C_TC2_IER EQU (0xFFFA00A4) ;- (TC2) Interrupt Enable Register +AT91C_TC2_SR EQU (0xFFFA00A0) ;- (TC2) Status Register +;- ========== Register definition for TCB peripheral ========== +AT91C_TCB_BMR EQU (0xFFFA00C4) ;- (TCB) TC Block Mode Register +AT91C_TCB_BCR EQU (0xFFFA00C0) ;- (TCB) TC Block Control Register +;- ========== Register definition for CAN_MB0 peripheral ========== +AT91C_CAN_MB0_MDL EQU (0xFFFD0214) ;- (CAN_MB0) MailBox Data Low Register +AT91C_CAN_MB0_MAM EQU (0xFFFD0204) ;- (CAN_MB0) MailBox Acceptance Mask Register +AT91C_CAN_MB0_MCR EQU (0xFFFD021C) ;- (CAN_MB0) MailBox Control Register +AT91C_CAN_MB0_MID EQU (0xFFFD0208) ;- (CAN_MB0) MailBox ID Register +AT91C_CAN_MB0_MSR EQU (0xFFFD0210) ;- (CAN_MB0) MailBox Status Register +AT91C_CAN_MB0_MFID EQU (0xFFFD020C) ;- (CAN_MB0) MailBox Family ID Register +AT91C_CAN_MB0_MDH EQU (0xFFFD0218) ;- (CAN_MB0) MailBox Data High Register +AT91C_CAN_MB0_MMR EQU (0xFFFD0200) ;- (CAN_MB0) MailBox Mode Register +;- ========== Register definition for CAN_MB1 peripheral ========== +AT91C_CAN_MB1_MDL EQU (0xFFFD0234) ;- (CAN_MB1) MailBox Data Low Register +AT91C_CAN_MB1_MID EQU (0xFFFD0228) ;- (CAN_MB1) MailBox ID Register +AT91C_CAN_MB1_MMR EQU (0xFFFD0220) ;- (CAN_MB1) MailBox Mode Register +AT91C_CAN_MB1_MSR EQU (0xFFFD0230) ;- (CAN_MB1) MailBox Status Register +AT91C_CAN_MB1_MAM EQU (0xFFFD0224) ;- (CAN_MB1) MailBox Acceptance Mask Register +AT91C_CAN_MB1_MDH EQU (0xFFFD0238) ;- (CAN_MB1) MailBox Data High Register +AT91C_CAN_MB1_MCR EQU (0xFFFD023C) ;- (CAN_MB1) MailBox Control Register +AT91C_CAN_MB1_MFID EQU (0xFFFD022C) ;- (CAN_MB1) MailBox Family ID Register +;- ========== Register definition for CAN_MB2 peripheral ========== +AT91C_CAN_MB2_MCR EQU (0xFFFD025C) ;- (CAN_MB2) MailBox Control Register +AT91C_CAN_MB2_MDH EQU (0xFFFD0258) ;- (CAN_MB2) MailBox Data High Register +AT91C_CAN_MB2_MID EQU (0xFFFD0248) ;- (CAN_MB2) MailBox ID Register +AT91C_CAN_MB2_MDL EQU (0xFFFD0254) ;- (CAN_MB2) MailBox Data Low Register +AT91C_CAN_MB2_MMR EQU (0xFFFD0240) ;- (CAN_MB2) MailBox Mode Register +AT91C_CAN_MB2_MAM EQU (0xFFFD0244) ;- (CAN_MB2) MailBox Acceptance Mask Register +AT91C_CAN_MB2_MFID EQU (0xFFFD024C) ;- (CAN_MB2) MailBox Family ID Register +AT91C_CAN_MB2_MSR EQU (0xFFFD0250) ;- (CAN_MB2) MailBox Status Register +;- ========== Register definition for CAN_MB3 peripheral ========== +AT91C_CAN_MB3_MFID EQU (0xFFFD026C) ;- (CAN_MB3) MailBox Family ID Register +AT91C_CAN_MB3_MAM EQU (0xFFFD0264) ;- (CAN_MB3) MailBox Acceptance Mask Register +AT91C_CAN_MB3_MID EQU (0xFFFD0268) ;- (CAN_MB3) MailBox ID Register +AT91C_CAN_MB3_MCR EQU (0xFFFD027C) ;- (CAN_MB3) MailBox Control Register +AT91C_CAN_MB3_MMR EQU (0xFFFD0260) ;- (CAN_MB3) MailBox Mode Register +AT91C_CAN_MB3_MSR EQU (0xFFFD0270) ;- (CAN_MB3) MailBox Status Register +AT91C_CAN_MB3_MDL EQU (0xFFFD0274) ;- (CAN_MB3) MailBox Data Low Register +AT91C_CAN_MB3_MDH EQU (0xFFFD0278) ;- (CAN_MB3) MailBox Data High Register +;- ========== Register definition for CAN_MB4 peripheral ========== +AT91C_CAN_MB4_MID EQU (0xFFFD0288) ;- (CAN_MB4) MailBox ID Register +AT91C_CAN_MB4_MMR EQU (0xFFFD0280) ;- (CAN_MB4) MailBox Mode Register +AT91C_CAN_MB4_MDH EQU (0xFFFD0298) ;- (CAN_MB4) MailBox Data High Register +AT91C_CAN_MB4_MFID EQU (0xFFFD028C) ;- (CAN_MB4) MailBox Family ID Register +AT91C_CAN_MB4_MSR EQU (0xFFFD0290) ;- (CAN_MB4) MailBox Status Register +AT91C_CAN_MB4_MCR EQU (0xFFFD029C) ;- (CAN_MB4) MailBox Control Register +AT91C_CAN_MB4_MDL EQU (0xFFFD0294) ;- (CAN_MB4) MailBox Data Low Register +AT91C_CAN_MB4_MAM EQU (0xFFFD0284) ;- (CAN_MB4) MailBox Acceptance Mask Register +;- ========== Register definition for CAN_MB5 peripheral ========== +AT91C_CAN_MB5_MSR EQU (0xFFFD02B0) ;- (CAN_MB5) MailBox Status Register +AT91C_CAN_MB5_MCR EQU (0xFFFD02BC) ;- (CAN_MB5) MailBox Control Register +AT91C_CAN_MB5_MFID EQU (0xFFFD02AC) ;- (CAN_MB5) MailBox Family ID Register +AT91C_CAN_MB5_MDH EQU (0xFFFD02B8) ;- (CAN_MB5) MailBox Data High Register +AT91C_CAN_MB5_MID EQU (0xFFFD02A8) ;- (CAN_MB5) MailBox ID Register +AT91C_CAN_MB5_MMR EQU (0xFFFD02A0) ;- (CAN_MB5) MailBox Mode Register +AT91C_CAN_MB5_MDL EQU (0xFFFD02B4) ;- (CAN_MB5) MailBox Data Low Register +AT91C_CAN_MB5_MAM EQU (0xFFFD02A4) ;- (CAN_MB5) MailBox Acceptance Mask Register +;- ========== Register definition for CAN_MB6 peripheral ========== +AT91C_CAN_MB6_MFID EQU (0xFFFD02CC) ;- (CAN_MB6) MailBox Family ID Register +AT91C_CAN_MB6_MID EQU (0xFFFD02C8) ;- (CAN_MB6) MailBox ID Register +AT91C_CAN_MB6_MAM EQU (0xFFFD02C4) ;- (CAN_MB6) MailBox Acceptance Mask Register +AT91C_CAN_MB6_MSR EQU (0xFFFD02D0) ;- (CAN_MB6) MailBox Status Register +AT91C_CAN_MB6_MDL EQU (0xFFFD02D4) ;- (CAN_MB6) MailBox Data Low Register +AT91C_CAN_MB6_MCR EQU (0xFFFD02DC) ;- (CAN_MB6) MailBox Control Register +AT91C_CAN_MB6_MDH EQU (0xFFFD02D8) ;- (CAN_MB6) MailBox Data High Register +AT91C_CAN_MB6_MMR EQU (0xFFFD02C0) ;- (CAN_MB6) MailBox Mode Register +;- ========== Register definition for CAN_MB7 peripheral ========== +AT91C_CAN_MB7_MCR EQU (0xFFFD02FC) ;- (CAN_MB7) MailBox Control Register +AT91C_CAN_MB7_MDH EQU (0xFFFD02F8) ;- (CAN_MB7) MailBox Data High Register +AT91C_CAN_MB7_MFID EQU (0xFFFD02EC) ;- (CAN_MB7) MailBox Family ID Register +AT91C_CAN_MB7_MDL EQU (0xFFFD02F4) ;- (CAN_MB7) MailBox Data Low Register +AT91C_CAN_MB7_MID EQU (0xFFFD02E8) ;- (CAN_MB7) MailBox ID Register +AT91C_CAN_MB7_MMR EQU (0xFFFD02E0) ;- (CAN_MB7) MailBox Mode Register +AT91C_CAN_MB7_MAM EQU (0xFFFD02E4) ;- (CAN_MB7) MailBox Acceptance Mask Register +AT91C_CAN_MB7_MSR EQU (0xFFFD02F0) ;- (CAN_MB7) MailBox Status Register +;- ========== Register definition for CAN peripheral ========== +AT91C_CAN_TCR EQU (0xFFFD0024) ;- (CAN) Transfer Command Register +AT91C_CAN_IMR EQU (0xFFFD000C) ;- (CAN) Interrupt Mask Register +AT91C_CAN_IER EQU (0xFFFD0004) ;- (CAN) Interrupt Enable Register +AT91C_CAN_ECR EQU (0xFFFD0020) ;- (CAN) Error Counter Register +AT91C_CAN_TIMESTP EQU (0xFFFD001C) ;- (CAN) Time Stamp Register +AT91C_CAN_MR EQU (0xFFFD0000) ;- (CAN) Mode Register +AT91C_CAN_IDR EQU (0xFFFD0008) ;- (CAN) Interrupt Disable Register +AT91C_CAN_ACR EQU (0xFFFD0028) ;- (CAN) Abort Command Register +AT91C_CAN_TIM EQU (0xFFFD0018) ;- (CAN) Timer Register +AT91C_CAN_SR EQU (0xFFFD0010) ;- (CAN) Status Register +AT91C_CAN_BR EQU (0xFFFD0014) ;- (CAN) Baudrate Register +AT91C_CAN_VR EQU (0xFFFD00FC) ;- (CAN) Version Register +;- ========== Register definition for EMAC peripheral ========== +AT91C_EMAC_ISR EQU (0xFFFDC024) ;- (EMAC) Interrupt Status Register +AT91C_EMAC_SA4H EQU (0xFFFDC0B4) ;- (EMAC) Specific Address 4 Top, Last 2 bytes +AT91C_EMAC_SA1L EQU (0xFFFDC098) ;- (EMAC) Specific Address 1 Bottom, First 4 bytes +AT91C_EMAC_ELE EQU (0xFFFDC078) ;- (EMAC) Excessive Length Errors Register +AT91C_EMAC_LCOL EQU (0xFFFDC05C) ;- (EMAC) Late Collision Register +AT91C_EMAC_RLE EQU (0xFFFDC088) ;- (EMAC) Receive Length Field Mismatch Register +AT91C_EMAC_WOL EQU (0xFFFDC0C4) ;- (EMAC) Wake On LAN Register +AT91C_EMAC_DTF EQU (0xFFFDC058) ;- (EMAC) Deferred Transmission Frame Register +AT91C_EMAC_TUND EQU (0xFFFDC064) ;- (EMAC) Transmit Underrun Error Register +AT91C_EMAC_NCR EQU (0xFFFDC000) ;- (EMAC) Network Control Register +AT91C_EMAC_SA4L EQU (0xFFFDC0B0) ;- (EMAC) Specific Address 4 Bottom, First 4 bytes +AT91C_EMAC_RSR EQU (0xFFFDC020) ;- (EMAC) Receive Status Register +AT91C_EMAC_SA3L EQU (0xFFFDC0A8) ;- (EMAC) Specific Address 3 Bottom, First 4 bytes +AT91C_EMAC_TSR EQU (0xFFFDC014) ;- (EMAC) Transmit Status Register +AT91C_EMAC_IDR EQU (0xFFFDC02C) ;- (EMAC) Interrupt Disable Register +AT91C_EMAC_RSE EQU (0xFFFDC074) ;- (EMAC) Receive Symbol Errors Register +AT91C_EMAC_ECOL EQU (0xFFFDC060) ;- (EMAC) Excessive Collision Register +AT91C_EMAC_TID EQU (0xFFFDC0B8) ;- (EMAC) Type ID Checking Register +AT91C_EMAC_HRB EQU (0xFFFDC090) ;- (EMAC) Hash Address Bottom[31:0] +AT91C_EMAC_TBQP EQU (0xFFFDC01C) ;- (EMAC) Transmit Buffer Queue Pointer +AT91C_EMAC_USRIO EQU (0xFFFDC0C0) ;- (EMAC) USER Input/Output Register +AT91C_EMAC_PTR EQU (0xFFFDC038) ;- (EMAC) Pause Time Register +AT91C_EMAC_SA2H EQU (0xFFFDC0A4) ;- (EMAC) Specific Address 2 Top, Last 2 bytes +AT91C_EMAC_ROV EQU (0xFFFDC070) ;- (EMAC) Receive Overrun Errors Register +AT91C_EMAC_ALE EQU (0xFFFDC054) ;- (EMAC) Alignment Error Register +AT91C_EMAC_RJA EQU (0xFFFDC07C) ;- (EMAC) Receive Jabbers Register +AT91C_EMAC_RBQP EQU (0xFFFDC018) ;- (EMAC) Receive Buffer Queue Pointer +AT91C_EMAC_TPF EQU (0xFFFDC08C) ;- (EMAC) Transmitted Pause Frames Register +AT91C_EMAC_NCFGR EQU (0xFFFDC004) ;- (EMAC) Network Configuration Register +AT91C_EMAC_HRT EQU (0xFFFDC094) ;- (EMAC) Hash Address Top[63:32] +AT91C_EMAC_USF EQU (0xFFFDC080) ;- (EMAC) Undersize Frames Register +AT91C_EMAC_FCSE EQU (0xFFFDC050) ;- (EMAC) Frame Check Sequence Error Register +AT91C_EMAC_TPQ EQU (0xFFFDC0BC) ;- (EMAC) Transmit Pause Quantum Register +AT91C_EMAC_MAN EQU (0xFFFDC034) ;- (EMAC) PHY Maintenance Register +AT91C_EMAC_FTO EQU (0xFFFDC040) ;- (EMAC) Frames Transmitted OK Register +AT91C_EMAC_REV EQU (0xFFFDC0FC) ;- (EMAC) Revision Register +AT91C_EMAC_IMR EQU (0xFFFDC030) ;- (EMAC) Interrupt Mask Register +AT91C_EMAC_SCF EQU (0xFFFDC044) ;- (EMAC) Single Collision Frame Register +AT91C_EMAC_PFR EQU (0xFFFDC03C) ;- (EMAC) Pause Frames received Register +AT91C_EMAC_MCF EQU (0xFFFDC048) ;- (EMAC) Multiple Collision Frame Register +AT91C_EMAC_NSR EQU (0xFFFDC008) ;- (EMAC) Network Status Register +AT91C_EMAC_SA2L EQU (0xFFFDC0A0) ;- (EMAC) Specific Address 2 Bottom, First 4 bytes +AT91C_EMAC_FRO EQU (0xFFFDC04C) ;- (EMAC) Frames Received OK Register +AT91C_EMAC_IER EQU (0xFFFDC028) ;- (EMAC) Interrupt Enable Register +AT91C_EMAC_SA1H EQU (0xFFFDC09C) ;- (EMAC) Specific Address 1 Top, Last 2 bytes +AT91C_EMAC_CSE EQU (0xFFFDC068) ;- (EMAC) Carrier Sense Error Register +AT91C_EMAC_SA3H EQU (0xFFFDC0AC) ;- (EMAC) Specific Address 3 Top, Last 2 bytes +AT91C_EMAC_RRE EQU (0xFFFDC06C) ;- (EMAC) Receive Ressource Error Register +AT91C_EMAC_STE EQU (0xFFFDC084) ;- (EMAC) SQE Test Error Register +;- ========== Register definition for PDC_ADC peripheral ========== +AT91C_ADC_PTSR EQU (0xFFFD8124) ;- (PDC_ADC) PDC Transfer Status Register +AT91C_ADC_PTCR EQU (0xFFFD8120) ;- (PDC_ADC) PDC Transfer Control Register +AT91C_ADC_TNPR EQU (0xFFFD8118) ;- (PDC_ADC) Transmit Next Pointer Register +AT91C_ADC_TNCR EQU (0xFFFD811C) ;- (PDC_ADC) Transmit Next Counter Register +AT91C_ADC_RNPR EQU (0xFFFD8110) ;- (PDC_ADC) Receive Next Pointer Register +AT91C_ADC_RNCR EQU (0xFFFD8114) ;- (PDC_ADC) Receive Next Counter Register +AT91C_ADC_RPR EQU (0xFFFD8100) ;- (PDC_ADC) Receive Pointer Register +AT91C_ADC_TCR EQU (0xFFFD810C) ;- (PDC_ADC) Transmit Counter Register +AT91C_ADC_TPR EQU (0xFFFD8108) ;- (PDC_ADC) Transmit Pointer Register +AT91C_ADC_RCR EQU (0xFFFD8104) ;- (PDC_ADC) Receive Counter Register +;- ========== Register definition for ADC peripheral ========== +AT91C_ADC_CDR2 EQU (0xFFFD8038) ;- (ADC) ADC Channel Data Register 2 +AT91C_ADC_CDR3 EQU (0xFFFD803C) ;- (ADC) ADC Channel Data Register 3 +AT91C_ADC_CDR0 EQU (0xFFFD8030) ;- (ADC) ADC Channel Data Register 0 +AT91C_ADC_CDR5 EQU (0xFFFD8044) ;- (ADC) ADC Channel Data Register 5 +AT91C_ADC_CHDR EQU (0xFFFD8014) ;- (ADC) ADC Channel Disable Register +AT91C_ADC_SR EQU (0xFFFD801C) ;- (ADC) ADC Status Register +AT91C_ADC_CDR4 EQU (0xFFFD8040) ;- (ADC) ADC Channel Data Register 4 +AT91C_ADC_CDR1 EQU (0xFFFD8034) ;- (ADC) ADC Channel Data Register 1 +AT91C_ADC_LCDR EQU (0xFFFD8020) ;- (ADC) ADC Last Converted Data Register +AT91C_ADC_IDR EQU (0xFFFD8028) ;- (ADC) ADC Interrupt Disable Register +AT91C_ADC_CR EQU (0xFFFD8000) ;- (ADC) ADC Control Register +AT91C_ADC_CDR7 EQU (0xFFFD804C) ;- (ADC) ADC Channel Data Register 7 +AT91C_ADC_CDR6 EQU (0xFFFD8048) ;- (ADC) ADC Channel Data Register 6 +AT91C_ADC_IER EQU (0xFFFD8024) ;- (ADC) ADC Interrupt Enable Register +AT91C_ADC_CHER EQU (0xFFFD8010) ;- (ADC) ADC Channel Enable Register +AT91C_ADC_CHSR EQU (0xFFFD8018) ;- (ADC) ADC Channel Status Register +AT91C_ADC_MR EQU (0xFFFD8004) ;- (ADC) ADC Mode Register +AT91C_ADC_IMR EQU (0xFFFD802C) ;- (ADC) ADC Interrupt Mask Register + +;- ***************************************************************************** +;- PIO DEFINITIONS FOR AT91SAM7X256 +;- ***************************************************************************** +AT91C_PIO_PA0 EQU (1:SHL:0) ;- Pin Controlled by PA0 +AT91C_PA0_RXD0 EQU (AT91C_PIO_PA0) ;- USART 0 Receive Data +AT91C_PIO_PA1 EQU (1:SHL:1) ;- Pin Controlled by PA1 +AT91C_PA1_TXD0 EQU (AT91C_PIO_PA1) ;- USART 0 Transmit Data +AT91C_PIO_PA10 EQU (1:SHL:10) ;- Pin Controlled by PA10 +AT91C_PA10_TWD EQU (AT91C_PIO_PA10) ;- TWI Two-wire Serial Data +AT91C_PIO_PA11 EQU (1:SHL:11) ;- Pin Controlled by PA11 +AT91C_PA11_TWCK EQU (AT91C_PIO_PA11) ;- TWI Two-wire Serial Clock +AT91C_PIO_PA12 EQU (1:SHL:12) ;- Pin Controlled by PA12 +AT91C_PA12_SPI0_NPCS0 EQU (AT91C_PIO_PA12) ;- SPI 0 Peripheral Chip Select 0 +AT91C_PIO_PA13 EQU (1:SHL:13) ;- Pin Controlled by PA13 +AT91C_PA13_SPI0_NPCS1 EQU (AT91C_PIO_PA13) ;- SPI 0 Peripheral Chip Select 1 +AT91C_PA13_PCK1 EQU (AT91C_PIO_PA13) ;- PMC Programmable Clock Output 1 +AT91C_PIO_PA14 EQU (1:SHL:14) ;- Pin Controlled by PA14 +AT91C_PA14_SPI0_NPCS2 EQU (AT91C_PIO_PA14) ;- SPI 0 Peripheral Chip Select 2 +AT91C_PA14_IRQ1 EQU (AT91C_PIO_PA14) ;- External Interrupt 1 +AT91C_PIO_PA15 EQU (1:SHL:15) ;- Pin Controlled by PA15 +AT91C_PA15_SPI0_NPCS3 EQU (AT91C_PIO_PA15) ;- SPI 0 Peripheral Chip Select 3 +AT91C_PA15_TCLK2 EQU (AT91C_PIO_PA15) ;- Timer Counter 2 external clock input +AT91C_PIO_PA16 EQU (1:SHL:16) ;- Pin Controlled by PA16 +AT91C_PA16_SPI0_MISO EQU (AT91C_PIO_PA16) ;- SPI 0 Master In Slave +AT91C_PIO_PA17 EQU (1:SHL:17) ;- Pin Controlled by PA17 +AT91C_PA17_SPI0_MOSI EQU (AT91C_PIO_PA17) ;- SPI 0 Master Out Slave +AT91C_PIO_PA18 EQU (1:SHL:18) ;- Pin Controlled by PA18 +AT91C_PA18_SPI0_SPCK EQU (AT91C_PIO_PA18) ;- SPI 0 Serial Clock +AT91C_PIO_PA19 EQU (1:SHL:19) ;- Pin Controlled by PA19 +AT91C_PA19_CANRX EQU (AT91C_PIO_PA19) ;- CAN Receive +AT91C_PIO_PA2 EQU (1:SHL:2) ;- Pin Controlled by PA2 +AT91C_PA2_SCK0 EQU (AT91C_PIO_PA2) ;- USART 0 Serial Clock +AT91C_PA2_SPI1_NPCS1 EQU (AT91C_PIO_PA2) ;- SPI 1 Peripheral Chip Select 1 +AT91C_PIO_PA20 EQU (1:SHL:20) ;- Pin Controlled by PA20 +AT91C_PA20_CANTX EQU (AT91C_PIO_PA20) ;- CAN Transmit +AT91C_PIO_PA21 EQU (1:SHL:21) ;- Pin Controlled by PA21 +AT91C_PA21_TF EQU (AT91C_PIO_PA21) ;- SSC Transmit Frame Sync +AT91C_PA21_SPI1_NPCS0 EQU (AT91C_PIO_PA21) ;- SPI 1 Peripheral Chip Select 0 +AT91C_PIO_PA22 EQU (1:SHL:22) ;- Pin Controlled by PA22 +AT91C_PA22_TK EQU (AT91C_PIO_PA22) ;- SSC Transmit Clock +AT91C_PA22_SPI1_SPCK EQU (AT91C_PIO_PA22) ;- SPI 1 Serial Clock +AT91C_PIO_PA23 EQU (1:SHL:23) ;- Pin Controlled by PA23 +AT91C_PA23_TD EQU (AT91C_PIO_PA23) ;- SSC Transmit data +AT91C_PA23_SPI1_MOSI EQU (AT91C_PIO_PA23) ;- SPI 1 Master Out Slave +AT91C_PIO_PA24 EQU (1:SHL:24) ;- Pin Controlled by PA24 +AT91C_PA24_RD EQU (AT91C_PIO_PA24) ;- SSC Receive Data +AT91C_PA24_SPI1_MISO EQU (AT91C_PIO_PA24) ;- SPI 1 Master In Slave +AT91C_PIO_PA25 EQU (1:SHL:25) ;- Pin Controlled by PA25 +AT91C_PA25_RK EQU (AT91C_PIO_PA25) ;- SSC Receive Clock +AT91C_PA25_SPI1_NPCS1 EQU (AT91C_PIO_PA25) ;- SPI 1 Peripheral Chip Select 1 +AT91C_PIO_PA26 EQU (1:SHL:26) ;- Pin Controlled by PA26 +AT91C_PA26_RF EQU (AT91C_PIO_PA26) ;- SSC Receive Frame Sync +AT91C_PA26_SPI1_NPCS2 EQU (AT91C_PIO_PA26) ;- SPI 1 Peripheral Chip Select 2 +AT91C_PIO_PA27 EQU (1:SHL:27) ;- Pin Controlled by PA27 +AT91C_PA27_DRXD EQU (AT91C_PIO_PA27) ;- DBGU Debug Receive Data +AT91C_PA27_PCK3 EQU (AT91C_PIO_PA27) ;- PMC Programmable Clock Output 3 +AT91C_PIO_PA28 EQU (1:SHL:28) ;- Pin Controlled by PA28 +AT91C_PA28_DTXD EQU (AT91C_PIO_PA28) ;- DBGU Debug Transmit Data +AT91C_PIO_PA29 EQU (1:SHL:29) ;- Pin Controlled by PA29 +AT91C_PA29_FIQ EQU (AT91C_PIO_PA29) ;- AIC Fast Interrupt Input +AT91C_PA29_SPI1_NPCS3 EQU (AT91C_PIO_PA29) ;- SPI 1 Peripheral Chip Select 3 +AT91C_PIO_PA3 EQU (1:SHL:3) ;- Pin Controlled by PA3 +AT91C_PA3_RTS0 EQU (AT91C_PIO_PA3) ;- USART 0 Ready To Send +AT91C_PA3_SPI1_NPCS2 EQU (AT91C_PIO_PA3) ;- SPI 1 Peripheral Chip Select 2 +AT91C_PIO_PA30 EQU (1:SHL:30) ;- Pin Controlled by PA30 +AT91C_PA30_IRQ0 EQU (AT91C_PIO_PA30) ;- External Interrupt 0 +AT91C_PA30_PCK2 EQU (AT91C_PIO_PA30) ;- PMC Programmable Clock Output 2 +AT91C_PIO_PA4 EQU (1:SHL:4) ;- Pin Controlled by PA4 +AT91C_PA4_CTS0 EQU (AT91C_PIO_PA4) ;- USART 0 Clear To Send +AT91C_PA4_SPI1_NPCS3 EQU (AT91C_PIO_PA4) ;- SPI 1 Peripheral Chip Select 3 +AT91C_PIO_PA5 EQU (1:SHL:5) ;- Pin Controlled by PA5 +AT91C_PA5_RXD1 EQU (AT91C_PIO_PA5) ;- USART 1 Receive Data +AT91C_PIO_PA6 EQU (1:SHL:6) ;- Pin Controlled by PA6 +AT91C_PA6_TXD1 EQU (AT91C_PIO_PA6) ;- USART 1 Transmit Data +AT91C_PIO_PA7 EQU (1:SHL:7) ;- Pin Controlled by PA7 +AT91C_PA7_SCK1 EQU (AT91C_PIO_PA7) ;- USART 1 Serial Clock +AT91C_PA7_SPI0_NPCS1 EQU (AT91C_PIO_PA7) ;- SPI 0 Peripheral Chip Select 1 +AT91C_PIO_PA8 EQU (1:SHL:8) ;- Pin Controlled by PA8 +AT91C_PA8_RTS1 EQU (AT91C_PIO_PA8) ;- USART 1 Ready To Send +AT91C_PA8_SPI0_NPCS2 EQU (AT91C_PIO_PA8) ;- SPI 0 Peripheral Chip Select 2 +AT91C_PIO_PA9 EQU (1:SHL:9) ;- Pin Controlled by PA9 +AT91C_PA9_CTS1 EQU (AT91C_PIO_PA9) ;- USART 1 Clear To Send +AT91C_PA9_SPI0_NPCS3 EQU (AT91C_PIO_PA9) ;- SPI 0 Peripheral Chip Select 3 +AT91C_PIO_PB0 EQU (1:SHL:0) ;- Pin Controlled by PB0 +AT91C_PB0_ETXCK_EREFCK EQU (AT91C_PIO_PB0) ;- Ethernet MAC Transmit Clock/Reference Clock +AT91C_PB0_PCK0 EQU (AT91C_PIO_PB0) ;- PMC Programmable Clock Output 0 +AT91C_PIO_PB1 EQU (1:SHL:1) ;- Pin Controlled by PB1 +AT91C_PB1_ETXEN EQU (AT91C_PIO_PB1) ;- Ethernet MAC Transmit Enable +AT91C_PIO_PB10 EQU (1:SHL:10) ;- Pin Controlled by PB10 +AT91C_PB10_ETX2 EQU (AT91C_PIO_PB10) ;- Ethernet MAC Transmit Data 2 +AT91C_PB10_SPI1_NPCS1 EQU (AT91C_PIO_PB10) ;- SPI 1 Peripheral Chip Select 1 +AT91C_PIO_PB11 EQU (1:SHL:11) ;- Pin Controlled by PB11 +AT91C_PB11_ETX3 EQU (AT91C_PIO_PB11) ;- Ethernet MAC Transmit Data 3 +AT91C_PB11_SPI1_NPCS2 EQU (AT91C_PIO_PB11) ;- SPI 1 Peripheral Chip Select 2 +AT91C_PIO_PB12 EQU (1:SHL:12) ;- Pin Controlled by PB12 +AT91C_PB12_ETXER EQU (AT91C_PIO_PB12) ;- Ethernet MAC Transmikt Coding Error +AT91C_PB12_TCLK0 EQU (AT91C_PIO_PB12) ;- Timer Counter 0 external clock input +AT91C_PIO_PB13 EQU (1:SHL:13) ;- Pin Controlled by PB13 +AT91C_PB13_ERX2 EQU (AT91C_PIO_PB13) ;- Ethernet MAC Receive Data 2 +AT91C_PB13_SPI0_NPCS1 EQU (AT91C_PIO_PB13) ;- SPI 0 Peripheral Chip Select 1 +AT91C_PIO_PB14 EQU (1:SHL:14) ;- Pin Controlled by PB14 +AT91C_PB14_ERX3 EQU (AT91C_PIO_PB14) ;- Ethernet MAC Receive Data 3 +AT91C_PB14_SPI0_NPCS2 EQU (AT91C_PIO_PB14) ;- SPI 0 Peripheral Chip Select 2 +AT91C_PIO_PB15 EQU (1:SHL:15) ;- Pin Controlled by PB15 +AT91C_PB15_ERXDV_ECRSDV EQU (AT91C_PIO_PB15) ;- Ethernet MAC Receive Data Valid +AT91C_PIO_PB16 EQU (1:SHL:16) ;- Pin Controlled by PB16 +AT91C_PB16_ECOL EQU (AT91C_PIO_PB16) ;- Ethernet MAC Collision Detected +AT91C_PB16_SPI1_NPCS3 EQU (AT91C_PIO_PB16) ;- SPI 1 Peripheral Chip Select 3 +AT91C_PIO_PB17 EQU (1:SHL:17) ;- Pin Controlled by PB17 +AT91C_PB17_ERXCK EQU (AT91C_PIO_PB17) ;- Ethernet MAC Receive Clock +AT91C_PB17_SPI0_NPCS3 EQU (AT91C_PIO_PB17) ;- SPI 0 Peripheral Chip Select 3 +AT91C_PIO_PB18 EQU (1:SHL:18) ;- Pin Controlled by PB18 +AT91C_PB18_EF100 EQU (AT91C_PIO_PB18) ;- Ethernet MAC Force 100 Mbits/sec +AT91C_PB18_ADTRG EQU (AT91C_PIO_PB18) ;- ADC External Trigger +AT91C_PIO_PB19 EQU (1:SHL:19) ;- Pin Controlled by PB19 +AT91C_PB19_PWM0 EQU (AT91C_PIO_PB19) ;- PWM Channel 0 +AT91C_PB19_TCLK1 EQU (AT91C_PIO_PB19) ;- Timer Counter 1 external clock input +AT91C_PIO_PB2 EQU (1:SHL:2) ;- Pin Controlled by PB2 +AT91C_PB2_ETX0 EQU (AT91C_PIO_PB2) ;- Ethernet MAC Transmit Data 0 +AT91C_PIO_PB20 EQU (1:SHL:20) ;- Pin Controlled by PB20 +AT91C_PB20_PWM1 EQU (AT91C_PIO_PB20) ;- PWM Channel 1 +AT91C_PB20_PCK0 EQU (AT91C_PIO_PB20) ;- PMC Programmable Clock Output 0 +AT91C_PIO_PB21 EQU (1:SHL:21) ;- Pin Controlled by PB21 +AT91C_PB21_PWM2 EQU (AT91C_PIO_PB21) ;- PWM Channel 2 +AT91C_PB21_PCK1 EQU (AT91C_PIO_PB21) ;- PMC Programmable Clock Output 1 +AT91C_PIO_PB22 EQU (1:SHL:22) ;- Pin Controlled by PB22 +AT91C_PB22_PWM3 EQU (AT91C_PIO_PB22) ;- PWM Channel 3 +AT91C_PB22_PCK2 EQU (AT91C_PIO_PB22) ;- PMC Programmable Clock Output 2 +AT91C_PIO_PB23 EQU (1:SHL:23) ;- Pin Controlled by PB23 +AT91C_PB23_TIOA0 EQU (AT91C_PIO_PB23) ;- Timer Counter 0 Multipurpose Timer I/O Pin A +AT91C_PB23_DCD1 EQU (AT91C_PIO_PB23) ;- USART 1 Data Carrier Detect +AT91C_PIO_PB24 EQU (1:SHL:24) ;- Pin Controlled by PB24 +AT91C_PB24_TIOB0 EQU (AT91C_PIO_PB24) ;- Timer Counter 0 Multipurpose Timer I/O Pin B +AT91C_PB24_DSR1 EQU (AT91C_PIO_PB24) ;- USART 1 Data Set ready +AT91C_PIO_PB25 EQU (1:SHL:25) ;- Pin Controlled by PB25 +AT91C_PB25_TIOA1 EQU (AT91C_PIO_PB25) ;- Timer Counter 1 Multipurpose Timer I/O Pin A +AT91C_PB25_DTR1 EQU (AT91C_PIO_PB25) ;- USART 1 Data Terminal ready +AT91C_PIO_PB26 EQU (1:SHL:26) ;- Pin Controlled by PB26 +AT91C_PB26_TIOB1 EQU (AT91C_PIO_PB26) ;- Timer Counter 1 Multipurpose Timer I/O Pin B +AT91C_PB26_RI1 EQU (AT91C_PIO_PB26) ;- USART 1 Ring Indicator +AT91C_PIO_PB27 EQU (1:SHL:27) ;- Pin Controlled by PB27 +AT91C_PB27_TIOA2 EQU (AT91C_PIO_PB27) ;- Timer Counter 2 Multipurpose Timer I/O Pin A +AT91C_PB27_PWM0 EQU (AT91C_PIO_PB27) ;- PWM Channel 0 +AT91C_PIO_PB28 EQU (1:SHL:28) ;- Pin Controlled by PB28 +AT91C_PB28_TIOB2 EQU (AT91C_PIO_PB28) ;- Timer Counter 2 Multipurpose Timer I/O Pin B +AT91C_PB28_PWM1 EQU (AT91C_PIO_PB28) ;- PWM Channel 1 +AT91C_PIO_PB29 EQU (1:SHL:29) ;- Pin Controlled by PB29 +AT91C_PB29_PCK1 EQU (AT91C_PIO_PB29) ;- PMC Programmable Clock Output 1 +AT91C_PB29_PWM2 EQU (AT91C_PIO_PB29) ;- PWM Channel 2 +AT91C_PIO_PB3 EQU (1:SHL:3) ;- Pin Controlled by PB3 +AT91C_PB3_ETX1 EQU (AT91C_PIO_PB3) ;- Ethernet MAC Transmit Data 1 +AT91C_PIO_PB30 EQU (1:SHL:30) ;- Pin Controlled by PB30 +AT91C_PB30_PCK2 EQU (AT91C_PIO_PB30) ;- PMC Programmable Clock Output 2 +AT91C_PB30_PWM3 EQU (AT91C_PIO_PB30) ;- PWM Channel 3 +AT91C_PIO_PB4 EQU (1:SHL:4) ;- Pin Controlled by PB4 +AT91C_PB4_ECRS EQU (AT91C_PIO_PB4) ;- Ethernet MAC Carrier Sense/Carrier Sense and Data Valid +AT91C_PIO_PB5 EQU (1:SHL:5) ;- Pin Controlled by PB5 +AT91C_PB5_ERX0 EQU (AT91C_PIO_PB5) ;- Ethernet MAC Receive Data 0 +AT91C_PIO_PB6 EQU (1:SHL:6) ;- Pin Controlled by PB6 +AT91C_PB6_ERX1 EQU (AT91C_PIO_PB6) ;- Ethernet MAC Receive Data 1 +AT91C_PIO_PB7 EQU (1:SHL:7) ;- Pin Controlled by PB7 +AT91C_PB7_ERXER EQU (AT91C_PIO_PB7) ;- Ethernet MAC Receive Error +AT91C_PIO_PB8 EQU (1:SHL:8) ;- Pin Controlled by PB8 +AT91C_PB8_EMDC EQU (AT91C_PIO_PB8) ;- Ethernet MAC Management Data Clock +AT91C_PIO_PB9 EQU (1:SHL:9) ;- Pin Controlled by PB9 +AT91C_PB9_EMDIO EQU (AT91C_PIO_PB9) ;- Ethernet MAC Management Data Input/Output + +;- ***************************************************************************** +;- PERIPHERAL ID DEFINITIONS FOR AT91SAM7X256 +;- ***************************************************************************** +AT91C_ID_FIQ EQU ( 0) ;- Advanced Interrupt Controller (FIQ) +AT91C_ID_SYS EQU ( 1) ;- System Peripheral +AT91C_ID_PIOA EQU ( 2) ;- Parallel IO Controller A +AT91C_ID_PIOB EQU ( 3) ;- Parallel IO Controller B +AT91C_ID_SPI0 EQU ( 4) ;- Serial Peripheral Interface 0 +AT91C_ID_SPI1 EQU ( 5) ;- Serial Peripheral Interface 1 +AT91C_ID_US0 EQU ( 6) ;- USART 0 +AT91C_ID_US1 EQU ( 7) ;- USART 1 +AT91C_ID_SSC EQU ( 8) ;- Serial Synchronous Controller +AT91C_ID_TWI EQU ( 9) ;- Two-Wire Interface +AT91C_ID_PWMC EQU (10) ;- PWM Controller +AT91C_ID_UDP EQU (11) ;- USB Device Port +AT91C_ID_TC0 EQU (12) ;- Timer Counter 0 +AT91C_ID_TC1 EQU (13) ;- Timer Counter 1 +AT91C_ID_TC2 EQU (14) ;- Timer Counter 2 +AT91C_ID_CAN EQU (15) ;- Control Area Network Controller +AT91C_ID_EMAC EQU (16) ;- Ethernet MAC +AT91C_ID_ADC EQU (17) ;- Analog-to-Digital Converter +AT91C_ID_18_Reserved EQU (18) ;- Reserved +AT91C_ID_19_Reserved EQU (19) ;- Reserved +AT91C_ID_20_Reserved EQU (20) ;- Reserved +AT91C_ID_21_Reserved EQU (21) ;- Reserved +AT91C_ID_22_Reserved EQU (22) ;- Reserved +AT91C_ID_23_Reserved EQU (23) ;- Reserved +AT91C_ID_24_Reserved EQU (24) ;- Reserved +AT91C_ID_25_Reserved EQU (25) ;- Reserved +AT91C_ID_26_Reserved EQU (26) ;- Reserved +AT91C_ID_27_Reserved EQU (27) ;- Reserved +AT91C_ID_28_Reserved EQU (28) ;- Reserved +AT91C_ID_29_Reserved EQU (29) ;- Reserved +AT91C_ID_IRQ0 EQU (30) ;- Advanced Interrupt Controller (IRQ0) +AT91C_ID_IRQ1 EQU (31) ;- Advanced Interrupt Controller (IRQ1) +AT91C_ALL_INT EQU (0xC003FFFF) ;- ALL VALID INTERRUPTS + +;- ***************************************************************************** +;- BASE ADDRESS DEFINITIONS FOR AT91SAM7X256 +;- ***************************************************************************** +AT91C_BASE_SYS EQU (0xFFFFF000) ;- (SYS) Base Address +AT91C_BASE_AIC EQU (0xFFFFF000) ;- (AIC) Base Address +AT91C_BASE_PDC_DBGU EQU (0xFFFFF300) ;- (PDC_DBGU) Base Address +AT91C_BASE_DBGU EQU (0xFFFFF200) ;- (DBGU) Base Address +AT91C_BASE_PIOA EQU (0xFFFFF400) ;- (PIOA) Base Address +AT91C_BASE_PIOB EQU (0xFFFFF600) ;- (PIOB) Base Address +AT91C_BASE_CKGR EQU (0xFFFFFC20) ;- (CKGR) Base Address +AT91C_BASE_PMC EQU (0xFFFFFC00) ;- (PMC) Base Address +AT91C_BASE_RSTC EQU (0xFFFFFD00) ;- (RSTC) Base Address +AT91C_BASE_RTTC EQU (0xFFFFFD20) ;- (RTTC) Base Address +AT91C_BASE_PITC EQU (0xFFFFFD30) ;- (PITC) Base Address +AT91C_BASE_WDTC EQU (0xFFFFFD40) ;- (WDTC) Base Address +AT91C_BASE_VREG EQU (0xFFFFFD60) ;- (VREG) Base Address +AT91C_BASE_MC EQU (0xFFFFFF00) ;- (MC) Base Address +AT91C_BASE_PDC_SPI1 EQU (0xFFFE4100) ;- (PDC_SPI1) Base Address +AT91C_BASE_SPI1 EQU (0xFFFE4000) ;- (SPI1) Base Address +AT91C_BASE_PDC_SPI0 EQU (0xFFFE0100) ;- (PDC_SPI0) Base Address +AT91C_BASE_SPI0 EQU (0xFFFE0000) ;- (SPI0) Base Address +AT91C_BASE_PDC_US1 EQU (0xFFFC4100) ;- (PDC_US1) Base Address +AT91C_BASE_US1 EQU (0xFFFC4000) ;- (US1) Base Address +AT91C_BASE_PDC_US0 EQU (0xFFFC0100) ;- (PDC_US0) Base Address +AT91C_BASE_US0 EQU (0xFFFC0000) ;- (US0) Base Address +AT91C_BASE_PDC_SSC EQU (0xFFFD4100) ;- (PDC_SSC) Base Address +AT91C_BASE_SSC EQU (0xFFFD4000) ;- (SSC) Base Address +AT91C_BASE_TWI EQU (0xFFFB8000) ;- (TWI) Base Address +AT91C_BASE_PWMC_CH3 EQU (0xFFFCC260) ;- (PWMC_CH3) Base Address +AT91C_BASE_PWMC_CH2 EQU (0xFFFCC240) ;- (PWMC_CH2) Base Address +AT91C_BASE_PWMC_CH1 EQU (0xFFFCC220) ;- (PWMC_CH1) Base Address +AT91C_BASE_PWMC_CH0 EQU (0xFFFCC200) ;- (PWMC_CH0) Base Address +AT91C_BASE_PWMC EQU (0xFFFCC000) ;- (PWMC) Base Address +AT91C_BASE_UDP EQU (0xFFFB0000) ;- (UDP) Base Address +AT91C_BASE_TC0 EQU (0xFFFA0000) ;- (TC0) Base Address +AT91C_BASE_TC1 EQU (0xFFFA0040) ;- (TC1) Base Address +AT91C_BASE_TC2 EQU (0xFFFA0080) ;- (TC2) Base Address +AT91C_BASE_TCB EQU (0xFFFA0000) ;- (TCB) Base Address +AT91C_BASE_CAN_MB0 EQU (0xFFFD0200) ;- (CAN_MB0) Base Address +AT91C_BASE_CAN_MB1 EQU (0xFFFD0220) ;- (CAN_MB1) Base Address +AT91C_BASE_CAN_MB2 EQU (0xFFFD0240) ;- (CAN_MB2) Base Address +AT91C_BASE_CAN_MB3 EQU (0xFFFD0260) ;- (CAN_MB3) Base Address +AT91C_BASE_CAN_MB4 EQU (0xFFFD0280) ;- (CAN_MB4) Base Address +AT91C_BASE_CAN_MB5 EQU (0xFFFD02A0) ;- (CAN_MB5) Base Address +AT91C_BASE_CAN_MB6 EQU (0xFFFD02C0) ;- (CAN_MB6) Base Address +AT91C_BASE_CAN_MB7 EQU (0xFFFD02E0) ;- (CAN_MB7) Base Address +AT91C_BASE_CAN EQU (0xFFFD0000) ;- (CAN) Base Address +AT91C_BASE_EMAC EQU (0xFFFDC000) ;- (EMAC) Base Address +AT91C_BASE_PDC_ADC EQU (0xFFFD8100) ;- (PDC_ADC) Base Address +AT91C_BASE_ADC EQU (0xFFFD8000) ;- (ADC) Base Address + +;- ***************************************************************************** +;- MEMORY MAPPING DEFINITIONS FOR AT91SAM7X256 +;- ***************************************************************************** +;- ISRAM +AT91C_ISRAM EQU (0x00200000) ;- Internal SRAM base address +AT91C_ISRAM_SIZE EQU (0x00010000) ;- Internal SRAM size in byte (64 Kbytes) +;- IFLASH +AT91C_IFLASH EQU (0x00100000) ;- Internal FLASH base address +AT91C_IFLASH_SIZE EQU (0x00040000) ;- Internal FLASH size in byte (256 Kbytes) +AT91C_IFLASH_PAGE_SIZE EQU (256) ;- Internal FLASH Page Size: 256 bytes +AT91C_IFLASH_LOCK_REGION_SIZE EQU (16384) ;- Internal FLASH Lock Region Size: 16 Kbytes +AT91C_IFLASH_NB_OF_PAGES EQU (1024) ;- Internal FLASH Number of Pages: 1024 bytes +AT91C_IFLASH_NB_OF_LOCK_BITS EQU (16) ;- Internal FLASH Number of Lock Bits: 16 bytes + + + END diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.rdf b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.rdf new file mode 100644 index 0000000..7668f5b --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.rdf @@ -0,0 +1,4704 @@ +# ---------------------------------------------------------------------------- +# ATMEL Microcontroller Software Support - ROUSSET - +# ---------------------------------------------------------------------------- +# DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +# DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ---------------------------------------------------------------------------- +# File Name : AT91SAM7X256.h +# Object : AT91SAM7X256 definitions +# Generated : AT91 SW Application Group 11/02/2005 (15:17:24) +# +# CVS Reference : /AT91SAM7X256.pl/1.14/Tue Sep 13 15:06:52 2005// +# CVS Reference : /SYS_SAM7X.pl/1.3/Tue Feb 1 17:01:43 2005// +# CVS Reference : /MC_SAM7X.pl/1.2/Fri May 20 14:13:04 2005// +# CVS Reference : /PMC_SAM7X.pl/1.4/Tue Feb 8 13:58:10 2005// +# CVS Reference : /RSTC_SAM7X.pl/1.2/Wed Jul 13 14:57:50 2005// +# CVS Reference : /UDP_SAM7X.pl/1.1/Tue May 10 11:35:35 2005// +# CVS Reference : /PWM_SAM7X.pl/1.1/Tue May 10 11:53:07 2005// +# CVS Reference : /AIC_6075B.pl/1.3/Fri May 20 14:01:30 2005// +# CVS Reference : /PIO_6057A.pl/1.2/Thu Feb 3 10:18:28 2005// +# CVS Reference : /RTTC_6081A.pl/1.2/Tue Nov 9 14:43:58 2004// +# CVS Reference : /PITC_6079A.pl/1.2/Tue Nov 9 14:43:56 2004// +# CVS Reference : /WDTC_6080A.pl/1.3/Tue Nov 9 14:44:00 2004// +# CVS Reference : /VREG_6085B.pl/1.1/Tue Feb 1 16:05:48 2005// +# CVS Reference : /PDC_6074C.pl/1.2/Thu Feb 3 08:48:54 2005// +# CVS Reference : /DBGU_6059D.pl/1.1/Mon Jan 31 13:15:32 2005// +# CVS Reference : /SPI_6088D.pl/1.3/Fri May 20 14:08:59 2005// +# CVS Reference : /US_6089C.pl/1.1/Mon Jul 12 18:23:26 2004// +# CVS Reference : /SSC_6078B.pl/1.1/Wed Jul 13 15:19:19 2005// +# CVS Reference : /TWI_6061A.pl/1.1/Tue Jul 13 07:38:06 2004// +# CVS Reference : /TC_6082A.pl/1.7/Fri Mar 11 12:52:17 2005// +# CVS Reference : /CAN_6019B.pl/1.1/Tue Mar 8 12:42:22 2005// +# CVS Reference : /EMACB_6119A.pl/1.6/Wed Jul 13 15:05:35 2005// +# CVS Reference : /ADC_6051C.pl/1.1/Fri Oct 17 09:12:38 2003// +# ---------------------------------------------------------------------------- + +rdf.version=1 + +~sysinclude=arm_default.rdf +~sysinclude=arm_status.rdf +# ========== Register definition for SYS peripheral ========== +# ========== Register definition for AIC peripheral ========== +AT91C_AIC_IVR.name="AT91C_AIC_IVR" +AT91C_AIC_IVR.description="IRQ Vector Register" +AT91C_AIC_IVR.helpkey="IRQ Vector Register" +AT91C_AIC_IVR.access=memorymapped +AT91C_AIC_IVR.address=0xFFFFF100 +AT91C_AIC_IVR.width=32 +AT91C_AIC_IVR.byteEndian=little +AT91C_AIC_IVR.permission.write=none +AT91C_AIC_SMR.name="AT91C_AIC_SMR" +AT91C_AIC_SMR.description="Source Mode Register" +AT91C_AIC_SMR.helpkey="Source Mode Register" +AT91C_AIC_SMR.access=memorymapped +AT91C_AIC_SMR.address=0xFFFFF000 +AT91C_AIC_SMR.width=32 +AT91C_AIC_SMR.byteEndian=little +AT91C_AIC_FVR.name="AT91C_AIC_FVR" +AT91C_AIC_FVR.description="FIQ Vector Register" +AT91C_AIC_FVR.helpkey="FIQ Vector Register" +AT91C_AIC_FVR.access=memorymapped +AT91C_AIC_FVR.address=0xFFFFF104 +AT91C_AIC_FVR.width=32 +AT91C_AIC_FVR.byteEndian=little +AT91C_AIC_FVR.permission.write=none +AT91C_AIC_DCR.name="AT91C_AIC_DCR" +AT91C_AIC_DCR.description="Debug Control Register (Protect)" +AT91C_AIC_DCR.helpkey="Debug Control Register (Protect)" +AT91C_AIC_DCR.access=memorymapped +AT91C_AIC_DCR.address=0xFFFFF138 +AT91C_AIC_DCR.width=32 +AT91C_AIC_DCR.byteEndian=little +AT91C_AIC_EOICR.name="AT91C_AIC_EOICR" +AT91C_AIC_EOICR.description="End of Interrupt Command Register" +AT91C_AIC_EOICR.helpkey="End of Interrupt Command Register" +AT91C_AIC_EOICR.access=memorymapped +AT91C_AIC_EOICR.address=0xFFFFF130 +AT91C_AIC_EOICR.width=32 +AT91C_AIC_EOICR.byteEndian=little +AT91C_AIC_EOICR.type=enum +AT91C_AIC_EOICR.enum.0.name=*** Write only *** +AT91C_AIC_EOICR.enum.1.name=Error +AT91C_AIC_SVR.name="AT91C_AIC_SVR" +AT91C_AIC_SVR.description="Source Vector Register" +AT91C_AIC_SVR.helpkey="Source Vector Register" +AT91C_AIC_SVR.access=memorymapped +AT91C_AIC_SVR.address=0xFFFFF080 +AT91C_AIC_SVR.width=32 +AT91C_AIC_SVR.byteEndian=little +AT91C_AIC_FFSR.name="AT91C_AIC_FFSR" +AT91C_AIC_FFSR.description="Fast Forcing Status Register" +AT91C_AIC_FFSR.helpkey="Fast Forcing Status Register" +AT91C_AIC_FFSR.access=memorymapped +AT91C_AIC_FFSR.address=0xFFFFF148 +AT91C_AIC_FFSR.width=32 +AT91C_AIC_FFSR.byteEndian=little +AT91C_AIC_FFSR.permission.write=none +AT91C_AIC_ICCR.name="AT91C_AIC_ICCR" +AT91C_AIC_ICCR.description="Interrupt Clear Command Register" +AT91C_AIC_ICCR.helpkey="Interrupt Clear Command Register" +AT91C_AIC_ICCR.access=memorymapped +AT91C_AIC_ICCR.address=0xFFFFF128 +AT91C_AIC_ICCR.width=32 +AT91C_AIC_ICCR.byteEndian=little +AT91C_AIC_ICCR.type=enum +AT91C_AIC_ICCR.enum.0.name=*** Write only *** +AT91C_AIC_ICCR.enum.1.name=Error +AT91C_AIC_ISR.name="AT91C_AIC_ISR" +AT91C_AIC_ISR.description="Interrupt Status Register" +AT91C_AIC_ISR.helpkey="Interrupt Status Register" +AT91C_AIC_ISR.access=memorymapped +AT91C_AIC_ISR.address=0xFFFFF108 +AT91C_AIC_ISR.width=32 +AT91C_AIC_ISR.byteEndian=little +AT91C_AIC_ISR.permission.write=none +AT91C_AIC_IMR.name="AT91C_AIC_IMR" +AT91C_AIC_IMR.description="Interrupt Mask Register" +AT91C_AIC_IMR.helpkey="Interrupt Mask Register" +AT91C_AIC_IMR.access=memorymapped +AT91C_AIC_IMR.address=0xFFFFF110 +AT91C_AIC_IMR.width=32 +AT91C_AIC_IMR.byteEndian=little +AT91C_AIC_IMR.permission.write=none +AT91C_AIC_IPR.name="AT91C_AIC_IPR" +AT91C_AIC_IPR.description="Interrupt Pending Register" +AT91C_AIC_IPR.helpkey="Interrupt Pending Register" +AT91C_AIC_IPR.access=memorymapped +AT91C_AIC_IPR.address=0xFFFFF10C +AT91C_AIC_IPR.width=32 +AT91C_AIC_IPR.byteEndian=little +AT91C_AIC_IPR.permission.write=none +AT91C_AIC_FFER.name="AT91C_AIC_FFER" +AT91C_AIC_FFER.description="Fast Forcing Enable Register" +AT91C_AIC_FFER.helpkey="Fast Forcing Enable Register" +AT91C_AIC_FFER.access=memorymapped +AT91C_AIC_FFER.address=0xFFFFF140 +AT91C_AIC_FFER.width=32 +AT91C_AIC_FFER.byteEndian=little +AT91C_AIC_FFER.type=enum +AT91C_AIC_FFER.enum.0.name=*** Write only *** +AT91C_AIC_FFER.enum.1.name=Error +AT91C_AIC_IECR.name="AT91C_AIC_IECR" +AT91C_AIC_IECR.description="Interrupt Enable Command Register" +AT91C_AIC_IECR.helpkey="Interrupt Enable Command Register" +AT91C_AIC_IECR.access=memorymapped +AT91C_AIC_IECR.address=0xFFFFF120 +AT91C_AIC_IECR.width=32 +AT91C_AIC_IECR.byteEndian=little +AT91C_AIC_IECR.type=enum +AT91C_AIC_IECR.enum.0.name=*** Write only *** +AT91C_AIC_IECR.enum.1.name=Error +AT91C_AIC_ISCR.name="AT91C_AIC_ISCR" +AT91C_AIC_ISCR.description="Interrupt Set Command Register" +AT91C_AIC_ISCR.helpkey="Interrupt Set Command Register" +AT91C_AIC_ISCR.access=memorymapped +AT91C_AIC_ISCR.address=0xFFFFF12C +AT91C_AIC_ISCR.width=32 +AT91C_AIC_ISCR.byteEndian=little +AT91C_AIC_ISCR.type=enum +AT91C_AIC_ISCR.enum.0.name=*** Write only *** +AT91C_AIC_ISCR.enum.1.name=Error +AT91C_AIC_FFDR.name="AT91C_AIC_FFDR" +AT91C_AIC_FFDR.description="Fast Forcing Disable Register" +AT91C_AIC_FFDR.helpkey="Fast Forcing Disable Register" +AT91C_AIC_FFDR.access=memorymapped +AT91C_AIC_FFDR.address=0xFFFFF144 +AT91C_AIC_FFDR.width=32 +AT91C_AIC_FFDR.byteEndian=little +AT91C_AIC_FFDR.type=enum +AT91C_AIC_FFDR.enum.0.name=*** Write only *** +AT91C_AIC_FFDR.enum.1.name=Error +AT91C_AIC_CISR.name="AT91C_AIC_CISR" +AT91C_AIC_CISR.description="Core Interrupt Status Register" +AT91C_AIC_CISR.helpkey="Core Interrupt Status Register" +AT91C_AIC_CISR.access=memorymapped +AT91C_AIC_CISR.address=0xFFFFF114 +AT91C_AIC_CISR.width=32 +AT91C_AIC_CISR.byteEndian=little +AT91C_AIC_CISR.permission.write=none +AT91C_AIC_IDCR.name="AT91C_AIC_IDCR" +AT91C_AIC_IDCR.description="Interrupt Disable Command Register" +AT91C_AIC_IDCR.helpkey="Interrupt Disable Command Register" +AT91C_AIC_IDCR.access=memorymapped +AT91C_AIC_IDCR.address=0xFFFFF124 +AT91C_AIC_IDCR.width=32 +AT91C_AIC_IDCR.byteEndian=little +AT91C_AIC_IDCR.type=enum +AT91C_AIC_IDCR.enum.0.name=*** Write only *** +AT91C_AIC_IDCR.enum.1.name=Error +AT91C_AIC_SPU.name="AT91C_AIC_SPU" +AT91C_AIC_SPU.description="Spurious Vector Register" +AT91C_AIC_SPU.helpkey="Spurious Vector Register" +AT91C_AIC_SPU.access=memorymapped +AT91C_AIC_SPU.address=0xFFFFF134 +AT91C_AIC_SPU.width=32 +AT91C_AIC_SPU.byteEndian=little +# ========== Register definition for PDC_DBGU peripheral ========== +AT91C_DBGU_TCR.name="AT91C_DBGU_TCR" +AT91C_DBGU_TCR.description="Transmit Counter Register" +AT91C_DBGU_TCR.helpkey="Transmit Counter Register" +AT91C_DBGU_TCR.access=memorymapped +AT91C_DBGU_TCR.address=0xFFFFF30C +AT91C_DBGU_TCR.width=32 +AT91C_DBGU_TCR.byteEndian=little +AT91C_DBGU_RNPR.name="AT91C_DBGU_RNPR" +AT91C_DBGU_RNPR.description="Receive Next Pointer Register" +AT91C_DBGU_RNPR.helpkey="Receive Next Pointer Register" +AT91C_DBGU_RNPR.access=memorymapped +AT91C_DBGU_RNPR.address=0xFFFFF310 +AT91C_DBGU_RNPR.width=32 +AT91C_DBGU_RNPR.byteEndian=little +AT91C_DBGU_TNPR.name="AT91C_DBGU_TNPR" +AT91C_DBGU_TNPR.description="Transmit Next Pointer Register" +AT91C_DBGU_TNPR.helpkey="Transmit Next Pointer Register" +AT91C_DBGU_TNPR.access=memorymapped +AT91C_DBGU_TNPR.address=0xFFFFF318 +AT91C_DBGU_TNPR.width=32 +AT91C_DBGU_TNPR.byteEndian=little +AT91C_DBGU_TPR.name="AT91C_DBGU_TPR" +AT91C_DBGU_TPR.description="Transmit Pointer Register" +AT91C_DBGU_TPR.helpkey="Transmit Pointer Register" +AT91C_DBGU_TPR.access=memorymapped +AT91C_DBGU_TPR.address=0xFFFFF308 +AT91C_DBGU_TPR.width=32 +AT91C_DBGU_TPR.byteEndian=little +AT91C_DBGU_RPR.name="AT91C_DBGU_RPR" +AT91C_DBGU_RPR.description="Receive Pointer Register" +AT91C_DBGU_RPR.helpkey="Receive Pointer Register" +AT91C_DBGU_RPR.access=memorymapped +AT91C_DBGU_RPR.address=0xFFFFF300 +AT91C_DBGU_RPR.width=32 +AT91C_DBGU_RPR.byteEndian=little +AT91C_DBGU_RCR.name="AT91C_DBGU_RCR" +AT91C_DBGU_RCR.description="Receive Counter Register" +AT91C_DBGU_RCR.helpkey="Receive Counter Register" +AT91C_DBGU_RCR.access=memorymapped +AT91C_DBGU_RCR.address=0xFFFFF304 +AT91C_DBGU_RCR.width=32 +AT91C_DBGU_RCR.byteEndian=little +AT91C_DBGU_RNCR.name="AT91C_DBGU_RNCR" +AT91C_DBGU_RNCR.description="Receive Next Counter Register" +AT91C_DBGU_RNCR.helpkey="Receive Next Counter Register" +AT91C_DBGU_RNCR.access=memorymapped +AT91C_DBGU_RNCR.address=0xFFFFF314 +AT91C_DBGU_RNCR.width=32 +AT91C_DBGU_RNCR.byteEndian=little +AT91C_DBGU_PTCR.name="AT91C_DBGU_PTCR" +AT91C_DBGU_PTCR.description="PDC Transfer Control Register" +AT91C_DBGU_PTCR.helpkey="PDC Transfer Control Register" +AT91C_DBGU_PTCR.access=memorymapped +AT91C_DBGU_PTCR.address=0xFFFFF320 +AT91C_DBGU_PTCR.width=32 +AT91C_DBGU_PTCR.byteEndian=little +AT91C_DBGU_PTCR.type=enum +AT91C_DBGU_PTCR.enum.0.name=*** Write only *** +AT91C_DBGU_PTCR.enum.1.name=Error +AT91C_DBGU_PTSR.name="AT91C_DBGU_PTSR" +AT91C_DBGU_PTSR.description="PDC Transfer Status Register" +AT91C_DBGU_PTSR.helpkey="PDC Transfer Status Register" +AT91C_DBGU_PTSR.access=memorymapped +AT91C_DBGU_PTSR.address=0xFFFFF324 +AT91C_DBGU_PTSR.width=32 +AT91C_DBGU_PTSR.byteEndian=little +AT91C_DBGU_PTSR.permission.write=none +AT91C_DBGU_TNCR.name="AT91C_DBGU_TNCR" +AT91C_DBGU_TNCR.description="Transmit Next Counter Register" +AT91C_DBGU_TNCR.helpkey="Transmit Next Counter Register" +AT91C_DBGU_TNCR.access=memorymapped +AT91C_DBGU_TNCR.address=0xFFFFF31C +AT91C_DBGU_TNCR.width=32 +AT91C_DBGU_TNCR.byteEndian=little +# ========== Register definition for DBGU peripheral ========== +AT91C_DBGU_EXID.name="AT91C_DBGU_EXID" +AT91C_DBGU_EXID.description="Chip ID Extension Register" +AT91C_DBGU_EXID.helpkey="Chip ID Extension Register" +AT91C_DBGU_EXID.access=memorymapped +AT91C_DBGU_EXID.address=0xFFFFF244 +AT91C_DBGU_EXID.width=32 +AT91C_DBGU_EXID.byteEndian=little +AT91C_DBGU_EXID.permission.write=none +AT91C_DBGU_BRGR.name="AT91C_DBGU_BRGR" +AT91C_DBGU_BRGR.description="Baud Rate Generator Register" +AT91C_DBGU_BRGR.helpkey="Baud Rate Generator Register" +AT91C_DBGU_BRGR.access=memorymapped +AT91C_DBGU_BRGR.address=0xFFFFF220 +AT91C_DBGU_BRGR.width=32 +AT91C_DBGU_BRGR.byteEndian=little +AT91C_DBGU_IDR.name="AT91C_DBGU_IDR" +AT91C_DBGU_IDR.description="Interrupt Disable Register" +AT91C_DBGU_IDR.helpkey="Interrupt Disable Register" +AT91C_DBGU_IDR.access=memorymapped +AT91C_DBGU_IDR.address=0xFFFFF20C +AT91C_DBGU_IDR.width=32 +AT91C_DBGU_IDR.byteEndian=little +AT91C_DBGU_IDR.type=enum +AT91C_DBGU_IDR.enum.0.name=*** Write only *** +AT91C_DBGU_IDR.enum.1.name=Error +AT91C_DBGU_CSR.name="AT91C_DBGU_CSR" +AT91C_DBGU_CSR.description="Channel Status Register" +AT91C_DBGU_CSR.helpkey="Channel Status Register" +AT91C_DBGU_CSR.access=memorymapped +AT91C_DBGU_CSR.address=0xFFFFF214 +AT91C_DBGU_CSR.width=32 +AT91C_DBGU_CSR.byteEndian=little +AT91C_DBGU_CSR.permission.write=none +AT91C_DBGU_CIDR.name="AT91C_DBGU_CIDR" +AT91C_DBGU_CIDR.description="Chip ID Register" +AT91C_DBGU_CIDR.helpkey="Chip ID Register" +AT91C_DBGU_CIDR.access=memorymapped +AT91C_DBGU_CIDR.address=0xFFFFF240 +AT91C_DBGU_CIDR.width=32 +AT91C_DBGU_CIDR.byteEndian=little +AT91C_DBGU_CIDR.permission.write=none +AT91C_DBGU_MR.name="AT91C_DBGU_MR" +AT91C_DBGU_MR.description="Mode Register" +AT91C_DBGU_MR.helpkey="Mode Register" +AT91C_DBGU_MR.access=memorymapped +AT91C_DBGU_MR.address=0xFFFFF204 +AT91C_DBGU_MR.width=32 +AT91C_DBGU_MR.byteEndian=little +AT91C_DBGU_IMR.name="AT91C_DBGU_IMR" +AT91C_DBGU_IMR.description="Interrupt Mask Register" +AT91C_DBGU_IMR.helpkey="Interrupt Mask Register" +AT91C_DBGU_IMR.access=memorymapped +AT91C_DBGU_IMR.address=0xFFFFF210 +AT91C_DBGU_IMR.width=32 +AT91C_DBGU_IMR.byteEndian=little +AT91C_DBGU_IMR.permission.write=none +AT91C_DBGU_CR.name="AT91C_DBGU_CR" +AT91C_DBGU_CR.description="Control Register" +AT91C_DBGU_CR.helpkey="Control Register" +AT91C_DBGU_CR.access=memorymapped +AT91C_DBGU_CR.address=0xFFFFF200 +AT91C_DBGU_CR.width=32 +AT91C_DBGU_CR.byteEndian=little +AT91C_DBGU_CR.type=enum +AT91C_DBGU_CR.enum.0.name=*** Write only *** +AT91C_DBGU_CR.enum.1.name=Error +AT91C_DBGU_FNTR.name="AT91C_DBGU_FNTR" +AT91C_DBGU_FNTR.description="Force NTRST Register" +AT91C_DBGU_FNTR.helpkey="Force NTRST Register" +AT91C_DBGU_FNTR.access=memorymapped +AT91C_DBGU_FNTR.address=0xFFFFF248 +AT91C_DBGU_FNTR.width=32 +AT91C_DBGU_FNTR.byteEndian=little +AT91C_DBGU_THR.name="AT91C_DBGU_THR" +AT91C_DBGU_THR.description="Transmitter Holding Register" +AT91C_DBGU_THR.helpkey="Transmitter Holding Register" +AT91C_DBGU_THR.access=memorymapped +AT91C_DBGU_THR.address=0xFFFFF21C +AT91C_DBGU_THR.width=32 +AT91C_DBGU_THR.byteEndian=little +AT91C_DBGU_THR.type=enum +AT91C_DBGU_THR.enum.0.name=*** Write only *** +AT91C_DBGU_THR.enum.1.name=Error +AT91C_DBGU_RHR.name="AT91C_DBGU_RHR" +AT91C_DBGU_RHR.description="Receiver Holding Register" +AT91C_DBGU_RHR.helpkey="Receiver Holding Register" +AT91C_DBGU_RHR.access=memorymapped +AT91C_DBGU_RHR.address=0xFFFFF218 +AT91C_DBGU_RHR.width=32 +AT91C_DBGU_RHR.byteEndian=little +AT91C_DBGU_RHR.permission.write=none +AT91C_DBGU_IER.name="AT91C_DBGU_IER" +AT91C_DBGU_IER.description="Interrupt Enable Register" +AT91C_DBGU_IER.helpkey="Interrupt Enable Register" +AT91C_DBGU_IER.access=memorymapped +AT91C_DBGU_IER.address=0xFFFFF208 +AT91C_DBGU_IER.width=32 +AT91C_DBGU_IER.byteEndian=little +AT91C_DBGU_IER.type=enum +AT91C_DBGU_IER.enum.0.name=*** Write only *** +AT91C_DBGU_IER.enum.1.name=Error +# ========== Register definition for PIOA peripheral ========== +AT91C_PIOA_ODR.name="AT91C_PIOA_ODR" +AT91C_PIOA_ODR.description="Output Disable Registerr" +AT91C_PIOA_ODR.helpkey="Output Disable Registerr" +AT91C_PIOA_ODR.access=memorymapped +AT91C_PIOA_ODR.address=0xFFFFF414 +AT91C_PIOA_ODR.width=32 +AT91C_PIOA_ODR.byteEndian=little +AT91C_PIOA_ODR.type=enum +AT91C_PIOA_ODR.enum.0.name=*** Write only *** +AT91C_PIOA_ODR.enum.1.name=Error +AT91C_PIOA_SODR.name="AT91C_PIOA_SODR" +AT91C_PIOA_SODR.description="Set Output Data Register" +AT91C_PIOA_SODR.helpkey="Set Output Data Register" +AT91C_PIOA_SODR.access=memorymapped +AT91C_PIOA_SODR.address=0xFFFFF430 +AT91C_PIOA_SODR.width=32 +AT91C_PIOA_SODR.byteEndian=little +AT91C_PIOA_SODR.type=enum +AT91C_PIOA_SODR.enum.0.name=*** Write only *** +AT91C_PIOA_SODR.enum.1.name=Error +AT91C_PIOA_ISR.name="AT91C_PIOA_ISR" +AT91C_PIOA_ISR.description="Interrupt Status Register" +AT91C_PIOA_ISR.helpkey="Interrupt Status Register" +AT91C_PIOA_ISR.access=memorymapped +AT91C_PIOA_ISR.address=0xFFFFF44C +AT91C_PIOA_ISR.width=32 +AT91C_PIOA_ISR.byteEndian=little +AT91C_PIOA_ISR.permission.write=none +AT91C_PIOA_ABSR.name="AT91C_PIOA_ABSR" +AT91C_PIOA_ABSR.description="AB Select Status Register" +AT91C_PIOA_ABSR.helpkey="AB Select Status Register" +AT91C_PIOA_ABSR.access=memorymapped +AT91C_PIOA_ABSR.address=0xFFFFF478 +AT91C_PIOA_ABSR.width=32 +AT91C_PIOA_ABSR.byteEndian=little +AT91C_PIOA_ABSR.permission.write=none +AT91C_PIOA_IER.name="AT91C_PIOA_IER" +AT91C_PIOA_IER.description="Interrupt Enable Register" +AT91C_PIOA_IER.helpkey="Interrupt Enable Register" +AT91C_PIOA_IER.access=memorymapped +AT91C_PIOA_IER.address=0xFFFFF440 +AT91C_PIOA_IER.width=32 +AT91C_PIOA_IER.byteEndian=little +AT91C_PIOA_IER.type=enum +AT91C_PIOA_IER.enum.0.name=*** Write only *** +AT91C_PIOA_IER.enum.1.name=Error +AT91C_PIOA_PPUDR.name="AT91C_PIOA_PPUDR" +AT91C_PIOA_PPUDR.description="Pull-up Disable Register" +AT91C_PIOA_PPUDR.helpkey="Pull-up Disable Register" +AT91C_PIOA_PPUDR.access=memorymapped +AT91C_PIOA_PPUDR.address=0xFFFFF460 +AT91C_PIOA_PPUDR.width=32 +AT91C_PIOA_PPUDR.byteEndian=little +AT91C_PIOA_PPUDR.type=enum +AT91C_PIOA_PPUDR.enum.0.name=*** Write only *** +AT91C_PIOA_PPUDR.enum.1.name=Error +AT91C_PIOA_IMR.name="AT91C_PIOA_IMR" +AT91C_PIOA_IMR.description="Interrupt Mask Register" +AT91C_PIOA_IMR.helpkey="Interrupt Mask Register" +AT91C_PIOA_IMR.access=memorymapped +AT91C_PIOA_IMR.address=0xFFFFF448 +AT91C_PIOA_IMR.width=32 +AT91C_PIOA_IMR.byteEndian=little +AT91C_PIOA_IMR.permission.write=none +AT91C_PIOA_PER.name="AT91C_PIOA_PER" +AT91C_PIOA_PER.description="PIO Enable Register" +AT91C_PIOA_PER.helpkey="PIO Enable Register" +AT91C_PIOA_PER.access=memorymapped +AT91C_PIOA_PER.address=0xFFFFF400 +AT91C_PIOA_PER.width=32 +AT91C_PIOA_PER.byteEndian=little +AT91C_PIOA_PER.type=enum +AT91C_PIOA_PER.enum.0.name=*** Write only *** +AT91C_PIOA_PER.enum.1.name=Error +AT91C_PIOA_IFDR.name="AT91C_PIOA_IFDR" +AT91C_PIOA_IFDR.description="Input Filter Disable Register" +AT91C_PIOA_IFDR.helpkey="Input Filter Disable Register" +AT91C_PIOA_IFDR.access=memorymapped +AT91C_PIOA_IFDR.address=0xFFFFF424 +AT91C_PIOA_IFDR.width=32 +AT91C_PIOA_IFDR.byteEndian=little +AT91C_PIOA_IFDR.type=enum +AT91C_PIOA_IFDR.enum.0.name=*** Write only *** +AT91C_PIOA_IFDR.enum.1.name=Error +AT91C_PIOA_OWDR.name="AT91C_PIOA_OWDR" +AT91C_PIOA_OWDR.description="Output Write Disable Register" +AT91C_PIOA_OWDR.helpkey="Output Write Disable Register" +AT91C_PIOA_OWDR.access=memorymapped +AT91C_PIOA_OWDR.address=0xFFFFF4A4 +AT91C_PIOA_OWDR.width=32 +AT91C_PIOA_OWDR.byteEndian=little +AT91C_PIOA_OWDR.type=enum +AT91C_PIOA_OWDR.enum.0.name=*** Write only *** +AT91C_PIOA_OWDR.enum.1.name=Error +AT91C_PIOA_MDSR.name="AT91C_PIOA_MDSR" +AT91C_PIOA_MDSR.description="Multi-driver Status Register" +AT91C_PIOA_MDSR.helpkey="Multi-driver Status Register" +AT91C_PIOA_MDSR.access=memorymapped +AT91C_PIOA_MDSR.address=0xFFFFF458 +AT91C_PIOA_MDSR.width=32 +AT91C_PIOA_MDSR.byteEndian=little +AT91C_PIOA_MDSR.permission.write=none +AT91C_PIOA_IDR.name="AT91C_PIOA_IDR" +AT91C_PIOA_IDR.description="Interrupt Disable Register" +AT91C_PIOA_IDR.helpkey="Interrupt Disable Register" +AT91C_PIOA_IDR.access=memorymapped +AT91C_PIOA_IDR.address=0xFFFFF444 +AT91C_PIOA_IDR.width=32 +AT91C_PIOA_IDR.byteEndian=little +AT91C_PIOA_IDR.type=enum +AT91C_PIOA_IDR.enum.0.name=*** Write only *** +AT91C_PIOA_IDR.enum.1.name=Error +AT91C_PIOA_ODSR.name="AT91C_PIOA_ODSR" +AT91C_PIOA_ODSR.description="Output Data Status Register" +AT91C_PIOA_ODSR.helpkey="Output Data Status Register" +AT91C_PIOA_ODSR.access=memorymapped +AT91C_PIOA_ODSR.address=0xFFFFF438 +AT91C_PIOA_ODSR.width=32 +AT91C_PIOA_ODSR.byteEndian=little +AT91C_PIOA_ODSR.permission.write=none +AT91C_PIOA_PPUSR.name="AT91C_PIOA_PPUSR" +AT91C_PIOA_PPUSR.description="Pull-up Status Register" +AT91C_PIOA_PPUSR.helpkey="Pull-up Status Register" +AT91C_PIOA_PPUSR.access=memorymapped +AT91C_PIOA_PPUSR.address=0xFFFFF468 +AT91C_PIOA_PPUSR.width=32 +AT91C_PIOA_PPUSR.byteEndian=little +AT91C_PIOA_PPUSR.permission.write=none +AT91C_PIOA_OWSR.name="AT91C_PIOA_OWSR" +AT91C_PIOA_OWSR.description="Output Write Status Register" +AT91C_PIOA_OWSR.helpkey="Output Write Status Register" +AT91C_PIOA_OWSR.access=memorymapped +AT91C_PIOA_OWSR.address=0xFFFFF4A8 +AT91C_PIOA_OWSR.width=32 +AT91C_PIOA_OWSR.byteEndian=little +AT91C_PIOA_OWSR.permission.write=none +AT91C_PIOA_BSR.name="AT91C_PIOA_BSR" +AT91C_PIOA_BSR.description="Select B Register" +AT91C_PIOA_BSR.helpkey="Select B Register" +AT91C_PIOA_BSR.access=memorymapped +AT91C_PIOA_BSR.address=0xFFFFF474 +AT91C_PIOA_BSR.width=32 +AT91C_PIOA_BSR.byteEndian=little +AT91C_PIOA_BSR.type=enum +AT91C_PIOA_BSR.enum.0.name=*** Write only *** +AT91C_PIOA_BSR.enum.1.name=Error +AT91C_PIOA_OWER.name="AT91C_PIOA_OWER" +AT91C_PIOA_OWER.description="Output Write Enable Register" +AT91C_PIOA_OWER.helpkey="Output Write Enable Register" +AT91C_PIOA_OWER.access=memorymapped +AT91C_PIOA_OWER.address=0xFFFFF4A0 +AT91C_PIOA_OWER.width=32 +AT91C_PIOA_OWER.byteEndian=little +AT91C_PIOA_OWER.type=enum +AT91C_PIOA_OWER.enum.0.name=*** Write only *** +AT91C_PIOA_OWER.enum.1.name=Error +AT91C_PIOA_IFER.name="AT91C_PIOA_IFER" +AT91C_PIOA_IFER.description="Input Filter Enable Register" +AT91C_PIOA_IFER.helpkey="Input Filter Enable Register" +AT91C_PIOA_IFER.access=memorymapped +AT91C_PIOA_IFER.address=0xFFFFF420 +AT91C_PIOA_IFER.width=32 +AT91C_PIOA_IFER.byteEndian=little +AT91C_PIOA_IFER.type=enum +AT91C_PIOA_IFER.enum.0.name=*** Write only *** +AT91C_PIOA_IFER.enum.1.name=Error +AT91C_PIOA_PDSR.name="AT91C_PIOA_PDSR" +AT91C_PIOA_PDSR.description="Pin Data Status Register" +AT91C_PIOA_PDSR.helpkey="Pin Data Status Register" +AT91C_PIOA_PDSR.access=memorymapped +AT91C_PIOA_PDSR.address=0xFFFFF43C +AT91C_PIOA_PDSR.width=32 +AT91C_PIOA_PDSR.byteEndian=little +AT91C_PIOA_PDSR.permission.write=none +AT91C_PIOA_PPUER.name="AT91C_PIOA_PPUER" +AT91C_PIOA_PPUER.description="Pull-up Enable Register" +AT91C_PIOA_PPUER.helpkey="Pull-up Enable Register" +AT91C_PIOA_PPUER.access=memorymapped +AT91C_PIOA_PPUER.address=0xFFFFF464 +AT91C_PIOA_PPUER.width=32 +AT91C_PIOA_PPUER.byteEndian=little +AT91C_PIOA_PPUER.type=enum +AT91C_PIOA_PPUER.enum.0.name=*** Write only *** +AT91C_PIOA_PPUER.enum.1.name=Error +AT91C_PIOA_OSR.name="AT91C_PIOA_OSR" +AT91C_PIOA_OSR.description="Output Status Register" +AT91C_PIOA_OSR.helpkey="Output Status Register" +AT91C_PIOA_OSR.access=memorymapped +AT91C_PIOA_OSR.address=0xFFFFF418 +AT91C_PIOA_OSR.width=32 +AT91C_PIOA_OSR.byteEndian=little +AT91C_PIOA_OSR.permission.write=none +AT91C_PIOA_ASR.name="AT91C_PIOA_ASR" +AT91C_PIOA_ASR.description="Select A Register" +AT91C_PIOA_ASR.helpkey="Select A Register" +AT91C_PIOA_ASR.access=memorymapped +AT91C_PIOA_ASR.address=0xFFFFF470 +AT91C_PIOA_ASR.width=32 +AT91C_PIOA_ASR.byteEndian=little +AT91C_PIOA_ASR.type=enum +AT91C_PIOA_ASR.enum.0.name=*** Write only *** +AT91C_PIOA_ASR.enum.1.name=Error +AT91C_PIOA_MDDR.name="AT91C_PIOA_MDDR" +AT91C_PIOA_MDDR.description="Multi-driver Disable Register" +AT91C_PIOA_MDDR.helpkey="Multi-driver Disable Register" +AT91C_PIOA_MDDR.access=memorymapped +AT91C_PIOA_MDDR.address=0xFFFFF454 +AT91C_PIOA_MDDR.width=32 +AT91C_PIOA_MDDR.byteEndian=little +AT91C_PIOA_MDDR.type=enum +AT91C_PIOA_MDDR.enum.0.name=*** Write only *** +AT91C_PIOA_MDDR.enum.1.name=Error +AT91C_PIOA_CODR.name="AT91C_PIOA_CODR" +AT91C_PIOA_CODR.description="Clear Output Data Register" +AT91C_PIOA_CODR.helpkey="Clear Output Data Register" +AT91C_PIOA_CODR.access=memorymapped +AT91C_PIOA_CODR.address=0xFFFFF434 +AT91C_PIOA_CODR.width=32 +AT91C_PIOA_CODR.byteEndian=little +AT91C_PIOA_CODR.type=enum +AT91C_PIOA_CODR.enum.0.name=*** Write only *** +AT91C_PIOA_CODR.enum.1.name=Error +AT91C_PIOA_MDER.name="AT91C_PIOA_MDER" +AT91C_PIOA_MDER.description="Multi-driver Enable Register" +AT91C_PIOA_MDER.helpkey="Multi-driver Enable Register" +AT91C_PIOA_MDER.access=memorymapped +AT91C_PIOA_MDER.address=0xFFFFF450 +AT91C_PIOA_MDER.width=32 +AT91C_PIOA_MDER.byteEndian=little +AT91C_PIOA_MDER.type=enum +AT91C_PIOA_MDER.enum.0.name=*** Write only *** +AT91C_PIOA_MDER.enum.1.name=Error +AT91C_PIOA_PDR.name="AT91C_PIOA_PDR" +AT91C_PIOA_PDR.description="PIO Disable Register" +AT91C_PIOA_PDR.helpkey="PIO Disable Register" +AT91C_PIOA_PDR.access=memorymapped +AT91C_PIOA_PDR.address=0xFFFFF404 +AT91C_PIOA_PDR.width=32 +AT91C_PIOA_PDR.byteEndian=little +AT91C_PIOA_PDR.type=enum +AT91C_PIOA_PDR.enum.0.name=*** Write only *** +AT91C_PIOA_PDR.enum.1.name=Error +AT91C_PIOA_IFSR.name="AT91C_PIOA_IFSR" +AT91C_PIOA_IFSR.description="Input Filter Status Register" +AT91C_PIOA_IFSR.helpkey="Input Filter Status Register" +AT91C_PIOA_IFSR.access=memorymapped +AT91C_PIOA_IFSR.address=0xFFFFF428 +AT91C_PIOA_IFSR.width=32 +AT91C_PIOA_IFSR.byteEndian=little +AT91C_PIOA_IFSR.permission.write=none +AT91C_PIOA_OER.name="AT91C_PIOA_OER" +AT91C_PIOA_OER.description="Output Enable Register" +AT91C_PIOA_OER.helpkey="Output Enable Register" +AT91C_PIOA_OER.access=memorymapped +AT91C_PIOA_OER.address=0xFFFFF410 +AT91C_PIOA_OER.width=32 +AT91C_PIOA_OER.byteEndian=little +AT91C_PIOA_OER.type=enum +AT91C_PIOA_OER.enum.0.name=*** Write only *** +AT91C_PIOA_OER.enum.1.name=Error +AT91C_PIOA_PSR.name="AT91C_PIOA_PSR" +AT91C_PIOA_PSR.description="PIO Status Register" +AT91C_PIOA_PSR.helpkey="PIO Status Register" +AT91C_PIOA_PSR.access=memorymapped +AT91C_PIOA_PSR.address=0xFFFFF408 +AT91C_PIOA_PSR.width=32 +AT91C_PIOA_PSR.byteEndian=little +AT91C_PIOA_PSR.permission.write=none +# ========== Register definition for PIOB peripheral ========== +AT91C_PIOB_OWDR.name="AT91C_PIOB_OWDR" +AT91C_PIOB_OWDR.description="Output Write Disable Register" +AT91C_PIOB_OWDR.helpkey="Output Write Disable Register" +AT91C_PIOB_OWDR.access=memorymapped +AT91C_PIOB_OWDR.address=0xFFFFF6A4 +AT91C_PIOB_OWDR.width=32 +AT91C_PIOB_OWDR.byteEndian=little +AT91C_PIOB_OWDR.type=enum +AT91C_PIOB_OWDR.enum.0.name=*** Write only *** +AT91C_PIOB_OWDR.enum.1.name=Error +AT91C_PIOB_MDER.name="AT91C_PIOB_MDER" +AT91C_PIOB_MDER.description="Multi-driver Enable Register" +AT91C_PIOB_MDER.helpkey="Multi-driver Enable Register" +AT91C_PIOB_MDER.access=memorymapped +AT91C_PIOB_MDER.address=0xFFFFF650 +AT91C_PIOB_MDER.width=32 +AT91C_PIOB_MDER.byteEndian=little +AT91C_PIOB_MDER.type=enum +AT91C_PIOB_MDER.enum.0.name=*** Write only *** +AT91C_PIOB_MDER.enum.1.name=Error +AT91C_PIOB_PPUSR.name="AT91C_PIOB_PPUSR" +AT91C_PIOB_PPUSR.description="Pull-up Status Register" +AT91C_PIOB_PPUSR.helpkey="Pull-up Status Register" +AT91C_PIOB_PPUSR.access=memorymapped +AT91C_PIOB_PPUSR.address=0xFFFFF668 +AT91C_PIOB_PPUSR.width=32 +AT91C_PIOB_PPUSR.byteEndian=little +AT91C_PIOB_PPUSR.permission.write=none +AT91C_PIOB_IMR.name="AT91C_PIOB_IMR" +AT91C_PIOB_IMR.description="Interrupt Mask Register" +AT91C_PIOB_IMR.helpkey="Interrupt Mask Register" +AT91C_PIOB_IMR.access=memorymapped +AT91C_PIOB_IMR.address=0xFFFFF648 +AT91C_PIOB_IMR.width=32 +AT91C_PIOB_IMR.byteEndian=little +AT91C_PIOB_IMR.permission.write=none +AT91C_PIOB_ASR.name="AT91C_PIOB_ASR" +AT91C_PIOB_ASR.description="Select A Register" +AT91C_PIOB_ASR.helpkey="Select A Register" +AT91C_PIOB_ASR.access=memorymapped +AT91C_PIOB_ASR.address=0xFFFFF670 +AT91C_PIOB_ASR.width=32 +AT91C_PIOB_ASR.byteEndian=little +AT91C_PIOB_ASR.type=enum +AT91C_PIOB_ASR.enum.0.name=*** Write only *** +AT91C_PIOB_ASR.enum.1.name=Error +AT91C_PIOB_PPUDR.name="AT91C_PIOB_PPUDR" +AT91C_PIOB_PPUDR.description="Pull-up Disable Register" +AT91C_PIOB_PPUDR.helpkey="Pull-up Disable Register" +AT91C_PIOB_PPUDR.access=memorymapped +AT91C_PIOB_PPUDR.address=0xFFFFF660 +AT91C_PIOB_PPUDR.width=32 +AT91C_PIOB_PPUDR.byteEndian=little +AT91C_PIOB_PPUDR.type=enum +AT91C_PIOB_PPUDR.enum.0.name=*** Write only *** +AT91C_PIOB_PPUDR.enum.1.name=Error +AT91C_PIOB_PSR.name="AT91C_PIOB_PSR" +AT91C_PIOB_PSR.description="PIO Status Register" +AT91C_PIOB_PSR.helpkey="PIO Status Register" +AT91C_PIOB_PSR.access=memorymapped +AT91C_PIOB_PSR.address=0xFFFFF608 +AT91C_PIOB_PSR.width=32 +AT91C_PIOB_PSR.byteEndian=little +AT91C_PIOB_PSR.permission.write=none +AT91C_PIOB_IER.name="AT91C_PIOB_IER" +AT91C_PIOB_IER.description="Interrupt Enable Register" +AT91C_PIOB_IER.helpkey="Interrupt Enable Register" +AT91C_PIOB_IER.access=memorymapped +AT91C_PIOB_IER.address=0xFFFFF640 +AT91C_PIOB_IER.width=32 +AT91C_PIOB_IER.byteEndian=little +AT91C_PIOB_IER.type=enum +AT91C_PIOB_IER.enum.0.name=*** Write only *** +AT91C_PIOB_IER.enum.1.name=Error +AT91C_PIOB_CODR.name="AT91C_PIOB_CODR" +AT91C_PIOB_CODR.description="Clear Output Data Register" +AT91C_PIOB_CODR.helpkey="Clear Output Data Register" +AT91C_PIOB_CODR.access=memorymapped +AT91C_PIOB_CODR.address=0xFFFFF634 +AT91C_PIOB_CODR.width=32 +AT91C_PIOB_CODR.byteEndian=little +AT91C_PIOB_CODR.type=enum +AT91C_PIOB_CODR.enum.0.name=*** Write only *** +AT91C_PIOB_CODR.enum.1.name=Error +AT91C_PIOB_OWER.name="AT91C_PIOB_OWER" +AT91C_PIOB_OWER.description="Output Write Enable Register" +AT91C_PIOB_OWER.helpkey="Output Write Enable Register" +AT91C_PIOB_OWER.access=memorymapped +AT91C_PIOB_OWER.address=0xFFFFF6A0 +AT91C_PIOB_OWER.width=32 +AT91C_PIOB_OWER.byteEndian=little +AT91C_PIOB_OWER.type=enum +AT91C_PIOB_OWER.enum.0.name=*** Write only *** +AT91C_PIOB_OWER.enum.1.name=Error +AT91C_PIOB_ABSR.name="AT91C_PIOB_ABSR" +AT91C_PIOB_ABSR.description="AB Select Status Register" +AT91C_PIOB_ABSR.helpkey="AB Select Status Register" +AT91C_PIOB_ABSR.access=memorymapped +AT91C_PIOB_ABSR.address=0xFFFFF678 +AT91C_PIOB_ABSR.width=32 +AT91C_PIOB_ABSR.byteEndian=little +AT91C_PIOB_ABSR.permission.write=none +AT91C_PIOB_IFDR.name="AT91C_PIOB_IFDR" +AT91C_PIOB_IFDR.description="Input Filter Disable Register" +AT91C_PIOB_IFDR.helpkey="Input Filter Disable Register" +AT91C_PIOB_IFDR.access=memorymapped +AT91C_PIOB_IFDR.address=0xFFFFF624 +AT91C_PIOB_IFDR.width=32 +AT91C_PIOB_IFDR.byteEndian=little +AT91C_PIOB_IFDR.type=enum +AT91C_PIOB_IFDR.enum.0.name=*** Write only *** +AT91C_PIOB_IFDR.enum.1.name=Error +AT91C_PIOB_PDSR.name="AT91C_PIOB_PDSR" +AT91C_PIOB_PDSR.description="Pin Data Status Register" +AT91C_PIOB_PDSR.helpkey="Pin Data Status Register" +AT91C_PIOB_PDSR.access=memorymapped +AT91C_PIOB_PDSR.address=0xFFFFF63C +AT91C_PIOB_PDSR.width=32 +AT91C_PIOB_PDSR.byteEndian=little +AT91C_PIOB_PDSR.permission.write=none +AT91C_PIOB_IDR.name="AT91C_PIOB_IDR" +AT91C_PIOB_IDR.description="Interrupt Disable Register" +AT91C_PIOB_IDR.helpkey="Interrupt Disable Register" +AT91C_PIOB_IDR.access=memorymapped +AT91C_PIOB_IDR.address=0xFFFFF644 +AT91C_PIOB_IDR.width=32 +AT91C_PIOB_IDR.byteEndian=little +AT91C_PIOB_IDR.type=enum +AT91C_PIOB_IDR.enum.0.name=*** Write only *** +AT91C_PIOB_IDR.enum.1.name=Error +AT91C_PIOB_OWSR.name="AT91C_PIOB_OWSR" +AT91C_PIOB_OWSR.description="Output Write Status Register" +AT91C_PIOB_OWSR.helpkey="Output Write Status Register" +AT91C_PIOB_OWSR.access=memorymapped +AT91C_PIOB_OWSR.address=0xFFFFF6A8 +AT91C_PIOB_OWSR.width=32 +AT91C_PIOB_OWSR.byteEndian=little +AT91C_PIOB_OWSR.permission.write=none +AT91C_PIOB_PDR.name="AT91C_PIOB_PDR" +AT91C_PIOB_PDR.description="PIO Disable Register" +AT91C_PIOB_PDR.helpkey="PIO Disable Register" +AT91C_PIOB_PDR.access=memorymapped +AT91C_PIOB_PDR.address=0xFFFFF604 +AT91C_PIOB_PDR.width=32 +AT91C_PIOB_PDR.byteEndian=little +AT91C_PIOB_PDR.type=enum +AT91C_PIOB_PDR.enum.0.name=*** Write only *** +AT91C_PIOB_PDR.enum.1.name=Error +AT91C_PIOB_ODR.name="AT91C_PIOB_ODR" +AT91C_PIOB_ODR.description="Output Disable Registerr" +AT91C_PIOB_ODR.helpkey="Output Disable Registerr" +AT91C_PIOB_ODR.access=memorymapped +AT91C_PIOB_ODR.address=0xFFFFF614 +AT91C_PIOB_ODR.width=32 +AT91C_PIOB_ODR.byteEndian=little +AT91C_PIOB_ODR.type=enum +AT91C_PIOB_ODR.enum.0.name=*** Write only *** +AT91C_PIOB_ODR.enum.1.name=Error +AT91C_PIOB_IFSR.name="AT91C_PIOB_IFSR" +AT91C_PIOB_IFSR.description="Input Filter Status Register" +AT91C_PIOB_IFSR.helpkey="Input Filter Status Register" +AT91C_PIOB_IFSR.access=memorymapped +AT91C_PIOB_IFSR.address=0xFFFFF628 +AT91C_PIOB_IFSR.width=32 +AT91C_PIOB_IFSR.byteEndian=little +AT91C_PIOB_IFSR.permission.write=none +AT91C_PIOB_PPUER.name="AT91C_PIOB_PPUER" +AT91C_PIOB_PPUER.description="Pull-up Enable Register" +AT91C_PIOB_PPUER.helpkey="Pull-up Enable Register" +AT91C_PIOB_PPUER.access=memorymapped +AT91C_PIOB_PPUER.address=0xFFFFF664 +AT91C_PIOB_PPUER.width=32 +AT91C_PIOB_PPUER.byteEndian=little +AT91C_PIOB_PPUER.type=enum +AT91C_PIOB_PPUER.enum.0.name=*** Write only *** +AT91C_PIOB_PPUER.enum.1.name=Error +AT91C_PIOB_SODR.name="AT91C_PIOB_SODR" +AT91C_PIOB_SODR.description="Set Output Data Register" +AT91C_PIOB_SODR.helpkey="Set Output Data Register" +AT91C_PIOB_SODR.access=memorymapped +AT91C_PIOB_SODR.address=0xFFFFF630 +AT91C_PIOB_SODR.width=32 +AT91C_PIOB_SODR.byteEndian=little +AT91C_PIOB_SODR.type=enum +AT91C_PIOB_SODR.enum.0.name=*** Write only *** +AT91C_PIOB_SODR.enum.1.name=Error +AT91C_PIOB_ISR.name="AT91C_PIOB_ISR" +AT91C_PIOB_ISR.description="Interrupt Status Register" +AT91C_PIOB_ISR.helpkey="Interrupt Status Register" +AT91C_PIOB_ISR.access=memorymapped +AT91C_PIOB_ISR.address=0xFFFFF64C +AT91C_PIOB_ISR.width=32 +AT91C_PIOB_ISR.byteEndian=little +AT91C_PIOB_ISR.permission.write=none +AT91C_PIOB_ODSR.name="AT91C_PIOB_ODSR" +AT91C_PIOB_ODSR.description="Output Data Status Register" +AT91C_PIOB_ODSR.helpkey="Output Data Status Register" +AT91C_PIOB_ODSR.access=memorymapped +AT91C_PIOB_ODSR.address=0xFFFFF638 +AT91C_PIOB_ODSR.width=32 +AT91C_PIOB_ODSR.byteEndian=little +AT91C_PIOB_ODSR.permission.write=none +AT91C_PIOB_OSR.name="AT91C_PIOB_OSR" +AT91C_PIOB_OSR.description="Output Status Register" +AT91C_PIOB_OSR.helpkey="Output Status Register" +AT91C_PIOB_OSR.access=memorymapped +AT91C_PIOB_OSR.address=0xFFFFF618 +AT91C_PIOB_OSR.width=32 +AT91C_PIOB_OSR.byteEndian=little +AT91C_PIOB_OSR.permission.write=none +AT91C_PIOB_MDSR.name="AT91C_PIOB_MDSR" +AT91C_PIOB_MDSR.description="Multi-driver Status Register" +AT91C_PIOB_MDSR.helpkey="Multi-driver Status Register" +AT91C_PIOB_MDSR.access=memorymapped +AT91C_PIOB_MDSR.address=0xFFFFF658 +AT91C_PIOB_MDSR.width=32 +AT91C_PIOB_MDSR.byteEndian=little +AT91C_PIOB_MDSR.permission.write=none +AT91C_PIOB_IFER.name="AT91C_PIOB_IFER" +AT91C_PIOB_IFER.description="Input Filter Enable Register" +AT91C_PIOB_IFER.helpkey="Input Filter Enable Register" +AT91C_PIOB_IFER.access=memorymapped +AT91C_PIOB_IFER.address=0xFFFFF620 +AT91C_PIOB_IFER.width=32 +AT91C_PIOB_IFER.byteEndian=little +AT91C_PIOB_IFER.type=enum +AT91C_PIOB_IFER.enum.0.name=*** Write only *** +AT91C_PIOB_IFER.enum.1.name=Error +AT91C_PIOB_BSR.name="AT91C_PIOB_BSR" +AT91C_PIOB_BSR.description="Select B Register" +AT91C_PIOB_BSR.helpkey="Select B Register" +AT91C_PIOB_BSR.access=memorymapped +AT91C_PIOB_BSR.address=0xFFFFF674 +AT91C_PIOB_BSR.width=32 +AT91C_PIOB_BSR.byteEndian=little +AT91C_PIOB_BSR.type=enum +AT91C_PIOB_BSR.enum.0.name=*** Write only *** +AT91C_PIOB_BSR.enum.1.name=Error +AT91C_PIOB_MDDR.name="AT91C_PIOB_MDDR" +AT91C_PIOB_MDDR.description="Multi-driver Disable Register" +AT91C_PIOB_MDDR.helpkey="Multi-driver Disable Register" +AT91C_PIOB_MDDR.access=memorymapped +AT91C_PIOB_MDDR.address=0xFFFFF654 +AT91C_PIOB_MDDR.width=32 +AT91C_PIOB_MDDR.byteEndian=little +AT91C_PIOB_MDDR.type=enum +AT91C_PIOB_MDDR.enum.0.name=*** Write only *** +AT91C_PIOB_MDDR.enum.1.name=Error +AT91C_PIOB_OER.name="AT91C_PIOB_OER" +AT91C_PIOB_OER.description="Output Enable Register" +AT91C_PIOB_OER.helpkey="Output Enable Register" +AT91C_PIOB_OER.access=memorymapped +AT91C_PIOB_OER.address=0xFFFFF610 +AT91C_PIOB_OER.width=32 +AT91C_PIOB_OER.byteEndian=little +AT91C_PIOB_OER.type=enum +AT91C_PIOB_OER.enum.0.name=*** Write only *** +AT91C_PIOB_OER.enum.1.name=Error +AT91C_PIOB_PER.name="AT91C_PIOB_PER" +AT91C_PIOB_PER.description="PIO Enable Register" +AT91C_PIOB_PER.helpkey="PIO Enable Register" +AT91C_PIOB_PER.access=memorymapped +AT91C_PIOB_PER.address=0xFFFFF600 +AT91C_PIOB_PER.width=32 +AT91C_PIOB_PER.byteEndian=little +AT91C_PIOB_PER.type=enum +AT91C_PIOB_PER.enum.0.name=*** Write only *** +AT91C_PIOB_PER.enum.1.name=Error +# ========== Register definition for CKGR peripheral ========== +AT91C_CKGR_MOR.name="AT91C_CKGR_MOR" +AT91C_CKGR_MOR.description="Main Oscillator Register" +AT91C_CKGR_MOR.helpkey="Main Oscillator Register" +AT91C_CKGR_MOR.access=memorymapped +AT91C_CKGR_MOR.address=0xFFFFFC20 +AT91C_CKGR_MOR.width=32 +AT91C_CKGR_MOR.byteEndian=little +AT91C_CKGR_PLLR.name="AT91C_CKGR_PLLR" +AT91C_CKGR_PLLR.description="PLL Register" +AT91C_CKGR_PLLR.helpkey="PLL Register" +AT91C_CKGR_PLLR.access=memorymapped +AT91C_CKGR_PLLR.address=0xFFFFFC2C +AT91C_CKGR_PLLR.width=32 +AT91C_CKGR_PLLR.byteEndian=little +AT91C_CKGR_MCFR.name="AT91C_CKGR_MCFR" +AT91C_CKGR_MCFR.description="Main Clock Frequency Register" +AT91C_CKGR_MCFR.helpkey="Main Clock Frequency Register" +AT91C_CKGR_MCFR.access=memorymapped +AT91C_CKGR_MCFR.address=0xFFFFFC24 +AT91C_CKGR_MCFR.width=32 +AT91C_CKGR_MCFR.byteEndian=little +AT91C_CKGR_MCFR.permission.write=none +# ========== Register definition for PMC peripheral ========== +AT91C_PMC_IDR.name="AT91C_PMC_IDR" +AT91C_PMC_IDR.description="Interrupt Disable Register" +AT91C_PMC_IDR.helpkey="Interrupt Disable Register" +AT91C_PMC_IDR.access=memorymapped +AT91C_PMC_IDR.address=0xFFFFFC64 +AT91C_PMC_IDR.width=32 +AT91C_PMC_IDR.byteEndian=little +AT91C_PMC_IDR.type=enum +AT91C_PMC_IDR.enum.0.name=*** Write only *** +AT91C_PMC_IDR.enum.1.name=Error +AT91C_PMC_MOR.name="AT91C_PMC_MOR" +AT91C_PMC_MOR.description="Main Oscillator Register" +AT91C_PMC_MOR.helpkey="Main Oscillator Register" +AT91C_PMC_MOR.access=memorymapped +AT91C_PMC_MOR.address=0xFFFFFC20 +AT91C_PMC_MOR.width=32 +AT91C_PMC_MOR.byteEndian=little +AT91C_PMC_PLLR.name="AT91C_PMC_PLLR" +AT91C_PMC_PLLR.description="PLL Register" +AT91C_PMC_PLLR.helpkey="PLL Register" +AT91C_PMC_PLLR.access=memorymapped +AT91C_PMC_PLLR.address=0xFFFFFC2C +AT91C_PMC_PLLR.width=32 +AT91C_PMC_PLLR.byteEndian=little +AT91C_PMC_PCER.name="AT91C_PMC_PCER" +AT91C_PMC_PCER.description="Peripheral Clock Enable Register" +AT91C_PMC_PCER.helpkey="Peripheral Clock Enable Register" +AT91C_PMC_PCER.access=memorymapped +AT91C_PMC_PCER.address=0xFFFFFC10 +AT91C_PMC_PCER.width=32 +AT91C_PMC_PCER.byteEndian=little +AT91C_PMC_PCER.type=enum +AT91C_PMC_PCER.enum.0.name=*** Write only *** +AT91C_PMC_PCER.enum.1.name=Error +AT91C_PMC_PCKR.name="AT91C_PMC_PCKR" +AT91C_PMC_PCKR.description="Programmable Clock Register" +AT91C_PMC_PCKR.helpkey="Programmable Clock Register" +AT91C_PMC_PCKR.access=memorymapped +AT91C_PMC_PCKR.address=0xFFFFFC40 +AT91C_PMC_PCKR.width=32 +AT91C_PMC_PCKR.byteEndian=little +AT91C_PMC_MCKR.name="AT91C_PMC_MCKR" +AT91C_PMC_MCKR.description="Master Clock Register" +AT91C_PMC_MCKR.helpkey="Master Clock Register" +AT91C_PMC_MCKR.access=memorymapped +AT91C_PMC_MCKR.address=0xFFFFFC30 +AT91C_PMC_MCKR.width=32 +AT91C_PMC_MCKR.byteEndian=little +AT91C_PMC_SCDR.name="AT91C_PMC_SCDR" +AT91C_PMC_SCDR.description="System Clock Disable Register" +AT91C_PMC_SCDR.helpkey="System Clock Disable Register" +AT91C_PMC_SCDR.access=memorymapped +AT91C_PMC_SCDR.address=0xFFFFFC04 +AT91C_PMC_SCDR.width=32 +AT91C_PMC_SCDR.byteEndian=little +AT91C_PMC_SCDR.type=enum +AT91C_PMC_SCDR.enum.0.name=*** Write only *** +AT91C_PMC_SCDR.enum.1.name=Error +AT91C_PMC_PCDR.name="AT91C_PMC_PCDR" +AT91C_PMC_PCDR.description="Peripheral Clock Disable Register" +AT91C_PMC_PCDR.helpkey="Peripheral Clock Disable Register" +AT91C_PMC_PCDR.access=memorymapped +AT91C_PMC_PCDR.address=0xFFFFFC14 +AT91C_PMC_PCDR.width=32 +AT91C_PMC_PCDR.byteEndian=little +AT91C_PMC_PCDR.type=enum +AT91C_PMC_PCDR.enum.0.name=*** Write only *** +AT91C_PMC_PCDR.enum.1.name=Error +AT91C_PMC_SCSR.name="AT91C_PMC_SCSR" +AT91C_PMC_SCSR.description="System Clock Status Register" +AT91C_PMC_SCSR.helpkey="System Clock Status Register" +AT91C_PMC_SCSR.access=memorymapped +AT91C_PMC_SCSR.address=0xFFFFFC08 +AT91C_PMC_SCSR.width=32 +AT91C_PMC_SCSR.byteEndian=little +AT91C_PMC_SCSR.permission.write=none +AT91C_PMC_PCSR.name="AT91C_PMC_PCSR" +AT91C_PMC_PCSR.description="Peripheral Clock Status Register" +AT91C_PMC_PCSR.helpkey="Peripheral Clock Status Register" +AT91C_PMC_PCSR.access=memorymapped +AT91C_PMC_PCSR.address=0xFFFFFC18 +AT91C_PMC_PCSR.width=32 +AT91C_PMC_PCSR.byteEndian=little +AT91C_PMC_PCSR.permission.write=none +AT91C_PMC_MCFR.name="AT91C_PMC_MCFR" +AT91C_PMC_MCFR.description="Main Clock Frequency Register" +AT91C_PMC_MCFR.helpkey="Main Clock Frequency Register" +AT91C_PMC_MCFR.access=memorymapped +AT91C_PMC_MCFR.address=0xFFFFFC24 +AT91C_PMC_MCFR.width=32 +AT91C_PMC_MCFR.byteEndian=little +AT91C_PMC_MCFR.permission.write=none +AT91C_PMC_SCER.name="AT91C_PMC_SCER" +AT91C_PMC_SCER.description="System Clock Enable Register" +AT91C_PMC_SCER.helpkey="System Clock Enable Register" +AT91C_PMC_SCER.access=memorymapped +AT91C_PMC_SCER.address=0xFFFFFC00 +AT91C_PMC_SCER.width=32 +AT91C_PMC_SCER.byteEndian=little +AT91C_PMC_SCER.type=enum +AT91C_PMC_SCER.enum.0.name=*** Write only *** +AT91C_PMC_SCER.enum.1.name=Error +AT91C_PMC_IMR.name="AT91C_PMC_IMR" +AT91C_PMC_IMR.description="Interrupt Mask Register" +AT91C_PMC_IMR.helpkey="Interrupt Mask Register" +AT91C_PMC_IMR.access=memorymapped +AT91C_PMC_IMR.address=0xFFFFFC6C +AT91C_PMC_IMR.width=32 +AT91C_PMC_IMR.byteEndian=little +AT91C_PMC_IMR.permission.write=none +AT91C_PMC_IER.name="AT91C_PMC_IER" +AT91C_PMC_IER.description="Interrupt Enable Register" +AT91C_PMC_IER.helpkey="Interrupt Enable Register" +AT91C_PMC_IER.access=memorymapped +AT91C_PMC_IER.address=0xFFFFFC60 +AT91C_PMC_IER.width=32 +AT91C_PMC_IER.byteEndian=little +AT91C_PMC_IER.type=enum +AT91C_PMC_IER.enum.0.name=*** Write only *** +AT91C_PMC_IER.enum.1.name=Error +AT91C_PMC_SR.name="AT91C_PMC_SR" +AT91C_PMC_SR.description="Status Register" +AT91C_PMC_SR.helpkey="Status Register" +AT91C_PMC_SR.access=memorymapped +AT91C_PMC_SR.address=0xFFFFFC68 +AT91C_PMC_SR.width=32 +AT91C_PMC_SR.byteEndian=little +AT91C_PMC_SR.permission.write=none +# ========== Register definition for RSTC peripheral ========== +AT91C_RSTC_RCR.name="AT91C_RSTC_RCR" +AT91C_RSTC_RCR.description="Reset Control Register" +AT91C_RSTC_RCR.helpkey="Reset Control Register" +AT91C_RSTC_RCR.access=memorymapped +AT91C_RSTC_RCR.address=0xFFFFFD00 +AT91C_RSTC_RCR.width=32 +AT91C_RSTC_RCR.byteEndian=little +AT91C_RSTC_RCR.type=enum +AT91C_RSTC_RCR.enum.0.name=*** Write only *** +AT91C_RSTC_RCR.enum.1.name=Error +AT91C_RSTC_RMR.name="AT91C_RSTC_RMR" +AT91C_RSTC_RMR.description="Reset Mode Register" +AT91C_RSTC_RMR.helpkey="Reset Mode Register" +AT91C_RSTC_RMR.access=memorymapped +AT91C_RSTC_RMR.address=0xFFFFFD08 +AT91C_RSTC_RMR.width=32 +AT91C_RSTC_RMR.byteEndian=little +AT91C_RSTC_RSR.name="AT91C_RSTC_RSR" +AT91C_RSTC_RSR.description="Reset Status Register" +AT91C_RSTC_RSR.helpkey="Reset Status Register" +AT91C_RSTC_RSR.access=memorymapped +AT91C_RSTC_RSR.address=0xFFFFFD04 +AT91C_RSTC_RSR.width=32 +AT91C_RSTC_RSR.byteEndian=little +AT91C_RSTC_RSR.permission.write=none +# ========== Register definition for RTTC peripheral ========== +AT91C_RTTC_RTSR.name="AT91C_RTTC_RTSR" +AT91C_RTTC_RTSR.description="Real-time Status Register" +AT91C_RTTC_RTSR.helpkey="Real-time Status Register" +AT91C_RTTC_RTSR.access=memorymapped +AT91C_RTTC_RTSR.address=0xFFFFFD2C +AT91C_RTTC_RTSR.width=32 +AT91C_RTTC_RTSR.byteEndian=little +AT91C_RTTC_RTSR.permission.write=none +AT91C_RTTC_RTMR.name="AT91C_RTTC_RTMR" +AT91C_RTTC_RTMR.description="Real-time Mode Register" +AT91C_RTTC_RTMR.helpkey="Real-time Mode Register" +AT91C_RTTC_RTMR.access=memorymapped +AT91C_RTTC_RTMR.address=0xFFFFFD20 +AT91C_RTTC_RTMR.width=32 +AT91C_RTTC_RTMR.byteEndian=little +AT91C_RTTC_RTVR.name="AT91C_RTTC_RTVR" +AT91C_RTTC_RTVR.description="Real-time Value Register" +AT91C_RTTC_RTVR.helpkey="Real-time Value Register" +AT91C_RTTC_RTVR.access=memorymapped +AT91C_RTTC_RTVR.address=0xFFFFFD28 +AT91C_RTTC_RTVR.width=32 +AT91C_RTTC_RTVR.byteEndian=little +AT91C_RTTC_RTVR.permission.write=none +AT91C_RTTC_RTAR.name="AT91C_RTTC_RTAR" +AT91C_RTTC_RTAR.description="Real-time Alarm Register" +AT91C_RTTC_RTAR.helpkey="Real-time Alarm Register" +AT91C_RTTC_RTAR.access=memorymapped +AT91C_RTTC_RTAR.address=0xFFFFFD24 +AT91C_RTTC_RTAR.width=32 +AT91C_RTTC_RTAR.byteEndian=little +# ========== Register definition for PITC peripheral ========== +AT91C_PITC_PIVR.name="AT91C_PITC_PIVR" +AT91C_PITC_PIVR.description="Period Interval Value Register" +AT91C_PITC_PIVR.helpkey="Period Interval Value Register" +AT91C_PITC_PIVR.access=memorymapped +AT91C_PITC_PIVR.address=0xFFFFFD38 +AT91C_PITC_PIVR.width=32 +AT91C_PITC_PIVR.byteEndian=little +AT91C_PITC_PIVR.permission.write=none +AT91C_PITC_PISR.name="AT91C_PITC_PISR" +AT91C_PITC_PISR.description="Period Interval Status Register" +AT91C_PITC_PISR.helpkey="Period Interval Status Register" +AT91C_PITC_PISR.access=memorymapped +AT91C_PITC_PISR.address=0xFFFFFD34 +AT91C_PITC_PISR.width=32 +AT91C_PITC_PISR.byteEndian=little +AT91C_PITC_PISR.permission.write=none +AT91C_PITC_PIIR.name="AT91C_PITC_PIIR" +AT91C_PITC_PIIR.description="Period Interval Image Register" +AT91C_PITC_PIIR.helpkey="Period Interval Image Register" +AT91C_PITC_PIIR.access=memorymapped +AT91C_PITC_PIIR.address=0xFFFFFD3C +AT91C_PITC_PIIR.width=32 +AT91C_PITC_PIIR.byteEndian=little +AT91C_PITC_PIIR.permission.write=none +AT91C_PITC_PIMR.name="AT91C_PITC_PIMR" +AT91C_PITC_PIMR.description="Period Interval Mode Register" +AT91C_PITC_PIMR.helpkey="Period Interval Mode Register" +AT91C_PITC_PIMR.access=memorymapped +AT91C_PITC_PIMR.address=0xFFFFFD30 +AT91C_PITC_PIMR.width=32 +AT91C_PITC_PIMR.byteEndian=little +# ========== Register definition for WDTC peripheral ========== +AT91C_WDTC_WDCR.name="AT91C_WDTC_WDCR" +AT91C_WDTC_WDCR.description="Watchdog Control Register" +AT91C_WDTC_WDCR.helpkey="Watchdog Control Register" +AT91C_WDTC_WDCR.access=memorymapped +AT91C_WDTC_WDCR.address=0xFFFFFD40 +AT91C_WDTC_WDCR.width=32 +AT91C_WDTC_WDCR.byteEndian=little +AT91C_WDTC_WDCR.type=enum +AT91C_WDTC_WDCR.enum.0.name=*** Write only *** +AT91C_WDTC_WDCR.enum.1.name=Error +AT91C_WDTC_WDSR.name="AT91C_WDTC_WDSR" +AT91C_WDTC_WDSR.description="Watchdog Status Register" +AT91C_WDTC_WDSR.helpkey="Watchdog Status Register" +AT91C_WDTC_WDSR.access=memorymapped +AT91C_WDTC_WDSR.address=0xFFFFFD48 +AT91C_WDTC_WDSR.width=32 +AT91C_WDTC_WDSR.byteEndian=little +AT91C_WDTC_WDSR.permission.write=none +AT91C_WDTC_WDMR.name="AT91C_WDTC_WDMR" +AT91C_WDTC_WDMR.description="Watchdog Mode Register" +AT91C_WDTC_WDMR.helpkey="Watchdog Mode Register" +AT91C_WDTC_WDMR.access=memorymapped +AT91C_WDTC_WDMR.address=0xFFFFFD44 +AT91C_WDTC_WDMR.width=32 +AT91C_WDTC_WDMR.byteEndian=little +# ========== Register definition for VREG peripheral ========== +AT91C_VREG_MR.name="AT91C_VREG_MR" +AT91C_VREG_MR.description="Voltage Regulator Mode Register" +AT91C_VREG_MR.helpkey="Voltage Regulator Mode Register" +AT91C_VREG_MR.access=memorymapped +AT91C_VREG_MR.address=0xFFFFFD60 +AT91C_VREG_MR.width=32 +AT91C_VREG_MR.byteEndian=little +# ========== Register definition for MC peripheral ========== +AT91C_MC_ASR.name="AT91C_MC_ASR" +AT91C_MC_ASR.description="MC Abort Status Register" +AT91C_MC_ASR.helpkey="MC Abort Status Register" +AT91C_MC_ASR.access=memorymapped +AT91C_MC_ASR.address=0xFFFFFF04 +AT91C_MC_ASR.width=32 +AT91C_MC_ASR.byteEndian=little +AT91C_MC_ASR.permission.write=none +AT91C_MC_RCR.name="AT91C_MC_RCR" +AT91C_MC_RCR.description="MC Remap Control Register" +AT91C_MC_RCR.helpkey="MC Remap Control Register" +AT91C_MC_RCR.access=memorymapped +AT91C_MC_RCR.address=0xFFFFFF00 +AT91C_MC_RCR.width=32 +AT91C_MC_RCR.byteEndian=little +AT91C_MC_RCR.type=enum +AT91C_MC_RCR.enum.0.name=*** Write only *** +AT91C_MC_RCR.enum.1.name=Error +AT91C_MC_FCR.name="AT91C_MC_FCR" +AT91C_MC_FCR.description="MC Flash Command Register" +AT91C_MC_FCR.helpkey="MC Flash Command Register" +AT91C_MC_FCR.access=memorymapped +AT91C_MC_FCR.address=0xFFFFFF64 +AT91C_MC_FCR.width=32 +AT91C_MC_FCR.byteEndian=little +AT91C_MC_FCR.type=enum +AT91C_MC_FCR.enum.0.name=*** Write only *** +AT91C_MC_FCR.enum.1.name=Error +AT91C_MC_AASR.name="AT91C_MC_AASR" +AT91C_MC_AASR.description="MC Abort Address Status Register" +AT91C_MC_AASR.helpkey="MC Abort Address Status Register" +AT91C_MC_AASR.access=memorymapped +AT91C_MC_AASR.address=0xFFFFFF08 +AT91C_MC_AASR.width=32 +AT91C_MC_AASR.byteEndian=little +AT91C_MC_AASR.permission.write=none +AT91C_MC_FSR.name="AT91C_MC_FSR" +AT91C_MC_FSR.description="MC Flash Status Register" +AT91C_MC_FSR.helpkey="MC Flash Status Register" +AT91C_MC_FSR.access=memorymapped +AT91C_MC_FSR.address=0xFFFFFF68 +AT91C_MC_FSR.width=32 +AT91C_MC_FSR.byteEndian=little +AT91C_MC_FSR.permission.write=none +AT91C_MC_FMR.name="AT91C_MC_FMR" +AT91C_MC_FMR.description="MC Flash Mode Register" +AT91C_MC_FMR.helpkey="MC Flash Mode Register" +AT91C_MC_FMR.access=memorymapped +AT91C_MC_FMR.address=0xFFFFFF60 +AT91C_MC_FMR.width=32 +AT91C_MC_FMR.byteEndian=little +# ========== Register definition for PDC_SPI1 peripheral ========== +AT91C_SPI1_PTCR.name="AT91C_SPI1_PTCR" +AT91C_SPI1_PTCR.description="PDC Transfer Control Register" +AT91C_SPI1_PTCR.helpkey="PDC Transfer Control Register" +AT91C_SPI1_PTCR.access=memorymapped +AT91C_SPI1_PTCR.address=0xFFFE4120 +AT91C_SPI1_PTCR.width=32 +AT91C_SPI1_PTCR.byteEndian=little +AT91C_SPI1_PTCR.type=enum +AT91C_SPI1_PTCR.enum.0.name=*** Write only *** +AT91C_SPI1_PTCR.enum.1.name=Error +AT91C_SPI1_RPR.name="AT91C_SPI1_RPR" +AT91C_SPI1_RPR.description="Receive Pointer Register" +AT91C_SPI1_RPR.helpkey="Receive Pointer Register" +AT91C_SPI1_RPR.access=memorymapped +AT91C_SPI1_RPR.address=0xFFFE4100 +AT91C_SPI1_RPR.width=32 +AT91C_SPI1_RPR.byteEndian=little +AT91C_SPI1_TNCR.name="AT91C_SPI1_TNCR" +AT91C_SPI1_TNCR.description="Transmit Next Counter Register" +AT91C_SPI1_TNCR.helpkey="Transmit Next Counter Register" +AT91C_SPI1_TNCR.access=memorymapped +AT91C_SPI1_TNCR.address=0xFFFE411C +AT91C_SPI1_TNCR.width=32 +AT91C_SPI1_TNCR.byteEndian=little +AT91C_SPI1_TPR.name="AT91C_SPI1_TPR" +AT91C_SPI1_TPR.description="Transmit Pointer Register" +AT91C_SPI1_TPR.helpkey="Transmit Pointer Register" +AT91C_SPI1_TPR.access=memorymapped +AT91C_SPI1_TPR.address=0xFFFE4108 +AT91C_SPI1_TPR.width=32 +AT91C_SPI1_TPR.byteEndian=little +AT91C_SPI1_TNPR.name="AT91C_SPI1_TNPR" +AT91C_SPI1_TNPR.description="Transmit Next Pointer Register" +AT91C_SPI1_TNPR.helpkey="Transmit Next Pointer Register" +AT91C_SPI1_TNPR.access=memorymapped +AT91C_SPI1_TNPR.address=0xFFFE4118 +AT91C_SPI1_TNPR.width=32 +AT91C_SPI1_TNPR.byteEndian=little +AT91C_SPI1_TCR.name="AT91C_SPI1_TCR" +AT91C_SPI1_TCR.description="Transmit Counter Register" +AT91C_SPI1_TCR.helpkey="Transmit Counter Register" +AT91C_SPI1_TCR.access=memorymapped +AT91C_SPI1_TCR.address=0xFFFE410C +AT91C_SPI1_TCR.width=32 +AT91C_SPI1_TCR.byteEndian=little +AT91C_SPI1_RCR.name="AT91C_SPI1_RCR" +AT91C_SPI1_RCR.description="Receive Counter Register" +AT91C_SPI1_RCR.helpkey="Receive Counter Register" +AT91C_SPI1_RCR.access=memorymapped +AT91C_SPI1_RCR.address=0xFFFE4104 +AT91C_SPI1_RCR.width=32 +AT91C_SPI1_RCR.byteEndian=little +AT91C_SPI1_RNPR.name="AT91C_SPI1_RNPR" +AT91C_SPI1_RNPR.description="Receive Next Pointer Register" +AT91C_SPI1_RNPR.helpkey="Receive Next Pointer Register" +AT91C_SPI1_RNPR.access=memorymapped +AT91C_SPI1_RNPR.address=0xFFFE4110 +AT91C_SPI1_RNPR.width=32 +AT91C_SPI1_RNPR.byteEndian=little +AT91C_SPI1_RNCR.name="AT91C_SPI1_RNCR" +AT91C_SPI1_RNCR.description="Receive Next Counter Register" +AT91C_SPI1_RNCR.helpkey="Receive Next Counter Register" +AT91C_SPI1_RNCR.access=memorymapped +AT91C_SPI1_RNCR.address=0xFFFE4114 +AT91C_SPI1_RNCR.width=32 +AT91C_SPI1_RNCR.byteEndian=little +AT91C_SPI1_PTSR.name="AT91C_SPI1_PTSR" +AT91C_SPI1_PTSR.description="PDC Transfer Status Register" +AT91C_SPI1_PTSR.helpkey="PDC Transfer Status Register" +AT91C_SPI1_PTSR.access=memorymapped +AT91C_SPI1_PTSR.address=0xFFFE4124 +AT91C_SPI1_PTSR.width=32 +AT91C_SPI1_PTSR.byteEndian=little +AT91C_SPI1_PTSR.permission.write=none +# ========== Register definition for SPI1 peripheral ========== +AT91C_SPI1_IMR.name="AT91C_SPI1_IMR" +AT91C_SPI1_IMR.description="Interrupt Mask Register" +AT91C_SPI1_IMR.helpkey="Interrupt Mask Register" +AT91C_SPI1_IMR.access=memorymapped +AT91C_SPI1_IMR.address=0xFFFE401C +AT91C_SPI1_IMR.width=32 +AT91C_SPI1_IMR.byteEndian=little +AT91C_SPI1_IMR.permission.write=none +AT91C_SPI1_IER.name="AT91C_SPI1_IER" +AT91C_SPI1_IER.description="Interrupt Enable Register" +AT91C_SPI1_IER.helpkey="Interrupt Enable Register" +AT91C_SPI1_IER.access=memorymapped +AT91C_SPI1_IER.address=0xFFFE4014 +AT91C_SPI1_IER.width=32 +AT91C_SPI1_IER.byteEndian=little +AT91C_SPI1_IER.type=enum +AT91C_SPI1_IER.enum.0.name=*** Write only *** +AT91C_SPI1_IER.enum.1.name=Error +AT91C_SPI1_MR.name="AT91C_SPI1_MR" +AT91C_SPI1_MR.description="Mode Register" +AT91C_SPI1_MR.helpkey="Mode Register" +AT91C_SPI1_MR.access=memorymapped +AT91C_SPI1_MR.address=0xFFFE4004 +AT91C_SPI1_MR.width=32 +AT91C_SPI1_MR.byteEndian=little +AT91C_SPI1_RDR.name="AT91C_SPI1_RDR" +AT91C_SPI1_RDR.description="Receive Data Register" +AT91C_SPI1_RDR.helpkey="Receive Data Register" +AT91C_SPI1_RDR.access=memorymapped +AT91C_SPI1_RDR.address=0xFFFE4008 +AT91C_SPI1_RDR.width=32 +AT91C_SPI1_RDR.byteEndian=little +AT91C_SPI1_RDR.permission.write=none +AT91C_SPI1_IDR.name="AT91C_SPI1_IDR" +AT91C_SPI1_IDR.description="Interrupt Disable Register" +AT91C_SPI1_IDR.helpkey="Interrupt Disable Register" +AT91C_SPI1_IDR.access=memorymapped +AT91C_SPI1_IDR.address=0xFFFE4018 +AT91C_SPI1_IDR.width=32 +AT91C_SPI1_IDR.byteEndian=little +AT91C_SPI1_IDR.type=enum +AT91C_SPI1_IDR.enum.0.name=*** Write only *** +AT91C_SPI1_IDR.enum.1.name=Error +AT91C_SPI1_SR.name="AT91C_SPI1_SR" +AT91C_SPI1_SR.description="Status Register" +AT91C_SPI1_SR.helpkey="Status Register" +AT91C_SPI1_SR.access=memorymapped +AT91C_SPI1_SR.address=0xFFFE4010 +AT91C_SPI1_SR.width=32 +AT91C_SPI1_SR.byteEndian=little +AT91C_SPI1_SR.permission.write=none +AT91C_SPI1_TDR.name="AT91C_SPI1_TDR" +AT91C_SPI1_TDR.description="Transmit Data Register" +AT91C_SPI1_TDR.helpkey="Transmit Data Register" +AT91C_SPI1_TDR.access=memorymapped +AT91C_SPI1_TDR.address=0xFFFE400C +AT91C_SPI1_TDR.width=32 +AT91C_SPI1_TDR.byteEndian=little +AT91C_SPI1_TDR.type=enum +AT91C_SPI1_TDR.enum.0.name=*** Write only *** +AT91C_SPI1_TDR.enum.1.name=Error +AT91C_SPI1_CR.name="AT91C_SPI1_CR" +AT91C_SPI1_CR.description="Control Register" +AT91C_SPI1_CR.helpkey="Control Register" +AT91C_SPI1_CR.access=memorymapped +AT91C_SPI1_CR.address=0xFFFE4000 +AT91C_SPI1_CR.width=32 +AT91C_SPI1_CR.byteEndian=little +AT91C_SPI1_CR.permission.write=none +AT91C_SPI1_CSR.name="AT91C_SPI1_CSR" +AT91C_SPI1_CSR.description="Chip Select Register" +AT91C_SPI1_CSR.helpkey="Chip Select Register" +AT91C_SPI1_CSR.access=memorymapped +AT91C_SPI1_CSR.address=0xFFFE4030 +AT91C_SPI1_CSR.width=32 +AT91C_SPI1_CSR.byteEndian=little +# ========== Register definition for PDC_SPI0 peripheral ========== +AT91C_SPI0_PTCR.name="AT91C_SPI0_PTCR" +AT91C_SPI0_PTCR.description="PDC Transfer Control Register" +AT91C_SPI0_PTCR.helpkey="PDC Transfer Control Register" +AT91C_SPI0_PTCR.access=memorymapped +AT91C_SPI0_PTCR.address=0xFFFE0120 +AT91C_SPI0_PTCR.width=32 +AT91C_SPI0_PTCR.byteEndian=little +AT91C_SPI0_PTCR.type=enum +AT91C_SPI0_PTCR.enum.0.name=*** Write only *** +AT91C_SPI0_PTCR.enum.1.name=Error +AT91C_SPI0_TPR.name="AT91C_SPI0_TPR" +AT91C_SPI0_TPR.description="Transmit Pointer Register" +AT91C_SPI0_TPR.helpkey="Transmit Pointer Register" +AT91C_SPI0_TPR.access=memorymapped +AT91C_SPI0_TPR.address=0xFFFE0108 +AT91C_SPI0_TPR.width=32 +AT91C_SPI0_TPR.byteEndian=little +AT91C_SPI0_TCR.name="AT91C_SPI0_TCR" +AT91C_SPI0_TCR.description="Transmit Counter Register" +AT91C_SPI0_TCR.helpkey="Transmit Counter Register" +AT91C_SPI0_TCR.access=memorymapped +AT91C_SPI0_TCR.address=0xFFFE010C +AT91C_SPI0_TCR.width=32 +AT91C_SPI0_TCR.byteEndian=little +AT91C_SPI0_RCR.name="AT91C_SPI0_RCR" +AT91C_SPI0_RCR.description="Receive Counter Register" +AT91C_SPI0_RCR.helpkey="Receive Counter Register" +AT91C_SPI0_RCR.access=memorymapped +AT91C_SPI0_RCR.address=0xFFFE0104 +AT91C_SPI0_RCR.width=32 +AT91C_SPI0_RCR.byteEndian=little +AT91C_SPI0_PTSR.name="AT91C_SPI0_PTSR" +AT91C_SPI0_PTSR.description="PDC Transfer Status Register" +AT91C_SPI0_PTSR.helpkey="PDC Transfer Status Register" +AT91C_SPI0_PTSR.access=memorymapped +AT91C_SPI0_PTSR.address=0xFFFE0124 +AT91C_SPI0_PTSR.width=32 +AT91C_SPI0_PTSR.byteEndian=little +AT91C_SPI0_PTSR.permission.write=none +AT91C_SPI0_RNPR.name="AT91C_SPI0_RNPR" +AT91C_SPI0_RNPR.description="Receive Next Pointer Register" +AT91C_SPI0_RNPR.helpkey="Receive Next Pointer Register" +AT91C_SPI0_RNPR.access=memorymapped +AT91C_SPI0_RNPR.address=0xFFFE0110 +AT91C_SPI0_RNPR.width=32 +AT91C_SPI0_RNPR.byteEndian=little +AT91C_SPI0_RPR.name="AT91C_SPI0_RPR" +AT91C_SPI0_RPR.description="Receive Pointer Register" +AT91C_SPI0_RPR.helpkey="Receive Pointer Register" +AT91C_SPI0_RPR.access=memorymapped +AT91C_SPI0_RPR.address=0xFFFE0100 +AT91C_SPI0_RPR.width=32 +AT91C_SPI0_RPR.byteEndian=little +AT91C_SPI0_TNCR.name="AT91C_SPI0_TNCR" +AT91C_SPI0_TNCR.description="Transmit Next Counter Register" +AT91C_SPI0_TNCR.helpkey="Transmit Next Counter Register" +AT91C_SPI0_TNCR.access=memorymapped +AT91C_SPI0_TNCR.address=0xFFFE011C +AT91C_SPI0_TNCR.width=32 +AT91C_SPI0_TNCR.byteEndian=little +AT91C_SPI0_RNCR.name="AT91C_SPI0_RNCR" +AT91C_SPI0_RNCR.description="Receive Next Counter Register" +AT91C_SPI0_RNCR.helpkey="Receive Next Counter Register" +AT91C_SPI0_RNCR.access=memorymapped +AT91C_SPI0_RNCR.address=0xFFFE0114 +AT91C_SPI0_RNCR.width=32 +AT91C_SPI0_RNCR.byteEndian=little +AT91C_SPI0_TNPR.name="AT91C_SPI0_TNPR" +AT91C_SPI0_TNPR.description="Transmit Next Pointer Register" +AT91C_SPI0_TNPR.helpkey="Transmit Next Pointer Register" +AT91C_SPI0_TNPR.access=memorymapped +AT91C_SPI0_TNPR.address=0xFFFE0118 +AT91C_SPI0_TNPR.width=32 +AT91C_SPI0_TNPR.byteEndian=little +# ========== Register definition for SPI0 peripheral ========== +AT91C_SPI0_IER.name="AT91C_SPI0_IER" +AT91C_SPI0_IER.description="Interrupt Enable Register" +AT91C_SPI0_IER.helpkey="Interrupt Enable Register" +AT91C_SPI0_IER.access=memorymapped +AT91C_SPI0_IER.address=0xFFFE0014 +AT91C_SPI0_IER.width=32 +AT91C_SPI0_IER.byteEndian=little +AT91C_SPI0_IER.type=enum +AT91C_SPI0_IER.enum.0.name=*** Write only *** +AT91C_SPI0_IER.enum.1.name=Error +AT91C_SPI0_SR.name="AT91C_SPI0_SR" +AT91C_SPI0_SR.description="Status Register" +AT91C_SPI0_SR.helpkey="Status Register" +AT91C_SPI0_SR.access=memorymapped +AT91C_SPI0_SR.address=0xFFFE0010 +AT91C_SPI0_SR.width=32 +AT91C_SPI0_SR.byteEndian=little +AT91C_SPI0_SR.permission.write=none +AT91C_SPI0_IDR.name="AT91C_SPI0_IDR" +AT91C_SPI0_IDR.description="Interrupt Disable Register" +AT91C_SPI0_IDR.helpkey="Interrupt Disable Register" +AT91C_SPI0_IDR.access=memorymapped +AT91C_SPI0_IDR.address=0xFFFE0018 +AT91C_SPI0_IDR.width=32 +AT91C_SPI0_IDR.byteEndian=little +AT91C_SPI0_IDR.type=enum +AT91C_SPI0_IDR.enum.0.name=*** Write only *** +AT91C_SPI0_IDR.enum.1.name=Error +AT91C_SPI0_CR.name="AT91C_SPI0_CR" +AT91C_SPI0_CR.description="Control Register" +AT91C_SPI0_CR.helpkey="Control Register" +AT91C_SPI0_CR.access=memorymapped +AT91C_SPI0_CR.address=0xFFFE0000 +AT91C_SPI0_CR.width=32 +AT91C_SPI0_CR.byteEndian=little +AT91C_SPI0_CR.permission.write=none +AT91C_SPI0_MR.name="AT91C_SPI0_MR" +AT91C_SPI0_MR.description="Mode Register" +AT91C_SPI0_MR.helpkey="Mode Register" +AT91C_SPI0_MR.access=memorymapped +AT91C_SPI0_MR.address=0xFFFE0004 +AT91C_SPI0_MR.width=32 +AT91C_SPI0_MR.byteEndian=little +AT91C_SPI0_IMR.name="AT91C_SPI0_IMR" +AT91C_SPI0_IMR.description="Interrupt Mask Register" +AT91C_SPI0_IMR.helpkey="Interrupt Mask Register" +AT91C_SPI0_IMR.access=memorymapped +AT91C_SPI0_IMR.address=0xFFFE001C +AT91C_SPI0_IMR.width=32 +AT91C_SPI0_IMR.byteEndian=little +AT91C_SPI0_IMR.permission.write=none +AT91C_SPI0_TDR.name="AT91C_SPI0_TDR" +AT91C_SPI0_TDR.description="Transmit Data Register" +AT91C_SPI0_TDR.helpkey="Transmit Data Register" +AT91C_SPI0_TDR.access=memorymapped +AT91C_SPI0_TDR.address=0xFFFE000C +AT91C_SPI0_TDR.width=32 +AT91C_SPI0_TDR.byteEndian=little +AT91C_SPI0_TDR.type=enum +AT91C_SPI0_TDR.enum.0.name=*** Write only *** +AT91C_SPI0_TDR.enum.1.name=Error +AT91C_SPI0_RDR.name="AT91C_SPI0_RDR" +AT91C_SPI0_RDR.description="Receive Data Register" +AT91C_SPI0_RDR.helpkey="Receive Data Register" +AT91C_SPI0_RDR.access=memorymapped +AT91C_SPI0_RDR.address=0xFFFE0008 +AT91C_SPI0_RDR.width=32 +AT91C_SPI0_RDR.byteEndian=little +AT91C_SPI0_RDR.permission.write=none +AT91C_SPI0_CSR.name="AT91C_SPI0_CSR" +AT91C_SPI0_CSR.description="Chip Select Register" +AT91C_SPI0_CSR.helpkey="Chip Select Register" +AT91C_SPI0_CSR.access=memorymapped +AT91C_SPI0_CSR.address=0xFFFE0030 +AT91C_SPI0_CSR.width=32 +AT91C_SPI0_CSR.byteEndian=little +# ========== Register definition for PDC_US1 peripheral ========== +AT91C_US1_RNCR.name="AT91C_US1_RNCR" +AT91C_US1_RNCR.description="Receive Next Counter Register" +AT91C_US1_RNCR.helpkey="Receive Next Counter Register" +AT91C_US1_RNCR.access=memorymapped +AT91C_US1_RNCR.address=0xFFFC4114 +AT91C_US1_RNCR.width=32 +AT91C_US1_RNCR.byteEndian=little +AT91C_US1_PTCR.name="AT91C_US1_PTCR" +AT91C_US1_PTCR.description="PDC Transfer Control Register" +AT91C_US1_PTCR.helpkey="PDC Transfer Control Register" +AT91C_US1_PTCR.access=memorymapped +AT91C_US1_PTCR.address=0xFFFC4120 +AT91C_US1_PTCR.width=32 +AT91C_US1_PTCR.byteEndian=little +AT91C_US1_PTCR.type=enum +AT91C_US1_PTCR.enum.0.name=*** Write only *** +AT91C_US1_PTCR.enum.1.name=Error +AT91C_US1_TCR.name="AT91C_US1_TCR" +AT91C_US1_TCR.description="Transmit Counter Register" +AT91C_US1_TCR.helpkey="Transmit Counter Register" +AT91C_US1_TCR.access=memorymapped +AT91C_US1_TCR.address=0xFFFC410C +AT91C_US1_TCR.width=32 +AT91C_US1_TCR.byteEndian=little +AT91C_US1_PTSR.name="AT91C_US1_PTSR" +AT91C_US1_PTSR.description="PDC Transfer Status Register" +AT91C_US1_PTSR.helpkey="PDC Transfer Status Register" +AT91C_US1_PTSR.access=memorymapped +AT91C_US1_PTSR.address=0xFFFC4124 +AT91C_US1_PTSR.width=32 +AT91C_US1_PTSR.byteEndian=little +AT91C_US1_PTSR.permission.write=none +AT91C_US1_TNPR.name="AT91C_US1_TNPR" +AT91C_US1_TNPR.description="Transmit Next Pointer Register" +AT91C_US1_TNPR.helpkey="Transmit Next Pointer Register" +AT91C_US1_TNPR.access=memorymapped +AT91C_US1_TNPR.address=0xFFFC4118 +AT91C_US1_TNPR.width=32 +AT91C_US1_TNPR.byteEndian=little +AT91C_US1_RCR.name="AT91C_US1_RCR" +AT91C_US1_RCR.description="Receive Counter Register" +AT91C_US1_RCR.helpkey="Receive Counter Register" +AT91C_US1_RCR.access=memorymapped +AT91C_US1_RCR.address=0xFFFC4104 +AT91C_US1_RCR.width=32 +AT91C_US1_RCR.byteEndian=little +AT91C_US1_RNPR.name="AT91C_US1_RNPR" +AT91C_US1_RNPR.description="Receive Next Pointer Register" +AT91C_US1_RNPR.helpkey="Receive Next Pointer Register" +AT91C_US1_RNPR.access=memorymapped +AT91C_US1_RNPR.address=0xFFFC4110 +AT91C_US1_RNPR.width=32 +AT91C_US1_RNPR.byteEndian=little +AT91C_US1_RPR.name="AT91C_US1_RPR" +AT91C_US1_RPR.description="Receive Pointer Register" +AT91C_US1_RPR.helpkey="Receive Pointer Register" +AT91C_US1_RPR.access=memorymapped +AT91C_US1_RPR.address=0xFFFC4100 +AT91C_US1_RPR.width=32 +AT91C_US1_RPR.byteEndian=little +AT91C_US1_TNCR.name="AT91C_US1_TNCR" +AT91C_US1_TNCR.description="Transmit Next Counter Register" +AT91C_US1_TNCR.helpkey="Transmit Next Counter Register" +AT91C_US1_TNCR.access=memorymapped +AT91C_US1_TNCR.address=0xFFFC411C +AT91C_US1_TNCR.width=32 +AT91C_US1_TNCR.byteEndian=little +AT91C_US1_TPR.name="AT91C_US1_TPR" +AT91C_US1_TPR.description="Transmit Pointer Register" +AT91C_US1_TPR.helpkey="Transmit Pointer Register" +AT91C_US1_TPR.access=memorymapped +AT91C_US1_TPR.address=0xFFFC4108 +AT91C_US1_TPR.width=32 +AT91C_US1_TPR.byteEndian=little +# ========== Register definition for US1 peripheral ========== +AT91C_US1_IF.name="AT91C_US1_IF" +AT91C_US1_IF.description="IRDA_FILTER Register" +AT91C_US1_IF.helpkey="IRDA_FILTER Register" +AT91C_US1_IF.access=memorymapped +AT91C_US1_IF.address=0xFFFC404C +AT91C_US1_IF.width=32 +AT91C_US1_IF.byteEndian=little +AT91C_US1_NER.name="AT91C_US1_NER" +AT91C_US1_NER.description="Nb Errors Register" +AT91C_US1_NER.helpkey="Nb Errors Register" +AT91C_US1_NER.access=memorymapped +AT91C_US1_NER.address=0xFFFC4044 +AT91C_US1_NER.width=32 +AT91C_US1_NER.byteEndian=little +AT91C_US1_NER.permission.write=none +AT91C_US1_RTOR.name="AT91C_US1_RTOR" +AT91C_US1_RTOR.description="Receiver Time-out Register" +AT91C_US1_RTOR.helpkey="Receiver Time-out Register" +AT91C_US1_RTOR.access=memorymapped +AT91C_US1_RTOR.address=0xFFFC4024 +AT91C_US1_RTOR.width=32 +AT91C_US1_RTOR.byteEndian=little +AT91C_US1_CSR.name="AT91C_US1_CSR" +AT91C_US1_CSR.description="Channel Status Register" +AT91C_US1_CSR.helpkey="Channel Status Register" +AT91C_US1_CSR.access=memorymapped +AT91C_US1_CSR.address=0xFFFC4014 +AT91C_US1_CSR.width=32 +AT91C_US1_CSR.byteEndian=little +AT91C_US1_CSR.permission.write=none +AT91C_US1_IDR.name="AT91C_US1_IDR" +AT91C_US1_IDR.description="Interrupt Disable Register" +AT91C_US1_IDR.helpkey="Interrupt Disable Register" +AT91C_US1_IDR.access=memorymapped +AT91C_US1_IDR.address=0xFFFC400C +AT91C_US1_IDR.width=32 +AT91C_US1_IDR.byteEndian=little +AT91C_US1_IDR.type=enum +AT91C_US1_IDR.enum.0.name=*** Write only *** +AT91C_US1_IDR.enum.1.name=Error +AT91C_US1_IER.name="AT91C_US1_IER" +AT91C_US1_IER.description="Interrupt Enable Register" +AT91C_US1_IER.helpkey="Interrupt Enable Register" +AT91C_US1_IER.access=memorymapped +AT91C_US1_IER.address=0xFFFC4008 +AT91C_US1_IER.width=32 +AT91C_US1_IER.byteEndian=little +AT91C_US1_IER.type=enum +AT91C_US1_IER.enum.0.name=*** Write only *** +AT91C_US1_IER.enum.1.name=Error +AT91C_US1_THR.name="AT91C_US1_THR" +AT91C_US1_THR.description="Transmitter Holding Register" +AT91C_US1_THR.helpkey="Transmitter Holding Register" +AT91C_US1_THR.access=memorymapped +AT91C_US1_THR.address=0xFFFC401C +AT91C_US1_THR.width=32 +AT91C_US1_THR.byteEndian=little +AT91C_US1_THR.type=enum +AT91C_US1_THR.enum.0.name=*** Write only *** +AT91C_US1_THR.enum.1.name=Error +AT91C_US1_TTGR.name="AT91C_US1_TTGR" +AT91C_US1_TTGR.description="Transmitter Time-guard Register" +AT91C_US1_TTGR.helpkey="Transmitter Time-guard Register" +AT91C_US1_TTGR.access=memorymapped +AT91C_US1_TTGR.address=0xFFFC4028 +AT91C_US1_TTGR.width=32 +AT91C_US1_TTGR.byteEndian=little +AT91C_US1_RHR.name="AT91C_US1_RHR" +AT91C_US1_RHR.description="Receiver Holding Register" +AT91C_US1_RHR.helpkey="Receiver Holding Register" +AT91C_US1_RHR.access=memorymapped +AT91C_US1_RHR.address=0xFFFC4018 +AT91C_US1_RHR.width=32 +AT91C_US1_RHR.byteEndian=little +AT91C_US1_RHR.permission.write=none +AT91C_US1_BRGR.name="AT91C_US1_BRGR" +AT91C_US1_BRGR.description="Baud Rate Generator Register" +AT91C_US1_BRGR.helpkey="Baud Rate Generator Register" +AT91C_US1_BRGR.access=memorymapped +AT91C_US1_BRGR.address=0xFFFC4020 +AT91C_US1_BRGR.width=32 +AT91C_US1_BRGR.byteEndian=little +AT91C_US1_IMR.name="AT91C_US1_IMR" +AT91C_US1_IMR.description="Interrupt Mask Register" +AT91C_US1_IMR.helpkey="Interrupt Mask Register" +AT91C_US1_IMR.access=memorymapped +AT91C_US1_IMR.address=0xFFFC4010 +AT91C_US1_IMR.width=32 +AT91C_US1_IMR.byteEndian=little +AT91C_US1_IMR.permission.write=none +AT91C_US1_FIDI.name="AT91C_US1_FIDI" +AT91C_US1_FIDI.description="FI_DI_Ratio Register" +AT91C_US1_FIDI.helpkey="FI_DI_Ratio Register" +AT91C_US1_FIDI.access=memorymapped +AT91C_US1_FIDI.address=0xFFFC4040 +AT91C_US1_FIDI.width=32 +AT91C_US1_FIDI.byteEndian=little +AT91C_US1_CR.name="AT91C_US1_CR" +AT91C_US1_CR.description="Control Register" +AT91C_US1_CR.helpkey="Control Register" +AT91C_US1_CR.access=memorymapped +AT91C_US1_CR.address=0xFFFC4000 +AT91C_US1_CR.width=32 +AT91C_US1_CR.byteEndian=little +AT91C_US1_CR.type=enum +AT91C_US1_CR.enum.0.name=*** Write only *** +AT91C_US1_CR.enum.1.name=Error +AT91C_US1_MR.name="AT91C_US1_MR" +AT91C_US1_MR.description="Mode Register" +AT91C_US1_MR.helpkey="Mode Register" +AT91C_US1_MR.access=memorymapped +AT91C_US1_MR.address=0xFFFC4004 +AT91C_US1_MR.width=32 +AT91C_US1_MR.byteEndian=little +# ========== Register definition for PDC_US0 peripheral ========== +AT91C_US0_TNPR.name="AT91C_US0_TNPR" +AT91C_US0_TNPR.description="Transmit Next Pointer Register" +AT91C_US0_TNPR.helpkey="Transmit Next Pointer Register" +AT91C_US0_TNPR.access=memorymapped +AT91C_US0_TNPR.address=0xFFFC0118 +AT91C_US0_TNPR.width=32 +AT91C_US0_TNPR.byteEndian=little +AT91C_US0_RNPR.name="AT91C_US0_RNPR" +AT91C_US0_RNPR.description="Receive Next Pointer Register" +AT91C_US0_RNPR.helpkey="Receive Next Pointer Register" +AT91C_US0_RNPR.access=memorymapped +AT91C_US0_RNPR.address=0xFFFC0110 +AT91C_US0_RNPR.width=32 +AT91C_US0_RNPR.byteEndian=little +AT91C_US0_TCR.name="AT91C_US0_TCR" +AT91C_US0_TCR.description="Transmit Counter Register" +AT91C_US0_TCR.helpkey="Transmit Counter Register" +AT91C_US0_TCR.access=memorymapped +AT91C_US0_TCR.address=0xFFFC010C +AT91C_US0_TCR.width=32 +AT91C_US0_TCR.byteEndian=little +AT91C_US0_PTCR.name="AT91C_US0_PTCR" +AT91C_US0_PTCR.description="PDC Transfer Control Register" +AT91C_US0_PTCR.helpkey="PDC Transfer Control Register" +AT91C_US0_PTCR.access=memorymapped +AT91C_US0_PTCR.address=0xFFFC0120 +AT91C_US0_PTCR.width=32 +AT91C_US0_PTCR.byteEndian=little +AT91C_US0_PTCR.type=enum +AT91C_US0_PTCR.enum.0.name=*** Write only *** +AT91C_US0_PTCR.enum.1.name=Error +AT91C_US0_PTSR.name="AT91C_US0_PTSR" +AT91C_US0_PTSR.description="PDC Transfer Status Register" +AT91C_US0_PTSR.helpkey="PDC Transfer Status Register" +AT91C_US0_PTSR.access=memorymapped +AT91C_US0_PTSR.address=0xFFFC0124 +AT91C_US0_PTSR.width=32 +AT91C_US0_PTSR.byteEndian=little +AT91C_US0_PTSR.permission.write=none +AT91C_US0_TNCR.name="AT91C_US0_TNCR" +AT91C_US0_TNCR.description="Transmit Next Counter Register" +AT91C_US0_TNCR.helpkey="Transmit Next Counter Register" +AT91C_US0_TNCR.access=memorymapped +AT91C_US0_TNCR.address=0xFFFC011C +AT91C_US0_TNCR.width=32 +AT91C_US0_TNCR.byteEndian=little +AT91C_US0_TPR.name="AT91C_US0_TPR" +AT91C_US0_TPR.description="Transmit Pointer Register" +AT91C_US0_TPR.helpkey="Transmit Pointer Register" +AT91C_US0_TPR.access=memorymapped +AT91C_US0_TPR.address=0xFFFC0108 +AT91C_US0_TPR.width=32 +AT91C_US0_TPR.byteEndian=little +AT91C_US0_RCR.name="AT91C_US0_RCR" +AT91C_US0_RCR.description="Receive Counter Register" +AT91C_US0_RCR.helpkey="Receive Counter Register" +AT91C_US0_RCR.access=memorymapped +AT91C_US0_RCR.address=0xFFFC0104 +AT91C_US0_RCR.width=32 +AT91C_US0_RCR.byteEndian=little +AT91C_US0_RPR.name="AT91C_US0_RPR" +AT91C_US0_RPR.description="Receive Pointer Register" +AT91C_US0_RPR.helpkey="Receive Pointer Register" +AT91C_US0_RPR.access=memorymapped +AT91C_US0_RPR.address=0xFFFC0100 +AT91C_US0_RPR.width=32 +AT91C_US0_RPR.byteEndian=little +AT91C_US0_RNCR.name="AT91C_US0_RNCR" +AT91C_US0_RNCR.description="Receive Next Counter Register" +AT91C_US0_RNCR.helpkey="Receive Next Counter Register" +AT91C_US0_RNCR.access=memorymapped +AT91C_US0_RNCR.address=0xFFFC0114 +AT91C_US0_RNCR.width=32 +AT91C_US0_RNCR.byteEndian=little +# ========== Register definition for US0 peripheral ========== +AT91C_US0_BRGR.name="AT91C_US0_BRGR" +AT91C_US0_BRGR.description="Baud Rate Generator Register" +AT91C_US0_BRGR.helpkey="Baud Rate Generator Register" +AT91C_US0_BRGR.access=memorymapped +AT91C_US0_BRGR.address=0xFFFC0020 +AT91C_US0_BRGR.width=32 +AT91C_US0_BRGR.byteEndian=little +AT91C_US0_NER.name="AT91C_US0_NER" +AT91C_US0_NER.description="Nb Errors Register" +AT91C_US0_NER.helpkey="Nb Errors Register" +AT91C_US0_NER.access=memorymapped +AT91C_US0_NER.address=0xFFFC0044 +AT91C_US0_NER.width=32 +AT91C_US0_NER.byteEndian=little +AT91C_US0_NER.permission.write=none +AT91C_US0_CR.name="AT91C_US0_CR" +AT91C_US0_CR.description="Control Register" +AT91C_US0_CR.helpkey="Control Register" +AT91C_US0_CR.access=memorymapped +AT91C_US0_CR.address=0xFFFC0000 +AT91C_US0_CR.width=32 +AT91C_US0_CR.byteEndian=little +AT91C_US0_CR.type=enum +AT91C_US0_CR.enum.0.name=*** Write only *** +AT91C_US0_CR.enum.1.name=Error +AT91C_US0_IMR.name="AT91C_US0_IMR" +AT91C_US0_IMR.description="Interrupt Mask Register" +AT91C_US0_IMR.helpkey="Interrupt Mask Register" +AT91C_US0_IMR.access=memorymapped +AT91C_US0_IMR.address=0xFFFC0010 +AT91C_US0_IMR.width=32 +AT91C_US0_IMR.byteEndian=little +AT91C_US0_IMR.permission.write=none +AT91C_US0_FIDI.name="AT91C_US0_FIDI" +AT91C_US0_FIDI.description="FI_DI_Ratio Register" +AT91C_US0_FIDI.helpkey="FI_DI_Ratio Register" +AT91C_US0_FIDI.access=memorymapped +AT91C_US0_FIDI.address=0xFFFC0040 +AT91C_US0_FIDI.width=32 +AT91C_US0_FIDI.byteEndian=little +AT91C_US0_TTGR.name="AT91C_US0_TTGR" +AT91C_US0_TTGR.description="Transmitter Time-guard Register" +AT91C_US0_TTGR.helpkey="Transmitter Time-guard Register" +AT91C_US0_TTGR.access=memorymapped +AT91C_US0_TTGR.address=0xFFFC0028 +AT91C_US0_TTGR.width=32 +AT91C_US0_TTGR.byteEndian=little +AT91C_US0_MR.name="AT91C_US0_MR" +AT91C_US0_MR.description="Mode Register" +AT91C_US0_MR.helpkey="Mode Register" +AT91C_US0_MR.access=memorymapped +AT91C_US0_MR.address=0xFFFC0004 +AT91C_US0_MR.width=32 +AT91C_US0_MR.byteEndian=little +AT91C_US0_RTOR.name="AT91C_US0_RTOR" +AT91C_US0_RTOR.description="Receiver Time-out Register" +AT91C_US0_RTOR.helpkey="Receiver Time-out Register" +AT91C_US0_RTOR.access=memorymapped +AT91C_US0_RTOR.address=0xFFFC0024 +AT91C_US0_RTOR.width=32 +AT91C_US0_RTOR.byteEndian=little +AT91C_US0_CSR.name="AT91C_US0_CSR" +AT91C_US0_CSR.description="Channel Status Register" +AT91C_US0_CSR.helpkey="Channel Status Register" +AT91C_US0_CSR.access=memorymapped +AT91C_US0_CSR.address=0xFFFC0014 +AT91C_US0_CSR.width=32 +AT91C_US0_CSR.byteEndian=little +AT91C_US0_CSR.permission.write=none +AT91C_US0_RHR.name="AT91C_US0_RHR" +AT91C_US0_RHR.description="Receiver Holding Register" +AT91C_US0_RHR.helpkey="Receiver Holding Register" +AT91C_US0_RHR.access=memorymapped +AT91C_US0_RHR.address=0xFFFC0018 +AT91C_US0_RHR.width=32 +AT91C_US0_RHR.byteEndian=little +AT91C_US0_RHR.permission.write=none +AT91C_US0_IDR.name="AT91C_US0_IDR" +AT91C_US0_IDR.description="Interrupt Disable Register" +AT91C_US0_IDR.helpkey="Interrupt Disable Register" +AT91C_US0_IDR.access=memorymapped +AT91C_US0_IDR.address=0xFFFC000C +AT91C_US0_IDR.width=32 +AT91C_US0_IDR.byteEndian=little +AT91C_US0_IDR.type=enum +AT91C_US0_IDR.enum.0.name=*** Write only *** +AT91C_US0_IDR.enum.1.name=Error +AT91C_US0_THR.name="AT91C_US0_THR" +AT91C_US0_THR.description="Transmitter Holding Register" +AT91C_US0_THR.helpkey="Transmitter Holding Register" +AT91C_US0_THR.access=memorymapped +AT91C_US0_THR.address=0xFFFC001C +AT91C_US0_THR.width=32 +AT91C_US0_THR.byteEndian=little +AT91C_US0_THR.type=enum +AT91C_US0_THR.enum.0.name=*** Write only *** +AT91C_US0_THR.enum.1.name=Error +AT91C_US0_IF.name="AT91C_US0_IF" +AT91C_US0_IF.description="IRDA_FILTER Register" +AT91C_US0_IF.helpkey="IRDA_FILTER Register" +AT91C_US0_IF.access=memorymapped +AT91C_US0_IF.address=0xFFFC004C +AT91C_US0_IF.width=32 +AT91C_US0_IF.byteEndian=little +AT91C_US0_IER.name="AT91C_US0_IER" +AT91C_US0_IER.description="Interrupt Enable Register" +AT91C_US0_IER.helpkey="Interrupt Enable Register" +AT91C_US0_IER.access=memorymapped +AT91C_US0_IER.address=0xFFFC0008 +AT91C_US0_IER.width=32 +AT91C_US0_IER.byteEndian=little +AT91C_US0_IER.type=enum +AT91C_US0_IER.enum.0.name=*** Write only *** +AT91C_US0_IER.enum.1.name=Error +# ========== Register definition for PDC_SSC peripheral ========== +AT91C_SSC_TNCR.name="AT91C_SSC_TNCR" +AT91C_SSC_TNCR.description="Transmit Next Counter Register" +AT91C_SSC_TNCR.helpkey="Transmit Next Counter Register" +AT91C_SSC_TNCR.access=memorymapped +AT91C_SSC_TNCR.address=0xFFFD411C +AT91C_SSC_TNCR.width=32 +AT91C_SSC_TNCR.byteEndian=little +AT91C_SSC_RPR.name="AT91C_SSC_RPR" +AT91C_SSC_RPR.description="Receive Pointer Register" +AT91C_SSC_RPR.helpkey="Receive Pointer Register" +AT91C_SSC_RPR.access=memorymapped +AT91C_SSC_RPR.address=0xFFFD4100 +AT91C_SSC_RPR.width=32 +AT91C_SSC_RPR.byteEndian=little +AT91C_SSC_RNCR.name="AT91C_SSC_RNCR" +AT91C_SSC_RNCR.description="Receive Next Counter Register" +AT91C_SSC_RNCR.helpkey="Receive Next Counter Register" +AT91C_SSC_RNCR.access=memorymapped +AT91C_SSC_RNCR.address=0xFFFD4114 +AT91C_SSC_RNCR.width=32 +AT91C_SSC_RNCR.byteEndian=little +AT91C_SSC_TPR.name="AT91C_SSC_TPR" +AT91C_SSC_TPR.description="Transmit Pointer Register" +AT91C_SSC_TPR.helpkey="Transmit Pointer Register" +AT91C_SSC_TPR.access=memorymapped +AT91C_SSC_TPR.address=0xFFFD4108 +AT91C_SSC_TPR.width=32 +AT91C_SSC_TPR.byteEndian=little +AT91C_SSC_PTCR.name="AT91C_SSC_PTCR" +AT91C_SSC_PTCR.description="PDC Transfer Control Register" +AT91C_SSC_PTCR.helpkey="PDC Transfer Control Register" +AT91C_SSC_PTCR.access=memorymapped +AT91C_SSC_PTCR.address=0xFFFD4120 +AT91C_SSC_PTCR.width=32 +AT91C_SSC_PTCR.byteEndian=little +AT91C_SSC_PTCR.type=enum +AT91C_SSC_PTCR.enum.0.name=*** Write only *** +AT91C_SSC_PTCR.enum.1.name=Error +AT91C_SSC_TCR.name="AT91C_SSC_TCR" +AT91C_SSC_TCR.description="Transmit Counter Register" +AT91C_SSC_TCR.helpkey="Transmit Counter Register" +AT91C_SSC_TCR.access=memorymapped +AT91C_SSC_TCR.address=0xFFFD410C +AT91C_SSC_TCR.width=32 +AT91C_SSC_TCR.byteEndian=little +AT91C_SSC_RCR.name="AT91C_SSC_RCR" +AT91C_SSC_RCR.description="Receive Counter Register" +AT91C_SSC_RCR.helpkey="Receive Counter Register" +AT91C_SSC_RCR.access=memorymapped +AT91C_SSC_RCR.address=0xFFFD4104 +AT91C_SSC_RCR.width=32 +AT91C_SSC_RCR.byteEndian=little +AT91C_SSC_RNPR.name="AT91C_SSC_RNPR" +AT91C_SSC_RNPR.description="Receive Next Pointer Register" +AT91C_SSC_RNPR.helpkey="Receive Next Pointer Register" +AT91C_SSC_RNPR.access=memorymapped +AT91C_SSC_RNPR.address=0xFFFD4110 +AT91C_SSC_RNPR.width=32 +AT91C_SSC_RNPR.byteEndian=little +AT91C_SSC_TNPR.name="AT91C_SSC_TNPR" +AT91C_SSC_TNPR.description="Transmit Next Pointer Register" +AT91C_SSC_TNPR.helpkey="Transmit Next Pointer Register" +AT91C_SSC_TNPR.access=memorymapped +AT91C_SSC_TNPR.address=0xFFFD4118 +AT91C_SSC_TNPR.width=32 +AT91C_SSC_TNPR.byteEndian=little +AT91C_SSC_PTSR.name="AT91C_SSC_PTSR" +AT91C_SSC_PTSR.description="PDC Transfer Status Register" +AT91C_SSC_PTSR.helpkey="PDC Transfer Status Register" +AT91C_SSC_PTSR.access=memorymapped +AT91C_SSC_PTSR.address=0xFFFD4124 +AT91C_SSC_PTSR.width=32 +AT91C_SSC_PTSR.byteEndian=little +AT91C_SSC_PTSR.permission.write=none +# ========== Register definition for SSC peripheral ========== +AT91C_SSC_RHR.name="AT91C_SSC_RHR" +AT91C_SSC_RHR.description="Receive Holding Register" +AT91C_SSC_RHR.helpkey="Receive Holding Register" +AT91C_SSC_RHR.access=memorymapped +AT91C_SSC_RHR.address=0xFFFD4020 +AT91C_SSC_RHR.width=32 +AT91C_SSC_RHR.byteEndian=little +AT91C_SSC_RHR.permission.write=none +AT91C_SSC_RSHR.name="AT91C_SSC_RSHR" +AT91C_SSC_RSHR.description="Receive Sync Holding Register" +AT91C_SSC_RSHR.helpkey="Receive Sync Holding Register" +AT91C_SSC_RSHR.access=memorymapped +AT91C_SSC_RSHR.address=0xFFFD4030 +AT91C_SSC_RSHR.width=32 +AT91C_SSC_RSHR.byteEndian=little +AT91C_SSC_RSHR.permission.write=none +AT91C_SSC_TFMR.name="AT91C_SSC_TFMR" +AT91C_SSC_TFMR.description="Transmit Frame Mode Register" +AT91C_SSC_TFMR.helpkey="Transmit Frame Mode Register" +AT91C_SSC_TFMR.access=memorymapped +AT91C_SSC_TFMR.address=0xFFFD401C +AT91C_SSC_TFMR.width=32 +AT91C_SSC_TFMR.byteEndian=little +AT91C_SSC_IDR.name="AT91C_SSC_IDR" +AT91C_SSC_IDR.description="Interrupt Disable Register" +AT91C_SSC_IDR.helpkey="Interrupt Disable Register" +AT91C_SSC_IDR.access=memorymapped +AT91C_SSC_IDR.address=0xFFFD4048 +AT91C_SSC_IDR.width=32 +AT91C_SSC_IDR.byteEndian=little +AT91C_SSC_IDR.type=enum +AT91C_SSC_IDR.enum.0.name=*** Write only *** +AT91C_SSC_IDR.enum.1.name=Error +AT91C_SSC_THR.name="AT91C_SSC_THR" +AT91C_SSC_THR.description="Transmit Holding Register" +AT91C_SSC_THR.helpkey="Transmit Holding Register" +AT91C_SSC_THR.access=memorymapped +AT91C_SSC_THR.address=0xFFFD4024 +AT91C_SSC_THR.width=32 +AT91C_SSC_THR.byteEndian=little +AT91C_SSC_THR.type=enum +AT91C_SSC_THR.enum.0.name=*** Write only *** +AT91C_SSC_THR.enum.1.name=Error +AT91C_SSC_RCMR.name="AT91C_SSC_RCMR" +AT91C_SSC_RCMR.description="Receive Clock ModeRegister" +AT91C_SSC_RCMR.helpkey="Receive Clock ModeRegister" +AT91C_SSC_RCMR.access=memorymapped +AT91C_SSC_RCMR.address=0xFFFD4010 +AT91C_SSC_RCMR.width=32 +AT91C_SSC_RCMR.byteEndian=little +AT91C_SSC_IER.name="AT91C_SSC_IER" +AT91C_SSC_IER.description="Interrupt Enable Register" +AT91C_SSC_IER.helpkey="Interrupt Enable Register" +AT91C_SSC_IER.access=memorymapped +AT91C_SSC_IER.address=0xFFFD4044 +AT91C_SSC_IER.width=32 +AT91C_SSC_IER.byteEndian=little +AT91C_SSC_IER.type=enum +AT91C_SSC_IER.enum.0.name=*** Write only *** +AT91C_SSC_IER.enum.1.name=Error +AT91C_SSC_TSHR.name="AT91C_SSC_TSHR" +AT91C_SSC_TSHR.description="Transmit Sync Holding Register" +AT91C_SSC_TSHR.helpkey="Transmit Sync Holding Register" +AT91C_SSC_TSHR.access=memorymapped +AT91C_SSC_TSHR.address=0xFFFD4034 +AT91C_SSC_TSHR.width=32 +AT91C_SSC_TSHR.byteEndian=little +AT91C_SSC_SR.name="AT91C_SSC_SR" +AT91C_SSC_SR.description="Status Register" +AT91C_SSC_SR.helpkey="Status Register" +AT91C_SSC_SR.access=memorymapped +AT91C_SSC_SR.address=0xFFFD4040 +AT91C_SSC_SR.width=32 +AT91C_SSC_SR.byteEndian=little +AT91C_SSC_SR.permission.write=none +AT91C_SSC_CMR.name="AT91C_SSC_CMR" +AT91C_SSC_CMR.description="Clock Mode Register" +AT91C_SSC_CMR.helpkey="Clock Mode Register" +AT91C_SSC_CMR.access=memorymapped +AT91C_SSC_CMR.address=0xFFFD4004 +AT91C_SSC_CMR.width=32 +AT91C_SSC_CMR.byteEndian=little +AT91C_SSC_TCMR.name="AT91C_SSC_TCMR" +AT91C_SSC_TCMR.description="Transmit Clock Mode Register" +AT91C_SSC_TCMR.helpkey="Transmit Clock Mode Register" +AT91C_SSC_TCMR.access=memorymapped +AT91C_SSC_TCMR.address=0xFFFD4018 +AT91C_SSC_TCMR.width=32 +AT91C_SSC_TCMR.byteEndian=little +AT91C_SSC_CR.name="AT91C_SSC_CR" +AT91C_SSC_CR.description="Control Register" +AT91C_SSC_CR.helpkey="Control Register" +AT91C_SSC_CR.access=memorymapped +AT91C_SSC_CR.address=0xFFFD4000 +AT91C_SSC_CR.width=32 +AT91C_SSC_CR.byteEndian=little +AT91C_SSC_CR.type=enum +AT91C_SSC_CR.enum.0.name=*** Write only *** +AT91C_SSC_CR.enum.1.name=Error +AT91C_SSC_IMR.name="AT91C_SSC_IMR" +AT91C_SSC_IMR.description="Interrupt Mask Register" +AT91C_SSC_IMR.helpkey="Interrupt Mask Register" +AT91C_SSC_IMR.access=memorymapped +AT91C_SSC_IMR.address=0xFFFD404C +AT91C_SSC_IMR.width=32 +AT91C_SSC_IMR.byteEndian=little +AT91C_SSC_IMR.permission.write=none +AT91C_SSC_RFMR.name="AT91C_SSC_RFMR" +AT91C_SSC_RFMR.description="Receive Frame Mode Register" +AT91C_SSC_RFMR.helpkey="Receive Frame Mode Register" +AT91C_SSC_RFMR.access=memorymapped +AT91C_SSC_RFMR.address=0xFFFD4014 +AT91C_SSC_RFMR.width=32 +AT91C_SSC_RFMR.byteEndian=little +# ========== Register definition for TWI peripheral ========== +AT91C_TWI_IER.name="AT91C_TWI_IER" +AT91C_TWI_IER.description="Interrupt Enable Register" +AT91C_TWI_IER.helpkey="Interrupt Enable Register" +AT91C_TWI_IER.access=memorymapped +AT91C_TWI_IER.address=0xFFFB8024 +AT91C_TWI_IER.width=32 +AT91C_TWI_IER.byteEndian=little +AT91C_TWI_IER.type=enum +AT91C_TWI_IER.enum.0.name=*** Write only *** +AT91C_TWI_IER.enum.1.name=Error +AT91C_TWI_CR.name="AT91C_TWI_CR" +AT91C_TWI_CR.description="Control Register" +AT91C_TWI_CR.helpkey="Control Register" +AT91C_TWI_CR.access=memorymapped +AT91C_TWI_CR.address=0xFFFB8000 +AT91C_TWI_CR.width=32 +AT91C_TWI_CR.byteEndian=little +AT91C_TWI_CR.type=enum +AT91C_TWI_CR.enum.0.name=*** Write only *** +AT91C_TWI_CR.enum.1.name=Error +AT91C_TWI_SR.name="AT91C_TWI_SR" +AT91C_TWI_SR.description="Status Register" +AT91C_TWI_SR.helpkey="Status Register" +AT91C_TWI_SR.access=memorymapped +AT91C_TWI_SR.address=0xFFFB8020 +AT91C_TWI_SR.width=32 +AT91C_TWI_SR.byteEndian=little +AT91C_TWI_SR.permission.write=none +AT91C_TWI_IMR.name="AT91C_TWI_IMR" +AT91C_TWI_IMR.description="Interrupt Mask Register" +AT91C_TWI_IMR.helpkey="Interrupt Mask Register" +AT91C_TWI_IMR.access=memorymapped +AT91C_TWI_IMR.address=0xFFFB802C +AT91C_TWI_IMR.width=32 +AT91C_TWI_IMR.byteEndian=little +AT91C_TWI_IMR.permission.write=none +AT91C_TWI_THR.name="AT91C_TWI_THR" +AT91C_TWI_THR.description="Transmit Holding Register" +AT91C_TWI_THR.helpkey="Transmit Holding Register" +AT91C_TWI_THR.access=memorymapped +AT91C_TWI_THR.address=0xFFFB8034 +AT91C_TWI_THR.width=32 +AT91C_TWI_THR.byteEndian=little +AT91C_TWI_THR.type=enum +AT91C_TWI_THR.enum.0.name=*** Write only *** +AT91C_TWI_THR.enum.1.name=Error +AT91C_TWI_IDR.name="AT91C_TWI_IDR" +AT91C_TWI_IDR.description="Interrupt Disable Register" +AT91C_TWI_IDR.helpkey="Interrupt Disable Register" +AT91C_TWI_IDR.access=memorymapped +AT91C_TWI_IDR.address=0xFFFB8028 +AT91C_TWI_IDR.width=32 +AT91C_TWI_IDR.byteEndian=little +AT91C_TWI_IDR.type=enum +AT91C_TWI_IDR.enum.0.name=*** Write only *** +AT91C_TWI_IDR.enum.1.name=Error +AT91C_TWI_IADR.name="AT91C_TWI_IADR" +AT91C_TWI_IADR.description="Internal Address Register" +AT91C_TWI_IADR.helpkey="Internal Address Register" +AT91C_TWI_IADR.access=memorymapped +AT91C_TWI_IADR.address=0xFFFB800C +AT91C_TWI_IADR.width=32 +AT91C_TWI_IADR.byteEndian=little +AT91C_TWI_MMR.name="AT91C_TWI_MMR" +AT91C_TWI_MMR.description="Master Mode Register" +AT91C_TWI_MMR.helpkey="Master Mode Register" +AT91C_TWI_MMR.access=memorymapped +AT91C_TWI_MMR.address=0xFFFB8004 +AT91C_TWI_MMR.width=32 +AT91C_TWI_MMR.byteEndian=little +AT91C_TWI_CWGR.name="AT91C_TWI_CWGR" +AT91C_TWI_CWGR.description="Clock Waveform Generator Register" +AT91C_TWI_CWGR.helpkey="Clock Waveform Generator Register" +AT91C_TWI_CWGR.access=memorymapped +AT91C_TWI_CWGR.address=0xFFFB8010 +AT91C_TWI_CWGR.width=32 +AT91C_TWI_CWGR.byteEndian=little +AT91C_TWI_RHR.name="AT91C_TWI_RHR" +AT91C_TWI_RHR.description="Receive Holding Register" +AT91C_TWI_RHR.helpkey="Receive Holding Register" +AT91C_TWI_RHR.access=memorymapped +AT91C_TWI_RHR.address=0xFFFB8030 +AT91C_TWI_RHR.width=32 +AT91C_TWI_RHR.byteEndian=little +AT91C_TWI_RHR.permission.write=none +# ========== Register definition for PWMC_CH3 peripheral ========== +AT91C_PWMC_CH3_CUPDR.name="AT91C_PWMC_CH3_CUPDR" +AT91C_PWMC_CH3_CUPDR.description="Channel Update Register" +AT91C_PWMC_CH3_CUPDR.helpkey="Channel Update Register" +AT91C_PWMC_CH3_CUPDR.access=memorymapped +AT91C_PWMC_CH3_CUPDR.address=0xFFFCC270 +AT91C_PWMC_CH3_CUPDR.width=32 +AT91C_PWMC_CH3_CUPDR.byteEndian=little +AT91C_PWMC_CH3_CUPDR.type=enum +AT91C_PWMC_CH3_CUPDR.enum.0.name=*** Write only *** +AT91C_PWMC_CH3_CUPDR.enum.1.name=Error +AT91C_PWMC_CH3_Reserved.name="AT91C_PWMC_CH3_Reserved" +AT91C_PWMC_CH3_Reserved.description="Reserved" +AT91C_PWMC_CH3_Reserved.helpkey="Reserved" +AT91C_PWMC_CH3_Reserved.access=memorymapped +AT91C_PWMC_CH3_Reserved.address=0xFFFCC274 +AT91C_PWMC_CH3_Reserved.width=32 +AT91C_PWMC_CH3_Reserved.byteEndian=little +AT91C_PWMC_CH3_Reserved.type=enum +AT91C_PWMC_CH3_Reserved.enum.0.name=*** Write only *** +AT91C_PWMC_CH3_Reserved.enum.1.name=Error +AT91C_PWMC_CH3_CPRDR.name="AT91C_PWMC_CH3_CPRDR" +AT91C_PWMC_CH3_CPRDR.description="Channel Period Register" +AT91C_PWMC_CH3_CPRDR.helpkey="Channel Period Register" +AT91C_PWMC_CH3_CPRDR.access=memorymapped +AT91C_PWMC_CH3_CPRDR.address=0xFFFCC268 +AT91C_PWMC_CH3_CPRDR.width=32 +AT91C_PWMC_CH3_CPRDR.byteEndian=little +AT91C_PWMC_CH3_CDTYR.name="AT91C_PWMC_CH3_CDTYR" +AT91C_PWMC_CH3_CDTYR.description="Channel Duty Cycle Register" +AT91C_PWMC_CH3_CDTYR.helpkey="Channel Duty Cycle Register" +AT91C_PWMC_CH3_CDTYR.access=memorymapped +AT91C_PWMC_CH3_CDTYR.address=0xFFFCC264 +AT91C_PWMC_CH3_CDTYR.width=32 +AT91C_PWMC_CH3_CDTYR.byteEndian=little +AT91C_PWMC_CH3_CCNTR.name="AT91C_PWMC_CH3_CCNTR" +AT91C_PWMC_CH3_CCNTR.description="Channel Counter Register" +AT91C_PWMC_CH3_CCNTR.helpkey="Channel Counter Register" +AT91C_PWMC_CH3_CCNTR.access=memorymapped +AT91C_PWMC_CH3_CCNTR.address=0xFFFCC26C +AT91C_PWMC_CH3_CCNTR.width=32 +AT91C_PWMC_CH3_CCNTR.byteEndian=little +AT91C_PWMC_CH3_CCNTR.permission.write=none +AT91C_PWMC_CH3_CMR.name="AT91C_PWMC_CH3_CMR" +AT91C_PWMC_CH3_CMR.description="Channel Mode Register" +AT91C_PWMC_CH3_CMR.helpkey="Channel Mode Register" +AT91C_PWMC_CH3_CMR.access=memorymapped +AT91C_PWMC_CH3_CMR.address=0xFFFCC260 +AT91C_PWMC_CH3_CMR.width=32 +AT91C_PWMC_CH3_CMR.byteEndian=little +# ========== Register definition for PWMC_CH2 peripheral ========== +AT91C_PWMC_CH2_Reserved.name="AT91C_PWMC_CH2_Reserved" +AT91C_PWMC_CH2_Reserved.description="Reserved" +AT91C_PWMC_CH2_Reserved.helpkey="Reserved" +AT91C_PWMC_CH2_Reserved.access=memorymapped +AT91C_PWMC_CH2_Reserved.address=0xFFFCC254 +AT91C_PWMC_CH2_Reserved.width=32 +AT91C_PWMC_CH2_Reserved.byteEndian=little +AT91C_PWMC_CH2_Reserved.type=enum +AT91C_PWMC_CH2_Reserved.enum.0.name=*** Write only *** +AT91C_PWMC_CH2_Reserved.enum.1.name=Error +AT91C_PWMC_CH2_CMR.name="AT91C_PWMC_CH2_CMR" +AT91C_PWMC_CH2_CMR.description="Channel Mode Register" +AT91C_PWMC_CH2_CMR.helpkey="Channel Mode Register" +AT91C_PWMC_CH2_CMR.access=memorymapped +AT91C_PWMC_CH2_CMR.address=0xFFFCC240 +AT91C_PWMC_CH2_CMR.width=32 +AT91C_PWMC_CH2_CMR.byteEndian=little +AT91C_PWMC_CH2_CCNTR.name="AT91C_PWMC_CH2_CCNTR" +AT91C_PWMC_CH2_CCNTR.description="Channel Counter Register" +AT91C_PWMC_CH2_CCNTR.helpkey="Channel Counter Register" +AT91C_PWMC_CH2_CCNTR.access=memorymapped +AT91C_PWMC_CH2_CCNTR.address=0xFFFCC24C +AT91C_PWMC_CH2_CCNTR.width=32 +AT91C_PWMC_CH2_CCNTR.byteEndian=little +AT91C_PWMC_CH2_CCNTR.permission.write=none +AT91C_PWMC_CH2_CPRDR.name="AT91C_PWMC_CH2_CPRDR" +AT91C_PWMC_CH2_CPRDR.description="Channel Period Register" +AT91C_PWMC_CH2_CPRDR.helpkey="Channel Period Register" +AT91C_PWMC_CH2_CPRDR.access=memorymapped +AT91C_PWMC_CH2_CPRDR.address=0xFFFCC248 +AT91C_PWMC_CH2_CPRDR.width=32 +AT91C_PWMC_CH2_CPRDR.byteEndian=little +AT91C_PWMC_CH2_CUPDR.name="AT91C_PWMC_CH2_CUPDR" +AT91C_PWMC_CH2_CUPDR.description="Channel Update Register" +AT91C_PWMC_CH2_CUPDR.helpkey="Channel Update Register" +AT91C_PWMC_CH2_CUPDR.access=memorymapped +AT91C_PWMC_CH2_CUPDR.address=0xFFFCC250 +AT91C_PWMC_CH2_CUPDR.width=32 +AT91C_PWMC_CH2_CUPDR.byteEndian=little +AT91C_PWMC_CH2_CUPDR.type=enum +AT91C_PWMC_CH2_CUPDR.enum.0.name=*** Write only *** +AT91C_PWMC_CH2_CUPDR.enum.1.name=Error +AT91C_PWMC_CH2_CDTYR.name="AT91C_PWMC_CH2_CDTYR" +AT91C_PWMC_CH2_CDTYR.description="Channel Duty Cycle Register" +AT91C_PWMC_CH2_CDTYR.helpkey="Channel Duty Cycle Register" +AT91C_PWMC_CH2_CDTYR.access=memorymapped +AT91C_PWMC_CH2_CDTYR.address=0xFFFCC244 +AT91C_PWMC_CH2_CDTYR.width=32 +AT91C_PWMC_CH2_CDTYR.byteEndian=little +# ========== Register definition for PWMC_CH1 peripheral ========== +AT91C_PWMC_CH1_Reserved.name="AT91C_PWMC_CH1_Reserved" +AT91C_PWMC_CH1_Reserved.description="Reserved" +AT91C_PWMC_CH1_Reserved.helpkey="Reserved" +AT91C_PWMC_CH1_Reserved.access=memorymapped +AT91C_PWMC_CH1_Reserved.address=0xFFFCC234 +AT91C_PWMC_CH1_Reserved.width=32 +AT91C_PWMC_CH1_Reserved.byteEndian=little +AT91C_PWMC_CH1_Reserved.type=enum +AT91C_PWMC_CH1_Reserved.enum.0.name=*** Write only *** +AT91C_PWMC_CH1_Reserved.enum.1.name=Error +AT91C_PWMC_CH1_CUPDR.name="AT91C_PWMC_CH1_CUPDR" +AT91C_PWMC_CH1_CUPDR.description="Channel Update Register" +AT91C_PWMC_CH1_CUPDR.helpkey="Channel Update Register" +AT91C_PWMC_CH1_CUPDR.access=memorymapped +AT91C_PWMC_CH1_CUPDR.address=0xFFFCC230 +AT91C_PWMC_CH1_CUPDR.width=32 +AT91C_PWMC_CH1_CUPDR.byteEndian=little +AT91C_PWMC_CH1_CUPDR.type=enum +AT91C_PWMC_CH1_CUPDR.enum.0.name=*** Write only *** +AT91C_PWMC_CH1_CUPDR.enum.1.name=Error +AT91C_PWMC_CH1_CPRDR.name="AT91C_PWMC_CH1_CPRDR" +AT91C_PWMC_CH1_CPRDR.description="Channel Period Register" +AT91C_PWMC_CH1_CPRDR.helpkey="Channel Period Register" +AT91C_PWMC_CH1_CPRDR.access=memorymapped +AT91C_PWMC_CH1_CPRDR.address=0xFFFCC228 +AT91C_PWMC_CH1_CPRDR.width=32 +AT91C_PWMC_CH1_CPRDR.byteEndian=little +AT91C_PWMC_CH1_CCNTR.name="AT91C_PWMC_CH1_CCNTR" +AT91C_PWMC_CH1_CCNTR.description="Channel Counter Register" +AT91C_PWMC_CH1_CCNTR.helpkey="Channel Counter Register" +AT91C_PWMC_CH1_CCNTR.access=memorymapped +AT91C_PWMC_CH1_CCNTR.address=0xFFFCC22C +AT91C_PWMC_CH1_CCNTR.width=32 +AT91C_PWMC_CH1_CCNTR.byteEndian=little +AT91C_PWMC_CH1_CCNTR.permission.write=none +AT91C_PWMC_CH1_CDTYR.name="AT91C_PWMC_CH1_CDTYR" +AT91C_PWMC_CH1_CDTYR.description="Channel Duty Cycle Register" +AT91C_PWMC_CH1_CDTYR.helpkey="Channel Duty Cycle Register" +AT91C_PWMC_CH1_CDTYR.access=memorymapped +AT91C_PWMC_CH1_CDTYR.address=0xFFFCC224 +AT91C_PWMC_CH1_CDTYR.width=32 +AT91C_PWMC_CH1_CDTYR.byteEndian=little +AT91C_PWMC_CH1_CMR.name="AT91C_PWMC_CH1_CMR" +AT91C_PWMC_CH1_CMR.description="Channel Mode Register" +AT91C_PWMC_CH1_CMR.helpkey="Channel Mode Register" +AT91C_PWMC_CH1_CMR.access=memorymapped +AT91C_PWMC_CH1_CMR.address=0xFFFCC220 +AT91C_PWMC_CH1_CMR.width=32 +AT91C_PWMC_CH1_CMR.byteEndian=little +# ========== Register definition for PWMC_CH0 peripheral ========== +AT91C_PWMC_CH0_Reserved.name="AT91C_PWMC_CH0_Reserved" +AT91C_PWMC_CH0_Reserved.description="Reserved" +AT91C_PWMC_CH0_Reserved.helpkey="Reserved" +AT91C_PWMC_CH0_Reserved.access=memorymapped +AT91C_PWMC_CH0_Reserved.address=0xFFFCC214 +AT91C_PWMC_CH0_Reserved.width=32 +AT91C_PWMC_CH0_Reserved.byteEndian=little +AT91C_PWMC_CH0_Reserved.type=enum +AT91C_PWMC_CH0_Reserved.enum.0.name=*** Write only *** +AT91C_PWMC_CH0_Reserved.enum.1.name=Error +AT91C_PWMC_CH0_CPRDR.name="AT91C_PWMC_CH0_CPRDR" +AT91C_PWMC_CH0_CPRDR.description="Channel Period Register" +AT91C_PWMC_CH0_CPRDR.helpkey="Channel Period Register" +AT91C_PWMC_CH0_CPRDR.access=memorymapped +AT91C_PWMC_CH0_CPRDR.address=0xFFFCC208 +AT91C_PWMC_CH0_CPRDR.width=32 +AT91C_PWMC_CH0_CPRDR.byteEndian=little +AT91C_PWMC_CH0_CDTYR.name="AT91C_PWMC_CH0_CDTYR" +AT91C_PWMC_CH0_CDTYR.description="Channel Duty Cycle Register" +AT91C_PWMC_CH0_CDTYR.helpkey="Channel Duty Cycle Register" +AT91C_PWMC_CH0_CDTYR.access=memorymapped +AT91C_PWMC_CH0_CDTYR.address=0xFFFCC204 +AT91C_PWMC_CH0_CDTYR.width=32 +AT91C_PWMC_CH0_CDTYR.byteEndian=little +AT91C_PWMC_CH0_CMR.name="AT91C_PWMC_CH0_CMR" +AT91C_PWMC_CH0_CMR.description="Channel Mode Register" +AT91C_PWMC_CH0_CMR.helpkey="Channel Mode Register" +AT91C_PWMC_CH0_CMR.access=memorymapped +AT91C_PWMC_CH0_CMR.address=0xFFFCC200 +AT91C_PWMC_CH0_CMR.width=32 +AT91C_PWMC_CH0_CMR.byteEndian=little +AT91C_PWMC_CH0_CUPDR.name="AT91C_PWMC_CH0_CUPDR" +AT91C_PWMC_CH0_CUPDR.description="Channel Update Register" +AT91C_PWMC_CH0_CUPDR.helpkey="Channel Update Register" +AT91C_PWMC_CH0_CUPDR.access=memorymapped +AT91C_PWMC_CH0_CUPDR.address=0xFFFCC210 +AT91C_PWMC_CH0_CUPDR.width=32 +AT91C_PWMC_CH0_CUPDR.byteEndian=little +AT91C_PWMC_CH0_CUPDR.type=enum +AT91C_PWMC_CH0_CUPDR.enum.0.name=*** Write only *** +AT91C_PWMC_CH0_CUPDR.enum.1.name=Error +AT91C_PWMC_CH0_CCNTR.name="AT91C_PWMC_CH0_CCNTR" +AT91C_PWMC_CH0_CCNTR.description="Channel Counter Register" +AT91C_PWMC_CH0_CCNTR.helpkey="Channel Counter Register" +AT91C_PWMC_CH0_CCNTR.access=memorymapped +AT91C_PWMC_CH0_CCNTR.address=0xFFFCC20C +AT91C_PWMC_CH0_CCNTR.width=32 +AT91C_PWMC_CH0_CCNTR.byteEndian=little +AT91C_PWMC_CH0_CCNTR.permission.write=none +# ========== Register definition for PWMC peripheral ========== +AT91C_PWMC_IDR.name="AT91C_PWMC_IDR" +AT91C_PWMC_IDR.description="PWMC Interrupt Disable Register" +AT91C_PWMC_IDR.helpkey="PWMC Interrupt Disable Register" +AT91C_PWMC_IDR.access=memorymapped +AT91C_PWMC_IDR.address=0xFFFCC014 +AT91C_PWMC_IDR.width=32 +AT91C_PWMC_IDR.byteEndian=little +AT91C_PWMC_IDR.type=enum +AT91C_PWMC_IDR.enum.0.name=*** Write only *** +AT91C_PWMC_IDR.enum.1.name=Error +AT91C_PWMC_DIS.name="AT91C_PWMC_DIS" +AT91C_PWMC_DIS.description="PWMC Disable Register" +AT91C_PWMC_DIS.helpkey="PWMC Disable Register" +AT91C_PWMC_DIS.access=memorymapped +AT91C_PWMC_DIS.address=0xFFFCC008 +AT91C_PWMC_DIS.width=32 +AT91C_PWMC_DIS.byteEndian=little +AT91C_PWMC_DIS.type=enum +AT91C_PWMC_DIS.enum.0.name=*** Write only *** +AT91C_PWMC_DIS.enum.1.name=Error +AT91C_PWMC_IER.name="AT91C_PWMC_IER" +AT91C_PWMC_IER.description="PWMC Interrupt Enable Register" +AT91C_PWMC_IER.helpkey="PWMC Interrupt Enable Register" +AT91C_PWMC_IER.access=memorymapped +AT91C_PWMC_IER.address=0xFFFCC010 +AT91C_PWMC_IER.width=32 +AT91C_PWMC_IER.byteEndian=little +AT91C_PWMC_IER.type=enum +AT91C_PWMC_IER.enum.0.name=*** Write only *** +AT91C_PWMC_IER.enum.1.name=Error +AT91C_PWMC_VR.name="AT91C_PWMC_VR" +AT91C_PWMC_VR.description="PWMC Version Register" +AT91C_PWMC_VR.helpkey="PWMC Version Register" +AT91C_PWMC_VR.access=memorymapped +AT91C_PWMC_VR.address=0xFFFCC0FC +AT91C_PWMC_VR.width=32 +AT91C_PWMC_VR.byteEndian=little +AT91C_PWMC_VR.permission.write=none +AT91C_PWMC_ISR.name="AT91C_PWMC_ISR" +AT91C_PWMC_ISR.description="PWMC Interrupt Status Register" +AT91C_PWMC_ISR.helpkey="PWMC Interrupt Status Register" +AT91C_PWMC_ISR.access=memorymapped +AT91C_PWMC_ISR.address=0xFFFCC01C +AT91C_PWMC_ISR.width=32 +AT91C_PWMC_ISR.byteEndian=little +AT91C_PWMC_ISR.permission.write=none +AT91C_PWMC_SR.name="AT91C_PWMC_SR" +AT91C_PWMC_SR.description="PWMC Status Register" +AT91C_PWMC_SR.helpkey="PWMC Status Register" +AT91C_PWMC_SR.access=memorymapped +AT91C_PWMC_SR.address=0xFFFCC00C +AT91C_PWMC_SR.width=32 +AT91C_PWMC_SR.byteEndian=little +AT91C_PWMC_SR.permission.write=none +AT91C_PWMC_IMR.name="AT91C_PWMC_IMR" +AT91C_PWMC_IMR.description="PWMC Interrupt Mask Register" +AT91C_PWMC_IMR.helpkey="PWMC Interrupt Mask Register" +AT91C_PWMC_IMR.access=memorymapped +AT91C_PWMC_IMR.address=0xFFFCC018 +AT91C_PWMC_IMR.width=32 +AT91C_PWMC_IMR.byteEndian=little +AT91C_PWMC_IMR.permission.write=none +AT91C_PWMC_MR.name="AT91C_PWMC_MR" +AT91C_PWMC_MR.description="PWMC Mode Register" +AT91C_PWMC_MR.helpkey="PWMC Mode Register" +AT91C_PWMC_MR.access=memorymapped +AT91C_PWMC_MR.address=0xFFFCC000 +AT91C_PWMC_MR.width=32 +AT91C_PWMC_MR.byteEndian=little +AT91C_PWMC_ENA.name="AT91C_PWMC_ENA" +AT91C_PWMC_ENA.description="PWMC Enable Register" +AT91C_PWMC_ENA.helpkey="PWMC Enable Register" +AT91C_PWMC_ENA.access=memorymapped +AT91C_PWMC_ENA.address=0xFFFCC004 +AT91C_PWMC_ENA.width=32 +AT91C_PWMC_ENA.byteEndian=little +AT91C_PWMC_ENA.type=enum +AT91C_PWMC_ENA.enum.0.name=*** Write only *** +AT91C_PWMC_ENA.enum.1.name=Error +# ========== Register definition for UDP peripheral ========== +AT91C_UDP_IMR.name="AT91C_UDP_IMR" +AT91C_UDP_IMR.description="Interrupt Mask Register" +AT91C_UDP_IMR.helpkey="Interrupt Mask Register" +AT91C_UDP_IMR.access=memorymapped +AT91C_UDP_IMR.address=0xFFFB0018 +AT91C_UDP_IMR.width=32 +AT91C_UDP_IMR.byteEndian=little +AT91C_UDP_IMR.permission.write=none +AT91C_UDP_FADDR.name="AT91C_UDP_FADDR" +AT91C_UDP_FADDR.description="Function Address Register" +AT91C_UDP_FADDR.helpkey="Function Address Register" +AT91C_UDP_FADDR.access=memorymapped +AT91C_UDP_FADDR.address=0xFFFB0008 +AT91C_UDP_FADDR.width=32 +AT91C_UDP_FADDR.byteEndian=little +AT91C_UDP_NUM.name="AT91C_UDP_NUM" +AT91C_UDP_NUM.description="Frame Number Register" +AT91C_UDP_NUM.helpkey="Frame Number Register" +AT91C_UDP_NUM.access=memorymapped +AT91C_UDP_NUM.address=0xFFFB0000 +AT91C_UDP_NUM.width=32 +AT91C_UDP_NUM.byteEndian=little +AT91C_UDP_NUM.permission.write=none +AT91C_UDP_FDR.name="AT91C_UDP_FDR" +AT91C_UDP_FDR.description="Endpoint FIFO Data Register" +AT91C_UDP_FDR.helpkey="Endpoint FIFO Data Register" +AT91C_UDP_FDR.access=memorymapped +AT91C_UDP_FDR.address=0xFFFB0050 +AT91C_UDP_FDR.width=32 +AT91C_UDP_FDR.byteEndian=little +AT91C_UDP_ISR.name="AT91C_UDP_ISR" +AT91C_UDP_ISR.description="Interrupt Status Register" +AT91C_UDP_ISR.helpkey="Interrupt Status Register" +AT91C_UDP_ISR.access=memorymapped +AT91C_UDP_ISR.address=0xFFFB001C +AT91C_UDP_ISR.width=32 +AT91C_UDP_ISR.byteEndian=little +AT91C_UDP_ISR.permission.write=none +AT91C_UDP_CSR.name="AT91C_UDP_CSR" +AT91C_UDP_CSR.description="Endpoint Control and Status Register" +AT91C_UDP_CSR.helpkey="Endpoint Control and Status Register" +AT91C_UDP_CSR.access=memorymapped +AT91C_UDP_CSR.address=0xFFFB0030 +AT91C_UDP_CSR.width=32 +AT91C_UDP_CSR.byteEndian=little +AT91C_UDP_IDR.name="AT91C_UDP_IDR" +AT91C_UDP_IDR.description="Interrupt Disable Register" +AT91C_UDP_IDR.helpkey="Interrupt Disable Register" +AT91C_UDP_IDR.access=memorymapped +AT91C_UDP_IDR.address=0xFFFB0014 +AT91C_UDP_IDR.width=32 +AT91C_UDP_IDR.byteEndian=little +AT91C_UDP_IDR.type=enum +AT91C_UDP_IDR.enum.0.name=*** Write only *** +AT91C_UDP_IDR.enum.1.name=Error +AT91C_UDP_ICR.name="AT91C_UDP_ICR" +AT91C_UDP_ICR.description="Interrupt Clear Register" +AT91C_UDP_ICR.helpkey="Interrupt Clear Register" +AT91C_UDP_ICR.access=memorymapped +AT91C_UDP_ICR.address=0xFFFB0020 +AT91C_UDP_ICR.width=32 +AT91C_UDP_ICR.byteEndian=little +AT91C_UDP_ICR.permission.write=none +AT91C_UDP_RSTEP.name="AT91C_UDP_RSTEP" +AT91C_UDP_RSTEP.description="Reset Endpoint Register" +AT91C_UDP_RSTEP.helpkey="Reset Endpoint Register" +AT91C_UDP_RSTEP.access=memorymapped +AT91C_UDP_RSTEP.address=0xFFFB0028 +AT91C_UDP_RSTEP.width=32 +AT91C_UDP_RSTEP.byteEndian=little +AT91C_UDP_RSTEP.permission.write=none +AT91C_UDP_TXVC.name="AT91C_UDP_TXVC" +AT91C_UDP_TXVC.description="Transceiver Control Register" +AT91C_UDP_TXVC.helpkey="Transceiver Control Register" +AT91C_UDP_TXVC.access=memorymapped +AT91C_UDP_TXVC.address=0xFFFB0074 +AT91C_UDP_TXVC.width=32 +AT91C_UDP_TXVC.byteEndian=little +AT91C_UDP_GLBSTATE.name="AT91C_UDP_GLBSTATE" +AT91C_UDP_GLBSTATE.description="Global State Register" +AT91C_UDP_GLBSTATE.helpkey="Global State Register" +AT91C_UDP_GLBSTATE.access=memorymapped +AT91C_UDP_GLBSTATE.address=0xFFFB0004 +AT91C_UDP_GLBSTATE.width=32 +AT91C_UDP_GLBSTATE.byteEndian=little +AT91C_UDP_IER.name="AT91C_UDP_IER" +AT91C_UDP_IER.description="Interrupt Enable Register" +AT91C_UDP_IER.helpkey="Interrupt Enable Register" +AT91C_UDP_IER.access=memorymapped +AT91C_UDP_IER.address=0xFFFB0010 +AT91C_UDP_IER.width=32 +AT91C_UDP_IER.byteEndian=little +AT91C_UDP_IER.type=enum +AT91C_UDP_IER.enum.0.name=*** Write only *** +AT91C_UDP_IER.enum.1.name=Error +# ========== Register definition for TC0 peripheral ========== +AT91C_TC0_SR.name="AT91C_TC0_SR" +AT91C_TC0_SR.description="Status Register" +AT91C_TC0_SR.helpkey="Status Register" +AT91C_TC0_SR.access=memorymapped +AT91C_TC0_SR.address=0xFFFA0020 +AT91C_TC0_SR.width=32 +AT91C_TC0_SR.byteEndian=little +AT91C_TC0_SR.permission.write=none +AT91C_TC0_RC.name="AT91C_TC0_RC" +AT91C_TC0_RC.description="Register C" +AT91C_TC0_RC.helpkey="Register C" +AT91C_TC0_RC.access=memorymapped +AT91C_TC0_RC.address=0xFFFA001C +AT91C_TC0_RC.width=32 +AT91C_TC0_RC.byteEndian=little +AT91C_TC0_RB.name="AT91C_TC0_RB" +AT91C_TC0_RB.description="Register B" +AT91C_TC0_RB.helpkey="Register B" +AT91C_TC0_RB.access=memorymapped +AT91C_TC0_RB.address=0xFFFA0018 +AT91C_TC0_RB.width=32 +AT91C_TC0_RB.byteEndian=little +AT91C_TC0_CCR.name="AT91C_TC0_CCR" +AT91C_TC0_CCR.description="Channel Control Register" +AT91C_TC0_CCR.helpkey="Channel Control Register" +AT91C_TC0_CCR.access=memorymapped +AT91C_TC0_CCR.address=0xFFFA0000 +AT91C_TC0_CCR.width=32 +AT91C_TC0_CCR.byteEndian=little +AT91C_TC0_CCR.type=enum +AT91C_TC0_CCR.enum.0.name=*** Write only *** +AT91C_TC0_CCR.enum.1.name=Error +AT91C_TC0_CMR.name="AT91C_TC0_CMR" +AT91C_TC0_CMR.description="Channel Mode Register (Capture Mode / Waveform Mode)" +AT91C_TC0_CMR.helpkey="Channel Mode Register (Capture Mode / Waveform Mode)" +AT91C_TC0_CMR.access=memorymapped +AT91C_TC0_CMR.address=0xFFFA0004 +AT91C_TC0_CMR.width=32 +AT91C_TC0_CMR.byteEndian=little +AT91C_TC0_IER.name="AT91C_TC0_IER" +AT91C_TC0_IER.description="Interrupt Enable Register" +AT91C_TC0_IER.helpkey="Interrupt Enable Register" +AT91C_TC0_IER.access=memorymapped +AT91C_TC0_IER.address=0xFFFA0024 +AT91C_TC0_IER.width=32 +AT91C_TC0_IER.byteEndian=little +AT91C_TC0_IER.type=enum +AT91C_TC0_IER.enum.0.name=*** Write only *** +AT91C_TC0_IER.enum.1.name=Error +AT91C_TC0_RA.name="AT91C_TC0_RA" +AT91C_TC0_RA.description="Register A" +AT91C_TC0_RA.helpkey="Register A" +AT91C_TC0_RA.access=memorymapped +AT91C_TC0_RA.address=0xFFFA0014 +AT91C_TC0_RA.width=32 +AT91C_TC0_RA.byteEndian=little +AT91C_TC0_IDR.name="AT91C_TC0_IDR" +AT91C_TC0_IDR.description="Interrupt Disable Register" +AT91C_TC0_IDR.helpkey="Interrupt Disable Register" +AT91C_TC0_IDR.access=memorymapped +AT91C_TC0_IDR.address=0xFFFA0028 +AT91C_TC0_IDR.width=32 +AT91C_TC0_IDR.byteEndian=little +AT91C_TC0_IDR.type=enum +AT91C_TC0_IDR.enum.0.name=*** Write only *** +AT91C_TC0_IDR.enum.1.name=Error +AT91C_TC0_CV.name="AT91C_TC0_CV" +AT91C_TC0_CV.description="Counter Value" +AT91C_TC0_CV.helpkey="Counter Value" +AT91C_TC0_CV.access=memorymapped +AT91C_TC0_CV.address=0xFFFA0010 +AT91C_TC0_CV.width=32 +AT91C_TC0_CV.byteEndian=little +AT91C_TC0_IMR.name="AT91C_TC0_IMR" +AT91C_TC0_IMR.description="Interrupt Mask Register" +AT91C_TC0_IMR.helpkey="Interrupt Mask Register" +AT91C_TC0_IMR.access=memorymapped +AT91C_TC0_IMR.address=0xFFFA002C +AT91C_TC0_IMR.width=32 +AT91C_TC0_IMR.byteEndian=little +AT91C_TC0_IMR.permission.write=none +# ========== Register definition for TC1 peripheral ========== +AT91C_TC1_RB.name="AT91C_TC1_RB" +AT91C_TC1_RB.description="Register B" +AT91C_TC1_RB.helpkey="Register B" +AT91C_TC1_RB.access=memorymapped +AT91C_TC1_RB.address=0xFFFA0058 +AT91C_TC1_RB.width=32 +AT91C_TC1_RB.byteEndian=little +AT91C_TC1_CCR.name="AT91C_TC1_CCR" +AT91C_TC1_CCR.description="Channel Control Register" +AT91C_TC1_CCR.helpkey="Channel Control Register" +AT91C_TC1_CCR.access=memorymapped +AT91C_TC1_CCR.address=0xFFFA0040 +AT91C_TC1_CCR.width=32 +AT91C_TC1_CCR.byteEndian=little +AT91C_TC1_CCR.type=enum +AT91C_TC1_CCR.enum.0.name=*** Write only *** +AT91C_TC1_CCR.enum.1.name=Error +AT91C_TC1_IER.name="AT91C_TC1_IER" +AT91C_TC1_IER.description="Interrupt Enable Register" +AT91C_TC1_IER.helpkey="Interrupt Enable Register" +AT91C_TC1_IER.access=memorymapped +AT91C_TC1_IER.address=0xFFFA0064 +AT91C_TC1_IER.width=32 +AT91C_TC1_IER.byteEndian=little +AT91C_TC1_IER.type=enum +AT91C_TC1_IER.enum.0.name=*** Write only *** +AT91C_TC1_IER.enum.1.name=Error +AT91C_TC1_IDR.name="AT91C_TC1_IDR" +AT91C_TC1_IDR.description="Interrupt Disable Register" +AT91C_TC1_IDR.helpkey="Interrupt Disable Register" +AT91C_TC1_IDR.access=memorymapped +AT91C_TC1_IDR.address=0xFFFA0068 +AT91C_TC1_IDR.width=32 +AT91C_TC1_IDR.byteEndian=little +AT91C_TC1_IDR.type=enum +AT91C_TC1_IDR.enum.0.name=*** Write only *** +AT91C_TC1_IDR.enum.1.name=Error +AT91C_TC1_SR.name="AT91C_TC1_SR" +AT91C_TC1_SR.description="Status Register" +AT91C_TC1_SR.helpkey="Status Register" +AT91C_TC1_SR.access=memorymapped +AT91C_TC1_SR.address=0xFFFA0060 +AT91C_TC1_SR.width=32 +AT91C_TC1_SR.byteEndian=little +AT91C_TC1_SR.permission.write=none +AT91C_TC1_CMR.name="AT91C_TC1_CMR" +AT91C_TC1_CMR.description="Channel Mode Register (Capture Mode / Waveform Mode)" +AT91C_TC1_CMR.helpkey="Channel Mode Register (Capture Mode / Waveform Mode)" +AT91C_TC1_CMR.access=memorymapped +AT91C_TC1_CMR.address=0xFFFA0044 +AT91C_TC1_CMR.width=32 +AT91C_TC1_CMR.byteEndian=little +AT91C_TC1_RA.name="AT91C_TC1_RA" +AT91C_TC1_RA.description="Register A" +AT91C_TC1_RA.helpkey="Register A" +AT91C_TC1_RA.access=memorymapped +AT91C_TC1_RA.address=0xFFFA0054 +AT91C_TC1_RA.width=32 +AT91C_TC1_RA.byteEndian=little +AT91C_TC1_RC.name="AT91C_TC1_RC" +AT91C_TC1_RC.description="Register C" +AT91C_TC1_RC.helpkey="Register C" +AT91C_TC1_RC.access=memorymapped +AT91C_TC1_RC.address=0xFFFA005C +AT91C_TC1_RC.width=32 +AT91C_TC1_RC.byteEndian=little +AT91C_TC1_IMR.name="AT91C_TC1_IMR" +AT91C_TC1_IMR.description="Interrupt Mask Register" +AT91C_TC1_IMR.helpkey="Interrupt Mask Register" +AT91C_TC1_IMR.access=memorymapped +AT91C_TC1_IMR.address=0xFFFA006C +AT91C_TC1_IMR.width=32 +AT91C_TC1_IMR.byteEndian=little +AT91C_TC1_IMR.permission.write=none +AT91C_TC1_CV.name="AT91C_TC1_CV" +AT91C_TC1_CV.description="Counter Value" +AT91C_TC1_CV.helpkey="Counter Value" +AT91C_TC1_CV.access=memorymapped +AT91C_TC1_CV.address=0xFFFA0050 +AT91C_TC1_CV.width=32 +AT91C_TC1_CV.byteEndian=little +# ========== Register definition for TC2 peripheral ========== +AT91C_TC2_CMR.name="AT91C_TC2_CMR" +AT91C_TC2_CMR.description="Channel Mode Register (Capture Mode / Waveform Mode)" +AT91C_TC2_CMR.helpkey="Channel Mode Register (Capture Mode / Waveform Mode)" +AT91C_TC2_CMR.access=memorymapped +AT91C_TC2_CMR.address=0xFFFA0084 +AT91C_TC2_CMR.width=32 +AT91C_TC2_CMR.byteEndian=little +AT91C_TC2_CCR.name="AT91C_TC2_CCR" +AT91C_TC2_CCR.description="Channel Control Register" +AT91C_TC2_CCR.helpkey="Channel Control Register" +AT91C_TC2_CCR.access=memorymapped +AT91C_TC2_CCR.address=0xFFFA0080 +AT91C_TC2_CCR.width=32 +AT91C_TC2_CCR.byteEndian=little +AT91C_TC2_CCR.type=enum +AT91C_TC2_CCR.enum.0.name=*** Write only *** +AT91C_TC2_CCR.enum.1.name=Error +AT91C_TC2_CV.name="AT91C_TC2_CV" +AT91C_TC2_CV.description="Counter Value" +AT91C_TC2_CV.helpkey="Counter Value" +AT91C_TC2_CV.access=memorymapped +AT91C_TC2_CV.address=0xFFFA0090 +AT91C_TC2_CV.width=32 +AT91C_TC2_CV.byteEndian=little +AT91C_TC2_RA.name="AT91C_TC2_RA" +AT91C_TC2_RA.description="Register A" +AT91C_TC2_RA.helpkey="Register A" +AT91C_TC2_RA.access=memorymapped +AT91C_TC2_RA.address=0xFFFA0094 +AT91C_TC2_RA.width=32 +AT91C_TC2_RA.byteEndian=little +AT91C_TC2_RB.name="AT91C_TC2_RB" +AT91C_TC2_RB.description="Register B" +AT91C_TC2_RB.helpkey="Register B" +AT91C_TC2_RB.access=memorymapped +AT91C_TC2_RB.address=0xFFFA0098 +AT91C_TC2_RB.width=32 +AT91C_TC2_RB.byteEndian=little +AT91C_TC2_IDR.name="AT91C_TC2_IDR" +AT91C_TC2_IDR.description="Interrupt Disable Register" +AT91C_TC2_IDR.helpkey="Interrupt Disable Register" +AT91C_TC2_IDR.access=memorymapped +AT91C_TC2_IDR.address=0xFFFA00A8 +AT91C_TC2_IDR.width=32 +AT91C_TC2_IDR.byteEndian=little +AT91C_TC2_IDR.type=enum +AT91C_TC2_IDR.enum.0.name=*** Write only *** +AT91C_TC2_IDR.enum.1.name=Error +AT91C_TC2_IMR.name="AT91C_TC2_IMR" +AT91C_TC2_IMR.description="Interrupt Mask Register" +AT91C_TC2_IMR.helpkey="Interrupt Mask Register" +AT91C_TC2_IMR.access=memorymapped +AT91C_TC2_IMR.address=0xFFFA00AC +AT91C_TC2_IMR.width=32 +AT91C_TC2_IMR.byteEndian=little +AT91C_TC2_IMR.permission.write=none +AT91C_TC2_RC.name="AT91C_TC2_RC" +AT91C_TC2_RC.description="Register C" +AT91C_TC2_RC.helpkey="Register C" +AT91C_TC2_RC.access=memorymapped +AT91C_TC2_RC.address=0xFFFA009C +AT91C_TC2_RC.width=32 +AT91C_TC2_RC.byteEndian=little +AT91C_TC2_IER.name="AT91C_TC2_IER" +AT91C_TC2_IER.description="Interrupt Enable Register" +AT91C_TC2_IER.helpkey="Interrupt Enable Register" +AT91C_TC2_IER.access=memorymapped +AT91C_TC2_IER.address=0xFFFA00A4 +AT91C_TC2_IER.width=32 +AT91C_TC2_IER.byteEndian=little +AT91C_TC2_IER.type=enum +AT91C_TC2_IER.enum.0.name=*** Write only *** +AT91C_TC2_IER.enum.1.name=Error +AT91C_TC2_SR.name="AT91C_TC2_SR" +AT91C_TC2_SR.description="Status Register" +AT91C_TC2_SR.helpkey="Status Register" +AT91C_TC2_SR.access=memorymapped +AT91C_TC2_SR.address=0xFFFA00A0 +AT91C_TC2_SR.width=32 +AT91C_TC2_SR.byteEndian=little +AT91C_TC2_SR.permission.write=none +# ========== Register definition for TCB peripheral ========== +AT91C_TCB_BMR.name="AT91C_TCB_BMR" +AT91C_TCB_BMR.description="TC Block Mode Register" +AT91C_TCB_BMR.helpkey="TC Block Mode Register" +AT91C_TCB_BMR.access=memorymapped +AT91C_TCB_BMR.address=0xFFFA00C4 +AT91C_TCB_BMR.width=32 +AT91C_TCB_BMR.byteEndian=little +AT91C_TCB_BCR.name="AT91C_TCB_BCR" +AT91C_TCB_BCR.description="TC Block Control Register" +AT91C_TCB_BCR.helpkey="TC Block Control Register" +AT91C_TCB_BCR.access=memorymapped +AT91C_TCB_BCR.address=0xFFFA00C0 +AT91C_TCB_BCR.width=32 +AT91C_TCB_BCR.byteEndian=little +AT91C_TCB_BCR.type=enum +AT91C_TCB_BCR.enum.0.name=*** Write only *** +AT91C_TCB_BCR.enum.1.name=Error +# ========== Register definition for CAN_MB0 peripheral ========== +AT91C_CAN_MB0_MDL.name="AT91C_CAN_MB0_MDL" +AT91C_CAN_MB0_MDL.description="MailBox Data Low Register" +AT91C_CAN_MB0_MDL.helpkey="MailBox Data Low Register" +AT91C_CAN_MB0_MDL.access=memorymapped +AT91C_CAN_MB0_MDL.address=0xFFFD0214 +AT91C_CAN_MB0_MDL.width=32 +AT91C_CAN_MB0_MDL.byteEndian=little +AT91C_CAN_MB0_MAM.name="AT91C_CAN_MB0_MAM" +AT91C_CAN_MB0_MAM.description="MailBox Acceptance Mask Register" +AT91C_CAN_MB0_MAM.helpkey="MailBox Acceptance Mask Register" +AT91C_CAN_MB0_MAM.access=memorymapped +AT91C_CAN_MB0_MAM.address=0xFFFD0204 +AT91C_CAN_MB0_MAM.width=32 +AT91C_CAN_MB0_MAM.byteEndian=little +AT91C_CAN_MB0_MCR.name="AT91C_CAN_MB0_MCR" +AT91C_CAN_MB0_MCR.description="MailBox Control Register" +AT91C_CAN_MB0_MCR.helpkey="MailBox Control Register" +AT91C_CAN_MB0_MCR.access=memorymapped +AT91C_CAN_MB0_MCR.address=0xFFFD021C +AT91C_CAN_MB0_MCR.width=32 +AT91C_CAN_MB0_MCR.byteEndian=little +AT91C_CAN_MB0_MCR.type=enum +AT91C_CAN_MB0_MCR.enum.0.name=*** Write only *** +AT91C_CAN_MB0_MCR.enum.1.name=Error +AT91C_CAN_MB0_MID.name="AT91C_CAN_MB0_MID" +AT91C_CAN_MB0_MID.description="MailBox ID Register" +AT91C_CAN_MB0_MID.helpkey="MailBox ID Register" +AT91C_CAN_MB0_MID.access=memorymapped +AT91C_CAN_MB0_MID.address=0xFFFD0208 +AT91C_CAN_MB0_MID.width=32 +AT91C_CAN_MB0_MID.byteEndian=little +AT91C_CAN_MB0_MSR.name="AT91C_CAN_MB0_MSR" +AT91C_CAN_MB0_MSR.description="MailBox Status Register" +AT91C_CAN_MB0_MSR.helpkey="MailBox Status Register" +AT91C_CAN_MB0_MSR.access=memorymapped +AT91C_CAN_MB0_MSR.address=0xFFFD0210 +AT91C_CAN_MB0_MSR.width=32 +AT91C_CAN_MB0_MSR.byteEndian=little +AT91C_CAN_MB0_MSR.permission.write=none +AT91C_CAN_MB0_MFID.name="AT91C_CAN_MB0_MFID" +AT91C_CAN_MB0_MFID.description="MailBox Family ID Register" +AT91C_CAN_MB0_MFID.helpkey="MailBox Family ID Register" +AT91C_CAN_MB0_MFID.access=memorymapped +AT91C_CAN_MB0_MFID.address=0xFFFD020C +AT91C_CAN_MB0_MFID.width=32 +AT91C_CAN_MB0_MFID.byteEndian=little +AT91C_CAN_MB0_MFID.permission.write=none +AT91C_CAN_MB0_MDH.name="AT91C_CAN_MB0_MDH" +AT91C_CAN_MB0_MDH.description="MailBox Data High Register" +AT91C_CAN_MB0_MDH.helpkey="MailBox Data High Register" +AT91C_CAN_MB0_MDH.access=memorymapped +AT91C_CAN_MB0_MDH.address=0xFFFD0218 +AT91C_CAN_MB0_MDH.width=32 +AT91C_CAN_MB0_MDH.byteEndian=little +AT91C_CAN_MB0_MMR.name="AT91C_CAN_MB0_MMR" +AT91C_CAN_MB0_MMR.description="MailBox Mode Register" +AT91C_CAN_MB0_MMR.helpkey="MailBox Mode Register" +AT91C_CAN_MB0_MMR.access=memorymapped +AT91C_CAN_MB0_MMR.address=0xFFFD0200 +AT91C_CAN_MB0_MMR.width=32 +AT91C_CAN_MB0_MMR.byteEndian=little +# ========== Register definition for CAN_MB1 peripheral ========== +AT91C_CAN_MB1_MDL.name="AT91C_CAN_MB1_MDL" +AT91C_CAN_MB1_MDL.description="MailBox Data Low Register" +AT91C_CAN_MB1_MDL.helpkey="MailBox Data Low Register" +AT91C_CAN_MB1_MDL.access=memorymapped +AT91C_CAN_MB1_MDL.address=0xFFFD0234 +AT91C_CAN_MB1_MDL.width=32 +AT91C_CAN_MB1_MDL.byteEndian=little +AT91C_CAN_MB1_MID.name="AT91C_CAN_MB1_MID" +AT91C_CAN_MB1_MID.description="MailBox ID Register" +AT91C_CAN_MB1_MID.helpkey="MailBox ID Register" +AT91C_CAN_MB1_MID.access=memorymapped +AT91C_CAN_MB1_MID.address=0xFFFD0228 +AT91C_CAN_MB1_MID.width=32 +AT91C_CAN_MB1_MID.byteEndian=little +AT91C_CAN_MB1_MMR.name="AT91C_CAN_MB1_MMR" +AT91C_CAN_MB1_MMR.description="MailBox Mode Register" +AT91C_CAN_MB1_MMR.helpkey="MailBox Mode Register" +AT91C_CAN_MB1_MMR.access=memorymapped +AT91C_CAN_MB1_MMR.address=0xFFFD0220 +AT91C_CAN_MB1_MMR.width=32 +AT91C_CAN_MB1_MMR.byteEndian=little +AT91C_CAN_MB1_MSR.name="AT91C_CAN_MB1_MSR" +AT91C_CAN_MB1_MSR.description="MailBox Status Register" +AT91C_CAN_MB1_MSR.helpkey="MailBox Status Register" +AT91C_CAN_MB1_MSR.access=memorymapped +AT91C_CAN_MB1_MSR.address=0xFFFD0230 +AT91C_CAN_MB1_MSR.width=32 +AT91C_CAN_MB1_MSR.byteEndian=little +AT91C_CAN_MB1_MSR.permission.write=none +AT91C_CAN_MB1_MAM.name="AT91C_CAN_MB1_MAM" +AT91C_CAN_MB1_MAM.description="MailBox Acceptance Mask Register" +AT91C_CAN_MB1_MAM.helpkey="MailBox Acceptance Mask Register" +AT91C_CAN_MB1_MAM.access=memorymapped +AT91C_CAN_MB1_MAM.address=0xFFFD0224 +AT91C_CAN_MB1_MAM.width=32 +AT91C_CAN_MB1_MAM.byteEndian=little +AT91C_CAN_MB1_MDH.name="AT91C_CAN_MB1_MDH" +AT91C_CAN_MB1_MDH.description="MailBox Data High Register" +AT91C_CAN_MB1_MDH.helpkey="MailBox Data High Register" +AT91C_CAN_MB1_MDH.access=memorymapped +AT91C_CAN_MB1_MDH.address=0xFFFD0238 +AT91C_CAN_MB1_MDH.width=32 +AT91C_CAN_MB1_MDH.byteEndian=little +AT91C_CAN_MB1_MCR.name="AT91C_CAN_MB1_MCR" +AT91C_CAN_MB1_MCR.description="MailBox Control Register" +AT91C_CAN_MB1_MCR.helpkey="MailBox Control Register" +AT91C_CAN_MB1_MCR.access=memorymapped +AT91C_CAN_MB1_MCR.address=0xFFFD023C +AT91C_CAN_MB1_MCR.width=32 +AT91C_CAN_MB1_MCR.byteEndian=little +AT91C_CAN_MB1_MCR.type=enum +AT91C_CAN_MB1_MCR.enum.0.name=*** Write only *** +AT91C_CAN_MB1_MCR.enum.1.name=Error +AT91C_CAN_MB1_MFID.name="AT91C_CAN_MB1_MFID" +AT91C_CAN_MB1_MFID.description="MailBox Family ID Register" +AT91C_CAN_MB1_MFID.helpkey="MailBox Family ID Register" +AT91C_CAN_MB1_MFID.access=memorymapped +AT91C_CAN_MB1_MFID.address=0xFFFD022C +AT91C_CAN_MB1_MFID.width=32 +AT91C_CAN_MB1_MFID.byteEndian=little +AT91C_CAN_MB1_MFID.permission.write=none +# ========== Register definition for CAN_MB2 peripheral ========== +AT91C_CAN_MB2_MCR.name="AT91C_CAN_MB2_MCR" +AT91C_CAN_MB2_MCR.description="MailBox Control Register" +AT91C_CAN_MB2_MCR.helpkey="MailBox Control Register" +AT91C_CAN_MB2_MCR.access=memorymapped +AT91C_CAN_MB2_MCR.address=0xFFFD025C +AT91C_CAN_MB2_MCR.width=32 +AT91C_CAN_MB2_MCR.byteEndian=little +AT91C_CAN_MB2_MCR.type=enum +AT91C_CAN_MB2_MCR.enum.0.name=*** Write only *** +AT91C_CAN_MB2_MCR.enum.1.name=Error +AT91C_CAN_MB2_MDH.name="AT91C_CAN_MB2_MDH" +AT91C_CAN_MB2_MDH.description="MailBox Data High Register" +AT91C_CAN_MB2_MDH.helpkey="MailBox Data High Register" +AT91C_CAN_MB2_MDH.access=memorymapped +AT91C_CAN_MB2_MDH.address=0xFFFD0258 +AT91C_CAN_MB2_MDH.width=32 +AT91C_CAN_MB2_MDH.byteEndian=little +AT91C_CAN_MB2_MID.name="AT91C_CAN_MB2_MID" +AT91C_CAN_MB2_MID.description="MailBox ID Register" +AT91C_CAN_MB2_MID.helpkey="MailBox ID Register" +AT91C_CAN_MB2_MID.access=memorymapped +AT91C_CAN_MB2_MID.address=0xFFFD0248 +AT91C_CAN_MB2_MID.width=32 +AT91C_CAN_MB2_MID.byteEndian=little +AT91C_CAN_MB2_MDL.name="AT91C_CAN_MB2_MDL" +AT91C_CAN_MB2_MDL.description="MailBox Data Low Register" +AT91C_CAN_MB2_MDL.helpkey="MailBox Data Low Register" +AT91C_CAN_MB2_MDL.access=memorymapped +AT91C_CAN_MB2_MDL.address=0xFFFD0254 +AT91C_CAN_MB2_MDL.width=32 +AT91C_CAN_MB2_MDL.byteEndian=little +AT91C_CAN_MB2_MMR.name="AT91C_CAN_MB2_MMR" +AT91C_CAN_MB2_MMR.description="MailBox Mode Register" +AT91C_CAN_MB2_MMR.helpkey="MailBox Mode Register" +AT91C_CAN_MB2_MMR.access=memorymapped +AT91C_CAN_MB2_MMR.address=0xFFFD0240 +AT91C_CAN_MB2_MMR.width=32 +AT91C_CAN_MB2_MMR.byteEndian=little +AT91C_CAN_MB2_MAM.name="AT91C_CAN_MB2_MAM" +AT91C_CAN_MB2_MAM.description="MailBox Acceptance Mask Register" +AT91C_CAN_MB2_MAM.helpkey="MailBox Acceptance Mask Register" +AT91C_CAN_MB2_MAM.access=memorymapped +AT91C_CAN_MB2_MAM.address=0xFFFD0244 +AT91C_CAN_MB2_MAM.width=32 +AT91C_CAN_MB2_MAM.byteEndian=little +AT91C_CAN_MB2_MFID.name="AT91C_CAN_MB2_MFID" +AT91C_CAN_MB2_MFID.description="MailBox Family ID Register" +AT91C_CAN_MB2_MFID.helpkey="MailBox Family ID Register" +AT91C_CAN_MB2_MFID.access=memorymapped +AT91C_CAN_MB2_MFID.address=0xFFFD024C +AT91C_CAN_MB2_MFID.width=32 +AT91C_CAN_MB2_MFID.byteEndian=little +AT91C_CAN_MB2_MFID.permission.write=none +AT91C_CAN_MB2_MSR.name="AT91C_CAN_MB2_MSR" +AT91C_CAN_MB2_MSR.description="MailBox Status Register" +AT91C_CAN_MB2_MSR.helpkey="MailBox Status Register" +AT91C_CAN_MB2_MSR.access=memorymapped +AT91C_CAN_MB2_MSR.address=0xFFFD0250 +AT91C_CAN_MB2_MSR.width=32 +AT91C_CAN_MB2_MSR.byteEndian=little +AT91C_CAN_MB2_MSR.permission.write=none +# ========== Register definition for CAN_MB3 peripheral ========== +AT91C_CAN_MB3_MFID.name="AT91C_CAN_MB3_MFID" +AT91C_CAN_MB3_MFID.description="MailBox Family ID Register" +AT91C_CAN_MB3_MFID.helpkey="MailBox Family ID Register" +AT91C_CAN_MB3_MFID.access=memorymapped +AT91C_CAN_MB3_MFID.address=0xFFFD026C +AT91C_CAN_MB3_MFID.width=32 +AT91C_CAN_MB3_MFID.byteEndian=little +AT91C_CAN_MB3_MFID.permission.write=none +AT91C_CAN_MB3_MAM.name="AT91C_CAN_MB3_MAM" +AT91C_CAN_MB3_MAM.description="MailBox Acceptance Mask Register" +AT91C_CAN_MB3_MAM.helpkey="MailBox Acceptance Mask Register" +AT91C_CAN_MB3_MAM.access=memorymapped +AT91C_CAN_MB3_MAM.address=0xFFFD0264 +AT91C_CAN_MB3_MAM.width=32 +AT91C_CAN_MB3_MAM.byteEndian=little +AT91C_CAN_MB3_MID.name="AT91C_CAN_MB3_MID" +AT91C_CAN_MB3_MID.description="MailBox ID Register" +AT91C_CAN_MB3_MID.helpkey="MailBox ID Register" +AT91C_CAN_MB3_MID.access=memorymapped +AT91C_CAN_MB3_MID.address=0xFFFD0268 +AT91C_CAN_MB3_MID.width=32 +AT91C_CAN_MB3_MID.byteEndian=little +AT91C_CAN_MB3_MCR.name="AT91C_CAN_MB3_MCR" +AT91C_CAN_MB3_MCR.description="MailBox Control Register" +AT91C_CAN_MB3_MCR.helpkey="MailBox Control Register" +AT91C_CAN_MB3_MCR.access=memorymapped +AT91C_CAN_MB3_MCR.address=0xFFFD027C +AT91C_CAN_MB3_MCR.width=32 +AT91C_CAN_MB3_MCR.byteEndian=little +AT91C_CAN_MB3_MCR.type=enum +AT91C_CAN_MB3_MCR.enum.0.name=*** Write only *** +AT91C_CAN_MB3_MCR.enum.1.name=Error +AT91C_CAN_MB3_MMR.name="AT91C_CAN_MB3_MMR" +AT91C_CAN_MB3_MMR.description="MailBox Mode Register" +AT91C_CAN_MB3_MMR.helpkey="MailBox Mode Register" +AT91C_CAN_MB3_MMR.access=memorymapped +AT91C_CAN_MB3_MMR.address=0xFFFD0260 +AT91C_CAN_MB3_MMR.width=32 +AT91C_CAN_MB3_MMR.byteEndian=little +AT91C_CAN_MB3_MSR.name="AT91C_CAN_MB3_MSR" +AT91C_CAN_MB3_MSR.description="MailBox Status Register" +AT91C_CAN_MB3_MSR.helpkey="MailBox Status Register" +AT91C_CAN_MB3_MSR.access=memorymapped +AT91C_CAN_MB3_MSR.address=0xFFFD0270 +AT91C_CAN_MB3_MSR.width=32 +AT91C_CAN_MB3_MSR.byteEndian=little +AT91C_CAN_MB3_MSR.permission.write=none +AT91C_CAN_MB3_MDL.name="AT91C_CAN_MB3_MDL" +AT91C_CAN_MB3_MDL.description="MailBox Data Low Register" +AT91C_CAN_MB3_MDL.helpkey="MailBox Data Low Register" +AT91C_CAN_MB3_MDL.access=memorymapped +AT91C_CAN_MB3_MDL.address=0xFFFD0274 +AT91C_CAN_MB3_MDL.width=32 +AT91C_CAN_MB3_MDL.byteEndian=little +AT91C_CAN_MB3_MDH.name="AT91C_CAN_MB3_MDH" +AT91C_CAN_MB3_MDH.description="MailBox Data High Register" +AT91C_CAN_MB3_MDH.helpkey="MailBox Data High Register" +AT91C_CAN_MB3_MDH.access=memorymapped +AT91C_CAN_MB3_MDH.address=0xFFFD0278 +AT91C_CAN_MB3_MDH.width=32 +AT91C_CAN_MB3_MDH.byteEndian=little +# ========== Register definition for CAN_MB4 peripheral ========== +AT91C_CAN_MB4_MID.name="AT91C_CAN_MB4_MID" +AT91C_CAN_MB4_MID.description="MailBox ID Register" +AT91C_CAN_MB4_MID.helpkey="MailBox ID Register" +AT91C_CAN_MB4_MID.access=memorymapped +AT91C_CAN_MB4_MID.address=0xFFFD0288 +AT91C_CAN_MB4_MID.width=32 +AT91C_CAN_MB4_MID.byteEndian=little +AT91C_CAN_MB4_MMR.name="AT91C_CAN_MB4_MMR" +AT91C_CAN_MB4_MMR.description="MailBox Mode Register" +AT91C_CAN_MB4_MMR.helpkey="MailBox Mode Register" +AT91C_CAN_MB4_MMR.access=memorymapped +AT91C_CAN_MB4_MMR.address=0xFFFD0280 +AT91C_CAN_MB4_MMR.width=32 +AT91C_CAN_MB4_MMR.byteEndian=little +AT91C_CAN_MB4_MDH.name="AT91C_CAN_MB4_MDH" +AT91C_CAN_MB4_MDH.description="MailBox Data High Register" +AT91C_CAN_MB4_MDH.helpkey="MailBox Data High Register" +AT91C_CAN_MB4_MDH.access=memorymapped +AT91C_CAN_MB4_MDH.address=0xFFFD0298 +AT91C_CAN_MB4_MDH.width=32 +AT91C_CAN_MB4_MDH.byteEndian=little +AT91C_CAN_MB4_MFID.name="AT91C_CAN_MB4_MFID" +AT91C_CAN_MB4_MFID.description="MailBox Family ID Register" +AT91C_CAN_MB4_MFID.helpkey="MailBox Family ID Register" +AT91C_CAN_MB4_MFID.access=memorymapped +AT91C_CAN_MB4_MFID.address=0xFFFD028C +AT91C_CAN_MB4_MFID.width=32 +AT91C_CAN_MB4_MFID.byteEndian=little +AT91C_CAN_MB4_MFID.permission.write=none +AT91C_CAN_MB4_MSR.name="AT91C_CAN_MB4_MSR" +AT91C_CAN_MB4_MSR.description="MailBox Status Register" +AT91C_CAN_MB4_MSR.helpkey="MailBox Status Register" +AT91C_CAN_MB4_MSR.access=memorymapped +AT91C_CAN_MB4_MSR.address=0xFFFD0290 +AT91C_CAN_MB4_MSR.width=32 +AT91C_CAN_MB4_MSR.byteEndian=little +AT91C_CAN_MB4_MSR.permission.write=none +AT91C_CAN_MB4_MCR.name="AT91C_CAN_MB4_MCR" +AT91C_CAN_MB4_MCR.description="MailBox Control Register" +AT91C_CAN_MB4_MCR.helpkey="MailBox Control Register" +AT91C_CAN_MB4_MCR.access=memorymapped +AT91C_CAN_MB4_MCR.address=0xFFFD029C +AT91C_CAN_MB4_MCR.width=32 +AT91C_CAN_MB4_MCR.byteEndian=little +AT91C_CAN_MB4_MCR.type=enum +AT91C_CAN_MB4_MCR.enum.0.name=*** Write only *** +AT91C_CAN_MB4_MCR.enum.1.name=Error +AT91C_CAN_MB4_MDL.name="AT91C_CAN_MB4_MDL" +AT91C_CAN_MB4_MDL.description="MailBox Data Low Register" +AT91C_CAN_MB4_MDL.helpkey="MailBox Data Low Register" +AT91C_CAN_MB4_MDL.access=memorymapped +AT91C_CAN_MB4_MDL.address=0xFFFD0294 +AT91C_CAN_MB4_MDL.width=32 +AT91C_CAN_MB4_MDL.byteEndian=little +AT91C_CAN_MB4_MAM.name="AT91C_CAN_MB4_MAM" +AT91C_CAN_MB4_MAM.description="MailBox Acceptance Mask Register" +AT91C_CAN_MB4_MAM.helpkey="MailBox Acceptance Mask Register" +AT91C_CAN_MB4_MAM.access=memorymapped +AT91C_CAN_MB4_MAM.address=0xFFFD0284 +AT91C_CAN_MB4_MAM.width=32 +AT91C_CAN_MB4_MAM.byteEndian=little +# ========== Register definition for CAN_MB5 peripheral ========== +AT91C_CAN_MB5_MSR.name="AT91C_CAN_MB5_MSR" +AT91C_CAN_MB5_MSR.description="MailBox Status Register" +AT91C_CAN_MB5_MSR.helpkey="MailBox Status Register" +AT91C_CAN_MB5_MSR.access=memorymapped +AT91C_CAN_MB5_MSR.address=0xFFFD02B0 +AT91C_CAN_MB5_MSR.width=32 +AT91C_CAN_MB5_MSR.byteEndian=little +AT91C_CAN_MB5_MSR.permission.write=none +AT91C_CAN_MB5_MCR.name="AT91C_CAN_MB5_MCR" +AT91C_CAN_MB5_MCR.description="MailBox Control Register" +AT91C_CAN_MB5_MCR.helpkey="MailBox Control Register" +AT91C_CAN_MB5_MCR.access=memorymapped +AT91C_CAN_MB5_MCR.address=0xFFFD02BC +AT91C_CAN_MB5_MCR.width=32 +AT91C_CAN_MB5_MCR.byteEndian=little +AT91C_CAN_MB5_MCR.type=enum +AT91C_CAN_MB5_MCR.enum.0.name=*** Write only *** +AT91C_CAN_MB5_MCR.enum.1.name=Error +AT91C_CAN_MB5_MFID.name="AT91C_CAN_MB5_MFID" +AT91C_CAN_MB5_MFID.description="MailBox Family ID Register" +AT91C_CAN_MB5_MFID.helpkey="MailBox Family ID Register" +AT91C_CAN_MB5_MFID.access=memorymapped +AT91C_CAN_MB5_MFID.address=0xFFFD02AC +AT91C_CAN_MB5_MFID.width=32 +AT91C_CAN_MB5_MFID.byteEndian=little +AT91C_CAN_MB5_MFID.permission.write=none +AT91C_CAN_MB5_MDH.name="AT91C_CAN_MB5_MDH" +AT91C_CAN_MB5_MDH.description="MailBox Data High Register" +AT91C_CAN_MB5_MDH.helpkey="MailBox Data High Register" +AT91C_CAN_MB5_MDH.access=memorymapped +AT91C_CAN_MB5_MDH.address=0xFFFD02B8 +AT91C_CAN_MB5_MDH.width=32 +AT91C_CAN_MB5_MDH.byteEndian=little +AT91C_CAN_MB5_MID.name="AT91C_CAN_MB5_MID" +AT91C_CAN_MB5_MID.description="MailBox ID Register" +AT91C_CAN_MB5_MID.helpkey="MailBox ID Register" +AT91C_CAN_MB5_MID.access=memorymapped +AT91C_CAN_MB5_MID.address=0xFFFD02A8 +AT91C_CAN_MB5_MID.width=32 +AT91C_CAN_MB5_MID.byteEndian=little +AT91C_CAN_MB5_MMR.name="AT91C_CAN_MB5_MMR" +AT91C_CAN_MB5_MMR.description="MailBox Mode Register" +AT91C_CAN_MB5_MMR.helpkey="MailBox Mode Register" +AT91C_CAN_MB5_MMR.access=memorymapped +AT91C_CAN_MB5_MMR.address=0xFFFD02A0 +AT91C_CAN_MB5_MMR.width=32 +AT91C_CAN_MB5_MMR.byteEndian=little +AT91C_CAN_MB5_MDL.name="AT91C_CAN_MB5_MDL" +AT91C_CAN_MB5_MDL.description="MailBox Data Low Register" +AT91C_CAN_MB5_MDL.helpkey="MailBox Data Low Register" +AT91C_CAN_MB5_MDL.access=memorymapped +AT91C_CAN_MB5_MDL.address=0xFFFD02B4 +AT91C_CAN_MB5_MDL.width=32 +AT91C_CAN_MB5_MDL.byteEndian=little +AT91C_CAN_MB5_MAM.name="AT91C_CAN_MB5_MAM" +AT91C_CAN_MB5_MAM.description="MailBox Acceptance Mask Register" +AT91C_CAN_MB5_MAM.helpkey="MailBox Acceptance Mask Register" +AT91C_CAN_MB5_MAM.access=memorymapped +AT91C_CAN_MB5_MAM.address=0xFFFD02A4 +AT91C_CAN_MB5_MAM.width=32 +AT91C_CAN_MB5_MAM.byteEndian=little +# ========== Register definition for CAN_MB6 peripheral ========== +AT91C_CAN_MB6_MFID.name="AT91C_CAN_MB6_MFID" +AT91C_CAN_MB6_MFID.description="MailBox Family ID Register" +AT91C_CAN_MB6_MFID.helpkey="MailBox Family ID Register" +AT91C_CAN_MB6_MFID.access=memorymapped +AT91C_CAN_MB6_MFID.address=0xFFFD02CC +AT91C_CAN_MB6_MFID.width=32 +AT91C_CAN_MB6_MFID.byteEndian=little +AT91C_CAN_MB6_MFID.permission.write=none +AT91C_CAN_MB6_MID.name="AT91C_CAN_MB6_MID" +AT91C_CAN_MB6_MID.description="MailBox ID Register" +AT91C_CAN_MB6_MID.helpkey="MailBox ID Register" +AT91C_CAN_MB6_MID.access=memorymapped +AT91C_CAN_MB6_MID.address=0xFFFD02C8 +AT91C_CAN_MB6_MID.width=32 +AT91C_CAN_MB6_MID.byteEndian=little +AT91C_CAN_MB6_MAM.name="AT91C_CAN_MB6_MAM" +AT91C_CAN_MB6_MAM.description="MailBox Acceptance Mask Register" +AT91C_CAN_MB6_MAM.helpkey="MailBox Acceptance Mask Register" +AT91C_CAN_MB6_MAM.access=memorymapped +AT91C_CAN_MB6_MAM.address=0xFFFD02C4 +AT91C_CAN_MB6_MAM.width=32 +AT91C_CAN_MB6_MAM.byteEndian=little +AT91C_CAN_MB6_MSR.name="AT91C_CAN_MB6_MSR" +AT91C_CAN_MB6_MSR.description="MailBox Status Register" +AT91C_CAN_MB6_MSR.helpkey="MailBox Status Register" +AT91C_CAN_MB6_MSR.access=memorymapped +AT91C_CAN_MB6_MSR.address=0xFFFD02D0 +AT91C_CAN_MB6_MSR.width=32 +AT91C_CAN_MB6_MSR.byteEndian=little +AT91C_CAN_MB6_MSR.permission.write=none +AT91C_CAN_MB6_MDL.name="AT91C_CAN_MB6_MDL" +AT91C_CAN_MB6_MDL.description="MailBox Data Low Register" +AT91C_CAN_MB6_MDL.helpkey="MailBox Data Low Register" +AT91C_CAN_MB6_MDL.access=memorymapped +AT91C_CAN_MB6_MDL.address=0xFFFD02D4 +AT91C_CAN_MB6_MDL.width=32 +AT91C_CAN_MB6_MDL.byteEndian=little +AT91C_CAN_MB6_MCR.name="AT91C_CAN_MB6_MCR" +AT91C_CAN_MB6_MCR.description="MailBox Control Register" +AT91C_CAN_MB6_MCR.helpkey="MailBox Control Register" +AT91C_CAN_MB6_MCR.access=memorymapped +AT91C_CAN_MB6_MCR.address=0xFFFD02DC +AT91C_CAN_MB6_MCR.width=32 +AT91C_CAN_MB6_MCR.byteEndian=little +AT91C_CAN_MB6_MCR.type=enum +AT91C_CAN_MB6_MCR.enum.0.name=*** Write only *** +AT91C_CAN_MB6_MCR.enum.1.name=Error +AT91C_CAN_MB6_MDH.name="AT91C_CAN_MB6_MDH" +AT91C_CAN_MB6_MDH.description="MailBox Data High Register" +AT91C_CAN_MB6_MDH.helpkey="MailBox Data High Register" +AT91C_CAN_MB6_MDH.access=memorymapped +AT91C_CAN_MB6_MDH.address=0xFFFD02D8 +AT91C_CAN_MB6_MDH.width=32 +AT91C_CAN_MB6_MDH.byteEndian=little +AT91C_CAN_MB6_MMR.name="AT91C_CAN_MB6_MMR" +AT91C_CAN_MB6_MMR.description="MailBox Mode Register" +AT91C_CAN_MB6_MMR.helpkey="MailBox Mode Register" +AT91C_CAN_MB6_MMR.access=memorymapped +AT91C_CAN_MB6_MMR.address=0xFFFD02C0 +AT91C_CAN_MB6_MMR.width=32 +AT91C_CAN_MB6_MMR.byteEndian=little +# ========== Register definition for CAN_MB7 peripheral ========== +AT91C_CAN_MB7_MCR.name="AT91C_CAN_MB7_MCR" +AT91C_CAN_MB7_MCR.description="MailBox Control Register" +AT91C_CAN_MB7_MCR.helpkey="MailBox Control Register" +AT91C_CAN_MB7_MCR.access=memorymapped +AT91C_CAN_MB7_MCR.address=0xFFFD02FC +AT91C_CAN_MB7_MCR.width=32 +AT91C_CAN_MB7_MCR.byteEndian=little +AT91C_CAN_MB7_MCR.type=enum +AT91C_CAN_MB7_MCR.enum.0.name=*** Write only *** +AT91C_CAN_MB7_MCR.enum.1.name=Error +AT91C_CAN_MB7_MDH.name="AT91C_CAN_MB7_MDH" +AT91C_CAN_MB7_MDH.description="MailBox Data High Register" +AT91C_CAN_MB7_MDH.helpkey="MailBox Data High Register" +AT91C_CAN_MB7_MDH.access=memorymapped +AT91C_CAN_MB7_MDH.address=0xFFFD02F8 +AT91C_CAN_MB7_MDH.width=32 +AT91C_CAN_MB7_MDH.byteEndian=little +AT91C_CAN_MB7_MFID.name="AT91C_CAN_MB7_MFID" +AT91C_CAN_MB7_MFID.description="MailBox Family ID Register" +AT91C_CAN_MB7_MFID.helpkey="MailBox Family ID Register" +AT91C_CAN_MB7_MFID.access=memorymapped +AT91C_CAN_MB7_MFID.address=0xFFFD02EC +AT91C_CAN_MB7_MFID.width=32 +AT91C_CAN_MB7_MFID.byteEndian=little +AT91C_CAN_MB7_MFID.permission.write=none +AT91C_CAN_MB7_MDL.name="AT91C_CAN_MB7_MDL" +AT91C_CAN_MB7_MDL.description="MailBox Data Low Register" +AT91C_CAN_MB7_MDL.helpkey="MailBox Data Low Register" +AT91C_CAN_MB7_MDL.access=memorymapped +AT91C_CAN_MB7_MDL.address=0xFFFD02F4 +AT91C_CAN_MB7_MDL.width=32 +AT91C_CAN_MB7_MDL.byteEndian=little +AT91C_CAN_MB7_MID.name="AT91C_CAN_MB7_MID" +AT91C_CAN_MB7_MID.description="MailBox ID Register" +AT91C_CAN_MB7_MID.helpkey="MailBox ID Register" +AT91C_CAN_MB7_MID.access=memorymapped +AT91C_CAN_MB7_MID.address=0xFFFD02E8 +AT91C_CAN_MB7_MID.width=32 +AT91C_CAN_MB7_MID.byteEndian=little +AT91C_CAN_MB7_MMR.name="AT91C_CAN_MB7_MMR" +AT91C_CAN_MB7_MMR.description="MailBox Mode Register" +AT91C_CAN_MB7_MMR.helpkey="MailBox Mode Register" +AT91C_CAN_MB7_MMR.access=memorymapped +AT91C_CAN_MB7_MMR.address=0xFFFD02E0 +AT91C_CAN_MB7_MMR.width=32 +AT91C_CAN_MB7_MMR.byteEndian=little +AT91C_CAN_MB7_MAM.name="AT91C_CAN_MB7_MAM" +AT91C_CAN_MB7_MAM.description="MailBox Acceptance Mask Register" +AT91C_CAN_MB7_MAM.helpkey="MailBox Acceptance Mask Register" +AT91C_CAN_MB7_MAM.access=memorymapped +AT91C_CAN_MB7_MAM.address=0xFFFD02E4 +AT91C_CAN_MB7_MAM.width=32 +AT91C_CAN_MB7_MAM.byteEndian=little +AT91C_CAN_MB7_MSR.name="AT91C_CAN_MB7_MSR" +AT91C_CAN_MB7_MSR.description="MailBox Status Register" +AT91C_CAN_MB7_MSR.helpkey="MailBox Status Register" +AT91C_CAN_MB7_MSR.access=memorymapped +AT91C_CAN_MB7_MSR.address=0xFFFD02F0 +AT91C_CAN_MB7_MSR.width=32 +AT91C_CAN_MB7_MSR.byteEndian=little +AT91C_CAN_MB7_MSR.permission.write=none +# ========== Register definition for CAN peripheral ========== +AT91C_CAN_TCR.name="AT91C_CAN_TCR" +AT91C_CAN_TCR.description="Transfer Command Register" +AT91C_CAN_TCR.helpkey="Transfer Command Register" +AT91C_CAN_TCR.access=memorymapped +AT91C_CAN_TCR.address=0xFFFD0024 +AT91C_CAN_TCR.width=32 +AT91C_CAN_TCR.byteEndian=little +AT91C_CAN_TCR.type=enum +AT91C_CAN_TCR.enum.0.name=*** Write only *** +AT91C_CAN_TCR.enum.1.name=Error +AT91C_CAN_IMR.name="AT91C_CAN_IMR" +AT91C_CAN_IMR.description="Interrupt Mask Register" +AT91C_CAN_IMR.helpkey="Interrupt Mask Register" +AT91C_CAN_IMR.access=memorymapped +AT91C_CAN_IMR.address=0xFFFD000C +AT91C_CAN_IMR.width=32 +AT91C_CAN_IMR.byteEndian=little +AT91C_CAN_IMR.permission.write=none +AT91C_CAN_IER.name="AT91C_CAN_IER" +AT91C_CAN_IER.description="Interrupt Enable Register" +AT91C_CAN_IER.helpkey="Interrupt Enable Register" +AT91C_CAN_IER.access=memorymapped +AT91C_CAN_IER.address=0xFFFD0004 +AT91C_CAN_IER.width=32 +AT91C_CAN_IER.byteEndian=little +AT91C_CAN_IER.type=enum +AT91C_CAN_IER.enum.0.name=*** Write only *** +AT91C_CAN_IER.enum.1.name=Error +AT91C_CAN_ECR.name="AT91C_CAN_ECR" +AT91C_CAN_ECR.description="Error Counter Register" +AT91C_CAN_ECR.helpkey="Error Counter Register" +AT91C_CAN_ECR.access=memorymapped +AT91C_CAN_ECR.address=0xFFFD0020 +AT91C_CAN_ECR.width=32 +AT91C_CAN_ECR.byteEndian=little +AT91C_CAN_ECR.permission.write=none +AT91C_CAN_TIMESTP.name="AT91C_CAN_TIMESTP" +AT91C_CAN_TIMESTP.description="Time Stamp Register" +AT91C_CAN_TIMESTP.helpkey="Time Stamp Register" +AT91C_CAN_TIMESTP.access=memorymapped +AT91C_CAN_TIMESTP.address=0xFFFD001C +AT91C_CAN_TIMESTP.width=32 +AT91C_CAN_TIMESTP.byteEndian=little +AT91C_CAN_TIMESTP.permission.write=none +AT91C_CAN_MR.name="AT91C_CAN_MR" +AT91C_CAN_MR.description="Mode Register" +AT91C_CAN_MR.helpkey="Mode Register" +AT91C_CAN_MR.access=memorymapped +AT91C_CAN_MR.address=0xFFFD0000 +AT91C_CAN_MR.width=32 +AT91C_CAN_MR.byteEndian=little +AT91C_CAN_IDR.name="AT91C_CAN_IDR" +AT91C_CAN_IDR.description="Interrupt Disable Register" +AT91C_CAN_IDR.helpkey="Interrupt Disable Register" +AT91C_CAN_IDR.access=memorymapped +AT91C_CAN_IDR.address=0xFFFD0008 +AT91C_CAN_IDR.width=32 +AT91C_CAN_IDR.byteEndian=little +AT91C_CAN_IDR.type=enum +AT91C_CAN_IDR.enum.0.name=*** Write only *** +AT91C_CAN_IDR.enum.1.name=Error +AT91C_CAN_ACR.name="AT91C_CAN_ACR" +AT91C_CAN_ACR.description="Abort Command Register" +AT91C_CAN_ACR.helpkey="Abort Command Register" +AT91C_CAN_ACR.access=memorymapped +AT91C_CAN_ACR.address=0xFFFD0028 +AT91C_CAN_ACR.width=32 +AT91C_CAN_ACR.byteEndian=little +AT91C_CAN_ACR.type=enum +AT91C_CAN_ACR.enum.0.name=*** Write only *** +AT91C_CAN_ACR.enum.1.name=Error +AT91C_CAN_TIM.name="AT91C_CAN_TIM" +AT91C_CAN_TIM.description="Timer Register" +AT91C_CAN_TIM.helpkey="Timer Register" +AT91C_CAN_TIM.access=memorymapped +AT91C_CAN_TIM.address=0xFFFD0018 +AT91C_CAN_TIM.width=32 +AT91C_CAN_TIM.byteEndian=little +AT91C_CAN_TIM.permission.write=none +AT91C_CAN_SR.name="AT91C_CAN_SR" +AT91C_CAN_SR.description="Status Register" +AT91C_CAN_SR.helpkey="Status Register" +AT91C_CAN_SR.access=memorymapped +AT91C_CAN_SR.address=0xFFFD0010 +AT91C_CAN_SR.width=32 +AT91C_CAN_SR.byteEndian=little +AT91C_CAN_SR.permission.write=none +AT91C_CAN_BR.name="AT91C_CAN_BR" +AT91C_CAN_BR.description="Baudrate Register" +AT91C_CAN_BR.helpkey="Baudrate Register" +AT91C_CAN_BR.access=memorymapped +AT91C_CAN_BR.address=0xFFFD0014 +AT91C_CAN_BR.width=32 +AT91C_CAN_BR.byteEndian=little +AT91C_CAN_VR.name="AT91C_CAN_VR" +AT91C_CAN_VR.description="Version Register" +AT91C_CAN_VR.helpkey="Version Register" +AT91C_CAN_VR.access=memorymapped +AT91C_CAN_VR.address=0xFFFD00FC +AT91C_CAN_VR.width=32 +AT91C_CAN_VR.byteEndian=little +AT91C_CAN_VR.permission.write=none +# ========== Register definition for EMAC peripheral ========== +AT91C_EMAC_ISR.name="AT91C_EMAC_ISR" +AT91C_EMAC_ISR.description="Interrupt Status Register" +AT91C_EMAC_ISR.helpkey="Interrupt Status Register" +AT91C_EMAC_ISR.access=memorymapped +AT91C_EMAC_ISR.address=0xFFFDC024 +AT91C_EMAC_ISR.width=32 +AT91C_EMAC_ISR.byteEndian=little +AT91C_EMAC_SA4H.name="AT91C_EMAC_SA4H" +AT91C_EMAC_SA4H.description="Specific Address 4 Top, Last 2 bytes" +AT91C_EMAC_SA4H.helpkey="Specific Address 4 Top, Last 2 bytes" +AT91C_EMAC_SA4H.access=memorymapped +AT91C_EMAC_SA4H.address=0xFFFDC0B4 +AT91C_EMAC_SA4H.width=32 +AT91C_EMAC_SA4H.byteEndian=little +AT91C_EMAC_SA1L.name="AT91C_EMAC_SA1L" +AT91C_EMAC_SA1L.description="Specific Address 1 Bottom, First 4 bytes" +AT91C_EMAC_SA1L.helpkey="Specific Address 1 Bottom, First 4 bytes" +AT91C_EMAC_SA1L.access=memorymapped +AT91C_EMAC_SA1L.address=0xFFFDC098 +AT91C_EMAC_SA1L.width=32 +AT91C_EMAC_SA1L.byteEndian=little +AT91C_EMAC_ELE.name="AT91C_EMAC_ELE" +AT91C_EMAC_ELE.description="Excessive Length Errors Register" +AT91C_EMAC_ELE.helpkey="Excessive Length Errors Register" +AT91C_EMAC_ELE.access=memorymapped +AT91C_EMAC_ELE.address=0xFFFDC078 +AT91C_EMAC_ELE.width=32 +AT91C_EMAC_ELE.byteEndian=little +AT91C_EMAC_LCOL.name="AT91C_EMAC_LCOL" +AT91C_EMAC_LCOL.description="Late Collision Register" +AT91C_EMAC_LCOL.helpkey="Late Collision Register" +AT91C_EMAC_LCOL.access=memorymapped +AT91C_EMAC_LCOL.address=0xFFFDC05C +AT91C_EMAC_LCOL.width=32 +AT91C_EMAC_LCOL.byteEndian=little +AT91C_EMAC_RLE.name="AT91C_EMAC_RLE" +AT91C_EMAC_RLE.description="Receive Length Field Mismatch Register" +AT91C_EMAC_RLE.helpkey="Receive Length Field Mismatch Register" +AT91C_EMAC_RLE.access=memorymapped +AT91C_EMAC_RLE.address=0xFFFDC088 +AT91C_EMAC_RLE.width=32 +AT91C_EMAC_RLE.byteEndian=little +AT91C_EMAC_WOL.name="AT91C_EMAC_WOL" +AT91C_EMAC_WOL.description="Wake On LAN Register" +AT91C_EMAC_WOL.helpkey="Wake On LAN Register" +AT91C_EMAC_WOL.access=memorymapped +AT91C_EMAC_WOL.address=0xFFFDC0C4 +AT91C_EMAC_WOL.width=32 +AT91C_EMAC_WOL.byteEndian=little +AT91C_EMAC_DTF.name="AT91C_EMAC_DTF" +AT91C_EMAC_DTF.description="Deferred Transmission Frame Register" +AT91C_EMAC_DTF.helpkey="Deferred Transmission Frame Register" +AT91C_EMAC_DTF.access=memorymapped +AT91C_EMAC_DTF.address=0xFFFDC058 +AT91C_EMAC_DTF.width=32 +AT91C_EMAC_DTF.byteEndian=little +AT91C_EMAC_TUND.name="AT91C_EMAC_TUND" +AT91C_EMAC_TUND.description="Transmit Underrun Error Register" +AT91C_EMAC_TUND.helpkey="Transmit Underrun Error Register" +AT91C_EMAC_TUND.access=memorymapped +AT91C_EMAC_TUND.address=0xFFFDC064 +AT91C_EMAC_TUND.width=32 +AT91C_EMAC_TUND.byteEndian=little +AT91C_EMAC_NCR.name="AT91C_EMAC_NCR" +AT91C_EMAC_NCR.description="Network Control Register" +AT91C_EMAC_NCR.helpkey="Network Control Register" +AT91C_EMAC_NCR.access=memorymapped +AT91C_EMAC_NCR.address=0xFFFDC000 +AT91C_EMAC_NCR.width=32 +AT91C_EMAC_NCR.byteEndian=little +AT91C_EMAC_SA4L.name="AT91C_EMAC_SA4L" +AT91C_EMAC_SA4L.description="Specific Address 4 Bottom, First 4 bytes" +AT91C_EMAC_SA4L.helpkey="Specific Address 4 Bottom, First 4 bytes" +AT91C_EMAC_SA4L.access=memorymapped +AT91C_EMAC_SA4L.address=0xFFFDC0B0 +AT91C_EMAC_SA4L.width=32 +AT91C_EMAC_SA4L.byteEndian=little +AT91C_EMAC_RSR.name="AT91C_EMAC_RSR" +AT91C_EMAC_RSR.description="Receive Status Register" +AT91C_EMAC_RSR.helpkey="Receive Status Register" +AT91C_EMAC_RSR.access=memorymapped +AT91C_EMAC_RSR.address=0xFFFDC020 +AT91C_EMAC_RSR.width=32 +AT91C_EMAC_RSR.byteEndian=little +AT91C_EMAC_SA3L.name="AT91C_EMAC_SA3L" +AT91C_EMAC_SA3L.description="Specific Address 3 Bottom, First 4 bytes" +AT91C_EMAC_SA3L.helpkey="Specific Address 3 Bottom, First 4 bytes" +AT91C_EMAC_SA3L.access=memorymapped +AT91C_EMAC_SA3L.address=0xFFFDC0A8 +AT91C_EMAC_SA3L.width=32 +AT91C_EMAC_SA3L.byteEndian=little +AT91C_EMAC_TSR.name="AT91C_EMAC_TSR" +AT91C_EMAC_TSR.description="Transmit Status Register" +AT91C_EMAC_TSR.helpkey="Transmit Status Register" +AT91C_EMAC_TSR.access=memorymapped +AT91C_EMAC_TSR.address=0xFFFDC014 +AT91C_EMAC_TSR.width=32 +AT91C_EMAC_TSR.byteEndian=little +AT91C_EMAC_IDR.name="AT91C_EMAC_IDR" +AT91C_EMAC_IDR.description="Interrupt Disable Register" +AT91C_EMAC_IDR.helpkey="Interrupt Disable Register" +AT91C_EMAC_IDR.access=memorymapped +AT91C_EMAC_IDR.address=0xFFFDC02C +AT91C_EMAC_IDR.width=32 +AT91C_EMAC_IDR.byteEndian=little +AT91C_EMAC_IDR.type=enum +AT91C_EMAC_IDR.enum.0.name=*** Write only *** +AT91C_EMAC_IDR.enum.1.name=Error +AT91C_EMAC_RSE.name="AT91C_EMAC_RSE" +AT91C_EMAC_RSE.description="Receive Symbol Errors Register" +AT91C_EMAC_RSE.helpkey="Receive Symbol Errors Register" +AT91C_EMAC_RSE.access=memorymapped +AT91C_EMAC_RSE.address=0xFFFDC074 +AT91C_EMAC_RSE.width=32 +AT91C_EMAC_RSE.byteEndian=little +AT91C_EMAC_ECOL.name="AT91C_EMAC_ECOL" +AT91C_EMAC_ECOL.description="Excessive Collision Register" +AT91C_EMAC_ECOL.helpkey="Excessive Collision Register" +AT91C_EMAC_ECOL.access=memorymapped +AT91C_EMAC_ECOL.address=0xFFFDC060 +AT91C_EMAC_ECOL.width=32 +AT91C_EMAC_ECOL.byteEndian=little +AT91C_EMAC_TID.name="AT91C_EMAC_TID" +AT91C_EMAC_TID.description="Type ID Checking Register" +AT91C_EMAC_TID.helpkey="Type ID Checking Register" +AT91C_EMAC_TID.access=memorymapped +AT91C_EMAC_TID.address=0xFFFDC0B8 +AT91C_EMAC_TID.width=32 +AT91C_EMAC_TID.byteEndian=little +AT91C_EMAC_HRB.name="AT91C_EMAC_HRB" +AT91C_EMAC_HRB.description="Hash Address Bottom[31:0]" +AT91C_EMAC_HRB.helpkey="Hash Address Bottom[31:0]" +AT91C_EMAC_HRB.access=memorymapped +AT91C_EMAC_HRB.address=0xFFFDC090 +AT91C_EMAC_HRB.width=32 +AT91C_EMAC_HRB.byteEndian=little +AT91C_EMAC_TBQP.name="AT91C_EMAC_TBQP" +AT91C_EMAC_TBQP.description="Transmit Buffer Queue Pointer" +AT91C_EMAC_TBQP.helpkey="Transmit Buffer Queue Pointer" +AT91C_EMAC_TBQP.access=memorymapped +AT91C_EMAC_TBQP.address=0xFFFDC01C +AT91C_EMAC_TBQP.width=32 +AT91C_EMAC_TBQP.byteEndian=little +AT91C_EMAC_USRIO.name="AT91C_EMAC_USRIO" +AT91C_EMAC_USRIO.description="USER Input/Output Register" +AT91C_EMAC_USRIO.helpkey="USER Input/Output Register" +AT91C_EMAC_USRIO.access=memorymapped +AT91C_EMAC_USRIO.address=0xFFFDC0C0 +AT91C_EMAC_USRIO.width=32 +AT91C_EMAC_USRIO.byteEndian=little +AT91C_EMAC_PTR.name="AT91C_EMAC_PTR" +AT91C_EMAC_PTR.description="Pause Time Register" +AT91C_EMAC_PTR.helpkey="Pause Time Register" +AT91C_EMAC_PTR.access=memorymapped +AT91C_EMAC_PTR.address=0xFFFDC038 +AT91C_EMAC_PTR.width=32 +AT91C_EMAC_PTR.byteEndian=little +AT91C_EMAC_SA2H.name="AT91C_EMAC_SA2H" +AT91C_EMAC_SA2H.description="Specific Address 2 Top, Last 2 bytes" +AT91C_EMAC_SA2H.helpkey="Specific Address 2 Top, Last 2 bytes" +AT91C_EMAC_SA2H.access=memorymapped +AT91C_EMAC_SA2H.address=0xFFFDC0A4 +AT91C_EMAC_SA2H.width=32 +AT91C_EMAC_SA2H.byteEndian=little +AT91C_EMAC_ROV.name="AT91C_EMAC_ROV" +AT91C_EMAC_ROV.description="Receive Overrun Errors Register" +AT91C_EMAC_ROV.helpkey="Receive Overrun Errors Register" +AT91C_EMAC_ROV.access=memorymapped +AT91C_EMAC_ROV.address=0xFFFDC070 +AT91C_EMAC_ROV.width=32 +AT91C_EMAC_ROV.byteEndian=little +AT91C_EMAC_ALE.name="AT91C_EMAC_ALE" +AT91C_EMAC_ALE.description="Alignment Error Register" +AT91C_EMAC_ALE.helpkey="Alignment Error Register" +AT91C_EMAC_ALE.access=memorymapped +AT91C_EMAC_ALE.address=0xFFFDC054 +AT91C_EMAC_ALE.width=32 +AT91C_EMAC_ALE.byteEndian=little +AT91C_EMAC_RJA.name="AT91C_EMAC_RJA" +AT91C_EMAC_RJA.description="Receive Jabbers Register" +AT91C_EMAC_RJA.helpkey="Receive Jabbers Register" +AT91C_EMAC_RJA.access=memorymapped +AT91C_EMAC_RJA.address=0xFFFDC07C +AT91C_EMAC_RJA.width=32 +AT91C_EMAC_RJA.byteEndian=little +AT91C_EMAC_RBQP.name="AT91C_EMAC_RBQP" +AT91C_EMAC_RBQP.description="Receive Buffer Queue Pointer" +AT91C_EMAC_RBQP.helpkey="Receive Buffer Queue Pointer" +AT91C_EMAC_RBQP.access=memorymapped +AT91C_EMAC_RBQP.address=0xFFFDC018 +AT91C_EMAC_RBQP.width=32 +AT91C_EMAC_RBQP.byteEndian=little +AT91C_EMAC_TPF.name="AT91C_EMAC_TPF" +AT91C_EMAC_TPF.description="Transmitted Pause Frames Register" +AT91C_EMAC_TPF.helpkey="Transmitted Pause Frames Register" +AT91C_EMAC_TPF.access=memorymapped +AT91C_EMAC_TPF.address=0xFFFDC08C +AT91C_EMAC_TPF.width=32 +AT91C_EMAC_TPF.byteEndian=little +AT91C_EMAC_NCFGR.name="AT91C_EMAC_NCFGR" +AT91C_EMAC_NCFGR.description="Network Configuration Register" +AT91C_EMAC_NCFGR.helpkey="Network Configuration Register" +AT91C_EMAC_NCFGR.access=memorymapped +AT91C_EMAC_NCFGR.address=0xFFFDC004 +AT91C_EMAC_NCFGR.width=32 +AT91C_EMAC_NCFGR.byteEndian=little +AT91C_EMAC_HRT.name="AT91C_EMAC_HRT" +AT91C_EMAC_HRT.description="Hash Address Top[63:32]" +AT91C_EMAC_HRT.helpkey="Hash Address Top[63:32]" +AT91C_EMAC_HRT.access=memorymapped +AT91C_EMAC_HRT.address=0xFFFDC094 +AT91C_EMAC_HRT.width=32 +AT91C_EMAC_HRT.byteEndian=little +AT91C_EMAC_USF.name="AT91C_EMAC_USF" +AT91C_EMAC_USF.description="Undersize Frames Register" +AT91C_EMAC_USF.helpkey="Undersize Frames Register" +AT91C_EMAC_USF.access=memorymapped +AT91C_EMAC_USF.address=0xFFFDC080 +AT91C_EMAC_USF.width=32 +AT91C_EMAC_USF.byteEndian=little +AT91C_EMAC_FCSE.name="AT91C_EMAC_FCSE" +AT91C_EMAC_FCSE.description="Frame Check Sequence Error Register" +AT91C_EMAC_FCSE.helpkey="Frame Check Sequence Error Register" +AT91C_EMAC_FCSE.access=memorymapped +AT91C_EMAC_FCSE.address=0xFFFDC050 +AT91C_EMAC_FCSE.width=32 +AT91C_EMAC_FCSE.byteEndian=little +AT91C_EMAC_TPQ.name="AT91C_EMAC_TPQ" +AT91C_EMAC_TPQ.description="Transmit Pause Quantum Register" +AT91C_EMAC_TPQ.helpkey="Transmit Pause Quantum Register" +AT91C_EMAC_TPQ.access=memorymapped +AT91C_EMAC_TPQ.address=0xFFFDC0BC +AT91C_EMAC_TPQ.width=32 +AT91C_EMAC_TPQ.byteEndian=little +AT91C_EMAC_MAN.name="AT91C_EMAC_MAN" +AT91C_EMAC_MAN.description="PHY Maintenance Register" +AT91C_EMAC_MAN.helpkey="PHY Maintenance Register" +AT91C_EMAC_MAN.access=memorymapped +AT91C_EMAC_MAN.address=0xFFFDC034 +AT91C_EMAC_MAN.width=32 +AT91C_EMAC_MAN.byteEndian=little +AT91C_EMAC_FTO.name="AT91C_EMAC_FTO" +AT91C_EMAC_FTO.description="Frames Transmitted OK Register" +AT91C_EMAC_FTO.helpkey="Frames Transmitted OK Register" +AT91C_EMAC_FTO.access=memorymapped +AT91C_EMAC_FTO.address=0xFFFDC040 +AT91C_EMAC_FTO.width=32 +AT91C_EMAC_FTO.byteEndian=little +AT91C_EMAC_REV.name="AT91C_EMAC_REV" +AT91C_EMAC_REV.description="Revision Register" +AT91C_EMAC_REV.helpkey="Revision Register" +AT91C_EMAC_REV.access=memorymapped +AT91C_EMAC_REV.address=0xFFFDC0FC +AT91C_EMAC_REV.width=32 +AT91C_EMAC_REV.byteEndian=little +AT91C_EMAC_REV.permission.write=none +AT91C_EMAC_IMR.name="AT91C_EMAC_IMR" +AT91C_EMAC_IMR.description="Interrupt Mask Register" +AT91C_EMAC_IMR.helpkey="Interrupt Mask Register" +AT91C_EMAC_IMR.access=memorymapped +AT91C_EMAC_IMR.address=0xFFFDC030 +AT91C_EMAC_IMR.width=32 +AT91C_EMAC_IMR.byteEndian=little +AT91C_EMAC_IMR.permission.write=none +AT91C_EMAC_SCF.name="AT91C_EMAC_SCF" +AT91C_EMAC_SCF.description="Single Collision Frame Register" +AT91C_EMAC_SCF.helpkey="Single Collision Frame Register" +AT91C_EMAC_SCF.access=memorymapped +AT91C_EMAC_SCF.address=0xFFFDC044 +AT91C_EMAC_SCF.width=32 +AT91C_EMAC_SCF.byteEndian=little +AT91C_EMAC_PFR.name="AT91C_EMAC_PFR" +AT91C_EMAC_PFR.description="Pause Frames received Register" +AT91C_EMAC_PFR.helpkey="Pause Frames received Register" +AT91C_EMAC_PFR.access=memorymapped +AT91C_EMAC_PFR.address=0xFFFDC03C +AT91C_EMAC_PFR.width=32 +AT91C_EMAC_PFR.byteEndian=little +AT91C_EMAC_MCF.name="AT91C_EMAC_MCF" +AT91C_EMAC_MCF.description="Multiple Collision Frame Register" +AT91C_EMAC_MCF.helpkey="Multiple Collision Frame Register" +AT91C_EMAC_MCF.access=memorymapped +AT91C_EMAC_MCF.address=0xFFFDC048 +AT91C_EMAC_MCF.width=32 +AT91C_EMAC_MCF.byteEndian=little +AT91C_EMAC_NSR.name="AT91C_EMAC_NSR" +AT91C_EMAC_NSR.description="Network Status Register" +AT91C_EMAC_NSR.helpkey="Network Status Register" +AT91C_EMAC_NSR.access=memorymapped +AT91C_EMAC_NSR.address=0xFFFDC008 +AT91C_EMAC_NSR.width=32 +AT91C_EMAC_NSR.byteEndian=little +AT91C_EMAC_NSR.permission.write=none +AT91C_EMAC_SA2L.name="AT91C_EMAC_SA2L" +AT91C_EMAC_SA2L.description="Specific Address 2 Bottom, First 4 bytes" +AT91C_EMAC_SA2L.helpkey="Specific Address 2 Bottom, First 4 bytes" +AT91C_EMAC_SA2L.access=memorymapped +AT91C_EMAC_SA2L.address=0xFFFDC0A0 +AT91C_EMAC_SA2L.width=32 +AT91C_EMAC_SA2L.byteEndian=little +AT91C_EMAC_FRO.name="AT91C_EMAC_FRO" +AT91C_EMAC_FRO.description="Frames Received OK Register" +AT91C_EMAC_FRO.helpkey="Frames Received OK Register" +AT91C_EMAC_FRO.access=memorymapped +AT91C_EMAC_FRO.address=0xFFFDC04C +AT91C_EMAC_FRO.width=32 +AT91C_EMAC_FRO.byteEndian=little +AT91C_EMAC_IER.name="AT91C_EMAC_IER" +AT91C_EMAC_IER.description="Interrupt Enable Register" +AT91C_EMAC_IER.helpkey="Interrupt Enable Register" +AT91C_EMAC_IER.access=memorymapped +AT91C_EMAC_IER.address=0xFFFDC028 +AT91C_EMAC_IER.width=32 +AT91C_EMAC_IER.byteEndian=little +AT91C_EMAC_IER.type=enum +AT91C_EMAC_IER.enum.0.name=*** Write only *** +AT91C_EMAC_IER.enum.1.name=Error +AT91C_EMAC_SA1H.name="AT91C_EMAC_SA1H" +AT91C_EMAC_SA1H.description="Specific Address 1 Top, Last 2 bytes" +AT91C_EMAC_SA1H.helpkey="Specific Address 1 Top, Last 2 bytes" +AT91C_EMAC_SA1H.access=memorymapped +AT91C_EMAC_SA1H.address=0xFFFDC09C +AT91C_EMAC_SA1H.width=32 +AT91C_EMAC_SA1H.byteEndian=little +AT91C_EMAC_CSE.name="AT91C_EMAC_CSE" +AT91C_EMAC_CSE.description="Carrier Sense Error Register" +AT91C_EMAC_CSE.helpkey="Carrier Sense Error Register" +AT91C_EMAC_CSE.access=memorymapped +AT91C_EMAC_CSE.address=0xFFFDC068 +AT91C_EMAC_CSE.width=32 +AT91C_EMAC_CSE.byteEndian=little +AT91C_EMAC_SA3H.name="AT91C_EMAC_SA3H" +AT91C_EMAC_SA3H.description="Specific Address 3 Top, Last 2 bytes" +AT91C_EMAC_SA3H.helpkey="Specific Address 3 Top, Last 2 bytes" +AT91C_EMAC_SA3H.access=memorymapped +AT91C_EMAC_SA3H.address=0xFFFDC0AC +AT91C_EMAC_SA3H.width=32 +AT91C_EMAC_SA3H.byteEndian=little +AT91C_EMAC_RRE.name="AT91C_EMAC_RRE" +AT91C_EMAC_RRE.description="Receive Ressource Error Register" +AT91C_EMAC_RRE.helpkey="Receive Ressource Error Register" +AT91C_EMAC_RRE.access=memorymapped +AT91C_EMAC_RRE.address=0xFFFDC06C +AT91C_EMAC_RRE.width=32 +AT91C_EMAC_RRE.byteEndian=little +AT91C_EMAC_STE.name="AT91C_EMAC_STE" +AT91C_EMAC_STE.description="SQE Test Error Register" +AT91C_EMAC_STE.helpkey="SQE Test Error Register" +AT91C_EMAC_STE.access=memorymapped +AT91C_EMAC_STE.address=0xFFFDC084 +AT91C_EMAC_STE.width=32 +AT91C_EMAC_STE.byteEndian=little +# ========== Register definition for PDC_ADC peripheral ========== +AT91C_ADC_PTSR.name="AT91C_ADC_PTSR" +AT91C_ADC_PTSR.description="PDC Transfer Status Register" +AT91C_ADC_PTSR.helpkey="PDC Transfer Status Register" +AT91C_ADC_PTSR.access=memorymapped +AT91C_ADC_PTSR.address=0xFFFD8124 +AT91C_ADC_PTSR.width=32 +AT91C_ADC_PTSR.byteEndian=little +AT91C_ADC_PTSR.permission.write=none +AT91C_ADC_PTCR.name="AT91C_ADC_PTCR" +AT91C_ADC_PTCR.description="PDC Transfer Control Register" +AT91C_ADC_PTCR.helpkey="PDC Transfer Control Register" +AT91C_ADC_PTCR.access=memorymapped +AT91C_ADC_PTCR.address=0xFFFD8120 +AT91C_ADC_PTCR.width=32 +AT91C_ADC_PTCR.byteEndian=little +AT91C_ADC_PTCR.type=enum +AT91C_ADC_PTCR.enum.0.name=*** Write only *** +AT91C_ADC_PTCR.enum.1.name=Error +AT91C_ADC_TNPR.name="AT91C_ADC_TNPR" +AT91C_ADC_TNPR.description="Transmit Next Pointer Register" +AT91C_ADC_TNPR.helpkey="Transmit Next Pointer Register" +AT91C_ADC_TNPR.access=memorymapped +AT91C_ADC_TNPR.address=0xFFFD8118 +AT91C_ADC_TNPR.width=32 +AT91C_ADC_TNPR.byteEndian=little +AT91C_ADC_TNCR.name="AT91C_ADC_TNCR" +AT91C_ADC_TNCR.description="Transmit Next Counter Register" +AT91C_ADC_TNCR.helpkey="Transmit Next Counter Register" +AT91C_ADC_TNCR.access=memorymapped +AT91C_ADC_TNCR.address=0xFFFD811C +AT91C_ADC_TNCR.width=32 +AT91C_ADC_TNCR.byteEndian=little +AT91C_ADC_RNPR.name="AT91C_ADC_RNPR" +AT91C_ADC_RNPR.description="Receive Next Pointer Register" +AT91C_ADC_RNPR.helpkey="Receive Next Pointer Register" +AT91C_ADC_RNPR.access=memorymapped +AT91C_ADC_RNPR.address=0xFFFD8110 +AT91C_ADC_RNPR.width=32 +AT91C_ADC_RNPR.byteEndian=little +AT91C_ADC_RNCR.name="AT91C_ADC_RNCR" +AT91C_ADC_RNCR.description="Receive Next Counter Register" +AT91C_ADC_RNCR.helpkey="Receive Next Counter Register" +AT91C_ADC_RNCR.access=memorymapped +AT91C_ADC_RNCR.address=0xFFFD8114 +AT91C_ADC_RNCR.width=32 +AT91C_ADC_RNCR.byteEndian=little +AT91C_ADC_RPR.name="AT91C_ADC_RPR" +AT91C_ADC_RPR.description="Receive Pointer Register" +AT91C_ADC_RPR.helpkey="Receive Pointer Register" +AT91C_ADC_RPR.access=memorymapped +AT91C_ADC_RPR.address=0xFFFD8100 +AT91C_ADC_RPR.width=32 +AT91C_ADC_RPR.byteEndian=little +AT91C_ADC_TCR.name="AT91C_ADC_TCR" +AT91C_ADC_TCR.description="Transmit Counter Register" +AT91C_ADC_TCR.helpkey="Transmit Counter Register" +AT91C_ADC_TCR.access=memorymapped +AT91C_ADC_TCR.address=0xFFFD810C +AT91C_ADC_TCR.width=32 +AT91C_ADC_TCR.byteEndian=little +AT91C_ADC_TPR.name="AT91C_ADC_TPR" +AT91C_ADC_TPR.description="Transmit Pointer Register" +AT91C_ADC_TPR.helpkey="Transmit Pointer Register" +AT91C_ADC_TPR.access=memorymapped +AT91C_ADC_TPR.address=0xFFFD8108 +AT91C_ADC_TPR.width=32 +AT91C_ADC_TPR.byteEndian=little +AT91C_ADC_RCR.name="AT91C_ADC_RCR" +AT91C_ADC_RCR.description="Receive Counter Register" +AT91C_ADC_RCR.helpkey="Receive Counter Register" +AT91C_ADC_RCR.access=memorymapped +AT91C_ADC_RCR.address=0xFFFD8104 +AT91C_ADC_RCR.width=32 +AT91C_ADC_RCR.byteEndian=little +# ========== Register definition for ADC peripheral ========== +AT91C_ADC_CDR2.name="AT91C_ADC_CDR2" +AT91C_ADC_CDR2.description="ADC Channel Data Register 2" +AT91C_ADC_CDR2.helpkey="ADC Channel Data Register 2" +AT91C_ADC_CDR2.access=memorymapped +AT91C_ADC_CDR2.address=0xFFFD8038 +AT91C_ADC_CDR2.width=32 +AT91C_ADC_CDR2.byteEndian=little +AT91C_ADC_CDR2.permission.write=none +AT91C_ADC_CDR3.name="AT91C_ADC_CDR3" +AT91C_ADC_CDR3.description="ADC Channel Data Register 3" +AT91C_ADC_CDR3.helpkey="ADC Channel Data Register 3" +AT91C_ADC_CDR3.access=memorymapped +AT91C_ADC_CDR3.address=0xFFFD803C +AT91C_ADC_CDR3.width=32 +AT91C_ADC_CDR3.byteEndian=little +AT91C_ADC_CDR3.permission.write=none +AT91C_ADC_CDR0.name="AT91C_ADC_CDR0" +AT91C_ADC_CDR0.description="ADC Channel Data Register 0" +AT91C_ADC_CDR0.helpkey="ADC Channel Data Register 0" +AT91C_ADC_CDR0.access=memorymapped +AT91C_ADC_CDR0.address=0xFFFD8030 +AT91C_ADC_CDR0.width=32 +AT91C_ADC_CDR0.byteEndian=little +AT91C_ADC_CDR0.permission.write=none +AT91C_ADC_CDR5.name="AT91C_ADC_CDR5" +AT91C_ADC_CDR5.description="ADC Channel Data Register 5" +AT91C_ADC_CDR5.helpkey="ADC Channel Data Register 5" +AT91C_ADC_CDR5.access=memorymapped +AT91C_ADC_CDR5.address=0xFFFD8044 +AT91C_ADC_CDR5.width=32 +AT91C_ADC_CDR5.byteEndian=little +AT91C_ADC_CDR5.permission.write=none +AT91C_ADC_CHDR.name="AT91C_ADC_CHDR" +AT91C_ADC_CHDR.description="ADC Channel Disable Register" +AT91C_ADC_CHDR.helpkey="ADC Channel Disable Register" +AT91C_ADC_CHDR.access=memorymapped +AT91C_ADC_CHDR.address=0xFFFD8014 +AT91C_ADC_CHDR.width=32 +AT91C_ADC_CHDR.byteEndian=little +AT91C_ADC_CHDR.type=enum +AT91C_ADC_CHDR.enum.0.name=*** Write only *** +AT91C_ADC_CHDR.enum.1.name=Error +AT91C_ADC_SR.name="AT91C_ADC_SR" +AT91C_ADC_SR.description="ADC Status Register" +AT91C_ADC_SR.helpkey="ADC Status Register" +AT91C_ADC_SR.access=memorymapped +AT91C_ADC_SR.address=0xFFFD801C +AT91C_ADC_SR.width=32 +AT91C_ADC_SR.byteEndian=little +AT91C_ADC_SR.permission.write=none +AT91C_ADC_CDR4.name="AT91C_ADC_CDR4" +AT91C_ADC_CDR4.description="ADC Channel Data Register 4" +AT91C_ADC_CDR4.helpkey="ADC Channel Data Register 4" +AT91C_ADC_CDR4.access=memorymapped +AT91C_ADC_CDR4.address=0xFFFD8040 +AT91C_ADC_CDR4.width=32 +AT91C_ADC_CDR4.byteEndian=little +AT91C_ADC_CDR4.permission.write=none +AT91C_ADC_CDR1.name="AT91C_ADC_CDR1" +AT91C_ADC_CDR1.description="ADC Channel Data Register 1" +AT91C_ADC_CDR1.helpkey="ADC Channel Data Register 1" +AT91C_ADC_CDR1.access=memorymapped +AT91C_ADC_CDR1.address=0xFFFD8034 +AT91C_ADC_CDR1.width=32 +AT91C_ADC_CDR1.byteEndian=little +AT91C_ADC_CDR1.permission.write=none +AT91C_ADC_LCDR.name="AT91C_ADC_LCDR" +AT91C_ADC_LCDR.description="ADC Last Converted Data Register" +AT91C_ADC_LCDR.helpkey="ADC Last Converted Data Register" +AT91C_ADC_LCDR.access=memorymapped +AT91C_ADC_LCDR.address=0xFFFD8020 +AT91C_ADC_LCDR.width=32 +AT91C_ADC_LCDR.byteEndian=little +AT91C_ADC_LCDR.permission.write=none +AT91C_ADC_IDR.name="AT91C_ADC_IDR" +AT91C_ADC_IDR.description="ADC Interrupt Disable Register" +AT91C_ADC_IDR.helpkey="ADC Interrupt Disable Register" +AT91C_ADC_IDR.access=memorymapped +AT91C_ADC_IDR.address=0xFFFD8028 +AT91C_ADC_IDR.width=32 +AT91C_ADC_IDR.byteEndian=little +AT91C_ADC_IDR.type=enum +AT91C_ADC_IDR.enum.0.name=*** Write only *** +AT91C_ADC_IDR.enum.1.name=Error +AT91C_ADC_CR.name="AT91C_ADC_CR" +AT91C_ADC_CR.description="ADC Control Register" +AT91C_ADC_CR.helpkey="ADC Control Register" +AT91C_ADC_CR.access=memorymapped +AT91C_ADC_CR.address=0xFFFD8000 +AT91C_ADC_CR.width=32 +AT91C_ADC_CR.byteEndian=little +AT91C_ADC_CR.type=enum +AT91C_ADC_CR.enum.0.name=*** Write only *** +AT91C_ADC_CR.enum.1.name=Error +AT91C_ADC_CDR7.name="AT91C_ADC_CDR7" +AT91C_ADC_CDR7.description="ADC Channel Data Register 7" +AT91C_ADC_CDR7.helpkey="ADC Channel Data Register 7" +AT91C_ADC_CDR7.access=memorymapped +AT91C_ADC_CDR7.address=0xFFFD804C +AT91C_ADC_CDR7.width=32 +AT91C_ADC_CDR7.byteEndian=little +AT91C_ADC_CDR7.permission.write=none +AT91C_ADC_CDR6.name="AT91C_ADC_CDR6" +AT91C_ADC_CDR6.description="ADC Channel Data Register 6" +AT91C_ADC_CDR6.helpkey="ADC Channel Data Register 6" +AT91C_ADC_CDR6.access=memorymapped +AT91C_ADC_CDR6.address=0xFFFD8048 +AT91C_ADC_CDR6.width=32 +AT91C_ADC_CDR6.byteEndian=little +AT91C_ADC_CDR6.permission.write=none +AT91C_ADC_IER.name="AT91C_ADC_IER" +AT91C_ADC_IER.description="ADC Interrupt Enable Register" +AT91C_ADC_IER.helpkey="ADC Interrupt Enable Register" +AT91C_ADC_IER.access=memorymapped +AT91C_ADC_IER.address=0xFFFD8024 +AT91C_ADC_IER.width=32 +AT91C_ADC_IER.byteEndian=little +AT91C_ADC_IER.type=enum +AT91C_ADC_IER.enum.0.name=*** Write only *** +AT91C_ADC_IER.enum.1.name=Error +AT91C_ADC_CHER.name="AT91C_ADC_CHER" +AT91C_ADC_CHER.description="ADC Channel Enable Register" +AT91C_ADC_CHER.helpkey="ADC Channel Enable Register" +AT91C_ADC_CHER.access=memorymapped +AT91C_ADC_CHER.address=0xFFFD8010 +AT91C_ADC_CHER.width=32 +AT91C_ADC_CHER.byteEndian=little +AT91C_ADC_CHER.type=enum +AT91C_ADC_CHER.enum.0.name=*** Write only *** +AT91C_ADC_CHER.enum.1.name=Error +AT91C_ADC_CHSR.name="AT91C_ADC_CHSR" +AT91C_ADC_CHSR.description="ADC Channel Status Register" +AT91C_ADC_CHSR.helpkey="ADC Channel Status Register" +AT91C_ADC_CHSR.access=memorymapped +AT91C_ADC_CHSR.address=0xFFFD8018 +AT91C_ADC_CHSR.width=32 +AT91C_ADC_CHSR.byteEndian=little +AT91C_ADC_CHSR.permission.write=none +AT91C_ADC_MR.name="AT91C_ADC_MR" +AT91C_ADC_MR.description="ADC Mode Register" +AT91C_ADC_MR.helpkey="ADC Mode Register" +AT91C_ADC_MR.access=memorymapped +AT91C_ADC_MR.address=0xFFFD8004 +AT91C_ADC_MR.width=32 +AT91C_ADC_MR.byteEndian=little +AT91C_ADC_IMR.name="AT91C_ADC_IMR" +AT91C_ADC_IMR.description="ADC Interrupt Mask Register" +AT91C_ADC_IMR.helpkey="ADC Interrupt Mask Register" +AT91C_ADC_IMR.access=memorymapped +AT91C_ADC_IMR.address=0xFFFD802C +AT91C_ADC_IMR.width=32 +AT91C_ADC_IMR.byteEndian=little +AT91C_ADC_IMR.permission.write=none +# ========== Group definition for SYS peripheral ========== +group.SYS.description="ATMEL SYS Registers" +group.SYS.helpkey="ATMEL SYS Registers" +# ========== Group definition for AIC peripheral ========== +group.AIC.description="ATMEL AIC Registers" +group.AIC.helpkey="ATMEL AIC Registers" +group.AIC.register.0=AT91C_AIC_IVR +group.AIC.register.1=AT91C_AIC_SMR +group.AIC.register.2=AT91C_AIC_FVR +group.AIC.register.3=AT91C_AIC_DCR +group.AIC.register.4=AT91C_AIC_EOICR +group.AIC.register.5=AT91C_AIC_SVR +group.AIC.register.6=AT91C_AIC_FFSR +group.AIC.register.7=AT91C_AIC_ICCR +group.AIC.register.8=AT91C_AIC_ISR +group.AIC.register.9=AT91C_AIC_IMR +group.AIC.register.10=AT91C_AIC_IPR +group.AIC.register.11=AT91C_AIC_FFER +group.AIC.register.12=AT91C_AIC_IECR +group.AIC.register.13=AT91C_AIC_ISCR +group.AIC.register.14=AT91C_AIC_FFDR +group.AIC.register.15=AT91C_AIC_CISR +group.AIC.register.16=AT91C_AIC_IDCR +group.AIC.register.17=AT91C_AIC_SPU +# ========== Group definition for PDC_DBGU peripheral ========== +group.PDC_DBGU.description="ATMEL PDC_DBGU Registers" +group.PDC_DBGU.helpkey="ATMEL PDC_DBGU Registers" +group.PDC_DBGU.register.0=AT91C_DBGU_TCR +group.PDC_DBGU.register.1=AT91C_DBGU_RNPR +group.PDC_DBGU.register.2=AT91C_DBGU_TNPR +group.PDC_DBGU.register.3=AT91C_DBGU_TPR +group.PDC_DBGU.register.4=AT91C_DBGU_RPR +group.PDC_DBGU.register.5=AT91C_DBGU_RCR +group.PDC_DBGU.register.6=AT91C_DBGU_RNCR +group.PDC_DBGU.register.7=AT91C_DBGU_PTCR +group.PDC_DBGU.register.8=AT91C_DBGU_PTSR +group.PDC_DBGU.register.9=AT91C_DBGU_TNCR +# ========== Group definition for DBGU peripheral ========== +group.DBGU.description="ATMEL DBGU Registers" +group.DBGU.helpkey="ATMEL DBGU Registers" +group.DBGU.register.0=AT91C_DBGU_EXID +group.DBGU.register.1=AT91C_DBGU_BRGR +group.DBGU.register.2=AT91C_DBGU_IDR +group.DBGU.register.3=AT91C_DBGU_CSR +group.DBGU.register.4=AT91C_DBGU_CIDR +group.DBGU.register.5=AT91C_DBGU_MR +group.DBGU.register.6=AT91C_DBGU_IMR +group.DBGU.register.7=AT91C_DBGU_CR +group.DBGU.register.8=AT91C_DBGU_FNTR +group.DBGU.register.9=AT91C_DBGU_THR +group.DBGU.register.10=AT91C_DBGU_RHR +group.DBGU.register.11=AT91C_DBGU_IER +# ========== Group definition for PIOA peripheral ========== +group.PIOA.description="ATMEL PIOA Registers" +group.PIOA.helpkey="ATMEL PIOA Registers" +group.PIOA.register.0=AT91C_PIOA_ODR +group.PIOA.register.1=AT91C_PIOA_SODR +group.PIOA.register.2=AT91C_PIOA_ISR +group.PIOA.register.3=AT91C_PIOA_ABSR +group.PIOA.register.4=AT91C_PIOA_IER +group.PIOA.register.5=AT91C_PIOA_PPUDR +group.PIOA.register.6=AT91C_PIOA_IMR +group.PIOA.register.7=AT91C_PIOA_PER +group.PIOA.register.8=AT91C_PIOA_IFDR +group.PIOA.register.9=AT91C_PIOA_OWDR +group.PIOA.register.10=AT91C_PIOA_MDSR +group.PIOA.register.11=AT91C_PIOA_IDR +group.PIOA.register.12=AT91C_PIOA_ODSR +group.PIOA.register.13=AT91C_PIOA_PPUSR +group.PIOA.register.14=AT91C_PIOA_OWSR +group.PIOA.register.15=AT91C_PIOA_BSR +group.PIOA.register.16=AT91C_PIOA_OWER +group.PIOA.register.17=AT91C_PIOA_IFER +group.PIOA.register.18=AT91C_PIOA_PDSR +group.PIOA.register.19=AT91C_PIOA_PPUER +group.PIOA.register.20=AT91C_PIOA_OSR +group.PIOA.register.21=AT91C_PIOA_ASR +group.PIOA.register.22=AT91C_PIOA_MDDR +group.PIOA.register.23=AT91C_PIOA_CODR +group.PIOA.register.24=AT91C_PIOA_MDER +group.PIOA.register.25=AT91C_PIOA_PDR +group.PIOA.register.26=AT91C_PIOA_IFSR +group.PIOA.register.27=AT91C_PIOA_OER +group.PIOA.register.28=AT91C_PIOA_PSR +# ========== Group definition for PIOB peripheral ========== +group.PIOB.description="ATMEL PIOB Registers" +group.PIOB.helpkey="ATMEL PIOB Registers" +group.PIOB.register.0=AT91C_PIOB_OWDR +group.PIOB.register.1=AT91C_PIOB_MDER +group.PIOB.register.2=AT91C_PIOB_PPUSR +group.PIOB.register.3=AT91C_PIOB_IMR +group.PIOB.register.4=AT91C_PIOB_ASR +group.PIOB.register.5=AT91C_PIOB_PPUDR +group.PIOB.register.6=AT91C_PIOB_PSR +group.PIOB.register.7=AT91C_PIOB_IER +group.PIOB.register.8=AT91C_PIOB_CODR +group.PIOB.register.9=AT91C_PIOB_OWER +group.PIOB.register.10=AT91C_PIOB_ABSR +group.PIOB.register.11=AT91C_PIOB_IFDR +group.PIOB.register.12=AT91C_PIOB_PDSR +group.PIOB.register.13=AT91C_PIOB_IDR +group.PIOB.register.14=AT91C_PIOB_OWSR +group.PIOB.register.15=AT91C_PIOB_PDR +group.PIOB.register.16=AT91C_PIOB_ODR +group.PIOB.register.17=AT91C_PIOB_IFSR +group.PIOB.register.18=AT91C_PIOB_PPUER +group.PIOB.register.19=AT91C_PIOB_SODR +group.PIOB.register.20=AT91C_PIOB_ISR +group.PIOB.register.21=AT91C_PIOB_ODSR +group.PIOB.register.22=AT91C_PIOB_OSR +group.PIOB.register.23=AT91C_PIOB_MDSR +group.PIOB.register.24=AT91C_PIOB_IFER +group.PIOB.register.25=AT91C_PIOB_BSR +group.PIOB.register.26=AT91C_PIOB_MDDR +group.PIOB.register.27=AT91C_PIOB_OER +group.PIOB.register.28=AT91C_PIOB_PER +# ========== Group definition for CKGR peripheral ========== +group.CKGR.description="ATMEL CKGR Registers" +group.CKGR.helpkey="ATMEL CKGR Registers" +group.CKGR.register.0=AT91C_CKGR_MOR +group.CKGR.register.1=AT91C_CKGR_PLLR +group.CKGR.register.2=AT91C_CKGR_MCFR +# ========== Group definition for PMC peripheral ========== +group.PMC.description="ATMEL PMC Registers" +group.PMC.helpkey="ATMEL PMC Registers" +group.PMC.register.0=AT91C_PMC_IDR +group.PMC.register.1=AT91C_PMC_MOR +group.PMC.register.2=AT91C_PMC_PLLR +group.PMC.register.3=AT91C_PMC_PCER +group.PMC.register.4=AT91C_PMC_PCKR +group.PMC.register.5=AT91C_PMC_MCKR +group.PMC.register.6=AT91C_PMC_SCDR +group.PMC.register.7=AT91C_PMC_PCDR +group.PMC.register.8=AT91C_PMC_SCSR +group.PMC.register.9=AT91C_PMC_PCSR +group.PMC.register.10=AT91C_PMC_MCFR +group.PMC.register.11=AT91C_PMC_SCER +group.PMC.register.12=AT91C_PMC_IMR +group.PMC.register.13=AT91C_PMC_IER +group.PMC.register.14=AT91C_PMC_SR +# ========== Group definition for RSTC peripheral ========== +group.RSTC.description="ATMEL RSTC Registers" +group.RSTC.helpkey="ATMEL RSTC Registers" +group.RSTC.register.0=AT91C_RSTC_RCR +group.RSTC.register.1=AT91C_RSTC_RMR +group.RSTC.register.2=AT91C_RSTC_RSR +# ========== Group definition for RTTC peripheral ========== +group.RTTC.description="ATMEL RTTC Registers" +group.RTTC.helpkey="ATMEL RTTC Registers" +group.RTTC.register.0=AT91C_RTTC_RTSR +group.RTTC.register.1=AT91C_RTTC_RTMR +group.RTTC.register.2=AT91C_RTTC_RTVR +group.RTTC.register.3=AT91C_RTTC_RTAR +# ========== Group definition for PITC peripheral ========== +group.PITC.description="ATMEL PITC Registers" +group.PITC.helpkey="ATMEL PITC Registers" +group.PITC.register.0=AT91C_PITC_PIVR +group.PITC.register.1=AT91C_PITC_PISR +group.PITC.register.2=AT91C_PITC_PIIR +group.PITC.register.3=AT91C_PITC_PIMR +# ========== Group definition for WDTC peripheral ========== +group.WDTC.description="ATMEL WDTC Registers" +group.WDTC.helpkey="ATMEL WDTC Registers" +group.WDTC.register.0=AT91C_WDTC_WDCR +group.WDTC.register.1=AT91C_WDTC_WDSR +group.WDTC.register.2=AT91C_WDTC_WDMR +# ========== Group definition for VREG peripheral ========== +group.VREG.description="ATMEL VREG Registers" +group.VREG.helpkey="ATMEL VREG Registers" +group.VREG.register.0=AT91C_VREG_MR +# ========== Group definition for MC peripheral ========== +group.MC.description="ATMEL MC Registers" +group.MC.helpkey="ATMEL MC Registers" +group.MC.register.0=AT91C_MC_ASR +group.MC.register.1=AT91C_MC_RCR +group.MC.register.2=AT91C_MC_FCR +group.MC.register.3=AT91C_MC_AASR +group.MC.register.4=AT91C_MC_FSR +group.MC.register.5=AT91C_MC_FMR +# ========== Group definition for PDC_SPI1 peripheral ========== +group.PDC_SPI1.description="ATMEL PDC_SPI1 Registers" +group.PDC_SPI1.helpkey="ATMEL PDC_SPI1 Registers" +group.PDC_SPI1.register.0=AT91C_SPI1_PTCR +group.PDC_SPI1.register.1=AT91C_SPI1_RPR +group.PDC_SPI1.register.2=AT91C_SPI1_TNCR +group.PDC_SPI1.register.3=AT91C_SPI1_TPR +group.PDC_SPI1.register.4=AT91C_SPI1_TNPR +group.PDC_SPI1.register.5=AT91C_SPI1_TCR +group.PDC_SPI1.register.6=AT91C_SPI1_RCR +group.PDC_SPI1.register.7=AT91C_SPI1_RNPR +group.PDC_SPI1.register.8=AT91C_SPI1_RNCR +group.PDC_SPI1.register.9=AT91C_SPI1_PTSR +# ========== Group definition for SPI1 peripheral ========== +group.SPI1.description="ATMEL SPI1 Registers" +group.SPI1.helpkey="ATMEL SPI1 Registers" +group.SPI1.register.0=AT91C_SPI1_IMR +group.SPI1.register.1=AT91C_SPI1_IER +group.SPI1.register.2=AT91C_SPI1_MR +group.SPI1.register.3=AT91C_SPI1_RDR +group.SPI1.register.4=AT91C_SPI1_IDR +group.SPI1.register.5=AT91C_SPI1_SR +group.SPI1.register.6=AT91C_SPI1_TDR +group.SPI1.register.7=AT91C_SPI1_CR +group.SPI1.register.8=AT91C_SPI1_CSR +# ========== Group definition for PDC_SPI0 peripheral ========== +group.PDC_SPI0.description="ATMEL PDC_SPI0 Registers" +group.PDC_SPI0.helpkey="ATMEL PDC_SPI0 Registers" +group.PDC_SPI0.register.0=AT91C_SPI0_PTCR +group.PDC_SPI0.register.1=AT91C_SPI0_TPR +group.PDC_SPI0.register.2=AT91C_SPI0_TCR +group.PDC_SPI0.register.3=AT91C_SPI0_RCR +group.PDC_SPI0.register.4=AT91C_SPI0_PTSR +group.PDC_SPI0.register.5=AT91C_SPI0_RNPR +group.PDC_SPI0.register.6=AT91C_SPI0_RPR +group.PDC_SPI0.register.7=AT91C_SPI0_TNCR +group.PDC_SPI0.register.8=AT91C_SPI0_RNCR +group.PDC_SPI0.register.9=AT91C_SPI0_TNPR +# ========== Group definition for SPI0 peripheral ========== +group.SPI0.description="ATMEL SPI0 Registers" +group.SPI0.helpkey="ATMEL SPI0 Registers" +group.SPI0.register.0=AT91C_SPI0_IER +group.SPI0.register.1=AT91C_SPI0_SR +group.SPI0.register.2=AT91C_SPI0_IDR +group.SPI0.register.3=AT91C_SPI0_CR +group.SPI0.register.4=AT91C_SPI0_MR +group.SPI0.register.5=AT91C_SPI0_IMR +group.SPI0.register.6=AT91C_SPI0_TDR +group.SPI0.register.7=AT91C_SPI0_RDR +group.SPI0.register.8=AT91C_SPI0_CSR +# ========== Group definition for PDC_US1 peripheral ========== +group.PDC_US1.description="ATMEL PDC_US1 Registers" +group.PDC_US1.helpkey="ATMEL PDC_US1 Registers" +group.PDC_US1.register.0=AT91C_US1_RNCR +group.PDC_US1.register.1=AT91C_US1_PTCR +group.PDC_US1.register.2=AT91C_US1_TCR +group.PDC_US1.register.3=AT91C_US1_PTSR +group.PDC_US1.register.4=AT91C_US1_TNPR +group.PDC_US1.register.5=AT91C_US1_RCR +group.PDC_US1.register.6=AT91C_US1_RNPR +group.PDC_US1.register.7=AT91C_US1_RPR +group.PDC_US1.register.8=AT91C_US1_TNCR +group.PDC_US1.register.9=AT91C_US1_TPR +# ========== Group definition for US1 peripheral ========== +group.US1.description="ATMEL US1 Registers" +group.US1.helpkey="ATMEL US1 Registers" +group.US1.register.0=AT91C_US1_IF +group.US1.register.1=AT91C_US1_NER +group.US1.register.2=AT91C_US1_RTOR +group.US1.register.3=AT91C_US1_CSR +group.US1.register.4=AT91C_US1_IDR +group.US1.register.5=AT91C_US1_IER +group.US1.register.6=AT91C_US1_THR +group.US1.register.7=AT91C_US1_TTGR +group.US1.register.8=AT91C_US1_RHR +group.US1.register.9=AT91C_US1_BRGR +group.US1.register.10=AT91C_US1_IMR +group.US1.register.11=AT91C_US1_FIDI +group.US1.register.12=AT91C_US1_CR +group.US1.register.13=AT91C_US1_MR +# ========== Group definition for PDC_US0 peripheral ========== +group.PDC_US0.description="ATMEL PDC_US0 Registers" +group.PDC_US0.helpkey="ATMEL PDC_US0 Registers" +group.PDC_US0.register.0=AT91C_US0_TNPR +group.PDC_US0.register.1=AT91C_US0_RNPR +group.PDC_US0.register.2=AT91C_US0_TCR +group.PDC_US0.register.3=AT91C_US0_PTCR +group.PDC_US0.register.4=AT91C_US0_PTSR +group.PDC_US0.register.5=AT91C_US0_TNCR +group.PDC_US0.register.6=AT91C_US0_TPR +group.PDC_US0.register.7=AT91C_US0_RCR +group.PDC_US0.register.8=AT91C_US0_RPR +group.PDC_US0.register.9=AT91C_US0_RNCR +# ========== Group definition for US0 peripheral ========== +group.US0.description="ATMEL US0 Registers" +group.US0.helpkey="ATMEL US0 Registers" +group.US0.register.0=AT91C_US0_BRGR +group.US0.register.1=AT91C_US0_NER +group.US0.register.2=AT91C_US0_CR +group.US0.register.3=AT91C_US0_IMR +group.US0.register.4=AT91C_US0_FIDI +group.US0.register.5=AT91C_US0_TTGR +group.US0.register.6=AT91C_US0_MR +group.US0.register.7=AT91C_US0_RTOR +group.US0.register.8=AT91C_US0_CSR +group.US0.register.9=AT91C_US0_RHR +group.US0.register.10=AT91C_US0_IDR +group.US0.register.11=AT91C_US0_THR +group.US0.register.12=AT91C_US0_IF +group.US0.register.13=AT91C_US0_IER +# ========== Group definition for PDC_SSC peripheral ========== +group.PDC_SSC.description="ATMEL PDC_SSC Registers" +group.PDC_SSC.helpkey="ATMEL PDC_SSC Registers" +group.PDC_SSC.register.0=AT91C_SSC_TNCR +group.PDC_SSC.register.1=AT91C_SSC_RPR +group.PDC_SSC.register.2=AT91C_SSC_RNCR +group.PDC_SSC.register.3=AT91C_SSC_TPR +group.PDC_SSC.register.4=AT91C_SSC_PTCR +group.PDC_SSC.register.5=AT91C_SSC_TCR +group.PDC_SSC.register.6=AT91C_SSC_RCR +group.PDC_SSC.register.7=AT91C_SSC_RNPR +group.PDC_SSC.register.8=AT91C_SSC_TNPR +group.PDC_SSC.register.9=AT91C_SSC_PTSR +# ========== Group definition for SSC peripheral ========== +group.SSC.description="ATMEL SSC Registers" +group.SSC.helpkey="ATMEL SSC Registers" +group.SSC.register.0=AT91C_SSC_RHR +group.SSC.register.1=AT91C_SSC_RSHR +group.SSC.register.2=AT91C_SSC_TFMR +group.SSC.register.3=AT91C_SSC_IDR +group.SSC.register.4=AT91C_SSC_THR +group.SSC.register.5=AT91C_SSC_RCMR +group.SSC.register.6=AT91C_SSC_IER +group.SSC.register.7=AT91C_SSC_TSHR +group.SSC.register.8=AT91C_SSC_SR +group.SSC.register.9=AT91C_SSC_CMR +group.SSC.register.10=AT91C_SSC_TCMR +group.SSC.register.11=AT91C_SSC_CR +group.SSC.register.12=AT91C_SSC_IMR +group.SSC.register.13=AT91C_SSC_RFMR +# ========== Group definition for TWI peripheral ========== +group.TWI.description="ATMEL TWI Registers" +group.TWI.helpkey="ATMEL TWI Registers" +group.TWI.register.0=AT91C_TWI_IER +group.TWI.register.1=AT91C_TWI_CR +group.TWI.register.2=AT91C_TWI_SR +group.TWI.register.3=AT91C_TWI_IMR +group.TWI.register.4=AT91C_TWI_THR +group.TWI.register.5=AT91C_TWI_IDR +group.TWI.register.6=AT91C_TWI_IADR +group.TWI.register.7=AT91C_TWI_MMR +group.TWI.register.8=AT91C_TWI_CWGR +group.TWI.register.9=AT91C_TWI_RHR +# ========== Group definition for PWMC_CH3 peripheral ========== +group.PWMC_CH3.description="ATMEL PWMC_CH3 Registers" +group.PWMC_CH3.helpkey="ATMEL PWMC_CH3 Registers" +group.PWMC_CH3.register.0=AT91C_PWMC_CH3_CUPDR +group.PWMC_CH3.register.1=AT91C_PWMC_CH3_Reserved +group.PWMC_CH3.register.2=AT91C_PWMC_CH3_CPRDR +group.PWMC_CH3.register.3=AT91C_PWMC_CH3_CDTYR +group.PWMC_CH3.register.4=AT91C_PWMC_CH3_CCNTR +group.PWMC_CH3.register.5=AT91C_PWMC_CH3_CMR +# ========== Group definition for PWMC_CH2 peripheral ========== +group.PWMC_CH2.description="ATMEL PWMC_CH2 Registers" +group.PWMC_CH2.helpkey="ATMEL PWMC_CH2 Registers" +group.PWMC_CH2.register.0=AT91C_PWMC_CH2_Reserved +group.PWMC_CH2.register.1=AT91C_PWMC_CH2_CMR +group.PWMC_CH2.register.2=AT91C_PWMC_CH2_CCNTR +group.PWMC_CH2.register.3=AT91C_PWMC_CH2_CPRDR +group.PWMC_CH2.register.4=AT91C_PWMC_CH2_CUPDR +group.PWMC_CH2.register.5=AT91C_PWMC_CH2_CDTYR +# ========== Group definition for PWMC_CH1 peripheral ========== +group.PWMC_CH1.description="ATMEL PWMC_CH1 Registers" +group.PWMC_CH1.helpkey="ATMEL PWMC_CH1 Registers" +group.PWMC_CH1.register.0=AT91C_PWMC_CH1_Reserved +group.PWMC_CH1.register.1=AT91C_PWMC_CH1_CUPDR +group.PWMC_CH1.register.2=AT91C_PWMC_CH1_CPRDR +group.PWMC_CH1.register.3=AT91C_PWMC_CH1_CCNTR +group.PWMC_CH1.register.4=AT91C_PWMC_CH1_CDTYR +group.PWMC_CH1.register.5=AT91C_PWMC_CH1_CMR +# ========== Group definition for PWMC_CH0 peripheral ========== +group.PWMC_CH0.description="ATMEL PWMC_CH0 Registers" +group.PWMC_CH0.helpkey="ATMEL PWMC_CH0 Registers" +group.PWMC_CH0.register.0=AT91C_PWMC_CH0_Reserved +group.PWMC_CH0.register.1=AT91C_PWMC_CH0_CPRDR +group.PWMC_CH0.register.2=AT91C_PWMC_CH0_CDTYR +group.PWMC_CH0.register.3=AT91C_PWMC_CH0_CMR +group.PWMC_CH0.register.4=AT91C_PWMC_CH0_CUPDR +group.PWMC_CH0.register.5=AT91C_PWMC_CH0_CCNTR +# ========== Group definition for PWMC peripheral ========== +group.PWMC.description="ATMEL PWMC Registers" +group.PWMC.helpkey="ATMEL PWMC Registers" +group.PWMC.register.0=AT91C_PWMC_IDR +group.PWMC.register.1=AT91C_PWMC_DIS +group.PWMC.register.2=AT91C_PWMC_IER +group.PWMC.register.3=AT91C_PWMC_VR +group.PWMC.register.4=AT91C_PWMC_ISR +group.PWMC.register.5=AT91C_PWMC_SR +group.PWMC.register.6=AT91C_PWMC_IMR +group.PWMC.register.7=AT91C_PWMC_MR +group.PWMC.register.8=AT91C_PWMC_ENA +# ========== Group definition for UDP peripheral ========== +group.UDP.description="ATMEL UDP Registers" +group.UDP.helpkey="ATMEL UDP Registers" +group.UDP.register.0=AT91C_UDP_IMR +group.UDP.register.1=AT91C_UDP_FADDR +group.UDP.register.2=AT91C_UDP_NUM +group.UDP.register.3=AT91C_UDP_FDR +group.UDP.register.4=AT91C_UDP_ISR +group.UDP.register.5=AT91C_UDP_CSR +group.UDP.register.6=AT91C_UDP_IDR +group.UDP.register.7=AT91C_UDP_ICR +group.UDP.register.8=AT91C_UDP_RSTEP +group.UDP.register.9=AT91C_UDP_TXVC +group.UDP.register.10=AT91C_UDP_GLBSTATE +group.UDP.register.11=AT91C_UDP_IER +# ========== Group definition for TC0 peripheral ========== +group.TC0.description="ATMEL TC0 Registers" +group.TC0.helpkey="ATMEL TC0 Registers" +group.TC0.register.0=AT91C_TC0_SR +group.TC0.register.1=AT91C_TC0_RC +group.TC0.register.2=AT91C_TC0_RB +group.TC0.register.3=AT91C_TC0_CCR +group.TC0.register.4=AT91C_TC0_CMR +group.TC0.register.5=AT91C_TC0_IER +group.TC0.register.6=AT91C_TC0_RA +group.TC0.register.7=AT91C_TC0_IDR +group.TC0.register.8=AT91C_TC0_CV +group.TC0.register.9=AT91C_TC0_IMR +# ========== Group definition for TC1 peripheral ========== +group.TC1.description="ATMEL TC1 Registers" +group.TC1.helpkey="ATMEL TC1 Registers" +group.TC1.register.0=AT91C_TC1_RB +group.TC1.register.1=AT91C_TC1_CCR +group.TC1.register.2=AT91C_TC1_IER +group.TC1.register.3=AT91C_TC1_IDR +group.TC1.register.4=AT91C_TC1_SR +group.TC1.register.5=AT91C_TC1_CMR +group.TC1.register.6=AT91C_TC1_RA +group.TC1.register.7=AT91C_TC1_RC +group.TC1.register.8=AT91C_TC1_IMR +group.TC1.register.9=AT91C_TC1_CV +# ========== Group definition for TC2 peripheral ========== +group.TC2.description="ATMEL TC2 Registers" +group.TC2.helpkey="ATMEL TC2 Registers" +group.TC2.register.0=AT91C_TC2_CMR +group.TC2.register.1=AT91C_TC2_CCR +group.TC2.register.2=AT91C_TC2_CV +group.TC2.register.3=AT91C_TC2_RA +group.TC2.register.4=AT91C_TC2_RB +group.TC2.register.5=AT91C_TC2_IDR +group.TC2.register.6=AT91C_TC2_IMR +group.TC2.register.7=AT91C_TC2_RC +group.TC2.register.8=AT91C_TC2_IER +group.TC2.register.9=AT91C_TC2_SR +# ========== Group definition for TCB peripheral ========== +group.TCB.description="ATMEL TCB Registers" +group.TCB.helpkey="ATMEL TCB Registers" +group.TCB.register.0=AT91C_TCB_BMR +group.TCB.register.1=AT91C_TCB_BCR +# ========== Group definition for CAN_MB0 peripheral ========== +group.CAN_MB0.description="ATMEL CAN_MB0 Registers" +group.CAN_MB0.helpkey="ATMEL CAN_MB0 Registers" +group.CAN_MB0.register.0=AT91C_CAN_MB0_MDL +group.CAN_MB0.register.1=AT91C_CAN_MB0_MAM +group.CAN_MB0.register.2=AT91C_CAN_MB0_MCR +group.CAN_MB0.register.3=AT91C_CAN_MB0_MID +group.CAN_MB0.register.4=AT91C_CAN_MB0_MSR +group.CAN_MB0.register.5=AT91C_CAN_MB0_MFID +group.CAN_MB0.register.6=AT91C_CAN_MB0_MDH +group.CAN_MB0.register.7=AT91C_CAN_MB0_MMR +# ========== Group definition for CAN_MB1 peripheral ========== +group.CAN_MB1.description="ATMEL CAN_MB1 Registers" +group.CAN_MB1.helpkey="ATMEL CAN_MB1 Registers" +group.CAN_MB1.register.0=AT91C_CAN_MB1_MDL +group.CAN_MB1.register.1=AT91C_CAN_MB1_MID +group.CAN_MB1.register.2=AT91C_CAN_MB1_MMR +group.CAN_MB1.register.3=AT91C_CAN_MB1_MSR +group.CAN_MB1.register.4=AT91C_CAN_MB1_MAM +group.CAN_MB1.register.5=AT91C_CAN_MB1_MDH +group.CAN_MB1.register.6=AT91C_CAN_MB1_MCR +group.CAN_MB1.register.7=AT91C_CAN_MB1_MFID +# ========== Group definition for CAN_MB2 peripheral ========== +group.CAN_MB2.description="ATMEL CAN_MB2 Registers" +group.CAN_MB2.helpkey="ATMEL CAN_MB2 Registers" +group.CAN_MB2.register.0=AT91C_CAN_MB2_MCR +group.CAN_MB2.register.1=AT91C_CAN_MB2_MDH +group.CAN_MB2.register.2=AT91C_CAN_MB2_MID +group.CAN_MB2.register.3=AT91C_CAN_MB2_MDL +group.CAN_MB2.register.4=AT91C_CAN_MB2_MMR +group.CAN_MB2.register.5=AT91C_CAN_MB2_MAM +group.CAN_MB2.register.6=AT91C_CAN_MB2_MFID +group.CAN_MB2.register.7=AT91C_CAN_MB2_MSR +# ========== Group definition for CAN_MB3 peripheral ========== +group.CAN_MB3.description="ATMEL CAN_MB3 Registers" +group.CAN_MB3.helpkey="ATMEL CAN_MB3 Registers" +group.CAN_MB3.register.0=AT91C_CAN_MB3_MFID +group.CAN_MB3.register.1=AT91C_CAN_MB3_MAM +group.CAN_MB3.register.2=AT91C_CAN_MB3_MID +group.CAN_MB3.register.3=AT91C_CAN_MB3_MCR +group.CAN_MB3.register.4=AT91C_CAN_MB3_MMR +group.CAN_MB3.register.5=AT91C_CAN_MB3_MSR +group.CAN_MB3.register.6=AT91C_CAN_MB3_MDL +group.CAN_MB3.register.7=AT91C_CAN_MB3_MDH +# ========== Group definition for CAN_MB4 peripheral ========== +group.CAN_MB4.description="ATMEL CAN_MB4 Registers" +group.CAN_MB4.helpkey="ATMEL CAN_MB4 Registers" +group.CAN_MB4.register.0=AT91C_CAN_MB4_MID +group.CAN_MB4.register.1=AT91C_CAN_MB4_MMR +group.CAN_MB4.register.2=AT91C_CAN_MB4_MDH +group.CAN_MB4.register.3=AT91C_CAN_MB4_MFID +group.CAN_MB4.register.4=AT91C_CAN_MB4_MSR +group.CAN_MB4.register.5=AT91C_CAN_MB4_MCR +group.CAN_MB4.register.6=AT91C_CAN_MB4_MDL +group.CAN_MB4.register.7=AT91C_CAN_MB4_MAM +# ========== Group definition for CAN_MB5 peripheral ========== +group.CAN_MB5.description="ATMEL CAN_MB5 Registers" +group.CAN_MB5.helpkey="ATMEL CAN_MB5 Registers" +group.CAN_MB5.register.0=AT91C_CAN_MB5_MSR +group.CAN_MB5.register.1=AT91C_CAN_MB5_MCR +group.CAN_MB5.register.2=AT91C_CAN_MB5_MFID +group.CAN_MB5.register.3=AT91C_CAN_MB5_MDH +group.CAN_MB5.register.4=AT91C_CAN_MB5_MID +group.CAN_MB5.register.5=AT91C_CAN_MB5_MMR +group.CAN_MB5.register.6=AT91C_CAN_MB5_MDL +group.CAN_MB5.register.7=AT91C_CAN_MB5_MAM +# ========== Group definition for CAN_MB6 peripheral ========== +group.CAN_MB6.description="ATMEL CAN_MB6 Registers" +group.CAN_MB6.helpkey="ATMEL CAN_MB6 Registers" +group.CAN_MB6.register.0=AT91C_CAN_MB6_MFID +group.CAN_MB6.register.1=AT91C_CAN_MB6_MID +group.CAN_MB6.register.2=AT91C_CAN_MB6_MAM +group.CAN_MB6.register.3=AT91C_CAN_MB6_MSR +group.CAN_MB6.register.4=AT91C_CAN_MB6_MDL +group.CAN_MB6.register.5=AT91C_CAN_MB6_MCR +group.CAN_MB6.register.6=AT91C_CAN_MB6_MDH +group.CAN_MB6.register.7=AT91C_CAN_MB6_MMR +# ========== Group definition for CAN_MB7 peripheral ========== +group.CAN_MB7.description="ATMEL CAN_MB7 Registers" +group.CAN_MB7.helpkey="ATMEL CAN_MB7 Registers" +group.CAN_MB7.register.0=AT91C_CAN_MB7_MCR +group.CAN_MB7.register.1=AT91C_CAN_MB7_MDH +group.CAN_MB7.register.2=AT91C_CAN_MB7_MFID +group.CAN_MB7.register.3=AT91C_CAN_MB7_MDL +group.CAN_MB7.register.4=AT91C_CAN_MB7_MID +group.CAN_MB7.register.5=AT91C_CAN_MB7_MMR +group.CAN_MB7.register.6=AT91C_CAN_MB7_MAM +group.CAN_MB7.register.7=AT91C_CAN_MB7_MSR +# ========== Group definition for CAN peripheral ========== +group.CAN.description="ATMEL CAN Registers" +group.CAN.helpkey="ATMEL CAN Registers" +group.CAN.register.0=AT91C_CAN_TCR +group.CAN.register.1=AT91C_CAN_IMR +group.CAN.register.2=AT91C_CAN_IER +group.CAN.register.3=AT91C_CAN_ECR +group.CAN.register.4=AT91C_CAN_TIMESTP +group.CAN.register.5=AT91C_CAN_MR +group.CAN.register.6=AT91C_CAN_IDR +group.CAN.register.7=AT91C_CAN_ACR +group.CAN.register.8=AT91C_CAN_TIM +group.CAN.register.9=AT91C_CAN_SR +group.CAN.register.10=AT91C_CAN_BR +group.CAN.register.11=AT91C_CAN_VR +# ========== Group definition for EMAC peripheral ========== +group.EMAC.description="ATMEL EMAC Registers" +group.EMAC.helpkey="ATMEL EMAC Registers" +group.EMAC.register.0=AT91C_EMAC_ISR +group.EMAC.register.1=AT91C_EMAC_SA4H +group.EMAC.register.2=AT91C_EMAC_SA1L +group.EMAC.register.3=AT91C_EMAC_ELE +group.EMAC.register.4=AT91C_EMAC_LCOL +group.EMAC.register.5=AT91C_EMAC_RLE +group.EMAC.register.6=AT91C_EMAC_WOL +group.EMAC.register.7=AT91C_EMAC_DTF +group.EMAC.register.8=AT91C_EMAC_TUND +group.EMAC.register.9=AT91C_EMAC_NCR +group.EMAC.register.10=AT91C_EMAC_SA4L +group.EMAC.register.11=AT91C_EMAC_RSR +group.EMAC.register.12=AT91C_EMAC_SA3L +group.EMAC.register.13=AT91C_EMAC_TSR +group.EMAC.register.14=AT91C_EMAC_IDR +group.EMAC.register.15=AT91C_EMAC_RSE +group.EMAC.register.16=AT91C_EMAC_ECOL +group.EMAC.register.17=AT91C_EMAC_TID +group.EMAC.register.18=AT91C_EMAC_HRB +group.EMAC.register.19=AT91C_EMAC_TBQP +group.EMAC.register.20=AT91C_EMAC_USRIO +group.EMAC.register.21=AT91C_EMAC_PTR +group.EMAC.register.22=AT91C_EMAC_SA2H +group.EMAC.register.23=AT91C_EMAC_ROV +group.EMAC.register.24=AT91C_EMAC_ALE +group.EMAC.register.25=AT91C_EMAC_RJA +group.EMAC.register.26=AT91C_EMAC_RBQP +group.EMAC.register.27=AT91C_EMAC_TPF +group.EMAC.register.28=AT91C_EMAC_NCFGR +group.EMAC.register.29=AT91C_EMAC_HRT +group.EMAC.register.30=AT91C_EMAC_USF +group.EMAC.register.31=AT91C_EMAC_FCSE +group.EMAC.register.32=AT91C_EMAC_TPQ +group.EMAC.register.33=AT91C_EMAC_MAN +group.EMAC.register.34=AT91C_EMAC_FTO +group.EMAC.register.35=AT91C_EMAC_REV +group.EMAC.register.36=AT91C_EMAC_IMR +group.EMAC.register.37=AT91C_EMAC_SCF +group.EMAC.register.38=AT91C_EMAC_PFR +group.EMAC.register.39=AT91C_EMAC_MCF +group.EMAC.register.40=AT91C_EMAC_NSR +group.EMAC.register.41=AT91C_EMAC_SA2L +group.EMAC.register.42=AT91C_EMAC_FRO +group.EMAC.register.43=AT91C_EMAC_IER +group.EMAC.register.44=AT91C_EMAC_SA1H +group.EMAC.register.45=AT91C_EMAC_CSE +group.EMAC.register.46=AT91C_EMAC_SA3H +group.EMAC.register.47=AT91C_EMAC_RRE +group.EMAC.register.48=AT91C_EMAC_STE +# ========== Group definition for PDC_ADC peripheral ========== +group.PDC_ADC.description="ATMEL PDC_ADC Registers" +group.PDC_ADC.helpkey="ATMEL PDC_ADC Registers" +group.PDC_ADC.register.0=AT91C_ADC_PTSR +group.PDC_ADC.register.1=AT91C_ADC_PTCR +group.PDC_ADC.register.2=AT91C_ADC_TNPR +group.PDC_ADC.register.3=AT91C_ADC_TNCR +group.PDC_ADC.register.4=AT91C_ADC_RNPR +group.PDC_ADC.register.5=AT91C_ADC_RNCR +group.PDC_ADC.register.6=AT91C_ADC_RPR +group.PDC_ADC.register.7=AT91C_ADC_TCR +group.PDC_ADC.register.8=AT91C_ADC_TPR +group.PDC_ADC.register.9=AT91C_ADC_RCR +# ========== Group definition for ADC peripheral ========== +group.ADC.description="ATMEL ADC Registers" +group.ADC.helpkey="ATMEL ADC Registers" +group.ADC.register.0=AT91C_ADC_CDR2 +group.ADC.register.1=AT91C_ADC_CDR3 +group.ADC.register.2=AT91C_ADC_CDR0 +group.ADC.register.3=AT91C_ADC_CDR5 +group.ADC.register.4=AT91C_ADC_CHDR +group.ADC.register.5=AT91C_ADC_SR +group.ADC.register.6=AT91C_ADC_CDR4 +group.ADC.register.7=AT91C_ADC_CDR1 +group.ADC.register.8=AT91C_ADC_LCDR +group.ADC.register.9=AT91C_ADC_IDR +group.ADC.register.10=AT91C_ADC_CR +group.ADC.register.11=AT91C_ADC_CDR7 +group.ADC.register.12=AT91C_ADC_CDR6 +group.ADC.register.13=AT91C_ADC_IER +group.ADC.register.14=AT91C_ADC_CHER +group.ADC.register.15=AT91C_ADC_CHSR +group.ADC.register.16=AT91C_ADC_MR +group.ADC.register.17=AT91C_ADC_IMR +group.AT91SAM7X256.description="ATMEL AT91SAM7X256 Registers" +group.AT91SAM7X256.helpkey="ATMEL AT91SAM7X256 Registers" +group.AT91SAM7X256.topLevelIndex=100 +group.AT91SAM7X256.group.0=SYS +group.AT91SAM7X256.group.1=AIC +group.AT91SAM7X256.group.2=PDC_DBGU +group.AT91SAM7X256.group.3=DBGU +group.AT91SAM7X256.group.4=PIOA +group.AT91SAM7X256.group.5=PIOB +group.AT91SAM7X256.group.6=CKGR +group.AT91SAM7X256.group.7=PMC +group.AT91SAM7X256.group.8=RSTC +group.AT91SAM7X256.group.9=RTTC +group.AT91SAM7X256.group.10=PITC +group.AT91SAM7X256.group.11=WDTC +group.AT91SAM7X256.group.12=VREG +group.AT91SAM7X256.group.13=MC +group.AT91SAM7X256.group.14=PDC_SPI1 +group.AT91SAM7X256.group.15=SPI1 +group.AT91SAM7X256.group.16=PDC_SPI0 +group.AT91SAM7X256.group.17=SPI0 +group.AT91SAM7X256.group.18=PDC_US1 +group.AT91SAM7X256.group.19=US1 +group.AT91SAM7X256.group.20=PDC_US0 +group.AT91SAM7X256.group.21=US0 +group.AT91SAM7X256.group.22=PDC_SSC +group.AT91SAM7X256.group.23=SSC +group.AT91SAM7X256.group.24=TWI +group.AT91SAM7X256.group.25=PWMC_CH3 +group.AT91SAM7X256.group.26=PWMC_CH2 +group.AT91SAM7X256.group.27=PWMC_CH1 +group.AT91SAM7X256.group.28=PWMC_CH0 +group.AT91SAM7X256.group.29=PWMC +group.AT91SAM7X256.group.30=UDP +group.AT91SAM7X256.group.31=TC0 +group.AT91SAM7X256.group.32=TC1 +group.AT91SAM7X256.group.33=TC2 +group.AT91SAM7X256.group.34=TCB +group.AT91SAM7X256.group.35=CAN_MB0 +group.AT91SAM7X256.group.36=CAN_MB1 +group.AT91SAM7X256.group.37=CAN_MB2 +group.AT91SAM7X256.group.38=CAN_MB3 +group.AT91SAM7X256.group.39=CAN_MB4 +group.AT91SAM7X256.group.40=CAN_MB5 +group.AT91SAM7X256.group.41=CAN_MB6 +group.AT91SAM7X256.group.42=CAN_MB7 +group.AT91SAM7X256.group.43=CAN +group.AT91SAM7X256.group.44=EMAC +group.AT91SAM7X256.group.45=PDC_ADC +group.AT91SAM7X256.group.46=ADC diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.tcl b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.tcl new file mode 100644 index 0000000..5d3a662 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.tcl @@ -0,0 +1,3407 @@ +# ---------------------------------------------------------------------------- +# ATMEL Microcontroller Software Support - ROUSSET - +# ---------------------------------------------------------------------------- +# DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +# DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ---------------------------------------------------------------------------- +# File Name : AT91SAM7X256.tcl +# Object : AT91SAM7X256 definitions +# Generated : AT91 SW Application Group 11/02/2005 (15:17:30) +# +# CVS Reference : /AT91SAM7X256.pl/1.14/Tue Sep 13 15:06:52 2005// +# CVS Reference : /SYS_SAM7X.pl/1.3/Tue Feb 1 17:01:43 2005// +# CVS Reference : /MC_SAM7X.pl/1.2/Fri May 20 14:13:04 2005// +# CVS Reference : /PMC_SAM7X.pl/1.4/Tue Feb 8 13:58:10 2005// +# CVS Reference : /RSTC_SAM7X.pl/1.2/Wed Jul 13 14:57:50 2005// +# CVS Reference : /UDP_SAM7X.pl/1.1/Tue May 10 11:35:35 2005// +# CVS Reference : /PWM_SAM7X.pl/1.1/Tue May 10 11:53:07 2005// +# CVS Reference : /AIC_6075B.pl/1.3/Fri May 20 14:01:30 2005// +# CVS Reference : /PIO_6057A.pl/1.2/Thu Feb 3 10:18:28 2005// +# CVS Reference : /RTTC_6081A.pl/1.2/Tue Nov 9 14:43:58 2004// +# CVS Reference : /PITC_6079A.pl/1.2/Tue Nov 9 14:43:56 2004// +# CVS Reference : /WDTC_6080A.pl/1.3/Tue Nov 9 14:44:00 2004// +# CVS Reference : /VREG_6085B.pl/1.1/Tue Feb 1 16:05:48 2005// +# CVS Reference : /PDC_6074C.pl/1.2/Thu Feb 3 08:48:54 2005// +# CVS Reference : /DBGU_6059D.pl/1.1/Mon Jan 31 13:15:32 2005// +# CVS Reference : /SPI_6088D.pl/1.3/Fri May 20 14:08:59 2005// +# CVS Reference : /US_6089C.pl/1.1/Mon Jul 12 18:23:26 2004// +# CVS Reference : /SSC_6078B.pl/1.1/Wed Jul 13 15:19:19 2005// +# CVS Reference : /TWI_6061A.pl/1.1/Tue Jul 13 07:38:06 2004// +# CVS Reference : /TC_6082A.pl/1.7/Fri Mar 11 12:52:17 2005// +# CVS Reference : /CAN_6019B.pl/1.1/Tue Mar 8 12:42:22 2005// +# CVS Reference : /EMACB_6119A.pl/1.6/Wed Jul 13 15:05:35 2005// +# CVS Reference : /ADC_6051C.pl/1.1/Fri Oct 17 09:12:38 2003// +# ---------------------------------------------------------------------------- + + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR System Peripherals +# ***************************************************************************** + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Advanced Interrupt Controller +# ***************************************************************************** +# -------- AIC_SMR : (AIC Offset: 0x0) Control Register -------- +set AT91C_AIC_PRIOR [expr 0x7 << 0 ] +set AT91C_AIC_PRIOR_LOWEST 0x0 +set AT91C_AIC_PRIOR_HIGHEST 0x7 +set AT91C_AIC_SRCTYPE [expr 0x3 << 5 ] +set AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL [expr 0x0 << 5 ] +set AT91C_AIC_SRCTYPE_EXT_LOW_LEVEL [expr 0x0 << 5 ] +set AT91C_AIC_SRCTYPE_INT_POSITIVE_EDGE [expr 0x1 << 5 ] +set AT91C_AIC_SRCTYPE_EXT_NEGATIVE_EDGE [expr 0x1 << 5 ] +set AT91C_AIC_SRCTYPE_HIGH_LEVEL [expr 0x2 << 5 ] +set AT91C_AIC_SRCTYPE_POSITIVE_EDGE [expr 0x3 << 5 ] +# -------- AIC_CISR : (AIC Offset: 0x114) AIC Core Interrupt Status Register -------- +set AT91C_AIC_NFIQ [expr 0x1 << 0 ] +set AT91C_AIC_NIRQ [expr 0x1 << 1 ] +# -------- AIC_DCR : (AIC Offset: 0x138) AIC Debug Control Register (Protect) -------- +set AT91C_AIC_DCR_PROT [expr 0x1 << 0 ] +set AT91C_AIC_DCR_GMSK [expr 0x1 << 1 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Peripheral DMA Controller +# ***************************************************************************** +# -------- PDC_PTCR : (PDC Offset: 0x20) PDC Transfer Control Register -------- +set AT91C_PDC_RXTEN [expr 0x1 << 0 ] +set AT91C_PDC_RXTDIS [expr 0x1 << 1 ] +set AT91C_PDC_TXTEN [expr 0x1 << 8 ] +set AT91C_PDC_TXTDIS [expr 0x1 << 9 ] +# -------- PDC_PTSR : (PDC Offset: 0x24) PDC Transfer Status Register -------- +set AT91C_PDC_RXTEN [expr 0x1 << 0 ] +set AT91C_PDC_TXTEN [expr 0x1 << 8 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Debug Unit +# ***************************************************************************** +# -------- DBGU_CR : (DBGU Offset: 0x0) Debug Unit Control Register -------- +set AT91C_US_RSTRX [expr 0x1 << 2 ] +set AT91C_US_RSTTX [expr 0x1 << 3 ] +set AT91C_US_RXEN [expr 0x1 << 4 ] +set AT91C_US_RXDIS [expr 0x1 << 5 ] +set AT91C_US_TXEN [expr 0x1 << 6 ] +set AT91C_US_TXDIS [expr 0x1 << 7 ] +set AT91C_US_RSTSTA [expr 0x1 << 8 ] +# -------- DBGU_MR : (DBGU Offset: 0x4) Debug Unit Mode Register -------- +set AT91C_US_PAR [expr 0x7 << 9 ] +set AT91C_US_PAR_EVEN [expr 0x0 << 9 ] +set AT91C_US_PAR_ODD [expr 0x1 << 9 ] +set AT91C_US_PAR_SPACE [expr 0x2 << 9 ] +set AT91C_US_PAR_MARK [expr 0x3 << 9 ] +set AT91C_US_PAR_NONE [expr 0x4 << 9 ] +set AT91C_US_PAR_MULTI_DROP [expr 0x6 << 9 ] +set AT91C_US_CHMODE [expr 0x3 << 14 ] +set AT91C_US_CHMODE_NORMAL [expr 0x0 << 14 ] +set AT91C_US_CHMODE_AUTO [expr 0x1 << 14 ] +set AT91C_US_CHMODE_LOCAL [expr 0x2 << 14 ] +set AT91C_US_CHMODE_REMOTE [expr 0x3 << 14 ] +# -------- DBGU_IER : (DBGU Offset: 0x8) Debug Unit Interrupt Enable Register -------- +set AT91C_US_RXRDY [expr 0x1 << 0 ] +set AT91C_US_TXRDY [expr 0x1 << 1 ] +set AT91C_US_ENDRX [expr 0x1 << 3 ] +set AT91C_US_ENDTX [expr 0x1 << 4 ] +set AT91C_US_OVRE [expr 0x1 << 5 ] +set AT91C_US_FRAME [expr 0x1 << 6 ] +set AT91C_US_PARE [expr 0x1 << 7 ] +set AT91C_US_TXEMPTY [expr 0x1 << 9 ] +set AT91C_US_TXBUFE [expr 0x1 << 11 ] +set AT91C_US_RXBUFF [expr 0x1 << 12 ] +set AT91C_US_COMM_TX [expr 0x1 << 30 ] +set AT91C_US_COMM_RX [expr 0x1 << 31 ] +# -------- DBGU_IDR : (DBGU Offset: 0xc) Debug Unit Interrupt Disable Register -------- +set AT91C_US_RXRDY [expr 0x1 << 0 ] +set AT91C_US_TXRDY [expr 0x1 << 1 ] +set AT91C_US_ENDRX [expr 0x1 << 3 ] +set AT91C_US_ENDTX [expr 0x1 << 4 ] +set AT91C_US_OVRE [expr 0x1 << 5 ] +set AT91C_US_FRAME [expr 0x1 << 6 ] +set AT91C_US_PARE [expr 0x1 << 7 ] +set AT91C_US_TXEMPTY [expr 0x1 << 9 ] +set AT91C_US_TXBUFE [expr 0x1 << 11 ] +set AT91C_US_RXBUFF [expr 0x1 << 12 ] +set AT91C_US_COMM_TX [expr 0x1 << 30 ] +set AT91C_US_COMM_RX [expr 0x1 << 31 ] +# -------- DBGU_IMR : (DBGU Offset: 0x10) Debug Unit Interrupt Mask Register -------- +set AT91C_US_RXRDY [expr 0x1 << 0 ] +set AT91C_US_TXRDY [expr 0x1 << 1 ] +set AT91C_US_ENDRX [expr 0x1 << 3 ] +set AT91C_US_ENDTX [expr 0x1 << 4 ] +set AT91C_US_OVRE [expr 0x1 << 5 ] +set AT91C_US_FRAME [expr 0x1 << 6 ] +set AT91C_US_PARE [expr 0x1 << 7 ] +set AT91C_US_TXEMPTY [expr 0x1 << 9 ] +set AT91C_US_TXBUFE [expr 0x1 << 11 ] +set AT91C_US_RXBUFF [expr 0x1 << 12 ] +set AT91C_US_COMM_TX [expr 0x1 << 30 ] +set AT91C_US_COMM_RX [expr 0x1 << 31 ] +# -------- DBGU_CSR : (DBGU Offset: 0x14) Debug Unit Channel Status Register -------- +set AT91C_US_RXRDY [expr 0x1 << 0 ] +set AT91C_US_TXRDY [expr 0x1 << 1 ] +set AT91C_US_ENDRX [expr 0x1 << 3 ] +set AT91C_US_ENDTX [expr 0x1 << 4 ] +set AT91C_US_OVRE [expr 0x1 << 5 ] +set AT91C_US_FRAME [expr 0x1 << 6 ] +set AT91C_US_PARE [expr 0x1 << 7 ] +set AT91C_US_TXEMPTY [expr 0x1 << 9 ] +set AT91C_US_TXBUFE [expr 0x1 << 11 ] +set AT91C_US_RXBUFF [expr 0x1 << 12 ] +set AT91C_US_COMM_TX [expr 0x1 << 30 ] +set AT91C_US_COMM_RX [expr 0x1 << 31 ] +# -------- DBGU_FNTR : (DBGU Offset: 0x48) Debug Unit FORCE_NTRST Register -------- +set AT91C_US_FORCE_NTRST [expr 0x1 << 0 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Parallel Input Output Controler +# ***************************************************************************** + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Clock Generator Controler +# ***************************************************************************** +# -------- CKGR_MOR : (CKGR Offset: 0x0) Main Oscillator Register -------- +set AT91C_CKGR_MOSCEN [expr 0x1 << 0 ] +set AT91C_CKGR_OSCBYPASS [expr 0x1 << 1 ] +set AT91C_CKGR_OSCOUNT [expr 0xFF << 8 ] +# -------- CKGR_MCFR : (CKGR Offset: 0x4) Main Clock Frequency Register -------- +set AT91C_CKGR_MAINF [expr 0xFFFF << 0 ] +set AT91C_CKGR_MAINRDY [expr 0x1 << 16 ] +# -------- CKGR_PLLR : (CKGR Offset: 0xc) PLL B Register -------- +set AT91C_CKGR_DIV [expr 0xFF << 0 ] +set AT91C_CKGR_DIV_0 0x0 +set AT91C_CKGR_DIV_BYPASS 0x1 +set AT91C_CKGR_PLLCOUNT [expr 0x3F << 8 ] +set AT91C_CKGR_OUT [expr 0x3 << 14 ] +set AT91C_CKGR_OUT_0 [expr 0x0 << 14 ] +set AT91C_CKGR_OUT_1 [expr 0x1 << 14 ] +set AT91C_CKGR_OUT_2 [expr 0x2 << 14 ] +set AT91C_CKGR_OUT_3 [expr 0x3 << 14 ] +set AT91C_CKGR_MUL [expr 0x7FF << 16 ] +set AT91C_CKGR_USBDIV [expr 0x3 << 28 ] +set AT91C_CKGR_USBDIV_0 [expr 0x0 << 28 ] +set AT91C_CKGR_USBDIV_1 [expr 0x1 << 28 ] +set AT91C_CKGR_USBDIV_2 [expr 0x2 << 28 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Power Management Controler +# ***************************************************************************** +# -------- PMC_SCER : (PMC Offset: 0x0) System Clock Enable Register -------- +set AT91C_PMC_PCK [expr 0x1 << 0 ] +set AT91C_PMC_UDP [expr 0x1 << 7 ] +set AT91C_PMC_PCK0 [expr 0x1 << 8 ] +set AT91C_PMC_PCK1 [expr 0x1 << 9 ] +set AT91C_PMC_PCK2 [expr 0x1 << 10 ] +set AT91C_PMC_PCK3 [expr 0x1 << 11 ] +# -------- PMC_SCDR : (PMC Offset: 0x4) System Clock Disable Register -------- +set AT91C_PMC_PCK [expr 0x1 << 0 ] +set AT91C_PMC_UDP [expr 0x1 << 7 ] +set AT91C_PMC_PCK0 [expr 0x1 << 8 ] +set AT91C_PMC_PCK1 [expr 0x1 << 9 ] +set AT91C_PMC_PCK2 [expr 0x1 << 10 ] +set AT91C_PMC_PCK3 [expr 0x1 << 11 ] +# -------- PMC_SCSR : (PMC Offset: 0x8) System Clock Status Register -------- +set AT91C_PMC_PCK [expr 0x1 << 0 ] +set AT91C_PMC_UDP [expr 0x1 << 7 ] +set AT91C_PMC_PCK0 [expr 0x1 << 8 ] +set AT91C_PMC_PCK1 [expr 0x1 << 9 ] +set AT91C_PMC_PCK2 [expr 0x1 << 10 ] +set AT91C_PMC_PCK3 [expr 0x1 << 11 ] +# -------- CKGR_MOR : (PMC Offset: 0x20) Main Oscillator Register -------- +set AT91C_CKGR_MOSCEN [expr 0x1 << 0 ] +set AT91C_CKGR_OSCBYPASS [expr 0x1 << 1 ] +set AT91C_CKGR_OSCOUNT [expr 0xFF << 8 ] +# -------- CKGR_MCFR : (PMC Offset: 0x24) Main Clock Frequency Register -------- +set AT91C_CKGR_MAINF [expr 0xFFFF << 0 ] +set AT91C_CKGR_MAINRDY [expr 0x1 << 16 ] +# -------- CKGR_PLLR : (PMC Offset: 0x2c) PLL B Register -------- +set AT91C_CKGR_DIV [expr 0xFF << 0 ] +set AT91C_CKGR_DIV_0 0x0 +set AT91C_CKGR_DIV_BYPASS 0x1 +set AT91C_CKGR_PLLCOUNT [expr 0x3F << 8 ] +set AT91C_CKGR_OUT [expr 0x3 << 14 ] +set AT91C_CKGR_OUT_0 [expr 0x0 << 14 ] +set AT91C_CKGR_OUT_1 [expr 0x1 << 14 ] +set AT91C_CKGR_OUT_2 [expr 0x2 << 14 ] +set AT91C_CKGR_OUT_3 [expr 0x3 << 14 ] +set AT91C_CKGR_MUL [expr 0x7FF << 16 ] +set AT91C_CKGR_USBDIV [expr 0x3 << 28 ] +set AT91C_CKGR_USBDIV_0 [expr 0x0 << 28 ] +set AT91C_CKGR_USBDIV_1 [expr 0x1 << 28 ] +set AT91C_CKGR_USBDIV_2 [expr 0x2 << 28 ] +# -------- PMC_MCKR : (PMC Offset: 0x30) Master Clock Register -------- +set AT91C_PMC_CSS [expr 0x3 << 0 ] +set AT91C_PMC_CSS_SLOW_CLK 0x0 +set AT91C_PMC_CSS_MAIN_CLK 0x1 +set AT91C_PMC_CSS_PLL_CLK 0x3 +set AT91C_PMC_PRES [expr 0x7 << 2 ] +set AT91C_PMC_PRES_CLK [expr 0x0 << 2 ] +set AT91C_PMC_PRES_CLK_2 [expr 0x1 << 2 ] +set AT91C_PMC_PRES_CLK_4 [expr 0x2 << 2 ] +set AT91C_PMC_PRES_CLK_8 [expr 0x3 << 2 ] +set AT91C_PMC_PRES_CLK_16 [expr 0x4 << 2 ] +set AT91C_PMC_PRES_CLK_32 [expr 0x5 << 2 ] +set AT91C_PMC_PRES_CLK_64 [expr 0x6 << 2 ] +# -------- PMC_PCKR : (PMC Offset: 0x40) Programmable Clock Register -------- +set AT91C_PMC_CSS [expr 0x3 << 0 ] +set AT91C_PMC_CSS_SLOW_CLK 0x0 +set AT91C_PMC_CSS_MAIN_CLK 0x1 +set AT91C_PMC_CSS_PLL_CLK 0x3 +set AT91C_PMC_PRES [expr 0x7 << 2 ] +set AT91C_PMC_PRES_CLK [expr 0x0 << 2 ] +set AT91C_PMC_PRES_CLK_2 [expr 0x1 << 2 ] +set AT91C_PMC_PRES_CLK_4 [expr 0x2 << 2 ] +set AT91C_PMC_PRES_CLK_8 [expr 0x3 << 2 ] +set AT91C_PMC_PRES_CLK_16 [expr 0x4 << 2 ] +set AT91C_PMC_PRES_CLK_32 [expr 0x5 << 2 ] +set AT91C_PMC_PRES_CLK_64 [expr 0x6 << 2 ] +# -------- PMC_IER : (PMC Offset: 0x60) PMC Interrupt Enable Register -------- +set AT91C_PMC_MOSCS [expr 0x1 << 0 ] +set AT91C_PMC_LOCK [expr 0x1 << 2 ] +set AT91C_PMC_MCKRDY [expr 0x1 << 3 ] +set AT91C_PMC_PCK0RDY [expr 0x1 << 8 ] +set AT91C_PMC_PCK1RDY [expr 0x1 << 9 ] +set AT91C_PMC_PCK2RDY [expr 0x1 << 10 ] +set AT91C_PMC_PCK3RDY [expr 0x1 << 11 ] +# -------- PMC_IDR : (PMC Offset: 0x64) PMC Interrupt Disable Register -------- +set AT91C_PMC_MOSCS [expr 0x1 << 0 ] +set AT91C_PMC_LOCK [expr 0x1 << 2 ] +set AT91C_PMC_MCKRDY [expr 0x1 << 3 ] +set AT91C_PMC_PCK0RDY [expr 0x1 << 8 ] +set AT91C_PMC_PCK1RDY [expr 0x1 << 9 ] +set AT91C_PMC_PCK2RDY [expr 0x1 << 10 ] +set AT91C_PMC_PCK3RDY [expr 0x1 << 11 ] +# -------- PMC_SR : (PMC Offset: 0x68) PMC Status Register -------- +set AT91C_PMC_MOSCS [expr 0x1 << 0 ] +set AT91C_PMC_LOCK [expr 0x1 << 2 ] +set AT91C_PMC_MCKRDY [expr 0x1 << 3 ] +set AT91C_PMC_PCK0RDY [expr 0x1 << 8 ] +set AT91C_PMC_PCK1RDY [expr 0x1 << 9 ] +set AT91C_PMC_PCK2RDY [expr 0x1 << 10 ] +set AT91C_PMC_PCK3RDY [expr 0x1 << 11 ] +# -------- PMC_IMR : (PMC Offset: 0x6c) PMC Interrupt Mask Register -------- +set AT91C_PMC_MOSCS [expr 0x1 << 0 ] +set AT91C_PMC_LOCK [expr 0x1 << 2 ] +set AT91C_PMC_MCKRDY [expr 0x1 << 3 ] +set AT91C_PMC_PCK0RDY [expr 0x1 << 8 ] +set AT91C_PMC_PCK1RDY [expr 0x1 << 9 ] +set AT91C_PMC_PCK2RDY [expr 0x1 << 10 ] +set AT91C_PMC_PCK3RDY [expr 0x1 << 11 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Reset Controller Interface +# ***************************************************************************** +# -------- RSTC_RCR : (RSTC Offset: 0x0) Reset Control Register -------- +set AT91C_RSTC_PROCRST [expr 0x1 << 0 ] +set AT91C_RSTC_PERRST [expr 0x1 << 2 ] +set AT91C_RSTC_EXTRST [expr 0x1 << 3 ] +set AT91C_RSTC_KEY [expr 0xFF << 24 ] +# -------- RSTC_RSR : (RSTC Offset: 0x4) Reset Status Register -------- +set AT91C_RSTC_URSTS [expr 0x1 << 0 ] +set AT91C_RSTC_BODSTS [expr 0x1 << 1 ] +set AT91C_RSTC_RSTTYP [expr 0x7 << 8 ] +set AT91C_RSTC_RSTTYP_POWERUP [expr 0x0 << 8 ] +set AT91C_RSTC_RSTTYP_WAKEUP [expr 0x1 << 8 ] +set AT91C_RSTC_RSTTYP_WATCHDOG [expr 0x2 << 8 ] +set AT91C_RSTC_RSTTYP_SOFTWARE [expr 0x3 << 8 ] +set AT91C_RSTC_RSTTYP_USER [expr 0x4 << 8 ] +set AT91C_RSTC_RSTTYP_BROWNOUT [expr 0x5 << 8 ] +set AT91C_RSTC_NRSTL [expr 0x1 << 16 ] +set AT91C_RSTC_SRCMP [expr 0x1 << 17 ] +# -------- RSTC_RMR : (RSTC Offset: 0x8) Reset Mode Register -------- +set AT91C_RSTC_URSTEN [expr 0x1 << 0 ] +set AT91C_RSTC_URSTIEN [expr 0x1 << 4 ] +set AT91C_RSTC_ERSTL [expr 0xF << 8 ] +set AT91C_RSTC_BODIEN [expr 0x1 << 16 ] +set AT91C_RSTC_KEY [expr 0xFF << 24 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Real Time Timer Controller Interface +# ***************************************************************************** +# -------- RTTC_RTMR : (RTTC Offset: 0x0) Real-time Mode Register -------- +set AT91C_RTTC_RTPRES [expr 0xFFFF << 0 ] +set AT91C_RTTC_ALMIEN [expr 0x1 << 16 ] +set AT91C_RTTC_RTTINCIEN [expr 0x1 << 17 ] +set AT91C_RTTC_RTTRST [expr 0x1 << 18 ] +# -------- RTTC_RTAR : (RTTC Offset: 0x4) Real-time Alarm Register -------- +set AT91C_RTTC_ALMV [expr 0x0 << 0 ] +# -------- RTTC_RTVR : (RTTC Offset: 0x8) Current Real-time Value Register -------- +set AT91C_RTTC_CRTV [expr 0x0 << 0 ] +# -------- RTTC_RTSR : (RTTC Offset: 0xc) Real-time Status Register -------- +set AT91C_RTTC_ALMS [expr 0x1 << 0 ] +set AT91C_RTTC_RTTINC [expr 0x1 << 1 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Periodic Interval Timer Controller Interface +# ***************************************************************************** +# -------- PITC_PIMR : (PITC Offset: 0x0) Periodic Interval Mode Register -------- +set AT91C_PITC_PIV [expr 0xFFFFF << 0 ] +set AT91C_PITC_PITEN [expr 0x1 << 24 ] +set AT91C_PITC_PITIEN [expr 0x1 << 25 ] +# -------- PITC_PISR : (PITC Offset: 0x4) Periodic Interval Status Register -------- +set AT91C_PITC_PITS [expr 0x1 << 0 ] +# -------- PITC_PIVR : (PITC Offset: 0x8) Periodic Interval Value Register -------- +set AT91C_PITC_CPIV [expr 0xFFFFF << 0 ] +set AT91C_PITC_PICNT [expr 0xFFF << 20 ] +# -------- PITC_PIIR : (PITC Offset: 0xc) Periodic Interval Image Register -------- +set AT91C_PITC_CPIV [expr 0xFFFFF << 0 ] +set AT91C_PITC_PICNT [expr 0xFFF << 20 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Watchdog Timer Controller Interface +# ***************************************************************************** +# -------- WDTC_WDCR : (WDTC Offset: 0x0) Periodic Interval Image Register -------- +set AT91C_WDTC_WDRSTT [expr 0x1 << 0 ] +set AT91C_WDTC_KEY [expr 0xFF << 24 ] +# -------- WDTC_WDMR : (WDTC Offset: 0x4) Watchdog Mode Register -------- +set AT91C_WDTC_WDV [expr 0xFFF << 0 ] +set AT91C_WDTC_WDFIEN [expr 0x1 << 12 ] +set AT91C_WDTC_WDRSTEN [expr 0x1 << 13 ] +set AT91C_WDTC_WDRPROC [expr 0x1 << 14 ] +set AT91C_WDTC_WDDIS [expr 0x1 << 15 ] +set AT91C_WDTC_WDD [expr 0xFFF << 16 ] +set AT91C_WDTC_WDDBGHLT [expr 0x1 << 28 ] +set AT91C_WDTC_WDIDLEHLT [expr 0x1 << 29 ] +# -------- WDTC_WDSR : (WDTC Offset: 0x8) Watchdog Status Register -------- +set AT91C_WDTC_WDUNF [expr 0x1 << 0 ] +set AT91C_WDTC_WDERR [expr 0x1 << 1 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Voltage Regulator Mode Controller Interface +# ***************************************************************************** +# -------- VREG_MR : (VREG Offset: 0x0) Voltage Regulator Mode Register -------- +set AT91C_VREG_PSTDBY [expr 0x1 << 0 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Memory Controller Interface +# ***************************************************************************** +# -------- MC_RCR : (MC Offset: 0x0) MC Remap Control Register -------- +set AT91C_MC_RCB [expr 0x1 << 0 ] +# -------- MC_ASR : (MC Offset: 0x4) MC Abort Status Register -------- +set AT91C_MC_UNDADD [expr 0x1 << 0 ] +set AT91C_MC_MISADD [expr 0x1 << 1 ] +set AT91C_MC_ABTSZ [expr 0x3 << 8 ] +set AT91C_MC_ABTSZ_BYTE [expr 0x0 << 8 ] +set AT91C_MC_ABTSZ_HWORD [expr 0x1 << 8 ] +set AT91C_MC_ABTSZ_WORD [expr 0x2 << 8 ] +set AT91C_MC_ABTTYP [expr 0x3 << 10 ] +set AT91C_MC_ABTTYP_DATAR [expr 0x0 << 10 ] +set AT91C_MC_ABTTYP_DATAW [expr 0x1 << 10 ] +set AT91C_MC_ABTTYP_FETCH [expr 0x2 << 10 ] +set AT91C_MC_MST0 [expr 0x1 << 16 ] +set AT91C_MC_MST1 [expr 0x1 << 17 ] +set AT91C_MC_SVMST0 [expr 0x1 << 24 ] +set AT91C_MC_SVMST1 [expr 0x1 << 25 ] +# -------- MC_FMR : (MC Offset: 0x60) MC Flash Mode Register -------- +set AT91C_MC_FRDY [expr 0x1 << 0 ] +set AT91C_MC_LOCKE [expr 0x1 << 2 ] +set AT91C_MC_PROGE [expr 0x1 << 3 ] +set AT91C_MC_NEBP [expr 0x1 << 7 ] +set AT91C_MC_FWS [expr 0x3 << 8 ] +set AT91C_MC_FWS_0FWS [expr 0x0 << 8 ] +set AT91C_MC_FWS_1FWS [expr 0x1 << 8 ] +set AT91C_MC_FWS_2FWS [expr 0x2 << 8 ] +set AT91C_MC_FWS_3FWS [expr 0x3 << 8 ] +set AT91C_MC_FMCN [expr 0xFF << 16 ] +# -------- MC_FCR : (MC Offset: 0x64) MC Flash Command Register -------- +set AT91C_MC_FCMD [expr 0xF << 0 ] +set AT91C_MC_FCMD_START_PROG 0x1 +set AT91C_MC_FCMD_LOCK 0x2 +set AT91C_MC_FCMD_PROG_AND_LOCK 0x3 +set AT91C_MC_FCMD_UNLOCK 0x4 +set AT91C_MC_FCMD_ERASE_ALL 0x8 +set AT91C_MC_FCMD_SET_GP_NVM 0xB +set AT91C_MC_FCMD_CLR_GP_NVM 0xD +set AT91C_MC_FCMD_SET_SECURITY 0xF +set AT91C_MC_PAGEN [expr 0x3FF << 8 ] +set AT91C_MC_KEY [expr 0xFF << 24 ] +# -------- MC_FSR : (MC Offset: 0x68) MC Flash Command Register -------- +set AT91C_MC_FRDY [expr 0x1 << 0 ] +set AT91C_MC_LOCKE [expr 0x1 << 2 ] +set AT91C_MC_PROGE [expr 0x1 << 3 ] +set AT91C_MC_SECURITY [expr 0x1 << 4 ] +set AT91C_MC_GPNVM0 [expr 0x1 << 8 ] +set AT91C_MC_GPNVM1 [expr 0x1 << 9 ] +set AT91C_MC_GPNVM2 [expr 0x1 << 10 ] +set AT91C_MC_GPNVM3 [expr 0x1 << 11 ] +set AT91C_MC_GPNVM4 [expr 0x1 << 12 ] +set AT91C_MC_GPNVM5 [expr 0x1 << 13 ] +set AT91C_MC_GPNVM6 [expr 0x1 << 14 ] +set AT91C_MC_GPNVM7 [expr 0x1 << 15 ] +set AT91C_MC_LOCKS0 [expr 0x1 << 16 ] +set AT91C_MC_LOCKS1 [expr 0x1 << 17 ] +set AT91C_MC_LOCKS2 [expr 0x1 << 18 ] +set AT91C_MC_LOCKS3 [expr 0x1 << 19 ] +set AT91C_MC_LOCKS4 [expr 0x1 << 20 ] +set AT91C_MC_LOCKS5 [expr 0x1 << 21 ] +set AT91C_MC_LOCKS6 [expr 0x1 << 22 ] +set AT91C_MC_LOCKS7 [expr 0x1 << 23 ] +set AT91C_MC_LOCKS8 [expr 0x1 << 24 ] +set AT91C_MC_LOCKS9 [expr 0x1 << 25 ] +set AT91C_MC_LOCKS10 [expr 0x1 << 26 ] +set AT91C_MC_LOCKS11 [expr 0x1 << 27 ] +set AT91C_MC_LOCKS12 [expr 0x1 << 28 ] +set AT91C_MC_LOCKS13 [expr 0x1 << 29 ] +set AT91C_MC_LOCKS14 [expr 0x1 << 30 ] +set AT91C_MC_LOCKS15 [expr 0x1 << 31 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Serial Parallel Interface +# ***************************************************************************** +# -------- SPI_CR : (SPI Offset: 0x0) SPI Control Register -------- +set AT91C_SPI_SPIEN [expr 0x1 << 0 ] +set AT91C_SPI_SPIDIS [expr 0x1 << 1 ] +set AT91C_SPI_SWRST [expr 0x1 << 7 ] +set AT91C_SPI_LASTXFER [expr 0x1 << 24 ] +# -------- SPI_MR : (SPI Offset: 0x4) SPI Mode Register -------- +set AT91C_SPI_MSTR [expr 0x1 << 0 ] +set AT91C_SPI_PS [expr 0x1 << 1 ] +set AT91C_SPI_PS_FIXED [expr 0x0 << 1 ] +set AT91C_SPI_PS_VARIABLE [expr 0x1 << 1 ] +set AT91C_SPI_PCSDEC [expr 0x1 << 2 ] +set AT91C_SPI_FDIV [expr 0x1 << 3 ] +set AT91C_SPI_MODFDIS [expr 0x1 << 4 ] +set AT91C_SPI_LLB [expr 0x1 << 7 ] +set AT91C_SPI_PCS [expr 0xF << 16 ] +set AT91C_SPI_DLYBCS [expr 0xFF << 24 ] +# -------- SPI_RDR : (SPI Offset: 0x8) Receive Data Register -------- +set AT91C_SPI_RD [expr 0xFFFF << 0 ] +set AT91C_SPI_RPCS [expr 0xF << 16 ] +# -------- SPI_TDR : (SPI Offset: 0xc) Transmit Data Register -------- +set AT91C_SPI_TD [expr 0xFFFF << 0 ] +set AT91C_SPI_TPCS [expr 0xF << 16 ] +set AT91C_SPI_LASTXFER [expr 0x1 << 24 ] +# -------- SPI_SR : (SPI Offset: 0x10) Status Register -------- +set AT91C_SPI_RDRF [expr 0x1 << 0 ] +set AT91C_SPI_TDRE [expr 0x1 << 1 ] +set AT91C_SPI_MODF [expr 0x1 << 2 ] +set AT91C_SPI_OVRES [expr 0x1 << 3 ] +set AT91C_SPI_ENDRX [expr 0x1 << 4 ] +set AT91C_SPI_ENDTX [expr 0x1 << 5 ] +set AT91C_SPI_RXBUFF [expr 0x1 << 6 ] +set AT91C_SPI_TXBUFE [expr 0x1 << 7 ] +set AT91C_SPI_NSSR [expr 0x1 << 8 ] +set AT91C_SPI_TXEMPTY [expr 0x1 << 9 ] +set AT91C_SPI_SPIENS [expr 0x1 << 16 ] +# -------- SPI_IER : (SPI Offset: 0x14) Interrupt Enable Register -------- +set AT91C_SPI_RDRF [expr 0x1 << 0 ] +set AT91C_SPI_TDRE [expr 0x1 << 1 ] +set AT91C_SPI_MODF [expr 0x1 << 2 ] +set AT91C_SPI_OVRES [expr 0x1 << 3 ] +set AT91C_SPI_ENDRX [expr 0x1 << 4 ] +set AT91C_SPI_ENDTX [expr 0x1 << 5 ] +set AT91C_SPI_RXBUFF [expr 0x1 << 6 ] +set AT91C_SPI_TXBUFE [expr 0x1 << 7 ] +set AT91C_SPI_NSSR [expr 0x1 << 8 ] +set AT91C_SPI_TXEMPTY [expr 0x1 << 9 ] +# -------- SPI_IDR : (SPI Offset: 0x18) Interrupt Disable Register -------- +set AT91C_SPI_RDRF [expr 0x1 << 0 ] +set AT91C_SPI_TDRE [expr 0x1 << 1 ] +set AT91C_SPI_MODF [expr 0x1 << 2 ] +set AT91C_SPI_OVRES [expr 0x1 << 3 ] +set AT91C_SPI_ENDRX [expr 0x1 << 4 ] +set AT91C_SPI_ENDTX [expr 0x1 << 5 ] +set AT91C_SPI_RXBUFF [expr 0x1 << 6 ] +set AT91C_SPI_TXBUFE [expr 0x1 << 7 ] +set AT91C_SPI_NSSR [expr 0x1 << 8 ] +set AT91C_SPI_TXEMPTY [expr 0x1 << 9 ] +# -------- SPI_IMR : (SPI Offset: 0x1c) Interrupt Mask Register -------- +set AT91C_SPI_RDRF [expr 0x1 << 0 ] +set AT91C_SPI_TDRE [expr 0x1 << 1 ] +set AT91C_SPI_MODF [expr 0x1 << 2 ] +set AT91C_SPI_OVRES [expr 0x1 << 3 ] +set AT91C_SPI_ENDRX [expr 0x1 << 4 ] +set AT91C_SPI_ENDTX [expr 0x1 << 5 ] +set AT91C_SPI_RXBUFF [expr 0x1 << 6 ] +set AT91C_SPI_TXBUFE [expr 0x1 << 7 ] +set AT91C_SPI_NSSR [expr 0x1 << 8 ] +set AT91C_SPI_TXEMPTY [expr 0x1 << 9 ] +# -------- SPI_CSR : (SPI Offset: 0x30) Chip Select Register -------- +set AT91C_SPI_CPOL [expr 0x1 << 0 ] +set AT91C_SPI_NCPHA [expr 0x1 << 1 ] +set AT91C_SPI_CSAAT [expr 0x1 << 3 ] +set AT91C_SPI_BITS [expr 0xF << 4 ] +set AT91C_SPI_BITS_8 [expr 0x0 << 4 ] +set AT91C_SPI_BITS_9 [expr 0x1 << 4 ] +set AT91C_SPI_BITS_10 [expr 0x2 << 4 ] +set AT91C_SPI_BITS_11 [expr 0x3 << 4 ] +set AT91C_SPI_BITS_12 [expr 0x4 << 4 ] +set AT91C_SPI_BITS_13 [expr 0x5 << 4 ] +set AT91C_SPI_BITS_14 [expr 0x6 << 4 ] +set AT91C_SPI_BITS_15 [expr 0x7 << 4 ] +set AT91C_SPI_BITS_16 [expr 0x8 << 4 ] +set AT91C_SPI_SCBR [expr 0xFF << 8 ] +set AT91C_SPI_DLYBS [expr 0xFF << 16 ] +set AT91C_SPI_DLYBCT [expr 0xFF << 24 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Usart +# ***************************************************************************** +# -------- US_CR : (USART Offset: 0x0) Debug Unit Control Register -------- +set AT91C_US_RSTRX [expr 0x1 << 2 ] +set AT91C_US_RSTTX [expr 0x1 << 3 ] +set AT91C_US_RXEN [expr 0x1 << 4 ] +set AT91C_US_RXDIS [expr 0x1 << 5 ] +set AT91C_US_TXEN [expr 0x1 << 6 ] +set AT91C_US_TXDIS [expr 0x1 << 7 ] +set AT91C_US_RSTSTA [expr 0x1 << 8 ] +set AT91C_US_STTBRK [expr 0x1 << 9 ] +set AT91C_US_STPBRK [expr 0x1 << 10 ] +set AT91C_US_STTTO [expr 0x1 << 11 ] +set AT91C_US_SENDA [expr 0x1 << 12 ] +set AT91C_US_RSTIT [expr 0x1 << 13 ] +set AT91C_US_RSTNACK [expr 0x1 << 14 ] +set AT91C_US_RETTO [expr 0x1 << 15 ] +set AT91C_US_DTREN [expr 0x1 << 16 ] +set AT91C_US_DTRDIS [expr 0x1 << 17 ] +set AT91C_US_RTSEN [expr 0x1 << 18 ] +set AT91C_US_RTSDIS [expr 0x1 << 19 ] +# -------- US_MR : (USART Offset: 0x4) Debug Unit Mode Register -------- +set AT91C_US_USMODE [expr 0xF << 0 ] +set AT91C_US_USMODE_NORMAL 0x0 +set AT91C_US_USMODE_RS485 0x1 +set AT91C_US_USMODE_HWHSH 0x2 +set AT91C_US_USMODE_MODEM 0x3 +set AT91C_US_USMODE_ISO7816_0 0x4 +set AT91C_US_USMODE_ISO7816_1 0x6 +set AT91C_US_USMODE_IRDA 0x8 +set AT91C_US_USMODE_SWHSH 0xC +set AT91C_US_CLKS [expr 0x3 << 4 ] +set AT91C_US_CLKS_CLOCK [expr 0x0 << 4 ] +set AT91C_US_CLKS_FDIV1 [expr 0x1 << 4 ] +set AT91C_US_CLKS_SLOW [expr 0x2 << 4 ] +set AT91C_US_CLKS_EXT [expr 0x3 << 4 ] +set AT91C_US_CHRL [expr 0x3 << 6 ] +set AT91C_US_CHRL_5_BITS [expr 0x0 << 6 ] +set AT91C_US_CHRL_6_BITS [expr 0x1 << 6 ] +set AT91C_US_CHRL_7_BITS [expr 0x2 << 6 ] +set AT91C_US_CHRL_8_BITS [expr 0x3 << 6 ] +set AT91C_US_SYNC [expr 0x1 << 8 ] +set AT91C_US_PAR [expr 0x7 << 9 ] +set AT91C_US_PAR_EVEN [expr 0x0 << 9 ] +set AT91C_US_PAR_ODD [expr 0x1 << 9 ] +set AT91C_US_PAR_SPACE [expr 0x2 << 9 ] +set AT91C_US_PAR_MARK [expr 0x3 << 9 ] +set AT91C_US_PAR_NONE [expr 0x4 << 9 ] +set AT91C_US_PAR_MULTI_DROP [expr 0x6 << 9 ] +set AT91C_US_NBSTOP [expr 0x3 << 12 ] +set AT91C_US_NBSTOP_1_BIT [expr 0x0 << 12 ] +set AT91C_US_NBSTOP_15_BIT [expr 0x1 << 12 ] +set AT91C_US_NBSTOP_2_BIT [expr 0x2 << 12 ] +set AT91C_US_CHMODE [expr 0x3 << 14 ] +set AT91C_US_CHMODE_NORMAL [expr 0x0 << 14 ] +set AT91C_US_CHMODE_AUTO [expr 0x1 << 14 ] +set AT91C_US_CHMODE_LOCAL [expr 0x2 << 14 ] +set AT91C_US_CHMODE_REMOTE [expr 0x3 << 14 ] +set AT91C_US_MSBF [expr 0x1 << 16 ] +set AT91C_US_MODE9 [expr 0x1 << 17 ] +set AT91C_US_CKLO [expr 0x1 << 18 ] +set AT91C_US_OVER [expr 0x1 << 19 ] +set AT91C_US_INACK [expr 0x1 << 20 ] +set AT91C_US_DSNACK [expr 0x1 << 21 ] +set AT91C_US_MAX_ITER [expr 0x1 << 24 ] +set AT91C_US_FILTER [expr 0x1 << 28 ] +# -------- US_IER : (USART Offset: 0x8) Debug Unit Interrupt Enable Register -------- +set AT91C_US_RXRDY [expr 0x1 << 0 ] +set AT91C_US_TXRDY [expr 0x1 << 1 ] +set AT91C_US_RXBRK [expr 0x1 << 2 ] +set AT91C_US_ENDRX [expr 0x1 << 3 ] +set AT91C_US_ENDTX [expr 0x1 << 4 ] +set AT91C_US_OVRE [expr 0x1 << 5 ] +set AT91C_US_FRAME [expr 0x1 << 6 ] +set AT91C_US_PARE [expr 0x1 << 7 ] +set AT91C_US_TIMEOUT [expr 0x1 << 8 ] +set AT91C_US_TXEMPTY [expr 0x1 << 9 ] +set AT91C_US_ITERATION [expr 0x1 << 10 ] +set AT91C_US_TXBUFE [expr 0x1 << 11 ] +set AT91C_US_RXBUFF [expr 0x1 << 12 ] +set AT91C_US_NACK [expr 0x1 << 13 ] +set AT91C_US_RIIC [expr 0x1 << 16 ] +set AT91C_US_DSRIC [expr 0x1 << 17 ] +set AT91C_US_DCDIC [expr 0x1 << 18 ] +set AT91C_US_CTSIC [expr 0x1 << 19 ] +# -------- US_IDR : (USART Offset: 0xc) Debug Unit Interrupt Disable Register -------- +set AT91C_US_RXRDY [expr 0x1 << 0 ] +set AT91C_US_TXRDY [expr 0x1 << 1 ] +set AT91C_US_RXBRK [expr 0x1 << 2 ] +set AT91C_US_ENDRX [expr 0x1 << 3 ] +set AT91C_US_ENDTX [expr 0x1 << 4 ] +set AT91C_US_OVRE [expr 0x1 << 5 ] +set AT91C_US_FRAME [expr 0x1 << 6 ] +set AT91C_US_PARE [expr 0x1 << 7 ] +set AT91C_US_TIMEOUT [expr 0x1 << 8 ] +set AT91C_US_TXEMPTY [expr 0x1 << 9 ] +set AT91C_US_ITERATION [expr 0x1 << 10 ] +set AT91C_US_TXBUFE [expr 0x1 << 11 ] +set AT91C_US_RXBUFF [expr 0x1 << 12 ] +set AT91C_US_NACK [expr 0x1 << 13 ] +set AT91C_US_RIIC [expr 0x1 << 16 ] +set AT91C_US_DSRIC [expr 0x1 << 17 ] +set AT91C_US_DCDIC [expr 0x1 << 18 ] +set AT91C_US_CTSIC [expr 0x1 << 19 ] +# -------- US_IMR : (USART Offset: 0x10) Debug Unit Interrupt Mask Register -------- +set AT91C_US_RXRDY [expr 0x1 << 0 ] +set AT91C_US_TXRDY [expr 0x1 << 1 ] +set AT91C_US_RXBRK [expr 0x1 << 2 ] +set AT91C_US_ENDRX [expr 0x1 << 3 ] +set AT91C_US_ENDTX [expr 0x1 << 4 ] +set AT91C_US_OVRE [expr 0x1 << 5 ] +set AT91C_US_FRAME [expr 0x1 << 6 ] +set AT91C_US_PARE [expr 0x1 << 7 ] +set AT91C_US_TIMEOUT [expr 0x1 << 8 ] +set AT91C_US_TXEMPTY [expr 0x1 << 9 ] +set AT91C_US_ITERATION [expr 0x1 << 10 ] +set AT91C_US_TXBUFE [expr 0x1 << 11 ] +set AT91C_US_RXBUFF [expr 0x1 << 12 ] +set AT91C_US_NACK [expr 0x1 << 13 ] +set AT91C_US_RIIC [expr 0x1 << 16 ] +set AT91C_US_DSRIC [expr 0x1 << 17 ] +set AT91C_US_DCDIC [expr 0x1 << 18 ] +set AT91C_US_CTSIC [expr 0x1 << 19 ] +# -------- US_CSR : (USART Offset: 0x14) Debug Unit Channel Status Register -------- +set AT91C_US_RXRDY [expr 0x1 << 0 ] +set AT91C_US_TXRDY [expr 0x1 << 1 ] +set AT91C_US_RXBRK [expr 0x1 << 2 ] +set AT91C_US_ENDRX [expr 0x1 << 3 ] +set AT91C_US_ENDTX [expr 0x1 << 4 ] +set AT91C_US_OVRE [expr 0x1 << 5 ] +set AT91C_US_FRAME [expr 0x1 << 6 ] +set AT91C_US_PARE [expr 0x1 << 7 ] +set AT91C_US_TIMEOUT [expr 0x1 << 8 ] +set AT91C_US_TXEMPTY [expr 0x1 << 9 ] +set AT91C_US_ITERATION [expr 0x1 << 10 ] +set AT91C_US_TXBUFE [expr 0x1 << 11 ] +set AT91C_US_RXBUFF [expr 0x1 << 12 ] +set AT91C_US_NACK [expr 0x1 << 13 ] +set AT91C_US_RIIC [expr 0x1 << 16 ] +set AT91C_US_DSRIC [expr 0x1 << 17 ] +set AT91C_US_DCDIC [expr 0x1 << 18 ] +set AT91C_US_CTSIC [expr 0x1 << 19 ] +set AT91C_US_RI [expr 0x1 << 20 ] +set AT91C_US_DSR [expr 0x1 << 21 ] +set AT91C_US_DCD [expr 0x1 << 22 ] +set AT91C_US_CTS [expr 0x1 << 23 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Synchronous Serial Controller Interface +# ***************************************************************************** +# -------- SSC_CR : (SSC Offset: 0x0) SSC Control Register -------- +set AT91C_SSC_RXEN [expr 0x1 << 0 ] +set AT91C_SSC_RXDIS [expr 0x1 << 1 ] +set AT91C_SSC_TXEN [expr 0x1 << 8 ] +set AT91C_SSC_TXDIS [expr 0x1 << 9 ] +set AT91C_SSC_SWRST [expr 0x1 << 15 ] +# -------- SSC_RCMR : (SSC Offset: 0x10) SSC Receive Clock Mode Register -------- +set AT91C_SSC_CKS [expr 0x3 << 0 ] +set AT91C_SSC_CKS_DIV 0x0 +set AT91C_SSC_CKS_TK 0x1 +set AT91C_SSC_CKS_RK 0x2 +set AT91C_SSC_CKO [expr 0x7 << 2 ] +set AT91C_SSC_CKO_NONE [expr 0x0 << 2 ] +set AT91C_SSC_CKO_CONTINOUS [expr 0x1 << 2 ] +set AT91C_SSC_CKO_DATA_TX [expr 0x2 << 2 ] +set AT91C_SSC_CKI [expr 0x1 << 5 ] +set AT91C_SSC_CKG [expr 0x3 << 6 ] +set AT91C_SSC_CKG_NONE [expr 0x0 << 6 ] +set AT91C_SSC_CKG_LOW [expr 0x1 << 6 ] +set AT91C_SSC_CKG_HIGH [expr 0x2 << 6 ] +set AT91C_SSC_START [expr 0xF << 8 ] +set AT91C_SSC_START_CONTINOUS [expr 0x0 << 8 ] +set AT91C_SSC_START_TX [expr 0x1 << 8 ] +set AT91C_SSC_START_LOW_RF [expr 0x2 << 8 ] +set AT91C_SSC_START_HIGH_RF [expr 0x3 << 8 ] +set AT91C_SSC_START_FALL_RF [expr 0x4 << 8 ] +set AT91C_SSC_START_RISE_RF [expr 0x5 << 8 ] +set AT91C_SSC_START_LEVEL_RF [expr 0x6 << 8 ] +set AT91C_SSC_START_EDGE_RF [expr 0x7 << 8 ] +set AT91C_SSC_START_0 [expr 0x8 << 8 ] +set AT91C_SSC_STOP [expr 0x1 << 12 ] +set AT91C_SSC_STTDLY [expr 0xFF << 16 ] +set AT91C_SSC_PERIOD [expr 0xFF << 24 ] +# -------- SSC_RFMR : (SSC Offset: 0x14) SSC Receive Frame Mode Register -------- +set AT91C_SSC_DATLEN [expr 0x1F << 0 ] +set AT91C_SSC_LOOP [expr 0x1 << 5 ] +set AT91C_SSC_MSBF [expr 0x1 << 7 ] +set AT91C_SSC_DATNB [expr 0xF << 8 ] +set AT91C_SSC_FSLEN [expr 0xF << 16 ] +set AT91C_SSC_FSOS [expr 0x7 << 20 ] +set AT91C_SSC_FSOS_NONE [expr 0x0 << 20 ] +set AT91C_SSC_FSOS_NEGATIVE [expr 0x1 << 20 ] +set AT91C_SSC_FSOS_POSITIVE [expr 0x2 << 20 ] +set AT91C_SSC_FSOS_LOW [expr 0x3 << 20 ] +set AT91C_SSC_FSOS_HIGH [expr 0x4 << 20 ] +set AT91C_SSC_FSOS_TOGGLE [expr 0x5 << 20 ] +set AT91C_SSC_FSEDGE [expr 0x1 << 24 ] +# -------- SSC_TCMR : (SSC Offset: 0x18) SSC Transmit Clock Mode Register -------- +set AT91C_SSC_CKS [expr 0x3 << 0 ] +set AT91C_SSC_CKS_DIV 0x0 +set AT91C_SSC_CKS_TK 0x1 +set AT91C_SSC_CKS_RK 0x2 +set AT91C_SSC_CKO [expr 0x7 << 2 ] +set AT91C_SSC_CKO_NONE [expr 0x0 << 2 ] +set AT91C_SSC_CKO_CONTINOUS [expr 0x1 << 2 ] +set AT91C_SSC_CKO_DATA_TX [expr 0x2 << 2 ] +set AT91C_SSC_CKI [expr 0x1 << 5 ] +set AT91C_SSC_CKG [expr 0x3 << 6 ] +set AT91C_SSC_CKG_NONE [expr 0x0 << 6 ] +set AT91C_SSC_CKG_LOW [expr 0x1 << 6 ] +set AT91C_SSC_CKG_HIGH [expr 0x2 << 6 ] +set AT91C_SSC_START [expr 0xF << 8 ] +set AT91C_SSC_START_CONTINOUS [expr 0x0 << 8 ] +set AT91C_SSC_START_TX [expr 0x1 << 8 ] +set AT91C_SSC_START_LOW_RF [expr 0x2 << 8 ] +set AT91C_SSC_START_HIGH_RF [expr 0x3 << 8 ] +set AT91C_SSC_START_FALL_RF [expr 0x4 << 8 ] +set AT91C_SSC_START_RISE_RF [expr 0x5 << 8 ] +set AT91C_SSC_START_LEVEL_RF [expr 0x6 << 8 ] +set AT91C_SSC_START_EDGE_RF [expr 0x7 << 8 ] +set AT91C_SSC_START_0 [expr 0x8 << 8 ] +set AT91C_SSC_STTDLY [expr 0xFF << 16 ] +set AT91C_SSC_PERIOD [expr 0xFF << 24 ] +# -------- SSC_TFMR : (SSC Offset: 0x1c) SSC Transmit Frame Mode Register -------- +set AT91C_SSC_DATLEN [expr 0x1F << 0 ] +set AT91C_SSC_DATDEF [expr 0x1 << 5 ] +set AT91C_SSC_MSBF [expr 0x1 << 7 ] +set AT91C_SSC_DATNB [expr 0xF << 8 ] +set AT91C_SSC_FSLEN [expr 0xF << 16 ] +set AT91C_SSC_FSOS [expr 0x7 << 20 ] +set AT91C_SSC_FSOS_NONE [expr 0x0 << 20 ] +set AT91C_SSC_FSOS_NEGATIVE [expr 0x1 << 20 ] +set AT91C_SSC_FSOS_POSITIVE [expr 0x2 << 20 ] +set AT91C_SSC_FSOS_LOW [expr 0x3 << 20 ] +set AT91C_SSC_FSOS_HIGH [expr 0x4 << 20 ] +set AT91C_SSC_FSOS_TOGGLE [expr 0x5 << 20 ] +set AT91C_SSC_FSDEN [expr 0x1 << 23 ] +set AT91C_SSC_FSEDGE [expr 0x1 << 24 ] +# -------- SSC_SR : (SSC Offset: 0x40) SSC Status Register -------- +set AT91C_SSC_TXRDY [expr 0x1 << 0 ] +set AT91C_SSC_TXEMPTY [expr 0x1 << 1 ] +set AT91C_SSC_ENDTX [expr 0x1 << 2 ] +set AT91C_SSC_TXBUFE [expr 0x1 << 3 ] +set AT91C_SSC_RXRDY [expr 0x1 << 4 ] +set AT91C_SSC_OVRUN [expr 0x1 << 5 ] +set AT91C_SSC_ENDRX [expr 0x1 << 6 ] +set AT91C_SSC_RXBUFF [expr 0x1 << 7 ] +set AT91C_SSC_CP0 [expr 0x1 << 8 ] +set AT91C_SSC_CP1 [expr 0x1 << 9 ] +set AT91C_SSC_TXSYN [expr 0x1 << 10 ] +set AT91C_SSC_RXSYN [expr 0x1 << 11 ] +set AT91C_SSC_TXENA [expr 0x1 << 16 ] +set AT91C_SSC_RXENA [expr 0x1 << 17 ] +# -------- SSC_IER : (SSC Offset: 0x44) SSC Interrupt Enable Register -------- +set AT91C_SSC_TXRDY [expr 0x1 << 0 ] +set AT91C_SSC_TXEMPTY [expr 0x1 << 1 ] +set AT91C_SSC_ENDTX [expr 0x1 << 2 ] +set AT91C_SSC_TXBUFE [expr 0x1 << 3 ] +set AT91C_SSC_RXRDY [expr 0x1 << 4 ] +set AT91C_SSC_OVRUN [expr 0x1 << 5 ] +set AT91C_SSC_ENDRX [expr 0x1 << 6 ] +set AT91C_SSC_RXBUFF [expr 0x1 << 7 ] +set AT91C_SSC_CP0 [expr 0x1 << 8 ] +set AT91C_SSC_CP1 [expr 0x1 << 9 ] +set AT91C_SSC_TXSYN [expr 0x1 << 10 ] +set AT91C_SSC_RXSYN [expr 0x1 << 11 ] +# -------- SSC_IDR : (SSC Offset: 0x48) SSC Interrupt Disable Register -------- +set AT91C_SSC_TXRDY [expr 0x1 << 0 ] +set AT91C_SSC_TXEMPTY [expr 0x1 << 1 ] +set AT91C_SSC_ENDTX [expr 0x1 << 2 ] +set AT91C_SSC_TXBUFE [expr 0x1 << 3 ] +set AT91C_SSC_RXRDY [expr 0x1 << 4 ] +set AT91C_SSC_OVRUN [expr 0x1 << 5 ] +set AT91C_SSC_ENDRX [expr 0x1 << 6 ] +set AT91C_SSC_RXBUFF [expr 0x1 << 7 ] +set AT91C_SSC_CP0 [expr 0x1 << 8 ] +set AT91C_SSC_CP1 [expr 0x1 << 9 ] +set AT91C_SSC_TXSYN [expr 0x1 << 10 ] +set AT91C_SSC_RXSYN [expr 0x1 << 11 ] +# -------- SSC_IMR : (SSC Offset: 0x4c) SSC Interrupt Mask Register -------- +set AT91C_SSC_TXRDY [expr 0x1 << 0 ] +set AT91C_SSC_TXEMPTY [expr 0x1 << 1 ] +set AT91C_SSC_ENDTX [expr 0x1 << 2 ] +set AT91C_SSC_TXBUFE [expr 0x1 << 3 ] +set AT91C_SSC_RXRDY [expr 0x1 << 4 ] +set AT91C_SSC_OVRUN [expr 0x1 << 5 ] +set AT91C_SSC_ENDRX [expr 0x1 << 6 ] +set AT91C_SSC_RXBUFF [expr 0x1 << 7 ] +set AT91C_SSC_CP0 [expr 0x1 << 8 ] +set AT91C_SSC_CP1 [expr 0x1 << 9 ] +set AT91C_SSC_TXSYN [expr 0x1 << 10 ] +set AT91C_SSC_RXSYN [expr 0x1 << 11 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Two-wire Interface +# ***************************************************************************** +# -------- TWI_CR : (TWI Offset: 0x0) TWI Control Register -------- +set AT91C_TWI_START [expr 0x1 << 0 ] +set AT91C_TWI_STOP [expr 0x1 << 1 ] +set AT91C_TWI_MSEN [expr 0x1 << 2 ] +set AT91C_TWI_MSDIS [expr 0x1 << 3 ] +set AT91C_TWI_SWRST [expr 0x1 << 7 ] +# -------- TWI_MMR : (TWI Offset: 0x4) TWI Master Mode Register -------- +set AT91C_TWI_IADRSZ [expr 0x3 << 8 ] +set AT91C_TWI_IADRSZ_NO [expr 0x0 << 8 ] +set AT91C_TWI_IADRSZ_1_BYTE [expr 0x1 << 8 ] +set AT91C_TWI_IADRSZ_2_BYTE [expr 0x2 << 8 ] +set AT91C_TWI_IADRSZ_3_BYTE [expr 0x3 << 8 ] +set AT91C_TWI_MREAD [expr 0x1 << 12 ] +set AT91C_TWI_DADR [expr 0x7F << 16 ] +# -------- TWI_CWGR : (TWI Offset: 0x10) TWI Clock Waveform Generator Register -------- +set AT91C_TWI_CLDIV [expr 0xFF << 0 ] +set AT91C_TWI_CHDIV [expr 0xFF << 8 ] +set AT91C_TWI_CKDIV [expr 0x7 << 16 ] +# -------- TWI_SR : (TWI Offset: 0x20) TWI Status Register -------- +set AT91C_TWI_TXCOMP [expr 0x1 << 0 ] +set AT91C_TWI_RXRDY [expr 0x1 << 1 ] +set AT91C_TWI_TXRDY [expr 0x1 << 2 ] +set AT91C_TWI_OVRE [expr 0x1 << 6 ] +set AT91C_TWI_UNRE [expr 0x1 << 7 ] +set AT91C_TWI_NACK [expr 0x1 << 8 ] +# -------- TWI_IER : (TWI Offset: 0x24) TWI Interrupt Enable Register -------- +set AT91C_TWI_TXCOMP [expr 0x1 << 0 ] +set AT91C_TWI_RXRDY [expr 0x1 << 1 ] +set AT91C_TWI_TXRDY [expr 0x1 << 2 ] +set AT91C_TWI_OVRE [expr 0x1 << 6 ] +set AT91C_TWI_UNRE [expr 0x1 << 7 ] +set AT91C_TWI_NACK [expr 0x1 << 8 ] +# -------- TWI_IDR : (TWI Offset: 0x28) TWI Interrupt Disable Register -------- +set AT91C_TWI_TXCOMP [expr 0x1 << 0 ] +set AT91C_TWI_RXRDY [expr 0x1 << 1 ] +set AT91C_TWI_TXRDY [expr 0x1 << 2 ] +set AT91C_TWI_OVRE [expr 0x1 << 6 ] +set AT91C_TWI_UNRE [expr 0x1 << 7 ] +set AT91C_TWI_NACK [expr 0x1 << 8 ] +# -------- TWI_IMR : (TWI Offset: 0x2c) TWI Interrupt Mask Register -------- +set AT91C_TWI_TXCOMP [expr 0x1 << 0 ] +set AT91C_TWI_RXRDY [expr 0x1 << 1 ] +set AT91C_TWI_TXRDY [expr 0x1 << 2 ] +set AT91C_TWI_OVRE [expr 0x1 << 6 ] +set AT91C_TWI_UNRE [expr 0x1 << 7 ] +set AT91C_TWI_NACK [expr 0x1 << 8 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR PWMC Channel Interface +# ***************************************************************************** +# -------- PWMC_CMR : (PWMC_CH Offset: 0x0) PWMC Channel Mode Register -------- +set AT91C_PWMC_CPRE [expr 0xF << 0 ] +set AT91C_PWMC_CPRE_MCK 0x0 +set AT91C_PWMC_CPRE_MCK/2 0x1 +set AT91C_PWMC_CPRE_MCK/4 0x2 +set AT91C_PWMC_CPRE_MCK/8 0x3 +set AT91C_PWMC_CPRE_MCK/16 0x4 +set AT91C_PWMC_CPRE_MCK/32 0x5 +set AT91C_PWMC_CPRE_MCK/64 0x6 +set AT91C_PWMC_CPRE_MCK/128 0x7 +set AT91C_PWMC_CPRE_MCK/256 0x8 +set AT91C_PWMC_CPRE_MCK/512 0x9 +set AT91C_PWMC_CPRE_MCK/1024 0xA +set AT91C_PWMC_CPRE_MCKA 0xB +set AT91C_PWMC_CPRE_MCKB 0xC +set AT91C_PWMC_CALG [expr 0x1 << 8 ] +set AT91C_PWMC_CPOL [expr 0x1 << 9 ] +set AT91C_PWMC_CPD [expr 0x1 << 10 ] +# -------- PWMC_CDTYR : (PWMC_CH Offset: 0x4) PWMC Channel Duty Cycle Register -------- +set AT91C_PWMC_CDTY [expr 0x0 << 0 ] +# -------- PWMC_CPRDR : (PWMC_CH Offset: 0x8) PWMC Channel Period Register -------- +set AT91C_PWMC_CPRD [expr 0x0 << 0 ] +# -------- PWMC_CCNTR : (PWMC_CH Offset: 0xc) PWMC Channel Counter Register -------- +set AT91C_PWMC_CCNT [expr 0x0 << 0 ] +# -------- PWMC_CUPDR : (PWMC_CH Offset: 0x10) PWMC Channel Update Register -------- +set AT91C_PWMC_CUPD [expr 0x0 << 0 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Pulse Width Modulation Controller Interface +# ***************************************************************************** +# -------- PWMC_MR : (PWMC Offset: 0x0) PWMC Mode Register -------- +set AT91C_PWMC_DIVA [expr 0xFF << 0 ] +set AT91C_PWMC_PREA [expr 0xF << 8 ] +set AT91C_PWMC_PREA_MCK [expr 0x0 << 8 ] +set AT91C_PWMC_PREA_MCK/2 [expr 0x1 << 8 ] +set AT91C_PWMC_PREA_MCK/4 [expr 0x2 << 8 ] +set AT91C_PWMC_PREA_MCK/8 [expr 0x3 << 8 ] +set AT91C_PWMC_PREA_MCK/16 [expr 0x4 << 8 ] +set AT91C_PWMC_PREA_MCK/32 [expr 0x5 << 8 ] +set AT91C_PWMC_PREA_MCK/64 [expr 0x6 << 8 ] +set AT91C_PWMC_PREA_MCK/128 [expr 0x7 << 8 ] +set AT91C_PWMC_PREA_MCK/256 [expr 0x8 << 8 ] +set AT91C_PWMC_DIVB [expr 0xFF << 16 ] +set AT91C_PWMC_PREB [expr 0xF << 24 ] +set AT91C_PWMC_PREB_MCK [expr 0x0 << 24 ] +set AT91C_PWMC_PREB_MCK/2 [expr 0x1 << 24 ] +set AT91C_PWMC_PREB_MCK/4 [expr 0x2 << 24 ] +set AT91C_PWMC_PREB_MCK/8 [expr 0x3 << 24 ] +set AT91C_PWMC_PREB_MCK/16 [expr 0x4 << 24 ] +set AT91C_PWMC_PREB_MCK/32 [expr 0x5 << 24 ] +set AT91C_PWMC_PREB_MCK/64 [expr 0x6 << 24 ] +set AT91C_PWMC_PREB_MCK/128 [expr 0x7 << 24 ] +set AT91C_PWMC_PREB_MCK/256 [expr 0x8 << 24 ] +# -------- PWMC_ENA : (PWMC Offset: 0x4) PWMC Enable Register -------- +set AT91C_PWMC_CHID0 [expr 0x1 << 0 ] +set AT91C_PWMC_CHID1 [expr 0x1 << 1 ] +set AT91C_PWMC_CHID2 [expr 0x1 << 2 ] +set AT91C_PWMC_CHID3 [expr 0x1 << 3 ] +# -------- PWMC_DIS : (PWMC Offset: 0x8) PWMC Disable Register -------- +set AT91C_PWMC_CHID0 [expr 0x1 << 0 ] +set AT91C_PWMC_CHID1 [expr 0x1 << 1 ] +set AT91C_PWMC_CHID2 [expr 0x1 << 2 ] +set AT91C_PWMC_CHID3 [expr 0x1 << 3 ] +# -------- PWMC_SR : (PWMC Offset: 0xc) PWMC Status Register -------- +set AT91C_PWMC_CHID0 [expr 0x1 << 0 ] +set AT91C_PWMC_CHID1 [expr 0x1 << 1 ] +set AT91C_PWMC_CHID2 [expr 0x1 << 2 ] +set AT91C_PWMC_CHID3 [expr 0x1 << 3 ] +# -------- PWMC_IER : (PWMC Offset: 0x10) PWMC Interrupt Enable Register -------- +set AT91C_PWMC_CHID0 [expr 0x1 << 0 ] +set AT91C_PWMC_CHID1 [expr 0x1 << 1 ] +set AT91C_PWMC_CHID2 [expr 0x1 << 2 ] +set AT91C_PWMC_CHID3 [expr 0x1 << 3 ] +# -------- PWMC_IDR : (PWMC Offset: 0x14) PWMC Interrupt Disable Register -------- +set AT91C_PWMC_CHID0 [expr 0x1 << 0 ] +set AT91C_PWMC_CHID1 [expr 0x1 << 1 ] +set AT91C_PWMC_CHID2 [expr 0x1 << 2 ] +set AT91C_PWMC_CHID3 [expr 0x1 << 3 ] +# -------- PWMC_IMR : (PWMC Offset: 0x18) PWMC Interrupt Mask Register -------- +set AT91C_PWMC_CHID0 [expr 0x1 << 0 ] +set AT91C_PWMC_CHID1 [expr 0x1 << 1 ] +set AT91C_PWMC_CHID2 [expr 0x1 << 2 ] +set AT91C_PWMC_CHID3 [expr 0x1 << 3 ] +# -------- PWMC_ISR : (PWMC Offset: 0x1c) PWMC Interrupt Status Register -------- +set AT91C_PWMC_CHID0 [expr 0x1 << 0 ] +set AT91C_PWMC_CHID1 [expr 0x1 << 1 ] +set AT91C_PWMC_CHID2 [expr 0x1 << 2 ] +set AT91C_PWMC_CHID3 [expr 0x1 << 3 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR USB Device Interface +# ***************************************************************************** +# -------- UDP_FRM_NUM : (UDP Offset: 0x0) USB Frame Number Register -------- +set AT91C_UDP_FRM_NUM [expr 0x7FF << 0 ] +set AT91C_UDP_FRM_ERR [expr 0x1 << 16 ] +set AT91C_UDP_FRM_OK [expr 0x1 << 17 ] +# -------- UDP_GLB_STATE : (UDP Offset: 0x4) USB Global State Register -------- +set AT91C_UDP_FADDEN [expr 0x1 << 0 ] +set AT91C_UDP_CONFG [expr 0x1 << 1 ] +set AT91C_UDP_ESR [expr 0x1 << 2 ] +set AT91C_UDP_RSMINPR [expr 0x1 << 3 ] +set AT91C_UDP_RMWUPE [expr 0x1 << 4 ] +# -------- UDP_FADDR : (UDP Offset: 0x8) USB Function Address Register -------- +set AT91C_UDP_FADD [expr 0xFF << 0 ] +set AT91C_UDP_FEN [expr 0x1 << 8 ] +# -------- UDP_IER : (UDP Offset: 0x10) USB Interrupt Enable Register -------- +set AT91C_UDP_EPINT0 [expr 0x1 << 0 ] +set AT91C_UDP_EPINT1 [expr 0x1 << 1 ] +set AT91C_UDP_EPINT2 [expr 0x1 << 2 ] +set AT91C_UDP_EPINT3 [expr 0x1 << 3 ] +set AT91C_UDP_EPINT4 [expr 0x1 << 4 ] +set AT91C_UDP_EPINT5 [expr 0x1 << 5 ] +set AT91C_UDP_RXSUSP [expr 0x1 << 8 ] +set AT91C_UDP_RXRSM [expr 0x1 << 9 ] +set AT91C_UDP_EXTRSM [expr 0x1 << 10 ] +set AT91C_UDP_SOFINT [expr 0x1 << 11 ] +set AT91C_UDP_WAKEUP [expr 0x1 << 13 ] +# -------- UDP_IDR : (UDP Offset: 0x14) USB Interrupt Disable Register -------- +set AT91C_UDP_EPINT0 [expr 0x1 << 0 ] +set AT91C_UDP_EPINT1 [expr 0x1 << 1 ] +set AT91C_UDP_EPINT2 [expr 0x1 << 2 ] +set AT91C_UDP_EPINT3 [expr 0x1 << 3 ] +set AT91C_UDP_EPINT4 [expr 0x1 << 4 ] +set AT91C_UDP_EPINT5 [expr 0x1 << 5 ] +set AT91C_UDP_RXSUSP [expr 0x1 << 8 ] +set AT91C_UDP_RXRSM [expr 0x1 << 9 ] +set AT91C_UDP_EXTRSM [expr 0x1 << 10 ] +set AT91C_UDP_SOFINT [expr 0x1 << 11 ] +set AT91C_UDP_WAKEUP [expr 0x1 << 13 ] +# -------- UDP_IMR : (UDP Offset: 0x18) USB Interrupt Mask Register -------- +set AT91C_UDP_EPINT0 [expr 0x1 << 0 ] +set AT91C_UDP_EPINT1 [expr 0x1 << 1 ] +set AT91C_UDP_EPINT2 [expr 0x1 << 2 ] +set AT91C_UDP_EPINT3 [expr 0x1 << 3 ] +set AT91C_UDP_EPINT4 [expr 0x1 << 4 ] +set AT91C_UDP_EPINT5 [expr 0x1 << 5 ] +set AT91C_UDP_RXSUSP [expr 0x1 << 8 ] +set AT91C_UDP_RXRSM [expr 0x1 << 9 ] +set AT91C_UDP_EXTRSM [expr 0x1 << 10 ] +set AT91C_UDP_SOFINT [expr 0x1 << 11 ] +set AT91C_UDP_WAKEUP [expr 0x1 << 13 ] +# -------- UDP_ISR : (UDP Offset: 0x1c) USB Interrupt Status Register -------- +set AT91C_UDP_EPINT0 [expr 0x1 << 0 ] +set AT91C_UDP_EPINT1 [expr 0x1 << 1 ] +set AT91C_UDP_EPINT2 [expr 0x1 << 2 ] +set AT91C_UDP_EPINT3 [expr 0x1 << 3 ] +set AT91C_UDP_EPINT4 [expr 0x1 << 4 ] +set AT91C_UDP_EPINT5 [expr 0x1 << 5 ] +set AT91C_UDP_RXSUSP [expr 0x1 << 8 ] +set AT91C_UDP_RXRSM [expr 0x1 << 9 ] +set AT91C_UDP_EXTRSM [expr 0x1 << 10 ] +set AT91C_UDP_SOFINT [expr 0x1 << 11 ] +set AT91C_UDP_ENDBUSRES [expr 0x1 << 12 ] +set AT91C_UDP_WAKEUP [expr 0x1 << 13 ] +# -------- UDP_ICR : (UDP Offset: 0x20) USB Interrupt Clear Register -------- +set AT91C_UDP_EPINT0 [expr 0x1 << 0 ] +set AT91C_UDP_EPINT1 [expr 0x1 << 1 ] +set AT91C_UDP_EPINT2 [expr 0x1 << 2 ] +set AT91C_UDP_EPINT3 [expr 0x1 << 3 ] +set AT91C_UDP_EPINT4 [expr 0x1 << 4 ] +set AT91C_UDP_EPINT5 [expr 0x1 << 5 ] +set AT91C_UDP_RXSUSP [expr 0x1 << 8 ] +set AT91C_UDP_RXRSM [expr 0x1 << 9 ] +set AT91C_UDP_EXTRSM [expr 0x1 << 10 ] +set AT91C_UDP_SOFINT [expr 0x1 << 11 ] +set AT91C_UDP_WAKEUP [expr 0x1 << 13 ] +# -------- UDP_RST_EP : (UDP Offset: 0x28) USB Reset Endpoint Register -------- +set AT91C_UDP_EP0 [expr 0x1 << 0 ] +set AT91C_UDP_EP1 [expr 0x1 << 1 ] +set AT91C_UDP_EP2 [expr 0x1 << 2 ] +set AT91C_UDP_EP3 [expr 0x1 << 3 ] +set AT91C_UDP_EP4 [expr 0x1 << 4 ] +set AT91C_UDP_EP5 [expr 0x1 << 5 ] +# -------- UDP_CSR : (UDP Offset: 0x30) USB Endpoint Control and Status Register -------- +set AT91C_UDP_TXCOMP [expr 0x1 << 0 ] +set AT91C_UDP_RX_DATA_BK0 [expr 0x1 << 1 ] +set AT91C_UDP_RXSETUP [expr 0x1 << 2 ] +set AT91C_UDP_ISOERROR [expr 0x1 << 3 ] +set AT91C_UDP_TXPKTRDY [expr 0x1 << 4 ] +set AT91C_UDP_FORCESTALL [expr 0x1 << 5 ] +set AT91C_UDP_RX_DATA_BK1 [expr 0x1 << 6 ] +set AT91C_UDP_DIR [expr 0x1 << 7 ] +set AT91C_UDP_EPTYPE [expr 0x7 << 8 ] +set AT91C_UDP_EPTYPE_CTRL [expr 0x0 << 8 ] +set AT91C_UDP_EPTYPE_ISO_OUT [expr 0x1 << 8 ] +set AT91C_UDP_EPTYPE_BULK_OUT [expr 0x2 << 8 ] +set AT91C_UDP_EPTYPE_INT_OUT [expr 0x3 << 8 ] +set AT91C_UDP_EPTYPE_ISO_IN [expr 0x5 << 8 ] +set AT91C_UDP_EPTYPE_BULK_IN [expr 0x6 << 8 ] +set AT91C_UDP_EPTYPE_INT_IN [expr 0x7 << 8 ] +set AT91C_UDP_DTGLE [expr 0x1 << 11 ] +set AT91C_UDP_EPEDS [expr 0x1 << 15 ] +set AT91C_UDP_RXBYTECNT [expr 0x7FF << 16 ] +# -------- UDP_TXVC : (UDP Offset: 0x74) Transceiver Control Register -------- +set AT91C_UDP_TXVDIS [expr 0x1 << 8 ] +set AT91C_UDP_PUON [expr 0x1 << 9 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Timer Counter Channel Interface +# ***************************************************************************** +# -------- TC_CCR : (TC Offset: 0x0) TC Channel Control Register -------- +set AT91C_TC_CLKEN [expr 0x1 << 0 ] +set AT91C_TC_CLKDIS [expr 0x1 << 1 ] +set AT91C_TC_SWTRG [expr 0x1 << 2 ] +# -------- TC_CMR : (TC Offset: 0x4) TC Channel Mode Register: Capture Mode / Waveform Mode -------- +set AT91C_TC_CLKS [expr 0x7 << 0 ] +set AT91C_TC_CLKS_TIMER_DIV1_CLOCK 0x0 +set AT91C_TC_CLKS_TIMER_DIV2_CLOCK 0x1 +set AT91C_TC_CLKS_TIMER_DIV3_CLOCK 0x2 +set AT91C_TC_CLKS_TIMER_DIV4_CLOCK 0x3 +set AT91C_TC_CLKS_TIMER_DIV5_CLOCK 0x4 +set AT91C_TC_CLKS_XC0 0x5 +set AT91C_TC_CLKS_XC1 0x6 +set AT91C_TC_CLKS_XC2 0x7 +set AT91C_TC_CLKS [expr 0x7 << 0 ] +set AT91C_TC_CLKS_TIMER_DIV1_CLOCK 0x0 +set AT91C_TC_CLKS_TIMER_DIV2_CLOCK 0x1 +set AT91C_TC_CLKS_TIMER_DIV3_CLOCK 0x2 +set AT91C_TC_CLKS_TIMER_DIV4_CLOCK 0x3 +set AT91C_TC_CLKS_TIMER_DIV5_CLOCK 0x4 +set AT91C_TC_CLKS_XC0 0x5 +set AT91C_TC_CLKS_XC1 0x6 +set AT91C_TC_CLKS_XC2 0x7 +set AT91C_TC_CLKI [expr 0x1 << 3 ] +set AT91C_TC_CLKI [expr 0x1 << 3 ] +set AT91C_TC_BURST [expr 0x3 << 4 ] +set AT91C_TC_BURST_NONE [expr 0x0 << 4 ] +set AT91C_TC_BURST_XC0 [expr 0x1 << 4 ] +set AT91C_TC_BURST_XC1 [expr 0x2 << 4 ] +set AT91C_TC_BURST_XC2 [expr 0x3 << 4 ] +set AT91C_TC_BURST [expr 0x3 << 4 ] +set AT91C_TC_BURST_NONE [expr 0x0 << 4 ] +set AT91C_TC_BURST_XC0 [expr 0x1 << 4 ] +set AT91C_TC_BURST_XC1 [expr 0x2 << 4 ] +set AT91C_TC_BURST_XC2 [expr 0x3 << 4 ] +set AT91C_TC_CPCSTOP [expr 0x1 << 6 ] +set AT91C_TC_LDBSTOP [expr 0x1 << 6 ] +set AT91C_TC_CPCDIS [expr 0x1 << 7 ] +set AT91C_TC_LDBDIS [expr 0x1 << 7 ] +set AT91C_TC_ETRGEDG [expr 0x3 << 8 ] +set AT91C_TC_ETRGEDG_NONE [expr 0x0 << 8 ] +set AT91C_TC_ETRGEDG_RISING [expr 0x1 << 8 ] +set AT91C_TC_ETRGEDG_FALLING [expr 0x2 << 8 ] +set AT91C_TC_ETRGEDG_BOTH [expr 0x3 << 8 ] +set AT91C_TC_EEVTEDG [expr 0x3 << 8 ] +set AT91C_TC_EEVTEDG_NONE [expr 0x0 << 8 ] +set AT91C_TC_EEVTEDG_RISING [expr 0x1 << 8 ] +set AT91C_TC_EEVTEDG_FALLING [expr 0x2 << 8 ] +set AT91C_TC_EEVTEDG_BOTH [expr 0x3 << 8 ] +set AT91C_TC_EEVT [expr 0x3 << 10 ] +set AT91C_TC_EEVT_TIOB [expr 0x0 << 10 ] +set AT91C_TC_EEVT_XC0 [expr 0x1 << 10 ] +set AT91C_TC_EEVT_XC1 [expr 0x2 << 10 ] +set AT91C_TC_EEVT_XC2 [expr 0x3 << 10 ] +set AT91C_TC_ABETRG [expr 0x1 << 10 ] +set AT91C_TC_ENETRG [expr 0x1 << 12 ] +set AT91C_TC_WAVESEL [expr 0x3 << 13 ] +set AT91C_TC_WAVESEL_UP [expr 0x0 << 13 ] +set AT91C_TC_WAVESEL_UPDOWN [expr 0x1 << 13 ] +set AT91C_TC_WAVESEL_UP_AUTO [expr 0x2 << 13 ] +set AT91C_TC_WAVESEL_UPDOWN_AUTO [expr 0x3 << 13 ] +set AT91C_TC_CPCTRG [expr 0x1 << 14 ] +set AT91C_TC_WAVE [expr 0x1 << 15 ] +set AT91C_TC_WAVE [expr 0x1 << 15 ] +set AT91C_TC_ACPA [expr 0x3 << 16 ] +set AT91C_TC_ACPA_NONE [expr 0x0 << 16 ] +set AT91C_TC_ACPA_SET [expr 0x1 << 16 ] +set AT91C_TC_ACPA_CLEAR [expr 0x2 << 16 ] +set AT91C_TC_ACPA_TOGGLE [expr 0x3 << 16 ] +set AT91C_TC_LDRA [expr 0x3 << 16 ] +set AT91C_TC_LDRA_NONE [expr 0x0 << 16 ] +set AT91C_TC_LDRA_RISING [expr 0x1 << 16 ] +set AT91C_TC_LDRA_FALLING [expr 0x2 << 16 ] +set AT91C_TC_LDRA_BOTH [expr 0x3 << 16 ] +set AT91C_TC_ACPC [expr 0x3 << 18 ] +set AT91C_TC_ACPC_NONE [expr 0x0 << 18 ] +set AT91C_TC_ACPC_SET [expr 0x1 << 18 ] +set AT91C_TC_ACPC_CLEAR [expr 0x2 << 18 ] +set AT91C_TC_ACPC_TOGGLE [expr 0x3 << 18 ] +set AT91C_TC_LDRB [expr 0x3 << 18 ] +set AT91C_TC_LDRB_NONE [expr 0x0 << 18 ] +set AT91C_TC_LDRB_RISING [expr 0x1 << 18 ] +set AT91C_TC_LDRB_FALLING [expr 0x2 << 18 ] +set AT91C_TC_LDRB_BOTH [expr 0x3 << 18 ] +set AT91C_TC_AEEVT [expr 0x3 << 20 ] +set AT91C_TC_AEEVT_NONE [expr 0x0 << 20 ] +set AT91C_TC_AEEVT_SET [expr 0x1 << 20 ] +set AT91C_TC_AEEVT_CLEAR [expr 0x2 << 20 ] +set AT91C_TC_AEEVT_TOGGLE [expr 0x3 << 20 ] +set AT91C_TC_ASWTRG [expr 0x3 << 22 ] +set AT91C_TC_ASWTRG_NONE [expr 0x0 << 22 ] +set AT91C_TC_ASWTRG_SET [expr 0x1 << 22 ] +set AT91C_TC_ASWTRG_CLEAR [expr 0x2 << 22 ] +set AT91C_TC_ASWTRG_TOGGLE [expr 0x3 << 22 ] +set AT91C_TC_BCPB [expr 0x3 << 24 ] +set AT91C_TC_BCPB_NONE [expr 0x0 << 24 ] +set AT91C_TC_BCPB_SET [expr 0x1 << 24 ] +set AT91C_TC_BCPB_CLEAR [expr 0x2 << 24 ] +set AT91C_TC_BCPB_TOGGLE [expr 0x3 << 24 ] +set AT91C_TC_BCPC [expr 0x3 << 26 ] +set AT91C_TC_BCPC_NONE [expr 0x0 << 26 ] +set AT91C_TC_BCPC_SET [expr 0x1 << 26 ] +set AT91C_TC_BCPC_CLEAR [expr 0x2 << 26 ] +set AT91C_TC_BCPC_TOGGLE [expr 0x3 << 26 ] +set AT91C_TC_BEEVT [expr 0x3 << 28 ] +set AT91C_TC_BEEVT_NONE [expr 0x0 << 28 ] +set AT91C_TC_BEEVT_SET [expr 0x1 << 28 ] +set AT91C_TC_BEEVT_CLEAR [expr 0x2 << 28 ] +set AT91C_TC_BEEVT_TOGGLE [expr 0x3 << 28 ] +set AT91C_TC_BSWTRG [expr 0x3 << 30 ] +set AT91C_TC_BSWTRG_NONE [expr 0x0 << 30 ] +set AT91C_TC_BSWTRG_SET [expr 0x1 << 30 ] +set AT91C_TC_BSWTRG_CLEAR [expr 0x2 << 30 ] +set AT91C_TC_BSWTRG_TOGGLE [expr 0x3 << 30 ] +# -------- TC_SR : (TC Offset: 0x20) TC Channel Status Register -------- +set AT91C_TC_COVFS [expr 0x1 << 0 ] +set AT91C_TC_LOVRS [expr 0x1 << 1 ] +set AT91C_TC_CPAS [expr 0x1 << 2 ] +set AT91C_TC_CPBS [expr 0x1 << 3 ] +set AT91C_TC_CPCS [expr 0x1 << 4 ] +set AT91C_TC_LDRAS [expr 0x1 << 5 ] +set AT91C_TC_LDRBS [expr 0x1 << 6 ] +set AT91C_TC_ETRGS [expr 0x1 << 7 ] +set AT91C_TC_CLKSTA [expr 0x1 << 16 ] +set AT91C_TC_MTIOA [expr 0x1 << 17 ] +set AT91C_TC_MTIOB [expr 0x1 << 18 ] +# -------- TC_IER : (TC Offset: 0x24) TC Channel Interrupt Enable Register -------- +set AT91C_TC_COVFS [expr 0x1 << 0 ] +set AT91C_TC_LOVRS [expr 0x1 << 1 ] +set AT91C_TC_CPAS [expr 0x1 << 2 ] +set AT91C_TC_CPBS [expr 0x1 << 3 ] +set AT91C_TC_CPCS [expr 0x1 << 4 ] +set AT91C_TC_LDRAS [expr 0x1 << 5 ] +set AT91C_TC_LDRBS [expr 0x1 << 6 ] +set AT91C_TC_ETRGS [expr 0x1 << 7 ] +# -------- TC_IDR : (TC Offset: 0x28) TC Channel Interrupt Disable Register -------- +set AT91C_TC_COVFS [expr 0x1 << 0 ] +set AT91C_TC_LOVRS [expr 0x1 << 1 ] +set AT91C_TC_CPAS [expr 0x1 << 2 ] +set AT91C_TC_CPBS [expr 0x1 << 3 ] +set AT91C_TC_CPCS [expr 0x1 << 4 ] +set AT91C_TC_LDRAS [expr 0x1 << 5 ] +set AT91C_TC_LDRBS [expr 0x1 << 6 ] +set AT91C_TC_ETRGS [expr 0x1 << 7 ] +# -------- TC_IMR : (TC Offset: 0x2c) TC Channel Interrupt Mask Register -------- +set AT91C_TC_COVFS [expr 0x1 << 0 ] +set AT91C_TC_LOVRS [expr 0x1 << 1 ] +set AT91C_TC_CPAS [expr 0x1 << 2 ] +set AT91C_TC_CPBS [expr 0x1 << 3 ] +set AT91C_TC_CPCS [expr 0x1 << 4 ] +set AT91C_TC_LDRAS [expr 0x1 << 5 ] +set AT91C_TC_LDRBS [expr 0x1 << 6 ] +set AT91C_TC_ETRGS [expr 0x1 << 7 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Timer Counter Interface +# ***************************************************************************** +# -------- TCB_BCR : (TCB Offset: 0xc0) TC Block Control Register -------- +set AT91C_TCB_SYNC [expr 0x1 << 0 ] +# -------- TCB_BMR : (TCB Offset: 0xc4) TC Block Mode Register -------- +set AT91C_TCB_TC0XC0S [expr 0x3 << 0 ] +set AT91C_TCB_TC0XC0S_TCLK0 0x0 +set AT91C_TCB_TC0XC0S_NONE 0x1 +set AT91C_TCB_TC0XC0S_TIOA1 0x2 +set AT91C_TCB_TC0XC0S_TIOA2 0x3 +set AT91C_TCB_TC1XC1S [expr 0x3 << 2 ] +set AT91C_TCB_TC1XC1S_TCLK1 [expr 0x0 << 2 ] +set AT91C_TCB_TC1XC1S_NONE [expr 0x1 << 2 ] +set AT91C_TCB_TC1XC1S_TIOA0 [expr 0x2 << 2 ] +set AT91C_TCB_TC1XC1S_TIOA2 [expr 0x3 << 2 ] +set AT91C_TCB_TC2XC2S [expr 0x3 << 4 ] +set AT91C_TCB_TC2XC2S_TCLK2 [expr 0x0 << 4 ] +set AT91C_TCB_TC2XC2S_NONE [expr 0x1 << 4 ] +set AT91C_TCB_TC2XC2S_TIOA0 [expr 0x2 << 4 ] +set AT91C_TCB_TC2XC2S_TIOA1 [expr 0x3 << 4 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Control Area Network MailBox Interface +# ***************************************************************************** +# -------- CAN_MMR : (CAN_MB Offset: 0x0) CAN Message Mode Register -------- +set AT91C_CAN_MTIMEMARK [expr 0xFFFF << 0 ] +set AT91C_CAN_PRIOR [expr 0xF << 16 ] +set AT91C_CAN_MOT [expr 0x7 << 24 ] +set AT91C_CAN_MOT_DIS [expr 0x0 << 24 ] +set AT91C_CAN_MOT_RX [expr 0x1 << 24 ] +set AT91C_CAN_MOT_RXOVERWRITE [expr 0x2 << 24 ] +set AT91C_CAN_MOT_TX [expr 0x3 << 24 ] +set AT91C_CAN_MOT_CONSUMER [expr 0x4 << 24 ] +set AT91C_CAN_MOT_PRODUCER [expr 0x5 << 24 ] +# -------- CAN_MAM : (CAN_MB Offset: 0x4) CAN Message Acceptance Mask Register -------- +set AT91C_CAN_MIDvB [expr 0x3FFFF << 0 ] +set AT91C_CAN_MIDvA [expr 0x7FF << 18 ] +set AT91C_CAN_MIDE [expr 0x1 << 29 ] +# -------- CAN_MID : (CAN_MB Offset: 0x8) CAN Message ID Register -------- +set AT91C_CAN_MIDvB [expr 0x3FFFF << 0 ] +set AT91C_CAN_MIDvA [expr 0x7FF << 18 ] +set AT91C_CAN_MIDE [expr 0x1 << 29 ] +# -------- CAN_MFID : (CAN_MB Offset: 0xc) CAN Message Family ID Register -------- +# -------- CAN_MSR : (CAN_MB Offset: 0x10) CAN Message Status Register -------- +set AT91C_CAN_MTIMESTAMP [expr 0xFFFF << 0 ] +set AT91C_CAN_MDLC [expr 0xF << 16 ] +set AT91C_CAN_MRTR [expr 0x1 << 20 ] +set AT91C_CAN_MABT [expr 0x1 << 22 ] +set AT91C_CAN_MRDY [expr 0x1 << 23 ] +set AT91C_CAN_MMI [expr 0x1 << 24 ] +# -------- CAN_MDL : (CAN_MB Offset: 0x14) CAN Message Data Low Register -------- +# -------- CAN_MDH : (CAN_MB Offset: 0x18) CAN Message Data High Register -------- +# -------- CAN_MCR : (CAN_MB Offset: 0x1c) CAN Message Control Register -------- +set AT91C_CAN_MDLC [expr 0xF << 16 ] +set AT91C_CAN_MRTR [expr 0x1 << 20 ] +set AT91C_CAN_MACR [expr 0x1 << 22 ] +set AT91C_CAN_MTCR [expr 0x1 << 23 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Control Area Network Interface +# ***************************************************************************** +# -------- CAN_MR : (CAN Offset: 0x0) CAN Mode Register -------- +set AT91C_CAN_CANEN [expr 0x1 << 0 ] +set AT91C_CAN_LPM [expr 0x1 << 1 ] +set AT91C_CAN_ABM [expr 0x1 << 2 ] +set AT91C_CAN_OVL [expr 0x1 << 3 ] +set AT91C_CAN_TEOF [expr 0x1 << 4 ] +set AT91C_CAN_TTM [expr 0x1 << 5 ] +set AT91C_CAN_TIMFRZ [expr 0x1 << 6 ] +set AT91C_CAN_DRPT [expr 0x1 << 7 ] +# -------- CAN_IER : (CAN Offset: 0x4) CAN Interrupt Enable Register -------- +set AT91C_CAN_MB0 [expr 0x1 << 0 ] +set AT91C_CAN_MB1 [expr 0x1 << 1 ] +set AT91C_CAN_MB2 [expr 0x1 << 2 ] +set AT91C_CAN_MB3 [expr 0x1 << 3 ] +set AT91C_CAN_MB4 [expr 0x1 << 4 ] +set AT91C_CAN_MB5 [expr 0x1 << 5 ] +set AT91C_CAN_MB6 [expr 0x1 << 6 ] +set AT91C_CAN_MB7 [expr 0x1 << 7 ] +set AT91C_CAN_MB8 [expr 0x1 << 8 ] +set AT91C_CAN_MB9 [expr 0x1 << 9 ] +set AT91C_CAN_MB10 [expr 0x1 << 10 ] +set AT91C_CAN_MB11 [expr 0x1 << 11 ] +set AT91C_CAN_MB12 [expr 0x1 << 12 ] +set AT91C_CAN_MB13 [expr 0x1 << 13 ] +set AT91C_CAN_MB14 [expr 0x1 << 14 ] +set AT91C_CAN_MB15 [expr 0x1 << 15 ] +set AT91C_CAN_ERRA [expr 0x1 << 16 ] +set AT91C_CAN_WARN [expr 0x1 << 17 ] +set AT91C_CAN_ERRP [expr 0x1 << 18 ] +set AT91C_CAN_BOFF [expr 0x1 << 19 ] +set AT91C_CAN_SLEEP [expr 0x1 << 20 ] +set AT91C_CAN_WAKEUP [expr 0x1 << 21 ] +set AT91C_CAN_TOVF [expr 0x1 << 22 ] +set AT91C_CAN_TSTP [expr 0x1 << 23 ] +set AT91C_CAN_CERR [expr 0x1 << 24 ] +set AT91C_CAN_SERR [expr 0x1 << 25 ] +set AT91C_CAN_AERR [expr 0x1 << 26 ] +set AT91C_CAN_FERR [expr 0x1 << 27 ] +set AT91C_CAN_BERR [expr 0x1 << 28 ] +# -------- CAN_IDR : (CAN Offset: 0x8) CAN Interrupt Disable Register -------- +set AT91C_CAN_MB0 [expr 0x1 << 0 ] +set AT91C_CAN_MB1 [expr 0x1 << 1 ] +set AT91C_CAN_MB2 [expr 0x1 << 2 ] +set AT91C_CAN_MB3 [expr 0x1 << 3 ] +set AT91C_CAN_MB4 [expr 0x1 << 4 ] +set AT91C_CAN_MB5 [expr 0x1 << 5 ] +set AT91C_CAN_MB6 [expr 0x1 << 6 ] +set AT91C_CAN_MB7 [expr 0x1 << 7 ] +set AT91C_CAN_MB8 [expr 0x1 << 8 ] +set AT91C_CAN_MB9 [expr 0x1 << 9 ] +set AT91C_CAN_MB10 [expr 0x1 << 10 ] +set AT91C_CAN_MB11 [expr 0x1 << 11 ] +set AT91C_CAN_MB12 [expr 0x1 << 12 ] +set AT91C_CAN_MB13 [expr 0x1 << 13 ] +set AT91C_CAN_MB14 [expr 0x1 << 14 ] +set AT91C_CAN_MB15 [expr 0x1 << 15 ] +set AT91C_CAN_ERRA [expr 0x1 << 16 ] +set AT91C_CAN_WARN [expr 0x1 << 17 ] +set AT91C_CAN_ERRP [expr 0x1 << 18 ] +set AT91C_CAN_BOFF [expr 0x1 << 19 ] +set AT91C_CAN_SLEEP [expr 0x1 << 20 ] +set AT91C_CAN_WAKEUP [expr 0x1 << 21 ] +set AT91C_CAN_TOVF [expr 0x1 << 22 ] +set AT91C_CAN_TSTP [expr 0x1 << 23 ] +set AT91C_CAN_CERR [expr 0x1 << 24 ] +set AT91C_CAN_SERR [expr 0x1 << 25 ] +set AT91C_CAN_AERR [expr 0x1 << 26 ] +set AT91C_CAN_FERR [expr 0x1 << 27 ] +set AT91C_CAN_BERR [expr 0x1 << 28 ] +# -------- CAN_IMR : (CAN Offset: 0xc) CAN Interrupt Mask Register -------- +set AT91C_CAN_MB0 [expr 0x1 << 0 ] +set AT91C_CAN_MB1 [expr 0x1 << 1 ] +set AT91C_CAN_MB2 [expr 0x1 << 2 ] +set AT91C_CAN_MB3 [expr 0x1 << 3 ] +set AT91C_CAN_MB4 [expr 0x1 << 4 ] +set AT91C_CAN_MB5 [expr 0x1 << 5 ] +set AT91C_CAN_MB6 [expr 0x1 << 6 ] +set AT91C_CAN_MB7 [expr 0x1 << 7 ] +set AT91C_CAN_MB8 [expr 0x1 << 8 ] +set AT91C_CAN_MB9 [expr 0x1 << 9 ] +set AT91C_CAN_MB10 [expr 0x1 << 10 ] +set AT91C_CAN_MB11 [expr 0x1 << 11 ] +set AT91C_CAN_MB12 [expr 0x1 << 12 ] +set AT91C_CAN_MB13 [expr 0x1 << 13 ] +set AT91C_CAN_MB14 [expr 0x1 << 14 ] +set AT91C_CAN_MB15 [expr 0x1 << 15 ] +set AT91C_CAN_ERRA [expr 0x1 << 16 ] +set AT91C_CAN_WARN [expr 0x1 << 17 ] +set AT91C_CAN_ERRP [expr 0x1 << 18 ] +set AT91C_CAN_BOFF [expr 0x1 << 19 ] +set AT91C_CAN_SLEEP [expr 0x1 << 20 ] +set AT91C_CAN_WAKEUP [expr 0x1 << 21 ] +set AT91C_CAN_TOVF [expr 0x1 << 22 ] +set AT91C_CAN_TSTP [expr 0x1 << 23 ] +set AT91C_CAN_CERR [expr 0x1 << 24 ] +set AT91C_CAN_SERR [expr 0x1 << 25 ] +set AT91C_CAN_AERR [expr 0x1 << 26 ] +set AT91C_CAN_FERR [expr 0x1 << 27 ] +set AT91C_CAN_BERR [expr 0x1 << 28 ] +# -------- CAN_SR : (CAN Offset: 0x10) CAN Status Register -------- +set AT91C_CAN_MB0 [expr 0x1 << 0 ] +set AT91C_CAN_MB1 [expr 0x1 << 1 ] +set AT91C_CAN_MB2 [expr 0x1 << 2 ] +set AT91C_CAN_MB3 [expr 0x1 << 3 ] +set AT91C_CAN_MB4 [expr 0x1 << 4 ] +set AT91C_CAN_MB5 [expr 0x1 << 5 ] +set AT91C_CAN_MB6 [expr 0x1 << 6 ] +set AT91C_CAN_MB7 [expr 0x1 << 7 ] +set AT91C_CAN_MB8 [expr 0x1 << 8 ] +set AT91C_CAN_MB9 [expr 0x1 << 9 ] +set AT91C_CAN_MB10 [expr 0x1 << 10 ] +set AT91C_CAN_MB11 [expr 0x1 << 11 ] +set AT91C_CAN_MB12 [expr 0x1 << 12 ] +set AT91C_CAN_MB13 [expr 0x1 << 13 ] +set AT91C_CAN_MB14 [expr 0x1 << 14 ] +set AT91C_CAN_MB15 [expr 0x1 << 15 ] +set AT91C_CAN_ERRA [expr 0x1 << 16 ] +set AT91C_CAN_WARN [expr 0x1 << 17 ] +set AT91C_CAN_ERRP [expr 0x1 << 18 ] +set AT91C_CAN_BOFF [expr 0x1 << 19 ] +set AT91C_CAN_SLEEP [expr 0x1 << 20 ] +set AT91C_CAN_WAKEUP [expr 0x1 << 21 ] +set AT91C_CAN_TOVF [expr 0x1 << 22 ] +set AT91C_CAN_TSTP [expr 0x1 << 23 ] +set AT91C_CAN_CERR [expr 0x1 << 24 ] +set AT91C_CAN_SERR [expr 0x1 << 25 ] +set AT91C_CAN_AERR [expr 0x1 << 26 ] +set AT91C_CAN_FERR [expr 0x1 << 27 ] +set AT91C_CAN_BERR [expr 0x1 << 28 ] +set AT91C_CAN_RBSY [expr 0x1 << 29 ] +set AT91C_CAN_TBSY [expr 0x1 << 30 ] +set AT91C_CAN_OVLY [expr 0x1 << 31 ] +# -------- CAN_BR : (CAN Offset: 0x14) CAN Baudrate Register -------- +set AT91C_CAN_PHASE2 [expr 0x7 << 0 ] +set AT91C_CAN_PHASE1 [expr 0x7 << 4 ] +set AT91C_CAN_PROPAG [expr 0x7 << 8 ] +set AT91C_CAN_SYNC [expr 0x3 << 12 ] +set AT91C_CAN_BRP [expr 0x7F << 16 ] +set AT91C_CAN_SMP [expr 0x1 << 24 ] +# -------- CAN_TIM : (CAN Offset: 0x18) CAN Timer Register -------- +set AT91C_CAN_TIMER [expr 0xFFFF << 0 ] +# -------- CAN_TIMESTP : (CAN Offset: 0x1c) CAN Timestamp Register -------- +set AT91C_CAN_MTIMESTAMP [expr 0xFFFF << 0 ] +# -------- CAN_ECR : (CAN Offset: 0x20) CAN Error Counter Register -------- +set AT91C_CAN_REC [expr 0xFF << 0 ] +set AT91C_CAN_TEC [expr 0xFF << 16 ] +# -------- CAN_TCR : (CAN Offset: 0x24) CAN Transfer Command Register -------- +set AT91C_CAN_MB0 [expr 0x1 << 0 ] +set AT91C_CAN_MB1 [expr 0x1 << 1 ] +set AT91C_CAN_MB2 [expr 0x1 << 2 ] +set AT91C_CAN_MB3 [expr 0x1 << 3 ] +set AT91C_CAN_MB4 [expr 0x1 << 4 ] +set AT91C_CAN_MB5 [expr 0x1 << 5 ] +set AT91C_CAN_MB6 [expr 0x1 << 6 ] +set AT91C_CAN_MB7 [expr 0x1 << 7 ] +set AT91C_CAN_MB8 [expr 0x1 << 8 ] +set AT91C_CAN_MB9 [expr 0x1 << 9 ] +set AT91C_CAN_MB10 [expr 0x1 << 10 ] +set AT91C_CAN_MB11 [expr 0x1 << 11 ] +set AT91C_CAN_MB12 [expr 0x1 << 12 ] +set AT91C_CAN_MB13 [expr 0x1 << 13 ] +set AT91C_CAN_MB14 [expr 0x1 << 14 ] +set AT91C_CAN_MB15 [expr 0x1 << 15 ] +set AT91C_CAN_TIMRST [expr 0x1 << 31 ] +# -------- CAN_ACR : (CAN Offset: 0x28) CAN Abort Command Register -------- +set AT91C_CAN_MB0 [expr 0x1 << 0 ] +set AT91C_CAN_MB1 [expr 0x1 << 1 ] +set AT91C_CAN_MB2 [expr 0x1 << 2 ] +set AT91C_CAN_MB3 [expr 0x1 << 3 ] +set AT91C_CAN_MB4 [expr 0x1 << 4 ] +set AT91C_CAN_MB5 [expr 0x1 << 5 ] +set AT91C_CAN_MB6 [expr 0x1 << 6 ] +set AT91C_CAN_MB7 [expr 0x1 << 7 ] +set AT91C_CAN_MB8 [expr 0x1 << 8 ] +set AT91C_CAN_MB9 [expr 0x1 << 9 ] +set AT91C_CAN_MB10 [expr 0x1 << 10 ] +set AT91C_CAN_MB11 [expr 0x1 << 11 ] +set AT91C_CAN_MB12 [expr 0x1 << 12 ] +set AT91C_CAN_MB13 [expr 0x1 << 13 ] +set AT91C_CAN_MB14 [expr 0x1 << 14 ] +set AT91C_CAN_MB15 [expr 0x1 << 15 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Ethernet MAC 10/100 +# ***************************************************************************** +# -------- EMAC_NCR : (EMAC Offset: 0x0) -------- +set AT91C_EMAC_LB [expr 0x1 << 0 ] +set AT91C_EMAC_LLB [expr 0x1 << 1 ] +set AT91C_EMAC_RE [expr 0x1 << 2 ] +set AT91C_EMAC_TE [expr 0x1 << 3 ] +set AT91C_EMAC_MPE [expr 0x1 << 4 ] +set AT91C_EMAC_CLRSTAT [expr 0x1 << 5 ] +set AT91C_EMAC_INCSTAT [expr 0x1 << 6 ] +set AT91C_EMAC_WESTAT [expr 0x1 << 7 ] +set AT91C_EMAC_BP [expr 0x1 << 8 ] +set AT91C_EMAC_TSTART [expr 0x1 << 9 ] +set AT91C_EMAC_THALT [expr 0x1 << 10 ] +set AT91C_EMAC_TPFR [expr 0x1 << 11 ] +set AT91C_EMAC_TZQ [expr 0x1 << 12 ] +# -------- EMAC_NCFGR : (EMAC Offset: 0x4) Network Configuration Register -------- +set AT91C_EMAC_SPD [expr 0x1 << 0 ] +set AT91C_EMAC_FD [expr 0x1 << 1 ] +set AT91C_EMAC_JFRAME [expr 0x1 << 3 ] +set AT91C_EMAC_CAF [expr 0x1 << 4 ] +set AT91C_EMAC_NBC [expr 0x1 << 5 ] +set AT91C_EMAC_MTI [expr 0x1 << 6 ] +set AT91C_EMAC_UNI [expr 0x1 << 7 ] +set AT91C_EMAC_BIG [expr 0x1 << 8 ] +set AT91C_EMAC_EAE [expr 0x1 << 9 ] +set AT91C_EMAC_CLK [expr 0x3 << 10 ] +set AT91C_EMAC_CLK_HCLK_8 [expr 0x0 << 10 ] +set AT91C_EMAC_CLK_HCLK_16 [expr 0x1 << 10 ] +set AT91C_EMAC_CLK_HCLK_32 [expr 0x2 << 10 ] +set AT91C_EMAC_CLK_HCLK_64 [expr 0x3 << 10 ] +set AT91C_EMAC_RTY [expr 0x1 << 12 ] +set AT91C_EMAC_PAE [expr 0x1 << 13 ] +set AT91C_EMAC_RBOF [expr 0x3 << 14 ] +set AT91C_EMAC_RBOF_OFFSET_0 [expr 0x0 << 14 ] +set AT91C_EMAC_RBOF_OFFSET_1 [expr 0x1 << 14 ] +set AT91C_EMAC_RBOF_OFFSET_2 [expr 0x2 << 14 ] +set AT91C_EMAC_RBOF_OFFSET_3 [expr 0x3 << 14 ] +set AT91C_EMAC_RLCE [expr 0x1 << 16 ] +set AT91C_EMAC_DRFCS [expr 0x1 << 17 ] +set AT91C_EMAC_EFRHD [expr 0x1 << 18 ] +set AT91C_EMAC_IRXFCS [expr 0x1 << 19 ] +# -------- EMAC_NSR : (EMAC Offset: 0x8) Network Status Register -------- +set AT91C_EMAC_LINKR [expr 0x1 << 0 ] +set AT91C_EMAC_MDIO [expr 0x1 << 1 ] +set AT91C_EMAC_IDLE [expr 0x1 << 2 ] +# -------- EMAC_TSR : (EMAC Offset: 0x14) Transmit Status Register -------- +set AT91C_EMAC_UBR [expr 0x1 << 0 ] +set AT91C_EMAC_COL [expr 0x1 << 1 ] +set AT91C_EMAC_RLES [expr 0x1 << 2 ] +set AT91C_EMAC_TGO [expr 0x1 << 3 ] +set AT91C_EMAC_BEX [expr 0x1 << 4 ] +set AT91C_EMAC_COMP [expr 0x1 << 5 ] +set AT91C_EMAC_UND [expr 0x1 << 6 ] +# -------- EMAC_RSR : (EMAC Offset: 0x20) Receive Status Register -------- +set AT91C_EMAC_BNA [expr 0x1 << 0 ] +set AT91C_EMAC_REC [expr 0x1 << 1 ] +set AT91C_EMAC_OVR [expr 0x1 << 2 ] +# -------- EMAC_ISR : (EMAC Offset: 0x24) Interrupt Status Register -------- +set AT91C_EMAC_MFD [expr 0x1 << 0 ] +set AT91C_EMAC_RCOMP [expr 0x1 << 1 ] +set AT91C_EMAC_RXUBR [expr 0x1 << 2 ] +set AT91C_EMAC_TXUBR [expr 0x1 << 3 ] +set AT91C_EMAC_TUNDR [expr 0x1 << 4 ] +set AT91C_EMAC_RLEX [expr 0x1 << 5 ] +set AT91C_EMAC_TXERR [expr 0x1 << 6 ] +set AT91C_EMAC_TCOMP [expr 0x1 << 7 ] +set AT91C_EMAC_LINK [expr 0x1 << 9 ] +set AT91C_EMAC_ROVR [expr 0x1 << 10 ] +set AT91C_EMAC_HRESP [expr 0x1 << 11 ] +set AT91C_EMAC_PFRE [expr 0x1 << 12 ] +set AT91C_EMAC_PTZ [expr 0x1 << 13 ] +# -------- EMAC_IER : (EMAC Offset: 0x28) Interrupt Enable Register -------- +set AT91C_EMAC_MFD [expr 0x1 << 0 ] +set AT91C_EMAC_RCOMP [expr 0x1 << 1 ] +set AT91C_EMAC_RXUBR [expr 0x1 << 2 ] +set AT91C_EMAC_TXUBR [expr 0x1 << 3 ] +set AT91C_EMAC_TUNDR [expr 0x1 << 4 ] +set AT91C_EMAC_RLEX [expr 0x1 << 5 ] +set AT91C_EMAC_TXERR [expr 0x1 << 6 ] +set AT91C_EMAC_TCOMP [expr 0x1 << 7 ] +set AT91C_EMAC_LINK [expr 0x1 << 9 ] +set AT91C_EMAC_ROVR [expr 0x1 << 10 ] +set AT91C_EMAC_HRESP [expr 0x1 << 11 ] +set AT91C_EMAC_PFRE [expr 0x1 << 12 ] +set AT91C_EMAC_PTZ [expr 0x1 << 13 ] +# -------- EMAC_IDR : (EMAC Offset: 0x2c) Interrupt Disable Register -------- +set AT91C_EMAC_MFD [expr 0x1 << 0 ] +set AT91C_EMAC_RCOMP [expr 0x1 << 1 ] +set AT91C_EMAC_RXUBR [expr 0x1 << 2 ] +set AT91C_EMAC_TXUBR [expr 0x1 << 3 ] +set AT91C_EMAC_TUNDR [expr 0x1 << 4 ] +set AT91C_EMAC_RLEX [expr 0x1 << 5 ] +set AT91C_EMAC_TXERR [expr 0x1 << 6 ] +set AT91C_EMAC_TCOMP [expr 0x1 << 7 ] +set AT91C_EMAC_LINK [expr 0x1 << 9 ] +set AT91C_EMAC_ROVR [expr 0x1 << 10 ] +set AT91C_EMAC_HRESP [expr 0x1 << 11 ] +set AT91C_EMAC_PFRE [expr 0x1 << 12 ] +set AT91C_EMAC_PTZ [expr 0x1 << 13 ] +# -------- EMAC_IMR : (EMAC Offset: 0x30) Interrupt Mask Register -------- +set AT91C_EMAC_MFD [expr 0x1 << 0 ] +set AT91C_EMAC_RCOMP [expr 0x1 << 1 ] +set AT91C_EMAC_RXUBR [expr 0x1 << 2 ] +set AT91C_EMAC_TXUBR [expr 0x1 << 3 ] +set AT91C_EMAC_TUNDR [expr 0x1 << 4 ] +set AT91C_EMAC_RLEX [expr 0x1 << 5 ] +set AT91C_EMAC_TXERR [expr 0x1 << 6 ] +set AT91C_EMAC_TCOMP [expr 0x1 << 7 ] +set AT91C_EMAC_LINK [expr 0x1 << 9 ] +set AT91C_EMAC_ROVR [expr 0x1 << 10 ] +set AT91C_EMAC_HRESP [expr 0x1 << 11 ] +set AT91C_EMAC_PFRE [expr 0x1 << 12 ] +set AT91C_EMAC_PTZ [expr 0x1 << 13 ] +# -------- EMAC_MAN : (EMAC Offset: 0x34) PHY Maintenance Register -------- +set AT91C_EMAC_DATA [expr 0xFFFF << 0 ] +set AT91C_EMAC_CODE [expr 0x3 << 16 ] +set AT91C_EMAC_REGA [expr 0x1F << 18 ] +set AT91C_EMAC_PHYA [expr 0x1F << 23 ] +set AT91C_EMAC_RW [expr 0x3 << 28 ] +set AT91C_EMAC_SOF [expr 0x3 << 30 ] +# -------- EMAC_USRIO : (EMAC Offset: 0xc0) USER Input Output Register -------- +set AT91C_EMAC_RMII [expr 0x1 << 0 ] +set AT91C_EMAC_CLKEN [expr 0x1 << 1 ] +# -------- EMAC_WOL : (EMAC Offset: 0xc4) Wake On LAN Register -------- +set AT91C_EMAC_IP [expr 0xFFFF << 0 ] +set AT91C_EMAC_MAG [expr 0x1 << 16 ] +set AT91C_EMAC_ARP [expr 0x1 << 17 ] +set AT91C_EMAC_SA1 [expr 0x1 << 18 ] +set AT91C_EMAC_MTI [expr 0x1 << 19 ] +# -------- EMAC_REV : (EMAC Offset: 0xfc) Revision Register -------- +set AT91C_EMAC_REVREF [expr 0xFFFF << 0 ] +set AT91C_EMAC_PARTREF [expr 0xFFFF << 16 ] + +# ***************************************************************************** +# SOFTWARE API DEFINITION FOR Analog to Digital Convertor +# ***************************************************************************** +# -------- ADC_CR : (ADC Offset: 0x0) ADC Control Register -------- +set AT91C_ADC_SWRST [expr 0x1 << 0 ] +set AT91C_ADC_START [expr 0x1 << 1 ] +# -------- ADC_MR : (ADC Offset: 0x4) ADC Mode Register -------- +set AT91C_ADC_TRGEN [expr 0x1 << 0 ] +set AT91C_ADC_TRGEN_DIS 0x0 +set AT91C_ADC_TRGEN_EN 0x1 +set AT91C_ADC_TRGSEL [expr 0x7 << 1 ] +set AT91C_ADC_TRGSEL_TIOA0 [expr 0x0 << 1 ] +set AT91C_ADC_TRGSEL_TIOA1 [expr 0x1 << 1 ] +set AT91C_ADC_TRGSEL_TIOA2 [expr 0x2 << 1 ] +set AT91C_ADC_TRGSEL_TIOA3 [expr 0x3 << 1 ] +set AT91C_ADC_TRGSEL_TIOA4 [expr 0x4 << 1 ] +set AT91C_ADC_TRGSEL_TIOA5 [expr 0x5 << 1 ] +set AT91C_ADC_TRGSEL_EXT [expr 0x6 << 1 ] +set AT91C_ADC_LOWRES [expr 0x1 << 4 ] +set AT91C_ADC_LOWRES_10_BIT [expr 0x0 << 4 ] +set AT91C_ADC_LOWRES_8_BIT [expr 0x1 << 4 ] +set AT91C_ADC_SLEEP [expr 0x1 << 5 ] +set AT91C_ADC_SLEEP_NORMAL_MODE [expr 0x0 << 5 ] +set AT91C_ADC_SLEEP_MODE [expr 0x1 << 5 ] +set AT91C_ADC_PRESCAL [expr 0x3F << 8 ] +set AT91C_ADC_STARTUP [expr 0x1F << 16 ] +set AT91C_ADC_SHTIM [expr 0xF << 24 ] +# -------- ADC_CHER : (ADC Offset: 0x10) ADC Channel Enable Register -------- +set AT91C_ADC_CH0 [expr 0x1 << 0 ] +set AT91C_ADC_CH1 [expr 0x1 << 1 ] +set AT91C_ADC_CH2 [expr 0x1 << 2 ] +set AT91C_ADC_CH3 [expr 0x1 << 3 ] +set AT91C_ADC_CH4 [expr 0x1 << 4 ] +set AT91C_ADC_CH5 [expr 0x1 << 5 ] +set AT91C_ADC_CH6 [expr 0x1 << 6 ] +set AT91C_ADC_CH7 [expr 0x1 << 7 ] +# -------- ADC_CHDR : (ADC Offset: 0x14) ADC Channel Disable Register -------- +set AT91C_ADC_CH0 [expr 0x1 << 0 ] +set AT91C_ADC_CH1 [expr 0x1 << 1 ] +set AT91C_ADC_CH2 [expr 0x1 << 2 ] +set AT91C_ADC_CH3 [expr 0x1 << 3 ] +set AT91C_ADC_CH4 [expr 0x1 << 4 ] +set AT91C_ADC_CH5 [expr 0x1 << 5 ] +set AT91C_ADC_CH6 [expr 0x1 << 6 ] +set AT91C_ADC_CH7 [expr 0x1 << 7 ] +# -------- ADC_CHSR : (ADC Offset: 0x18) ADC Channel Status Register -------- +set AT91C_ADC_CH0 [expr 0x1 << 0 ] +set AT91C_ADC_CH1 [expr 0x1 << 1 ] +set AT91C_ADC_CH2 [expr 0x1 << 2 ] +set AT91C_ADC_CH3 [expr 0x1 << 3 ] +set AT91C_ADC_CH4 [expr 0x1 << 4 ] +set AT91C_ADC_CH5 [expr 0x1 << 5 ] +set AT91C_ADC_CH6 [expr 0x1 << 6 ] +set AT91C_ADC_CH7 [expr 0x1 << 7 ] +# -------- ADC_SR : (ADC Offset: 0x1c) ADC Status Register -------- +set AT91C_ADC_EOC0 [expr 0x1 << 0 ] +set AT91C_ADC_EOC1 [expr 0x1 << 1 ] +set AT91C_ADC_EOC2 [expr 0x1 << 2 ] +set AT91C_ADC_EOC3 [expr 0x1 << 3 ] +set AT91C_ADC_EOC4 [expr 0x1 << 4 ] +set AT91C_ADC_EOC5 [expr 0x1 << 5 ] +set AT91C_ADC_EOC6 [expr 0x1 << 6 ] +set AT91C_ADC_EOC7 [expr 0x1 << 7 ] +set AT91C_ADC_OVRE0 [expr 0x1 << 8 ] +set AT91C_ADC_OVRE1 [expr 0x1 << 9 ] +set AT91C_ADC_OVRE2 [expr 0x1 << 10 ] +set AT91C_ADC_OVRE3 [expr 0x1 << 11 ] +set AT91C_ADC_OVRE4 [expr 0x1 << 12 ] +set AT91C_ADC_OVRE5 [expr 0x1 << 13 ] +set AT91C_ADC_OVRE6 [expr 0x1 << 14 ] +set AT91C_ADC_OVRE7 [expr 0x1 << 15 ] +set AT91C_ADC_DRDY [expr 0x1 << 16 ] +set AT91C_ADC_GOVRE [expr 0x1 << 17 ] +set AT91C_ADC_ENDRX [expr 0x1 << 18 ] +set AT91C_ADC_RXBUFF [expr 0x1 << 19 ] +# -------- ADC_LCDR : (ADC Offset: 0x20) ADC Last Converted Data Register -------- +set AT91C_ADC_LDATA [expr 0x3FF << 0 ] +# -------- ADC_IER : (ADC Offset: 0x24) ADC Interrupt Enable Register -------- +set AT91C_ADC_EOC0 [expr 0x1 << 0 ] +set AT91C_ADC_EOC1 [expr 0x1 << 1 ] +set AT91C_ADC_EOC2 [expr 0x1 << 2 ] +set AT91C_ADC_EOC3 [expr 0x1 << 3 ] +set AT91C_ADC_EOC4 [expr 0x1 << 4 ] +set AT91C_ADC_EOC5 [expr 0x1 << 5 ] +set AT91C_ADC_EOC6 [expr 0x1 << 6 ] +set AT91C_ADC_EOC7 [expr 0x1 << 7 ] +set AT91C_ADC_OVRE0 [expr 0x1 << 8 ] +set AT91C_ADC_OVRE1 [expr 0x1 << 9 ] +set AT91C_ADC_OVRE2 [expr 0x1 << 10 ] +set AT91C_ADC_OVRE3 [expr 0x1 << 11 ] +set AT91C_ADC_OVRE4 [expr 0x1 << 12 ] +set AT91C_ADC_OVRE5 [expr 0x1 << 13 ] +set AT91C_ADC_OVRE6 [expr 0x1 << 14 ] +set AT91C_ADC_OVRE7 [expr 0x1 << 15 ] +set AT91C_ADC_DRDY [expr 0x1 << 16 ] +set AT91C_ADC_GOVRE [expr 0x1 << 17 ] +set AT91C_ADC_ENDRX [expr 0x1 << 18 ] +set AT91C_ADC_RXBUFF [expr 0x1 << 19 ] +# -------- ADC_IDR : (ADC Offset: 0x28) ADC Interrupt Disable Register -------- +set AT91C_ADC_EOC0 [expr 0x1 << 0 ] +set AT91C_ADC_EOC1 [expr 0x1 << 1 ] +set AT91C_ADC_EOC2 [expr 0x1 << 2 ] +set AT91C_ADC_EOC3 [expr 0x1 << 3 ] +set AT91C_ADC_EOC4 [expr 0x1 << 4 ] +set AT91C_ADC_EOC5 [expr 0x1 << 5 ] +set AT91C_ADC_EOC6 [expr 0x1 << 6 ] +set AT91C_ADC_EOC7 [expr 0x1 << 7 ] +set AT91C_ADC_OVRE0 [expr 0x1 << 8 ] +set AT91C_ADC_OVRE1 [expr 0x1 << 9 ] +set AT91C_ADC_OVRE2 [expr 0x1 << 10 ] +set AT91C_ADC_OVRE3 [expr 0x1 << 11 ] +set AT91C_ADC_OVRE4 [expr 0x1 << 12 ] +set AT91C_ADC_OVRE5 [expr 0x1 << 13 ] +set AT91C_ADC_OVRE6 [expr 0x1 << 14 ] +set AT91C_ADC_OVRE7 [expr 0x1 << 15 ] +set AT91C_ADC_DRDY [expr 0x1 << 16 ] +set AT91C_ADC_GOVRE [expr 0x1 << 17 ] +set AT91C_ADC_ENDRX [expr 0x1 << 18 ] +set AT91C_ADC_RXBUFF [expr 0x1 << 19 ] +# -------- ADC_IMR : (ADC Offset: 0x2c) ADC Interrupt Mask Register -------- +set AT91C_ADC_EOC0 [expr 0x1 << 0 ] +set AT91C_ADC_EOC1 [expr 0x1 << 1 ] +set AT91C_ADC_EOC2 [expr 0x1 << 2 ] +set AT91C_ADC_EOC3 [expr 0x1 << 3 ] +set AT91C_ADC_EOC4 [expr 0x1 << 4 ] +set AT91C_ADC_EOC5 [expr 0x1 << 5 ] +set AT91C_ADC_EOC6 [expr 0x1 << 6 ] +set AT91C_ADC_EOC7 [expr 0x1 << 7 ] +set AT91C_ADC_OVRE0 [expr 0x1 << 8 ] +set AT91C_ADC_OVRE1 [expr 0x1 << 9 ] +set AT91C_ADC_OVRE2 [expr 0x1 << 10 ] +set AT91C_ADC_OVRE3 [expr 0x1 << 11 ] +set AT91C_ADC_OVRE4 [expr 0x1 << 12 ] +set AT91C_ADC_OVRE5 [expr 0x1 << 13 ] +set AT91C_ADC_OVRE6 [expr 0x1 << 14 ] +set AT91C_ADC_OVRE7 [expr 0x1 << 15 ] +set AT91C_ADC_DRDY [expr 0x1 << 16 ] +set AT91C_ADC_GOVRE [expr 0x1 << 17 ] +set AT91C_ADC_ENDRX [expr 0x1 << 18 ] +set AT91C_ADC_RXBUFF [expr 0x1 << 19 ] +# -------- ADC_CDR0 : (ADC Offset: 0x30) ADC Channel Data Register 0 -------- +set AT91C_ADC_DATA [expr 0x3FF << 0 ] +# -------- ADC_CDR1 : (ADC Offset: 0x34) ADC Channel Data Register 1 -------- +set AT91C_ADC_DATA [expr 0x3FF << 0 ] +# -------- ADC_CDR2 : (ADC Offset: 0x38) ADC Channel Data Register 2 -------- +set AT91C_ADC_DATA [expr 0x3FF << 0 ] +# -------- ADC_CDR3 : (ADC Offset: 0x3c) ADC Channel Data Register 3 -------- +set AT91C_ADC_DATA [expr 0x3FF << 0 ] +# -------- ADC_CDR4 : (ADC Offset: 0x40) ADC Channel Data Register 4 -------- +set AT91C_ADC_DATA [expr 0x3FF << 0 ] +# -------- ADC_CDR5 : (ADC Offset: 0x44) ADC Channel Data Register 5 -------- +set AT91C_ADC_DATA [expr 0x3FF << 0 ] +# -------- ADC_CDR6 : (ADC Offset: 0x48) ADC Channel Data Register 6 -------- +set AT91C_ADC_DATA [expr 0x3FF << 0 ] +# -------- ADC_CDR7 : (ADC Offset: 0x4c) ADC Channel Data Register 7 -------- +set AT91C_ADC_DATA [expr 0x3FF << 0 ] + +# ***************************************************************************** +# REGISTER ADDRESS DEFINITION FOR AT91SAM7X256 +# ***************************************************************************** +# ========== Register definition for SYS peripheral ========== +# ========== Register definition for AIC peripheral ========== +set AT91C_AIC_IVR 0xFFFFF100 +set AT91C_AIC_SMR 0xFFFFF000 +set AT91C_AIC_FVR 0xFFFFF104 +set AT91C_AIC_DCR 0xFFFFF138 +set AT91C_AIC_EOICR 0xFFFFF130 +set AT91C_AIC_SVR 0xFFFFF080 +set AT91C_AIC_FFSR 0xFFFFF148 +set AT91C_AIC_ICCR 0xFFFFF128 +set AT91C_AIC_ISR 0xFFFFF108 +set AT91C_AIC_IMR 0xFFFFF110 +set AT91C_AIC_IPR 0xFFFFF10C +set AT91C_AIC_FFER 0xFFFFF140 +set AT91C_AIC_IECR 0xFFFFF120 +set AT91C_AIC_ISCR 0xFFFFF12C +set AT91C_AIC_FFDR 0xFFFFF144 +set AT91C_AIC_CISR 0xFFFFF114 +set AT91C_AIC_IDCR 0xFFFFF124 +set AT91C_AIC_SPU 0xFFFFF134 +# ========== Register definition for PDC_DBGU peripheral ========== +set AT91C_DBGU_TCR 0xFFFFF30C +set AT91C_DBGU_RNPR 0xFFFFF310 +set AT91C_DBGU_TNPR 0xFFFFF318 +set AT91C_DBGU_TPR 0xFFFFF308 +set AT91C_DBGU_RPR 0xFFFFF300 +set AT91C_DBGU_RCR 0xFFFFF304 +set AT91C_DBGU_RNCR 0xFFFFF314 +set AT91C_DBGU_PTCR 0xFFFFF320 +set AT91C_DBGU_PTSR 0xFFFFF324 +set AT91C_DBGU_TNCR 0xFFFFF31C +# ========== Register definition for DBGU peripheral ========== +set AT91C_DBGU_EXID 0xFFFFF244 +set AT91C_DBGU_BRGR 0xFFFFF220 +set AT91C_DBGU_IDR 0xFFFFF20C +set AT91C_DBGU_CSR 0xFFFFF214 +set AT91C_DBGU_CIDR 0xFFFFF240 +set AT91C_DBGU_MR 0xFFFFF204 +set AT91C_DBGU_IMR 0xFFFFF210 +set AT91C_DBGU_CR 0xFFFFF200 +set AT91C_DBGU_FNTR 0xFFFFF248 +set AT91C_DBGU_THR 0xFFFFF21C +set AT91C_DBGU_RHR 0xFFFFF218 +set AT91C_DBGU_IER 0xFFFFF208 +# ========== Register definition for PIOA peripheral ========== +set AT91C_PIOA_ODR 0xFFFFF414 +set AT91C_PIOA_SODR 0xFFFFF430 +set AT91C_PIOA_ISR 0xFFFFF44C +set AT91C_PIOA_ABSR 0xFFFFF478 +set AT91C_PIOA_IER 0xFFFFF440 +set AT91C_PIOA_PPUDR 0xFFFFF460 +set AT91C_PIOA_IMR 0xFFFFF448 +set AT91C_PIOA_PER 0xFFFFF400 +set AT91C_PIOA_IFDR 0xFFFFF424 +set AT91C_PIOA_OWDR 0xFFFFF4A4 +set AT91C_PIOA_MDSR 0xFFFFF458 +set AT91C_PIOA_IDR 0xFFFFF444 +set AT91C_PIOA_ODSR 0xFFFFF438 +set AT91C_PIOA_PPUSR 0xFFFFF468 +set AT91C_PIOA_OWSR 0xFFFFF4A8 +set AT91C_PIOA_BSR 0xFFFFF474 +set AT91C_PIOA_OWER 0xFFFFF4A0 +set AT91C_PIOA_IFER 0xFFFFF420 +set AT91C_PIOA_PDSR 0xFFFFF43C +set AT91C_PIOA_PPUER 0xFFFFF464 +set AT91C_PIOA_OSR 0xFFFFF418 +set AT91C_PIOA_ASR 0xFFFFF470 +set AT91C_PIOA_MDDR 0xFFFFF454 +set AT91C_PIOA_CODR 0xFFFFF434 +set AT91C_PIOA_MDER 0xFFFFF450 +set AT91C_PIOA_PDR 0xFFFFF404 +set AT91C_PIOA_IFSR 0xFFFFF428 +set AT91C_PIOA_OER 0xFFFFF410 +set AT91C_PIOA_PSR 0xFFFFF408 +# ========== Register definition for PIOB peripheral ========== +set AT91C_PIOB_OWDR 0xFFFFF6A4 +set AT91C_PIOB_MDER 0xFFFFF650 +set AT91C_PIOB_PPUSR 0xFFFFF668 +set AT91C_PIOB_IMR 0xFFFFF648 +set AT91C_PIOB_ASR 0xFFFFF670 +set AT91C_PIOB_PPUDR 0xFFFFF660 +set AT91C_PIOB_PSR 0xFFFFF608 +set AT91C_PIOB_IER 0xFFFFF640 +set AT91C_PIOB_CODR 0xFFFFF634 +set AT91C_PIOB_OWER 0xFFFFF6A0 +set AT91C_PIOB_ABSR 0xFFFFF678 +set AT91C_PIOB_IFDR 0xFFFFF624 +set AT91C_PIOB_PDSR 0xFFFFF63C +set AT91C_PIOB_IDR 0xFFFFF644 +set AT91C_PIOB_OWSR 0xFFFFF6A8 +set AT91C_PIOB_PDR 0xFFFFF604 +set AT91C_PIOB_ODR 0xFFFFF614 +set AT91C_PIOB_IFSR 0xFFFFF628 +set AT91C_PIOB_PPUER 0xFFFFF664 +set AT91C_PIOB_SODR 0xFFFFF630 +set AT91C_PIOB_ISR 0xFFFFF64C +set AT91C_PIOB_ODSR 0xFFFFF638 +set AT91C_PIOB_OSR 0xFFFFF618 +set AT91C_PIOB_MDSR 0xFFFFF658 +set AT91C_PIOB_IFER 0xFFFFF620 +set AT91C_PIOB_BSR 0xFFFFF674 +set AT91C_PIOB_MDDR 0xFFFFF654 +set AT91C_PIOB_OER 0xFFFFF610 +set AT91C_PIOB_PER 0xFFFFF600 +# ========== Register definition for CKGR peripheral ========== +set AT91C_CKGR_MOR 0xFFFFFC20 +set AT91C_CKGR_PLLR 0xFFFFFC2C +set AT91C_CKGR_MCFR 0xFFFFFC24 +# ========== Register definition for PMC peripheral ========== +set AT91C_PMC_IDR 0xFFFFFC64 +set AT91C_PMC_MOR 0xFFFFFC20 +set AT91C_PMC_PLLR 0xFFFFFC2C +set AT91C_PMC_PCER 0xFFFFFC10 +set AT91C_PMC_PCKR 0xFFFFFC40 +set AT91C_PMC_MCKR 0xFFFFFC30 +set AT91C_PMC_SCDR 0xFFFFFC04 +set AT91C_PMC_PCDR 0xFFFFFC14 +set AT91C_PMC_SCSR 0xFFFFFC08 +set AT91C_PMC_PCSR 0xFFFFFC18 +set AT91C_PMC_MCFR 0xFFFFFC24 +set AT91C_PMC_SCER 0xFFFFFC00 +set AT91C_PMC_IMR 0xFFFFFC6C +set AT91C_PMC_IER 0xFFFFFC60 +set AT91C_PMC_SR 0xFFFFFC68 +# ========== Register definition for RSTC peripheral ========== +set AT91C_RSTC_RCR 0xFFFFFD00 +set AT91C_RSTC_RMR 0xFFFFFD08 +set AT91C_RSTC_RSR 0xFFFFFD04 +# ========== Register definition for RTTC peripheral ========== +set AT91C_RTTC_RTSR 0xFFFFFD2C +set AT91C_RTTC_RTMR 0xFFFFFD20 +set AT91C_RTTC_RTVR 0xFFFFFD28 +set AT91C_RTTC_RTAR 0xFFFFFD24 +# ========== Register definition for PITC peripheral ========== +set AT91C_PITC_PIVR 0xFFFFFD38 +set AT91C_PITC_PISR 0xFFFFFD34 +set AT91C_PITC_PIIR 0xFFFFFD3C +set AT91C_PITC_PIMR 0xFFFFFD30 +# ========== Register definition for WDTC peripheral ========== +set AT91C_WDTC_WDCR 0xFFFFFD40 +set AT91C_WDTC_WDSR 0xFFFFFD48 +set AT91C_WDTC_WDMR 0xFFFFFD44 +# ========== Register definition for VREG peripheral ========== +set AT91C_VREG_MR 0xFFFFFD60 +# ========== Register definition for MC peripheral ========== +set AT91C_MC_ASR 0xFFFFFF04 +set AT91C_MC_RCR 0xFFFFFF00 +set AT91C_MC_FCR 0xFFFFFF64 +set AT91C_MC_AASR 0xFFFFFF08 +set AT91C_MC_FSR 0xFFFFFF68 +set AT91C_MC_FMR 0xFFFFFF60 +# ========== Register definition for PDC_SPI1 peripheral ========== +set AT91C_SPI1_PTCR 0xFFFE4120 +set AT91C_SPI1_RPR 0xFFFE4100 +set AT91C_SPI1_TNCR 0xFFFE411C +set AT91C_SPI1_TPR 0xFFFE4108 +set AT91C_SPI1_TNPR 0xFFFE4118 +set AT91C_SPI1_TCR 0xFFFE410C +set AT91C_SPI1_RCR 0xFFFE4104 +set AT91C_SPI1_RNPR 0xFFFE4110 +set AT91C_SPI1_RNCR 0xFFFE4114 +set AT91C_SPI1_PTSR 0xFFFE4124 +# ========== Register definition for SPI1 peripheral ========== +set AT91C_SPI1_IMR 0xFFFE401C +set AT91C_SPI1_IER 0xFFFE4014 +set AT91C_SPI1_MR 0xFFFE4004 +set AT91C_SPI1_RDR 0xFFFE4008 +set AT91C_SPI1_IDR 0xFFFE4018 +set AT91C_SPI1_SR 0xFFFE4010 +set AT91C_SPI1_TDR 0xFFFE400C +set AT91C_SPI1_CR 0xFFFE4000 +set AT91C_SPI1_CSR 0xFFFE4030 +# ========== Register definition for PDC_SPI0 peripheral ========== +set AT91C_SPI0_PTCR 0xFFFE0120 +set AT91C_SPI0_TPR 0xFFFE0108 +set AT91C_SPI0_TCR 0xFFFE010C +set AT91C_SPI0_RCR 0xFFFE0104 +set AT91C_SPI0_PTSR 0xFFFE0124 +set AT91C_SPI0_RNPR 0xFFFE0110 +set AT91C_SPI0_RPR 0xFFFE0100 +set AT91C_SPI0_TNCR 0xFFFE011C +set AT91C_SPI0_RNCR 0xFFFE0114 +set AT91C_SPI0_TNPR 0xFFFE0118 +# ========== Register definition for SPI0 peripheral ========== +set AT91C_SPI0_IER 0xFFFE0014 +set AT91C_SPI0_SR 0xFFFE0010 +set AT91C_SPI0_IDR 0xFFFE0018 +set AT91C_SPI0_CR 0xFFFE0000 +set AT91C_SPI0_MR 0xFFFE0004 +set AT91C_SPI0_IMR 0xFFFE001C +set AT91C_SPI0_TDR 0xFFFE000C +set AT91C_SPI0_RDR 0xFFFE0008 +set AT91C_SPI0_CSR 0xFFFE0030 +# ========== Register definition for PDC_US1 peripheral ========== +set AT91C_US1_RNCR 0xFFFC4114 +set AT91C_US1_PTCR 0xFFFC4120 +set AT91C_US1_TCR 0xFFFC410C +set AT91C_US1_PTSR 0xFFFC4124 +set AT91C_US1_TNPR 0xFFFC4118 +set AT91C_US1_RCR 0xFFFC4104 +set AT91C_US1_RNPR 0xFFFC4110 +set AT91C_US1_RPR 0xFFFC4100 +set AT91C_US1_TNCR 0xFFFC411C +set AT91C_US1_TPR 0xFFFC4108 +# ========== Register definition for US1 peripheral ========== +set AT91C_US1_IF 0xFFFC404C +set AT91C_US1_NER 0xFFFC4044 +set AT91C_US1_RTOR 0xFFFC4024 +set AT91C_US1_CSR 0xFFFC4014 +set AT91C_US1_IDR 0xFFFC400C +set AT91C_US1_IER 0xFFFC4008 +set AT91C_US1_THR 0xFFFC401C +set AT91C_US1_TTGR 0xFFFC4028 +set AT91C_US1_RHR 0xFFFC4018 +set AT91C_US1_BRGR 0xFFFC4020 +set AT91C_US1_IMR 0xFFFC4010 +set AT91C_US1_FIDI 0xFFFC4040 +set AT91C_US1_CR 0xFFFC4000 +set AT91C_US1_MR 0xFFFC4004 +# ========== Register definition for PDC_US0 peripheral ========== +set AT91C_US0_TNPR 0xFFFC0118 +set AT91C_US0_RNPR 0xFFFC0110 +set AT91C_US0_TCR 0xFFFC010C +set AT91C_US0_PTCR 0xFFFC0120 +set AT91C_US0_PTSR 0xFFFC0124 +set AT91C_US0_TNCR 0xFFFC011C +set AT91C_US0_TPR 0xFFFC0108 +set AT91C_US0_RCR 0xFFFC0104 +set AT91C_US0_RPR 0xFFFC0100 +set AT91C_US0_RNCR 0xFFFC0114 +# ========== Register definition for US0 peripheral ========== +set AT91C_US0_BRGR 0xFFFC0020 +set AT91C_US0_NER 0xFFFC0044 +set AT91C_US0_CR 0xFFFC0000 +set AT91C_US0_IMR 0xFFFC0010 +set AT91C_US0_FIDI 0xFFFC0040 +set AT91C_US0_TTGR 0xFFFC0028 +set AT91C_US0_MR 0xFFFC0004 +set AT91C_US0_RTOR 0xFFFC0024 +set AT91C_US0_CSR 0xFFFC0014 +set AT91C_US0_RHR 0xFFFC0018 +set AT91C_US0_IDR 0xFFFC000C +set AT91C_US0_THR 0xFFFC001C +set AT91C_US0_IF 0xFFFC004C +set AT91C_US0_IER 0xFFFC0008 +# ========== Register definition for PDC_SSC peripheral ========== +set AT91C_SSC_TNCR 0xFFFD411C +set AT91C_SSC_RPR 0xFFFD4100 +set AT91C_SSC_RNCR 0xFFFD4114 +set AT91C_SSC_TPR 0xFFFD4108 +set AT91C_SSC_PTCR 0xFFFD4120 +set AT91C_SSC_TCR 0xFFFD410C +set AT91C_SSC_RCR 0xFFFD4104 +set AT91C_SSC_RNPR 0xFFFD4110 +set AT91C_SSC_TNPR 0xFFFD4118 +set AT91C_SSC_PTSR 0xFFFD4124 +# ========== Register definition for SSC peripheral ========== +set AT91C_SSC_RHR 0xFFFD4020 +set AT91C_SSC_RSHR 0xFFFD4030 +set AT91C_SSC_TFMR 0xFFFD401C +set AT91C_SSC_IDR 0xFFFD4048 +set AT91C_SSC_THR 0xFFFD4024 +set AT91C_SSC_RCMR 0xFFFD4010 +set AT91C_SSC_IER 0xFFFD4044 +set AT91C_SSC_TSHR 0xFFFD4034 +set AT91C_SSC_SR 0xFFFD4040 +set AT91C_SSC_CMR 0xFFFD4004 +set AT91C_SSC_TCMR 0xFFFD4018 +set AT91C_SSC_CR 0xFFFD4000 +set AT91C_SSC_IMR 0xFFFD404C +set AT91C_SSC_RFMR 0xFFFD4014 +# ========== Register definition for TWI peripheral ========== +set AT91C_TWI_IER 0xFFFB8024 +set AT91C_TWI_CR 0xFFFB8000 +set AT91C_TWI_SR 0xFFFB8020 +set AT91C_TWI_IMR 0xFFFB802C +set AT91C_TWI_THR 0xFFFB8034 +set AT91C_TWI_IDR 0xFFFB8028 +set AT91C_TWI_IADR 0xFFFB800C +set AT91C_TWI_MMR 0xFFFB8004 +set AT91C_TWI_CWGR 0xFFFB8010 +set AT91C_TWI_RHR 0xFFFB8030 +# ========== Register definition for PWMC_CH3 peripheral ========== +set AT91C_PWMC_CH3_CUPDR 0xFFFCC270 +set AT91C_PWMC_CH3_Reserved 0xFFFCC274 +set AT91C_PWMC_CH3_CPRDR 0xFFFCC268 +set AT91C_PWMC_CH3_CDTYR 0xFFFCC264 +set AT91C_PWMC_CH3_CCNTR 0xFFFCC26C +set AT91C_PWMC_CH3_CMR 0xFFFCC260 +# ========== Register definition for PWMC_CH2 peripheral ========== +set AT91C_PWMC_CH2_Reserved 0xFFFCC254 +set AT91C_PWMC_CH2_CMR 0xFFFCC240 +set AT91C_PWMC_CH2_CCNTR 0xFFFCC24C +set AT91C_PWMC_CH2_CPRDR 0xFFFCC248 +set AT91C_PWMC_CH2_CUPDR 0xFFFCC250 +set AT91C_PWMC_CH2_CDTYR 0xFFFCC244 +# ========== Register definition for PWMC_CH1 peripheral ========== +set AT91C_PWMC_CH1_Reserved 0xFFFCC234 +set AT91C_PWMC_CH1_CUPDR 0xFFFCC230 +set AT91C_PWMC_CH1_CPRDR 0xFFFCC228 +set AT91C_PWMC_CH1_CCNTR 0xFFFCC22C +set AT91C_PWMC_CH1_CDTYR 0xFFFCC224 +set AT91C_PWMC_CH1_CMR 0xFFFCC220 +# ========== Register definition for PWMC_CH0 peripheral ========== +set AT91C_PWMC_CH0_Reserved 0xFFFCC214 +set AT91C_PWMC_CH0_CPRDR 0xFFFCC208 +set AT91C_PWMC_CH0_CDTYR 0xFFFCC204 +set AT91C_PWMC_CH0_CMR 0xFFFCC200 +set AT91C_PWMC_CH0_CUPDR 0xFFFCC210 +set AT91C_PWMC_CH0_CCNTR 0xFFFCC20C +# ========== Register definition for PWMC peripheral ========== +set AT91C_PWMC_IDR 0xFFFCC014 +set AT91C_PWMC_DIS 0xFFFCC008 +set AT91C_PWMC_IER 0xFFFCC010 +set AT91C_PWMC_VR 0xFFFCC0FC +set AT91C_PWMC_ISR 0xFFFCC01C +set AT91C_PWMC_SR 0xFFFCC00C +set AT91C_PWMC_IMR 0xFFFCC018 +set AT91C_PWMC_MR 0xFFFCC000 +set AT91C_PWMC_ENA 0xFFFCC004 +# ========== Register definition for UDP peripheral ========== +set AT91C_UDP_IMR 0xFFFB0018 +set AT91C_UDP_FADDR 0xFFFB0008 +set AT91C_UDP_NUM 0xFFFB0000 +set AT91C_UDP_FDR 0xFFFB0050 +set AT91C_UDP_ISR 0xFFFB001C +set AT91C_UDP_CSR 0xFFFB0030 +set AT91C_UDP_IDR 0xFFFB0014 +set AT91C_UDP_ICR 0xFFFB0020 +set AT91C_UDP_RSTEP 0xFFFB0028 +set AT91C_UDP_TXVC 0xFFFB0074 +set AT91C_UDP_GLBSTATE 0xFFFB0004 +set AT91C_UDP_IER 0xFFFB0010 +# ========== Register definition for TC0 peripheral ========== +set AT91C_TC0_SR 0xFFFA0020 +set AT91C_TC0_RC 0xFFFA001C +set AT91C_TC0_RB 0xFFFA0018 +set AT91C_TC0_CCR 0xFFFA0000 +set AT91C_TC0_CMR 0xFFFA0004 +set AT91C_TC0_IER 0xFFFA0024 +set AT91C_TC0_RA 0xFFFA0014 +set AT91C_TC0_IDR 0xFFFA0028 +set AT91C_TC0_CV 0xFFFA0010 +set AT91C_TC0_IMR 0xFFFA002C +# ========== Register definition for TC1 peripheral ========== +set AT91C_TC1_RB 0xFFFA0058 +set AT91C_TC1_CCR 0xFFFA0040 +set AT91C_TC1_IER 0xFFFA0064 +set AT91C_TC1_IDR 0xFFFA0068 +set AT91C_TC1_SR 0xFFFA0060 +set AT91C_TC1_CMR 0xFFFA0044 +set AT91C_TC1_RA 0xFFFA0054 +set AT91C_TC1_RC 0xFFFA005C +set AT91C_TC1_IMR 0xFFFA006C +set AT91C_TC1_CV 0xFFFA0050 +# ========== Register definition for TC2 peripheral ========== +set AT91C_TC2_CMR 0xFFFA0084 +set AT91C_TC2_CCR 0xFFFA0080 +set AT91C_TC2_CV 0xFFFA0090 +set AT91C_TC2_RA 0xFFFA0094 +set AT91C_TC2_RB 0xFFFA0098 +set AT91C_TC2_IDR 0xFFFA00A8 +set AT91C_TC2_IMR 0xFFFA00AC +set AT91C_TC2_RC 0xFFFA009C +set AT91C_TC2_IER 0xFFFA00A4 +set AT91C_TC2_SR 0xFFFA00A0 +# ========== Register definition for TCB peripheral ========== +set AT91C_TCB_BMR 0xFFFA00C4 +set AT91C_TCB_BCR 0xFFFA00C0 +# ========== Register definition for CAN_MB0 peripheral ========== +set AT91C_CAN_MB0_MDL 0xFFFD0214 +set AT91C_CAN_MB0_MAM 0xFFFD0204 +set AT91C_CAN_MB0_MCR 0xFFFD021C +set AT91C_CAN_MB0_MID 0xFFFD0208 +set AT91C_CAN_MB0_MSR 0xFFFD0210 +set AT91C_CAN_MB0_MFID 0xFFFD020C +set AT91C_CAN_MB0_MDH 0xFFFD0218 +set AT91C_CAN_MB0_MMR 0xFFFD0200 +# ========== Register definition for CAN_MB1 peripheral ========== +set AT91C_CAN_MB1_MDL 0xFFFD0234 +set AT91C_CAN_MB1_MID 0xFFFD0228 +set AT91C_CAN_MB1_MMR 0xFFFD0220 +set AT91C_CAN_MB1_MSR 0xFFFD0230 +set AT91C_CAN_MB1_MAM 0xFFFD0224 +set AT91C_CAN_MB1_MDH 0xFFFD0238 +set AT91C_CAN_MB1_MCR 0xFFFD023C +set AT91C_CAN_MB1_MFID 0xFFFD022C +# ========== Register definition for CAN_MB2 peripheral ========== +set AT91C_CAN_MB2_MCR 0xFFFD025C +set AT91C_CAN_MB2_MDH 0xFFFD0258 +set AT91C_CAN_MB2_MID 0xFFFD0248 +set AT91C_CAN_MB2_MDL 0xFFFD0254 +set AT91C_CAN_MB2_MMR 0xFFFD0240 +set AT91C_CAN_MB2_MAM 0xFFFD0244 +set AT91C_CAN_MB2_MFID 0xFFFD024C +set AT91C_CAN_MB2_MSR 0xFFFD0250 +# ========== Register definition for CAN_MB3 peripheral ========== +set AT91C_CAN_MB3_MFID 0xFFFD026C +set AT91C_CAN_MB3_MAM 0xFFFD0264 +set AT91C_CAN_MB3_MID 0xFFFD0268 +set AT91C_CAN_MB3_MCR 0xFFFD027C +set AT91C_CAN_MB3_MMR 0xFFFD0260 +set AT91C_CAN_MB3_MSR 0xFFFD0270 +set AT91C_CAN_MB3_MDL 0xFFFD0274 +set AT91C_CAN_MB3_MDH 0xFFFD0278 +# ========== Register definition for CAN_MB4 peripheral ========== +set AT91C_CAN_MB4_MID 0xFFFD0288 +set AT91C_CAN_MB4_MMR 0xFFFD0280 +set AT91C_CAN_MB4_MDH 0xFFFD0298 +set AT91C_CAN_MB4_MFID 0xFFFD028C +set AT91C_CAN_MB4_MSR 0xFFFD0290 +set AT91C_CAN_MB4_MCR 0xFFFD029C +set AT91C_CAN_MB4_MDL 0xFFFD0294 +set AT91C_CAN_MB4_MAM 0xFFFD0284 +# ========== Register definition for CAN_MB5 peripheral ========== +set AT91C_CAN_MB5_MSR 0xFFFD02B0 +set AT91C_CAN_MB5_MCR 0xFFFD02BC +set AT91C_CAN_MB5_MFID 0xFFFD02AC +set AT91C_CAN_MB5_MDH 0xFFFD02B8 +set AT91C_CAN_MB5_MID 0xFFFD02A8 +set AT91C_CAN_MB5_MMR 0xFFFD02A0 +set AT91C_CAN_MB5_MDL 0xFFFD02B4 +set AT91C_CAN_MB5_MAM 0xFFFD02A4 +# ========== Register definition for CAN_MB6 peripheral ========== +set AT91C_CAN_MB6_MFID 0xFFFD02CC +set AT91C_CAN_MB6_MID 0xFFFD02C8 +set AT91C_CAN_MB6_MAM 0xFFFD02C4 +set AT91C_CAN_MB6_MSR 0xFFFD02D0 +set AT91C_CAN_MB6_MDL 0xFFFD02D4 +set AT91C_CAN_MB6_MCR 0xFFFD02DC +set AT91C_CAN_MB6_MDH 0xFFFD02D8 +set AT91C_CAN_MB6_MMR 0xFFFD02C0 +# ========== Register definition for CAN_MB7 peripheral ========== +set AT91C_CAN_MB7_MCR 0xFFFD02FC +set AT91C_CAN_MB7_MDH 0xFFFD02F8 +set AT91C_CAN_MB7_MFID 0xFFFD02EC +set AT91C_CAN_MB7_MDL 0xFFFD02F4 +set AT91C_CAN_MB7_MID 0xFFFD02E8 +set AT91C_CAN_MB7_MMR 0xFFFD02E0 +set AT91C_CAN_MB7_MAM 0xFFFD02E4 +set AT91C_CAN_MB7_MSR 0xFFFD02F0 +# ========== Register definition for CAN peripheral ========== +set AT91C_CAN_TCR 0xFFFD0024 +set AT91C_CAN_IMR 0xFFFD000C +set AT91C_CAN_IER 0xFFFD0004 +set AT91C_CAN_ECR 0xFFFD0020 +set AT91C_CAN_TIMESTP 0xFFFD001C +set AT91C_CAN_MR 0xFFFD0000 +set AT91C_CAN_IDR 0xFFFD0008 +set AT91C_CAN_ACR 0xFFFD0028 +set AT91C_CAN_TIM 0xFFFD0018 +set AT91C_CAN_SR 0xFFFD0010 +set AT91C_CAN_BR 0xFFFD0014 +set AT91C_CAN_VR 0xFFFD00FC +# ========== Register definition for EMAC peripheral ========== +set AT91C_EMAC_ISR 0xFFFDC024 +set AT91C_EMAC_SA4H 0xFFFDC0B4 +set AT91C_EMAC_SA1L 0xFFFDC098 +set AT91C_EMAC_ELE 0xFFFDC078 +set AT91C_EMAC_LCOL 0xFFFDC05C +set AT91C_EMAC_RLE 0xFFFDC088 +set AT91C_EMAC_WOL 0xFFFDC0C4 +set AT91C_EMAC_DTF 0xFFFDC058 +set AT91C_EMAC_TUND 0xFFFDC064 +set AT91C_EMAC_NCR 0xFFFDC000 +set AT91C_EMAC_SA4L 0xFFFDC0B0 +set AT91C_EMAC_RSR 0xFFFDC020 +set AT91C_EMAC_SA3L 0xFFFDC0A8 +set AT91C_EMAC_TSR 0xFFFDC014 +set AT91C_EMAC_IDR 0xFFFDC02C +set AT91C_EMAC_RSE 0xFFFDC074 +set AT91C_EMAC_ECOL 0xFFFDC060 +set AT91C_EMAC_TID 0xFFFDC0B8 +set AT91C_EMAC_HRB 0xFFFDC090 +set AT91C_EMAC_TBQP 0xFFFDC01C +set AT91C_EMAC_USRIO 0xFFFDC0C0 +set AT91C_EMAC_PTR 0xFFFDC038 +set AT91C_EMAC_SA2H 0xFFFDC0A4 +set AT91C_EMAC_ROV 0xFFFDC070 +set AT91C_EMAC_ALE 0xFFFDC054 +set AT91C_EMAC_RJA 0xFFFDC07C +set AT91C_EMAC_RBQP 0xFFFDC018 +set AT91C_EMAC_TPF 0xFFFDC08C +set AT91C_EMAC_NCFGR 0xFFFDC004 +set AT91C_EMAC_HRT 0xFFFDC094 +set AT91C_EMAC_USF 0xFFFDC080 +set AT91C_EMAC_FCSE 0xFFFDC050 +set AT91C_EMAC_TPQ 0xFFFDC0BC +set AT91C_EMAC_MAN 0xFFFDC034 +set AT91C_EMAC_FTO 0xFFFDC040 +set AT91C_EMAC_REV 0xFFFDC0FC +set AT91C_EMAC_IMR 0xFFFDC030 +set AT91C_EMAC_SCF 0xFFFDC044 +set AT91C_EMAC_PFR 0xFFFDC03C +set AT91C_EMAC_MCF 0xFFFDC048 +set AT91C_EMAC_NSR 0xFFFDC008 +set AT91C_EMAC_SA2L 0xFFFDC0A0 +set AT91C_EMAC_FRO 0xFFFDC04C +set AT91C_EMAC_IER 0xFFFDC028 +set AT91C_EMAC_SA1H 0xFFFDC09C +set AT91C_EMAC_CSE 0xFFFDC068 +set AT91C_EMAC_SA3H 0xFFFDC0AC +set AT91C_EMAC_RRE 0xFFFDC06C +set AT91C_EMAC_STE 0xFFFDC084 +# ========== Register definition for PDC_ADC peripheral ========== +set AT91C_ADC_PTSR 0xFFFD8124 +set AT91C_ADC_PTCR 0xFFFD8120 +set AT91C_ADC_TNPR 0xFFFD8118 +set AT91C_ADC_TNCR 0xFFFD811C +set AT91C_ADC_RNPR 0xFFFD8110 +set AT91C_ADC_RNCR 0xFFFD8114 +set AT91C_ADC_RPR 0xFFFD8100 +set AT91C_ADC_TCR 0xFFFD810C +set AT91C_ADC_TPR 0xFFFD8108 +set AT91C_ADC_RCR 0xFFFD8104 +# ========== Register definition for ADC peripheral ========== +set AT91C_ADC_CDR2 0xFFFD8038 +set AT91C_ADC_CDR3 0xFFFD803C +set AT91C_ADC_CDR0 0xFFFD8030 +set AT91C_ADC_CDR5 0xFFFD8044 +set AT91C_ADC_CHDR 0xFFFD8014 +set AT91C_ADC_SR 0xFFFD801C +set AT91C_ADC_CDR4 0xFFFD8040 +set AT91C_ADC_CDR1 0xFFFD8034 +set AT91C_ADC_LCDR 0xFFFD8020 +set AT91C_ADC_IDR 0xFFFD8028 +set AT91C_ADC_CR 0xFFFD8000 +set AT91C_ADC_CDR7 0xFFFD804C +set AT91C_ADC_CDR6 0xFFFD8048 +set AT91C_ADC_IER 0xFFFD8024 +set AT91C_ADC_CHER 0xFFFD8010 +set AT91C_ADC_CHSR 0xFFFD8018 +set AT91C_ADC_MR 0xFFFD8004 +set AT91C_ADC_IMR 0xFFFD802C + +# ***************************************************************************** +# BASE ADDRESS DEFINITIONS FOR AT91SAM7X256 +# ***************************************************************************** +set AT91C_BASE_SYS 0xFFFFF000 +set AT91C_BASE_AIC 0xFFFFF000 +set AT91C_BASE_PDC_DBGU 0xFFFFF300 +set AT91C_BASE_DBGU 0xFFFFF200 +set AT91C_BASE_PIOA 0xFFFFF400 +set AT91C_BASE_PIOB 0xFFFFF600 +set AT91C_BASE_CKGR 0xFFFFFC20 +set AT91C_BASE_PMC 0xFFFFFC00 +set AT91C_BASE_RSTC 0xFFFFFD00 +set AT91C_BASE_RTTC 0xFFFFFD20 +set AT91C_BASE_PITC 0xFFFFFD30 +set AT91C_BASE_WDTC 0xFFFFFD40 +set AT91C_BASE_VREG 0xFFFFFD60 +set AT91C_BASE_MC 0xFFFFFF00 +set AT91C_BASE_PDC_SPI1 0xFFFE4100 +set AT91C_BASE_SPI1 0xFFFE4000 +set AT91C_BASE_PDC_SPI0 0xFFFE0100 +set AT91C_BASE_SPI0 0xFFFE0000 +set AT91C_BASE_PDC_US1 0xFFFC4100 +set AT91C_BASE_US1 0xFFFC4000 +set AT91C_BASE_PDC_US0 0xFFFC0100 +set AT91C_BASE_US0 0xFFFC0000 +set AT91C_BASE_PDC_SSC 0xFFFD4100 +set AT91C_BASE_SSC 0xFFFD4000 +set AT91C_BASE_TWI 0xFFFB8000 +set AT91C_BASE_PWMC_CH3 0xFFFCC260 +set AT91C_BASE_PWMC_CH2 0xFFFCC240 +set AT91C_BASE_PWMC_CH1 0xFFFCC220 +set AT91C_BASE_PWMC_CH0 0xFFFCC200 +set AT91C_BASE_PWMC 0xFFFCC000 +set AT91C_BASE_UDP 0xFFFB0000 +set AT91C_BASE_TC0 0xFFFA0000 +set AT91C_BASE_TC1 0xFFFA0040 +set AT91C_BASE_TC2 0xFFFA0080 +set AT91C_BASE_TCB 0xFFFA0000 +set AT91C_BASE_CAN_MB0 0xFFFD0200 +set AT91C_BASE_CAN_MB1 0xFFFD0220 +set AT91C_BASE_CAN_MB2 0xFFFD0240 +set AT91C_BASE_CAN_MB3 0xFFFD0260 +set AT91C_BASE_CAN_MB4 0xFFFD0280 +set AT91C_BASE_CAN_MB5 0xFFFD02A0 +set AT91C_BASE_CAN_MB6 0xFFFD02C0 +set AT91C_BASE_CAN_MB7 0xFFFD02E0 +set AT91C_BASE_CAN 0xFFFD0000 +set AT91C_BASE_EMAC 0xFFFDC000 +set AT91C_BASE_PDC_ADC 0xFFFD8100 +set AT91C_BASE_ADC 0xFFFD8000 + +# ***************************************************************************** +# PERIPHERAL ID DEFINITIONS FOR AT91SAM7X256 +# ***************************************************************************** +set AT91C_ID_FIQ 0 +set AT91C_ID_SYS 1 +set AT91C_ID_PIOA 2 +set AT91C_ID_PIOB 3 +set AT91C_ID_SPI0 4 +set AT91C_ID_SPI1 5 +set AT91C_ID_US0 6 +set AT91C_ID_US1 7 +set AT91C_ID_SSC 8 +set AT91C_ID_TWI 9 +set AT91C_ID_PWMC 10 +set AT91C_ID_UDP 11 +set AT91C_ID_TC0 12 +set AT91C_ID_TC1 13 +set AT91C_ID_TC2 14 +set AT91C_ID_CAN 15 +set AT91C_ID_EMAC 16 +set AT91C_ID_ADC 17 +set AT91C_ID_18_Reserved 18 +set AT91C_ID_19_Reserved 19 +set AT91C_ID_20_Reserved 20 +set AT91C_ID_21_Reserved 21 +set AT91C_ID_22_Reserved 22 +set AT91C_ID_23_Reserved 23 +set AT91C_ID_24_Reserved 24 +set AT91C_ID_25_Reserved 25 +set AT91C_ID_26_Reserved 26 +set AT91C_ID_27_Reserved 27 +set AT91C_ID_28_Reserved 28 +set AT91C_ID_29_Reserved 29 +set AT91C_ID_IRQ0 30 +set AT91C_ID_IRQ1 31 + +# ***************************************************************************** +# PIO DEFINITIONS FOR AT91SAM7X256 +# ***************************************************************************** +set AT91C_PIO_PA0 [expr 1 << 0 ] +set AT91C_PA0_RXD0 $AT91C_PIO_PA0 +set AT91C_PIO_PA1 [expr 1 << 1 ] +set AT91C_PA1_TXD0 $AT91C_PIO_PA1 +set AT91C_PIO_PA10 [expr 1 << 10 ] +set AT91C_PA10_TWD $AT91C_PIO_PA10 +set AT91C_PIO_PA11 [expr 1 << 11 ] +set AT91C_PA11_TWCK $AT91C_PIO_PA11 +set AT91C_PIO_PA12 [expr 1 << 12 ] +set AT91C_PA12_SPI0_NPCS0 $AT91C_PIO_PA12 +set AT91C_PIO_PA13 [expr 1 << 13 ] +set AT91C_PA13_SPI0_NPCS1 $AT91C_PIO_PA13 +set AT91C_PA13_PCK1 $AT91C_PIO_PA13 +set AT91C_PIO_PA14 [expr 1 << 14 ] +set AT91C_PA14_SPI0_NPCS2 $AT91C_PIO_PA14 +set AT91C_PA14_IRQ1 $AT91C_PIO_PA14 +set AT91C_PIO_PA15 [expr 1 << 15 ] +set AT91C_PA15_SPI0_NPCS3 $AT91C_PIO_PA15 +set AT91C_PA15_TCLK2 $AT91C_PIO_PA15 +set AT91C_PIO_PA16 [expr 1 << 16 ] +set AT91C_PA16_SPI0_MISO $AT91C_PIO_PA16 +set AT91C_PIO_PA17 [expr 1 << 17 ] +set AT91C_PA17_SPI0_MOSI $AT91C_PIO_PA17 +set AT91C_PIO_PA18 [expr 1 << 18 ] +set AT91C_PA18_SPI0_SPCK $AT91C_PIO_PA18 +set AT91C_PIO_PA19 [expr 1 << 19 ] +set AT91C_PA19_CANRX $AT91C_PIO_PA19 +set AT91C_PIO_PA2 [expr 1 << 2 ] +set AT91C_PA2_SCK0 $AT91C_PIO_PA2 +set AT91C_PA2_SPI1_NPCS1 $AT91C_PIO_PA2 +set AT91C_PIO_PA20 [expr 1 << 20 ] +set AT91C_PA20_CANTX $AT91C_PIO_PA20 +set AT91C_PIO_PA21 [expr 1 << 21 ] +set AT91C_PA21_TF $AT91C_PIO_PA21 +set AT91C_PA21_SPI1_NPCS0 $AT91C_PIO_PA21 +set AT91C_PIO_PA22 [expr 1 << 22 ] +set AT91C_PA22_TK $AT91C_PIO_PA22 +set AT91C_PA22_SPI1_SPCK $AT91C_PIO_PA22 +set AT91C_PIO_PA23 [expr 1 << 23 ] +set AT91C_PA23_TD $AT91C_PIO_PA23 +set AT91C_PA23_SPI1_MOSI $AT91C_PIO_PA23 +set AT91C_PIO_PA24 [expr 1 << 24 ] +set AT91C_PA24_RD $AT91C_PIO_PA24 +set AT91C_PA24_SPI1_MISO $AT91C_PIO_PA24 +set AT91C_PIO_PA25 [expr 1 << 25 ] +set AT91C_PA25_RK $AT91C_PIO_PA25 +set AT91C_PA25_SPI1_NPCS1 $AT91C_PIO_PA25 +set AT91C_PIO_PA26 [expr 1 << 26 ] +set AT91C_PA26_RF $AT91C_PIO_PA26 +set AT91C_PA26_SPI1_NPCS2 $AT91C_PIO_PA26 +set AT91C_PIO_PA27 [expr 1 << 27 ] +set AT91C_PA27_DRXD $AT91C_PIO_PA27 +set AT91C_PA27_PCK3 $AT91C_PIO_PA27 +set AT91C_PIO_PA28 [expr 1 << 28 ] +set AT91C_PA28_DTXD $AT91C_PIO_PA28 +set AT91C_PIO_PA29 [expr 1 << 29 ] +set AT91C_PA29_FIQ $AT91C_PIO_PA29 +set AT91C_PA29_SPI1_NPCS3 $AT91C_PIO_PA29 +set AT91C_PIO_PA3 [expr 1 << 3 ] +set AT91C_PA3_RTS0 $AT91C_PIO_PA3 +set AT91C_PA3_SPI1_NPCS2 $AT91C_PIO_PA3 +set AT91C_PIO_PA30 [expr 1 << 30 ] +set AT91C_PA30_IRQ0 $AT91C_PIO_PA30 +set AT91C_PA30_PCK2 $AT91C_PIO_PA30 +set AT91C_PIO_PA4 [expr 1 << 4 ] +set AT91C_PA4_CTS0 $AT91C_PIO_PA4 +set AT91C_PA4_SPI1_NPCS3 $AT91C_PIO_PA4 +set AT91C_PIO_PA5 [expr 1 << 5 ] +set AT91C_PA5_RXD1 $AT91C_PIO_PA5 +set AT91C_PIO_PA6 [expr 1 << 6 ] +set AT91C_PA6_TXD1 $AT91C_PIO_PA6 +set AT91C_PIO_PA7 [expr 1 << 7 ] +set AT91C_PA7_SCK1 $AT91C_PIO_PA7 +set AT91C_PA7_SPI0_NPCS1 $AT91C_PIO_PA7 +set AT91C_PIO_PA8 [expr 1 << 8 ] +set AT91C_PA8_RTS1 $AT91C_PIO_PA8 +set AT91C_PA8_SPI0_NPCS2 $AT91C_PIO_PA8 +set AT91C_PIO_PA9 [expr 1 << 9 ] +set AT91C_PA9_CTS1 $AT91C_PIO_PA9 +set AT91C_PA9_SPI0_NPCS3 $AT91C_PIO_PA9 +set AT91C_PIO_PB0 [expr 1 << 0 ] +set AT91C_PB0_ETXCK_EREFCK $AT91C_PIO_PB0 +set AT91C_PB0_PCK0 $AT91C_PIO_PB0 +set AT91C_PIO_PB1 [expr 1 << 1 ] +set AT91C_PB1_ETXEN $AT91C_PIO_PB1 +set AT91C_PIO_PB10 [expr 1 << 10 ] +set AT91C_PB10_ETX2 $AT91C_PIO_PB10 +set AT91C_PB10_SPI1_NPCS1 $AT91C_PIO_PB10 +set AT91C_PIO_PB11 [expr 1 << 11 ] +set AT91C_PB11_ETX3 $AT91C_PIO_PB11 +set AT91C_PB11_SPI1_NPCS2 $AT91C_PIO_PB11 +set AT91C_PIO_PB12 [expr 1 << 12 ] +set AT91C_PB12_ETXER $AT91C_PIO_PB12 +set AT91C_PB12_TCLK0 $AT91C_PIO_PB12 +set AT91C_PIO_PB13 [expr 1 << 13 ] +set AT91C_PB13_ERX2 $AT91C_PIO_PB13 +set AT91C_PB13_SPI0_NPCS1 $AT91C_PIO_PB13 +set AT91C_PIO_PB14 [expr 1 << 14 ] +set AT91C_PB14_ERX3 $AT91C_PIO_PB14 +set AT91C_PB14_SPI0_NPCS2 $AT91C_PIO_PB14 +set AT91C_PIO_PB15 [expr 1 << 15 ] +set AT91C_PB15_ERXDV_ECRSDV $AT91C_PIO_PB15 +set AT91C_PIO_PB16 [expr 1 << 16 ] +set AT91C_PB16_ECOL $AT91C_PIO_PB16 +set AT91C_PB16_SPI1_NPCS3 $AT91C_PIO_PB16 +set AT91C_PIO_PB17 [expr 1 << 17 ] +set AT91C_PB17_ERXCK $AT91C_PIO_PB17 +set AT91C_PB17_SPI0_NPCS3 $AT91C_PIO_PB17 +set AT91C_PIO_PB18 [expr 1 << 18 ] +set AT91C_PB18_EF100 $AT91C_PIO_PB18 +set AT91C_PB18_ADTRG $AT91C_PIO_PB18 +set AT91C_PIO_PB19 [expr 1 << 19 ] +set AT91C_PB19_PWM0 $AT91C_PIO_PB19 +set AT91C_PB19_TCLK1 $AT91C_PIO_PB19 +set AT91C_PIO_PB2 [expr 1 << 2 ] +set AT91C_PB2_ETX0 $AT91C_PIO_PB2 +set AT91C_PIO_PB20 [expr 1 << 20 ] +set AT91C_PB20_PWM1 $AT91C_PIO_PB20 +set AT91C_PB20_PCK0 $AT91C_PIO_PB20 +set AT91C_PIO_PB21 [expr 1 << 21 ] +set AT91C_PB21_PWM2 $AT91C_PIO_PB21 +set AT91C_PB21_PCK1 $AT91C_PIO_PB21 +set AT91C_PIO_PB22 [expr 1 << 22 ] +set AT91C_PB22_PWM3 $AT91C_PIO_PB22 +set AT91C_PB22_PCK2 $AT91C_PIO_PB22 +set AT91C_PIO_PB23 [expr 1 << 23 ] +set AT91C_PB23_TIOA0 $AT91C_PIO_PB23 +set AT91C_PB23_DCD1 $AT91C_PIO_PB23 +set AT91C_PIO_PB24 [expr 1 << 24 ] +set AT91C_PB24_TIOB0 $AT91C_PIO_PB24 +set AT91C_PB24_DSR1 $AT91C_PIO_PB24 +set AT91C_PIO_PB25 [expr 1 << 25 ] +set AT91C_PB25_TIOA1 $AT91C_PIO_PB25 +set AT91C_PB25_DTR1 $AT91C_PIO_PB25 +set AT91C_PIO_PB26 [expr 1 << 26 ] +set AT91C_PB26_TIOB1 $AT91C_PIO_PB26 +set AT91C_PB26_RI1 $AT91C_PIO_PB26 +set AT91C_PIO_PB27 [expr 1 << 27 ] +set AT91C_PB27_TIOA2 $AT91C_PIO_PB27 +set AT91C_PB27_PWM0 $AT91C_PIO_PB27 +set AT91C_PIO_PB28 [expr 1 << 28 ] +set AT91C_PB28_TIOB2 $AT91C_PIO_PB28 +set AT91C_PB28_PWM1 $AT91C_PIO_PB28 +set AT91C_PIO_PB29 [expr 1 << 29 ] +set AT91C_PB29_PCK1 $AT91C_PIO_PB29 +set AT91C_PB29_PWM2 $AT91C_PIO_PB29 +set AT91C_PIO_PB3 [expr 1 << 3 ] +set AT91C_PB3_ETX1 $AT91C_PIO_PB3 +set AT91C_PIO_PB30 [expr 1 << 30 ] +set AT91C_PB30_PCK2 $AT91C_PIO_PB30 +set AT91C_PB30_PWM3 $AT91C_PIO_PB30 +set AT91C_PIO_PB4 [expr 1 << 4 ] +set AT91C_PB4_ECRS $AT91C_PIO_PB4 +set AT91C_PIO_PB5 [expr 1 << 5 ] +set AT91C_PB5_ERX0 $AT91C_PIO_PB5 +set AT91C_PIO_PB6 [expr 1 << 6 ] +set AT91C_PB6_ERX1 $AT91C_PIO_PB6 +set AT91C_PIO_PB7 [expr 1 << 7 ] +set AT91C_PB7_ERXER $AT91C_PIO_PB7 +set AT91C_PIO_PB8 [expr 1 << 8 ] +set AT91C_PB8_EMDC $AT91C_PIO_PB8 +set AT91C_PIO_PB9 [expr 1 << 9 ] +set AT91C_PB9_EMDIO $AT91C_PIO_PB9 + +# ***************************************************************************** +# MEMORY MAPPING DEFINITIONS FOR AT91SAM7X256 +# ***************************************************************************** +set AT91C_ISRAM 0x00200000 +set AT91C_ISRAM_SIZE 0x00010000 +set AT91C_IFLASH 0x00100000 +set AT91C_IFLASH_SIZE 0x00040000 + + +# ***************************************************************************** +# ATTRIBUTES DEFINITIONS FOR AT91SAM7X256 +# ***************************************************************************** +array set AT91SAM7X256_att { + DBGU { LP DBGU_att } + PMC { LP PMC_att } + VREG { LP VREG_att } + RSTC { LP RSTC_att } + SSC { LP SSC_att } + WDTC { LP WDTC_att } + USART { LP US1_att US0_att } + SPI { LP SPI1_att SPI0_att } + PITC { LP PITC_att } + TCB { LP TCB_att } + CKGR { LP CKGR_att } + AIC { LP AIC_att } + TWI { LP TWI_att } + ADC { LP ADC_att } + PWMC_CH { LP PWMC_CH3_att PWMC_CH2_att PWMC_CH1_att PWMC_CH0_att } + RTTC { LP RTTC_att } + UDP { LP UDP_att } + EMAC { LP EMAC_att } + CAN_MB { LP CAN_MB0_att CAN_MB1_att CAN_MB2_att CAN_MB3_att CAN_MB4_att CAN_MB5_att CAN_MB6_att CAN_MB7_att } + TC { LP TC0_att TC1_att TC2_att } + SYS { LP SYS_att } + MC { LP MC_att } + PIO { LP PIOA_att PIOB_att } + CAN { LP CAN_att } + PWMC { LP PWMC_att } + PDC { LP PDC_DBGU_att PDC_SPI1_att PDC_SPI0_att PDC_US1_att PDC_US0_att PDC_SSC_att PDC_ADC_att } + +} +# ========== Peripheral attributes for DBGU peripheral ========== +array set DBGU_att { + EXID { R AT91C_DBGU_EXID RO } + BRGR { R AT91C_DBGU_BRGR RW } + IDR { R AT91C_DBGU_IDR WO } + CSR { R AT91C_DBGU_CSR RO } + CIDR { R AT91C_DBGU_CIDR RO } + MR { R AT91C_DBGU_MR RW } + IMR { R AT91C_DBGU_IMR RO } + CR { R AT91C_DBGU_CR WO } + FNTR { R AT91C_DBGU_FNTR RW } + THR { R AT91C_DBGU_THR WO } + RHR { R AT91C_DBGU_RHR RO } + IER { R AT91C_DBGU_IER WO } + listeReg { EXID BRGR IDR CSR CIDR MR IMR CR FNTR THR RHR IER } + +} + +# ========== Peripheral attributes for PMC peripheral ========== +array set PMC_att { + IDR { R AT91C_PMC_IDR WO } + MOR { R AT91C_PMC_MOR RW } + PLLR { R AT91C_PMC_PLLR RW } + PCER { R AT91C_PMC_PCER WO } + PCKR { R AT91C_PMC_PCKR RW } + MCKR { R AT91C_PMC_MCKR RW } + SCDR { R AT91C_PMC_SCDR WO } + PCDR { R AT91C_PMC_PCDR WO } + SCSR { R AT91C_PMC_SCSR RO } + PCSR { R AT91C_PMC_PCSR RO } + MCFR { R AT91C_PMC_MCFR RO } + SCER { R AT91C_PMC_SCER WO } + IMR { R AT91C_PMC_IMR RO } + IER { R AT91C_PMC_IER WO } + SR { R AT91C_PMC_SR RO } + listeReg { IDR MOR PLLR PCER PCKR MCKR SCDR PCDR SCSR PCSR MCFR SCER IMR IER SR } + +} + +# ========== Peripheral attributes for VREG peripheral ========== +array set VREG_att { + MR { R AT91C_VREG_MR RW } + listeReg { MR } + +} + +# ========== Peripheral attributes for RSTC peripheral ========== +array set RSTC_att { + RCR { R AT91C_RSTC_RCR WO } + RMR { R AT91C_RSTC_RMR RW } + RSR { R AT91C_RSTC_RSR RO } + listeReg { RCR RMR RSR } + +} + +# ========== Peripheral attributes for SSC peripheral ========== +array set SSC_att { + RHR { R AT91C_SSC_RHR RO } + RSHR { R AT91C_SSC_RSHR RO } + TFMR { R AT91C_SSC_TFMR RW } + IDR { R AT91C_SSC_IDR WO } + THR { R AT91C_SSC_THR WO } + RCMR { R AT91C_SSC_RCMR RW } + IER { R AT91C_SSC_IER WO } + TSHR { R AT91C_SSC_TSHR RW } + SR { R AT91C_SSC_SR RO } + CMR { R AT91C_SSC_CMR RW } + TCMR { R AT91C_SSC_TCMR RW } + CR { R AT91C_SSC_CR WO } + IMR { R AT91C_SSC_IMR RO } + RFMR { R AT91C_SSC_RFMR RW } + listeReg { RHR RSHR TFMR IDR THR RCMR IER TSHR SR CMR TCMR CR IMR RFMR } + +} + +# ========== Peripheral attributes for WDTC peripheral ========== +array set WDTC_att { + WDCR { R AT91C_WDTC_WDCR WO } + WDSR { R AT91C_WDTC_WDSR RO } + WDMR { R AT91C_WDTC_WDMR RW } + listeReg { WDCR WDSR WDMR } + +} + +# ========== Peripheral attributes for USART peripheral ========== +array set US1_att { + IF { R AT91C_US1_IF RW } + NER { R AT91C_US1_NER RO } + RTOR { R AT91C_US1_RTOR RW } + CSR { R AT91C_US1_CSR RO } + IDR { R AT91C_US1_IDR WO } + IER { R AT91C_US1_IER WO } + THR { R AT91C_US1_THR WO } + TTGR { R AT91C_US1_TTGR RW } + RHR { R AT91C_US1_RHR RO } + BRGR { R AT91C_US1_BRGR RW } + IMR { R AT91C_US1_IMR RO } + FIDI { R AT91C_US1_FIDI RW } + CR { R AT91C_US1_CR WO } + MR { R AT91C_US1_MR RW } + listeReg { IF NER RTOR CSR IDR IER THR TTGR RHR BRGR IMR FIDI CR MR } + +} +array set US0_att { + BRGR { R AT91C_US0_BRGR RW } + NER { R AT91C_US0_NER RO } + CR { R AT91C_US0_CR WO } + IMR { R AT91C_US0_IMR RO } + FIDI { R AT91C_US0_FIDI RW } + TTGR { R AT91C_US0_TTGR RW } + MR { R AT91C_US0_MR RW } + RTOR { R AT91C_US0_RTOR RW } + CSR { R AT91C_US0_CSR RO } + RHR { R AT91C_US0_RHR RO } + IDR { R AT91C_US0_IDR WO } + THR { R AT91C_US0_THR WO } + IF { R AT91C_US0_IF RW } + IER { R AT91C_US0_IER WO } + listeReg { BRGR NER CR IMR FIDI TTGR MR RTOR CSR RHR IDR THR IF IER } + +} + +# ========== Peripheral attributes for SPI peripheral ========== +array set SPI1_att { + IMR { R AT91C_SPI1_IMR RO } + IER { R AT91C_SPI1_IER WO } + MR { R AT91C_SPI1_MR RW } + RDR { R AT91C_SPI1_RDR RO } + IDR { R AT91C_SPI1_IDR WO } + SR { R AT91C_SPI1_SR RO } + TDR { R AT91C_SPI1_TDR WO } + CR { R AT91C_SPI1_CR RO } + CSR { R AT91C_SPI1_CSR RW } + listeReg { IMR IER MR RDR IDR SR TDR CR CSR } + +} +array set SPI0_att { + IER { R AT91C_SPI0_IER WO } + SR { R AT91C_SPI0_SR RO } + IDR { R AT91C_SPI0_IDR WO } + CR { R AT91C_SPI0_CR RO } + MR { R AT91C_SPI0_MR RW } + IMR { R AT91C_SPI0_IMR RO } + TDR { R AT91C_SPI0_TDR WO } + RDR { R AT91C_SPI0_RDR RO } + CSR { R AT91C_SPI0_CSR RW } + listeReg { IER SR IDR CR MR IMR TDR RDR CSR } + +} + +# ========== Peripheral attributes for PITC peripheral ========== +array set PITC_att { + PIVR { R AT91C_PITC_PIVR RO } + PISR { R AT91C_PITC_PISR RO } + PIIR { R AT91C_PITC_PIIR RO } + PIMR { R AT91C_PITC_PIMR RW } + listeReg { PIVR PISR PIIR PIMR } + +} + +# ========== Peripheral attributes for TCB peripheral ========== +array set TCB_att { + BMR { R AT91C_TCB_BMR RW } + BCR { R AT91C_TCB_BCR WO } + listeReg { BMR BCR } + +} + +# ========== Peripheral attributes for CKGR peripheral ========== +array set CKGR_att { + MOR { R AT91C_CKGR_MOR RW } + PLLR { R AT91C_CKGR_PLLR RW } + MCFR { R AT91C_CKGR_MCFR RO } + listeReg { MOR PLLR MCFR } + +} + +# ========== Peripheral attributes for AIC peripheral ========== +array set AIC_att { + IVR { R AT91C_AIC_IVR RO } + SMR { R AT91C_AIC_SMR RW } + FVR { R AT91C_AIC_FVR RO } + DCR { R AT91C_AIC_DCR RW } + EOICR { R AT91C_AIC_EOICR WO } + SVR { R AT91C_AIC_SVR RW } + FFSR { R AT91C_AIC_FFSR RO } + ICCR { R AT91C_AIC_ICCR WO } + ISR { R AT91C_AIC_ISR RO } + IMR { R AT91C_AIC_IMR RO } + IPR { R AT91C_AIC_IPR RO } + FFER { R AT91C_AIC_FFER WO } + IECR { R AT91C_AIC_IECR WO } + ISCR { R AT91C_AIC_ISCR WO } + FFDR { R AT91C_AIC_FFDR WO } + CISR { R AT91C_AIC_CISR RO } + IDCR { R AT91C_AIC_IDCR WO } + SPU { R AT91C_AIC_SPU RW } + listeReg { IVR SMR FVR DCR EOICR SVR FFSR ICCR ISR IMR IPR FFER IECR ISCR FFDR CISR IDCR SPU } + +} + +# ========== Peripheral attributes for TWI peripheral ========== +array set TWI_att { + IER { R AT91C_TWI_IER WO } + CR { R AT91C_TWI_CR WO } + SR { R AT91C_TWI_SR RO } + IMR { R AT91C_TWI_IMR RO } + THR { R AT91C_TWI_THR WO } + IDR { R AT91C_TWI_IDR WO } + IADR { R AT91C_TWI_IADR RW } + MMR { R AT91C_TWI_MMR RW } + CWGR { R AT91C_TWI_CWGR RW } + RHR { R AT91C_TWI_RHR RO } + listeReg { IER CR SR IMR THR IDR IADR MMR CWGR RHR } + +} + +# ========== Peripheral attributes for ADC peripheral ========== +array set ADC_att { + CDR2 { R AT91C_ADC_CDR2 RO } + CDR3 { R AT91C_ADC_CDR3 RO } + CDR0 { R AT91C_ADC_CDR0 RO } + CDR5 { R AT91C_ADC_CDR5 RO } + CHDR { R AT91C_ADC_CHDR WO } + SR { R AT91C_ADC_SR RO } + CDR4 { R AT91C_ADC_CDR4 RO } + CDR1 { R AT91C_ADC_CDR1 RO } + LCDR { R AT91C_ADC_LCDR RO } + IDR { R AT91C_ADC_IDR WO } + CR { R AT91C_ADC_CR WO } + CDR7 { R AT91C_ADC_CDR7 RO } + CDR6 { R AT91C_ADC_CDR6 RO } + IER { R AT91C_ADC_IER WO } + CHER { R AT91C_ADC_CHER WO } + CHSR { R AT91C_ADC_CHSR RO } + MR { R AT91C_ADC_MR RW } + IMR { R AT91C_ADC_IMR RO } + listeReg { CDR2 CDR3 CDR0 CDR5 CHDR SR CDR4 CDR1 LCDR IDR CR CDR7 CDR6 IER CHER CHSR MR IMR } + +} + +# ========== Peripheral attributes for PWMC_CH peripheral ========== +array set PWMC_CH3_att { + CUPDR { R AT91C_PWMC_CH3_CUPDR WO } + Reserved { R AT91C_PWMC_CH3_Reserved WO } + CPRDR { R AT91C_PWMC_CH3_CPRDR RW } + CDTYR { R AT91C_PWMC_CH3_CDTYR RW } + CCNTR { R AT91C_PWMC_CH3_CCNTR RO } + CMR { R AT91C_PWMC_CH3_CMR RW } + listeReg { CUPDR Reserved CPRDR CDTYR CCNTR CMR } + +} +array set PWMC_CH2_att { + Reserved { R AT91C_PWMC_CH2_Reserved WO } + CMR { R AT91C_PWMC_CH2_CMR RW } + CCNTR { R AT91C_PWMC_CH2_CCNTR RO } + CPRDR { R AT91C_PWMC_CH2_CPRDR RW } + CUPDR { R AT91C_PWMC_CH2_CUPDR WO } + CDTYR { R AT91C_PWMC_CH2_CDTYR RW } + listeReg { Reserved CMR CCNTR CPRDR CUPDR CDTYR } + +} +array set PWMC_CH1_att { + Reserved { R AT91C_PWMC_CH1_Reserved WO } + CUPDR { R AT91C_PWMC_CH1_CUPDR WO } + CPRDR { R AT91C_PWMC_CH1_CPRDR RW } + CCNTR { R AT91C_PWMC_CH1_CCNTR RO } + CDTYR { R AT91C_PWMC_CH1_CDTYR RW } + CMR { R AT91C_PWMC_CH1_CMR RW } + listeReg { Reserved CUPDR CPRDR CCNTR CDTYR CMR } + +} +array set PWMC_CH0_att { + Reserved { R AT91C_PWMC_CH0_Reserved WO } + CPRDR { R AT91C_PWMC_CH0_CPRDR RW } + CDTYR { R AT91C_PWMC_CH0_CDTYR RW } + CMR { R AT91C_PWMC_CH0_CMR RW } + CUPDR { R AT91C_PWMC_CH0_CUPDR WO } + CCNTR { R AT91C_PWMC_CH0_CCNTR RO } + listeReg { Reserved CPRDR CDTYR CMR CUPDR CCNTR } + +} + +# ========== Peripheral attributes for RTTC peripheral ========== +array set RTTC_att { + RTSR { R AT91C_RTTC_RTSR RO } + RTMR { R AT91C_RTTC_RTMR RW } + RTVR { R AT91C_RTTC_RTVR RO } + RTAR { R AT91C_RTTC_RTAR RW } + listeReg { RTSR RTMR RTVR RTAR } + +} + +# ========== Peripheral attributes for UDP peripheral ========== +array set UDP_att { + IMR { R AT91C_UDP_IMR RO } + FADDR { R AT91C_UDP_FADDR RW } + NUM { R AT91C_UDP_NUM RO } + FDR { R AT91C_UDP_FDR RW } + ISR { R AT91C_UDP_ISR RO } + CSR { R AT91C_UDP_CSR RW } + IDR { R AT91C_UDP_IDR WO } + ICR { R AT91C_UDP_ICR RO } + RSTEP { R AT91C_UDP_RSTEP RO } + TXVC { R AT91C_UDP_TXVC RW } + GLBSTATE { R AT91C_UDP_GLBSTATE RW } + IER { R AT91C_UDP_IER WO } + listeReg { IMR FADDR NUM FDR ISR CSR IDR ICR RSTEP TXVC GLBSTATE IER } + +} + +# ========== Peripheral attributes for EMAC peripheral ========== +array set EMAC_att { + ISR { R AT91C_EMAC_ISR RW } + SA4H { R AT91C_EMAC_SA4H RW } + SA1L { R AT91C_EMAC_SA1L RW } + ELE { R AT91C_EMAC_ELE RW } + LCOL { R AT91C_EMAC_LCOL RW } + RLE { R AT91C_EMAC_RLE RW } + WOL { R AT91C_EMAC_WOL RW } + DTF { R AT91C_EMAC_DTF RW } + TUND { R AT91C_EMAC_TUND RW } + NCR { R AT91C_EMAC_NCR RW } + SA4L { R AT91C_EMAC_SA4L RW } + RSR { R AT91C_EMAC_RSR RW } + SA3L { R AT91C_EMAC_SA3L RW } + TSR { R AT91C_EMAC_TSR RW } + IDR { R AT91C_EMAC_IDR WO } + RSE { R AT91C_EMAC_RSE RW } + ECOL { R AT91C_EMAC_ECOL RW } + TID { R AT91C_EMAC_TID RW } + HRB { R AT91C_EMAC_HRB RW } + TBQP { R AT91C_EMAC_TBQP RW } + USRIO { R AT91C_EMAC_USRIO RW } + PTR { R AT91C_EMAC_PTR RW } + SA2H { R AT91C_EMAC_SA2H RW } + ROV { R AT91C_EMAC_ROV RW } + ALE { R AT91C_EMAC_ALE RW } + RJA { R AT91C_EMAC_RJA RW } + RBQP { R AT91C_EMAC_RBQP RW } + TPF { R AT91C_EMAC_TPF RW } + NCFGR { R AT91C_EMAC_NCFGR RW } + HRT { R AT91C_EMAC_HRT RW } + USF { R AT91C_EMAC_USF RW } + FCSE { R AT91C_EMAC_FCSE RW } + TPQ { R AT91C_EMAC_TPQ RW } + MAN { R AT91C_EMAC_MAN RW } + FTO { R AT91C_EMAC_FTO RW } + REV { R AT91C_EMAC_REV RO } + IMR { R AT91C_EMAC_IMR RO } + SCF { R AT91C_EMAC_SCF RW } + PFR { R AT91C_EMAC_PFR RW } + MCF { R AT91C_EMAC_MCF RW } + NSR { R AT91C_EMAC_NSR RO } + SA2L { R AT91C_EMAC_SA2L RW } + FRO { R AT91C_EMAC_FRO RW } + IER { R AT91C_EMAC_IER WO } + SA1H { R AT91C_EMAC_SA1H RW } + CSE { R AT91C_EMAC_CSE RW } + SA3H { R AT91C_EMAC_SA3H RW } + RRE { R AT91C_EMAC_RRE RW } + STE { R AT91C_EMAC_STE RW } + listeReg { ISR SA4H SA1L ELE LCOL RLE WOL DTF TUND NCR SA4L RSR SA3L TSR IDR RSE ECOL TID HRB TBQP USRIO PTR SA2H ROV ALE RJA RBQP TPF NCFGR HRT USF FCSE TPQ MAN FTO REV IMR SCF PFR MCF NSR SA2L FRO IER SA1H CSE SA3H RRE STE } + +} + +# ========== Peripheral attributes for CAN_MB peripheral ========== +array set CAN_MB0_att { + MDL { R AT91C_CAN_MB0_MDL RW } + MAM { R AT91C_CAN_MB0_MAM RW } + MCR { R AT91C_CAN_MB0_MCR WO } + MID { R AT91C_CAN_MB0_MID RW } + MSR { R AT91C_CAN_MB0_MSR RO } + MFID { R AT91C_CAN_MB0_MFID RO } + MDH { R AT91C_CAN_MB0_MDH RW } + MMR { R AT91C_CAN_MB0_MMR RW } + listeReg { MDL MAM MCR MID MSR MFID MDH MMR } + +} +array set CAN_MB1_att { + MDL { R AT91C_CAN_MB1_MDL RW } + MID { R AT91C_CAN_MB1_MID RW } + MMR { R AT91C_CAN_MB1_MMR RW } + MSR { R AT91C_CAN_MB1_MSR RO } + MAM { R AT91C_CAN_MB1_MAM RW } + MDH { R AT91C_CAN_MB1_MDH RW } + MCR { R AT91C_CAN_MB1_MCR WO } + MFID { R AT91C_CAN_MB1_MFID RO } + listeReg { MDL MID MMR MSR MAM MDH MCR MFID } + +} +array set CAN_MB2_att { + MCR { R AT91C_CAN_MB2_MCR WO } + MDH { R AT91C_CAN_MB2_MDH RW } + MID { R AT91C_CAN_MB2_MID RW } + MDL { R AT91C_CAN_MB2_MDL RW } + MMR { R AT91C_CAN_MB2_MMR RW } + MAM { R AT91C_CAN_MB2_MAM RW } + MFID { R AT91C_CAN_MB2_MFID RO } + MSR { R AT91C_CAN_MB2_MSR RO } + listeReg { MCR MDH MID MDL MMR MAM MFID MSR } + +} +array set CAN_MB3_att { + MFID { R AT91C_CAN_MB3_MFID RO } + MAM { R AT91C_CAN_MB3_MAM RW } + MID { R AT91C_CAN_MB3_MID RW } + MCR { R AT91C_CAN_MB3_MCR WO } + MMR { R AT91C_CAN_MB3_MMR RW } + MSR { R AT91C_CAN_MB3_MSR RO } + MDL { R AT91C_CAN_MB3_MDL RW } + MDH { R AT91C_CAN_MB3_MDH RW } + listeReg { MFID MAM MID MCR MMR MSR MDL MDH } + +} +array set CAN_MB4_att { + MID { R AT91C_CAN_MB4_MID RW } + MMR { R AT91C_CAN_MB4_MMR RW } + MDH { R AT91C_CAN_MB4_MDH RW } + MFID { R AT91C_CAN_MB4_MFID RO } + MSR { R AT91C_CAN_MB4_MSR RO } + MCR { R AT91C_CAN_MB4_MCR WO } + MDL { R AT91C_CAN_MB4_MDL RW } + MAM { R AT91C_CAN_MB4_MAM RW } + listeReg { MID MMR MDH MFID MSR MCR MDL MAM } + +} +array set CAN_MB5_att { + MSR { R AT91C_CAN_MB5_MSR RO } + MCR { R AT91C_CAN_MB5_MCR WO } + MFID { R AT91C_CAN_MB5_MFID RO } + MDH { R AT91C_CAN_MB5_MDH RW } + MID { R AT91C_CAN_MB5_MID RW } + MMR { R AT91C_CAN_MB5_MMR RW } + MDL { R AT91C_CAN_MB5_MDL RW } + MAM { R AT91C_CAN_MB5_MAM RW } + listeReg { MSR MCR MFID MDH MID MMR MDL MAM } + +} +array set CAN_MB6_att { + MFID { R AT91C_CAN_MB6_MFID RO } + MID { R AT91C_CAN_MB6_MID RW } + MAM { R AT91C_CAN_MB6_MAM RW } + MSR { R AT91C_CAN_MB6_MSR RO } + MDL { R AT91C_CAN_MB6_MDL RW } + MCR { R AT91C_CAN_MB6_MCR WO } + MDH { R AT91C_CAN_MB6_MDH RW } + MMR { R AT91C_CAN_MB6_MMR RW } + listeReg { MFID MID MAM MSR MDL MCR MDH MMR } + +} +array set CAN_MB7_att { + MCR { R AT91C_CAN_MB7_MCR WO } + MDH { R AT91C_CAN_MB7_MDH RW } + MFID { R AT91C_CAN_MB7_MFID RO } + MDL { R AT91C_CAN_MB7_MDL RW } + MID { R AT91C_CAN_MB7_MID RW } + MMR { R AT91C_CAN_MB7_MMR RW } + MAM { R AT91C_CAN_MB7_MAM RW } + MSR { R AT91C_CAN_MB7_MSR RO } + listeReg { MCR MDH MFID MDL MID MMR MAM MSR } + +} + +# ========== Peripheral attributes for TC peripheral ========== +array set TC0_att { + SR { R AT91C_TC0_SR RO } + RC { R AT91C_TC0_RC RW } + RB { R AT91C_TC0_RB RW } + CCR { R AT91C_TC0_CCR WO } + CMR { R AT91C_TC0_CMR RW } + IER { R AT91C_TC0_IER WO } + RA { R AT91C_TC0_RA RW } + IDR { R AT91C_TC0_IDR WO } + CV { R AT91C_TC0_CV RW } + IMR { R AT91C_TC0_IMR RO } + listeReg { SR RC RB CCR CMR IER RA IDR CV IMR } + +} +array set TC1_att { + RB { R AT91C_TC1_RB RW } + CCR { R AT91C_TC1_CCR WO } + IER { R AT91C_TC1_IER WO } + IDR { R AT91C_TC1_IDR WO } + SR { R AT91C_TC1_SR RO } + CMR { R AT91C_TC1_CMR RW } + RA { R AT91C_TC1_RA RW } + RC { R AT91C_TC1_RC RW } + IMR { R AT91C_TC1_IMR RO } + CV { R AT91C_TC1_CV RW } + listeReg { RB CCR IER IDR SR CMR RA RC IMR CV } + +} +array set TC2_att { + CMR { R AT91C_TC2_CMR RW } + CCR { R AT91C_TC2_CCR WO } + CV { R AT91C_TC2_CV RW } + RA { R AT91C_TC2_RA RW } + RB { R AT91C_TC2_RB RW } + IDR { R AT91C_TC2_IDR WO } + IMR { R AT91C_TC2_IMR RO } + RC { R AT91C_TC2_RC RW } + IER { R AT91C_TC2_IER WO } + SR { R AT91C_TC2_SR RO } + listeReg { CMR CCR CV RA RB IDR IMR RC IER SR } + +} + +# ========== Peripheral attributes for SYS peripheral ========== +array set SYS_att { + listeReg { } + +} + +# ========== Peripheral attributes for MC peripheral ========== +array set MC_att { + ASR { R AT91C_MC_ASR RO } + RCR { R AT91C_MC_RCR WO } + FCR { R AT91C_MC_FCR WO } + AASR { R AT91C_MC_AASR RO } + FSR { R AT91C_MC_FSR RO } + FMR { R AT91C_MC_FMR RW } + listeReg { ASR RCR FCR AASR FSR FMR } + +} + +# ========== Peripheral attributes for PIO peripheral ========== +array set PIOA_att { + ODR { R AT91C_PIOA_ODR WO } + SODR { R AT91C_PIOA_SODR WO } + ISR { R AT91C_PIOA_ISR RO } + ABSR { R AT91C_PIOA_ABSR RO } + IER { R AT91C_PIOA_IER WO } + PPUDR { R AT91C_PIOA_PPUDR WO } + IMR { R AT91C_PIOA_IMR RO } + PER { R AT91C_PIOA_PER WO } + IFDR { R AT91C_PIOA_IFDR WO } + OWDR { R AT91C_PIOA_OWDR WO } + MDSR { R AT91C_PIOA_MDSR RO } + IDR { R AT91C_PIOA_IDR WO } + ODSR { R AT91C_PIOA_ODSR RO } + PPUSR { R AT91C_PIOA_PPUSR RO } + OWSR { R AT91C_PIOA_OWSR RO } + BSR { R AT91C_PIOA_BSR WO } + OWER { R AT91C_PIOA_OWER WO } + IFER { R AT91C_PIOA_IFER WO } + PDSR { R AT91C_PIOA_PDSR RO } + PPUER { R AT91C_PIOA_PPUER WO } + OSR { R AT91C_PIOA_OSR RO } + ASR { R AT91C_PIOA_ASR WO } + MDDR { R AT91C_PIOA_MDDR WO } + CODR { R AT91C_PIOA_CODR WO } + MDER { R AT91C_PIOA_MDER WO } + PDR { R AT91C_PIOA_PDR WO } + IFSR { R AT91C_PIOA_IFSR RO } + OER { R AT91C_PIOA_OER WO } + PSR { R AT91C_PIOA_PSR RO } + listeReg { ODR SODR ISR ABSR IER PPUDR IMR PER IFDR OWDR MDSR IDR ODSR PPUSR OWSR BSR OWER IFER PDSR PPUER OSR ASR MDDR CODR MDER PDR IFSR OER PSR } + +} +array set PIOB_att { + OWDR { R AT91C_PIOB_OWDR WO } + MDER { R AT91C_PIOB_MDER WO } + PPUSR { R AT91C_PIOB_PPUSR RO } + IMR { R AT91C_PIOB_IMR RO } + ASR { R AT91C_PIOB_ASR WO } + PPUDR { R AT91C_PIOB_PPUDR WO } + PSR { R AT91C_PIOB_PSR RO } + IER { R AT91C_PIOB_IER WO } + CODR { R AT91C_PIOB_CODR WO } + OWER { R AT91C_PIOB_OWER WO } + ABSR { R AT91C_PIOB_ABSR RO } + IFDR { R AT91C_PIOB_IFDR WO } + PDSR { R AT91C_PIOB_PDSR RO } + IDR { R AT91C_PIOB_IDR WO } + OWSR { R AT91C_PIOB_OWSR RO } + PDR { R AT91C_PIOB_PDR WO } + ODR { R AT91C_PIOB_ODR WO } + IFSR { R AT91C_PIOB_IFSR RO } + PPUER { R AT91C_PIOB_PPUER WO } + SODR { R AT91C_PIOB_SODR WO } + ISR { R AT91C_PIOB_ISR RO } + ODSR { R AT91C_PIOB_ODSR RO } + OSR { R AT91C_PIOB_OSR RO } + MDSR { R AT91C_PIOB_MDSR RO } + IFER { R AT91C_PIOB_IFER WO } + BSR { R AT91C_PIOB_BSR WO } + MDDR { R AT91C_PIOB_MDDR WO } + OER { R AT91C_PIOB_OER WO } + PER { R AT91C_PIOB_PER WO } + listeReg { OWDR MDER PPUSR IMR ASR PPUDR PSR IER CODR OWER ABSR IFDR PDSR IDR OWSR PDR ODR IFSR PPUER SODR ISR ODSR OSR MDSR IFER BSR MDDR OER PER } + +} + +# ========== Peripheral attributes for CAN peripheral ========== +array set CAN_att { + TCR { R AT91C_CAN_TCR WO } + IMR { R AT91C_CAN_IMR RO } + IER { R AT91C_CAN_IER WO } + ECR { R AT91C_CAN_ECR RO } + TIMESTP { R AT91C_CAN_TIMESTP RO } + MR { R AT91C_CAN_MR RW } + IDR { R AT91C_CAN_IDR WO } + ACR { R AT91C_CAN_ACR WO } + TIM { R AT91C_CAN_TIM RO } + SR { R AT91C_CAN_SR RO } + BR { R AT91C_CAN_BR RW } + VR { R AT91C_CAN_VR RO } + listeReg { TCR IMR IER ECR TIMESTP MR IDR ACR TIM SR BR VR } + +} + +# ========== Peripheral attributes for PWMC peripheral ========== +array set PWMC_att { + IDR { R AT91C_PWMC_IDR WO } + DIS { R AT91C_PWMC_DIS WO } + IER { R AT91C_PWMC_IER WO } + VR { R AT91C_PWMC_VR RO } + ISR { R AT91C_PWMC_ISR RO } + SR { R AT91C_PWMC_SR RO } + IMR { R AT91C_PWMC_IMR RO } + MR { R AT91C_PWMC_MR RW } + ENA { R AT91C_PWMC_ENA WO } + listeReg { IDR DIS IER VR ISR SR IMR MR ENA } + +} + +# ========== Peripheral attributes for PDC peripheral ========== +array set PDC_DBGU_att { + TCR { R AT91C_DBGU_TCR RW } + RNPR { R AT91C_DBGU_RNPR RW } + TNPR { R AT91C_DBGU_TNPR RW } + TPR { R AT91C_DBGU_TPR RW } + RPR { R AT91C_DBGU_RPR RW } + RCR { R AT91C_DBGU_RCR RW } + RNCR { R AT91C_DBGU_RNCR RW } + PTCR { R AT91C_DBGU_PTCR WO } + PTSR { R AT91C_DBGU_PTSR RO } + TNCR { R AT91C_DBGU_TNCR RW } + listeReg { TCR RNPR TNPR TPR RPR RCR RNCR PTCR PTSR TNCR } + +} +array set PDC_SPI1_att { + PTCR { R AT91C_SPI1_PTCR WO } + RPR { R AT91C_SPI1_RPR RW } + TNCR { R AT91C_SPI1_TNCR RW } + TPR { R AT91C_SPI1_TPR RW } + TNPR { R AT91C_SPI1_TNPR RW } + TCR { R AT91C_SPI1_TCR RW } + RCR { R AT91C_SPI1_RCR RW } + RNPR { R AT91C_SPI1_RNPR RW } + RNCR { R AT91C_SPI1_RNCR RW } + PTSR { R AT91C_SPI1_PTSR RO } + listeReg { PTCR RPR TNCR TPR TNPR TCR RCR RNPR RNCR PTSR } + +} +array set PDC_SPI0_att { + PTCR { R AT91C_SPI0_PTCR WO } + TPR { R AT91C_SPI0_TPR RW } + TCR { R AT91C_SPI0_TCR RW } + RCR { R AT91C_SPI0_RCR RW } + PTSR { R AT91C_SPI0_PTSR RO } + RNPR { R AT91C_SPI0_RNPR RW } + RPR { R AT91C_SPI0_RPR RW } + TNCR { R AT91C_SPI0_TNCR RW } + RNCR { R AT91C_SPI0_RNCR RW } + TNPR { R AT91C_SPI0_TNPR RW } + listeReg { PTCR TPR TCR RCR PTSR RNPR RPR TNCR RNCR TNPR } + +} +array set PDC_US1_att { + RNCR { R AT91C_US1_RNCR RW } + PTCR { R AT91C_US1_PTCR WO } + TCR { R AT91C_US1_TCR RW } + PTSR { R AT91C_US1_PTSR RO } + TNPR { R AT91C_US1_TNPR RW } + RCR { R AT91C_US1_RCR RW } + RNPR { R AT91C_US1_RNPR RW } + RPR { R AT91C_US1_RPR RW } + TNCR { R AT91C_US1_TNCR RW } + TPR { R AT91C_US1_TPR RW } + listeReg { RNCR PTCR TCR PTSR TNPR RCR RNPR RPR TNCR TPR } + +} +array set PDC_US0_att { + TNPR { R AT91C_US0_TNPR RW } + RNPR { R AT91C_US0_RNPR RW } + TCR { R AT91C_US0_TCR RW } + PTCR { R AT91C_US0_PTCR WO } + PTSR { R AT91C_US0_PTSR RO } + TNCR { R AT91C_US0_TNCR RW } + TPR { R AT91C_US0_TPR RW } + RCR { R AT91C_US0_RCR RW } + RPR { R AT91C_US0_RPR RW } + RNCR { R AT91C_US0_RNCR RW } + listeReg { TNPR RNPR TCR PTCR PTSR TNCR TPR RCR RPR RNCR } + +} +array set PDC_SSC_att { + TNCR { R AT91C_SSC_TNCR RW } + RPR { R AT91C_SSC_RPR RW } + RNCR { R AT91C_SSC_RNCR RW } + TPR { R AT91C_SSC_TPR RW } + PTCR { R AT91C_SSC_PTCR WO } + TCR { R AT91C_SSC_TCR RW } + RCR { R AT91C_SSC_RCR RW } + RNPR { R AT91C_SSC_RNPR RW } + TNPR { R AT91C_SSC_TNPR RW } + PTSR { R AT91C_SSC_PTSR RO } + listeReg { TNCR RPR RNCR TPR PTCR TCR RCR RNPR TNPR PTSR } + +} +array set PDC_ADC_att { + PTSR { R AT91C_ADC_PTSR RO } + PTCR { R AT91C_ADC_PTCR WO } + TNPR { R AT91C_ADC_TNPR RW } + TNCR { R AT91C_ADC_TNCR RW } + RNPR { R AT91C_ADC_RNPR RW } + RNCR { R AT91C_ADC_RNCR RW } + RPR { R AT91C_ADC_RPR RW } + TCR { R AT91C_ADC_TCR RW } + TPR { R AT91C_ADC_TPR RW } + RCR { R AT91C_ADC_RCR RW } + listeReg { PTSR PTCR TNPR TNCR RNPR RNCR RPR TCR TPR RCR } + +} + +# ========== PIO information ========== + +array set def_PIOA_att { + PA0 { RXD0 } + PA1 { TXD0 } + PA10 { TWD } + PA11 { TWCK } + PA12 { SPI0_NPCS0 } + PA13 { SPI0_NPCS1 PCK1 } + PA14 { SPI0_NPCS2 IRQ1 } + PA15 { SPI0_NPCS3 TCLK2 } + PA16 { SPI0_MISO } + PA17 { SPI0_MOSI } + PA18 { SPI0_SPCK } + PA19 { CANRX } + PA2 { SCK0 SPI1_NPCS1 } + PA20 { CANTX } + PA21 { TF SPI1_NPCS0 } + PA22 { TK SPI1_SPCK } + PA23 { TD SPI1_MOSI } + PA24 { RD SPI1_MISO } + PA25 { RK SPI1_NPCS1 } + PA26 { RF SPI1_NPCS2 } + PA27 { DRXD PCK3 } + PA28 { DTXD } + PA29 { FIQ SPI1_NPCS3 } + PA3 { RTS0 SPI1_NPCS2 } + PA30 { IRQ0 PCK2 } + PA4 { CTS0 SPI1_NPCS3 } + PA5 { RXD1 } + PA6 { TXD1 } + PA7 { SCK1 SPI0_NPCS1 } + PA8 { RTS1 SPI0_NPCS2 } + PA9 { CTS1 SPI0_NPCS3 } + } + +array set def_PIOB_att { + PB0 { ETXCK_EREFCK PCK0 } + PB1 { ETXEN } + PB10 { ETX2 SPI1_NPCS1 } + PB11 { ETX3 SPI1_NPCS2 } + PB12 { ETXER TCLK0 } + PB13 { ERX2 SPI0_NPCS1 } + PB14 { ERX3 SPI0_NPCS2 } + PB15 { ERXDV_ECRSDV } + PB16 { ECOL SPI1_NPCS3 } + PB17 { ERXCK SPI0_NPCS3 } + PB18 { EF100 ADTRG } + PB19 { PWM0 TCLK1 } + PB2 { ETX0 } + PB20 { PWM1 PCK0 } + PB21 { PWM2 PCK1 } + PB22 { PWM3 PCK2 } + PB23 { TIOA0 DCD1 } + PB24 { TIOB0 DSR1 } + PB25 { TIOA1 DTR1 } + PB26 { TIOB1 RI1 } + PB27 { TIOA2 PWM0 } + PB28 { TIOB2 PWM1 } + PB29 { PCK1 PWM2 } + PB3 { ETX1 } + PB30 { PCK2 PWM3 } + PB4 { ECRS } + PB5 { ERX0 } + PB6 { ERX1 } + PB7 { ERXER } + PB8 { EMDC } + PB9 { EMDIO } + } diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256_inc.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256_inc.h new file mode 100644 index 0000000..b393d05 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256_inc.h @@ -0,0 +1,2268 @@ +// ---------------------------------------------------------------------------- +// ATMEL Microcontroller Software Support - ROUSSET - +// ---------------------------------------------------------------------------- +// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// ---------------------------------------------------------------------------- +// File Name : AT91SAM7X256.h +// Object : AT91SAM7X256 definitions +// Generated : AT91 SW Application Group 11/02/2005 (15:17:24) +// +// CVS Reference : /AT91SAM7X256.pl/1.14/Tue Sep 13 15:06:52 2005// +// CVS Reference : /SYS_SAM7X.pl/1.3/Tue Feb 1 17:01:43 2005// +// CVS Reference : /MC_SAM7X.pl/1.2/Fri May 20 14:13:04 2005// +// CVS Reference : /PMC_SAM7X.pl/1.4/Tue Feb 8 13:58:10 2005// +// CVS Reference : /RSTC_SAM7X.pl/1.2/Wed Jul 13 14:57:50 2005// +// CVS Reference : /UDP_SAM7X.pl/1.1/Tue May 10 11:35:35 2005// +// CVS Reference : /PWM_SAM7X.pl/1.1/Tue May 10 11:53:07 2005// +// CVS Reference : /AIC_6075B.pl/1.3/Fri May 20 14:01:30 2005// +// CVS Reference : /PIO_6057A.pl/1.2/Thu Feb 3 10:18:28 2005// +// CVS Reference : /RTTC_6081A.pl/1.2/Tue Nov 9 14:43:58 2004// +// CVS Reference : /PITC_6079A.pl/1.2/Tue Nov 9 14:43:56 2004// +// CVS Reference : /WDTC_6080A.pl/1.3/Tue Nov 9 14:44:00 2004// +// CVS Reference : /VREG_6085B.pl/1.1/Tue Feb 1 16:05:48 2005// +// CVS Reference : /PDC_6074C.pl/1.2/Thu Feb 3 08:48:54 2005// +// CVS Reference : /DBGU_6059D.pl/1.1/Mon Jan 31 13:15:32 2005// +// CVS Reference : /SPI_6088D.pl/1.3/Fri May 20 14:08:59 2005// +// CVS Reference : /US_6089C.pl/1.1/Mon Jul 12 18:23:26 2004// +// CVS Reference : /SSC_6078B.pl/1.1/Wed Jul 13 15:19:19 2005// +// CVS Reference : /TWI_6061A.pl/1.1/Tue Jul 13 07:38:06 2004// +// CVS Reference : /TC_6082A.pl/1.7/Fri Mar 11 12:52:17 2005// +// CVS Reference : /CAN_6019B.pl/1.1/Tue Mar 8 12:42:22 2005// +// CVS Reference : /EMACB_6119A.pl/1.6/Wed Jul 13 15:05:35 2005// +// CVS Reference : /ADC_6051C.pl/1.1/Fri Oct 17 09:12:38 2003// +// ---------------------------------------------------------------------------- + +// Hardware register definition + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR System Peripherals +// ***************************************************************************** + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Advanced Interrupt Controller +// ***************************************************************************** +// *** Register offset in AT91S_AIC structure *** +#define AIC_SMR ( 0) // Source Mode Register +#define AIC_SVR (128) // Source Vector Register +#define AIC_IVR (256) // IRQ Vector Register +#define AIC_FVR (260) // FIQ Vector Register +#define AIC_ISR (264) // Interrupt Status Register +#define AIC_IPR (268) // Interrupt Pending Register +#define AIC_IMR (272) // Interrupt Mask Register +#define AIC_CISR (276) // Core Interrupt Status Register +#define AIC_IECR (288) // Interrupt Enable Command Register +#define AIC_IDCR (292) // Interrupt Disable Command Register +#define AIC_ICCR (296) // Interrupt Clear Command Register +#define AIC_ISCR (300) // Interrupt Set Command Register +#define AIC_EOICR (304) // End of Interrupt Command Register +#define AIC_SPU (308) // Spurious Vector Register +#define AIC_DCR (312) // Debug Control Register (Protect) +#define AIC_FFER (320) // Fast Forcing Enable Register +#define AIC_FFDR (324) // Fast Forcing Disable Register +#define AIC_FFSR (328) // Fast Forcing Status Register +// -------- AIC_SMR : (AIC Offset: 0x0) Control Register -------- +#define AT91C_AIC_PRIOR (0x7 << 0) // (AIC) Priority Level +#define AT91C_AIC_PRIOR_LOWEST (0x0) // (AIC) Lowest priority level +#define AT91C_AIC_PRIOR_HIGHEST (0x7) // (AIC) Highest priority level +#define AT91C_AIC_SRCTYPE (0x3 << 5) // (AIC) Interrupt Source Type +#define AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL (0x0 << 5) // (AIC) Internal Sources Code Label High-level Sensitive +#define AT91C_AIC_SRCTYPE_EXT_LOW_LEVEL (0x0 << 5) // (AIC) External Sources Code Label Low-level Sensitive +#define AT91C_AIC_SRCTYPE_INT_POSITIVE_EDGE (0x1 << 5) // (AIC) Internal Sources Code Label Positive Edge triggered +#define AT91C_AIC_SRCTYPE_EXT_NEGATIVE_EDGE (0x1 << 5) // (AIC) External Sources Code Label Negative Edge triggered +#define AT91C_AIC_SRCTYPE_HIGH_LEVEL (0x2 << 5) // (AIC) Internal Or External Sources Code Label High-level Sensitive +#define AT91C_AIC_SRCTYPE_POSITIVE_EDGE (0x3 << 5) // (AIC) Internal Or External Sources Code Label Positive Edge triggered +// -------- AIC_CISR : (AIC Offset: 0x114) AIC Core Interrupt Status Register -------- +#define AT91C_AIC_NFIQ (0x1 << 0) // (AIC) NFIQ Status +#define AT91C_AIC_NIRQ (0x1 << 1) // (AIC) NIRQ Status +// -------- AIC_DCR : (AIC Offset: 0x138) AIC Debug Control Register (Protect) -------- +#define AT91C_AIC_DCR_PROT (0x1 << 0) // (AIC) Protection Mode +#define AT91C_AIC_DCR_GMSK (0x1 << 1) // (AIC) General Mask + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Peripheral DMA Controller +// ***************************************************************************** +// *** Register offset in AT91S_PDC structure *** +#define PDC_RPR ( 0) // Receive Pointer Register +#define PDC_RCR ( 4) // Receive Counter Register +#define PDC_TPR ( 8) // Transmit Pointer Register +#define PDC_TCR (12) // Transmit Counter Register +#define PDC_RNPR (16) // Receive Next Pointer Register +#define PDC_RNCR (20) // Receive Next Counter Register +#define PDC_TNPR (24) // Transmit Next Pointer Register +#define PDC_TNCR (28) // Transmit Next Counter Register +#define PDC_PTCR (32) // PDC Transfer Control Register +#define PDC_PTSR (36) // PDC Transfer Status Register +// -------- PDC_PTCR : (PDC Offset: 0x20) PDC Transfer Control Register -------- +#define AT91C_PDC_RXTEN (0x1 << 0) // (PDC) Receiver Transfer Enable +#define AT91C_PDC_RXTDIS (0x1 << 1) // (PDC) Receiver Transfer Disable +#define AT91C_PDC_TXTEN (0x1 << 8) // (PDC) Transmitter Transfer Enable +#define AT91C_PDC_TXTDIS (0x1 << 9) // (PDC) Transmitter Transfer Disable +// -------- PDC_PTSR : (PDC Offset: 0x24) PDC Transfer Status Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Debug Unit +// ***************************************************************************** +// *** Register offset in AT91S_DBGU structure *** +#define DBGU_CR ( 0) // Control Register +#define DBGU_MR ( 4) // Mode Register +#define DBGU_IER ( 8) // Interrupt Enable Register +#define DBGU_IDR (12) // Interrupt Disable Register +#define DBGU_IMR (16) // Interrupt Mask Register +#define DBGU_CSR (20) // Channel Status Register +#define DBGU_RHR (24) // Receiver Holding Register +#define DBGU_THR (28) // Transmitter Holding Register +#define DBGU_BRGR (32) // Baud Rate Generator Register +#define DBGU_CIDR (64) // Chip ID Register +#define DBGU_EXID (68) // Chip ID Extension Register +#define DBGU_FNTR (72) // Force NTRST Register +#define DBGU_RPR (256) // Receive Pointer Register +#define DBGU_RCR (260) // Receive Counter Register +#define DBGU_TPR (264) // Transmit Pointer Register +#define DBGU_TCR (268) // Transmit Counter Register +#define DBGU_RNPR (272) // Receive Next Pointer Register +#define DBGU_RNCR (276) // Receive Next Counter Register +#define DBGU_TNPR (280) // Transmit Next Pointer Register +#define DBGU_TNCR (284) // Transmit Next Counter Register +#define DBGU_PTCR (288) // PDC Transfer Control Register +#define DBGU_PTSR (292) // PDC Transfer Status Register +// -------- DBGU_CR : (DBGU Offset: 0x0) Debug Unit Control Register -------- +#define AT91C_US_RSTRX (0x1 << 2) // (DBGU) Reset Receiver +#define AT91C_US_RSTTX (0x1 << 3) // (DBGU) Reset Transmitter +#define AT91C_US_RXEN (0x1 << 4) // (DBGU) Receiver Enable +#define AT91C_US_RXDIS (0x1 << 5) // (DBGU) Receiver Disable +#define AT91C_US_TXEN (0x1 << 6) // (DBGU) Transmitter Enable +#define AT91C_US_TXDIS (0x1 << 7) // (DBGU) Transmitter Disable +#define AT91C_US_RSTSTA (0x1 << 8) // (DBGU) Reset Status Bits +// -------- DBGU_MR : (DBGU Offset: 0x4) Debug Unit Mode Register -------- +#define AT91C_US_PAR (0x7 << 9) // (DBGU) Parity type +#define AT91C_US_PAR_EVEN (0x0 << 9) // (DBGU) Even Parity +#define AT91C_US_PAR_ODD (0x1 << 9) // (DBGU) Odd Parity +#define AT91C_US_PAR_SPACE (0x2 << 9) // (DBGU) Parity forced to 0 (Space) +#define AT91C_US_PAR_MARK (0x3 << 9) // (DBGU) Parity forced to 1 (Mark) +#define AT91C_US_PAR_NONE (0x4 << 9) // (DBGU) No Parity +#define AT91C_US_PAR_MULTI_DROP (0x6 << 9) // (DBGU) Multi-drop mode +#define AT91C_US_CHMODE (0x3 << 14) // (DBGU) Channel Mode +#define AT91C_US_CHMODE_NORMAL (0x0 << 14) // (DBGU) Normal Mode: The USART channel operates as an RX/TX USART. +#define AT91C_US_CHMODE_AUTO (0x1 << 14) // (DBGU) Automatic Echo: Receiver Data Input is connected to the TXD pin. +#define AT91C_US_CHMODE_LOCAL (0x2 << 14) // (DBGU) Local Loopback: Transmitter Output Signal is connected to Receiver Input Signal. +#define AT91C_US_CHMODE_REMOTE (0x3 << 14) // (DBGU) Remote Loopback: RXD pin is internally connected to TXD pin. +// -------- DBGU_IER : (DBGU Offset: 0x8) Debug Unit Interrupt Enable Register -------- +#define AT91C_US_RXRDY (0x1 << 0) // (DBGU) RXRDY Interrupt +#define AT91C_US_TXRDY (0x1 << 1) // (DBGU) TXRDY Interrupt +#define AT91C_US_ENDRX (0x1 << 3) // (DBGU) End of Receive Transfer Interrupt +#define AT91C_US_ENDTX (0x1 << 4) // (DBGU) End of Transmit Interrupt +#define AT91C_US_OVRE (0x1 << 5) // (DBGU) Overrun Interrupt +#define AT91C_US_FRAME (0x1 << 6) // (DBGU) Framing Error Interrupt +#define AT91C_US_PARE (0x1 << 7) // (DBGU) Parity Error Interrupt +#define AT91C_US_TXEMPTY (0x1 << 9) // (DBGU) TXEMPTY Interrupt +#define AT91C_US_TXBUFE (0x1 << 11) // (DBGU) TXBUFE Interrupt +#define AT91C_US_RXBUFF (0x1 << 12) // (DBGU) RXBUFF Interrupt +#define AT91C_US_COMM_TX (0x1 << 30) // (DBGU) COMM_TX Interrupt +#define AT91C_US_COMM_RX (0x1 << 31) // (DBGU) COMM_RX Interrupt +// -------- DBGU_IDR : (DBGU Offset: 0xc) Debug Unit Interrupt Disable Register -------- +// -------- DBGU_IMR : (DBGU Offset: 0x10) Debug Unit Interrupt Mask Register -------- +// -------- DBGU_CSR : (DBGU Offset: 0x14) Debug Unit Channel Status Register -------- +// -------- DBGU_FNTR : (DBGU Offset: 0x48) Debug Unit FORCE_NTRST Register -------- +#define AT91C_US_FORCE_NTRST (0x1 << 0) // (DBGU) Force NTRST in JTAG + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Parallel Input Output Controler +// ***************************************************************************** +// *** Register offset in AT91S_PIO structure *** +#define PIO_PER ( 0) // PIO Enable Register +#define PIO_PDR ( 4) // PIO Disable Register +#define PIO_PSR ( 8) // PIO Status Register +#define PIO_OER (16) // Output Enable Register +#define PIO_ODR (20) // Output Disable Registerr +#define PIO_OSR (24) // Output Status Register +#define PIO_IFER (32) // Input Filter Enable Register +#define PIO_IFDR (36) // Input Filter Disable Register +#define PIO_IFSR (40) // Input Filter Status Register +#define PIO_SODR (48) // Set Output Data Register +#define PIO_CODR (52) // Clear Output Data Register +#define PIO_ODSR (56) // Output Data Status Register +#define PIO_PDSR (60) // Pin Data Status Register +#define PIO_IER (64) // Interrupt Enable Register +#define PIO_IDR (68) // Interrupt Disable Register +#define PIO_IMR (72) // Interrupt Mask Register +#define PIO_ISR (76) // Interrupt Status Register +#define PIO_MDER (80) // Multi-driver Enable Register +#define PIO_MDDR (84) // Multi-driver Disable Register +#define PIO_MDSR (88) // Multi-driver Status Register +#define PIO_PPUDR (96) // Pull-up Disable Register +#define PIO_PPUER (100) // Pull-up Enable Register +#define PIO_PPUSR (104) // Pull-up Status Register +#define PIO_ASR (112) // Select A Register +#define PIO_BSR (116) // Select B Register +#define PIO_ABSR (120) // AB Select Status Register +#define PIO_OWER (160) // Output Write Enable Register +#define PIO_OWDR (164) // Output Write Disable Register +#define PIO_OWSR (168) // Output Write Status Register + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Clock Generator Controler +// ***************************************************************************** +// *** Register offset in AT91S_CKGR structure *** +#define CKGR_MOR ( 0) // Main Oscillator Register +#define CKGR_MCFR ( 4) // Main Clock Frequency Register +#define CKGR_PLLR (12) // PLL Register +// -------- CKGR_MOR : (CKGR Offset: 0x0) Main Oscillator Register -------- +#define AT91C_CKGR_MOSCEN (0x1 << 0) // (CKGR) Main Oscillator Enable +#define AT91C_CKGR_OSCBYPASS (0x1 << 1) // (CKGR) Main Oscillator Bypass +#define AT91C_CKGR_OSCOUNT (0xFF << 8) // (CKGR) Main Oscillator Start-up Time +// -------- CKGR_MCFR : (CKGR Offset: 0x4) Main Clock Frequency Register -------- +#define AT91C_CKGR_MAINF (0xFFFF << 0) // (CKGR) Main Clock Frequency +#define AT91C_CKGR_MAINRDY (0x1 << 16) // (CKGR) Main Clock Ready +// -------- CKGR_PLLR : (CKGR Offset: 0xc) PLL B Register -------- +#define AT91C_CKGR_DIV (0xFF << 0) // (CKGR) Divider Selected +#define AT91C_CKGR_DIV_0 (0x0) // (CKGR) Divider output is 0 +#define AT91C_CKGR_DIV_BYPASS (0x1) // (CKGR) Divider is bypassed +#define AT91C_CKGR_PLLCOUNT (0x3F << 8) // (CKGR) PLL Counter +#define AT91C_CKGR_OUT (0x3 << 14) // (CKGR) PLL Output Frequency Range +#define AT91C_CKGR_OUT_0 (0x0 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_OUT_1 (0x1 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_OUT_2 (0x2 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_OUT_3 (0x3 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_MUL (0x7FF << 16) // (CKGR) PLL Multiplier +#define AT91C_CKGR_USBDIV (0x3 << 28) // (CKGR) Divider for USB Clocks +#define AT91C_CKGR_USBDIV_0 (0x0 << 28) // (CKGR) Divider output is PLL clock output +#define AT91C_CKGR_USBDIV_1 (0x1 << 28) // (CKGR) Divider output is PLL clock output divided by 2 +#define AT91C_CKGR_USBDIV_2 (0x2 << 28) // (CKGR) Divider output is PLL clock output divided by 4 + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Power Management Controler +// ***************************************************************************** +// *** Register offset in AT91S_PMC structure *** +#define PMC_SCER ( 0) // System Clock Enable Register +#define PMC_SCDR ( 4) // System Clock Disable Register +#define PMC_SCSR ( 8) // System Clock Status Register +#define PMC_PCER (16) // Peripheral Clock Enable Register +#define PMC_PCDR (20) // Peripheral Clock Disable Register +#define PMC_PCSR (24) // Peripheral Clock Status Register +#define PMC_MOR (32) // Main Oscillator Register +#define PMC_MCFR (36) // Main Clock Frequency Register +#define PMC_PLLR (44) // PLL Register +#define PMC_MCKR (48) // Master Clock Register +#define PMC_PCKR (64) // Programmable Clock Register +#define PMC_IER (96) // Interrupt Enable Register +#define PMC_IDR (100) // Interrupt Disable Register +#define PMC_SR (104) // Status Register +#define PMC_IMR (108) // Interrupt Mask Register +// -------- PMC_SCER : (PMC Offset: 0x0) System Clock Enable Register -------- +#define AT91C_PMC_PCK (0x1 << 0) // (PMC) Processor Clock +#define AT91C_PMC_UDP (0x1 << 7) // (PMC) USB Device Port Clock +#define AT91C_PMC_PCK0 (0x1 << 8) // (PMC) Programmable Clock Output +#define AT91C_PMC_PCK1 (0x1 << 9) // (PMC) Programmable Clock Output +#define AT91C_PMC_PCK2 (0x1 << 10) // (PMC) Programmable Clock Output +#define AT91C_PMC_PCK3 (0x1 << 11) // (PMC) Programmable Clock Output +// -------- PMC_SCDR : (PMC Offset: 0x4) System Clock Disable Register -------- +// -------- PMC_SCSR : (PMC Offset: 0x8) System Clock Status Register -------- +// -------- CKGR_MOR : (PMC Offset: 0x20) Main Oscillator Register -------- +// -------- CKGR_MCFR : (PMC Offset: 0x24) Main Clock Frequency Register -------- +// -------- CKGR_PLLR : (PMC Offset: 0x2c) PLL B Register -------- +// -------- PMC_MCKR : (PMC Offset: 0x30) Master Clock Register -------- +#define AT91C_PMC_CSS (0x3 << 0) // (PMC) Programmable Clock Selection +#define AT91C_PMC_CSS_SLOW_CLK (0x0) // (PMC) Slow Clock is selected +#define AT91C_PMC_CSS_MAIN_CLK (0x1) // (PMC) Main Clock is selected +#define AT91C_PMC_CSS_PLL_CLK (0x3) // (PMC) Clock from PLL is selected +#define AT91C_PMC_PRES (0x7 << 2) // (PMC) Programmable Clock Prescaler +#define AT91C_PMC_PRES_CLK (0x0 << 2) // (PMC) Selected clock +#define AT91C_PMC_PRES_CLK_2 (0x1 << 2) // (PMC) Selected clock divided by 2 +#define AT91C_PMC_PRES_CLK_4 (0x2 << 2) // (PMC) Selected clock divided by 4 +#define AT91C_PMC_PRES_CLK_8 (0x3 << 2) // (PMC) Selected clock divided by 8 +#define AT91C_PMC_PRES_CLK_16 (0x4 << 2) // (PMC) Selected clock divided by 16 +#define AT91C_PMC_PRES_CLK_32 (0x5 << 2) // (PMC) Selected clock divided by 32 +#define AT91C_PMC_PRES_CLK_64 (0x6 << 2) // (PMC) Selected clock divided by 64 +// -------- PMC_PCKR : (PMC Offset: 0x40) Programmable Clock Register -------- +// -------- PMC_IER : (PMC Offset: 0x60) PMC Interrupt Enable Register -------- +#define AT91C_PMC_MOSCS (0x1 << 0) // (PMC) MOSC Status/Enable/Disable/Mask +#define AT91C_PMC_LOCK (0x1 << 2) // (PMC) PLL Status/Enable/Disable/Mask +#define AT91C_PMC_MCKRDY (0x1 << 3) // (PMC) MCK_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK0RDY (0x1 << 8) // (PMC) PCK0_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK1RDY (0x1 << 9) // (PMC) PCK1_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK2RDY (0x1 << 10) // (PMC) PCK2_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK3RDY (0x1 << 11) // (PMC) PCK3_RDY Status/Enable/Disable/Mask +// -------- PMC_IDR : (PMC Offset: 0x64) PMC Interrupt Disable Register -------- +// -------- PMC_SR : (PMC Offset: 0x68) PMC Status Register -------- +// -------- PMC_IMR : (PMC Offset: 0x6c) PMC Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Reset Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_RSTC structure *** +#define RSTC_RCR ( 0) // Reset Control Register +#define RSTC_RSR ( 4) // Reset Status Register +#define RSTC_RMR ( 8) // Reset Mode Register +// -------- RSTC_RCR : (RSTC Offset: 0x0) Reset Control Register -------- +#define AT91C_RSTC_PROCRST (0x1 << 0) // (RSTC) Processor Reset +#define AT91C_RSTC_PERRST (0x1 << 2) // (RSTC) Peripheral Reset +#define AT91C_RSTC_EXTRST (0x1 << 3) // (RSTC) External Reset +#define AT91C_RSTC_KEY (0xFF << 24) // (RSTC) Password +// -------- RSTC_RSR : (RSTC Offset: 0x4) Reset Status Register -------- +#define AT91C_RSTC_URSTS (0x1 << 0) // (RSTC) User Reset Status +#define AT91C_RSTC_BODSTS (0x1 << 1) // (RSTC) Brownout Detection Status +#define AT91C_RSTC_RSTTYP (0x7 << 8) // (RSTC) Reset Type +#define AT91C_RSTC_RSTTYP_POWERUP (0x0 << 8) // (RSTC) Power-up Reset. VDDCORE rising. +#define AT91C_RSTC_RSTTYP_WAKEUP (0x1 << 8) // (RSTC) WakeUp Reset. VDDCORE rising. +#define AT91C_RSTC_RSTTYP_WATCHDOG (0x2 << 8) // (RSTC) Watchdog Reset. Watchdog overflow occured. +#define AT91C_RSTC_RSTTYP_SOFTWARE (0x3 << 8) // (RSTC) Software Reset. Processor reset required by the software. +#define AT91C_RSTC_RSTTYP_USER (0x4 << 8) // (RSTC) User Reset. NRST pin detected low. +#define AT91C_RSTC_RSTTYP_BROWNOUT (0x5 << 8) // (RSTC) Brownout Reset occured. +#define AT91C_RSTC_NRSTL (0x1 << 16) // (RSTC) NRST pin level +#define AT91C_RSTC_SRCMP (0x1 << 17) // (RSTC) Software Reset Command in Progress. +// -------- RSTC_RMR : (RSTC Offset: 0x8) Reset Mode Register -------- +#define AT91C_RSTC_URSTEN (0x1 << 0) // (RSTC) User Reset Enable +#define AT91C_RSTC_URSTIEN (0x1 << 4) // (RSTC) User Reset Interrupt Enable +#define AT91C_RSTC_ERSTL (0xF << 8) // (RSTC) User Reset Length +#define AT91C_RSTC_BODIEN (0x1 << 16) // (RSTC) Brownout Detection Interrupt Enable + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Real Time Timer Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_RTTC structure *** +#define RTTC_RTMR ( 0) // Real-time Mode Register +#define RTTC_RTAR ( 4) // Real-time Alarm Register +#define RTTC_RTVR ( 8) // Real-time Value Register +#define RTTC_RTSR (12) // Real-time Status Register +// -------- RTTC_RTMR : (RTTC Offset: 0x0) Real-time Mode Register -------- +#define AT91C_RTTC_RTPRES (0xFFFF << 0) // (RTTC) Real-time Timer Prescaler Value +#define AT91C_RTTC_ALMIEN (0x1 << 16) // (RTTC) Alarm Interrupt Enable +#define AT91C_RTTC_RTTINCIEN (0x1 << 17) // (RTTC) Real Time Timer Increment Interrupt Enable +#define AT91C_RTTC_RTTRST (0x1 << 18) // (RTTC) Real Time Timer Restart +// -------- RTTC_RTAR : (RTTC Offset: 0x4) Real-time Alarm Register -------- +#define AT91C_RTTC_ALMV (0x0 << 0) // (RTTC) Alarm Value +// -------- RTTC_RTVR : (RTTC Offset: 0x8) Current Real-time Value Register -------- +#define AT91C_RTTC_CRTV (0x0 << 0) // (RTTC) Current Real-time Value +// -------- RTTC_RTSR : (RTTC Offset: 0xc) Real-time Status Register -------- +#define AT91C_RTTC_ALMS (0x1 << 0) // (RTTC) Real-time Alarm Status +#define AT91C_RTTC_RTTINC (0x1 << 1) // (RTTC) Real-time Timer Increment + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Periodic Interval Timer Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_PITC structure *** +#define PITC_PIMR ( 0) // Period Interval Mode Register +#define PITC_PISR ( 4) // Period Interval Status Register +#define PITC_PIVR ( 8) // Period Interval Value Register +#define PITC_PIIR (12) // Period Interval Image Register +// -------- PITC_PIMR : (PITC Offset: 0x0) Periodic Interval Mode Register -------- +#define AT91C_PITC_PIV (0xFFFFF << 0) // (PITC) Periodic Interval Value +#define AT91C_PITC_PITEN (0x1 << 24) // (PITC) Periodic Interval Timer Enabled +#define AT91C_PITC_PITIEN (0x1 << 25) // (PITC) Periodic Interval Timer Interrupt Enable +// -------- PITC_PISR : (PITC Offset: 0x4) Periodic Interval Status Register -------- +#define AT91C_PITC_PITS (0x1 << 0) // (PITC) Periodic Interval Timer Status +// -------- PITC_PIVR : (PITC Offset: 0x8) Periodic Interval Value Register -------- +#define AT91C_PITC_CPIV (0xFFFFF << 0) // (PITC) Current Periodic Interval Value +#define AT91C_PITC_PICNT (0xFFF << 20) // (PITC) Periodic Interval Counter +// -------- PITC_PIIR : (PITC Offset: 0xc) Periodic Interval Image Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Watchdog Timer Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_WDTC structure *** +#define WDTC_WDCR ( 0) // Watchdog Control Register +#define WDTC_WDMR ( 4) // Watchdog Mode Register +#define WDTC_WDSR ( 8) // Watchdog Status Register +// -------- WDTC_WDCR : (WDTC Offset: 0x0) Periodic Interval Image Register -------- +#define AT91C_WDTC_WDRSTT (0x1 << 0) // (WDTC) Watchdog Restart +#define AT91C_WDTC_KEY (0xFF << 24) // (WDTC) Watchdog KEY Password +// -------- WDTC_WDMR : (WDTC Offset: 0x4) Watchdog Mode Register -------- +#define AT91C_WDTC_WDV (0xFFF << 0) // (WDTC) Watchdog Timer Restart +#define AT91C_WDTC_WDFIEN (0x1 << 12) // (WDTC) Watchdog Fault Interrupt Enable +#define AT91C_WDTC_WDRSTEN (0x1 << 13) // (WDTC) Watchdog Reset Enable +#define AT91C_WDTC_WDRPROC (0x1 << 14) // (WDTC) Watchdog Timer Restart +#define AT91C_WDTC_WDDIS (0x1 << 15) // (WDTC) Watchdog Disable +#define AT91C_WDTC_WDD (0xFFF << 16) // (WDTC) Watchdog Delta Value +#define AT91C_WDTC_WDDBGHLT (0x1 << 28) // (WDTC) Watchdog Debug Halt +#define AT91C_WDTC_WDIDLEHLT (0x1 << 29) // (WDTC) Watchdog Idle Halt +// -------- WDTC_WDSR : (WDTC Offset: 0x8) Watchdog Status Register -------- +#define AT91C_WDTC_WDUNF (0x1 << 0) // (WDTC) Watchdog Underflow +#define AT91C_WDTC_WDERR (0x1 << 1) // (WDTC) Watchdog Error + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Voltage Regulator Mode Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_VREG structure *** +#define VREG_MR ( 0) // Voltage Regulator Mode Register +// -------- VREG_MR : (VREG Offset: 0x0) Voltage Regulator Mode Register -------- +#define AT91C_VREG_PSTDBY (0x1 << 0) // (VREG) Voltage Regulator Power Standby Mode + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Memory Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_MC structure *** +#define MC_RCR ( 0) // MC Remap Control Register +#define MC_ASR ( 4) // MC Abort Status Register +#define MC_AASR ( 8) // MC Abort Address Status Register +#define MC_FMR (96) // MC Flash Mode Register +#define MC_FCR (100) // MC Flash Command Register +#define MC_FSR (104) // MC Flash Status Register +// -------- MC_RCR : (MC Offset: 0x0) MC Remap Control Register -------- +#define AT91C_MC_RCB (0x1 << 0) // (MC) Remap Command Bit +// -------- MC_ASR : (MC Offset: 0x4) MC Abort Status Register -------- +#define AT91C_MC_UNDADD (0x1 << 0) // (MC) Undefined Addess Abort Status +#define AT91C_MC_MISADD (0x1 << 1) // (MC) Misaligned Addess Abort Status +#define AT91C_MC_ABTSZ (0x3 << 8) // (MC) Abort Size Status +#define AT91C_MC_ABTSZ_BYTE (0x0 << 8) // (MC) Byte +#define AT91C_MC_ABTSZ_HWORD (0x1 << 8) // (MC) Half-word +#define AT91C_MC_ABTSZ_WORD (0x2 << 8) // (MC) Word +#define AT91C_MC_ABTTYP (0x3 << 10) // (MC) Abort Type Status +#define AT91C_MC_ABTTYP_DATAR (0x0 << 10) // (MC) Data Read +#define AT91C_MC_ABTTYP_DATAW (0x1 << 10) // (MC) Data Write +#define AT91C_MC_ABTTYP_FETCH (0x2 << 10) // (MC) Code Fetch +#define AT91C_MC_MST0 (0x1 << 16) // (MC) Master 0 Abort Source +#define AT91C_MC_MST1 (0x1 << 17) // (MC) Master 1 Abort Source +#define AT91C_MC_SVMST0 (0x1 << 24) // (MC) Saved Master 0 Abort Source +#define AT91C_MC_SVMST1 (0x1 << 25) // (MC) Saved Master 1 Abort Source +// -------- MC_FMR : (MC Offset: 0x60) MC Flash Mode Register -------- +#define AT91C_MC_FRDY (0x1 << 0) // (MC) Flash Ready +#define AT91C_MC_LOCKE (0x1 << 2) // (MC) Lock Error +#define AT91C_MC_PROGE (0x1 << 3) // (MC) Programming Error +#define AT91C_MC_NEBP (0x1 << 7) // (MC) No Erase Before Programming +#define AT91C_MC_FWS (0x3 << 8) // (MC) Flash Wait State +#define AT91C_MC_FWS_0FWS (0x0 << 8) // (MC) 1 cycle for Read, 2 for Write operations +#define AT91C_MC_FWS_1FWS (0x1 << 8) // (MC) 2 cycles for Read, 3 for Write operations +#define AT91C_MC_FWS_2FWS (0x2 << 8) // (MC) 3 cycles for Read, 4 for Write operations +#define AT91C_MC_FWS_3FWS (0x3 << 8) // (MC) 4 cycles for Read, 4 for Write operations +#define AT91C_MC_FMCN (0xFF << 16) // (MC) Flash Microsecond Cycle Number +// -------- MC_FCR : (MC Offset: 0x64) MC Flash Command Register -------- +#define AT91C_MC_FCMD (0xF << 0) // (MC) Flash Command +#define AT91C_MC_FCMD_START_PROG (0x1) // (MC) Starts the programming of th epage specified by PAGEN. +#define AT91C_MC_FCMD_LOCK (0x2) // (MC) Starts a lock sequence of the sector defined by the bits 4 to 7 of the field PAGEN. +#define AT91C_MC_FCMD_PROG_AND_LOCK (0x3) // (MC) The lock sequence automatically happens after the programming sequence is completed. +#define AT91C_MC_FCMD_UNLOCK (0x4) // (MC) Starts an unlock sequence of the sector defined by the bits 4 to 7 of the field PAGEN. +#define AT91C_MC_FCMD_ERASE_ALL (0x8) // (MC) Starts the erase of the entire flash.If at least a page is locked, the command is cancelled. +#define AT91C_MC_FCMD_SET_GP_NVM (0xB) // (MC) Set General Purpose NVM bits. +#define AT91C_MC_FCMD_CLR_GP_NVM (0xD) // (MC) Clear General Purpose NVM bits. +#define AT91C_MC_FCMD_SET_SECURITY (0xF) // (MC) Set Security Bit. +#define AT91C_MC_PAGEN (0x3FF << 8) // (MC) Page Number +#define AT91C_MC_KEY (0xFF << 24) // (MC) Writing Protect Key +// -------- MC_FSR : (MC Offset: 0x68) MC Flash Command Register -------- +#define AT91C_MC_SECURITY (0x1 << 4) // (MC) Security Bit Status +#define AT91C_MC_GPNVM0 (0x1 << 8) // (MC) Sector 0 Lock Status +#define AT91C_MC_GPNVM1 (0x1 << 9) // (MC) Sector 1 Lock Status +#define AT91C_MC_GPNVM2 (0x1 << 10) // (MC) Sector 2 Lock Status +#define AT91C_MC_GPNVM3 (0x1 << 11) // (MC) Sector 3 Lock Status +#define AT91C_MC_GPNVM4 (0x1 << 12) // (MC) Sector 4 Lock Status +#define AT91C_MC_GPNVM5 (0x1 << 13) // (MC) Sector 5 Lock Status +#define AT91C_MC_GPNVM6 (0x1 << 14) // (MC) Sector 6 Lock Status +#define AT91C_MC_GPNVM7 (0x1 << 15) // (MC) Sector 7 Lock Status +#define AT91C_MC_LOCKS0 (0x1 << 16) // (MC) Sector 0 Lock Status +#define AT91C_MC_LOCKS1 (0x1 << 17) // (MC) Sector 1 Lock Status +#define AT91C_MC_LOCKS2 (0x1 << 18) // (MC) Sector 2 Lock Status +#define AT91C_MC_LOCKS3 (0x1 << 19) // (MC) Sector 3 Lock Status +#define AT91C_MC_LOCKS4 (0x1 << 20) // (MC) Sector 4 Lock Status +#define AT91C_MC_LOCKS5 (0x1 << 21) // (MC) Sector 5 Lock Status +#define AT91C_MC_LOCKS6 (0x1 << 22) // (MC) Sector 6 Lock Status +#define AT91C_MC_LOCKS7 (0x1 << 23) // (MC) Sector 7 Lock Status +#define AT91C_MC_LOCKS8 (0x1 << 24) // (MC) Sector 8 Lock Status +#define AT91C_MC_LOCKS9 (0x1 << 25) // (MC) Sector 9 Lock Status +#define AT91C_MC_LOCKS10 (0x1 << 26) // (MC) Sector 10 Lock Status +#define AT91C_MC_LOCKS11 (0x1 << 27) // (MC) Sector 11 Lock Status +#define AT91C_MC_LOCKS12 (0x1 << 28) // (MC) Sector 12 Lock Status +#define AT91C_MC_LOCKS13 (0x1 << 29) // (MC) Sector 13 Lock Status +#define AT91C_MC_LOCKS14 (0x1 << 30) // (MC) Sector 14 Lock Status +#define AT91C_MC_LOCKS15 (0x1 << 31) // (MC) Sector 15 Lock Status + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Serial Parallel Interface +// ***************************************************************************** +// *** Register offset in AT91S_SPI structure *** +#define SPI_CR ( 0) // Control Register +#define SPI_MR ( 4) // Mode Register +#define SPI_RDR ( 8) // Receive Data Register +#define SPI_TDR (12) // Transmit Data Register +#define SPI_SR (16) // Status Register +#define SPI_IER (20) // Interrupt Enable Register +#define SPI_IDR (24) // Interrupt Disable Register +#define SPI_IMR (28) // Interrupt Mask Register +#define SPI_CSR (48) // Chip Select Register +#define SPI_RPR (256) // Receive Pointer Register +#define SPI_RCR (260) // Receive Counter Register +#define SPI_TPR (264) // Transmit Pointer Register +#define SPI_TCR (268) // Transmit Counter Register +#define SPI_RNPR (272) // Receive Next Pointer Register +#define SPI_RNCR (276) // Receive Next Counter Register +#define SPI_TNPR (280) // Transmit Next Pointer Register +#define SPI_TNCR (284) // Transmit Next Counter Register +#define SPI_PTCR (288) // PDC Transfer Control Register +#define SPI_PTSR (292) // PDC Transfer Status Register +// -------- SPI_CR : (SPI Offset: 0x0) SPI Control Register -------- +#define AT91C_SPI_SPIEN (0x1 << 0) // (SPI) SPI Enable +#define AT91C_SPI_SPIDIS (0x1 << 1) // (SPI) SPI Disable +#define AT91C_SPI_SWRST (0x1 << 7) // (SPI) SPI Software reset +#define AT91C_SPI_LASTXFER (0x1 << 24) // (SPI) SPI Last Transfer +// -------- SPI_MR : (SPI Offset: 0x4) SPI Mode Register -------- +#define AT91C_SPI_MSTR (0x1 << 0) // (SPI) Master/Slave Mode +#define AT91C_SPI_PS (0x1 << 1) // (SPI) Peripheral Select +#define AT91C_SPI_PS_FIXED (0x0 << 1) // (SPI) Fixed Peripheral Select +#define AT91C_SPI_PS_VARIABLE (0x1 << 1) // (SPI) Variable Peripheral Select +#define AT91C_SPI_PCSDEC (0x1 << 2) // (SPI) Chip Select Decode +#define AT91C_SPI_FDIV (0x1 << 3) // (SPI) Clock Selection +#define AT91C_SPI_MODFDIS (0x1 << 4) // (SPI) Mode Fault Detection +#define AT91C_SPI_LLB (0x1 << 7) // (SPI) Clock Selection +#define AT91C_SPI_PCS (0xF << 16) // (SPI) Peripheral Chip Select +#define AT91C_SPI_DLYBCS (0xFF << 24) // (SPI) Delay Between Chip Selects +// -------- SPI_RDR : (SPI Offset: 0x8) Receive Data Register -------- +#define AT91C_SPI_RD (0xFFFF << 0) // (SPI) Receive Data +#define AT91C_SPI_RPCS (0xF << 16) // (SPI) Peripheral Chip Select Status +// -------- SPI_TDR : (SPI Offset: 0xc) Transmit Data Register -------- +#define AT91C_SPI_TD (0xFFFF << 0) // (SPI) Transmit Data +#define AT91C_SPI_TPCS (0xF << 16) // (SPI) Peripheral Chip Select Status +// -------- SPI_SR : (SPI Offset: 0x10) Status Register -------- +#define AT91C_SPI_RDRF (0x1 << 0) // (SPI) Receive Data Register Full +#define AT91C_SPI_TDRE (0x1 << 1) // (SPI) Transmit Data Register Empty +#define AT91C_SPI_MODF (0x1 << 2) // (SPI) Mode Fault Error +#define AT91C_SPI_OVRES (0x1 << 3) // (SPI) Overrun Error Status +#define AT91C_SPI_ENDRX (0x1 << 4) // (SPI) End of Receiver Transfer +#define AT91C_SPI_ENDTX (0x1 << 5) // (SPI) End of Receiver Transfer +#define AT91C_SPI_RXBUFF (0x1 << 6) // (SPI) RXBUFF Interrupt +#define AT91C_SPI_TXBUFE (0x1 << 7) // (SPI) TXBUFE Interrupt +#define AT91C_SPI_NSSR (0x1 << 8) // (SPI) NSSR Interrupt +#define AT91C_SPI_TXEMPTY (0x1 << 9) // (SPI) TXEMPTY Interrupt +#define AT91C_SPI_SPIENS (0x1 << 16) // (SPI) Enable Status +// -------- SPI_IER : (SPI Offset: 0x14) Interrupt Enable Register -------- +// -------- SPI_IDR : (SPI Offset: 0x18) Interrupt Disable Register -------- +// -------- SPI_IMR : (SPI Offset: 0x1c) Interrupt Mask Register -------- +// -------- SPI_CSR : (SPI Offset: 0x30) Chip Select Register -------- +#define AT91C_SPI_CPOL (0x1 << 0) // (SPI) Clock Polarity +#define AT91C_SPI_NCPHA (0x1 << 1) // (SPI) Clock Phase +#define AT91C_SPI_CSAAT (0x1 << 3) // (SPI) Chip Select Active After Transfer +#define AT91C_SPI_BITS (0xF << 4) // (SPI) Bits Per Transfer +#define AT91C_SPI_BITS_8 (0x0 << 4) // (SPI) 8 Bits Per transfer +#define AT91C_SPI_BITS_9 (0x1 << 4) // (SPI) 9 Bits Per transfer +#define AT91C_SPI_BITS_10 (0x2 << 4) // (SPI) 10 Bits Per transfer +#define AT91C_SPI_BITS_11 (0x3 << 4) // (SPI) 11 Bits Per transfer +#define AT91C_SPI_BITS_12 (0x4 << 4) // (SPI) 12 Bits Per transfer +#define AT91C_SPI_BITS_13 (0x5 << 4) // (SPI) 13 Bits Per transfer +#define AT91C_SPI_BITS_14 (0x6 << 4) // (SPI) 14 Bits Per transfer +#define AT91C_SPI_BITS_15 (0x7 << 4) // (SPI) 15 Bits Per transfer +#define AT91C_SPI_BITS_16 (0x8 << 4) // (SPI) 16 Bits Per transfer +#define AT91C_SPI_SCBR (0xFF << 8) // (SPI) Serial Clock Baud Rate +#define AT91C_SPI_DLYBS (0xFF << 16) // (SPI) Delay Before SPCK +#define AT91C_SPI_DLYBCT (0xFF << 24) // (SPI) Delay Between Consecutive Transfers + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Usart +// ***************************************************************************** +// *** Register offset in AT91S_USART structure *** +#define US_CR ( 0) // Control Register +#define US_MR ( 4) // Mode Register +#define US_IER ( 8) // Interrupt Enable Register +#define US_IDR (12) // Interrupt Disable Register +#define US_IMR (16) // Interrupt Mask Register +#define US_CSR (20) // Channel Status Register +#define US_RHR (24) // Receiver Holding Register +#define US_THR (28) // Transmitter Holding Register +#define US_BRGR (32) // Baud Rate Generator Register +#define US_RTOR (36) // Receiver Time-out Register +#define US_TTGR (40) // Transmitter Time-guard Register +#define US_FIDI (64) // FI_DI_Ratio Register +#define US_NER (68) // Nb Errors Register +#define US_IF (76) // IRDA_FILTER Register +#define US_RPR (256) // Receive Pointer Register +#define US_RCR (260) // Receive Counter Register +#define US_TPR (264) // Transmit Pointer Register +#define US_TCR (268) // Transmit Counter Register +#define US_RNPR (272) // Receive Next Pointer Register +#define US_RNCR (276) // Receive Next Counter Register +#define US_TNPR (280) // Transmit Next Pointer Register +#define US_TNCR (284) // Transmit Next Counter Register +#define US_PTCR (288) // PDC Transfer Control Register +#define US_PTSR (292) // PDC Transfer Status Register +// -------- US_CR : (USART Offset: 0x0) Debug Unit Control Register -------- +#define AT91C_US_STTBRK (0x1 << 9) // (USART) Start Break +#define AT91C_US_STPBRK (0x1 << 10) // (USART) Stop Break +#define AT91C_US_STTTO (0x1 << 11) // (USART) Start Time-out +#define AT91C_US_SENDA (0x1 << 12) // (USART) Send Address +#define AT91C_US_RSTIT (0x1 << 13) // (USART) Reset Iterations +#define AT91C_US_RSTNACK (0x1 << 14) // (USART) Reset Non Acknowledge +#define AT91C_US_RETTO (0x1 << 15) // (USART) Rearm Time-out +#define AT91C_US_DTREN (0x1 << 16) // (USART) Data Terminal ready Enable +#define AT91C_US_DTRDIS (0x1 << 17) // (USART) Data Terminal ready Disable +#define AT91C_US_RTSEN (0x1 << 18) // (USART) Request to Send enable +#define AT91C_US_RTSDIS (0x1 << 19) // (USART) Request to Send Disable +// -------- US_MR : (USART Offset: 0x4) Debug Unit Mode Register -------- +#define AT91C_US_USMODE (0xF << 0) // (USART) Usart mode +#define AT91C_US_USMODE_NORMAL (0x0) // (USART) Normal +#define AT91C_US_USMODE_RS485 (0x1) // (USART) RS485 +#define AT91C_US_USMODE_HWHSH (0x2) // (USART) Hardware Handshaking +#define AT91C_US_USMODE_MODEM (0x3) // (USART) Modem +#define AT91C_US_USMODE_ISO7816_0 (0x4) // (USART) ISO7816 protocol: T = 0 +#define AT91C_US_USMODE_ISO7816_1 (0x6) // (USART) ISO7816 protocol: T = 1 +#define AT91C_US_USMODE_IRDA (0x8) // (USART) IrDA +#define AT91C_US_USMODE_SWHSH (0xC) // (USART) Software Handshaking +#define AT91C_US_CLKS (0x3 << 4) // (USART) Clock Selection (Baud Rate generator Input Clock +#define AT91C_US_CLKS_CLOCK (0x0 << 4) // (USART) Clock +#define AT91C_US_CLKS_FDIV1 (0x1 << 4) // (USART) fdiv1 +#define AT91C_US_CLKS_SLOW (0x2 << 4) // (USART) slow_clock (ARM) +#define AT91C_US_CLKS_EXT (0x3 << 4) // (USART) External (SCK) +#define AT91C_US_CHRL (0x3 << 6) // (USART) Clock Selection (Baud Rate generator Input Clock +#define AT91C_US_CHRL_5_BITS (0x0 << 6) // (USART) Character Length: 5 bits +#define AT91C_US_CHRL_6_BITS (0x1 << 6) // (USART) Character Length: 6 bits +#define AT91C_US_CHRL_7_BITS (0x2 << 6) // (USART) Character Length: 7 bits +#define AT91C_US_CHRL_8_BITS (0x3 << 6) // (USART) Character Length: 8 bits +#define AT91C_US_SYNC (0x1 << 8) // (USART) Synchronous Mode Select +#define AT91C_US_NBSTOP (0x3 << 12) // (USART) Number of Stop bits +#define AT91C_US_NBSTOP_1_BIT (0x0 << 12) // (USART) 1 stop bit +#define AT91C_US_NBSTOP_15_BIT (0x1 << 12) // (USART) Asynchronous (SYNC=0) 2 stop bits Synchronous (SYNC=1) 2 stop bits +#define AT91C_US_NBSTOP_2_BIT (0x2 << 12) // (USART) 2 stop bits +#define AT91C_US_MSBF (0x1 << 16) // (USART) Bit Order +#define AT91C_US_MODE9 (0x1 << 17) // (USART) 9-bit Character length +#define AT91C_US_CKLO (0x1 << 18) // (USART) Clock Output Select +#define AT91C_US_OVER (0x1 << 19) // (USART) Over Sampling Mode +#define AT91C_US_INACK (0x1 << 20) // (USART) Inhibit Non Acknowledge +#define AT91C_US_DSNACK (0x1 << 21) // (USART) Disable Successive NACK +#define AT91C_US_MAX_ITER (0x1 << 24) // (USART) Number of Repetitions +#define AT91C_US_FILTER (0x1 << 28) // (USART) Receive Line Filter +// -------- US_IER : (USART Offset: 0x8) Debug Unit Interrupt Enable Register -------- +#define AT91C_US_RXBRK (0x1 << 2) // (USART) Break Received/End of Break +#define AT91C_US_TIMEOUT (0x1 << 8) // (USART) Receiver Time-out +#define AT91C_US_ITERATION (0x1 << 10) // (USART) Max number of Repetitions Reached +#define AT91C_US_NACK (0x1 << 13) // (USART) Non Acknowledge +#define AT91C_US_RIIC (0x1 << 16) // (USART) Ring INdicator Input Change Flag +#define AT91C_US_DSRIC (0x1 << 17) // (USART) Data Set Ready Input Change Flag +#define AT91C_US_DCDIC (0x1 << 18) // (USART) Data Carrier Flag +#define AT91C_US_CTSIC (0x1 << 19) // (USART) Clear To Send Input Change Flag +// -------- US_IDR : (USART Offset: 0xc) Debug Unit Interrupt Disable Register -------- +// -------- US_IMR : (USART Offset: 0x10) Debug Unit Interrupt Mask Register -------- +// -------- US_CSR : (USART Offset: 0x14) Debug Unit Channel Status Register -------- +#define AT91C_US_RI (0x1 << 20) // (USART) Image of RI Input +#define AT91C_US_DSR (0x1 << 21) // (USART) Image of DSR Input +#define AT91C_US_DCD (0x1 << 22) // (USART) Image of DCD Input +#define AT91C_US_CTS (0x1 << 23) // (USART) Image of CTS Input + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Synchronous Serial Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_SSC structure *** +#define SSC_CR ( 0) // Control Register +#define SSC_CMR ( 4) // Clock Mode Register +#define SSC_RCMR (16) // Receive Clock ModeRegister +#define SSC_RFMR (20) // Receive Frame Mode Register +#define SSC_TCMR (24) // Transmit Clock Mode Register +#define SSC_TFMR (28) // Transmit Frame Mode Register +#define SSC_RHR (32) // Receive Holding Register +#define SSC_THR (36) // Transmit Holding Register +#define SSC_RSHR (48) // Receive Sync Holding Register +#define SSC_TSHR (52) // Transmit Sync Holding Register +#define SSC_SR (64) // Status Register +#define SSC_IER (68) // Interrupt Enable Register +#define SSC_IDR (72) // Interrupt Disable Register +#define SSC_IMR (76) // Interrupt Mask Register +#define SSC_RPR (256) // Receive Pointer Register +#define SSC_RCR (260) // Receive Counter Register +#define SSC_TPR (264) // Transmit Pointer Register +#define SSC_TCR (268) // Transmit Counter Register +#define SSC_RNPR (272) // Receive Next Pointer Register +#define SSC_RNCR (276) // Receive Next Counter Register +#define SSC_TNPR (280) // Transmit Next Pointer Register +#define SSC_TNCR (284) // Transmit Next Counter Register +#define SSC_PTCR (288) // PDC Transfer Control Register +#define SSC_PTSR (292) // PDC Transfer Status Register +// -------- SSC_CR : (SSC Offset: 0x0) SSC Control Register -------- +#define AT91C_SSC_RXEN (0x1 << 0) // (SSC) Receive Enable +#define AT91C_SSC_RXDIS (0x1 << 1) // (SSC) Receive Disable +#define AT91C_SSC_TXEN (0x1 << 8) // (SSC) Transmit Enable +#define AT91C_SSC_TXDIS (0x1 << 9) // (SSC) Transmit Disable +#define AT91C_SSC_SWRST (0x1 << 15) // (SSC) Software Reset +// -------- SSC_RCMR : (SSC Offset: 0x10) SSC Receive Clock Mode Register -------- +#define AT91C_SSC_CKS (0x3 << 0) // (SSC) Receive/Transmit Clock Selection +#define AT91C_SSC_CKS_DIV (0x0) // (SSC) Divided Clock +#define AT91C_SSC_CKS_TK (0x1) // (SSC) TK Clock signal +#define AT91C_SSC_CKS_RK (0x2) // (SSC) RK pin +#define AT91C_SSC_CKO (0x7 << 2) // (SSC) Receive/Transmit Clock Output Mode Selection +#define AT91C_SSC_CKO_NONE (0x0 << 2) // (SSC) Receive/Transmit Clock Output Mode: None RK pin: Input-only +#define AT91C_SSC_CKO_CONTINOUS (0x1 << 2) // (SSC) Continuous Receive/Transmit Clock RK pin: Output +#define AT91C_SSC_CKO_DATA_TX (0x2 << 2) // (SSC) Receive/Transmit Clock only during data transfers RK pin: Output +#define AT91C_SSC_CKI (0x1 << 5) // (SSC) Receive/Transmit Clock Inversion +#define AT91C_SSC_CKG (0x3 << 6) // (SSC) Receive/Transmit Clock Gating Selection +#define AT91C_SSC_CKG_NONE (0x0 << 6) // (SSC) Receive/Transmit Clock Gating: None, continuous clock +#define AT91C_SSC_CKG_LOW (0x1 << 6) // (SSC) Receive/Transmit Clock enabled only if RF Low +#define AT91C_SSC_CKG_HIGH (0x2 << 6) // (SSC) Receive/Transmit Clock enabled only if RF High +#define AT91C_SSC_START (0xF << 8) // (SSC) Receive/Transmit Start Selection +#define AT91C_SSC_START_CONTINOUS (0x0 << 8) // (SSC) Continuous, as soon as the receiver is enabled, and immediately after the end of transfer of the previous data. +#define AT91C_SSC_START_TX (0x1 << 8) // (SSC) Transmit/Receive start +#define AT91C_SSC_START_LOW_RF (0x2 << 8) // (SSC) Detection of a low level on RF input +#define AT91C_SSC_START_HIGH_RF (0x3 << 8) // (SSC) Detection of a high level on RF input +#define AT91C_SSC_START_FALL_RF (0x4 << 8) // (SSC) Detection of a falling edge on RF input +#define AT91C_SSC_START_RISE_RF (0x5 << 8) // (SSC) Detection of a rising edge on RF input +#define AT91C_SSC_START_LEVEL_RF (0x6 << 8) // (SSC) Detection of any level change on RF input +#define AT91C_SSC_START_EDGE_RF (0x7 << 8) // (SSC) Detection of any edge on RF input +#define AT91C_SSC_START_0 (0x8 << 8) // (SSC) Compare 0 +#define AT91C_SSC_STOP (0x1 << 12) // (SSC) Receive Stop Selection +#define AT91C_SSC_STTDLY (0xFF << 16) // (SSC) Receive/Transmit Start Delay +#define AT91C_SSC_PERIOD (0xFF << 24) // (SSC) Receive/Transmit Period Divider Selection +// -------- SSC_RFMR : (SSC Offset: 0x14) SSC Receive Frame Mode Register -------- +#define AT91C_SSC_DATLEN (0x1F << 0) // (SSC) Data Length +#define AT91C_SSC_LOOP (0x1 << 5) // (SSC) Loop Mode +#define AT91C_SSC_MSBF (0x1 << 7) // (SSC) Most Significant Bit First +#define AT91C_SSC_DATNB (0xF << 8) // (SSC) Data Number per Frame +#define AT91C_SSC_FSLEN (0xF << 16) // (SSC) Receive/Transmit Frame Sync length +#define AT91C_SSC_FSOS (0x7 << 20) // (SSC) Receive/Transmit Frame Sync Output Selection +#define AT91C_SSC_FSOS_NONE (0x0 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: None RK pin Input-only +#define AT91C_SSC_FSOS_NEGATIVE (0x1 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Negative Pulse +#define AT91C_SSC_FSOS_POSITIVE (0x2 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Positive Pulse +#define AT91C_SSC_FSOS_LOW (0x3 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Driver Low during data transfer +#define AT91C_SSC_FSOS_HIGH (0x4 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Driver High during data transfer +#define AT91C_SSC_FSOS_TOGGLE (0x5 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Toggling at each start of data transfer +#define AT91C_SSC_FSEDGE (0x1 << 24) // (SSC) Frame Sync Edge Detection +// -------- SSC_TCMR : (SSC Offset: 0x18) SSC Transmit Clock Mode Register -------- +// -------- SSC_TFMR : (SSC Offset: 0x1c) SSC Transmit Frame Mode Register -------- +#define AT91C_SSC_DATDEF (0x1 << 5) // (SSC) Data Default Value +#define AT91C_SSC_FSDEN (0x1 << 23) // (SSC) Frame Sync Data Enable +// -------- SSC_SR : (SSC Offset: 0x40) SSC Status Register -------- +#define AT91C_SSC_TXRDY (0x1 << 0) // (SSC) Transmit Ready +#define AT91C_SSC_TXEMPTY (0x1 << 1) // (SSC) Transmit Empty +#define AT91C_SSC_ENDTX (0x1 << 2) // (SSC) End Of Transmission +#define AT91C_SSC_TXBUFE (0x1 << 3) // (SSC) Transmit Buffer Empty +#define AT91C_SSC_RXRDY (0x1 << 4) // (SSC) Receive Ready +#define AT91C_SSC_OVRUN (0x1 << 5) // (SSC) Receive Overrun +#define AT91C_SSC_ENDRX (0x1 << 6) // (SSC) End of Reception +#define AT91C_SSC_RXBUFF (0x1 << 7) // (SSC) Receive Buffer Full +#define AT91C_SSC_CP0 (0x1 << 8) // (SSC) Compare 0 +#define AT91C_SSC_CP1 (0x1 << 9) // (SSC) Compare 1 +#define AT91C_SSC_TXSYN (0x1 << 10) // (SSC) Transmit Sync +#define AT91C_SSC_RXSYN (0x1 << 11) // (SSC) Receive Sync +#define AT91C_SSC_TXENA (0x1 << 16) // (SSC) Transmit Enable +#define AT91C_SSC_RXENA (0x1 << 17) // (SSC) Receive Enable +// -------- SSC_IER : (SSC Offset: 0x44) SSC Interrupt Enable Register -------- +// -------- SSC_IDR : (SSC Offset: 0x48) SSC Interrupt Disable Register -------- +// -------- SSC_IMR : (SSC Offset: 0x4c) SSC Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Two-wire Interface +// ***************************************************************************** +// *** Register offset in AT91S_TWI structure *** +#define TWI_CR ( 0) // Control Register +#define TWI_MMR ( 4) // Master Mode Register +#define TWI_IADR (12) // Internal Address Register +#define TWI_CWGR (16) // Clock Waveform Generator Register +#define TWI_SR (32) // Status Register +#define TWI_IER (36) // Interrupt Enable Register +#define TWI_IDR (40) // Interrupt Disable Register +#define TWI_IMR (44) // Interrupt Mask Register +#define TWI_RHR (48) // Receive Holding Register +#define TWI_THR (52) // Transmit Holding Register +// -------- TWI_CR : (TWI Offset: 0x0) TWI Control Register -------- +#define AT91C_TWI_START (0x1 << 0) // (TWI) Send a START Condition +#define AT91C_TWI_STOP (0x1 << 1) // (TWI) Send a STOP Condition +#define AT91C_TWI_MSEN (0x1 << 2) // (TWI) TWI Master Transfer Enabled +#define AT91C_TWI_MSDIS (0x1 << 3) // (TWI) TWI Master Transfer Disabled +#define AT91C_TWI_SWRST (0x1 << 7) // (TWI) Software Reset +// -------- TWI_MMR : (TWI Offset: 0x4) TWI Master Mode Register -------- +#define AT91C_TWI_IADRSZ (0x3 << 8) // (TWI) Internal Device Address Size +#define AT91C_TWI_IADRSZ_NO (0x0 << 8) // (TWI) No internal device address +#define AT91C_TWI_IADRSZ_1_BYTE (0x1 << 8) // (TWI) One-byte internal device address +#define AT91C_TWI_IADRSZ_2_BYTE (0x2 << 8) // (TWI) Two-byte internal device address +#define AT91C_TWI_IADRSZ_3_BYTE (0x3 << 8) // (TWI) Three-byte internal device address +#define AT91C_TWI_MREAD (0x1 << 12) // (TWI) Master Read Direction +#define AT91C_TWI_DADR (0x7F << 16) // (TWI) Device Address +// -------- TWI_CWGR : (TWI Offset: 0x10) TWI Clock Waveform Generator Register -------- +#define AT91C_TWI_CLDIV (0xFF << 0) // (TWI) Clock Low Divider +#define AT91C_TWI_CHDIV (0xFF << 8) // (TWI) Clock High Divider +#define AT91C_TWI_CKDIV (0x7 << 16) // (TWI) Clock Divider +// -------- TWI_SR : (TWI Offset: 0x20) TWI Status Register -------- +#define AT91C_TWI_TXCOMP (0x1 << 0) // (TWI) Transmission Completed +#define AT91C_TWI_RXRDY (0x1 << 1) // (TWI) Receive holding register ReaDY +#define AT91C_TWI_TXRDY (0x1 << 2) // (TWI) Transmit holding register ReaDY +#define AT91C_TWI_OVRE (0x1 << 6) // (TWI) Overrun Error +#define AT91C_TWI_UNRE (0x1 << 7) // (TWI) Underrun Error +#define AT91C_TWI_NACK (0x1 << 8) // (TWI) Not Acknowledged +// -------- TWI_IER : (TWI Offset: 0x24) TWI Interrupt Enable Register -------- +// -------- TWI_IDR : (TWI Offset: 0x28) TWI Interrupt Disable Register -------- +// -------- TWI_IMR : (TWI Offset: 0x2c) TWI Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR PWMC Channel Interface +// ***************************************************************************** +// *** Register offset in AT91S_PWMC_CH structure *** +#define PWMC_CMR ( 0) // Channel Mode Register +#define PWMC_CDTYR ( 4) // Channel Duty Cycle Register +#define PWMC_CPRDR ( 8) // Channel Period Register +#define PWMC_CCNTR (12) // Channel Counter Register +#define PWMC_CUPDR (16) // Channel Update Register +#define PWMC_Reserved (20) // Reserved +// -------- PWMC_CMR : (PWMC_CH Offset: 0x0) PWMC Channel Mode Register -------- +#define AT91C_PWMC_CPRE (0xF << 0) // (PWMC_CH) Channel Pre-scaler : PWMC_CLKx +#define AT91C_PWMC_CPRE_MCK (0x0) // (PWMC_CH) +#define AT91C_PWMC_CPRE_MCKA (0xB) // (PWMC_CH) +#define AT91C_PWMC_CPRE_MCKB (0xC) // (PWMC_CH) +#define AT91C_PWMC_CALG (0x1 << 8) // (PWMC_CH) Channel Alignment +#define AT91C_PWMC_CPOL (0x1 << 9) // (PWMC_CH) Channel Polarity +#define AT91C_PWMC_CPD (0x1 << 10) // (PWMC_CH) Channel Update Period +// -------- PWMC_CDTYR : (PWMC_CH Offset: 0x4) PWMC Channel Duty Cycle Register -------- +#define AT91C_PWMC_CDTY (0x0 << 0) // (PWMC_CH) Channel Duty Cycle +// -------- PWMC_CPRDR : (PWMC_CH Offset: 0x8) PWMC Channel Period Register -------- +#define AT91C_PWMC_CPRD (0x0 << 0) // (PWMC_CH) Channel Period +// -------- PWMC_CCNTR : (PWMC_CH Offset: 0xc) PWMC Channel Counter Register -------- +#define AT91C_PWMC_CCNT (0x0 << 0) // (PWMC_CH) Channel Counter +// -------- PWMC_CUPDR : (PWMC_CH Offset: 0x10) PWMC Channel Update Register -------- +#define AT91C_PWMC_CUPD (0x0 << 0) // (PWMC_CH) Channel Update + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Pulse Width Modulation Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_PWMC structure *** +#define PWMC_MR ( 0) // PWMC Mode Register +#define PWMC_ENA ( 4) // PWMC Enable Register +#define PWMC_DIS ( 8) // PWMC Disable Register +#define PWMC_SR (12) // PWMC Status Register +#define PWMC_IER (16) // PWMC Interrupt Enable Register +#define PWMC_IDR (20) // PWMC Interrupt Disable Register +#define PWMC_IMR (24) // PWMC Interrupt Mask Register +#define PWMC_ISR (28) // PWMC Interrupt Status Register +#define PWMC_VR (252) // PWMC Version Register +#define PWMC_CH (512) // PWMC Channel +// -------- PWMC_MR : (PWMC Offset: 0x0) PWMC Mode Register -------- +#define AT91C_PWMC_DIVA (0xFF << 0) // (PWMC) CLKA divide factor. +#define AT91C_PWMC_PREA (0xF << 8) // (PWMC) Divider Input Clock Prescaler A +#define AT91C_PWMC_PREA_MCK (0x0 << 8) // (PWMC) +#define AT91C_PWMC_DIVB (0xFF << 16) // (PWMC) CLKB divide factor. +#define AT91C_PWMC_PREB (0xF << 24) // (PWMC) Divider Input Clock Prescaler B +#define AT91C_PWMC_PREB_MCK (0x0 << 24) // (PWMC) +// -------- PWMC_ENA : (PWMC Offset: 0x4) PWMC Enable Register -------- +#define AT91C_PWMC_CHID0 (0x1 << 0) // (PWMC) Channel ID 0 +#define AT91C_PWMC_CHID1 (0x1 << 1) // (PWMC) Channel ID 1 +#define AT91C_PWMC_CHID2 (0x1 << 2) // (PWMC) Channel ID 2 +#define AT91C_PWMC_CHID3 (0x1 << 3) // (PWMC) Channel ID 3 +// -------- PWMC_DIS : (PWMC Offset: 0x8) PWMC Disable Register -------- +// -------- PWMC_SR : (PWMC Offset: 0xc) PWMC Status Register -------- +// -------- PWMC_IER : (PWMC Offset: 0x10) PWMC Interrupt Enable Register -------- +// -------- PWMC_IDR : (PWMC Offset: 0x14) PWMC Interrupt Disable Register -------- +// -------- PWMC_IMR : (PWMC Offset: 0x18) PWMC Interrupt Mask Register -------- +// -------- PWMC_ISR : (PWMC Offset: 0x1c) PWMC Interrupt Status Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR USB Device Interface +// ***************************************************************************** +// *** Register offset in AT91S_UDP structure *** +#define UDP_NUM ( 0) // Frame Number Register +#define UDP_GLBSTATE ( 4) // Global State Register +#define UDP_FADDR ( 8) // Function Address Register +#define UDP_IER (16) // Interrupt Enable Register +#define UDP_IDR (20) // Interrupt Disable Register +#define UDP_IMR (24) // Interrupt Mask Register +#define UDP_ISR (28) // Interrupt Status Register +#define UDP_ICR (32) // Interrupt Clear Register +#define UDP_RSTEP (40) // Reset Endpoint Register +#define UDP_CSR (48) // Endpoint Control and Status Register +#define UDP_FDR (80) // Endpoint FIFO Data Register +#define UDP_TXVC (116) // Transceiver Control Register +// -------- UDP_FRM_NUM : (UDP Offset: 0x0) USB Frame Number Register -------- +#define AT91C_UDP_FRM_NUM (0x7FF << 0) // (UDP) Frame Number as Defined in the Packet Field Formats +#define AT91C_UDP_FRM_ERR (0x1 << 16) // (UDP) Frame Error +#define AT91C_UDP_FRM_OK (0x1 << 17) // (UDP) Frame OK +// -------- UDP_GLB_STATE : (UDP Offset: 0x4) USB Global State Register -------- +#define AT91C_UDP_FADDEN (0x1 << 0) // (UDP) Function Address Enable +#define AT91C_UDP_CONFG (0x1 << 1) // (UDP) Configured +#define AT91C_UDP_ESR (0x1 << 2) // (UDP) Enable Send Resume +#define AT91C_UDP_RSMINPR (0x1 << 3) // (UDP) A Resume Has Been Sent to the Host +#define AT91C_UDP_RMWUPE (0x1 << 4) // (UDP) Remote Wake Up Enable +// -------- UDP_FADDR : (UDP Offset: 0x8) USB Function Address Register -------- +#define AT91C_UDP_FADD (0xFF << 0) // (UDP) Function Address Value +#define AT91C_UDP_FEN (0x1 << 8) // (UDP) Function Enable +// -------- UDP_IER : (UDP Offset: 0x10) USB Interrupt Enable Register -------- +#define AT91C_UDP_EPINT0 (0x1 << 0) // (UDP) Endpoint 0 Interrupt +#define AT91C_UDP_EPINT1 (0x1 << 1) // (UDP) Endpoint 0 Interrupt +#define AT91C_UDP_EPINT2 (0x1 << 2) // (UDP) Endpoint 2 Interrupt +#define AT91C_UDP_EPINT3 (0x1 << 3) // (UDP) Endpoint 3 Interrupt +#define AT91C_UDP_EPINT4 (0x1 << 4) // (UDP) Endpoint 4 Interrupt +#define AT91C_UDP_EPINT5 (0x1 << 5) // (UDP) Endpoint 5 Interrupt +#define AT91C_UDP_RXSUSP (0x1 << 8) // (UDP) USB Suspend Interrupt +#define AT91C_UDP_RXRSM (0x1 << 9) // (UDP) USB Resume Interrupt +#define AT91C_UDP_EXTRSM (0x1 << 10) // (UDP) USB External Resume Interrupt +#define AT91C_UDP_SOFINT (0x1 << 11) // (UDP) USB Start Of frame Interrupt +#define AT91C_UDP_WAKEUP (0x1 << 13) // (UDP) USB Resume Interrupt +// -------- UDP_IDR : (UDP Offset: 0x14) USB Interrupt Disable Register -------- +// -------- UDP_IMR : (UDP Offset: 0x18) USB Interrupt Mask Register -------- +// -------- UDP_ISR : (UDP Offset: 0x1c) USB Interrupt Status Register -------- +#define AT91C_UDP_ENDBUSRES (0x1 << 12) // (UDP) USB End Of Bus Reset Interrupt +// -------- UDP_ICR : (UDP Offset: 0x20) USB Interrupt Clear Register -------- +// -------- UDP_RST_EP : (UDP Offset: 0x28) USB Reset Endpoint Register -------- +#define AT91C_UDP_EP0 (0x1 << 0) // (UDP) Reset Endpoint 0 +#define AT91C_UDP_EP1 (0x1 << 1) // (UDP) Reset Endpoint 1 +#define AT91C_UDP_EP2 (0x1 << 2) // (UDP) Reset Endpoint 2 +#define AT91C_UDP_EP3 (0x1 << 3) // (UDP) Reset Endpoint 3 +#define AT91C_UDP_EP4 (0x1 << 4) // (UDP) Reset Endpoint 4 +#define AT91C_UDP_EP5 (0x1 << 5) // (UDP) Reset Endpoint 5 +// -------- UDP_CSR : (UDP Offset: 0x30) USB Endpoint Control and Status Register -------- +#define AT91C_UDP_TXCOMP (0x1 << 0) // (UDP) Generates an IN packet with data previously written in the DPR +#define AT91C_UDP_RX_DATA_BK0 (0x1 << 1) // (UDP) Receive Data Bank 0 +#define AT91C_UDP_RXSETUP (0x1 << 2) // (UDP) Sends STALL to the Host (Control endpoints) +#define AT91C_UDP_ISOERROR (0x1 << 3) // (UDP) Isochronous error (Isochronous endpoints) +#define AT91C_UDP_TXPKTRDY (0x1 << 4) // (UDP) Transmit Packet Ready +#define AT91C_UDP_FORCESTALL (0x1 << 5) // (UDP) Force Stall (used by Control, Bulk and Isochronous endpoints). +#define AT91C_UDP_RX_DATA_BK1 (0x1 << 6) // (UDP) Receive Data Bank 1 (only used by endpoints with ping-pong attributes). +#define AT91C_UDP_DIR (0x1 << 7) // (UDP) Transfer Direction +#define AT91C_UDP_EPTYPE (0x7 << 8) // (UDP) Endpoint type +#define AT91C_UDP_EPTYPE_CTRL (0x0 << 8) // (UDP) Control +#define AT91C_UDP_EPTYPE_ISO_OUT (0x1 << 8) // (UDP) Isochronous OUT +#define AT91C_UDP_EPTYPE_BULK_OUT (0x2 << 8) // (UDP) Bulk OUT +#define AT91C_UDP_EPTYPE_INT_OUT (0x3 << 8) // (UDP) Interrupt OUT +#define AT91C_UDP_EPTYPE_ISO_IN (0x5 << 8) // (UDP) Isochronous IN +#define AT91C_UDP_EPTYPE_BULK_IN (0x6 << 8) // (UDP) Bulk IN +#define AT91C_UDP_EPTYPE_INT_IN (0x7 << 8) // (UDP) Interrupt IN +#define AT91C_UDP_DTGLE (0x1 << 11) // (UDP) Data Toggle +#define AT91C_UDP_EPEDS (0x1 << 15) // (UDP) Endpoint Enable Disable +#define AT91C_UDP_RXBYTECNT (0x7FF << 16) // (UDP) Number Of Bytes Available in the FIFO +// -------- UDP_TXVC : (UDP Offset: 0x74) Transceiver Control Register -------- +#define AT91C_UDP_TXVDIS (0x1 << 8) // (UDP) +#define AT91C_UDP_PUON (0x1 << 9) // (UDP) Pull-up ON + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Timer Counter Channel Interface +// ***************************************************************************** +// *** Register offset in AT91S_TC structure *** +#define TC_CCR ( 0) // Channel Control Register +#define TC_CMR ( 4) // Channel Mode Register (Capture Mode / Waveform Mode) +#define TC_CV (16) // Counter Value +#define TC_RA (20) // Register A +#define TC_RB (24) // Register B +#define TC_RC (28) // Register C +#define TC_SR (32) // Status Register +#define TC_IER (36) // Interrupt Enable Register +#define TC_IDR (40) // Interrupt Disable Register +#define TC_IMR (44) // Interrupt Mask Register +// -------- TC_CCR : (TC Offset: 0x0) TC Channel Control Register -------- +#define AT91C_TC_CLKEN (0x1 << 0) // (TC) Counter Clock Enable Command +#define AT91C_TC_CLKDIS (0x1 << 1) // (TC) Counter Clock Disable Command +#define AT91C_TC_SWTRG (0x1 << 2) // (TC) Software Trigger Command +// -------- TC_CMR : (TC Offset: 0x4) TC Channel Mode Register: Capture Mode / Waveform Mode -------- +#define AT91C_TC_CLKS (0x7 << 0) // (TC) Clock Selection +#define AT91C_TC_CLKS_TIMER_DIV1_CLOCK (0x0) // (TC) Clock selected: TIMER_DIV1_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV2_CLOCK (0x1) // (TC) Clock selected: TIMER_DIV2_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV3_CLOCK (0x2) // (TC) Clock selected: TIMER_DIV3_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV4_CLOCK (0x3) // (TC) Clock selected: TIMER_DIV4_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV5_CLOCK (0x4) // (TC) Clock selected: TIMER_DIV5_CLOCK +#define AT91C_TC_CLKS_XC0 (0x5) // (TC) Clock selected: XC0 +#define AT91C_TC_CLKS_XC1 (0x6) // (TC) Clock selected: XC1 +#define AT91C_TC_CLKS_XC2 (0x7) // (TC) Clock selected: XC2 +#define AT91C_TC_CLKI (0x1 << 3) // (TC) Clock Invert +#define AT91C_TC_BURST (0x3 << 4) // (TC) Burst Signal Selection +#define AT91C_TC_BURST_NONE (0x0 << 4) // (TC) The clock is not gated by an external signal +#define AT91C_TC_BURST_XC0 (0x1 << 4) // (TC) XC0 is ANDed with the selected clock +#define AT91C_TC_BURST_XC1 (0x2 << 4) // (TC) XC1 is ANDed with the selected clock +#define AT91C_TC_BURST_XC2 (0x3 << 4) // (TC) XC2 is ANDed with the selected clock +#define AT91C_TC_CPCSTOP (0x1 << 6) // (TC) Counter Clock Stopped with RC Compare +#define AT91C_TC_LDBSTOP (0x1 << 6) // (TC) Counter Clock Stopped with RB Loading +#define AT91C_TC_CPCDIS (0x1 << 7) // (TC) Counter Clock Disable with RC Compare +#define AT91C_TC_LDBDIS (0x1 << 7) // (TC) Counter Clock Disabled with RB Loading +#define AT91C_TC_ETRGEDG (0x3 << 8) // (TC) External Trigger Edge Selection +#define AT91C_TC_ETRGEDG_NONE (0x0 << 8) // (TC) Edge: None +#define AT91C_TC_ETRGEDG_RISING (0x1 << 8) // (TC) Edge: rising edge +#define AT91C_TC_ETRGEDG_FALLING (0x2 << 8) // (TC) Edge: falling edge +#define AT91C_TC_ETRGEDG_BOTH (0x3 << 8) // (TC) Edge: each edge +#define AT91C_TC_EEVTEDG (0x3 << 8) // (TC) External Event Edge Selection +#define AT91C_TC_EEVTEDG_NONE (0x0 << 8) // (TC) Edge: None +#define AT91C_TC_EEVTEDG_RISING (0x1 << 8) // (TC) Edge: rising edge +#define AT91C_TC_EEVTEDG_FALLING (0x2 << 8) // (TC) Edge: falling edge +#define AT91C_TC_EEVTEDG_BOTH (0x3 << 8) // (TC) Edge: each edge +#define AT91C_TC_EEVT (0x3 << 10) // (TC) External Event Selection +#define AT91C_TC_EEVT_TIOB (0x0 << 10) // (TC) Signal selected as external event: TIOB TIOB direction: input +#define AT91C_TC_EEVT_XC0 (0x1 << 10) // (TC) Signal selected as external event: XC0 TIOB direction: output +#define AT91C_TC_EEVT_XC1 (0x2 << 10) // (TC) Signal selected as external event: XC1 TIOB direction: output +#define AT91C_TC_EEVT_XC2 (0x3 << 10) // (TC) Signal selected as external event: XC2 TIOB direction: output +#define AT91C_TC_ABETRG (0x1 << 10) // (TC) TIOA or TIOB External Trigger Selection +#define AT91C_TC_ENETRG (0x1 << 12) // (TC) External Event Trigger enable +#define AT91C_TC_WAVESEL (0x3 << 13) // (TC) Waveform Selection +#define AT91C_TC_WAVESEL_UP (0x0 << 13) // (TC) UP mode without atomatic trigger on RC Compare +#define AT91C_TC_WAVESEL_UPDOWN (0x1 << 13) // (TC) UPDOWN mode without automatic trigger on RC Compare +#define AT91C_TC_WAVESEL_UP_AUTO (0x2 << 13) // (TC) UP mode with automatic trigger on RC Compare +#define AT91C_TC_WAVESEL_UPDOWN_AUTO (0x3 << 13) // (TC) UPDOWN mode with automatic trigger on RC Compare +#define AT91C_TC_CPCTRG (0x1 << 14) // (TC) RC Compare Trigger Enable +#define AT91C_TC_WAVE (0x1 << 15) // (TC) +#define AT91C_TC_ACPA (0x3 << 16) // (TC) RA Compare Effect on TIOA +#define AT91C_TC_ACPA_NONE (0x0 << 16) // (TC) Effect: none +#define AT91C_TC_ACPA_SET (0x1 << 16) // (TC) Effect: set +#define AT91C_TC_ACPA_CLEAR (0x2 << 16) // (TC) Effect: clear +#define AT91C_TC_ACPA_TOGGLE (0x3 << 16) // (TC) Effect: toggle +#define AT91C_TC_LDRA (0x3 << 16) // (TC) RA Loading Selection +#define AT91C_TC_LDRA_NONE (0x0 << 16) // (TC) Edge: None +#define AT91C_TC_LDRA_RISING (0x1 << 16) // (TC) Edge: rising edge of TIOA +#define AT91C_TC_LDRA_FALLING (0x2 << 16) // (TC) Edge: falling edge of TIOA +#define AT91C_TC_LDRA_BOTH (0x3 << 16) // (TC) Edge: each edge of TIOA +#define AT91C_TC_ACPC (0x3 << 18) // (TC) RC Compare Effect on TIOA +#define AT91C_TC_ACPC_NONE (0x0 << 18) // (TC) Effect: none +#define AT91C_TC_ACPC_SET (0x1 << 18) // (TC) Effect: set +#define AT91C_TC_ACPC_CLEAR (0x2 << 18) // (TC) Effect: clear +#define AT91C_TC_ACPC_TOGGLE (0x3 << 18) // (TC) Effect: toggle +#define AT91C_TC_LDRB (0x3 << 18) // (TC) RB Loading Selection +#define AT91C_TC_LDRB_NONE (0x0 << 18) // (TC) Edge: None +#define AT91C_TC_LDRB_RISING (0x1 << 18) // (TC) Edge: rising edge of TIOA +#define AT91C_TC_LDRB_FALLING (0x2 << 18) // (TC) Edge: falling edge of TIOA +#define AT91C_TC_LDRB_BOTH (0x3 << 18) // (TC) Edge: each edge of TIOA +#define AT91C_TC_AEEVT (0x3 << 20) // (TC) External Event Effect on TIOA +#define AT91C_TC_AEEVT_NONE (0x0 << 20) // (TC) Effect: none +#define AT91C_TC_AEEVT_SET (0x1 << 20) // (TC) Effect: set +#define AT91C_TC_AEEVT_CLEAR (0x2 << 20) // (TC) Effect: clear +#define AT91C_TC_AEEVT_TOGGLE (0x3 << 20) // (TC) Effect: toggle +#define AT91C_TC_ASWTRG (0x3 << 22) // (TC) Software Trigger Effect on TIOA +#define AT91C_TC_ASWTRG_NONE (0x0 << 22) // (TC) Effect: none +#define AT91C_TC_ASWTRG_SET (0x1 << 22) // (TC) Effect: set +#define AT91C_TC_ASWTRG_CLEAR (0x2 << 22) // (TC) Effect: clear +#define AT91C_TC_ASWTRG_TOGGLE (0x3 << 22) // (TC) Effect: toggle +#define AT91C_TC_BCPB (0x3 << 24) // (TC) RB Compare Effect on TIOB +#define AT91C_TC_BCPB_NONE (0x0 << 24) // (TC) Effect: none +#define AT91C_TC_BCPB_SET (0x1 << 24) // (TC) Effect: set +#define AT91C_TC_BCPB_CLEAR (0x2 << 24) // (TC) Effect: clear +#define AT91C_TC_BCPB_TOGGLE (0x3 << 24) // (TC) Effect: toggle +#define AT91C_TC_BCPC (0x3 << 26) // (TC) RC Compare Effect on TIOB +#define AT91C_TC_BCPC_NONE (0x0 << 26) // (TC) Effect: none +#define AT91C_TC_BCPC_SET (0x1 << 26) // (TC) Effect: set +#define AT91C_TC_BCPC_CLEAR (0x2 << 26) // (TC) Effect: clear +#define AT91C_TC_BCPC_TOGGLE (0x3 << 26) // (TC) Effect: toggle +#define AT91C_TC_BEEVT (0x3 << 28) // (TC) External Event Effect on TIOB +#define AT91C_TC_BEEVT_NONE (0x0 << 28) // (TC) Effect: none +#define AT91C_TC_BEEVT_SET (0x1 << 28) // (TC) Effect: set +#define AT91C_TC_BEEVT_CLEAR (0x2 << 28) // (TC) Effect: clear +#define AT91C_TC_BEEVT_TOGGLE (0x3 << 28) // (TC) Effect: toggle +#define AT91C_TC_BSWTRG (0x3 << 30) // (TC) Software Trigger Effect on TIOB +#define AT91C_TC_BSWTRG_NONE (0x0 << 30) // (TC) Effect: none +#define AT91C_TC_BSWTRG_SET (0x1 << 30) // (TC) Effect: set +#define AT91C_TC_BSWTRG_CLEAR (0x2 << 30) // (TC) Effect: clear +#define AT91C_TC_BSWTRG_TOGGLE (0x3 << 30) // (TC) Effect: toggle +// -------- TC_SR : (TC Offset: 0x20) TC Channel Status Register -------- +#define AT91C_TC_COVFS (0x1 << 0) // (TC) Counter Overflow +#define AT91C_TC_LOVRS (0x1 << 1) // (TC) Load Overrun +#define AT91C_TC_CPAS (0x1 << 2) // (TC) RA Compare +#define AT91C_TC_CPBS (0x1 << 3) // (TC) RB Compare +#define AT91C_TC_CPCS (0x1 << 4) // (TC) RC Compare +#define AT91C_TC_LDRAS (0x1 << 5) // (TC) RA Loading +#define AT91C_TC_LDRBS (0x1 << 6) // (TC) RB Loading +#define AT91C_TC_ETRGS (0x1 << 7) // (TC) External Trigger +#define AT91C_TC_CLKSTA (0x1 << 16) // (TC) Clock Enabling +#define AT91C_TC_MTIOA (0x1 << 17) // (TC) TIOA Mirror +#define AT91C_TC_MTIOB (0x1 << 18) // (TC) TIOA Mirror +// -------- TC_IER : (TC Offset: 0x24) TC Channel Interrupt Enable Register -------- +// -------- TC_IDR : (TC Offset: 0x28) TC Channel Interrupt Disable Register -------- +// -------- TC_IMR : (TC Offset: 0x2c) TC Channel Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Timer Counter Interface +// ***************************************************************************** +// *** Register offset in AT91S_TCB structure *** +#define TCB_TC0 ( 0) // TC Channel 0 +#define TCB_TC1 (64) // TC Channel 1 +#define TCB_TC2 (128) // TC Channel 2 +#define TCB_BCR (192) // TC Block Control Register +#define TCB_BMR (196) // TC Block Mode Register +// -------- TCB_BCR : (TCB Offset: 0xc0) TC Block Control Register -------- +#define AT91C_TCB_SYNC (0x1 << 0) // (TCB) Synchro Command +// -------- TCB_BMR : (TCB Offset: 0xc4) TC Block Mode Register -------- +#define AT91C_TCB_TC0XC0S (0x3 << 0) // (TCB) External Clock Signal 0 Selection +#define AT91C_TCB_TC0XC0S_TCLK0 (0x0) // (TCB) TCLK0 connected to XC0 +#define AT91C_TCB_TC0XC0S_NONE (0x1) // (TCB) None signal connected to XC0 +#define AT91C_TCB_TC0XC0S_TIOA1 (0x2) // (TCB) TIOA1 connected to XC0 +#define AT91C_TCB_TC0XC0S_TIOA2 (0x3) // (TCB) TIOA2 connected to XC0 +#define AT91C_TCB_TC1XC1S (0x3 << 2) // (TCB) External Clock Signal 1 Selection +#define AT91C_TCB_TC1XC1S_TCLK1 (0x0 << 2) // (TCB) TCLK1 connected to XC1 +#define AT91C_TCB_TC1XC1S_NONE (0x1 << 2) // (TCB) None signal connected to XC1 +#define AT91C_TCB_TC1XC1S_TIOA0 (0x2 << 2) // (TCB) TIOA0 connected to XC1 +#define AT91C_TCB_TC1XC1S_TIOA2 (0x3 << 2) // (TCB) TIOA2 connected to XC1 +#define AT91C_TCB_TC2XC2S (0x3 << 4) // (TCB) External Clock Signal 2 Selection +#define AT91C_TCB_TC2XC2S_TCLK2 (0x0 << 4) // (TCB) TCLK2 connected to XC2 +#define AT91C_TCB_TC2XC2S_NONE (0x1 << 4) // (TCB) None signal connected to XC2 +#define AT91C_TCB_TC2XC2S_TIOA0 (0x2 << 4) // (TCB) TIOA0 connected to XC2 +#define AT91C_TCB_TC2XC2S_TIOA1 (0x3 << 4) // (TCB) TIOA2 connected to XC2 + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Control Area Network MailBox Interface +// ***************************************************************************** +// *** Register offset in AT91S_CAN_MB structure *** +#define CAN_MB_MMR ( 0) // MailBox Mode Register +#define CAN_MB_MAM ( 4) // MailBox Acceptance Mask Register +#define CAN_MB_MID ( 8) // MailBox ID Register +#define CAN_MB_MFID (12) // MailBox Family ID Register +#define CAN_MB_MSR (16) // MailBox Status Register +#define CAN_MB_MDL (20) // MailBox Data Low Register +#define CAN_MB_MDH (24) // MailBox Data High Register +#define CAN_MB_MCR (28) // MailBox Control Register +// -------- CAN_MMR : (CAN_MB Offset: 0x0) CAN Message Mode Register -------- +#define AT91C_CAN_MTIMEMARK (0xFFFF << 0) // (CAN_MB) Mailbox Timemark +#define AT91C_CAN_PRIOR (0xF << 16) // (CAN_MB) Mailbox Priority +#define AT91C_CAN_MOT (0x7 << 24) // (CAN_MB) Mailbox Object Type +#define AT91C_CAN_MOT_DIS (0x0 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_RX (0x1 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_RXOVERWRITE (0x2 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_TX (0x3 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_CONSUMER (0x4 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_PRODUCER (0x5 << 24) // (CAN_MB) +// -------- CAN_MAM : (CAN_MB Offset: 0x4) CAN Message Acceptance Mask Register -------- +#define AT91C_CAN_MIDvB (0x3FFFF << 0) // (CAN_MB) Complementary bits for identifier in extended mode +#define AT91C_CAN_MIDvA (0x7FF << 18) // (CAN_MB) Identifier for standard frame mode +#define AT91C_CAN_MIDE (0x1 << 29) // (CAN_MB) Identifier Version +// -------- CAN_MID : (CAN_MB Offset: 0x8) CAN Message ID Register -------- +// -------- CAN_MFID : (CAN_MB Offset: 0xc) CAN Message Family ID Register -------- +// -------- CAN_MSR : (CAN_MB Offset: 0x10) CAN Message Status Register -------- +#define AT91C_CAN_MTIMESTAMP (0xFFFF << 0) // (CAN_MB) Timer Value +#define AT91C_CAN_MDLC (0xF << 16) // (CAN_MB) Mailbox Data Length Code +#define AT91C_CAN_MRTR (0x1 << 20) // (CAN_MB) Mailbox Remote Transmission Request +#define AT91C_CAN_MABT (0x1 << 22) // (CAN_MB) Mailbox Message Abort +#define AT91C_CAN_MRDY (0x1 << 23) // (CAN_MB) Mailbox Ready +#define AT91C_CAN_MMI (0x1 << 24) // (CAN_MB) Mailbox Message Ignored +// -------- CAN_MDL : (CAN_MB Offset: 0x14) CAN Message Data Low Register -------- +// -------- CAN_MDH : (CAN_MB Offset: 0x18) CAN Message Data High Register -------- +// -------- CAN_MCR : (CAN_MB Offset: 0x1c) CAN Message Control Register -------- +#define AT91C_CAN_MACR (0x1 << 22) // (CAN_MB) Abort Request for Mailbox +#define AT91C_CAN_MTCR (0x1 << 23) // (CAN_MB) Mailbox Transfer Command + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Control Area Network Interface +// ***************************************************************************** +// *** Register offset in AT91S_CAN structure *** +#define CAN_MR ( 0) // Mode Register +#define CAN_IER ( 4) // Interrupt Enable Register +#define CAN_IDR ( 8) // Interrupt Disable Register +#define CAN_IMR (12) // Interrupt Mask Register +#define CAN_SR (16) // Status Register +#define CAN_BR (20) // Baudrate Register +#define CAN_TIM (24) // Timer Register +#define CAN_TIMESTP (28) // Time Stamp Register +#define CAN_ECR (32) // Error Counter Register +#define CAN_TCR (36) // Transfer Command Register +#define CAN_ACR (40) // Abort Command Register +#define CAN_VR (252) // Version Register +#define CAN_MB0 (512) // CAN Mailbox 0 +#define CAN_MB1 (544) // CAN Mailbox 1 +#define CAN_MB2 (576) // CAN Mailbox 2 +#define CAN_MB3 (608) // CAN Mailbox 3 +#define CAN_MB4 (640) // CAN Mailbox 4 +#define CAN_MB5 (672) // CAN Mailbox 5 +#define CAN_MB6 (704) // CAN Mailbox 6 +#define CAN_MB7 (736) // CAN Mailbox 7 +#define CAN_MB8 (768) // CAN Mailbox 8 +#define CAN_MB9 (800) // CAN Mailbox 9 +#define CAN_MB10 (832) // CAN Mailbox 10 +#define CAN_MB11 (864) // CAN Mailbox 11 +#define CAN_MB12 (896) // CAN Mailbox 12 +#define CAN_MB13 (928) // CAN Mailbox 13 +#define CAN_MB14 (960) // CAN Mailbox 14 +#define CAN_MB15 (992) // CAN Mailbox 15 +// -------- CAN_MR : (CAN Offset: 0x0) CAN Mode Register -------- +#define AT91C_CAN_CANEN (0x1 << 0) // (CAN) CAN Controller Enable +#define AT91C_CAN_LPM (0x1 << 1) // (CAN) Disable/Enable Low Power Mode +#define AT91C_CAN_ABM (0x1 << 2) // (CAN) Disable/Enable Autobaud/Listen Mode +#define AT91C_CAN_OVL (0x1 << 3) // (CAN) Disable/Enable Overload Frame +#define AT91C_CAN_TEOF (0x1 << 4) // (CAN) Time Stamp messages at each end of Frame +#define AT91C_CAN_TTM (0x1 << 5) // (CAN) Disable/Enable Time Trigger Mode +#define AT91C_CAN_TIMFRZ (0x1 << 6) // (CAN) Enable Timer Freeze +#define AT91C_CAN_DRPT (0x1 << 7) // (CAN) Disable Repeat +// -------- CAN_IER : (CAN Offset: 0x4) CAN Interrupt Enable Register -------- +#define AT91C_CAN_MB0 (0x1 << 0) // (CAN) Mailbox 0 Flag +#define AT91C_CAN_MB1 (0x1 << 1) // (CAN) Mailbox 1 Flag +#define AT91C_CAN_MB2 (0x1 << 2) // (CAN) Mailbox 2 Flag +#define AT91C_CAN_MB3 (0x1 << 3) // (CAN) Mailbox 3 Flag +#define AT91C_CAN_MB4 (0x1 << 4) // (CAN) Mailbox 4 Flag +#define AT91C_CAN_MB5 (0x1 << 5) // (CAN) Mailbox 5 Flag +#define AT91C_CAN_MB6 (0x1 << 6) // (CAN) Mailbox 6 Flag +#define AT91C_CAN_MB7 (0x1 << 7) // (CAN) Mailbox 7 Flag +#define AT91C_CAN_MB8 (0x1 << 8) // (CAN) Mailbox 8 Flag +#define AT91C_CAN_MB9 (0x1 << 9) // (CAN) Mailbox 9 Flag +#define AT91C_CAN_MB10 (0x1 << 10) // (CAN) Mailbox 10 Flag +#define AT91C_CAN_MB11 (0x1 << 11) // (CAN) Mailbox 11 Flag +#define AT91C_CAN_MB12 (0x1 << 12) // (CAN) Mailbox 12 Flag +#define AT91C_CAN_MB13 (0x1 << 13) // (CAN) Mailbox 13 Flag +#define AT91C_CAN_MB14 (0x1 << 14) // (CAN) Mailbox 14 Flag +#define AT91C_CAN_MB15 (0x1 << 15) // (CAN) Mailbox 15 Flag +#define AT91C_CAN_ERRA (0x1 << 16) // (CAN) Error Active Mode Flag +#define AT91C_CAN_WARN (0x1 << 17) // (CAN) Warning Limit Flag +#define AT91C_CAN_ERRP (0x1 << 18) // (CAN) Error Passive Mode Flag +#define AT91C_CAN_BOFF (0x1 << 19) // (CAN) Bus Off Mode Flag +#define AT91C_CAN_SLEEP (0x1 << 20) // (CAN) Sleep Flag +#define AT91C_CAN_WAKEUP (0x1 << 21) // (CAN) Wakeup Flag +#define AT91C_CAN_TOVF (0x1 << 22) // (CAN) Timer Overflow Flag +#define AT91C_CAN_TSTP (0x1 << 23) // (CAN) Timestamp Flag +#define AT91C_CAN_CERR (0x1 << 24) // (CAN) CRC Error +#define AT91C_CAN_SERR (0x1 << 25) // (CAN) Stuffing Error +#define AT91C_CAN_AERR (0x1 << 26) // (CAN) Acknowledgment Error +#define AT91C_CAN_FERR (0x1 << 27) // (CAN) Form Error +#define AT91C_CAN_BERR (0x1 << 28) // (CAN) Bit Error +// -------- CAN_IDR : (CAN Offset: 0x8) CAN Interrupt Disable Register -------- +// -------- CAN_IMR : (CAN Offset: 0xc) CAN Interrupt Mask Register -------- +// -------- CAN_SR : (CAN Offset: 0x10) CAN Status Register -------- +#define AT91C_CAN_RBSY (0x1 << 29) // (CAN) Receiver Busy +#define AT91C_CAN_TBSY (0x1 << 30) // (CAN) Transmitter Busy +#define AT91C_CAN_OVLY (0x1 << 31) // (CAN) Overload Busy +// -------- CAN_BR : (CAN Offset: 0x14) CAN Baudrate Register -------- +#define AT91C_CAN_PHASE2 (0x7 << 0) // (CAN) Phase 2 segment +#define AT91C_CAN_PHASE1 (0x7 << 4) // (CAN) Phase 1 segment +#define AT91C_CAN_PROPAG (0x7 << 8) // (CAN) Programmation time segment +#define AT91C_CAN_SYNC (0x3 << 12) // (CAN) Re-synchronization jump width segment +#define AT91C_CAN_BRP (0x7F << 16) // (CAN) Baudrate Prescaler +#define AT91C_CAN_SMP (0x1 << 24) // (CAN) Sampling mode +// -------- CAN_TIM : (CAN Offset: 0x18) CAN Timer Register -------- +#define AT91C_CAN_TIMER (0xFFFF << 0) // (CAN) Timer field +// -------- CAN_TIMESTP : (CAN Offset: 0x1c) CAN Timestamp Register -------- +// -------- CAN_ECR : (CAN Offset: 0x20) CAN Error Counter Register -------- +#define AT91C_CAN_REC (0xFF << 0) // (CAN) Receive Error Counter +#define AT91C_CAN_TEC (0xFF << 16) // (CAN) Transmit Error Counter +// -------- CAN_TCR : (CAN Offset: 0x24) CAN Transfer Command Register -------- +#define AT91C_CAN_TIMRST (0x1 << 31) // (CAN) Timer Reset Field +// -------- CAN_ACR : (CAN Offset: 0x28) CAN Abort Command Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Ethernet MAC 10/100 +// ***************************************************************************** +// *** Register offset in AT91S_EMAC structure *** +#define EMAC_NCR ( 0) // Network Control Register +#define EMAC_NCFGR ( 4) // Network Configuration Register +#define EMAC_NSR ( 8) // Network Status Register +#define EMAC_TSR (20) // Transmit Status Register +#define EMAC_RBQP (24) // Receive Buffer Queue Pointer +#define EMAC_TBQP (28) // Transmit Buffer Queue Pointer +#define EMAC_RSR (32) // Receive Status Register +#define EMAC_ISR (36) // Interrupt Status Register +#define EMAC_IER (40) // Interrupt Enable Register +#define EMAC_IDR (44) // Interrupt Disable Register +#define EMAC_IMR (48) // Interrupt Mask Register +#define EMAC_MAN (52) // PHY Maintenance Register +#define EMAC_PTR (56) // Pause Time Register +#define EMAC_PFR (60) // Pause Frames received Register +#define EMAC_FTO (64) // Frames Transmitted OK Register +#define EMAC_SCF (68) // Single Collision Frame Register +#define EMAC_MCF (72) // Multiple Collision Frame Register +#define EMAC_FRO (76) // Frames Received OK Register +#define EMAC_FCSE (80) // Frame Check Sequence Error Register +#define EMAC_ALE (84) // Alignment Error Register +#define EMAC_DTF (88) // Deferred Transmission Frame Register +#define EMAC_LCOL (92) // Late Collision Register +#define EMAC_ECOL (96) // Excessive Collision Register +#define EMAC_TUND (100) // Transmit Underrun Error Register +#define EMAC_CSE (104) // Carrier Sense Error Register +#define EMAC_RRE (108) // Receive Ressource Error Register +#define EMAC_ROV (112) // Receive Overrun Errors Register +#define EMAC_RSE (116) // Receive Symbol Errors Register +#define EMAC_ELE (120) // Excessive Length Errors Register +#define EMAC_RJA (124) // Receive Jabbers Register +#define EMAC_USF (128) // Undersize Frames Register +#define EMAC_STE (132) // SQE Test Error Register +#define EMAC_RLE (136) // Receive Length Field Mismatch Register +#define EMAC_TPF (140) // Transmitted Pause Frames Register +#define EMAC_HRB (144) // Hash Address Bottom[31:0] +#define EMAC_HRT (148) // Hash Address Top[63:32] +#define EMAC_SA1L (152) // Specific Address 1 Bottom, First 4 bytes +#define EMAC_SA1H (156) // Specific Address 1 Top, Last 2 bytes +#define EMAC_SA2L (160) // Specific Address 2 Bottom, First 4 bytes +#define EMAC_SA2H (164) // Specific Address 2 Top, Last 2 bytes +#define EMAC_SA3L (168) // Specific Address 3 Bottom, First 4 bytes +#define EMAC_SA3H (172) // Specific Address 3 Top, Last 2 bytes +#define EMAC_SA4L (176) // Specific Address 4 Bottom, First 4 bytes +#define EMAC_SA4H (180) // Specific Address 4 Top, Last 2 bytes +#define EMAC_TID (184) // Type ID Checking Register +#define EMAC_TPQ (188) // Transmit Pause Quantum Register +#define EMAC_USRIO (192) // USER Input/Output Register +#define EMAC_WOL (196) // Wake On LAN Register +#define EMAC_REV (252) // Revision Register +// -------- EMAC_NCR : (EMAC Offset: 0x0) -------- +#define AT91C_EMAC_LB (0x1 << 0) // (EMAC) Loopback. Optional. When set, loopback signal is at high level. +#define AT91C_EMAC_LLB (0x1 << 1) // (EMAC) Loopback local. +#define AT91C_EMAC_RE (0x1 << 2) // (EMAC) Receive enable. +#define AT91C_EMAC_TE (0x1 << 3) // (EMAC) Transmit enable. +#define AT91C_EMAC_MPE (0x1 << 4) // (EMAC) Management port enable. +#define AT91C_EMAC_CLRSTAT (0x1 << 5) // (EMAC) Clear statistics registers. +#define AT91C_EMAC_INCSTAT (0x1 << 6) // (EMAC) Increment statistics registers. +#define AT91C_EMAC_WESTAT (0x1 << 7) // (EMAC) Write enable for statistics registers. +#define AT91C_EMAC_BP (0x1 << 8) // (EMAC) Back pressure. +#define AT91C_EMAC_TSTART (0x1 << 9) // (EMAC) Start Transmission. +#define AT91C_EMAC_THALT (0x1 << 10) // (EMAC) Transmission Halt. +#define AT91C_EMAC_TPFR (0x1 << 11) // (EMAC) Transmit pause frame +#define AT91C_EMAC_TZQ (0x1 << 12) // (EMAC) Transmit zero quantum pause frame +// -------- EMAC_NCFGR : (EMAC Offset: 0x4) Network Configuration Register -------- +#define AT91C_EMAC_SPD (0x1 << 0) // (EMAC) Speed. +#define AT91C_EMAC_FD (0x1 << 1) // (EMAC) Full duplex. +#define AT91C_EMAC_JFRAME (0x1 << 3) // (EMAC) Jumbo Frames. +#define AT91C_EMAC_CAF (0x1 << 4) // (EMAC) Copy all frames. +#define AT91C_EMAC_NBC (0x1 << 5) // (EMAC) No broadcast. +#define AT91C_EMAC_MTI (0x1 << 6) // (EMAC) Multicast hash event enable +#define AT91C_EMAC_UNI (0x1 << 7) // (EMAC) Unicast hash enable. +#define AT91C_EMAC_BIG (0x1 << 8) // (EMAC) Receive 1522 bytes. +#define AT91C_EMAC_EAE (0x1 << 9) // (EMAC) External address match enable. +#define AT91C_EMAC_CLK (0x3 << 10) // (EMAC) +#define AT91C_EMAC_CLK_HCLK_8 (0x0 << 10) // (EMAC) HCLK divided by 8 +#define AT91C_EMAC_CLK_HCLK_16 (0x1 << 10) // (EMAC) HCLK divided by 16 +#define AT91C_EMAC_CLK_HCLK_32 (0x2 << 10) // (EMAC) HCLK divided by 32 +#define AT91C_EMAC_CLK_HCLK_64 (0x3 << 10) // (EMAC) HCLK divided by 64 +#define AT91C_EMAC_RTY (0x1 << 12) // (EMAC) +#define AT91C_EMAC_PAE (0x1 << 13) // (EMAC) +#define AT91C_EMAC_RBOF (0x3 << 14) // (EMAC) +#define AT91C_EMAC_RBOF_OFFSET_0 (0x0 << 14) // (EMAC) no offset from start of receive buffer +#define AT91C_EMAC_RBOF_OFFSET_1 (0x1 << 14) // (EMAC) one byte offset from start of receive buffer +#define AT91C_EMAC_RBOF_OFFSET_2 (0x2 << 14) // (EMAC) two bytes offset from start of receive buffer +#define AT91C_EMAC_RBOF_OFFSET_3 (0x3 << 14) // (EMAC) three bytes offset from start of receive buffer +#define AT91C_EMAC_RLCE (0x1 << 16) // (EMAC) Receive Length field Checking Enable +#define AT91C_EMAC_DRFCS (0x1 << 17) // (EMAC) Discard Receive FCS +#define AT91C_EMAC_EFRHD (0x1 << 18) // (EMAC) +#define AT91C_EMAC_IRXFCS (0x1 << 19) // (EMAC) Ignore RX FCS +// -------- EMAC_NSR : (EMAC Offset: 0x8) Network Status Register -------- +#define AT91C_EMAC_LINKR (0x1 << 0) // (EMAC) +#define AT91C_EMAC_MDIO (0x1 << 1) // (EMAC) +#define AT91C_EMAC_IDLE (0x1 << 2) // (EMAC) +// -------- EMAC_TSR : (EMAC Offset: 0x14) Transmit Status Register -------- +#define AT91C_EMAC_UBR (0x1 << 0) // (EMAC) +#define AT91C_EMAC_COL (0x1 << 1) // (EMAC) +#define AT91C_EMAC_RLES (0x1 << 2) // (EMAC) +#define AT91C_EMAC_TGO (0x1 << 3) // (EMAC) Transmit Go +#define AT91C_EMAC_BEX (0x1 << 4) // (EMAC) Buffers exhausted mid frame +#define AT91C_EMAC_COMP (0x1 << 5) // (EMAC) +#define AT91C_EMAC_UND (0x1 << 6) // (EMAC) +// -------- EMAC_RSR : (EMAC Offset: 0x20) Receive Status Register -------- +#define AT91C_EMAC_BNA (0x1 << 0) // (EMAC) +#define AT91C_EMAC_REC (0x1 << 1) // (EMAC) +#define AT91C_EMAC_OVR (0x1 << 2) // (EMAC) +// -------- EMAC_ISR : (EMAC Offset: 0x24) Interrupt Status Register -------- +#define AT91C_EMAC_MFD (0x1 << 0) // (EMAC) +#define AT91C_EMAC_RCOMP (0x1 << 1) // (EMAC) +#define AT91C_EMAC_RXUBR (0x1 << 2) // (EMAC) +#define AT91C_EMAC_TXUBR (0x1 << 3) // (EMAC) +#define AT91C_EMAC_TUNDR (0x1 << 4) // (EMAC) +#define AT91C_EMAC_RLEX (0x1 << 5) // (EMAC) +#define AT91C_EMAC_TXERR (0x1 << 6) // (EMAC) +#define AT91C_EMAC_TCOMP (0x1 << 7) // (EMAC) +#define AT91C_EMAC_LINK (0x1 << 9) // (EMAC) +#define AT91C_EMAC_ROVR (0x1 << 10) // (EMAC) +#define AT91C_EMAC_HRESP (0x1 << 11) // (EMAC) +#define AT91C_EMAC_PFRE (0x1 << 12) // (EMAC) +#define AT91C_EMAC_PTZ (0x1 << 13) // (EMAC) +// -------- EMAC_IER : (EMAC Offset: 0x28) Interrupt Enable Register -------- +// -------- EMAC_IDR : (EMAC Offset: 0x2c) Interrupt Disable Register -------- +// -------- EMAC_IMR : (EMAC Offset: 0x30) Interrupt Mask Register -------- +// -------- EMAC_MAN : (EMAC Offset: 0x34) PHY Maintenance Register -------- +#define AT91C_EMAC_DATA (0xFFFF << 0) // (EMAC) +#define AT91C_EMAC_CODE (0x3 << 16) // (EMAC) +#define AT91C_EMAC_REGA (0x1F << 18) // (EMAC) +#define AT91C_EMAC_PHYA (0x1F << 23) // (EMAC) +#define AT91C_EMAC_RW (0x3 << 28) // (EMAC) +#define AT91C_EMAC_SOF (0x3 << 30) // (EMAC) +// -------- EMAC_USRIO : (EMAC Offset: 0xc0) USER Input Output Register -------- +#define AT91C_EMAC_RMII (0x1 << 0) // (EMAC) Reduce MII +#define AT91C_EMAC_CLKEN (0x1 << 1) // (EMAC) Clock Enable +// -------- EMAC_WOL : (EMAC Offset: 0xc4) Wake On LAN Register -------- +#define AT91C_EMAC_IP (0xFFFF << 0) // (EMAC) ARP request IP address +#define AT91C_EMAC_MAG (0x1 << 16) // (EMAC) Magic packet event enable +#define AT91C_EMAC_ARP (0x1 << 17) // (EMAC) ARP request event enable +#define AT91C_EMAC_SA1 (0x1 << 18) // (EMAC) Specific address register 1 event enable +// -------- EMAC_REV : (EMAC Offset: 0xfc) Revision Register -------- +#define AT91C_EMAC_REVREF (0xFFFF << 0) // (EMAC) +#define AT91C_EMAC_PARTREF (0xFFFF << 16) // (EMAC) + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Analog to Digital Convertor +// ***************************************************************************** +// *** Register offset in AT91S_ADC structure *** +#define ADC_CR ( 0) // ADC Control Register +#define ADC_MR ( 4) // ADC Mode Register +#define ADC_CHER (16) // ADC Channel Enable Register +#define ADC_CHDR (20) // ADC Channel Disable Register +#define ADC_CHSR (24) // ADC Channel Status Register +#define ADC_SR (28) // ADC Status Register +#define ADC_LCDR (32) // ADC Last Converted Data Register +#define ADC_IER (36) // ADC Interrupt Enable Register +#define ADC_IDR (40) // ADC Interrupt Disable Register +#define ADC_IMR (44) // ADC Interrupt Mask Register +#define ADC_CDR0 (48) // ADC Channel Data Register 0 +#define ADC_CDR1 (52) // ADC Channel Data Register 1 +#define ADC_CDR2 (56) // ADC Channel Data Register 2 +#define ADC_CDR3 (60) // ADC Channel Data Register 3 +#define ADC_CDR4 (64) // ADC Channel Data Register 4 +#define ADC_CDR5 (68) // ADC Channel Data Register 5 +#define ADC_CDR6 (72) // ADC Channel Data Register 6 +#define ADC_CDR7 (76) // ADC Channel Data Register 7 +#define ADC_RPR (256) // Receive Pointer Register +#define ADC_RCR (260) // Receive Counter Register +#define ADC_TPR (264) // Transmit Pointer Register +#define ADC_TCR (268) // Transmit Counter Register +#define ADC_RNPR (272) // Receive Next Pointer Register +#define ADC_RNCR (276) // Receive Next Counter Register +#define ADC_TNPR (280) // Transmit Next Pointer Register +#define ADC_TNCR (284) // Transmit Next Counter Register +#define ADC_PTCR (288) // PDC Transfer Control Register +#define ADC_PTSR (292) // PDC Transfer Status Register +// -------- ADC_CR : (ADC Offset: 0x0) ADC Control Register -------- +#define AT91C_ADC_SWRST (0x1 << 0) // (ADC) Software Reset +#define AT91C_ADC_START (0x1 << 1) // (ADC) Start Conversion +// -------- ADC_MR : (ADC Offset: 0x4) ADC Mode Register -------- +#define AT91C_ADC_TRGEN (0x1 << 0) // (ADC) Trigger Enable +#define AT91C_ADC_TRGEN_DIS (0x0) // (ADC) Hradware triggers are disabled. Starting a conversion is only possible by software +#define AT91C_ADC_TRGEN_EN (0x1) // (ADC) Hardware trigger selected by TRGSEL field is enabled. +#define AT91C_ADC_TRGSEL (0x7 << 1) // (ADC) Trigger Selection +#define AT91C_ADC_TRGSEL_TIOA0 (0x0 << 1) // (ADC) Selected TRGSEL = TIAO0 +#define AT91C_ADC_TRGSEL_TIOA1 (0x1 << 1) // (ADC) Selected TRGSEL = TIAO1 +#define AT91C_ADC_TRGSEL_TIOA2 (0x2 << 1) // (ADC) Selected TRGSEL = TIAO2 +#define AT91C_ADC_TRGSEL_TIOA3 (0x3 << 1) // (ADC) Selected TRGSEL = TIAO3 +#define AT91C_ADC_TRGSEL_TIOA4 (0x4 << 1) // (ADC) Selected TRGSEL = TIAO4 +#define AT91C_ADC_TRGSEL_TIOA5 (0x5 << 1) // (ADC) Selected TRGSEL = TIAO5 +#define AT91C_ADC_TRGSEL_EXT (0x6 << 1) // (ADC) Selected TRGSEL = External Trigger +#define AT91C_ADC_LOWRES (0x1 << 4) // (ADC) Resolution. +#define AT91C_ADC_LOWRES_10_BIT (0x0 << 4) // (ADC) 10-bit resolution +#define AT91C_ADC_LOWRES_8_BIT (0x1 << 4) // (ADC) 8-bit resolution +#define AT91C_ADC_SLEEP (0x1 << 5) // (ADC) Sleep Mode +#define AT91C_ADC_SLEEP_NORMAL_MODE (0x0 << 5) // (ADC) Normal Mode +#define AT91C_ADC_SLEEP_MODE (0x1 << 5) // (ADC) Sleep Mode +#define AT91C_ADC_PRESCAL (0x3F << 8) // (ADC) Prescaler rate selection +#define AT91C_ADC_STARTUP (0x1F << 16) // (ADC) Startup Time +#define AT91C_ADC_SHTIM (0xF << 24) // (ADC) Sample & Hold Time +// -------- ADC_CHER : (ADC Offset: 0x10) ADC Channel Enable Register -------- +#define AT91C_ADC_CH0 (0x1 << 0) // (ADC) Channel 0 +#define AT91C_ADC_CH1 (0x1 << 1) // (ADC) Channel 1 +#define AT91C_ADC_CH2 (0x1 << 2) // (ADC) Channel 2 +#define AT91C_ADC_CH3 (0x1 << 3) // (ADC) Channel 3 +#define AT91C_ADC_CH4 (0x1 << 4) // (ADC) Channel 4 +#define AT91C_ADC_CH5 (0x1 << 5) // (ADC) Channel 5 +#define AT91C_ADC_CH6 (0x1 << 6) // (ADC) Channel 6 +#define AT91C_ADC_CH7 (0x1 << 7) // (ADC) Channel 7 +// -------- ADC_CHDR : (ADC Offset: 0x14) ADC Channel Disable Register -------- +// -------- ADC_CHSR : (ADC Offset: 0x18) ADC Channel Status Register -------- +// -------- ADC_SR : (ADC Offset: 0x1c) ADC Status Register -------- +#define AT91C_ADC_EOC0 (0x1 << 0) // (ADC) End of Conversion +#define AT91C_ADC_EOC1 (0x1 << 1) // (ADC) End of Conversion +#define AT91C_ADC_EOC2 (0x1 << 2) // (ADC) End of Conversion +#define AT91C_ADC_EOC3 (0x1 << 3) // (ADC) End of Conversion +#define AT91C_ADC_EOC4 (0x1 << 4) // (ADC) End of Conversion +#define AT91C_ADC_EOC5 (0x1 << 5) // (ADC) End of Conversion +#define AT91C_ADC_EOC6 (0x1 << 6) // (ADC) End of Conversion +#define AT91C_ADC_EOC7 (0x1 << 7) // (ADC) End of Conversion +#define AT91C_ADC_OVRE0 (0x1 << 8) // (ADC) Overrun Error +#define AT91C_ADC_OVRE1 (0x1 << 9) // (ADC) Overrun Error +#define AT91C_ADC_OVRE2 (0x1 << 10) // (ADC) Overrun Error +#define AT91C_ADC_OVRE3 (0x1 << 11) // (ADC) Overrun Error +#define AT91C_ADC_OVRE4 (0x1 << 12) // (ADC) Overrun Error +#define AT91C_ADC_OVRE5 (0x1 << 13) // (ADC) Overrun Error +#define AT91C_ADC_OVRE6 (0x1 << 14) // (ADC) Overrun Error +#define AT91C_ADC_OVRE7 (0x1 << 15) // (ADC) Overrun Error +#define AT91C_ADC_DRDY (0x1 << 16) // (ADC) Data Ready +#define AT91C_ADC_GOVRE (0x1 << 17) // (ADC) General Overrun +#define AT91C_ADC_ENDRX (0x1 << 18) // (ADC) End of Receiver Transfer +#define AT91C_ADC_RXBUFF (0x1 << 19) // (ADC) RXBUFF Interrupt +// -------- ADC_LCDR : (ADC Offset: 0x20) ADC Last Converted Data Register -------- +#define AT91C_ADC_LDATA (0x3FF << 0) // (ADC) Last Data Converted +// -------- ADC_IER : (ADC Offset: 0x24) ADC Interrupt Enable Register -------- +// -------- ADC_IDR : (ADC Offset: 0x28) ADC Interrupt Disable Register -------- +// -------- ADC_IMR : (ADC Offset: 0x2c) ADC Interrupt Mask Register -------- +// -------- ADC_CDR0 : (ADC Offset: 0x30) ADC Channel Data Register 0 -------- +#define AT91C_ADC_DATA (0x3FF << 0) // (ADC) Converted Data +// -------- ADC_CDR1 : (ADC Offset: 0x34) ADC Channel Data Register 1 -------- +// -------- ADC_CDR2 : (ADC Offset: 0x38) ADC Channel Data Register 2 -------- +// -------- ADC_CDR3 : (ADC Offset: 0x3c) ADC Channel Data Register 3 -------- +// -------- ADC_CDR4 : (ADC Offset: 0x40) ADC Channel Data Register 4 -------- +// -------- ADC_CDR5 : (ADC Offset: 0x44) ADC Channel Data Register 5 -------- +// -------- ADC_CDR6 : (ADC Offset: 0x48) ADC Channel Data Register 6 -------- +// -------- ADC_CDR7 : (ADC Offset: 0x4c) ADC Channel Data Register 7 -------- + +// ***************************************************************************** +// REGISTER ADDRESS DEFINITION FOR AT91SAM7X256 +// ***************************************************************************** +// ========== Register definition for SYS peripheral ========== +// ========== Register definition for AIC peripheral ========== +#define AT91C_AIC_IVR (0xFFFFF100) // (AIC) IRQ Vector Register +#define AT91C_AIC_SMR (0xFFFFF000) // (AIC) Source Mode Register +#define AT91C_AIC_FVR (0xFFFFF104) // (AIC) FIQ Vector Register +#define AT91C_AIC_DCR (0xFFFFF138) // (AIC) Debug Control Register (Protect) +#define AT91C_AIC_EOICR (0xFFFFF130) // (AIC) End of Interrupt Command Register +#define AT91C_AIC_SVR (0xFFFFF080) // (AIC) Source Vector Register +#define AT91C_AIC_FFSR (0xFFFFF148) // (AIC) Fast Forcing Status Register +#define AT91C_AIC_ICCR (0xFFFFF128) // (AIC) Interrupt Clear Command Register +#define AT91C_AIC_ISR (0xFFFFF108) // (AIC) Interrupt Status Register +#define AT91C_AIC_IMR (0xFFFFF110) // (AIC) Interrupt Mask Register +#define AT91C_AIC_IPR (0xFFFFF10C) // (AIC) Interrupt Pending Register +#define AT91C_AIC_FFER (0xFFFFF140) // (AIC) Fast Forcing Enable Register +#define AT91C_AIC_IECR (0xFFFFF120) // (AIC) Interrupt Enable Command Register +#define AT91C_AIC_ISCR (0xFFFFF12C) // (AIC) Interrupt Set Command Register +#define AT91C_AIC_FFDR (0xFFFFF144) // (AIC) Fast Forcing Disable Register +#define AT91C_AIC_CISR (0xFFFFF114) // (AIC) Core Interrupt Status Register +#define AT91C_AIC_IDCR (0xFFFFF124) // (AIC) Interrupt Disable Command Register +#define AT91C_AIC_SPU (0xFFFFF134) // (AIC) Spurious Vector Register +// ========== Register definition for PDC_DBGU peripheral ========== +#define AT91C_DBGU_TCR (0xFFFFF30C) // (PDC_DBGU) Transmit Counter Register +#define AT91C_DBGU_RNPR (0xFFFFF310) // (PDC_DBGU) Receive Next Pointer Register +#define AT91C_DBGU_TNPR (0xFFFFF318) // (PDC_DBGU) Transmit Next Pointer Register +#define AT91C_DBGU_TPR (0xFFFFF308) // (PDC_DBGU) Transmit Pointer Register +#define AT91C_DBGU_RPR (0xFFFFF300) // (PDC_DBGU) Receive Pointer Register +#define AT91C_DBGU_RCR (0xFFFFF304) // (PDC_DBGU) Receive Counter Register +#define AT91C_DBGU_RNCR (0xFFFFF314) // (PDC_DBGU) Receive Next Counter Register +#define AT91C_DBGU_PTCR (0xFFFFF320) // (PDC_DBGU) PDC Transfer Control Register +#define AT91C_DBGU_PTSR (0xFFFFF324) // (PDC_DBGU) PDC Transfer Status Register +#define AT91C_DBGU_TNCR (0xFFFFF31C) // (PDC_DBGU) Transmit Next Counter Register +// ========== Register definition for DBGU peripheral ========== +#define AT91C_DBGU_EXID (0xFFFFF244) // (DBGU) Chip ID Extension Register +#define AT91C_DBGU_BRGR (0xFFFFF220) // (DBGU) Baud Rate Generator Register +#define AT91C_DBGU_IDR (0xFFFFF20C) // (DBGU) Interrupt Disable Register +#define AT91C_DBGU_CSR (0xFFFFF214) // (DBGU) Channel Status Register +#define AT91C_DBGU_CIDR (0xFFFFF240) // (DBGU) Chip ID Register +#define AT91C_DBGU_MR (0xFFFFF204) // (DBGU) Mode Register +#define AT91C_DBGU_IMR (0xFFFFF210) // (DBGU) Interrupt Mask Register +#define AT91C_DBGU_CR (0xFFFFF200) // (DBGU) Control Register +#define AT91C_DBGU_FNTR (0xFFFFF248) // (DBGU) Force NTRST Register +#define AT91C_DBGU_THR (0xFFFFF21C) // (DBGU) Transmitter Holding Register +#define AT91C_DBGU_RHR (0xFFFFF218) // (DBGU) Receiver Holding Register +#define AT91C_DBGU_IER (0xFFFFF208) // (DBGU) Interrupt Enable Register +// ========== Register definition for PIOA peripheral ========== +#define AT91C_PIOA_ODR (0xFFFFF414) // (PIOA) Output Disable Registerr +#define AT91C_PIOA_SODR (0xFFFFF430) // (PIOA) Set Output Data Register +#define AT91C_PIOA_ISR (0xFFFFF44C) // (PIOA) Interrupt Status Register +#define AT91C_PIOA_ABSR (0xFFFFF478) // (PIOA) AB Select Status Register +#define AT91C_PIOA_IER (0xFFFFF440) // (PIOA) Interrupt Enable Register +#define AT91C_PIOA_PPUDR (0xFFFFF460) // (PIOA) Pull-up Disable Register +#define AT91C_PIOA_IMR (0xFFFFF448) // (PIOA) Interrupt Mask Register +#define AT91C_PIOA_PER (0xFFFFF400) // (PIOA) PIO Enable Register +#define AT91C_PIOA_IFDR (0xFFFFF424) // (PIOA) Input Filter Disable Register +#define AT91C_PIOA_OWDR (0xFFFFF4A4) // (PIOA) Output Write Disable Register +#define AT91C_PIOA_MDSR (0xFFFFF458) // (PIOA) Multi-driver Status Register +#define AT91C_PIOA_IDR (0xFFFFF444) // (PIOA) Interrupt Disable Register +#define AT91C_PIOA_ODSR (0xFFFFF438) // (PIOA) Output Data Status Register +#define AT91C_PIOA_PPUSR (0xFFFFF468) // (PIOA) Pull-up Status Register +#define AT91C_PIOA_OWSR (0xFFFFF4A8) // (PIOA) Output Write Status Register +#define AT91C_PIOA_BSR (0xFFFFF474) // (PIOA) Select B Register +#define AT91C_PIOA_OWER (0xFFFFF4A0) // (PIOA) Output Write Enable Register +#define AT91C_PIOA_IFER (0xFFFFF420) // (PIOA) Input Filter Enable Register +#define AT91C_PIOA_PDSR (0xFFFFF43C) // (PIOA) Pin Data Status Register +#define AT91C_PIOA_PPUER (0xFFFFF464) // (PIOA) Pull-up Enable Register +#define AT91C_PIOA_OSR (0xFFFFF418) // (PIOA) Output Status Register +#define AT91C_PIOA_ASR (0xFFFFF470) // (PIOA) Select A Register +#define AT91C_PIOA_MDDR (0xFFFFF454) // (PIOA) Multi-driver Disable Register +#define AT91C_PIOA_CODR (0xFFFFF434) // (PIOA) Clear Output Data Register +#define AT91C_PIOA_MDER (0xFFFFF450) // (PIOA) Multi-driver Enable Register +#define AT91C_PIOA_PDR (0xFFFFF404) // (PIOA) PIO Disable Register +#define AT91C_PIOA_IFSR (0xFFFFF428) // (PIOA) Input Filter Status Register +#define AT91C_PIOA_OER (0xFFFFF410) // (PIOA) Output Enable Register +#define AT91C_PIOA_PSR (0xFFFFF408) // (PIOA) PIO Status Register +// ========== Register definition for PIOB peripheral ========== +#define AT91C_PIOB_OWDR (0xFFFFF6A4) // (PIOB) Output Write Disable Register +#define AT91C_PIOB_MDER (0xFFFFF650) // (PIOB) Multi-driver Enable Register +#define AT91C_PIOB_PPUSR (0xFFFFF668) // (PIOB) Pull-up Status Register +#define AT91C_PIOB_IMR (0xFFFFF648) // (PIOB) Interrupt Mask Register +#define AT91C_PIOB_ASR (0xFFFFF670) // (PIOB) Select A Register +#define AT91C_PIOB_PPUDR (0xFFFFF660) // (PIOB) Pull-up Disable Register +#define AT91C_PIOB_PSR (0xFFFFF608) // (PIOB) PIO Status Register +#define AT91C_PIOB_IER (0xFFFFF640) // (PIOB) Interrupt Enable Register +#define AT91C_PIOB_CODR (0xFFFFF634) // (PIOB) Clear Output Data Register +#define AT91C_PIOB_OWER (0xFFFFF6A0) // (PIOB) Output Write Enable Register +#define AT91C_PIOB_ABSR (0xFFFFF678) // (PIOB) AB Select Status Register +#define AT91C_PIOB_IFDR (0xFFFFF624) // (PIOB) Input Filter Disable Register +#define AT91C_PIOB_PDSR (0xFFFFF63C) // (PIOB) Pin Data Status Register +#define AT91C_PIOB_IDR (0xFFFFF644) // (PIOB) Interrupt Disable Register +#define AT91C_PIOB_OWSR (0xFFFFF6A8) // (PIOB) Output Write Status Register +#define AT91C_PIOB_PDR (0xFFFFF604) // (PIOB) PIO Disable Register +#define AT91C_PIOB_ODR (0xFFFFF614) // (PIOB) Output Disable Registerr +#define AT91C_PIOB_IFSR (0xFFFFF628) // (PIOB) Input Filter Status Register +#define AT91C_PIOB_PPUER (0xFFFFF664) // (PIOB) Pull-up Enable Register +#define AT91C_PIOB_SODR (0xFFFFF630) // (PIOB) Set Output Data Register +#define AT91C_PIOB_ISR (0xFFFFF64C) // (PIOB) Interrupt Status Register +#define AT91C_PIOB_ODSR (0xFFFFF638) // (PIOB) Output Data Status Register +#define AT91C_PIOB_OSR (0xFFFFF618) // (PIOB) Output Status Register +#define AT91C_PIOB_MDSR (0xFFFFF658) // (PIOB) Multi-driver Status Register +#define AT91C_PIOB_IFER (0xFFFFF620) // (PIOB) Input Filter Enable Register +#define AT91C_PIOB_BSR (0xFFFFF674) // (PIOB) Select B Register +#define AT91C_PIOB_MDDR (0xFFFFF654) // (PIOB) Multi-driver Disable Register +#define AT91C_PIOB_OER (0xFFFFF610) // (PIOB) Output Enable Register +#define AT91C_PIOB_PER (0xFFFFF600) // (PIOB) PIO Enable Register +// ========== Register definition for CKGR peripheral ========== +#define AT91C_CKGR_MOR (0xFFFFFC20) // (CKGR) Main Oscillator Register +#define AT91C_CKGR_PLLR (0xFFFFFC2C) // (CKGR) PLL Register +#define AT91C_CKGR_MCFR (0xFFFFFC24) // (CKGR) Main Clock Frequency Register +// ========== Register definition for PMC peripheral ========== +#define AT91C_PMC_IDR (0xFFFFFC64) // (PMC) Interrupt Disable Register +#define AT91C_PMC_MOR (0xFFFFFC20) // (PMC) Main Oscillator Register +#define AT91C_PMC_PLLR (0xFFFFFC2C) // (PMC) PLL Register +#define AT91C_PMC_PCER (0xFFFFFC10) // (PMC) Peripheral Clock Enable Register +#define AT91C_PMC_PCKR (0xFFFFFC40) // (PMC) Programmable Clock Register +#define AT91C_PMC_MCKR (0xFFFFFC30) // (PMC) Master Clock Register +#define AT91C_PMC_SCDR (0xFFFFFC04) // (PMC) System Clock Disable Register +#define AT91C_PMC_PCDR (0xFFFFFC14) // (PMC) Peripheral Clock Disable Register +#define AT91C_PMC_SCSR (0xFFFFFC08) // (PMC) System Clock Status Register +#define AT91C_PMC_PCSR (0xFFFFFC18) // (PMC) Peripheral Clock Status Register +#define AT91C_PMC_MCFR (0xFFFFFC24) // (PMC) Main Clock Frequency Register +#define AT91C_PMC_SCER (0xFFFFFC00) // (PMC) System Clock Enable Register +#define AT91C_PMC_IMR (0xFFFFFC6C) // (PMC) Interrupt Mask Register +#define AT91C_PMC_IER (0xFFFFFC60) // (PMC) Interrupt Enable Register +#define AT91C_PMC_SR (0xFFFFFC68) // (PMC) Status Register +// ========== Register definition for RSTC peripheral ========== +#define AT91C_RSTC_RCR (0xFFFFFD00) // (RSTC) Reset Control Register +#define AT91C_RSTC_RMR (0xFFFFFD08) // (RSTC) Reset Mode Register +#define AT91C_RSTC_RSR (0xFFFFFD04) // (RSTC) Reset Status Register +// ========== Register definition for RTTC peripheral ========== +#define AT91C_RTTC_RTSR (0xFFFFFD2C) // (RTTC) Real-time Status Register +#define AT91C_RTTC_RTMR (0xFFFFFD20) // (RTTC) Real-time Mode Register +#define AT91C_RTTC_RTVR (0xFFFFFD28) // (RTTC) Real-time Value Register +#define AT91C_RTTC_RTAR (0xFFFFFD24) // (RTTC) Real-time Alarm Register +// ========== Register definition for PITC peripheral ========== +#define AT91C_PITC_PIVR (0xFFFFFD38) // (PITC) Period Interval Value Register +#define AT91C_PITC_PISR (0xFFFFFD34) // (PITC) Period Interval Status Register +#define AT91C_PITC_PIIR (0xFFFFFD3C) // (PITC) Period Interval Image Register +#define AT91C_PITC_PIMR (0xFFFFFD30) // (PITC) Period Interval Mode Register +// ========== Register definition for WDTC peripheral ========== +#define AT91C_WDTC_WDCR (0xFFFFFD40) // (WDTC) Watchdog Control Register +#define AT91C_WDTC_WDSR (0xFFFFFD48) // (WDTC) Watchdog Status Register +#define AT91C_WDTC_WDMR (0xFFFFFD44) // (WDTC) Watchdog Mode Register +// ========== Register definition for VREG peripheral ========== +#define AT91C_VREG_MR (0xFFFFFD60) // (VREG) Voltage Regulator Mode Register +// ========== Register definition for MC peripheral ========== +#define AT91C_MC_ASR (0xFFFFFF04) // (MC) MC Abort Status Register +#define AT91C_MC_RCR (0xFFFFFF00) // (MC) MC Remap Control Register +#define AT91C_MC_FCR (0xFFFFFF64) // (MC) MC Flash Command Register +#define AT91C_MC_AASR (0xFFFFFF08) // (MC) MC Abort Address Status Register +#define AT91C_MC_FSR (0xFFFFFF68) // (MC) MC Flash Status Register +#define AT91C_MC_FMR (0xFFFFFF60) // (MC) MC Flash Mode Register +// ========== Register definition for PDC_SPI1 peripheral ========== +#define AT91C_SPI1_PTCR (0xFFFE4120) // (PDC_SPI1) PDC Transfer Control Register +#define AT91C_SPI1_RPR (0xFFFE4100) // (PDC_SPI1) Receive Pointer Register +#define AT91C_SPI1_TNCR (0xFFFE411C) // (PDC_SPI1) Transmit Next Counter Register +#define AT91C_SPI1_TPR (0xFFFE4108) // (PDC_SPI1) Transmit Pointer Register +#define AT91C_SPI1_TNPR (0xFFFE4118) // (PDC_SPI1) Transmit Next Pointer Register +#define AT91C_SPI1_TCR (0xFFFE410C) // (PDC_SPI1) Transmit Counter Register +#define AT91C_SPI1_RCR (0xFFFE4104) // (PDC_SPI1) Receive Counter Register +#define AT91C_SPI1_RNPR (0xFFFE4110) // (PDC_SPI1) Receive Next Pointer Register +#define AT91C_SPI1_RNCR (0xFFFE4114) // (PDC_SPI1) Receive Next Counter Register +#define AT91C_SPI1_PTSR (0xFFFE4124) // (PDC_SPI1) PDC Transfer Status Register +// ========== Register definition for SPI1 peripheral ========== +#define AT91C_SPI1_IMR (0xFFFE401C) // (SPI1) Interrupt Mask Register +#define AT91C_SPI1_IER (0xFFFE4014) // (SPI1) Interrupt Enable Register +#define AT91C_SPI1_MR (0xFFFE4004) // (SPI1) Mode Register +#define AT91C_SPI1_RDR (0xFFFE4008) // (SPI1) Receive Data Register +#define AT91C_SPI1_IDR (0xFFFE4018) // (SPI1) Interrupt Disable Register +#define AT91C_SPI1_SR (0xFFFE4010) // (SPI1) Status Register +#define AT91C_SPI1_TDR (0xFFFE400C) // (SPI1) Transmit Data Register +#define AT91C_SPI1_CR (0xFFFE4000) // (SPI1) Control Register +#define AT91C_SPI1_CSR (0xFFFE4030) // (SPI1) Chip Select Register +// ========== Register definition for PDC_SPI0 peripheral ========== +#define AT91C_SPI0_PTCR (0xFFFE0120) // (PDC_SPI0) PDC Transfer Control Register +#define AT91C_SPI0_TPR (0xFFFE0108) // (PDC_SPI0) Transmit Pointer Register +#define AT91C_SPI0_TCR (0xFFFE010C) // (PDC_SPI0) Transmit Counter Register +#define AT91C_SPI0_RCR (0xFFFE0104) // (PDC_SPI0) Receive Counter Register +#define AT91C_SPI0_PTSR (0xFFFE0124) // (PDC_SPI0) PDC Transfer Status Register +#define AT91C_SPI0_RNPR (0xFFFE0110) // (PDC_SPI0) Receive Next Pointer Register +#define AT91C_SPI0_RPR (0xFFFE0100) // (PDC_SPI0) Receive Pointer Register +#define AT91C_SPI0_TNCR (0xFFFE011C) // (PDC_SPI0) Transmit Next Counter Register +#define AT91C_SPI0_RNCR (0xFFFE0114) // (PDC_SPI0) Receive Next Counter Register +#define AT91C_SPI0_TNPR (0xFFFE0118) // (PDC_SPI0) Transmit Next Pointer Register +// ========== Register definition for SPI0 peripheral ========== +#define AT91C_SPI0_IER (0xFFFE0014) // (SPI0) Interrupt Enable Register +#define AT91C_SPI0_SR (0xFFFE0010) // (SPI0) Status Register +#define AT91C_SPI0_IDR (0xFFFE0018) // (SPI0) Interrupt Disable Register +#define AT91C_SPI0_CR (0xFFFE0000) // (SPI0) Control Register +#define AT91C_SPI0_MR (0xFFFE0004) // (SPI0) Mode Register +#define AT91C_SPI0_IMR (0xFFFE001C) // (SPI0) Interrupt Mask Register +#define AT91C_SPI0_TDR (0xFFFE000C) // (SPI0) Transmit Data Register +#define AT91C_SPI0_RDR (0xFFFE0008) // (SPI0) Receive Data Register +#define AT91C_SPI0_CSR (0xFFFE0030) // (SPI0) Chip Select Register +// ========== Register definition for PDC_US1 peripheral ========== +#define AT91C_US1_RNCR (0xFFFC4114) // (PDC_US1) Receive Next Counter Register +#define AT91C_US1_PTCR (0xFFFC4120) // (PDC_US1) PDC Transfer Control Register +#define AT91C_US1_TCR (0xFFFC410C) // (PDC_US1) Transmit Counter Register +#define AT91C_US1_PTSR (0xFFFC4124) // (PDC_US1) PDC Transfer Status Register +#define AT91C_US1_TNPR (0xFFFC4118) // (PDC_US1) Transmit Next Pointer Register +#define AT91C_US1_RCR (0xFFFC4104) // (PDC_US1) Receive Counter Register +#define AT91C_US1_RNPR (0xFFFC4110) // (PDC_US1) Receive Next Pointer Register +#define AT91C_US1_RPR (0xFFFC4100) // (PDC_US1) Receive Pointer Register +#define AT91C_US1_TNCR (0xFFFC411C) // (PDC_US1) Transmit Next Counter Register +#define AT91C_US1_TPR (0xFFFC4108) // (PDC_US1) Transmit Pointer Register +// ========== Register definition for US1 peripheral ========== +#define AT91C_US1_IF (0xFFFC404C) // (US1) IRDA_FILTER Register +#define AT91C_US1_NER (0xFFFC4044) // (US1) Nb Errors Register +#define AT91C_US1_RTOR (0xFFFC4024) // (US1) Receiver Time-out Register +#define AT91C_US1_CSR (0xFFFC4014) // (US1) Channel Status Register +#define AT91C_US1_IDR (0xFFFC400C) // (US1) Interrupt Disable Register +#define AT91C_US1_IER (0xFFFC4008) // (US1) Interrupt Enable Register +#define AT91C_US1_THR (0xFFFC401C) // (US1) Transmitter Holding Register +#define AT91C_US1_TTGR (0xFFFC4028) // (US1) Transmitter Time-guard Register +#define AT91C_US1_RHR (0xFFFC4018) // (US1) Receiver Holding Register +#define AT91C_US1_BRGR (0xFFFC4020) // (US1) Baud Rate Generator Register +#define AT91C_US1_IMR (0xFFFC4010) // (US1) Interrupt Mask Register +#define AT91C_US1_FIDI (0xFFFC4040) // (US1) FI_DI_Ratio Register +#define AT91C_US1_CR (0xFFFC4000) // (US1) Control Register +#define AT91C_US1_MR (0xFFFC4004) // (US1) Mode Register +// ========== Register definition for PDC_US0 peripheral ========== +#define AT91C_US0_TNPR (0xFFFC0118) // (PDC_US0) Transmit Next Pointer Register +#define AT91C_US0_RNPR (0xFFFC0110) // (PDC_US0) Receive Next Pointer Register +#define AT91C_US0_TCR (0xFFFC010C) // (PDC_US0) Transmit Counter Register +#define AT91C_US0_PTCR (0xFFFC0120) // (PDC_US0) PDC Transfer Control Register +#define AT91C_US0_PTSR (0xFFFC0124) // (PDC_US0) PDC Transfer Status Register +#define AT91C_US0_TNCR (0xFFFC011C) // (PDC_US0) Transmit Next Counter Register +#define AT91C_US0_TPR (0xFFFC0108) // (PDC_US0) Transmit Pointer Register +#define AT91C_US0_RCR (0xFFFC0104) // (PDC_US0) Receive Counter Register +#define AT91C_US0_RPR (0xFFFC0100) // (PDC_US0) Receive Pointer Register +#define AT91C_US0_RNCR (0xFFFC0114) // (PDC_US0) Receive Next Counter Register +// ========== Register definition for US0 peripheral ========== +#define AT91C_US0_BRGR (0xFFFC0020) // (US0) Baud Rate Generator Register +#define AT91C_US0_NER (0xFFFC0044) // (US0) Nb Errors Register +#define AT91C_US0_CR (0xFFFC0000) // (US0) Control Register +#define AT91C_US0_IMR (0xFFFC0010) // (US0) Interrupt Mask Register +#define AT91C_US0_FIDI (0xFFFC0040) // (US0) FI_DI_Ratio Register +#define AT91C_US0_TTGR (0xFFFC0028) // (US0) Transmitter Time-guard Register +#define AT91C_US0_MR (0xFFFC0004) // (US0) Mode Register +#define AT91C_US0_RTOR (0xFFFC0024) // (US0) Receiver Time-out Register +#define AT91C_US0_CSR (0xFFFC0014) // (US0) Channel Status Register +#define AT91C_US0_RHR (0xFFFC0018) // (US0) Receiver Holding Register +#define AT91C_US0_IDR (0xFFFC000C) // (US0) Interrupt Disable Register +#define AT91C_US0_THR (0xFFFC001C) // (US0) Transmitter Holding Register +#define AT91C_US0_IF (0xFFFC004C) // (US0) IRDA_FILTER Register +#define AT91C_US0_IER (0xFFFC0008) // (US0) Interrupt Enable Register +// ========== Register definition for PDC_SSC peripheral ========== +#define AT91C_SSC_TNCR (0xFFFD411C) // (PDC_SSC) Transmit Next Counter Register +#define AT91C_SSC_RPR (0xFFFD4100) // (PDC_SSC) Receive Pointer Register +#define AT91C_SSC_RNCR (0xFFFD4114) // (PDC_SSC) Receive Next Counter Register +#define AT91C_SSC_TPR (0xFFFD4108) // (PDC_SSC) Transmit Pointer Register +#define AT91C_SSC_PTCR (0xFFFD4120) // (PDC_SSC) PDC Transfer Control Register +#define AT91C_SSC_TCR (0xFFFD410C) // (PDC_SSC) Transmit Counter Register +#define AT91C_SSC_RCR (0xFFFD4104) // (PDC_SSC) Receive Counter Register +#define AT91C_SSC_RNPR (0xFFFD4110) // (PDC_SSC) Receive Next Pointer Register +#define AT91C_SSC_TNPR (0xFFFD4118) // (PDC_SSC) Transmit Next Pointer Register +#define AT91C_SSC_PTSR (0xFFFD4124) // (PDC_SSC) PDC Transfer Status Register +// ========== Register definition for SSC peripheral ========== +#define AT91C_SSC_RHR (0xFFFD4020) // (SSC) Receive Holding Register +#define AT91C_SSC_RSHR (0xFFFD4030) // (SSC) Receive Sync Holding Register +#define AT91C_SSC_TFMR (0xFFFD401C) // (SSC) Transmit Frame Mode Register +#define AT91C_SSC_IDR (0xFFFD4048) // (SSC) Interrupt Disable Register +#define AT91C_SSC_THR (0xFFFD4024) // (SSC) Transmit Holding Register +#define AT91C_SSC_RCMR (0xFFFD4010) // (SSC) Receive Clock ModeRegister +#define AT91C_SSC_IER (0xFFFD4044) // (SSC) Interrupt Enable Register +#define AT91C_SSC_TSHR (0xFFFD4034) // (SSC) Transmit Sync Holding Register +#define AT91C_SSC_SR (0xFFFD4040) // (SSC) Status Register +#define AT91C_SSC_CMR (0xFFFD4004) // (SSC) Clock Mode Register +#define AT91C_SSC_TCMR (0xFFFD4018) // (SSC) Transmit Clock Mode Register +#define AT91C_SSC_CR (0xFFFD4000) // (SSC) Control Register +#define AT91C_SSC_IMR (0xFFFD404C) // (SSC) Interrupt Mask Register +#define AT91C_SSC_RFMR (0xFFFD4014) // (SSC) Receive Frame Mode Register +// ========== Register definition for TWI peripheral ========== +#define AT91C_TWI_IER (0xFFFB8024) // (TWI) Interrupt Enable Register +#define AT91C_TWI_CR (0xFFFB8000) // (TWI) Control Register +#define AT91C_TWI_SR (0xFFFB8020) // (TWI) Status Register +#define AT91C_TWI_IMR (0xFFFB802C) // (TWI) Interrupt Mask Register +#define AT91C_TWI_THR (0xFFFB8034) // (TWI) Transmit Holding Register +#define AT91C_TWI_IDR (0xFFFB8028) // (TWI) Interrupt Disable Register +#define AT91C_TWI_IADR (0xFFFB800C) // (TWI) Internal Address Register +#define AT91C_TWI_MMR (0xFFFB8004) // (TWI) Master Mode Register +#define AT91C_TWI_CWGR (0xFFFB8010) // (TWI) Clock Waveform Generator Register +#define AT91C_TWI_RHR (0xFFFB8030) // (TWI) Receive Holding Register +// ========== Register definition for PWMC_CH3 peripheral ========== +#define AT91C_PWMC_CH3_CUPDR (0xFFFCC270) // (PWMC_CH3) Channel Update Register +#define AT91C_PWMC_CH3_Reserved (0xFFFCC274) // (PWMC_CH3) Reserved +#define AT91C_PWMC_CH3_CPRDR (0xFFFCC268) // (PWMC_CH3) Channel Period Register +#define AT91C_PWMC_CH3_CDTYR (0xFFFCC264) // (PWMC_CH3) Channel Duty Cycle Register +#define AT91C_PWMC_CH3_CCNTR (0xFFFCC26C) // (PWMC_CH3) Channel Counter Register +#define AT91C_PWMC_CH3_CMR (0xFFFCC260) // (PWMC_CH3) Channel Mode Register +// ========== Register definition for PWMC_CH2 peripheral ========== +#define AT91C_PWMC_CH2_Reserved (0xFFFCC254) // (PWMC_CH2) Reserved +#define AT91C_PWMC_CH2_CMR (0xFFFCC240) // (PWMC_CH2) Channel Mode Register +#define AT91C_PWMC_CH2_CCNTR (0xFFFCC24C) // (PWMC_CH2) Channel Counter Register +#define AT91C_PWMC_CH2_CPRDR (0xFFFCC248) // (PWMC_CH2) Channel Period Register +#define AT91C_PWMC_CH2_CUPDR (0xFFFCC250) // (PWMC_CH2) Channel Update Register +#define AT91C_PWMC_CH2_CDTYR (0xFFFCC244) // (PWMC_CH2) Channel Duty Cycle Register +// ========== Register definition for PWMC_CH1 peripheral ========== +#define AT91C_PWMC_CH1_Reserved (0xFFFCC234) // (PWMC_CH1) Reserved +#define AT91C_PWMC_CH1_CUPDR (0xFFFCC230) // (PWMC_CH1) Channel Update Register +#define AT91C_PWMC_CH1_CPRDR (0xFFFCC228) // (PWMC_CH1) Channel Period Register +#define AT91C_PWMC_CH1_CCNTR (0xFFFCC22C) // (PWMC_CH1) Channel Counter Register +#define AT91C_PWMC_CH1_CDTYR (0xFFFCC224) // (PWMC_CH1) Channel Duty Cycle Register +#define AT91C_PWMC_CH1_CMR (0xFFFCC220) // (PWMC_CH1) Channel Mode Register +// ========== Register definition for PWMC_CH0 peripheral ========== +#define AT91C_PWMC_CH0_Reserved (0xFFFCC214) // (PWMC_CH0) Reserved +#define AT91C_PWMC_CH0_CPRDR (0xFFFCC208) // (PWMC_CH0) Channel Period Register +#define AT91C_PWMC_CH0_CDTYR (0xFFFCC204) // (PWMC_CH0) Channel Duty Cycle Register +#define AT91C_PWMC_CH0_CMR (0xFFFCC200) // (PWMC_CH0) Channel Mode Register +#define AT91C_PWMC_CH0_CUPDR (0xFFFCC210) // (PWMC_CH0) Channel Update Register +#define AT91C_PWMC_CH0_CCNTR (0xFFFCC20C) // (PWMC_CH0) Channel Counter Register +// ========== Register definition for PWMC peripheral ========== +#define AT91C_PWMC_IDR (0xFFFCC014) // (PWMC) PWMC Interrupt Disable Register +#define AT91C_PWMC_DIS (0xFFFCC008) // (PWMC) PWMC Disable Register +#define AT91C_PWMC_IER (0xFFFCC010) // (PWMC) PWMC Interrupt Enable Register +#define AT91C_PWMC_VR (0xFFFCC0FC) // (PWMC) PWMC Version Register +#define AT91C_PWMC_ISR (0xFFFCC01C) // (PWMC) PWMC Interrupt Status Register +#define AT91C_PWMC_SR (0xFFFCC00C) // (PWMC) PWMC Status Register +#define AT91C_PWMC_IMR (0xFFFCC018) // (PWMC) PWMC Interrupt Mask Register +#define AT91C_PWMC_MR (0xFFFCC000) // (PWMC) PWMC Mode Register +#define AT91C_PWMC_ENA (0xFFFCC004) // (PWMC) PWMC Enable Register +// ========== Register definition for UDP peripheral ========== +#define AT91C_UDP_IMR (0xFFFB0018) // (UDP) Interrupt Mask Register +#define AT91C_UDP_FADDR (0xFFFB0008) // (UDP) Function Address Register +#define AT91C_UDP_NUM (0xFFFB0000) // (UDP) Frame Number Register +#define AT91C_UDP_FDR (0xFFFB0050) // (UDP) Endpoint FIFO Data Register +#define AT91C_UDP_ISR (0xFFFB001C) // (UDP) Interrupt Status Register +#define AT91C_UDP_CSR (0xFFFB0030) // (UDP) Endpoint Control and Status Register +#define AT91C_UDP_IDR (0xFFFB0014) // (UDP) Interrupt Disable Register +#define AT91C_UDP_ICR (0xFFFB0020) // (UDP) Interrupt Clear Register +#define AT91C_UDP_RSTEP (0xFFFB0028) // (UDP) Reset Endpoint Register +#define AT91C_UDP_TXVC (0xFFFB0074) // (UDP) Transceiver Control Register +#define AT91C_UDP_GLBSTATE (0xFFFB0004) // (UDP) Global State Register +#define AT91C_UDP_IER (0xFFFB0010) // (UDP) Interrupt Enable Register +// ========== Register definition for TC0 peripheral ========== +#define AT91C_TC0_SR (0xFFFA0020) // (TC0) Status Register +#define AT91C_TC0_RC (0xFFFA001C) // (TC0) Register C +#define AT91C_TC0_RB (0xFFFA0018) // (TC0) Register B +#define AT91C_TC0_CCR (0xFFFA0000) // (TC0) Channel Control Register +#define AT91C_TC0_CMR (0xFFFA0004) // (TC0) Channel Mode Register (Capture Mode / Waveform Mode) +#define AT91C_TC0_IER (0xFFFA0024) // (TC0) Interrupt Enable Register +#define AT91C_TC0_RA (0xFFFA0014) // (TC0) Register A +#define AT91C_TC0_IDR (0xFFFA0028) // (TC0) Interrupt Disable Register +#define AT91C_TC0_CV (0xFFFA0010) // (TC0) Counter Value +#define AT91C_TC0_IMR (0xFFFA002C) // (TC0) Interrupt Mask Register +// ========== Register definition for TC1 peripheral ========== +#define AT91C_TC1_RB (0xFFFA0058) // (TC1) Register B +#define AT91C_TC1_CCR (0xFFFA0040) // (TC1) Channel Control Register +#define AT91C_TC1_IER (0xFFFA0064) // (TC1) Interrupt Enable Register +#define AT91C_TC1_IDR (0xFFFA0068) // (TC1) Interrupt Disable Register +#define AT91C_TC1_SR (0xFFFA0060) // (TC1) Status Register +#define AT91C_TC1_CMR (0xFFFA0044) // (TC1) Channel Mode Register (Capture Mode / Waveform Mode) +#define AT91C_TC1_RA (0xFFFA0054) // (TC1) Register A +#define AT91C_TC1_RC (0xFFFA005C) // (TC1) Register C +#define AT91C_TC1_IMR (0xFFFA006C) // (TC1) Interrupt Mask Register +#define AT91C_TC1_CV (0xFFFA0050) // (TC1) Counter Value +// ========== Register definition for TC2 peripheral ========== +#define AT91C_TC2_CMR (0xFFFA0084) // (TC2) Channel Mode Register (Capture Mode / Waveform Mode) +#define AT91C_TC2_CCR (0xFFFA0080) // (TC2) Channel Control Register +#define AT91C_TC2_CV (0xFFFA0090) // (TC2) Counter Value +#define AT91C_TC2_RA (0xFFFA0094) // (TC2) Register A +#define AT91C_TC2_RB (0xFFFA0098) // (TC2) Register B +#define AT91C_TC2_IDR (0xFFFA00A8) // (TC2) Interrupt Disable Register +#define AT91C_TC2_IMR (0xFFFA00AC) // (TC2) Interrupt Mask Register +#define AT91C_TC2_RC (0xFFFA009C) // (TC2) Register C +#define AT91C_TC2_IER (0xFFFA00A4) // (TC2) Interrupt Enable Register +#define AT91C_TC2_SR (0xFFFA00A0) // (TC2) Status Register +// ========== Register definition for TCB peripheral ========== +#define AT91C_TCB_BMR (0xFFFA00C4) // (TCB) TC Block Mode Register +#define AT91C_TCB_BCR (0xFFFA00C0) // (TCB) TC Block Control Register +// ========== Register definition for CAN_MB0 peripheral ========== +#define AT91C_CAN_MB0_MDL (0xFFFD0214) // (CAN_MB0) MailBox Data Low Register +#define AT91C_CAN_MB0_MAM (0xFFFD0204) // (CAN_MB0) MailBox Acceptance Mask Register +#define AT91C_CAN_MB0_MCR (0xFFFD021C) // (CAN_MB0) MailBox Control Register +#define AT91C_CAN_MB0_MID (0xFFFD0208) // (CAN_MB0) MailBox ID Register +#define AT91C_CAN_MB0_MSR (0xFFFD0210) // (CAN_MB0) MailBox Status Register +#define AT91C_CAN_MB0_MFID (0xFFFD020C) // (CAN_MB0) MailBox Family ID Register +#define AT91C_CAN_MB0_MDH (0xFFFD0218) // (CAN_MB0) MailBox Data High Register +#define AT91C_CAN_MB0_MMR (0xFFFD0200) // (CAN_MB0) MailBox Mode Register +// ========== Register definition for CAN_MB1 peripheral ========== +#define AT91C_CAN_MB1_MDL (0xFFFD0234) // (CAN_MB1) MailBox Data Low Register +#define AT91C_CAN_MB1_MID (0xFFFD0228) // (CAN_MB1) MailBox ID Register +#define AT91C_CAN_MB1_MMR (0xFFFD0220) // (CAN_MB1) MailBox Mode Register +#define AT91C_CAN_MB1_MSR (0xFFFD0230) // (CAN_MB1) MailBox Status Register +#define AT91C_CAN_MB1_MAM (0xFFFD0224) // (CAN_MB1) MailBox Acceptance Mask Register +#define AT91C_CAN_MB1_MDH (0xFFFD0238) // (CAN_MB1) MailBox Data High Register +#define AT91C_CAN_MB1_MCR (0xFFFD023C) // (CAN_MB1) MailBox Control Register +#define AT91C_CAN_MB1_MFID (0xFFFD022C) // (CAN_MB1) MailBox Family ID Register +// ========== Register definition for CAN_MB2 peripheral ========== +#define AT91C_CAN_MB2_MCR (0xFFFD025C) // (CAN_MB2) MailBox Control Register +#define AT91C_CAN_MB2_MDH (0xFFFD0258) // (CAN_MB2) MailBox Data High Register +#define AT91C_CAN_MB2_MID (0xFFFD0248) // (CAN_MB2) MailBox ID Register +#define AT91C_CAN_MB2_MDL (0xFFFD0254) // (CAN_MB2) MailBox Data Low Register +#define AT91C_CAN_MB2_MMR (0xFFFD0240) // (CAN_MB2) MailBox Mode Register +#define AT91C_CAN_MB2_MAM (0xFFFD0244) // (CAN_MB2) MailBox Acceptance Mask Register +#define AT91C_CAN_MB2_MFID (0xFFFD024C) // (CAN_MB2) MailBox Family ID Register +#define AT91C_CAN_MB2_MSR (0xFFFD0250) // (CAN_MB2) MailBox Status Register +// ========== Register definition for CAN_MB3 peripheral ========== +#define AT91C_CAN_MB3_MFID (0xFFFD026C) // (CAN_MB3) MailBox Family ID Register +#define AT91C_CAN_MB3_MAM (0xFFFD0264) // (CAN_MB3) MailBox Acceptance Mask Register +#define AT91C_CAN_MB3_MID (0xFFFD0268) // (CAN_MB3) MailBox ID Register +#define AT91C_CAN_MB3_MCR (0xFFFD027C) // (CAN_MB3) MailBox Control Register +#define AT91C_CAN_MB3_MMR (0xFFFD0260) // (CAN_MB3) MailBox Mode Register +#define AT91C_CAN_MB3_MSR (0xFFFD0270) // (CAN_MB3) MailBox Status Register +#define AT91C_CAN_MB3_MDL (0xFFFD0274) // (CAN_MB3) MailBox Data Low Register +#define AT91C_CAN_MB3_MDH (0xFFFD0278) // (CAN_MB3) MailBox Data High Register +// ========== Register definition for CAN_MB4 peripheral ========== +#define AT91C_CAN_MB4_MID (0xFFFD0288) // (CAN_MB4) MailBox ID Register +#define AT91C_CAN_MB4_MMR (0xFFFD0280) // (CAN_MB4) MailBox Mode Register +#define AT91C_CAN_MB4_MDH (0xFFFD0298) // (CAN_MB4) MailBox Data High Register +#define AT91C_CAN_MB4_MFID (0xFFFD028C) // (CAN_MB4) MailBox Family ID Register +#define AT91C_CAN_MB4_MSR (0xFFFD0290) // (CAN_MB4) MailBox Status Register +#define AT91C_CAN_MB4_MCR (0xFFFD029C) // (CAN_MB4) MailBox Control Register +#define AT91C_CAN_MB4_MDL (0xFFFD0294) // (CAN_MB4) MailBox Data Low Register +#define AT91C_CAN_MB4_MAM (0xFFFD0284) // (CAN_MB4) MailBox Acceptance Mask Register +// ========== Register definition for CAN_MB5 peripheral ========== +#define AT91C_CAN_MB5_MSR (0xFFFD02B0) // (CAN_MB5) MailBox Status Register +#define AT91C_CAN_MB5_MCR (0xFFFD02BC) // (CAN_MB5) MailBox Control Register +#define AT91C_CAN_MB5_MFID (0xFFFD02AC) // (CAN_MB5) MailBox Family ID Register +#define AT91C_CAN_MB5_MDH (0xFFFD02B8) // (CAN_MB5) MailBox Data High Register +#define AT91C_CAN_MB5_MID (0xFFFD02A8) // (CAN_MB5) MailBox ID Register +#define AT91C_CAN_MB5_MMR (0xFFFD02A0) // (CAN_MB5) MailBox Mode Register +#define AT91C_CAN_MB5_MDL (0xFFFD02B4) // (CAN_MB5) MailBox Data Low Register +#define AT91C_CAN_MB5_MAM (0xFFFD02A4) // (CAN_MB5) MailBox Acceptance Mask Register +// ========== Register definition for CAN_MB6 peripheral ========== +#define AT91C_CAN_MB6_MFID (0xFFFD02CC) // (CAN_MB6) MailBox Family ID Register +#define AT91C_CAN_MB6_MID (0xFFFD02C8) // (CAN_MB6) MailBox ID Register +#define AT91C_CAN_MB6_MAM (0xFFFD02C4) // (CAN_MB6) MailBox Acceptance Mask Register +#define AT91C_CAN_MB6_MSR (0xFFFD02D0) // (CAN_MB6) MailBox Status Register +#define AT91C_CAN_MB6_MDL (0xFFFD02D4) // (CAN_MB6) MailBox Data Low Register +#define AT91C_CAN_MB6_MCR (0xFFFD02DC) // (CAN_MB6) MailBox Control Register +#define AT91C_CAN_MB6_MDH (0xFFFD02D8) // (CAN_MB6) MailBox Data High Register +#define AT91C_CAN_MB6_MMR (0xFFFD02C0) // (CAN_MB6) MailBox Mode Register +// ========== Register definition for CAN_MB7 peripheral ========== +#define AT91C_CAN_MB7_MCR (0xFFFD02FC) // (CAN_MB7) MailBox Control Register +#define AT91C_CAN_MB7_MDH (0xFFFD02F8) // (CAN_MB7) MailBox Data High Register +#define AT91C_CAN_MB7_MFID (0xFFFD02EC) // (CAN_MB7) MailBox Family ID Register +#define AT91C_CAN_MB7_MDL (0xFFFD02F4) // (CAN_MB7) MailBox Data Low Register +#define AT91C_CAN_MB7_MID (0xFFFD02E8) // (CAN_MB7) MailBox ID Register +#define AT91C_CAN_MB7_MMR (0xFFFD02E0) // (CAN_MB7) MailBox Mode Register +#define AT91C_CAN_MB7_MAM (0xFFFD02E4) // (CAN_MB7) MailBox Acceptance Mask Register +#define AT91C_CAN_MB7_MSR (0xFFFD02F0) // (CAN_MB7) MailBox Status Register +// ========== Register definition for CAN peripheral ========== +#define AT91C_CAN_TCR (0xFFFD0024) // (CAN) Transfer Command Register +#define AT91C_CAN_IMR (0xFFFD000C) // (CAN) Interrupt Mask Register +#define AT91C_CAN_IER (0xFFFD0004) // (CAN) Interrupt Enable Register +#define AT91C_CAN_ECR (0xFFFD0020) // (CAN) Error Counter Register +#define AT91C_CAN_TIMESTP (0xFFFD001C) // (CAN) Time Stamp Register +#define AT91C_CAN_MR (0xFFFD0000) // (CAN) Mode Register +#define AT91C_CAN_IDR (0xFFFD0008) // (CAN) Interrupt Disable Register +#define AT91C_CAN_ACR (0xFFFD0028) // (CAN) Abort Command Register +#define AT91C_CAN_TIM (0xFFFD0018) // (CAN) Timer Register +#define AT91C_CAN_SR (0xFFFD0010) // (CAN) Status Register +#define AT91C_CAN_BR (0xFFFD0014) // (CAN) Baudrate Register +#define AT91C_CAN_VR (0xFFFD00FC) // (CAN) Version Register +// ========== Register definition for EMAC peripheral ========== +#define AT91C_EMAC_ISR (0xFFFDC024) // (EMAC) Interrupt Status Register +#define AT91C_EMAC_SA4H (0xFFFDC0B4) // (EMAC) Specific Address 4 Top, Last 2 bytes +#define AT91C_EMAC_SA1L (0xFFFDC098) // (EMAC) Specific Address 1 Bottom, First 4 bytes +#define AT91C_EMAC_ELE (0xFFFDC078) // (EMAC) Excessive Length Errors Register +#define AT91C_EMAC_LCOL (0xFFFDC05C) // (EMAC) Late Collision Register +#define AT91C_EMAC_RLE (0xFFFDC088) // (EMAC) Receive Length Field Mismatch Register +#define AT91C_EMAC_WOL (0xFFFDC0C4) // (EMAC) Wake On LAN Register +#define AT91C_EMAC_DTF (0xFFFDC058) // (EMAC) Deferred Transmission Frame Register +#define AT91C_EMAC_TUND (0xFFFDC064) // (EMAC) Transmit Underrun Error Register +#define AT91C_EMAC_NCR (0xFFFDC000) // (EMAC) Network Control Register +#define AT91C_EMAC_SA4L (0xFFFDC0B0) // (EMAC) Specific Address 4 Bottom, First 4 bytes +#define AT91C_EMAC_RSR (0xFFFDC020) // (EMAC) Receive Status Register +#define AT91C_EMAC_SA3L (0xFFFDC0A8) // (EMAC) Specific Address 3 Bottom, First 4 bytes +#define AT91C_EMAC_TSR (0xFFFDC014) // (EMAC) Transmit Status Register +#define AT91C_EMAC_IDR (0xFFFDC02C) // (EMAC) Interrupt Disable Register +#define AT91C_EMAC_RSE (0xFFFDC074) // (EMAC) Receive Symbol Errors Register +#define AT91C_EMAC_ECOL (0xFFFDC060) // (EMAC) Excessive Collision Register +#define AT91C_EMAC_TID (0xFFFDC0B8) // (EMAC) Type ID Checking Register +#define AT91C_EMAC_HRB (0xFFFDC090) // (EMAC) Hash Address Bottom[31:0] +#define AT91C_EMAC_TBQP (0xFFFDC01C) // (EMAC) Transmit Buffer Queue Pointer +#define AT91C_EMAC_USRIO (0xFFFDC0C0) // (EMAC) USER Input/Output Register +#define AT91C_EMAC_PTR (0xFFFDC038) // (EMAC) Pause Time Register +#define AT91C_EMAC_SA2H (0xFFFDC0A4) // (EMAC) Specific Address 2 Top, Last 2 bytes +#define AT91C_EMAC_ROV (0xFFFDC070) // (EMAC) Receive Overrun Errors Register +#define AT91C_EMAC_ALE (0xFFFDC054) // (EMAC) Alignment Error Register +#define AT91C_EMAC_RJA (0xFFFDC07C) // (EMAC) Receive Jabbers Register +#define AT91C_EMAC_RBQP (0xFFFDC018) // (EMAC) Receive Buffer Queue Pointer +#define AT91C_EMAC_TPF (0xFFFDC08C) // (EMAC) Transmitted Pause Frames Register +#define AT91C_EMAC_NCFGR (0xFFFDC004) // (EMAC) Network Configuration Register +#define AT91C_EMAC_HRT (0xFFFDC094) // (EMAC) Hash Address Top[63:32] +#define AT91C_EMAC_USF (0xFFFDC080) // (EMAC) Undersize Frames Register +#define AT91C_EMAC_FCSE (0xFFFDC050) // (EMAC) Frame Check Sequence Error Register +#define AT91C_EMAC_TPQ (0xFFFDC0BC) // (EMAC) Transmit Pause Quantum Register +#define AT91C_EMAC_MAN (0xFFFDC034) // (EMAC) PHY Maintenance Register +#define AT91C_EMAC_FTO (0xFFFDC040) // (EMAC) Frames Transmitted OK Register +#define AT91C_EMAC_REV (0xFFFDC0FC) // (EMAC) Revision Register +#define AT91C_EMAC_IMR (0xFFFDC030) // (EMAC) Interrupt Mask Register +#define AT91C_EMAC_SCF (0xFFFDC044) // (EMAC) Single Collision Frame Register +#define AT91C_EMAC_PFR (0xFFFDC03C) // (EMAC) Pause Frames received Register +#define AT91C_EMAC_MCF (0xFFFDC048) // (EMAC) Multiple Collision Frame Register +#define AT91C_EMAC_NSR (0xFFFDC008) // (EMAC) Network Status Register +#define AT91C_EMAC_SA2L (0xFFFDC0A0) // (EMAC) Specific Address 2 Bottom, First 4 bytes +#define AT91C_EMAC_FRO (0xFFFDC04C) // (EMAC) Frames Received OK Register +#define AT91C_EMAC_IER (0xFFFDC028) // (EMAC) Interrupt Enable Register +#define AT91C_EMAC_SA1H (0xFFFDC09C) // (EMAC) Specific Address 1 Top, Last 2 bytes +#define AT91C_EMAC_CSE (0xFFFDC068) // (EMAC) Carrier Sense Error Register +#define AT91C_EMAC_SA3H (0xFFFDC0AC) // (EMAC) Specific Address 3 Top, Last 2 bytes +#define AT91C_EMAC_RRE (0xFFFDC06C) // (EMAC) Receive Ressource Error Register +#define AT91C_EMAC_STE (0xFFFDC084) // (EMAC) SQE Test Error Register +// ========== Register definition for PDC_ADC peripheral ========== +#define AT91C_ADC_PTSR (0xFFFD8124) // (PDC_ADC) PDC Transfer Status Register +#define AT91C_ADC_PTCR (0xFFFD8120) // (PDC_ADC) PDC Transfer Control Register +#define AT91C_ADC_TNPR (0xFFFD8118) // (PDC_ADC) Transmit Next Pointer Register +#define AT91C_ADC_TNCR (0xFFFD811C) // (PDC_ADC) Transmit Next Counter Register +#define AT91C_ADC_RNPR (0xFFFD8110) // (PDC_ADC) Receive Next Pointer Register +#define AT91C_ADC_RNCR (0xFFFD8114) // (PDC_ADC) Receive Next Counter Register +#define AT91C_ADC_RPR (0xFFFD8100) // (PDC_ADC) Receive Pointer Register +#define AT91C_ADC_TCR (0xFFFD810C) // (PDC_ADC) Transmit Counter Register +#define AT91C_ADC_TPR (0xFFFD8108) // (PDC_ADC) Transmit Pointer Register +#define AT91C_ADC_RCR (0xFFFD8104) // (PDC_ADC) Receive Counter Register +// ========== Register definition for ADC peripheral ========== +#define AT91C_ADC_CDR2 (0xFFFD8038) // (ADC) ADC Channel Data Register 2 +#define AT91C_ADC_CDR3 (0xFFFD803C) // (ADC) ADC Channel Data Register 3 +#define AT91C_ADC_CDR0 (0xFFFD8030) // (ADC) ADC Channel Data Register 0 +#define AT91C_ADC_CDR5 (0xFFFD8044) // (ADC) ADC Channel Data Register 5 +#define AT91C_ADC_CHDR (0xFFFD8014) // (ADC) ADC Channel Disable Register +#define AT91C_ADC_SR (0xFFFD801C) // (ADC) ADC Status Register +#define AT91C_ADC_CDR4 (0xFFFD8040) // (ADC) ADC Channel Data Register 4 +#define AT91C_ADC_CDR1 (0xFFFD8034) // (ADC) ADC Channel Data Register 1 +#define AT91C_ADC_LCDR (0xFFFD8020) // (ADC) ADC Last Converted Data Register +#define AT91C_ADC_IDR (0xFFFD8028) // (ADC) ADC Interrupt Disable Register +#define AT91C_ADC_CR (0xFFFD8000) // (ADC) ADC Control Register +#define AT91C_ADC_CDR7 (0xFFFD804C) // (ADC) ADC Channel Data Register 7 +#define AT91C_ADC_CDR6 (0xFFFD8048) // (ADC) ADC Channel Data Register 6 +#define AT91C_ADC_IER (0xFFFD8024) // (ADC) ADC Interrupt Enable Register +#define AT91C_ADC_CHER (0xFFFD8010) // (ADC) ADC Channel Enable Register +#define AT91C_ADC_CHSR (0xFFFD8018) // (ADC) ADC Channel Status Register +#define AT91C_ADC_MR (0xFFFD8004) // (ADC) ADC Mode Register +#define AT91C_ADC_IMR (0xFFFD802C) // (ADC) ADC Interrupt Mask Register + +// ***************************************************************************** +// PIO DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** +#define AT91C_PIO_PA0 (1 << 0) // Pin Controlled by PA0 +#define AT91C_PA0_RXD0 (AT91C_PIO_PA0) // USART 0 Receive Data +#define AT91C_PIO_PA1 (1 << 1) // Pin Controlled by PA1 +#define AT91C_PA1_TXD0 (AT91C_PIO_PA1) // USART 0 Transmit Data +#define AT91C_PIO_PA10 (1 << 10) // Pin Controlled by PA10 +#define AT91C_PA10_TWD (AT91C_PIO_PA10) // TWI Two-wire Serial Data +#define AT91C_PIO_PA11 (1 << 11) // Pin Controlled by PA11 +#define AT91C_PA11_TWCK (AT91C_PIO_PA11) // TWI Two-wire Serial Clock +#define AT91C_PIO_PA12 (1 << 12) // Pin Controlled by PA12 +#define AT91C_PA12_SPI0_NPCS0 (AT91C_PIO_PA12) // SPI 0 Peripheral Chip Select 0 +#define AT91C_PIO_PA13 (1 << 13) // Pin Controlled by PA13 +#define AT91C_PA13_SPI0_NPCS1 (AT91C_PIO_PA13) // SPI 0 Peripheral Chip Select 1 +#define AT91C_PA13_PCK1 (AT91C_PIO_PA13) // PMC Programmable Clock Output 1 +#define AT91C_PIO_PA14 (1 << 14) // Pin Controlled by PA14 +#define AT91C_PA14_SPI0_NPCS2 (AT91C_PIO_PA14) // SPI 0 Peripheral Chip Select 2 +#define AT91C_PA14_IRQ1 (AT91C_PIO_PA14) // External Interrupt 1 +#define AT91C_PIO_PA15 (1 << 15) // Pin Controlled by PA15 +#define AT91C_PA15_SPI0_NPCS3 (AT91C_PIO_PA15) // SPI 0 Peripheral Chip Select 3 +#define AT91C_PA15_TCLK2 (AT91C_PIO_PA15) // Timer Counter 2 external clock input +#define AT91C_PIO_PA16 (1 << 16) // Pin Controlled by PA16 +#define AT91C_PA16_SPI0_MISO (AT91C_PIO_PA16) // SPI 0 Master In Slave +#define AT91C_PIO_PA17 (1 << 17) // Pin Controlled by PA17 +#define AT91C_PA17_SPI0_MOSI (AT91C_PIO_PA17) // SPI 0 Master Out Slave +#define AT91C_PIO_PA18 (1 << 18) // Pin Controlled by PA18 +#define AT91C_PA18_SPI0_SPCK (AT91C_PIO_PA18) // SPI 0 Serial Clock +#define AT91C_PIO_PA19 (1 << 19) // Pin Controlled by PA19 +#define AT91C_PA19_CANRX (AT91C_PIO_PA19) // CAN Receive +#define AT91C_PIO_PA2 (1 << 2) // Pin Controlled by PA2 +#define AT91C_PA2_SCK0 (AT91C_PIO_PA2) // USART 0 Serial Clock +#define AT91C_PA2_SPI1_NPCS1 (AT91C_PIO_PA2) // SPI 1 Peripheral Chip Select 1 +#define AT91C_PIO_PA20 (1 << 20) // Pin Controlled by PA20 +#define AT91C_PA20_CANTX (AT91C_PIO_PA20) // CAN Transmit +#define AT91C_PIO_PA21 (1 << 21) // Pin Controlled by PA21 +#define AT91C_PA21_TF (AT91C_PIO_PA21) // SSC Transmit Frame Sync +#define AT91C_PA21_SPI1_NPCS0 (AT91C_PIO_PA21) // SPI 1 Peripheral Chip Select 0 +#define AT91C_PIO_PA22 (1 << 22) // Pin Controlled by PA22 +#define AT91C_PA22_TK (AT91C_PIO_PA22) // SSC Transmit Clock +#define AT91C_PA22_SPI1_SPCK (AT91C_PIO_PA22) // SPI 1 Serial Clock +#define AT91C_PIO_PA23 (1 << 23) // Pin Controlled by PA23 +#define AT91C_PA23_TD (AT91C_PIO_PA23) // SSC Transmit data +#define AT91C_PA23_SPI1_MOSI (AT91C_PIO_PA23) // SPI 1 Master Out Slave +#define AT91C_PIO_PA24 (1 << 24) // Pin Controlled by PA24 +#define AT91C_PA24_RD (AT91C_PIO_PA24) // SSC Receive Data +#define AT91C_PA24_SPI1_MISO (AT91C_PIO_PA24) // SPI 1 Master In Slave +#define AT91C_PIO_PA25 (1 << 25) // Pin Controlled by PA25 +#define AT91C_PA25_RK (AT91C_PIO_PA25) // SSC Receive Clock +#define AT91C_PA25_SPI1_NPCS1 (AT91C_PIO_PA25) // SPI 1 Peripheral Chip Select 1 +#define AT91C_PIO_PA26 (1 << 26) // Pin Controlled by PA26 +#define AT91C_PA26_RF (AT91C_PIO_PA26) // SSC Receive Frame Sync +#define AT91C_PA26_SPI1_NPCS2 (AT91C_PIO_PA26) // SPI 1 Peripheral Chip Select 2 +#define AT91C_PIO_PA27 (1 << 27) // Pin Controlled by PA27 +#define AT91C_PA27_DRXD (AT91C_PIO_PA27) // DBGU Debug Receive Data +#define AT91C_PA27_PCK3 (AT91C_PIO_PA27) // PMC Programmable Clock Output 3 +#define AT91C_PIO_PA28 (1 << 28) // Pin Controlled by PA28 +#define AT91C_PA28_DTXD (AT91C_PIO_PA28) // DBGU Debug Transmit Data +#define AT91C_PIO_PA29 (1 << 29) // Pin Controlled by PA29 +#define AT91C_PA29_FIQ (AT91C_PIO_PA29) // AIC Fast Interrupt Input +#define AT91C_PA29_SPI1_NPCS3 (AT91C_PIO_PA29) // SPI 1 Peripheral Chip Select 3 +#define AT91C_PIO_PA3 (1 << 3) // Pin Controlled by PA3 +#define AT91C_PA3_RTS0 (AT91C_PIO_PA3) // USART 0 Ready To Send +#define AT91C_PA3_SPI1_NPCS2 (AT91C_PIO_PA3) // SPI 1 Peripheral Chip Select 2 +#define AT91C_PIO_PA30 (1 << 30) // Pin Controlled by PA30 +#define AT91C_PA30_IRQ0 (AT91C_PIO_PA30) // External Interrupt 0 +#define AT91C_PA30_PCK2 (AT91C_PIO_PA30) // PMC Programmable Clock Output 2 +#define AT91C_PIO_PA4 (1 << 4) // Pin Controlled by PA4 +#define AT91C_PA4_CTS0 (AT91C_PIO_PA4) // USART 0 Clear To Send +#define AT91C_PA4_SPI1_NPCS3 (AT91C_PIO_PA4) // SPI 1 Peripheral Chip Select 3 +#define AT91C_PIO_PA5 (1 << 5) // Pin Controlled by PA5 +#define AT91C_PA5_RXD1 (AT91C_PIO_PA5) // USART 1 Receive Data +#define AT91C_PIO_PA6 (1 << 6) // Pin Controlled by PA6 +#define AT91C_PA6_TXD1 (AT91C_PIO_PA6) // USART 1 Transmit Data +#define AT91C_PIO_PA7 (1 << 7) // Pin Controlled by PA7 +#define AT91C_PA7_SCK1 (AT91C_PIO_PA7) // USART 1 Serial Clock +#define AT91C_PA7_SPI0_NPCS1 (AT91C_PIO_PA7) // SPI 0 Peripheral Chip Select 1 +#define AT91C_PIO_PA8 (1 << 8) // Pin Controlled by PA8 +#define AT91C_PA8_RTS1 (AT91C_PIO_PA8) // USART 1 Ready To Send +#define AT91C_PA8_SPI0_NPCS2 (AT91C_PIO_PA8) // SPI 0 Peripheral Chip Select 2 +#define AT91C_PIO_PA9 (1 << 9) // Pin Controlled by PA9 +#define AT91C_PA9_CTS1 (AT91C_PIO_PA9) // USART 1 Clear To Send +#define AT91C_PA9_SPI0_NPCS3 (AT91C_PIO_PA9) // SPI 0 Peripheral Chip Select 3 +#define AT91C_PIO_PB0 (1 << 0) // Pin Controlled by PB0 +#define AT91C_PB0_ETXCK_EREFCK (AT91C_PIO_PB0) // Ethernet MAC Transmit Clock/Reference Clock +#define AT91C_PB0_PCK0 (AT91C_PIO_PB0) // PMC Programmable Clock Output 0 +#define AT91C_PIO_PB1 (1 << 1) // Pin Controlled by PB1 +#define AT91C_PB1_ETXEN (AT91C_PIO_PB1) // Ethernet MAC Transmit Enable +#define AT91C_PIO_PB10 (1 << 10) // Pin Controlled by PB10 +#define AT91C_PB10_ETX2 (AT91C_PIO_PB10) // Ethernet MAC Transmit Data 2 +#define AT91C_PB10_SPI1_NPCS1 (AT91C_PIO_PB10) // SPI 1 Peripheral Chip Select 1 +#define AT91C_PIO_PB11 (1 << 11) // Pin Controlled by PB11 +#define AT91C_PB11_ETX3 (AT91C_PIO_PB11) // Ethernet MAC Transmit Data 3 +#define AT91C_PB11_SPI1_NPCS2 (AT91C_PIO_PB11) // SPI 1 Peripheral Chip Select 2 +#define AT91C_PIO_PB12 (1 << 12) // Pin Controlled by PB12 +#define AT91C_PB12_ETXER (AT91C_PIO_PB12) // Ethernet MAC Transmikt Coding Error +#define AT91C_PB12_TCLK0 (AT91C_PIO_PB12) // Timer Counter 0 external clock input +#define AT91C_PIO_PB13 (1 << 13) // Pin Controlled by PB13 +#define AT91C_PB13_ERX2 (AT91C_PIO_PB13) // Ethernet MAC Receive Data 2 +#define AT91C_PB13_SPI0_NPCS1 (AT91C_PIO_PB13) // SPI 0 Peripheral Chip Select 1 +#define AT91C_PIO_PB14 (1 << 14) // Pin Controlled by PB14 +#define AT91C_PB14_ERX3 (AT91C_PIO_PB14) // Ethernet MAC Receive Data 3 +#define AT91C_PB14_SPI0_NPCS2 (AT91C_PIO_PB14) // SPI 0 Peripheral Chip Select 2 +#define AT91C_PIO_PB15 (1 << 15) // Pin Controlled by PB15 +#define AT91C_PB15_ERXDV_ECRSDV (AT91C_PIO_PB15) // Ethernet MAC Receive Data Valid +#define AT91C_PIO_PB16 (1 << 16) // Pin Controlled by PB16 +#define AT91C_PB16_ECOL (AT91C_PIO_PB16) // Ethernet MAC Collision Detected +#define AT91C_PB16_SPI1_NPCS3 (AT91C_PIO_PB16) // SPI 1 Peripheral Chip Select 3 +#define AT91C_PIO_PB17 (1 << 17) // Pin Controlled by PB17 +#define AT91C_PB17_ERXCK (AT91C_PIO_PB17) // Ethernet MAC Receive Clock +#define AT91C_PB17_SPI0_NPCS3 (AT91C_PIO_PB17) // SPI 0 Peripheral Chip Select 3 +#define AT91C_PIO_PB18 (1 << 18) // Pin Controlled by PB18 +#define AT91C_PB18_EF100 (AT91C_PIO_PB18) // Ethernet MAC Force 100 Mbits/sec +#define AT91C_PB18_ADTRG (AT91C_PIO_PB18) // ADC External Trigger +#define AT91C_PIO_PB19 (1 << 19) // Pin Controlled by PB19 +#define AT91C_PB19_PWM0 (AT91C_PIO_PB19) // PWM Channel 0 +#define AT91C_PB19_TCLK1 (AT91C_PIO_PB19) // Timer Counter 1 external clock input +#define AT91C_PIO_PB2 (1 << 2) // Pin Controlled by PB2 +#define AT91C_PB2_ETX0 (AT91C_PIO_PB2) // Ethernet MAC Transmit Data 0 +#define AT91C_PIO_PB20 (1 << 20) // Pin Controlled by PB20 +#define AT91C_PB20_PWM1 (AT91C_PIO_PB20) // PWM Channel 1 +#define AT91C_PB20_PCK0 (AT91C_PIO_PB20) // PMC Programmable Clock Output 0 +#define AT91C_PIO_PB21 (1 << 21) // Pin Controlled by PB21 +#define AT91C_PB21_PWM2 (AT91C_PIO_PB21) // PWM Channel 2 +#define AT91C_PB21_PCK1 (AT91C_PIO_PB21) // PMC Programmable Clock Output 1 +#define AT91C_PIO_PB22 (1 << 22) // Pin Controlled by PB22 +#define AT91C_PB22_PWM3 (AT91C_PIO_PB22) // PWM Channel 3 +#define AT91C_PB22_PCK2 (AT91C_PIO_PB22) // PMC Programmable Clock Output 2 +#define AT91C_PIO_PB23 (1 << 23) // Pin Controlled by PB23 +#define AT91C_PB23_TIOA0 (AT91C_PIO_PB23) // Timer Counter 0 Multipurpose Timer I/O Pin A +#define AT91C_PB23_DCD1 (AT91C_PIO_PB23) // USART 1 Data Carrier Detect +#define AT91C_PIO_PB24 (1 << 24) // Pin Controlled by PB24 +#define AT91C_PB24_TIOB0 (AT91C_PIO_PB24) // Timer Counter 0 Multipurpose Timer I/O Pin B +#define AT91C_PB24_DSR1 (AT91C_PIO_PB24) // USART 1 Data Set ready +#define AT91C_PIO_PB25 (1 << 25) // Pin Controlled by PB25 +#define AT91C_PB25_TIOA1 (AT91C_PIO_PB25) // Timer Counter 1 Multipurpose Timer I/O Pin A +#define AT91C_PB25_DTR1 (AT91C_PIO_PB25) // USART 1 Data Terminal ready +#define AT91C_PIO_PB26 (1 << 26) // Pin Controlled by PB26 +#define AT91C_PB26_TIOB1 (AT91C_PIO_PB26) // Timer Counter 1 Multipurpose Timer I/O Pin B +#define AT91C_PB26_RI1 (AT91C_PIO_PB26) // USART 1 Ring Indicator +#define AT91C_PIO_PB27 (1 << 27) // Pin Controlled by PB27 +#define AT91C_PB27_TIOA2 (AT91C_PIO_PB27) // Timer Counter 2 Multipurpose Timer I/O Pin A +#define AT91C_PB27_PWM0 (AT91C_PIO_PB27) // PWM Channel 0 +#define AT91C_PIO_PB28 (1 << 28) // Pin Controlled by PB28 +#define AT91C_PB28_TIOB2 (AT91C_PIO_PB28) // Timer Counter 2 Multipurpose Timer I/O Pin B +#define AT91C_PB28_PWM1 (AT91C_PIO_PB28) // PWM Channel 1 +#define AT91C_PIO_PB29 (1 << 29) // Pin Controlled by PB29 +#define AT91C_PB29_PCK1 (AT91C_PIO_PB29) // PMC Programmable Clock Output 1 +#define AT91C_PB29_PWM2 (AT91C_PIO_PB29) // PWM Channel 2 +#define AT91C_PIO_PB3 (1 << 3) // Pin Controlled by PB3 +#define AT91C_PB3_ETX1 (AT91C_PIO_PB3) // Ethernet MAC Transmit Data 1 +#define AT91C_PIO_PB30 (1 << 30) // Pin Controlled by PB30 +#define AT91C_PB30_PCK2 (AT91C_PIO_PB30) // PMC Programmable Clock Output 2 +#define AT91C_PB30_PWM3 (AT91C_PIO_PB30) // PWM Channel 3 +#define AT91C_PIO_PB4 (1 << 4) // Pin Controlled by PB4 +#define AT91C_PB4_ECRS (AT91C_PIO_PB4) // Ethernet MAC Carrier Sense/Carrier Sense and Data Valid +#define AT91C_PIO_PB5 (1 << 5) // Pin Controlled by PB5 +#define AT91C_PB5_ERX0 (AT91C_PIO_PB5) // Ethernet MAC Receive Data 0 +#define AT91C_PIO_PB6 (1 << 6) // Pin Controlled by PB6 +#define AT91C_PB6_ERX1 (AT91C_PIO_PB6) // Ethernet MAC Receive Data 1 +#define AT91C_PIO_PB7 (1 << 7) // Pin Controlled by PB7 +#define AT91C_PB7_ERXER (AT91C_PIO_PB7) // Ethernet MAC Receive Error +#define AT91C_PIO_PB8 (1 << 8) // Pin Controlled by PB8 +#define AT91C_PB8_EMDC (AT91C_PIO_PB8) // Ethernet MAC Management Data Clock +#define AT91C_PIO_PB9 (1 << 9) // Pin Controlled by PB9 +#define AT91C_PB9_EMDIO (AT91C_PIO_PB9) // Ethernet MAC Management Data Input/Output + +// ***************************************************************************** +// PERIPHERAL ID DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** +#define AT91C_ID_FIQ ( 0) // Advanced Interrupt Controller (FIQ) +#define AT91C_ID_SYS ( 1) // System Peripheral +#define AT91C_ID_PIOA ( 2) // Parallel IO Controller A +#define AT91C_ID_PIOB ( 3) // Parallel IO Controller B +#define AT91C_ID_SPI0 ( 4) // Serial Peripheral Interface 0 +#define AT91C_ID_SPI1 ( 5) // Serial Peripheral Interface 1 +#define AT91C_ID_US0 ( 6) // USART 0 +#define AT91C_ID_US1 ( 7) // USART 1 +#define AT91C_ID_SSC ( 8) // Serial Synchronous Controller +#define AT91C_ID_TWI ( 9) // Two-Wire Interface +#define AT91C_ID_PWMC (10) // PWM Controller +#define AT91C_ID_UDP (11) // USB Device Port +#define AT91C_ID_TC0 (12) // Timer Counter 0 +#define AT91C_ID_TC1 (13) // Timer Counter 1 +#define AT91C_ID_TC2 (14) // Timer Counter 2 +#define AT91C_ID_CAN (15) // Control Area Network Controller +#define AT91C_ID_EMAC (16) // Ethernet MAC +#define AT91C_ID_ADC (17) // Analog-to-Digital Converter +#define AT91C_ID_18_Reserved (18) // Reserved +#define AT91C_ID_19_Reserved (19) // Reserved +#define AT91C_ID_20_Reserved (20) // Reserved +#define AT91C_ID_21_Reserved (21) // Reserved +#define AT91C_ID_22_Reserved (22) // Reserved +#define AT91C_ID_23_Reserved (23) // Reserved +#define AT91C_ID_24_Reserved (24) // Reserved +#define AT91C_ID_25_Reserved (25) // Reserved +#define AT91C_ID_26_Reserved (26) // Reserved +#define AT91C_ID_27_Reserved (27) // Reserved +#define AT91C_ID_28_Reserved (28) // Reserved +#define AT91C_ID_29_Reserved (29) // Reserved +#define AT91C_ID_IRQ0 (30) // Advanced Interrupt Controller (IRQ0) +#define AT91C_ID_IRQ1 (31) // Advanced Interrupt Controller (IRQ1) +#define AT91C_ALL_INT (0xC003FFFF) // ALL VALID INTERRUPTS + +// ***************************************************************************** +// BASE ADDRESS DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** +#define AT91C_BASE_SYS (0xFFFFF000) // (SYS) Base Address +#define AT91C_BASE_AIC (0xFFFFF000) // (AIC) Base Address +#define AT91C_BASE_PDC_DBGU (0xFFFFF300) // (PDC_DBGU) Base Address +#define AT91C_BASE_DBGU (0xFFFFF200) // (DBGU) Base Address +#define AT91C_BASE_PIOA (0xFFFFF400) // (PIOA) Base Address +#define AT91C_BASE_PIOB (0xFFFFF600) // (PIOB) Base Address +#define AT91C_BASE_CKGR (0xFFFFFC20) // (CKGR) Base Address +#define AT91C_BASE_PMC (0xFFFFFC00) // (PMC) Base Address +#define AT91C_BASE_RSTC (0xFFFFFD00) // (RSTC) Base Address +#define AT91C_BASE_RTTC (0xFFFFFD20) // (RTTC) Base Address +#define AT91C_BASE_PITC (0xFFFFFD30) // (PITC) Base Address +#define AT91C_BASE_WDTC (0xFFFFFD40) // (WDTC) Base Address +#define AT91C_BASE_VREG (0xFFFFFD60) // (VREG) Base Address +#define AT91C_BASE_MC (0xFFFFFF00) // (MC) Base Address +#define AT91C_BASE_PDC_SPI1 (0xFFFE4100) // (PDC_SPI1) Base Address +#define AT91C_BASE_SPI1 (0xFFFE4000) // (SPI1) Base Address +#define AT91C_BASE_PDC_SPI0 (0xFFFE0100) // (PDC_SPI0) Base Address +#define AT91C_BASE_SPI0 (0xFFFE0000) // (SPI0) Base Address +#define AT91C_BASE_PDC_US1 (0xFFFC4100) // (PDC_US1) Base Address +#define AT91C_BASE_US1 (0xFFFC4000) // (US1) Base Address +#define AT91C_BASE_PDC_US0 (0xFFFC0100) // (PDC_US0) Base Address +#define AT91C_BASE_US0 (0xFFFC0000) // (US0) Base Address +#define AT91C_BASE_PDC_SSC (0xFFFD4100) // (PDC_SSC) Base Address +#define AT91C_BASE_SSC (0xFFFD4000) // (SSC) Base Address +#define AT91C_BASE_TWI (0xFFFB8000) // (TWI) Base Address +#define AT91C_BASE_PWMC_CH3 (0xFFFCC260) // (PWMC_CH3) Base Address +#define AT91C_BASE_PWMC_CH2 (0xFFFCC240) // (PWMC_CH2) Base Address +#define AT91C_BASE_PWMC_CH1 (0xFFFCC220) // (PWMC_CH1) Base Address +#define AT91C_BASE_PWMC_CH0 (0xFFFCC200) // (PWMC_CH0) Base Address +#define AT91C_BASE_PWMC (0xFFFCC000) // (PWMC) Base Address +#define AT91C_BASE_UDP (0xFFFB0000) // (UDP) Base Address +#define AT91C_BASE_TC0 (0xFFFA0000) // (TC0) Base Address +#define AT91C_BASE_TC1 (0xFFFA0040) // (TC1) Base Address +#define AT91C_BASE_TC2 (0xFFFA0080) // (TC2) Base Address +#define AT91C_BASE_TCB (0xFFFA0000) // (TCB) Base Address +#define AT91C_BASE_CAN_MB0 (0xFFFD0200) // (CAN_MB0) Base Address +#define AT91C_BASE_CAN_MB1 (0xFFFD0220) // (CAN_MB1) Base Address +#define AT91C_BASE_CAN_MB2 (0xFFFD0240) // (CAN_MB2) Base Address +#define AT91C_BASE_CAN_MB3 (0xFFFD0260) // (CAN_MB3) Base Address +#define AT91C_BASE_CAN_MB4 (0xFFFD0280) // (CAN_MB4) Base Address +#define AT91C_BASE_CAN_MB5 (0xFFFD02A0) // (CAN_MB5) Base Address +#define AT91C_BASE_CAN_MB6 (0xFFFD02C0) // (CAN_MB6) Base Address +#define AT91C_BASE_CAN_MB7 (0xFFFD02E0) // (CAN_MB7) Base Address +#define AT91C_BASE_CAN (0xFFFD0000) // (CAN) Base Address +#define AT91C_BASE_EMAC (0xFFFDC000) // (EMAC) Base Address +#define AT91C_BASE_PDC_ADC (0xFFFD8100) // (PDC_ADC) Base Address +#define AT91C_BASE_ADC (0xFFFD8000) // (ADC) Base Address + +// ***************************************************************************** +// MEMORY MAPPING DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** +// ISRAM +#define AT91C_ISRAM (0x00200000) // Internal SRAM base address +#define AT91C_ISRAM_SIZE (0x00010000) // Internal SRAM size in byte (64 Kbytes) +// IFLASH +#define AT91C_IFLASH (0x00100000) // Internal FLASH base address +#define AT91C_IFLASH_SIZE (0x00040000) // Internal FLASH size in byte (256 Kbytes) +#define AT91C_IFLASH_PAGE_SIZE (256) // Internal FLASH Page Size: 256 bytes +#define AT91C_IFLASH_LOCK_REGION_SIZE (16384) // Internal FLASH Lock Region Size: 16 Kbytes +#define AT91C_IFLASH_NB_OF_PAGES (1024) // Internal FLASH Number of Pages: 1024 bytes +#define AT91C_IFLASH_NB_OF_LOCK_BITS (16) // Internal FLASH Number of Lock Bits: 16 bytes + + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/ioat91sam7x256.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/ioat91sam7x256.h new file mode 100644 index 0000000..ab71b93 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/ioat91sam7x256.h @@ -0,0 +1,4380 @@ +// - ---------------------------------------------------------------------------- +// - ATMEL Microcontroller Software Support - ROUSSET - +// - ---------------------------------------------------------------------------- +// - DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// - DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// - OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// - EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// - ---------------------------------------------------------------------------- +// - File Name : AT91SAM7X256.h +// - Object : AT91SAM7X256 definitions +// - Generated : AT91 SW Application Group 11/02/2005 (15:17:24) +// - +// - CVS Reference : /AT91SAM7X256.pl/1.14/Tue Sep 13 15:06:52 2005// +// - CVS Reference : /SYS_SAM7X.pl/1.3/Tue Feb 1 17:01:43 2005// +// - CVS Reference : /MC_SAM7X.pl/1.2/Fri May 20 14:13:04 2005// +// - CVS Reference : /PMC_SAM7X.pl/1.4/Tue Feb 8 13:58:10 2005// +// - CVS Reference : /RSTC_SAM7X.pl/1.2/Wed Jul 13 14:57:50 2005// +// - CVS Reference : /UDP_SAM7X.pl/1.1/Tue May 10 11:35:35 2005// +// - CVS Reference : /PWM_SAM7X.pl/1.1/Tue May 10 11:53:07 2005// +// - CVS Reference : /AIC_6075B.pl/1.3/Fri May 20 14:01:30 2005// +// - CVS Reference : /PIO_6057A.pl/1.2/Thu Feb 3 10:18:28 2005// +// - CVS Reference : /RTTC_6081A.pl/1.2/Tue Nov 9 14:43:58 2004// +// - CVS Reference : /PITC_6079A.pl/1.2/Tue Nov 9 14:43:56 2004// +// - CVS Reference : /WDTC_6080A.pl/1.3/Tue Nov 9 14:44:00 2004// +// - CVS Reference : /VREG_6085B.pl/1.1/Tue Feb 1 16:05:48 2005// +// - CVS Reference : /PDC_6074C.pl/1.2/Thu Feb 3 08:48:54 2005// +// - CVS Reference : /DBGU_6059D.pl/1.1/Mon Jan 31 13:15:32 2005// +// - CVS Reference : /SPI_6088D.pl/1.3/Fri May 20 14:08:59 2005// +// - CVS Reference : /US_6089C.pl/1.1/Mon Jul 12 18:23:26 2004// +// - CVS Reference : /SSC_6078B.pl/1.1/Wed Jul 13 15:19:19 2005// +// - CVS Reference : /TWI_6061A.pl/1.1/Tue Jul 13 07:38:06 2004// +// - CVS Reference : /TC_6082A.pl/1.7/Fri Mar 11 12:52:17 2005// +// - CVS Reference : /CAN_6019B.pl/1.1/Tue Mar 8 12:42:22 2005// +// - CVS Reference : /EMACB_6119A.pl/1.6/Wed Jul 13 15:05:35 2005// +// - CVS Reference : /ADC_6051C.pl/1.1/Fri Oct 17 09:12:38 2003// +// - ---------------------------------------------------------------------------- + +#ifndef AT91SAM7X256_H +#define AT91SAM7X256_H + +#ifdef __IAR_SYSTEMS_ICC__ + +typedef volatile unsigned int AT91_REG;// Hardware register definition + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR System Peripherals +// ***************************************************************************** +typedef struct _AT91S_SYS { + AT91_REG AIC_SMR[32]; // Source Mode Register + AT91_REG AIC_SVR[32]; // Source Vector Register + AT91_REG AIC_IVR; // IRQ Vector Register + AT91_REG AIC_FVR; // FIQ Vector Register + AT91_REG AIC_ISR; // Interrupt Status Register + AT91_REG AIC_IPR; // Interrupt Pending Register + AT91_REG AIC_IMR; // Interrupt Mask Register + AT91_REG AIC_CISR; // Core Interrupt Status Register + AT91_REG Reserved0[2]; // + AT91_REG AIC_IECR; // Interrupt Enable Command Register + AT91_REG AIC_IDCR; // Interrupt Disable Command Register + AT91_REG AIC_ICCR; // Interrupt Clear Command Register + AT91_REG AIC_ISCR; // Interrupt Set Command Register + AT91_REG AIC_EOICR; // End of Interrupt Command Register + AT91_REG AIC_SPU; // Spurious Vector Register + AT91_REG AIC_DCR; // Debug Control Register (Protect) + AT91_REG Reserved1[1]; // + AT91_REG AIC_FFER; // Fast Forcing Enable Register + AT91_REG AIC_FFDR; // Fast Forcing Disable Register + AT91_REG AIC_FFSR; // Fast Forcing Status Register + AT91_REG Reserved2[45]; // + AT91_REG DBGU_CR; // Control Register + AT91_REG DBGU_MR; // Mode Register + AT91_REG DBGU_IER; // Interrupt Enable Register + AT91_REG DBGU_IDR; // Interrupt Disable Register + AT91_REG DBGU_IMR; // Interrupt Mask Register + AT91_REG DBGU_CSR; // Channel Status Register + AT91_REG DBGU_RHR; // Receiver Holding Register + AT91_REG DBGU_THR; // Transmitter Holding Register + AT91_REG DBGU_BRGR; // Baud Rate Generator Register + AT91_REG Reserved3[7]; // + AT91_REG DBGU_CIDR; // Chip ID Register + AT91_REG DBGU_EXID; // Chip ID Extension Register + AT91_REG DBGU_FNTR; // Force NTRST Register + AT91_REG Reserved4[45]; // + AT91_REG DBGU_RPR; // Receive Pointer Register + AT91_REG DBGU_RCR; // Receive Counter Register + AT91_REG DBGU_TPR; // Transmit Pointer Register + AT91_REG DBGU_TCR; // Transmit Counter Register + AT91_REG DBGU_RNPR; // Receive Next Pointer Register + AT91_REG DBGU_RNCR; // Receive Next Counter Register + AT91_REG DBGU_TNPR; // Transmit Next Pointer Register + AT91_REG DBGU_TNCR; // Transmit Next Counter Register + AT91_REG DBGU_PTCR; // PDC Transfer Control Register + AT91_REG DBGU_PTSR; // PDC Transfer Status Register + AT91_REG Reserved5[54]; // + AT91_REG PIOA_PER; // PIO Enable Register + AT91_REG PIOA_PDR; // PIO Disable Register + AT91_REG PIOA_PSR; // PIO Status Register + AT91_REG Reserved6[1]; // + AT91_REG PIOA_OER; // Output Enable Register + AT91_REG PIOA_ODR; // Output Disable Registerr + AT91_REG PIOA_OSR; // Output Status Register + AT91_REG Reserved7[1]; // + AT91_REG PIOA_IFER; // Input Filter Enable Register + AT91_REG PIOA_IFDR; // Input Filter Disable Register + AT91_REG PIOA_IFSR; // Input Filter Status Register + AT91_REG Reserved8[1]; // + AT91_REG PIOA_SODR; // Set Output Data Register + AT91_REG PIOA_CODR; // Clear Output Data Register + AT91_REG PIOA_ODSR; // Output Data Status Register + AT91_REG PIOA_PDSR; // Pin Data Status Register + AT91_REG PIOA_IER; // Interrupt Enable Register + AT91_REG PIOA_IDR; // Interrupt Disable Register + AT91_REG PIOA_IMR; // Interrupt Mask Register + AT91_REG PIOA_ISR; // Interrupt Status Register + AT91_REG PIOA_MDER; // Multi-driver Enable Register + AT91_REG PIOA_MDDR; // Multi-driver Disable Register + AT91_REG PIOA_MDSR; // Multi-driver Status Register + AT91_REG Reserved9[1]; // + AT91_REG PIOA_PPUDR; // Pull-up Disable Register + AT91_REG PIOA_PPUER; // Pull-up Enable Register + AT91_REG PIOA_PPUSR; // Pull-up Status Register + AT91_REG Reserved10[1]; // + AT91_REG PIOA_ASR; // Select A Register + AT91_REG PIOA_BSR; // Select B Register + AT91_REG PIOA_ABSR; // AB Select Status Register + AT91_REG Reserved11[9]; // + AT91_REG PIOA_OWER; // Output Write Enable Register + AT91_REG PIOA_OWDR; // Output Write Disable Register + AT91_REG PIOA_OWSR; // Output Write Status Register + AT91_REG Reserved12[85]; // + AT91_REG PIOB_PER; // PIO Enable Register + AT91_REG PIOB_PDR; // PIO Disable Register + AT91_REG PIOB_PSR; // PIO Status Register + AT91_REG Reserved13[1]; // + AT91_REG PIOB_OER; // Output Enable Register + AT91_REG PIOB_ODR; // Output Disable Registerr + AT91_REG PIOB_OSR; // Output Status Register + AT91_REG Reserved14[1]; // + AT91_REG PIOB_IFER; // Input Filter Enable Register + AT91_REG PIOB_IFDR; // Input Filter Disable Register + AT91_REG PIOB_IFSR; // Input Filter Status Register + AT91_REG Reserved15[1]; // + AT91_REG PIOB_SODR; // Set Output Data Register + AT91_REG PIOB_CODR; // Clear Output Data Register + AT91_REG PIOB_ODSR; // Output Data Status Register + AT91_REG PIOB_PDSR; // Pin Data Status Register + AT91_REG PIOB_IER; // Interrupt Enable Register + AT91_REG PIOB_IDR; // Interrupt Disable Register + AT91_REG PIOB_IMR; // Interrupt Mask Register + AT91_REG PIOB_ISR; // Interrupt Status Register + AT91_REG PIOB_MDER; // Multi-driver Enable Register + AT91_REG PIOB_MDDR; // Multi-driver Disable Register + AT91_REG PIOB_MDSR; // Multi-driver Status Register + AT91_REG Reserved16[1]; // + AT91_REG PIOB_PPUDR; // Pull-up Disable Register + AT91_REG PIOB_PPUER; // Pull-up Enable Register + AT91_REG PIOB_PPUSR; // Pull-up Status Register + AT91_REG Reserved17[1]; // + AT91_REG PIOB_ASR; // Select A Register + AT91_REG PIOB_BSR; // Select B Register + AT91_REG PIOB_ABSR; // AB Select Status Register + AT91_REG Reserved18[9]; // + AT91_REG PIOB_OWER; // Output Write Enable Register + AT91_REG PIOB_OWDR; // Output Write Disable Register + AT91_REG PIOB_OWSR; // Output Write Status Register + AT91_REG Reserved19[341]; // + AT91_REG PMC_SCER; // System Clock Enable Register + AT91_REG PMC_SCDR; // System Clock Disable Register + AT91_REG PMC_SCSR; // System Clock Status Register + AT91_REG Reserved20[1]; // + AT91_REG PMC_PCER; // Peripheral Clock Enable Register + AT91_REG PMC_PCDR; // Peripheral Clock Disable Register + AT91_REG PMC_PCSR; // Peripheral Clock Status Register + AT91_REG Reserved21[1]; // + AT91_REG PMC_MOR; // Main Oscillator Register + AT91_REG PMC_MCFR; // Main Clock Frequency Register + AT91_REG Reserved22[1]; // + AT91_REG PMC_PLLR; // PLL Register + AT91_REG PMC_MCKR; // Master Clock Register + AT91_REG Reserved23[3]; // + AT91_REG PMC_PCKR[4]; // Programmable Clock Register + AT91_REG Reserved24[4]; // + AT91_REG PMC_IER; // Interrupt Enable Register + AT91_REG PMC_IDR; // Interrupt Disable Register + AT91_REG PMC_SR; // Status Register + AT91_REG PMC_IMR; // Interrupt Mask Register + AT91_REG Reserved25[36]; // + AT91_REG RSTC_RCR; // Reset Control Register + AT91_REG RSTC_RSR; // Reset Status Register + AT91_REG RSTC_RMR; // Reset Mode Register + AT91_REG Reserved26[5]; // + AT91_REG RTTC_RTMR; // Real-time Mode Register + AT91_REG RTTC_RTAR; // Real-time Alarm Register + AT91_REG RTTC_RTVR; // Real-time Value Register + AT91_REG RTTC_RTSR; // Real-time Status Register + AT91_REG PITC_PIMR; // Period Interval Mode Register + AT91_REG PITC_PISR; // Period Interval Status Register + AT91_REG PITC_PIVR; // Period Interval Value Register + AT91_REG PITC_PIIR; // Period Interval Image Register + AT91_REG WDTC_WDCR; // Watchdog Control Register + AT91_REG WDTC_WDMR; // Watchdog Mode Register + AT91_REG WDTC_WDSR; // Watchdog Status Register + AT91_REG Reserved27[5]; // + AT91_REG VREG_MR; // Voltage Regulator Mode Register +} AT91S_SYS, *AT91PS_SYS; + + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Advanced Interrupt Controller +// ***************************************************************************** +typedef struct _AT91S_AIC { + AT91_REG AIC_SMR[32]; // Source Mode Register + AT91_REG AIC_SVR[32]; // Source Vector Register + AT91_REG AIC_IVR; // IRQ Vector Register + AT91_REG AIC_FVR; // FIQ Vector Register + AT91_REG AIC_ISR; // Interrupt Status Register + AT91_REG AIC_IPR; // Interrupt Pending Register + AT91_REG AIC_IMR; // Interrupt Mask Register + AT91_REG AIC_CISR; // Core Interrupt Status Register + AT91_REG Reserved0[2]; // + AT91_REG AIC_IECR; // Interrupt Enable Command Register + AT91_REG AIC_IDCR; // Interrupt Disable Command Register + AT91_REG AIC_ICCR; // Interrupt Clear Command Register + AT91_REG AIC_ISCR; // Interrupt Set Command Register + AT91_REG AIC_EOICR; // End of Interrupt Command Register + AT91_REG AIC_SPU; // Spurious Vector Register + AT91_REG AIC_DCR; // Debug Control Register (Protect) + AT91_REG Reserved1[1]; // + AT91_REG AIC_FFER; // Fast Forcing Enable Register + AT91_REG AIC_FFDR; // Fast Forcing Disable Register + AT91_REG AIC_FFSR; // Fast Forcing Status Register +} AT91S_AIC, *AT91PS_AIC; + +// -------- AIC_SMR : (AIC Offset: 0x0) Control Register -------- +#define AT91C_AIC_PRIOR ((unsigned int) 0x7 << 0) // (AIC) Priority Level +#define AT91C_AIC_PRIOR_LOWEST ((unsigned int) 0x0) // (AIC) Lowest priority level +#define AT91C_AIC_PRIOR_HIGHEST ((unsigned int) 0x7) // (AIC) Highest priority level +#define AT91C_AIC_SRCTYPE ((unsigned int) 0x3 << 5) // (AIC) Interrupt Source Type +#define AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL ((unsigned int) 0x0 << 5) // (AIC) Internal Sources Code Label High-level Sensitive +#define AT91C_AIC_SRCTYPE_EXT_LOW_LEVEL ((unsigned int) 0x0 << 5) // (AIC) External Sources Code Label Low-level Sensitive +#define AT91C_AIC_SRCTYPE_INT_POSITIVE_EDGE ((unsigned int) 0x1 << 5) // (AIC) Internal Sources Code Label Positive Edge triggered +#define AT91C_AIC_SRCTYPE_EXT_NEGATIVE_EDGE ((unsigned int) 0x1 << 5) // (AIC) External Sources Code Label Negative Edge triggered +#define AT91C_AIC_SRCTYPE_HIGH_LEVEL ((unsigned int) 0x2 << 5) // (AIC) Internal Or External Sources Code Label High-level Sensitive +#define AT91C_AIC_SRCTYPE_POSITIVE_EDGE ((unsigned int) 0x3 << 5) // (AIC) Internal Or External Sources Code Label Positive Edge triggered +// -------- AIC_CISR : (AIC Offset: 0x114) AIC Core Interrupt Status Register -------- +#define AT91C_AIC_NFIQ ((unsigned int) 0x1 << 0) // (AIC) NFIQ Status +#define AT91C_AIC_NIRQ ((unsigned int) 0x1 << 1) // (AIC) NIRQ Status +// -------- AIC_DCR : (AIC Offset: 0x138) AIC Debug Control Register (Protect) -------- +#define AT91C_AIC_DCR_PROT ((unsigned int) 0x1 << 0) // (AIC) Protection Mode +#define AT91C_AIC_DCR_GMSK ((unsigned int) 0x1 << 1) // (AIC) General Mask + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Peripheral DMA Controller +// ***************************************************************************** +typedef struct _AT91S_PDC { + AT91_REG PDC_RPR; // Receive Pointer Register + AT91_REG PDC_RCR; // Receive Counter Register + AT91_REG PDC_TPR; // Transmit Pointer Register + AT91_REG PDC_TCR; // Transmit Counter Register + AT91_REG PDC_RNPR; // Receive Next Pointer Register + AT91_REG PDC_RNCR; // Receive Next Counter Register + AT91_REG PDC_TNPR; // Transmit Next Pointer Register + AT91_REG PDC_TNCR; // Transmit Next Counter Register + AT91_REG PDC_PTCR; // PDC Transfer Control Register + AT91_REG PDC_PTSR; // PDC Transfer Status Register +} AT91S_PDC, *AT91PS_PDC; + +// -------- PDC_PTCR : (PDC Offset: 0x20) PDC Transfer Control Register -------- +#define AT91C_PDC_RXTEN ((unsigned int) 0x1 << 0) // (PDC) Receiver Transfer Enable +#define AT91C_PDC_RXTDIS ((unsigned int) 0x1 << 1) // (PDC) Receiver Transfer Disable +#define AT91C_PDC_TXTEN ((unsigned int) 0x1 << 8) // (PDC) Transmitter Transfer Enable +#define AT91C_PDC_TXTDIS ((unsigned int) 0x1 << 9) // (PDC) Transmitter Transfer Disable +// -------- PDC_PTSR : (PDC Offset: 0x24) PDC Transfer Status Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Debug Unit +// ***************************************************************************** +typedef struct _AT91S_DBGU { + AT91_REG DBGU_CR; // Control Register + AT91_REG DBGU_MR; // Mode Register + AT91_REG DBGU_IER; // Interrupt Enable Register + AT91_REG DBGU_IDR; // Interrupt Disable Register + AT91_REG DBGU_IMR; // Interrupt Mask Register + AT91_REG DBGU_CSR; // Channel Status Register + AT91_REG DBGU_RHR; // Receiver Holding Register + AT91_REG DBGU_THR; // Transmitter Holding Register + AT91_REG DBGU_BRGR; // Baud Rate Generator Register + AT91_REG Reserved0[7]; // + AT91_REG DBGU_CIDR; // Chip ID Register + AT91_REG DBGU_EXID; // Chip ID Extension Register + AT91_REG DBGU_FNTR; // Force NTRST Register + AT91_REG Reserved1[45]; // + AT91_REG DBGU_RPR; // Receive Pointer Register + AT91_REG DBGU_RCR; // Receive Counter Register + AT91_REG DBGU_TPR; // Transmit Pointer Register + AT91_REG DBGU_TCR; // Transmit Counter Register + AT91_REG DBGU_RNPR; // Receive Next Pointer Register + AT91_REG DBGU_RNCR; // Receive Next Counter Register + AT91_REG DBGU_TNPR; // Transmit Next Pointer Register + AT91_REG DBGU_TNCR; // Transmit Next Counter Register + AT91_REG DBGU_PTCR; // PDC Transfer Control Register + AT91_REG DBGU_PTSR; // PDC Transfer Status Register +} AT91S_DBGU, *AT91PS_DBGU; + +// -------- DBGU_CR : (DBGU Offset: 0x0) Debug Unit Control Register -------- +#define AT91C_US_RSTRX ((unsigned int) 0x1 << 2) // (DBGU) Reset Receiver +#define AT91C_US_RSTTX ((unsigned int) 0x1 << 3) // (DBGU) Reset Transmitter +#define AT91C_US_RXEN ((unsigned int) 0x1 << 4) // (DBGU) Receiver Enable +#define AT91C_US_RXDIS ((unsigned int) 0x1 << 5) // (DBGU) Receiver Disable +#define AT91C_US_TXEN ((unsigned int) 0x1 << 6) // (DBGU) Transmitter Enable +#define AT91C_US_TXDIS ((unsigned int) 0x1 << 7) // (DBGU) Transmitter Disable +#define AT91C_US_RSTSTA ((unsigned int) 0x1 << 8) // (DBGU) Reset Status Bits +// -------- DBGU_MR : (DBGU Offset: 0x4) Debug Unit Mode Register -------- +#define AT91C_US_PAR ((unsigned int) 0x7 << 9) // (DBGU) Parity type +#define AT91C_US_PAR_EVEN ((unsigned int) 0x0 << 9) // (DBGU) Even Parity +#define AT91C_US_PAR_ODD ((unsigned int) 0x1 << 9) // (DBGU) Odd Parity +#define AT91C_US_PAR_SPACE ((unsigned int) 0x2 << 9) // (DBGU) Parity forced to 0 (Space) +#define AT91C_US_PAR_MARK ((unsigned int) 0x3 << 9) // (DBGU) Parity forced to 1 (Mark) +#define AT91C_US_PAR_NONE ((unsigned int) 0x4 << 9) // (DBGU) No Parity +#define AT91C_US_PAR_MULTI_DROP ((unsigned int) 0x6 << 9) // (DBGU) Multi-drop mode +#define AT91C_US_CHMODE ((unsigned int) 0x3 << 14) // (DBGU) Channel Mode +#define AT91C_US_CHMODE_NORMAL ((unsigned int) 0x0 << 14) // (DBGU) Normal Mode: The USART channel operates as an RX/TX USART. +#define AT91C_US_CHMODE_AUTO ((unsigned int) 0x1 << 14) // (DBGU) Automatic Echo: Receiver Data Input is connected to the TXD pin. +#define AT91C_US_CHMODE_LOCAL ((unsigned int) 0x2 << 14) // (DBGU) Local Loopback: Transmitter Output Signal is connected to Receiver Input Signal. +#define AT91C_US_CHMODE_REMOTE ((unsigned int) 0x3 << 14) // (DBGU) Remote Loopback: RXD pin is internally connected to TXD pin. +// -------- DBGU_IER : (DBGU Offset: 0x8) Debug Unit Interrupt Enable Register -------- +#define AT91C_US_RXRDY ((unsigned int) 0x1 << 0) // (DBGU) RXRDY Interrupt +#define AT91C_US_TXRDY ((unsigned int) 0x1 << 1) // (DBGU) TXRDY Interrupt +#define AT91C_US_ENDRX ((unsigned int) 0x1 << 3) // (DBGU) End of Receive Transfer Interrupt +#define AT91C_US_ENDTX ((unsigned int) 0x1 << 4) // (DBGU) End of Transmit Interrupt +#define AT91C_US_OVRE ((unsigned int) 0x1 << 5) // (DBGU) Overrun Interrupt +#define AT91C_US_FRAME ((unsigned int) 0x1 << 6) // (DBGU) Framing Error Interrupt +#define AT91C_US_PARE ((unsigned int) 0x1 << 7) // (DBGU) Parity Error Interrupt +#define AT91C_US_TXEMPTY ((unsigned int) 0x1 << 9) // (DBGU) TXEMPTY Interrupt +#define AT91C_US_TXBUFE ((unsigned int) 0x1 << 11) // (DBGU) TXBUFE Interrupt +#define AT91C_US_RXBUFF ((unsigned int) 0x1 << 12) // (DBGU) RXBUFF Interrupt +#define AT91C_US_COMM_TX ((unsigned int) 0x1 << 30) // (DBGU) COMM_TX Interrupt +#define AT91C_US_COMM_RX ((unsigned int) 0x1 << 31) // (DBGU) COMM_RX Interrupt +// -------- DBGU_IDR : (DBGU Offset: 0xc) Debug Unit Interrupt Disable Register -------- +// -------- DBGU_IMR : (DBGU Offset: 0x10) Debug Unit Interrupt Mask Register -------- +// -------- DBGU_CSR : (DBGU Offset: 0x14) Debug Unit Channel Status Register -------- +// -------- DBGU_FNTR : (DBGU Offset: 0x48) Debug Unit FORCE_NTRST Register -------- +#define AT91C_US_FORCE_NTRST ((unsigned int) 0x1 << 0) // (DBGU) Force NTRST in JTAG + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Parallel Input Output Controler +// ***************************************************************************** +typedef struct _AT91S_PIO { + AT91_REG PIO_PER; // PIO Enable Register + AT91_REG PIO_PDR; // PIO Disable Register + AT91_REG PIO_PSR; // PIO Status Register + AT91_REG Reserved0[1]; // + AT91_REG PIO_OER; // Output Enable Register + AT91_REG PIO_ODR; // Output Disable Registerr + AT91_REG PIO_OSR; // Output Status Register + AT91_REG Reserved1[1]; // + AT91_REG PIO_IFER; // Input Filter Enable Register + AT91_REG PIO_IFDR; // Input Filter Disable Register + AT91_REG PIO_IFSR; // Input Filter Status Register + AT91_REG Reserved2[1]; // + AT91_REG PIO_SODR; // Set Output Data Register + AT91_REG PIO_CODR; // Clear Output Data Register + AT91_REG PIO_ODSR; // Output Data Status Register + AT91_REG PIO_PDSR; // Pin Data Status Register + AT91_REG PIO_IER; // Interrupt Enable Register + AT91_REG PIO_IDR; // Interrupt Disable Register + AT91_REG PIO_IMR; // Interrupt Mask Register + AT91_REG PIO_ISR; // Interrupt Status Register + AT91_REG PIO_MDER; // Multi-driver Enable Register + AT91_REG PIO_MDDR; // Multi-driver Disable Register + AT91_REG PIO_MDSR; // Multi-driver Status Register + AT91_REG Reserved3[1]; // + AT91_REG PIO_PPUDR; // Pull-up Disable Register + AT91_REG PIO_PPUER; // Pull-up Enable Register + AT91_REG PIO_PPUSR; // Pull-up Status Register + AT91_REG Reserved4[1]; // + AT91_REG PIO_ASR; // Select A Register + AT91_REG PIO_BSR; // Select B Register + AT91_REG PIO_ABSR; // AB Select Status Register + AT91_REG Reserved5[9]; // + AT91_REG PIO_OWER; // Output Write Enable Register + AT91_REG PIO_OWDR; // Output Write Disable Register + AT91_REG PIO_OWSR; // Output Write Status Register +} AT91S_PIO, *AT91PS_PIO; + + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Clock Generator Controler +// ***************************************************************************** +typedef struct _AT91S_CKGR { + AT91_REG CKGR_MOR; // Main Oscillator Register + AT91_REG CKGR_MCFR; // Main Clock Frequency Register + AT91_REG Reserved0[1]; // + AT91_REG CKGR_PLLR; // PLL Register +} AT91S_CKGR, *AT91PS_CKGR; + +// -------- CKGR_MOR : (CKGR Offset: 0x0) Main Oscillator Register -------- +#define AT91C_CKGR_MOSCEN ((unsigned int) 0x1 << 0) // (CKGR) Main Oscillator Enable +#define AT91C_CKGR_OSCBYPASS ((unsigned int) 0x1 << 1) // (CKGR) Main Oscillator Bypass +#define AT91C_CKGR_OSCOUNT ((unsigned int) 0xFF << 8) // (CKGR) Main Oscillator Start-up Time +// -------- CKGR_MCFR : (CKGR Offset: 0x4) Main Clock Frequency Register -------- +#define AT91C_CKGR_MAINF ((unsigned int) 0xFFFF << 0) // (CKGR) Main Clock Frequency +#define AT91C_CKGR_MAINRDY ((unsigned int) 0x1 << 16) // (CKGR) Main Clock Ready +// -------- CKGR_PLLR : (CKGR Offset: 0xc) PLL B Register -------- +#define AT91C_CKGR_DIV ((unsigned int) 0xFF << 0) // (CKGR) Divider Selected +#define AT91C_CKGR_DIV_0 ((unsigned int) 0x0) // (CKGR) Divider output is 0 +#define AT91C_CKGR_DIV_BYPASS ((unsigned int) 0x1) // (CKGR) Divider is bypassed +#define AT91C_CKGR_PLLCOUNT ((unsigned int) 0x3F << 8) // (CKGR) PLL Counter +#define AT91C_CKGR_OUT ((unsigned int) 0x3 << 14) // (CKGR) PLL Output Frequency Range +#define AT91C_CKGR_OUT_0 ((unsigned int) 0x0 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_OUT_1 ((unsigned int) 0x1 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_OUT_2 ((unsigned int) 0x2 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_OUT_3 ((unsigned int) 0x3 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_MUL ((unsigned int) 0x7FF << 16) // (CKGR) PLL Multiplier +#define AT91C_CKGR_USBDIV ((unsigned int) 0x3 << 28) // (CKGR) Divider for USB Clocks +#define AT91C_CKGR_USBDIV_0 ((unsigned int) 0x0 << 28) // (CKGR) Divider output is PLL clock output +#define AT91C_CKGR_USBDIV_1 ((unsigned int) 0x1 << 28) // (CKGR) Divider output is PLL clock output divided by 2 +#define AT91C_CKGR_USBDIV_2 ((unsigned int) 0x2 << 28) // (CKGR) Divider output is PLL clock output divided by 4 + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Power Management Controler +// ***************************************************************************** +typedef struct _AT91S_PMC { + AT91_REG PMC_SCER; // System Clock Enable Register + AT91_REG PMC_SCDR; // System Clock Disable Register + AT91_REG PMC_SCSR; // System Clock Status Register + AT91_REG Reserved0[1]; // + AT91_REG PMC_PCER; // Peripheral Clock Enable Register + AT91_REG PMC_PCDR; // Peripheral Clock Disable Register + AT91_REG PMC_PCSR; // Peripheral Clock Status Register + AT91_REG Reserved1[1]; // + AT91_REG PMC_MOR; // Main Oscillator Register + AT91_REG PMC_MCFR; // Main Clock Frequency Register + AT91_REG Reserved2[1]; // + AT91_REG PMC_PLLR; // PLL Register + AT91_REG PMC_MCKR; // Master Clock Register + AT91_REG Reserved3[3]; // + AT91_REG PMC_PCKR[4]; // Programmable Clock Register + AT91_REG Reserved4[4]; // + AT91_REG PMC_IER; // Interrupt Enable Register + AT91_REG PMC_IDR; // Interrupt Disable Register + AT91_REG PMC_SR; // Status Register + AT91_REG PMC_IMR; // Interrupt Mask Register +} AT91S_PMC, *AT91PS_PMC; + +// -------- PMC_SCER : (PMC Offset: 0x0) System Clock Enable Register -------- +#define AT91C_PMC_PCK ((unsigned int) 0x1 << 0) // (PMC) Processor Clock +#define AT91C_PMC_UDP ((unsigned int) 0x1 << 7) // (PMC) USB Device Port Clock +#define AT91C_PMC_PCK0 ((unsigned int) 0x1 << 8) // (PMC) Programmable Clock Output +#define AT91C_PMC_PCK1 ((unsigned int) 0x1 << 9) // (PMC) Programmable Clock Output +#define AT91C_PMC_PCK2 ((unsigned int) 0x1 << 10) // (PMC) Programmable Clock Output +#define AT91C_PMC_PCK3 ((unsigned int) 0x1 << 11) // (PMC) Programmable Clock Output +// -------- PMC_SCDR : (PMC Offset: 0x4) System Clock Disable Register -------- +// -------- PMC_SCSR : (PMC Offset: 0x8) System Clock Status Register -------- +// -------- CKGR_MOR : (PMC Offset: 0x20) Main Oscillator Register -------- +// -------- CKGR_MCFR : (PMC Offset: 0x24) Main Clock Frequency Register -------- +// -------- CKGR_PLLR : (PMC Offset: 0x2c) PLL B Register -------- +// -------- PMC_MCKR : (PMC Offset: 0x30) Master Clock Register -------- +#define AT91C_PMC_CSS ((unsigned int) 0x3 << 0) // (PMC) Programmable Clock Selection +#define AT91C_PMC_CSS_SLOW_CLK ((unsigned int) 0x0) // (PMC) Slow Clock is selected +#define AT91C_PMC_CSS_MAIN_CLK ((unsigned int) 0x1) // (PMC) Main Clock is selected +#define AT91C_PMC_CSS_PLL_CLK ((unsigned int) 0x3) // (PMC) Clock from PLL is selected +#define AT91C_PMC_PRES ((unsigned int) 0x7 << 2) // (PMC) Programmable Clock Prescaler +#define AT91C_PMC_PRES_CLK ((unsigned int) 0x0 << 2) // (PMC) Selected clock +#define AT91C_PMC_PRES_CLK_2 ((unsigned int) 0x1 << 2) // (PMC) Selected clock divided by 2 +#define AT91C_PMC_PRES_CLK_4 ((unsigned int) 0x2 << 2) // (PMC) Selected clock divided by 4 +#define AT91C_PMC_PRES_CLK_8 ((unsigned int) 0x3 << 2) // (PMC) Selected clock divided by 8 +#define AT91C_PMC_PRES_CLK_16 ((unsigned int) 0x4 << 2) // (PMC) Selected clock divided by 16 +#define AT91C_PMC_PRES_CLK_32 ((unsigned int) 0x5 << 2) // (PMC) Selected clock divided by 32 +#define AT91C_PMC_PRES_CLK_64 ((unsigned int) 0x6 << 2) // (PMC) Selected clock divided by 64 +// -------- PMC_PCKR : (PMC Offset: 0x40) Programmable Clock Register -------- +// -------- PMC_IER : (PMC Offset: 0x60) PMC Interrupt Enable Register -------- +#define AT91C_PMC_MOSCS ((unsigned int) 0x1 << 0) // (PMC) MOSC Status/Enable/Disable/Mask +#define AT91C_PMC_LOCK ((unsigned int) 0x1 << 2) // (PMC) PLL Status/Enable/Disable/Mask +#define AT91C_PMC_MCKRDY ((unsigned int) 0x1 << 3) // (PMC) MCK_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK0RDY ((unsigned int) 0x1 << 8) // (PMC) PCK0_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK1RDY ((unsigned int) 0x1 << 9) // (PMC) PCK1_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK2RDY ((unsigned int) 0x1 << 10) // (PMC) PCK2_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK3RDY ((unsigned int) 0x1 << 11) // (PMC) PCK3_RDY Status/Enable/Disable/Mask +// -------- PMC_IDR : (PMC Offset: 0x64) PMC Interrupt Disable Register -------- +// -------- PMC_SR : (PMC Offset: 0x68) PMC Status Register -------- +// -------- PMC_IMR : (PMC Offset: 0x6c) PMC Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Reset Controller Interface +// ***************************************************************************** +typedef struct _AT91S_RSTC { + AT91_REG RSTC_RCR; // Reset Control Register + AT91_REG RSTC_RSR; // Reset Status Register + AT91_REG RSTC_RMR; // Reset Mode Register +} AT91S_RSTC, *AT91PS_RSTC; + +// -------- RSTC_RCR : (RSTC Offset: 0x0) Reset Control Register -------- +#define AT91C_RSTC_PROCRST ((unsigned int) 0x1 << 0) // (RSTC) Processor Reset +#define AT91C_RSTC_PERRST ((unsigned int) 0x1 << 2) // (RSTC) Peripheral Reset +#define AT91C_RSTC_EXTRST ((unsigned int) 0x1 << 3) // (RSTC) External Reset +#define AT91C_RSTC_KEY ((unsigned int) 0xFF << 24) // (RSTC) Password +// -------- RSTC_RSR : (RSTC Offset: 0x4) Reset Status Register -------- +#define AT91C_RSTC_URSTS ((unsigned int) 0x1 << 0) // (RSTC) User Reset Status +#define AT91C_RSTC_BODSTS ((unsigned int) 0x1 << 1) // (RSTC) Brownout Detection Status +#define AT91C_RSTC_RSTTYP ((unsigned int) 0x7 << 8) // (RSTC) Reset Type +#define AT91C_RSTC_RSTTYP_POWERUP ((unsigned int) 0x0 << 8) // (RSTC) Power-up Reset. VDDCORE rising. +#define AT91C_RSTC_RSTTYP_WAKEUP ((unsigned int) 0x1 << 8) // (RSTC) WakeUp Reset. VDDCORE rising. +#define AT91C_RSTC_RSTTYP_WATCHDOG ((unsigned int) 0x2 << 8) // (RSTC) Watchdog Reset. Watchdog overflow occured. +#define AT91C_RSTC_RSTTYP_SOFTWARE ((unsigned int) 0x3 << 8) // (RSTC) Software Reset. Processor reset required by the software. +#define AT91C_RSTC_RSTTYP_USER ((unsigned int) 0x4 << 8) // (RSTC) User Reset. NRST pin detected low. +#define AT91C_RSTC_RSTTYP_BROWNOUT ((unsigned int) 0x5 << 8) // (RSTC) Brownout Reset occured. +#define AT91C_RSTC_NRSTL ((unsigned int) 0x1 << 16) // (RSTC) NRST pin level +#define AT91C_RSTC_SRCMP ((unsigned int) 0x1 << 17) // (RSTC) Software Reset Command in Progress. +// -------- RSTC_RMR : (RSTC Offset: 0x8) Reset Mode Register -------- +#define AT91C_RSTC_URSTEN ((unsigned int) 0x1 << 0) // (RSTC) User Reset Enable +#define AT91C_RSTC_URSTIEN ((unsigned int) 0x1 << 4) // (RSTC) User Reset Interrupt Enable +#define AT91C_RSTC_ERSTL ((unsigned int) 0xF << 8) // (RSTC) User Reset Length +#define AT91C_RSTC_BODIEN ((unsigned int) 0x1 << 16) // (RSTC) Brownout Detection Interrupt Enable + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Real Time Timer Controller Interface +// ***************************************************************************** +typedef struct _AT91S_RTTC { + AT91_REG RTTC_RTMR; // Real-time Mode Register + AT91_REG RTTC_RTAR; // Real-time Alarm Register + AT91_REG RTTC_RTVR; // Real-time Value Register + AT91_REG RTTC_RTSR; // Real-time Status Register +} AT91S_RTTC, *AT91PS_RTTC; + +// -------- RTTC_RTMR : (RTTC Offset: 0x0) Real-time Mode Register -------- +#define AT91C_RTTC_RTPRES ((unsigned int) 0xFFFF << 0) // (RTTC) Real-time Timer Prescaler Value +#define AT91C_RTTC_ALMIEN ((unsigned int) 0x1 << 16) // (RTTC) Alarm Interrupt Enable +#define AT91C_RTTC_RTTINCIEN ((unsigned int) 0x1 << 17) // (RTTC) Real Time Timer Increment Interrupt Enable +#define AT91C_RTTC_RTTRST ((unsigned int) 0x1 << 18) // (RTTC) Real Time Timer Restart +// -------- RTTC_RTAR : (RTTC Offset: 0x4) Real-time Alarm Register -------- +#define AT91C_RTTC_ALMV ((unsigned int) 0x0 << 0) // (RTTC) Alarm Value +// -------- RTTC_RTVR : (RTTC Offset: 0x8) Current Real-time Value Register -------- +#define AT91C_RTTC_CRTV ((unsigned int) 0x0 << 0) // (RTTC) Current Real-time Value +// -------- RTTC_RTSR : (RTTC Offset: 0xc) Real-time Status Register -------- +#define AT91C_RTTC_ALMS ((unsigned int) 0x1 << 0) // (RTTC) Real-time Alarm Status +#define AT91C_RTTC_RTTINC ((unsigned int) 0x1 << 1) // (RTTC) Real-time Timer Increment + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Periodic Interval Timer Controller Interface +// ***************************************************************************** +typedef struct _AT91S_PITC { + AT91_REG PITC_PIMR; // Period Interval Mode Register + AT91_REG PITC_PISR; // Period Interval Status Register + AT91_REG PITC_PIVR; // Period Interval Value Register + AT91_REG PITC_PIIR; // Period Interval Image Register +} AT91S_PITC, *AT91PS_PITC; + +// -------- PITC_PIMR : (PITC Offset: 0x0) Periodic Interval Mode Register -------- +#define AT91C_PITC_PIV ((unsigned int) 0xFFFFF << 0) // (PITC) Periodic Interval Value +#define AT91C_PITC_PITEN ((unsigned int) 0x1 << 24) // (PITC) Periodic Interval Timer Enabled +#define AT91C_PITC_PITIEN ((unsigned int) 0x1 << 25) // (PITC) Periodic Interval Timer Interrupt Enable +// -------- PITC_PISR : (PITC Offset: 0x4) Periodic Interval Status Register -------- +#define AT91C_PITC_PITS ((unsigned int) 0x1 << 0) // (PITC) Periodic Interval Timer Status +// -------- PITC_PIVR : (PITC Offset: 0x8) Periodic Interval Value Register -------- +#define AT91C_PITC_CPIV ((unsigned int) 0xFFFFF << 0) // (PITC) Current Periodic Interval Value +#define AT91C_PITC_PICNT ((unsigned int) 0xFFF << 20) // (PITC) Periodic Interval Counter +// -------- PITC_PIIR : (PITC Offset: 0xc) Periodic Interval Image Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Watchdog Timer Controller Interface +// ***************************************************************************** +typedef struct _AT91S_WDTC { + AT91_REG WDTC_WDCR; // Watchdog Control Register + AT91_REG WDTC_WDMR; // Watchdog Mode Register + AT91_REG WDTC_WDSR; // Watchdog Status Register +} AT91S_WDTC, *AT91PS_WDTC; + +// -------- WDTC_WDCR : (WDTC Offset: 0x0) Periodic Interval Image Register -------- +#define AT91C_WDTC_WDRSTT ((unsigned int) 0x1 << 0) // (WDTC) Watchdog Restart +#define AT91C_WDTC_KEY ((unsigned int) 0xFF << 24) // (WDTC) Watchdog KEY Password +// -------- WDTC_WDMR : (WDTC Offset: 0x4) Watchdog Mode Register -------- +#define AT91C_WDTC_WDV ((unsigned int) 0xFFF << 0) // (WDTC) Watchdog Timer Restart +#define AT91C_WDTC_WDFIEN ((unsigned int) 0x1 << 12) // (WDTC) Watchdog Fault Interrupt Enable +#define AT91C_WDTC_WDRSTEN ((unsigned int) 0x1 << 13) // (WDTC) Watchdog Reset Enable +#define AT91C_WDTC_WDRPROC ((unsigned int) 0x1 << 14) // (WDTC) Watchdog Timer Restart +#define AT91C_WDTC_WDDIS ((unsigned int) 0x1 << 15) // (WDTC) Watchdog Disable +#define AT91C_WDTC_WDD ((unsigned int) 0xFFF << 16) // (WDTC) Watchdog Delta Value +#define AT91C_WDTC_WDDBGHLT ((unsigned int) 0x1 << 28) // (WDTC) Watchdog Debug Halt +#define AT91C_WDTC_WDIDLEHLT ((unsigned int) 0x1 << 29) // (WDTC) Watchdog Idle Halt +// -------- WDTC_WDSR : (WDTC Offset: 0x8) Watchdog Status Register -------- +#define AT91C_WDTC_WDUNF ((unsigned int) 0x1 << 0) // (WDTC) Watchdog Underflow +#define AT91C_WDTC_WDERR ((unsigned int) 0x1 << 1) // (WDTC) Watchdog Error + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Voltage Regulator Mode Controller Interface +// ***************************************************************************** +typedef struct _AT91S_VREG { + AT91_REG VREG_MR; // Voltage Regulator Mode Register +} AT91S_VREG, *AT91PS_VREG; + +// -------- VREG_MR : (VREG Offset: 0x0) Voltage Regulator Mode Register -------- +#define AT91C_VREG_PSTDBY ((unsigned int) 0x1 << 0) // (VREG) Voltage Regulator Power Standby Mode + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Memory Controller Interface +// ***************************************************************************** +typedef struct _AT91S_MC { + AT91_REG MC_RCR; // MC Remap Control Register + AT91_REG MC_ASR; // MC Abort Status Register + AT91_REG MC_AASR; // MC Abort Address Status Register + AT91_REG Reserved0[21]; // + AT91_REG MC_FMR; // MC Flash Mode Register + AT91_REG MC_FCR; // MC Flash Command Register + AT91_REG MC_FSR; // MC Flash Status Register +} AT91S_MC, *AT91PS_MC; + +// -------- MC_RCR : (MC Offset: 0x0) MC Remap Control Register -------- +#define AT91C_MC_RCB ((unsigned int) 0x1 << 0) // (MC) Remap Command Bit +// -------- MC_ASR : (MC Offset: 0x4) MC Abort Status Register -------- +#define AT91C_MC_UNDADD ((unsigned int) 0x1 << 0) // (MC) Undefined Addess Abort Status +#define AT91C_MC_MISADD ((unsigned int) 0x1 << 1) // (MC) Misaligned Addess Abort Status +#define AT91C_MC_ABTSZ ((unsigned int) 0x3 << 8) // (MC) Abort Size Status +#define AT91C_MC_ABTSZ_BYTE ((unsigned int) 0x0 << 8) // (MC) Byte +#define AT91C_MC_ABTSZ_HWORD ((unsigned int) 0x1 << 8) // (MC) Half-word +#define AT91C_MC_ABTSZ_WORD ((unsigned int) 0x2 << 8) // (MC) Word +#define AT91C_MC_ABTTYP ((unsigned int) 0x3 << 10) // (MC) Abort Type Status +#define AT91C_MC_ABTTYP_DATAR ((unsigned int) 0x0 << 10) // (MC) Data Read +#define AT91C_MC_ABTTYP_DATAW ((unsigned int) 0x1 << 10) // (MC) Data Write +#define AT91C_MC_ABTTYP_FETCH ((unsigned int) 0x2 << 10) // (MC) Code Fetch +#define AT91C_MC_MST0 ((unsigned int) 0x1 << 16) // (MC) Master 0 Abort Source +#define AT91C_MC_MST1 ((unsigned int) 0x1 << 17) // (MC) Master 1 Abort Source +#define AT91C_MC_SVMST0 ((unsigned int) 0x1 << 24) // (MC) Saved Master 0 Abort Source +#define AT91C_MC_SVMST1 ((unsigned int) 0x1 << 25) // (MC) Saved Master 1 Abort Source +// -------- MC_FMR : (MC Offset: 0x60) MC Flash Mode Register -------- +#define AT91C_MC_FRDY ((unsigned int) 0x1 << 0) // (MC) Flash Ready +#define AT91C_MC_LOCKE ((unsigned int) 0x1 << 2) // (MC) Lock Error +#define AT91C_MC_PROGE ((unsigned int) 0x1 << 3) // (MC) Programming Error +#define AT91C_MC_NEBP ((unsigned int) 0x1 << 7) // (MC) No Erase Before Programming +#define AT91C_MC_FWS ((unsigned int) 0x3 << 8) // (MC) Flash Wait State +#define AT91C_MC_FWS_0FWS ((unsigned int) 0x0 << 8) // (MC) 1 cycle for Read, 2 for Write operations +#define AT91C_MC_FWS_1FWS ((unsigned int) 0x1 << 8) // (MC) 2 cycles for Read, 3 for Write operations +#define AT91C_MC_FWS_2FWS ((unsigned int) 0x2 << 8) // (MC) 3 cycles for Read, 4 for Write operations +#define AT91C_MC_FWS_3FWS ((unsigned int) 0x3 << 8) // (MC) 4 cycles for Read, 4 for Write operations +#define AT91C_MC_FMCN ((unsigned int) 0xFF << 16) // (MC) Flash Microsecond Cycle Number +// -------- MC_FCR : (MC Offset: 0x64) MC Flash Command Register -------- +#define AT91C_MC_FCMD ((unsigned int) 0xF << 0) // (MC) Flash Command +#define AT91C_MC_FCMD_START_PROG ((unsigned int) 0x1) // (MC) Starts the programming of th epage specified by PAGEN. +#define AT91C_MC_FCMD_LOCK ((unsigned int) 0x2) // (MC) Starts a lock sequence of the sector defined by the bits 4 to 7 of the field PAGEN. +#define AT91C_MC_FCMD_PROG_AND_LOCK ((unsigned int) 0x3) // (MC) The lock sequence automatically happens after the programming sequence is completed. +#define AT91C_MC_FCMD_UNLOCK ((unsigned int) 0x4) // (MC) Starts an unlock sequence of the sector defined by the bits 4 to 7 of the field PAGEN. +#define AT91C_MC_FCMD_ERASE_ALL ((unsigned int) 0x8) // (MC) Starts the erase of the entire flash.If at least a page is locked, the command is cancelled. +#define AT91C_MC_FCMD_SET_GP_NVM ((unsigned int) 0xB) // (MC) Set General Purpose NVM bits. +#define AT91C_MC_FCMD_CLR_GP_NVM ((unsigned int) 0xD) // (MC) Clear General Purpose NVM bits. +#define AT91C_MC_FCMD_SET_SECURITY ((unsigned int) 0xF) // (MC) Set Security Bit. +#define AT91C_MC_PAGEN ((unsigned int) 0x3FF << 8) // (MC) Page Number +#define AT91C_MC_KEY ((unsigned int) 0xFF << 24) // (MC) Writing Protect Key +// -------- MC_FSR : (MC Offset: 0x68) MC Flash Command Register -------- +#define AT91C_MC_SECURITY ((unsigned int) 0x1 << 4) // (MC) Security Bit Status +#define AT91C_MC_GPNVM0 ((unsigned int) 0x1 << 8) // (MC) Sector 0 Lock Status +#define AT91C_MC_GPNVM1 ((unsigned int) 0x1 << 9) // (MC) Sector 1 Lock Status +#define AT91C_MC_GPNVM2 ((unsigned int) 0x1 << 10) // (MC) Sector 2 Lock Status +#define AT91C_MC_GPNVM3 ((unsigned int) 0x1 << 11) // (MC) Sector 3 Lock Status +#define AT91C_MC_GPNVM4 ((unsigned int) 0x1 << 12) // (MC) Sector 4 Lock Status +#define AT91C_MC_GPNVM5 ((unsigned int) 0x1 << 13) // (MC) Sector 5 Lock Status +#define AT91C_MC_GPNVM6 ((unsigned int) 0x1 << 14) // (MC) Sector 6 Lock Status +#define AT91C_MC_GPNVM7 ((unsigned int) 0x1 << 15) // (MC) Sector 7 Lock Status +#define AT91C_MC_LOCKS0 ((unsigned int) 0x1 << 16) // (MC) Sector 0 Lock Status +#define AT91C_MC_LOCKS1 ((unsigned int) 0x1 << 17) // (MC) Sector 1 Lock Status +#define AT91C_MC_LOCKS2 ((unsigned int) 0x1 << 18) // (MC) Sector 2 Lock Status +#define AT91C_MC_LOCKS3 ((unsigned int) 0x1 << 19) // (MC) Sector 3 Lock Status +#define AT91C_MC_LOCKS4 ((unsigned int) 0x1 << 20) // (MC) Sector 4 Lock Status +#define AT91C_MC_LOCKS5 ((unsigned int) 0x1 << 21) // (MC) Sector 5 Lock Status +#define AT91C_MC_LOCKS6 ((unsigned int) 0x1 << 22) // (MC) Sector 6 Lock Status +#define AT91C_MC_LOCKS7 ((unsigned int) 0x1 << 23) // (MC) Sector 7 Lock Status +#define AT91C_MC_LOCKS8 ((unsigned int) 0x1 << 24) // (MC) Sector 8 Lock Status +#define AT91C_MC_LOCKS9 ((unsigned int) 0x1 << 25) // (MC) Sector 9 Lock Status +#define AT91C_MC_LOCKS10 ((unsigned int) 0x1 << 26) // (MC) Sector 10 Lock Status +#define AT91C_MC_LOCKS11 ((unsigned int) 0x1 << 27) // (MC) Sector 11 Lock Status +#define AT91C_MC_LOCKS12 ((unsigned int) 0x1 << 28) // (MC) Sector 12 Lock Status +#define AT91C_MC_LOCKS13 ((unsigned int) 0x1 << 29) // (MC) Sector 13 Lock Status +#define AT91C_MC_LOCKS14 ((unsigned int) 0x1 << 30) // (MC) Sector 14 Lock Status +#define AT91C_MC_LOCKS15 ((unsigned int) 0x1 << 31) // (MC) Sector 15 Lock Status + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Serial Parallel Interface +// ***************************************************************************** +typedef struct _AT91S_SPI { + AT91_REG SPI_CR; // Control Register + AT91_REG SPI_MR; // Mode Register + AT91_REG SPI_RDR; // Receive Data Register + AT91_REG SPI_TDR; // Transmit Data Register + AT91_REG SPI_SR; // Status Register + AT91_REG SPI_IER; // Interrupt Enable Register + AT91_REG SPI_IDR; // Interrupt Disable Register + AT91_REG SPI_IMR; // Interrupt Mask Register + AT91_REG Reserved0[4]; // + AT91_REG SPI_CSR[4]; // Chip Select Register + AT91_REG Reserved1[48]; // + AT91_REG SPI_RPR; // Receive Pointer Register + AT91_REG SPI_RCR; // Receive Counter Register + AT91_REG SPI_TPR; // Transmit Pointer Register + AT91_REG SPI_TCR; // Transmit Counter Register + AT91_REG SPI_RNPR; // Receive Next Pointer Register + AT91_REG SPI_RNCR; // Receive Next Counter Register + AT91_REG SPI_TNPR; // Transmit Next Pointer Register + AT91_REG SPI_TNCR; // Transmit Next Counter Register + AT91_REG SPI_PTCR; // PDC Transfer Control Register + AT91_REG SPI_PTSR; // PDC Transfer Status Register +} AT91S_SPI, *AT91PS_SPI; + +// -------- SPI_CR : (SPI Offset: 0x0) SPI Control Register -------- +#define AT91C_SPI_SPIEN ((unsigned int) 0x1 << 0) // (SPI) SPI Enable +#define AT91C_SPI_SPIDIS ((unsigned int) 0x1 << 1) // (SPI) SPI Disable +#define AT91C_SPI_SWRST ((unsigned int) 0x1 << 7) // (SPI) SPI Software reset +#define AT91C_SPI_LASTXFER ((unsigned int) 0x1 << 24) // (SPI) SPI Last Transfer +// -------- SPI_MR : (SPI Offset: 0x4) SPI Mode Register -------- +#define AT91C_SPI_MSTR ((unsigned int) 0x1 << 0) // (SPI) Master/Slave Mode +#define AT91C_SPI_PS ((unsigned int) 0x1 << 1) // (SPI) Peripheral Select +#define AT91C_SPI_PS_FIXED ((unsigned int) 0x0 << 1) // (SPI) Fixed Peripheral Select +#define AT91C_SPI_PS_VARIABLE ((unsigned int) 0x1 << 1) // (SPI) Variable Peripheral Select +#define AT91C_SPI_PCSDEC ((unsigned int) 0x1 << 2) // (SPI) Chip Select Decode +#define AT91C_SPI_FDIV ((unsigned int) 0x1 << 3) // (SPI) Clock Selection +#define AT91C_SPI_MODFDIS ((unsigned int) 0x1 << 4) // (SPI) Mode Fault Detection +#define AT91C_SPI_LLB ((unsigned int) 0x1 << 7) // (SPI) Clock Selection +#define AT91C_SPI_PCS ((unsigned int) 0xF << 16) // (SPI) Peripheral Chip Select +#define AT91C_SPI_DLYBCS ((unsigned int) 0xFF << 24) // (SPI) Delay Between Chip Selects +// -------- SPI_RDR : (SPI Offset: 0x8) Receive Data Register -------- +#define AT91C_SPI_RD ((unsigned int) 0xFFFF << 0) // (SPI) Receive Data +#define AT91C_SPI_RPCS ((unsigned int) 0xF << 16) // (SPI) Peripheral Chip Select Status +// -------- SPI_TDR : (SPI Offset: 0xc) Transmit Data Register -------- +#define AT91C_SPI_TD ((unsigned int) 0xFFFF << 0) // (SPI) Transmit Data +#define AT91C_SPI_TPCS ((unsigned int) 0xF << 16) // (SPI) Peripheral Chip Select Status +// -------- SPI_SR : (SPI Offset: 0x10) Status Register -------- +#define AT91C_SPI_RDRF ((unsigned int) 0x1 << 0) // (SPI) Receive Data Register Full +#define AT91C_SPI_TDRE ((unsigned int) 0x1 << 1) // (SPI) Transmit Data Register Empty +#define AT91C_SPI_MODF ((unsigned int) 0x1 << 2) // (SPI) Mode Fault Error +#define AT91C_SPI_OVRES ((unsigned int) 0x1 << 3) // (SPI) Overrun Error Status +#define AT91C_SPI_ENDRX ((unsigned int) 0x1 << 4) // (SPI) End of Receiver Transfer +#define AT91C_SPI_ENDTX ((unsigned int) 0x1 << 5) // (SPI) End of Receiver Transfer +#define AT91C_SPI_RXBUFF ((unsigned int) 0x1 << 6) // (SPI) RXBUFF Interrupt +#define AT91C_SPI_TXBUFE ((unsigned int) 0x1 << 7) // (SPI) TXBUFE Interrupt +#define AT91C_SPI_NSSR ((unsigned int) 0x1 << 8) // (SPI) NSSR Interrupt +#define AT91C_SPI_TXEMPTY ((unsigned int) 0x1 << 9) // (SPI) TXEMPTY Interrupt +#define AT91C_SPI_SPIENS ((unsigned int) 0x1 << 16) // (SPI) Enable Status +// -------- SPI_IER : (SPI Offset: 0x14) Interrupt Enable Register -------- +// -------- SPI_IDR : (SPI Offset: 0x18) Interrupt Disable Register -------- +// -------- SPI_IMR : (SPI Offset: 0x1c) Interrupt Mask Register -------- +// -------- SPI_CSR : (SPI Offset: 0x30) Chip Select Register -------- +#define AT91C_SPI_CPOL ((unsigned int) 0x1 << 0) // (SPI) Clock Polarity +#define AT91C_SPI_NCPHA ((unsigned int) 0x1 << 1) // (SPI) Clock Phase +#define AT91C_SPI_CSAAT ((unsigned int) 0x1 << 3) // (SPI) Chip Select Active After Transfer +#define AT91C_SPI_BITS ((unsigned int) 0xF << 4) // (SPI) Bits Per Transfer +#define AT91C_SPI_BITS_8 ((unsigned int) 0x0 << 4) // (SPI) 8 Bits Per transfer +#define AT91C_SPI_BITS_9 ((unsigned int) 0x1 << 4) // (SPI) 9 Bits Per transfer +#define AT91C_SPI_BITS_10 ((unsigned int) 0x2 << 4) // (SPI) 10 Bits Per transfer +#define AT91C_SPI_BITS_11 ((unsigned int) 0x3 << 4) // (SPI) 11 Bits Per transfer +#define AT91C_SPI_BITS_12 ((unsigned int) 0x4 << 4) // (SPI) 12 Bits Per transfer +#define AT91C_SPI_BITS_13 ((unsigned int) 0x5 << 4) // (SPI) 13 Bits Per transfer +#define AT91C_SPI_BITS_14 ((unsigned int) 0x6 << 4) // (SPI) 14 Bits Per transfer +#define AT91C_SPI_BITS_15 ((unsigned int) 0x7 << 4) // (SPI) 15 Bits Per transfer +#define AT91C_SPI_BITS_16 ((unsigned int) 0x8 << 4) // (SPI) 16 Bits Per transfer +#define AT91C_SPI_SCBR ((unsigned int) 0xFF << 8) // (SPI) Serial Clock Baud Rate +#define AT91C_SPI_DLYBS ((unsigned int) 0xFF << 16) // (SPI) Delay Before SPCK +#define AT91C_SPI_DLYBCT ((unsigned int) 0xFF << 24) // (SPI) Delay Between Consecutive Transfers + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Usart +// ***************************************************************************** +typedef struct _AT91S_USART { + AT91_REG US_CR; // Control Register + AT91_REG US_MR; // Mode Register + AT91_REG US_IER; // Interrupt Enable Register + AT91_REG US_IDR; // Interrupt Disable Register + AT91_REG US_IMR; // Interrupt Mask Register + AT91_REG US_CSR; // Channel Status Register + AT91_REG US_RHR; // Receiver Holding Register + AT91_REG US_THR; // Transmitter Holding Register + AT91_REG US_BRGR; // Baud Rate Generator Register + AT91_REG US_RTOR; // Receiver Time-out Register + AT91_REG US_TTGR; // Transmitter Time-guard Register + AT91_REG Reserved0[5]; // + AT91_REG US_FIDI; // FI_DI_Ratio Register + AT91_REG US_NER; // Nb Errors Register + AT91_REG Reserved1[1]; // + AT91_REG US_IF; // IRDA_FILTER Register + AT91_REG Reserved2[44]; // + AT91_REG US_RPR; // Receive Pointer Register + AT91_REG US_RCR; // Receive Counter Register + AT91_REG US_TPR; // Transmit Pointer Register + AT91_REG US_TCR; // Transmit Counter Register + AT91_REG US_RNPR; // Receive Next Pointer Register + AT91_REG US_RNCR; // Receive Next Counter Register + AT91_REG US_TNPR; // Transmit Next Pointer Register + AT91_REG US_TNCR; // Transmit Next Counter Register + AT91_REG US_PTCR; // PDC Transfer Control Register + AT91_REG US_PTSR; // PDC Transfer Status Register +} AT91S_USART, *AT91PS_USART; + +// -------- US_CR : (USART Offset: 0x0) Debug Unit Control Register -------- +#define AT91C_US_STTBRK ((unsigned int) 0x1 << 9) // (USART) Start Break +#define AT91C_US_STPBRK ((unsigned int) 0x1 << 10) // (USART) Stop Break +#define AT91C_US_STTTO ((unsigned int) 0x1 << 11) // (USART) Start Time-out +#define AT91C_US_SENDA ((unsigned int) 0x1 << 12) // (USART) Send Address +#define AT91C_US_RSTIT ((unsigned int) 0x1 << 13) // (USART) Reset Iterations +#define AT91C_US_RSTNACK ((unsigned int) 0x1 << 14) // (USART) Reset Non Acknowledge +#define AT91C_US_RETTO ((unsigned int) 0x1 << 15) // (USART) Rearm Time-out +#define AT91C_US_DTREN ((unsigned int) 0x1 << 16) // (USART) Data Terminal ready Enable +#define AT91C_US_DTRDIS ((unsigned int) 0x1 << 17) // (USART) Data Terminal ready Disable +#define AT91C_US_RTSEN ((unsigned int) 0x1 << 18) // (USART) Request to Send enable +#define AT91C_US_RTSDIS ((unsigned int) 0x1 << 19) // (USART) Request to Send Disable +// -------- US_MR : (USART Offset: 0x4) Debug Unit Mode Register -------- +#define AT91C_US_USMODE ((unsigned int) 0xF << 0) // (USART) Usart mode +#define AT91C_US_USMODE_NORMAL ((unsigned int) 0x0) // (USART) Normal +#define AT91C_US_USMODE_RS485 ((unsigned int) 0x1) // (USART) RS485 +#define AT91C_US_USMODE_HWHSH ((unsigned int) 0x2) // (USART) Hardware Handshaking +#define AT91C_US_USMODE_MODEM ((unsigned int) 0x3) // (USART) Modem +#define AT91C_US_USMODE_ISO7816_0 ((unsigned int) 0x4) // (USART) ISO7816 protocol: T = 0 +#define AT91C_US_USMODE_ISO7816_1 ((unsigned int) 0x6) // (USART) ISO7816 protocol: T = 1 +#define AT91C_US_USMODE_IRDA ((unsigned int) 0x8) // (USART) IrDA +#define AT91C_US_USMODE_SWHSH ((unsigned int) 0xC) // (USART) Software Handshaking +#define AT91C_US_CLKS ((unsigned int) 0x3 << 4) // (USART) Clock Selection (Baud Rate generator Input Clock +#define AT91C_US_CLKS_CLOCK ((unsigned int) 0x0 << 4) // (USART) Clock +#define AT91C_US_CLKS_FDIV1 ((unsigned int) 0x1 << 4) // (USART) fdiv1 +#define AT91C_US_CLKS_SLOW ((unsigned int) 0x2 << 4) // (USART) slow_clock (ARM) +#define AT91C_US_CLKS_EXT ((unsigned int) 0x3 << 4) // (USART) External (SCK) +#define AT91C_US_CHRL ((unsigned int) 0x3 << 6) // (USART) Clock Selection (Baud Rate generator Input Clock +#define AT91C_US_CHRL_5_BITS ((unsigned int) 0x0 << 6) // (USART) Character Length: 5 bits +#define AT91C_US_CHRL_6_BITS ((unsigned int) 0x1 << 6) // (USART) Character Length: 6 bits +#define AT91C_US_CHRL_7_BITS ((unsigned int) 0x2 << 6) // (USART) Character Length: 7 bits +#define AT91C_US_CHRL_8_BITS ((unsigned int) 0x3 << 6) // (USART) Character Length: 8 bits +#define AT91C_US_SYNC ((unsigned int) 0x1 << 8) // (USART) Synchronous Mode Select +#define AT91C_US_NBSTOP ((unsigned int) 0x3 << 12) // (USART) Number of Stop bits +#define AT91C_US_NBSTOP_1_BIT ((unsigned int) 0x0 << 12) // (USART) 1 stop bit +#define AT91C_US_NBSTOP_15_BIT ((unsigned int) 0x1 << 12) // (USART) Asynchronous (SYNC=0) 2 stop bits Synchronous (SYNC=1) 2 stop bits +#define AT91C_US_NBSTOP_2_BIT ((unsigned int) 0x2 << 12) // (USART) 2 stop bits +#define AT91C_US_MSBF ((unsigned int) 0x1 << 16) // (USART) Bit Order +#define AT91C_US_MODE9 ((unsigned int) 0x1 << 17) // (USART) 9-bit Character length +#define AT91C_US_CKLO ((unsigned int) 0x1 << 18) // (USART) Clock Output Select +#define AT91C_US_OVER ((unsigned int) 0x1 << 19) // (USART) Over Sampling Mode +#define AT91C_US_INACK ((unsigned int) 0x1 << 20) // (USART) Inhibit Non Acknowledge +#define AT91C_US_DSNACK ((unsigned int) 0x1 << 21) // (USART) Disable Successive NACK +#define AT91C_US_MAX_ITER ((unsigned int) 0x1 << 24) // (USART) Number of Repetitions +#define AT91C_US_FILTER ((unsigned int) 0x1 << 28) // (USART) Receive Line Filter +// -------- US_IER : (USART Offset: 0x8) Debug Unit Interrupt Enable Register -------- +#define AT91C_US_RXBRK ((unsigned int) 0x1 << 2) // (USART) Break Received/End of Break +#define AT91C_US_TIMEOUT ((unsigned int) 0x1 << 8) // (USART) Receiver Time-out +#define AT91C_US_ITERATION ((unsigned int) 0x1 << 10) // (USART) Max number of Repetitions Reached +#define AT91C_US_NACK ((unsigned int) 0x1 << 13) // (USART) Non Acknowledge +#define AT91C_US_RIIC ((unsigned int) 0x1 << 16) // (USART) Ring INdicator Input Change Flag +#define AT91C_US_DSRIC ((unsigned int) 0x1 << 17) // (USART) Data Set Ready Input Change Flag +#define AT91C_US_DCDIC ((unsigned int) 0x1 << 18) // (USART) Data Carrier Flag +#define AT91C_US_CTSIC ((unsigned int) 0x1 << 19) // (USART) Clear To Send Input Change Flag +// -------- US_IDR : (USART Offset: 0xc) Debug Unit Interrupt Disable Register -------- +// -------- US_IMR : (USART Offset: 0x10) Debug Unit Interrupt Mask Register -------- +// -------- US_CSR : (USART Offset: 0x14) Debug Unit Channel Status Register -------- +#define AT91C_US_RI ((unsigned int) 0x1 << 20) // (USART) Image of RI Input +#define AT91C_US_DSR ((unsigned int) 0x1 << 21) // (USART) Image of DSR Input +#define AT91C_US_DCD ((unsigned int) 0x1 << 22) // (USART) Image of DCD Input +#define AT91C_US_CTS ((unsigned int) 0x1 << 23) // (USART) Image of CTS Input + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Synchronous Serial Controller Interface +// ***************************************************************************** +typedef struct _AT91S_SSC { + AT91_REG SSC_CR; // Control Register + AT91_REG SSC_CMR; // Clock Mode Register + AT91_REG Reserved0[2]; // + AT91_REG SSC_RCMR; // Receive Clock ModeRegister + AT91_REG SSC_RFMR; // Receive Frame Mode Register + AT91_REG SSC_TCMR; // Transmit Clock Mode Register + AT91_REG SSC_TFMR; // Transmit Frame Mode Register + AT91_REG SSC_RHR; // Receive Holding Register + AT91_REG SSC_THR; // Transmit Holding Register + AT91_REG Reserved1[2]; // + AT91_REG SSC_RSHR; // Receive Sync Holding Register + AT91_REG SSC_TSHR; // Transmit Sync Holding Register + AT91_REG Reserved2[2]; // + AT91_REG SSC_SR; // Status Register + AT91_REG SSC_IER; // Interrupt Enable Register + AT91_REG SSC_IDR; // Interrupt Disable Register + AT91_REG SSC_IMR; // Interrupt Mask Register + AT91_REG Reserved3[44]; // + AT91_REG SSC_RPR; // Receive Pointer Register + AT91_REG SSC_RCR; // Receive Counter Register + AT91_REG SSC_TPR; // Transmit Pointer Register + AT91_REG SSC_TCR; // Transmit Counter Register + AT91_REG SSC_RNPR; // Receive Next Pointer Register + AT91_REG SSC_RNCR; // Receive Next Counter Register + AT91_REG SSC_TNPR; // Transmit Next Pointer Register + AT91_REG SSC_TNCR; // Transmit Next Counter Register + AT91_REG SSC_PTCR; // PDC Transfer Control Register + AT91_REG SSC_PTSR; // PDC Transfer Status Register +} AT91S_SSC, *AT91PS_SSC; + +// -------- SSC_CR : (SSC Offset: 0x0) SSC Control Register -------- +#define AT91C_SSC_RXEN ((unsigned int) 0x1 << 0) // (SSC) Receive Enable +#define AT91C_SSC_RXDIS ((unsigned int) 0x1 << 1) // (SSC) Receive Disable +#define AT91C_SSC_TXEN ((unsigned int) 0x1 << 8) // (SSC) Transmit Enable +#define AT91C_SSC_TXDIS ((unsigned int) 0x1 << 9) // (SSC) Transmit Disable +#define AT91C_SSC_SWRST ((unsigned int) 0x1 << 15) // (SSC) Software Reset +// -------- SSC_RCMR : (SSC Offset: 0x10) SSC Receive Clock Mode Register -------- +#define AT91C_SSC_CKS ((unsigned int) 0x3 << 0) // (SSC) Receive/Transmit Clock Selection +#define AT91C_SSC_CKS_DIV ((unsigned int) 0x0) // (SSC) Divided Clock +#define AT91C_SSC_CKS_TK ((unsigned int) 0x1) // (SSC) TK Clock signal +#define AT91C_SSC_CKS_RK ((unsigned int) 0x2) // (SSC) RK pin +#define AT91C_SSC_CKO ((unsigned int) 0x7 << 2) // (SSC) Receive/Transmit Clock Output Mode Selection +#define AT91C_SSC_CKO_NONE ((unsigned int) 0x0 << 2) // (SSC) Receive/Transmit Clock Output Mode: None RK pin: Input-only +#define AT91C_SSC_CKO_CONTINOUS ((unsigned int) 0x1 << 2) // (SSC) Continuous Receive/Transmit Clock RK pin: Output +#define AT91C_SSC_CKO_DATA_TX ((unsigned int) 0x2 << 2) // (SSC) Receive/Transmit Clock only during data transfers RK pin: Output +#define AT91C_SSC_CKI ((unsigned int) 0x1 << 5) // (SSC) Receive/Transmit Clock Inversion +#define AT91C_SSC_CKG ((unsigned int) 0x3 << 6) // (SSC) Receive/Transmit Clock Gating Selection +#define AT91C_SSC_CKG_NONE ((unsigned int) 0x0 << 6) // (SSC) Receive/Transmit Clock Gating: None, continuous clock +#define AT91C_SSC_CKG_LOW ((unsigned int) 0x1 << 6) // (SSC) Receive/Transmit Clock enabled only if RF Low +#define AT91C_SSC_CKG_HIGH ((unsigned int) 0x2 << 6) // (SSC) Receive/Transmit Clock enabled only if RF High +#define AT91C_SSC_START ((unsigned int) 0xF << 8) // (SSC) Receive/Transmit Start Selection +#define AT91C_SSC_START_CONTINOUS ((unsigned int) 0x0 << 8) // (SSC) Continuous, as soon as the receiver is enabled, and immediately after the end of transfer of the previous data. +#define AT91C_SSC_START_TX ((unsigned int) 0x1 << 8) // (SSC) Transmit/Receive start +#define AT91C_SSC_START_LOW_RF ((unsigned int) 0x2 << 8) // (SSC) Detection of a low level on RF input +#define AT91C_SSC_START_HIGH_RF ((unsigned int) 0x3 << 8) // (SSC) Detection of a high level on RF input +#define AT91C_SSC_START_FALL_RF ((unsigned int) 0x4 << 8) // (SSC) Detection of a falling edge on RF input +#define AT91C_SSC_START_RISE_RF ((unsigned int) 0x5 << 8) // (SSC) Detection of a rising edge on RF input +#define AT91C_SSC_START_LEVEL_RF ((unsigned int) 0x6 << 8) // (SSC) Detection of any level change on RF input +#define AT91C_SSC_START_EDGE_RF ((unsigned int) 0x7 << 8) // (SSC) Detection of any edge on RF input +#define AT91C_SSC_START_0 ((unsigned int) 0x8 << 8) // (SSC) Compare 0 +#define AT91C_SSC_STOP ((unsigned int) 0x1 << 12) // (SSC) Receive Stop Selection +#define AT91C_SSC_STTDLY ((unsigned int) 0xFF << 16) // (SSC) Receive/Transmit Start Delay +#define AT91C_SSC_PERIOD ((unsigned int) 0xFF << 24) // (SSC) Receive/Transmit Period Divider Selection +// -------- SSC_RFMR : (SSC Offset: 0x14) SSC Receive Frame Mode Register -------- +#define AT91C_SSC_DATLEN ((unsigned int) 0x1F << 0) // (SSC) Data Length +#define AT91C_SSC_LOOP ((unsigned int) 0x1 << 5) // (SSC) Loop Mode +#define AT91C_SSC_MSBF ((unsigned int) 0x1 << 7) // (SSC) Most Significant Bit First +#define AT91C_SSC_DATNB ((unsigned int) 0xF << 8) // (SSC) Data Number per Frame +#define AT91C_SSC_FSLEN ((unsigned int) 0xF << 16) // (SSC) Receive/Transmit Frame Sync length +#define AT91C_SSC_FSOS ((unsigned int) 0x7 << 20) // (SSC) Receive/Transmit Frame Sync Output Selection +#define AT91C_SSC_FSOS_NONE ((unsigned int) 0x0 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: None RK pin Input-only +#define AT91C_SSC_FSOS_NEGATIVE ((unsigned int) 0x1 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Negative Pulse +#define AT91C_SSC_FSOS_POSITIVE ((unsigned int) 0x2 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Positive Pulse +#define AT91C_SSC_FSOS_LOW ((unsigned int) 0x3 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Driver Low during data transfer +#define AT91C_SSC_FSOS_HIGH ((unsigned int) 0x4 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Driver High during data transfer +#define AT91C_SSC_FSOS_TOGGLE ((unsigned int) 0x5 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Toggling at each start of data transfer +#define AT91C_SSC_FSEDGE ((unsigned int) 0x1 << 24) // (SSC) Frame Sync Edge Detection +// -------- SSC_TCMR : (SSC Offset: 0x18) SSC Transmit Clock Mode Register -------- +// -------- SSC_TFMR : (SSC Offset: 0x1c) SSC Transmit Frame Mode Register -------- +#define AT91C_SSC_DATDEF ((unsigned int) 0x1 << 5) // (SSC) Data Default Value +#define AT91C_SSC_FSDEN ((unsigned int) 0x1 << 23) // (SSC) Frame Sync Data Enable +// -------- SSC_SR : (SSC Offset: 0x40) SSC Status Register -------- +#define AT91C_SSC_TXRDY ((unsigned int) 0x1 << 0) // (SSC) Transmit Ready +#define AT91C_SSC_TXEMPTY ((unsigned int) 0x1 << 1) // (SSC) Transmit Empty +#define AT91C_SSC_ENDTX ((unsigned int) 0x1 << 2) // (SSC) End Of Transmission +#define AT91C_SSC_TXBUFE ((unsigned int) 0x1 << 3) // (SSC) Transmit Buffer Empty +#define AT91C_SSC_RXRDY ((unsigned int) 0x1 << 4) // (SSC) Receive Ready +#define AT91C_SSC_OVRUN ((unsigned int) 0x1 << 5) // (SSC) Receive Overrun +#define AT91C_SSC_ENDRX ((unsigned int) 0x1 << 6) // (SSC) End of Reception +#define AT91C_SSC_RXBUFF ((unsigned int) 0x1 << 7) // (SSC) Receive Buffer Full +#define AT91C_SSC_CP0 ((unsigned int) 0x1 << 8) // (SSC) Compare 0 +#define AT91C_SSC_CP1 ((unsigned int) 0x1 << 9) // (SSC) Compare 1 +#define AT91C_SSC_TXSYN ((unsigned int) 0x1 << 10) // (SSC) Transmit Sync +#define AT91C_SSC_RXSYN ((unsigned int) 0x1 << 11) // (SSC) Receive Sync +#define AT91C_SSC_TXENA ((unsigned int) 0x1 << 16) // (SSC) Transmit Enable +#define AT91C_SSC_RXENA ((unsigned int) 0x1 << 17) // (SSC) Receive Enable +// -------- SSC_IER : (SSC Offset: 0x44) SSC Interrupt Enable Register -------- +// -------- SSC_IDR : (SSC Offset: 0x48) SSC Interrupt Disable Register -------- +// -------- SSC_IMR : (SSC Offset: 0x4c) SSC Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Two-wire Interface +// ***************************************************************************** +typedef struct _AT91S_TWI { + AT91_REG TWI_CR; // Control Register + AT91_REG TWI_MMR; // Master Mode Register + AT91_REG Reserved0[1]; // + AT91_REG TWI_IADR; // Internal Address Register + AT91_REG TWI_CWGR; // Clock Waveform Generator Register + AT91_REG Reserved1[3]; // + AT91_REG TWI_SR; // Status Register + AT91_REG TWI_IER; // Interrupt Enable Register + AT91_REG TWI_IDR; // Interrupt Disable Register + AT91_REG TWI_IMR; // Interrupt Mask Register + AT91_REG TWI_RHR; // Receive Holding Register + AT91_REG TWI_THR; // Transmit Holding Register +} AT91S_TWI, *AT91PS_TWI; + +// -------- TWI_CR : (TWI Offset: 0x0) TWI Control Register -------- +#define AT91C_TWI_START ((unsigned int) 0x1 << 0) // (TWI) Send a START Condition +#define AT91C_TWI_STOP ((unsigned int) 0x1 << 1) // (TWI) Send a STOP Condition +#define AT91C_TWI_MSEN ((unsigned int) 0x1 << 2) // (TWI) TWI Master Transfer Enabled +#define AT91C_TWI_MSDIS ((unsigned int) 0x1 << 3) // (TWI) TWI Master Transfer Disabled +#define AT91C_TWI_SWRST ((unsigned int) 0x1 << 7) // (TWI) Software Reset +// -------- TWI_MMR : (TWI Offset: 0x4) TWI Master Mode Register -------- +#define AT91C_TWI_IADRSZ ((unsigned int) 0x3 << 8) // (TWI) Internal Device Address Size +#define AT91C_TWI_IADRSZ_NO ((unsigned int) 0x0 << 8) // (TWI) No internal device address +#define AT91C_TWI_IADRSZ_1_BYTE ((unsigned int) 0x1 << 8) // (TWI) One-byte internal device address +#define AT91C_TWI_IADRSZ_2_BYTE ((unsigned int) 0x2 << 8) // (TWI) Two-byte internal device address +#define AT91C_TWI_IADRSZ_3_BYTE ((unsigned int) 0x3 << 8) // (TWI) Three-byte internal device address +#define AT91C_TWI_MREAD ((unsigned int) 0x1 << 12) // (TWI) Master Read Direction +#define AT91C_TWI_DADR ((unsigned int) 0x7F << 16) // (TWI) Device Address +// -------- TWI_CWGR : (TWI Offset: 0x10) TWI Clock Waveform Generator Register -------- +#define AT91C_TWI_CLDIV ((unsigned int) 0xFF << 0) // (TWI) Clock Low Divider +#define AT91C_TWI_CHDIV ((unsigned int) 0xFF << 8) // (TWI) Clock High Divider +#define AT91C_TWI_CKDIV ((unsigned int) 0x7 << 16) // (TWI) Clock Divider +// -------- TWI_SR : (TWI Offset: 0x20) TWI Status Register -------- +#define AT91C_TWI_TXCOMP ((unsigned int) 0x1 << 0) // (TWI) Transmission Completed +#define AT91C_TWI_RXRDY ((unsigned int) 0x1 << 1) // (TWI) Receive holding register ReaDY +#define AT91C_TWI_TXRDY ((unsigned int) 0x1 << 2) // (TWI) Transmit holding register ReaDY +#define AT91C_TWI_OVRE ((unsigned int) 0x1 << 6) // (TWI) Overrun Error +#define AT91C_TWI_UNRE ((unsigned int) 0x1 << 7) // (TWI) Underrun Error +#define AT91C_TWI_NACK ((unsigned int) 0x1 << 8) // (TWI) Not Acknowledged +// -------- TWI_IER : (TWI Offset: 0x24) TWI Interrupt Enable Register -------- +// -------- TWI_IDR : (TWI Offset: 0x28) TWI Interrupt Disable Register -------- +// -------- TWI_IMR : (TWI Offset: 0x2c) TWI Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR PWMC Channel Interface +// ***************************************************************************** +typedef struct _AT91S_PWMC_CH { + AT91_REG PWMC_CMR; // Channel Mode Register + AT91_REG PWMC_CDTYR; // Channel Duty Cycle Register + AT91_REG PWMC_CPRDR; // Channel Period Register + AT91_REG PWMC_CCNTR; // Channel Counter Register + AT91_REG PWMC_CUPDR; // Channel Update Register + AT91_REG PWMC_Reserved[3]; // Reserved +} AT91S_PWMC_CH, *AT91PS_PWMC_CH; + +// -------- PWMC_CMR : (PWMC_CH Offset: 0x0) PWMC Channel Mode Register -------- +#define AT91C_PWMC_CPRE ((unsigned int) 0xF << 0) // (PWMC_CH) Channel Pre-scaler : PWMC_CLKx +#define AT91C_PWMC_CPRE_MCK ((unsigned int) 0x0) // (PWMC_CH) +#define AT91C_PWMC_CPRE_MCKA ((unsigned int) 0xB) // (PWMC_CH) +#define AT91C_PWMC_CPRE_MCKB ((unsigned int) 0xC) // (PWMC_CH) +#define AT91C_PWMC_CALG ((unsigned int) 0x1 << 8) // (PWMC_CH) Channel Alignment +#define AT91C_PWMC_CPOL ((unsigned int) 0x1 << 9) // (PWMC_CH) Channel Polarity +#define AT91C_PWMC_CPD ((unsigned int) 0x1 << 10) // (PWMC_CH) Channel Update Period +// -------- PWMC_CDTYR : (PWMC_CH Offset: 0x4) PWMC Channel Duty Cycle Register -------- +#define AT91C_PWMC_CDTY ((unsigned int) 0x0 << 0) // (PWMC_CH) Channel Duty Cycle +// -------- PWMC_CPRDR : (PWMC_CH Offset: 0x8) PWMC Channel Period Register -------- +#define AT91C_PWMC_CPRD ((unsigned int) 0x0 << 0) // (PWMC_CH) Channel Period +// -------- PWMC_CCNTR : (PWMC_CH Offset: 0xc) PWMC Channel Counter Register -------- +#define AT91C_PWMC_CCNT ((unsigned int) 0x0 << 0) // (PWMC_CH) Channel Counter +// -------- PWMC_CUPDR : (PWMC_CH Offset: 0x10) PWMC Channel Update Register -------- +#define AT91C_PWMC_CUPD ((unsigned int) 0x0 << 0) // (PWMC_CH) Channel Update + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Pulse Width Modulation Controller Interface +// ***************************************************************************** +typedef struct _AT91S_PWMC { + AT91_REG PWMC_MR; // PWMC Mode Register + AT91_REG PWMC_ENA; // PWMC Enable Register + AT91_REG PWMC_DIS; // PWMC Disable Register + AT91_REG PWMC_SR; // PWMC Status Register + AT91_REG PWMC_IER; // PWMC Interrupt Enable Register + AT91_REG PWMC_IDR; // PWMC Interrupt Disable Register + AT91_REG PWMC_IMR; // PWMC Interrupt Mask Register + AT91_REG PWMC_ISR; // PWMC Interrupt Status Register + AT91_REG Reserved0[55]; // + AT91_REG PWMC_VR; // PWMC Version Register + AT91_REG Reserved1[64]; // + AT91S_PWMC_CH PWMC_CH[4]; // PWMC Channel +} AT91S_PWMC, *AT91PS_PWMC; + +// -------- PWMC_MR : (PWMC Offset: 0x0) PWMC Mode Register -------- +#define AT91C_PWMC_DIVA ((unsigned int) 0xFF << 0) // (PWMC) CLKA divide factor. +#define AT91C_PWMC_PREA ((unsigned int) 0xF << 8) // (PWMC) Divider Input Clock Prescaler A +#define AT91C_PWMC_PREA_MCK ((unsigned int) 0x0 << 8) // (PWMC) +#define AT91C_PWMC_DIVB ((unsigned int) 0xFF << 16) // (PWMC) CLKB divide factor. +#define AT91C_PWMC_PREB ((unsigned int) 0xF << 24) // (PWMC) Divider Input Clock Prescaler B +#define AT91C_PWMC_PREB_MCK ((unsigned int) 0x0 << 24) // (PWMC) +// -------- PWMC_ENA : (PWMC Offset: 0x4) PWMC Enable Register -------- +#define AT91C_PWMC_CHID0 ((unsigned int) 0x1 << 0) // (PWMC) Channel ID 0 +#define AT91C_PWMC_CHID1 ((unsigned int) 0x1 << 1) // (PWMC) Channel ID 1 +#define AT91C_PWMC_CHID2 ((unsigned int) 0x1 << 2) // (PWMC) Channel ID 2 +#define AT91C_PWMC_CHID3 ((unsigned int) 0x1 << 3) // (PWMC) Channel ID 3 +// -------- PWMC_DIS : (PWMC Offset: 0x8) PWMC Disable Register -------- +// -------- PWMC_SR : (PWMC Offset: 0xc) PWMC Status Register -------- +// -------- PWMC_IER : (PWMC Offset: 0x10) PWMC Interrupt Enable Register -------- +// -------- PWMC_IDR : (PWMC Offset: 0x14) PWMC Interrupt Disable Register -------- +// -------- PWMC_IMR : (PWMC Offset: 0x18) PWMC Interrupt Mask Register -------- +// -------- PWMC_ISR : (PWMC Offset: 0x1c) PWMC Interrupt Status Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR USB Device Interface +// ***************************************************************************** +typedef struct _AT91S_UDP { + AT91_REG UDP_NUM; // Frame Number Register + AT91_REG UDP_GLBSTATE; // Global State Register + AT91_REG UDP_FADDR; // Function Address Register + AT91_REG Reserved0[1]; // + AT91_REG UDP_IER; // Interrupt Enable Register + AT91_REG UDP_IDR; // Interrupt Disable Register + AT91_REG UDP_IMR; // Interrupt Mask Register + AT91_REG UDP_ISR; // Interrupt Status Register + AT91_REG UDP_ICR; // Interrupt Clear Register + AT91_REG Reserved1[1]; // + AT91_REG UDP_RSTEP; // Reset Endpoint Register + AT91_REG Reserved2[1]; // + AT91_REG UDP_CSR[6]; // Endpoint Control and Status Register + AT91_REG Reserved3[2]; // + AT91_REG UDP_FDR[6]; // Endpoint FIFO Data Register + AT91_REG Reserved4[3]; // + AT91_REG UDP_TXVC; // Transceiver Control Register +} AT91S_UDP, *AT91PS_UDP; + +// -------- UDP_FRM_NUM : (UDP Offset: 0x0) USB Frame Number Register -------- +#define AT91C_UDP_FRM_NUM ((unsigned int) 0x7FF << 0) // (UDP) Frame Number as Defined in the Packet Field Formats +#define AT91C_UDP_FRM_ERR ((unsigned int) 0x1 << 16) // (UDP) Frame Error +#define AT91C_UDP_FRM_OK ((unsigned int) 0x1 << 17) // (UDP) Frame OK +// -------- UDP_GLB_STATE : (UDP Offset: 0x4) USB Global State Register -------- +#define AT91C_UDP_FADDEN ((unsigned int) 0x1 << 0) // (UDP) Function Address Enable +#define AT91C_UDP_CONFG ((unsigned int) 0x1 << 1) // (UDP) Configured +#define AT91C_UDP_ESR ((unsigned int) 0x1 << 2) // (UDP) Enable Send Resume +#define AT91C_UDP_RSMINPR ((unsigned int) 0x1 << 3) // (UDP) A Resume Has Been Sent to the Host +#define AT91C_UDP_RMWUPE ((unsigned int) 0x1 << 4) // (UDP) Remote Wake Up Enable +// -------- UDP_FADDR : (UDP Offset: 0x8) USB Function Address Register -------- +#define AT91C_UDP_FADD ((unsigned int) 0xFF << 0) // (UDP) Function Address Value +#define AT91C_UDP_FEN ((unsigned int) 0x1 << 8) // (UDP) Function Enable +// -------- UDP_IER : (UDP Offset: 0x10) USB Interrupt Enable Register -------- +#define AT91C_UDP_EPINT0 ((unsigned int) 0x1 << 0) // (UDP) Endpoint 0 Interrupt +#define AT91C_UDP_EPINT1 ((unsigned int) 0x1 << 1) // (UDP) Endpoint 0 Interrupt +#define AT91C_UDP_EPINT2 ((unsigned int) 0x1 << 2) // (UDP) Endpoint 2 Interrupt +#define AT91C_UDP_EPINT3 ((unsigned int) 0x1 << 3) // (UDP) Endpoint 3 Interrupt +#define AT91C_UDP_EPINT4 ((unsigned int) 0x1 << 4) // (UDP) Endpoint 4 Interrupt +#define AT91C_UDP_EPINT5 ((unsigned int) 0x1 << 5) // (UDP) Endpoint 5 Interrupt +#define AT91C_UDP_RXSUSP ((unsigned int) 0x1 << 8) // (UDP) USB Suspend Interrupt +#define AT91C_UDP_RXRSM ((unsigned int) 0x1 << 9) // (UDP) USB Resume Interrupt +#define AT91C_UDP_EXTRSM ((unsigned int) 0x1 << 10) // (UDP) USB External Resume Interrupt +#define AT91C_UDP_SOFINT ((unsigned int) 0x1 << 11) // (UDP) USB Start Of frame Interrupt +#define AT91C_UDP_WAKEUP ((unsigned int) 0x1 << 13) // (UDP) USB Resume Interrupt +// -------- UDP_IDR : (UDP Offset: 0x14) USB Interrupt Disable Register -------- +// -------- UDP_IMR : (UDP Offset: 0x18) USB Interrupt Mask Register -------- +// -------- UDP_ISR : (UDP Offset: 0x1c) USB Interrupt Status Register -------- +#define AT91C_UDP_ENDBUSRES ((unsigned int) 0x1 << 12) // (UDP) USB End Of Bus Reset Interrupt +// -------- UDP_ICR : (UDP Offset: 0x20) USB Interrupt Clear Register -------- +// -------- UDP_RST_EP : (UDP Offset: 0x28) USB Reset Endpoint Register -------- +#define AT91C_UDP_EP0 ((unsigned int) 0x1 << 0) // (UDP) Reset Endpoint 0 +#define AT91C_UDP_EP1 ((unsigned int) 0x1 << 1) // (UDP) Reset Endpoint 1 +#define AT91C_UDP_EP2 ((unsigned int) 0x1 << 2) // (UDP) Reset Endpoint 2 +#define AT91C_UDP_EP3 ((unsigned int) 0x1 << 3) // (UDP) Reset Endpoint 3 +#define AT91C_UDP_EP4 ((unsigned int) 0x1 << 4) // (UDP) Reset Endpoint 4 +#define AT91C_UDP_EP5 ((unsigned int) 0x1 << 5) // (UDP) Reset Endpoint 5 +// -------- UDP_CSR : (UDP Offset: 0x30) USB Endpoint Control and Status Register -------- +#define AT91C_UDP_TXCOMP ((unsigned int) 0x1 << 0) // (UDP) Generates an IN packet with data previously written in the DPR +#define AT91C_UDP_RX_DATA_BK0 ((unsigned int) 0x1 << 1) // (UDP) Receive Data Bank 0 +#define AT91C_UDP_RXSETUP ((unsigned int) 0x1 << 2) // (UDP) Sends STALL to the Host (Control endpoints) +#define AT91C_UDP_ISOERROR ((unsigned int) 0x1 << 3) // (UDP) Isochronous error (Isochronous endpoints) +#define AT91C_UDP_TXPKTRDY ((unsigned int) 0x1 << 4) // (UDP) Transmit Packet Ready +#define AT91C_UDP_FORCESTALL ((unsigned int) 0x1 << 5) // (UDP) Force Stall (used by Control, Bulk and Isochronous endpoints). +#define AT91C_UDP_RX_DATA_BK1 ((unsigned int) 0x1 << 6) // (UDP) Receive Data Bank 1 (only used by endpoints with ping-pong attributes). +#define AT91C_UDP_DIR ((unsigned int) 0x1 << 7) // (UDP) Transfer Direction +#define AT91C_UDP_EPTYPE ((unsigned int) 0x7 << 8) // (UDP) Endpoint type +#define AT91C_UDP_EPTYPE_CTRL ((unsigned int) 0x0 << 8) // (UDP) Control +#define AT91C_UDP_EPTYPE_ISO_OUT ((unsigned int) 0x1 << 8) // (UDP) Isochronous OUT +#define AT91C_UDP_EPTYPE_BULK_OUT ((unsigned int) 0x2 << 8) // (UDP) Bulk OUT +#define AT91C_UDP_EPTYPE_INT_OUT ((unsigned int) 0x3 << 8) // (UDP) Interrupt OUT +#define AT91C_UDP_EPTYPE_ISO_IN ((unsigned int) 0x5 << 8) // (UDP) Isochronous IN +#define AT91C_UDP_EPTYPE_BULK_IN ((unsigned int) 0x6 << 8) // (UDP) Bulk IN +#define AT91C_UDP_EPTYPE_INT_IN ((unsigned int) 0x7 << 8) // (UDP) Interrupt IN +#define AT91C_UDP_DTGLE ((unsigned int) 0x1 << 11) // (UDP) Data Toggle +#define AT91C_UDP_EPEDS ((unsigned int) 0x1 << 15) // (UDP) Endpoint Enable Disable +#define AT91C_UDP_RXBYTECNT ((unsigned int) 0x7FF << 16) // (UDP) Number Of Bytes Available in the FIFO +// -------- UDP_TXVC : (UDP Offset: 0x74) Transceiver Control Register -------- +#define AT91C_UDP_TXVDIS ((unsigned int) 0x1 << 8) // (UDP) +#define AT91C_UDP_PUON ((unsigned int) 0x1 << 9) // (UDP) Pull-up ON + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Timer Counter Channel Interface +// ***************************************************************************** +typedef struct _AT91S_TC { + AT91_REG TC_CCR; // Channel Control Register + AT91_REG TC_CMR; // Channel Mode Register (Capture Mode / Waveform Mode) + AT91_REG Reserved0[2]; // + AT91_REG TC_CV; // Counter Value + AT91_REG TC_RA; // Register A + AT91_REG TC_RB; // Register B + AT91_REG TC_RC; // Register C + AT91_REG TC_SR; // Status Register + AT91_REG TC_IER; // Interrupt Enable Register + AT91_REG TC_IDR; // Interrupt Disable Register + AT91_REG TC_IMR; // Interrupt Mask Register +} AT91S_TC, *AT91PS_TC; + +// -------- TC_CCR : (TC Offset: 0x0) TC Channel Control Register -------- +#define AT91C_TC_CLKEN ((unsigned int) 0x1 << 0) // (TC) Counter Clock Enable Command +#define AT91C_TC_CLKDIS ((unsigned int) 0x1 << 1) // (TC) Counter Clock Disable Command +#define AT91C_TC_SWTRG ((unsigned int) 0x1 << 2) // (TC) Software Trigger Command +// -------- TC_CMR : (TC Offset: 0x4) TC Channel Mode Register: Capture Mode / Waveform Mode -------- +#define AT91C_TC_CLKS ((unsigned int) 0x7 << 0) // (TC) Clock Selection +#define AT91C_TC_CLKS_TIMER_DIV1_CLOCK ((unsigned int) 0x0) // (TC) Clock selected: TIMER_DIV1_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV2_CLOCK ((unsigned int) 0x1) // (TC) Clock selected: TIMER_DIV2_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV3_CLOCK ((unsigned int) 0x2) // (TC) Clock selected: TIMER_DIV3_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV4_CLOCK ((unsigned int) 0x3) // (TC) Clock selected: TIMER_DIV4_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV5_CLOCK ((unsigned int) 0x4) // (TC) Clock selected: TIMER_DIV5_CLOCK +#define AT91C_TC_CLKS_XC0 ((unsigned int) 0x5) // (TC) Clock selected: XC0 +#define AT91C_TC_CLKS_XC1 ((unsigned int) 0x6) // (TC) Clock selected: XC1 +#define AT91C_TC_CLKS_XC2 ((unsigned int) 0x7) // (TC) Clock selected: XC2 +#define AT91C_TC_CLKI ((unsigned int) 0x1 << 3) // (TC) Clock Invert +#define AT91C_TC_BURST ((unsigned int) 0x3 << 4) // (TC) Burst Signal Selection +#define AT91C_TC_BURST_NONE ((unsigned int) 0x0 << 4) // (TC) The clock is not gated by an external signal +#define AT91C_TC_BURST_XC0 ((unsigned int) 0x1 << 4) // (TC) XC0 is ANDed with the selected clock +#define AT91C_TC_BURST_XC1 ((unsigned int) 0x2 << 4) // (TC) XC1 is ANDed with the selected clock +#define AT91C_TC_BURST_XC2 ((unsigned int) 0x3 << 4) // (TC) XC2 is ANDed with the selected clock +#define AT91C_TC_CPCSTOP ((unsigned int) 0x1 << 6) // (TC) Counter Clock Stopped with RC Compare +#define AT91C_TC_LDBSTOP ((unsigned int) 0x1 << 6) // (TC) Counter Clock Stopped with RB Loading +#define AT91C_TC_CPCDIS ((unsigned int) 0x1 << 7) // (TC) Counter Clock Disable with RC Compare +#define AT91C_TC_LDBDIS ((unsigned int) 0x1 << 7) // (TC) Counter Clock Disabled with RB Loading +#define AT91C_TC_ETRGEDG ((unsigned int) 0x3 << 8) // (TC) External Trigger Edge Selection +#define AT91C_TC_ETRGEDG_NONE ((unsigned int) 0x0 << 8) // (TC) Edge: None +#define AT91C_TC_ETRGEDG_RISING ((unsigned int) 0x1 << 8) // (TC) Edge: rising edge +#define AT91C_TC_ETRGEDG_FALLING ((unsigned int) 0x2 << 8) // (TC) Edge: falling edge +#define AT91C_TC_ETRGEDG_BOTH ((unsigned int) 0x3 << 8) // (TC) Edge: each edge +#define AT91C_TC_EEVTEDG ((unsigned int) 0x3 << 8) // (TC) External Event Edge Selection +#define AT91C_TC_EEVTEDG_NONE ((unsigned int) 0x0 << 8) // (TC) Edge: None +#define AT91C_TC_EEVTEDG_RISING ((unsigned int) 0x1 << 8) // (TC) Edge: rising edge +#define AT91C_TC_EEVTEDG_FALLING ((unsigned int) 0x2 << 8) // (TC) Edge: falling edge +#define AT91C_TC_EEVTEDG_BOTH ((unsigned int) 0x3 << 8) // (TC) Edge: each edge +#define AT91C_TC_EEVT ((unsigned int) 0x3 << 10) // (TC) External Event Selection +#define AT91C_TC_EEVT_TIOB ((unsigned int) 0x0 << 10) // (TC) Signal selected as external event: TIOB TIOB direction: input +#define AT91C_TC_EEVT_XC0 ((unsigned int) 0x1 << 10) // (TC) Signal selected as external event: XC0 TIOB direction: output +#define AT91C_TC_EEVT_XC1 ((unsigned int) 0x2 << 10) // (TC) Signal selected as external event: XC1 TIOB direction: output +#define AT91C_TC_EEVT_XC2 ((unsigned int) 0x3 << 10) // (TC) Signal selected as external event: XC2 TIOB direction: output +#define AT91C_TC_ABETRG ((unsigned int) 0x1 << 10) // (TC) TIOA or TIOB External Trigger Selection +#define AT91C_TC_ENETRG ((unsigned int) 0x1 << 12) // (TC) External Event Trigger enable +#define AT91C_TC_WAVESEL ((unsigned int) 0x3 << 13) // (TC) Waveform Selection +#define AT91C_TC_WAVESEL_UP ((unsigned int) 0x0 << 13) // (TC) UP mode without atomatic trigger on RC Compare +#define AT91C_TC_WAVESEL_UPDOWN ((unsigned int) 0x1 << 13) // (TC) UPDOWN mode without automatic trigger on RC Compare +#define AT91C_TC_WAVESEL_UP_AUTO ((unsigned int) 0x2 << 13) // (TC) UP mode with automatic trigger on RC Compare +#define AT91C_TC_WAVESEL_UPDOWN_AUTO ((unsigned int) 0x3 << 13) // (TC) UPDOWN mode with automatic trigger on RC Compare +#define AT91C_TC_CPCTRG ((unsigned int) 0x1 << 14) // (TC) RC Compare Trigger Enable +#define AT91C_TC_WAVE ((unsigned int) 0x1 << 15) // (TC) +#define AT91C_TC_ACPA ((unsigned int) 0x3 << 16) // (TC) RA Compare Effect on TIOA +#define AT91C_TC_ACPA_NONE ((unsigned int) 0x0 << 16) // (TC) Effect: none +#define AT91C_TC_ACPA_SET ((unsigned int) 0x1 << 16) // (TC) Effect: set +#define AT91C_TC_ACPA_CLEAR ((unsigned int) 0x2 << 16) // (TC) Effect: clear +#define AT91C_TC_ACPA_TOGGLE ((unsigned int) 0x3 << 16) // (TC) Effect: toggle +#define AT91C_TC_LDRA ((unsigned int) 0x3 << 16) // (TC) RA Loading Selection +#define AT91C_TC_LDRA_NONE ((unsigned int) 0x0 << 16) // (TC) Edge: None +#define AT91C_TC_LDRA_RISING ((unsigned int) 0x1 << 16) // (TC) Edge: rising edge of TIOA +#define AT91C_TC_LDRA_FALLING ((unsigned int) 0x2 << 16) // (TC) Edge: falling edge of TIOA +#define AT91C_TC_LDRA_BOTH ((unsigned int) 0x3 << 16) // (TC) Edge: each edge of TIOA +#define AT91C_TC_ACPC ((unsigned int) 0x3 << 18) // (TC) RC Compare Effect on TIOA +#define AT91C_TC_ACPC_NONE ((unsigned int) 0x0 << 18) // (TC) Effect: none +#define AT91C_TC_ACPC_SET ((unsigned int) 0x1 << 18) // (TC) Effect: set +#define AT91C_TC_ACPC_CLEAR ((unsigned int) 0x2 << 18) // (TC) Effect: clear +#define AT91C_TC_ACPC_TOGGLE ((unsigned int) 0x3 << 18) // (TC) Effect: toggle +#define AT91C_TC_LDRB ((unsigned int) 0x3 << 18) // (TC) RB Loading Selection +#define AT91C_TC_LDRB_NONE ((unsigned int) 0x0 << 18) // (TC) Edge: None +#define AT91C_TC_LDRB_RISING ((unsigned int) 0x1 << 18) // (TC) Edge: rising edge of TIOA +#define AT91C_TC_LDRB_FALLING ((unsigned int) 0x2 << 18) // (TC) Edge: falling edge of TIOA +#define AT91C_TC_LDRB_BOTH ((unsigned int) 0x3 << 18) // (TC) Edge: each edge of TIOA +#define AT91C_TC_AEEVT ((unsigned int) 0x3 << 20) // (TC) External Event Effect on TIOA +#define AT91C_TC_AEEVT_NONE ((unsigned int) 0x0 << 20) // (TC) Effect: none +#define AT91C_TC_AEEVT_SET ((unsigned int) 0x1 << 20) // (TC) Effect: set +#define AT91C_TC_AEEVT_CLEAR ((unsigned int) 0x2 << 20) // (TC) Effect: clear +#define AT91C_TC_AEEVT_TOGGLE ((unsigned int) 0x3 << 20) // (TC) Effect: toggle +#define AT91C_TC_ASWTRG ((unsigned int) 0x3 << 22) // (TC) Software Trigger Effect on TIOA +#define AT91C_TC_ASWTRG_NONE ((unsigned int) 0x0 << 22) // (TC) Effect: none +#define AT91C_TC_ASWTRG_SET ((unsigned int) 0x1 << 22) // (TC) Effect: set +#define AT91C_TC_ASWTRG_CLEAR ((unsigned int) 0x2 << 22) // (TC) Effect: clear +#define AT91C_TC_ASWTRG_TOGGLE ((unsigned int) 0x3 << 22) // (TC) Effect: toggle +#define AT91C_TC_BCPB ((unsigned int) 0x3 << 24) // (TC) RB Compare Effect on TIOB +#define AT91C_TC_BCPB_NONE ((unsigned int) 0x0 << 24) // (TC) Effect: none +#define AT91C_TC_BCPB_SET ((unsigned int) 0x1 << 24) // (TC) Effect: set +#define AT91C_TC_BCPB_CLEAR ((unsigned int) 0x2 << 24) // (TC) Effect: clear +#define AT91C_TC_BCPB_TOGGLE ((unsigned int) 0x3 << 24) // (TC) Effect: toggle +#define AT91C_TC_BCPC ((unsigned int) 0x3 << 26) // (TC) RC Compare Effect on TIOB +#define AT91C_TC_BCPC_NONE ((unsigned int) 0x0 << 26) // (TC) Effect: none +#define AT91C_TC_BCPC_SET ((unsigned int) 0x1 << 26) // (TC) Effect: set +#define AT91C_TC_BCPC_CLEAR ((unsigned int) 0x2 << 26) // (TC) Effect: clear +#define AT91C_TC_BCPC_TOGGLE ((unsigned int) 0x3 << 26) // (TC) Effect: toggle +#define AT91C_TC_BEEVT ((unsigned int) 0x3 << 28) // (TC) External Event Effect on TIOB +#define AT91C_TC_BEEVT_NONE ((unsigned int) 0x0 << 28) // (TC) Effect: none +#define AT91C_TC_BEEVT_SET ((unsigned int) 0x1 << 28) // (TC) Effect: set +#define AT91C_TC_BEEVT_CLEAR ((unsigned int) 0x2 << 28) // (TC) Effect: clear +#define AT91C_TC_BEEVT_TOGGLE ((unsigned int) 0x3 << 28) // (TC) Effect: toggle +#define AT91C_TC_BSWTRG ((unsigned int) 0x3 << 30) // (TC) Software Trigger Effect on TIOB +#define AT91C_TC_BSWTRG_NONE ((unsigned int) 0x0 << 30) // (TC) Effect: none +#define AT91C_TC_BSWTRG_SET ((unsigned int) 0x1 << 30) // (TC) Effect: set +#define AT91C_TC_BSWTRG_CLEAR ((unsigned int) 0x2 << 30) // (TC) Effect: clear +#define AT91C_TC_BSWTRG_TOGGLE ((unsigned int) 0x3 << 30) // (TC) Effect: toggle +// -------- TC_SR : (TC Offset: 0x20) TC Channel Status Register -------- +#define AT91C_TC_COVFS ((unsigned int) 0x1 << 0) // (TC) Counter Overflow +#define AT91C_TC_LOVRS ((unsigned int) 0x1 << 1) // (TC) Load Overrun +#define AT91C_TC_CPAS ((unsigned int) 0x1 << 2) // (TC) RA Compare +#define AT91C_TC_CPBS ((unsigned int) 0x1 << 3) // (TC) RB Compare +#define AT91C_TC_CPCS ((unsigned int) 0x1 << 4) // (TC) RC Compare +#define AT91C_TC_LDRAS ((unsigned int) 0x1 << 5) // (TC) RA Loading +#define AT91C_TC_LDRBS ((unsigned int) 0x1 << 6) // (TC) RB Loading +#define AT91C_TC_ETRGS ((unsigned int) 0x1 << 7) // (TC) External Trigger +#define AT91C_TC_CLKSTA ((unsigned int) 0x1 << 16) // (TC) Clock Enabling +#define AT91C_TC_MTIOA ((unsigned int) 0x1 << 17) // (TC) TIOA Mirror +#define AT91C_TC_MTIOB ((unsigned int) 0x1 << 18) // (TC) TIOA Mirror +// -------- TC_IER : (TC Offset: 0x24) TC Channel Interrupt Enable Register -------- +// -------- TC_IDR : (TC Offset: 0x28) TC Channel Interrupt Disable Register -------- +// -------- TC_IMR : (TC Offset: 0x2c) TC Channel Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Timer Counter Interface +// ***************************************************************************** +typedef struct _AT91S_TCB { + AT91S_TC TCB_TC0; // TC Channel 0 + AT91_REG Reserved0[4]; // + AT91S_TC TCB_TC1; // TC Channel 1 + AT91_REG Reserved1[4]; // + AT91S_TC TCB_TC2; // TC Channel 2 + AT91_REG Reserved2[4]; // + AT91_REG TCB_BCR; // TC Block Control Register + AT91_REG TCB_BMR; // TC Block Mode Register +} AT91S_TCB, *AT91PS_TCB; + +// -------- TCB_BCR : (TCB Offset: 0xc0) TC Block Control Register -------- +#define AT91C_TCB_SYNC ((unsigned int) 0x1 << 0) // (TCB) Synchro Command +// -------- TCB_BMR : (TCB Offset: 0xc4) TC Block Mode Register -------- +#define AT91C_TCB_TC0XC0S ((unsigned int) 0x3 << 0) // (TCB) External Clock Signal 0 Selection +#define AT91C_TCB_TC0XC0S_TCLK0 ((unsigned int) 0x0) // (TCB) TCLK0 connected to XC0 +#define AT91C_TCB_TC0XC0S_NONE ((unsigned int) 0x1) // (TCB) None signal connected to XC0 +#define AT91C_TCB_TC0XC0S_TIOA1 ((unsigned int) 0x2) // (TCB) TIOA1 connected to XC0 +#define AT91C_TCB_TC0XC0S_TIOA2 ((unsigned int) 0x3) // (TCB) TIOA2 connected to XC0 +#define AT91C_TCB_TC1XC1S ((unsigned int) 0x3 << 2) // (TCB) External Clock Signal 1 Selection +#define AT91C_TCB_TC1XC1S_TCLK1 ((unsigned int) 0x0 << 2) // (TCB) TCLK1 connected to XC1 +#define AT91C_TCB_TC1XC1S_NONE ((unsigned int) 0x1 << 2) // (TCB) None signal connected to XC1 +#define AT91C_TCB_TC1XC1S_TIOA0 ((unsigned int) 0x2 << 2) // (TCB) TIOA0 connected to XC1 +#define AT91C_TCB_TC1XC1S_TIOA2 ((unsigned int) 0x3 << 2) // (TCB) TIOA2 connected to XC1 +#define AT91C_TCB_TC2XC2S ((unsigned int) 0x3 << 4) // (TCB) External Clock Signal 2 Selection +#define AT91C_TCB_TC2XC2S_TCLK2 ((unsigned int) 0x0 << 4) // (TCB) TCLK2 connected to XC2 +#define AT91C_TCB_TC2XC2S_NONE ((unsigned int) 0x1 << 4) // (TCB) None signal connected to XC2 +#define AT91C_TCB_TC2XC2S_TIOA0 ((unsigned int) 0x2 << 4) // (TCB) TIOA0 connected to XC2 +#define AT91C_TCB_TC2XC2S_TIOA1 ((unsigned int) 0x3 << 4) // (TCB) TIOA2 connected to XC2 + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Control Area Network MailBox Interface +// ***************************************************************************** +typedef struct _AT91S_CAN_MB { + AT91_REG CAN_MB_MMR; // MailBox Mode Register + AT91_REG CAN_MB_MAM; // MailBox Acceptance Mask Register + AT91_REG CAN_MB_MID; // MailBox ID Register + AT91_REG CAN_MB_MFID; // MailBox Family ID Register + AT91_REG CAN_MB_MSR; // MailBox Status Register + AT91_REG CAN_MB_MDL; // MailBox Data Low Register + AT91_REG CAN_MB_MDH; // MailBox Data High Register + AT91_REG CAN_MB_MCR; // MailBox Control Register +} AT91S_CAN_MB, *AT91PS_CAN_MB; + +// -------- CAN_MMR : (CAN_MB Offset: 0x0) CAN Message Mode Register -------- +#define AT91C_CAN_MTIMEMARK ((unsigned int) 0xFFFF << 0) // (CAN_MB) Mailbox Timemark +#define AT91C_CAN_PRIOR ((unsigned int) 0xF << 16) // (CAN_MB) Mailbox Priority +#define AT91C_CAN_MOT ((unsigned int) 0x7 << 24) // (CAN_MB) Mailbox Object Type +#define AT91C_CAN_MOT_DIS ((unsigned int) 0x0 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_RX ((unsigned int) 0x1 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_RXOVERWRITE ((unsigned int) 0x2 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_TX ((unsigned int) 0x3 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_CONSUMER ((unsigned int) 0x4 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_PRODUCER ((unsigned int) 0x5 << 24) // (CAN_MB) +// -------- CAN_MAM : (CAN_MB Offset: 0x4) CAN Message Acceptance Mask Register -------- +#define AT91C_CAN_MIDvB ((unsigned int) 0x3FFFF << 0) // (CAN_MB) Complementary bits for identifier in extended mode +#define AT91C_CAN_MIDvA ((unsigned int) 0x7FF << 18) // (CAN_MB) Identifier for standard frame mode +#define AT91C_CAN_MIDE ((unsigned int) 0x1 << 29) // (CAN_MB) Identifier Version +// -------- CAN_MID : (CAN_MB Offset: 0x8) CAN Message ID Register -------- +// -------- CAN_MFID : (CAN_MB Offset: 0xc) CAN Message Family ID Register -------- +// -------- CAN_MSR : (CAN_MB Offset: 0x10) CAN Message Status Register -------- +#define AT91C_CAN_MTIMESTAMP ((unsigned int) 0xFFFF << 0) // (CAN_MB) Timer Value +#define AT91C_CAN_MDLC ((unsigned int) 0xF << 16) // (CAN_MB) Mailbox Data Length Code +#define AT91C_CAN_MRTR ((unsigned int) 0x1 << 20) // (CAN_MB) Mailbox Remote Transmission Request +#define AT91C_CAN_MABT ((unsigned int) 0x1 << 22) // (CAN_MB) Mailbox Message Abort +#define AT91C_CAN_MRDY ((unsigned int) 0x1 << 23) // (CAN_MB) Mailbox Ready +#define AT91C_CAN_MMI ((unsigned int) 0x1 << 24) // (CAN_MB) Mailbox Message Ignored +// -------- CAN_MDL : (CAN_MB Offset: 0x14) CAN Message Data Low Register -------- +// -------- CAN_MDH : (CAN_MB Offset: 0x18) CAN Message Data High Register -------- +// -------- CAN_MCR : (CAN_MB Offset: 0x1c) CAN Message Control Register -------- +#define AT91C_CAN_MACR ((unsigned int) 0x1 << 22) // (CAN_MB) Abort Request for Mailbox +#define AT91C_CAN_MTCR ((unsigned int) 0x1 << 23) // (CAN_MB) Mailbox Transfer Command + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Control Area Network Interface +// ***************************************************************************** +typedef struct _AT91S_CAN { + AT91_REG CAN_MR; // Mode Register + AT91_REG CAN_IER; // Interrupt Enable Register + AT91_REG CAN_IDR; // Interrupt Disable Register + AT91_REG CAN_IMR; // Interrupt Mask Register + AT91_REG CAN_SR; // Status Register + AT91_REG CAN_BR; // Baudrate Register + AT91_REG CAN_TIM; // Timer Register + AT91_REG CAN_TIMESTP; // Time Stamp Register + AT91_REG CAN_ECR; // Error Counter Register + AT91_REG CAN_TCR; // Transfer Command Register + AT91_REG CAN_ACR; // Abort Command Register + AT91_REG Reserved0[52]; // + AT91_REG CAN_VR; // Version Register + AT91_REG Reserved1[64]; // + AT91S_CAN_MB CAN_MB0; // CAN Mailbox 0 + AT91S_CAN_MB CAN_MB1; // CAN Mailbox 1 + AT91S_CAN_MB CAN_MB2; // CAN Mailbox 2 + AT91S_CAN_MB CAN_MB3; // CAN Mailbox 3 + AT91S_CAN_MB CAN_MB4; // CAN Mailbox 4 + AT91S_CAN_MB CAN_MB5; // CAN Mailbox 5 + AT91S_CAN_MB CAN_MB6; // CAN Mailbox 6 + AT91S_CAN_MB CAN_MB7; // CAN Mailbox 7 + AT91S_CAN_MB CAN_MB8; // CAN Mailbox 8 + AT91S_CAN_MB CAN_MB9; // CAN Mailbox 9 + AT91S_CAN_MB CAN_MB10; // CAN Mailbox 10 + AT91S_CAN_MB CAN_MB11; // CAN Mailbox 11 + AT91S_CAN_MB CAN_MB12; // CAN Mailbox 12 + AT91S_CAN_MB CAN_MB13; // CAN Mailbox 13 + AT91S_CAN_MB CAN_MB14; // CAN Mailbox 14 + AT91S_CAN_MB CAN_MB15; // CAN Mailbox 15 +} AT91S_CAN, *AT91PS_CAN; + +// -------- CAN_MR : (CAN Offset: 0x0) CAN Mode Register -------- +#define AT91C_CAN_CANEN ((unsigned int) 0x1 << 0) // (CAN) CAN Controller Enable +#define AT91C_CAN_LPM ((unsigned int) 0x1 << 1) // (CAN) Disable/Enable Low Power Mode +#define AT91C_CAN_ABM ((unsigned int) 0x1 << 2) // (CAN) Disable/Enable Autobaud/Listen Mode +#define AT91C_CAN_OVL ((unsigned int) 0x1 << 3) // (CAN) Disable/Enable Overload Frame +#define AT91C_CAN_TEOF ((unsigned int) 0x1 << 4) // (CAN) Time Stamp messages at each end of Frame +#define AT91C_CAN_TTM ((unsigned int) 0x1 << 5) // (CAN) Disable/Enable Time Trigger Mode +#define AT91C_CAN_TIMFRZ ((unsigned int) 0x1 << 6) // (CAN) Enable Timer Freeze +#define AT91C_CAN_DRPT ((unsigned int) 0x1 << 7) // (CAN) Disable Repeat +// -------- CAN_IER : (CAN Offset: 0x4) CAN Interrupt Enable Register -------- +#define AT91C_CAN_MB0 ((unsigned int) 0x1 << 0) // (CAN) Mailbox 0 Flag +#define AT91C_CAN_MB1 ((unsigned int) 0x1 << 1) // (CAN) Mailbox 1 Flag +#define AT91C_CAN_MB2 ((unsigned int) 0x1 << 2) // (CAN) Mailbox 2 Flag +#define AT91C_CAN_MB3 ((unsigned int) 0x1 << 3) // (CAN) Mailbox 3 Flag +#define AT91C_CAN_MB4 ((unsigned int) 0x1 << 4) // (CAN) Mailbox 4 Flag +#define AT91C_CAN_MB5 ((unsigned int) 0x1 << 5) // (CAN) Mailbox 5 Flag +#define AT91C_CAN_MB6 ((unsigned int) 0x1 << 6) // (CAN) Mailbox 6 Flag +#define AT91C_CAN_MB7 ((unsigned int) 0x1 << 7) // (CAN) Mailbox 7 Flag +#define AT91C_CAN_MB8 ((unsigned int) 0x1 << 8) // (CAN) Mailbox 8 Flag +#define AT91C_CAN_MB9 ((unsigned int) 0x1 << 9) // (CAN) Mailbox 9 Flag +#define AT91C_CAN_MB10 ((unsigned int) 0x1 << 10) // (CAN) Mailbox 10 Flag +#define AT91C_CAN_MB11 ((unsigned int) 0x1 << 11) // (CAN) Mailbox 11 Flag +#define AT91C_CAN_MB12 ((unsigned int) 0x1 << 12) // (CAN) Mailbox 12 Flag +#define AT91C_CAN_MB13 ((unsigned int) 0x1 << 13) // (CAN) Mailbox 13 Flag +#define AT91C_CAN_MB14 ((unsigned int) 0x1 << 14) // (CAN) Mailbox 14 Flag +#define AT91C_CAN_MB15 ((unsigned int) 0x1 << 15) // (CAN) Mailbox 15 Flag +#define AT91C_CAN_ERRA ((unsigned int) 0x1 << 16) // (CAN) Error Active Mode Flag +#define AT91C_CAN_WARN ((unsigned int) 0x1 << 17) // (CAN) Warning Limit Flag +#define AT91C_CAN_ERRP ((unsigned int) 0x1 << 18) // (CAN) Error Passive Mode Flag +#define AT91C_CAN_BOFF ((unsigned int) 0x1 << 19) // (CAN) Bus Off Mode Flag +#define AT91C_CAN_SLEEP ((unsigned int) 0x1 << 20) // (CAN) Sleep Flag +#define AT91C_CAN_WAKEUP ((unsigned int) 0x1 << 21) // (CAN) Wakeup Flag +#define AT91C_CAN_TOVF ((unsigned int) 0x1 << 22) // (CAN) Timer Overflow Flag +#define AT91C_CAN_TSTP ((unsigned int) 0x1 << 23) // (CAN) Timestamp Flag +#define AT91C_CAN_CERR ((unsigned int) 0x1 << 24) // (CAN) CRC Error +#define AT91C_CAN_SERR ((unsigned int) 0x1 << 25) // (CAN) Stuffing Error +#define AT91C_CAN_AERR ((unsigned int) 0x1 << 26) // (CAN) Acknowledgment Error +#define AT91C_CAN_FERR ((unsigned int) 0x1 << 27) // (CAN) Form Error +#define AT91C_CAN_BERR ((unsigned int) 0x1 << 28) // (CAN) Bit Error +// -------- CAN_IDR : (CAN Offset: 0x8) CAN Interrupt Disable Register -------- +// -------- CAN_IMR : (CAN Offset: 0xc) CAN Interrupt Mask Register -------- +// -------- CAN_SR : (CAN Offset: 0x10) CAN Status Register -------- +#define AT91C_CAN_RBSY ((unsigned int) 0x1 << 29) // (CAN) Receiver Busy +#define AT91C_CAN_TBSY ((unsigned int) 0x1 << 30) // (CAN) Transmitter Busy +#define AT91C_CAN_OVLY ((unsigned int) 0x1 << 31) // (CAN) Overload Busy +// -------- CAN_BR : (CAN Offset: 0x14) CAN Baudrate Register -------- +#define AT91C_CAN_PHASE2 ((unsigned int) 0x7 << 0) // (CAN) Phase 2 segment +#define AT91C_CAN_PHASE1 ((unsigned int) 0x7 << 4) // (CAN) Phase 1 segment +#define AT91C_CAN_PROPAG ((unsigned int) 0x7 << 8) // (CAN) Programmation time segment +#define AT91C_CAN_SYNC ((unsigned int) 0x3 << 12) // (CAN) Re-synchronization jump width segment +#define AT91C_CAN_BRP ((unsigned int) 0x7F << 16) // (CAN) Baudrate Prescaler +#define AT91C_CAN_SMP ((unsigned int) 0x1 << 24) // (CAN) Sampling mode +// -------- CAN_TIM : (CAN Offset: 0x18) CAN Timer Register -------- +#define AT91C_CAN_TIMER ((unsigned int) 0xFFFF << 0) // (CAN) Timer field +// -------- CAN_TIMESTP : (CAN Offset: 0x1c) CAN Timestamp Register -------- +// -------- CAN_ECR : (CAN Offset: 0x20) CAN Error Counter Register -------- +#define AT91C_CAN_REC ((unsigned int) 0xFF << 0) // (CAN) Receive Error Counter +#define AT91C_CAN_TEC ((unsigned int) 0xFF << 16) // (CAN) Transmit Error Counter +// -------- CAN_TCR : (CAN Offset: 0x24) CAN Transfer Command Register -------- +#define AT91C_CAN_TIMRST ((unsigned int) 0x1 << 31) // (CAN) Timer Reset Field +// -------- CAN_ACR : (CAN Offset: 0x28) CAN Abort Command Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Ethernet MAC 10/100 +// ***************************************************************************** +typedef struct _AT91S_EMAC { + AT91_REG EMAC_NCR; // Network Control Register + AT91_REG EMAC_NCFGR; // Network Configuration Register + AT91_REG EMAC_NSR; // Network Status Register + AT91_REG Reserved0[2]; // + AT91_REG EMAC_TSR; // Transmit Status Register + AT91_REG EMAC_RBQP; // Receive Buffer Queue Pointer + AT91_REG EMAC_TBQP; // Transmit Buffer Queue Pointer + AT91_REG EMAC_RSR; // Receive Status Register + AT91_REG EMAC_ISR; // Interrupt Status Register + AT91_REG EMAC_IER; // Interrupt Enable Register + AT91_REG EMAC_IDR; // Interrupt Disable Register + AT91_REG EMAC_IMR; // Interrupt Mask Register + AT91_REG EMAC_MAN; // PHY Maintenance Register + AT91_REG EMAC_PTR; // Pause Time Register + AT91_REG EMAC_PFR; // Pause Frames received Register + AT91_REG EMAC_FTO; // Frames Transmitted OK Register + AT91_REG EMAC_SCF; // Single Collision Frame Register + AT91_REG EMAC_MCF; // Multiple Collision Frame Register + AT91_REG EMAC_FRO; // Frames Received OK Register + AT91_REG EMAC_FCSE; // Frame Check Sequence Error Register + AT91_REG EMAC_ALE; // Alignment Error Register + AT91_REG EMAC_DTF; // Deferred Transmission Frame Register + AT91_REG EMAC_LCOL; // Late Collision Register + AT91_REG EMAC_ECOL; // Excessive Collision Register + AT91_REG EMAC_TUND; // Transmit Underrun Error Register + AT91_REG EMAC_CSE; // Carrier Sense Error Register + AT91_REG EMAC_RRE; // Receive Ressource Error Register + AT91_REG EMAC_ROV; // Receive Overrun Errors Register + AT91_REG EMAC_RSE; // Receive Symbol Errors Register + AT91_REG EMAC_ELE; // Excessive Length Errors Register + AT91_REG EMAC_RJA; // Receive Jabbers Register + AT91_REG EMAC_USF; // Undersize Frames Register + AT91_REG EMAC_STE; // SQE Test Error Register + AT91_REG EMAC_RLE; // Receive Length Field Mismatch Register + AT91_REG EMAC_TPF; // Transmitted Pause Frames Register + AT91_REG EMAC_HRB; // Hash Address Bottom[31:0] + AT91_REG EMAC_HRT; // Hash Address Top[63:32] + AT91_REG EMAC_SA1L; // Specific Address 1 Bottom, First 4 bytes + AT91_REG EMAC_SA1H; // Specific Address 1 Top, Last 2 bytes + AT91_REG EMAC_SA2L; // Specific Address 2 Bottom, First 4 bytes + AT91_REG EMAC_SA2H; // Specific Address 2 Top, Last 2 bytes + AT91_REG EMAC_SA3L; // Specific Address 3 Bottom, First 4 bytes + AT91_REG EMAC_SA3H; // Specific Address 3 Top, Last 2 bytes + AT91_REG EMAC_SA4L; // Specific Address 4 Bottom, First 4 bytes + AT91_REG EMAC_SA4H; // Specific Address 4 Top, Last 2 bytes + AT91_REG EMAC_TID; // Type ID Checking Register + AT91_REG EMAC_TPQ; // Transmit Pause Quantum Register + AT91_REG EMAC_USRIO; // USER Input/Output Register + AT91_REG EMAC_WOL; // Wake On LAN Register + AT91_REG Reserved1[13]; // + AT91_REG EMAC_REV; // Revision Register +} AT91S_EMAC, *AT91PS_EMAC; + +// -------- EMAC_NCR : (EMAC Offset: 0x0) -------- +#define AT91C_EMAC_LB ((unsigned int) 0x1 << 0) // (EMAC) Loopback. Optional. When set, loopback signal is at high level. +#define AT91C_EMAC_LLB ((unsigned int) 0x1 << 1) // (EMAC) Loopback local. +#define AT91C_EMAC_RE ((unsigned int) 0x1 << 2) // (EMAC) Receive enable. +#define AT91C_EMAC_TE ((unsigned int) 0x1 << 3) // (EMAC) Transmit enable. +#define AT91C_EMAC_MPE ((unsigned int) 0x1 << 4) // (EMAC) Management port enable. +#define AT91C_EMAC_CLRSTAT ((unsigned int) 0x1 << 5) // (EMAC) Clear statistics registers. +#define AT91C_EMAC_INCSTAT ((unsigned int) 0x1 << 6) // (EMAC) Increment statistics registers. +#define AT91C_EMAC_WESTAT ((unsigned int) 0x1 << 7) // (EMAC) Write enable for statistics registers. +#define AT91C_EMAC_BP ((unsigned int) 0x1 << 8) // (EMAC) Back pressure. +#define AT91C_EMAC_TSTART ((unsigned int) 0x1 << 9) // (EMAC) Start Transmission. +#define AT91C_EMAC_THALT ((unsigned int) 0x1 << 10) // (EMAC) Transmission Halt. +#define AT91C_EMAC_TPFR ((unsigned int) 0x1 << 11) // (EMAC) Transmit pause frame +#define AT91C_EMAC_TZQ ((unsigned int) 0x1 << 12) // (EMAC) Transmit zero quantum pause frame +// -------- EMAC_NCFGR : (EMAC Offset: 0x4) Network Configuration Register -------- +#define AT91C_EMAC_SPD ((unsigned int) 0x1 << 0) // (EMAC) Speed. +#define AT91C_EMAC_FD ((unsigned int) 0x1 << 1) // (EMAC) Full duplex. +#define AT91C_EMAC_JFRAME ((unsigned int) 0x1 << 3) // (EMAC) Jumbo Frames. +#define AT91C_EMAC_CAF ((unsigned int) 0x1 << 4) // (EMAC) Copy all frames. +#define AT91C_EMAC_NBC ((unsigned int) 0x1 << 5) // (EMAC) No broadcast. +#define AT91C_EMAC_MTI ((unsigned int) 0x1 << 6) // (EMAC) Multicast hash event enable +#define AT91C_EMAC_UNI ((unsigned int) 0x1 << 7) // (EMAC) Unicast hash enable. +#define AT91C_EMAC_BIG ((unsigned int) 0x1 << 8) // (EMAC) Receive 1522 bytes. +#define AT91C_EMAC_EAE ((unsigned int) 0x1 << 9) // (EMAC) External address match enable. +#define AT91C_EMAC_CLK ((unsigned int) 0x3 << 10) // (EMAC) +#define AT91C_EMAC_CLK_HCLK_8 ((unsigned int) 0x0 << 10) // (EMAC) HCLK divided by 8 +#define AT91C_EMAC_CLK_HCLK_16 ((unsigned int) 0x1 << 10) // (EMAC) HCLK divided by 16 +#define AT91C_EMAC_CLK_HCLK_32 ((unsigned int) 0x2 << 10) // (EMAC) HCLK divided by 32 +#define AT91C_EMAC_CLK_HCLK_64 ((unsigned int) 0x3 << 10) // (EMAC) HCLK divided by 64 +#define AT91C_EMAC_RTY ((unsigned int) 0x1 << 12) // (EMAC) +#define AT91C_EMAC_PAE ((unsigned int) 0x1 << 13) // (EMAC) +#define AT91C_EMAC_RBOF ((unsigned int) 0x3 << 14) // (EMAC) +#define AT91C_EMAC_RBOF_OFFSET_0 ((unsigned int) 0x0 << 14) // (EMAC) no offset from start of receive buffer +#define AT91C_EMAC_RBOF_OFFSET_1 ((unsigned int) 0x1 << 14) // (EMAC) one byte offset from start of receive buffer +#define AT91C_EMAC_RBOF_OFFSET_2 ((unsigned int) 0x2 << 14) // (EMAC) two bytes offset from start of receive buffer +#define AT91C_EMAC_RBOF_OFFSET_3 ((unsigned int) 0x3 << 14) // (EMAC) three bytes offset from start of receive buffer +#define AT91C_EMAC_RLCE ((unsigned int) 0x1 << 16) // (EMAC) Receive Length field Checking Enable +#define AT91C_EMAC_DRFCS ((unsigned int) 0x1 << 17) // (EMAC) Discard Receive FCS +#define AT91C_EMAC_EFRHD ((unsigned int) 0x1 << 18) // (EMAC) +#define AT91C_EMAC_IRXFCS ((unsigned int) 0x1 << 19) // (EMAC) Ignore RX FCS +// -------- EMAC_NSR : (EMAC Offset: 0x8) Network Status Register -------- +#define AT91C_EMAC_LINKR ((unsigned int) 0x1 << 0) // (EMAC) +#define AT91C_EMAC_MDIO ((unsigned int) 0x1 << 1) // (EMAC) +#define AT91C_EMAC_IDLE ((unsigned int) 0x1 << 2) // (EMAC) +// -------- EMAC_TSR : (EMAC Offset: 0x14) Transmit Status Register -------- +#define AT91C_EMAC_UBR ((unsigned int) 0x1 << 0) // (EMAC) +#define AT91C_EMAC_COL ((unsigned int) 0x1 << 1) // (EMAC) +#define AT91C_EMAC_RLES ((unsigned int) 0x1 << 2) // (EMAC) +#define AT91C_EMAC_TGO ((unsigned int) 0x1 << 3) // (EMAC) Transmit Go +#define AT91C_EMAC_BEX ((unsigned int) 0x1 << 4) // (EMAC) Buffers exhausted mid frame +#define AT91C_EMAC_COMP ((unsigned int) 0x1 << 5) // (EMAC) +#define AT91C_EMAC_UND ((unsigned int) 0x1 << 6) // (EMAC) +// -------- EMAC_RSR : (EMAC Offset: 0x20) Receive Status Register -------- +#define AT91C_EMAC_BNA ((unsigned int) 0x1 << 0) // (EMAC) +#define AT91C_EMAC_REC ((unsigned int) 0x1 << 1) // (EMAC) +#define AT91C_EMAC_OVR ((unsigned int) 0x1 << 2) // (EMAC) +// -------- EMAC_ISR : (EMAC Offset: 0x24) Interrupt Status Register -------- +#define AT91C_EMAC_MFD ((unsigned int) 0x1 << 0) // (EMAC) +#define AT91C_EMAC_RCOMP ((unsigned int) 0x1 << 1) // (EMAC) +#define AT91C_EMAC_RXUBR ((unsigned int) 0x1 << 2) // (EMAC) +#define AT91C_EMAC_TXUBR ((unsigned int) 0x1 << 3) // (EMAC) +#define AT91C_EMAC_TUNDR ((unsigned int) 0x1 << 4) // (EMAC) +#define AT91C_EMAC_RLEX ((unsigned int) 0x1 << 5) // (EMAC) +#define AT91C_EMAC_TXERR ((unsigned int) 0x1 << 6) // (EMAC) +#define AT91C_EMAC_TCOMP ((unsigned int) 0x1 << 7) // (EMAC) +#define AT91C_EMAC_LINK ((unsigned int) 0x1 << 9) // (EMAC) +#define AT91C_EMAC_ROVR ((unsigned int) 0x1 << 10) // (EMAC) +#define AT91C_EMAC_HRESP ((unsigned int) 0x1 << 11) // (EMAC) +#define AT91C_EMAC_PFRE ((unsigned int) 0x1 << 12) // (EMAC) +#define AT91C_EMAC_PTZ ((unsigned int) 0x1 << 13) // (EMAC) +// -------- EMAC_IER : (EMAC Offset: 0x28) Interrupt Enable Register -------- +// -------- EMAC_IDR : (EMAC Offset: 0x2c) Interrupt Disable Register -------- +// -------- EMAC_IMR : (EMAC Offset: 0x30) Interrupt Mask Register -------- +// -------- EMAC_MAN : (EMAC Offset: 0x34) PHY Maintenance Register -------- +#define AT91C_EMAC_DATA ((unsigned int) 0xFFFF << 0) // (EMAC) +#define AT91C_EMAC_CODE ((unsigned int) 0x3 << 16) // (EMAC) +#define AT91C_EMAC_REGA ((unsigned int) 0x1F << 18) // (EMAC) +#define AT91C_EMAC_PHYA ((unsigned int) 0x1F << 23) // (EMAC) +#define AT91C_EMAC_RW ((unsigned int) 0x3 << 28) // (EMAC) +#define AT91C_EMAC_SOF ((unsigned int) 0x3 << 30) // (EMAC) +// -------- EMAC_USRIO : (EMAC Offset: 0xc0) USER Input Output Register -------- +#define AT91C_EMAC_RMII ((unsigned int) 0x1 << 0) // (EMAC) Reduce MII +#define AT91C_EMAC_CLKEN ((unsigned int) 0x1 << 1) // (EMAC) Clock Enable +// -------- EMAC_WOL : (EMAC Offset: 0xc4) Wake On LAN Register -------- +#define AT91C_EMAC_IP ((unsigned int) 0xFFFF << 0) // (EMAC) ARP request IP address +#define AT91C_EMAC_MAG ((unsigned int) 0x1 << 16) // (EMAC) Magic packet event enable +#define AT91C_EMAC_ARP ((unsigned int) 0x1 << 17) // (EMAC) ARP request event enable +#define AT91C_EMAC_SA1 ((unsigned int) 0x1 << 18) // (EMAC) Specific address register 1 event enable +// -------- EMAC_REV : (EMAC Offset: 0xfc) Revision Register -------- +#define AT91C_EMAC_REVREF ((unsigned int) 0xFFFF << 0) // (EMAC) +#define AT91C_EMAC_PARTREF ((unsigned int) 0xFFFF << 16) // (EMAC) + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Analog to Digital Convertor +// ***************************************************************************** +typedef struct _AT91S_ADC { + AT91_REG ADC_CR; // ADC Control Register + AT91_REG ADC_MR; // ADC Mode Register + AT91_REG Reserved0[2]; // + AT91_REG ADC_CHER; // ADC Channel Enable Register + AT91_REG ADC_CHDR; // ADC Channel Disable Register + AT91_REG ADC_CHSR; // ADC Channel Status Register + AT91_REG ADC_SR; // ADC Status Register + AT91_REG ADC_LCDR; // ADC Last Converted Data Register + AT91_REG ADC_IER; // ADC Interrupt Enable Register + AT91_REG ADC_IDR; // ADC Interrupt Disable Register + AT91_REG ADC_IMR; // ADC Interrupt Mask Register + AT91_REG ADC_CDR0; // ADC Channel Data Register 0 + AT91_REG ADC_CDR1; // ADC Channel Data Register 1 + AT91_REG ADC_CDR2; // ADC Channel Data Register 2 + AT91_REG ADC_CDR3; // ADC Channel Data Register 3 + AT91_REG ADC_CDR4; // ADC Channel Data Register 4 + AT91_REG ADC_CDR5; // ADC Channel Data Register 5 + AT91_REG ADC_CDR6; // ADC Channel Data Register 6 + AT91_REG ADC_CDR7; // ADC Channel Data Register 7 + AT91_REG Reserved1[44]; // + AT91_REG ADC_RPR; // Receive Pointer Register + AT91_REG ADC_RCR; // Receive Counter Register + AT91_REG ADC_TPR; // Transmit Pointer Register + AT91_REG ADC_TCR; // Transmit Counter Register + AT91_REG ADC_RNPR; // Receive Next Pointer Register + AT91_REG ADC_RNCR; // Receive Next Counter Register + AT91_REG ADC_TNPR; // Transmit Next Pointer Register + AT91_REG ADC_TNCR; // Transmit Next Counter Register + AT91_REG ADC_PTCR; // PDC Transfer Control Register + AT91_REG ADC_PTSR; // PDC Transfer Status Register +} AT91S_ADC, *AT91PS_ADC; + +// -------- ADC_CR : (ADC Offset: 0x0) ADC Control Register -------- +#define AT91C_ADC_SWRST ((unsigned int) 0x1 << 0) // (ADC) Software Reset +#define AT91C_ADC_START ((unsigned int) 0x1 << 1) // (ADC) Start Conversion +// -------- ADC_MR : (ADC Offset: 0x4) ADC Mode Register -------- +#define AT91C_ADC_TRGEN ((unsigned int) 0x1 << 0) // (ADC) Trigger Enable +#define AT91C_ADC_TRGEN_DIS ((unsigned int) 0x0) // (ADC) Hradware triggers are disabled. Starting a conversion is only possible by software +#define AT91C_ADC_TRGEN_EN ((unsigned int) 0x1) // (ADC) Hardware trigger selected by TRGSEL field is enabled. +#define AT91C_ADC_TRGSEL ((unsigned int) 0x7 << 1) // (ADC) Trigger Selection +#define AT91C_ADC_TRGSEL_TIOA0 ((unsigned int) 0x0 << 1) // (ADC) Selected TRGSEL = TIAO0 +#define AT91C_ADC_TRGSEL_TIOA1 ((unsigned int) 0x1 << 1) // (ADC) Selected TRGSEL = TIAO1 +#define AT91C_ADC_TRGSEL_TIOA2 ((unsigned int) 0x2 << 1) // (ADC) Selected TRGSEL = TIAO2 +#define AT91C_ADC_TRGSEL_TIOA3 ((unsigned int) 0x3 << 1) // (ADC) Selected TRGSEL = TIAO3 +#define AT91C_ADC_TRGSEL_TIOA4 ((unsigned int) 0x4 << 1) // (ADC) Selected TRGSEL = TIAO4 +#define AT91C_ADC_TRGSEL_TIOA5 ((unsigned int) 0x5 << 1) // (ADC) Selected TRGSEL = TIAO5 +#define AT91C_ADC_TRGSEL_EXT ((unsigned int) 0x6 << 1) // (ADC) Selected TRGSEL = External Trigger +#define AT91C_ADC_LOWRES ((unsigned int) 0x1 << 4) // (ADC) Resolution. +#define AT91C_ADC_LOWRES_10_BIT ((unsigned int) 0x0 << 4) // (ADC) 10-bit resolution +#define AT91C_ADC_LOWRES_8_BIT ((unsigned int) 0x1 << 4) // (ADC) 8-bit resolution +#define AT91C_ADC_SLEEP ((unsigned int) 0x1 << 5) // (ADC) Sleep Mode +#define AT91C_ADC_SLEEP_NORMAL_MODE ((unsigned int) 0x0 << 5) // (ADC) Normal Mode +#define AT91C_ADC_SLEEP_MODE ((unsigned int) 0x1 << 5) // (ADC) Sleep Mode +#define AT91C_ADC_PRESCAL ((unsigned int) 0x3F << 8) // (ADC) Prescaler rate selection +#define AT91C_ADC_STARTUP ((unsigned int) 0x1F << 16) // (ADC) Startup Time +#define AT91C_ADC_SHTIM ((unsigned int) 0xF << 24) // (ADC) Sample & Hold Time +// -------- ADC_CHER : (ADC Offset: 0x10) ADC Channel Enable Register -------- +#define AT91C_ADC_CH0 ((unsigned int) 0x1 << 0) // (ADC) Channel 0 +#define AT91C_ADC_CH1 ((unsigned int) 0x1 << 1) // (ADC) Channel 1 +#define AT91C_ADC_CH2 ((unsigned int) 0x1 << 2) // (ADC) Channel 2 +#define AT91C_ADC_CH3 ((unsigned int) 0x1 << 3) // (ADC) Channel 3 +#define AT91C_ADC_CH4 ((unsigned int) 0x1 << 4) // (ADC) Channel 4 +#define AT91C_ADC_CH5 ((unsigned int) 0x1 << 5) // (ADC) Channel 5 +#define AT91C_ADC_CH6 ((unsigned int) 0x1 << 6) // (ADC) Channel 6 +#define AT91C_ADC_CH7 ((unsigned int) 0x1 << 7) // (ADC) Channel 7 +// -------- ADC_CHDR : (ADC Offset: 0x14) ADC Channel Disable Register -------- +// -------- ADC_CHSR : (ADC Offset: 0x18) ADC Channel Status Register -------- +// -------- ADC_SR : (ADC Offset: 0x1c) ADC Status Register -------- +#define AT91C_ADC_EOC0 ((unsigned int) 0x1 << 0) // (ADC) End of Conversion +#define AT91C_ADC_EOC1 ((unsigned int) 0x1 << 1) // (ADC) End of Conversion +#define AT91C_ADC_EOC2 ((unsigned int) 0x1 << 2) // (ADC) End of Conversion +#define AT91C_ADC_EOC3 ((unsigned int) 0x1 << 3) // (ADC) End of Conversion +#define AT91C_ADC_EOC4 ((unsigned int) 0x1 << 4) // (ADC) End of Conversion +#define AT91C_ADC_EOC5 ((unsigned int) 0x1 << 5) // (ADC) End of Conversion +#define AT91C_ADC_EOC6 ((unsigned int) 0x1 << 6) // (ADC) End of Conversion +#define AT91C_ADC_EOC7 ((unsigned int) 0x1 << 7) // (ADC) End of Conversion +#define AT91C_ADC_OVRE0 ((unsigned int) 0x1 << 8) // (ADC) Overrun Error +#define AT91C_ADC_OVRE1 ((unsigned int) 0x1 << 9) // (ADC) Overrun Error +#define AT91C_ADC_OVRE2 ((unsigned int) 0x1 << 10) // (ADC) Overrun Error +#define AT91C_ADC_OVRE3 ((unsigned int) 0x1 << 11) // (ADC) Overrun Error +#define AT91C_ADC_OVRE4 ((unsigned int) 0x1 << 12) // (ADC) Overrun Error +#define AT91C_ADC_OVRE5 ((unsigned int) 0x1 << 13) // (ADC) Overrun Error +#define AT91C_ADC_OVRE6 ((unsigned int) 0x1 << 14) // (ADC) Overrun Error +#define AT91C_ADC_OVRE7 ((unsigned int) 0x1 << 15) // (ADC) Overrun Error +#define AT91C_ADC_DRDY ((unsigned int) 0x1 << 16) // (ADC) Data Ready +#define AT91C_ADC_GOVRE ((unsigned int) 0x1 << 17) // (ADC) General Overrun +#define AT91C_ADC_ENDRX ((unsigned int) 0x1 << 18) // (ADC) End of Receiver Transfer +#define AT91C_ADC_RXBUFF ((unsigned int) 0x1 << 19) // (ADC) RXBUFF Interrupt +// -------- ADC_LCDR : (ADC Offset: 0x20) ADC Last Converted Data Register -------- +#define AT91C_ADC_LDATA ((unsigned int) 0x3FF << 0) // (ADC) Last Data Converted +// -------- ADC_IER : (ADC Offset: 0x24) ADC Interrupt Enable Register -------- +// -------- ADC_IDR : (ADC Offset: 0x28) ADC Interrupt Disable Register -------- +// -------- ADC_IMR : (ADC Offset: 0x2c) ADC Interrupt Mask Register -------- +// -------- ADC_CDR0 : (ADC Offset: 0x30) ADC Channel Data Register 0 -------- +#define AT91C_ADC_DATA ((unsigned int) 0x3FF << 0) // (ADC) Converted Data +// -------- ADC_CDR1 : (ADC Offset: 0x34) ADC Channel Data Register 1 -------- +// -------- ADC_CDR2 : (ADC Offset: 0x38) ADC Channel Data Register 2 -------- +// -------- ADC_CDR3 : (ADC Offset: 0x3c) ADC Channel Data Register 3 -------- +// -------- ADC_CDR4 : (ADC Offset: 0x40) ADC Channel Data Register 4 -------- +// -------- ADC_CDR5 : (ADC Offset: 0x44) ADC Channel Data Register 5 -------- +// -------- ADC_CDR6 : (ADC Offset: 0x48) ADC Channel Data Register 6 -------- +// -------- ADC_CDR7 : (ADC Offset: 0x4c) ADC Channel Data Register 7 -------- + +// ***************************************************************************** +// REGISTER ADDRESS DEFINITION FOR AT91SAM7X256 +// ***************************************************************************** +// ========== Register definition for SYS peripheral ========== +// ========== Register definition for AIC peripheral ========== +#define AT91C_AIC_IVR ((AT91_REG *) 0xFFFFF100) // (AIC) IRQ Vector Register +#define AT91C_AIC_SMR ((AT91_REG *) 0xFFFFF000) // (AIC) Source Mode Register +#define AT91C_AIC_FVR ((AT91_REG *) 0xFFFFF104) // (AIC) FIQ Vector Register +#define AT91C_AIC_DCR ((AT91_REG *) 0xFFFFF138) // (AIC) Debug Control Register (Protect) +#define AT91C_AIC_EOICR ((AT91_REG *) 0xFFFFF130) // (AIC) End of Interrupt Command Register +#define AT91C_AIC_SVR ((AT91_REG *) 0xFFFFF080) // (AIC) Source Vector Register +#define AT91C_AIC_FFSR ((AT91_REG *) 0xFFFFF148) // (AIC) Fast Forcing Status Register +#define AT91C_AIC_ICCR ((AT91_REG *) 0xFFFFF128) // (AIC) Interrupt Clear Command Register +#define AT91C_AIC_ISR ((AT91_REG *) 0xFFFFF108) // (AIC) Interrupt Status Register +#define AT91C_AIC_IMR ((AT91_REG *) 0xFFFFF110) // (AIC) Interrupt Mask Register +#define AT91C_AIC_IPR ((AT91_REG *) 0xFFFFF10C) // (AIC) Interrupt Pending Register +#define AT91C_AIC_FFER ((AT91_REG *) 0xFFFFF140) // (AIC) Fast Forcing Enable Register +#define AT91C_AIC_IECR ((AT91_REG *) 0xFFFFF120) // (AIC) Interrupt Enable Command Register +#define AT91C_AIC_ISCR ((AT91_REG *) 0xFFFFF12C) // (AIC) Interrupt Set Command Register +#define AT91C_AIC_FFDR ((AT91_REG *) 0xFFFFF144) // (AIC) Fast Forcing Disable Register +#define AT91C_AIC_CISR ((AT91_REG *) 0xFFFFF114) // (AIC) Core Interrupt Status Register +#define AT91C_AIC_IDCR ((AT91_REG *) 0xFFFFF124) // (AIC) Interrupt Disable Command Register +#define AT91C_AIC_SPU ((AT91_REG *) 0xFFFFF134) // (AIC) Spurious Vector Register +// ========== Register definition for PDC_DBGU peripheral ========== +#define AT91C_DBGU_TCR ((AT91_REG *) 0xFFFFF30C) // (PDC_DBGU) Transmit Counter Register +#define AT91C_DBGU_RNPR ((AT91_REG *) 0xFFFFF310) // (PDC_DBGU) Receive Next Pointer Register +#define AT91C_DBGU_TNPR ((AT91_REG *) 0xFFFFF318) // (PDC_DBGU) Transmit Next Pointer Register +#define AT91C_DBGU_TPR ((AT91_REG *) 0xFFFFF308) // (PDC_DBGU) Transmit Pointer Register +#define AT91C_DBGU_RPR ((AT91_REG *) 0xFFFFF300) // (PDC_DBGU) Receive Pointer Register +#define AT91C_DBGU_RCR ((AT91_REG *) 0xFFFFF304) // (PDC_DBGU) Receive Counter Register +#define AT91C_DBGU_RNCR ((AT91_REG *) 0xFFFFF314) // (PDC_DBGU) Receive Next Counter Register +#define AT91C_DBGU_PTCR ((AT91_REG *) 0xFFFFF320) // (PDC_DBGU) PDC Transfer Control Register +#define AT91C_DBGU_PTSR ((AT91_REG *) 0xFFFFF324) // (PDC_DBGU) PDC Transfer Status Register +#define AT91C_DBGU_TNCR ((AT91_REG *) 0xFFFFF31C) // (PDC_DBGU) Transmit Next Counter Register +// ========== Register definition for DBGU peripheral ========== +#define AT91C_DBGU_EXID ((AT91_REG *) 0xFFFFF244) // (DBGU) Chip ID Extension Register +#define AT91C_DBGU_BRGR ((AT91_REG *) 0xFFFFF220) // (DBGU) Baud Rate Generator Register +#define AT91C_DBGU_IDR ((AT91_REG *) 0xFFFFF20C) // (DBGU) Interrupt Disable Register +#define AT91C_DBGU_CSR ((AT91_REG *) 0xFFFFF214) // (DBGU) Channel Status Register +#define AT91C_DBGU_CIDR ((AT91_REG *) 0xFFFFF240) // (DBGU) Chip ID Register +#define AT91C_DBGU_MR ((AT91_REG *) 0xFFFFF204) // (DBGU) Mode Register +#define AT91C_DBGU_IMR ((AT91_REG *) 0xFFFFF210) // (DBGU) Interrupt Mask Register +#define AT91C_DBGU_CR ((AT91_REG *) 0xFFFFF200) // (DBGU) Control Register +#define AT91C_DBGU_FNTR ((AT91_REG *) 0xFFFFF248) // (DBGU) Force NTRST Register +#define AT91C_DBGU_THR ((AT91_REG *) 0xFFFFF21C) // (DBGU) Transmitter Holding Register +#define AT91C_DBGU_RHR ((AT91_REG *) 0xFFFFF218) // (DBGU) Receiver Holding Register +#define AT91C_DBGU_IER ((AT91_REG *) 0xFFFFF208) // (DBGU) Interrupt Enable Register +// ========== Register definition for PIOA peripheral ========== +#define AT91C_PIOA_ODR ((AT91_REG *) 0xFFFFF414) // (PIOA) Output Disable Registerr +#define AT91C_PIOA_SODR ((AT91_REG *) 0xFFFFF430) // (PIOA) Set Output Data Register +#define AT91C_PIOA_ISR ((AT91_REG *) 0xFFFFF44C) // (PIOA) Interrupt Status Register +#define AT91C_PIOA_ABSR ((AT91_REG *) 0xFFFFF478) // (PIOA) AB Select Status Register +#define AT91C_PIOA_IER ((AT91_REG *) 0xFFFFF440) // (PIOA) Interrupt Enable Register +#define AT91C_PIOA_PPUDR ((AT91_REG *) 0xFFFFF460) // (PIOA) Pull-up Disable Register +#define AT91C_PIOA_IMR ((AT91_REG *) 0xFFFFF448) // (PIOA) Interrupt Mask Register +#define AT91C_PIOA_PER ((AT91_REG *) 0xFFFFF400) // (PIOA) PIO Enable Register +#define AT91C_PIOA_IFDR ((AT91_REG *) 0xFFFFF424) // (PIOA) Input Filter Disable Register +#define AT91C_PIOA_OWDR ((AT91_REG *) 0xFFFFF4A4) // (PIOA) Output Write Disable Register +#define AT91C_PIOA_MDSR ((AT91_REG *) 0xFFFFF458) // (PIOA) Multi-driver Status Register +#define AT91C_PIOA_IDR ((AT91_REG *) 0xFFFFF444) // (PIOA) Interrupt Disable Register +#define AT91C_PIOA_ODSR ((AT91_REG *) 0xFFFFF438) // (PIOA) Output Data Status Register +#define AT91C_PIOA_PPUSR ((AT91_REG *) 0xFFFFF468) // (PIOA) Pull-up Status Register +#define AT91C_PIOA_OWSR ((AT91_REG *) 0xFFFFF4A8) // (PIOA) Output Write Status Register +#define AT91C_PIOA_BSR ((AT91_REG *) 0xFFFFF474) // (PIOA) Select B Register +#define AT91C_PIOA_OWER ((AT91_REG *) 0xFFFFF4A0) // (PIOA) Output Write Enable Register +#define AT91C_PIOA_IFER ((AT91_REG *) 0xFFFFF420) // (PIOA) Input Filter Enable Register +#define AT91C_PIOA_PDSR ((AT91_REG *) 0xFFFFF43C) // (PIOA) Pin Data Status Register +#define AT91C_PIOA_PPUER ((AT91_REG *) 0xFFFFF464) // (PIOA) Pull-up Enable Register +#define AT91C_PIOA_OSR ((AT91_REG *) 0xFFFFF418) // (PIOA) Output Status Register +#define AT91C_PIOA_ASR ((AT91_REG *) 0xFFFFF470) // (PIOA) Select A Register +#define AT91C_PIOA_MDDR ((AT91_REG *) 0xFFFFF454) // (PIOA) Multi-driver Disable Register +#define AT91C_PIOA_CODR ((AT91_REG *) 0xFFFFF434) // (PIOA) Clear Output Data Register +#define AT91C_PIOA_MDER ((AT91_REG *) 0xFFFFF450) // (PIOA) Multi-driver Enable Register +#define AT91C_PIOA_PDR ((AT91_REG *) 0xFFFFF404) // (PIOA) PIO Disable Register +#define AT91C_PIOA_IFSR ((AT91_REG *) 0xFFFFF428) // (PIOA) Input Filter Status Register +#define AT91C_PIOA_OER ((AT91_REG *) 0xFFFFF410) // (PIOA) Output Enable Register +#define AT91C_PIOA_PSR ((AT91_REG *) 0xFFFFF408) // (PIOA) PIO Status Register +// ========== Register definition for PIOB peripheral ========== +#define AT91C_PIOB_OWDR ((AT91_REG *) 0xFFFFF6A4) // (PIOB) Output Write Disable Register +#define AT91C_PIOB_MDER ((AT91_REG *) 0xFFFFF650) // (PIOB) Multi-driver Enable Register +#define AT91C_PIOB_PPUSR ((AT91_REG *) 0xFFFFF668) // (PIOB) Pull-up Status Register +#define AT91C_PIOB_IMR ((AT91_REG *) 0xFFFFF648) // (PIOB) Interrupt Mask Register +#define AT91C_PIOB_ASR ((AT91_REG *) 0xFFFFF670) // (PIOB) Select A Register +#define AT91C_PIOB_PPUDR ((AT91_REG *) 0xFFFFF660) // (PIOB) Pull-up Disable Register +#define AT91C_PIOB_PSR ((AT91_REG *) 0xFFFFF608) // (PIOB) PIO Status Register +#define AT91C_PIOB_IER ((AT91_REG *) 0xFFFFF640) // (PIOB) Interrupt Enable Register +#define AT91C_PIOB_CODR ((AT91_REG *) 0xFFFFF634) // (PIOB) Clear Output Data Register +#define AT91C_PIOB_OWER ((AT91_REG *) 0xFFFFF6A0) // (PIOB) Output Write Enable Register +#define AT91C_PIOB_ABSR ((AT91_REG *) 0xFFFFF678) // (PIOB) AB Select Status Register +#define AT91C_PIOB_IFDR ((AT91_REG *) 0xFFFFF624) // (PIOB) Input Filter Disable Register +#define AT91C_PIOB_PDSR ((AT91_REG *) 0xFFFFF63C) // (PIOB) Pin Data Status Register +#define AT91C_PIOB_IDR ((AT91_REG *) 0xFFFFF644) // (PIOB) Interrupt Disable Register +#define AT91C_PIOB_OWSR ((AT91_REG *) 0xFFFFF6A8) // (PIOB) Output Write Status Register +#define AT91C_PIOB_PDR ((AT91_REG *) 0xFFFFF604) // (PIOB) PIO Disable Register +#define AT91C_PIOB_ODR ((AT91_REG *) 0xFFFFF614) // (PIOB) Output Disable Registerr +#define AT91C_PIOB_IFSR ((AT91_REG *) 0xFFFFF628) // (PIOB) Input Filter Status Register +#define AT91C_PIOB_PPUER ((AT91_REG *) 0xFFFFF664) // (PIOB) Pull-up Enable Register +#define AT91C_PIOB_SODR ((AT91_REG *) 0xFFFFF630) // (PIOB) Set Output Data Register +#define AT91C_PIOB_ISR ((AT91_REG *) 0xFFFFF64C) // (PIOB) Interrupt Status Register +#define AT91C_PIOB_ODSR ((AT91_REG *) 0xFFFFF638) // (PIOB) Output Data Status Register +#define AT91C_PIOB_OSR ((AT91_REG *) 0xFFFFF618) // (PIOB) Output Status Register +#define AT91C_PIOB_MDSR ((AT91_REG *) 0xFFFFF658) // (PIOB) Multi-driver Status Register +#define AT91C_PIOB_IFER ((AT91_REG *) 0xFFFFF620) // (PIOB) Input Filter Enable Register +#define AT91C_PIOB_BSR ((AT91_REG *) 0xFFFFF674) // (PIOB) Select B Register +#define AT91C_PIOB_MDDR ((AT91_REG *) 0xFFFFF654) // (PIOB) Multi-driver Disable Register +#define AT91C_PIOB_OER ((AT91_REG *) 0xFFFFF610) // (PIOB) Output Enable Register +#define AT91C_PIOB_PER ((AT91_REG *) 0xFFFFF600) // (PIOB) PIO Enable Register +// ========== Register definition for CKGR peripheral ========== +#define AT91C_CKGR_MOR ((AT91_REG *) 0xFFFFFC20) // (CKGR) Main Oscillator Register +#define AT91C_CKGR_PLLR ((AT91_REG *) 0xFFFFFC2C) // (CKGR) PLL Register +#define AT91C_CKGR_MCFR ((AT91_REG *) 0xFFFFFC24) // (CKGR) Main Clock Frequency Register +// ========== Register definition for PMC peripheral ========== +#define AT91C_PMC_IDR ((AT91_REG *) 0xFFFFFC64) // (PMC) Interrupt Disable Register +#define AT91C_PMC_MOR ((AT91_REG *) 0xFFFFFC20) // (PMC) Main Oscillator Register +#define AT91C_PMC_PLLR ((AT91_REG *) 0xFFFFFC2C) // (PMC) PLL Register +#define AT91C_PMC_PCER ((AT91_REG *) 0xFFFFFC10) // (PMC) Peripheral Clock Enable Register +#define AT91C_PMC_PCKR ((AT91_REG *) 0xFFFFFC40) // (PMC) Programmable Clock Register +#define AT91C_PMC_MCKR ((AT91_REG *) 0xFFFFFC30) // (PMC) Master Clock Register +#define AT91C_PMC_SCDR ((AT91_REG *) 0xFFFFFC04) // (PMC) System Clock Disable Register +#define AT91C_PMC_PCDR ((AT91_REG *) 0xFFFFFC14) // (PMC) Peripheral Clock Disable Register +#define AT91C_PMC_SCSR ((AT91_REG *) 0xFFFFFC08) // (PMC) System Clock Status Register +#define AT91C_PMC_PCSR ((AT91_REG *) 0xFFFFFC18) // (PMC) Peripheral Clock Status Register +#define AT91C_PMC_MCFR ((AT91_REG *) 0xFFFFFC24) // (PMC) Main Clock Frequency Register +#define AT91C_PMC_SCER ((AT91_REG *) 0xFFFFFC00) // (PMC) System Clock Enable Register +#define AT91C_PMC_IMR ((AT91_REG *) 0xFFFFFC6C) // (PMC) Interrupt Mask Register +#define AT91C_PMC_IER ((AT91_REG *) 0xFFFFFC60) // (PMC) Interrupt Enable Register +#define AT91C_PMC_SR ((AT91_REG *) 0xFFFFFC68) // (PMC) Status Register +// ========== Register definition for RSTC peripheral ========== +#define AT91C_RSTC_RCR ((AT91_REG *) 0xFFFFFD00) // (RSTC) Reset Control Register +#define AT91C_RSTC_RMR ((AT91_REG *) 0xFFFFFD08) // (RSTC) Reset Mode Register +#define AT91C_RSTC_RSR ((AT91_REG *) 0xFFFFFD04) // (RSTC) Reset Status Register +// ========== Register definition for RTTC peripheral ========== +#define AT91C_RTTC_RTSR ((AT91_REG *) 0xFFFFFD2C) // (RTTC) Real-time Status Register +#define AT91C_RTTC_RTMR ((AT91_REG *) 0xFFFFFD20) // (RTTC) Real-time Mode Register +#define AT91C_RTTC_RTVR ((AT91_REG *) 0xFFFFFD28) // (RTTC) Real-time Value Register +#define AT91C_RTTC_RTAR ((AT91_REG *) 0xFFFFFD24) // (RTTC) Real-time Alarm Register +// ========== Register definition for PITC peripheral ========== +#define AT91C_PITC_PIVR ((AT91_REG *) 0xFFFFFD38) // (PITC) Period Interval Value Register +#define AT91C_PITC_PISR ((AT91_REG *) 0xFFFFFD34) // (PITC) Period Interval Status Register +#define AT91C_PITC_PIIR ((AT91_REG *) 0xFFFFFD3C) // (PITC) Period Interval Image Register +#define AT91C_PITC_PIMR ((AT91_REG *) 0xFFFFFD30) // (PITC) Period Interval Mode Register +// ========== Register definition for WDTC peripheral ========== +#define AT91C_WDTC_WDCR ((AT91_REG *) 0xFFFFFD40) // (WDTC) Watchdog Control Register +#define AT91C_WDTC_WDSR ((AT91_REG *) 0xFFFFFD48) // (WDTC) Watchdog Status Register +#define AT91C_WDTC_WDMR ((AT91_REG *) 0xFFFFFD44) // (WDTC) Watchdog Mode Register +// ========== Register definition for VREG peripheral ========== +#define AT91C_VREG_MR ((AT91_REG *) 0xFFFFFD60) // (VREG) Voltage Regulator Mode Register +// ========== Register definition for MC peripheral ========== +#define AT91C_MC_ASR ((AT91_REG *) 0xFFFFFF04) // (MC) MC Abort Status Register +#define AT91C_MC_RCR ((AT91_REG *) 0xFFFFFF00) // (MC) MC Remap Control Register +#define AT91C_MC_FCR ((AT91_REG *) 0xFFFFFF64) // (MC) MC Flash Command Register +#define AT91C_MC_AASR ((AT91_REG *) 0xFFFFFF08) // (MC) MC Abort Address Status Register +#define AT91C_MC_FSR ((AT91_REG *) 0xFFFFFF68) // (MC) MC Flash Status Register +#define AT91C_MC_FMR ((AT91_REG *) 0xFFFFFF60) // (MC) MC Flash Mode Register +// ========== Register definition for PDC_SPI1 peripheral ========== +#define AT91C_SPI1_PTCR ((AT91_REG *) 0xFFFE4120) // (PDC_SPI1) PDC Transfer Control Register +#define AT91C_SPI1_RPR ((AT91_REG *) 0xFFFE4100) // (PDC_SPI1) Receive Pointer Register +#define AT91C_SPI1_TNCR ((AT91_REG *) 0xFFFE411C) // (PDC_SPI1) Transmit Next Counter Register +#define AT91C_SPI1_TPR ((AT91_REG *) 0xFFFE4108) // (PDC_SPI1) Transmit Pointer Register +#define AT91C_SPI1_TNPR ((AT91_REG *) 0xFFFE4118) // (PDC_SPI1) Transmit Next Pointer Register +#define AT91C_SPI1_TCR ((AT91_REG *) 0xFFFE410C) // (PDC_SPI1) Transmit Counter Register +#define AT91C_SPI1_RCR ((AT91_REG *) 0xFFFE4104) // (PDC_SPI1) Receive Counter Register +#define AT91C_SPI1_RNPR ((AT91_REG *) 0xFFFE4110) // (PDC_SPI1) Receive Next Pointer Register +#define AT91C_SPI1_RNCR ((AT91_REG *) 0xFFFE4114) // (PDC_SPI1) Receive Next Counter Register +#define AT91C_SPI1_PTSR ((AT91_REG *) 0xFFFE4124) // (PDC_SPI1) PDC Transfer Status Register +// ========== Register definition for SPI1 peripheral ========== +#define AT91C_SPI1_IMR ((AT91_REG *) 0xFFFE401C) // (SPI1) Interrupt Mask Register +#define AT91C_SPI1_IER ((AT91_REG *) 0xFFFE4014) // (SPI1) Interrupt Enable Register +#define AT91C_SPI1_MR ((AT91_REG *) 0xFFFE4004) // (SPI1) Mode Register +#define AT91C_SPI1_RDR ((AT91_REG *) 0xFFFE4008) // (SPI1) Receive Data Register +#define AT91C_SPI1_IDR ((AT91_REG *) 0xFFFE4018) // (SPI1) Interrupt Disable Register +#define AT91C_SPI1_SR ((AT91_REG *) 0xFFFE4010) // (SPI1) Status Register +#define AT91C_SPI1_TDR ((AT91_REG *) 0xFFFE400C) // (SPI1) Transmit Data Register +#define AT91C_SPI1_CR ((AT91_REG *) 0xFFFE4000) // (SPI1) Control Register +#define AT91C_SPI1_CSR ((AT91_REG *) 0xFFFE4030) // (SPI1) Chip Select Register +// ========== Register definition for PDC_SPI0 peripheral ========== +#define AT91C_SPI0_PTCR ((AT91_REG *) 0xFFFE0120) // (PDC_SPI0) PDC Transfer Control Register +#define AT91C_SPI0_TPR ((AT91_REG *) 0xFFFE0108) // (PDC_SPI0) Transmit Pointer Register +#define AT91C_SPI0_TCR ((AT91_REG *) 0xFFFE010C) // (PDC_SPI0) Transmit Counter Register +#define AT91C_SPI0_RCR ((AT91_REG *) 0xFFFE0104) // (PDC_SPI0) Receive Counter Register +#define AT91C_SPI0_PTSR ((AT91_REG *) 0xFFFE0124) // (PDC_SPI0) PDC Transfer Status Register +#define AT91C_SPI0_RNPR ((AT91_REG *) 0xFFFE0110) // (PDC_SPI0) Receive Next Pointer Register +#define AT91C_SPI0_RPR ((AT91_REG *) 0xFFFE0100) // (PDC_SPI0) Receive Pointer Register +#define AT91C_SPI0_TNCR ((AT91_REG *) 0xFFFE011C) // (PDC_SPI0) Transmit Next Counter Register +#define AT91C_SPI0_RNCR ((AT91_REG *) 0xFFFE0114) // (PDC_SPI0) Receive Next Counter Register +#define AT91C_SPI0_TNPR ((AT91_REG *) 0xFFFE0118) // (PDC_SPI0) Transmit Next Pointer Register +// ========== Register definition for SPI0 peripheral ========== +#define AT91C_SPI0_IER ((AT91_REG *) 0xFFFE0014) // (SPI0) Interrupt Enable Register +#define AT91C_SPI0_SR ((AT91_REG *) 0xFFFE0010) // (SPI0) Status Register +#define AT91C_SPI0_IDR ((AT91_REG *) 0xFFFE0018) // (SPI0) Interrupt Disable Register +#define AT91C_SPI0_CR ((AT91_REG *) 0xFFFE0000) // (SPI0) Control Register +#define AT91C_SPI0_MR ((AT91_REG *) 0xFFFE0004) // (SPI0) Mode Register +#define AT91C_SPI0_IMR ((AT91_REG *) 0xFFFE001C) // (SPI0) Interrupt Mask Register +#define AT91C_SPI0_TDR ((AT91_REG *) 0xFFFE000C) // (SPI0) Transmit Data Register +#define AT91C_SPI0_RDR ((AT91_REG *) 0xFFFE0008) // (SPI0) Receive Data Register +#define AT91C_SPI0_CSR ((AT91_REG *) 0xFFFE0030) // (SPI0) Chip Select Register +// ========== Register definition for PDC_US1 peripheral ========== +#define AT91C_US1_RNCR ((AT91_REG *) 0xFFFC4114) // (PDC_US1) Receive Next Counter Register +#define AT91C_US1_PTCR ((AT91_REG *) 0xFFFC4120) // (PDC_US1) PDC Transfer Control Register +#define AT91C_US1_TCR ((AT91_REG *) 0xFFFC410C) // (PDC_US1) Transmit Counter Register +#define AT91C_US1_PTSR ((AT91_REG *) 0xFFFC4124) // (PDC_US1) PDC Transfer Status Register +#define AT91C_US1_TNPR ((AT91_REG *) 0xFFFC4118) // (PDC_US1) Transmit Next Pointer Register +#define AT91C_US1_RCR ((AT91_REG *) 0xFFFC4104) // (PDC_US1) Receive Counter Register +#define AT91C_US1_RNPR ((AT91_REG *) 0xFFFC4110) // (PDC_US1) Receive Next Pointer Register +#define AT91C_US1_RPR ((AT91_REG *) 0xFFFC4100) // (PDC_US1) Receive Pointer Register +#define AT91C_US1_TNCR ((AT91_REG *) 0xFFFC411C) // (PDC_US1) Transmit Next Counter Register +#define AT91C_US1_TPR ((AT91_REG *) 0xFFFC4108) // (PDC_US1) Transmit Pointer Register +// ========== Register definition for US1 peripheral ========== +#define AT91C_US1_IF ((AT91_REG *) 0xFFFC404C) // (US1) IRDA_FILTER Register +#define AT91C_US1_NER ((AT91_REG *) 0xFFFC4044) // (US1) Nb Errors Register +#define AT91C_US1_RTOR ((AT91_REG *) 0xFFFC4024) // (US1) Receiver Time-out Register +#define AT91C_US1_CSR ((AT91_REG *) 0xFFFC4014) // (US1) Channel Status Register +#define AT91C_US1_IDR ((AT91_REG *) 0xFFFC400C) // (US1) Interrupt Disable Register +#define AT91C_US1_IER ((AT91_REG *) 0xFFFC4008) // (US1) Interrupt Enable Register +#define AT91C_US1_THR ((AT91_REG *) 0xFFFC401C) // (US1) Transmitter Holding Register +#define AT91C_US1_TTGR ((AT91_REG *) 0xFFFC4028) // (US1) Transmitter Time-guard Register +#define AT91C_US1_RHR ((AT91_REG *) 0xFFFC4018) // (US1) Receiver Holding Register +#define AT91C_US1_BRGR ((AT91_REG *) 0xFFFC4020) // (US1) Baud Rate Generator Register +#define AT91C_US1_IMR ((AT91_REG *) 0xFFFC4010) // (US1) Interrupt Mask Register +#define AT91C_US1_FIDI ((AT91_REG *) 0xFFFC4040) // (US1) FI_DI_Ratio Register +#define AT91C_US1_CR ((AT91_REG *) 0xFFFC4000) // (US1) Control Register +#define AT91C_US1_MR ((AT91_REG *) 0xFFFC4004) // (US1) Mode Register +// ========== Register definition for PDC_US0 peripheral ========== +#define AT91C_US0_TNPR ((AT91_REG *) 0xFFFC0118) // (PDC_US0) Transmit Next Pointer Register +#define AT91C_US0_RNPR ((AT91_REG *) 0xFFFC0110) // (PDC_US0) Receive Next Pointer Register +#define AT91C_US0_TCR ((AT91_REG *) 0xFFFC010C) // (PDC_US0) Transmit Counter Register +#define AT91C_US0_PTCR ((AT91_REG *) 0xFFFC0120) // (PDC_US0) PDC Transfer Control Register +#define AT91C_US0_PTSR ((AT91_REG *) 0xFFFC0124) // (PDC_US0) PDC Transfer Status Register +#define AT91C_US0_TNCR ((AT91_REG *) 0xFFFC011C) // (PDC_US0) Transmit Next Counter Register +#define AT91C_US0_TPR ((AT91_REG *) 0xFFFC0108) // (PDC_US0) Transmit Pointer Register +#define AT91C_US0_RCR ((AT91_REG *) 0xFFFC0104) // (PDC_US0) Receive Counter Register +#define AT91C_US0_RPR ((AT91_REG *) 0xFFFC0100) // (PDC_US0) Receive Pointer Register +#define AT91C_US0_RNCR ((AT91_REG *) 0xFFFC0114) // (PDC_US0) Receive Next Counter Register +// ========== Register definition for US0 peripheral ========== +#define AT91C_US0_BRGR ((AT91_REG *) 0xFFFC0020) // (US0) Baud Rate Generator Register +#define AT91C_US0_NER ((AT91_REG *) 0xFFFC0044) // (US0) Nb Errors Register +#define AT91C_US0_CR ((AT91_REG *) 0xFFFC0000) // (US0) Control Register +#define AT91C_US0_IMR ((AT91_REG *) 0xFFFC0010) // (US0) Interrupt Mask Register +#define AT91C_US0_FIDI ((AT91_REG *) 0xFFFC0040) // (US0) FI_DI_Ratio Register +#define AT91C_US0_TTGR ((AT91_REG *) 0xFFFC0028) // (US0) Transmitter Time-guard Register +#define AT91C_US0_MR ((AT91_REG *) 0xFFFC0004) // (US0) Mode Register +#define AT91C_US0_RTOR ((AT91_REG *) 0xFFFC0024) // (US0) Receiver Time-out Register +#define AT91C_US0_CSR ((AT91_REG *) 0xFFFC0014) // (US0) Channel Status Register +#define AT91C_US0_RHR ((AT91_REG *) 0xFFFC0018) // (US0) Receiver Holding Register +#define AT91C_US0_IDR ((AT91_REG *) 0xFFFC000C) // (US0) Interrupt Disable Register +#define AT91C_US0_THR ((AT91_REG *) 0xFFFC001C) // (US0) Transmitter Holding Register +#define AT91C_US0_IF ((AT91_REG *) 0xFFFC004C) // (US0) IRDA_FILTER Register +#define AT91C_US0_IER ((AT91_REG *) 0xFFFC0008) // (US0) Interrupt Enable Register +// ========== Register definition for PDC_SSC peripheral ========== +#define AT91C_SSC_TNCR ((AT91_REG *) 0xFFFD411C) // (PDC_SSC) Transmit Next Counter Register +#define AT91C_SSC_RPR ((AT91_REG *) 0xFFFD4100) // (PDC_SSC) Receive Pointer Register +#define AT91C_SSC_RNCR ((AT91_REG *) 0xFFFD4114) // (PDC_SSC) Receive Next Counter Register +#define AT91C_SSC_TPR ((AT91_REG *) 0xFFFD4108) // (PDC_SSC) Transmit Pointer Register +#define AT91C_SSC_PTCR ((AT91_REG *) 0xFFFD4120) // (PDC_SSC) PDC Transfer Control Register +#define AT91C_SSC_TCR ((AT91_REG *) 0xFFFD410C) // (PDC_SSC) Transmit Counter Register +#define AT91C_SSC_RCR ((AT91_REG *) 0xFFFD4104) // (PDC_SSC) Receive Counter Register +#define AT91C_SSC_RNPR ((AT91_REG *) 0xFFFD4110) // (PDC_SSC) Receive Next Pointer Register +#define AT91C_SSC_TNPR ((AT91_REG *) 0xFFFD4118) // (PDC_SSC) Transmit Next Pointer Register +#define AT91C_SSC_PTSR ((AT91_REG *) 0xFFFD4124) // (PDC_SSC) PDC Transfer Status Register +// ========== Register definition for SSC peripheral ========== +#define AT91C_SSC_RHR ((AT91_REG *) 0xFFFD4020) // (SSC) Receive Holding Register +#define AT91C_SSC_RSHR ((AT91_REG *) 0xFFFD4030) // (SSC) Receive Sync Holding Register +#define AT91C_SSC_TFMR ((AT91_REG *) 0xFFFD401C) // (SSC) Transmit Frame Mode Register +#define AT91C_SSC_IDR ((AT91_REG *) 0xFFFD4048) // (SSC) Interrupt Disable Register +#define AT91C_SSC_THR ((AT91_REG *) 0xFFFD4024) // (SSC) Transmit Holding Register +#define AT91C_SSC_RCMR ((AT91_REG *) 0xFFFD4010) // (SSC) Receive Clock ModeRegister +#define AT91C_SSC_IER ((AT91_REG *) 0xFFFD4044) // (SSC) Interrupt Enable Register +#define AT91C_SSC_TSHR ((AT91_REG *) 0xFFFD4034) // (SSC) Transmit Sync Holding Register +#define AT91C_SSC_SR ((AT91_REG *) 0xFFFD4040) // (SSC) Status Register +#define AT91C_SSC_CMR ((AT91_REG *) 0xFFFD4004) // (SSC) Clock Mode Register +#define AT91C_SSC_TCMR ((AT91_REG *) 0xFFFD4018) // (SSC) Transmit Clock Mode Register +#define AT91C_SSC_CR ((AT91_REG *) 0xFFFD4000) // (SSC) Control Register +#define AT91C_SSC_IMR ((AT91_REG *) 0xFFFD404C) // (SSC) Interrupt Mask Register +#define AT91C_SSC_RFMR ((AT91_REG *) 0xFFFD4014) // (SSC) Receive Frame Mode Register +// ========== Register definition for TWI peripheral ========== +#define AT91C_TWI_IER ((AT91_REG *) 0xFFFB8024) // (TWI) Interrupt Enable Register +#define AT91C_TWI_CR ((AT91_REG *) 0xFFFB8000) // (TWI) Control Register +#define AT91C_TWI_SR ((AT91_REG *) 0xFFFB8020) // (TWI) Status Register +#define AT91C_TWI_IMR ((AT91_REG *) 0xFFFB802C) // (TWI) Interrupt Mask Register +#define AT91C_TWI_THR ((AT91_REG *) 0xFFFB8034) // (TWI) Transmit Holding Register +#define AT91C_TWI_IDR ((AT91_REG *) 0xFFFB8028) // (TWI) Interrupt Disable Register +#define AT91C_TWI_IADR ((AT91_REG *) 0xFFFB800C) // (TWI) Internal Address Register +#define AT91C_TWI_MMR ((AT91_REG *) 0xFFFB8004) // (TWI) Master Mode Register +#define AT91C_TWI_CWGR ((AT91_REG *) 0xFFFB8010) // (TWI) Clock Waveform Generator Register +#define AT91C_TWI_RHR ((AT91_REG *) 0xFFFB8030) // (TWI) Receive Holding Register +// ========== Register definition for PWMC_CH3 peripheral ========== +#define AT91C_PWMC_CH3_CUPDR ((AT91_REG *) 0xFFFCC270) // (PWMC_CH3) Channel Update Register +#define AT91C_PWMC_CH3_Reserved ((AT91_REG *) 0xFFFCC274) // (PWMC_CH3) Reserved +#define AT91C_PWMC_CH3_CPRDR ((AT91_REG *) 0xFFFCC268) // (PWMC_CH3) Channel Period Register +#define AT91C_PWMC_CH3_CDTYR ((AT91_REG *) 0xFFFCC264) // (PWMC_CH3) Channel Duty Cycle Register +#define AT91C_PWMC_CH3_CCNTR ((AT91_REG *) 0xFFFCC26C) // (PWMC_CH3) Channel Counter Register +#define AT91C_PWMC_CH3_CMR ((AT91_REG *) 0xFFFCC260) // (PWMC_CH3) Channel Mode Register +// ========== Register definition for PWMC_CH2 peripheral ========== +#define AT91C_PWMC_CH2_Reserved ((AT91_REG *) 0xFFFCC254) // (PWMC_CH2) Reserved +#define AT91C_PWMC_CH2_CMR ((AT91_REG *) 0xFFFCC240) // (PWMC_CH2) Channel Mode Register +#define AT91C_PWMC_CH2_CCNTR ((AT91_REG *) 0xFFFCC24C) // (PWMC_CH2) Channel Counter Register +#define AT91C_PWMC_CH2_CPRDR ((AT91_REG *) 0xFFFCC248) // (PWMC_CH2) Channel Period Register +#define AT91C_PWMC_CH2_CUPDR ((AT91_REG *) 0xFFFCC250) // (PWMC_CH2) Channel Update Register +#define AT91C_PWMC_CH2_CDTYR ((AT91_REG *) 0xFFFCC244) // (PWMC_CH2) Channel Duty Cycle Register +// ========== Register definition for PWMC_CH1 peripheral ========== +#define AT91C_PWMC_CH1_Reserved ((AT91_REG *) 0xFFFCC234) // (PWMC_CH1) Reserved +#define AT91C_PWMC_CH1_CUPDR ((AT91_REG *) 0xFFFCC230) // (PWMC_CH1) Channel Update Register +#define AT91C_PWMC_CH1_CPRDR ((AT91_REG *) 0xFFFCC228) // (PWMC_CH1) Channel Period Register +#define AT91C_PWMC_CH1_CCNTR ((AT91_REG *) 0xFFFCC22C) // (PWMC_CH1) Channel Counter Register +#define AT91C_PWMC_CH1_CDTYR ((AT91_REG *) 0xFFFCC224) // (PWMC_CH1) Channel Duty Cycle Register +#define AT91C_PWMC_CH1_CMR ((AT91_REG *) 0xFFFCC220) // (PWMC_CH1) Channel Mode Register +// ========== Register definition for PWMC_CH0 peripheral ========== +#define AT91C_PWMC_CH0_Reserved ((AT91_REG *) 0xFFFCC214) // (PWMC_CH0) Reserved +#define AT91C_PWMC_CH0_CPRDR ((AT91_REG *) 0xFFFCC208) // (PWMC_CH0) Channel Period Register +#define AT91C_PWMC_CH0_CDTYR ((AT91_REG *) 0xFFFCC204) // (PWMC_CH0) Channel Duty Cycle Register +#define AT91C_PWMC_CH0_CMR ((AT91_REG *) 0xFFFCC200) // (PWMC_CH0) Channel Mode Register +#define AT91C_PWMC_CH0_CUPDR ((AT91_REG *) 0xFFFCC210) // (PWMC_CH0) Channel Update Register +#define AT91C_PWMC_CH0_CCNTR ((AT91_REG *) 0xFFFCC20C) // (PWMC_CH0) Channel Counter Register +// ========== Register definition for PWMC peripheral ========== +#define AT91C_PWMC_IDR ((AT91_REG *) 0xFFFCC014) // (PWMC) PWMC Interrupt Disable Register +#define AT91C_PWMC_DIS ((AT91_REG *) 0xFFFCC008) // (PWMC) PWMC Disable Register +#define AT91C_PWMC_IER ((AT91_REG *) 0xFFFCC010) // (PWMC) PWMC Interrupt Enable Register +#define AT91C_PWMC_VR ((AT91_REG *) 0xFFFCC0FC) // (PWMC) PWMC Version Register +#define AT91C_PWMC_ISR ((AT91_REG *) 0xFFFCC01C) // (PWMC) PWMC Interrupt Status Register +#define AT91C_PWMC_SR ((AT91_REG *) 0xFFFCC00C) // (PWMC) PWMC Status Register +#define AT91C_PWMC_IMR ((AT91_REG *) 0xFFFCC018) // (PWMC) PWMC Interrupt Mask Register +#define AT91C_PWMC_MR ((AT91_REG *) 0xFFFCC000) // (PWMC) PWMC Mode Register +#define AT91C_PWMC_ENA ((AT91_REG *) 0xFFFCC004) // (PWMC) PWMC Enable Register +// ========== Register definition for UDP peripheral ========== +#define AT91C_UDP_IMR ((AT91_REG *) 0xFFFB0018) // (UDP) Interrupt Mask Register +#define AT91C_UDP_FADDR ((AT91_REG *) 0xFFFB0008) // (UDP) Function Address Register +#define AT91C_UDP_NUM ((AT91_REG *) 0xFFFB0000) // (UDP) Frame Number Register +#define AT91C_UDP_FDR ((AT91_REG *) 0xFFFB0050) // (UDP) Endpoint FIFO Data Register +#define AT91C_UDP_ISR ((AT91_REG *) 0xFFFB001C) // (UDP) Interrupt Status Register +#define AT91C_UDP_CSR ((AT91_REG *) 0xFFFB0030) // (UDP) Endpoint Control and Status Register +#define AT91C_UDP_IDR ((AT91_REG *) 0xFFFB0014) // (UDP) Interrupt Disable Register +#define AT91C_UDP_ICR ((AT91_REG *) 0xFFFB0020) // (UDP) Interrupt Clear Register +#define AT91C_UDP_RSTEP ((AT91_REG *) 0xFFFB0028) // (UDP) Reset Endpoint Register +#define AT91C_UDP_TXVC ((AT91_REG *) 0xFFFB0074) // (UDP) Transceiver Control Register +#define AT91C_UDP_GLBSTATE ((AT91_REG *) 0xFFFB0004) // (UDP) Global State Register +#define AT91C_UDP_IER ((AT91_REG *) 0xFFFB0010) // (UDP) Interrupt Enable Register +// ========== Register definition for TC0 peripheral ========== +#define AT91C_TC0_SR ((AT91_REG *) 0xFFFA0020) // (TC0) Status Register +#define AT91C_TC0_RC ((AT91_REG *) 0xFFFA001C) // (TC0) Register C +#define AT91C_TC0_RB ((AT91_REG *) 0xFFFA0018) // (TC0) Register B +#define AT91C_TC0_CCR ((AT91_REG *) 0xFFFA0000) // (TC0) Channel Control Register +#define AT91C_TC0_CMR ((AT91_REG *) 0xFFFA0004) // (TC0) Channel Mode Register (Capture Mode / Waveform Mode) +#define AT91C_TC0_IER ((AT91_REG *) 0xFFFA0024) // (TC0) Interrupt Enable Register +#define AT91C_TC0_RA ((AT91_REG *) 0xFFFA0014) // (TC0) Register A +#define AT91C_TC0_IDR ((AT91_REG *) 0xFFFA0028) // (TC0) Interrupt Disable Register +#define AT91C_TC0_CV ((AT91_REG *) 0xFFFA0010) // (TC0) Counter Value +#define AT91C_TC0_IMR ((AT91_REG *) 0xFFFA002C) // (TC0) Interrupt Mask Register +// ========== Register definition for TC1 peripheral ========== +#define AT91C_TC1_RB ((AT91_REG *) 0xFFFA0058) // (TC1) Register B +#define AT91C_TC1_CCR ((AT91_REG *) 0xFFFA0040) // (TC1) Channel Control Register +#define AT91C_TC1_IER ((AT91_REG *) 0xFFFA0064) // (TC1) Interrupt Enable Register +#define AT91C_TC1_IDR ((AT91_REG *) 0xFFFA0068) // (TC1) Interrupt Disable Register +#define AT91C_TC1_SR ((AT91_REG *) 0xFFFA0060) // (TC1) Status Register +#define AT91C_TC1_CMR ((AT91_REG *) 0xFFFA0044) // (TC1) Channel Mode Register (Capture Mode / Waveform Mode) +#define AT91C_TC1_RA ((AT91_REG *) 0xFFFA0054) // (TC1) Register A +#define AT91C_TC1_RC ((AT91_REG *) 0xFFFA005C) // (TC1) Register C +#define AT91C_TC1_IMR ((AT91_REG *) 0xFFFA006C) // (TC1) Interrupt Mask Register +#define AT91C_TC1_CV ((AT91_REG *) 0xFFFA0050) // (TC1) Counter Value +// ========== Register definition for TC2 peripheral ========== +#define AT91C_TC2_CMR ((AT91_REG *) 0xFFFA0084) // (TC2) Channel Mode Register (Capture Mode / Waveform Mode) +#define AT91C_TC2_CCR ((AT91_REG *) 0xFFFA0080) // (TC2) Channel Control Register +#define AT91C_TC2_CV ((AT91_REG *) 0xFFFA0090) // (TC2) Counter Value +#define AT91C_TC2_RA ((AT91_REG *) 0xFFFA0094) // (TC2) Register A +#define AT91C_TC2_RB ((AT91_REG *) 0xFFFA0098) // (TC2) Register B +#define AT91C_TC2_IDR ((AT91_REG *) 0xFFFA00A8) // (TC2) Interrupt Disable Register +#define AT91C_TC2_IMR ((AT91_REG *) 0xFFFA00AC) // (TC2) Interrupt Mask Register +#define AT91C_TC2_RC ((AT91_REG *) 0xFFFA009C) // (TC2) Register C +#define AT91C_TC2_IER ((AT91_REG *) 0xFFFA00A4) // (TC2) Interrupt Enable Register +#define AT91C_TC2_SR ((AT91_REG *) 0xFFFA00A0) // (TC2) Status Register +// ========== Register definition for TCB peripheral ========== +#define AT91C_TCB_BMR ((AT91_REG *) 0xFFFA00C4) // (TCB) TC Block Mode Register +#define AT91C_TCB_BCR ((AT91_REG *) 0xFFFA00C0) // (TCB) TC Block Control Register +// ========== Register definition for CAN_MB0 peripheral ========== +#define AT91C_CAN_MB0_MDL ((AT91_REG *) 0xFFFD0214) // (CAN_MB0) MailBox Data Low Register +#define AT91C_CAN_MB0_MAM ((AT91_REG *) 0xFFFD0204) // (CAN_MB0) MailBox Acceptance Mask Register +#define AT91C_CAN_MB0_MCR ((AT91_REG *) 0xFFFD021C) // (CAN_MB0) MailBox Control Register +#define AT91C_CAN_MB0_MID ((AT91_REG *) 0xFFFD0208) // (CAN_MB0) MailBox ID Register +#define AT91C_CAN_MB0_MSR ((AT91_REG *) 0xFFFD0210) // (CAN_MB0) MailBox Status Register +#define AT91C_CAN_MB0_MFID ((AT91_REG *) 0xFFFD020C) // (CAN_MB0) MailBox Family ID Register +#define AT91C_CAN_MB0_MDH ((AT91_REG *) 0xFFFD0218) // (CAN_MB0) MailBox Data High Register +#define AT91C_CAN_MB0_MMR ((AT91_REG *) 0xFFFD0200) // (CAN_MB0) MailBox Mode Register +// ========== Register definition for CAN_MB1 peripheral ========== +#define AT91C_CAN_MB1_MDL ((AT91_REG *) 0xFFFD0234) // (CAN_MB1) MailBox Data Low Register +#define AT91C_CAN_MB1_MID ((AT91_REG *) 0xFFFD0228) // (CAN_MB1) MailBox ID Register +#define AT91C_CAN_MB1_MMR ((AT91_REG *) 0xFFFD0220) // (CAN_MB1) MailBox Mode Register +#define AT91C_CAN_MB1_MSR ((AT91_REG *) 0xFFFD0230) // (CAN_MB1) MailBox Status Register +#define AT91C_CAN_MB1_MAM ((AT91_REG *) 0xFFFD0224) // (CAN_MB1) MailBox Acceptance Mask Register +#define AT91C_CAN_MB1_MDH ((AT91_REG *) 0xFFFD0238) // (CAN_MB1) MailBox Data High Register +#define AT91C_CAN_MB1_MCR ((AT91_REG *) 0xFFFD023C) // (CAN_MB1) MailBox Control Register +#define AT91C_CAN_MB1_MFID ((AT91_REG *) 0xFFFD022C) // (CAN_MB1) MailBox Family ID Register +// ========== Register definition for CAN_MB2 peripheral ========== +#define AT91C_CAN_MB2_MCR ((AT91_REG *) 0xFFFD025C) // (CAN_MB2) MailBox Control Register +#define AT91C_CAN_MB2_MDH ((AT91_REG *) 0xFFFD0258) // (CAN_MB2) MailBox Data High Register +#define AT91C_CAN_MB2_MID ((AT91_REG *) 0xFFFD0248) // (CAN_MB2) MailBox ID Register +#define AT91C_CAN_MB2_MDL ((AT91_REG *) 0xFFFD0254) // (CAN_MB2) MailBox Data Low Register +#define AT91C_CAN_MB2_MMR ((AT91_REG *) 0xFFFD0240) // (CAN_MB2) MailBox Mode Register +#define AT91C_CAN_MB2_MAM ((AT91_REG *) 0xFFFD0244) // (CAN_MB2) MailBox Acceptance Mask Register +#define AT91C_CAN_MB2_MFID ((AT91_REG *) 0xFFFD024C) // (CAN_MB2) MailBox Family ID Register +#define AT91C_CAN_MB2_MSR ((AT91_REG *) 0xFFFD0250) // (CAN_MB2) MailBox Status Register +// ========== Register definition for CAN_MB3 peripheral ========== +#define AT91C_CAN_MB3_MFID ((AT91_REG *) 0xFFFD026C) // (CAN_MB3) MailBox Family ID Register +#define AT91C_CAN_MB3_MAM ((AT91_REG *) 0xFFFD0264) // (CAN_MB3) MailBox Acceptance Mask Register +#define AT91C_CAN_MB3_MID ((AT91_REG *) 0xFFFD0268) // (CAN_MB3) MailBox ID Register +#define AT91C_CAN_MB3_MCR ((AT91_REG *) 0xFFFD027C) // (CAN_MB3) MailBox Control Register +#define AT91C_CAN_MB3_MMR ((AT91_REG *) 0xFFFD0260) // (CAN_MB3) MailBox Mode Register +#define AT91C_CAN_MB3_MSR ((AT91_REG *) 0xFFFD0270) // (CAN_MB3) MailBox Status Register +#define AT91C_CAN_MB3_MDL ((AT91_REG *) 0xFFFD0274) // (CAN_MB3) MailBox Data Low Register +#define AT91C_CAN_MB3_MDH ((AT91_REG *) 0xFFFD0278) // (CAN_MB3) MailBox Data High Register +// ========== Register definition for CAN_MB4 peripheral ========== +#define AT91C_CAN_MB4_MID ((AT91_REG *) 0xFFFD0288) // (CAN_MB4) MailBox ID Register +#define AT91C_CAN_MB4_MMR ((AT91_REG *) 0xFFFD0280) // (CAN_MB4) MailBox Mode Register +#define AT91C_CAN_MB4_MDH ((AT91_REG *) 0xFFFD0298) // (CAN_MB4) MailBox Data High Register +#define AT91C_CAN_MB4_MFID ((AT91_REG *) 0xFFFD028C) // (CAN_MB4) MailBox Family ID Register +#define AT91C_CAN_MB4_MSR ((AT91_REG *) 0xFFFD0290) // (CAN_MB4) MailBox Status Register +#define AT91C_CAN_MB4_MCR ((AT91_REG *) 0xFFFD029C) // (CAN_MB4) MailBox Control Register +#define AT91C_CAN_MB4_MDL ((AT91_REG *) 0xFFFD0294) // (CAN_MB4) MailBox Data Low Register +#define AT91C_CAN_MB4_MAM ((AT91_REG *) 0xFFFD0284) // (CAN_MB4) MailBox Acceptance Mask Register +// ========== Register definition for CAN_MB5 peripheral ========== +#define AT91C_CAN_MB5_MSR ((AT91_REG *) 0xFFFD02B0) // (CAN_MB5) MailBox Status Register +#define AT91C_CAN_MB5_MCR ((AT91_REG *) 0xFFFD02BC) // (CAN_MB5) MailBox Control Register +#define AT91C_CAN_MB5_MFID ((AT91_REG *) 0xFFFD02AC) // (CAN_MB5) MailBox Family ID Register +#define AT91C_CAN_MB5_MDH ((AT91_REG *) 0xFFFD02B8) // (CAN_MB5) MailBox Data High Register +#define AT91C_CAN_MB5_MID ((AT91_REG *) 0xFFFD02A8) // (CAN_MB5) MailBox ID Register +#define AT91C_CAN_MB5_MMR ((AT91_REG *) 0xFFFD02A0) // (CAN_MB5) MailBox Mode Register +#define AT91C_CAN_MB5_MDL ((AT91_REG *) 0xFFFD02B4) // (CAN_MB5) MailBox Data Low Register +#define AT91C_CAN_MB5_MAM ((AT91_REG *) 0xFFFD02A4) // (CAN_MB5) MailBox Acceptance Mask Register +// ========== Register definition for CAN_MB6 peripheral ========== +#define AT91C_CAN_MB6_MFID ((AT91_REG *) 0xFFFD02CC) // (CAN_MB6) MailBox Family ID Register +#define AT91C_CAN_MB6_MID ((AT91_REG *) 0xFFFD02C8) // (CAN_MB6) MailBox ID Register +#define AT91C_CAN_MB6_MAM ((AT91_REG *) 0xFFFD02C4) // (CAN_MB6) MailBox Acceptance Mask Register +#define AT91C_CAN_MB6_MSR ((AT91_REG *) 0xFFFD02D0) // (CAN_MB6) MailBox Status Register +#define AT91C_CAN_MB6_MDL ((AT91_REG *) 0xFFFD02D4) // (CAN_MB6) MailBox Data Low Register +#define AT91C_CAN_MB6_MCR ((AT91_REG *) 0xFFFD02DC) // (CAN_MB6) MailBox Control Register +#define AT91C_CAN_MB6_MDH ((AT91_REG *) 0xFFFD02D8) // (CAN_MB6) MailBox Data High Register +#define AT91C_CAN_MB6_MMR ((AT91_REG *) 0xFFFD02C0) // (CAN_MB6) MailBox Mode Register +// ========== Register definition for CAN_MB7 peripheral ========== +#define AT91C_CAN_MB7_MCR ((AT91_REG *) 0xFFFD02FC) // (CAN_MB7) MailBox Control Register +#define AT91C_CAN_MB7_MDH ((AT91_REG *) 0xFFFD02F8) // (CAN_MB7) MailBox Data High Register +#define AT91C_CAN_MB7_MFID ((AT91_REG *) 0xFFFD02EC) // (CAN_MB7) MailBox Family ID Register +#define AT91C_CAN_MB7_MDL ((AT91_REG *) 0xFFFD02F4) // (CAN_MB7) MailBox Data Low Register +#define AT91C_CAN_MB7_MID ((AT91_REG *) 0xFFFD02E8) // (CAN_MB7) MailBox ID Register +#define AT91C_CAN_MB7_MMR ((AT91_REG *) 0xFFFD02E0) // (CAN_MB7) MailBox Mode Register +#define AT91C_CAN_MB7_MAM ((AT91_REG *) 0xFFFD02E4) // (CAN_MB7) MailBox Acceptance Mask Register +#define AT91C_CAN_MB7_MSR ((AT91_REG *) 0xFFFD02F0) // (CAN_MB7) MailBox Status Register +// ========== Register definition for CAN peripheral ========== +#define AT91C_CAN_TCR ((AT91_REG *) 0xFFFD0024) // (CAN) Transfer Command Register +#define AT91C_CAN_IMR ((AT91_REG *) 0xFFFD000C) // (CAN) Interrupt Mask Register +#define AT91C_CAN_IER ((AT91_REG *) 0xFFFD0004) // (CAN) Interrupt Enable Register +#define AT91C_CAN_ECR ((AT91_REG *) 0xFFFD0020) // (CAN) Error Counter Register +#define AT91C_CAN_TIMESTP ((AT91_REG *) 0xFFFD001C) // (CAN) Time Stamp Register +#define AT91C_CAN_MR ((AT91_REG *) 0xFFFD0000) // (CAN) Mode Register +#define AT91C_CAN_IDR ((AT91_REG *) 0xFFFD0008) // (CAN) Interrupt Disable Register +#define AT91C_CAN_ACR ((AT91_REG *) 0xFFFD0028) // (CAN) Abort Command Register +#define AT91C_CAN_TIM ((AT91_REG *) 0xFFFD0018) // (CAN) Timer Register +#define AT91C_CAN_SR ((AT91_REG *) 0xFFFD0010) // (CAN) Status Register +#define AT91C_CAN_BR ((AT91_REG *) 0xFFFD0014) // (CAN) Baudrate Register +#define AT91C_CAN_VR ((AT91_REG *) 0xFFFD00FC) // (CAN) Version Register +// ========== Register definition for EMAC peripheral ========== +#define AT91C_EMAC_ISR ((AT91_REG *) 0xFFFDC024) // (EMAC) Interrupt Status Register +#define AT91C_EMAC_SA4H ((AT91_REG *) 0xFFFDC0B4) // (EMAC) Specific Address 4 Top, Last 2 bytes +#define AT91C_EMAC_SA1L ((AT91_REG *) 0xFFFDC098) // (EMAC) Specific Address 1 Bottom, First 4 bytes +#define AT91C_EMAC_ELE ((AT91_REG *) 0xFFFDC078) // (EMAC) Excessive Length Errors Register +#define AT91C_EMAC_LCOL ((AT91_REG *) 0xFFFDC05C) // (EMAC) Late Collision Register +#define AT91C_EMAC_RLE ((AT91_REG *) 0xFFFDC088) // (EMAC) Receive Length Field Mismatch Register +#define AT91C_EMAC_WOL ((AT91_REG *) 0xFFFDC0C4) // (EMAC) Wake On LAN Register +#define AT91C_EMAC_DTF ((AT91_REG *) 0xFFFDC058) // (EMAC) Deferred Transmission Frame Register +#define AT91C_EMAC_TUND ((AT91_REG *) 0xFFFDC064) // (EMAC) Transmit Underrun Error Register +#define AT91C_EMAC_NCR ((AT91_REG *) 0xFFFDC000) // (EMAC) Network Control Register +#define AT91C_EMAC_SA4L ((AT91_REG *) 0xFFFDC0B0) // (EMAC) Specific Address 4 Bottom, First 4 bytes +#define AT91C_EMAC_RSR ((AT91_REG *) 0xFFFDC020) // (EMAC) Receive Status Register +#define AT91C_EMAC_SA3L ((AT91_REG *) 0xFFFDC0A8) // (EMAC) Specific Address 3 Bottom, First 4 bytes +#define AT91C_EMAC_TSR ((AT91_REG *) 0xFFFDC014) // (EMAC) Transmit Status Register +#define AT91C_EMAC_IDR ((AT91_REG *) 0xFFFDC02C) // (EMAC) Interrupt Disable Register +#define AT91C_EMAC_RSE ((AT91_REG *) 0xFFFDC074) // (EMAC) Receive Symbol Errors Register +#define AT91C_EMAC_ECOL ((AT91_REG *) 0xFFFDC060) // (EMAC) Excessive Collision Register +#define AT91C_EMAC_TID ((AT91_REG *) 0xFFFDC0B8) // (EMAC) Type ID Checking Register +#define AT91C_EMAC_HRB ((AT91_REG *) 0xFFFDC090) // (EMAC) Hash Address Bottom[31:0] +#define AT91C_EMAC_TBQP ((AT91_REG *) 0xFFFDC01C) // (EMAC) Transmit Buffer Queue Pointer +#define AT91C_EMAC_USRIO ((AT91_REG *) 0xFFFDC0C0) // (EMAC) USER Input/Output Register +#define AT91C_EMAC_PTR ((AT91_REG *) 0xFFFDC038) // (EMAC) Pause Time Register +#define AT91C_EMAC_SA2H ((AT91_REG *) 0xFFFDC0A4) // (EMAC) Specific Address 2 Top, Last 2 bytes +#define AT91C_EMAC_ROV ((AT91_REG *) 0xFFFDC070) // (EMAC) Receive Overrun Errors Register +#define AT91C_EMAC_ALE ((AT91_REG *) 0xFFFDC054) // (EMAC) Alignment Error Register +#define AT91C_EMAC_RJA ((AT91_REG *) 0xFFFDC07C) // (EMAC) Receive Jabbers Register +#define AT91C_EMAC_RBQP ((AT91_REG *) 0xFFFDC018) // (EMAC) Receive Buffer Queue Pointer +#define AT91C_EMAC_TPF ((AT91_REG *) 0xFFFDC08C) // (EMAC) Transmitted Pause Frames Register +#define AT91C_EMAC_NCFGR ((AT91_REG *) 0xFFFDC004) // (EMAC) Network Configuration Register +#define AT91C_EMAC_HRT ((AT91_REG *) 0xFFFDC094) // (EMAC) Hash Address Top[63:32] +#define AT91C_EMAC_USF ((AT91_REG *) 0xFFFDC080) // (EMAC) Undersize Frames Register +#define AT91C_EMAC_FCSE ((AT91_REG *) 0xFFFDC050) // (EMAC) Frame Check Sequence Error Register +#define AT91C_EMAC_TPQ ((AT91_REG *) 0xFFFDC0BC) // (EMAC) Transmit Pause Quantum Register +#define AT91C_EMAC_MAN ((AT91_REG *) 0xFFFDC034) // (EMAC) PHY Maintenance Register +#define AT91C_EMAC_FTO ((AT91_REG *) 0xFFFDC040) // (EMAC) Frames Transmitted OK Register +#define AT91C_EMAC_REV ((AT91_REG *) 0xFFFDC0FC) // (EMAC) Revision Register +#define AT91C_EMAC_IMR ((AT91_REG *) 0xFFFDC030) // (EMAC) Interrupt Mask Register +#define AT91C_EMAC_SCF ((AT91_REG *) 0xFFFDC044) // (EMAC) Single Collision Frame Register +#define AT91C_EMAC_PFR ((AT91_REG *) 0xFFFDC03C) // (EMAC) Pause Frames received Register +#define AT91C_EMAC_MCF ((AT91_REG *) 0xFFFDC048) // (EMAC) Multiple Collision Frame Register +#define AT91C_EMAC_NSR ((AT91_REG *) 0xFFFDC008) // (EMAC) Network Status Register +#define AT91C_EMAC_SA2L ((AT91_REG *) 0xFFFDC0A0) // (EMAC) Specific Address 2 Bottom, First 4 bytes +#define AT91C_EMAC_FRO ((AT91_REG *) 0xFFFDC04C) // (EMAC) Frames Received OK Register +#define AT91C_EMAC_IER ((AT91_REG *) 0xFFFDC028) // (EMAC) Interrupt Enable Register +#define AT91C_EMAC_SA1H ((AT91_REG *) 0xFFFDC09C) // (EMAC) Specific Address 1 Top, Last 2 bytes +#define AT91C_EMAC_CSE ((AT91_REG *) 0xFFFDC068) // (EMAC) Carrier Sense Error Register +#define AT91C_EMAC_SA3H ((AT91_REG *) 0xFFFDC0AC) // (EMAC) Specific Address 3 Top, Last 2 bytes +#define AT91C_EMAC_RRE ((AT91_REG *) 0xFFFDC06C) // (EMAC) Receive Ressource Error Register +#define AT91C_EMAC_STE ((AT91_REG *) 0xFFFDC084) // (EMAC) SQE Test Error Register +// ========== Register definition for PDC_ADC peripheral ========== +#define AT91C_ADC_PTSR ((AT91_REG *) 0xFFFD8124) // (PDC_ADC) PDC Transfer Status Register +#define AT91C_ADC_PTCR ((AT91_REG *) 0xFFFD8120) // (PDC_ADC) PDC Transfer Control Register +#define AT91C_ADC_TNPR ((AT91_REG *) 0xFFFD8118) // (PDC_ADC) Transmit Next Pointer Register +#define AT91C_ADC_TNCR ((AT91_REG *) 0xFFFD811C) // (PDC_ADC) Transmit Next Counter Register +#define AT91C_ADC_RNPR ((AT91_REG *) 0xFFFD8110) // (PDC_ADC) Receive Next Pointer Register +#define AT91C_ADC_RNCR ((AT91_REG *) 0xFFFD8114) // (PDC_ADC) Receive Next Counter Register +#define AT91C_ADC_RPR ((AT91_REG *) 0xFFFD8100) // (PDC_ADC) Receive Pointer Register +#define AT91C_ADC_TCR ((AT91_REG *) 0xFFFD810C) // (PDC_ADC) Transmit Counter Register +#define AT91C_ADC_TPR ((AT91_REG *) 0xFFFD8108) // (PDC_ADC) Transmit Pointer Register +#define AT91C_ADC_RCR ((AT91_REG *) 0xFFFD8104) // (PDC_ADC) Receive Counter Register +// ========== Register definition for ADC peripheral ========== +#define AT91C_ADC_CDR2 ((AT91_REG *) 0xFFFD8038) // (ADC) ADC Channel Data Register 2 +#define AT91C_ADC_CDR3 ((AT91_REG *) 0xFFFD803C) // (ADC) ADC Channel Data Register 3 +#define AT91C_ADC_CDR0 ((AT91_REG *) 0xFFFD8030) // (ADC) ADC Channel Data Register 0 +#define AT91C_ADC_CDR5 ((AT91_REG *) 0xFFFD8044) // (ADC) ADC Channel Data Register 5 +#define AT91C_ADC_CHDR ((AT91_REG *) 0xFFFD8014) // (ADC) ADC Channel Disable Register +#define AT91C_ADC_SR ((AT91_REG *) 0xFFFD801C) // (ADC) ADC Status Register +#define AT91C_ADC_CDR4 ((AT91_REG *) 0xFFFD8040) // (ADC) ADC Channel Data Register 4 +#define AT91C_ADC_CDR1 ((AT91_REG *) 0xFFFD8034) // (ADC) ADC Channel Data Register 1 +#define AT91C_ADC_LCDR ((AT91_REG *) 0xFFFD8020) // (ADC) ADC Last Converted Data Register +#define AT91C_ADC_IDR ((AT91_REG *) 0xFFFD8028) // (ADC) ADC Interrupt Disable Register +#define AT91C_ADC_CR ((AT91_REG *) 0xFFFD8000) // (ADC) ADC Control Register +#define AT91C_ADC_CDR7 ((AT91_REG *) 0xFFFD804C) // (ADC) ADC Channel Data Register 7 +#define AT91C_ADC_CDR6 ((AT91_REG *) 0xFFFD8048) // (ADC) ADC Channel Data Register 6 +#define AT91C_ADC_IER ((AT91_REG *) 0xFFFD8024) // (ADC) ADC Interrupt Enable Register +#define AT91C_ADC_CHER ((AT91_REG *) 0xFFFD8010) // (ADC) ADC Channel Enable Register +#define AT91C_ADC_CHSR ((AT91_REG *) 0xFFFD8018) // (ADC) ADC Channel Status Register +#define AT91C_ADC_MR ((AT91_REG *) 0xFFFD8004) // (ADC) ADC Mode Register +#define AT91C_ADC_IMR ((AT91_REG *) 0xFFFD802C) // (ADC) ADC Interrupt Mask Register + +// ***************************************************************************** +// PIO DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** +#define AT91C_PIO_PA0 ((unsigned int) 1 << 0) // Pin Controlled by PA0 +#define AT91C_PA0_RXD0 ((unsigned int) AT91C_PIO_PA0) // USART 0 Receive Data +#define AT91C_PIO_PA1 ((unsigned int) 1 << 1) // Pin Controlled by PA1 +#define AT91C_PA1_TXD0 ((unsigned int) AT91C_PIO_PA1) // USART 0 Transmit Data +#define AT91C_PIO_PA10 ((unsigned int) 1 << 10) // Pin Controlled by PA10 +#define AT91C_PA10_TWD ((unsigned int) AT91C_PIO_PA10) // TWI Two-wire Serial Data +#define AT91C_PIO_PA11 ((unsigned int) 1 << 11) // Pin Controlled by PA11 +#define AT91C_PA11_TWCK ((unsigned int) AT91C_PIO_PA11) // TWI Two-wire Serial Clock +#define AT91C_PIO_PA12 ((unsigned int) 1 << 12) // Pin Controlled by PA12 +#define AT91C_PA12_SPI0_NPCS0 ((unsigned int) AT91C_PIO_PA12) // SPI 0 Peripheral Chip Select 0 +#define AT91C_PIO_PA13 ((unsigned int) 1 << 13) // Pin Controlled by PA13 +#define AT91C_PA13_SPI0_NPCS1 ((unsigned int) AT91C_PIO_PA13) // SPI 0 Peripheral Chip Select 1 +#define AT91C_PA13_PCK1 ((unsigned int) AT91C_PIO_PA13) // PMC Programmable Clock Output 1 +#define AT91C_PIO_PA14 ((unsigned int) 1 << 14) // Pin Controlled by PA14 +#define AT91C_PA14_SPI0_NPCS2 ((unsigned int) AT91C_PIO_PA14) // SPI 0 Peripheral Chip Select 2 +#define AT91C_PA14_IRQ1 ((unsigned int) AT91C_PIO_PA14) // External Interrupt 1 +#define AT91C_PIO_PA15 ((unsigned int) 1 << 15) // Pin Controlled by PA15 +#define AT91C_PA15_SPI0_NPCS3 ((unsigned int) AT91C_PIO_PA15) // SPI 0 Peripheral Chip Select 3 +#define AT91C_PA15_TCLK2 ((unsigned int) AT91C_PIO_PA15) // Timer Counter 2 external clock input +#define AT91C_PIO_PA16 ((unsigned int) 1 << 16) // Pin Controlled by PA16 +#define AT91C_PA16_SPI0_MISO ((unsigned int) AT91C_PIO_PA16) // SPI 0 Master In Slave +#define AT91C_PIO_PA17 ((unsigned int) 1 << 17) // Pin Controlled by PA17 +#define AT91C_PA17_SPI0_MOSI ((unsigned int) AT91C_PIO_PA17) // SPI 0 Master Out Slave +#define AT91C_PIO_PA18 ((unsigned int) 1 << 18) // Pin Controlled by PA18 +#define AT91C_PA18_SPI0_SPCK ((unsigned int) AT91C_PIO_PA18) // SPI 0 Serial Clock +#define AT91C_PIO_PA19 ((unsigned int) 1 << 19) // Pin Controlled by PA19 +#define AT91C_PA19_CANRX ((unsigned int) AT91C_PIO_PA19) // CAN Receive +#define AT91C_PIO_PA2 ((unsigned int) 1 << 2) // Pin Controlled by PA2 +#define AT91C_PA2_SCK0 ((unsigned int) AT91C_PIO_PA2) // USART 0 Serial Clock +#define AT91C_PA2_SPI1_NPCS1 ((unsigned int) AT91C_PIO_PA2) // SPI 1 Peripheral Chip Select 1 +#define AT91C_PIO_PA20 ((unsigned int) 1 << 20) // Pin Controlled by PA20 +#define AT91C_PA20_CANTX ((unsigned int) AT91C_PIO_PA20) // CAN Transmit +#define AT91C_PIO_PA21 ((unsigned int) 1 << 21) // Pin Controlled by PA21 +#define AT91C_PA21_TF ((unsigned int) AT91C_PIO_PA21) // SSC Transmit Frame Sync +#define AT91C_PA21_SPI1_NPCS0 ((unsigned int) AT91C_PIO_PA21) // SPI 1 Peripheral Chip Select 0 +#define AT91C_PIO_PA22 ((unsigned int) 1 << 22) // Pin Controlled by PA22 +#define AT91C_PA22_TK ((unsigned int) AT91C_PIO_PA22) // SSC Transmit Clock +#define AT91C_PA22_SPI1_SPCK ((unsigned int) AT91C_PIO_PA22) // SPI 1 Serial Clock +#define AT91C_PIO_PA23 ((unsigned int) 1 << 23) // Pin Controlled by PA23 +#define AT91C_PA23_TD ((unsigned int) AT91C_PIO_PA23) // SSC Transmit data +#define AT91C_PA23_SPI1_MOSI ((unsigned int) AT91C_PIO_PA23) // SPI 1 Master Out Slave +#define AT91C_PIO_PA24 ((unsigned int) 1 << 24) // Pin Controlled by PA24 +#define AT91C_PA24_RD ((unsigned int) AT91C_PIO_PA24) // SSC Receive Data +#define AT91C_PA24_SPI1_MISO ((unsigned int) AT91C_PIO_PA24) // SPI 1 Master In Slave +#define AT91C_PIO_PA25 ((unsigned int) 1 << 25) // Pin Controlled by PA25 +#define AT91C_PA25_RK ((unsigned int) AT91C_PIO_PA25) // SSC Receive Clock +#define AT91C_PA25_SPI1_NPCS1 ((unsigned int) AT91C_PIO_PA25) // SPI 1 Peripheral Chip Select 1 +#define AT91C_PIO_PA26 ((unsigned int) 1 << 26) // Pin Controlled by PA26 +#define AT91C_PA26_RF ((unsigned int) AT91C_PIO_PA26) // SSC Receive Frame Sync +#define AT91C_PA26_SPI1_NPCS2 ((unsigned int) AT91C_PIO_PA26) // SPI 1 Peripheral Chip Select 2 +#define AT91C_PIO_PA27 ((unsigned int) 1 << 27) // Pin Controlled by PA27 +#define AT91C_PA27_DRXD ((unsigned int) AT91C_PIO_PA27) // DBGU Debug Receive Data +#define AT91C_PA27_PCK3 ((unsigned int) AT91C_PIO_PA27) // PMC Programmable Clock Output 3 +#define AT91C_PIO_PA28 ((unsigned int) 1 << 28) // Pin Controlled by PA28 +#define AT91C_PA28_DTXD ((unsigned int) AT91C_PIO_PA28) // DBGU Debug Transmit Data +#define AT91C_PIO_PA29 ((unsigned int) 1 << 29) // Pin Controlled by PA29 +#define AT91C_PA29_FIQ ((unsigned int) AT91C_PIO_PA29) // AIC Fast Interrupt Input +#define AT91C_PA29_SPI1_NPCS3 ((unsigned int) AT91C_PIO_PA29) // SPI 1 Peripheral Chip Select 3 +#define AT91C_PIO_PA3 ((unsigned int) 1 << 3) // Pin Controlled by PA3 +#define AT91C_PA3_RTS0 ((unsigned int) AT91C_PIO_PA3) // USART 0 Ready To Send +#define AT91C_PA3_SPI1_NPCS2 ((unsigned int) AT91C_PIO_PA3) // SPI 1 Peripheral Chip Select 2 +#define AT91C_PIO_PA30 ((unsigned int) 1 << 30) // Pin Controlled by PA30 +#define AT91C_PA30_IRQ0 ((unsigned int) AT91C_PIO_PA30) // External Interrupt 0 +#define AT91C_PA30_PCK2 ((unsigned int) AT91C_PIO_PA30) // PMC Programmable Clock Output 2 +#define AT91C_PIO_PA4 ((unsigned int) 1 << 4) // Pin Controlled by PA4 +#define AT91C_PA4_CTS0 ((unsigned int) AT91C_PIO_PA4) // USART 0 Clear To Send +#define AT91C_PA4_SPI1_NPCS3 ((unsigned int) AT91C_PIO_PA4) // SPI 1 Peripheral Chip Select 3 +#define AT91C_PIO_PA5 ((unsigned int) 1 << 5) // Pin Controlled by PA5 +#define AT91C_PA5_RXD1 ((unsigned int) AT91C_PIO_PA5) // USART 1 Receive Data +#define AT91C_PIO_PA6 ((unsigned int) 1 << 6) // Pin Controlled by PA6 +#define AT91C_PA6_TXD1 ((unsigned int) AT91C_PIO_PA6) // USART 1 Transmit Data +#define AT91C_PIO_PA7 ((unsigned int) 1 << 7) // Pin Controlled by PA7 +#define AT91C_PA7_SCK1 ((unsigned int) AT91C_PIO_PA7) // USART 1 Serial Clock +#define AT91C_PA7_SPI0_NPCS1 ((unsigned int) AT91C_PIO_PA7) // SPI 0 Peripheral Chip Select 1 +#define AT91C_PIO_PA8 ((unsigned int) 1 << 8) // Pin Controlled by PA8 +#define AT91C_PA8_RTS1 ((unsigned int) AT91C_PIO_PA8) // USART 1 Ready To Send +#define AT91C_PA8_SPI0_NPCS2 ((unsigned int) AT91C_PIO_PA8) // SPI 0 Peripheral Chip Select 2 +#define AT91C_PIO_PA9 ((unsigned int) 1 << 9) // Pin Controlled by PA9 +#define AT91C_PA9_CTS1 ((unsigned int) AT91C_PIO_PA9) // USART 1 Clear To Send +#define AT91C_PA9_SPI0_NPCS3 ((unsigned int) AT91C_PIO_PA9) // SPI 0 Peripheral Chip Select 3 +#define AT91C_PIO_PB0 ((unsigned int) 1 << 0) // Pin Controlled by PB0 +#define AT91C_PB0_ETXCK_EREFCK ((unsigned int) AT91C_PIO_PB0) // Ethernet MAC Transmit Clock/Reference Clock +#define AT91C_PB0_PCK0 ((unsigned int) AT91C_PIO_PB0) // PMC Programmable Clock Output 0 +#define AT91C_PIO_PB1 ((unsigned int) 1 << 1) // Pin Controlled by PB1 +#define AT91C_PB1_ETXEN ((unsigned int) AT91C_PIO_PB1) // Ethernet MAC Transmit Enable +#define AT91C_PIO_PB10 ((unsigned int) 1 << 10) // Pin Controlled by PB10 +#define AT91C_PB10_ETX2 ((unsigned int) AT91C_PIO_PB10) // Ethernet MAC Transmit Data 2 +#define AT91C_PB10_SPI1_NPCS1 ((unsigned int) AT91C_PIO_PB10) // SPI 1 Peripheral Chip Select 1 +#define AT91C_PIO_PB11 ((unsigned int) 1 << 11) // Pin Controlled by PB11 +#define AT91C_PB11_ETX3 ((unsigned int) AT91C_PIO_PB11) // Ethernet MAC Transmit Data 3 +#define AT91C_PB11_SPI1_NPCS2 ((unsigned int) AT91C_PIO_PB11) // SPI 1 Peripheral Chip Select 2 +#define AT91C_PIO_PB12 ((unsigned int) 1 << 12) // Pin Controlled by PB12 +#define AT91C_PB12_ETXER ((unsigned int) AT91C_PIO_PB12) // Ethernet MAC Transmikt Coding Error +#define AT91C_PB12_TCLK0 ((unsigned int) AT91C_PIO_PB12) // Timer Counter 0 external clock input +#define AT91C_PIO_PB13 ((unsigned int) 1 << 13) // Pin Controlled by PB13 +#define AT91C_PB13_ERX2 ((unsigned int) AT91C_PIO_PB13) // Ethernet MAC Receive Data 2 +#define AT91C_PB13_SPI0_NPCS1 ((unsigned int) AT91C_PIO_PB13) // SPI 0 Peripheral Chip Select 1 +#define AT91C_PIO_PB14 ((unsigned int) 1 << 14) // Pin Controlled by PB14 +#define AT91C_PB14_ERX3 ((unsigned int) AT91C_PIO_PB14) // Ethernet MAC Receive Data 3 +#define AT91C_PB14_SPI0_NPCS2 ((unsigned int) AT91C_PIO_PB14) // SPI 0 Peripheral Chip Select 2 +#define AT91C_PIO_PB15 ((unsigned int) 1 << 15) // Pin Controlled by PB15 +#define AT91C_PB15_ERXDV_ECRSDV ((unsigned int) AT91C_PIO_PB15) // Ethernet MAC Receive Data Valid +#define AT91C_PIO_PB16 ((unsigned int) 1 << 16) // Pin Controlled by PB16 +#define AT91C_PB16_ECOL ((unsigned int) AT91C_PIO_PB16) // Ethernet MAC Collision Detected +#define AT91C_PB16_SPI1_NPCS3 ((unsigned int) AT91C_PIO_PB16) // SPI 1 Peripheral Chip Select 3 +#define AT91C_PIO_PB17 ((unsigned int) 1 << 17) // Pin Controlled by PB17 +#define AT91C_PB17_ERXCK ((unsigned int) AT91C_PIO_PB17) // Ethernet MAC Receive Clock +#define AT91C_PB17_SPI0_NPCS3 ((unsigned int) AT91C_PIO_PB17) // SPI 0 Peripheral Chip Select 3 +#define AT91C_PIO_PB18 ((unsigned int) 1 << 18) // Pin Controlled by PB18 +#define AT91C_PB18_EF100 ((unsigned int) AT91C_PIO_PB18) // Ethernet MAC Force 100 Mbits/sec +#define AT91C_PB18_ADTRG ((unsigned int) AT91C_PIO_PB18) // ADC External Trigger +#define AT91C_PIO_PB19 ((unsigned int) 1 << 19) // Pin Controlled by PB19 +#define AT91C_PB19_PWM0 ((unsigned int) AT91C_PIO_PB19) // PWM Channel 0 +#define AT91C_PB19_TCLK1 ((unsigned int) AT91C_PIO_PB19) // Timer Counter 1 external clock input +#define AT91C_PIO_PB2 ((unsigned int) 1 << 2) // Pin Controlled by PB2 +#define AT91C_PB2_ETX0 ((unsigned int) AT91C_PIO_PB2) // Ethernet MAC Transmit Data 0 +#define AT91C_PIO_PB20 ((unsigned int) 1 << 20) // Pin Controlled by PB20 +#define AT91C_PB20_PWM1 ((unsigned int) AT91C_PIO_PB20) // PWM Channel 1 +#define AT91C_PB20_PCK0 ((unsigned int) AT91C_PIO_PB20) // PMC Programmable Clock Output 0 +#define AT91C_PIO_PB21 ((unsigned int) 1 << 21) // Pin Controlled by PB21 +#define AT91C_PB21_PWM2 ((unsigned int) AT91C_PIO_PB21) // PWM Channel 2 +#define AT91C_PB21_PCK1 ((unsigned int) AT91C_PIO_PB21) // PMC Programmable Clock Output 1 +#define AT91C_PIO_PB22 ((unsigned int) 1 << 22) // Pin Controlled by PB22 +#define AT91C_PB22_PWM3 ((unsigned int) AT91C_PIO_PB22) // PWM Channel 3 +#define AT91C_PB22_PCK2 ((unsigned int) AT91C_PIO_PB22) // PMC Programmable Clock Output 2 +#define AT91C_PIO_PB23 ((unsigned int) 1 << 23) // Pin Controlled by PB23 +#define AT91C_PB23_TIOA0 ((unsigned int) AT91C_PIO_PB23) // Timer Counter 0 Multipurpose Timer I/O Pin A +#define AT91C_PB23_DCD1 ((unsigned int) AT91C_PIO_PB23) // USART 1 Data Carrier Detect +#define AT91C_PIO_PB24 ((unsigned int) 1 << 24) // Pin Controlled by PB24 +#define AT91C_PB24_TIOB0 ((unsigned int) AT91C_PIO_PB24) // Timer Counter 0 Multipurpose Timer I/O Pin B +#define AT91C_PB24_DSR1 ((unsigned int) AT91C_PIO_PB24) // USART 1 Data Set ready +#define AT91C_PIO_PB25 ((unsigned int) 1 << 25) // Pin Controlled by PB25 +#define AT91C_PB25_TIOA1 ((unsigned int) AT91C_PIO_PB25) // Timer Counter 1 Multipurpose Timer I/O Pin A +#define AT91C_PB25_DTR1 ((unsigned int) AT91C_PIO_PB25) // USART 1 Data Terminal ready +#define AT91C_PIO_PB26 ((unsigned int) 1 << 26) // Pin Controlled by PB26 +#define AT91C_PB26_TIOB1 ((unsigned int) AT91C_PIO_PB26) // Timer Counter 1 Multipurpose Timer I/O Pin B +#define AT91C_PB26_RI1 ((unsigned int) AT91C_PIO_PB26) // USART 1 Ring Indicator +#define AT91C_PIO_PB27 ((unsigned int) 1 << 27) // Pin Controlled by PB27 +#define AT91C_PB27_TIOA2 ((unsigned int) AT91C_PIO_PB27) // Timer Counter 2 Multipurpose Timer I/O Pin A +#define AT91C_PB27_PWM0 ((unsigned int) AT91C_PIO_PB27) // PWM Channel 0 +#define AT91C_PIO_PB28 ((unsigned int) 1 << 28) // Pin Controlled by PB28 +#define AT91C_PB28_TIOB2 ((unsigned int) AT91C_PIO_PB28) // Timer Counter 2 Multipurpose Timer I/O Pin B +#define AT91C_PB28_PWM1 ((unsigned int) AT91C_PIO_PB28) // PWM Channel 1 +#define AT91C_PIO_PB29 ((unsigned int) 1 << 29) // Pin Controlled by PB29 +#define AT91C_PB29_PCK1 ((unsigned int) AT91C_PIO_PB29) // PMC Programmable Clock Output 1 +#define AT91C_PB29_PWM2 ((unsigned int) AT91C_PIO_PB29) // PWM Channel 2 +#define AT91C_PIO_PB3 ((unsigned int) 1 << 3) // Pin Controlled by PB3 +#define AT91C_PB3_ETX1 ((unsigned int) AT91C_PIO_PB3) // Ethernet MAC Transmit Data 1 +#define AT91C_PIO_PB30 ((unsigned int) 1 << 30) // Pin Controlled by PB30 +#define AT91C_PB30_PCK2 ((unsigned int) AT91C_PIO_PB30) // PMC Programmable Clock Output 2 +#define AT91C_PB30_PWM3 ((unsigned int) AT91C_PIO_PB30) // PWM Channel 3 +#define AT91C_PIO_PB4 ((unsigned int) 1 << 4) // Pin Controlled by PB4 +#define AT91C_PB4_ECRS ((unsigned int) AT91C_PIO_PB4) // Ethernet MAC Carrier Sense/Carrier Sense and Data Valid +#define AT91C_PIO_PB5 ((unsigned int) 1 << 5) // Pin Controlled by PB5 +#define AT91C_PB5_ERX0 ((unsigned int) AT91C_PIO_PB5) // Ethernet MAC Receive Data 0 +#define AT91C_PIO_PB6 ((unsigned int) 1 << 6) // Pin Controlled by PB6 +#define AT91C_PB6_ERX1 ((unsigned int) AT91C_PIO_PB6) // Ethernet MAC Receive Data 1 +#define AT91C_PIO_PB7 ((unsigned int) 1 << 7) // Pin Controlled by PB7 +#define AT91C_PB7_ERXER ((unsigned int) AT91C_PIO_PB7) // Ethernet MAC Receive Error +#define AT91C_PIO_PB8 ((unsigned int) 1 << 8) // Pin Controlled by PB8 +#define AT91C_PB8_EMDC ((unsigned int) AT91C_PIO_PB8) // Ethernet MAC Management Data Clock +#define AT91C_PIO_PB9 ((unsigned int) 1 << 9) // Pin Controlled by PB9 +#define AT91C_PB9_EMDIO ((unsigned int) AT91C_PIO_PB9) // Ethernet MAC Management Data Input/Output + +// ***************************************************************************** +// PERIPHERAL ID DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** +#define AT91C_ID_FIQ ((unsigned int) 0) // Advanced Interrupt Controller (FIQ) +#define AT91C_ID_SYS ((unsigned int) 1) // System Peripheral +#define AT91C_ID_PIOA ((unsigned int) 2) // Parallel IO Controller A +#define AT91C_ID_PIOB ((unsigned int) 3) // Parallel IO Controller B +#define AT91C_ID_SPI0 ((unsigned int) 4) // Serial Peripheral Interface 0 +#define AT91C_ID_SPI1 ((unsigned int) 5) // Serial Peripheral Interface 1 +#define AT91C_ID_US0 ((unsigned int) 6) // USART 0 +#define AT91C_ID_US1 ((unsigned int) 7) // USART 1 +#define AT91C_ID_SSC ((unsigned int) 8) // Serial Synchronous Controller +#define AT91C_ID_TWI ((unsigned int) 9) // Two-Wire Interface +#define AT91C_ID_PWMC ((unsigned int) 10) // PWM Controller +#define AT91C_ID_UDP ((unsigned int) 11) // USB Device Port +#define AT91C_ID_TC0 ((unsigned int) 12) // Timer Counter 0 +#define AT91C_ID_TC1 ((unsigned int) 13) // Timer Counter 1 +#define AT91C_ID_TC2 ((unsigned int) 14) // Timer Counter 2 +#define AT91C_ID_CAN ((unsigned int) 15) // Control Area Network Controller +#define AT91C_ID_EMAC ((unsigned int) 16) // Ethernet MAC +#define AT91C_ID_ADC ((unsigned int) 17) // Analog-to-Digital Converter +#define AT91C_ID_18_Reserved ((unsigned int) 18) // Reserved +#define AT91C_ID_19_Reserved ((unsigned int) 19) // Reserved +#define AT91C_ID_20_Reserved ((unsigned int) 20) // Reserved +#define AT91C_ID_21_Reserved ((unsigned int) 21) // Reserved +#define AT91C_ID_22_Reserved ((unsigned int) 22) // Reserved +#define AT91C_ID_23_Reserved ((unsigned int) 23) // Reserved +#define AT91C_ID_24_Reserved ((unsigned int) 24) // Reserved +#define AT91C_ID_25_Reserved ((unsigned int) 25) // Reserved +#define AT91C_ID_26_Reserved ((unsigned int) 26) // Reserved +#define AT91C_ID_27_Reserved ((unsigned int) 27) // Reserved +#define AT91C_ID_28_Reserved ((unsigned int) 28) // Reserved +#define AT91C_ID_29_Reserved ((unsigned int) 29) // Reserved +#define AT91C_ID_IRQ0 ((unsigned int) 30) // Advanced Interrupt Controller (IRQ0) +#define AT91C_ID_IRQ1 ((unsigned int) 31) // Advanced Interrupt Controller (IRQ1) +#define AT91C_ALL_INT ((unsigned int) 0xC003FFFF) // ALL VALID INTERRUPTS + +// ***************************************************************************** +// BASE ADDRESS DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** +#define AT91C_BASE_SYS ((AT91PS_SYS) 0xFFFFF000) // (SYS) Base Address +#define AT91C_BASE_AIC ((AT91PS_AIC) 0xFFFFF000) // (AIC) Base Address +#define AT91C_BASE_PDC_DBGU ((AT91PS_PDC) 0xFFFFF300) // (PDC_DBGU) Base Address +#define AT91C_BASE_DBGU ((AT91PS_DBGU) 0xFFFFF200) // (DBGU) Base Address +#define AT91C_BASE_PIOA ((AT91PS_PIO) 0xFFFFF400) // (PIOA) Base Address +#define AT91C_BASE_PIOB ((AT91PS_PIO) 0xFFFFF600) // (PIOB) Base Address +#define AT91C_BASE_CKGR ((AT91PS_CKGR) 0xFFFFFC20) // (CKGR) Base Address +#define AT91C_BASE_PMC ((AT91PS_PMC) 0xFFFFFC00) // (PMC) Base Address +#define AT91C_BASE_RSTC ((AT91PS_RSTC) 0xFFFFFD00) // (RSTC) Base Address +#define AT91C_BASE_RTTC ((AT91PS_RTTC) 0xFFFFFD20) // (RTTC) Base Address +#define AT91C_BASE_PITC ((AT91PS_PITC) 0xFFFFFD30) // (PITC) Base Address +#define AT91C_BASE_WDTC ((AT91PS_WDTC) 0xFFFFFD40) // (WDTC) Base Address +#define AT91C_BASE_VREG ((AT91PS_VREG) 0xFFFFFD60) // (VREG) Base Address +#define AT91C_BASE_MC ((AT91PS_MC) 0xFFFFFF00) // (MC) Base Address +#define AT91C_BASE_PDC_SPI1 ((AT91PS_PDC) 0xFFFE4100) // (PDC_SPI1) Base Address +#define AT91C_BASE_SPI1 ((AT91PS_SPI) 0xFFFE4000) // (SPI1) Base Address +#define AT91C_BASE_PDC_SPI0 ((AT91PS_PDC) 0xFFFE0100) // (PDC_SPI0) Base Address +#define AT91C_BASE_SPI0 ((AT91PS_SPI) 0xFFFE0000) // (SPI0) Base Address +#define AT91C_BASE_PDC_US1 ((AT91PS_PDC) 0xFFFC4100) // (PDC_US1) Base Address +#define AT91C_BASE_US1 ((AT91PS_USART) 0xFFFC4000) // (US1) Base Address +#define AT91C_BASE_PDC_US0 ((AT91PS_PDC) 0xFFFC0100) // (PDC_US0) Base Address +#define AT91C_BASE_US0 ((AT91PS_USART) 0xFFFC0000) // (US0) Base Address +#define AT91C_BASE_PDC_SSC ((AT91PS_PDC) 0xFFFD4100) // (PDC_SSC) Base Address +#define AT91C_BASE_SSC ((AT91PS_SSC) 0xFFFD4000) // (SSC) Base Address +#define AT91C_BASE_TWI ((AT91PS_TWI) 0xFFFB8000) // (TWI) Base Address +#define AT91C_BASE_PWMC_CH3 ((AT91PS_PWMC_CH) 0xFFFCC260) // (PWMC_CH3) Base Address +#define AT91C_BASE_PWMC_CH2 ((AT91PS_PWMC_CH) 0xFFFCC240) // (PWMC_CH2) Base Address +#define AT91C_BASE_PWMC_CH1 ((AT91PS_PWMC_CH) 0xFFFCC220) // (PWMC_CH1) Base Address +#define AT91C_BASE_PWMC_CH0 ((AT91PS_PWMC_CH) 0xFFFCC200) // (PWMC_CH0) Base Address +#define AT91C_BASE_PWMC ((AT91PS_PWMC) 0xFFFCC000) // (PWMC) Base Address +#define AT91C_BASE_UDP ((AT91PS_UDP) 0xFFFB0000) // (UDP) Base Address +#define AT91C_BASE_TC0 ((AT91PS_TC) 0xFFFA0000) // (TC0) Base Address +#define AT91C_BASE_TC1 ((AT91PS_TC) 0xFFFA0040) // (TC1) Base Address +#define AT91C_BASE_TC2 ((AT91PS_TC) 0xFFFA0080) // (TC2) Base Address +#define AT91C_BASE_TCB ((AT91PS_TCB) 0xFFFA0000) // (TCB) Base Address +#define AT91C_BASE_CAN_MB0 ((AT91PS_CAN_MB) 0xFFFD0200) // (CAN_MB0) Base Address +#define AT91C_BASE_CAN_MB1 ((AT91PS_CAN_MB) 0xFFFD0220) // (CAN_MB1) Base Address +#define AT91C_BASE_CAN_MB2 ((AT91PS_CAN_MB) 0xFFFD0240) // (CAN_MB2) Base Address +#define AT91C_BASE_CAN_MB3 ((AT91PS_CAN_MB) 0xFFFD0260) // (CAN_MB3) Base Address +#define AT91C_BASE_CAN_MB4 ((AT91PS_CAN_MB) 0xFFFD0280) // (CAN_MB4) Base Address +#define AT91C_BASE_CAN_MB5 ((AT91PS_CAN_MB) 0xFFFD02A0) // (CAN_MB5) Base Address +#define AT91C_BASE_CAN_MB6 ((AT91PS_CAN_MB) 0xFFFD02C0) // (CAN_MB6) Base Address +#define AT91C_BASE_CAN_MB7 ((AT91PS_CAN_MB) 0xFFFD02E0) // (CAN_MB7) Base Address +#define AT91C_BASE_CAN ((AT91PS_CAN) 0xFFFD0000) // (CAN) Base Address +#define AT91C_BASE_EMAC ((AT91PS_EMAC) 0xFFFDC000) // (EMAC) Base Address +#define AT91C_BASE_PDC_ADC ((AT91PS_PDC) 0xFFFD8100) // (PDC_ADC) Base Address +#define AT91C_BASE_ADC ((AT91PS_ADC) 0xFFFD8000) // (ADC) Base Address + +// ***************************************************************************** +// MEMORY MAPPING DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** +// ISRAM +#define AT91C_ISRAM ((char *) 0x00200000) // Internal SRAM base address +#define AT91C_ISRAM_SIZE ((unsigned int) 0x00010000) // Internal SRAM size in byte (64 Kbytes) +// IFLASH +#define AT91C_IFLASH ((char *) 0x00100000) // Internal FLASH base address +#define AT91C_IFLASH_SIZE ((unsigned int) 0x00040000) // Internal FLASH size in byte (256 Kbytes) +#define AT91C_IFLASH_PAGE_SIZE ((unsigned int) 256) // Internal FLASH Page Size: 256 bytes +#define AT91C_IFLASH_LOCK_REGION_SIZE ((unsigned int) 16384) // Internal FLASH Lock Region Size: 16 Kbytes +#define AT91C_IFLASH_NB_OF_PAGES ((unsigned int) 1024) // Internal FLASH Number of Pages: 1024 bytes +#define AT91C_IFLASH_NB_OF_LOCK_BITS ((unsigned int) 16) // Internal FLASH Number of Lock Bits: 16 bytes +#endif /* __IAR_SYSTEMS_ICC__ */ + +#ifdef __IAR_SYSTEMS_ASM__ + +// - Hardware register definition + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR System Peripherals +// - ***************************************************************************** + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Advanced Interrupt Controller +// - ***************************************************************************** +// - -------- AIC_SMR : (AIC Offset: 0x0) Control Register -------- +AT91C_AIC_PRIOR EQU (0x7 << 0) ;- (AIC) Priority Level +AT91C_AIC_PRIOR_LOWEST EQU (0x0) ;- (AIC) Lowest priority level +AT91C_AIC_PRIOR_HIGHEST EQU (0x7) ;- (AIC) Highest priority level +AT91C_AIC_SRCTYPE EQU (0x3 << 5) ;- (AIC) Interrupt Source Type +AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL EQU (0x0 << 5) ;- (AIC) Internal Sources Code Label High-level Sensitive +AT91C_AIC_SRCTYPE_EXT_LOW_LEVEL EQU (0x0 << 5) ;- (AIC) External Sources Code Label Low-level Sensitive +AT91C_AIC_SRCTYPE_INT_POSITIVE_EDGE EQU (0x1 << 5) ;- (AIC) Internal Sources Code Label Positive Edge triggered +AT91C_AIC_SRCTYPE_EXT_NEGATIVE_EDGE EQU (0x1 << 5) ;- (AIC) External Sources Code Label Negative Edge triggered +AT91C_AIC_SRCTYPE_HIGH_LEVEL EQU (0x2 << 5) ;- (AIC) Internal Or External Sources Code Label High-level Sensitive +AT91C_AIC_SRCTYPE_POSITIVE_EDGE EQU (0x3 << 5) ;- (AIC) Internal Or External Sources Code Label Positive Edge triggered +// - -------- AIC_CISR : (AIC Offset: 0x114) AIC Core Interrupt Status Register -------- +AT91C_AIC_NFIQ EQU (0x1 << 0) ;- (AIC) NFIQ Status +AT91C_AIC_NIRQ EQU (0x1 << 1) ;- (AIC) NIRQ Status +// - -------- AIC_DCR : (AIC Offset: 0x138) AIC Debug Control Register (Protect) -------- +AT91C_AIC_DCR_PROT EQU (0x1 << 0) ;- (AIC) Protection Mode +AT91C_AIC_DCR_GMSK EQU (0x1 << 1) ;- (AIC) General Mask + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Peripheral DMA Controller +// - ***************************************************************************** +// - -------- PDC_PTCR : (PDC Offset: 0x20) PDC Transfer Control Register -------- +AT91C_PDC_RXTEN EQU (0x1 << 0) ;- (PDC) Receiver Transfer Enable +AT91C_PDC_RXTDIS EQU (0x1 << 1) ;- (PDC) Receiver Transfer Disable +AT91C_PDC_TXTEN EQU (0x1 << 8) ;- (PDC) Transmitter Transfer Enable +AT91C_PDC_TXTDIS EQU (0x1 << 9) ;- (PDC) Transmitter Transfer Disable +// - -------- PDC_PTSR : (PDC Offset: 0x24) PDC Transfer Status Register -------- + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Debug Unit +// - ***************************************************************************** +// - -------- DBGU_CR : (DBGU Offset: 0x0) Debug Unit Control Register -------- +AT91C_US_RSTRX EQU (0x1 << 2) ;- (DBGU) Reset Receiver +AT91C_US_RSTTX EQU (0x1 << 3) ;- (DBGU) Reset Transmitter +AT91C_US_RXEN EQU (0x1 << 4) ;- (DBGU) Receiver Enable +AT91C_US_RXDIS EQU (0x1 << 5) ;- (DBGU) Receiver Disable +AT91C_US_TXEN EQU (0x1 << 6) ;- (DBGU) Transmitter Enable +AT91C_US_TXDIS EQU (0x1 << 7) ;- (DBGU) Transmitter Disable +AT91C_US_RSTSTA EQU (0x1 << 8) ;- (DBGU) Reset Status Bits +// - -------- DBGU_MR : (DBGU Offset: 0x4) Debug Unit Mode Register -------- +AT91C_US_PAR EQU (0x7 << 9) ;- (DBGU) Parity type +AT91C_US_PAR_EVEN EQU (0x0 << 9) ;- (DBGU) Even Parity +AT91C_US_PAR_ODD EQU (0x1 << 9) ;- (DBGU) Odd Parity +AT91C_US_PAR_SPACE EQU (0x2 << 9) ;- (DBGU) Parity forced to 0 (Space) +AT91C_US_PAR_MARK EQU (0x3 << 9) ;- (DBGU) Parity forced to 1 (Mark) +AT91C_US_PAR_NONE EQU (0x4 << 9) ;- (DBGU) No Parity +AT91C_US_PAR_MULTI_DROP EQU (0x6 << 9) ;- (DBGU) Multi-drop mode +AT91C_US_CHMODE EQU (0x3 << 14) ;- (DBGU) Channel Mode +AT91C_US_CHMODE_NORMAL EQU (0x0 << 14) ;- (DBGU) Normal Mode: The USART channel operates as an RX/TX USART. +AT91C_US_CHMODE_AUTO EQU (0x1 << 14) ;- (DBGU) Automatic Echo: Receiver Data Input is connected to the TXD pin. +AT91C_US_CHMODE_LOCAL EQU (0x2 << 14) ;- (DBGU) Local Loopback: Transmitter Output Signal is connected to Receiver Input Signal. +AT91C_US_CHMODE_REMOTE EQU (0x3 << 14) ;- (DBGU) Remote Loopback: RXD pin is internally connected to TXD pin. +// - -------- DBGU_IER : (DBGU Offset: 0x8) Debug Unit Interrupt Enable Register -------- +AT91C_US_RXRDY EQU (0x1 << 0) ;- (DBGU) RXRDY Interrupt +AT91C_US_TXRDY EQU (0x1 << 1) ;- (DBGU) TXRDY Interrupt +AT91C_US_ENDRX EQU (0x1 << 3) ;- (DBGU) End of Receive Transfer Interrupt +AT91C_US_ENDTX EQU (0x1 << 4) ;- (DBGU) End of Transmit Interrupt +AT91C_US_OVRE EQU (0x1 << 5) ;- (DBGU) Overrun Interrupt +AT91C_US_FRAME EQU (0x1 << 6) ;- (DBGU) Framing Error Interrupt +AT91C_US_PARE EQU (0x1 << 7) ;- (DBGU) Parity Error Interrupt +AT91C_US_TXEMPTY EQU (0x1 << 9) ;- (DBGU) TXEMPTY Interrupt +AT91C_US_TXBUFE EQU (0x1 << 11) ;- (DBGU) TXBUFE Interrupt +AT91C_US_RXBUFF EQU (0x1 << 12) ;- (DBGU) RXBUFF Interrupt +AT91C_US_COMM_TX EQU (0x1 << 30) ;- (DBGU) COMM_TX Interrupt +AT91C_US_COMM_RX EQU (0x1 << 31) ;- (DBGU) COMM_RX Interrupt +// - -------- DBGU_IDR : (DBGU Offset: 0xc) Debug Unit Interrupt Disable Register -------- +// - -------- DBGU_IMR : (DBGU Offset: 0x10) Debug Unit Interrupt Mask Register -------- +// - -------- DBGU_CSR : (DBGU Offset: 0x14) Debug Unit Channel Status Register -------- +// - -------- DBGU_FNTR : (DBGU Offset: 0x48) Debug Unit FORCE_NTRST Register -------- +AT91C_US_FORCE_NTRST EQU (0x1 << 0) ;- (DBGU) Force NTRST in JTAG + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Parallel Input Output Controler +// - ***************************************************************************** + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Clock Generator Controler +// - ***************************************************************************** +// - -------- CKGR_MOR : (CKGR Offset: 0x0) Main Oscillator Register -------- +AT91C_CKGR_MOSCEN EQU (0x1 << 0) ;- (CKGR) Main Oscillator Enable +AT91C_CKGR_OSCBYPASS EQU (0x1 << 1) ;- (CKGR) Main Oscillator Bypass +AT91C_CKGR_OSCOUNT EQU (0xFF << 8) ;- (CKGR) Main Oscillator Start-up Time +// - -------- CKGR_MCFR : (CKGR Offset: 0x4) Main Clock Frequency Register -------- +AT91C_CKGR_MAINF EQU (0xFFFF << 0) ;- (CKGR) Main Clock Frequency +AT91C_CKGR_MAINRDY EQU (0x1 << 16) ;- (CKGR) Main Clock Ready +// - -------- CKGR_PLLR : (CKGR Offset: 0xc) PLL B Register -------- +AT91C_CKGR_DIV EQU (0xFF << 0) ;- (CKGR) Divider Selected +AT91C_CKGR_DIV_0 EQU (0x0) ;- (CKGR) Divider output is 0 +AT91C_CKGR_DIV_BYPASS EQU (0x1) ;- (CKGR) Divider is bypassed +AT91C_CKGR_PLLCOUNT EQU (0x3F << 8) ;- (CKGR) PLL Counter +AT91C_CKGR_OUT EQU (0x3 << 14) ;- (CKGR) PLL Output Frequency Range +AT91C_CKGR_OUT_0 EQU (0x0 << 14) ;- (CKGR) Please refer to the PLL datasheet +AT91C_CKGR_OUT_1 EQU (0x1 << 14) ;- (CKGR) Please refer to the PLL datasheet +AT91C_CKGR_OUT_2 EQU (0x2 << 14) ;- (CKGR) Please refer to the PLL datasheet +AT91C_CKGR_OUT_3 EQU (0x3 << 14) ;- (CKGR) Please refer to the PLL datasheet +AT91C_CKGR_MUL EQU (0x7FF << 16) ;- (CKGR) PLL Multiplier +AT91C_CKGR_USBDIV EQU (0x3 << 28) ;- (CKGR) Divider for USB Clocks +AT91C_CKGR_USBDIV_0 EQU (0x0 << 28) ;- (CKGR) Divider output is PLL clock output +AT91C_CKGR_USBDIV_1 EQU (0x1 << 28) ;- (CKGR) Divider output is PLL clock output divided by 2 +AT91C_CKGR_USBDIV_2 EQU (0x2 << 28) ;- (CKGR) Divider output is PLL clock output divided by 4 + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Power Management Controler +// - ***************************************************************************** +// - -------- PMC_SCER : (PMC Offset: 0x0) System Clock Enable Register -------- +AT91C_PMC_PCK EQU (0x1 << 0) ;- (PMC) Processor Clock +AT91C_PMC_UDP EQU (0x1 << 7) ;- (PMC) USB Device Port Clock +AT91C_PMC_PCK0 EQU (0x1 << 8) ;- (PMC) Programmable Clock Output +AT91C_PMC_PCK1 EQU (0x1 << 9) ;- (PMC) Programmable Clock Output +AT91C_PMC_PCK2 EQU (0x1 << 10) ;- (PMC) Programmable Clock Output +AT91C_PMC_PCK3 EQU (0x1 << 11) ;- (PMC) Programmable Clock Output +// - -------- PMC_SCDR : (PMC Offset: 0x4) System Clock Disable Register -------- +// - -------- PMC_SCSR : (PMC Offset: 0x8) System Clock Status Register -------- +// - -------- CKGR_MOR : (PMC Offset: 0x20) Main Oscillator Register -------- +// - -------- CKGR_MCFR : (PMC Offset: 0x24) Main Clock Frequency Register -------- +// - -------- CKGR_PLLR : (PMC Offset: 0x2c) PLL B Register -------- +// - -------- PMC_MCKR : (PMC Offset: 0x30) Master Clock Register -------- +AT91C_PMC_CSS EQU (0x3 << 0) ;- (PMC) Programmable Clock Selection +AT91C_PMC_CSS_SLOW_CLK EQU (0x0) ;- (PMC) Slow Clock is selected +AT91C_PMC_CSS_MAIN_CLK EQU (0x1) ;- (PMC) Main Clock is selected +AT91C_PMC_CSS_PLL_CLK EQU (0x3) ;- (PMC) Clock from PLL is selected +AT91C_PMC_PRES EQU (0x7 << 2) ;- (PMC) Programmable Clock Prescaler +AT91C_PMC_PRES_CLK EQU (0x0 << 2) ;- (PMC) Selected clock +AT91C_PMC_PRES_CLK_2 EQU (0x1 << 2) ;- (PMC) Selected clock divided by 2 +AT91C_PMC_PRES_CLK_4 EQU (0x2 << 2) ;- (PMC) Selected clock divided by 4 +AT91C_PMC_PRES_CLK_8 EQU (0x3 << 2) ;- (PMC) Selected clock divided by 8 +AT91C_PMC_PRES_CLK_16 EQU (0x4 << 2) ;- (PMC) Selected clock divided by 16 +AT91C_PMC_PRES_CLK_32 EQU (0x5 << 2) ;- (PMC) Selected clock divided by 32 +AT91C_PMC_PRES_CLK_64 EQU (0x6 << 2) ;- (PMC) Selected clock divided by 64 +// - -------- PMC_PCKR : (PMC Offset: 0x40) Programmable Clock Register -------- +// - -------- PMC_IER : (PMC Offset: 0x60) PMC Interrupt Enable Register -------- +AT91C_PMC_MOSCS EQU (0x1 << 0) ;- (PMC) MOSC Status/Enable/Disable/Mask +AT91C_PMC_LOCK EQU (0x1 << 2) ;- (PMC) PLL Status/Enable/Disable/Mask +AT91C_PMC_MCKRDY EQU (0x1 << 3) ;- (PMC) MCK_RDY Status/Enable/Disable/Mask +AT91C_PMC_PCK0RDY EQU (0x1 << 8) ;- (PMC) PCK0_RDY Status/Enable/Disable/Mask +AT91C_PMC_PCK1RDY EQU (0x1 << 9) ;- (PMC) PCK1_RDY Status/Enable/Disable/Mask +AT91C_PMC_PCK2RDY EQU (0x1 << 10) ;- (PMC) PCK2_RDY Status/Enable/Disable/Mask +AT91C_PMC_PCK3RDY EQU (0x1 << 11) ;- (PMC) PCK3_RDY Status/Enable/Disable/Mask +// - -------- PMC_IDR : (PMC Offset: 0x64) PMC Interrupt Disable Register -------- +// - -------- PMC_SR : (PMC Offset: 0x68) PMC Status Register -------- +// - -------- PMC_IMR : (PMC Offset: 0x6c) PMC Interrupt Mask Register -------- + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Reset Controller Interface +// - ***************************************************************************** +// - -------- RSTC_RCR : (RSTC Offset: 0x0) Reset Control Register -------- +AT91C_RSTC_PROCRST EQU (0x1 << 0) ;- (RSTC) Processor Reset +AT91C_RSTC_PERRST EQU (0x1 << 2) ;- (RSTC) Peripheral Reset +AT91C_RSTC_EXTRST EQU (0x1 << 3) ;- (RSTC) External Reset +AT91C_RSTC_KEY EQU (0xFF << 24) ;- (RSTC) Password +// - -------- RSTC_RSR : (RSTC Offset: 0x4) Reset Status Register -------- +AT91C_RSTC_URSTS EQU (0x1 << 0) ;- (RSTC) User Reset Status +AT91C_RSTC_BODSTS EQU (0x1 << 1) ;- (RSTC) Brownout Detection Status +AT91C_RSTC_RSTTYP EQU (0x7 << 8) ;- (RSTC) Reset Type +AT91C_RSTC_RSTTYP_POWERUP EQU (0x0 << 8) ;- (RSTC) Power-up Reset. VDDCORE rising. +AT91C_RSTC_RSTTYP_WAKEUP EQU (0x1 << 8) ;- (RSTC) WakeUp Reset. VDDCORE rising. +AT91C_RSTC_RSTTYP_WATCHDOG EQU (0x2 << 8) ;- (RSTC) Watchdog Reset. Watchdog overflow occured. +AT91C_RSTC_RSTTYP_SOFTWARE EQU (0x3 << 8) ;- (RSTC) Software Reset. Processor reset required by the software. +AT91C_RSTC_RSTTYP_USER EQU (0x4 << 8) ;- (RSTC) User Reset. NRST pin detected low. +AT91C_RSTC_RSTTYP_BROWNOUT EQU (0x5 << 8) ;- (RSTC) Brownout Reset occured. +AT91C_RSTC_NRSTL EQU (0x1 << 16) ;- (RSTC) NRST pin level +AT91C_RSTC_SRCMP EQU (0x1 << 17) ;- (RSTC) Software Reset Command in Progress. +// - -------- RSTC_RMR : (RSTC Offset: 0x8) Reset Mode Register -------- +AT91C_RSTC_URSTEN EQU (0x1 << 0) ;- (RSTC) User Reset Enable +AT91C_RSTC_URSTIEN EQU (0x1 << 4) ;- (RSTC) User Reset Interrupt Enable +AT91C_RSTC_ERSTL EQU (0xF << 8) ;- (RSTC) User Reset Length +AT91C_RSTC_BODIEN EQU (0x1 << 16) ;- (RSTC) Brownout Detection Interrupt Enable + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Real Time Timer Controller Interface +// - ***************************************************************************** +// - -------- RTTC_RTMR : (RTTC Offset: 0x0) Real-time Mode Register -------- +AT91C_RTTC_RTPRES EQU (0xFFFF << 0) ;- (RTTC) Real-time Timer Prescaler Value +AT91C_RTTC_ALMIEN EQU (0x1 << 16) ;- (RTTC) Alarm Interrupt Enable +AT91C_RTTC_RTTINCIEN EQU (0x1 << 17) ;- (RTTC) Real Time Timer Increment Interrupt Enable +AT91C_RTTC_RTTRST EQU (0x1 << 18) ;- (RTTC) Real Time Timer Restart +// - -------- RTTC_RTAR : (RTTC Offset: 0x4) Real-time Alarm Register -------- +AT91C_RTTC_ALMV EQU (0x0 << 0) ;- (RTTC) Alarm Value +// - -------- RTTC_RTVR : (RTTC Offset: 0x8) Current Real-time Value Register -------- +AT91C_RTTC_CRTV EQU (0x0 << 0) ;- (RTTC) Current Real-time Value +// - -------- RTTC_RTSR : (RTTC Offset: 0xc) Real-time Status Register -------- +AT91C_RTTC_ALMS EQU (0x1 << 0) ;- (RTTC) Real-time Alarm Status +AT91C_RTTC_RTTINC EQU (0x1 << 1) ;- (RTTC) Real-time Timer Increment + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Periodic Interval Timer Controller Interface +// - ***************************************************************************** +// - -------- PITC_PIMR : (PITC Offset: 0x0) Periodic Interval Mode Register -------- +AT91C_PITC_PIV EQU (0xFFFFF << 0) ;- (PITC) Periodic Interval Value +AT91C_PITC_PITEN EQU (0x1 << 24) ;- (PITC) Periodic Interval Timer Enabled +AT91C_PITC_PITIEN EQU (0x1 << 25) ;- (PITC) Periodic Interval Timer Interrupt Enable +// - -------- PITC_PISR : (PITC Offset: 0x4) Periodic Interval Status Register -------- +AT91C_PITC_PITS EQU (0x1 << 0) ;- (PITC) Periodic Interval Timer Status +// - -------- PITC_PIVR : (PITC Offset: 0x8) Periodic Interval Value Register -------- +AT91C_PITC_CPIV EQU (0xFFFFF << 0) ;- (PITC) Current Periodic Interval Value +AT91C_PITC_PICNT EQU (0xFFF << 20) ;- (PITC) Periodic Interval Counter +// - -------- PITC_PIIR : (PITC Offset: 0xc) Periodic Interval Image Register -------- + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Watchdog Timer Controller Interface +// - ***************************************************************************** +// - -------- WDTC_WDCR : (WDTC Offset: 0x0) Periodic Interval Image Register -------- +AT91C_WDTC_WDRSTT EQU (0x1 << 0) ;- (WDTC) Watchdog Restart +AT91C_WDTC_KEY EQU (0xFF << 24) ;- (WDTC) Watchdog KEY Password +// - -------- WDTC_WDMR : (WDTC Offset: 0x4) Watchdog Mode Register -------- +AT91C_WDTC_WDV EQU (0xFFF << 0) ;- (WDTC) Watchdog Timer Restart +AT91C_WDTC_WDFIEN EQU (0x1 << 12) ;- (WDTC) Watchdog Fault Interrupt Enable +AT91C_WDTC_WDRSTEN EQU (0x1 << 13) ;- (WDTC) Watchdog Reset Enable +AT91C_WDTC_WDRPROC EQU (0x1 << 14) ;- (WDTC) Watchdog Timer Restart +AT91C_WDTC_WDDIS EQU (0x1 << 15) ;- (WDTC) Watchdog Disable +AT91C_WDTC_WDD EQU (0xFFF << 16) ;- (WDTC) Watchdog Delta Value +AT91C_WDTC_WDDBGHLT EQU (0x1 << 28) ;- (WDTC) Watchdog Debug Halt +AT91C_WDTC_WDIDLEHLT EQU (0x1 << 29) ;- (WDTC) Watchdog Idle Halt +// - -------- WDTC_WDSR : (WDTC Offset: 0x8) Watchdog Status Register -------- +AT91C_WDTC_WDUNF EQU (0x1 << 0) ;- (WDTC) Watchdog Underflow +AT91C_WDTC_WDERR EQU (0x1 << 1) ;- (WDTC) Watchdog Error + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Voltage Regulator Mode Controller Interface +// - ***************************************************************************** +// - -------- VREG_MR : (VREG Offset: 0x0) Voltage Regulator Mode Register -------- +AT91C_VREG_PSTDBY EQU (0x1 << 0) ;- (VREG) Voltage Regulator Power Standby Mode + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Memory Controller Interface +// - ***************************************************************************** +// - -------- MC_RCR : (MC Offset: 0x0) MC Remap Control Register -------- +AT91C_MC_RCB EQU (0x1 << 0) ;- (MC) Remap Command Bit +// - -------- MC_ASR : (MC Offset: 0x4) MC Abort Status Register -------- +AT91C_MC_UNDADD EQU (0x1 << 0) ;- (MC) Undefined Addess Abort Status +AT91C_MC_MISADD EQU (0x1 << 1) ;- (MC) Misaligned Addess Abort Status +AT91C_MC_ABTSZ EQU (0x3 << 8) ;- (MC) Abort Size Status +AT91C_MC_ABTSZ_BYTE EQU (0x0 << 8) ;- (MC) Byte +AT91C_MC_ABTSZ_HWORD EQU (0x1 << 8) ;- (MC) Half-word +AT91C_MC_ABTSZ_WORD EQU (0x2 << 8) ;- (MC) Word +AT91C_MC_ABTTYP EQU (0x3 << 10) ;- (MC) Abort Type Status +AT91C_MC_ABTTYP_DATAR EQU (0x0 << 10) ;- (MC) Data Read +AT91C_MC_ABTTYP_DATAW EQU (0x1 << 10) ;- (MC) Data Write +AT91C_MC_ABTTYP_FETCH EQU (0x2 << 10) ;- (MC) Code Fetch +AT91C_MC_MST0 EQU (0x1 << 16) ;- (MC) Master 0 Abort Source +AT91C_MC_MST1 EQU (0x1 << 17) ;- (MC) Master 1 Abort Source +AT91C_MC_SVMST0 EQU (0x1 << 24) ;- (MC) Saved Master 0 Abort Source +AT91C_MC_SVMST1 EQU (0x1 << 25) ;- (MC) Saved Master 1 Abort Source +// - -------- MC_FMR : (MC Offset: 0x60) MC Flash Mode Register -------- +AT91C_MC_FRDY EQU (0x1 << 0) ;- (MC) Flash Ready +AT91C_MC_LOCKE EQU (0x1 << 2) ;- (MC) Lock Error +AT91C_MC_PROGE EQU (0x1 << 3) ;- (MC) Programming Error +AT91C_MC_NEBP EQU (0x1 << 7) ;- (MC) No Erase Before Programming +AT91C_MC_FWS EQU (0x3 << 8) ;- (MC) Flash Wait State +AT91C_MC_FWS_0FWS EQU (0x0 << 8) ;- (MC) 1 cycle for Read, 2 for Write operations +AT91C_MC_FWS_1FWS EQU (0x1 << 8) ;- (MC) 2 cycles for Read, 3 for Write operations +AT91C_MC_FWS_2FWS EQU (0x2 << 8) ;- (MC) 3 cycles for Read, 4 for Write operations +AT91C_MC_FWS_3FWS EQU (0x3 << 8) ;- (MC) 4 cycles for Read, 4 for Write operations +AT91C_MC_FMCN EQU (0xFF << 16) ;- (MC) Flash Microsecond Cycle Number +// - -------- MC_FCR : (MC Offset: 0x64) MC Flash Command Register -------- +AT91C_MC_FCMD EQU (0xF << 0) ;- (MC) Flash Command +AT91C_MC_FCMD_START_PROG EQU (0x1) ;- (MC) Starts the programming of th epage specified by PAGEN. +AT91C_MC_FCMD_LOCK EQU (0x2) ;- (MC) Starts a lock sequence of the sector defined by the bits 4 to 7 of the field PAGEN. +AT91C_MC_FCMD_PROG_AND_LOCK EQU (0x3) ;- (MC) The lock sequence automatically happens after the programming sequence is completed. +AT91C_MC_FCMD_UNLOCK EQU (0x4) ;- (MC) Starts an unlock sequence of the sector defined by the bits 4 to 7 of the field PAGEN. +AT91C_MC_FCMD_ERASE_ALL EQU (0x8) ;- (MC) Starts the erase of the entire flash.If at least a page is locked, the command is cancelled. +AT91C_MC_FCMD_SET_GP_NVM EQU (0xB) ;- (MC) Set General Purpose NVM bits. +AT91C_MC_FCMD_CLR_GP_NVM EQU (0xD) ;- (MC) Clear General Purpose NVM bits. +AT91C_MC_FCMD_SET_SECURITY EQU (0xF) ;- (MC) Set Security Bit. +AT91C_MC_PAGEN EQU (0x3FF << 8) ;- (MC) Page Number +AT91C_MC_KEY EQU (0xFF << 24) ;- (MC) Writing Protect Key +// - -------- MC_FSR : (MC Offset: 0x68) MC Flash Command Register -------- +AT91C_MC_SECURITY EQU (0x1 << 4) ;- (MC) Security Bit Status +AT91C_MC_GPNVM0 EQU (0x1 << 8) ;- (MC) Sector 0 Lock Status +AT91C_MC_GPNVM1 EQU (0x1 << 9) ;- (MC) Sector 1 Lock Status +AT91C_MC_GPNVM2 EQU (0x1 << 10) ;- (MC) Sector 2 Lock Status +AT91C_MC_GPNVM3 EQU (0x1 << 11) ;- (MC) Sector 3 Lock Status +AT91C_MC_GPNVM4 EQU (0x1 << 12) ;- (MC) Sector 4 Lock Status +AT91C_MC_GPNVM5 EQU (0x1 << 13) ;- (MC) Sector 5 Lock Status +AT91C_MC_GPNVM6 EQU (0x1 << 14) ;- (MC) Sector 6 Lock Status +AT91C_MC_GPNVM7 EQU (0x1 << 15) ;- (MC) Sector 7 Lock Status +AT91C_MC_LOCKS0 EQU (0x1 << 16) ;- (MC) Sector 0 Lock Status +AT91C_MC_LOCKS1 EQU (0x1 << 17) ;- (MC) Sector 1 Lock Status +AT91C_MC_LOCKS2 EQU (0x1 << 18) ;- (MC) Sector 2 Lock Status +AT91C_MC_LOCKS3 EQU (0x1 << 19) ;- (MC) Sector 3 Lock Status +AT91C_MC_LOCKS4 EQU (0x1 << 20) ;- (MC) Sector 4 Lock Status +AT91C_MC_LOCKS5 EQU (0x1 << 21) ;- (MC) Sector 5 Lock Status +AT91C_MC_LOCKS6 EQU (0x1 << 22) ;- (MC) Sector 6 Lock Status +AT91C_MC_LOCKS7 EQU (0x1 << 23) ;- (MC) Sector 7 Lock Status +AT91C_MC_LOCKS8 EQU (0x1 << 24) ;- (MC) Sector 8 Lock Status +AT91C_MC_LOCKS9 EQU (0x1 << 25) ;- (MC) Sector 9 Lock Status +AT91C_MC_LOCKS10 EQU (0x1 << 26) ;- (MC) Sector 10 Lock Status +AT91C_MC_LOCKS11 EQU (0x1 << 27) ;- (MC) Sector 11 Lock Status +AT91C_MC_LOCKS12 EQU (0x1 << 28) ;- (MC) Sector 12 Lock Status +AT91C_MC_LOCKS13 EQU (0x1 << 29) ;- (MC) Sector 13 Lock Status +AT91C_MC_LOCKS14 EQU (0x1 << 30) ;- (MC) Sector 14 Lock Status +AT91C_MC_LOCKS15 EQU (0x1 << 31) ;- (MC) Sector 15 Lock Status + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Serial Parallel Interface +// - ***************************************************************************** +// - -------- SPI_CR : (SPI Offset: 0x0) SPI Control Register -------- +AT91C_SPI_SPIEN EQU (0x1 << 0) ;- (SPI) SPI Enable +AT91C_SPI_SPIDIS EQU (0x1 << 1) ;- (SPI) SPI Disable +AT91C_SPI_SWRST EQU (0x1 << 7) ;- (SPI) SPI Software reset +AT91C_SPI_LASTXFER EQU (0x1 << 24) ;- (SPI) SPI Last Transfer +// - -------- SPI_MR : (SPI Offset: 0x4) SPI Mode Register -------- +AT91C_SPI_MSTR EQU (0x1 << 0) ;- (SPI) Master/Slave Mode +AT91C_SPI_PS EQU (0x1 << 1) ;- (SPI) Peripheral Select +AT91C_SPI_PS_FIXED EQU (0x0 << 1) ;- (SPI) Fixed Peripheral Select +AT91C_SPI_PS_VARIABLE EQU (0x1 << 1) ;- (SPI) Variable Peripheral Select +AT91C_SPI_PCSDEC EQU (0x1 << 2) ;- (SPI) Chip Select Decode +AT91C_SPI_FDIV EQU (0x1 << 3) ;- (SPI) Clock Selection +AT91C_SPI_MODFDIS EQU (0x1 << 4) ;- (SPI) Mode Fault Detection +AT91C_SPI_LLB EQU (0x1 << 7) ;- (SPI) Clock Selection +AT91C_SPI_PCS EQU (0xF << 16) ;- (SPI) Peripheral Chip Select +AT91C_SPI_DLYBCS EQU (0xFF << 24) ;- (SPI) Delay Between Chip Selects +// - -------- SPI_RDR : (SPI Offset: 0x8) Receive Data Register -------- +AT91C_SPI_RD EQU (0xFFFF << 0) ;- (SPI) Receive Data +AT91C_SPI_RPCS EQU (0xF << 16) ;- (SPI) Peripheral Chip Select Status +// - -------- SPI_TDR : (SPI Offset: 0xc) Transmit Data Register -------- +AT91C_SPI_TD EQU (0xFFFF << 0) ;- (SPI) Transmit Data +AT91C_SPI_TPCS EQU (0xF << 16) ;- (SPI) Peripheral Chip Select Status +// - -------- SPI_SR : (SPI Offset: 0x10) Status Register -------- +AT91C_SPI_RDRF EQU (0x1 << 0) ;- (SPI) Receive Data Register Full +AT91C_SPI_TDRE EQU (0x1 << 1) ;- (SPI) Transmit Data Register Empty +AT91C_SPI_MODF EQU (0x1 << 2) ;- (SPI) Mode Fault Error +AT91C_SPI_OVRES EQU (0x1 << 3) ;- (SPI) Overrun Error Status +AT91C_SPI_ENDRX EQU (0x1 << 4) ;- (SPI) End of Receiver Transfer +AT91C_SPI_ENDTX EQU (0x1 << 5) ;- (SPI) End of Receiver Transfer +AT91C_SPI_RXBUFF EQU (0x1 << 6) ;- (SPI) RXBUFF Interrupt +AT91C_SPI_TXBUFE EQU (0x1 << 7) ;- (SPI) TXBUFE Interrupt +AT91C_SPI_NSSR EQU (0x1 << 8) ;- (SPI) NSSR Interrupt +AT91C_SPI_TXEMPTY EQU (0x1 << 9) ;- (SPI) TXEMPTY Interrupt +AT91C_SPI_SPIENS EQU (0x1 << 16) ;- (SPI) Enable Status +// - -------- SPI_IER : (SPI Offset: 0x14) Interrupt Enable Register -------- +// - -------- SPI_IDR : (SPI Offset: 0x18) Interrupt Disable Register -------- +// - -------- SPI_IMR : (SPI Offset: 0x1c) Interrupt Mask Register -------- +// - -------- SPI_CSR : (SPI Offset: 0x30) Chip Select Register -------- +AT91C_SPI_CPOL EQU (0x1 << 0) ;- (SPI) Clock Polarity +AT91C_SPI_NCPHA EQU (0x1 << 1) ;- (SPI) Clock Phase +AT91C_SPI_CSAAT EQU (0x1 << 3) ;- (SPI) Chip Select Active After Transfer +AT91C_SPI_BITS EQU (0xF << 4) ;- (SPI) Bits Per Transfer +AT91C_SPI_BITS_8 EQU (0x0 << 4) ;- (SPI) 8 Bits Per transfer +AT91C_SPI_BITS_9 EQU (0x1 << 4) ;- (SPI) 9 Bits Per transfer +AT91C_SPI_BITS_10 EQU (0x2 << 4) ;- (SPI) 10 Bits Per transfer +AT91C_SPI_BITS_11 EQU (0x3 << 4) ;- (SPI) 11 Bits Per transfer +AT91C_SPI_BITS_12 EQU (0x4 << 4) ;- (SPI) 12 Bits Per transfer +AT91C_SPI_BITS_13 EQU (0x5 << 4) ;- (SPI) 13 Bits Per transfer +AT91C_SPI_BITS_14 EQU (0x6 << 4) ;- (SPI) 14 Bits Per transfer +AT91C_SPI_BITS_15 EQU (0x7 << 4) ;- (SPI) 15 Bits Per transfer +AT91C_SPI_BITS_16 EQU (0x8 << 4) ;- (SPI) 16 Bits Per transfer +AT91C_SPI_SCBR EQU (0xFF << 8) ;- (SPI) Serial Clock Baud Rate +AT91C_SPI_DLYBS EQU (0xFF << 16) ;- (SPI) Delay Before SPCK +AT91C_SPI_DLYBCT EQU (0xFF << 24) ;- (SPI) Delay Between Consecutive Transfers + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Usart +// - ***************************************************************************** +// - -------- US_CR : (USART Offset: 0x0) Debug Unit Control Register -------- +AT91C_US_STTBRK EQU (0x1 << 9) ;- (USART) Start Break +AT91C_US_STPBRK EQU (0x1 << 10) ;- (USART) Stop Break +AT91C_US_STTTO EQU (0x1 << 11) ;- (USART) Start Time-out +AT91C_US_SENDA EQU (0x1 << 12) ;- (USART) Send Address +AT91C_US_RSTIT EQU (0x1 << 13) ;- (USART) Reset Iterations +AT91C_US_RSTNACK EQU (0x1 << 14) ;- (USART) Reset Non Acknowledge +AT91C_US_RETTO EQU (0x1 << 15) ;- (USART) Rearm Time-out +AT91C_US_DTREN EQU (0x1 << 16) ;- (USART) Data Terminal ready Enable +AT91C_US_DTRDIS EQU (0x1 << 17) ;- (USART) Data Terminal ready Disable +AT91C_US_RTSEN EQU (0x1 << 18) ;- (USART) Request to Send enable +AT91C_US_RTSDIS EQU (0x1 << 19) ;- (USART) Request to Send Disable +// - -------- US_MR : (USART Offset: 0x4) Debug Unit Mode Register -------- +AT91C_US_USMODE EQU (0xF << 0) ;- (USART) Usart mode +AT91C_US_USMODE_NORMAL EQU (0x0) ;- (USART) Normal +AT91C_US_USMODE_RS485 EQU (0x1) ;- (USART) RS485 +AT91C_US_USMODE_HWHSH EQU (0x2) ;- (USART) Hardware Handshaking +AT91C_US_USMODE_MODEM EQU (0x3) ;- (USART) Modem +AT91C_US_USMODE_ISO7816_0 EQU (0x4) ;- (USART) ISO7816 protocol: T = 0 +AT91C_US_USMODE_ISO7816_1 EQU (0x6) ;- (USART) ISO7816 protocol: T = 1 +AT91C_US_USMODE_IRDA EQU (0x8) ;- (USART) IrDA +AT91C_US_USMODE_SWHSH EQU (0xC) ;- (USART) Software Handshaking +AT91C_US_CLKS EQU (0x3 << 4) ;- (USART) Clock Selection (Baud Rate generator Input Clock +AT91C_US_CLKS_CLOCK EQU (0x0 << 4) ;- (USART) Clock +AT91C_US_CLKS_FDIV1 EQU (0x1 << 4) ;- (USART) fdiv1 +AT91C_US_CLKS_SLOW EQU (0x2 << 4) ;- (USART) slow_clock (ARM) +AT91C_US_CLKS_EXT EQU (0x3 << 4) ;- (USART) External (SCK) +AT91C_US_CHRL EQU (0x3 << 6) ;- (USART) Clock Selection (Baud Rate generator Input Clock +AT91C_US_CHRL_5_BITS EQU (0x0 << 6) ;- (USART) Character Length: 5 bits +AT91C_US_CHRL_6_BITS EQU (0x1 << 6) ;- (USART) Character Length: 6 bits +AT91C_US_CHRL_7_BITS EQU (0x2 << 6) ;- (USART) Character Length: 7 bits +AT91C_US_CHRL_8_BITS EQU (0x3 << 6) ;- (USART) Character Length: 8 bits +AT91C_US_SYNC EQU (0x1 << 8) ;- (USART) Synchronous Mode Select +AT91C_US_NBSTOP EQU (0x3 << 12) ;- (USART) Number of Stop bits +AT91C_US_NBSTOP_1_BIT EQU (0x0 << 12) ;- (USART) 1 stop bit +AT91C_US_NBSTOP_15_BIT EQU (0x1 << 12) ;- (USART) Asynchronous (SYNC=0) 2 stop bits Synchronous (SYNC=1) 2 stop bits +AT91C_US_NBSTOP_2_BIT EQU (0x2 << 12) ;- (USART) 2 stop bits +AT91C_US_MSBF EQU (0x1 << 16) ;- (USART) Bit Order +AT91C_US_MODE9 EQU (0x1 << 17) ;- (USART) 9-bit Character length +AT91C_US_CKLO EQU (0x1 << 18) ;- (USART) Clock Output Select +AT91C_US_OVER EQU (0x1 << 19) ;- (USART) Over Sampling Mode +AT91C_US_INACK EQU (0x1 << 20) ;- (USART) Inhibit Non Acknowledge +AT91C_US_DSNACK EQU (0x1 << 21) ;- (USART) Disable Successive NACK +AT91C_US_MAX_ITER EQU (0x1 << 24) ;- (USART) Number of Repetitions +AT91C_US_FILTER EQU (0x1 << 28) ;- (USART) Receive Line Filter +// - -------- US_IER : (USART Offset: 0x8) Debug Unit Interrupt Enable Register -------- +AT91C_US_RXBRK EQU (0x1 << 2) ;- (USART) Break Received/End of Break +AT91C_US_TIMEOUT EQU (0x1 << 8) ;- (USART) Receiver Time-out +AT91C_US_ITERATION EQU (0x1 << 10) ;- (USART) Max number of Repetitions Reached +AT91C_US_NACK EQU (0x1 << 13) ;- (USART) Non Acknowledge +AT91C_US_RIIC EQU (0x1 << 16) ;- (USART) Ring INdicator Input Change Flag +AT91C_US_DSRIC EQU (0x1 << 17) ;- (USART) Data Set Ready Input Change Flag +AT91C_US_DCDIC EQU (0x1 << 18) ;- (USART) Data Carrier Flag +AT91C_US_CTSIC EQU (0x1 << 19) ;- (USART) Clear To Send Input Change Flag +// - -------- US_IDR : (USART Offset: 0xc) Debug Unit Interrupt Disable Register -------- +// - -------- US_IMR : (USART Offset: 0x10) Debug Unit Interrupt Mask Register -------- +// - -------- US_CSR : (USART Offset: 0x14) Debug Unit Channel Status Register -------- +AT91C_US_RI EQU (0x1 << 20) ;- (USART) Image of RI Input +AT91C_US_DSR EQU (0x1 << 21) ;- (USART) Image of DSR Input +AT91C_US_DCD EQU (0x1 << 22) ;- (USART) Image of DCD Input +AT91C_US_CTS EQU (0x1 << 23) ;- (USART) Image of CTS Input + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Synchronous Serial Controller Interface +// - ***************************************************************************** +// - -------- SSC_CR : (SSC Offset: 0x0) SSC Control Register -------- +AT91C_SSC_RXEN EQU (0x1 << 0) ;- (SSC) Receive Enable +AT91C_SSC_RXDIS EQU (0x1 << 1) ;- (SSC) Receive Disable +AT91C_SSC_TXEN EQU (0x1 << 8) ;- (SSC) Transmit Enable +AT91C_SSC_TXDIS EQU (0x1 << 9) ;- (SSC) Transmit Disable +AT91C_SSC_SWRST EQU (0x1 << 15) ;- (SSC) Software Reset +// - -------- SSC_RCMR : (SSC Offset: 0x10) SSC Receive Clock Mode Register -------- +AT91C_SSC_CKS EQU (0x3 << 0) ;- (SSC) Receive/Transmit Clock Selection +AT91C_SSC_CKS_DIV EQU (0x0) ;- (SSC) Divided Clock +AT91C_SSC_CKS_TK EQU (0x1) ;- (SSC) TK Clock signal +AT91C_SSC_CKS_RK EQU (0x2) ;- (SSC) RK pin +AT91C_SSC_CKO EQU (0x7 << 2) ;- (SSC) Receive/Transmit Clock Output Mode Selection +AT91C_SSC_CKO_NONE EQU (0x0 << 2) ;- (SSC) Receive/Transmit Clock Output Mode: None RK pin: Input-only +AT91C_SSC_CKO_CONTINOUS EQU (0x1 << 2) ;- (SSC) Continuous Receive/Transmit Clock RK pin: Output +AT91C_SSC_CKO_DATA_TX EQU (0x2 << 2) ;- (SSC) Receive/Transmit Clock only during data transfers RK pin: Output +AT91C_SSC_CKI EQU (0x1 << 5) ;- (SSC) Receive/Transmit Clock Inversion +AT91C_SSC_CKG EQU (0x3 << 6) ;- (SSC) Receive/Transmit Clock Gating Selection +AT91C_SSC_CKG_NONE EQU (0x0 << 6) ;- (SSC) Receive/Transmit Clock Gating: None, continuous clock +AT91C_SSC_CKG_LOW EQU (0x1 << 6) ;- (SSC) Receive/Transmit Clock enabled only if RF Low +AT91C_SSC_CKG_HIGH EQU (0x2 << 6) ;- (SSC) Receive/Transmit Clock enabled only if RF High +AT91C_SSC_START EQU (0xF << 8) ;- (SSC) Receive/Transmit Start Selection +AT91C_SSC_START_CONTINOUS EQU (0x0 << 8) ;- (SSC) Continuous, as soon as the receiver is enabled, and immediately after the end of transfer of the previous data. +AT91C_SSC_START_TX EQU (0x1 << 8) ;- (SSC) Transmit/Receive start +AT91C_SSC_START_LOW_RF EQU (0x2 << 8) ;- (SSC) Detection of a low level on RF input +AT91C_SSC_START_HIGH_RF EQU (0x3 << 8) ;- (SSC) Detection of a high level on RF input +AT91C_SSC_START_FALL_RF EQU (0x4 << 8) ;- (SSC) Detection of a falling edge on RF input +AT91C_SSC_START_RISE_RF EQU (0x5 << 8) ;- (SSC) Detection of a rising edge on RF input +AT91C_SSC_START_LEVEL_RF EQU (0x6 << 8) ;- (SSC) Detection of any level change on RF input +AT91C_SSC_START_EDGE_RF EQU (0x7 << 8) ;- (SSC) Detection of any edge on RF input +AT91C_SSC_START_0 EQU (0x8 << 8) ;- (SSC) Compare 0 +AT91C_SSC_STOP EQU (0x1 << 12) ;- (SSC) Receive Stop Selection +AT91C_SSC_STTDLY EQU (0xFF << 16) ;- (SSC) Receive/Transmit Start Delay +AT91C_SSC_PERIOD EQU (0xFF << 24) ;- (SSC) Receive/Transmit Period Divider Selection +// - -------- SSC_RFMR : (SSC Offset: 0x14) SSC Receive Frame Mode Register -------- +AT91C_SSC_DATLEN EQU (0x1F << 0) ;- (SSC) Data Length +AT91C_SSC_LOOP EQU (0x1 << 5) ;- (SSC) Loop Mode +AT91C_SSC_MSBF EQU (0x1 << 7) ;- (SSC) Most Significant Bit First +AT91C_SSC_DATNB EQU (0xF << 8) ;- (SSC) Data Number per Frame +AT91C_SSC_FSLEN EQU (0xF << 16) ;- (SSC) Receive/Transmit Frame Sync length +AT91C_SSC_FSOS EQU (0x7 << 20) ;- (SSC) Receive/Transmit Frame Sync Output Selection +AT91C_SSC_FSOS_NONE EQU (0x0 << 20) ;- (SSC) Selected Receive/Transmit Frame Sync Signal: None RK pin Input-only +AT91C_SSC_FSOS_NEGATIVE EQU (0x1 << 20) ;- (SSC) Selected Receive/Transmit Frame Sync Signal: Negative Pulse +AT91C_SSC_FSOS_POSITIVE EQU (0x2 << 20) ;- (SSC) Selected Receive/Transmit Frame Sync Signal: Positive Pulse +AT91C_SSC_FSOS_LOW EQU (0x3 << 20) ;- (SSC) Selected Receive/Transmit Frame Sync Signal: Driver Low during data transfer +AT91C_SSC_FSOS_HIGH EQU (0x4 << 20) ;- (SSC) Selected Receive/Transmit Frame Sync Signal: Driver High during data transfer +AT91C_SSC_FSOS_TOGGLE EQU (0x5 << 20) ;- (SSC) Selected Receive/Transmit Frame Sync Signal: Toggling at each start of data transfer +AT91C_SSC_FSEDGE EQU (0x1 << 24) ;- (SSC) Frame Sync Edge Detection +// - -------- SSC_TCMR : (SSC Offset: 0x18) SSC Transmit Clock Mode Register -------- +// - -------- SSC_TFMR : (SSC Offset: 0x1c) SSC Transmit Frame Mode Register -------- +AT91C_SSC_DATDEF EQU (0x1 << 5) ;- (SSC) Data Default Value +AT91C_SSC_FSDEN EQU (0x1 << 23) ;- (SSC) Frame Sync Data Enable +// - -------- SSC_SR : (SSC Offset: 0x40) SSC Status Register -------- +AT91C_SSC_TXRDY EQU (0x1 << 0) ;- (SSC) Transmit Ready +AT91C_SSC_TXEMPTY EQU (0x1 << 1) ;- (SSC) Transmit Empty +AT91C_SSC_ENDTX EQU (0x1 << 2) ;- (SSC) End Of Transmission +AT91C_SSC_TXBUFE EQU (0x1 << 3) ;- (SSC) Transmit Buffer Empty +AT91C_SSC_RXRDY EQU (0x1 << 4) ;- (SSC) Receive Ready +AT91C_SSC_OVRUN EQU (0x1 << 5) ;- (SSC) Receive Overrun +AT91C_SSC_ENDRX EQU (0x1 << 6) ;- (SSC) End of Reception +AT91C_SSC_RXBUFF EQU (0x1 << 7) ;- (SSC) Receive Buffer Full +AT91C_SSC_CP0 EQU (0x1 << 8) ;- (SSC) Compare 0 +AT91C_SSC_CP1 EQU (0x1 << 9) ;- (SSC) Compare 1 +AT91C_SSC_TXSYN EQU (0x1 << 10) ;- (SSC) Transmit Sync +AT91C_SSC_RXSYN EQU (0x1 << 11) ;- (SSC) Receive Sync +AT91C_SSC_TXENA EQU (0x1 << 16) ;- (SSC) Transmit Enable +AT91C_SSC_RXENA EQU (0x1 << 17) ;- (SSC) Receive Enable +// - -------- SSC_IER : (SSC Offset: 0x44) SSC Interrupt Enable Register -------- +// - -------- SSC_IDR : (SSC Offset: 0x48) SSC Interrupt Disable Register -------- +// - -------- SSC_IMR : (SSC Offset: 0x4c) SSC Interrupt Mask Register -------- + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Two-wire Interface +// - ***************************************************************************** +// - -------- TWI_CR : (TWI Offset: 0x0) TWI Control Register -------- +AT91C_TWI_START EQU (0x1 << 0) ;- (TWI) Send a START Condition +AT91C_TWI_STOP EQU (0x1 << 1) ;- (TWI) Send a STOP Condition +AT91C_TWI_MSEN EQU (0x1 << 2) ;- (TWI) TWI Master Transfer Enabled +AT91C_TWI_MSDIS EQU (0x1 << 3) ;- (TWI) TWI Master Transfer Disabled +AT91C_TWI_SWRST EQU (0x1 << 7) ;- (TWI) Software Reset +// - -------- TWI_MMR : (TWI Offset: 0x4) TWI Master Mode Register -------- +AT91C_TWI_IADRSZ EQU (0x3 << 8) ;- (TWI) Internal Device Address Size +AT91C_TWI_IADRSZ_NO EQU (0x0 << 8) ;- (TWI) No internal device address +AT91C_TWI_IADRSZ_1_BYTE EQU (0x1 << 8) ;- (TWI) One-byte internal device address +AT91C_TWI_IADRSZ_2_BYTE EQU (0x2 << 8) ;- (TWI) Two-byte internal device address +AT91C_TWI_IADRSZ_3_BYTE EQU (0x3 << 8) ;- (TWI) Three-byte internal device address +AT91C_TWI_MREAD EQU (0x1 << 12) ;- (TWI) Master Read Direction +AT91C_TWI_DADR EQU (0x7F << 16) ;- (TWI) Device Address +// - -------- TWI_CWGR : (TWI Offset: 0x10) TWI Clock Waveform Generator Register -------- +AT91C_TWI_CLDIV EQU (0xFF << 0) ;- (TWI) Clock Low Divider +AT91C_TWI_CHDIV EQU (0xFF << 8) ;- (TWI) Clock High Divider +AT91C_TWI_CKDIV EQU (0x7 << 16) ;- (TWI) Clock Divider +// - -------- TWI_SR : (TWI Offset: 0x20) TWI Status Register -------- +AT91C_TWI_TXCOMP EQU (0x1 << 0) ;- (TWI) Transmission Completed +AT91C_TWI_RXRDY EQU (0x1 << 1) ;- (TWI) Receive holding register ReaDY +AT91C_TWI_TXRDY EQU (0x1 << 2) ;- (TWI) Transmit holding register ReaDY +AT91C_TWI_OVRE EQU (0x1 << 6) ;- (TWI) Overrun Error +AT91C_TWI_UNRE EQU (0x1 << 7) ;- (TWI) Underrun Error +AT91C_TWI_NACK EQU (0x1 << 8) ;- (TWI) Not Acknowledged +// - -------- TWI_IER : (TWI Offset: 0x24) TWI Interrupt Enable Register -------- +// - -------- TWI_IDR : (TWI Offset: 0x28) TWI Interrupt Disable Register -------- +// - -------- TWI_IMR : (TWI Offset: 0x2c) TWI Interrupt Mask Register -------- + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR PWMC Channel Interface +// - ***************************************************************************** +// - -------- PWMC_CMR : (PWMC_CH Offset: 0x0) PWMC Channel Mode Register -------- +AT91C_PWMC_CPRE EQU (0xF << 0) ;- (PWMC_CH) Channel Pre-scaler : PWMC_CLKx +AT91C_PWMC_CPRE_MCK EQU (0x0) ;- (PWMC_CH) +AT91C_PWMC_CPRE_MCKA EQU (0xB) ;- (PWMC_CH) +AT91C_PWMC_CPRE_MCKB EQU (0xC) ;- (PWMC_CH) +AT91C_PWMC_CALG EQU (0x1 << 8) ;- (PWMC_CH) Channel Alignment +AT91C_PWMC_CPOL EQU (0x1 << 9) ;- (PWMC_CH) Channel Polarity +AT91C_PWMC_CPD EQU (0x1 << 10) ;- (PWMC_CH) Channel Update Period +// - -------- PWMC_CDTYR : (PWMC_CH Offset: 0x4) PWMC Channel Duty Cycle Register -------- +AT91C_PWMC_CDTY EQU (0x0 << 0) ;- (PWMC_CH) Channel Duty Cycle +// - -------- PWMC_CPRDR : (PWMC_CH Offset: 0x8) PWMC Channel Period Register -------- +AT91C_PWMC_CPRD EQU (0x0 << 0) ;- (PWMC_CH) Channel Period +// - -------- PWMC_CCNTR : (PWMC_CH Offset: 0xc) PWMC Channel Counter Register -------- +AT91C_PWMC_CCNT EQU (0x0 << 0) ;- (PWMC_CH) Channel Counter +// - -------- PWMC_CUPDR : (PWMC_CH Offset: 0x10) PWMC Channel Update Register -------- +AT91C_PWMC_CUPD EQU (0x0 << 0) ;- (PWMC_CH) Channel Update + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Pulse Width Modulation Controller Interface +// - ***************************************************************************** +// - -------- PWMC_MR : (PWMC Offset: 0x0) PWMC Mode Register -------- +AT91C_PWMC_DIVA EQU (0xFF << 0) ;- (PWMC) CLKA divide factor. +AT91C_PWMC_PREA EQU (0xF << 8) ;- (PWMC) Divider Input Clock Prescaler A +AT91C_PWMC_PREA_MCK EQU (0x0 << 8) ;- (PWMC) +AT91C_PWMC_DIVB EQU (0xFF << 16) ;- (PWMC) CLKB divide factor. +AT91C_PWMC_PREB EQU (0xF << 24) ;- (PWMC) Divider Input Clock Prescaler B +AT91C_PWMC_PREB_MCK EQU (0x0 << 24) ;- (PWMC) +// - -------- PWMC_ENA : (PWMC Offset: 0x4) PWMC Enable Register -------- +AT91C_PWMC_CHID0 EQU (0x1 << 0) ;- (PWMC) Channel ID 0 +AT91C_PWMC_CHID1 EQU (0x1 << 1) ;- (PWMC) Channel ID 1 +AT91C_PWMC_CHID2 EQU (0x1 << 2) ;- (PWMC) Channel ID 2 +AT91C_PWMC_CHID3 EQU (0x1 << 3) ;- (PWMC) Channel ID 3 +// - -------- PWMC_DIS : (PWMC Offset: 0x8) PWMC Disable Register -------- +// - -------- PWMC_SR : (PWMC Offset: 0xc) PWMC Status Register -------- +// - -------- PWMC_IER : (PWMC Offset: 0x10) PWMC Interrupt Enable Register -------- +// - -------- PWMC_IDR : (PWMC Offset: 0x14) PWMC Interrupt Disable Register -------- +// - -------- PWMC_IMR : (PWMC Offset: 0x18) PWMC Interrupt Mask Register -------- +// - -------- PWMC_ISR : (PWMC Offset: 0x1c) PWMC Interrupt Status Register -------- + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR USB Device Interface +// - ***************************************************************************** +// - -------- UDP_FRM_NUM : (UDP Offset: 0x0) USB Frame Number Register -------- +AT91C_UDP_FRM_NUM EQU (0x7FF << 0) ;- (UDP) Frame Number as Defined in the Packet Field Formats +AT91C_UDP_FRM_ERR EQU (0x1 << 16) ;- (UDP) Frame Error +AT91C_UDP_FRM_OK EQU (0x1 << 17) ;- (UDP) Frame OK +// - -------- UDP_GLB_STATE : (UDP Offset: 0x4) USB Global State Register -------- +AT91C_UDP_FADDEN EQU (0x1 << 0) ;- (UDP) Function Address Enable +AT91C_UDP_CONFG EQU (0x1 << 1) ;- (UDP) Configured +AT91C_UDP_ESR EQU (0x1 << 2) ;- (UDP) Enable Send Resume +AT91C_UDP_RSMINPR EQU (0x1 << 3) ;- (UDP) A Resume Has Been Sent to the Host +AT91C_UDP_RMWUPE EQU (0x1 << 4) ;- (UDP) Remote Wake Up Enable +// - -------- UDP_FADDR : (UDP Offset: 0x8) USB Function Address Register -------- +AT91C_UDP_FADD EQU (0xFF << 0) ;- (UDP) Function Address Value +AT91C_UDP_FEN EQU (0x1 << 8) ;- (UDP) Function Enable +// - -------- UDP_IER : (UDP Offset: 0x10) USB Interrupt Enable Register -------- +AT91C_UDP_EPINT0 EQU (0x1 << 0) ;- (UDP) Endpoint 0 Interrupt +AT91C_UDP_EPINT1 EQU (0x1 << 1) ;- (UDP) Endpoint 0 Interrupt +AT91C_UDP_EPINT2 EQU (0x1 << 2) ;- (UDP) Endpoint 2 Interrupt +AT91C_UDP_EPINT3 EQU (0x1 << 3) ;- (UDP) Endpoint 3 Interrupt +AT91C_UDP_EPINT4 EQU (0x1 << 4) ;- (UDP) Endpoint 4 Interrupt +AT91C_UDP_EPINT5 EQU (0x1 << 5) ;- (UDP) Endpoint 5 Interrupt +AT91C_UDP_RXSUSP EQU (0x1 << 8) ;- (UDP) USB Suspend Interrupt +AT91C_UDP_RXRSM EQU (0x1 << 9) ;- (UDP) USB Resume Interrupt +AT91C_UDP_EXTRSM EQU (0x1 << 10) ;- (UDP) USB External Resume Interrupt +AT91C_UDP_SOFINT EQU (0x1 << 11) ;- (UDP) USB Start Of frame Interrupt +AT91C_UDP_WAKEUP EQU (0x1 << 13) ;- (UDP) USB Resume Interrupt +// - -------- UDP_IDR : (UDP Offset: 0x14) USB Interrupt Disable Register -------- +// - -------- UDP_IMR : (UDP Offset: 0x18) USB Interrupt Mask Register -------- +// - -------- UDP_ISR : (UDP Offset: 0x1c) USB Interrupt Status Register -------- +AT91C_UDP_ENDBUSRES EQU (0x1 << 12) ;- (UDP) USB End Of Bus Reset Interrupt +// - -------- UDP_ICR : (UDP Offset: 0x20) USB Interrupt Clear Register -------- +// - -------- UDP_RST_EP : (UDP Offset: 0x28) USB Reset Endpoint Register -------- +AT91C_UDP_EP0 EQU (0x1 << 0) ;- (UDP) Reset Endpoint 0 +AT91C_UDP_EP1 EQU (0x1 << 1) ;- (UDP) Reset Endpoint 1 +AT91C_UDP_EP2 EQU (0x1 << 2) ;- (UDP) Reset Endpoint 2 +AT91C_UDP_EP3 EQU (0x1 << 3) ;- (UDP) Reset Endpoint 3 +AT91C_UDP_EP4 EQU (0x1 << 4) ;- (UDP) Reset Endpoint 4 +AT91C_UDP_EP5 EQU (0x1 << 5) ;- (UDP) Reset Endpoint 5 +// - -------- UDP_CSR : (UDP Offset: 0x30) USB Endpoint Control and Status Register -------- +AT91C_UDP_TXCOMP EQU (0x1 << 0) ;- (UDP) Generates an IN packet with data previously written in the DPR +AT91C_UDP_RX_DATA_BK0 EQU (0x1 << 1) ;- (UDP) Receive Data Bank 0 +AT91C_UDP_RXSETUP EQU (0x1 << 2) ;- (UDP) Sends STALL to the Host (Control endpoints) +AT91C_UDP_ISOERROR EQU (0x1 << 3) ;- (UDP) Isochronous error (Isochronous endpoints) +AT91C_UDP_TXPKTRDY EQU (0x1 << 4) ;- (UDP) Transmit Packet Ready +AT91C_UDP_FORCESTALL EQU (0x1 << 5) ;- (UDP) Force Stall (used by Control, Bulk and Isochronous endpoints). +AT91C_UDP_RX_DATA_BK1 EQU (0x1 << 6) ;- (UDP) Receive Data Bank 1 (only used by endpoints with ping-pong attributes). +AT91C_UDP_DIR EQU (0x1 << 7) ;- (UDP) Transfer Direction +AT91C_UDP_EPTYPE EQU (0x7 << 8) ;- (UDP) Endpoint type +AT91C_UDP_EPTYPE_CTRL EQU (0x0 << 8) ;- (UDP) Control +AT91C_UDP_EPTYPE_ISO_OUT EQU (0x1 << 8) ;- (UDP) Isochronous OUT +AT91C_UDP_EPTYPE_BULK_OUT EQU (0x2 << 8) ;- (UDP) Bulk OUT +AT91C_UDP_EPTYPE_INT_OUT EQU (0x3 << 8) ;- (UDP) Interrupt OUT +AT91C_UDP_EPTYPE_ISO_IN EQU (0x5 << 8) ;- (UDP) Isochronous IN +AT91C_UDP_EPTYPE_BULK_IN EQU (0x6 << 8) ;- (UDP) Bulk IN +AT91C_UDP_EPTYPE_INT_IN EQU (0x7 << 8) ;- (UDP) Interrupt IN +AT91C_UDP_DTGLE EQU (0x1 << 11) ;- (UDP) Data Toggle +AT91C_UDP_EPEDS EQU (0x1 << 15) ;- (UDP) Endpoint Enable Disable +AT91C_UDP_RXBYTECNT EQU (0x7FF << 16) ;- (UDP) Number Of Bytes Available in the FIFO +// - -------- UDP_TXVC : (UDP Offset: 0x74) Transceiver Control Register -------- +AT91C_UDP_TXVDIS EQU (0x1 << 8) ;- (UDP) +AT91C_UDP_PUON EQU (0x1 << 9) ;- (UDP) Pull-up ON + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Timer Counter Channel Interface +// - ***************************************************************************** +// - -------- TC_CCR : (TC Offset: 0x0) TC Channel Control Register -------- +AT91C_TC_CLKEN EQU (0x1 << 0) ;- (TC) Counter Clock Enable Command +AT91C_TC_CLKDIS EQU (0x1 << 1) ;- (TC) Counter Clock Disable Command +AT91C_TC_SWTRG EQU (0x1 << 2) ;- (TC) Software Trigger Command +// - -------- TC_CMR : (TC Offset: 0x4) TC Channel Mode Register: Capture Mode / Waveform Mode -------- +AT91C_TC_CLKS EQU (0x7 << 0) ;- (TC) Clock Selection +AT91C_TC_CLKS_TIMER_DIV1_CLOCK EQU (0x0) ;- (TC) Clock selected: TIMER_DIV1_CLOCK +AT91C_TC_CLKS_TIMER_DIV2_CLOCK EQU (0x1) ;- (TC) Clock selected: TIMER_DIV2_CLOCK +AT91C_TC_CLKS_TIMER_DIV3_CLOCK EQU (0x2) ;- (TC) Clock selected: TIMER_DIV3_CLOCK +AT91C_TC_CLKS_TIMER_DIV4_CLOCK EQU (0x3) ;- (TC) Clock selected: TIMER_DIV4_CLOCK +AT91C_TC_CLKS_TIMER_DIV5_CLOCK EQU (0x4) ;- (TC) Clock selected: TIMER_DIV5_CLOCK +AT91C_TC_CLKS_XC0 EQU (0x5) ;- (TC) Clock selected: XC0 +AT91C_TC_CLKS_XC1 EQU (0x6) ;- (TC) Clock selected: XC1 +AT91C_TC_CLKS_XC2 EQU (0x7) ;- (TC) Clock selected: XC2 +AT91C_TC_CLKI EQU (0x1 << 3) ;- (TC) Clock Invert +AT91C_TC_BURST EQU (0x3 << 4) ;- (TC) Burst Signal Selection +AT91C_TC_BURST_NONE EQU (0x0 << 4) ;- (TC) The clock is not gated by an external signal +AT91C_TC_BURST_XC0 EQU (0x1 << 4) ;- (TC) XC0 is ANDed with the selected clock +AT91C_TC_BURST_XC1 EQU (0x2 << 4) ;- (TC) XC1 is ANDed with the selected clock +AT91C_TC_BURST_XC2 EQU (0x3 << 4) ;- (TC) XC2 is ANDed with the selected clock +AT91C_TC_CPCSTOP EQU (0x1 << 6) ;- (TC) Counter Clock Stopped with RC Compare +AT91C_TC_LDBSTOP EQU (0x1 << 6) ;- (TC) Counter Clock Stopped with RB Loading +AT91C_TC_CPCDIS EQU (0x1 << 7) ;- (TC) Counter Clock Disable with RC Compare +AT91C_TC_LDBDIS EQU (0x1 << 7) ;- (TC) Counter Clock Disabled with RB Loading +AT91C_TC_ETRGEDG EQU (0x3 << 8) ;- (TC) External Trigger Edge Selection +AT91C_TC_ETRGEDG_NONE EQU (0x0 << 8) ;- (TC) Edge: None +AT91C_TC_ETRGEDG_RISING EQU (0x1 << 8) ;- (TC) Edge: rising edge +AT91C_TC_ETRGEDG_FALLING EQU (0x2 << 8) ;- (TC) Edge: falling edge +AT91C_TC_ETRGEDG_BOTH EQU (0x3 << 8) ;- (TC) Edge: each edge +AT91C_TC_EEVTEDG EQU (0x3 << 8) ;- (TC) External Event Edge Selection +AT91C_TC_EEVTEDG_NONE EQU (0x0 << 8) ;- (TC) Edge: None +AT91C_TC_EEVTEDG_RISING EQU (0x1 << 8) ;- (TC) Edge: rising edge +AT91C_TC_EEVTEDG_FALLING EQU (0x2 << 8) ;- (TC) Edge: falling edge +AT91C_TC_EEVTEDG_BOTH EQU (0x3 << 8) ;- (TC) Edge: each edge +AT91C_TC_EEVT EQU (0x3 << 10) ;- (TC) External Event Selection +AT91C_TC_EEVT_TIOB EQU (0x0 << 10) ;- (TC) Signal selected as external event: TIOB TIOB direction: input +AT91C_TC_EEVT_XC0 EQU (0x1 << 10) ;- (TC) Signal selected as external event: XC0 TIOB direction: output +AT91C_TC_EEVT_XC1 EQU (0x2 << 10) ;- (TC) Signal selected as external event: XC1 TIOB direction: output +AT91C_TC_EEVT_XC2 EQU (0x3 << 10) ;- (TC) Signal selected as external event: XC2 TIOB direction: output +AT91C_TC_ABETRG EQU (0x1 << 10) ;- (TC) TIOA or TIOB External Trigger Selection +AT91C_TC_ENETRG EQU (0x1 << 12) ;- (TC) External Event Trigger enable +AT91C_TC_WAVESEL EQU (0x3 << 13) ;- (TC) Waveform Selection +AT91C_TC_WAVESEL_UP EQU (0x0 << 13) ;- (TC) UP mode without atomatic trigger on RC Compare +AT91C_TC_WAVESEL_UPDOWN EQU (0x1 << 13) ;- (TC) UPDOWN mode without automatic trigger on RC Compare +AT91C_TC_WAVESEL_UP_AUTO EQU (0x2 << 13) ;- (TC) UP mode with automatic trigger on RC Compare +AT91C_TC_WAVESEL_UPDOWN_AUTO EQU (0x3 << 13) ;- (TC) UPDOWN mode with automatic trigger on RC Compare +AT91C_TC_CPCTRG EQU (0x1 << 14) ;- (TC) RC Compare Trigger Enable +AT91C_TC_WAVE EQU (0x1 << 15) ;- (TC) +AT91C_TC_ACPA EQU (0x3 << 16) ;- (TC) RA Compare Effect on TIOA +AT91C_TC_ACPA_NONE EQU (0x0 << 16) ;- (TC) Effect: none +AT91C_TC_ACPA_SET EQU (0x1 << 16) ;- (TC) Effect: set +AT91C_TC_ACPA_CLEAR EQU (0x2 << 16) ;- (TC) Effect: clear +AT91C_TC_ACPA_TOGGLE EQU (0x3 << 16) ;- (TC) Effect: toggle +AT91C_TC_LDRA EQU (0x3 << 16) ;- (TC) RA Loading Selection +AT91C_TC_LDRA_NONE EQU (0x0 << 16) ;- (TC) Edge: None +AT91C_TC_LDRA_RISING EQU (0x1 << 16) ;- (TC) Edge: rising edge of TIOA +AT91C_TC_LDRA_FALLING EQU (0x2 << 16) ;- (TC) Edge: falling edge of TIOA +AT91C_TC_LDRA_BOTH EQU (0x3 << 16) ;- (TC) Edge: each edge of TIOA +AT91C_TC_ACPC EQU (0x3 << 18) ;- (TC) RC Compare Effect on TIOA +AT91C_TC_ACPC_NONE EQU (0x0 << 18) ;- (TC) Effect: none +AT91C_TC_ACPC_SET EQU (0x1 << 18) ;- (TC) Effect: set +AT91C_TC_ACPC_CLEAR EQU (0x2 << 18) ;- (TC) Effect: clear +AT91C_TC_ACPC_TOGGLE EQU (0x3 << 18) ;- (TC) Effect: toggle +AT91C_TC_LDRB EQU (0x3 << 18) ;- (TC) RB Loading Selection +AT91C_TC_LDRB_NONE EQU (0x0 << 18) ;- (TC) Edge: None +AT91C_TC_LDRB_RISING EQU (0x1 << 18) ;- (TC) Edge: rising edge of TIOA +AT91C_TC_LDRB_FALLING EQU (0x2 << 18) ;- (TC) Edge: falling edge of TIOA +AT91C_TC_LDRB_BOTH EQU (0x3 << 18) ;- (TC) Edge: each edge of TIOA +AT91C_TC_AEEVT EQU (0x3 << 20) ;- (TC) External Event Effect on TIOA +AT91C_TC_AEEVT_NONE EQU (0x0 << 20) ;- (TC) Effect: none +AT91C_TC_AEEVT_SET EQU (0x1 << 20) ;- (TC) Effect: set +AT91C_TC_AEEVT_CLEAR EQU (0x2 << 20) ;- (TC) Effect: clear +AT91C_TC_AEEVT_TOGGLE EQU (0x3 << 20) ;- (TC) Effect: toggle +AT91C_TC_ASWTRG EQU (0x3 << 22) ;- (TC) Software Trigger Effect on TIOA +AT91C_TC_ASWTRG_NONE EQU (0x0 << 22) ;- (TC) Effect: none +AT91C_TC_ASWTRG_SET EQU (0x1 << 22) ;- (TC) Effect: set +AT91C_TC_ASWTRG_CLEAR EQU (0x2 << 22) ;- (TC) Effect: clear +AT91C_TC_ASWTRG_TOGGLE EQU (0x3 << 22) ;- (TC) Effect: toggle +AT91C_TC_BCPB EQU (0x3 << 24) ;- (TC) RB Compare Effect on TIOB +AT91C_TC_BCPB_NONE EQU (0x0 << 24) ;- (TC) Effect: none +AT91C_TC_BCPB_SET EQU (0x1 << 24) ;- (TC) Effect: set +AT91C_TC_BCPB_CLEAR EQU (0x2 << 24) ;- (TC) Effect: clear +AT91C_TC_BCPB_TOGGLE EQU (0x3 << 24) ;- (TC) Effect: toggle +AT91C_TC_BCPC EQU (0x3 << 26) ;- (TC) RC Compare Effect on TIOB +AT91C_TC_BCPC_NONE EQU (0x0 << 26) ;- (TC) Effect: none +AT91C_TC_BCPC_SET EQU (0x1 << 26) ;- (TC) Effect: set +AT91C_TC_BCPC_CLEAR EQU (0x2 << 26) ;- (TC) Effect: clear +AT91C_TC_BCPC_TOGGLE EQU (0x3 << 26) ;- (TC) Effect: toggle +AT91C_TC_BEEVT EQU (0x3 << 28) ;- (TC) External Event Effect on TIOB +AT91C_TC_BEEVT_NONE EQU (0x0 << 28) ;- (TC) Effect: none +AT91C_TC_BEEVT_SET EQU (0x1 << 28) ;- (TC) Effect: set +AT91C_TC_BEEVT_CLEAR EQU (0x2 << 28) ;- (TC) Effect: clear +AT91C_TC_BEEVT_TOGGLE EQU (0x3 << 28) ;- (TC) Effect: toggle +AT91C_TC_BSWTRG EQU (0x3 << 30) ;- (TC) Software Trigger Effect on TIOB +AT91C_TC_BSWTRG_NONE EQU (0x0 << 30) ;- (TC) Effect: none +AT91C_TC_BSWTRG_SET EQU (0x1 << 30) ;- (TC) Effect: set +AT91C_TC_BSWTRG_CLEAR EQU (0x2 << 30) ;- (TC) Effect: clear +AT91C_TC_BSWTRG_TOGGLE EQU (0x3 << 30) ;- (TC) Effect: toggle +// - -------- TC_SR : (TC Offset: 0x20) TC Channel Status Register -------- +AT91C_TC_COVFS EQU (0x1 << 0) ;- (TC) Counter Overflow +AT91C_TC_LOVRS EQU (0x1 << 1) ;- (TC) Load Overrun +AT91C_TC_CPAS EQU (0x1 << 2) ;- (TC) RA Compare +AT91C_TC_CPBS EQU (0x1 << 3) ;- (TC) RB Compare +AT91C_TC_CPCS EQU (0x1 << 4) ;- (TC) RC Compare +AT91C_TC_LDRAS EQU (0x1 << 5) ;- (TC) RA Loading +AT91C_TC_LDRBS EQU (0x1 << 6) ;- (TC) RB Loading +AT91C_TC_ETRGS EQU (0x1 << 7) ;- (TC) External Trigger +AT91C_TC_CLKSTA EQU (0x1 << 16) ;- (TC) Clock Enabling +AT91C_TC_MTIOA EQU (0x1 << 17) ;- (TC) TIOA Mirror +AT91C_TC_MTIOB EQU (0x1 << 18) ;- (TC) TIOA Mirror +// - -------- TC_IER : (TC Offset: 0x24) TC Channel Interrupt Enable Register -------- +// - -------- TC_IDR : (TC Offset: 0x28) TC Channel Interrupt Disable Register -------- +// - -------- TC_IMR : (TC Offset: 0x2c) TC Channel Interrupt Mask Register -------- + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Timer Counter Interface +// - ***************************************************************************** +// - -------- TCB_BCR : (TCB Offset: 0xc0) TC Block Control Register -------- +AT91C_TCB_SYNC EQU (0x1 << 0) ;- (TCB) Synchro Command +// - -------- TCB_BMR : (TCB Offset: 0xc4) TC Block Mode Register -------- +AT91C_TCB_TC0XC0S EQU (0x3 << 0) ;- (TCB) External Clock Signal 0 Selection +AT91C_TCB_TC0XC0S_TCLK0 EQU (0x0) ;- (TCB) TCLK0 connected to XC0 +AT91C_TCB_TC0XC0S_NONE EQU (0x1) ;- (TCB) None signal connected to XC0 +AT91C_TCB_TC0XC0S_TIOA1 EQU (0x2) ;- (TCB) TIOA1 connected to XC0 +AT91C_TCB_TC0XC0S_TIOA2 EQU (0x3) ;- (TCB) TIOA2 connected to XC0 +AT91C_TCB_TC1XC1S EQU (0x3 << 2) ;- (TCB) External Clock Signal 1 Selection +AT91C_TCB_TC1XC1S_TCLK1 EQU (0x0 << 2) ;- (TCB) TCLK1 connected to XC1 +AT91C_TCB_TC1XC1S_NONE EQU (0x1 << 2) ;- (TCB) None signal connected to XC1 +AT91C_TCB_TC1XC1S_TIOA0 EQU (0x2 << 2) ;- (TCB) TIOA0 connected to XC1 +AT91C_TCB_TC1XC1S_TIOA2 EQU (0x3 << 2) ;- (TCB) TIOA2 connected to XC1 +AT91C_TCB_TC2XC2S EQU (0x3 << 4) ;- (TCB) External Clock Signal 2 Selection +AT91C_TCB_TC2XC2S_TCLK2 EQU (0x0 << 4) ;- (TCB) TCLK2 connected to XC2 +AT91C_TCB_TC2XC2S_NONE EQU (0x1 << 4) ;- (TCB) None signal connected to XC2 +AT91C_TCB_TC2XC2S_TIOA0 EQU (0x2 << 4) ;- (TCB) TIOA0 connected to XC2 +AT91C_TCB_TC2XC2S_TIOA1 EQU (0x3 << 4) ;- (TCB) TIOA2 connected to XC2 + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Control Area Network MailBox Interface +// - ***************************************************************************** +// - -------- CAN_MMR : (CAN_MB Offset: 0x0) CAN Message Mode Register -------- +AT91C_CAN_MTIMEMARK EQU (0xFFFF << 0) ;- (CAN_MB) Mailbox Timemark +AT91C_CAN_PRIOR EQU (0xF << 16) ;- (CAN_MB) Mailbox Priority +AT91C_CAN_MOT EQU (0x7 << 24) ;- (CAN_MB) Mailbox Object Type +AT91C_CAN_MOT_DIS EQU (0x0 << 24) ;- (CAN_MB) +AT91C_CAN_MOT_RX EQU (0x1 << 24) ;- (CAN_MB) +AT91C_CAN_MOT_RXOVERWRITE EQU (0x2 << 24) ;- (CAN_MB) +AT91C_CAN_MOT_TX EQU (0x3 << 24) ;- (CAN_MB) +AT91C_CAN_MOT_CONSUMER EQU (0x4 << 24) ;- (CAN_MB) +AT91C_CAN_MOT_PRODUCER EQU (0x5 << 24) ;- (CAN_MB) +// - -------- CAN_MAM : (CAN_MB Offset: 0x4) CAN Message Acceptance Mask Register -------- +AT91C_CAN_MIDvB EQU (0x3FFFF << 0) ;- (CAN_MB) Complementary bits for identifier in extended mode +AT91C_CAN_MIDvA EQU (0x7FF << 18) ;- (CAN_MB) Identifier for standard frame mode +AT91C_CAN_MIDE EQU (0x1 << 29) ;- (CAN_MB) Identifier Version +// - -------- CAN_MID : (CAN_MB Offset: 0x8) CAN Message ID Register -------- +// - -------- CAN_MFID : (CAN_MB Offset: 0xc) CAN Message Family ID Register -------- +// - -------- CAN_MSR : (CAN_MB Offset: 0x10) CAN Message Status Register -------- +AT91C_CAN_MTIMESTAMP EQU (0xFFFF << 0) ;- (CAN_MB) Timer Value +AT91C_CAN_MDLC EQU (0xF << 16) ;- (CAN_MB) Mailbox Data Length Code +AT91C_CAN_MRTR EQU (0x1 << 20) ;- (CAN_MB) Mailbox Remote Transmission Request +AT91C_CAN_MABT EQU (0x1 << 22) ;- (CAN_MB) Mailbox Message Abort +AT91C_CAN_MRDY EQU (0x1 << 23) ;- (CAN_MB) Mailbox Ready +AT91C_CAN_MMI EQU (0x1 << 24) ;- (CAN_MB) Mailbox Message Ignored +// - -------- CAN_MDL : (CAN_MB Offset: 0x14) CAN Message Data Low Register -------- +// - -------- CAN_MDH : (CAN_MB Offset: 0x18) CAN Message Data High Register -------- +// - -------- CAN_MCR : (CAN_MB Offset: 0x1c) CAN Message Control Register -------- +AT91C_CAN_MACR EQU (0x1 << 22) ;- (CAN_MB) Abort Request for Mailbox +AT91C_CAN_MTCR EQU (0x1 << 23) ;- (CAN_MB) Mailbox Transfer Command + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Control Area Network Interface +// - ***************************************************************************** +// - -------- CAN_MR : (CAN Offset: 0x0) CAN Mode Register -------- +AT91C_CAN_CANEN EQU (0x1 << 0) ;- (CAN) CAN Controller Enable +AT91C_CAN_LPM EQU (0x1 << 1) ;- (CAN) Disable/Enable Low Power Mode +AT91C_CAN_ABM EQU (0x1 << 2) ;- (CAN) Disable/Enable Autobaud/Listen Mode +AT91C_CAN_OVL EQU (0x1 << 3) ;- (CAN) Disable/Enable Overload Frame +AT91C_CAN_TEOF EQU (0x1 << 4) ;- (CAN) Time Stamp messages at each end of Frame +AT91C_CAN_TTM EQU (0x1 << 5) ;- (CAN) Disable/Enable Time Trigger Mode +AT91C_CAN_TIMFRZ EQU (0x1 << 6) ;- (CAN) Enable Timer Freeze +AT91C_CAN_DRPT EQU (0x1 << 7) ;- (CAN) Disable Repeat +// - -------- CAN_IER : (CAN Offset: 0x4) CAN Interrupt Enable Register -------- +AT91C_CAN_MB0 EQU (0x1 << 0) ;- (CAN) Mailbox 0 Flag +AT91C_CAN_MB1 EQU (0x1 << 1) ;- (CAN) Mailbox 1 Flag +AT91C_CAN_MB2 EQU (0x1 << 2) ;- (CAN) Mailbox 2 Flag +AT91C_CAN_MB3 EQU (0x1 << 3) ;- (CAN) Mailbox 3 Flag +AT91C_CAN_MB4 EQU (0x1 << 4) ;- (CAN) Mailbox 4 Flag +AT91C_CAN_MB5 EQU (0x1 << 5) ;- (CAN) Mailbox 5 Flag +AT91C_CAN_MB6 EQU (0x1 << 6) ;- (CAN) Mailbox 6 Flag +AT91C_CAN_MB7 EQU (0x1 << 7) ;- (CAN) Mailbox 7 Flag +AT91C_CAN_MB8 EQU (0x1 << 8) ;- (CAN) Mailbox 8 Flag +AT91C_CAN_MB9 EQU (0x1 << 9) ;- (CAN) Mailbox 9 Flag +AT91C_CAN_MB10 EQU (0x1 << 10) ;- (CAN) Mailbox 10 Flag +AT91C_CAN_MB11 EQU (0x1 << 11) ;- (CAN) Mailbox 11 Flag +AT91C_CAN_MB12 EQU (0x1 << 12) ;- (CAN) Mailbox 12 Flag +AT91C_CAN_MB13 EQU (0x1 << 13) ;- (CAN) Mailbox 13 Flag +AT91C_CAN_MB14 EQU (0x1 << 14) ;- (CAN) Mailbox 14 Flag +AT91C_CAN_MB15 EQU (0x1 << 15) ;- (CAN) Mailbox 15 Flag +AT91C_CAN_ERRA EQU (0x1 << 16) ;- (CAN) Error Active Mode Flag +AT91C_CAN_WARN EQU (0x1 << 17) ;- (CAN) Warning Limit Flag +AT91C_CAN_ERRP EQU (0x1 << 18) ;- (CAN) Error Passive Mode Flag +AT91C_CAN_BOFF EQU (0x1 << 19) ;- (CAN) Bus Off Mode Flag +AT91C_CAN_SLEEP EQU (0x1 << 20) ;- (CAN) Sleep Flag +AT91C_CAN_WAKEUP EQU (0x1 << 21) ;- (CAN) Wakeup Flag +AT91C_CAN_TOVF EQU (0x1 << 22) ;- (CAN) Timer Overflow Flag +AT91C_CAN_TSTP EQU (0x1 << 23) ;- (CAN) Timestamp Flag +AT91C_CAN_CERR EQU (0x1 << 24) ;- (CAN) CRC Error +AT91C_CAN_SERR EQU (0x1 << 25) ;- (CAN) Stuffing Error +AT91C_CAN_AERR EQU (0x1 << 26) ;- (CAN) Acknowledgment Error +AT91C_CAN_FERR EQU (0x1 << 27) ;- (CAN) Form Error +AT91C_CAN_BERR EQU (0x1 << 28) ;- (CAN) Bit Error +// - -------- CAN_IDR : (CAN Offset: 0x8) CAN Interrupt Disable Register -------- +// - -------- CAN_IMR : (CAN Offset: 0xc) CAN Interrupt Mask Register -------- +// - -------- CAN_SR : (CAN Offset: 0x10) CAN Status Register -------- +AT91C_CAN_RBSY EQU (0x1 << 29) ;- (CAN) Receiver Busy +AT91C_CAN_TBSY EQU (0x1 << 30) ;- (CAN) Transmitter Busy +AT91C_CAN_OVLY EQU (0x1 << 31) ;- (CAN) Overload Busy +// - -------- CAN_BR : (CAN Offset: 0x14) CAN Baudrate Register -------- +AT91C_CAN_PHASE2 EQU (0x7 << 0) ;- (CAN) Phase 2 segment +AT91C_CAN_PHASE1 EQU (0x7 << 4) ;- (CAN) Phase 1 segment +AT91C_CAN_PROPAG EQU (0x7 << 8) ;- (CAN) Programmation time segment +AT91C_CAN_SYNC EQU (0x3 << 12) ;- (CAN) Re-synchronization jump width segment +AT91C_CAN_BRP EQU (0x7F << 16) ;- (CAN) Baudrate Prescaler +AT91C_CAN_SMP EQU (0x1 << 24) ;- (CAN) Sampling mode +// - -------- CAN_TIM : (CAN Offset: 0x18) CAN Timer Register -------- +AT91C_CAN_TIMER EQU (0xFFFF << 0) ;- (CAN) Timer field +// - -------- CAN_TIMESTP : (CAN Offset: 0x1c) CAN Timestamp Register -------- +// - -------- CAN_ECR : (CAN Offset: 0x20) CAN Error Counter Register -------- +AT91C_CAN_REC EQU (0xFF << 0) ;- (CAN) Receive Error Counter +AT91C_CAN_TEC EQU (0xFF << 16) ;- (CAN) Transmit Error Counter +// - -------- CAN_TCR : (CAN Offset: 0x24) CAN Transfer Command Register -------- +AT91C_CAN_TIMRST EQU (0x1 << 31) ;- (CAN) Timer Reset Field +// - -------- CAN_ACR : (CAN Offset: 0x28) CAN Abort Command Register -------- + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Ethernet MAC 10/100 +// - ***************************************************************************** +// - -------- EMAC_NCR : (EMAC Offset: 0x0) -------- +AT91C_EMAC_LB EQU (0x1 << 0) ;- (EMAC) Loopback. Optional. When set, loopback signal is at high level. +AT91C_EMAC_LLB EQU (0x1 << 1) ;- (EMAC) Loopback local. +AT91C_EMAC_RE EQU (0x1 << 2) ;- (EMAC) Receive enable. +AT91C_EMAC_TE EQU (0x1 << 3) ;- (EMAC) Transmit enable. +AT91C_EMAC_MPE EQU (0x1 << 4) ;- (EMAC) Management port enable. +AT91C_EMAC_CLRSTAT EQU (0x1 << 5) ;- (EMAC) Clear statistics registers. +AT91C_EMAC_INCSTAT EQU (0x1 << 6) ;- (EMAC) Increment statistics registers. +AT91C_EMAC_WESTAT EQU (0x1 << 7) ;- (EMAC) Write enable for statistics registers. +AT91C_EMAC_BP EQU (0x1 << 8) ;- (EMAC) Back pressure. +AT91C_EMAC_TSTART EQU (0x1 << 9) ;- (EMAC) Start Transmission. +AT91C_EMAC_THALT EQU (0x1 << 10) ;- (EMAC) Transmission Halt. +AT91C_EMAC_TPFR EQU (0x1 << 11) ;- (EMAC) Transmit pause frame +AT91C_EMAC_TZQ EQU (0x1 << 12) ;- (EMAC) Transmit zero quantum pause frame +// - -------- EMAC_NCFGR : (EMAC Offset: 0x4) Network Configuration Register -------- +AT91C_EMAC_SPD EQU (0x1 << 0) ;- (EMAC) Speed. +AT91C_EMAC_FD EQU (0x1 << 1) ;- (EMAC) Full duplex. +AT91C_EMAC_JFRAME EQU (0x1 << 3) ;- (EMAC) Jumbo Frames. +AT91C_EMAC_CAF EQU (0x1 << 4) ;- (EMAC) Copy all frames. +AT91C_EMAC_NBC EQU (0x1 << 5) ;- (EMAC) No broadcast. +AT91C_EMAC_MTI EQU (0x1 << 6) ;- (EMAC) Multicast hash event enable +AT91C_EMAC_UNI EQU (0x1 << 7) ;- (EMAC) Unicast hash enable. +AT91C_EMAC_BIG EQU (0x1 << 8) ;- (EMAC) Receive 1522 bytes. +AT91C_EMAC_EAE EQU (0x1 << 9) ;- (EMAC) External address match enable. +AT91C_EMAC_CLK EQU (0x3 << 10) ;- (EMAC) +AT91C_EMAC_CLK_HCLK_8 EQU (0x0 << 10) ;- (EMAC) HCLK divided by 8 +AT91C_EMAC_CLK_HCLK_16 EQU (0x1 << 10) ;- (EMAC) HCLK divided by 16 +AT91C_EMAC_CLK_HCLK_32 EQU (0x2 << 10) ;- (EMAC) HCLK divided by 32 +AT91C_EMAC_CLK_HCLK_64 EQU (0x3 << 10) ;- (EMAC) HCLK divided by 64 +AT91C_EMAC_RTY EQU (0x1 << 12) ;- (EMAC) +AT91C_EMAC_PAE EQU (0x1 << 13) ;- (EMAC) +AT91C_EMAC_RBOF EQU (0x3 << 14) ;- (EMAC) +AT91C_EMAC_RBOF_OFFSET_0 EQU (0x0 << 14) ;- (EMAC) no offset from start of receive buffer +AT91C_EMAC_RBOF_OFFSET_1 EQU (0x1 << 14) ;- (EMAC) one byte offset from start of receive buffer +AT91C_EMAC_RBOF_OFFSET_2 EQU (0x2 << 14) ;- (EMAC) two bytes offset from start of receive buffer +AT91C_EMAC_RBOF_OFFSET_3 EQU (0x3 << 14) ;- (EMAC) three bytes offset from start of receive buffer +AT91C_EMAC_RLCE EQU (0x1 << 16) ;- (EMAC) Receive Length field Checking Enable +AT91C_EMAC_DRFCS EQU (0x1 << 17) ;- (EMAC) Discard Receive FCS +AT91C_EMAC_EFRHD EQU (0x1 << 18) ;- (EMAC) +AT91C_EMAC_IRXFCS EQU (0x1 << 19) ;- (EMAC) Ignore RX FCS +// - -------- EMAC_NSR : (EMAC Offset: 0x8) Network Status Register -------- +AT91C_EMAC_LINKR EQU (0x1 << 0) ;- (EMAC) +AT91C_EMAC_MDIO EQU (0x1 << 1) ;- (EMAC) +AT91C_EMAC_IDLE EQU (0x1 << 2) ;- (EMAC) +// - -------- EMAC_TSR : (EMAC Offset: 0x14) Transmit Status Register -------- +AT91C_EMAC_UBR EQU (0x1 << 0) ;- (EMAC) +AT91C_EMAC_COL EQU (0x1 << 1) ;- (EMAC) +AT91C_EMAC_RLES EQU (0x1 << 2) ;- (EMAC) +AT91C_EMAC_TGO EQU (0x1 << 3) ;- (EMAC) Transmit Go +AT91C_EMAC_BEX EQU (0x1 << 4) ;- (EMAC) Buffers exhausted mid frame +AT91C_EMAC_COMP EQU (0x1 << 5) ;- (EMAC) +AT91C_EMAC_UND EQU (0x1 << 6) ;- (EMAC) +// - -------- EMAC_RSR : (EMAC Offset: 0x20) Receive Status Register -------- +AT91C_EMAC_BNA EQU (0x1 << 0) ;- (EMAC) +AT91C_EMAC_REC EQU (0x1 << 1) ;- (EMAC) +AT91C_EMAC_OVR EQU (0x1 << 2) ;- (EMAC) +// - -------- EMAC_ISR : (EMAC Offset: 0x24) Interrupt Status Register -------- +AT91C_EMAC_MFD EQU (0x1 << 0) ;- (EMAC) +AT91C_EMAC_RCOMP EQU (0x1 << 1) ;- (EMAC) +AT91C_EMAC_RXUBR EQU (0x1 << 2) ;- (EMAC) +AT91C_EMAC_TXUBR EQU (0x1 << 3) ;- (EMAC) +AT91C_EMAC_TUNDR EQU (0x1 << 4) ;- (EMAC) +AT91C_EMAC_RLEX EQU (0x1 << 5) ;- (EMAC) +AT91C_EMAC_TXERR EQU (0x1 << 6) ;- (EMAC) +AT91C_EMAC_TCOMP EQU (0x1 << 7) ;- (EMAC) +AT91C_EMAC_LINK EQU (0x1 << 9) ;- (EMAC) +AT91C_EMAC_ROVR EQU (0x1 << 10) ;- (EMAC) +AT91C_EMAC_HRESP EQU (0x1 << 11) ;- (EMAC) +AT91C_EMAC_PFRE EQU (0x1 << 12) ;- (EMAC) +AT91C_EMAC_PTZ EQU (0x1 << 13) ;- (EMAC) +// - -------- EMAC_IER : (EMAC Offset: 0x28) Interrupt Enable Register -------- +// - -------- EMAC_IDR : (EMAC Offset: 0x2c) Interrupt Disable Register -------- +// - -------- EMAC_IMR : (EMAC Offset: 0x30) Interrupt Mask Register -------- +// - -------- EMAC_MAN : (EMAC Offset: 0x34) PHY Maintenance Register -------- +AT91C_EMAC_DATA EQU (0xFFFF << 0) ;- (EMAC) +AT91C_EMAC_CODE EQU (0x3 << 16) ;- (EMAC) +AT91C_EMAC_REGA EQU (0x1F << 18) ;- (EMAC) +AT91C_EMAC_PHYA EQU (0x1F << 23) ;- (EMAC) +AT91C_EMAC_RW EQU (0x3 << 28) ;- (EMAC) +AT91C_EMAC_SOF EQU (0x3 << 30) ;- (EMAC) +// - -------- EMAC_USRIO : (EMAC Offset: 0xc0) USER Input Output Register -------- +AT91C_EMAC_RMII EQU (0x1 << 0) ;- (EMAC) Reduce MII +AT91C_EMAC_CLKEN EQU (0x1 << 1) ;- (EMAC) Clock Enable +// - -------- EMAC_WOL : (EMAC Offset: 0xc4) Wake On LAN Register -------- +AT91C_EMAC_IP EQU (0xFFFF << 0) ;- (EMAC) ARP request IP address +AT91C_EMAC_MAG EQU (0x1 << 16) ;- (EMAC) Magic packet event enable +AT91C_EMAC_ARP EQU (0x1 << 17) ;- (EMAC) ARP request event enable +AT91C_EMAC_SA1 EQU (0x1 << 18) ;- (EMAC) Specific address register 1 event enable +// - -------- EMAC_REV : (EMAC Offset: 0xfc) Revision Register -------- +AT91C_EMAC_REVREF EQU (0xFFFF << 0) ;- (EMAC) +AT91C_EMAC_PARTREF EQU (0xFFFF << 16) ;- (EMAC) + +// - ***************************************************************************** +// - SOFTWARE API DEFINITION FOR Analog to Digital Convertor +// - ***************************************************************************** +// - -------- ADC_CR : (ADC Offset: 0x0) ADC Control Register -------- +AT91C_ADC_SWRST EQU (0x1 << 0) ;- (ADC) Software Reset +AT91C_ADC_START EQU (0x1 << 1) ;- (ADC) Start Conversion +// - -------- ADC_MR : (ADC Offset: 0x4) ADC Mode Register -------- +AT91C_ADC_TRGEN EQU (0x1 << 0) ;- (ADC) Trigger Enable +AT91C_ADC_TRGEN_DIS EQU (0x0) ;- (ADC) Hradware triggers are disabled. Starting a conversion is only possible by software +AT91C_ADC_TRGEN_EN EQU (0x1) ;- (ADC) Hardware trigger selected by TRGSEL field is enabled. +AT91C_ADC_TRGSEL EQU (0x7 << 1) ;- (ADC) Trigger Selection +AT91C_ADC_TRGSEL_TIOA0 EQU (0x0 << 1) ;- (ADC) Selected TRGSEL = TIAO0 +AT91C_ADC_TRGSEL_TIOA1 EQU (0x1 << 1) ;- (ADC) Selected TRGSEL = TIAO1 +AT91C_ADC_TRGSEL_TIOA2 EQU (0x2 << 1) ;- (ADC) Selected TRGSEL = TIAO2 +AT91C_ADC_TRGSEL_TIOA3 EQU (0x3 << 1) ;- (ADC) Selected TRGSEL = TIAO3 +AT91C_ADC_TRGSEL_TIOA4 EQU (0x4 << 1) ;- (ADC) Selected TRGSEL = TIAO4 +AT91C_ADC_TRGSEL_TIOA5 EQU (0x5 << 1) ;- (ADC) Selected TRGSEL = TIAO5 +AT91C_ADC_TRGSEL_EXT EQU (0x6 << 1) ;- (ADC) Selected TRGSEL = External Trigger +AT91C_ADC_LOWRES EQU (0x1 << 4) ;- (ADC) Resolution. +AT91C_ADC_LOWRES_10_BIT EQU (0x0 << 4) ;- (ADC) 10-bit resolution +AT91C_ADC_LOWRES_8_BIT EQU (0x1 << 4) ;- (ADC) 8-bit resolution +AT91C_ADC_SLEEP EQU (0x1 << 5) ;- (ADC) Sleep Mode +AT91C_ADC_SLEEP_NORMAL_MODE EQU (0x0 << 5) ;- (ADC) Normal Mode +AT91C_ADC_SLEEP_MODE EQU (0x1 << 5) ;- (ADC) Sleep Mode +AT91C_ADC_PRESCAL EQU (0x3F << 8) ;- (ADC) Prescaler rate selection +AT91C_ADC_STARTUP EQU (0x1F << 16) ;- (ADC) Startup Time +AT91C_ADC_SHTIM EQU (0xF << 24) ;- (ADC) Sample & Hold Time +// - -------- ADC_CHER : (ADC Offset: 0x10) ADC Channel Enable Register -------- +AT91C_ADC_CH0 EQU (0x1 << 0) ;- (ADC) Channel 0 +AT91C_ADC_CH1 EQU (0x1 << 1) ;- (ADC) Channel 1 +AT91C_ADC_CH2 EQU (0x1 << 2) ;- (ADC) Channel 2 +AT91C_ADC_CH3 EQU (0x1 << 3) ;- (ADC) Channel 3 +AT91C_ADC_CH4 EQU (0x1 << 4) ;- (ADC) Channel 4 +AT91C_ADC_CH5 EQU (0x1 << 5) ;- (ADC) Channel 5 +AT91C_ADC_CH6 EQU (0x1 << 6) ;- (ADC) Channel 6 +AT91C_ADC_CH7 EQU (0x1 << 7) ;- (ADC) Channel 7 +// - -------- ADC_CHDR : (ADC Offset: 0x14) ADC Channel Disable Register -------- +// - -------- ADC_CHSR : (ADC Offset: 0x18) ADC Channel Status Register -------- +// - -------- ADC_SR : (ADC Offset: 0x1c) ADC Status Register -------- +AT91C_ADC_EOC0 EQU (0x1 << 0) ;- (ADC) End of Conversion +AT91C_ADC_EOC1 EQU (0x1 << 1) ;- (ADC) End of Conversion +AT91C_ADC_EOC2 EQU (0x1 << 2) ;- (ADC) End of Conversion +AT91C_ADC_EOC3 EQU (0x1 << 3) ;- (ADC) End of Conversion +AT91C_ADC_EOC4 EQU (0x1 << 4) ;- (ADC) End of Conversion +AT91C_ADC_EOC5 EQU (0x1 << 5) ;- (ADC) End of Conversion +AT91C_ADC_EOC6 EQU (0x1 << 6) ;- (ADC) End of Conversion +AT91C_ADC_EOC7 EQU (0x1 << 7) ;- (ADC) End of Conversion +AT91C_ADC_OVRE0 EQU (0x1 << 8) ;- (ADC) Overrun Error +AT91C_ADC_OVRE1 EQU (0x1 << 9) ;- (ADC) Overrun Error +AT91C_ADC_OVRE2 EQU (0x1 << 10) ;- (ADC) Overrun Error +AT91C_ADC_OVRE3 EQU (0x1 << 11) ;- (ADC) Overrun Error +AT91C_ADC_OVRE4 EQU (0x1 << 12) ;- (ADC) Overrun Error +AT91C_ADC_OVRE5 EQU (0x1 << 13) ;- (ADC) Overrun Error +AT91C_ADC_OVRE6 EQU (0x1 << 14) ;- (ADC) Overrun Error +AT91C_ADC_OVRE7 EQU (0x1 << 15) ;- (ADC) Overrun Error +AT91C_ADC_DRDY EQU (0x1 << 16) ;- (ADC) Data Ready +AT91C_ADC_GOVRE EQU (0x1 << 17) ;- (ADC) General Overrun +AT91C_ADC_ENDRX EQU (0x1 << 18) ;- (ADC) End of Receiver Transfer +AT91C_ADC_RXBUFF EQU (0x1 << 19) ;- (ADC) RXBUFF Interrupt +// - -------- ADC_LCDR : (ADC Offset: 0x20) ADC Last Converted Data Register -------- +AT91C_ADC_LDATA EQU (0x3FF << 0) ;- (ADC) Last Data Converted +// - -------- ADC_IER : (ADC Offset: 0x24) ADC Interrupt Enable Register -------- +// - -------- ADC_IDR : (ADC Offset: 0x28) ADC Interrupt Disable Register -------- +// - -------- ADC_IMR : (ADC Offset: 0x2c) ADC Interrupt Mask Register -------- +// - -------- ADC_CDR0 : (ADC Offset: 0x30) ADC Channel Data Register 0 -------- +AT91C_ADC_DATA EQU (0x3FF << 0) ;- (ADC) Converted Data +// - -------- ADC_CDR1 : (ADC Offset: 0x34) ADC Channel Data Register 1 -------- +// - -------- ADC_CDR2 : (ADC Offset: 0x38) ADC Channel Data Register 2 -------- +// - -------- ADC_CDR3 : (ADC Offset: 0x3c) ADC Channel Data Register 3 -------- +// - -------- ADC_CDR4 : (ADC Offset: 0x40) ADC Channel Data Register 4 -------- +// - -------- ADC_CDR5 : (ADC Offset: 0x44) ADC Channel Data Register 5 -------- +// - -------- ADC_CDR6 : (ADC Offset: 0x48) ADC Channel Data Register 6 -------- +// - -------- ADC_CDR7 : (ADC Offset: 0x4c) ADC Channel Data Register 7 -------- + +// - ***************************************************************************** +// - REGISTER ADDRESS DEFINITION FOR AT91SAM7X256 +// - ***************************************************************************** +// - ========== Register definition for SYS peripheral ========== +// - ========== Register definition for AIC peripheral ========== +AT91C_AIC_IVR EQU (0xFFFFF100) ;- (AIC) IRQ Vector Register +AT91C_AIC_SMR EQU (0xFFFFF000) ;- (AIC) Source Mode Register +AT91C_AIC_FVR EQU (0xFFFFF104) ;- (AIC) FIQ Vector Register +AT91C_AIC_DCR EQU (0xFFFFF138) ;- (AIC) Debug Control Register (Protect) +AT91C_AIC_EOICR EQU (0xFFFFF130) ;- (AIC) End of Interrupt Command Register +AT91C_AIC_SVR EQU (0xFFFFF080) ;- (AIC) Source Vector Register +AT91C_AIC_FFSR EQU (0xFFFFF148) ;- (AIC) Fast Forcing Status Register +AT91C_AIC_ICCR EQU (0xFFFFF128) ;- (AIC) Interrupt Clear Command Register +AT91C_AIC_ISR EQU (0xFFFFF108) ;- (AIC) Interrupt Status Register +AT91C_AIC_IMR EQU (0xFFFFF110) ;- (AIC) Interrupt Mask Register +AT91C_AIC_IPR EQU (0xFFFFF10C) ;- (AIC) Interrupt Pending Register +AT91C_AIC_FFER EQU (0xFFFFF140) ;- (AIC) Fast Forcing Enable Register +AT91C_AIC_IECR EQU (0xFFFFF120) ;- (AIC) Interrupt Enable Command Register +AT91C_AIC_ISCR EQU (0xFFFFF12C) ;- (AIC) Interrupt Set Command Register +AT91C_AIC_FFDR EQU (0xFFFFF144) ;- (AIC) Fast Forcing Disable Register +AT91C_AIC_CISR EQU (0xFFFFF114) ;- (AIC) Core Interrupt Status Register +AT91C_AIC_IDCR EQU (0xFFFFF124) ;- (AIC) Interrupt Disable Command Register +AT91C_AIC_SPU EQU (0xFFFFF134) ;- (AIC) Spurious Vector Register +// - ========== Register definition for PDC_DBGU peripheral ========== +AT91C_DBGU_TCR EQU (0xFFFFF30C) ;- (PDC_DBGU) Transmit Counter Register +AT91C_DBGU_RNPR EQU (0xFFFFF310) ;- (PDC_DBGU) Receive Next Pointer Register +AT91C_DBGU_TNPR EQU (0xFFFFF318) ;- (PDC_DBGU) Transmit Next Pointer Register +AT91C_DBGU_TPR EQU (0xFFFFF308) ;- (PDC_DBGU) Transmit Pointer Register +AT91C_DBGU_RPR EQU (0xFFFFF300) ;- (PDC_DBGU) Receive Pointer Register +AT91C_DBGU_RCR EQU (0xFFFFF304) ;- (PDC_DBGU) Receive Counter Register +AT91C_DBGU_RNCR EQU (0xFFFFF314) ;- (PDC_DBGU) Receive Next Counter Register +AT91C_DBGU_PTCR EQU (0xFFFFF320) ;- (PDC_DBGU) PDC Transfer Control Register +AT91C_DBGU_PTSR EQU (0xFFFFF324) ;- (PDC_DBGU) PDC Transfer Status Register +AT91C_DBGU_TNCR EQU (0xFFFFF31C) ;- (PDC_DBGU) Transmit Next Counter Register +// - ========== Register definition for DBGU peripheral ========== +AT91C_DBGU_EXID EQU (0xFFFFF244) ;- (DBGU) Chip ID Extension Register +AT91C_DBGU_BRGR EQU (0xFFFFF220) ;- (DBGU) Baud Rate Generator Register +AT91C_DBGU_IDR EQU (0xFFFFF20C) ;- (DBGU) Interrupt Disable Register +AT91C_DBGU_CSR EQU (0xFFFFF214) ;- (DBGU) Channel Status Register +AT91C_DBGU_CIDR EQU (0xFFFFF240) ;- (DBGU) Chip ID Register +AT91C_DBGU_MR EQU (0xFFFFF204) ;- (DBGU) Mode Register +AT91C_DBGU_IMR EQU (0xFFFFF210) ;- (DBGU) Interrupt Mask Register +AT91C_DBGU_CR EQU (0xFFFFF200) ;- (DBGU) Control Register +AT91C_DBGU_FNTR EQU (0xFFFFF248) ;- (DBGU) Force NTRST Register +AT91C_DBGU_THR EQU (0xFFFFF21C) ;- (DBGU) Transmitter Holding Register +AT91C_DBGU_RHR EQU (0xFFFFF218) ;- (DBGU) Receiver Holding Register +AT91C_DBGU_IER EQU (0xFFFFF208) ;- (DBGU) Interrupt Enable Register +// - ========== Register definition for PIOA peripheral ========== +AT91C_PIOA_ODR EQU (0xFFFFF414) ;- (PIOA) Output Disable Registerr +AT91C_PIOA_SODR EQU (0xFFFFF430) ;- (PIOA) Set Output Data Register +AT91C_PIOA_ISR EQU (0xFFFFF44C) ;- (PIOA) Interrupt Status Register +AT91C_PIOA_ABSR EQU (0xFFFFF478) ;- (PIOA) AB Select Status Register +AT91C_PIOA_IER EQU (0xFFFFF440) ;- (PIOA) Interrupt Enable Register +AT91C_PIOA_PPUDR EQU (0xFFFFF460) ;- (PIOA) Pull-up Disable Register +AT91C_PIOA_IMR EQU (0xFFFFF448) ;- (PIOA) Interrupt Mask Register +AT91C_PIOA_PER EQU (0xFFFFF400) ;- (PIOA) PIO Enable Register +AT91C_PIOA_IFDR EQU (0xFFFFF424) ;- (PIOA) Input Filter Disable Register +AT91C_PIOA_OWDR EQU (0xFFFFF4A4) ;- (PIOA) Output Write Disable Register +AT91C_PIOA_MDSR EQU (0xFFFFF458) ;- (PIOA) Multi-driver Status Register +AT91C_PIOA_IDR EQU (0xFFFFF444) ;- (PIOA) Interrupt Disable Register +AT91C_PIOA_ODSR EQU (0xFFFFF438) ;- (PIOA) Output Data Status Register +AT91C_PIOA_PPUSR EQU (0xFFFFF468) ;- (PIOA) Pull-up Status Register +AT91C_PIOA_OWSR EQU (0xFFFFF4A8) ;- (PIOA) Output Write Status Register +AT91C_PIOA_BSR EQU (0xFFFFF474) ;- (PIOA) Select B Register +AT91C_PIOA_OWER EQU (0xFFFFF4A0) ;- (PIOA) Output Write Enable Register +AT91C_PIOA_IFER EQU (0xFFFFF420) ;- (PIOA) Input Filter Enable Register +AT91C_PIOA_PDSR EQU (0xFFFFF43C) ;- (PIOA) Pin Data Status Register +AT91C_PIOA_PPUER EQU (0xFFFFF464) ;- (PIOA) Pull-up Enable Register +AT91C_PIOA_OSR EQU (0xFFFFF418) ;- (PIOA) Output Status Register +AT91C_PIOA_ASR EQU (0xFFFFF470) ;- (PIOA) Select A Register +AT91C_PIOA_MDDR EQU (0xFFFFF454) ;- (PIOA) Multi-driver Disable Register +AT91C_PIOA_CODR EQU (0xFFFFF434) ;- (PIOA) Clear Output Data Register +AT91C_PIOA_MDER EQU (0xFFFFF450) ;- (PIOA) Multi-driver Enable Register +AT91C_PIOA_PDR EQU (0xFFFFF404) ;- (PIOA) PIO Disable Register +AT91C_PIOA_IFSR EQU (0xFFFFF428) ;- (PIOA) Input Filter Status Register +AT91C_PIOA_OER EQU (0xFFFFF410) ;- (PIOA) Output Enable Register +AT91C_PIOA_PSR EQU (0xFFFFF408) ;- (PIOA) PIO Status Register +// - ========== Register definition for PIOB peripheral ========== +AT91C_PIOB_OWDR EQU (0xFFFFF6A4) ;- (PIOB) Output Write Disable Register +AT91C_PIOB_MDER EQU (0xFFFFF650) ;- (PIOB) Multi-driver Enable Register +AT91C_PIOB_PPUSR EQU (0xFFFFF668) ;- (PIOB) Pull-up Status Register +AT91C_PIOB_IMR EQU (0xFFFFF648) ;- (PIOB) Interrupt Mask Register +AT91C_PIOB_ASR EQU (0xFFFFF670) ;- (PIOB) Select A Register +AT91C_PIOB_PPUDR EQU (0xFFFFF660) ;- (PIOB) Pull-up Disable Register +AT91C_PIOB_PSR EQU (0xFFFFF608) ;- (PIOB) PIO Status Register +AT91C_PIOB_IER EQU (0xFFFFF640) ;- (PIOB) Interrupt Enable Register +AT91C_PIOB_CODR EQU (0xFFFFF634) ;- (PIOB) Clear Output Data Register +AT91C_PIOB_OWER EQU (0xFFFFF6A0) ;- (PIOB) Output Write Enable Register +AT91C_PIOB_ABSR EQU (0xFFFFF678) ;- (PIOB) AB Select Status Register +AT91C_PIOB_IFDR EQU (0xFFFFF624) ;- (PIOB) Input Filter Disable Register +AT91C_PIOB_PDSR EQU (0xFFFFF63C) ;- (PIOB) Pin Data Status Register +AT91C_PIOB_IDR EQU (0xFFFFF644) ;- (PIOB) Interrupt Disable Register +AT91C_PIOB_OWSR EQU (0xFFFFF6A8) ;- (PIOB) Output Write Status Register +AT91C_PIOB_PDR EQU (0xFFFFF604) ;- (PIOB) PIO Disable Register +AT91C_PIOB_ODR EQU (0xFFFFF614) ;- (PIOB) Output Disable Registerr +AT91C_PIOB_IFSR EQU (0xFFFFF628) ;- (PIOB) Input Filter Status Register +AT91C_PIOB_PPUER EQU (0xFFFFF664) ;- (PIOB) Pull-up Enable Register +AT91C_PIOB_SODR EQU (0xFFFFF630) ;- (PIOB) Set Output Data Register +AT91C_PIOB_ISR EQU (0xFFFFF64C) ;- (PIOB) Interrupt Status Register +AT91C_PIOB_ODSR EQU (0xFFFFF638) ;- (PIOB) Output Data Status Register +AT91C_PIOB_OSR EQU (0xFFFFF618) ;- (PIOB) Output Status Register +AT91C_PIOB_MDSR EQU (0xFFFFF658) ;- (PIOB) Multi-driver Status Register +AT91C_PIOB_IFER EQU (0xFFFFF620) ;- (PIOB) Input Filter Enable Register +AT91C_PIOB_BSR EQU (0xFFFFF674) ;- (PIOB) Select B Register +AT91C_PIOB_MDDR EQU (0xFFFFF654) ;- (PIOB) Multi-driver Disable Register +AT91C_PIOB_OER EQU (0xFFFFF610) ;- (PIOB) Output Enable Register +AT91C_PIOB_PER EQU (0xFFFFF600) ;- (PIOB) PIO Enable Register +// - ========== Register definition for CKGR peripheral ========== +AT91C_CKGR_MOR EQU (0xFFFFFC20) ;- (CKGR) Main Oscillator Register +AT91C_CKGR_PLLR EQU (0xFFFFFC2C) ;- (CKGR) PLL Register +AT91C_CKGR_MCFR EQU (0xFFFFFC24) ;- (CKGR) Main Clock Frequency Register +// - ========== Register definition for PMC peripheral ========== +AT91C_PMC_IDR EQU (0xFFFFFC64) ;- (PMC) Interrupt Disable Register +AT91C_PMC_MOR EQU (0xFFFFFC20) ;- (PMC) Main Oscillator Register +AT91C_PMC_PLLR EQU (0xFFFFFC2C) ;- (PMC) PLL Register +AT91C_PMC_PCER EQU (0xFFFFFC10) ;- (PMC) Peripheral Clock Enable Register +AT91C_PMC_PCKR EQU (0xFFFFFC40) ;- (PMC) Programmable Clock Register +AT91C_PMC_MCKR EQU (0xFFFFFC30) ;- (PMC) Master Clock Register +AT91C_PMC_SCDR EQU (0xFFFFFC04) ;- (PMC) System Clock Disable Register +AT91C_PMC_PCDR EQU (0xFFFFFC14) ;- (PMC) Peripheral Clock Disable Register +AT91C_PMC_SCSR EQU (0xFFFFFC08) ;- (PMC) System Clock Status Register +AT91C_PMC_PCSR EQU (0xFFFFFC18) ;- (PMC) Peripheral Clock Status Register +AT91C_PMC_MCFR EQU (0xFFFFFC24) ;- (PMC) Main Clock Frequency Register +AT91C_PMC_SCER EQU (0xFFFFFC00) ;- (PMC) System Clock Enable Register +AT91C_PMC_IMR EQU (0xFFFFFC6C) ;- (PMC) Interrupt Mask Register +AT91C_PMC_IER EQU (0xFFFFFC60) ;- (PMC) Interrupt Enable Register +AT91C_PMC_SR EQU (0xFFFFFC68) ;- (PMC) Status Register +// - ========== Register definition for RSTC peripheral ========== +AT91C_RSTC_RCR EQU (0xFFFFFD00) ;- (RSTC) Reset Control Register +AT91C_RSTC_RMR EQU (0xFFFFFD08) ;- (RSTC) Reset Mode Register +AT91C_RSTC_RSR EQU (0xFFFFFD04) ;- (RSTC) Reset Status Register +// - ========== Register definition for RTTC peripheral ========== +AT91C_RTTC_RTSR EQU (0xFFFFFD2C) ;- (RTTC) Real-time Status Register +AT91C_RTTC_RTMR EQU (0xFFFFFD20) ;- (RTTC) Real-time Mode Register +AT91C_RTTC_RTVR EQU (0xFFFFFD28) ;- (RTTC) Real-time Value Register +AT91C_RTTC_RTAR EQU (0xFFFFFD24) ;- (RTTC) Real-time Alarm Register +// - ========== Register definition for PITC peripheral ========== +AT91C_PITC_PIVR EQU (0xFFFFFD38) ;- (PITC) Period Interval Value Register +AT91C_PITC_PISR EQU (0xFFFFFD34) ;- (PITC) Period Interval Status Register +AT91C_PITC_PIIR EQU (0xFFFFFD3C) ;- (PITC) Period Interval Image Register +AT91C_PITC_PIMR EQU (0xFFFFFD30) ;- (PITC) Period Interval Mode Register +// - ========== Register definition for WDTC peripheral ========== +AT91C_WDTC_WDCR EQU (0xFFFFFD40) ;- (WDTC) Watchdog Control Register +AT91C_WDTC_WDSR EQU (0xFFFFFD48) ;- (WDTC) Watchdog Status Register +AT91C_WDTC_WDMR EQU (0xFFFFFD44) ;- (WDTC) Watchdog Mode Register +// - ========== Register definition for VREG peripheral ========== +AT91C_VREG_MR EQU (0xFFFFFD60) ;- (VREG) Voltage Regulator Mode Register +// - ========== Register definition for MC peripheral ========== +AT91C_MC_ASR EQU (0xFFFFFF04) ;- (MC) MC Abort Status Register +AT91C_MC_RCR EQU (0xFFFFFF00) ;- (MC) MC Remap Control Register +AT91C_MC_FCR EQU (0xFFFFFF64) ;- (MC) MC Flash Command Register +AT91C_MC_AASR EQU (0xFFFFFF08) ;- (MC) MC Abort Address Status Register +AT91C_MC_FSR EQU (0xFFFFFF68) ;- (MC) MC Flash Status Register +AT91C_MC_FMR EQU (0xFFFFFF60) ;- (MC) MC Flash Mode Register +// - ========== Register definition for PDC_SPI1 peripheral ========== +AT91C_SPI1_PTCR EQU (0xFFFE4120) ;- (PDC_SPI1) PDC Transfer Control Register +AT91C_SPI1_RPR EQU (0xFFFE4100) ;- (PDC_SPI1) Receive Pointer Register +AT91C_SPI1_TNCR EQU (0xFFFE411C) ;- (PDC_SPI1) Transmit Next Counter Register +AT91C_SPI1_TPR EQU (0xFFFE4108) ;- (PDC_SPI1) Transmit Pointer Register +AT91C_SPI1_TNPR EQU (0xFFFE4118) ;- (PDC_SPI1) Transmit Next Pointer Register +AT91C_SPI1_TCR EQU (0xFFFE410C) ;- (PDC_SPI1) Transmit Counter Register +AT91C_SPI1_RCR EQU (0xFFFE4104) ;- (PDC_SPI1) Receive Counter Register +AT91C_SPI1_RNPR EQU (0xFFFE4110) ;- (PDC_SPI1) Receive Next Pointer Register +AT91C_SPI1_RNCR EQU (0xFFFE4114) ;- (PDC_SPI1) Receive Next Counter Register +AT91C_SPI1_PTSR EQU (0xFFFE4124) ;- (PDC_SPI1) PDC Transfer Status Register +// - ========== Register definition for SPI1 peripheral ========== +AT91C_SPI1_IMR EQU (0xFFFE401C) ;- (SPI1) Interrupt Mask Register +AT91C_SPI1_IER EQU (0xFFFE4014) ;- (SPI1) Interrupt Enable Register +AT91C_SPI1_MR EQU (0xFFFE4004) ;- (SPI1) Mode Register +AT91C_SPI1_RDR EQU (0xFFFE4008) ;- (SPI1) Receive Data Register +AT91C_SPI1_IDR EQU (0xFFFE4018) ;- (SPI1) Interrupt Disable Register +AT91C_SPI1_SR EQU (0xFFFE4010) ;- (SPI1) Status Register +AT91C_SPI1_TDR EQU (0xFFFE400C) ;- (SPI1) Transmit Data Register +AT91C_SPI1_CR EQU (0xFFFE4000) ;- (SPI1) Control Register +AT91C_SPI1_CSR EQU (0xFFFE4030) ;- (SPI1) Chip Select Register +// - ========== Register definition for PDC_SPI0 peripheral ========== +AT91C_SPI0_PTCR EQU (0xFFFE0120) ;- (PDC_SPI0) PDC Transfer Control Register +AT91C_SPI0_TPR EQU (0xFFFE0108) ;- (PDC_SPI0) Transmit Pointer Register +AT91C_SPI0_TCR EQU (0xFFFE010C) ;- (PDC_SPI0) Transmit Counter Register +AT91C_SPI0_RCR EQU (0xFFFE0104) ;- (PDC_SPI0) Receive Counter Register +AT91C_SPI0_PTSR EQU (0xFFFE0124) ;- (PDC_SPI0) PDC Transfer Status Register +AT91C_SPI0_RNPR EQU (0xFFFE0110) ;- (PDC_SPI0) Receive Next Pointer Register +AT91C_SPI0_RPR EQU (0xFFFE0100) ;- (PDC_SPI0) Receive Pointer Register +AT91C_SPI0_TNCR EQU (0xFFFE011C) ;- (PDC_SPI0) Transmit Next Counter Register +AT91C_SPI0_RNCR EQU (0xFFFE0114) ;- (PDC_SPI0) Receive Next Counter Register +AT91C_SPI0_TNPR EQU (0xFFFE0118) ;- (PDC_SPI0) Transmit Next Pointer Register +// - ========== Register definition for SPI0 peripheral ========== +AT91C_SPI0_IER EQU (0xFFFE0014) ;- (SPI0) Interrupt Enable Register +AT91C_SPI0_SR EQU (0xFFFE0010) ;- (SPI0) Status Register +AT91C_SPI0_IDR EQU (0xFFFE0018) ;- (SPI0) Interrupt Disable Register +AT91C_SPI0_CR EQU (0xFFFE0000) ;- (SPI0) Control Register +AT91C_SPI0_MR EQU (0xFFFE0004) ;- (SPI0) Mode Register +AT91C_SPI0_IMR EQU (0xFFFE001C) ;- (SPI0) Interrupt Mask Register +AT91C_SPI0_TDR EQU (0xFFFE000C) ;- (SPI0) Transmit Data Register +AT91C_SPI0_RDR EQU (0xFFFE0008) ;- (SPI0) Receive Data Register +AT91C_SPI0_CSR EQU (0xFFFE0030) ;- (SPI0) Chip Select Register +// - ========== Register definition for PDC_US1 peripheral ========== +AT91C_US1_RNCR EQU (0xFFFC4114) ;- (PDC_US1) Receive Next Counter Register +AT91C_US1_PTCR EQU (0xFFFC4120) ;- (PDC_US1) PDC Transfer Control Register +AT91C_US1_TCR EQU (0xFFFC410C) ;- (PDC_US1) Transmit Counter Register +AT91C_US1_PTSR EQU (0xFFFC4124) ;- (PDC_US1) PDC Transfer Status Register +AT91C_US1_TNPR EQU (0xFFFC4118) ;- (PDC_US1) Transmit Next Pointer Register +AT91C_US1_RCR EQU (0xFFFC4104) ;- (PDC_US1) Receive Counter Register +AT91C_US1_RNPR EQU (0xFFFC4110) ;- (PDC_US1) Receive Next Pointer Register +AT91C_US1_RPR EQU (0xFFFC4100) ;- (PDC_US1) Receive Pointer Register +AT91C_US1_TNCR EQU (0xFFFC411C) ;- (PDC_US1) Transmit Next Counter Register +AT91C_US1_TPR EQU (0xFFFC4108) ;- (PDC_US1) Transmit Pointer Register +// - ========== Register definition for US1 peripheral ========== +AT91C_US1_IF EQU (0xFFFC404C) ;- (US1) IRDA_FILTER Register +AT91C_US1_NER EQU (0xFFFC4044) ;- (US1) Nb Errors Register +AT91C_US1_RTOR EQU (0xFFFC4024) ;- (US1) Receiver Time-out Register +AT91C_US1_CSR EQU (0xFFFC4014) ;- (US1) Channel Status Register +AT91C_US1_IDR EQU (0xFFFC400C) ;- (US1) Interrupt Disable Register +AT91C_US1_IER EQU (0xFFFC4008) ;- (US1) Interrupt Enable Register +AT91C_US1_THR EQU (0xFFFC401C) ;- (US1) Transmitter Holding Register +AT91C_US1_TTGR EQU (0xFFFC4028) ;- (US1) Transmitter Time-guard Register +AT91C_US1_RHR EQU (0xFFFC4018) ;- (US1) Receiver Holding Register +AT91C_US1_BRGR EQU (0xFFFC4020) ;- (US1) Baud Rate Generator Register +AT91C_US1_IMR EQU (0xFFFC4010) ;- (US1) Interrupt Mask Register +AT91C_US1_FIDI EQU (0xFFFC4040) ;- (US1) FI_DI_Ratio Register +AT91C_US1_CR EQU (0xFFFC4000) ;- (US1) Control Register +AT91C_US1_MR EQU (0xFFFC4004) ;- (US1) Mode Register +// - ========== Register definition for PDC_US0 peripheral ========== +AT91C_US0_TNPR EQU (0xFFFC0118) ;- (PDC_US0) Transmit Next Pointer Register +AT91C_US0_RNPR EQU (0xFFFC0110) ;- (PDC_US0) Receive Next Pointer Register +AT91C_US0_TCR EQU (0xFFFC010C) ;- (PDC_US0) Transmit Counter Register +AT91C_US0_PTCR EQU (0xFFFC0120) ;- (PDC_US0) PDC Transfer Control Register +AT91C_US0_PTSR EQU (0xFFFC0124) ;- (PDC_US0) PDC Transfer Status Register +AT91C_US0_TNCR EQU (0xFFFC011C) ;- (PDC_US0) Transmit Next Counter Register +AT91C_US0_TPR EQU (0xFFFC0108) ;- (PDC_US0) Transmit Pointer Register +AT91C_US0_RCR EQU (0xFFFC0104) ;- (PDC_US0) Receive Counter Register +AT91C_US0_RPR EQU (0xFFFC0100) ;- (PDC_US0) Receive Pointer Register +AT91C_US0_RNCR EQU (0xFFFC0114) ;- (PDC_US0) Receive Next Counter Register +// - ========== Register definition for US0 peripheral ========== +AT91C_US0_BRGR EQU (0xFFFC0020) ;- (US0) Baud Rate Generator Register +AT91C_US0_NER EQU (0xFFFC0044) ;- (US0) Nb Errors Register +AT91C_US0_CR EQU (0xFFFC0000) ;- (US0) Control Register +AT91C_US0_IMR EQU (0xFFFC0010) ;- (US0) Interrupt Mask Register +AT91C_US0_FIDI EQU (0xFFFC0040) ;- (US0) FI_DI_Ratio Register +AT91C_US0_TTGR EQU (0xFFFC0028) ;- (US0) Transmitter Time-guard Register +AT91C_US0_MR EQU (0xFFFC0004) ;- (US0) Mode Register +AT91C_US0_RTOR EQU (0xFFFC0024) ;- (US0) Receiver Time-out Register +AT91C_US0_CSR EQU (0xFFFC0014) ;- (US0) Channel Status Register +AT91C_US0_RHR EQU (0xFFFC0018) ;- (US0) Receiver Holding Register +AT91C_US0_IDR EQU (0xFFFC000C) ;- (US0) Interrupt Disable Register +AT91C_US0_THR EQU (0xFFFC001C) ;- (US0) Transmitter Holding Register +AT91C_US0_IF EQU (0xFFFC004C) ;- (US0) IRDA_FILTER Register +AT91C_US0_IER EQU (0xFFFC0008) ;- (US0) Interrupt Enable Register +// - ========== Register definition for PDC_SSC peripheral ========== +AT91C_SSC_TNCR EQU (0xFFFD411C) ;- (PDC_SSC) Transmit Next Counter Register +AT91C_SSC_RPR EQU (0xFFFD4100) ;- (PDC_SSC) Receive Pointer Register +AT91C_SSC_RNCR EQU (0xFFFD4114) ;- (PDC_SSC) Receive Next Counter Register +AT91C_SSC_TPR EQU (0xFFFD4108) ;- (PDC_SSC) Transmit Pointer Register +AT91C_SSC_PTCR EQU (0xFFFD4120) ;- (PDC_SSC) PDC Transfer Control Register +AT91C_SSC_TCR EQU (0xFFFD410C) ;- (PDC_SSC) Transmit Counter Register +AT91C_SSC_RCR EQU (0xFFFD4104) ;- (PDC_SSC) Receive Counter Register +AT91C_SSC_RNPR EQU (0xFFFD4110) ;- (PDC_SSC) Receive Next Pointer Register +AT91C_SSC_TNPR EQU (0xFFFD4118) ;- (PDC_SSC) Transmit Next Pointer Register +AT91C_SSC_PTSR EQU (0xFFFD4124) ;- (PDC_SSC) PDC Transfer Status Register +// - ========== Register definition for SSC peripheral ========== +AT91C_SSC_RHR EQU (0xFFFD4020) ;- (SSC) Receive Holding Register +AT91C_SSC_RSHR EQU (0xFFFD4030) ;- (SSC) Receive Sync Holding Register +AT91C_SSC_TFMR EQU (0xFFFD401C) ;- (SSC) Transmit Frame Mode Register +AT91C_SSC_IDR EQU (0xFFFD4048) ;- (SSC) Interrupt Disable Register +AT91C_SSC_THR EQU (0xFFFD4024) ;- (SSC) Transmit Holding Register +AT91C_SSC_RCMR EQU (0xFFFD4010) ;- (SSC) Receive Clock ModeRegister +AT91C_SSC_IER EQU (0xFFFD4044) ;- (SSC) Interrupt Enable Register +AT91C_SSC_TSHR EQU (0xFFFD4034) ;- (SSC) Transmit Sync Holding Register +AT91C_SSC_SR EQU (0xFFFD4040) ;- (SSC) Status Register +AT91C_SSC_CMR EQU (0xFFFD4004) ;- (SSC) Clock Mode Register +AT91C_SSC_TCMR EQU (0xFFFD4018) ;- (SSC) Transmit Clock Mode Register +AT91C_SSC_CR EQU (0xFFFD4000) ;- (SSC) Control Register +AT91C_SSC_IMR EQU (0xFFFD404C) ;- (SSC) Interrupt Mask Register +AT91C_SSC_RFMR EQU (0xFFFD4014) ;- (SSC) Receive Frame Mode Register +// - ========== Register definition for TWI peripheral ========== +AT91C_TWI_IER EQU (0xFFFB8024) ;- (TWI) Interrupt Enable Register +AT91C_TWI_CR EQU (0xFFFB8000) ;- (TWI) Control Register +AT91C_TWI_SR EQU (0xFFFB8020) ;- (TWI) Status Register +AT91C_TWI_IMR EQU (0xFFFB802C) ;- (TWI) Interrupt Mask Register +AT91C_TWI_THR EQU (0xFFFB8034) ;- (TWI) Transmit Holding Register +AT91C_TWI_IDR EQU (0xFFFB8028) ;- (TWI) Interrupt Disable Register +AT91C_TWI_IADR EQU (0xFFFB800C) ;- (TWI) Internal Address Register +AT91C_TWI_MMR EQU (0xFFFB8004) ;- (TWI) Master Mode Register +AT91C_TWI_CWGR EQU (0xFFFB8010) ;- (TWI) Clock Waveform Generator Register +AT91C_TWI_RHR EQU (0xFFFB8030) ;- (TWI) Receive Holding Register +// - ========== Register definition for PWMC_CH3 peripheral ========== +AT91C_PWMC_CH3_CUPDR EQU (0xFFFCC270) ;- (PWMC_CH3) Channel Update Register +AT91C_PWMC_CH3_Reserved EQU (0xFFFCC274) ;- (PWMC_CH3) Reserved +AT91C_PWMC_CH3_CPRDR EQU (0xFFFCC268) ;- (PWMC_CH3) Channel Period Register +AT91C_PWMC_CH3_CDTYR EQU (0xFFFCC264) ;- (PWMC_CH3) Channel Duty Cycle Register +AT91C_PWMC_CH3_CCNTR EQU (0xFFFCC26C) ;- (PWMC_CH3) Channel Counter Register +AT91C_PWMC_CH3_CMR EQU (0xFFFCC260) ;- (PWMC_CH3) Channel Mode Register +// - ========== Register definition for PWMC_CH2 peripheral ========== +AT91C_PWMC_CH2_Reserved EQU (0xFFFCC254) ;- (PWMC_CH2) Reserved +AT91C_PWMC_CH2_CMR EQU (0xFFFCC240) ;- (PWMC_CH2) Channel Mode Register +AT91C_PWMC_CH2_CCNTR EQU (0xFFFCC24C) ;- (PWMC_CH2) Channel Counter Register +AT91C_PWMC_CH2_CPRDR EQU (0xFFFCC248) ;- (PWMC_CH2) Channel Period Register +AT91C_PWMC_CH2_CUPDR EQU (0xFFFCC250) ;- (PWMC_CH2) Channel Update Register +AT91C_PWMC_CH2_CDTYR EQU (0xFFFCC244) ;- (PWMC_CH2) Channel Duty Cycle Register +// - ========== Register definition for PWMC_CH1 peripheral ========== +AT91C_PWMC_CH1_Reserved EQU (0xFFFCC234) ;- (PWMC_CH1) Reserved +AT91C_PWMC_CH1_CUPDR EQU (0xFFFCC230) ;- (PWMC_CH1) Channel Update Register +AT91C_PWMC_CH1_CPRDR EQU (0xFFFCC228) ;- (PWMC_CH1) Channel Period Register +AT91C_PWMC_CH1_CCNTR EQU (0xFFFCC22C) ;- (PWMC_CH1) Channel Counter Register +AT91C_PWMC_CH1_CDTYR EQU (0xFFFCC224) ;- (PWMC_CH1) Channel Duty Cycle Register +AT91C_PWMC_CH1_CMR EQU (0xFFFCC220) ;- (PWMC_CH1) Channel Mode Register +// - ========== Register definition for PWMC_CH0 peripheral ========== +AT91C_PWMC_CH0_Reserved EQU (0xFFFCC214) ;- (PWMC_CH0) Reserved +AT91C_PWMC_CH0_CPRDR EQU (0xFFFCC208) ;- (PWMC_CH0) Channel Period Register +AT91C_PWMC_CH0_CDTYR EQU (0xFFFCC204) ;- (PWMC_CH0) Channel Duty Cycle Register +AT91C_PWMC_CH0_CMR EQU (0xFFFCC200) ;- (PWMC_CH0) Channel Mode Register +AT91C_PWMC_CH0_CUPDR EQU (0xFFFCC210) ;- (PWMC_CH0) Channel Update Register +AT91C_PWMC_CH0_CCNTR EQU (0xFFFCC20C) ;- (PWMC_CH0) Channel Counter Register +// - ========== Register definition for PWMC peripheral ========== +AT91C_PWMC_IDR EQU (0xFFFCC014) ;- (PWMC) PWMC Interrupt Disable Register +AT91C_PWMC_DIS EQU (0xFFFCC008) ;- (PWMC) PWMC Disable Register +AT91C_PWMC_IER EQU (0xFFFCC010) ;- (PWMC) PWMC Interrupt Enable Register +AT91C_PWMC_VR EQU (0xFFFCC0FC) ;- (PWMC) PWMC Version Register +AT91C_PWMC_ISR EQU (0xFFFCC01C) ;- (PWMC) PWMC Interrupt Status Register +AT91C_PWMC_SR EQU (0xFFFCC00C) ;- (PWMC) PWMC Status Register +AT91C_PWMC_IMR EQU (0xFFFCC018) ;- (PWMC) PWMC Interrupt Mask Register +AT91C_PWMC_MR EQU (0xFFFCC000) ;- (PWMC) PWMC Mode Register +AT91C_PWMC_ENA EQU (0xFFFCC004) ;- (PWMC) PWMC Enable Register +// - ========== Register definition for UDP peripheral ========== +AT91C_UDP_IMR EQU (0xFFFB0018) ;- (UDP) Interrupt Mask Register +AT91C_UDP_FADDR EQU (0xFFFB0008) ;- (UDP) Function Address Register +AT91C_UDP_NUM EQU (0xFFFB0000) ;- (UDP) Frame Number Register +AT91C_UDP_FDR EQU (0xFFFB0050) ;- (UDP) Endpoint FIFO Data Register +AT91C_UDP_ISR EQU (0xFFFB001C) ;- (UDP) Interrupt Status Register +AT91C_UDP_CSR EQU (0xFFFB0030) ;- (UDP) Endpoint Control and Status Register +AT91C_UDP_IDR EQU (0xFFFB0014) ;- (UDP) Interrupt Disable Register +AT91C_UDP_ICR EQU (0xFFFB0020) ;- (UDP) Interrupt Clear Register +AT91C_UDP_RSTEP EQU (0xFFFB0028) ;- (UDP) Reset Endpoint Register +AT91C_UDP_TXVC EQU (0xFFFB0074) ;- (UDP) Transceiver Control Register +AT91C_UDP_GLBSTATE EQU (0xFFFB0004) ;- (UDP) Global State Register +AT91C_UDP_IER EQU (0xFFFB0010) ;- (UDP) Interrupt Enable Register +// - ========== Register definition for TC0 peripheral ========== +AT91C_TC0_SR EQU (0xFFFA0020) ;- (TC0) Status Register +AT91C_TC0_RC EQU (0xFFFA001C) ;- (TC0) Register C +AT91C_TC0_RB EQU (0xFFFA0018) ;- (TC0) Register B +AT91C_TC0_CCR EQU (0xFFFA0000) ;- (TC0) Channel Control Register +AT91C_TC0_CMR EQU (0xFFFA0004) ;- (TC0) Channel Mode Register (Capture Mode / Waveform Mode) +AT91C_TC0_IER EQU (0xFFFA0024) ;- (TC0) Interrupt Enable Register +AT91C_TC0_RA EQU (0xFFFA0014) ;- (TC0) Register A +AT91C_TC0_IDR EQU (0xFFFA0028) ;- (TC0) Interrupt Disable Register +AT91C_TC0_CV EQU (0xFFFA0010) ;- (TC0) Counter Value +AT91C_TC0_IMR EQU (0xFFFA002C) ;- (TC0) Interrupt Mask Register +// - ========== Register definition for TC1 peripheral ========== +AT91C_TC1_RB EQU (0xFFFA0058) ;- (TC1) Register B +AT91C_TC1_CCR EQU (0xFFFA0040) ;- (TC1) Channel Control Register +AT91C_TC1_IER EQU (0xFFFA0064) ;- (TC1) Interrupt Enable Register +AT91C_TC1_IDR EQU (0xFFFA0068) ;- (TC1) Interrupt Disable Register +AT91C_TC1_SR EQU (0xFFFA0060) ;- (TC1) Status Register +AT91C_TC1_CMR EQU (0xFFFA0044) ;- (TC1) Channel Mode Register (Capture Mode / Waveform Mode) +AT91C_TC1_RA EQU (0xFFFA0054) ;- (TC1) Register A +AT91C_TC1_RC EQU (0xFFFA005C) ;- (TC1) Register C +AT91C_TC1_IMR EQU (0xFFFA006C) ;- (TC1) Interrupt Mask Register +AT91C_TC1_CV EQU (0xFFFA0050) ;- (TC1) Counter Value +// - ========== Register definition for TC2 peripheral ========== +AT91C_TC2_CMR EQU (0xFFFA0084) ;- (TC2) Channel Mode Register (Capture Mode / Waveform Mode) +AT91C_TC2_CCR EQU (0xFFFA0080) ;- (TC2) Channel Control Register +AT91C_TC2_CV EQU (0xFFFA0090) ;- (TC2) Counter Value +AT91C_TC2_RA EQU (0xFFFA0094) ;- (TC2) Register A +AT91C_TC2_RB EQU (0xFFFA0098) ;- (TC2) Register B +AT91C_TC2_IDR EQU (0xFFFA00A8) ;- (TC2) Interrupt Disable Register +AT91C_TC2_IMR EQU (0xFFFA00AC) ;- (TC2) Interrupt Mask Register +AT91C_TC2_RC EQU (0xFFFA009C) ;- (TC2) Register C +AT91C_TC2_IER EQU (0xFFFA00A4) ;- (TC2) Interrupt Enable Register +AT91C_TC2_SR EQU (0xFFFA00A0) ;- (TC2) Status Register +// - ========== Register definition for TCB peripheral ========== +AT91C_TCB_BMR EQU (0xFFFA00C4) ;- (TCB) TC Block Mode Register +AT91C_TCB_BCR EQU (0xFFFA00C0) ;- (TCB) TC Block Control Register +// - ========== Register definition for CAN_MB0 peripheral ========== +AT91C_CAN_MB0_MDL EQU (0xFFFD0214) ;- (CAN_MB0) MailBox Data Low Register +AT91C_CAN_MB0_MAM EQU (0xFFFD0204) ;- (CAN_MB0) MailBox Acceptance Mask Register +AT91C_CAN_MB0_MCR EQU (0xFFFD021C) ;- (CAN_MB0) MailBox Control Register +AT91C_CAN_MB0_MID EQU (0xFFFD0208) ;- (CAN_MB0) MailBox ID Register +AT91C_CAN_MB0_MSR EQU (0xFFFD0210) ;- (CAN_MB0) MailBox Status Register +AT91C_CAN_MB0_MFID EQU (0xFFFD020C) ;- (CAN_MB0) MailBox Family ID Register +AT91C_CAN_MB0_MDH EQU (0xFFFD0218) ;- (CAN_MB0) MailBox Data High Register +AT91C_CAN_MB0_MMR EQU (0xFFFD0200) ;- (CAN_MB0) MailBox Mode Register +// - ========== Register definition for CAN_MB1 peripheral ========== +AT91C_CAN_MB1_MDL EQU (0xFFFD0234) ;- (CAN_MB1) MailBox Data Low Register +AT91C_CAN_MB1_MID EQU (0xFFFD0228) ;- (CAN_MB1) MailBox ID Register +AT91C_CAN_MB1_MMR EQU (0xFFFD0220) ;- (CAN_MB1) MailBox Mode Register +AT91C_CAN_MB1_MSR EQU (0xFFFD0230) ;- (CAN_MB1) MailBox Status Register +AT91C_CAN_MB1_MAM EQU (0xFFFD0224) ;- (CAN_MB1) MailBox Acceptance Mask Register +AT91C_CAN_MB1_MDH EQU (0xFFFD0238) ;- (CAN_MB1) MailBox Data High Register +AT91C_CAN_MB1_MCR EQU (0xFFFD023C) ;- (CAN_MB1) MailBox Control Register +AT91C_CAN_MB1_MFID EQU (0xFFFD022C) ;- (CAN_MB1) MailBox Family ID Register +// - ========== Register definition for CAN_MB2 peripheral ========== +AT91C_CAN_MB2_MCR EQU (0xFFFD025C) ;- (CAN_MB2) MailBox Control Register +AT91C_CAN_MB2_MDH EQU (0xFFFD0258) ;- (CAN_MB2) MailBox Data High Register +AT91C_CAN_MB2_MID EQU (0xFFFD0248) ;- (CAN_MB2) MailBox ID Register +AT91C_CAN_MB2_MDL EQU (0xFFFD0254) ;- (CAN_MB2) MailBox Data Low Register +AT91C_CAN_MB2_MMR EQU (0xFFFD0240) ;- (CAN_MB2) MailBox Mode Register +AT91C_CAN_MB2_MAM EQU (0xFFFD0244) ;- (CAN_MB2) MailBox Acceptance Mask Register +AT91C_CAN_MB2_MFID EQU (0xFFFD024C) ;- (CAN_MB2) MailBox Family ID Register +AT91C_CAN_MB2_MSR EQU (0xFFFD0250) ;- (CAN_MB2) MailBox Status Register +// - ========== Register definition for CAN_MB3 peripheral ========== +AT91C_CAN_MB3_MFID EQU (0xFFFD026C) ;- (CAN_MB3) MailBox Family ID Register +AT91C_CAN_MB3_MAM EQU (0xFFFD0264) ;- (CAN_MB3) MailBox Acceptance Mask Register +AT91C_CAN_MB3_MID EQU (0xFFFD0268) ;- (CAN_MB3) MailBox ID Register +AT91C_CAN_MB3_MCR EQU (0xFFFD027C) ;- (CAN_MB3) MailBox Control Register +AT91C_CAN_MB3_MMR EQU (0xFFFD0260) ;- (CAN_MB3) MailBox Mode Register +AT91C_CAN_MB3_MSR EQU (0xFFFD0270) ;- (CAN_MB3) MailBox Status Register +AT91C_CAN_MB3_MDL EQU (0xFFFD0274) ;- (CAN_MB3) MailBox Data Low Register +AT91C_CAN_MB3_MDH EQU (0xFFFD0278) ;- (CAN_MB3) MailBox Data High Register +// - ========== Register definition for CAN_MB4 peripheral ========== +AT91C_CAN_MB4_MID EQU (0xFFFD0288) ;- (CAN_MB4) MailBox ID Register +AT91C_CAN_MB4_MMR EQU (0xFFFD0280) ;- (CAN_MB4) MailBox Mode Register +AT91C_CAN_MB4_MDH EQU (0xFFFD0298) ;- (CAN_MB4) MailBox Data High Register +AT91C_CAN_MB4_MFID EQU (0xFFFD028C) ;- (CAN_MB4) MailBox Family ID Register +AT91C_CAN_MB4_MSR EQU (0xFFFD0290) ;- (CAN_MB4) MailBox Status Register +AT91C_CAN_MB4_MCR EQU (0xFFFD029C) ;- (CAN_MB4) MailBox Control Register +AT91C_CAN_MB4_MDL EQU (0xFFFD0294) ;- (CAN_MB4) MailBox Data Low Register +AT91C_CAN_MB4_MAM EQU (0xFFFD0284) ;- (CAN_MB4) MailBox Acceptance Mask Register +// - ========== Register definition for CAN_MB5 peripheral ========== +AT91C_CAN_MB5_MSR EQU (0xFFFD02B0) ;- (CAN_MB5) MailBox Status Register +AT91C_CAN_MB5_MCR EQU (0xFFFD02BC) ;- (CAN_MB5) MailBox Control Register +AT91C_CAN_MB5_MFID EQU (0xFFFD02AC) ;- (CAN_MB5) MailBox Family ID Register +AT91C_CAN_MB5_MDH EQU (0xFFFD02B8) ;- (CAN_MB5) MailBox Data High Register +AT91C_CAN_MB5_MID EQU (0xFFFD02A8) ;- (CAN_MB5) MailBox ID Register +AT91C_CAN_MB5_MMR EQU (0xFFFD02A0) ;- (CAN_MB5) MailBox Mode Register +AT91C_CAN_MB5_MDL EQU (0xFFFD02B4) ;- (CAN_MB5) MailBox Data Low Register +AT91C_CAN_MB5_MAM EQU (0xFFFD02A4) ;- (CAN_MB5) MailBox Acceptance Mask Register +// - ========== Register definition for CAN_MB6 peripheral ========== +AT91C_CAN_MB6_MFID EQU (0xFFFD02CC) ;- (CAN_MB6) MailBox Family ID Register +AT91C_CAN_MB6_MID EQU (0xFFFD02C8) ;- (CAN_MB6) MailBox ID Register +AT91C_CAN_MB6_MAM EQU (0xFFFD02C4) ;- (CAN_MB6) MailBox Acceptance Mask Register +AT91C_CAN_MB6_MSR EQU (0xFFFD02D0) ;- (CAN_MB6) MailBox Status Register +AT91C_CAN_MB6_MDL EQU (0xFFFD02D4) ;- (CAN_MB6) MailBox Data Low Register +AT91C_CAN_MB6_MCR EQU (0xFFFD02DC) ;- (CAN_MB6) MailBox Control Register +AT91C_CAN_MB6_MDH EQU (0xFFFD02D8) ;- (CAN_MB6) MailBox Data High Register +AT91C_CAN_MB6_MMR EQU (0xFFFD02C0) ;- (CAN_MB6) MailBox Mode Register +// - ========== Register definition for CAN_MB7 peripheral ========== +AT91C_CAN_MB7_MCR EQU (0xFFFD02FC) ;- (CAN_MB7) MailBox Control Register +AT91C_CAN_MB7_MDH EQU (0xFFFD02F8) ;- (CAN_MB7) MailBox Data High Register +AT91C_CAN_MB7_MFID EQU (0xFFFD02EC) ;- (CAN_MB7) MailBox Family ID Register +AT91C_CAN_MB7_MDL EQU (0xFFFD02F4) ;- (CAN_MB7) MailBox Data Low Register +AT91C_CAN_MB7_MID EQU (0xFFFD02E8) ;- (CAN_MB7) MailBox ID Register +AT91C_CAN_MB7_MMR EQU (0xFFFD02E0) ;- (CAN_MB7) MailBox Mode Register +AT91C_CAN_MB7_MAM EQU (0xFFFD02E4) ;- (CAN_MB7) MailBox Acceptance Mask Register +AT91C_CAN_MB7_MSR EQU (0xFFFD02F0) ;- (CAN_MB7) MailBox Status Register +// - ========== Register definition for CAN peripheral ========== +AT91C_CAN_TCR EQU (0xFFFD0024) ;- (CAN) Transfer Command Register +AT91C_CAN_IMR EQU (0xFFFD000C) ;- (CAN) Interrupt Mask Register +AT91C_CAN_IER EQU (0xFFFD0004) ;- (CAN) Interrupt Enable Register +AT91C_CAN_ECR EQU (0xFFFD0020) ;- (CAN) Error Counter Register +AT91C_CAN_TIMESTP EQU (0xFFFD001C) ;- (CAN) Time Stamp Register +AT91C_CAN_MR EQU (0xFFFD0000) ;- (CAN) Mode Register +AT91C_CAN_IDR EQU (0xFFFD0008) ;- (CAN) Interrupt Disable Register +AT91C_CAN_ACR EQU (0xFFFD0028) ;- (CAN) Abort Command Register +AT91C_CAN_TIM EQU (0xFFFD0018) ;- (CAN) Timer Register +AT91C_CAN_SR EQU (0xFFFD0010) ;- (CAN) Status Register +AT91C_CAN_BR EQU (0xFFFD0014) ;- (CAN) Baudrate Register +AT91C_CAN_VR EQU (0xFFFD00FC) ;- (CAN) Version Register +// - ========== Register definition for EMAC peripheral ========== +AT91C_EMAC_ISR EQU (0xFFFDC024) ;- (EMAC) Interrupt Status Register +AT91C_EMAC_SA4H EQU (0xFFFDC0B4) ;- (EMAC) Specific Address 4 Top, Last 2 bytes +AT91C_EMAC_SA1L EQU (0xFFFDC098) ;- (EMAC) Specific Address 1 Bottom, First 4 bytes +AT91C_EMAC_ELE EQU (0xFFFDC078) ;- (EMAC) Excessive Length Errors Register +AT91C_EMAC_LCOL EQU (0xFFFDC05C) ;- (EMAC) Late Collision Register +AT91C_EMAC_RLE EQU (0xFFFDC088) ;- (EMAC) Receive Length Field Mismatch Register +AT91C_EMAC_WOL EQU (0xFFFDC0C4) ;- (EMAC) Wake On LAN Register +AT91C_EMAC_DTF EQU (0xFFFDC058) ;- (EMAC) Deferred Transmission Frame Register +AT91C_EMAC_TUND EQU (0xFFFDC064) ;- (EMAC) Transmit Underrun Error Register +AT91C_EMAC_NCR EQU (0xFFFDC000) ;- (EMAC) Network Control Register +AT91C_EMAC_SA4L EQU (0xFFFDC0B0) ;- (EMAC) Specific Address 4 Bottom, First 4 bytes +AT91C_EMAC_RSR EQU (0xFFFDC020) ;- (EMAC) Receive Status Register +AT91C_EMAC_SA3L EQU (0xFFFDC0A8) ;- (EMAC) Specific Address 3 Bottom, First 4 bytes +AT91C_EMAC_TSR EQU (0xFFFDC014) ;- (EMAC) Transmit Status Register +AT91C_EMAC_IDR EQU (0xFFFDC02C) ;- (EMAC) Interrupt Disable Register +AT91C_EMAC_RSE EQU (0xFFFDC074) ;- (EMAC) Receive Symbol Errors Register +AT91C_EMAC_ECOL EQU (0xFFFDC060) ;- (EMAC) Excessive Collision Register +AT91C_EMAC_TID EQU (0xFFFDC0B8) ;- (EMAC) Type ID Checking Register +AT91C_EMAC_HRB EQU (0xFFFDC090) ;- (EMAC) Hash Address Bottom[31:0] +AT91C_EMAC_TBQP EQU (0xFFFDC01C) ;- (EMAC) Transmit Buffer Queue Pointer +AT91C_EMAC_USRIO EQU (0xFFFDC0C0) ;- (EMAC) USER Input/Output Register +AT91C_EMAC_PTR EQU (0xFFFDC038) ;- (EMAC) Pause Time Register +AT91C_EMAC_SA2H EQU (0xFFFDC0A4) ;- (EMAC) Specific Address 2 Top, Last 2 bytes +AT91C_EMAC_ROV EQU (0xFFFDC070) ;- (EMAC) Receive Overrun Errors Register +AT91C_EMAC_ALE EQU (0xFFFDC054) ;- (EMAC) Alignment Error Register +AT91C_EMAC_RJA EQU (0xFFFDC07C) ;- (EMAC) Receive Jabbers Register +AT91C_EMAC_RBQP EQU (0xFFFDC018) ;- (EMAC) Receive Buffer Queue Pointer +AT91C_EMAC_TPF EQU (0xFFFDC08C) ;- (EMAC) Transmitted Pause Frames Register +AT91C_EMAC_NCFGR EQU (0xFFFDC004) ;- (EMAC) Network Configuration Register +AT91C_EMAC_HRT EQU (0xFFFDC094) ;- (EMAC) Hash Address Top[63:32] +AT91C_EMAC_USF EQU (0xFFFDC080) ;- (EMAC) Undersize Frames Register +AT91C_EMAC_FCSE EQU (0xFFFDC050) ;- (EMAC) Frame Check Sequence Error Register +AT91C_EMAC_TPQ EQU (0xFFFDC0BC) ;- (EMAC) Transmit Pause Quantum Register +AT91C_EMAC_MAN EQU (0xFFFDC034) ;- (EMAC) PHY Maintenance Register +AT91C_EMAC_FTO EQU (0xFFFDC040) ;- (EMAC) Frames Transmitted OK Register +AT91C_EMAC_REV EQU (0xFFFDC0FC) ;- (EMAC) Revision Register +AT91C_EMAC_IMR EQU (0xFFFDC030) ;- (EMAC) Interrupt Mask Register +AT91C_EMAC_SCF EQU (0xFFFDC044) ;- (EMAC) Single Collision Frame Register +AT91C_EMAC_PFR EQU (0xFFFDC03C) ;- (EMAC) Pause Frames received Register +AT91C_EMAC_MCF EQU (0xFFFDC048) ;- (EMAC) Multiple Collision Frame Register +AT91C_EMAC_NSR EQU (0xFFFDC008) ;- (EMAC) Network Status Register +AT91C_EMAC_SA2L EQU (0xFFFDC0A0) ;- (EMAC) Specific Address 2 Bottom, First 4 bytes +AT91C_EMAC_FRO EQU (0xFFFDC04C) ;- (EMAC) Frames Received OK Register +AT91C_EMAC_IER EQU (0xFFFDC028) ;- (EMAC) Interrupt Enable Register +AT91C_EMAC_SA1H EQU (0xFFFDC09C) ;- (EMAC) Specific Address 1 Top, Last 2 bytes +AT91C_EMAC_CSE EQU (0xFFFDC068) ;- (EMAC) Carrier Sense Error Register +AT91C_EMAC_SA3H EQU (0xFFFDC0AC) ;- (EMAC) Specific Address 3 Top, Last 2 bytes +AT91C_EMAC_RRE EQU (0xFFFDC06C) ;- (EMAC) Receive Ressource Error Register +AT91C_EMAC_STE EQU (0xFFFDC084) ;- (EMAC) SQE Test Error Register +// - ========== Register definition for PDC_ADC peripheral ========== +AT91C_ADC_PTSR EQU (0xFFFD8124) ;- (PDC_ADC) PDC Transfer Status Register +AT91C_ADC_PTCR EQU (0xFFFD8120) ;- (PDC_ADC) PDC Transfer Control Register +AT91C_ADC_TNPR EQU (0xFFFD8118) ;- (PDC_ADC) Transmit Next Pointer Register +AT91C_ADC_TNCR EQU (0xFFFD811C) ;- (PDC_ADC) Transmit Next Counter Register +AT91C_ADC_RNPR EQU (0xFFFD8110) ;- (PDC_ADC) Receive Next Pointer Register +AT91C_ADC_RNCR EQU (0xFFFD8114) ;- (PDC_ADC) Receive Next Counter Register +AT91C_ADC_RPR EQU (0xFFFD8100) ;- (PDC_ADC) Receive Pointer Register +AT91C_ADC_TCR EQU (0xFFFD810C) ;- (PDC_ADC) Transmit Counter Register +AT91C_ADC_TPR EQU (0xFFFD8108) ;- (PDC_ADC) Transmit Pointer Register +AT91C_ADC_RCR EQU (0xFFFD8104) ;- (PDC_ADC) Receive Counter Register +// - ========== Register definition for ADC peripheral ========== +AT91C_ADC_CDR2 EQU (0xFFFD8038) ;- (ADC) ADC Channel Data Register 2 +AT91C_ADC_CDR3 EQU (0xFFFD803C) ;- (ADC) ADC Channel Data Register 3 +AT91C_ADC_CDR0 EQU (0xFFFD8030) ;- (ADC) ADC Channel Data Register 0 +AT91C_ADC_CDR5 EQU (0xFFFD8044) ;- (ADC) ADC Channel Data Register 5 +AT91C_ADC_CHDR EQU (0xFFFD8014) ;- (ADC) ADC Channel Disable Register +AT91C_ADC_SR EQU (0xFFFD801C) ;- (ADC) ADC Status Register +AT91C_ADC_CDR4 EQU (0xFFFD8040) ;- (ADC) ADC Channel Data Register 4 +AT91C_ADC_CDR1 EQU (0xFFFD8034) ;- (ADC) ADC Channel Data Register 1 +AT91C_ADC_LCDR EQU (0xFFFD8020) ;- (ADC) ADC Last Converted Data Register +AT91C_ADC_IDR EQU (0xFFFD8028) ;- (ADC) ADC Interrupt Disable Register +AT91C_ADC_CR EQU (0xFFFD8000) ;- (ADC) ADC Control Register +AT91C_ADC_CDR7 EQU (0xFFFD804C) ;- (ADC) ADC Channel Data Register 7 +AT91C_ADC_CDR6 EQU (0xFFFD8048) ;- (ADC) ADC Channel Data Register 6 +AT91C_ADC_IER EQU (0xFFFD8024) ;- (ADC) ADC Interrupt Enable Register +AT91C_ADC_CHER EQU (0xFFFD8010) ;- (ADC) ADC Channel Enable Register +AT91C_ADC_CHSR EQU (0xFFFD8018) ;- (ADC) ADC Channel Status Register +AT91C_ADC_MR EQU (0xFFFD8004) ;- (ADC) ADC Mode Register +AT91C_ADC_IMR EQU (0xFFFD802C) ;- (ADC) ADC Interrupt Mask Register + +// - ***************************************************************************** +// - PIO DEFINITIONS FOR AT91SAM7X256 +// - ***************************************************************************** +AT91C_PIO_PA0 EQU (1 << 0) ;- Pin Controlled by PA0 +AT91C_PA0_RXD0 EQU (AT91C_PIO_PA0) ;- USART 0 Receive Data +AT91C_PIO_PA1 EQU (1 << 1) ;- Pin Controlled by PA1 +AT91C_PA1_TXD0 EQU (AT91C_PIO_PA1) ;- USART 0 Transmit Data +AT91C_PIO_PA10 EQU (1 << 10) ;- Pin Controlled by PA10 +AT91C_PA10_TWD EQU (AT91C_PIO_PA10) ;- TWI Two-wire Serial Data +AT91C_PIO_PA11 EQU (1 << 11) ;- Pin Controlled by PA11 +AT91C_PA11_TWCK EQU (AT91C_PIO_PA11) ;- TWI Two-wire Serial Clock +AT91C_PIO_PA12 EQU (1 << 12) ;- Pin Controlled by PA12 +AT91C_PA12_SPI0_NPCS0 EQU (AT91C_PIO_PA12) ;- SPI 0 Peripheral Chip Select 0 +AT91C_PIO_PA13 EQU (1 << 13) ;- Pin Controlled by PA13 +AT91C_PA13_SPI0_NPCS1 EQU (AT91C_PIO_PA13) ;- SPI 0 Peripheral Chip Select 1 +AT91C_PA13_PCK1 EQU (AT91C_PIO_PA13) ;- PMC Programmable Clock Output 1 +AT91C_PIO_PA14 EQU (1 << 14) ;- Pin Controlled by PA14 +AT91C_PA14_SPI0_NPCS2 EQU (AT91C_PIO_PA14) ;- SPI 0 Peripheral Chip Select 2 +AT91C_PA14_IRQ1 EQU (AT91C_PIO_PA14) ;- External Interrupt 1 +AT91C_PIO_PA15 EQU (1 << 15) ;- Pin Controlled by PA15 +AT91C_PA15_SPI0_NPCS3 EQU (AT91C_PIO_PA15) ;- SPI 0 Peripheral Chip Select 3 +AT91C_PA15_TCLK2 EQU (AT91C_PIO_PA15) ;- Timer Counter 2 external clock input +AT91C_PIO_PA16 EQU (1 << 16) ;- Pin Controlled by PA16 +AT91C_PA16_SPI0_MISO EQU (AT91C_PIO_PA16) ;- SPI 0 Master In Slave +AT91C_PIO_PA17 EQU (1 << 17) ;- Pin Controlled by PA17 +AT91C_PA17_SPI0_MOSI EQU (AT91C_PIO_PA17) ;- SPI 0 Master Out Slave +AT91C_PIO_PA18 EQU (1 << 18) ;- Pin Controlled by PA18 +AT91C_PA18_SPI0_SPCK EQU (AT91C_PIO_PA18) ;- SPI 0 Serial Clock +AT91C_PIO_PA19 EQU (1 << 19) ;- Pin Controlled by PA19 +AT91C_PA19_CANRX EQU (AT91C_PIO_PA19) ;- CAN Receive +AT91C_PIO_PA2 EQU (1 << 2) ;- Pin Controlled by PA2 +AT91C_PA2_SCK0 EQU (AT91C_PIO_PA2) ;- USART 0 Serial Clock +AT91C_PA2_SPI1_NPCS1 EQU (AT91C_PIO_PA2) ;- SPI 1 Peripheral Chip Select 1 +AT91C_PIO_PA20 EQU (1 << 20) ;- Pin Controlled by PA20 +AT91C_PA20_CANTX EQU (AT91C_PIO_PA20) ;- CAN Transmit +AT91C_PIO_PA21 EQU (1 << 21) ;- Pin Controlled by PA21 +AT91C_PA21_TF EQU (AT91C_PIO_PA21) ;- SSC Transmit Frame Sync +AT91C_PA21_SPI1_NPCS0 EQU (AT91C_PIO_PA21) ;- SPI 1 Peripheral Chip Select 0 +AT91C_PIO_PA22 EQU (1 << 22) ;- Pin Controlled by PA22 +AT91C_PA22_TK EQU (AT91C_PIO_PA22) ;- SSC Transmit Clock +AT91C_PA22_SPI1_SPCK EQU (AT91C_PIO_PA22) ;- SPI 1 Serial Clock +AT91C_PIO_PA23 EQU (1 << 23) ;- Pin Controlled by PA23 +AT91C_PA23_TD EQU (AT91C_PIO_PA23) ;- SSC Transmit data +AT91C_PA23_SPI1_MOSI EQU (AT91C_PIO_PA23) ;- SPI 1 Master Out Slave +AT91C_PIO_PA24 EQU (1 << 24) ;- Pin Controlled by PA24 +AT91C_PA24_RD EQU (AT91C_PIO_PA24) ;- SSC Receive Data +AT91C_PA24_SPI1_MISO EQU (AT91C_PIO_PA24) ;- SPI 1 Master In Slave +AT91C_PIO_PA25 EQU (1 << 25) ;- Pin Controlled by PA25 +AT91C_PA25_RK EQU (AT91C_PIO_PA25) ;- SSC Receive Clock +AT91C_PA25_SPI1_NPCS1 EQU (AT91C_PIO_PA25) ;- SPI 1 Peripheral Chip Select 1 +AT91C_PIO_PA26 EQU (1 << 26) ;- Pin Controlled by PA26 +AT91C_PA26_RF EQU (AT91C_PIO_PA26) ;- SSC Receive Frame Sync +AT91C_PA26_SPI1_NPCS2 EQU (AT91C_PIO_PA26) ;- SPI 1 Peripheral Chip Select 2 +AT91C_PIO_PA27 EQU (1 << 27) ;- Pin Controlled by PA27 +AT91C_PA27_DRXD EQU (AT91C_PIO_PA27) ;- DBGU Debug Receive Data +AT91C_PA27_PCK3 EQU (AT91C_PIO_PA27) ;- PMC Programmable Clock Output 3 +AT91C_PIO_PA28 EQU (1 << 28) ;- Pin Controlled by PA28 +AT91C_PA28_DTXD EQU (AT91C_PIO_PA28) ;- DBGU Debug Transmit Data +AT91C_PIO_PA29 EQU (1 << 29) ;- Pin Controlled by PA29 +AT91C_PA29_FIQ EQU (AT91C_PIO_PA29) ;- AIC Fast Interrupt Input +AT91C_PA29_SPI1_NPCS3 EQU (AT91C_PIO_PA29) ;- SPI 1 Peripheral Chip Select 3 +AT91C_PIO_PA3 EQU (1 << 3) ;- Pin Controlled by PA3 +AT91C_PA3_RTS0 EQU (AT91C_PIO_PA3) ;- USART 0 Ready To Send +AT91C_PA3_SPI1_NPCS2 EQU (AT91C_PIO_PA3) ;- SPI 1 Peripheral Chip Select 2 +AT91C_PIO_PA30 EQU (1 << 30) ;- Pin Controlled by PA30 +AT91C_PA30_IRQ0 EQU (AT91C_PIO_PA30) ;- External Interrupt 0 +AT91C_PA30_PCK2 EQU (AT91C_PIO_PA30) ;- PMC Programmable Clock Output 2 +AT91C_PIO_PA4 EQU (1 << 4) ;- Pin Controlled by PA4 +AT91C_PA4_CTS0 EQU (AT91C_PIO_PA4) ;- USART 0 Clear To Send +AT91C_PA4_SPI1_NPCS3 EQU (AT91C_PIO_PA4) ;- SPI 1 Peripheral Chip Select 3 +AT91C_PIO_PA5 EQU (1 << 5) ;- Pin Controlled by PA5 +AT91C_PA5_RXD1 EQU (AT91C_PIO_PA5) ;- USART 1 Receive Data +AT91C_PIO_PA6 EQU (1 << 6) ;- Pin Controlled by PA6 +AT91C_PA6_TXD1 EQU (AT91C_PIO_PA6) ;- USART 1 Transmit Data +AT91C_PIO_PA7 EQU (1 << 7) ;- Pin Controlled by PA7 +AT91C_PA7_SCK1 EQU (AT91C_PIO_PA7) ;- USART 1 Serial Clock +AT91C_PA7_SPI0_NPCS1 EQU (AT91C_PIO_PA7) ;- SPI 0 Peripheral Chip Select 1 +AT91C_PIO_PA8 EQU (1 << 8) ;- Pin Controlled by PA8 +AT91C_PA8_RTS1 EQU (AT91C_PIO_PA8) ;- USART 1 Ready To Send +AT91C_PA8_SPI0_NPCS2 EQU (AT91C_PIO_PA8) ;- SPI 0 Peripheral Chip Select 2 +AT91C_PIO_PA9 EQU (1 << 9) ;- Pin Controlled by PA9 +AT91C_PA9_CTS1 EQU (AT91C_PIO_PA9) ;- USART 1 Clear To Send +AT91C_PA9_SPI0_NPCS3 EQU (AT91C_PIO_PA9) ;- SPI 0 Peripheral Chip Select 3 +AT91C_PIO_PB0 EQU (1 << 0) ;- Pin Controlled by PB0 +AT91C_PB0_ETXCK_EREFCK EQU (AT91C_PIO_PB0) ;- Ethernet MAC Transmit Clock/Reference Clock +AT91C_PB0_PCK0 EQU (AT91C_PIO_PB0) ;- PMC Programmable Clock Output 0 +AT91C_PIO_PB1 EQU (1 << 1) ;- Pin Controlled by PB1 +AT91C_PB1_ETXEN EQU (AT91C_PIO_PB1) ;- Ethernet MAC Transmit Enable +AT91C_PIO_PB10 EQU (1 << 10) ;- Pin Controlled by PB10 +AT91C_PB10_ETX2 EQU (AT91C_PIO_PB10) ;- Ethernet MAC Transmit Data 2 +AT91C_PB10_SPI1_NPCS1 EQU (AT91C_PIO_PB10) ;- SPI 1 Peripheral Chip Select 1 +AT91C_PIO_PB11 EQU (1 << 11) ;- Pin Controlled by PB11 +AT91C_PB11_ETX3 EQU (AT91C_PIO_PB11) ;- Ethernet MAC Transmit Data 3 +AT91C_PB11_SPI1_NPCS2 EQU (AT91C_PIO_PB11) ;- SPI 1 Peripheral Chip Select 2 +AT91C_PIO_PB12 EQU (1 << 12) ;- Pin Controlled by PB12 +AT91C_PB12_ETXER EQU (AT91C_PIO_PB12) ;- Ethernet MAC Transmikt Coding Error +AT91C_PB12_TCLK0 EQU (AT91C_PIO_PB12) ;- Timer Counter 0 external clock input +AT91C_PIO_PB13 EQU (1 << 13) ;- Pin Controlled by PB13 +AT91C_PB13_ERX2 EQU (AT91C_PIO_PB13) ;- Ethernet MAC Receive Data 2 +AT91C_PB13_SPI0_NPCS1 EQU (AT91C_PIO_PB13) ;- SPI 0 Peripheral Chip Select 1 +AT91C_PIO_PB14 EQU (1 << 14) ;- Pin Controlled by PB14 +AT91C_PB14_ERX3 EQU (AT91C_PIO_PB14) ;- Ethernet MAC Receive Data 3 +AT91C_PB14_SPI0_NPCS2 EQU (AT91C_PIO_PB14) ;- SPI 0 Peripheral Chip Select 2 +AT91C_PIO_PB15 EQU (1 << 15) ;- Pin Controlled by PB15 +AT91C_PB15_ERXDV_ECRSDV EQU (AT91C_PIO_PB15) ;- Ethernet MAC Receive Data Valid +AT91C_PIO_PB16 EQU (1 << 16) ;- Pin Controlled by PB16 +AT91C_PB16_ECOL EQU (AT91C_PIO_PB16) ;- Ethernet MAC Collision Detected +AT91C_PB16_SPI1_NPCS3 EQU (AT91C_PIO_PB16) ;- SPI 1 Peripheral Chip Select 3 +AT91C_PIO_PB17 EQU (1 << 17) ;- Pin Controlled by PB17 +AT91C_PB17_ERXCK EQU (AT91C_PIO_PB17) ;- Ethernet MAC Receive Clock +AT91C_PB17_SPI0_NPCS3 EQU (AT91C_PIO_PB17) ;- SPI 0 Peripheral Chip Select 3 +AT91C_PIO_PB18 EQU (1 << 18) ;- Pin Controlled by PB18 +AT91C_PB18_EF100 EQU (AT91C_PIO_PB18) ;- Ethernet MAC Force 100 Mbits/sec +AT91C_PB18_ADTRG EQU (AT91C_PIO_PB18) ;- ADC External Trigger +AT91C_PIO_PB19 EQU (1 << 19) ;- Pin Controlled by PB19 +AT91C_PB19_PWM0 EQU (AT91C_PIO_PB19) ;- PWM Channel 0 +AT91C_PB19_TCLK1 EQU (AT91C_PIO_PB19) ;- Timer Counter 1 external clock input +AT91C_PIO_PB2 EQU (1 << 2) ;- Pin Controlled by PB2 +AT91C_PB2_ETX0 EQU (AT91C_PIO_PB2) ;- Ethernet MAC Transmit Data 0 +AT91C_PIO_PB20 EQU (1 << 20) ;- Pin Controlled by PB20 +AT91C_PB20_PWM1 EQU (AT91C_PIO_PB20) ;- PWM Channel 1 +AT91C_PB20_PCK0 EQU (AT91C_PIO_PB20) ;- PMC Programmable Clock Output 0 +AT91C_PIO_PB21 EQU (1 << 21) ;- Pin Controlled by PB21 +AT91C_PB21_PWM2 EQU (AT91C_PIO_PB21) ;- PWM Channel 2 +AT91C_PB21_PCK1 EQU (AT91C_PIO_PB21) ;- PMC Programmable Clock Output 1 +AT91C_PIO_PB22 EQU (1 << 22) ;- Pin Controlled by PB22 +AT91C_PB22_PWM3 EQU (AT91C_PIO_PB22) ;- PWM Channel 3 +AT91C_PB22_PCK2 EQU (AT91C_PIO_PB22) ;- PMC Programmable Clock Output 2 +AT91C_PIO_PB23 EQU (1 << 23) ;- Pin Controlled by PB23 +AT91C_PB23_TIOA0 EQU (AT91C_PIO_PB23) ;- Timer Counter 0 Multipurpose Timer I/O Pin A +AT91C_PB23_DCD1 EQU (AT91C_PIO_PB23) ;- USART 1 Data Carrier Detect +AT91C_PIO_PB24 EQU (1 << 24) ;- Pin Controlled by PB24 +AT91C_PB24_TIOB0 EQU (AT91C_PIO_PB24) ;- Timer Counter 0 Multipurpose Timer I/O Pin B +AT91C_PB24_DSR1 EQU (AT91C_PIO_PB24) ;- USART 1 Data Set ready +AT91C_PIO_PB25 EQU (1 << 25) ;- Pin Controlled by PB25 +AT91C_PB25_TIOA1 EQU (AT91C_PIO_PB25) ;- Timer Counter 1 Multipurpose Timer I/O Pin A +AT91C_PB25_DTR1 EQU (AT91C_PIO_PB25) ;- USART 1 Data Terminal ready +AT91C_PIO_PB26 EQU (1 << 26) ;- Pin Controlled by PB26 +AT91C_PB26_TIOB1 EQU (AT91C_PIO_PB26) ;- Timer Counter 1 Multipurpose Timer I/O Pin B +AT91C_PB26_RI1 EQU (AT91C_PIO_PB26) ;- USART 1 Ring Indicator +AT91C_PIO_PB27 EQU (1 << 27) ;- Pin Controlled by PB27 +AT91C_PB27_TIOA2 EQU (AT91C_PIO_PB27) ;- Timer Counter 2 Multipurpose Timer I/O Pin A +AT91C_PB27_PWM0 EQU (AT91C_PIO_PB27) ;- PWM Channel 0 +AT91C_PIO_PB28 EQU (1 << 28) ;- Pin Controlled by PB28 +AT91C_PB28_TIOB2 EQU (AT91C_PIO_PB28) ;- Timer Counter 2 Multipurpose Timer I/O Pin B +AT91C_PB28_PWM1 EQU (AT91C_PIO_PB28) ;- PWM Channel 1 +AT91C_PIO_PB29 EQU (1 << 29) ;- Pin Controlled by PB29 +AT91C_PB29_PCK1 EQU (AT91C_PIO_PB29) ;- PMC Programmable Clock Output 1 +AT91C_PB29_PWM2 EQU (AT91C_PIO_PB29) ;- PWM Channel 2 +AT91C_PIO_PB3 EQU (1 << 3) ;- Pin Controlled by PB3 +AT91C_PB3_ETX1 EQU (AT91C_PIO_PB3) ;- Ethernet MAC Transmit Data 1 +AT91C_PIO_PB30 EQU (1 << 30) ;- Pin Controlled by PB30 +AT91C_PB30_PCK2 EQU (AT91C_PIO_PB30) ;- PMC Programmable Clock Output 2 +AT91C_PB30_PWM3 EQU (AT91C_PIO_PB30) ;- PWM Channel 3 +AT91C_PIO_PB4 EQU (1 << 4) ;- Pin Controlled by PB4 +AT91C_PB4_ECRS EQU (AT91C_PIO_PB4) ;- Ethernet MAC Carrier Sense/Carrier Sense and Data Valid +AT91C_PIO_PB5 EQU (1 << 5) ;- Pin Controlled by PB5 +AT91C_PB5_ERX0 EQU (AT91C_PIO_PB5) ;- Ethernet MAC Receive Data 0 +AT91C_PIO_PB6 EQU (1 << 6) ;- Pin Controlled by PB6 +AT91C_PB6_ERX1 EQU (AT91C_PIO_PB6) ;- Ethernet MAC Receive Data 1 +AT91C_PIO_PB7 EQU (1 << 7) ;- Pin Controlled by PB7 +AT91C_PB7_ERXER EQU (AT91C_PIO_PB7) ;- Ethernet MAC Receive Error +AT91C_PIO_PB8 EQU (1 << 8) ;- Pin Controlled by PB8 +AT91C_PB8_EMDC EQU (AT91C_PIO_PB8) ;- Ethernet MAC Management Data Clock +AT91C_PIO_PB9 EQU (1 << 9) ;- Pin Controlled by PB9 +AT91C_PB9_EMDIO EQU (AT91C_PIO_PB9) ;- Ethernet MAC Management Data Input/Output + +// - ***************************************************************************** +// - PERIPHERAL ID DEFINITIONS FOR AT91SAM7X256 +// - ***************************************************************************** +AT91C_ID_FIQ EQU ( 0) ;- Advanced Interrupt Controller (FIQ) +AT91C_ID_SYS EQU ( 1) ;- System Peripheral +AT91C_ID_PIOA EQU ( 2) ;- Parallel IO Controller A +AT91C_ID_PIOB EQU ( 3) ;- Parallel IO Controller B +AT91C_ID_SPI0 EQU ( 4) ;- Serial Peripheral Interface 0 +AT91C_ID_SPI1 EQU ( 5) ;- Serial Peripheral Interface 1 +AT91C_ID_US0 EQU ( 6) ;- USART 0 +AT91C_ID_US1 EQU ( 7) ;- USART 1 +AT91C_ID_SSC EQU ( 8) ;- Serial Synchronous Controller +AT91C_ID_TWI EQU ( 9) ;- Two-Wire Interface +AT91C_ID_PWMC EQU (10) ;- PWM Controller +AT91C_ID_UDP EQU (11) ;- USB Device Port +AT91C_ID_TC0 EQU (12) ;- Timer Counter 0 +AT91C_ID_TC1 EQU (13) ;- Timer Counter 1 +AT91C_ID_TC2 EQU (14) ;- Timer Counter 2 +AT91C_ID_CAN EQU (15) ;- Control Area Network Controller +AT91C_ID_EMAC EQU (16) ;- Ethernet MAC +AT91C_ID_ADC EQU (17) ;- Analog-to-Digital Converter +AT91C_ID_18_Reserved EQU (18) ;- Reserved +AT91C_ID_19_Reserved EQU (19) ;- Reserved +AT91C_ID_20_Reserved EQU (20) ;- Reserved +AT91C_ID_21_Reserved EQU (21) ;- Reserved +AT91C_ID_22_Reserved EQU (22) ;- Reserved +AT91C_ID_23_Reserved EQU (23) ;- Reserved +AT91C_ID_24_Reserved EQU (24) ;- Reserved +AT91C_ID_25_Reserved EQU (25) ;- Reserved +AT91C_ID_26_Reserved EQU (26) ;- Reserved +AT91C_ID_27_Reserved EQU (27) ;- Reserved +AT91C_ID_28_Reserved EQU (28) ;- Reserved +AT91C_ID_29_Reserved EQU (29) ;- Reserved +AT91C_ID_IRQ0 EQU (30) ;- Advanced Interrupt Controller (IRQ0) +AT91C_ID_IRQ1 EQU (31) ;- Advanced Interrupt Controller (IRQ1) +AT91C_ALL_INT EQU (0xC003FFFF) ;- ALL VALID INTERRUPTS + +// - ***************************************************************************** +// - BASE ADDRESS DEFINITIONS FOR AT91SAM7X256 +// - ***************************************************************************** +AT91C_BASE_SYS EQU (0xFFFFF000) ;- (SYS) Base Address +AT91C_BASE_AIC EQU (0xFFFFF000) ;- (AIC) Base Address +AT91C_BASE_PDC_DBGU EQU (0xFFFFF300) ;- (PDC_DBGU) Base Address +AT91C_BASE_DBGU EQU (0xFFFFF200) ;- (DBGU) Base Address +AT91C_BASE_PIOA EQU (0xFFFFF400) ;- (PIOA) Base Address +AT91C_BASE_PIOB EQU (0xFFFFF600) ;- (PIOB) Base Address +AT91C_BASE_CKGR EQU (0xFFFFFC20) ;- (CKGR) Base Address +AT91C_BASE_PMC EQU (0xFFFFFC00) ;- (PMC) Base Address +AT91C_BASE_RSTC EQU (0xFFFFFD00) ;- (RSTC) Base Address +AT91C_BASE_RTTC EQU (0xFFFFFD20) ;- (RTTC) Base Address +AT91C_BASE_PITC EQU (0xFFFFFD30) ;- (PITC) Base Address +AT91C_BASE_WDTC EQU (0xFFFFFD40) ;- (WDTC) Base Address +AT91C_BASE_VREG EQU (0xFFFFFD60) ;- (VREG) Base Address +AT91C_BASE_MC EQU (0xFFFFFF00) ;- (MC) Base Address +AT91C_BASE_PDC_SPI1 EQU (0xFFFE4100) ;- (PDC_SPI1) Base Address +AT91C_BASE_SPI1 EQU (0xFFFE4000) ;- (SPI1) Base Address +AT91C_BASE_PDC_SPI0 EQU (0xFFFE0100) ;- (PDC_SPI0) Base Address +AT91C_BASE_SPI0 EQU (0xFFFE0000) ;- (SPI0) Base Address +AT91C_BASE_PDC_US1 EQU (0xFFFC4100) ;- (PDC_US1) Base Address +AT91C_BASE_US1 EQU (0xFFFC4000) ;- (US1) Base Address +AT91C_BASE_PDC_US0 EQU (0xFFFC0100) ;- (PDC_US0) Base Address +AT91C_BASE_US0 EQU (0xFFFC0000) ;- (US0) Base Address +AT91C_BASE_PDC_SSC EQU (0xFFFD4100) ;- (PDC_SSC) Base Address +AT91C_BASE_SSC EQU (0xFFFD4000) ;- (SSC) Base Address +AT91C_BASE_TWI EQU (0xFFFB8000) ;- (TWI) Base Address +AT91C_BASE_PWMC_CH3 EQU (0xFFFCC260) ;- (PWMC_CH3) Base Address +AT91C_BASE_PWMC_CH2 EQU (0xFFFCC240) ;- (PWMC_CH2) Base Address +AT91C_BASE_PWMC_CH1 EQU (0xFFFCC220) ;- (PWMC_CH1) Base Address +AT91C_BASE_PWMC_CH0 EQU (0xFFFCC200) ;- (PWMC_CH0) Base Address +AT91C_BASE_PWMC EQU (0xFFFCC000) ;- (PWMC) Base Address +AT91C_BASE_UDP EQU (0xFFFB0000) ;- (UDP) Base Address +AT91C_BASE_TC0 EQU (0xFFFA0000) ;- (TC0) Base Address +AT91C_BASE_TC1 EQU (0xFFFA0040) ;- (TC1) Base Address +AT91C_BASE_TC2 EQU (0xFFFA0080) ;- (TC2) Base Address +AT91C_BASE_TCB EQU (0xFFFA0000) ;- (TCB) Base Address +AT91C_BASE_CAN_MB0 EQU (0xFFFD0200) ;- (CAN_MB0) Base Address +AT91C_BASE_CAN_MB1 EQU (0xFFFD0220) ;- (CAN_MB1) Base Address +AT91C_BASE_CAN_MB2 EQU (0xFFFD0240) ;- (CAN_MB2) Base Address +AT91C_BASE_CAN_MB3 EQU (0xFFFD0260) ;- (CAN_MB3) Base Address +AT91C_BASE_CAN_MB4 EQU (0xFFFD0280) ;- (CAN_MB4) Base Address +AT91C_BASE_CAN_MB5 EQU (0xFFFD02A0) ;- (CAN_MB5) Base Address +AT91C_BASE_CAN_MB6 EQU (0xFFFD02C0) ;- (CAN_MB6) Base Address +AT91C_BASE_CAN_MB7 EQU (0xFFFD02E0) ;- (CAN_MB7) Base Address +AT91C_BASE_CAN EQU (0xFFFD0000) ;- (CAN) Base Address +AT91C_BASE_EMAC EQU (0xFFFDC000) ;- (EMAC) Base Address +AT91C_BASE_PDC_ADC EQU (0xFFFD8100) ;- (PDC_ADC) Base Address +AT91C_BASE_ADC EQU (0xFFFD8000) ;- (ADC) Base Address + +// - ***************************************************************************** +// - MEMORY MAPPING DEFINITIONS FOR AT91SAM7X256 +// - ***************************************************************************** +// - ISRAM +AT91C_ISRAM EQU (0x00200000) ;- Internal SRAM base address +AT91C_ISRAM_SIZE EQU (0x00010000) ;- Internal SRAM size in byte (64 Kbytes) +// - IFLASH +AT91C_IFLASH EQU (0x00100000) ;- Internal FLASH base address +AT91C_IFLASH_SIZE EQU (0x00040000) ;- Internal FLASH size in byte (256 Kbytes) +AT91C_IFLASH_PAGE_SIZE EQU (256) ;- Internal FLASH Page Size: 256 bytes +AT91C_IFLASH_LOCK_REGION_SIZE EQU (16384) ;- Internal FLASH Lock Region Size: 16 Kbytes +AT91C_IFLASH_NB_OF_PAGES EQU (1024) ;- Internal FLASH Number of Pages: 1024 bytes +AT91C_IFLASH_NB_OF_LOCK_BITS EQU (16) ;- Internal FLASH Number of Lock Bits: 16 bytes +#endif /* __IAR_SYSTEMS_ASM__ */ + + +#endif /* AT91SAM7X256_H */ diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/lib_AT91SAM7X256.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/lib_AT91SAM7X256.h new file mode 100644 index 0000000..95492d0 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/incIAR/lib_AT91SAM7X256.h @@ -0,0 +1,4211 @@ +//* ---------------------------------------------------------------------------- +//* ATMEL Microcontroller Software Support - ROUSSET - +//* ---------------------------------------------------------------------------- +//* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +//* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +//* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +//* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +//* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +//* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +//* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +//* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +//* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +//* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +//* ---------------------------------------------------------------------------- +//* File Name : lib_AT91SAM7X256.h +//* Object : AT91SAM7X256 inlined functions +//* Generated : AT91 SW Application Group 11/02/2005 (15:17:24) +//* +//* CVS Reference : /lib_dbgu.h/1.1/Thu Aug 25 12:56:22 2005// +//* CVS Reference : /lib_pmc_SAM7X.h/1.4/Tue Aug 30 13:00:36 2005// +//* CVS Reference : /lib_VREG_6085B.h/1.1/Tue Feb 1 16:20:47 2005// +//* CVS Reference : /lib_rstc_6098A.h/1.1/Wed Oct 6 10:39:20 2004// +//* CVS Reference : /lib_ssc.h/1.4/Fri Jan 31 12:19:20 2003// +//* CVS Reference : /lib_wdtc_6080A.h/1.1/Wed Oct 6 10:38:30 2004// +//* CVS Reference : /lib_usart.h/1.5/Thu Nov 21 16:01:54 2002// +//* CVS Reference : /lib_spi2.h/1.2/Tue Aug 23 15:37:28 2005// +//* CVS Reference : /lib_pitc_6079A.h/1.2/Tue Nov 9 14:43:56 2004// +//* CVS Reference : /lib_aic_6075b.h/1.2/Thu Jul 7 07:48:22 2005// +//* CVS Reference : /lib_twi.h/1.3/Mon Jul 19 14:27:58 2004// +//* CVS Reference : /lib_adc.h/1.6/Fri Oct 17 09:12:38 2003// +//* CVS Reference : /lib_rttc_6081A.h/1.1/Wed Oct 6 10:39:38 2004// +//* CVS Reference : /lib_udp.h/1.5/Tue Aug 30 12:13:47 2005// +//* CVS Reference : /lib_tc_1753b.h/1.1/Fri Jan 31 12:20:02 2003// +//* CVS Reference : /lib_MC_SAM7X.h/1.1/Thu Mar 25 15:19:14 2004// +//* CVS Reference : /lib_pio.h/1.3/Fri Jan 31 12:18:56 2003// +//* CVS Reference : /lib_can_AT91.h/1.5/Tue Aug 23 15:37:07 2005// +//* CVS Reference : /lib_PWM_SAM.h/1.3/Thu Jan 22 10:10:50 2004// +//* CVS Reference : /lib_pdc.h/1.2/Tue Jul 2 13:29:40 2002// +//* ---------------------------------------------------------------------------- + +#ifndef lib_AT91SAM7X256_H +#define lib_AT91SAM7X256_H + +/* ***************************************************************************** + SOFTWARE API FOR AIC + ***************************************************************************** */ +#define AT91C_AIC_BRANCH_OPCODE ((void (*) ()) 0xE51FFF20) // ldr, pc, [pc, #-&F20] + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_ConfigureIt +//* \brief Interrupt Handler Initialization +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_AIC_ConfigureIt ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id, // \arg interrupt number to initialize + unsigned int priority, // \arg priority to give to the interrupt + unsigned int src_type, // \arg activation and sense of activation + void (*newHandler) () ) // \arg address of the interrupt handler +{ + unsigned int oldHandler; + unsigned int mask ; + + oldHandler = pAic->AIC_SVR[irq_id]; + + mask = 0x1 << irq_id ; + //* Disable the interrupt on the interrupt controller + pAic->AIC_IDCR = mask ; + //* Save the interrupt handler routine pointer and the interrupt priority + pAic->AIC_SVR[irq_id] = (unsigned int) newHandler ; + //* Store the Source Mode Register + pAic->AIC_SMR[irq_id] = src_type | priority ; + //* Clear the interrupt on the interrupt controller + pAic->AIC_ICCR = mask ; + + return oldHandler; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_EnableIt +//* \brief Enable corresponding IT number +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_EnableIt ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id ) // \arg interrupt number to initialize +{ + //* Enable the interrupt on the interrupt controller + pAic->AIC_IECR = 0x1 << irq_id ; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_DisableIt +//* \brief Disable corresponding IT number +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_DisableIt ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id ) // \arg interrupt number to initialize +{ + unsigned int mask = 0x1 << irq_id; + //* Disable the interrupt on the interrupt controller + pAic->AIC_IDCR = mask ; + //* Clear the interrupt on the Interrupt Controller ( if one is pending ) + pAic->AIC_ICCR = mask ; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_ClearIt +//* \brief Clear corresponding IT number +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_ClearIt ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id) // \arg interrupt number to initialize +{ + //* Clear the interrupt on the Interrupt Controller ( if one is pending ) + pAic->AIC_ICCR = (0x1 << irq_id); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_AcknowledgeIt +//* \brief Acknowledge corresponding IT number +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_AcknowledgeIt ( + AT91PS_AIC pAic) // \arg pointer to the AIC registers +{ + pAic->AIC_EOICR = pAic->AIC_EOICR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_SetExceptionVector +//* \brief Configure vector handler +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_AIC_SetExceptionVector ( + unsigned int *pVector, // \arg pointer to the AIC registers + void (*Handler) () ) // \arg Interrupt Handler +{ + unsigned int oldVector = *pVector; + + if ((unsigned int) Handler == (unsigned int) AT91C_AIC_BRANCH_OPCODE) + *pVector = (unsigned int) AT91C_AIC_BRANCH_OPCODE; + else + *pVector = (((((unsigned int) Handler) - ((unsigned int) pVector) - 0x8) >> 2) & 0x00FFFFFF) | 0xEA000000; + + return oldVector; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_Trig +//* \brief Trig an IT +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_Trig ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id) // \arg interrupt number +{ + pAic->AIC_ISCR = (0x1 << irq_id) ; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_IsActive +//* \brief Test if an IT is active +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_AIC_IsActive ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id) // \arg Interrupt Number +{ + return (pAic->AIC_ISR & (0x1 << irq_id)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_IsPending +//* \brief Test if an IT is pending +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_AIC_IsPending ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id) // \arg Interrupt Number +{ + return (pAic->AIC_IPR & (0x1 << irq_id)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_Open +//* \brief Set exception vectors and AIC registers to default values +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_Open( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + void (*IrqHandler) (), // \arg Default IRQ vector exception + void (*FiqHandler) (), // \arg Default FIQ vector exception + void (*DefaultHandler) (), // \arg Default Handler set in ISR + void (*SpuriousHandler) (), // \arg Default Spurious Handler + unsigned int protectMode) // \arg Debug Control Register +{ + int i; + + // Disable all interrupts and set IVR to the default handler + for (i = 0; i < 32; ++i) { + AT91F_AIC_DisableIt(pAic, i); + AT91F_AIC_ConfigureIt(pAic, i, AT91C_AIC_PRIOR_LOWEST, AT91C_AIC_SRCTYPE_HIGH_LEVEL, DefaultHandler); + } + + // Set the IRQ exception vector + AT91F_AIC_SetExceptionVector((unsigned int *) 0x18, IrqHandler); + // Set the Fast Interrupt exception vector + AT91F_AIC_SetExceptionVector((unsigned int *) 0x1C, FiqHandler); + + pAic->AIC_SPU = (unsigned int) SpuriousHandler; + pAic->AIC_DCR = protectMode; +} +/* ***************************************************************************** + SOFTWARE API FOR PDC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_SetNextRx +//* \brief Set the next receive transfer descriptor +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_SetNextRx ( + AT91PS_PDC pPDC, // \arg pointer to a PDC controller + char *address, // \arg address to the next bloc to be received + unsigned int bytes) // \arg number of bytes to be received +{ + pPDC->PDC_RNPR = (unsigned int) address; + pPDC->PDC_RNCR = bytes; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_SetNextTx +//* \brief Set the next transmit transfer descriptor +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_SetNextTx ( + AT91PS_PDC pPDC, // \arg pointer to a PDC controller + char *address, // \arg address to the next bloc to be transmitted + unsigned int bytes) // \arg number of bytes to be transmitted +{ + pPDC->PDC_TNPR = (unsigned int) address; + pPDC->PDC_TNCR = bytes; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_SetRx +//* \brief Set the receive transfer descriptor +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_SetRx ( + AT91PS_PDC pPDC, // \arg pointer to a PDC controller + char *address, // \arg address to the next bloc to be received + unsigned int bytes) // \arg number of bytes to be received +{ + pPDC->PDC_RPR = (unsigned int) address; + pPDC->PDC_RCR = bytes; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_SetTx +//* \brief Set the transmit transfer descriptor +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_SetTx ( + AT91PS_PDC pPDC, // \arg pointer to a PDC controller + char *address, // \arg address to the next bloc to be transmitted + unsigned int bytes) // \arg number of bytes to be transmitted +{ + pPDC->PDC_TPR = (unsigned int) address; + pPDC->PDC_TCR = bytes; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_EnableTx +//* \brief Enable transmit +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_EnableTx ( + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + pPDC->PDC_PTCR = AT91C_PDC_TXTEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_EnableRx +//* \brief Enable receive +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_EnableRx ( + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + pPDC->PDC_PTCR = AT91C_PDC_RXTEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_DisableTx +//* \brief Disable transmit +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_DisableTx ( + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + pPDC->PDC_PTCR = AT91C_PDC_TXTDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_DisableRx +//* \brief Disable receive +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_DisableRx ( + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + pPDC->PDC_PTCR = AT91C_PDC_RXTDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_IsTxEmpty +//* \brief Test if the current transfer descriptor has been sent +//*---------------------------------------------------------------------------- +__inline int AT91F_PDC_IsTxEmpty ( // \return return 1 if transfer is complete + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + return !(pPDC->PDC_TCR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_IsNextTxEmpty +//* \brief Test if the next transfer descriptor has been moved to the current td +//*---------------------------------------------------------------------------- +__inline int AT91F_PDC_IsNextTxEmpty ( // \return return 1 if transfer is complete + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + return !(pPDC->PDC_TNCR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_IsRxEmpty +//* \brief Test if the current transfer descriptor has been filled +//*---------------------------------------------------------------------------- +__inline int AT91F_PDC_IsRxEmpty ( // \return return 1 if transfer is complete + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + return !(pPDC->PDC_RCR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_IsNextRxEmpty +//* \brief Test if the next transfer descriptor has been moved to the current td +//*---------------------------------------------------------------------------- +__inline int AT91F_PDC_IsNextRxEmpty ( // \return return 1 if transfer is complete + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + return !(pPDC->PDC_RNCR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_Open +//* \brief Open PDC: disable TX and RX reset transfer descriptors, re-enable RX and TX +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_Open ( + AT91PS_PDC pPDC) // \arg pointer to a PDC controller +{ + //* Disable the RX and TX PDC transfer requests + AT91F_PDC_DisableRx(pPDC); + AT91F_PDC_DisableTx(pPDC); + + //* Reset all Counter register Next buffer first + AT91F_PDC_SetNextTx(pPDC, (char *) 0, 0); + AT91F_PDC_SetNextRx(pPDC, (char *) 0, 0); + AT91F_PDC_SetTx(pPDC, (char *) 0, 0); + AT91F_PDC_SetRx(pPDC, (char *) 0, 0); + + //* Enable the RX and TX PDC transfer requests + AT91F_PDC_EnableRx(pPDC); + AT91F_PDC_EnableTx(pPDC); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_Close +//* \brief Close PDC: disable TX and RX reset transfer descriptors +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_Close ( + AT91PS_PDC pPDC) // \arg pointer to a PDC controller +{ + //* Disable the RX and TX PDC transfer requests + AT91F_PDC_DisableRx(pPDC); + AT91F_PDC_DisableTx(pPDC); + + //* Reset all Counter register Next buffer first + AT91F_PDC_SetNextTx(pPDC, (char *) 0, 0); + AT91F_PDC_SetNextRx(pPDC, (char *) 0, 0); + AT91F_PDC_SetTx(pPDC, (char *) 0, 0); + AT91F_PDC_SetRx(pPDC, (char *) 0, 0); + +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_SendFrame +//* \brief Close PDC: disable TX and RX reset transfer descriptors +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PDC_SendFrame( + AT91PS_PDC pPDC, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + if (AT91F_PDC_IsTxEmpty(pPDC)) { + //* Buffer and next buffer can be initialized + AT91F_PDC_SetTx(pPDC, pBuffer, szBuffer); + AT91F_PDC_SetNextTx(pPDC, pNextBuffer, szNextBuffer); + return 2; + } + else if (AT91F_PDC_IsNextTxEmpty(pPDC)) { + //* Only one buffer can be initialized + AT91F_PDC_SetNextTx(pPDC, pBuffer, szBuffer); + return 1; + } + else { + //* All buffer are in use... + return 0; + } +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_ReceiveFrame +//* \brief Close PDC: disable TX and RX reset transfer descriptors +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PDC_ReceiveFrame ( + AT91PS_PDC pPDC, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + if (AT91F_PDC_IsRxEmpty(pPDC)) { + //* Buffer and next buffer can be initialized + AT91F_PDC_SetRx(pPDC, pBuffer, szBuffer); + AT91F_PDC_SetNextRx(pPDC, pNextBuffer, szNextBuffer); + return 2; + } + else if (AT91F_PDC_IsNextRxEmpty(pPDC)) { + //* Only one buffer can be initialized + AT91F_PDC_SetNextRx(pPDC, pBuffer, szBuffer); + return 1; + } + else { + //* All buffer are in use... + return 0; + } +} +/* ***************************************************************************** + SOFTWARE API FOR DBGU + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_DBGU_InterruptEnable +//* \brief Enable DBGU Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_DBGU_InterruptEnable( + AT91PS_DBGU pDbgu, // \arg pointer to a DBGU controller + unsigned int flag) // \arg dbgu interrupt to be enabled +{ + pDbgu->DBGU_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_DBGU_InterruptDisable +//* \brief Disable DBGU Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_DBGU_InterruptDisable( + AT91PS_DBGU pDbgu, // \arg pointer to a DBGU controller + unsigned int flag) // \arg dbgu interrupt to be disabled +{ + pDbgu->DBGU_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_DBGU_GetInterruptMaskStatus +//* \brief Return DBGU Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_DBGU_GetInterruptMaskStatus( // \return DBGU Interrupt Mask Status + AT91PS_DBGU pDbgu) // \arg pointer to a DBGU controller +{ + return pDbgu->DBGU_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_DBGU_IsInterruptMasked +//* \brief Test if DBGU Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_DBGU_IsInterruptMasked( + AT91PS_DBGU pDbgu, // \arg pointer to a DBGU controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_DBGU_GetInterruptMaskStatus(pDbgu) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR PIO + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgPeriph +//* \brief Enable pins to be drived by peripheral +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgPeriph( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int periphAEnable, // \arg PERIPH A to enable + unsigned int periphBEnable) // \arg PERIPH B to enable + +{ + pPio->PIO_ASR = periphAEnable; + pPio->PIO_BSR = periphBEnable; + pPio->PIO_PDR = (periphAEnable | periphBEnable); // Set in Periph mode +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgOutput +//* \brief Enable PIO in output mode +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgOutput( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int pioEnable) // \arg PIO to be enabled +{ + pPio->PIO_PER = pioEnable; // Set in PIO mode + pPio->PIO_OER = pioEnable; // Configure in Output +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgInput +//* \brief Enable PIO in input mode +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgInput( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int inputEnable) // \arg PIO to be enabled +{ + // Disable output + pPio->PIO_ODR = inputEnable; + pPio->PIO_PER = inputEnable; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgOpendrain +//* \brief Configure PIO in open drain +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgOpendrain( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int multiDrvEnable) // \arg pio to be configured in open drain +{ + // Configure the multi-drive option + pPio->PIO_MDDR = ~multiDrvEnable; + pPio->PIO_MDER = multiDrvEnable; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgPullup +//* \brief Enable pullup on PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgPullup( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int pullupEnable) // \arg enable pullup on PIO +{ + // Connect or not Pullup + pPio->PIO_PPUDR = ~pullupEnable; + pPio->PIO_PPUER = pullupEnable; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgDirectDrive +//* \brief Enable direct drive on PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgDirectDrive( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int directDrive) // \arg PIO to be configured with direct drive + +{ + // Configure the Direct Drive + pPio->PIO_OWDR = ~directDrive; + pPio->PIO_OWER = directDrive; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgInputFilter +//* \brief Enable input filter on input PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgInputFilter( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int inputFilter) // \arg PIO to be configured with input filter + +{ + // Configure the Direct Drive + pPio->PIO_IFDR = ~inputFilter; + pPio->PIO_IFER = inputFilter; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetInput +//* \brief Return PIO input value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetInput( // \return PIO input + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_PDSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsInputSet +//* \brief Test if PIO is input flag is active +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsInputSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetInput(pPio) & flag); +} + + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_SetOutput +//* \brief Set to 1 output PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_SetOutput( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg output to be set +{ + pPio->PIO_SODR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_ClearOutput +//* \brief Set to 0 output PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_ClearOutput( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg output to be cleared +{ + pPio->PIO_CODR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_ForceOutput +//* \brief Force output when Direct drive option is enabled +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_ForceOutput( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg output to be forced +{ + pPio->PIO_ODSR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_Enable +//* \brief Enable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_Enable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio to be enabled +{ + pPio->PIO_PER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_Disable +//* \brief Disable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_Disable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio to be disabled +{ + pPio->PIO_PDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetStatus +//* \brief Return PIO Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetStatus( // \return PIO Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_PSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsSet +//* \brief Test if PIO is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_OutputEnable +//* \brief Output Enable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_OutputEnable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio output to be enabled +{ + pPio->PIO_OER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_OutputDisable +//* \brief Output Enable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_OutputDisable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio output to be disabled +{ + pPio->PIO_ODR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetOutputStatus +//* \brief Return PIO Output Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetOutputStatus( // \return PIO Output Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_OSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsOuputSet +//* \brief Test if PIO Output is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsOutputSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetOutputStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_InputFilterEnable +//* \brief Input Filter Enable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_InputFilterEnable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio input filter to be enabled +{ + pPio->PIO_IFER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_InputFilterDisable +//* \brief Input Filter Disable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_InputFilterDisable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio input filter to be disabled +{ + pPio->PIO_IFDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetInputFilterStatus +//* \brief Return PIO Input Filter Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetInputFilterStatus( // \return PIO Input Filter Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_IFSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsInputFilterSet +//* \brief Test if PIO Input filter is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsInputFilterSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetInputFilterStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetOutputDataStatus +//* \brief Return PIO Output Data Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetOutputDataStatus( // \return PIO Output Data Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_ODSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_InterruptEnable +//* \brief Enable PIO Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_InterruptEnable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio interrupt to be enabled +{ + pPio->PIO_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_InterruptDisable +//* \brief Disable PIO Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_InterruptDisable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio interrupt to be disabled +{ + pPio->PIO_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetInterruptMaskStatus +//* \brief Return PIO Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetInterruptMaskStatus( // \return PIO Interrupt Mask Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetInterruptStatus +//* \brief Return PIO Interrupt Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetInterruptStatus( // \return PIO Interrupt Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_ISR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsInterruptMasked +//* \brief Test if PIO Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsInterruptMasked( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetInterruptMaskStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsInterruptSet +//* \brief Test if PIO Interrupt is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsInterruptSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetInterruptStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_MultiDriverEnable +//* \brief Multi Driver Enable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_MultiDriverEnable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio to be enabled +{ + pPio->PIO_MDER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_MultiDriverDisable +//* \brief Multi Driver Disable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_MultiDriverDisable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio to be disabled +{ + pPio->PIO_MDDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetMultiDriverStatus +//* \brief Return PIO Multi Driver Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetMultiDriverStatus( // \return PIO Multi Driver Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_MDSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsMultiDriverSet +//* \brief Test if PIO MultiDriver is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsMultiDriverSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetMultiDriverStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_A_RegisterSelection +//* \brief PIO A Register Selection +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_A_RegisterSelection( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio A register selection +{ + pPio->PIO_ASR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_B_RegisterSelection +//* \brief PIO B Register Selection +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_B_RegisterSelection( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio B register selection +{ + pPio->PIO_BSR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_Get_AB_RegisterStatus +//* \brief Return PIO Interrupt Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_Get_AB_RegisterStatus( // \return PIO AB Register Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_ABSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsAB_RegisterSet +//* \brief Test if PIO AB Register is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsAB_RegisterSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_Get_AB_RegisterStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_OutputWriteEnable +//* \brief Output Write Enable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_OutputWriteEnable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio output write to be enabled +{ + pPio->PIO_OWER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_OutputWriteDisable +//* \brief Output Write Disable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_OutputWriteDisable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio output write to be disabled +{ + pPio->PIO_OWDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetOutputWriteStatus +//* \brief Return PIO Output Write Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetOutputWriteStatus( // \return PIO Output Write Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_OWSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsOutputWriteSet +//* \brief Test if PIO OutputWrite is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsOutputWriteSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetOutputWriteStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetCfgPullup +//* \brief Return PIO Configuration Pullup +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetCfgPullup( // \return PIO Configuration Pullup + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_PPUSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsOutputDataStatusSet +//* \brief Test if PIO Output Data Status is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsOutputDataStatusSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetOutputDataStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsCfgPullupStatusSet +//* \brief Test if PIO Configuration Pullup Status is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsCfgPullupStatusSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (~AT91F_PIO_GetCfgPullup(pPio) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR PMC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_CfgSysClkEnableReg +//* \brief Configure the System Clock Enable Register of the PMC controller +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_CfgSysClkEnableReg ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int mode) +{ + //* Write to the SCER register + pPMC->PMC_SCER = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_CfgSysClkDisableReg +//* \brief Configure the System Clock Disable Register of the PMC controller +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_CfgSysClkDisableReg ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int mode) +{ + //* Write to the SCDR register + pPMC->PMC_SCDR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_GetSysClkStatusReg +//* \brief Return the System Clock Status Register of the PMC controller +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_GetSysClkStatusReg ( + AT91PS_PMC pPMC // pointer to a CAN controller + ) +{ + return pPMC->PMC_SCSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_EnablePeriphClock +//* \brief Enable peripheral clock +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_EnablePeriphClock ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int periphIds) // \arg IDs of peripherals to enable +{ + pPMC->PMC_PCER = periphIds; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_DisablePeriphClock +//* \brief Disable peripheral clock +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_DisablePeriphClock ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int periphIds) // \arg IDs of peripherals to enable +{ + pPMC->PMC_PCDR = periphIds; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_GetPeriphClock +//* \brief Get peripheral clock status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_GetPeriphClock ( + AT91PS_PMC pPMC) // \arg pointer to PMC controller +{ + return pPMC->PMC_PCSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_CfgMainOscillatorReg +//* \brief Cfg the main oscillator +//*---------------------------------------------------------------------------- +__inline void AT91F_CKGR_CfgMainOscillatorReg ( + AT91PS_CKGR pCKGR, // \arg pointer to CKGR controller + unsigned int mode) +{ + pCKGR->CKGR_MOR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_GetMainOscillatorReg +//* \brief Cfg the main oscillator +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CKGR_GetMainOscillatorReg ( + AT91PS_CKGR pCKGR) // \arg pointer to CKGR controller +{ + return pCKGR->CKGR_MOR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_EnableMainOscillator +//* \brief Enable the main oscillator +//*---------------------------------------------------------------------------- +__inline void AT91F_CKGR_EnableMainOscillator( + AT91PS_CKGR pCKGR) // \arg pointer to CKGR controller +{ + pCKGR->CKGR_MOR |= AT91C_CKGR_MOSCEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_DisableMainOscillator +//* \brief Disable the main oscillator +//*---------------------------------------------------------------------------- +__inline void AT91F_CKGR_DisableMainOscillator ( + AT91PS_CKGR pCKGR) // \arg pointer to CKGR controller +{ + pCKGR->CKGR_MOR &= ~AT91C_CKGR_MOSCEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_CfgMainOscStartUpTime +//* \brief Cfg MOR Register according to the main osc startup time +//*---------------------------------------------------------------------------- +__inline void AT91F_CKGR_CfgMainOscStartUpTime ( + AT91PS_CKGR pCKGR, // \arg pointer to CKGR controller + unsigned int startup_time, // \arg main osc startup time in microsecond (us) + unsigned int slowClock) // \arg slowClock in Hz +{ + pCKGR->CKGR_MOR &= ~AT91C_CKGR_OSCOUNT; + pCKGR->CKGR_MOR |= ((slowClock * startup_time)/(8*1000000)) << 8; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_GetMainClockFreqReg +//* \brief Cfg the main oscillator +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CKGR_GetMainClockFreqReg ( + AT91PS_CKGR pCKGR) // \arg pointer to CKGR controller +{ + return pCKGR->CKGR_MCFR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_GetMainClock +//* \brief Return Main clock in Hz +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CKGR_GetMainClock ( + AT91PS_CKGR pCKGR, // \arg pointer to CKGR controller + unsigned int slowClock) // \arg slowClock in Hz +{ + return ((pCKGR->CKGR_MCFR & AT91C_CKGR_MAINF) * slowClock) >> 4; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_CfgMCKReg +//* \brief Cfg Master Clock Register +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_CfgMCKReg ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int mode) +{ + pPMC->PMC_MCKR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_GetMCKReg +//* \brief Return Master Clock Register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_GetMCKReg( + AT91PS_PMC pPMC) // \arg pointer to PMC controller +{ + return pPMC->PMC_MCKR; +} + +//*------------------------------------------------------------------------------ +//* \fn AT91F_PMC_GetMasterClock +//* \brief Return master clock in Hz which correponds to processor clock for ARM7 +//*------------------------------------------------------------------------------ +__inline unsigned int AT91F_PMC_GetMasterClock ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + AT91PS_CKGR pCKGR, // \arg pointer to CKGR controller + unsigned int slowClock) // \arg slowClock in Hz +{ + unsigned int reg = pPMC->PMC_MCKR; + unsigned int prescaler = (1 << ((reg & AT91C_PMC_PRES) >> 2)); + unsigned int pllDivider, pllMultiplier; + + switch (reg & AT91C_PMC_CSS) { + case AT91C_PMC_CSS_SLOW_CLK: // Slow clock selected + return slowClock / prescaler; + case AT91C_PMC_CSS_MAIN_CLK: // Main clock is selected + return AT91F_CKGR_GetMainClock(pCKGR, slowClock) / prescaler; + case AT91C_PMC_CSS_PLL_CLK: // PLLB clock is selected + reg = pCKGR->CKGR_PLLR; + pllDivider = (reg & AT91C_CKGR_DIV); + pllMultiplier = ((reg & AT91C_CKGR_MUL) >> 16) + 1; + return AT91F_CKGR_GetMainClock(pCKGR, slowClock) / pllDivider * pllMultiplier / prescaler; + } + return 0; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_EnablePCK +//* \brief Enable peripheral clock +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_EnablePCK ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int pck, // \arg Peripheral clock identifier 0 .. 7 + unsigned int mode) +{ + pPMC->PMC_PCKR[pck] = mode; + pPMC->PMC_SCER = (1 << pck) << 8; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_DisablePCK +//* \brief Enable peripheral clock +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_DisablePCK ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int pck) // \arg Peripheral clock identifier 0 .. 7 +{ + pPMC->PMC_SCDR = (1 << pck) << 8; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_EnableIt +//* \brief Enable PMC interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_EnableIt ( + AT91PS_PMC pPMC, // pointer to a PMC controller + unsigned int flag) // IT to be enabled +{ + //* Write to the IER register + pPMC->PMC_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_DisableIt +//* \brief Disable PMC interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_DisableIt ( + AT91PS_PMC pPMC, // pointer to a PMC controller + unsigned int flag) // IT to be disabled +{ + //* Write to the IDR register + pPMC->PMC_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_GetStatus +//* \brief Return PMC Interrupt Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_GetStatus( // \return PMC Interrupt Status + AT91PS_PMC pPMC) // pointer to a PMC controller +{ + return pPMC->PMC_SR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_GetInterruptMaskStatus +//* \brief Return PMC Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_GetInterruptMaskStatus( // \return PMC Interrupt Mask Status + AT91PS_PMC pPMC) // pointer to a PMC controller +{ + return pPMC->PMC_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_IsInterruptMasked +//* \brief Test if PMC Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_IsInterruptMasked( + AT91PS_PMC pPMC, // \arg pointer to a PMC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PMC_GetInterruptMaskStatus(pPMC) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_IsStatusSet +//* \brief Test if PMC Status is Set +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_IsStatusSet( + AT91PS_PMC pPMC, // \arg pointer to a PMC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PMC_GetStatus(pPMC) & flag); +} + +// ---------------------------------------------------------------------------- +// \fn AT91F_CKGR_CfgPLLReg +// \brief Cfg the PLL Register +// ---------------------------------------------------------------------------- +__inline void AT91F_CKGR_CfgPLLReg ( + AT91PS_CKGR pCKGR, // \arg pointer to CKGR controller + unsigned int mode) +{ + pCKGR->CKGR_PLLR = mode; +} + +// ---------------------------------------------------------------------------- +// \fn AT91F_CKGR_GetPLLReg +// \brief Get the PLL Register +// ---------------------------------------------------------------------------- +__inline unsigned int AT91F_CKGR_GetPLLReg ( + AT91PS_CKGR pCKGR) // \arg pointer to CKGR controller +{ + return pCKGR->CKGR_PLLR; +} + + +/* ***************************************************************************** + SOFTWARE API FOR RSTC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_RSTSoftReset +//* \brief Start Software Reset +//*---------------------------------------------------------------------------- +__inline void AT91F_RSTSoftReset( + AT91PS_RSTC pRSTC, + unsigned int reset) +{ + pRSTC->RSTC_RCR = (0xA5000000 | reset); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_RSTSetMode +//* \brief Set Reset Mode +//*---------------------------------------------------------------------------- +__inline void AT91F_RSTSetMode( + AT91PS_RSTC pRSTC, + unsigned int mode) +{ + pRSTC->RSTC_RMR = (0xA5000000 | mode); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_RSTGetMode +//* \brief Get Reset Mode +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_RSTGetMode( + AT91PS_RSTC pRSTC) +{ + return (pRSTC->RSTC_RMR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_RSTGetStatus +//* \brief Get Reset Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_RSTGetStatus( + AT91PS_RSTC pRSTC) +{ + return (pRSTC->RSTC_RSR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_RSTIsSoftRstActive +//* \brief Return !=0 if software reset is still not completed +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_RSTIsSoftRstActive( + AT91PS_RSTC pRSTC) +{ + return ((pRSTC->RSTC_RSR) & AT91C_RSTC_SRCMP); +} +/* ***************************************************************************** + SOFTWARE API FOR RTTC + ***************************************************************************** */ +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_SetRTT_TimeBase() +//* \brief Set the RTT prescaler according to the TimeBase in ms +//*-------------------------------------------------------------------------------------- +__inline unsigned int AT91F_RTTSetTimeBase( + AT91PS_RTTC pRTTC, + unsigned int ms) +{ + if (ms > 2000) + return 1; // AT91C_TIME_OUT_OF_RANGE + pRTTC->RTTC_RTMR &= ~0xFFFF; + pRTTC->RTTC_RTMR |= (((ms << 15) /1000) & 0xFFFF); + return 0; +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTTSetPrescaler() +//* \brief Set the new prescaler value +//*-------------------------------------------------------------------------------------- +__inline unsigned int AT91F_RTTSetPrescaler( + AT91PS_RTTC pRTTC, + unsigned int rtpres) +{ + pRTTC->RTTC_RTMR &= ~0xFFFF; + pRTTC->RTTC_RTMR |= (rtpres & 0xFFFF); + return (pRTTC->RTTC_RTMR); +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTTRestart() +//* \brief Restart the RTT prescaler +//*-------------------------------------------------------------------------------------- +__inline void AT91F_RTTRestart( + AT91PS_RTTC pRTTC) +{ + pRTTC->RTTC_RTMR |= AT91C_RTTC_RTTRST; +} + + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_SetAlarmINT() +//* \brief Enable RTT Alarm Interrupt +//*-------------------------------------------------------------------------------------- +__inline void AT91F_RTTSetAlarmINT( + AT91PS_RTTC pRTTC) +{ + pRTTC->RTTC_RTMR |= AT91C_RTTC_ALMIEN; +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_ClearAlarmINT() +//* \brief Disable RTT Alarm Interrupt +//*-------------------------------------------------------------------------------------- +__inline void AT91F_RTTClearAlarmINT( + AT91PS_RTTC pRTTC) +{ + pRTTC->RTTC_RTMR &= ~AT91C_RTTC_ALMIEN; +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_SetRttIncINT() +//* \brief Enable RTT INC Interrupt +//*-------------------------------------------------------------------------------------- +__inline void AT91F_RTTSetRttIncINT( + AT91PS_RTTC pRTTC) +{ + pRTTC->RTTC_RTMR |= AT91C_RTTC_RTTINCIEN; +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_ClearRttIncINT() +//* \brief Disable RTT INC Interrupt +//*-------------------------------------------------------------------------------------- +__inline void AT91F_RTTClearRttIncINT( + AT91PS_RTTC pRTTC) +{ + pRTTC->RTTC_RTMR &= ~AT91C_RTTC_RTTINCIEN; +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_SetAlarmValue() +//* \brief Set RTT Alarm Value +//*-------------------------------------------------------------------------------------- +__inline void AT91F_RTTSetAlarmValue( + AT91PS_RTTC pRTTC, unsigned int alarm) +{ + pRTTC->RTTC_RTAR = alarm; +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_GetAlarmValue() +//* \brief Get RTT Alarm Value +//*-------------------------------------------------------------------------------------- +__inline unsigned int AT91F_RTTGetAlarmValue( + AT91PS_RTTC pRTTC) +{ + return(pRTTC->RTTC_RTAR); +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTTGetStatus() +//* \brief Read the RTT status +//*-------------------------------------------------------------------------------------- +__inline unsigned int AT91F_RTTGetStatus( + AT91PS_RTTC pRTTC) +{ + return(pRTTC->RTTC_RTSR); +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_ReadValue() +//* \brief Read the RTT value +//*-------------------------------------------------------------------------------------- +__inline unsigned int AT91F_RTTReadValue( + AT91PS_RTTC pRTTC) +{ + register volatile unsigned int val1,val2; + do + { + val1 = pRTTC->RTTC_RTVR; + val2 = pRTTC->RTTC_RTVR; + } + while(val1 != val2); + return(val1); +} +/* ***************************************************************************** + SOFTWARE API FOR PITC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITInit +//* \brief System timer init : period in µsecond, system clock freq in MHz +//*---------------------------------------------------------------------------- +__inline void AT91F_PITInit( + AT91PS_PITC pPITC, + unsigned int period, + unsigned int pit_frequency) +{ + pPITC->PITC_PIMR = period? (period * pit_frequency + 8) >> 4 : 0; // +8 to avoid %10 and /10 + pPITC->PITC_PIMR |= AT91C_PITC_PITEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITSetPIV +//* \brief Set the PIT Periodic Interval Value +//*---------------------------------------------------------------------------- +__inline void AT91F_PITSetPIV( + AT91PS_PITC pPITC, + unsigned int piv) +{ + pPITC->PITC_PIMR = piv | (pPITC->PITC_PIMR & (AT91C_PITC_PITEN | AT91C_PITC_PITIEN)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITEnableInt +//* \brief Enable PIT periodic interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PITEnableInt( + AT91PS_PITC pPITC) +{ + pPITC->PITC_PIMR |= AT91C_PITC_PITIEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITDisableInt +//* \brief Disable PIT periodic interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PITDisableInt( + AT91PS_PITC pPITC) +{ + pPITC->PITC_PIMR &= ~AT91C_PITC_PITIEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITGetMode +//* \brief Read PIT mode register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PITGetMode( + AT91PS_PITC pPITC) +{ + return(pPITC->PITC_PIMR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITGetStatus +//* \brief Read PIT status register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PITGetStatus( + AT91PS_PITC pPITC) +{ + return(pPITC->PITC_PISR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITGetPIIR +//* \brief Read PIT CPIV and PICNT without ressetting the counters +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PITGetPIIR( + AT91PS_PITC pPITC) +{ + return(pPITC->PITC_PIIR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITGetPIVR +//* \brief Read System timer CPIV and PICNT without ressetting the counters +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PITGetPIVR( + AT91PS_PITC pPITC) +{ + return(pPITC->PITC_PIVR); +} +/* ***************************************************************************** + SOFTWARE API FOR WDTC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_WDTSetMode +//* \brief Set Watchdog Mode Register +//*---------------------------------------------------------------------------- +__inline void AT91F_WDTSetMode( + AT91PS_WDTC pWDTC, + unsigned int Mode) +{ + pWDTC->WDTC_WDMR = Mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_WDTRestart +//* \brief Restart Watchdog +//*---------------------------------------------------------------------------- +__inline void AT91F_WDTRestart( + AT91PS_WDTC pWDTC) +{ + pWDTC->WDTC_WDCR = 0xA5000001; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_WDTSGettatus +//* \brief Get Watchdog Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_WDTSGettatus( + AT91PS_WDTC pWDTC) +{ + return(pWDTC->WDTC_WDSR & 0x3); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_WDTGetPeriod +//* \brief Translate ms into Watchdog Compatible value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_WDTGetPeriod(unsigned int ms) +{ + if ((ms < 4) || (ms > 16000)) + return 0; + return((ms << 8) / 1000); +} +/* ***************************************************************************** + SOFTWARE API FOR VREG + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_VREG_Enable_LowPowerMode +//* \brief Enable VREG Low Power Mode +//*---------------------------------------------------------------------------- +__inline void AT91F_VREG_Enable_LowPowerMode( + AT91PS_VREG pVREG) +{ + pVREG->VREG_MR |= AT91C_VREG_PSTDBY; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_VREG_Disable_LowPowerMode +//* \brief Disable VREG Low Power Mode +//*---------------------------------------------------------------------------- +__inline void AT91F_VREG_Disable_LowPowerMode( + AT91PS_VREG pVREG) +{ + pVREG->VREG_MR &= ~AT91C_VREG_PSTDBY; +}/* ***************************************************************************** + SOFTWARE API FOR MC + ***************************************************************************** */ + +#define AT91C_MC_CORRECT_KEY ((unsigned int) 0x5A << 24) // (MC) Correct Protect Key + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_Remap +//* \brief Make Remap +//*---------------------------------------------------------------------------- +__inline void AT91F_MC_Remap (void) // +{ + AT91PS_MC pMC = (AT91PS_MC) AT91C_BASE_MC; + + pMC->MC_RCR = AT91C_MC_RCB; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_CfgModeReg +//* \brief Configure the EFC Mode Register of the MC controller +//*---------------------------------------------------------------------------- +__inline void AT91F_MC_EFC_CfgModeReg ( + AT91PS_MC pMC, // pointer to a MC controller + unsigned int mode) // mode register +{ + // Write to the FMR register + pMC->MC_FMR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_GetModeReg +//* \brief Return MC EFC Mode Regsiter +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_MC_EFC_GetModeReg( + AT91PS_MC pMC) // pointer to a MC controller +{ + return pMC->MC_FMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_ComputeFMCN +//* \brief Return MC EFC Mode Regsiter +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_MC_EFC_ComputeFMCN( + int master_clock) // master clock in Hz +{ + return (master_clock/1000000 +2); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_PerformCmd +//* \brief Perform EFC Command +//*---------------------------------------------------------------------------- +__inline void AT91F_MC_EFC_PerformCmd ( + AT91PS_MC pMC, // pointer to a MC controller + unsigned int transfer_cmd) +{ + pMC->MC_FCR = transfer_cmd; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_GetStatus +//* \brief Return MC EFC Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_MC_EFC_GetStatus( + AT91PS_MC pMC) // pointer to a MC controller +{ + return pMC->MC_FSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_IsInterruptMasked +//* \brief Test if EFC MC Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_MC_EFC_IsInterruptMasked( + AT91PS_MC pMC, // \arg pointer to a MC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_MC_EFC_GetModeReg(pMC) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_IsInterruptSet +//* \brief Test if EFC MC Interrupt is Set +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_MC_EFC_IsInterruptSet( + AT91PS_MC pMC, // \arg pointer to a MC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_MC_EFC_GetStatus(pMC) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR SPI + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_CfgCs +//* \brief Configure SPI chip select register +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_CfgCs ( + AT91PS_SPI pSPI, // pointer to a SPI controller + int cs, // SPI cs number (0 to 3) + int val) // chip select register +{ + //* Write to the CSR register + *(pSPI->SPI_CSR + cs) = val; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_EnableIt +//* \brief Enable SPI interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_EnableIt ( + AT91PS_SPI pSPI, // pointer to a SPI controller + unsigned int flag) // IT to be enabled +{ + //* Write to the IER register + pSPI->SPI_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_DisableIt +//* \brief Disable SPI interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_DisableIt ( + AT91PS_SPI pSPI, // pointer to a SPI controller + unsigned int flag) // IT to be disabled +{ + //* Write to the IDR register + pSPI->SPI_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_Reset +//* \brief Reset the SPI controller +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_Reset ( + AT91PS_SPI pSPI // pointer to a SPI controller + ) +{ + //* Write to the CR register + pSPI->SPI_CR = AT91C_SPI_SWRST; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_Enable +//* \brief Enable the SPI controller +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_Enable ( + AT91PS_SPI pSPI // pointer to a SPI controller + ) +{ + //* Write to the CR register + pSPI->SPI_CR = AT91C_SPI_SPIEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_Disable +//* \brief Disable the SPI controller +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_Disable ( + AT91PS_SPI pSPI // pointer to a SPI controller + ) +{ + //* Write to the CR register + pSPI->SPI_CR = AT91C_SPI_SPIDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_CfgMode +//* \brief Enable the SPI controller +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_CfgMode ( + AT91PS_SPI pSPI, // pointer to a SPI controller + int mode) // mode register +{ + //* Write to the MR register + pSPI->SPI_MR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_CfgPCS +//* \brief Switch to the correct PCS of SPI Mode Register : Fixed Peripheral Selected +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_CfgPCS ( + AT91PS_SPI pSPI, // pointer to a SPI controller + char PCS_Device) // PCS of the Device +{ + //* Write to the MR register + pSPI->SPI_MR &= 0xFFF0FFFF; + pSPI->SPI_MR |= ( (PCS_Device<<16) & AT91C_SPI_PCS ); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_ReceiveFrame +//* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initializaed with Next Buffer, 0 if PDC is busy +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_SPI_ReceiveFrame ( + AT91PS_SPI pSPI, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + return AT91F_PDC_ReceiveFrame( + (AT91PS_PDC) &(pSPI->SPI_RPR), + pBuffer, + szBuffer, + pNextBuffer, + szNextBuffer); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_SendFrame +//* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initializaed with Next Buffer, 0 if PDC is bSPIy +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_SPI_SendFrame( + AT91PS_SPI pSPI, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + return AT91F_PDC_SendFrame( + (AT91PS_PDC) &(pSPI->SPI_RPR), + pBuffer, + szBuffer, + pNextBuffer, + szNextBuffer); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_Close +//* \brief Close SPI: disable IT disable transfert, close PDC +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_Close ( + AT91PS_SPI pSPI) // \arg pointer to a SPI controller +{ + //* Reset all the Chip Select register + pSPI->SPI_CSR[0] = 0 ; + pSPI->SPI_CSR[1] = 0 ; + pSPI->SPI_CSR[2] = 0 ; + pSPI->SPI_CSR[3] = 0 ; + + //* Reset the SPI mode + pSPI->SPI_MR = 0 ; + + //* Disable all interrupts + pSPI->SPI_IDR = 0xFFFFFFFF ; + + //* Abort the Peripheral Data Transfers + AT91F_PDC_Close((AT91PS_PDC) &(pSPI->SPI_RPR)); + + //* Disable receiver and transmitter and stop any activity immediately + pSPI->SPI_CR = AT91C_SPI_SPIDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_PutChar +//* \brief Send a character,does not check if ready to send +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_PutChar ( + AT91PS_SPI pSPI, + unsigned int character, + unsigned int cs_number ) +{ + unsigned int value_for_cs; + value_for_cs = (~(1 << cs_number)) & 0xF; //Place a zero among a 4 ONEs number + pSPI->SPI_TDR = (character & 0xFFFF) | (value_for_cs << 16); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_GetChar +//* \brief Receive a character,does not check if a character is available +//*---------------------------------------------------------------------------- +__inline int AT91F_SPI_GetChar ( + const AT91PS_SPI pSPI) +{ + return((pSPI->SPI_RDR) & 0xFFFF); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_GetInterruptMaskStatus +//* \brief Return SPI Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_SPI_GetInterruptMaskStatus( // \return SPI Interrupt Mask Status + AT91PS_SPI pSpi) // \arg pointer to a SPI controller +{ + return pSpi->SPI_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_IsInterruptMasked +//* \brief Test if SPI Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_SPI_IsInterruptMasked( + AT91PS_SPI pSpi, // \arg pointer to a SPI controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_SPI_GetInterruptMaskStatus(pSpi) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR USART + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_Baudrate +//* \brief Calculate the baudrate +//* Standard Asynchronous Mode : 8 bits , 1 stop , no parity +#define AT91C_US_ASYNC_MODE ( AT91C_US_USMODE_NORMAL + \ + AT91C_US_NBSTOP_1_BIT + \ + AT91C_US_PAR_NONE + \ + AT91C_US_CHRL_8_BITS + \ + AT91C_US_CLKS_CLOCK ) + +//* Standard External Asynchronous Mode : 8 bits , 1 stop , no parity +#define AT91C_US_ASYNC_SCK_MODE ( AT91C_US_USMODE_NORMAL + \ + AT91C_US_NBSTOP_1_BIT + \ + AT91C_US_PAR_NONE + \ + AT91C_US_CHRL_8_BITS + \ + AT91C_US_CLKS_EXT ) + +//* Standard Synchronous Mode : 8 bits , 1 stop , no parity +#define AT91C_US_SYNC_MODE ( AT91C_US_SYNC + \ + AT91C_US_USMODE_NORMAL + \ + AT91C_US_NBSTOP_1_BIT + \ + AT91C_US_PAR_NONE + \ + AT91C_US_CHRL_8_BITS + \ + AT91C_US_CLKS_CLOCK ) + +//* SCK used Label +#define AT91C_US_SCK_USED (AT91C_US_CKLO | AT91C_US_CLKS_EXT) + +//* Standard ISO T=0 Mode : 8 bits , 1 stop , parity +#define AT91C_US_ISO_READER_MODE ( AT91C_US_USMODE_ISO7816_0 + \ + AT91C_US_CLKS_CLOCK +\ + AT91C_US_NBSTOP_1_BIT + \ + AT91C_US_PAR_EVEN + \ + AT91C_US_CHRL_8_BITS + \ + AT91C_US_CKLO +\ + AT91C_US_OVER) + +//* Standard IRDA mode +#define AT91C_US_ASYNC_IRDA_MODE ( AT91C_US_USMODE_IRDA + \ + AT91C_US_NBSTOP_1_BIT + \ + AT91C_US_PAR_NONE + \ + AT91C_US_CHRL_8_BITS + \ + AT91C_US_CLKS_CLOCK ) + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_Baudrate +//* \brief Caluculate baud_value according to the main clock and the baud rate +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_US_Baudrate ( + const unsigned int main_clock, // \arg peripheral clock + const unsigned int baud_rate) // \arg UART baudrate +{ + unsigned int baud_value = ((main_clock*10)/(baud_rate * 16)); + if ((baud_value % 10) >= 5) + baud_value = (baud_value / 10) + 1; + else + baud_value /= 10; + return baud_value; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_SetBaudrate +//* \brief Set the baudrate according to the CPU clock +//*---------------------------------------------------------------------------- +__inline void AT91F_US_SetBaudrate ( + AT91PS_USART pUSART, // \arg pointer to a USART controller + unsigned int mainClock, // \arg peripheral clock + unsigned int speed) // \arg UART baudrate +{ + //* Define the baud rate divisor register + pUSART->US_BRGR = AT91F_US_Baudrate(mainClock, speed); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_SetTimeguard +//* \brief Set USART timeguard +//*---------------------------------------------------------------------------- +__inline void AT91F_US_SetTimeguard ( + AT91PS_USART pUSART, // \arg pointer to a USART controller + unsigned int timeguard) // \arg timeguard value +{ + //* Write the Timeguard Register + pUSART->US_TTGR = timeguard ; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_EnableIt +//* \brief Enable USART IT +//*---------------------------------------------------------------------------- +__inline void AT91F_US_EnableIt ( + AT91PS_USART pUSART, // \arg pointer to a USART controller + unsigned int flag) // \arg IT to be enabled +{ + //* Write to the IER register + pUSART->US_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_DisableIt +//* \brief Disable USART IT +//*---------------------------------------------------------------------------- +__inline void AT91F_US_DisableIt ( + AT91PS_USART pUSART, // \arg pointer to a USART controller + unsigned int flag) // \arg IT to be disabled +{ + //* Write to the IER register + pUSART->US_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_Configure +//* \brief Configure USART +//*---------------------------------------------------------------------------- +__inline void AT91F_US_Configure ( + AT91PS_USART pUSART, // \arg pointer to a USART controller + unsigned int mainClock, // \arg peripheral clock + unsigned int mode , // \arg mode Register to be programmed + unsigned int baudRate , // \arg baudrate to be programmed + unsigned int timeguard ) // \arg timeguard to be programmed +{ + //* Disable interrupts + pUSART->US_IDR = (unsigned int) -1; + + //* Reset receiver and transmitter + pUSART->US_CR = AT91C_US_RSTRX | AT91C_US_RSTTX | AT91C_US_RXDIS | AT91C_US_TXDIS ; + + //* Define the baud rate divisor register + AT91F_US_SetBaudrate(pUSART, mainClock, baudRate); + + //* Write the Timeguard Register + AT91F_US_SetTimeguard(pUSART, timeguard); + + //* Clear Transmit and Receive Counters + AT91F_PDC_Open((AT91PS_PDC) &(pUSART->US_RPR)); + + //* Define the USART mode + pUSART->US_MR = mode ; + +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_EnableRx +//* \brief Enable receiving characters +//*---------------------------------------------------------------------------- +__inline void AT91F_US_EnableRx ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Enable receiver + pUSART->US_CR = AT91C_US_RXEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_EnableTx +//* \brief Enable sending characters +//*---------------------------------------------------------------------------- +__inline void AT91F_US_EnableTx ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Enable transmitter + pUSART->US_CR = AT91C_US_TXEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_ResetRx +//* \brief Reset Receiver and re-enable it +//*---------------------------------------------------------------------------- +__inline void AT91F_US_ResetRx ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Reset receiver + pUSART->US_CR = AT91C_US_RSTRX; + //* Re-Enable receiver + pUSART->US_CR = AT91C_US_RXEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_ResetTx +//* \brief Reset Transmitter and re-enable it +//*---------------------------------------------------------------------------- +__inline void AT91F_US_ResetTx ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Reset transmitter + pUSART->US_CR = AT91C_US_RSTTX; + //* Enable transmitter + pUSART->US_CR = AT91C_US_TXEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_DisableRx +//* \brief Disable Receiver +//*---------------------------------------------------------------------------- +__inline void AT91F_US_DisableRx ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Disable receiver + pUSART->US_CR = AT91C_US_RXDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_DisableTx +//* \brief Disable Transmitter +//*---------------------------------------------------------------------------- +__inline void AT91F_US_DisableTx ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Disable transmitter + pUSART->US_CR = AT91C_US_TXDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_Close +//* \brief Close USART: disable IT disable receiver and transmitter, close PDC +//*---------------------------------------------------------------------------- +__inline void AT91F_US_Close ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Reset the baud rate divisor register + pUSART->US_BRGR = 0 ; + + //* Reset the USART mode + pUSART->US_MR = 0 ; + + //* Reset the Timeguard Register + pUSART->US_TTGR = 0; + + //* Disable all interrupts + pUSART->US_IDR = 0xFFFFFFFF ; + + //* Abort the Peripheral Data Transfers + AT91F_PDC_Close((AT91PS_PDC) &(pUSART->US_RPR)); + + //* Disable receiver and transmitter and stop any activity immediately + pUSART->US_CR = AT91C_US_TXDIS | AT91C_US_RXDIS | AT91C_US_RSTTX | AT91C_US_RSTRX ; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_TxReady +//* \brief Return 1 if a character can be written in US_THR +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_US_TxReady ( + AT91PS_USART pUSART ) // \arg pointer to a USART controller +{ + return (pUSART->US_CSR & AT91C_US_TXRDY); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_RxReady +//* \brief Return 1 if a character can be read in US_RHR +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_US_RxReady ( + AT91PS_USART pUSART ) // \arg pointer to a USART controller +{ + return (pUSART->US_CSR & AT91C_US_RXRDY); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_Error +//* \brief Return the error flag +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_US_Error ( + AT91PS_USART pUSART ) // \arg pointer to a USART controller +{ + return (pUSART->US_CSR & + (AT91C_US_OVRE | // Overrun error + AT91C_US_FRAME | // Framing error + AT91C_US_PARE)); // Parity error +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_PutChar +//* \brief Send a character,does not check if ready to send +//*---------------------------------------------------------------------------- +__inline void AT91F_US_PutChar ( + AT91PS_USART pUSART, + int character ) +{ + pUSART->US_THR = (character & 0x1FF); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_GetChar +//* \brief Receive a character,does not check if a character is available +//*---------------------------------------------------------------------------- +__inline int AT91F_US_GetChar ( + const AT91PS_USART pUSART) +{ + return((pUSART->US_RHR) & 0x1FF); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_SendFrame +//* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initializaed with Next Buffer, 0 if PDC is busy +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_US_SendFrame( + AT91PS_USART pUSART, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + return AT91F_PDC_SendFrame( + (AT91PS_PDC) &(pUSART->US_RPR), + pBuffer, + szBuffer, + pNextBuffer, + szNextBuffer); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_ReceiveFrame +//* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initializaed with Next Buffer, 0 if PDC is busy +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_US_ReceiveFrame ( + AT91PS_USART pUSART, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + return AT91F_PDC_ReceiveFrame( + (AT91PS_PDC) &(pUSART->US_RPR), + pBuffer, + szBuffer, + pNextBuffer, + szNextBuffer); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_SetIrdaFilter +//* \brief Set the value of IrDa filter tregister +//*---------------------------------------------------------------------------- +__inline void AT91F_US_SetIrdaFilter ( + AT91PS_USART pUSART, + unsigned char value +) +{ + pUSART->US_IF = value; +} + +/* ***************************************************************************** + SOFTWARE API FOR SSC + ***************************************************************************** */ +//* Define the standard I2S mode configuration + +//* Configuration to set in the SSC Transmit Clock Mode Register +//* Parameters : nb_bit_by_slot : 8, 16 or 32 bits +//* nb_slot_by_frame : number of channels +#define AT91C_I2S_ASY_MASTER_TX_SETTING(nb_bit_by_slot, nb_slot_by_frame)( +\ + AT91C_SSC_CKS_DIV +\ + AT91C_SSC_CKO_CONTINOUS +\ + AT91C_SSC_CKG_NONE +\ + AT91C_SSC_START_FALL_RF +\ + AT91C_SSC_STTOUT +\ + ((1<<16) & AT91C_SSC_STTDLY) +\ + ((((nb_bit_by_slot*nb_slot_by_frame)/2)-1) <<24)) + + +//* Configuration to set in the SSC Transmit Frame Mode Register +//* Parameters : nb_bit_by_slot : 8, 16 or 32 bits +//* nb_slot_by_frame : number of channels +#define AT91C_I2S_ASY_TX_FRAME_SETTING(nb_bit_by_slot, nb_slot_by_frame)( +\ + (nb_bit_by_slot-1) +\ + AT91C_SSC_MSBF +\ + (((nb_slot_by_frame-1)<<8) & AT91C_SSC_DATNB) +\ + (((nb_bit_by_slot-1)<<16) & AT91C_SSC_FSLEN) +\ + AT91C_SSC_FSOS_NEGATIVE) + + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_SetBaudrate +//* \brief Set the baudrate according to the CPU clock +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_SetBaudrate ( + AT91PS_SSC pSSC, // \arg pointer to a SSC controller + unsigned int mainClock, // \arg peripheral clock + unsigned int speed) // \arg SSC baudrate +{ + unsigned int baud_value; + //* Define the baud rate divisor register + if (speed == 0) + baud_value = 0; + else + { + baud_value = (unsigned int) (mainClock * 10)/(2*speed); + if ((baud_value % 10) >= 5) + baud_value = (baud_value / 10) + 1; + else + baud_value /= 10; + } + + pSSC->SSC_CMR = baud_value; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_Configure +//* \brief Configure SSC +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_Configure ( + AT91PS_SSC pSSC, // \arg pointer to a SSC controller + unsigned int syst_clock, // \arg System Clock Frequency + unsigned int baud_rate, // \arg Expected Baud Rate Frequency + unsigned int clock_rx, // \arg Receiver Clock Parameters + unsigned int mode_rx, // \arg mode Register to be programmed + unsigned int clock_tx, // \arg Transmitter Clock Parameters + unsigned int mode_tx) // \arg mode Register to be programmed +{ + //* Disable interrupts + pSSC->SSC_IDR = (unsigned int) -1; + + //* Reset receiver and transmitter + pSSC->SSC_CR = AT91C_SSC_SWRST | AT91C_SSC_RXDIS | AT91C_SSC_TXDIS ; + + //* Define the Clock Mode Register + AT91F_SSC_SetBaudrate(pSSC, syst_clock, baud_rate); + + //* Write the Receive Clock Mode Register + pSSC->SSC_RCMR = clock_rx; + + //* Write the Transmit Clock Mode Register + pSSC->SSC_TCMR = clock_tx; + + //* Write the Receive Frame Mode Register + pSSC->SSC_RFMR = mode_rx; + + //* Write the Transmit Frame Mode Register + pSSC->SSC_TFMR = mode_tx; + + //* Clear Transmit and Receive Counters + AT91F_PDC_Open((AT91PS_PDC) &(pSSC->SSC_RPR)); + + +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_EnableRx +//* \brief Enable receiving datas +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_EnableRx ( + AT91PS_SSC pSSC) // \arg pointer to a SSC controller +{ + //* Enable receiver + pSSC->SSC_CR = AT91C_SSC_RXEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_DisableRx +//* \brief Disable receiving datas +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_DisableRx ( + AT91PS_SSC pSSC) // \arg pointer to a SSC controller +{ + //* Disable receiver + pSSC->SSC_CR = AT91C_SSC_RXDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_EnableTx +//* \brief Enable sending datas +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_EnableTx ( + AT91PS_SSC pSSC) // \arg pointer to a SSC controller +{ + //* Enable transmitter + pSSC->SSC_CR = AT91C_SSC_TXEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_DisableTx +//* \brief Disable sending datas +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_DisableTx ( + AT91PS_SSC pSSC) // \arg pointer to a SSC controller +{ + //* Disable transmitter + pSSC->SSC_CR = AT91C_SSC_TXDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_EnableIt +//* \brief Enable SSC IT +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_EnableIt ( + AT91PS_SSC pSSC, // \arg pointer to a SSC controller + unsigned int flag) // \arg IT to be enabled +{ + //* Write to the IER register + pSSC->SSC_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_DisableIt +//* \brief Disable SSC IT +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_DisableIt ( + AT91PS_SSC pSSC, // \arg pointer to a SSC controller + unsigned int flag) // \arg IT to be disabled +{ + //* Write to the IDR register + pSSC->SSC_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_ReceiveFrame +//* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initialized with Next Buffer, 0 if PDC is busy +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_SSC_ReceiveFrame ( + AT91PS_SSC pSSC, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + return AT91F_PDC_ReceiveFrame( + (AT91PS_PDC) &(pSSC->SSC_RPR), + pBuffer, + szBuffer, + pNextBuffer, + szNextBuffer); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_SendFrame +//* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initialized with Next Buffer, 0 if PDC is busy +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_SSC_SendFrame( + AT91PS_SSC pSSC, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + return AT91F_PDC_SendFrame( + (AT91PS_PDC) &(pSSC->SSC_RPR), + pBuffer, + szBuffer, + pNextBuffer, + szNextBuffer); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_GetInterruptMaskStatus +//* \brief Return SSC Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_SSC_GetInterruptMaskStatus( // \return SSC Interrupt Mask Status + AT91PS_SSC pSsc) // \arg pointer to a SSC controller +{ + return pSsc->SSC_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_IsInterruptMasked +//* \brief Test if SSC Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_SSC_IsInterruptMasked( + AT91PS_SSC pSsc, // \arg pointer to a SSC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_SSC_GetInterruptMaskStatus(pSsc) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR TWI + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_EnableIt +//* \brief Enable TWI IT +//*---------------------------------------------------------------------------- +__inline void AT91F_TWI_EnableIt ( + AT91PS_TWI pTWI, // \arg pointer to a TWI controller + unsigned int flag) // \arg IT to be enabled +{ + //* Write to the IER register + pTWI->TWI_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_DisableIt +//* \brief Disable TWI IT +//*---------------------------------------------------------------------------- +__inline void AT91F_TWI_DisableIt ( + AT91PS_TWI pTWI, // \arg pointer to a TWI controller + unsigned int flag) // \arg IT to be disabled +{ + //* Write to the IDR register + pTWI->TWI_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_Configure +//* \brief Configure TWI in master mode +//*---------------------------------------------------------------------------- +__inline void AT91F_TWI_Configure ( AT91PS_TWI pTWI ) // \arg pointer to a TWI controller +{ + //* Disable interrupts + pTWI->TWI_IDR = (unsigned int) -1; + + //* Reset peripheral + pTWI->TWI_CR = AT91C_TWI_SWRST; + + //* Set Master mode + pTWI->TWI_CR = AT91C_TWI_MSEN; + +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_GetInterruptMaskStatus +//* \brief Return TWI Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_TWI_GetInterruptMaskStatus( // \return TWI Interrupt Mask Status + AT91PS_TWI pTwi) // \arg pointer to a TWI controller +{ + return pTwi->TWI_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_IsInterruptMasked +//* \brief Test if TWI Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_TWI_IsInterruptMasked( + AT91PS_TWI pTwi, // \arg pointer to a TWI controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_TWI_GetInterruptMaskStatus(pTwi) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR PWMC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_GetStatus +//* \brief Return PWM Interrupt Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PWMC_GetStatus( // \return PWM Interrupt Status + AT91PS_PWMC pPWM) // pointer to a PWM controller +{ + return pPWM->PWMC_SR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_InterruptEnable +//* \brief Enable PWM Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_InterruptEnable( + AT91PS_PWMC pPwm, // \arg pointer to a PWM controller + unsigned int flag) // \arg PWM interrupt to be enabled +{ + pPwm->PWMC_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_InterruptDisable +//* \brief Disable PWM Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_InterruptDisable( + AT91PS_PWMC pPwm, // \arg pointer to a PWM controller + unsigned int flag) // \arg PWM interrupt to be disabled +{ + pPwm->PWMC_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_GetInterruptMaskStatus +//* \brief Return PWM Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PWMC_GetInterruptMaskStatus( // \return PWM Interrupt Mask Status + AT91PS_PWMC pPwm) // \arg pointer to a PWM controller +{ + return pPwm->PWMC_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_IsInterruptMasked +//* \brief Test if PWM Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PWMC_IsInterruptMasked( + AT91PS_PWMC pPWM, // \arg pointer to a PWM controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PWMC_GetInterruptMaskStatus(pPWM) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_IsStatusSet +//* \brief Test if PWM Interrupt is Set +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PWMC_IsStatusSet( + AT91PS_PWMC pPWM, // \arg pointer to a PWM controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PWMC_GetStatus(pPWM) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_CfgChannel +//* \brief Test if PWM Interrupt is Set +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_CfgChannel( + AT91PS_PWMC pPWM, // \arg pointer to a PWM controller + unsigned int channelId, // \arg PWM channel ID + unsigned int mode, // \arg PWM mode + unsigned int period, // \arg PWM period + unsigned int duty) // \arg PWM duty cycle +{ + pPWM->PWMC_CH[channelId].PWMC_CMR = mode; + pPWM->PWMC_CH[channelId].PWMC_CDTYR = duty; + pPWM->PWMC_CH[channelId].PWMC_CPRDR = period; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_StartChannel +//* \brief Enable channel +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_StartChannel( + AT91PS_PWMC pPWM, // \arg pointer to a PWM controller + unsigned int flag) // \arg Channels IDs to be enabled +{ + pPWM->PWMC_ENA = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_StopChannel +//* \brief Disable channel +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_StopChannel( + AT91PS_PWMC pPWM, // \arg pointer to a PWM controller + unsigned int flag) // \arg Channels IDs to be enabled +{ + pPWM->PWMC_DIS = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_UpdateChannel +//* \brief Update Period or Duty Cycle +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_UpdateChannel( + AT91PS_PWMC pPWM, // \arg pointer to a PWM controller + unsigned int channelId, // \arg PWM channel ID + unsigned int update) // \arg Channels IDs to be enabled +{ + pPWM->PWMC_CH[channelId].PWMC_CUPDR = update; +} + +/* ***************************************************************************** + SOFTWARE API FOR UDP + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EnableIt +//* \brief Enable UDP IT +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EnableIt ( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned int flag) // \arg IT to be enabled +{ + //* Write to the IER register + pUDP->UDP_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_DisableIt +//* \brief Disable UDP IT +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_DisableIt ( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned int flag) // \arg IT to be disabled +{ + //* Write to the IDR register + pUDP->UDP_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_SetAddress +//* \brief Set UDP functional address +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_SetAddress ( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char address) // \arg new UDP address +{ + pUDP->UDP_FADDR = (AT91C_UDP_FEN | address); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EnableEp +//* \brief Enable Endpoint +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EnableEp ( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint) // \arg endpoint number +{ + pUDP->UDP_CSR[endpoint] |= AT91C_UDP_EPEDS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_DisableEp +//* \brief Enable Endpoint +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_DisableEp ( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint) // \arg endpoint number +{ + pUDP->UDP_CSR[endpoint] &= ~AT91C_UDP_EPEDS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_SetState +//* \brief Set UDP Device state +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_SetState ( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned int flag) // \arg new UDP address +{ + pUDP->UDP_GLBSTATE &= ~(AT91C_UDP_FADDEN | AT91C_UDP_CONFG); + pUDP->UDP_GLBSTATE |= flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_GetState +//* \brief return UDP Device state +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_UDP_GetState ( // \return the UDP device state + AT91PS_UDP pUDP) // \arg pointer to a UDP controller +{ + return (pUDP->UDP_GLBSTATE & (AT91C_UDP_FADDEN | AT91C_UDP_CONFG)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_ResetEp +//* \brief Reset UDP endpoint +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_ResetEp ( // \return the UDP device state + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned int flag) // \arg Endpoints to be reset +{ + pUDP->UDP_RSTEP = flag; + pUDP->UDP_RSTEP = 0; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpStall +//* \brief Endpoint will STALL requests +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EpStall( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint) // \arg endpoint number +{ + pUDP->UDP_CSR[endpoint] |= AT91C_UDP_FORCESTALL; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpWrite +//* \brief Write value in the DPR +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EpWrite( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint, // \arg endpoint number + unsigned char value) // \arg value to be written in the DPR +{ + pUDP->UDP_FDR[endpoint] = value; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpRead +//* \brief Return value from the DPR +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_UDP_EpRead( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint) // \arg endpoint number +{ + return pUDP->UDP_FDR[endpoint]; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpEndOfWr +//* \brief Notify the UDP that values in DPR are ready to be sent +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EpEndOfWr( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint) // \arg endpoint number +{ + pUDP->UDP_CSR[endpoint] |= AT91C_UDP_TXPKTRDY; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpClear +//* \brief Clear flag in the endpoint CSR register +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EpClear( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint, // \arg endpoint number + unsigned int flag) // \arg flag to be cleared +{ + pUDP->UDP_CSR[endpoint] &= ~(flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpSet +//* \brief Set flag in the endpoint CSR register +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EpSet( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint, // \arg endpoint number + unsigned int flag) // \arg flag to be cleared +{ + pUDP->UDP_CSR[endpoint] |= flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpStatus +//* \brief Return the endpoint CSR register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_UDP_EpStatus( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint) // \arg endpoint number +{ + return pUDP->UDP_CSR[endpoint]; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_GetInterruptMaskStatus +//* \brief Return UDP Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_UDP_GetInterruptMaskStatus( + AT91PS_UDP pUdp) // \arg pointer to a UDP controller +{ + return pUdp->UDP_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_IsInterruptMasked +//* \brief Test if UDP Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_UDP_IsInterruptMasked( + AT91PS_UDP pUdp, // \arg pointer to a UDP controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_UDP_GetInterruptMaskStatus(pUdp) & flag); +} + +// ---------------------------------------------------------------------------- +// \fn AT91F_UDP_InterruptStatusRegister +// \brief Return the Interrupt Status Register +// ---------------------------------------------------------------------------- +__inline unsigned int AT91F_UDP_InterruptStatusRegister( + AT91PS_UDP pUDP ) // \arg pointer to a UDP controller +{ + return pUDP->UDP_ISR; +} + +// ---------------------------------------------------------------------------- +// \fn AT91F_UDP_InterruptClearRegister +// \brief Clear Interrupt Register +// ---------------------------------------------------------------------------- +__inline void AT91F_UDP_InterruptClearRegister ( + AT91PS_UDP pUDP, // \arg pointer to UDP controller + unsigned int flag) // \arg IT to be cleat +{ + pUDP->UDP_ICR = flag; +} + +// ---------------------------------------------------------------------------- +// \fn AT91F_UDP_EnableTransceiver +// \brief Enable transceiver +// ---------------------------------------------------------------------------- +__inline void AT91F_UDP_EnableTransceiver( + AT91PS_UDP pUDP ) // \arg pointer to a UDP controller +{ + pUDP->UDP_TXVC &= ~AT91C_UDP_TXVDIS; +} + +// ---------------------------------------------------------------------------- +// \fn AT91F_UDP_DisableTransceiver +// \brief Disable transceiver +// ---------------------------------------------------------------------------- +__inline void AT91F_UDP_DisableTransceiver( + AT91PS_UDP pUDP ) // \arg pointer to a UDP controller +{ + pUDP->UDP_TXVC = AT91C_UDP_TXVDIS; +} + +/* ***************************************************************************** + SOFTWARE API FOR TC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC_InterruptEnable +//* \brief Enable TC Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_TC_InterruptEnable( + AT91PS_TC pTc, // \arg pointer to a TC controller + unsigned int flag) // \arg TC interrupt to be enabled +{ + pTc->TC_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC_InterruptDisable +//* \brief Disable TC Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_TC_InterruptDisable( + AT91PS_TC pTc, // \arg pointer to a TC controller + unsigned int flag) // \arg TC interrupt to be disabled +{ + pTc->TC_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC_GetInterruptMaskStatus +//* \brief Return TC Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_TC_GetInterruptMaskStatus( // \return TC Interrupt Mask Status + AT91PS_TC pTc) // \arg pointer to a TC controller +{ + return pTc->TC_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC_IsInterruptMasked +//* \brief Test if TC Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_TC_IsInterruptMasked( + AT91PS_TC pTc, // \arg pointer to a TC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_TC_GetInterruptMaskStatus(pTc) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR CAN + ***************************************************************************** */ +#define STANDARD_FORMAT 0 +#define EXTENDED_FORMAT 1 + +//*---------------------------------------------------------------------------- +//* \fn AT91F_InitMailboxRegisters() +//* \brief Configure the corresponding mailbox +//*---------------------------------------------------------------------------- +__inline void AT91F_InitMailboxRegisters(AT91PS_CAN_MB CAN_Mailbox, + int mode_reg, + int acceptance_mask_reg, + int id_reg, + int data_low_reg, + int data_high_reg, + int control_reg) +{ + CAN_Mailbox->CAN_MB_MCR = 0x0; + CAN_Mailbox->CAN_MB_MMR = mode_reg; + CAN_Mailbox->CAN_MB_MAM = acceptance_mask_reg; + CAN_Mailbox->CAN_MB_MID = id_reg; + CAN_Mailbox->CAN_MB_MDL = data_low_reg; + CAN_Mailbox->CAN_MB_MDH = data_high_reg; + CAN_Mailbox->CAN_MB_MCR = control_reg; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_EnableCAN() +//* \brief +//*---------------------------------------------------------------------------- +__inline void AT91F_EnableCAN( + AT91PS_CAN pCAN) // pointer to a CAN controller +{ + pCAN->CAN_MR |= AT91C_CAN_CANEN; + + // Wait for WAKEUP flag raising <=> 11-recessive-bit were scanned by the transceiver + while( (pCAN->CAN_SR & AT91C_CAN_WAKEUP) != AT91C_CAN_WAKEUP ); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_DisableCAN() +//* \brief +//*---------------------------------------------------------------------------- +__inline void AT91F_DisableCAN( + AT91PS_CAN pCAN) // pointer to a CAN controller +{ + pCAN->CAN_MR &= ~AT91C_CAN_CANEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_EnableIt +//* \brief Enable CAN interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_EnableIt ( + AT91PS_CAN pCAN, // pointer to a CAN controller + unsigned int flag) // IT to be enabled +{ + //* Write to the IER register + pCAN->CAN_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_DisableIt +//* \brief Disable CAN interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_DisableIt ( + AT91PS_CAN pCAN, // pointer to a CAN controller + unsigned int flag) // IT to be disabled +{ + //* Write to the IDR register + pCAN->CAN_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetStatus +//* \brief Return CAN Interrupt Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetStatus( // \return CAN Interrupt Status + AT91PS_CAN pCAN) // pointer to a CAN controller +{ + return pCAN->CAN_SR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetInterruptMaskStatus +//* \brief Return CAN Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetInterruptMaskStatus( // \return CAN Interrupt Mask Status + AT91PS_CAN pCAN) // pointer to a CAN controller +{ + return pCAN->CAN_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_IsInterruptMasked +//* \brief Test if CAN Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_IsInterruptMasked( + AT91PS_CAN pCAN, // \arg pointer to a CAN controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_CAN_GetInterruptMaskStatus(pCAN) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_IsStatusSet +//* \brief Test if CAN Interrupt is Set +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_IsStatusSet( + AT91PS_CAN pCAN, // \arg pointer to a CAN controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_CAN_GetStatus(pCAN) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgModeReg +//* \brief Configure the Mode Register of the CAN controller +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgModeReg ( + AT91PS_CAN pCAN, // pointer to a CAN controller + unsigned int mode) // mode register +{ + //* Write to the MR register + pCAN->CAN_MR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetModeReg +//* \brief Return the Mode Register of the CAN controller value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetModeReg ( + AT91PS_CAN pCAN // pointer to a CAN controller + ) +{ + return pCAN->CAN_MR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgBaudrateReg +//* \brief Configure the Baudrate of the CAN controller for the network +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgBaudrateReg ( + AT91PS_CAN pCAN, // pointer to a CAN controller + unsigned int baudrate_cfg) +{ + //* Write to the BR register + pCAN->CAN_BR = baudrate_cfg; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetBaudrate +//* \brief Return the Baudrate of the CAN controller for the network value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetBaudrate ( + AT91PS_CAN pCAN // pointer to a CAN controller + ) +{ + return pCAN->CAN_BR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetInternalCounter +//* \brief Return CAN Timer Regsiter Value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetInternalCounter ( + AT91PS_CAN pCAN // pointer to a CAN controller + ) +{ + return pCAN->CAN_TIM; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetTimestamp +//* \brief Return CAN Timestamp Register Value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetTimestamp ( + AT91PS_CAN pCAN // pointer to a CAN controller + ) +{ + return pCAN->CAN_TIMESTP; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetErrorCounter +//* \brief Return CAN Error Counter Register Value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetErrorCounter ( + AT91PS_CAN pCAN // pointer to a CAN controller + ) +{ + return pCAN->CAN_ECR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_InitTransferRequest +//* \brief Request for a transfer on the corresponding mailboxes +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_InitTransferRequest ( + AT91PS_CAN pCAN, // pointer to a CAN controller + unsigned int transfer_cmd) +{ + pCAN->CAN_TCR = transfer_cmd; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_InitAbortRequest +//* \brief Abort the corresponding mailboxes +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_InitAbortRequest ( + AT91PS_CAN pCAN, // pointer to a CAN controller + unsigned int abort_cmd) +{ + pCAN->CAN_ACR = abort_cmd; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgMessageModeReg +//* \brief Program the Message Mode Register +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgMessageModeReg ( + AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox + unsigned int mode) +{ + CAN_Mailbox->CAN_MB_MMR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetMessageModeReg +//* \brief Return the Message Mode Register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetMessageModeReg ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgMessageIDReg +//* \brief Program the Message ID Register +//* \brief Version == 0 for Standard messsage, Version == 1 for Extended +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgMessageIDReg ( + AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox + unsigned int id, + unsigned char version) +{ + if(version==0) // IDvA Standard Format + CAN_Mailbox->CAN_MB_MID = id<<18; + else // IDvB Extended Format + CAN_Mailbox->CAN_MB_MID = id | (1<<29); // set MIDE bit +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetMessageIDReg +//* \brief Return the Message ID Register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetMessageIDReg ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MID; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgMessageAcceptanceMaskReg +//* \brief Program the Message Acceptance Mask Register +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgMessageAcceptanceMaskReg ( + AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox + unsigned int mask) +{ + CAN_Mailbox->CAN_MB_MAM = mask; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetMessageAcceptanceMaskReg +//* \brief Return the Message Acceptance Mask Register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetMessageAcceptanceMaskReg ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MAM; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetFamilyID +//* \brief Return the Message ID Register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetFamilyID ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MFID; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgMessageCtrl +//* \brief Request and config for a transfer on the corresponding mailbox +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgMessageCtrlReg ( + AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox + unsigned int message_ctrl_cmd) +{ + CAN_Mailbox->CAN_MB_MCR = message_ctrl_cmd; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetMessageStatus +//* \brief Return CAN Mailbox Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetMessageStatus ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgMessageDataLow +//* \brief Program data low value +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgMessageDataLow ( + AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox + unsigned int data) +{ + CAN_Mailbox->CAN_MB_MDL = data; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetMessageDataLow +//* \brief Return data low value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetMessageDataLow ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MDL; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgMessageDataHigh +//* \brief Program data high value +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgMessageDataHigh ( + AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox + unsigned int data) +{ + CAN_Mailbox->CAN_MB_MDH = data; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetMessageDataHigh +//* \brief Return data high value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetMessageDataHigh ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MDH; +} + +/* ***************************************************************************** + SOFTWARE API FOR ADC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_EnableIt +//* \brief Enable ADC interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_EnableIt ( + AT91PS_ADC pADC, // pointer to a ADC controller + unsigned int flag) // IT to be enabled +{ + //* Write to the IER register + pADC->ADC_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_DisableIt +//* \brief Disable ADC interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_DisableIt ( + AT91PS_ADC pADC, // pointer to a ADC controller + unsigned int flag) // IT to be disabled +{ + //* Write to the IDR register + pADC->ADC_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetStatus +//* \brief Return ADC Interrupt Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetStatus( // \return ADC Interrupt Status + AT91PS_ADC pADC) // pointer to a ADC controller +{ + return pADC->ADC_SR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetInterruptMaskStatus +//* \brief Return ADC Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetInterruptMaskStatus( // \return ADC Interrupt Mask Status + AT91PS_ADC pADC) // pointer to a ADC controller +{ + return pADC->ADC_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_IsInterruptMasked +//* \brief Test if ADC Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_IsInterruptMasked( + AT91PS_ADC pADC, // \arg pointer to a ADC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_ADC_GetInterruptMaskStatus(pADC) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_IsStatusSet +//* \brief Test if ADC Status is Set +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_IsStatusSet( + AT91PS_ADC pADC, // \arg pointer to a ADC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_ADC_GetStatus(pADC) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_CfgModeReg +//* \brief Configure the Mode Register of the ADC controller +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_CfgModeReg ( + AT91PS_ADC pADC, // pointer to a ADC controller + unsigned int mode) // mode register +{ + //* Write to the MR register + pADC->ADC_MR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetModeReg +//* \brief Return the Mode Register of the ADC controller value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetModeReg ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_MR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_CfgTimings +//* \brief Configure the different necessary timings of the ADC controller +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_CfgTimings ( + AT91PS_ADC pADC, // pointer to a ADC controller + unsigned int mck_clock, // in MHz + unsigned int adc_clock, // in MHz + unsigned int startup_time, // in us + unsigned int sample_and_hold_time) // in ns +{ + unsigned int prescal,startup,shtim; + + prescal = mck_clock/(2*adc_clock) - 1; + startup = adc_clock*startup_time/8 - 1; + shtim = adc_clock*sample_and_hold_time/1000 - 1; + + //* Write to the MR register + pADC->ADC_MR = ( (prescal<<8) & AT91C_ADC_PRESCAL) | ( (startup<<16) & AT91C_ADC_STARTUP) | ( (shtim<<24) & AT91C_ADC_SHTIM); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_EnableChannel +//* \brief Return ADC Timer Register Value +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_EnableChannel ( + AT91PS_ADC pADC, // pointer to a ADC controller + unsigned int channel) // mode register +{ + //* Write to the CHER register + pADC->ADC_CHER = channel; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_DisableChannel +//* \brief Return ADC Timer Register Value +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_DisableChannel ( + AT91PS_ADC pADC, // pointer to a ADC controller + unsigned int channel) // mode register +{ + //* Write to the CHDR register + pADC->ADC_CHDR = channel; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetChannelStatus +//* \brief Return ADC Timer Register Value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetChannelStatus ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CHSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_StartConversion +//* \brief Software request for a analog to digital conversion +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_StartConversion ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + pADC->ADC_CR = AT91C_ADC_START; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_SoftReset +//* \brief Software reset +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_SoftReset ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + pADC->ADC_CR = AT91C_ADC_SWRST; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetLastConvertedData +//* \brief Return the Last Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetLastConvertedData ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_LCDR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH0 +//* \brief Return the Channel 0 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH0 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR0; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH1 +//* \brief Return the Channel 1 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH1 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR1; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH2 +//* \brief Return the Channel 2 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH2 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR2; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH3 +//* \brief Return the Channel 3 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH3 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR3; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH4 +//* \brief Return the Channel 4 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH4 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR4; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH5 +//* \brief Return the Channel 5 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH5 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR5; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH6 +//* \brief Return the Channel 6 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH6 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR6; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH7 +//* \brief Return the Channel 7 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH7 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR7; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_DBGU_CfgPMC +//* \brief Enable Peripheral clock in PMC for DBGU +//*---------------------------------------------------------------------------- +__inline void AT91F_DBGU_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_DBGU_CfgPIO +//* \brief Configure PIO controllers to drive DBGU signals +//*---------------------------------------------------------------------------- +__inline void AT91F_DBGU_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA27_DRXD ) | + ((unsigned int) AT91C_PA28_DTXD ), // Peripheral A + 0); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_CfgPMC +//* \brief Enable Peripheral clock in PMC for PMC +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_CfgPIO +//* \brief Configure PIO controllers to drive PMC signals +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB30_PCK2 ) | + ((unsigned int) AT91C_PB29_PCK1 ), // Peripheral A + ((unsigned int) AT91C_PB20_PCK0 ) | + ((unsigned int) AT91C_PB0_PCK0 ) | + ((unsigned int) AT91C_PB22_PCK2 ) | + ((unsigned int) AT91C_PB21_PCK1 )); // Peripheral B + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PA30_PCK2 ) | + ((unsigned int) AT91C_PA13_PCK1 ) | + ((unsigned int) AT91C_PA27_PCK3 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_VREG_CfgPMC +//* \brief Enable Peripheral clock in PMC for VREG +//*---------------------------------------------------------------------------- +__inline void AT91F_VREG_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_RSTC_CfgPMC +//* \brief Enable Peripheral clock in PMC for RSTC +//*---------------------------------------------------------------------------- +__inline void AT91F_RSTC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_CfgPMC +//* \brief Enable Peripheral clock in PMC for SSC +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SSC)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_CfgPIO +//* \brief Configure PIO controllers to drive SSC signals +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA25_RK ) | + ((unsigned int) AT91C_PA22_TK ) | + ((unsigned int) AT91C_PA21_TF ) | + ((unsigned int) AT91C_PA24_RD ) | + ((unsigned int) AT91C_PA26_RF ) | + ((unsigned int) AT91C_PA23_TD ), // Peripheral A + 0); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_WDTC_CfgPMC +//* \brief Enable Peripheral clock in PMC for WDTC +//*---------------------------------------------------------------------------- +__inline void AT91F_WDTC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US1_CfgPMC +//* \brief Enable Peripheral clock in PMC for US1 +//*---------------------------------------------------------------------------- +__inline void AT91F_US1_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_US1)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US1_CfgPIO +//* \brief Configure PIO controllers to drive US1 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_US1_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PB26_RI1 ) | + ((unsigned int) AT91C_PB24_DSR1 ) | + ((unsigned int) AT91C_PB23_DCD1 ) | + ((unsigned int) AT91C_PB25_DTR1 )); // Peripheral B + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA7_SCK1 ) | + ((unsigned int) AT91C_PA8_RTS1 ) | + ((unsigned int) AT91C_PA6_TXD1 ) | + ((unsigned int) AT91C_PA5_RXD1 ) | + ((unsigned int) AT91C_PA9_CTS1 ), // Peripheral A + 0); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US0_CfgPMC +//* \brief Enable Peripheral clock in PMC for US0 +//*---------------------------------------------------------------------------- +__inline void AT91F_US0_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_US0)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US0_CfgPIO +//* \brief Configure PIO controllers to drive US0 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_US0_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA0_RXD0 ) | + ((unsigned int) AT91C_PA4_CTS0 ) | + ((unsigned int) AT91C_PA3_RTS0 ) | + ((unsigned int) AT91C_PA2_SCK0 ) | + ((unsigned int) AT91C_PA1_TXD0 ), // Peripheral A + 0); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI1_CfgPMC +//* \brief Enable Peripheral clock in PMC for SPI1 +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI1_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SPI1)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI1_CfgPIO +//* \brief Configure PIO controllers to drive SPI1 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI1_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PB11_SPI1_NPCS2) | + ((unsigned int) AT91C_PB10_SPI1_NPCS1) | + ((unsigned int) AT91C_PB16_SPI1_NPCS3)); // Peripheral B + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PA22_SPI1_SPCK) | + ((unsigned int) AT91C_PA3_SPI1_NPCS2) | + ((unsigned int) AT91C_PA26_SPI1_NPCS2) | + ((unsigned int) AT91C_PA25_SPI1_NPCS1) | + ((unsigned int) AT91C_PA2_SPI1_NPCS1) | + ((unsigned int) AT91C_PA24_SPI1_MISO) | + ((unsigned int) AT91C_PA4_SPI1_NPCS3) | + ((unsigned int) AT91C_PA29_SPI1_NPCS3) | + ((unsigned int) AT91C_PA21_SPI1_NPCS0) | + ((unsigned int) AT91C_PA23_SPI1_MOSI)); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI0_CfgPMC +//* \brief Enable Peripheral clock in PMC for SPI0 +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI0_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SPI0)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI0_CfgPIO +//* \brief Configure PIO controllers to drive SPI0 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI0_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PB13_SPI0_NPCS1) | + ((unsigned int) AT91C_PB14_SPI0_NPCS2) | + ((unsigned int) AT91C_PB17_SPI0_NPCS3)); // Peripheral B + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA16_SPI0_MISO) | + ((unsigned int) AT91C_PA13_SPI0_NPCS1) | + ((unsigned int) AT91C_PA14_SPI0_NPCS2) | + ((unsigned int) AT91C_PA12_SPI0_NPCS0) | + ((unsigned int) AT91C_PA17_SPI0_MOSI) | + ((unsigned int) AT91C_PA15_SPI0_NPCS3) | + ((unsigned int) AT91C_PA18_SPI0_SPCK), // Peripheral A + ((unsigned int) AT91C_PA7_SPI0_NPCS1) | + ((unsigned int) AT91C_PA8_SPI0_NPCS2) | + ((unsigned int) AT91C_PA9_SPI0_NPCS3)); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITC_CfgPMC +//* \brief Enable Peripheral clock in PMC for PITC +//*---------------------------------------------------------------------------- +__inline void AT91F_PITC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_CfgPMC +//* \brief Enable Peripheral clock in PMC for AIC +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_FIQ) | + ((unsigned int) 1 << AT91C_ID_IRQ0) | + ((unsigned int) 1 << AT91C_ID_IRQ1)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_CfgPIO +//* \brief Configure PIO controllers to drive AIC signals +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA30_IRQ0 ) | + ((unsigned int) AT91C_PA29_FIQ ), // Peripheral A + ((unsigned int) AT91C_PA14_IRQ1 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_CfgPMC +//* \brief Enable Peripheral clock in PMC for TWI +//*---------------------------------------------------------------------------- +__inline void AT91F_TWI_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_TWI)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_CfgPIO +//* \brief Configure PIO controllers to drive TWI signals +//*---------------------------------------------------------------------------- +__inline void AT91F_TWI_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA11_TWCK ) | + ((unsigned int) AT91C_PA10_TWD ), // Peripheral A + 0); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_CfgPMC +//* \brief Enable Peripheral clock in PMC for ADC +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_ADC)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_CfgPIO +//* \brief Configure PIO controllers to drive ADC signals +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PB18_ADTRG )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWMC_CH3_CfgPIO +//* \brief Configure PIO controllers to drive PWMC_CH3 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_CH3_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB22_PWM3 ), // Peripheral A + ((unsigned int) AT91C_PB30_PWM3 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWMC_CH2_CfgPIO +//* \brief Configure PIO controllers to drive PWMC_CH2 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_CH2_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB21_PWM2 ), // Peripheral A + ((unsigned int) AT91C_PB29_PWM2 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWMC_CH1_CfgPIO +//* \brief Configure PIO controllers to drive PWMC_CH1 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_CH1_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB20_PWM1 ), // Peripheral A + ((unsigned int) AT91C_PB28_PWM1 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWMC_CH0_CfgPIO +//* \brief Configure PIO controllers to drive PWMC_CH0 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_CH0_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB19_PWM0 ), // Peripheral A + ((unsigned int) AT91C_PB27_PWM0 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_RTTC_CfgPMC +//* \brief Enable Peripheral clock in PMC for RTTC +//*---------------------------------------------------------------------------- +__inline void AT91F_RTTC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_CfgPMC +//* \brief Enable Peripheral clock in PMC for UDP +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_UDP)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_EMAC_CfgPMC +//* \brief Enable Peripheral clock in PMC for EMAC +//*---------------------------------------------------------------------------- +__inline void AT91F_EMAC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_EMAC)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_EMAC_CfgPIO +//* \brief Configure PIO controllers to drive EMAC signals +//*---------------------------------------------------------------------------- +__inline void AT91F_EMAC_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB2_ETX0 ) | + ((unsigned int) AT91C_PB12_ETXER ) | + ((unsigned int) AT91C_PB16_ECOL ) | + ((unsigned int) AT91C_PB15_ERXDV_ECRSDV) | + ((unsigned int) AT91C_PB11_ETX3 ) | + ((unsigned int) AT91C_PB6_ERX1 ) | + ((unsigned int) AT91C_PB13_ERX2 ) | + ((unsigned int) AT91C_PB3_ETX1 ) | + ((unsigned int) AT91C_PB4_ECRS ) | + ((unsigned int) AT91C_PB8_EMDC ) | + ((unsigned int) AT91C_PB5_ERX0 ) | + ((unsigned int) AT91C_PB18_EF100 ) | + ((unsigned int) AT91C_PB14_ERX3 ) | + ((unsigned int) AT91C_PB1_ETXEN ) | + ((unsigned int) AT91C_PB10_ETX2 ) | + ((unsigned int) AT91C_PB0_ETXCK_EREFCK) | + ((unsigned int) AT91C_PB9_EMDIO ) | + ((unsigned int) AT91C_PB7_ERXER ) | + ((unsigned int) AT91C_PB17_ERXCK ), // Peripheral A + 0); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC0_CfgPMC +//* \brief Enable Peripheral clock in PMC for TC0 +//*---------------------------------------------------------------------------- +__inline void AT91F_TC0_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_TC0)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC0_CfgPIO +//* \brief Configure PIO controllers to drive TC0 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_TC0_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB23_TIOA0 ) | + ((unsigned int) AT91C_PB24_TIOB0 ), // Peripheral A + ((unsigned int) AT91C_PB12_TCLK0 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC1_CfgPMC +//* \brief Enable Peripheral clock in PMC for TC1 +//*---------------------------------------------------------------------------- +__inline void AT91F_TC1_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_TC1)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC1_CfgPIO +//* \brief Configure PIO controllers to drive TC1 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_TC1_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB25_TIOA1 ) | + ((unsigned int) AT91C_PB26_TIOB1 ), // Peripheral A + ((unsigned int) AT91C_PB19_TCLK1 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC2_CfgPMC +//* \brief Enable Peripheral clock in PMC for TC2 +//*---------------------------------------------------------------------------- +__inline void AT91F_TC2_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_TC2)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC2_CfgPIO +//* \brief Configure PIO controllers to drive TC2 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_TC2_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB28_TIOB2 ) | + ((unsigned int) AT91C_PB27_TIOA2 ), // Peripheral A + 0); // Peripheral B + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PA15_TCLK2 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_CfgPMC +//* \brief Enable Peripheral clock in PMC for MC +//*---------------------------------------------------------------------------- +__inline void AT91F_MC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIOA_CfgPMC +//* \brief Enable Peripheral clock in PMC for PIOA +//*---------------------------------------------------------------------------- +__inline void AT91F_PIOA_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_PIOA)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIOB_CfgPMC +//* \brief Enable Peripheral clock in PMC for PIOB +//*---------------------------------------------------------------------------- +__inline void AT91F_PIOB_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_PIOB)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgPMC +//* \brief Enable Peripheral clock in PMC for CAN +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_CAN)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgPIO +//* \brief Configure PIO controllers to drive CAN signals +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA20_CANTX ) | + ((unsigned int) AT91C_PA19_CANRX ), // Peripheral A + 0); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWMC_CfgPMC +//* \brief Enable Peripheral clock in PMC for PWMC +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_PWMC)); +} + +#endif // lib_AT91SAM7X256_H diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/settings/cmock_demo.cspy.bat b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/settings/cmock_demo.cspy.bat new file mode 100644 index 0000000..46433e0 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/settings/cmock_demo.cspy.bat @@ -0,0 +1,32 @@ +@REM This bat file has been generated by the IAR Embeddded Workbench +@REM C-SPY interactive debugger,as an aid to preparing a command +@REM line for running the cspybat command line utility with the +@REM appropriate settings. +@REM +@REM After making some adjustments to this file, you can launch cspybat +@REM by typing the name of this file followed by the name of the debug +@REM file (usually an ubrof file). Note that this file is generated +@REM every time a new debug session is initialized, so you may want to +@REM move or rename the file before making changes. +@REM +@REM Note: some command line arguments cannot be properly generated +@REM by this process. Specifically, the plugin which is responsible +@REM for the Terminal I/O window (and other C runtime functionality) +@REM comes in a special version for cspybat, and the name of that +@REM plugin dll is not known when generating this file. It resides in +@REM the $TOOLKIT_DIR$\bin folder and is usually called XXXbat.dll or +@REM XXXlibsupportbat.dll, where XXX is the name of the corresponding +@REM tool chain. Replace the '' parameter +@REM below with the appropriate file name. Other plugins loaded by +@REM C-SPY are usually not needed by, or will not work in, cspybat +@REM but they are listed at the end of this file for reference. + + +"C:\Program Files\IAR Systems\Embedded Workbench 4.0\common\bin\cspybat" "C:\Program Files\IAR Systems\Embedded Workbench 4.0\ARM\bin\armproc.dll" "C:\Program Files\IAR Systems\Embedded Workbench 4.0\ARM\bin\armjlink.dll" %1 --plugin "C:\Program Files\IAR Systems\Embedded Workbench 4.0\ARM\bin\" --macro "C:\svn\cmock\iar\iar_v4\Resource\SAM7_FLASH.mac" --backend -B "--endian" "little" "--cpu" "ARM7TDMI" "--fpu" "None" "--proc_device_desc_file" "C:\Program Files\IAR Systems\Embedded Workbench 4.0\ARM\CONFIG\ioAT91SAM7X256.ddf" "--drv_verify_download" "all" "--proc_driver" "jlink" "--jlink_connection" "USB:0" "--jlink_initial_speed" "32" + + +@REM loaded plugins: +@REM armlibsupport.dll +@REM C:\Program Files\IAR Systems\Embedded Workbench 4.0\common\plugins\CodeCoverage\CodeCoverage.dll +@REM C:\Program Files\IAR Systems\Embedded Workbench 4.0\common\plugins\Profiling\Profiling.dll +@REM C:\Program Files\IAR Systems\Embedded Workbench 4.0\common\plugins\stack\stack.dll diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/settings/cmock_demo.dbgdt b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/settings/cmock_demo.dbgdt new file mode 100644 index 0000000..5e79c26 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/settings/cmock_demo.dbgdt @@ -0,0 +1,86 @@ + + + + + + + + + + + + + 185272727 + + + + + + 100 + + 20 + 1115 + 297 + 74 + + 110$PROJ_DIR$\TermIOInput.txt10 + + + + + + + + TabID-23656-3537 + Debug Log + Debug-Log + + + + TabID-22088-3567 + Build + Build + + + TabID-16970-5692Terminal I/OTerminalIO + + 0 + + + TabID-1637-3541 + Workspace + Workspace + + + cmock_democmock_demo/source + + + + 0 + + + TabID-12385-3544 + Disassembly + Disassembly + + + + + 0 + + + + + + TextEditorC:\svn\cmock\examples\src\Main.c02780680600100000010000001 + + + + + + + iaridepm1debuggergui1-2-2509276-2-2179148129149173302200577598361-2-2509177-2-2179148129149173302129149598361-2-22771388-2-213902791002886326698129149173302 + + + + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/settings/cmock_demo.dni b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/settings/cmock_demo.dni new file mode 100644 index 0000000..b187569 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/settings/cmock_demo.dni @@ -0,0 +1,42 @@ +[JLinkDriver] +WatchCond=_ 0 +Watch0=_ 0 "" 0 "" 0 "" 0 "" 0 0 0 0 +Watch1=_ 0 "" 0 "" 0 "" 0 "" 0 0 0 0 +[DisAssemblyWindow] +NumStates=_ 1 +State 1=_ 1 +[StackPlugin] +Enabled=1 +OverflowWarningsEnabled=1 +WarningThreshold=90 +SpWarningsEnabled=1 +WarnHow=0 +UseTrigger=1 +TriggerName=main +LimitSize=0 +ByteLimit=50 +[Log file] +LoggingEnabled=_ 0 +LogFile=_ "" +Category=_ 0 +[TermIOLog] +LoggingEnabled=_ 0 +LogFile=_ "" +[Interrupts] +Enabled=1 +Irq0=_ 0 480549 0 480549 0 0 0 100 0 1 "IRQ 1 0x18 CPSR.I" +Count=1 +[MemoryMap] +Enabled=0 +Base=0 +UseAuto=0 +TypeViolation=1 +UnspecRange=1 +ActionState=1 +[Disassemble mode] +mode=0 +[Breakpoints] +Count=0 +[TraceHelper] +Enabled=0 +ShowSource=1 diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/settings/cmock_demo.wsdt b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/settings/cmock_demo.wsdt new file mode 100644 index 0000000..33a5635 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/settings/cmock_demo.wsdt @@ -0,0 +1,76 @@ + + + + + + cmock_demo/Debug + + + + + + + + + 237272727 + + + + + + + 20111529774 + + + + + 100 + + + + + + + TabID-20770-112 + Workspace + Workspace + + + cmock_democmock_demo/Sourcecmock_demo/source + + + + 0 + + + TabID-10733-1323 + Build + Build + + + + TabID-27316-3469 + Debug Log + Debug-Log + + + + + 0 + + + + + + TextEditorC:\svn\cmock\examples\src\Main.c0056856800100000010000001 + + + + + + + iaridepm1-2-2554328-2-2179148129149173302238095651054-2-22561388-2-213902581002886302108129149173302 + + + + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/srcIAR/Cstartup.s79 b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/srcIAR/Cstartup.s79 new file mode 100644 index 0000000..73a53fc --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/srcIAR/Cstartup.s79 @@ -0,0 +1,266 @@ +;- ---------------------------------------------------------------------------- +;- ATMEL Microcontroller Software Support - ROUSSET - +;- ---------------------------------------------------------------------------- +;- DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +;- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +;- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +;- DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +;- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +;- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +;- OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +;- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +;- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +;- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +;- ---------------------------------------------------------------------------- +;- File source : Cstartup.s79 +;- Object : Generic CStartup +;- 1.0 01/Sep/05 FBr : Creation +;- 1.1 09/Sep/05 JPP : Change Interrupt management +;------------------------------------------------------------------------------ + +;------------------------------------------------------------------------------ +; Include your AT91 Library files +;------------------------------------------------------------------------------ +#include "AT91SAM7X256_inc.h" +;------------------------------------------------------------------------------ + +;------------------------------------------------------------------------------ +; ?RESET +; Reset Vector. +; Normally, segment INTVEC is linked at address 0. +; For debugging purposes, INTVEC may be placed at other addresses. +; A debugger that honors the entry point will start the +; program in a normal way even if INTVEC is not at address 0. +;------------------------------------------------------------------------------ + + PROGRAM ?RESET ;- Begins a program module + RSEG INTRAMEND_REMAP ;- Begins a relocatable segment + RSEG ICODE:CODE (2) ;- Begins a relocatable segment : corresponding address is 32-bit aligned + CODE32 ;- Always ARM mode after reset + ORG 0 ;- Sets the location counter: corresponds to the RESET vector address + +;------------------------------------------------------------------------------ +;- Exception vectors +;------------------------------------------------------------------------------ +;- These vectors can be read at address 0 or at RAM address +;- They ABSOLUTELY requires to be in relative addresssing mode in order to +;- guarantee a valid jump. For the moment, all are just looping. +;- If an exception occurs before remap, this would result in an infinite loop. +;- To ensure if a exeption occurs before start application to infinite loop. +;------------------------------------------------------------------------------ + +reset + B InitReset ; 0x00 Reset handler +undefvec: + B undefvec ; 0x04 Undefined Instruction +swivec: + B swivec ; 0x08 Software Interrupt +pabtvec: + B pabtvec ; 0x0C Prefetch Abort +dabtvec: + B dabtvec ; 0x10 Data Abort +rsvdvec: + B rsvdvec ; 0x14 reserved +irqvec: + B IRQ_Handler_Entry ; 0x18 IRQ + +fiqvec: ; 0x1c FIQ +;------------------------------------------------------------------------------ +;- Function : FIQ_Handler_Entry +;- Treatments : FIQ Controller Interrupt Handler. +;- Called Functions : AIC_FVR[interrupt] +;------------------------------------------------------------------------------ + +FIQ_Handler_Entry: + +;- Switch in SVC/User Mode to allow User Stack access for C code +; because the FIQ is not yet acknowledged + +;- Save and r0 in FIQ_Register + mov r9,r0 + ldr r0 , [r8, #AIC_FVR] + msr CPSR_c,#I_BIT | F_BIT | ARM_MODE_SVC +;- Save scratch/used registers and LR in User Stack + stmfd sp!, { r1-r3, r12, lr} + +;- Branch to the routine pointed by the AIC_FVR + mov r14, pc + bx r0 + +;- Restore scratch/used registers and LR from User Stack + ldmia sp!, { r1-r3, r12, lr} + +;- Leave Interrupts disabled and switch back in FIQ mode + msr CPSR_c, #I_BIT | F_BIT | ARM_MODE_FIQ + +;- Restore the R0 ARM_MODE_SVC register + mov r0,r9 + +;- Restore the Program Counter using the LR_fiq directly in the PC + subs pc,lr,#4 + +;------------------------------------------------------------------------------ +;- Manage exception: The exception must be ensure in ARM mode +;------------------------------------------------------------------------------ +;------------------------------------------------------------------------------ +;- Function : IRQ_Handler_Entry +;- Treatments : IRQ Controller Interrupt Handler. +;- Called Functions : AIC_IVR[interrupt] +;------------------------------------------------------------------------------ +IRQ_Handler_Entry: + +;------------------------- +;- Manage Exception Entry +;------------------------- +;- Adjust and save LR_irq in IRQ stack + sub lr, lr, #4 + stmfd sp!, {lr} + +;- Save r0 and SPSR (need to be saved for nested interrupt) + mrs r14, SPSR + stmfd sp!, {r0,r14} + +;- Write in the IVR to support Protect Mode +;- No effect in Normal Mode +;- De-assert the NIRQ and clear the source in Protect Mode + ldr r14, =AT91C_BASE_AIC + ldr r0 , [r14, #AIC_IVR] + str r14, [r14, #AIC_IVR] + +;- Enable Interrupt and Switch in Supervisor Mode + msr CPSR_c, #ARM_MODE_SVC + +;- Save scratch/used registers and LR in User Stack + stmfd sp!, { r1-r3, r12, r14} + +;---------------------------------------------- +;- Branch to the routine pointed by the AIC_IVR +;---------------------------------------------- + mov r14, pc + bx r0 + +;---------------------------------------------- +;- Manage Exception Exit +;---------------------------------------------- +;- Restore scratch/used registers and LR from User Stack + ldmia sp!, { r1-r3, r12, r14} + +;- Disable Interrupt and switch back in IRQ mode + msr CPSR_c, #I_BIT | ARM_MODE_IRQ + +;- Mark the End of Interrupt on the AIC + ldr r14, =AT91C_BASE_AIC + str r14, [r14, #AIC_EOICR] + +;- Restore SPSR_irq and r0 from IRQ stack + ldmia sp!, {r0,r14} + msr SPSR_cxsf, r14 + +;- Restore adjusted LR_irq from IRQ stack directly in the PC + ldmia sp!, {pc}^ + + + +InitReset: + +;------------------------------------------------------------------------------ +;- Low level Init is performed in a C function: AT91F_LowLevelInit +;- Init Stack Pointer to a valid memory area before calling AT91F_LowLevelInit +;------------------------------------------------------------------------------ + +;- Retrieve end of RAM address +__iramend EQU SFB(INTRAMEND_REMAP) ;- Segment begin + + EXTERN AT91F_LowLevelInit + ldr r13,=__iramend ;- Temporary stack in internal RAM for Low Level Init execution + ldr r0,=AT91F_LowLevelInit + mov lr, pc + bx r0 ;- Branch on C function (with interworking) + +;------------------------------------------------------------------------------ +;- Top of Stack Definition +;------------------------------------------------------------------------------ +;- Interrupt and Supervisor Stack are located at the top of internal memory in +;- order to speed the exception handling context saving and restoring. +;- ARM_MODE_SVC (Application, C) Stack is located at the top of the external memory. +;------------------------------------------------------------------------------ + +IRQ_STACK_SIZE EQU (3*8*4) ; 3 words to be saved per interrupt priority level +ARM_MODE_FIQ EQU 0x11 +ARM_MODE_IRQ EQU 0x12 +ARM_MODE_SVC EQU 0x13 +I_BIT EQU 0x80 +F_BIT EQU 0x40 + +;------------------------------------------------------------------------------ +;- Setup the stack for each mode +;------------------------------------------------------------------------------ + ldr r0, =__iramend + +;- Set up Fast Interrupt Mode and set FIQ Mode Stack + msr CPSR_c, #ARM_MODE_FIQ | I_BIT | F_BIT +;- Init the FIQ register + ldr r8, =AT91C_BASE_AIC + +;- Set up Interrupt Mode and set IRQ Mode Stack + msr CPSR_c, #ARM_MODE_IRQ | I_BIT | F_BIT + mov r13, r0 ; Init stack IRQ + sub r0, r0, #IRQ_STACK_SIZE + +;- Enable interrupt & Set up Supervisor Mode and set Supervisor Mode Stack + msr CPSR_c, #ARM_MODE_SVC + mov r13, r0 + +;------------------------------------------------------------------------------ +; Initialize segments. +;------------------------------------------------------------------------------ +; __segment_init is assumed to use +; instruction set and to be reachable by BL from the ICODE segment +; (it is safest to link them in segment ICODE). +;------------------------------------------------------------------------------ + EXTERN __segment_init + ldr r0,=__segment_init + mov lr, pc + bx r0 + +;------------------------------------------------------------------------------ +;- Branch on C code Main function (with interworking) +;------------------------------------------------------------------------------ + EXTERN main + PUBLIC __main +?jump_to_main: + ldr lr,=?call_exit + ldr r0,=main +__main: + bx r0 + +;------------------------------------------------------------------------------ +;- Loop for ever +;------------------------------------------------------------------------------ +;- End of application. Normally, never occur. +;- Could jump on Software Reset ( B 0x0 ). +;------------------------------------------------------------------------------ +?call_exit: +End + b End + +;------------------------------------------------------------------------------ +;- Exception Vectors +;------------------------------------------------------------------------------ + PUBLIC AT91F_Default_FIQ_handler + PUBLIC AT91F_Default_IRQ_handler + PUBLIC AT91F_Spurious_handler + + CODE32 ; Always ARM mode after exeption + +AT91F_Default_FIQ_handler + b AT91F_Default_FIQ_handler + +AT91F_Default_IRQ_handler + b AT91F_Default_IRQ_handler + +AT91F_Spurious_handler + b AT91F_Spurious_handler + + ENDMOD ;- Terminates the assembly of the current module + END ;- Terminates the assembly of the last module in a file \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/srcIAR/Cstartup_SAM7.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/srcIAR/Cstartup_SAM7.c new file mode 100644 index 0000000..0913da3 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v4/srcIAR/Cstartup_SAM7.c @@ -0,0 +1,98 @@ +// ---------------------------------------------------------------------------- +// ATMEL Microcontroller Software Support - ROUSSET - +// ---------------------------------------------------------------------------- +// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// ---------------------------------------------------------------------------- +// File Name : Cstartup_SAM7.c +// Object : Low level initialisations written in C for IAR Tools +// Creation : FBr 01-Sep-2005 +// 1.0 08-Sep-2005 JPP : Suppress Reset +// ---------------------------------------------------------------------------- + +#include "AT91SAM7X256.h" + +// The following functions must be write in ARM mode this function called directly by exception vector +extern void AT91F_Spurious_handler(void); +extern void AT91F_Default_IRQ_handler(void); +extern void AT91F_Default_FIQ_handler(void); + +//*---------------------------------------------------------------------------- +//* \fn AT91F_LowLevelInit +//* \brief This function performs very low level HW initialization +//* this function can use a Stack, depending the compilation +//* optimization mode +//*---------------------------------------------------------------------------- +void AT91F_LowLevelInit(void) +{ + unsigned char i; + ///////////////////////////////////////////////////////////////////////////////////////////////////// + // EFC Init + ///////////////////////////////////////////////////////////////////////////////////////////////////// + AT91C_BASE_MC->MC_FMR = AT91C_MC_FWS_1FWS; // 1 Wait State necessary to work at 48MHz + + ///////////////////////////////////////////////////////////////////////////////////////////////////// + // Init PMC Step 1. Enable Main Oscillator + // Main Oscillator startup time is board specific: + // Main Oscillator Startup Time worst case (3MHz) corresponds to 15ms (0x40 for AT91C_CKGR_OSCOUNT field) + ///////////////////////////////////////////////////////////////////////////////////////////////////// + AT91C_BASE_PMC->PMC_MOR = (( AT91C_CKGR_OSCOUNT & (0x40 <<8) | AT91C_CKGR_MOSCEN )); +#ifndef SIMULATE + // Wait Main Oscillator stabilization + while(!(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MOSCS)); +#endif + + ///////////////////////////////////////////////////////////////////////////////////////////////////// + // Init PMC Step 2. + // Set PLL to 96MHz (96,109MHz) and UDP Clock to 48MHz + // PLL Startup time depends on PLL RC filter: worst case is choosen + // UDP Clock (48,058MHz) is compliant with the Universal Serial Bus Specification (+/- 0.25% for full speed) + ///////////////////////////////////////////////////////////////////////////////////////////////////// + AT91C_BASE_PMC->PMC_PLLR = AT91C_CKGR_USBDIV_1 | AT91C_CKGR_OUT_0 | AT91C_CKGR_PLLCOUNT | + (AT91C_CKGR_MUL & (72 << 16)) | (AT91C_CKGR_DIV & 14); +#ifndef SIMULATE + // Wait for PLL stabilization + while( !(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_LOCK) ); + // Wait until the master clock is established for the case we already turn on the PLL + while( !(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MCKRDY) ); +#endif + + ///////////////////////////////////////////////////////////////////////////////////////////////////// + // Init PMC Step 3. + // Selection of Master Clock MCK (equal to Processor Clock PCK) equal to PLL/2 = 48MHz + // The PMC_MCKR register must not be programmed in a single write operation (see. Product Errata Sheet) + ///////////////////////////////////////////////////////////////////////////////////////////////////// + AT91C_BASE_PMC->PMC_MCKR = AT91C_PMC_PRES_CLK_2; +#ifndef SIMULATE + // Wait until the master clock is established + while( !(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MCKRDY) ); +#endif + + AT91C_BASE_PMC->PMC_MCKR |= AT91C_PMC_CSS_PLL_CLK; +#ifndef SIMULATE + // Wait until the master clock is established + while( !(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MCKRDY) ); +#endif + + ///////////////////////////////////////////////////////////////////////////////////////////////////// + // Disable Watchdog (write once register) + ///////////////////////////////////////////////////////////////////////////////////////////////////// + AT91C_BASE_WDTC->WDTC_WDMR = AT91C_WDTC_WDDIS; + + //////////////////////////////////////////////////////////////////////////////////////////////////// + // Init AIC: assign corresponding handler for each interrupt source + ///////////////////////////////////////////////////////////////////////////////////////////////////// + AT91C_BASE_AIC->AIC_SVR[0] = (int) AT91F_Default_FIQ_handler ; + for (i = 1; i < 31; i++) { + AT91C_BASE_AIC->AIC_SVR[i] = (int) AT91F_Default_IRQ_handler ; + } + AT91C_BASE_AIC->AIC_SPU = (unsigned int) AT91F_Spurious_handler; +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/SAM7_FLASH.mac b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/SAM7_FLASH.mac new file mode 100644 index 0000000..407acb2 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/SAM7_FLASH.mac @@ -0,0 +1,71 @@ +// ---------------------------------------------------------------------------- +// ATMEL Microcontroller Software Support - ROUSSET - +// ---------------------------------------------------------------------------- +// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// ---------------------------------------------------------------------------- +// File Name : SAM7_FLASH.mac +// Object : Generic Macro File for IAR +// 1.0 17/Aug/05 FBr : Creation +// ---------------------------------------------------------------------------- + +/********************************************************************* +* +* _InitRSTC() +* +* Function description +* Initializes the RSTC (Reset controller). +* This makes sense since the default is to not allow user resets, which makes it impossible to +* apply a second RESET via J-Link +*/ +_InitRSTC() { + __writeMemory32(0xA5000001, 0xFFFFFD08,"Memory"); // Allow user reset +} + +/********************************************************************* +* +* _InitPLL() +* Function description +* Initializes the PMC. +* 1. Enable the Main Oscillator +* 2. Configure PLL to 96MHz +* 3. Switch Master Clock (MCK) on PLL/2 = 48MHz +*/ + _InitPLL() { + + __message "Enable Main Oscillator"; + __writeMemory32(0x00000601,0xFFFFFc20,"Memory"); // MOSC + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x1) ); + + __message "Set PLL to 96MHz"; + __writeMemory32(0x10191c05,0xFFFFFc2c,"Memory"); // LOCK + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x4) ); + + __message "Set Master Clock to 48MHz"; + __writeMemory32(0x00000004,0xFFFFFc30,"Memory"); // MCKRDY + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x8) ); + __writeMemory32(0x00000007,0xFFFFFc30,"Memory"); // MCKRDY + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x8) ); +} + +/********************************************************************* +* +* execUserReset() : JTAG set initially to Full Speed +*/ +execUserReset() { + __message "execUserReset()"; + __emulatorSpeed(30000); // Set JTAG speed to 30kHz to make a hardware reset + __hwReset(0); // Hardware Reset: CPU is automatically halted after the reset (JTAG is already configured to 32kHz) + _InitPLL(); // Allow to debug at JTAG Full Speed + _InitRSTC(); // Enable User Reset to allow execUserReset() execution + __emulatorSpeed(0); // Set JTAG speed to full speed +} + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/SAM7_RAM.mac b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/SAM7_RAM.mac new file mode 100644 index 0000000..a2b8a01 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/SAM7_RAM.mac @@ -0,0 +1,94 @@ +// ---------------------------------------------------------------------------- +// ATMEL Microcontroller Software Support - ROUSSET - +// ---------------------------------------------------------------------------- +// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// ---------------------------------------------------------------------------- +// File Name : SAM7_RAM.mac +// Object : Generic Macro File for IAR +// 1.0 17/Aug/05 FBr : Creation +// ---------------------------------------------------------------------------- + +/********************************************************************* +* +* _MapRAMAt0() +* +* Function description +* Maps RAM at 0. +*/ +_MapRAMAt0(){ + __message "Changing mapping: RAM mapped to 0"; + __writeMemory32(0x00000001,0xFFFFFF00,"Memory"); +} + +/********************************************************************* +* +* _InitRSTC() +* +* Function description +* Initializes the RSTC (Reset controller). +* This makes sense since the default is to not allow user resets, which makes it impossible to +* apply a second RESET via J-Link +*/ +_InitRSTC() { + __writeMemory32(0xA5000001, 0xFFFFFD08,"Memory"); // Allow user reset +} + +/********************************************************************* +* +* _InitPLL() +* Function description +* Initializes the PMC. +* 1. Enable the Main Oscillator +* 2. Configure PLL to 96MHz +* 3. Switch Master Clock (MCK) on PLL/2 = 48MHz +*/ + _InitPLL() { + + __message "Set Main Oscillator"; + __writeMemory32(0x00004001,0xFFFFFc20,"Memory"); // MOSC + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x1) ); + + __message "Set PLL to 96MHz"; + __writeMemory32(0x10483f0e,0xFFFFFc2c,"Memory"); // LOCK + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x4) ); + + __message "Set Master Clock to 48MHz"; + __writeMemory32(0x00000004,0xFFFFFc30,"Memory"); // MCKRDY + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x8) ); + __writeMemory32(0x00000007,0xFFFFFc30,"Memory"); // MCKRDY + while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x8) ); +} + +/********************************************************************* +* +* execUserReset() : JTAG set initially to Full Speed +*/ +execUserReset() { + __message "execUserReset()"; + __emulatorSpeed(30000); // Set JTAG speed to 30kHz to make a hardware reset + __hwReset(0); // Hardware Reset: CPU is automatically halted after the reset + _InitPLL(); // Allow to debug at JTAG Full Speed + _MapRAMAt0(); // Remap RAM to address 0 + __emulatorSpeed(0); // Set JTAG speed to full speed +} + +/********************************************************************* +* +* execUserPreload() : JTAG set initially to 32kHz +*/ +execUserPreload() { + __message "execUserPreload()"; + __hwReset(0); // Hardware Reset: CPU is automatically halted after the reset (JTAG is already configured to 32kHz) + _InitPLL(); // Allow to load Code at JTAG Full Speed + _MapRAMAt0(); // Remap RAM to address 0 + _InitRSTC(); // Enable User Reset to allow execUserReset() execution +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/SAM7_SIM.mac b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/SAM7_SIM.mac new file mode 100644 index 0000000..418a2c3 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/SAM7_SIM.mac @@ -0,0 +1,67 @@ +//========================================================= +// Simulation setup file for esc07_demo project +//========================================================= + +__var _timer0_interrupt_ID; + +irqBreak() +{ + __var __AIC_SMR; + __var __AIC_IECR; + __var __AIC_IVR; + + // read AIC_IECR instead, since not fully supported by simulator + __AIC_IECR = __readMemory32(0xFFFFF120, "Memory"); + if(__AIC_IECR & 0x1000) + { + __AIC_SMR = __readMemory32(0xFFFFF060, "Memory"); + __AIC_IVR = __readMemory32(0xFFFFF0B0, "Memory"); //AIC_IVR = AIC_SVR[x] + __writeMemory32(__AIC_IVR, 0xFFFFF100, "Memory"); //AIC_IVR + __writeMemory32(0x1000, 0xFFFFF10C, "Memory"); //AIC_IPR + __writeMemory32(0x2, 0xFFFFF114, "Memory"); //AIC_CISR + } + + return 0; +} + +setupProcessorRegisters() +{ + // Write TC0_SR.CPCS with correct status for ISR (Clock enabled; RC Compare Flag = TRUE) + __writeMemory32(0x00010010, 0xfffa0020, "Memory"); + + // Set TX ready flag in USART0 status register + // USART0_BASE->US_CSR = AT91C_US_TXRDY + __writeMemory32(0x00000002, 0xfffc0014, "Memory"); +} + +configureTimer0Interrupt() +{ + __var _master_clock_frequency; + __var _timer0_period_cycles; + + // Calculate timer0 frequency in master clock cycles + _master_clock_frequency = 48054857; + _timer0_period_cycles = _master_clock_frequency / 100; + if((_master_clock_frequency % 100) >= 50) + { + _timer0_period_cycles++; + } + + __cancelAllInterrupts(); + __enableInterrupts(); + + _timer0_interrupt_ID = __orderInterrupt("IRQ", _timer0_period_cycles, _timer0_period_cycles, 0, 0, 0, 100); + + if(-1 == _timer0_interrupt_ID) + { + __message "ERROR: failed to order timer 0 interrupt"; + } + + __setCodeBreak("0x18", 0, "irqBreak()", "TRUE", ""); +} + +execUserReset() +{ + setupProcessorRegisters(); + configureTimer0Interrupt(); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/at91SAM7X256_FLASH.icf b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/at91SAM7X256_FLASH.icf new file mode 100644 index 0000000..ab842a2 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/at91SAM7X256_FLASH.icf @@ -0,0 +1,43 @@ +/*###ICF### Section handled by ICF editor, don't touch! ****/ +/*-Editor annotation file-*/ +/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\a_v1_0.xml" */ +/*-Specials-*/ +define symbol __ICFEDIT_intvec_start__ = 0x00000000; +/*-Memory Regions-*/ +define symbol __ICFEDIT_region_ROM_start__ = 0x00000100; +define symbol __ICFEDIT_region_ROM_end__ = 0x0003FFFF; +define symbol __ICFEDIT_region_RAM_start__ = 0x00200000; +define symbol __ICFEDIT_region_RAM_end__ = 0x0020FFFF; +/*-Sizes-*/ +define symbol __ICFEDIT_size_cstack__ = 0x400; +define symbol __ICFEDIT_size_svcstack__ = 0x100; +define symbol __ICFEDIT_size_irqstack__ = 0x100; +define symbol __ICFEDIT_size_fiqstack__ = 0x40; +define symbol __ICFEDIT_size_undstack__ = 0x40; +define symbol __ICFEDIT_size_abtstack__ = 0x40; +define symbol __ICFEDIT_size_heap__ = 0x400; +/**** End of ICF editor section. ###ICF###*/ + + +define memory mem with size = 4G; +define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__]; +define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; + +define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; +define block SVC_STACK with alignment = 8, size = __ICFEDIT_size_svcstack__ { }; +define block IRQ_STACK with alignment = 8, size = __ICFEDIT_size_irqstack__ { }; +define block FIQ_STACK with alignment = 8, size = __ICFEDIT_size_fiqstack__ { }; +define block UND_STACK with alignment = 8, size = __ICFEDIT_size_undstack__ { }; +define block ABT_STACK with alignment = 8, size = __ICFEDIT_size_abtstack__ { }; +define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; + +initialize by copy { readwrite }; +do not initialize { section .noinit }; + +place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; + +place in ROM_region { readonly }; +place in RAM_region { readwrite, + block CSTACK, block SVC_STACK, block IRQ_STACK, block FIQ_STACK, + block UND_STACK, block ABT_STACK, block HEAP }; + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/at91SAM7X256_RAM.icf b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/at91SAM7X256_RAM.icf new file mode 100644 index 0000000..cc79cda --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/Resource/at91SAM7X256_RAM.icf @@ -0,0 +1,42 @@ +/*###ICF### Section handled by ICF editor, don't touch! ****/ +/*-Editor annotation file-*/ +/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\a_v1_0.xml" */ +/*-Specials-*/ +define symbol __ICFEDIT_intvec_start__ = 0x00000000; +/*-Memory Regions-*/ +define symbol __ICFEDIT_region_ROM_start__ = 0x00; +define symbol __ICFEDIT_region_ROM_end__ = 0x00; +define symbol __ICFEDIT_region_RAM_start__ = 0x00000100; +define symbol __ICFEDIT_region_RAM_end__ = 0x0000FFFF; +/*-Sizes-*/ +define symbol __ICFEDIT_size_cstack__ = 0x400; +define symbol __ICFEDIT_size_svcstack__ = 0x100; +define symbol __ICFEDIT_size_irqstack__ = 0x100; +define symbol __ICFEDIT_size_fiqstack__ = 0x40; +define symbol __ICFEDIT_size_undstack__ = 0x40; +define symbol __ICFEDIT_size_abtstack__ = 0x40; +define symbol __ICFEDIT_size_heap__ = 0x800; +/**** End of ICF editor section. ###ICF###*/ + + +define memory mem with size = 4G; +define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; + +define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; +define block SVC_STACK with alignment = 8, size = __ICFEDIT_size_svcstack__ { }; +define block IRQ_STACK with alignment = 8, size = __ICFEDIT_size_irqstack__ { }; +define block FIQ_STACK with alignment = 8, size = __ICFEDIT_size_fiqstack__ { }; +define block UND_STACK with alignment = 8, size = __ICFEDIT_size_undstack__ { }; +define block ABT_STACK with alignment = 8, size = __ICFEDIT_size_abtstack__ { }; +define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; + +initialize by copy { readwrite }; +do not initialize { section .noinit }; + +place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; + +place in RAM_region { readonly }; +place in RAM_region { readwrite, + block CSTACK, block SVC_STACK, block IRQ_STACK, block FIQ_STACK, + block UND_STACK, block ABT_STACK, block HEAP }; + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/cmock_demo.dep b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/cmock_demo.dep new file mode 100644 index 0000000..456f4db --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/cmock_demo.dep @@ -0,0 +1,4204 @@ + + + + 2 + 3270150602 + + Binary + + $PROJ_DIR$\Binary\Obj\TimerConductor.o + $TOOLKIT_DIR$\inc\DLib_Defaults.h + $TOOLKIT_DIR$\inc\DLib_Threads.h + $PROJ_DIR$\Binary\Obj\TimerConductor.pbi + $PROJ_DIR$\Binary\List\TimerInterruptConfigurator.lst + $PROJ_DIR$\Binary\Obj\AdcTemperatureSensor.o + $PROJ_DIR$\..\..\test\system\src\TimerInterruptConfigurator.h + $PROJ_DIR$\..\..\test\system\src\TimerModel.h + $TOOLKIT_DIR$\inc\ymath.h + $PROJ_DIR$\Binary\Obj\Cstartup_SAM7.o + $TOOLKIT_DIR$\inc\DLib_Product.h + $TOOLKIT_DIR$\inc\math.h + $PROJ_DIR$\Binary\Exe\cmock_demo.hex + $PROJ_DIR$\Binary\Obj\UsartPutChar.pbi + $PROJ_DIR$\..\..\test\system\src\TimerInterruptHandler.h + $PROJ_DIR$\Binary\Obj\AdcConductor.pbi + $PROJ_DIR$\Binary\List\TimerConfigurator.lst + $PROJ_DIR$\Binary\List\TaskScheduler.lst + $PROJ_DIR$\Binary\List\TemperatureCalculator.lst + $PROJ_DIR$\Binary\List\UsartConductor.lst + $PROJ_DIR$\Binary\Obj\UsartConductor.o + $PROJ_DIR$\Binary\Obj\TimerModel.o + $PROJ_DIR$\Binary\Obj\UsartConfigurator.pbi + $PROJ_DIR$\Binary\Obj\TimerInterruptConfigurator.o + $PROJ_DIR$\Binary\List\Cstartup.lst + $PROJ_DIR$\..\..\test\system\src\Executor.h + $PROJ_DIR$\incIAR\project.h + $PROJ_DIR$\Binary\Obj\Executor.pbi + $PROJ_DIR$\Binary\List\TimerConductor.lst + $PROJ_DIR$\Binary\Obj\TimerModel.pbi + $TOOLKIT_DIR$\inc\intrinsics.h + $PROJ_DIR$\Binary\Obj\Model.pbi + $PROJ_DIR$\Binary\Obj\UsartBaudRateRegisterCalculator.o + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.h + $PROJ_DIR$\..\..\examples\src\UsartModel.h + $PROJ_DIR$\Binary\Obj\TaskScheduler.pbi + $PROJ_DIR$\Binary\Obj\Executor.o + $PROJ_DIR$\Binary\Obj\TemperatureCalculator.o + $PROJ_DIR$\Binary\Obj\Cstartup_SAM7.pbi + $PROJ_DIR$\..\..\test\system\src\AT91SAM7X256.h + $PROJ_DIR$\Binary\Obj\IntrinsicsWrapper.pbi + $PROJ_DIR$\..\..\examples\src\UsartHardware.h + $PROJ_DIR$\Binary\List\Main.lst + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.h + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.h + $PROJ_DIR$\Binary\List\TimerHardware.lst + $PROJ_DIR$\..\..\test\system\src\UsartBaudRateRegisterCalculator.h + $PROJ_DIR$\..\..\test\system\src\TemperatureCalculator.h + $PROJ_DIR$\..\..\test\system\src\UsartPutChar.h + $PROJ_DIR$\..\..\test\system\src\TaskScheduler.h + $PROJ_DIR$\Binary\List\UsartTransmitBufferStatus.lst + $PROJ_DIR$\Binary\Obj\AdcTemperatureSensor.pbi + $PROJ_DIR$\Binary\Obj\Main.pbi + $PROJ_DIR$\Binary\List\UsartModel.lst + $PROJ_DIR$\Binary\Obj\TemperatureFilter.pbi + $PROJ_DIR$\Binary\List\AdcHardware.lst + $PROJ_DIR$\Binary\List\AdcTemperatureSensor.lst + $PROJ_DIR$\Binary\Obj\UsartTransmitBufferStatus.pbi + $PROJ_DIR$\Binary\Obj\AdcHardware.pbi + $PROJ_DIR$\Binary\Obj\TemperatureCalculator.pbi + $TOOLKIT_DIR$\lib\dl4t_tl_in.a + $TOOLKIT_DIR$\inc\ycheck.h + $PROJ_DIR$\..\..\test\system\src\ModelConfig.h + $PROJ_DIR$\Binary\List\AdcConductor.lst + $PROJ_DIR$\Binary\List\AdcHardwareConfigurator.lst + $PROJ_DIR$\Binary\Obj\TimerHardware.o + $PROJ_DIR$\Binary\Obj\TimerInterruptHandler.o + $TOOLKIT_DIR$\inc\stdio.h + $PROJ_DIR$\Binary\Obj\UsartHardware.o + $PROJ_DIR$\Binary\Obj\TimerInterruptHandler.pbi + $PROJ_DIR$\Binary\Obj\UsartModel.o + $TOOLKIT_DIR$\inc\DLib_Config_Normal.h + $PROJ_DIR$\Binary\List\TemperatureFilter.lst + $PROJ_DIR$\Binary\List\UsartPutChar.lst + $PROJ_DIR$\Binary\Obj\UsartConfigurator.o + $PROJ_DIR$\..\..\test\system\src\UsartConductor.h + $PROJ_DIR$\Binary\List\AdcModel.lst + $PROJ_DIR$\..\..\test\system\src\TemperatureFilter.h + $PROJ_DIR$\..\..\test\system\src\Types.h + $PROJ_DIR$\..\..\test\system\src\TimerConfigurator.h + $TOOLKIT_DIR$\inc\yvals.h + $PROJ_DIR$\..\..\test\system\src\UsartModel.h + $PROJ_DIR$\Binary\Obj\UsartTransmitBufferStatus.o + $TOOLKIT_DIR$\lib\rt4t_al.a + $PROJ_DIR$\Binary\List\UsartHardware.lst + $TOOLKIT_DIR$\inc\ysizet.h + $PROJ_DIR$\Binary\Obj\AdcModel.o + $PROJ_DIR$\Binary\Obj\AdcConductor.o + $PROJ_DIR$\Binary\Exe\cmock_demo.out + $PROJ_DIR$\..\..\test\system\src\AdcConductor.h + $PROJ_DIR$\..\..\test\system\src\AdcTemperatureSensor.h + $PROJ_DIR$\Binary\Obj\UsartModel.pbi + $PROJ_DIR$\..\..\test\system\src\TimerHardware.h + $PROJ_DIR$\..\..\test\system\src\AdcModel.h + $PROJ_DIR$\..\..\test\system\src\AdcHardware.h + $PROJ_DIR$\Binary\List\UsartBaudRateRegisterCalculator.lst + $PROJ_DIR$\..\..\test\system\src\Model.h + $TOOLKIT_DIR$\lib\shs_l.a + $PROJ_DIR$\..\..\test\system\src\UsartConfigurator.h + $PROJ_DIR$\Binary\Obj\TimerInterruptConfigurator.pbi + $PROJ_DIR$\Binary\List\UsartConfigurator.lst + $PROJ_DIR$\Binary\List\TimerModel.lst + $PROJ_DIR$\..\..\examples\src\Executor.h + $PROJ_DIR$\Binary\Obj\IntrinsicsWrapper.o + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.h + $PROJ_DIR$\..\..\examples\src\UsartConductor.h + $PROJ_DIR$\..\..\test\system\src\AdcTemperatureSensor.c + $PROJ_DIR$\..\..\examples\src\TimerConductor.h + $PROJ_DIR$\Binary\Obj\AdcHardwareConfigurator.o + $TOOLKIT_DIR$\inc\xencoding_limits.h + $PROJ_DIR$\..\..\test\system\src\Main.c + $PROJ_DIR$\..\..\test\system\src\AdcHardwareConfigurator.c + $PROJ_DIR$\..\..\test\system\src\AdcConductor.c + $PROJ_DIR$\..\..\test\system\src\AdcHardware.c + $PROJ_DIR$\..\..\examples\src\TimerModel.h + $PROJ_DIR$\..\..\test\system\src\AdcModel.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.h + $PROJ_DIR$\..\..\test\system\src\Executor.c + $PROJ_DIR$\..\..\examples\src\Model.h + $PROJ_DIR$\..\..\test\system\src\Model.c + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.h + $PROJ_DIR$\..\..\examples\src\UsartPutChar.h + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.h + $PROJ_DIR$\..\..\test\system\src\TemperatureFilter.c + $PROJ_DIR$\..\..\test\system\src\TimerConfigurator.c + $PROJ_DIR$\..\..\test\system\src\TemperatureCalculator.c + $PROJ_DIR$\..\..\test\system\src\TaskScheduler.c + $PROJ_DIR$\..\..\test\system\src\TimerInterruptConfigurator.c + $PROJ_DIR$\Binary\Obj\AdcModel.pbi + $PROJ_DIR$\..\..\test\system\src\TimerConductor.c + $PROJ_DIR$\..\..\test\system\src\TimerInterruptHandler.c + $PROJ_DIR$\Binary\Obj\AdcHardware.o + $PROJ_DIR$\..\..\test\system\src\UsartConfigurator.c + $PROJ_DIR$\..\..\test\system\src\TimerHardware.c + $PROJ_DIR$\..\..\test\system\src\UsartTransmitBufferStatus.c + $PROJ_DIR$\..\..\examples\src\AdcModel.h + $PROJ_DIR$\..\..\test\system\src\TimerModel.c + $PROJ_DIR$\..\..\test\system\src\UsartBaudRateRegisterCalculator.c + $PROJ_DIR$\..\..\test\system\src\UsartConductor.c + $PROJ_DIR$\..\..\examples\src\AdcHardware.h + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.h + $PROJ_DIR$\..\..\test\system\src\UsartHardware.c + $PROJ_DIR$\..\..\test\system\src\UsartModel.c + $PROJ_DIR$\..\..\test\system\src\UsartPutChar.c + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.h + $PROJ_DIR$\..\..\examples\src\ModelConfig.h + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.h + $PROJ_DIR$\..\..\examples\src\Types.h + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.h + $PROJ_DIR$\..\..\examples\src\AdcConductor.h + $PROJ_DIR$\..\..\examples\src\AT91SAM7X256.h + $PROJ_DIR$\..\..\examples\src\TaskScheduler.h + $PROJ_DIR$\..\..\examples\src\TimerHardware.h + $PROJ_DIR$\Binary\Obj\TimerHardware.pbi + $PROJ_DIR$\Binary\Obj\TimerConfigurator.o + $PROJ_DIR$\Binary\List\Model.lst + $PROJ_DIR$\Binary\Obj\Cstartup.o + $PROJ_DIR$\Binary\Obj\TaskScheduler.o + $PROJ_DIR$\Binary\Obj\TemperatureFilter.o + $PROJ_DIR$\..\..\test\system\src\TimerConductor.h + $PROJ_DIR$\Binary\Obj\Model.o + $PROJ_DIR$\..\..\test\system\src\UsartTransmitBufferStatus.h + $PROJ_DIR$\Binary\Obj\UsartHardware.pbi + $PROJ_DIR$\Binary\List\TimerInterruptHandler.lst + $PROJ_DIR$\Binary\Obj\cmock_demo.pbd + $PROJ_DIR$\..\..\test\system\src\UsartHardware.h + $PROJ_DIR$\..\..\test\system\src\AdcHardwareConfigurator.h + $PROJ_DIR$\Binary\Obj\UsartConductor.pbi + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + $PROJ_DIR$\..\..\examples\src\AdcModel.c + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + $PROJ_DIR$\..\..\examples\src\Executor.c + $PROJ_DIR$\..\..\examples\src\Main.c + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + $PROJ_DIR$\..\..\examples\src\Model.c + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + $PROJ_DIR$\Resource\at91SAM7X256_FLASH.icf + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + $PROJ_DIR$\..\..\examples\src\TimerModel.c + $PROJ_DIR$\..\..\examples\src\UsartModel.c + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + $PROJ_DIR$\srcIAR\Cstartup.s + $PROJ_DIR$\Binary\Obj\UsartPutChar.o + $PROJ_DIR$\Binary\Obj\TimerConfigurator.pbi + $PROJ_DIR$\Binary\Obj\Main.o + $PROJ_DIR$\Binary\List\Executor.lst + $PROJ_DIR$\incIAR\AT91SAM7X-EK.h + $PROJ_DIR$\incIAR\lib_AT91SAM7X256.h + $PROJ_DIR$\incIAR\AT91SAM7X256_inc.h + $PROJ_DIR$\Binary\Obj\AdcHardwareConfigurator.pbi + $PROJ_DIR$\Binary\Obj\UsartBaudRateRegisterCalculator.pbi + + + [ROOT_NODE] + + + ILINK + 88 + + + + + $PROJ_DIR$\Binary\Exe\cmock_demo.out + + + OBJCOPY + 12 + + + + + ILINK + 179 87 131 108 86 5 156 9 36 103 198 160 157 37 158 0 154 65 23 66 21 32 20 74 68 70 196 82 97 83 60 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcTemperatureSensor.c + + + BICOMP + 51 + + + ICCARM + 56 5 + + + + + BICOMP + 78 39 90 + + + ICCARM + 78 39 90 + + + + + $PROJ_DIR$\..\..\test\system\src\Main.c + + + BICOMP + 52 + + + ICCARM + 42 198 + + + + + BICOMP + 78 39 25 96 49 47 77 75 165 98 48 81 46 161 159 92 79 6 14 7 89 94 166 90 93 + + + ICCARM + 78 39 25 96 49 47 77 75 165 98 48 81 46 161 159 92 79 6 14 7 89 94 166 90 93 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcHardwareConfigurator.c + + + BICOMP + 203 + + + ICCARM + 64 108 + + + + + BICOMP + 78 39 166 62 + + + ICCARM + 78 39 166 62 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcConductor.c + + + BICOMP + 15 + + + ICCARM + 63 87 + + + + + BICOMP + 78 39 89 93 94 + + + ICCARM + 78 39 89 93 94 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcHardware.c + + + BICOMP + 58 + + + ICCARM + 55 131 + + + + + BICOMP + 78 39 94 166 90 + + + ICCARM + 78 39 94 166 90 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcModel.c + + + BICOMP + 128 + + + ICCARM + 76 86 + + + + + BICOMP + 78 39 93 49 47 77 + + + ICCARM + 78 39 93 49 47 77 + + + + + $PROJ_DIR$\..\..\test\system\src\Executor.c + + + BICOMP + 27 + + + ICCARM + 199 36 + + + + + BICOMP + 78 39 25 96 75 159 89 30 61 + + + ICCARM + 78 39 25 96 75 159 89 30 61 + + + + + $PROJ_DIR$\..\..\test\system\src\Model.c + + + BICOMP + 31 + + + ICCARM + 155 160 + + + + + BICOMP + 96 78 39 49 77 + + + ICCARM + 96 78 39 49 77 + + + + + $PROJ_DIR$\..\..\test\system\src\TemperatureFilter.c + + + BICOMP + 54 + + + ICCARM + 72 158 + + + + + BICOMP + 78 39 77 11 61 8 80 1 10 109 2 + + + ICCARM + 78 39 77 11 61 8 80 1 71 10 109 2 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerConfigurator.c + + + BICOMP + 197 + + + ICCARM + 16 154 + + + + + BICOMP + 78 39 79 6 + + + ICCARM + 78 39 79 6 + + + + + $PROJ_DIR$\..\..\test\system\src\TemperatureCalculator.c + + + BICOMP + 59 + + + ICCARM + 18 37 + + + + + BICOMP + 78 39 47 11 61 8 80 1 10 109 2 + + + ICCARM + 78 39 47 11 61 8 80 1 71 10 109 2 + + + + + $PROJ_DIR$\..\..\test\system\src\TaskScheduler.c + + + BICOMP + 35 + + + ICCARM + 17 157 + + + + + BICOMP + 78 39 49 + + + ICCARM + 78 39 49 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerInterruptConfigurator.c + + + BICOMP + 99 + + + ICCARM + 4 23 + + + + + BICOMP + 78 39 6 14 + + + ICCARM + 78 39 6 14 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerConductor.c + + + BICOMP + 3 + + + ICCARM + 28 0 + + + + + BICOMP + 78 39 159 7 92 14 + + + ICCARM + 78 39 159 7 92 14 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerInterruptHandler.c + + + BICOMP + 69 + + + ICCARM + 163 66 + + + + + BICOMP + 78 39 14 6 + + + ICCARM + 78 39 14 6 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartConfigurator.c + + + BICOMP + 22 + + + ICCARM + 100 74 + + + + + BICOMP + 78 39 98 + + + ICCARM + 78 39 98 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerHardware.c + + + BICOMP + 153 + + + ICCARM + 45 65 + + + + + BICOMP + 78 39 92 79 + + + ICCARM + 78 39 92 79 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartTransmitBufferStatus.c + + + BICOMP + 57 + + + ICCARM + 50 82 + + + + + BICOMP + 78 39 161 + + + ICCARM + 78 39 161 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerModel.c + + + BICOMP + 29 + + + ICCARM + 101 21 + + + + + BICOMP + 78 39 7 49 + + + ICCARM + 78 39 7 49 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartBaudRateRegisterCalculator.c + + + BICOMP + 204 + + + ICCARM + 95 32 + + + + + BICOMP + 78 39 46 + + + ICCARM + 78 39 46 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartConductor.c + + + BICOMP + 167 + + + ICCARM + 19 20 + + + + + BICOMP + 78 39 75 165 81 49 + + + ICCARM + 78 39 75 165 81 49 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartHardware.c + + + BICOMP + 162 + + + ICCARM + 84 68 + + + + + BICOMP + 78 39 165 98 48 + + + ICCARM + 78 39 165 98 48 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartModel.c + + + BICOMP + 91 + + + ICCARM + 53 70 + + + + + BICOMP + 78 39 81 62 46 77 67 61 80 1 10 109 2 85 11 8 + + + ICCARM + 78 39 81 62 46 77 67 61 80 1 71 10 109 2 85 11 8 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartPutChar.c + + + BICOMP + 13 + + + ICCARM + 73 196 + + + + + BICOMP + 78 39 48 161 + + + ICCARM + 78 39 48 161 + + + + + $PROJ_DIR$\Binary\Obj\cmock_demo.pbd + + + BILINK + 15 58 203 128 51 38 27 40 52 31 35 59 54 3 197 153 99 69 29 204 167 22 162 91 13 57 + + + + + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + + + BICOMP + 38 + + + + + BICOMP + 26 30 61 200 150 201 + + + + + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + + + BICOMP + 203 + + + + + BICOMP + 147 150 146 145 + + + + + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + + + BICOMP + 15 + + + ICCARM + 63 87 131 108 86 5 36 103 198 160 157 37 158 0 154 65 23 66 21 32 20 74 68 70 196 82 9 + + + + + BICOMP + 147 150 149 135 139 + + + ICCARM + 147 150 149 135 139 146 144 145 151 148 140 102 118 105 107 120 30 61 41 43 121 34 33 44 152 104 122 116 114 11 8 80 1 71 10 109 2 67 85 26 200 201 + + + + + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + + + BICOMP + 58 + + + + + BICOMP + 147 150 139 146 144 + + + + + $PROJ_DIR$\..\..\examples\src\AdcModel.c + + + BICOMP + 128 + + + + + BICOMP + 147 150 135 151 148 140 + + + + + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + + + BICOMP + 51 + + + + + BICOMP + 147 150 144 + + + + + $PROJ_DIR$\..\..\examples\src\Executor.c + + + BICOMP + 27 + + + + + BICOMP + 147 150 102 118 105 107 149 120 + + + + + $PROJ_DIR$\..\..\examples\src\Main.c + + + BICOMP + 52 + + + + + BICOMP + 147 150 120 102 118 151 148 140 105 41 43 121 34 33 44 107 152 104 122 116 114 149 139 146 144 135 + + + + + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + + + BICOMP + 40 + + + + + BICOMP + 120 30 61 + + + + + $PROJ_DIR$\..\..\examples\src\Model.c + + + BICOMP + 31 + + + + + BICOMP + 118 147 150 151 140 + + + + + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + + + BICOMP + 59 + + + + + BICOMP + 147 150 148 11 61 8 80 1 10 109 2 + + + + + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + + + BICOMP + 35 + + + + + BICOMP + 147 150 151 + + + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + + + BICOMP + 99 + + + + + BICOMP + 147 150 122 116 + + + + + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + + + BICOMP + 54 + + + + + BICOMP + 147 150 140 11 61 8 80 1 10 109 2 + + + + + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + + + BICOMP + 3 + + + + + BICOMP + 147 150 107 114 152 116 + + + + + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + + + BICOMP + 197 + + + + + BICOMP + 147 150 104 122 + + + + + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + + + BICOMP + 153 + + + + + BICOMP + 147 150 152 104 + + + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + + + BICOMP + 69 + + + + + BICOMP + 147 150 116 122 + + + + + $PROJ_DIR$\..\..\examples\src\TimerModel.c + + + BICOMP + 29 + + + + + BICOMP + 147 150 114 151 + + + + + $PROJ_DIR$\..\..\examples\src\UsartModel.c + + + BICOMP + 91 + + + + + BICOMP + 147 150 34 145 33 140 67 61 80 1 10 109 2 85 11 8 + + + + + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + + + BICOMP + 204 + + + + + BICOMP + 147 150 33 + + + + + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + + + BICOMP + 167 + + + + + BICOMP + 147 150 105 41 34 151 + + + + + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + + + BICOMP + 22 + + + + + BICOMP + 147 150 43 + + + + + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + + + BICOMP + 162 + + + + + BICOMP + 147 150 41 43 121 + + + + + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + + + BICOMP + 57 + + + + + BICOMP + 147 150 44 + + + + + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + + + BICOMP + 13 + + + + + BICOMP + 147 150 121 44 + + + + + $PROJ_DIR$\srcIAR\Cstartup.s + + + AARM + 156 24 + + + + + AARM + 202 + + + + + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\AdcModel.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\Executor.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\Main.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\Model.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\TimerModel.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\UsartModel.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + ICCARM + + + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + ICCARM + + + + FLASH_Debug + + $TOOLKIT_DIR$\inc\DLib_Defaults.h + $TOOLKIT_DIR$\inc\DLib_Threads.h + $PROJ_DIR$\..\..\test\system\src\TimerInterruptConfigurator.h + $PROJ_DIR$\..\..\test\system\src\TimerModel.h + $TOOLKIT_DIR$\inc\ymath.h + $TOOLKIT_DIR$\inc\DLib_Product.h + $TOOLKIT_DIR$\inc\math.h + $PROJ_DIR$\..\..\test\system\src\TimerInterruptHandler.h + $PROJ_DIR$\..\..\test\system\src\Executor.h + $PROJ_DIR$\incIAR\project.h + $TOOLKIT_DIR$\inc\intrinsics.h + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.h + $PROJ_DIR$\..\..\examples\src\UsartModel.h + $PROJ_DIR$\..\..\test\system\src\AT91SAM7X256.h + $PROJ_DIR$\..\..\examples\src\UsartHardware.h + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.h + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.h + $PROJ_DIR$\..\..\test\system\src\UsartBaudRateRegisterCalculator.h + $PROJ_DIR$\..\..\test\system\src\TemperatureCalculator.h + $PROJ_DIR$\..\..\test\system\src\UsartPutChar.h + $PROJ_DIR$\..\..\test\system\src\TaskScheduler.h + $TOOLKIT_DIR$\lib\dl4t_tl_in.a + $TOOLKIT_DIR$\inc\ycheck.h + $PROJ_DIR$\..\..\test\system\src\ModelConfig.h + $TOOLKIT_DIR$\inc\stdio.h + $TOOLKIT_DIR$\inc\DLib_Config_Normal.h + $PROJ_DIR$\..\..\test\system\src\UsartConductor.h + $PROJ_DIR$\..\..\test\system\src\TemperatureFilter.h + $PROJ_DIR$\..\..\test\system\src\Types.h + $PROJ_DIR$\..\..\test\system\src\TimerConfigurator.h + $TOOLKIT_DIR$\inc\yvals.h + $PROJ_DIR$\..\..\test\system\src\UsartModel.h + $TOOLKIT_DIR$\lib\rt4t_al.a + $TOOLKIT_DIR$\inc\ysizet.h + $PROJ_DIR$\..\..\test\system\src\AdcConductor.h + $PROJ_DIR$\..\..\test\system\src\AdcTemperatureSensor.h + $PROJ_DIR$\..\..\test\system\src\TimerHardware.h + $PROJ_DIR$\..\..\test\system\src\AdcModel.h + $PROJ_DIR$\..\..\test\system\src\AdcHardware.h + $PROJ_DIR$\..\..\test\system\src\Model.h + $TOOLKIT_DIR$\lib\shs_l.a + $PROJ_DIR$\..\..\test\system\src\UsartConfigurator.h + $PROJ_DIR$\..\..\examples\src\Executor.h + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.h + $PROJ_DIR$\..\..\examples\src\UsartConductor.h + $PROJ_DIR$\..\..\test\system\src\AdcTemperatureSensor.c + $PROJ_DIR$\..\..\examples\src\TimerConductor.h + $TOOLKIT_DIR$\inc\xencoding_limits.h + $PROJ_DIR$\FLASH_Debug\Obj\cmock_demo.pbd + $PROJ_DIR$\..\..\test\system\src\Main.c + $PROJ_DIR$\..\..\test\system\src\AdcHardwareConfigurator.c + $PROJ_DIR$\..\..\test\system\src\AdcConductor.c + $PROJ_DIR$\..\..\test\system\src\AdcHardware.c + $PROJ_DIR$\..\..\examples\src\TimerModel.h + $PROJ_DIR$\..\..\test\system\src\AdcModel.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.h + $PROJ_DIR$\..\..\test\system\src\Executor.c + $PROJ_DIR$\..\..\examples\src\Model.h + $PROJ_DIR$\..\..\test\system\src\Model.c + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.h + $PROJ_DIR$\..\..\examples\src\UsartPutChar.h + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.h + $PROJ_DIR$\..\..\test\system\src\TemperatureFilter.c + $PROJ_DIR$\..\..\test\system\src\TimerConfigurator.c + $PROJ_DIR$\..\..\test\system\src\TemperatureCalculator.c + $PROJ_DIR$\..\..\test\system\src\TaskScheduler.c + $PROJ_DIR$\..\..\test\system\src\TimerInterruptConfigurator.c + $PROJ_DIR$\..\..\test\system\src\TimerConductor.c + $PROJ_DIR$\..\..\test\system\src\TimerInterruptHandler.c + $PROJ_DIR$\..\..\test\system\src\UsartConfigurator.c + $PROJ_DIR$\..\..\test\system\src\TimerHardware.c + $PROJ_DIR$\..\..\test\system\src\UsartTransmitBufferStatus.c + $PROJ_DIR$\..\..\examples\src\AdcModel.h + $PROJ_DIR$\..\..\test\system\src\TimerModel.c + $PROJ_DIR$\..\..\test\system\src\UsartBaudRateRegisterCalculator.c + $PROJ_DIR$\..\..\test\system\src\UsartConductor.c + $PROJ_DIR$\..\..\examples\src\AdcHardware.h + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.h + $PROJ_DIR$\..\..\test\system\src\UsartHardware.c + $PROJ_DIR$\..\..\test\system\src\UsartModel.c + $PROJ_DIR$\..\..\test\system\src\UsartPutChar.c + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.h + $PROJ_DIR$\..\..\examples\src\ModelConfig.h + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.h + $PROJ_DIR$\..\..\examples\src\Types.h + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.h + $PROJ_DIR$\..\..\examples\src\AdcConductor.h + $PROJ_DIR$\..\..\examples\src\AT91SAM7X256.h + $PROJ_DIR$\..\..\examples\src\TaskScheduler.h + $PROJ_DIR$\..\..\examples\src\TimerHardware.h + $PROJ_DIR$\..\..\test\system\src\TimerConductor.h + $PROJ_DIR$\..\..\test\system\src\UsartTransmitBufferStatus.h + $PROJ_DIR$\..\..\test\system\src\UsartHardware.h + $PROJ_DIR$\FLASH_Debug\Obj\Main.o + $PROJ_DIR$\..\..\test\system\src\AdcHardwareConfigurator.h + $PROJ_DIR$\FLASH_Debug\List\TimerHardware.lst + $PROJ_DIR$\FLASH_Debug\List\ext_irq.lst + $PROJ_DIR$\FLASH_Debug\Obj\Cstartup.o + $PROJ_DIR$\FLASH_Debug\Obj\TimerConfigurator.pbi + $PROJ_DIR$\FLASH_Debug\List\UsartHardware.lst + $PROJ_DIR$\..\src\ext_irq.c + $PROJ_DIR$\FLASH_Debug\Obj\interrupt_Usart.o + $PROJ_DIR$\FLASH_Debug\Obj\interrupt_Usart.pbi + $PROJ_DIR$\FLASH_Debug\Obj\TimerModel.o + $PROJ_DIR$\FLASH_Debug\Obj\main.pbi + $PROJ_DIR$\FLASH_Debug\List\Model.lst + $PROJ_DIR$\FLASH_Debug\Obj\AdcModel.o + $PROJ_DIR$\FLASH_Debug\Obj\UsartHardware.o + $PROJ_DIR$\FLASH_Debug\Obj\UsartPutChar.o + $PROJ_DIR$\FLASH_Debug\Obj\TemperatureCalculator.pbi + $PROJ_DIR$\FLASH_Debug\List\AdcConductor.lst + $PROJ_DIR$\FLASH_Debug\Obj\UsartTransmitBufferStatus.pbi + $PROJ_DIR$\FLASH_Debug\Obj\AdcConductor.pbi + $PROJ_DIR$\FLASH_Debug\Obj\Model.pbi + $PROJ_DIR$\FLASH_Debug\Obj\Cstartup_SAM7.o + $PROJ_DIR$\FLASH_Debug\Obj\IntrinsicsWrapper.o + $PROJ_DIR$\FLASH_Debug\Obj\IntrinsicsWrapper.pbi + $PROJ_DIR$\FLASH_Debug\Obj\AdcHardware.o + $PROJ_DIR$\FLASH_Debug\Obj\UsartPutChar.pbi + $PROJ_DIR$\FLASH_Debug\Obj\UsartBaudRateRegisterCalculator.pbi + $PROJ_DIR$\FLASH_Debug\List\interrupt_timer.lst + $PROJ_DIR$\FLASH_Debug\List\Cstartup_SAM7.lst + $PROJ_DIR$\FLASH_Debug\Obj\AdcHardwareConfigurator.o + $PROJ_DIR$\FLASH_Debug\List\AdcHardwareConfigurator.lst + $PROJ_DIR$\FLASH_Debug\Obj\TemperatureFilter.pbi + $PROJ_DIR$\FLASH_Debug\Obj\TimerConductor.pbi + $PROJ_DIR$\..\..\include\lib_AT91SAM7X256.h + $PROJ_DIR$\FLASH_Debug\Obj\TaskScheduler.o + $PROJ_DIR$\FLASH_Debug\Obj\TemperatureFilter.o + $PROJ_DIR$\FLASH_Debug\Obj\ext_irq.pbi + $PROJ_DIR$\..\..\include\AT91SAM7X256.h + $PROJ_DIR$\FLASH_Debug\Obj\AdcModel.pbi + $PROJ_DIR$\FLASH_Debug\Obj\TimerInterruptConfigurator.o + $PROJ_DIR$\FLASH_Debug\List\AdcModel.lst + $PROJ_DIR$\FLASH_Debug\List\interrupt_Usart.lst + $PROJ_DIR$\FLASH_Debug\List\Cstartup.lst + $PROJ_DIR$\FLASH_Debug\Obj\UsartHardware.pbi + $PROJ_DIR$\FLASH_Debug\List\TimerModel.lst + $PROJ_DIR$\FLASH_Debug\Obj\UsartConductor.o + $PROJ_DIR$\FLASH_Debug\Obj\UsartConfigurator.o + $PROJ_DIR$\FLASH_Debug\List\UsartPutChar.lst + $PROJ_DIR$\FLASH_Debug\List\TemperatureFilter.lst + $PROJ_DIR$\FLASH_Debug\Obj\TimerInterruptHandler.pbi + $PROJ_DIR$\FLASH_Debug\List\TemperatureCalculator.lst + $PROJ_DIR$\FLASH_Debug\List\UsartTransmitBufferStatus.lst + $PROJ_DIR$\FLASH_Debug\Obj\UsartModel.pbi + $PROJ_DIR$\FLASH_Debug\List\UsartConductor.lst + $PROJ_DIR$\FLASH_Debug\List\TimerConfigurator.lst + $PROJ_DIR$\FLASH_Debug\Obj\Model.o + $PROJ_DIR$\FLASH_Debug\List\Executor.lst + $PROJ_DIR$\FLASH_Debug\List\UsartModel.lst + $PROJ_DIR$\FLASH_Debug\List\TimerInterruptHandler.lst + $PROJ_DIR$\FLASH_Debug\List\Main.lst + $PROJ_DIR$\FLASH_Debug\List\TimerInterruptConfigurator.lst + $PROJ_DIR$\FLASH_Debug\Exe\cmock_demo.out + $PROJ_DIR$\FLASH_Debug\Obj\TimerHardware.pbi + $PROJ_DIR$\FLASH_Debug\Obj\TaskScheduler.pbi + $PROJ_DIR$\FLASH_Debug\Obj\TimerModel.pbi + $PROJ_DIR$\FLASH_Debug\Obj\AdcConductor.o + $PROJ_DIR$\FLASH_Debug\Obj\AdcTemperatureSensor.o + $PROJ_DIR$\..\src\AT91SAM7X-EK.h + $PROJ_DIR$\FLASH_Debug\Obj\UsartTransmitBufferStatus.o + $PROJ_DIR$\FLASH_Debug\Obj\AdcHardware.pbi + $PROJ_DIR$\FLASH_Debug\Obj\UsartBaudRateRegisterCalculator.o + $PROJ_DIR$\FLASH_Debug\Obj\ext_irq.o + $PROJ_DIR$\FLASH_Debug\Obj\AdcTemperatureSensor.pbi + $PROJ_DIR$\FLASH_Debug\Obj\TemperatureCalculator.o + $PROJ_DIR$\FLASH_Debug\Obj\TimerHardware.o + $PROJ_DIR$\FLASH_Debug\Obj\UsartModel.o + $PROJ_DIR$\FLASH_Debug\List\UsartConfigurator.lst + $PROJ_DIR$\FLASH_Debug\Obj\TimerConductor.o + $PROJ_DIR$\srcIAR\project.h + $PROJ_DIR$\FLASH_Debug\List\UsartBaudRateRegisterCalculator.lst + $PROJ_DIR$\FLASH_Debug\Obj\AdcHardwareConfigurator.pbi + $PROJ_DIR$\FLASH_Debug\Obj\TimerInterruptHandler.o + $PROJ_DIR$\FLASH_Debug\List\TimerConductor.lst + $PROJ_DIR$\FLASH_Debug\Obj\Cstartup_SAM7.pbi + $PROJ_DIR$\FLASH_Debug\Obj\UsartConductor.pbi + $PROJ_DIR$\FLASH_Debug\Obj\UsartConfigurator.pbi + $PROJ_DIR$\FLASH_Debug\Obj\Executor.o + $PROJ_DIR$\FLASH_Debug\List\AdcHardware.lst + $PROJ_DIR$\FLASH_Debug\Obj\Executor.pbi + $PROJ_DIR$\..\src\interrupt_timer.c + $PROJ_DIR$\..\src\interrupt_Usart.c + $PROJ_DIR$\FLASH_Debug\Obj\TimerInterruptConfigurator.pbi + $PROJ_DIR$\..\src\main.c + $PROJ_DIR$\FLASH_Debug\Obj\TimerConfigurator.o + $PROJ_DIR$\FLASH_Debug\List\AdcTemperatureSensor.lst + $PROJ_DIR$\FLASH_Debug\List\TaskScheduler.lst + $PROJ_DIR$\FLASH_Debug\Obj\interrupt_timer.o + $PROJ_DIR$\FLASH_Debug\List\IntrinsicsWrapper.lst + $PROJ_DIR$\FLASH_Debug\Obj\interrupt_timer.pbi + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + $PROJ_DIR$\..\..\examples\src\AdcModel.c + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + $PROJ_DIR$\..\..\examples\src\Executor.c + $PROJ_DIR$\..\..\examples\src\Main.c + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + $PROJ_DIR$\..\..\examples\src\Model.c + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + $PROJ_DIR$\Resource\at91SAM7X256_FLASH.icf + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + $PROJ_DIR$\..\..\examples\src\TimerModel.c + $PROJ_DIR$\..\..\examples\src\UsartModel.c + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + $PROJ_DIR$\srcIAR\Cstartup.s + $PROJ_DIR$\incIAR\AT91SAM7X-EK.h + $PROJ_DIR$\incIAR\lib_AT91SAM7X256.h + $PROJ_DIR$\incIAR\AT91SAM7X256_inc.h + + + [ROOT_NODE] + + + ILINK + 154 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcTemperatureSensor.c + + + BICOMP + 165 + + + ICCARM + 187 159 + + + + + ICCARM + 28 13 35 + + + + + $PROJ_DIR$\FLASH_Debug\Obj\cmock_demo.pbd + + + BILINK + 112 162 173 131 165 176 181 116 113 156 109 124 125 98 155 184 142 157 119 177 178 136 145 118 111 104 + + + + + $PROJ_DIR$\..\..\test\system\src\Main.c + + + BICOMP + 104 + + + ICCARM + 152 93 + + + + + ICCARM + 28 13 8 39 20 18 27 26 92 41 19 31 17 91 90 36 29 2 7 3 34 38 94 35 37 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcHardwareConfigurator.c + + + BICOMP + 173 + + + ICCARM + 123 122 + + + + + ICCARM + 28 13 94 23 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcConductor.c + + + BICOMP + 112 + + + ICCARM + 110 158 + + + + + ICCARM + 28 13 34 37 38 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcHardware.c + + + BICOMP + 162 + + + ICCARM + 180 117 + + + + + ICCARM + 28 13 38 94 35 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcModel.c + + + BICOMP + 131 + + + ICCARM + 133 106 + + + + + ICCARM + 28 13 37 20 18 27 + + + + + $PROJ_DIR$\..\..\test\system\src\Executor.c + + + BICOMP + 181 + + + ICCARM + 149 179 + + + + + ICCARM + 28 13 8 39 26 90 34 10 22 + + + + + $PROJ_DIR$\..\..\test\system\src\Model.c + + + BICOMP + 113 + + + ICCARM + 105 148 + + + + + ICCARM + 39 28 13 20 27 + + + + + $PROJ_DIR$\..\..\test\system\src\TemperatureFilter.c + + + BICOMP + 124 + + + ICCARM + 141 128 + + + + + ICCARM + 28 13 27 6 22 4 30 0 25 5 47 1 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerConfigurator.c + + + BICOMP + 98 + + + ICCARM + 147 186 + + + + + ICCARM + 28 13 29 2 + + + + + $PROJ_DIR$\..\..\test\system\src\TemperatureCalculator.c + + + BICOMP + 109 + + + ICCARM + 143 166 + + + + + ICCARM + 28 13 18 6 22 4 30 0 25 5 47 1 + + + + + $PROJ_DIR$\..\..\test\system\src\TaskScheduler.c + + + BICOMP + 156 + + + ICCARM + 188 127 + + + + + ICCARM + 28 13 20 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerInterruptConfigurator.c + + + BICOMP + 184 + + + ICCARM + 153 132 + + + + + ICCARM + 28 13 2 7 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerConductor.c + + + BICOMP + 125 + + + ICCARM + 175 170 + + + + + ICCARM + 28 13 90 3 36 7 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerInterruptHandler.c + + + BICOMP + 142 + + + ICCARM + 151 174 + + + + + ICCARM + 28 13 7 2 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartConfigurator.c + + + BICOMP + 178 + + + ICCARM + 169 139 + + + + + ICCARM + 28 13 41 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerHardware.c + + + BICOMP + 155 + + + ICCARM + 95 167 + + + + + ICCARM + 28 13 36 29 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartTransmitBufferStatus.c + + + BICOMP + 111 + + + ICCARM + 144 161 + + + + + ICCARM + 28 13 91 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerModel.c + + + BICOMP + 157 + + + ICCARM + 137 103 + + + + + ICCARM + 28 13 3 20 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartBaudRateRegisterCalculator.c + + + BICOMP + 119 + + + ICCARM + 172 163 + + + + + ICCARM + 28 13 17 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartConductor.c + + + BICOMP + 177 + + + ICCARM + 146 138 + + + + + ICCARM + 28 13 26 92 31 20 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartHardware.c + + + BICOMP + 136 + + + ICCARM + 99 107 + + + + + ICCARM + 28 13 92 41 19 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartModel.c + + + BICOMP + 145 + + + ICCARM + 150 168 + + + + + ICCARM + 28 13 31 23 17 27 24 22 30 0 25 5 47 1 33 6 4 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartPutChar.c + + + BICOMP + 118 + + + ICCARM + 140 108 + + + + + ICCARM + 28 13 19 91 + + + + + $PROJ_DIR$\..\src\ext_irq.c + + + BICOMP + 129 + + + ICCARM + 96 164 + + + + + BICOMP + 171 10 22 160 130 126 + + + ICCARM + 171 10 22 160 130 126 + + + + + $PROJ_DIR$\FLASH_Debug\Exe\cmock_demo.out + + + ILINK + 203 158 117 122 106 159 97 114 179 115 93 148 127 166 128 170 186 167 132 174 103 163 138 139 107 168 108 161 40 32 21 + + + + + $PROJ_DIR$\..\src\interrupt_timer.c + + + BICOMP + 191 + + + ICCARM + 120 189 + + + + + BICOMP + 171 10 22 160 130 126 + + + ICCARM + 171 10 22 160 130 126 + + + + + $PROJ_DIR$\..\src\interrupt_Usart.c + + + BICOMP + 102 + + + ICCARM + 134 101 + + + + + BICOMP + 171 10 22 160 130 126 + + + ICCARM + 171 10 22 160 130 126 + + + + + $PROJ_DIR$\..\src\main.c + + + BICOMP + 104 + + + ICCARM + 152 93 + + + + + BICOMP + 171 10 22 160 130 126 + + + ICCARM + 171 10 22 160 130 126 + + + + + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + + + BICOMP + 176 + + + ICCARM + 121 114 + + + + + BICOMP + 9 10 22 220 221 + + + ICCARM + 9 10 22 220 87 221 + + + + + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + + + BICOMP + 173 + + + ICCARM + 123 122 + + + + + BICOMP + 84 87 83 82 + + + ICCARM + 84 87 83 82 + + + + + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + + + BICOMP + 112 + + + ICCARM + 110 158 + + + + + BICOMP + 84 87 86 72 76 + + + ICCARM + 84 87 86 72 76 + + + + + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + + + BICOMP + 162 + + + ICCARM + 180 117 + + + + + BICOMP + 84 87 76 83 81 + + + ICCARM + 84 87 76 83 81 + + + + + $PROJ_DIR$\..\..\examples\src\AdcModel.c + + + BICOMP + 131 + + + ICCARM + 133 106 + + + + + BICOMP + 84 87 72 88 85 77 + + + ICCARM + 84 87 72 88 85 77 + + + + + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + + + BICOMP + 165 + + + ICCARM + 187 159 + + + + + BICOMP + 84 87 81 + + + ICCARM + 84 87 81 + + + + + $PROJ_DIR$\..\..\examples\src\Executor.c + + + BICOMP + 181 + + + ICCARM + 149 179 + + + + + BICOMP + 84 87 42 57 44 46 86 59 + + + ICCARM + 84 87 42 57 44 46 86 59 + + + + + $PROJ_DIR$\..\..\examples\src\Main.c + + + BICOMP + 104 + + + ICCARM + 152 93 + + + + + BICOMP + 84 87 59 42 57 88 85 77 44 14 15 60 12 11 16 46 89 43 61 55 53 86 76 83 81 72 + + + ICCARM + 84 87 59 42 57 88 85 77 44 14 15 60 12 11 16 46 89 43 61 55 53 86 76 83 81 72 + + + + + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + + + BICOMP + 116 + + + ICCARM + 190 115 + + + + + BICOMP + 59 10 22 + + + ICCARM + 59 10 22 + + + + + $PROJ_DIR$\..\..\examples\src\Model.c + + + BICOMP + 113 + + + ICCARM + 105 148 + + + + + BICOMP + 57 84 87 88 77 + + + ICCARM + 57 84 87 88 77 + + + + + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + + + BICOMP + 109 + + + ICCARM + 143 166 + + + + + BICOMP + 84 87 85 6 22 4 30 0 5 47 1 + + + ICCARM + 84 87 85 6 22 4 30 0 25 5 47 1 + + + + + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + + + BICOMP + 156 + + + ICCARM + 188 127 + + + + + BICOMP + 84 87 88 + + + ICCARM + 84 87 88 + + + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + + + BICOMP + 184 + + + ICCARM + 153 132 + + + + + BICOMP + 84 87 61 55 + + + ICCARM + 84 87 61 55 + + + + + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + + + BICOMP + 124 + + + ICCARM + 141 128 + + + + + BICOMP + 84 87 77 6 22 4 30 0 5 47 1 + + + ICCARM + 84 87 77 6 22 4 30 0 25 5 47 1 + + + + + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + + + BICOMP + 125 + + + ICCARM + 175 170 + + + + + BICOMP + 84 87 46 53 89 55 + + + ICCARM + 84 87 46 53 89 55 + + + + + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + + + BICOMP + 98 + + + ICCARM + 147 186 + + + + + BICOMP + 84 87 43 61 + + + ICCARM + 84 87 43 61 + + + + + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + + + BICOMP + 155 + + + ICCARM + 95 167 + + + + + BICOMP + 84 87 89 43 + + + ICCARM + 84 87 89 43 + + + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + + + BICOMP + 142 + + + ICCARM + 151 174 + + + + + BICOMP + 84 87 55 61 + + + ICCARM + 84 87 55 61 + + + + + $PROJ_DIR$\..\..\examples\src\TimerModel.c + + + BICOMP + 157 + + + ICCARM + 137 103 + + + + + BICOMP + 84 87 53 88 + + + ICCARM + 84 87 53 88 + + + + + $PROJ_DIR$\..\..\examples\src\UsartModel.c + + + BICOMP + 145 + + + ICCARM + 150 168 + + + + + ICCARM + 84 87 12 82 11 77 24 22 30 0 25 5 47 1 33 6 4 + + + + + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + + + BICOMP + 119 + + + ICCARM + 172 163 + + + + + BICOMP + 84 87 11 + + + ICCARM + 84 87 11 + + + + + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + + + BICOMP + 177 + + + ICCARM + 146 138 + + + + + BICOMP + 84 87 44 14 12 88 + + + ICCARM + 84 87 44 14 12 88 + + + + + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + + + BICOMP + 178 + + + ICCARM + 169 139 + + + + + BICOMP + 84 87 15 + + + ICCARM + 84 87 15 + + + + + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + + + BICOMP + 136 + + + ICCARM + 99 107 + + + + + BICOMP + 84 87 14 15 60 + + + ICCARM + 84 87 14 15 60 + + + + + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + + + BICOMP + 111 + + + ICCARM + 144 161 + + + + + ICCARM + 84 87 16 + + + + + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + + + BICOMP + 118 + + + ICCARM + 140 108 + + + + + ICCARM + 84 87 60 16 + + + + + $PROJ_DIR$\srcIAR\Cstartup.s + + + AARM + 97 135 + + + + + AARM + 222 + + + + + + RAM_Debug + + $PROJ_DIR$\Resource\SAM7_FLASH.mac + $TOOLKIT_DIR$\inc\DLib_Defaults.h + $TOOLKIT_DIR$\inc\DLib_Threads.h + $PROJ_DIR$\..\..\test\system\src\TimerInterruptConfigurator.h + $PROJ_DIR$\..\..\test\system\src\TimerModel.h + $TOOLKIT_DIR$\inc\ymath.h + $TOOLKIT_DIR$\inc\DLib_Product.h + $TOOLKIT_DIR$\inc\math.h + $PROJ_DIR$\..\..\test\system\src\TimerInterruptHandler.h + $PROJ_DIR$\..\..\test\system\src\Executor.h + $PROJ_DIR$\incIAR\project.h + $TOOLKIT_DIR$\inc\intrinsics.h + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.h + $PROJ_DIR$\..\..\examples\src\UsartModel.h + $PROJ_DIR$\..\..\test\system\src\AT91SAM7X256.h + $PROJ_DIR$\..\..\examples\src\UsartHardware.h + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.h + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.h + $PROJ_DIR$\..\..\test\system\src\UsartBaudRateRegisterCalculator.h + $PROJ_DIR$\..\..\test\system\src\TemperatureCalculator.h + $PROJ_DIR$\..\..\test\system\src\UsartPutChar.h + $PROJ_DIR$\..\..\test\system\src\TaskScheduler.h + $TOOLKIT_DIR$\lib\dl4t_tl_in.a + $TOOLKIT_DIR$\inc\ycheck.h + $PROJ_DIR$\..\..\test\system\src\ModelConfig.h + $TOOLKIT_DIR$\inc\stdio.h + $TOOLKIT_DIR$\inc\DLib_Config_Normal.h + $PROJ_DIR$\..\..\test\system\src\UsartConductor.h + $PROJ_DIR$\..\..\test\system\src\TemperatureFilter.h + $PROJ_DIR$\..\..\test\system\src\Types.h + $PROJ_DIR$\..\..\test\system\src\TimerConfigurator.h + $TOOLKIT_DIR$\inc\yvals.h + $PROJ_DIR$\..\..\test\system\src\UsartModel.h + $TOOLKIT_DIR$\lib\rt4t_al.a + $TOOLKIT_DIR$\inc\ysizet.h + $PROJ_DIR$\..\..\test\system\src\AdcConductor.h + $PROJ_DIR$\..\..\test\system\src\AdcTemperatureSensor.h + $PROJ_DIR$\..\..\test\system\src\TimerHardware.h + $PROJ_DIR$\..\..\test\system\src\AdcModel.h + $PROJ_DIR$\..\..\test\system\src\AdcHardware.h + $PROJ_DIR$\..\..\test\system\src\Model.h + $TOOLKIT_DIR$\lib\shs_l.a + $PROJ_DIR$\..\..\test\system\src\UsartConfigurator.h + $PROJ_DIR$\..\..\examples\src\Executor.h + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.h + $PROJ_DIR$\..\..\examples\src\UsartConductor.h + $PROJ_DIR$\..\..\test\system\src\AdcTemperatureSensor.c + $PROJ_DIR$\..\..\examples\src\TimerConductor.h + $TOOLKIT_DIR$\inc\xencoding_limits.h + $PROJ_DIR$\..\..\test\system\src\Main.c + $PROJ_DIR$\..\..\test\system\src\AdcHardwareConfigurator.c + $PROJ_DIR$\..\..\test\system\src\AdcConductor.c + $PROJ_DIR$\..\..\test\system\src\AdcHardware.c + $PROJ_DIR$\..\..\examples\src\TimerModel.h + $PROJ_DIR$\..\..\test\system\src\AdcModel.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.h + $PROJ_DIR$\..\..\test\system\src\Executor.c + $PROJ_DIR$\..\..\examples\src\Model.h + $PROJ_DIR$\..\..\test\system\src\Model.c + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.h + $PROJ_DIR$\..\..\examples\src\UsartPutChar.h + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.h + $PROJ_DIR$\..\..\test\system\src\TemperatureFilter.c + $PROJ_DIR$\..\..\test\system\src\TimerConfigurator.c + $PROJ_DIR$\..\..\test\system\src\TemperatureCalculator.c + $PROJ_DIR$\..\..\test\system\src\TaskScheduler.c + $PROJ_DIR$\..\..\test\system\src\TimerInterruptConfigurator.c + $PROJ_DIR$\..\..\test\system\src\TimerConductor.c + $PROJ_DIR$\..\..\test\system\src\TimerInterruptHandler.c + $PROJ_DIR$\..\..\test\system\src\UsartConfigurator.c + $PROJ_DIR$\..\..\test\system\src\TimerHardware.c + $PROJ_DIR$\..\..\test\system\src\UsartTransmitBufferStatus.c + $PROJ_DIR$\..\..\examples\src\AdcModel.h + $PROJ_DIR$\..\..\test\system\src\TimerModel.c + $PROJ_DIR$\..\..\test\system\src\UsartBaudRateRegisterCalculator.c + $PROJ_DIR$\..\..\test\system\src\UsartConductor.c + $PROJ_DIR$\..\..\examples\src\AdcHardware.h + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.h + $PROJ_DIR$\..\..\test\system\src\UsartHardware.c + $PROJ_DIR$\..\..\test\system\src\UsartModel.c + $PROJ_DIR$\..\..\test\system\src\UsartPutChar.c + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.h + $PROJ_DIR$\..\..\examples\src\ModelConfig.h + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.h + $PROJ_DIR$\..\..\examples\src\Types.h + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.h + $PROJ_DIR$\..\..\examples\src\AdcConductor.h + $PROJ_DIR$\..\..\examples\src\AT91SAM7X256.h + $PROJ_DIR$\..\..\examples\src\TaskScheduler.h + $PROJ_DIR$\..\..\examples\src\TimerHardware.h + $PROJ_DIR$\..\..\test\system\src\TimerConductor.h + $PROJ_DIR$\..\..\test\system\src\UsartTransmitBufferStatus.h + $PROJ_DIR$\..\..\test\system\src\UsartHardware.h + $PROJ_DIR$\..\..\test\system\src\AdcHardwareConfigurator.h + $PROJ_DIR$\..\src\ext_irq.c + $PROJ_DIR$\..\src\interrupt_timer.c + $PROJ_DIR$\..\src\interrupt_Usart.c + $PROJ_DIR$\..\src\main.c + $PROJ_DIR$\RAM_Debug\Obj\UsartConductor.o + $PROJ_DIR$\RAM_Debug\List\AdcConductor.lst + $PROJ_DIR$\RAM_Debug\List\TimerInterruptHandler.lst + $PROJ_DIR$\RAM_Debug\List\AdcHardwareConfigurator.lst + $PROJ_DIR$\RAM_Debug\Obj\TimerHardware.pbi + $PROJ_DIR$\RAM_Debug\Obj\UsartHardware.pbi + $PROJ_DIR$\RAM_Debug\Obj\UsartConductor.pbi + $PROJ_DIR$\RAM_Debug\List\TimerConfigurator.lst + $PROJ_DIR$\RAM_Debug\List\UsartPutChar.lst + $PROJ_DIR$\RAM_Debug\Obj\TimerConductor.o + $PROJ_DIR$\RAM_Debug\Obj\TimerConfigurator.o + $PROJ_DIR$\RAM_Debug\Obj\UsartBaudRateRegisterCalculator.pbi + $PROJ_DIR$\RAM_Debug\Obj\AdcHardwareConfigurator.o + $PROJ_DIR$\RAM_Debug\List\AdcModel.lst + $PROJ_DIR$\RAM_Debug\List\TimerConductor.lst + $PROJ_DIR$\RAM_Debug\List\TimerHardware.lst + $PROJ_DIR$\RAM_Debug\Obj\AdcHardware.o + $PROJ_DIR$\RAM_Debug\List\TemperatureFilter.lst + $PROJ_DIR$\RAM_Debug\Obj\AdcModel.pbi + $PROJ_DIR$\RAM_Debug\List\IntrinsicsWrapper.lst + $PROJ_DIR$\RAM_Debug\Obj\Cstartup.o + $PROJ_DIR$\RAM_Debug\Obj\interrupt_Usart.o + $PROJ_DIR$\RAM_Debug\Obj\AdcHardwareConfigurator.pbi + $PROJ_DIR$\RAM_Debug\Obj\main.pbi + $PROJ_DIR$\RAM_Debug\List\AdcTemperatureSensor.lst + $PROJ_DIR$\RAM_Debug\Obj\TimerInterruptHandler.pbi + $PROJ_DIR$\RAM_Debug\List\Model.lst + $PROJ_DIR$\RAM_Debug\Obj\Model.pbi + $PROJ_DIR$\RAM_Debug\Obj\AdcHardware.pbi + $PROJ_DIR$\RAM_Debug\List\UsartBaudRateRegisterCalculator.lst + $PROJ_DIR$\RAM_Debug\Obj\ext_irq.o + $PROJ_DIR$\RAM_Debug\Obj\TimerInterruptHandler.o + $PROJ_DIR$\RAM_Debug\List\Cstartup.lst + $PROJ_DIR$\RAM_Debug\Obj\TimerConfigurator.pbi + $PROJ_DIR$\RAM_Debug\Obj\Cstartup_SAM7.o + $PROJ_DIR$\RAM_Debug\Obj\AdcTemperatureSensor.pbi + $PROJ_DIR$\RAM_Debug\List\UsartConfigurator.lst + $PROJ_DIR$\RAM_Debug\List\UsartTransmitBufferStatus.lst + $PROJ_DIR$\RAM_Debug\Obj\UsartPutChar.pbi + $PROJ_DIR$\RAM_Debug\List\TaskScheduler.lst + $PROJ_DIR$\RAM_Debug\Obj\interrupt_timer.pbi + $PROJ_DIR$\RAM_Debug\List\UsartHardware.lst + $PROJ_DIR$\RAM_Debug\Obj\TaskScheduler.pbi + $PROJ_DIR$\RAM_Debug\Obj\Cstartup_SAM7.pbi + $PROJ_DIR$\RAM_Debug\List\Cstartup_SAM7.lst + $PROJ_DIR$\RAM_Debug\Obj\UsartTransmitBufferStatus.o + $PROJ_DIR$\RAM_Debug\Obj\TimerModel.pbi + $PROJ_DIR$\RAM_Debug\List\UsartConductor.lst + $PROJ_DIR$\RAM_Debug\Obj\UsartPutChar.o + $PROJ_DIR$\RAM_Debug\Obj\TimerInterruptConfigurator.pbi + $PROJ_DIR$\RAM_Debug\Obj\TimerHardware.o + $PROJ_DIR$\RAM_Debug\Obj\AdcTemperatureSensor.o + $PROJ_DIR$\RAM_Debug\Obj\AdcModel.o + $PROJ_DIR$\RAM_Debug\Obj\Executor.pbi + $PROJ_DIR$\RAM_Debug\Obj\TemperatureFilter.o + $PROJ_DIR$\RAM_Debug\Obj\AdcConductor.pbi + $PROJ_DIR$\RAM_Debug\List\TimerInterruptConfigurator.lst + $PROJ_DIR$\RAM_Debug\List\UsartModel.lst + $PROJ_DIR$\RAM_Debug\Obj\UsartConfigurator.o + $PROJ_DIR$\RAM_Debug\Obj\cmock_demo.pbd + $PROJ_DIR$\RAM_Debug\Exe\cmock_demo.out + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + $PROJ_DIR$\RAM_Debug\List\TemperatureCalculator.lst + $PROJ_DIR$\RAM_Debug\List\AdcHardware.lst + $PROJ_DIR$\RAM_Debug\List\Executor.lst + $PROJ_DIR$\RAM_Debug\Obj\UsartModel.pbi + $PROJ_DIR$\RAM_Debug\Obj\TimerConductor.pbi + $PROJ_DIR$\RAM_Debug\Obj\UsartConfigurator.pbi + $PROJ_DIR$\RAM_Debug\Obj\UsartHardware.o + $PROJ_DIR$\RAM_Debug\Obj\TemperatureCalculator.o + $PROJ_DIR$\RAM_Debug\Obj\AdcConductor.o + $PROJ_DIR$\RAM_Debug\Obj\IntrinsicsWrapper.o + $PROJ_DIR$\RAM_Debug\Obj\Model.o + $PROJ_DIR$\RAM_Debug\Obj\UsartTransmitBufferStatus.pbi + $PROJ_DIR$\RAM_Debug\Obj\TimerModel.o + $PROJ_DIR$\RAM_Debug\Obj\Executor.o + $PROJ_DIR$\RAM_Debug\Obj\TemperatureCalculator.pbi + $PROJ_DIR$\RAM_Debug\Obj\UsartBaudRateRegisterCalculator.o + $PROJ_DIR$\RAM_Debug\Obj\TimerInterruptConfigurator.o + $PROJ_DIR$\RAM_Debug\Obj\interrupt_Usart.pbi + $PROJ_DIR$\RAM_Debug\Obj\TaskScheduler.o + $PROJ_DIR$\RAM_Debug\Obj\Main.o + $PROJ_DIR$\RAM_Debug\Obj\ext_irq.pbi + $PROJ_DIR$\RAM_Debug\List\Main.lst + $PROJ_DIR$\RAM_Debug\List\TimerModel.lst + $PROJ_DIR$\RAM_Debug\Obj\interrupt_timer.o + $PROJ_DIR$\RAM_Debug\Obj\UsartModel.o + $PROJ_DIR$\RAM_Debug\Obj\TemperatureFilter.pbi + $PROJ_DIR$\RAM_Debug\Obj\IntrinsicsWrapper.pbi + $PROJ_DIR$\Resource\at91SAM7X256_RAM.icf + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + $PROJ_DIR$\..\..\examples\src\AdcModel.c + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + $PROJ_DIR$\..\..\examples\src\Executor.c + $PROJ_DIR$\..\..\examples\src\Main.c + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + $PROJ_DIR$\..\..\examples\src\Model.c + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + $PROJ_DIR$\Resource\SAM7_RAM.mac + $PROJ_DIR$\Resource\at91SAM7X256_FLASH.icf + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + $PROJ_DIR$\..\..\examples\src\TimerModel.c + $PROJ_DIR$\..\..\examples\src\UsartModel.c + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + $PROJ_DIR$\srcIAR\Cstartup.s + $PROJ_DIR$\incIAR\AT91SAM7X-EK.h + $PROJ_DIR$\incIAR\lib_AT91SAM7X256.h + $PROJ_DIR$\incIAR\AT91SAM7X256_inc.h + + + [ROOT_NODE] + + + ILINK + 158 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcTemperatureSensor.c + + + BICOMP + 133 + + + ICCARM + 122 149 + + + + + BICOMP + 29 14 36 + + + ICCARM + 29 14 36 + + + + + $PROJ_DIR$\..\..\test\system\src\Main.c + + + BICOMP + 121 + + + ICCARM + 181 179 + + + + + BICOMP + 29 14 9 40 21 19 28 27 92 42 20 32 18 91 90 37 30 3 8 4 35 39 93 36 38 + + + ICCARM + 29 14 9 40 21 19 28 27 92 42 20 32 18 91 90 37 30 3 8 4 35 39 93 36 38 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcHardwareConfigurator.c + + + BICOMP + 120 + + + ICCARM + 101 110 + + + + + BICOMP + 29 14 93 24 + + + ICCARM + 29 14 93 24 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcConductor.c + + + BICOMP + 153 + + + ICCARM + 99 168 + + + + + BICOMP + 29 14 35 38 39 + + + ICCARM + 29 14 35 38 39 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcHardware.c + + + BICOMP + 126 + + + ICCARM + 161 114 + + + + + BICOMP + 29 14 39 93 36 + + + ICCARM + 29 14 39 93 36 + + + + + $PROJ_DIR$\..\..\test\system\src\AdcModel.c + + + BICOMP + 116 + + + ICCARM + 111 150 + + + + + BICOMP + 29 14 38 21 19 28 + + + ICCARM + 29 14 38 21 19 28 + + + + + $PROJ_DIR$\..\..\test\system\src\Executor.c + + + BICOMP + 151 + + + ICCARM + 162 173 + + + + + BICOMP + 29 14 9 40 27 90 35 11 23 + + + ICCARM + 29 14 9 40 27 90 35 11 23 + + + + + $PROJ_DIR$\..\..\test\system\src\Model.c + + + BICOMP + 125 + + + ICCARM + 124 170 + + + + + BICOMP + 40 29 14 21 28 + + + ICCARM + 40 29 14 21 28 + + + + + $PROJ_DIR$\..\..\test\system\src\TemperatureFilter.c + + + BICOMP + 185 + + + ICCARM + 115 152 + + + + + BICOMP + 29 14 28 7 23 5 31 1 6 48 2 + + + ICCARM + 29 14 28 7 23 5 31 1 26 6 48 2 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerConfigurator.c + + + BICOMP + 131 + + + ICCARM + 105 108 + + + + + BICOMP + 29 14 30 3 + + + ICCARM + 29 14 30 3 + + + + + $PROJ_DIR$\..\..\test\system\src\TemperatureCalculator.c + + + BICOMP + 174 + + + ICCARM + 160 167 + + + + + BICOMP + 29 14 19 7 23 5 31 1 6 48 2 + + + ICCARM + 29 14 19 7 23 5 31 1 26 6 48 2 + + + + + $PROJ_DIR$\..\..\test\system\src\TaskScheduler.c + + + BICOMP + 140 + + + ICCARM + 137 178 + + + + + BICOMP + 29 14 21 + + + ICCARM + 29 14 21 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerInterruptConfigurator.c + + + BICOMP + 147 + + + ICCARM + 154 176 + + + + + BICOMP + 29 14 3 8 + + + ICCARM + 29 14 3 8 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerConductor.c + + + BICOMP + 164 + + + ICCARM + 112 107 + + + + + BICOMP + 29 14 90 4 37 8 + + + ICCARM + 29 14 90 4 37 8 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerInterruptHandler.c + + + BICOMP + 123 + + + ICCARM + 100 129 + + + + + BICOMP + 29 14 8 3 + + + ICCARM + 29 14 8 3 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartConfigurator.c + + + BICOMP + 165 + + + ICCARM + 134 156 + + + + + BICOMP + 29 14 42 + + + ICCARM + 29 14 42 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerHardware.c + + + BICOMP + 102 + + + ICCARM + 113 148 + + + + + BICOMP + 29 14 37 30 + + + ICCARM + 29 14 37 30 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartTransmitBufferStatus.c + + + BICOMP + 171 + + + ICCARM + 135 143 + + + + + BICOMP + 29 14 91 + + + ICCARM + 29 14 91 + + + + + $PROJ_DIR$\..\..\test\system\src\TimerModel.c + + + BICOMP + 144 + + + ICCARM + 182 172 + + + + + BICOMP + 29 14 4 21 + + + ICCARM + 29 14 4 21 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartBaudRateRegisterCalculator.c + + + BICOMP + 109 + + + ICCARM + 127 175 + + + + + BICOMP + 29 14 18 + + + ICCARM + 29 14 18 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartConductor.c + + + BICOMP + 104 + + + ICCARM + 145 98 + + + + + BICOMP + 29 14 27 92 32 21 + + + ICCARM + 29 14 27 92 32 21 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartHardware.c + + + BICOMP + 103 + + + ICCARM + 139 166 + + + + + BICOMP + 29 14 92 42 20 + + + ICCARM + 29 14 92 42 20 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartModel.c + + + BICOMP + 163 + + + ICCARM + 155 184 + + + + + BICOMP + 29 14 32 24 18 28 25 23 31 1 6 48 2 34 7 5 + + + ICCARM + 29 14 32 24 18 28 25 23 31 1 26 6 48 2 34 7 5 + + + + + $PROJ_DIR$\..\..\test\system\src\UsartPutChar.c + + + BICOMP + 136 + + + ICCARM + 106 146 + + + + + BICOMP + 29 14 20 91 + + + ICCARM + 29 14 20 91 + + + + + $PROJ_DIR$\..\src\ext_irq.c + + + BICOMP + 180 + + + ICCARM + 128 + + + + + $PROJ_DIR$\..\src\interrupt_timer.c + + + BICOMP + 138 + + + ICCARM + 183 + + + + + $PROJ_DIR$\..\src\interrupt_Usart.c + + + BICOMP + 177 + + + ICCARM + 119 + + + + + $PROJ_DIR$\..\src\main.c + + + BICOMP + 121 + + + ICCARM + 179 + + + + + $PROJ_DIR$\RAM_Debug\Obj\cmock_demo.pbd + + + BILINK + 153 126 120 116 133 141 151 186 125 140 174 185 164 131 102 147 123 144 109 104 165 103 163 136 171 121 + + + + + $PROJ_DIR$\RAM_Debug\Exe\cmock_demo.out + + + ILINK + 187 168 114 110 150 149 118 132 173 169 179 170 178 167 152 107 108 148 176 129 172 175 98 156 166 184 146 143 41 33 22 + + + + + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + + + BICOMP + 141 + + + ICCARM + 142 132 + + + + + BICOMP + 10 11 23 216 87 217 + + + ICCARM + 10 11 23 216 87 217 + + + + + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + + + BICOMP + 120 + + + ICCARM + 101 110 + + + + + BICOMP + 84 87 83 82 + + + ICCARM + 84 87 83 82 + + + + + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + + + BICOMP + 153 + + + ICCARM + 99 168 + + + + + BICOMP + 84 87 86 72 76 + + + ICCARM + 84 87 86 72 76 + + + + + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + + + BICOMP + 126 + + + ICCARM + 161 114 + + + + + BICOMP + 84 87 76 83 81 + + + ICCARM + 84 87 76 83 81 + + + + + $PROJ_DIR$\..\..\examples\src\AdcModel.c + + + BICOMP + 116 + + + ICCARM + 111 150 + + + + + BICOMP + 84 87 72 88 85 77 + + + ICCARM + 84 87 72 88 85 77 + + + + + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + + + BICOMP + 133 + + + ICCARM + 122 149 + + + + + BICOMP + 84 87 81 + + + ICCARM + 84 87 81 + + + + + $PROJ_DIR$\..\..\examples\src\Executor.c + + + BICOMP + 151 + + + ICCARM + 162 173 + + + + + BICOMP + 84 87 43 57 45 47 86 59 + + + ICCARM + 84 87 43 57 45 47 86 59 + + + + + $PROJ_DIR$\..\..\examples\src\Main.c + + + BICOMP + 121 + + + ICCARM + 181 179 + + + + + BICOMP + 84 87 59 43 57 88 85 77 45 15 16 60 13 12 17 47 89 44 61 55 53 86 76 83 81 72 + + + ICCARM + 84 87 59 43 57 88 85 77 45 15 16 60 13 12 17 47 89 44 61 55 53 86 76 83 81 72 + + + + + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + + + BICOMP + 186 + + + ICCARM + 117 169 + + + + + BICOMP + 59 11 23 + + + ICCARM + 59 11 23 + + + + + $PROJ_DIR$\..\..\examples\src\Model.c + + + BICOMP + 125 + + + ICCARM + 124 170 + + + + + BICOMP + 57 84 87 88 77 + + + ICCARM + 57 84 87 88 77 + + + + + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + + + BICOMP + 174 + + + ICCARM + 160 167 + + + + + BICOMP + 84 87 85 7 23 5 31 1 6 48 2 + + + ICCARM + 84 87 85 7 23 5 31 1 26 6 48 2 + + + + + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + + + BICOMP + 140 + + + ICCARM + 137 178 + + + + + BICOMP + 84 87 88 + + + ICCARM + 84 87 88 + + + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + + + BICOMP + 147 + + + ICCARM + 154 176 + + + + + BICOMP + 84 87 61 55 + + + ICCARM + 84 87 61 55 + + + + + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + + + BICOMP + 185 + + + ICCARM + 115 152 + + + + + BICOMP + 84 87 77 7 23 5 31 1 6 48 2 + + + ICCARM + 84 87 77 7 23 5 31 1 26 6 48 2 + + + + + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + + + BICOMP + 164 + + + ICCARM + 112 107 + + + + + BICOMP + 84 87 47 53 89 55 + + + ICCARM + 84 87 47 53 89 55 + + + + + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + + + BICOMP + 131 + + + ICCARM + 105 108 + + + + + BICOMP + 84 87 44 61 + + + ICCARM + 84 87 44 61 + + + + + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + + + BICOMP + 102 + + + ICCARM + 113 148 + + + + + BICOMP + 84 87 89 44 + + + ICCARM + 84 87 89 44 + + + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + + + BICOMP + 123 + + + ICCARM + 100 129 + + + + + BICOMP + 84 87 55 61 + + + ICCARM + 84 87 55 61 + + + + + $PROJ_DIR$\..\..\examples\src\TimerModel.c + + + BICOMP + 144 + + + ICCARM + 182 172 + + + + + BICOMP + 84 87 53 88 + + + ICCARM + 84 87 53 88 + + + + + $PROJ_DIR$\..\..\examples\src\UsartModel.c + + + BICOMP + 163 + + + ICCARM + 155 184 + + + + + BICOMP + 84 87 13 82 12 77 25 23 31 1 6 48 2 34 7 5 + + + ICCARM + 84 87 13 82 12 77 25 23 31 1 26 6 48 2 34 7 5 + + + + + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + + + BICOMP + 109 + + + ICCARM + 127 175 + + + + + BICOMP + 84 87 12 + + + ICCARM + 84 87 12 + + + + + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + + + BICOMP + 104 + + + ICCARM + 145 98 + + + + + BICOMP + 84 87 45 15 13 88 + + + ICCARM + 84 87 45 15 13 88 + + + + + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + + + BICOMP + 165 + + + ICCARM + 134 156 + + + + + BICOMP + 84 87 16 + + + ICCARM + 84 87 16 + + + + + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + + + BICOMP + 103 + + + ICCARM + 139 166 + + + + + BICOMP + 84 87 15 16 60 + + + ICCARM + 84 87 15 16 60 + + + + + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + + + BICOMP + 171 + + + ICCARM + 135 143 + + + + + BICOMP + 84 87 17 + + + ICCARM + 84 87 17 + + + + + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + + + BICOMP + 136 + + + ICCARM + 106 146 + + + + + BICOMP + 84 87 60 17 + + + ICCARM + 84 87 60 17 + + + + + $PROJ_DIR$\srcIAR\Cstartup.s + + + AARM + 118 130 + + + + + AARM + 218 + + + + + $PROJ_DIR$\..\src\ext_irq.c + ICCARM + + + $PROJ_DIR$\..\src\interrupt_timer.c + ICCARM + + + $PROJ_DIR$\..\src\interrupt_Usart.c + ICCARM + + + $PROJ_DIR$\..\src\main.c + ICCARM + + + + + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/cmock_demo.ewd b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/cmock_demo.ewd new file mode 100644 index 0000000..27cc8e9 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/cmock_demo.ewd @@ -0,0 +1,1906 @@ + + + + 2 + + RAM_Debug + + ARM + + 1 + + C-SPY + 2 + + 18 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 1 + + + + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + JLINK_ID + 2 + + 10 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + MACRAIGOR_ID + 2 + + 3 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin + 1 + + + + + FLASH_Debug + + ARM + + 1 + + C-SPY + 2 + + 18 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 1 + + + + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + JLINK_ID + 2 + + 10 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + MACRAIGOR_ID + 2 + + 3 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin + 1 + + + + + Binary + + ARM + + 1 + + C-SPY + 2 + + 18 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 1 + + + + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + JLINK_ID + 2 + + 10 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + MACRAIGOR_ID + 2 + + 3 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin + 1 + + + + + + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/cmock_demo.ewp b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/cmock_demo.ewp new file mode 100644 index 0000000..4524d91 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/cmock_demo.ewp @@ -0,0 +1,2426 @@ + + + + 2 + + RAM_Debug + + ARM + + 1 + + General + 3 + + 16 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 20 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + ILINK + 0 + + 6 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + FLASH_Debug + + ARM + + 1 + + General + 3 + + 16 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 20 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + ILINK + 0 + + 6 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + Binary + + ARM + + 1 + + General + 3 + + 16 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 20 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + ILINK + 0 + + 6 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + Binary + + + Resource + + $PROJ_DIR$\Resource\at91SAM7X256_FLASH.icf + + + $PROJ_DIR$\Resource\at91SAM7X256_RAM.icf + + + $PROJ_DIR$\Resource\SAM7_FLASH.mac + + + $PROJ_DIR$\Resource\SAM7_RAM.mac + + + + Source + + $PROJ_DIR$\..\..\examples\src\AdcConductor.c + + + $PROJ_DIR$\..\..\examples\src\AdcHardware.c + + + $PROJ_DIR$\..\..\examples\src\AdcHardwareConfigurator.c + + + $PROJ_DIR$\..\..\examples\src\AdcModel.c + + + $PROJ_DIR$\..\..\examples\src\AdcTemperatureSensor.c + + + $PROJ_DIR$\..\..\examples\src\Executor.c + + + $PROJ_DIR$\..\..\examples\src\IntrinsicsWrapper.c + + + $PROJ_DIR$\..\..\examples\src\Main.c + + + $PROJ_DIR$\..\..\examples\src\Model.c + + + $PROJ_DIR$\..\..\examples\src\TaskScheduler.c + + + $PROJ_DIR$\..\..\examples\src\TemperatureCalculator.c + + + $PROJ_DIR$\..\..\examples\src\TemperatureFilter.c + + + $PROJ_DIR$\..\..\examples\src\TimerConductor.c + + + $PROJ_DIR$\..\..\examples\src\TimerConfigurator.c + + + $PROJ_DIR$\..\..\examples\src\TimerHardware.c + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptConfigurator.c + + + $PROJ_DIR$\..\..\examples\src\TimerInterruptHandler.c + + + $PROJ_DIR$\..\..\examples\src\TimerModel.c + + + $PROJ_DIR$\..\..\examples\src\UsartBaudRateRegisterCalculator.c + + + $PROJ_DIR$\..\..\examples\src\UsartConductor.c + + + $PROJ_DIR$\..\..\examples\src\UsartConfigurator.c + + + $PROJ_DIR$\..\..\examples\src\UsartHardware.c + + + $PROJ_DIR$\..\..\examples\src\UsartModel.c + + + $PROJ_DIR$\..\..\examples\src\UsartPutChar.c + + + $PROJ_DIR$\..\..\examples\src\UsartTransmitBufferStatus.c + + + + Startup + + $PROJ_DIR$\srcIAR\Cstartup.s + + + $PROJ_DIR$\srcIAR\Cstartup_SAM7.c + + + + + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/cmock_demo.eww b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/cmock_demo.eww new file mode 100644 index 0000000..a299a5d --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/cmock_demo.eww @@ -0,0 +1,26 @@ + + + + + $WS_DIR$\cmock_demo.ewp + + + + All + + cmock_demo + Binary + + + cmock_demo + FLASH_Debug + + + cmock_demo + RAM_Debug + + + + + + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/incIAR/AT91SAM7X-EK.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/incIAR/AT91SAM7X-EK.h new file mode 100644 index 0000000..9834675 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/incIAR/AT91SAM7X-EK.h @@ -0,0 +1,61 @@ +// ---------------------------------------------------------------------------- +// ATMEL Microcontroller Software Support - ROUSSET - +// ---------------------------------------------------------------------------- +// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// ---------------------------------------------------------------------------- +// File Name : AT91SAM7X-EK.h +// Object : AT91SAM7X-EK Evaluation Board Features Definition File +// +// ---------------------------------------------------------------------------- + +#ifndef AT91SAM7X_EK_H +#define AT91SAM7X_EK_H + +/*-----------------*/ +/* LEDs Definition */ +/*-----------------*/ +#define AT91B_LED1 (1<<19) // AT91C_PIO_PB19 AT91C_PB19_PWM0 AT91C_PB19_TCLK1 +#define AT91B_LED2 (1<<20) // AT91C_PIO_PB20 AT91C_PB20_PWM1 AT91C_PB20_PWM1 +#define AT91B_LED3 (AT91C_PIO_PB21) // AT91C_PIO_PB21 AT91C_PB21_PWM2 AT91C_PB21_PCK1 +#define AT91B_LED4 (AT91C_PIO_PB22) // AT91C_PIO_PB22 AT91C_PB22_PWM3 AT91C_PB22_PCK2 +#define AT91B_NB_LEB 4 +#define AT91B_LED_MASK (AT91B_LED1|AT91B_LED2|AT91B_LED3|AT91B_LED4) +#define AT91D_BASE_PIO_LED (AT91C_BASE_PIOB) + +#define AT91B_POWERLED (1<<25) // PB25 + + +/*-------------------------------*/ +/* JOYSTICK Position Definition */ +/*-------------------------------*/ +#define AT91B_SW1 (1<<21) // PA21 Up Button AT91C_PA21_TF AT91C_PA21_NPCS10 +#define AT91B_SW2 (1<<22) // PA22 Down Button AT91C_PA22_TK AT91C_PA22_SPCK1 +#define AT91B_SW3 (1<<23) // PA23 Left Button AT91C_PA23_TD AT91C_PA23_MOSI1 +#define AT91B_SW4 (1<<24) // PA24 Right Button AT91C_PA24_RD AT91C_PA24_MISO1 +#define AT91B_SW5 (1<<25) // PA25 Push Button AT91C_PA25_RK AT91C_PA25_NPCS11 +#define AT91B_SW_MASK (AT91B_SW1|AT91B_SW2|AT91B_SW3|AT91B_SW4|AT91B_SW5) + + +#define AT91D_BASE_PIO_SW (AT91C_BASE_PIOA) + +/*------------------*/ +/* CAN Definition */ +/*------------------*/ +#define AT91B_CAN_TRANSCEIVER_RS (1<<2) // PA2 + +/*--------------*/ +/* Clocks */ +/*--------------*/ +#define AT91B_MAIN_OSC 18432000 // Main Oscillator MAINCK +#define AT91B_MCK ((18432000*73/14)/2) // Output PLL Clock + +#endif /* AT91SAM7X-EK_H */ diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/incIAR/AT91SAM7X256_inc.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/incIAR/AT91SAM7X256_inc.h new file mode 100644 index 0000000..18e58d4 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/incIAR/AT91SAM7X256_inc.h @@ -0,0 +1,2268 @@ +// ---------------------------------------------------------------------------- +// ATMEL Microcontroller Software Support - ROUSSET - +// ---------------------------------------------------------------------------- +// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// ---------------------------------------------------------------------------- +// File Name : AT91SAM7X256.h +// Object : AT91SAM7X256 definitions +// Generated : AT91 SW Application Group 01/16/2006 (16:36:22) +// +// CVS Reference : /AT91SAM7X256.pl/1.15/Wed Nov 2 13:56:49 2005// +// CVS Reference : /SYS_SAM7X.pl/1.3/Tue Feb 1 17:01:43 2005// +// CVS Reference : /MC_SAM7X.pl/1.2/Fri May 20 14:13:04 2005// +// CVS Reference : /PMC_SAM7X.pl/1.4/Tue Feb 8 13:58:10 2005// +// CVS Reference : /RSTC_SAM7X.pl/1.2/Wed Jul 13 14:57:50 2005// +// CVS Reference : /UDP_SAM7X.pl/1.1/Tue May 10 11:35:35 2005// +// CVS Reference : /PWM_SAM7X.pl/1.1/Tue May 10 11:53:07 2005// +// CVS Reference : /AIC_6075B.pl/1.3/Fri May 20 14:01:30 2005// +// CVS Reference : /PIO_6057A.pl/1.2/Thu Feb 3 10:18:28 2005// +// CVS Reference : /RTTC_6081A.pl/1.2/Tue Nov 9 14:43:58 2004// +// CVS Reference : /PITC_6079A.pl/1.2/Tue Nov 9 14:43:56 2004// +// CVS Reference : /WDTC_6080A.pl/1.3/Tue Nov 9 14:44:00 2004// +// CVS Reference : /VREG_6085B.pl/1.1/Tue Feb 1 16:05:48 2005// +// CVS Reference : /PDC_6074C.pl/1.2/Thu Feb 3 08:48:54 2005// +// CVS Reference : /DBGU_6059D.pl/1.1/Mon Jan 31 13:15:32 2005// +// CVS Reference : /SPI_6088D.pl/1.3/Fri May 20 14:08:59 2005// +// CVS Reference : /US_6089C.pl/1.1/Mon Jul 12 18:23:26 2004// +// CVS Reference : /SSC_6078B.pl/1.1/Wed Jul 13 15:19:19 2005// +// CVS Reference : /TWI_6061A.pl/1.1/Tue Jul 13 07:38:06 2004// +// CVS Reference : /TC_6082A.pl/1.7/Fri Mar 11 12:52:17 2005// +// CVS Reference : /CAN_6019B.pl/1.1/Tue Mar 8 12:42:22 2005// +// CVS Reference : /EMACB_6119A.pl/1.6/Wed Jul 13 15:05:35 2005// +// CVS Reference : /ADC_6051C.pl/1.1/Fri Oct 17 09:12:38 2003// +// ---------------------------------------------------------------------------- + +// Hardware register definition + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR System Peripherals +// ***************************************************************************** + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Advanced Interrupt Controller +// ***************************************************************************** +// *** Register offset in AT91S_AIC structure *** +#define AIC_SMR ( 0) // Source Mode Register +#define AIC_SVR (128) // Source Vector Register +#define AIC_IVR (256) // IRQ Vector Register +#define AIC_FVR (260) // FIQ Vector Register +#define AIC_ISR (264) // Interrupt Status Register +#define AIC_IPR (268) // Interrupt Pending Register +#define AIC_IMR (272) // Interrupt Mask Register +#define AIC_CISR (276) // Core Interrupt Status Register +#define AIC_IECR (288) // Interrupt Enable Command Register +#define AIC_IDCR (292) // Interrupt Disable Command Register +#define AIC_ICCR (296) // Interrupt Clear Command Register +#define AIC_ISCR (300) // Interrupt Set Command Register +#define AIC_EOICR (304) // End of Interrupt Command Register +#define AIC_SPU (308) // Spurious Vector Register +#define AIC_DCR (312) // Debug Control Register (Protect) +#define AIC_FFER (320) // Fast Forcing Enable Register +#define AIC_FFDR (324) // Fast Forcing Disable Register +#define AIC_FFSR (328) // Fast Forcing Status Register +// -------- AIC_SMR : (AIC Offset: 0x0) Control Register -------- +#define AT91C_AIC_PRIOR (0x7 << 0) // (AIC) Priority Level +#define AT91C_AIC_PRIOR_LOWEST (0x0) // (AIC) Lowest priority level +#define AT91C_AIC_PRIOR_HIGHEST (0x7) // (AIC) Highest priority level +#define AT91C_AIC_SRCTYPE (0x3 << 5) // (AIC) Interrupt Source Type +#define AT91C_AIC_SRCTYPE_EXT_LOW_LEVEL (0x0 << 5) // (AIC) External Sources Code Label Low-level Sensitive +#define AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL (0x0 << 5) // (AIC) Internal Sources Code Label High-level Sensitive +#define AT91C_AIC_SRCTYPE_INT_POSITIVE_EDGE (0x1 << 5) // (AIC) Internal Sources Code Label Positive Edge triggered +#define AT91C_AIC_SRCTYPE_EXT_NEGATIVE_EDGE (0x1 << 5) // (AIC) External Sources Code Label Negative Edge triggered +#define AT91C_AIC_SRCTYPE_HIGH_LEVEL (0x2 << 5) // (AIC) Internal Or External Sources Code Label High-level Sensitive +#define AT91C_AIC_SRCTYPE_POSITIVE_EDGE (0x3 << 5) // (AIC) Internal Or External Sources Code Label Positive Edge triggered +// -------- AIC_CISR : (AIC Offset: 0x114) AIC Core Interrupt Status Register -------- +#define AT91C_AIC_NFIQ (0x1 << 0) // (AIC) NFIQ Status +#define AT91C_AIC_NIRQ (0x1 << 1) // (AIC) NIRQ Status +// -------- AIC_DCR : (AIC Offset: 0x138) AIC Debug Control Register (Protect) -------- +#define AT91C_AIC_DCR_PROT (0x1 << 0) // (AIC) Protection Mode +#define AT91C_AIC_DCR_GMSK (0x1 << 1) // (AIC) General Mask + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Peripheral DMA Controller +// ***************************************************************************** +// *** Register offset in AT91S_PDC structure *** +#define PDC_RPR ( 0) // Receive Pointer Register +#define PDC_RCR ( 4) // Receive Counter Register +#define PDC_TPR ( 8) // Transmit Pointer Register +#define PDC_TCR (12) // Transmit Counter Register +#define PDC_RNPR (16) // Receive Next Pointer Register +#define PDC_RNCR (20) // Receive Next Counter Register +#define PDC_TNPR (24) // Transmit Next Pointer Register +#define PDC_TNCR (28) // Transmit Next Counter Register +#define PDC_PTCR (32) // PDC Transfer Control Register +#define PDC_PTSR (36) // PDC Transfer Status Register +// -------- PDC_PTCR : (PDC Offset: 0x20) PDC Transfer Control Register -------- +#define AT91C_PDC_RXTEN (0x1 << 0) // (PDC) Receiver Transfer Enable +#define AT91C_PDC_RXTDIS (0x1 << 1) // (PDC) Receiver Transfer Disable +#define AT91C_PDC_TXTEN (0x1 << 8) // (PDC) Transmitter Transfer Enable +#define AT91C_PDC_TXTDIS (0x1 << 9) // (PDC) Transmitter Transfer Disable +// -------- PDC_PTSR : (PDC Offset: 0x24) PDC Transfer Status Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Debug Unit +// ***************************************************************************** +// *** Register offset in AT91S_DBGU structure *** +#define DBGU_CR ( 0) // Control Register +#define DBGU_MR ( 4) // Mode Register +#define DBGU_IER ( 8) // Interrupt Enable Register +#define DBGU_IDR (12) // Interrupt Disable Register +#define DBGU_IMR (16) // Interrupt Mask Register +#define DBGU_CSR (20) // Channel Status Register +#define DBGU_RHR (24) // Receiver Holding Register +#define DBGU_THR (28) // Transmitter Holding Register +#define DBGU_BRGR (32) // Baud Rate Generator Register +#define DBGU_CIDR (64) // Chip ID Register +#define DBGU_EXID (68) // Chip ID Extension Register +#define DBGU_FNTR (72) // Force NTRST Register +#define DBGU_RPR (256) // Receive Pointer Register +#define DBGU_RCR (260) // Receive Counter Register +#define DBGU_TPR (264) // Transmit Pointer Register +#define DBGU_TCR (268) // Transmit Counter Register +#define DBGU_RNPR (272) // Receive Next Pointer Register +#define DBGU_RNCR (276) // Receive Next Counter Register +#define DBGU_TNPR (280) // Transmit Next Pointer Register +#define DBGU_TNCR (284) // Transmit Next Counter Register +#define DBGU_PTCR (288) // PDC Transfer Control Register +#define DBGU_PTSR (292) // PDC Transfer Status Register +// -------- DBGU_CR : (DBGU Offset: 0x0) Debug Unit Control Register -------- +#define AT91C_US_RSTRX (0x1 << 2) // (DBGU) Reset Receiver +#define AT91C_US_RSTTX (0x1 << 3) // (DBGU) Reset Transmitter +#define AT91C_US_RXEN (0x1 << 4) // (DBGU) Receiver Enable +#define AT91C_US_RXDIS (0x1 << 5) // (DBGU) Receiver Disable +#define AT91C_US_TXEN (0x1 << 6) // (DBGU) Transmitter Enable +#define AT91C_US_TXDIS (0x1 << 7) // (DBGU) Transmitter Disable +#define AT91C_US_RSTSTA (0x1 << 8) // (DBGU) Reset Status Bits +// -------- DBGU_MR : (DBGU Offset: 0x4) Debug Unit Mode Register -------- +#define AT91C_US_PAR (0x7 << 9) // (DBGU) Parity type +#define AT91C_US_PAR_EVEN (0x0 << 9) // (DBGU) Even Parity +#define AT91C_US_PAR_ODD (0x1 << 9) // (DBGU) Odd Parity +#define AT91C_US_PAR_SPACE (0x2 << 9) // (DBGU) Parity forced to 0 (Space) +#define AT91C_US_PAR_MARK (0x3 << 9) // (DBGU) Parity forced to 1 (Mark) +#define AT91C_US_PAR_NONE (0x4 << 9) // (DBGU) No Parity +#define AT91C_US_PAR_MULTI_DROP (0x6 << 9) // (DBGU) Multi-drop mode +#define AT91C_US_CHMODE (0x3 << 14) // (DBGU) Channel Mode +#define AT91C_US_CHMODE_NORMAL (0x0 << 14) // (DBGU) Normal Mode: The USART channel operates as an RX/TX USART. +#define AT91C_US_CHMODE_AUTO (0x1 << 14) // (DBGU) Automatic Echo: Receiver Data Input is connected to the TXD pin. +#define AT91C_US_CHMODE_LOCAL (0x2 << 14) // (DBGU) Local Loopback: Transmitter Output Signal is connected to Receiver Input Signal. +#define AT91C_US_CHMODE_REMOTE (0x3 << 14) // (DBGU) Remote Loopback: RXD pin is internally connected to TXD pin. +// -------- DBGU_IER : (DBGU Offset: 0x8) Debug Unit Interrupt Enable Register -------- +#define AT91C_US_RXRDY (0x1 << 0) // (DBGU) RXRDY Interrupt +#define AT91C_US_TXRDY (0x1 << 1) // (DBGU) TXRDY Interrupt +#define AT91C_US_ENDRX (0x1 << 3) // (DBGU) End of Receive Transfer Interrupt +#define AT91C_US_ENDTX (0x1 << 4) // (DBGU) End of Transmit Interrupt +#define AT91C_US_OVRE (0x1 << 5) // (DBGU) Overrun Interrupt +#define AT91C_US_FRAME (0x1 << 6) // (DBGU) Framing Error Interrupt +#define AT91C_US_PARE (0x1 << 7) // (DBGU) Parity Error Interrupt +#define AT91C_US_TXEMPTY (0x1 << 9) // (DBGU) TXEMPTY Interrupt +#define AT91C_US_TXBUFE (0x1 << 11) // (DBGU) TXBUFE Interrupt +#define AT91C_US_RXBUFF (0x1 << 12) // (DBGU) RXBUFF Interrupt +#define AT91C_US_COMM_TX (0x1 << 30) // (DBGU) COMM_TX Interrupt +#define AT91C_US_COMM_RX (0x1 << 31) // (DBGU) COMM_RX Interrupt +// -------- DBGU_IDR : (DBGU Offset: 0xc) Debug Unit Interrupt Disable Register -------- +// -------- DBGU_IMR : (DBGU Offset: 0x10) Debug Unit Interrupt Mask Register -------- +// -------- DBGU_CSR : (DBGU Offset: 0x14) Debug Unit Channel Status Register -------- +// -------- DBGU_FNTR : (DBGU Offset: 0x48) Debug Unit FORCE_NTRST Register -------- +#define AT91C_US_FORCE_NTRST (0x1 << 0) // (DBGU) Force NTRST in JTAG + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Parallel Input Output Controler +// ***************************************************************************** +// *** Register offset in AT91S_PIO structure *** +#define PIO_PER ( 0) // PIO Enable Register +#define PIO_PDR ( 4) // PIO Disable Register +#define PIO_PSR ( 8) // PIO Status Register +#define PIO_OER (16) // Output Enable Register +#define PIO_ODR (20) // Output Disable Registerr +#define PIO_OSR (24) // Output Status Register +#define PIO_IFER (32) // Input Filter Enable Register +#define PIO_IFDR (36) // Input Filter Disable Register +#define PIO_IFSR (40) // Input Filter Status Register +#define PIO_SODR (48) // Set Output Data Register +#define PIO_CODR (52) // Clear Output Data Register +#define PIO_ODSR (56) // Output Data Status Register +#define PIO_PDSR (60) // Pin Data Status Register +#define PIO_IER (64) // Interrupt Enable Register +#define PIO_IDR (68) // Interrupt Disable Register +#define PIO_IMR (72) // Interrupt Mask Register +#define PIO_ISR (76) // Interrupt Status Register +#define PIO_MDER (80) // Multi-driver Enable Register +#define PIO_MDDR (84) // Multi-driver Disable Register +#define PIO_MDSR (88) // Multi-driver Status Register +#define PIO_PPUDR (96) // Pull-up Disable Register +#define PIO_PPUER (100) // Pull-up Enable Register +#define PIO_PPUSR (104) // Pull-up Status Register +#define PIO_ASR (112) // Select A Register +#define PIO_BSR (116) // Select B Register +#define PIO_ABSR (120) // AB Select Status Register +#define PIO_OWER (160) // Output Write Enable Register +#define PIO_OWDR (164) // Output Write Disable Register +#define PIO_OWSR (168) // Output Write Status Register + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Clock Generator Controler +// ***************************************************************************** +// *** Register offset in AT91S_CKGR structure *** +#define CKGR_MOR ( 0) // Main Oscillator Register +#define CKGR_MCFR ( 4) // Main Clock Frequency Register +#define CKGR_PLLR (12) // PLL Register +// -------- CKGR_MOR : (CKGR Offset: 0x0) Main Oscillator Register -------- +#define AT91C_CKGR_MOSCEN (0x1 << 0) // (CKGR) Main Oscillator Enable +#define AT91C_CKGR_OSCBYPASS (0x1 << 1) // (CKGR) Main Oscillator Bypass +#define AT91C_CKGR_OSCOUNT (0xFF << 8) // (CKGR) Main Oscillator Start-up Time +// -------- CKGR_MCFR : (CKGR Offset: 0x4) Main Clock Frequency Register -------- +#define AT91C_CKGR_MAINF (0xFFFF << 0) // (CKGR) Main Clock Frequency +#define AT91C_CKGR_MAINRDY (0x1 << 16) // (CKGR) Main Clock Ready +// -------- CKGR_PLLR : (CKGR Offset: 0xc) PLL B Register -------- +#define AT91C_CKGR_DIV (0xFF << 0) // (CKGR) Divider Selected +#define AT91C_CKGR_DIV_0 (0x0) // (CKGR) Divider output is 0 +#define AT91C_CKGR_DIV_BYPASS (0x1) // (CKGR) Divider is bypassed +#define AT91C_CKGR_PLLCOUNT (0x3F << 8) // (CKGR) PLL Counter +#define AT91C_CKGR_OUT (0x3 << 14) // (CKGR) PLL Output Frequency Range +#define AT91C_CKGR_OUT_0 (0x0 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_OUT_1 (0x1 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_OUT_2 (0x2 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_OUT_3 (0x3 << 14) // (CKGR) Please refer to the PLL datasheet +#define AT91C_CKGR_MUL (0x7FF << 16) // (CKGR) PLL Multiplier +#define AT91C_CKGR_USBDIV (0x3 << 28) // (CKGR) Divider for USB Clocks +#define AT91C_CKGR_USBDIV_0 (0x0 << 28) // (CKGR) Divider output is PLL clock output +#define AT91C_CKGR_USBDIV_1 (0x1 << 28) // (CKGR) Divider output is PLL clock output divided by 2 +#define AT91C_CKGR_USBDIV_2 (0x2 << 28) // (CKGR) Divider output is PLL clock output divided by 4 + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Power Management Controler +// ***************************************************************************** +// *** Register offset in AT91S_PMC structure *** +#define PMC_SCER ( 0) // System Clock Enable Register +#define PMC_SCDR ( 4) // System Clock Disable Register +#define PMC_SCSR ( 8) // System Clock Status Register +#define PMC_PCER (16) // Peripheral Clock Enable Register +#define PMC_PCDR (20) // Peripheral Clock Disable Register +#define PMC_PCSR (24) // Peripheral Clock Status Register +#define PMC_MOR (32) // Main Oscillator Register +#define PMC_MCFR (36) // Main Clock Frequency Register +#define PMC_PLLR (44) // PLL Register +#define PMC_MCKR (48) // Master Clock Register +#define PMC_PCKR (64) // Programmable Clock Register +#define PMC_IER (96) // Interrupt Enable Register +#define PMC_IDR (100) // Interrupt Disable Register +#define PMC_SR (104) // Status Register +#define PMC_IMR (108) // Interrupt Mask Register +// -------- PMC_SCER : (PMC Offset: 0x0) System Clock Enable Register -------- +#define AT91C_PMC_PCK (0x1 << 0) // (PMC) Processor Clock +#define AT91C_PMC_UDP (0x1 << 7) // (PMC) USB Device Port Clock +#define AT91C_PMC_PCK0 (0x1 << 8) // (PMC) Programmable Clock Output +#define AT91C_PMC_PCK1 (0x1 << 9) // (PMC) Programmable Clock Output +#define AT91C_PMC_PCK2 (0x1 << 10) // (PMC) Programmable Clock Output +#define AT91C_PMC_PCK3 (0x1 << 11) // (PMC) Programmable Clock Output +// -------- PMC_SCDR : (PMC Offset: 0x4) System Clock Disable Register -------- +// -------- PMC_SCSR : (PMC Offset: 0x8) System Clock Status Register -------- +// -------- CKGR_MOR : (PMC Offset: 0x20) Main Oscillator Register -------- +// -------- CKGR_MCFR : (PMC Offset: 0x24) Main Clock Frequency Register -------- +// -------- CKGR_PLLR : (PMC Offset: 0x2c) PLL B Register -------- +// -------- PMC_MCKR : (PMC Offset: 0x30) Master Clock Register -------- +#define AT91C_PMC_CSS (0x3 << 0) // (PMC) Programmable Clock Selection +#define AT91C_PMC_CSS_SLOW_CLK (0x0) // (PMC) Slow Clock is selected +#define AT91C_PMC_CSS_MAIN_CLK (0x1) // (PMC) Main Clock is selected +#define AT91C_PMC_CSS_PLL_CLK (0x3) // (PMC) Clock from PLL is selected +#define AT91C_PMC_PRES (0x7 << 2) // (PMC) Programmable Clock Prescaler +#define AT91C_PMC_PRES_CLK (0x0 << 2) // (PMC) Selected clock +#define AT91C_PMC_PRES_CLK_2 (0x1 << 2) // (PMC) Selected clock divided by 2 +#define AT91C_PMC_PRES_CLK_4 (0x2 << 2) // (PMC) Selected clock divided by 4 +#define AT91C_PMC_PRES_CLK_8 (0x3 << 2) // (PMC) Selected clock divided by 8 +#define AT91C_PMC_PRES_CLK_16 (0x4 << 2) // (PMC) Selected clock divided by 16 +#define AT91C_PMC_PRES_CLK_32 (0x5 << 2) // (PMC) Selected clock divided by 32 +#define AT91C_PMC_PRES_CLK_64 (0x6 << 2) // (PMC) Selected clock divided by 64 +// -------- PMC_PCKR : (PMC Offset: 0x40) Programmable Clock Register -------- +// -------- PMC_IER : (PMC Offset: 0x60) PMC Interrupt Enable Register -------- +#define AT91C_PMC_MOSCS (0x1 << 0) // (PMC) MOSC Status/Enable/Disable/Mask +#define AT91C_PMC_LOCK (0x1 << 2) // (PMC) PLL Status/Enable/Disable/Mask +#define AT91C_PMC_MCKRDY (0x1 << 3) // (PMC) MCK_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK0RDY (0x1 << 8) // (PMC) PCK0_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK1RDY (0x1 << 9) // (PMC) PCK1_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK2RDY (0x1 << 10) // (PMC) PCK2_RDY Status/Enable/Disable/Mask +#define AT91C_PMC_PCK3RDY (0x1 << 11) // (PMC) PCK3_RDY Status/Enable/Disable/Mask +// -------- PMC_IDR : (PMC Offset: 0x64) PMC Interrupt Disable Register -------- +// -------- PMC_SR : (PMC Offset: 0x68) PMC Status Register -------- +// -------- PMC_IMR : (PMC Offset: 0x6c) PMC Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Reset Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_RSTC structure *** +#define RSTC_RCR ( 0) // Reset Control Register +#define RSTC_RSR ( 4) // Reset Status Register +#define RSTC_RMR ( 8) // Reset Mode Register +// -------- RSTC_RCR : (RSTC Offset: 0x0) Reset Control Register -------- +#define AT91C_RSTC_PROCRST (0x1 << 0) // (RSTC) Processor Reset +#define AT91C_RSTC_PERRST (0x1 << 2) // (RSTC) Peripheral Reset +#define AT91C_RSTC_EXTRST (0x1 << 3) // (RSTC) External Reset +#define AT91C_RSTC_KEY (0xFF << 24) // (RSTC) Password +// -------- RSTC_RSR : (RSTC Offset: 0x4) Reset Status Register -------- +#define AT91C_RSTC_URSTS (0x1 << 0) // (RSTC) User Reset Status +#define AT91C_RSTC_BODSTS (0x1 << 1) // (RSTC) Brownout Detection Status +#define AT91C_RSTC_RSTTYP (0x7 << 8) // (RSTC) Reset Type +#define AT91C_RSTC_RSTTYP_POWERUP (0x0 << 8) // (RSTC) Power-up Reset. VDDCORE rising. +#define AT91C_RSTC_RSTTYP_WAKEUP (0x1 << 8) // (RSTC) WakeUp Reset. VDDCORE rising. +#define AT91C_RSTC_RSTTYP_WATCHDOG (0x2 << 8) // (RSTC) Watchdog Reset. Watchdog overflow occured. +#define AT91C_RSTC_RSTTYP_SOFTWARE (0x3 << 8) // (RSTC) Software Reset. Processor reset required by the software. +#define AT91C_RSTC_RSTTYP_USER (0x4 << 8) // (RSTC) User Reset. NRST pin detected low. +#define AT91C_RSTC_RSTTYP_BROWNOUT (0x5 << 8) // (RSTC) Brownout Reset occured. +#define AT91C_RSTC_NRSTL (0x1 << 16) // (RSTC) NRST pin level +#define AT91C_RSTC_SRCMP (0x1 << 17) // (RSTC) Software Reset Command in Progress. +// -------- RSTC_RMR : (RSTC Offset: 0x8) Reset Mode Register -------- +#define AT91C_RSTC_URSTEN (0x1 << 0) // (RSTC) User Reset Enable +#define AT91C_RSTC_URSTIEN (0x1 << 4) // (RSTC) User Reset Interrupt Enable +#define AT91C_RSTC_ERSTL (0xF << 8) // (RSTC) User Reset Length +#define AT91C_RSTC_BODIEN (0x1 << 16) // (RSTC) Brownout Detection Interrupt Enable + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Real Time Timer Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_RTTC structure *** +#define RTTC_RTMR ( 0) // Real-time Mode Register +#define RTTC_RTAR ( 4) // Real-time Alarm Register +#define RTTC_RTVR ( 8) // Real-time Value Register +#define RTTC_RTSR (12) // Real-time Status Register +// -------- RTTC_RTMR : (RTTC Offset: 0x0) Real-time Mode Register -------- +#define AT91C_RTTC_RTPRES (0xFFFF << 0) // (RTTC) Real-time Timer Prescaler Value +#define AT91C_RTTC_ALMIEN (0x1 << 16) // (RTTC) Alarm Interrupt Enable +#define AT91C_RTTC_RTTINCIEN (0x1 << 17) // (RTTC) Real Time Timer Increment Interrupt Enable +#define AT91C_RTTC_RTTRST (0x1 << 18) // (RTTC) Real Time Timer Restart +// -------- RTTC_RTAR : (RTTC Offset: 0x4) Real-time Alarm Register -------- +#define AT91C_RTTC_ALMV (0x0 << 0) // (RTTC) Alarm Value +// -------- RTTC_RTVR : (RTTC Offset: 0x8) Current Real-time Value Register -------- +#define AT91C_RTTC_CRTV (0x0 << 0) // (RTTC) Current Real-time Value +// -------- RTTC_RTSR : (RTTC Offset: 0xc) Real-time Status Register -------- +#define AT91C_RTTC_ALMS (0x1 << 0) // (RTTC) Real-time Alarm Status +#define AT91C_RTTC_RTTINC (0x1 << 1) // (RTTC) Real-time Timer Increment + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Periodic Interval Timer Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_PITC structure *** +#define PITC_PIMR ( 0) // Period Interval Mode Register +#define PITC_PISR ( 4) // Period Interval Status Register +#define PITC_PIVR ( 8) // Period Interval Value Register +#define PITC_PIIR (12) // Period Interval Image Register +// -------- PITC_PIMR : (PITC Offset: 0x0) Periodic Interval Mode Register -------- +#define AT91C_PITC_PIV (0xFFFFF << 0) // (PITC) Periodic Interval Value +#define AT91C_PITC_PITEN (0x1 << 24) // (PITC) Periodic Interval Timer Enabled +#define AT91C_PITC_PITIEN (0x1 << 25) // (PITC) Periodic Interval Timer Interrupt Enable +// -------- PITC_PISR : (PITC Offset: 0x4) Periodic Interval Status Register -------- +#define AT91C_PITC_PITS (0x1 << 0) // (PITC) Periodic Interval Timer Status +// -------- PITC_PIVR : (PITC Offset: 0x8) Periodic Interval Value Register -------- +#define AT91C_PITC_CPIV (0xFFFFF << 0) // (PITC) Current Periodic Interval Value +#define AT91C_PITC_PICNT (0xFFF << 20) // (PITC) Periodic Interval Counter +// -------- PITC_PIIR : (PITC Offset: 0xc) Periodic Interval Image Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Watchdog Timer Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_WDTC structure *** +#define WDTC_WDCR ( 0) // Watchdog Control Register +#define WDTC_WDMR ( 4) // Watchdog Mode Register +#define WDTC_WDSR ( 8) // Watchdog Status Register +// -------- WDTC_WDCR : (WDTC Offset: 0x0) Periodic Interval Image Register -------- +#define AT91C_WDTC_WDRSTT (0x1 << 0) // (WDTC) Watchdog Restart +#define AT91C_WDTC_KEY (0xFF << 24) // (WDTC) Watchdog KEY Password +// -------- WDTC_WDMR : (WDTC Offset: 0x4) Watchdog Mode Register -------- +#define AT91C_WDTC_WDV (0xFFF << 0) // (WDTC) Watchdog Timer Restart +#define AT91C_WDTC_WDFIEN (0x1 << 12) // (WDTC) Watchdog Fault Interrupt Enable +#define AT91C_WDTC_WDRSTEN (0x1 << 13) // (WDTC) Watchdog Reset Enable +#define AT91C_WDTC_WDRPROC (0x1 << 14) // (WDTC) Watchdog Timer Restart +#define AT91C_WDTC_WDDIS (0x1 << 15) // (WDTC) Watchdog Disable +#define AT91C_WDTC_WDD (0xFFF << 16) // (WDTC) Watchdog Delta Value +#define AT91C_WDTC_WDDBGHLT (0x1 << 28) // (WDTC) Watchdog Debug Halt +#define AT91C_WDTC_WDIDLEHLT (0x1 << 29) // (WDTC) Watchdog Idle Halt +// -------- WDTC_WDSR : (WDTC Offset: 0x8) Watchdog Status Register -------- +#define AT91C_WDTC_WDUNF (0x1 << 0) // (WDTC) Watchdog Underflow +#define AT91C_WDTC_WDERR (0x1 << 1) // (WDTC) Watchdog Error + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Voltage Regulator Mode Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_VREG structure *** +#define VREG_MR ( 0) // Voltage Regulator Mode Register +// -------- VREG_MR : (VREG Offset: 0x0) Voltage Regulator Mode Register -------- +#define AT91C_VREG_PSTDBY (0x1 << 0) // (VREG) Voltage Regulator Power Standby Mode + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Memory Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_MC structure *** +#define MC_RCR ( 0) // MC Remap Control Register +#define MC_ASR ( 4) // MC Abort Status Register +#define MC_AASR ( 8) // MC Abort Address Status Register +#define MC_FMR (96) // MC Flash Mode Register +#define MC_FCR (100) // MC Flash Command Register +#define MC_FSR (104) // MC Flash Status Register +// -------- MC_RCR : (MC Offset: 0x0) MC Remap Control Register -------- +#define AT91C_MC_RCB (0x1 << 0) // (MC) Remap Command Bit +// -------- MC_ASR : (MC Offset: 0x4) MC Abort Status Register -------- +#define AT91C_MC_UNDADD (0x1 << 0) // (MC) Undefined Addess Abort Status +#define AT91C_MC_MISADD (0x1 << 1) // (MC) Misaligned Addess Abort Status +#define AT91C_MC_ABTSZ (0x3 << 8) // (MC) Abort Size Status +#define AT91C_MC_ABTSZ_BYTE (0x0 << 8) // (MC) Byte +#define AT91C_MC_ABTSZ_HWORD (0x1 << 8) // (MC) Half-word +#define AT91C_MC_ABTSZ_WORD (0x2 << 8) // (MC) Word +#define AT91C_MC_ABTTYP (0x3 << 10) // (MC) Abort Type Status +#define AT91C_MC_ABTTYP_DATAR (0x0 << 10) // (MC) Data Read +#define AT91C_MC_ABTTYP_DATAW (0x1 << 10) // (MC) Data Write +#define AT91C_MC_ABTTYP_FETCH (0x2 << 10) // (MC) Code Fetch +#define AT91C_MC_MST0 (0x1 << 16) // (MC) Master 0 Abort Source +#define AT91C_MC_MST1 (0x1 << 17) // (MC) Master 1 Abort Source +#define AT91C_MC_SVMST0 (0x1 << 24) // (MC) Saved Master 0 Abort Source +#define AT91C_MC_SVMST1 (0x1 << 25) // (MC) Saved Master 1 Abort Source +// -------- MC_FMR : (MC Offset: 0x60) MC Flash Mode Register -------- +#define AT91C_MC_FRDY (0x1 << 0) // (MC) Flash Ready +#define AT91C_MC_LOCKE (0x1 << 2) // (MC) Lock Error +#define AT91C_MC_PROGE (0x1 << 3) // (MC) Programming Error +#define AT91C_MC_NEBP (0x1 << 7) // (MC) No Erase Before Programming +#define AT91C_MC_FWS (0x3 << 8) // (MC) Flash Wait State +#define AT91C_MC_FWS_0FWS (0x0 << 8) // (MC) 1 cycle for Read, 2 for Write operations +#define AT91C_MC_FWS_1FWS (0x1 << 8) // (MC) 2 cycles for Read, 3 for Write operations +#define AT91C_MC_FWS_2FWS (0x2 << 8) // (MC) 3 cycles for Read, 4 for Write operations +#define AT91C_MC_FWS_3FWS (0x3 << 8) // (MC) 4 cycles for Read, 4 for Write operations +#define AT91C_MC_FMCN (0xFF << 16) // (MC) Flash Microsecond Cycle Number +// -------- MC_FCR : (MC Offset: 0x64) MC Flash Command Register -------- +#define AT91C_MC_FCMD (0xF << 0) // (MC) Flash Command +#define AT91C_MC_FCMD_START_PROG (0x1) // (MC) Starts the programming of th epage specified by PAGEN. +#define AT91C_MC_FCMD_LOCK (0x2) // (MC) Starts a lock sequence of the sector defined by the bits 4 to 7 of the field PAGEN. +#define AT91C_MC_FCMD_PROG_AND_LOCK (0x3) // (MC) The lock sequence automatically happens after the programming sequence is completed. +#define AT91C_MC_FCMD_UNLOCK (0x4) // (MC) Starts an unlock sequence of the sector defined by the bits 4 to 7 of the field PAGEN. +#define AT91C_MC_FCMD_ERASE_ALL (0x8) // (MC) Starts the erase of the entire flash.If at least a page is locked, the command is cancelled. +#define AT91C_MC_FCMD_SET_GP_NVM (0xB) // (MC) Set General Purpose NVM bits. +#define AT91C_MC_FCMD_CLR_GP_NVM (0xD) // (MC) Clear General Purpose NVM bits. +#define AT91C_MC_FCMD_SET_SECURITY (0xF) // (MC) Set Security Bit. +#define AT91C_MC_PAGEN (0x3FF << 8) // (MC) Page Number +#define AT91C_MC_KEY (0xFF << 24) // (MC) Writing Protect Key +// -------- MC_FSR : (MC Offset: 0x68) MC Flash Command Register -------- +#define AT91C_MC_SECURITY (0x1 << 4) // (MC) Security Bit Status +#define AT91C_MC_GPNVM0 (0x1 << 8) // (MC) Sector 0 Lock Status +#define AT91C_MC_GPNVM1 (0x1 << 9) // (MC) Sector 1 Lock Status +#define AT91C_MC_GPNVM2 (0x1 << 10) // (MC) Sector 2 Lock Status +#define AT91C_MC_GPNVM3 (0x1 << 11) // (MC) Sector 3 Lock Status +#define AT91C_MC_GPNVM4 (0x1 << 12) // (MC) Sector 4 Lock Status +#define AT91C_MC_GPNVM5 (0x1 << 13) // (MC) Sector 5 Lock Status +#define AT91C_MC_GPNVM6 (0x1 << 14) // (MC) Sector 6 Lock Status +#define AT91C_MC_GPNVM7 (0x1 << 15) // (MC) Sector 7 Lock Status +#define AT91C_MC_LOCKS0 (0x1 << 16) // (MC) Sector 0 Lock Status +#define AT91C_MC_LOCKS1 (0x1 << 17) // (MC) Sector 1 Lock Status +#define AT91C_MC_LOCKS2 (0x1 << 18) // (MC) Sector 2 Lock Status +#define AT91C_MC_LOCKS3 (0x1 << 19) // (MC) Sector 3 Lock Status +#define AT91C_MC_LOCKS4 (0x1 << 20) // (MC) Sector 4 Lock Status +#define AT91C_MC_LOCKS5 (0x1 << 21) // (MC) Sector 5 Lock Status +#define AT91C_MC_LOCKS6 (0x1 << 22) // (MC) Sector 6 Lock Status +#define AT91C_MC_LOCKS7 (0x1 << 23) // (MC) Sector 7 Lock Status +#define AT91C_MC_LOCKS8 (0x1 << 24) // (MC) Sector 8 Lock Status +#define AT91C_MC_LOCKS9 (0x1 << 25) // (MC) Sector 9 Lock Status +#define AT91C_MC_LOCKS10 (0x1 << 26) // (MC) Sector 10 Lock Status +#define AT91C_MC_LOCKS11 (0x1 << 27) // (MC) Sector 11 Lock Status +#define AT91C_MC_LOCKS12 (0x1 << 28) // (MC) Sector 12 Lock Status +#define AT91C_MC_LOCKS13 (0x1 << 29) // (MC) Sector 13 Lock Status +#define AT91C_MC_LOCKS14 (0x1 << 30) // (MC) Sector 14 Lock Status +#define AT91C_MC_LOCKS15 (0x1 << 31) // (MC) Sector 15 Lock Status + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Serial Parallel Interface +// ***************************************************************************** +// *** Register offset in AT91S_SPI structure *** +#define SPI_CR ( 0) // Control Register +#define SPI_MR ( 4) // Mode Register +#define SPI_RDR ( 8) // Receive Data Register +#define SPI_TDR (12) // Transmit Data Register +#define SPI_SR (16) // Status Register +#define SPI_IER (20) // Interrupt Enable Register +#define SPI_IDR (24) // Interrupt Disable Register +#define SPI_IMR (28) // Interrupt Mask Register +#define SPI_CSR (48) // Chip Select Register +#define SPI_RPR (256) // Receive Pointer Register +#define SPI_RCR (260) // Receive Counter Register +#define SPI_TPR (264) // Transmit Pointer Register +#define SPI_TCR (268) // Transmit Counter Register +#define SPI_RNPR (272) // Receive Next Pointer Register +#define SPI_RNCR (276) // Receive Next Counter Register +#define SPI_TNPR (280) // Transmit Next Pointer Register +#define SPI_TNCR (284) // Transmit Next Counter Register +#define SPI_PTCR (288) // PDC Transfer Control Register +#define SPI_PTSR (292) // PDC Transfer Status Register +// -------- SPI_CR : (SPI Offset: 0x0) SPI Control Register -------- +#define AT91C_SPI_SPIEN (0x1 << 0) // (SPI) SPI Enable +#define AT91C_SPI_SPIDIS (0x1 << 1) // (SPI) SPI Disable +#define AT91C_SPI_SWRST (0x1 << 7) // (SPI) SPI Software reset +#define AT91C_SPI_LASTXFER (0x1 << 24) // (SPI) SPI Last Transfer +// -------- SPI_MR : (SPI Offset: 0x4) SPI Mode Register -------- +#define AT91C_SPI_MSTR (0x1 << 0) // (SPI) Master/Slave Mode +#define AT91C_SPI_PS (0x1 << 1) // (SPI) Peripheral Select +#define AT91C_SPI_PS_FIXED (0x0 << 1) // (SPI) Fixed Peripheral Select +#define AT91C_SPI_PS_VARIABLE (0x1 << 1) // (SPI) Variable Peripheral Select +#define AT91C_SPI_PCSDEC (0x1 << 2) // (SPI) Chip Select Decode +#define AT91C_SPI_FDIV (0x1 << 3) // (SPI) Clock Selection +#define AT91C_SPI_MODFDIS (0x1 << 4) // (SPI) Mode Fault Detection +#define AT91C_SPI_LLB (0x1 << 7) // (SPI) Clock Selection +#define AT91C_SPI_PCS (0xF << 16) // (SPI) Peripheral Chip Select +#define AT91C_SPI_DLYBCS (0xFF << 24) // (SPI) Delay Between Chip Selects +// -------- SPI_RDR : (SPI Offset: 0x8) Receive Data Register -------- +#define AT91C_SPI_RD (0xFFFF << 0) // (SPI) Receive Data +#define AT91C_SPI_RPCS (0xF << 16) // (SPI) Peripheral Chip Select Status +// -------- SPI_TDR : (SPI Offset: 0xc) Transmit Data Register -------- +#define AT91C_SPI_TD (0xFFFF << 0) // (SPI) Transmit Data +#define AT91C_SPI_TPCS (0xF << 16) // (SPI) Peripheral Chip Select Status +// -------- SPI_SR : (SPI Offset: 0x10) Status Register -------- +#define AT91C_SPI_RDRF (0x1 << 0) // (SPI) Receive Data Register Full +#define AT91C_SPI_TDRE (0x1 << 1) // (SPI) Transmit Data Register Empty +#define AT91C_SPI_MODF (0x1 << 2) // (SPI) Mode Fault Error +#define AT91C_SPI_OVRES (0x1 << 3) // (SPI) Overrun Error Status +#define AT91C_SPI_ENDRX (0x1 << 4) // (SPI) End of Receiver Transfer +#define AT91C_SPI_ENDTX (0x1 << 5) // (SPI) End of Receiver Transfer +#define AT91C_SPI_RXBUFF (0x1 << 6) // (SPI) RXBUFF Interrupt +#define AT91C_SPI_TXBUFE (0x1 << 7) // (SPI) TXBUFE Interrupt +#define AT91C_SPI_NSSR (0x1 << 8) // (SPI) NSSR Interrupt +#define AT91C_SPI_TXEMPTY (0x1 << 9) // (SPI) TXEMPTY Interrupt +#define AT91C_SPI_SPIENS (0x1 << 16) // (SPI) Enable Status +// -------- SPI_IER : (SPI Offset: 0x14) Interrupt Enable Register -------- +// -------- SPI_IDR : (SPI Offset: 0x18) Interrupt Disable Register -------- +// -------- SPI_IMR : (SPI Offset: 0x1c) Interrupt Mask Register -------- +// -------- SPI_CSR : (SPI Offset: 0x30) Chip Select Register -------- +#define AT91C_SPI_CPOL (0x1 << 0) // (SPI) Clock Polarity +#define AT91C_SPI_NCPHA (0x1 << 1) // (SPI) Clock Phase +#define AT91C_SPI_CSAAT (0x1 << 3) // (SPI) Chip Select Active After Transfer +#define AT91C_SPI_BITS (0xF << 4) // (SPI) Bits Per Transfer +#define AT91C_SPI_BITS_8 (0x0 << 4) // (SPI) 8 Bits Per transfer +#define AT91C_SPI_BITS_9 (0x1 << 4) // (SPI) 9 Bits Per transfer +#define AT91C_SPI_BITS_10 (0x2 << 4) // (SPI) 10 Bits Per transfer +#define AT91C_SPI_BITS_11 (0x3 << 4) // (SPI) 11 Bits Per transfer +#define AT91C_SPI_BITS_12 (0x4 << 4) // (SPI) 12 Bits Per transfer +#define AT91C_SPI_BITS_13 (0x5 << 4) // (SPI) 13 Bits Per transfer +#define AT91C_SPI_BITS_14 (0x6 << 4) // (SPI) 14 Bits Per transfer +#define AT91C_SPI_BITS_15 (0x7 << 4) // (SPI) 15 Bits Per transfer +#define AT91C_SPI_BITS_16 (0x8 << 4) // (SPI) 16 Bits Per transfer +#define AT91C_SPI_SCBR (0xFF << 8) // (SPI) Serial Clock Baud Rate +#define AT91C_SPI_DLYBS (0xFF << 16) // (SPI) Delay Before SPCK +#define AT91C_SPI_DLYBCT (0xFF << 24) // (SPI) Delay Between Consecutive Transfers + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Usart +// ***************************************************************************** +// *** Register offset in AT91S_USART structure *** +#define US_CR ( 0) // Control Register +#define US_MR ( 4) // Mode Register +#define US_IER ( 8) // Interrupt Enable Register +#define US_IDR (12) // Interrupt Disable Register +#define US_IMR (16) // Interrupt Mask Register +#define US_CSR (20) // Channel Status Register +#define US_RHR (24) // Receiver Holding Register +#define US_THR (28) // Transmitter Holding Register +#define US_BRGR (32) // Baud Rate Generator Register +#define US_RTOR (36) // Receiver Time-out Register +#define US_TTGR (40) // Transmitter Time-guard Register +#define US_FIDI (64) // FI_DI_Ratio Register +#define US_NER (68) // Nb Errors Register +#define US_IF (76) // IRDA_FILTER Register +#define US_RPR (256) // Receive Pointer Register +#define US_RCR (260) // Receive Counter Register +#define US_TPR (264) // Transmit Pointer Register +#define US_TCR (268) // Transmit Counter Register +#define US_RNPR (272) // Receive Next Pointer Register +#define US_RNCR (276) // Receive Next Counter Register +#define US_TNPR (280) // Transmit Next Pointer Register +#define US_TNCR (284) // Transmit Next Counter Register +#define US_PTCR (288) // PDC Transfer Control Register +#define US_PTSR (292) // PDC Transfer Status Register +// -------- US_CR : (USART Offset: 0x0) Debug Unit Control Register -------- +#define AT91C_US_STTBRK (0x1 << 9) // (USART) Start Break +#define AT91C_US_STPBRK (0x1 << 10) // (USART) Stop Break +#define AT91C_US_STTTO (0x1 << 11) // (USART) Start Time-out +#define AT91C_US_SENDA (0x1 << 12) // (USART) Send Address +#define AT91C_US_RSTIT (0x1 << 13) // (USART) Reset Iterations +#define AT91C_US_RSTNACK (0x1 << 14) // (USART) Reset Non Acknowledge +#define AT91C_US_RETTO (0x1 << 15) // (USART) Rearm Time-out +#define AT91C_US_DTREN (0x1 << 16) // (USART) Data Terminal ready Enable +#define AT91C_US_DTRDIS (0x1 << 17) // (USART) Data Terminal ready Disable +#define AT91C_US_RTSEN (0x1 << 18) // (USART) Request to Send enable +#define AT91C_US_RTSDIS (0x1 << 19) // (USART) Request to Send Disable +// -------- US_MR : (USART Offset: 0x4) Debug Unit Mode Register -------- +#define AT91C_US_USMODE (0xF << 0) // (USART) Usart mode +#define AT91C_US_USMODE_NORMAL (0x0) // (USART) Normal +#define AT91C_US_USMODE_RS485 (0x1) // (USART) RS485 +#define AT91C_US_USMODE_HWHSH (0x2) // (USART) Hardware Handshaking +#define AT91C_US_USMODE_MODEM (0x3) // (USART) Modem +#define AT91C_US_USMODE_ISO7816_0 (0x4) // (USART) ISO7816 protocol: T = 0 +#define AT91C_US_USMODE_ISO7816_1 (0x6) // (USART) ISO7816 protocol: T = 1 +#define AT91C_US_USMODE_IRDA (0x8) // (USART) IrDA +#define AT91C_US_USMODE_SWHSH (0xC) // (USART) Software Handshaking +#define AT91C_US_CLKS (0x3 << 4) // (USART) Clock Selection (Baud Rate generator Input Clock +#define AT91C_US_CLKS_CLOCK (0x0 << 4) // (USART) Clock +#define AT91C_US_CLKS_FDIV1 (0x1 << 4) // (USART) fdiv1 +#define AT91C_US_CLKS_SLOW (0x2 << 4) // (USART) slow_clock (ARM) +#define AT91C_US_CLKS_EXT (0x3 << 4) // (USART) External (SCK) +#define AT91C_US_CHRL (0x3 << 6) // (USART) Clock Selection (Baud Rate generator Input Clock +#define AT91C_US_CHRL_5_BITS (0x0 << 6) // (USART) Character Length: 5 bits +#define AT91C_US_CHRL_6_BITS (0x1 << 6) // (USART) Character Length: 6 bits +#define AT91C_US_CHRL_7_BITS (0x2 << 6) // (USART) Character Length: 7 bits +#define AT91C_US_CHRL_8_BITS (0x3 << 6) // (USART) Character Length: 8 bits +#define AT91C_US_SYNC (0x1 << 8) // (USART) Synchronous Mode Select +#define AT91C_US_NBSTOP (0x3 << 12) // (USART) Number of Stop bits +#define AT91C_US_NBSTOP_1_BIT (0x0 << 12) // (USART) 1 stop bit +#define AT91C_US_NBSTOP_15_BIT (0x1 << 12) // (USART) Asynchronous (SYNC=0) 2 stop bits Synchronous (SYNC=1) 2 stop bits +#define AT91C_US_NBSTOP_2_BIT (0x2 << 12) // (USART) 2 stop bits +#define AT91C_US_MSBF (0x1 << 16) // (USART) Bit Order +#define AT91C_US_MODE9 (0x1 << 17) // (USART) 9-bit Character length +#define AT91C_US_CKLO (0x1 << 18) // (USART) Clock Output Select +#define AT91C_US_OVER (0x1 << 19) // (USART) Over Sampling Mode +#define AT91C_US_INACK (0x1 << 20) // (USART) Inhibit Non Acknowledge +#define AT91C_US_DSNACK (0x1 << 21) // (USART) Disable Successive NACK +#define AT91C_US_MAX_ITER (0x1 << 24) // (USART) Number of Repetitions +#define AT91C_US_FILTER (0x1 << 28) // (USART) Receive Line Filter +// -------- US_IER : (USART Offset: 0x8) Debug Unit Interrupt Enable Register -------- +#define AT91C_US_RXBRK (0x1 << 2) // (USART) Break Received/End of Break +#define AT91C_US_TIMEOUT (0x1 << 8) // (USART) Receiver Time-out +#define AT91C_US_ITERATION (0x1 << 10) // (USART) Max number of Repetitions Reached +#define AT91C_US_NACK (0x1 << 13) // (USART) Non Acknowledge +#define AT91C_US_RIIC (0x1 << 16) // (USART) Ring INdicator Input Change Flag +#define AT91C_US_DSRIC (0x1 << 17) // (USART) Data Set Ready Input Change Flag +#define AT91C_US_DCDIC (0x1 << 18) // (USART) Data Carrier Flag +#define AT91C_US_CTSIC (0x1 << 19) // (USART) Clear To Send Input Change Flag +// -------- US_IDR : (USART Offset: 0xc) Debug Unit Interrupt Disable Register -------- +// -------- US_IMR : (USART Offset: 0x10) Debug Unit Interrupt Mask Register -------- +// -------- US_CSR : (USART Offset: 0x14) Debug Unit Channel Status Register -------- +#define AT91C_US_RI (0x1 << 20) // (USART) Image of RI Input +#define AT91C_US_DSR (0x1 << 21) // (USART) Image of DSR Input +#define AT91C_US_DCD (0x1 << 22) // (USART) Image of DCD Input +#define AT91C_US_CTS (0x1 << 23) // (USART) Image of CTS Input + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Synchronous Serial Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_SSC structure *** +#define SSC_CR ( 0) // Control Register +#define SSC_CMR ( 4) // Clock Mode Register +#define SSC_RCMR (16) // Receive Clock ModeRegister +#define SSC_RFMR (20) // Receive Frame Mode Register +#define SSC_TCMR (24) // Transmit Clock Mode Register +#define SSC_TFMR (28) // Transmit Frame Mode Register +#define SSC_RHR (32) // Receive Holding Register +#define SSC_THR (36) // Transmit Holding Register +#define SSC_RSHR (48) // Receive Sync Holding Register +#define SSC_TSHR (52) // Transmit Sync Holding Register +#define SSC_SR (64) // Status Register +#define SSC_IER (68) // Interrupt Enable Register +#define SSC_IDR (72) // Interrupt Disable Register +#define SSC_IMR (76) // Interrupt Mask Register +#define SSC_RPR (256) // Receive Pointer Register +#define SSC_RCR (260) // Receive Counter Register +#define SSC_TPR (264) // Transmit Pointer Register +#define SSC_TCR (268) // Transmit Counter Register +#define SSC_RNPR (272) // Receive Next Pointer Register +#define SSC_RNCR (276) // Receive Next Counter Register +#define SSC_TNPR (280) // Transmit Next Pointer Register +#define SSC_TNCR (284) // Transmit Next Counter Register +#define SSC_PTCR (288) // PDC Transfer Control Register +#define SSC_PTSR (292) // PDC Transfer Status Register +// -------- SSC_CR : (SSC Offset: 0x0) SSC Control Register -------- +#define AT91C_SSC_RXEN (0x1 << 0) // (SSC) Receive Enable +#define AT91C_SSC_RXDIS (0x1 << 1) // (SSC) Receive Disable +#define AT91C_SSC_TXEN (0x1 << 8) // (SSC) Transmit Enable +#define AT91C_SSC_TXDIS (0x1 << 9) // (SSC) Transmit Disable +#define AT91C_SSC_SWRST (0x1 << 15) // (SSC) Software Reset +// -------- SSC_RCMR : (SSC Offset: 0x10) SSC Receive Clock Mode Register -------- +#define AT91C_SSC_CKS (0x3 << 0) // (SSC) Receive/Transmit Clock Selection +#define AT91C_SSC_CKS_DIV (0x0) // (SSC) Divided Clock +#define AT91C_SSC_CKS_TK (0x1) // (SSC) TK Clock signal +#define AT91C_SSC_CKS_RK (0x2) // (SSC) RK pin +#define AT91C_SSC_CKO (0x7 << 2) // (SSC) Receive/Transmit Clock Output Mode Selection +#define AT91C_SSC_CKO_NONE (0x0 << 2) // (SSC) Receive/Transmit Clock Output Mode: None RK pin: Input-only +#define AT91C_SSC_CKO_CONTINOUS (0x1 << 2) // (SSC) Continuous Receive/Transmit Clock RK pin: Output +#define AT91C_SSC_CKO_DATA_TX (0x2 << 2) // (SSC) Receive/Transmit Clock only during data transfers RK pin: Output +#define AT91C_SSC_CKI (0x1 << 5) // (SSC) Receive/Transmit Clock Inversion +#define AT91C_SSC_CKG (0x3 << 6) // (SSC) Receive/Transmit Clock Gating Selection +#define AT91C_SSC_CKG_NONE (0x0 << 6) // (SSC) Receive/Transmit Clock Gating: None, continuous clock +#define AT91C_SSC_CKG_LOW (0x1 << 6) // (SSC) Receive/Transmit Clock enabled only if RF Low +#define AT91C_SSC_CKG_HIGH (0x2 << 6) // (SSC) Receive/Transmit Clock enabled only if RF High +#define AT91C_SSC_START (0xF << 8) // (SSC) Receive/Transmit Start Selection +#define AT91C_SSC_START_CONTINOUS (0x0 << 8) // (SSC) Continuous, as soon as the receiver is enabled, and immediately after the end of transfer of the previous data. +#define AT91C_SSC_START_TX (0x1 << 8) // (SSC) Transmit/Receive start +#define AT91C_SSC_START_LOW_RF (0x2 << 8) // (SSC) Detection of a low level on RF input +#define AT91C_SSC_START_HIGH_RF (0x3 << 8) // (SSC) Detection of a high level on RF input +#define AT91C_SSC_START_FALL_RF (0x4 << 8) // (SSC) Detection of a falling edge on RF input +#define AT91C_SSC_START_RISE_RF (0x5 << 8) // (SSC) Detection of a rising edge on RF input +#define AT91C_SSC_START_LEVEL_RF (0x6 << 8) // (SSC) Detection of any level change on RF input +#define AT91C_SSC_START_EDGE_RF (0x7 << 8) // (SSC) Detection of any edge on RF input +#define AT91C_SSC_START_0 (0x8 << 8) // (SSC) Compare 0 +#define AT91C_SSC_STOP (0x1 << 12) // (SSC) Receive Stop Selection +#define AT91C_SSC_STTDLY (0xFF << 16) // (SSC) Receive/Transmit Start Delay +#define AT91C_SSC_PERIOD (0xFF << 24) // (SSC) Receive/Transmit Period Divider Selection +// -------- SSC_RFMR : (SSC Offset: 0x14) SSC Receive Frame Mode Register -------- +#define AT91C_SSC_DATLEN (0x1F << 0) // (SSC) Data Length +#define AT91C_SSC_LOOP (0x1 << 5) // (SSC) Loop Mode +#define AT91C_SSC_MSBF (0x1 << 7) // (SSC) Most Significant Bit First +#define AT91C_SSC_DATNB (0xF << 8) // (SSC) Data Number per Frame +#define AT91C_SSC_FSLEN (0xF << 16) // (SSC) Receive/Transmit Frame Sync length +#define AT91C_SSC_FSOS (0x7 << 20) // (SSC) Receive/Transmit Frame Sync Output Selection +#define AT91C_SSC_FSOS_NONE (0x0 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: None RK pin Input-only +#define AT91C_SSC_FSOS_NEGATIVE (0x1 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Negative Pulse +#define AT91C_SSC_FSOS_POSITIVE (0x2 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Positive Pulse +#define AT91C_SSC_FSOS_LOW (0x3 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Driver Low during data transfer +#define AT91C_SSC_FSOS_HIGH (0x4 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Driver High during data transfer +#define AT91C_SSC_FSOS_TOGGLE (0x5 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Toggling at each start of data transfer +#define AT91C_SSC_FSEDGE (0x1 << 24) // (SSC) Frame Sync Edge Detection +// -------- SSC_TCMR : (SSC Offset: 0x18) SSC Transmit Clock Mode Register -------- +// -------- SSC_TFMR : (SSC Offset: 0x1c) SSC Transmit Frame Mode Register -------- +#define AT91C_SSC_DATDEF (0x1 << 5) // (SSC) Data Default Value +#define AT91C_SSC_FSDEN (0x1 << 23) // (SSC) Frame Sync Data Enable +// -------- SSC_SR : (SSC Offset: 0x40) SSC Status Register -------- +#define AT91C_SSC_TXRDY (0x1 << 0) // (SSC) Transmit Ready +#define AT91C_SSC_TXEMPTY (0x1 << 1) // (SSC) Transmit Empty +#define AT91C_SSC_ENDTX (0x1 << 2) // (SSC) End Of Transmission +#define AT91C_SSC_TXBUFE (0x1 << 3) // (SSC) Transmit Buffer Empty +#define AT91C_SSC_RXRDY (0x1 << 4) // (SSC) Receive Ready +#define AT91C_SSC_OVRUN (0x1 << 5) // (SSC) Receive Overrun +#define AT91C_SSC_ENDRX (0x1 << 6) // (SSC) End of Reception +#define AT91C_SSC_RXBUFF (0x1 << 7) // (SSC) Receive Buffer Full +#define AT91C_SSC_CP0 (0x1 << 8) // (SSC) Compare 0 +#define AT91C_SSC_CP1 (0x1 << 9) // (SSC) Compare 1 +#define AT91C_SSC_TXSYN (0x1 << 10) // (SSC) Transmit Sync +#define AT91C_SSC_RXSYN (0x1 << 11) // (SSC) Receive Sync +#define AT91C_SSC_TXENA (0x1 << 16) // (SSC) Transmit Enable +#define AT91C_SSC_RXENA (0x1 << 17) // (SSC) Receive Enable +// -------- SSC_IER : (SSC Offset: 0x44) SSC Interrupt Enable Register -------- +// -------- SSC_IDR : (SSC Offset: 0x48) SSC Interrupt Disable Register -------- +// -------- SSC_IMR : (SSC Offset: 0x4c) SSC Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Two-wire Interface +// ***************************************************************************** +// *** Register offset in AT91S_TWI structure *** +#define TWI_CR ( 0) // Control Register +#define TWI_MMR ( 4) // Master Mode Register +#define TWI_IADR (12) // Internal Address Register +#define TWI_CWGR (16) // Clock Waveform Generator Register +#define TWI_SR (32) // Status Register +#define TWI_IER (36) // Interrupt Enable Register +#define TWI_IDR (40) // Interrupt Disable Register +#define TWI_IMR (44) // Interrupt Mask Register +#define TWI_RHR (48) // Receive Holding Register +#define TWI_THR (52) // Transmit Holding Register +// -------- TWI_CR : (TWI Offset: 0x0) TWI Control Register -------- +#define AT91C_TWI_START (0x1 << 0) // (TWI) Send a START Condition +#define AT91C_TWI_STOP (0x1 << 1) // (TWI) Send a STOP Condition +#define AT91C_TWI_MSEN (0x1 << 2) // (TWI) TWI Master Transfer Enabled +#define AT91C_TWI_MSDIS (0x1 << 3) // (TWI) TWI Master Transfer Disabled +#define AT91C_TWI_SWRST (0x1 << 7) // (TWI) Software Reset +// -------- TWI_MMR : (TWI Offset: 0x4) TWI Master Mode Register -------- +#define AT91C_TWI_IADRSZ (0x3 << 8) // (TWI) Internal Device Address Size +#define AT91C_TWI_IADRSZ_NO (0x0 << 8) // (TWI) No internal device address +#define AT91C_TWI_IADRSZ_1_BYTE (0x1 << 8) // (TWI) One-byte internal device address +#define AT91C_TWI_IADRSZ_2_BYTE (0x2 << 8) // (TWI) Two-byte internal device address +#define AT91C_TWI_IADRSZ_3_BYTE (0x3 << 8) // (TWI) Three-byte internal device address +#define AT91C_TWI_MREAD (0x1 << 12) // (TWI) Master Read Direction +#define AT91C_TWI_DADR (0x7F << 16) // (TWI) Device Address +// -------- TWI_CWGR : (TWI Offset: 0x10) TWI Clock Waveform Generator Register -------- +#define AT91C_TWI_CLDIV (0xFF << 0) // (TWI) Clock Low Divider +#define AT91C_TWI_CHDIV (0xFF << 8) // (TWI) Clock High Divider +#define AT91C_TWI_CKDIV (0x7 << 16) // (TWI) Clock Divider +// -------- TWI_SR : (TWI Offset: 0x20) TWI Status Register -------- +#define AT91C_TWI_TXCOMP (0x1 << 0) // (TWI) Transmission Completed +#define AT91C_TWI_RXRDY (0x1 << 1) // (TWI) Receive holding register ReaDY +#define AT91C_TWI_TXRDY (0x1 << 2) // (TWI) Transmit holding register ReaDY +#define AT91C_TWI_OVRE (0x1 << 6) // (TWI) Overrun Error +#define AT91C_TWI_UNRE (0x1 << 7) // (TWI) Underrun Error +#define AT91C_TWI_NACK (0x1 << 8) // (TWI) Not Acknowledged +// -------- TWI_IER : (TWI Offset: 0x24) TWI Interrupt Enable Register -------- +// -------- TWI_IDR : (TWI Offset: 0x28) TWI Interrupt Disable Register -------- +// -------- TWI_IMR : (TWI Offset: 0x2c) TWI Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR PWMC Channel Interface +// ***************************************************************************** +// *** Register offset in AT91S_PWMC_CH structure *** +#define PWMC_CMR ( 0) // Channel Mode Register +#define PWMC_CDTYR ( 4) // Channel Duty Cycle Register +#define PWMC_CPRDR ( 8) // Channel Period Register +#define PWMC_CCNTR (12) // Channel Counter Register +#define PWMC_CUPDR (16) // Channel Update Register +#define PWMC_Reserved (20) // Reserved +// -------- PWMC_CMR : (PWMC_CH Offset: 0x0) PWMC Channel Mode Register -------- +#define AT91C_PWMC_CPRE (0xF << 0) // (PWMC_CH) Channel Pre-scaler : PWMC_CLKx +#define AT91C_PWMC_CPRE_MCK (0x0) // (PWMC_CH) +#define AT91C_PWMC_CPRE_MCKA (0xB) // (PWMC_CH) +#define AT91C_PWMC_CPRE_MCKB (0xC) // (PWMC_CH) +#define AT91C_PWMC_CALG (0x1 << 8) // (PWMC_CH) Channel Alignment +#define AT91C_PWMC_CPOL (0x1 << 9) // (PWMC_CH) Channel Polarity +#define AT91C_PWMC_CPD (0x1 << 10) // (PWMC_CH) Channel Update Period +// -------- PWMC_CDTYR : (PWMC_CH Offset: 0x4) PWMC Channel Duty Cycle Register -------- +#define AT91C_PWMC_CDTY (0x0 << 0) // (PWMC_CH) Channel Duty Cycle +// -------- PWMC_CPRDR : (PWMC_CH Offset: 0x8) PWMC Channel Period Register -------- +#define AT91C_PWMC_CPRD (0x0 << 0) // (PWMC_CH) Channel Period +// -------- PWMC_CCNTR : (PWMC_CH Offset: 0xc) PWMC Channel Counter Register -------- +#define AT91C_PWMC_CCNT (0x0 << 0) // (PWMC_CH) Channel Counter +// -------- PWMC_CUPDR : (PWMC_CH Offset: 0x10) PWMC Channel Update Register -------- +#define AT91C_PWMC_CUPD (0x0 << 0) // (PWMC_CH) Channel Update + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Pulse Width Modulation Controller Interface +// ***************************************************************************** +// *** Register offset in AT91S_PWMC structure *** +#define PWMC_MR ( 0) // PWMC Mode Register +#define PWMC_ENA ( 4) // PWMC Enable Register +#define PWMC_DIS ( 8) // PWMC Disable Register +#define PWMC_SR (12) // PWMC Status Register +#define PWMC_IER (16) // PWMC Interrupt Enable Register +#define PWMC_IDR (20) // PWMC Interrupt Disable Register +#define PWMC_IMR (24) // PWMC Interrupt Mask Register +#define PWMC_ISR (28) // PWMC Interrupt Status Register +#define PWMC_VR (252) // PWMC Version Register +#define PWMC_CH (512) // PWMC Channel +// -------- PWMC_MR : (PWMC Offset: 0x0) PWMC Mode Register -------- +#define AT91C_PWMC_DIVA (0xFF << 0) // (PWMC) CLKA divide factor. +#define AT91C_PWMC_PREA (0xF << 8) // (PWMC) Divider Input Clock Prescaler A +#define AT91C_PWMC_PREA_MCK (0x0 << 8) // (PWMC) +#define AT91C_PWMC_DIVB (0xFF << 16) // (PWMC) CLKB divide factor. +#define AT91C_PWMC_PREB (0xF << 24) // (PWMC) Divider Input Clock Prescaler B +#define AT91C_PWMC_PREB_MCK (0x0 << 24) // (PWMC) +// -------- PWMC_ENA : (PWMC Offset: 0x4) PWMC Enable Register -------- +#define AT91C_PWMC_CHID0 (0x1 << 0) // (PWMC) Channel ID 0 +#define AT91C_PWMC_CHID1 (0x1 << 1) // (PWMC) Channel ID 1 +#define AT91C_PWMC_CHID2 (0x1 << 2) // (PWMC) Channel ID 2 +#define AT91C_PWMC_CHID3 (0x1 << 3) // (PWMC) Channel ID 3 +// -------- PWMC_DIS : (PWMC Offset: 0x8) PWMC Disable Register -------- +// -------- PWMC_SR : (PWMC Offset: 0xc) PWMC Status Register -------- +// -------- PWMC_IER : (PWMC Offset: 0x10) PWMC Interrupt Enable Register -------- +// -------- PWMC_IDR : (PWMC Offset: 0x14) PWMC Interrupt Disable Register -------- +// -------- PWMC_IMR : (PWMC Offset: 0x18) PWMC Interrupt Mask Register -------- +// -------- PWMC_ISR : (PWMC Offset: 0x1c) PWMC Interrupt Status Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR USB Device Interface +// ***************************************************************************** +// *** Register offset in AT91S_UDP structure *** +#define UDP_NUM ( 0) // Frame Number Register +#define UDP_GLBSTATE ( 4) // Global State Register +#define UDP_FADDR ( 8) // Function Address Register +#define UDP_IER (16) // Interrupt Enable Register +#define UDP_IDR (20) // Interrupt Disable Register +#define UDP_IMR (24) // Interrupt Mask Register +#define UDP_ISR (28) // Interrupt Status Register +#define UDP_ICR (32) // Interrupt Clear Register +#define UDP_RSTEP (40) // Reset Endpoint Register +#define UDP_CSR (48) // Endpoint Control and Status Register +#define UDP_FDR (80) // Endpoint FIFO Data Register +#define UDP_TXVC (116) // Transceiver Control Register +// -------- UDP_FRM_NUM : (UDP Offset: 0x0) USB Frame Number Register -------- +#define AT91C_UDP_FRM_NUM (0x7FF << 0) // (UDP) Frame Number as Defined in the Packet Field Formats +#define AT91C_UDP_FRM_ERR (0x1 << 16) // (UDP) Frame Error +#define AT91C_UDP_FRM_OK (0x1 << 17) // (UDP) Frame OK +// -------- UDP_GLB_STATE : (UDP Offset: 0x4) USB Global State Register -------- +#define AT91C_UDP_FADDEN (0x1 << 0) // (UDP) Function Address Enable +#define AT91C_UDP_CONFG (0x1 << 1) // (UDP) Configured +#define AT91C_UDP_ESR (0x1 << 2) // (UDP) Enable Send Resume +#define AT91C_UDP_RSMINPR (0x1 << 3) // (UDP) A Resume Has Been Sent to the Host +#define AT91C_UDP_RMWUPE (0x1 << 4) // (UDP) Remote Wake Up Enable +// -------- UDP_FADDR : (UDP Offset: 0x8) USB Function Address Register -------- +#define AT91C_UDP_FADD (0xFF << 0) // (UDP) Function Address Value +#define AT91C_UDP_FEN (0x1 << 8) // (UDP) Function Enable +// -------- UDP_IER : (UDP Offset: 0x10) USB Interrupt Enable Register -------- +#define AT91C_UDP_EPINT0 (0x1 << 0) // (UDP) Endpoint 0 Interrupt +#define AT91C_UDP_EPINT1 (0x1 << 1) // (UDP) Endpoint 0 Interrupt +#define AT91C_UDP_EPINT2 (0x1 << 2) // (UDP) Endpoint 2 Interrupt +#define AT91C_UDP_EPINT3 (0x1 << 3) // (UDP) Endpoint 3 Interrupt +#define AT91C_UDP_EPINT4 (0x1 << 4) // (UDP) Endpoint 4 Interrupt +#define AT91C_UDP_EPINT5 (0x1 << 5) // (UDP) Endpoint 5 Interrupt +#define AT91C_UDP_RXSUSP (0x1 << 8) // (UDP) USB Suspend Interrupt +#define AT91C_UDP_RXRSM (0x1 << 9) // (UDP) USB Resume Interrupt +#define AT91C_UDP_EXTRSM (0x1 << 10) // (UDP) USB External Resume Interrupt +#define AT91C_UDP_SOFINT (0x1 << 11) // (UDP) USB Start Of frame Interrupt +#define AT91C_UDP_WAKEUP (0x1 << 13) // (UDP) USB Resume Interrupt +// -------- UDP_IDR : (UDP Offset: 0x14) USB Interrupt Disable Register -------- +// -------- UDP_IMR : (UDP Offset: 0x18) USB Interrupt Mask Register -------- +// -------- UDP_ISR : (UDP Offset: 0x1c) USB Interrupt Status Register -------- +#define AT91C_UDP_ENDBUSRES (0x1 << 12) // (UDP) USB End Of Bus Reset Interrupt +// -------- UDP_ICR : (UDP Offset: 0x20) USB Interrupt Clear Register -------- +// -------- UDP_RST_EP : (UDP Offset: 0x28) USB Reset Endpoint Register -------- +#define AT91C_UDP_EP0 (0x1 << 0) // (UDP) Reset Endpoint 0 +#define AT91C_UDP_EP1 (0x1 << 1) // (UDP) Reset Endpoint 1 +#define AT91C_UDP_EP2 (0x1 << 2) // (UDP) Reset Endpoint 2 +#define AT91C_UDP_EP3 (0x1 << 3) // (UDP) Reset Endpoint 3 +#define AT91C_UDP_EP4 (0x1 << 4) // (UDP) Reset Endpoint 4 +#define AT91C_UDP_EP5 (0x1 << 5) // (UDP) Reset Endpoint 5 +// -------- UDP_CSR : (UDP Offset: 0x30) USB Endpoint Control and Status Register -------- +#define AT91C_UDP_TXCOMP (0x1 << 0) // (UDP) Generates an IN packet with data previously written in the DPR +#define AT91C_UDP_RX_DATA_BK0 (0x1 << 1) // (UDP) Receive Data Bank 0 +#define AT91C_UDP_RXSETUP (0x1 << 2) // (UDP) Sends STALL to the Host (Control endpoints) +#define AT91C_UDP_ISOERROR (0x1 << 3) // (UDP) Isochronous error (Isochronous endpoints) +#define AT91C_UDP_TXPKTRDY (0x1 << 4) // (UDP) Transmit Packet Ready +#define AT91C_UDP_FORCESTALL (0x1 << 5) // (UDP) Force Stall (used by Control, Bulk and Isochronous endpoints). +#define AT91C_UDP_RX_DATA_BK1 (0x1 << 6) // (UDP) Receive Data Bank 1 (only used by endpoints with ping-pong attributes). +#define AT91C_UDP_DIR (0x1 << 7) // (UDP) Transfer Direction +#define AT91C_UDP_EPTYPE (0x7 << 8) // (UDP) Endpoint type +#define AT91C_UDP_EPTYPE_CTRL (0x0 << 8) // (UDP) Control +#define AT91C_UDP_EPTYPE_ISO_OUT (0x1 << 8) // (UDP) Isochronous OUT +#define AT91C_UDP_EPTYPE_BULK_OUT (0x2 << 8) // (UDP) Bulk OUT +#define AT91C_UDP_EPTYPE_INT_OUT (0x3 << 8) // (UDP) Interrupt OUT +#define AT91C_UDP_EPTYPE_ISO_IN (0x5 << 8) // (UDP) Isochronous IN +#define AT91C_UDP_EPTYPE_BULK_IN (0x6 << 8) // (UDP) Bulk IN +#define AT91C_UDP_EPTYPE_INT_IN (0x7 << 8) // (UDP) Interrupt IN +#define AT91C_UDP_DTGLE (0x1 << 11) // (UDP) Data Toggle +#define AT91C_UDP_EPEDS (0x1 << 15) // (UDP) Endpoint Enable Disable +#define AT91C_UDP_RXBYTECNT (0x7FF << 16) // (UDP) Number Of Bytes Available in the FIFO +// -------- UDP_TXVC : (UDP Offset: 0x74) Transceiver Control Register -------- +#define AT91C_UDP_TXVDIS (0x1 << 8) // (UDP) +#define AT91C_UDP_PUON (0x1 << 9) // (UDP) Pull-up ON + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Timer Counter Channel Interface +// ***************************************************************************** +// *** Register offset in AT91S_TC structure *** +#define TC_CCR ( 0) // Channel Control Register +#define TC_CMR ( 4) // Channel Mode Register (Capture Mode / Waveform Mode) +#define TC_CV (16) // Counter Value +#define TC_RA (20) // Register A +#define TC_RB (24) // Register B +#define TC_RC (28) // Register C +#define TC_SR (32) // Status Register +#define TC_IER (36) // Interrupt Enable Register +#define TC_IDR (40) // Interrupt Disable Register +#define TC_IMR (44) // Interrupt Mask Register +// -------- TC_CCR : (TC Offset: 0x0) TC Channel Control Register -------- +#define AT91C_TC_CLKEN (0x1 << 0) // (TC) Counter Clock Enable Command +#define AT91C_TC_CLKDIS (0x1 << 1) // (TC) Counter Clock Disable Command +#define AT91C_TC_SWTRG (0x1 << 2) // (TC) Software Trigger Command +// -------- TC_CMR : (TC Offset: 0x4) TC Channel Mode Register: Capture Mode / Waveform Mode -------- +#define AT91C_TC_CLKS (0x7 << 0) // (TC) Clock Selection +#define AT91C_TC_CLKS_TIMER_DIV1_CLOCK (0x0) // (TC) Clock selected: TIMER_DIV1_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV2_CLOCK (0x1) // (TC) Clock selected: TIMER_DIV2_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV3_CLOCK (0x2) // (TC) Clock selected: TIMER_DIV3_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV4_CLOCK (0x3) // (TC) Clock selected: TIMER_DIV4_CLOCK +#define AT91C_TC_CLKS_TIMER_DIV5_CLOCK (0x4) // (TC) Clock selected: TIMER_DIV5_CLOCK +#define AT91C_TC_CLKS_XC0 (0x5) // (TC) Clock selected: XC0 +#define AT91C_TC_CLKS_XC1 (0x6) // (TC) Clock selected: XC1 +#define AT91C_TC_CLKS_XC2 (0x7) // (TC) Clock selected: XC2 +#define AT91C_TC_CLKI (0x1 << 3) // (TC) Clock Invert +#define AT91C_TC_BURST (0x3 << 4) // (TC) Burst Signal Selection +#define AT91C_TC_BURST_NONE (0x0 << 4) // (TC) The clock is not gated by an external signal +#define AT91C_TC_BURST_XC0 (0x1 << 4) // (TC) XC0 is ANDed with the selected clock +#define AT91C_TC_BURST_XC1 (0x2 << 4) // (TC) XC1 is ANDed with the selected clock +#define AT91C_TC_BURST_XC2 (0x3 << 4) // (TC) XC2 is ANDed with the selected clock +#define AT91C_TC_CPCSTOP (0x1 << 6) // (TC) Counter Clock Stopped with RC Compare +#define AT91C_TC_LDBSTOP (0x1 << 6) // (TC) Counter Clock Stopped with RB Loading +#define AT91C_TC_LDBDIS (0x1 << 7) // (TC) Counter Clock Disabled with RB Loading +#define AT91C_TC_CPCDIS (0x1 << 7) // (TC) Counter Clock Disable with RC Compare +#define AT91C_TC_ETRGEDG (0x3 << 8) // (TC) External Trigger Edge Selection +#define AT91C_TC_ETRGEDG_NONE (0x0 << 8) // (TC) Edge: None +#define AT91C_TC_ETRGEDG_RISING (0x1 << 8) // (TC) Edge: rising edge +#define AT91C_TC_ETRGEDG_FALLING (0x2 << 8) // (TC) Edge: falling edge +#define AT91C_TC_ETRGEDG_BOTH (0x3 << 8) // (TC) Edge: each edge +#define AT91C_TC_EEVTEDG (0x3 << 8) // (TC) External Event Edge Selection +#define AT91C_TC_EEVTEDG_NONE (0x0 << 8) // (TC) Edge: None +#define AT91C_TC_EEVTEDG_RISING (0x1 << 8) // (TC) Edge: rising edge +#define AT91C_TC_EEVTEDG_FALLING (0x2 << 8) // (TC) Edge: falling edge +#define AT91C_TC_EEVTEDG_BOTH (0x3 << 8) // (TC) Edge: each edge +#define AT91C_TC_ABETRG (0x1 << 10) // (TC) TIOA or TIOB External Trigger Selection +#define AT91C_TC_EEVT (0x3 << 10) // (TC) External Event Selection +#define AT91C_TC_EEVT_TIOB (0x0 << 10) // (TC) Signal selected as external event: TIOB TIOB direction: input +#define AT91C_TC_EEVT_XC0 (0x1 << 10) // (TC) Signal selected as external event: XC0 TIOB direction: output +#define AT91C_TC_EEVT_XC1 (0x2 << 10) // (TC) Signal selected as external event: XC1 TIOB direction: output +#define AT91C_TC_EEVT_XC2 (0x3 << 10) // (TC) Signal selected as external event: XC2 TIOB direction: output +#define AT91C_TC_ENETRG (0x1 << 12) // (TC) External Event Trigger enable +#define AT91C_TC_WAVESEL (0x3 << 13) // (TC) Waveform Selection +#define AT91C_TC_WAVESEL_UP (0x0 << 13) // (TC) UP mode without atomatic trigger on RC Compare +#define AT91C_TC_WAVESEL_UPDOWN (0x1 << 13) // (TC) UPDOWN mode without automatic trigger on RC Compare +#define AT91C_TC_WAVESEL_UP_AUTO (0x2 << 13) // (TC) UP mode with automatic trigger on RC Compare +#define AT91C_TC_WAVESEL_UPDOWN_AUTO (0x3 << 13) // (TC) UPDOWN mode with automatic trigger on RC Compare +#define AT91C_TC_CPCTRG (0x1 << 14) // (TC) RC Compare Trigger Enable +#define AT91C_TC_WAVE (0x1 << 15) // (TC) +#define AT91C_TC_LDRA (0x3 << 16) // (TC) RA Loading Selection +#define AT91C_TC_LDRA_NONE (0x0 << 16) // (TC) Edge: None +#define AT91C_TC_LDRA_RISING (0x1 << 16) // (TC) Edge: rising edge of TIOA +#define AT91C_TC_LDRA_FALLING (0x2 << 16) // (TC) Edge: falling edge of TIOA +#define AT91C_TC_LDRA_BOTH (0x3 << 16) // (TC) Edge: each edge of TIOA +#define AT91C_TC_ACPA (0x3 << 16) // (TC) RA Compare Effect on TIOA +#define AT91C_TC_ACPA_NONE (0x0 << 16) // (TC) Effect: none +#define AT91C_TC_ACPA_SET (0x1 << 16) // (TC) Effect: set +#define AT91C_TC_ACPA_CLEAR (0x2 << 16) // (TC) Effect: clear +#define AT91C_TC_ACPA_TOGGLE (0x3 << 16) // (TC) Effect: toggle +#define AT91C_TC_LDRB (0x3 << 18) // (TC) RB Loading Selection +#define AT91C_TC_LDRB_NONE (0x0 << 18) // (TC) Edge: None +#define AT91C_TC_LDRB_RISING (0x1 << 18) // (TC) Edge: rising edge of TIOA +#define AT91C_TC_LDRB_FALLING (0x2 << 18) // (TC) Edge: falling edge of TIOA +#define AT91C_TC_LDRB_BOTH (0x3 << 18) // (TC) Edge: each edge of TIOA +#define AT91C_TC_ACPC (0x3 << 18) // (TC) RC Compare Effect on TIOA +#define AT91C_TC_ACPC_NONE (0x0 << 18) // (TC) Effect: none +#define AT91C_TC_ACPC_SET (0x1 << 18) // (TC) Effect: set +#define AT91C_TC_ACPC_CLEAR (0x2 << 18) // (TC) Effect: clear +#define AT91C_TC_ACPC_TOGGLE (0x3 << 18) // (TC) Effect: toggle +#define AT91C_TC_AEEVT (0x3 << 20) // (TC) External Event Effect on TIOA +#define AT91C_TC_AEEVT_NONE (0x0 << 20) // (TC) Effect: none +#define AT91C_TC_AEEVT_SET (0x1 << 20) // (TC) Effect: set +#define AT91C_TC_AEEVT_CLEAR (0x2 << 20) // (TC) Effect: clear +#define AT91C_TC_AEEVT_TOGGLE (0x3 << 20) // (TC) Effect: toggle +#define AT91C_TC_ASWTRG (0x3 << 22) // (TC) Software Trigger Effect on TIOA +#define AT91C_TC_ASWTRG_NONE (0x0 << 22) // (TC) Effect: none +#define AT91C_TC_ASWTRG_SET (0x1 << 22) // (TC) Effect: set +#define AT91C_TC_ASWTRG_CLEAR (0x2 << 22) // (TC) Effect: clear +#define AT91C_TC_ASWTRG_TOGGLE (0x3 << 22) // (TC) Effect: toggle +#define AT91C_TC_BCPB (0x3 << 24) // (TC) RB Compare Effect on TIOB +#define AT91C_TC_BCPB_NONE (0x0 << 24) // (TC) Effect: none +#define AT91C_TC_BCPB_SET (0x1 << 24) // (TC) Effect: set +#define AT91C_TC_BCPB_CLEAR (0x2 << 24) // (TC) Effect: clear +#define AT91C_TC_BCPB_TOGGLE (0x3 << 24) // (TC) Effect: toggle +#define AT91C_TC_BCPC (0x3 << 26) // (TC) RC Compare Effect on TIOB +#define AT91C_TC_BCPC_NONE (0x0 << 26) // (TC) Effect: none +#define AT91C_TC_BCPC_SET (0x1 << 26) // (TC) Effect: set +#define AT91C_TC_BCPC_CLEAR (0x2 << 26) // (TC) Effect: clear +#define AT91C_TC_BCPC_TOGGLE (0x3 << 26) // (TC) Effect: toggle +#define AT91C_TC_BEEVT (0x3 << 28) // (TC) External Event Effect on TIOB +#define AT91C_TC_BEEVT_NONE (0x0 << 28) // (TC) Effect: none +#define AT91C_TC_BEEVT_SET (0x1 << 28) // (TC) Effect: set +#define AT91C_TC_BEEVT_CLEAR (0x2 << 28) // (TC) Effect: clear +#define AT91C_TC_BEEVT_TOGGLE (0x3 << 28) // (TC) Effect: toggle +#define AT91C_TC_BSWTRG (0x3 << 30) // (TC) Software Trigger Effect on TIOB +#define AT91C_TC_BSWTRG_NONE (0x0 << 30) // (TC) Effect: none +#define AT91C_TC_BSWTRG_SET (0x1 << 30) // (TC) Effect: set +#define AT91C_TC_BSWTRG_CLEAR (0x2 << 30) // (TC) Effect: clear +#define AT91C_TC_BSWTRG_TOGGLE (0x3 << 30) // (TC) Effect: toggle +// -------- TC_SR : (TC Offset: 0x20) TC Channel Status Register -------- +#define AT91C_TC_COVFS (0x1 << 0) // (TC) Counter Overflow +#define AT91C_TC_LOVRS (0x1 << 1) // (TC) Load Overrun +#define AT91C_TC_CPAS (0x1 << 2) // (TC) RA Compare +#define AT91C_TC_CPBS (0x1 << 3) // (TC) RB Compare +#define AT91C_TC_CPCS (0x1 << 4) // (TC) RC Compare +#define AT91C_TC_LDRAS (0x1 << 5) // (TC) RA Loading +#define AT91C_TC_LDRBS (0x1 << 6) // (TC) RB Loading +#define AT91C_TC_ETRGS (0x1 << 7) // (TC) External Trigger +#define AT91C_TC_CLKSTA (0x1 << 16) // (TC) Clock Enabling +#define AT91C_TC_MTIOA (0x1 << 17) // (TC) TIOA Mirror +#define AT91C_TC_MTIOB (0x1 << 18) // (TC) TIOA Mirror +// -------- TC_IER : (TC Offset: 0x24) TC Channel Interrupt Enable Register -------- +// -------- TC_IDR : (TC Offset: 0x28) TC Channel Interrupt Disable Register -------- +// -------- TC_IMR : (TC Offset: 0x2c) TC Channel Interrupt Mask Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Timer Counter Interface +// ***************************************************************************** +// *** Register offset in AT91S_TCB structure *** +#define TCB_TC0 ( 0) // TC Channel 0 +#define TCB_TC1 (64) // TC Channel 1 +#define TCB_TC2 (128) // TC Channel 2 +#define TCB_BCR (192) // TC Block Control Register +#define TCB_BMR (196) // TC Block Mode Register +// -------- TCB_BCR : (TCB Offset: 0xc0) TC Block Control Register -------- +#define AT91C_TCB_SYNC (0x1 << 0) // (TCB) Synchro Command +// -------- TCB_BMR : (TCB Offset: 0xc4) TC Block Mode Register -------- +#define AT91C_TCB_TC0XC0S (0x3 << 0) // (TCB) External Clock Signal 0 Selection +#define AT91C_TCB_TC0XC0S_TCLK0 (0x0) // (TCB) TCLK0 connected to XC0 +#define AT91C_TCB_TC0XC0S_NONE (0x1) // (TCB) None signal connected to XC0 +#define AT91C_TCB_TC0XC0S_TIOA1 (0x2) // (TCB) TIOA1 connected to XC0 +#define AT91C_TCB_TC0XC0S_TIOA2 (0x3) // (TCB) TIOA2 connected to XC0 +#define AT91C_TCB_TC1XC1S (0x3 << 2) // (TCB) External Clock Signal 1 Selection +#define AT91C_TCB_TC1XC1S_TCLK1 (0x0 << 2) // (TCB) TCLK1 connected to XC1 +#define AT91C_TCB_TC1XC1S_NONE (0x1 << 2) // (TCB) None signal connected to XC1 +#define AT91C_TCB_TC1XC1S_TIOA0 (0x2 << 2) // (TCB) TIOA0 connected to XC1 +#define AT91C_TCB_TC1XC1S_TIOA2 (0x3 << 2) // (TCB) TIOA2 connected to XC1 +#define AT91C_TCB_TC2XC2S (0x3 << 4) // (TCB) External Clock Signal 2 Selection +#define AT91C_TCB_TC2XC2S_TCLK2 (0x0 << 4) // (TCB) TCLK2 connected to XC2 +#define AT91C_TCB_TC2XC2S_NONE (0x1 << 4) // (TCB) None signal connected to XC2 +#define AT91C_TCB_TC2XC2S_TIOA0 (0x2 << 4) // (TCB) TIOA0 connected to XC2 +#define AT91C_TCB_TC2XC2S_TIOA1 (0x3 << 4) // (TCB) TIOA2 connected to XC2 + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Control Area Network MailBox Interface +// ***************************************************************************** +// *** Register offset in AT91S_CAN_MB structure *** +#define CAN_MB_MMR ( 0) // MailBox Mode Register +#define CAN_MB_MAM ( 4) // MailBox Acceptance Mask Register +#define CAN_MB_MID ( 8) // MailBox ID Register +#define CAN_MB_MFID (12) // MailBox Family ID Register +#define CAN_MB_MSR (16) // MailBox Status Register +#define CAN_MB_MDL (20) // MailBox Data Low Register +#define CAN_MB_MDH (24) // MailBox Data High Register +#define CAN_MB_MCR (28) // MailBox Control Register +// -------- CAN_MMR : (CAN_MB Offset: 0x0) CAN Message Mode Register -------- +#define AT91C_CAN_MTIMEMARK (0xFFFF << 0) // (CAN_MB) Mailbox Timemark +#define AT91C_CAN_PRIOR (0xF << 16) // (CAN_MB) Mailbox Priority +#define AT91C_CAN_MOT (0x7 << 24) // (CAN_MB) Mailbox Object Type +#define AT91C_CAN_MOT_DIS (0x0 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_RX (0x1 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_RXOVERWRITE (0x2 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_TX (0x3 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_CONSUMER (0x4 << 24) // (CAN_MB) +#define AT91C_CAN_MOT_PRODUCER (0x5 << 24) // (CAN_MB) +// -------- CAN_MAM : (CAN_MB Offset: 0x4) CAN Message Acceptance Mask Register -------- +#define AT91C_CAN_MIDvB (0x3FFFF << 0) // (CAN_MB) Complementary bits for identifier in extended mode +#define AT91C_CAN_MIDvA (0x7FF << 18) // (CAN_MB) Identifier for standard frame mode +#define AT91C_CAN_MIDE (0x1 << 29) // (CAN_MB) Identifier Version +// -------- CAN_MID : (CAN_MB Offset: 0x8) CAN Message ID Register -------- +// -------- CAN_MFID : (CAN_MB Offset: 0xc) CAN Message Family ID Register -------- +// -------- CAN_MSR : (CAN_MB Offset: 0x10) CAN Message Status Register -------- +#define AT91C_CAN_MTIMESTAMP (0xFFFF << 0) // (CAN_MB) Timer Value +#define AT91C_CAN_MDLC (0xF << 16) // (CAN_MB) Mailbox Data Length Code +#define AT91C_CAN_MRTR (0x1 << 20) // (CAN_MB) Mailbox Remote Transmission Request +#define AT91C_CAN_MABT (0x1 << 22) // (CAN_MB) Mailbox Message Abort +#define AT91C_CAN_MRDY (0x1 << 23) // (CAN_MB) Mailbox Ready +#define AT91C_CAN_MMI (0x1 << 24) // (CAN_MB) Mailbox Message Ignored +// -------- CAN_MDL : (CAN_MB Offset: 0x14) CAN Message Data Low Register -------- +// -------- CAN_MDH : (CAN_MB Offset: 0x18) CAN Message Data High Register -------- +// -------- CAN_MCR : (CAN_MB Offset: 0x1c) CAN Message Control Register -------- +#define AT91C_CAN_MACR (0x1 << 22) // (CAN_MB) Abort Request for Mailbox +#define AT91C_CAN_MTCR (0x1 << 23) // (CAN_MB) Mailbox Transfer Command + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Control Area Network Interface +// ***************************************************************************** +// *** Register offset in AT91S_CAN structure *** +#define CAN_MR ( 0) // Mode Register +#define CAN_IER ( 4) // Interrupt Enable Register +#define CAN_IDR ( 8) // Interrupt Disable Register +#define CAN_IMR (12) // Interrupt Mask Register +#define CAN_SR (16) // Status Register +#define CAN_BR (20) // Baudrate Register +#define CAN_TIM (24) // Timer Register +#define CAN_TIMESTP (28) // Time Stamp Register +#define CAN_ECR (32) // Error Counter Register +#define CAN_TCR (36) // Transfer Command Register +#define CAN_ACR (40) // Abort Command Register +#define CAN_VR (252) // Version Register +#define CAN_MB0 (512) // CAN Mailbox 0 +#define CAN_MB1 (544) // CAN Mailbox 1 +#define CAN_MB2 (576) // CAN Mailbox 2 +#define CAN_MB3 (608) // CAN Mailbox 3 +#define CAN_MB4 (640) // CAN Mailbox 4 +#define CAN_MB5 (672) // CAN Mailbox 5 +#define CAN_MB6 (704) // CAN Mailbox 6 +#define CAN_MB7 (736) // CAN Mailbox 7 +#define CAN_MB8 (768) // CAN Mailbox 8 +#define CAN_MB9 (800) // CAN Mailbox 9 +#define CAN_MB10 (832) // CAN Mailbox 10 +#define CAN_MB11 (864) // CAN Mailbox 11 +#define CAN_MB12 (896) // CAN Mailbox 12 +#define CAN_MB13 (928) // CAN Mailbox 13 +#define CAN_MB14 (960) // CAN Mailbox 14 +#define CAN_MB15 (992) // CAN Mailbox 15 +// -------- CAN_MR : (CAN Offset: 0x0) CAN Mode Register -------- +#define AT91C_CAN_CANEN (0x1 << 0) // (CAN) CAN Controller Enable +#define AT91C_CAN_LPM (0x1 << 1) // (CAN) Disable/Enable Low Power Mode +#define AT91C_CAN_ABM (0x1 << 2) // (CAN) Disable/Enable Autobaud/Listen Mode +#define AT91C_CAN_OVL (0x1 << 3) // (CAN) Disable/Enable Overload Frame +#define AT91C_CAN_TEOF (0x1 << 4) // (CAN) Time Stamp messages at each end of Frame +#define AT91C_CAN_TTM (0x1 << 5) // (CAN) Disable/Enable Time Trigger Mode +#define AT91C_CAN_TIMFRZ (0x1 << 6) // (CAN) Enable Timer Freeze +#define AT91C_CAN_DRPT (0x1 << 7) // (CAN) Disable Repeat +// -------- CAN_IER : (CAN Offset: 0x4) CAN Interrupt Enable Register -------- +#define AT91C_CAN_MB0 (0x1 << 0) // (CAN) Mailbox 0 Flag +#define AT91C_CAN_MB1 (0x1 << 1) // (CAN) Mailbox 1 Flag +#define AT91C_CAN_MB2 (0x1 << 2) // (CAN) Mailbox 2 Flag +#define AT91C_CAN_MB3 (0x1 << 3) // (CAN) Mailbox 3 Flag +#define AT91C_CAN_MB4 (0x1 << 4) // (CAN) Mailbox 4 Flag +#define AT91C_CAN_MB5 (0x1 << 5) // (CAN) Mailbox 5 Flag +#define AT91C_CAN_MB6 (0x1 << 6) // (CAN) Mailbox 6 Flag +#define AT91C_CAN_MB7 (0x1 << 7) // (CAN) Mailbox 7 Flag +#define AT91C_CAN_MB8 (0x1 << 8) // (CAN) Mailbox 8 Flag +#define AT91C_CAN_MB9 (0x1 << 9) // (CAN) Mailbox 9 Flag +#define AT91C_CAN_MB10 (0x1 << 10) // (CAN) Mailbox 10 Flag +#define AT91C_CAN_MB11 (0x1 << 11) // (CAN) Mailbox 11 Flag +#define AT91C_CAN_MB12 (0x1 << 12) // (CAN) Mailbox 12 Flag +#define AT91C_CAN_MB13 (0x1 << 13) // (CAN) Mailbox 13 Flag +#define AT91C_CAN_MB14 (0x1 << 14) // (CAN) Mailbox 14 Flag +#define AT91C_CAN_MB15 (0x1 << 15) // (CAN) Mailbox 15 Flag +#define AT91C_CAN_ERRA (0x1 << 16) // (CAN) Error Active Mode Flag +#define AT91C_CAN_WARN (0x1 << 17) // (CAN) Warning Limit Flag +#define AT91C_CAN_ERRP (0x1 << 18) // (CAN) Error Passive Mode Flag +#define AT91C_CAN_BOFF (0x1 << 19) // (CAN) Bus Off Mode Flag +#define AT91C_CAN_SLEEP (0x1 << 20) // (CAN) Sleep Flag +#define AT91C_CAN_WAKEUP (0x1 << 21) // (CAN) Wakeup Flag +#define AT91C_CAN_TOVF (0x1 << 22) // (CAN) Timer Overflow Flag +#define AT91C_CAN_TSTP (0x1 << 23) // (CAN) Timestamp Flag +#define AT91C_CAN_CERR (0x1 << 24) // (CAN) CRC Error +#define AT91C_CAN_SERR (0x1 << 25) // (CAN) Stuffing Error +#define AT91C_CAN_AERR (0x1 << 26) // (CAN) Acknowledgment Error +#define AT91C_CAN_FERR (0x1 << 27) // (CAN) Form Error +#define AT91C_CAN_BERR (0x1 << 28) // (CAN) Bit Error +// -------- CAN_IDR : (CAN Offset: 0x8) CAN Interrupt Disable Register -------- +// -------- CAN_IMR : (CAN Offset: 0xc) CAN Interrupt Mask Register -------- +// -------- CAN_SR : (CAN Offset: 0x10) CAN Status Register -------- +#define AT91C_CAN_RBSY (0x1 << 29) // (CAN) Receiver Busy +#define AT91C_CAN_TBSY (0x1 << 30) // (CAN) Transmitter Busy +#define AT91C_CAN_OVLY (0x1 << 31) // (CAN) Overload Busy +// -------- CAN_BR : (CAN Offset: 0x14) CAN Baudrate Register -------- +#define AT91C_CAN_PHASE2 (0x7 << 0) // (CAN) Phase 2 segment +#define AT91C_CAN_PHASE1 (0x7 << 4) // (CAN) Phase 1 segment +#define AT91C_CAN_PROPAG (0x7 << 8) // (CAN) Programmation time segment +#define AT91C_CAN_SYNC (0x3 << 12) // (CAN) Re-synchronization jump width segment +#define AT91C_CAN_BRP (0x7F << 16) // (CAN) Baudrate Prescaler +#define AT91C_CAN_SMP (0x1 << 24) // (CAN) Sampling mode +// -------- CAN_TIM : (CAN Offset: 0x18) CAN Timer Register -------- +#define AT91C_CAN_TIMER (0xFFFF << 0) // (CAN) Timer field +// -------- CAN_TIMESTP : (CAN Offset: 0x1c) CAN Timestamp Register -------- +// -------- CAN_ECR : (CAN Offset: 0x20) CAN Error Counter Register -------- +#define AT91C_CAN_REC (0xFF << 0) // (CAN) Receive Error Counter +#define AT91C_CAN_TEC (0xFF << 16) // (CAN) Transmit Error Counter +// -------- CAN_TCR : (CAN Offset: 0x24) CAN Transfer Command Register -------- +#define AT91C_CAN_TIMRST (0x1 << 31) // (CAN) Timer Reset Field +// -------- CAN_ACR : (CAN Offset: 0x28) CAN Abort Command Register -------- + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Ethernet MAC 10/100 +// ***************************************************************************** +// *** Register offset in AT91S_EMAC structure *** +#define EMAC_NCR ( 0) // Network Control Register +#define EMAC_NCFGR ( 4) // Network Configuration Register +#define EMAC_NSR ( 8) // Network Status Register +#define EMAC_TSR (20) // Transmit Status Register +#define EMAC_RBQP (24) // Receive Buffer Queue Pointer +#define EMAC_TBQP (28) // Transmit Buffer Queue Pointer +#define EMAC_RSR (32) // Receive Status Register +#define EMAC_ISR (36) // Interrupt Status Register +#define EMAC_IER (40) // Interrupt Enable Register +#define EMAC_IDR (44) // Interrupt Disable Register +#define EMAC_IMR (48) // Interrupt Mask Register +#define EMAC_MAN (52) // PHY Maintenance Register +#define EMAC_PTR (56) // Pause Time Register +#define EMAC_PFR (60) // Pause Frames received Register +#define EMAC_FTO (64) // Frames Transmitted OK Register +#define EMAC_SCF (68) // Single Collision Frame Register +#define EMAC_MCF (72) // Multiple Collision Frame Register +#define EMAC_FRO (76) // Frames Received OK Register +#define EMAC_FCSE (80) // Frame Check Sequence Error Register +#define EMAC_ALE (84) // Alignment Error Register +#define EMAC_DTF (88) // Deferred Transmission Frame Register +#define EMAC_LCOL (92) // Late Collision Register +#define EMAC_ECOL (96) // Excessive Collision Register +#define EMAC_TUND (100) // Transmit Underrun Error Register +#define EMAC_CSE (104) // Carrier Sense Error Register +#define EMAC_RRE (108) // Receive Ressource Error Register +#define EMAC_ROV (112) // Receive Overrun Errors Register +#define EMAC_RSE (116) // Receive Symbol Errors Register +#define EMAC_ELE (120) // Excessive Length Errors Register +#define EMAC_RJA (124) // Receive Jabbers Register +#define EMAC_USF (128) // Undersize Frames Register +#define EMAC_STE (132) // SQE Test Error Register +#define EMAC_RLE (136) // Receive Length Field Mismatch Register +#define EMAC_TPF (140) // Transmitted Pause Frames Register +#define EMAC_HRB (144) // Hash Address Bottom[31:0] +#define EMAC_HRT (148) // Hash Address Top[63:32] +#define EMAC_SA1L (152) // Specific Address 1 Bottom, First 4 bytes +#define EMAC_SA1H (156) // Specific Address 1 Top, Last 2 bytes +#define EMAC_SA2L (160) // Specific Address 2 Bottom, First 4 bytes +#define EMAC_SA2H (164) // Specific Address 2 Top, Last 2 bytes +#define EMAC_SA3L (168) // Specific Address 3 Bottom, First 4 bytes +#define EMAC_SA3H (172) // Specific Address 3 Top, Last 2 bytes +#define EMAC_SA4L (176) // Specific Address 4 Bottom, First 4 bytes +#define EMAC_SA4H (180) // Specific Address 4 Top, Last 2 bytes +#define EMAC_TID (184) // Type ID Checking Register +#define EMAC_TPQ (188) // Transmit Pause Quantum Register +#define EMAC_USRIO (192) // USER Input/Output Register +#define EMAC_WOL (196) // Wake On LAN Register +#define EMAC_REV (252) // Revision Register +// -------- EMAC_NCR : (EMAC Offset: 0x0) -------- +#define AT91C_EMAC_LB (0x1 << 0) // (EMAC) Loopback. Optional. When set, loopback signal is at high level. +#define AT91C_EMAC_LLB (0x1 << 1) // (EMAC) Loopback local. +#define AT91C_EMAC_RE (0x1 << 2) // (EMAC) Receive enable. +#define AT91C_EMAC_TE (0x1 << 3) // (EMAC) Transmit enable. +#define AT91C_EMAC_MPE (0x1 << 4) // (EMAC) Management port enable. +#define AT91C_EMAC_CLRSTAT (0x1 << 5) // (EMAC) Clear statistics registers. +#define AT91C_EMAC_INCSTAT (0x1 << 6) // (EMAC) Increment statistics registers. +#define AT91C_EMAC_WESTAT (0x1 << 7) // (EMAC) Write enable for statistics registers. +#define AT91C_EMAC_BP (0x1 << 8) // (EMAC) Back pressure. +#define AT91C_EMAC_TSTART (0x1 << 9) // (EMAC) Start Transmission. +#define AT91C_EMAC_THALT (0x1 << 10) // (EMAC) Transmission Halt. +#define AT91C_EMAC_TPFR (0x1 << 11) // (EMAC) Transmit pause frame +#define AT91C_EMAC_TZQ (0x1 << 12) // (EMAC) Transmit zero quantum pause frame +// -------- EMAC_NCFGR : (EMAC Offset: 0x4) Network Configuration Register -------- +#define AT91C_EMAC_SPD (0x1 << 0) // (EMAC) Speed. +#define AT91C_EMAC_FD (0x1 << 1) // (EMAC) Full duplex. +#define AT91C_EMAC_JFRAME (0x1 << 3) // (EMAC) Jumbo Frames. +#define AT91C_EMAC_CAF (0x1 << 4) // (EMAC) Copy all frames. +#define AT91C_EMAC_NBC (0x1 << 5) // (EMAC) No broadcast. +#define AT91C_EMAC_MTI (0x1 << 6) // (EMAC) Multicast hash event enable +#define AT91C_EMAC_UNI (0x1 << 7) // (EMAC) Unicast hash enable. +#define AT91C_EMAC_BIG (0x1 << 8) // (EMAC) Receive 1522 bytes. +#define AT91C_EMAC_EAE (0x1 << 9) // (EMAC) External address match enable. +#define AT91C_EMAC_CLK (0x3 << 10) // (EMAC) +#define AT91C_EMAC_CLK_HCLK_8 (0x0 << 10) // (EMAC) HCLK divided by 8 +#define AT91C_EMAC_CLK_HCLK_16 (0x1 << 10) // (EMAC) HCLK divided by 16 +#define AT91C_EMAC_CLK_HCLK_32 (0x2 << 10) // (EMAC) HCLK divided by 32 +#define AT91C_EMAC_CLK_HCLK_64 (0x3 << 10) // (EMAC) HCLK divided by 64 +#define AT91C_EMAC_RTY (0x1 << 12) // (EMAC) +#define AT91C_EMAC_PAE (0x1 << 13) // (EMAC) +#define AT91C_EMAC_RBOF (0x3 << 14) // (EMAC) +#define AT91C_EMAC_RBOF_OFFSET_0 (0x0 << 14) // (EMAC) no offset from start of receive buffer +#define AT91C_EMAC_RBOF_OFFSET_1 (0x1 << 14) // (EMAC) one byte offset from start of receive buffer +#define AT91C_EMAC_RBOF_OFFSET_2 (0x2 << 14) // (EMAC) two bytes offset from start of receive buffer +#define AT91C_EMAC_RBOF_OFFSET_3 (0x3 << 14) // (EMAC) three bytes offset from start of receive buffer +#define AT91C_EMAC_RLCE (0x1 << 16) // (EMAC) Receive Length field Checking Enable +#define AT91C_EMAC_DRFCS (0x1 << 17) // (EMAC) Discard Receive FCS +#define AT91C_EMAC_EFRHD (0x1 << 18) // (EMAC) +#define AT91C_EMAC_IRXFCS (0x1 << 19) // (EMAC) Ignore RX FCS +// -------- EMAC_NSR : (EMAC Offset: 0x8) Network Status Register -------- +#define AT91C_EMAC_LINKR (0x1 << 0) // (EMAC) +#define AT91C_EMAC_MDIO (0x1 << 1) // (EMAC) +#define AT91C_EMAC_IDLE (0x1 << 2) // (EMAC) +// -------- EMAC_TSR : (EMAC Offset: 0x14) Transmit Status Register -------- +#define AT91C_EMAC_UBR (0x1 << 0) // (EMAC) +#define AT91C_EMAC_COL (0x1 << 1) // (EMAC) +#define AT91C_EMAC_RLES (0x1 << 2) // (EMAC) +#define AT91C_EMAC_TGO (0x1 << 3) // (EMAC) Transmit Go +#define AT91C_EMAC_BEX (0x1 << 4) // (EMAC) Buffers exhausted mid frame +#define AT91C_EMAC_COMP (0x1 << 5) // (EMAC) +#define AT91C_EMAC_UND (0x1 << 6) // (EMAC) +// -------- EMAC_RSR : (EMAC Offset: 0x20) Receive Status Register -------- +#define AT91C_EMAC_BNA (0x1 << 0) // (EMAC) +#define AT91C_EMAC_REC (0x1 << 1) // (EMAC) +#define AT91C_EMAC_OVR (0x1 << 2) // (EMAC) +// -------- EMAC_ISR : (EMAC Offset: 0x24) Interrupt Status Register -------- +#define AT91C_EMAC_MFD (0x1 << 0) // (EMAC) +#define AT91C_EMAC_RCOMP (0x1 << 1) // (EMAC) +#define AT91C_EMAC_RXUBR (0x1 << 2) // (EMAC) +#define AT91C_EMAC_TXUBR (0x1 << 3) // (EMAC) +#define AT91C_EMAC_TUNDR (0x1 << 4) // (EMAC) +#define AT91C_EMAC_RLEX (0x1 << 5) // (EMAC) +#define AT91C_EMAC_TXERR (0x1 << 6) // (EMAC) +#define AT91C_EMAC_TCOMP (0x1 << 7) // (EMAC) +#define AT91C_EMAC_LINK (0x1 << 9) // (EMAC) +#define AT91C_EMAC_ROVR (0x1 << 10) // (EMAC) +#define AT91C_EMAC_HRESP (0x1 << 11) // (EMAC) +#define AT91C_EMAC_PFRE (0x1 << 12) // (EMAC) +#define AT91C_EMAC_PTZ (0x1 << 13) // (EMAC) +// -------- EMAC_IER : (EMAC Offset: 0x28) Interrupt Enable Register -------- +// -------- EMAC_IDR : (EMAC Offset: 0x2c) Interrupt Disable Register -------- +// -------- EMAC_IMR : (EMAC Offset: 0x30) Interrupt Mask Register -------- +// -------- EMAC_MAN : (EMAC Offset: 0x34) PHY Maintenance Register -------- +#define AT91C_EMAC_DATA (0xFFFF << 0) // (EMAC) +#define AT91C_EMAC_CODE (0x3 << 16) // (EMAC) +#define AT91C_EMAC_REGA (0x1F << 18) // (EMAC) +#define AT91C_EMAC_PHYA (0x1F << 23) // (EMAC) +#define AT91C_EMAC_RW (0x3 << 28) // (EMAC) +#define AT91C_EMAC_SOF (0x3 << 30) // (EMAC) +// -------- EMAC_USRIO : (EMAC Offset: 0xc0) USER Input Output Register -------- +#define AT91C_EMAC_RMII (0x1 << 0) // (EMAC) Reduce MII +#define AT91C_EMAC_CLKEN (0x1 << 1) // (EMAC) Clock Enable +// -------- EMAC_WOL : (EMAC Offset: 0xc4) Wake On LAN Register -------- +#define AT91C_EMAC_IP (0xFFFF << 0) // (EMAC) ARP request IP address +#define AT91C_EMAC_MAG (0x1 << 16) // (EMAC) Magic packet event enable +#define AT91C_EMAC_ARP (0x1 << 17) // (EMAC) ARP request event enable +#define AT91C_EMAC_SA1 (0x1 << 18) // (EMAC) Specific address register 1 event enable +// -------- EMAC_REV : (EMAC Offset: 0xfc) Revision Register -------- +#define AT91C_EMAC_REVREF (0xFFFF << 0) // (EMAC) +#define AT91C_EMAC_PARTREF (0xFFFF << 16) // (EMAC) + +// ***************************************************************************** +// SOFTWARE API DEFINITION FOR Analog to Digital Convertor +// ***************************************************************************** +// *** Register offset in AT91S_ADC structure *** +#define ADC_CR ( 0) // ADC Control Register +#define ADC_MR ( 4) // ADC Mode Register +#define ADC_CHER (16) // ADC Channel Enable Register +#define ADC_CHDR (20) // ADC Channel Disable Register +#define ADC_CHSR (24) // ADC Channel Status Register +#define ADC_SR (28) // ADC Status Register +#define ADC_LCDR (32) // ADC Last Converted Data Register +#define ADC_IER (36) // ADC Interrupt Enable Register +#define ADC_IDR (40) // ADC Interrupt Disable Register +#define ADC_IMR (44) // ADC Interrupt Mask Register +#define ADC_CDR0 (48) // ADC Channel Data Register 0 +#define ADC_CDR1 (52) // ADC Channel Data Register 1 +#define ADC_CDR2 (56) // ADC Channel Data Register 2 +#define ADC_CDR3 (60) // ADC Channel Data Register 3 +#define ADC_CDR4 (64) // ADC Channel Data Register 4 +#define ADC_CDR5 (68) // ADC Channel Data Register 5 +#define ADC_CDR6 (72) // ADC Channel Data Register 6 +#define ADC_CDR7 (76) // ADC Channel Data Register 7 +#define ADC_RPR (256) // Receive Pointer Register +#define ADC_RCR (260) // Receive Counter Register +#define ADC_TPR (264) // Transmit Pointer Register +#define ADC_TCR (268) // Transmit Counter Register +#define ADC_RNPR (272) // Receive Next Pointer Register +#define ADC_RNCR (276) // Receive Next Counter Register +#define ADC_TNPR (280) // Transmit Next Pointer Register +#define ADC_TNCR (284) // Transmit Next Counter Register +#define ADC_PTCR (288) // PDC Transfer Control Register +#define ADC_PTSR (292) // PDC Transfer Status Register +// -------- ADC_CR : (ADC Offset: 0x0) ADC Control Register -------- +#define AT91C_ADC_SWRST (0x1 << 0) // (ADC) Software Reset +#define AT91C_ADC_START (0x1 << 1) // (ADC) Start Conversion +// -------- ADC_MR : (ADC Offset: 0x4) ADC Mode Register -------- +#define AT91C_ADC_TRGEN (0x1 << 0) // (ADC) Trigger Enable +#define AT91C_ADC_TRGEN_DIS (0x0) // (ADC) Hradware triggers are disabled. Starting a conversion is only possible by software +#define AT91C_ADC_TRGEN_EN (0x1) // (ADC) Hardware trigger selected by TRGSEL field is enabled. +#define AT91C_ADC_TRGSEL (0x7 << 1) // (ADC) Trigger Selection +#define AT91C_ADC_TRGSEL_TIOA0 (0x0 << 1) // (ADC) Selected TRGSEL = TIAO0 +#define AT91C_ADC_TRGSEL_TIOA1 (0x1 << 1) // (ADC) Selected TRGSEL = TIAO1 +#define AT91C_ADC_TRGSEL_TIOA2 (0x2 << 1) // (ADC) Selected TRGSEL = TIAO2 +#define AT91C_ADC_TRGSEL_TIOA3 (0x3 << 1) // (ADC) Selected TRGSEL = TIAO3 +#define AT91C_ADC_TRGSEL_TIOA4 (0x4 << 1) // (ADC) Selected TRGSEL = TIAO4 +#define AT91C_ADC_TRGSEL_TIOA5 (0x5 << 1) // (ADC) Selected TRGSEL = TIAO5 +#define AT91C_ADC_TRGSEL_EXT (0x6 << 1) // (ADC) Selected TRGSEL = External Trigger +#define AT91C_ADC_LOWRES (0x1 << 4) // (ADC) Resolution. +#define AT91C_ADC_LOWRES_10_BIT (0x0 << 4) // (ADC) 10-bit resolution +#define AT91C_ADC_LOWRES_8_BIT (0x1 << 4) // (ADC) 8-bit resolution +#define AT91C_ADC_SLEEP (0x1 << 5) // (ADC) Sleep Mode +#define AT91C_ADC_SLEEP_NORMAL_MODE (0x0 << 5) // (ADC) Normal Mode +#define AT91C_ADC_SLEEP_MODE (0x1 << 5) // (ADC) Sleep Mode +#define AT91C_ADC_PRESCAL (0x3F << 8) // (ADC) Prescaler rate selection +#define AT91C_ADC_STARTUP (0x1F << 16) // (ADC) Startup Time +#define AT91C_ADC_SHTIM (0xF << 24) // (ADC) Sample & Hold Time +// -------- ADC_CHER : (ADC Offset: 0x10) ADC Channel Enable Register -------- +#define AT91C_ADC_CH0 (0x1 << 0) // (ADC) Channel 0 +#define AT91C_ADC_CH1 (0x1 << 1) // (ADC) Channel 1 +#define AT91C_ADC_CH2 (0x1 << 2) // (ADC) Channel 2 +#define AT91C_ADC_CH3 (0x1 << 3) // (ADC) Channel 3 +#define AT91C_ADC_CH4 (0x1 << 4) // (ADC) Channel 4 +#define AT91C_ADC_CH5 (0x1 << 5) // (ADC) Channel 5 +#define AT91C_ADC_CH6 (0x1 << 6) // (ADC) Channel 6 +#define AT91C_ADC_CH7 (0x1 << 7) // (ADC) Channel 7 +// -------- ADC_CHDR : (ADC Offset: 0x14) ADC Channel Disable Register -------- +// -------- ADC_CHSR : (ADC Offset: 0x18) ADC Channel Status Register -------- +// -------- ADC_SR : (ADC Offset: 0x1c) ADC Status Register -------- +#define AT91C_ADC_EOC0 (0x1 << 0) // (ADC) End of Conversion +#define AT91C_ADC_EOC1 (0x1 << 1) // (ADC) End of Conversion +#define AT91C_ADC_EOC2 (0x1 << 2) // (ADC) End of Conversion +#define AT91C_ADC_EOC3 (0x1 << 3) // (ADC) End of Conversion +#define AT91C_ADC_EOC4 (0x1 << 4) // (ADC) End of Conversion +#define AT91C_ADC_EOC5 (0x1 << 5) // (ADC) End of Conversion +#define AT91C_ADC_EOC6 (0x1 << 6) // (ADC) End of Conversion +#define AT91C_ADC_EOC7 (0x1 << 7) // (ADC) End of Conversion +#define AT91C_ADC_OVRE0 (0x1 << 8) // (ADC) Overrun Error +#define AT91C_ADC_OVRE1 (0x1 << 9) // (ADC) Overrun Error +#define AT91C_ADC_OVRE2 (0x1 << 10) // (ADC) Overrun Error +#define AT91C_ADC_OVRE3 (0x1 << 11) // (ADC) Overrun Error +#define AT91C_ADC_OVRE4 (0x1 << 12) // (ADC) Overrun Error +#define AT91C_ADC_OVRE5 (0x1 << 13) // (ADC) Overrun Error +#define AT91C_ADC_OVRE6 (0x1 << 14) // (ADC) Overrun Error +#define AT91C_ADC_OVRE7 (0x1 << 15) // (ADC) Overrun Error +#define AT91C_ADC_DRDY (0x1 << 16) // (ADC) Data Ready +#define AT91C_ADC_GOVRE (0x1 << 17) // (ADC) General Overrun +#define AT91C_ADC_ENDRX (0x1 << 18) // (ADC) End of Receiver Transfer +#define AT91C_ADC_RXBUFF (0x1 << 19) // (ADC) RXBUFF Interrupt +// -------- ADC_LCDR : (ADC Offset: 0x20) ADC Last Converted Data Register -------- +#define AT91C_ADC_LDATA (0x3FF << 0) // (ADC) Last Data Converted +// -------- ADC_IER : (ADC Offset: 0x24) ADC Interrupt Enable Register -------- +// -------- ADC_IDR : (ADC Offset: 0x28) ADC Interrupt Disable Register -------- +// -------- ADC_IMR : (ADC Offset: 0x2c) ADC Interrupt Mask Register -------- +// -------- ADC_CDR0 : (ADC Offset: 0x30) ADC Channel Data Register 0 -------- +#define AT91C_ADC_DATA (0x3FF << 0) // (ADC) Converted Data +// -------- ADC_CDR1 : (ADC Offset: 0x34) ADC Channel Data Register 1 -------- +// -------- ADC_CDR2 : (ADC Offset: 0x38) ADC Channel Data Register 2 -------- +// -------- ADC_CDR3 : (ADC Offset: 0x3c) ADC Channel Data Register 3 -------- +// -------- ADC_CDR4 : (ADC Offset: 0x40) ADC Channel Data Register 4 -------- +// -------- ADC_CDR5 : (ADC Offset: 0x44) ADC Channel Data Register 5 -------- +// -------- ADC_CDR6 : (ADC Offset: 0x48) ADC Channel Data Register 6 -------- +// -------- ADC_CDR7 : (ADC Offset: 0x4c) ADC Channel Data Register 7 -------- + +// ***************************************************************************** +// REGISTER ADDRESS DEFINITION FOR AT91SAM7X256 +// ***************************************************************************** +// ========== Register definition for SYS peripheral ========== +// ========== Register definition for AIC peripheral ========== +#define AT91C_AIC_ICCR (0xFFFFF128) // (AIC) Interrupt Clear Command Register +#define AT91C_AIC_IECR (0xFFFFF120) // (AIC) Interrupt Enable Command Register +#define AT91C_AIC_SMR (0xFFFFF000) // (AIC) Source Mode Register +#define AT91C_AIC_ISCR (0xFFFFF12C) // (AIC) Interrupt Set Command Register +#define AT91C_AIC_EOICR (0xFFFFF130) // (AIC) End of Interrupt Command Register +#define AT91C_AIC_DCR (0xFFFFF138) // (AIC) Debug Control Register (Protect) +#define AT91C_AIC_FFER (0xFFFFF140) // (AIC) Fast Forcing Enable Register +#define AT91C_AIC_SVR (0xFFFFF080) // (AIC) Source Vector Register +#define AT91C_AIC_SPU (0xFFFFF134) // (AIC) Spurious Vector Register +#define AT91C_AIC_FFDR (0xFFFFF144) // (AIC) Fast Forcing Disable Register +#define AT91C_AIC_FVR (0xFFFFF104) // (AIC) FIQ Vector Register +#define AT91C_AIC_FFSR (0xFFFFF148) // (AIC) Fast Forcing Status Register +#define AT91C_AIC_IMR (0xFFFFF110) // (AIC) Interrupt Mask Register +#define AT91C_AIC_ISR (0xFFFFF108) // (AIC) Interrupt Status Register +#define AT91C_AIC_IVR (0xFFFFF100) // (AIC) IRQ Vector Register +#define AT91C_AIC_IDCR (0xFFFFF124) // (AIC) Interrupt Disable Command Register +#define AT91C_AIC_CISR (0xFFFFF114) // (AIC) Core Interrupt Status Register +#define AT91C_AIC_IPR (0xFFFFF10C) // (AIC) Interrupt Pending Register +// ========== Register definition for PDC_DBGU peripheral ========== +#define AT91C_DBGU_TNCR (0xFFFFF31C) // (PDC_DBGU) Transmit Next Counter Register +#define AT91C_DBGU_RNCR (0xFFFFF314) // (PDC_DBGU) Receive Next Counter Register +#define AT91C_DBGU_PTCR (0xFFFFF320) // (PDC_DBGU) PDC Transfer Control Register +#define AT91C_DBGU_PTSR (0xFFFFF324) // (PDC_DBGU) PDC Transfer Status Register +#define AT91C_DBGU_RCR (0xFFFFF304) // (PDC_DBGU) Receive Counter Register +#define AT91C_DBGU_TCR (0xFFFFF30C) // (PDC_DBGU) Transmit Counter Register +#define AT91C_DBGU_RPR (0xFFFFF300) // (PDC_DBGU) Receive Pointer Register +#define AT91C_DBGU_TPR (0xFFFFF308) // (PDC_DBGU) Transmit Pointer Register +#define AT91C_DBGU_RNPR (0xFFFFF310) // (PDC_DBGU) Receive Next Pointer Register +#define AT91C_DBGU_TNPR (0xFFFFF318) // (PDC_DBGU) Transmit Next Pointer Register +// ========== Register definition for DBGU peripheral ========== +#define AT91C_DBGU_EXID (0xFFFFF244) // (DBGU) Chip ID Extension Register +#define AT91C_DBGU_THR (0xFFFFF21C) // (DBGU) Transmitter Holding Register +#define AT91C_DBGU_CSR (0xFFFFF214) // (DBGU) Channel Status Register +#define AT91C_DBGU_IDR (0xFFFFF20C) // (DBGU) Interrupt Disable Register +#define AT91C_DBGU_MR (0xFFFFF204) // (DBGU) Mode Register +#define AT91C_DBGU_FNTR (0xFFFFF248) // (DBGU) Force NTRST Register +#define AT91C_DBGU_CIDR (0xFFFFF240) // (DBGU) Chip ID Register +#define AT91C_DBGU_BRGR (0xFFFFF220) // (DBGU) Baud Rate Generator Register +#define AT91C_DBGU_RHR (0xFFFFF218) // (DBGU) Receiver Holding Register +#define AT91C_DBGU_IMR (0xFFFFF210) // (DBGU) Interrupt Mask Register +#define AT91C_DBGU_IER (0xFFFFF208) // (DBGU) Interrupt Enable Register +#define AT91C_DBGU_CR (0xFFFFF200) // (DBGU) Control Register +// ========== Register definition for PIOA peripheral ========== +#define AT91C_PIOA_IMR (0xFFFFF448) // (PIOA) Interrupt Mask Register +#define AT91C_PIOA_IER (0xFFFFF440) // (PIOA) Interrupt Enable Register +#define AT91C_PIOA_OWDR (0xFFFFF4A4) // (PIOA) Output Write Disable Register +#define AT91C_PIOA_ISR (0xFFFFF44C) // (PIOA) Interrupt Status Register +#define AT91C_PIOA_PPUDR (0xFFFFF460) // (PIOA) Pull-up Disable Register +#define AT91C_PIOA_MDSR (0xFFFFF458) // (PIOA) Multi-driver Status Register +#define AT91C_PIOA_MDER (0xFFFFF450) // (PIOA) Multi-driver Enable Register +#define AT91C_PIOA_PER (0xFFFFF400) // (PIOA) PIO Enable Register +#define AT91C_PIOA_PSR (0xFFFFF408) // (PIOA) PIO Status Register +#define AT91C_PIOA_OER (0xFFFFF410) // (PIOA) Output Enable Register +#define AT91C_PIOA_BSR (0xFFFFF474) // (PIOA) Select B Register +#define AT91C_PIOA_PPUER (0xFFFFF464) // (PIOA) Pull-up Enable Register +#define AT91C_PIOA_MDDR (0xFFFFF454) // (PIOA) Multi-driver Disable Register +#define AT91C_PIOA_PDR (0xFFFFF404) // (PIOA) PIO Disable Register +#define AT91C_PIOA_ODR (0xFFFFF414) // (PIOA) Output Disable Registerr +#define AT91C_PIOA_IFDR (0xFFFFF424) // (PIOA) Input Filter Disable Register +#define AT91C_PIOA_ABSR (0xFFFFF478) // (PIOA) AB Select Status Register +#define AT91C_PIOA_ASR (0xFFFFF470) // (PIOA) Select A Register +#define AT91C_PIOA_PPUSR (0xFFFFF468) // (PIOA) Pull-up Status Register +#define AT91C_PIOA_ODSR (0xFFFFF438) // (PIOA) Output Data Status Register +#define AT91C_PIOA_SODR (0xFFFFF430) // (PIOA) Set Output Data Register +#define AT91C_PIOA_IFSR (0xFFFFF428) // (PIOA) Input Filter Status Register +#define AT91C_PIOA_IFER (0xFFFFF420) // (PIOA) Input Filter Enable Register +#define AT91C_PIOA_OSR (0xFFFFF418) // (PIOA) Output Status Register +#define AT91C_PIOA_IDR (0xFFFFF444) // (PIOA) Interrupt Disable Register +#define AT91C_PIOA_PDSR (0xFFFFF43C) // (PIOA) Pin Data Status Register +#define AT91C_PIOA_CODR (0xFFFFF434) // (PIOA) Clear Output Data Register +#define AT91C_PIOA_OWSR (0xFFFFF4A8) // (PIOA) Output Write Status Register +#define AT91C_PIOA_OWER (0xFFFFF4A0) // (PIOA) Output Write Enable Register +// ========== Register definition for PIOB peripheral ========== +#define AT91C_PIOB_OWSR (0xFFFFF6A8) // (PIOB) Output Write Status Register +#define AT91C_PIOB_PPUSR (0xFFFFF668) // (PIOB) Pull-up Status Register +#define AT91C_PIOB_PPUDR (0xFFFFF660) // (PIOB) Pull-up Disable Register +#define AT91C_PIOB_MDSR (0xFFFFF658) // (PIOB) Multi-driver Status Register +#define AT91C_PIOB_MDER (0xFFFFF650) // (PIOB) Multi-driver Enable Register +#define AT91C_PIOB_IMR (0xFFFFF648) // (PIOB) Interrupt Mask Register +#define AT91C_PIOB_OSR (0xFFFFF618) // (PIOB) Output Status Register +#define AT91C_PIOB_OER (0xFFFFF610) // (PIOB) Output Enable Register +#define AT91C_PIOB_PSR (0xFFFFF608) // (PIOB) PIO Status Register +#define AT91C_PIOB_PER (0xFFFFF600) // (PIOB) PIO Enable Register +#define AT91C_PIOB_BSR (0xFFFFF674) // (PIOB) Select B Register +#define AT91C_PIOB_PPUER (0xFFFFF664) // (PIOB) Pull-up Enable Register +#define AT91C_PIOB_IFDR (0xFFFFF624) // (PIOB) Input Filter Disable Register +#define AT91C_PIOB_ODR (0xFFFFF614) // (PIOB) Output Disable Registerr +#define AT91C_PIOB_ABSR (0xFFFFF678) // (PIOB) AB Select Status Register +#define AT91C_PIOB_ASR (0xFFFFF670) // (PIOB) Select A Register +#define AT91C_PIOB_IFER (0xFFFFF620) // (PIOB) Input Filter Enable Register +#define AT91C_PIOB_IFSR (0xFFFFF628) // (PIOB) Input Filter Status Register +#define AT91C_PIOB_SODR (0xFFFFF630) // (PIOB) Set Output Data Register +#define AT91C_PIOB_ODSR (0xFFFFF638) // (PIOB) Output Data Status Register +#define AT91C_PIOB_CODR (0xFFFFF634) // (PIOB) Clear Output Data Register +#define AT91C_PIOB_PDSR (0xFFFFF63C) // (PIOB) Pin Data Status Register +#define AT91C_PIOB_OWER (0xFFFFF6A0) // (PIOB) Output Write Enable Register +#define AT91C_PIOB_IER (0xFFFFF640) // (PIOB) Interrupt Enable Register +#define AT91C_PIOB_OWDR (0xFFFFF6A4) // (PIOB) Output Write Disable Register +#define AT91C_PIOB_MDDR (0xFFFFF654) // (PIOB) Multi-driver Disable Register +#define AT91C_PIOB_ISR (0xFFFFF64C) // (PIOB) Interrupt Status Register +#define AT91C_PIOB_IDR (0xFFFFF644) // (PIOB) Interrupt Disable Register +#define AT91C_PIOB_PDR (0xFFFFF604) // (PIOB) PIO Disable Register +// ========== Register definition for CKGR peripheral ========== +#define AT91C_CKGR_PLLR (0xFFFFFC2C) // (CKGR) PLL Register +#define AT91C_CKGR_MCFR (0xFFFFFC24) // (CKGR) Main Clock Frequency Register +#define AT91C_CKGR_MOR (0xFFFFFC20) // (CKGR) Main Oscillator Register +// ========== Register definition for PMC peripheral ========== +#define AT91C_PMC_SCSR (0xFFFFFC08) // (PMC) System Clock Status Register +#define AT91C_PMC_SCER (0xFFFFFC00) // (PMC) System Clock Enable Register +#define AT91C_PMC_IMR (0xFFFFFC6C) // (PMC) Interrupt Mask Register +#define AT91C_PMC_IDR (0xFFFFFC64) // (PMC) Interrupt Disable Register +#define AT91C_PMC_PCDR (0xFFFFFC14) // (PMC) Peripheral Clock Disable Register +#define AT91C_PMC_SCDR (0xFFFFFC04) // (PMC) System Clock Disable Register +#define AT91C_PMC_SR (0xFFFFFC68) // (PMC) Status Register +#define AT91C_PMC_IER (0xFFFFFC60) // (PMC) Interrupt Enable Register +#define AT91C_PMC_MCKR (0xFFFFFC30) // (PMC) Master Clock Register +#define AT91C_PMC_MOR (0xFFFFFC20) // (PMC) Main Oscillator Register +#define AT91C_PMC_PCER (0xFFFFFC10) // (PMC) Peripheral Clock Enable Register +#define AT91C_PMC_PCSR (0xFFFFFC18) // (PMC) Peripheral Clock Status Register +#define AT91C_PMC_PLLR (0xFFFFFC2C) // (PMC) PLL Register +#define AT91C_PMC_MCFR (0xFFFFFC24) // (PMC) Main Clock Frequency Register +#define AT91C_PMC_PCKR (0xFFFFFC40) // (PMC) Programmable Clock Register +// ========== Register definition for RSTC peripheral ========== +#define AT91C_RSTC_RSR (0xFFFFFD04) // (RSTC) Reset Status Register +#define AT91C_RSTC_RMR (0xFFFFFD08) // (RSTC) Reset Mode Register +#define AT91C_RSTC_RCR (0xFFFFFD00) // (RSTC) Reset Control Register +// ========== Register definition for RTTC peripheral ========== +#define AT91C_RTTC_RTSR (0xFFFFFD2C) // (RTTC) Real-time Status Register +#define AT91C_RTTC_RTAR (0xFFFFFD24) // (RTTC) Real-time Alarm Register +#define AT91C_RTTC_RTVR (0xFFFFFD28) // (RTTC) Real-time Value Register +#define AT91C_RTTC_RTMR (0xFFFFFD20) // (RTTC) Real-time Mode Register +// ========== Register definition for PITC peripheral ========== +#define AT91C_PITC_PIIR (0xFFFFFD3C) // (PITC) Period Interval Image Register +#define AT91C_PITC_PISR (0xFFFFFD34) // (PITC) Period Interval Status Register +#define AT91C_PITC_PIVR (0xFFFFFD38) // (PITC) Period Interval Value Register +#define AT91C_PITC_PIMR (0xFFFFFD30) // (PITC) Period Interval Mode Register +// ========== Register definition for WDTC peripheral ========== +#define AT91C_WDTC_WDMR (0xFFFFFD44) // (WDTC) Watchdog Mode Register +#define AT91C_WDTC_WDSR (0xFFFFFD48) // (WDTC) Watchdog Status Register +#define AT91C_WDTC_WDCR (0xFFFFFD40) // (WDTC) Watchdog Control Register +// ========== Register definition for VREG peripheral ========== +#define AT91C_VREG_MR (0xFFFFFD60) // (VREG) Voltage Regulator Mode Register +// ========== Register definition for MC peripheral ========== +#define AT91C_MC_FCR (0xFFFFFF64) // (MC) MC Flash Command Register +#define AT91C_MC_ASR (0xFFFFFF04) // (MC) MC Abort Status Register +#define AT91C_MC_FSR (0xFFFFFF68) // (MC) MC Flash Status Register +#define AT91C_MC_FMR (0xFFFFFF60) // (MC) MC Flash Mode Register +#define AT91C_MC_AASR (0xFFFFFF08) // (MC) MC Abort Address Status Register +#define AT91C_MC_RCR (0xFFFFFF00) // (MC) MC Remap Control Register +// ========== Register definition for PDC_SPI1 peripheral ========== +#define AT91C_SPI1_RNPR (0xFFFE4110) // (PDC_SPI1) Receive Next Pointer Register +#define AT91C_SPI1_TPR (0xFFFE4108) // (PDC_SPI1) Transmit Pointer Register +#define AT91C_SPI1_RPR (0xFFFE4100) // (PDC_SPI1) Receive Pointer Register +#define AT91C_SPI1_PTSR (0xFFFE4124) // (PDC_SPI1) PDC Transfer Status Register +#define AT91C_SPI1_RCR (0xFFFE4104) // (PDC_SPI1) Receive Counter Register +#define AT91C_SPI1_TCR (0xFFFE410C) // (PDC_SPI1) Transmit Counter Register +#define AT91C_SPI1_RNCR (0xFFFE4114) // (PDC_SPI1) Receive Next Counter Register +#define AT91C_SPI1_TNCR (0xFFFE411C) // (PDC_SPI1) Transmit Next Counter Register +#define AT91C_SPI1_TNPR (0xFFFE4118) // (PDC_SPI1) Transmit Next Pointer Register +#define AT91C_SPI1_PTCR (0xFFFE4120) // (PDC_SPI1) PDC Transfer Control Register +// ========== Register definition for SPI1 peripheral ========== +#define AT91C_SPI1_CSR (0xFFFE4030) // (SPI1) Chip Select Register +#define AT91C_SPI1_IDR (0xFFFE4018) // (SPI1) Interrupt Disable Register +#define AT91C_SPI1_SR (0xFFFE4010) // (SPI1) Status Register +#define AT91C_SPI1_RDR (0xFFFE4008) // (SPI1) Receive Data Register +#define AT91C_SPI1_CR (0xFFFE4000) // (SPI1) Control Register +#define AT91C_SPI1_IMR (0xFFFE401C) // (SPI1) Interrupt Mask Register +#define AT91C_SPI1_IER (0xFFFE4014) // (SPI1) Interrupt Enable Register +#define AT91C_SPI1_TDR (0xFFFE400C) // (SPI1) Transmit Data Register +#define AT91C_SPI1_MR (0xFFFE4004) // (SPI1) Mode Register +// ========== Register definition for PDC_SPI0 peripheral ========== +#define AT91C_SPI0_PTCR (0xFFFE0120) // (PDC_SPI0) PDC Transfer Control Register +#define AT91C_SPI0_TNPR (0xFFFE0118) // (PDC_SPI0) Transmit Next Pointer Register +#define AT91C_SPI0_RNPR (0xFFFE0110) // (PDC_SPI0) Receive Next Pointer Register +#define AT91C_SPI0_TPR (0xFFFE0108) // (PDC_SPI0) Transmit Pointer Register +#define AT91C_SPI0_RPR (0xFFFE0100) // (PDC_SPI0) Receive Pointer Register +#define AT91C_SPI0_PTSR (0xFFFE0124) // (PDC_SPI0) PDC Transfer Status Register +#define AT91C_SPI0_TNCR (0xFFFE011C) // (PDC_SPI0) Transmit Next Counter Register +#define AT91C_SPI0_RNCR (0xFFFE0114) // (PDC_SPI0) Receive Next Counter Register +#define AT91C_SPI0_TCR (0xFFFE010C) // (PDC_SPI0) Transmit Counter Register +#define AT91C_SPI0_RCR (0xFFFE0104) // (PDC_SPI0) Receive Counter Register +// ========== Register definition for SPI0 peripheral ========== +#define AT91C_SPI0_CSR (0xFFFE0030) // (SPI0) Chip Select Register +#define AT91C_SPI0_IDR (0xFFFE0018) // (SPI0) Interrupt Disable Register +#define AT91C_SPI0_SR (0xFFFE0010) // (SPI0) Status Register +#define AT91C_SPI0_RDR (0xFFFE0008) // (SPI0) Receive Data Register +#define AT91C_SPI0_CR (0xFFFE0000) // (SPI0) Control Register +#define AT91C_SPI0_IMR (0xFFFE001C) // (SPI0) Interrupt Mask Register +#define AT91C_SPI0_IER (0xFFFE0014) // (SPI0) Interrupt Enable Register +#define AT91C_SPI0_TDR (0xFFFE000C) // (SPI0) Transmit Data Register +#define AT91C_SPI0_MR (0xFFFE0004) // (SPI0) Mode Register +// ========== Register definition for PDC_US1 peripheral ========== +#define AT91C_US1_PTSR (0xFFFC4124) // (PDC_US1) PDC Transfer Status Register +#define AT91C_US1_TNCR (0xFFFC411C) // (PDC_US1) Transmit Next Counter Register +#define AT91C_US1_RNCR (0xFFFC4114) // (PDC_US1) Receive Next Counter Register +#define AT91C_US1_TCR (0xFFFC410C) // (PDC_US1) Transmit Counter Register +#define AT91C_US1_RCR (0xFFFC4104) // (PDC_US1) Receive Counter Register +#define AT91C_US1_PTCR (0xFFFC4120) // (PDC_US1) PDC Transfer Control Register +#define AT91C_US1_TNPR (0xFFFC4118) // (PDC_US1) Transmit Next Pointer Register +#define AT91C_US1_RNPR (0xFFFC4110) // (PDC_US1) Receive Next Pointer Register +#define AT91C_US1_TPR (0xFFFC4108) // (PDC_US1) Transmit Pointer Register +#define AT91C_US1_RPR (0xFFFC4100) // (PDC_US1) Receive Pointer Register +// ========== Register definition for US1 peripheral ========== +#define AT91C_US1_RHR (0xFFFC4018) // (US1) Receiver Holding Register +#define AT91C_US1_IMR (0xFFFC4010) // (US1) Interrupt Mask Register +#define AT91C_US1_IER (0xFFFC4008) // (US1) Interrupt Enable Register +#define AT91C_US1_CR (0xFFFC4000) // (US1) Control Register +#define AT91C_US1_RTOR (0xFFFC4024) // (US1) Receiver Time-out Register +#define AT91C_US1_THR (0xFFFC401C) // (US1) Transmitter Holding Register +#define AT91C_US1_CSR (0xFFFC4014) // (US1) Channel Status Register +#define AT91C_US1_IDR (0xFFFC400C) // (US1) Interrupt Disable Register +#define AT91C_US1_FIDI (0xFFFC4040) // (US1) FI_DI_Ratio Register +#define AT91C_US1_BRGR (0xFFFC4020) // (US1) Baud Rate Generator Register +#define AT91C_US1_TTGR (0xFFFC4028) // (US1) Transmitter Time-guard Register +#define AT91C_US1_IF (0xFFFC404C) // (US1) IRDA_FILTER Register +#define AT91C_US1_NER (0xFFFC4044) // (US1) Nb Errors Register +#define AT91C_US1_MR (0xFFFC4004) // (US1) Mode Register +// ========== Register definition for PDC_US0 peripheral ========== +#define AT91C_US0_PTCR (0xFFFC0120) // (PDC_US0) PDC Transfer Control Register +#define AT91C_US0_TNPR (0xFFFC0118) // (PDC_US0) Transmit Next Pointer Register +#define AT91C_US0_RNPR (0xFFFC0110) // (PDC_US0) Receive Next Pointer Register +#define AT91C_US0_TPR (0xFFFC0108) // (PDC_US0) Transmit Pointer Register +#define AT91C_US0_RPR (0xFFFC0100) // (PDC_US0) Receive Pointer Register +#define AT91C_US0_PTSR (0xFFFC0124) // (PDC_US0) PDC Transfer Status Register +#define AT91C_US0_TNCR (0xFFFC011C) // (PDC_US0) Transmit Next Counter Register +#define AT91C_US0_RNCR (0xFFFC0114) // (PDC_US0) Receive Next Counter Register +#define AT91C_US0_TCR (0xFFFC010C) // (PDC_US0) Transmit Counter Register +#define AT91C_US0_RCR (0xFFFC0104) // (PDC_US0) Receive Counter Register +// ========== Register definition for US0 peripheral ========== +#define AT91C_US0_TTGR (0xFFFC0028) // (US0) Transmitter Time-guard Register +#define AT91C_US0_BRGR (0xFFFC0020) // (US0) Baud Rate Generator Register +#define AT91C_US0_RHR (0xFFFC0018) // (US0) Receiver Holding Register +#define AT91C_US0_IMR (0xFFFC0010) // (US0) Interrupt Mask Register +#define AT91C_US0_NER (0xFFFC0044) // (US0) Nb Errors Register +#define AT91C_US0_RTOR (0xFFFC0024) // (US0) Receiver Time-out Register +#define AT91C_US0_FIDI (0xFFFC0040) // (US0) FI_DI_Ratio Register +#define AT91C_US0_CR (0xFFFC0000) // (US0) Control Register +#define AT91C_US0_IER (0xFFFC0008) // (US0) Interrupt Enable Register +#define AT91C_US0_IF (0xFFFC004C) // (US0) IRDA_FILTER Register +#define AT91C_US0_MR (0xFFFC0004) // (US0) Mode Register +#define AT91C_US0_IDR (0xFFFC000C) // (US0) Interrupt Disable Register +#define AT91C_US0_CSR (0xFFFC0014) // (US0) Channel Status Register +#define AT91C_US0_THR (0xFFFC001C) // (US0) Transmitter Holding Register +// ========== Register definition for PDC_SSC peripheral ========== +#define AT91C_SSC_PTCR (0xFFFD4120) // (PDC_SSC) PDC Transfer Control Register +#define AT91C_SSC_TNPR (0xFFFD4118) // (PDC_SSC) Transmit Next Pointer Register +#define AT91C_SSC_RNPR (0xFFFD4110) // (PDC_SSC) Receive Next Pointer Register +#define AT91C_SSC_TPR (0xFFFD4108) // (PDC_SSC) Transmit Pointer Register +#define AT91C_SSC_RPR (0xFFFD4100) // (PDC_SSC) Receive Pointer Register +#define AT91C_SSC_PTSR (0xFFFD4124) // (PDC_SSC) PDC Transfer Status Register +#define AT91C_SSC_TNCR (0xFFFD411C) // (PDC_SSC) Transmit Next Counter Register +#define AT91C_SSC_RNCR (0xFFFD4114) // (PDC_SSC) Receive Next Counter Register +#define AT91C_SSC_TCR (0xFFFD410C) // (PDC_SSC) Transmit Counter Register +#define AT91C_SSC_RCR (0xFFFD4104) // (PDC_SSC) Receive Counter Register +// ========== Register definition for SSC peripheral ========== +#define AT91C_SSC_RFMR (0xFFFD4014) // (SSC) Receive Frame Mode Register +#define AT91C_SSC_CMR (0xFFFD4004) // (SSC) Clock Mode Register +#define AT91C_SSC_IDR (0xFFFD4048) // (SSC) Interrupt Disable Register +#define AT91C_SSC_SR (0xFFFD4040) // (SSC) Status Register +#define AT91C_SSC_RSHR (0xFFFD4030) // (SSC) Receive Sync Holding Register +#define AT91C_SSC_RHR (0xFFFD4020) // (SSC) Receive Holding Register +#define AT91C_SSC_TCMR (0xFFFD4018) // (SSC) Transmit Clock Mode Register +#define AT91C_SSC_RCMR (0xFFFD4010) // (SSC) Receive Clock ModeRegister +#define AT91C_SSC_CR (0xFFFD4000) // (SSC) Control Register +#define AT91C_SSC_IMR (0xFFFD404C) // (SSC) Interrupt Mask Register +#define AT91C_SSC_IER (0xFFFD4044) // (SSC) Interrupt Enable Register +#define AT91C_SSC_TSHR (0xFFFD4034) // (SSC) Transmit Sync Holding Register +#define AT91C_SSC_THR (0xFFFD4024) // (SSC) Transmit Holding Register +#define AT91C_SSC_TFMR (0xFFFD401C) // (SSC) Transmit Frame Mode Register +// ========== Register definition for TWI peripheral ========== +#define AT91C_TWI_RHR (0xFFFB8030) // (TWI) Receive Holding Register +#define AT91C_TWI_IDR (0xFFFB8028) // (TWI) Interrupt Disable Register +#define AT91C_TWI_SR (0xFFFB8020) // (TWI) Status Register +#define AT91C_TWI_CWGR (0xFFFB8010) // (TWI) Clock Waveform Generator Register +#define AT91C_TWI_CR (0xFFFB8000) // (TWI) Control Register +#define AT91C_TWI_THR (0xFFFB8034) // (TWI) Transmit Holding Register +#define AT91C_TWI_IMR (0xFFFB802C) // (TWI) Interrupt Mask Register +#define AT91C_TWI_IER (0xFFFB8024) // (TWI) Interrupt Enable Register +#define AT91C_TWI_IADR (0xFFFB800C) // (TWI) Internal Address Register +#define AT91C_TWI_MMR (0xFFFB8004) // (TWI) Master Mode Register +// ========== Register definition for PWMC_CH3 peripheral ========== +#define AT91C_PWMC_CH3_CUPDR (0xFFFCC270) // (PWMC_CH3) Channel Update Register +#define AT91C_PWMC_CH3_CPRDR (0xFFFCC268) // (PWMC_CH3) Channel Period Register +#define AT91C_PWMC_CH3_CMR (0xFFFCC260) // (PWMC_CH3) Channel Mode Register +#define AT91C_PWMC_CH3_Reserved (0xFFFCC274) // (PWMC_CH3) Reserved +#define AT91C_PWMC_CH3_CCNTR (0xFFFCC26C) // (PWMC_CH3) Channel Counter Register +#define AT91C_PWMC_CH3_CDTYR (0xFFFCC264) // (PWMC_CH3) Channel Duty Cycle Register +// ========== Register definition for PWMC_CH2 peripheral ========== +#define AT91C_PWMC_CH2_CUPDR (0xFFFCC250) // (PWMC_CH2) Channel Update Register +#define AT91C_PWMC_CH2_CPRDR (0xFFFCC248) // (PWMC_CH2) Channel Period Register +#define AT91C_PWMC_CH2_CMR (0xFFFCC240) // (PWMC_CH2) Channel Mode Register +#define AT91C_PWMC_CH2_Reserved (0xFFFCC254) // (PWMC_CH2) Reserved +#define AT91C_PWMC_CH2_CCNTR (0xFFFCC24C) // (PWMC_CH2) Channel Counter Register +#define AT91C_PWMC_CH2_CDTYR (0xFFFCC244) // (PWMC_CH2) Channel Duty Cycle Register +// ========== Register definition for PWMC_CH1 peripheral ========== +#define AT91C_PWMC_CH1_CUPDR (0xFFFCC230) // (PWMC_CH1) Channel Update Register +#define AT91C_PWMC_CH1_CPRDR (0xFFFCC228) // (PWMC_CH1) Channel Period Register +#define AT91C_PWMC_CH1_CMR (0xFFFCC220) // (PWMC_CH1) Channel Mode Register +#define AT91C_PWMC_CH1_Reserved (0xFFFCC234) // (PWMC_CH1) Reserved +#define AT91C_PWMC_CH1_CCNTR (0xFFFCC22C) // (PWMC_CH1) Channel Counter Register +#define AT91C_PWMC_CH1_CDTYR (0xFFFCC224) // (PWMC_CH1) Channel Duty Cycle Register +// ========== Register definition for PWMC_CH0 peripheral ========== +#define AT91C_PWMC_CH0_CUPDR (0xFFFCC210) // (PWMC_CH0) Channel Update Register +#define AT91C_PWMC_CH0_CPRDR (0xFFFCC208) // (PWMC_CH0) Channel Period Register +#define AT91C_PWMC_CH0_CMR (0xFFFCC200) // (PWMC_CH0) Channel Mode Register +#define AT91C_PWMC_CH0_Reserved (0xFFFCC214) // (PWMC_CH0) Reserved +#define AT91C_PWMC_CH0_CCNTR (0xFFFCC20C) // (PWMC_CH0) Channel Counter Register +#define AT91C_PWMC_CH0_CDTYR (0xFFFCC204) // (PWMC_CH0) Channel Duty Cycle Register +// ========== Register definition for PWMC peripheral ========== +#define AT91C_PWMC_VR (0xFFFCC0FC) // (PWMC) PWMC Version Register +#define AT91C_PWMC_ISR (0xFFFCC01C) // (PWMC) PWMC Interrupt Status Register +#define AT91C_PWMC_IDR (0xFFFCC014) // (PWMC) PWMC Interrupt Disable Register +#define AT91C_PWMC_SR (0xFFFCC00C) // (PWMC) PWMC Status Register +#define AT91C_PWMC_ENA (0xFFFCC004) // (PWMC) PWMC Enable Register +#define AT91C_PWMC_IMR (0xFFFCC018) // (PWMC) PWMC Interrupt Mask Register +#define AT91C_PWMC_MR (0xFFFCC000) // (PWMC) PWMC Mode Register +#define AT91C_PWMC_DIS (0xFFFCC008) // (PWMC) PWMC Disable Register +#define AT91C_PWMC_IER (0xFFFCC010) // (PWMC) PWMC Interrupt Enable Register +// ========== Register definition for UDP peripheral ========== +#define AT91C_UDP_TXVC (0xFFFB0074) // (UDP) Transceiver Control Register +#define AT91C_UDP_ISR (0xFFFB001C) // (UDP) Interrupt Status Register +#define AT91C_UDP_IDR (0xFFFB0014) // (UDP) Interrupt Disable Register +#define AT91C_UDP_CSR (0xFFFB0030) // (UDP) Endpoint Control and Status Register +#define AT91C_UDP_RSTEP (0xFFFB0028) // (UDP) Reset Endpoint Register +#define AT91C_UDP_ICR (0xFFFB0020) // (UDP) Interrupt Clear Register +#define AT91C_UDP_GLBSTATE (0xFFFB0004) // (UDP) Global State Register +#define AT91C_UDP_NUM (0xFFFB0000) // (UDP) Frame Number Register +#define AT91C_UDP_FADDR (0xFFFB0008) // (UDP) Function Address Register +#define AT91C_UDP_IER (0xFFFB0010) // (UDP) Interrupt Enable Register +#define AT91C_UDP_IMR (0xFFFB0018) // (UDP) Interrupt Mask Register +#define AT91C_UDP_FDR (0xFFFB0050) // (UDP) Endpoint FIFO Data Register +// ========== Register definition for TC0 peripheral ========== +#define AT91C_TC0_IMR (0xFFFA002C) // (TC0) Interrupt Mask Register +#define AT91C_TC0_IER (0xFFFA0024) // (TC0) Interrupt Enable Register +#define AT91C_TC0_RC (0xFFFA001C) // (TC0) Register C +#define AT91C_TC0_RA (0xFFFA0014) // (TC0) Register A +#define AT91C_TC0_CMR (0xFFFA0004) // (TC0) Channel Mode Register (Capture Mode / Waveform Mode) +#define AT91C_TC0_IDR (0xFFFA0028) // (TC0) Interrupt Disable Register +#define AT91C_TC0_SR (0xFFFA0020) // (TC0) Status Register +#define AT91C_TC0_RB (0xFFFA0018) // (TC0) Register B +#define AT91C_TC0_CV (0xFFFA0010) // (TC0) Counter Value +#define AT91C_TC0_CCR (0xFFFA0000) // (TC0) Channel Control Register +// ========== Register definition for TC1 peripheral ========== +#define AT91C_TC1_IMR (0xFFFA006C) // (TC1) Interrupt Mask Register +#define AT91C_TC1_IER (0xFFFA0064) // (TC1) Interrupt Enable Register +#define AT91C_TC1_RC (0xFFFA005C) // (TC1) Register C +#define AT91C_TC1_RA (0xFFFA0054) // (TC1) Register A +#define AT91C_TC1_CMR (0xFFFA0044) // (TC1) Channel Mode Register (Capture Mode / Waveform Mode) +#define AT91C_TC1_IDR (0xFFFA0068) // (TC1) Interrupt Disable Register +#define AT91C_TC1_SR (0xFFFA0060) // (TC1) Status Register +#define AT91C_TC1_RB (0xFFFA0058) // (TC1) Register B +#define AT91C_TC1_CV (0xFFFA0050) // (TC1) Counter Value +#define AT91C_TC1_CCR (0xFFFA0040) // (TC1) Channel Control Register +// ========== Register definition for TC2 peripheral ========== +#define AT91C_TC2_IMR (0xFFFA00AC) // (TC2) Interrupt Mask Register +#define AT91C_TC2_IER (0xFFFA00A4) // (TC2) Interrupt Enable Register +#define AT91C_TC2_RC (0xFFFA009C) // (TC2) Register C +#define AT91C_TC2_RA (0xFFFA0094) // (TC2) Register A +#define AT91C_TC2_CMR (0xFFFA0084) // (TC2) Channel Mode Register (Capture Mode / Waveform Mode) +#define AT91C_TC2_IDR (0xFFFA00A8) // (TC2) Interrupt Disable Register +#define AT91C_TC2_SR (0xFFFA00A0) // (TC2) Status Register +#define AT91C_TC2_RB (0xFFFA0098) // (TC2) Register B +#define AT91C_TC2_CV (0xFFFA0090) // (TC2) Counter Value +#define AT91C_TC2_CCR (0xFFFA0080) // (TC2) Channel Control Register +// ========== Register definition for TCB peripheral ========== +#define AT91C_TCB_BMR (0xFFFA00C4) // (TCB) TC Block Mode Register +#define AT91C_TCB_BCR (0xFFFA00C0) // (TCB) TC Block Control Register +// ========== Register definition for CAN_MB0 peripheral ========== +#define AT91C_CAN_MB0_MCR (0xFFFD021C) // (CAN_MB0) MailBox Control Register +#define AT91C_CAN_MB0_MDL (0xFFFD0214) // (CAN_MB0) MailBox Data Low Register +#define AT91C_CAN_MB0_MFID (0xFFFD020C) // (CAN_MB0) MailBox Family ID Register +#define AT91C_CAN_MB0_MAM (0xFFFD0204) // (CAN_MB0) MailBox Acceptance Mask Register +#define AT91C_CAN_MB0_MDH (0xFFFD0218) // (CAN_MB0) MailBox Data High Register +#define AT91C_CAN_MB0_MSR (0xFFFD0210) // (CAN_MB0) MailBox Status Register +#define AT91C_CAN_MB0_MID (0xFFFD0208) // (CAN_MB0) MailBox ID Register +#define AT91C_CAN_MB0_MMR (0xFFFD0200) // (CAN_MB0) MailBox Mode Register +// ========== Register definition for CAN_MB1 peripheral ========== +#define AT91C_CAN_MB1_MCR (0xFFFD023C) // (CAN_MB1) MailBox Control Register +#define AT91C_CAN_MB1_MDL (0xFFFD0234) // (CAN_MB1) MailBox Data Low Register +#define AT91C_CAN_MB1_MFID (0xFFFD022C) // (CAN_MB1) MailBox Family ID Register +#define AT91C_CAN_MB1_MAM (0xFFFD0224) // (CAN_MB1) MailBox Acceptance Mask Register +#define AT91C_CAN_MB1_MDH (0xFFFD0238) // (CAN_MB1) MailBox Data High Register +#define AT91C_CAN_MB1_MSR (0xFFFD0230) // (CAN_MB1) MailBox Status Register +#define AT91C_CAN_MB1_MID (0xFFFD0228) // (CAN_MB1) MailBox ID Register +#define AT91C_CAN_MB1_MMR (0xFFFD0220) // (CAN_MB1) MailBox Mode Register +// ========== Register definition for CAN_MB2 peripheral ========== +#define AT91C_CAN_MB2_MCR (0xFFFD025C) // (CAN_MB2) MailBox Control Register +#define AT91C_CAN_MB2_MDL (0xFFFD0254) // (CAN_MB2) MailBox Data Low Register +#define AT91C_CAN_MB2_MFID (0xFFFD024C) // (CAN_MB2) MailBox Family ID Register +#define AT91C_CAN_MB2_MAM (0xFFFD0244) // (CAN_MB2) MailBox Acceptance Mask Register +#define AT91C_CAN_MB2_MDH (0xFFFD0258) // (CAN_MB2) MailBox Data High Register +#define AT91C_CAN_MB2_MSR (0xFFFD0250) // (CAN_MB2) MailBox Status Register +#define AT91C_CAN_MB2_MID (0xFFFD0248) // (CAN_MB2) MailBox ID Register +#define AT91C_CAN_MB2_MMR (0xFFFD0240) // (CAN_MB2) MailBox Mode Register +// ========== Register definition for CAN_MB3 peripheral ========== +#define AT91C_CAN_MB3_MCR (0xFFFD027C) // (CAN_MB3) MailBox Control Register +#define AT91C_CAN_MB3_MDL (0xFFFD0274) // (CAN_MB3) MailBox Data Low Register +#define AT91C_CAN_MB3_MFID (0xFFFD026C) // (CAN_MB3) MailBox Family ID Register +#define AT91C_CAN_MB3_MAM (0xFFFD0264) // (CAN_MB3) MailBox Acceptance Mask Register +#define AT91C_CAN_MB3_MDH (0xFFFD0278) // (CAN_MB3) MailBox Data High Register +#define AT91C_CAN_MB3_MSR (0xFFFD0270) // (CAN_MB3) MailBox Status Register +#define AT91C_CAN_MB3_MID (0xFFFD0268) // (CAN_MB3) MailBox ID Register +#define AT91C_CAN_MB3_MMR (0xFFFD0260) // (CAN_MB3) MailBox Mode Register +// ========== Register definition for CAN_MB4 peripheral ========== +#define AT91C_CAN_MB4_MCR (0xFFFD029C) // (CAN_MB4) MailBox Control Register +#define AT91C_CAN_MB4_MDL (0xFFFD0294) // (CAN_MB4) MailBox Data Low Register +#define AT91C_CAN_MB4_MFID (0xFFFD028C) // (CAN_MB4) MailBox Family ID Register +#define AT91C_CAN_MB4_MAM (0xFFFD0284) // (CAN_MB4) MailBox Acceptance Mask Register +#define AT91C_CAN_MB4_MDH (0xFFFD0298) // (CAN_MB4) MailBox Data High Register +#define AT91C_CAN_MB4_MSR (0xFFFD0290) // (CAN_MB4) MailBox Status Register +#define AT91C_CAN_MB4_MID (0xFFFD0288) // (CAN_MB4) MailBox ID Register +#define AT91C_CAN_MB4_MMR (0xFFFD0280) // (CAN_MB4) MailBox Mode Register +// ========== Register definition for CAN_MB5 peripheral ========== +#define AT91C_CAN_MB5_MCR (0xFFFD02BC) // (CAN_MB5) MailBox Control Register +#define AT91C_CAN_MB5_MDL (0xFFFD02B4) // (CAN_MB5) MailBox Data Low Register +#define AT91C_CAN_MB5_MFID (0xFFFD02AC) // (CAN_MB5) MailBox Family ID Register +#define AT91C_CAN_MB5_MAM (0xFFFD02A4) // (CAN_MB5) MailBox Acceptance Mask Register +#define AT91C_CAN_MB5_MDH (0xFFFD02B8) // (CAN_MB5) MailBox Data High Register +#define AT91C_CAN_MB5_MSR (0xFFFD02B0) // (CAN_MB5) MailBox Status Register +#define AT91C_CAN_MB5_MID (0xFFFD02A8) // (CAN_MB5) MailBox ID Register +#define AT91C_CAN_MB5_MMR (0xFFFD02A0) // (CAN_MB5) MailBox Mode Register +// ========== Register definition for CAN_MB6 peripheral ========== +#define AT91C_CAN_MB6_MAM (0xFFFD02C4) // (CAN_MB6) MailBox Acceptance Mask Register +#define AT91C_CAN_MB6_MDH (0xFFFD02D8) // (CAN_MB6) MailBox Data High Register +#define AT91C_CAN_MB6_MSR (0xFFFD02D0) // (CAN_MB6) MailBox Status Register +#define AT91C_CAN_MB6_MID (0xFFFD02C8) // (CAN_MB6) MailBox ID Register +#define AT91C_CAN_MB6_MMR (0xFFFD02C0) // (CAN_MB6) MailBox Mode Register +#define AT91C_CAN_MB6_MCR (0xFFFD02DC) // (CAN_MB6) MailBox Control Register +#define AT91C_CAN_MB6_MDL (0xFFFD02D4) // (CAN_MB6) MailBox Data Low Register +#define AT91C_CAN_MB6_MFID (0xFFFD02CC) // (CAN_MB6) MailBox Family ID Register +// ========== Register definition for CAN_MB7 peripheral ========== +#define AT91C_CAN_MB7_MDH (0xFFFD02F8) // (CAN_MB7) MailBox Data High Register +#define AT91C_CAN_MB7_MSR (0xFFFD02F0) // (CAN_MB7) MailBox Status Register +#define AT91C_CAN_MB7_MID (0xFFFD02E8) // (CAN_MB7) MailBox ID Register +#define AT91C_CAN_MB7_MMR (0xFFFD02E0) // (CAN_MB7) MailBox Mode Register +#define AT91C_CAN_MB7_MCR (0xFFFD02FC) // (CAN_MB7) MailBox Control Register +#define AT91C_CAN_MB7_MDL (0xFFFD02F4) // (CAN_MB7) MailBox Data Low Register +#define AT91C_CAN_MB7_MFID (0xFFFD02EC) // (CAN_MB7) MailBox Family ID Register +#define AT91C_CAN_MB7_MAM (0xFFFD02E4) // (CAN_MB7) MailBox Acceptance Mask Register +// ========== Register definition for CAN peripheral ========== +#define AT91C_CAN_IMR (0xFFFD000C) // (CAN) Interrupt Mask Register +#define AT91C_CAN_IER (0xFFFD0004) // (CAN) Interrupt Enable Register +#define AT91C_CAN_ECR (0xFFFD0020) // (CAN) Error Counter Register +#define AT91C_CAN_TIM (0xFFFD0018) // (CAN) Timer Register +#define AT91C_CAN_SR (0xFFFD0010) // (CAN) Status Register +#define AT91C_CAN_IDR (0xFFFD0008) // (CAN) Interrupt Disable Register +#define AT91C_CAN_MR (0xFFFD0000) // (CAN) Mode Register +#define AT91C_CAN_BR (0xFFFD0014) // (CAN) Baudrate Register +#define AT91C_CAN_TIMESTP (0xFFFD001C) // (CAN) Time Stamp Register +#define AT91C_CAN_TCR (0xFFFD0024) // (CAN) Transfer Command Register +#define AT91C_CAN_ACR (0xFFFD0028) // (CAN) Abort Command Register +#define AT91C_CAN_VR (0xFFFD00FC) // (CAN) Version Register +// ========== Register definition for EMAC peripheral ========== +#define AT91C_EMAC_TID (0xFFFDC0B8) // (EMAC) Type ID Checking Register +#define AT91C_EMAC_SA3L (0xFFFDC0A8) // (EMAC) Specific Address 3 Bottom, First 4 bytes +#define AT91C_EMAC_STE (0xFFFDC084) // (EMAC) SQE Test Error Register +#define AT91C_EMAC_RSE (0xFFFDC074) // (EMAC) Receive Symbol Errors Register +#define AT91C_EMAC_IDR (0xFFFDC02C) // (EMAC) Interrupt Disable Register +#define AT91C_EMAC_TBQP (0xFFFDC01C) // (EMAC) Transmit Buffer Queue Pointer +#define AT91C_EMAC_TPQ (0xFFFDC0BC) // (EMAC) Transmit Pause Quantum Register +#define AT91C_EMAC_SA1L (0xFFFDC098) // (EMAC) Specific Address 1 Bottom, First 4 bytes +#define AT91C_EMAC_RLE (0xFFFDC088) // (EMAC) Receive Length Field Mismatch Register +#define AT91C_EMAC_IMR (0xFFFDC030) // (EMAC) Interrupt Mask Register +#define AT91C_EMAC_SA1H (0xFFFDC09C) // (EMAC) Specific Address 1 Top, Last 2 bytes +#define AT91C_EMAC_PFR (0xFFFDC03C) // (EMAC) Pause Frames received Register +#define AT91C_EMAC_FCSE (0xFFFDC050) // (EMAC) Frame Check Sequence Error Register +#define AT91C_EMAC_FTO (0xFFFDC040) // (EMAC) Frames Transmitted OK Register +#define AT91C_EMAC_TUND (0xFFFDC064) // (EMAC) Transmit Underrun Error Register +#define AT91C_EMAC_ALE (0xFFFDC054) // (EMAC) Alignment Error Register +#define AT91C_EMAC_SCF (0xFFFDC044) // (EMAC) Single Collision Frame Register +#define AT91C_EMAC_SA3H (0xFFFDC0AC) // (EMAC) Specific Address 3 Top, Last 2 bytes +#define AT91C_EMAC_ELE (0xFFFDC078) // (EMAC) Excessive Length Errors Register +#define AT91C_EMAC_CSE (0xFFFDC068) // (EMAC) Carrier Sense Error Register +#define AT91C_EMAC_DTF (0xFFFDC058) // (EMAC) Deferred Transmission Frame Register +#define AT91C_EMAC_RSR (0xFFFDC020) // (EMAC) Receive Status Register +#define AT91C_EMAC_USRIO (0xFFFDC0C0) // (EMAC) USER Input/Output Register +#define AT91C_EMAC_SA4L (0xFFFDC0B0) // (EMAC) Specific Address 4 Bottom, First 4 bytes +#define AT91C_EMAC_RRE (0xFFFDC06C) // (EMAC) Receive Ressource Error Register +#define AT91C_EMAC_RJA (0xFFFDC07C) // (EMAC) Receive Jabbers Register +#define AT91C_EMAC_TPF (0xFFFDC08C) // (EMAC) Transmitted Pause Frames Register +#define AT91C_EMAC_ISR (0xFFFDC024) // (EMAC) Interrupt Status Register +#define AT91C_EMAC_MAN (0xFFFDC034) // (EMAC) PHY Maintenance Register +#define AT91C_EMAC_WOL (0xFFFDC0C4) // (EMAC) Wake On LAN Register +#define AT91C_EMAC_USF (0xFFFDC080) // (EMAC) Undersize Frames Register +#define AT91C_EMAC_HRB (0xFFFDC090) // (EMAC) Hash Address Bottom[31:0] +#define AT91C_EMAC_PTR (0xFFFDC038) // (EMAC) Pause Time Register +#define AT91C_EMAC_HRT (0xFFFDC094) // (EMAC) Hash Address Top[63:32] +#define AT91C_EMAC_REV (0xFFFDC0FC) // (EMAC) Revision Register +#define AT91C_EMAC_MCF (0xFFFDC048) // (EMAC) Multiple Collision Frame Register +#define AT91C_EMAC_SA2L (0xFFFDC0A0) // (EMAC) Specific Address 2 Bottom, First 4 bytes +#define AT91C_EMAC_NCR (0xFFFDC000) // (EMAC) Network Control Register +#define AT91C_EMAC_FRO (0xFFFDC04C) // (EMAC) Frames Received OK Register +#define AT91C_EMAC_LCOL (0xFFFDC05C) // (EMAC) Late Collision Register +#define AT91C_EMAC_SA4H (0xFFFDC0B4) // (EMAC) Specific Address 4 Top, Last 2 bytes +#define AT91C_EMAC_NCFGR (0xFFFDC004) // (EMAC) Network Configuration Register +#define AT91C_EMAC_TSR (0xFFFDC014) // (EMAC) Transmit Status Register +#define AT91C_EMAC_SA2H (0xFFFDC0A4) // (EMAC) Specific Address 2 Top, Last 2 bytes +#define AT91C_EMAC_ECOL (0xFFFDC060) // (EMAC) Excessive Collision Register +#define AT91C_EMAC_ROV (0xFFFDC070) // (EMAC) Receive Overrun Errors Register +#define AT91C_EMAC_NSR (0xFFFDC008) // (EMAC) Network Status Register +#define AT91C_EMAC_RBQP (0xFFFDC018) // (EMAC) Receive Buffer Queue Pointer +#define AT91C_EMAC_IER (0xFFFDC028) // (EMAC) Interrupt Enable Register +// ========== Register definition for PDC_ADC peripheral ========== +#define AT91C_ADC_PTCR (0xFFFD8120) // (PDC_ADC) PDC Transfer Control Register +#define AT91C_ADC_TNPR (0xFFFD8118) // (PDC_ADC) Transmit Next Pointer Register +#define AT91C_ADC_RNPR (0xFFFD8110) // (PDC_ADC) Receive Next Pointer Register +#define AT91C_ADC_TPR (0xFFFD8108) // (PDC_ADC) Transmit Pointer Register +#define AT91C_ADC_RPR (0xFFFD8100) // (PDC_ADC) Receive Pointer Register +#define AT91C_ADC_PTSR (0xFFFD8124) // (PDC_ADC) PDC Transfer Status Register +#define AT91C_ADC_TNCR (0xFFFD811C) // (PDC_ADC) Transmit Next Counter Register +#define AT91C_ADC_RNCR (0xFFFD8114) // (PDC_ADC) Receive Next Counter Register +#define AT91C_ADC_TCR (0xFFFD810C) // (PDC_ADC) Transmit Counter Register +#define AT91C_ADC_RCR (0xFFFD8104) // (PDC_ADC) Receive Counter Register +// ========== Register definition for ADC peripheral ========== +#define AT91C_ADC_IMR (0xFFFD802C) // (ADC) ADC Interrupt Mask Register +#define AT91C_ADC_CDR4 (0xFFFD8040) // (ADC) ADC Channel Data Register 4 +#define AT91C_ADC_CDR2 (0xFFFD8038) // (ADC) ADC Channel Data Register 2 +#define AT91C_ADC_CDR0 (0xFFFD8030) // (ADC) ADC Channel Data Register 0 +#define AT91C_ADC_CDR7 (0xFFFD804C) // (ADC) ADC Channel Data Register 7 +#define AT91C_ADC_CDR1 (0xFFFD8034) // (ADC) ADC Channel Data Register 1 +#define AT91C_ADC_CDR3 (0xFFFD803C) // (ADC) ADC Channel Data Register 3 +#define AT91C_ADC_CDR5 (0xFFFD8044) // (ADC) ADC Channel Data Register 5 +#define AT91C_ADC_MR (0xFFFD8004) // (ADC) ADC Mode Register +#define AT91C_ADC_CDR6 (0xFFFD8048) // (ADC) ADC Channel Data Register 6 +#define AT91C_ADC_CR (0xFFFD8000) // (ADC) ADC Control Register +#define AT91C_ADC_CHER (0xFFFD8010) // (ADC) ADC Channel Enable Register +#define AT91C_ADC_CHSR (0xFFFD8018) // (ADC) ADC Channel Status Register +#define AT91C_ADC_IER (0xFFFD8024) // (ADC) ADC Interrupt Enable Register +#define AT91C_ADC_SR (0xFFFD801C) // (ADC) ADC Status Register +#define AT91C_ADC_CHDR (0xFFFD8014) // (ADC) ADC Channel Disable Register +#define AT91C_ADC_IDR (0xFFFD8028) // (ADC) ADC Interrupt Disable Register +#define AT91C_ADC_LCDR (0xFFFD8020) // (ADC) ADC Last Converted Data Register + +// ***************************************************************************** +// PIO DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** +#define AT91C_PIO_PA0 (1 << 0) // Pin Controlled by PA0 +#define AT91C_PA0_RXD0 (AT91C_PIO_PA0) // USART 0 Receive Data +#define AT91C_PIO_PA1 (1 << 1) // Pin Controlled by PA1 +#define AT91C_PA1_TXD0 (AT91C_PIO_PA1) // USART 0 Transmit Data +#define AT91C_PIO_PA10 (1 << 10) // Pin Controlled by PA10 +#define AT91C_PA10_TWD (AT91C_PIO_PA10) // TWI Two-wire Serial Data +#define AT91C_PIO_PA11 (1 << 11) // Pin Controlled by PA11 +#define AT91C_PA11_TWCK (AT91C_PIO_PA11) // TWI Two-wire Serial Clock +#define AT91C_PIO_PA12 (1 << 12) // Pin Controlled by PA12 +#define AT91C_PA12_SPI0_NPCS0 (AT91C_PIO_PA12) // SPI 0 Peripheral Chip Select 0 +#define AT91C_PIO_PA13 (1 << 13) // Pin Controlled by PA13 +#define AT91C_PA13_SPI0_NPCS1 (AT91C_PIO_PA13) // SPI 0 Peripheral Chip Select 1 +#define AT91C_PA13_PCK1 (AT91C_PIO_PA13) // PMC Programmable Clock Output 1 +#define AT91C_PIO_PA14 (1 << 14) // Pin Controlled by PA14 +#define AT91C_PA14_SPI0_NPCS2 (AT91C_PIO_PA14) // SPI 0 Peripheral Chip Select 2 +#define AT91C_PA14_IRQ1 (AT91C_PIO_PA14) // External Interrupt 1 +#define AT91C_PIO_PA15 (1 << 15) // Pin Controlled by PA15 +#define AT91C_PA15_SPI0_NPCS3 (AT91C_PIO_PA15) // SPI 0 Peripheral Chip Select 3 +#define AT91C_PA15_TCLK2 (AT91C_PIO_PA15) // Timer Counter 2 external clock input +#define AT91C_PIO_PA16 (1 << 16) // Pin Controlled by PA16 +#define AT91C_PA16_SPI0_MISO (AT91C_PIO_PA16) // SPI 0 Master In Slave +#define AT91C_PIO_PA17 (1 << 17) // Pin Controlled by PA17 +#define AT91C_PA17_SPI0_MOSI (AT91C_PIO_PA17) // SPI 0 Master Out Slave +#define AT91C_PIO_PA18 (1 << 18) // Pin Controlled by PA18 +#define AT91C_PA18_SPI0_SPCK (AT91C_PIO_PA18) // SPI 0 Serial Clock +#define AT91C_PIO_PA19 (1 << 19) // Pin Controlled by PA19 +#define AT91C_PA19_CANRX (AT91C_PIO_PA19) // CAN Receive +#define AT91C_PIO_PA2 (1 << 2) // Pin Controlled by PA2 +#define AT91C_PA2_SCK0 (AT91C_PIO_PA2) // USART 0 Serial Clock +#define AT91C_PA2_SPI1_NPCS1 (AT91C_PIO_PA2) // SPI 1 Peripheral Chip Select 1 +#define AT91C_PIO_PA20 (1 << 20) // Pin Controlled by PA20 +#define AT91C_PA20_CANTX (AT91C_PIO_PA20) // CAN Transmit +#define AT91C_PIO_PA21 (1 << 21) // Pin Controlled by PA21 +#define AT91C_PA21_TF (AT91C_PIO_PA21) // SSC Transmit Frame Sync +#define AT91C_PA21_SPI1_NPCS0 (AT91C_PIO_PA21) // SPI 1 Peripheral Chip Select 0 +#define AT91C_PIO_PA22 (1 << 22) // Pin Controlled by PA22 +#define AT91C_PA22_TK (AT91C_PIO_PA22) // SSC Transmit Clock +#define AT91C_PA22_SPI1_SPCK (AT91C_PIO_PA22) // SPI 1 Serial Clock +#define AT91C_PIO_PA23 (1 << 23) // Pin Controlled by PA23 +#define AT91C_PA23_TD (AT91C_PIO_PA23) // SSC Transmit data +#define AT91C_PA23_SPI1_MOSI (AT91C_PIO_PA23) // SPI 1 Master Out Slave +#define AT91C_PIO_PA24 (1 << 24) // Pin Controlled by PA24 +#define AT91C_PA24_RD (AT91C_PIO_PA24) // SSC Receive Data +#define AT91C_PA24_SPI1_MISO (AT91C_PIO_PA24) // SPI 1 Master In Slave +#define AT91C_PIO_PA25 (1 << 25) // Pin Controlled by PA25 +#define AT91C_PA25_RK (AT91C_PIO_PA25) // SSC Receive Clock +#define AT91C_PA25_SPI1_NPCS1 (AT91C_PIO_PA25) // SPI 1 Peripheral Chip Select 1 +#define AT91C_PIO_PA26 (1 << 26) // Pin Controlled by PA26 +#define AT91C_PA26_RF (AT91C_PIO_PA26) // SSC Receive Frame Sync +#define AT91C_PA26_SPI1_NPCS2 (AT91C_PIO_PA26) // SPI 1 Peripheral Chip Select 2 +#define AT91C_PIO_PA27 (1 << 27) // Pin Controlled by PA27 +#define AT91C_PA27_DRXD (AT91C_PIO_PA27) // DBGU Debug Receive Data +#define AT91C_PA27_PCK3 (AT91C_PIO_PA27) // PMC Programmable Clock Output 3 +#define AT91C_PIO_PA28 (1 << 28) // Pin Controlled by PA28 +#define AT91C_PA28_DTXD (AT91C_PIO_PA28) // DBGU Debug Transmit Data +#define AT91C_PIO_PA29 (1 << 29) // Pin Controlled by PA29 +#define AT91C_PA29_FIQ (AT91C_PIO_PA29) // AIC Fast Interrupt Input +#define AT91C_PA29_SPI1_NPCS3 (AT91C_PIO_PA29) // SPI 1 Peripheral Chip Select 3 +#define AT91C_PIO_PA3 (1 << 3) // Pin Controlled by PA3 +#define AT91C_PA3_RTS0 (AT91C_PIO_PA3) // USART 0 Ready To Send +#define AT91C_PA3_SPI1_NPCS2 (AT91C_PIO_PA3) // SPI 1 Peripheral Chip Select 2 +#define AT91C_PIO_PA30 (1 << 30) // Pin Controlled by PA30 +#define AT91C_PA30_IRQ0 (AT91C_PIO_PA30) // External Interrupt 0 +#define AT91C_PA30_PCK2 (AT91C_PIO_PA30) // PMC Programmable Clock Output 2 +#define AT91C_PIO_PA4 (1 << 4) // Pin Controlled by PA4 +#define AT91C_PA4_CTS0 (AT91C_PIO_PA4) // USART 0 Clear To Send +#define AT91C_PA4_SPI1_NPCS3 (AT91C_PIO_PA4) // SPI 1 Peripheral Chip Select 3 +#define AT91C_PIO_PA5 (1 << 5) // Pin Controlled by PA5 +#define AT91C_PA5_RXD1 (AT91C_PIO_PA5) // USART 1 Receive Data +#define AT91C_PIO_PA6 (1 << 6) // Pin Controlled by PA6 +#define AT91C_PA6_TXD1 (AT91C_PIO_PA6) // USART 1 Transmit Data +#define AT91C_PIO_PA7 (1 << 7) // Pin Controlled by PA7 +#define AT91C_PA7_SCK1 (AT91C_PIO_PA7) // USART 1 Serial Clock +#define AT91C_PA7_SPI0_NPCS1 (AT91C_PIO_PA7) // SPI 0 Peripheral Chip Select 1 +#define AT91C_PIO_PA8 (1 << 8) // Pin Controlled by PA8 +#define AT91C_PA8_RTS1 (AT91C_PIO_PA8) // USART 1 Ready To Send +#define AT91C_PA8_SPI0_NPCS2 (AT91C_PIO_PA8) // SPI 0 Peripheral Chip Select 2 +#define AT91C_PIO_PA9 (1 << 9) // Pin Controlled by PA9 +#define AT91C_PA9_CTS1 (AT91C_PIO_PA9) // USART 1 Clear To Send +#define AT91C_PA9_SPI0_NPCS3 (AT91C_PIO_PA9) // SPI 0 Peripheral Chip Select 3 +#define AT91C_PIO_PB0 (1 << 0) // Pin Controlled by PB0 +#define AT91C_PB0_ETXCK_EREFCK (AT91C_PIO_PB0) // Ethernet MAC Transmit Clock/Reference Clock +#define AT91C_PB0_PCK0 (AT91C_PIO_PB0) // PMC Programmable Clock Output 0 +#define AT91C_PIO_PB1 (1 << 1) // Pin Controlled by PB1 +#define AT91C_PB1_ETXEN (AT91C_PIO_PB1) // Ethernet MAC Transmit Enable +#define AT91C_PIO_PB10 (1 << 10) // Pin Controlled by PB10 +#define AT91C_PB10_ETX2 (AT91C_PIO_PB10) // Ethernet MAC Transmit Data 2 +#define AT91C_PB10_SPI1_NPCS1 (AT91C_PIO_PB10) // SPI 1 Peripheral Chip Select 1 +#define AT91C_PIO_PB11 (1 << 11) // Pin Controlled by PB11 +#define AT91C_PB11_ETX3 (AT91C_PIO_PB11) // Ethernet MAC Transmit Data 3 +#define AT91C_PB11_SPI1_NPCS2 (AT91C_PIO_PB11) // SPI 1 Peripheral Chip Select 2 +#define AT91C_PIO_PB12 (1 << 12) // Pin Controlled by PB12 +#define AT91C_PB12_ETXER (AT91C_PIO_PB12) // Ethernet MAC Transmikt Coding Error +#define AT91C_PB12_TCLK0 (AT91C_PIO_PB12) // Timer Counter 0 external clock input +#define AT91C_PIO_PB13 (1 << 13) // Pin Controlled by PB13 +#define AT91C_PB13_ERX2 (AT91C_PIO_PB13) // Ethernet MAC Receive Data 2 +#define AT91C_PB13_SPI0_NPCS1 (AT91C_PIO_PB13) // SPI 0 Peripheral Chip Select 1 +#define AT91C_PIO_PB14 (1 << 14) // Pin Controlled by PB14 +#define AT91C_PB14_ERX3 (AT91C_PIO_PB14) // Ethernet MAC Receive Data 3 +#define AT91C_PB14_SPI0_NPCS2 (AT91C_PIO_PB14) // SPI 0 Peripheral Chip Select 2 +#define AT91C_PIO_PB15 (1 << 15) // Pin Controlled by PB15 +#define AT91C_PB15_ERXDV_ECRSDV (AT91C_PIO_PB15) // Ethernet MAC Receive Data Valid +#define AT91C_PIO_PB16 (1 << 16) // Pin Controlled by PB16 +#define AT91C_PB16_ECOL (AT91C_PIO_PB16) // Ethernet MAC Collision Detected +#define AT91C_PB16_SPI1_NPCS3 (AT91C_PIO_PB16) // SPI 1 Peripheral Chip Select 3 +#define AT91C_PIO_PB17 (1 << 17) // Pin Controlled by PB17 +#define AT91C_PB17_ERXCK (AT91C_PIO_PB17) // Ethernet MAC Receive Clock +#define AT91C_PB17_SPI0_NPCS3 (AT91C_PIO_PB17) // SPI 0 Peripheral Chip Select 3 +#define AT91C_PIO_PB18 (1 << 18) // Pin Controlled by PB18 +#define AT91C_PB18_EF100 (AT91C_PIO_PB18) // Ethernet MAC Force 100 Mbits/sec +#define AT91C_PB18_ADTRG (AT91C_PIO_PB18) // ADC External Trigger +#define AT91C_PIO_PB19 (1 << 19) // Pin Controlled by PB19 +#define AT91C_PB19_PWM0 (AT91C_PIO_PB19) // PWM Channel 0 +#define AT91C_PB19_TCLK1 (AT91C_PIO_PB19) // Timer Counter 1 external clock input +#define AT91C_PIO_PB2 (1 << 2) // Pin Controlled by PB2 +#define AT91C_PB2_ETX0 (AT91C_PIO_PB2) // Ethernet MAC Transmit Data 0 +#define AT91C_PIO_PB20 (1 << 20) // Pin Controlled by PB20 +#define AT91C_PB20_PWM1 (AT91C_PIO_PB20) // PWM Channel 1 +#define AT91C_PB20_PCK0 (AT91C_PIO_PB20) // PMC Programmable Clock Output 0 +#define AT91C_PIO_PB21 (1 << 21) // Pin Controlled by PB21 +#define AT91C_PB21_PWM2 (AT91C_PIO_PB21) // PWM Channel 2 +#define AT91C_PB21_PCK1 (AT91C_PIO_PB21) // PMC Programmable Clock Output 1 +#define AT91C_PIO_PB22 (1 << 22) // Pin Controlled by PB22 +#define AT91C_PB22_PWM3 (AT91C_PIO_PB22) // PWM Channel 3 +#define AT91C_PB22_PCK2 (AT91C_PIO_PB22) // PMC Programmable Clock Output 2 +#define AT91C_PIO_PB23 (1 << 23) // Pin Controlled by PB23 +#define AT91C_PB23_TIOA0 (AT91C_PIO_PB23) // Timer Counter 0 Multipurpose Timer I/O Pin A +#define AT91C_PB23_DCD1 (AT91C_PIO_PB23) // USART 1 Data Carrier Detect +#define AT91C_PIO_PB24 (1 << 24) // Pin Controlled by PB24 +#define AT91C_PB24_TIOB0 (AT91C_PIO_PB24) // Timer Counter 0 Multipurpose Timer I/O Pin B +#define AT91C_PB24_DSR1 (AT91C_PIO_PB24) // USART 1 Data Set ready +#define AT91C_PIO_PB25 (1 << 25) // Pin Controlled by PB25 +#define AT91C_PB25_TIOA1 (AT91C_PIO_PB25) // Timer Counter 1 Multipurpose Timer I/O Pin A +#define AT91C_PB25_DTR1 (AT91C_PIO_PB25) // USART 1 Data Terminal ready +#define AT91C_PIO_PB26 (1 << 26) // Pin Controlled by PB26 +#define AT91C_PB26_TIOB1 (AT91C_PIO_PB26) // Timer Counter 1 Multipurpose Timer I/O Pin B +#define AT91C_PB26_RI1 (AT91C_PIO_PB26) // USART 1 Ring Indicator +#define AT91C_PIO_PB27 (1 << 27) // Pin Controlled by PB27 +#define AT91C_PB27_TIOA2 (AT91C_PIO_PB27) // Timer Counter 2 Multipurpose Timer I/O Pin A +#define AT91C_PB27_PWM0 (AT91C_PIO_PB27) // PWM Channel 0 +#define AT91C_PIO_PB28 (1 << 28) // Pin Controlled by PB28 +#define AT91C_PB28_TIOB2 (AT91C_PIO_PB28) // Timer Counter 2 Multipurpose Timer I/O Pin B +#define AT91C_PB28_PWM1 (AT91C_PIO_PB28) // PWM Channel 1 +#define AT91C_PIO_PB29 (1 << 29) // Pin Controlled by PB29 +#define AT91C_PB29_PCK1 (AT91C_PIO_PB29) // PMC Programmable Clock Output 1 +#define AT91C_PB29_PWM2 (AT91C_PIO_PB29) // PWM Channel 2 +#define AT91C_PIO_PB3 (1 << 3) // Pin Controlled by PB3 +#define AT91C_PB3_ETX1 (AT91C_PIO_PB3) // Ethernet MAC Transmit Data 1 +#define AT91C_PIO_PB30 (1 << 30) // Pin Controlled by PB30 +#define AT91C_PB30_PCK2 (AT91C_PIO_PB30) // PMC Programmable Clock Output 2 +#define AT91C_PB30_PWM3 (AT91C_PIO_PB30) // PWM Channel 3 +#define AT91C_PIO_PB4 (1 << 4) // Pin Controlled by PB4 +#define AT91C_PB4_ECRS (AT91C_PIO_PB4) // Ethernet MAC Carrier Sense/Carrier Sense and Data Valid +#define AT91C_PIO_PB5 (1 << 5) // Pin Controlled by PB5 +#define AT91C_PB5_ERX0 (AT91C_PIO_PB5) // Ethernet MAC Receive Data 0 +#define AT91C_PIO_PB6 (1 << 6) // Pin Controlled by PB6 +#define AT91C_PB6_ERX1 (AT91C_PIO_PB6) // Ethernet MAC Receive Data 1 +#define AT91C_PIO_PB7 (1 << 7) // Pin Controlled by PB7 +#define AT91C_PB7_ERXER (AT91C_PIO_PB7) // Ethernet MAC Receive Error +#define AT91C_PIO_PB8 (1 << 8) // Pin Controlled by PB8 +#define AT91C_PB8_EMDC (AT91C_PIO_PB8) // Ethernet MAC Management Data Clock +#define AT91C_PIO_PB9 (1 << 9) // Pin Controlled by PB9 +#define AT91C_PB9_EMDIO (AT91C_PIO_PB9) // Ethernet MAC Management Data Input/Output + +// ***************************************************************************** +// PERIPHERAL ID DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** +#define AT91C_ID_FIQ ( 0) // Advanced Interrupt Controller (FIQ) +#define AT91C_ID_SYS ( 1) // System Peripheral +#define AT91C_ID_PIOA ( 2) // Parallel IO Controller A +#define AT91C_ID_PIOB ( 3) // Parallel IO Controller B +#define AT91C_ID_SPI0 ( 4) // Serial Peripheral Interface 0 +#define AT91C_ID_SPI1 ( 5) // Serial Peripheral Interface 1 +#define AT91C_ID_US0 ( 6) // USART 0 +#define AT91C_ID_US1 ( 7) // USART 1 +#define AT91C_ID_SSC ( 8) // Serial Synchronous Controller +#define AT91C_ID_TWI ( 9) // Two-Wire Interface +#define AT91C_ID_PWMC (10) // PWM Controller +#define AT91C_ID_UDP (11) // USB Device Port +#define AT91C_ID_TC0 (12) // Timer Counter 0 +#define AT91C_ID_TC1 (13) // Timer Counter 1 +#define AT91C_ID_TC2 (14) // Timer Counter 2 +#define AT91C_ID_CAN (15) // Control Area Network Controller +#define AT91C_ID_EMAC (16) // Ethernet MAC +#define AT91C_ID_ADC (17) // Analog-to-Digital Converter +#define AT91C_ID_18_Reserved (18) // Reserved +#define AT91C_ID_19_Reserved (19) // Reserved +#define AT91C_ID_20_Reserved (20) // Reserved +#define AT91C_ID_21_Reserved (21) // Reserved +#define AT91C_ID_22_Reserved (22) // Reserved +#define AT91C_ID_23_Reserved (23) // Reserved +#define AT91C_ID_24_Reserved (24) // Reserved +#define AT91C_ID_25_Reserved (25) // Reserved +#define AT91C_ID_26_Reserved (26) // Reserved +#define AT91C_ID_27_Reserved (27) // Reserved +#define AT91C_ID_28_Reserved (28) // Reserved +#define AT91C_ID_29_Reserved (29) // Reserved +#define AT91C_ID_IRQ0 (30) // Advanced Interrupt Controller (IRQ0) +#define AT91C_ID_IRQ1 (31) // Advanced Interrupt Controller (IRQ1) +#define AT91C_ALL_INT (0xC003FFFF) // ALL VALID INTERRUPTS + +// ***************************************************************************** +// BASE ADDRESS DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** +#define AT91C_BASE_SYS (0xFFFFF000) // (SYS) Base Address +#define AT91C_BASE_AIC (0xFFFFF000) // (AIC) Base Address +#define AT91C_BASE_PDC_DBGU (0xFFFFF300) // (PDC_DBGU) Base Address +#define AT91C_BASE_DBGU (0xFFFFF200) // (DBGU) Base Address +#define AT91C_BASE_PIOA (0xFFFFF400) // (PIOA) Base Address +#define AT91C_BASE_PIOB (0xFFFFF600) // (PIOB) Base Address +#define AT91C_BASE_CKGR (0xFFFFFC20) // (CKGR) Base Address +#define AT91C_BASE_PMC (0xFFFFFC00) // (PMC) Base Address +#define AT91C_BASE_RSTC (0xFFFFFD00) // (RSTC) Base Address +#define AT91C_BASE_RTTC (0xFFFFFD20) // (RTTC) Base Address +#define AT91C_BASE_PITC (0xFFFFFD30) // (PITC) Base Address +#define AT91C_BASE_WDTC (0xFFFFFD40) // (WDTC) Base Address +#define AT91C_BASE_VREG (0xFFFFFD60) // (VREG) Base Address +#define AT91C_BASE_MC (0xFFFFFF00) // (MC) Base Address +#define AT91C_BASE_PDC_SPI1 (0xFFFE4100) // (PDC_SPI1) Base Address +#define AT91C_BASE_SPI1 (0xFFFE4000) // (SPI1) Base Address +#define AT91C_BASE_PDC_SPI0 (0xFFFE0100) // (PDC_SPI0) Base Address +#define AT91C_BASE_SPI0 (0xFFFE0000) // (SPI0) Base Address +#define AT91C_BASE_PDC_US1 (0xFFFC4100) // (PDC_US1) Base Address +#define AT91C_BASE_US1 (0xFFFC4000) // (US1) Base Address +#define AT91C_BASE_PDC_US0 (0xFFFC0100) // (PDC_US0) Base Address +#define AT91C_BASE_US0 (0xFFFC0000) // (US0) Base Address +#define AT91C_BASE_PDC_SSC (0xFFFD4100) // (PDC_SSC) Base Address +#define AT91C_BASE_SSC (0xFFFD4000) // (SSC) Base Address +#define AT91C_BASE_TWI (0xFFFB8000) // (TWI) Base Address +#define AT91C_BASE_PWMC_CH3 (0xFFFCC260) // (PWMC_CH3) Base Address +#define AT91C_BASE_PWMC_CH2 (0xFFFCC240) // (PWMC_CH2) Base Address +#define AT91C_BASE_PWMC_CH1 (0xFFFCC220) // (PWMC_CH1) Base Address +#define AT91C_BASE_PWMC_CH0 (0xFFFCC200) // (PWMC_CH0) Base Address +#define AT91C_BASE_PWMC (0xFFFCC000) // (PWMC) Base Address +#define AT91C_BASE_UDP (0xFFFB0000) // (UDP) Base Address +#define AT91C_BASE_TC0 (0xFFFA0000) // (TC0) Base Address +#define AT91C_BASE_TC1 (0xFFFA0040) // (TC1) Base Address +#define AT91C_BASE_TC2 (0xFFFA0080) // (TC2) Base Address +#define AT91C_BASE_TCB (0xFFFA0000) // (TCB) Base Address +#define AT91C_BASE_CAN_MB0 (0xFFFD0200) // (CAN_MB0) Base Address +#define AT91C_BASE_CAN_MB1 (0xFFFD0220) // (CAN_MB1) Base Address +#define AT91C_BASE_CAN_MB2 (0xFFFD0240) // (CAN_MB2) Base Address +#define AT91C_BASE_CAN_MB3 (0xFFFD0260) // (CAN_MB3) Base Address +#define AT91C_BASE_CAN_MB4 (0xFFFD0280) // (CAN_MB4) Base Address +#define AT91C_BASE_CAN_MB5 (0xFFFD02A0) // (CAN_MB5) Base Address +#define AT91C_BASE_CAN_MB6 (0xFFFD02C0) // (CAN_MB6) Base Address +#define AT91C_BASE_CAN_MB7 (0xFFFD02E0) // (CAN_MB7) Base Address +#define AT91C_BASE_CAN (0xFFFD0000) // (CAN) Base Address +#define AT91C_BASE_EMAC (0xFFFDC000) // (EMAC) Base Address +#define AT91C_BASE_PDC_ADC (0xFFFD8100) // (PDC_ADC) Base Address +#define AT91C_BASE_ADC (0xFFFD8000) // (ADC) Base Address + +// ***************************************************************************** +// MEMORY MAPPING DEFINITIONS FOR AT91SAM7X256 +// ***************************************************************************** +// ISRAM +#define AT91C_ISRAM (0x00200000) // Internal SRAM base address +#define AT91C_ISRAM_SIZE (0x00010000) // Internal SRAM size in byte (64 Kbytes) +// IFLASH +#define AT91C_IFLASH (0x00100000) // Internal FLASH base address +#define AT91C_IFLASH_SIZE (0x00040000) // Internal FLASH size in byte (256 Kbytes) +#define AT91C_IFLASH_PAGE_SIZE (256) // Internal FLASH Page Size: 256 bytes +#define AT91C_IFLASH_LOCK_REGION_SIZE (16384) // Internal FLASH Lock Region Size: 16 Kbytes +#define AT91C_IFLASH_NB_OF_PAGES (1024) // Internal FLASH Number of Pages: 1024 bytes +#define AT91C_IFLASH_NB_OF_LOCK_BITS (16) // Internal FLASH Number of Lock Bits: 16 bytes + + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/incIAR/lib_AT91SAM7X256.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/incIAR/lib_AT91SAM7X256.h new file mode 100644 index 0000000..8bd8f04 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/incIAR/lib_AT91SAM7X256.h @@ -0,0 +1,4211 @@ +//* ---------------------------------------------------------------------------- +//* ATMEL Microcontroller Software Support - ROUSSET - +//* ---------------------------------------------------------------------------- +//* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +//* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +//* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +//* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +//* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +//* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +//* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +//* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +//* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +//* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +//* ---------------------------------------------------------------------------- +//* File Name : lib_AT91SAM7X256.h +//* Object : AT91SAM7X256 inlined functions +//* Generated : AT91 SW Application Group 01/16/2006 (16:36:21) +//* +//* CVS Reference : /lib_MC_SAM7X.h/1.1/Thu Mar 25 15:19:14 2004// +//* CVS Reference : /lib_pdc.h/1.2/Tue Jul 2 13:29:40 2002// +//* CVS Reference : /lib_dbgu.h/1.1/Thu Aug 25 12:56:22 2005// +//* CVS Reference : /lib_VREG_6085B.h/1.1/Tue Feb 1 16:20:47 2005// +//* CVS Reference : /lib_ssc.h/1.4/Fri Jan 31 12:19:20 2003// +//* CVS Reference : /lib_spi2.h/1.2/Tue Aug 23 15:37:28 2005// +//* CVS Reference : /lib_PWM_SAM.h/1.3/Thu Jan 22 10:10:50 2004// +//* CVS Reference : /lib_tc_1753b.h/1.1/Fri Jan 31 12:20:02 2003// +//* CVS Reference : /lib_pitc_6079A.h/1.2/Tue Nov 9 14:43:56 2004// +//* CVS Reference : /lib_adc.h/1.6/Fri Oct 17 09:12:38 2003// +//* CVS Reference : /lib_pmc_SAM7X.h/1.5/Fri Nov 4 09:41:32 2005// +//* CVS Reference : /lib_rstc_6098A.h/1.1/Wed Oct 6 10:39:20 2004// +//* CVS Reference : /lib_rttc_6081A.h/1.1/Wed Oct 6 10:39:38 2004// +//* CVS Reference : /lib_pio.h/1.3/Fri Jan 31 12:18:56 2003// +//* CVS Reference : /lib_twi.h/1.3/Mon Jul 19 14:27:58 2004// +//* CVS Reference : /lib_wdtc_6080A.h/1.1/Wed Oct 6 10:38:30 2004// +//* CVS Reference : /lib_usart.h/1.5/Thu Nov 21 16:01:54 2002// +//* CVS Reference : /lib_udp.h/1.5/Tue Aug 30 12:13:47 2005// +//* CVS Reference : /lib_aic_6075b.h/1.2/Thu Jul 7 07:48:22 2005// +//* CVS Reference : /lib_can_AT91.h/1.5/Tue Aug 23 15:37:07 2005// +//* ---------------------------------------------------------------------------- + +#ifndef lib_AT91SAM7X256_H +#define lib_AT91SAM7X256_H + +/* ***************************************************************************** + SOFTWARE API FOR AIC + ***************************************************************************** */ +#define AT91C_AIC_BRANCH_OPCODE ((void (*) ()) 0xE51FFF20) // ldr, pc, [pc, #-&F20] + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_ConfigureIt +//* \brief Interrupt Handler Initialization +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_AIC_ConfigureIt ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id, // \arg interrupt number to initialize + unsigned int priority, // \arg priority to give to the interrupt + unsigned int src_type, // \arg activation and sense of activation + void (*newHandler) () ) // \arg address of the interrupt handler +{ + unsigned int oldHandler; + unsigned int mask ; + + oldHandler = pAic->AIC_SVR[irq_id]; + + mask = 0x1 << irq_id ; + //* Disable the interrupt on the interrupt controller + pAic->AIC_IDCR = mask ; + //* Save the interrupt handler routine pointer and the interrupt priority + pAic->AIC_SVR[irq_id] = (unsigned int) newHandler ; + //* Store the Source Mode Register + pAic->AIC_SMR[irq_id] = src_type | priority ; + //* Clear the interrupt on the interrupt controller + pAic->AIC_ICCR = mask ; + + return oldHandler; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_EnableIt +//* \brief Enable corresponding IT number +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_EnableIt ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id ) // \arg interrupt number to initialize +{ + //* Enable the interrupt on the interrupt controller + pAic->AIC_IECR = 0x1 << irq_id ; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_DisableIt +//* \brief Disable corresponding IT number +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_DisableIt ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id ) // \arg interrupt number to initialize +{ + unsigned int mask = 0x1 << irq_id; + //* Disable the interrupt on the interrupt controller + pAic->AIC_IDCR = mask ; + //* Clear the interrupt on the Interrupt Controller ( if one is pending ) + pAic->AIC_ICCR = mask ; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_ClearIt +//* \brief Clear corresponding IT number +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_ClearIt ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id) // \arg interrupt number to initialize +{ + //* Clear the interrupt on the Interrupt Controller ( if one is pending ) + pAic->AIC_ICCR = (0x1 << irq_id); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_AcknowledgeIt +//* \brief Acknowledge corresponding IT number +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_AcknowledgeIt ( + AT91PS_AIC pAic) // \arg pointer to the AIC registers +{ + pAic->AIC_EOICR = pAic->AIC_EOICR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_SetExceptionVector +//* \brief Configure vector handler +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_AIC_SetExceptionVector ( + unsigned int *pVector, // \arg pointer to the AIC registers + void (*Handler) () ) // \arg Interrupt Handler +{ + unsigned int oldVector = *pVector; + + if ((unsigned int) Handler == (unsigned int) AT91C_AIC_BRANCH_OPCODE) + *pVector = (unsigned int) AT91C_AIC_BRANCH_OPCODE; + else + *pVector = (((((unsigned int) Handler) - ((unsigned int) pVector) - 0x8) >> 2) & 0x00FFFFFF) | 0xEA000000; + + return oldVector; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_Trig +//* \brief Trig an IT +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_Trig ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id) // \arg interrupt number +{ + pAic->AIC_ISCR = (0x1 << irq_id) ; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_IsActive +//* \brief Test if an IT is active +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_AIC_IsActive ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id) // \arg Interrupt Number +{ + return (pAic->AIC_ISR & (0x1 << irq_id)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_IsPending +//* \brief Test if an IT is pending +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_AIC_IsPending ( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + unsigned int irq_id) // \arg Interrupt Number +{ + return (pAic->AIC_IPR & (0x1 << irq_id)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_Open +//* \brief Set exception vectors and AIC registers to default values +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_Open( + AT91PS_AIC pAic, // \arg pointer to the AIC registers + void (*IrqHandler) (), // \arg Default IRQ vector exception + void (*FiqHandler) (), // \arg Default FIQ vector exception + void (*DefaultHandler) (), // \arg Default Handler set in ISR + void (*SpuriousHandler) (), // \arg Default Spurious Handler + unsigned int protectMode) // \arg Debug Control Register +{ + int i; + + // Disable all interrupts and set IVR to the default handler + for (i = 0; i < 32; ++i) { + AT91F_AIC_DisableIt(pAic, i); + AT91F_AIC_ConfigureIt(pAic, i, AT91C_AIC_PRIOR_LOWEST, AT91C_AIC_SRCTYPE_HIGH_LEVEL, DefaultHandler); + } + + // Set the IRQ exception vector + AT91F_AIC_SetExceptionVector((unsigned int *) 0x18, IrqHandler); + // Set the Fast Interrupt exception vector + AT91F_AIC_SetExceptionVector((unsigned int *) 0x1C, FiqHandler); + + pAic->AIC_SPU = (unsigned int) SpuriousHandler; + pAic->AIC_DCR = protectMode; +} +/* ***************************************************************************** + SOFTWARE API FOR PDC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_SetNextRx +//* \brief Set the next receive transfer descriptor +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_SetNextRx ( + AT91PS_PDC pPDC, // \arg pointer to a PDC controller + char *address, // \arg address to the next bloc to be received + unsigned int bytes) // \arg number of bytes to be received +{ + pPDC->PDC_RNPR = (unsigned int) address; + pPDC->PDC_RNCR = bytes; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_SetNextTx +//* \brief Set the next transmit transfer descriptor +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_SetNextTx ( + AT91PS_PDC pPDC, // \arg pointer to a PDC controller + char *address, // \arg address to the next bloc to be transmitted + unsigned int bytes) // \arg number of bytes to be transmitted +{ + pPDC->PDC_TNPR = (unsigned int) address; + pPDC->PDC_TNCR = bytes; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_SetRx +//* \brief Set the receive transfer descriptor +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_SetRx ( + AT91PS_PDC pPDC, // \arg pointer to a PDC controller + char *address, // \arg address to the next bloc to be received + unsigned int bytes) // \arg number of bytes to be received +{ + pPDC->PDC_RPR = (unsigned int) address; + pPDC->PDC_RCR = bytes; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_SetTx +//* \brief Set the transmit transfer descriptor +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_SetTx ( + AT91PS_PDC pPDC, // \arg pointer to a PDC controller + char *address, // \arg address to the next bloc to be transmitted + unsigned int bytes) // \arg number of bytes to be transmitted +{ + pPDC->PDC_TPR = (unsigned int) address; + pPDC->PDC_TCR = bytes; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_EnableTx +//* \brief Enable transmit +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_EnableTx ( + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + pPDC->PDC_PTCR = AT91C_PDC_TXTEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_EnableRx +//* \brief Enable receive +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_EnableRx ( + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + pPDC->PDC_PTCR = AT91C_PDC_RXTEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_DisableTx +//* \brief Disable transmit +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_DisableTx ( + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + pPDC->PDC_PTCR = AT91C_PDC_TXTDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_DisableRx +//* \brief Disable receive +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_DisableRx ( + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + pPDC->PDC_PTCR = AT91C_PDC_RXTDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_IsTxEmpty +//* \brief Test if the current transfer descriptor has been sent +//*---------------------------------------------------------------------------- +__inline int AT91F_PDC_IsTxEmpty ( // \return return 1 if transfer is complete + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + return !(pPDC->PDC_TCR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_IsNextTxEmpty +//* \brief Test if the next transfer descriptor has been moved to the current td +//*---------------------------------------------------------------------------- +__inline int AT91F_PDC_IsNextTxEmpty ( // \return return 1 if transfer is complete + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + return !(pPDC->PDC_TNCR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_IsRxEmpty +//* \brief Test if the current transfer descriptor has been filled +//*---------------------------------------------------------------------------- +__inline int AT91F_PDC_IsRxEmpty ( // \return return 1 if transfer is complete + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + return !(pPDC->PDC_RCR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_IsNextRxEmpty +//* \brief Test if the next transfer descriptor has been moved to the current td +//*---------------------------------------------------------------------------- +__inline int AT91F_PDC_IsNextRxEmpty ( // \return return 1 if transfer is complete + AT91PS_PDC pPDC ) // \arg pointer to a PDC controller +{ + return !(pPDC->PDC_RNCR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_Open +//* \brief Open PDC: disable TX and RX reset transfer descriptors, re-enable RX and TX +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_Open ( + AT91PS_PDC pPDC) // \arg pointer to a PDC controller +{ + //* Disable the RX and TX PDC transfer requests + AT91F_PDC_DisableRx(pPDC); + AT91F_PDC_DisableTx(pPDC); + + //* Reset all Counter register Next buffer first + AT91F_PDC_SetNextTx(pPDC, (char *) 0, 0); + AT91F_PDC_SetNextRx(pPDC, (char *) 0, 0); + AT91F_PDC_SetTx(pPDC, (char *) 0, 0); + AT91F_PDC_SetRx(pPDC, (char *) 0, 0); + + //* Enable the RX and TX PDC transfer requests + AT91F_PDC_EnableRx(pPDC); + AT91F_PDC_EnableTx(pPDC); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_Close +//* \brief Close PDC: disable TX and RX reset transfer descriptors +//*---------------------------------------------------------------------------- +__inline void AT91F_PDC_Close ( + AT91PS_PDC pPDC) // \arg pointer to a PDC controller +{ + //* Disable the RX and TX PDC transfer requests + AT91F_PDC_DisableRx(pPDC); + AT91F_PDC_DisableTx(pPDC); + + //* Reset all Counter register Next buffer first + AT91F_PDC_SetNextTx(pPDC, (char *) 0, 0); + AT91F_PDC_SetNextRx(pPDC, (char *) 0, 0); + AT91F_PDC_SetTx(pPDC, (char *) 0, 0); + AT91F_PDC_SetRx(pPDC, (char *) 0, 0); + +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_SendFrame +//* \brief Close PDC: disable TX and RX reset transfer descriptors +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PDC_SendFrame( + AT91PS_PDC pPDC, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + if (AT91F_PDC_IsTxEmpty(pPDC)) { + //* Buffer and next buffer can be initialized + AT91F_PDC_SetTx(pPDC, pBuffer, szBuffer); + AT91F_PDC_SetNextTx(pPDC, pNextBuffer, szNextBuffer); + return 2; + } + else if (AT91F_PDC_IsNextTxEmpty(pPDC)) { + //* Only one buffer can be initialized + AT91F_PDC_SetNextTx(pPDC, pBuffer, szBuffer); + return 1; + } + else { + //* All buffer are in use... + return 0; + } +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PDC_ReceiveFrame +//* \brief Close PDC: disable TX and RX reset transfer descriptors +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PDC_ReceiveFrame ( + AT91PS_PDC pPDC, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + if (AT91F_PDC_IsRxEmpty(pPDC)) { + //* Buffer and next buffer can be initialized + AT91F_PDC_SetRx(pPDC, pBuffer, szBuffer); + AT91F_PDC_SetNextRx(pPDC, pNextBuffer, szNextBuffer); + return 2; + } + else if (AT91F_PDC_IsNextRxEmpty(pPDC)) { + //* Only one buffer can be initialized + AT91F_PDC_SetNextRx(pPDC, pBuffer, szBuffer); + return 1; + } + else { + //* All buffer are in use... + return 0; + } +} +/* ***************************************************************************** + SOFTWARE API FOR DBGU + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_DBGU_InterruptEnable +//* \brief Enable DBGU Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_DBGU_InterruptEnable( + AT91PS_DBGU pDbgu, // \arg pointer to a DBGU controller + unsigned int flag) // \arg dbgu interrupt to be enabled +{ + pDbgu->DBGU_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_DBGU_InterruptDisable +//* \brief Disable DBGU Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_DBGU_InterruptDisable( + AT91PS_DBGU pDbgu, // \arg pointer to a DBGU controller + unsigned int flag) // \arg dbgu interrupt to be disabled +{ + pDbgu->DBGU_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_DBGU_GetInterruptMaskStatus +//* \brief Return DBGU Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_DBGU_GetInterruptMaskStatus( // \return DBGU Interrupt Mask Status + AT91PS_DBGU pDbgu) // \arg pointer to a DBGU controller +{ + return pDbgu->DBGU_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_DBGU_IsInterruptMasked +//* \brief Test if DBGU Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_DBGU_IsInterruptMasked( + AT91PS_DBGU pDbgu, // \arg pointer to a DBGU controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_DBGU_GetInterruptMaskStatus(pDbgu) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR PIO + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgPeriph +//* \brief Enable pins to be drived by peripheral +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgPeriph( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int periphAEnable, // \arg PERIPH A to enable + unsigned int periphBEnable) // \arg PERIPH B to enable + +{ + pPio->PIO_ASR = periphAEnable; + pPio->PIO_BSR = periphBEnable; + pPio->PIO_PDR = (periphAEnable | periphBEnable); // Set in Periph mode +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgOutput +//* \brief Enable PIO in output mode +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgOutput( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int pioEnable) // \arg PIO to be enabled +{ + pPio->PIO_PER = pioEnable; // Set in PIO mode + pPio->PIO_OER = pioEnable; // Configure in Output +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgInput +//* \brief Enable PIO in input mode +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgInput( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int inputEnable) // \arg PIO to be enabled +{ + // Disable output + pPio->PIO_ODR = inputEnable; + pPio->PIO_PER = inputEnable; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgOpendrain +//* \brief Configure PIO in open drain +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgOpendrain( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int multiDrvEnable) // \arg pio to be configured in open drain +{ + // Configure the multi-drive option + pPio->PIO_MDDR = ~multiDrvEnable; + pPio->PIO_MDER = multiDrvEnable; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgPullup +//* \brief Enable pullup on PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgPullup( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int pullupEnable) // \arg enable pullup on PIO +{ + // Connect or not Pullup + pPio->PIO_PPUDR = ~pullupEnable; + pPio->PIO_PPUER = pullupEnable; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgDirectDrive +//* \brief Enable direct drive on PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgDirectDrive( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int directDrive) // \arg PIO to be configured with direct drive + +{ + // Configure the Direct Drive + pPio->PIO_OWDR = ~directDrive; + pPio->PIO_OWER = directDrive; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_CfgInputFilter +//* \brief Enable input filter on input PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_CfgInputFilter( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int inputFilter) // \arg PIO to be configured with input filter + +{ + // Configure the Direct Drive + pPio->PIO_IFDR = ~inputFilter; + pPio->PIO_IFER = inputFilter; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetInput +//* \brief Return PIO input value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetInput( // \return PIO input + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_PDSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsInputSet +//* \brief Test if PIO is input flag is active +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsInputSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetInput(pPio) & flag); +} + + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_SetOutput +//* \brief Set to 1 output PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_SetOutput( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg output to be set +{ + pPio->PIO_SODR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_ClearOutput +//* \brief Set to 0 output PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_ClearOutput( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg output to be cleared +{ + pPio->PIO_CODR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_ForceOutput +//* \brief Force output when Direct drive option is enabled +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_ForceOutput( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg output to be forced +{ + pPio->PIO_ODSR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_Enable +//* \brief Enable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_Enable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio to be enabled +{ + pPio->PIO_PER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_Disable +//* \brief Disable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_Disable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio to be disabled +{ + pPio->PIO_PDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetStatus +//* \brief Return PIO Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetStatus( // \return PIO Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_PSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsSet +//* \brief Test if PIO is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_OutputEnable +//* \brief Output Enable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_OutputEnable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio output to be enabled +{ + pPio->PIO_OER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_OutputDisable +//* \brief Output Enable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_OutputDisable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio output to be disabled +{ + pPio->PIO_ODR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetOutputStatus +//* \brief Return PIO Output Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetOutputStatus( // \return PIO Output Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_OSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsOuputSet +//* \brief Test if PIO Output is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsOutputSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetOutputStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_InputFilterEnable +//* \brief Input Filter Enable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_InputFilterEnable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio input filter to be enabled +{ + pPio->PIO_IFER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_InputFilterDisable +//* \brief Input Filter Disable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_InputFilterDisable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio input filter to be disabled +{ + pPio->PIO_IFDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetInputFilterStatus +//* \brief Return PIO Input Filter Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetInputFilterStatus( // \return PIO Input Filter Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_IFSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsInputFilterSet +//* \brief Test if PIO Input filter is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsInputFilterSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetInputFilterStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetOutputDataStatus +//* \brief Return PIO Output Data Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetOutputDataStatus( // \return PIO Output Data Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_ODSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_InterruptEnable +//* \brief Enable PIO Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_InterruptEnable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio interrupt to be enabled +{ + pPio->PIO_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_InterruptDisable +//* \brief Disable PIO Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_InterruptDisable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio interrupt to be disabled +{ + pPio->PIO_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetInterruptMaskStatus +//* \brief Return PIO Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetInterruptMaskStatus( // \return PIO Interrupt Mask Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetInterruptStatus +//* \brief Return PIO Interrupt Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetInterruptStatus( // \return PIO Interrupt Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_ISR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsInterruptMasked +//* \brief Test if PIO Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsInterruptMasked( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetInterruptMaskStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsInterruptSet +//* \brief Test if PIO Interrupt is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsInterruptSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetInterruptStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_MultiDriverEnable +//* \brief Multi Driver Enable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_MultiDriverEnable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio to be enabled +{ + pPio->PIO_MDER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_MultiDriverDisable +//* \brief Multi Driver Disable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_MultiDriverDisable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio to be disabled +{ + pPio->PIO_MDDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetMultiDriverStatus +//* \brief Return PIO Multi Driver Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetMultiDriverStatus( // \return PIO Multi Driver Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_MDSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsMultiDriverSet +//* \brief Test if PIO MultiDriver is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsMultiDriverSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetMultiDriverStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_A_RegisterSelection +//* \brief PIO A Register Selection +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_A_RegisterSelection( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio A register selection +{ + pPio->PIO_ASR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_B_RegisterSelection +//* \brief PIO B Register Selection +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_B_RegisterSelection( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio B register selection +{ + pPio->PIO_BSR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_Get_AB_RegisterStatus +//* \brief Return PIO Interrupt Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_Get_AB_RegisterStatus( // \return PIO AB Register Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_ABSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsAB_RegisterSet +//* \brief Test if PIO AB Register is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsAB_RegisterSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_Get_AB_RegisterStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_OutputWriteEnable +//* \brief Output Write Enable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_OutputWriteEnable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio output write to be enabled +{ + pPio->PIO_OWER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_OutputWriteDisable +//* \brief Output Write Disable PIO +//*---------------------------------------------------------------------------- +__inline void AT91F_PIO_OutputWriteDisable( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg pio output write to be disabled +{ + pPio->PIO_OWDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetOutputWriteStatus +//* \brief Return PIO Output Write Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetOutputWriteStatus( // \return PIO Output Write Status + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_OWSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsOutputWriteSet +//* \brief Test if PIO OutputWrite is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsOutputWriteSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetOutputWriteStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_GetCfgPullup +//* \brief Return PIO Configuration Pullup +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PIO_GetCfgPullup( // \return PIO Configuration Pullup + AT91PS_PIO pPio) // \arg pointer to a PIO controller +{ + return pPio->PIO_PPUSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsOutputDataStatusSet +//* \brief Test if PIO Output Data Status is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsOutputDataStatusSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PIO_GetOutputDataStatus(pPio) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIO_IsCfgPullupStatusSet +//* \brief Test if PIO Configuration Pullup Status is Set +//*---------------------------------------------------------------------------- +__inline int AT91F_PIO_IsCfgPullupStatusSet( + AT91PS_PIO pPio, // \arg pointer to a PIO controller + unsigned int flag) // \arg flag to be tested +{ + return (~AT91F_PIO_GetCfgPullup(pPio) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR PMC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_CfgSysClkEnableReg +//* \brief Configure the System Clock Enable Register of the PMC controller +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_CfgSysClkEnableReg ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int mode) +{ + //* Write to the SCER register + pPMC->PMC_SCER = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_CfgSysClkDisableReg +//* \brief Configure the System Clock Disable Register of the PMC controller +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_CfgSysClkDisableReg ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int mode) +{ + //* Write to the SCDR register + pPMC->PMC_SCDR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_GetSysClkStatusReg +//* \brief Return the System Clock Status Register of the PMC controller +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_GetSysClkStatusReg ( + AT91PS_PMC pPMC // pointer to a CAN controller + ) +{ + return pPMC->PMC_SCSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_EnablePeriphClock +//* \brief Enable peripheral clock +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_EnablePeriphClock ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int periphIds) // \arg IDs of peripherals +{ + pPMC->PMC_PCER = periphIds; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_DisablePeriphClock +//* \brief Disable peripheral clock +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_DisablePeriphClock ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int periphIds) // \arg IDs of peripherals +{ + pPMC->PMC_PCDR = periphIds; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_GetPeriphClock +//* \brief Get peripheral clock status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_GetPeriphClock ( + AT91PS_PMC pPMC) // \arg pointer to PMC controller +{ + return pPMC->PMC_PCSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_CfgMainOscillatorReg +//* \brief Cfg the main oscillator +//*---------------------------------------------------------------------------- +__inline void AT91F_CKGR_CfgMainOscillatorReg ( + AT91PS_CKGR pCKGR, // \arg pointer to CKGR controller + unsigned int mode) +{ + pCKGR->CKGR_MOR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_GetMainOscillatorReg +//* \brief Cfg the main oscillator +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CKGR_GetMainOscillatorReg ( + AT91PS_CKGR pCKGR) // \arg pointer to CKGR controller +{ + return pCKGR->CKGR_MOR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_EnableMainOscillator +//* \brief Enable the main oscillator +//*---------------------------------------------------------------------------- +__inline void AT91F_CKGR_EnableMainOscillator( + AT91PS_CKGR pCKGR) // \arg pointer to CKGR controller +{ + pCKGR->CKGR_MOR |= AT91C_CKGR_MOSCEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_DisableMainOscillator +//* \brief Disable the main oscillator +//*---------------------------------------------------------------------------- +__inline void AT91F_CKGR_DisableMainOscillator ( + AT91PS_CKGR pCKGR) // \arg pointer to CKGR controller +{ + pCKGR->CKGR_MOR &= ~AT91C_CKGR_MOSCEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_CfgMainOscStartUpTime +//* \brief Cfg MOR Register according to the main osc startup time +//*---------------------------------------------------------------------------- +__inline void AT91F_CKGR_CfgMainOscStartUpTime ( + AT91PS_CKGR pCKGR, // \arg pointer to CKGR controller + unsigned int startup_time, // \arg main osc startup time in microsecond (us) + unsigned int slowClock) // \arg slowClock in Hz +{ + pCKGR->CKGR_MOR &= ~AT91C_CKGR_OSCOUNT; + pCKGR->CKGR_MOR |= ((slowClock * startup_time)/(8*1000000)) << 8; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_GetMainClockFreqReg +//* \brief Cfg the main oscillator +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CKGR_GetMainClockFreqReg ( + AT91PS_CKGR pCKGR) // \arg pointer to CKGR controller +{ + return pCKGR->CKGR_MCFR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CKGR_GetMainClock +//* \brief Return Main clock in Hz +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CKGR_GetMainClock ( + AT91PS_CKGR pCKGR, // \arg pointer to CKGR controller + unsigned int slowClock) // \arg slowClock in Hz +{ + return ((pCKGR->CKGR_MCFR & AT91C_CKGR_MAINF) * slowClock) >> 4; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_CfgMCKReg +//* \brief Cfg Master Clock Register +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_CfgMCKReg ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int mode) +{ + pPMC->PMC_MCKR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_GetMCKReg +//* \brief Return Master Clock Register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_GetMCKReg( + AT91PS_PMC pPMC) // \arg pointer to PMC controller +{ + return pPMC->PMC_MCKR; +} + +//*------------------------------------------------------------------------------ +//* \fn AT91F_PMC_GetMasterClock +//* \brief Return master clock in Hz which correponds to processor clock for ARM7 +//*------------------------------------------------------------------------------ +__inline unsigned int AT91F_PMC_GetMasterClock ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + AT91PS_CKGR pCKGR, // \arg pointer to CKGR controller + unsigned int slowClock) // \arg slowClock in Hz +{ + unsigned int reg = pPMC->PMC_MCKR; + unsigned int prescaler = (1 << ((reg & AT91C_PMC_PRES) >> 2)); + unsigned int pllDivider, pllMultiplier; + + switch (reg & AT91C_PMC_CSS) { + case AT91C_PMC_CSS_SLOW_CLK: // Slow clock selected + return slowClock / prescaler; + case AT91C_PMC_CSS_MAIN_CLK: // Main clock is selected + return AT91F_CKGR_GetMainClock(pCKGR, slowClock) / prescaler; + case AT91C_PMC_CSS_PLL_CLK: // PLLB clock is selected + reg = pCKGR->CKGR_PLLR; + pllDivider = (reg & AT91C_CKGR_DIV); + pllMultiplier = ((reg & AT91C_CKGR_MUL) >> 16) + 1; + return AT91F_CKGR_GetMainClock(pCKGR, slowClock) / pllDivider * pllMultiplier / prescaler; + } + return 0; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_EnablePCK +//* \brief Enable Programmable Clock x Output +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_EnablePCK ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int pck, // \arg Programmable Clock x Output + unsigned int mode) +{ + pPMC->PMC_PCKR[pck] = mode; + pPMC->PMC_SCER = (1 << pck) << 8; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_DisablePCK +//* \brief Disable Programmable Clock x Output +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_DisablePCK ( + AT91PS_PMC pPMC, // \arg pointer to PMC controller + unsigned int pck) // \arg Programmable Clock x Output +{ + pPMC->PMC_SCDR = (1 << pck) << 8; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_EnableIt +//* \brief Enable PMC interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_EnableIt ( + AT91PS_PMC pPMC, // pointer to a PMC controller + unsigned int flag) // IT to be enabled +{ + //* Write to the IER register + pPMC->PMC_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_DisableIt +//* \brief Disable PMC interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_DisableIt ( + AT91PS_PMC pPMC, // pointer to a PMC controller + unsigned int flag) // IT to be disabled +{ + //* Write to the IDR register + pPMC->PMC_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_GetStatus +//* \brief Return PMC Interrupt Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_GetStatus( // \return PMC Interrupt Status + AT91PS_PMC pPMC) // pointer to a PMC controller +{ + return pPMC->PMC_SR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_GetInterruptMaskStatus +//* \brief Return PMC Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_GetInterruptMaskStatus( // \return PMC Interrupt Mask Status + AT91PS_PMC pPMC) // pointer to a PMC controller +{ + return pPMC->PMC_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_IsInterruptMasked +//* \brief Test if PMC Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_IsInterruptMasked( + AT91PS_PMC pPMC, // \arg pointer to a PMC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PMC_GetInterruptMaskStatus(pPMC) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_IsStatusSet +//* \brief Test if PMC Status is Set +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PMC_IsStatusSet( + AT91PS_PMC pPMC, // \arg pointer to a PMC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PMC_GetStatus(pPMC) & flag); +} + +// ---------------------------------------------------------------------------- +// \fn AT91F_CKGR_CfgPLLReg +// \brief Cfg the PLL Register +// ---------------------------------------------------------------------------- +__inline void AT91F_CKGR_CfgPLLReg ( + AT91PS_CKGR pCKGR, // \arg pointer to CKGR controller + unsigned int mode) +{ + pCKGR->CKGR_PLLR = mode; +} + +// ---------------------------------------------------------------------------- +// \fn AT91F_CKGR_GetPLLReg +// \brief Get the PLL Register +// ---------------------------------------------------------------------------- +__inline unsigned int AT91F_CKGR_GetPLLReg ( + AT91PS_CKGR pCKGR) // \arg pointer to CKGR controller +{ + return pCKGR->CKGR_PLLR; +} + + +/* ***************************************************************************** + SOFTWARE API FOR RSTC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_RSTSoftReset +//* \brief Start Software Reset +//*---------------------------------------------------------------------------- +__inline void AT91F_RSTSoftReset( + AT91PS_RSTC pRSTC, + unsigned int reset) +{ + pRSTC->RSTC_RCR = (0xA5000000 | reset); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_RSTSetMode +//* \brief Set Reset Mode +//*---------------------------------------------------------------------------- +__inline void AT91F_RSTSetMode( + AT91PS_RSTC pRSTC, + unsigned int mode) +{ + pRSTC->RSTC_RMR = (0xA5000000 | mode); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_RSTGetMode +//* \brief Get Reset Mode +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_RSTGetMode( + AT91PS_RSTC pRSTC) +{ + return (pRSTC->RSTC_RMR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_RSTGetStatus +//* \brief Get Reset Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_RSTGetStatus( + AT91PS_RSTC pRSTC) +{ + return (pRSTC->RSTC_RSR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_RSTIsSoftRstActive +//* \brief Return !=0 if software reset is still not completed +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_RSTIsSoftRstActive( + AT91PS_RSTC pRSTC) +{ + return ((pRSTC->RSTC_RSR) & AT91C_RSTC_SRCMP); +} +/* ***************************************************************************** + SOFTWARE API FOR RTTC + ***************************************************************************** */ +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_SetRTT_TimeBase() +//* \brief Set the RTT prescaler according to the TimeBase in ms +//*-------------------------------------------------------------------------------------- +__inline unsigned int AT91F_RTTSetTimeBase( + AT91PS_RTTC pRTTC, + unsigned int ms) +{ + if (ms > 2000) + return 1; // AT91C_TIME_OUT_OF_RANGE + pRTTC->RTTC_RTMR &= ~0xFFFF; + pRTTC->RTTC_RTMR |= (((ms << 15) /1000) & 0xFFFF); + return 0; +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTTSetPrescaler() +//* \brief Set the new prescaler value +//*-------------------------------------------------------------------------------------- +__inline unsigned int AT91F_RTTSetPrescaler( + AT91PS_RTTC pRTTC, + unsigned int rtpres) +{ + pRTTC->RTTC_RTMR &= ~0xFFFF; + pRTTC->RTTC_RTMR |= (rtpres & 0xFFFF); + return (pRTTC->RTTC_RTMR); +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTTRestart() +//* \brief Restart the RTT prescaler +//*-------------------------------------------------------------------------------------- +__inline void AT91F_RTTRestart( + AT91PS_RTTC pRTTC) +{ + pRTTC->RTTC_RTMR |= AT91C_RTTC_RTTRST; +} + + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_SetAlarmINT() +//* \brief Enable RTT Alarm Interrupt +//*-------------------------------------------------------------------------------------- +__inline void AT91F_RTTSetAlarmINT( + AT91PS_RTTC pRTTC) +{ + pRTTC->RTTC_RTMR |= AT91C_RTTC_ALMIEN; +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_ClearAlarmINT() +//* \brief Disable RTT Alarm Interrupt +//*-------------------------------------------------------------------------------------- +__inline void AT91F_RTTClearAlarmINT( + AT91PS_RTTC pRTTC) +{ + pRTTC->RTTC_RTMR &= ~AT91C_RTTC_ALMIEN; +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_SetRttIncINT() +//* \brief Enable RTT INC Interrupt +//*-------------------------------------------------------------------------------------- +__inline void AT91F_RTTSetRttIncINT( + AT91PS_RTTC pRTTC) +{ + pRTTC->RTTC_RTMR |= AT91C_RTTC_RTTINCIEN; +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_ClearRttIncINT() +//* \brief Disable RTT INC Interrupt +//*-------------------------------------------------------------------------------------- +__inline void AT91F_RTTClearRttIncINT( + AT91PS_RTTC pRTTC) +{ + pRTTC->RTTC_RTMR &= ~AT91C_RTTC_RTTINCIEN; +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_SetAlarmValue() +//* \brief Set RTT Alarm Value +//*-------------------------------------------------------------------------------------- +__inline void AT91F_RTTSetAlarmValue( + AT91PS_RTTC pRTTC, unsigned int alarm) +{ + pRTTC->RTTC_RTAR = alarm; +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_GetAlarmValue() +//* \brief Get RTT Alarm Value +//*-------------------------------------------------------------------------------------- +__inline unsigned int AT91F_RTTGetAlarmValue( + AT91PS_RTTC pRTTC) +{ + return(pRTTC->RTTC_RTAR); +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTTGetStatus() +//* \brief Read the RTT status +//*-------------------------------------------------------------------------------------- +__inline unsigned int AT91F_RTTGetStatus( + AT91PS_RTTC pRTTC) +{ + return(pRTTC->RTTC_RTSR); +} + +//*-------------------------------------------------------------------------------------- +//* \fn AT91F_RTT_ReadValue() +//* \brief Read the RTT value +//*-------------------------------------------------------------------------------------- +__inline unsigned int AT91F_RTTReadValue( + AT91PS_RTTC pRTTC) +{ + register volatile unsigned int val1,val2; + do + { + val1 = pRTTC->RTTC_RTVR; + val2 = pRTTC->RTTC_RTVR; + } + while(val1 != val2); + return(val1); +} +/* ***************************************************************************** + SOFTWARE API FOR PITC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITInit +//* \brief System timer init : period in µsecond, system clock freq in MHz +//*---------------------------------------------------------------------------- +__inline void AT91F_PITInit( + AT91PS_PITC pPITC, + unsigned int period, + unsigned int pit_frequency) +{ + pPITC->PITC_PIMR = period? (period * pit_frequency + 8) >> 4 : 0; // +8 to avoid %10 and /10 + pPITC->PITC_PIMR |= AT91C_PITC_PITEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITSetPIV +//* \brief Set the PIT Periodic Interval Value +//*---------------------------------------------------------------------------- +__inline void AT91F_PITSetPIV( + AT91PS_PITC pPITC, + unsigned int piv) +{ + pPITC->PITC_PIMR = piv | (pPITC->PITC_PIMR & (AT91C_PITC_PITEN | AT91C_PITC_PITIEN)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITEnableInt +//* \brief Enable PIT periodic interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PITEnableInt( + AT91PS_PITC pPITC) +{ + pPITC->PITC_PIMR |= AT91C_PITC_PITIEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITDisableInt +//* \brief Disable PIT periodic interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PITDisableInt( + AT91PS_PITC pPITC) +{ + pPITC->PITC_PIMR &= ~AT91C_PITC_PITIEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITGetMode +//* \brief Read PIT mode register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PITGetMode( + AT91PS_PITC pPITC) +{ + return(pPITC->PITC_PIMR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITGetStatus +//* \brief Read PIT status register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PITGetStatus( + AT91PS_PITC pPITC) +{ + return(pPITC->PITC_PISR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITGetPIIR +//* \brief Read PIT CPIV and PICNT without ressetting the counters +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PITGetPIIR( + AT91PS_PITC pPITC) +{ + return(pPITC->PITC_PIIR); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITGetPIVR +//* \brief Read System timer CPIV and PICNT without ressetting the counters +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PITGetPIVR( + AT91PS_PITC pPITC) +{ + return(pPITC->PITC_PIVR); +} +/* ***************************************************************************** + SOFTWARE API FOR WDTC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_WDTSetMode +//* \brief Set Watchdog Mode Register +//*---------------------------------------------------------------------------- +__inline void AT91F_WDTSetMode( + AT91PS_WDTC pWDTC, + unsigned int Mode) +{ + pWDTC->WDTC_WDMR = Mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_WDTRestart +//* \brief Restart Watchdog +//*---------------------------------------------------------------------------- +__inline void AT91F_WDTRestart( + AT91PS_WDTC pWDTC) +{ + pWDTC->WDTC_WDCR = 0xA5000001; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_WDTSGettatus +//* \brief Get Watchdog Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_WDTSGettatus( + AT91PS_WDTC pWDTC) +{ + return(pWDTC->WDTC_WDSR & 0x3); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_WDTGetPeriod +//* \brief Translate ms into Watchdog Compatible value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_WDTGetPeriod(unsigned int ms) +{ + if ((ms < 4) || (ms > 16000)) + return 0; + return((ms << 8) / 1000); +} +/* ***************************************************************************** + SOFTWARE API FOR VREG + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_VREG_Enable_LowPowerMode +//* \brief Enable VREG Low Power Mode +//*---------------------------------------------------------------------------- +__inline void AT91F_VREG_Enable_LowPowerMode( + AT91PS_VREG pVREG) +{ + pVREG->VREG_MR |= AT91C_VREG_PSTDBY; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_VREG_Disable_LowPowerMode +//* \brief Disable VREG Low Power Mode +//*---------------------------------------------------------------------------- +__inline void AT91F_VREG_Disable_LowPowerMode( + AT91PS_VREG pVREG) +{ + pVREG->VREG_MR &= ~AT91C_VREG_PSTDBY; +}/* ***************************************************************************** + SOFTWARE API FOR MC + ***************************************************************************** */ + +#define AT91C_MC_CORRECT_KEY ((unsigned int) 0x5A << 24) // (MC) Correct Protect Key + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_Remap +//* \brief Make Remap +//*---------------------------------------------------------------------------- +__inline void AT91F_MC_Remap (void) // +{ + AT91PS_MC pMC = (AT91PS_MC) AT91C_BASE_MC; + + pMC->MC_RCR = AT91C_MC_RCB; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_CfgModeReg +//* \brief Configure the EFC Mode Register of the MC controller +//*---------------------------------------------------------------------------- +__inline void AT91F_MC_EFC_CfgModeReg ( + AT91PS_MC pMC, // pointer to a MC controller + unsigned int mode) // mode register +{ + // Write to the FMR register + pMC->MC_FMR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_GetModeReg +//* \brief Return MC EFC Mode Regsiter +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_MC_EFC_GetModeReg( + AT91PS_MC pMC) // pointer to a MC controller +{ + return pMC->MC_FMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_ComputeFMCN +//* \brief Return MC EFC Mode Regsiter +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_MC_EFC_ComputeFMCN( + int master_clock) // master clock in Hz +{ + return (master_clock/1000000 +2); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_PerformCmd +//* \brief Perform EFC Command +//*---------------------------------------------------------------------------- +__inline void AT91F_MC_EFC_PerformCmd ( + AT91PS_MC pMC, // pointer to a MC controller + unsigned int transfer_cmd) +{ + pMC->MC_FCR = transfer_cmd; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_GetStatus +//* \brief Return MC EFC Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_MC_EFC_GetStatus( + AT91PS_MC pMC) // pointer to a MC controller +{ + return pMC->MC_FSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_IsInterruptMasked +//* \brief Test if EFC MC Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_MC_EFC_IsInterruptMasked( + AT91PS_MC pMC, // \arg pointer to a MC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_MC_EFC_GetModeReg(pMC) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_EFC_IsInterruptSet +//* \brief Test if EFC MC Interrupt is Set +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_MC_EFC_IsInterruptSet( + AT91PS_MC pMC, // \arg pointer to a MC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_MC_EFC_GetStatus(pMC) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR SPI + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_CfgCs +//* \brief Configure SPI chip select register +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_CfgCs ( + AT91PS_SPI pSPI, // pointer to a SPI controller + int cs, // SPI cs number (0 to 3) + int val) // chip select register +{ + //* Write to the CSR register + *(pSPI->SPI_CSR + cs) = val; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_EnableIt +//* \brief Enable SPI interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_EnableIt ( + AT91PS_SPI pSPI, // pointer to a SPI controller + unsigned int flag) // IT to be enabled +{ + //* Write to the IER register + pSPI->SPI_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_DisableIt +//* \brief Disable SPI interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_DisableIt ( + AT91PS_SPI pSPI, // pointer to a SPI controller + unsigned int flag) // IT to be disabled +{ + //* Write to the IDR register + pSPI->SPI_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_Reset +//* \brief Reset the SPI controller +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_Reset ( + AT91PS_SPI pSPI // pointer to a SPI controller + ) +{ + //* Write to the CR register + pSPI->SPI_CR = AT91C_SPI_SWRST; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_Enable +//* \brief Enable the SPI controller +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_Enable ( + AT91PS_SPI pSPI // pointer to a SPI controller + ) +{ + //* Write to the CR register + pSPI->SPI_CR = AT91C_SPI_SPIEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_Disable +//* \brief Disable the SPI controller +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_Disable ( + AT91PS_SPI pSPI // pointer to a SPI controller + ) +{ + //* Write to the CR register + pSPI->SPI_CR = AT91C_SPI_SPIDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_CfgMode +//* \brief Enable the SPI controller +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_CfgMode ( + AT91PS_SPI pSPI, // pointer to a SPI controller + int mode) // mode register +{ + //* Write to the MR register + pSPI->SPI_MR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_CfgPCS +//* \brief Switch to the correct PCS of SPI Mode Register : Fixed Peripheral Selected +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_CfgPCS ( + AT91PS_SPI pSPI, // pointer to a SPI controller + char PCS_Device) // PCS of the Device +{ + //* Write to the MR register + pSPI->SPI_MR &= 0xFFF0FFFF; + pSPI->SPI_MR |= ( (PCS_Device<<16) & AT91C_SPI_PCS ); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_ReceiveFrame +//* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initializaed with Next Buffer, 0 if PDC is busy +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_SPI_ReceiveFrame ( + AT91PS_SPI pSPI, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + return AT91F_PDC_ReceiveFrame( + (AT91PS_PDC) &(pSPI->SPI_RPR), + pBuffer, + szBuffer, + pNextBuffer, + szNextBuffer); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_SendFrame +//* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initializaed with Next Buffer, 0 if PDC is bSPIy +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_SPI_SendFrame( + AT91PS_SPI pSPI, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + return AT91F_PDC_SendFrame( + (AT91PS_PDC) &(pSPI->SPI_RPR), + pBuffer, + szBuffer, + pNextBuffer, + szNextBuffer); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_Close +//* \brief Close SPI: disable IT disable transfert, close PDC +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_Close ( + AT91PS_SPI pSPI) // \arg pointer to a SPI controller +{ + //* Reset all the Chip Select register + pSPI->SPI_CSR[0] = 0 ; + pSPI->SPI_CSR[1] = 0 ; + pSPI->SPI_CSR[2] = 0 ; + pSPI->SPI_CSR[3] = 0 ; + + //* Reset the SPI mode + pSPI->SPI_MR = 0 ; + + //* Disable all interrupts + pSPI->SPI_IDR = 0xFFFFFFFF ; + + //* Abort the Peripheral Data Transfers + AT91F_PDC_Close((AT91PS_PDC) &(pSPI->SPI_RPR)); + + //* Disable receiver and transmitter and stop any activity immediately + pSPI->SPI_CR = AT91C_SPI_SPIDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_PutChar +//* \brief Send a character,does not check if ready to send +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI_PutChar ( + AT91PS_SPI pSPI, + unsigned int character, + unsigned int cs_number ) +{ + unsigned int value_for_cs; + value_for_cs = (~(1 << cs_number)) & 0xF; //Place a zero among a 4 ONEs number + pSPI->SPI_TDR = (character & 0xFFFF) | (value_for_cs << 16); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_GetChar +//* \brief Receive a character,does not check if a character is available +//*---------------------------------------------------------------------------- +__inline int AT91F_SPI_GetChar ( + const AT91PS_SPI pSPI) +{ + return((pSPI->SPI_RDR) & 0xFFFF); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_GetInterruptMaskStatus +//* \brief Return SPI Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_SPI_GetInterruptMaskStatus( // \return SPI Interrupt Mask Status + AT91PS_SPI pSpi) // \arg pointer to a SPI controller +{ + return pSpi->SPI_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI_IsInterruptMasked +//* \brief Test if SPI Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_SPI_IsInterruptMasked( + AT91PS_SPI pSpi, // \arg pointer to a SPI controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_SPI_GetInterruptMaskStatus(pSpi) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR USART + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_Baudrate +//* \brief Calculate the baudrate +//* Standard Asynchronous Mode : 8 bits , 1 stop , no parity +#define AT91C_US_ASYNC_MODE ( AT91C_US_USMODE_NORMAL + \ + AT91C_US_NBSTOP_1_BIT + \ + AT91C_US_PAR_NONE + \ + AT91C_US_CHRL_8_BITS + \ + AT91C_US_CLKS_CLOCK ) + +//* Standard External Asynchronous Mode : 8 bits , 1 stop , no parity +#define AT91C_US_ASYNC_SCK_MODE ( AT91C_US_USMODE_NORMAL + \ + AT91C_US_NBSTOP_1_BIT + \ + AT91C_US_PAR_NONE + \ + AT91C_US_CHRL_8_BITS + \ + AT91C_US_CLKS_EXT ) + +//* Standard Synchronous Mode : 8 bits , 1 stop , no parity +#define AT91C_US_SYNC_MODE ( AT91C_US_SYNC + \ + AT91C_US_USMODE_NORMAL + \ + AT91C_US_NBSTOP_1_BIT + \ + AT91C_US_PAR_NONE + \ + AT91C_US_CHRL_8_BITS + \ + AT91C_US_CLKS_CLOCK ) + +//* SCK used Label +#define AT91C_US_SCK_USED (AT91C_US_CKLO | AT91C_US_CLKS_EXT) + +//* Standard ISO T=0 Mode : 8 bits , 1 stop , parity +#define AT91C_US_ISO_READER_MODE ( AT91C_US_USMODE_ISO7816_0 + \ + AT91C_US_CLKS_CLOCK +\ + AT91C_US_NBSTOP_1_BIT + \ + AT91C_US_PAR_EVEN + \ + AT91C_US_CHRL_8_BITS + \ + AT91C_US_CKLO +\ + AT91C_US_OVER) + +//* Standard IRDA mode +#define AT91C_US_ASYNC_IRDA_MODE ( AT91C_US_USMODE_IRDA + \ + AT91C_US_NBSTOP_1_BIT + \ + AT91C_US_PAR_NONE + \ + AT91C_US_CHRL_8_BITS + \ + AT91C_US_CLKS_CLOCK ) + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_Baudrate +//* \brief Caluculate baud_value according to the main clock and the baud rate +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_US_Baudrate ( + const unsigned int main_clock, // \arg peripheral clock + const unsigned int baud_rate) // \arg UART baudrate +{ + unsigned int baud_value = ((main_clock*10)/(baud_rate * 16)); + if ((baud_value % 10) >= 5) + baud_value = (baud_value / 10) + 1; + else + baud_value /= 10; + return baud_value; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_SetBaudrate +//* \brief Set the baudrate according to the CPU clock +//*---------------------------------------------------------------------------- +__inline void AT91F_US_SetBaudrate ( + AT91PS_USART pUSART, // \arg pointer to a USART controller + unsigned int mainClock, // \arg peripheral clock + unsigned int speed) // \arg UART baudrate +{ + //* Define the baud rate divisor register + pUSART->US_BRGR = AT91F_US_Baudrate(mainClock, speed); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_SetTimeguard +//* \brief Set USART timeguard +//*---------------------------------------------------------------------------- +__inline void AT91F_US_SetTimeguard ( + AT91PS_USART pUSART, // \arg pointer to a USART controller + unsigned int timeguard) // \arg timeguard value +{ + //* Write the Timeguard Register + pUSART->US_TTGR = timeguard ; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_EnableIt +//* \brief Enable USART IT +//*---------------------------------------------------------------------------- +__inline void AT91F_US_EnableIt ( + AT91PS_USART pUSART, // \arg pointer to a USART controller + unsigned int flag) // \arg IT to be enabled +{ + //* Write to the IER register + pUSART->US_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_DisableIt +//* \brief Disable USART IT +//*---------------------------------------------------------------------------- +__inline void AT91F_US_DisableIt ( + AT91PS_USART pUSART, // \arg pointer to a USART controller + unsigned int flag) // \arg IT to be disabled +{ + //* Write to the IER register + pUSART->US_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_Configure +//* \brief Configure USART +//*---------------------------------------------------------------------------- +__inline void AT91F_US_Configure ( + AT91PS_USART pUSART, // \arg pointer to a USART controller + unsigned int mainClock, // \arg peripheral clock + unsigned int mode , // \arg mode Register to be programmed + unsigned int baudRate , // \arg baudrate to be programmed + unsigned int timeguard ) // \arg timeguard to be programmed +{ + //* Disable interrupts + pUSART->US_IDR = (unsigned int) -1; + + //* Reset receiver and transmitter + pUSART->US_CR = AT91C_US_RSTRX | AT91C_US_RSTTX | AT91C_US_RXDIS | AT91C_US_TXDIS ; + + //* Define the baud rate divisor register + AT91F_US_SetBaudrate(pUSART, mainClock, baudRate); + + //* Write the Timeguard Register + AT91F_US_SetTimeguard(pUSART, timeguard); + + //* Clear Transmit and Receive Counters + AT91F_PDC_Open((AT91PS_PDC) &(pUSART->US_RPR)); + + //* Define the USART mode + pUSART->US_MR = mode ; + +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_EnableRx +//* \brief Enable receiving characters +//*---------------------------------------------------------------------------- +__inline void AT91F_US_EnableRx ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Enable receiver + pUSART->US_CR = AT91C_US_RXEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_EnableTx +//* \brief Enable sending characters +//*---------------------------------------------------------------------------- +__inline void AT91F_US_EnableTx ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Enable transmitter + pUSART->US_CR = AT91C_US_TXEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_ResetRx +//* \brief Reset Receiver and re-enable it +//*---------------------------------------------------------------------------- +__inline void AT91F_US_ResetRx ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Reset receiver + pUSART->US_CR = AT91C_US_RSTRX; + //* Re-Enable receiver + pUSART->US_CR = AT91C_US_RXEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_ResetTx +//* \brief Reset Transmitter and re-enable it +//*---------------------------------------------------------------------------- +__inline void AT91F_US_ResetTx ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Reset transmitter + pUSART->US_CR = AT91C_US_RSTTX; + //* Enable transmitter + pUSART->US_CR = AT91C_US_TXEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_DisableRx +//* \brief Disable Receiver +//*---------------------------------------------------------------------------- +__inline void AT91F_US_DisableRx ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Disable receiver + pUSART->US_CR = AT91C_US_RXDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_DisableTx +//* \brief Disable Transmitter +//*---------------------------------------------------------------------------- +__inline void AT91F_US_DisableTx ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Disable transmitter + pUSART->US_CR = AT91C_US_TXDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_Close +//* \brief Close USART: disable IT disable receiver and transmitter, close PDC +//*---------------------------------------------------------------------------- +__inline void AT91F_US_Close ( + AT91PS_USART pUSART) // \arg pointer to a USART controller +{ + //* Reset the baud rate divisor register + pUSART->US_BRGR = 0 ; + + //* Reset the USART mode + pUSART->US_MR = 0 ; + + //* Reset the Timeguard Register + pUSART->US_TTGR = 0; + + //* Disable all interrupts + pUSART->US_IDR = 0xFFFFFFFF ; + + //* Abort the Peripheral Data Transfers + AT91F_PDC_Close((AT91PS_PDC) &(pUSART->US_RPR)); + + //* Disable receiver and transmitter and stop any activity immediately + pUSART->US_CR = AT91C_US_TXDIS | AT91C_US_RXDIS | AT91C_US_RSTTX | AT91C_US_RSTRX ; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_TxReady +//* \brief Return 1 if a character can be written in US_THR +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_US_TxReady ( + AT91PS_USART pUSART ) // \arg pointer to a USART controller +{ + return (pUSART->US_CSR & AT91C_US_TXRDY); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_RxReady +//* \brief Return 1 if a character can be read in US_RHR +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_US_RxReady ( + AT91PS_USART pUSART ) // \arg pointer to a USART controller +{ + return (pUSART->US_CSR & AT91C_US_RXRDY); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_Error +//* \brief Return the error flag +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_US_Error ( + AT91PS_USART pUSART ) // \arg pointer to a USART controller +{ + return (pUSART->US_CSR & + (AT91C_US_OVRE | // Overrun error + AT91C_US_FRAME | // Framing error + AT91C_US_PARE)); // Parity error +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_PutChar +//* \brief Send a character,does not check if ready to send +//*---------------------------------------------------------------------------- +__inline void AT91F_US_PutChar ( + AT91PS_USART pUSART, + int character ) +{ + pUSART->US_THR = (character & 0x1FF); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_GetChar +//* \brief Receive a character,does not check if a character is available +//*---------------------------------------------------------------------------- +__inline int AT91F_US_GetChar ( + const AT91PS_USART pUSART) +{ + return((pUSART->US_RHR) & 0x1FF); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_SendFrame +//* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initializaed with Next Buffer, 0 if PDC is busy +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_US_SendFrame( + AT91PS_USART pUSART, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + return AT91F_PDC_SendFrame( + (AT91PS_PDC) &(pUSART->US_RPR), + pBuffer, + szBuffer, + pNextBuffer, + szNextBuffer); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_ReceiveFrame +//* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initializaed with Next Buffer, 0 if PDC is busy +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_US_ReceiveFrame ( + AT91PS_USART pUSART, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + return AT91F_PDC_ReceiveFrame( + (AT91PS_PDC) &(pUSART->US_RPR), + pBuffer, + szBuffer, + pNextBuffer, + szNextBuffer); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US_SetIrdaFilter +//* \brief Set the value of IrDa filter tregister +//*---------------------------------------------------------------------------- +__inline void AT91F_US_SetIrdaFilter ( + AT91PS_USART pUSART, + unsigned char value +) +{ + pUSART->US_IF = value; +} + +/* ***************************************************************************** + SOFTWARE API FOR SSC + ***************************************************************************** */ +//* Define the standard I2S mode configuration + +//* Configuration to set in the SSC Transmit Clock Mode Register +//* Parameters : nb_bit_by_slot : 8, 16 or 32 bits +//* nb_slot_by_frame : number of channels +#define AT91C_I2S_ASY_MASTER_TX_SETTING(nb_bit_by_slot, nb_slot_by_frame)( +\ + AT91C_SSC_CKS_DIV +\ + AT91C_SSC_CKO_CONTINOUS +\ + AT91C_SSC_CKG_NONE +\ + AT91C_SSC_START_FALL_RF +\ + AT91C_SSC_STTOUT +\ + ((1<<16) & AT91C_SSC_STTDLY) +\ + ((((nb_bit_by_slot*nb_slot_by_frame)/2)-1) <<24)) + + +//* Configuration to set in the SSC Transmit Frame Mode Register +//* Parameters : nb_bit_by_slot : 8, 16 or 32 bits +//* nb_slot_by_frame : number of channels +#define AT91C_I2S_ASY_TX_FRAME_SETTING(nb_bit_by_slot, nb_slot_by_frame)( +\ + (nb_bit_by_slot-1) +\ + AT91C_SSC_MSBF +\ + (((nb_slot_by_frame-1)<<8) & AT91C_SSC_DATNB) +\ + (((nb_bit_by_slot-1)<<16) & AT91C_SSC_FSLEN) +\ + AT91C_SSC_FSOS_NEGATIVE) + + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_SetBaudrate +//* \brief Set the baudrate according to the CPU clock +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_SetBaudrate ( + AT91PS_SSC pSSC, // \arg pointer to a SSC controller + unsigned int mainClock, // \arg peripheral clock + unsigned int speed) // \arg SSC baudrate +{ + unsigned int baud_value; + //* Define the baud rate divisor register + if (speed == 0) + baud_value = 0; + else + { + baud_value = (unsigned int) (mainClock * 10)/(2*speed); + if ((baud_value % 10) >= 5) + baud_value = (baud_value / 10) + 1; + else + baud_value /= 10; + } + + pSSC->SSC_CMR = baud_value; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_Configure +//* \brief Configure SSC +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_Configure ( + AT91PS_SSC pSSC, // \arg pointer to a SSC controller + unsigned int syst_clock, // \arg System Clock Frequency + unsigned int baud_rate, // \arg Expected Baud Rate Frequency + unsigned int clock_rx, // \arg Receiver Clock Parameters + unsigned int mode_rx, // \arg mode Register to be programmed + unsigned int clock_tx, // \arg Transmitter Clock Parameters + unsigned int mode_tx) // \arg mode Register to be programmed +{ + //* Disable interrupts + pSSC->SSC_IDR = (unsigned int) -1; + + //* Reset receiver and transmitter + pSSC->SSC_CR = AT91C_SSC_SWRST | AT91C_SSC_RXDIS | AT91C_SSC_TXDIS ; + + //* Define the Clock Mode Register + AT91F_SSC_SetBaudrate(pSSC, syst_clock, baud_rate); + + //* Write the Receive Clock Mode Register + pSSC->SSC_RCMR = clock_rx; + + //* Write the Transmit Clock Mode Register + pSSC->SSC_TCMR = clock_tx; + + //* Write the Receive Frame Mode Register + pSSC->SSC_RFMR = mode_rx; + + //* Write the Transmit Frame Mode Register + pSSC->SSC_TFMR = mode_tx; + + //* Clear Transmit and Receive Counters + AT91F_PDC_Open((AT91PS_PDC) &(pSSC->SSC_RPR)); + + +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_EnableRx +//* \brief Enable receiving datas +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_EnableRx ( + AT91PS_SSC pSSC) // \arg pointer to a SSC controller +{ + //* Enable receiver + pSSC->SSC_CR = AT91C_SSC_RXEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_DisableRx +//* \brief Disable receiving datas +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_DisableRx ( + AT91PS_SSC pSSC) // \arg pointer to a SSC controller +{ + //* Disable receiver + pSSC->SSC_CR = AT91C_SSC_RXDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_EnableTx +//* \brief Enable sending datas +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_EnableTx ( + AT91PS_SSC pSSC) // \arg pointer to a SSC controller +{ + //* Enable transmitter + pSSC->SSC_CR = AT91C_SSC_TXEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_DisableTx +//* \brief Disable sending datas +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_DisableTx ( + AT91PS_SSC pSSC) // \arg pointer to a SSC controller +{ + //* Disable transmitter + pSSC->SSC_CR = AT91C_SSC_TXDIS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_EnableIt +//* \brief Enable SSC IT +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_EnableIt ( + AT91PS_SSC pSSC, // \arg pointer to a SSC controller + unsigned int flag) // \arg IT to be enabled +{ + //* Write to the IER register + pSSC->SSC_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_DisableIt +//* \brief Disable SSC IT +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_DisableIt ( + AT91PS_SSC pSSC, // \arg pointer to a SSC controller + unsigned int flag) // \arg IT to be disabled +{ + //* Write to the IDR register + pSSC->SSC_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_ReceiveFrame +//* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initialized with Next Buffer, 0 if PDC is busy +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_SSC_ReceiveFrame ( + AT91PS_SSC pSSC, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + return AT91F_PDC_ReceiveFrame( + (AT91PS_PDC) &(pSSC->SSC_RPR), + pBuffer, + szBuffer, + pNextBuffer, + szNextBuffer); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_SendFrame +//* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initialized with Next Buffer, 0 if PDC is busy +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_SSC_SendFrame( + AT91PS_SSC pSSC, + char *pBuffer, + unsigned int szBuffer, + char *pNextBuffer, + unsigned int szNextBuffer ) +{ + return AT91F_PDC_SendFrame( + (AT91PS_PDC) &(pSSC->SSC_RPR), + pBuffer, + szBuffer, + pNextBuffer, + szNextBuffer); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_GetInterruptMaskStatus +//* \brief Return SSC Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_SSC_GetInterruptMaskStatus( // \return SSC Interrupt Mask Status + AT91PS_SSC pSsc) // \arg pointer to a SSC controller +{ + return pSsc->SSC_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_IsInterruptMasked +//* \brief Test if SSC Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_SSC_IsInterruptMasked( + AT91PS_SSC pSsc, // \arg pointer to a SSC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_SSC_GetInterruptMaskStatus(pSsc) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR TWI + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_EnableIt +//* \brief Enable TWI IT +//*---------------------------------------------------------------------------- +__inline void AT91F_TWI_EnableIt ( + AT91PS_TWI pTWI, // \arg pointer to a TWI controller + unsigned int flag) // \arg IT to be enabled +{ + //* Write to the IER register + pTWI->TWI_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_DisableIt +//* \brief Disable TWI IT +//*---------------------------------------------------------------------------- +__inline void AT91F_TWI_DisableIt ( + AT91PS_TWI pTWI, // \arg pointer to a TWI controller + unsigned int flag) // \arg IT to be disabled +{ + //* Write to the IDR register + pTWI->TWI_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_Configure +//* \brief Configure TWI in master mode +//*---------------------------------------------------------------------------- +__inline void AT91F_TWI_Configure ( AT91PS_TWI pTWI ) // \arg pointer to a TWI controller +{ + //* Disable interrupts + pTWI->TWI_IDR = (unsigned int) -1; + + //* Reset peripheral + pTWI->TWI_CR = AT91C_TWI_SWRST; + + //* Set Master mode + pTWI->TWI_CR = AT91C_TWI_MSEN; + +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_GetInterruptMaskStatus +//* \brief Return TWI Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_TWI_GetInterruptMaskStatus( // \return TWI Interrupt Mask Status + AT91PS_TWI pTwi) // \arg pointer to a TWI controller +{ + return pTwi->TWI_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_IsInterruptMasked +//* \brief Test if TWI Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_TWI_IsInterruptMasked( + AT91PS_TWI pTwi, // \arg pointer to a TWI controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_TWI_GetInterruptMaskStatus(pTwi) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR PWMC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_GetStatus +//* \brief Return PWM Interrupt Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PWMC_GetStatus( // \return PWM Interrupt Status + AT91PS_PWMC pPWM) // pointer to a PWM controller +{ + return pPWM->PWMC_SR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_InterruptEnable +//* \brief Enable PWM Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_InterruptEnable( + AT91PS_PWMC pPwm, // \arg pointer to a PWM controller + unsigned int flag) // \arg PWM interrupt to be enabled +{ + pPwm->PWMC_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_InterruptDisable +//* \brief Disable PWM Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_InterruptDisable( + AT91PS_PWMC pPwm, // \arg pointer to a PWM controller + unsigned int flag) // \arg PWM interrupt to be disabled +{ + pPwm->PWMC_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_GetInterruptMaskStatus +//* \brief Return PWM Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PWMC_GetInterruptMaskStatus( // \return PWM Interrupt Mask Status + AT91PS_PWMC pPwm) // \arg pointer to a PWM controller +{ + return pPwm->PWMC_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_IsInterruptMasked +//* \brief Test if PWM Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PWMC_IsInterruptMasked( + AT91PS_PWMC pPWM, // \arg pointer to a PWM controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PWMC_GetInterruptMaskStatus(pPWM) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_IsStatusSet +//* \brief Test if PWM Interrupt is Set +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_PWMC_IsStatusSet( + AT91PS_PWMC pPWM, // \arg pointer to a PWM controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_PWMC_GetStatus(pPWM) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_CfgChannel +//* \brief Test if PWM Interrupt is Set +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_CfgChannel( + AT91PS_PWMC pPWM, // \arg pointer to a PWM controller + unsigned int channelId, // \arg PWM channel ID + unsigned int mode, // \arg PWM mode + unsigned int period, // \arg PWM period + unsigned int duty) // \arg PWM duty cycle +{ + pPWM->PWMC_CH[channelId].PWMC_CMR = mode; + pPWM->PWMC_CH[channelId].PWMC_CDTYR = duty; + pPWM->PWMC_CH[channelId].PWMC_CPRDR = period; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_StartChannel +//* \brief Enable channel +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_StartChannel( + AT91PS_PWMC pPWM, // \arg pointer to a PWM controller + unsigned int flag) // \arg Channels IDs to be enabled +{ + pPWM->PWMC_ENA = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_StopChannel +//* \brief Disable channel +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_StopChannel( + AT91PS_PWMC pPWM, // \arg pointer to a PWM controller + unsigned int flag) // \arg Channels IDs to be enabled +{ + pPWM->PWMC_DIS = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWM_UpdateChannel +//* \brief Update Period or Duty Cycle +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_UpdateChannel( + AT91PS_PWMC pPWM, // \arg pointer to a PWM controller + unsigned int channelId, // \arg PWM channel ID + unsigned int update) // \arg Channels IDs to be enabled +{ + pPWM->PWMC_CH[channelId].PWMC_CUPDR = update; +} + +/* ***************************************************************************** + SOFTWARE API FOR UDP + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EnableIt +//* \brief Enable UDP IT +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EnableIt ( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned int flag) // \arg IT to be enabled +{ + //* Write to the IER register + pUDP->UDP_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_DisableIt +//* \brief Disable UDP IT +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_DisableIt ( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned int flag) // \arg IT to be disabled +{ + //* Write to the IDR register + pUDP->UDP_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_SetAddress +//* \brief Set UDP functional address +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_SetAddress ( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char address) // \arg new UDP address +{ + pUDP->UDP_FADDR = (AT91C_UDP_FEN | address); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EnableEp +//* \brief Enable Endpoint +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EnableEp ( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint) // \arg endpoint number +{ + pUDP->UDP_CSR[endpoint] |= AT91C_UDP_EPEDS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_DisableEp +//* \brief Enable Endpoint +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_DisableEp ( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint) // \arg endpoint number +{ + pUDP->UDP_CSR[endpoint] &= ~AT91C_UDP_EPEDS; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_SetState +//* \brief Set UDP Device state +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_SetState ( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned int flag) // \arg new UDP address +{ + pUDP->UDP_GLBSTATE &= ~(AT91C_UDP_FADDEN | AT91C_UDP_CONFG); + pUDP->UDP_GLBSTATE |= flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_GetState +//* \brief return UDP Device state +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_UDP_GetState ( // \return the UDP device state + AT91PS_UDP pUDP) // \arg pointer to a UDP controller +{ + return (pUDP->UDP_GLBSTATE & (AT91C_UDP_FADDEN | AT91C_UDP_CONFG)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_ResetEp +//* \brief Reset UDP endpoint +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_ResetEp ( // \return the UDP device state + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned int flag) // \arg Endpoints to be reset +{ + pUDP->UDP_RSTEP = flag; + pUDP->UDP_RSTEP = 0; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpStall +//* \brief Endpoint will STALL requests +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EpStall( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint) // \arg endpoint number +{ + pUDP->UDP_CSR[endpoint] |= AT91C_UDP_FORCESTALL; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpWrite +//* \brief Write value in the DPR +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EpWrite( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint, // \arg endpoint number + unsigned char value) // \arg value to be written in the DPR +{ + pUDP->UDP_FDR[endpoint] = value; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpRead +//* \brief Return value from the DPR +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_UDP_EpRead( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint) // \arg endpoint number +{ + return pUDP->UDP_FDR[endpoint]; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpEndOfWr +//* \brief Notify the UDP that values in DPR are ready to be sent +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EpEndOfWr( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint) // \arg endpoint number +{ + pUDP->UDP_CSR[endpoint] |= AT91C_UDP_TXPKTRDY; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpClear +//* \brief Clear flag in the endpoint CSR register +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EpClear( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint, // \arg endpoint number + unsigned int flag) // \arg flag to be cleared +{ + pUDP->UDP_CSR[endpoint] &= ~(flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpSet +//* \brief Set flag in the endpoint CSR register +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_EpSet( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint, // \arg endpoint number + unsigned int flag) // \arg flag to be cleared +{ + pUDP->UDP_CSR[endpoint] |= flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_EpStatus +//* \brief Return the endpoint CSR register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_UDP_EpStatus( + AT91PS_UDP pUDP, // \arg pointer to a UDP controller + unsigned char endpoint) // \arg endpoint number +{ + return pUDP->UDP_CSR[endpoint]; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_GetInterruptMaskStatus +//* \brief Return UDP Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_UDP_GetInterruptMaskStatus( + AT91PS_UDP pUdp) // \arg pointer to a UDP controller +{ + return pUdp->UDP_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_IsInterruptMasked +//* \brief Test if UDP Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_UDP_IsInterruptMasked( + AT91PS_UDP pUdp, // \arg pointer to a UDP controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_UDP_GetInterruptMaskStatus(pUdp) & flag); +} + +// ---------------------------------------------------------------------------- +// \fn AT91F_UDP_InterruptStatusRegister +// \brief Return the Interrupt Status Register +// ---------------------------------------------------------------------------- +__inline unsigned int AT91F_UDP_InterruptStatusRegister( + AT91PS_UDP pUDP ) // \arg pointer to a UDP controller +{ + return pUDP->UDP_ISR; +} + +// ---------------------------------------------------------------------------- +// \fn AT91F_UDP_InterruptClearRegister +// \brief Clear Interrupt Register +// ---------------------------------------------------------------------------- +__inline void AT91F_UDP_InterruptClearRegister ( + AT91PS_UDP pUDP, // \arg pointer to UDP controller + unsigned int flag) // \arg IT to be cleat +{ + pUDP->UDP_ICR = flag; +} + +// ---------------------------------------------------------------------------- +// \fn AT91F_UDP_EnableTransceiver +// \brief Enable transceiver +// ---------------------------------------------------------------------------- +__inline void AT91F_UDP_EnableTransceiver( + AT91PS_UDP pUDP ) // \arg pointer to a UDP controller +{ + pUDP->UDP_TXVC &= ~AT91C_UDP_TXVDIS; +} + +// ---------------------------------------------------------------------------- +// \fn AT91F_UDP_DisableTransceiver +// \brief Disable transceiver +// ---------------------------------------------------------------------------- +__inline void AT91F_UDP_DisableTransceiver( + AT91PS_UDP pUDP ) // \arg pointer to a UDP controller +{ + pUDP->UDP_TXVC = AT91C_UDP_TXVDIS; +} + +/* ***************************************************************************** + SOFTWARE API FOR TC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC_InterruptEnable +//* \brief Enable TC Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_TC_InterruptEnable( + AT91PS_TC pTc, // \arg pointer to a TC controller + unsigned int flag) // \arg TC interrupt to be enabled +{ + pTc->TC_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC_InterruptDisable +//* \brief Disable TC Interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_TC_InterruptDisable( + AT91PS_TC pTc, // \arg pointer to a TC controller + unsigned int flag) // \arg TC interrupt to be disabled +{ + pTc->TC_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC_GetInterruptMaskStatus +//* \brief Return TC Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_TC_GetInterruptMaskStatus( // \return TC Interrupt Mask Status + AT91PS_TC pTc) // \arg pointer to a TC controller +{ + return pTc->TC_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC_IsInterruptMasked +//* \brief Test if TC Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline int AT91F_TC_IsInterruptMasked( + AT91PS_TC pTc, // \arg pointer to a TC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_TC_GetInterruptMaskStatus(pTc) & flag); +} + +/* ***************************************************************************** + SOFTWARE API FOR CAN + ***************************************************************************** */ +#define STANDARD_FORMAT 0 +#define EXTENDED_FORMAT 1 + +//*---------------------------------------------------------------------------- +//* \fn AT91F_InitMailboxRegisters() +//* \brief Configure the corresponding mailbox +//*---------------------------------------------------------------------------- +__inline void AT91F_InitMailboxRegisters(AT91PS_CAN_MB CAN_Mailbox, + int mode_reg, + int acceptance_mask_reg, + int id_reg, + int data_low_reg, + int data_high_reg, + int control_reg) +{ + CAN_Mailbox->CAN_MB_MCR = 0x0; + CAN_Mailbox->CAN_MB_MMR = mode_reg; + CAN_Mailbox->CAN_MB_MAM = acceptance_mask_reg; + CAN_Mailbox->CAN_MB_MID = id_reg; + CAN_Mailbox->CAN_MB_MDL = data_low_reg; + CAN_Mailbox->CAN_MB_MDH = data_high_reg; + CAN_Mailbox->CAN_MB_MCR = control_reg; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_EnableCAN() +//* \brief +//*---------------------------------------------------------------------------- +__inline void AT91F_EnableCAN( + AT91PS_CAN pCAN) // pointer to a CAN controller +{ + pCAN->CAN_MR |= AT91C_CAN_CANEN; + + // Wait for WAKEUP flag raising <=> 11-recessive-bit were scanned by the transceiver + while( (pCAN->CAN_SR & AT91C_CAN_WAKEUP) != AT91C_CAN_WAKEUP ); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_DisableCAN() +//* \brief +//*---------------------------------------------------------------------------- +__inline void AT91F_DisableCAN( + AT91PS_CAN pCAN) // pointer to a CAN controller +{ + pCAN->CAN_MR &= ~AT91C_CAN_CANEN; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_EnableIt +//* \brief Enable CAN interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_EnableIt ( + AT91PS_CAN pCAN, // pointer to a CAN controller + unsigned int flag) // IT to be enabled +{ + //* Write to the IER register + pCAN->CAN_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_DisableIt +//* \brief Disable CAN interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_DisableIt ( + AT91PS_CAN pCAN, // pointer to a CAN controller + unsigned int flag) // IT to be disabled +{ + //* Write to the IDR register + pCAN->CAN_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetStatus +//* \brief Return CAN Interrupt Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetStatus( // \return CAN Interrupt Status + AT91PS_CAN pCAN) // pointer to a CAN controller +{ + return pCAN->CAN_SR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetInterruptMaskStatus +//* \brief Return CAN Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetInterruptMaskStatus( // \return CAN Interrupt Mask Status + AT91PS_CAN pCAN) // pointer to a CAN controller +{ + return pCAN->CAN_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_IsInterruptMasked +//* \brief Test if CAN Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_IsInterruptMasked( + AT91PS_CAN pCAN, // \arg pointer to a CAN controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_CAN_GetInterruptMaskStatus(pCAN) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_IsStatusSet +//* \brief Test if CAN Interrupt is Set +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_IsStatusSet( + AT91PS_CAN pCAN, // \arg pointer to a CAN controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_CAN_GetStatus(pCAN) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgModeReg +//* \brief Configure the Mode Register of the CAN controller +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgModeReg ( + AT91PS_CAN pCAN, // pointer to a CAN controller + unsigned int mode) // mode register +{ + //* Write to the MR register + pCAN->CAN_MR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetModeReg +//* \brief Return the Mode Register of the CAN controller value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetModeReg ( + AT91PS_CAN pCAN // pointer to a CAN controller + ) +{ + return pCAN->CAN_MR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgBaudrateReg +//* \brief Configure the Baudrate of the CAN controller for the network +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgBaudrateReg ( + AT91PS_CAN pCAN, // pointer to a CAN controller + unsigned int baudrate_cfg) +{ + //* Write to the BR register + pCAN->CAN_BR = baudrate_cfg; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetBaudrate +//* \brief Return the Baudrate of the CAN controller for the network value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetBaudrate ( + AT91PS_CAN pCAN // pointer to a CAN controller + ) +{ + return pCAN->CAN_BR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetInternalCounter +//* \brief Return CAN Timer Regsiter Value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetInternalCounter ( + AT91PS_CAN pCAN // pointer to a CAN controller + ) +{ + return pCAN->CAN_TIM; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetTimestamp +//* \brief Return CAN Timestamp Register Value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetTimestamp ( + AT91PS_CAN pCAN // pointer to a CAN controller + ) +{ + return pCAN->CAN_TIMESTP; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetErrorCounter +//* \brief Return CAN Error Counter Register Value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetErrorCounter ( + AT91PS_CAN pCAN // pointer to a CAN controller + ) +{ + return pCAN->CAN_ECR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_InitTransferRequest +//* \brief Request for a transfer on the corresponding mailboxes +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_InitTransferRequest ( + AT91PS_CAN pCAN, // pointer to a CAN controller + unsigned int transfer_cmd) +{ + pCAN->CAN_TCR = transfer_cmd; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_InitAbortRequest +//* \brief Abort the corresponding mailboxes +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_InitAbortRequest ( + AT91PS_CAN pCAN, // pointer to a CAN controller + unsigned int abort_cmd) +{ + pCAN->CAN_ACR = abort_cmd; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgMessageModeReg +//* \brief Program the Message Mode Register +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgMessageModeReg ( + AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox + unsigned int mode) +{ + CAN_Mailbox->CAN_MB_MMR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetMessageModeReg +//* \brief Return the Message Mode Register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetMessageModeReg ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgMessageIDReg +//* \brief Program the Message ID Register +//* \brief Version == 0 for Standard messsage, Version == 1 for Extended +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgMessageIDReg ( + AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox + unsigned int id, + unsigned char version) +{ + if(version==0) // IDvA Standard Format + CAN_Mailbox->CAN_MB_MID = id<<18; + else // IDvB Extended Format + CAN_Mailbox->CAN_MB_MID = id | (1<<29); // set MIDE bit +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetMessageIDReg +//* \brief Return the Message ID Register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetMessageIDReg ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MID; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgMessageAcceptanceMaskReg +//* \brief Program the Message Acceptance Mask Register +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgMessageAcceptanceMaskReg ( + AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox + unsigned int mask) +{ + CAN_Mailbox->CAN_MB_MAM = mask; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetMessageAcceptanceMaskReg +//* \brief Return the Message Acceptance Mask Register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetMessageAcceptanceMaskReg ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MAM; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetFamilyID +//* \brief Return the Message ID Register +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetFamilyID ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MFID; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgMessageCtrl +//* \brief Request and config for a transfer on the corresponding mailbox +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgMessageCtrlReg ( + AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox + unsigned int message_ctrl_cmd) +{ + CAN_Mailbox->CAN_MB_MCR = message_ctrl_cmd; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetMessageStatus +//* \brief Return CAN Mailbox Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetMessageStatus ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgMessageDataLow +//* \brief Program data low value +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgMessageDataLow ( + AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox + unsigned int data) +{ + CAN_Mailbox->CAN_MB_MDL = data; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetMessageDataLow +//* \brief Return data low value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetMessageDataLow ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MDL; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgMessageDataHigh +//* \brief Program data high value +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgMessageDataHigh ( + AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox + unsigned int data) +{ + CAN_Mailbox->CAN_MB_MDH = data; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_GetMessageDataHigh +//* \brief Return data high value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_CAN_GetMessageDataHigh ( + AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox +{ + return CAN_Mailbox->CAN_MB_MDH; +} + +/* ***************************************************************************** + SOFTWARE API FOR ADC + ***************************************************************************** */ +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_EnableIt +//* \brief Enable ADC interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_EnableIt ( + AT91PS_ADC pADC, // pointer to a ADC controller + unsigned int flag) // IT to be enabled +{ + //* Write to the IER register + pADC->ADC_IER = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_DisableIt +//* \brief Disable ADC interrupt +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_DisableIt ( + AT91PS_ADC pADC, // pointer to a ADC controller + unsigned int flag) // IT to be disabled +{ + //* Write to the IDR register + pADC->ADC_IDR = flag; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetStatus +//* \brief Return ADC Interrupt Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetStatus( // \return ADC Interrupt Status + AT91PS_ADC pADC) // pointer to a ADC controller +{ + return pADC->ADC_SR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetInterruptMaskStatus +//* \brief Return ADC Interrupt Mask Status +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetInterruptMaskStatus( // \return ADC Interrupt Mask Status + AT91PS_ADC pADC) // pointer to a ADC controller +{ + return pADC->ADC_IMR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_IsInterruptMasked +//* \brief Test if ADC Interrupt is Masked +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_IsInterruptMasked( + AT91PS_ADC pADC, // \arg pointer to a ADC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_ADC_GetInterruptMaskStatus(pADC) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_IsStatusSet +//* \brief Test if ADC Status is Set +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_IsStatusSet( + AT91PS_ADC pADC, // \arg pointer to a ADC controller + unsigned int flag) // \arg flag to be tested +{ + return (AT91F_ADC_GetStatus(pADC) & flag); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_CfgModeReg +//* \brief Configure the Mode Register of the ADC controller +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_CfgModeReg ( + AT91PS_ADC pADC, // pointer to a ADC controller + unsigned int mode) // mode register +{ + //* Write to the MR register + pADC->ADC_MR = mode; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetModeReg +//* \brief Return the Mode Register of the ADC controller value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetModeReg ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_MR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_CfgTimings +//* \brief Configure the different necessary timings of the ADC controller +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_CfgTimings ( + AT91PS_ADC pADC, // pointer to a ADC controller + unsigned int mck_clock, // in MHz + unsigned int adc_clock, // in MHz + unsigned int startup_time, // in us + unsigned int sample_and_hold_time) // in ns +{ + unsigned int prescal,startup,shtim; + + prescal = mck_clock/(2*adc_clock) - 1; + startup = adc_clock*startup_time/8 - 1; + shtim = adc_clock*sample_and_hold_time/1000 - 1; + + //* Write to the MR register + pADC->ADC_MR = ( (prescal<<8) & AT91C_ADC_PRESCAL) | ( (startup<<16) & AT91C_ADC_STARTUP) | ( (shtim<<24) & AT91C_ADC_SHTIM); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_EnableChannel +//* \brief Return ADC Timer Register Value +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_EnableChannel ( + AT91PS_ADC pADC, // pointer to a ADC controller + unsigned int channel) // mode register +{ + //* Write to the CHER register + pADC->ADC_CHER = channel; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_DisableChannel +//* \brief Return ADC Timer Register Value +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_DisableChannel ( + AT91PS_ADC pADC, // pointer to a ADC controller + unsigned int channel) // mode register +{ + //* Write to the CHDR register + pADC->ADC_CHDR = channel; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetChannelStatus +//* \brief Return ADC Timer Register Value +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetChannelStatus ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CHSR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_StartConversion +//* \brief Software request for a analog to digital conversion +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_StartConversion ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + pADC->ADC_CR = AT91C_ADC_START; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_SoftReset +//* \brief Software reset +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_SoftReset ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + pADC->ADC_CR = AT91C_ADC_SWRST; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetLastConvertedData +//* \brief Return the Last Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetLastConvertedData ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_LCDR; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH0 +//* \brief Return the Channel 0 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH0 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR0; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH1 +//* \brief Return the Channel 1 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH1 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR1; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH2 +//* \brief Return the Channel 2 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH2 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR2; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH3 +//* \brief Return the Channel 3 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH3 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR3; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH4 +//* \brief Return the Channel 4 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH4 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR4; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH5 +//* \brief Return the Channel 5 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH5 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR5; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH6 +//* \brief Return the Channel 6 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH6 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR6; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_GetConvertedDataCH7 +//* \brief Return the Channel 7 Converted Data +//*---------------------------------------------------------------------------- +__inline unsigned int AT91F_ADC_GetConvertedDataCH7 ( + AT91PS_ADC pADC // pointer to a ADC controller + ) +{ + return pADC->ADC_CDR7; +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_MC_CfgPMC +//* \brief Enable Peripheral clock in PMC for MC +//*---------------------------------------------------------------------------- +__inline void AT91F_MC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_DBGU_CfgPMC +//* \brief Enable Peripheral clock in PMC for DBGU +//*---------------------------------------------------------------------------- +__inline void AT91F_DBGU_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_DBGU_CfgPIO +//* \brief Configure PIO controllers to drive DBGU signals +//*---------------------------------------------------------------------------- +__inline void AT91F_DBGU_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA28_DTXD ) | + ((unsigned int) AT91C_PA27_DRXD ), // Peripheral A + 0); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWMC_CH3_CfgPIO +//* \brief Configure PIO controllers to drive PWMC_CH3 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_CH3_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB22_PWM3 ), // Peripheral A + ((unsigned int) AT91C_PB30_PWM3 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWMC_CH2_CfgPIO +//* \brief Configure PIO controllers to drive PWMC_CH2 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_CH2_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB21_PWM2 ), // Peripheral A + ((unsigned int) AT91C_PB29_PWM2 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWMC_CH1_CfgPIO +//* \brief Configure PIO controllers to drive PWMC_CH1 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_CH1_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB20_PWM1 ), // Peripheral A + ((unsigned int) AT91C_PB28_PWM1 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWMC_CH0_CfgPIO +//* \brief Configure PIO controllers to drive PWMC_CH0 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_CH0_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB19_PWM0 ), // Peripheral A + ((unsigned int) AT91C_PB27_PWM0 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_EMAC_CfgPMC +//* \brief Enable Peripheral clock in PMC for EMAC +//*---------------------------------------------------------------------------- +__inline void AT91F_EMAC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_EMAC)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_EMAC_CfgPIO +//* \brief Configure PIO controllers to drive EMAC signals +//*---------------------------------------------------------------------------- +__inline void AT91F_EMAC_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB9_EMDIO ) | + ((unsigned int) AT91C_PB17_ERXCK ) | + ((unsigned int) AT91C_PB15_ERXDV_ECRSDV) | + ((unsigned int) AT91C_PB8_EMDC ) | + ((unsigned int) AT91C_PB16_ECOL ) | + ((unsigned int) AT91C_PB7_ERXER ) | + ((unsigned int) AT91C_PB5_ERX0 ) | + ((unsigned int) AT91C_PB6_ERX1 ) | + ((unsigned int) AT91C_PB13_ERX2 ) | + ((unsigned int) AT91C_PB1_ETXEN ) | + ((unsigned int) AT91C_PB14_ERX3 ) | + ((unsigned int) AT91C_PB12_ETXER ) | + ((unsigned int) AT91C_PB2_ETX0 ) | + ((unsigned int) AT91C_PB3_ETX1 ) | + ((unsigned int) AT91C_PB10_ETX2 ) | + ((unsigned int) AT91C_PB18_EF100 ) | + ((unsigned int) AT91C_PB11_ETX3 ) | + ((unsigned int) AT91C_PB4_ECRS ) | + ((unsigned int) AT91C_PB0_ETXCK_EREFCK), // Peripheral A + 0); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_VREG_CfgPMC +//* \brief Enable Peripheral clock in PMC for VREG +//*---------------------------------------------------------------------------- +__inline void AT91F_VREG_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_CfgPMC +//* \brief Enable Peripheral clock in PMC for SSC +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SSC)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SSC_CfgPIO +//* \brief Configure PIO controllers to drive SSC signals +//*---------------------------------------------------------------------------- +__inline void AT91F_SSC_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA23_TD ) | + ((unsigned int) AT91C_PA21_TF ) | + ((unsigned int) AT91C_PA25_RK ) | + ((unsigned int) AT91C_PA24_RD ) | + ((unsigned int) AT91C_PA26_RF ) | + ((unsigned int) AT91C_PA22_TK ), // Peripheral A + 0); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI1_CfgPMC +//* \brief Enable Peripheral clock in PMC for SPI1 +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI1_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SPI1)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI1_CfgPIO +//* \brief Configure PIO controllers to drive SPI1 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI1_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PA23_SPI1_MOSI) | + ((unsigned int) AT91C_PA21_SPI1_NPCS0) | + ((unsigned int) AT91C_PA25_SPI1_NPCS1) | + ((unsigned int) AT91C_PA2_SPI1_NPCS1) | + ((unsigned int) AT91C_PA24_SPI1_MISO) | + ((unsigned int) AT91C_PA22_SPI1_SPCK) | + ((unsigned int) AT91C_PA26_SPI1_NPCS2) | + ((unsigned int) AT91C_PA3_SPI1_NPCS2) | + ((unsigned int) AT91C_PA29_SPI1_NPCS3) | + ((unsigned int) AT91C_PA4_SPI1_NPCS3)); // Peripheral B + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PB10_SPI1_NPCS1) | + ((unsigned int) AT91C_PB11_SPI1_NPCS2) | + ((unsigned int) AT91C_PB16_SPI1_NPCS3)); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI0_CfgPMC +//* \brief Enable Peripheral clock in PMC for SPI0 +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI0_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SPI0)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_SPI0_CfgPIO +//* \brief Configure PIO controllers to drive SPI0 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_SPI0_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA17_SPI0_MOSI) | + ((unsigned int) AT91C_PA12_SPI0_NPCS0) | + ((unsigned int) AT91C_PA13_SPI0_NPCS1) | + ((unsigned int) AT91C_PA16_SPI0_MISO) | + ((unsigned int) AT91C_PA14_SPI0_NPCS2) | + ((unsigned int) AT91C_PA18_SPI0_SPCK) | + ((unsigned int) AT91C_PA15_SPI0_NPCS3), // Peripheral A + ((unsigned int) AT91C_PA7_SPI0_NPCS1) | + ((unsigned int) AT91C_PA8_SPI0_NPCS2) | + ((unsigned int) AT91C_PA9_SPI0_NPCS3)); // Peripheral B + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PB13_SPI0_NPCS1) | + ((unsigned int) AT91C_PB14_SPI0_NPCS2) | + ((unsigned int) AT91C_PB17_SPI0_NPCS3)); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PWMC_CfgPMC +//* \brief Enable Peripheral clock in PMC for PWMC +//*---------------------------------------------------------------------------- +__inline void AT91F_PWMC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_PWMC)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC0_CfgPMC +//* \brief Enable Peripheral clock in PMC for TC0 +//*---------------------------------------------------------------------------- +__inline void AT91F_TC0_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_TC0)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC0_CfgPIO +//* \brief Configure PIO controllers to drive TC0 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_TC0_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB23_TIOA0 ) | + ((unsigned int) AT91C_PB24_TIOB0 ), // Peripheral A + ((unsigned int) AT91C_PB12_TCLK0 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC1_CfgPMC +//* \brief Enable Peripheral clock in PMC for TC1 +//*---------------------------------------------------------------------------- +__inline void AT91F_TC1_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_TC1)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC1_CfgPIO +//* \brief Configure PIO controllers to drive TC1 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_TC1_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB25_TIOA1 ) | + ((unsigned int) AT91C_PB26_TIOB1 ), // Peripheral A + ((unsigned int) AT91C_PB19_TCLK1 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC2_CfgPMC +//* \brief Enable Peripheral clock in PMC for TC2 +//*---------------------------------------------------------------------------- +__inline void AT91F_TC2_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_TC2)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TC2_CfgPIO +//* \brief Configure PIO controllers to drive TC2 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_TC2_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PA15_TCLK2 )); // Peripheral B + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB27_TIOA2 ) | + ((unsigned int) AT91C_PB28_TIOB2 ), // Peripheral A + 0); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PITC_CfgPMC +//* \brief Enable Peripheral clock in PMC for PITC +//*---------------------------------------------------------------------------- +__inline void AT91F_PITC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_CfgPMC +//* \brief Enable Peripheral clock in PMC for ADC +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_ADC)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_ADC_CfgPIO +//* \brief Configure PIO controllers to drive ADC signals +//*---------------------------------------------------------------------------- +__inline void AT91F_ADC_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PB18_ADTRG )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_CfgPMC +//* \brief Enable Peripheral clock in PMC for PMC +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PMC_CfgPIO +//* \brief Configure PIO controllers to drive PMC signals +//*---------------------------------------------------------------------------- +__inline void AT91F_PMC_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PA13_PCK1 ) | + ((unsigned int) AT91C_PA30_PCK2 ) | + ((unsigned int) AT91C_PA27_PCK3 )); // Peripheral B + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + ((unsigned int) AT91C_PB29_PCK1 ) | + ((unsigned int) AT91C_PB30_PCK2 ), // Peripheral A + ((unsigned int) AT91C_PB21_PCK1 ) | + ((unsigned int) AT91C_PB22_PCK2 ) | + ((unsigned int) AT91C_PB20_PCK0 ) | + ((unsigned int) AT91C_PB0_PCK0 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_RSTC_CfgPMC +//* \brief Enable Peripheral clock in PMC for RSTC +//*---------------------------------------------------------------------------- +__inline void AT91F_RSTC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_RTTC_CfgPMC +//* \brief Enable Peripheral clock in PMC for RTTC +//*---------------------------------------------------------------------------- +__inline void AT91F_RTTC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIOA_CfgPMC +//* \brief Enable Peripheral clock in PMC for PIOA +//*---------------------------------------------------------------------------- +__inline void AT91F_PIOA_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_PIOA)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_PIOB_CfgPMC +//* \brief Enable Peripheral clock in PMC for PIOB +//*---------------------------------------------------------------------------- +__inline void AT91F_PIOB_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_PIOB)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_CfgPMC +//* \brief Enable Peripheral clock in PMC for TWI +//*---------------------------------------------------------------------------- +__inline void AT91F_TWI_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_TWI)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_TWI_CfgPIO +//* \brief Configure PIO controllers to drive TWI signals +//*---------------------------------------------------------------------------- +__inline void AT91F_TWI_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA10_TWD ) | + ((unsigned int) AT91C_PA11_TWCK ), // Peripheral A + 0); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_WDTC_CfgPMC +//* \brief Enable Peripheral clock in PMC for WDTC +//*---------------------------------------------------------------------------- +__inline void AT91F_WDTC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_SYS)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US1_CfgPMC +//* \brief Enable Peripheral clock in PMC for US1 +//*---------------------------------------------------------------------------- +__inline void AT91F_US1_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_US1)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US1_CfgPIO +//* \brief Configure PIO controllers to drive US1 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_US1_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA5_RXD1 ) | + ((unsigned int) AT91C_PA6_TXD1 ) | + ((unsigned int) AT91C_PA8_RTS1 ) | + ((unsigned int) AT91C_PA7_SCK1 ) | + ((unsigned int) AT91C_PA9_CTS1 ), // Peripheral A + 0); // Peripheral B + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOB, // PIO controller base address + 0, // Peripheral A + ((unsigned int) AT91C_PB25_DTR1 ) | + ((unsigned int) AT91C_PB23_DCD1 ) | + ((unsigned int) AT91C_PB24_DSR1 ) | + ((unsigned int) AT91C_PB26_RI1 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US0_CfgPMC +//* \brief Enable Peripheral clock in PMC for US0 +//*---------------------------------------------------------------------------- +__inline void AT91F_US0_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_US0)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_US0_CfgPIO +//* \brief Configure PIO controllers to drive US0 signals +//*---------------------------------------------------------------------------- +__inline void AT91F_US0_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA0_RXD0 ) | + ((unsigned int) AT91C_PA1_TXD0 ) | + ((unsigned int) AT91C_PA3_RTS0 ) | + ((unsigned int) AT91C_PA2_SCK0 ) | + ((unsigned int) AT91C_PA4_CTS0 ), // Peripheral A + 0); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_UDP_CfgPMC +//* \brief Enable Peripheral clock in PMC for UDP +//*---------------------------------------------------------------------------- +__inline void AT91F_UDP_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_UDP)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_CfgPMC +//* \brief Enable Peripheral clock in PMC for AIC +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_IRQ0) | + ((unsigned int) 1 << AT91C_ID_FIQ) | + ((unsigned int) 1 << AT91C_ID_IRQ1)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_AIC_CfgPIO +//* \brief Configure PIO controllers to drive AIC signals +//*---------------------------------------------------------------------------- +__inline void AT91F_AIC_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA30_IRQ0 ) | + ((unsigned int) AT91C_PA29_FIQ ), // Peripheral A + ((unsigned int) AT91C_PA14_IRQ1 )); // Peripheral B +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgPMC +//* \brief Enable Peripheral clock in PMC for CAN +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgPMC (void) +{ + AT91F_PMC_EnablePeriphClock( + AT91C_BASE_PMC, // PIO controller base address + ((unsigned int) 1 << AT91C_ID_CAN)); +} + +//*---------------------------------------------------------------------------- +//* \fn AT91F_CAN_CfgPIO +//* \brief Configure PIO controllers to drive CAN signals +//*---------------------------------------------------------------------------- +__inline void AT91F_CAN_CfgPIO (void) +{ + // Configure PIO controllers to periph mode + AT91F_PIO_CfgPeriph( + AT91C_BASE_PIOA, // PIO controller base address + ((unsigned int) AT91C_PA20_CANTX ) | + ((unsigned int) AT91C_PA19_CANRX ), // Peripheral A + 0); // Peripheral B +} + +#endif // lib_AT91SAM7X256_H diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/incIAR/project.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/incIAR/project.h new file mode 100644 index 0000000..24fb698 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/incIAR/project.h @@ -0,0 +1,30 @@ +//----------------------------------------------------------------------------- +// ATMEL Microcontroller Software Support - ROUSSET - +//----------------------------------------------------------------------------- +// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +//----------------------------------------------------------------------------- +// File Name : project.h +// Object : project specific include file to AT91SAM7X256 +// Creation : JPP 14-Sep-2006 +//----------------------------------------------------------------------------- +#ifndef _PROJECT_H +#define _PROJECT_H + +/// Include your AT91 Library files and specific compiler definitions + +#include +#include "AT91SAM7X-EK.h" +#include "AT91SAM7X256.h" +#define __inline inline +#include "lib_AT91SAM7X256.h" + +#endif // _PROJECT_H diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.cspy.bat b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.cspy.bat new file mode 100644 index 0000000..aa07e50 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.cspy.bat @@ -0,0 +1,33 @@ +@REM This bat file has been generated by the IAR Embeddded Workbench +@REM C-SPY interactive debugger,as an aid to preparing a command +@REM line for running the cspybat command line utility with the +@REM appropriate settings. +@REM +@REM After making some adjustments to this file, you can launch cspybat +@REM by typing the name of this file followed by the name of the debug +@REM file (usually an ubrof file). Note that this file is generated +@REM every time a new debug session is initialized, so you may want to +@REM move or rename the file before making changes. +@REM +@REM Note: some command line arguments cannot be properly generated +@REM by this process. Specifically, the plugin which is responsible +@REM for the Terminal I/O window (and other C runtime functionality) +@REM comes in a special version for cspybat, and the name of that +@REM plugin dll is not known when generating this file. It resides in +@REM the $TOOLKIT_DIR$\bin folder and is usually called XXXbat.dll or +@REM XXXlibsupportbat.dll, where XXX is the name of the corresponding +@REM tool chain. Replace the '' parameter +@REM below with the appropriate file name. Other plugins loaded by +@REM C-SPY are usually not needed by, or will not work in, cspybat +@REM but they are listed at the end of this file for reference. + + +"C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\bin\cspybat" "C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\bin\armproc.dll" "C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\bin\armjlink.dll" %1 --plugin "C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\bin\" --macro "C:\Documents and Settings\Greg\Desktop\SAM7X256\AT91SAM7X-Interrupt_SAM7X\Compil\resource\SAM7_FLASH.mac" --backend -B "--endian=little" "--cpu=ARM7TDMI" "--fpu=None" "-p" "C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\CONFIG\debugger\Atmel\ioAT91SAM7X256.ddf" "--drv_verify_download" "--semihosting" "--device=AT91SAM7X256" "-d" "jlink" "--drv_communication=USB0" "--jlink_speed=adaptive" + + +@REM Loaded plugins: +@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\bin\armlibsupport.dll +@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\plugins\CodeCoverage\CodeCoverage.dll +@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\plugins\Profiling\Profiling.dll +@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\plugins\stack\stack.dll +@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\plugins\SymList\SymList.dll diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.dbgdt b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.dbgdt new file mode 100644 index 0000000..e068f91 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.dbgdt @@ -0,0 +1,5 @@ + + + + + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.dni b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.dni new file mode 100644 index 0000000..a4e49ac --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.dni @@ -0,0 +1,18 @@ +[JLinkDriver] +WatchCond=_ 0 +Watch0=_ 0 "" 0 "" 0 "" 0 "" 0 0 0 0 +Watch1=_ 0 "" 0 "" 0 "" 0 "" 0 0 0 0 +[TermIOLog] +LoggingEnabled=_ 0 +LogFile=_ "" +[Log file] +LoggingEnabled=_ 0 +LogFile=_ "" +Category=_ 0 +[Disassemble mode] +mode=0 +[Breakpoints] +Count=0 +[TraceHelper] +Enabled=0 +ShowSource=1 diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.wsdt b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.wsdt new file mode 100644 index 0000000..f9f15e9 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.wsdt @@ -0,0 +1,74 @@ + + + + + + BasicInterrupt_SAM7X/FLASH_Debug + + + + + + + + + 271272727 + + + 20 + 995 + 265 + 66 + + + + + + + + + + + TabID-26686-579 + Workspace + Workspace + + + BasicInterrupt_SAM7X + + + + 0 + + + TabID-13847-615 + Build + Build + + + + TabID-20936-687 + Debug Log + Debug-Log + + + + + 1 + + + + + + 0100000010000001 + + + + + + + iaridepm.enu1-2-2612345-2-2200200144300234192250361718970-2-21981388-2-213902001002886234192144300234192 + + + + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X_FLASH_Debug.jlink b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X_FLASH_Debug.jlink new file mode 100644 index 0000000..ecbb0a8 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X_FLASH_Debug.jlink @@ -0,0 +1,12 @@ +[FLASH] +SkipProgOnCRCMatch = 1 +VerifyDownload = 1 +AllowCaching = 1 +EnableFlashDL = 2 +Override = 0 +Device="ADUC7020X62" +[BREAKPOINTS] +ShowInfoWin = 1 +EnableFlashBP = 2 +[CPU] +AllowSimulation = 1 diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo.cspy.bat b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo.cspy.bat new file mode 100644 index 0000000..0e4d177 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo.cspy.bat @@ -0,0 +1,33 @@ +@REM This bat file has been generated by the IAR Embeddded Workbench +@REM C-SPY interactive debugger,as an aid to preparing a command +@REM line for running the cspybat command line utility with the +@REM appropriate settings. +@REM +@REM After making some adjustments to this file, you can launch cspybat +@REM by typing the name of this file followed by the name of the debug +@REM file (usually an ubrof file). Note that this file is generated +@REM every time a new debug session is initialized, so you may want to +@REM move or rename the file before making changes. +@REM +@REM Note: some command line arguments cannot be properly generated +@REM by this process. Specifically, the plugin which is responsible +@REM for the Terminal I/O window (and other C runtime functionality) +@REM comes in a special version for cspybat, and the name of that +@REM plugin dll is not known when generating this file. It resides in +@REM the $TOOLKIT_DIR$\bin folder and is usually called XXXbat.dll or +@REM XXXlibsupportbat.dll, where XXX is the name of the corresponding +@REM tool chain. Replace the '' parameter +@REM below with the appropriate file name. Other plugins loaded by +@REM C-SPY are usually not needed by, or will not work in, cspybat +@REM but they are listed at the end of this file for reference. + + +"C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\bin\cspybat" "C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\bin\armproc.dll" "C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\bin\armjlink.dll" %1 --plugin "C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\bin\" --macro "C:\svn\cmock\iar\iar_v5\Resource\SAM7_RAM.mac" --backend -B "--endian=little" "--cpu=ARM7TDMI" "--fpu=None" "-p" "C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\CONFIG\debugger\Atmel\ioAT91SAM7X256.ddf" "--drv_verify_download" "--semihosting" "--device=AT91SAM7X256" "-d" "jlink" "--drv_communication=USB0" "--jlink_speed=adaptive" + + +@REM Loaded plugins: +@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\bin\armlibsupport.dll +@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\plugins\CodeCoverage\CodeCoverage.dll +@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\plugins\Profiling\Profiling.dll +@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\plugins\stack\stack.dll +@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\plugins\SymList\SymList.dll diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo.dbgdt b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo.dbgdt new file mode 100644 index 0000000..b521f67 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo.dbgdt @@ -0,0 +1,85 @@ + + + + + + + + 20 + 995 + 265 + 66 + + + + + + + + 124272727 + + + + + 10 + + + + + + + + + TabID-27249-27051 + Debug Log + Debug-Log + + + + TabID-4707-27064 + Build + Build + + + + + 0 + + + TabID-5230-27054 + Workspace + Workspace + + + cmock_demo + + + + 0 + + + TabID-15978-27058 + Disassembly + Disassembly + + + + + 0 + + + + + + TextEditorC:\svn\cmock\examples\src\Main.c0258358350TextEditorC:\svn\cmock\examples\src\TaskScheduler.c0439819810100000010000001 + + + + + + + iaridepm.enu1debuggergui.enu1-2-2588198-2-2200200144300234192144300690867-2-2588198-2-2200200144300234192144300690867-2-21981388-2-213902001002886234192144300234192 + + + + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo.dni b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo.dni new file mode 100644 index 0000000..84237e1 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo.dni @@ -0,0 +1,44 @@ +[JLinkDriver] +WatchCond=_ 0 +Watch0=_ 0 "" 0 "" 0 "" 0 "" 0 0 0 0 +Watch1=_ 0 "" 0 "" 0 "" 0 "" 0 0 0 0 +[DisAssemblyWindow] +NumStates=_ 1 +State 1=_ 1 +[CodeCoverage] +Enabled=_ 0 +[Profiling] +Enabled=0 +[StackPlugin] +Enabled=1 +OverflowWarningsEnabled=1 +WarningThreshold=90 +SpWarningsEnabled=1 +WarnHow=0 +UseTrigger=1 +TriggerName=main +LimitSize=0 +ByteLimit=50 +[Interrupts] +Enabled=1 +[MemoryMap] +Enabled=0 +Base=0 +UseAuto=0 +TypeViolation=1 +UnspecRange=1 +ActionState=1 +[Log file] +LoggingEnabled=_ 0 +LogFile=_ "" +Category=_ 0 +[TermIOLog] +LoggingEnabled=_ 0 +LogFile=_ "" +[Disassemble mode] +mode=0 +[Breakpoints] +Count=0 +[TraceHelper] +Enabled=0 +ShowSource=1 diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo.wsdt b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo.wsdt new file mode 100644 index 0000000..c1a7704 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo.wsdt @@ -0,0 +1,73 @@ + + + + + + cmock_demo/RAM_Debug + + + + + + + + 2099526566 + + + + + + + 216272727 + + + + + + + + + + TabID-7530-24964 + Build + Build + + + + TabID-25388-26881 + Debug Log + Debug-Log + + + + + 0 + + + TabID-18278-24968 + Workspace + Workspace + + + cmock_democmock_demo/Sourcecmock_demo/srccmock_demo/srcIAR + + + + 0 + + + + + + TextEditorC:\svn\cmock\examples\src\Main.c02582082000100000010000001 + + + + + + + iaridepm.enu1-2-2513307-2-2200200144300234192222944603044-2-22971388-2-213902991002886350117144300234192 + + + + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo_Binary.jlink b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo_Binary.jlink new file mode 100644 index 0000000..ecbb0a8 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo_Binary.jlink @@ -0,0 +1,12 @@ +[FLASH] +SkipProgOnCRCMatch = 1 +VerifyDownload = 1 +AllowCaching = 1 +EnableFlashDL = 2 +Override = 0 +Device="ADUC7020X62" +[BREAKPOINTS] +ShowInfoWin = 1 +EnableFlashBP = 2 +[CPU] +AllowSimulation = 1 diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo_FLASH_Debug.jlink b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo_FLASH_Debug.jlink new file mode 100644 index 0000000..ecbb0a8 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo_FLASH_Debug.jlink @@ -0,0 +1,12 @@ +[FLASH] +SkipProgOnCRCMatch = 1 +VerifyDownload = 1 +AllowCaching = 1 +EnableFlashDL = 2 +Override = 0 +Device="ADUC7020X62" +[BREAKPOINTS] +ShowInfoWin = 1 +EnableFlashBP = 2 +[CPU] +AllowSimulation = 1 diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo_RAM_Debug.jlink b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo_RAM_Debug.jlink new file mode 100644 index 0000000..ecbb0a8 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/settings/cmock_demo_RAM_Debug.jlink @@ -0,0 +1,12 @@ +[FLASH] +SkipProgOnCRCMatch = 1 +VerifyDownload = 1 +AllowCaching = 1 +EnableFlashDL = 2 +Override = 0 +Device="ADUC7020X62" +[BREAKPOINTS] +ShowInfoWin = 1 +EnableFlashBP = 2 +[CPU] +AllowSimulation = 1 diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/srcIAR/Cstartup.s b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/srcIAR/Cstartup.s new file mode 100644 index 0000000..7113c80 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/srcIAR/Cstartup.s @@ -0,0 +1,299 @@ +;* ---------------------------------------------------------------------------- +;* ATMEL Microcontroller Software Support - ROUSSET - +;* ---------------------------------------------------------------------------- +;* Copyright (c) 2006, Atmel Corporation +; +;* All rights reserved. +;* +;* Redistribution and use in source and binary forms, with or without +;* modification, are permitted provided that the following conditions are met: +;* +;* - Redistributions of source code must retain the above copyright notice, +;* this list of conditions and the disclaimer below. +;* +;* - Redistributions in binary form must reproduce the above copyright notice, +;* this list of conditions and the disclaimer below in the documentation and/or +;* other materials provided with the distribution. +;* +;* Atmel's name may not be used to endorse or promote products derived from +;* this software without specific prior written permission. +;* +;* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +;* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +;* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +;* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +;* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +;* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +;* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +;* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +;* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +;* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +;* ---------------------------------------------------------------------------- + +;------------------------------------------------------------------------------ +; Include your AT91 Library files +;------------------------------------------------------------------------------ +#include "AT91SAM7X256_inc.h" +;------------------------------------------------------------------------------ + +#define TOP_OF_MEMORY (AT91C_ISRAM + AT91C_ISRAM_SIZE) +#define IRQ_STACK_SIZE (3*8*4) + ; 3 words to be saved per interrupt priority level + +; Mode, correspords to bits 0-5 in CPSR +MODE_BITS DEFINE 0x1F ; Bit mask for mode bits in CPSR +USR_MODE DEFINE 0x10 ; User mode +FIQ_MODE DEFINE 0x11 ; Fast Interrupt Request mode +IRQ_MODE DEFINE 0x12 ; Interrupt Request mode +SVC_MODE DEFINE 0x13 ; Supervisor mode +ABT_MODE DEFINE 0x17 ; Abort mode +UND_MODE DEFINE 0x1B ; Undefined Instruction mode +SYS_MODE DEFINE 0x1F ; System mode + +I_BIT DEFINE 0x80 +F_BIT DEFINE 0x40 + +;------------------------------------------------------------------------------ +; ?RESET +; Reset Vector. +; Normally, segment INTVEC is linked at address 0. +; For debugging purposes, INTVEC may be placed at other addresses. +; A debugger that honors the entry point will start the +; program in a normal way even if INTVEC is not at address 0. +;------------------------------------------------------------------------------ + SECTION .intvec:CODE:NOROOT(2) + PUBLIC __vector + PUBLIC __iar_program_start + + ARM +__vector: + ldr pc,[pc,#+24] ;; Reset +__und_handler: + ldr pc,[pc,#+24] ;; Undefined instructions +__swi_handler: + ldr pc,[pc,#+24] ;; Software interrupt (SWI/SVC) +__prefetch_handler: + ldr pc,[pc,#+24] ;; Prefetch abort +__data_handler: + ldr pc,[pc,#+24] ;; Data abort + DC32 0xFFFFFFFF ;; RESERVED +__irq_handler: + ldr pc,[pc,#+24] ;; IRQ +__fiq_handler: + ldr pc,[pc,#+24] ;; FIQ + + DC32 __iar_program_start + DC32 __und_handler + DC32 __swi_handler + DC32 __prefetch_handler + DC32 __data_handler + B . + DC32 IRQ_Handler_Entry + DC32 FIQ_Handler_Entry + +;------------------------------------------------------------------------------ +;- Manage exception: The exception must be ensure in ARM mode +;------------------------------------------------------------------------------ + SECTION text:CODE:NOROOT(2) + ARM +;------------------------------------------------------------------------------ +;- Function : FIQ_Handler_Entry +;- Treatments : FIQ Controller Interrupt Handler. +;- R8 is initialize in Cstartup +;- Called Functions : None only by FIQ +;------------------------------------------------------------------------------ +FIQ_Handler_Entry: + +;- Switch in SVC/User Mode to allow User Stack access for C code +; because the FIQ is not yet acknowledged + +;- Save and r0 in FIQ_Register + mov r9,r0 + ldr r0 , [r8, #AIC_FVR] + msr CPSR_c,#I_BIT | F_BIT | SVC_MODE +;- Save scratch/used registers and LR in User Stack + stmfd sp!, { r1-r3, r12, lr} + +;- Branch to the routine pointed by the AIC_FVR + mov r14, pc + bx r0 + +;- Restore scratch/used registers and LR from User Stack + ldmia sp!, { r1-r3, r12, lr} + +;- Leave Interrupts disabled and switch back in FIQ mode + msr CPSR_c, #I_BIT | F_BIT | FIQ_MODE + +;- Restore the R0 ARM_MODE_SVC register + mov r0,r9 + +;- Restore the Program Counter using the LR_fiq directly in the PC + subs pc,lr,#4 +;------------------------------------------------------------------------------ +;- Function : IRQ_Handler_Entry +;- Treatments : IRQ Controller Interrupt Handler. +;- Called Functions : AIC_IVR[interrupt] +;------------------------------------------------------------------------------ +IRQ_Handler_Entry: +;------------------------- +;- Manage Exception Entry +;------------------------- +;- Adjust and save LR_irq in IRQ stack + sub lr, lr, #4 + stmfd sp!, {lr} + +;- Save r0 and SPSR (need to be saved for nested interrupt) + mrs r14, SPSR + stmfd sp!, {r0,r14} + +;- Write in the IVR to support Protect Mode +;- No effect in Normal Mode +;- De-assert the NIRQ and clear the source in Protect Mode + ldr r14, =AT91C_BASE_AIC + ldr r0 , [r14, #AIC_IVR] + str r14, [r14, #AIC_IVR] + +;- Enable Interrupt and Switch in Supervisor Mode + msr CPSR_c, #SVC_MODE + +;- Save scratch/used registers and LR in User Stack + stmfd sp!, { r1-r3, r12, r14} + +;---------------------------------------------- +;- Branch to the routine pointed by the AIC_IVR +;---------------------------------------------- + mov r14, pc + bx r0 + +;---------------------------------------------- +;- Manage Exception Exit +;---------------------------------------------- +;- Restore scratch/used registers and LR from User Stack + ldmia sp!, { r1-r3, r12, r14} + +;- Disable Interrupt and switch back in IRQ mode + msr CPSR_c, #I_BIT | IRQ_MODE + +;- Mark the End of Interrupt on the AIC + ldr r14, =AT91C_BASE_AIC + str r14, [r14, #AIC_EOICR] + +;- Restore SPSR_irq and r0 from IRQ stack + ldmia sp!, {r0,r14} + msr SPSR_cxsf, r14 + +;- Restore adjusted LR_irq from IRQ stack directly in the PC + ldmia sp!, {pc}^ + +;------------------------------------------------------------------------------ +;- Exception Vectors +;------------------------------------------------------------------------------ + PUBLIC AT91F_Default_FIQ_handler + PUBLIC AT91F_Default_IRQ_handler + PUBLIC AT91F_Spurious_handler + + ARM ; Always ARM mode after exeption + +AT91F_Default_FIQ_handler + b AT91F_Default_FIQ_handler + +AT91F_Default_IRQ_handler + b AT91F_Default_IRQ_handler + +AT91F_Spurious_handler + b AT91F_Spurious_handler + + +;------------------------------------------------------------------------------ +; ?INIT +; Program entry. +;------------------------------------------------------------------------------ + + SECTION FIQ_STACK:DATA:NOROOT(3) + SECTION IRQ_STACK:DATA:NOROOT(3) + SECTION SVC_STACK:DATA:NOROOT(3) + SECTION ABT_STACK:DATA:NOROOT(3) + SECTION UND_STACK:DATA:NOROOT(3) + SECTION CSTACK:DATA:NOROOT(3) + SECTION text:CODE:NOROOT(2) + REQUIRE __vector + EXTERN ?main + PUBLIC __iar_program_start + EXTERN AT91F_LowLevelInit + + +__iar_program_start: + +;------------------------------------------------------------------------------ +;- Low level Init is performed in a C function: AT91F_LowLevelInit +;- Init Stack Pointer to a valid memory area before calling AT91F_LowLevelInit +;------------------------------------------------------------------------------ + +;- Retrieve end of RAM address + + ldr r13,=TOP_OF_MEMORY ;- Temporary stack in internal RAM for Low Level Init execution + ldr r0,=AT91F_LowLevelInit + mov lr, pc + bx r0 ;- Branch on C function (with interworking) + +; Initialize the stack pointers. +; The pattern below can be used for any of the exception stacks: +; FIQ, IRQ, SVC, ABT, UND, SYS. +; The USR mode uses the same stack as SYS. +; The stack segments must be defined in the linker command file, +; and be declared above. + + mrs r0,cpsr ; Original PSR value + bic r0,r0,#MODE_BITS ; Clear the mode bits + orr r0,r0,#SVC_MODE ; Set SVC mode bits + msr cpsr_c,r0 ; Change the mode + ldr sp,=SFE(SVC_STACK) ; End of SVC_STACK + + bic r0,r0,#MODE_BITS ; Clear the mode bits + orr r0,r0,#UND_MODE ; Set UND mode bits + msr cpsr_c,r0 ; Change the mode + ldr sp,=SFE(UND_STACK) ; End of UND_STACK + + bic r0,r0,#MODE_BITS ; Clear the mode bits + orr r0,r0,#ABT_MODE ; Set ABT mode bits + msr cpsr_c,r0 ; Change the mode + ldr sp,=SFE(ABT_STACK) ; End of ABT_STACK + + bic r0,r0,#MODE_BITS ; Clear the mode bits + orr r0,r0,#FIQ_MODE ; Set FIQ mode bits + msr cpsr_c,r0 ; Change the mode + ldr sp,=SFE(FIQ_STACK) ; End of FIQ_STACK + ;- Init the FIQ register + ldr r8, =AT91C_BASE_AIC + + bic r0,r0,#MODE_BITS ; Clear the mode bits + orr r0,r0,#IRQ_MODE ; Set IRQ mode bits + msr cpsr_c,r0 ; Change the mode + ldr sp,=SFE(IRQ_STACK) ; End of IRQ_STACK + + bic r0,r0,#MODE_BITS ; Clear the mode bits + orr r0,r0,#SYS_MODE ; Set System mode bits + msr cpsr_c,r0 ; Change the mode + ldr sp,=SFE(CSTACK) ; End of CSTACK + +#ifdef __ARMVFP__ +; Enable the VFP coprocessor. + mov r0, #0x40000000 ; Set EN bit in VFP + fmxr fpexc, r0 ; FPEXC, clear others. + +; Disable underflow exceptions by setting flush to zero mode. +; For full IEEE 754 underflow compliance this code should be removed +; and the appropriate exception handler installed. + mov r0, #0x01000000 ; Set FZ bit in VFP + fmxr fpscr, r0 ; FPSCR, clear others. +#endif + +; Add more initialization here + + +; Continue to ?main for more IAR specific system startup + + ldr r0,=?main + bx r0 + + END ;- Terminates the assembly of the last module in a file diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/srcIAR/Cstartup_SAM7.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/srcIAR/Cstartup_SAM7.c new file mode 100644 index 0000000..a7c72b9 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/iar/iar_v5/srcIAR/Cstartup_SAM7.c @@ -0,0 +1,98 @@ +//----------------------------------------------------------------------------- +// ATMEL Microcontroller Software Support - ROUSSET - +//----------------------------------------------------------------------------- +// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +//----------------------------------------------------------------------------- +// File Name : Cstartup_SAM7.c +// Object : Low level initialisations written in C for Tools +// For AT91SAM7X256 with 2 flash plane +// Creation : JPP 14-Sep-2006 +//----------------------------------------------------------------------------- + +#include "project.h" + + +// The following functions must be write in ARM mode this function called +// directly by exception vector +extern void AT91F_Spurious_handler(void); +extern void AT91F_Default_IRQ_handler(void); +extern void AT91F_Default_FIQ_handler(void); + +//*---------------------------------------------------------------------------- +//* \fn AT91F_LowLevelInit +//* \brief This function performs very low level HW initialization +//* this function can use a Stack, depending the compilation +//* optimization mode +//*---------------------------------------------------------------------------- +void AT91F_LowLevelInit(void) @ "ICODE" +{ + unsigned char i; + /////////////////////////////////////////////////////////////////////////// + // EFC Init + /////////////////////////////////////////////////////////////////////////// + AT91C_BASE_MC->MC_FMR = AT91C_MC_FWS_1FWS ; + + /////////////////////////////////////////////////////////////////////////// + // Init PMC Step 1. Enable Main Oscillator + // Main Oscillator startup time is board specific: + // Main Oscillator Startup Time worst case (3MHz) corresponds to 15ms + // (0x40 for AT91C_CKGR_OSCOUNT field) + /////////////////////////////////////////////////////////////////////////// + AT91C_BASE_PMC->PMC_MOR = (( AT91C_CKGR_OSCOUNT & (0x40 <<8) | AT91C_CKGR_MOSCEN )); + // Wait Main Oscillator stabilization + while(!(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MOSCS)); + + /////////////////////////////////////////////////////////////////////////// + // Init PMC Step 2. + // Set PLL to 96MHz (96,109MHz) and UDP Clock to 48MHz + // PLL Startup time depends on PLL RC filter: worst case is choosen + // UDP Clock (48,058MHz) is compliant with the Universal Serial Bus + // Specification (+/- 0.25% for full speed) + /////////////////////////////////////////////////////////////////////////// + AT91C_BASE_PMC->PMC_PLLR = AT91C_CKGR_USBDIV_1 | + (16 << 8) | + (AT91C_CKGR_MUL & (72 << 16)) | + (AT91C_CKGR_DIV & 14); + // Wait for PLL stabilization + while( !(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_LOCK) ); + // Wait until the master clock is established for the case we already + // turn on the PLL + while( !(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MCKRDY) ); + + /////////////////////////////////////////////////////////////////////////// + // Init PMC Step 3. + // Selection of Master Clock MCK equal to (Processor Clock PCK) PLL/2=48MHz + // The PMC_MCKR register must not be programmed in a single write operation + // (see. Product Errata Sheet) + /////////////////////////////////////////////////////////////////////////// + AT91C_BASE_PMC->PMC_MCKR = AT91C_PMC_PRES_CLK_2; + // Wait until the master clock is established + while( !(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MCKRDY) ); + + AT91C_BASE_PMC->PMC_MCKR |= AT91C_PMC_CSS_PLL_CLK; + // Wait until the master clock is established + while( !(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MCKRDY) ); + + /////////////////////////////////////////////////////////////////////////// + // Disable Watchdog (write once register) + /////////////////////////////////////////////////////////////////////////// + AT91C_BASE_WDTC->WDTC_WDMR = AT91C_WDTC_WDDIS; + + /////////////////////////////////////////////////////////////////////////// + // Init AIC: assign corresponding handler for each interrupt source + /////////////////////////////////////////////////////////////////////////// + AT91C_BASE_AIC->AIC_SVR[0] = (int) AT91F_Default_FIQ_handler ; + for (i = 1; i < 31; i++) { + AT91C_BASE_AIC->AIC_SVR[i] = (int) AT91F_Default_IRQ_handler ; + } + AT91C_BASE_AIC->AIC_SPU = (unsigned int) AT91F_Spurious_handler; +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/lib/cmock.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/lib/cmock.rb new file mode 100644 index 0000000..e332351 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/lib/cmock.rb @@ -0,0 +1,65 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +[ "../config/production_environment", + "cmock_header_parser", + "cmock_generator", + "cmock_file_writer", + "cmock_config", + "cmock_plugin_manager", + "cmock_generator_utils", + "cmock_unityhelper_parser"].each {|req| require "#{File.expand_path(File.dirname(__FILE__))}/#{req}"} + +class CMock + + def initialize(options=nil) + cm_config = CMockConfig.new(options) + cm_unityhelper = CMockUnityHelperParser.new(cm_config) + cm_writer = CMockFileWriter.new(cm_config) + cm_gen_utils = CMockGeneratorUtils.new(cm_config, {:unity_helper => cm_unityhelper}) + cm_gen_plugins = CMockPluginManager.new(cm_config, cm_gen_utils) + @cm_parser = CMockHeaderParser.new(cm_config) + @cm_generator = CMockGenerator.new(cm_config, cm_writer, cm_gen_utils, cm_gen_plugins) + @silent = (cm_config.verbosity < 2) + end + + def setup_mocks(files) + [files].flatten.each do |src| + generate_mock src + end + end + + private ############################### + + def generate_mock(src) + name = File.basename(src, '.h') + puts "Creating mock for #{name}..." unless @silent + @cm_generator.create_mock(name, @cm_parser.parse(name, File.read(src))) + end +end + + # Command Line Support ############################### + +if ($0 == __FILE__) + usage = "usage: ruby #{__FILE__} (-oOptionsFile) File(s)ToMock" + + if (!ARGV[0]) + puts usage + exit 1 + end + + options = nil + filelist = [] + ARGV.each do |arg| + if (arg =~ /^-o(\w*)/) + options = arg.gsub(/^-o/,'') + else + filelist << arg + end + end + + CMock.new(options).setup_mocks(filelist) +end \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/lib/cmock_config.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/lib/cmock_config.rb new file mode 100644 index 0000000..d574a70 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/lib/cmock_config.rb @@ -0,0 +1,123 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +class CMockConfig + + CMockDefaultOptions = + { + :framework => :unity, + :mock_path => 'mocks', + :mock_prefix => 'Mock', + :plugins => [], + :strippables => ['(?:__attribute__\s*\(+.*?\)+)'], + :attributes => ['__ramfunc', '__irq', '__fiq', 'register', 'extern'], + :enforce_strict_ordering => false, + :unity_helper => false, + :treat_as => {}, + :treat_as_void => [], + :memcmp_if_unknown => true, + :when_no_prototypes => :warn, #the options being :ignore, :warn, or :error + :when_ptr => :compare_data, #the options being :compare_ptr, :compare_data, or :smart + :verbosity => 2, #the options being 0 errors only, 1 warnings and errors, 2 normal info, 3 verbose + :treat_externs => :exclude, #the options being :include or :exclude + :ignore => :args_and_calls, #the options being :args_and_calls or :args_only + :callback_include_count => true, + :callback_after_arg_check => false, + :includes => nil, + :includes_h_pre_orig_header => nil, + :includes_h_post_orig_header => nil, + :includes_c_pre_header => nil, + :includes_c_post_header => nil, + } + + def initialize(options=nil) + case(options) + when NilClass then options = CMockDefaultOptions.clone + when String then options = CMockDefaultOptions.clone.merge(load_config_file_from_yaml(options)) + when Hash then options = CMockDefaultOptions.clone.merge(options) + else raise "If you specify arguments, it should be a filename or a hash of options" + end + + #do some quick type verification + [:plugins, :attributes, :treat_as_void].each do |opt| + unless (options[opt].class == Array) + options[opt] = [] + puts "WARNING: :#{opt.to_s} should be an array." unless (options[:verbosity] < 1) + end + end + [:includes, :includes_h_pre_orig_header, :includes_h_post_orig_header, :includes_c_pre_header, :includes_c_post_header].each do |opt| + unless (options[opt].nil? or (options[opt].class == Array)) + options[opt] = [] + puts "WARNING: :#{opt.to_s} should be an array." unless (options[:verbosity] < 1) + end + end + options[:plugins].compact! + options[:plugins].map! {|p| p.to_sym} + @options = options + @options[:treat_as].merge!(standard_treat_as_map) + @options.each_key { |key| eval("def #{key.to_s}() return @options[:#{key.to_s}] end") } + end + + def load_config_file_from_yaml yaml_filename + require 'yaml' + require 'fileutils' + YAML.load_file(yaml_filename)[:cmock] + end + + def set_path(path) + @src_path = path + end + + def load_unity_helper + return File.new(@options[:unity_helper]).read if (@options[:unity_helper]) + return nil + end + + def standard_treat_as_map + { + 'int' => 'INT', + 'char' => 'INT8', + 'short' => 'INT16', + 'long' => 'INT', + 'int8' => 'INT8', + 'int16' => 'INT16', + 'int32' => 'INT', + 'int8_t' => 'INT8', + 'int16_t' => 'INT16', + 'int32_t' => 'INT', + 'INT8_T' => 'INT8', + 'INT16_T' => 'INT16', + 'INT32_T' => 'INT', + 'bool' => 'INT', + 'bool_t' => 'INT', + 'BOOL' => 'INT', + 'BOOL_T' => 'INT', + 'unsigned int' => 'HEX32', + 'unsigned long' => 'HEX32', + 'uint32' => 'HEX32', + 'uint32_t' => 'HEX32', + 'UINT32' => 'HEX32', + 'UINT32_T' => 'HEX32', + 'void*' => 'PTR', + 'unsigned short' => 'HEX16', + 'uint16' => 'HEX16', + 'uint16_t' => 'HEX16', + 'UINT16' => 'HEX16', + 'UINT16_T' => 'HEX16', + 'unsigned char' => 'HEX8', + 'uint8' => 'HEX8', + 'uint8_t' => 'HEX8', + 'UINT8' => 'HEX8', + 'UINT8_T' => 'HEX8', + 'char*' => 'STRING', + 'pCHAR' => 'STRING', + 'cstring' => 'STRING', + 'CSTRING' => 'STRING', + 'float' => 'FLOAT', + 'double' => 'FLOAT', + } + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/lib/cmock_file_writer.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/lib/cmock_file_writer.rb new file mode 100644 index 0000000..63faee5 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/lib/cmock_file_writer.rb @@ -0,0 +1,33 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +class CMockFileWriter + + attr_reader :config + + def initialize(config) + @config = config + end + + def create_file(filename) + raise "Where's the block of data to create?" unless block_given? + full_file_name_temp = "#{@config.mock_path}/#{filename}.new" + full_file_name_done = "#{@config.mock_path}/#{filename}" + File.open(full_file_name_temp, 'w') do |file| + yield(file, filename) + end + update_file(full_file_name_done, full_file_name_temp) + end + + private ################################### + + def update_file(dest, src) + require 'fileutils' + FileUtils.rm(dest) if (File.exist?(dest)) + FileUtils.cp(src, dest) + FileUtils.rm(src) + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/lib/cmock_generator.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/lib/cmock_generator.rb new file mode 100644 index 0000000..5f483ba --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/lib/cmock_generator.rb @@ -0,0 +1,196 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +$here = File.dirname __FILE__ + +class CMockGenerator + + attr_accessor :config, :file_writer, :module_name, :mock_name, :utils, :plugins, :ordered + + def initialize(config, file_writer, utils, plugins) + @file_writer = file_writer + @utils = utils + @plugins = plugins + @config = config + @prefix = @config.mock_prefix + @ordered = @config.enforce_strict_ordering + @framework = @config.framework.to_s + + @includes_h_pre_orig_header = (@config.includes || @config.includes_h_pre_orig_header || []).map{|h| h =~ /\n" + file << "#include \n" + file << "#include \n" + file << "#include \"#{@framework}.h\"\n" + file << "#include \"cmock.h\"\n" + @includes_c_pre_header.each {|inc| file << "#include #{inc}\n"} + file << "#include \"#{header_file}\"\n" + @includes_c_post_header.each {|inc| file << "#include #{inc}\n"} + file << "\n" + end + + def create_instance_structure(file, functions) + functions.each do |function| + file << "typedef struct _CMOCK_#{function[:name]}_CALL_INSTANCE\n{\n" + file << " UNITY_LINE_TYPE LineNumber;\n" + file << @plugins.run(:instance_typedefs, function) + file << "\n} CMOCK_#{function[:name]}_CALL_INSTANCE;\n\n" + end + file << "static struct #{@mock_name}Instance\n{\n" + if (functions.size == 0) + file << " unsigned char placeHolder;\n" + end + functions.each do |function| + file << @plugins.run(:instance_structure, function) + file << " CMOCK_MEM_INDEX_TYPE #{function[:name]}_CallInstance;\n" + end + file << "} Mock;\n\n" + end + + def create_extern_declarations(file) + file << "extern jmp_buf AbortFrame;\n" + if (@ordered) + file << "extern int GlobalExpectCount;\n" + file << "extern int GlobalVerifyOrder;\n" + end + file << "\n" + end + + def create_mock_verify_function(file, functions) + file << "void #{@mock_name}_Verify(void)\n{\n" + verifications = functions.collect {|function| @plugins.run(:mock_verify, function)}.join + file << " UNITY_LINE_TYPE cmock_line = TEST_LINE_NUM;\n" unless verifications.empty? + file << verifications + file << "}\n\n" + end + + def create_mock_init_function(file) + file << "void #{@mock_name}_Init(void)\n{\n" + file << " #{@mock_name}_Destroy();\n" + file << "}\n\n" + end + + def create_mock_destroy_function(file, functions) + file << "void #{@mock_name}_Destroy(void)\n{\n" + file << " CMock_Guts_MemFreeAll();\n" + file << " memset(&Mock, 0, sizeof(Mock));\n" + file << functions.collect {|function| @plugins.run(:mock_destroy, function)}.join + if (@ordered) + file << " GlobalExpectCount = 0;\n" + file << " GlobalVerifyOrder = 0;\n" + end + file << "}\n\n" + end + + def create_mock_implementation(file, function) + # prepare return value and arguments + if (function[:modifier].empty?) + function_mod_and_rettype = function[:return][:type] + else + function_mod_and_rettype = function[:modifier] + ' ' + function[:return][:type] + end + args_string = function[:args_string] + args_string += (", " + function[:var_arg]) unless (function[:var_arg].nil?) + + # Create mock function + file << "#{function_mod_and_rettype} #{function[:name]}(#{args_string})\n" + file << "{\n" + file << " UNITY_LINE_TYPE cmock_line = TEST_LINE_NUM;\n" + file << " CMOCK_#{function[:name]}_CALL_INSTANCE* cmock_call_instance = (CMOCK_#{function[:name]}_CALL_INSTANCE*)CMock_Guts_GetAddressFor(Mock.#{function[:name]}_CallInstance);\n" + file << " Mock.#{function[:name]}_CallInstance = CMock_Guts_MemNext(Mock.#{function[:name]}_CallInstance);\n" + file << @plugins.run(:mock_implementation_precheck, function) + file << " UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, \"Function '#{function[:name]}' called more times than expected.\");\n" + file << " cmock_line = cmock_call_instance->LineNumber;\n" + if (@ordered) + file << " if (cmock_call_instance->CallOrder > ++GlobalVerifyOrder)\n" + file << " UNITY_TEST_FAIL(cmock_line, \"Function '#{function[:name]}' called earlier than expected.\");" + file << " if (cmock_call_instance->CallOrder < GlobalVerifyOrder)\n" + file << " UNITY_TEST_FAIL(cmock_line, \"Function '#{function[:name]}' called later than expected.\");" + # file << " UNITY_TEST_ASSERT((cmock_call_instance->CallOrder == ++GlobalVerifyOrder), cmock_line, \"Out of order function calls. Function '#{function[:name]}'\");\n" + end + file << @plugins.run(:mock_implementation, function) + file << " return cmock_call_instance->ReturnVal;\n" unless (function[:return][:void?]) + file << "}\n\n" + end + + def create_mock_interfaces(file, function) + file << @utils.code_add_argument_loader(function) + file << @plugins.run(:mock_interfaces, function) + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_array.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_array.rb new file mode 100644 index 0000000..25045a2 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_array.rb @@ -0,0 +1,57 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +class CMockGeneratorPluginArray + + attr_reader :priority + attr_accessor :config, :utils, :unity_helper, :ordered + def initialize(config, utils) + @config = config + @ptr_handling = @config.when_ptr + @ordered = @config.enforce_strict_ordering + @utils = utils + @unity_helper = @utils.helpers[:unity_helper] + @priority = 8 + end + + def instance_typedefs(function) + function[:args].inject("") do |all, arg| + (arg[:ptr?]) ? all + " int Expected_#{arg[:name]}_Depth;\n" : all + end + end + + def mock_function_declarations(function) + return nil unless function[:contains_ptr?] + args_call = function[:args].map{|m| m[:ptr?] ? "#{m[:name]}, #{m[:name]}_Depth" : "#{m[:name]}"}.join(', ') + args_string = function[:args].map{|m| m[:ptr?] ? "#{m[:type]} #{m[:name]}, int #{m[:name]}_Depth" : "#{m[:type]} #{m[:name]}"}.join(', ') + if (function[:return][:void?]) + return "#define #{function[:name]}_ExpectWithArray(#{args_call}) #{function[:name]}_CMockExpectWithArray(__LINE__, #{args_call})\n" + + "void #{function[:name]}_CMockExpectWithArray(UNITY_LINE_TYPE cmock_line, #{args_string});\n" + else + return "#define #{function[:name]}_ExpectWithArrayAndReturn(#{args_call}, cmock_retval) #{function[:name]}_CMockExpectWithArrayAndReturn(__LINE__, #{args_call}, cmock_retval)\n" + + "void #{function[:name]}_CMockExpectWithArrayAndReturn(UNITY_LINE_TYPE cmock_line, #{args_string}, #{function[:return][:str]});\n" + end + end + + def mock_interfaces(function) + return nil unless function[:contains_ptr?] + lines = [] + func_name = function[:name] + args_string = function[:args].map{|m| m[:ptr?] ? "#{m[:type]} #{m[:name]}, int #{m[:name]}_Depth" : "#{m[:type]} #{m[:name]}"}.join(', ') + call_string = function[:args].map{|m| m[:ptr?] ? "#{m[:name]}, #{m[:name]}_Depth" : m[:name]}.join(', ') + if (function[:return][:void?]) + lines << "void #{func_name}_CMockExpectWithArray(UNITY_LINE_TYPE cmock_line, #{args_string})\n" + else + lines << "void #{func_name}_CMockExpectWithArrayAndReturn(UNITY_LINE_TYPE cmock_line, #{args_string}, #{function[:return][:str]})\n" + end + lines << "{\n" + lines << @utils.code_add_base_expectation(func_name) + lines << " CMockExpectParameters_#{func_name}(cmock_call_instance, #{call_string});\n" + lines << " cmock_call_instance->ReturnVal = cmock_to_return;\n" unless (function[:return][:void?]) + lines << "}\n\n" + end + +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_callback.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_callback.rb new file mode 100644 index 0000000..0db9b36 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_callback.rb @@ -0,0 +1,78 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +class CMockGeneratorPluginCallback + + attr_accessor :include_count + attr_reader :priority + attr_reader :config, :utils + + def initialize(config, utils) + @config = config + @utils = utils + @priority = 6 + + @include_count = @config.callback_include_count + if (@config.callback_after_arg_check) + alias :mock_implementation :mock_implementation_for_callbacks + alias :mock_implementation_precheck :nothing + else + alias :mock_implementation_precheck :mock_implementation_for_callbacks + alias :mock_implementation :nothing + end + end + + def instance_structure(function) + func_name = function[:name] + " CMOCK_#{func_name}_CALLBACK #{func_name}_CallbackFunctionPointer;\n" + + " int #{func_name}_CallbackCalls;\n" + end + + def mock_function_declarations(function) + func_name = function[:name] + return_type = function[:return][:const?] ? "const #{function[:return][:type]}" : function[:return][:type] + style = (@include_count ? 1 : 0) | (function[:args].empty? ? 0 : 2) + styles = [ "void", "int cmock_num_calls", function[:args_string], "#{function[:args_string]}, int cmock_num_calls" ] + "typedef #{return_type} (* CMOCK_#{func_name}_CALLBACK)(#{styles[style]});\nvoid #{func_name}_StubWithCallback(CMOCK_#{func_name}_CALLBACK Callback);\n" + end + + def mock_implementation_for_callbacks(function) + func_name = function[:name] + style = (@include_count ? 1 : 0) | (function[:args].empty? ? 0 : 2) | (function[:return][:void?] ? 0 : 4) + " if (Mock.#{func_name}_CallbackFunctionPointer != NULL)\n {\n" + + case(style) + when 0 then " Mock.#{func_name}_CallbackFunctionPointer();\n return;\n }\n" + when 1 then " Mock.#{func_name}_CallbackFunctionPointer(Mock.#{func_name}_CallbackCalls++);\n return;\n }\n" + when 2 then " Mock.#{func_name}_CallbackFunctionPointer(#{function[:args].map{|m| m[:name]}.join(', ')});\n return;\n }\n" + when 3 then " Mock.#{func_name}_CallbackFunctionPointer(#{function[:args].map{|m| m[:name]}.join(', ')}, Mock.#{func_name}_CallbackCalls++);\n return;\n }\n" + when 4 then " return Mock.#{func_name}_CallbackFunctionPointer(void);\n }\n" + when 5 then " return Mock.#{func_name}_CallbackFunctionPointer(Mock.#{func_name}_CallbackCalls++);\n }\n" + when 6 then " return Mock.#{func_name}_CallbackFunctionPointer(#{function[:args].map{|m| m[:name]}.join(', ')});\n }\n" + when 7 then " return Mock.#{func_name}_CallbackFunctionPointer(#{function[:args].map{|m| m[:name]}.join(', ')}, Mock.#{func_name}_CallbackCalls++);\n }\n" + end + end + + def nothing(function) + return "" + end + + def mock_interfaces(function) + func_name = function[:name] + "void #{func_name}_StubWithCallback(CMOCK_#{func_name}_CALLBACK Callback)\n{\n" + + " Mock.#{func_name}_CallbackFunctionPointer = Callback;\n}\n\n" + end + + def mock_destroy(function) + " Mock.#{function[:name]}_CallbackFunctionPointer = NULL;\n" + + " Mock.#{function[:name]}_CallbackCalls = 0;\n" + end + + def mock_verify(function) + func_name = function[:name] + " if (Mock.#{func_name}_CallbackFunctionPointer != NULL)\n Mock.#{func_name}_CallInstance = CMOCK_GUTS_NONE;\n" + end + +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_cexception.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_cexception.rb new file mode 100644 index 0000000..fdf31db --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_cexception.rb @@ -0,0 +1,51 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +class CMockGeneratorPluginCexception + + attr_reader :priority + attr_reader :config, :utils + + def initialize(config, utils) + @config = config + @utils = utils + @priority = 7 + end + + def include_files + return "#include \"CException.h\"\n" + end + + def instance_typedefs(function) + " CEXCEPTION_T ExceptionToThrow;\n" + end + + def mock_function_declarations(function) + if (function[:args_string] == "void") + return "#define #{function[:name]}_ExpectAndThrow(cmock_to_throw) #{function[:name]}_CMockExpectAndThrow(__LINE__, cmock_to_throw)\n" + + "void #{function[:name]}_CMockExpectAndThrow(UNITY_LINE_TYPE cmock_line, CEXCEPTION_T cmock_to_throw);\n" + else + return "#define #{function[:name]}_ExpectAndThrow(#{function[:args_call]}, cmock_to_throw) #{function[:name]}_CMockExpectAndThrow(__LINE__, #{function[:args_call]}, cmock_to_throw)\n" + + "void #{function[:name]}_CMockExpectAndThrow(UNITY_LINE_TYPE cmock_line, #{function[:args_string]}, CEXCEPTION_T cmock_to_throw);\n" + end + end + + def mock_implementation(function) + " if (cmock_call_instance->ExceptionToThrow != CEXCEPTION_NONE)\n {\n" + + " Throw(cmock_call_instance->ExceptionToThrow);\n }\n" + end + + def mock_interfaces(function) + arg_insert = (function[:args_string] == "void") ? "" : "#{function[:args_string]}, " + call_string = function[:args].map{|m| m[:name]}.join(', ') + [ "void #{function[:name]}_CMockExpectAndThrow(UNITY_LINE_TYPE cmock_line, #{arg_insert}CEXCEPTION_T cmock_to_throw)\n{\n", + @utils.code_add_base_expectation(function[:name]), + @utils.code_call_argument_loader(function), + " cmock_call_instance->ExceptionToThrow = cmock_to_throw;\n", + "}\n\n" ].join + end + +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_expect.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_expect.rb new file mode 100644 index 0000000..5651cd9 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_expect.rb @@ -0,0 +1,86 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +class CMockGeneratorPluginExpect + + attr_reader :priority + attr_accessor :config, :utils, :unity_helper, :ordered + + def initialize(config, utils) + @config = config + @ptr_handling = @config.when_ptr + @ordered = @config.enforce_strict_ordering + @utils = utils + @unity_helper = @utils.helpers[:unity_helper] + @priority = 5 + end + + def instance_typedefs(function) + lines = "" + lines << " #{function[:return][:type]} ReturnVal;\n" unless (function[:return][:void?]) + lines << " int CallOrder;\n" if (@ordered) + function[:args].each do |arg| + lines << " #{arg[:type]} Expected_#{arg[:name]};\n" + end + lines + end + + def mock_function_declarations(function) + if (function[:args].empty?) + if (function[:return][:void?]) + return "#define #{function[:name]}_Expect() #{function[:name]}_CMockExpect(__LINE__)\n" + + "void #{function[:name]}_CMockExpect(UNITY_LINE_TYPE cmock_line);\n" + else + return "#define #{function[:name]}_ExpectAndReturn(cmock_retval) #{function[:name]}_CMockExpectAndReturn(__LINE__, cmock_retval)\n" + + "void #{function[:name]}_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, #{function[:return][:str]});\n" + end + else + if (function[:return][:void?]) + return "#define #{function[:name]}_Expect(#{function[:args_call]}) #{function[:name]}_CMockExpect(__LINE__, #{function[:args_call]})\n" + + "void #{function[:name]}_CMockExpect(UNITY_LINE_TYPE cmock_line, #{function[:args_string]});\n" + else + return "#define #{function[:name]}_ExpectAndReturn(#{function[:args_call]}, cmock_retval) #{function[:name]}_CMockExpectAndReturn(__LINE__, #{function[:args_call]}, cmock_retval)\n" + + "void #{function[:name]}_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, #{function[:args_string]}, #{function[:return][:str]});\n" + end + end + end + + def mock_implementation(function) + lines = "" + function[:args].each do |arg| + lines << @utils.code_verify_an_arg_expectation(function, arg) + end + lines + end + + def mock_interfaces(function) + lines = "" + func_name = function[:name] + if (function[:return][:void?]) + if (function[:args_string] == "void") + lines << "void #{func_name}_CMockExpect(UNITY_LINE_TYPE cmock_line)\n{\n" + else + lines << "void #{func_name}_CMockExpect(UNITY_LINE_TYPE cmock_line, #{function[:args_string]})\n{\n" + end + else + if (function[:args_string] == "void") + lines << "void #{func_name}_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, #{function[:return][:str]})\n{\n" + else + lines << "void #{func_name}_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, #{function[:args_string]}, #{function[:return][:str]})\n{\n" + end + end + lines << @utils.code_add_base_expectation(func_name) + lines << @utils.code_call_argument_loader(function) + lines << @utils.code_assign_argument_quickly("cmock_call_instance->ReturnVal", function[:return]) unless (function[:return][:void?]) + lines << "}\n\n" + end + + def mock_verify(function) + func_name = function[:name] + " UNITY_TEST_ASSERT(CMOCK_GUTS_NONE == Mock.#{func_name}_CallInstance, cmock_line, \"Function '#{func_name}' called less times than expected.\");\n" + end + +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_ignore.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_ignore.rb new file mode 100644 index 0000000..a81933d --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/lib/cmock_generator_plugin_ignore.rb @@ -0,0 +1,85 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +class CMockGeneratorPluginIgnore + + attr_reader :priority + attr_reader :config, :utils + + def initialize(config, utils) + @config = config + if (@config.ignore == :args_and_calls) + alias :mock_implementation_precheck :mock_implementation_for_ignores + alias :mock_implementation :nothing + alias :mock_verify :mock_conditionally_verify_counts + else + alias :mock_implementation :mock_implementation_for_ignores + alias :mock_implementation_precheck :nothing + alias :mock_verify :nothing + end + @utils = utils + @priority = 2 + end + + def instance_structure(function) + if (function[:return][:void?]) + " int #{function[:name]}_IgnoreBool;\n" + else + " int #{function[:name]}_IgnoreBool;\n #{function[:return][:type]} #{function[:name]}_FinalReturn;\n" + end + end + + def mock_function_declarations(function) + if (function[:return][:void?]) + return "#define #{function[:name]}_Ignore() #{function[:name]}_CMockIgnore(__LINE__)\n" + + "void #{function[:name]}_CMockIgnore(UNITY_LINE_TYPE cmock_line);\n" + else + return "#define #{function[:name]}_IgnoreAndReturn(cmock_retval) #{function[:name]}_CMockIgnoreAndReturn(__LINE__, cmock_retval)\n" + + "void #{function[:name]}_CMockIgnoreAndReturn(UNITY_LINE_TYPE cmock_line, #{function[:return][:str]});\n" + end + end + + def mock_implementation_for_ignores(function) + lines = " if (Mock.#{function[:name]}_IgnoreBool)\n {\n" + if (function[:return][:void?]) + lines << " return;\n }\n" + else + retval = function[:return].merge( { :name => "cmock_call_instance->ReturnVal"} ) + lines << " if (cmock_call_instance == NULL)\n return Mock.#{function[:name]}_FinalReturn;\n" + lines << " " + @utils.code_assign_argument_quickly("Mock.#{function[:name]}_FinalReturn", retval) unless (retval[:void?]) + lines << " return cmock_call_instance->ReturnVal;\n }\n" + end + lines + end + + def mock_interfaces(function) + lines = "" + if (function[:return][:void?]) + lines << "void #{function[:name]}_CMockIgnore(UNITY_LINE_TYPE cmock_line)\n{\n" + else + lines << "void #{function[:name]}_CMockIgnoreAndReturn(UNITY_LINE_TYPE cmock_line, #{function[:return][:str]})\n{\n" + end + if (@config.ignore == :args_only) + lines << @utils.code_add_base_expectation(function[:name], true) + elsif (!function[:return][:void?]) + lines << @utils.code_add_base_expectation(function[:name], false) + end + unless (function[:return][:void?]) + lines << " cmock_call_instance->ReturnVal = cmock_to_return;\n" + end + lines << " Mock.#{function[:name]}_IgnoreBool = (int)1;\n" + lines << "}\n\n" + end + + def mock_conditionally_verify_counts(function) + func_name = function[:name] + " if (Mock.#{func_name}_IgnoreBool)\n Mock.#{func_name}_CallInstance = CMOCK_GUTS_NONE;\n" + end + + def nothing(function) + return "" + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/lib/cmock_generator_utils.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/lib/cmock_generator_utils.rb new file mode 100644 index 0000000..4444979 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/lib/cmock_generator_utils.rb @@ -0,0 +1,177 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +class CMockGeneratorUtils + + attr_accessor :config, :helpers, :ordered, :ptr_handling, :arrays, :cexception + + def initialize(config, helpers={}) + @config = config + @ptr_handling = @config.when_ptr + @ordered = @config.enforce_strict_ordering + @arrays = @config.plugins.include? :array + @cexception = @config.plugins.include? :cexception + @treat_as = @config.treat_as + @helpers = helpers + + if (@arrays) + case(@ptr_handling) + when :smart then alias :code_verify_an_arg_expectation :code_verify_an_arg_expectation_with_smart_arrays + when :compare_data then alias :code_verify_an_arg_expectation :code_verify_an_arg_expectation_with_normal_arrays + when :compare_ptr then raise "ERROR: the array plugin doesn't enjoy working with :compare_ptr only. Disable one option." + end + else + alias :code_verify_an_arg_expectation :code_verify_an_arg_expectation_with_no_arrays + end + end + + def code_add_base_expectation(func_name, global_ordering_supported=true) + lines = " CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_#{func_name}_CALL_INSTANCE));\n" + lines << " CMOCK_#{func_name}_CALL_INSTANCE* cmock_call_instance = (CMOCK_#{func_name}_CALL_INSTANCE*)CMock_Guts_GetAddressFor(cmock_guts_index);\n" + lines << " UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, \"CMock has run out of memory. Please allocate more.\");\n" + lines << " Mock.#{func_name}_CallInstance = CMock_Guts_MemChain(Mock.#{func_name}_CallInstance, cmock_guts_index);\n" + lines << " cmock_call_instance->LineNumber = cmock_line;\n" + lines << " cmock_call_instance->CallOrder = ++GlobalExpectCount;\n" if (@ordered and global_ordering_supported) + lines << " cmock_call_instance->ExceptionToThrow = CEXCEPTION_NONE;\n" if (@cexception) + lines + end + + def code_add_an_arg_expectation(arg, depth=1) + lines = code_assign_argument_quickly("cmock_call_instance->Expected_#{arg[:name]}", arg) + lines << " cmock_call_instance->Expected_#{arg[:name]}_Depth = #{arg[:name]}_Depth;\n" if (@arrays and (depth.class == String)) + lines + end + + def code_assign_argument_quickly(dest, arg) + if (arg[:ptr?] or @treat_as.include?(arg[:type])) + " #{dest} = #{arg[:const?] ? "(#{arg[:type]})" : ''}#{arg[:name]};\n" + else + " memcpy(&#{dest}, &#{arg[:name]}, sizeof(#{arg[:type]}));\n" + end + end + + def code_add_argument_loader(function) + if (function[:args_string] != "void") + if (@arrays) + args_string = function[:args].map do |m| + const_str = m[ :const? ] ? 'const ' : '' + m[:ptr?] ? "#{const_str}#{m[:type]} #{m[:name]}, int #{m[:name]}_Depth" : "#{const_str}#{m[:type]} #{m[:name]}" + end.join(', ') + "void CMockExpectParameters_#{function[:name]}(CMOCK_#{function[:name]}_CALL_INSTANCE* cmock_call_instance, #{args_string})\n{\n" + + function[:args].inject("") { |all, arg| all + code_add_an_arg_expectation(arg, (arg[:ptr?] ? "#{arg[:name]}_Depth" : 1) ) } + + "}\n\n" + else + "void CMockExpectParameters_#{function[:name]}(CMOCK_#{function[:name]}_CALL_INSTANCE* cmock_call_instance, #{function[:args_string]})\n{\n" + + function[:args].inject("") { |all, arg| all + code_add_an_arg_expectation(arg) } + + "}\n\n" + end + else + "" + end + end + + def code_call_argument_loader(function) + if (function[:args_string] != "void") + args = function[:args].map do |m| + (@arrays and m[:ptr?]) ? "#{m[:name]}, 1" : m[:name] + end + " CMockExpectParameters_#{function[:name]}(cmock_call_instance, #{args.join(', ')});\n" + else + "" + end + end + + #private ###################### + + def lookup_expect_type(function, arg) + c_type = arg[:type] + arg_name = arg[:name] + expected = "cmock_call_instance->Expected_#{arg_name}" + unity_func = if ((arg[:ptr?]) and ((c_type =~ /\*\*/) or (@ptr_handling == :compare_ptr))) + ['UNITY_TEST_ASSERT_EQUAL_PTR', ''] + else + (@helpers.nil? or @helpers[:unity_helper].nil?) ? ["UNITY_TEST_ASSERT_EQUAL",''] : @helpers[:unity_helper].get_helper(c_type) + end + unity_msg = "Function '#{function[:name]}' called with unexpected value for argument '#{arg_name}'." + return c_type, arg_name, expected, unity_func[0], unity_func[1], unity_msg + end + + def code_verify_an_arg_expectation_with_no_arrays(function, arg) + c_type, arg_name, expected, unity_func, pre, unity_msg = lookup_expect_type(function, arg) + case(unity_func) + when "UNITY_TEST_ASSERT_EQUAL_MEMORY" + c_type_local = c_type.gsub(/\*$/,'') + return " UNITY_TEST_ASSERT_EQUAL_MEMORY((void*)(#{pre}#{expected}), (void*)(#{pre}#{arg_name}), sizeof(#{c_type_local}), cmock_line, \"#{unity_msg}\");\n" + when "UNITY_TEST_ASSERT_EQUAL_MEMORY" + [ " if (#{pre}#{expected} == NULL)", + " { UNITY_TEST_ASSERT_NULL(#{pre}#{arg_name}, cmock_line, \"Expected NULL. #{unity_msg}\"); }", + " else", + " { UNITY_TEST_ASSERT_EQUAL_MEMORY((void*)(#{pre}#{expected}), (void*)(#{pre}#{arg_name}), sizeof(#{c_type.sub('*','')}), cmock_line, \"#{unity_msg}\"); }\n"].join("\n") + when /_ARRAY/ + [ " if (#{pre}#{expected} == NULL)", + " { UNITY_TEST_ASSERT_NULL(#{pre}#{arg_name}, cmock_line, \"Expected NULL. #{unity_msg}\"); }", + " else", + " { #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, 1, cmock_line, \"#{unity_msg}\"); }\n"].join("\n") + else + return " #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, cmock_line, \"#{unity_msg}\");\n" + end + end + + def code_verify_an_arg_expectation_with_normal_arrays(function, arg) + c_type, arg_name, expected, unity_func, pre, unity_msg = lookup_expect_type(function, arg) + depth_name = (arg[:ptr?]) ? "cmock_call_instance->Expected_#{arg_name}_Depth" : 1 + case(unity_func) + when "UNITY_TEST_ASSERT_EQUAL_MEMORY" + c_type_local = c_type.gsub(/\*$/,'') + return " UNITY_TEST_ASSERT_EQUAL_MEMORY((void*)(#{pre}#{expected}), (void*)(#{pre}#{arg_name}), sizeof(#{c_type_local}), cmock_line, \"#{unity_msg}\");\n" + when "UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY" + [ " if (#{pre}#{expected} == NULL)", + " { UNITY_TEST_ASSERT_NULL(#{pre}#{arg_name}, cmock_line, \"Expected NULL. #{unity_msg}\"); }", + " else", + " { UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY((void*)(#{pre}#{expected}), (void*)(#{pre}#{arg_name}), sizeof(#{c_type.sub('*','')}), #{depth_name}, cmock_line, \"#{unity_msg}\"); }\n"].compact.join("\n") + when /_ARRAY/ + if (pre == '&') + " #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, #{depth_name}, cmock_line, \"#{unity_msg}\");\n" + else + [ " if (#{pre}#{expected} == NULL)", + " { UNITY_TEST_ASSERT_NULL(#{pre}#{arg_name}, cmock_line, \"Expected NULL. #{unity_msg}\"); }", + " else", + " { #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, #{depth_name}, cmock_line, \"#{unity_msg}\"); }\n"].compact.join("\n") + end + else + return " #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, cmock_line, \"#{unity_msg}\");\n" + end + end + + def code_verify_an_arg_expectation_with_smart_arrays(function, arg) + c_type, arg_name, expected, unity_func, pre, unity_msg = lookup_expect_type(function, arg) + depth_name = (arg[:ptr?]) ? "cmock_call_instance->Expected_#{arg_name}_Depth" : 1 + case(unity_func) + when "UNITY_TEST_ASSERT_EQUAL_MEMORY" + c_type_local = c_type.gsub(/\*$/,'') + return " UNITY_TEST_ASSERT_EQUAL_MEMORY((void*)(#{pre}#{expected}), (void*)(#{pre}#{arg_name}), sizeof(#{c_type_local}), cmock_line, \"#{unity_msg}\");\n" + when "UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY" + [ " if (#{pre}#{expected} == NULL)", + " { UNITY_TEST_ASSERT_NULL(#{arg_name}, cmock_line, \"Expected NULL. #{unity_msg}\"); }", + ((depth_name != 1) ? " else if (#{depth_name} == 0)\n { UNITY_TEST_ASSERT_EQUAL_PTR(#{pre}#{expected}, #{pre}#{arg_name}, cmock_line, \"#{unity_msg}\"); }" : nil), + " else", + " { UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY((void*)(#{pre}#{expected}), (void*)(#{pre}#{arg_name}), sizeof(#{c_type.sub('*','')}), #{depth_name}, cmock_line, \"#{unity_msg}\"); }\n"].compact.join("\n") + when /_ARRAY/ + if (pre == '&') + " #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, #{depth_name}, cmock_line, \"#{unity_msg}\");\n" + else + [ " if (#{pre}#{expected} == NULL)", + " { UNITY_TEST_ASSERT_NULL(#{pre}#{arg_name}, cmock_line, \"Expected NULL. #{unity_msg}\"); }", + ((depth_name != 1) ? " else if (#{depth_name} == 0)\n { UNITY_TEST_ASSERT_EQUAL_PTR(#{pre}#{expected}, #{pre}#{arg_name}, cmock_line, \"#{unity_msg}\"); }" : nil), + " else", + " { #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, #{depth_name}, cmock_line, \"#{unity_msg}\"); }\n"].compact.join("\n") + end + else + return " #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, cmock_line, \"#{unity_msg}\");\n" + end + end + +end \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/lib/cmock_header_parser.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/lib/cmock_header_parser.rb new file mode 100644 index 0000000..4ea9966 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/lib/cmock_header_parser.rb @@ -0,0 +1,270 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +class CMockHeaderParser + + attr_accessor :funcs, :c_attributes, :treat_as_void, :treat_externs + + def initialize(cfg) + @funcs = [] + @c_strippables = cfg.strippables + @c_attributes = (['const'] + cfg.attributes).uniq + @treat_as_void = (['void'] + cfg.treat_as_void).uniq + @declaration_parse_matcher = /([\d\w\s\*\(\),\[\]]+??)\(([\d\w\s\*\(\),\.\[\]+-]*)\)$/m + @standards = (['int','short','char','long','unsigned','signed'] + cfg.treat_as.keys).uniq + @when_no_prototypes = cfg.when_no_prototypes + @local_as_void = @treat_as_void + @verbosity = cfg.verbosity + @treat_externs = cfg.treat_externs + @c_strippables += ['extern'] if (@treat_externs == :include) #we'll need to remove the attribute if we're allowing externs + end + + def parse(name, source) + @module_name = name + @typedefs = [] + @funcs = [] + function_names = [] + + parse_functions( import_source(source) ).map do |decl| + func = parse_declaration(decl) + unless (function_names.include? func[:name]) + @funcs << func + function_names << func[:name] + end + end + + { :includes => nil, + :functions => @funcs, + :typedefs => @typedefs + } + end + + private if $ThisIsOnlyATest.nil? ################ + + def import_source(source) + + # void must be void for cmock _ExpectAndReturn calls to process properly, not some weird typedef which equates to void + # to a certain extent, this action assumes we're chewing on pre-processed header files, otherwise we'll most likely just get stuff from @treat_as_void + @local_as_void = @treat_as_void + void_types = source.scan(/typedef\s+(?:\(\s*)?void(?:\s*\))?\s+([\w\d]+)\s*;/) + if void_types + @local_as_void += void_types.flatten.uniq.compact + end + + # smush multiline macros into single line (checking for continuation character at end of line '\') + source.gsub!(/\s*\\\s*/m, ' ') + + #remove comments (block and line, in three steps to ensure correct precedence) + source.gsub!(/\/\/(?:.+\/\*|\*(?:$|[^\/])).*$/, '') # remove line comments that comment out the start of blocks + source.gsub!(/\/\*.*?\*\//m, '') # remove block comments + source.gsub!(/\/\/.*$/, '') # remove line comments (all that remain) + + # remove assembler pragma sections + source.gsub!(/^\s*#\s*pragma\s+asm\s+.*?#\s*pragma\s+endasm/m, '') + + # remove preprocessor statements and extern "C" + source.gsub!(/^\s*#.*/, '') + source.gsub!(/extern\s+\"C\"\s+\{/, '') + + # enums, unions, structs, and typedefs can all contain things (e.g. function pointers) that parse like function prototypes, so yank them + # forward declared structs are removed before struct definitions so they don't mess up real thing later. we leave structs keywords in function prototypes + source.gsub!(/^[\w\s]*struct[^;\{\}\(\)]+;/m, '') # remove forward declared structs + source.gsub!(/^[\w\s]*(enum|union|struct|typepdef)[\w\s]*\{[^\}]+\}[\w\s\*\,]*;/m, '') # remove struct, union, and enum definitions and typedefs with braces + source.gsub!(/(\W)(?:register|auto|static|restrict)(\W)/, '\1\2') # remove problem keywords + source.gsub!(/\s*=\s*['"a-zA-Z0-9_\.]+\s*/, '') # remove default value statements from argument lists + source.gsub!(/^(?:[\w\s]*\W)?typedef\W.*/, '') # remove typedef statements + source.gsub!(/(^|\W+)(?:#{@c_strippables.join('|')})(?=$|\W+)/,'\1') unless @c_strippables.empty? # remove known attributes slated to be stripped + + #scan for functions which return function pointers, because they are a pain + source.gsub!(/([\w\s\*]+)\(*\(\s*\*([\w\s\*]+)\s*\(([\w\s\*,]*)\)\)\s*\(([\w\s\*,]*)\)\)*/) do |m| + functype = "cmock_#{@module_name}_func_ptr#{@typedefs.size + 1}" + @typedefs << "typedef #{$1.strip}(*#{functype})(#{$4});" + "#{functype} #{$2.strip}(#{$3});" + end + + #drop extra white space to make the rest go faster + source.gsub!(/^\s+/, '') # remove extra white space from beginning of line + source.gsub!(/\s+$/, '') # remove extra white space from end of line + source.gsub!(/\s*\(\s*/, '(') # remove extra white space from before left parens + source.gsub!(/\s*\)\s*/, ')') # remove extra white space from before right parens + source.gsub!(/\s+/, ' ') # remove remaining extra white space + + #split lines on semicolons and remove things that are obviously not what we are looking for + src_lines = source.split(/\s*;\s*/) + src_lines.delete_if {|line| line.strip.length == 0} # remove blank lines + src_lines.delete_if {|line| !(line =~ /\(\s*\*(?:.*\[\d*\])??\s*\)/).nil?} #remove function pointer arrays + if (@treat_externs == :include) + src_lines.delete_if {|line| !(line =~ /(?:^|\s+)(?:inline)\s+/).nil?} #remove inline functions + else + src_lines.delete_if {|line| !(line =~ /(?:^|\s+)(?:extern|inline)\s+/).nil?} #remove inline and extern functions + end + end + + def parse_functions(source) + funcs = [] + source.each {|line| funcs << line.strip.gsub(/\s+/, ' ') if (line =~ @declaration_parse_matcher)} + if funcs.empty? + case @when_no_prototypes + when :error + raise "ERROR: No function prototypes found!" + when :warn + puts "WARNING: No function prototypes found!" unless (@verbosity < 1) + end + end + return funcs + end + + def parse_args(arg_list) + args = [] + arg_list.split(',').each do |arg| + arg.strip! + return args if (arg =~ /^\s*((\.\.\.)|(void))\s*$/) # we're done if we reach void by itself or ... + arg_array = arg.split + arg_elements = arg_array - @c_attributes # split up words and remove known attributes + args << { :type => (arg_type =arg_elements[0..-2].join(' ')), + :name => arg_elements[-1], + :ptr? => divine_ptr(arg_type), + :const? => arg_array.include?('const') + } + end + return args + end + + def divine_ptr(arg_type) + return false unless arg_type.include? '*' + return false if arg_type.gsub(/(const|char|\*|\s)+/,'').empty? + return true + end + + def clean_args(arg_list) + if ((@local_as_void.include?(arg_list.strip)) or (arg_list.empty?)) + return 'void' + else + c=0 + arg_list.gsub!(/(\w+)(?:\s*\[[\s\d\w+-]*\])+/,'*\1') # magically turn brackets into asterisks + arg_list.gsub!(/\s+\*/,'*') # remove space to place asterisks with type (where they belong) + arg_list.gsub!(/\*(\w)/,'* \1') # pull asterisks away from arg to place asterisks with type (where they belong) + + #scan argument list for function pointers and replace them with custom types + arg_list.gsub!(/([\w\s]+)\(*\(\s*\*([\w\s\*]+)\)\s*\(([\w\s\*,]*)\)\)*/) do |m| + functype = "cmock_#{@module_name}_func_ptr#{@typedefs.size + 1}" + funcret = $1.strip + funcname = $2.strip + funcargs = $3.strip + funconst = '' + if (funcname.include? 'const') + funcname.gsub!('const','').strip! + funconst = 'const ' + end + @typedefs << "typedef #{funcret}(*#{functype})(#{funcargs});" + funcname = "cmock_arg#{c+=1}" if (funcname.empty?) + "#{functype} #{funconst}#{funcname}" + end + + #automatically name unnamed arguments (those that only had a type) + arg_list.split(/\s*,\s*/).map { |arg| + parts = (arg.split - ['struct', 'union', 'enum', 'const', 'const*']) + if ((parts.size < 2) or (parts[-1][-1].chr == '*') or (@standards.include?(parts[-1]))) + "#{arg} cmock_arg#{c+=1}" + else + arg + end + }.join(', ') + end + end + + def parse_declaration(declaration) + decl = {} + + regex_match = @declaration_parse_matcher.match(declaration) + raise "Failed parsing function declaration: '#{declaration}'" if regex_match.nil? + + #grab argument list + args = regex_match[2].strip + + #process function attributes, return type, and name + descriptors = regex_match[1] + descriptors.gsub!(/\s+\*/,'*') #remove space to place asterisks with return type (where they belong) + descriptors.gsub!(/\*(\w)/,'* \1') #pull asterisks away from function name to place asterisks with return type (where they belong) + descriptors = descriptors.split #array of all descriptor strings + + #grab name + decl[:name] = descriptors[-1] #snag name as last array item + + #build attribute and return type strings + decl[:modifier] = [] + rettype = [] + descriptors[0..-2].each do |word| + if @c_attributes.include?(word) + decl[:modifier] << word + else + rettype << word + end + end + decl[:modifier] = decl[:modifier].join(' ') + rettype = rettype.join(' ') + rettype = 'void' if (@local_as_void.include?(rettype.strip)) + decl[:return] = { :type => rettype, + :name => 'cmock_to_return', + :ptr? => divine_ptr(rettype), + :const? => rettype.split(/\s/).include?('const'), + :str => "#{rettype} cmock_to_return", + :void? => (rettype == 'void') + } + + #remove default argument statements from mock definitions + args.gsub!(/=\s*[a-zA-Z0-9_\.]+\s*/, ' ') + + #check for var args + if (args =~ /\.\.\./) + decl[:var_arg] = args.match( /[\w\s]*\.\.\./ ).to_s.strip + if (args =~ /\,[\w\s]*\.\.\./) + args = args.gsub!(/\,[\w\s]*\.\.\./,'') + else + args = 'void' + end + else + decl[:var_arg] = nil + end + args = clean_args(args) + decl[:args_string] = args + decl[:args] = parse_args(args) + decl[:args_call] = decl[:args].map{|a| a[:name]}.join(', ') + decl[:contains_ptr?] = decl[:args].inject(false) {|ptr, arg| arg[:ptr?] ? true : ptr } + + if (decl[:return][:type].nil? or decl[:name].nil? or decl[:args].nil? or + decl[:return][:type].empty? or decl[:name].empty?) + raise "Failed Parsing Declaration Prototype!\n" + + " declaration: '#{declaration}'\n" + + " modifier: '#{decl[:modifier]}'\n" + + " return: #{prototype_inspect_hash(decl[:return])}\n" + + " function: '#{decl[:name]}'\n" + + " args: #{prototype_inspect_array_of_hashes(decl[:args])}\n" + end + + return decl + end + + def prototype_inspect_hash(hash) + pairs = [] + hash.each_pair { |name, value| pairs << ":#{name} => #{"'" if (value.class == String)}#{value}#{"'" if (value.class == String)}" } + return "{#{pairs.join(', ')}}" + end + + def prototype_inspect_array_of_hashes(array) + hashes = [] + array.each { |hash| hashes << prototype_inspect_hash(hash) } + case (array.size) + when 0 + return "[]" + when 1 + return "[#{hashes[0]}]" + else + return "[\n #{hashes.join("\n ")}\n ]\n" + end + end + +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/lib/cmock_plugin_manager.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/lib/cmock_plugin_manager.rb new file mode 100644 index 0000000..eb8f9e8 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/lib/cmock_plugin_manager.rb @@ -0,0 +1,40 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +class CMockPluginManager + + attr_accessor :plugins + + def initialize(config, utils) + @plugins = [] + plugins_to_load = [:expect, config.plugins].flatten.uniq.compact + plugins_to_load.each do |plugin| + plugin_name = plugin.to_s + object_name = "CMockGeneratorPlugin" + camelize(plugin_name) + begin + unless (Object.const_defined? object_name) + require "#{File.expand_path(File.dirname(__FILE__))}/cmock_generator_plugin_#{plugin_name.downcase}.rb" + end + @plugins << eval("#{object_name}.new(config, utils)") + rescue + raise "ERROR: CMock unable to load plugin '#{plugin_name}'" + end + end + @plugins.sort! {|a,b| a.priority <=> b.priority } + end + + def run(method, args=nil) + if args.nil? + return @plugins.collect{ |plugin| plugin.send(method) if plugin.respond_to?(method) }.flatten.join + else + return @plugins.collect{ |plugin| plugin.send(method, args) if plugin.respond_to?(method) }.flatten.join + end + end + + def camelize(lower_case_and_underscored_word) + lower_case_and_underscored_word.gsub(/\/(.?)/) { "::" + $1.upcase }.gsub(/(^|_)(.)/) { $2.upcase } + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/lib/cmock_unityhelper_parser.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/lib/cmock_unityhelper_parser.rb new file mode 100644 index 0000000..3ddffb3 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/lib/cmock_unityhelper_parser.rb @@ -0,0 +1,74 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +class CMockUnityHelperParser + + attr_accessor :c_types + + def initialize(config) + @config = config + @fallback = @config.plugins.include?(:array) ? 'UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY' : 'UNITY_TEST_ASSERT_EQUAL_MEMORY' + @c_types = map_C_types.merge(import_source) + end + + def get_helper(ctype) + lookup = ctype.gsub(/(?:^|(\S?)(\s*)|(\W))const(?:$|(\s*)(\S)|(\W))/,'\1\3\5\6').strip.gsub(/\s+/,'_') + return [@c_types[lookup], ''] if (@c_types[lookup]) + if (lookup =~ /\*$/) + lookup = lookup.gsub(/\*$/,'') + return [@c_types[lookup], '*'] if (@c_types[lookup]) + else + lookup = lookup + '*' + return [@c_types[lookup], '&'] if (@c_types[lookup]) + end + return ['UNITY_TEST_ASSERT_EQUAL_PTR', ''] if (ctype =~ /cmock_\w+_ptr\d+/) + raise("Don't know how to test #{ctype} and memory tests are disabled!") unless @config.memcmp_if_unknown + return (lookup =~ /\*$/) ? [@fallback, '&'] : [@fallback, ''] + end + + private ########################### + + def map_C_types + c_types = {} + @config.treat_as.each_pair do |ctype, expecttype| + if (expecttype =~ /\*/) + c_types[ctype.gsub(/\s+/,'_')] = "UNITY_TEST_ASSERT_EQUAL_#{expecttype.gsub(/\*/,'')}_ARRAY" + else + c_types[ctype.gsub(/\s+/,'_')] = "UNITY_TEST_ASSERT_EQUAL_#{expecttype}" + c_types[ctype.gsub(/\s+/,'_')+'*'] = "UNITY_TEST_ASSERT_EQUAL_#{expecttype}_ARRAY" + end + end + c_types + end + + def import_source + source = @config.load_unity_helper + return {} if source.nil? + c_types = {} + source = source.gsub(/\/\/.*$/, '') #remove line comments + source = source.gsub(/\/\*.*?\*\//m, '') #remove block comments + + #scan for comparison helpers + match_regex = Regexp.new('^\s*#define\s+(UNITY_TEST_ASSERT_EQUAL_(\w+))\s*\(' + Array.new(4,'\s*\w+\s*').join(',') + '\)') + pairs = source.scan(match_regex).flatten.compact + (pairs.size/2).times do |i| + expect = pairs[i*2] + ctype = pairs[(i*2)+1] + c_types[ctype] = expect unless expect.include?("_ARRAY") + end + + #scan for array variants of those helpers + match_regex = Regexp.new('^\s*#define\s+(UNITY_TEST_ASSERT_EQUAL_(\w+_ARRAY))\s*\(' + Array.new(5,'\s*\w+\s*').join(',') + '\)') + pairs = source.scan(match_regex).flatten.compact + (pairs.size/2).times do |i| + expect = pairs[i*2] + ctype = pairs[(i*2)+1] + c_types[ctype.gsub('_ARRAY','*')] = expect + end + + c_types + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/rakefile.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/rakefile.rb new file mode 100644 index 0000000..1ea3ef2 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/rakefile.rb @@ -0,0 +1,89 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require './config/test_environment' +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require './rakefile_helper' + +include RakefileHelpers + +DEFAULT_CONFIG_FILE = 'gcc.yml' + +configure_clean +configure_toolchain(DEFAULT_CONFIG_FILE) + +task :default => ['test:all'] +task :cruise => [:no_color, :default] + +desc "Load configuration" +task :config, :config_file do |t, args| + args = {:config_file => DEFAULT_CONFIG_FILE} if args[:config_file].nil? + args = {:config_file => args[:config_file] + '.yml'} unless args[:config_file] =~ /\.yml$/i + configure_toolchain(args[:config_file]) +end + +namespace :test do + desc "Run all unit and system tests" + task :all => [:clobber, 'test:units', 'test:c', 'test:system'] + + desc "Run Unit Tests" + Rake::TestTask.new('units') do |t| + t.pattern = 'test/unit/*_test.rb' + t.verbose = true + end + + #individual unit tests + FileList['test/unit/*_test.rb'].each do |test| + Rake::TestTask.new(File.basename(test,'.*')) do |t| + t.pattern = test + t.verbose = true + end + end + + desc "Run C Unit Tests" + task :c do + build_and_test_c_files + end + + desc "Run System Tests" + task :system => [:clobber] do + #get a list of all system tests, removing unsupported tests for this compiler + sys_unsupported = $cfg['unsupported'].map {|a| 'test/system/test_interactions/'+a+'.yml'} + sys_tests_to_run = FileList['test/system/test_interactions/*.yml'] - sys_unsupported + compile_unsupported = $cfg['unsupported'].map {|a| SYSTEST_COMPILE_MOCKABLES_PATH+a+'.h'} + compile_tests_to_run = FileList[SYSTEST_COMPILE_MOCKABLES_PATH + '*.h'] - compile_unsupported + unless (sys_unsupported.empty? and compile_unsupported.empty?) + report "\nIgnoring these system tests..." + sys_unsupported.each {|a| report a} + compile_unsupported.each {|a| report a} + end + report "\nRunning system tests..." + tests_failed = run_system_test_interactions(sys_tests_to_run) + raise "System tests failed." if (tests_failed > 0) + + run_system_test_compilations(compile_tests_to_run) + end + + #individual system tests + FileList['test/system/test_interactions/*.yml'].each do |test| + desc "Run system test #{File.basename(test,'.*')}" + task "test:#{File.basename(test,'.*')}" do + run_system_test_interactions([test]) + end + end + + desc "Profile Mock Generation" + task :profile => [:clobber] do + run_system_test_profiles(FileList[SYSTEST_COMPILE_MOCKABLES_PATH + '*.h']) + end +end + +task :no_color do + $colour_output = false +end + \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/rakefile_helper.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/rakefile_helper.rb new file mode 100644 index 0000000..c7103b7 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/rakefile_helper.rb @@ -0,0 +1,383 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require 'yaml' +require 'fileutils' +require './vendor/unity/auto/generate_test_runner' +require './vendor/unity/auto/unity_test_summary' +require './test/system/systest_generator' +require './vendor/unity/auto/colour_reporter.rb' + +module RakefileHelpers + + SYSTEST_GENERATED_FILES_PATH = 'test/system/generated/' + SYSTEST_BUILD_FILES_PATH = 'test/system/build/' + SYSTEST_COMPILE_MOCKABLES_PATH = 'test/system/test_compilation/' + C_EXTENSION = '.c' + RESULT_EXTENSION = '.result' + + def load_configuration(config_file) + $cfg_file = config_file + $cfg = YAML.load(File.read('./targets/' + $cfg_file)) + $colour_output = false unless $cfg['colour'] + end + + def configure_clean + CLEAN.include(SYSTEST_GENERATED_FILES_PATH + '*.*') + CLEAN.include(SYSTEST_BUILD_FILES_PATH + '*.*') + end + + def configure_toolchain(config_file) + load_configuration(config_file) + configure_clean + end + + def get_local_include_dirs + include_dirs = $cfg['compiler']['includes']['items'].dup + include_dirs.delete_if {|dir| dir.is_a?(Array)} + return include_dirs + end + + def extract_headers(filename) + includes = [] + lines = File.readlines(filename) + lines.each do |line| + m = line.match(/^\s*#include\s+\"\s*(.+\.[hH])\s*\"/) + if not m.nil? + includes << m[1] + end + end + return includes + end + + def find_source_file(header, paths) + paths.each do |dir| + src_file = dir + header.ext(C_EXTENSION) + if (File.exists?(src_file)) + return src_file + end + end + return nil + end + + def squash(prefix, items) + result = '' + items.each { |item| result += " #{prefix}#{tackit(item)}" } + return result + end + + def build_compiler_fields + command = tackit($cfg['compiler']['path']) + if $cfg['compiler']['defines']['items'].nil? + defines = '' + else + defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items']) + end + options = squash('', $cfg['compiler']['options']) + includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :defines => defines, :options => options, :includes => includes} + end + + def compile(file, defines=[]) + compiler = build_compiler_fields + cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{defines.inject(''){|all, a| ' -D'+a+all }}#{compiler[:options]}#{compiler[:includes]} #{file} " + + "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" + + "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" + execute(cmd_str) + end + + def build_linker_fields + command = tackit($cfg['linker']['path']) + if $cfg['linker']['options'].nil? + options = '' + else + options = squash('', $cfg['linker']['options']) + end + if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?) + includes = '' + else + includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) + end + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :options => options, :includes => includes} + end + + def link(exe_name, obj_list) + linker = build_linker_fields + cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + + (obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).uniq.join + + $cfg['linker']['bin_files']['prefix'] + ' ' + + $cfg['linker']['bin_files']['destination'] + + exe_name + $cfg['linker']['bin_files']['extension'] + execute(cmd_str) + end + + def build_simulator_fields + return nil if $cfg['simulator'].nil? + if $cfg['simulator']['path'].nil? + command = '' + else + command = (tackit($cfg['simulator']['path']) + ' ') + end + if $cfg['simulator']['pre_support'].nil? + pre_support = '' + else + pre_support = squash('', $cfg['simulator']['pre_support']) + end + if $cfg['simulator']['post_support'].nil? + post_support = '' + else + post_support = squash('', $cfg['simulator']['post_support']) + end + return {:command => command, :pre_support => pre_support, :post_support => post_support} + end + + def execute(command_string, verbose=true, raise_on_failure=true) + #report command_string + output = `#{command_string}`.chomp + report(output) if (verbose && !output.nil? && (output.length > 0)) + if ($?.exitstatus != 0) and (raise_on_failure) + raise "#{command_string} failed. (Returned #{$?.exitstatus})" + end + return output + end + + def tackit(strings) + case(strings) + when Array + "\"#{strings.join}\"" + when /^-/ + strings + when /\s/ + "\"#{strings}\"" + else + strings + end + end + + def report_summary + summary = UnityTestSummary.new + summary.set_root_path(File.expand_path(File.dirname(__FILE__)) + '/') + results_glob = "#{$cfg['compiler']['build_path']}*.test*" + results_glob.gsub!(/\\/, '/') + results = Dir[results_glob] + summary.set_targets(results) + summary.run + fail_out "FAIL: There were failures" if (summary.failures > 0) + end + + def run_system_test_interactions(test_case_files) + load './lib/cmock.rb' + + SystemTestGenerator.new.generate_files(test_case_files) + test_files = FileList.new(SYSTEST_GENERATED_FILES_PATH + 'test*.c') + + load_configuration($cfg_file) + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + + include_dirs = get_local_include_dirs + + # Build and execute each unit test + test_files.each do |test| + + obj_list = [] + + test_base = File.basename(test, C_EXTENSION) + cmock_config = test_base.gsub(/test_/, '') + '_cmock.yml' + + report "Executing system tests in #{File.basename(test)}..." + + # Detect dependencies and build required required modules + extract_headers(test).each do |header| + + # Generate any needed mocks + if header =~ /^mock_(.*)\.h/i + module_name = $1 + cmock = CMock.new(SYSTEST_GENERATED_FILES_PATH + cmock_config) + cmock.setup_mocks("#{$cfg['compiler']['source_path']}#{module_name}.h") + end + # Compile corresponding source file if it exists + src_file = find_source_file(header, include_dirs) + if !src_file.nil? + compile(src_file) + obj_list << header.ext($cfg['compiler']['object_files']['extension']) + end + end + + # Generate and build the test suite runner + runner_name = test_base + '_runner.c' + runner_path = $cfg['compiler']['source_path'] + runner_name + UnityTestRunnerGenerator.new(SYSTEST_GENERATED_FILES_PATH + cmock_config).run(test, runner_path) + compile(runner_path) + obj_list << runner_name.ext($cfg['compiler']['object_files']['extension']) + + # Build the test module + compile(test) + obj_list << test_base.ext($cfg['compiler']['object_files']['extension']) + + # Link the test executable + link(test_base, obj_list) + + # Execute unit test and generate results file + simulator = build_simulator_fields + executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] + if simulator.nil? + cmd_str = executable + else + cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" + end + output = execute(cmd_str, false, false) + test_results = $cfg['compiler']['build_path'] + test_base + RESULT_EXTENSION + File.open(test_results, 'w') { |f| f.print output } + end + + # Parse and report test results + total_tests = 0 + total_failures = 0 + failure_messages = [] + + test_case_files.each do |test_case| + tests = (YAML.load_file(test_case))[:systest][:tests][:units] + total_tests += tests.size + + test_file = 'test_' + File.basename(test_case).ext(C_EXTENSION) + result_file = test_file.ext(RESULT_EXTENSION) + test_results = File.readlines(SYSTEST_BUILD_FILES_PATH + result_file) + tests.each_with_index do |test, index| + # compare test's intended pass/fail state with pass/fail state in actual results; + # if they don't match, the system test has failed + this_failed = case(test[:pass]) + when :ignore + (test_results[index] =~ /:IGNORE/).nil? + when true + (test_results[index] =~ /:PASS/).nil? + when false + (test_results[index] =~ /:FAIL/).nil? + end + if (this_failed) + total_failures += 1 + test_results[index] =~ /test#{index+1}:(.+)/ + failure_messages << "#{test_file}:test#{index+1}:should #{test[:should]}:#{$1}" + end + # some tests have additional requirements to check for (checking the actual output message) + if (test[:verify_error]) and not (test_results[index] =~ /test#{index+1}:.*#{test[:verify_error]}/) + total_failures += 1 + failure_messages << "#{test_file}:test#{index+1}:should #{test[:should]}:should have output matching '#{test[:verify_error]}'" + end + end + end + + report "\n" + report "------------------------------------\n" + report "SYSTEM TEST MOCK INTERACTION SUMMARY\n" + report "------------------------------------\n" + report "#{total_tests} Tests #{total_failures} Failures 0 Ignored\n" + report "\n" + + if (failure_messages.size > 0) + report 'System test failures:' + failure_messages.each do |failure| + report failure + end + end + + report '' + + return total_failures + end + + def profile_this(filename) + profile = true + begin + require 'ruby-prof' + RubyProf.start + rescue + profile = false + end + + yield + + if (profile) + profile_result = RubyProf.stop + File.open("Profile_#{filename}.html", 'w') do |f| + RubyProf::GraphHtmlPrinter.new(profile_result).print(f) + end + end + end + + def run_system_test_compilations(mockables) + load './lib/cmock.rb' + + load_configuration($cfg_file) + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + + report "\n" + report "------------------------------------\n" + report "SYSTEM TEST MOCK COMPILATION SUMMARY\n" + report "------------------------------------\n" + mockables.each do |header| + mock_filename = 'mock_' + File.basename(header).ext('.c') + CMock.new(SYSTEST_COMPILE_MOCKABLES_PATH + 'config.yml').setup_mocks(header) + report "Compiling #{mock_filename}..." + compile(SYSTEST_GENERATED_FILES_PATH + mock_filename) + end + end + + def run_system_test_profiles(mockables) + load './lib/cmock.rb' + + load_configuration($cfg_file) + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + + report "\n" + report "--------------------------\n" + report "SYSTEM TEST MOCK PROFILING\n" + report "--------------------------\n" + mockables.each do |header| + mock_filename = 'mock_' + File.basename(header).ext('.c') + profile_this(mock_filename.gsub('.c','')) do + 10.times do + CMock.new(SYSTEST_COMPILE_MOCKABLES_PATH + 'config.yml').setup_mocks(header) + end + end + report "Compiling #{mock_filename}..." + compile(SYSTEST_GENERATED_FILES_PATH + mock_filename) + end + end + + def build_and_test_c_files + report "\n" + report "----------------\n" + report "UNIT TEST C CODE\n" + report "----------------\n" + errors = false + FileList.new("test/c/*.yml").each do |yaml_file| + test = YAML.load(File.read(yaml_file)) + report "\nTesting #{yaml_file.sub('.yml','')}" + report "(#{test[:options].join(', ')})" + test[:files].each { |f| compile(f, test[:options]) } + obj_files = test[:files].map { |f| f.gsub!(/.*\//,'').gsub!(C_EXTENSION, $cfg['compiler']['object_files']['extension']) } + link('TestCMockC', obj_files) + if $cfg['simulator'].nil? + execute($cfg['linker']['bin_files']['destination'] + 'TestCMockC' + $cfg['linker']['bin_files']['extension']) + else + execute(tackit($cfg['simulator']['path'].join) + ' ' + + $cfg['simulator']['pre_support'].map{|o| tackit(o)}.join(' ') + ' ' + + $cfg['linker']['bin_files']['destination'] + + 'TestCMockC' + + $cfg['linker']['bin_files']['extension'] + ' ' + + $cfg['simulator']['post_support'].map{|o| tackit(o)}.join(' ') ) + end + end + end + + def fail_out(msg) + puts msg + exit(-1) + end +end + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/release/build.info b/flex-bison/mark1/tools/ceedling/vendor/cmock/release/build.info new file mode 100644 index 0000000..360b9e4 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/release/build.info @@ -0,0 +1,2 @@ +209 + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/release/version.info b/flex-bison/mark1/tools/ceedling/vendor/cmock/release/version.info new file mode 100644 index 0000000..0d71c08 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/release/version.info @@ -0,0 +1,2 @@ +2.0 + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/src/cmock.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/src/cmock.c new file mode 100644 index 0000000..558e19a --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/src/cmock.c @@ -0,0 +1,186 @@ +/* ========================================== + CMock Project - Automatic Mock Generation for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity.h" +#include "cmock.h" + +//define CMOCK_MEM_DYNAMIC to grab memory as needed with malloc +//when you do that, CMOCK_MEM_SIZE is used for incremental size instead of total +#ifdef CMOCK_MEM_STATIC +#undef CMOCK_MEM_DYNAMIC +#endif + +#ifdef CMOCK_MEM_DYNAMIC +#include +#endif + +//this is used internally during pointer arithmetic. make sure this type is the same size as the target's pointer type +#ifndef CMOCK_MEM_PTR_AS_INT +#define CMOCK_MEM_PTR_AS_INT unsigned long +#endif + +//0 for no alignment, 1 for 16-bit, 2 for 32-bit, 3 for 64-bit +#ifndef CMOCK_MEM_ALIGN +#define CMOCK_MEM_ALIGN (2) +#endif + +//amount of memory to allow cmock to use in its internal heap +#ifndef CMOCK_MEM_SIZE +#define CMOCK_MEM_SIZE (32768) +#endif + +//automatically calculated defs for easier reading +#define CMOCK_MEM_ALIGN_SIZE (1u << CMOCK_MEM_ALIGN) +#define CMOCK_MEM_ALIGN_MASK (CMOCK_MEM_ALIGN_SIZE - 1) +#define CMOCK_MEM_INDEX_SIZE ((sizeof(CMOCK_MEM_INDEX_TYPE) > CMOCK_MEM_ALIGN_SIZE) ? sizeof(CMOCK_MEM_INDEX_TYPE) : CMOCK_MEM_ALIGN_SIZE) + +//private variables +#ifdef CMOCK_MEM_DYNAMIC +static unsigned char* CMock_Guts_Buffer = NULL; +static CMOCK_MEM_INDEX_TYPE CMock_Guts_BufferSize = CMOCK_MEM_ALIGN_SIZE; +static CMOCK_MEM_INDEX_TYPE CMock_Guts_FreePtr; +#else +static unsigned char CMock_Guts_Buffer[CMOCK_MEM_SIZE + CMOCK_MEM_ALIGN_SIZE]; +static CMOCK_MEM_INDEX_TYPE CMock_Guts_BufferSize = CMOCK_MEM_SIZE + CMOCK_MEM_ALIGN_SIZE; +static CMOCK_MEM_INDEX_TYPE CMock_Guts_FreePtr; +#endif +//------------------------------------------------------- +// CMock_Guts_MemNew +//------------------------------------------------------- +CMOCK_MEM_INDEX_TYPE CMock_Guts_MemNew(CMOCK_MEM_INDEX_TYPE size) +{ + CMOCK_MEM_INDEX_TYPE index; + + //verify arguments valid (we must be allocating space for at least 1 byte, and the existing chain must be in memory somewhere) + if (size < 1) + return CMOCK_GUTS_NONE; + + //verify we have enough room + size = size + CMOCK_MEM_INDEX_SIZE; + if (size & CMOCK_MEM_ALIGN_MASK) + size = (size + CMOCK_MEM_ALIGN_MASK) & ~CMOCK_MEM_ALIGN_MASK; + if ((CMock_Guts_BufferSize - CMock_Guts_FreePtr) < size) + { +#ifdef CMOCK_MEM_DYNAMIC + CMock_Guts_BufferSize += CMOCK_MEM_SIZE + size; + CMock_Guts_Buffer = realloc(CMock_Guts_Buffer, CMock_Guts_BufferSize); + if (CMock_Guts_Buffer == NULL) +#endif //yes that if will continue to the return below if TRUE + return CMOCK_GUTS_NONE; + } + + //determine where we're putting this new block, and init its pointer to be the end of the line + index = CMock_Guts_FreePtr + CMOCK_MEM_INDEX_SIZE; + *(CMOCK_MEM_INDEX_TYPE*)(&CMock_Guts_Buffer[CMock_Guts_FreePtr]) = CMOCK_GUTS_NONE; + CMock_Guts_FreePtr += size; + + return index; +} + +//------------------------------------------------------- +// CMock_Guts_MemChain +//------------------------------------------------------- +CMOCK_MEM_INDEX_TYPE CMock_Guts_MemChain(CMOCK_MEM_INDEX_TYPE root_index, CMOCK_MEM_INDEX_TYPE obj_index) +{ + CMOCK_MEM_INDEX_TYPE index; + void* root; + void* obj; + void* next; + + if (root_index == CMOCK_GUTS_NONE) + { + //if there is no root currently, we return this object as the root of the chain + return obj_index; + } + else + { + //reject illegal nodes + if ((root_index < CMOCK_MEM_ALIGN_SIZE) || (root_index >= CMock_Guts_FreePtr)) + { + return CMOCK_GUTS_NONE; + } + if ((obj_index < CMOCK_MEM_ALIGN_SIZE) || (obj_index >= CMock_Guts_FreePtr)) + { + return CMOCK_GUTS_NONE; + } + + root = (void*)(&CMock_Guts_Buffer[root_index]); + obj = (void*)(&CMock_Guts_Buffer[obj_index]); + + //find the end of the existing chain and add us + next = root; + do { + index = *(CMOCK_MEM_INDEX_TYPE*)((CMOCK_MEM_PTR_AS_INT)next - CMOCK_MEM_INDEX_SIZE); + if (index >= CMock_Guts_FreePtr) + return CMOCK_GUTS_NONE; + if (index > 0) + next = (void*)(&CMock_Guts_Buffer[index]); + } while (index > 0); + *(CMOCK_MEM_INDEX_TYPE*)((CMOCK_MEM_PTR_AS_INT)next - CMOCK_MEM_INDEX_SIZE) = ((CMOCK_MEM_PTR_AS_INT)obj - (CMOCK_MEM_PTR_AS_INT)CMock_Guts_Buffer); + return root_index; + } +} + +//------------------------------------------------------- +// CMock_Guts_MemNext +//------------------------------------------------------- +CMOCK_MEM_INDEX_TYPE CMock_Guts_MemNext(CMOCK_MEM_INDEX_TYPE previous_item_index) +{ + CMOCK_MEM_INDEX_TYPE index; + void* previous_item; + + //There is nothing "next" if the pointer isn't from our buffer + if ((previous_item_index < CMOCK_MEM_ALIGN_SIZE) || (previous_item_index >= CMock_Guts_FreePtr)) + return CMOCK_GUTS_NONE; + previous_item = (void*)(&CMock_Guts_Buffer[previous_item_index]); + + //if the pointer is good, then use it to look up the next index + //(we know the first element always goes in zero, so NEXT must always be > 1) + index = *(CMOCK_MEM_INDEX_TYPE*)((CMOCK_MEM_PTR_AS_INT)previous_item - CMOCK_MEM_INDEX_SIZE); + if ((index > 1) && (index < CMock_Guts_FreePtr)) + return index; + else + return CMOCK_GUTS_NONE; +} + +//------------------------------------------------------- +// CMock_GetAddressFor +//------------------------------------------------------- +void* CMock_Guts_GetAddressFor(CMOCK_MEM_INDEX_TYPE index) +{ + if ((index >= CMOCK_MEM_ALIGN_SIZE) && (index < CMock_Guts_FreePtr)) + { + return (void*)(&CMock_Guts_Buffer[index]); + } + else + { + return NULL; + } +} + +//------------------------------------------------------- +// CMock_Guts_MemBytesFree +//------------------------------------------------------- +CMOCK_MEM_INDEX_TYPE CMock_Guts_MemBytesFree(void) +{ + return CMock_Guts_BufferSize - CMock_Guts_FreePtr; +} + +//------------------------------------------------------- +// CMock_Guts_MemBytesUsed +//------------------------------------------------------- +CMOCK_MEM_INDEX_TYPE CMock_Guts_MemBytesUsed(void) +{ + return CMock_Guts_FreePtr - CMOCK_MEM_ALIGN_SIZE; +} + +//------------------------------------------------------- +// CMock_Guts_MemFreeAll +//------------------------------------------------------- +void CMock_Guts_MemFreeAll(void) +{ + CMock_Guts_FreePtr = CMOCK_MEM_ALIGN_SIZE; //skip the very beginning +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/src/cmock.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/src/cmock.h new file mode 100644 index 0000000..a43e9e0 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/src/cmock.h @@ -0,0 +1,30 @@ +/* ========================================== + CMock Project - Automatic Mock Generation for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef CMOCK_FRAMEWORK_H +#define CMOCK_FRAMEWORK_H + +//should be big enough to index full range of CMOCK_MEM_MAX +#ifndef CMOCK_MEM_INDEX_TYPE +#define CMOCK_MEM_INDEX_TYPE unsigned int +#endif + +#define CMOCK_GUTS_NONE (0) + +//------------------------------------------------------- +// Memory API +//------------------------------------------------------- +CMOCK_MEM_INDEX_TYPE CMock_Guts_MemNew(CMOCK_MEM_INDEX_TYPE size); +CMOCK_MEM_INDEX_TYPE CMock_Guts_MemChain(CMOCK_MEM_INDEX_TYPE root_index, CMOCK_MEM_INDEX_TYPE obj_index); +CMOCK_MEM_INDEX_TYPE CMock_Guts_MemNext(CMOCK_MEM_INDEX_TYPE previous_item_index); + +void* CMock_Guts_GetAddressFor(CMOCK_MEM_INDEX_TYPE index); + +CMOCK_MEM_INDEX_TYPE CMock_Guts_MemBytesFree(void); +CMOCK_MEM_INDEX_TYPE CMock_Guts_MemBytesUsed(void); +void CMock_Guts_MemFreeAll(void); + +#endif //CMOCK_FRAMEWORK diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/targets/gcc.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/targets/gcc.yml new file mode 100644 index 0000000..e46aec5 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/targets/gcc.yml @@ -0,0 +1,50 @@ +--- +compiler: + path: gcc + source_path: &systest_generated_path 'test/system/generated/' + unit_tests_path: &unit_tests_path 'examples/test/' + mocks_path: &systest_mocks_path 'test/system/generated/' + build_path: &systest_build_path 'test/system/build/' + options: + - '-c' + - '-Wall' + - '-Wno-address' + - '-std=c99' + - '-pedantic' + includes: + prefix: '-I' + items: + - *systest_generated_path + - *unit_tests_path + - *systest_mocks_path + - 'src/' + - 'vendor/unity/src/' + - 'vendor/c_exception/lib/' + - 'test/system/test_compilation/' + - 'test/' + defines: + prefix: '-D' + items: + object_files: + prefix: '-o' + extension: '.o' + destination: *systest_build_path + +linker: + path: gcc + options: + - -lm + includes: + prefix: '-I' + object_files: + path: *systest_build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.exe' + destination: *systest_build_path + +unsupported: + - unity_64bit_support + +colour: true diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/targets/gcc_32_with_64_support.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/targets/gcc_32_with_64_support.yml new file mode 100644 index 0000000..2decb69 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/targets/gcc_32_with_64_support.yml @@ -0,0 +1,52 @@ +--- +compiler: + path: gcc + source_path: &systest_generated_path 'test/system/generated/' + unit_tests_path: &unit_tests_path 'examples/test/' + mocks_path: &systest_mocks_path 'test/system/generated/' + build_path: &systest_build_path 'test/system/build/' + options: + - '-c' + - '-Wall' + - '-Wno-address' + - '-std=c99' + - '-pedantic' + includes: + prefix: '-I' + items: + - *systest_generated_path + - *unit_tests_path + - *systest_mocks_path + - 'src/' + - 'vendor/unity/src/' + - 'vendor/c_exception/lib/' + - 'test/system/test_compilation/' + - 'test/' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - UNITY_LONG_WIDTH=32 + - 'CMOCK_MEM_PTR_AS_INT=long' + object_files: + prefix: '-o' + extension: '.o' + destination: *systest_build_path + +linker: + path: gcc + options: + - -lm + includes: + prefix: '-I' + object_files: + path: *systest_build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.exe' + destination: *systest_build_path + +unsupported: [] + +colour: true diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/targets/gcc_64.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/targets/gcc_64.yml new file mode 100644 index 0000000..2296537 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/targets/gcc_64.yml @@ -0,0 +1,53 @@ +--- +compiler: + path: gcc + source_path: &systest_generated_path 'test/system/generated/' + unit_tests_path: &unit_tests_path 'examples/test/' + mocks_path: &systest_mocks_path 'test/system/generated/' + build_path: &systest_build_path 'test/system/build/' + options: + - '-c' + - '-Wall' + - '-std=c99' + - '-Wno-address' + - '-pedantic-errors' + includes: + prefix: '-I' + items: + - *systest_generated_path + - *unit_tests_path + - *systest_mocks_path + - 'src/' + - 'vendor/unity/src/' + - 'vendor/c_exception/lib/' + - 'test/system/test_compilation/' + - 'test/' + defines: + prefix: '-D' + items: + - 'UNITY_SUPPORT_64' + - 'UNITY_LONG_WIDTH=64' + - 'UNITY_POINTER_WIDTH=64' + - 'CMOCK_MEM_PTR_AS_INT=long' + object_files: + prefix: '-o' + extension: '.o' + destination: *systest_build_path + +linker: + path: gcc + options: + - -lm + includes: + prefix: '-I' + object_files: + path: *systest_build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.exe' + destination: *systest_build_path + +unsupported: [] + +colour: true diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/targets/iar_arm_v4.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/targets/iar_arm_v4.yml new file mode 100644 index 0000000..574814b --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/targets/iar_arm_v4.yml @@ -0,0 +1,107 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 4.0\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: &systest_generated_path 'test/system/generated/' + unit_tests_path: &unit_tests_path 'examples/test/' + mocks_path: &systest_mocks_path 'test/system/generated/' + build_path: &systest_build_path 'test/system/build/' + options: + - --dlib_config + - [*tools_root, 'arm\lib\dl4tptinl8n.h'] + - -z3 + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian little + - --cpu ARM7TDMI + - --stack_align 4 + - --interwork + - -e + - --silent + - --warnings_are_errors + - --fpu None + #We are supressing some warnings here because we test CMock against some questionable code to make sure it still works + - --diag_suppress Pa050 + - --diag_suppress Pe191 + - --diag_suppress=Pe494 + - --diag_suppress=Pe083 + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - *systest_generated_path + - *unit_tests_path + - *systest_mocks_path + - 'src/' + - 'vendor/unity/src/' + - 'vendor/c_exception/lib/' + - 'test/system/test_compilation/' + - 'test\' + defines: + prefix: '-D' + items: + object_files: + prefix: '-o' + extension: '.r79' + destination: *systest_build_path + +linker: + path: [*tools_root, 'common\bin\xlink.exe'] + options: + - -rt + - [*tools_root, 'arm\lib\dl4tptinl8n.r79'] + - -D_L_EXTMEM_START=0 + - -D_L_EXTMEM_SIZE=0 + - -D_L_HEAP_SIZE=120 + - -D_L_STACK_SIZE=32 + - -e_small_write=_formatted_write + - -s + - __program_start + - '-f iar\iar_v4\Resource\at91SAM7X256_FLASH.xcl' + includes: + prefix: '-I' + items: + - *systest_generated_path + - *unit_tests_path + - *systest_mocks_path + - 'vendor/unity/src/' + - [*tools_root, 'arm\config\'] + - [*tools_root, 'arm\lib\'] + object_files: + path: *systest_build_path + extension: '.r79' + bin_files: + prefix: '-o' + extension: '.d79' + destination: *systest_build_path + +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --macro + - 'iar\iar_v4\Resource\SAM7_SIM.mac' + - --backend + - -B + - -p + - [*tools_root, 'arm\config\ioat91sam7X256.ddf'] + - -d + - sim + +unsupported: + - nonstandard_parsed_stuff_1 + - const + - unity_64bit_support + +colour: true diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/targets/iar_arm_v5.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/targets/iar_arm_v5.yml new file mode 100644 index 0000000..fc4e4c4 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/targets/iar_arm_v5.yml @@ -0,0 +1,92 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: &systest_generated_path 'test/system/generated/' + unit_tests_path: &unit_tests_path 'examples/test/' + mocks_path: &systest_mocks_path 'test/system/generated/' + build_path: &systest_build_path 'test/system/build/' + options: + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian=little + - --cpu=ARM7TDMI + - --interwork + - --warnings_are_errors + - --fpu=None + - -e + - -On + #We are supressing some warnings here because we test CMock against some questionable code to make sure it still works + - --diag_suppress=Pa050 + - --diag_suppress=Pe191 + - --diag_suppress=Pe494 + - --diag_suppress=Pe083 + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - *systest_generated_path + - *unit_tests_path + - *systest_mocks_path + - 'src/' + - 'vendor/unity/src/' + - 'vendor/c_exception/lib/' + - 'iar\iar_v5\incIAR\' + - 'test\system\test_compilation\' + - 'test\' + defines: + prefix: '-D' + items: + object_files: + prefix: '-o' + extension: '.r79' + destination: *systest_build_path + +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config iar\iar_v5\Resource\at91SAM7X256_RAM.icf + object_files: + path: *systest_build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *systest_build_path + +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --macro + - 'iar\iar_v5\Resource\SAM7_SIM.mac' + - --backend + - -B + - -p + - [*tools_root, 'arm\config\debugger\Atmel\ioat91sam7X256.ddf'] + - -d + - sim + +unsupported: + - nonstandard_parsed_stuff_1 + - const + - unity_64bit_support + +colour: true diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/test/c/TestCMockC.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/c/TestCMockC.c new file mode 100644 index 0000000..9a61b39 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/c/TestCMockC.c @@ -0,0 +1,280 @@ +/* ========================================== + CMock Project - Automatic Mock Generation for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity.h" +#include "cmock.h" + +#define TEST_MEM_INDEX_SIZE (sizeof(CMOCK_MEM_INDEX_TYPE)) + +void setUp(void) +{ + CMock_Guts_MemFreeAll(); +} + +void tearDown(void) +{ +} + +void test_MemNewWillReturnNullIfGivenIllegalSizes(void) +{ + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemNew(0) ); + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemNew(CMOCK_MEM_SIZE - TEST_MEM_INDEX_SIZE + 1) ); + TEST_ASSERT_NULL( CMock_Guts_GetAddressFor(CMOCK_GUTS_NONE) ); + + //verify we're cleared still + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE, CMock_Guts_MemBytesFree()); +} + +void test_MemChainWillReturnNullAndDoNothingIfGivenIllegalInformation(void) +{ + CMOCK_MEM_INDEX_TYPE next = CMock_Guts_MemNew(4); + TEST_ASSERT_EQUAL(4 + TEST_MEM_INDEX_SIZE, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - 4 - TEST_MEM_INDEX_SIZE, CMock_Guts_MemBytesFree()); + + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemChain(next + CMOCK_MEM_SIZE, next) ); + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemChain(next, next + CMOCK_MEM_SIZE) ); + + //verify we're still the same + TEST_ASSERT_EQUAL(4 + TEST_MEM_INDEX_SIZE, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - 4 - TEST_MEM_INDEX_SIZE, CMock_Guts_MemBytesFree()); +} + +void test_MemNextWillReturnNullIfGivenABadRoot(void) +{ + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemNext(0) ); + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemNext(2) ); + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemNext(CMOCK_MEM_SIZE - 4) ); + + //verify we're cleared still + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE, CMock_Guts_MemBytesFree()); +} + +void test_ThatWeCanClaimAndChainAFewElementsTogether(void) +{ + unsigned int i; + CMOCK_MEM_INDEX_TYPE next; + CMOCK_MEM_INDEX_TYPE first = CMOCK_GUTS_NONE; + CMOCK_MEM_INDEX_TYPE element[4]; + + //verify we're cleared first + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE, CMock_Guts_MemBytesFree()); + + //first element + element[0] = CMock_Guts_MemNew(sizeof(unsigned int)); + TEST_ASSERT_MESSAGE(element[0] != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + first = CMock_Guts_MemChain(first, element[0]); + TEST_ASSERT_EQUAL(element[0], first); + *((unsigned int*)CMock_Guts_GetAddressFor(element[0])) = 0; + + //verify we're using the right amount of memory + TEST_ASSERT_EQUAL(1 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - 1 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesFree()); + + //second element + element[1] = CMock_Guts_MemNew(sizeof(unsigned int)); + TEST_ASSERT_MESSAGE(element[1] != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + TEST_ASSERT_NOT_EQUAL(element[0], element[1]); + TEST_ASSERT_EQUAL(first, CMock_Guts_MemChain(first, element[1])); + *((unsigned int*)CMock_Guts_GetAddressFor(element[1])) = 1; + + //verify we're using the right amount of memory + TEST_ASSERT_EQUAL(2 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - 2 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesFree()); + + //third element + element[2] = CMock_Guts_MemNew(sizeof(unsigned int)); + TEST_ASSERT_MESSAGE(element[2] != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + TEST_ASSERT_NOT_EQUAL(element[0], element[2]); + TEST_ASSERT_NOT_EQUAL(element[1], element[2]); + TEST_ASSERT_EQUAL(first, CMock_Guts_MemChain(first, element[2])); + *((unsigned int*)CMock_Guts_GetAddressFor(element[2])) = 2; + + //verify we're using the right amount of memory + TEST_ASSERT_EQUAL(3 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - 3 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesFree()); + + //fourth element + element[3] = CMock_Guts_MemNew(sizeof(unsigned int)); + TEST_ASSERT_MESSAGE(element[3] != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + TEST_ASSERT_NOT_EQUAL(element[0], element[3]); + TEST_ASSERT_NOT_EQUAL(element[1], element[3]); + TEST_ASSERT_NOT_EQUAL(element[2], element[3]); + TEST_ASSERT_EQUAL(first, CMock_Guts_MemChain(first, element[3])); + *((unsigned int*)CMock_Guts_GetAddressFor(element[3])) = 3; + + //verify we're using the right amount of memory + TEST_ASSERT_EQUAL(4 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - 4 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesFree()); + + //traverse list + next = first; + for (i = 0; i < 4; i++) + { + TEST_ASSERT_EQUAL(element[i], next); + TEST_ASSERT_EQUAL(i, *((unsigned int*)CMock_Guts_GetAddressFor(element[i]))); + next = CMock_Guts_MemNext(next); + } + + //verify we get a null at the end of the list + TEST_ASSERT_EQUAL_HEX(CMOCK_GUTS_NONE, next); + + //verify we're using the right amount of memory + TEST_ASSERT_EQUAL(4 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - 4 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesFree()); + + //Free it all + CMock_Guts_MemFreeAll(); + + //verify we're cleared + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE, CMock_Guts_MemBytesFree()); +} + +void test_ThatCMockStopsReturningMoreDataWhenItRunsOutOfMemory(void) +{ + unsigned int i; + CMOCK_MEM_INDEX_TYPE first = CMOCK_GUTS_NONE; + CMOCK_MEM_INDEX_TYPE next; + + //even though we are asking for one byte, we've told it to align to closest 4 bytes, therefore it will waste a byte each time + //so each call will use 8 bytes (4 for the index, 1 for the data, and 3 wasted). + //therefore we can safely allocated total/8 times. + for (i = 0; i < (CMOCK_MEM_SIZE / 8); i++) + { + TEST_ASSERT_EQUAL(i*8, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - i*8, CMock_Guts_MemBytesFree()); + + next = CMock_Guts_MemNew(1); + TEST_ASSERT_MESSAGE(next != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + + first = CMock_Guts_MemChain(first, next); + TEST_ASSERT_MESSAGE(first != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + } + + //verify we're at top of memory + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesFree()); + + //The very next call will return a NULL, and any after that + TEST_ASSERT_EQUAL_HEX(CMOCK_GUTS_NONE, CMock_Guts_MemNew(1)); + TEST_ASSERT_EQUAL_HEX(CMOCK_GUTS_NONE, CMock_Guts_MemNew(1)); + TEST_ASSERT_EQUAL_HEX(CMOCK_GUTS_NONE, CMock_Guts_MemNew(1)); + + //verify nothing has changed + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesFree()); + + //verify we can still walk through the elements allocated + next = first; + for (i = 0; i < (CMOCK_MEM_SIZE / 8); i++) + { + TEST_ASSERT_MESSAGE(next != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + next = CMock_Guts_MemNext(next); + } + + //there aren't any after that + TEST_ASSERT_EQUAL_HEX(CMOCK_GUTS_NONE, next); +} + +void test_ThatCMockStopsReturningMoreDataWhenAskForMoreThanItHasLeftEvenIfNotAtExactEnd(void) +{ + unsigned int i; + CMOCK_MEM_INDEX_TYPE first = CMOCK_GUTS_NONE; + CMOCK_MEM_INDEX_TYPE next; + + //we're asking for 12 bytes each time now (4 for index, 8 for data). + //10 requests will give us 120 bytes used, which isn't enough for another 12 bytes if total memory is 128 + for (i = 0; i < 10; i++) + { + TEST_ASSERT_EQUAL(i*12, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - i*12, CMock_Guts_MemBytesFree()); + + next = CMock_Guts_MemNew(8); + TEST_ASSERT_MESSAGE(next != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + + first = CMock_Guts_MemChain(first, next); + TEST_ASSERT_MESSAGE(first != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + + //verify writing data won't screw us up + *((unsigned int*)CMock_Guts_GetAddressFor(next)) = i; + } + + //verify we're at top of memory + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - 8, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(8, CMock_Guts_MemBytesFree()); + + //The very next call will return a NONE, and any after that + TEST_ASSERT_EQUAL_HEX(CMOCK_GUTS_NONE, CMock_Guts_MemNew(8)); + TEST_ASSERT_EQUAL_HEX(CMOCK_GUTS_NONE, CMock_Guts_MemNew(5)); + + //verify nothing has changed + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - 8, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(8, CMock_Guts_MemBytesFree()); + + //verify we can still walk through the elements allocated + next = first; + for (i = 0; i < 10; i++) + { + TEST_ASSERT_MESSAGE(next != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + TEST_ASSERT_EQUAL(i, *((unsigned int*)CMock_Guts_GetAddressFor(next))); + next = CMock_Guts_MemNext(next); + } + + //there aren't any after that + TEST_ASSERT_EQUAL_HEX(CMOCK_GUTS_NONE, next); +} + +void test_ThatWeCanAskForAllSortsOfSizes(void) +{ + unsigned int i; + CMOCK_MEM_INDEX_TYPE first = CMOCK_GUTS_NONE; + CMOCK_MEM_INDEX_TYPE next; + unsigned int sizes[5] = {3, 1, 80, 5, 4}; + unsigned int sizes_buffered[5] = {4, 4, 80, 8, 4}; + unsigned int sum = 0; + + for (i = 0; i < 5; i++) + { + next = CMock_Guts_MemNew(sizes[i]); + TEST_ASSERT_MESSAGE(next != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + + first = CMock_Guts_MemChain(first, next); + TEST_ASSERT_MESSAGE(first != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + + sum += sizes_buffered[i] + 4; + TEST_ASSERT_EQUAL(sum, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - sum, CMock_Guts_MemBytesFree()); + } + + //show that we can't ask for too much memory + TEST_ASSERT_EQUAL_HEX(CMOCK_GUTS_NONE, CMock_Guts_MemNew(12)); + TEST_ASSERT_EQUAL_HEX(CMOCK_GUTS_NONE, CMock_Guts_MemNew(5)); + + //but we CAN ask for something that will still fit + next = CMock_Guts_MemNew(4); + TEST_ASSERT_MESSAGE(next != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + + first = CMock_Guts_MemChain(first, next); + TEST_ASSERT_MESSAGE(first != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + + //verify we're used up now + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesFree()); + + //verify we can still walk through the elements allocated + next = first; + for (i = 0; i < 6; i++) + { + TEST_ASSERT_MESSAGE(next != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + next = CMock_Guts_MemNext(next); + } + + //there aren't any after that + TEST_ASSERT_EQUAL_HEX(CMOCK_GUTS_NONE, next); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/test/c/TestCMockC.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/c/TestCMockC.yml new file mode 100644 index 0000000..cd76154 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/c/TestCMockC.yml @@ -0,0 +1,12 @@ +--- +:files: + - 'src/cmock.c' + - 'test/c/TestCMockC.c' + - 'test/c/TestCMockC_Runner.c' + - 'vendor/unity/src/unity.c' +:options: + - 'TEST' + - 'CMOCK_MEM_SIZE=128' + - 'CMOCK_MEM_ALIGN=2' + - 'CMOCK_MEM_INDEX_TYPE=int' + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/test/c/TestCMockCDynamic.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/c/TestCMockCDynamic.c new file mode 100644 index 0000000..bd699a8 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/c/TestCMockCDynamic.c @@ -0,0 +1,186 @@ +/* ========================================== + CMock Project - Automatic Mock Generation for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity.h" +#include "cmock.h" + +#define TEST_MEM_INDEX_SIZE (sizeof(CMOCK_MEM_INDEX_TYPE)) +#define TEST_MEM_INDEX_PAD ((sizeof(CMOCK_MEM_INDEX_TYPE) + 7) & ~7) //round up to nearest 4 byte boundary + +unsigned int StartingSize; + +void setUp(void) +{ + CMock_Guts_MemFreeAll(); + StartingSize = CMock_Guts_MemBytesFree(); + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesUsed()); +} + +void tearDown(void) +{ +} + +void test_MemNewWillReturnNullIfGivenIllegalSizes(void) +{ + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemNew(0) ); + + //verify we're cleared still + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesFree()); +} + +void test_MemNewWillNowSupportSizesGreaterThanTheDefinesCMockSize(void) +{ + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesFree()); + + TEST_ASSERT_MESSAGE(CMock_Guts_MemNew(CMOCK_MEM_SIZE - TEST_MEM_INDEX_SIZE + 1) != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE + TEST_MEM_INDEX_PAD, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE, CMock_Guts_MemBytesFree()); +} + +void test_MemChainWillReturnNullAndDoNothingIfGivenIllegalInformation(void) +{ + CMOCK_MEM_INDEX_TYPE next = CMock_Guts_MemNew(8); + TEST_ASSERT_EQUAL(8 + TEST_MEM_INDEX_PAD, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(StartingSize - 8 - TEST_MEM_INDEX_PAD, CMock_Guts_MemBytesFree()); + + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemChain(next + CMOCK_MEM_SIZE, next) ); + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemChain(next, next + CMOCK_MEM_SIZE) ); + + //verify we're still the same + TEST_ASSERT_EQUAL(8 + TEST_MEM_INDEX_PAD, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(StartingSize - 8 - TEST_MEM_INDEX_PAD, CMock_Guts_MemBytesFree()); +} + +void test_MemNextWillReturnNullIfGivenABadRoot(void) +{ + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemNext(0) ); + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemNext(2) ); + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemNext( CMOCK_MEM_SIZE - 4 ) ); + + //verify we're cleared still + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(StartingSize, CMock_Guts_MemBytesFree()); +} + +void test_ThatWeCanClaimAndChainAFewElementsTogether(void) +{ + unsigned int i; + CMOCK_MEM_INDEX_TYPE first = CMOCK_GUTS_NONE; + CMOCK_MEM_INDEX_TYPE next; + CMOCK_MEM_INDEX_TYPE element[4]; + + //verify we're cleared first + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(StartingSize, CMock_Guts_MemBytesFree()); + + //first element + element[0] = CMock_Guts_MemNew(sizeof(unsigned int)); + TEST_ASSERT_MESSAGE(element[0] != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + first = CMock_Guts_MemChain(first, element[0]); + TEST_ASSERT_EQUAL(element[0], first); + *((unsigned int*)CMock_Guts_GetAddressFor(element[0])) = 0; + + //verify we're using the right amount of memory + TEST_ASSERT_EQUAL(1 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(StartingSize - 1 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesFree()); + + //second element + element[1] = CMock_Guts_MemNew(sizeof(unsigned int)); + TEST_ASSERT_MESSAGE(element[1] != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + TEST_ASSERT_NOT_EQUAL(element[0], element[1]); + TEST_ASSERT_EQUAL(first, CMock_Guts_MemChain(first, element[1])); + *((unsigned int*)CMock_Guts_GetAddressFor(element[1])) = 1; + + //verify we're using the right amount of memory + TEST_ASSERT_EQUAL(2 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(StartingSize - 2 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesFree()); + + //third element + element[2] = CMock_Guts_MemNew(sizeof(unsigned int)); + TEST_ASSERT_MESSAGE(element[2] != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + TEST_ASSERT_NOT_EQUAL(element[0], element[2]); + TEST_ASSERT_NOT_EQUAL(element[1], element[2]); + TEST_ASSERT_EQUAL(first, CMock_Guts_MemChain(first, element[2])); + *((unsigned int*)CMock_Guts_GetAddressFor(element[2])) = 2; + + //verify we're using the right amount of memory + TEST_ASSERT_EQUAL(3 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(StartingSize - 3 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesFree()); + + //fourth element + element[3] = CMock_Guts_MemNew(sizeof(unsigned int)); + TEST_ASSERT_MESSAGE(element[3] != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + TEST_ASSERT_NOT_EQUAL(element[0], element[3]); + TEST_ASSERT_NOT_EQUAL(element[1], element[3]); + TEST_ASSERT_NOT_EQUAL(element[2], element[3]); + TEST_ASSERT_EQUAL(first, CMock_Guts_MemChain(first, element[3])); + *((unsigned int*)CMock_Guts_GetAddressFor(element[3])) = 3; + + //verify we're using the right amount of memory + TEST_ASSERT_EQUAL(4 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(StartingSize - 4 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesFree()); + + //traverse list + next = first; + for (i = 0; i < 4; i++) + { + TEST_ASSERT_EQUAL(element[i], next); + TEST_ASSERT_EQUAL(i, *((unsigned int*)CMock_Guts_GetAddressFor(element[i]))); + next = CMock_Guts_MemNext(next); + } + + //verify we get a null at the end of the list + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, next); + + //verify we're using the right amount of memory + TEST_ASSERT_EQUAL(4 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(StartingSize - 4 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesFree()); + + //Free it all + CMock_Guts_MemFreeAll(); + + //verify we're cleared + TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesUsed()); + TEST_ASSERT_EQUAL(StartingSize, CMock_Guts_MemBytesFree()); +} + +void test_ThatWeCanAskForAllSortsOfSizes(void) +{ + unsigned int i; + CMOCK_MEM_INDEX_TYPE first = CMOCK_GUTS_NONE; + CMOCK_MEM_INDEX_TYPE next; + unsigned int sizes[10] = {3, 1, 80, 5, 8, 31, 7, 911, 2, 80}; + unsigned int sizes_buffered[10] = {16, 16, 88, 16, 16, 40, 16, 920, 16, 88}; //includes counter + unsigned int sum = 0; + unsigned int cap; + + for (i = 0; i < 10; i++) + { + next = CMock_Guts_MemNew(sizes[i]); + TEST_ASSERT_MESSAGE(next != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + + first = CMock_Guts_MemChain(first, next); + TEST_ASSERT_MESSAGE(first != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + + sum += sizes_buffered[i]; + cap = (StartingSize > (sum + CMOCK_MEM_SIZE)) ? StartingSize : (sum + CMOCK_MEM_SIZE); + TEST_ASSERT_EQUAL(sum, CMock_Guts_MemBytesUsed()); + TEST_ASSERT(cap >= CMock_Guts_MemBytesFree()); + } + + //verify we can still walk through the elements allocated + next = first; + for (i = 0; i < 10; i++) + { + TEST_ASSERT_MESSAGE(next != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE"); + next = CMock_Guts_MemNext(next); + } + + //there aren't any after that + TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, next); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/test/c/TestCMockCDynamic.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/c/TestCMockCDynamic.yml new file mode 100644 index 0000000..7776c89 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/c/TestCMockCDynamic.yml @@ -0,0 +1,12 @@ +--- +:files: + - 'src/cmock.c' + - 'test/c/TestCMockCDynamic.c' + - 'test/c/TestCMockCDynamic_Runner.c' + - 'vendor/unity/src/unity.c' +:options: + - 'TEST' + - 'CMOCK_MEM_DYNAMIC' + - 'CMOCK_MEM_SIZE=64' + - 'CMOCK_MEM_ALIGN=3' + - 'CMOCK_MEM_INDEX_TYPE=short' diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/test/c/TestCMockCDynamic_Runner.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/c/TestCMockCDynamic_Runner.c new file mode 100644 index 0000000..e161625 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/c/TestCMockCDynamic_Runner.c @@ -0,0 +1,35 @@ +/* ========================================== + CMock Project - Automatic Mock Generation for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity.h" +#include +#include + +extern void setUp(void); +extern void tearDown(void); + +extern void test_MemNewWillReturnNullIfGivenIllegalSizes(void); +extern void test_MemNewWillNowSupportSizesGreaterThanTheDefinesCMockSize(void); +extern void test_MemChainWillReturnNullAndDoNothingIfGivenIllegalInformation(void); +extern void test_MemNextWillReturnNullIfGivenABadRoot(void); +extern void test_ThatWeCanClaimAndChainAFewElementsTogether(void); +extern void test_ThatWeCanAskForAllSortsOfSizes(void); + +int main(void) +{ + Unity.TestFile = "TestCMockDynamic.c"; + UnityBegin(); + + RUN_TEST(test_MemNewWillReturnNullIfGivenIllegalSizes, 26); + RUN_TEST(test_MemNewWillNowSupportSizesGreaterThanTheDefinesCMockSize, 35); + RUN_TEST(test_MemChainWillReturnNullAndDoNothingIfGivenIllegalInformation, 45); + RUN_TEST(test_MemNextWillReturnNullIfGivenABadRoot, 59); + RUN_TEST(test_ThatWeCanClaimAndChainAFewElementsTogether, 70); + RUN_TEST(test_ThatWeCanAskForAllSortsOfSizes, 152); + + UnityEnd(); + return 0; +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/test/c/TestCMockC_Runner.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/c/TestCMockC_Runner.c new file mode 100644 index 0000000..93d8e1f --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/c/TestCMockC_Runner.c @@ -0,0 +1,37 @@ +/* ========================================== + CMock Project - Automatic Mock Generation for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity.h" +#include +#include + +extern void setUp(void); +extern void tearDown(void); + +extern void test_MemNewWillReturnNullIfGivenIllegalSizes(void); +extern void test_MemChainWillReturnNullAndDoNothingIfGivenIllegalInformation(void); +extern void test_MemNextWillReturnNullIfGivenABadRoot(void); +extern void test_ThatWeCanClaimAndChainAFewElementsTogether(void); +extern void test_ThatCMockStopsReturningMoreDataWhenItRunsOutOfMemory(void); +extern void test_ThatCMockStopsReturningMoreDataWhenAskForMoreThanItHasLeftEvenIfNotAtExactEnd(void); +extern void test_ThatWeCanAskForAllSortsOfSizes(void); + +int main(void) +{ + Unity.TestFile = "TestCMock.c"; + UnityBegin(); + + RUN_TEST(test_MemNewWillReturnNullIfGivenIllegalSizes, 21); + RUN_TEST(test_MemChainWillReturnNullAndDoNothingIfGivenIllegalInformation, 32); + RUN_TEST(test_MemNextWillReturnNullIfGivenABadRoot, 46); + RUN_TEST(test_ThatWeCanClaimAndChainAFewElementsTogether, 57); + RUN_TEST(test_ThatCMockStopsReturningMoreDataWhenItRunsOutOfMemory, 139); + RUN_TEST(test_ThatCMockStopsReturningMoreDataWhenAskForMoreThanItHasLeftEvenIfNotAtExactEnd, 185); + RUN_TEST(test_ThatWeCanAskForAllSortsOfSizes, 233); + + UnityEnd(); + return 0; +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/systest_generator.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/systest_generator.rb new file mode 100644 index 0000000..368b039 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/systest_generator.rb @@ -0,0 +1,178 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require 'yaml' + +SYS_TEST_GEN_ROOT = File.expand_path( File.dirname( __FILE__ ) ) + '/' +GENERATED_PATH = SYS_TEST_GEN_ROOT + 'generated/' +BUILD_PATH = SYS_TEST_GEN_ROOT + 'build/' +CASES_PATH = SYS_TEST_GEN_ROOT + 'cases/' + +TYPES_H = 'types.h' +UNITY_H = 'unity.h' +CMOCK_H = 'cmock.h' +UNITY_HELPER_H = 'unity_helper.h' +UNITY_HELPER_C = 'unity_helper.c' +MOCKABLE_H = 'mockable.h' + +YAML_EXTENSION = '.yml' +TEST_PREFIX = 'test_' +MOCK_PREFIX = 'mock_' +H_EXTENSION = '.h' +C_EXTENSION = '.c' + + +class SystemTestGenerator + + def generate_files(test_cases) + test_cases.each do |filename| + yaml_hash = YAML.load_file(filename) + + name = File.basename(filename, YAML_EXTENSION) + namix = "#{name}_" + + generate_cmock_config(yaml_hash, namix) + generate_code(yaml_hash, namix, name) + end + end + + private + + def generate_cmock_config(yaml_hash, namix) + cmock_yaml = yaml_hash.clone + cmock_yaml.delete(:systest) + cmock = cmock_yaml[:cmock] + + cmock[:mock_path] = GENERATED_PATH + cmock[:includes] = (cmock[:includes] || []) + [namix + TYPES_H] + cmock[:mock_prefix] = MOCK_PREFIX + if not yaml_hash[:systest][:unity_helper].nil? + cmock[:includes] << namix + UNITY_HELPER_H + cmock[:unity_helper] = GENERATED_PATH + namix + UNITY_HELPER_H + end + + File.open(GENERATED_PATH + namix + 'cmock' + YAML_EXTENSION, 'w') do |out| + YAML.dump(cmock_yaml, out) + end + end + + def generate_code(yaml_hash, namix, name) + generate_types_file(yaml_hash, namix) + generate_mockable_file(yaml_hash, namix) + generate_unity_helper_files(yaml_hash, namix) + + generate_test_file(yaml_hash, namix, name) + generate_source_file(yaml_hash, namix, name) + end + + def generate_types_file(yaml_hash, namix) + types = yaml_hash[:systest][:types] + return if types.nil? + + write_header_file(GENERATED_PATH + namix + TYPES_H, namix.upcase + 'TYPES_H') do |out| + out.puts(types) + end + end + + def generate_mockable_file(yaml_hash, namix) + mockable = yaml_hash[:systest][:mockable] + return if mockable.nil? + + write_header_file(GENERATED_PATH + namix + MOCKABLE_H, namix.upcase + 'MOCKABLE_H', [namix + TYPES_H]) do |out| + out.puts(mockable) + end + end + + def generate_unity_helper_files(yaml_hash, namix) + unity_helper = yaml_hash[:systest][:unity_helper] + return if unity_helper.nil? + + write_header_file(GENERATED_PATH + namix + UNITY_HELPER_H, namix.upcase + 'UNITY_HELPER_H', [namix + TYPES_H]) do |out| + out.puts(unity_helper[:header]) + end + + write_source_file(GENERATED_PATH + namix + UNITY_HELPER_C, ["unity.h", namix + UNITY_HELPER_H]) do |out| + out.puts(unity_helper[:code]) + end + end + + def generate_test_file(yaml_hash, namix, name) + tests = yaml_hash[:systest][:tests] + return if tests.nil? + + includes = [UNITY_H, CMOCK_H] + includes << (namix + UNITY_HELPER_H) if not yaml_hash[:systest][:unity_helper].nil? + includes << [MOCK_PREFIX + namix + MOCKABLE_H] + includes << [name + H_EXTENSION] + + write_source_file(GENERATED_PATH + TEST_PREFIX + name + C_EXTENSION, includes.flatten) do |out| + out.puts(tests[:common]) + out.puts('') + + tests[:units].each_with_index do |test, index| + out.puts('// should ' + test[:should]) + out.puts(test[:code].gsub!(/test\(\)/, "void test#{index+1}(void)")) + out.puts('') + end + end + end + + def generate_source_file(yaml_hash, namix, name) + source = yaml_hash[:systest][:source] + return if source.nil? + + header_file = name + H_EXTENSION + + includes = yaml_hash[:systest][:types].nil? ? [] : [(namix + TYPES_H)] + + write_header_file(GENERATED_PATH + header_file, name.upcase, includes) do |out| + out.puts(source[:header]) + end + + includes = [] + includes << (namix + TYPES_H) if not yaml_hash[:systest][:types].nil? + includes << (namix + MOCKABLE_H) if not yaml_hash[:systest][:mockable].nil? + includes << header_file + + write_source_file(GENERATED_PATH + name + C_EXTENSION, includes.flatten) do |out| + out.puts(source[:code]) + end + end + + def write_header_file(filename, upcase_name, include_list=[]) + File.open(filename, 'w') do |out| + out.puts("#ifndef _#{upcase_name}") + out.puts("#define _#{upcase_name}") + out.puts('') + include_list.each do |include| + out.puts("#include \"#{include}\"") + end + out.puts('') + yield(out) + out.puts('') + out.puts("#endif // _#{upcase_name}") + out.puts('') + end + end + + def write_source_file(filename, include_list=[]) + File.open(filename, 'w') do |out| + include_list.each do |include| + out.puts("#include \"#{include}\"") + end + out.puts('') + yield(out) + out.puts('') + end + end + +end + + +if ($0 == __FILE__) + SystemTestGenerator.new.generate_files(Dir[CASES_PATH + "*#{YAML_EXTENSION}"]) +end + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_compilation/config.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_compilation/config.yml new file mode 100644 index 0000000..7726699 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_compilation/config.yml @@ -0,0 +1,9 @@ +--- +:cmock: + :plugins: [] + :includes: [] + :mock_path: test/system/generated/ + :mock_prefix: mock_ + :treat_as_void: + - OSEK_TASK + - VOID_TYPE_CRAZINESS diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_compilation/const.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_compilation/const.h new file mode 100644 index 0000000..e17c465 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_compilation/const.h @@ -0,0 +1,15 @@ +/* ========================================== + CMock Project - Automatic Mock Generation for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +struct _DUMMY_T { unsigned int a; float b; }; + +void const_variants1( const char* a, int const, unsigned short const * c ); + +void const_variants2( + struct _DUMMY_T const * const param1, + const unsigned long int const * const param2, + const struct _DUMMY_T const * param3 ); + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_compilation/osek.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_compilation/osek.h new file mode 100644 index 0000000..f3abe7b --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_compilation/osek.h @@ -0,0 +1,275 @@ +/* ========================================== + CMock Project - Automatic Mock Generation for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +typedef unsigned char OSServiceIdType; +typedef void (*OSEKOS_VOIDFUNCPTR)(void); + +typedef unsigned char StatusType; +typedef unsigned char OSEK_U8; +typedef unsigned short OSEK_U16; +typedef unsigned long OSEK_U32; + +void OSEKOSDisableAll(void); +void OSEKOSEnableAll(void); + +typedef unsigned long * OSEKOSSaveType; +typedef void OSEK_TASK; +typedef OSEK_U8 OSEKOSPrioType; + +enum { +Task_DbgCAN +, +Task_ALS +, +CalibrateMagTask +, +Task_IAQ +, +SmartBeam +, +Task_QbertTestImage +, +Task_TestQbertMem +, +Task_Cyclic1000 +, +ProcessMagForCompass +, +ReadMag +, +Task_Cyclic10 +, +Task_Wdm +, +BackgroundTask +, +Task_Cyclic20 +, +Task_Cyclic2 +}; + +OSEK_TASK OSEKOS_T_Task_DbgCAN(void); +OSEK_TASK OSEKOS_T_Task_ALS(void); +OSEK_TASK OSEKOS_T_CalibrateMagTask(void); +OSEK_TASK OSEKOS_T_Task_IAQ(void); +OSEK_TASK OSEKOS_T_SmartBeam(void); +OSEK_TASK OSEKOS_T_Task_QbertTestImage(void); +OSEK_TASK OSEKOS_T_Task_TestQbertMem(void); +OSEK_TASK OSEKOS_T_Task_Cyclic1000(void); +OSEK_TASK OSEKOS_T_ProcessMagForCompass(void); +OSEK_TASK OSEKOS_T_ReadMag(void); +OSEK_TASK OSEKOS_T_Task_Cyclic10(void); +OSEK_TASK OSEKOS_T_Task_Wdm(void); +OSEK_TASK OSEKOS_T_BackgroundTask(void); +OSEK_TASK OSEKOS_T_Task_Cyclic20(void); +OSEK_TASK OSEKOS_T_Task_Cyclic2(void); +OSEK_TASK OSEKOS_Twrap_Task_DbgCAN(void); +OSEK_TASK OSEKOS_Twrap_Task_ALS(void); +OSEK_TASK OSEKOS_Twrap_CalibrateMagTask(void); +OSEK_TASK OSEKOS_Twrap_Task_IAQ(void); +OSEK_TASK OSEKOS_Twrap_SmartBeam(void); +OSEK_TASK OSEKOS_Twrap_Task_QbertTestImage(void); +OSEK_TASK OSEKOS_Twrap_Task_TestQbertMem(void); +OSEK_TASK OSEKOS_Twrap_Task_Cyclic1000(void); +OSEK_TASK OSEKOS_Twrap_ProcessMagForCompass(void); +OSEK_TASK OSEKOS_Twrap_ReadMag(void); +OSEK_TASK OSEKOS_Twrap_Task_Cyclic10(void); +OSEK_TASK OSEKOS_Twrap_Task_Wdm(void); +OSEK_TASK OSEKOS_Twrap_BackgroundTask(void); +OSEK_TASK OSEKOS_Twrap_Task_Cyclic20(void); +OSEK_TASK OSEKOS_Twrap_Task_Cyclic2(void); + +typedef OSEK_U8 TaskType; +typedef OSEK_U8 TaskStateType; +typedef OSEK_U16 EventMaskType; +typedef OSEK_U8 ResourceType; + +void OSEKOSEnableSystemTimers(void); + +typedef OSEK_U8 CounterType; +typedef OSEK_U32 TickType; +typedef OSEK_U8 AlarmType; + +void OSEKOS_ISR_CanTxInterrupt(void); +void OSEKOS_ISR_CanRxInterrupt(void); +void OSEKOS_ISR_CanErrInterrupt(void); +void OSEKOS_ISR_SCIRxInterrupt(void); +void OSEKOS_ISR_SCITxInterrupt(void); +void OSEKOS_ISR_UP_DMA_Interrupt_0(void); +void OSEKOS_ISR_UP_DMA_Interrupt_1(void); +void OSEKOS_ISR_UP_DMA_Interrupt_2(void); +void OSEKOS_ISR_UP_DMA_Interrupt_3(void); +void OSEKOS_ISR_CompFreqHandler(void); +void OSEKOS_ISR_AmbientReturnInt(void); +void OSEKOS_ISR_GlareReturnInt(void); +void OSEKOS_ISR_ALSTimeoutInt(void); +void OSEKOS_ISR_LINTimerInt(void); +void OSEKOS_ISR_LINDelayInt(void); +void OSEKOS_ISR_TimerMExpire(void); +void OSEKOS_ISR_LINRxTx_SCI1(void); +void OSEKOS_ISR_CanRxInterrupt_1(void); +void OSEKOS_ISR_LINError_SCI1(void); +void OSEKOS_ISR_SysCounter(void); + + +// defined multiple times (slightly different forms) These should be ignored because they are externed +extern void OSEKOS_ISR_CanTxInterrupt( void ); +extern void OSEKOS_ISR_CanRxInterrupt( void ); + + +unsigned long OSEKOSrtcGetSeconds ( void ); +void OSEKOSrtcIncrement ( unsigned long nsec ); + +enum +{ + E_OS_ACCESS = 1, + E_OS_CALLEVEL = 2, + E_OS_ID = 3, + E_OS_LIMIT = 4, + E_OS_NOFUNC = 5, + E_OS_RESOURCE = 6, + E_OS_STATE = 7, + E_OS_VALUE = 8, + E_OS_SYS_StackOverflow = 20, + E_OS_SYS_StackUnderflow = 21, + E_OS_SYS_INIT = 22, + E_OS_SYS_CONFIG = 23, + E_OS_SYS_CODE = 24, + E_OS_SYS_TOOL = 25, + E_OS_SYS_TimerRange = 26 +}; + +enum +{ + SUSPENDED = 0x00, + READY = 0x01, + RUNNING = 0x02, + WAITING = 0x03, + INTSTART = 0x08, + SETSTART = 0x10, + NPRTASK = 0x20, + USEFP = 0x40 +}; + +typedef struct +{ + TickType maxallowedvalue; + TickType ticksperbase; +} AlarmBaseType; + +typedef TaskType *TaskRefType; +typedef TaskStateType *TaskStateRefType; +typedef EventMaskType *EventMaskRefType; +typedef TickType *TickRefType; +typedef AlarmBaseType *AlarmBaseRefType; +typedef OSEK_U8 AppModeType; +typedef OSEK_U8 OSEKOSTaskActCntType; + +TaskType OSEKOStidact; +OSEKOSPrioType OSEKOSrunprio; + +StatusType OSEKOSError ( register StatusType ); +void ErrorHook ( StatusType ); +void StartupHook ( void ); +void ShutdownHook ( StatusType ); + +int getUsedTaskStack ( TaskType ); +int getUnusedTaskStack ( TaskType ); +int getUsedIsrStack ( void ); +int getUnusedIsrStack ( void ); +void OSEKOStaskStackCheckInit ( void ); +signed char OSEKOStaskStackCheck ( OSEK_U8 * ); +signed char OSEKOSisrStackCheck ( OSEK_U8 * ); +void OSEKOStaskStackCheckFatal ( OSEK_U8 * ); +void OSEKOSisrStackCheckFatal ( OSEK_U8 * ); +OSEK_U8 * OSEKOSgetStackPointer ( void ); +void OSEKOSTaskSwitch ( void ); +StatusType OSEKOSReturn ( StatusType ); +StatusType OSEKOSActivateTask ( register TaskType ); +void OSEKOSTerminateTask ( TaskType, TaskType ); + + extern void OSEKOSGetResource ( ResourceType ); + extern void OSEKOSReleaseResource ( ResourceType ); + +int OSEKOSSetEvent ( TaskType, EventMaskType ); +int OSEKOSWaitEvent ( EventMaskType ); +TickType OSEKOSGetAlarm(register AlarmType); +void OSEKOSSetAlarm ( AlarmType, TickType, TickType ); +StatusType OSEKOSSetAbsAlarm ( AlarmType a, TickType b, TickType c ); + +StatusType OSEKOSCancelAlarm ( register AlarmType ); +void OSEKOSAdvCntr ( void ); +AppModeType GetActiveApplicationMode ( void ); + +void StartOS ( AppModeType ); + +void OSEKOSShutdownOS ( StatusType ); + +StatusType ActivateTask ( TaskType A ); +StatusType TerminateTask ( void ); +StatusType ChainTask ( TaskType A ); +StatusType GetTaskState ( TaskType A, TaskStateRefType B ); +StatusType GetTaskID ( TaskRefType A ); +StatusType Schedule ( void ); +StatusType GetResource ( ResourceType A ); +StatusType ReleaseResource ( ResourceType A ); +StatusType SetEvent ( TaskType A, EventMaskType B ); +StatusType ClearEvent ( EventMaskType A ); +StatusType WaitEvent ( EventMaskType A ); +StatusType GetEvent ( TaskType A, EventMaskRefType B ); +StatusType GetAlarm ( AlarmType A, TickRefType B ); +StatusType GetAlarmBase ( AlarmType A, AlarmBaseRefType B ); +StatusType SetRelAlarm ( AlarmType A, TickType B, TickType C ); +StatusType SetAbsAlarm ( AlarmType A, TickType B, TickType C ); +StatusType CancelAlarm ( AlarmType A ); +StatusType AdvCntr ( CounterType A ); +StatusType IAdvCntr ( CounterType A ); +void SuspendOSInterrupts ( void ); +void ResumeOSInterrupts ( void ); +void SuspendAllInterrupts ( void ); +void ResumeAllInterrupts ( void ); +void DisableAllInterrupts ( void ); +void EnableAllInterrupts ( void ); + +void OSEKOSDisable(void); +void OSEKOSEnable(void); +void OSEKOSAsmIDispatch(unsigned long *); +void OSEKOSAsmDispatch(OSEKOSPrioType p); +void OSEKOSStartupEnable(void); +void OSEKOSNop(void); +unsigned int OSEKOSV850CheckIsrSwitch(void); +void OSEKOSV850InitInterrupts(void); +void OSEKOSV850SetupInterrupts(); +void OSEKOSV850SyncContextLoad(OSEKOSSaveType); +void OSEKOSV850SyncContextLoadFromIRQ(OSEKOSSaveType); +void OSEKOSV850ASyncContextLoad(OSEKOSSaveType); +void OSEKOSV850ASyncContextLoadFromIRQ(OSEKOSSaveType); + +// arrays of function pointers - they look like function prototypes +void ( ( * const OSEKOStaskStartAddress [10] ) ( void ) ); +StatusType (* OSEKOStaskStatuses [10][5]) ( void ); + +void OSEKOSV850StartContext +( + OSEK_TASK (( * const ) ( void )), + OSEK_U8 * const +); +void OSEKOSV850StartContextFromIRQ +( + OSEK_TASK (( * const ) ( void )), + OSEK_U8 * const +); + +void OSEKOSSuspendOSInterrupts(void); +void OSEKOSResumeOSInterrupts(void); +void OSEKOSSuspendAllInterrupts(void); +void OSEKOSResumeAllInterrupts(void); +void OSEKOScheckSuspendResumeNesting(void); + + +void OSEKOSgetSR(void); +void OSEKOSEnableInterrupt_intern(int nr); +void OSEKOSDisableInterrupt_intern(int nr); diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_compilation/parsing.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_compilation/parsing.h new file mode 100644 index 0000000..e1bcb8b --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_compilation/parsing.h @@ -0,0 +1,47 @@ +/* ========================================== + CMock Project - Automatic Mock Generation for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +typedef unsigned short U16; +typedef signed int int32_t; + +typedef struct _POINT_T +{ + int x; + int y; +} POINT_T; + +// typedef edge case; +// not ANSI C but it has been done and will break cmock if not handled +typedef void VOID_TYPE_CRAZINESS; + +/* fun parsing & mock generation cases */ + +void var_args1(int a, ...); +void var_args2(int a, int b, ...); + +VOID_TYPE_CRAZINESS void_type_craziness1(int, float, double, char, short, long, long int, long long, void*); +int void_type_craziness2( VOID_TYPE_CRAZINESS ); + + void crazy_whitespace ( int lint, double shot , short stack ) ; + +char + crazy_multiline +( + int a, + unsigned int b); + +U16 *ptr_return1(int a); +U16* ptr_return2(int a); +U16 * ptr_return3(int a); + +unsigned int** ptr_ptr_return1(unsigned int** a); +unsigned int* *ptr_ptr_return2(unsigned int* *a); +unsigned int **ptr_ptr_return3(unsigned int **a); +unsigned int ** ptr_ptr_return4(unsigned int ** a); + +extern unsigned long int incredible_descriptors(register const unsigned short a); + +int32_t example_c99_type(int32_t param1); diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/all_plugins_but_other_limits.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/all_plugins_but_other_limits.yml new file mode 100644 index 0000000..052f883 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/all_plugins_but_other_limits.yml @@ -0,0 +1,340 @@ +--- +#this test is different than all_plugins_coexist primarily because of these options +:cmock: + :enforce_strict_ordering: 1 + :treat_externs: :include + :ignore: :args_only + :plugins: + - :array + - :cexception + - :ignore + - :callback + +:systest: + :types: | + typedef struct _POINT_T { + int x; + int y; + } POINT_T; + + :mockable: | + #include "CException.h" + void foo(POINT_T* a); + POINT_T* bar(void); + void fooa(POINT_T a[]); + void foos(const char * a); + extern const char * bars(void); + void no_pointers(int a, char* b); + int mixed(int a, int* b, int c); + + :source: + :header: | + #include "CException.h" + void function_a(void); + void function_b(void); + void function_c(void); + int function_d(void); + void function_e(void); + + :code: | + void function_a(void) + { + foo(bar()); + } + + void function_b(void) { + fooa(bar()); + } + + void function_c(void) { + CEXCEPTION_T e; + Try { + foos(bars()); + } Catch(e) { foos("err"); } + } + + int function_d(void) { + int test_list[] = { 1, 2, 3, 4, 5 }; + no_pointers(1, "silly"); + return mixed(6, test_list, 7); + } + + void function_e(void) { + foos("Hello"); + foos("Tuna"); + foos("Oranges"); + } + + :tests: + :common: | + #include "CException.h" + void setUp(void) {} + void tearDown(void) {} + + :units: + - :pass: TRUE + :should: 'handle the situation where we pass nulls to pointers' + :code: | + test() + { + bar_ExpectAndReturn(NULL); + foo_Expect(NULL); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we expected nulls to pointers but did not get that' + :code: | + test() + { + POINT_T pt = {1, 2}; + bar_ExpectAndReturn(&pt); + foo_Expect(NULL); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we did not expect nulls to pointers but got null' + :code: | + test() + { + POINT_T ex = {1, 2}; + bar_ExpectAndReturn(NULL); + foo_Expect(&ex); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass single object with expect and it is wrong' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 3}; + bar_ExpectAndReturn(&pt); + foo_Expect(&ex); + + function_a(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass single object with expect and use array handler' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 2}; + bar_ExpectAndReturn(&pt); + foo_ExpectWithArray(&ex, 1); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass single object with expect and use array handler and it is wrong' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 3}; + bar_ExpectAndReturn(&pt); + foo_ExpectWithArray(&ex, 1); + + function_a(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass multiple objects with expect and use array handler' + :code: | + test() + { + POINT_T pt[] = {{1, 2}, {3, 4}, {5, 6}}; + POINT_T ex[] = {{1, 2}, {3, 4}, {5, 6}}; + bar_ExpectAndReturn(pt); + foo_ExpectWithArray(ex, 3); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass multiple objects with expect and use array handler and it is wrong at end' + :code: | + test() + { + POINT_T pt[] = {{1, 2}, {3, 4}, {5, 6}}; + POINT_T ex[] = {{1, 2}, {3, 4}, {5, 9}}; + bar_ExpectAndReturn(pt); + foo_ExpectWithArray(ex, 3); + + function_a(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass single array element with expect' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 2}; + bar_ExpectAndReturn(&pt); + fooa_Expect(&ex); + + function_b(); + } + + - :pass: TRUE + :should: 'handle standard c string as null terminated on not do crappy memory compares of a byte, passing' + :code: | + test() + { + bars_ExpectAndReturn("This is a\0 silly string"); + foos_Expect("This is a\0 wacky string"); + + function_c(); + } + + - :pass: FALSE + :should: 'handle standard c string as null terminated on not do crappy memory compares of a byte, finding failures' + :code: | + test() + { + bars_ExpectAndReturn("This is a silly string"); + foos_Expect("This is a wacky string"); + + function_c(); + } + + - :pass: TRUE + :should: 'handle creating array expects when we have mixed arguments for single object' + :code: | + test() + { + int expect_list[] = { 1, 9 }; + no_pointers_Expect(1, "silly"); + mixed_ExpectAndReturn(6, expect_list, 7, 13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: FALSE + :should: 'handle creating array expects when we have mixed arguments and handle failures for single object' + :code: | + test() + { + int expect_list[] = { 9, 1 }; + no_pointers_Expect(1, "silly"); + mixed_ExpectAndReturn(6, expect_list, 7, 13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: TRUE + :should: 'handle creating array expects when we have mixed arguments for multiple objects' + :code: | + test() + { + int expect_list[] = { 1, 2, 3, 4, 6 }; + no_pointers_Expect(1, "silly"); + mixed_ExpectWithArrayAndReturn(6, expect_list, 4, 7, 13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: FALSE + :should: 'handle creating array expects when we have mixed arguments and handle failures for multiple objects' + :code: | + test() + { + int expect_list[] = { 1, 2, 3, 4, 6 }; + no_pointers_Expect(1, "silly"); + mixed_ExpectWithArrayAndReturn(6, expect_list, 5, 7, 13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: TRUE + :should: 'handle an exception being caught' + :code: | + test() + { + bars_ExpectAndReturn("This is a\0 silly string"); + foos_ExpectAndThrow("This is a\0 wacky string", 55); + foos_Expect("err"); + + function_c(); + } + + - :pass: FALSE + :should: 'handle an exception being caught but still catch following errors' + :code: | + test() + { + bars_ExpectAndReturn("This is a\0 silly string"); + foos_ExpectAndThrow("This is a\0 wacky string", 55); + foos_Expect("wrong error"); + + function_c(); + } + + - :pass: FALSE + :should: 'fail strict ordering problems even though we would otherwise have passed' + :code: | + test() + { + int expect_list[] = { 1, 2, 3, 4, 6 }; + mixed_ExpectWithArrayAndReturn(6, expect_list, 4, 7, 13); + no_pointers_Expect(1, "silly"); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: TRUE + :should: 'properly ignore first function but the other will work properly' + :code: | + test() + { + int expect_list[] = { 1, 2, 3, 4, 6 }; + no_pointers_Ignore(); + mixed_ExpectWithArrayAndReturn(6, expect_list, 4, 7, 13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: TRUE + :should: 'properly ignore last function but the other will work properly' + :code: | + test() + { + no_pointers_Expect(1, "silly"); + mixed_IgnoreAndReturn(13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: TRUE + :should: 'be ok if we ignore a call each because we are counting calls' + :code: | + test() + { + foos_Ignore(); + foos_Ignore(); + foos_Ignore(); + + function_e(); + } + + - :pass: FALSE + :should: 'fail if we do not ignore a call once because we are counting calls' + :code: | + test() + { + foos_Ignore(); + foos_Ignore(); + + function_e(); + } + +... diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/all_plugins_coexist.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/all_plugins_coexist.yml new file mode 100644 index 0000000..b76859f --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/all_plugins_coexist.yml @@ -0,0 +1,381 @@ +--- +:cmock: + :enforce_strict_ordering: 1 + :plugins: + - :array + - :cexception + - :ignore + - :callback + :callback_after_arg_check: true + #:callback_include_count: false + :treat_externs: :include + +:systest: + :types: | + typedef struct _POINT_T { + int x; + int y; + } POINT_T; + + :mockable: | + #include "CException.h" + extern void foo(POINT_T* a); + POINT_T* bar(void); + void fooa(POINT_T a[]); + void foos(const char * a); + const char * bars(void); + void no_pointers(int a, char* b); + int mixed(int a, int* b, int c); + + :source: + :header: | + #include "CException.h" + void function_a(void); + void function_b(void); + void function_c(void); + int function_d(void); + void function_e(void); + + :code: | + void function_a(void) + { + foo(bar()); + } + + void function_b(void) { + fooa(bar()); + } + + void function_c(void) { + CEXCEPTION_T e; + Try { + foos(bars()); + } Catch(e) { foos("err"); } + } + + int function_d(void) { + int test_list[] = { 1, 2, 3, 4, 5 }; + no_pointers(1, "silly"); + return mixed(6, test_list, 7); + } + + void function_e(void) { + foos("Hello"); + foos("Tuna"); + foos("Oranges"); + } + + :tests: + :common: | + #include "CException.h" + void setUp(void) {} + void tearDown(void) {} + void my_foo_callback(POINT_T* a) { TEST_ASSERT_EQUAL_INT(2, a->x); } + + :units: + - :pass: TRUE + :should: 'handle the situation where we pass nulls to pointers' + :code: | + test() + { + bar_ExpectAndReturn(NULL); + foo_Expect(NULL); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we expected nulls to pointers but did not get that' + :code: | + test() + { + POINT_T pt = {1, 2}; + bar_ExpectAndReturn(&pt); + foo_Expect(NULL); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we did not expect nulls to pointers but got null' + :code: | + test() + { + POINT_T ex = {1, 2}; + bar_ExpectAndReturn(NULL); + foo_Expect(&ex); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass single object with expect and it is wrong' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 3}; + bar_ExpectAndReturn(&pt); + foo_Expect(&ex); + + function_a(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass single object with expect and use array handler' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 2}; + bar_ExpectAndReturn(&pt); + foo_ExpectWithArray(&ex, 1); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass single object with expect and use array handler and it is wrong' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 3}; + bar_ExpectAndReturn(&pt); + foo_ExpectWithArray(&ex, 1); + + function_a(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass multiple objects with expect and use array handler' + :code: | + test() + { + POINT_T pt[] = {{1, 2}, {3, 4}, {5, 6}}; + POINT_T ex[] = {{1, 2}, {3, 4}, {5, 6}}; + bar_ExpectAndReturn(pt); + foo_ExpectWithArray(ex, 3); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass multiple objects with expect and use array handler and it is wrong at end' + :code: | + test() + { + POINT_T pt[] = {{1, 2}, {3, 4}, {5, 6}}; + POINT_T ex[] = {{1, 2}, {3, 4}, {5, 9}}; + bar_ExpectAndReturn(pt); + foo_ExpectWithArray(ex, 3); + + function_a(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass single array element with expect' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 2}; + bar_ExpectAndReturn(&pt); + fooa_Expect(&ex); + + function_b(); + } + + - :pass: TRUE + :should: 'handle standard c string as null terminated on not do crappy memory compares of a byte, passing' + :code: | + test() + { + bars_ExpectAndReturn("This is a\0 silly string"); + foos_Expect("This is a\0 wacky string"); + + function_c(); + } + + - :pass: FALSE + :should: 'handle standard c string as null terminated on not do crappy memory compares of a byte, finding failures' + :code: | + test() + { + bars_ExpectAndReturn("This is a silly string"); + foos_Expect("This is a wacky string"); + + function_c(); + } + + - :pass: TRUE + :should: 'handle creating array expects when we have mixed arguments for single object' + :code: | + test() + { + int expect_list[] = { 1, 9 }; + no_pointers_Expect(1, "silly"); + mixed_ExpectAndReturn(6, expect_list, 7, 13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: FALSE + :should: 'handle creating array expects when we have mixed arguments and handle failures for single object' + :code: | + test() + { + int expect_list[] = { 9, 1 }; + no_pointers_Expect(1, "silly"); + mixed_ExpectAndReturn(6, expect_list, 7, 13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: TRUE + :should: 'handle creating array expects when we have mixed arguments for multiple objects' + :code: | + test() + { + int expect_list[] = { 1, 2, 3, 4, 6 }; + no_pointers_Expect(1, "silly"); + mixed_ExpectWithArrayAndReturn(6, expect_list, 4, 7, 13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: FALSE + :should: 'handle creating array expects when we have mixed arguments and handle failures for multiple objects' + :code: | + test() + { + int expect_list[] = { 1, 2, 3, 4, 6 }; + no_pointers_Expect(1, "silly"); + mixed_ExpectWithArrayAndReturn(6, expect_list, 5, 7, 13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: TRUE + :should: 'handle an exception being caught' + :code: | + test() + { + bars_ExpectAndReturn("This is a\0 silly string"); + foos_ExpectAndThrow("This is a\0 wacky string", 55); + foos_Expect("err"); + + function_c(); + } + + - :pass: FALSE + :should: 'handle an exception being caught but still catch following errors' + :code: | + test() + { + bars_ExpectAndReturn("This is a\0 silly string"); + foos_ExpectAndThrow("This is a\0 wacky string", 55); + foos_Expect("wrong error"); + + function_c(); + } + + - :pass: FALSE + :should: 'fail strict ordering problems even though we would otherwise have passed' + :code: | + test() + { + int expect_list[] = { 1, 2, 3, 4, 6 }; + mixed_ExpectWithArrayAndReturn(6, expect_list, 4, 7, 13); + no_pointers_Expect(1, "silly"); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: TRUE + :should: 'that we can properly ignore last function but the other will work properly' + :code: | + test() + { + int expect_list[] = { 1, 2, 3, 4, 6 }; + mixed_ExpectWithArrayAndReturn(6, expect_list, 4, 7, 13); + no_pointers_Ignore(); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: TRUE + :should: 'that we can properly ignore first function but the other will work properly' + :code: | + test() + { + mixed_IgnoreAndReturn(13); + no_pointers_Expect(1, "silly"); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: TRUE + :should: 'that we just have to ignore a call once because we are not counting calls' + :code: | + test() + { + foos_Ignore(); + + function_e(); + } + + - :pass: TRUE + :should: 'that we can use a callback and an expect' + :code: | + test() + { + POINT_T pt1 = {2, 3}; + POINT_T pt2 = {2, 3}; + bar_ExpectAndReturn(&pt1); + foo_Expect(&pt2); + foo_StubWithCallback((CMOCK_foo_CALLBACK)my_foo_callback); + + function_a(); + } + + - :pass: FALSE + :should: 'that we can fail even when using a callback if we want to expect call but did not and we are checking that' + :code: | + test() + { + POINT_T pt = {2, 3}; + bar_ExpectAndReturn(&pt); + foo_StubWithCallback((CMOCK_foo_CALLBACK)my_foo_callback); + + function_a(); + } + + - :pass: FALSE + :should: 'that we can fail even when using a callback if args are wrong and we are checking those' + :code: | + test() + { + POINT_T pt1 = {2, 3}; + POINT_T pt2 = {1, 3}; + bar_ExpectAndReturn(&pt1); + foo_Expect(&pt2); + foo_StubWithCallback((CMOCK_foo_CALLBACK)my_foo_callback); + + function_a(); + } + + - :pass: FALSE + :should: 'that we can fail from the callback itself' + :code: | + test() + { + POINT_T pt = {3, 3}; + bar_ExpectAndReturn(&pt); + foo_Expect(&pt); + foo_StubWithCallback((CMOCK_foo_CALLBACK)my_foo_callback); + + function_a(); + } + +... diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/array_and_pointer_handling.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/array_and_pointer_handling.yml new file mode 100644 index 0000000..dfa7d10 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/array_and_pointer_handling.yml @@ -0,0 +1,382 @@ +--- +:cmock: + :when_ptr: :smart + :plugins: + - :array + +:systest: + :types: | + typedef struct _POINT_T { + int x; + int y; + } POINT_T; + #define ARRAY_A_SIZE (5) + + :mockable: | + void foo(POINT_T* a); + POINT_T* bar(void); + void fooa(POINT_T a[ARRAY_A_SIZE+1-1]); + void foos(const char * a); + const char * bars(void); + void no_pointers(int a, char* b); + int mixed(int a, int* b, int c); + void potential_packing_problem(short *a); + + :source: + :header: | + void function_a(void); + void function_b(void); + void function_c(void); + int function_d(void); + void function_e(void); + + :code: | + void function_a(void) + { + foo(bar()); + } + + void function_b(void) { + fooa(bar()); + } + + void function_c(void) { + foos(bars()); + } + + int function_d(void) { + int test_list[] = { 1, 2, 3, 4, 5 }; + no_pointers(1, "silly"); + return mixed(6, test_list, 7); + } + + void function_e(void) { + short test_list[] = {-1, -2, -3, -4}; + potential_packing_problem(&test_list[1]); + } + + :tests: + :common: | + void setUp(void) {} + void tearDown(void) {} + + :units: + - :pass: TRUE + :should: 'handle the situation where we pass nulls to pointers' + :code: | + test() + { + bar_ExpectAndReturn(NULL); + foo_Expect(NULL); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we expected nulls to pointers but did not get that' + :code: | + test() + { + POINT_T pt = {1, 2}; + bar_ExpectAndReturn(&pt); + foo_Expect(NULL); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we did not expect nulls to pointers but got null' + :code: | + test() + { + POINT_T ex = {1, 2}; + bar_ExpectAndReturn(NULL); + foo_Expect(&ex); + + function_a(); + } + + - :pass: TRUE + :should: 'handle the situation where it falls back to pointers because you asked it to compare 0 elements' + :code: | + test() + { + POINT_T ex = {1, 2}; + bar_ExpectAndReturn(&ex); + foo_ExpectWithArray(&ex, 0); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where it fails because you asked it to compare zero elements and the pointers do not match' + :code: | + test() + { + POINT_T ex = {1, 2}; + POINT_T pt = {1, 2}; + bar_ExpectAndReturn(&pt); + foo_ExpectWithArray(&ex, 0); + + function_a(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass single object with expect' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 2}; + bar_ExpectAndReturn(&pt); + foo_Expect(&ex); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass single object with expect and it is wrong' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 3}; + bar_ExpectAndReturn(&pt); + foo_Expect(&ex); + + function_a(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass single object with expect and use array handler' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 2}; + bar_ExpectAndReturn(&pt); + foo_ExpectWithArray(&ex, 1); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass single object with expect and use array handler and it is wrong' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 3}; + bar_ExpectAndReturn(&pt); + foo_ExpectWithArray(&ex, 1); + + function_a(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass multiple objects with expect and use array handler' + :code: | + test() + { + POINT_T pt[] = {{1, 2}, {3, 4}, {5, 6}}; + POINT_T ex[] = {{1, 2}, {3, 4}, {5, 6}}; + bar_ExpectAndReturn(pt); + foo_ExpectWithArray(ex, 3); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass multiple objects with expect and use array handler and it is wrong at start' + :code: | + test() + { + POINT_T pt[] = {{1, 2}, {3, 4}, {5, 6}}; + POINT_T ex[] = {{9, 2}, {3, 4}, {5, 6}}; + bar_ExpectAndReturn(pt); + foo_ExpectWithArray(ex, 3); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass multiple objects with expect and use array handler and it is wrong at end' + :code: | + test() + { + POINT_T pt[] = {{1, 2}, {3, 4}, {5, 6}}; + POINT_T ex[] = {{1, 2}, {3, 4}, {5, 9}}; + bar_ExpectAndReturn(pt); + foo_ExpectWithArray(ex, 3); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass multiple objects with expect and use array handler and it is wrong in middle' + :code: | + test() + { + POINT_T pt[] = {{1, 2}, {3, 4}, {5, 6}}; + POINT_T ex[] = {{1, 2}, {3, 9}, {5, 6}}; + bar_ExpectAndReturn(pt); + foo_ExpectWithArray(ex, 3); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass nulls to pointers and fail' + :code: | + test() + { + POINT_T pt = {1, 2}; + bar_ExpectAndReturn(&pt); + foo_Expect(NULL); + + function_a(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass nulls to arrays' + :code: | + test() + { + bar_ExpectAndReturn(NULL); + fooa_Expect(NULL); + + function_b(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass single array element with expect' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 2}; + bar_ExpectAndReturn(&pt); + fooa_Expect(&ex); + + function_b(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass single array element with expect and it is wrong' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 3}; + bar_ExpectAndReturn(&pt); + fooa_Expect(&ex); + + function_b(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass nulls to arrays and fail' + :code: | + test() + { + POINT_T pt = {1, 2}; + bar_ExpectAndReturn(&pt); + fooa_Expect(NULL); + + function_b(); + } + + - :pass: TRUE + :should: 'handle standard c string as null terminated on not do crappy memory compares of a byte, passing' + :code: | + test() + { + bars_ExpectAndReturn("This is a\0 silly string"); + foos_Expect("This is a\0 wacky string"); + + function_c(); + } + + - :pass: FALSE + :should: 'handle standard c string as null terminated on not do crappy memory compares of a byte, finding failures' + :code: | + test() + { + bars_ExpectAndReturn("This is a silly string"); + foos_Expect("This is a wacky string"); + + function_c(); + } + + - :pass: TRUE + :should: 'handle creating array expects when we have mixed arguments for single object' + :code: | + test() + { + int expect_list[] = { 1, 9 }; + no_pointers_Expect(1, "silly"); + mixed_ExpectAndReturn(6, expect_list, 7, 13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: FALSE + :should: 'handle creating array expects when we have mixed arguments and handle failures for single object' + :code: | + test() + { + int expect_list[] = { 9, 1 }; + no_pointers_Expect(1, "silly"); + mixed_ExpectAndReturn(6, expect_list, 7, 13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: TRUE + :should: 'handle creating array expects when we have mixed arguments for multiple objects' + :code: | + test() + { + int expect_list[] = { 1, 2, 3, 4, 6 }; + no_pointers_Expect(1, "silly"); + mixed_ExpectWithArrayAndReturn(6, expect_list, 4, 7, 13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: FALSE + :should: 'handle creating array expects when we have mixed arguments and handle failures for multiple objects' + :code: | + test() + { + int expect_list[] = { 1, 2, 3, 4, 6 }; + no_pointers_Expect(1, "silly"); + mixed_ExpectWithArrayAndReturn(6, expect_list, 5, 7, 13); + + TEST_ASSERT_EQUAL(13, function_d()); + } + + - :pass: TRUE + :should: 'handle a passing version of a potential packing problem (particularly try with ARM simulators)' + :code: | + test() + { + short expect_list[] = { -2, -3, -4 }; + potential_packing_problem_ExpectWithArray(expect_list, 3); + + function_e(); + } + + - :pass: FALSE + :should: 'handle a failing version of a potential packing problem (particularly try with ARM simulators)' + :code: | + test() + { + short expect_list[] = { -2, -3, 4 }; + potential_packing_problem_ExpectWithArray(expect_list, 3); + + function_e(); + } + + +... diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/basic_expect_and_return.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/basic_expect_and_return.yml new file mode 100644 index 0000000..ecd6b2c --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/basic_expect_and_return.yml @@ -0,0 +1,123 @@ +--- +:cmock: + :plugins: + - # none + +:systest: + :types: | + #define UINT32 unsigned int + + typedef signed int custom_type; + + :mockable: | + UINT32 foo(custom_type a); + UINT32 bar(custom_type b); + UINT32 foo_varargs(custom_type a, ...); + char* foo_char_strings(char a[], char* b); + + :source: + :header: | + UINT32 function_a(int a, int b); + void function_b(void); + UINT32 function_c(int a); + char* function_d(char a[], char* b); + + :code: | + UINT32 function_a(int a, int b) + { + return foo((custom_type)a) + bar((custom_type)b); + } + + void function_b(void) { } + + UINT32 function_c(int a) + { + return foo_varargs((custom_type)a, "ignored", 5); + } + + char* function_d(char a[], char* b) + { + return foo_char_strings(a, b); + } + + :tests: + :common: | + void setUp(void) {} + void tearDown(void) {} + + :units: + - :pass: TRUE + :should: 'successfully exercise two simple ExpectAndReturn mock calls' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + bar_ExpectAndReturn((custom_type)2, 20); + TEST_ASSERT_EQUAL(30, function_a(1, 2)); + } + + - :pass: FALSE + :should: 'fail because bar() is not called but is expected' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + TEST_ASSERT_EQUAL(30, function_a(1, 2)); + } + + - :pass: FALSE + :should: 'fail because bar() is called but is not expected' + :code: | + test() + { + bar_ExpectAndReturn((custom_type)1, 10); + function_b(); + } + + - :pass: TRUE + :should: 'consume var args passed to mocked function' + :code: | + test() + { + foo_varargs_ExpectAndReturn((custom_type)3, 10); + TEST_ASSERT_EQUAL(10, function_c(3)); + } + + - :pass: TRUE + :should: 'handle char strings' + :code: | + test() + { + foo_char_strings_ExpectAndReturn("larry", "curly", "moe"); + TEST_ASSERT_EQUAL_STRING("moe", function_d("larry", "curly")); + } + + - :pass: TRUE + :should: 'successfully exercise multiple cycles of expecting and mocking and pass' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + bar_ExpectAndReturn((custom_type)2, 20); + TEST_ASSERT_EQUAL(30, function_a(1, 2)); + + foo_ExpectAndReturn((custom_type)3, 30); + bar_ExpectAndReturn((custom_type)4, 40); + TEST_ASSERT_EQUAL(70, function_a(3, 4)); + } + + - :pass: FALSE + :should: 'successfully exercise multiple cycles of expecting and mocking and fail' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + bar_ExpectAndReturn((custom_type)2, 20); + TEST_ASSERT_EQUAL(30, function_a(1, 2)); + + foo_ExpectAndReturn((custom_type)3, 30); + bar_ExpectAndReturn((custom_type)4, 40); + TEST_ASSERT_EQUAL(70, function_a(3, 5)); + } + +... diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/const_primitives_handling.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/const_primitives_handling.yml new file mode 100644 index 0000000..2fc1b21 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/const_primitives_handling.yml @@ -0,0 +1,87 @@ +--- +:cmock: + :plugins: + - # none + +:systest: + :types: | + + :mockable: | + // no argument names + void foo(char const*, char* const, const char*); + + // argument names + void bar(char const* param1, char* const param2, const char* param3); + + :source: + :header: | + void exercise_const1(char const* param1, char* const param2, const char* param3); + void exercise_const2(char const* param1, char* const param2, const char* param3); + + :code: | + char value1 = '1'; + char value2 = '2'; + + const char* A = &value1; + char* const B = &value2; + const char* C = "C"; + const char* D = "D"; + + void exercise_const1(char const* param1, char* const param2, const char* param3) + { + foo(param1, param2, param3); + } + + void exercise_const2(char const* param1, char* const param2, const char* param3) + { + bar(param1, param2, param3); + } + + :tests: + :common: | + extern const char* A; + extern char* const B; + extern const char* C; + extern const char* D; + + void setUp(void) {} + void tearDown(void) {} + :units: + - :pass: TRUE + :should: 'successfully pass several const parameters' + :code: | + test() + { + foo_Expect( A, B, C ); + exercise_const1( A, B, C ); + } + + - :pass: FALSE + :should: 'should fail upon wrong const arguments passed' + :code: | + test() + { + foo_Expect( A, B, C ); + exercise_const1( (const char*)B, (char * const)A, C ); + } + + - :pass: FALSE + :should: 'should fail upon wrong const arguments passed' + :code: | + test() + { + foo_Expect( A, B, C ); + exercise_const1( A, B, D ); + } + + - :pass: FALSE + :should: 'should fail upon wrong const arguments passed' + :code: | + test() + { + bar_Expect( A, B, C ); + exercise_const2( A, (char * const)C, (const char *)B ); + } + + +... diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/enforce_strict_ordering.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/enforce_strict_ordering.yml new file mode 100644 index 0000000..61e2999 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/enforce_strict_ordering.yml @@ -0,0 +1,247 @@ +--- +:cmock: + :enforce_strict_ordering: 1 + :plugins: + - :ignore + - :cexception + +:systest: + :types: | + #define UINT32 unsigned int + + typedef signed int custom_type; + + :mockable: | + #include "CException.h" + UINT32 foo(custom_type a); + UINT32 bar(custom_type b); + void baz(custom_type c); + + :source: + :header: | + #include "CException.h" + UINT32 function_a(int a, int b); + void function_b(void); + void function_c(void); + void function_d(void); + + :code: | + UINT32 function_a(int a, int b) + { + return foo((custom_type)a) + bar((custom_type)b); + } + + void function_b(void) + { + baz((custom_type)1); + foo((custom_type)2); + bar((custom_type)3); + baz((custom_type)4); + foo((custom_type)5); + bar((custom_type)6); + baz((custom_type)7); + } + + void function_c(void) + { + foo((custom_type)1); + foo((custom_type)2); + bar((custom_type)3); + bar((custom_type)4); + foo((custom_type)5); + } + + void function_d(void) + { + CEXCEPTION_T e; + Try + { + foo((custom_type)1); + } + Catch(e) {} + Try + { + bar((custom_type)2); + } + Catch(e) {} + Try + { + foo((custom_type)3); + } + Catch(e) {} + } + + :tests: + :common: | + #include "CException.h" + void setUp(void) {} + void tearDown(void) {} + + :units: + - :pass: TRUE + :should: 'successfully exercise two simple ExpectAndReturn mock calls' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + bar_ExpectAndReturn((custom_type)2, 20); + TEST_ASSERT_EQUAL(30, function_a(1, 2)); + } + + - :pass: FALSE + :should: 'fail because bar() is called but is not expected' + :verify_error: 'called more times than expected' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + TEST_ASSERT_EQUAL(30, function_a(1, 2)); + } + + - :pass: FALSE + :should: 'fail because bar() is called twice but is expected once' + :verify_error: 'called less times than expected' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + bar_ExpectAndReturn((custom_type)2, 20); + bar_ExpectAndReturn((custom_type)3, 30); + TEST_ASSERT_EQUAL(30, function_a(1, 2)); + } + + - :pass: FALSE + :should: 'fail because bar and foo called in reverse order' + :verify_error: 'called earlier than expected' + :code: | + test() + { + bar_ExpectAndReturn((custom_type)2, 20); + foo_ExpectAndReturn((custom_type)1, 10); + TEST_ASSERT_EQUAL(30, function_a(1, 2)); + } + + - :pass: TRUE + :should: 'pass because bar and foo called in order with multiple params' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + foo_ExpectAndReturn((custom_type)2, 10); + bar_ExpectAndReturn((custom_type)3, 20); + bar_ExpectAndReturn((custom_type)4, 10); + foo_ExpectAndReturn((custom_type)5, 10); + function_c(); + } + + - :pass: FALSE + :should: 'fail because bar and foo called out of order at end' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + foo_ExpectAndReturn((custom_type)2, 10); + bar_ExpectAndReturn((custom_type)3, 20); + foo_ExpectAndReturn((custom_type)5, 10); + bar_ExpectAndReturn((custom_type)4, 10); + function_c(); + } + + - :pass: FALSE + :should: 'fail because bar and foo called out of order at start' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)2, 10); + foo_ExpectAndReturn((custom_type)1, 10); + bar_ExpectAndReturn((custom_type)3, 20); + bar_ExpectAndReturn((custom_type)4, 10); + foo_ExpectAndReturn((custom_type)5, 10); + function_c(); + } + + - :pass: TRUE + :should: 'pass because we are properly ignoring baz' + :code: | + test() + { + baz_Ignore(); + foo_ExpectAndReturn((custom_type)2, 10); + bar_ExpectAndReturn((custom_type)3, 20); + foo_ExpectAndReturn((custom_type)5, 10); + bar_ExpectAndReturn((custom_type)6, 10); + function_b(); + } + + - :pass: FALSE + :should: 'fail because bar and foo out of order, even though baz is ignored' + :code: | + test() + { + baz_Ignore(); + foo_ExpectAndReturn((custom_type)2, 10); + foo_ExpectAndReturn((custom_type)5, 10); + bar_ExpectAndReturn((custom_type)3, 20); + bar_ExpectAndReturn((custom_type)6, 10); + function_b(); + } + + - :pass: TRUE + :should: 'pass when using cexception, as long as the order is right' + :code: | + test() + { + foo_ExpectAndThrow((custom_type)1, 10); + bar_ExpectAndReturn((custom_type)2, 20); + foo_ExpectAndReturn((custom_type)3, 10); + function_d(); + } + + - :pass: FALSE + :should: 'fail when an throw call is made out of order' + :code: | + test() + { + bar_ExpectAndReturn((custom_type)2, 20); + foo_ExpectAndThrow((custom_type)1, 10); + foo_ExpectAndReturn((custom_type)3, 10); + function_d(); + } + + - :pass: TRUE + :should: 'successfully handle back to back ExpectAndReturn setup and mock calls' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + bar_ExpectAndReturn((custom_type)2, 20); + TEST_ASSERT_EQUAL(30, function_a(1, 2)); + + foo_ExpectAndReturn((custom_type)3, 30); + bar_ExpectAndReturn((custom_type)4, 40); + TEST_ASSERT_EQUAL(70, function_a(3, 4)); + + foo_ExpectAndReturn((custom_type)1, 50); + bar_ExpectAndReturn((custom_type)9, 60); + TEST_ASSERT_EQUAL(110, function_a(1, 9)); + } + + - :pass: FALSE + :should: 'successfully catch errors during back to back ExpectAndReturn setup and mock calls' + :verify_error: 'called earlier than expected' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + bar_ExpectAndReturn((custom_type)2, 20); + TEST_ASSERT_EQUAL(30, function_a(1, 2)); + + foo_ExpectAndReturn((custom_type)3, 30); + bar_ExpectAndReturn((custom_type)4, 40); + TEST_ASSERT_EQUAL(70, function_a(3, 4)); + + bar_ExpectAndReturn((custom_type)9, 60); + foo_ExpectAndReturn((custom_type)1, 50); + TEST_ASSERT_EQUAL(110, function_a(1, 9)); + } +... diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/expect_and_return_custom_types.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/expect_and_return_custom_types.yml new file mode 100644 index 0000000..f5b13a3 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/expect_and_return_custom_types.yml @@ -0,0 +1,108 @@ +--- +:cmock: + :plugins: + - # none + :memcmp_if_unknown: false + +:systest: + :types: | + typedef struct _EXAMPLE_STRUCT_T { int x; int y; } EXAMPLE_STRUCT_T; + + :mockable: | + EXAMPLE_STRUCT_T foo(EXAMPLE_STRUCT_T a); + + :source: + :header: | + EXAMPLE_STRUCT_T function_a(EXAMPLE_STRUCT_T a, EXAMPLE_STRUCT_T b); + EXAMPLE_STRUCT_T function_b(EXAMPLE_STRUCT_T a, EXAMPLE_STRUCT_T b); + + :code: | + EXAMPLE_STRUCT_T function_a(EXAMPLE_STRUCT_T a, EXAMPLE_STRUCT_T b) + { + EXAMPLE_STRUCT_T retval = foo(a); + retval.x += b.x; + retval.y += b.y; + return retval; + } + + EXAMPLE_STRUCT_T function_b(EXAMPLE_STRUCT_T a, EXAMPLE_STRUCT_T b) + { + EXAMPLE_STRUCT_T retval = foo(b); + retval.x *= a.x; + retval.y *= a.y; + return retval; + } + + :tests: + :common: | + #include "expect_and_return_custom_types_unity_helper.h" + void setUp(void) {} + void tearDown(void) {} + + :units: + - :pass: TRUE + :should: 'successfully exercise simple ExpectAndReturn mock calls' + :code: | + test() + { + EXAMPLE_STRUCT_T c = {1,2}; + EXAMPLE_STRUCT_T d = {3,4}; + EXAMPLE_STRUCT_T e = {2,4}; + EXAMPLE_STRUCT_T f = {5,8}; + foo_ExpectAndReturn(c, e); + TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(f, function_a(c,d)); + } + + - :pass: FALSE + :should: 'fail because it is expecting to call foo with c not d' + :code: | + test() + { + EXAMPLE_STRUCT_T c = {1,2}; + EXAMPLE_STRUCT_T d = {3,4}; + EXAMPLE_STRUCT_T e = {2,4}; + EXAMPLE_STRUCT_T f = {5,8}; + foo_ExpectAndReturn(d, e); + TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(f, function_a(c,d)); + } + + - :pass: TRUE + :should: 'successfully exercise simple ExpectAndReturn mock calls on other function' + :code: | + test() + { + EXAMPLE_STRUCT_T c = {1,2}; + EXAMPLE_STRUCT_T d = {3,4}; + EXAMPLE_STRUCT_T e = {2,4}; + EXAMPLE_STRUCT_T f = {2,8}; + foo_ExpectAndReturn(d, e); + TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(f, function_b(c,d)); + } + + - :pass: FALSE + :should: 'fail because it is expecting to call foo with d not c' + :code: | + test() + { + EXAMPLE_STRUCT_T c = {1,2}; + EXAMPLE_STRUCT_T d = {3,4}; + EXAMPLE_STRUCT_T e = {2,4}; + EXAMPLE_STRUCT_T f = {2,8}; + foo_ExpectAndReturn(c, e); + TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(f, function_b(c,d)); + } + + :unity_helper: + :header: | + void AssertEqualExampleStruct(EXAMPLE_STRUCT_T expected, EXAMPLE_STRUCT_T actual, unsigned short line); + #define UNITY_TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(expected, actual, line, message) {AssertEqualExampleStruct(expected, actual, line);} + #define TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(expected, actual) UNITY_TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(expected, actual, __LINE__, NULL); + + :code: | + void AssertEqualExampleStruct(EXAMPLE_STRUCT_T expected, EXAMPLE_STRUCT_T actual, unsigned short line) + { + UNITY_TEST_ASSERT_EQUAL_INT(expected.x, actual.x, line, "Example Struct Failed For Field x"); + UNITY_TEST_ASSERT_EQUAL_INT(expected.y, actual.y, line, "Example Struct Failed For Field y"); + } + +... diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/expect_and_return_treat_as.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/expect_and_return_treat_as.yml new file mode 100644 index 0000000..2a73273 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/expect_and_return_treat_as.yml @@ -0,0 +1,173 @@ +--- +:cmock: + :plugins: + - # none + :treat_as: + MY_STRING: STRING + MY_INT: INT + PTR_INT: INT* + MY_HEX: HEX32 + +:systest: + :types: | + typedef char* MY_STRING; + typedef int MY_INT; + typedef unsigned int MY_HEX; + typedef int* PTR_INT; + + :mockable: | + MY_INT foo(MY_HEX a); + MY_INT bar(MY_HEX b); + MY_STRING foo_char_strings(MY_STRING a, MY_STRING b); + float float_adder(float a, float b); + MY_INT* pointer_foo(MY_HEX* a); + void pointer_bar(PTR_INT a); + + :source: + :header: | + MY_INT function_a(MY_INT a, MY_INT b); + MY_STRING function_b(MY_STRING a, MY_STRING b); + float function_c(float a, float b); + MY_INT function_d(MY_HEX a); + void function_e(PTR_INT a); + + :code: | + MY_INT function_a(MY_INT a, MY_INT b) + { + return foo((MY_HEX)a) + bar((MY_HEX)b); + } + + MY_STRING function_b(MY_STRING a, MY_STRING b) + { + return foo_char_strings(a, b); + } + + float function_c(float a, float b) + { + return float_adder(b, a); + } + + MY_INT function_d(MY_HEX a) + { + MY_HEX b = a; + MY_INT* c = pointer_foo(&b); + return *c; + } + + void function_e(PTR_INT a) + { + pointer_bar(a); + } + + :tests: + :common: | + void setUp(void) {} + void tearDown(void) {} + + :units: + - :pass: TRUE + :should: 'successfully exercise two simple ExpectAndReturn mock calls' + :code: | + test() + { + foo_ExpectAndReturn((MY_HEX)1, 10); + bar_ExpectAndReturn((MY_HEX)2, 20); + TEST_ASSERT_EQUAL(30, function_a(1, 2)); + } + + - :pass: FALSE + :should: 'fail because bar() is expected but not called' + :code: | + test() + { + foo_ExpectAndReturn((MY_HEX)1, 10); + TEST_ASSERT_EQUAL(30, function_a(1, 2)); + } + + - :pass: FALSE + :should: 'fail because foo_char_strings() is called but is not expected' + :code: | + test() + { + foo_char_strings_ExpectAndReturn((MY_STRING)"jello", (MY_STRING)"jiggle", (MY_STRING)"boing!"); + function_a(1,2); + } + + - :pass: TRUE + :should: 'handle char strings' + :code: | + test() + { + foo_char_strings_ExpectAndReturn((MY_STRING)"jello", (MY_STRING)"jiggle", (MY_STRING)"boing!"); + TEST_ASSERT_EQUAL_STRING("boing!", function_b((MY_STRING)"jello", (MY_STRING)"jiggle")); + } + + - :pass: TRUE + :should: 'handle floating point numbers with Unity support: pass' + :code: | + test() + { + float_adder_ExpectAndReturn(1.2345, 6.7890, 8.0235); + TEST_ASSERT_EQUAL_FLOAT(8.0235, function_c(6.7890, 1.2345)); + } + + - :pass: FALSE + :should: 'handle floating point numbers with Unity support: fail' + :code: | + test() + { + float_adder_ExpectAndReturn(1.2345, 6.7892, 8.0235); + TEST_ASSERT_EQUAL_FLOAT(8.0235, function_c(6.7890, 1.2345)); + } + + - :pass: TRUE + :should: 'handle pointers to treat_as values just as cleanly as the treat_as itself for passes' + :code: | + test() + { + MY_HEX TestHex = (MY_HEX)45; + MY_INT TestInt = (MY_INT)33; + pointer_foo_ExpectAndReturn(&TestHex, &TestInt); + TEST_ASSERT_EQUAL_INT(33, function_d(45)); + } + + - :pass: FALSE + :should: 'handle pointers to treat_as values just as cleanly as the treat_as itself for failures' + :verify_error: 'Element 0 Expected 0x0000002D Was 0x0000002B' + :code: | + test() + { + MY_HEX TestHex = (MY_HEX)45; + MY_INT TestInt = (MY_INT)33; + pointer_foo_ExpectAndReturn(&TestHex, &TestInt); + TEST_ASSERT_EQUAL_INT(33, function_d(43)); + } + + - :pass: TRUE + :should: 'handle treat_as values containing pointers for passes' + :code: | + test() + { + MY_INT ExpInt = (MY_INT)33; + PTR_INT ExpPtr = (PTR_INT)(&ExpInt); + MY_INT ActInt = (MY_INT)33; + PTR_INT ActPtr = (PTR_INT)(&ActInt); + pointer_bar_Expect(ExpPtr); + function_e(ActPtr); + } + + - :pass: FALSE + :should: 'handle treat_as values containing pointers for failures' + :verify_error: 'Element 0 Expected 33 Was 45' + :code: | + test() + { + MY_INT ExpInt = (MY_INT)33; + PTR_INT ExpPtr = (PTR_INT)(&ExpInt); + MY_INT ActInt = (MY_INT)45; + PTR_INT ActPtr = (PTR_INT)(&ActInt); + pointer_bar_Expect(ExpPtr); + function_e(ActPtr); + } + +... diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/expect_and_throw.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/expect_and_throw.yml new file mode 100644 index 0000000..c22524c --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/expect_and_throw.yml @@ -0,0 +1,170 @@ +--- +:cmock: + :plugins: + - :cexception + +:systest: + :types: | + #define UINT32 unsigned int + typedef signed int custom_type; + + :mockable: | + #include "CException.h" + UINT32 foo(custom_type a); + UINT32 bar(custom_type b); + UINT32 foo_varargs(custom_type a, ...); + + :source: + :header: | + #include "CException.h" + UINT32 function_a(int a); + void function_b(char a); + + :code: | + UINT32 function_a(int a) + { + UINT32 r = 0; + CEXCEPTION_T e; + + Try + { + r = (UINT32)foo((custom_type)a); + } + Catch(e) + { + r = (UINT32)e*2; + } + return r; + } + + void function_b(char a) + { + if (a) + { + Throw((CEXCEPTION_T)a); + } + } + + :tests: + :common: | + #include "CException.h" + void setUp(void) {} + void tearDown(void) {} + + :units: + - :pass: TRUE + :should: 'successfully exercise a simple ExpectAndReturn mock calls' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + TEST_ASSERT_EQUAL(10, function_a(1)); + } + + - :pass: TRUE + :should: 'successfully throw an error on first call' + :code: | + test() + { + foo_ExpectAndThrow((custom_type)1, 55); + TEST_ASSERT_EQUAL(110, function_a(1)); + } + + - :pass: TRUE + :should: 'successfully throw an error on later calls' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + foo_ExpectAndReturn((custom_type)2, 20); + foo_ExpectAndThrow((custom_type)3, 15); + foo_ExpectAndReturn((custom_type)4, 40); + TEST_ASSERT_EQUAL(10, function_a(1)); + TEST_ASSERT_EQUAL(20, function_a(2)); + TEST_ASSERT_EQUAL(30, function_a(3)); + TEST_ASSERT_EQUAL(40, function_a(4)); + } + + - :pass: TRUE + :should: 'pass because we nothing happens' + :code: | + test() + { + function_b(0); + } + + - :pass: FALSE + :should: 'fail because we did not expect function B to throw' + :code: | + test() + { + function_b(1); + } + + - :pass: TRUE + :should: 'fail because we expect function B to throw' + :code: | + test() + { + CEXCEPTION_T e; + Try + { + function_b(3); + TEST_FAIL_MESSAGE("Should Have Thrown"); + } + Catch(e) + { + TEST_ASSERT_EQUAL(3, e); + } + } + + - :pass: TRUE + :should: 'successfully throw an error on consecutive calls' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + foo_ExpectAndReturn((custom_type)1, 20); + foo_ExpectAndThrow((custom_type)1, 15); + foo_ExpectAndThrow((custom_type)3, 40); + TEST_ASSERT_EQUAL(10, function_a(1)); + TEST_ASSERT_EQUAL(20, function_a(1)); + TEST_ASSERT_EQUAL(30, function_a(1)); + TEST_ASSERT_EQUAL(80, function_a(3)); + } + + - :pass: TRUE + :should: 'successfully throw an error on later calls and after a previous mock call' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + foo_ExpectAndReturn((custom_type)1, 20); + foo_ExpectAndThrow((custom_type)1, 15); + TEST_ASSERT_EQUAL(10, function_a(1)); + TEST_ASSERT_EQUAL(20, function_a(1)); + TEST_ASSERT_EQUAL(30, function_a(1)); + + foo_ExpectAndReturn((custom_type)2, 20); + foo_ExpectAndThrow((custom_type)3, 40); + TEST_ASSERT_EQUAL(20, function_a(2)); + TEST_ASSERT_EQUAL(80, function_a(3)); + } + + - :pass: TRUE + :should: 'successfully throw an error if expects and mocks called before it' + :code: | + test() + { + foo_ExpectAndReturn((custom_type)1, 10); + foo_ExpectAndReturn((custom_type)1, 20); + TEST_ASSERT_EQUAL(10, function_a(1)); + TEST_ASSERT_EQUAL(20, function_a(1)); + + foo_ExpectAndReturn((custom_type)2, 20); + foo_ExpectAndThrow((custom_type)3, 40); + TEST_ASSERT_EQUAL(20, function_a(2)); + TEST_ASSERT_EQUAL(80, function_a(3)); + } + +... diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/fancy_pointer_handling.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/fancy_pointer_handling.yml new file mode 100644 index 0000000..e6e75e5 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/fancy_pointer_handling.yml @@ -0,0 +1,208 @@ +--- +:cmock: + :plugins: + - # none + :treat_as: + INT_PTR: INT* + +:systest: + :types: | + typedef struct _POINT_T { + int x; + int y; + } POINT_T; + typedef int* INT_PTR; + + :mockable: | + void foo(POINT_T* a); + POINT_T* bar(void); + void fooa(POINT_T a[]); + void foos(const char *a); + const char* bars(void); + INT_PTR zoink(INT_PTR a); + + :source: + :header: | + void function_a(void); + void function_b(void); + void function_c(void); + int function_d(void); + + :code: | + void function_a(void) + { + foo(bar()); + } + + void function_b(void) { + fooa(bar()); + } + + void function_c(void) { + foos(bars()); + } + + int function_d(void) { + int i = 456; + INT_PTR ptr = (INT_PTR)(&i); + return (int)(*(zoink(ptr))); + } + + :tests: + :common: | + void setUp(void) {} + void tearDown(void) {} + + :units: + - :pass: TRUE + :should: 'handle the situation where we pass nulls to pointers' + :code: | + test() + { + bar_ExpectAndReturn(NULL); + foo_Expect(NULL); + + function_a(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass single object with expect' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 2}; + bar_ExpectAndReturn(&pt); + foo_Expect(&ex); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass single object with expect and it is wrong' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 3}; + bar_ExpectAndReturn(&pt); + foo_Expect(&ex); + + function_a(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass nulls to pointers and fail' + :code: | + test() + { + POINT_T pt = {1, 2}; + bar_ExpectAndReturn(&pt); + foo_Expect(NULL); + + function_a(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass nulls to arrays' + :code: | + test() + { + bar_ExpectAndReturn(NULL); + fooa_Expect(NULL); + + function_b(); + } + + - :pass: TRUE + :should: 'handle the situation where we pass single array element with expect' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 2}; + bar_ExpectAndReturn(&pt); + fooa_Expect(&ex); + + function_b(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass single array element with expect and it is wrong' + :code: | + test() + { + POINT_T pt = {1, 2}; + POINT_T ex = {1, 3}; + bar_ExpectAndReturn(&pt); + fooa_Expect(&ex); + + function_b(); + } + + - :pass: FALSE + :should: 'handle the situation where we pass nulls to arrays and fail' + :code: | + test() + { + POINT_T pt = {1, 2}; + bar_ExpectAndReturn(&pt); + fooa_Expect(NULL); + + function_b(); + } + + - :pass: TRUE + :should: 'handle standard c string as null terminated on not do crappy memory compares of a byte, passing' + :code: | + test() + { + bars_ExpectAndReturn("This is a\0 silly string"); + foos_Expect("This is a\0 wacky string"); + + function_c(); + } + + - :pass: FALSE + :should: 'handle standard c string as null terminated on not do crappy memory compares of a byte, finding failures' + :code: | + test() + { + bars_ExpectAndReturn("This is a silly string"); + foos_Expect("This is a wacky string"); + + function_c(); + } + + - :pass: TRUE + :should: 'handle handle typedefs that ARE pointers by using treat_as' + :code: | + test() + { + int e = 456; + int r = 789; + INT_PTR ptr_e = (INT_PTR)(&e); + INT_PTR ptr_r = (INT_PTR)(&r); + + zoink_ExpectAndReturn(ptr_e, ptr_r); + + TEST_ASSERT_EQUAL(r, function_d()); + } + + - :pass: FALSE + :should: 'handle handle typedefs that ARE pointers by using treat_as and catch failures' + :code: | + test() + { + int e = 457; + int r = 789; + INT_PTR ptr_e = (INT_PTR)(&e); + INT_PTR ptr_r = (INT_PTR)(&r); + + zoink_ExpectAndReturn(ptr_e, ptr_r); + + TEST_ASSERT_EQUAL(r, function_d()); + } + + +... diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/function_pointer_handling.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/function_pointer_handling.yml new file mode 100644 index 0000000..9462bdd --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/function_pointer_handling.yml @@ -0,0 +1,82 @@ +--- +:cmock: + :plugins: + - # none + :treat_as: + FUNCTION_T: PTR + +:systest: + :types: | + typedef void (*FUNCTION_T)(void); + + :mockable: | + void takes_function_type( FUNCTION_T myfunc ); + void takes_function_ptr( unsigned int (*func_ptr)(int, char) ); + void takes_const_function_ptr( unsigned int (* const)(int, char) ); + unsigned short (*returns_function_ptr( const char op_code ))( int, long int ); + + :source: + :header: | + void exercise_function_pointer_param(void); + unsigned short (*exercise_function_pointer_return( const char op_code ))( int, long int ); + + // functions for function pointer tests + unsigned int dummy_function1(int a, char b); + unsigned short dummy_function2(int a, long int b); + + :code: | + /* + * functions used in tests + */ + + unsigned int dummy_function1(int a, char b) + { + // prevent compiler warnings by using everything + return (unsigned int)a + (unsigned int)b; + } + + unsigned short dummy_function2(int a, long int b) + { + // prevent compiler warnings by using everything + return (unsigned short)a + (unsigned short)b; + } + + /* + * functions executed by tests + */ + + void exercise_function_pointer_param(void) + { + takes_function_ptr(dummy_function1); + } + + unsigned short (*exercise_function_pointer_return( const char op_code ))( int, long int ) + { + return returns_function_ptr(op_code); + } + + :tests: + :common: | + void setUp(void) {} + void tearDown(void) {} + :units: + - :pass: TRUE + :should: 'expect a function pointer param' + :code: | + test() + { + takes_function_ptr_Expect(dummy_function1); + exercise_function_pointer_param(); + } + + - :pass: TRUE + :should: 'return a function pointer' + :code: | + test() + { + returns_function_ptr_ExpectAndReturn('z', dummy_function2); + TEST_ASSERT_EQUAL_PTR(dummy_function2, exercise_function_pointer_return('z')); + } + + +... diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/ignore_and_return.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/ignore_and_return.yml new file mode 100644 index 0000000..281efd0 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/ignore_and_return.yml @@ -0,0 +1,153 @@ +--- +:cmock: + :plugins: + - 'ignore' + +:systest: + :types: | + + :mockable: | + int foo(int a); + void bar(int b); + + :source: + :header: | + int function(int a, int b, int c); + :code: | + int function(int a, int b, int c) + { + bar(b); + return foo(a) + foo(b) + foo(c); + } + + :tests: + :common: | + void setUp(void) {} + void tearDown(void) {} + :units: + - :pass: TRUE + :should: 'successfully exercise simple ExpectAndReturn mock calls' + :code: | + test() + { + bar_Expect(2); + foo_ExpectAndReturn(1, 10); + foo_ExpectAndReturn(2, 20); + foo_ExpectAndReturn(3, 30); + TEST_ASSERT_EQUAL(60, function(1, 2, 3)); + } + + - :pass: TRUE + :should: 'ignore foo() calls' + :code: | + test() + { + bar_Expect(4); + foo_IgnoreAndReturn(10); + foo_IgnoreAndReturn(40); + foo_IgnoreAndReturn(80); + TEST_ASSERT_EQUAL(130, function(3, 4, 3)); + } + + - :pass: TRUE + :should: 'ignore foo() calls and always return last item if we run out' + :code: | + test() + { + bar_Expect(4); + foo_IgnoreAndReturn(20); + foo_IgnoreAndReturn(30); + TEST_ASSERT_EQUAL(80, function(3, 4, 9)); + } + + - :pass: TRUE + :should: 'ignore foo() calls and always return only item if only one specified' + :code: | + test() + { + bar_Expect(4); + foo_IgnoreAndReturn(20); + TEST_ASSERT_EQUAL(60, function(3, 4, 9)); + } + + - :pass: TRUE + :should: 'ignore bar() and foo() calls' + :code: | + test() + { + bar_Ignore(); + foo_IgnoreAndReturn(50); + TEST_ASSERT_EQUAL(150, function(0, 0, 0)); + } + + - :pass: TRUE + :should: 'ignore foo() calls over multiple mock calls' + :code: | + test() + { + bar_Ignore(); + foo_IgnoreAndReturn(50); + foo_IgnoreAndReturn(60); + foo_IgnoreAndReturn(70); + TEST_ASSERT_EQUAL(180, function(0, 0, 0)); + + bar_Ignore(); + foo_IgnoreAndReturn(30); + foo_IgnoreAndReturn(80); + foo_IgnoreAndReturn(10); + TEST_ASSERT_EQUAL(120, function(0, 0, 0)); + + foo_IgnoreAndReturn(70); + foo_IgnoreAndReturn(20); + TEST_ASSERT_EQUAL(110, function(0, 0, 0)); + } + + - :pass: TRUE + :should: 'multiple cycles of expects still pass when ignores enabled' + :code: | + test() + { + bar_Expect(2); + foo_ExpectAndReturn(1, 50); + foo_ExpectAndReturn(2, 60); + foo_ExpectAndReturn(3, 70); + TEST_ASSERT_EQUAL(180, function(1, 2, 3)); + + bar_Expect(5); + foo_ExpectAndReturn(4, 30); + foo_ExpectAndReturn(5, 80); + foo_ExpectAndReturn(6, 10); + TEST_ASSERT_EQUAL(120, function(4, 5, 6)); + + bar_Expect(8); + foo_ExpectAndReturn(7, 70); + foo_ExpectAndReturn(8, 20); + foo_ExpectAndReturn(9, 20); + TEST_ASSERT_EQUAL(110, function(7, 8, 9)); + } + + - :pass: FALSE + :should: 'multiple cycles of expects still fail when ignores enabled' + :code: | + test() + { + bar_Expect(2); + foo_ExpectAndReturn(1, 50); + foo_ExpectAndReturn(2, 60); + foo_ExpectAndReturn(3, 70); + TEST_ASSERT_EQUAL(180, function(1, 2, 3)); + + bar_Expect(5); + foo_ExpectAndReturn(4, 30); + foo_ExpectAndReturn(5, 80); + foo_ExpectAndReturn(6, 10); + TEST_ASSERT_EQUAL(120, function(4, 5, 6)); + + bar_Expect(8); + foo_ExpectAndReturn(7, 70); + foo_ExpectAndReturn(8, 20); + foo_ExpectAndReturn(9, 20); + TEST_ASSERT_EQUAL(110, function(0, 8, 9)); + } + +... diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/newer_standards_stuff1.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/newer_standards_stuff1.yml new file mode 100644 index 0000000..6843eae --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/newer_standards_stuff1.yml @@ -0,0 +1,52 @@ +--- +#The purpose of this test is to pull in some standard library stuff from C99 +:cmock: + :includes: + - "" + - "" + +:systest: + :types: | + #include + #include + + + :mockable: | + int32_t foo(int32_t a); + + :source: + :header: | + int8_t function_a(void); + + :code: | + int8_t function_a(void) { + return (int8_t)(INT_MIN == foo(INT_MAX)); + } + + :tests: + :common: | + void setUp(void) {} + void tearDown(void) {} + + :units: + - :pass: TRUE + :should: 'handle handle a simple comparison of C99 types which pass' + :code: | + test() + { + foo_ExpectAndReturn(INT_MAX, INT_MIN); + + TEST_ASSERT_TRUE(function_a()); + } + + - :pass: FALSE + :should: 'handle handle a simple comparison of C99 types which fail' + :code: | + test() + { + foo_ExpectAndReturn(INT_MIN, INT_MIN); + + TEST_ASSERT_TRUE(function_a()); + } + +... diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/nonstandard_parsed_stuff_1.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/nonstandard_parsed_stuff_1.yml new file mode 100644 index 0000000..01538ea --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/nonstandard_parsed_stuff_1.yml @@ -0,0 +1,91 @@ +--- +#The purpose of this test is to play with things like "const char const *" which isn't supported by some compilers +:cmock: + :enforce_strict_ordering: 1 + :plugins: + - :array + - :cexception + - :ignore + +:systest: + :types: | + typedef struct _POINT_T { + int x; + int y; + } POINT_T; + + :mockable: | + #include "CException.h" + void foos(const char const * a); + const char const * bars(void); + + :source: + :header: | + #include "CException.h" + void function_a(void); + void function_b(void); + void function_c(void); + int function_d(void); + + :code: | + void function_c(void) { + CEXCEPTION_T e; + Try { + foos(bars()); + } Catch(e) { foos("err"); } + } + + :tests: + :common: | + #include "CException.h" + void setUp(void) {} + void tearDown(void) {} + + :units: + - :pass: TRUE + :should: 'handle standard c string as null terminated on not do crappy memory compares of a byte, passing' + :code: | + test() + { + bars_ExpectAndReturn("This is a\0 silly string"); + foos_Expect("This is a\0 wacky string"); + + function_c(); + } + + - :pass: FALSE + :should: 'handle standard c string as null terminated on not do crappy memory compares of a byte, finding failures' + :code: | + test() + { + bars_ExpectAndReturn("This is a silly string"); + foos_Expect("This is a wacky string"); + + function_c(); + } + + - :pass: TRUE + :should: 'handle an exception being caught' + :code: | + test() + { + bars_ExpectAndReturn("This is a\0 silly string"); + foos_ExpectAndThrow("This is a\0 wacky string", 55); + foos_Expect("err"); + + function_c(); + } + + - :pass: FALSE + :should: 'handle an exception being caught but still catch following errors' + :code: | + test() + { + bars_ExpectAndReturn("This is a\0 silly string"); + foos_ExpectAndThrow("This is a\0 wacky string", 55); + foos_Expect("wrong error"); + + function_c(); + } + +... diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/nonstandard_parsed_stuff_2.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/nonstandard_parsed_stuff_2.yml new file mode 100644 index 0000000..f9c9538 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/nonstandard_parsed_stuff_2.yml @@ -0,0 +1,59 @@ +--- +#The purpose of this test is to play with our really rough multidimensional array support, which involves an implicit cast not supported everywhere +:cmock: + :plugins: + - :array + +:systest: + :types: | + + + :mockable: | + void foo(unsigned char** a); + unsigned char** bar(void); + + :source: + :header: | + void function_a(void); + + :code: | + void function_a(void) { + foo(bar()); + } + + :tests: + :common: | + void setUp(void) {} + void tearDown(void) {} + + :units: + - :pass: TRUE + :should: 'handle two dimensional array of unsigned characters just like we would handle a single dimensional array in expect (where we really only care about first element)' + :code: | + test() + { + unsigned char a[] = { 1, 2, 3, 4, 5, 6 }; + unsigned char** pa = (unsigned char**)(&a); + + bar_ExpectAndReturn(pa); + foo_Expect(pa); + + function_a(); + } + + - :pass: FALSE + :should: 'handle two dimensional array of unsigned characters just like we would handle a single dimensional array in expect as failures (where we really only care about first element)' + :code: | + test() + { + unsigned char a[] = { 1, 2, 3, 4, 5, 6 }; + unsigned char b[] = { 5, 6, 7, 8, 9, 0 }; + unsigned char** pa = (unsigned char**)(&a); + unsigned char** pb = (unsigned char**)(&b); + + bar_ExpectAndReturn(pa); + foo_Expect(pb); + + function_a(); + } +... diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/parsing_challenges.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/parsing_challenges.yml new file mode 100644 index 0000000..835e1fa --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/parsing_challenges.yml @@ -0,0 +1,222 @@ +--- +:cmock: + :plugins: + - # no plugins + :treat_as_void: + - VOID_TYPE_CRAZINESS_CFG + :treat_as: + TypeDefInt: HEX8 + +:systest: + :types: | + typedef unsigned short U16; + typedef struct _POINT_T + { + int x; + int y; + } POINT_T; + typedef void VOID_TYPE_CRAZINESS_CFG; + typedef int TypeDefInt; + + :mockable: | + /* Make sure we ignore the following + #include "NonExistantFile.h + */ + //#include "AndIgnoreThisToo.h" + #ifdef __cplusplus + extern "C" { + #endif + #define SHOULD_IGNORE_NEXT_FUNC_DEF_AS_PART_OF_MACRO \ + void IgnoredFunction(NotAValidType ToMakeItFailIfWeActuallyMockedThis); + + // typedef edge case; must be in mockable.h for test to compile + // not ANSI C but it has been done and will break cmock if not handled + typedef void VOID_TYPE_CRAZINESS_LCL; + + VOID_TYPE_CRAZINESS_LCL void_type_craziness1(int * a, int *b, int* c); + void void_type_craziness2(VOID_TYPE_CRAZINESS_CFG); + + // pointer parsing exercise + U16 *ptr_return1(int a); + U16* ptr_return2(int a); + U16 * ptr_return3(int a); + + unsigned int** ptr_ptr_return1(unsigned int** a); + unsigned int* *ptr_ptr_return2(unsigned int* *a); + unsigned int **ptr_ptr_return3(unsigned int **a); + unsigned int ** ptr_ptr_return4(unsigned int ** a); + + // variable argument lists + void var_args1(int a, ...); + void var_args2(int a, int b, ...); + + // parsing "stress tests" + char + crazy_multiline( + int a, + unsigned int b); + + unsigned long int incredible_descriptors(register const unsigned short a); + + TypeDefInt uses_typedef_like_names(TypeDefInt typedefvar); + + void oh_brackets1(int fudge[5]); + void oh_brackets2(int caramel[]); + #ifdef __cplusplus + } + #endif + + :source: + :header: | + U16* exercise_return_pointers(int a); + void exercise_var_args(int a, int b); + void exercise_arglist_pointers(void); + char exercise_multiline_declarations(int a, unsigned int b); + void exercise_double_pointers(unsigned int** a); + int exercise_many_descriptors(int a); + TypeDefInt exercise_typedef_like_names(TypeDefInt a); + + :code: | + int A, B, C; + unsigned int *pA, *pB, *pC; + + U16* exercise_return_pointers(int a) + { + ptr_return1(a); + ptr_return2(a); + return ptr_return3(a); + } + + void exercise_var_args(int a, int b) + { + var_args1(a, 3); + var_args2(a, b, 'c'); + } + + void exercise_arglist_pointers(void) + { + void_type_craziness1(&A, &B, &C); + void_type_craziness2(); + } + + char exercise_multiline_declarations(int a, unsigned int b) + { + return crazy_multiline(a, b); + } + + void exercise_double_pointers(unsigned int** a) + { + ptr_ptr_return1((unsigned int**)a); + ptr_ptr_return2((unsigned int**)a); + ptr_ptr_return3((unsigned int**)a); + ptr_ptr_return4((unsigned int**)a); + } + + int exercise_many_descriptors(int a) + { + return (int)incredible_descriptors((unsigned short)a); + } + + TypeDefInt exercise_typedef_like_names(TypeDefInt a) + { + return uses_typedef_like_names(a); + } + + :tests: + :common: | + extern int A, B, C; + extern unsigned int *pA, *pB, *pC; + + void setUp(void) + { + A = 100; + B = 200; + C = 300; + pA = (unsigned int*)(&A); + pB = (unsigned int*)(&B); + pC = (unsigned int*)(&C); + } + void tearDown(void) {} + :units: + - :pass: TRUE + :should: 'execute simple pointer return value check' + :code: | + test() + { + U16 retval; + ptr_return1_ExpectAndReturn(2, NULL); + ptr_return2_ExpectAndReturn(2, NULL); + ptr_return3_ExpectAndReturn(2, &retval); + TEST_ASSERT_EQUAL_PTR(&retval, exercise_return_pointers(2)); + } + + - :pass: TRUE + :should: 'ignore var args in expect prototype generation' + :code: | + test() + { + var_args1_Expect(2); + var_args2_Expect(2, 3); + exercise_var_args(2, 3); + } + + - :pass: TRUE + :should: "not process a typedef'd void as anything other than void" + :code: | + test() + { + void_type_craziness1_Expect(&A, &B, &C); + void_type_craziness2_Expect(); + exercise_arglist_pointers(); + } + + - :pass: TRUE + :should: 'successfully mock crazy multline function prototypes' + :code: | + test() + { + crazy_multiline_ExpectAndReturn(-10, 11, 'z'); + TEST_ASSERT_EQUAL('z', exercise_multiline_declarations(-10, 11)); + } + + - :pass: TRUE + :should: 'mock double pointers just fine' + :code: | + test() + { + ptr_ptr_return1_ExpectAndReturn(&pA, &pB); + ptr_ptr_return2_ExpectAndReturn(&pA, &pB); + ptr_ptr_return3_ExpectAndReturn(&pA, &pB); + ptr_ptr_return4_ExpectAndReturn(&pA, &pB); + exercise_double_pointers((unsigned int**)(&pA)); + } + + - :pass: TRUE + :should: 'mock prototypes with long lists of return and parameter type descriptors' + :code: | + test() + { + incredible_descriptors_ExpectAndReturn(888, 777); + TEST_ASSERT_EQUAL(777, exercise_many_descriptors(888)); + } + + - :pass: TRUE + :should: 'handle words like typdef as PART of a variable or type' + :code: | + test() + { + uses_typedef_like_names_ExpectAndReturn((TypeDefInt)54, (TypeDefInt)53); + TEST_ASSERT_EQUAL(53, exercise_typedef_like_names((TypeDefInt)54)); + } + + - :pass: FALSE + :should: 'handle words like typdef as PART of a variable or type during failing tests' + :code: | + test() + { + uses_typedef_like_names_ExpectAndReturn((TypeDefInt)52, (TypeDefInt)53); + TEST_ASSERT_EQUAL(53, exercise_typedef_like_names((TypeDefInt)54)); + } + + +... diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/struct_union_enum_expect_and_return.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/struct_union_enum_expect_and_return.yml new file mode 100644 index 0000000..d4cf6af --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/struct_union_enum_expect_and_return.yml @@ -0,0 +1,277 @@ +--- +:cmock: + :plugins: + - # none + +:systest: + :types: | + struct THING { int a; int b; }; + + union STARS_AND_STRIPES { int a; char b; }; + + enum HOKEY_POKEY { IN, OUT, SHAKE_IT_ALL_ABOUT }; + + :mockable: | + void foo_struct(struct THING*, struct THING); + struct THING foobar_struct(void); + + void foo_union(union STARS_AND_STRIPES*, union STARS_AND_STRIPES); + union STARS_AND_STRIPES foobar_union(void); + + void foo_enum(enum HOKEY_POKEY a, enum HOKEY_POKEY * b); + enum HOKEY_POKEY foobar_enum(void); + + :source: + :header: | + void exercise_struct(struct THING* a, struct THING b); + struct THING return_struct(void); + + void exercise_union(union STARS_AND_STRIPES* a, union STARS_AND_STRIPES b); + union STARS_AND_STRIPES return_union(void); + + void exercise_enum(enum HOKEY_POKEY a, enum HOKEY_POKEY * b); + enum HOKEY_POKEY return_enum(void); + + :code: | + void exercise_struct(struct THING* a, struct THING b) + { + foo_struct(a, b); + } + + struct THING return_struct(void) + { + return foobar_struct(); + } + + void exercise_union(union STARS_AND_STRIPES* a, union STARS_AND_STRIPES b) + { + foo_union(a, b); + } + + union STARS_AND_STRIPES return_union(void) + { + return foobar_union(); + } + + void exercise_enum(enum HOKEY_POKEY a, enum HOKEY_POKEY * b) + { + foo_enum(a, b); + } + + enum HOKEY_POKEY return_enum(void) + { + return foobar_enum(); + } + + + :tests: + :common: | + struct THING struct1; + struct THING struct2; + struct THING struct3; + struct THING struct4; + struct THING struct5; + struct THING struct6; + + union STARS_AND_STRIPES union1; + union STARS_AND_STRIPES union2; + union STARS_AND_STRIPES union3; + union STARS_AND_STRIPES union4; + union STARS_AND_STRIPES union5; + union STARS_AND_STRIPES union6; + + enum HOKEY_POKEY enum1; + enum HOKEY_POKEY enum2; + + void setUp(void) + { + struct1.a = 1; + struct1.b = 2; + + struct2.a = 3; + struct2.b = 4; + + struct3.a = 5; + struct3.b = 6; + + struct4.a = 7; + struct4.b = 8; + + struct5.a = 9; + struct5.b = 10; + + struct6.a = 9; + struct6.b = 10; + + union1.a = 1; + union2.a = 2; + union3.a = 3; + union4.a = 4; + union5.a = 5; + union6.a = 5; + + enum1 = OUT; + enum2 = IN; + } + + void tearDown(void) {} + + :units: + - :pass: TRUE + :should: 'successfully compare structs' + :code: | + test() + { + foo_struct_Expect(&struct1, struct2); + exercise_struct(&struct1, struct2); + } + + - :pass: FALSE + :should: 'blow up on bad struct pointer comparison' + :code: | + test() + { + foo_struct_Expect(&struct1, struct2); + exercise_struct(&struct3, struct2); + } + + - :pass: FALSE + :should: 'blow up on bad structure comparison' + :code: | + test() + { + foo_struct_Expect(&struct1, struct2); + exercise_struct(&struct1, struct4); + } + + - :pass: TRUE + :should: 'compare returned structs as equal' + :code: | + test() + { + foobar_struct_ExpectAndReturn(struct5); + TEST_ASSERT_EQUAL_THING(struct6, return_struct()); + } + + - :pass: FALSE + :should: 'compare returned structs as unequal' + :code: | + test() + { + foobar_struct_ExpectAndReturn(struct4); + TEST_ASSERT_EQUAL_THING(struct5, return_struct()); + } + + - :pass: TRUE + :should: 'successfully compare unions' + :code: | + test() + { + foo_union_Expect(&union1, union2); + exercise_union(&union1, union2); + } + + - :pass: FALSE + :should: 'blow up on bad union pointer comparison' + :code: | + test() + { + foo_union_Expect(&union1, union2); + exercise_union(&union3, union2); + } + + - :pass: FALSE + :should: 'blow up on bad union comparison' + :code: | + test() + { + foo_union_Expect(&union1, union2); + exercise_union(&union1, union4); + } + + - :pass: TRUE + :should: 'compare returned unions as equal' + :code: | + test() + { + foobar_union_ExpectAndReturn(union5); + TEST_ASSERT_EQUAL_STARS_AND_STRIPES(union6, return_union()); + } + + - :pass: FALSE + :should: 'compare returned unions as unequal' + :code: | + test() + { + foobar_union_ExpectAndReturn(union4); + TEST_ASSERT_EQUAL_STARS_AND_STRIPES(union5, return_union()); + } + + - :pass: TRUE + :should: 'successfully pass enum values' + :code: | + test() + { + foo_enum_Expect(OUT, &enum1); + exercise_enum(OUT, &enum1); + } + + - :pass: FALSE + :should: 'blow up on bad enum pointer comparison' + :code: | + test() + { + foo_enum_Expect(IN, &enum1); + exercise_enum(IN, &enum2); + } + + - :pass: FALSE + :should: 'blow up on bad enum comparison' + :code: | + test() + { + foo_enum_Expect(IN, &enum1); + exercise_enum(SHAKE_IT_ALL_ABOUT, &enum1); + } + + - :pass: TRUE + :should: 'compare returned enums as equal' + :code: | + test() + { + foobar_enum_ExpectAndReturn(OUT); + TEST_ASSERT_EQUAL(OUT, return_enum()); + } + + - :pass: FALSE + :should: 'compare returned unions as unequal' + :code: | + test() + { + foobar_enum_ExpectAndReturn(OUT); + TEST_ASSERT_EQUAL(IN, return_enum()); + } + + + :unity_helper: + :header: | + void AssertEqualTHINGStruct(struct THING expected, struct THING actual); + void AssertEqualSTARS_AND_STRIPESUnion(union STARS_AND_STRIPES expected, union STARS_AND_STRIPES actual); + + #define TEST_ASSERT_EQUAL_THING(expected, actual) {AssertEqualTHINGStruct(expected, actual);} + #define TEST_ASSERT_EQUAL_STARS_AND_STRIPES(expected, actual) {AssertEqualSTARS_AND_STRIPESUnion(expected, actual);} + + :code: | + void AssertEqualTHINGStruct(struct THING expected, struct THING actual) + { + TEST_ASSERT_EQUAL_INT_MESSAGE(expected.a, actual.a, "actual struct member \"a\" does not equal expected"); + TEST_ASSERT_EQUAL_INT_MESSAGE(expected.b, actual.b, "actual struct member \"b\" does not equal expected"); + } + + void AssertEqualSTARS_AND_STRIPESUnion(union STARS_AND_STRIPES expected, union STARS_AND_STRIPES actual) + { + TEST_ASSERT_EQUAL_INT_MESSAGE(expected.a, actual.a, "actual union member \"a\" does not equal expected"); + TEST_ASSERT_EQUAL_MESSAGE(expected.b, actual.b, "actual union member \"b\" does not equal expected"); + } + +... diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/stubs_with_callbacks.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/stubs_with_callbacks.yml new file mode 100644 index 0000000..fcae12c --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/stubs_with_callbacks.yml @@ -0,0 +1,221 @@ +--- +:cmock: + :plugins: + - :callback + :treat_as: + custom_type: INT + +:systest: + :types: | + #define UINT32 unsigned int + + typedef signed int custom_type; + + :mockable: | + UINT32 foo(custom_type* a); + UINT32 bar(custom_type* b); + int baz(void); + void fuz(int* args, int num); + + :source: + :header: | + void function_a(int a, int b); + UINT32 function_b(void); + int function_c(void); + + :code: | + void function_a(int a, int b) + { + int args[6] = {0, 1, 2, 3, 5, 5}; + args[0] = a; + fuz(args, b); + } + + UINT32 function_b(void) + { + UINT32 sum = 0; + custom_type a = 0; + custom_type b = 0; + sum = foo(&a) + bar(&b); + return sum + a + b; + } + + int function_c(void) + { + return (baz() + baz() + baz()); + } + + :tests: + :common: | + void setUp(void) {} + void tearDown(void) {} + + UINT32 FooAndBarHelper(custom_type* data, int num) + { + num++; + *data = (custom_type)(num * 2); + return (*data * 2); + } + + int BazCallbackPointless(int num) + { + return num; + } + + int BazCallbackComplainsIfCalledMoreThanTwice(int num) + { + TEST_ASSERT_MESSAGE(num < 2, "Do Not Call Baz More Than Twice"); + return num; + } + + void FuzVerifier(int* args, int num_args, int num_calls) + { + int i; + TEST_ASSERT_MESSAGE(num_args < 5, "No More Than 5 Args Allowed"); + for (i = 0; i < num_args; i++) + { + TEST_ASSERT_EQUAL(num_calls + i, args[i]); + } + } + + :units: + - :pass: TRUE + :should: 'successfully exercise two simple ExpectAndReturn mock calls the normal way' + :code: | + test() + { + custom_type exp = 0; + foo_ExpectAndReturn(&exp, 10); + bar_ExpectAndReturn(&exp, 20); + TEST_ASSERT_EQUAL(30, function_b()); + } + + - :pass: FALSE + :should: 'successfully exercise two simple ExpectAndReturn mock calls and catch failure the normal way' + :code: | + test() + { + custom_type exp = 1; + foo_ExpectAndReturn(&exp, 10); + bar_ExpectAndReturn(&exp, 20); + TEST_ASSERT_EQUAL(30, function_b()); + } + + - :pass: TRUE + :should: 'successfully exercise using some basic callbacks' + :code: | + test() + { + foo_StubWithCallback((CMOCK_foo_CALLBACK)FooAndBarHelper); + bar_StubWithCallback((CMOCK_bar_CALLBACK)FooAndBarHelper); + TEST_ASSERT_EQUAL(12, function_b()); + } + + - :pass: TRUE + :should: 'successfully exercise using some basic callbacks even if there were expects' + :code: | + test() + { + custom_type exp = 500; + foo_ExpectAndReturn(&exp, 10); + foo_StubWithCallback((CMOCK_foo_CALLBACK)FooAndBarHelper); + bar_StubWithCallback((CMOCK_bar_CALLBACK)FooAndBarHelper); + TEST_ASSERT_EQUAL(12, function_b()); + } + + - :pass: FALSE + :should: 'successfully exercise using some basic callbacks and notice failures' + :code: | + test() + { + foo_StubWithCallback((CMOCK_foo_CALLBACK)FooAndBarHelper); + bar_StubWithCallback((CMOCK_bar_CALLBACK)FooAndBarHelper); + TEST_ASSERT_EQUAL(10, function_b()); + } + + - :pass: TRUE + :should: 'successfully exercise a callback with no arguments' + :code: | + test() + { + baz_StubWithCallback((CMOCK_baz_CALLBACK)BazCallbackPointless); + TEST_ASSERT_EQUAL(3, function_c()); + } + + - :pass: FALSE + :should: 'successfully throw a failure from within a callback function' + :code: | + test() + { + baz_StubWithCallback((CMOCK_baz_CALLBACK)BazCallbackComplainsIfCalledMoreThanTwice); + function_c(); + } + + - :pass: TRUE + :should: 'be usable for things like dynamically sized memory checking for passing conditions' + :code: | + test() + { + fuz_StubWithCallback((CMOCK_fuz_CALLBACK)FuzVerifier); + function_a(0, 4); + } + + - :pass: FALSE + :should: 'be usable for things like dynamically sized memory checking for failing conditions' + :code: | + test() + { + fuz_StubWithCallback((CMOCK_fuz_CALLBACK)FuzVerifier); + function_a(0, 5); + } + + - :pass: FALSE + :should: 'be usable for things like dynamically sized memory checking for failing conditions 2' + :code: | + test() + { + fuz_StubWithCallback((CMOCK_fuz_CALLBACK)FuzVerifier); + function_a(1, 4); + } + + - :pass: TRUE + :should: 'run them interlaced' + :code: | + test() + { + custom_type exp = 0; + foo_ExpectAndReturn(&exp, 10); + foo_ExpectAndReturn(&exp, 15); + bar_ExpectAndReturn(&exp, 20); + bar_ExpectAndReturn(&exp, 40); + fuz_StubWithCallback((CMOCK_fuz_CALLBACK)FuzVerifier); + baz_StubWithCallback((CMOCK_baz_CALLBACK)BazCallbackPointless); + + TEST_ASSERT_EQUAL(30, function_b()); + TEST_ASSERT_EQUAL(55, function_b()); + function_a(0, 4); + TEST_ASSERT_EQUAL(3, function_c()); + } + + - :pass: TRUE + :should: 'run them back to back' + :code: | + test() + { + custom_type exp = 0; + foo_ExpectAndReturn(&exp, 10); + bar_ExpectAndReturn(&exp, 20); + TEST_ASSERT_EQUAL(30, function_b()); + + foo_ExpectAndReturn(&exp, 15); + bar_ExpectAndReturn(&exp, 40); + TEST_ASSERT_EQUAL(55, function_b()); + + fuz_StubWithCallback((CMOCK_fuz_CALLBACK)FuzVerifier); + function_a(0, 4); + + baz_StubWithCallback((CMOCK_baz_CALLBACK)BazCallbackPointless); + TEST_ASSERT_EQUAL(3, function_c()); + } + +... diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/unity_64bit_support.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/unity_64bit_support.yml new file mode 100644 index 0000000..c34bb1c --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/unity_64bit_support.yml @@ -0,0 +1,82 @@ +--- +#The purpose of this test is to play with things 64-bit integers, which aren't supported by all compilers +:cmock: + :plugins: + - :array + - :ignore + +:systest: + :types: | + #if (UNITY_LONG_WIDTH == 32) + typedef unsigned long long TEST64; + #elif (UNITY_LONG_WIDTH == 64) + typedef unsigned long TEST64; + #else + #error This Test Should Not Be Run Unless You Have 64 Bit Support Enabled + #endif + + :mockable: | + TEST64 foo(TEST64 a); + TEST64* bar(TEST64* b); + + :source: + :header: | + TEST64 function_a(void); + + :code: | + TEST64 function_a(void) { + TEST64 a = 0x1234567890123456; + TEST64 b; + TEST64* c; + + b = foo(a); + c = bar(&b); + return *c; + } + + :tests: + :common: | + void setUp(void) {} + void tearDown(void) {} + + :units: + - :pass: TRUE + :should: 'handle a straightforward 64-bit series of calls' + :code: | + test() + { + TEST64 a = 0x0987654321543210; + TEST64 b = 0x5a5a5a5a5a5a5a5a; + foo_ExpectAndReturn(0x1234567890123456, 0x0987654321543210); + bar_ExpectAndReturn(&a, &b); + + TEST_ASSERT_EQUAL_HEX64(b, function_a()); + } + + - :pass: FALSE + :should: 'handle a straightforward 64-bit series of calls with a failure' + :code: | + test() + { + TEST64 a = 0x0987654321543210; + TEST64 b = 0x5a5a5a5a5a5a5a5a; + foo_ExpectAndReturn(0x1234567890123456, 0x0987654321543211); + bar_ExpectAndReturn(&a, &b); + + TEST_ASSERT_EQUAL_HEX64(b, function_a()); + } + + - :pass: FALSE + :should: 'handle a straightforward 64-bit series of calls returning a failure' + :code: | + test() + { + TEST64 a = 0x0987654321543210; + TEST64 b = 0x5a5a5a5a5a5a5a5a; + foo_ExpectAndReturn(0x1234567890123456, 0x0987654321543210); + bar_ExpectAndReturn(&a, &b); + + TEST_ASSERT_EQUAL_HEX64(b+1, function_a()); + } + +... diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/unity_ignores.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/unity_ignores.yml new file mode 100644 index 0000000..c6f8574 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/system/test_interactions/unity_ignores.yml @@ -0,0 +1,139 @@ +--- +:cmock: + :plugins: + - # none + +:systest: + :types: | + #define UINT32 unsigned int + + :mockable: | + UINT32 foo(UINT32 a); + void bar(void); + + :source: + :header: | + UINT32 function_a(int a); + void function_b(void); + + :code: | + UINT32 function_a(int a) + { + bar(); + return foo((UINT32)a); + } + + void function_b(void) + { + bar(); + } + + :tests: + :common: | + void setUp(void) {} + void tearDown(void) {} + + :units: + - :pass: :ignore + :should: 'ignore incorrect expects after the TEST_IGNORE call' + :code: | + test() + { + TEST_IGNORE(); + bar_Expect(); + foo_ExpectAndReturn(10, 20); + TEST_ASSERT_EQUAL(40, function_a(30)); + } + + - :pass: :ignore + :should: 'ignore missing expects after the TEST_IGNORE call' + :code: | + test() + { + TEST_IGNORE(); + foo_ExpectAndReturn(10, 20); + TEST_ASSERT_EQUAL(20, function_a(10)); + } + + - :pass: :ignore + :should: 'ignore extra expects after the TEST_IGNORE call' + :code: | + test() + { + TEST_IGNORE(); + bar_Expect(); + bar_Expect(); + foo_ExpectAndReturn(10, 20); + foo_ExpectAndReturn(10, 20); + foo_ExpectAndReturn(10, 20); + TEST_ASSERT_EQUAL(20, function_a(10)); + } + + - :pass: :ignore + :should: 'ignore no expects after the TEST_IGNORE call' + :code: | + test() + { + TEST_IGNORE(); + TEST_ASSERT_EQUAL(20, function_a(10)); + } + + - :pass: :ignore + :should: 'ignore extra expects after the TEST_IGNORE call even if it happens later' + :code: | + test() + { + bar_Expect(); + foo_ExpectAndReturn(10, 20); + function_a(10); + + TEST_IGNORE(); + bar_Expect(); + foo_ExpectAndReturn(10, 20); + TEST_ASSERT_EQUAL(40, function_a(30)); + } + + - :pass: false + :should: 'still fail if there are expect problems before the TEST_IGNORE' + :code: | + test() + { + bar_Expect(); + foo_ExpectAndReturn(10, 20); + function_a(30); + + TEST_IGNORE(); + bar_Expect(); + foo_ExpectAndReturn(10, 20); + TEST_ASSERT_EQUAL(40, function_a(30)); + } + + - :pass: false + :should: 'still fail if there are missing expect problems before the TEST_IGNORE' + :code: | + test() + { + bar_Expect(); + function_a(10); + + TEST_IGNORE(); + bar_Expect(); + foo_ExpectAndReturn(10, 20); + TEST_ASSERT_EQUAL(40, function_a(30)); + } + + - :pass: :ignore + :should: 'ignore if extra expects before the TEST_IGNORE because it ignored the rest of the test that might have made calls to it' + :code: | + test() + { + bar_Expect(); + bar_Expect(); + foo_ExpectAndReturn(10, 20); + function_a(10); + + TEST_IGNORE(); + foo_ExpectAndReturn(10, 20); + TEST_ASSERT_EQUAL(40, function_a(30)); + } +... diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/test/test_helper.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/test_helper.rb new file mode 100644 index 0000000..7dd33fb --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/test_helper.rb @@ -0,0 +1,44 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== +[ "/../config/test_environment", + "/../vendor/behaviors/lib/behaviors" +].each do |req| + require File.expand_path(File.dirname(__FILE__)) + req +end + +#gem install test-unit -v 1.2.3 +ruby_version = RUBY_VERSION.split('.') +if (ruby_version[1].to_i == 9) and (ruby_version[2].to_i > 1) + require 'rubygems' + gem 'test-unit' +end +require 'test/unit' +require 'hardmock' + +class Test::Unit::TestCase + extend Behaviors + + #these are helpful test structures which can be used during tests + + def test_return + { + :int => {:type => "int", :name => 'cmock_to_return', :ptr? => false, :const? => false, :void? => false, :str => 'int cmock_to_return'}, + :int_ptr => {:type => "int*", :name => 'cmock_to_return', :ptr? => true, :const? => false, :void? => false, :str => 'int* cmock_to_return'}, + :void => {:type => "void", :name => 'cmock_to_return', :ptr? => false, :const? => false, :void? => true, :str => 'void cmock_to_return'}, + :string => {:type => "char*", :name => 'cmock_to_return', :ptr? => false, :const? => true, :void? => false, :str => 'const char* cmock_to_return'}, + } + end + + def test_arg + { + :int => {:type => "int", :name => 'MyInt', :ptr? => false, :const? => false}, + :int_ptr => {:type => "int*", :name => 'MyIntPtr', :ptr? => true, :const? => false}, + :mytype => {:type => "MY_TYPE", :name => 'MyMyType', :ptr? => false, :const? => true}, + :mytype_ptr => {:type => "MY_TYPE*", :name => 'MyMyTypePtr', :ptr? => true, :const? => false}, + :string => {:type => "char*", :name => 'MyStr', :ptr? => false, :const? => true}, + } + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/test/unit/cmock_config_test.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/unit/cmock_config_test.rb new file mode 100644 index 0000000..cfdfc41 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/unit/cmock_config_test.rb @@ -0,0 +1,45 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require File.expand_path(File.dirname(__FILE__)) + "/../test_helper" +require 'cmock_config' + +class CMockConfigTest < Test::Unit::TestCase + def setup + end + + def teardown + end + + should "use default settings when no parameters are specified" do + config = CMockConfig.new + assert_equal(CMockConfig::CMockDefaultOptions[:mock_path], config.mock_path) + assert_equal(CMockConfig::CMockDefaultOptions[:includes], config.includes) + assert_equal(CMockConfig::CMockDefaultOptions[:attributes], config.attributes) + assert_equal(CMockConfig::CMockDefaultOptions[:plugins], config.plugins) + assert_equal(CMockConfig::CMockDefaultOptions[:treat_externs], config.treat_externs) + end + + should "replace only options specified in a hash" do + test_includes = ['hello'] + test_attributes = ['blah', 'bleh'] + config = CMockConfig.new(:includes => test_includes, :attributes => test_attributes) + assert_equal(CMockConfig::CMockDefaultOptions[:mock_path], config.mock_path) + assert_equal(test_includes, config.includes) + assert_equal(test_attributes, config.attributes) + assert_equal(CMockConfig::CMockDefaultOptions[:plugins], config.plugins) + assert_equal(CMockConfig::CMockDefaultOptions[:treat_externs], config.treat_externs) + end + + should "replace only options specified in a yaml file" do + test_plugins = [:soda, :pizza] + config = CMockConfig.new("#{File.expand_path(File.dirname(__FILE__))}/cmock_config_test.yml") + assert_equal(CMockConfig::CMockDefaultOptions[:mock_path], config.mock_path) + assert_equal(CMockConfig::CMockDefaultOptions[:includes], config.includes) + assert_equal(test_plugins, config.plugins) + assert_equal(:include, config.treat_externs) + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/test/unit/cmock_config_test.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/unit/cmock_config_test.yml new file mode 100644 index 0000000..b2444f8 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/unit/cmock_config_test.yml @@ -0,0 +1,5 @@ +:cmock: + :plugins: + - 'soda' + - 'pizza' + :treat_externs: :include diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/test/unit/cmock_file_writer_test.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/unit/cmock_file_writer_test.rb new file mode 100644 index 0000000..13c2631 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/unit/cmock_file_writer_test.rb @@ -0,0 +1,30 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require File.expand_path(File.dirname(__FILE__)) + "/../test_helper" +require 'cmock_file_writer' + +class CMockFileWriterTest < Test::Unit::TestCase + def setup + create_mocks :config + @cmock_file_writer = CMockFileWriter.new(@config) + end + + def teardown + end + + should "have set up internal accessors correctly on init" do + assert_equal(@config, @cmock_file_writer.config) + end + + should "complain if a block was not specified when calling create" do + begin + @cmock_file_writer.create_file("test.txt") + assert false, "Should Have Thrown An Error When Calling Without A Block" + rescue + end + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/test/unit/cmock_generator_main_test.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/unit/cmock_generator_main_test.rb new file mode 100644 index 0000000..f743d84 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/unit/cmock_generator_main_test.rb @@ -0,0 +1,412 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +$ThisIsOnlyATest = true + +require File.expand_path(File.dirname(__FILE__)) + "/../test_helper" +require 'cmock_generator' + +class MockedPluginHelper + def initialize return_this + @return_this = return_this + end + + def include_files + return @return_this + end + + def instance_structure( name, args, rettype ) + return " #{@return_this}_#{name}(#{args}, #{rettype})" + end + + def mock_verify( name ) + return " #{@return_this}_#{name}" + end + + def mock_destroy( name, args, rettype ) + return " #{@return_this}_#{name}(#{args}, #{rettype})" + end + + def mock_implementation(name, args) + return " Mock#{name}#{@return_this}(#{args.join(", ")})" + end +end + +class CMockGeneratorTest < Test::Unit::TestCase + def setup + create_mocks :config, :file_writer, :utils, :plugins + @module_name = "PoutPoutFish" + + #no strict handling + @config.expect.mock_prefix.returns("Mock") + @config.expect.enforce_strict_ordering.returns(nil) + @config.expect.framework.returns(:unity) + @config.expect.includes.returns(["ConfigRequiredHeader1.h","ConfigRequiredHeader2.h"]) + #@config.expect.includes_h_pre_orig_header.returns(nil) #not called because includes called + @config.expect.includes_h_post_orig_header.returns(nil) + @config.expect.includes_c_pre_header.returns(nil) + @config.expect.includes_c_post_header.returns(nil) + @cmock_generator = CMockGenerator.new(@config, @file_writer, @utils, @plugins) + @cmock_generator.module_name = @module_name + @cmock_generator.mock_name = "Mock#{@module_name}" + + #strict handling + @config.expect.mock_prefix.returns("Mock") + @config.expect.enforce_strict_ordering.returns(true) + @config.expect.framework.returns(:unity) + @config.expect.includes.returns(nil) + @config.expect.includes_h_pre_orig_header.returns(nil) + @config.expect.includes_h_post_orig_header.returns(nil) + @config.expect.includes_c_pre_header.returns(nil) + @config.expect.includes_c_post_header.returns(nil) + @cmock_generator_strict = CMockGenerator.new(@config, @file_writer, @utils, @plugins) + @cmock_generator_strict.module_name = @module_name + @cmock_generator_strict.mock_name = "Mock#{@module_name}" + end + + def teardown + end + + should "have set up internal accessors correctly on init" do + assert_equal(@config, @cmock_generator.config) + assert_equal(@file_writer, @cmock_generator.file_writer) + assert_equal(@utils, @cmock_generator.utils) + assert_equal(@plugins, @cmock_generator.plugins) + end + + should "create the top of a header file with optional include files from config and include file from plugin" do + @config.expect.mock_prefix.returns("Mock") + orig_filename = "PoutPoutFish.h" + define_name = "MOCKPOUTPOUTFISH_H" + mock_name = "MockPoutPoutFish" + output = [] + expected = [ "/* AUTOGENERATED FILE. DO NOT EDIT. */\n", + "#ifndef _#{define_name}\n", + "#define _#{define_name}\n\n", + "#include \"ConfigRequiredHeader1.h\"\n", + "#include \"ConfigRequiredHeader2.h\"\n", + "#include \"#{orig_filename}\"\n", + "#include \"PluginRequiredHeader.h\"\n", + "\n" + ] + + @plugins.expect.run(:include_files).returns("#include \"PluginRequiredHeader.h\"\n") + + @cmock_generator.create_mock_header_header(output, "MockPoutPoutFish.h") + + assert_equal(expected, output) + end + + should "create the top of a header file with optional include files from config" do + @config.expect.mock_prefix.returns("Mock") + orig_filename = "PoutPoutFish.h" + define_name = "MOCKPOUTPOUTFISH_H" + mock_name = "MockPoutPoutFish" + output = [] + expected = [ "/* AUTOGENERATED FILE. DO NOT EDIT. */\n", + "#ifndef _#{define_name}\n", + "#define _#{define_name}\n\n", + "#include \"ConfigRequiredHeader1.h\"\n", + "#include \"ConfigRequiredHeader2.h\"\n", + "#include \"#{orig_filename}\"\n", + "\n" + ] + + @plugins.expect.run(:include_files).returns('') + + @cmock_generator.create_mock_header_header(output, "MockPoutPoutFish.h") + + assert_equal(expected, output) + end + + should "create the top of a header file with include file from plugin" do + @config.expect.mock_prefix.returns("Mock") + orig_filename = "PoutPoutFish.h" + define_name = "MOCKPOUTPOUTFISH_H" + mock_name = "MockPoutPoutFish" + output = [] + expected = [ "/* AUTOGENERATED FILE. DO NOT EDIT. */\n", + "#ifndef _#{define_name}\n", + "#define _#{define_name}\n\n", + "#include \"ConfigRequiredHeader1.h\"\n", + "#include \"ConfigRequiredHeader2.h\"\n", + "#include \"#{orig_filename}\"\n", + "#include \"PluginRequiredHeader.h\"\n", + "\n" + ] + + @plugins.expect.run(:include_files).returns("#include \"PluginRequiredHeader.h\"\n") + + @cmock_generator.create_mock_header_header(output, "MockPoutPoutFish.h") + + assert_equal(expected, output) + end + + should "write typedefs" do + typedefs = [ 'typedef unsigned char U8;', + 'typedef char S8;', + 'typedef unsigned long U32;' + ] + output = [] + expected = [ "\n", + "typedef unsigned char U8;\n", + "typedef char S8;\n", + "typedef unsigned long U32;\n", + "\n\n" + ] + + @cmock_generator.create_typedefs(output, typedefs) + + assert_equal(expected, output.flatten) + end + + should "create the header file service call declarations" do + mock_name = "MockPoutPoutFish" + + output = [] + expected = [ "void #{mock_name}_Init(void);\n", + "void #{mock_name}_Destroy(void);\n", + "void #{mock_name}_Verify(void);\n\n" + ] + + @cmock_generator.create_mock_header_service_call_declarations(output) + + assert_equal(expected, output) + end + + should "append the proper footer to the header file" do + output = [] + expected = ["\n#endif\n"] + + @cmock_generator.create_mock_header_footer(output) + + assert_equal(expected, output) + end + + should "create a proper heading for a source file" do + output = [] + expected = [ "/* AUTOGENERATED FILE. DO NOT EDIT. */\n", + "#include \n", + "#include \n", + "#include \n", + "#include \"unity.h\"\n", + "#include \"cmock.h\"\n", + "#include \"MockPoutPoutFish.h\"\n", + "\n" + ] + + @cmock_generator.create_source_header_section(output, "MockPoutPoutFish.c") + + assert_equal(expected, output) + end + + should "create the instance structure where it is needed when no functions" do + output = [] + functions = [] + expected = [ "static struct MockPoutPoutFishInstance\n", + "{\n", + " unsigned char placeHolder;\n", + "} Mock;\n\n" + ].join + + @cmock_generator.create_instance_structure(output, functions) + + assert_equal(expected, output.join) + end + + should "create the instance structure where it is needed when functions required" do + output = [] + functions = [ { :name => "First", :args => "int Candy", :return => test_return[:int] }, + { :name => "Second", :args => "bool Smarty", :return => test_return[:string] } + ] + expected = [ "typedef struct _CMOCK_First_CALL_INSTANCE\n{\n", + " UNITY_LINE_TYPE LineNumber;\n", + " b1 b2", + "\n} CMOCK_First_CALL_INSTANCE;\n\n", + "typedef struct _CMOCK_Second_CALL_INSTANCE\n{\n", + " UNITY_LINE_TYPE LineNumber;\n", + "\n} CMOCK_Second_CALL_INSTANCE;\n\n", + "static struct MockPoutPoutFishInstance\n{\n", + " d1", + " CMOCK_MEM_INDEX_TYPE First_CallInstance;\n", + " e1 e2 e3", + " CMOCK_MEM_INDEX_TYPE Second_CallInstance;\n", + "} Mock;\n\n" + ].join + @plugins.expect.run(:instance_typedefs, functions[0]).returns([" b1"," b2"]) + @plugins.expect.run(:instance_typedefs, functions[1]).returns([]) + + @plugins.expect.run(:instance_structure, functions[0]).returns([" d1"]) + @plugins.expect.run(:instance_structure, functions[1]).returns([" e1"," e2"," e3"]) + + @cmock_generator.create_instance_structure(output, functions) + + assert_equal(expected, output.join) + end + + should "create extern declarations for source file" do + output = [] + expected = [ "extern jmp_buf AbortFrame;\n", + "\n" ] + + @cmock_generator.create_extern_declarations(output) + + assert_equal(expected, output.flatten) + end + + should "create extern declarations for source file when using strict ordering" do + output = [] + expected = [ "extern jmp_buf AbortFrame;\n", + "extern int GlobalExpectCount;\n", + "extern int GlobalVerifyOrder;\n", + "\n" ] + + @cmock_generator_strict.create_extern_declarations(output) + + assert_equal(expected, output.flatten) + end + + should "create mock verify functions in source file when no functions specified" do + functions = [] + output = [] + expected = "void MockPoutPoutFish_Verify(void)\n{\n}\n\n" + + @cmock_generator.create_mock_verify_function(output, functions) + + assert_equal(expected, output.join) + end + + should "create mock verify functions in source file when extra functions specified" do + functions = [ { :name => "First", :args => "int Candy", :return => test_return[:int] }, + { :name => "Second", :args => "bool Smarty", :return => test_return[:string] } + ] + output = [] + expected = [ "void MockPoutPoutFish_Verify(void)\n{\n", + " UNITY_LINE_TYPE cmock_line = TEST_LINE_NUM;\n", + " Uno_First" + + " Dos_First" + + " Uno_Second" + + " Dos_Second", + "}\n\n" + ] + @plugins.expect.run(:mock_verify, functions[0]).returns([" Uno_First"," Dos_First"]) + @plugins.expect.run(:mock_verify, functions[1]).returns([" Uno_Second"," Dos_Second"]) + + @cmock_generator.ordered = true + @cmock_generator.create_mock_verify_function(output, functions) + + assert_equal(expected, output.flatten) + end + + should "create mock init functions in source file" do + output = [] + expected = [ "void MockPoutPoutFish_Init(void)\n{\n", + " MockPoutPoutFish_Destroy();\n", + "}\n\n" + ] + + @cmock_generator.create_mock_init_function(output) + + assert_equal(expected.join, output.join) + end + + should "create mock destroy functions in source file" do + functions = [] + output = [] + expected = [ "void MockPoutPoutFish_Destroy(void)\n{\n", + " CMock_Guts_MemFreeAll();\n", + " memset(&Mock, 0, sizeof(Mock));\n", + "}\n\n" + ] + + @cmock_generator.create_mock_destroy_function(output, functions) + + assert_equal(expected.join, output.join) + end + + should "create mock destroy functions in source file when specified with strict ordering" do + functions = [ { :name => "First", :args => "int Candy", :return => test_return[:int] }, + { :name => "Second", :args => "bool Smarty", :return => test_return[:string] } + ] + output = [] + expected = [ "void MockPoutPoutFish_Destroy(void)\n{\n", + " CMock_Guts_MemFreeAll();\n", + " memset(&Mock, 0, sizeof(Mock));\n", + " uno", + " GlobalExpectCount = 0;\n", + " GlobalVerifyOrder = 0;\n", + "}\n\n" + ] + @plugins.expect.run(:mock_destroy, functions[0]).returns([]) + @plugins.expect.run(:mock_destroy, functions[1]).returns([" uno"]) + + @cmock_generator_strict.create_mock_destroy_function(output, functions) + + assert_equal(expected.join, output.join) + end + + should "create mock implementation functions in source file" do + function = { :modifier => "static", + :return => test_return[:int], + :args_string => "uint32 sandwiches, const char* named", + :args => ["uint32 sandwiches", "const char* named"], + :var_arg => nil, + :name => "SupaFunction", + :attributes => "__inline" + } + output = [] + expected = [ "static int SupaFunction(uint32 sandwiches, const char* named)\n", + "{\n", + " UNITY_LINE_TYPE cmock_line = TEST_LINE_NUM;\n", + " CMOCK_SupaFunction_CALL_INSTANCE* cmock_call_instance = (CMOCK_SupaFunction_CALL_INSTANCE*)CMock_Guts_GetAddressFor(Mock.SupaFunction_CallInstance);\n", + " Mock.SupaFunction_CallInstance = CMock_Guts_MemNext(Mock.SupaFunction_CallInstance);\n", + " uno", + " UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, \"Function 'SupaFunction' called more times than expected.\");\n", + " cmock_line = cmock_call_instance->LineNumber;\n", + " dos", + " tres", + " return cmock_call_instance->ReturnVal;\n", + "}\n\n" + ] + @plugins.expect.run(:mock_implementation_precheck, function).returns([" uno"]) + @plugins.expect.run(:mock_implementation, function).returns([" dos"," tres"]) + + @cmock_generator.create_mock_implementation(output, function) + + assert_equal(expected.join, output.join) + end + + should "create mock implementation functions in source file with different options" do + function = { :modifier => "", + :return => test_return[:int], + :args_string => "uint32 sandwiches", + :args => ["uint32 sandwiches"], + :var_arg => "corn ...", + :name => "SupaFunction", + :attributes => nil + } + output = [] + expected = [ "int SupaFunction(uint32 sandwiches, corn ...)\n", + "{\n", + " UNITY_LINE_TYPE cmock_line = TEST_LINE_NUM;\n", + " CMOCK_SupaFunction_CALL_INSTANCE* cmock_call_instance = (CMOCK_SupaFunction_CALL_INSTANCE*)CMock_Guts_GetAddressFor(Mock.SupaFunction_CallInstance);\n", + " Mock.SupaFunction_CallInstance = CMock_Guts_MemNext(Mock.SupaFunction_CallInstance);\n", + " uno", + " UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, \"Function 'SupaFunction' called more times than expected.\");\n", + " cmock_line = cmock_call_instance->LineNumber;\n", + " dos", + " tres", + " return cmock_call_instance->ReturnVal;\n", + "}\n\n" + ] + @plugins.expect.run(:mock_implementation_precheck, function).returns([" uno"]) + @plugins.expect.run(:mock_implementation, function).returns([" dos"," tres"]) + + @cmock_generator.create_mock_implementation(output, function) + + assert_equal(expected.join, output.join) + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_array_test.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_array_test.rb new file mode 100644 index 0000000..959a8e0 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_array_test.rb @@ -0,0 +1,114 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require File.expand_path(File.dirname(__FILE__)) + "/../test_helper" +require 'cmock_generator_plugin_array' + +class CMockGeneratorPluginArrayTest < Test::Unit::TestCase + def setup + create_mocks :config, :utils + + #no strict ordering + @config.expect.when_ptr.returns(:compare_data) + @config.expect.enforce_strict_ordering.returns(false) + @config.stubs!(:respond_to?).returns(true) + @utils.expect.helpers.returns({}) + @cmock_generator_plugin_array = CMockGeneratorPluginArray.new(@config, @utils) + end + + def teardown + end + + should "have set up internal accessors correctly on init" do + assert_equal(@config, @cmock_generator_plugin_array.config) + assert_equal(@utils, @cmock_generator_plugin_array.utils) + assert_equal(nil, @cmock_generator_plugin_array.unity_helper) + assert_equal(8, @cmock_generator_plugin_array.priority) + end + + should "not include any additional include files" do + assert(!@cmock_generator_plugin_array.respond_to?(:include_files)) + end + + should "not add to typedef structure for functions of style 'int* func(void)'" do + function = {:name => "Oak", :args => [], :return => test_return[:int_ptr]} + returned = @cmock_generator_plugin_array.instance_typedefs(function) + assert_equal("", returned) + end + + should "add to tyepdef structure mock needs of functions of style 'void func(int chicken, int* pork)'" do + function = {:name => "Cedar", :args => [{ :name => "chicken", :type => "int", :ptr? => false}, { :name => "pork", :type => "int*", :ptr? => true}], :return => test_return[:void]} + expected = " int Expected_pork_Depth;\n" + returned = @cmock_generator_plugin_array.instance_typedefs(function) + assert_equal(expected, returned) + end + + should "not add an additional mock interface for functions not containing pointers" do + function = {:name => "Maple", :args_string => "int blah", :return => test_return[:string], :contains_ptr? => false} + returned = @cmock_generator_plugin_array.mock_function_declarations(function) + assert_nil(returned) + end + + should "add another mock function declaration for functions of style 'void func(int* tofu)'" do + function = {:name => "Pine", + :args => [{ :type => "int*", + :name => "tofu", + :ptr? => true, + }], + :return => test_return[:void], + :contains_ptr? => true } + + expected = "#define #{function[:name]}_ExpectWithArray(tofu, tofu_Depth) #{function[:name]}_CMockExpectWithArray(__LINE__, tofu, tofu_Depth)\n" + + "void #{function[:name]}_CMockExpectWithArray(UNITY_LINE_TYPE cmock_line, int* tofu, int tofu_Depth);\n" + returned = @cmock_generator_plugin_array.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "add another mock function declaration for functions of style 'const char* func(int* tofu)'" do + function = {:name => "Pine", + :args => [{ :type => "int*", + :name => "tofu", + :ptr? => true, + }], + :return => test_return[:string], + :contains_ptr? => true } + + expected = "#define #{function[:name]}_ExpectWithArrayAndReturn(tofu, tofu_Depth, cmock_retval) #{function[:name]}_CMockExpectWithArrayAndReturn(__LINE__, tofu, tofu_Depth, cmock_retval)\n" + + "void #{function[:name]}_CMockExpectWithArrayAndReturn(UNITY_LINE_TYPE cmock_line, int* tofu, int tofu_Depth, const char* cmock_to_return);\n" + returned = @cmock_generator_plugin_array.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "not have a mock function implementation" do + assert(!@cmock_generator_plugin_array.respond_to?(:mock_implementation)) + end + + should "not have a mock interfaces for functions of style 'int* func(void)'" do + function = {:name => "Pear", :args => [], :args_string => "void", :return => test_return[:int_ptr]} + returned = @cmock_generator_plugin_array.mock_interfaces(function) + assert_nil(returned) + end + + should "add mock interfaces for functions of style 'int* func(int* pescado, int pes)'" do + function = {:name => "Lemon", + :args => [{ :type => "int*", :name => "pescado", :ptr? => true}, { :type => "int", :name => "pes", :ptr? => false}], + :args_string => "int* pescado, int pes", + :return => test_return[:int_ptr], + :contains_ptr? => true } + @utils.expect.code_add_base_expectation("Lemon").returns("mock_retval_0") + + expected = ["void Lemon_CMockExpectWithArrayAndReturn(UNITY_LINE_TYPE cmock_line, int* pescado, int pescado_Depth, int pes, int* cmock_to_return)\n", + "{\n", + "mock_retval_0", + " CMockExpectParameters_Lemon(cmock_call_instance, pescado, pescado_Depth, pes);\n", + " cmock_call_instance->ReturnVal = cmock_to_return;\n", + "}\n\n" + ].join + returned = @cmock_generator_plugin_array.mock_interfaces(function).join + assert_equal(expected, returned) + end + +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_callback_test.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_callback_test.rb new file mode 100644 index 0000000..8542fc6 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_callback_test.rb @@ -0,0 +1,190 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require File.expand_path(File.dirname(__FILE__)) + "/../test_helper" +require 'cmock_generator_plugin_callback' + +class CMockGeneratorPluginCallbackTest < Test::Unit::TestCase + def setup + create_mocks :config, :utils + + @config.expect.callback_include_count.returns(true) + @config.expect.callback_after_arg_check.returns(false) + + @cmock_generator_plugin_callback = CMockGeneratorPluginCallback.new(@config, @utils) + end + + def teardown + end + + should "have set up internal accessors correctly on init" do + assert_equal(@config, @cmock_generator_plugin_callback.config) + assert_equal(@utils, @cmock_generator_plugin_callback.utils) + assert_equal(6, @cmock_generator_plugin_callback.priority) + end + + should "not include any additional include files" do + assert(!@cmock_generator_plugin_callback.respond_to?(:include_files)) + end + + should "add to instance structure" do + function = {:name => "Oak", :args => [:type => "int*", :name => "blah", :ptr? => true], :return => test_return[:int_ptr]} + expected = " CMOCK_Oak_CALLBACK Oak_CallbackFunctionPointer;\n" + + " int Oak_CallbackCalls;\n" + returned = @cmock_generator_plugin_callback.instance_structure(function) + assert_equal(expected, returned) + end + + should "add mock function declaration for function without arguments" do + function = {:name => "Maple", :args_string => "void", :args => [], :return => test_return[:void]} + expected = [ "typedef void (* CMOCK_Maple_CALLBACK)(int cmock_num_calls);\n", + "void Maple_StubWithCallback(CMOCK_Maple_CALLBACK Callback);\n" ].join + returned = @cmock_generator_plugin_callback.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "add mock function declaration for function without arguments when count is also turned off" do + function = {:name => "Maple", :args_string => "void", :args => [], :return => test_return[:void]} + expected = [ "typedef void (* CMOCK_Maple_CALLBACK)(void);\n", + "void Maple_StubWithCallback(CMOCK_Maple_CALLBACK Callback);\n" ].join + @cmock_generator_plugin_callback.include_count = false + returned = @cmock_generator_plugin_callback.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "add mock function declaration for function with arguments" do + function = {:name => "Maple", :args_string => "int* tofu", :args => [1], :return => test_return[:void]} + expected = [ "typedef void (* CMOCK_Maple_CALLBACK)(int* tofu, int cmock_num_calls);\n", + "void Maple_StubWithCallback(CMOCK_Maple_CALLBACK Callback);\n" ].join + returned = @cmock_generator_plugin_callback.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "add mock function declaration for function with return values" do + function = {:name => "Maple", :args_string => "int* tofu", :args => [1], :return => test_return[:string]} + expected = [ "typedef const char* (* CMOCK_Maple_CALLBACK)(int* tofu, int cmock_num_calls);\n", + "void Maple_StubWithCallback(CMOCK_Maple_CALLBACK Callback);\n" ].join + returned = @cmock_generator_plugin_callback.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "add mock function declaration for function with return values and count is turned off" do + function = {:name => "Maple", :args_string => "int* tofu", :args => [1], :return => test_return[:string]} + expected = [ "typedef const char* (* CMOCK_Maple_CALLBACK)(int* tofu);\n", + "void Maple_StubWithCallback(CMOCK_Maple_CALLBACK Callback);\n" ].join + @cmock_generator_plugin_callback.include_count = false + returned = @cmock_generator_plugin_callback.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "add mock function implementation for functions of style 'void func(void)'" do + function = {:name => "Apple", :args => [], :args_string => "void", :return => test_return[:void]} + expected = [" if (Mock.Apple_CallbackFunctionPointer != NULL)\n", + " {\n", + " Mock.Apple_CallbackFunctionPointer(Mock.Apple_CallbackCalls++);\n", + " return;\n", + " }\n" + ].join + returned = @cmock_generator_plugin_callback.mock_implementation_precheck(function) + assert_equal(expected, returned) + end + + should "add mock function implementation for functions of style 'void func(void)' when count turned off" do + function = {:name => "Apple", :args => [], :args_string => "void", :return => test_return[:void]} + expected = [" if (Mock.Apple_CallbackFunctionPointer != NULL)\n", + " {\n", + " Mock.Apple_CallbackFunctionPointer();\n", + " return;\n", + " }\n" + ].join + @cmock_generator_plugin_callback.include_count = false + returned = @cmock_generator_plugin_callback.mock_implementation_precheck(function) + assert_equal(expected, returned) + end + + should "add mock function implementation for functions of style 'int func(void)'" do + function = {:name => "Apple", :args => [], :args_string => "void", :return => test_return[:int]} + expected = [" if (Mock.Apple_CallbackFunctionPointer != NULL)\n", + " {\n", + " return Mock.Apple_CallbackFunctionPointer(Mock.Apple_CallbackCalls++);\n", + " }\n" + ].join + returned = @cmock_generator_plugin_callback.mock_implementation_precheck(function) + assert_equal(expected, returned) + end + + should "add mock function implementation for functions of style 'void func(int* steak, uint8_t flag)'" do + function = {:name => "Apple", + :args => [ { :type => 'int*', :name => 'steak', :ptr? => true}, + { :type => 'uint8_t', :name => 'flag', :ptr? => false} ], + :args_string => "int* steak, uint8_t flag", + :return=> test_return[:void]} + expected = [" if (Mock.Apple_CallbackFunctionPointer != NULL)\n", + " {\n", + " Mock.Apple_CallbackFunctionPointer(steak, flag, Mock.Apple_CallbackCalls++);\n", + " return;\n", + " }\n" + ].join + returned = @cmock_generator_plugin_callback.mock_implementation_precheck(function) + assert_equal(expected, returned) + end + + should "add mock function implementation for functions of style 'void func(int* steak, uint8_t flag)' when count turned off" do + function = {:name => "Apple", + :args => [ { :type => 'int*', :name => 'steak', :ptr? => true}, + { :type => 'uint8_t', :name => 'flag', :ptr? => false} ], + :args_string => "int* steak, uint8_t flag", + :return=> test_return[:void]} + expected = [" if (Mock.Apple_CallbackFunctionPointer != NULL)\n", + " {\n", + " Mock.Apple_CallbackFunctionPointer(steak, flag);\n", + " return;\n", + " }\n" + ].join + @cmock_generator_plugin_callback.include_count = false + returned = @cmock_generator_plugin_callback.mock_implementation_precheck(function) + assert_equal(expected, returned) + end + + should "add mock function implementation for functions of style 'int16_t func(int* steak, uint8_t flag)'" do + function = {:name => "Apple", + :args => [ { :type => 'int*', :name => 'steak', :ptr? => true}, + { :type => 'uint8_t', :name => 'flag', :ptr? => false} ], + :args_string => "int* steak, uint8_t flag", + :return => test_return[:int]} + expected = [" if (Mock.Apple_CallbackFunctionPointer != NULL)\n", + " {\n", + " return Mock.Apple_CallbackFunctionPointer(steak, flag, Mock.Apple_CallbackCalls++);\n", + " }\n" + ].join + returned = @cmock_generator_plugin_callback.mock_implementation_precheck(function) + assert_equal(expected, returned) + end + + should "add mock interfaces for functions " do + function = {:name => "Lemon", + :args => [{ :type => "char*", :name => "pescado"}], + :args_string => "char* pescado", + :return => test_return[:int] + } + + expected = ["void Lemon_StubWithCallback(CMOCK_Lemon_CALLBACK Callback)\n", + "{\n", + " Mock.Lemon_CallbackFunctionPointer = Callback;\n", + "}\n\n" + ].join + returned = @cmock_generator_plugin_callback.mock_interfaces(function) + assert_equal(expected, returned) + end + + should "add mock destroy for functions" do + function = {:name => "Peach", :args => [], :return => test_return[:void] } + expected = " Mock.Peach_CallbackFunctionPointer = NULL;\n" + + " Mock.Peach_CallbackCalls = 0;\n" + returned = @cmock_generator_plugin_callback.mock_destroy(function) + assert_equal(expected, returned) + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_cexception_test.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_cexception_test.rb new file mode 100644 index 0000000..ac64f30 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_cexception_test.rb @@ -0,0 +1,94 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require File.expand_path(File.dirname(__FILE__)) + "/../test_helper" +require 'cmock_generator_plugin_cexception' + +class CMockGeneratorPluginCexceptionTest < Test::Unit::TestCase + def setup + create_mocks :config, :utils + @cmock_generator_plugin_cexception = CMockGeneratorPluginCexception.new(@config, @utils) + end + + def teardown + end + + should "have set up internal accessors correctly on init" do + assert_equal(@config, @cmock_generator_plugin_cexception.config) + assert_equal(@utils, @cmock_generator_plugin_cexception.utils) + assert_equal(7, @cmock_generator_plugin_cexception.priority) + end + + should "include the cexception library" do + expected = "#include \"CException.h\"\n" + returned = @cmock_generator_plugin_cexception.include_files + assert_equal(expected, returned) + end + + should "add to typedef structure mock needs" do + function = { :name => "Oak", :args => [], :return => test_return[:void] } + expected = " CEXCEPTION_T ExceptionToThrow;\n" + returned = @cmock_generator_plugin_cexception.instance_typedefs(function) + assert_equal(expected, returned) + end + + should "add mock function declarations for functions without arguments" do + function = { :name => "Spruce", :args_string => "void", :return => test_return[:void] } + expected = "#define Spruce_ExpectAndThrow(cmock_to_throw) Spruce_CMockExpectAndThrow(__LINE__, cmock_to_throw)\n"+ + "void Spruce_CMockExpectAndThrow(UNITY_LINE_TYPE cmock_line, CEXCEPTION_T cmock_to_throw);\n" + returned = @cmock_generator_plugin_cexception.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "add mock function declarations for functions with arguments" do + function = { :name => "Spruce", :args_string => "const char* Petunia, uint32_t Lily", :args_call => "Petunia, Lily", :return => test_return[:void] } + expected = "#define Spruce_ExpectAndThrow(Petunia, Lily, cmock_to_throw) Spruce_CMockExpectAndThrow(__LINE__, Petunia, Lily, cmock_to_throw)\n" + + "void Spruce_CMockExpectAndThrow(UNITY_LINE_TYPE cmock_line, const char* Petunia, uint32_t Lily, CEXCEPTION_T cmock_to_throw);\n" + returned = @cmock_generator_plugin_cexception.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "add a mock implementation" do + function = {:name => "Cherry", :args => [], :return => test_return[:void]} + expected = " if (cmock_call_instance->ExceptionToThrow != CEXCEPTION_NONE)\n {\n" + + " Throw(cmock_call_instance->ExceptionToThrow);\n }\n" + returned = @cmock_generator_plugin_cexception.mock_implementation(function) + assert_equal(expected, returned) + end + + should "add mock interfaces for functions without arguments" do + function = {:name => "Pear", :args_string => "void", :args => [], :return => test_return[:void]} + @utils.expect.code_add_base_expectation("Pear").returns("mock_retval_0") + @utils.expect.code_call_argument_loader(function).returns("") + + expected = ["void Pear_CMockExpectAndThrow(UNITY_LINE_TYPE cmock_line, CEXCEPTION_T cmock_to_throw)\n", + "{\n", + "mock_retval_0", + "", + " cmock_call_instance->ExceptionToThrow = cmock_to_throw;\n", + "}\n\n" + ].join + returned = @cmock_generator_plugin_cexception.mock_interfaces(function) + assert_equal(expected, returned) + end + + should "add a mock interfaces for functions with arguments" do + function = {:name => "Pear", :args_string => "int blah", :args => [{ :type => "int", :name => "blah" }], :return => test_return[:void]} + @utils.expect.code_add_base_expectation("Pear").returns("mock_retval_0") + @utils.expect.code_call_argument_loader(function).returns("mock_return_1") + + expected = ["void Pear_CMockExpectAndThrow(UNITY_LINE_TYPE cmock_line, int blah, CEXCEPTION_T cmock_to_throw)\n", + "{\n", + "mock_retval_0", + "mock_return_1", + " cmock_call_instance->ExceptionToThrow = cmock_to_throw;\n", + "}\n\n" + ].join + returned = @cmock_generator_plugin_cexception.mock_interfaces(function) + assert_equal(expected, returned) + end + +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_expect_test.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_expect_test.rb new file mode 100644 index 0000000..fa85936 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_expect_test.rb @@ -0,0 +1,206 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require File.expand_path(File.dirname(__FILE__)) + "/../test_helper" +require 'cmock_generator_plugin_expect' + +class CMockGeneratorPluginExpectTest < Test::Unit::TestCase + def setup + create_mocks :config, :utils + + #no strict ordering and args_and_calls + @config.expect.when_ptr.returns(:compare_data) + @config.expect.enforce_strict_ordering.returns(false) + @config.stubs!(:respond_to?).returns(true) + # @config.expect.ignore.returns(:args_and_calls) + @utils.expect.helpers.returns({}) + @cmock_generator_plugin_expect = CMockGeneratorPluginExpect.new(@config, @utils) + + #strict ordering and args_only + @config.expect.when_ptr.returns(:compare_data) + @config.expect.enforce_strict_ordering.returns(true) + @config.stubs!(:respond_to?).returns(true) + # @config.expect.ignore.returns(:args_only) + @utils.expect.helpers.returns({}) + @cmock_generator_plugin_expect_strict = CMockGeneratorPluginExpect.new(@config, @utils) + end + + def teardown + end + + should "have set up internal accessors correctly on init" do + assert_equal(@config, @cmock_generator_plugin_expect.config) + assert_equal(@utils, @cmock_generator_plugin_expect.utils) + assert_equal(nil, @cmock_generator_plugin_expect.unity_helper) + assert_equal(5, @cmock_generator_plugin_expect.priority) + end + + should "not include any additional include files" do + assert(!@cmock_generator_plugin_expect.respond_to?(:include_files)) + end + + should "add to typedef structure mock needs of functions of style 'void func(void)'" do + function = {:name => "Oak", :args => [], :return => test_return[:void]} + expected = "" + returned = @cmock_generator_plugin_expect.instance_typedefs(function) + assert_equal(expected, returned) + end + + should "add to typedef structure mock needs of functions of style 'int func(void)'" do + function = {:name => "Elm", :args => [], :return => test_return[:int]} + expected = " int ReturnVal;\n" + returned = @cmock_generator_plugin_expect.instance_typedefs(function) + assert_equal(expected, returned) + end + + should "add to typedef structure mock needs of functions of style 'void func(int chicken, char* pork)'" do + function = {:name => "Cedar", :args => [{ :name => "chicken", :type => "int"}, { :name => "pork", :type => "char*"}], :return => test_return[:void]} + expected = " int Expected_chicken;\n char* Expected_pork;\n" + returned = @cmock_generator_plugin_expect.instance_typedefs(function) + assert_equal(expected, returned) + end + + should "add to typedef structure mock needs of functions of style 'int func(float beef)'" do + function = {:name => "Birch", :args => [{ :name => "beef", :type => "float"}], :return => test_return[:int]} + expected = " int ReturnVal;\n float Expected_beef;\n" + returned = @cmock_generator_plugin_expect.instance_typedefs(function) + assert_equal(expected, returned) + end + + should "add to typedef structure mock needs of functions of style 'void func(void)' and global ordering" do + function = {:name => "Oak", :args => [], :return => test_return[:void]} + expected = " int CallOrder;\n" + returned = @cmock_generator_plugin_expect_strict.instance_typedefs(function) + assert_equal(expected, returned) + end + + should "add mock function declaration for functions of style 'void func(void)'" do + function = {:name => "Maple", :args => [], :return => test_return[:void]} + expected = "#define Maple_Expect() Maple_CMockExpect(__LINE__)\n" + + "void Maple_CMockExpect(UNITY_LINE_TYPE cmock_line);\n" + returned = @cmock_generator_plugin_expect.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "add mock function declaration for functions of style 'int func(void)'" do + function = {:name => "Spruce", :args => [], :return => test_return[:int]} + expected = "#define Spruce_ExpectAndReturn(cmock_retval) Spruce_CMockExpectAndReturn(__LINE__, cmock_retval)\n" + + "void Spruce_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, int cmock_to_return);\n" + returned = @cmock_generator_plugin_expect.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "add mock function declaration for functions of style 'const char* func(int tofu)'" do + function = {:name => "Pine", :args => ["int tofu"], :args_string => "int tofu", :args_call => 'tofu', :return => test_return[:string]} + expected = "#define Pine_ExpectAndReturn(tofu, cmock_retval) Pine_CMockExpectAndReturn(__LINE__, tofu, cmock_retval)\n" + + "void Pine_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, int tofu, const char* cmock_to_return);\n" + returned = @cmock_generator_plugin_expect.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "add mock function implementation for functions of style 'void func(void)'" do + function = {:name => "Apple", :args => [], :return => test_return[:void]} + expected = "" + returned = @cmock_generator_plugin_expect.mock_implementation(function) + assert_equal(expected, returned) + end + + should "add mock function implementation for functions of style 'int func(int veal, unsigned int sushi)'" do + function = {:name => "Cherry", :args => [ { :type => "int", :name => "veal" }, { :type => "unsigned int", :name => "sushi" } ], :return => test_return[:int]} + + @utils.expect.code_verify_an_arg_expectation(function, function[:args][0]).returns(" mocked_retval_1") + @utils.expect.code_verify_an_arg_expectation(function, function[:args][1]).returns(" mocked_retval_2") + expected = " mocked_retval_1 mocked_retval_2" + returned = @cmock_generator_plugin_expect.mock_implementation(function) + assert_equal(expected, returned) + end + + should "add mock function implementation using ordering if needed" do + function = {:name => "Apple", :args => [], :return => test_return[:void]} + expected = "" + @cmock_generator_plugin_expect.ordered = true + returned = @cmock_generator_plugin_expect.mock_implementation(function) + assert_equal(expected, returned) + end + + should "add mock function implementation for functions of style 'void func(int worm)' and strict ordering" do + function = {:name => "Apple", :args => [{ :type => "int", :name => "worm" }], :return => test_return[:void]} + @utils.expect.code_verify_an_arg_expectation(function, function[:args][0]).returns("mocked_retval_0") + expected = "mocked_retval_0" + @cmock_generator_plugin_expect.ordered = true + returned = @cmock_generator_plugin_expect_strict.mock_implementation(function) + assert_equal(expected, returned) + end + + should "add mock interfaces for functions of style 'void func(void)'" do + function = {:name => "Pear", :args => [], :args_string => "void", :return => test_return[:void]} + @utils.expect.code_add_base_expectation("Pear").returns("mock_retval_0 ") + @utils.expect.code_call_argument_loader(function).returns("mock_retval_1 ") + expected = ["void Pear_CMockExpect(UNITY_LINE_TYPE cmock_line)\n", + "{\n", + "mock_retval_0 ", + "mock_retval_1 ", + "}\n\n" + ].join + returned = @cmock_generator_plugin_expect.mock_interfaces(function) + assert_equal(expected, returned) + end + + should "add mock interfaces for functions of style 'int func(void)'" do + function = {:name => "Orange", :args => [], :args_string => "void", :return => test_return[:int]} + @utils.expect.code_add_base_expectation("Orange").returns("mock_retval_0 ") + @utils.expect.code_call_argument_loader(function).returns("mock_retval_1 ") + @utils.expect.code_assign_argument_quickly("cmock_call_instance->ReturnVal", function[:return]).returns("mock_retval_2") + expected = ["void Orange_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, int cmock_to_return)\n", + "{\n", + "mock_retval_0 ", + "mock_retval_1 ", + "mock_retval_2", + "}\n\n" + ].join + returned = @cmock_generator_plugin_expect.mock_interfaces(function) + assert_equal(expected, returned) + end + + should "add mock interfaces for functions of style 'int func(char* pescado)'" do + function = {:name => "Lemon", :args => [{ :type => "char*", :name => "pescado"}], :args_string => "char* pescado", :return => test_return[:int]} + @utils.expect.code_add_base_expectation("Lemon").returns("mock_retval_0 ") + @utils.expect.code_call_argument_loader(function).returns("mock_retval_1 ") + @utils.expect.code_assign_argument_quickly("cmock_call_instance->ReturnVal", function[:return]).returns("mock_retval_2") + expected = ["void Lemon_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, char* pescado, int cmock_to_return)\n", + "{\n", + "mock_retval_0 ", + "mock_retval_1 ", + "mock_retval_2", + "}\n\n" + ].join + returned = @cmock_generator_plugin_expect.mock_interfaces(function) + assert_equal(expected, returned) + end + + should "add mock interfaces for functions when using ordering" do + function = {:name => "Pear", :args => [], :args_string => "void", :return => test_return[:void]} + @utils.expect.code_add_base_expectation("Pear").returns("mock_retval_0 ") + @utils.expect.code_call_argument_loader(function).returns("mock_retval_1 ") + expected = ["void Pear_CMockExpect(UNITY_LINE_TYPE cmock_line)\n", + "{\n", + "mock_retval_0 ", + "mock_retval_1 ", + "}\n\n" + ].join + @cmock_generator_plugin_expect.ordered = true + returned = @cmock_generator_plugin_expect.mock_interfaces(function) + assert_equal(expected, returned) + end + + should "add mock verify lines" do + function = {:name => "Banana" } + expected = " UNITY_TEST_ASSERT(CMOCK_GUTS_NONE == Mock.Banana_CallInstance, cmock_line, \"Function 'Banana' called less times than expected.\");\n" + returned = @cmock_generator_plugin_expect.mock_verify(function) + assert_equal(expected, returned) + end + +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_ignore_test.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_ignore_test.rb new file mode 100644 index 0000000..15f72cc --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/unit/cmock_generator_plugin_ignore_test.rb @@ -0,0 +1,159 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require File.expand_path(File.dirname(__FILE__)) + "/../test_helper" +require 'cmock_generator_plugin_ignore' + +class CMockGeneratorPluginIgnoreTest < Test::Unit::TestCase + def setup + create_mocks :config, :utils + @config.expect.ignore.returns(:args_and_calls) + @config.stubs!(:respond_to?).returns(true) + @cmock_generator_plugin_ignore = CMockGeneratorPluginIgnore.new(@config, @utils) + + @config.expect.ignore.returns(:args_only) + @cmock_generator_plugin_ignore_just_args = CMockGeneratorPluginIgnore.new(@config, @utils) + end + + def teardown + end + + should "have set up internal accessors correctly on init" do + assert_equal(@config, @cmock_generator_plugin_ignore.config) + assert_equal(@utils, @cmock_generator_plugin_ignore.utils) + assert_equal(2, @cmock_generator_plugin_ignore.priority) + end + + should "not have any additional include file requirements" do + assert(!@cmock_generator_plugin_ignore.respond_to?(:include_files)) + end + + should "add a required variable to the instance structure" do + function = {:name => "Grass", :args => [], :return => test_return[:void]} + expected = " int Grass_IgnoreBool;\n" + returned = @cmock_generator_plugin_ignore.instance_structure(function) + assert_equal(expected, returned) + end + + should "handle function declarations for functions without return values" do + function = {:name => "Mold", :args_string => "void", :return => test_return[:void]} + expected = "#define Mold_Ignore() Mold_CMockIgnore(__LINE__)\nvoid Mold_CMockIgnore(UNITY_LINE_TYPE cmock_line);\n" + returned = @cmock_generator_plugin_ignore.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "handle function declarations for functions that returns something" do + function = {:name => "Fungus", :args_string => "void", :return => test_return[:string]} + expected = "#define Fungus_IgnoreAndReturn(cmock_retval) Fungus_CMockIgnoreAndReturn(__LINE__, cmock_retval)\n"+ + "void Fungus_CMockIgnoreAndReturn(UNITY_LINE_TYPE cmock_line, const char* cmock_to_return);\n" + returned = @cmock_generator_plugin_ignore.mock_function_declarations(function) + assert_equal(expected, returned) + end + + should "add required code to implementation precheck with void function (when :args_and_calls)" do + function = {:name => "Mold", :args_string => "void", :return => test_return[:void]} + expected = [" if (Mock.Mold_IgnoreBool)\n", + " {\n", + " return;\n", + " }\n" + ].join + returned = @cmock_generator_plugin_ignore.mock_implementation_for_ignores(function) + assert_equal(expected, returned) + end + + should "add required code to implementation precheck with return functions (when :args_and_calls)" do + function = {:name => "Fungus", :args_string => "void", :return => test_return[:int]} + retval = test_return[:int].merge({ :name => "cmock_call_instance->ReturnVal"}) + @utils.expect.code_assign_argument_quickly("Mock.Fungus_FinalReturn", retval).returns(' mock_retval_0') + expected = [" if (Mock.Fungus_IgnoreBool)\n", + " {\n", + " if (cmock_call_instance == NULL)\n", + " return Mock.Fungus_FinalReturn;\n", + " mock_retval_0", + " return cmock_call_instance->ReturnVal;\n", + " }\n" + ].join + returned = @cmock_generator_plugin_ignore.mock_implementation_for_ignores(function) + assert_equal(expected, returned) + end + + should "not add code to implementation prefix (when :args_only)" do + function = {:name => "Fungus", :args_string => "void", :return => test_return[:int]} + retval = test_return[:int].merge({ :name => "cmock_call_instance->ReturnVal"}) + expected = "" + returned = @cmock_generator_plugin_ignore.mock_implementation_precheck(function) + assert_equal(expected, returned) + end + + should "add required code to implementation with void function (when :args_only)" do + function = {:name => "Mold", :args_string => "void", :return => test_return[:void]} + expected = [" if (Mock.Mold_IgnoreBool)\n", + " {\n", + " return;\n", + " }\n" + ].join + returned = @cmock_generator_plugin_ignore_just_args.mock_implementation(function) + assert_equal(expected, returned) + end + + should "add required code to implementation with return functions (when :args_only)" do + function = {:name => "Fungus", :args_string => "void", :return => test_return[:int]} + retval = test_return[:int].merge({ :name => "cmock_call_instance->ReturnVal"}) + @utils.expect.code_assign_argument_quickly("Mock.Fungus_FinalReturn", retval).returns(' mock_retval_0') + expected = [" if (Mock.Fungus_IgnoreBool)\n", + " {\n", + " if (cmock_call_instance == NULL)\n", + " return Mock.Fungus_FinalReturn;\n", + " mock_retval_0", + " return cmock_call_instance->ReturnVal;\n", + " }\n" + ].join + returned = @cmock_generator_plugin_ignore_just_args.mock_implementation(function) + assert_equal(expected, returned) + end + + should "add a new mock interface for ignoring when function had no return value" do + function = {:name => "Slime", :args => [], :args_string => "void", :return => test_return[:void]} + expected = ["void Slime_CMockIgnore(UNITY_LINE_TYPE cmock_line)\n", + "{\n", + " Mock.Slime_IgnoreBool = (int)1;\n", + "}\n\n" + ].join + @config.expect.ignore.returns(:args_and_calls) + returned = @cmock_generator_plugin_ignore.mock_interfaces(function) + assert_equal(expected, returned) + end + + should "add a new mock interface for ignoring when function had no return value and we are checking args only" do + function = {:name => "Slime", :args => [], :args_string => "void", :return => test_return[:void]} + expected = ["void Slime_CMockIgnore(UNITY_LINE_TYPE cmock_line)\n", + "{\n", + "mock_return_1", + " Mock.Slime_IgnoreBool = (int)1;\n", + "}\n\n" + ].join + @config.expect.ignore.returns(:args_only) + @utils.expect.code_add_base_expectation("Slime", true).returns("mock_return_1") + returned = @cmock_generator_plugin_ignore.mock_interfaces(function) + assert_equal(expected, returned) + end + + should "add a new mock interface for ignoring when function has return value" do + function = {:name => "Slime", :args => [], :args_string => "void", :return => test_return[:int]} + @config.expect.ignore.returns(:args_and_calls) + @utils.expect.code_add_base_expectation("Slime", false).returns("mock_return_1") + expected = ["void Slime_CMockIgnoreAndReturn(UNITY_LINE_TYPE cmock_line, int cmock_to_return)\n", + "{\n", + "mock_return_1", + " cmock_call_instance->ReturnVal = cmock_to_return;\n", + " Mock.Slime_IgnoreBool = (int)1;\n", + "}\n\n" + ].join + returned = @cmock_generator_plugin_ignore.mock_interfaces(function) + assert_equal(expected, returned) + end + +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/test/unit/cmock_generator_utils_test.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/unit/cmock_generator_utils_test.rb new file mode 100644 index 0000000..7b24fe3 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/unit/cmock_generator_utils_test.rb @@ -0,0 +1,291 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require File.expand_path(File.dirname(__FILE__)) + "/../test_helper" +require 'cmock_generator_utils' + +class CMockGeneratorUtilsTest < Test::Unit::TestCase + def setup + create_mocks :config, :unity_helper, :unity_helper + + @config.expect.when_ptr.returns(:compare_ptr) + @config.expect.enforce_strict_ordering.returns(false) + @config.expect.plugins.returns([]) + @config.expect.plugins.returns([]) + @config.expect.treat_as.returns(['int','short','long','char','char*']) + @cmock_generator_utils_simple = CMockGeneratorUtils.new(@config, {:unity_helper => @unity_helper}) + + @config.expect.when_ptr.returns(:smart) + @config.expect.enforce_strict_ordering.returns(true) + @config.expect.plugins.returns([:array, :cexception]) + @config.expect.plugins.returns([:array, :cexception]) + @config.expect.treat_as.returns(['int','short','long','char','uint32_t','char*']) + @cmock_generator_utils_complex = CMockGeneratorUtils.new(@config, {:unity_helper => @unity_helper, :A=>1, :B=>2}) + end + + def teardown + end + + should "have set up internal accessors correctly on init" do + assert_equal(@config, @cmock_generator_utils_simple.config) + assert_equal({:unity_helper => @unity_helper}, @cmock_generator_utils_simple.helpers) + assert_equal(false, @cmock_generator_utils_simple.arrays) + assert_equal(false, @cmock_generator_utils_simple.cexception) + end + + should "have set up internal accessors correctly on init, complete with passed helpers" do + assert_equal(@config, @cmock_generator_utils_complex.config) + assert_equal({:unity_helper => @unity_helper, :A=>1, :B=>2},@cmock_generator_utils_complex.helpers) + assert_equal(true, @cmock_generator_utils_complex.arrays) + assert_equal(true, @cmock_generator_utils_complex.cexception) + end + + should "add code for a base expectation with no plugins" do + expected = + " CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_Apple_CALL_INSTANCE));\n" + + " CMOCK_Apple_CALL_INSTANCE* cmock_call_instance = (CMOCK_Apple_CALL_INSTANCE*)CMock_Guts_GetAddressFor(cmock_guts_index);\n" + + " UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, \"CMock has run out of memory. Please allocate more.\");\n" + + " Mock.Apple_CallInstance = CMock_Guts_MemChain(Mock.Apple_CallInstance, cmock_guts_index);\n" + + " cmock_call_instance->LineNumber = cmock_line;\n" + output = @cmock_generator_utils_simple.code_add_base_expectation("Apple") + assert_equal(expected, output) + end + + should "add code for a base expectation with all plugins" do + expected = + " CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_Apple_CALL_INSTANCE));\n" + + " CMOCK_Apple_CALL_INSTANCE* cmock_call_instance = (CMOCK_Apple_CALL_INSTANCE*)CMock_Guts_GetAddressFor(cmock_guts_index);\n" + + " UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, \"CMock has run out of memory. Please allocate more.\");\n" + + " Mock.Apple_CallInstance = CMock_Guts_MemChain(Mock.Apple_CallInstance, cmock_guts_index);\n" + + " cmock_call_instance->LineNumber = cmock_line;\n" + + " cmock_call_instance->CallOrder = ++GlobalExpectCount;\n" + + " cmock_call_instance->ExceptionToThrow = CEXCEPTION_NONE;\n" + output = @cmock_generator_utils_complex.code_add_base_expectation("Apple", true) + assert_equal(expected, output) + end + + should "add code for a base expectation with all plugins and ordering not supported" do + expected = + " CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_Apple_CALL_INSTANCE));\n" + + " CMOCK_Apple_CALL_INSTANCE* cmock_call_instance = (CMOCK_Apple_CALL_INSTANCE*)CMock_Guts_GetAddressFor(cmock_guts_index);\n" + + " UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, \"CMock has run out of memory. Please allocate more.\");\n" + + " Mock.Apple_CallInstance = CMock_Guts_MemChain(Mock.Apple_CallInstance, cmock_guts_index);\n" + + " cmock_call_instance->LineNumber = cmock_line;\n" + + " cmock_call_instance->ExceptionToThrow = CEXCEPTION_NONE;\n" + output = @cmock_generator_utils_complex.code_add_base_expectation("Apple", false) + assert_equal(expected, output) + end + + should "add argument expectations for values when no array plugin" do + arg1 = { :name => "Orange", :const? => false, :type => 'int', :ptr? => false } + expected1 = " cmock_call_instance->Expected_Orange = Orange;\n" + + arg2 = { :name => "Lemon", :const? => true, :type => 'const char*', :ptr? => true } + expected2 = " cmock_call_instance->Expected_Lemon = (const char*)Lemon;\n" + + arg3 = { :name => "Kiwi", :const? => false, :type => 'KIWI_T*', :ptr? => true } + expected3 = " cmock_call_instance->Expected_Kiwi = Kiwi;\n" + + arg4 = { :name => "Lime", :const? => false, :type => 'LIME_T', :ptr? => false } + expected4 = " memcpy(&cmock_call_instance->Expected_Lime, &Lime, sizeof(LIME_T));\n" + + assert_equal(expected1, @cmock_generator_utils_simple.code_add_an_arg_expectation(arg1)) + assert_equal(expected2, @cmock_generator_utils_simple.code_add_an_arg_expectation(arg2)) + assert_equal(expected3, @cmock_generator_utils_simple.code_add_an_arg_expectation(arg3)) + assert_equal(expected4, @cmock_generator_utils_simple.code_add_an_arg_expectation(arg4)) + end + + should "add argument expectations for values when array plugin enabled" do + arg1 = { :name => "Orange", :const? => false, :type => 'int', :ptr? => false } + expected1 = " cmock_call_instance->Expected_Orange = Orange;\n" + + arg2 = { :name => "Lemon", :const? => true, :type => 'const char*', :ptr? => true } + expected2 = " cmock_call_instance->Expected_Lemon = (const char*)Lemon;\n" + + " cmock_call_instance->Expected_Lemon_Depth = Lemon_Depth;\n" + + arg3 = { :name => "Kiwi", :const? => false, :type => 'KIWI_T*', :ptr? => true } + expected3 = " cmock_call_instance->Expected_Kiwi = Kiwi;\n" + + " cmock_call_instance->Expected_Kiwi_Depth = Kiwi_Depth;\n" + + arg4 = { :name => "Lime", :const? => false, :type => 'LIME_T', :ptr? => false } + expected4 = " memcpy(&cmock_call_instance->Expected_Lime, &Lime, sizeof(LIME_T));\n" + + assert_equal(expected1, @cmock_generator_utils_complex.code_add_an_arg_expectation(arg1)) + assert_equal(expected2, @cmock_generator_utils_complex.code_add_an_arg_expectation(arg2, 'Lemon_Depth')) + assert_equal(expected3, @cmock_generator_utils_complex.code_add_an_arg_expectation(arg3, 'Lemon_Depth')) + assert_equal(expected4, @cmock_generator_utils_complex.code_add_an_arg_expectation(arg4)) + end + + should 'not have an argument loader when the function has no arguments' do + function = { :name => "Melon", :args_string => "void" } + + assert_equal("", @cmock_generator_utils_complex.code_add_argument_loader(function)) + end + + should 'create an argument loader when the function has arguments' do + function = { :name => "Melon", + :args_string => "stuff", + :args => [test_arg[:int_ptr], test_arg[:mytype], test_arg[:string]] + } + expected = "void CMockExpectParameters_Melon(CMOCK_Melon_CALL_INSTANCE* cmock_call_instance, stuff)\n{\n" + + " cmock_call_instance->Expected_MyIntPtr = MyIntPtr;\n" + + " memcpy(&cmock_call_instance->Expected_MyMyType, &MyMyType, sizeof(MY_TYPE));\n" + + " cmock_call_instance->Expected_MyStr = (char*)MyStr;\n" + + "}\n\n" + assert_equal(expected, @cmock_generator_utils_simple.code_add_argument_loader(function)) + end + + should 'create an argument loader when the function has arguments supporting arrays' do + function = { :name => "Melon", + :args_string => "stuff", + :args => [test_arg[:int_ptr], test_arg[:mytype], test_arg[:string]] + } + expected = "void CMockExpectParameters_Melon(CMOCK_Melon_CALL_INSTANCE* cmock_call_instance, int* MyIntPtr, int MyIntPtr_Depth, const MY_TYPE MyMyType, const char* MyStr)\n{\n" + + " cmock_call_instance->Expected_MyIntPtr = MyIntPtr;\n" + + " cmock_call_instance->Expected_MyIntPtr_Depth = MyIntPtr_Depth;\n" + + " memcpy(&cmock_call_instance->Expected_MyMyType, &MyMyType, sizeof(MY_TYPE));\n" + + " cmock_call_instance->Expected_MyStr = (char*)MyStr;\n" + + "}\n\n" + assert_equal(expected, @cmock_generator_utils_complex.code_add_argument_loader(function)) + end + + should "not call argument loader if there are no arguments to actually use for this function" do + function = { :name => "Pineapple", :args_string => "void" } + + assert_equal("", @cmock_generator_utils_complex.code_call_argument_loader(function)) + end + + should 'call an argument loader when the function has arguments' do + function = { :name => "Pineapple", + :args_string => "stuff", + :args => [test_arg[:int_ptr], test_arg[:mytype], test_arg[:string]] + } + expected = " CMockExpectParameters_Pineapple(cmock_call_instance, MyIntPtr, MyMyType, MyStr);\n" + assert_equal(expected, @cmock_generator_utils_simple.code_call_argument_loader(function)) + end + + should 'call an argument loader when the function has arguments with arrays' do + function = { :name => "Pineapple", + :args_string => "stuff", + :args => [test_arg[:int_ptr], test_arg[:mytype], test_arg[:string]] + } + expected = " CMockExpectParameters_Pineapple(cmock_call_instance, MyIntPtr, 1, MyMyType, MyStr);\n" + assert_equal(expected, @cmock_generator_utils_complex.code_call_argument_loader(function)) + end + + should 'handle a simple assert when requested' do + function = { :name => 'Pear' } + arg = test_arg[:int] + expected = " UNITY_TEST_ASSERT_EQUAL_INT(cmock_call_instance->Expected_MyInt, MyInt, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyInt'.\");\n" + @unity_helper.expect.get_helper('int').returns(['UNITY_TEST_ASSERT_EQUAL_INT','']) + assert_equal(expected, @cmock_generator_utils_simple.code_verify_an_arg_expectation(function, arg)) + end + + should 'handle a pointer comparison when configured to do so' do + function = { :name => 'Pear' } + arg = test_arg[:int_ptr] + expected = " UNITY_TEST_ASSERT_EQUAL_PTR(cmock_call_instance->Expected_MyIntPtr, MyIntPtr, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyIntPtr'.\");\n" + assert_equal(expected, @cmock_generator_utils_simple.code_verify_an_arg_expectation(function, arg)) + end + + should 'handle const char as string compares ' do + function = { :name => 'Pear' } + arg = test_arg[:string] + expected = " UNITY_TEST_ASSERT_EQUAL_STRING(cmock_call_instance->Expected_MyStr, MyStr, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyStr'.\");\n" + @unity_helper.expect.get_helper('char*').returns(['UNITY_TEST_ASSERT_EQUAL_STRING','']) + assert_equal(expected, @cmock_generator_utils_simple.code_verify_an_arg_expectation(function, arg)) + end + + should 'handle custom types as memory compares when we have no better way to do it' do + function = { :name => 'Pear' } + arg = test_arg[:mytype] + expected = " UNITY_TEST_ASSERT_EQUAL_MEMORY((void*)(&cmock_call_instance->Expected_MyMyType), (void*)(&MyMyType), sizeof(MY_TYPE), cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyMyType'.\");\n" + @unity_helper.expect.get_helper('MY_TYPE').returns(['UNITY_TEST_ASSERT_EQUAL_MEMORY','&']) + assert_equal(expected, @cmock_generator_utils_simple.code_verify_an_arg_expectation(function, arg)) + end + + should 'handle custom types with custom handlers when available, even if they do not support the extra message' do + function = { :name => 'Pear' } + arg = test_arg[:mytype] + expected = " UNITY_TEST_ASSERT_EQUAL_MY_TYPE(cmock_call_instance->Expected_MyMyType, MyMyType, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyMyType'.\");\n" + @unity_helper.expect.get_helper('MY_TYPE').returns(['UNITY_TEST_ASSERT_EQUAL_MY_TYPE','']) + assert_equal(expected, @cmock_generator_utils_simple.code_verify_an_arg_expectation(function, arg)) + end + + should 'handle pointers to custom types with array handlers, even if the array extension is turned off' do + function = { :name => 'Pear' } + arg = test_arg[:mytype] + expected = " UNITY_TEST_ASSERT_EQUAL_MY_TYPE_ARRAY(&cmock_call_instance->Expected_MyMyType, &MyMyType, 1, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyMyType'.\");\n" + @unity_helper.expect.get_helper('MY_TYPE').returns(['UNITY_TEST_ASSERT_EQUAL_MY_TYPE_ARRAY','&']) + assert_equal(expected, @cmock_generator_utils_simple.code_verify_an_arg_expectation(function, arg)) + end + + should 'handle a simple assert when requested with array plugin enabled' do + function = { :name => 'Pear' } + arg = test_arg[:int] + expected = " UNITY_TEST_ASSERT_EQUAL_INT(cmock_call_instance->Expected_MyInt, MyInt, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyInt'.\");\n" + @unity_helper.expect.get_helper('int').returns(['UNITY_TEST_ASSERT_EQUAL_INT','']) + assert_equal(expected, @cmock_generator_utils_complex.code_verify_an_arg_expectation(function, arg)) + end + + should 'handle an array comparison with array plugin enabled' do + function = { :name => 'Pear' } + arg = test_arg[:int_ptr] + expected = " if (cmock_call_instance->Expected_MyIntPtr == NULL)\n" + + " { UNITY_TEST_ASSERT_NULL(MyIntPtr, cmock_line, \"Expected NULL. Function 'Pear' called with unexpected value for argument 'MyIntPtr'.\"); }\n" + + " else if (cmock_call_instance->Expected_MyIntPtr_Depth == 0)\n" + + " { UNITY_TEST_ASSERT_EQUAL_PTR(cmock_call_instance->Expected_MyIntPtr, MyIntPtr, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyIntPtr'.\"); }\n" + + " else\n" + + " { UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(cmock_call_instance->Expected_MyIntPtr, MyIntPtr, cmock_call_instance->Expected_MyIntPtr_Depth, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyIntPtr'.\"); }\n" + @unity_helper.expect.get_helper('int*').returns(['UNITY_TEST_ASSERT_EQUAL_INT_ARRAY','']) + assert_equal(expected, @cmock_generator_utils_complex.code_verify_an_arg_expectation(function, arg)) + end + + should 'handle const char as string compares with array plugin enabled' do + function = { :name => 'Pear' } + arg = test_arg[:string] + expected = " UNITY_TEST_ASSERT_EQUAL_STRING(cmock_call_instance->Expected_MyStr, MyStr, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyStr'.\");\n" + @unity_helper.expect.get_helper('char*').returns(['UNITY_TEST_ASSERT_EQUAL_STRING','']) + assert_equal(expected, @cmock_generator_utils_complex.code_verify_an_arg_expectation(function, arg)) + end + + should 'handle custom types as memory compares when we have no better way to do it with array plugin enabled' do + function = { :name => 'Pear' } + arg = test_arg[:mytype] + expected = " UNITY_TEST_ASSERT_EQUAL_MEMORY((void*)(&cmock_call_instance->Expected_MyMyType), (void*)(&MyMyType), sizeof(MY_TYPE), cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyMyType'.\");\n" + @unity_helper.expect.get_helper('MY_TYPE').returns(['UNITY_TEST_ASSERT_EQUAL_MEMORY','&']) + assert_equal(expected, @cmock_generator_utils_complex.code_verify_an_arg_expectation(function, arg)) + end + + should 'handle custom types with custom handlers when available, even if they do not support the extra message with array plugin enabled' do + function = { :name => 'Pear' } + arg = test_arg[:mytype] + expected = " UNITY_TEST_ASSERT_EQUAL_MY_TYPE(cmock_call_instance->Expected_MyMyType, MyMyType, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyMyType'.\");\n" + @unity_helper.expect.get_helper('MY_TYPE').returns(['UNITY_TEST_ASSERT_EQUAL_MY_TYPE','']) + assert_equal(expected, @cmock_generator_utils_complex.code_verify_an_arg_expectation(function, arg)) + end + + should 'handle custom types with array handlers when array plugin is enabled' do + function = { :name => 'Pear' } + arg = test_arg[:mytype_ptr] + expected = " if (cmock_call_instance->Expected_MyMyTypePtr == NULL)\n" + + " { UNITY_TEST_ASSERT_NULL(MyMyTypePtr, cmock_line, \"Expected NULL. Function 'Pear' called with unexpected value for argument 'MyMyTypePtr'.\"); }\n" + + " else if (cmock_call_instance->Expected_MyMyTypePtr_Depth == 0)\n" + + " { UNITY_TEST_ASSERT_EQUAL_PTR(cmock_call_instance->Expected_MyMyTypePtr, MyMyTypePtr, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyMyTypePtr'.\"); }\n" + + " else\n" + + " { UNITY_TEST_ASSERT_EQUAL_MY_TYPE_ARRAY(cmock_call_instance->Expected_MyMyTypePtr, MyMyTypePtr, cmock_call_instance->Expected_MyMyTypePtr_Depth, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyMyTypePtr'.\"); }\n" + @unity_helper.expect.get_helper('MY_TYPE*').returns(['UNITY_TEST_ASSERT_EQUAL_MY_TYPE_ARRAY','']) + assert_equal(expected, @cmock_generator_utils_complex.code_verify_an_arg_expectation(function, arg)) + end + + should 'handle custom types with array handlers when array plugin is enabled for non-array types' do + function = { :name => 'Pear' } + arg = test_arg[:mytype] + expected = " UNITY_TEST_ASSERT_EQUAL_MY_TYPE_ARRAY(&cmock_call_instance->Expected_MyMyType, &MyMyType, 1, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyMyType'.\");\n" + @unity_helper.expect.get_helper('MY_TYPE').returns(['UNITY_TEST_ASSERT_EQUAL_MY_TYPE_ARRAY','&']) + assert_equal(expected, @cmock_generator_utils_complex.code_verify_an_arg_expectation(function, arg)) + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/test/unit/cmock_header_parser_test.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/unit/cmock_header_parser_test.rb new file mode 100644 index 0000000..6517abd --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/unit/cmock_header_parser_test.rb @@ -0,0 +1,1170 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +$ThisIsOnlyATest = true + +require File.expand_path(File.dirname(__FILE__)) + "/../test_helper" +require 'cmock_header_parser' + +class CMockHeaderParserTest < Test::Unit::TestCase + + def setup + create_mocks :config + @test_name = 'test_file.h' + @config.expect.strippables.returns(['(?:__attribute__\s*\(+.*?\)+)']) + @config.expect.attributes.returns(['__ramfunc', 'funky_attrib']) + @config.expect.treat_as_void.returns(['MY_FUNKY_VOID']) + @config.expect.treat_as.returns({ "BANJOS" => "INT", "TUBAS" => "HEX16"} ) + @config.expect.when_no_prototypes.returns(:error) + @config.expect.verbosity.returns(1) + @config.expect.treat_externs.returns(:exclude) + + @parser = CMockHeaderParser.new(@config) + end + + def teardown + end + + should "create and initialize variables to defaults appropriately" do + assert_equal([], @parser.funcs) + assert_equal(['const', '__ramfunc', 'funky_attrib'], @parser.c_attributes) + assert_equal(['void','MY_FUNKY_VOID'], @parser.treat_as_void) + end + + should "strip out line comments" do + source = + " abcd;\n" + + "// hello;\n" + + "who // is you\n" + + expected = + [ + "abcd", + "who" + ] + + assert_equal(expected, @parser.import_source(source).map!{|s|s.strip}) + end + + + should "remove block comments" do + source = + " no_comments;\n" + + "// basic_line_comment;\n" + + "/* basic_block_comment;*/\n" + + "pre_block; /* start_of_block_comment;\n" + + "// embedded_line_comment_in_block_comment; */\n" + + "// /* commented_out_block_comment_line\n" + + "shown_because_block_comment_invalid_from_line_comment;\n" + + "// */\n" + + "//* shorter_commented_out_block_comment_line; \n" + + "shown_because_block_comment_invalid_from_shorter_line_comment;\n" + + "/*/\n" + + "not_shown_because_line_above_started_comment;\n" + + "//*/\n" + + "/* \n" + + "not_shown_because_block_comment_started_this_time;\n" + + "/*/\n" + + "shown_because_line_above_ended_comment_this_time;\n" + + "//*/\n" + + expected = + [ + "no_comments", + "pre_block", + "shown_because_block_comment_invalid_from_line_comment", + "shown_because_block_comment_invalid_from_shorter_line_comment", + "shown_because_line_above_ended_comment_this_time" + ] + + assert_equal(expected, @parser.import_source(source).map!{|s|s.strip}) + end + + + should "remove preprocessor directives" do + source = + "#when stuff_happens\n" + + "#ifdef _TEST\n" + + "#pragma stack_switch" + + expected = [] + + assert_equal(expected, @parser.import_source(source)) + end + + + should "remove assembler pragma sections" do + source = + " #pragma\tasm\n" + + " .foo\n" + + " lda %m\n" + + " nop\n" + + "# pragma endasm \n" + + "foo" + + expected = ["foo"] + + assert_equal(expected, @parser.import_source(source)) + end + + + should "smush lines together that contain continuation characters" do + source = + "hoo hah \\\n" + + "when \\ \n" + + expected = + [ + "hoo hah when" + ] + + assert_equal(expected, @parser.import_source(source).map!{|s|s.strip}) + end + + + should "remove C macro definitions" do + source = + "#define this is the first line\\\n" + + "and the second\\\n" + + "and the third that should be removed\n" + + "but I'm here\n" + + expected = ["but I'm here"] + + assert_equal(expected, @parser.import_source(source)) + end + + + should "remove typedef statements" do + source = + "typedef uint32 (unsigned int);\n" + + "const typedef int INT;\n" + + "int notatypedef;\n" + + "int typedef_isnt_me;\n" + + " typedef who cares what really comes here \\\n" + # exercise multiline typedef + " continuation;\n" + + "this should remain!;\n" + + "typedef blah bleh;\n" + + "typedef struct shell_command_struct {\n" + + " char_ptr COMMAND;\n" + + " int_32 (*SHELL_FUNC)(int_32 argc);\n" + + "} SHELL_COMMAND_STRUCT, * SHELL_COMMAND_PTR;\n" + + "typedef struct shell_command_struct {\n" + + " char_ptr COMMAND;\n" + + " int_32 (*SHELL_FUNC)(int_32 argc, char_ptr argv[]);\n" + + "} SHELL_COMMAND_STRUCT, * SHELL_COMMAND_PTR;\n" + + "typedef struct shell_command_struct {\n" + + " char_ptr COMMAND;\n" + + " int_32 (*SHELL_FUNC)(int_32 argc);\n" + + "};\n" + + expected = + [ + "int notatypedef", + "int typedef_isnt_me", + "this should remain!" + ] + + assert_equal(expected, @parser.import_source(source).map!{|s|s.strip}) + end + + + should "remove enum statements" do + source = + "enum _NamedEnum {\n" + + " THING1 = (0x0001),\n" + + " THING2 = (0x0001 << 5),\n" + + "}ListOValues;\n\n" + + "don't delete me!!\n" + + " modifier_str enum _NamedEnum {THING1 = (0x0001), THING2 = (0x0001 << 5)} ListOValues;\n\n" + + "typedef enum {\n" + + " THING1,\n" + + " THING2,\n" + + "} Thinger;\n" + + "or me!!\n" + + assert_equal(["don't delete me!! or me!!"], @parser.import_source(source).map!{|s|s.strip}) + end + + + should "remove union statements" do + source = + "union _NamedDoohicky {\n" + + " unsigned int a;\n" + + " char b;\n" + + "} Doohicky;\n\n" + + "I want to live!!\n" + + "some_modifier union { unsigned int a; char b;} Whatever;\n" + + "typedef union {\n" + + " unsigned int a;\n" + + " char b;\n" + + "} Whatever;\n" + + "me too!!\n" + + assert_equal(["I want to live!! me too!!"], @parser.import_source(source).map!{|s|s.strip}) + end + + + should "remove struct statements" do + source = + "struct _NamedStruct1 {\n" + + " unsigned int a;\n" + + " signed long int b;\n" + + "} Thing ;\n\n" + + "extern struct ForwardDeclared_t TestDataType1;\n" + + "void foo(void);\n" + + "struct\n"+ + " MultilineForwardDeclared_t\n" + + " TestDataType2;\n" + + "struct THINGER foo(void);\n" + + "typedef struct {\n" + + " unsigned int a;\n" + + " signed char b;\n" + + "}Thinger;\n" + + "I want to live!!\n" + + assert_equal(["void foo(void)", "struct THINGER foo(void)", "I want to live!!"], + @parser.import_source(source).map!{|s|s.strip}) + end + + should "remove externed and inline functions" do + source = + " extern uint32 foobar(unsigned int);\n" + + "uint32 extern_name_func(unsigned int);\n" + + "uint32 funcinline(unsigned int);\n" + + "extern void bar(unsigned int);\n" + + "inline void bar(unsigned int);\n" + + "extern\n" + + "void kinda_ugly_on_the_next_line(unsigned int);\n" + + expected = + [ + "uint32 extern_name_func(unsigned int)", + "uint32 funcinline(unsigned int)" + ] + + assert_equal(expected, @parser.import_source(source).map!{|s|s.strip}) + end + + should "remove a fully defined inline function" do + source = + "inline void foo(unsigned int a) { oranges = a; }\n" + + "inline void bar(unsigned int a) { apples = a; };\n" + + "inline void bar(unsigned int a)\n" + + "{" + + " bananas = a;\n" + + "}" + + # ensure it's expected type of exception + assert_raise RuntimeError do + @parser.parse("module", source) + end + + assert_equal([], @parser.funcs) + + # verify exception message + begin + @parser.parse("module", source) + rescue RuntimeError => e + assert_equal("ERROR: No function prototypes found!", e.message) + end + end + + should "remove just inline functions if externs to be included" do + source = + " extern uint32 foobar(unsigned int);\n" + + "uint32 extern_name_func(unsigned int);\n" + + "uint32 funcinline(unsigned int);\n" + + "extern void bar(unsigned int);\n" + + "inline void bar(unsigned int);\n" + + "extern\n" + + "void kinda_ugly_on_the_next_line(unsigned int);\n" + + expected = + [ "extern uint32 foobar(unsigned int)", + "uint32 extern_name_func(unsigned int)", + "uint32 funcinline(unsigned int)", + "extern void bar(unsigned int)", + "extern void kinda_ugly_on_the_next_line(unsigned int)" + ] + + @parser.treat_externs = :include + assert_equal(expected, @parser.import_source(source).map!{|s|s.strip}) + end + + + should "remove defines" do + source = + "#define whatever you feel like defining\n" + + "void hello(void);\n" + + "#DEFINE I JUST DON'T CARE\n" + + "#deFINE\n" + + "#define get_foo() \\\n ((Thing)foo.bar)" # exercise multiline define + + expected = + [ + "void hello(void)", + ] + + assert_equal(expected, @parser.import_source(source).map!{|s|s.strip}) + end + + + should "remove keywords that would keep things from going smoothly in the future" do + source = + "const int TheMatrix(register int Trinity, unsigned int *restrict Neo)" + + expected = + [ + "const int TheMatrix(int Trinity, unsigned int * Neo)", + ] + + assert_equal(expected, @parser.import_source(source).map!{|s|s.strip}) + end + + + # some code actually typedef's void even though it's not ANSI C and is, frankly, weird + # since cmock treats void specially, we can't let void be obfuscated + should "handle odd case of typedef'd void returned" do + source = "MY_FUNKY_VOID FunkyVoidReturned(int a)" + expected = { :var_arg=>nil, + :name=>"FunkyVoidReturned", + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :modifier=>"", + :contains_ptr? => false, + :args=>[{:type=>"int", :name=>"a", :ptr? => false, :const? => false}], + :args_string=>"int a", + :args_call=>"a"} + assert_equal(expected, @parser.parse_declaration(source)) + end + + should "handle odd case of typedef'd void as arg" do + source = "int FunkyVoidAsArg(MY_FUNKY_VOID)" + expected = { :var_arg=>nil, + :name=>"FunkyVoidAsArg", + :return=>{ :type => "int", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "int cmock_to_return", + :void? => false + }, + :modifier=>"", + :contains_ptr? => false, + :args=>[], + :args_string=>"void", + :args_call=>"" } + assert_equal(expected, @parser.parse_declaration(source)) + end + + should "handle odd case of typedef'd void as arg pointer" do + source = "char FunkyVoidPointer(MY_FUNKY_VOID* bluh)" + expected = { :var_arg=>nil, + :name=>"FunkyVoidPointer", + :return=>{ :type => "char", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "char cmock_to_return", + :void? => false + }, + :modifier=>"", + :contains_ptr? => true, + :args=>[{:type=>"MY_FUNKY_VOID*", :name=>"bluh", :ptr? => true, :const? => false}], + :args_string=>"MY_FUNKY_VOID* bluh", + :args_call=>"bluh" } + assert_equal(expected, @parser.parse_declaration(source)) + end + + + should "strip default values from function parameter lists" do + source = + "void Foo(int a = 57, float b=37.52, char c= 'd', char* e=\"junk\");\n" + + expected = + [ + "void Foo(int a, float b, char c, char* e)" + ] + + assert_equal(expected, @parser.import_source(source).map!{|s|s.strip}) + end + + + should "raise upon empty file" do + source = '' + + # ensure it's expected type of exception + assert_raise RuntimeError do + @parser.parse("module", "") + end + + assert_equal([], @parser.funcs) + + # verify exception message + begin + @parser.parse("module", "") + rescue RuntimeError => e + assert_equal("ERROR: No function prototypes found!", e.message) + end + end + + + should "raise upon no function prototypes found in file" do + source = + "typedef void SILLY_VOID_TYPE1;\n" + + "typedef (void) SILLY_VOID_TYPE2 ;\n" + + "typedef ( void ) (*FUNCPTR)(void);\n\n" + + "#define get_foo() \\\n ((Thing)foo.bar)" + + # ensure it's expected type of exception + assert_raise(RuntimeError) do + @parser.parse("module", source) + end + + assert_equal([], @parser.funcs) + + # verify exception message + begin + @parser.parse("module", source) + rescue RuntimeError => e + assert_equal("ERROR: No function prototypes found!", e.message) + end + end + + + should "raise upon prototype parsing failure" do + source = "void (int, )" + + # ensure it's expected type of exception + assert_raise(RuntimeError) do + @parser.parse("module", source) + end + + # verify exception message + begin + @parser.parse("module", source) + rescue RuntimeError => e + assert(e.message.include?("Failed Parsing Declaration Prototype!")) + end + end + + should "extract and return function declarations with retval and args" do + + source = "int Foo(int a, unsigned int b)" + expected = { :var_arg=>nil, + :name=>"Foo", + :return=>{ :type => "int", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "int cmock_to_return", + :void? => false + }, + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"int", :name=>"a", :ptr? => false, :const? => false}, + {:type=>"unsigned int", :name=>"b", :ptr? => false, :const? => false} + ], + :args_string=>"int a, unsigned int b", + :args_call=>"a, b" } + assert_equal(expected, @parser.parse_declaration(source)) + end + + should "extract and return function declarations with no retval" do + + source = "void FunkyChicken( uint la, int de, bool da)" + expected = { :var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"FunkyChicken", + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"uint", :name=>"la", :ptr? => false, :const? => false}, + {:type=>"int", :name=>"de", :ptr? => false, :const? => false}, + {:type=>"bool", :name=>"da", :ptr? => false, :const? => false} + ], + :args_string=>"uint la, int de, bool da", + :args_call=>"la, de, da" } + assert_equal(expected, @parser.parse_declaration(source)) + end + + should "extract and return function declarations with implied voids" do + + source = "void tat()" + expected = { :var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"tat", + :modifier=>"", + :contains_ptr? => false, + :args=>[ ], + :args_string=>"void", + :args_call=>"" } + assert_equal(expected, @parser.parse_declaration(source)) + end + + should "extract modifiers properly" do + + source = "const int TheMatrix(int Trinity, unsigned int * Neo)" + expected = { :var_arg=>nil, + :return=>{ :type => "int", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "int cmock_to_return", + :void? => false + }, + :name=>"TheMatrix", + :modifier=>"const", + :contains_ptr? => true, + :args=>[ {:type=>"int", :name=>"Trinity", :ptr? => false, :const? => false}, + {:type=>"unsigned int*", :name=>"Neo", :ptr? => true, :const? => false} + ], + :args_string=>"int Trinity, unsigned int* Neo", + :args_call=>"Trinity, Neo" } + assert_equal(expected, @parser.parse_declaration(source)) + end + + should "fully parse multiple prototypes" do + + source = "const int TheMatrix(int Trinity, unsigned int * Neo);\n" + + "int Morpheus(int, unsigned int*);\n" + + expected = [{ :var_arg=>nil, + :return=> { :type => "int", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "int cmock_to_return", + :void? => false + }, + :name=>"TheMatrix", + :modifier=>"const", + :contains_ptr? => true, + :args=>[ {:type=>"int", :name=>"Trinity", :ptr? => false, :const? => false}, + {:type=>"unsigned int*", :name=>"Neo", :ptr? => true, :const? => false} + ], + :args_string=>"int Trinity, unsigned int* Neo", + :args_call=>"Trinity, Neo" }, + { :var_arg=>nil, + :return=> { :type => "int", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "int cmock_to_return", + :void? => false + }, + :name=>"Morpheus", + :modifier=>"", + :contains_ptr? => true, + :args=>[ {:type=>"int", :name=>"cmock_arg1", :ptr? => false, :const? => false}, + {:type=>"unsigned int*", :name=>"cmock_arg2", :ptr? => true, :const? => false} + ], + :args_string=>"int cmock_arg1, unsigned int* cmock_arg2", + :args_call=>"cmock_arg1, cmock_arg2" + }] + assert_equal(expected, @parser.parse("module", source)[:functions]) + end + + should "not extract for mocking multiply defined prototypes" do + + source = "const int TheMatrix(int Trinity, unsigned int * Neo);\n" + + "const int TheMatrix(int, unsigned int*);\n" + + expected = [{ :var_arg=>nil, + :name=>"TheMatrix", + :return=> { :type => "int", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "int cmock_to_return", + :void? => false + }, + :modifier=>"const", + :contains_ptr? => true, + :args=>[ {:type=>"int", :name=>"Trinity", :ptr? => false, :const? => false}, + {:type=>"unsigned int*", :name=>"Neo", :ptr? => true, :const? => false} + ], + :args_string=>"int Trinity, unsigned int* Neo", + :args_call=>"Trinity, Neo" + }] + assert_equal(expected, @parser.parse("module", source)[:functions]) + end + + should "properly detect typedef'd variants of void and use those" do + + source = "typedef (void) FUNKY_VOID_T;\n" + + "typedef void CHUNKY_VOID_T;\n" + + "FUNKY_VOID_T DrHorrible(int SingAlong);\n" + + "int CaptainHammer(CHUNKY_VOID_T);\n" + + expected = [{ :var_arg=>nil, + :name=>"DrHorrible", + :return => { :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"int", :name=>"SingAlong", :ptr? => false, :const? => false} ], + :args_string=>"int SingAlong", + :args_call=>"SingAlong" + }, + { :var_arg=>nil, + :return=> { :type => "int", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "int cmock_to_return", + :void? => false + }, + :name=>"CaptainHammer", + :modifier=>"", + :contains_ptr? => false, + :args=>[ ], + :args_string=>"void", + :args_call=>"" + }] + assert_equal(expected, @parser.parse("module", source)[:functions]) + end + + should "be ok with structs inside of function declarations" do + + source = "int DrHorrible(struct SingAlong Blog);\n" + + "void Penny(struct const _KeepYourHeadUp_ * const BillyBuddy);\n" + + "struct TheseArentTheHammer CaptainHammer(void);\n" + + expected = [{ :var_arg=>nil, + :return =>{ :type => "int", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "int cmock_to_return", + :void? => false + }, + :name=>"DrHorrible", + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"struct SingAlong", :name=>"Blog", :ptr? => false, :const? => false} ], + :args_string=>"struct SingAlong Blog", + :args_call=>"Blog" + }, + { :var_arg=>nil, + :return=> { :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"Penny", + :modifier=>"", + :contains_ptr? => true, + :args=>[ {:type=>"struct _KeepYourHeadUp_*", :name=>"BillyBuddy", :ptr? => true, :const? => true} ], + :args_string=>"struct const _KeepYourHeadUp_* const BillyBuddy", + :args_call=>"BillyBuddy" + }, + { :var_arg=>nil, + :return=> { :type => "struct TheseArentTheHammer", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "struct TheseArentTheHammer cmock_to_return", + :void? => false + }, + :name=>"CaptainHammer", + :modifier=>"", + :contains_ptr? => false, + :args=>[ ], + :args_string=>"void", + :args_call=>"" + }] + assert_equal(expected, @parser.parse("module", source)[:functions]) + end + + should "extract functions containing unions with union specifier" do + source = "void OrangePeel(union STARS_AND_STRIPES * a, union AFL_CIO b)" + expected = [{ :var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"OrangePeel", + :modifier=>"", + :contains_ptr? => true, + :args=>[ {:type=>"union STARS_AND_STRIPES*", :name=>"a", :ptr? => true, :const? => false}, + {:type=>"union AFL_CIO", :name=>"b", :ptr? => false, :const? => false} + ], + :args_string=>"union STARS_AND_STRIPES* a, union AFL_CIO b", + :args_call=>"a, b" }] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + end + + should "not be thwarted by variables named with primitive types as part of the name" do + source = "void ApplePeel(const unsigned int const_param, int int_param, int integer, char character, int* const constant)" + expected = [{ :var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"ApplePeel", + :modifier=>"", + :contains_ptr? => true, + :args=>[ {:type=> "unsigned int", :name=>"const_param", :ptr? => false, :const? => true}, + {:type=>"int", :name=>"int_param", :ptr? => false, :const? => false}, + {:type=>"int", :name=>"integer", :ptr? => false, :const? => false}, + {:type=>"char", :name=>"character", :ptr? => false, :const? => false}, + {:type=>"int*", :name=>"constant", :ptr? => true, :const? => true} + ], + :args_string=>"const unsigned int const_param, int int_param, int integer, char character, int* const constant", + :args_call=>"const_param, int_param, integer, character, constant" }] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + end + + should "not be thwarted by custom types named similarly to primitive types" do + source = "void LemonPeel(integer param, character thing, longint * junk, constant value, int32_t const number)" + expected = [{:var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"LemonPeel", + :modifier=>"", + :contains_ptr? => true, + :args=>[ {:type=>"integer", :name=>"param", :ptr? => false, :const? => false}, + {:type=>"character", :name=>"thing", :ptr? => false, :const? => false}, + {:type=>"longint*", :name=>"junk", :ptr? => true, :const? => false}, + {:type=>"constant", :name=>"value", :ptr? => false, :const? => false}, + {:type=>"int32_t", :name=>"number", :ptr? => false, :const? => true} + ], + :args_string=>"integer param, character thing, longint* junk, constant value, int32_t const number", + :args_call=>"param, thing, junk, value, number" }] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + end + + should "handle some of those chains of C name specifiers naturally" do + source = "void CoinOperated(signed char abc, const unsigned long int xyz_123, unsigned int const abc_123, long long arm_of_the_law)" + expected = [{:var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"CoinOperated", + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"signed char", :name=>"abc", :ptr? => false, :const? => false}, + {:type=>"unsigned long int", :name=>"xyz_123", :ptr? => false, :const? => true}, + {:type=>"unsigned int", :name=>"abc_123", :ptr? => false, :const? => true}, + {:type=>"long long", :name=>"arm_of_the_law", :ptr? => false, :const? => false} + ], + :args_string=>"signed char abc, const unsigned long int xyz_123, unsigned int const abc_123, long long arm_of_the_law", + :args_call=>"abc, xyz_123, abc_123, arm_of_the_law" }] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + end + + should "handle custom types of various formats" do + source = "void CardOperated(CUSTOM_TYPE abc, CUSTOM_TYPE* xyz_123, CUSTOM_TYPE const abcxyz, struct CUSTOM_TYPE const * const abc123)" + expected = [{:var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"CardOperated", + :modifier=>"", + :contains_ptr? => true, + :args=>[ {:type=>"CUSTOM_TYPE", :name=>"abc", :ptr? => false, :const? => false}, + {:type=>"CUSTOM_TYPE*", :name=>"xyz_123", :ptr? => true, :const? => false}, + {:type=>"CUSTOM_TYPE", :name=>"abcxyz", :ptr? => false, :const? => true}, + {:type=>"struct CUSTOM_TYPE const*", :name=>"abc123", :ptr? => true, :const? => true} + ], + :args_string=>"CUSTOM_TYPE abc, CUSTOM_TYPE* xyz_123, CUSTOM_TYPE const abcxyz, struct CUSTOM_TYPE const* const abc123", + :args_call=>"abc, xyz_123, abcxyz, abc123" }] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + end + + should "handle arrays and treat them as pointers" do + source = "void KeyOperated(CUSTOM_TYPE thing1[], int thing2 [ ], char thing3 [][2 ][ 3], int* thing4[4])" + expected = [{:var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"KeyOperated", + :modifier=>"", + :contains_ptr? => true, + :args=>[ {:type=>"CUSTOM_TYPE*", :name=>"thing1", :ptr? => true, :const? => false}, + {:type=>"int*", :name=>"thing2", :ptr? => true, :const? => false}, + {:type=>"char*", :name=>"thing3", :ptr? => false, :const? => false}, #THIS one will likely change in the future when we improve multidimensional array support + {:type=>"int**", :name=>"thing4", :ptr? => true, :const? => false} #THIS one will likely change in the future when we improve multidimensional array support + ], + :args_string=>"CUSTOM_TYPE* thing1, int* thing2, char* thing3, int** thing4", + :args_call=>"thing1, thing2, thing3, thing4" }] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + end + + should "give a reasonable guess when dealing with weird combinations of custom types and modifiers" do + source = "void Cheese(unsigned CUSTOM_TYPE abc, unsigned xyz, CUSTOM_TYPE1 CUSTOM_TYPE2 pdq)" + expected = [{:var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"Cheese", + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"unsigned CUSTOM_TYPE", :name=>"abc", :ptr? => false, :const? => false}, + {:type=>"unsigned", :name=>"xyz", :ptr? => false, :const? => false}, + {:type=>"CUSTOM_TYPE1 CUSTOM_TYPE2", :name=>"pdq", :ptr? => false, :const? => false} + ], + :args_string=>"unsigned CUSTOM_TYPE abc, unsigned xyz, CUSTOM_TYPE1 CUSTOM_TYPE2 pdq", + :args_call=>"abc, xyz, pdq" }] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + end + + should "extract functions containing a function pointer" do + source = "void FunkyTurkey(unsigned int (*func_ptr)(int, char))" + expected = [{ :var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"FunkyTurkey", + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"cmock_module_func_ptr1", :name=>"func_ptr", :ptr? => false, :const? => false} + ], + :args_string=>"cmock_module_func_ptr1 func_ptr", + :args_call=>"func_ptr" }] + typedefs = ["typedef unsigned int(*cmock_module_func_ptr1)(int, char);"] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + assert_equal(typedefs, result[:typedefs]) + end + + should "extract functions containing a function pointer with an implied void" do + source = "void FunkyTurkey(unsigned int (*func_ptr)())" + expected = [{ :var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"FunkyTurkey", + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"cmock_module_func_ptr1", :name=>"func_ptr", :ptr? => false, :const? => false} + ], + :args_string=>"cmock_module_func_ptr1 func_ptr", + :args_call=>"func_ptr" }] + typedefs = ["typedef unsigned int(*cmock_module_func_ptr1)();"] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + assert_equal(typedefs, result[:typedefs]) + end + + should "extract functions containing a constant function pointer and a pointer in the nested arg list" do + source = "void FunkyChicken(unsigned int (* const func_ptr)(unsigned long int * , char))" + expected = [{ :var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"FunkyChicken", + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"cmock_module_func_ptr1", :name=>"func_ptr", :ptr? => false, :const? => true} + ], + :args_string=>"cmock_module_func_ptr1 const func_ptr", + :args_call=>"func_ptr" }] + typedefs = ["typedef unsigned int(*cmock_module_func_ptr1)(unsigned long int* , char);"] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + assert_equal(typedefs, result[:typedefs]) + end + + # should "extract functions containing a function pointer taking a vararg" do + # source = "void FunkyParrot(unsigned int (*func_ptr)(int, char, ...))" + # expected = [{ :var_arg=>nil, + # :return=>{ :type => "void", + # :name => 'cmock_to_return', + # :ptr? => false, + # :const? => false, + # :str => "void cmock_to_return", + # :void? => true + # }, + # :name=>"FunkyParrot", + # :modifier=>"", + # :contains_ptr? => false, + # :args=>[ {:type=>"cmock_module_func_ptr1", :name=>"func_ptr", :ptr? => false, :const? => false} + # ], + # :args_string=>"cmock_module_func_ptr1 func_ptr", + # :args_call=>"func_ptr" }] + # typedefs = ["typedef unsigned int(*cmock_module_func_ptr1)(int, char, ...);"] + # result = @parser.parse("module", source) + # assert_equal(expected, result[:functions]) + # assert_equal(typedefs, result[:typedefs]) + # end + + should "extract functions containing a function pointer with extra parenthesis and two sets" do + source = "void FunkyBudgie(int (((* func_ptr1)(int, char))), void (*func_ptr2)(void))" + expected = [{ :var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"FunkyBudgie", + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"cmock_module_func_ptr1", :name=>"func_ptr1", :ptr? => false, :const? => false}, + {:type=>"cmock_module_func_ptr2", :name=>"func_ptr2", :ptr? => false, :const? => false} + ], + :args_string=>"cmock_module_func_ptr1 func_ptr1, cmock_module_func_ptr2 func_ptr2", + :args_call=>"func_ptr1, func_ptr2" }] + typedefs = ["typedef int(*cmock_module_func_ptr1)(int, char);", "typedef void(*cmock_module_func_ptr2)(void);"] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + assert_equal(typedefs, result[:typedefs]) + end + + should "extract functions containing an anonymous function pointer" do + source = "void FunkyFowl(unsigned int (* const)(int, char))" + expected = [{ :var_arg=>nil, + :return=>{ :type => "void", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "void cmock_to_return", + :void? => true + }, + :name=>"FunkyFowl", + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"cmock_module_func_ptr1", :name=>"cmock_arg1", :ptr? => false, :const? => true} + ], + :args_string=>"cmock_module_func_ptr1 const cmock_arg1", + :args_call=>"cmock_arg1" }] + typedefs = ["typedef unsigned int(*cmock_module_func_ptr1)(int, char);"] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + assert_equal(typedefs, result[:typedefs]) + end + + should "extract functions returning a function pointer" do + source = "unsigned short (*FunkyPidgeon( const char op_code ))( int, long int )" + expected = [{ :var_arg=>nil, + :return=>{ :type => "cmock_module_func_ptr1", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "cmock_module_func_ptr1 cmock_to_return", + :void? => false + }, + :name=>"FunkyPidgeon", + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"char", :name=>"op_code", :ptr? => false, :const? => true} + ], + :args_string=>"const char op_code", + :args_call=>"op_code" }] + typedefs = ["typedef unsigned short(*cmock_module_func_ptr1)( int, long int );"] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + assert_equal(typedefs, result[:typedefs]) + end + + should "extract functions returning a function pointer with implied void" do + source = "unsigned short (*FunkyTweetie())()" + expected = [{ :var_arg=>nil, + :return=>{ :type => "cmock_module_func_ptr1", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "cmock_module_func_ptr1 cmock_to_return", + :void? => false + }, + :name=>"FunkyTweetie", + :modifier=>"", + :contains_ptr? => false, + :args=>[], + :args_string=>"void", + :args_call=>"" }] + typedefs = ["typedef unsigned short(*cmock_module_func_ptr1)();"] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + assert_equal(typedefs, result[:typedefs]) + end + + should "extract functions returning a function pointer where everything is a void" do + source = "void (* FunkySeaGull(void))(void)" + expected = [{ :var_arg=>nil, + :return=>{ :type => "cmock_module_func_ptr1", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "cmock_module_func_ptr1 cmock_to_return", + :void? => false + }, + :name=>"FunkySeaGull", + :modifier=>"", + :contains_ptr? => false, + :args=>[], + :args_string=>"void", + :args_call=>"" }] + typedefs = ["typedef void(*cmock_module_func_ptr1)(void);"] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + assert_equal(typedefs, result[:typedefs]) + end + + should "extract functions returning a function pointer with some pointer nonsense" do + source = "unsigned int * (* FunkyMacaw(double* foo, THING *bar))(unsigned int)" + expected = [{ :var_arg=>nil, + :return=>{ :type => "cmock_module_func_ptr1", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "cmock_module_func_ptr1 cmock_to_return", + :void? => false + }, + :name=>"FunkyMacaw", + :modifier=>"", + :contains_ptr? => true, + :args=>[ {:type=>"double*", :name=>"foo", :ptr? => true, :const? => false}, + {:type=>"THING*", :name=>"bar", :ptr? => true, :const? => false} + ], + :args_string=>"double* foo, THING* bar", + :args_call=>"foo, bar" }] + typedefs = ["typedef unsigned int *(*cmock_module_func_ptr1)(unsigned int);"] + result = @parser.parse("module", source) + assert_equal(expected, result[:functions]) + assert_equal(typedefs, result[:typedefs]) + end + + should "extract functions with varargs" do + source = "int XFiles(int Scully, int Mulder, ...);\n" + expected = [{ :var_arg=>"...", + :return=> { :type => "int", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "int cmock_to_return", + :void? => false + }, + :name=>"XFiles", + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"int", :name=>"Scully", :ptr? => false, :const? => false}, + {:type=>"int", :name=>"Mulder", :ptr? => false, :const? => false} + ], + :args_string=>"int Scully, int Mulder", + :args_call=>"Scully, Mulder" + }] + assert_equal(expected, @parser.parse("module", source)[:functions]) + end + + should "extract functions with strippable confusing junk like gcc attributes" do + source = "int LaverneAndShirley(int Lenny, int Squiggy) __attribute__((weak)) __attribute__ ((deprecated));\n" + expected = [{ :var_arg=>nil, + :return=> { :type => "int", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "int cmock_to_return", + :void? => false + }, + :name=>"LaverneAndShirley", + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"int", :name=>"Lenny", :ptr? => false, :const? => false}, + {:type=>"int", :name=>"Squiggy", :ptr? => false, :const? => false} + ], + :args_string=>"int Lenny, int Squiggy", + :args_call=>"Lenny, Squiggy" + }] + assert_equal(expected, @parser.parse("module", source)[:functions]) + end + + should "extract functions with strippable confusing junk like gcc attributes with parenthesis" do + source = "int TheCosbyShow(int Cliff, int Claire) __attribute__((weak, alias (\"__f\"));\n" + expected = [{ :var_arg=>nil, + :return=> { :type => "int", + :name => 'cmock_to_return', + :ptr? => false, + :const? => false, + :str => "int cmock_to_return", + :void? => false + }, + :name=>"TheCosbyShow", + :modifier=>"", + :contains_ptr? => false, + :args=>[ {:type=>"int", :name=>"Cliff", :ptr? => false, :const? => false}, + {:type=>"int", :name=>"Claire", :ptr? => false, :const? => false} + ], + :args_string=>"int Cliff, int Claire", + :args_call=>"Cliff, Claire" + }] + assert_equal(expected, @parser.parse("module", source)[:functions]) + end + +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/test/unit/cmock_plugin_manager_test.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/unit/cmock_plugin_manager_test.rb new file mode 100644 index 0000000..88b4e6b --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/unit/cmock_plugin_manager_test.rb @@ -0,0 +1,85 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require File.expand_path(File.dirname(__FILE__)) + "/../test_helper" +require 'cmock_plugin_manager' + +class CMockPluginManagerTest < Test::Unit::TestCase + def setup + create_mocks :config, :utils, :pluginA, :pluginB + @config.stubs!(:respond_to?).returns(true) + @config.stubs!(:when_ptr).returns(:compare_data) + @config.stubs!(:enforce_strict_ordering).returns(false) + @config.stubs!(:ignore).returns(:args_and_calls) + end + + def teardown + end + + should "return all plugins by default" do + @config.expect.plugins.returns(['cexception','ignore']) + @utils.expect.helpers.returns({}) + + @cmock_plugins = CMockPluginManager.new(@config, @utils) + + test_plugins = @cmock_plugins.plugins + contained = { :expect => false, :ignore => false, :cexception => false } + test_plugins.each do |plugin| + contained[:expect] = true if plugin.instance_of?(CMockGeneratorPluginExpect) + contained[:ignore] = true if plugin.instance_of?(CMockGeneratorPluginIgnore) + contained[:cexception] = true if plugin.instance_of?(CMockGeneratorPluginCexception) + end + assert_equal(true, contained[:expect]) + assert_equal(true, contained[:ignore]) + assert_equal(true, contained[:cexception]) + end + + should "return restricted plugins based on config" do + @config.expect.plugins.returns([]) + @utils.expect.helpers.returns({}) + + @cmock_plugins = CMockPluginManager.new(@config, @utils) + + test_plugins = @cmock_plugins.plugins + contained = { :expect => false, :ignore => false, :cexception => false } + test_plugins.each do |plugin| + contained[:expect] = true if plugin.instance_of?(CMockGeneratorPluginExpect) + contained[:ignore] = true if plugin.instance_of?(CMockGeneratorPluginIgnore) + contained[:cexception] = true if plugin.instance_of?(CMockGeneratorPluginCexception) + end + assert_equal(true, contained[:expect]) + assert_equal(false,contained[:ignore]) + assert_equal(false,contained[:cexception]) + end + + should "run a desired method over each plugin requested and return the results" do + @config.expect.plugins.returns([]) + @utils.expect.helpers.returns({}) + @cmock_plugins = CMockPluginManager.new(@config, @utils) + + @cmock_plugins.plugins = [@pluginA, @pluginB] + @pluginA.stubs!(:test_method).returns(["This Is An Awesome Test-"]) + @pluginB.stubs!(:test_method).returns(["And This is Part 2-","Of An Awesome Test"]) + + expected = "This Is An Awesome Test-And This is Part 2-Of An Awesome Test" + output = @cmock_plugins.run(:test_method) + assert_equal(expected, output) + end + + should "run a desired method and arg list over each plugin requested and return the results" do + @config.expect.plugins.returns([]) + @utils.expect.helpers.returns({}) + @cmock_plugins = CMockPluginManager.new(@config, @utils) + + @cmock_plugins.plugins = [@pluginA, @pluginB] + @pluginA.stubs!(:test_method).returns(["This Is An Awesome Test-"]) + @pluginB.stubs!(:test_method).returns(["And This is Part 2-","Of An Awesome Test"]) + + expected = "This Is An Awesome Test-And This is Part 2-Of An Awesome Test" + output = @cmock_plugins.run(:test_method, "chickenpotpie") + assert_equal(expected, output) + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/test/unit/cmock_unityhelper_parser_test.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/unit/cmock_unityhelper_parser_test.rb new file mode 100644 index 0000000..3af5762 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/test/unit/cmock_unityhelper_parser_test.rb @@ -0,0 +1,223 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require File.expand_path(File.dirname(__FILE__)) + "/../test_helper" +require 'cmock_unityhelper_parser' + +class CMockUnityHelperParserTest < Test::Unit::TestCase + + def setup + create_mocks :config + end + + def teardown + end + + should "ignore lines that are commented out" do + source = + " abcd;\n" + + "// #define UNITY_TEST_ASSERT_EQUAL_CHICKENS(a,b,line,msg) {...};\n" + + "or maybe // #define UNITY_TEST_ASSERT_EQUAL_CHICKENS(a,b,line,msg) {...};\n\n" + @config.expects.plugins.returns([]) #not :array + @config.expects.treat_as.returns({}) + @config.expects.load_unity_helper.returns(source) + @parser = CMockUnityHelperParser.new(@config) + expected = {} + + assert_equal(expected, @parser.c_types) + end + + should "ignore stuff in block comments" do + source = + " abcd; /*\n" + + "#define UNITY_TEST_ASSERT_EQUAL_CHICKENS(a,b,line,msg) {...};\n" + + "#define UNITY_TEST_ASSERT_EQUAL_CHICKENS(a,b,line,msg) {...};\n */\n" + @config.expects.plugins.returns([]) #not :array + @config.expects.treat_as.returns({}) + @config.expect.load_unity_helper.returns(source) + @parser = CMockUnityHelperParser.new(@config) + expected = {} + + assert_equal(expected, @parser.c_types) + end + + should "notice equal helpers in the proper form and ignore others" do + source = + "abcd;\n" + + "#define UNITY_TEST_ASSERT_EQUAL_TURKEYS_T(a,b,line,msg) {...};\n" + + "abcd;\n" + + "#define UNITY_TEST_ASSERT_EQUAL_WRONG_NUM_ARGS(a,b,c,d,e) {...};\n" + + "#define UNITY_TEST_ASSERT_WRONG_NAME_EQUAL(a,b,c,d) {...};\n" + + "#define UNITY_TEST_ASSERT_EQUAL_unsigned_funky_rabbits(a,b,c,d) {...};\n" + + "abcd;\n" + @config.expects.plugins.returns([]) #not :array + @config.expects.treat_as.returns({}) + @config.expect.load_unity_helper.returns(source) + @parser = CMockUnityHelperParser.new(@config) + expected = { + 'TURKEYS_T' => "UNITY_TEST_ASSERT_EQUAL_TURKEYS_T", + 'unsigned_funky_rabbits' => "UNITY_TEST_ASSERT_EQUAL_unsigned_funky_rabbits" + } + + assert_equal(expected, @parser.c_types) + end + + should "notice equal helpers that contain arrays" do + source = + "abcd;\n" + + "#define UNITY_TEST_ASSERT_EQUAL_TURKEYS_ARRAY(a,b,c,d,e) {...};\n" + + "abcd;\n" + + "#define UNITY_TEST_ASSERT_EQUAL_WRONG_NUM_ARGS_ARRAY(a,b,c,d,e,f) {...};\n" + + "#define UNITY_TEST_ASSERT_WRONG_NAME_EQUAL_ARRAY(a,b,c,d,e) {...};\n" + + "#define UNITY_TEST_ASSERT_EQUAL_unsigned_funky_rabbits_ARRAY(a,b,c,d,e) {...};\n" + + "abcd;\n" + @config.expects.plugins.returns([]) #not :array + @config.expects.treat_as.returns({}) + @config.expect.load_unity_helper.returns(source) + @parser = CMockUnityHelperParser.new(@config) + expected = { + 'TURKEYS*' => "UNITY_TEST_ASSERT_EQUAL_TURKEYS_ARRAY", + 'unsigned_funky_rabbits*' => "UNITY_TEST_ASSERT_EQUAL_unsigned_funky_rabbits_ARRAY" + } + + assert_equal(expected, @parser.c_types) + end + + should "pull in the standard set of helpers and add them to my list" do + pairs = { + "UINT" => "HEX32", + "unsigned long" => "HEX64", + } + expected = { + "UINT" => "UNITY_TEST_ASSERT_EQUAL_HEX32", + "unsigned_long" => "UNITY_TEST_ASSERT_EQUAL_HEX64", + "UINT*" => "UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY", + "unsigned_long*"=> "UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY", + } + @config.expects.plugins.returns([]) #not :array + @config.expects.treat_as.returns(pairs) + @config.expect.load_unity_helper.returns(nil) + @parser = CMockUnityHelperParser.new(@config) + + assert_equal(expected, @parser.c_types) + end + + should "pull in the user specified set of helpers and add them to my list" do + pairs = { + "char*" => "STRING", + "unsigned int" => "HEX32", + } + expected = { + "char*" => "UNITY_TEST_ASSERT_EQUAL_STRING", + "unsigned_int" => "UNITY_TEST_ASSERT_EQUAL_HEX32", + "char**" => "UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY", + "unsigned_int*" => "UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY", + } + @config.expects.plugins.returns([]) #not :array + @config.expects.treat_as.returns(pairs) + @config.expect.load_unity_helper.returns(nil) + @parser = CMockUnityHelperParser.new(@config) + + assert_equal(expected, @parser.c_types) + end + + should "be able to fetch helpers on my list" do + @config.expects.plugins.returns([]) #not :array + @config.expects.treat_as.returns({}) + @config.expect.load_unity_helper.returns("") + @parser = CMockUnityHelperParser.new(@config) + @parser.c_types = { + 'UINT8' => "UNITY_TEST_ASSERT_EQUAL_UINT8", + 'UINT16*' => "UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY", + 'SPINACH' => "UNITY_TEST_ASSERT_EQUAL_SPINACH", + 'LONG_LONG' => "UNITY_TEST_ASSERT_EQUAL_LONG_LONG" + } + + [["UINT8","UINT8"], + ["UINT16*","UINT16_ARRAY"], + ["const SPINACH","SPINACH"], + ["LONG LONG","LONG_LONG"] ].each do |ctype, exptype| + assert_equal(["UNITY_TEST_ASSERT_EQUAL_#{exptype}",''], @parser.get_helper(ctype)) + end + end + + should "return memory comparison when asked to fetch helper of types not on my list" do + @config.expects.plugins.returns([]) #not :array + @config.expects.treat_as.returns({}) + @config.expects.load_unity_helper.returns("") + @parser = CMockUnityHelperParser.new(@config) + @parser.c_types = { + 'UINT8' => "UNITY_TEST_ASSERT_EQUAL_UINT8", + 'UINT16*' => "UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY", + 'SPINACH' => "UNITY_TEST_ASSERT_EQUAL_SPINACH", + } + + ["UINT32","SPINACH_T","SALAD","PINEAPPLE"].each do |ctype| + @config.expect.memcmp_if_unknown.returns(true) + assert_equal(["UNITY_TEST_ASSERT_EQUAL_MEMORY",'&'], @parser.get_helper(ctype)) + end + end + + should "return memory array comparison when asked to fetch helper of types not on my list" do + @config.expects.plugins.returns([:array]) + @config.expects.treat_as.returns({}) + @config.expects.load_unity_helper.returns("") + @parser = CMockUnityHelperParser.new(@config) + @parser.c_types = { + 'UINT8' => "UNITY_TEST_ASSERT_EQUAL_UINT8", + 'UINT16*' => "UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY", + 'SPINACH' => "UNITY_TEST_ASSERT_EQUAL_SPINACH", + } + + ["UINT32*","SPINACH_T*"].each do |ctype| + @config.expect.memcmp_if_unknown.returns(true) + assert_equal(["UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY",''], @parser.get_helper(ctype)) + end + end + + should "return the array handler if we cannot find the normal handler" do + @config.expects.plugins.returns([]) #not :array + @config.expects.treat_as.returns({}) + @config.expect.load_unity_helper.returns("") + @parser = CMockUnityHelperParser.new(@config) + @parser.c_types = { + 'UINT8' => "UNITY_TEST_ASSERT_EQUAL_UINT8", + 'UINT16*' => "UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY", + 'SPINACH' => "UNITY_TEST_ASSERT_EQUAL_SPINACH", + } + + assert_equal(["UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY",'&'], @parser.get_helper("UINT16")) + end + + should "return the normal handler if we cannot find the array handler" do + @config.expects.plugins.returns([]) #not :array + @config.expects.treat_as.returns({}) + @config.expect.load_unity_helper.returns("") + @parser = CMockUnityHelperParser.new(@config) + @parser.c_types = { + 'UINT8' => "UNITY_TEST_ASSERT_EQUAL_UINT8", + 'UINT16' => "UNITY_TEST_ASSERT_EQUAL_UINT16", + 'SPINACH' => "UNITY_TEST_ASSERT_EQUAL_SPINACH", + } + + assert_equal(["UNITY_TEST_ASSERT_EQUAL_UINT8",'*'], @parser.get_helper("UINT8*")) + end + + should "raise error when asked to fetch helper of type not on my list and not allowed to mem check" do + @config.expects.plugins.returns([]) #not :array + @config.expects.treat_as.returns({}) + @config.expect.load_unity_helper.returns("") + @config.expect.memcmp_if_unknown.returns(false) + @parser = CMockUnityHelperParser.new(@config) + @parser.c_types = { + 'UINT8' => "UNITY_TEST_ASSERT_EQUAL_UINT8", + 'UINT32*' => "UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY", + 'SPINACH' => "UNITY_TEST_ASSERT_EQUAL_SPINACH", + } + + assert_raise(RuntimeError) { @parser.get_helper("UINT16") } + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/behaviors/Manifest.txt b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/behaviors/Manifest.txt new file mode 100644 index 0000000..6c954ec --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/behaviors/Manifest.txt @@ -0,0 +1,9 @@ +Manifest.txt +Rakefile +lib/behaviors.rb +lib/behaviors/reporttask.rb +test/behaviors_tasks_test.rb +test/behaviors_test.rb +test/tasks_test/lib/user.rb +test/tasks_test/Rakefile +test/tasks_test/test/user_test.rb diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/behaviors/Rakefile b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/behaviors/Rakefile new file mode 100644 index 0000000..d4d68b9 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/behaviors/Rakefile @@ -0,0 +1,19 @@ +require 'rake' +require 'rubygems' +require 'hoe' + +Hoe.new('behaviors','1.0.3') do |p| + p.author = "Atomic Object LLC" + p.email = "dev@atomicobject.com" + p.url = "http://behaviors.rubyforge.org" + p.summary = "behavior-driven unit test helper" + p.description = <<-EOS +Behaviors allows for Test::Unit test case methods to be defined as +human-readable descriptions of program behavior. It also provides +Rake tasks to list the behaviors of your project. + EOS + p.test_globs = ['test/*_test.rb'] + + p.changes = <<-EOS + EOS +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/behaviors/lib/behaviors.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/behaviors/lib/behaviors.rb new file mode 100644 index 0000000..d8d70f7 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/behaviors/lib/behaviors.rb @@ -0,0 +1,76 @@ +=begin rdoc += Usage +Behaviors provides a single method: should. + +Instead of naming test methods like: + + def test_something + end + +You declare test methods like: + + should "perform action" do + end + +You may omit the body of a should method to describe unimplemented behavior. + + should "perform other action" + +When you run your unit tests, empty should methods will appear as an 'UNIMPLEMENTED CASE' along with the described behavior. +This is useful for sketching out planned behavior quickly. + +Simply extend Behaviors in your TestCase to start using behaviors. + + require 'test/unit' + require 'behaviors' + require 'user' + + class UserTest < Test::Unit::TestCase + extend Behaviors + ... + end + += Motivation +Test methods typically focus on the name of the method under test instead of its behavior. +Creating test methods with should statements focuses on the behavior of an object. +This helps you to think about the role of the object under test. + +Using a behavior-driven approach prevents the danger in assuming a one-to-one mapping of method names to +test method names. +As always, you get the most value by writing the tests first. + +For a more complete BDD framework, try RSpec http://rspec.rubyforge.org/ + += Rake tasks + +You can define a Behaviors::ReportTask in your Rakefile to generate rake tasks that +summarize the behavior of your project. + +These tasks are named behaviors and behaviors_html. They will output to the +console or an html file in the doc directory with a list all of your should tests. + Behaviors::ReportTask.new do |t| + t.pattern = 'test/**/*_test.rb' + end + +You may also initialize the ReportTask with a custom name to associate with a particular suite of tests. + Behaviors::ReportTask.new(:widget_subsystem) do |t| + t.pattern = 'test/widgets/*_test.rb' + end + +The html report will be placed in the doc directory by default. +You can override this default by setting the html_dir in the ReportTask. + Behaviors::ReportTask.new do |t| + t.pattern = 'test/**/*_test.rb' + t.html_dir = 'behaviors_html_reports' + end +=end +module Behaviors + def should(behave,&block) + mname = "test_should_#{behave}" + if block + define_method mname, &block + else + puts ">>> UNIMPLEMENTED CASE: #{name.sub(/Test$/,'')} should #{behave}" + end + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/behaviors/lib/behaviors/reporttask.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/behaviors/lib/behaviors/reporttask.rb new file mode 100644 index 0000000..51c0eca --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/behaviors/lib/behaviors/reporttask.rb @@ -0,0 +1,158 @@ +require 'rake' +require 'rake/tasklib' + +module Behaviors +include Rake + + class ReportTask < TaskLib + attr_accessor :pattern + attr_accessor :html_dir + + def initialize(name=:behaviors) + @name = name + @html_dir = 'doc' + yield self if block_given? + define + end + + def define + desc "List behavioral definitions for the classes specified (use for= to further limit files included in report)" + task @name do + specifications.each do |spec| + puts "#{spec.name} should:\n" + spec.requirements.each do |req| + puts " - #{req}" + end + end + end + + desc "Generate html report of behavioral definitions for the classes specified (use for= to further limit files included in report)" + task "#{@name}_html" do + require 'erb' + txt =<<-EOS + + + + + +
Specifications
+<% specifications.each do |spec| %> +
+<%= spec.name %> should: +
    +<% spec.requirements.each do |req| %> +
  • <%= req %>
  • +<% end %> +
+
+<% end %> + + + EOS + output_dir = File.expand_path(@html_dir) + mkdir_p output_dir + output_filename = output_dir + "/behaviors.html" + File.open(output_filename,"w") do |f| + f.write ERB.new(txt).result(binding) + end + puts "(Wrote #{output_filename})" + end + end + + private + def test_files + test_list = FileList[@pattern] + if ENV['for'] + test_list = test_list.grep(/#{ENV['for']}/i) + end + test_list + end + + def specifications + test_files.map do |file| + spec = OpenStruct.new + m = %r".*/([^/].*)_test.rb".match(file) + class_name = titleize(m[1]) if m[1] + spec.name = class_name + spec.requirements = [] + File::readlines(file).each do |line| + if line =~ /^\s*should\s+\(?\s*["'](.*)["']/ + spec.requirements << $1 + end + end + spec + end + end + + ############################################################ + # STOLEN FROM inflector.rb + ############################################################ + #-- + # Copyright (c) 2005 David Heinemeier Hansson + # + # Permission is hereby granted, free of charge, to any person obtaining + # a copy of this software and associated documentation files (the + # "Software"), to deal in the Software without restriction, including + # without limitation the rights to use, copy, modify, merge, publish, + # distribute, sublicense, and/or sell copies of the Software, and to + # permit persons to whom the Software is furnished to do so, subject to + # the following conditions: + # + # The above copyright notice and this permission notice shall be + # included in all copies or substantial portions of the Software. + # + # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + #++ + def titleize(word) + humanize(underscore(word)).gsub(/\b([a-z])/) { $1.capitalize } + end + + def underscore(camel_cased_word) camel_cased_word.to_s.gsub(/::/, '/'). + gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').gsub(/([a-z\d])([A-Z])/,'\1_\2').tr("-", "_").downcase + end + + def humanize(lower_case_and_underscored_word) + lower_case_and_underscored_word.to_s.gsub(/_id$/, "").gsub(/_/, " ").capitalize + end + + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/behaviors/test/behaviors_tasks_test.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/behaviors/test/behaviors_tasks_test.rb new file mode 100644 index 0000000..9382e07 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/behaviors/test/behaviors_tasks_test.rb @@ -0,0 +1,73 @@ +require 'test/unit' +require 'fileutils' + +class BehaviorsTasksTest < Test::Unit::TestCase + include FileUtils + + def setup + @here = File.expand_path(File.dirname(__FILE__)) + @base_cmd = RUBY_PLATFORM[/mswin/] ? 'rake.cmd ' : 'rake ' + end + + # + # HELPERS + # + def run_behaviors_task + run_cmd "behaviors" + end + + def run_behaviors_html_task + run_cmd "behaviors_html" + end + + def run_cmd(cmd) + cd "#{@here}/tasks_test" do + @report = %x[ #{@base_cmd} #{cmd} ] + end + end + + def see_html_task_output_message + @html_output_filename = "#{@here}/tasks_test/behaviors_doc/behaviors.html" + assert_match(/Wrote #{@html_output_filename}/, @report) + end + + def see_that_html_report_file_exits + assert File.exists?(@html_output_filename), "html output file should exist" + end + + def html_report_file_should_contain(user_behaviors) + file_contents = File.read(@html_output_filename) + user_behaviors.each do |line| + assert_match(/#{line}/, file_contents) + end + rm_rf File.dirname(@html_output_filename) + end + + # + # TESTS + # + def test_that_behaviors_tasks_should_list_behavioral_definitions_for_the_classes_under_test + run_behaviors_task + user_behaviors = [ + "User should:", + " - be able set user name and age during construction", + " - be able to get user name and age", + " - be able to ask if a user is an adult" + ] + assert_match(/#{user_behaviors.join("\n")}/, @report) + end + + def test_that_behaviors_tasks_should_list_behavioral_definitions_for_the_classes_under_test_in_html_output + run_behaviors_html_task + see_html_task_output_message + see_that_html_report_file_exits + user_behaviors = [ + "User should:", + "be able set user name and age during construction", + "be able to get user name and age", + "be able to ask if a user is an adult" + ] + html_report_file_should_contain user_behaviors + end + +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/behaviors/test/behaviors_test.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/behaviors/test/behaviors_test.rb new file mode 100644 index 0000000..fd0a77f --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/behaviors/test/behaviors_test.rb @@ -0,0 +1,50 @@ +require 'test/unit' +require File.expand_path(File.dirname(__FILE__)) + '/../lib/behaviors' +require 'stringio' + +loading_developer_test_class_stdout = StringIO.new +saved_stdout = $stdout.dup +$stdout = loading_developer_test_class_stdout + +class DeveloperTest + extend Behaviors + attr_accessor :flunk_msg, :tested_code + + should "test their code" do + @tested_code = true + end + should "go to meetings" +end + +$stdout = saved_stdout +loading_developer_test_class_stdout.rewind +$loading_developer_test_class_output = loading_developer_test_class_stdout.read + +class BehaviorsTest < Test::Unit::TestCase + + + def setup + @target = DeveloperTest.new + assert_nil @target.tested_code, "block called too early" + end + + # + # TESTS + # + def test_should_called_with_a_block_defines_a_test + assert @target.methods.include?("test_should_test their code"), "Missing test method" + + @target.send("test_should_test their code") + + assert @target.tested_code, "block not called" + end + + def test_should_called_without_a_block_does_not_create_a_test_method + assert !@target.methods.include?("test_should_go to meetings"), "Should not have method" + end + + def test_should_called_without_a_block_will_give_unimplemented_output_when_class_loads + unimplemented_output = "UNIMPLEMENTED CASE: Developer should go to meetings" + assert_match(/#{unimplemented_output}/, $loading_developer_test_class_output) + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/behaviors/test/tasks_test/Rakefile b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/behaviors/test/tasks_test/Rakefile new file mode 100644 index 0000000..ba71f71 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/behaviors/test/tasks_test/Rakefile @@ -0,0 +1,19 @@ +require 'rake' +require 'rake/testtask' + +here = File.expand_path(File.dirname(__FILE__)) +require "#{here}/../../lib/behaviors/reporttask" + +desc 'Default: run unit tests.' +task :default => :test + +Rake::TestTask.new(:test) do |t| + t.libs << "#{here}/../../lib" + t.pattern = 'test/**/*_test.rb' + t.verbose = true +end + +Behaviors::ReportTask.new(:behaviors) do |t| + t.pattern = 'test/**/*_test.rb' + t.html_dir = 'behaviors_doc' +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/behaviors/test/tasks_test/lib/user.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/behaviors/test/tasks_test/lib/user.rb new file mode 100644 index 0000000..40bc07c --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/behaviors/test/tasks_test/lib/user.rb @@ -0,0 +1,2 @@ +class User +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/behaviors/test/tasks_test/test/user_test.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/behaviors/test/tasks_test/test/user_test.rb new file mode 100644 index 0000000..ad3cd1b --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/behaviors/test/tasks_test/test/user_test.rb @@ -0,0 +1,17 @@ +require 'test/unit' +require 'behaviors' + +require 'user' + +class UserTest < Test::Unit::TestCase + extend Behaviors + + def setup + end + + should "be able set user name and age during construction" + should "be able to get user name and age" + should "be able to ask if a user is an adult" + def test_DELETEME + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/docs/CExceptionSummary.odt b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/docs/CExceptionSummary.odt new file mode 100644 index 0000000..ea852a0 Binary files /dev/null and b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/docs/CExceptionSummary.odt differ diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/docs/CExceptionSummary.pdf b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/docs/CExceptionSummary.pdf new file mode 100644 index 0000000..a838337 Binary files /dev/null and b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/docs/CExceptionSummary.pdf differ diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/docs/license.txt b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/docs/license.txt new file mode 100644 index 0000000..561e5f2 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/docs/license.txt @@ -0,0 +1,30 @@ + Copyright (c) 2007 Mark VanderVoord + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + The end-user documentation included with the redistribution, if + any, must include the following acknowledgment: "This product + includes software developed for the CEXCeption Project, by Mark + VanderVoord and other contributors", in the same place and form + as other third-party acknowledgments. Alternately, this + acknowledgment may appear in the software itself, in the same + form and location as other such third-party acknowledgments. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/docs/readme.txt b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/docs/readme.txt new file mode 100644 index 0000000..92cac38 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/docs/readme.txt @@ -0,0 +1,236 @@ +==================================================================== +CException +==================================================================== + +CException is a basic exception framework for C, suitable for use in +embedded applications. It provides an exception framework similar in +use to C++, but with much less overhead. + +CException uses C standard library functions setjmp and longjmp to +operate. As long as the target system has these two functions defined, +this library should be useable with very little configuration. It +even supports environments where multiple program flows are in use, +such as real-time operating systems. + +There are about a gabillion exception frameworks using a similar +setjmp/longjmp method out there... and there will probably be more +in the future. Unfortunately, when we started our last embedded +project, all those that existed either (a) did not support multiple +tasks (therefore multiple stacks) or (b) were way more complex than +we really wanted. CException was born. + +Why use CException? + +0. It's ANSI C, and it beats passing error codes around. + +1. You want something simple... CException throws a single id. You can + define those ID's to be whatever you like. You might even choose which + type that number is for your project. But that's as far as it goes. + We weren't interested in passing objects or structs or strings... + just simple error codes. + +2. Performance... CException can be configured for single tasking or + multitasking. In single tasking, there is very little overhead past + the setjmp/longjmp calls (which are already fast). In multitasking, + your only additional overhead is the time it takes you to determine + a unique task id 0 - num_tasks. + +For the latest version, go to http://cexception.sourceforge.net + +-------------------------------------------------------------------- +CONTENTS OF THIS DOCUMENT +-------------------------------------------------------------------- + +Usage +Limitations +API +Configuration +Testing +License + +-------------------------------------------------------------------- +Usage +-------------------------------------------------------------------- + +Code that is to be protected are wrapped in Try { } Catch { } blocks. +The code directly following the Try call is "protected", meaning that +if any Throws occur, program control is directly transferred to the +start of the Catch block. + +A numerical exception ID is included with Throw, and is made accessible +from the Catch block. + +Throws can occur from within function calls (nested as deeply as you +like) or directly from within the function itself. + +-------------------------------------------------------------------- +Limitations +-------------------------------------------------------------------- + +This library was made to be as fast as possible, and provide basic +exception handling. It is not a full-blown exception library. Because +of this, there are a few limitations that should be observed in order +to successfully utilize this library: + +1. Do not directly "return" from within a Try block, nor "goto" + into or out of a Try block. + + Why? + + The "Try" macro allocates some local memory and alters a global + pointer. These are cleaned up at the top of the "Catch" macro. + Gotos and returns would bypass some of these steps, resulting in + memory leaks or unpredictable behavior. + +2. If (a) you change local (stack) variables within your Try block, + AND (b) wish to make use of the updated values after an exception + is thrown, those variables should be made volatile. Note that this + is ONLY for locals and ONLY when you need access to them after a + throw. + + Why? + + Compilers optimize. There is no way to guarantee that the actual + memory location was updated and not just a register unless the + variable is marked volatile. + +3. Memory which is malloc'd or new'd is not automatically released + when an error is thrown. This will sometimes be desirable, and + othertimes may not. It will be the responsibility of the Catch + block to perform this kind of cleanup. + + Why? + + There's just no easy way to track malloc'd memory, etc., without + replacing or wrapping malloc calls or something like that. This + is a light framework, so these options were not desirable. + +-------------------------------------------------------------------- +API +-------------------------------------------------------------------- + +Try +--- + +Try is a macro which starts a protected block. It MUST be followed by +a pair of braces or a single protected line (similar to an 'if'), +enclosing the data that is to be protected. It MUST be followed by a +Catch block (don't worry, you'll get compiler errors to let you know if +you mess any of that up). + +Catch(e) +-------- + +Catch is a macro which ends the Try block and starts the error handling +block. The catch block is called if and only if an exception was thrown +while within the Try block. This error was thrown by a Throw call +somewhere within Try (or within a function called within Try, or a function +called by a function called within Try, etc). + +The single parameter 'e' is filled with the error code which was thrown. +This can be used for reporting, conditional cleanup, etc. (or you can just +ignore it if you really want... people ignore return codes all the time, +right?). 'e' should be of type EXCEPTION_T; + +Throw(e) +-------- + +The method of throwing an error. Throws should only occur from within a +protected (Try...Catch) block, though it may easily be nested many function +calls deep without an impact on performance or functionality. Throw takes +a single argument, which is an exception id which will be passed to Catch +as the reason for the error. + +If you wish to Rethrow an error, this can be done by calling Throw(e) with +the error code you just caught. It IS valid to throw from a catch block. + +-------------------------------------------------------------------- +CONFIGURATION +-------------------------------------------------------------------- + +CException is a mostly portable library. It has one universal +dependency, and some macros which are required if working in a +multi-tasking environment. + +1. The standard C library setjmp must be available. Since this is part + of the standard library, chances are good that you'll be fine. + +2. If working in a multitasking environment, methods for obtaining an + index into an array of frames and to get the overall number of + id's are required. If the OS supports a method to retrieve Task + ID's, and those Tasks are number 0, 1, 2... you are in an ideal + situation. Otherwise, a more creative mapping function may be + required. Note that this function is likely to be called twice + for each protected block and once during a throw. This is the + only overhead in the system. + +Exception.h +----------------- +By convention, most projects include Exception.h which defines any +further requirements, then calls CException.h to do the gruntwork. All +of these are optional. You could directly include CException.h if +you wanted and just use the defaults provided. + +EXCEPTION_T - Set this to the type you want your exception id's + to be. Defaults to 'unsigned int'. + +EXCEPTION_NONE - Set this to a number which will never be an + exception id in your system. Defaults to 0x5a5a5a5a. + +EXCEPTION_GET_ID - If in a multi-tasking environment, this should be + set to be a call to the function described in #2 above. + Defaults to just return 0 all the time (good for + single tasking environments) + +EXCEPTION_NUM_ID - If in a multi-tasking environment, this should be set + to the number of ID's required (usually the number of + tasks in the system). Defaults to 1 (for single + tasking environments). + +You may also want to include any header files which will commonly be +needed by the rest of your application where it uses exception handling +here. For example, OS header files or exception codes would be useful. + +-------------------------------------------------------------------- +TESTING +-------------------------------------------------------------------- + +If you want to validate that CException works with your tools or that +it works with your custom configuration, you may want to run the test +suite. + +The test suite included makes use of the Unity Test Framework. It will +require a native C compiler. The example makefile uses MinGW's gcc. +Modify the makefile to include the proper paths to tools, then run 'make' +to compile and run the test application. + +C_COMPILER - The C compiler to use to perform the tests +C_LIBS - The path to the C libraries (including setjmp) +UNITY_DIR - The path to the Unity framework (required to run tests) + (get it at http://embunity.sourceforge.net) + +-------------------------------------------------------------------- +LICENSE +-------------------------------------------------------------------- + +This software is licensed under the MIT License + +Copyright (c) 2007 Mark VanderVoord + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/lib/CException.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/lib/CException.c new file mode 100644 index 0000000..57f5353 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/lib/CException.c @@ -0,0 +1,39 @@ +#include "CException.h" + +volatile CEXCEPTION_FRAME_T CExceptionFrames[CEXCEPTION_NUM_ID]; + +//------------------------------------------------------------------------------------------ +// Throw +//------------------------------------------------------------------------------------------ +void Throw(CEXCEPTION_T ExceptionID) +{ + unsigned int MY_ID = CEXCEPTION_GET_ID; + CExceptionFrames[MY_ID].Exception = ExceptionID; + longjmp(*CExceptionFrames[MY_ID].pFrame, 1); +} + +//------------------------------------------------------------------------------------------ +// Explaination of what it's all for: +//------------------------------------------------------------------------------------------ +/* +#define Try + { <- give us some local scope. most compilers are happy with this + jmp_buf *PrevFrame, NewFrame; <- prev frame points to the last try block's frame. new frame gets created on stack for this Try block + unsigned int MY_ID = CEXCEPTION_GET_ID; <- look up this task's id for use in frame array. always 0 if single-tasking + PrevFrame = CExceptionFrames[CEXCEPTION_GET_ID].pFrame; <- set pointer to point at old frame (which array is currently pointing at) + CExceptionFrames[MY_ID].pFrame = &NewFrame; <- set array to point at my new frame instead, now + CExceptionFrames[MY_ID].Exception = CEXCEPTION_NONE; <- initialize my exception id to be NONE + if (setjmp(NewFrame) == 0) { <- do setjmp. it returns 1 if longjump called, otherwise 0 + if (&PrevFrame) <- this is here to force proper scoping. it requires braces or a single line to be but after Try, otherwise won't compile. This is always true at this point. + +#define Catch(e) + else { } <- this also forces proper scoping. Without this they could stick their own 'else' in and it would get ugly + CExceptionFrames[MY_ID].Exception = CEXCEPTION_NONE; <- no errors happened, so just set the exception id to NONE (in case it was corrupted) + } + else <- an exception occurred + { e = CExceptionFrames[MY_ID].Exception; e=e;} <- assign the caught exception id to the variable passed in. + CExceptionFrames[MY_ID].pFrame = PrevFrame; <- make the pointer in the array point at the previous frame again, as if NewFrame never existed. + } <- finish off that local scope we created to have our own variables + if (CExceptionFrames[CEXCEPTION_GET_ID].Exception != CEXCEPTION_NONE) <- start the actual 'catch' processing if we have an exception id saved away + */ + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/lib/CException.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/lib/CException.h new file mode 100644 index 0000000..40c6fc7 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/lib/CException.h @@ -0,0 +1,70 @@ +#ifndef _CEXCEPTION_H +#define _CEXCEPTION_H + +#include + +//To Use CException, you have a number of options: +//1. Just include it and run with the defaults +//2. Define any of the following symbols at the command line to override them +//3. Include a header file before CException.h everywhere which defines any of these +//4. Create an Exception.h in your path, and just define EXCEPTION_USE_CONFIG_FILE first + +#ifdef CEXCEPTION_USE_CONFIG_FILE +#include "CExceptionConfig.h" +#endif + +//This is the value to assign when there isn't an exception +#ifndef CEXCEPTION_NONE +#define CEXCEPTION_NONE (0x5A5A5A5A) +#endif + +//This is number of exception stacks to keep track of (one per task) +#ifndef CEXCEPTION_NUM_ID +#define CEXCEPTION_NUM_ID (1) //there is only the one stack by default +#endif + +//This is the method of getting the current exception stack index (0 if only one stack) +#ifndef CEXCEPTION_GET_ID +#define CEXCEPTION_GET_ID (0) //use the first index always because there is only one anyway +#endif + +//The type to use to store the exception values. +#ifndef CEXCEPTION_T +#define CEXCEPTION_T unsigned int +#endif + +//exception frame structures +typedef struct { + jmp_buf* pFrame; + volatile CEXCEPTION_T Exception; +} CEXCEPTION_FRAME_T; + +//actual root frame storage (only one if single-tasking) +extern volatile CEXCEPTION_FRAME_T CExceptionFrames[]; + +//Try (see C file for explanation) +#define Try \ + { \ + jmp_buf *PrevFrame, NewFrame; \ + unsigned int MY_ID = CEXCEPTION_GET_ID; \ + PrevFrame = CExceptionFrames[CEXCEPTION_GET_ID].pFrame; \ + CExceptionFrames[MY_ID].pFrame = (jmp_buf*)(&NewFrame); \ + CExceptionFrames[MY_ID].Exception = CEXCEPTION_NONE; \ + if (setjmp(NewFrame) == 0) { \ + if (&PrevFrame) + +//Catch (see C file for explanation) +#define Catch(e) \ + else { } \ + CExceptionFrames[MY_ID].Exception = CEXCEPTION_NONE; \ + } \ + else \ + { e = CExceptionFrames[MY_ID].Exception; e=e; } \ + CExceptionFrames[MY_ID].pFrame = PrevFrame; \ + } \ + if (CExceptionFrames[CEXCEPTION_GET_ID].Exception != CEXCEPTION_NONE) + +//Throw an Error +void Throw(CEXCEPTION_T ExceptionID); + +#endif // _CEXCEPTION_H diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/makefile b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/makefile new file mode 100644 index 0000000..c168a41 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/makefile @@ -0,0 +1,24 @@ +#Tool and Lib Locations +C_COMPILER=gcc +C_LIBS=C:/MinGW/lib +UNITY_DIR=vendor/unity/src + +#Test File To Be Created +OUT_FILE=test_cexceptions +ifeq ($(OS),Windows_NT) +OUT_EXTENSION=.exe +else +OUT_EXTENSION=.out +endif + +#Options +SRC_FILES=lib/CException.c test/TestException.c test/TestException_Runner.c $(UNITY_DIR)/unity.c +INC_DIRS=-Ilib -Itest -I$(UNITY_DIR) +LIB_DIRS=-L$(C_LIBS) +SYMBOLS=-DTEST -DEXCEPTION_USE_CONFIG_FILE + +#Default Task: Compile And Run Tests +default: + $(C_COMPILER) $(INC_DIRS) $(LIB_DIRS) $(SYMBOLS) $(SRC_FILES) -o $(OUT_FILE)$(OUT_EXTENSION) + $(OUT_FILE)$(OUT_EXTENSION) + \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/rakefile.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/rakefile.rb new file mode 100644 index 0000000..2458c6f --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/rakefile.rb @@ -0,0 +1,41 @@ +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require HERE+'vendor/unity/auto/colour_reporter.rb' + +#Tool and Lib Locations +C_COMPILER = 'gcc' +C_LIBS = '' +UNITY_DIR = 'vendor/unity/src' + +#Test File To Be Created +OUT_FILE = 'test_cexceptions' +OUT_EXTENSION = '.out' + +#Options +SRC_FILES = "lib/CException.c test/TestException.c test/TestException_Runner.c #{UNITY_DIR}/unity.c" +INC_DIRS = "-Ilib -Itest -I#{UNITY_DIR}" +LIB_DIRS = C_LIBS.empty? ? '' : "-L#{C_LIBS}" +SYMBOLS = '-DTEST -DEXCEPTION_USE_CONFIG_FILE' + +CLEAN.include("#{HERE}*.out") + +task :default => [:clobber, :test] +task :cruise => [:no_color, :default] + +desc "performs a quick set of unit tests to confirm you're ready to go" +task :test do + report "#{C_COMPILER} #{INC_DIRS} #{LIB_DIRS} #{SYMBOLS} #{SRC_FILES} -o #{OUT_FILE}#{OUT_EXTENSION}" + output = `#{C_COMPILER} #{INC_DIRS} #{LIB_DIRS} #{SYMBOLS} #{SRC_FILES} -o #{OUT_FILE}#{OUT_EXTENSION}` + report output + + report "#{HERE}#{OUT_FILE}#{OUT_EXTENSION}" + output = `#{HERE}#{OUT_FILE}#{OUT_EXTENSION}` + report output +end + +task :no_color do + $colour_output = false +end \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/release/build.info b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/release/build.info new file mode 100644 index 0000000..b5794c5 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/release/build.info @@ -0,0 +1,2 @@ +16 + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/release/version.info b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/release/version.info new file mode 100644 index 0000000..cb7e5f6 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/release/version.info @@ -0,0 +1,2 @@ +1.2.0 + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/test/CExceptionConfig.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/test/CExceptionConfig.h new file mode 100644 index 0000000..79b085d --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/test/CExceptionConfig.h @@ -0,0 +1,27 @@ +#ifndef _EXCEPTION_H +#define _EXCEPTION_H + +//Optionally define the exception type (something like an int which can be directly assigned) +#define CEXCEPTION_T int + +// Optionally define the reserved value representing NO EXCEPTION +#define CEXCEPTION_NONE (1234) + +// Multi-Tasking environments will need a couple of macros defined to make this library +// properly handle multiple exception stacks. You will need to include and required +// definitions, then define the following macros: +// EXCEPTION_GET_ID - returns the id of the current task indexed 0 to (numtasks - 1) +// EXCEPTION_NUM_ID - returns the number of tasks that might be returned +// +// For example, Quadros might include the following implementation: +#ifndef TEST +#include "OSAPI.h" +#define CEXCEPTION_GET_ID (KS_GetTaskID()) +#define CEXCEPTION_NUM_ID (NTASKS + 1) +#endif + +//This could be a good place to define/include some error ID's: +#define ERROR_ID_EVERYTHING_IS_BROKEN (0x88) +#define ERROR_ID_ONLY_THIS_IS_BROKEN (0x77) + +#endif // _EXCEPTION_H diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/test/TestException.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/test/TestException.c new file mode 100644 index 0000000..704cfdb --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/test/TestException.c @@ -0,0 +1,291 @@ +#include "unity.h" +#include "CException.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void test_BasicTryDoesNothingIfNoThrow(void) +{ + int i; + CEXCEPTION_T e = 0x5a; + + Try + { + i += 1; + } + Catch(e) + { + TEST_FAIL_MESSAGE("Should Not Enter Catch If Not Thrown") + } + + //verify that e was untouched + TEST_ASSERT_EQUAL(0x5a, e); +} + +void test_BasicThrowAndCatch(void) +{ + CEXCEPTION_T e; + + Try + { + Throw(0xBE); + TEST_FAIL_MESSAGE("Should Have Thrown An Error") + } + Catch(e) + { + //verify that e has the right data + TEST_ASSERT_EQUAL(0xBE, e); + } + + //verify that e STILL has the right data + TEST_ASSERT_EQUAL(0xBE, e); +} + +void test_BasicThrowAndCatch_WithMiniSyntax(void) +{ + CEXCEPTION_T e; + + //Mini Throw and Catch + Try + Throw(0xEF); + Catch(e) + TEST_ASSERT_EQUAL(0xEF, e); + TEST_ASSERT_EQUAL(0xEF, e); + + //Mini Passthrough + Try + e = 0; + Catch(e) + TEST_FAIL_MESSAGE("I shouldn't be caught because there was no throw"); + + TEST_ASSERT_EQUAL(0, e); +} + +void test_VerifyVolatilesSurviveThrowAndCatch(void) +{ + volatile unsigned int VolVal = 0; + CEXCEPTION_T e; + + Try + { + VolVal = 2; + Throw(0xBF); + TEST_FAIL_MESSAGE("Should Have Thrown An Error") + } + Catch(e) + { + VolVal += 2; + TEST_ASSERT_EQUAL(0xBF, e); + } + + TEST_ASSERT_EQUAL(4, VolVal); + TEST_ASSERT_EQUAL(0xBF, e); +} + +void HappyExceptionThrower(unsigned int ID) +{ + if (ID != 0) + { + Throw(ID); + } +} + +void test_ThrowFromASubFunctionAndCatchInRootFunc(void) +{ + volatile unsigned int ID = 0; + CEXCEPTION_T e; + + Try + { + + HappyExceptionThrower(0xBA); + TEST_FAIL_MESSAGE("Should Have Thrown An Exception"); + } + Catch(e) + { + ID = e; + } + + //verify that I can pass that value to something else + TEST_ASSERT_EQUAL(0xBA, e); +} + +void HappyExceptionRethrower(unsigned int ID) +{ + CEXCEPTION_T e; + + Try + { + Throw(ID); + } + Catch(e) + { + switch (e) + { + case 0xBD: + Throw(0xBF); + break; + default: + break; + } + } +} + +void test_ThrowAndCatchFromASubFunctionAndRethrowToCatchInRootFunc(void) +{ + volatile unsigned int ID = 0; + CEXCEPTION_T e; + + Try + { + HappyExceptionRethrower(0xBD); + TEST_FAIL_MESSAGE("Should Have Rethrown Exception"); + } + Catch(e) + { + ID = 1; + } + + TEST_ASSERT_EQUAL(0xBF, e); + TEST_ASSERT_EQUAL(1, ID); +} + +void test_ThrowAndCatchFromASubFunctionAndNoRethrowToCatchInRootFunc(void) +{ + CEXCEPTION_T e = 3; + + Try + { + HappyExceptionRethrower(0xBF); + } + Catch(e) + { + TEST_FAIL_MESSAGE("Should Not Have Re-thrown Error (it should have already been caught)"); + } + + //verify that THIS e is still untouched, even though subfunction was touched + TEST_ASSERT_EQUAL(3, e); +} + +void test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThisDoesntCorruptExceptionId(void) +{ + CEXCEPTION_T e; + + Try + { + HappyExceptionThrower(0xBF); + TEST_FAIL_MESSAGE("Should Have Thrown Exception"); + } + Catch(e) + { + TEST_ASSERT_EQUAL(0xBF, e); + HappyExceptionRethrower(0x12); + TEST_ASSERT_EQUAL(0xBF, e); + } + TEST_ASSERT_EQUAL(0xBF, e); +} + +void test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThatEachExceptionIdIndependent(void) +{ + CEXCEPTION_T e1, e2; + + Try + { + HappyExceptionThrower(0xBF); + TEST_FAIL_MESSAGE("Should Have Thrown Exception"); + } + Catch(e1) + { + TEST_ASSERT_EQUAL(0xBF, e1); + Try + { + HappyExceptionThrower(0x12); + } + Catch(e2) + { + TEST_ASSERT_EQUAL(0x12, e2); + } + TEST_ASSERT_EQUAL(0x12, e2); + TEST_ASSERT_EQUAL(0xBF, e1); + } + TEST_ASSERT_EQUAL(0x12, e2); + TEST_ASSERT_EQUAL(0xBF, e1); +} + +void test_CanHaveMultipleTryBlocksInASingleFunction(void) +{ + CEXCEPTION_T e; + + Try + { + HappyExceptionThrower(0x01); + TEST_FAIL_MESSAGE("Should Have Thrown Exception"); + } + Catch(e) + { + TEST_ASSERT_EQUAL(0x01, e); + } + + Try + { + HappyExceptionThrower(0xF0); + TEST_FAIL_MESSAGE("Should Have Thrown Exception"); + } + Catch(e) + { + TEST_ASSERT_EQUAL(0xF0, e); + } +} + +void test_CanHaveNestedTryBlocksInASingleFunction_ThrowInside(void) +{ + int i = 0; + CEXCEPTION_T e; + + Try + { + Try + { + HappyExceptionThrower(0x01); + i = 1; + TEST_FAIL_MESSAGE("Should Have Rethrown Exception"); + } + Catch(e) + { + TEST_ASSERT_EQUAL(0x01, e); + } + } + Catch(e) + { + TEST_FAIL_MESSAGE("Should Have Been Caught By Inside Catch"); + } +} + +void test_CanHaveNestedTryBlocksInASingleFunction_ThrowOutside(void) +{ + int i = 0; + CEXCEPTION_T e; + + Try + { + Try + { + i = 2; + } + Catch(e) + { + TEST_FAIL_MESSAGE("Should NotBe Caught Here"); + } + HappyExceptionThrower(0x01); + TEST_FAIL_MESSAGE("Should Have Rethrown Exception"); + } + Catch(e) + { + TEST_ASSERT_EQUAL(0x01, e); + } +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/test/TestException_Runner.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/test/TestException_Runner.c new file mode 100644 index 0000000..1697a0e --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/test/TestException_Runner.c @@ -0,0 +1,62 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ +#include "unity.h" +#include "CException.h" + +extern void setUp(void); +extern void tearDown(void); + +extern void test_BasicTryDoesNothingIfNoThrow(void); +extern void test_BasicThrowAndCatch(void); +extern void test_BasicThrowAndCatch_WithMiniSyntax(void); +extern void test_VerifyVolatilesSurviveThrowAndCatch(void); +extern void test_ThrowFromASubFunctionAndCatchInRootFunc(void); +extern void test_ThrowAndCatchFromASubFunctionAndRethrowToCatchInRootFunc(void); +extern void test_ThrowAndCatchFromASubFunctionAndNoRethrowToCatchInRootFunc(void); +extern void test_CanHaveMultipleTryBlocksInASingleFunction(void); +extern void test_CanHaveNestedTryBlocksInASingleFunction_ThrowInside(void); +extern void test_CanHaveNestedTryBlocksInASingleFunction_ThrowOutside(void); +extern void test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThisDoesntCorruptExceptionId(void); +extern void test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThatEachExceptionIdIndependent(void); + +static void runTest(UnityTestFunction test) +{ + CEXCEPTION_T e; + if (TEST_PROTECT()) + { + setUp(); + Try + { + test(); + } + Catch(e) + { + TEST_FAIL_MESSAGE("Unexpected exception!") + } + } + tearDown(); +} + + +int main(void) +{ + Unity.TestFile = __FILE__; + UnityBegin(); + + // RUN_TEST calls runTest + RUN_TEST(test_BasicTryDoesNothingIfNoThrow, 12); + RUN_TEST(test_BasicThrowAndCatch, 30); + RUN_TEST(test_BasicThrowAndCatch_WithMiniSyntax, 49); + RUN_TEST(test_VerifyVolatilesSurviveThrowAndCatch, 69); + RUN_TEST(test_ThrowFromASubFunctionAndCatchInRootFunc, 98); + RUN_TEST(test_ThrowAndCatchFromASubFunctionAndRethrowToCatchInRootFunc, 139); + RUN_TEST(test_ThrowAndCatchFromASubFunctionAndNoRethrowToCatchInRootFunc, 158); + RUN_TEST(test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThisDoesntCorruptExceptionId, 175); + RUN_TEST(test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThatEachExceptionIdIndependent, 193); + RUN_TEST(test_CanHaveMultipleTryBlocksInASingleFunction, 220); + RUN_TEST(test_CanHaveNestedTryBlocksInASingleFunction_ThrowInside, 245); + RUN_TEST(test_CanHaveNestedTryBlocksInASingleFunction_ThrowOutside, 269); + + UnityEnd(); + + return 0; +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/colour_prompt.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/colour_prompt.rb new file mode 100644 index 0000000..81003dd --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/colour_prompt.rb @@ -0,0 +1,94 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +if RUBY_PLATFORM =~/(win|w)32$/ + begin + require 'Win32API' + rescue LoadError + puts "ERROR! \"Win32API\" library not found" + puts "\"Win32API\" is required for colour on a windows machine" + puts " try => \"gem install Win32API\" on the command line" + puts + end + # puts + # puts 'Windows Environment Detected...' + # puts 'Win32API Library Found.' + # puts +end + +class ColourCommandLine + def initialize + if RUBY_PLATFORM =~/(win|w)32$/ + get_std_handle = Win32API.new("kernel32", "GetStdHandle", ['L'], 'L') + @set_console_txt_attrb = + Win32API.new("kernel32","SetConsoleTextAttribute",['L','N'], 'I') + @hout = get_std_handle.call(-11) + end + end + + def change_to(new_colour) + if RUBY_PLATFORM =~/(win|w)32$/ + @set_console_txt_attrb.call(@hout,self.win32_colour(new_colour)) + else + "\033[30;#{posix_colour(new_colour)};22m" + end + end + + def win32_colour(colour) + case colour + when :black then 0 + when :dark_blue then 1 + when :dark_green then 2 + when :dark_cyan then 3 + when :dark_red then 4 + when :dark_purple then 5 + when :dark_yellow, :narrative then 6 + when :default_white, :default, :dark_white then 7 + when :silver then 8 + when :blue then 9 + when :green, :success then 10 + when :cyan, :output then 11 + when :red, :failure then 12 + when :purple then 13 + when :yellow then 14 + when :white then 15 + else + 0 + end + end + + def posix_colour(colour) + case colour + when :black then 30 + when :red, :failure then 31 + when :green, :success then 32 + when :yellow then 33 + when :blue, :narrative then 34 + when :purple, :magenta then 35 + when :cyan, :output then 36 + when :white, :default_white, :default then 37 + else + 30 + end + end + + def out_c(mode, colour, str) + case RUBY_PLATFORM + when /(win|w)32$/ + change_to(colour) + $stdout.puts str if mode == :puts + $stdout.print str if mode == :print + change_to(:default_white) + else + $stdout.puts("#{change_to(colour)}#{str}\033[0m") if mode == :puts + $stdout.print("#{change_to(colour)}#{str}\033[0m") if mode == :print + end + end +end # ColourCommandLine + +def colour_puts(role,str) ColourCommandLine.new.out_c(:puts, role, str) end +def colour_print(role,str) ColourCommandLine.new.out_c(:print, role, str) end + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/colour_reporter.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/colour_reporter.rb new file mode 100644 index 0000000..5aa1d27 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/colour_reporter.rb @@ -0,0 +1,39 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require "#{File.expand_path(File.dirname(__FILE__))}/colour_prompt" + +$colour_output = true + +def report(message) + if not $colour_output + $stdout.puts(message) + else + message = message.join('\n') if (message.class == Array) + message.each_line do |line| + line.chomp! + colour = case(line) + when /(?:total\s+)?tests:?\s+(\d+)\s+(?:total\s+)?failures:?\s+\d+\s+Ignored:?/i + ($1.to_i == 0) ? :green : :red + when /PASS/ + :green + when /^OK$/ + :green + when /(?:FAIL|ERROR)/ + :red + when /IGNORE/ + :yellow + when /^(?:Creating|Compiling|Linking)/ + :white + else + :silver + end + colour_puts(colour, line) + end + end + $stdout.flush + $stderr.flush +end \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_config.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_config.yml new file mode 100644 index 0000000..4a5e474 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_config.yml @@ -0,0 +1,36 @@ +#this is a sample configuration file for generate_module +#you would use it by calling generate_module with the -ygenerate_config.yml option +#files like this are useful for customizing generate_module to your environment +:generate_module: + :defaults: + #these defaults are used in place of any missing options at the command line + :path_src: ../src/ + :path_inc: ../src/ + :path_tst: ../test/ + :update_svn: true + :includes: + #use [] for no additional includes, otherwise list the includes on separate lines + :src: + - Defs.h + - Board.h + :inc: [] + :tst: + - Defs.h + - Board.h + - Exception.h + :boilerplates: + #these are inserted at the top of generated files. + #just comment out or remove if not desired. + #use %1$s where you would like the file name to appear (path/extension not included) + :src: | + //------------------------------------------- + // %1$s.c + //------------------------------------------- + :inc: | + //------------------------------------------- + // %1$s.h + //------------------------------------------- + :tst: | + //------------------------------------------- + // Test%1$s.c : Units tests for %1$s.c + //------------------------------------------- diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_module.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_module.rb new file mode 100644 index 0000000..3db1a98 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_module.rb @@ -0,0 +1,202 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +# This script creates all the files with start code necessary for a new module. +# A simple module only requires a source file, header file, and test file. +# Triad modules require a source, header, and test file for each triad type (like model, conductor, and hardware). + +require 'rubygems' +require 'fileutils' + +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +#help text when requested +HELP_TEXT = [ "\nGENERATE MODULE\n-------- ------", + "\nUsage: ruby generate_module [options] module_name", + " -i\"include\" sets the path to output headers to 'include' (DEFAULT ../src)", + " -s\"../src\" sets the path to output source to '../src' (DEFAULT ../src)", + " -t\"C:/test\" sets the path to output source to 'C:/test' (DEFAULT ../test)", + " -p\"MCH\" sets the output pattern to MCH.", + " dh - driver hardware.", + " dih - driver interrupt hardware.", + " mch - model conductor hardware.", + " mvp - model view presenter.", + " src - just a single source module. (DEFAULT)", + " -d destroy module instead of creating it.", + " -u update subversion too (requires subversion command line)", + " -y\"my.yml\" selects a different yaml config file for module generation", + "" ].join("\n") + +#Built in patterns +PATTERNS = { 'src' => {'' => { :inc => [] } }, + 'dh' => {'Driver' => { :inc => ['%1$sHardware.h'] }, + 'Hardware' => { :inc => [] } + }, + 'dih' => {'Driver' => { :inc => ['%1$sHardware.h', '%1$sInterrupt.h'] }, + 'Interrupt'=> { :inc => ['%1$sHardware.h'] }, + 'Hardware' => { :inc => [] } + }, + 'mch' => {'Model' => { :inc => [] }, + 'Conductor'=> { :inc => ['%1$sModel.h', '%1$sHardware.h'] }, + 'Hardware' => { :inc => [] } + }, + 'mvp' => {'Model' => { :inc => [] }, + 'Presenter'=> { :inc => ['%1$sModel.h', '%1$sView.h'] }, + 'View' => { :inc => [] } + } + } + +#TEMPLATE_TST +TEMPLATE_TST = %q[#include "unity.h" +%2$s#include "%1$s.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void test_%1$s_NeedToImplement(void) +{ + TEST_IGNORE(); +} +] + +#TEMPLATE_SRC +TEMPLATE_SRC = %q[%2$s#include "%1$s.h" +] + +#TEMPLATE_INC +TEMPLATE_INC = %q[#ifndef _%3$s_H +#define _%3$s_H%2$s + +#endif // _%3$s_H +] + +# Parse the command line parameters. +ARGV.each do |arg| + case(arg) + when /^-d/ then @destroy = true + when /^-u/ then @update_svn = true + when /^-p(\w+)/ then @pattern = $1 + when /^-s(.+)/ then @path_src = $1 + when /^-i(.+)/ then @path_inc = $1 + when /^-t(.+)/ then @path_tst = $1 + when /^-y(.+)/ then @yaml_config = $1 + when /^(\w+)/ + raise "ERROR: You can't have more than one Module name specified!" unless @module_name.nil? + @module_name = arg + when /^-(h|-help)/ + puts HELP_TEXT + exit + else + raise "ERROR: Unknown option specified '#{arg}'" + end +end +raise "ERROR: You must have a Module name specified! (use option -h for help)" if @module_name.nil? + +#load yaml file if one was requested +if @yaml_config + require 'yaml' + cfg = YAML.load_file(HERE + @yaml_config)[:generate_module] + @path_src = cfg[:defaults][:path_src] if @path_src.nil? + @path_inc = cfg[:defaults][:path_inc] if @path_inc.nil? + @path_tst = cfg[:defaults][:path_tst] if @path_tst.nil? + @update_svn = cfg[:defaults][:update_svn] if @update_svn.nil? + @extra_inc = cfg[:includes] + @boilerplates = cfg[:boilerplates] +else + @boilerplates = {} +end + +# Create default file paths if none were provided +@path_src = HERE + "../src/" if @path_src.nil? +@path_inc = @path_src if @path_inc.nil? +@path_tst = HERE + "../test/" if @path_tst.nil? +@path_src += '/' unless (@path_src[-1] == 47) +@path_inc += '/' unless (@path_inc[-1] == 47) +@path_tst += '/' unless (@path_tst[-1] == 47) +@pattern = 'src' if @pattern.nil? +@includes = { :src => [], :inc => [], :tst => [] } +@includes.merge!(@extra_inc) unless @extra_inc.nil? + +#create triad definition +TRIAD = [ { :ext => '.c', :path => @path_src, :template => TEMPLATE_SRC, :inc => :src, :boilerplate => @boilerplates[:src] }, + { :ext => '.h', :path => @path_inc, :template => TEMPLATE_INC, :inc => :inc, :boilerplate => @boilerplates[:inc] }, + { :ext => '.c', :path => @path_tst+'Test', :template => TEMPLATE_TST, :inc => :tst, :boilerplate => @boilerplates[:tst] }, + ] + +#prepare the pattern for use +@patterns = PATTERNS[@pattern.downcase] +raise "ERROR: The design pattern specified isn't one that I recognize!" if @patterns.nil? + +# Assemble the path/names of the files we need to work with. +files = [] +TRIAD.each do |triad| + @patterns.each_pair do |pattern_file, pattern_traits| + files << { + :path => "#{triad[:path]}#{@module_name}#{pattern_file}#{triad[:ext]}", + :name => "#{@module_name}#{pattern_file}", + :template => triad[:template], + :boilerplate => triad[:boilerplate], + :includes => case(triad[:inc]) + when :src then @includes[:src] | pattern_traits[:inc].map{|f| f % [@module_name]} + when :inc then @includes[:inc] + when :tst then @includes[:tst] | pattern_traits[:inc].map{|f| "Mock#{f}"% [@module_name]} + end + } + end +end + +# destroy files if that was what was requested +if @destroy + files.each do |filespec| + file = filespec[:path] + if File.exist?(file) + if @update_svn + `svn delete \"#{file}\" --force` + puts "File #{file} deleted and removed from source control" + else + FileUtils.remove(file) + puts "File #{file} deleted" + end + else + puts "File #{file} does not exist so cannot be removed." + end + end + puts "Destroy Complete" + exit +end + +#Abort if any module already exists +files.each do |file| + raise "ERROR: File #{file[:name]} already exists. Exiting." if File.exist?(file[:path]) +end + +# Create Source Modules +files.each_with_index do |file, i| + File.open(file[:path], 'w') do |f| + f.write(file[:boilerplate] % [file[:name]]) unless file[:boilerplate].nil? + f.write(file[:template] % [ file[:name], + file[:includes].map{|f| "#include \"#{f}\"\n"}.join, + file[:name].upcase ] + ) + end + if (@update_svn) + `svn add \"#{file[:path]}\"` + if $?.exitstatus == 0 + puts "File #{file[:path]} created and added to source control" + else + puts "File #{file[:path]} created but FAILED adding to source control!" + end + else + puts "File #{file[:path]} created" + end +end + +puts 'Generate Complete' diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb new file mode 100644 index 0000000..aff5053 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb @@ -0,0 +1,303 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +File.expand_path(File.join(File.dirname(__FILE__),'colour_prompt')) + +class UnityTestRunnerGenerator + + def initialize(options = nil) + @options = { :includes => [], :plugins => [], :framework => :unity } + case(options) + when NilClass then @options + when String then @options.merge!(UnityTestRunnerGenerator.grab_config(options)) + when Hash then @options.merge!(options) + else raise "If you specify arguments, it should be a filename or a hash of options" + end + end + + def self.grab_config(config_file) + options = { :includes => [], :plugins => [], :framework => :unity } + unless (config_file.nil? or config_file.empty?) + require 'yaml' + yaml_guts = YAML.load_file(config_file) + options.merge!(yaml_guts[:unity] ? yaml_guts[:unity] : yaml_guts[:cmock]) + raise "No :unity or :cmock section found in #{config_file}" unless options + end + return(options) + end + + def run(input_file, output_file, options=nil) + tests = [] + includes = [] + used_mocks = [] + + @options.merge!(options) unless options.nil? + module_name = File.basename(input_file) + + #pull required data from source file + File.open(input_file, 'r') do |input| + tests = find_tests(input) + includes = find_includes(input) + used_mocks = find_mocks(includes) + end + + #build runner file + File.open(output_file, 'w') do |output| + create_header(output, used_mocks) + create_externs(output, tests, used_mocks) + create_mock_management(output, used_mocks) + create_suite_setup_and_teardown(output) + create_reset(output, used_mocks) + create_main(output, input_file, tests) + end + + all_files_used = [input_file, output_file] + all_files_used += includes.map {|filename| filename + '.c'} unless includes.empty? + all_files_used += @options[:includes] unless @options[:includes].empty? + return all_files_used.uniq + end + + def find_tests(input_file) + tests_raw = [] + tests_args = [] + tests_and_line_numbers = [] + + input_file.rewind + source_raw = input_file.read + source_scrubbed = source_raw.gsub(/\/\/.*$/, '') # remove line comments + source_scrubbed = source_scrubbed.gsub(/\/\*.*?\*\//m, '') # remove block comments + lines = source_scrubbed.split(/(^\s*\#.*$) # Treat preprocessor directives as a logical line + | (;|\{|\}) /x) # Match ;, {, and } as end of lines + + lines.each_with_index do |line, index| + #find tests + if line =~ /^((?:\s*TEST_CASE\s*\(.*?\)\s*)*)\s*void\s+(test.*?)\s*\(\s*(.*)\s*\)/ + arguments = $1 + name = $2 + call = $3 + args = nil + if (@options[:use_param_tests] and !arguments.empty?) + args = [] + arguments.scan(/\s*TEST_CASE\s*\((.*)\)\s*$/) {|a| args << a[0]} + end + tests_and_line_numbers << { :name => name, :args => args, :call => call, :line_number => 0 } + tests_args = [] + end + end + + #determine line numbers and create tests to run + source_lines = source_raw.split("\n") + source_index = 0; + tests_and_line_numbers.size.times do |i| + source_lines[source_index..-1].each_with_index do |line, index| + if (line =~ /#{tests_and_line_numbers[i][:name]}/) + source_index += index + tests_and_line_numbers[i][:line_number] = source_index + 1 + break + end + end + end + + return tests_and_line_numbers + end + + def find_includes(input_file) + input_file.rewind + includes = [] + input_file.readlines.each do |line| + scan_results = line.scan(/^\s*#include\s+\"\s*(.+)\.[hH]\s*\"/) + includes << scan_results[0][0] if (scan_results.size > 0) + end + return includes + end + + def find_mocks(includes) + mock_headers = [] + includes.each do |include_file| + mock_headers << File.basename(include_file) if (include_file =~ /^mock/i) + end + return mock_headers + end + + def create_header(output, mocks) + output.puts('/* AUTOGENERATED FILE. DO NOT EDIT. */') + create_runtest(output, mocks) + output.puts("\n//=======Automagically Detected Files To Include=====") + output.puts("#include \"#{@options[:framework].to_s}.h\"") + output.puts('#include "cmock.h"') unless (mocks.empty?) + @options[:includes].flatten.uniq.compact.each do |inc| + output.puts("#include #{inc.include?('<') ? inc : "\"#{inc.gsub('.h','')}.h\""}") + end + output.puts('#include ') + output.puts('#include ') + output.puts('#include "CException.h"') if @options[:plugins].include?(:cexception) + mocks.each do |mock| + output.puts("#include \"#{mock.gsub('.h','')}.h\"") + end + if @options[:enforce_strict_ordering] + output.puts('') + output.puts('int GlobalExpectCount;') + output.puts('int GlobalVerifyOrder;') + output.puts('char* GlobalOrderError;') + end + end + + def create_externs(output, tests, mocks) + output.puts("\n//=======External Functions This Runner Calls=====") + output.puts("extern void setUp(void);") + output.puts("extern void tearDown(void);") + tests.each do |test| + output.puts("extern void #{test[:name]}(#{test[:call]});") + end + output.puts('') + end + + def create_mock_management(output, mocks) + unless (mocks.empty?) + output.puts("\n//=======Mock Management=====") + output.puts("static void CMock_Init(void)") + output.puts("{") + if @options[:enforce_strict_ordering] + output.puts(" GlobalExpectCount = 0;") + output.puts(" GlobalVerifyOrder = 0;") + output.puts(" GlobalOrderError = NULL;") + end + mocks.each do |mock| + output.puts(" #{mock}_Init();") + end + output.puts("}\n") + + output.puts("static void CMock_Verify(void)") + output.puts("{") + mocks.each do |mock| + output.puts(" #{mock}_Verify();") + end + output.puts("}\n") + + output.puts("static void CMock_Destroy(void)") + output.puts("{") + mocks.each do |mock| + output.puts(" #{mock}_Destroy();") + end + output.puts("}\n") + end + end + + def create_suite_setup_and_teardown(output) + unless (@options[:suite_setup].nil?) + output.puts("\n//=======Suite Setup=====") + output.puts("static int suite_setup(void)") + output.puts("{") + output.puts(@options[:suite_setup]) + output.puts("}") + end + unless (@options[:suite_teardown].nil?) + output.puts("\n//=======Suite Teardown=====") + output.puts("static int suite_teardown(int num_failures)") + output.puts("{") + output.puts(@options[:suite_teardown]) + output.puts("}") + end + end + + def create_runtest(output, used_mocks) + cexception = @options[:plugins].include? :cexception + va_args1 = @options[:use_param_tests] ? ', ...' : '' + va_args2 = @options[:use_param_tests] ? '__VA_ARGS__' : '' + output.puts("\n//=======Test Runner Used To Run Each Test Below=====") + output.puts("#define RUN_TEST_NO_ARGS") if @options[:use_param_tests] + output.puts("#define RUN_TEST(TestFunc, TestLineNum#{va_args1}) \\") + output.puts("{ \\") + output.puts(" Unity.CurrentTestName = #TestFunc#{va_args2.empty? ? '' : " \"(\" ##{va_args2} \")\""}; \\") + output.puts(" Unity.CurrentTestLineNumber = TestLineNum; \\") + output.puts(" Unity.NumberOfTests++; \\") + output.puts(" if (TEST_PROTECT()) \\") + output.puts(" { \\") + output.puts(" CEXCEPTION_T e; \\") if cexception + output.puts(" Try { \\") if cexception + output.puts(" CMock_Init(); \\") unless (used_mocks.empty?) + output.puts(" setUp(); \\") + output.puts(" TestFunc(#{va_args2}); \\") + output.puts(" CMock_Verify(); \\") unless (used_mocks.empty?) + output.puts(" } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, \"Unhandled Exception!\"); } \\") if cexception + output.puts(" } \\") + output.puts(" CMock_Destroy(); \\") unless (used_mocks.empty?) + output.puts(" if (TEST_PROTECT() && !TEST_IS_IGNORED) \\") + output.puts(" { \\") + output.puts(" tearDown(); \\") + output.puts(" } \\") + output.puts(" UnityConcludeTest(); \\") + output.puts("}\n") + end + + def create_reset(output, used_mocks) + output.puts("\n//=======Test Reset Option=====") + output.puts("void resetTest()") + output.puts("{") + output.puts(" CMock_Verify();") unless (used_mocks.empty?) + output.puts(" CMock_Destroy();") unless (used_mocks.empty?) + output.puts(" tearDown();") + output.puts(" CMock_Init();") unless (used_mocks.empty?) + output.puts(" setUp();") + output.puts("}") + end + + def create_main(output, filename, tests) + output.puts("\n\n//=======MAIN=====") + output.puts("int main(void)") + output.puts("{") + output.puts(" suite_setup();") unless @options[:suite_setup].nil? + output.puts(" Unity.TestFile = \"#{filename}\";") + output.puts(" UnityBegin();") + if (@options[:use_param_tests]) + tests.each do |test| + if ((test[:args].nil?) or (test[:args].empty?)) + output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]}, RUN_TEST_NO_ARGS);") + else + test[:args].each {|args| output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]}, #{args});")} + end + end + else + tests.each { |test| output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]});") } + end + output.puts() + output.puts(" return #{@options[:suite_teardown].nil? ? "" : "suite_teardown"}(UnityEnd());") + output.puts("}") + end +end + + +if ($0 == __FILE__) + options = { :includes => [] } + yaml_file = nil + + #parse out all the options first + ARGV.reject! do |arg| + case(arg) + when '-cexception' + options[:plugins] = [:cexception]; true + when /\.*\.yml/ + options = UnityTestRunnerGenerator.grab_config(arg); true + else false + end + end + + #make sure there is at least one parameter left (the input file) + if !ARGV[0] + puts ["usage: ruby #{__FILE__} (yaml) (options) input_test_file output_test_runner (includes)", + " blah.yml - will use config options in the yml file (see docs)", + " -cexception - include cexception support"].join("\n") + exit 1 + end + + #create the default test runner name if not specified + ARGV[1] = ARGV[0].gsub(".c","_Runner.c") if (!ARGV[1]) + + #everything else is an include file + options[:includes] ||= (ARGV.slice(2..-1).flatten.compact) if (ARGV.size > 2) + + UnityTestRunnerGenerator.new(options).run(ARGV[0], ARGV[1]) +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/test_file_filter.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/test_file_filter.rb new file mode 100644 index 0000000..3dbc26a --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/test_file_filter.rb @@ -0,0 +1,23 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require'yaml' + +module RakefileHelpers + class TestFileFilter + def initialize(all_files = false) + @all_files = all_files + if not @all_files == true + if File.exist?('test_file_filter.yml') + filters = YAML.load_file( 'test_file_filter.yml' ) + @all_files, @only_files, @exclude_files = + filters[:all_files], filters[:only_files], filters[:exclude_files] + end + end + end + attr_accessor :all_files, :only_files, :exclude_files + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/unity_test_summary.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/unity_test_summary.rb new file mode 100644 index 0000000..69ec2e8 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/auto/unity_test_summary.rb @@ -0,0 +1,126 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +#!/usr/bin/ruby +# +# unity_test_summary.rb +# +require 'fileutils' +require 'set' + +class UnityTestSummary + include FileUtils::Verbose + + attr_reader :report, :total_tests, :failures, :ignored + + def initialize + @report = '' + @total_tests = 0 + @failures = 0 + @ignored = 0 + end + + def run + # Clean up result file names + results = @targets.map {|target| target.gsub(/\\/,'/')} + + # Dig through each result file, looking for details on pass/fail: + failure_output = [] + ignore_output = [] + + results.each do |result_file| + lines = File.readlines(result_file).map { |line| line.chomp } + if lines.length == 0 + raise "Empty test result file: #{result_file}" + else + output = get_details(result_file, lines) + failure_output << output[:failures] unless output[:failures].empty? + ignore_output << output[:ignores] unless output[:ignores].empty? + tests,failures,ignored = parse_test_summary(lines) + @total_tests += tests + @failures += failures + @ignored += ignored + end + end + + if @ignored > 0 + @report += "\n" + @report += "--------------------------\n" + @report += "UNITY IGNORED TEST SUMMARY\n" + @report += "--------------------------\n" + @report += ignore_output.flatten.join("\n") + end + + if @failures > 0 + @report += "\n" + @report += "--------------------------\n" + @report += "UNITY FAILED TEST SUMMARY\n" + @report += "--------------------------\n" + @report += failure_output.flatten.join("\n") + end + + @report += "\n" + @report += "--------------------------\n" + @report += "OVERALL UNITY TEST SUMMARY\n" + @report += "--------------------------\n" + @report += "#{@total_tests} TOTAL TESTS #{@failures} TOTAL FAILURES #{@ignored} IGNORED\n" + @report += "\n" + end + + def set_targets(target_array) + @targets = target_array + end + + def set_root_path(path) + @root = path + end + + def usage(err_msg=nil) + puts err_msg if err_msg + puts "Usage: unity_test_summary.rb" + exit 1 + end + + protected + + @@targets=nil + @@path=nil + @@root=nil + + def get_details(result_file, lines) + results = { :failures => [], :ignores => [], :successes => [] } + lines.each do |line| + src_file,src_line,test_name,status,msg = line.split(/:/) + line_out = ((@root and (@root != 0)) ? "#{@root}#{line}" : line ).gsub(/\//, "\\") + case(status) + when 'IGNORE' then results[:ignores] << line_out + when 'FAIL' then results[:failures] << line_out + when 'PASS' then results[:successes] << line_out + end + end + return results + end + + def parse_test_summary(summary) + if summary[-3..-1].join("\n") =~ /(\d+) Tests (\d+) Failures (\d+) Ignored/ + [$1.to_i,$2.to_i,$3.to_i] + else + raise "Couldn't parse test results: #{summary}" + end + end + + def here; File.expand_path(File.dirname(__FILE__)); end + +end + +if $0 == __FILE__ + script = UnityTestSummary.new + begin + script.run + rescue Exception => e + script.usage e.message + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/docs/Unity Summary.odt b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/docs/Unity Summary.odt new file mode 100644 index 0000000..f699661 Binary files /dev/null and b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/docs/Unity Summary.odt differ diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/docs/Unity Summary.pdf b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/docs/Unity Summary.pdf new file mode 100644 index 0000000..ad1a956 Binary files /dev/null and b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/docs/Unity Summary.pdf differ diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/docs/Unity Summary.txt b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/docs/Unity Summary.txt new file mode 100644 index 0000000..e0b179d --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/docs/Unity Summary.txt @@ -0,0 +1,217 @@ +============== +Unity Test API +============== + +[Copyright (c) 2007 - Unity Project by Mike Karlesky, Mark VanderVoord, and Greg Williams] + +------------- +Running Tests +------------- + +RUN_TEST(func, linenum) + +Each Test is run within the macro RUN_TEST. This macro performs necessary setup before the test is called and handles cleanup and result tabulation afterwards. + +-------------- +Ignoring Tests +-------------- + +There are times when a test is incomplete or not valid for some reason. At these times, TEST_IGNORE can be called. Control will immediately be returned to the caller of the test, and no failures will be returned. + +TEST_IGNORE() + +Ignore this test and return immediately + +TEST_IGNORE_MESSAGE (message) + +Ignore this test and return immediately. Output a message stating why the test was ignored. + +-------------- +Aborting Tests +-------------- + +There are times when a test will contain an infinite loop on error conditions, or there may be reason to escape from the test early without executing the rest of the test. A pair of macros support this functionality in Unity. The first (TEST_PROTECT) sets up the feature, and handles emergency abort cases. TEST_ABORT can then be used at any time within the tests to return to the last TEST_PROTECT call. + +TEST_PROTECT() + +Setup and Catch macro + +TEST_ABORT() + +Abort Test macro + +Example: + +main() +{ + if (TEST_PROTECT() == 0) + { + MyTest(); + } +} + +If MyTest calls TEST_ABORT, program control will immediately return to TEST_PROTECT with a non-zero return value. + + +======================= +Unity Assertion Summary +======================= + +-------------------- +Basic Validity Tests +-------------------- + +TEST_ASSERT_TRUE(condition) + +Evaluates whatever code is in condition and fails if it evaluates to false + +TEST_ASSERT_FALSE(condition) + +Evaluates whatever code is in condition and fails if it evaluates to true + +TEST_ASSERT(condition) + +Another way of calling TEST_ASSERT_TRUE + +TEST_ASSERT_UNLESS(condition) + +Another way of calling TEST_ASSERT_FALSE + +TEST_FAIL() +TEST_FAIL_MESSAGE(message) + +This test is automatically marked as a failure. The message is output stating why. + +------------------------------ +Numerical Assertions: Integers +------------------------------ + +TEST_ASSERT_EQUAL_INT(expected, actual) +TEST_ASSERT_EQUAL_INT8(expected, actual) +TEST_ASSERT_EQUAL_INT16(expected, actual) +TEST_ASSERT_EQUAL_INT32(expected, actual) +TEST_ASSERT_EQUAL_INT64(expected, actual) + +Compare two integers for equality and display errors as signed integers. A cast will be performed +to your natural integer size so often this can just be used. When you need to specify the exact size, +like when comparing arrays, you can use a specific version: + + + +TEST_ASSERT_EQUAL_UINT(expected, actual) + +Compare two integers for equality and display errors as unsigned integers. Like INT, there are +variants for different sizes also. + + + +TEST_ASSERT_EQUAL_HEX(expected, actual) + +Compares two integers for equality and display errors as hexadecimal. Like the other integer comparisons, +you can specify the size... here the size will also effect how many nibbles are shown (for example, HEX16 +will show 4 nibbles). + +_ARRAY + +You can append _ARRAY to any of these macros to make an array comparison of that type. Here you will +need to care a bit more about the actual size of the value being checked. You will also specify an +additional argument which is the number of elements to compare. For example: + +TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, elements) + + +TEST_ASSERT_EQUAL(expected, actual) + +Another way of calling TEST_ASSERT_EQUAL_INT + + + +TEST_ASSERT_INT_WITHIN(delta, expected, actual) + +Asserts that the actual value is within plus or minus delta of the expected value. This also comes in +size specific variants. + + +----------------------------- +Numerical Assertions: Bitwise +----------------------------- + +TEST_ASSERT_BITS(mask, expected, actual) + +Use an integer mask to specify which bits should be compared between two other integers. High bits in the mask are compared, low bits ignored. + +TEST_ASSERT_BITS_HIGH(mask, actual) + +Use an integer mask to specify which bits should be inspected to determine if they are all set high. High bits in the mask are compared, low bits ignored. + +TEST_ASSERT_BITS_LOW(mask, actual) + +Use an integer mask to specify which bits should be inspected to determine if they are all set low. High bits in the mask are compared, low bits ignored. + +TEST_ASSERT_BIT_HIGH(bit, actual) + +Test a single bit and verify that it is high. The bit is specified 0-31 for a 32-bit integer. + +TEST_ASSERT_BIT_LOW(bit, actual) + +Test a single bit and verify that it is low. The bit is specified 0-31 for a 32-bit integer. + +---------------------------- +Numerical Assertions: Floats +---------------------------- + +TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual) + +Asserts that the actual value is within plus or minus delta of the expected value. + +TEST_ASSERT_EQUAL_FLOAT(expected, actual) + +Asserts that two floating point values are "equal" within a small % delta of the expected value. + +----------------- +String Assertions +----------------- + +TEST_ASSERT_EQUAL_STRING(expected, actual) + +Compare two null-terminate strings. Fail if any character is different or if the lengths are different. + +TEST_ASSERT_EQUAL_STRING_MESSAGE(expected, actual, message) + +Compare two null-terminate strings. Fail if any character is different or if the lengths are different. Output a custom message on failure. + +------------------ +Pointer Assertions +------------------ + +Most pointer operations can be performed by simply using the integer comparisons above. However, a couple of special cases are added for clarity. + +TEST_ASSERT_NULL(pointer) + +Fails if the pointer is not equal to NULL + +TEST_ASSERT_NOT_NULL(pointer) + +Fails if the pointer is equal to NULL + + +----------------- +Memory Assertions +----------------- + +TEST_ASSERT_EQUAL_MEMORY(expected, actual, len) + +Compare two blocks of memory. This is a good generic assertion for types that can't be coerced into acting like +standard types... but since it's a memory compare, you have to be careful that your data types are packed. + +-------- +_MESSAGE +-------- + +you can append _MESSAGE to any of the macros to make them take an additional argument. This argument +is a string that will be printed at the end of the failure strings. This is useful for specifying more +information about the problem. + + + + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/docs/license.txt b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/docs/license.txt new file mode 100644 index 0000000..c42e330 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/docs/license.txt @@ -0,0 +1,31 @@ + Copyright (c) 2007-2010 Mike Karlesky, Mark VanderVoord, Greg Williams + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + The end-user documentation included with the redistribution, if + any, must include the following acknowledgment: "This product + includes software developed for the Unity Project, by Mike Karlesky, + Mark VanderVoord, and Greg Williams and other contributors", in + the same place and form as other third-party acknowledgments. + Alternately, this acknowledgment may appear in the software + itself, in the same form and location as other such third-party + acknowledgments. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.c new file mode 100644 index 0000000..9cf42c6 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.c @@ -0,0 +1,10 @@ +#include "unity.h" +#include "UnityHelper.h" +#include +#include + +void AssertEqualExampleStruct(const EXAMPLE_STRUCT_T expected, const EXAMPLE_STRUCT_T actual, const unsigned short line) +{ + UNITY_TEST_ASSERT_EQUAL_INT(expected.x, actual.x, line, "Example Struct Failed For Field x"); + UNITY_TEST_ASSERT_EQUAL_INT(expected.y, actual.y, line, "Example Struct Failed For Field y"); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.h new file mode 100644 index 0000000..1516111 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.h @@ -0,0 +1,12 @@ +#ifndef _TESTHELPER_H +#define _TESTHELPER_H + +#include "Types.h" + +void AssertEqualExampleStruct(const EXAMPLE_STRUCT_T expected, const EXAMPLE_STRUCT_T actual, const unsigned short line); + +#define UNITY_TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(expected, actual, line, message) AssertEqualExampleStruct(expected, actual, line); + +#define TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(expected, actual) UNITY_TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(expected, actual, __LINE__, NULL); + +#endif // _TESTHELPER_H diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/makefile b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/makefile new file mode 100644 index 0000000..723d390 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/makefile @@ -0,0 +1,40 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +C_COMPILER=gcc +TARGET_BASE1=test1 +TARGET_BASE2=test2 +ifeq ($(OS),Windows_NT) + TARGET_EXTENSION=.exe +else + TARGET_EXTENSION=.out +endif +TARGET1 = $(TARGET_BASE1)$(TARGET_EXTENSION) +TARGET2 = $(TARGET_BASE2)$(TARGET_EXTENSION) +SRC_FILES1=../src/unity.c src/ProductionCode.c test/TestProductionCode.c test/no_ruby/TestProductionCode_Runner.c +SRC_FILES2=../src/unity.c src/ProductionCode2.c test/TestProductionCode2.c test/no_ruby/TestProductionCode2_Runner.c +INC_DIRS=-Isrc -I../src +SYMBOLS=-DTEST + +ifeq ($(OS),Windows_NT) + CLEANUP = del /F /Q build\* && del /F /Q $(TARGET1) && del /F /Q $(TARGET2) +else + CLEANUP = rm -f build/*.o ; rm -f $(TARGET1) ; rm -f $(TARGET2) +endif + +all: clean default + +default: +# ruby auto/generate_test_runner.rb test/TestProductionCode.c test/no_ruby/TestProductionCode_Runner.c +# ruby auto/generate_test_runner.rb test/TestProductionCode2.c test/no_ruby/TestProductionCode2_Runner.c + $(C_COMPILER) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES1) -o $(TARGET1) + $(C_COMPILER) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES2) -o $(TARGET2) + $(TARGET1) + $(TARGET2) + +clean: + $(CLEANUP) + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/rakefile.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/rakefile.rb new file mode 100644 index 0000000..0905b4b --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/rakefile.rb @@ -0,0 +1,32 @@ +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require HERE+'rakefile_helper' + +include RakefileHelpers + +# Load default configuration, for now +DEFAULT_CONFIG_FILE = 'gcc.yml' +configure_toolchain(DEFAULT_CONFIG_FILE) + +task :unit do + run_tests get_unit_test_files +end + +desc "Generate test summary" +task :summary do + report_summary +end + +desc "Build and test Unity" +task :all => [:clean, :unit, :summary] +task :default => [:clobber, :all] +task :ci => [:default] +task :cruise => [:default] + +desc "Load configuration" +task :config, :config_file do |t, args| + configure_toolchain(args[:config_file]) +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/rakefile_helper.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/rakefile_helper.rb new file mode 100644 index 0000000..0127d69 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/rakefile_helper.rb @@ -0,0 +1,260 @@ +require 'yaml' +require 'fileutils' +require HERE+'../auto/unity_test_summary' +require HERE+'../auto/generate_test_runner' +require HERE+'../auto/colour_reporter' + +module RakefileHelpers + + C_EXTENSION = '.c' + + def load_configuration(config_file) + $cfg_file = "../targets/#{config_file}" + $cfg = YAML.load(File.read($cfg_file)) + end + + def configure_clean + CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil? + end + + def configure_toolchain(config_file=DEFAULT_CONFIG_FILE) + config_file += '.yml' unless config_file =~ /\.yml$/ + load_configuration('../targets/'+config_file) + configure_clean + end + + def get_unit_test_files + path = $cfg['compiler']['unit_tests_path'] + 'Test*' + C_EXTENSION + path.gsub!(/\\/, '/') + FileList.new(path) + end + + def get_local_include_dirs + include_dirs = $cfg['compiler']['includes']['items'].dup + include_dirs.delete_if {|dir| dir.is_a?(Array)} + return include_dirs + end + + def extract_headers(filename) + includes = [] + lines = File.readlines(filename) + lines.each do |line| + m = line.match(/^\s*#include\s+\"\s*(.+\.[hH])\s*\"/) + if not m.nil? + includes << m[1] + end + end + return includes + end + + def find_source_file(header, paths) + paths.each do |dir| + src_file = dir + header.ext(C_EXTENSION) + if (File.exists?(src_file)) + return src_file + end + end + return nil + end + + def tackit(strings) + if strings.is_a?(Array) + result = "\"#{strings.join}\"" + else + result = strings + end + return result + end + + def squash(prefix, items) + result = '' + items.each { |item| result += " #{prefix}#{tackit(item)}" } + return result + end + + def build_compiler_fields + command = tackit($cfg['compiler']['path']) + if $cfg['compiler']['defines']['items'].nil? + defines = '' + else + defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items']) + end + options = squash('', $cfg['compiler']['options']) + includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :defines => defines, :options => options, :includes => includes} + end + + def compile(file, defines=[]) + compiler = build_compiler_fields + cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{file} " + + "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" + + "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" + execute(cmd_str) + end + + def build_linker_fields + command = tackit($cfg['linker']['path']) + if $cfg['linker']['options'].nil? + options = '' + else + options = squash('', $cfg['linker']['options']) + end + if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?) + includes = '' + else + includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) + end + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :options => options, :includes => includes} + end + + def link(exe_name, obj_list) + linker = build_linker_fields + cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + + (obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).join + + $cfg['linker']['bin_files']['prefix'] + ' ' + + $cfg['linker']['bin_files']['destination'] + + exe_name + $cfg['linker']['bin_files']['extension'] + execute(cmd_str) + end + + def build_simulator_fields + return nil if $cfg['simulator'].nil? + if $cfg['simulator']['path'].nil? + command = '' + else + command = (tackit($cfg['simulator']['path']) + ' ') + end + if $cfg['simulator']['pre_support'].nil? + pre_support = '' + else + pre_support = squash('', $cfg['simulator']['pre_support']) + end + if $cfg['simulator']['post_support'].nil? + post_support = '' + else + post_support = squash('', $cfg['simulator']['post_support']) + end + return {:command => command, :pre_support => pre_support, :post_support => post_support} + end + + def execute(command_string, verbose=true, raise_on_fail=true) + report command_string + output = `#{command_string}`.chomp + report(output) if (verbose && !output.nil? && (output.length > 0)) + if (($?.exitstatus != 0) and (raise_on_fail)) + raise "Command failed. (Returned #{$?.exitstatus})" + end + return output + end + + def report_summary + summary = UnityTestSummary.new + summary.set_root_path(HERE) + results_glob = "#{$cfg['compiler']['build_path']}*.test*" + results_glob.gsub!(/\\/, '/') + results = Dir[results_glob] + summary.set_targets(results) + summary.run + fail_out "FAIL: There were failures" if (summary.failures > 0) + end + + def run_tests(test_files) + + report 'Running system tests...' + + # Tack on TEST define for compiling unit tests + load_configuration($cfg_file) + test_defines = ['TEST'] + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + $cfg['compiler']['defines']['items'] << 'TEST' + + include_dirs = get_local_include_dirs + + # Build and execute each unit test + test_files.each do |test| + obj_list = [] + + # Detect dependencies and build required required modules + extract_headers(test).each do |header| + # Compile corresponding source file if it exists + src_file = find_source_file(header, include_dirs) + if !src_file.nil? + compile(src_file, test_defines) + obj_list << header.ext($cfg['compiler']['object_files']['extension']) + end + end + + # Build the test runner (generate if configured to do so) + test_base = File.basename(test, C_EXTENSION) + runner_name = test_base + '_Runner.c' + if $cfg['compiler']['runner_path'].nil? + runner_path = $cfg['compiler']['build_path'] + runner_name + test_gen = UnityTestRunnerGenerator.new($cfg_file) + test_gen.run(test, runner_path) + else + runner_path = $cfg['compiler']['runner_path'] + runner_name + end + + compile(runner_path, test_defines) + obj_list << runner_name.ext($cfg['compiler']['object_files']['extension']) + + # Build the test module + compile(test, test_defines) + obj_list << test_base.ext($cfg['compiler']['object_files']['extension']) + + # Link the test executable + link(test_base, obj_list) + + # Execute unit test and generate results file + simulator = build_simulator_fields + executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] + if simulator.nil? + cmd_str = executable + else + cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" + end + output = execute(cmd_str, true, false) + test_results = $cfg['compiler']['build_path'] + test_base + if output.match(/OK$/m).nil? + test_results += '.testfail' + else + test_results += '.testpass' + end + File.open(test_results, 'w') { |f| f.print output } + end + end + + def build_application(main) + + report "Building application..." + + obj_list = [] + load_configuration($cfg_file) + main_path = $cfg['compiler']['source_path'] + main + C_EXTENSION + + # Detect dependencies and build required required modules + include_dirs = get_local_include_dirs + extract_headers(main_path).each do |header| + src_file = find_source_file(header, include_dirs) + if !src_file.nil? + compile(src_file) + obj_list << header.ext($cfg['compiler']['object_files']['extension']) + end + end + + # Build the main source file + main_base = File.basename(main_path, C_EXTENSION) + compile(main_path) + obj_list << main_base.ext($cfg['compiler']['object_files']['extension']) + + # Create the executable + link(main_base, obj_list) + end + + def fail_out(msg) + puts msg + exit(-1) + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/readme.txt b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/readme.txt new file mode 100644 index 0000000..6c7780e --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/readme.txt @@ -0,0 +1,18 @@ +Example Project + +This example project gives an example of some passing, ignored, and failing tests. +It's simple and meant for you to look over and get an idea for what all of this stuff does. + +You can build and test using the makefile if you have gcc installed (you may need to tweak +the locations of some tools in the makefile). Otherwise, the rake version will let you +test with gcc or a couple versions of IAR. You can tweak the yaml files to get those versions +running. + +Ruby is required if you're using the rake version (obviously). This version shows off most of +Unity's advanced features (automatically creating test runners, fancy summaries, etc.) + +The makefile version doesn't require anything outside of your normal build tools, but won't do the +extras for you. So that you can test right away, we've written the test runners for you and +put them in the test\no_ruby subdirectory. If you make changes to the tests or source, you might +need to update these (like when you add or remove tests). Do that for a while and you'll learn +why you really want to start using the Ruby tools. \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/src/ProductionCode.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/src/ProductionCode.c new file mode 100644 index 0000000..500b44b --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/src/ProductionCode.c @@ -0,0 +1,24 @@ + +#include "ProductionCode.h" + +int Counter = 0; +int NumbersToFind[9] = { 0, 34, 55, 66, 32, 11, 1, 77, 888 }; //some obnoxious array to search that is 1-based indexing instead of 0. + +// This function is supposed to search through NumbersToFind and find a particular number. +// If it finds it, the index is returned. Otherwise 0 is returned which sorta makes sense since +// NumbersToFind is indexed from 1. Unfortunately it's broken +// (and should therefore be caught by our tests) +int FindFunction_WhichIsBroken(int NumberToFind) +{ + int i = 0; + while (i <= 8) //Notice I should have been in braces + i++; + if (NumbersToFind[i] == NumberToFind) //Yikes! I'm getting run after the loop finishes instead of during it! + return i; + return 0; +} + +int FunctionWhichReturnsLocalVariable(void) +{ + return Counter; +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/src/ProductionCode.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/src/ProductionCode.h new file mode 100644 index 0000000..250ca0d --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/src/ProductionCode.h @@ -0,0 +1,3 @@ + +int FindFunction_WhichIsBroken(int NumberToFind); +int FunctionWhichReturnsLocalVariable(void); diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/src/ProductionCode2.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/src/ProductionCode2.c new file mode 100644 index 0000000..a8c72e1 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/src/ProductionCode2.c @@ -0,0 +1,9 @@ + +#include "ProductionCode2.h" + +char* ThisFunctionHasNotBeenTested(int Poor, char* LittleFunction) +{ + //Since There Are No Tests Yet, This Function Could Be Empty For All We Know. + // Which isn't terribly useful... but at least we put in a TEST_IGNORE so we won't forget + return (char*)0; +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/src/ProductionCode2.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/src/ProductionCode2.h new file mode 100644 index 0000000..34ae980 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/src/ProductionCode2.h @@ -0,0 +1,2 @@ + +char* ThisFunctionHasNotBeenTested(int Poor, char* LittleFunction); diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/test/TestProductionCode.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/test/TestProductionCode.c new file mode 100644 index 0000000..28a5581 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/test/TestProductionCode.c @@ -0,0 +1,62 @@ + +#include "ProductionCode.h" +#include "unity.h" + +//sometimes you may want to get at local data in a module. +//for example: If you plan to pass by reference, this could be useful +//however, it should often be avoided +extern int Counter; + +void setUp(void) +{ + //This is run before EACH TEST + Counter = 0x5a5a; +} + +void tearDown(void) +{ +} + +void test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode(void) +{ + //All of these should pass + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(78)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(1)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(33)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(999)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(-1)); +} + +void test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken(void) +{ + // You should see this line fail in your test summary + TEST_ASSERT_EQUAL(1, FindFunction_WhichIsBroken(34)); + + // Notice the rest of these didn't get a chance to run because the line above failed. + // Unit tests abort each test function on the first sign of trouble. + // Then NEXT test function runs as normal. + TEST_ASSERT_EQUAL(8, FindFunction_WhichIsBroken(8888)); +} + +void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue(void) +{ + //This should be true because setUp set this up for us before this test + TEST_ASSERT_EQUAL_HEX(0x5a5a, FunctionWhichReturnsLocalVariable()); + + //This should be true because we can still change our answer + Counter = 0x1234; + TEST_ASSERT_EQUAL_HEX(0x1234, FunctionWhichReturnsLocalVariable()); +} + +void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain(void) +{ + //This should be true again because setup was rerun before this test (and after we changed it to 0x1234) + TEST_ASSERT_EQUAL_HEX(0x5a5a, FunctionWhichReturnsLocalVariable()); +} + +void test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed(void) +{ + //Sometimes you get the test wrong. When that happens, you get a failure too... and a quick look should tell + // you what actually happened...which in this case was a failure to setup the initial condition. + TEST_ASSERT_EQUAL_HEX(0x1234, FunctionWhichReturnsLocalVariable()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/test/TestProductionCode2.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/test/TestProductionCode2.c new file mode 100644 index 0000000..20c9251 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/test/TestProductionCode2.c @@ -0,0 +1,26 @@ + +#include "ProductionCode2.h" +#include "unity.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void test_IgnoredTest(void) +{ + TEST_IGNORE_MESSAGE("This Test Was Ignored On Purpose"); +} + +void test_AnotherIgnoredTest(void) +{ + TEST_IGNORE_MESSAGE("These Can Be Useful For Leaving Yourself Notes On What You Need To Do Yet"); +} + +void test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented(void) +{ + TEST_IGNORE(); //Like This +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode2_Runner.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode2_Runner.c new file mode 100644 index 0000000..56515ae --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode2_Runner.c @@ -0,0 +1,46 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ +#include "unity.h" +#include +#include + +char MessageBuffer[50]; + +extern void setUp(void); +extern void tearDown(void); + +extern void test_IgnoredTest(void); +extern void test_AnotherIgnoredTest(void); +extern void test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented(void); + +static void runTest(UnityTestFunction test) +{ + if (TEST_PROTECT()) + { + setUp(); + test(); + } + if (TEST_PROTECT() && !TEST_IS_IGNORED) + { + tearDown(); + } +} +void resetTest() +{ + tearDown(); + setUp(); +} + + +int main(void) +{ + Unity.TestFile = "test/TestProductionCode2.c"; + UnityBegin(); + + // RUN_TEST calls runTest + RUN_TEST(test_IgnoredTest, 13); + RUN_TEST(test_AnotherIgnoredTest, 18); + RUN_TEST(test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented, 23); + + UnityEnd(); + return 0; +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode_Runner.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode_Runner.c new file mode 100644 index 0000000..64112f3 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode_Runner.c @@ -0,0 +1,50 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ +#include "unity.h" +#include +#include + +char MessageBuffer[50]; + +extern void setUp(void); +extern void tearDown(void); + +extern void test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode(void); +extern void test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken(void); +extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue(void); +extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain(void); +extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed(void); + +static void runTest(UnityTestFunction test) +{ + if (TEST_PROTECT()) + { + setUp(); + test(); + } + if (TEST_PROTECT() && !TEST_IS_IGNORED) + { + tearDown(); + } +} +void resetTest() +{ + tearDown(); + setUp(); +} + + +int main(void) +{ + Unity.TestFile = "test/TestProductionCode.c"; + UnityBegin(); + + // RUN_TEST calls runTest + RUN_TEST(test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode, 20); + RUN_TEST(test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken, 30); + RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue, 41); + RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain, 51); + RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed, 57); + + UnityEnd(); + return 0; +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/build/MakefileWorker.mk b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/build/MakefileWorker.mk new file mode 100644 index 0000000..9948751 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/build/MakefileWorker.mk @@ -0,0 +1,331 @@ +#--------- +# +# MakefileWorker.mk +# +# Include this helper file in your makefile +# It makes +# A static library holding the application objs +# A test executable +# +# See this example for parameter settings +# examples/Makefile +# +#---------- +# Inputs - these variables describe what to build +# +# INCLUDE_DIRS - Directories used to search for include files. +# This generates a -I for each directory +# SRC_DIRS - Directories containing source file to built into the library +# SRC_FILES - Specific source files to build into library. Helpful when not all code +# in a directory can be built for test (hopefully a temporary situation) +# TEST_SRC_DIRS - Directories containing unit test code build into the unit test runner +# These do not go in a library. They are explicitly included in the test runner +# MOCKS_SRC_DIRS - Directories containing mock source files to build into the test runner +# These do not go in a library. They are explicitly included in the test runner +#---------- +# You can adjust these variables to influence how to build the test target +# and where to put and name outputs +# See below to determine defaults +# COMPONENT_NAME - the name of the thing being built +# UNITY_HOME - where Unity home dir found +# UNITY_BUILD_HOME - place for scripts +# UNITY_OBJS_DIR - a directory where o and d files go +# UNITY_LIB_DIR - a directory where libs go +# UNITY_ENABLE_DEBUG - build for debug +# UNITY_USE_MEM_LEAK_DETECTION - Links with overridden new and delete +# UNITY_USE_STD_CPP_LIB - Set to N to keep the standard C++ library out +# of the test harness +# UNITY_USE_GCOV - Turn on coverage analysis +# Clean then build with this flag set to Y, then 'make gcov' +# UNITY_TEST_RUNNER_FLAGS +# None by default +# UNITY_MAPFILE - generate a map file +# UNITY_WARNINGFLAGS - overly picky by default +# OTHER_MAKEFILE_TO_INCLUDE - a hook to use this makefile to make +# other targets. Like CSlim, which is part of fitnesse +#---------- +# +# Other flags users can initialize to sneak in their settings +# UNITY_CFLAGS - C complier +# UNITY_LDFLAGS - Linker flags +#---------- + + +ifndef COMPONENT_NAME + COMPONENT_NAME = name_this_in_the_makefile +endif + +# Debug on by default +ifndef UNITY_ENABLE_DEBUG + UNITY_ENABLE_DEBUG = Y +endif + +# new and delete for memory leak detection on by default +ifndef UNITY_USE_MEM_LEAK_DETECTION + UNITY_USE_MEM_LEAK_DETECTION = Y +endif + +# Use gcov, off by default +ifndef UNITY_USE_GCOV + UNITY_USE_GCOV = N +endif + +# Default warnings +ifndef UNITY_WARNINGFLAGS + UNITY_WARNINGFLAGS = -Wall -Werror -Wshadow -Wswitch-default +endif + +# Default dir for temporary files (d, o) +ifndef UNITY_OBJS_DIR + UNITY_OBJS_DIR = objs +endif + +# Default dir for the outout library +ifndef UNITY_LIB_DIR + UNITY_LIB_DIR = lib +endif + +# No map by default +ifndef UNITY_MAP_FILE + UNITY_MAP_FILE = N +endif + +#Not verbose by deafult +ifdef VERBOSE + UNITY_TEST_RUNNER_FLAGS += -v +endif + +ifdef GROUP + UNITY_TEST_RUNNER_FLAGS += -g $(GROUP) +endif + +ifdef NAME + UNITY_TEST_RUNNER_FLAGS += -n $(NAME) +endif + +ifdef REPEAT + UNITY_TEST_RUNNER_FLAGS += -r $(REPEAT) +endif + + +# -------------------------------------- +# derived flags in the following area +# -------------------------------------- +ifeq ($(UNITY_USE_MEM_LEAK_DETECTION), N) + UNITY_CFLAGS += -DUNITY_MEM_LEAK_DETECTION_DISABLED +else + UNITY_MEMLEAK_DETECTOR_MALLOC_MACRO_FILE = -include $(UNITY_HOME)/extras/fixture/src/unity_fixture_malloc_overrides.h +endif + +ifeq ($(UNITY_ENABLE_DEBUG), Y) + UNITY_CFLAGS += -g +endif + +ifeq ($(UNITY_USE_GCOV), Y) + UNITY_CFLAGS += -fprofile-arcs -ftest-coverage +endif + +UNITY_CFLAGS += $(UNITY_MEMLEAK_DETECTOR_MALLOC_MACRO_FILE) + +TARGET_MAP = $(COMPONENT_NAME).map.txt +ifeq ($(UNITY_MAP_FILE), Y) + UNITY_LDFLAGS += -Wl,-map,$(TARGET_MAP) +endif + +LD_LIBRARIES += -lgcov + +TARGET_LIB = \ + $(UNITY_LIB_DIR)/lib$(COMPONENT_NAME).a + +TEST_TARGET = \ + $(COMPONENT_NAME)_tests + +#Helper Functions +get_src_from_dir = $(wildcard $1/*.cpp) $(wildcard $1/*.c) +get_dirs_from_dirspec = $(wildcard $1) +get_src_from_dir_list = $(foreach dir, $1, $(call get_src_from_dir,$(dir))) +__src_to = $(subst .c,$1, $(subst .cpp,$1,$2)) +src_to = $(addprefix $(UNITY_OBJS_DIR)/,$(call __src_to,$1,$2)) +src_to_o = $(call src_to,.o,$1) +src_to_d = $(call src_to,.d,$1) +src_to_gcda = $(call src_to,.gcda,$1) +src_to_gcno = $(call src_to,.gcno,$1) +make_dotdot_a_subdir = $(subst ..,_dot_dot, $1) +time = $(shell date +%s) +delta_t = $(eval minus, $1, $2) +debug_print_list = $(foreach word,$1,echo " $(word)";) echo; + +#Derived +STUFF_TO_CLEAN += $(TEST_TARGET) $(TEST_TARGET).exe $(TARGET_LIB) $(TARGET_MAP) + +SRC += $(call get_src_from_dir_list, $(SRC_DIRS)) $(SRC_FILES) +OBJ = $(call src_to_o,$(SRC)) +OBJ2 = $(call make_dotdot_a_subdir. $(OBJ)) + +STUFF_TO_CLEAN += $(OBJ) + +TEST_SRC = $(call get_src_from_dir_list, $(TEST_SRC_DIRS)) +TEST_OBJS = $(call src_to_o,$(TEST_SRC)) +STUFF_TO_CLEAN += $(TEST_OBJS) + + +MOCKS_SRC = $(call get_src_from_dir_list, $(MOCKS_SRC_DIRS)) +MOCKS_OBJS = $(call src_to_o,$(MOCKS_SRC)) +STUFF_TO_CLEAN += $(MOCKS_OBJS) + +ALL_SRC = $(SRC) $(TEST_SRC) $(MOCKS_SRC) + +#Test coverage with gcov +GCOV_OUTPUT = gcov_output.txt +GCOV_REPORT = gcov_report.txt +GCOV_ERROR = gcov_error.txt +GCOV_GCDA_FILES = $(call src_to_gcda, $(ALL_SRC)) +GCOV_GCNO_FILES = $(call src_to_gcno, $(ALL_SRC)) +TEST_OUTPUT = $(TEST_TARGET).txt +STUFF_TO_CLEAN += \ + $(GCOV_OUTPUT)\ + $(GCOV_REPORT)\ + $(GCOV_REPORT).html\ + $(GCOV_ERROR)\ + $(GCOV_GCDA_FILES)\ + $(GCOV_GCNO_FILES)\ + $(TEST_OUTPUT) + + +#The gcda files for gcov need to be deleted before each run +#To avoid annoying messages. +GCOV_CLEAN = $(SILENCE)rm -f $(GCOV_GCDA_FILES) $(GCOV_OUTPUT) $(GCOV_REPORT) $(GCOV_ERROR) +RUN_TEST_TARGET = $(SILENCE) $(GCOV_CLEAN) ; echo "Running $(TEST_TARGET)"; ./$(TEST_TARGET) $(UNITY_TEST_RUNNER_FLAGS) + +INCLUDES_DIRS_EXPANDED = $(call get_dirs_from_dirspec, $(INCLUDE_DIRS)) +INCLUDES += $(foreach dir, $(INCLUDES_DIRS_EXPANDED), -I$(dir)) +MOCK_DIRS_EXPANDED = $(call get_dirs_from_dirspec, $(MOCKS_SRC_DIRS)) +INCLUDES += $(foreach dir, $(MOCK_DIRS_EXPANDED), -I$(dir)) + + +DEP_FILES = $(call src_to_d, $(ALL_SRC)) +STUFF_TO_CLEAN += $(DEP_FILES) $(PRODUCTION_CODE_START) $(PRODUCTION_CODE_END) +STUFF_TO_CLEAN += $(STDLIB_CODE_START) $(MAP_FILE) cpputest_*.xml junit_run_output + +# We'll use the UNITY_CFLAGS etc so that you can override AND add to the CppUTest flags +CFLAGS = $(UNITY_CFLAGS) $(UNITY_ADDITIONAL_CFLAGS) $(INCLUDES) $(UNITY_WARNINGFLAGS) +LDFLAGS = $(UNITY_LDFLAGS) $(UNITY_ADDITIONAL_LDFLAGS) + +# Targets + +.PHONY: all +all: start $(TEST_TARGET) + $(RUN_TEST_TARGET) + +.PHONY: start +start: $(TEST_TARGET) + $(SILENCE)START_TIME=$(call time) + +.PHONY: all_no_tests +all_no_tests: $(TEST_TARGET) + +.PHONY: flags +flags: + @echo + @echo "Compile C source with CFLAGS:" + @$(call debug_print_list,$(CFLAGS)) + @echo "Link with LDFLAGS:" + @$(call debug_print_list,$(LDFLAGS)) + @echo "Link with LD_LIBRARIES:" + @$(call debug_print_list,$(LD_LIBRARIES)) + @echo "Create libraries with ARFLAGS:" + @$(call debug_print_list,$(ARFLAGS)) + @echo "OBJ files:" + @$(call debug_print_list,$(OBJ2)) + + +$(TEST_TARGET): $(TEST_OBJS) $(MOCKS_OBJS) $(PRODUCTION_CODE_START) $(TARGET_LIB) $(USER_LIBS) $(PRODUCTION_CODE_END) $(STDLIB_CODE_START) + $(SILENCE)echo Linking $@ + $(SILENCE)$(LINK.o) -o $@ $^ $(LD_LIBRARIES) + +$(TARGET_LIB): $(OBJ) + $(SILENCE)echo Building archive $@ + $(SILENCE)mkdir -p lib + $(SILENCE)$(AR) $(ARFLAGS) $@ $^ + $(SILENCE)ranlib $@ + +test: $(TEST_TARGET) + $(RUN_TEST_TARGET) | tee $(TEST_OUTPUT) + +vtest: $(TEST_TARGET) + $(RUN_TEST_TARGET) -v | tee $(TEST_OUTPUT) + +$(UNITY_OBJS_DIR)/%.o: %.cpp + @echo compiling $(notdir $<) + $(SILENCE)mkdir -p $(dir $@) + $(SILENCE)$(COMPILE.cpp) -MMD -MP $(OUTPUT_OPTION) $< + +$(UNITY_OBJS_DIR)/%.o: %.c + @echo compiling $(notdir $<) + $(SILENCE)mkdir -p $(dir $@) + $(SILENCE)$(COMPILE.c) -MMD -MP $(OUTPUT_OPTION) $< + +ifneq "$(MAKECMDGOALS)" "clean" +-include $(DEP_FILES) +endif + +.PHONY: clean +clean: + $(SILENCE)echo Making clean + $(SILENCE)$(RM) $(STUFF_TO_CLEAN) + $(SILENCE)rm -rf gcov $(UNITY_OBJS_DIR) + $(SILENCE)find . -name "*.gcno" | xargs rm -f + $(SILENCE)find . -name "*.gcda" | xargs rm -f + +#realclean gets rid of all gcov, o and d files in the directory tree +#not just the ones made by this makefile +.PHONY: realclean +realclean: clean + $(SILENCE)rm -rf gcov + $(SILENCE)find . -name "*.gdcno" | xargs rm -f + $(SILENCE)find . -name "*.[do]" | xargs rm -f + +gcov: test + $(SILENCE)for d in $(SRC_DIRS) ; do \ + gcov --object-directory $(UNITY_OBJS_DIR)/$$d $$d/*.c $$d/*.cpp >> $(GCOV_OUTPUT) 2>>$(GCOV_ERROR) ; \ + done + $(SILENCE)for f in $(SRC_FILES) ; do \ + gcov --object-directory $(UNITY_OBJS_DIR)/$$f $$f >> $(GCOV_OUTPUT) 2>>$(GCOV_ERROR) ; \ + done + $(UNITY_BUILD_HOME)/filterGcov.sh $(GCOV_OUTPUT) $(GCOV_ERROR) $(GCOV_REPORT) $(TEST_OUTPUT) + $(SILENCE)cat $(GCOV_REPORT) + $(SILENCE)mkdir -p gcov + $(SILENCE)mv *.gcov gcov + $(SILENCE)mv gcov_* gcov + $(SILENCE)echo "See gcov directory for details" + +debug: + @echo + @echo "Target Source files:" + @$(call debug_print_list,$(SRC)) + @echo "Target Object files:" + @$(call debug_print_list,$(OBJ)) + @echo "Test Source files:" + @$(call debug_print_list,$(TEST_SRC)) + @echo "Test Object files:" + @$(call debug_print_list,$(TEST_OBJS)) + @echo "Mock Source files:" + @$(call debug_print_list,$(MOCKS_SRC)) + @echo "Mock Object files:" + @$(call debug_print_list,$(MOCKS_OBJS)) + @echo "All Input Dependency files:" + @$(call debug_print_list,$(DEP_FILES)) + @echo Stuff to clean: + @$(call debug_print_list,$(STUFF_TO_CLEAN)) + @echo Includes: + @$(call debug_print_list,$(INCLUDES)) + +ifneq "$(OTHER_MAKEFILE_TO_INCLUDE)" "" +-include $(OTHER_MAKEFILE_TO_INCLUDE) +endif + + + +st,$(TEST_SRC)) + @echo "Test Object files:" + @$(call debug_print \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/build/filterGcov.sh b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/build/filterGcov.sh new file mode 100644 index 0000000..a861cf6 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/build/filterGcov.sh @@ -0,0 +1,61 @@ +#!/bin/bash +INPUT_FILE=$1 +TEMP_FILE1=${INPUT_FILE}1.tmp +TEMP_FILE2=${INPUT_FILE}2.tmp +TEMP_FILE3=${INPUT_FILE}3.tmp +ERROR_FILE=$2 +OUTPUT_FILE=$3 +HTML_OUTPUT_FILE=$3.html +TEST_RESULTS=$4 + +flattenGcovOutput() { +while read line1 +do + read line2 + echo $line2 " " $line1 + read junk + read junk +done < ${INPUT_FILE} +} + +getRidOfCruft() { +sed '-e s/^Lines.*://g' \ + '-e s/^[0-9]\./ &/g' \ + '-e s/^[0-9][0-9]\./ &/g' \ + '-e s/of.*File/ /g' \ + "-e s/'//g" \ + '-e s/^.*\/usr\/.*$//g' \ + '-e s/^.*\.$//g' +} + +getFileNameRootFromErrorFile() { +sed '-e s/gc..:cannot open .* file//g' ${ERROR_FILE} +} + +writeEachNoTestCoverageFile() { +while read line +do + echo " 0.00% " ${line} +done +} + +createHtmlOutput() { + echo "" + echo "" + sed "-e s/.*% /
CoverageFile
&<\/td>/" \ + "-e s/[a-zA-Z0-9_]*\.[ch][a-z]*/&<\/a><\/td><\/tr>/" + echo "
" + sed "-e s/.*/&
/g" < ${TEST_RESULTS} +} + + +flattenGcovOutput | getRidOfCruft > ${TEMP_FILE1} +getFileNameRootFromErrorFile | writeEachNoTestCoverageFile > ${TEMP_FILE2} +cat ${TEMP_FILE1} ${TEMP_FILE2} | sort | uniq > ${OUTPUT_FILE} +createHtmlOutput < ${OUTPUT_FILE} > ${HTML_OUTPUT_FILE} +rm -f ${TEMP_FILE1} ${TEMP_FILE2} +erageFile" + sed "-e s/.*% /&<\/td>/" \ + "-e s/[a-zA-Z0-9_]*\.[ch][a-z]*/
&<\/a><\/td><\/tr>/" + echo "" + sed "-e s/.*/&
/g" < ${TEST_RESULTS \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/rakefile.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/rakefile.rb new file mode 100644 index 0000000..6181707 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/rakefile.rb @@ -0,0 +1,37 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require HERE + 'rakefile_helper' + +include RakefileHelpers + +# Load default configuration, for now +DEFAULT_CONFIG_FILE = 'gcc.yml' +configure_toolchain(DEFAULT_CONFIG_FILE) + +task :unit do + run_tests +end + +desc "Build and test Unity Framework" +task :all => [:clean, :unit] +task :default => [:clobber, :all] +task :ci => [:no_color, :default] +task :cruise => [:no_color, :default] + +desc "Load configuration" +task :config, :config_file do |t, args| + configure_toolchain(args[:config_file]) +end + +task :no_color do + $colour_output = false +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/rakefile_helper.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/rakefile_helper.rb new file mode 100644 index 0000000..a7f6a28 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/rakefile_helper.rb @@ -0,0 +1,178 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require 'yaml' +require 'fileutils' +require HERE+'../../auto/unity_test_summary' +require HERE+'../../auto/generate_test_runner' +require HERE+'../../auto/colour_reporter' + +module RakefileHelpers + + C_EXTENSION = '.c' + + def load_configuration(config_file) + unless ($configured) + $cfg_file = HERE+"../../targets/#{config_file}" unless (config_file =~ /[\\|\/]/) + $cfg = YAML.load(File.read($cfg_file)) + $colour_output = false unless $cfg['colour'] + $configured = true if (config_file != DEFAULT_CONFIG_FILE) + end + end + + def configure_clean + CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil? + end + + def configure_toolchain(config_file=DEFAULT_CONFIG_FILE) + config_file += '.yml' unless config_file =~ /\.yml$/ + config_file = config_file unless config_file =~ /[\\|\/]/ + load_configuration(config_file) + configure_clean + end + + def tackit(strings) + if strings.is_a?(Array) + result = "\"#{strings.join}\"" + else + result = strings + end + return result + end + + def squash(prefix, items) + result = '' + items.each { |item| result += " #{prefix}#{tackit(item)}" } + return result + end + + def build_compiler_fields + command = tackit($cfg['compiler']['path']) + if $cfg['compiler']['defines']['items'].nil? + defines = '' + else + defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items'] + ['UNITY_OUTPUT_CHAR=UnityOutputCharSpy_OutputChar']) + end + options = squash('', $cfg['compiler']['options']) + includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :defines => defines, :options => options, :includes => includes} + end + + def compile(file, defines=[]) + compiler = build_compiler_fields + unity_include = $cfg['compiler']['includes']['prefix']+'../../src' + cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{unity_include} #{file} " + + "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" + + "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" + execute(cmd_str) + end + + def build_linker_fields + command = tackit($cfg['linker']['path']) + if $cfg['linker']['options'].nil? + options = '' + else + options = squash('', $cfg['linker']['options']) + end + if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?) + includes = '' + else + includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) + end + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :options => options, :includes => includes} + end + + def link(exe_name, obj_list) + linker = build_linker_fields + cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + + (obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).join + + $cfg['linker']['bin_files']['prefix'] + ' ' + + $cfg['linker']['bin_files']['destination'] + + exe_name + $cfg['linker']['bin_files']['extension'] + execute(cmd_str) + end + + def build_simulator_fields + return nil if $cfg['simulator'].nil? + if $cfg['simulator']['path'].nil? + command = '' + else + command = (tackit($cfg['simulator']['path']) + ' ') + end + if $cfg['simulator']['pre_support'].nil? + pre_support = '' + else + pre_support = squash('', $cfg['simulator']['pre_support']) + end + if $cfg['simulator']['post_support'].nil? + post_support = '' + else + post_support = squash('', $cfg['simulator']['post_support']) + end + return {:command => command, :pre_support => pre_support, :post_support => post_support} + end + + def execute(command_string, verbose=true) + report command_string + output = `#{command_string}`.chomp + report(output) if (verbose && !output.nil? && (output.length > 0)) + if ($?.exitstatus != 0) + raise "Command failed. (Returned #{$?.exitstatus})" + end + return output + end + + def report_summary + summary = UnityTestSummary.new + summary.set_root_path(HERE) + results_glob = "#{$cfg['compiler']['build_path']}*.test*" + results_glob.gsub!(/\\/, '/') + results = Dir[results_glob] + summary.set_targets(results) + summary.run + end + + def run_tests + report 'Running Unity system tests...' + + # Tack on TEST define for compiling unit tests + load_configuration($cfg_file) + test_defines = ['TEST'] + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + + # Get a list of all source files needed + src_files = Dir[HERE+'src/*.c'] + src_files += Dir[HERE+'test/*.c'] + src_files << '../../src/Unity.c' + + # Build object files + src_files.each { |f| compile(f, test_defines) } + obj_list = src_files.map {|f| File.basename(f.ext($cfg['compiler']['object_files']['extension'])) } + + # Link the test executable + test_base = "framework_test" + link(test_base, obj_list) + + # Execute unit test and generate results file + simulator = build_simulator_fields + executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] + if simulator.nil? + cmd_str = executable + " -v -r" + else + cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" + end + output = execute(cmd_str) + test_results = $cfg['compiler']['build_path'] + test_base + if output.match(/OK$/m).nil? + test_results += '.testfail' + else + test_results += '.testpass' + end + File.open(test_results, 'w') { |f| f.print output } + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/readme.txt b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/readme.txt new file mode 100644 index 0000000..6b9a78c --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/readme.txt @@ -0,0 +1,9 @@ +Copyright (c) 2010 James Grenning and Contributed to Unity Project + +Unity Project - A Test Framework for C +Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +[Released under MIT License. Please refer to license.txt for details] + +This Framework is an optional add-on to Unity. By including unity_framework.h in place of unity.h, +you may now work with Unity in a manner similar to CppUTest. This framework adds the concepts of +test groups and gives finer control of your tests over the command line. \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c new file mode 100644 index 0000000..1ba3e9a --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c @@ -0,0 +1,381 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" +#include "unity_internals.h" +#include + +UNITY_FIXTURE_T UnityFixture; + +//If you decide to use the function pointer approach. +int (*outputChar)(int) = putchar; + +int verbose = 0; + +void setUp(void) { /*does nothing*/ } +void tearDown(void) { /*does nothing*/ } + +void announceTestRun(int runNumber) +{ + UnityPrint("Unity test run "); + UnityPrintNumber(runNumber+1); + UnityPrint(" of "); + UnityPrintNumber(UnityFixture.RepeatCount); + UNITY_OUTPUT_CHAR('\n'); +} + +int UnityMain(int argc, char* argv[], void (*runAllTests)()) +{ + int result = UnityGetCommandLineOptions(argc, argv); + int r; + if (result != 0) + return result; + + for (r = 0; r < UnityFixture.RepeatCount; r++) + { + announceTestRun(r); + UnityBegin(); + runAllTests(); + UNITY_OUTPUT_CHAR('\n'); + UnityEnd(); + } + + return UnityFailureCount(); +} + +static int selected(const char * filter, const char * name) +{ + if (filter == 0) + return 1; + return strstr(name, filter) ? 1 : 0; +} + +static int testSelected(const char* test) +{ + return selected(UnityFixture.NameFilter, test); +} + +static int groupSelected(const char* group) +{ + return selected(UnityFixture.GroupFilter, group); +} + +static void runTestCase() +{ + +} + +void UnityTestRunner(unityfunction* setup, + unityfunction* testBody, + unityfunction* teardown, + const char * printableName, + const char * group, + const char * name, + const char * file, int line) +{ + if (testSelected(name) && groupSelected(group)) + { + Unity.CurrentTestFailed = 0; + Unity.TestFile = file; + Unity.CurrentTestName = printableName; + Unity.CurrentTestLineNumber = line; + if (!UnityFixture.Verbose) + UNITY_OUTPUT_CHAR('.'); + else + UnityPrint(printableName); + + Unity.NumberOfTests++; + UnityMalloc_StartTest(); + UnityPointer_Init(); + + runTestCase(); + if (TEST_PROTECT()) + { + setup(); + testBody(); + } + if (TEST_PROTECT()) + { + teardown(); + } + if (TEST_PROTECT()) + { + UnityPointer_UndoAllSets(); + if (!Unity.CurrentTestFailed) + UnityMalloc_EndTest(); + UnityConcludeFixtureTest(); + } + else + { + //aborting - jwg - di i need these for the other TEST_PROTECTS? + } + } +} + +void UnityIgnoreTest() +{ + Unity.NumberOfTests++; + Unity.CurrentTestIgnored = 1; + UNITY_OUTPUT_CHAR('!'); +} + + +//------------------------------------------------- +//Malloc and free stuff +// +#define MALLOC_DONT_FAIL -1 +static int malloc_count; +static int malloc_fail_countdown = MALLOC_DONT_FAIL; + +void UnityMalloc_StartTest() +{ + malloc_count = 0; + malloc_fail_countdown = MALLOC_DONT_FAIL; +} + +void UnityMalloc_EndTest() +{ + malloc_fail_countdown = MALLOC_DONT_FAIL; + if (malloc_count != 0) + { + TEST_FAIL_MESSAGE("This test leaks!"); + } +} + +void UnityMalloc_MakeMallocFailAfterCount(int countdown) +{ + malloc_fail_countdown = countdown; +} + +#ifdef malloc +#undef malloc +#endif + +#ifdef free +#undef free +#endif + +#include +#include + +typedef struct GuardBytes +{ + int size; + char guard[sizeof(int)]; +} Guard; + + +static const char * end = "END"; + +void * unity_malloc(size_t size) +{ + char* mem; + Guard* guard; + + if (malloc_fail_countdown != MALLOC_DONT_FAIL) + { + if (malloc_fail_countdown == 0) + return 0; + malloc_fail_countdown--; + } + + malloc_count++; + + guard = (Guard*)malloc(size + sizeof(Guard) + 4); + guard->size = size; + mem = (char*)&(guard[1]); + memcpy(&mem[size], end, strlen(end) + 1); + + return (void*)mem; +} + +static int isOverrun(void * mem) +{ + Guard* guard = (Guard*)mem; + char* memAsChar = (char*)mem; + guard--; + + return strcmp(&memAsChar[guard->size], end) != 0; +} + +static void release_memory(void * mem) +{ + Guard* guard = (Guard*)mem; + guard--; + + malloc_count--; + free(guard); +} + +void unity_free(void * mem) +{ + int overrun = isOverrun(mem);//strcmp(&memAsChar[guard->size], end) != 0; + release_memory(mem); + if (overrun) + { + TEST_FAIL_MESSAGE("Buffer overrun detected during free()"); + } +} + +void* unity_calloc(size_t num, size_t size) +{ + void* mem = unity_malloc(num * size); + memset(mem, 0, num*size); + return mem; +} + +void* unity_realloc(void * oldMem, size_t size) +{ + Guard* guard = (Guard*)oldMem; +// char* memAsChar = (char*)oldMem; + void* newMem; + + if (oldMem == 0) + return unity_malloc(size); + + guard--; + if (isOverrun(oldMem)) + { + release_memory(oldMem); + TEST_FAIL_MESSAGE("Buffer overrun detected during realloc()"); + } + + if (size == 0) + { + release_memory(oldMem); + return 0; + } + + if (guard->size >= size) + return oldMem; + + newMem = unity_malloc(size); + memcpy(newMem, oldMem, size); + unity_free(oldMem); + return newMem; +} + + +//-------------------------------------------------------- +//Automatic pointer restoration functions +typedef struct _PointerPair +{ + struct _PointerPair * next; + void ** pointer; + void * old_value; +} PointerPair; + +enum {MAX_POINTERS=50}; +static PointerPair pointer_store[MAX_POINTERS]; +static int pointer_index = 0; + +void UnityPointer_Init() +{ + pointer_index = 0; +} + +void UnityPointer_Set(void ** pointer, void * newValue) +{ + if (pointer_index >= MAX_POINTERS) + TEST_FAIL_MESSAGE("Too many pointers set"); + + pointer_store[pointer_index].pointer = pointer; + pointer_store[pointer_index].old_value = *pointer; + *pointer = newValue; + pointer_index++; +} + +void UnityPointer_UndoAllSets() +{ + while (pointer_index > 0) + { + pointer_index--; + *(pointer_store[pointer_index].pointer) = + pointer_store[pointer_index].old_value; + + } +} + +int UnityFailureCount() +{ + return Unity.TestFailures; +} + +int UnityGetCommandLineOptions(int argc, char* argv[]) +{ + int i; + UnityFixture.Verbose = 0; + UnityFixture.GroupFilter = 0; + UnityFixture.NameFilter = 0; + UnityFixture.RepeatCount = 1; + + if (argc == 1) + return 0; + + for (i = 1; i < argc; ) + { + if (strcmp(argv[i], "-v") == 0) + { + UnityFixture.Verbose = 1; + i++; + } + else if (strcmp(argv[i], "-g") == 0) + { + i++; + if (i >= argc) + return 1; + UnityFixture.GroupFilter = argv[i]; + i++; + } + else if (strcmp(argv[i], "-n") == 0) + { + i++; + if (i >= argc) + return 1; + UnityFixture.NameFilter = argv[i]; + i++; + } + else if (strcmp(argv[i], "-r") == 0) + { + UnityFixture.RepeatCount = 2; + i++; + if (i < argc) + { + if (*(argv[i]) >= '0' && *(argv[i]) <= '9') + { + UnityFixture.RepeatCount = atoi(argv[i]); + i++; + } + } + } + } + return 0; +} + +void UnityConcludeFixtureTest() +{ + if (Unity.CurrentTestIgnored) + { + Unity.TestIgnores++; + } + else if (!Unity.CurrentTestFailed) + { + if (UnityFixture.Verbose) + { + UnityPrint(" PASS"); + UNITY_OUTPUT_CHAR('\n'); + } + } + else if (Unity.CurrentTestFailed) + { + Unity.TestFailures++; + } + + Unity.CurrentTestFailed = 0; + Unity.CurrentTestIgnored = 0; +} + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.h new file mode 100644 index 0000000..da1f871 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.h @@ -0,0 +1,81 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FIXTURE_H_ +#define UNITY_FIXTURE_H_ + +#include "unity.h" +#include "unity_internals.h" +#include "unity_fixture_malloc_overrides.h" +#include "unity_fixture_internals.h" + +int UnityMain(int argc, char* argv[], void (*runAllTests)()); + + +#define TEST_GROUP(group)\ + int TEST_GROUP_##group = 0 + +#define TEST_SETUP(group) void TEST_##group##_SETUP() + +#define TEST_TEAR_DOWN(group) void TEST_##group##_TEAR_DOWN() + + +#define TEST(group, name) \ + void TEST_##group##_##name##_();\ + void TEST_##group##_##name##_run()\ + {\ + UnityTestRunner(TEST_##group##_SETUP,\ + TEST_##group##_##name##_,\ + TEST_##group##_TEAR_DOWN,\ + "TEST(" #group ", " #name ")",\ + #group, #name,\ + __FILE__, __LINE__);\ + }\ + void TEST_##group##_##name##_() + +#define IGNORE_TEST(group, name) \ + void TEST_##group##_##name##_();\ + void TEST_##group##_##name##_run()\ + {\ + UnityIgnoreTest();\ + }\ + void TEST_##group##_##name##_() + +#define DECLARE_TEST_CASE(group, name) \ + void TEST_##group##_##name##_run() + +#define RUN_TEST_CASE(group, name) \ + DECLARE_TEST_CASE(group, name);\ + TEST_##group##_##name##_run(); + +//This goes at the bottom of each test file or in a separate c file +#define TEST_GROUP_RUNNER(group)\ + void TEST_##group##_GROUP_RUNNER_runAll();\ + void TEST_##group##_GROUP_RUNNER()\ + {\ + TEST_##group##_GROUP_RUNNER_runAll();\ + }\ + void TEST_##group##_GROUP_RUNNER_runAll() + +//Call this from main +#define RUN_TEST_GROUP(group)\ + void TEST_##group##_GROUP_RUNNER();\ + TEST_##group##_GROUP_RUNNER(); + +//CppUTest Compatibility Macros +#define UT_PTR_SET(ptr, newPointerValue) UnityPointer_Set((void**)&ptr, (void*)newPointerValue) +#define TEST_ASSERT_POINTERS_EQUAL(expected, actual) TEST_ASSERT_EQUAL_PTR(expected, actual) +#define TEST_ASSERT_BYTES_EQUAL(expected, actual) TEST_ASSERT_EQUAL_HEX8(0xff & (expected), 0xff & (actual)) +#define FAIL(message) TEST_FAIL((message)) +#define CHECK(condition) TEST_ASSERT_TRUE((condition)) +#define LONGS_EQUAL(expected, actual) TEST_ASSERT_EQUAL_INT((expected), (actual)) +#define STRCMP_EQUAL(expected, actual) TEST_ASSERT_EQUAL_STRING((expected), (actual)) +#define DOUBLES_EQUAL(expected, actual, delta) TEST_ASSERT_FLOAT_WITHIN(((expected), (actual), (delta)) + +void UnityMalloc_MakeMallocFailAfterCount(int count); + +#endif /* UNITY_FIXTURE_H_ */ diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h new file mode 100644 index 0000000..db23f67 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h @@ -0,0 +1,44 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FIXTURE_INTERNALS_H_ +#define UNITY_FIXTURE_INTERNALS_H_ + +typedef struct _UNITY_FIXTURE_T +{ + int Verbose; + unsigned int RepeatCount; + const char* NameFilter; + const char* GroupFilter; +} UNITY_FIXTURE_T; + +typedef void unityfunction(); +void UnityTestRunner(unityfunction * setup, + unityfunction * body, + unityfunction * teardown, + const char * printableName, + const char * group, + const char * name, + const char * file, int line); + +void UnityIgnoreTest(); +void UnityMalloc_StartTest(); +void UnityMalloc_EndTest(); +int UnityFailureCount(); +int UnityGetCommandLineOptions(int argc, char* argv[]); +void UnityConcludeFixtureTest(); + +void UnityPointer_Set(void ** ptr, void * newValue); +void UnityPointer_UndoAllSets(); +void UnityPointer_Init(); + +void UnityAssertEqualPointer(const void * expected, + const void * actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +#endif /* UNITY_FIXTURE_INTERNALS_H_ */ diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h new file mode 100644 index 0000000..38f8e34 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h @@ -0,0 +1,16 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FIXTURE_MALLOC_OVERRIDES_H_ +#define UNITY_FIXTURE_MALLOC_OVERRIDES_H_ + +#define malloc unity_malloc +#define calloc unity_calloc +#define realloc unity_realloc +#define free unity_free + +#endif /* UNITY_FIXTURE_MALLOC_OVERRIDES_H_ */ diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/main/AllTests.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/main/AllTests.c new file mode 100644 index 0000000..ccb775b --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/main/AllTests.c @@ -0,0 +1,21 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" + +static void runAllTests() +{ + RUN_TEST_GROUP(UnityFixture); + RUN_TEST_GROUP(UnityCommandOptions); + RUN_TEST_GROUP(LeakDetection) +} + +int main(int argc, char* argv[]) +{ + return UnityMain(argc, argv, runAllTests); +} + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/testunity_fixture.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/testunity_fixture.c new file mode 100644 index 0000000..de0c04c --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/testunity_fixture.c @@ -0,0 +1,39 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" + +static int data = -1; + +TEST_GROUP(mygroup); + +TEST_SETUP(mygroup) +{ + data = 0; +} + +TEST_TEAR_DOWN(mygroup) +{ + data = -1; +} + +TEST(mygroup, test1) +{ + TEST_ASSERT_EQUAL_INT(0, data); +} + +TEST(mygroup, test2) +{ + TEST_ASSERT_EQUAL_INT(0, data); + data = 5; +} + +TEST(mygroup, test3) +{ + data = 7; + TEST_ASSERT_EQUAL_INT(7, data); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c new file mode 100644 index 0000000..b8b4524 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c @@ -0,0 +1,321 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" +#include "unity_output_Spy.h" +#include +#include + +extern UNITY_FIXTURE_T UnityFixture; + +TEST_GROUP(UnityFixture); + +TEST_SETUP(UnityFixture) +{ +} + +TEST_TEAR_DOWN(UnityFixture) +{ +} + +int my_int; +int* pointer1 = 0; +int* pointer2 = (int*)2; +int* pointer3 = (int*)3; +int int1; +int int2; +int int3; +int int4; + +TEST(UnityFixture, PointerSetting) +{ + TEST_ASSERT_POINTERS_EQUAL(pointer1, 0); + UT_PTR_SET(pointer1, &int1); + UT_PTR_SET(pointer2, &int2); + UT_PTR_SET(pointer3, &int3); + TEST_ASSERT_POINTERS_EQUAL(pointer1, &int1); + TEST_ASSERT_POINTERS_EQUAL(pointer2, &int2); + TEST_ASSERT_POINTERS_EQUAL(pointer3, &int3); + UT_PTR_SET(pointer1, &int4); + UnityPointer_UndoAllSets(); + TEST_ASSERT_POINTERS_EQUAL(pointer1, 0); + TEST_ASSERT_POINTERS_EQUAL(pointer2, (int*)2); + TEST_ASSERT_POINTERS_EQUAL(pointer3, (int*)3); +} + +TEST(UnityFixture, ForceMallocFail) +{ + UnityMalloc_MakeMallocFailAfterCount(1); + void* m = malloc(10); + CHECK(m); + void* mfails = malloc(10); + TEST_ASSERT_POINTERS_EQUAL(0, mfails); + free(m); +} + +TEST(UnityFixture, ReallocSmallerIsUnchanged) +{ + void* m1 = malloc(10); + void* m2 = realloc(m1, 5); + TEST_ASSERT_POINTERS_EQUAL(m1, m2); + free(m2); +} + +TEST(UnityFixture, ReallocSameIsUnchanged) +{ + void* m1 = malloc(10); + void* m2 = realloc(m1, 10); + TEST_ASSERT_POINTERS_EQUAL(m1, m2); + free(m2); +} + +TEST(UnityFixture, ReallocLargerNeeded) +{ + void* m1 = malloc(10); + strcpy((char*)m1, "123456789"); + void* m2 = realloc(m1, 15); + CHECK(m1 != m2); + STRCMP_EQUAL("123456789", m2); + free(m2); +} + +TEST(UnityFixture, ReallocNullPointerIsLikeMalloc) +{ + void* m = realloc(0, 15); + CHECK(m != 0); + free(m); +} + +TEST(UnityFixture, ReallocSizeZeroFreesMemAndReturnsNullPointer) +{ + void* m1 = malloc(10); + void* m2 = realloc(m1, 0); + TEST_ASSERT_POINTERS_EQUAL(0, m2); +} + +TEST(UnityFixture, CallocFillsWithZero) +{ + void* m = calloc(3, sizeof(char)); + char* s = (char*)m; + TEST_ASSERT_BYTES_EQUAL(0, s[0]); + TEST_ASSERT_BYTES_EQUAL(0, s[1]); + TEST_ASSERT_BYTES_EQUAL(0, s[2]); + free(m); +} + +char *p1; +char *p2; + +TEST(UnityFixture, PointerSet) +{ + char c1; + char c2; + char newC1; + char newC2; + p1 = &c1; + p2 = &c2; + + UnityPointer_Init(10); + UT_PTR_SET(p1, &newC1); + UT_PTR_SET(p2, &newC2); + TEST_ASSERT_POINTERS_EQUAL(&newC1, p1); + TEST_ASSERT_POINTERS_EQUAL(&newC2, p2); + UnityPointer_UndoAllSets(); + TEST_ASSERT_POINTERS_EQUAL(&c1, p1); + TEST_ASSERT_POINTERS_EQUAL(&c2, p2); +} + +//------------------------------------------------------------ + +TEST_GROUP(UnityCommandOptions); + +int savedVerbose; +int savedRepeat; +const char* savedName; +const char* savedGroup; + +TEST_SETUP(UnityCommandOptions) +{ + savedVerbose = UnityFixture.Verbose; + savedRepeat = UnityFixture.RepeatCount; + savedName = UnityFixture.NameFilter; + savedGroup = UnityFixture.GroupFilter; +} + +TEST_TEAR_DOWN(UnityCommandOptions) +{ + UnityFixture.Verbose = savedVerbose; + UnityFixture.RepeatCount= savedRepeat; + UnityFixture.NameFilter = savedName; + UnityFixture.GroupFilter = savedGroup; +} + + +static char* noOptions[] = { + "testrunner.exe" +}; + +TEST(UnityCommandOptions, DefaultOptions) +{ + UnityGetCommandLineOptions(1, noOptions); + TEST_ASSERT_EQUAL(0, UnityFixture.Verbose); + TEST_ASSERT_POINTERS_EQUAL(0, UnityFixture.GroupFilter); + TEST_ASSERT_POINTERS_EQUAL(0, UnityFixture.NameFilter); + TEST_ASSERT_EQUAL(1, UnityFixture.RepeatCount); +} + +static char* verbose[] = { + "testrunner.exe", + "-v" +}; + +TEST(UnityCommandOptions, OptionVerbose) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(2, verbose)); + TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); +} + +static char* group[] = { + "testrunner.exe", + "-g", "groupname" +}; + +TEST(UnityCommandOptions, OptionSelectTestByGroup) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, group)); + STRCMP_EQUAL("groupname", UnityFixture.GroupFilter); +} + +static char* name[] = { + "testrunner.exe", + "-n", "testname" +}; + +TEST(UnityCommandOptions, OptionSelectTestByName) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, name)); + STRCMP_EQUAL("testname", UnityFixture.NameFilter); +} + +static char* repeat[] = { + "testrunner.exe", + "-r", "99" +}; + +TEST(UnityCommandOptions, OptionSelectRepeatTestsDefaultCount) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(2, repeat)); + TEST_ASSERT_EQUAL(2, UnityFixture.RepeatCount); +} + +TEST(UnityCommandOptions, OptionSelectRepeatTestsSpecificCount) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, repeat)); + TEST_ASSERT_EQUAL(99, UnityFixture.RepeatCount); +} + +static char* multiple[] = { + "testrunner.exe", + "-v", + "-g", "groupname", + "-n", "testname", + "-r", "98" +}; + +TEST(UnityCommandOptions, MultipleOptions) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(8, multiple)); + TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); + STRCMP_EQUAL("groupname", UnityFixture.GroupFilter); + STRCMP_EQUAL("testname", UnityFixture.NameFilter); + TEST_ASSERT_EQUAL(98, UnityFixture.RepeatCount); +} + +static char* dashRNotLast[] = { + "testrunner.exe", + "-v", + "-g", "gggg", + "-r", + "-n", "tttt", +}; + +TEST(UnityCommandOptions, MultipleOptionsDashRNotLastAndNoValueSpecified) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(7, dashRNotLast)); + TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); + STRCMP_EQUAL("gggg", UnityFixture.GroupFilter); + STRCMP_EQUAL("tttt", UnityFixture.NameFilter); + TEST_ASSERT_EQUAL(2, UnityFixture.RepeatCount); +} + + +//------------------------------------------------------------ + +TEST_GROUP(LeakDetection); + +TEST_SETUP(LeakDetection) +{ + UnityOutputCharSpy_Create(1000); +} + +TEST_TEAR_DOWN(LeakDetection) +{ + UnityOutputCharSpy_Destroy(); +} + +#define EXPECT_ABORT_BEGIN \ + { \ + jmp_buf TestAbortFrame; \ + memcpy(TestAbortFrame, Unity.AbortFrame, sizeof(jmp_buf)); \ + if (TEST_PROTECT()) \ + { + +#define EXPECT_ABORT_END \ + } \ + memcpy(Unity.AbortFrame, TestAbortFrame, sizeof(jmp_buf)); \ + } + +TEST(LeakDetection, DetectsLeak) +{ + void* m = malloc(10); + UnityOutputCharSpy_Enable(1); + EXPECT_ABORT_BEGIN + UnityMalloc_EndTest(); + EXPECT_ABORT_END + UnityOutputCharSpy_Enable(0); + CHECK(strstr(UnityOutputCharSpy_Get(), "This test leaks!")); + free(m); + Unity.CurrentTestFailed = 0; +} + +TEST(LeakDetection, BufferOverrunFoundDuringFree) +{ + void* m = malloc(10); + char* s = (char*)m; + s[10] = (char)0xFF; + UnityOutputCharSpy_Enable(1); + EXPECT_ABORT_BEGIN + free(m); + EXPECT_ABORT_END + UnityOutputCharSpy_Enable(0); + CHECK(strstr(UnityOutputCharSpy_Get(), "Buffer overrun detected during free()")); + Unity.CurrentTestFailed = 0; +} + +TEST(LeakDetection, BufferOverrunFoundDuringRealloc) +{ + void* m = malloc(10); + char* s = (char*)m; + s[10] = (char)0xFF; + UnityOutputCharSpy_Enable(1); + EXPECT_ABORT_BEGIN + m = realloc(m, 100); + EXPECT_ABORT_END + UnityOutputCharSpy_Enable(0); + CHECK(strstr(UnityOutputCharSpy_Get(), "Buffer overrun detected during realloc()")); + Unity.CurrentTestFailed = 0; +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c new file mode 100644 index 0000000..80fec09 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c @@ -0,0 +1,40 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" + +TEST_GROUP_RUNNER(UnityFixture) +{ + RUN_TEST_CASE(UnityFixture, PointerSetting); + RUN_TEST_CASE(UnityFixture, ForceMallocFail); + RUN_TEST_CASE(UnityFixture, ReallocSmallerIsUnchanged); + RUN_TEST_CASE(UnityFixture, ReallocSameIsUnchanged); + RUN_TEST_CASE(UnityFixture, ReallocLargerNeeded); + RUN_TEST_CASE(UnityFixture, ReallocNullPointerIsLikeMalloc); + RUN_TEST_CASE(UnityFixture, ReallocSizeZeroFreesMemAndReturnsNullPointer); + RUN_TEST_CASE(UnityFixture, CallocFillsWithZero); + RUN_TEST_CASE(UnityFixture, PointerSet); +} + +TEST_GROUP_RUNNER(UnityCommandOptions) +{ + RUN_TEST_CASE(UnityCommandOptions, DefaultOptions); + RUN_TEST_CASE(UnityCommandOptions, OptionVerbose); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectTestByGroup); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectTestByName); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectRepeatTestsDefaultCount); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectRepeatTestsSpecificCount); + RUN_TEST_CASE(UnityCommandOptions, MultipleOptions); + RUN_TEST_CASE(UnityCommandOptions, MultipleOptionsDashRNotLastAndNoValueSpecified); +} + +TEST_GROUP_RUNNER(LeakDetection) +{ + RUN_TEST_CASE(LeakDetection, DetectsLeak); + RUN_TEST_CASE(LeakDetection, BufferOverrunFoundDuringFree); + RUN_TEST_CASE(LeakDetection, BufferOverrunFoundDuringRealloc); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.c new file mode 100644 index 0000000..16faefa --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.c @@ -0,0 +1,56 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + + +#include "unity_output_Spy.h" +#include +#include +#include + +static int size; +static int count; +static char* buffer; +static int spy_enable; + +void UnityOutputCharSpy_Create(int s) +{ + size = s; + count = 0; + spy_enable = 0; + buffer = malloc(size); + memset(buffer, 0, size); +} + +void UnityOutputCharSpy_Destroy() +{ + size = 0; + free(buffer); +} + +int UnityOutputCharSpy_OutputChar(int c) +{ + if (spy_enable) + { + if (count < (size-1)) + buffer[count++] = c; + } + else + { + putchar(c); + } + return c; +} + +const char * UnityOutputCharSpy_Get() +{ + return buffer; +} + +void UnityOutputCharSpy_Enable(int enable) +{ + spy_enable = enable; +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.h new file mode 100644 index 0000000..7c1590e --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.h @@ -0,0 +1,17 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef D_unity_output_Spy_H +#define D_unity_output_Spy_H + +void UnityOutputCharSpy_Create(int s); +void UnityOutputCharSpy_Destroy(); +int UnityOutputCharSpy_OutputChar(int c); +const char * UnityOutputCharSpy_Get(); +void UnityOutputCharSpy_Enable(int enable); + +#endif diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/makefile b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/makefile new file mode 100644 index 0000000..8c8444b --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/makefile @@ -0,0 +1,35 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +C_COMPILER=gcc +TARGET_BASE = testunity +ifeq ($(OS),Windows_NT) + TARGET_EXTENSION=.exe +else + TARGET_EXTENSION=.out +endif +TARGET = $(TARGET_BASE)$(TARGET_EXTENSION) +OUT_FILE=-o $(TARGET) +SRC_FILES=src/unity.c test/testunity.c build/testunity_Runner.c +INC_DIRS=-Isrc +SYMBOLS=-DTEST -DUNITY_SUPPORT_64 + +ifeq ($(OS),Windows_NT) + CLEANUP = del /F /Q build\* && del /F /Q $(TARGET) +else + CLEANUP = rm -f build/*.o ; rm -f $(TARGET) +endif + +all: clean default + +default: + ruby auto/generate_test_runner.rb test/testunity.c build/testunity_Runner.c + $(C_COMPILER) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES) $(OUT_FILE) + $(TARGET) + +clean: + $(CLEANUP) + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/rakefile.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/rakefile.rb new file mode 100644 index 0000000..3ec5d5a --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/rakefile.rb @@ -0,0 +1,48 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require HERE + 'rakefile_helper' + +include RakefileHelpers + +# Load default configuration, for now +DEFAULT_CONFIG_FILE = 'gcc.yml' +configure_toolchain(DEFAULT_CONFIG_FILE) + +desc "Test unity with its own unit tests" +task :unit do + run_tests get_unit_test_files +end + +Rake::TestTask.new(:scripts) do |t| + t.pattern = 'test/test_*.rb' + t.verbose = true +end + +desc "Generate test summary" +task :summary do + report_summary +end + +desc "Build and test Unity" +task :all => [:clean, :scripts, :unit, :summary] +task :default => [:clobber, :all] +task :ci => [:no_color, :default] +task :cruise => [:no_color, :default] + +desc "Load configuration" +task :config, :config_file do |t, args| + configure_toolchain(args[:config_file]) +end + +task :no_color do + $colour_output = false +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/rakefile_helper.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/rakefile_helper.rb new file mode 100644 index 0000000..218fcaa --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/rakefile_helper.rb @@ -0,0 +1,243 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require 'yaml' +require 'fileutils' +require HERE+'auto/unity_test_summary' +require HERE+'auto/generate_test_runner' +require HERE+'auto/colour_reporter' + +module RakefileHelpers + + C_EXTENSION = '.c' + + def load_configuration(config_file) + unless ($configured) + $cfg_file = "targets/#{config_file}" unless (config_file =~ /[\\|\/]/) + $cfg = YAML.load(File.read($cfg_file)) + $colour_output = false unless $cfg['colour'] + $configured = true if (config_file != DEFAULT_CONFIG_FILE) + end + end + + def configure_clean + CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil? + end + + def configure_toolchain(config_file=DEFAULT_CONFIG_FILE) + config_file += '.yml' unless config_file =~ /\.yml$/ + config_file = config_file unless config_file =~ /[\\|\/]/ + load_configuration(config_file) + configure_clean + end + + def get_unit_test_files + path = $cfg['compiler']['unit_tests_path'] + 'test*' + C_EXTENSION + path.gsub!(/\\/, '/') + FileList.new(path) + end + + def get_local_include_dirs + include_dirs = $cfg['compiler']['includes']['items'].dup + include_dirs.delete_if {|dir| dir.is_a?(Array)} + return include_dirs + end + + def extract_headers(filename) + includes = [] + lines = File.readlines(filename) + lines.each do |line| + m = line.match(/^\s*#include\s+\"\s*(.+\.[hH])\s*\"/) + if not m.nil? + includes << m[1] + end + end + return includes + end + + def find_source_file(header, paths) + paths.each do |dir| + src_file = dir + header.ext(C_EXTENSION) + if (File.exists?(src_file)) + return src_file + end + end + return nil + end + + def tackit(strings) + if strings.is_a?(Array) + result = "\"#{strings.join}\"" + else + result = strings + end + return result + end + + def squash(prefix, items) + result = '' + items.each { |item| result += " #{prefix}#{tackit(item)}" } + return result + end + + def build_compiler_fields + command = tackit($cfg['compiler']['path']) + if $cfg['compiler']['defines']['items'].nil? + defines = '' + else + defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items']) + end + options = squash('', $cfg['compiler']['options']) + includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :defines => defines, :options => options, :includes => includes} + end + + def compile(file, defines=[]) + compiler = build_compiler_fields + cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{file} " + + "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" + + "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" + execute(cmd_str) + end + + def build_linker_fields + command = tackit($cfg['linker']['path']) + if $cfg['linker']['options'].nil? + options = '' + else + options = squash('', $cfg['linker']['options']) + end + if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?) + includes = '' + else + includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) + end + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :options => options, :includes => includes} + end + + def link(exe_name, obj_list) + linker = build_linker_fields + cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + + (obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).join + + $cfg['linker']['bin_files']['prefix'] + ' ' + + $cfg['linker']['bin_files']['destination'] + + exe_name + $cfg['linker']['bin_files']['extension'] + execute(cmd_str) + end + + def build_simulator_fields + return nil if $cfg['simulator'].nil? + if $cfg['simulator']['path'].nil? + command = '' + else + command = (tackit($cfg['simulator']['path']) + ' ') + end + if $cfg['simulator']['pre_support'].nil? + pre_support = '' + else + pre_support = squash('', $cfg['simulator']['pre_support']) + end + if $cfg['simulator']['post_support'].nil? + post_support = '' + else + post_support = squash('', $cfg['simulator']['post_support']) + end + return {:command => command, :pre_support => pre_support, :post_support => post_support} + end + + def execute(command_string, verbose=true) + report command_string + output = `#{command_string}`.chomp + report(output) if (verbose && !output.nil? && (output.length > 0)) + if $?.exitstatus != 0 + raise "Command failed. (Returned #{$?.exitstatus})" + end + return output + end + + def report_summary + summary = UnityTestSummary.new + summary.set_root_path(HERE) + results_glob = "#{$cfg['compiler']['build_path']}*.test*" + results_glob.gsub!(/\\/, '/') + results = Dir[results_glob] + summary.set_targets(results) + summary.run + end + + def run_tests(test_files) + report 'Running Unity system tests...' + + # Tack on TEST define for compiling unit tests + load_configuration($cfg_file) + test_defines = ['TEST'] + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + $cfg['compiler']['defines']['items'] << 'TEST' + + include_dirs = get_local_include_dirs + + # Build and execute each unit test + test_files.each do |test| + obj_list = [] + + # Detect dependencies and build required modules + extract_headers(test).each do |header| + # Compile corresponding source file if it exists + src_file = find_source_file(header, include_dirs) + if !src_file.nil? + compile(src_file, test_defines) + obj_list << header.ext($cfg['compiler']['object_files']['extension']) + end + end + + # Build the test runner (generate if configured to do so) + test_base = File.basename(test, C_EXTENSION) + + runner_name = test_base + '_Runner.c' + runner_path = '' + + if $cfg['compiler']['runner_path'].nil? + runner_path = $cfg['compiler']['build_path'] + runner_name + else + runner_path = $cfg['compiler']['runner_path'] + runner_name + end + + options = $cfg[:unity] + options[:use_param_tests] = (test =~ /parameterized/) ? true : false + UnityTestRunnerGenerator.new(options).run(test, runner_path) + + compile(runner_path, test_defines) + obj_list << runner_name.ext($cfg['compiler']['object_files']['extension']) + + # Build the test module + compile(test, test_defines) + obj_list << test_base.ext($cfg['compiler']['object_files']['extension']) + + # Link the test executable + link(test_base, obj_list) + + # Execute unit test and generate results file + simulator = build_simulator_fields + executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] + if simulator.nil? + cmd_str = executable + else + cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" + end + output = execute(cmd_str) + test_results = $cfg['compiler']['build_path'] + test_base + if output.match(/OK$/m).nil? + test_results += '.testfail' + else + test_results += '.testpass' + end + File.open(test_results, 'w') { |f| f.print output } + + end + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/release/build.info b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/release/build.info new file mode 100644 index 0000000..7871b21 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/release/build.info @@ -0,0 +1,2 @@ +118 + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/release/version.info b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/release/version.info new file mode 100644 index 0000000..0d71c08 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/release/version.info @@ -0,0 +1,2 @@ +2.0 + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/src/unity.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/src/unity.c new file mode 100644 index 0000000..d85b880 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/src/unity.c @@ -0,0 +1,855 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity.h" +#include +#include + +#define UNITY_FAIL_AND_BAIL { Unity.CurrentTestFailed = 1; UNITY_OUTPUT_CHAR('\n'); longjmp(Unity.AbortFrame, 1); } +#define UNITY_IGNORE_AND_BAIL { Unity.CurrentTestIgnored = 1; UNITY_OUTPUT_CHAR('\n'); longjmp(Unity.AbortFrame, 1); } +/// return prematurely if we are already in failure or ignore state +#define UNITY_SKIP_EXECUTION { if ((Unity.CurrentTestFailed != 0) || (Unity.CurrentTestIgnored != 0)) {return;} } +#define UNITY_PRINT_EOL { UNITY_OUTPUT_CHAR('\n'); } + +struct _Unity Unity = { 0 }; + +const char* UnityStrNull = "NULL"; +const char* UnityStrSpacer = ". "; +const char* UnityStrExpected = " Expected "; +const char* UnityStrWas = " Was "; +const char* UnityStrTo = " To "; +const char* UnityStrElement = " Element "; +const char* UnityStrMemory = " Memory Mismatch"; +const char* UnityStrDelta = " Values Not Within Delta "; +const char* UnityStrPointless= " You Asked Me To Compare Nothing, Which Was Pointless."; +const char* UnityStrNullPointerForExpected= " Expected pointer to be NULL"; +const char* UnityStrNullPointerForActual = " Actual pointer was NULL"; + +const _U_UINT UnitySizeMask[] = +{ + 255, + 65535, + 65535, + 4294967295, + 4294967295, + 4294967295, + 4294967295 +#ifdef UNITY_SUPPORT_64 + ,0xFFFFFFFFFFFFFFFF +#endif +}; + +//----------------------------------------------- +// Pretty Printers & Test Result Output Handlers +//----------------------------------------------- + +void UnityPrint(const char* string) +{ + const char* pch = string; + + if (pch != NULL) + { + while (*pch) + { + // printable characters plus CR & LF are printed + if ((*pch <= 126) && (*pch >= 32)) + { + UNITY_OUTPUT_CHAR(*pch); + } + //write escaped carriage returns + else if (*pch == 13) + { + UNITY_OUTPUT_CHAR('\\'); + UNITY_OUTPUT_CHAR('r'); + } + //write escaped line feeds + else if (*pch == 10) + { + UNITY_OUTPUT_CHAR('\\'); + UNITY_OUTPUT_CHAR('n'); + } + // unprintable characters are shown as codes + else + { + UNITY_OUTPUT_CHAR('\\'); + UnityPrintNumberHex((_U_SINT)*pch, 2); + } + pch++; + } + } +} + +//----------------------------------------------- +void UnityPrintNumberByStyle(const _U_SINT number, const UNITY_DISPLAY_STYLE_T style) +{ + if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT) + { + UnityPrintNumber(number); + } + else if ((style & UNITY_DISPLAY_RANGE_UINT) == UNITY_DISPLAY_RANGE_UINT) + { + UnityPrintNumberUnsigned( (_U_UINT)number & UnitySizeMask[((_U_UINT)style & (_U_UINT)0x0F) - 1] ); + } + else + { + UnityPrintNumberHex((_U_UINT)number, (style & 0x000F) << 1); + } +} + +//----------------------------------------------- +/// basically do an itoa using as little ram as possible +void UnityPrintNumber(const _U_SINT number_to_print) +{ + _U_SINT divisor = 1; + _U_SINT next_divisor; + _U_SINT number = number_to_print; + + if (number < 0) + { + UNITY_OUTPUT_CHAR('-'); + number = -number; + } + + // figure out initial divisor + while (number / divisor > 9) + { + next_divisor = divisor * 10; + if (next_divisor > divisor) + divisor = next_divisor; + else + break; + } + + // now mod and print, then divide divisor + do + { + UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10))); + divisor /= 10; + } + while (divisor > 0); +} + +//----------------------------------------------- +/// basically do an itoa using as little ram as possible +void UnityPrintNumberUnsigned(const _U_UINT number) +{ + _U_UINT divisor = 1; + _U_UINT next_divisor; + + // figure out initial divisor + while (number / divisor > 9) + { + next_divisor = divisor * 10; + if (next_divisor > divisor) + divisor = next_divisor; + else + break; + } + + // now mod and print, then divide divisor + do + { + UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10))); + divisor /= 10; + } + while (divisor > 0); +} + +//----------------------------------------------- +void UnityPrintNumberHex(const _U_UINT number, const char nibbles_to_print) +{ + _U_UINT nibble; + char nibbles = nibbles_to_print; + UNITY_OUTPUT_CHAR('0'); + UNITY_OUTPUT_CHAR('x'); + + while (nibbles > 0) + { + nibble = (number >> (--nibbles << 2)) & 0x0000000F; + if (nibble <= 9) + { + UNITY_OUTPUT_CHAR((char)('0' + nibble)); + } + else + { + UNITY_OUTPUT_CHAR((char)('A' - 10 + nibble)); + } + } +} + +//----------------------------------------------- +void UnityPrintMask(const _U_UINT mask, const _U_UINT number) +{ + _U_UINT current_bit = (_U_UINT)1 << (UNITY_INT_WIDTH - 1); + _US32 i; + + for (i = 0; i < UNITY_INT_WIDTH; i++) + { + if (current_bit & mask) + { + if (current_bit & number) + { + UNITY_OUTPUT_CHAR('1'); + } + else + { + UNITY_OUTPUT_CHAR('0'); + } + } + else + { + UNITY_OUTPUT_CHAR('X'); + } + current_bit = current_bit >> 1; + } +} + +//----------------------------------------------- +#ifdef UNITY_FLOAT_VERBOSE +void UnityPrintFloat(_UF number) +{ + char TempBuffer[32]; + sprintf(TempBuffer, "%.6f", number); + UnityPrint(TempBuffer); +} +#endif + +//----------------------------------------------- +void UnityTestResultsBegin(const char* file, const UNITY_LINE_TYPE line) +{ + UnityPrint(file); + UNITY_OUTPUT_CHAR(':'); + UnityPrintNumber(line); + UNITY_OUTPUT_CHAR(':'); + UnityPrint(Unity.CurrentTestName); + UNITY_OUTPUT_CHAR(':'); +} + +//----------------------------------------------- +void UnityTestResultsFailBegin(const UNITY_LINE_TYPE line) +{ + UnityTestResultsBegin(Unity.TestFile, line); + UnityPrint("FAIL:"); +} + +//----------------------------------------------- +void UnityConcludeTest(void) +{ + if (Unity.CurrentTestIgnored) + { + Unity.TestIgnores++; + } + else if (!Unity.CurrentTestFailed) + { + UnityTestResultsBegin(Unity.TestFile, Unity.CurrentTestLineNumber); + UnityPrint("PASS"); + UNITY_PRINT_EOL; + } + else + { + Unity.TestFailures++; + } + + Unity.CurrentTestFailed = 0; + Unity.CurrentTestIgnored = 0; +} + +//----------------------------------------------- +void UnityAddMsgIfSpecified(const char* msg) +{ + if (msg) + { + UnityPrint(UnityStrSpacer); + UnityPrint(msg); + } +} + +//----------------------------------------------- +void UnityPrintExpectedAndActualStrings(const char* expected, const char* actual) +{ + UnityPrint(UnityStrExpected); + if (expected != NULL) + { + UNITY_OUTPUT_CHAR('\''); + UnityPrint(expected); + UNITY_OUTPUT_CHAR('\''); + } + else + { + UnityPrint(UnityStrNull); + } + UnityPrint(UnityStrWas); + if (actual != NULL) + { + UNITY_OUTPUT_CHAR('\''); + UnityPrint(actual); + UNITY_OUTPUT_CHAR('\''); + } + else + { + UnityPrint(UnityStrNull); + } +} + +//----------------------------------------------- +// Assertion & Control Helpers +//----------------------------------------------- + +int UnityCheckArraysForNull(const void* expected, const void* actual, const UNITY_LINE_TYPE lineNumber, const char* msg) +{ + //return true if they are both NULL + if ((expected == NULL) && (actual == NULL)) + return 1; + + //throw error if just expected is NULL + if (expected == NULL) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrNullPointerForExpected); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + //throw error if just actual is NULL + if (actual == NULL) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrNullPointerForActual); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + //return false if neither is NULL + return 0; +} + +//----------------------------------------------- +// Assertion Functions +//----------------------------------------------- + +void UnityAssertBits(const _U_SINT mask, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + UNITY_SKIP_EXECUTION; + + if ((mask & expected) != (mask & actual)) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrExpected); + UnityPrintMask(mask, expected); + UnityPrint(UnityStrWas); + UnityPrintMask(mask, actual); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualNumber(const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style) +{ + UNITY_SKIP_EXECUTION; + + if (expected != actual) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(expected, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(actual, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualIntArray(const _U_SINT* expected, + const _U_SINT* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style) +{ + _UU32 elements = num_elements; + const _US8* ptr_exp = (_US8*)expected; + const _US8* ptr_act = (_US8*)actual; + + UNITY_SKIP_EXECUTION; + + if (elements == 0) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + switch(style) + { + case UNITY_DISPLAY_STYLE_HEX8: + case UNITY_DISPLAY_STYLE_INT8: + case UNITY_DISPLAY_STYLE_UINT8: + while (elements--) + { + if (*ptr_exp != *ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 1; + ptr_act += 1; + } + break; + case UNITY_DISPLAY_STYLE_HEX16: + case UNITY_DISPLAY_STYLE_INT16: + case UNITY_DISPLAY_STYLE_UINT16: + while (elements--) + { + if (*(_US16*)ptr_exp != *(_US16*)ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*(_US16*)ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*(_US16*)ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 2; + ptr_act += 2; + } + break; +#ifdef UNITY_SUPPORT_64 + case UNITY_DISPLAY_STYLE_HEX64: + case UNITY_DISPLAY_STYLE_INT64: + case UNITY_DISPLAY_STYLE_UINT64: + while (elements--) + { + if (*(_US64*)ptr_exp != *(_US64*)ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*(_US64*)ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*(_US64*)ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 8; + ptr_act += 8; + } + break; +#endif + default: + while (elements--) + { + if (*(_US32*)ptr_exp != *(_US32*)ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*(_US32*)ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*(_US32*)ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 4; + ptr_act += 4; + } + break; + } +} + +//----------------------------------------------- +#ifndef UNITY_EXCLUDE_FLOAT +void UnityAssertEqualFloatArray(const _UF* expected, + const _UF* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UU32 elements = num_elements; + const _UF* ptr_expected = expected; + const _UF* ptr_actual = actual; + _UF diff, tol; + + UNITY_SKIP_EXECUTION; + + if (elements == 0) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + while (elements--) + { + diff = *ptr_expected - *ptr_actual; + if (diff < 0.0) + diff = 0.0 - diff; + tol = UNITY_FLOAT_PRECISION * *ptr_expected; + if (tol < 0.0) + tol = 0.0 - tol; + if (diff > tol) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); +#ifdef UNITY_FLOAT_VERBOSE + UnityPrint(UnityStrExpected); + UnityPrintFloat(*ptr_expected); + UnityPrint(UnityStrWas); + UnityPrintFloat(*ptr_actual); +#else + UnityPrint(UnityStrDelta); +#endif + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_expected++; + ptr_actual++; + } +} + +//----------------------------------------------- +void UnityAssertFloatsWithin(const _UF delta, + const _UF expected, + const _UF actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UF diff = actual - expected; + _UF pos_delta = delta; + + UNITY_SKIP_EXECUTION; + + if (diff < 0) + { + diff = 0.0f - diff; + } + if (pos_delta < 0) + { + pos_delta = 0.0f - pos_delta; + } + + if (pos_delta < diff) + { + UnityTestResultsFailBegin(lineNumber); +#ifdef UNITY_FLOAT_VERBOSE + UnityPrint(UnityStrExpected); + UnityPrintFloat(expected); + UnityPrint(UnityStrWas); + UnityPrintFloat(actual); +#else + UnityPrint(UnityStrDelta); +#endif + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} +#endif + +//----------------------------------------------- +void UnityAssertNumbersWithin( const _U_SINT delta, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style) +{ + UNITY_SKIP_EXECUTION; + + if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT) + { + if (actual > expected) + Unity.CurrentTestFailed = ((actual - expected) > delta); + else + Unity.CurrentTestFailed = ((expected - actual) > delta); + } + else + { + if ((_U_UINT)actual > (_U_UINT)expected) + Unity.CurrentTestFailed = ((_U_UINT)(actual - expected) > (_U_UINT)delta); + else + Unity.CurrentTestFailed = ((_U_UINT)(expected - actual) > (_U_UINT)delta); + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrDelta); + UnityPrintNumberByStyle(delta, style); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(expected, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(actual, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualString(const char* expected, + const char* actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UU32 i; + + UNITY_SKIP_EXECUTION; + + // if both pointers not null compare the strings + if (expected && actual) + { + for (i = 0; expected[i] || actual[i]; i++) + { + if (expected[i] != actual[i]) + { + Unity.CurrentTestFailed = 1; + break; + } + } + } + else + { // handle case of one pointers being null (if both null, test should pass) + if (expected != actual) + { + Unity.CurrentTestFailed = 1; + } + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrintExpectedAndActualStrings(expected, actual); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualStringArray( const char** expected, + const char** actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UU32 i, j = 0; + + UNITY_SKIP_EXECUTION; + + // if no elements, it's an error + if (num_elements == 0) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + do + { + // if both pointers not null compare the strings + if (expected[j] && actual[j]) + { + for (i = 0; expected[j][i] || actual[j][i]; i++) + { + if (expected[j][i] != actual[j][i]) + { + Unity.CurrentTestFailed = 1; + break; + } + } + } + else + { // handle case of one pointers being null (if both null, test should pass) + if (expected[j] != actual[j]) + { + Unity.CurrentTestFailed = 1; + } + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + if (num_elements > 1) + { + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - j - 1), UNITY_DISPLAY_STYLE_UINT); + } + UnityPrintExpectedAndActualStrings((const char*)(expected[j]), (const char*)(actual[j])); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + } while (++j < num_elements); +} + +//----------------------------------------------- +void UnityAssertEqualMemory( const void* expected, + const void* actual, + _UU32 length, + _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + unsigned char* expected_ptr = (unsigned char*)expected; + unsigned char* actual_ptr = (unsigned char*)actual; + _UU32 elements = num_elements; + + UNITY_SKIP_EXECUTION; + + if ((elements == 0) || (length == 0)) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + while (elements--) + { + if (memcmp((const void*)expected_ptr, (const void*)actual_ptr, length) != 0) + { + Unity.CurrentTestFailed = 1; + break; + } + expected_ptr += length; + actual_ptr += length; + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + if (num_elements > 1) + { + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + } + UnityPrint(UnityStrMemory); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +// Control Functions +//----------------------------------------------- + +void UnityFail(const char* msg, const UNITY_LINE_TYPE line) +{ + UNITY_SKIP_EXECUTION; + + UnityTestResultsBegin(Unity.TestFile, line); + UnityPrint("FAIL"); + if (msg != NULL) + { + UNITY_OUTPUT_CHAR(':'); + if (msg[0] != ' ') + { + UNITY_OUTPUT_CHAR(' '); + } + UnityPrint(msg); + } + UNITY_FAIL_AND_BAIL; +} + +//----------------------------------------------- +void UnityIgnore(const char* msg, const UNITY_LINE_TYPE line) +{ + UNITY_SKIP_EXECUTION; + + UnityTestResultsBegin(Unity.TestFile, line); + UnityPrint("IGNORE"); + if (msg != NULL) + { + UNITY_OUTPUT_CHAR(':'); + UNITY_OUTPUT_CHAR(' '); + UnityPrint(msg); + } + UNITY_IGNORE_AND_BAIL; +} + +//----------------------------------------------- +void setUp(void); +void tearDown(void); +void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum) +{ + Unity.CurrentTestName = FuncName; + Unity.CurrentTestLineNumber = FuncLineNum; + Unity.NumberOfTests++; + if (TEST_PROTECT()) + { + setUp(); + Func(); + } + if (TEST_PROTECT() && !(Unity.CurrentTestIgnored)) + { + tearDown(); + } + UnityConcludeTest(); +} + +//----------------------------------------------- +void UnityBegin(void) +{ + Unity.NumberOfTests = 0; +} + +//----------------------------------------------- +int UnityEnd(void) +{ + UnityPrint("-----------------------"); + UNITY_PRINT_EOL; + UnityPrintNumber(Unity.NumberOfTests); + UnityPrint(" Tests "); + UnityPrintNumber(Unity.TestFailures); + UnityPrint(" Failures "); + UnityPrintNumber(Unity.TestIgnores); + UnityPrint(" Ignored"); + UNITY_PRINT_EOL; + if (Unity.TestFailures == 0U) + { + UnityPrint("OK"); + } + else + { + UnityPrint("FAIL"); + } + UNITY_PRINT_EOL; + return Unity.TestFailures; +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/src/unity.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/src/unity.h new file mode 100644 index 0000000..0b1b187 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/src/unity.h @@ -0,0 +1,213 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FRAMEWORK_H +#define UNITY_FRAMEWORK_H + +#define UNITY + +#include "unity_internals.h" + +//------------------------------------------------------- +// Configuration Options +//------------------------------------------------------- + +// Integers +// - Unity assumes 32 bit integers by default +// - If your compiler treats ints of a different size, define UNITY_INT_WIDTH + +// Floats +// - define UNITY_EXCLUDE_FLOAT to disallow floating point comparisons +// - define UNITY_FLOAT_PRECISION to specify the precision to use when doing TEST_ASSERT_EQUAL_FLOAT +// - define UNITY_FLOAT_TYPE to specify doubles instead of single precision floats +// - define UNITY_FLOAT_VERBOSE to print floating point values in errors (uses sprintf) + +// Output +// - by default, Unity prints to standard out with putchar. define UNITY_OUTPUT_CHAR(a) with a different function if desired + +// Optimization +// - by default, line numbers are stored in unsigned shorts. Define UNITY_LINE_TYPE with a different type if your files are huge +// - by default, test and failure counters are unsigned shorts. Define UNITY_COUNTER_TYPE with a different type if you want to save space or have more than 65535 Tests. + +// Test Cases +// - define UNITY_SUPPORT_TEST_CASES to include the TEST_CASE macro, though really it's mostly about the runner generator script + +// Parameterized Tests +// - you'll want to create a define of TEST_CASE(...) which basically evaluates to nothing + +//------------------------------------------------------- +// Test Running Macros +//------------------------------------------------------- + +#define TEST_PROTECT() (setjmp(Unity.AbortFrame) == 0) + +#define TEST_ABORT() {longjmp(Unity.AbortFrame, 1);} + +#ifndef RUN_TEST +#define RUN_TEST(func, line_num) UnityDefaultTestRun(func, #func, line_num) +#endif + +#define TEST_LINE_NUM (Unity.CurrentTestLineNumber) +#define TEST_IS_IGNORED (Unity.CurrentTestIgnored) + +//------------------------------------------------------- +// Basic Fail and Ignore +//------------------------------------------------------- + +#define TEST_FAIL_MESSAGE(message) UNITY_TEST_FAIL(__LINE__, message) +#define TEST_FAIL() UNITY_TEST_FAIL(__LINE__, NULL) +#define TEST_IGNORE_MESSAGE(message) UNITY_TEST_IGNORE(__LINE__, message) +#define TEST_IGNORE() UNITY_TEST_IGNORE(__LINE__, NULL) +#define TEST_ONLY() + +//------------------------------------------------------- +// Test Asserts (simple) +//------------------------------------------------------- + +//Boolean +#define TEST_ASSERT(condition) UNITY_TEST_ASSERT( (condition), __LINE__, " Expression Evaluated To FALSE") +#define TEST_ASSERT_TRUE(condition) UNITY_TEST_ASSERT( (condition), __LINE__, " Expected TRUE Was FALSE") +#define TEST_ASSERT_UNLESS(condition) UNITY_TEST_ASSERT( !(condition), __LINE__, " Expression Evaluated To TRUE") +#define TEST_ASSERT_FALSE(condition) UNITY_TEST_ASSERT( !(condition), __LINE__, " Expected FALSE Was TRUE") +#define TEST_ASSERT_NULL(pointer) UNITY_TEST_ASSERT_NULL( (pointer), __LINE__, " Expected NULL") +#define TEST_ASSERT_NOT_NULL(pointer) UNITY_TEST_ASSERT_NOT_NULL((pointer), __LINE__, " Expected Non-NULL") + +//Integers (of all sizes) +#define TEST_ASSERT_EQUAL_INT(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT8(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT8((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT16(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT16((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT32(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT32((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT64(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT64((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_NOT_EQUAL(expected, actual) UNITY_TEST_ASSERT(((expected) != (actual)), __LINE__, " Expected Not-Equal") +#define TEST_ASSERT_EQUAL_UINT(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT8(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT8( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT16(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT16( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT32(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT32( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT64(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT64( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX8(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX8( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX16(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX16((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX32(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX64(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX64((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_BITS(mask, expected, actual) UNITY_TEST_ASSERT_BITS((mask), (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_BITS_HIGH(mask, actual) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(-1), (actual), __LINE__, NULL) +#define TEST_ASSERT_BITS_LOW(mask, actual) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(0), (actual), __LINE__, NULL) +#define TEST_ASSERT_BIT_HIGH(bit, actual) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(-1), (actual), __LINE__, NULL) +#define TEST_ASSERT_BIT_LOW(bit, actual) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(0), (actual), __LINE__, NULL) + +//Integer Ranges (of all sizes) +#define TEST_ASSERT_INT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_UINT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX8_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX16_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX32_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX64_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, __LINE__, NULL) + +//Structs and Strings +#define TEST_ASSERT_EQUAL_PTR(expected, actual) UNITY_TEST_ASSERT_EQUAL_PTR((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_STRING(expected, actual) UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_MEMORY(expected, actual, len) UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, __LINE__, NULL) + +//Arrays +#define TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements) UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, __LINE__, NULL) + +//Floating Point (If Enabled) +#define TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_FLOAT(expected, actual) UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, __LINE__, NULL) + +//------------------------------------------------------- +// Test Asserts (with additional messages) +//------------------------------------------------------- + +//Boolean +#define TEST_ASSERT_MESSAGE(condition, message) UNITY_TEST_ASSERT( (condition), __LINE__, message) +#define TEST_ASSERT_TRUE_MESSAGE(condition, message) UNITY_TEST_ASSERT( (condition), __LINE__, message) +#define TEST_ASSERT_UNLESS_MESSAGE(condition, message) UNITY_TEST_ASSERT( !(condition), __LINE__, message) +#define TEST_ASSERT_FALSE_MESSAGE(condition, message) UNITY_TEST_ASSERT( !(condition), __LINE__, message) +#define TEST_ASSERT_NULL_MESSAGE(pointer, message) UNITY_TEST_ASSERT_NULL( (pointer), __LINE__, message) +#define TEST_ASSERT_NOT_NULL_MESSAGE(pointer, message) UNITY_TEST_ASSERT_NOT_NULL((pointer), __LINE__, message) + +//Integers (of all sizes) +#define TEST_ASSERT_EQUAL_INT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT8((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT16((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT32((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT64((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, message) +#define TEST_ASSERT_NOT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT(((expected) != (actual)), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT8( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT16( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT32( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT64( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX8( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX16((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX64((expected), (actual), __LINE__, message) +#define TEST_ASSERT_BITS_MESSAGE(mask, expected, actual, message) UNITY_TEST_ASSERT_BITS((mask), (expected), (actual), __LINE__, message) +#define TEST_ASSERT_BITS_HIGH_MESSAGE(mask, actual, message) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(-1), (actual), __LINE__, message) +#define TEST_ASSERT_BITS_LOW_MESSAGE(mask, actual, message) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(0), (actual), __LINE__, message) +#define TEST_ASSERT_BIT_HIGH_MESSAGE(bit, actual, message) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(-1), (actual), __LINE__, message) +#define TEST_ASSERT_BIT_LOW_MESSAGE(bit, actual, message) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(0), (actual), __LINE__, message) + +//Integer Ranges (of all sizes) +#define TEST_ASSERT_INT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_UINT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX8_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX16_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX32_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX64_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, __LINE__, message) + +//Structs and Strings +#define TEST_ASSERT_EQUAL_PTR_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_PTR(expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_STRING_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_MEMORY_MESSAGE(expected, actual, len, message) UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, __LINE__, message) + +//Arrays +#define TEST_ASSERT_EQUAL_INT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_STRING_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_MEMORY_ARRAY_MESSAGE(expected, actual, len, num_elements, message) UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, __LINE__, message) + +//Floating Point (If Enabled) +#define TEST_ASSERT_FLOAT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_FLOAT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_FLOAT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, __LINE__, message) +#endif diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/src/unity_internals.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/src/unity_internals.h new file mode 100644 index 0000000..29c9d1d --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/src/unity_internals.h @@ -0,0 +1,355 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_INTERNALS_H +#define UNITY_INTERNALS_H + +#include +#include + +//------------------------------------------------------- +// Int Support +//------------------------------------------------------- + +#ifndef UNITY_INT_WIDTH +#define UNITY_INT_WIDTH (32) +#endif + +#ifndef UNITY_LONG_WIDTH +#define UNITY_LONG_WIDTH (32) +#endif + +#if (UNITY_INT_WIDTH == 32) + typedef unsigned char _UU8; + typedef unsigned short _UU16; + typedef unsigned int _UU32; + typedef signed char _US8; + typedef signed short _US16; + typedef signed int _US32; +#elif (UNITY_INT_WIDTH == 16) + typedef unsigned char _UU8; + typedef unsigned int _UU16; + typedef unsigned long _UU32; + typedef signed char _US8; + typedef signed int _US16; + typedef signed long _US32; +#else + #error Invalid UNITY_INT_WIDTH specified! (16 or 32 are supported) +#endif + +//------------------------------------------------------- +// 64-bit Support +//------------------------------------------------------- + +#ifndef UNITY_SUPPORT_64 + +//No 64-bit Support +typedef _UU32 _U_UINT; +typedef _US32 _U_SINT; + +#else + +//64-bit Support +#if (UNITY_LONG_WIDTH == 32) + typedef unsigned long long _UU64; + typedef signed long long _US64; +#elif (UNITY_LONG_WIDTH == 64) + typedef unsigned long _UU64; + typedef signed long _US64; +#else + #error Invalid UNITY_LONG_WIDTH specified! (32 or 64 are supported) +#endif +typedef _UU64 _U_UINT; +typedef _US64 _U_SINT; + +#endif + +//------------------------------------------------------- +// Pointer Support +//------------------------------------------------------- + +#ifndef UNITY_POINTER_WIDTH +#define UNITY_POINTER_WIDTH (32) +#endif + +#if (UNITY_POINTER_WIDTH == 32) + typedef _UU32 _UP; +#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX32 +#elif (UNITY_POINTER_WIDTH == 64) + typedef _UU64 _UP; +#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX64 +#elif (UNITY_POINTER_WIDTH == 16) + typedef _UU16 _UP; +#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX16 +#else + #error Invalid UNITY_POINTER_WIDTH specified! (16, 32 or 64 are supported) +#endif + +//------------------------------------------------------- +// Float Support +//------------------------------------------------------- + +#ifdef UNITY_EXCLUDE_FLOAT + +//No Floating Point Support +#undef UNITY_FLOAT_PRECISION +#undef UNITY_FLOAT_TYPE +#undef UNITY_FLOAT_VERBOSE + +#else + +//Floating Point Support +#ifndef UNITY_FLOAT_PRECISION +#define UNITY_FLOAT_PRECISION (0.00001f) +#endif +#ifndef UNITY_FLOAT_TYPE +#define UNITY_FLOAT_TYPE float +#endif +typedef UNITY_FLOAT_TYPE _UF; + +#endif + +//------------------------------------------------------- +// Output Method +//------------------------------------------------------- + +#ifndef UNITY_OUTPUT_CHAR +//Default to using putchar, which is defined in stdio.h above +#define UNITY_OUTPUT_CHAR(a) putchar(a) +#else +//If defined as something else, make sure we declare it here so it's ready for use +extern int UNITY_OUTPUT_CHAR(int); +#endif + +//------------------------------------------------------- +// Footprint +//------------------------------------------------------- + +#ifndef UNITY_LINE_TYPE +#define UNITY_LINE_TYPE unsigned short +#endif + +#ifndef UNITY_COUNTER_TYPE +#define UNITY_COUNTER_TYPE unsigned short +#endif + +//------------------------------------------------------- +// Internal Structs Needed +//------------------------------------------------------- + +typedef void (*UnityTestFunction)(void); + +#define UNITY_DISPLAY_RANGE_INT (0x10) +#define UNITY_DISPLAY_RANGE_UINT (0x20) +#define UNITY_DISPLAY_RANGE_HEX (0x40) +#define UNITY_DISPLAY_RANGE_AUTO (0x80) + +typedef enum +{ + UNITY_DISPLAY_STYLE_INT = 4 + UNITY_DISPLAY_RANGE_INT + UNITY_DISPLAY_RANGE_AUTO, + UNITY_DISPLAY_STYLE_INT8 = 1 + UNITY_DISPLAY_RANGE_INT, + UNITY_DISPLAY_STYLE_INT16 = 2 + UNITY_DISPLAY_RANGE_INT, + UNITY_DISPLAY_STYLE_INT32 = 4 + UNITY_DISPLAY_RANGE_INT, +#ifdef UNITY_SUPPORT_64 + UNITY_DISPLAY_STYLE_INT64 = 8 + UNITY_DISPLAY_RANGE_INT, +#endif + UNITY_DISPLAY_STYLE_UINT = 4 + UNITY_DISPLAY_RANGE_UINT + UNITY_DISPLAY_RANGE_AUTO, + UNITY_DISPLAY_STYLE_UINT8 = 1 + UNITY_DISPLAY_RANGE_UINT, + UNITY_DISPLAY_STYLE_UINT16 = 2 + UNITY_DISPLAY_RANGE_UINT, + UNITY_DISPLAY_STYLE_UINT32 = 4 + UNITY_DISPLAY_RANGE_UINT, +#ifdef UNITY_SUPPORT_64 + UNITY_DISPLAY_STYLE_UINT64 = 8 + UNITY_DISPLAY_RANGE_UINT, +#endif + UNITY_DISPLAY_STYLE_HEX8 = 1 + UNITY_DISPLAY_RANGE_HEX, + UNITY_DISPLAY_STYLE_HEX16 = 2 + UNITY_DISPLAY_RANGE_HEX, + UNITY_DISPLAY_STYLE_HEX32 = 4 + UNITY_DISPLAY_RANGE_HEX, +#ifdef UNITY_SUPPORT_64 + UNITY_DISPLAY_STYLE_HEX64 = 8 + UNITY_DISPLAY_RANGE_HEX, +#endif +} UNITY_DISPLAY_STYLE_T; + +struct _Unity +{ + const char* TestFile; + const char* CurrentTestName; + _UU32 CurrentTestLineNumber; + UNITY_COUNTER_TYPE NumberOfTests; + UNITY_COUNTER_TYPE TestFailures; + UNITY_COUNTER_TYPE TestIgnores; + UNITY_COUNTER_TYPE CurrentTestFailed; + UNITY_COUNTER_TYPE CurrentTestIgnored; + jmp_buf AbortFrame; +}; + +extern struct _Unity Unity; + +//------------------------------------------------------- +// Test Suite Management +//------------------------------------------------------- + +void UnityBegin(void); +int UnityEnd(void); +void UnityConcludeTest(void); +void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum); + +//------------------------------------------------------- +// Test Output +//------------------------------------------------------- + +void UnityPrint(const char* string); +void UnityPrintMask(const _U_UINT mask, const _U_UINT number); +void UnityPrintNumberByStyle(const _U_SINT number, const UNITY_DISPLAY_STYLE_T style); +void UnityPrintNumber(const _U_SINT number); +void UnityPrintNumberUnsigned(const _U_UINT number); +void UnityPrintNumberHex(const _U_UINT number, const char nibbles); + +#ifdef UNITY_FLOAT_VERBOSE +void UnityPrintFloat(const _UF number); +#endif + +//------------------------------------------------------- +// Test Assertion Fuctions +//------------------------------------------------------- +// Use the macros below this section instead of calling +// these directly. The macros have a consistent naming +// convention and will pull in file and line information +// for you. + +void UnityAssertEqualNumber(const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style); + +void UnityAssertEqualIntArray(const _U_SINT* expected, + const _U_SINT* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style); + +void UnityAssertBits(const _U_SINT mask, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualString(const char* expected, + const char* actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualStringArray( const char** expected, + const char** actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualMemory( const void* expected, + const void* actual, + const _UU32 length, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertNumbersWithin(const _U_SINT delta, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style); + +void UnityFail(const char* message, const UNITY_LINE_TYPE line); + +void UnityIgnore(const char* message, const UNITY_LINE_TYPE line); + +#ifndef UNITY_EXCLUDE_FLOAT +void UnityAssertFloatsWithin(const _UF delta, + const _UF expected, + const _UF actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualFloatArray(const _UF* expected, + const _UF* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber); +#endif + +//------------------------------------------------------- +// Basic Fail and Ignore +//------------------------------------------------------- + +#define UNITY_TEST_FAIL(line, message) UnityFail( (message), (UNITY_LINE_TYPE)line); +#define UNITY_TEST_IGNORE(line, message) UnityIgnore( (message), (UNITY_LINE_TYPE)line); + +//------------------------------------------------------- +// Test Asserts +//------------------------------------------------------- + +#define UNITY_TEST_ASSERT(condition, line, message) if (condition) {} else {UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, message);} +#define UNITY_TEST_ASSERT_NULL(pointer, line, message) UNITY_TEST_ASSERT(((pointer) == NULL), (UNITY_LINE_TYPE)line, message) +#define UNITY_TEST_ASSERT_NOT_NULL(pointer, line, message) UNITY_TEST_ASSERT(((pointer) != NULL), (UNITY_LINE_TYPE)line, message) + +#define UNITY_TEST_ASSERT_EQUAL_INT(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_UINT(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_HEX8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX8) +#define UNITY_TEST_ASSERT_EQUAL_HEX16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX16) +#define UNITY_TEST_ASSERT_EQUAL_HEX32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX32) +#define UNITY_TEST_ASSERT_BITS(mask, expected, actual, line, message) UnityAssertBits((_U_SINT)(mask), (_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line) + +#define UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX8) +#define UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX16) +#define UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX32) +#define UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64) + +#define UNITY_TEST_ASSERT_EQUAL_PTR(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(_UP)(expected), (_U_SINT)(_UP)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_POINTER) +#define UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, line, message) UnityAssertEqualString((const char*)(expected), (const char*)(actual), (message), (UNITY_LINE_TYPE)line) +#define UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, line, message) UnityAssertEqualMemory((void*)(expected), (void*)(actual), (_UU32)(len), 1, (message), (UNITY_LINE_TYPE)line) + +#define UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT8) +#define UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT16) +#define UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT32) +#define UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT8) +#define UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT16) +#define UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT32) +#define UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX8) +#define UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX16) +#define UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX32) +#define UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualStringArray((const char**)(expected), (const char**)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line) +#define UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, line, message) UnityAssertEqualMemory((void*)(expected), (void*)(actual), (_UU32)(len), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line) + +#ifdef UNITY_SUPPORT_64 +#define UNITY_TEST_ASSERT_EQUAL_INT64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT64) +#define UNITY_TEST_ASSERT_EQUAL_UINT64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT64) +#define UNITY_TEST_ASSERT_EQUAL_HEX64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64) +#define UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT64) +#define UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT64) +#define UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64) +#endif + +#ifdef UNITY_EXCLUDE_FLOAT +#define UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled") +#define UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled") +#define UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled") +#else +#define UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, line, message) UnityAssertFloatsWithin((_UF)(delta), (_UF)(expected), (_UF)(actual), (message), (UNITY_LINE_TYPE)line) +#define UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, line, message) UNITY_TEST_ASSERT_FLOAT_WITHIN((_UF)(expected) * (_UF)UNITY_FLOAT_PRECISION, (_UF)expected, (_UF)actual, (UNITY_LINE_TYPE)line, message) +#define UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualFloatArray((_UF*)(expected), (_UF*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line) +#endif + +#endif diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/gcc.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/gcc.yml new file mode 100644 index 0000000..0f18c6c --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/gcc.yml @@ -0,0 +1,42 @@ +compiler: + path: gcc + source_path: 'src/' + unit_tests_path: &unit_tests_path 'test/' + build_path: &build_path 'build/' + options: + - '-c' + - '-Wall' + - '-Wno-address' + - '-std=c99' + - '-pedantic' + includes: + prefix: '-I' + items: + - 'src/' + - '../src/' + - *unit_tests_path + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - UNITY_SUPPORT_TEST_CASES + object_files: + prefix: '-o' + extension: '.o' + destination: *build_path +linker: + path: gcc + options: + - -lm + includes: + prefix: '-I' + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.exe' + destination: *build_path +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/gcc_64.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/gcc_64.yml new file mode 100644 index 0000000..97cb958 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/gcc_64.yml @@ -0,0 +1,43 @@ +compiler: + path: gcc + source_path: 'src/' + unit_tests_path: &unit_tests_path 'test/' + build_path: &build_path 'build/' + options: + - '-c' + - '-Wall' + - '-Wno-address' + - '-std=c99' + - '-pedantic' + includes: + prefix: '-I' + items: + - 'src/' + - '../src/' + - *unit_tests_path + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - UNITY_SUPPORT_TEST_CASES + - 'UNITY_POINTER_WIDTH=64' + object_files: + prefix: '-o' + extension: '.o' + destination: *build_path +linker: + path: gcc + options: + - -lm + includes: + prefix: '-I' + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.exe' + destination: *build_path +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/hitech_picc18.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/hitech_picc18.yml new file mode 100644 index 0000000..210d944 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/hitech_picc18.yml @@ -0,0 +1,101 @@ +# rumor has it that this yaml file works for the standard edition of the +# hitech PICC18 compiler, but not the pro version. +# +compiler: + path: cd build && picc18 + source_path: 'c:\Projects\NexGen\Prototypes\CMockTest\src\' + unit_tests_path: &unit_tests_path 'c:\Projects\NexGen\Prototypes\CMockTest\test\' + build_path: &build_path 'c:\Projects\NexGen\Prototypes\CMockTest\build\' + options: + - --chip=18F87J10 + - --ide=hitide + - --q #quiet please + - --asmlist + - --codeoffset=0 + - --emi=wordwrite # External memory interface protocol + - --warn=0 # allow all normal warning messages + - --errors=10 # Number of errors before aborting compile + - --char=unsigned + - -Bl # Large memory model + - -G # generate symbol file + - --cp=16 # 16-bit pointers + - --double=24 + - -N255 # 255-char symbol names + - --opt=none # Do not use any compiler optimziations + - -c # compile only + - -M + includes: + prefix: '-I' + items: + - 'c:/Projects/NexGen/Prototypes/CMockTest/src/' + - 'c:/Projects/NexGen/Prototypes/CMockTest/mocks/' + - 'c:/CMock/src/' + - 'c:/CMock/examples/src/' + - 'c:/CMock/vendor/unity/src/' + - 'c:/CMock/vendor/unity/examples/helper/' + - *unit_tests_path + defines: + prefix: '-D' + items: + - UNITY_INT_WIDTH=16 + - UNITY_POINTER_WIDTH=16 + - CMOCK_MEM_STATIC + - CMOCK_MEM_SIZE=3000 + - UNITY_SUPPORT_TEST_CASES + - _PICC18 + object_files: + # prefix: '-O' # Hi-Tech doesn't want a prefix. They key off of filename .extensions, instead + extension: '.obj' + destination: *build_path + +linker: + path: cd build && picc18 + options: + - --chip=18F87J10 + - --ide=hitide + - --cp=24 # 24-bit pointers. Is this needed for linker?? + - --double=24 # Is this needed for linker?? + - -Lw # Scan the pic87*w.lib in the lib/ of the compiler installation directory + - --summary=mem,file # info listing + - --summary=+psect + - --summary=+hex + - --output=+intel + - --output=+mcof + - --runtime=+init # Directs startup code to copy idata, ibigdata and ifardata psects from ROM to RAM. + - --runtime=+clear # Directs startup code to clear bss, bigbss, rbss and farbss psects + - --runtime=+clib # link in the c-runtime + - --runtime=+keep # Keep the generated startup src after its obj is linked + - -G # Generate src-level symbol file + - -MIWasTheLastToBuild.map + - --warn=0 # allow all normal warning messages + - -Bl # Large memory model (probably not needed for linking) + includes: + prefix: '-I' + object_files: + path: *build_path + extension: '.obj' + bin_files: + prefix: '-O' + extension: '.hex' + destination: *build_path + +simulator: + path: + pre_support: + - 'java -client -jar ' # note space + - ['C:\Program Files\HI-TECH Software\HI-TIDE\3.15\lib\', 'simpic18.jar'] + - 18F87J10 + post_support: + +:cmock: + :plugins: [] + :includes: + - Types.h + :suite_teardown: | + if (num_failures) + _FAILED_TEST(); + else + _PASSED_TESTS(); + return 0; + +colour: true \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_arm_v4.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_arm_v4.yml new file mode 100644 index 0000000..c2e7f18 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_arm_v4.yml @@ -0,0 +1,89 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 4.0 Kickstart\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\lib\dl4tptinl8n.h'] + - -z3 + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian little + - --cpu ARM7TDMI + - --stack_align 4 + - --interwork + - -e + - --silent + - --warnings_are_errors + - --fpu None + - --diag_suppress Pa050 + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'common\bin\xlink.exe'] + options: + - -rt + - [*tools_root, 'arm\lib\dl4tptinl8n.r79'] + - -D_L_EXTMEM_START=0 + - -D_L_EXTMEM_SIZE=0 + - -D_L_HEAP_SIZE=120 + - -D_L_STACK_SIZE=32 + - -e_small_write=_formatted_write + - -s + - __program_start + - -f + - [*tools_root, '\arm\config\lnkarm.xcl'] + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\config\'] + - [*tools_root, 'arm\lib\'] + object_files: + path: *build_path + extension: '.r79' + bin_files: + prefix: '-o' + extension: '.d79' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\ioat91sam7X256.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_arm_v5.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_arm_v5.yml new file mode 100644 index 0000000..0549d8e --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_arm_v5.yml @@ -0,0 +1,79 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian=little + - --cpu=ARM7TDMI + - --interwork + - --warnings_are_errors + - --fpu=None + - --diag_suppress=Pa050 + - --diag_suppress=Pe111 + - -e + - -On + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\debugger\atmel\ioat91sam7X256.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_arm_v5_3.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_arm_v5_3.yml new file mode 100644 index 0000000..0549d8e --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_arm_v5_3.yml @@ -0,0 +1,79 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian=little + - --cpu=ARM7TDMI + - --interwork + - --warnings_are_errors + - --fpu=None + - --diag_suppress=Pa050 + - --diag_suppress=Pe111 + - -e + - -On + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\debugger\atmel\ioat91sam7X256.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml new file mode 100644 index 0000000..eb0785c --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml @@ -0,0 +1,93 @@ +#Default tool path for IAR 5.4 on Windows XP 64bit +tools_root: &tools_root 'C:\Program Files (x86)\IAR Systems\Embedded Workbench 5.4 Kickstart\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --diag_suppress=Pa050 + #- --diag_suppress=Pe111 + - --debug + - --endian=little + - --cpu=Cortex-M3 + - --no_path_in_file_macros + - -e + - --fpu=None + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + #- --preinclude --preinclude C:\Vss\T2 Working\common\system.h + - --interwork + - --warnings_are_errors +# - Ohz + - -Oh +# - --no_cse +# - --no_unroll +# - --no_inline +# - --no_code_motion +# - --no_tbaa +# - --no_clustering +# - --no_scheduling + + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - ewarm + - PART_LM3S9B92 + - TARGET_IS_TEMPEST_RB1 + - USE_ROM_DRIVERS + - UART_BUFFERED + - UNITY_SUPPORT_64 + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic.icf'] +# - ['C:\Temp\lm3s9b92.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + #- --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim2.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - --endian=little + - --cpu=Cortex-M3 + - --fpu=None + - -p + - [*tools_root, 'arm\config\debugger\TexasInstruments\iolm3sxxxx.ddf'] + - --semihosting + - --device=LM3SxBxx + #- -d + #- sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_cortexm3_v5.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_cortexm3_v5.yml new file mode 100644 index 0000000..cf0d1d0 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_cortexm3_v5.yml @@ -0,0 +1,83 @@ +# unit testing under iar compiler / simulator for STM32 Cortex-M3 + +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.4\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian=little + - --cpu=Cortex-M3 + - --interwork + - --warnings_are_errors + - --fpu=None + - --diag_suppress=Pa050 + - --diag_suppress=Pe111 + - -e + - -On + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - 'IAR' + - 'UNITY_SUPPORT_64' + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic_cortex.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\debugger\ST\iostm32f107xx.ddf'] + - --cpu=Cortex-M3 + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_msp430.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_msp430.yml new file mode 100644 index 0000000..e022647 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_msp430.yml @@ -0,0 +1,94 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3 MSP430\' +core_root: &core_root [*tools_root, '430\'] +core_bin: &core_bin [*core_root, 'bin\'] +core_config: &core_config [*core_root, 'config\'] +core_lib: &core_lib [*core_root, 'lib\'] +core_inc: &core_inc [*core_root, 'inc\'] +core_config: &core_config [*core_root, 'config\'] + +compiler: + path: [*core_bin, 'icc430.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*core_lib, 'dlib\dl430fn.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --debug + - -e + - -Ol + - --multiplier=16 + - --double=32 + - --diag_suppress Pa050 + - --diag_suppress Pe111 + includes: + prefix: '-I' + items: + - *core_inc + - [*core_inc, 'dlib'] + - [*core_lib, 'dlib'] + - 'src\' + - '../src/' + - *unit_tests_path + - 'vendor\unity\src' + defines: + prefix: '-D' + items: + - '__MSP430F149__' + - 'INT_WIDTH=16' + - 'UNITY_EXCLUDE_FLOAT' + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r43' + destination: *build_path +linker: + path: [*core_bin, 'xlink.exe'] + options: + - -rt + - [*core_lib, 'dlib\dl430fn.r43'] + - -e_PrintfTiny=_Printf + - -e_ScanfSmall=_Scanf + - -s __program_start + - -D_STACK_SIZE=50 + - -D_DATA16_HEAP_SIZE=50 + - -D_DATA20_HEAP_SIZE=50 + - -f + - [*core_config, 'lnk430f5438.xcl'] + - -f + - [*core_config, 'multiplier.xcl'] + includes: + prefix: '-I' + items: + - *core_config + - *core_lib + - [*core_lib, 'dlib'] + object_files: + path: *build_path + extension: '.r79' + bin_files: + prefix: '-o' + extension: '.d79' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*core_bin, '430proc.dll'] + - [*core_bin, '430sim.dll'] + post_support: + - --plugin + - [*core_bin, '430bat.dll'] + - --backend -B + - --cpu MSP430F5438 + - -p + - [*core_config, 'MSP430F5438.ddf'] + - -d sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_sh2a_v6.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_sh2a_v6.yml new file mode 100644 index 0000000..ddc5603 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_sh2a_v6.yml @@ -0,0 +1,85 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 6.0\' +compiler: + path: [*tools_root, 'sh\bin\iccsh.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - -e + - --char_is_signed + - -Ol + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_scheduling + - --no_clustering + - --debug + - --dlib_config + - [*tools_root, 'sh\inc\DLib_Product.h'] + - --double=32 + - --code_model=huge + - --data_model=huge + - --core=sh2afpu + - --warnings_affect_exit_code + - --warnings_are_errors + - --mfc + - --use_unix_directory_separators + - --diag_suppress=Pe161 + includes: + prefix: '-I' + items: + - [*tools_root, 'sh\inc\'] + - [*tools_root, 'sh\inc\c'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.o' + destination: *build_path +linker: + path: [*tools_root, 'sh\bin\ilinksh.exe'] + options: + - --redirect __Printf=__PrintfSmall + - --redirect __Scanf=__ScanfSmall + - --config + - [*tools_root, 'sh\config\generic.icf'] + - --config_def _CSTACK_SIZE=0x800 + - --config_def _HEAP_SIZE=0x800 + - --config_def _INT_TABLE=0x10 + - --entry __iar_program_start + - --debug_lib + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'sh\bin\shproc.dll'] + - [*tools_root, 'sh\bin\shsim.dll'] + post_support: + - --plugin + - [*tools_root, 'sh\bin\shbat.dll'] + - --backend + - -B + - --core sh2afpu + - -p + - [*tools_root, 'sh\config\debugger\io7264.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_cmd.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_cmd.c new file mode 100644 index 0000000..42841d8 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_cmd.c @@ -0,0 +1,54 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include +#include "CException.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_def.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_def.c new file mode 100644 index 0000000..8280804 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_def.c @@ -0,0 +1,50 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_cmd.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_cmd.c new file mode 100644 index 0000000..e47b31c --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_cmd.c @@ -0,0 +1,76 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_def.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_def.c new file mode 100644 index 0000000..3ca9dba --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_def.c @@ -0,0 +1,72 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new1.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new1.c new file mode 100644 index 0000000..a7cbcd8 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new1.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + GlobalExpectCount = 0; + GlobalVerifyOrder = 0; + GlobalOrderError = NULL; + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new2.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new2.c new file mode 100644 index 0000000..2c76bf2 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new2.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_param.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_param.c new file mode 100644 index 0000000..23c04f4 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_param.c @@ -0,0 +1,73 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST_NO_ARGS +#define RUN_TEST(TestFunc, TestLineNum, ...) \ +{ \ + Unity.CurrentTestName = #TestFunc "(" #__VA_ARGS__ ")"; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(__VA_ARGS__); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21, RUN_TEST_NO_ARGS); + RUN_TEST(test_TheSecondThingToTest, 43, RUN_TEST_NO_ARGS); + + return (UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run1.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run1.c new file mode 100644 index 0000000..a7cbcd8 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run1.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + GlobalExpectCount = 0; + GlobalVerifyOrder = 0; + GlobalOrderError = NULL; + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run2.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run2.c new file mode 100644 index 0000000..2c76bf2 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run2.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_yaml.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_yaml.c new file mode 100644 index 0000000..68b545a --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_yaml.c @@ -0,0 +1,86 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include "two.h" +#include "three.h" +#include +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_yaml_setup(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_new1.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_new1.c new file mode 100644 index 0000000..e5bcac2 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_new1.c @@ -0,0 +1,60 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_new2.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_new2.c new file mode 100644 index 0000000..b7c7e5b --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_new2.c @@ -0,0 +1,63 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_param.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_param.c new file mode 100644 index 0000000..4157007 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_param.c @@ -0,0 +1,51 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST_NO_ARGS +#define RUN_TEST(TestFunc, TestLineNum, ...) \ +{ \ + Unity.CurrentTestName = #TestFunc "(" #__VA_ARGS__ ")"; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(__VA_ARGS__); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21, RUN_TEST_NO_ARGS); + RUN_TEST(test_TheSecondThingToTest, 43, RUN_TEST_NO_ARGS); + + return (UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_run1.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_run1.c new file mode 100644 index 0000000..e5bcac2 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_run1.c @@ -0,0 +1,60 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_run2.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_run2.c new file mode 100644 index 0000000..b7c7e5b --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_run2.c @@ -0,0 +1,63 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_yaml.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_yaml.c new file mode 100644 index 0000000..d109287 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_yaml.c @@ -0,0 +1,64 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "two.h" +#include "three.h" +#include +#include +#include +#include "CException.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_yaml_setup(); +} + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/test_generate_test_runner.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/test_generate_test_runner.rb new file mode 100644 index 0000000..61c8df9 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/test_generate_test_runner.rb @@ -0,0 +1,94 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +ruby_version = RUBY_VERSION.split('.') +if (ruby_version[1].to_i == 9) and (ruby_version[2].to_i > 1) + require 'rubygems' + gem 'test-unit' +end +require 'test/unit' +require './auto/generate_test_runner.rb' + +TEST_FILE = 'test/testdata/testsample.c' +TEST_MOCK = 'test/testdata/mocksample.c' +OUT_FILE = 'build/testsample_' +EXP_FILE = 'test/expectdata/testsample_' + +class TestGenerateTestRunner < Test::Unit::TestCase + def setup + end + + def teardown + end + + def verify_output_equal(subtest) + expected = File.read(EXP_FILE + subtest + '.c').gsub(/\r\n/,"\n") + actual = File.read(OUT_FILE + subtest + '.c').gsub(/\r\n/,"\n") + assert_equal(expected, actual, "Generated File Sub-Test '#{subtest}' Failed") + end + + def test_ShouldGenerateARunnerByCreatingRunnerWithOptions + sets = { 'def' => nil, + 'new1' => { :plugins => [:cexception], :includes => ['one.h', 'two.h'], :enforce_strict_ordering => true }, + 'new2' => { :plugins => [:ignore], :suite_setup => "a_custom_setup();", :suite_teardown => "a_custom_teardown();" } + } + + sets.each_pair do |subtest, options| + UnityTestRunnerGenerator.new(options).run(TEST_FILE, OUT_FILE + subtest + '.c') + verify_output_equal(subtest) + UnityTestRunnerGenerator.new(options).run(TEST_MOCK, OUT_FILE + 'mock_' + subtest + '.c') + verify_output_equal('mock_' + subtest) + end + end + + def test_ShouldGenerateARunnerByRunningRunnerWithOptions + sets = { 'run1' => { :plugins => [:cexception], :includes => ['one.h', 'two.h'], :enforce_strict_ordering => true }, + 'run2' => { :plugins => [:ignore], :suite_setup => "a_custom_setup();", :suite_teardown => "a_custom_teardown();" } + } + + sets.each_pair do |subtest, options| + UnityTestRunnerGenerator.new.run(TEST_FILE, OUT_FILE + subtest + '.c', options) + verify_output_equal(subtest) + UnityTestRunnerGenerator.new.run(TEST_MOCK, OUT_FILE + 'mock_' + subtest + '.c', options) + verify_output_equal('mock_' + subtest) + end + end + + def test_ShouldGenerateARunnerByPullingYamlOptions + subtest = 'yaml' + cmdstr = "ruby auto/generate_test_runner.rb test/testdata/sample.yml \"#{TEST_FILE}\" \"#{OUT_FILE + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal(subtest) + + cmdstr = "ruby auto/generate_test_runner.rb test/testdata/sample.yml \"#{TEST_MOCK}\" \"#{OUT_FILE + 'mock_' + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal('mock_' + subtest) + end + + def test_ShouldGenerateARunnerByPullingCommandlineOptions + subtest = 'cmd' + cmdstr = "ruby auto/generate_test_runner.rb -cexception \"#{TEST_FILE}\" \"#{OUT_FILE + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal(subtest) + + cmdstr = "ruby auto/generate_test_runner.rb -cexception \"#{TEST_MOCK}\" \"#{OUT_FILE + 'mock_' + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal('mock_' + subtest) + end + + def test_ShouldGenerateARunnerThatUsesParameterizedTests + sets = { 'param' => { :plugins => [:ignore], :use_param_tests => true } + } + + sets.each_pair do |subtest, options| + UnityTestRunnerGenerator.new(options).run(TEST_FILE, OUT_FILE + subtest + '.c') + verify_output_equal(subtest) + UnityTestRunnerGenerator.new(options).run(TEST_MOCK, OUT_FILE + 'mock_' + subtest + '.c') + verify_output_equal('mock_' + subtest) + end + end + +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/mocksample.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/mocksample.c new file mode 100644 index 0000000..b709438 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/mocksample.c @@ -0,0 +1,51 @@ +// This is just a sample test file to be used to test the generator script +#ifndef TEST_SAMPLE_H +#define TEST_SAMPLE_H + +#include +#include "unity.h" +#include "funky.h" +#include "Mockstanky.h" + +void setUp(void) +{ + CustomSetupStuff(); +} + +void tearDown(void) +{ + CustomTeardownStuff +} + +//Yup, nice comment +void test_TheFirstThingToTest(void) +{ + TEST_ASSERT(1); + + TEST_ASSERT_TRUE(1); +} + +/* +void test_ShouldBeIgnored(void) +{ + DoesStuff(); +} +*/ + +//void test_ShouldAlsoNotBeTested(void) +//{ +// Call_An_Expect(); +// +// CallAFunction(); +// test_CallAFunctionThatLooksLikeATest(); +//} + +void test_TheSecondThingToTest(void) +{ + Call_An_Expect(); + + CallAFunction(); + test_CallAFunctionThatLooksLikeATest(); +} + +#endif //TEST_SAMPLE_H diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/sample.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/sample.yml new file mode 100644 index 0000000..9e5eece --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/sample.yml @@ -0,0 +1,9 @@ +:unity: + :includes: + - two.h + - three.h + - + :plugins: + - :cexception + :suite_setup: | + a_yaml_setup(); \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/testsample.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/testsample.c new file mode 100644 index 0000000..4f30ec7 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/testsample.c @@ -0,0 +1,51 @@ +// This is just a sample test file to be used to test the generator script +#ifndef TEST_SAMPLE_H +#define TEST_SAMPLE_H + +#include +#include "unity.h" +#include "funky.h" +#include "stanky.h" + +void setUp(void) +{ + CustomSetupStuff(); +} + +void tearDown(void) +{ + CustomTeardownStuff +} + +//Yup, nice comment +void test_TheFirstThingToTest(void) +{ + TEST_ASSERT(1); + + TEST_ASSERT_TRUE(1); +} + +/* +void test_ShouldBeIgnored(void) +{ + DoesStuff(); +} +*/ + +//void test_ShouldAlsoNotBeTested(void) +//{ +// Call_An_Expect(); +// +// CallAFunction(); +// test_CallAFunctionThatLooksLikeATest(); +//} + +void test_TheSecondThingToTest(void) +{ + Call_An_Expect(); + + CallAFunction(); + test_CallAFunctionThatLooksLikeATest(); +} + +#endif //TEST_SAMPLE_H diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testparameterized.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testparameterized.c new file mode 100644 index 0000000..037cd21 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testparameterized.c @@ -0,0 +1,101 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include +#include "unity.h" + +#define TEST_CASE(...) + +#define EXPECT_ABORT_BEGIN \ + if (TEST_PROTECT()) \ + { + +#define VERIFY_FAILS_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestFailed == 1) ? 0 : 1; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Failed But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +#define VERIFY_IGNORES_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestIgnored == 1) ? 0 : 1; \ + Unity.CurrentTestIgnored = 0; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Ignored But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +int SetToOneToFailInTearDown; +int SetToOneMeanWeAlreadyCheckedThisGuy; + +void setUp(void) +{ + SetToOneToFailInTearDown = 0; + SetToOneMeanWeAlreadyCheckedThisGuy = 0; +} + +void tearDown(void) +{ + if (SetToOneToFailInTearDown == 1) + TEST_FAIL_MESSAGE("<= Failed in tearDown"); + if ((SetToOneMeanWeAlreadyCheckedThisGuy == 0) && (Unity.CurrentTestFailed > 0)) + { + UnityPrint("[[[[ Previous Test Should Have Passed But Did Not ]]]]"); + UNITY_OUTPUT_CHAR('\n'); + } +} + +TEST_CASE(0) +TEST_CASE(44) +TEST_CASE((90)+9) +void test_TheseShouldAllPass(int Num) +{ + TEST_ASSERT_TRUE(Num < 100); +} + +TEST_CASE(3) +TEST_CASE(77) +TEST_CASE( (99) + 1 - (1)) +void test_TheseShouldAllFail(int Num) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(Num > 100); + VERIFY_FAILS_END +} + +TEST_CASE(1) +TEST_CASE(44) +TEST_CASE(99) +TEST_CASE(98) +void test_TheseAreEveryOther(int Num) +{ + if (Num & 1) + { + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(Num > 100); + VERIFY_FAILS_END + } + else + { + TEST_ASSERT_TRUE(Num < 100); + } +} + +void test_NormalPassesStillWork(void) +{ + TEST_ASSERT_TRUE(1); +} + +void test_NormalFailsStillWork(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(0); + VERIFY_FAILS_END +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testunity.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testunity.c new file mode 100644 index 0000000..9f826dc --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/c_exception/vendor/unity/test/testunity.c @@ -0,0 +1,1510 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include +#include "unity.h" + +#define EXPECT_ABORT_BEGIN \ + if (TEST_PROTECT()) \ + { + +#define VERIFY_FAILS_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestFailed == 1) ? 0 : 1; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Failed But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +#define VERIFY_IGNORES_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestIgnored == 1) ? 0 : 1; \ + Unity.CurrentTestIgnored = 0; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Ignored But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +int SetToOneToFailInTearDown; +int SetToOneMeanWeAlreadyCheckedThisGuy; + +void setUp(void) +{ + SetToOneToFailInTearDown = 0; + SetToOneMeanWeAlreadyCheckedThisGuy = 0; +} + +void tearDown(void) +{ + if (SetToOneToFailInTearDown == 1) + TEST_FAIL_MESSAGE("<= Failed in tearDown"); + if ((SetToOneMeanWeAlreadyCheckedThisGuy == 0) && (Unity.CurrentTestFailed > 0)) + { + UnityPrint("[[[[ Previous Test Should Have Passed But Did Not ]]]]"); + UNITY_OUTPUT_CHAR('\n'); + } +} + +void testTrue(void) +{ + TEST_ASSERT(1); + + TEST_ASSERT_TRUE(1); +} + +void testFalse(void) +{ + TEST_ASSERT_FALSE(0); + + TEST_ASSERT_UNLESS(0); +} + +void testPreviousPass(void) +{ + TEST_ASSERT_EQUAL_INT(0U, Unity.TestFailures); +} + +void testNotVanilla(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT(0); + VERIFY_FAILS_END +} + +void testNotTrue(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(0); + VERIFY_FAILS_END +} + +void testNotFalse(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_FALSE(1); + VERIFY_FAILS_END +} + +void testNotUnless(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UNLESS(1); + VERIFY_FAILS_END +} + +void testNotNotEqual(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_NOT_EQUAL(10, 10); + VERIFY_FAILS_END +} + +void testFail(void) +{ + EXPECT_ABORT_BEGIN + TEST_FAIL_MESSAGE("Expected for testing"); + VERIFY_FAILS_END +} + +void testIsNull(void) +{ + char* ptr1 = NULL; + char* ptr2 = "hello"; + + TEST_ASSERT_NULL(ptr1); + TEST_ASSERT_NOT_NULL(ptr2); +} + +void testIsNullShouldFailIfNot(void) +{ + char* ptr1 = "hello"; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_NULL(ptr1); + VERIFY_FAILS_END +} + +void testNotNullShouldFailIfNULL(void) +{ + char* ptr1 = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_NOT_NULL(ptr1); + VERIFY_FAILS_END +} + +void testIgnore(void) +{ + EXPECT_ABORT_BEGIN + TEST_IGNORE(); + TEST_FAIL_MESSAGE("This should not be reached"); + VERIFY_IGNORES_END +} + +void testIgnoreMessage(void) +{ + EXPECT_ABORT_BEGIN + TEST_IGNORE_MESSAGE("This is an expected TEST_IGNORE_MESSAGE string!"); + TEST_FAIL_MESSAGE("This should not be reached"); + VERIFY_IGNORES_END +} + +void testNotEqualInts(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT(3982, 3983); + VERIFY_FAILS_END +} + +void testNotEqualInt8s(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT8(-127, -126); + VERIFY_FAILS_END +} + +void testNotEqualInt16s(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT16(-16383, -16382); + VERIFY_FAILS_END +} + +void testNotEqualInt32s(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT32(-2147483647, -2147483646); + VERIFY_FAILS_END +} + +void testNotEqualBits(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_BITS(0xFF00, 0x5555, 0x5A55); + VERIFY_FAILS_END +} + +void testNotEqualUInts(void) +{ + _UU16 v0, v1; + + v0 = 9000; + v1 = 9001; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualUInt8s(void) +{ + _UU8 v0, v1; + + v0 = 254; + v1 = 255; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT8(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualUInt16s(void) +{ + _UU16 v0, v1; + + v0 = 65535; + v1 = 65534; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualUInt32s(void) +{ + _UU32 v0, v1; + + v0 = 4294967295; + v1 = 4294967294; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT32(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex8s(void) +{ + _UU8 v0, v1; + + v0 = 0x23; + v1 = 0x22; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex8sIfSigned(void) +{ + _US8 v0, v1; + + v0 = -2; + v1 = 2; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex16s(void) +{ + _UU16 v0, v1; + + v0 = 0x1234; + v1 = 0x1235; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex16sIfSigned(void) +{ + _US16 v0, v1; + + v0 = -1024; + v1 = -1028; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex32s(void) +{ + _UU32 v0, v1; + + v0 = 900000; + v1 = 900001; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex32sIfSigned(void) +{ + _US32 v0, v1; + + v0 = -900000; + v1 = 900001; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32(v0, v1); + VERIFY_FAILS_END +} + +void testEqualInts(void) +{ + int v0, v1; + int *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(1837, 1837); + TEST_ASSERT_EQUAL_INT(-27365, -27365); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(19467, v1); + TEST_ASSERT_EQUAL_INT(v0, 19467); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 19467); +} + +void testEqualUints(void) +{ + unsigned int v0, v1; + unsigned int *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_UINT(1837, 1837); + TEST_ASSERT_EQUAL_UINT(v0, v1); + TEST_ASSERT_EQUAL_UINT(19467, v1); + TEST_ASSERT_EQUAL_UINT(v0, 19467); + TEST_ASSERT_EQUAL_UINT(*p0, v1); + TEST_ASSERT_EQUAL_UINT(*p0, *p1); + TEST_ASSERT_EQUAL_UINT(*p0, 19467); + TEST_ASSERT_EQUAL_UINT(60872u, 60872u); +} + +void testNotEqual(void) +{ + TEST_ASSERT_NOT_EQUAL(0, 1); + TEST_ASSERT_NOT_EQUAL(1, 0); + TEST_ASSERT_NOT_EQUAL(100, 101); + TEST_ASSERT_NOT_EQUAL(0, -1); + TEST_ASSERT_NOT_EQUAL(65535, -65535); + TEST_ASSERT_NOT_EQUAL(75, 900); + TEST_ASSERT_NOT_EQUAL(-100, -101); +} + +void testEqualHex8s(void) +{ + _UU8 v0, v1; + _UU8 *p0, *p1; + + v0 = 0x22; + v1 = 0x22; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX8(0x22, 0x22); + TEST_ASSERT_EQUAL_HEX8(v0, v1); + TEST_ASSERT_EQUAL_HEX8(0x22, v1); + TEST_ASSERT_EQUAL_HEX8(v0, 0x22); + TEST_ASSERT_EQUAL_HEX8(*p0, v1); + TEST_ASSERT_EQUAL_HEX8(*p0, *p1); + TEST_ASSERT_EQUAL_HEX8(*p0, 0x22); +} + +void testEqualHex8sNegatives(void) +{ + _UU8 v0, v1; + _UU8 *p0, *p1; + + v0 = 0xDD; + v1 = 0xDD; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX8(0xDD, 0xDD); + TEST_ASSERT_EQUAL_HEX8(v0, v1); + TEST_ASSERT_EQUAL_HEX8(0xDD, v1); + TEST_ASSERT_EQUAL_HEX8(v0, 0xDD); + TEST_ASSERT_EQUAL_HEX8(*p0, v1); + TEST_ASSERT_EQUAL_HEX8(*p0, *p1); + TEST_ASSERT_EQUAL_HEX8(*p0, 0xDD); +} + +void testEqualHex16s(void) +{ + _UU16 v0, v1; + _UU16 *p0, *p1; + + v0 = 0x9876; + v1 = 0x9876; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX16(0x9876, 0x9876); + TEST_ASSERT_EQUAL_HEX16(v0, v1); + TEST_ASSERT_EQUAL_HEX16(0x9876, v1); + TEST_ASSERT_EQUAL_HEX16(v0, 0x9876); + TEST_ASSERT_EQUAL_HEX16(*p0, v1); + TEST_ASSERT_EQUAL_HEX16(*p0, *p1); + TEST_ASSERT_EQUAL_HEX16(*p0, 0x9876); +} + +void testEqualHex32s(void) +{ + _UU32 v0, v1; + _UU32 *p0, *p1; + + v0 = 0x98765432ul; + v1 = 0x98765432ul; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX32(0x98765432ul, 0x98765432ul); + TEST_ASSERT_EQUAL_HEX32(v0, v1); + TEST_ASSERT_EQUAL_HEX32(0x98765432ul, v1); + TEST_ASSERT_EQUAL_HEX32(v0, 0x98765432ul); + TEST_ASSERT_EQUAL_HEX32(*p0, v1); + TEST_ASSERT_EQUAL_HEX32(*p0, *p1); + TEST_ASSERT_EQUAL_HEX32(*p0, 0x98765432ul); +} + +void testEqualBits(void) +{ + _UU32 v0 = 0xFF55AA00; + _UU32 v1 = 0x55550000; + + TEST_ASSERT_BITS(v1, v0, 0x55550000); + TEST_ASSERT_BITS(v1, v0, 0xFF55CC00); + TEST_ASSERT_BITS(0xFFFFFFFF, v0, 0xFF55AA00); + TEST_ASSERT_BITS(0xFFFFFFFF, v0, v0); + TEST_ASSERT_BITS(0xF0F0F0F0, v0, 0xFC5DAE0F); + TEST_ASSERT_BITS_HIGH(v1, v0); + TEST_ASSERT_BITS_LOW(0x000055FF, v0); + TEST_ASSERT_BIT_HIGH(30, v0); + TEST_ASSERT_BIT_LOW(5, v0); +} + +void testEqualShorts(void) +{ + short v0, v1; + short *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(1837, 1837); + TEST_ASSERT_EQUAL_INT(-2987, -2987); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(19467, v1); + TEST_ASSERT_EQUAL_INT(v0, 19467); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 19467); +} + +void testEqualUShorts(void) +{ + unsigned short v0, v1; + unsigned short *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_UINT(1837, 1837); + TEST_ASSERT_EQUAL_UINT(2987, 2987); + TEST_ASSERT_EQUAL_UINT(v0, v1); + TEST_ASSERT_EQUAL_UINT(19467, v1); + TEST_ASSERT_EQUAL_UINT(v0, 19467); + TEST_ASSERT_EQUAL_UINT(*p0, v1); + TEST_ASSERT_EQUAL_UINT(*p0, *p1); + TEST_ASSERT_EQUAL_UINT(*p0, 19467); +} + +void testEqualChars(void) +{ + signed char v0, v1; + signed char *p0, *p1; + + v0 = 109; + v1 = 109; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(42, 42); + TEST_ASSERT_EQUAL_INT(-116, -116); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(109, v1); + TEST_ASSERT_EQUAL_INT(v0, 109); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 109); +} + +void testEqualUChars(void) +{ + unsigned char v0, v1; + unsigned char *p0, *p1; + + v0 = 251; + v1 = 251; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(42, 42); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(251, v1); + TEST_ASSERT_EQUAL_INT(v0, 251); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 251); +} + +void testEqualPointers(void) +{ + int v0, v1; + int *p0, *p1, *p2; + + v0 = 19467; + v1 = 18271; + p0 = &v0; + p1 = &v1; + p2 = &v1; + + TEST_ASSERT_EQUAL_PTR(p0, &v0); + TEST_ASSERT_EQUAL_PTR(&v1, p1); + TEST_ASSERT_EQUAL_PTR(p2, p1); + TEST_ASSERT_EQUAL_PTR(&v0, &v0); +} + +void testNotEqualPointers(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_PTR(0x12345678, 0x12345677); + VERIFY_FAILS_END +} + +void testIntsWithinDelta(void) +{ + TEST_ASSERT_INT_WITHIN(1, 5000, 5001); + TEST_ASSERT_INT_WITHIN(5, 5000, 4996); + TEST_ASSERT_INT_WITHIN(5, 5000, 5005); + TEST_ASSERT_INT_WITHIN(500, 50, -440); + + TEST_ASSERT_INT_WITHIN(2, -1, -1); + TEST_ASSERT_INT_WITHIN(5, 1, -1); + TEST_ASSERT_INT_WITHIN(5, -1, 1); +} + +void testIntsNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_INT_WITHIN(5, 5000, 5006); + VERIFY_FAILS_END +} + +void testUIntsWithinDelta(void) +{ + TEST_ASSERT_UINT_WITHIN(1, 5000, 5001); + TEST_ASSERT_UINT_WITHIN(5, 5000, 4996); + TEST_ASSERT_UINT_WITHIN(5, 5000, 5005); +} + +void testUIntsNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UINT_WITHIN(1, 2147483647u, 2147483649u); + VERIFY_FAILS_END +} + +void testUIntsNotWithinDeltaEvenThoughASignedIntWouldPassSmallFirst(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UINT_WITHIN(5, 1, -1); + VERIFY_FAILS_END +} + +void testUIntsNotWithinDeltaEvenThoughASignedIntWouldPassBigFirst(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UINT_WITHIN(5, -1, 1); + VERIFY_FAILS_END +} + +void testHEX32sWithinDelta(void) +{ + TEST_ASSERT_HEX32_WITHIN(1, 5000, 5001); + TEST_ASSERT_HEX32_WITHIN(5, 5000, 4996); + TEST_ASSERT_HEX32_WITHIN(5, 5000, 5005); +} + +void testHEX32sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX32_WITHIN(1, 2147483647u, 2147483649u); + VERIFY_FAILS_END +} + +void testHEX32sNotWithinDeltaEvenThoughASignedIntWouldPass(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX32_WITHIN(5, 1, -1); + VERIFY_FAILS_END +} + +void testHEX16sWithinDelta(void) +{ + TEST_ASSERT_HEX16_WITHIN(1, 5000, 5001); + TEST_ASSERT_HEX16_WITHIN(5, 5000, 4996); + TEST_ASSERT_HEX16_WITHIN(5, 5000, 5005); +} + +void testHEX16sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX16_WITHIN(2, 65535, 0); + VERIFY_FAILS_END +} + +void testHEX8sWithinDelta(void) +{ + TEST_ASSERT_HEX8_WITHIN(1, 254, 255); + TEST_ASSERT_HEX8_WITHIN(5, 251, 255); + TEST_ASSERT_HEX8_WITHIN(5, 1, 4); +} + +void testHEX8sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX8_WITHIN(2, 255, 0); + VERIFY_FAILS_END +} + +void testEqualStrings(void) +{ + const char *testString = "foo"; + + TEST_ASSERT_EQUAL_STRING(testString, testString); + TEST_ASSERT_EQUAL_STRING("foo", "foo"); + TEST_ASSERT_EQUAL_STRING("foo", testString); + TEST_ASSERT_EQUAL_STRING(testString, "foo"); + TEST_ASSERT_EQUAL_STRING("", ""); +} + +void testEqualStringsWithCarriageReturnsAndLineFeeds(void) +{ + const char *testString = "foo\r\nbar"; + + TEST_ASSERT_EQUAL_STRING(testString, testString); + TEST_ASSERT_EQUAL_STRING("foo\r\nbar", "foo\r\nbar"); + TEST_ASSERT_EQUAL_STRING("foo\r\nbar", testString); + TEST_ASSERT_EQUAL_STRING(testString, "foo\r\nbar"); + TEST_ASSERT_EQUAL_STRING("", ""); +} + +void testNotEqualString1(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("foo", "bar"); + VERIFY_FAILS_END +} + +void testNotEqualString2(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("foo", ""); + VERIFY_FAILS_END +} + +void testNotEqualString3(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("", "bar"); + VERIFY_FAILS_END +} + +void testNotEqualString4(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("bar\r", "bar\n"); + VERIFY_FAILS_END +} + +void testNotEqualString5(void) +{ + const char str1[] = { 0x41, 0x42, 0x03, 0x00 }; + const char str2[] = { 0x41, 0x42, 0x04, 0x00 }; + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING(str1, str2); + VERIFY_FAILS_END +} + +void testNotEqualString_ExpectedStringIsNull(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING(NULL, "bar"); + VERIFY_FAILS_END +} + +void testNotEqualString_ActualStringIsNull(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("foo", NULL); + VERIFY_FAILS_END +} + +void testEqualStringArrays(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, expStrings, 3); + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 3); + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 2); + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 1); +} + +void testNotEqualStringArray1(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray2(void) +{ + const char *testStrings[] = { "zoo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", "boo", "woo", "moo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray3(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", NULL }; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray4(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", NULL, "woo", "moo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray5(void) +{ + const char **testStrings = NULL; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray6(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "zoo" }; + const char **expStrings = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testEqualStringArrayIfBothNulls(void) +{ + const char **testStrings = NULL; + const char **expStrings = NULL; + + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); +} + +void testEqualMemory(void) +{ + const char *testString = "whatever"; + + TEST_ASSERT_EQUAL_MEMORY(testString, testString, 8); + TEST_ASSERT_EQUAL_MEMORY("whatever", "whatever", 8); + TEST_ASSERT_EQUAL_MEMORY("whatever", testString, 8); + TEST_ASSERT_EQUAL_MEMORY(testString, "whatever", 8); + TEST_ASSERT_EQUAL_MEMORY(testString, "whatever", 2); + TEST_ASSERT_EQUAL_MEMORY(NULL, NULL, 1); +} + +void testNotEqualMemory1(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY("foo", "bar", 3); + VERIFY_FAILS_END +} + +void testNotEqualMemory2(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY("fool", "food", 4); + VERIFY_FAILS_END +} + +void testNotEqualMemory3(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY(NULL, "food", 4); + VERIFY_FAILS_END +} + +void testNotEqualMemory4(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY("fool", NULL, 4); + VERIFY_FAILS_END +} + +void testEqualIntArrays(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, -2}; + int p2[] = {1, 8, 987, 2}; + int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p3, 1); +} + +void testNotEqualIntArraysNullExpected(void) +{ + int* p0 = NULL; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArraysNullActual(void) +{ + int* p1 = NULL; + int p0[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArrays1(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArrays2(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {2, 8, 987, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArrays3(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 986, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualInt8Arrays(void) +{ + _US8 p0[] = {1, 8, 117, -2}; + _US8 p1[] = {1, 8, 117, -2}; + _US8 p2[] = {1, 8, 117, 2}; + _US8 p3[] = {1, 50, 60, 70}; + + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p3, 1); +} + +void testNotEqualInt8Arrays(void) +{ + _US8 p0[] = {1, 8, 127, -2}; + _US8 p1[] = {1, 8, 127, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualUIntArrays(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65132u}; + unsigned int p2[] = {1, 8, 987, 2}; + unsigned int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p3, 1); +} + +void testNotEqualUIntArrays1(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUIntArrays2(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUIntArrays3(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualInt16Arrays(void) +{ + _UU16 p0[] = {1, 8, 117, 3}; + _UU16 p1[] = {1, 8, 117, 3}; + _UU16 p2[] = {1, 8, 117, 2}; + _UU16 p3[] = {1, 50, 60, 70}; + + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p3, 1); +} + +void testNotEqualInt16Arrays(void) +{ + _UU16 p0[] = {1, 8, 127, 3}; + _UU16 p1[] = {1, 8, 127, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualUINT16Arrays(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65132u}; + unsigned short p2[] = {1, 8, 987, 2}; + unsigned short p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p3, 1); +} + +void testNotEqualUINT16Arrays1(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUINT16Arrays2(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUINT16Arrays3(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualHEXArrays(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65132u}; + unsigned int p2[] = {1, 8, 987, 2}; + unsigned int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p3, 1); +} + +void testNotEqualHEXArrays1(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEXArrays2(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEXArrays3(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualHEX16Arrays(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65132u}; + unsigned short p2[] = {1, 8, 987, 2}; + unsigned short p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p3, 1); +} + +void testNotEqualHEX16Arrays1(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX16Arrays2(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX16Arrays3(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualHEX8Arrays(void) +{ + unsigned short p0[] = {1, 8, 254u, 123}; + unsigned short p1[] = {1, 8, 254u, 123}; + unsigned short p2[] = {1, 8, 254u, 2}; + unsigned short p3[] = {1, 23, 25, 26}; + + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p3, 1); +} + +void testNotEqualHEX8Arrays1(void) +{ + unsigned char p0[] = {1, 8, 254u, 253u}; + unsigned char p1[] = {1, 8, 254u, 252u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX8Arrays2(void) +{ + unsigned char p0[] = {1, 8, 254u, 253u}; + unsigned char p1[] = {2, 8, 254u, 253u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX8Arrays3(void) +{ + unsigned char p0[] = {1, 8, 254u, 253u}; + unsigned char p1[] = {1, 8, 255u, 253u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualMemoryArrays(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, -2}; + int p2[] = {1, 8, 987, 2}; + int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p0, 4, 1); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p0, 4, 4); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p2, 4, 3); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p3, 4, 1); +} + +void testNotEqualMemoryArraysExpectedNull(void) +{ + int* p0 = NULL; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArraysActualNull(void) +{ + int p0[] = {1, 8, 987, -2}; + int* p1 = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArrays1(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArrays2(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {2, 8, 987, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArrays3(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 986, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testProtection(void) +{ + volatile int mask = 0; + + if (TEST_PROTECT()) + { + mask |= 1; + TEST_ABORT(); + } + else + { + Unity.CurrentTestFailed = 0; + mask |= 2; + } + + TEST_ASSERT_EQUAL(3, mask); +} + +void testIgnoredAndThenFailInTearDown(void) +{ + SetToOneToFailInTearDown = 1; + TEST_IGNORE(); +} + +// ===================== THESE TEST WILL RUN IF YOUR CONFIG INCLUDES 64 BIT SUPPORT ================== +#ifdef UNITY_SUPPORT_64 + +void testEqualHex64s(void) +{ + _UU64 v0, v1; + _UU64 *p0, *p1; + + v0 = 0x9876543201234567; + v1 = 0x9876543201234567; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX64(0x9876543201234567, 0x9876543201234567); + TEST_ASSERT_EQUAL_HEX64(v0, v1); + TEST_ASSERT_EQUAL_HEX64(0x9876543201234567, v1); + TEST_ASSERT_EQUAL_HEX64(v0, 0x9876543201234567); + TEST_ASSERT_EQUAL_HEX64(*p0, v1); + TEST_ASSERT_EQUAL_HEX64(*p0, *p1); + TEST_ASSERT_EQUAL_HEX64(*p0, 0x9876543201234567); +} + +void testNotEqualHex64s(void) +{ + _UU64 v0, v1; + + v0 = 9000000000; + v1 = 9100000000; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex64sIfSigned(void) +{ + _US64 v0, v1; + + v0 = -9000000000; + v1 = 9000000000; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64(v0, v1); + VERIFY_FAILS_END +} + +void testHEX64sWithinDelta(void) +{ + TEST_ASSERT_HEX64_WITHIN(1, 0x7FFFFFFFFFFFFFFF,0x7FFFFFFFFFFFFFFE); + TEST_ASSERT_HEX64_WITHIN(5, 5000, 4996); + TEST_ASSERT_HEX64_WITHIN(5, 5000, 5005); +} + +void testHEX64sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX64_WITHIN(1, 0x7FFFFFFFFFFFFFFF, 0x7FFFFFFFFFFFFFFC); + VERIFY_FAILS_END +} + +void testHEX64sNotWithinDeltaEvenThoughASignedIntWouldPass(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX64_WITHIN(5, 1, -1); + VERIFY_FAILS_END +} + +void testEqualHEX64Arrays(void) +{ + _UU64 p0[] = {1, 8, 987, 65132u}; + _UU64 p1[] = {1, 8, 987, 65132u}; + _UU64 p2[] = {1, 8, 987, 2}; + _UU64 p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p3, 1); +} + +void testNotEqualHEX64Arrays1(void) +{ + _UU64 p0[] = {1, 8, 987, 65132u}; + _UU64 p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX64Arrays2(void) +{ + _UU64 p0[] = {1, 8, 987, 65132u}; + _UU64 p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +#endif //64-bit SUPPORT + +// ===================== THESE TEST WILL RUN IF YOUR CONFIG INCLUDES FLOAT SUPPORT ================== +#ifndef UNITY_EXCLUDE_FLOAT + +void testFloatsWithinDelta(void) +{ + TEST_ASSERT_FLOAT_WITHIN(0.00003f, 187245.03485f, 187245.03488f); + TEST_ASSERT_FLOAT_WITHIN(1.0f, 187245.0f, 187246.0f); + TEST_ASSERT_FLOAT_WITHIN(0.05f, 9273.2549f, 9273.2049f); + TEST_ASSERT_FLOAT_WITHIN(0.007f, -726.93724f, -726.94424f); +} + +void testFloatsNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_FLOAT_WITHIN(0.05f, 9273.2649f, 9273.2049f); + VERIFY_FAILS_END +} + +void testFloatsEqual(void) +{ + TEST_ASSERT_EQUAL_FLOAT(187245.0f, 187246.0f); + TEST_ASSERT_EQUAL_FLOAT(18724.5f, 18724.6f); + TEST_ASSERT_EQUAL_FLOAT(9273.2549f, 9273.2599f); + TEST_ASSERT_EQUAL_FLOAT(-726.93724f, -726.9374f); +} + +void testFloatsNotEqual(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT(9273.9649f, 9273.0049f); + VERIFY_FAILS_END +} + +void testFloatsNotEqualNegative1(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT(-9273.9649f, -9273.0049f); + VERIFY_FAILS_END +} + +void testFloatsNotEqualNegative2(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT(-9273.0049f, -9273.9649f); + VERIFY_FAILS_END +} + +void testEqualFloatArrays(void) +{ + float p0[] = {1.0, -8.0, 25.4, -0.123}; + float p1[] = {1.0, -8.0, 25.4, -0.123}; + float p2[] = {1.0, -8.0, 25.4, -0.2}; + float p3[] = {1.0, -23.0, 25.0, -0.26}; + + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p3, 1); +} + +void testNotEqualFloatArraysExpectedNull(void) +{ + float* p0 = NULL; + float p1[] = {1.0, 8.0, 25.4, 0.252}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysActualNull(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float* p1 = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArrays1(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float p1[] = {1.0, 8.0, 25.4, 0.252}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArrays2(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float p1[] = {2.0, 8.0, 25.4, 0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArrays3(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float p1[] = {1.0, 8.0, 25.5, 0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysNegative1(void) +{ + float p0[] = {-1.0, -8.0, -25.4, -0.253}; + float p1[] = {-1.0, -8.0, -25.4, -0.252}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysNegative2(void) +{ + float p0[] = {-1.0, -8.0, -25.4, -0.253}; + float p1[] = {-2.0, -8.0, -25.4, -0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysNegative3(void) +{ + float p0[] = {-1.0, -8.0, -25.4, -0.253}; + float p1[] = {-1.0, -8.0, -25.5, -0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +#endif //FLOAT SUPPORT diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/CHANGES b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/CHANGES new file mode 100644 index 0000000..4b5184c --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/CHANGES @@ -0,0 +1,78 @@ +Hardmock 1.3.7 + +* BUG FIX: expects! could not setup expectations for more than one concrete method on an object, since the method aliasing and rewriting was only taking place when the background mock instance was first created. This logic has been updated and now you can do all the things you'd expect. + +Hardmock 1.3.6 + +* BUG FIX: In Rails apps (and others) Hardmock and Fixtures battled viciously over "setup" and "teardown" and "method_added" (and any other clever test enhancement tool, namely Mocha) causing unpredictable results, notably failure to auto-verify mocks after teardown (leading to false positive tests). + * The newly-added TestUnitBeforeAfter provides TestCase.before_setup and TestCase.after_teardown -- formal test wrapping hooks -- lets Hardmock provide its preparation and auto-verify behavior without contending for setup/teardown supremacy. + +Hardmock 1.3.5 + +* Aliased should_receive => expects and and_return => returns for easier transition from rspec mock and flexmock users. + +Hardmock 1.3.4 + +* Prevents accidental stubbing and mocking on NilClasses + +Hardmock 1.3.3 + +* stubs! and expects! no longer require that their target methods exist in reality (this used to prevent you from stubbing methods that "exist" by virtue of "method_missing" +* Tweaked inner metaclass code to avoid collisions with rspec's "metaid" stuff +* Moved this project's Rake tasks into rake_tasks... otherwise Rails will load them, if Hardmock is installed as a Rails plugin +* Alias added: 'verify_hardmocks' is now an alias for 'verify_mocks' (some internal projects were using this modified method name as a means of cooexisting with mocha) + +Hardmock 1.3.2 + +November 2007 + +* adds 'with' as an alternate syntax for specifying argument expectations. + +Hardmock 1.3.1 + +October 2007 + +* Can use stubs! on a mock object +* expects! now generates mocked methods that can safely transfer runtime blocks to the mock instance itself +* No longer need to call "prepare_hardmock_control" when using stubs in the absence of mocks +* Stubs of concrete class or instance methods are restored to original state in teardown + +Hardmock 1.3.0 + +October 2007 + +* Adds stubs! and expects! method to all objects and classes to support concrete stubbing/mocking. + +Hardmock 1.2.3 + +Sat Apr 28 01:16:15 EDT 2007 + +* Re-release of 1.2.2 (which was canceled)... tasks moved to lib/tasks + +Hardmock 1.2.2 + +Sat Apr 28 00:41:30 EDT 2007 + +* assert_error has been broken out into its own lib file +* Gem package can now run all tests successfully +* Internal code refactoring; a number of classes that were defined in hardmock.rb are now in their own files + +Hardmock 1.2.1 + +Sat Apr 28 00:41:30 EDT 2007 + +* (botched release, see 1.2.2) + +Hardmock 1.2.0 + +* You can now use "expect" in place of "expects" if you must. +* "inspect" has been added to the list of methods NOT erased by MethodCleanout. + +Hardmock 1.1.0 + +* "expects" replaces "expect" ("expect" now raises Hardmock::DeprecationError) +* "verify_mocks" is now implicit in teardown, you needn't call it anymore +* Mocking methods that Mock would otherwise inherit from Object (eg, to_s) is now possible +* require 'hardmock' is all that's required to use the library now; no need to include in TestCase + +(previously called CMock, translated to Hardmock on 2006-12-10) diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/LICENSE b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/LICENSE new file mode 100644 index 0000000..396211e --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/LICENSE @@ -0,0 +1,7 @@ +Copyright (c) 2006,2007 David Crosby at Atomic Object, LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/README b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/README new file mode 100644 index 0000000..4650a2a --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/README @@ -0,0 +1,70 @@ +== Hardmock + +Strict, ordered mock objects using very lightweight syntax in your tests. + +== How + +The basic procedure for using Hardmock in your tests is: + +* require 'hardmock' (this happens automatically when being used as a Rails plugin) +* Create some mocks +* Setup some expectations +* Execute the target code +* Verification of calls is automatic in =teardown= + +The expectations you set when using mocks are strict and ordered. +Expectations you declare by creating and using mocks are all considered together. + +* Hardmock::Mock#expects will show you more examples +* Hardmock::SimpleExpectation will teach you more about expectation methods + +== Example + + create_mocks :garage, :car + + # Set some expectations + @garage.expects.open_door + @car.expects.start(:choke) + @car.expects.drive(:reverse, 5.mph) + + # Execute the code (this code is usually, obviously, in your class under test) + @garage.open_door + @car.start :choke + @car.drive :reverse, 5.mph + + verify_mocks # OPTIONAL, teardown will do this for you + +Expects @garage.open_door, @car.start(:choke) and @car.drive(:reverse, 5.mph) to be called in that order, with those specific arguments. +* Violations of expectations, such as mis-ordered calls, calls on wrong objects, or incorrect methods result in Hardmock::ExpectationError +* verify_mocks will raise VerifyError if not all expectations have been met. + +== Download and Install + +* Homepage: http://hardmock.rubyforge.org +* GEM or TGZ or ZIP: http://rubyforge.org/frs/?group_id=2742 +* Rails plugin: script/plugin install +* SVN access: svn co svn://rubyforge.org/var/svn/hardmock/trunk +* Developer SVN access: svn co svn://developername@rubyforge.org/var/svn/hardmock/trunk + +== Setup for Test::Unit + + require 'hardmock' + require 'assert_error' # OPTIONAL: this adds the TestUnit extension 'assert_error' + +NOTE: If installed as a Rails plugin, init.rb does this for you... nothing else is needed. + +== Setup for RSpec + +Get this into your spec helper or environment or Rakefile or wherever you prefer: + + Spec::Runner.configure do |configuration| + configuration.include Hardmock + configuration.after(:each) {verify_mocks} + end + +This puts the implicit conveniences into your spec context, like "create_mocks" etc, and also provides for automatic +"verify_mocks" after each Example is run. + +== Author +* David Crosby crosby at http://atomicobject.com +* (c) 2006,2007 Atomic Object LLC diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/Rakefile b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/Rakefile new file mode 100644 index 0000000..aff126c --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/Rakefile @@ -0,0 +1,8 @@ +require 'rake' +require 'rubygems' + +HARDMOCK_VERSION = "1.3.7" + +Dir["rake_tasks/*.rake"].each { |f| load f } + +task :default => [ 'test:all' ] diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/config/environment.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/config/environment.rb new file mode 100644 index 0000000..a15e598 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/config/environment.rb @@ -0,0 +1,12 @@ +# The path to the root directory of your application. +APP_ROOT = File.join(File.dirname(__FILE__), '..') + +ADDITIONAL_LOAD_PATHS = [] +ADDITIONAL_LOAD_PATHS.concat %w( + lib +).map { |dir| "#{APP_ROOT}/#{dir}" }.select { |dir| File.directory?(dir) } + +# Prepend to $LOAD_PATH +ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) } + +# Require any additional libraries needed diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/lib/assert_error.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/lib/assert_error.rb new file mode 100644 index 0000000..6da61de --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/lib/assert_error.rb @@ -0,0 +1,23 @@ +require 'test/unit/assertions' + +module Test::Unit #:nodoc:# + module Assertions #:nodoc:# + # A better 'assert_raise'. +patterns+ can be one or more Regexps, or a literal String that + # must match the entire error message. + def assert_error(err_type,*patterns,&block) + assert_not_nil block, "assert_error requires a block" + assert((err_type and err_type.kind_of?(Class)), "First argument to assert_error has to be an error type") + err = assert_raise(err_type) do + block.call + end + patterns.each do |pattern| + case pattern + when Regexp + assert_match(pattern, err.message) + else + assert_equal pattern, err.message + end + end + end + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/lib/extend_test_unit.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/lib/extend_test_unit.rb new file mode 100644 index 0000000..3d7ef9d --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/lib/extend_test_unit.rb @@ -0,0 +1,14 @@ + +require 'test/unit/testcase' +class Test::Unit::TestCase + include Hardmock +end + +require 'test_unit_before_after' +Test::Unit::TestCase.before_setup do |test| + test.prepare_hardmock_control +end + +Test::Unit::TestCase.after_teardown do |test| + test.verify_mocks +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock.rb new file mode 100644 index 0000000..50f9a94 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock.rb @@ -0,0 +1,86 @@ +require 'hardmock/method_cleanout' +require 'hardmock/mock' +require 'hardmock/mock_control' +require 'hardmock/utils' +require 'hardmock/errors' +require 'hardmock/trapper' +require 'hardmock/expector' +require 'hardmock/expectation' +require 'hardmock/expectation_builder' +require 'hardmock/stubbing' + +module Hardmock + + # Create one or more new Mock instances in your test suite. + # Once created, the Mocks are accessible as instance variables in your test. + # Newly built Mocks are added to the full set of Mocks for this test, which will + # be verified when you call verify_mocks. + # + # create_mocks :donkey, :cat # Your test now has @donkey and @cat + # create_mock :dog # Test now has @donkey, @cat and @dog + # + # The first call returned a hash { :donkey => @donkey, :cat => @cat } + # and the second call returned { :dog => @dog } + # + # For more info on how to use your mocks, see Mock and Expectation + # + def create_mocks(*mock_names) + prepare_hardmock_control unless @main_mock_control + + mocks = {} + mock_names.each do |mock_name| + raise ArgumentError, "'nil' is not a valid name for a mock" if mock_name.nil? + mock_name = mock_name.to_s + mock_object = Mock.new(mock_name, @main_mock_control) + mocks[mock_name.to_sym] = mock_object + self.instance_variable_set "@#{mock_name}", mock_object + end + @all_mocks ||= {} + @all_mocks.merge! mocks + + return mocks.clone + end + + def prepare_hardmock_control + if @main_mock_control.nil? + @main_mock_control = MockControl.new + $main_mock_control = @main_mock_control + else + raise "@main_mock_control is already setup for this test!" + end + end + + alias :create_mock :create_mocks + + # Ensures that all expectations have been met. If not, VerifyException is + # raised. + # + # You normally won't need to call this yourself. Within Test::Unit::TestCase, this will be done automatically at teardown time. + # + # * +force+ -- if +false+, and a VerifyError or ExpectationError has already occurred, this method will not raise. This is to help you suppress repeated errors when if you're calling #verify_mocks in the teardown method of your test suite. BE WARNED - only use this if you're sure you aren't obscuring useful information. Eg, if your code handles exceptions internally, and an ExpectationError gets gobbled up by your +rescue+ block, the cause of failure for your test may be hidden from you. For this reason, #verify_mocks defaults to force=true as of Hardmock 1.0.1 + def verify_mocks(force=true) + return unless @main_mock_control + return if @main_mock_control.disappointed? and !force + @main_mock_control.verify + ensure + @main_mock_control.clear_expectations if @main_mock_control + $main_mock_control = nil + reset_stubs + end + + alias :verify_hardmocks :verify_mocks + + # Purge the main MockControl of all expectations, restore all concrete stubbed/mocked methods + def clear_expectations + @main_mock_control.clear_expectations if @main_mock_control + reset_stubs + $main_mock_control = nil + end + + def reset_stubs + Hardmock.restore_all_replaced_methods + end + +end + +require 'extend_test_unit' diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/errors.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/errors.rb new file mode 100644 index 0000000..48698a6 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/errors.rb @@ -0,0 +1,22 @@ +module Hardmock + # Raised when: + # * Unexpected method is called on a mock object + # * Bad arguments passed to an expected call + class ExpectationError < StandardError #:nodoc:# + end + + # Raised for methods that should no longer be called. Hopefully, the exception message contains helpful alternatives. + class DeprecationError < StandardError #:nodoc:# + end + + # Raised when stubbing fails + class StubbingError < StandardError #:nodoc:# + end + + # Raised when it is discovered that an expected method call was never made. + class VerifyError < StandardError #:nodoc:# + def initialize(msg,unmet_expectations) + super("#{msg}:" + unmet_expectations.map { |ex| "\n * #{ex.to_s}" }.join) + end + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/expectation.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/expectation.rb new file mode 100644 index 0000000..4d1db92 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/expectation.rb @@ -0,0 +1,229 @@ +require 'hardmock/utils' + +module Hardmock + class Expectation + include Utils + attr_reader :block_value + + def initialize(options) #:nodoc: + @options = options + end + + def apply_method_call(mock,mname,args,block) #:nodoc: + unless @options[:mock].equal?(mock) + raise anger("Wrong object", mock,mname,args) + end + unless @options[:method] == mname + raise anger("Wrong method",mock,mname,args) + end + + # Tester-defined block to invoke at method-call-time: + expectation_block = @options[:block] + + expected_args = @options[:arguments] + # if we have a block, we can skip the argument check if none were specified + unless (expected_args.nil? || expected_args.empty?) && expectation_block && !@options[:suppress_arguments_to_block] + unless expected_args == args + raise anger("Wrong arguments",mock,mname,args) + end + end + + relayed_args = args.dup + if block + if expectation_block.nil? + # Can't handle a runtime block without an expectation block + raise ExpectationError.new("Unexpected block provided to #{to_s}") + else + # Runtime blocks are passed as final argument to the expectation block + unless @options[:suppress_arguments_to_block] + relayed_args << block + else + # Arguments suppressed; send only the block + relayed_args = [block] + end + end + end + + # Run the expectation block: + @block_value = expectation_block.call(*relayed_args) if expectation_block + + raise @options[:raises] unless @options[:raises].nil? + + return_value = @options[:returns] + if return_value.nil? + return @block_value + else + return return_value + end + end + + # Set the return value for an expected method call. + # Eg, + # @cash_machine.expects.withdraw(20,:dollars).returns(20.00) + def returns(val) + @options[:returns] = val + self + end + alias_method :and_return, :returns + + # Set the arguments for an expected method call. + # Eg, + # @cash_machine.expects.deposit.with(20, "dollars").returns(:balance => "20") + def with(*args) + @options[:arguments] = args + self + end + + # Rig an expected method to raise an exception when the mock is invoked. + # + # Eg, + # @cash_machine.expects.withdraw(20,:dollars).raises "Insufficient funds" + # + # The argument can be: + # * an Exception -- will be used directly + # * a String -- will be used as the message for a RuntimeError + # * nothing -- RuntimeError.new("An Error") will be raised + def raises(err=nil) + case err + when Exception + @options[:raises] = err + when String + @options[:raises] = RuntimeError.new(err) + else + @options[:raises] = RuntimeError.new("An Error") + end + self + end + + # Convenience method: assumes +block_value+ is set, and is set to a Proc + # (or anything that responds to 'call') + # + # light_event = @traffic_light.trap.subscribe(:light_changes) + # + # # This code will meet the expectation: + # @traffic_light.subscribe :light_changes do |color| + # puts color + # end + # + # The color-handling block is now stored in light_event.block_value + # + # The block can be invoked like this: + # + # light_event.trigger :red + # + # See Mock#trap and Mock#expects for information on using expectation objects + # after they are set. + # + def trigger(*block_arguments) + unless block_value + raise ExpectationError.new("No block value is currently set for expectation #{to_s}") + end + unless block_value.respond_to?(:call) + raise ExpectationError.new("Can't apply trigger to #{block_value} for expectation #{to_s}") + end + block_value.call *block_arguments + end + + # Used when an expected method accepts a block at runtime. + # When the expected method is invoked, the block passed to + # that method will be invoked as well. + # + # NOTE: ExpectationError will be thrown upon running the expected method + # if the arguments you set up in +yields+ do not properly match up with + # the actual block that ends up getting passed. + # + # == Examples + # Single invocation: The block passed to +lock_down+ gets invoked + # once with no arguments: + # + # @safe_zone.expects.lock_down.yields + # + # # (works on code that looks like:) + # @safe_zone.lock_down do + # # ... this block invoked once + # end + # + # Multi-parameter blocks: The block passed to +each_item+ gets + # invoked twice, with :item1 the first time, and with + # :item2 the second time: + # + # @fruit_basket.expects.each_with_index.yields [:apple,1], [:orange,2] + # + # # (works on code that looks like:) + # @fruit_basket.each_with_index do |fruit,index| + # # ... this block invoked with fruit=:apple, index=1, + # # ... and then with fruit=:orange, index=2 + # end + # + # Arrays can be passed as arguments too... if the block + # takes a single argument and you want to pass a series of arrays into it, + # that will work as well: + # + # @list_provider.expects.each_list.yields [1,2,3], [4,5,6] + # + # # (works on code that looks like:) + # @list_provider.each_list do |list| + # # ... list is [1,2,3] the first time + # # ... list is [4,5,6] the second time + # end + # + # Return value: You can set the return value for the method that + # accepts the block like so: + # + # @cruncher.expects.do_things.yields(:bean1,:bean2).returns("The Results") + # + # Raising errors: You can set the raised exception for the method that + # accepts the block. NOTE: the error will be raised _after_ the block has + # been invoked. + # + # # :bean1 and :bean2 will be passed to the block, then an error is raised: + # @cruncher.expects.do_things.yields(:bean1,:bean2).raises("Too crunchy") + # + def yields(*items) + @options[:suppress_arguments_to_block] = true + if items.empty? + # Yield once + @options[:block] = lambda do |block| + if block.arity != 0 and block.arity != -1 + raise ExpectationError.new("The given block was expected to have no parameter count; instead, got #{block.arity} to <#{to_s}>") + end + block.call + end + else + # Yield one or more specific items + @options[:block] = lambda do |block| + items.each do |item| + if item.kind_of?(Array) + if block.arity == item.size + # Unfold the array into the block's arguments: + block.call *item + elsif block.arity == 1 + # Just pass the array in + block.call item + else + # Size mismatch + raise ExpectationError.new("Can't pass #{item.inspect} to block with arity #{block.arity} to <#{to_s}>") + end + else + if block.arity != 1 + # Size mismatch + raise ExpectationError.new("Can't pass #{item.inspect} to block with arity #{block.arity} to <#{to_s}>") + end + block.call item + end + end + end + end + self + end + + def to_s # :nodoc: + format_method_call_string(@options[:mock],@options[:method],@options[:arguments]) + end + + private + def anger(msg, mock,mname,args) + ExpectationError.new("#{msg}: expected call <#{to_s}> but was <#{format_method_call_string(mock,mname,args)}>") + end + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/expectation_builder.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/expectation_builder.rb new file mode 100644 index 0000000..7445fb1 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/expectation_builder.rb @@ -0,0 +1,9 @@ +require 'hardmock/expectation' + +module Hardmock + class ExpectationBuilder #:nodoc: + def build_expectation(options) + Expectation.new(options) + end + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/expector.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/expector.rb new file mode 100644 index 0000000..8055460 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/expector.rb @@ -0,0 +1,26 @@ +require 'hardmock/method_cleanout' +require 'hardmock/errors' + +module Hardmock + class Expector #:nodoc: + include MethodCleanout + + def initialize(mock,mock_control,expectation_builder) + @mock = mock + @mock_control = mock_control + @expectation_builder = expectation_builder + end + + def method_missing(mname, *args, &block) + expectation = @expectation_builder.build_expectation( + :mock => @mock, + :method => mname, + :arguments => args, + :block => block) + + @mock_control.add_expectation expectation + expectation + end + end + +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/method_cleanout.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/method_cleanout.rb new file mode 100644 index 0000000..51797e6 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/method_cleanout.rb @@ -0,0 +1,33 @@ + +module Hardmock #:nodoc: + module MethodCleanout #:nodoc: + SACRED_METHODS = %w{ + __id__ + __send__ + equal? + object_id + send + nil? + class + kind_of? + respond_to? + inspect + method + to_s + instance_variables + instance_eval + == + hm_metaclass + hm_meta_eval + hm_meta_def + } + + def self.included(base) #:nodoc: + base.class_eval do + instance_methods.each do |m| + undef_method m unless SACRED_METHODS.include?(m.to_s) + end + end + end + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/mock.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/mock.rb new file mode 100644 index 0000000..928c432 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/mock.rb @@ -0,0 +1,180 @@ + +module Hardmock + # Mock is used to set expectations in your test. Most of the time you'll use + # #expects to create expectations. + # + # Aside from the scant few control methods (like +expects+, +trap+ and +_verify+) + # all calls made on a Mock instance will be immediately applied to the internal + # expectation mechanism. + # + # * If the method call was expected and all the parameters match properly, execution continues + # * If the expectation was configured with an expectation block, the block is invoked + # * If the expectation was set up to raise an error, the error is raised now + # * If the expectation was set up to return a value, it is returned + # * If the method call was _not_ expected, or the parameter values are wrong, an ExpectationError is raised. + class Mock + include Hardmock::MethodCleanout + + # Create a new Mock instance with a name and a MockControl to support it. + # If not given, a MockControl is made implicitly for this Mock alone; this means + # expectations for this mock are not tied to other expectations in your test. + # + # It's not recommended to use a Mock directly; see Hardmock and + # Hardmock#create_mocks for the more wholistic approach. + def initialize(name, mock_control=nil) + @name = name + @control = mock_control || MockControl.new + @expectation_builder = ExpectationBuilder.new + end + + def inspect + "" + end + + # Begin declaring an expectation for this Mock. + # + # == Simple Examples + # Expect the +customer+ to be queried for +account+, and return "The + # Account": + # @customer.expects.account.returns "The Account" + # + # Expect the +withdraw+ method to be called, and raise an exception when it + # is (see Expectation#raises for more info): + # @cash_machine.expects.withdraw(20,:dollars).raises("not enough money") + # + # Expect +customer+ to have its +user_name+ set + # @customer.expects.user_name = 'Big Boss' + # + # Expect +customer+ to have its +user_name+ set, and raise a RuntimeException when + # that happens: + # @customer.expects('user_name=', "Big Boss").raises "lost connection" + # + # Expect +evaluate+ to be passed a block, and when that happens, pass a value + # to the block (see Expectation#yields for more info): + # @cruncher.expects.evaluate.yields("some data").returns("some results") + # + # + # == Expectation Blocks + # To do special handling of expected method calls when they occur, you + # may pass a block to your expectation, like: + # @page_scraper.expects.handle_content do |address,request,status| + # assert_not_nil address, "Can't abide nil addresses" + # assert_equal "http-get", request.method, "Can only handle GET" + # assert status > 200 and status < 300, status, "Failed status" + # "Simulated results #{request.content.downcase}" + # end + # In this example, when page_scraper.handle_content is called, its + # three arguments are passed to the expectation block and evaluated + # using the above assertions. The last value in the block will be used + # as the return value for +handle_content+ + # + # You may specify arguments to the expected method call, just like any normal + # expectation, and those arguments will be pre-validated before being passed + # to the expectation block. This is useful when you know all of the + # expected values but still need to do something programmatic. + # + # If the method being invoked on the mock accepts a block, that block will be + # passed to your expectation block as the last (or only) argument. Eg, the + # convenience method +yields+ can be replaced with the more explicit: + # @cruncher.expects.evaluate do |block| + # block.call "some data" + # "some results" + # end + # + # The result value of the expectation block becomes the return value for the + # expected method call. This can be overidden by using the +returns+ method: + # @cruncher.expects.evaluate do |block| + # block.call "some data" + # "some results" + # end.returns("the actual value") + # + # Additionally, the resulting value of the expectation block is stored + # in the +block_value+ field on the expectation. If you've saved a reference + # to your expectation, you may retrieve the block value once the expectation + # has been met. + # + # evaluation_event = @cruncher.expects.evaluate do |block| + # block.call "some data" + # "some results" + # end.returns("the actual value") + # + # result = @cruncher.evaluate do |input| + # puts input # => 'some data' + # end + # # result is 'the actual value' + # + # evaluation_event.block_value # => 'some results' + # + def expects(*args, &block) + expector = Expector.new(self,@control,@expectation_builder) + # If there are no args, we return the Expector + return expector if args.empty? + # If there ARE args, we set up the expectation right here and return it + expector.send(args.shift.to_sym, *args, &block) + end + alias_method :expect, :expects + alias_method :should_receive, :expects + + # Special-case convenience: #trap sets up an expectation for a method + # that will take a block. That block, when sent to the expected method, will + # be trapped and stored in the expectation's +block_value+ field. + # The Expectation#trigger method may then be used to invoke that block. + # + # Like +expects+, the +trap+ mechanism can be followed by +raises+ or +returns+. + # + # _Unlike_ +expects+, you may not use an expectation block with +trap+. If + # the expected method takes arguments in addition to the block, they must + # be specified in the arguments to the +trap+ call itself. + # + # == Example + # + # create_mocks :address_book, :editor_form + # + # # Expect a subscription on the :person_added event for @address_book: + # person_event = @address_book.trap.subscribe(:person_added) + # + # # The runtime code would look like: + # @address_book.subscribe :person_added do |person_name| + # @editor_form.name = person_name + # end + # + # # At this point, the expectation for 'subscribe' is met and the + # # block has been captured. But we're not done: + # @editor_form.expects.name = "David" + # + # # Now invoke the block we trapped earlier: + # person_event.trigger "David" + # + # verify_mocks + def trap(*args) + Trapper.new(self,@control,ExpectationBuilder.new) + end + + def method_missing(mname,*args) #:nodoc: + block = nil + block = Proc.new if block_given? + @control.apply_method_call(self,mname,args,block) + end + + + def _control #:nodoc: + @control + end + + def _name #:nodoc: + @name + end + + # Verify that all expectations are fulfilled. NOTE: this method triggers + # validation on the _control_ for this mock, so all Mocks that share the + # MockControl with this instance will be included in the verification. + # + # Only use this method if you are managing your own Mocks and their controls. + # + # Normal usage of Hardmock doesn't require you to call this; let + # Hardmock#verify_mocks do it for you. + def _verify + @control.verify + end + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/mock_control.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/mock_control.rb new file mode 100644 index 0000000..302ebce --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/mock_control.rb @@ -0,0 +1,53 @@ +require 'hardmock/utils' + +module Hardmock + class MockControl #:nodoc: + include Utils + attr_accessor :name + + def initialize + clear_expectations + end + + def happy? + @expectations.empty? + end + + def disappointed? + @disappointed + end + + def add_expectation(expectation) +# puts "MockControl #{self.object_id.to_s(16)} adding expectation: #{expectation}" + @expectations << expectation + end + + def apply_method_call(mock,mname,args,block) + # Are we even expecting any sort of call? + if happy? + @disappointed = true + raise ExpectationError.new("Surprise call to #{format_method_call_string(mock,mname,args)}") + end + + begin + @expectations.shift.apply_method_call(mock,mname,args,block) + rescue Exception => ouch + @disappointed = true + raise ouch + end + end + + def verify +# puts "MockControl #{self.object_id.to_s(16)} verify: happy? #{happy?}" + @disappointed = !happy? + raise VerifyError.new("Unmet expectations", @expectations) unless happy? + end + + def clear_expectations + @expectations = [] + @disappointed = false + end + + end + +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/stubbing.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/stubbing.rb new file mode 100644 index 0000000..0f8a293 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/stubbing.rb @@ -0,0 +1,210 @@ + + +# Stubbing support +# +# Stubs methods on classes and instances +# + +# Why's "metaid.rb" stuff crunched down: +class Object #:nodoc:# + def hm_metaclass #:nodoc:# + class << self + self + end + end + + def hm_meta_eval(&blk) #:nodoc:# + hm_metaclass.instance_eval(&blk) + end + + def hm_meta_def(name, &blk) #:nodoc:# + hm_meta_eval { define_method name, &blk } + end +end + + + +module Hardmock + + # == Hardmock: Stubbing and Mocking Concrete Methods + # + # Hardmock lets you stub and/or mock methods on concrete classes or objects. + # + # * To "stub" a concrete method is to rig it to return the same thing always, disregarding any arguments. + # * To "mock" a concrete method is to surplant its funcionality by delegating to a mock object who will cover this behavior. + # + # Mocked methods have their expectations considered along with all other mock object expectations. + # + # If you use stubbing or concrete mocking in the absence (or before creation) of other mocks, you need to invoke prepare_hardmock_control. + # Once verify_mocks or clear_expectaions is called, the overriden behavior in the target objects is restored. + # + # == Examples + # + # River.stubs!(:sounds_like).returns("gurgle") + # + # River.expects!(:jump).returns("splash") + # + # rogue.stubs!(:sounds_like).returns("pshshsh") + # + # rogue.expects!(:rawhide_tanning_solvents).returns("giant snapping turtles") + # + module Stubbing + # Exists only for documentation + end + + class ReplacedMethod #:nodoc:# + attr_reader :target, :method_name + + def initialize(target, method_name) + @target = target + @method_name = method_name + + Hardmock.track_replaced_method self + end + end + + class StubbedMethod < ReplacedMethod #:nodoc:# + def invoke(args) + raise @raises if @raises + @return_value + end + + def returns(stubbed_return) + @return_value = stubbed_return + end + + def raises(err) + err = RuntimeError.new(err) unless err.kind_of?(Exception) + @raises = err + end + end + + class ::Object + def stubs!(method_name) + method_name = method_name.to_s + already_stubbed = Hardmock.has_replaced_method?(self, method_name) + + stubbed_method = Hardmock::StubbedMethod.new(self, method_name) + + + unless _is_mock? or already_stubbed + if methods.include?(method_name.to_s) + hm_meta_eval do + alias_method "_hardmock_original_#{method_name}".to_sym, method_name.to_sym + end + end + end + + hm_meta_def method_name do |*args| + stubbed_method.invoke(args) + end + + stubbed_method + end + + def expects!(method_name, *args, &block) + if self._is_mock? + raise Hardmock::StubbingError, "Cannot use 'expects!(:#{method_name})' on a Mock object; try 'expects' instead" + end + + method_name = method_name.to_s + + @_my_mock = Mock.new(_my_name, $main_mock_control) if @_my_mock.nil? + + unless Hardmock.has_replaced_method?(self, method_name) + # Track the method as replaced + Hardmock::ReplacedMethod.new(self, method_name) + + # Preserver original implementation of the method by aliasing it away + if methods.include?(method_name) + hm_meta_eval do + alias_method "_hardmock_original_#{method_name}".to_sym, method_name.to_sym + end + end + + # Re-define the method to utilize our patron mock instance. + # (This global-temp-var thing is hokey but I was having difficulty generating + # code for the meta class.) + begin + $method_text_temp = %{ + def #{method_name}(*args,&block) + @_my_mock.__send__(:#{method_name}, *args, &block) + end + } + class << self + eval $method_text_temp + end + ensure + $method_text_temp = nil + end + end + + return @_my_mock.expects(method_name, *args, &block) + end + + def _is_mock? + self.kind_of?(Mock) + end + + def _my_name + self.kind_of?(Class) ? self.name : self.class.name + end + + def _clear_mock + @_my_mock = nil + end + + end + + class ::NilClass + # Use this only if you really mean it + alias_method :intentionally_stubs!, :stubs! + + # Use this only if you really mean it + alias_method :intentionally_expects!, :expects! + + # Overridden to protect against accidental nil reference self delusion + def stubs!(mname) + raise StubbingError, "Cannot stub #{mname} method on nil. (If you really mean to, try 'intentionally_stubs!')" + end + + # Overridden to protect against accidental nil reference self delusion + def expects!(mname, *args) + raise StubbingError, "Cannot mock #{mname} method on nil. (If you really mean to, try 'intentionally_expects!')" + end + end + + class << self + def track_replaced_method(replaced_method) + all_replaced_methods << replaced_method + end + + def all_replaced_methods + $all_replaced_methods ||= [] + end + + def has_replaced_method?(obj, method_name) + hits = all_replaced_methods.select do |replaced| + (replaced.target.object_id == obj.object_id) and (replaced.method_name.to_s == method_name.to_s) + end + return !hits.empty? + end + + def restore_all_replaced_methods + all_replaced_methods.each do |replaced| + unless replaced.target._is_mock? + backed_up = "_hardmock_original_#{replaced.method_name}" + if replaced.target.methods.include?(backed_up) + replaced.target.hm_meta_eval do + alias_method replaced.method_name.to_sym, backed_up.to_sym + end + end + replaced.target._clear_mock + end + end + all_replaced_methods.clear + end + end + +end + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/trapper.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/trapper.rb new file mode 100644 index 0000000..6aab176 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/trapper.rb @@ -0,0 +1,31 @@ +require 'test/unit/assertions' +require 'hardmock/errors' + +module Hardmock + class Trapper #:nodoc: + include Hardmock::MethodCleanout + + def initialize(mock,mock_control,expectation_builder) + @mock = mock + @mock_control = mock_control + @expectation_builder = expectation_builder + end + + def method_missing(mname, *args) + if block_given? + raise ExpectationError.new("Don't pass blocks when using 'trap' (setting exepectations for '#{mname}')") + end + + the_block = lambda { |target_block| target_block } + expectation = @expectation_builder.build_expectation( + :mock => @mock, + :method => mname, + :arguments => args, + :suppress_arguments_to_block => true, + :block => the_block) + + @mock_control.add_expectation expectation + expectation + end + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/utils.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/utils.rb new file mode 100644 index 0000000..1740577 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/lib/hardmock/utils.rb @@ -0,0 +1,9 @@ + +module Hardmock + module Utils #:nodoc: + def format_method_call_string(mock,mname,args) + arg_string = args.map { |a| a.inspect }.join(', ') + call_text = "#{mock._name}.#{mname}(#{arg_string})" + end + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/lib/test_unit_before_after.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/lib/test_unit_before_after.rb new file mode 100644 index 0000000..0499e39 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/lib/test_unit_before_after.rb @@ -0,0 +1,169 @@ +require 'test/unit' +require 'test/unit/testcase' +require 'test/unit/assertions' + +module Test #:nodoc:# + module Unit #:nodoc:# + + # == TestCase Modifications + # + # Monkey-patch to provide a formal mechanism for appending actions to be executed after teardown. + # Use after_teardown to define one or more actions to be executed after teardown for ALL tests. + # + # COMING SOON? + # * (maybe?) Hooks for before_teardown, after_setup, on_error + # * (maybe?) Options for positional control, eg, after_teardown :before_other_actions + # * (maybe?) Provide tagging/filtering so action execution can be controlled specifically? + # + # == Usage + # + # Invoke TestCase.after_teardown with optional parameter, which will be invoked with a reference + # to the test instance that has just been torn down. + # + # Example: + # + # Test::Unit::TestCase.after_teardown do |test| + # test.verify_mocks + # end + # + # == Justification + # + # There are a number of tools and libraries that play fast-n-loose with setup and teardown by + # wrapping them, and by overriding method_added as a means of upholding special setup/teardown + # behavior, usually by re-wrapping newly defined user-level setup/teardown methods. + # mocha and active_record/fixtures (and previously, hardmock) will fight for this + # territory with often unpredictable results. + # + # We wouldn't have to battle if Test::Unit provided a formal pre- and post- hook mechanism. + # + class TestCase + + class << self + + # Define an action to be run after teardown. Subsequent calls result in + # multiple actions. The block will be given a reference to the test + # being executed. + # + # Example: + # + # Test::Unit::TestCase.after_teardown do |test| + # test.verify_mocks + # end + def after_teardown(&block) + post_teardown_actions << block + end + + # Used internally. Access the list of post teardown actions for to be + # used by all tests. + def post_teardown_actions + @@post_teardown_actions ||= [] + end + + # Define an action to be run before setup. Subsequent calls result in + # multiple actions, EACH BEING PREPENDED TO THE PREVIOUS. + # The block will be given a reference to the test being executed. + # + # Example: + # + # Test::Unit::TestCase.before_setup do |test| + # test.prepare_hardmock_control + # end + def before_setup(&block) + pre_setup_actions.unshift block + end + + # Used internally. Access the list of post teardown actions for to be + # used by all tests. + def pre_setup_actions + @@pre_setup_actions ||= [] + end + end + + # OVERRIDE: This is a reimplementation of the default "run", updated to + # execute actions after teardown. + def run(result) + yield(STARTED, name) + @_result = result + begin + execute_pre_setup_actions(self) + setup + __send__(@method_name) + rescue Test::Unit::AssertionFailedError => e + add_failure(e.message, auxiliary_backtrace_filter(e.backtrace)) + rescue Exception + raise if should_passthru_exception($!) # See implementation; this is for pre-1.8.6 compat + add_error($!) + ensure + begin + teardown + rescue Test::Unit::AssertionFailedError => e + add_failure(e.message, auxiliary_backtrace_filter(e.backtrace)) + rescue Exception + raise if should_passthru_exception($!) # See implementation; this is for pre-1.8.6 compat + add_error($!) + ensure + execute_post_teardown_actions(self) + end + end + result.add_run + yield(FINISHED, name) + end + + private + + # Run through the after_teardown actions, treating failures and errors + # in the same way that "run" does: they are reported, and the remaining + # actions are executed. + def execute_post_teardown_actions(test_instance) + self.class.post_teardown_actions.each do |action| + begin + action.call test_instance + rescue Test::Unit::AssertionFailedError => e + add_failure(e.message, auxiliary_backtrace_filter(e.backtrace)) + rescue Exception + raise if should_passthru_exception($!) + add_error($!) + end + end + end + + # Run through the before_setup actions. + # Failures or errors cause execution to stop. + def execute_pre_setup_actions(test_instance) + self.class.pre_setup_actions.each do |action| +# begin + action.call test_instance +# rescue Test::Unit::AssertionFailedError => e +# add_failure(e.message, auxiliary_backtrace_filter(e.backtrace)) +# rescue Exception +# raise if should_passthru_exception($!) +# add_error($!) +# end + end + end + + # Make sure that this extension doesn't show up in failure backtraces + def auxiliary_backtrace_filter(trace) + trace.reject { |x| x =~ /test_unit_before_after/ } + end + + # Is the given error of the type that we allow to fly out (rather than catching it)? + def should_passthru_exception(ex) + return passthrough_exception_types.include?($!.class) + end + + # Provide a list of exception types that are to be allowed to explode out. + # Pre-ruby-1.8.6 doesn't use this functionality, so the PASSTHROUGH_EXCEPTIONS + # constant won't be defined. This methods defends against that and returns + # an empty list instead. + def passthrough_exception_types + begin + return PASSTHROUGH_EXCEPTIONS + rescue NameError + # older versions of test/unit do not have PASSTHROUGH_EXCEPTIONS constant + return [] + end + end + end + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/rake_tasks/rdoc.rake b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/rake_tasks/rdoc.rake new file mode 100644 index 0000000..6a6d79f --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/rake_tasks/rdoc.rake @@ -0,0 +1,19 @@ +require 'rake/rdoctask' +require File.expand_path(File.dirname(__FILE__) + "/rdoc_options.rb") + +namespace :doc do + + desc "Generate RDoc documentation" + Rake::RDocTask.new { |rdoc| + rdoc.rdoc_dir = 'doc' + rdoc.title = "Hardmock: Strict expectation-based mock object library " + add_rdoc_options(rdoc.options) + rdoc.rdoc_files.include('lib/**/*.rb', 'README','CHANGES','LICENSE') + } + + task :show => [ 'doc:rerdoc' ] do + sh "open doc/index.html" + end + +end + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/rake_tasks/rdoc_options.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/rake_tasks/rdoc_options.rb new file mode 100644 index 0000000..85bf4ce --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/rake_tasks/rdoc_options.rb @@ -0,0 +1,4 @@ + +def add_rdoc_options(options) + options << '--line-numbers' << '--inline-source' << '--main' << 'README' << '--title' << 'Hardmock' +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/rake_tasks/test.rake b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/rake_tasks/test.rake new file mode 100644 index 0000000..85a3753 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/rake_tasks/test.rake @@ -0,0 +1,22 @@ +require 'rake/testtask' + +namespace :test do + + desc "Run unit tests" + Rake::TestTask.new("units") { |t| + t.libs << "test" + t.pattern = 'test/unit/*_test.rb' + t.verbose = true + } + + desc "Run functional tests" + Rake::TestTask.new("functional") { |t| + t.libs << "test" + t.pattern = 'test/functional/*_test.rb' + t.verbose = true + } + + desc "Run all the tests" + task :all => [ 'test:units', 'test:functional' ] + +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/assert_error_test.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/assert_error_test.rb new file mode 100644 index 0000000..e4b35cf --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/assert_error_test.rb @@ -0,0 +1,52 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'assert_error' + +class AssertErrorTest < Test::Unit::TestCase + + it "specfies an error type and message that should be raised" do + assert_error RuntimeError, "Too funky" do + raise RuntimeError.new("Too funky") + end + end + + it "flunks if the error message is wrong" do + err = assert_raise Test::Unit::AssertionFailedError do + assert_error RuntimeError, "not good" do + raise RuntimeError.new("Too funky") + end + end + assert_match(/not good/i, err.message) + assert_match(/too funky/i, err.message) + end + + it "flunks if the error type is wrong" do + err = assert_raise Test::Unit::AssertionFailedError do + assert_error StandardError, "Too funky" do + raise RuntimeError.new("Too funky") + end + end + assert_match(/StandardError/i, err.message) + assert_match(/RuntimeError/i, err.message) + end + + it "can match error message text using a series of Regexps" do + assert_error StandardError, /too/i, /funky/i do + raise StandardError.new("Too funky") + end + end + + it "flunks if the error message doesn't match all the Regexps" do + err = assert_raise Test::Unit::AssertionFailedError do + assert_error StandardError, /way/i, /too/i, /funky/i do + raise StandardError.new("Too funky") + end + end + assert_match(/way/i, err.message) + end + + it "can operate without any message specification" do + assert_error StandardError do + raise StandardError.new("ooof") + end + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/auto_verify_test.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/auto_verify_test.rb new file mode 100644 index 0000000..1b005bd --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/auto_verify_test.rb @@ -0,0 +1,178 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'fileutils' + +class AutoVerifyTest < Test::Unit::TestCase + + def setup + @expect_unmet_expectations = true + end + + def teardown + remove_temp_test_file + end + + # + # TESTS + # + + it "auto-verifies all mocks in teardown" do + write_and_execute_test + end + + it "auto-verifies even if user defines own teardown" do + @teardown_code =<<-EOM + def teardown + # just in the way + end + EOM + write_and_execute_test + end + + should "not obscure normal failures when verification fails" do + @test_code =<<-EOM + def test_setup_doomed_expectation + create_mock :automobile + @automobile.expects.start + flunk "natural failure" + end + EOM + @expect_failures = 1 + write_and_execute_test + end + + should "not skip user-defined teardown when verification fails" do + @teardown_code =<<-EOM + def teardown + puts "User teardown" + end + EOM + write_and_execute_test + assert_output_contains(/User teardown/) + end + + it "is quiet when verification is ok" do + @test_code =<<-EOM + def test_ok + create_mock :automobile + @automobile.expects.start + @automobile.start + end + EOM + @teardown_code =<<-EOM + def teardown + puts "User teardown" + end + EOM + @expect_unmet_expectations = false + @expect_failures = 0 + @expect_errors = 0 + write_and_execute_test + assert_output_contains(/User teardown/) + end + + should "auto-verify even if user teardown explodes" do + @teardown_code =<<-EOM + def teardown + raise "self destruct" + end + EOM + @expect_errors = 2 + write_and_execute_test + assert_output_contains(/self destruct/) + end + + it "plays nice with inherited teardown methods" do + @full_code ||=<<-EOTEST + require File.expand_path(File.dirname(__FILE__) + "/../test_helper") + require 'hardmock' + class Test::Unit::TestCase + def teardown + puts "Test helper teardown" + end + end + class DummyTest < Test::Unit::TestCase + def test_prepare_to_die + create_mock :automobile + @automobile.expects.start + end + end + EOTEST + write_and_execute_test + assert_output_contains(/Test helper teardown/) + end + + # + # HELPERS + # + + def temp_test_file + File.expand_path(File.dirname(__FILE__) + "/tear_down_verification_test.rb") + end + + def run_test(tbody) + File.open(temp_test_file,"w") { |f| f.print(tbody) } + @test_output = `ruby #{temp_test_file} 2>&1` + end + + def formatted_test_output + if @test_output + @test_output.split(/\n/).map { |line| "> #{line}" }.join("\n") + else + "(NO TEST OUTPUT!)" + end + end + + def remove_temp_test_file + FileUtils::rm_f temp_test_file + end + + def assert_results(h) + if @test_output !~ /#{h[:tests]} tests, [0-9]+ assertions, #{h[:failures]} failures, #{h[:errors]} errors/ + flunk "Test results didn't match #{h.inspect}:\n#{formatted_test_output}" + end + end + + def assert_output_contains(*patterns) + patterns.each do |pattern| + if @test_output !~ pattern + flunk "Test output didn't match #{pattern.inspect}:\n#{formatted_test_output}" + end + end + end + + def assert_output_doesnt_contain(*patterns) + patterns.each do |pattern| + assert @test_output !~ pattern, "Output shouldn't match #{pattern.inspect} but it does." + end + end + + def write_and_execute_test + @test_code ||=<<-EOM + def test_setup_doomed_expectation + create_mock :automobile + @automobile.expects.start + end + EOM + @full_code ||=<<-EOTEST + require File.expand_path(File.dirname(__FILE__) + "/../test_helper") + require 'hardmock' + class DummyTest < Test::Unit::TestCase + #{@teardown_code} + #{@test_code} + end + EOTEST + run_test @full_code + + if @expect_unmet_expectations + assert_output_contains(/unmet expectations/i, /automobile/, /start/) + else + assert_output_doesnt_contain(/unmet expectations/i, /automobile/, /start/) + end + + @expect_tests ||= 1 + @expect_failures ||= 0 + @expect_errors ||= 1 + assert_results :tests => @expect_tests, :failures => @expect_failures, :errors => @expect_errors + end + +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/direct_mock_usage_test.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/direct_mock_usage_test.rb new file mode 100644 index 0000000..dcf2b2a --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/direct_mock_usage_test.rb @@ -0,0 +1,396 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock' + +class DirectMockUsageTest < Test::Unit::TestCase + + def setup + @bird = Mock.new('bird') + end + + def teardown + end + + # + # TESTS + # + + it "raises VerifyError if expected method not called" do + @bird.expects.flap_flap + + err = assert_raise VerifyError do + @bird._verify + end + assert_match(/unmet expectations/i, err.message) + end + + should "not raise when expected calls are made in order" do + @bird.expects.flap_flap + @bird.expects.bang + @bird.expects.plop + + @bird.flap_flap + @bird.bang + @bird.plop + + @bird._verify + end + + it "raises ExpectationError when unexpected method are called" do + @bird.expects.flap_flap + + err = assert_raise ExpectationError do + @bird.shoot + end + assert_match(/wrong method/i, err.message) + end + + it "raises ExpectationError on bad arguments" do + @bird.expects.flap_flap(:swoosh) + + err = assert_raise ExpectationError do + @bird.flap_flap(:rip) + end + assert_match(/wrong arguments/i, err.message) + end + + it "raises VerifyError when not all expected methods are called" do + @bird.expects.flap_flap + @bird.expects.bang + @bird.expects.plop + + @bird.flap_flap + + err = assert_raise VerifyError do + @bird._verify + end + assert_match(/unmet expectations/i, err.message) + end + + it "raises ExpectationError when calls are made out of order" do + @bird.expects.flap_flap + @bird.expects.bang + @bird.expects.plop + + @bird.flap_flap + err = assert_raise ExpectationError do + @bird.plop + end + assert_match(/wrong method/i, err.message) + end + + it "returns the configured value" do + @bird.expects.plop.returns(':P') + assert_equal ':P', @bird.plop + @bird._verify + + @bird.expects.plop.returns(':x') + assert_equal ':x', @bird.plop + @bird._verify + end + + it "returns nil when no return is specified" do + @bird.expects.plop + assert_nil @bird.plop + @bird._verify + end + + it "raises the configured exception" do + err = RuntimeError.new('shaq') + @bird.expects.plop.raises(err) + actual_err = assert_raise RuntimeError do + @bird.plop + end + assert_same err, actual_err, 'should be the same error' + @bird._verify + end + + it "raises a RuntimeError when told to 'raise' a string" do + @bird.expects.plop.raises('shaq') + err = assert_raise RuntimeError do + @bird.plop + end + assert_match(/shaq/i, err.message) + @bird._verify + end + + it "raises a default RuntimeError" do + @bird.expects.plop.raises + err = assert_raise RuntimeError do + @bird.plop + end + assert_match(/error/i, err.message) + @bird._verify + end + + it "is quiet when correct arguments given" do + thing = Object.new + @bird.expects.plop(:big,'one',thing) + @bird.plop(:big,'one',thing) + @bird._verify + end + + it "raises ExpectationError when wrong number of arguments specified" do + thing = Object.new + @bird.expects.plop(:big,'one',thing) + err = assert_raise ExpectationError do + # more + @bird.plop(:big,'one',thing,:other) + end + assert_match(/wrong arguments/i, err.message) + @bird._verify + + @bird.expects.plop(:big,'one',thing) + err = assert_raise ExpectationError do + # less + @bird.plop(:big,'one') + end + assert_match(/wrong arguments/i, err.message) + @bird._verify + + @bird.expects.plop + err = assert_raise ExpectationError do + # less + @bird.plop(:big) + end + assert_match(/wrong arguments/i, err.message) + @bird._verify + end + + it "raises ExpectationError when arguments don't match" do + thing = Object.new + @bird.expects.plop(:big,'one',thing) + err = assert_raise ExpectationError do + @bird.plop(:big,'two',thing,:other) + end + assert_match(/wrong arguments/i, err.message) + @bird._verify + end + + it "can use a block for custom reactions" do + mitt = nil + @bird.expects.plop { mitt = :ball } + assert_nil mitt + @bird.plop + assert_equal :ball, mitt, 'didnt catch the ball' + @bird._verify + + @bird.expects.plop { raise 'ball' } + err = assert_raise RuntimeError do + @bird.plop + end + assert_match(/ball/i, err.message) + @bird._verify + end + + it "passes mock-call arguments to the expectation block" do + ball = nil + mitt = nil + @bird.expects.plop {|arg1,arg2| + ball = arg1 + mitt = arg2 + } + assert_nil ball + assert_nil mitt + @bird.plop(:ball,:mitt) + assert_equal :ball, ball + assert_equal :mitt, mitt + @bird._verify + end + + it "validates arguments if specified in addition to a block" do + ball = nil + mitt = nil + @bird.expects.plop(:ball,:mitt) {|arg1,arg2| + ball = arg1 + mitt = arg2 + } + assert_nil ball + assert_nil mitt + @bird.plop(:ball,:mitt) + assert_equal :ball, ball + assert_equal :mitt, mitt + @bird._verify + + ball = nil + mitt = nil + @bird.expects.plop(:bad,:stupid) {|arg1,arg2| + ball = arg1 + mitt = arg2 + } + assert_nil ball + assert_nil mitt + err = assert_raise ExpectationError do + @bird.plop(:ball,:mitt) + end + assert_match(/wrong arguments/i, err.message) + assert_nil ball + assert_nil mitt + @bird._verify + + ball = nil + mitt = nil + @bird.expects.plop(:ball,:mitt) {|arg1,arg2| + ball = arg1 + mitt = arg2 + } + assert_nil ball + assert_nil mitt + err = assert_raise ExpectationError do + @bird.plop(:ball) + end + assert_match(/wrong arguments/i, err.message) + assert_nil ball + assert_nil mitt + @bird._verify + end + + it "passes runtime blocks to the expectation block as the final argument" do + runtime_block_called = false + got_arg = nil + + # Eg, bird expects someone to subscribe to :tweet using the 'when' method + @bird.expects.when(:tweet) { |arg1, block| + got_arg = arg1 + block.call + } + + @bird.when(:tweet) do + runtime_block_called = true + end + + assert_equal :tweet, got_arg, "Wrong arg" + assert runtime_block_called, "The runtime block should have been invoked by the user block" + + @bird.expects.when(:warnk) { |e,blk| } + + err = assert_raise ExpectationError do + @bird.when(:honk) { } + end + assert_match(/wrong arguments/i, err.message) + + @bird._verify + end + + it "passes the runtime block to the expectation block as sole argument if no other args come into play" do + runtime_block_called = false + @bird.expects.subscribe { |block| block.call } + @bird.subscribe do + runtime_block_called = true + end + assert runtime_block_called, "The runtime block should have been invoked by the user block" + end + + it "provides nil as final argument if expectation block seems to want a block" do + invoked = false + @bird.expects.kablam(:scatter) { |shot,block| + assert_equal :scatter, shot, "Wrong shot" + assert_nil block, "The expectation block should get a nil block when user neglects to pass one" + invoked = true + } + @bird.kablam :scatter + assert invoked, "Expectation block not invoked" + + @bird._verify + end + + it "can set explicit return after an expectation block" do + got = nil + @bird.expects.kablam(:scatter) { |shot| + got = shot + }.returns(:death) + + val = @bird.kablam :scatter + assert_equal :death, val, "Wrong return value" + assert_equal :scatter, got, "Wrong argument" + @bird._verify + end + + it "can raise after an expectation block" do + got = nil + @bird.expects.kablam(:scatter) do |shot| + got = shot + end.raises "hell" + + err = assert_raise RuntimeError do + @bird.kablam :scatter + end + assert_match(/hell/i, err.message) + + @bird._verify + end + + it "stores the semantic value of the expectation block after it executes" do + expectation = @bird.expects.kablam(:slug) { |shot| + "The shot was #{shot}" + } + + assert_not_nil expectation, "Expectation nil" + assert_nil expectation.block_value, "Block value should start out nil" + + ret_val = @bird.kablam :slug + + assert_equal "The shot was slug", expectation.block_value + assert_equal "The shot was slug", ret_val, "Block value should also be used for return" + + @bird._verify + end + + + it "uses the value of the expectation block as the default return value" do + @bird.expects.kablam(:scatter) { |shot| + "The shot was #{shot}" + } + val = @bird.kablam :scatter + assert_equal "The shot was scatter", val, "Wrong return value" + @bird._verify + end + + it "returns the Expectation even if 'returns' is used" do + expectation = @bird.expects.kablam(:slug) { |shot| + "The shot was #{shot}" + }.returns :hosed + + assert_not_nil expectation, "Expectation nil" + assert_nil expectation.block_value, "Block value should start out nil" + + ret_val = @bird.kablam :slug + + assert_equal "The shot was slug", expectation.block_value + assert_equal :hosed, ret_val, "Block value should also be used for return" + + @bird._verify + end + + it "returns the Expectation even if 'raises' is used" do + expectation = @bird.expects.kablam(:slug) { |shot| + "The shot was #{shot}" + }.raises "aiee!" + + assert_not_nil expectation, "Expectation nil" + assert_nil expectation.block_value, "Block value should start out nil" + + err = assert_raise RuntimeError do + @bird.kablam :slug + end + assert_match(/aiee!/i, err.message) + assert_equal "The shot was slug", expectation.block_value + @bird._verify + end + + + it "supports assignment-style methods" do + @bird.expects.size = "large" + @bird.size = "large" + @bird._verify + end + + it "supports assignments and raising (using explicit-method syntax)" do + @bird.expects('size=','large').raises "boom" + + err = assert_raise RuntimeError do + @bird.size = "large" + end + assert_match(/boom/i, err.message) + end + +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/hardmock_test.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/hardmock_test.rb new file mode 100644 index 0000000..159d369 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/hardmock_test.rb @@ -0,0 +1,434 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock' +require 'assert_error' + +class HardmockTest < Test::Unit::TestCase + + # + # TESTS + # + + it "conveniently creates mocks using create_mock and create_mocks" do + + h = create_mock :donkey + assert_equal [ :donkey ], h.keys + + assert_mock_exists :donkey + assert_same @donkey, h[:donkey] + + assert_equal [ :donkey ], @all_mocks.keys, "Wrong keyset for @all_mocks" + + h2 = create_mocks :cat, 'dog' # symbol/string indifference at this level + assert_equal [:cat,:dog].to_set, h2.keys.to_set, "Wrong keyset for second hash" + assert_equal [:cat,:dog,:donkey].to_set, @all_mocks.keys.to_set, "@all_mocks wrong" + + assert_mock_exists :cat + assert_same @cat, h2[:cat] + assert_mock_exists :dog + assert_same @dog, h2[:dog] + + assert_mock_exists :donkey + end + + it "provides literal 'expects' syntax" do + assert_nil @order, "Should be no @order yet" + create_mock :order + assert_not_nil @order, "@order should be built" + + # Setup an expectation + @order.expects.update_stuff :key1 => 'val1', :key2 => 'val2' + + # Use the mock + @order.update_stuff :key1 => 'val1', :key2 => 'val2' + + # Verify + verify_mocks + + # See that it's ok to do it again + verify_mocks + end + + it "supports 'with' for specifying argument expectations" do + create_mocks :car + @car.expects(:fill).with('gas','booze') + @car.fill('gas', 'booze') + verify_mocks + end + + it "supports several mocks at once" do + create_mocks :order_builder, :order, :customer + + @order_builder.expects.create_new_order.returns @order + @customer.expects.account_number.returns(1234) + @order.expects.account_no = 1234 + @order.expects.save! + + # Run "the code" + o = @order_builder.create_new_order + o.account_no = @customer.account_number + o.save! + + verify_mocks + end + + it "enforces inter-mock call ordering" do + create_mocks :order_builder, :order, :customer + + @order_builder.expects.create_new_order.returns @order + @customer.expects.account_number.returns(1234) + @order.expects.account_no = 1234 + @order.expects.save! + + # Run "the code" + o = @order_builder.create_new_order + err = assert_raise ExpectationError do + o.save! + end + assert_match(/wrong object/i, err.message) + assert_match(/order.save!/i, err.message) + assert_match(/customer.account_number/i, err.message) + + assert_error VerifyError, /unmet expectations/i do + verify_mocks + end + end + + class UserPresenter + def initialize(args) + view = args[:view] + model = args[:model] + model.when :data_changes do + view.user_name = model.user_name + end + view.when :user_edited do + model.user_name = view.user_name + end + end + end + + it "makes MVP testing simple" do + mox = create_mocks :model, :view + + data_change = @model.expects.when(:data_changes) { |evt,block| block } + user_edit = @view.expects.when(:user_edited) { |evt,block| block } + + UserPresenter.new mox + + # Expect user name transfer from model to view + @model.expects.user_name.returns 'Da Croz' + @view.expects.user_name = 'Da Croz' + # Trigger data change event in model + data_change.block_value.call + + # Expect user name transfer from view to model + @view.expects.user_name.returns '6:8' + @model.expects.user_name = '6:8' + # Trigger edit event in view + user_edit.block_value.call + + verify_mocks + end + + it "continues to function after verify, if verification error is controlled" do + mox = create_mocks :model, :view + data_change = @model.expects.when(:data_changes) { |evt,block| block } + user_edit = @view.expects.when(:user_edited) { |evt,block| block } + UserPresenter.new mox + + # Expect user name transfer from model to view + @model.expects.user_name.returns 'Da Croz' + @view.expects.user_name = 'Da Croz' + + assert_error ExpectationError, /model.monkey_wrench/i do + @model.monkey_wrench + end + + # This should raise because of unmet expectations + assert_error VerifyError, /unmet expectations/i, /user_name/i do + verify_mocks + end + + # See that the non-forced verification remains quiet + assert_nothing_raised VerifyError do + verify_mocks(false) + end + + @model.expects.never_gonna_happen + + assert_error VerifyError, /unmet expectations/i, /never_gonna_happen/i do + verify_mocks + end + end + + class UserPresenterBroken + def initialize(args) + view = args[:view] + model = args[:model] + model.when :data_changes do + view.user_name = model.user_name + end + # no view stuff, will break appropriately + end + end + + it "flunks for typical Presenter constructor wiring failure" do + mox = create_mocks :model, :view + + data_change = @model.expects.when(:data_changes) { |evt,block| block } + user_edit = @view.expects.when(:user_edited) { |evt,block| block } + + UserPresenterBroken.new mox + + err = assert_raise VerifyError do + verify_mocks + end + assert_match(/unmet expectations/i, err.message) + assert_match(/view.when\(:user_edited\)/i, err.message) + + end + + it "provides convenient event-subscription trap syntax for MVP testing" do + mox = create_mocks :model, :view + + data_change = @model.trap.when(:data_changes) + user_edit = @view.trap.when(:user_edited) + + UserPresenter.new mox + + # Expect user name transfer from model to view + @model.expects.user_name.returns 'Da Croz' + @view.expects.user_name = 'Da Croz' + # Trigger data change event in model + data_change.trigger + + # Expect user name transfer from view to model + @view.expects.user_name.returns '6:8' + @model.expects.user_name = '6:8' + # Trigger edit event in view + user_edit.trigger + + verify_mocks + end + + it "raises if you try to pass an expectation block to 'trap'" do + create_mock :model + assert_error Hardmock::ExpectationError, /blocks/i, /trap/i do + @model.trap.when(:some_event) do raise "huh?" end + end + end + + class Grinder + def initialize(objects) + @chute = objects[:chute] + @bucket = objects[:bucket] + @blade = objects[:blade] + end + + def grind(slot) + @chute.each_bean(slot) do |bean| + @bucket << @blade.chop(bean) + end + end + end + + it "lets you write clear iteration-oriented expectations" do + grinder = Grinder.new create_mocks(:blade, :chute, :bucket) + + # Style 1: assertions on method args is done explicitly in block + @chute.expects.each_bean { |slot,block| + assert_equal :side_slot, slot, "Wrong slot" + block.call :bean1 + block.call :bean2 + } + + @blade.expects.chop(:bean1).returns(:grounds1) + @bucket.expects('<<', :grounds1) + + @blade.expects.chop(:bean2).returns(:grounds2) + @bucket.expects('<<', :grounds2) + + # Run "the code" + grinder.grind(:side_slot) + + verify_mocks + + # Style 2: assertions on method arguments done implicitly in the expectation code + @chute.expects.each_bean(:main_slot) { |slot,block| + block.call :bean3 + } + @blade.expects.chop(:bean3).returns(:grounds3) + @bucket.expects('<<', :grounds3) + grinder.grind :main_slot + verify_mocks + end + + it "further supports iteration testing using 'yield'" do + grinder = Grinder.new create_mocks(:blade, :chute, :bucket) + + @chute.expects.each_bean(:side_slot).yields :bean1, :bean2 + + @blade.expects.chop(:bean1).returns(:grounds1) + @bucket.expects('<<', :grounds1) + + @blade.expects.chop(:bean2).returns(:grounds2) + @bucket.expects('<<', :grounds2) + + grinder.grind :side_slot + + verify_mocks + end + + class HurtLocker + attr_reader :caught + def initialize(opts) + @locker = opts[:locker] + @store = opts[:store] + end + + def do_the_thing(area,data) + @locker.with_lock(area) do + @store.eat(data) + end + rescue => oops + @caught = oops + end + end + + it "makes mutex-style locking scenarios easy to test" do + hurt = HurtLocker.new create_mocks(:locker, :store) + + @locker.expects.with_lock(:main).yields + @store.expects.eat("some info") + + hurt.do_the_thing(:main, "some info") + + verify_mocks + end + + it "makes it easy to simulate error in mutex-style locking scenarios" do + hurt = HurtLocker.new create_mocks(:locker, :store) + err = StandardError.new('fmshooop') + @locker.expects.with_lock(:main).yields + @store.expects.eat("some info").raises(err) + + hurt.do_the_thing(:main, "some info") + + assert_same err, hurt.caught, "Expected that error to be handled internally" + verify_mocks + end + + it "actually returns 'false' instead of nil when mocking boolean return values" do + create_mock :car + @car.expects.ignition_on?.returns(true) + assert_equal true, @car.ignition_on?, "Should be true" + @car.expects.ignition_on?.returns(false) + assert_equal false, @car.ignition_on?, "Should be false" + end + + it "can mock most methods inherited from object using literal syntax" do + target_methods = %w|id clone display dup eql? ==| + create_mock :foo + target_methods.each do |m| + eval %{@foo.expects(m, "some stuff")} + eval %{@foo.#{m} "some stuff"} + end + end + + it "provides 'expect' as an alias for 'expects'" do + create_mock :foo + @foo.expect.boomboom + @foo.boomboom + verify_mocks + end + + it "provides 'should_receive' as an alias for 'expects'" do + create_mock :foo + @foo.should_receive.boomboom + @foo.boomboom + verify_mocks + end + + it "provides 'and_return' as an alias for 'returns'" do + create_mock :foo + @foo.expects(:boomboom).and_return :brick + assert_equal :brick, @foo.boomboom + verify_mocks + end + + it "does not interfere with a core subset of Object methods" do + create_mock :foo + @foo.method(:inspect) + @foo.inspect + @foo.to_s + @foo.instance_variables + @foo.instance_eval("") + verify_mocks + end + + it "can raise errors from within an expectation block" do + create_mock :cat + @cat.expects.meow do |arg| + assert_equal "mix", arg + raise 'HAIRBALL' + end + assert_error RuntimeError, 'HAIRBALL' do + @cat.meow("mix") + end + end + + it "can raise errors AFTER an expectation block" do + create_mock :cat + @cat.expects.meow do |arg| + assert_equal "mix", arg + end.raises('HAIRBALL') + assert_error RuntimeError, 'HAIRBALL' do + @cat.meow("mix") + end + end + + it "raises an immediate error if a mock is created with a nil name (common mistake: create_mock @cat)" do + # I make this mistake all the time: Typing in an instance var name instead of a symbol in create_mocks. + # When you do that, you're effectively passing nil(s) in as mock names. + assert_error ArgumentError, /'nil' is not a valid name for a mock/ do + create_mocks @apples, @oranges + end + end + + it "overrides 'inspect' to make nice output" do + create_mock :hay_bailer + assert_equal "", @hay_bailer.inspect, "Wrong output from 'inspect'" + end + + it "raises if prepare_hardmock_control is invoked after create_mocks, or more than once" do + create_mock :hi_there + create_mocks :another, :one + assert_error RuntimeError, /already setup/ do + prepare_hardmock_control + end + end + + should "support alias verify_hardmocks" do + create_mock :tree + @tree.expects(:grow) + assert_error VerifyError, /unmet/i do + verify_hardmocks + end + end + + # + # HELPERS + # + + def assert_mock_exists(name) + assert_not_nil @all_mocks, "@all_mocks not here yet" + mo = @all_mocks[name] + assert_not_nil mo, "Mock '#{name}' not in @all_mocks" + assert_kind_of Mock, mo, "Wrong type of object, wanted a Mock" + assert_equal name.to_s, mo._name, "Mock '#{name}' had wrong name" + ivar = self.instance_variable_get("@#{name}") + assert_not_nil ivar, "Mock '#{name}' not set as ivar" + assert_same mo, ivar, "Mock '#{name}' ivar not same as instance in @all_mocks" + assert_same @main_mock_control, mo._control, "Mock '#{name}' doesn't share the main mock control" + end +end + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/stubbing_test.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/stubbing_test.rb new file mode 100644 index 0000000..f07a670 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/test/functional/stubbing_test.rb @@ -0,0 +1,479 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock' +require 'assert_error' + +class StubbingTest < Test::Unit::TestCase + + # + # TESTS + # + + it "stubs a class method (and un-stubs after reset_stubs)" do + assert_equal "stones and gravel", Concrete.pour + assert_equal "glug glug", Jug.pour + + Concrete.stubs!(:pour).returns("dust and plaster") + + 3.times do + assert_equal "dust and plaster", Concrete.pour + end + + assert_equal "glug glug", Jug.pour, "Jug's 'pour' method broken" + assert_equal "stones and gravel", Concrete._hardmock_original_pour, "Original 'pour' method not aliased" + + assert_equal "For roads", Concrete.describe, "'describe' method broken" + + reset_stubs + + assert_equal "stones and gravel", Concrete.pour, "'pour' method not restored" + assert_equal "For roads", Concrete.describe, "'describe' method broken after verify" + + end + + it "stubs several class methods" do + Concrete.stubs!(:pour).returns("sludge") + Concrete.stubs!(:describe).returns("awful") + Jug.stubs!(:pour).returns("milk") + + assert_equal "sludge", Concrete.pour + assert_equal "awful", Concrete.describe + assert_equal "milk", Jug.pour + + reset_stubs + + assert_equal "stones and gravel", Concrete.pour + assert_equal "For roads", Concrete.describe + assert_equal "glug glug", Jug.pour + end + + it "stubs instance methods" do + slab = Concrete.new + assert_equal "bonk", slab.hit + + slab.stubs!(:hit).returns("slap") + assert_equal "slap", slab.hit, "'hit' not stubbed" + + reset_stubs + + assert_equal "bonk", slab.hit, "'hit' not restored" + end + + it "stubs instance methods without breaking class methods or other instances" do + slab = Concrete.new + scrape = Concrete.new + assert_equal "an instance", slab.describe + assert_equal "an instance", scrape.describe + assert_equal "For roads", Concrete.describe + + slab.stubs!(:describe).returns("new instance describe") + assert_equal "new instance describe", slab.describe, "'describe' on instance not stubbed" + assert_equal "an instance", scrape.describe, "'describe' on 'scrape' instance broken" + assert_equal "For roads", Concrete.describe, "'describe' class method broken" + + reset_stubs + + assert_equal "an instance", slab.describe, "'describe' instance method not restored" + assert_equal "an instance", scrape.describe, "'describe' on 'scrape' instance broken after restore" + assert_equal "For roads", Concrete.describe, "'describe' class method broken after restore" + end + + should "allow stubbing of nonexistant class methods" do + Concrete.stubs!(:funky).returns('juice') + assert_equal 'juice', Concrete.funky + end + + should "allow stubbing of nonexistant instance methods" do + chunk = Concrete.new + chunk.stubs!(:shark).returns('bite') + assert_equal 'bite', chunk.shark + end + + should "allow re-stubbing" do + Concrete.stubs!(:pour).returns("one") + assert_equal "one", Concrete.pour + + Concrete.stubs!(:pour).raises("hell") + assert_error RuntimeError, /hell/ do + Concrete.pour + end + + Concrete.stubs!(:pour).returns("two") + assert_equal "two", Concrete.pour + + reset_stubs + + assert_equal "stones and gravel", Concrete.pour + end + + it "does nothing with a runtime block when simply stubbing" do + slab = Concrete.new + slab.stubs!(:hit) do |nothing| + raise "BOOOMM!" + end + slab.hit + reset_stubs + end + + it "can raise errors from a stubbed method" do + Concrete.stubs!(:pour).raises(StandardError.new("no!")) + assert_error StandardError, /no!/ do + Concrete.pour + end + end + + it "provides string syntax for convenient raising of RuntimeErrors" do + Concrete.stubs!(:pour).raises("never!") + assert_error RuntimeError, /never!/ do + Concrete.pour + end + end + + + # + # Per-method mocking on classes or instances + # + + it "mocks specific methods on existing classes, and returns the class method to normal after verification" do + + assert_equal "stones and gravel", Concrete.pour, "Concrete.pour is already messed up" + + Concrete.expects!(:pour).returns("ALIGATORS") + assert_equal "ALIGATORS", Concrete.pour + + verify_mocks + assert_equal "stones and gravel", Concrete.pour, "Concrete.pour not restored" + end + + it "flunks if expected class method is not invoked" do + + Concrete.expects!(:pour).returns("ALIGATORS") + assert_error(Hardmock::VerifyError, /Concrete.pour/, /unmet expectations/i) do + verify_mocks + end + clear_expectations + end + + it "supports all normal mock functionality for class methods" do + + Concrete.expects!(:pour, "two tons").returns("mice") + Concrete.expects!(:pour, "three tons").returns("cats") + Concrete.expects!(:pour, "four tons").raises("Can't do it") + Concrete.expects!(:pour) do |some, args| + "==#{some}+#{args}==" + end + + assert_equal "mice", Concrete.pour("two tons") + assert_equal "cats", Concrete.pour("three tons") + assert_error(RuntimeError, /Can't do it/) do + Concrete.pour("four tons") + end + assert_equal "==first+second==", Concrete.pour("first","second") + end + + + it "enforces inter-mock ordering when mocking class methods" do + create_mocks :truck, :foreman + + @truck.expects.backup + Concrete.expects!(:pour, "something") + @foreman.expects.shout + + @truck.backup + assert_error Hardmock::ExpectationError, /wrong/i, /expected call/i, /Concrete.pour/ do + @foreman.shout + end + assert_error Hardmock::VerifyError, /unmet expectations/i, /foreman.shout/ do + verify_mocks + end + clear_expectations + end + + should "allow mocking non-existant class methods" do + Concrete.expects!(:something).returns("else") + assert_equal "else", Concrete.something + end + + it "mocks specific methods on existing instances, then restore them after verify" do + + slab = Concrete.new + assert_equal "bonk", slab.hit + + slab.expects!(:hit).returns("slap") + assert_equal "slap", slab.hit, "'hit' not stubbed" + + verify_mocks + assert_equal "bonk", slab.hit, "'hit' not restored" + end + + it "flunks if expected instance method is not invoked" do + + slab = Concrete.new + slab.expects!(:hit) + + assert_error Hardmock::VerifyError, /unmet expectations/i, /Concrete.hit/ do + verify_mocks + end + clear_expectations + end + + it "supports all normal mock functionality for instance methods" do + + slab = Concrete.new + + slab.expects!(:hit, "soft").returns("hey") + slab.expects!(:hit, "hard").returns("OOF") + slab.expects!(:hit).raises("stoppit") + slab.expects!(:hit) do |some, args| + "==#{some}+#{args}==" + end + + assert_equal "hey", slab.hit("soft") + assert_equal "OOF", slab.hit("hard") + assert_error(RuntimeError, /stoppit/) do + slab.hit + end + assert_equal "==first+second==", slab.hit("first","second") + + end + + it "enforces inter-mock ordering when mocking instance methods" do + create_mocks :truck, :foreman + slab1 = Concrete.new + slab2 = Concrete.new + + @truck.expects.backup + slab1.expects!(:hit) + @foreman.expects.shout + slab2.expects!(:hit) + @foreman.expects.whatever + + @truck.backup + slab1.hit + @foreman.shout + assert_error Hardmock::ExpectationError, /wrong/i, /expected call/i, /Concrete.hit/ do + @foreman.whatever + end + assert_error Hardmock::VerifyError, /unmet expectations/i, /foreman.whatever/ do + verify_mocks + end + clear_expectations + end + + should "allow mocking non-existant instance methods" do + slab = Concrete.new + slab.expects!(:wholly).returns('happy') + assert_equal 'happy', slab.wholly + end + + should "support concrete expectations that deal with runtime blocks" do + + Concrete.expects!(:pour, "a lot") do |how_much, block| + assert_equal "a lot", how_much, "Wrong how_much arg" + assert_not_nil block, "nil runtime block" + assert_equal "the block value", block.call, "Wrong runtime block value" + end + + Concrete.pour("a lot") do + "the block value" + end + + end + + it "can stub methods on mock objects" do + create_mock :horse + @horse.stubs!(:speak).returns("silence") + @horse.stubs!(:hello).returns("nothing") + @horse.expects(:canter).returns("clip clop") + + assert_equal "silence", @horse.speak + assert_equal "clip clop", @horse.canter + assert_equal "silence", @horse.speak + assert_equal "silence", @horse.speak + assert_equal "nothing", @horse.hello + assert_equal "nothing", @horse.hello + + verify_mocks + reset_stubs + end + + it "can stub the new method and return values" do + Concrete.stubs!(:new).returns("this value") + assert_equal "this value", Concrete.new, "did not properly stub new class method" + reset_stubs + end + + it "can mock the new method and return values" do + Concrete.expects!(:new).with("foo").returns("hello") + Concrete.expects!(:new).with("bar").returns("world") + + assert_equal "hello", Concrete.new("foo"), "did not properly mock out new class method" + assert_equal "world", Concrete.new("bar"), "did not properly mock out new class method" + + verify_mocks + reset_stubs + end + + it "can mock several different class methods at once" do + sim_code = lambda do |input| + record = Multitool.find_record(input) + report = Multitool.generate_report(record) + Multitool.format_output(report) + end + + @identifier = "the id" + @record = "the record" + @report = "the report" + @output = "the output" + + Multitool.expects!(:find_record).with(@identifier).returns(@record) + Multitool.expects!(:generate_report).with(@record).returns(@report) + Multitool.expects!(:format_output).with(@report).returns(@output) + + result = sim_code.call(@identifier) + assert_equal @output, result, "Wrong output" + end + + it "can handle a mix of different and repeat class method mock calls" do + prep = lambda { + Multitool.expects!(:find_record).with("A").returns("1") + Multitool.expects!(:generate_report).with("1") + Multitool.expects!(:find_record).with("B").returns("2") + Multitool.expects!(:generate_report).with("2") + } + + prep[] + Multitool.generate_report(Multitool.find_record("A")) + Multitool.generate_report(Multitool.find_record("B")) + + prep[] + Multitool.generate_report(Multitool.find_record("A")) + assert_error Hardmock::ExpectationError, /Wrong arguments/, /find_record\("B"\)/, /find_record\("C"\)/ do + Multitool.generate_report(Multitool.find_record("C")) + end + clear_expectations + end + + it "can mock several concrete instance methods at once" do + inst = OtherMultitool.new + sim_code = lambda do |input| + record = inst.find_record(input) + report = inst.generate_report(record) + inst.format_output(report) + end + + @identifier = "the id" + @record = "the record" + @report = "the report" + @output = "the output" + + inst.expects!(:find_record).with(@identifier).returns(@record) + inst.expects!(:generate_report).with(@record).returns(@report) + inst.expects!(:format_output).with(@report).returns(@output) + + result = sim_code.call(@identifier) + assert_equal @output, result, "Wrong output" + end + + it "verifies all concrete expects! from several different expectations" do + Multitool.expects!(:find_record) + Multitool.expects!(:generate_report) + Multitool.expects!(:format_output) + + Multitool.find_record + Multitool.generate_report + + assert_error Hardmock::VerifyError, /unmet expectations/i, /format_output/i do + verify_mocks + end + end + + it "will not allow expects! to be used on a mock object" do + create_mock :cow + assert_error Hardmock::StubbingError, /expects!/, /mock/i, /something/ do + @cow.expects!(:something) + end + end + + it "does not allow stubbing on nil objects" do + [ nil, @this_is_nil ].each do |nil_obj| + assert_error Hardmock::StubbingError, /cannot/i, /nil/i, /intentionally/ do + nil_obj.stubs!(:wont_work) + end + end + end + + it "does not allow concrete method mocking on nil objects" do + [ nil, @this_is_nil ].each do |nil_obj| + assert_error Hardmock::StubbingError, /cannot/i, /nil/i, /intentionally/ do + nil_obj.expects!(:wont_work) + end + end + end + + it "provides an alternate method for stubbing on nil objects" do + @this_is_nil.intentionally_stubs!(:bogus).returns('output') + assert_equal 'output', @this_is_nil.bogus + end + + it "provides an alternate method for mocking concreate methods on nil objects" do + @this_is_nil.intentionally_expects!(:bogus).returns('output') + assert_error Hardmock::VerifyError, /unmet expectations/i, /NilClass.bogus/ do + verify_mocks + end + end + + # + # HELPERS + # + + class Concrete + def initialize; end + def self.pour + "stones and gravel" + end + + def self.describe + "For roads" + end + + def hit + "bonk" + end + + def describe + "an instance" + end + end + + class Jug + def self.pour + "glug glug" + end + end + + class Multitool + def self.find_record(*a) + raise "The real Multitool.find_record was called with #{a.inspect}" + end + def self.generate_report(*a) + raise "The real Multitool.generate_report was called with #{a.inspect}" + end + def self.format_output(*a) + raise "The real Multitool.format_output was called with #{a.inspect}" + end + end + + class OtherMultitool + def find_record(*a) + raise "The real OtherMultitool#find_record was called with #{a.inspect}" + end + def generate_report(*a) + raise "The real OtherMultitool#generate_report was called with #{a.inspect}" + end + def format_output(*a) + raise "The real OtherMultitool#format_output was called with #{a.inspect}" + end + end + +end + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/test/test_helper.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/test/test_helper.rb new file mode 100644 index 0000000..af159a4 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/test/test_helper.rb @@ -0,0 +1,43 @@ +here = File.expand_path(File.dirname(__FILE__)) +$: << here + +require "#{here}/../config/environment" +require 'test/unit' +require 'fileutils' +require 'logger' +require 'find' +require 'yaml' +require 'set' +require 'ostruct' + +class Test::Unit::TestCase + include FileUtils + + def poll(time_limit) + (time_limit * 10).to_i.times do + return true if yield + sleep 0.1 + end + return false + end + + def self.it(str, &block) + make_test_case "it", str, &block + end + + def self.should(str, &block) + make_test_case "should", str, &block + end + + def self.make_test_case(prefix, str, &block) + tname = self.name.sub(/Test$/,'') + if block + define_method "test #{prefix} #{str}" do + instance_eval &block + end + else + puts ">>> UNIMPLEMENTED CASE: #{tname}: #{str}" + end + end + +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/expectation_builder_test.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/expectation_builder_test.rb new file mode 100644 index 0000000..f689f98 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/expectation_builder_test.rb @@ -0,0 +1,19 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/expectation_builder' + +class ExpectationBuilderTest < Test::Unit::TestCase + include Hardmock + + def test_build_expectation + builder = ExpectationBuilder.new + + ex = builder.build_expectation( :stuff => 'inside' ) + assert_not_nil ex, "Didn't build an expectation" + assert_kind_of Expectation, ex, "Wrong type!" + + # Shhhh... fragile, yes, whatever. The functional tests do the + # real testing of this anyway + assert_equal({:stuff => 'inside'}, ex.instance_variable_get('@options'), "Hash not sent to SimpleExpectation constructor") + end + +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/expectation_test.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/expectation_test.rb new file mode 100644 index 0000000..54bd204 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/expectation_test.rb @@ -0,0 +1,372 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/expectation' +require 'hardmock/errors' +require 'assert_error' + +class ExpectationTest < Test::Unit::TestCase + include Hardmock + + def setup + @mock = TheMock.new + end + # + # HELPERS + # + + class TheMock + def _name; 'the_mock'; end + end + class OtherMock + def _name; 'other_mock'; end + end + + # + # TESTS + # + + def test_to_s + ex = Expectation.new( :mock => @mock, :method => 'a_func', :arguments => [1, "two", :three, { :four => 4 }] ) + assert_equal %|the_mock.a_func(1, "two", :three, {:four=>4})|, ex.to_s + end + + def test_apply_method_call + se = Expectation.new(:mock => @mock, :method => 'some_func', + :arguments => [1,'two',:three] ) + + # Try it good: + assert_nothing_raised ExpectationError do + se.apply_method_call( @mock, 'some_func', [1,'two',:three], nil ) + end + + # Bad func name: + err = assert_raise ExpectationError do + se.apply_method_call( @mock, 'wrong_func', [1,'two',:three], nil ) + end + assert_match(/wrong method/i, err.message) + assert_match(/wrong_func/i, err.message) + assert_match(/[1, "two", :three]/i, err.message) + assert_match(/some_func/i, err.message) + assert_match(/the_mock/i, err.message) + + # Wrong mock + err = assert_raise ExpectationError do + se.apply_method_call( OtherMock.new, 'some_func', [1,'two',:three], nil ) + end + assert_match(/[1, "two", :three]/i, err.message) + assert_match(/some_func/i, err.message) + assert_match(/the_mock/i, err.message) + assert_match(/other_mock/i, err.message) + + # Wrong args + err = assert_raise ExpectationError do + se.apply_method_call( @mock, 'some_func', [1,'two',:four], nil) + end + assert_match(/[1, "two", :three]/i, err.message) + assert_match(/[1, "two", :four]/i, err.message) + assert_match(/wrong arguments/i, err.message) + assert_match(/some_func/i, err.message) + end + + def test_apply_method_call_should_call_proc_when_given + # now with a proc + thinger = nil + the_proc = Proc.new { thinger = :shaq } + se = Expectation.new(:mock => @mock, :method => 'some_func', + :block => the_proc) + + # Try it good: + assert_nil thinger + assert_nothing_raised ExpectationError do + se.apply_method_call(@mock, 'some_func', [], nil) + end + assert_equal :shaq, thinger, 'wheres shaq??' + end + + def test_apply_method_call_passes_runtime_block_as_last_argument_to_expectation_block + + passed_block = nil + exp_block_called = false + exp_block = Proc.new { |blk| + exp_block_called = true + passed_block = blk + } + + se = Expectation.new(:mock => @mock, :method => 'some_func', :block => exp_block, + :arguments => []) + + set_flag = false + runtime_block = Proc.new { set_flag = true } + + assert_nil passed_block, "Passed block should be nil" + assert !set_flag, "set_flag should be off" + + # Go + se.apply_method_call( @mock, 'some_func', [], runtime_block) + + # Examine the passed block + assert exp_block_called, "Expectation block not called" + assert_not_nil passed_block, "Should have been passed a block" + assert !set_flag, "set_flag should still be off" + passed_block.call + assert set_flag, "set_flag should be on" + end + + def test_apply_method_call_fails_when_theres_no_expectation_block_to_handle_the_runtime_block + se = Expectation.new(:mock => @mock, :method => 'some_func', :arguments => []) + runtime_block = Proc.new { set_flag = true } + err = assert_raise ExpectationError do + se.apply_method_call( @mock, 'some_func', [], runtime_block) + end + assert_match(/unexpected block/i, err.message) + assert_match(/the_mock.some_func()/i, err.message) + end + + def test_returns + se = Expectation.new(:mock => @mock, :method => 'some_func', + :arguments => [1,'two',:three]) + + se.returns "A value" + + assert_equal "A value", se.apply_method_call(@mock, 'some_func', [1,'two',:three], nil) + end + + def test_apply_method_call_captures_block_value + the_proc = lambda { "in the block" } + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => [], :block => the_proc) + + assert_nil se.block_value, "Block value starts out nil" + + se.apply_method_call(@mock, 'do_it', [], nil) + + assert_equal "in the block", se.block_value, "Block value not captured" + end + + def test_trigger + # convenience method for block_value.call + target = false + inner_proc = lambda { target = true } + the_proc = lambda { inner_proc } + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => [], :block => the_proc) + + assert_nil se.block_value, "Block value starts out nil" + se.apply_method_call(@mock, 'do_it', [], nil) + assert_not_nil se.block_value, "Block value not set" + + assert !target, "Target should still be false" + se.trigger + assert target, "Target not true!" + end + + def test_trigger_with_arguments + # convenience method for block_value.call + target = nil + inner_proc = lambda { |one,two| target = [one,two] } + the_proc = lambda { inner_proc } + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => [], :block => the_proc) + + assert_nil se.block_value, "Block value starts out nil" + se.apply_method_call(@mock, 'do_it', [], nil) + assert_not_nil se.block_value, "Block value not set" + + assert_nil target, "target should still be nil" + se.trigger 'cat','dog' + assert_equal ['cat','dog'], target + end + + def test_trigger_nil_block_value + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => []) + + assert_nil se.block_value, "Block value starts out nil" + se.apply_method_call(@mock, 'do_it', [], nil) + assert_nil se.block_value, "Block value should still be nil" + + err = assert_raise ExpectationError do + se.trigger + end + assert_match(/do_it/i, err.message) + assert_match(/block value/i, err.message) + end + + def test_trigger_non_proc_block_value + the_block = lambda { "woops" } + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => [], :block => the_block) + + se.apply_method_call(@mock, 'do_it', [], nil) + assert_equal "woops", se.block_value + + err = assert_raise ExpectationError do + se.trigger + end + assert_match(/do_it/i, err.message) + assert_match(/trigger/i, err.message) + assert_match(/woops/i, err.message) + end + + + + def test_proc_used_for_return + the_proc = lambda { "in the block" } + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => [], :block => the_proc) + + assert_equal "in the block", se.apply_method_call(@mock, 'do_it', [], nil) + assert_equal "in the block", se.block_value, "Captured block value affected wrongly" + end + + def test_explicit_return_overrides_proc_return + the_proc = lambda { "in the block" } + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => [], :block => the_proc) + se.returns "the override" + assert_equal "the override", se.apply_method_call(@mock, 'do_it', [], nil) + assert_equal "in the block", se.block_value, "Captured block value affected wrongly" + end + + def test_yields + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] ) + se.yields :bean1, :bean2 + + things = [] + a_block = lambda { |thinger| things << thinger } + + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + assert_equal [:bean1,:bean2], things, "Wrong things" + end + + def test_yields_block_takes_no_arguments + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] ) + se.yields + + things = [] + a_block = lambda { things << 'OOF' } + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + assert_equal ['OOF'], things + end + + def test_yields_params_to_block_takes_no_arguments + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] ) + se.yields :wont_fit + + things = [] + a_block = lambda { things << 'WUP' } + + err = assert_raise ExpectationError do + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + end + assert_match(/wont_fit/i, err.message) + assert_match(/arity -1/i, err.message) + assert_equal [], things, "Wrong things" + end + + def test_yields_with_returns + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] , + :returns => 'the results') + + exp = se.yields :bean1, :bean2 + assert_same se, exp, "'yields' needs to return a reference to the expectation" + things = [] + a_block = lambda { |thinger| things << thinger } + returned = se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + assert_equal [:bean1,:bean2], things, "Wrong things" + assert_equal 'the results', returned, "Wrong return value" + end + + def test_yields_with_raises + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot], + :raises => RuntimeError.new("kerboom")) + + exp = se.yields :bean1, :bean2 + assert_same se, exp, "'yields' needs to return a reference to the expectation" + things = [] + a_block = lambda { |thinger| things << thinger } + err = assert_raise RuntimeError do + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + end + assert_match(/kerboom/i, err.message) + assert_equal [:bean1,:bean2], things, "Wrong things" + end + + def test_yields_and_inner_block_explodes + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot]) + + exp = se.yields :bean1, :bean2 + assert_same se, exp, "'yields' needs to return a reference to the expectation" + things = [] + a_block = lambda { |thinger| + things << thinger + raise "nasty" + } + err = assert_raise RuntimeError do + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + end + assert_match(/nasty/i, err.message) + assert_equal [:bean1], things, "Wrong things" + end + + def test_yields_with_several_arrays + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] ) + se.yields ['a','b'], ['c','d'] + + things = [] + a_block = lambda { |thinger| things << thinger } + + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + assert_equal [ ['a','b'], ['c','d'] ], things, "Wrong things" + end + + def test_yields_tuples + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] ) + se.yields ['a','b','c'], ['d','e','f'] + + things = [] + a_block = lambda { |left,mid,right| + things << { :left => left, :mid => mid, :right => right } + } + + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + assert_equal [ + {:left => 'a', :mid => 'b', :right => 'c' }, + {:left => 'd', :mid => 'e', :right => 'f' }, + ], things, "Wrong things" + end + + def test_yields_tuples_size_mismatch + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] ) + se.yields ['a','b','c'], ['d','e','f'] + + things = [] + a_block = lambda { |left,mid| + things << { :left => left, :mid => mid } + } + + err = assert_raise ExpectationError do + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + end + assert_match(/arity/i, err.message) + assert_match(/the_mock.each_bean/i, err.message) + assert_match(/"a", "b", "c"/i, err.message) + assert_equal [], things, "Wrong things" + end + + def test_yields_bad_block_arity + se = Expectation.new(:mock => @mock, :method => 'do_later', :arguments => [] ) + se.yields + + assert_error Hardmock::ExpectationError, /block/i, /expected/i, /no param/i, /got 2/i do + se.apply_method_call(@mock,'do_later',[],lambda { |doesnt,match| raise "Surprise!" } ) + end + end + + def test_that_arguments_can_be_added_to_expectation + expectation = Expectation.new(:mock => @mock, :method => "each_bean") + assert_same expectation, expectation.with("jello", "for", "cosby"), "should have returned the same expectation" + + err = assert_raise ExpectationError do + expectation.apply_method_call(@mock, 'each_bean', [], nil) + end + assert_match(/wrong arguments/i, err.message) + + assert_nothing_raised(ExpectationError) do + expectation.apply_method_call(@mock, 'each_bean', ["jello", "for", "cosby"], nil) + end + end + +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/expector_test.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/expector_test.rb new file mode 100644 index 0000000..f420db2 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/expector_test.rb @@ -0,0 +1,57 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/expector' + +class ExpectorTest < Test::Unit::TestCase + include Hardmock + + class MyControl + attr_reader :added + def add_expectation(expectation) + @added ||= [] + @added << expectation + end + end + + class ExpBuilder + attr_reader :options + def build_expectation(options) + @options = options + "dummy expectation" + end + end + + def try_it_with(method_name) + mock = Object.new + mock_control = MyControl.new + builder = ExpBuilder.new + + exp = Expector.new(mock, mock_control, builder) + output = exp.send(method_name,:with, 1, 'sauce') + + assert_same mock, builder.options[:mock] + assert_equal method_name, builder.options[:method].to_s + assert_equal [:with,1,'sauce'], builder.options[:arguments] + assert_nil builder.options[:block] + assert_equal [ "dummy expectation" ], mock_control.added, + "Wrong expectation added to control" + + assert_equal "dummy expectation", output, "Expectation should have been returned" + end + + # + # TESTS + # + def test_method_missing + try_it_with 'wonder_bread' + try_it_with 'whatever' + end + + def test_methods_that_wont_trigger_method_missing + mock = Object.new + mock_control = MyControl.new + builder = ExpBuilder.new + + exp = Expector.new(mock, mock_control, builder) + assert_equal mock, exp.instance_eval("@mock") + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/method_cleanout_test.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/method_cleanout_test.rb new file mode 100644 index 0000000..7aa6293 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/method_cleanout_test.rb @@ -0,0 +1,36 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/method_cleanout' + +class MethodCleanoutTest < Test::Unit::TestCase + class Victim + OriginalMethods = instance_methods + include Hardmock::MethodCleanout + end + + def setup + @victim = Victim.new + end + + def test_should_remove_most_methods_from_a_class + expect_removed = Victim::OriginalMethods.reject { |m| + Hardmock::MethodCleanout::SACRED_METHODS.include?(m) + } + expect_removed.each do |m| + assert !@victim.respond_to?(m), "should not have method #{m}" + end + end + + def test_should_leave_the_sacred_methods_defined + Hardmock::MethodCleanout::SACRED_METHODS.each do |m| + next if m =~ /^hm_/ + assert @victim.respond_to?(m), "Sacred method '#{m}' was removed unexpectedly" + end + end + + def test_should_include_certain_important_methods_in_the_sacred_methods_list + %w|__id__ __send__ equal? object_id send nil? class kind_of? respond_to? inspect method to_s instance_variables instance_eval|.each do |m| + assert Hardmock::MethodCleanout::SACRED_METHODS.include?(m), "important method #{m} is not included in SACRED_METHODS" + end + end + +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/mock_control_test.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/mock_control_test.rb new file mode 100644 index 0000000..3c52db6 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/mock_control_test.rb @@ -0,0 +1,175 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/utils' +require 'hardmock/errors' +require 'hardmock/mock_control' + +class MockControlTest < Test::Unit::TestCase + include Hardmock + + def setup + @unmock = OpenStruct.new( :_name => 'fakemock' ) + + @control = MockControl.new + assert @control.happy?, "Control should start out happy" + end + + def teardown + end + + # + # HELPERS + # + + class MyExp + attr_reader :mock, :mname, :args, :block + def apply_method_call(mock, mname, args, block) + @mock = mock + @mname = mname + @args = args + @block = block + end + end + + class BoomExp < MyExp + def apply_method_call(mock, mname, args, block) + super + raise "BOOM" + end + end + + # + # TESTS + # + + def test_add_exepectation_and_apply_method_call + e1 = MyExp.new + + @control.add_expectation e1 + assert !@control.happy? + + @control.apply_method_call @unmock, 'some_func', [ 'the', :args ], nil + assert @control.happy? + + assert_same @unmock, e1.mock, "Wrong mock" + assert_equal 'some_func', e1.mname, "Wrong method" + assert_equal [ 'the', :args ], e1.args, "Wrong args" + + @control.verify + end + + def test_add_exepectation_and_apply_method_call_with_block + e1 = MyExp.new + + @control.add_expectation e1 + assert !@control.happy? + + runtime_block = Proc.new { "hello" } + @control.apply_method_call @unmock, 'some_func', [ 'the', :args ], runtime_block + assert @control.happy? + + assert_same @unmock, e1.mock, "Wrong mock" + assert_equal 'some_func', e1.mname, "Wrong method" + assert_equal [ 'the', :args ], e1.args, "Wrong args" + assert_equal "hello", e1.block.call, "Wrong block in expectation" + + @control.verify + end + + def test_add_expectation_then_verify + e1 = MyExp.new + + @control.add_expectation e1 + assert !@control.happy?, "Shoudn't be happy" + err = assert_raise VerifyError do + @control.verify + end + assert_match(/unmet expectations/i, err.message) + + @control.apply_method_call @unmock, 'some_func', [ 'the', :args ], nil + assert @control.happy? + + assert_same @unmock, e1.mock, "Wrong mock" + assert_equal 'some_func', e1.mname, "Wrong method" + assert_equal [ 'the', :args ], e1.args, "Wrong args" + + @control.verify + end + + def test_expectation_explosion + be1 = BoomExp.new + + @control.add_expectation be1 + + err = assert_raise RuntimeError do + @control.apply_method_call @unmock, 'a func', [:arg], nil + end + assert_match(/BOOM/i, err.message) + + assert_same @unmock, be1.mock + assert_equal 'a func', be1.mname + assert_equal [:arg], be1.args + end + + def test_disappointment_on_bad_verify + @control.add_expectation MyExp.new + assert !@control.happy?, "Shouldn't be happy" + assert !@control.disappointed?, "too early to be disappointed" + + # See verify fails + err = assert_raise VerifyError do + @control.verify + end + assert_match(/unmet expectations/i, err.message) + + assert !@control.happy?, "Still have unmet expectation" + assert @control.disappointed?, "We should be disappointed following that failure" + + @control.apply_method_call @unmock, 'something', [], nil + assert @control.happy?, "Should be happy" + assert @control.disappointed?, "We should be skeptical" + + @control.verify + + assert !@control.disappointed?, "Should be non-disappointed" + end + + def test_disappointment_from_surprise_calls + assert @control.happy?, "Should be happy" + assert !@control.disappointed?, "too early to be disappointed" + + # See verify fails + err = assert_raise ExpectationError do + @control.apply_method_call @unmock, "something", [], nil + end + assert_match(/surprise/i, err.message) + + assert @control.happy?, "Happiness is an empty list of expectations" + assert @control.disappointed?, "We should be disappointed following that failure" + + @control.verify + assert !@control.disappointed?, "Disappointment should be gone" + end + + def test_disappointment_from_bad_calls + be1 = BoomExp.new + assert !@control.disappointed?, "Shouldn't be disappointed" + @control.add_expectation be1 + assert !@control.disappointed?, "Shouldn't be disappointed" + + err = assert_raise RuntimeError do + @control.apply_method_call @unmock, 'a func', [:arg], nil + end + assert_match(/BOOM/i, err.message) + assert @control.disappointed?, "Should be disappointed" + + assert_same @unmock, be1.mock + assert_equal 'a func', be1.mname + assert_equal [:arg], be1.args + + assert @control.happy?, "Happiness is an empty list of expectations" + @control.verify + assert !@control.disappointed?, "Disappointment should be gone" + end + + +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/mock_test.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/mock_test.rb new file mode 100644 index 0000000..2579bcc --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/mock_test.rb @@ -0,0 +1,279 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/method_cleanout' +require 'hardmock/mock' +require 'hardmock/mock_control' +require 'hardmock/expectation_builder' +require 'hardmock/expector' +require 'hardmock/trapper' + +class MockTest < Test::Unit::TestCase + include Hardmock + + def test_build_with_control + mc1 = MockControl.new + mock = Mock.new('hi', mc1) + assert_equal 'hi', mock._name, "Wrong name" + assert_same mc1, mock._control, "Wrong contol" + end + + def test_basics + mock = Mock.new('a name') + assert_equal 'a name', mock._name, "Wrong name for mock" + assert_not_nil mock._control, "Nil control in mock" + end + + def test_expects + mock = Mock.new('order') + control = mock._control + assert control.happy?, "Mock should start out satisfied" + + mock.expects.absorb_something(:location, 'garbage') + assert !control.happy?, "mock control should be unhappy" + + # Do the call + mock.absorb_something(:location, 'garbage') + assert control.happy?, "mock control should be happy again" + + # Verify + assert_nothing_raised Exception do + mock._verify + end + end + + def test_expects_using_arguments_for_method_and_arguments + mock = Mock.new('order') + mock.expects(:absorb_something, :location, 'garbage') + mock.absorb_something(:location, 'garbage') + mock._verify + end + + def test_expects_using_arguments_for_method_and_arguments_with_block + mock = Mock.new('order') + mock.expects(:absorb_something, :location, 'garbage') { |a,b,block| + assert_equal :location, a, "Wrong 'a' argument" + assert_equal 'garbage', b, "Wrong 'b' argument" + assert_equal 'innards', block.call, "Wrong block" + } + mock.absorb_something(:location, 'garbage') do "innards" end + mock._verify + end + + def test_expects_using_string_method_name + mock = Mock.new('order') + mock.expects('absorb_something', :location, 'garbage') + mock.absorb_something(:location, 'garbage') + mock._verify + end + + + def test_expects_assignment + mock = Mock.new('order') + mock.expects.account_number = 1234 + + mock.account_number = 1234 + + mock._verify + end + + def test_expects_assigment_using_arguments_for_method_and_arguments + mock = Mock.new('order') + mock.expects(:account_number=, 1234) + mock.account_number = 1234 + mock._verify + end + + def test_expects_assigment_using_string_method_name + mock = Mock.new('order') + mock.expects('account_number=', 1234) + mock.account_number = 1234 + mock._verify + end + + def test_expects_assignment_and_return_is_overruled_by_ruby_syntax + # Prove that we can set up a return but that it doesn't mean much, + # because ruby's parser will 'do the right thing' as regards semantic + # values for assignment. (That is, the rvalue of the assignment) + mock = Mock.new('order') + mock.expects(:account_number=, 1234).returns "gold" + got = mock.account_number = 1234 + mock._verify + assert_equal 1234, got, "Expected rvalue" + end + + def test_expects_assignment_and_raise + mock = Mock.new('order') + mock.expects(:account_number=, 1234).raises StandardError.new("kaboom") + err = assert_raise StandardError do + mock.account_number = 1234 + end + assert_match(/kaboom/i, err.message) + mock._verify + end + + + def test_expects_multiple + mock = Mock.new('order') + control = mock._control + + assert control.happy? + + mock.expects.one_thing :hi, { :goose => 'neck' } + mock.expects.another 5,6,7 + assert !control.happy? + + mock.one_thing :hi, { :goose => 'neck' } + assert !control.happy? + + mock.another 5,6,7 + assert control.happy? + end + + def test_surprise_call + mock = Mock.new('order') + err = assert_raise ExpectationError do + mock.uh_oh + end + assert_match(/surprise/i, err.message) + assert_match(/uh_oh/i, err.message) + + err = assert_raise ExpectationError do + mock.whoa :horse + end + assert_match(/surprise/i, err.message) + assert_match(/order\.whoa\(:horse\)/i, err.message) + end + + def test_wrong_call + mock = Mock.new('order') + mock.expects.pig 'arse' + err = assert_raise ExpectationError do + mock.whoa :horse + end + assert_match(/wrong method/i, err.message) + assert_match(/order\.whoa\(:horse\)/i, err.message) + assert_match(/order\.pig\("arse"\)/i, err.message) + end + + def test_wrong_arguments + mock = Mock.new('order') + mock.expects.go_fast(:a, 1, 'three') + + err = assert_raise ExpectationError do + mock.go_fast :a, 1, 'not right' + end + assert_match(/wrong argument/i, err.message) + assert_match(/order\.go_fast\(:a, 1, "three"\)/i, err.message) + assert_match(/order\.go_fast\(:a, 1, "not right"\)/i, err.message) + end + + def test_expects_and_return + mock = Mock.new('order') + mock.expects.delivery_date.returns Date.today + assert_equal Date.today, mock.delivery_date + mock._verify + end + + def test_expects_and_return_with_arguments + mock = Mock.new('order') + mock.expects.delivery_date(:arf,14).returns(Date.today) + assert_equal Date.today, mock.delivery_date(:arf,14) + mock._verify + end + + def test_expects_and_raise + mock = Mock.new('order') + mock.expects.delivery_date.raises StandardError.new("bloof") + + err = assert_raise StandardError do + mock.delivery_date + end + assert_match(/bloof/i, err.message) + + mock._verify + + # Try convenience argument String + mock.expects.pow.raises "hell" + err = assert_raise RuntimeError do + mock.pow + end + assert_match(/hell/i, err.message) + + mock._verify + + # Try convenience argument nothing + mock.expects.pow.raises + err = assert_raise RuntimeError do + mock.pow + end + assert_match(/an error/i, err.message) + + mock._verify + end + + def test_expects_a_runtime_block + mock = Mock.new('order') + got_val = nil + + mock.expects.when(:something) { |e,block| + got_val = block.call + } + + mock.when :something do "hi there" end + + assert_equal "hi there", got_val, "Expectation block not invoked" + mock._verify + end + + def test_trap_block + mock = Mock.new('order') + exp = mock.trap.observe + + # use it + mock.observe { "burp" } + + assert_equal "burp", exp.block_value.call + end + + def test_trap_arguments_and_block + mock = Mock.new('order') + exp = mock.trap.subscribe(:data_changed) + + # use it + mock.subscribe(:data_changed) { "burp" } + assert_equal "burp", exp.block_value.call + mock._verify + end + + def test_trap_arguments_and_block_wrong_num_args + mock = Mock.new('order') + exp = mock.trap.subscribe(:data_changed) + + assert_raise ExpectationError do + mock.subscribe(:data_changed,1) { "burp" } + end + mock._verify + end + + def test_trap_arguments_and_block_wrong_args + mock = Mock.new('order') + exp = mock.trap.subscribe(:data_changed) + + assert_raise ExpectationError do + mock.subscribe("no good") { "burp" } + end + + mock._verify + end + + def test_trap_is_not_leniant_about_arguments + mock = Mock.new('order') + exp = mock.trap.subscribe + + assert_raise ExpectationError do + mock.subscribe("no good") { "burp" } + end + + mock._verify + end + +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/test_unit_before_after_test.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/test_unit_before_after_test.rb new file mode 100644 index 0000000..172f527 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/test_unit_before_after_test.rb @@ -0,0 +1,452 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") + +class TestUnitBeforeAfter < Test::Unit::TestCase + + # + # after_teardown + # + + it "adds TestCase.after_teardown hook for appending post-teardown actions" do + write_and_run_test :use_after_teardown => true + + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "THE TEARDOWN", + "1st after_teardown", + "2nd after_teardown", + "Finished in" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 0 + end + + should "execute all after_teardowns, even if the main teardown flunks" do + write_and_run_test :use_after_teardown => true, :flunk_in_teardown => true + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "F", + "1st after_teardown", + "2nd after_teardown", + "Finished in", + "1) Failure:", + "test_something(MyExampleTest) [_test_file_temp.rb:20]:", + "FLUNK IN TEARDOWN" + see_results :tests => 1, :assertions => 1, :failures => 1, :errors => 0 + end + + should "execute all after_teardowns, even if the main teardown explodes" do + write_and_run_test :use_after_teardown => true, :raise_in_teardown => true + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "E", + "1st after_teardown", + "2nd after_teardown", + "Finished in", + "RuntimeError: ERROR IN TEARDOWN" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 1 + end + + should "execute all after_teardowns, even if some of them flunk" do + write_and_run_test :use_after_teardown => true, :flunk_in_after_teardown => true + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "THE TEARDOWN", + "1st after_teardown", + "F", + "2nd after_teardown", + "Finished in", + "1) Failure:", + "test_something(MyExampleTest) [_test_file_temp.rb:7]:", + "Flunk in first after_teardown", + "2) Failure:", + "test_something(MyExampleTest) [_test_file_temp.rb:10]:", + "Flunk in second after_teardown" + see_results :tests => 1, :assertions => 2, :failures => 2, :errors => 0 + end + + should "execute all after_teardowns, even if some of them explode" do + write_and_run_test :use_after_teardown => true, :raise_in_after_teardown => true + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "THE TEARDOWN", + "1st after_teardown", + "E", + "2nd after_teardown", + "Finished in", + "RuntimeError: Error in first after_teardown", + "RuntimeError: Error in second after_teardown" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 2 + end + + it "will run after_teardowns in the absence of a regular teardown" do + write_and_run_test :omit_teardown => true, :use_after_teardown => true + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "1st after_teardown", + "2nd after_teardown", + "Finished in" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 0 + end + + should "not interfere with normal test writing" do + write_and_run_test + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "THE TEARDOWN", + "Finished in" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 0 + end + + it "provides a cleaned-up backtrace" do + write_and_run_test :with_failure => true + see_in_order "Loaded suite", + "THE SETUP", + "A FAILING TEST", + "F", "THE TEARDOWN", + "Finished in", + "1) Failure:", + "test_something(MyExampleTest) [_test_file_temp.rb:17]:", + "Instrumented failure.", + " is not true." + see_results :tests => 1, :assertions => 1, :failures => 1, :errors => 0 + end + + it "provides a cleaned-up backtrace, but not TOO cleaned up" do + write_and_run_test :with_failure => true, :use_helpers => true + see_in_order "Loaded suite", + "THE SETUP", + "A FAILING TEST", + "F", "THE TEARDOWN", + "Finished in", + "1) Failure:", + "test_something(MyExampleTest)\n", + "[_test_file_temp.rb:25:in `tripwire'", + "_test_file_temp.rb:21:in `my_helper'", + "_test_file_temp.rb:17:in `test_something']:", + "Instrumented failure.", + " is not true." + see_results :tests => 1, :assertions => 1, :failures => 1, :errors => 0 + end + + should "not interfere with passthrough exception types" do + if is_modern_test_unit? + write_and_run_test :raise_nasty_in_test => true + see_in_no_particular_order "Loaded suite", + "THE TEARDOWN", + "_test_file_temp.rb:16:in `test_something': NASTY ERROR (NoMemoryError)" + see_no_results + end + end + + # + # before_setup + # + + it "adds TestCase.before_setup hook for prepending pre-setup actions" do + write_and_run_test :use_before_setup => true + see_in_order "Loaded suite", + "3rd before_setup", + "2nd before_setup", + "1st before_setup", + "THE SETUP", + "A TEST", + "THE TEARDOWN", + "Finished in" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 0 + end + + should "stop executing the test on the first failure withing a before_setup action" do + write_and_run_test :use_before_setup => true, :flunk_in_before_setup => true + see_in_order "Loaded suite", + "3rd before_setup", + "2nd before_setup", + "FTHE TEARDOWN", + "1) Failure:", + "test_something(MyExampleTest) [_test_file_temp.rb:10]:", + "Flunk in 2nd before_setup." + see_results :tests => 1, :assertions => 1, :failures => 1, :errors => 0 + end + + should "stop executing the test on the first error within a before_setup action" do + write_and_run_test :use_before_setup => true, :raise_in_before_setup => true + see_in_order "Loaded suite", + "3rd before_setup", + "2nd before_setup", + "ETHE TEARDOWN", + "Finished in", + "test_something(MyExampleTest):", + "RuntimeError: Error in 2nd before_setup", + "_test_file_temp.rb:10", + "/hardmock/lib/test_unit_before_after.rb:", ":in `call'" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 1 + end + + it "will run before_setup actions in the absence of a regular setup" do + write_and_run_test :omit_setup => true, :use_before_setup => true + see_in_order "Loaded suite", + "3rd before_setup", + "2nd before_setup", + "1st before_setup", + "A TEST", + "THE TEARDOWN", + "Finished in" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 0 + end + + it "allows before_setup and after_teardown to be used at the same time" do + write_and_run_test :use_before_setup => true, :use_after_teardown => true + see_in_order "Loaded suite", + "3rd before_setup", + "2nd before_setup", + "1st before_setup", + "A TEST", + "THE TEARDOWN", + "1st after_teardown", + "2nd after_teardown", + "Finished in" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 0 + end + + # + # HELPERS + # + + def teardown + remove_test + end + + def test_filename + "_test_file_temp.rb" + end + + def remove_test + rm_f test_filename + end + + def write_and_run_test(opts={}) + write(test_filename, generate_test_code(opts)) + run_test + end + + def run_test + @output = `ruby #{test_filename} 2>&1` + end + + + def write(fname, code) + File.open(fname,"w") do |f| + f.print code + end + end + + def show_output + puts "-- BEGIN TEST OUTPUT" + puts @output + puts "-- END TEST OUTPUT" + end + + def see_in_order(*phrases) + idx = 0 + phrases.each do |txt| + idx = @output.index(txt, idx) + if idx.nil? + if @output.index(txt) + flunk "Phrase '#{txt}' is out-of-order in test output:\n#{@output}" + else + flunk "Phrase '#{txt}' not found in test output:\n#{@output}" + end + end + end + end + + def see_in_no_particular_order(*phrases) + phrases.each do |txt| + assert_not_nil @output.index(txt), "Didn't see '#{txt}' in test output:\n#{@output}" + end + end + + def see_results(opts) + if @output =~ /(\d+) tests, (\d+) assertions, (\d+) failures, (\d+) errors/ + tests, assertions, failures, errors = [ $1, $2, $3, $4 ] + [:tests, :assertions, :failures, :errors].each do |key| + eval %{assert_equal(opts[:#{key}].to_s, #{key}, "Wrong number of #{key} in report") if opts[:#{key}]} + end + else + flunk "Didn't see the test results report line" + end + end + + def see_no_results + if @output =~ /\d+ tests, \d+ assertions, \d+ failures, \d+ errors/ + flunk "Should not have had a results line:\n#{@output}" + end + end + + def lib_dir + File.expand_path(File.dirname(__FILE__) + "/../../lib") + end + + def generate_test_code(opts={}) + + if opts[:with_failure] or opts[:raise_nasty_in_test] + test_method_code = generate_failing_test("test_something", opts) + else + test_method_code = generate_passing_test("test_something") + end + + + requires_for_ext = '' + if opts[:use_before_setup] or opts[:use_after_teardown] + requires_for_ext =<<-RFE + $: << "#{lib_dir}" + require 'test_unit_before_after' + RFE + end + + before_setups = '' + if opts[:use_before_setup] + add_on_two = "" + if opts[:flunk_in_before_setup] + add_on_two = %{; test.flunk "Flunk in 2nd before_setup"} + elsif opts[:raise_in_before_setup] + add_on_two = %{; raise "Error in 2nd before_setup"} + end + before_setups =<<-BSTS + Test::Unit::TestCase.before_setup do |test| + puts "1st before_setup" + end + Test::Unit::TestCase.before_setup do |test| + puts "2nd before_setup" #{add_on_two} + end + Test::Unit::TestCase.before_setup do |test| + puts "3rd before_setup" + end + + BSTS + end + + + setup_code =<<-SC + def setup + puts "THE SETUP" + end + SC + if opts[:omit_setup] + setup_code = "" + end + + after_teardowns = '' + if opts[:use_after_teardown] + add_on_one = "" + add_on_two = "" + if opts[:flunk_in_after_teardown] + add_on_one = %{; test.flunk "Flunk in first after_teardown"} + add_on_two = %{; test.flunk "Flunk in second after_teardown"} + elsif opts[:raise_in_after_teardown] + add_on_one = %{; raise "Error in first after_teardown"} + add_on_two = %{; raise "Error in second after_teardown"} + end + after_teardowns =<<-ATDS + Test::Unit::TestCase.after_teardown do |test| + puts "1st after_teardown" #{add_on_one} + end + Test::Unit::TestCase.after_teardown do |test| + puts "2nd after_teardown" #{add_on_two} + end + ATDS + end + + teardown_code =<<-TDC + def teardown + puts "THE TEARDOWN" + end + TDC + if opts[:flunk_in_teardown] + teardown_code =<<-TDC + def teardown + flunk "FLUNK IN TEARDOWN" + end + TDC + elsif opts[:raise_in_teardown] + teardown_code =<<-TDC + def teardown + raise "ERROR IN TEARDOWN" + end + TDC + end + if opts[:omit_teardown] + teardown_code = "" + end + + str = <<-TCODE + require 'test/unit' + #{requires_for_ext} + + #{before_setups} #{after_teardowns} + + class MyExampleTest < Test::Unit::TestCase + #{setup_code} + #{teardown_code} + #{test_method_code} + end + TCODE + end + + def generate_passing_test(tname) + str = <<-TMETH + def #{tname} + puts "A TEST" + end + TMETH + end + + def generate_failing_test(tname, opts={}) + str = "NOT DEFINED?" + if opts[:raise_nasty_in_test] + str = <<-TMETH + def #{tname} + raise NoMemoryError, "NASTY ERROR" + end + TMETH + + elsif opts[:use_helpers] + str = <<-TMETH + def #{tname} + puts "A FAILING TEST" + my_helper + end + + def my_helper + tripwire + end + + def tripwire + assert false, "Instrumented failure" + end + TMETH + else + str = <<-TMETH + def #{tname} + puts "A FAILING TEST" + assert false, "Instrumented failure" + end + TMETH + end + return str + end + + def is_modern_test_unit? + begin + Test::Unit::TestCase::PASSTHROUGH_EXCEPTIONS + return true + rescue NameError + return false + end + end + +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/trapper_test.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/trapper_test.rb new file mode 100644 index 0000000..f7d4114 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/trapper_test.rb @@ -0,0 +1,62 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/method_cleanout' +require 'hardmock/trapper' + +class TrapperTest < Test::Unit::TestCase + include Hardmock + + def setup + @mock = Object.new + @mock_control = MyControl.new + @builder = ExpBuilder.new + @trapper = Trapper.new(@mock, @mock_control, @builder) + end + + # + # HELPERS + # + + class MyControl + attr_reader :added + def add_expectation(expectation) + @added ||= [] + @added << expectation + end + end + + class ExpBuilder + attr_reader :options + def build_expectation(options) + @options = options + "dummy expectation" + end + end + + # + # TESTS + # + + def test_method_missing + + output = @trapper.change(:less) + + assert_same @mock, @builder.options[:mock] + assert_equal :change, @builder.options[:method] + assert_equal [:less], @builder.options[:arguments] + assert_not_nil @builder.options[:block] + assert @builder.options[:suppress_arguments_to_block], ":suppress_arguments_to_block should be set" + assert_equal [ "dummy expectation" ], @mock_control.added, + "Wrong expectation added to control" + + assert_equal "dummy expectation", output, "Expectation should have been returned" + + # Examine the block. It should take one argument and simply return + # that argument. because of the 'suppress arguments to block' + # setting, the argument can only end up being a block, in practice. + trapper_block = @builder.options[:block] + assert_equal "the argument", trapper_block.call("the argument"), + "The block should merely return the passed argument" + end + + +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/verify_error_test.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/verify_error_test.rb new file mode 100644 index 0000000..ecd23fd --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/hardmock/test/unit/verify_error_test.rb @@ -0,0 +1,40 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/method_cleanout' +require 'hardmock/mock_control' +require 'hardmock/errors' +require 'hardmock/expectation_builder' +require 'hardmock/expectation' +require 'hardmock/mock' + +class VerifyErrorTest < Test::Unit::TestCase + include Hardmock + + # + # TESTS + # + + def test_formatted_list_of_unmet_expectations + mock1 = Mock.new('mock1') + mock2 = Mock.new('mock2') + exp1 = Expectation.new( :mock => mock1, :method => 'send_parts', :arguments => [1,2,:a] ) + exp2 = Expectation.new( :mock => mock2, :method => 'grind_it', :arguments => [] ) + + exp_list = [ exp1, exp2 ] + + err = VerifyError.new("This is the error", exp_list) + assert_equal "This is the error:\n * #{exp1.to_s}\n * #{exp2.to_s}", err.message + end + + def test_empty_list_of_expectations + # this is not a normal case; not spending a lot of time to make this better + exp_list = [] + err = VerifyError.new("This is the error:\n", exp_list) + end + + def test_nil_expectation_list + # this is not a normal case; not spending a lot of time to make this better + exp_list = [] + err = VerifyError.new("This is the error:\n", exp_list) + end + +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/auto/colour_prompt.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/auto/colour_prompt.rb new file mode 100644 index 0000000..81003dd --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/auto/colour_prompt.rb @@ -0,0 +1,94 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +if RUBY_PLATFORM =~/(win|w)32$/ + begin + require 'Win32API' + rescue LoadError + puts "ERROR! \"Win32API\" library not found" + puts "\"Win32API\" is required for colour on a windows machine" + puts " try => \"gem install Win32API\" on the command line" + puts + end + # puts + # puts 'Windows Environment Detected...' + # puts 'Win32API Library Found.' + # puts +end + +class ColourCommandLine + def initialize + if RUBY_PLATFORM =~/(win|w)32$/ + get_std_handle = Win32API.new("kernel32", "GetStdHandle", ['L'], 'L') + @set_console_txt_attrb = + Win32API.new("kernel32","SetConsoleTextAttribute",['L','N'], 'I') + @hout = get_std_handle.call(-11) + end + end + + def change_to(new_colour) + if RUBY_PLATFORM =~/(win|w)32$/ + @set_console_txt_attrb.call(@hout,self.win32_colour(new_colour)) + else + "\033[30;#{posix_colour(new_colour)};22m" + end + end + + def win32_colour(colour) + case colour + when :black then 0 + when :dark_blue then 1 + when :dark_green then 2 + when :dark_cyan then 3 + when :dark_red then 4 + when :dark_purple then 5 + when :dark_yellow, :narrative then 6 + when :default_white, :default, :dark_white then 7 + when :silver then 8 + when :blue then 9 + when :green, :success then 10 + when :cyan, :output then 11 + when :red, :failure then 12 + when :purple then 13 + when :yellow then 14 + when :white then 15 + else + 0 + end + end + + def posix_colour(colour) + case colour + when :black then 30 + when :red, :failure then 31 + when :green, :success then 32 + when :yellow then 33 + when :blue, :narrative then 34 + when :purple, :magenta then 35 + when :cyan, :output then 36 + when :white, :default_white, :default then 37 + else + 30 + end + end + + def out_c(mode, colour, str) + case RUBY_PLATFORM + when /(win|w)32$/ + change_to(colour) + $stdout.puts str if mode == :puts + $stdout.print str if mode == :print + change_to(:default_white) + else + $stdout.puts("#{change_to(colour)}#{str}\033[0m") if mode == :puts + $stdout.print("#{change_to(colour)}#{str}\033[0m") if mode == :print + end + end +end # ColourCommandLine + +def colour_puts(role,str) ColourCommandLine.new.out_c(:puts, role, str) end +def colour_print(role,str) ColourCommandLine.new.out_c(:print, role, str) end + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/auto/colour_reporter.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/auto/colour_reporter.rb new file mode 100644 index 0000000..5aa1d27 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/auto/colour_reporter.rb @@ -0,0 +1,39 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require "#{File.expand_path(File.dirname(__FILE__))}/colour_prompt" + +$colour_output = true + +def report(message) + if not $colour_output + $stdout.puts(message) + else + message = message.join('\n') if (message.class == Array) + message.each_line do |line| + line.chomp! + colour = case(line) + when /(?:total\s+)?tests:?\s+(\d+)\s+(?:total\s+)?failures:?\s+\d+\s+Ignored:?/i + ($1.to_i == 0) ? :green : :red + when /PASS/ + :green + when /^OK$/ + :green + when /(?:FAIL|ERROR)/ + :red + when /IGNORE/ + :yellow + when /^(?:Creating|Compiling|Linking)/ + :white + else + :silver + end + colour_puts(colour, line) + end + end + $stdout.flush + $stderr.flush +end \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/auto/generate_config.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/auto/generate_config.yml new file mode 100644 index 0000000..4a5e474 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/auto/generate_config.yml @@ -0,0 +1,36 @@ +#this is a sample configuration file for generate_module +#you would use it by calling generate_module with the -ygenerate_config.yml option +#files like this are useful for customizing generate_module to your environment +:generate_module: + :defaults: + #these defaults are used in place of any missing options at the command line + :path_src: ../src/ + :path_inc: ../src/ + :path_tst: ../test/ + :update_svn: true + :includes: + #use [] for no additional includes, otherwise list the includes on separate lines + :src: + - Defs.h + - Board.h + :inc: [] + :tst: + - Defs.h + - Board.h + - Exception.h + :boilerplates: + #these are inserted at the top of generated files. + #just comment out or remove if not desired. + #use %1$s where you would like the file name to appear (path/extension not included) + :src: | + //------------------------------------------- + // %1$s.c + //------------------------------------------- + :inc: | + //------------------------------------------- + // %1$s.h + //------------------------------------------- + :tst: | + //------------------------------------------- + // Test%1$s.c : Units tests for %1$s.c + //------------------------------------------- diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/auto/generate_module.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/auto/generate_module.rb new file mode 100644 index 0000000..3db1a98 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/auto/generate_module.rb @@ -0,0 +1,202 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +# This script creates all the files with start code necessary for a new module. +# A simple module only requires a source file, header file, and test file. +# Triad modules require a source, header, and test file for each triad type (like model, conductor, and hardware). + +require 'rubygems' +require 'fileutils' + +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +#help text when requested +HELP_TEXT = [ "\nGENERATE MODULE\n-------- ------", + "\nUsage: ruby generate_module [options] module_name", + " -i\"include\" sets the path to output headers to 'include' (DEFAULT ../src)", + " -s\"../src\" sets the path to output source to '../src' (DEFAULT ../src)", + " -t\"C:/test\" sets the path to output source to 'C:/test' (DEFAULT ../test)", + " -p\"MCH\" sets the output pattern to MCH.", + " dh - driver hardware.", + " dih - driver interrupt hardware.", + " mch - model conductor hardware.", + " mvp - model view presenter.", + " src - just a single source module. (DEFAULT)", + " -d destroy module instead of creating it.", + " -u update subversion too (requires subversion command line)", + " -y\"my.yml\" selects a different yaml config file for module generation", + "" ].join("\n") + +#Built in patterns +PATTERNS = { 'src' => {'' => { :inc => [] } }, + 'dh' => {'Driver' => { :inc => ['%1$sHardware.h'] }, + 'Hardware' => { :inc => [] } + }, + 'dih' => {'Driver' => { :inc => ['%1$sHardware.h', '%1$sInterrupt.h'] }, + 'Interrupt'=> { :inc => ['%1$sHardware.h'] }, + 'Hardware' => { :inc => [] } + }, + 'mch' => {'Model' => { :inc => [] }, + 'Conductor'=> { :inc => ['%1$sModel.h', '%1$sHardware.h'] }, + 'Hardware' => { :inc => [] } + }, + 'mvp' => {'Model' => { :inc => [] }, + 'Presenter'=> { :inc => ['%1$sModel.h', '%1$sView.h'] }, + 'View' => { :inc => [] } + } + } + +#TEMPLATE_TST +TEMPLATE_TST = %q[#include "unity.h" +%2$s#include "%1$s.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void test_%1$s_NeedToImplement(void) +{ + TEST_IGNORE(); +} +] + +#TEMPLATE_SRC +TEMPLATE_SRC = %q[%2$s#include "%1$s.h" +] + +#TEMPLATE_INC +TEMPLATE_INC = %q[#ifndef _%3$s_H +#define _%3$s_H%2$s + +#endif // _%3$s_H +] + +# Parse the command line parameters. +ARGV.each do |arg| + case(arg) + when /^-d/ then @destroy = true + when /^-u/ then @update_svn = true + when /^-p(\w+)/ then @pattern = $1 + when /^-s(.+)/ then @path_src = $1 + when /^-i(.+)/ then @path_inc = $1 + when /^-t(.+)/ then @path_tst = $1 + when /^-y(.+)/ then @yaml_config = $1 + when /^(\w+)/ + raise "ERROR: You can't have more than one Module name specified!" unless @module_name.nil? + @module_name = arg + when /^-(h|-help)/ + puts HELP_TEXT + exit + else + raise "ERROR: Unknown option specified '#{arg}'" + end +end +raise "ERROR: You must have a Module name specified! (use option -h for help)" if @module_name.nil? + +#load yaml file if one was requested +if @yaml_config + require 'yaml' + cfg = YAML.load_file(HERE + @yaml_config)[:generate_module] + @path_src = cfg[:defaults][:path_src] if @path_src.nil? + @path_inc = cfg[:defaults][:path_inc] if @path_inc.nil? + @path_tst = cfg[:defaults][:path_tst] if @path_tst.nil? + @update_svn = cfg[:defaults][:update_svn] if @update_svn.nil? + @extra_inc = cfg[:includes] + @boilerplates = cfg[:boilerplates] +else + @boilerplates = {} +end + +# Create default file paths if none were provided +@path_src = HERE + "../src/" if @path_src.nil? +@path_inc = @path_src if @path_inc.nil? +@path_tst = HERE + "../test/" if @path_tst.nil? +@path_src += '/' unless (@path_src[-1] == 47) +@path_inc += '/' unless (@path_inc[-1] == 47) +@path_tst += '/' unless (@path_tst[-1] == 47) +@pattern = 'src' if @pattern.nil? +@includes = { :src => [], :inc => [], :tst => [] } +@includes.merge!(@extra_inc) unless @extra_inc.nil? + +#create triad definition +TRIAD = [ { :ext => '.c', :path => @path_src, :template => TEMPLATE_SRC, :inc => :src, :boilerplate => @boilerplates[:src] }, + { :ext => '.h', :path => @path_inc, :template => TEMPLATE_INC, :inc => :inc, :boilerplate => @boilerplates[:inc] }, + { :ext => '.c', :path => @path_tst+'Test', :template => TEMPLATE_TST, :inc => :tst, :boilerplate => @boilerplates[:tst] }, + ] + +#prepare the pattern for use +@patterns = PATTERNS[@pattern.downcase] +raise "ERROR: The design pattern specified isn't one that I recognize!" if @patterns.nil? + +# Assemble the path/names of the files we need to work with. +files = [] +TRIAD.each do |triad| + @patterns.each_pair do |pattern_file, pattern_traits| + files << { + :path => "#{triad[:path]}#{@module_name}#{pattern_file}#{triad[:ext]}", + :name => "#{@module_name}#{pattern_file}", + :template => triad[:template], + :boilerplate => triad[:boilerplate], + :includes => case(triad[:inc]) + when :src then @includes[:src] | pattern_traits[:inc].map{|f| f % [@module_name]} + when :inc then @includes[:inc] + when :tst then @includes[:tst] | pattern_traits[:inc].map{|f| "Mock#{f}"% [@module_name]} + end + } + end +end + +# destroy files if that was what was requested +if @destroy + files.each do |filespec| + file = filespec[:path] + if File.exist?(file) + if @update_svn + `svn delete \"#{file}\" --force` + puts "File #{file} deleted and removed from source control" + else + FileUtils.remove(file) + puts "File #{file} deleted" + end + else + puts "File #{file} does not exist so cannot be removed." + end + end + puts "Destroy Complete" + exit +end + +#Abort if any module already exists +files.each do |file| + raise "ERROR: File #{file[:name]} already exists. Exiting." if File.exist?(file[:path]) +end + +# Create Source Modules +files.each_with_index do |file, i| + File.open(file[:path], 'w') do |f| + f.write(file[:boilerplate] % [file[:name]]) unless file[:boilerplate].nil? + f.write(file[:template] % [ file[:name], + file[:includes].map{|f| "#include \"#{f}\"\n"}.join, + file[:name].upcase ] + ) + end + if (@update_svn) + `svn add \"#{file[:path]}\"` + if $?.exitstatus == 0 + puts "File #{file[:path]} created and added to source control" + else + puts "File #{file[:path]} created but FAILED adding to source control!" + end + else + puts "File #{file[:path]} created" + end +end + +puts 'Generate Complete' diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/auto/generate_test_runner.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/auto/generate_test_runner.rb new file mode 100644 index 0000000..aff5053 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/auto/generate_test_runner.rb @@ -0,0 +1,303 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +File.expand_path(File.join(File.dirname(__FILE__),'colour_prompt')) + +class UnityTestRunnerGenerator + + def initialize(options = nil) + @options = { :includes => [], :plugins => [], :framework => :unity } + case(options) + when NilClass then @options + when String then @options.merge!(UnityTestRunnerGenerator.grab_config(options)) + when Hash then @options.merge!(options) + else raise "If you specify arguments, it should be a filename or a hash of options" + end + end + + def self.grab_config(config_file) + options = { :includes => [], :plugins => [], :framework => :unity } + unless (config_file.nil? or config_file.empty?) + require 'yaml' + yaml_guts = YAML.load_file(config_file) + options.merge!(yaml_guts[:unity] ? yaml_guts[:unity] : yaml_guts[:cmock]) + raise "No :unity or :cmock section found in #{config_file}" unless options + end + return(options) + end + + def run(input_file, output_file, options=nil) + tests = [] + includes = [] + used_mocks = [] + + @options.merge!(options) unless options.nil? + module_name = File.basename(input_file) + + #pull required data from source file + File.open(input_file, 'r') do |input| + tests = find_tests(input) + includes = find_includes(input) + used_mocks = find_mocks(includes) + end + + #build runner file + File.open(output_file, 'w') do |output| + create_header(output, used_mocks) + create_externs(output, tests, used_mocks) + create_mock_management(output, used_mocks) + create_suite_setup_and_teardown(output) + create_reset(output, used_mocks) + create_main(output, input_file, tests) + end + + all_files_used = [input_file, output_file] + all_files_used += includes.map {|filename| filename + '.c'} unless includes.empty? + all_files_used += @options[:includes] unless @options[:includes].empty? + return all_files_used.uniq + end + + def find_tests(input_file) + tests_raw = [] + tests_args = [] + tests_and_line_numbers = [] + + input_file.rewind + source_raw = input_file.read + source_scrubbed = source_raw.gsub(/\/\/.*$/, '') # remove line comments + source_scrubbed = source_scrubbed.gsub(/\/\*.*?\*\//m, '') # remove block comments + lines = source_scrubbed.split(/(^\s*\#.*$) # Treat preprocessor directives as a logical line + | (;|\{|\}) /x) # Match ;, {, and } as end of lines + + lines.each_with_index do |line, index| + #find tests + if line =~ /^((?:\s*TEST_CASE\s*\(.*?\)\s*)*)\s*void\s+(test.*?)\s*\(\s*(.*)\s*\)/ + arguments = $1 + name = $2 + call = $3 + args = nil + if (@options[:use_param_tests] and !arguments.empty?) + args = [] + arguments.scan(/\s*TEST_CASE\s*\((.*)\)\s*$/) {|a| args << a[0]} + end + tests_and_line_numbers << { :name => name, :args => args, :call => call, :line_number => 0 } + tests_args = [] + end + end + + #determine line numbers and create tests to run + source_lines = source_raw.split("\n") + source_index = 0; + tests_and_line_numbers.size.times do |i| + source_lines[source_index..-1].each_with_index do |line, index| + if (line =~ /#{tests_and_line_numbers[i][:name]}/) + source_index += index + tests_and_line_numbers[i][:line_number] = source_index + 1 + break + end + end + end + + return tests_and_line_numbers + end + + def find_includes(input_file) + input_file.rewind + includes = [] + input_file.readlines.each do |line| + scan_results = line.scan(/^\s*#include\s+\"\s*(.+)\.[hH]\s*\"/) + includes << scan_results[0][0] if (scan_results.size > 0) + end + return includes + end + + def find_mocks(includes) + mock_headers = [] + includes.each do |include_file| + mock_headers << File.basename(include_file) if (include_file =~ /^mock/i) + end + return mock_headers + end + + def create_header(output, mocks) + output.puts('/* AUTOGENERATED FILE. DO NOT EDIT. */') + create_runtest(output, mocks) + output.puts("\n//=======Automagically Detected Files To Include=====") + output.puts("#include \"#{@options[:framework].to_s}.h\"") + output.puts('#include "cmock.h"') unless (mocks.empty?) + @options[:includes].flatten.uniq.compact.each do |inc| + output.puts("#include #{inc.include?('<') ? inc : "\"#{inc.gsub('.h','')}.h\""}") + end + output.puts('#include ') + output.puts('#include ') + output.puts('#include "CException.h"') if @options[:plugins].include?(:cexception) + mocks.each do |mock| + output.puts("#include \"#{mock.gsub('.h','')}.h\"") + end + if @options[:enforce_strict_ordering] + output.puts('') + output.puts('int GlobalExpectCount;') + output.puts('int GlobalVerifyOrder;') + output.puts('char* GlobalOrderError;') + end + end + + def create_externs(output, tests, mocks) + output.puts("\n//=======External Functions This Runner Calls=====") + output.puts("extern void setUp(void);") + output.puts("extern void tearDown(void);") + tests.each do |test| + output.puts("extern void #{test[:name]}(#{test[:call]});") + end + output.puts('') + end + + def create_mock_management(output, mocks) + unless (mocks.empty?) + output.puts("\n//=======Mock Management=====") + output.puts("static void CMock_Init(void)") + output.puts("{") + if @options[:enforce_strict_ordering] + output.puts(" GlobalExpectCount = 0;") + output.puts(" GlobalVerifyOrder = 0;") + output.puts(" GlobalOrderError = NULL;") + end + mocks.each do |mock| + output.puts(" #{mock}_Init();") + end + output.puts("}\n") + + output.puts("static void CMock_Verify(void)") + output.puts("{") + mocks.each do |mock| + output.puts(" #{mock}_Verify();") + end + output.puts("}\n") + + output.puts("static void CMock_Destroy(void)") + output.puts("{") + mocks.each do |mock| + output.puts(" #{mock}_Destroy();") + end + output.puts("}\n") + end + end + + def create_suite_setup_and_teardown(output) + unless (@options[:suite_setup].nil?) + output.puts("\n//=======Suite Setup=====") + output.puts("static int suite_setup(void)") + output.puts("{") + output.puts(@options[:suite_setup]) + output.puts("}") + end + unless (@options[:suite_teardown].nil?) + output.puts("\n//=======Suite Teardown=====") + output.puts("static int suite_teardown(int num_failures)") + output.puts("{") + output.puts(@options[:suite_teardown]) + output.puts("}") + end + end + + def create_runtest(output, used_mocks) + cexception = @options[:plugins].include? :cexception + va_args1 = @options[:use_param_tests] ? ', ...' : '' + va_args2 = @options[:use_param_tests] ? '__VA_ARGS__' : '' + output.puts("\n//=======Test Runner Used To Run Each Test Below=====") + output.puts("#define RUN_TEST_NO_ARGS") if @options[:use_param_tests] + output.puts("#define RUN_TEST(TestFunc, TestLineNum#{va_args1}) \\") + output.puts("{ \\") + output.puts(" Unity.CurrentTestName = #TestFunc#{va_args2.empty? ? '' : " \"(\" ##{va_args2} \")\""}; \\") + output.puts(" Unity.CurrentTestLineNumber = TestLineNum; \\") + output.puts(" Unity.NumberOfTests++; \\") + output.puts(" if (TEST_PROTECT()) \\") + output.puts(" { \\") + output.puts(" CEXCEPTION_T e; \\") if cexception + output.puts(" Try { \\") if cexception + output.puts(" CMock_Init(); \\") unless (used_mocks.empty?) + output.puts(" setUp(); \\") + output.puts(" TestFunc(#{va_args2}); \\") + output.puts(" CMock_Verify(); \\") unless (used_mocks.empty?) + output.puts(" } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, \"Unhandled Exception!\"); } \\") if cexception + output.puts(" } \\") + output.puts(" CMock_Destroy(); \\") unless (used_mocks.empty?) + output.puts(" if (TEST_PROTECT() && !TEST_IS_IGNORED) \\") + output.puts(" { \\") + output.puts(" tearDown(); \\") + output.puts(" } \\") + output.puts(" UnityConcludeTest(); \\") + output.puts("}\n") + end + + def create_reset(output, used_mocks) + output.puts("\n//=======Test Reset Option=====") + output.puts("void resetTest()") + output.puts("{") + output.puts(" CMock_Verify();") unless (used_mocks.empty?) + output.puts(" CMock_Destroy();") unless (used_mocks.empty?) + output.puts(" tearDown();") + output.puts(" CMock_Init();") unless (used_mocks.empty?) + output.puts(" setUp();") + output.puts("}") + end + + def create_main(output, filename, tests) + output.puts("\n\n//=======MAIN=====") + output.puts("int main(void)") + output.puts("{") + output.puts(" suite_setup();") unless @options[:suite_setup].nil? + output.puts(" Unity.TestFile = \"#{filename}\";") + output.puts(" UnityBegin();") + if (@options[:use_param_tests]) + tests.each do |test| + if ((test[:args].nil?) or (test[:args].empty?)) + output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]}, RUN_TEST_NO_ARGS);") + else + test[:args].each {|args| output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]}, #{args});")} + end + end + else + tests.each { |test| output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]});") } + end + output.puts() + output.puts(" return #{@options[:suite_teardown].nil? ? "" : "suite_teardown"}(UnityEnd());") + output.puts("}") + end +end + + +if ($0 == __FILE__) + options = { :includes => [] } + yaml_file = nil + + #parse out all the options first + ARGV.reject! do |arg| + case(arg) + when '-cexception' + options[:plugins] = [:cexception]; true + when /\.*\.yml/ + options = UnityTestRunnerGenerator.grab_config(arg); true + else false + end + end + + #make sure there is at least one parameter left (the input file) + if !ARGV[0] + puts ["usage: ruby #{__FILE__} (yaml) (options) input_test_file output_test_runner (includes)", + " blah.yml - will use config options in the yml file (see docs)", + " -cexception - include cexception support"].join("\n") + exit 1 + end + + #create the default test runner name if not specified + ARGV[1] = ARGV[0].gsub(".c","_Runner.c") if (!ARGV[1]) + + #everything else is an include file + options[:includes] ||= (ARGV.slice(2..-1).flatten.compact) if (ARGV.size > 2) + + UnityTestRunnerGenerator.new(options).run(ARGV[0], ARGV[1]) +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/auto/test_file_filter.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/auto/test_file_filter.rb new file mode 100644 index 0000000..3dbc26a --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/auto/test_file_filter.rb @@ -0,0 +1,23 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require'yaml' + +module RakefileHelpers + class TestFileFilter + def initialize(all_files = false) + @all_files = all_files + if not @all_files == true + if File.exist?('test_file_filter.yml') + filters = YAML.load_file( 'test_file_filter.yml' ) + @all_files, @only_files, @exclude_files = + filters[:all_files], filters[:only_files], filters[:exclude_files] + end + end + end + attr_accessor :all_files, :only_files, :exclude_files + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/auto/unity_test_summary.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/auto/unity_test_summary.rb new file mode 100644 index 0000000..69ec2e8 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/auto/unity_test_summary.rb @@ -0,0 +1,126 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +#!/usr/bin/ruby +# +# unity_test_summary.rb +# +require 'fileutils' +require 'set' + +class UnityTestSummary + include FileUtils::Verbose + + attr_reader :report, :total_tests, :failures, :ignored + + def initialize + @report = '' + @total_tests = 0 + @failures = 0 + @ignored = 0 + end + + def run + # Clean up result file names + results = @targets.map {|target| target.gsub(/\\/,'/')} + + # Dig through each result file, looking for details on pass/fail: + failure_output = [] + ignore_output = [] + + results.each do |result_file| + lines = File.readlines(result_file).map { |line| line.chomp } + if lines.length == 0 + raise "Empty test result file: #{result_file}" + else + output = get_details(result_file, lines) + failure_output << output[:failures] unless output[:failures].empty? + ignore_output << output[:ignores] unless output[:ignores].empty? + tests,failures,ignored = parse_test_summary(lines) + @total_tests += tests + @failures += failures + @ignored += ignored + end + end + + if @ignored > 0 + @report += "\n" + @report += "--------------------------\n" + @report += "UNITY IGNORED TEST SUMMARY\n" + @report += "--------------------------\n" + @report += ignore_output.flatten.join("\n") + end + + if @failures > 0 + @report += "\n" + @report += "--------------------------\n" + @report += "UNITY FAILED TEST SUMMARY\n" + @report += "--------------------------\n" + @report += failure_output.flatten.join("\n") + end + + @report += "\n" + @report += "--------------------------\n" + @report += "OVERALL UNITY TEST SUMMARY\n" + @report += "--------------------------\n" + @report += "#{@total_tests} TOTAL TESTS #{@failures} TOTAL FAILURES #{@ignored} IGNORED\n" + @report += "\n" + end + + def set_targets(target_array) + @targets = target_array + end + + def set_root_path(path) + @root = path + end + + def usage(err_msg=nil) + puts err_msg if err_msg + puts "Usage: unity_test_summary.rb" + exit 1 + end + + protected + + @@targets=nil + @@path=nil + @@root=nil + + def get_details(result_file, lines) + results = { :failures => [], :ignores => [], :successes => [] } + lines.each do |line| + src_file,src_line,test_name,status,msg = line.split(/:/) + line_out = ((@root and (@root != 0)) ? "#{@root}#{line}" : line ).gsub(/\//, "\\") + case(status) + when 'IGNORE' then results[:ignores] << line_out + when 'FAIL' then results[:failures] << line_out + when 'PASS' then results[:successes] << line_out + end + end + return results + end + + def parse_test_summary(summary) + if summary[-3..-1].join("\n") =~ /(\d+) Tests (\d+) Failures (\d+) Ignored/ + [$1.to_i,$2.to_i,$3.to_i] + else + raise "Couldn't parse test results: #{summary}" + end + end + + def here; File.expand_path(File.dirname(__FILE__)); end + +end + +if $0 == __FILE__ + script = UnityTestSummary.new + begin + script.run + rescue Exception => e + script.usage e.message + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/docs/Unity Summary.odt b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/docs/Unity Summary.odt new file mode 100644 index 0000000..f699661 Binary files /dev/null and b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/docs/Unity Summary.odt differ diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/docs/Unity Summary.pdf b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/docs/Unity Summary.pdf new file mode 100644 index 0000000..ad1a956 Binary files /dev/null and b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/docs/Unity Summary.pdf differ diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/docs/Unity Summary.txt b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/docs/Unity Summary.txt new file mode 100644 index 0000000..e0b179d --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/docs/Unity Summary.txt @@ -0,0 +1,217 @@ +============== +Unity Test API +============== + +[Copyright (c) 2007 - Unity Project by Mike Karlesky, Mark VanderVoord, and Greg Williams] + +------------- +Running Tests +------------- + +RUN_TEST(func, linenum) + +Each Test is run within the macro RUN_TEST. This macro performs necessary setup before the test is called and handles cleanup and result tabulation afterwards. + +-------------- +Ignoring Tests +-------------- + +There are times when a test is incomplete or not valid for some reason. At these times, TEST_IGNORE can be called. Control will immediately be returned to the caller of the test, and no failures will be returned. + +TEST_IGNORE() + +Ignore this test and return immediately + +TEST_IGNORE_MESSAGE (message) + +Ignore this test and return immediately. Output a message stating why the test was ignored. + +-------------- +Aborting Tests +-------------- + +There are times when a test will contain an infinite loop on error conditions, or there may be reason to escape from the test early without executing the rest of the test. A pair of macros support this functionality in Unity. The first (TEST_PROTECT) sets up the feature, and handles emergency abort cases. TEST_ABORT can then be used at any time within the tests to return to the last TEST_PROTECT call. + +TEST_PROTECT() + +Setup and Catch macro + +TEST_ABORT() + +Abort Test macro + +Example: + +main() +{ + if (TEST_PROTECT() == 0) + { + MyTest(); + } +} + +If MyTest calls TEST_ABORT, program control will immediately return to TEST_PROTECT with a non-zero return value. + + +======================= +Unity Assertion Summary +======================= + +-------------------- +Basic Validity Tests +-------------------- + +TEST_ASSERT_TRUE(condition) + +Evaluates whatever code is in condition and fails if it evaluates to false + +TEST_ASSERT_FALSE(condition) + +Evaluates whatever code is in condition and fails if it evaluates to true + +TEST_ASSERT(condition) + +Another way of calling TEST_ASSERT_TRUE + +TEST_ASSERT_UNLESS(condition) + +Another way of calling TEST_ASSERT_FALSE + +TEST_FAIL() +TEST_FAIL_MESSAGE(message) + +This test is automatically marked as a failure. The message is output stating why. + +------------------------------ +Numerical Assertions: Integers +------------------------------ + +TEST_ASSERT_EQUAL_INT(expected, actual) +TEST_ASSERT_EQUAL_INT8(expected, actual) +TEST_ASSERT_EQUAL_INT16(expected, actual) +TEST_ASSERT_EQUAL_INT32(expected, actual) +TEST_ASSERT_EQUAL_INT64(expected, actual) + +Compare two integers for equality and display errors as signed integers. A cast will be performed +to your natural integer size so often this can just be used. When you need to specify the exact size, +like when comparing arrays, you can use a specific version: + + + +TEST_ASSERT_EQUAL_UINT(expected, actual) + +Compare two integers for equality and display errors as unsigned integers. Like INT, there are +variants for different sizes also. + + + +TEST_ASSERT_EQUAL_HEX(expected, actual) + +Compares two integers for equality and display errors as hexadecimal. Like the other integer comparisons, +you can specify the size... here the size will also effect how many nibbles are shown (for example, HEX16 +will show 4 nibbles). + +_ARRAY + +You can append _ARRAY to any of these macros to make an array comparison of that type. Here you will +need to care a bit more about the actual size of the value being checked. You will also specify an +additional argument which is the number of elements to compare. For example: + +TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, elements) + + +TEST_ASSERT_EQUAL(expected, actual) + +Another way of calling TEST_ASSERT_EQUAL_INT + + + +TEST_ASSERT_INT_WITHIN(delta, expected, actual) + +Asserts that the actual value is within plus or minus delta of the expected value. This also comes in +size specific variants. + + +----------------------------- +Numerical Assertions: Bitwise +----------------------------- + +TEST_ASSERT_BITS(mask, expected, actual) + +Use an integer mask to specify which bits should be compared between two other integers. High bits in the mask are compared, low bits ignored. + +TEST_ASSERT_BITS_HIGH(mask, actual) + +Use an integer mask to specify which bits should be inspected to determine if they are all set high. High bits in the mask are compared, low bits ignored. + +TEST_ASSERT_BITS_LOW(mask, actual) + +Use an integer mask to specify which bits should be inspected to determine if they are all set low. High bits in the mask are compared, low bits ignored. + +TEST_ASSERT_BIT_HIGH(bit, actual) + +Test a single bit and verify that it is high. The bit is specified 0-31 for a 32-bit integer. + +TEST_ASSERT_BIT_LOW(bit, actual) + +Test a single bit and verify that it is low. The bit is specified 0-31 for a 32-bit integer. + +---------------------------- +Numerical Assertions: Floats +---------------------------- + +TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual) + +Asserts that the actual value is within plus or minus delta of the expected value. + +TEST_ASSERT_EQUAL_FLOAT(expected, actual) + +Asserts that two floating point values are "equal" within a small % delta of the expected value. + +----------------- +String Assertions +----------------- + +TEST_ASSERT_EQUAL_STRING(expected, actual) + +Compare two null-terminate strings. Fail if any character is different or if the lengths are different. + +TEST_ASSERT_EQUAL_STRING_MESSAGE(expected, actual, message) + +Compare two null-terminate strings. Fail if any character is different or if the lengths are different. Output a custom message on failure. + +------------------ +Pointer Assertions +------------------ + +Most pointer operations can be performed by simply using the integer comparisons above. However, a couple of special cases are added for clarity. + +TEST_ASSERT_NULL(pointer) + +Fails if the pointer is not equal to NULL + +TEST_ASSERT_NOT_NULL(pointer) + +Fails if the pointer is equal to NULL + + +----------------- +Memory Assertions +----------------- + +TEST_ASSERT_EQUAL_MEMORY(expected, actual, len) + +Compare two blocks of memory. This is a good generic assertion for types that can't be coerced into acting like +standard types... but since it's a memory compare, you have to be careful that your data types are packed. + +-------- +_MESSAGE +-------- + +you can append _MESSAGE to any of the macros to make them take an additional argument. This argument +is a string that will be printed at the end of the failure strings. This is useful for specifying more +information about the problem. + + + + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/docs/license.txt b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/docs/license.txt new file mode 100644 index 0000000..c42e330 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/docs/license.txt @@ -0,0 +1,31 @@ + Copyright (c) 2007-2010 Mike Karlesky, Mark VanderVoord, Greg Williams + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + The end-user documentation included with the redistribution, if + any, must include the following acknowledgment: "This product + includes software developed for the Unity Project, by Mike Karlesky, + Mark VanderVoord, and Greg Williams and other contributors", in + the same place and form as other third-party acknowledgments. + Alternately, this acknowledgment may appear in the software + itself, in the same form and location as other such third-party + acknowledgments. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/examples/helper/UnityHelper.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/examples/helper/UnityHelper.c new file mode 100644 index 0000000..9cf42c6 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/examples/helper/UnityHelper.c @@ -0,0 +1,10 @@ +#include "unity.h" +#include "UnityHelper.h" +#include +#include + +void AssertEqualExampleStruct(const EXAMPLE_STRUCT_T expected, const EXAMPLE_STRUCT_T actual, const unsigned short line) +{ + UNITY_TEST_ASSERT_EQUAL_INT(expected.x, actual.x, line, "Example Struct Failed For Field x"); + UNITY_TEST_ASSERT_EQUAL_INT(expected.y, actual.y, line, "Example Struct Failed For Field y"); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/examples/helper/UnityHelper.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/examples/helper/UnityHelper.h new file mode 100644 index 0000000..1516111 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/examples/helper/UnityHelper.h @@ -0,0 +1,12 @@ +#ifndef _TESTHELPER_H +#define _TESTHELPER_H + +#include "Types.h" + +void AssertEqualExampleStruct(const EXAMPLE_STRUCT_T expected, const EXAMPLE_STRUCT_T actual, const unsigned short line); + +#define UNITY_TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(expected, actual, line, message) AssertEqualExampleStruct(expected, actual, line); + +#define TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(expected, actual) UNITY_TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(expected, actual, __LINE__, NULL); + +#endif // _TESTHELPER_H diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/examples/makefile b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/examples/makefile new file mode 100644 index 0000000..723d390 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/examples/makefile @@ -0,0 +1,40 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +C_COMPILER=gcc +TARGET_BASE1=test1 +TARGET_BASE2=test2 +ifeq ($(OS),Windows_NT) + TARGET_EXTENSION=.exe +else + TARGET_EXTENSION=.out +endif +TARGET1 = $(TARGET_BASE1)$(TARGET_EXTENSION) +TARGET2 = $(TARGET_BASE2)$(TARGET_EXTENSION) +SRC_FILES1=../src/unity.c src/ProductionCode.c test/TestProductionCode.c test/no_ruby/TestProductionCode_Runner.c +SRC_FILES2=../src/unity.c src/ProductionCode2.c test/TestProductionCode2.c test/no_ruby/TestProductionCode2_Runner.c +INC_DIRS=-Isrc -I../src +SYMBOLS=-DTEST + +ifeq ($(OS),Windows_NT) + CLEANUP = del /F /Q build\* && del /F /Q $(TARGET1) && del /F /Q $(TARGET2) +else + CLEANUP = rm -f build/*.o ; rm -f $(TARGET1) ; rm -f $(TARGET2) +endif + +all: clean default + +default: +# ruby auto/generate_test_runner.rb test/TestProductionCode.c test/no_ruby/TestProductionCode_Runner.c +# ruby auto/generate_test_runner.rb test/TestProductionCode2.c test/no_ruby/TestProductionCode2_Runner.c + $(C_COMPILER) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES1) -o $(TARGET1) + $(C_COMPILER) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES2) -o $(TARGET2) + $(TARGET1) + $(TARGET2) + +clean: + $(CLEANUP) + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/examples/rakefile.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/examples/rakefile.rb new file mode 100644 index 0000000..0905b4b --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/examples/rakefile.rb @@ -0,0 +1,32 @@ +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require HERE+'rakefile_helper' + +include RakefileHelpers + +# Load default configuration, for now +DEFAULT_CONFIG_FILE = 'gcc.yml' +configure_toolchain(DEFAULT_CONFIG_FILE) + +task :unit do + run_tests get_unit_test_files +end + +desc "Generate test summary" +task :summary do + report_summary +end + +desc "Build and test Unity" +task :all => [:clean, :unit, :summary] +task :default => [:clobber, :all] +task :ci => [:default] +task :cruise => [:default] + +desc "Load configuration" +task :config, :config_file do |t, args| + configure_toolchain(args[:config_file]) +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/examples/rakefile_helper.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/examples/rakefile_helper.rb new file mode 100644 index 0000000..0127d69 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/examples/rakefile_helper.rb @@ -0,0 +1,260 @@ +require 'yaml' +require 'fileutils' +require HERE+'../auto/unity_test_summary' +require HERE+'../auto/generate_test_runner' +require HERE+'../auto/colour_reporter' + +module RakefileHelpers + + C_EXTENSION = '.c' + + def load_configuration(config_file) + $cfg_file = "../targets/#{config_file}" + $cfg = YAML.load(File.read($cfg_file)) + end + + def configure_clean + CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil? + end + + def configure_toolchain(config_file=DEFAULT_CONFIG_FILE) + config_file += '.yml' unless config_file =~ /\.yml$/ + load_configuration('../targets/'+config_file) + configure_clean + end + + def get_unit_test_files + path = $cfg['compiler']['unit_tests_path'] + 'Test*' + C_EXTENSION + path.gsub!(/\\/, '/') + FileList.new(path) + end + + def get_local_include_dirs + include_dirs = $cfg['compiler']['includes']['items'].dup + include_dirs.delete_if {|dir| dir.is_a?(Array)} + return include_dirs + end + + def extract_headers(filename) + includes = [] + lines = File.readlines(filename) + lines.each do |line| + m = line.match(/^\s*#include\s+\"\s*(.+\.[hH])\s*\"/) + if not m.nil? + includes << m[1] + end + end + return includes + end + + def find_source_file(header, paths) + paths.each do |dir| + src_file = dir + header.ext(C_EXTENSION) + if (File.exists?(src_file)) + return src_file + end + end + return nil + end + + def tackit(strings) + if strings.is_a?(Array) + result = "\"#{strings.join}\"" + else + result = strings + end + return result + end + + def squash(prefix, items) + result = '' + items.each { |item| result += " #{prefix}#{tackit(item)}" } + return result + end + + def build_compiler_fields + command = tackit($cfg['compiler']['path']) + if $cfg['compiler']['defines']['items'].nil? + defines = '' + else + defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items']) + end + options = squash('', $cfg['compiler']['options']) + includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :defines => defines, :options => options, :includes => includes} + end + + def compile(file, defines=[]) + compiler = build_compiler_fields + cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{file} " + + "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" + + "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" + execute(cmd_str) + end + + def build_linker_fields + command = tackit($cfg['linker']['path']) + if $cfg['linker']['options'].nil? + options = '' + else + options = squash('', $cfg['linker']['options']) + end + if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?) + includes = '' + else + includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) + end + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :options => options, :includes => includes} + end + + def link(exe_name, obj_list) + linker = build_linker_fields + cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + + (obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).join + + $cfg['linker']['bin_files']['prefix'] + ' ' + + $cfg['linker']['bin_files']['destination'] + + exe_name + $cfg['linker']['bin_files']['extension'] + execute(cmd_str) + end + + def build_simulator_fields + return nil if $cfg['simulator'].nil? + if $cfg['simulator']['path'].nil? + command = '' + else + command = (tackit($cfg['simulator']['path']) + ' ') + end + if $cfg['simulator']['pre_support'].nil? + pre_support = '' + else + pre_support = squash('', $cfg['simulator']['pre_support']) + end + if $cfg['simulator']['post_support'].nil? + post_support = '' + else + post_support = squash('', $cfg['simulator']['post_support']) + end + return {:command => command, :pre_support => pre_support, :post_support => post_support} + end + + def execute(command_string, verbose=true, raise_on_fail=true) + report command_string + output = `#{command_string}`.chomp + report(output) if (verbose && !output.nil? && (output.length > 0)) + if (($?.exitstatus != 0) and (raise_on_fail)) + raise "Command failed. (Returned #{$?.exitstatus})" + end + return output + end + + def report_summary + summary = UnityTestSummary.new + summary.set_root_path(HERE) + results_glob = "#{$cfg['compiler']['build_path']}*.test*" + results_glob.gsub!(/\\/, '/') + results = Dir[results_glob] + summary.set_targets(results) + summary.run + fail_out "FAIL: There were failures" if (summary.failures > 0) + end + + def run_tests(test_files) + + report 'Running system tests...' + + # Tack on TEST define for compiling unit tests + load_configuration($cfg_file) + test_defines = ['TEST'] + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + $cfg['compiler']['defines']['items'] << 'TEST' + + include_dirs = get_local_include_dirs + + # Build and execute each unit test + test_files.each do |test| + obj_list = [] + + # Detect dependencies and build required required modules + extract_headers(test).each do |header| + # Compile corresponding source file if it exists + src_file = find_source_file(header, include_dirs) + if !src_file.nil? + compile(src_file, test_defines) + obj_list << header.ext($cfg['compiler']['object_files']['extension']) + end + end + + # Build the test runner (generate if configured to do so) + test_base = File.basename(test, C_EXTENSION) + runner_name = test_base + '_Runner.c' + if $cfg['compiler']['runner_path'].nil? + runner_path = $cfg['compiler']['build_path'] + runner_name + test_gen = UnityTestRunnerGenerator.new($cfg_file) + test_gen.run(test, runner_path) + else + runner_path = $cfg['compiler']['runner_path'] + runner_name + end + + compile(runner_path, test_defines) + obj_list << runner_name.ext($cfg['compiler']['object_files']['extension']) + + # Build the test module + compile(test, test_defines) + obj_list << test_base.ext($cfg['compiler']['object_files']['extension']) + + # Link the test executable + link(test_base, obj_list) + + # Execute unit test and generate results file + simulator = build_simulator_fields + executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] + if simulator.nil? + cmd_str = executable + else + cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" + end + output = execute(cmd_str, true, false) + test_results = $cfg['compiler']['build_path'] + test_base + if output.match(/OK$/m).nil? + test_results += '.testfail' + else + test_results += '.testpass' + end + File.open(test_results, 'w') { |f| f.print output } + end + end + + def build_application(main) + + report "Building application..." + + obj_list = [] + load_configuration($cfg_file) + main_path = $cfg['compiler']['source_path'] + main + C_EXTENSION + + # Detect dependencies and build required required modules + include_dirs = get_local_include_dirs + extract_headers(main_path).each do |header| + src_file = find_source_file(header, include_dirs) + if !src_file.nil? + compile(src_file) + obj_list << header.ext($cfg['compiler']['object_files']['extension']) + end + end + + # Build the main source file + main_base = File.basename(main_path, C_EXTENSION) + compile(main_path) + obj_list << main_base.ext($cfg['compiler']['object_files']['extension']) + + # Create the executable + link(main_base, obj_list) + end + + def fail_out(msg) + puts msg + exit(-1) + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/examples/readme.txt b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/examples/readme.txt new file mode 100644 index 0000000..6c7780e --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/examples/readme.txt @@ -0,0 +1,18 @@ +Example Project + +This example project gives an example of some passing, ignored, and failing tests. +It's simple and meant for you to look over and get an idea for what all of this stuff does. + +You can build and test using the makefile if you have gcc installed (you may need to tweak +the locations of some tools in the makefile). Otherwise, the rake version will let you +test with gcc or a couple versions of IAR. You can tweak the yaml files to get those versions +running. + +Ruby is required if you're using the rake version (obviously). This version shows off most of +Unity's advanced features (automatically creating test runners, fancy summaries, etc.) + +The makefile version doesn't require anything outside of your normal build tools, but won't do the +extras for you. So that you can test right away, we've written the test runners for you and +put them in the test\no_ruby subdirectory. If you make changes to the tests or source, you might +need to update these (like when you add or remove tests). Do that for a while and you'll learn +why you really want to start using the Ruby tools. \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/examples/src/ProductionCode.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/examples/src/ProductionCode.c new file mode 100644 index 0000000..500b44b --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/examples/src/ProductionCode.c @@ -0,0 +1,24 @@ + +#include "ProductionCode.h" + +int Counter = 0; +int NumbersToFind[9] = { 0, 34, 55, 66, 32, 11, 1, 77, 888 }; //some obnoxious array to search that is 1-based indexing instead of 0. + +// This function is supposed to search through NumbersToFind and find a particular number. +// If it finds it, the index is returned. Otherwise 0 is returned which sorta makes sense since +// NumbersToFind is indexed from 1. Unfortunately it's broken +// (and should therefore be caught by our tests) +int FindFunction_WhichIsBroken(int NumberToFind) +{ + int i = 0; + while (i <= 8) //Notice I should have been in braces + i++; + if (NumbersToFind[i] == NumberToFind) //Yikes! I'm getting run after the loop finishes instead of during it! + return i; + return 0; +} + +int FunctionWhichReturnsLocalVariable(void) +{ + return Counter; +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/examples/src/ProductionCode.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/examples/src/ProductionCode.h new file mode 100644 index 0000000..250ca0d --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/examples/src/ProductionCode.h @@ -0,0 +1,3 @@ + +int FindFunction_WhichIsBroken(int NumberToFind); +int FunctionWhichReturnsLocalVariable(void); diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/examples/src/ProductionCode2.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/examples/src/ProductionCode2.c new file mode 100644 index 0000000..a8c72e1 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/examples/src/ProductionCode2.c @@ -0,0 +1,9 @@ + +#include "ProductionCode2.h" + +char* ThisFunctionHasNotBeenTested(int Poor, char* LittleFunction) +{ + //Since There Are No Tests Yet, This Function Could Be Empty For All We Know. + // Which isn't terribly useful... but at least we put in a TEST_IGNORE so we won't forget + return (char*)0; +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/examples/src/ProductionCode2.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/examples/src/ProductionCode2.h new file mode 100644 index 0000000..34ae980 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/examples/src/ProductionCode2.h @@ -0,0 +1,2 @@ + +char* ThisFunctionHasNotBeenTested(int Poor, char* LittleFunction); diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/examples/test/TestProductionCode.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/examples/test/TestProductionCode.c new file mode 100644 index 0000000..28a5581 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/examples/test/TestProductionCode.c @@ -0,0 +1,62 @@ + +#include "ProductionCode.h" +#include "unity.h" + +//sometimes you may want to get at local data in a module. +//for example: If you plan to pass by reference, this could be useful +//however, it should often be avoided +extern int Counter; + +void setUp(void) +{ + //This is run before EACH TEST + Counter = 0x5a5a; +} + +void tearDown(void) +{ +} + +void test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode(void) +{ + //All of these should pass + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(78)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(1)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(33)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(999)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(-1)); +} + +void test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken(void) +{ + // You should see this line fail in your test summary + TEST_ASSERT_EQUAL(1, FindFunction_WhichIsBroken(34)); + + // Notice the rest of these didn't get a chance to run because the line above failed. + // Unit tests abort each test function on the first sign of trouble. + // Then NEXT test function runs as normal. + TEST_ASSERT_EQUAL(8, FindFunction_WhichIsBroken(8888)); +} + +void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue(void) +{ + //This should be true because setUp set this up for us before this test + TEST_ASSERT_EQUAL_HEX(0x5a5a, FunctionWhichReturnsLocalVariable()); + + //This should be true because we can still change our answer + Counter = 0x1234; + TEST_ASSERT_EQUAL_HEX(0x1234, FunctionWhichReturnsLocalVariable()); +} + +void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain(void) +{ + //This should be true again because setup was rerun before this test (and after we changed it to 0x1234) + TEST_ASSERT_EQUAL_HEX(0x5a5a, FunctionWhichReturnsLocalVariable()); +} + +void test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed(void) +{ + //Sometimes you get the test wrong. When that happens, you get a failure too... and a quick look should tell + // you what actually happened...which in this case was a failure to setup the initial condition. + TEST_ASSERT_EQUAL_HEX(0x1234, FunctionWhichReturnsLocalVariable()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/examples/test/TestProductionCode2.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/examples/test/TestProductionCode2.c new file mode 100644 index 0000000..20c9251 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/examples/test/TestProductionCode2.c @@ -0,0 +1,26 @@ + +#include "ProductionCode2.h" +#include "unity.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void test_IgnoredTest(void) +{ + TEST_IGNORE_MESSAGE("This Test Was Ignored On Purpose"); +} + +void test_AnotherIgnoredTest(void) +{ + TEST_IGNORE_MESSAGE("These Can Be Useful For Leaving Yourself Notes On What You Need To Do Yet"); +} + +void test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented(void) +{ + TEST_IGNORE(); //Like This +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/examples/test/no_ruby/TestProductionCode2_Runner.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/examples/test/no_ruby/TestProductionCode2_Runner.c new file mode 100644 index 0000000..56515ae --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/examples/test/no_ruby/TestProductionCode2_Runner.c @@ -0,0 +1,46 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ +#include "unity.h" +#include +#include + +char MessageBuffer[50]; + +extern void setUp(void); +extern void tearDown(void); + +extern void test_IgnoredTest(void); +extern void test_AnotherIgnoredTest(void); +extern void test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented(void); + +static void runTest(UnityTestFunction test) +{ + if (TEST_PROTECT()) + { + setUp(); + test(); + } + if (TEST_PROTECT() && !TEST_IS_IGNORED) + { + tearDown(); + } +} +void resetTest() +{ + tearDown(); + setUp(); +} + + +int main(void) +{ + Unity.TestFile = "test/TestProductionCode2.c"; + UnityBegin(); + + // RUN_TEST calls runTest + RUN_TEST(test_IgnoredTest, 13); + RUN_TEST(test_AnotherIgnoredTest, 18); + RUN_TEST(test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented, 23); + + UnityEnd(); + return 0; +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/examples/test/no_ruby/TestProductionCode_Runner.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/examples/test/no_ruby/TestProductionCode_Runner.c new file mode 100644 index 0000000..64112f3 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/examples/test/no_ruby/TestProductionCode_Runner.c @@ -0,0 +1,50 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ +#include "unity.h" +#include +#include + +char MessageBuffer[50]; + +extern void setUp(void); +extern void tearDown(void); + +extern void test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode(void); +extern void test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken(void); +extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue(void); +extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain(void); +extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed(void); + +static void runTest(UnityTestFunction test) +{ + if (TEST_PROTECT()) + { + setUp(); + test(); + } + if (TEST_PROTECT() && !TEST_IS_IGNORED) + { + tearDown(); + } +} +void resetTest() +{ + tearDown(); + setUp(); +} + + +int main(void) +{ + Unity.TestFile = "test/TestProductionCode.c"; + UnityBegin(); + + // RUN_TEST calls runTest + RUN_TEST(test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode, 20); + RUN_TEST(test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken, 30); + RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue, 41); + RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain, 51); + RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed, 57); + + UnityEnd(); + return 0; +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/build/MakefileWorker.mk b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/build/MakefileWorker.mk new file mode 100644 index 0000000..9948751 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/build/MakefileWorker.mk @@ -0,0 +1,331 @@ +#--------- +# +# MakefileWorker.mk +# +# Include this helper file in your makefile +# It makes +# A static library holding the application objs +# A test executable +# +# See this example for parameter settings +# examples/Makefile +# +#---------- +# Inputs - these variables describe what to build +# +# INCLUDE_DIRS - Directories used to search for include files. +# This generates a -I for each directory +# SRC_DIRS - Directories containing source file to built into the library +# SRC_FILES - Specific source files to build into library. Helpful when not all code +# in a directory can be built for test (hopefully a temporary situation) +# TEST_SRC_DIRS - Directories containing unit test code build into the unit test runner +# These do not go in a library. They are explicitly included in the test runner +# MOCKS_SRC_DIRS - Directories containing mock source files to build into the test runner +# These do not go in a library. They are explicitly included in the test runner +#---------- +# You can adjust these variables to influence how to build the test target +# and where to put and name outputs +# See below to determine defaults +# COMPONENT_NAME - the name of the thing being built +# UNITY_HOME - where Unity home dir found +# UNITY_BUILD_HOME - place for scripts +# UNITY_OBJS_DIR - a directory where o and d files go +# UNITY_LIB_DIR - a directory where libs go +# UNITY_ENABLE_DEBUG - build for debug +# UNITY_USE_MEM_LEAK_DETECTION - Links with overridden new and delete +# UNITY_USE_STD_CPP_LIB - Set to N to keep the standard C++ library out +# of the test harness +# UNITY_USE_GCOV - Turn on coverage analysis +# Clean then build with this flag set to Y, then 'make gcov' +# UNITY_TEST_RUNNER_FLAGS +# None by default +# UNITY_MAPFILE - generate a map file +# UNITY_WARNINGFLAGS - overly picky by default +# OTHER_MAKEFILE_TO_INCLUDE - a hook to use this makefile to make +# other targets. Like CSlim, which is part of fitnesse +#---------- +# +# Other flags users can initialize to sneak in their settings +# UNITY_CFLAGS - C complier +# UNITY_LDFLAGS - Linker flags +#---------- + + +ifndef COMPONENT_NAME + COMPONENT_NAME = name_this_in_the_makefile +endif + +# Debug on by default +ifndef UNITY_ENABLE_DEBUG + UNITY_ENABLE_DEBUG = Y +endif + +# new and delete for memory leak detection on by default +ifndef UNITY_USE_MEM_LEAK_DETECTION + UNITY_USE_MEM_LEAK_DETECTION = Y +endif + +# Use gcov, off by default +ifndef UNITY_USE_GCOV + UNITY_USE_GCOV = N +endif + +# Default warnings +ifndef UNITY_WARNINGFLAGS + UNITY_WARNINGFLAGS = -Wall -Werror -Wshadow -Wswitch-default +endif + +# Default dir for temporary files (d, o) +ifndef UNITY_OBJS_DIR + UNITY_OBJS_DIR = objs +endif + +# Default dir for the outout library +ifndef UNITY_LIB_DIR + UNITY_LIB_DIR = lib +endif + +# No map by default +ifndef UNITY_MAP_FILE + UNITY_MAP_FILE = N +endif + +#Not verbose by deafult +ifdef VERBOSE + UNITY_TEST_RUNNER_FLAGS += -v +endif + +ifdef GROUP + UNITY_TEST_RUNNER_FLAGS += -g $(GROUP) +endif + +ifdef NAME + UNITY_TEST_RUNNER_FLAGS += -n $(NAME) +endif + +ifdef REPEAT + UNITY_TEST_RUNNER_FLAGS += -r $(REPEAT) +endif + + +# -------------------------------------- +# derived flags in the following area +# -------------------------------------- +ifeq ($(UNITY_USE_MEM_LEAK_DETECTION), N) + UNITY_CFLAGS += -DUNITY_MEM_LEAK_DETECTION_DISABLED +else + UNITY_MEMLEAK_DETECTOR_MALLOC_MACRO_FILE = -include $(UNITY_HOME)/extras/fixture/src/unity_fixture_malloc_overrides.h +endif + +ifeq ($(UNITY_ENABLE_DEBUG), Y) + UNITY_CFLAGS += -g +endif + +ifeq ($(UNITY_USE_GCOV), Y) + UNITY_CFLAGS += -fprofile-arcs -ftest-coverage +endif + +UNITY_CFLAGS += $(UNITY_MEMLEAK_DETECTOR_MALLOC_MACRO_FILE) + +TARGET_MAP = $(COMPONENT_NAME).map.txt +ifeq ($(UNITY_MAP_FILE), Y) + UNITY_LDFLAGS += -Wl,-map,$(TARGET_MAP) +endif + +LD_LIBRARIES += -lgcov + +TARGET_LIB = \ + $(UNITY_LIB_DIR)/lib$(COMPONENT_NAME).a + +TEST_TARGET = \ + $(COMPONENT_NAME)_tests + +#Helper Functions +get_src_from_dir = $(wildcard $1/*.cpp) $(wildcard $1/*.c) +get_dirs_from_dirspec = $(wildcard $1) +get_src_from_dir_list = $(foreach dir, $1, $(call get_src_from_dir,$(dir))) +__src_to = $(subst .c,$1, $(subst .cpp,$1,$2)) +src_to = $(addprefix $(UNITY_OBJS_DIR)/,$(call __src_to,$1,$2)) +src_to_o = $(call src_to,.o,$1) +src_to_d = $(call src_to,.d,$1) +src_to_gcda = $(call src_to,.gcda,$1) +src_to_gcno = $(call src_to,.gcno,$1) +make_dotdot_a_subdir = $(subst ..,_dot_dot, $1) +time = $(shell date +%s) +delta_t = $(eval minus, $1, $2) +debug_print_list = $(foreach word,$1,echo " $(word)";) echo; + +#Derived +STUFF_TO_CLEAN += $(TEST_TARGET) $(TEST_TARGET).exe $(TARGET_LIB) $(TARGET_MAP) + +SRC += $(call get_src_from_dir_list, $(SRC_DIRS)) $(SRC_FILES) +OBJ = $(call src_to_o,$(SRC)) +OBJ2 = $(call make_dotdot_a_subdir. $(OBJ)) + +STUFF_TO_CLEAN += $(OBJ) + +TEST_SRC = $(call get_src_from_dir_list, $(TEST_SRC_DIRS)) +TEST_OBJS = $(call src_to_o,$(TEST_SRC)) +STUFF_TO_CLEAN += $(TEST_OBJS) + + +MOCKS_SRC = $(call get_src_from_dir_list, $(MOCKS_SRC_DIRS)) +MOCKS_OBJS = $(call src_to_o,$(MOCKS_SRC)) +STUFF_TO_CLEAN += $(MOCKS_OBJS) + +ALL_SRC = $(SRC) $(TEST_SRC) $(MOCKS_SRC) + +#Test coverage with gcov +GCOV_OUTPUT = gcov_output.txt +GCOV_REPORT = gcov_report.txt +GCOV_ERROR = gcov_error.txt +GCOV_GCDA_FILES = $(call src_to_gcda, $(ALL_SRC)) +GCOV_GCNO_FILES = $(call src_to_gcno, $(ALL_SRC)) +TEST_OUTPUT = $(TEST_TARGET).txt +STUFF_TO_CLEAN += \ + $(GCOV_OUTPUT)\ + $(GCOV_REPORT)\ + $(GCOV_REPORT).html\ + $(GCOV_ERROR)\ + $(GCOV_GCDA_FILES)\ + $(GCOV_GCNO_FILES)\ + $(TEST_OUTPUT) + + +#The gcda files for gcov need to be deleted before each run +#To avoid annoying messages. +GCOV_CLEAN = $(SILENCE)rm -f $(GCOV_GCDA_FILES) $(GCOV_OUTPUT) $(GCOV_REPORT) $(GCOV_ERROR) +RUN_TEST_TARGET = $(SILENCE) $(GCOV_CLEAN) ; echo "Running $(TEST_TARGET)"; ./$(TEST_TARGET) $(UNITY_TEST_RUNNER_FLAGS) + +INCLUDES_DIRS_EXPANDED = $(call get_dirs_from_dirspec, $(INCLUDE_DIRS)) +INCLUDES += $(foreach dir, $(INCLUDES_DIRS_EXPANDED), -I$(dir)) +MOCK_DIRS_EXPANDED = $(call get_dirs_from_dirspec, $(MOCKS_SRC_DIRS)) +INCLUDES += $(foreach dir, $(MOCK_DIRS_EXPANDED), -I$(dir)) + + +DEP_FILES = $(call src_to_d, $(ALL_SRC)) +STUFF_TO_CLEAN += $(DEP_FILES) $(PRODUCTION_CODE_START) $(PRODUCTION_CODE_END) +STUFF_TO_CLEAN += $(STDLIB_CODE_START) $(MAP_FILE) cpputest_*.xml junit_run_output + +# We'll use the UNITY_CFLAGS etc so that you can override AND add to the CppUTest flags +CFLAGS = $(UNITY_CFLAGS) $(UNITY_ADDITIONAL_CFLAGS) $(INCLUDES) $(UNITY_WARNINGFLAGS) +LDFLAGS = $(UNITY_LDFLAGS) $(UNITY_ADDITIONAL_LDFLAGS) + +# Targets + +.PHONY: all +all: start $(TEST_TARGET) + $(RUN_TEST_TARGET) + +.PHONY: start +start: $(TEST_TARGET) + $(SILENCE)START_TIME=$(call time) + +.PHONY: all_no_tests +all_no_tests: $(TEST_TARGET) + +.PHONY: flags +flags: + @echo + @echo "Compile C source with CFLAGS:" + @$(call debug_print_list,$(CFLAGS)) + @echo "Link with LDFLAGS:" + @$(call debug_print_list,$(LDFLAGS)) + @echo "Link with LD_LIBRARIES:" + @$(call debug_print_list,$(LD_LIBRARIES)) + @echo "Create libraries with ARFLAGS:" + @$(call debug_print_list,$(ARFLAGS)) + @echo "OBJ files:" + @$(call debug_print_list,$(OBJ2)) + + +$(TEST_TARGET): $(TEST_OBJS) $(MOCKS_OBJS) $(PRODUCTION_CODE_START) $(TARGET_LIB) $(USER_LIBS) $(PRODUCTION_CODE_END) $(STDLIB_CODE_START) + $(SILENCE)echo Linking $@ + $(SILENCE)$(LINK.o) -o $@ $^ $(LD_LIBRARIES) + +$(TARGET_LIB): $(OBJ) + $(SILENCE)echo Building archive $@ + $(SILENCE)mkdir -p lib + $(SILENCE)$(AR) $(ARFLAGS) $@ $^ + $(SILENCE)ranlib $@ + +test: $(TEST_TARGET) + $(RUN_TEST_TARGET) | tee $(TEST_OUTPUT) + +vtest: $(TEST_TARGET) + $(RUN_TEST_TARGET) -v | tee $(TEST_OUTPUT) + +$(UNITY_OBJS_DIR)/%.o: %.cpp + @echo compiling $(notdir $<) + $(SILENCE)mkdir -p $(dir $@) + $(SILENCE)$(COMPILE.cpp) -MMD -MP $(OUTPUT_OPTION) $< + +$(UNITY_OBJS_DIR)/%.o: %.c + @echo compiling $(notdir $<) + $(SILENCE)mkdir -p $(dir $@) + $(SILENCE)$(COMPILE.c) -MMD -MP $(OUTPUT_OPTION) $< + +ifneq "$(MAKECMDGOALS)" "clean" +-include $(DEP_FILES) +endif + +.PHONY: clean +clean: + $(SILENCE)echo Making clean + $(SILENCE)$(RM) $(STUFF_TO_CLEAN) + $(SILENCE)rm -rf gcov $(UNITY_OBJS_DIR) + $(SILENCE)find . -name "*.gcno" | xargs rm -f + $(SILENCE)find . -name "*.gcda" | xargs rm -f + +#realclean gets rid of all gcov, o and d files in the directory tree +#not just the ones made by this makefile +.PHONY: realclean +realclean: clean + $(SILENCE)rm -rf gcov + $(SILENCE)find . -name "*.gdcno" | xargs rm -f + $(SILENCE)find . -name "*.[do]" | xargs rm -f + +gcov: test + $(SILENCE)for d in $(SRC_DIRS) ; do \ + gcov --object-directory $(UNITY_OBJS_DIR)/$$d $$d/*.c $$d/*.cpp >> $(GCOV_OUTPUT) 2>>$(GCOV_ERROR) ; \ + done + $(SILENCE)for f in $(SRC_FILES) ; do \ + gcov --object-directory $(UNITY_OBJS_DIR)/$$f $$f >> $(GCOV_OUTPUT) 2>>$(GCOV_ERROR) ; \ + done + $(UNITY_BUILD_HOME)/filterGcov.sh $(GCOV_OUTPUT) $(GCOV_ERROR) $(GCOV_REPORT) $(TEST_OUTPUT) + $(SILENCE)cat $(GCOV_REPORT) + $(SILENCE)mkdir -p gcov + $(SILENCE)mv *.gcov gcov + $(SILENCE)mv gcov_* gcov + $(SILENCE)echo "See gcov directory for details" + +debug: + @echo + @echo "Target Source files:" + @$(call debug_print_list,$(SRC)) + @echo "Target Object files:" + @$(call debug_print_list,$(OBJ)) + @echo "Test Source files:" + @$(call debug_print_list,$(TEST_SRC)) + @echo "Test Object files:" + @$(call debug_print_list,$(TEST_OBJS)) + @echo "Mock Source files:" + @$(call debug_print_list,$(MOCKS_SRC)) + @echo "Mock Object files:" + @$(call debug_print_list,$(MOCKS_OBJS)) + @echo "All Input Dependency files:" + @$(call debug_print_list,$(DEP_FILES)) + @echo Stuff to clean: + @$(call debug_print_list,$(STUFF_TO_CLEAN)) + @echo Includes: + @$(call debug_print_list,$(INCLUDES)) + +ifneq "$(OTHER_MAKEFILE_TO_INCLUDE)" "" +-include $(OTHER_MAKEFILE_TO_INCLUDE) +endif + + + +st,$(TEST_SRC)) + @echo "Test Object files:" + @$(call debug_print \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/build/filterGcov.sh b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/build/filterGcov.sh new file mode 100644 index 0000000..a861cf6 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/build/filterGcov.sh @@ -0,0 +1,61 @@ +#!/bin/bash +INPUT_FILE=$1 +TEMP_FILE1=${INPUT_FILE}1.tmp +TEMP_FILE2=${INPUT_FILE}2.tmp +TEMP_FILE3=${INPUT_FILE}3.tmp +ERROR_FILE=$2 +OUTPUT_FILE=$3 +HTML_OUTPUT_FILE=$3.html +TEST_RESULTS=$4 + +flattenGcovOutput() { +while read line1 +do + read line2 + echo $line2 " " $line1 + read junk + read junk +done < ${INPUT_FILE} +} + +getRidOfCruft() { +sed '-e s/^Lines.*://g' \ + '-e s/^[0-9]\./ &/g' \ + '-e s/^[0-9][0-9]\./ &/g' \ + '-e s/of.*File/ /g' \ + "-e s/'//g" \ + '-e s/^.*\/usr\/.*$//g' \ + '-e s/^.*\.$//g' +} + +getFileNameRootFromErrorFile() { +sed '-e s/gc..:cannot open .* file//g' ${ERROR_FILE} +} + +writeEachNoTestCoverageFile() { +while read line +do + echo " 0.00% " ${line} +done +} + +createHtmlOutput() { + echo "" + echo "" + sed "-e s/.*% /
CoverageFile
&<\/td>/" \ + "-e s/[a-zA-Z0-9_]*\.[ch][a-z]*/&<\/a><\/td><\/tr>/" + echo "
" + sed "-e s/.*/&
/g" < ${TEST_RESULTS} +} + + +flattenGcovOutput | getRidOfCruft > ${TEMP_FILE1} +getFileNameRootFromErrorFile | writeEachNoTestCoverageFile > ${TEMP_FILE2} +cat ${TEMP_FILE1} ${TEMP_FILE2} | sort | uniq > ${OUTPUT_FILE} +createHtmlOutput < ${OUTPUT_FILE} > ${HTML_OUTPUT_FILE} +rm -f ${TEMP_FILE1} ${TEMP_FILE2} +erageFile" + sed "-e s/.*% /&<\/td>/" \ + "-e s/[a-zA-Z0-9_]*\.[ch][a-z]*/
&<\/a><\/td><\/tr>/" + echo "" + sed "-e s/.*/&
/g" < ${TEST_RESULTS \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/rakefile.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/rakefile.rb new file mode 100644 index 0000000..6181707 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/rakefile.rb @@ -0,0 +1,37 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require HERE + 'rakefile_helper' + +include RakefileHelpers + +# Load default configuration, for now +DEFAULT_CONFIG_FILE = 'gcc.yml' +configure_toolchain(DEFAULT_CONFIG_FILE) + +task :unit do + run_tests +end + +desc "Build and test Unity Framework" +task :all => [:clean, :unit] +task :default => [:clobber, :all] +task :ci => [:no_color, :default] +task :cruise => [:no_color, :default] + +desc "Load configuration" +task :config, :config_file do |t, args| + configure_toolchain(args[:config_file]) +end + +task :no_color do + $colour_output = false +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/rakefile_helper.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/rakefile_helper.rb new file mode 100644 index 0000000..a7f6a28 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/rakefile_helper.rb @@ -0,0 +1,178 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require 'yaml' +require 'fileutils' +require HERE+'../../auto/unity_test_summary' +require HERE+'../../auto/generate_test_runner' +require HERE+'../../auto/colour_reporter' + +module RakefileHelpers + + C_EXTENSION = '.c' + + def load_configuration(config_file) + unless ($configured) + $cfg_file = HERE+"../../targets/#{config_file}" unless (config_file =~ /[\\|\/]/) + $cfg = YAML.load(File.read($cfg_file)) + $colour_output = false unless $cfg['colour'] + $configured = true if (config_file != DEFAULT_CONFIG_FILE) + end + end + + def configure_clean + CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil? + end + + def configure_toolchain(config_file=DEFAULT_CONFIG_FILE) + config_file += '.yml' unless config_file =~ /\.yml$/ + config_file = config_file unless config_file =~ /[\\|\/]/ + load_configuration(config_file) + configure_clean + end + + def tackit(strings) + if strings.is_a?(Array) + result = "\"#{strings.join}\"" + else + result = strings + end + return result + end + + def squash(prefix, items) + result = '' + items.each { |item| result += " #{prefix}#{tackit(item)}" } + return result + end + + def build_compiler_fields + command = tackit($cfg['compiler']['path']) + if $cfg['compiler']['defines']['items'].nil? + defines = '' + else + defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items'] + ['UNITY_OUTPUT_CHAR=UnityOutputCharSpy_OutputChar']) + end + options = squash('', $cfg['compiler']['options']) + includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :defines => defines, :options => options, :includes => includes} + end + + def compile(file, defines=[]) + compiler = build_compiler_fields + unity_include = $cfg['compiler']['includes']['prefix']+'../../src' + cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{unity_include} #{file} " + + "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" + + "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" + execute(cmd_str) + end + + def build_linker_fields + command = tackit($cfg['linker']['path']) + if $cfg['linker']['options'].nil? + options = '' + else + options = squash('', $cfg['linker']['options']) + end + if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?) + includes = '' + else + includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) + end + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :options => options, :includes => includes} + end + + def link(exe_name, obj_list) + linker = build_linker_fields + cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + + (obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).join + + $cfg['linker']['bin_files']['prefix'] + ' ' + + $cfg['linker']['bin_files']['destination'] + + exe_name + $cfg['linker']['bin_files']['extension'] + execute(cmd_str) + end + + def build_simulator_fields + return nil if $cfg['simulator'].nil? + if $cfg['simulator']['path'].nil? + command = '' + else + command = (tackit($cfg['simulator']['path']) + ' ') + end + if $cfg['simulator']['pre_support'].nil? + pre_support = '' + else + pre_support = squash('', $cfg['simulator']['pre_support']) + end + if $cfg['simulator']['post_support'].nil? + post_support = '' + else + post_support = squash('', $cfg['simulator']['post_support']) + end + return {:command => command, :pre_support => pre_support, :post_support => post_support} + end + + def execute(command_string, verbose=true) + report command_string + output = `#{command_string}`.chomp + report(output) if (verbose && !output.nil? && (output.length > 0)) + if ($?.exitstatus != 0) + raise "Command failed. (Returned #{$?.exitstatus})" + end + return output + end + + def report_summary + summary = UnityTestSummary.new + summary.set_root_path(HERE) + results_glob = "#{$cfg['compiler']['build_path']}*.test*" + results_glob.gsub!(/\\/, '/') + results = Dir[results_glob] + summary.set_targets(results) + summary.run + end + + def run_tests + report 'Running Unity system tests...' + + # Tack on TEST define for compiling unit tests + load_configuration($cfg_file) + test_defines = ['TEST'] + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + + # Get a list of all source files needed + src_files = Dir[HERE+'src/*.c'] + src_files += Dir[HERE+'test/*.c'] + src_files << '../../src/Unity.c' + + # Build object files + src_files.each { |f| compile(f, test_defines) } + obj_list = src_files.map {|f| File.basename(f.ext($cfg['compiler']['object_files']['extension'])) } + + # Link the test executable + test_base = "framework_test" + link(test_base, obj_list) + + # Execute unit test and generate results file + simulator = build_simulator_fields + executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] + if simulator.nil? + cmd_str = executable + " -v -r" + else + cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" + end + output = execute(cmd_str) + test_results = $cfg['compiler']['build_path'] + test_base + if output.match(/OK$/m).nil? + test_results += '.testfail' + else + test_results += '.testpass' + end + File.open(test_results, 'w') { |f| f.print output } + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/readme.txt b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/readme.txt new file mode 100644 index 0000000..6b9a78c --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/readme.txt @@ -0,0 +1,9 @@ +Copyright (c) 2010 James Grenning and Contributed to Unity Project + +Unity Project - A Test Framework for C +Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +[Released under MIT License. Please refer to license.txt for details] + +This Framework is an optional add-on to Unity. By including unity_framework.h in place of unity.h, +you may now work with Unity in a manner similar to CppUTest. This framework adds the concepts of +test groups and gives finer control of your tests over the command line. \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.c new file mode 100644 index 0000000..1ba3e9a --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.c @@ -0,0 +1,381 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" +#include "unity_internals.h" +#include + +UNITY_FIXTURE_T UnityFixture; + +//If you decide to use the function pointer approach. +int (*outputChar)(int) = putchar; + +int verbose = 0; + +void setUp(void) { /*does nothing*/ } +void tearDown(void) { /*does nothing*/ } + +void announceTestRun(int runNumber) +{ + UnityPrint("Unity test run "); + UnityPrintNumber(runNumber+1); + UnityPrint(" of "); + UnityPrintNumber(UnityFixture.RepeatCount); + UNITY_OUTPUT_CHAR('\n'); +} + +int UnityMain(int argc, char* argv[], void (*runAllTests)()) +{ + int result = UnityGetCommandLineOptions(argc, argv); + int r; + if (result != 0) + return result; + + for (r = 0; r < UnityFixture.RepeatCount; r++) + { + announceTestRun(r); + UnityBegin(); + runAllTests(); + UNITY_OUTPUT_CHAR('\n'); + UnityEnd(); + } + + return UnityFailureCount(); +} + +static int selected(const char * filter, const char * name) +{ + if (filter == 0) + return 1; + return strstr(name, filter) ? 1 : 0; +} + +static int testSelected(const char* test) +{ + return selected(UnityFixture.NameFilter, test); +} + +static int groupSelected(const char* group) +{ + return selected(UnityFixture.GroupFilter, group); +} + +static void runTestCase() +{ + +} + +void UnityTestRunner(unityfunction* setup, + unityfunction* testBody, + unityfunction* teardown, + const char * printableName, + const char * group, + const char * name, + const char * file, int line) +{ + if (testSelected(name) && groupSelected(group)) + { + Unity.CurrentTestFailed = 0; + Unity.TestFile = file; + Unity.CurrentTestName = printableName; + Unity.CurrentTestLineNumber = line; + if (!UnityFixture.Verbose) + UNITY_OUTPUT_CHAR('.'); + else + UnityPrint(printableName); + + Unity.NumberOfTests++; + UnityMalloc_StartTest(); + UnityPointer_Init(); + + runTestCase(); + if (TEST_PROTECT()) + { + setup(); + testBody(); + } + if (TEST_PROTECT()) + { + teardown(); + } + if (TEST_PROTECT()) + { + UnityPointer_UndoAllSets(); + if (!Unity.CurrentTestFailed) + UnityMalloc_EndTest(); + UnityConcludeFixtureTest(); + } + else + { + //aborting - jwg - di i need these for the other TEST_PROTECTS? + } + } +} + +void UnityIgnoreTest() +{ + Unity.NumberOfTests++; + Unity.CurrentTestIgnored = 1; + UNITY_OUTPUT_CHAR('!'); +} + + +//------------------------------------------------- +//Malloc and free stuff +// +#define MALLOC_DONT_FAIL -1 +static int malloc_count; +static int malloc_fail_countdown = MALLOC_DONT_FAIL; + +void UnityMalloc_StartTest() +{ + malloc_count = 0; + malloc_fail_countdown = MALLOC_DONT_FAIL; +} + +void UnityMalloc_EndTest() +{ + malloc_fail_countdown = MALLOC_DONT_FAIL; + if (malloc_count != 0) + { + TEST_FAIL_MESSAGE("This test leaks!"); + } +} + +void UnityMalloc_MakeMallocFailAfterCount(int countdown) +{ + malloc_fail_countdown = countdown; +} + +#ifdef malloc +#undef malloc +#endif + +#ifdef free +#undef free +#endif + +#include +#include + +typedef struct GuardBytes +{ + int size; + char guard[sizeof(int)]; +} Guard; + + +static const char * end = "END"; + +void * unity_malloc(size_t size) +{ + char* mem; + Guard* guard; + + if (malloc_fail_countdown != MALLOC_DONT_FAIL) + { + if (malloc_fail_countdown == 0) + return 0; + malloc_fail_countdown--; + } + + malloc_count++; + + guard = (Guard*)malloc(size + sizeof(Guard) + 4); + guard->size = size; + mem = (char*)&(guard[1]); + memcpy(&mem[size], end, strlen(end) + 1); + + return (void*)mem; +} + +static int isOverrun(void * mem) +{ + Guard* guard = (Guard*)mem; + char* memAsChar = (char*)mem; + guard--; + + return strcmp(&memAsChar[guard->size], end) != 0; +} + +static void release_memory(void * mem) +{ + Guard* guard = (Guard*)mem; + guard--; + + malloc_count--; + free(guard); +} + +void unity_free(void * mem) +{ + int overrun = isOverrun(mem);//strcmp(&memAsChar[guard->size], end) != 0; + release_memory(mem); + if (overrun) + { + TEST_FAIL_MESSAGE("Buffer overrun detected during free()"); + } +} + +void* unity_calloc(size_t num, size_t size) +{ + void* mem = unity_malloc(num * size); + memset(mem, 0, num*size); + return mem; +} + +void* unity_realloc(void * oldMem, size_t size) +{ + Guard* guard = (Guard*)oldMem; +// char* memAsChar = (char*)oldMem; + void* newMem; + + if (oldMem == 0) + return unity_malloc(size); + + guard--; + if (isOverrun(oldMem)) + { + release_memory(oldMem); + TEST_FAIL_MESSAGE("Buffer overrun detected during realloc()"); + } + + if (size == 0) + { + release_memory(oldMem); + return 0; + } + + if (guard->size >= size) + return oldMem; + + newMem = unity_malloc(size); + memcpy(newMem, oldMem, size); + unity_free(oldMem); + return newMem; +} + + +//-------------------------------------------------------- +//Automatic pointer restoration functions +typedef struct _PointerPair +{ + struct _PointerPair * next; + void ** pointer; + void * old_value; +} PointerPair; + +enum {MAX_POINTERS=50}; +static PointerPair pointer_store[MAX_POINTERS]; +static int pointer_index = 0; + +void UnityPointer_Init() +{ + pointer_index = 0; +} + +void UnityPointer_Set(void ** pointer, void * newValue) +{ + if (pointer_index >= MAX_POINTERS) + TEST_FAIL_MESSAGE("Too many pointers set"); + + pointer_store[pointer_index].pointer = pointer; + pointer_store[pointer_index].old_value = *pointer; + *pointer = newValue; + pointer_index++; +} + +void UnityPointer_UndoAllSets() +{ + while (pointer_index > 0) + { + pointer_index--; + *(pointer_store[pointer_index].pointer) = + pointer_store[pointer_index].old_value; + + } +} + +int UnityFailureCount() +{ + return Unity.TestFailures; +} + +int UnityGetCommandLineOptions(int argc, char* argv[]) +{ + int i; + UnityFixture.Verbose = 0; + UnityFixture.GroupFilter = 0; + UnityFixture.NameFilter = 0; + UnityFixture.RepeatCount = 1; + + if (argc == 1) + return 0; + + for (i = 1; i < argc; ) + { + if (strcmp(argv[i], "-v") == 0) + { + UnityFixture.Verbose = 1; + i++; + } + else if (strcmp(argv[i], "-g") == 0) + { + i++; + if (i >= argc) + return 1; + UnityFixture.GroupFilter = argv[i]; + i++; + } + else if (strcmp(argv[i], "-n") == 0) + { + i++; + if (i >= argc) + return 1; + UnityFixture.NameFilter = argv[i]; + i++; + } + else if (strcmp(argv[i], "-r") == 0) + { + UnityFixture.RepeatCount = 2; + i++; + if (i < argc) + { + if (*(argv[i]) >= '0' && *(argv[i]) <= '9') + { + UnityFixture.RepeatCount = atoi(argv[i]); + i++; + } + } + } + } + return 0; +} + +void UnityConcludeFixtureTest() +{ + if (Unity.CurrentTestIgnored) + { + Unity.TestIgnores++; + } + else if (!Unity.CurrentTestFailed) + { + if (UnityFixture.Verbose) + { + UnityPrint(" PASS"); + UNITY_OUTPUT_CHAR('\n'); + } + } + else if (Unity.CurrentTestFailed) + { + Unity.TestFailures++; + } + + Unity.CurrentTestFailed = 0; + Unity.CurrentTestIgnored = 0; +} + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.h new file mode 100644 index 0000000..da1f871 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.h @@ -0,0 +1,81 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FIXTURE_H_ +#define UNITY_FIXTURE_H_ + +#include "unity.h" +#include "unity_internals.h" +#include "unity_fixture_malloc_overrides.h" +#include "unity_fixture_internals.h" + +int UnityMain(int argc, char* argv[], void (*runAllTests)()); + + +#define TEST_GROUP(group)\ + int TEST_GROUP_##group = 0 + +#define TEST_SETUP(group) void TEST_##group##_SETUP() + +#define TEST_TEAR_DOWN(group) void TEST_##group##_TEAR_DOWN() + + +#define TEST(group, name) \ + void TEST_##group##_##name##_();\ + void TEST_##group##_##name##_run()\ + {\ + UnityTestRunner(TEST_##group##_SETUP,\ + TEST_##group##_##name##_,\ + TEST_##group##_TEAR_DOWN,\ + "TEST(" #group ", " #name ")",\ + #group, #name,\ + __FILE__, __LINE__);\ + }\ + void TEST_##group##_##name##_() + +#define IGNORE_TEST(group, name) \ + void TEST_##group##_##name##_();\ + void TEST_##group##_##name##_run()\ + {\ + UnityIgnoreTest();\ + }\ + void TEST_##group##_##name##_() + +#define DECLARE_TEST_CASE(group, name) \ + void TEST_##group##_##name##_run() + +#define RUN_TEST_CASE(group, name) \ + DECLARE_TEST_CASE(group, name);\ + TEST_##group##_##name##_run(); + +//This goes at the bottom of each test file or in a separate c file +#define TEST_GROUP_RUNNER(group)\ + void TEST_##group##_GROUP_RUNNER_runAll();\ + void TEST_##group##_GROUP_RUNNER()\ + {\ + TEST_##group##_GROUP_RUNNER_runAll();\ + }\ + void TEST_##group##_GROUP_RUNNER_runAll() + +//Call this from main +#define RUN_TEST_GROUP(group)\ + void TEST_##group##_GROUP_RUNNER();\ + TEST_##group##_GROUP_RUNNER(); + +//CppUTest Compatibility Macros +#define UT_PTR_SET(ptr, newPointerValue) UnityPointer_Set((void**)&ptr, (void*)newPointerValue) +#define TEST_ASSERT_POINTERS_EQUAL(expected, actual) TEST_ASSERT_EQUAL_PTR(expected, actual) +#define TEST_ASSERT_BYTES_EQUAL(expected, actual) TEST_ASSERT_EQUAL_HEX8(0xff & (expected), 0xff & (actual)) +#define FAIL(message) TEST_FAIL((message)) +#define CHECK(condition) TEST_ASSERT_TRUE((condition)) +#define LONGS_EQUAL(expected, actual) TEST_ASSERT_EQUAL_INT((expected), (actual)) +#define STRCMP_EQUAL(expected, actual) TEST_ASSERT_EQUAL_STRING((expected), (actual)) +#define DOUBLES_EQUAL(expected, actual, delta) TEST_ASSERT_FLOAT_WITHIN(((expected), (actual), (delta)) + +void UnityMalloc_MakeMallocFailAfterCount(int count); + +#endif /* UNITY_FIXTURE_H_ */ diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_internals.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_internals.h new file mode 100644 index 0000000..db23f67 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_internals.h @@ -0,0 +1,44 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FIXTURE_INTERNALS_H_ +#define UNITY_FIXTURE_INTERNALS_H_ + +typedef struct _UNITY_FIXTURE_T +{ + int Verbose; + unsigned int RepeatCount; + const char* NameFilter; + const char* GroupFilter; +} UNITY_FIXTURE_T; + +typedef void unityfunction(); +void UnityTestRunner(unityfunction * setup, + unityfunction * body, + unityfunction * teardown, + const char * printableName, + const char * group, + const char * name, + const char * file, int line); + +void UnityIgnoreTest(); +void UnityMalloc_StartTest(); +void UnityMalloc_EndTest(); +int UnityFailureCount(); +int UnityGetCommandLineOptions(int argc, char* argv[]); +void UnityConcludeFixtureTest(); + +void UnityPointer_Set(void ** ptr, void * newValue); +void UnityPointer_UndoAllSets(); +void UnityPointer_Init(); + +void UnityAssertEqualPointer(const void * expected, + const void * actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +#endif /* UNITY_FIXTURE_INTERNALS_H_ */ diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h new file mode 100644 index 0000000..38f8e34 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h @@ -0,0 +1,16 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FIXTURE_MALLOC_OVERRIDES_H_ +#define UNITY_FIXTURE_MALLOC_OVERRIDES_H_ + +#define malloc unity_malloc +#define calloc unity_calloc +#define realloc unity_realloc +#define free unity_free + +#endif /* UNITY_FIXTURE_MALLOC_OVERRIDES_H_ */ diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/main/AllTests.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/main/AllTests.c new file mode 100644 index 0000000..ccb775b --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/main/AllTests.c @@ -0,0 +1,21 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" + +static void runAllTests() +{ + RUN_TEST_GROUP(UnityFixture); + RUN_TEST_GROUP(UnityCommandOptions); + RUN_TEST_GROUP(LeakDetection) +} + +int main(int argc, char* argv[]) +{ + return UnityMain(argc, argv, runAllTests); +} + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/testunity_fixture.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/testunity_fixture.c new file mode 100644 index 0000000..de0c04c --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/testunity_fixture.c @@ -0,0 +1,39 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" + +static int data = -1; + +TEST_GROUP(mygroup); + +TEST_SETUP(mygroup) +{ + data = 0; +} + +TEST_TEAR_DOWN(mygroup) +{ + data = -1; +} + +TEST(mygroup, test1) +{ + TEST_ASSERT_EQUAL_INT(0, data); +} + +TEST(mygroup, test2) +{ + TEST_ASSERT_EQUAL_INT(0, data); + data = 5; +} + +TEST(mygroup, test3) +{ + data = 7; + TEST_ASSERT_EQUAL_INT(7, data); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_Test.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_Test.c new file mode 100644 index 0000000..b8b4524 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_Test.c @@ -0,0 +1,321 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" +#include "unity_output_Spy.h" +#include +#include + +extern UNITY_FIXTURE_T UnityFixture; + +TEST_GROUP(UnityFixture); + +TEST_SETUP(UnityFixture) +{ +} + +TEST_TEAR_DOWN(UnityFixture) +{ +} + +int my_int; +int* pointer1 = 0; +int* pointer2 = (int*)2; +int* pointer3 = (int*)3; +int int1; +int int2; +int int3; +int int4; + +TEST(UnityFixture, PointerSetting) +{ + TEST_ASSERT_POINTERS_EQUAL(pointer1, 0); + UT_PTR_SET(pointer1, &int1); + UT_PTR_SET(pointer2, &int2); + UT_PTR_SET(pointer3, &int3); + TEST_ASSERT_POINTERS_EQUAL(pointer1, &int1); + TEST_ASSERT_POINTERS_EQUAL(pointer2, &int2); + TEST_ASSERT_POINTERS_EQUAL(pointer3, &int3); + UT_PTR_SET(pointer1, &int4); + UnityPointer_UndoAllSets(); + TEST_ASSERT_POINTERS_EQUAL(pointer1, 0); + TEST_ASSERT_POINTERS_EQUAL(pointer2, (int*)2); + TEST_ASSERT_POINTERS_EQUAL(pointer3, (int*)3); +} + +TEST(UnityFixture, ForceMallocFail) +{ + UnityMalloc_MakeMallocFailAfterCount(1); + void* m = malloc(10); + CHECK(m); + void* mfails = malloc(10); + TEST_ASSERT_POINTERS_EQUAL(0, mfails); + free(m); +} + +TEST(UnityFixture, ReallocSmallerIsUnchanged) +{ + void* m1 = malloc(10); + void* m2 = realloc(m1, 5); + TEST_ASSERT_POINTERS_EQUAL(m1, m2); + free(m2); +} + +TEST(UnityFixture, ReallocSameIsUnchanged) +{ + void* m1 = malloc(10); + void* m2 = realloc(m1, 10); + TEST_ASSERT_POINTERS_EQUAL(m1, m2); + free(m2); +} + +TEST(UnityFixture, ReallocLargerNeeded) +{ + void* m1 = malloc(10); + strcpy((char*)m1, "123456789"); + void* m2 = realloc(m1, 15); + CHECK(m1 != m2); + STRCMP_EQUAL("123456789", m2); + free(m2); +} + +TEST(UnityFixture, ReallocNullPointerIsLikeMalloc) +{ + void* m = realloc(0, 15); + CHECK(m != 0); + free(m); +} + +TEST(UnityFixture, ReallocSizeZeroFreesMemAndReturnsNullPointer) +{ + void* m1 = malloc(10); + void* m2 = realloc(m1, 0); + TEST_ASSERT_POINTERS_EQUAL(0, m2); +} + +TEST(UnityFixture, CallocFillsWithZero) +{ + void* m = calloc(3, sizeof(char)); + char* s = (char*)m; + TEST_ASSERT_BYTES_EQUAL(0, s[0]); + TEST_ASSERT_BYTES_EQUAL(0, s[1]); + TEST_ASSERT_BYTES_EQUAL(0, s[2]); + free(m); +} + +char *p1; +char *p2; + +TEST(UnityFixture, PointerSet) +{ + char c1; + char c2; + char newC1; + char newC2; + p1 = &c1; + p2 = &c2; + + UnityPointer_Init(10); + UT_PTR_SET(p1, &newC1); + UT_PTR_SET(p2, &newC2); + TEST_ASSERT_POINTERS_EQUAL(&newC1, p1); + TEST_ASSERT_POINTERS_EQUAL(&newC2, p2); + UnityPointer_UndoAllSets(); + TEST_ASSERT_POINTERS_EQUAL(&c1, p1); + TEST_ASSERT_POINTERS_EQUAL(&c2, p2); +} + +//------------------------------------------------------------ + +TEST_GROUP(UnityCommandOptions); + +int savedVerbose; +int savedRepeat; +const char* savedName; +const char* savedGroup; + +TEST_SETUP(UnityCommandOptions) +{ + savedVerbose = UnityFixture.Verbose; + savedRepeat = UnityFixture.RepeatCount; + savedName = UnityFixture.NameFilter; + savedGroup = UnityFixture.GroupFilter; +} + +TEST_TEAR_DOWN(UnityCommandOptions) +{ + UnityFixture.Verbose = savedVerbose; + UnityFixture.RepeatCount= savedRepeat; + UnityFixture.NameFilter = savedName; + UnityFixture.GroupFilter = savedGroup; +} + + +static char* noOptions[] = { + "testrunner.exe" +}; + +TEST(UnityCommandOptions, DefaultOptions) +{ + UnityGetCommandLineOptions(1, noOptions); + TEST_ASSERT_EQUAL(0, UnityFixture.Verbose); + TEST_ASSERT_POINTERS_EQUAL(0, UnityFixture.GroupFilter); + TEST_ASSERT_POINTERS_EQUAL(0, UnityFixture.NameFilter); + TEST_ASSERT_EQUAL(1, UnityFixture.RepeatCount); +} + +static char* verbose[] = { + "testrunner.exe", + "-v" +}; + +TEST(UnityCommandOptions, OptionVerbose) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(2, verbose)); + TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); +} + +static char* group[] = { + "testrunner.exe", + "-g", "groupname" +}; + +TEST(UnityCommandOptions, OptionSelectTestByGroup) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, group)); + STRCMP_EQUAL("groupname", UnityFixture.GroupFilter); +} + +static char* name[] = { + "testrunner.exe", + "-n", "testname" +}; + +TEST(UnityCommandOptions, OptionSelectTestByName) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, name)); + STRCMP_EQUAL("testname", UnityFixture.NameFilter); +} + +static char* repeat[] = { + "testrunner.exe", + "-r", "99" +}; + +TEST(UnityCommandOptions, OptionSelectRepeatTestsDefaultCount) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(2, repeat)); + TEST_ASSERT_EQUAL(2, UnityFixture.RepeatCount); +} + +TEST(UnityCommandOptions, OptionSelectRepeatTestsSpecificCount) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, repeat)); + TEST_ASSERT_EQUAL(99, UnityFixture.RepeatCount); +} + +static char* multiple[] = { + "testrunner.exe", + "-v", + "-g", "groupname", + "-n", "testname", + "-r", "98" +}; + +TEST(UnityCommandOptions, MultipleOptions) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(8, multiple)); + TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); + STRCMP_EQUAL("groupname", UnityFixture.GroupFilter); + STRCMP_EQUAL("testname", UnityFixture.NameFilter); + TEST_ASSERT_EQUAL(98, UnityFixture.RepeatCount); +} + +static char* dashRNotLast[] = { + "testrunner.exe", + "-v", + "-g", "gggg", + "-r", + "-n", "tttt", +}; + +TEST(UnityCommandOptions, MultipleOptionsDashRNotLastAndNoValueSpecified) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(7, dashRNotLast)); + TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); + STRCMP_EQUAL("gggg", UnityFixture.GroupFilter); + STRCMP_EQUAL("tttt", UnityFixture.NameFilter); + TEST_ASSERT_EQUAL(2, UnityFixture.RepeatCount); +} + + +//------------------------------------------------------------ + +TEST_GROUP(LeakDetection); + +TEST_SETUP(LeakDetection) +{ + UnityOutputCharSpy_Create(1000); +} + +TEST_TEAR_DOWN(LeakDetection) +{ + UnityOutputCharSpy_Destroy(); +} + +#define EXPECT_ABORT_BEGIN \ + { \ + jmp_buf TestAbortFrame; \ + memcpy(TestAbortFrame, Unity.AbortFrame, sizeof(jmp_buf)); \ + if (TEST_PROTECT()) \ + { + +#define EXPECT_ABORT_END \ + } \ + memcpy(Unity.AbortFrame, TestAbortFrame, sizeof(jmp_buf)); \ + } + +TEST(LeakDetection, DetectsLeak) +{ + void* m = malloc(10); + UnityOutputCharSpy_Enable(1); + EXPECT_ABORT_BEGIN + UnityMalloc_EndTest(); + EXPECT_ABORT_END + UnityOutputCharSpy_Enable(0); + CHECK(strstr(UnityOutputCharSpy_Get(), "This test leaks!")); + free(m); + Unity.CurrentTestFailed = 0; +} + +TEST(LeakDetection, BufferOverrunFoundDuringFree) +{ + void* m = malloc(10); + char* s = (char*)m; + s[10] = (char)0xFF; + UnityOutputCharSpy_Enable(1); + EXPECT_ABORT_BEGIN + free(m); + EXPECT_ABORT_END + UnityOutputCharSpy_Enable(0); + CHECK(strstr(UnityOutputCharSpy_Get(), "Buffer overrun detected during free()")); + Unity.CurrentTestFailed = 0; +} + +TEST(LeakDetection, BufferOverrunFoundDuringRealloc) +{ + void* m = malloc(10); + char* s = (char*)m; + s[10] = (char)0xFF; + UnityOutputCharSpy_Enable(1); + EXPECT_ABORT_BEGIN + m = realloc(m, 100); + EXPECT_ABORT_END + UnityOutputCharSpy_Enable(0); + CHECK(strstr(UnityOutputCharSpy_Get(), "Buffer overrun detected during realloc()")); + Unity.CurrentTestFailed = 0; +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c new file mode 100644 index 0000000..80fec09 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c @@ -0,0 +1,40 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" + +TEST_GROUP_RUNNER(UnityFixture) +{ + RUN_TEST_CASE(UnityFixture, PointerSetting); + RUN_TEST_CASE(UnityFixture, ForceMallocFail); + RUN_TEST_CASE(UnityFixture, ReallocSmallerIsUnchanged); + RUN_TEST_CASE(UnityFixture, ReallocSameIsUnchanged); + RUN_TEST_CASE(UnityFixture, ReallocLargerNeeded); + RUN_TEST_CASE(UnityFixture, ReallocNullPointerIsLikeMalloc); + RUN_TEST_CASE(UnityFixture, ReallocSizeZeroFreesMemAndReturnsNullPointer); + RUN_TEST_CASE(UnityFixture, CallocFillsWithZero); + RUN_TEST_CASE(UnityFixture, PointerSet); +} + +TEST_GROUP_RUNNER(UnityCommandOptions) +{ + RUN_TEST_CASE(UnityCommandOptions, DefaultOptions); + RUN_TEST_CASE(UnityCommandOptions, OptionVerbose); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectTestByGroup); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectTestByName); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectRepeatTestsDefaultCount); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectRepeatTestsSpecificCount); + RUN_TEST_CASE(UnityCommandOptions, MultipleOptions); + RUN_TEST_CASE(UnityCommandOptions, MultipleOptionsDashRNotLastAndNoValueSpecified); +} + +TEST_GROUP_RUNNER(LeakDetection) +{ + RUN_TEST_CASE(LeakDetection, DetectsLeak); + RUN_TEST_CASE(LeakDetection, BufferOverrunFoundDuringFree); + RUN_TEST_CASE(LeakDetection, BufferOverrunFoundDuringRealloc); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/unity_output_Spy.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/unity_output_Spy.c new file mode 100644 index 0000000..16faefa --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/unity_output_Spy.c @@ -0,0 +1,56 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + + +#include "unity_output_Spy.h" +#include +#include +#include + +static int size; +static int count; +static char* buffer; +static int spy_enable; + +void UnityOutputCharSpy_Create(int s) +{ + size = s; + count = 0; + spy_enable = 0; + buffer = malloc(size); + memset(buffer, 0, size); +} + +void UnityOutputCharSpy_Destroy() +{ + size = 0; + free(buffer); +} + +int UnityOutputCharSpy_OutputChar(int c) +{ + if (spy_enable) + { + if (count < (size-1)) + buffer[count++] = c; + } + else + { + putchar(c); + } + return c; +} + +const char * UnityOutputCharSpy_Get() +{ + return buffer; +} + +void UnityOutputCharSpy_Enable(int enable) +{ + spy_enable = enable; +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/unity_output_Spy.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/unity_output_Spy.h new file mode 100644 index 0000000..7c1590e --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/extras/fixture/test/unity_output_Spy.h @@ -0,0 +1,17 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef D_unity_output_Spy_H +#define D_unity_output_Spy_H + +void UnityOutputCharSpy_Create(int s); +void UnityOutputCharSpy_Destroy(); +int UnityOutputCharSpy_OutputChar(int c); +const char * UnityOutputCharSpy_Get(); +void UnityOutputCharSpy_Enable(int enable); + +#endif diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/makefile b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/makefile new file mode 100644 index 0000000..8c8444b --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/makefile @@ -0,0 +1,35 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +C_COMPILER=gcc +TARGET_BASE = testunity +ifeq ($(OS),Windows_NT) + TARGET_EXTENSION=.exe +else + TARGET_EXTENSION=.out +endif +TARGET = $(TARGET_BASE)$(TARGET_EXTENSION) +OUT_FILE=-o $(TARGET) +SRC_FILES=src/unity.c test/testunity.c build/testunity_Runner.c +INC_DIRS=-Isrc +SYMBOLS=-DTEST -DUNITY_SUPPORT_64 + +ifeq ($(OS),Windows_NT) + CLEANUP = del /F /Q build\* && del /F /Q $(TARGET) +else + CLEANUP = rm -f build/*.o ; rm -f $(TARGET) +endif + +all: clean default + +default: + ruby auto/generate_test_runner.rb test/testunity.c build/testunity_Runner.c + $(C_COMPILER) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES) $(OUT_FILE) + $(TARGET) + +clean: + $(CLEANUP) + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/rakefile.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/rakefile.rb new file mode 100644 index 0000000..3ec5d5a --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/rakefile.rb @@ -0,0 +1,48 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require HERE + 'rakefile_helper' + +include RakefileHelpers + +# Load default configuration, for now +DEFAULT_CONFIG_FILE = 'gcc.yml' +configure_toolchain(DEFAULT_CONFIG_FILE) + +desc "Test unity with its own unit tests" +task :unit do + run_tests get_unit_test_files +end + +Rake::TestTask.new(:scripts) do |t| + t.pattern = 'test/test_*.rb' + t.verbose = true +end + +desc "Generate test summary" +task :summary do + report_summary +end + +desc "Build and test Unity" +task :all => [:clean, :scripts, :unit, :summary] +task :default => [:clobber, :all] +task :ci => [:no_color, :default] +task :cruise => [:no_color, :default] + +desc "Load configuration" +task :config, :config_file do |t, args| + configure_toolchain(args[:config_file]) +end + +task :no_color do + $colour_output = false +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/rakefile_helper.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/rakefile_helper.rb new file mode 100644 index 0000000..218fcaa --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/rakefile_helper.rb @@ -0,0 +1,243 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require 'yaml' +require 'fileutils' +require HERE+'auto/unity_test_summary' +require HERE+'auto/generate_test_runner' +require HERE+'auto/colour_reporter' + +module RakefileHelpers + + C_EXTENSION = '.c' + + def load_configuration(config_file) + unless ($configured) + $cfg_file = "targets/#{config_file}" unless (config_file =~ /[\\|\/]/) + $cfg = YAML.load(File.read($cfg_file)) + $colour_output = false unless $cfg['colour'] + $configured = true if (config_file != DEFAULT_CONFIG_FILE) + end + end + + def configure_clean + CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil? + end + + def configure_toolchain(config_file=DEFAULT_CONFIG_FILE) + config_file += '.yml' unless config_file =~ /\.yml$/ + config_file = config_file unless config_file =~ /[\\|\/]/ + load_configuration(config_file) + configure_clean + end + + def get_unit_test_files + path = $cfg['compiler']['unit_tests_path'] + 'test*' + C_EXTENSION + path.gsub!(/\\/, '/') + FileList.new(path) + end + + def get_local_include_dirs + include_dirs = $cfg['compiler']['includes']['items'].dup + include_dirs.delete_if {|dir| dir.is_a?(Array)} + return include_dirs + end + + def extract_headers(filename) + includes = [] + lines = File.readlines(filename) + lines.each do |line| + m = line.match(/^\s*#include\s+\"\s*(.+\.[hH])\s*\"/) + if not m.nil? + includes << m[1] + end + end + return includes + end + + def find_source_file(header, paths) + paths.each do |dir| + src_file = dir + header.ext(C_EXTENSION) + if (File.exists?(src_file)) + return src_file + end + end + return nil + end + + def tackit(strings) + if strings.is_a?(Array) + result = "\"#{strings.join}\"" + else + result = strings + end + return result + end + + def squash(prefix, items) + result = '' + items.each { |item| result += " #{prefix}#{tackit(item)}" } + return result + end + + def build_compiler_fields + command = tackit($cfg['compiler']['path']) + if $cfg['compiler']['defines']['items'].nil? + defines = '' + else + defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items']) + end + options = squash('', $cfg['compiler']['options']) + includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :defines => defines, :options => options, :includes => includes} + end + + def compile(file, defines=[]) + compiler = build_compiler_fields + cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{file} " + + "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" + + "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" + execute(cmd_str) + end + + def build_linker_fields + command = tackit($cfg['linker']['path']) + if $cfg['linker']['options'].nil? + options = '' + else + options = squash('', $cfg['linker']['options']) + end + if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?) + includes = '' + else + includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) + end + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :options => options, :includes => includes} + end + + def link(exe_name, obj_list) + linker = build_linker_fields + cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + + (obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).join + + $cfg['linker']['bin_files']['prefix'] + ' ' + + $cfg['linker']['bin_files']['destination'] + + exe_name + $cfg['linker']['bin_files']['extension'] + execute(cmd_str) + end + + def build_simulator_fields + return nil if $cfg['simulator'].nil? + if $cfg['simulator']['path'].nil? + command = '' + else + command = (tackit($cfg['simulator']['path']) + ' ') + end + if $cfg['simulator']['pre_support'].nil? + pre_support = '' + else + pre_support = squash('', $cfg['simulator']['pre_support']) + end + if $cfg['simulator']['post_support'].nil? + post_support = '' + else + post_support = squash('', $cfg['simulator']['post_support']) + end + return {:command => command, :pre_support => pre_support, :post_support => post_support} + end + + def execute(command_string, verbose=true) + report command_string + output = `#{command_string}`.chomp + report(output) if (verbose && !output.nil? && (output.length > 0)) + if $?.exitstatus != 0 + raise "Command failed. (Returned #{$?.exitstatus})" + end + return output + end + + def report_summary + summary = UnityTestSummary.new + summary.set_root_path(HERE) + results_glob = "#{$cfg['compiler']['build_path']}*.test*" + results_glob.gsub!(/\\/, '/') + results = Dir[results_glob] + summary.set_targets(results) + summary.run + end + + def run_tests(test_files) + report 'Running Unity system tests...' + + # Tack on TEST define for compiling unit tests + load_configuration($cfg_file) + test_defines = ['TEST'] + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + $cfg['compiler']['defines']['items'] << 'TEST' + + include_dirs = get_local_include_dirs + + # Build and execute each unit test + test_files.each do |test| + obj_list = [] + + # Detect dependencies and build required modules + extract_headers(test).each do |header| + # Compile corresponding source file if it exists + src_file = find_source_file(header, include_dirs) + if !src_file.nil? + compile(src_file, test_defines) + obj_list << header.ext($cfg['compiler']['object_files']['extension']) + end + end + + # Build the test runner (generate if configured to do so) + test_base = File.basename(test, C_EXTENSION) + + runner_name = test_base + '_Runner.c' + runner_path = '' + + if $cfg['compiler']['runner_path'].nil? + runner_path = $cfg['compiler']['build_path'] + runner_name + else + runner_path = $cfg['compiler']['runner_path'] + runner_name + end + + options = $cfg[:unity] + options[:use_param_tests] = (test =~ /parameterized/) ? true : false + UnityTestRunnerGenerator.new(options).run(test, runner_path) + + compile(runner_path, test_defines) + obj_list << runner_name.ext($cfg['compiler']['object_files']['extension']) + + # Build the test module + compile(test, test_defines) + obj_list << test_base.ext($cfg['compiler']['object_files']['extension']) + + # Link the test executable + link(test_base, obj_list) + + # Execute unit test and generate results file + simulator = build_simulator_fields + executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] + if simulator.nil? + cmd_str = executable + else + cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" + end + output = execute(cmd_str) + test_results = $cfg['compiler']['build_path'] + test_base + if output.match(/OK$/m).nil? + test_results += '.testfail' + else + test_results += '.testpass' + end + File.open(test_results, 'w') { |f| f.print output } + + end + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/release/build.info b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/release/build.info new file mode 100644 index 0000000..7871b21 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/release/build.info @@ -0,0 +1,2 @@ +118 + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/release/version.info b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/release/version.info new file mode 100644 index 0000000..0d71c08 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/release/version.info @@ -0,0 +1,2 @@ +2.0 + diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/src/unity.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/src/unity.c new file mode 100644 index 0000000..d85b880 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/src/unity.c @@ -0,0 +1,855 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity.h" +#include +#include + +#define UNITY_FAIL_AND_BAIL { Unity.CurrentTestFailed = 1; UNITY_OUTPUT_CHAR('\n'); longjmp(Unity.AbortFrame, 1); } +#define UNITY_IGNORE_AND_BAIL { Unity.CurrentTestIgnored = 1; UNITY_OUTPUT_CHAR('\n'); longjmp(Unity.AbortFrame, 1); } +/// return prematurely if we are already in failure or ignore state +#define UNITY_SKIP_EXECUTION { if ((Unity.CurrentTestFailed != 0) || (Unity.CurrentTestIgnored != 0)) {return;} } +#define UNITY_PRINT_EOL { UNITY_OUTPUT_CHAR('\n'); } + +struct _Unity Unity = { 0 }; + +const char* UnityStrNull = "NULL"; +const char* UnityStrSpacer = ". "; +const char* UnityStrExpected = " Expected "; +const char* UnityStrWas = " Was "; +const char* UnityStrTo = " To "; +const char* UnityStrElement = " Element "; +const char* UnityStrMemory = " Memory Mismatch"; +const char* UnityStrDelta = " Values Not Within Delta "; +const char* UnityStrPointless= " You Asked Me To Compare Nothing, Which Was Pointless."; +const char* UnityStrNullPointerForExpected= " Expected pointer to be NULL"; +const char* UnityStrNullPointerForActual = " Actual pointer was NULL"; + +const _U_UINT UnitySizeMask[] = +{ + 255, + 65535, + 65535, + 4294967295, + 4294967295, + 4294967295, + 4294967295 +#ifdef UNITY_SUPPORT_64 + ,0xFFFFFFFFFFFFFFFF +#endif +}; + +//----------------------------------------------- +// Pretty Printers & Test Result Output Handlers +//----------------------------------------------- + +void UnityPrint(const char* string) +{ + const char* pch = string; + + if (pch != NULL) + { + while (*pch) + { + // printable characters plus CR & LF are printed + if ((*pch <= 126) && (*pch >= 32)) + { + UNITY_OUTPUT_CHAR(*pch); + } + //write escaped carriage returns + else if (*pch == 13) + { + UNITY_OUTPUT_CHAR('\\'); + UNITY_OUTPUT_CHAR('r'); + } + //write escaped line feeds + else if (*pch == 10) + { + UNITY_OUTPUT_CHAR('\\'); + UNITY_OUTPUT_CHAR('n'); + } + // unprintable characters are shown as codes + else + { + UNITY_OUTPUT_CHAR('\\'); + UnityPrintNumberHex((_U_SINT)*pch, 2); + } + pch++; + } + } +} + +//----------------------------------------------- +void UnityPrintNumberByStyle(const _U_SINT number, const UNITY_DISPLAY_STYLE_T style) +{ + if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT) + { + UnityPrintNumber(number); + } + else if ((style & UNITY_DISPLAY_RANGE_UINT) == UNITY_DISPLAY_RANGE_UINT) + { + UnityPrintNumberUnsigned( (_U_UINT)number & UnitySizeMask[((_U_UINT)style & (_U_UINT)0x0F) - 1] ); + } + else + { + UnityPrintNumberHex((_U_UINT)number, (style & 0x000F) << 1); + } +} + +//----------------------------------------------- +/// basically do an itoa using as little ram as possible +void UnityPrintNumber(const _U_SINT number_to_print) +{ + _U_SINT divisor = 1; + _U_SINT next_divisor; + _U_SINT number = number_to_print; + + if (number < 0) + { + UNITY_OUTPUT_CHAR('-'); + number = -number; + } + + // figure out initial divisor + while (number / divisor > 9) + { + next_divisor = divisor * 10; + if (next_divisor > divisor) + divisor = next_divisor; + else + break; + } + + // now mod and print, then divide divisor + do + { + UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10))); + divisor /= 10; + } + while (divisor > 0); +} + +//----------------------------------------------- +/// basically do an itoa using as little ram as possible +void UnityPrintNumberUnsigned(const _U_UINT number) +{ + _U_UINT divisor = 1; + _U_UINT next_divisor; + + // figure out initial divisor + while (number / divisor > 9) + { + next_divisor = divisor * 10; + if (next_divisor > divisor) + divisor = next_divisor; + else + break; + } + + // now mod and print, then divide divisor + do + { + UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10))); + divisor /= 10; + } + while (divisor > 0); +} + +//----------------------------------------------- +void UnityPrintNumberHex(const _U_UINT number, const char nibbles_to_print) +{ + _U_UINT nibble; + char nibbles = nibbles_to_print; + UNITY_OUTPUT_CHAR('0'); + UNITY_OUTPUT_CHAR('x'); + + while (nibbles > 0) + { + nibble = (number >> (--nibbles << 2)) & 0x0000000F; + if (nibble <= 9) + { + UNITY_OUTPUT_CHAR((char)('0' + nibble)); + } + else + { + UNITY_OUTPUT_CHAR((char)('A' - 10 + nibble)); + } + } +} + +//----------------------------------------------- +void UnityPrintMask(const _U_UINT mask, const _U_UINT number) +{ + _U_UINT current_bit = (_U_UINT)1 << (UNITY_INT_WIDTH - 1); + _US32 i; + + for (i = 0; i < UNITY_INT_WIDTH; i++) + { + if (current_bit & mask) + { + if (current_bit & number) + { + UNITY_OUTPUT_CHAR('1'); + } + else + { + UNITY_OUTPUT_CHAR('0'); + } + } + else + { + UNITY_OUTPUT_CHAR('X'); + } + current_bit = current_bit >> 1; + } +} + +//----------------------------------------------- +#ifdef UNITY_FLOAT_VERBOSE +void UnityPrintFloat(_UF number) +{ + char TempBuffer[32]; + sprintf(TempBuffer, "%.6f", number); + UnityPrint(TempBuffer); +} +#endif + +//----------------------------------------------- +void UnityTestResultsBegin(const char* file, const UNITY_LINE_TYPE line) +{ + UnityPrint(file); + UNITY_OUTPUT_CHAR(':'); + UnityPrintNumber(line); + UNITY_OUTPUT_CHAR(':'); + UnityPrint(Unity.CurrentTestName); + UNITY_OUTPUT_CHAR(':'); +} + +//----------------------------------------------- +void UnityTestResultsFailBegin(const UNITY_LINE_TYPE line) +{ + UnityTestResultsBegin(Unity.TestFile, line); + UnityPrint("FAIL:"); +} + +//----------------------------------------------- +void UnityConcludeTest(void) +{ + if (Unity.CurrentTestIgnored) + { + Unity.TestIgnores++; + } + else if (!Unity.CurrentTestFailed) + { + UnityTestResultsBegin(Unity.TestFile, Unity.CurrentTestLineNumber); + UnityPrint("PASS"); + UNITY_PRINT_EOL; + } + else + { + Unity.TestFailures++; + } + + Unity.CurrentTestFailed = 0; + Unity.CurrentTestIgnored = 0; +} + +//----------------------------------------------- +void UnityAddMsgIfSpecified(const char* msg) +{ + if (msg) + { + UnityPrint(UnityStrSpacer); + UnityPrint(msg); + } +} + +//----------------------------------------------- +void UnityPrintExpectedAndActualStrings(const char* expected, const char* actual) +{ + UnityPrint(UnityStrExpected); + if (expected != NULL) + { + UNITY_OUTPUT_CHAR('\''); + UnityPrint(expected); + UNITY_OUTPUT_CHAR('\''); + } + else + { + UnityPrint(UnityStrNull); + } + UnityPrint(UnityStrWas); + if (actual != NULL) + { + UNITY_OUTPUT_CHAR('\''); + UnityPrint(actual); + UNITY_OUTPUT_CHAR('\''); + } + else + { + UnityPrint(UnityStrNull); + } +} + +//----------------------------------------------- +// Assertion & Control Helpers +//----------------------------------------------- + +int UnityCheckArraysForNull(const void* expected, const void* actual, const UNITY_LINE_TYPE lineNumber, const char* msg) +{ + //return true if they are both NULL + if ((expected == NULL) && (actual == NULL)) + return 1; + + //throw error if just expected is NULL + if (expected == NULL) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrNullPointerForExpected); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + //throw error if just actual is NULL + if (actual == NULL) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrNullPointerForActual); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + //return false if neither is NULL + return 0; +} + +//----------------------------------------------- +// Assertion Functions +//----------------------------------------------- + +void UnityAssertBits(const _U_SINT mask, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + UNITY_SKIP_EXECUTION; + + if ((mask & expected) != (mask & actual)) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrExpected); + UnityPrintMask(mask, expected); + UnityPrint(UnityStrWas); + UnityPrintMask(mask, actual); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualNumber(const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style) +{ + UNITY_SKIP_EXECUTION; + + if (expected != actual) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(expected, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(actual, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualIntArray(const _U_SINT* expected, + const _U_SINT* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style) +{ + _UU32 elements = num_elements; + const _US8* ptr_exp = (_US8*)expected; + const _US8* ptr_act = (_US8*)actual; + + UNITY_SKIP_EXECUTION; + + if (elements == 0) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + switch(style) + { + case UNITY_DISPLAY_STYLE_HEX8: + case UNITY_DISPLAY_STYLE_INT8: + case UNITY_DISPLAY_STYLE_UINT8: + while (elements--) + { + if (*ptr_exp != *ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 1; + ptr_act += 1; + } + break; + case UNITY_DISPLAY_STYLE_HEX16: + case UNITY_DISPLAY_STYLE_INT16: + case UNITY_DISPLAY_STYLE_UINT16: + while (elements--) + { + if (*(_US16*)ptr_exp != *(_US16*)ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*(_US16*)ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*(_US16*)ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 2; + ptr_act += 2; + } + break; +#ifdef UNITY_SUPPORT_64 + case UNITY_DISPLAY_STYLE_HEX64: + case UNITY_DISPLAY_STYLE_INT64: + case UNITY_DISPLAY_STYLE_UINT64: + while (elements--) + { + if (*(_US64*)ptr_exp != *(_US64*)ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*(_US64*)ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*(_US64*)ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 8; + ptr_act += 8; + } + break; +#endif + default: + while (elements--) + { + if (*(_US32*)ptr_exp != *(_US32*)ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*(_US32*)ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*(_US32*)ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 4; + ptr_act += 4; + } + break; + } +} + +//----------------------------------------------- +#ifndef UNITY_EXCLUDE_FLOAT +void UnityAssertEqualFloatArray(const _UF* expected, + const _UF* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UU32 elements = num_elements; + const _UF* ptr_expected = expected; + const _UF* ptr_actual = actual; + _UF diff, tol; + + UNITY_SKIP_EXECUTION; + + if (elements == 0) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + while (elements--) + { + diff = *ptr_expected - *ptr_actual; + if (diff < 0.0) + diff = 0.0 - diff; + tol = UNITY_FLOAT_PRECISION * *ptr_expected; + if (tol < 0.0) + tol = 0.0 - tol; + if (diff > tol) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); +#ifdef UNITY_FLOAT_VERBOSE + UnityPrint(UnityStrExpected); + UnityPrintFloat(*ptr_expected); + UnityPrint(UnityStrWas); + UnityPrintFloat(*ptr_actual); +#else + UnityPrint(UnityStrDelta); +#endif + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_expected++; + ptr_actual++; + } +} + +//----------------------------------------------- +void UnityAssertFloatsWithin(const _UF delta, + const _UF expected, + const _UF actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UF diff = actual - expected; + _UF pos_delta = delta; + + UNITY_SKIP_EXECUTION; + + if (diff < 0) + { + diff = 0.0f - diff; + } + if (pos_delta < 0) + { + pos_delta = 0.0f - pos_delta; + } + + if (pos_delta < diff) + { + UnityTestResultsFailBegin(lineNumber); +#ifdef UNITY_FLOAT_VERBOSE + UnityPrint(UnityStrExpected); + UnityPrintFloat(expected); + UnityPrint(UnityStrWas); + UnityPrintFloat(actual); +#else + UnityPrint(UnityStrDelta); +#endif + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} +#endif + +//----------------------------------------------- +void UnityAssertNumbersWithin( const _U_SINT delta, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style) +{ + UNITY_SKIP_EXECUTION; + + if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT) + { + if (actual > expected) + Unity.CurrentTestFailed = ((actual - expected) > delta); + else + Unity.CurrentTestFailed = ((expected - actual) > delta); + } + else + { + if ((_U_UINT)actual > (_U_UINT)expected) + Unity.CurrentTestFailed = ((_U_UINT)(actual - expected) > (_U_UINT)delta); + else + Unity.CurrentTestFailed = ((_U_UINT)(expected - actual) > (_U_UINT)delta); + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrDelta); + UnityPrintNumberByStyle(delta, style); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(expected, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(actual, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualString(const char* expected, + const char* actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UU32 i; + + UNITY_SKIP_EXECUTION; + + // if both pointers not null compare the strings + if (expected && actual) + { + for (i = 0; expected[i] || actual[i]; i++) + { + if (expected[i] != actual[i]) + { + Unity.CurrentTestFailed = 1; + break; + } + } + } + else + { // handle case of one pointers being null (if both null, test should pass) + if (expected != actual) + { + Unity.CurrentTestFailed = 1; + } + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrintExpectedAndActualStrings(expected, actual); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualStringArray( const char** expected, + const char** actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UU32 i, j = 0; + + UNITY_SKIP_EXECUTION; + + // if no elements, it's an error + if (num_elements == 0) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + do + { + // if both pointers not null compare the strings + if (expected[j] && actual[j]) + { + for (i = 0; expected[j][i] || actual[j][i]; i++) + { + if (expected[j][i] != actual[j][i]) + { + Unity.CurrentTestFailed = 1; + break; + } + } + } + else + { // handle case of one pointers being null (if both null, test should pass) + if (expected[j] != actual[j]) + { + Unity.CurrentTestFailed = 1; + } + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + if (num_elements > 1) + { + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - j - 1), UNITY_DISPLAY_STYLE_UINT); + } + UnityPrintExpectedAndActualStrings((const char*)(expected[j]), (const char*)(actual[j])); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + } while (++j < num_elements); +} + +//----------------------------------------------- +void UnityAssertEqualMemory( const void* expected, + const void* actual, + _UU32 length, + _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + unsigned char* expected_ptr = (unsigned char*)expected; + unsigned char* actual_ptr = (unsigned char*)actual; + _UU32 elements = num_elements; + + UNITY_SKIP_EXECUTION; + + if ((elements == 0) || (length == 0)) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + while (elements--) + { + if (memcmp((const void*)expected_ptr, (const void*)actual_ptr, length) != 0) + { + Unity.CurrentTestFailed = 1; + break; + } + expected_ptr += length; + actual_ptr += length; + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + if (num_elements > 1) + { + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + } + UnityPrint(UnityStrMemory); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +// Control Functions +//----------------------------------------------- + +void UnityFail(const char* msg, const UNITY_LINE_TYPE line) +{ + UNITY_SKIP_EXECUTION; + + UnityTestResultsBegin(Unity.TestFile, line); + UnityPrint("FAIL"); + if (msg != NULL) + { + UNITY_OUTPUT_CHAR(':'); + if (msg[0] != ' ') + { + UNITY_OUTPUT_CHAR(' '); + } + UnityPrint(msg); + } + UNITY_FAIL_AND_BAIL; +} + +//----------------------------------------------- +void UnityIgnore(const char* msg, const UNITY_LINE_TYPE line) +{ + UNITY_SKIP_EXECUTION; + + UnityTestResultsBegin(Unity.TestFile, line); + UnityPrint("IGNORE"); + if (msg != NULL) + { + UNITY_OUTPUT_CHAR(':'); + UNITY_OUTPUT_CHAR(' '); + UnityPrint(msg); + } + UNITY_IGNORE_AND_BAIL; +} + +//----------------------------------------------- +void setUp(void); +void tearDown(void); +void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum) +{ + Unity.CurrentTestName = FuncName; + Unity.CurrentTestLineNumber = FuncLineNum; + Unity.NumberOfTests++; + if (TEST_PROTECT()) + { + setUp(); + Func(); + } + if (TEST_PROTECT() && !(Unity.CurrentTestIgnored)) + { + tearDown(); + } + UnityConcludeTest(); +} + +//----------------------------------------------- +void UnityBegin(void) +{ + Unity.NumberOfTests = 0; +} + +//----------------------------------------------- +int UnityEnd(void) +{ + UnityPrint("-----------------------"); + UNITY_PRINT_EOL; + UnityPrintNumber(Unity.NumberOfTests); + UnityPrint(" Tests "); + UnityPrintNumber(Unity.TestFailures); + UnityPrint(" Failures "); + UnityPrintNumber(Unity.TestIgnores); + UnityPrint(" Ignored"); + UNITY_PRINT_EOL; + if (Unity.TestFailures == 0U) + { + UnityPrint("OK"); + } + else + { + UnityPrint("FAIL"); + } + UNITY_PRINT_EOL; + return Unity.TestFailures; +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/src/unity.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/src/unity.h new file mode 100644 index 0000000..0b1b187 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/src/unity.h @@ -0,0 +1,213 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FRAMEWORK_H +#define UNITY_FRAMEWORK_H + +#define UNITY + +#include "unity_internals.h" + +//------------------------------------------------------- +// Configuration Options +//------------------------------------------------------- + +// Integers +// - Unity assumes 32 bit integers by default +// - If your compiler treats ints of a different size, define UNITY_INT_WIDTH + +// Floats +// - define UNITY_EXCLUDE_FLOAT to disallow floating point comparisons +// - define UNITY_FLOAT_PRECISION to specify the precision to use when doing TEST_ASSERT_EQUAL_FLOAT +// - define UNITY_FLOAT_TYPE to specify doubles instead of single precision floats +// - define UNITY_FLOAT_VERBOSE to print floating point values in errors (uses sprintf) + +// Output +// - by default, Unity prints to standard out with putchar. define UNITY_OUTPUT_CHAR(a) with a different function if desired + +// Optimization +// - by default, line numbers are stored in unsigned shorts. Define UNITY_LINE_TYPE with a different type if your files are huge +// - by default, test and failure counters are unsigned shorts. Define UNITY_COUNTER_TYPE with a different type if you want to save space or have more than 65535 Tests. + +// Test Cases +// - define UNITY_SUPPORT_TEST_CASES to include the TEST_CASE macro, though really it's mostly about the runner generator script + +// Parameterized Tests +// - you'll want to create a define of TEST_CASE(...) which basically evaluates to nothing + +//------------------------------------------------------- +// Test Running Macros +//------------------------------------------------------- + +#define TEST_PROTECT() (setjmp(Unity.AbortFrame) == 0) + +#define TEST_ABORT() {longjmp(Unity.AbortFrame, 1);} + +#ifndef RUN_TEST +#define RUN_TEST(func, line_num) UnityDefaultTestRun(func, #func, line_num) +#endif + +#define TEST_LINE_NUM (Unity.CurrentTestLineNumber) +#define TEST_IS_IGNORED (Unity.CurrentTestIgnored) + +//------------------------------------------------------- +// Basic Fail and Ignore +//------------------------------------------------------- + +#define TEST_FAIL_MESSAGE(message) UNITY_TEST_FAIL(__LINE__, message) +#define TEST_FAIL() UNITY_TEST_FAIL(__LINE__, NULL) +#define TEST_IGNORE_MESSAGE(message) UNITY_TEST_IGNORE(__LINE__, message) +#define TEST_IGNORE() UNITY_TEST_IGNORE(__LINE__, NULL) +#define TEST_ONLY() + +//------------------------------------------------------- +// Test Asserts (simple) +//------------------------------------------------------- + +//Boolean +#define TEST_ASSERT(condition) UNITY_TEST_ASSERT( (condition), __LINE__, " Expression Evaluated To FALSE") +#define TEST_ASSERT_TRUE(condition) UNITY_TEST_ASSERT( (condition), __LINE__, " Expected TRUE Was FALSE") +#define TEST_ASSERT_UNLESS(condition) UNITY_TEST_ASSERT( !(condition), __LINE__, " Expression Evaluated To TRUE") +#define TEST_ASSERT_FALSE(condition) UNITY_TEST_ASSERT( !(condition), __LINE__, " Expected FALSE Was TRUE") +#define TEST_ASSERT_NULL(pointer) UNITY_TEST_ASSERT_NULL( (pointer), __LINE__, " Expected NULL") +#define TEST_ASSERT_NOT_NULL(pointer) UNITY_TEST_ASSERT_NOT_NULL((pointer), __LINE__, " Expected Non-NULL") + +//Integers (of all sizes) +#define TEST_ASSERT_EQUAL_INT(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT8(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT8((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT16(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT16((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT32(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT32((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT64(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT64((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_NOT_EQUAL(expected, actual) UNITY_TEST_ASSERT(((expected) != (actual)), __LINE__, " Expected Not-Equal") +#define TEST_ASSERT_EQUAL_UINT(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT8(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT8( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT16(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT16( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT32(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT32( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT64(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT64( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX8(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX8( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX16(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX16((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX32(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX64(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX64((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_BITS(mask, expected, actual) UNITY_TEST_ASSERT_BITS((mask), (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_BITS_HIGH(mask, actual) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(-1), (actual), __LINE__, NULL) +#define TEST_ASSERT_BITS_LOW(mask, actual) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(0), (actual), __LINE__, NULL) +#define TEST_ASSERT_BIT_HIGH(bit, actual) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(-1), (actual), __LINE__, NULL) +#define TEST_ASSERT_BIT_LOW(bit, actual) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(0), (actual), __LINE__, NULL) + +//Integer Ranges (of all sizes) +#define TEST_ASSERT_INT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_UINT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX8_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX16_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX32_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX64_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, __LINE__, NULL) + +//Structs and Strings +#define TEST_ASSERT_EQUAL_PTR(expected, actual) UNITY_TEST_ASSERT_EQUAL_PTR((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_STRING(expected, actual) UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_MEMORY(expected, actual, len) UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, __LINE__, NULL) + +//Arrays +#define TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements) UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, __LINE__, NULL) + +//Floating Point (If Enabled) +#define TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_FLOAT(expected, actual) UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, __LINE__, NULL) + +//------------------------------------------------------- +// Test Asserts (with additional messages) +//------------------------------------------------------- + +//Boolean +#define TEST_ASSERT_MESSAGE(condition, message) UNITY_TEST_ASSERT( (condition), __LINE__, message) +#define TEST_ASSERT_TRUE_MESSAGE(condition, message) UNITY_TEST_ASSERT( (condition), __LINE__, message) +#define TEST_ASSERT_UNLESS_MESSAGE(condition, message) UNITY_TEST_ASSERT( !(condition), __LINE__, message) +#define TEST_ASSERT_FALSE_MESSAGE(condition, message) UNITY_TEST_ASSERT( !(condition), __LINE__, message) +#define TEST_ASSERT_NULL_MESSAGE(pointer, message) UNITY_TEST_ASSERT_NULL( (pointer), __LINE__, message) +#define TEST_ASSERT_NOT_NULL_MESSAGE(pointer, message) UNITY_TEST_ASSERT_NOT_NULL((pointer), __LINE__, message) + +//Integers (of all sizes) +#define TEST_ASSERT_EQUAL_INT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT8((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT16((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT32((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT64((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, message) +#define TEST_ASSERT_NOT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT(((expected) != (actual)), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT8( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT16( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT32( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT64( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX8( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX16((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX64((expected), (actual), __LINE__, message) +#define TEST_ASSERT_BITS_MESSAGE(mask, expected, actual, message) UNITY_TEST_ASSERT_BITS((mask), (expected), (actual), __LINE__, message) +#define TEST_ASSERT_BITS_HIGH_MESSAGE(mask, actual, message) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(-1), (actual), __LINE__, message) +#define TEST_ASSERT_BITS_LOW_MESSAGE(mask, actual, message) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(0), (actual), __LINE__, message) +#define TEST_ASSERT_BIT_HIGH_MESSAGE(bit, actual, message) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(-1), (actual), __LINE__, message) +#define TEST_ASSERT_BIT_LOW_MESSAGE(bit, actual, message) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(0), (actual), __LINE__, message) + +//Integer Ranges (of all sizes) +#define TEST_ASSERT_INT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_UINT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX8_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX16_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX32_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX64_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, __LINE__, message) + +//Structs and Strings +#define TEST_ASSERT_EQUAL_PTR_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_PTR(expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_STRING_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_MEMORY_MESSAGE(expected, actual, len, message) UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, __LINE__, message) + +//Arrays +#define TEST_ASSERT_EQUAL_INT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_STRING_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_MEMORY_ARRAY_MESSAGE(expected, actual, len, num_elements, message) UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, __LINE__, message) + +//Floating Point (If Enabled) +#define TEST_ASSERT_FLOAT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_FLOAT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_FLOAT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, __LINE__, message) +#endif diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/src/unity_internals.h b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/src/unity_internals.h new file mode 100644 index 0000000..29c9d1d --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/src/unity_internals.h @@ -0,0 +1,355 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_INTERNALS_H +#define UNITY_INTERNALS_H + +#include +#include + +//------------------------------------------------------- +// Int Support +//------------------------------------------------------- + +#ifndef UNITY_INT_WIDTH +#define UNITY_INT_WIDTH (32) +#endif + +#ifndef UNITY_LONG_WIDTH +#define UNITY_LONG_WIDTH (32) +#endif + +#if (UNITY_INT_WIDTH == 32) + typedef unsigned char _UU8; + typedef unsigned short _UU16; + typedef unsigned int _UU32; + typedef signed char _US8; + typedef signed short _US16; + typedef signed int _US32; +#elif (UNITY_INT_WIDTH == 16) + typedef unsigned char _UU8; + typedef unsigned int _UU16; + typedef unsigned long _UU32; + typedef signed char _US8; + typedef signed int _US16; + typedef signed long _US32; +#else + #error Invalid UNITY_INT_WIDTH specified! (16 or 32 are supported) +#endif + +//------------------------------------------------------- +// 64-bit Support +//------------------------------------------------------- + +#ifndef UNITY_SUPPORT_64 + +//No 64-bit Support +typedef _UU32 _U_UINT; +typedef _US32 _U_SINT; + +#else + +//64-bit Support +#if (UNITY_LONG_WIDTH == 32) + typedef unsigned long long _UU64; + typedef signed long long _US64; +#elif (UNITY_LONG_WIDTH == 64) + typedef unsigned long _UU64; + typedef signed long _US64; +#else + #error Invalid UNITY_LONG_WIDTH specified! (32 or 64 are supported) +#endif +typedef _UU64 _U_UINT; +typedef _US64 _U_SINT; + +#endif + +//------------------------------------------------------- +// Pointer Support +//------------------------------------------------------- + +#ifndef UNITY_POINTER_WIDTH +#define UNITY_POINTER_WIDTH (32) +#endif + +#if (UNITY_POINTER_WIDTH == 32) + typedef _UU32 _UP; +#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX32 +#elif (UNITY_POINTER_WIDTH == 64) + typedef _UU64 _UP; +#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX64 +#elif (UNITY_POINTER_WIDTH == 16) + typedef _UU16 _UP; +#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX16 +#else + #error Invalid UNITY_POINTER_WIDTH specified! (16, 32 or 64 are supported) +#endif + +//------------------------------------------------------- +// Float Support +//------------------------------------------------------- + +#ifdef UNITY_EXCLUDE_FLOAT + +//No Floating Point Support +#undef UNITY_FLOAT_PRECISION +#undef UNITY_FLOAT_TYPE +#undef UNITY_FLOAT_VERBOSE + +#else + +//Floating Point Support +#ifndef UNITY_FLOAT_PRECISION +#define UNITY_FLOAT_PRECISION (0.00001f) +#endif +#ifndef UNITY_FLOAT_TYPE +#define UNITY_FLOAT_TYPE float +#endif +typedef UNITY_FLOAT_TYPE _UF; + +#endif + +//------------------------------------------------------- +// Output Method +//------------------------------------------------------- + +#ifndef UNITY_OUTPUT_CHAR +//Default to using putchar, which is defined in stdio.h above +#define UNITY_OUTPUT_CHAR(a) putchar(a) +#else +//If defined as something else, make sure we declare it here so it's ready for use +extern int UNITY_OUTPUT_CHAR(int); +#endif + +//------------------------------------------------------- +// Footprint +//------------------------------------------------------- + +#ifndef UNITY_LINE_TYPE +#define UNITY_LINE_TYPE unsigned short +#endif + +#ifndef UNITY_COUNTER_TYPE +#define UNITY_COUNTER_TYPE unsigned short +#endif + +//------------------------------------------------------- +// Internal Structs Needed +//------------------------------------------------------- + +typedef void (*UnityTestFunction)(void); + +#define UNITY_DISPLAY_RANGE_INT (0x10) +#define UNITY_DISPLAY_RANGE_UINT (0x20) +#define UNITY_DISPLAY_RANGE_HEX (0x40) +#define UNITY_DISPLAY_RANGE_AUTO (0x80) + +typedef enum +{ + UNITY_DISPLAY_STYLE_INT = 4 + UNITY_DISPLAY_RANGE_INT + UNITY_DISPLAY_RANGE_AUTO, + UNITY_DISPLAY_STYLE_INT8 = 1 + UNITY_DISPLAY_RANGE_INT, + UNITY_DISPLAY_STYLE_INT16 = 2 + UNITY_DISPLAY_RANGE_INT, + UNITY_DISPLAY_STYLE_INT32 = 4 + UNITY_DISPLAY_RANGE_INT, +#ifdef UNITY_SUPPORT_64 + UNITY_DISPLAY_STYLE_INT64 = 8 + UNITY_DISPLAY_RANGE_INT, +#endif + UNITY_DISPLAY_STYLE_UINT = 4 + UNITY_DISPLAY_RANGE_UINT + UNITY_DISPLAY_RANGE_AUTO, + UNITY_DISPLAY_STYLE_UINT8 = 1 + UNITY_DISPLAY_RANGE_UINT, + UNITY_DISPLAY_STYLE_UINT16 = 2 + UNITY_DISPLAY_RANGE_UINT, + UNITY_DISPLAY_STYLE_UINT32 = 4 + UNITY_DISPLAY_RANGE_UINT, +#ifdef UNITY_SUPPORT_64 + UNITY_DISPLAY_STYLE_UINT64 = 8 + UNITY_DISPLAY_RANGE_UINT, +#endif + UNITY_DISPLAY_STYLE_HEX8 = 1 + UNITY_DISPLAY_RANGE_HEX, + UNITY_DISPLAY_STYLE_HEX16 = 2 + UNITY_DISPLAY_RANGE_HEX, + UNITY_DISPLAY_STYLE_HEX32 = 4 + UNITY_DISPLAY_RANGE_HEX, +#ifdef UNITY_SUPPORT_64 + UNITY_DISPLAY_STYLE_HEX64 = 8 + UNITY_DISPLAY_RANGE_HEX, +#endif +} UNITY_DISPLAY_STYLE_T; + +struct _Unity +{ + const char* TestFile; + const char* CurrentTestName; + _UU32 CurrentTestLineNumber; + UNITY_COUNTER_TYPE NumberOfTests; + UNITY_COUNTER_TYPE TestFailures; + UNITY_COUNTER_TYPE TestIgnores; + UNITY_COUNTER_TYPE CurrentTestFailed; + UNITY_COUNTER_TYPE CurrentTestIgnored; + jmp_buf AbortFrame; +}; + +extern struct _Unity Unity; + +//------------------------------------------------------- +// Test Suite Management +//------------------------------------------------------- + +void UnityBegin(void); +int UnityEnd(void); +void UnityConcludeTest(void); +void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum); + +//------------------------------------------------------- +// Test Output +//------------------------------------------------------- + +void UnityPrint(const char* string); +void UnityPrintMask(const _U_UINT mask, const _U_UINT number); +void UnityPrintNumberByStyle(const _U_SINT number, const UNITY_DISPLAY_STYLE_T style); +void UnityPrintNumber(const _U_SINT number); +void UnityPrintNumberUnsigned(const _U_UINT number); +void UnityPrintNumberHex(const _U_UINT number, const char nibbles); + +#ifdef UNITY_FLOAT_VERBOSE +void UnityPrintFloat(const _UF number); +#endif + +//------------------------------------------------------- +// Test Assertion Fuctions +//------------------------------------------------------- +// Use the macros below this section instead of calling +// these directly. The macros have a consistent naming +// convention and will pull in file and line information +// for you. + +void UnityAssertEqualNumber(const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style); + +void UnityAssertEqualIntArray(const _U_SINT* expected, + const _U_SINT* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style); + +void UnityAssertBits(const _U_SINT mask, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualString(const char* expected, + const char* actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualStringArray( const char** expected, + const char** actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualMemory( const void* expected, + const void* actual, + const _UU32 length, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertNumbersWithin(const _U_SINT delta, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style); + +void UnityFail(const char* message, const UNITY_LINE_TYPE line); + +void UnityIgnore(const char* message, const UNITY_LINE_TYPE line); + +#ifndef UNITY_EXCLUDE_FLOAT +void UnityAssertFloatsWithin(const _UF delta, + const _UF expected, + const _UF actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualFloatArray(const _UF* expected, + const _UF* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber); +#endif + +//------------------------------------------------------- +// Basic Fail and Ignore +//------------------------------------------------------- + +#define UNITY_TEST_FAIL(line, message) UnityFail( (message), (UNITY_LINE_TYPE)line); +#define UNITY_TEST_IGNORE(line, message) UnityIgnore( (message), (UNITY_LINE_TYPE)line); + +//------------------------------------------------------- +// Test Asserts +//------------------------------------------------------- + +#define UNITY_TEST_ASSERT(condition, line, message) if (condition) {} else {UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, message);} +#define UNITY_TEST_ASSERT_NULL(pointer, line, message) UNITY_TEST_ASSERT(((pointer) == NULL), (UNITY_LINE_TYPE)line, message) +#define UNITY_TEST_ASSERT_NOT_NULL(pointer, line, message) UNITY_TEST_ASSERT(((pointer) != NULL), (UNITY_LINE_TYPE)line, message) + +#define UNITY_TEST_ASSERT_EQUAL_INT(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_UINT(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_HEX8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX8) +#define UNITY_TEST_ASSERT_EQUAL_HEX16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX16) +#define UNITY_TEST_ASSERT_EQUAL_HEX32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX32) +#define UNITY_TEST_ASSERT_BITS(mask, expected, actual, line, message) UnityAssertBits((_U_SINT)(mask), (_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line) + +#define UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX8) +#define UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX16) +#define UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX32) +#define UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64) + +#define UNITY_TEST_ASSERT_EQUAL_PTR(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(_UP)(expected), (_U_SINT)(_UP)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_POINTER) +#define UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, line, message) UnityAssertEqualString((const char*)(expected), (const char*)(actual), (message), (UNITY_LINE_TYPE)line) +#define UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, line, message) UnityAssertEqualMemory((void*)(expected), (void*)(actual), (_UU32)(len), 1, (message), (UNITY_LINE_TYPE)line) + +#define UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT8) +#define UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT16) +#define UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT32) +#define UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT8) +#define UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT16) +#define UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT32) +#define UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX8) +#define UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX16) +#define UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX32) +#define UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualStringArray((const char**)(expected), (const char**)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line) +#define UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, line, message) UnityAssertEqualMemory((void*)(expected), (void*)(actual), (_UU32)(len), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line) + +#ifdef UNITY_SUPPORT_64 +#define UNITY_TEST_ASSERT_EQUAL_INT64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT64) +#define UNITY_TEST_ASSERT_EQUAL_UINT64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT64) +#define UNITY_TEST_ASSERT_EQUAL_HEX64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64) +#define UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT64) +#define UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT64) +#define UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64) +#endif + +#ifdef UNITY_EXCLUDE_FLOAT +#define UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled") +#define UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled") +#define UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled") +#else +#define UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, line, message) UnityAssertFloatsWithin((_UF)(delta), (_UF)(expected), (_UF)(actual), (message), (UNITY_LINE_TYPE)line) +#define UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, line, message) UNITY_TEST_ASSERT_FLOAT_WITHIN((_UF)(expected) * (_UF)UNITY_FLOAT_PRECISION, (_UF)expected, (_UF)actual, (UNITY_LINE_TYPE)line, message) +#define UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualFloatArray((_UF*)(expected), (_UF*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line) +#endif + +#endif diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/targets/gcc.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/targets/gcc.yml new file mode 100644 index 0000000..0f18c6c --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/targets/gcc.yml @@ -0,0 +1,42 @@ +compiler: + path: gcc + source_path: 'src/' + unit_tests_path: &unit_tests_path 'test/' + build_path: &build_path 'build/' + options: + - '-c' + - '-Wall' + - '-Wno-address' + - '-std=c99' + - '-pedantic' + includes: + prefix: '-I' + items: + - 'src/' + - '../src/' + - *unit_tests_path + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - UNITY_SUPPORT_TEST_CASES + object_files: + prefix: '-o' + extension: '.o' + destination: *build_path +linker: + path: gcc + options: + - -lm + includes: + prefix: '-I' + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.exe' + destination: *build_path +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/targets/gcc_64.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/targets/gcc_64.yml new file mode 100644 index 0000000..97cb958 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/targets/gcc_64.yml @@ -0,0 +1,43 @@ +compiler: + path: gcc + source_path: 'src/' + unit_tests_path: &unit_tests_path 'test/' + build_path: &build_path 'build/' + options: + - '-c' + - '-Wall' + - '-Wno-address' + - '-std=c99' + - '-pedantic' + includes: + prefix: '-I' + items: + - 'src/' + - '../src/' + - *unit_tests_path + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - UNITY_SUPPORT_TEST_CASES + - 'UNITY_POINTER_WIDTH=64' + object_files: + prefix: '-o' + extension: '.o' + destination: *build_path +linker: + path: gcc + options: + - -lm + includes: + prefix: '-I' + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.exe' + destination: *build_path +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/targets/hitech_picc18.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/targets/hitech_picc18.yml new file mode 100644 index 0000000..210d944 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/targets/hitech_picc18.yml @@ -0,0 +1,101 @@ +# rumor has it that this yaml file works for the standard edition of the +# hitech PICC18 compiler, but not the pro version. +# +compiler: + path: cd build && picc18 + source_path: 'c:\Projects\NexGen\Prototypes\CMockTest\src\' + unit_tests_path: &unit_tests_path 'c:\Projects\NexGen\Prototypes\CMockTest\test\' + build_path: &build_path 'c:\Projects\NexGen\Prototypes\CMockTest\build\' + options: + - --chip=18F87J10 + - --ide=hitide + - --q #quiet please + - --asmlist + - --codeoffset=0 + - --emi=wordwrite # External memory interface protocol + - --warn=0 # allow all normal warning messages + - --errors=10 # Number of errors before aborting compile + - --char=unsigned + - -Bl # Large memory model + - -G # generate symbol file + - --cp=16 # 16-bit pointers + - --double=24 + - -N255 # 255-char symbol names + - --opt=none # Do not use any compiler optimziations + - -c # compile only + - -M + includes: + prefix: '-I' + items: + - 'c:/Projects/NexGen/Prototypes/CMockTest/src/' + - 'c:/Projects/NexGen/Prototypes/CMockTest/mocks/' + - 'c:/CMock/src/' + - 'c:/CMock/examples/src/' + - 'c:/CMock/vendor/unity/src/' + - 'c:/CMock/vendor/unity/examples/helper/' + - *unit_tests_path + defines: + prefix: '-D' + items: + - UNITY_INT_WIDTH=16 + - UNITY_POINTER_WIDTH=16 + - CMOCK_MEM_STATIC + - CMOCK_MEM_SIZE=3000 + - UNITY_SUPPORT_TEST_CASES + - _PICC18 + object_files: + # prefix: '-O' # Hi-Tech doesn't want a prefix. They key off of filename .extensions, instead + extension: '.obj' + destination: *build_path + +linker: + path: cd build && picc18 + options: + - --chip=18F87J10 + - --ide=hitide + - --cp=24 # 24-bit pointers. Is this needed for linker?? + - --double=24 # Is this needed for linker?? + - -Lw # Scan the pic87*w.lib in the lib/ of the compiler installation directory + - --summary=mem,file # info listing + - --summary=+psect + - --summary=+hex + - --output=+intel + - --output=+mcof + - --runtime=+init # Directs startup code to copy idata, ibigdata and ifardata psects from ROM to RAM. + - --runtime=+clear # Directs startup code to clear bss, bigbss, rbss and farbss psects + - --runtime=+clib # link in the c-runtime + - --runtime=+keep # Keep the generated startup src after its obj is linked + - -G # Generate src-level symbol file + - -MIWasTheLastToBuild.map + - --warn=0 # allow all normal warning messages + - -Bl # Large memory model (probably not needed for linking) + includes: + prefix: '-I' + object_files: + path: *build_path + extension: '.obj' + bin_files: + prefix: '-O' + extension: '.hex' + destination: *build_path + +simulator: + path: + pre_support: + - 'java -client -jar ' # note space + - ['C:\Program Files\HI-TECH Software\HI-TIDE\3.15\lib\', 'simpic18.jar'] + - 18F87J10 + post_support: + +:cmock: + :plugins: [] + :includes: + - Types.h + :suite_teardown: | + if (num_failures) + _FAILED_TEST(); + else + _PASSED_TESTS(); + return 0; + +colour: true \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_arm_v4.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_arm_v4.yml new file mode 100644 index 0000000..c2e7f18 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_arm_v4.yml @@ -0,0 +1,89 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 4.0 Kickstart\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\lib\dl4tptinl8n.h'] + - -z3 + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian little + - --cpu ARM7TDMI + - --stack_align 4 + - --interwork + - -e + - --silent + - --warnings_are_errors + - --fpu None + - --diag_suppress Pa050 + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'common\bin\xlink.exe'] + options: + - -rt + - [*tools_root, 'arm\lib\dl4tptinl8n.r79'] + - -D_L_EXTMEM_START=0 + - -D_L_EXTMEM_SIZE=0 + - -D_L_HEAP_SIZE=120 + - -D_L_STACK_SIZE=32 + - -e_small_write=_formatted_write + - -s + - __program_start + - -f + - [*tools_root, '\arm\config\lnkarm.xcl'] + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\config\'] + - [*tools_root, 'arm\lib\'] + object_files: + path: *build_path + extension: '.r79' + bin_files: + prefix: '-o' + extension: '.d79' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\ioat91sam7X256.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_arm_v5.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_arm_v5.yml new file mode 100644 index 0000000..0549d8e --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_arm_v5.yml @@ -0,0 +1,79 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian=little + - --cpu=ARM7TDMI + - --interwork + - --warnings_are_errors + - --fpu=None + - --diag_suppress=Pa050 + - --diag_suppress=Pe111 + - -e + - -On + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\debugger\atmel\ioat91sam7X256.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_arm_v5_3.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_arm_v5_3.yml new file mode 100644 index 0000000..0549d8e --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_arm_v5_3.yml @@ -0,0 +1,79 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian=little + - --cpu=ARM7TDMI + - --interwork + - --warnings_are_errors + - --fpu=None + - --diag_suppress=Pa050 + - --diag_suppress=Pe111 + - -e + - -On + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\debugger\atmel\ioat91sam7X256.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml new file mode 100644 index 0000000..eb0785c --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml @@ -0,0 +1,93 @@ +#Default tool path for IAR 5.4 on Windows XP 64bit +tools_root: &tools_root 'C:\Program Files (x86)\IAR Systems\Embedded Workbench 5.4 Kickstart\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --diag_suppress=Pa050 + #- --diag_suppress=Pe111 + - --debug + - --endian=little + - --cpu=Cortex-M3 + - --no_path_in_file_macros + - -e + - --fpu=None + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + #- --preinclude --preinclude C:\Vss\T2 Working\common\system.h + - --interwork + - --warnings_are_errors +# - Ohz + - -Oh +# - --no_cse +# - --no_unroll +# - --no_inline +# - --no_code_motion +# - --no_tbaa +# - --no_clustering +# - --no_scheduling + + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - ewarm + - PART_LM3S9B92 + - TARGET_IS_TEMPEST_RB1 + - USE_ROM_DRIVERS + - UART_BUFFERED + - UNITY_SUPPORT_64 + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic.icf'] +# - ['C:\Temp\lm3s9b92.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + #- --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim2.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - --endian=little + - --cpu=Cortex-M3 + - --fpu=None + - -p + - [*tools_root, 'arm\config\debugger\TexasInstruments\iolm3sxxxx.ddf'] + - --semihosting + - --device=LM3SxBxx + #- -d + #- sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_cortexm3_v5.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_cortexm3_v5.yml new file mode 100644 index 0000000..cf0d1d0 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_cortexm3_v5.yml @@ -0,0 +1,83 @@ +# unit testing under iar compiler / simulator for STM32 Cortex-M3 + +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.4\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian=little + - --cpu=Cortex-M3 + - --interwork + - --warnings_are_errors + - --fpu=None + - --diag_suppress=Pa050 + - --diag_suppress=Pe111 + - -e + - -On + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - 'IAR' + - 'UNITY_SUPPORT_64' + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic_cortex.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\debugger\ST\iostm32f107xx.ddf'] + - --cpu=Cortex-M3 + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_msp430.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_msp430.yml new file mode 100644 index 0000000..e022647 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_msp430.yml @@ -0,0 +1,94 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3 MSP430\' +core_root: &core_root [*tools_root, '430\'] +core_bin: &core_bin [*core_root, 'bin\'] +core_config: &core_config [*core_root, 'config\'] +core_lib: &core_lib [*core_root, 'lib\'] +core_inc: &core_inc [*core_root, 'inc\'] +core_config: &core_config [*core_root, 'config\'] + +compiler: + path: [*core_bin, 'icc430.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*core_lib, 'dlib\dl430fn.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --debug + - -e + - -Ol + - --multiplier=16 + - --double=32 + - --diag_suppress Pa050 + - --diag_suppress Pe111 + includes: + prefix: '-I' + items: + - *core_inc + - [*core_inc, 'dlib'] + - [*core_lib, 'dlib'] + - 'src\' + - '../src/' + - *unit_tests_path + - 'vendor\unity\src' + defines: + prefix: '-D' + items: + - '__MSP430F149__' + - 'INT_WIDTH=16' + - 'UNITY_EXCLUDE_FLOAT' + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r43' + destination: *build_path +linker: + path: [*core_bin, 'xlink.exe'] + options: + - -rt + - [*core_lib, 'dlib\dl430fn.r43'] + - -e_PrintfTiny=_Printf + - -e_ScanfSmall=_Scanf + - -s __program_start + - -D_STACK_SIZE=50 + - -D_DATA16_HEAP_SIZE=50 + - -D_DATA20_HEAP_SIZE=50 + - -f + - [*core_config, 'lnk430f5438.xcl'] + - -f + - [*core_config, 'multiplier.xcl'] + includes: + prefix: '-I' + items: + - *core_config + - *core_lib + - [*core_lib, 'dlib'] + object_files: + path: *build_path + extension: '.r79' + bin_files: + prefix: '-o' + extension: '.d79' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*core_bin, '430proc.dll'] + - [*core_bin, '430sim.dll'] + post_support: + - --plugin + - [*core_bin, '430bat.dll'] + - --backend -B + - --cpu MSP430F5438 + - -p + - [*core_config, 'MSP430F5438.ddf'] + - -d sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_sh2a_v6.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_sh2a_v6.yml new file mode 100644 index 0000000..ddc5603 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/targets/iar_sh2a_v6.yml @@ -0,0 +1,85 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 6.0\' +compiler: + path: [*tools_root, 'sh\bin\iccsh.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - -e + - --char_is_signed + - -Ol + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_scheduling + - --no_clustering + - --debug + - --dlib_config + - [*tools_root, 'sh\inc\DLib_Product.h'] + - --double=32 + - --code_model=huge + - --data_model=huge + - --core=sh2afpu + - --warnings_affect_exit_code + - --warnings_are_errors + - --mfc + - --use_unix_directory_separators + - --diag_suppress=Pe161 + includes: + prefix: '-I' + items: + - [*tools_root, 'sh\inc\'] + - [*tools_root, 'sh\inc\c'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.o' + destination: *build_path +linker: + path: [*tools_root, 'sh\bin\ilinksh.exe'] + options: + - --redirect __Printf=__PrintfSmall + - --redirect __Scanf=__ScanfSmall + - --config + - [*tools_root, 'sh\config\generic.icf'] + - --config_def _CSTACK_SIZE=0x800 + - --config_def _HEAP_SIZE=0x800 + - --config_def _INT_TABLE=0x10 + - --entry __iar_program_start + - --debug_lib + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'sh\bin\shproc.dll'] + - [*tools_root, 'sh\bin\shsim.dll'] + post_support: + - --plugin + - [*tools_root, 'sh\bin\shbat.dll'] + - --backend + - -B + - --core sh2afpu + - -p + - [*tools_root, 'sh\config\debugger\io7264.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_cmd.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_cmd.c new file mode 100644 index 0000000..42841d8 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_cmd.c @@ -0,0 +1,54 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include +#include "CException.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_def.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_def.c new file mode 100644 index 0000000..8280804 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_def.c @@ -0,0 +1,50 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_cmd.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_cmd.c new file mode 100644 index 0000000..e47b31c --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_cmd.c @@ -0,0 +1,76 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_def.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_def.c new file mode 100644 index 0000000..3ca9dba --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_def.c @@ -0,0 +1,72 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new1.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new1.c new file mode 100644 index 0000000..a7cbcd8 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new1.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + GlobalExpectCount = 0; + GlobalVerifyOrder = 0; + GlobalOrderError = NULL; + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new2.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new2.c new file mode 100644 index 0000000..2c76bf2 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new2.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_param.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_param.c new file mode 100644 index 0000000..23c04f4 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_param.c @@ -0,0 +1,73 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST_NO_ARGS +#define RUN_TEST(TestFunc, TestLineNum, ...) \ +{ \ + Unity.CurrentTestName = #TestFunc "(" #__VA_ARGS__ ")"; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(__VA_ARGS__); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21, RUN_TEST_NO_ARGS); + RUN_TEST(test_TheSecondThingToTest, 43, RUN_TEST_NO_ARGS); + + return (UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run1.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run1.c new file mode 100644 index 0000000..a7cbcd8 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run1.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + GlobalExpectCount = 0; + GlobalVerifyOrder = 0; + GlobalOrderError = NULL; + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run2.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run2.c new file mode 100644 index 0000000..2c76bf2 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run2.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_yaml.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_yaml.c new file mode 100644 index 0000000..68b545a --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_yaml.c @@ -0,0 +1,86 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include "two.h" +#include "three.h" +#include +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_yaml_setup(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_new1.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_new1.c new file mode 100644 index 0000000..e5bcac2 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_new1.c @@ -0,0 +1,60 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_new2.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_new2.c new file mode 100644 index 0000000..b7c7e5b --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_new2.c @@ -0,0 +1,63 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_param.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_param.c new file mode 100644 index 0000000..4157007 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_param.c @@ -0,0 +1,51 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST_NO_ARGS +#define RUN_TEST(TestFunc, TestLineNum, ...) \ +{ \ + Unity.CurrentTestName = #TestFunc "(" #__VA_ARGS__ ")"; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(__VA_ARGS__); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21, RUN_TEST_NO_ARGS); + RUN_TEST(test_TheSecondThingToTest, 43, RUN_TEST_NO_ARGS); + + return (UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_run1.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_run1.c new file mode 100644 index 0000000..e5bcac2 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_run1.c @@ -0,0 +1,60 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_run2.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_run2.c new file mode 100644 index 0000000..b7c7e5b --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_run2.c @@ -0,0 +1,63 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_yaml.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_yaml.c new file mode 100644 index 0000000..d109287 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/expectdata/testsample_yaml.c @@ -0,0 +1,64 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "two.h" +#include "three.h" +#include +#include +#include +#include "CException.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_yaml_setup(); +} + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/test_generate_test_runner.rb b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/test_generate_test_runner.rb new file mode 100644 index 0000000..61c8df9 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/test_generate_test_runner.rb @@ -0,0 +1,94 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +ruby_version = RUBY_VERSION.split('.') +if (ruby_version[1].to_i == 9) and (ruby_version[2].to_i > 1) + require 'rubygems' + gem 'test-unit' +end +require 'test/unit' +require './auto/generate_test_runner.rb' + +TEST_FILE = 'test/testdata/testsample.c' +TEST_MOCK = 'test/testdata/mocksample.c' +OUT_FILE = 'build/testsample_' +EXP_FILE = 'test/expectdata/testsample_' + +class TestGenerateTestRunner < Test::Unit::TestCase + def setup + end + + def teardown + end + + def verify_output_equal(subtest) + expected = File.read(EXP_FILE + subtest + '.c').gsub(/\r\n/,"\n") + actual = File.read(OUT_FILE + subtest + '.c').gsub(/\r\n/,"\n") + assert_equal(expected, actual, "Generated File Sub-Test '#{subtest}' Failed") + end + + def test_ShouldGenerateARunnerByCreatingRunnerWithOptions + sets = { 'def' => nil, + 'new1' => { :plugins => [:cexception], :includes => ['one.h', 'two.h'], :enforce_strict_ordering => true }, + 'new2' => { :plugins => [:ignore], :suite_setup => "a_custom_setup();", :suite_teardown => "a_custom_teardown();" } + } + + sets.each_pair do |subtest, options| + UnityTestRunnerGenerator.new(options).run(TEST_FILE, OUT_FILE + subtest + '.c') + verify_output_equal(subtest) + UnityTestRunnerGenerator.new(options).run(TEST_MOCK, OUT_FILE + 'mock_' + subtest + '.c') + verify_output_equal('mock_' + subtest) + end + end + + def test_ShouldGenerateARunnerByRunningRunnerWithOptions + sets = { 'run1' => { :plugins => [:cexception], :includes => ['one.h', 'two.h'], :enforce_strict_ordering => true }, + 'run2' => { :plugins => [:ignore], :suite_setup => "a_custom_setup();", :suite_teardown => "a_custom_teardown();" } + } + + sets.each_pair do |subtest, options| + UnityTestRunnerGenerator.new.run(TEST_FILE, OUT_FILE + subtest + '.c', options) + verify_output_equal(subtest) + UnityTestRunnerGenerator.new.run(TEST_MOCK, OUT_FILE + 'mock_' + subtest + '.c', options) + verify_output_equal('mock_' + subtest) + end + end + + def test_ShouldGenerateARunnerByPullingYamlOptions + subtest = 'yaml' + cmdstr = "ruby auto/generate_test_runner.rb test/testdata/sample.yml \"#{TEST_FILE}\" \"#{OUT_FILE + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal(subtest) + + cmdstr = "ruby auto/generate_test_runner.rb test/testdata/sample.yml \"#{TEST_MOCK}\" \"#{OUT_FILE + 'mock_' + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal('mock_' + subtest) + end + + def test_ShouldGenerateARunnerByPullingCommandlineOptions + subtest = 'cmd' + cmdstr = "ruby auto/generate_test_runner.rb -cexception \"#{TEST_FILE}\" \"#{OUT_FILE + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal(subtest) + + cmdstr = "ruby auto/generate_test_runner.rb -cexception \"#{TEST_MOCK}\" \"#{OUT_FILE + 'mock_' + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal('mock_' + subtest) + end + + def test_ShouldGenerateARunnerThatUsesParameterizedTests + sets = { 'param' => { :plugins => [:ignore], :use_param_tests => true } + } + + sets.each_pair do |subtest, options| + UnityTestRunnerGenerator.new(options).run(TEST_FILE, OUT_FILE + subtest + '.c') + verify_output_equal(subtest) + UnityTestRunnerGenerator.new(options).run(TEST_MOCK, OUT_FILE + 'mock_' + subtest + '.c') + verify_output_equal('mock_' + subtest) + end + end + +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/testdata/mocksample.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/testdata/mocksample.c new file mode 100644 index 0000000..b709438 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/testdata/mocksample.c @@ -0,0 +1,51 @@ +// This is just a sample test file to be used to test the generator script +#ifndef TEST_SAMPLE_H +#define TEST_SAMPLE_H + +#include +#include "unity.h" +#include "funky.h" +#include "Mockstanky.h" + +void setUp(void) +{ + CustomSetupStuff(); +} + +void tearDown(void) +{ + CustomTeardownStuff +} + +//Yup, nice comment +void test_TheFirstThingToTest(void) +{ + TEST_ASSERT(1); + + TEST_ASSERT_TRUE(1); +} + +/* +void test_ShouldBeIgnored(void) +{ + DoesStuff(); +} +*/ + +//void test_ShouldAlsoNotBeTested(void) +//{ +// Call_An_Expect(); +// +// CallAFunction(); +// test_CallAFunctionThatLooksLikeATest(); +//} + +void test_TheSecondThingToTest(void) +{ + Call_An_Expect(); + + CallAFunction(); + test_CallAFunctionThatLooksLikeATest(); +} + +#endif //TEST_SAMPLE_H diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/testdata/sample.yml b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/testdata/sample.yml new file mode 100644 index 0000000..9e5eece --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/testdata/sample.yml @@ -0,0 +1,9 @@ +:unity: + :includes: + - two.h + - three.h + - + :plugins: + - :cexception + :suite_setup: | + a_yaml_setup(); \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/testdata/testsample.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/testdata/testsample.c new file mode 100644 index 0000000..4f30ec7 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/testdata/testsample.c @@ -0,0 +1,51 @@ +// This is just a sample test file to be used to test the generator script +#ifndef TEST_SAMPLE_H +#define TEST_SAMPLE_H + +#include +#include "unity.h" +#include "funky.h" +#include "stanky.h" + +void setUp(void) +{ + CustomSetupStuff(); +} + +void tearDown(void) +{ + CustomTeardownStuff +} + +//Yup, nice comment +void test_TheFirstThingToTest(void) +{ + TEST_ASSERT(1); + + TEST_ASSERT_TRUE(1); +} + +/* +void test_ShouldBeIgnored(void) +{ + DoesStuff(); +} +*/ + +//void test_ShouldAlsoNotBeTested(void) +//{ +// Call_An_Expect(); +// +// CallAFunction(); +// test_CallAFunctionThatLooksLikeATest(); +//} + +void test_TheSecondThingToTest(void) +{ + Call_An_Expect(); + + CallAFunction(); + test_CallAFunctionThatLooksLikeATest(); +} + +#endif //TEST_SAMPLE_H diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/testparameterized.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/testparameterized.c new file mode 100644 index 0000000..037cd21 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/testparameterized.c @@ -0,0 +1,101 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include +#include "unity.h" + +#define TEST_CASE(...) + +#define EXPECT_ABORT_BEGIN \ + if (TEST_PROTECT()) \ + { + +#define VERIFY_FAILS_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestFailed == 1) ? 0 : 1; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Failed But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +#define VERIFY_IGNORES_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestIgnored == 1) ? 0 : 1; \ + Unity.CurrentTestIgnored = 0; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Ignored But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +int SetToOneToFailInTearDown; +int SetToOneMeanWeAlreadyCheckedThisGuy; + +void setUp(void) +{ + SetToOneToFailInTearDown = 0; + SetToOneMeanWeAlreadyCheckedThisGuy = 0; +} + +void tearDown(void) +{ + if (SetToOneToFailInTearDown == 1) + TEST_FAIL_MESSAGE("<= Failed in tearDown"); + if ((SetToOneMeanWeAlreadyCheckedThisGuy == 0) && (Unity.CurrentTestFailed > 0)) + { + UnityPrint("[[[[ Previous Test Should Have Passed But Did Not ]]]]"); + UNITY_OUTPUT_CHAR('\n'); + } +} + +TEST_CASE(0) +TEST_CASE(44) +TEST_CASE((90)+9) +void test_TheseShouldAllPass(int Num) +{ + TEST_ASSERT_TRUE(Num < 100); +} + +TEST_CASE(3) +TEST_CASE(77) +TEST_CASE( (99) + 1 - (1)) +void test_TheseShouldAllFail(int Num) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(Num > 100); + VERIFY_FAILS_END +} + +TEST_CASE(1) +TEST_CASE(44) +TEST_CASE(99) +TEST_CASE(98) +void test_TheseAreEveryOther(int Num) +{ + if (Num & 1) + { + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(Num > 100); + VERIFY_FAILS_END + } + else + { + TEST_ASSERT_TRUE(Num < 100); + } +} + +void test_NormalPassesStillWork(void) +{ + TEST_ASSERT_TRUE(1); +} + +void test_NormalFailsStillWork(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(0); + VERIFY_FAILS_END +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/testunity.c b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/testunity.c new file mode 100644 index 0000000..9f826dc --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/cmock/vendor/unity/test/testunity.c @@ -0,0 +1,1510 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include +#include "unity.h" + +#define EXPECT_ABORT_BEGIN \ + if (TEST_PROTECT()) \ + { + +#define VERIFY_FAILS_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestFailed == 1) ? 0 : 1; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Failed But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +#define VERIFY_IGNORES_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestIgnored == 1) ? 0 : 1; \ + Unity.CurrentTestIgnored = 0; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Ignored But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +int SetToOneToFailInTearDown; +int SetToOneMeanWeAlreadyCheckedThisGuy; + +void setUp(void) +{ + SetToOneToFailInTearDown = 0; + SetToOneMeanWeAlreadyCheckedThisGuy = 0; +} + +void tearDown(void) +{ + if (SetToOneToFailInTearDown == 1) + TEST_FAIL_MESSAGE("<= Failed in tearDown"); + if ((SetToOneMeanWeAlreadyCheckedThisGuy == 0) && (Unity.CurrentTestFailed > 0)) + { + UnityPrint("[[[[ Previous Test Should Have Passed But Did Not ]]]]"); + UNITY_OUTPUT_CHAR('\n'); + } +} + +void testTrue(void) +{ + TEST_ASSERT(1); + + TEST_ASSERT_TRUE(1); +} + +void testFalse(void) +{ + TEST_ASSERT_FALSE(0); + + TEST_ASSERT_UNLESS(0); +} + +void testPreviousPass(void) +{ + TEST_ASSERT_EQUAL_INT(0U, Unity.TestFailures); +} + +void testNotVanilla(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT(0); + VERIFY_FAILS_END +} + +void testNotTrue(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(0); + VERIFY_FAILS_END +} + +void testNotFalse(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_FALSE(1); + VERIFY_FAILS_END +} + +void testNotUnless(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UNLESS(1); + VERIFY_FAILS_END +} + +void testNotNotEqual(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_NOT_EQUAL(10, 10); + VERIFY_FAILS_END +} + +void testFail(void) +{ + EXPECT_ABORT_BEGIN + TEST_FAIL_MESSAGE("Expected for testing"); + VERIFY_FAILS_END +} + +void testIsNull(void) +{ + char* ptr1 = NULL; + char* ptr2 = "hello"; + + TEST_ASSERT_NULL(ptr1); + TEST_ASSERT_NOT_NULL(ptr2); +} + +void testIsNullShouldFailIfNot(void) +{ + char* ptr1 = "hello"; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_NULL(ptr1); + VERIFY_FAILS_END +} + +void testNotNullShouldFailIfNULL(void) +{ + char* ptr1 = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_NOT_NULL(ptr1); + VERIFY_FAILS_END +} + +void testIgnore(void) +{ + EXPECT_ABORT_BEGIN + TEST_IGNORE(); + TEST_FAIL_MESSAGE("This should not be reached"); + VERIFY_IGNORES_END +} + +void testIgnoreMessage(void) +{ + EXPECT_ABORT_BEGIN + TEST_IGNORE_MESSAGE("This is an expected TEST_IGNORE_MESSAGE string!"); + TEST_FAIL_MESSAGE("This should not be reached"); + VERIFY_IGNORES_END +} + +void testNotEqualInts(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT(3982, 3983); + VERIFY_FAILS_END +} + +void testNotEqualInt8s(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT8(-127, -126); + VERIFY_FAILS_END +} + +void testNotEqualInt16s(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT16(-16383, -16382); + VERIFY_FAILS_END +} + +void testNotEqualInt32s(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT32(-2147483647, -2147483646); + VERIFY_FAILS_END +} + +void testNotEqualBits(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_BITS(0xFF00, 0x5555, 0x5A55); + VERIFY_FAILS_END +} + +void testNotEqualUInts(void) +{ + _UU16 v0, v1; + + v0 = 9000; + v1 = 9001; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualUInt8s(void) +{ + _UU8 v0, v1; + + v0 = 254; + v1 = 255; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT8(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualUInt16s(void) +{ + _UU16 v0, v1; + + v0 = 65535; + v1 = 65534; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualUInt32s(void) +{ + _UU32 v0, v1; + + v0 = 4294967295; + v1 = 4294967294; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT32(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex8s(void) +{ + _UU8 v0, v1; + + v0 = 0x23; + v1 = 0x22; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex8sIfSigned(void) +{ + _US8 v0, v1; + + v0 = -2; + v1 = 2; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex16s(void) +{ + _UU16 v0, v1; + + v0 = 0x1234; + v1 = 0x1235; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex16sIfSigned(void) +{ + _US16 v0, v1; + + v0 = -1024; + v1 = -1028; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex32s(void) +{ + _UU32 v0, v1; + + v0 = 900000; + v1 = 900001; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex32sIfSigned(void) +{ + _US32 v0, v1; + + v0 = -900000; + v1 = 900001; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32(v0, v1); + VERIFY_FAILS_END +} + +void testEqualInts(void) +{ + int v0, v1; + int *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(1837, 1837); + TEST_ASSERT_EQUAL_INT(-27365, -27365); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(19467, v1); + TEST_ASSERT_EQUAL_INT(v0, 19467); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 19467); +} + +void testEqualUints(void) +{ + unsigned int v0, v1; + unsigned int *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_UINT(1837, 1837); + TEST_ASSERT_EQUAL_UINT(v0, v1); + TEST_ASSERT_EQUAL_UINT(19467, v1); + TEST_ASSERT_EQUAL_UINT(v0, 19467); + TEST_ASSERT_EQUAL_UINT(*p0, v1); + TEST_ASSERT_EQUAL_UINT(*p0, *p1); + TEST_ASSERT_EQUAL_UINT(*p0, 19467); + TEST_ASSERT_EQUAL_UINT(60872u, 60872u); +} + +void testNotEqual(void) +{ + TEST_ASSERT_NOT_EQUAL(0, 1); + TEST_ASSERT_NOT_EQUAL(1, 0); + TEST_ASSERT_NOT_EQUAL(100, 101); + TEST_ASSERT_NOT_EQUAL(0, -1); + TEST_ASSERT_NOT_EQUAL(65535, -65535); + TEST_ASSERT_NOT_EQUAL(75, 900); + TEST_ASSERT_NOT_EQUAL(-100, -101); +} + +void testEqualHex8s(void) +{ + _UU8 v0, v1; + _UU8 *p0, *p1; + + v0 = 0x22; + v1 = 0x22; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX8(0x22, 0x22); + TEST_ASSERT_EQUAL_HEX8(v0, v1); + TEST_ASSERT_EQUAL_HEX8(0x22, v1); + TEST_ASSERT_EQUAL_HEX8(v0, 0x22); + TEST_ASSERT_EQUAL_HEX8(*p0, v1); + TEST_ASSERT_EQUAL_HEX8(*p0, *p1); + TEST_ASSERT_EQUAL_HEX8(*p0, 0x22); +} + +void testEqualHex8sNegatives(void) +{ + _UU8 v0, v1; + _UU8 *p0, *p1; + + v0 = 0xDD; + v1 = 0xDD; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX8(0xDD, 0xDD); + TEST_ASSERT_EQUAL_HEX8(v0, v1); + TEST_ASSERT_EQUAL_HEX8(0xDD, v1); + TEST_ASSERT_EQUAL_HEX8(v0, 0xDD); + TEST_ASSERT_EQUAL_HEX8(*p0, v1); + TEST_ASSERT_EQUAL_HEX8(*p0, *p1); + TEST_ASSERT_EQUAL_HEX8(*p0, 0xDD); +} + +void testEqualHex16s(void) +{ + _UU16 v0, v1; + _UU16 *p0, *p1; + + v0 = 0x9876; + v1 = 0x9876; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX16(0x9876, 0x9876); + TEST_ASSERT_EQUAL_HEX16(v0, v1); + TEST_ASSERT_EQUAL_HEX16(0x9876, v1); + TEST_ASSERT_EQUAL_HEX16(v0, 0x9876); + TEST_ASSERT_EQUAL_HEX16(*p0, v1); + TEST_ASSERT_EQUAL_HEX16(*p0, *p1); + TEST_ASSERT_EQUAL_HEX16(*p0, 0x9876); +} + +void testEqualHex32s(void) +{ + _UU32 v0, v1; + _UU32 *p0, *p1; + + v0 = 0x98765432ul; + v1 = 0x98765432ul; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX32(0x98765432ul, 0x98765432ul); + TEST_ASSERT_EQUAL_HEX32(v0, v1); + TEST_ASSERT_EQUAL_HEX32(0x98765432ul, v1); + TEST_ASSERT_EQUAL_HEX32(v0, 0x98765432ul); + TEST_ASSERT_EQUAL_HEX32(*p0, v1); + TEST_ASSERT_EQUAL_HEX32(*p0, *p1); + TEST_ASSERT_EQUAL_HEX32(*p0, 0x98765432ul); +} + +void testEqualBits(void) +{ + _UU32 v0 = 0xFF55AA00; + _UU32 v1 = 0x55550000; + + TEST_ASSERT_BITS(v1, v0, 0x55550000); + TEST_ASSERT_BITS(v1, v0, 0xFF55CC00); + TEST_ASSERT_BITS(0xFFFFFFFF, v0, 0xFF55AA00); + TEST_ASSERT_BITS(0xFFFFFFFF, v0, v0); + TEST_ASSERT_BITS(0xF0F0F0F0, v0, 0xFC5DAE0F); + TEST_ASSERT_BITS_HIGH(v1, v0); + TEST_ASSERT_BITS_LOW(0x000055FF, v0); + TEST_ASSERT_BIT_HIGH(30, v0); + TEST_ASSERT_BIT_LOW(5, v0); +} + +void testEqualShorts(void) +{ + short v0, v1; + short *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(1837, 1837); + TEST_ASSERT_EQUAL_INT(-2987, -2987); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(19467, v1); + TEST_ASSERT_EQUAL_INT(v0, 19467); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 19467); +} + +void testEqualUShorts(void) +{ + unsigned short v0, v1; + unsigned short *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_UINT(1837, 1837); + TEST_ASSERT_EQUAL_UINT(2987, 2987); + TEST_ASSERT_EQUAL_UINT(v0, v1); + TEST_ASSERT_EQUAL_UINT(19467, v1); + TEST_ASSERT_EQUAL_UINT(v0, 19467); + TEST_ASSERT_EQUAL_UINT(*p0, v1); + TEST_ASSERT_EQUAL_UINT(*p0, *p1); + TEST_ASSERT_EQUAL_UINT(*p0, 19467); +} + +void testEqualChars(void) +{ + signed char v0, v1; + signed char *p0, *p1; + + v0 = 109; + v1 = 109; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(42, 42); + TEST_ASSERT_EQUAL_INT(-116, -116); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(109, v1); + TEST_ASSERT_EQUAL_INT(v0, 109); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 109); +} + +void testEqualUChars(void) +{ + unsigned char v0, v1; + unsigned char *p0, *p1; + + v0 = 251; + v1 = 251; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(42, 42); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(251, v1); + TEST_ASSERT_EQUAL_INT(v0, 251); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 251); +} + +void testEqualPointers(void) +{ + int v0, v1; + int *p0, *p1, *p2; + + v0 = 19467; + v1 = 18271; + p0 = &v0; + p1 = &v1; + p2 = &v1; + + TEST_ASSERT_EQUAL_PTR(p0, &v0); + TEST_ASSERT_EQUAL_PTR(&v1, p1); + TEST_ASSERT_EQUAL_PTR(p2, p1); + TEST_ASSERT_EQUAL_PTR(&v0, &v0); +} + +void testNotEqualPointers(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_PTR(0x12345678, 0x12345677); + VERIFY_FAILS_END +} + +void testIntsWithinDelta(void) +{ + TEST_ASSERT_INT_WITHIN(1, 5000, 5001); + TEST_ASSERT_INT_WITHIN(5, 5000, 4996); + TEST_ASSERT_INT_WITHIN(5, 5000, 5005); + TEST_ASSERT_INT_WITHIN(500, 50, -440); + + TEST_ASSERT_INT_WITHIN(2, -1, -1); + TEST_ASSERT_INT_WITHIN(5, 1, -1); + TEST_ASSERT_INT_WITHIN(5, -1, 1); +} + +void testIntsNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_INT_WITHIN(5, 5000, 5006); + VERIFY_FAILS_END +} + +void testUIntsWithinDelta(void) +{ + TEST_ASSERT_UINT_WITHIN(1, 5000, 5001); + TEST_ASSERT_UINT_WITHIN(5, 5000, 4996); + TEST_ASSERT_UINT_WITHIN(5, 5000, 5005); +} + +void testUIntsNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UINT_WITHIN(1, 2147483647u, 2147483649u); + VERIFY_FAILS_END +} + +void testUIntsNotWithinDeltaEvenThoughASignedIntWouldPassSmallFirst(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UINT_WITHIN(5, 1, -1); + VERIFY_FAILS_END +} + +void testUIntsNotWithinDeltaEvenThoughASignedIntWouldPassBigFirst(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UINT_WITHIN(5, -1, 1); + VERIFY_FAILS_END +} + +void testHEX32sWithinDelta(void) +{ + TEST_ASSERT_HEX32_WITHIN(1, 5000, 5001); + TEST_ASSERT_HEX32_WITHIN(5, 5000, 4996); + TEST_ASSERT_HEX32_WITHIN(5, 5000, 5005); +} + +void testHEX32sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX32_WITHIN(1, 2147483647u, 2147483649u); + VERIFY_FAILS_END +} + +void testHEX32sNotWithinDeltaEvenThoughASignedIntWouldPass(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX32_WITHIN(5, 1, -1); + VERIFY_FAILS_END +} + +void testHEX16sWithinDelta(void) +{ + TEST_ASSERT_HEX16_WITHIN(1, 5000, 5001); + TEST_ASSERT_HEX16_WITHIN(5, 5000, 4996); + TEST_ASSERT_HEX16_WITHIN(5, 5000, 5005); +} + +void testHEX16sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX16_WITHIN(2, 65535, 0); + VERIFY_FAILS_END +} + +void testHEX8sWithinDelta(void) +{ + TEST_ASSERT_HEX8_WITHIN(1, 254, 255); + TEST_ASSERT_HEX8_WITHIN(5, 251, 255); + TEST_ASSERT_HEX8_WITHIN(5, 1, 4); +} + +void testHEX8sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX8_WITHIN(2, 255, 0); + VERIFY_FAILS_END +} + +void testEqualStrings(void) +{ + const char *testString = "foo"; + + TEST_ASSERT_EQUAL_STRING(testString, testString); + TEST_ASSERT_EQUAL_STRING("foo", "foo"); + TEST_ASSERT_EQUAL_STRING("foo", testString); + TEST_ASSERT_EQUAL_STRING(testString, "foo"); + TEST_ASSERT_EQUAL_STRING("", ""); +} + +void testEqualStringsWithCarriageReturnsAndLineFeeds(void) +{ + const char *testString = "foo\r\nbar"; + + TEST_ASSERT_EQUAL_STRING(testString, testString); + TEST_ASSERT_EQUAL_STRING("foo\r\nbar", "foo\r\nbar"); + TEST_ASSERT_EQUAL_STRING("foo\r\nbar", testString); + TEST_ASSERT_EQUAL_STRING(testString, "foo\r\nbar"); + TEST_ASSERT_EQUAL_STRING("", ""); +} + +void testNotEqualString1(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("foo", "bar"); + VERIFY_FAILS_END +} + +void testNotEqualString2(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("foo", ""); + VERIFY_FAILS_END +} + +void testNotEqualString3(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("", "bar"); + VERIFY_FAILS_END +} + +void testNotEqualString4(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("bar\r", "bar\n"); + VERIFY_FAILS_END +} + +void testNotEqualString5(void) +{ + const char str1[] = { 0x41, 0x42, 0x03, 0x00 }; + const char str2[] = { 0x41, 0x42, 0x04, 0x00 }; + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING(str1, str2); + VERIFY_FAILS_END +} + +void testNotEqualString_ExpectedStringIsNull(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING(NULL, "bar"); + VERIFY_FAILS_END +} + +void testNotEqualString_ActualStringIsNull(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("foo", NULL); + VERIFY_FAILS_END +} + +void testEqualStringArrays(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, expStrings, 3); + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 3); + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 2); + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 1); +} + +void testNotEqualStringArray1(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray2(void) +{ + const char *testStrings[] = { "zoo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", "boo", "woo", "moo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray3(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", NULL }; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray4(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", NULL, "woo", "moo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray5(void) +{ + const char **testStrings = NULL; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray6(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "zoo" }; + const char **expStrings = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testEqualStringArrayIfBothNulls(void) +{ + const char **testStrings = NULL; + const char **expStrings = NULL; + + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); +} + +void testEqualMemory(void) +{ + const char *testString = "whatever"; + + TEST_ASSERT_EQUAL_MEMORY(testString, testString, 8); + TEST_ASSERT_EQUAL_MEMORY("whatever", "whatever", 8); + TEST_ASSERT_EQUAL_MEMORY("whatever", testString, 8); + TEST_ASSERT_EQUAL_MEMORY(testString, "whatever", 8); + TEST_ASSERT_EQUAL_MEMORY(testString, "whatever", 2); + TEST_ASSERT_EQUAL_MEMORY(NULL, NULL, 1); +} + +void testNotEqualMemory1(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY("foo", "bar", 3); + VERIFY_FAILS_END +} + +void testNotEqualMemory2(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY("fool", "food", 4); + VERIFY_FAILS_END +} + +void testNotEqualMemory3(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY(NULL, "food", 4); + VERIFY_FAILS_END +} + +void testNotEqualMemory4(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY("fool", NULL, 4); + VERIFY_FAILS_END +} + +void testEqualIntArrays(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, -2}; + int p2[] = {1, 8, 987, 2}; + int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p3, 1); +} + +void testNotEqualIntArraysNullExpected(void) +{ + int* p0 = NULL; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArraysNullActual(void) +{ + int* p1 = NULL; + int p0[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArrays1(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArrays2(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {2, 8, 987, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArrays3(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 986, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualInt8Arrays(void) +{ + _US8 p0[] = {1, 8, 117, -2}; + _US8 p1[] = {1, 8, 117, -2}; + _US8 p2[] = {1, 8, 117, 2}; + _US8 p3[] = {1, 50, 60, 70}; + + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p3, 1); +} + +void testNotEqualInt8Arrays(void) +{ + _US8 p0[] = {1, 8, 127, -2}; + _US8 p1[] = {1, 8, 127, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualUIntArrays(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65132u}; + unsigned int p2[] = {1, 8, 987, 2}; + unsigned int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p3, 1); +} + +void testNotEqualUIntArrays1(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUIntArrays2(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUIntArrays3(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualInt16Arrays(void) +{ + _UU16 p0[] = {1, 8, 117, 3}; + _UU16 p1[] = {1, 8, 117, 3}; + _UU16 p2[] = {1, 8, 117, 2}; + _UU16 p3[] = {1, 50, 60, 70}; + + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p3, 1); +} + +void testNotEqualInt16Arrays(void) +{ + _UU16 p0[] = {1, 8, 127, 3}; + _UU16 p1[] = {1, 8, 127, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualUINT16Arrays(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65132u}; + unsigned short p2[] = {1, 8, 987, 2}; + unsigned short p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p3, 1); +} + +void testNotEqualUINT16Arrays1(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUINT16Arrays2(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUINT16Arrays3(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualHEXArrays(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65132u}; + unsigned int p2[] = {1, 8, 987, 2}; + unsigned int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p3, 1); +} + +void testNotEqualHEXArrays1(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEXArrays2(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEXArrays3(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualHEX16Arrays(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65132u}; + unsigned short p2[] = {1, 8, 987, 2}; + unsigned short p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p3, 1); +} + +void testNotEqualHEX16Arrays1(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX16Arrays2(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX16Arrays3(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualHEX8Arrays(void) +{ + unsigned short p0[] = {1, 8, 254u, 123}; + unsigned short p1[] = {1, 8, 254u, 123}; + unsigned short p2[] = {1, 8, 254u, 2}; + unsigned short p3[] = {1, 23, 25, 26}; + + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p3, 1); +} + +void testNotEqualHEX8Arrays1(void) +{ + unsigned char p0[] = {1, 8, 254u, 253u}; + unsigned char p1[] = {1, 8, 254u, 252u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX8Arrays2(void) +{ + unsigned char p0[] = {1, 8, 254u, 253u}; + unsigned char p1[] = {2, 8, 254u, 253u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX8Arrays3(void) +{ + unsigned char p0[] = {1, 8, 254u, 253u}; + unsigned char p1[] = {1, 8, 255u, 253u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualMemoryArrays(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, -2}; + int p2[] = {1, 8, 987, 2}; + int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p0, 4, 1); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p0, 4, 4); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p2, 4, 3); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p3, 4, 1); +} + +void testNotEqualMemoryArraysExpectedNull(void) +{ + int* p0 = NULL; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArraysActualNull(void) +{ + int p0[] = {1, 8, 987, -2}; + int* p1 = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArrays1(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArrays2(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {2, 8, 987, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArrays3(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 986, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testProtection(void) +{ + volatile int mask = 0; + + if (TEST_PROTECT()) + { + mask |= 1; + TEST_ABORT(); + } + else + { + Unity.CurrentTestFailed = 0; + mask |= 2; + } + + TEST_ASSERT_EQUAL(3, mask); +} + +void testIgnoredAndThenFailInTearDown(void) +{ + SetToOneToFailInTearDown = 1; + TEST_IGNORE(); +} + +// ===================== THESE TEST WILL RUN IF YOUR CONFIG INCLUDES 64 BIT SUPPORT ================== +#ifdef UNITY_SUPPORT_64 + +void testEqualHex64s(void) +{ + _UU64 v0, v1; + _UU64 *p0, *p1; + + v0 = 0x9876543201234567; + v1 = 0x9876543201234567; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX64(0x9876543201234567, 0x9876543201234567); + TEST_ASSERT_EQUAL_HEX64(v0, v1); + TEST_ASSERT_EQUAL_HEX64(0x9876543201234567, v1); + TEST_ASSERT_EQUAL_HEX64(v0, 0x9876543201234567); + TEST_ASSERT_EQUAL_HEX64(*p0, v1); + TEST_ASSERT_EQUAL_HEX64(*p0, *p1); + TEST_ASSERT_EQUAL_HEX64(*p0, 0x9876543201234567); +} + +void testNotEqualHex64s(void) +{ + _UU64 v0, v1; + + v0 = 9000000000; + v1 = 9100000000; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex64sIfSigned(void) +{ + _US64 v0, v1; + + v0 = -9000000000; + v1 = 9000000000; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64(v0, v1); + VERIFY_FAILS_END +} + +void testHEX64sWithinDelta(void) +{ + TEST_ASSERT_HEX64_WITHIN(1, 0x7FFFFFFFFFFFFFFF,0x7FFFFFFFFFFFFFFE); + TEST_ASSERT_HEX64_WITHIN(5, 5000, 4996); + TEST_ASSERT_HEX64_WITHIN(5, 5000, 5005); +} + +void testHEX64sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX64_WITHIN(1, 0x7FFFFFFFFFFFFFFF, 0x7FFFFFFFFFFFFFFC); + VERIFY_FAILS_END +} + +void testHEX64sNotWithinDeltaEvenThoughASignedIntWouldPass(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX64_WITHIN(5, 1, -1); + VERIFY_FAILS_END +} + +void testEqualHEX64Arrays(void) +{ + _UU64 p0[] = {1, 8, 987, 65132u}; + _UU64 p1[] = {1, 8, 987, 65132u}; + _UU64 p2[] = {1, 8, 987, 2}; + _UU64 p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p3, 1); +} + +void testNotEqualHEX64Arrays1(void) +{ + _UU64 p0[] = {1, 8, 987, 65132u}; + _UU64 p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX64Arrays2(void) +{ + _UU64 p0[] = {1, 8, 987, 65132u}; + _UU64 p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +#endif //64-bit SUPPORT + +// ===================== THESE TEST WILL RUN IF YOUR CONFIG INCLUDES FLOAT SUPPORT ================== +#ifndef UNITY_EXCLUDE_FLOAT + +void testFloatsWithinDelta(void) +{ + TEST_ASSERT_FLOAT_WITHIN(0.00003f, 187245.03485f, 187245.03488f); + TEST_ASSERT_FLOAT_WITHIN(1.0f, 187245.0f, 187246.0f); + TEST_ASSERT_FLOAT_WITHIN(0.05f, 9273.2549f, 9273.2049f); + TEST_ASSERT_FLOAT_WITHIN(0.007f, -726.93724f, -726.94424f); +} + +void testFloatsNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_FLOAT_WITHIN(0.05f, 9273.2649f, 9273.2049f); + VERIFY_FAILS_END +} + +void testFloatsEqual(void) +{ + TEST_ASSERT_EQUAL_FLOAT(187245.0f, 187246.0f); + TEST_ASSERT_EQUAL_FLOAT(18724.5f, 18724.6f); + TEST_ASSERT_EQUAL_FLOAT(9273.2549f, 9273.2599f); + TEST_ASSERT_EQUAL_FLOAT(-726.93724f, -726.9374f); +} + +void testFloatsNotEqual(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT(9273.9649f, 9273.0049f); + VERIFY_FAILS_END +} + +void testFloatsNotEqualNegative1(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT(-9273.9649f, -9273.0049f); + VERIFY_FAILS_END +} + +void testFloatsNotEqualNegative2(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT(-9273.0049f, -9273.9649f); + VERIFY_FAILS_END +} + +void testEqualFloatArrays(void) +{ + float p0[] = {1.0, -8.0, 25.4, -0.123}; + float p1[] = {1.0, -8.0, 25.4, -0.123}; + float p2[] = {1.0, -8.0, 25.4, -0.2}; + float p3[] = {1.0, -23.0, 25.0, -0.26}; + + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p3, 1); +} + +void testNotEqualFloatArraysExpectedNull(void) +{ + float* p0 = NULL; + float p1[] = {1.0, 8.0, 25.4, 0.252}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysActualNull(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float* p1 = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArrays1(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float p1[] = {1.0, 8.0, 25.4, 0.252}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArrays2(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float p1[] = {2.0, 8.0, 25.4, 0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArrays3(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float p1[] = {1.0, 8.0, 25.5, 0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysNegative1(void) +{ + float p0[] = {-1.0, -8.0, -25.4, -0.253}; + float p1[] = {-1.0, -8.0, -25.4, -0.252}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysNegative2(void) +{ + float p0[] = {-1.0, -8.0, -25.4, -0.253}; + float p1[] = {-2.0, -8.0, -25.4, -0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysNegative3(void) +{ + float p0[] = {-1.0, -8.0, -25.4, -0.253}; + float p1[] = {-1.0, -8.0, -25.5, -0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +#endif //FLOAT SUPPORT diff --git a/flex-bison/mark1/tools/ceedling/vendor/constructor/History.rdoc b/flex-bison/mark1/tools/ceedling/vendor/constructor/History.rdoc new file mode 100644 index 0000000..b220b1d --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/constructor/History.rdoc @@ -0,0 +1,19 @@ +== 1.0.4 / 2009-12-01 + + * Building is now done with Jeweler. + +== 1.0.3 / 2009-11-30 + + * Quick release to include ConstructorStruct. + +== 1.0.2 / 2008-05-07 + + * An error is raised when constructor keys are passed in that already exist in the super class + +== 1.0.1 / 2007-12-21 + +* You can now pass a block to your constructor call; it gets executed after all the ivars get assigned. (This lets you write some initializer code if you need to.) + +== 1.0.0 / 2007-11-18 + +* Released! diff --git a/flex-bison/mark1/tools/ceedling/vendor/constructor/README.rdoc b/flex-bison/mark1/tools/ceedling/vendor/constructor/README.rdoc new file mode 100644 index 0000000..e6177de --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/constructor/README.rdoc @@ -0,0 +1,72 @@ +== Constructor + +* http://atomicobject.github.com/constructor + +== DESCRIPTION: + +Declarative means to define object properties by passing a hash +to the constructor, which will set the corresponding ivars. + +== SYNOPSIS: + + require 'constructor' + + class Horse + constructor :name, :breed, :weight + end + Horse.new :name => 'Ed', :breed => 'Mustang', :weight => 342 + +By default the ivars do not get accessors defined. +But you can get them auto-made if you want: + + class Horse + constructor :name, :breed, :weight, :accessors => true + end + ... + puts my_horse.weight + +Arguments specified are required by default. You can disable +strict argument checking with :strict option. This means that +the constructor will not raise an error if you pass more or +fewer arguments than declared. + + class Donkey + constructor :age, :odor, :strict => false + end + +... this allows you to pass either an age or odor key (or neither) +to the Donkey constructor. + + +== REQUIREMENTS: + +* rubygems + +== INSTALL: + +* sudo gem install constructor + +== LICENSE: + +(The MIT License) + +Copyright (c) 2007 Atomic Object + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/flex-bison/mark1/tools/ceedling/vendor/constructor/Rakefile b/flex-bison/mark1/tools/ceedling/vendor/constructor/Rakefile new file mode 100644 index 0000000..e1c3536 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/constructor/Rakefile @@ -0,0 +1,33 @@ +require 'rubygems' + +desc 'Default: run specs' +task :default => :spec + +require 'spec/rake/spectask' +desc 'Run constructor specs' +Spec::Rake::SpecTask.new(:spec) do |t| + t.spec_files = FileList['specs/*_spec.rb'] + t.spec_opts << '-c -f s' +end + +begin + require 'jeweler' + Jeweler::Tasks.new do |gemspec| + $: << "lib" + require 'constructor.rb' + gemspec.name = 'constructor' + gemspec.version = CONSTRUCTOR_VERSION + gemspec.summary = 'Declarative named-argument object initialization.' + gemspec.description = 'Declarative means to define object properties by passing a hash to the constructor, which will set the corresponding ivars.' + gemspec.homepage = 'http://atomicobject.github.com/constructor' + gemspec.authors = 'Atomic Object' + gemspec.email = 'github@atomicobject.com' + gemspec.test_files = FileList['specs/*_spec.rb'] + end + + Jeweler::GemcutterTasks.new + +rescue LoadError + puts "(jeweler not installed)" +end + diff --git a/flex-bison/mark1/tools/ceedling/vendor/constructor/homepage/Notes.txt b/flex-bison/mark1/tools/ceedling/vendor/constructor/homepage/Notes.txt new file mode 100644 index 0000000..258d959 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/constructor/homepage/Notes.txt @@ -0,0 +1,27 @@ +Wed Nov 21 21:49:27 EST 2007 +crosby + +1. Edit page_header.graffle +2. Export as HTML imagemap +3. Open ../sample_code/synopsis.rb +4. Screen shot, save as sample_code.png +5. rake (rewrites index.html) +6. cd .. +7. rake publish_docs + +page_header.graffle + Export-as-HTML-Imagemap + Use png + Use 125% scale + Remember to use the style inspector to assign actions to things that should be links. + +rake index + Rewrites index.html using index.erb and page_header.html (and some values in the Rakefile) + +The code sample screenshot: + Taken with Snapz Pro X (this is important, as Snapz is providing the + dropshadow and about 28 extra pixels widthwise) + + Should be 650 px wide to line up with the page header. + + Transparency: be conscious of WHAT'S IN THE BACKGROUND diff --git a/flex-bison/mark1/tools/ceedling/vendor/constructor/homepage/Rakefile b/flex-bison/mark1/tools/ceedling/vendor/constructor/homepage/Rakefile new file mode 100644 index 0000000..c2bca7a --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/constructor/homepage/Rakefile @@ -0,0 +1,15 @@ +desc "Rewrite index.html using index.erb and publisher_homepage.html" +task :index do + require 'erb' + @title = "Constructor - atomicobject.rb" + @plugin_install = "$ script/plugin install svn://rubyforge.org/var/svn/atomicobjectrb/tags/constructor" + @header_html = File.read("page_header.html") + html = ERB.new(File.read("index.erb")).result(binding) + fname = "index.html" + File.open(fname,"w") do |f| + f.print html + end + puts "Wrote #{fname}" +end + +task :default => :index diff --git a/flex-bison/mark1/tools/ceedling/vendor/constructor/homepage/index.erb b/flex-bison/mark1/tools/ceedling/vendor/constructor/homepage/index.erb new file mode 100644 index 0000000..9af27c1 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/constructor/homepage/index.erb @@ -0,0 +1,27 @@ + + + <%= @title %> + + + + + +
+ + + + + diff --git a/flex-bison/mark1/tools/ceedling/vendor/constructor/homepage/index.html b/flex-bison/mark1/tools/ceedling/vendor/constructor/homepage/index.html new file mode 100644 index 0000000..c2f8e64 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/constructor/homepage/index.html @@ -0,0 +1,36 @@ + + + Constructor - atomicobject.rb + + + + + +
+ + + + + + + + + + + + +
$ script/plugin install svn://rubyforge.org/var/svn/atomicobjectrb/tags/constructor
+ + +
+ + + + + diff --git a/flex-bison/mark1/tools/ceedling/vendor/constructor/homepage/page_header.graffle b/flex-bison/mark1/tools/ceedling/vendor/constructor/homepage/page_header.graffle new file mode 100644 index 0000000..a910021 Binary files /dev/null and b/flex-bison/mark1/tools/ceedling/vendor/constructor/homepage/page_header.graffle differ diff --git a/flex-bison/mark1/tools/ceedling/vendor/constructor/homepage/page_header.html b/flex-bison/mark1/tools/ceedling/vendor/constructor/homepage/page_header.html new file mode 100644 index 0000000..1530968 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/constructor/homepage/page_header.html @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/flex-bison/mark1/tools/ceedling/vendor/constructor/homepage/page_header.png b/flex-bison/mark1/tools/ceedling/vendor/constructor/homepage/page_header.png new file mode 100644 index 0000000..82b3aae Binary files /dev/null and b/flex-bison/mark1/tools/ceedling/vendor/constructor/homepage/page_header.png differ diff --git a/flex-bison/mark1/tools/ceedling/vendor/constructor/homepage/sample_code.png b/flex-bison/mark1/tools/ceedling/vendor/constructor/homepage/sample_code.png new file mode 100644 index 0000000..6084202 Binary files /dev/null and b/flex-bison/mark1/tools/ceedling/vendor/constructor/homepage/sample_code.png differ diff --git a/flex-bison/mark1/tools/ceedling/vendor/constructor/homepage/sample_code.rb b/flex-bison/mark1/tools/ceedling/vendor/constructor/homepage/sample_code.rb new file mode 100644 index 0000000..2b6dc21 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/constructor/homepage/sample_code.rb @@ -0,0 +1,12 @@ +require 'rubygems' +require 'constructor' + +class Horse + constructor :name, :breed, :weight, :accessors => true +end + +ed = Horse.new(:name => 'Ed', :breed => 'Mustang', :weight => 342) +puts ed.name +puts ed.breed +puts ed.weight + diff --git a/flex-bison/mark1/tools/ceedling/vendor/constructor/lib/constructor.rb b/flex-bison/mark1/tools/ceedling/vendor/constructor/lib/constructor.rb new file mode 100644 index 0000000..87eb6dd --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/constructor/lib/constructor.rb @@ -0,0 +1,127 @@ +CONSTRUCTOR_VERSION = '1.0.4' #:nodoc:# + +class Class #:nodoc:# + def constructor(*attrs, &block) + call_block = '' + if block_given? + @constructor_block = block + call_block = 'self.instance_eval(&self.class.constructor_block)' + end + # Look for embedded options in the listing: + opts = attrs.find { |a| a.kind_of?(Hash) and attrs.delete(a) } + do_acc = opts.nil? ? false : opts[:accessors] == true + do_reader = opts.nil? ? false : opts[:readers] == true + require_args = opts.nil? ? true : opts[:strict] != false + super_args = opts.nil? ? nil : opts[:super] + + # Incorporate superclass's constructor keys, if our superclass + if superclass.constructor_keys + similar_keys = superclass.constructor_keys & attrs + raise "Base class already has keys #{similar_keys.inspect}" unless similar_keys.empty? + attrs = [attrs,superclass.constructor_keys].flatten + end + # Generate ivar assigner code lines + assigns = '' + attrs.each do |k| + assigns += "@#{k.to_s} = args[:#{k.to_s}]\n" + end + + # If accessors option is on, declare accessors for the attributes: + if do_acc + add_accessors = "attr_accessor " + attrs.reject {|x| superclass.constructor_keys.include?(x.to_sym)}.map {|x| ":#{x.to_s}"}.join(',') + #add_accessors = "attr_accessor " + attrs.map {|x| ":#{x.to_s}"}.join(',') + self.class_eval add_accessors + end + + # If readers option is on, declare readers for the attributes: + if do_reader + self.class_eval "attr_reader " + attrs.reject {|x| superclass.constructor_keys.include?(x.to_sym)}.map {|x| ":#{x.to_s}"}.join(',') + end + + # If user supplied super-constructor hints: + super_call = '' + if super_args + list = super_args.map do |a| + case a + when String + %|"#{a}"| + when Symbol + %|:#{a}| + end + end + super_call = %|super(#{list.join(',')})| + end + + # If strict is on, define the constructor argument validator method, + # and setup the initializer to invoke the validator method. + # Otherwise, insert lax code into the initializer. + validation_code = "return if args.nil?" + if require_args + self.class_eval do + def _validate_constructor_args(args) + # First, make sure we've got args of some kind + unless args and args.keys and args.keys.size > 0 + raise ConstructorArgumentError.new(self.class.constructor_keys) + end + # Scan for missing keys in the argument hash + a_keys = args.keys + missing = [] + self.class.constructor_keys.each do |ck| + unless a_keys.member?(ck) + missing << ck + end + a_keys.delete(ck) # Delete inbound keys as we address them + end + if missing.size > 0 || a_keys.size > 0 + raise ConstructorArgumentError.new(missing,a_keys) + end + end + end + # Setup the code to insert into the initializer: + validation_code = "_validate_constructor_args args " + end + + # Generate the initializer code + self.class_eval %{ + def initialize(args=nil) + #{super_call} + #{validation_code} + #{assigns} + setup if respond_to?(:setup) + #{call_block} + end + } + + # Remember our constructor keys + @_ctor_keys = attrs + end + + # Access the constructor keys for this class + def constructor_keys; @_ctor_keys ||=[]; end + + def constructor_block #:nodoc:# + @constructor_block + end + +end + +# Fancy validation exception, based on missing and extraneous keys. +class ConstructorArgumentError < RuntimeError #:nodoc:# + def initialize(missing,rejected=[]) + err_msg = '' + if missing.size > 0 + err_msg = "Missing constructor args [#{missing.join(',')}]" + end + if rejected.size > 0 + # Some inbound keys were not addressed earlier; this means they're unwanted + if err_msg + err_msg << "; " # Appending to earlier message about missing items + else + err_msg = '' + end + # Enumerate the rejected key names + err_msg << "Rejected constructor args [#{rejected.join(',')}]" + end + super err_msg + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/constructor/lib/constructor_struct.rb b/flex-bison/mark1/tools/ceedling/vendor/constructor/lib/constructor_struct.rb new file mode 100644 index 0000000..e97ff62 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/constructor/lib/constructor_struct.rb @@ -0,0 +1,33 @@ +class ConstructorStruct + def self.new(*accessors, &block) + defaults = {:accessors => true, :strict => false} + + accessor_names = accessors.dup + if accessors.last.is_a? Hash + accessor_names.pop + user_opts = accessors.last + user_opts.delete(:accessors) + defaults.each do |k,v| + user_opts[k] ||= v + end + else + accessors << defaults + end + + Class.new do + constructor *accessors + + class_eval(&block) if block + + comparator_code = accessor_names.map { |fname| "self.#{fname} == o.#{fname}" }.join(" && ") + eval %| + def ==(o) + (self.class == o.class) && #{comparator_code} + end + def eql?(o) + (self.class == o.class) && #{comparator_code} + end + | + end + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/constructor/specs/constructor_spec.rb b/flex-bison/mark1/tools/ceedling/vendor/constructor/specs/constructor_spec.rb new file mode 100644 index 0000000..80345ae --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/constructor/specs/constructor_spec.rb @@ -0,0 +1,407 @@ +require File.expand_path(File.dirname(__FILE__) + '/../lib/constructor') + +describe 'standard constructor usage' do + it 'allows for object construction using a hash of named arguments' do + fuh = TestingClass.new( + :foo => 'my foo', + :bar => 'my bar', + :qux => 'my qux', + :why => 'lucky' + ) + + fuh.foo.should eql('my foo') + fuh.bar.should eql('my bar') + fuh.qux.should eql('my qux') + fuh.why.should eql('lucky') + fuh.to_pretty_pretty.should eql('my foo my bar') + end + + it 'calls setup method if defined' do + ralph = Llamma.new :hair => 'red' + ralph.hungry.should be_true + ralph.hair.should eql('red') + end +end + +describe "constructor's accessor option" do + it 'provides accessors for constructor arguments when accessor option is true' do + fuh = TestingAutoAccessors.new( + :foo => 'my foo', + :bar => 'my bar', + :qux => 'my qux', + :why => 'lucky' + ) + fuh.foo.should eql('my foo') + fuh.bar.should eql('my bar') + fuh.qux.should eql('my qux') + fuh.why.should eql('lucky') + fuh.to_pretty_pretty.should eql('my foo my bar') + end + + it 'does not provide accessors for constructor arguments when accessor option is false' do + fuh = TestingBlockedAccessors.new :foo => 'my foo', :bar => 'my bar' + lambda {fuh.foo}.should raise_error(NoMethodError) + lambda {fuh.bar}.should raise_error(NoMethodError) + fuh.to_pretty_pretty.should eql('my foo my bar') + end +end + +describe "constructor's reader option" do + it 'provides readers for constructor arguments when reader option is true' do + fuh = TestingAutoReaders.new( + :foo => 'my foo', + :why => 'lucky' + ) + fuh.foo.should eql('my foo') + fuh.why.should eql('lucky') + fuh.to_pretty_pretty.should eql('my foo lucky') + + lambda {fuh.why = 'no way'}.should raise_error(NoMethodError) + lambda {fuh.foo = 'uh uh'}.should raise_error(NoMethodError) + end + + it 'does not provide reader for constructor arguments when reader option is false' do + fuh = TestingBlockedReaders.new :foo => 'my foo', :why => 'my why' + lambda {fuh.foo}.should raise_error(NoMethodError) + lambda {fuh.bar}.should raise_error(NoMethodError) + fuh.to_pretty_pretty.should eql('my foo my why') + + lambda {fuh.why = 'no way'}.should raise_error(NoMethodError) + lambda {fuh.foo = 'uh uh'}.should raise_error(NoMethodError) + end +end + +describe 'using constructor with inheritance' do + it 'allows for inheritance of constructor arguments using a non-constructor defined subclass' do + fuh = SubclassOfTestingClass.new :foo => 'whu?' + fuh.foo.should eql('whu?') + fuh.bar.should be_nil + fuh.qux.should be_nil + fuh.why.should be_nil + end + + it 'allows for standard construction of a non-constructor subclass of a non-strict constuctor superclass' do + fuh = SubclassOfTestingClass2.new + fuh.foo.should be_nil + end + + it 'runs initialize method of a sublcass' do + fuh = SubclassOfTestingClass3.new + fuh.my_new_var.should eql('something') + fuh.foo.should be_nil + fuh.bar.should be_nil + fuh.qux.should be_nil + fuh.why.should be_nil + end + + it 'passes named constructor args to superclass when subclass calls super' do + fuh = SubclassOfTestingClass3.new :foo => 12 + fuh.my_new_var.should eql('something') + fuh.foo.should eql(12) + fuh.bar.should be_nil + fuh.qux.should be_nil + fuh.why.should be_nil + end + + it 'allows for inheritance of constructor arguments using a constructor defined subclass' do + s = Sonny.new :car => 'Nissan', :saw => 'Dewalt', :computer => 'Dell' + s.computer.should eql('Dell') + s.saw.should eql('Dewalt') + s.car.should eql('Nissan') + end + + it 'calls the setup method on superclass if subclass does not define a setup method' do + baby = Baby.new :cuteness => 'little', :age => 1 + baby.fat.should eql('much') + end + + it 'calls parent class setup when super is called from subclass setup' do + m = Mama.new :age => 55 + m.age.should eql(55) + m.fat.should eql('much') + + s = Sissy.new :age => 19, :beauty => 'medium', :fat => 'yeah' + s.age.should eql(19) + s.beauty.should eql('medium') + s.fat.should eql('much') + s.friends.should eql('many') + end + + it 'passes arguments given in the super option to the initializer of a non-constructor defined superclass' do + tsc = TestingSuperConstructor.new(:far => 'oo', :away => 'kk') + tsc.far.should eql('oo') + tsc.away.should eql('kk') + tsc.a.should eql("once") + tsc.b.should eql(:twice) + end + + it 'calls non-constructor defined superclass constructor when the super option is an empty array' do + tsc = TestingSuperConstructor2.new(:some => 'thing') + tsc.some.should eql('thing') + tsc.c.should eql('what a') + tsc.d.should eql('day for') + end + + it "raises an error if subclass tries to build a constructor with the keys as its parents" do + class1 = constructor_class(Object, :star, :wars) + class2 = constructor_class(class1, :space, :balls) + lambda { constructor_class(class2, :star, :space, :chewy) }.should raise_error("Base class already has keys [:space, :star]") + end + + it 'does not create accessors for superclass constructor arguments' do + tas = TestingAccessorSubclass.new(:far => 'thing') + tas.respond_to?(:cuteness).should be_false + end + + it 'does not create a reader for superclass constructor arguments' do + t1 = TestingReaderSubclass.new(:foo => 'thing') + t1.respond_to?(:foo).should be_false + end +end + +describe 'stict mode usage' do + it 'allows omission of arguments when strict is off' do + fuh = TestingClass.new :foo => 'my foo' + + fuh.foo.should eql('my foo') + fuh.bar.should be_nil + fuh.qux.should be_nil + fuh.why.should be_nil + end + + it 'allows no arguments to a constructor when strict is off' do + fuh = TestingClass.new + fuh.foo.should be_nil + fuh.bar.should be_nil + fuh.qux.should be_nil + fuh.why.should be_nil + end + + it 'does not interfere with normal object construction' do + require 'rexml/document' + d = REXML::Document.new '' + d.should_not be_nil + d.root.name.should eql('base') + end + + def see_strict_args_in_effect_for(clazz) + fuh = clazz.new :foo => 'my foo', :bar => 'my bar' + fuh.to_pretty_pretty.should eql('my foo my bar') + + # Omit foo + lambda { + TestingStrictArgsDefault.new :bar => 'ok,yeah' + }.should raise_error(ConstructorArgumentError, /foo/) + + # Omit bar + lambda { + TestingStrictArgsDefault.new :foo => 'ok,yeah' + }.should raise_error(ConstructorArgumentError, /bar/) + end + + it 'defaults to strict argument enforcement' do + see_strict_args_in_effect_for TestingStrictArgsDefault + end + + it 'enforces strict arguments when strict option is true' do + see_strict_args_in_effect_for TestingStrictArgs + end + + it 'does not allow empty constructor arguments when strict option is true' do + lambda {TestingStrictArgs.new {}}.should raise_error(ConstructorArgumentError,/foo,bar/) + lambda {TestingStrictArgs.new}.should raise_error(ConstructorArgumentError,/foo,bar/) + lambda {TestingStrictArgs.new nil}.should raise_error(ConstructorArgumentError,/foo,bar/) + end + + it 'does not allow extraneous arguments when strict option is true' do + [ /thing/, /other/ ].each do |rejected_arg| + lambda { + TestingStrictArgs.new(:foo => 1, :bar => 2, :other => 3, :thing => 4) + }.should raise_error(ConstructorArgumentError, rejected_arg) + end + end + + it 'allows for setting accessors option while in strict mode' do + t2 = TestingStrictArgs2.new :foo => 1, :bar => 2 + + # See that accessors work + t2.foo.should eql(1) + t2.bar.should eql(2) + + # See that strictness still applies + lambda {TestingStrictArgs2.new :no => 'good'}.should raise_error(ConstructorArgumentError) + end +end + +describe 'catching ConstructorArgumentError' do + it 'allows for generic rescuing of constructor argument errors' do + begin + TestingStrictArgs.new :broken => 'yoobetcha' + rescue => bad_news + bad_news.should be_kind_of(ConstructorArgumentError) + end + end +end + +describe 'block yielding' do + it 'executes a specified block after instantiating' do + TestingBlockYield.new(:a => false).a.should == true + end +end + +def constructor_class(base, *keys) + Class.new(base) do + constructor *keys + end +end + +class TestingClass + attr_accessor :foo, :bar, :why, :qux + constructor :foo, :bar, :why, :qux, :strict => false + + def to_pretty_pretty + "#{@foo} #{@bar}" + end + +end + +class Mama + attr_accessor :fat, :age + constructor :age, :strict => false + def setup + @fat = "much" + end +end + +class Baby < Mama + constructor :cuteness +end + +class Sissy < Mama + attr_accessor :friends, :beauty + constructor :beauty, :strict => false + def setup + super #IMPORTANT! + @friends = "many" + end +end + +class TestingStrictArgsDefault + constructor :foo, :bar + def to_pretty_pretty + "#{@foo} #{@bar}" + end +end + +class TestingStrictArgs + constructor :foo, :bar, :strict => true + def to_pretty_pretty + "#{@foo} #{@bar}" + end +end + +class TestingStrictArgs2 + constructor :foo, :bar, :accessors => true +end + +class SubclassOfTestingClass < TestingClass +end + +class SubclassOfTestingClass2 < TestingClass + def initialize; end +end + +class SubclassOfTestingClass3 < TestingClass + attr_reader :my_new_var + def initialize(hash = nil) + super + @my_new_var = "something" + end +end + +class TestingAutoAccessors + constructor :foo, :bar, :why, :qux, :accessors => true, :strict => false + def to_pretty_pretty + "#{@foo} #{@bar}" + end +end + +class TestingAutoReaders + constructor :foo, :why, :readers => true, :strict => false + def to_pretty_pretty + "#{@foo} #{@why}" + end +end + +class TestingReaderSuperclass + constructor :foo +end + +class TestingReaderSubclass < TestingReaderSuperclass + constructor :bar, :readers => true, :strict => false +end + +class TestingSuperConstructorBase + attr_reader :a, :b + def initialize(a,b) + @a = a + @b = b + end +end + +class TestingSuperConstructor < TestingSuperConstructorBase + constructor :far, :away, :accessors => true, :super => ["once", :twice], :strict => false +end + +class TestingSuperConstructorBase2 + attr_reader :c, :d + def initialize + @c = 'what a' + @d = 'day for' + end +end + +class TestingSuperConstructor2 < TestingSuperConstructorBase2 + constructor :some, :accessors => true, :super => [], :strict => false +end + +class TestingAccessorSubclass < Baby + constructor :foo, :accessors => true, :strict => false +end + +class TestingBlockedAccessors + constructor :foo, :bar, :accessors => false + def to_pretty_pretty + "#{@foo} #{@bar}" + end +end + +class TestingBlockedReaders + constructor :foo, :why, :readers => false + def to_pretty_pretty + "#{@foo} #{@why}" + end +end + +class Papa + constructor :car, :saw +end + +class Sonny < Papa + attr_accessor :car, :saw, :computer + constructor :computer +end + +class Llamma + attr_accessor :hungry, :hair + constructor :hair + def setup + @hungry = true + end +end + +class TestingBlockYield + constructor :a, :accessors => true do + @a = true + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/constructor/specs/constructor_struct_spec.rb b/flex-bison/mark1/tools/ceedling/vendor/constructor/specs/constructor_struct_spec.rb new file mode 100644 index 0000000..2442da3 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/constructor/specs/constructor_struct_spec.rb @@ -0,0 +1,84 @@ +require File.dirname(__FILE__) + '/../lib/constructor_struct' + +describe ConstructorStruct, "#new" do + def struct(*accessors) + ConstructorStruct.new(*accessors) + end + + def instance_of(clazz, args=nil) + args = [args] || [] + clazz.new(*args) + end + + before do + AClass = struct(:hello, :world) unless defined?(AClass) + end + + it "creates a new class with accessors given a set of symbols or strings" do + instance_of(AClass, {:hello => "foo", :world => "bar"}).hello.should == "foo" + instance_of(AClass, {:hello => "foo", :world => "bar"}).world.should == "bar" + end + + it "creates a real class" do + instance_of(AClass).class.should == AClass + end + + it "has the option of creating a strict accessors" do + lambda { instance_of(struct(:foo, :strict => true)) }.should raise_error + end + + it "does not have the option of not creating accessors" do + instance_of(struct(:foo, :accessors => false), :foo => "bar").foo.should == "bar" + end + + describe "equivalence" do + before do + @hello = "Hello" + @world = "World" + @args = { :hello => @hello, :world => @world } + @target = AClass.new(@args) + end + + it "uses all accessors" do + [ nil, :hello, :world ].each do |field_to_alter| + alt = AClass.new(:hello => @hello, :world => @world) + + unless field_to_alter + # Base case: they should be equal + @target.should == alt + @target.eql?(alt).should be_true #should eql(alt) + else + # Change 1 field and see not equal + alt.send("#{field_to_alter}=", "other data") + @target.should_not == alt + @target.should_not eql(alt) + end + end + end + + it "will not compare to another class with same fields" do + BClass = ConstructorStruct.new(:hello, :world) + alt = BClass.new(:hello => @hello, :world => @world) + @target.should_not == alt + @target.should_not eql(alt) + end + end + + describe "extra method definitions" do + NightTrain = ConstructorStruct.new(:beer, :conductor) do + def setup + @conductor ||= "Bill" + end + end + + it "lets you declare instance methods within a block" do + night_train = NightTrain.new(:beer => "Founders") + night_train.beer.should == "Founders" + night_train.conductor.should == "Bill" + + other_train = NightTrain.new(:beer => "Bells", :conductor => "Dave") + other_train.conductor.should == "Dave" + end + end + +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/deep_merge/MIT-LICENSE b/flex-bison/mark1/tools/ceedling/vendor/deep_merge/MIT-LICENSE new file mode 100644 index 0000000..8eaf6db --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/deep_merge/MIT-LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2008 [name of plugin creator] + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/flex-bison/mark1/tools/ceedling/vendor/deep_merge/README b/flex-bison/mark1/tools/ceedling/vendor/deep_merge/README new file mode 100644 index 0000000..0302735 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/deep_merge/README @@ -0,0 +1,94 @@ +DeepMerge Overview +================== + +Deep Merge is a simple set of utility functions for Hash. It permits +you to merge elements inside a hash together recursively. The manner +by which it does this is somewhat arbitrary (since there is no defining +standard for this) but it should end up being pretty intuitive and do what +you expect. + +You can learn a lot more about this by reading the test file. It's pretty +well documented and has many examples of various merges from very simple +to pretty complex. + +The primary need that caused me to write this library is the merging of elements +coming from HTTP parameters and related stored parameters in session. This lets +a user build up a set of parameters over time, modifying individual items. + +Deep Merge Core Documentation +============================= + There are three key methods that are added to Hash when you require deep_merge: + + deep_merge!(new_hash[, opts]) -- merges and new_hash wins unmergeable situations + deep_merge(new_hash[, opts]) -- merges and "self" hash wins unmergeable situations + ko_deep_merge!(new_hash[, opts]) -- same as deep_merge! but "--" provides "knockout" functions + + deep_merge! method permits merging of arbitrary child elements. The two top level + elements must be hashes. These hashes can contain unlimited (to stack limit) levels + of child elements. These child elements to not have to be of the same types. + Where child elements are of the same type, deep_merge will attempt to merge them together. + Where child elements are not of the same type, deep_merge will skip or optionally overwrite + the destination element with the contents of the source element at that level. + So if you have two hashes like this: + source = {:x => [1,2,3], :y => 2} + dest = {:x => [4,5,'6'], :y => [7,8,9]} + dest.deep_merge!(source) + Results: {:x => [1,2,3,4,5,'6'], :y => 2} + By default, "deep_merge!" will overwrite any unmergeables and merge everything else. + To avoid this, use "deep_merge" (no bang/exclamation mark) + + Options: + Options are specified in the last parameter passed, which should be in hash format: + hash.deep_merge!({:x => [1,2]}, {:knockout_prefix => '--'}) + :preserve_unmergeables DEFAULT: false + Set to true to skip any unmergeable elements from source + :knockout_prefix DEFAULT: nil + Set to string value to signify prefix which deletes elements from existing element + :sort_merged_arrays DEFAULT: false + Set to true to sort all arrays that are merged together + :unpack_arrays DEFAULT: nil + Set to string value to run "Array::join" then "String::split" against all arrays + :merge_debug DEFAULT: false + Set to true to get console output of merge process for debugging + + Selected Options Details: + :knockout_prefix => The purpose of this is to provide a way to remove elements + from existing Hash by specifying them in a special way in incoming hash + source = {:x => ['--1', '2']} + dest = {:x => ['1', '3']} + dest.ko_deep_merge!(source) + Results: {:x => ['2','3']} + Additionally, if the knockout_prefix is passed alone as a string, it will cause + the entire element to be removed: + source = {:x => '--'} + dest = {:x => [1,2,3]} + dest.ko_deep_merge!(source) + Results: {:x => ""} + :unpack_arrays => The purpose of this is to permit compound elements to be passed + in as strings and to be converted into discrete array elements + irsource = {:x => ['1,2,3', '4']} + dest = {:x => ['5','6','7,8']} + dest.deep_merge!(source, {:unpack_arrays => ','}) + Results: {:x => ['1','2','3','4','5','6','7','8'} + Why: If receiving data from an HTML form, this makes it easy for a checkbox + to pass multiple values from within a single HTML element + + There are many tests for this library - and you can learn more about the features + and usages of deep_merge! by just browsing the test examples + + +Simple Example Code +=================== + +require 'deep_merge' +x = {:x => [3,4,5]} +y = {:x => [1,2,3]} +y.deep_merge!(x) +# results: y = {:x => [1,2,3,4,5]} + +Availablility +============= +SVN Repo here: http://trac.misuse.org/science/wiki/DeepMerge +Contact author: http://www.misuse.org/science + +Copyright (c) 2008 Steve Midgley, released under the MIT license diff --git a/flex-bison/mark1/tools/ceedling/vendor/deep_merge/Rakefile b/flex-bison/mark1/tools/ceedling/vendor/deep_merge/Rakefile new file mode 100644 index 0000000..82e43b3 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/deep_merge/Rakefile @@ -0,0 +1,28 @@ +require 'rubygems' +require 'lib/deep_merge' +Gem::manage_gems +require 'rake/gempackagetask' + +spec = Gem::Specification.new do |s| + s.platform = Gem::Platform::RUBY + s.name = "deep_merge" + s.version = DeepMerge::VERSION + s.author = "Steve Midgley" + s.email = "public@misuse.org" + s.summary = "Permits recursive/deep merges of arrays and hashes." + s.files = FileList['lib/*.rb', 'test/*'].to_a + s.require_path = "lib" + s.autorequire = "deep_merge" + s.test_files = Dir.glob('tests/*.rb') + s.has_rdoc = true + s.extra_rdoc_files = ["README"] +end + +Rake::GemPackageTask.new(spec) do |pkg| + pkg.need_tar = true +end + +task :default => "pkg/#{spec.name}-#{spec.version}.gem" do + puts "generated latest version" +end + diff --git a/flex-bison/mark1/tools/ceedling/vendor/deep_merge/lib/deep_merge.rb b/flex-bison/mark1/tools/ceedling/vendor/deep_merge/lib/deep_merge.rb new file mode 100644 index 0000000..4c4b761 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/deep_merge/lib/deep_merge.rb @@ -0,0 +1,211 @@ +module DeepMerge + + MAJOR_VERSION = 0 + MINOR_VERSION = 1 + FIX_VERSION = 0 + VERSION = "#{MAJOR_VERSION}.#{MINOR_VERSION}.#{FIX_VERSION}" + + class InvalidParameter < StandardError; end + + DEFAULT_FIELD_KNOCKOUT_PREFIX = '--' + + module DeepMergeHash + # ko_hash_merge! will merge and knockout elements prefixed with DEFAULT_FIELD_KNOCKOUT_PREFIX + def ko_deep_merge!(source, options = {}) + default_opts = {:knockout_prefix => "--", :preserve_unmergeables => false} + DeepMerge::deep_merge!(source, self, default_opts.merge(options)) + end + + # deep_merge! will merge and overwrite any unmergeables in destination hash + def deep_merge!(source, options = {}) + default_opts = {:preserve_unmergeables => false} + DeepMerge::deep_merge!(source, self, default_opts.merge(options)) + end + + # deep_merge will merge and skip any unmergeables in destination hash + def deep_merge(source, options = {}) + default_opts = {:preserve_unmergeables => true} + DeepMerge::deep_merge!(source, self, default_opts.merge(options)) + end + + end # DeepMergeHashExt + + # Deep Merge core documentation. + # deep_merge! method permits merging of arbitrary child elements. The two top level + # elements must be hashes. These hashes can contain unlimited (to stack limit) levels + # of child elements. These child elements to not have to be of the same types. + # Where child elements are of the same type, deep_merge will attempt to merge them together. + # Where child elements are not of the same type, deep_merge will skip or optionally overwrite + # the destination element with the contents of the source element at that level. + # So if you have two hashes like this: + # source = {:x => [1,2,3], :y => 2} + # dest = {:x => [4,5,'6'], :y => [7,8,9]} + # dest.deep_merge!(source) + # Results: {:x => [1,2,3,4,5,'6'], :y => 2} + # By default, "deep_merge!" will overwrite any unmergeables and merge everything else. + # To avoid this, use "deep_merge" (no bang/exclamation mark) + # + # Options: + # Options are specified in the last parameter passed, which should be in hash format: + # hash.deep_merge!({:x => [1,2]}, {:knockout_prefix => '--'}) + # :preserve_unmergeables DEFAULT: false + # Set to true to skip any unmergeable elements from source + # :knockout_prefix DEFAULT: nil + # Set to string value to signify prefix which deletes elements from existing element + # :sort_merged_arrays DEFAULT: false + # Set to true to sort all arrays that are merged together + # :unpack_arrays DEFAULT: nil + # Set to string value to run "Array::join" then "String::split" against all arrays + # :merge_debug DEFAULT: false + # Set to true to get console output of merge process for debugging + # + # Selected Options Details: + # :knockout_prefix => The purpose of this is to provide a way to remove elements + # from existing Hash by specifying them in a special way in incoming hash + # source = {:x => ['--1', '2']} + # dest = {:x => ['1', '3']} + # dest.ko_deep_merge!(source) + # Results: {:x => ['2','3']} + # Additionally, if the knockout_prefix is passed alone as a string, it will cause + # the entire element to be removed: + # source = {:x => '--'} + # dest = {:x => [1,2,3]} + # dest.ko_deep_merge!(source) + # Results: {:x => ""} + # :unpack_arrays => The purpose of this is to permit compound elements to be passed + # in as strings and to be converted into discrete array elements + # irsource = {:x => ['1,2,3', '4']} + # dest = {:x => ['5','6','7,8']} + # dest.deep_merge!(source, {:unpack_arrays => ','}) + # Results: {:x => ['1','2','3','4','5','6','7','8'} + # Why: If receiving data from an HTML form, this makes it easy for a checkbox + # to pass multiple values from within a single HTML element + # + # There are many tests for this library - and you can learn more about the features + # and usages of deep_merge! by just browsing the test examples + def DeepMerge.deep_merge!(source, dest, options = {}) + # turn on this line for stdout debugging text + merge_debug = options[:merge_debug] || false + overwrite_unmergeable = !options[:preserve_unmergeables] + knockout_prefix = options[:knockout_prefix] || nil + if knockout_prefix == "" then raise InvalidParameter, "knockout_prefix cannot be an empty string in deep_merge!"; end + if knockout_prefix && !overwrite_unmergeable then raise InvalidParameter, "overwrite_unmergeable must be true if knockout_prefix is specified in deep_merge!"; end + # if present: we will split and join arrays on this char before merging + array_split_char = options[:unpack_arrays] || false + # request that we sort together any arrays when they are merged + sort_merged_arrays = options[:sort_merged_arrays] || false + di = options[:debug_indent] || '' + # do nothing if source is nil + if source.nil? || (source.respond_to?(:blank?) && source.blank?) then return dest; end + # if dest doesn't exist, then simply copy source to it + if dest.nil? && overwrite_unmergeable then dest = source; return dest; end + + puts "#{di}Source class: #{source.class.inspect} :: Dest class: #{dest.class.inspect}" if merge_debug + if source.kind_of?(Hash) + puts "#{di}Hashes: #{source.inspect} :: #{dest.inspect}" if merge_debug + source.each do |src_key, src_value| + if dest.kind_of?(Hash) + puts "#{di} looping: #{src_key.inspect} => #{src_value.inspect} :: #{dest.inspect}" if merge_debug + if not dest[src_key].nil? + puts "#{di} ==>merging: #{src_key.inspect} => #{src_value.inspect} :: #{dest[src_key].inspect}" if merge_debug + dest[src_key] = deep_merge!(src_value, dest[src_key], options.merge(:debug_indent => di + ' ')) + else # dest[src_key] doesn't exist so we want to create and overwrite it (but we do this via deep_merge!) + puts "#{di} ==>merging over: #{src_key.inspect} => #{src_value.inspect}" if merge_debug + # note: we rescue here b/c some classes respond to "dup" but don't implement it (Numeric, TrueClass, FalseClass, NilClass among maybe others) + begin + src_dup = src_value.dup # we dup src_value if possible because we're going to merge into it (since dest is empty) + rescue TypeError + src_dup = src_value + end + dest[src_key] = deep_merge!(src_value, src_dup, options.merge(:debug_indent => di + ' ')) + end + else # dest isn't a hash, so we overwrite it completely (if permitted) + if overwrite_unmergeable + puts "#{di} overwriting dest: #{src_key.inspect} => #{src_value.inspect} -over-> #{dest.inspect}" if merge_debug + dest = overwrite_unmergeables(source, dest, options) + end + end + end + elsif source.kind_of?(Array) + puts "#{di}Arrays: #{source.inspect} :: #{dest.inspect}" if merge_debug + # if we are instructed, join/split any source arrays before processing + if array_split_char + puts "#{di} split/join on source: #{source.inspect}" if merge_debug + source = source.join(array_split_char).split(array_split_char) + if dest.kind_of?(Array) then dest = dest.join(array_split_char).split(array_split_char); end + end + # if there's a naked knockout_prefix in source, that means we are to truncate dest + if source.index(knockout_prefix) then dest = clear_or_nil(dest); source.delete(knockout_prefix); end + if dest.kind_of?(Array) + if knockout_prefix + print "#{di} knocking out: " if merge_debug + # remove knockout prefix items from both source and dest + source.delete_if do |ko_item| + retval = false + item = ko_item.respond_to?(:gsub) ? ko_item.gsub(%r{^#{knockout_prefix}}, "") : ko_item + if item != ko_item + print "#{ko_item} - " if merge_debug + dest.delete(item) + dest.delete(ko_item) + retval = true + end + retval + end + puts if merge_debug + end + puts "#{di} merging arrays: #{source.inspect} :: #{dest.inspect}" if merge_debug + dest = dest | source + if sort_merged_arrays then dest.sort!; end + elsif overwrite_unmergeable + puts "#{di} overwriting dest: #{source.inspect} -over-> #{dest.inspect}" if merge_debug + dest = overwrite_unmergeables(source, dest, options) + end + else # src_hash is not an array or hash, so we'll have to overwrite dest + puts "#{di}Others: #{source.inspect} :: #{dest.inspect}" if merge_debug + dest = overwrite_unmergeables(source, dest, options) + end + puts "#{di}Returning #{dest.inspect}" if merge_debug + dest + end # deep_merge! + + # allows deep_merge! to uniformly handle overwriting of unmergeable entities + def DeepMerge::overwrite_unmergeables(source, dest, options) + merge_debug = options[:merge_debug] || false + overwrite_unmergeable = !options[:preserve_unmergeables] + knockout_prefix = options[:knockout_prefix] || false + di = options[:debug_indent] || '' + if knockout_prefix && overwrite_unmergeable + if source.kind_of?(String) # remove knockout string from source before overwriting dest + src_tmp = source.gsub(%r{^#{knockout_prefix}},"") + elsif source.kind_of?(Array) # remove all knockout elements before overwriting dest + src_tmp = source.delete_if {|ko_item| ko_item.kind_of?(String) && ko_item.match(%r{^#{knockout_prefix}}) } + else + src_tmp = source + end + if src_tmp == source # if we didn't find a knockout_prefix then we just overwrite dest + puts "#{di}#{src_tmp.inspect} -over-> #{dest.inspect}" if merge_debug + dest = src_tmp + else # if we do find a knockout_prefix, then we just delete dest + puts "#{di}\"\" -over-> #{dest.inspect}" if merge_debug + dest = "" + end + elsif overwrite_unmergeable + dest = source + end + dest + end + + def DeepMerge::clear_or_nil(obj) + if obj.respond_to?(:clear) + obj.clear + else + obj = nil + end + obj + end + +end # module DeepMerge + +class Hash + include DeepMerge::DeepMergeHash +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/deep_merge/pkg/deep_merge-0.1.0.gem b/flex-bison/mark1/tools/ceedling/vendor/deep_merge/pkg/deep_merge-0.1.0.gem new file mode 100644 index 0000000..ffd2448 Binary files /dev/null and b/flex-bison/mark1/tools/ceedling/vendor/deep_merge/pkg/deep_merge-0.1.0.gem differ diff --git a/flex-bison/mark1/tools/ceedling/vendor/deep_merge/test/test_deep_merge.rb b/flex-bison/mark1/tools/ceedling/vendor/deep_merge/test/test_deep_merge.rb new file mode 100644 index 0000000..7ebd918 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/deep_merge/test/test_deep_merge.rb @@ -0,0 +1,553 @@ +require 'test/unit' +require '../lib/deep_merge.rb' + +class TestDeepMerge < Test::Unit::TestCase + + def setup + end + + # show that Hash object has deep merge capabilities in form of three methods: + # ko_deep_merge! # uses '--' knockout and overwrites unmergeable + # deep_merge! # overwrites unmergeable + # deep_merge # skips unmergeable + def test_hash_deep_merge + x = {} + assert x.respond_to?('deep_merge!'.to_sym) + hash_src = {'id' => [3,4,5]} + hash_dest = {'id' => [1,2,3]} + assert hash_dest.ko_deep_merge!(hash_src) + assert_equal({'id' => [1,2,3,4,5]}, hash_dest) + + hash_src = {'id' => [3,4,5]} + hash_dest = {'id' => [1,2,3]} + assert hash_dest.deep_merge!(hash_src) + assert_equal({'id' => [1,2,3,4,5]}, hash_dest) + + hash_src = {'id' => 'xxx'} + hash_dest = {'id' => [1,2,3]} + assert hash_dest.deep_merge(hash_src) + assert_equal({'id' => [1,2,3]}, hash_dest) + end + + FIELD_KNOCKOUT_PREFIX = DeepMerge::DEFAULT_FIELD_KNOCKOUT_PREFIX + + # tests DeepMerge::deep_merge! function + def test_deep_merge + # merge tests (moving from basic to more complex) + + # test merging an hash w/array into blank hash + hash_src = {'id' => '2'} + hash_dst = {} + DeepMerge::deep_merge!(hash_src.dup, hash_dst, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal hash_src, hash_dst + + # test merging an hash w/array into blank hash + hash_src = {'region' => {'id' => ['227', '2']}} + hash_dst = {} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal hash_src, hash_dst + + # merge from empty hash + hash_src = {} + hash_dst = {"property" => ["2","4"]} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => ["2","4"]}, hash_dst) + + # merge to empty hash + hash_src = {"property" => ["2","4"]} + hash_dst = {} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => ["2","4"]}, hash_dst) + + # simple string overwrite + hash_src = {"name" => "value"} + hash_dst = {"name" => "value1"} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"name" => "value"}, hash_dst) + + # simple string overwrite of empty hash + hash_src = {"name" => "value"} + hash_dst = {} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal(hash_src, hash_dst) + + # hashes holding array + hash_src = {"property" => ["1","3"]} + hash_dst = {"property" => ["2","4"]} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal(["2","4","1","3"], hash_dst['property']) + + # hashes holding array (sorted) + hash_src = {"property" => ["1","3"]} + hash_dst = {"property" => ["2","4"]} + DeepMerge::deep_merge!(hash_src, hash_dst, {:sort_merged_arrays => true}) + assert_equal(["1","2","3","4"].sort, hash_dst['property']) + + # hashes holding hashes holding arrays (array with duplicate elements is merged with dest then src + hash_src = {"property" => {"bedroom_count" => ["1", "2"], "bathroom_count" => ["1", "4+"]}} + hash_dst = {"property" => {"bedroom_count" => ["3", "2"], "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => {"bedroom_count" => ["3","2","1"], "bathroom_count" => ["2", "1", "4+"]}}, hash_dst) + + # hash holding hash holding array v string (string is overwritten by array) + hash_src = {"property" => {"bedroom_count" => ["1", "2"], "bathroom_count" => ["1", "4+"]}} + hash_dst = {"property" => {"bedroom_count" => "3", "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => {"bedroom_count" => ["1", "2"], "bathroom_count" => ["2","1","4+"]}}, hash_dst) + + # hash holding hash holding array v string (string is NOT overwritten by array) + hash_src = {"property" => {"bedroom_count" => ["1", "2"], "bathroom_count" => ["1", "4+"]}} + hash_dst = {"property" => {"bedroom_count" => "3", "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst, {:preserve_unmergeables => true}) + assert_equal({"property" => {"bedroom_count" => "3", "bathroom_count" => ["2","1","4+"]}}, hash_dst) + + # hash holding hash holding string v array (array is overwritten by string) + hash_src = {"property" => {"bedroom_count" => "3", "bathroom_count" => ["1", "4+"]}} + hash_dst = {"property" => {"bedroom_count" => ["1", "2"], "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => {"bedroom_count" => "3", "bathroom_count" => ["2","1","4+"]}}, hash_dst) + + # hash holding hash holding string v array (array does NOT overwrite string) + hash_src = {"property" => {"bedroom_count" => "3", "bathroom_count" => ["1", "4+"]}} + hash_dst = {"property" => {"bedroom_count" => ["1", "2"], "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst, {:preserve_unmergeables => true}) + assert_equal({"property" => {"bedroom_count" => ["1", "2"], "bathroom_count" => ["2","1","4+"]}}, hash_dst) + + # hash holding hash holding hash v array (array is overwritten by hash) + hash_src = {"property" => {"bedroom_count" => {"king_bed" => 3, "queen_bed" => 1}, "bathroom_count" => ["1", "4+"]}} + hash_dst = {"property" => {"bedroom_count" => ["1", "2"], "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => {"bedroom_count" => {"king_bed" => 3, "queen_bed" => 1}, "bathroom_count" => ["2","1","4+"]}}, hash_dst) + + # hash holding hash holding hash v array (array is NOT overwritten by hash) + hash_src = {"property" => {"bedroom_count" => {"king_bed" => 3, "queen_bed" => 1}, "bathroom_count" => ["1", "4+"]}} + hash_dst = {"property" => {"bedroom_count" => ["1", "2"], "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst, {:preserve_unmergeables => true}) + assert_equal({"property" => {"bedroom_count" => ["1", "2"], "bathroom_count" => ["2","1","4+"]}}, hash_dst) + + # 3 hash layers holding integers (integers are overwritten by source) + hash_src = {"property" => {"bedroom_count" => {"king_bed" => 3, "queen_bed" => 1}, "bathroom_count" => ["1", "4+"]}} + hash_dst = {"property" => {"bedroom_count" => {"king_bed" => 2, "queen_bed" => 4}, "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => {"bedroom_count" => {"king_bed" => 3, "queen_bed" => 1}, "bathroom_count" => ["2","1","4+"]}}, hash_dst) + + # 3 hash layers holding arrays of int (arrays are merged) + hash_src = {"property" => {"bedroom_count" => {"king_bed" => [3], "queen_bed" => [1]}, "bathroom_count" => ["1", "4+"]}} + hash_dst = {"property" => {"bedroom_count" => {"king_bed" => [2], "queen_bed" => [4]}, "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => {"bedroom_count" => {"king_bed" => [2,3], "queen_bed" => [4,1]}, "bathroom_count" => ["2","1","4+"]}}, hash_dst) + + # 1 hash overwriting 3 hash layers holding arrays of int + hash_src = {"property" => "1"} + hash_dst = {"property" => {"bedroom_count" => {"king_bed" => [2], "queen_bed" => [4]}, "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => "1"}, hash_dst) + + # 1 hash NOT overwriting 3 hash layers holding arrays of int + hash_src = {"property" => "1"} + hash_dst = {"property" => {"bedroom_count" => {"king_bed" => [2], "queen_bed" => [4]}, "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst, {:preserve_unmergeables => true}) + assert_equal({"property" => {"bedroom_count" => {"king_bed" => [2], "queen_bed" => [4]}, "bathroom_count" => ["2"]}}, hash_dst) + + # 3 hash layers holding arrays of int (arrays are merged) but second hash's array is overwritten + hash_src = {"property" => {"bedroom_count" => {"king_bed" => [3], "queen_bed" => [1]}, "bathroom_count" => "1"}} + hash_dst = {"property" => {"bedroom_count" => {"king_bed" => [2], "queen_bed" => [4]}, "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => {"bedroom_count" => {"king_bed" => [2,3], "queen_bed" => [4,1]}, "bathroom_count" => "1"}}, hash_dst) + + # 3 hash layers holding arrays of int (arrays are merged) but second hash's array is NOT overwritten + hash_src = {"property" => {"bedroom_count" => {"king_bed" => [3], "queen_bed" => [1]}, "bathroom_count" => "1"}} + hash_dst = {"property" => {"bedroom_count" => {"king_bed" => [2], "queen_bed" => [4]}, "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst, {:preserve_unmergeables => true}) + assert_equal({"property" => {"bedroom_count" => {"king_bed" => [2,3], "queen_bed" => [4,1]}, "bathroom_count" => ["2"]}}, hash_dst) + + # 3 hash layers holding arrays of int, but one holds int. This one overwrites, but the rest merge + hash_src = {"property" => {"bedroom_count" => {"king_bed" => 3, "queen_bed" => [1]}, "bathroom_count" => ["1"]}} + hash_dst = {"property" => {"bedroom_count" => {"king_bed" => [2], "queen_bed" => [4]}, "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => {"bedroom_count" => {"king_bed" => 3, "queen_bed" => [4,1]}, "bathroom_count" => ["2","1"]}}, hash_dst) + + # 3 hash layers holding arrays of int, but source is incomplete. + hash_src = {"property" => {"bedroom_count" => {"king_bed" => [3]}, "bathroom_count" => ["1"]}} + hash_dst = {"property" => {"bedroom_count" => {"king_bed" => [2], "queen_bed" => [4]}, "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => {"bedroom_count" => {"king_bed" => [2,3], "queen_bed" => [4]}, "bathroom_count" => ["2","1"]}}, hash_dst) + + # 3 hash layers holding arrays of int, but source is shorter and has new 2nd level ints. + hash_src = {"property" => {"bedroom_count" => {2=>3, "king_bed" => [3]}, "bathroom_count" => ["1"]}} + hash_dst = {"property" => {"bedroom_count" => {"king_bed" => [2], "queen_bed" => [4]}, "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => {"bedroom_count" => {2=>3, "king_bed" => [2,3], "queen_bed" => [4]}, "bathroom_count" => ["2","1"]}}, hash_dst) + + # 3 hash layers holding arrays of int, but source is empty + hash_src = {} + hash_dst = {"property" => {"bedroom_count" => {"king_bed" => [2], "queen_bed" => [4]}, "bathroom_count" => ["2"]}} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => {"bedroom_count" => {"king_bed" => [2], "queen_bed" => [4]}, "bathroom_count" => ["2"]}}, hash_dst) + + # 3 hash layers holding arrays of int, but dest is empty + hash_src = {"property" => {"bedroom_count" => {2=>3, "king_bed" => [3]}, "bathroom_count" => ["1"]}} + hash_dst = {} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"property" => {"bedroom_count" => {2=>3, "king_bed" => [3]}, "bathroom_count" => ["1"]}}, hash_dst) + + # test parameter management for knockout_prefix and overwrite unmergable + assert_raise(DeepMerge::InvalidParameter) {DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => ""})} + assert_raise(DeepMerge::InvalidParameter) {DeepMerge::deep_merge!(hash_src, hash_dst, {:preserve_unmergeables => true, :knockout_prefix => ""})} + assert_raise(DeepMerge::InvalidParameter) {DeepMerge::deep_merge!(hash_src, hash_dst, {:preserve_unmergeables => true, :knockout_prefix => "--"})} + assert_nothing_raised(DeepMerge::InvalidParameter) {DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => "--"})} + assert_nothing_raised(DeepMerge::InvalidParameter) {DeepMerge::deep_merge!(hash_src, hash_dst)} + assert_nothing_raised(DeepMerge::InvalidParameter) {DeepMerge::deep_merge!(hash_src, hash_dst, {:preserve_unmergeables => true})} + + # hash holding arrays of arrays + hash_src = {["1", "2", "3"] => ["1", "2"]} + hash_dst = {["4", "5"] => ["3"]} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({["1","2","3"] => ["1", "2"], ["4", "5"] => ["3"]}, hash_dst) + + # test merging of hash with blank hash, and make sure that source array split still functions + hash_src = {'property' => {'bedroom_count' => ["1","2,3"]}} + hash_dst = {} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({'property' => {'bedroom_count' => ["1","2","3"]}}, hash_dst) + + # test merging of hash with blank hash, and make sure that source array split does not function when turned off + hash_src = {'property' => {'bedroom_count' => ["1","2,3"]}} + hash_dst = {} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX}) + assert_equal({'property' => {'bedroom_count' => ["1","2,3"]}}, hash_dst) + + # test merging into a blank hash with overwrite_unmergeables turned on + hash_src = {"action"=>"browse", "controller"=>"results"} + hash_dst = {} + DeepMerge::deep_merge!(hash_src, hash_dst, {:overwrite_unmergeables => true, :knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal hash_src, hash_dst + + # KNOCKOUT_PREFIX testing + # the next few tests are looking for correct behavior from specific real-world params/session merges + # using the custom modifiers built for param/session merges + + [nil, ","].each do |ko_split| + # typical params/session style hash with knockout_merge elements + hash_params = {"property"=>{"bedroom_count"=>[FIELD_KNOCKOUT_PREFIX+"1", "2", "3"]}} + hash_session = {"property"=>{"bedroom_count"=>["1", "2", "3"]}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ko_split}) + assert_equal({"property"=>{"bedroom_count"=>["2", "3"]}}, hash_session) + + # typical params/session style hash with knockout_merge elements + hash_params = {"property"=>{"bedroom_count"=>[FIELD_KNOCKOUT_PREFIX+"1", "2", "3"]}} + hash_session = {"property"=>{"bedroom_count"=>["3"]}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ko_split}) + assert_equal({"property"=>{"bedroom_count"=>["3","2"]}}, hash_session) + + # typical params/session style hash with knockout_merge elements + hash_params = {"property"=>{"bedroom_count"=>[FIELD_KNOCKOUT_PREFIX+"1", "2", "3"]}} + hash_session = {"property"=>{"bedroom_count"=>["4"]}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ko_split}) + assert_equal({"property"=>{"bedroom_count"=>["4","2","3"]}}, hash_session) + + # typical params/session style hash with knockout_merge elements + hash_params = {"property"=>{"bedroom_count"=>[FIELD_KNOCKOUT_PREFIX+"1", "2", "3"]}} + hash_session = {"property"=>{"bedroom_count"=>[FIELD_KNOCKOUT_PREFIX+"1", "4"]}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ko_split}) + assert_equal({"property"=>{"bedroom_count"=>["4","2","3"]}}, hash_session) + + # typical params/session style hash with knockout_merge elements + hash_params = {"amenity"=>{"id"=>[FIELD_KNOCKOUT_PREFIX+"1", FIELD_KNOCKOUT_PREFIX+"2", "3", "4"]}} + hash_session = {"amenity"=>{"id"=>["1", "2"]}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ko_split}) + assert_equal({"amenity"=>{"id"=>["3","4"]}}, hash_session) + end + + # special params/session style hash with knockout_merge elements in form src: ["1","2"] dest:["--1,--2", "3,4"] + hash_params = {"amenity"=>{"id"=>[FIELD_KNOCKOUT_PREFIX+"1,"+FIELD_KNOCKOUT_PREFIX+"2", "3,4"]}} + hash_session = {"amenity"=>{"id"=>["1", "2"]}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"amenity"=>{"id"=>["3","4"]}}, hash_session) + + # same as previous but without ko_split value, this merge should fail + hash_params = {"amenity"=>{"id"=>[FIELD_KNOCKOUT_PREFIX+"1,"+FIELD_KNOCKOUT_PREFIX+"2", "3,4"]}} + hash_session = {"amenity"=>{"id"=>["1", "2"]}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX}) + assert_equal({"amenity"=>{"id"=>["1","2","3,4"]}}, hash_session) + + # special params/session style hash with knockout_merge elements in form src: ["1","2"] dest:["--1,--2", "3,4"] + hash_params = {"amenity"=>{"id"=>[FIELD_KNOCKOUT_PREFIX+"1,2", "3,4", "--5", "6"]}} + hash_session = {"amenity"=>{"id"=>["1", "2"]}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"amenity"=>{"id"=>["2","3","4","6"]}}, hash_session) + + # special params/session style hash with knockout_merge elements in form src: ["--1,--2", "3,4", "--5", "6"] dest:["1,2", "3,4"] + hash_params = {"amenity"=>{"id"=>["#{FIELD_KNOCKOUT_PREFIX}1,#{FIELD_KNOCKOUT_PREFIX}2", "3,4", "#{FIELD_KNOCKOUT_PREFIX}5", "6"]}} + hash_session = {"amenity"=>{"id"=>["1", "2", "3", "4"]}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"amenity"=>{"id"=>["3","4","6"]}}, hash_session) + + + hash_src = {"url_regions"=>[], "region"=>{"ids"=>["227,233"]}, "action"=>"browse", "task"=>"browse", "controller"=>"results"} + hash_dst = {"region"=>{"ids"=>["227"]}} + DeepMerge::deep_merge!(hash_src.dup, hash_dst, {:overwrite_unmergeables => true, :knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"url_regions"=>[], "region"=>{"ids"=>["227","233"]}, "action"=>"browse", "task"=>"browse", "controller"=>"results"}, hash_dst) + + hash_src = {"region"=>{"ids"=>["--","227"], "id"=>"230"}} + hash_dst = {"region"=>{"ids"=>["227", "233", "324", "230", "230"], "id"=>"230"}} + DeepMerge::deep_merge!(hash_src, hash_dst, {:overwrite_unmergeables => true, :knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"region"=>{"ids"=>["227"], "id"=>"230"}}, hash_dst) + + hash_src = {"region"=>{"ids"=>["--","227", "232", "233"], "id"=>"232"}} + hash_dst = {"region"=>{"ids"=>["227", "233", "324", "230", "230"], "id"=>"230"}} + DeepMerge::deep_merge!(hash_src, hash_dst, {:overwrite_unmergeables => true, :knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"region"=>{"ids"=>["227", "232", "233"], "id"=>"232"}}, hash_dst) + + hash_src = {"region"=>{"ids"=>["--,227,232,233"], "id"=>"232"}} + hash_dst = {"region"=>{"ids"=>["227", "233", "324", "230", "230"], "id"=>"230"}} + DeepMerge::deep_merge!(hash_src, hash_dst, {:overwrite_unmergeables => true, :knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"region"=>{"ids"=>["227", "232", "233"], "id"=>"232"}}, hash_dst) + + hash_src = {"region"=>{"ids"=>["--,227,232","233"], "id"=>"232"}} + hash_dst = {"region"=>{"ids"=>["227", "233", "324", "230", "230"], "id"=>"230"}} + DeepMerge::deep_merge!(hash_src, hash_dst, {:overwrite_unmergeables => true, :knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"region"=>{"ids"=>["227", "232", "233"], "id"=>"232"}}, hash_dst) + + hash_src = {"region"=>{"ids"=>["--,227"], "id"=>"230"}} + hash_dst = {"region"=>{"ids"=>["227", "233", "324", "230", "230"], "id"=>"230"}} + DeepMerge::deep_merge!(hash_src, hash_dst, {:overwrite_unmergeables => true, :knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"region"=>{"ids"=>["227"], "id"=>"230"}}, hash_dst) + + hash_src = {"region"=>{"ids"=>["--,227"], "id"=>"230"}} + hash_dst = {"region"=>{"ids"=>["227", "233", "324", "230", "230"], "id"=>"230"}, "action"=>"browse", "task"=>"browse", "controller"=>"results", "property_order_by"=>"property_type.descr"} + DeepMerge::deep_merge!(hash_src, hash_dst, {:overwrite_unmergeables => true, :knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"region"=>{"ids"=>["227"], "id"=>"230"}, "action"=>"browse", "task"=>"browse", + "controller"=>"results", "property_order_by"=>"property_type.descr"}, hash_dst) + + hash_src = {"query_uuid"=>"6386333d-389b-ab5c-8943-6f3a2aa914d7", "region"=>{"ids"=>["--,227"], "id"=>"230"}} + hash_dst = {"query_uuid"=>"6386333d-389b-ab5c-8943-6f3a2aa914d7", "url_regions"=>[], "region"=>{"ids"=>["227", "233", "324", "230", "230"], "id"=>"230"}, "action"=>"browse", "task"=>"browse", "controller"=>"results", "property_order_by"=>"property_type.descr"} + DeepMerge::deep_merge!(hash_src, hash_dst, {:overwrite_unmergeables => true, :knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"query_uuid" => "6386333d-389b-ab5c-8943-6f3a2aa914d7", "url_regions"=>[], + "region"=>{"ids"=>["227"], "id"=>"230"}, "action"=>"browse", "task"=>"browse", + "controller"=>"results", "property_order_by"=>"property_type.descr"}, hash_dst) + + # knock out entire dest hash if "--" is passed for source + hash_params = {'amenity' => "--"} + hash_session = {"amenity" => "1"} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => "--", :unpack_arrays => ","}) + assert_equal({'amenity' => ""}, hash_session) + + # knock out entire dest hash if "--" is passed for source + hash_params = {'amenity' => ["--"]} + hash_session = {"amenity" => "1"} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => "--", :unpack_arrays => ","}) + assert_equal({'amenity' => []}, hash_session) + + # knock out entire dest hash if "--" is passed for source + hash_params = {'amenity' => "--"} + hash_session = {"amenity" => ["1"]} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => "--", :unpack_arrays => ","}) + assert_equal({'amenity' => ""}, hash_session) + + # knock out entire dest hash if "--" is passed for source + hash_params = {'amenity' => ["--"]} + hash_session = {"amenity" => ["1"]} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => "--", :unpack_arrays => ","}) + assert_equal({'amenity' => []}, hash_session) + + # knock out entire dest hash if "--" is passed for source + hash_params = {'amenity' => ["--"]} + hash_session = {"amenity" => "1"} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => "--", :unpack_arrays => ","}) + assert_equal({'amenity' => []}, hash_session) + + # knock out entire dest hash if "--" is passed for source + hash_params = {'amenity' => ["--", "2"]} + hash_session = {'amenity' => ["1", "3", "7+"]} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => "--", :unpack_arrays => ","}) + assert_equal({'amenity' => ["2"]}, hash_session) + + # knock out entire dest hash if "--" is passed for source + hash_params = {'amenity' => ["--", "2"]} + hash_session = {'amenity' => "5"} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => "--", :unpack_arrays => ","}) + assert_equal({'amenity' => ['2']}, hash_session) + + # knock out entire dest hash if "--" is passed for source + hash_params = {'amenity' => "--"} + hash_session = {"amenity"=>{"id"=>["1", "2", "3", "4"]}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => "--", :unpack_arrays => ","}) + assert_equal({'amenity' => ""}, hash_session) + + # knock out entire dest hash if "--" is passed for source + hash_params = {'amenity' => ["--"]} + hash_session = {"amenity"=>{"id"=>["1", "2", "3", "4"]}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => "--", :unpack_arrays => ","}) + assert_equal({'amenity' => []}, hash_session) + + # knock out dest array if "--" is passed for source + hash_params = {"region" => {'ids' => FIELD_KNOCKOUT_PREFIX}} + hash_session = {"region"=>{"ids"=>["1", "2", "3", "4"]}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({'region' => {'ids' => ""}}, hash_session) + + # knock out dest array but leave other elements of hash intact + hash_params = {"region" => {'ids' => FIELD_KNOCKOUT_PREFIX}} + hash_session = {"region"=>{"ids"=>["1", "2", "3", "4"], 'id'=>'11'}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({'region' => {'ids' => "", 'id'=>'11'}}, hash_session) + + # knock out entire tree of dest hash + hash_params = {"region" => FIELD_KNOCKOUT_PREFIX} + hash_session = {"region"=>{"ids"=>["1", "2", "3", "4"], 'id'=>'11'}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({'region' => ""}, hash_session) + + # knock out entire tree of dest hash - retaining array format + hash_params = {"region" => {'ids' => [FIELD_KNOCKOUT_PREFIX]}} + hash_session = {"region"=>{"ids"=>["1", "2", "3", "4"], 'id'=>'11'}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({'region' => {'ids' => [], 'id'=>'11'}}, hash_session) + + # knock out entire tree of dest hash & replace with new content + hash_params = {"region" => {'ids' => ["2", FIELD_KNOCKOUT_PREFIX, "6"]}} + hash_session = {"region"=>{"ids"=>["1", "2", "3", "4"], 'id'=>'11'}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({'region' => {'ids' => ["2", "6"], 'id'=>'11'}}, hash_session) + + # knock out entire tree of dest hash & replace with new content + hash_params = {"region" => {'ids' => ["7", FIELD_KNOCKOUT_PREFIX, "6"]}} + hash_session = {"region"=>{"ids"=>["1", "2", "3", "4"], 'id'=>'11'}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({'region' => {'ids' => ["7", "6"], 'id'=>'11'}}, hash_session) + + # edge test: make sure that when we turn off knockout_prefix that all values are processed correctly + hash_params = {"region" => {'ids' => ["7", "--", "2", "6,8"]}} + hash_session = {"region"=>{"ids"=>["1", "2", "3", "4"], 'id'=>'11'}} + DeepMerge::deep_merge!(hash_params, hash_session, {:unpack_arrays => ","}) + assert_equal({'region' => {'ids' => ["1", "2", "3", "4", "7", "--", "6", "8"], 'id'=>'11'}}, hash_session) + + # edge test 2: make sure that when we turn off source array split that all values are processed correctly + hash_params = {"region" => {'ids' => ["7", "3", "--", "6,8"]}} + hash_session = {"region"=>{"ids"=>["1", "2", "3", "4"], 'id'=>'11'}} + DeepMerge::deep_merge!(hash_params, hash_session) + assert_equal({'region' => {'ids' => ["1", "2", "3", "4", "7", "--", "6,8"], 'id'=>'11'}}, hash_session) + + # Example: src = {'key' => "--1"}, dst = {'key' => "1"} -> merges to {'key' => ""} + hash_params = {"amenity"=>"--1"} + hash_session = {"amenity"=>"1"} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX}) + assert_equal({"amenity"=>""}, hash_session) + + # Example: src = {'key' => "--1"}, dst = {'key' => "2"} -> merges to {'key' => ""} + hash_params = {"amenity"=>"--1"} + hash_session = {"amenity"=>"2"} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX}) + assert_equal({"amenity"=>""}, hash_session) + + # Example: src = {'key' => "--1"}, dst = {'key' => "1"} -> merges to {'key' => ""} + hash_params = {"amenity"=>["--1"]} + hash_session = {"amenity"=>"1"} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX}) + assert_equal({"amenity"=>[]}, hash_session) + + # Example: src = {'key' => "--1"}, dst = {'key' => "1"} -> merges to {'key' => ""} + hash_params = {"amenity"=>["--1"]} + hash_session = {"amenity"=>["1"]} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX}) + assert_equal({"amenity"=>[]}, hash_session) + + # Example: src = {'key' => "--1"}, dst = {'key' => "1"} -> merges to {'key' => ""} + hash_params = {"amenity"=>"--1"} + hash_session = {} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX}) + assert_equal({"amenity"=>""}, hash_session) + + + # Example: src = {'key' => "--1"}, dst = {'key' => "1"} -> merges to {'key' => ""} + hash_params = {"amenity"=>"--1"} + hash_session = {"amenity"=>["1"]} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX}) + assert_equal({"amenity"=>""}, hash_session) + + #are unmerged hashes passed unmodified w/out :unpack_arrays? + hash_params = {"amenity"=>{"id"=>["26,27"]}} + hash_session = {} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX}) + assert_equal({"amenity"=>{"id"=>["26,27"]}}, hash_session) + + #hash should be merged + hash_params = {"amenity"=>{"id"=>["26,27"]}} + hash_session = {} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"amenity"=>{"id"=>["26","27"]}}, hash_session) + + # second merge of same values should result in no change in output + hash_params = {"amenity"=>{"id"=>["26,27"]}} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"amenity"=>{"id"=>["26","27"]}}, hash_session) + + #hashes with knockout values are suppressed + hash_params = {"amenity"=>{"id"=>["#{FIELD_KNOCKOUT_PREFIX}26,#{FIELD_KNOCKOUT_PREFIX}27,28"]}} + hash_session = {} + DeepMerge::deep_merge!(hash_params, hash_session, {:knockout_prefix => FIELD_KNOCKOUT_PREFIX, :unpack_arrays => ","}) + assert_equal({"amenity"=>{"id"=>["28"]}}, hash_session) + + hash_src= {'region' =>{'ids'=>['--']}, 'query_uuid' => 'zzz'} + hash_dst= {'region' =>{'ids'=>['227','2','3','3']}, 'query_uuid' => 'zzz'} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => '--', :unpack_arrays => ","}) + assert_equal({'region' =>{'ids'=>[]}, 'query_uuid' => 'zzz'}, hash_dst) + + hash_src= {'region' =>{'ids'=>['--']}, 'query_uuid' => 'zzz'} + hash_dst= {'region' =>{'ids'=>['227','2','3','3'], 'id' => '3'}, 'query_uuid' => 'zzz'} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => '--', :unpack_arrays => ","}) + assert_equal({'region' =>{'ids'=>[], 'id'=>'3'}, 'query_uuid' => 'zzz'}, hash_dst) + + hash_src= {'region' =>{'ids'=>['--']}, 'query_uuid' => 'zzz'} + hash_dst= {'region' =>{'muni_city_id' => '2244', 'ids'=>['227','2','3','3'], 'id'=>'3'}, 'query_uuid' => 'zzz'} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => '--', :unpack_arrays => ","}) + assert_equal({'region' =>{'muni_city_id' => '2244', 'ids'=>[], 'id'=>'3'}, 'query_uuid' => 'zzz'}, hash_dst) + + hash_src= {'region' =>{'ids'=>['--'], 'id' => '5'}, 'query_uuid' => 'zzz'} + hash_dst= {'region' =>{'muni_city_id' => '2244', 'ids'=>['227','2','3','3'], 'id'=>'3'}, 'query_uuid' => 'zzz'} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => '--', :unpack_arrays => ","}) + assert_equal({'region' =>{'muni_city_id' => '2244', 'ids'=>[], 'id'=>'5'}, 'query_uuid' => 'zzz'}, hash_dst) + + hash_src= {'region' =>{'ids'=>['--', '227'], 'id' => '5'}, 'query_uuid' => 'zzz'} + hash_dst= {'region' =>{'muni_city_id' => '2244', 'ids'=>['227','2','3','3'], 'id'=>'3'}, 'query_uuid' => 'zzz'} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => '--', :unpack_arrays => ","}) + assert_equal({'region' =>{'muni_city_id' => '2244', 'ids'=>['227'], 'id'=>'5'}, 'query_uuid' => 'zzz'}, hash_dst) + + hash_src= {'region' =>{'muni_city_id' => '--', 'ids'=>'--', 'id'=>'5'}, 'query_uuid' => 'zzz'} + hash_dst= {'region' =>{'muni_city_id' => '2244', 'ids'=>['227','2','3','3'], 'id'=>'3'}, 'query_uuid' => 'zzz'} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => '--', :unpack_arrays => ","}) + assert_equal({'region' =>{'muni_city_id' => '', 'ids'=>'', 'id'=>'5'}, 'query_uuid' => 'zzz'}, hash_dst) + + hash_src= {'region' =>{'muni_city_id' => '--', 'ids'=>['--'], 'id'=>'5'}, 'query_uuid' => 'zzz'} + hash_dst= {'region' =>{'muni_city_id' => '2244', 'ids'=>['227','2','3','3'], 'id'=>'3'}, 'query_uuid' => 'zzz'} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => '--', :unpack_arrays => ","}) + assert_equal({'region' =>{'muni_city_id' => '', 'ids'=>[], 'id'=>'5'}, 'query_uuid' => 'zzz'}, hash_dst) + + hash_src= {'region' =>{'muni_city_id' => '--', 'ids'=>['--','227'], 'id'=>'5'}, 'query_uuid' => 'zzz'} + hash_dst= {'region' =>{'muni_city_id' => '2244', 'ids'=>['227','2','3','3'], 'id'=>'3'}, 'query_uuid' => 'zzz'} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => '--', :unpack_arrays => ","}) + assert_equal({'region' =>{'muni_city_id' => '', 'ids'=>['227'], 'id'=>'5'}, 'query_uuid' => 'zzz'}, hash_dst) + + hash_src = {"muni_city_id"=>"--", "id"=>""} + hash_dst = {"muni_city_id"=>"", "id"=>""} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => '--', :unpack_arrays => ","}) + assert_equal({"muni_city_id"=>"", "id"=>""}, hash_dst) + + hash_src = {"region"=>{"muni_city_id"=>"--", "id"=>""}} + hash_dst = {"region"=>{"muni_city_id"=>"", "id"=>""}} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => '--', :unpack_arrays => ","}) + assert_equal({"region"=>{"muni_city_id"=>"", "id"=>""}}, hash_dst) + + hash_src = {"query_uuid"=>"a0dc3c84-ec7f-6756-bdb0-fff9157438ab", "url_regions"=>[], "region"=>{"muni_city_id"=>"--", "id"=>""}, "property"=>{"property_type_id"=>"", "search_rate_min"=>"", "search_rate_max"=>""}, "task"=>"search", "run_query"=>"Search"} + hash_dst = {"query_uuid"=>"a0dc3c84-ec7f-6756-bdb0-fff9157438ab", "url_regions"=>[], "region"=>{"muni_city_id"=>"", "id"=>""}, "property"=>{"property_type_id"=>"", "search_rate_min"=>"", "search_rate_max"=>""}, "task"=>"search", "run_query"=>"Search"} + DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => '--', :unpack_arrays => ","}) + assert_equal({"query_uuid"=>"a0dc3c84-ec7f-6756-bdb0-fff9157438ab", "url_regions"=>[], "region"=>{"muni_city_id"=>"", "id"=>""}, "property"=>{"property_type_id"=>"", "search_rate_min"=>"", "search_rate_max"=>""}, "task"=>"search", "run_query"=>"Search"}, hash_dst) + + # hash of array of hashes + hash_src = {"item" => [{"1" => "3"}, {"2" => "4"}]} + hash_dst = {"item" => [{"3" => "5"}]} + DeepMerge::deep_merge!(hash_src, hash_dst) + assert_equal({"item" => [{"3" => "5"}, {"1" => "3"}, {"2" => "4"}]}, hash_dst) + end # test_deep_merge +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/History.txt b/flex-bison/mark1/tools/ceedling/vendor/diy/History.txt new file mode 100644 index 0000000..9833fd1 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/History.txt @@ -0,0 +1,28 @@ +== 1.1.2 / 2009-11-30 + * Converted to Jeweler for gem packaging + * diy/factory.rb was somehow missing from the 1.1.1 gem on gemcutter. This has been fixed as part of the Jeweler changeover. + * Rebuilt homepage http://atomicobject.github.com/diy + +== 1.1.1 / 2008-05-21 + * Fixed bug that did not allow a method to be properly injected into an object + +== 1.1 / 2008-05-20 + * Added 'method' directive for building a bounded method from an object defined in diy + +== 1.0.3 / 2007-12-11 + +* The 1.0.1 release had a load-path search in it that resulted in requiring files with full path names (rooted in loadpath entries). This is unintuitive, and will almost always result in a double "require" if the application code ever requires a library. The "require" for library loading now relies implicitly on the load path (just like normal human-coded requires.) + +== 1.0.1 / 2007-12-02 + +* Added 'using_namespace' directive for assuming a module for a group of object defs +* Added 'use_class_directly' option for configuring an ObjectDef. Instead of instantiating an instance + of the specified class, the class itself is referenced. (Good for injecting ActiveRecord classes into + other components in the guise of factories. +* Added DIY::Context.auto_require boolean setting. When false, the library of a + class is not autoloaded ahead of object construction. Is true by default. +* 'auto_require' can, if neccessary, be set in the YAML config for an individual object. + +== 1.0.0 / 2007-11-19 + +* Released! diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/README.rdoc b/flex-bison/mark1/tools/ceedling/vendor/diy/README.rdoc new file mode 100644 index 0000000..6dfef2e --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/README.rdoc @@ -0,0 +1,233 @@ +== DIY + +* http://atomicobject.github.com/diy + +== DESCRIPTION: + +DIY (Dependency Injection in YAML) is a simple dependency injection library +which focuses on declarative composition of objects through constructor injection. + +== INSTALL: + +* gem install diy + +== SYNOPSIS: + +=== Common Usage + +Author a YAML file that describes your objects and how they fit together. +This means you're building a Hash whose keys are the object names, and whose +values are Hashes that define the object. + +The following context defines an automobile engine: + +context.yml: + --- + engine: + compose: throttle, block + throttle: + compose: cable, pedal + block: + cable: + pedal: + +In your code, use DIY to load the YAML, then access its parts: + + context = DIY::Context.from_file('context.yml') + context[:engine] => + +This approach assumes: + +* You've got classes for Engine, Throttle, Block, Cable and Pedal +* They're defined in engine.rb, throttle.rb, etc +* The library files are in your load-path +* Engine and Throttle both have a constructor that accepts a Hash. The Hash + will contain keys 'throttle', 'block' (for Engine) and 'cable, 'pedal' (for Throttle) + and the values will be references to their respective objects. +* Block, Cable and Pedal all have default constructors that accept no arguments + +Sample code for Engine's constructor: + + class Engine + def initialize(components) + @throttle = components['throttle'] + @block = components['block'] + end + end + +Writing code like that is repetetive; that's why we created the Constructor gem, which lets you +specify object components using the "constructor" class method: + +Using constructor, you can write Engine like this: + + class Engine + constructor :throttle, :block + end + +=== Special Cases + +If your object has a lot of components (or they have big names) you can specify an array of component names +as opposed to a comma-separated list: + + engine: + compose: + - throttle + - block + +Sometimes you won't be able to rely on DIY's basic assumptions about class names and library files. + +* You can specify the 'class' option +* You can specify the 'library' option. If you do not, the library is inferred from the class name. + (Eg, My::Train::Station will be sought in "my/train/station.rb" + + engine: + class: FourHorse::Base + library: general_engines/base + compose: throttle, block + +If the Hash coming into your constructor needs to have some keys that do not exactly match the official +object names, you can specify them one-by-one: + + engine: + the_throttle: throttle + the_block: block + +=== Non-singleton objects + +Non-singletons are named objects that provide a new instance every time you ask for them. +By default, DIY considers all objects to be singletons. To override, use the "singleton" setting and +set it to false: + + foo: + singleton: false + +=== Sub-Contexts + +Sub-contexts are useful for creating isolated object networks that may need to be instantiated +zero or many times in your application. Objects defined in subcontexts can reference "upward" to +their surroundings, as well as objects in the subcontext itself. + +If you wanted to be able to make more than one Engine from the preceding examples, you might try: + + --- + epa_regulations: + + +automotive_plant: + engine: + compose: block, throttle, epa_regulations + block: + throttle: + +Each time you delve into the automotive_plant, you get a solar system of the defined objects. +In this context, the objects are singleton-like. The next time you invoke the subcontext, however, +you'll be working with a fresh set of objects... another solar system with the same layout, so to speak. + +Subcontexts are not initialized until you call upon them, which you do using the "within" method: + + context = DIY::Context.from_file('context.yml') + context.within('automotive_plant') do |plant| + puts plant[:engine] + end + +=== Direct Class References + +Occasionally you will have a class at your disposal that you'd like to provide directly as components +to other objects (as opposed to getting _instances_ of that class, you want to reference the class itself, eg, +to use its factory methods). Enter the "use_class_directly" flag: + + --- + customer_order_finder: + class: CustomerOrder + use_class_directly: true + +This can be handy in Rails when you'd like to use some of class methods on an ActiveRecord subclass, but +you'd like to avoid direct ActiveRecord class usage in your code. In this case, the customer_order_finder +is actually the CustomerOrder class, and so, it has methods like "find" and "destroy_all". + +=== Namespace Convenience + +If you find yourself writing context entries like this: + + --- + engine: + class: Car::Parts::Engine + throttle: + class: Car::Parts::Block + cable: + class: Car::Parts::Cable + +You can set the "assumed" module for a group of objects like this: + + --- + using_namespace Car Parts: + engine: + + throttle: + + block: + +=== Preventing auto-requiring of library files + +Normally, DIY will "require" the library for an object just before it instantiates the object. +If this is not desired (in Rails, auto-require can lead to library double-load issues), you +can deactivate auto-require. There is a global default setting (handled in code) and +a per-object override (handled in the context YAML): + + DIY::Context.auto_require = false + + --- + engine: + auto_require: false + +=== Factories + +It is possible to create factories automatically with DIY: + + --- + car_dealer: + compose: car_factory + + car_factory: + builds: car + +Then you can use the factory to easily build objects: + + context = DIY::Context.from_file('context.yml') + context[:car_factory].create => + +=== Method Directive + +This introduces the concept of first class methods. An object can now be constructed with a method object +bound to a particular object in the diy context. + + --- + trinket_builder: + + method build_trinket: + object: trinket_builder + method: build + +== LICENSE: + +(The MIT License) + +Copyright (c) 2007 Atomic Object + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/Rakefile b/flex-bison/mark1/tools/ceedling/vendor/diy/Rakefile new file mode 100644 index 0000000..0fb9c44 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/Rakefile @@ -0,0 +1,33 @@ +require 'rubygems' + +task :default => [ :test ] + +require 'rake/testtask' +Rake::TestTask.new do |t| + t.libs << "test" + t.test_files = FileList['test/**/*_test.rb'] + t.verbose = true +end + + +begin + require 'jeweler' + Jeweler::Tasks.new do |gemspec| + $: << "lib" + require 'diy.rb' + gemspec.name = 'diy' + gemspec.version = DIY::VERSION + gemspec.summary = 'Constructor-based dependency injection container using YAML input.' + gemspec.description = 'Constructor-based dependency injection container using YAML input.' + gemspec.homepage = 'http://atomicobject.github.com/diy' + gemspec.authors = 'Atomic Object' + gemspec.email = 'github@atomicobject.com' + gemspec.test_files = FileList['test/*_test.rb'] + gemspec.add_dependency 'constructor', '>= 1.0.0' + end + + Jeweler::GemcutterTasks.new + +rescue LoadError + puts "(jeweler not installed)" +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/TODO.txt b/flex-bison/mark1/tools/ceedling/vendor/diy/TODO.txt new file mode 100644 index 0000000..8533234 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/TODO.txt @@ -0,0 +1,9 @@ +Sun Dec 2 19:59:16 EST 2007 +crosby + +Features from FRE's rogue diy.rb (inside Injection) that need to be +incorporated into trunk: + +* auto_require +* use_class_directly + diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/diy.gemspec b/flex-bison/mark1/tools/ceedling/vendor/diy/diy.gemspec new file mode 100644 index 0000000..fe9ac19 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/diy.gemspec @@ -0,0 +1,131 @@ +# Generated by jeweler +# DO NOT EDIT THIS FILE DIRECTLY +# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command +# -*- encoding: utf-8 -*- + +Gem::Specification.new do |s| + s.name = %q{diy} + s.version = "1.1.2" + + s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= + s.authors = ["Atomic Object"] + s.date = %q{2009-12-01} + s.description = %q{Constructor-based dependency injection container using YAML input.} + s.email = %q{github@atomicobject.com} + s.extra_rdoc_files = [ + "README.rdoc" + ] + s.files = [ + "History.txt", + "README.rdoc", + "Rakefile", + "TODO.txt", + "diy.gemspec", + "lib/diy.rb", + "lib/diy/factory.rb", + "sample_code/car.rb", + "sample_code/chassis.rb", + "sample_code/diy_example.rb", + "sample_code/engine.rb", + "sample_code/objects.yml", + "test/constructor.rb", + "test/diy_test.rb", + "test/factory_test.rb", + "test/files/broken_construction.yml", + "test/files/cat/cat.rb", + "test/files/cat/extra_conflict.yml", + "test/files/cat/heritage.rb", + "test/files/cat/needs_input.yml", + "test/files/cat/the_cat_lineage.rb", + "test/files/dog/dog_model.rb", + "test/files/dog/dog_presenter.rb", + "test/files/dog/dog_view.rb", + "test/files/dog/file_resolver.rb", + "test/files/dog/other_thing.rb", + "test/files/dog/simple.yml", + "test/files/donkey/foo.rb", + "test/files/donkey/foo/bar/qux.rb", + "test/files/factory/beef.rb", + "test/files/factory/dog.rb", + "test/files/factory/factory.yml", + "test/files/factory/farm/llama.rb", + "test/files/factory/farm/pork.rb", + "test/files/factory/kitten.rb", + "test/files/fud/objects.yml", + "test/files/fud/toy.rb", + "test/files/functions/attached_things_builder.rb", + "test/files/functions/invalid_method.yml", + "test/files/functions/method_extractor.rb", + "test/files/functions/nonsingleton_objects.yml", + "test/files/functions/objects.yml", + "test/files/functions/thing.rb", + "test/files/functions/thing_builder.rb", + "test/files/functions/things_builder.rb", + "test/files/gnu/objects.yml", + "test/files/gnu/thinger.rb", + "test/files/goat/base.rb", + "test/files/goat/can.rb", + "test/files/goat/goat.rb", + "test/files/goat/objects.yml", + "test/files/goat/paper.rb", + "test/files/goat/plane.rb", + "test/files/goat/shirt.rb", + "test/files/goat/wings.rb", + "test/files/horse/holder_thing.rb", + "test/files/horse/objects.yml", + "test/files/namespace/animal/bird.rb", + "test/files/namespace/animal/cat.rb", + "test/files/namespace/animal/reptile/hardshell/turtle.rb", + "test/files/namespace/animal/reptile/lizard.rb", + "test/files/namespace/bad_module_specified.yml", + "test/files/namespace/class_name_combine.yml", + "test/files/namespace/hello.txt", + "test/files/namespace/no_module_specified.yml", + "test/files/namespace/objects.yml", + "test/files/namespace/road.rb", + "test/files/namespace/sky.rb", + "test/files/namespace/subcontext.yml", + "test/files/non_singleton/air.rb", + "test/files/non_singleton/fat_cat.rb", + "test/files/non_singleton/objects.yml", + "test/files/non_singleton/pig.rb", + "test/files/non_singleton/thread_spinner.rb", + "test/files/non_singleton/tick.rb", + "test/files/non_singleton/yard.rb", + "test/files/yak/core_model.rb", + "test/files/yak/core_presenter.rb", + "test/files/yak/core_view.rb", + "test/files/yak/data_source.rb", + "test/files/yak/fringe_model.rb", + "test/files/yak/fringe_presenter.rb", + "test/files/yak/fringe_view.rb", + "test/files/yak/giant_squid.rb", + "test/files/yak/krill.rb", + "test/files/yak/my_objects.yml", + "test/files/yak/sub_sub_context_test.yml", + "test/test_helper.rb" + ] + s.homepage = %q{http://atomicobject.github.com/diy} + s.rdoc_options = ["--charset=UTF-8"] + s.require_paths = ["lib"] + s.rubygems_version = %q{1.3.5} + s.summary = %q{Constructor-based dependency injection container using YAML input.} + s.test_files = [ + "test/diy_test.rb", + "test/factory_test.rb" + ] + + if s.respond_to? :specification_version then + current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION + s.specification_version = 3 + + if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then + s.add_runtime_dependency(%q, [">= 1.0.0"]) + else + s.add_dependency(%q, [">= 1.0.0"]) + end + else + s.add_dependency(%q, [">= 1.0.0"]) + end +end + diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/lib/diy.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/lib/diy.rb new file mode 100644 index 0000000..581afc7 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/lib/diy.rb @@ -0,0 +1,403 @@ +require 'diy/factory.rb' +require 'yaml' +require 'set' + +module DIY #:nodoc:# + VERSION = '1.1.2' + class Context + + class << self + # Enable / disable automatic requiring of libraries. Default: true + attr_accessor :auto_require + end + @auto_require = true + + # Accepts a Hash defining the object context (usually loaded from objects.yml), and an additional + # Hash containing objects to inject into the context. + def initialize(context_hash, extra_inputs={}) + raise "Nil context hash" unless context_hash + raise "Need a hash" unless context_hash.kind_of?(Hash) + [ "[]", "keys" ].each do |mname| + unless extra_inputs.respond_to?(mname) + raise "Extra inputs must respond to hash-like [] operator and methods #keys and #each" + end + end + + # store extra inputs + if extra_inputs.kind_of?(Hash) + @extra_inputs= {} + extra_inputs.each { |k,v| @extra_inputs[k.to_s] = v } # smooth out the names + else + @extra_inputs = extra_inputs + end + + collect_object_and_subcontext_defs context_hash + + # init the cache + @cache = {} + @cache['this_context'] = self + end + + + # Convenience: create a new DIY::Context by loading from a String (or open file handle.) + def self.from_yaml(io_or_string, extra_inputs={}) + raise "nil input to YAML" unless io_or_string + Context.new(YAML.load(io_or_string), extra_inputs) + end + + # Convenience: create a new DIY::Context by loading from the named file. + def self.from_file(fname, extra_inputs={}) + raise "nil file name" unless fname + self.from_yaml(File.read(fname), extra_inputs) + end + + # Return a reference to the object named. If necessary, the object will + # be instantiated on first use. If the object is non-singleton, a new + # object will be produced each time. + def get_object(obj_name) + key = obj_name.to_s + obj = @cache[key] + unless obj + if extra_inputs_has(key) + obj = @extra_inputs[key] + else + case @defs[key] + when MethodDef + obj = construct_method(key) + when FactoryDef + obj = construct_factory(key) + @cache[key] = obj + else + obj = construct_object(key) + @cache[key] = obj if @defs[key].singleton? + end + end + end + obj + end + alias :[] :get_object + + # Inject a named object into the Context. This must be done before the Context has instantiated the + # object in question. + def set_object(obj_name,obj) + key = obj_name.to_s + raise "object '#{key}' already exists in context" if @cache.keys.include?(key) + @cache[key] = obj + end + alias :[]= :set_object + + # Provide a listing of object names + def keys + (@defs.keys.to_set + @extra_inputs.keys.to_set).to_a + end + + # Instantiate and yield the named subcontext + def within(sub_context_name) + # Find the subcontext definitaion: + context_def = @sub_context_defs[sub_context_name.to_s] + raise "No sub-context named #{sub_context_name}" unless context_def + # Instantiate a new context using self as parent: + context = Context.new( context_def, self ) + + yield context + end + + # Returns true if the context contains an object with the given name + def contains_object(obj_name) + key = obj_name.to_s + @defs.keys.member?(key) or extra_inputs_has(key) + end + + # Every top level object in the Context is instantiated. This is especially useful for + # systems that have "floating observers"... objects that are never directly accessed, who + # would thus never be instantiated by coincedence. This does not build any subcontexts + # that may exist. + def build_everything + @defs.keys.each { |k| self[k] } + end + alias :build_all :build_everything + alias :preinstantiate_singletons :build_everything + + private + + def collect_object_and_subcontext_defs(context_hash) + @defs = {} + @sub_context_defs = {} + get_defs_from context_hash + end + + def get_defs_from(hash, namespace=nil) + hash.each do |name,info| + # we modify the info hash below so it's important to have a new + # instance to play with + info = info.dup if info + + # see if we are building a factory + if info and info.has_key?('builds') + unless info.has_key?('auto_require') + info['auto_require'] = self.class.auto_require + end + + if namespace + info['builds'] = namespace.build_classname(info['builds']) + end + @defs[name] = FactoryDef.new({:name => name, + :target => info['builds'], + :library => info['library'], + :auto_require => info['auto_require']}) + next + end + + name = name.to_s + case name + when /^\+/ + # subcontext + @sub_context_defs[name.gsub(/^\+/,'')] = info + + when /^using_namespace/ + # namespace: use a module(s) prefix for the classname of contained object defs + # NOTE: namespacing is NOT scope... it's just a convenient way to setup class names for a group of objects. + get_defs_from info, parse_namespace(name) + when /^method\s/ + key_name = name.gsub(/^method\s/, "") + @defs[key_name] = MethodDef.new(:name => key_name, + :object => info['object'], + :method => info['method'], + :attach => info['attach']) + else + # Normal object def + info ||= {} + if extra_inputs_has(name) + raise ConstructionError.new(name, "Object definition conflicts with parent context") + end + unless info.has_key?('auto_require') + info['auto_require'] = self.class.auto_require + end + if namespace + if info['class'] + info['class'] = namespace.build_classname(info['class']) + else + info['class'] = namespace.build_classname(name) + end + end + + @defs[name] = ObjectDef.new(:name => name, :info => info) + + end + end + end + + def construct_method(key) + method_definition = @defs[key] + object = get_object(method_definition.object) + method = object.method(method_definition.method) + + unless method_definition.attach.nil? + instance_var_name = "@__diy_#{method_definition.object}" + + method_definition.attach.each do |object_key| + get_object(object_key).instance_eval do + instance_variable_set(instance_var_name, object) + eval %|def #{key}(*args) + #{instance_var_name}.#{method_definition.method}(*args) + end| + end + end + end + + return method + rescue Exception => oops + build_and_raise_construction_error(key, oops) + end + + def construct_object(key) + # Find the object definition + obj_def = @defs[key] + raise "No object definition for '#{key}'" unless obj_def + # If object def mentions a library, load it + require obj_def.library if obj_def.library + + # Resolve all components for the object + arg_hash = {} + obj_def.components.each do |name,value| + case value + when Lookup + arg_hash[name.to_sym] = get_object(value.name) + when StringValue + arg_hash[name.to_sym] = value.literal_value + else + raise "Cannot cope with component definition '#{value.inspect}'" + end + end + # Get a reference to the class for the object + big_c = get_class_for_name_with_module_delimeters(obj_def.class_name) + # Make and return the instance + if obj_def.use_class_directly? + return big_c + elsif arg_hash.keys.size > 0 + return big_c.new(arg_hash) + else + return big_c.new + end + rescue Exception => oops + build_and_raise_construction_error(key, oops) + end + + def build_and_raise_construction_error(key, oops) + cerr = ConstructionError.new(key,oops) + cerr.set_backtrace(oops.backtrace) + raise cerr + end + + def get_class_for_name_with_module_delimeters(class_name) + class_name.split(/::/).inject(Object) do |mod,const_name| mod.const_get(const_name) end + end + + def extra_inputs_has(key) + if key.nil? or key.strip == '' + raise ArgumentError.new("Cannot lookup objects with nil keys") + end + @extra_inputs.keys.member?(key) or @extra_inputs.keys.member?(key.to_sym) + end + + def parse_namespace(str) + Namespace.new(str) + end + end + + class Namespace #:nodoc:# + def initialize(str) + # 'using_namespace Animal Reptile' + parts = str.split(/\s+/) + raise "Namespace definitions must begin with 'using_namespace'" unless parts[0] == 'using_namespace' + parts.shift + + if parts.length > 0 and parts[0] =~ /::/ + parts = parts[0].split(/::/) + end + + raise NamespaceError, "Namespace needs to indicate a module" if parts.empty? + + @module_nest = parts + end + + def build_classname(name) + [ @module_nest, Infl.camelize(name) ].flatten.join("::") + end + end + + class Lookup #:nodoc: + attr_reader :name + def initialize(obj_name) + @name = obj_name + end + end + + class MethodDef #:nodoc: + attr_accessor :name, :object, :method, :attach + + def initialize(opts) + @name, @object, @method, @attach = opts[:name], opts[:object], opts[:method], opts[:attach] + end + end + + class ObjectDef #:nodoc: + attr_accessor :name, :class_name, :library, :components + def initialize(opts) + name = opts[:name] + raise "Can't make an ObjectDef without a name" if name.nil? + + info = opts[:info] || {} + info = info.clone + + @components = {} + + # Object name + @name = name + + # Class name + @class_name = info.delete 'class' + @class_name ||= info.delete 'type' + @class_name ||= Infl.camelize(@name) + + # Auto Require + @auto_require = info.delete 'auto_require' + + # Library + @library = info.delete 'library' + @library ||= info.delete 'lib' + @library ||= Infl.underscore(@class_name) if @auto_require + + # Use Class Directly + @use_class_directly = info.delete 'use_class_directly' + + # Auto-compose + compose = info.delete 'compose' + if compose + case compose + when Array + auto_names = compose.map { |x| x.to_s } + when String + auto_names = compose.split(',').map { |x| x.to_s.strip } + when Symbol + auto_names = [ compose.to_s ] + else + raise "Cannot auto compose object #{@name}, bad 'compose' format: #{compose.inspect}" + end + end + auto_names ||= [] + auto_names.each do |cname| + @components[cname] = Lookup.new(cname) + end + + # Singleton status + if info['singleton'].nil? + @singleton = true + else + @singleton = info['singleton'] + end + info.delete 'singleton' + + # Remaining keys + info.each do |key,val| + @components[key.to_s] = Lookup.new(val.to_s) + end + + end + + def singleton? + @singleton + end + + def use_class_directly? + @use_class_directly == true + end + + end + + class ConstructionError < RuntimeError #:nodoc:# + def initialize(object_name, cause=nil) + object_name = object_name + cause = cause + m = "Failed to construct '#{object_name}'" + if cause + m << "\n ...caused by:\n >>> #{cause}" + end + super m + end + end + + class NamespaceError < RuntimeError #:nodoc:# + end + + module Infl #:nodoc:# + # Ganked this from Inflector: + def self.camelize(lower_case_and_underscored_word) + lower_case_and_underscored_word.to_s.gsub(/\/(.?)/) { "::" + $1.upcase }.gsub(/(^|_)(.)/) { $2.upcase } + end + # Ganked this from Inflector: + def self.underscore(camel_cased_word) + camel_cased_word.to_s.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z])/,'\1_\2').gsub(/([a-z\d])([A-Z])/,'\1_\2').downcase + end + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/lib/diy/factory.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/lib/diy/factory.rb new file mode 100644 index 0000000..d2566c5 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/lib/diy/factory.rb @@ -0,0 +1,36 @@ +module DIY #:nodoc:# + class FactoryDef #:nodoc: + attr_accessor :name, :target, :class_name, :library + + def initialize(opts) + @name, @target, @library, @auto_require = + opts[:name], opts[:target], opts[:library], opts[:auto_require] + + @class_name = Infl.camelize(@target) + @library ||= Infl.underscore(@class_name) if @auto_require + end + end + + class Context + def construct_factory(key) + factory_def = @defs[key] +# puts "requiring #{factory_def.library}" + require factory_def.library if factory_def.library + + big_c = get_class_for_name_with_module_delimeters(factory_def.class_name) + + FactoryFactory.new(big_c) + end + end + + class FactoryFactory + def initialize(clazz) + @class_to_create = clazz + end + + def create(*args) + @class_to_create.new(*args) + end + end +end + diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/sample_code/car.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/sample_code/car.rb new file mode 100644 index 0000000..9a6a8ed --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/sample_code/car.rb @@ -0,0 +1,7 @@ +class Car + attr_reader :engine, :chassis + def initialize(arg_hash) + @engine = arg_hash[:engine] + @chassis = arg_hash[:chassis] + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/sample_code/chassis.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/sample_code/chassis.rb new file mode 100644 index 0000000..b745b0b --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/sample_code/chassis.rb @@ -0,0 +1,5 @@ +class Chassis + def to_s + "Chassis" + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/sample_code/diy_example.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/sample_code/diy_example.rb new file mode 100644 index 0000000..88d5b7e --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/sample_code/diy_example.rb @@ -0,0 +1,26 @@ +require "rubygems" +require "diy" + +class Car + attr_reader :engine, :chassis + def initialize(arg_hash) + @engine = arg_hash[:engine] + @chassis = arg_hash[:chassis] + end +end + +class Chassis + def to_s + "Chassis" + end +end + +class Engine + def to_s + "Engine" + end +end + +context = DIY::Context.from_file("objects.yml") +car = context['car'] +puts "Car is made of: #{car.engine} and #{car.chassis}" diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/sample_code/engine.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/sample_code/engine.rb new file mode 100644 index 0000000..65c2dd5 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/sample_code/engine.rb @@ -0,0 +1,5 @@ +class Engine + def to_s + "Engine" + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/sample_code/objects.yml b/flex-bison/mark1/tools/ceedling/vendor/diy/sample_code/objects.yml new file mode 100644 index 0000000..6deb100 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/sample_code/objects.yml @@ -0,0 +1,10 @@ +--- +car: + compose: + - engine + - chassis + +engine: + +chassis: + diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/constructor.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/test/constructor.rb new file mode 100644 index 0000000..5fe8f3a --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/constructor.rb @@ -0,0 +1,119 @@ +CONSTRUCTOR_VERSION = '1.0.2' #:nodoc:# + +class Class #:nodoc:# + def constructor(*attrs, &block) + call_block = '' + if block_given? + @constructor_block = block + call_block = 'self.instance_eval(&self.class.constructor_block)' + end + # Look for embedded options in the listing: + opts = attrs.find { |a| a.kind_of?(Hash) and attrs.delete(a) } + do_acc = opts.nil? ? false : opts[:accessors] == true + require_args = opts.nil? ? true : opts[:strict] != false + super_args = opts.nil? ? nil : opts[:super] + + # Incorporate superclass's constructor keys, if our superclass + if superclass.constructor_keys + similar_keys = superclass.constructor_keys & attrs + raise "Base class already has keys #{similar_keys.inspect}" unless similar_keys.empty? + attrs = [attrs,superclass.constructor_keys].flatten + end + # Generate ivar assigner code lines + assigns = '' + attrs.each do |k| + assigns += "@#{k.to_s} = args[:#{k.to_s}]\n" + end + + # If accessors option is on, declare accessors for the attributes: + if do_acc + self.class_eval "attr_accessor " + attrs.map {|x| ":#{x.to_s}"}.join(',') + end + + # If user supplied super-constructor hints: + super_call = '' + if super_args + list = super_args.map do |a| + case a + when String + %|"#{a}"| + when Symbol + %|:#{a}| + end + end + super_call = %|super(#{list.join(',')})| + end + + # If strict is on, define the constructor argument validator method, + # and setup the initializer to invoke the validator method. + # Otherwise, insert lax code into the initializer. + validation_code = "return if args.nil?" + if require_args + self.class_eval do + def _validate_constructor_args(args) + # First, make sure we've got args of some kind + unless args and args.keys and args.keys.size > 0 + raise ConstructorArgumentError.new(self.class.constructor_keys) + end + # Scan for missing keys in the argument hash + a_keys = args.keys + missing = [] + self.class.constructor_keys.each do |ck| + unless a_keys.member?(ck) + missing << ck + end + a_keys.delete(ck) # Delete inbound keys as we address them + end + if missing.size > 0 || a_keys.size > 0 + raise ConstructorArgumentError.new(missing,a_keys) + end + end + end + # Setup the code to insert into the initializer: + validation_code = "_validate_constructor_args args " + end + + # Generate the initializer code + self.class_eval %{ + def initialize(args=nil) + #{super_call} + #{validation_code} + #{assigns} + setup if respond_to?(:setup) + #{call_block} + end + } + + # Remember our constructor keys + @_ctor_keys = attrs + end + + # Access the constructor keys for this class + def constructor_keys; @_ctor_keys ||=[]; end + + def constructor_block #:nodoc:# + @constructor_block + end + +end + +# Fancy validation exception, based on missing and extraneous keys. +class ConstructorArgumentError < RuntimeError #:nodoc:# + def initialize(missing,rejected=[]) + err_msg = '' + if missing.size > 0 + err_msg = "Missing constructor args [#{missing.join(',')}]" + end + if rejected.size > 0 + # Some inbound keys were not addressed earlier; this means they're unwanted + if err_msg + err_msg << "; " # Appending to earlier message about missing items + else + err_msg = '' + end + # Enumerate the rejected key names + err_msg << "Rejected constructor args [#{rejected.join(',')}]" + end + super err_msg + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/diy_test.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/test/diy_test.rb new file mode 100644 index 0000000..3540200 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/diy_test.rb @@ -0,0 +1,608 @@ +require File.dirname(__FILE__) + "/test_helper" +require 'diy' +require 'fileutils' +include FileUtils + +class DIYTest < Test::Unit::TestCase + + def setup + # Add load paths: + %w|gnu dog cat yak donkey goat horse fud non_singleton namespace functions|.each do |p| + libdir = path_to_test_file(p) + $: << libdir unless $:.member?(libdir) + end + DIY::Context.auto_require = true # Restore default + end + + + # + # TESTS + # + + def test_essential_use_case + load_context "dog/simple.yml" + + # Check object defs + check_dog_objects @diy + + # Tweak the load-path + $: << path_to_test_file("dog") + + # Get the objects, use reference comparison to check composition + presenter = @diy.get_object('dog_presenter') + assert_not_nil presenter, 'nil dog_presenter' + + model = @diy.get_object('dog_model') + assert_not_nil model, 'nil dog_model' + assert_same presenter.model, model, "Different model came from context than found in presenter" + + view = @diy.get_object('dog_view') + assert_not_nil view, 'nil dog_view' + assert_same presenter.view, view, "Different view came from context than found in presenter" + + resolver = @diy.get_object('file_resolver') + assert_not_nil resolver, 'nil file_resolver' + assert_same model.file_resolver, resolver, "File resolver in model is different than one in context" + + # Check repeat access: + assert_same model, @diy.get_object('dog_model'), "Second access of model yielded different result" + assert_same view, @diy.get_object('dog_view'), "Second access of view yielded different result" + assert_same presenter, @diy.get_object('dog_presenter'), "Second access of presenter got difrnt result" + end + + def test_classname_inside_a_module + load_hash 'thinger' => {'class' => "DiyTesting::Bar::Foo", 'lib' => 'foo'} + @diy.build_everything + assert_not_nil @diy['thinger'], "Should have got my thinger (which is hiding in a couple modules)" + end + + def test_classname_inside_a_module_loads_from_directories_named_after_the_underscored_module_names + load_hash 'thinger' => {'class' => "Foo::Bar::Qux"} + # expect it to be loaded from: foo/bar/qux.rb + @diy.build_everything + assert_not_nil @diy['thinger'], "Should have got my thinger (which is hiding in a couple modules)" + end + + def test_use_class_directly + load_hash 'thinger' => {'class' => "DiyTesting::Bar::Foo", 'lib' => 'foo', 'use_class_directly' => true} + @diy.build_everything + assert_equal DiyTesting::Bar::Foo, @diy['thinger'], "Should be the class 'object'" + end + + def test_classname_inside_a_module_derives_the_namespaced_classname_from_the_underscored_object_def_key + load_hash 'foo/bar/qux' => nil + @diy.build_everything + assert_not_nil @diy['foo/bar/qux'], "Should have got my qux (which is hiding in a couple modules)" + end + + def test_keys + load_context "dog/simple.yml" + assert_equal %w|dog_model dog_presenter dog_view file_resolver other_thing|, @diy.keys.sort + end + + def test_subcontext_keys_should_include_parent_context_keys + load_context 'yak/sub_sub_context_test.yml' + main_keys = %w|core_presenter core_model core_view data_source|.sort + assert_equal main_keys, @diy.keys.sort, "Wrong keys in main context" + @diy.within :fringe_context do |fcontext| + fringe_keys = [main_keys, %w|fringe_model fringe_view fringe_presenter|].flatten.sort + assert_equal fringe_keys, fcontext.keys.sort, "Wrong keys in fringe context" + fcontext.within :deep_context do |dcontext| + deep_keys = [fringe_keys, %w|krill giant_squid|].flatten.sort + assert_equal deep_keys, dcontext.keys.sort + end + end + end + + def test_constructor_no_hash + assert_raise RuntimeError do DIY::Context.new(nil) end + end + + def test_constructor_bad_extra_inputs + err = assert_raise RuntimeError do + DIY::Context.new({}, Object.new) + end + assert_match(/extra inputs/i, err.message) + end + + def test_from_yaml + text = File.read(path_to_test_file("dog/simple.yml")) + diy = DIY::Context.from_yaml(text) + check_dog_objects diy + end + + def test_from_yaml_extra_inputs + extra = { 'the_cat_lineage' => 'siamese', :some_meat => 'horse' } + diy = DIY::Context.from_yaml(File.read(path_to_test_file('cat/needs_input.yml')), extra) + cat = diy['cat'] + assert_equal 'siamese', cat.heritage + assert_equal 'horse', cat.food + end + + def test_from_file + diy = DIY::Context.from_file(path_to_test_file("dog/simple.yml")) + check_dog_objects diy + end + + def test_from_file_bad + assert_raise RuntimeError do + DIY::Context.from_file(nil) + end + assert_raise Errno::ENOENT do + DIY::Context.from_file("bad file name") + end + end + + def test_from_file_extra_inputs + extra = { 'the_cat_lineage' => 'siamese', :some_meat => 'horse' } + diy = DIY::Context.from_file(path_to_test_file('cat/needs_input.yml'), extra) + cat = diy['cat'] + assert_equal 'siamese', cat.heritage + assert_equal 'horse', cat.food + end + + def test_contains_object + load_context "dog/simple.yml" + assert @diy.contains_object('dog_presenter'), "Should be true for dog_presenter" + assert !@diy.contains_object('woops'), "Should return false for 'woops'" + err = assert_raise ArgumentError do + @diy.contains_object(nil) + end + end + + def test_contains_object_extra_inputs + extra = { 'the_cat_lineage' => 'siamese', :some_meat => 'horse' } + main = YAML.load(File.read(path_to_test_file('cat/needs_input.yml'))) + diy = DIY::Context.new(main, extra) + + assert diy.contains_object('cat') + assert diy.contains_object('the_cat_lineage') + assert diy.contains_object('some_meat') + end + + def test_get_object + load_context "dog/simple.yml" + assert_not_nil @diy.get_object('file_resolver'), "nil resolver?" + assert_raise ArgumentError do + @diy.get_object(nil) + end + assert_raise DIY::ConstructionError do + @diy.get_object("no such object") + end + end + + def test_hash_style_access + load_context "dog/simple.yml" + assert_not_nil @diy['file_resolver'], "nil resolver?" + assert_raise ArgumentError do + @diy[nil] + end + assert_raise DIY::ConstructionError do + @diy["no such object"] + end + end + + def test_get_object_construction_error + load_context "broken_construction.yml" + err = assert_raise DIY::ConstructionError do + @diy.get_object 'dog_presenter' + end + assert_match(/dog_presenter/, err.message) + end + + def test_context_with_extra_inputs + extra = { 'the_cat_lineage' => 'siamese', :some_meat => 'horse' } + main = YAML.load(File.read(path_to_test_file('cat/needs_input.yml'))) + diy = DIY::Context.new(main, extra) + cat = diy['cat'] + assert_equal 'siamese', cat.heritage + assert_equal 'horse', cat.food + end + + def test_conflicting_extra_inputs + extra = { 'the_cat_lineage' => 'siamese', :some_meat => 'horse' } + main = YAML.load(File.read(path_to_test_file('cat/extra_conflict.yml'))) + + DIY::Context.new(main,extra) + flunk "Should have raised err" + rescue Exception => err + assert_match(/conflict/i, err.message) + end + + def test_sub_context + load_context 'yak/my_objects.yml' + + core_model = @diy['core_model'] + assert_not_nil core_model, "no core model in main context?" + + fmodel1 = nil + fview1 = nil + @diy.within('fringe_context') do |fc| + assert_not_nil fc["fringe_presenter"], "no fringe presenter" + fmodel1 = fc["fringe_model"] + fmodel1a = fc["fringe_model"] + assert_same fmodel1, fmodel1a, "Second fring model in fringe_context came out different" + assert_not_nil fmodel1, "no fringe_model" + fview1 = fc["fringe_view"] + assert_not_nil fview1, "no fringe_view" + assert_same core_model, fmodel1.connected + end + + fmodel2 = nil + fview2 = nil + @diy.within('fringe_context') do |fc| + assert_not_nil fc["fringe_presenter"], "2: no fringe presenter" + fmodel2 = fc["fringe_model"] + fmodel2a = fc["fringe_model"] + assert_same fmodel2, fmodel2a, "Second fringe model in fringe_context came out different" + assert_not_nil fmodel2, "2: no fringe_model" + fview2 = fc["fringe_view"] + assert_not_nil fview2, "2: no fringe_view" + assert_same core_model, fmodel2.connected + + assert fmodel1.object_id != fmodel2.object_id, "fringe models 1 and 2 are same!" + assert fview1.object_id != fview2.object_id, "fringe views 1 and 2 are same!" + end + end + + def test_sub_sub_context + load_context 'yak/sub_sub_context_test.yml' + + core_model = @diy['core_model'] + assert_not_nil core_model, "no core model in main context?" + + fmodel1 = nil + fview1 = nil + @diy.within('fringe_context') do |fc| + assert_not_nil fc["fringe_presenter"], "no fringe presenter" + fmodel1 = fc["fringe_model"] + fmodel1a = fc["fringe_model"] + assert_same fmodel1, fmodel1a, "Second fring model in fringe_context came out different" + assert_not_nil fmodel1, "no fringe_model" + fview1 = fc["fringe_view"] + assert_not_nil fview1, "no fringe_view" + assert_same core_model, fmodel1.connected + + fc.within :deep_context do |dc| + krill = dc['krill'] + assert_not_nil krill, "nil krill" + assert_same krill, dc['krill'], "krill was different second time" + giant_squid = dc['giant_squid'] + assert_same fview1, giant_squid.fringe_view, "wrong view in squid" + assert_same core_model, giant_squid.core_model, "wrong model in squid" + assert_same krill, giant_squid.krill, "wrong krill in squid" + end + end + + end + + def test_build_everything + # Singletons in the goat context will generate test output in their constructors. + # We just gotta tell em where: + ofile = path_to_test_file('goat/output.tmp') + $goat_test_output_file = ofile + + # Reusable setup for this test + prep_output = proc do + remove ofile if File.exist?(ofile) + end + + # Reusable assertion set and cleanup + examine_output = proc do + # Examine output file for expected construction + assert File.exist?(ofile), "no goat output created" + lines = File.readlines(ofile).map { |x| x.strip } + %w|can paper shirt goat|.each do |object| + assert lines.member?("#{object} built"), "Didn't see constructor output for #{object}" + end + assert_equal 4, lines.size, "wrong number of entries in output file" + + # Make sure the subcontext was not built + assert !lines.member?("plane built"), "plane should not have been built -- it's in the subcontext" + assert !lines.member?("wings built"), "wings should not have been built -- it's in the subcontext" + + # Check the objects in the context + %w|can paper shirt goat|.each do |object| + assert_same @diy[object], @diy[object], "Multiple accesses on #{object} yielded different refs" + end + + # Try the subcontext + @diy.within('the_sub_context') do |tsc| + %w|plane wings|.each do |object| + assert_same tsc[object], tsc[object], "Multiple accesses on #{object} (in subcontext) yielded different refs" + end + end + # cleanup + remove ofile if File.exist?(ofile) + end + + # Test all three methods + [:build_everything, :build_all, :preinstantiate_singletons].each do |method_name| + prep_output.call + load_context 'goat/objects.yml' + # go + @diy.send method_name + examine_output.call + end + ensure + # cleanup + remove ofile if File.exist?(ofile) + end + + # See that the current object factory context can be referenced within the yaml + def test_this_context + load_context 'horse/objects.yml' + + assert_same @diy, @diy['this_context'], "basic self-reference failed" + assert_same @diy, @diy['holder_thing'].thing_held, "composition self-reference failed" + end + + def test_this_context_works_for_subcontexts + load_context 'horse/objects.yml' + + @diy.within('repeater') do |ctx| + assert_same ctx, ctx['this_context'], "self-ref inside a subcontext doesn't work" + end + end + + def test_multiple_classes_in_one_file + load_context 'fud/objects.yml' + + toy = @diy['toy'] + widget = @diy['widget'] + thing = @diy['thing_ama_jack'] + trinket = @diy['trinket'] + + assert_same widget, toy.widget, "wrong widget in toy" + assert_same trinket, toy.trinket, "wrong trinket in toy" + assert_same thing, trinket.thing_ama_jack, "wrong thing_ama_jack in trinket" + end + + def test_objects_can_be_set_in_a_context_and_diy_will_not_attempt_to_build_it_as_a_dependency + load_context 'gnu/objects.yml' + + injected = 'boom' + @diy[:injected] = injected + thinger = @diy[:thinger] + assert_not_nil thinger + assert_same injected, thinger.injected + assert_same injected, @diy[:injected] + + inner_injected = 'slam' + @diy.within :inny do |sub| + sub.set_object :inner_injected, inner_injected + inner_thinger = sub[:inner_thinger] + assert_not_nil inner_thinger + assert_same inner_injected, inner_thinger.injected + assert_same inner_injected, sub[:inner_injected] + end + end + + def test_should_not_allow_setting_of_an_object_which_has_already_been_loaded + load_context 'gnu/objects.yml' + + injected = 'boom' + @diy[:injected] = injected + err = assert_raise RuntimeError do + @diy[:injected] = injected + end + assert_match(/object 'injected' already exists/i, err.message) + assert_same injected, @diy[:injected] + + thinger = @diy[:thinger] + err = assert_raise RuntimeError do + @diy[:thinger] = 'sdf' + end + assert_match(/object 'thinger' already exists/i, err.message) + assert_same thinger, @diy[:thinger] + end + + def test_should_be_able_to_turn_off_auto_require_for_all_objects + DIY::Context.auto_require = false + load_context 'horse/objects.yml' + + exception = assert_raise(DIY::ConstructionError) { @diy['holder_thing'] } + assert_match(/uninitialized constant/, exception.message) + end + + def test_should_cause_non_singletons_to_be_rebuilt_every_time_they_are_accessed + load_context 'non_singleton/objects.yml' + + air = @diy['air'] + assert_not_nil air, "No air" + assert_same air, @diy['air'], "Air should be a singleton" + + yard = @diy['yard'] + assert_not_nil yard, "No yard" + assert_same yard, @diy['yard'], "yard should be a singleton" + + pig = @diy['pig'] + assert_not_nil pig, "No pig" + assert_same pig, @diy['pig'], "Pig should be a singleton" + + thread_spinner1 = @diy['thread_spinner'] + assert_not_nil thread_spinner1, "Couldn't get thread spinner" + thread_spinner2 = @diy['thread_spinner'] + assert_not_nil thread_spinner2, "Couldn't get second thread spinner" + assert thread_spinner1.object_id != thread_spinner2.object_id, "Thread spinners should be different instances" + thread_spinner3 = pig.thread_spinner + assert_not_nil thread_spinner3, "Didn't get a spinner from the pig" + assert thread_spinner2.object_id != thread_spinner3.object_id, "Thread spinner from pig should be different instance than the others" + assert thread_spinner1.object_id != thread_spinner3.object_id, "Thread spinner from pig should be different instance than the others" + + assert_same air, thread_spinner1.air, "spinner 1 air should be singleton reference" + assert_same air, thread_spinner2.air, "spinner 2 air should be singleton reference" + assert_same air, thread_spinner3.air, "spinner 3 air should be singleton reference" + end + + def test_should_handle_nonsingletons_in_sub_contexts + load_context 'non_singleton/objects.yml' + + yard = @diy['yard'] + assert_not_nil yard, "No yard" + assert_same yard, @diy['yard'], "yard should be a singleton" + + thread_spinner1 = @diy['thread_spinner'] + assert_not_nil thread_spinner1, "Couldn't get thread spinner" + + air = @diy['air'] + assert_not_nil air, "No air" + assert_same air, @diy['air'], "Air should be a singleton" + + @diy.within :inner_sanctum do |sanct| + tick1 = sanct['tick'] + assert_not_nil tick1, "Couldn't get tick1 from inner sanctum" + tick2 = sanct['tick'] + assert_not_nil tick2, "Couldn't get tick2 from inner sanctum" + assert tick1.object_id != tick2.object_id, "Tick should not be a singleton" + + cat = sanct['fat_cat'] + assert_not_nil cat, "Couldn't get cat from sanctum" + assert_same cat, sanct['fat_cat'], "Cat SHOULD be singleton" + + tick3 = cat.tick + assert_not_nil tick3, "Couldn't get tick from cat" + assert tick1.object_id != tick3.object_id, "tick from cat matched an earlier tick; should not be so" + + assert_same yard, cat.yard, "Cat's yard should be same as other yard" + assert_not_nil cat.thread_spinner, "No thread spinner in cat?" + + assert_same air, cat.thread_spinner.air, "spinner 1 air should be singleton reference" + assert thread_spinner1.object_id != cat.thread_spinner.object_id, "cat's thread spinner matched the other spinner; should not be so" + end + end + + def test_should_provide_syntax_for_using_namespace + # This test exercises single and triple-level namespaces for nested + # modules, and their interaction with other namespaced-objects. + load_context "namespace/objects.yml" + + %w{road sky cat bird lizard turtle}.each do |obj| + assert @diy.contains_object(obj), "Context had no object '#{obj}'" + end + + road = @diy['road'] + sky = @diy['sky'] + cat = @diy['cat'] + bird = @diy['bird'] + lizard = @diy['lizard'] + turtle = @diy['turtle'] + + assert_same road, cat.road, "Cat has wrong Road" + assert_same sky, bird.sky, "Bird has wrong Sky" + assert_same bird, lizard.bird, "Lizard has wrong Bird" + end + + def test_should_combine_a_given_class_name_with_the_namespace + load_context "namespace/class_name_combine.yml" + assert_not_nil @diy['garfield'], "No garfield" + assert_kind_of Animal::Cat, @diy['garfield'], "Garfield wrong" + end + + def test_should_let_you_use_namespaces_in_subcontexts + load_context "namespace/subcontext.yml" + @diy.build_everything + %w{road sky cat turtle}.each do |obj| + assert @diy.contains_object(obj), "Main context had no object '#{obj}'" + end + sky = @diy['sky'] + + @diy.within("aviary") do |subc| + assert subc.contains_object("bird"), "Sub context didn't have 'bird'" + assert subc.contains_object("lizard"), "Sub context didn't have 'lizard'" + bird = subc['bird'] + lizard = subc['lizard'] + assert_same sky, bird.sky, "Bird has wrong Sky" + assert_same bird, lizard.bird, "Lizard has wrong Bird" + end + end + + def test_should_raise_for_namespace_w_no_modules_named + ex = assert_raises DIY::NamespaceError do + load_context "namespace/no_module_specified.yml" + end + assert_equal "Namespace needs to indicate a module", ex.message + end + + def test_should_raise_for_namespace_whose_modules_dont_exist + load_context "namespace/bad_module_specified.yml" + ex = assert_raises DIY::ConstructionError do + @diy['bird'] + end + assert_match(/failed to construct/i, ex.message) + assert_match(/no such file to load -- fuzzy_creature\/bird/, ex.message) + end + + def test_should_be_able_define_and_access_bounded_methods + load_context "functions/objects.yml" + @diy.build_everything + build_thing = @diy['build_thing'] + + assert_not_nil build_thing, "should not be nil" + assert_kind_of(Method, build_thing) + assert_equal(build_thing, @diy['build_thing']) + end + + def test_bounded_method_can_be_used + load_context "functions/objects.yml" + @diy.build_everything + build_thing = @diy['build_thing'] + + thing = build_thing["the name", "flying"] + + assert_equal("the name", thing.name) + assert_equal("flying", thing.ability) + end + + def test_building_bounded_method_uses_object_in_diy_context_correctly + load_context "functions/objects.yml" + @diy.build_everything + assert_equal(@diy['build_thing'], @diy['thing_builder'].method(:build)) + + load_context "functions/nonsingleton_objects.yml" + @diy.build_everything + assert_not_equal(@diy['build_thing'], @diy['thing_builder'].method(:build)) + end + + def test_composing_bounded_methods_into_other_objects + load_context "functions/objects.yml" + @diy.build_everything + assert_equal(@diy['build_thing'], @diy['things_builder'].build_thing) + end + + def test_raises_construction_error_if_invalid_method_specified + load_context "functions/invalid_method.yml" + assert_raises DIY::ConstructionError do + @diy.build_everything + end + end + + def test_can_optionally_attach_method_to_other_objects_in_context + load_context "functions/objects.yml" + @diy.build_everything + + thing = @diy['attached_things_builder'].build_thing("the name", "flying") + assert_kind_of(Thing, thing) + assert_equal("the name", thing.name) + assert_equal("flying", thing.ability) + + ["attached_things_builder", "things_builder"].each do |key| + thing = @diy[key].build_default_thing + assert_kind_of(Thing, thing) + assert_equal("Thing", thing.name) + assert_equal("nothing", thing.ability) + end + end + + # + # HELPERS + # + def check_dog_objects(context) + assert_not_nil context, "nil context" + names = %w|dog_presenter dog_model dog_view file_resolver| + names.each do |n| + assert context.contains_object(n), "Context had no object '#{n}'" + end + end + +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/factory_test.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/test/factory_test.rb new file mode 100644 index 0000000..ed02f01 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/factory_test.rb @@ -0,0 +1,79 @@ +require File.dirname(__FILE__) + "/test_helper" +require 'diy' +require 'fileutils' +include FileUtils + +class FactoryTest < Test::Unit::TestCase + + def setup + # Add load paths: + %w|factory|.each do |p| + libdir = path_to_test_file(p) + $: << libdir unless $:.member?(libdir) + end + DIY::Context.auto_require = true # Restore default + end + + + # + # TESTS + # + + def test_creates_factory + load_context "factory/factory.yml" + + cat_factory = @diy.get_object(:cat_factory) + assert_not_nil cat_factory + + cat = cat_factory.create('a', 'b') + + assert cat.is_a?(Kitten) + assert_equal "meow", cat.meow + assert_equal 'a', cat.a + assert_equal 'b', cat.b + end + + def test_creates_factory_with_autorequire + load_context "factory/factory.yml" + + dog_factory = @diy.get_object(:dog_factory) + assert_not_nil dog_factory + + dog = dog_factory.create + + assert dog.is_a?(Dog) + assert_equal "woof", dog.woof + end + + def test_creates_factory_with_subcontext + load_context "factory/factory.yml" + + @diy.within :inny do |context| + bull_factory = context.get_object(:bull_factory) + beef = bull_factory.create + end + end + + def test_creates_factory_with_subcontext_and_namespace + load_context "factory/factory.yml" + + @diy.within :congress do |context| + politician = context.get_object(:politician) + pork = politician.create + assert pork.is_a?(Farm::Pork) + assert_equal "money!", pork.oink + end + end + + def test_creates_factory_with_namespace + load_context "factory/factory.yml" + + llama_factory = @diy.get_object(:llama_factory) + assert_not_nil llama_factory + + llama = llama_factory.create + + assert llama.is_a?(Farm::Llama) + assert_equal "?", llama.make_llama_noise + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/broken_construction.yml b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/broken_construction.yml new file mode 100644 index 0000000..1dacb01 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/broken_construction.yml @@ -0,0 +1,7 @@ + +dog_presenter: + model: dog_model + view: dog_view + +dog_model: +# VIEW IS MISSING, PRESENTER SHOULD CRASH diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/cat/cat.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/cat/cat.rb new file mode 100644 index 0000000..2d17514 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/cat/cat.rb @@ -0,0 +1,3 @@ +class Cat + constructor :heritage, :food, :strict => true, :accessors => true +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/cat/extra_conflict.yml b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/cat/extra_conflict.yml new file mode 100644 index 0000000..9c6b375 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/cat/extra_conflict.yml @@ -0,0 +1,5 @@ +the_cat_lineage: + +cat: + heritage: the_cat_lineage + food: some_meat diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/cat/heritage.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/cat/heritage.rb new file mode 100644 index 0000000..617d47a --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/cat/heritage.rb @@ -0,0 +1,2 @@ +class Heritage +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/cat/needs_input.yml b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/cat/needs_input.yml new file mode 100644 index 0000000..9f622f2 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/cat/needs_input.yml @@ -0,0 +1,3 @@ +cat: + heritage: the_cat_lineage + food: some_meat diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/cat/the_cat_lineage.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/cat/the_cat_lineage.rb new file mode 100644 index 0000000..b0f4308 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/cat/the_cat_lineage.rb @@ -0,0 +1 @@ +class TheCatLineage; end diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/dog/dog_model.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/dog/dog_model.rb new file mode 100644 index 0000000..51e7df0 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/dog/dog_model.rb @@ -0,0 +1,3 @@ +class DogModel + constructor :file_resolver, :other_thing, :strict => true, :accessors => true +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/dog/dog_presenter.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/dog/dog_presenter.rb new file mode 100644 index 0000000..786977d --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/dog/dog_presenter.rb @@ -0,0 +1,3 @@ +class DogPresenter + constructor :model, :view, :strict => true, :accessors => true +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/dog/dog_view.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/dog/dog_view.rb new file mode 100644 index 0000000..aae86bc --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/dog/dog_view.rb @@ -0,0 +1,2 @@ +class DogView +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/dog/file_resolver.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/dog/file_resolver.rb new file mode 100644 index 0000000..09cf18a --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/dog/file_resolver.rb @@ -0,0 +1,2 @@ +class FileResolver +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/dog/other_thing.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/dog/other_thing.rb new file mode 100644 index 0000000..48e6a95 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/dog/other_thing.rb @@ -0,0 +1,2 @@ +class OtherThing +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/dog/simple.yml b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/dog/simple.yml new file mode 100644 index 0000000..7737236 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/dog/simple.yml @@ -0,0 +1,11 @@ +dog_presenter: + model: dog_model + view: dog_view + +file_resolver: +other_thing: + +dog_model: + compose: file_resolver, other_thing + +dog_view: diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/donkey/foo.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/donkey/foo.rb new file mode 100644 index 0000000..5182cf3 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/donkey/foo.rb @@ -0,0 +1,8 @@ + +module DiyTesting + module Bar + class Foo + end + end +end + diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/donkey/foo/bar/qux.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/donkey/foo/bar/qux.rb new file mode 100644 index 0000000..bb05a02 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/donkey/foo/bar/qux.rb @@ -0,0 +1,7 @@ + +module Foo + module Bar + class Qux + end + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/factory/beef.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/factory/beef.rb new file mode 100644 index 0000000..2cd31a0 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/factory/beef.rb @@ -0,0 +1,5 @@ +class Beef + def cook + return "rare" + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/factory/dog.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/factory/dog.rb new file mode 100644 index 0000000..06b9daf --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/factory/dog.rb @@ -0,0 +1,6 @@ +class Dog + def woof + "woof" + end +end + diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/factory/factory.yml b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/factory/factory.yml new file mode 100644 index 0000000..8264d37 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/factory/factory.yml @@ -0,0 +1,19 @@ +cat_factory: + builds: kitten + library: kitten + +dog_factory: + builds: dog + +using_namespace Farm: + llama_factory: + builds: llama + ++inny: + bull_factory: + builds: beef + ++congress: + using_namespace Farm: + politician: + builds: pork diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/factory/farm/llama.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/factory/farm/llama.rb new file mode 100644 index 0000000..40e9fa2 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/factory/farm/llama.rb @@ -0,0 +1,7 @@ +module Farm + class Llama + def make_llama_noise + "?" + end + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/factory/farm/pork.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/factory/farm/pork.rb new file mode 100644 index 0000000..a5aa4e5 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/factory/farm/pork.rb @@ -0,0 +1,7 @@ +module Farm + class Pork + def oink + "money!" + end + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/factory/kitten.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/factory/kitten.rb new file mode 100644 index 0000000..f27a3ef --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/factory/kitten.rb @@ -0,0 +1,13 @@ +class Kitten + attr_accessor :a,:b + + def initialize(a, b) + @a = a + @b = b + end + + def meow + "meow" + end +end + diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/fud/objects.yml b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/fud/objects.yml new file mode 100644 index 0000000..1a152b9 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/fud/objects.yml @@ -0,0 +1,13 @@ +widget: + lib: toy + +trinket: + lib: toy + compose: thing_ama_jack + +thing_ama_jack: + lib: toy + +toy: + lib: toy + compose: widget, trinket diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/fud/toy.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/fud/toy.rb new file mode 100644 index 0000000..937b71d --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/fud/toy.rb @@ -0,0 +1,14 @@ + +class Toy + constructor :widget, :trinket, :accessors => true, :strict => true +end + +class Widget +end + +class ThingAmaJack +end + +class Trinket + constructor :thing_ama_jack, :accessors => true, :strict => true +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/functions/attached_things_builder.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/functions/attached_things_builder.rb new file mode 100644 index 0000000..f67888a --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/functions/attached_things_builder.rb @@ -0,0 +1,2 @@ +class AttachedThingsBuilder +end \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/functions/invalid_method.yml b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/functions/invalid_method.yml new file mode 100644 index 0000000..96690c3 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/functions/invalid_method.yml @@ -0,0 +1,5 @@ +thing_builder: + +method build_thing: + object: thing_builder + method: no_exist \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/functions/method_extractor.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/functions/method_extractor.rb new file mode 100644 index 0000000..55daf46 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/functions/method_extractor.rb @@ -0,0 +1,3 @@ +class MethodExtractor + +end \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/functions/nonsingleton_objects.yml b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/functions/nonsingleton_objects.yml new file mode 100644 index 0000000..39b6fd6 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/functions/nonsingleton_objects.yml @@ -0,0 +1,6 @@ +thing_builder: + singleton: false + +method build_thing: + object: thing_builder + method: build \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/functions/objects.yml b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/functions/objects.yml new file mode 100644 index 0000000..4d0a05a --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/functions/objects.yml @@ -0,0 +1,22 @@ +thing_builder: + +method_extractor: + +attached_things_builder: + +method build_thing: + object: thing_builder + method: build + attach: + - attached_things_builder + +method build_default_thing: + object: thing_builder + method: build_default + attach: + - attached_things_builder + - things_builder + +things_builder: + compose: + - build_thing \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/functions/thing.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/functions/thing.rb new file mode 100644 index 0000000..4bc652d --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/functions/thing.rb @@ -0,0 +1,3 @@ +class Thing + constructor :name, :ability, :accessors => true +end \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/functions/thing_builder.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/functions/thing_builder.rb new file mode 100644 index 0000000..288bab4 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/functions/thing_builder.rb @@ -0,0 +1,25 @@ +require 'thing' + +class ThingBuilder + @@builder_count = 0 + + def self.reset_builder_count + @@builder_count = 0 + end + + def self.builder_count + @@builder_count + end + + def initialize + @@builder_count += 1 + end + + def build(name, ability) + Thing.new(:name => name, :ability => ability) + end + + def build_default + Thing.new(:name => "Thing", :ability => "nothing") + end +end \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/functions/things_builder.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/functions/things_builder.rb new file mode 100644 index 0000000..198c85a --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/functions/things_builder.rb @@ -0,0 +1,3 @@ +class ThingsBuilder + constructor :build_thing, :accessors => true +end \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/gnu/objects.yml b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/gnu/objects.yml new file mode 100644 index 0000000..39581ef --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/gnu/objects.yml @@ -0,0 +1,14 @@ + +injected: + +thinger: + compose: injected + ++inny: + inner_injected: + + inner_thinger: + injected: inner_injected + lib: thinger + class: Thinger + diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/gnu/thinger.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/gnu/thinger.rb new file mode 100644 index 0000000..1d332f6 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/gnu/thinger.rb @@ -0,0 +1,7 @@ + + +class Thinger + constructor :injected + attr_reader :injected +end + diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/goat/base.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/goat/base.rb new file mode 100644 index 0000000..a4f5d0e --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/goat/base.rb @@ -0,0 +1,8 @@ +class Base + def test_output(name) + # See diy_context_test.rb + File.open($goat_test_output_file, "a") do |f| + f.puts "#{name} built" + end + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/goat/can.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/goat/can.rb new file mode 100644 index 0000000..0bd1eeb --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/goat/can.rb @@ -0,0 +1,6 @@ +require 'base' +class Can < Base + def initialize + test_output "can" + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/goat/goat.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/goat/goat.rb new file mode 100644 index 0000000..ad084d3 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/goat/goat.rb @@ -0,0 +1,6 @@ +require 'base' +class Goat < Base + def initialize + test_output "goat" + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/goat/objects.yml b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/goat/objects.yml new file mode 100644 index 0000000..a31123e --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/goat/objects.yml @@ -0,0 +1,12 @@ +can: + +paper: + +shirt: + +goat: + ++the_sub_context: + plane: + compose: wings + wings: diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/goat/paper.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/goat/paper.rb new file mode 100644 index 0000000..2068e41 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/goat/paper.rb @@ -0,0 +1,6 @@ +require 'base' +class Paper < Base + def initialize + test_output "paper" + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/goat/plane.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/goat/plane.rb new file mode 100644 index 0000000..712e904 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/goat/plane.rb @@ -0,0 +1,7 @@ +require 'base' +class Plane < Base + constructor :wings, :strict => true + def setup + test_output "plane" + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/goat/shirt.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/goat/shirt.rb new file mode 100644 index 0000000..7b28bec --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/goat/shirt.rb @@ -0,0 +1,6 @@ +require 'base' +class Shirt < Base + def initialize + test_output "shirt" + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/goat/wings.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/goat/wings.rb new file mode 100644 index 0000000..dc0e70c --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/goat/wings.rb @@ -0,0 +1,8 @@ +require 'base' +class Wings < Base + def initialize + test_output "wings" + end + def stay_on; end + def fall_off; end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/horse/holder_thing.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/horse/holder_thing.rb new file mode 100644 index 0000000..5480216 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/horse/holder_thing.rb @@ -0,0 +1,3 @@ +class HolderThing + constructor :thing_held, :strict => true, :accessors => true +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/horse/objects.yml b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/horse/objects.yml new file mode 100644 index 0000000..54a0e9c --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/horse/objects.yml @@ -0,0 +1,7 @@ +holder_thing: + thing_held: this_context + ++repeater: + other_thing: + class: HolderThing + thing_held: this_context diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/namespace/animal/bird.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/namespace/animal/bird.rb new file mode 100644 index 0000000..27be474 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/namespace/animal/bird.rb @@ -0,0 +1,5 @@ +module Animal + class Bird + constructor :sky, :accessors => true + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/namespace/animal/cat.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/namespace/animal/cat.rb new file mode 100644 index 0000000..632257e --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/namespace/animal/cat.rb @@ -0,0 +1,5 @@ +module Animal + class Cat + constructor :road, :accessors => true + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/namespace/animal/reptile/hardshell/turtle.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/namespace/animal/reptile/hardshell/turtle.rb new file mode 100644 index 0000000..fd05feb --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/namespace/animal/reptile/hardshell/turtle.rb @@ -0,0 +1,8 @@ +module Animal + module Reptile + module Hardshell + class Turtle + end + end + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/namespace/animal/reptile/lizard.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/namespace/animal/reptile/lizard.rb new file mode 100644 index 0000000..d2c6c96 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/namespace/animal/reptile/lizard.rb @@ -0,0 +1,7 @@ +module Animal + module Reptile + class Lizard + constructor :bird, :accessors => true + end + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/namespace/bad_module_specified.yml b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/namespace/bad_module_specified.yml new file mode 100644 index 0000000..7befcac --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/namespace/bad_module_specified.yml @@ -0,0 +1,8 @@ + +sky: + +using_namespace FuzzyCreature: + + bird: + compose: sky + diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/namespace/class_name_combine.yml b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/namespace/class_name_combine.yml new file mode 100644 index 0000000..77f66fc --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/namespace/class_name_combine.yml @@ -0,0 +1,8 @@ +road: + +using_namespace Animal: + + garfield: + class: Cat + compose: road + diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/namespace/hello.txt b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/namespace/hello.txt new file mode 100644 index 0000000..f6bfc02 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/namespace/hello.txt @@ -0,0 +1 @@ +this is the info \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/namespace/no_module_specified.yml b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/namespace/no_module_specified.yml new file mode 100644 index 0000000..065e83f --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/namespace/no_module_specified.yml @@ -0,0 +1,8 @@ + +sky: + +using_namespace: + + bird: + compose: sky + diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/namespace/objects.yml b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/namespace/objects.yml new file mode 100644 index 0000000..55511be --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/namespace/objects.yml @@ -0,0 +1,21 @@ +road: + +sky: + +using_namespace Animal: + + cat: + compose: road + + bird: + compose: sky + +using_namespace Animal Reptile: + + lizard: + compose: bird + +using_namespace Animal::Reptile::Hardshell: + + turtle: + diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/namespace/road.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/namespace/road.rb new file mode 100644 index 0000000..bb050fb --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/namespace/road.rb @@ -0,0 +1,2 @@ +class Road +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/namespace/sky.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/namespace/sky.rb new file mode 100644 index 0000000..fc1e2bb --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/namespace/sky.rb @@ -0,0 +1,2 @@ +class Sky +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/namespace/subcontext.yml b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/namespace/subcontext.yml new file mode 100644 index 0000000..da63311 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/namespace/subcontext.yml @@ -0,0 +1,22 @@ +road: + +sky: + +using_namespace Animal: + + cat: + compose: road + + ++aviary: + using_namespace Animal: + bird: + compose: sky + + using_namespace Animal Reptile: + lizard: + compose: bird + +using_namespace Animal::Reptile::Hardshell: + turtle: + diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/non_singleton/air.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/non_singleton/air.rb new file mode 100644 index 0000000..63414af --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/non_singleton/air.rb @@ -0,0 +1,2 @@ +class Air +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/non_singleton/fat_cat.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/non_singleton/fat_cat.rb new file mode 100644 index 0000000..54c195c --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/non_singleton/fat_cat.rb @@ -0,0 +1,3 @@ +class FatCat + constructor :thread_spinner, :tick, :yard, :accessors => true +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/non_singleton/objects.yml b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/non_singleton/objects.yml new file mode 100644 index 0000000..77b4505 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/non_singleton/objects.yml @@ -0,0 +1,19 @@ +air: + +thread_spinner: + compose: air + singleton: false + +yard: + +pig: + compose: thread_spinner, yard + ++inner_sanctum: + tick: + compose: thread_spinner + singleton: false + + fat_cat: + compose: thread_spinner, tick, yard + diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/non_singleton/pig.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/non_singleton/pig.rb new file mode 100644 index 0000000..9d75013 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/non_singleton/pig.rb @@ -0,0 +1,3 @@ +class Pig + constructor :thread_spinner, :yard, :accessors => true +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/non_singleton/thread_spinner.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/non_singleton/thread_spinner.rb new file mode 100644 index 0000000..384cd11 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/non_singleton/thread_spinner.rb @@ -0,0 +1,3 @@ +class ThreadSpinner + constructor :air, :accessors => true +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/non_singleton/tick.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/non_singleton/tick.rb new file mode 100644 index 0000000..e243c16 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/non_singleton/tick.rb @@ -0,0 +1,3 @@ +class Tick + constructor :thread_spinner, :accessors => true +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/non_singleton/yard.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/non_singleton/yard.rb new file mode 100644 index 0000000..43936a7 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/non_singleton/yard.rb @@ -0,0 +1,2 @@ +class Yard +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/yak/core_model.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/yak/core_model.rb new file mode 100644 index 0000000..539b56b --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/yak/core_model.rb @@ -0,0 +1,3 @@ +class CoreModel + constructor :data_source, :strict => true +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/yak/core_presenter.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/yak/core_presenter.rb new file mode 100644 index 0000000..6caca4d --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/yak/core_presenter.rb @@ -0,0 +1,3 @@ +class CorePresenter + constructor :model, :view, :strict => true +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/yak/core_view.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/yak/core_view.rb new file mode 100644 index 0000000..7e606da --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/yak/core_view.rb @@ -0,0 +1 @@ +class CoreView; end diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/yak/data_source.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/yak/data_source.rb new file mode 100644 index 0000000..772d3f4 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/yak/data_source.rb @@ -0,0 +1 @@ +class DataSource; end diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/yak/fringe_model.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/yak/fringe_model.rb new file mode 100644 index 0000000..255a22e --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/yak/fringe_model.rb @@ -0,0 +1,3 @@ +class FringeModel + constructor :connected, :accessors => true, :strict => true +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/yak/fringe_presenter.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/yak/fringe_presenter.rb new file mode 100644 index 0000000..e404435 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/yak/fringe_presenter.rb @@ -0,0 +1,3 @@ +class FringePresenter + constructor :fringe_model, :fringe_view, :strict => true +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/yak/fringe_view.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/yak/fringe_view.rb new file mode 100644 index 0000000..d406d3d --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/yak/fringe_view.rb @@ -0,0 +1 @@ +class FringeView; end diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/yak/giant_squid.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/yak/giant_squid.rb new file mode 100644 index 0000000..2ddc2cc --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/yak/giant_squid.rb @@ -0,0 +1,3 @@ +class GiantSquid + constructor :fringe_view, :core_model, :krill, :accessors => true +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/yak/krill.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/yak/krill.rb new file mode 100644 index 0000000..5e79f91 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/yak/krill.rb @@ -0,0 +1,2 @@ +class Krill +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/yak/my_objects.yml b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/yak/my_objects.yml new file mode 100644 index 0000000..ddc8264 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/yak/my_objects.yml @@ -0,0 +1,21 @@ + +core_model: + compose: data_source + +core_view: + +core_presenter: + model: core_model + view: core_view + +data_source: + ++fringe_context: + + fringe_model: + connected: core_model + + fringe_view: + + fringe_presenter: + compose: fringe_model, fringe_view diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/yak/sub_sub_context_test.yml b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/yak/sub_sub_context_test.yml new file mode 100644 index 0000000..465418a --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/files/yak/sub_sub_context_test.yml @@ -0,0 +1,27 @@ + +core_model: + compose: data_source + +core_view: + +core_presenter: + model: core_model + view: core_view + +data_source: + ++fringe_context: + + fringe_model: + connected: core_model + + fringe_view: + + fringe_presenter: + compose: fringe_model, fringe_view + + +deep_context: + krill: + + giant_squid: + compose: fringe_view, core_model, krill diff --git a/flex-bison/mark1/tools/ceedling/vendor/diy/test/test_helper.rb b/flex-bison/mark1/tools/ceedling/vendor/diy/test/test_helper.rb new file mode 100644 index 0000000..90089f0 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/diy/test/test_helper.rb @@ -0,0 +1,55 @@ +here = File.expand_path(File.dirname(__FILE__)) +PROJ_ROOT = File.expand_path("#{here}/..") +$: << "#{PROJ_ROOT}/lib" +require 'test/unit' +require 'fileutils' +require 'find' +require 'yaml' +require 'ostruct' +require "#{here}/constructor" + +class Test::Unit::TestCase + include FileUtils + + def path_to(file) + File.expand_path(File.dirname(__FILE__)) + file + end + + def not_done + flunk "IMPLEMENT ME" + end + alias :implement_me :not_done + + def poll(time_limit) + (time_limit * 10).to_i.times do + return true if yield + sleep 0.1 + end + return false + end + + def self.method_added(msym) + # Prevent duplicate test methods + if msym.to_s =~ /^test_/ + @_tracked_tests ||= {} + raise "Duplicate test #{msym}" if @_tracked_tests[msym] + @_tracked_tests[msym] = true + end + end + + # + # HELPERS + # + def path_to_test_file(fname) + path_to("/files/#{fname}") + end + + def load_context(file_name) + hash = YAML.load(File.read(path_to_test_file(file_name))) + load_hash(hash) + end + + def load_hash(hash) + @diy = DIY::Context.new(hash) + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/hardmock/CHANGES b/flex-bison/mark1/tools/ceedling/vendor/hardmock/CHANGES new file mode 100644 index 0000000..4b5184c --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/hardmock/CHANGES @@ -0,0 +1,78 @@ +Hardmock 1.3.7 + +* BUG FIX: expects! could not setup expectations for more than one concrete method on an object, since the method aliasing and rewriting was only taking place when the background mock instance was first created. This logic has been updated and now you can do all the things you'd expect. + +Hardmock 1.3.6 + +* BUG FIX: In Rails apps (and others) Hardmock and Fixtures battled viciously over "setup" and "teardown" and "method_added" (and any other clever test enhancement tool, namely Mocha) causing unpredictable results, notably failure to auto-verify mocks after teardown (leading to false positive tests). + * The newly-added TestUnitBeforeAfter provides TestCase.before_setup and TestCase.after_teardown -- formal test wrapping hooks -- lets Hardmock provide its preparation and auto-verify behavior without contending for setup/teardown supremacy. + +Hardmock 1.3.5 + +* Aliased should_receive => expects and and_return => returns for easier transition from rspec mock and flexmock users. + +Hardmock 1.3.4 + +* Prevents accidental stubbing and mocking on NilClasses + +Hardmock 1.3.3 + +* stubs! and expects! no longer require that their target methods exist in reality (this used to prevent you from stubbing methods that "exist" by virtue of "method_missing" +* Tweaked inner metaclass code to avoid collisions with rspec's "metaid" stuff +* Moved this project's Rake tasks into rake_tasks... otherwise Rails will load them, if Hardmock is installed as a Rails plugin +* Alias added: 'verify_hardmocks' is now an alias for 'verify_mocks' (some internal projects were using this modified method name as a means of cooexisting with mocha) + +Hardmock 1.3.2 + +November 2007 + +* adds 'with' as an alternate syntax for specifying argument expectations. + +Hardmock 1.3.1 + +October 2007 + +* Can use stubs! on a mock object +* expects! now generates mocked methods that can safely transfer runtime blocks to the mock instance itself +* No longer need to call "prepare_hardmock_control" when using stubs in the absence of mocks +* Stubs of concrete class or instance methods are restored to original state in teardown + +Hardmock 1.3.0 + +October 2007 + +* Adds stubs! and expects! method to all objects and classes to support concrete stubbing/mocking. + +Hardmock 1.2.3 + +Sat Apr 28 01:16:15 EDT 2007 + +* Re-release of 1.2.2 (which was canceled)... tasks moved to lib/tasks + +Hardmock 1.2.2 + +Sat Apr 28 00:41:30 EDT 2007 + +* assert_error has been broken out into its own lib file +* Gem package can now run all tests successfully +* Internal code refactoring; a number of classes that were defined in hardmock.rb are now in their own files + +Hardmock 1.2.1 + +Sat Apr 28 00:41:30 EDT 2007 + +* (botched release, see 1.2.2) + +Hardmock 1.2.0 + +* You can now use "expect" in place of "expects" if you must. +* "inspect" has been added to the list of methods NOT erased by MethodCleanout. + +Hardmock 1.1.0 + +* "expects" replaces "expect" ("expect" now raises Hardmock::DeprecationError) +* "verify_mocks" is now implicit in teardown, you needn't call it anymore +* Mocking methods that Mock would otherwise inherit from Object (eg, to_s) is now possible +* require 'hardmock' is all that's required to use the library now; no need to include in TestCase + +(previously called CMock, translated to Hardmock on 2006-12-10) diff --git a/flex-bison/mark1/tools/ceedling/vendor/hardmock/LICENSE b/flex-bison/mark1/tools/ceedling/vendor/hardmock/LICENSE new file mode 100644 index 0000000..396211e --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/hardmock/LICENSE @@ -0,0 +1,7 @@ +Copyright (c) 2006,2007 David Crosby at Atomic Object, LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/flex-bison/mark1/tools/ceedling/vendor/hardmock/README b/flex-bison/mark1/tools/ceedling/vendor/hardmock/README new file mode 100644 index 0000000..4650a2a --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/hardmock/README @@ -0,0 +1,70 @@ +== Hardmock + +Strict, ordered mock objects using very lightweight syntax in your tests. + +== How + +The basic procedure for using Hardmock in your tests is: + +* require 'hardmock' (this happens automatically when being used as a Rails plugin) +* Create some mocks +* Setup some expectations +* Execute the target code +* Verification of calls is automatic in =teardown= + +The expectations you set when using mocks are strict and ordered. +Expectations you declare by creating and using mocks are all considered together. + +* Hardmock::Mock#expects will show you more examples +* Hardmock::SimpleExpectation will teach you more about expectation methods + +== Example + + create_mocks :garage, :car + + # Set some expectations + @garage.expects.open_door + @car.expects.start(:choke) + @car.expects.drive(:reverse, 5.mph) + + # Execute the code (this code is usually, obviously, in your class under test) + @garage.open_door + @car.start :choke + @car.drive :reverse, 5.mph + + verify_mocks # OPTIONAL, teardown will do this for you + +Expects @garage.open_door, @car.start(:choke) and @car.drive(:reverse, 5.mph) to be called in that order, with those specific arguments. +* Violations of expectations, such as mis-ordered calls, calls on wrong objects, or incorrect methods result in Hardmock::ExpectationError +* verify_mocks will raise VerifyError if not all expectations have been met. + +== Download and Install + +* Homepage: http://hardmock.rubyforge.org +* GEM or TGZ or ZIP: http://rubyforge.org/frs/?group_id=2742 +* Rails plugin: script/plugin install +* SVN access: svn co svn://rubyforge.org/var/svn/hardmock/trunk +* Developer SVN access: svn co svn://developername@rubyforge.org/var/svn/hardmock/trunk + +== Setup for Test::Unit + + require 'hardmock' + require 'assert_error' # OPTIONAL: this adds the TestUnit extension 'assert_error' + +NOTE: If installed as a Rails plugin, init.rb does this for you... nothing else is needed. + +== Setup for RSpec + +Get this into your spec helper or environment or Rakefile or wherever you prefer: + + Spec::Runner.configure do |configuration| + configuration.include Hardmock + configuration.after(:each) {verify_mocks} + end + +This puts the implicit conveniences into your spec context, like "create_mocks" etc, and also provides for automatic +"verify_mocks" after each Example is run. + +== Author +* David Crosby crosby at http://atomicobject.com +* (c) 2006,2007 Atomic Object LLC diff --git a/flex-bison/mark1/tools/ceedling/vendor/hardmock/Rakefile b/flex-bison/mark1/tools/ceedling/vendor/hardmock/Rakefile new file mode 100644 index 0000000..aff126c --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/hardmock/Rakefile @@ -0,0 +1,8 @@ +require 'rake' +require 'rubygems' + +HARDMOCK_VERSION = "1.3.7" + +Dir["rake_tasks/*.rake"].each { |f| load f } + +task :default => [ 'test:all' ] diff --git a/flex-bison/mark1/tools/ceedling/vendor/hardmock/config/environment.rb b/flex-bison/mark1/tools/ceedling/vendor/hardmock/config/environment.rb new file mode 100644 index 0000000..a15e598 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/hardmock/config/environment.rb @@ -0,0 +1,12 @@ +# The path to the root directory of your application. +APP_ROOT = File.join(File.dirname(__FILE__), '..') + +ADDITIONAL_LOAD_PATHS = [] +ADDITIONAL_LOAD_PATHS.concat %w( + lib +).map { |dir| "#{APP_ROOT}/#{dir}" }.select { |dir| File.directory?(dir) } + +# Prepend to $LOAD_PATH +ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) } + +# Require any additional libraries needed diff --git a/flex-bison/mark1/tools/ceedling/vendor/hardmock/lib/assert_error.rb b/flex-bison/mark1/tools/ceedling/vendor/hardmock/lib/assert_error.rb new file mode 100644 index 0000000..6da61de --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/hardmock/lib/assert_error.rb @@ -0,0 +1,23 @@ +require 'test/unit/assertions' + +module Test::Unit #:nodoc:# + module Assertions #:nodoc:# + # A better 'assert_raise'. +patterns+ can be one or more Regexps, or a literal String that + # must match the entire error message. + def assert_error(err_type,*patterns,&block) + assert_not_nil block, "assert_error requires a block" + assert((err_type and err_type.kind_of?(Class)), "First argument to assert_error has to be an error type") + err = assert_raise(err_type) do + block.call + end + patterns.each do |pattern| + case pattern + when Regexp + assert_match(pattern, err.message) + else + assert_equal pattern, err.message + end + end + end + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/hardmock/lib/extend_test_unit.rb b/flex-bison/mark1/tools/ceedling/vendor/hardmock/lib/extend_test_unit.rb new file mode 100644 index 0000000..3d7ef9d --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/hardmock/lib/extend_test_unit.rb @@ -0,0 +1,14 @@ + +require 'test/unit/testcase' +class Test::Unit::TestCase + include Hardmock +end + +require 'test_unit_before_after' +Test::Unit::TestCase.before_setup do |test| + test.prepare_hardmock_control +end + +Test::Unit::TestCase.after_teardown do |test| + test.verify_mocks +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/hardmock/lib/hardmock.rb b/flex-bison/mark1/tools/ceedling/vendor/hardmock/lib/hardmock.rb new file mode 100644 index 0000000..50f9a94 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/hardmock/lib/hardmock.rb @@ -0,0 +1,86 @@ +require 'hardmock/method_cleanout' +require 'hardmock/mock' +require 'hardmock/mock_control' +require 'hardmock/utils' +require 'hardmock/errors' +require 'hardmock/trapper' +require 'hardmock/expector' +require 'hardmock/expectation' +require 'hardmock/expectation_builder' +require 'hardmock/stubbing' + +module Hardmock + + # Create one or more new Mock instances in your test suite. + # Once created, the Mocks are accessible as instance variables in your test. + # Newly built Mocks are added to the full set of Mocks for this test, which will + # be verified when you call verify_mocks. + # + # create_mocks :donkey, :cat # Your test now has @donkey and @cat + # create_mock :dog # Test now has @donkey, @cat and @dog + # + # The first call returned a hash { :donkey => @donkey, :cat => @cat } + # and the second call returned { :dog => @dog } + # + # For more info on how to use your mocks, see Mock and Expectation + # + def create_mocks(*mock_names) + prepare_hardmock_control unless @main_mock_control + + mocks = {} + mock_names.each do |mock_name| + raise ArgumentError, "'nil' is not a valid name for a mock" if mock_name.nil? + mock_name = mock_name.to_s + mock_object = Mock.new(mock_name, @main_mock_control) + mocks[mock_name.to_sym] = mock_object + self.instance_variable_set "@#{mock_name}", mock_object + end + @all_mocks ||= {} + @all_mocks.merge! mocks + + return mocks.clone + end + + def prepare_hardmock_control + if @main_mock_control.nil? + @main_mock_control = MockControl.new + $main_mock_control = @main_mock_control + else + raise "@main_mock_control is already setup for this test!" + end + end + + alias :create_mock :create_mocks + + # Ensures that all expectations have been met. If not, VerifyException is + # raised. + # + # You normally won't need to call this yourself. Within Test::Unit::TestCase, this will be done automatically at teardown time. + # + # * +force+ -- if +false+, and a VerifyError or ExpectationError has already occurred, this method will not raise. This is to help you suppress repeated errors when if you're calling #verify_mocks in the teardown method of your test suite. BE WARNED - only use this if you're sure you aren't obscuring useful information. Eg, if your code handles exceptions internally, and an ExpectationError gets gobbled up by your +rescue+ block, the cause of failure for your test may be hidden from you. For this reason, #verify_mocks defaults to force=true as of Hardmock 1.0.1 + def verify_mocks(force=true) + return unless @main_mock_control + return if @main_mock_control.disappointed? and !force + @main_mock_control.verify + ensure + @main_mock_control.clear_expectations if @main_mock_control + $main_mock_control = nil + reset_stubs + end + + alias :verify_hardmocks :verify_mocks + + # Purge the main MockControl of all expectations, restore all concrete stubbed/mocked methods + def clear_expectations + @main_mock_control.clear_expectations if @main_mock_control + reset_stubs + $main_mock_control = nil + end + + def reset_stubs + Hardmock.restore_all_replaced_methods + end + +end + +require 'extend_test_unit' diff --git a/flex-bison/mark1/tools/ceedling/vendor/hardmock/lib/hardmock/errors.rb b/flex-bison/mark1/tools/ceedling/vendor/hardmock/lib/hardmock/errors.rb new file mode 100644 index 0000000..48698a6 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/hardmock/lib/hardmock/errors.rb @@ -0,0 +1,22 @@ +module Hardmock + # Raised when: + # * Unexpected method is called on a mock object + # * Bad arguments passed to an expected call + class ExpectationError < StandardError #:nodoc:# + end + + # Raised for methods that should no longer be called. Hopefully, the exception message contains helpful alternatives. + class DeprecationError < StandardError #:nodoc:# + end + + # Raised when stubbing fails + class StubbingError < StandardError #:nodoc:# + end + + # Raised when it is discovered that an expected method call was never made. + class VerifyError < StandardError #:nodoc:# + def initialize(msg,unmet_expectations) + super("#{msg}:" + unmet_expectations.map { |ex| "\n * #{ex.to_s}" }.join) + end + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/hardmock/lib/hardmock/expectation.rb b/flex-bison/mark1/tools/ceedling/vendor/hardmock/lib/hardmock/expectation.rb new file mode 100644 index 0000000..4d1db92 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/hardmock/lib/hardmock/expectation.rb @@ -0,0 +1,229 @@ +require 'hardmock/utils' + +module Hardmock + class Expectation + include Utils + attr_reader :block_value + + def initialize(options) #:nodoc: + @options = options + end + + def apply_method_call(mock,mname,args,block) #:nodoc: + unless @options[:mock].equal?(mock) + raise anger("Wrong object", mock,mname,args) + end + unless @options[:method] == mname + raise anger("Wrong method",mock,mname,args) + end + + # Tester-defined block to invoke at method-call-time: + expectation_block = @options[:block] + + expected_args = @options[:arguments] + # if we have a block, we can skip the argument check if none were specified + unless (expected_args.nil? || expected_args.empty?) && expectation_block && !@options[:suppress_arguments_to_block] + unless expected_args == args + raise anger("Wrong arguments",mock,mname,args) + end + end + + relayed_args = args.dup + if block + if expectation_block.nil? + # Can't handle a runtime block without an expectation block + raise ExpectationError.new("Unexpected block provided to #{to_s}") + else + # Runtime blocks are passed as final argument to the expectation block + unless @options[:suppress_arguments_to_block] + relayed_args << block + else + # Arguments suppressed; send only the block + relayed_args = [block] + end + end + end + + # Run the expectation block: + @block_value = expectation_block.call(*relayed_args) if expectation_block + + raise @options[:raises] unless @options[:raises].nil? + + return_value = @options[:returns] + if return_value.nil? + return @block_value + else + return return_value + end + end + + # Set the return value for an expected method call. + # Eg, + # @cash_machine.expects.withdraw(20,:dollars).returns(20.00) + def returns(val) + @options[:returns] = val + self + end + alias_method :and_return, :returns + + # Set the arguments for an expected method call. + # Eg, + # @cash_machine.expects.deposit.with(20, "dollars").returns(:balance => "20") + def with(*args) + @options[:arguments] = args + self + end + + # Rig an expected method to raise an exception when the mock is invoked. + # + # Eg, + # @cash_machine.expects.withdraw(20,:dollars).raises "Insufficient funds" + # + # The argument can be: + # * an Exception -- will be used directly + # * a String -- will be used as the message for a RuntimeError + # * nothing -- RuntimeError.new("An Error") will be raised + def raises(err=nil) + case err + when Exception + @options[:raises] = err + when String + @options[:raises] = RuntimeError.new(err) + else + @options[:raises] = RuntimeError.new("An Error") + end + self + end + + # Convenience method: assumes +block_value+ is set, and is set to a Proc + # (or anything that responds to 'call') + # + # light_event = @traffic_light.trap.subscribe(:light_changes) + # + # # This code will meet the expectation: + # @traffic_light.subscribe :light_changes do |color| + # puts color + # end + # + # The color-handling block is now stored in light_event.block_value + # + # The block can be invoked like this: + # + # light_event.trigger :red + # + # See Mock#trap and Mock#expects for information on using expectation objects + # after they are set. + # + def trigger(*block_arguments) + unless block_value + raise ExpectationError.new("No block value is currently set for expectation #{to_s}") + end + unless block_value.respond_to?(:call) + raise ExpectationError.new("Can't apply trigger to #{block_value} for expectation #{to_s}") + end + block_value.call *block_arguments + end + + # Used when an expected method accepts a block at runtime. + # When the expected method is invoked, the block passed to + # that method will be invoked as well. + # + # NOTE: ExpectationError will be thrown upon running the expected method + # if the arguments you set up in +yields+ do not properly match up with + # the actual block that ends up getting passed. + # + # == Examples + # Single invocation: The block passed to +lock_down+ gets invoked + # once with no arguments: + # + # @safe_zone.expects.lock_down.yields + # + # # (works on code that looks like:) + # @safe_zone.lock_down do + # # ... this block invoked once + # end + # + # Multi-parameter blocks: The block passed to +each_item+ gets + # invoked twice, with :item1 the first time, and with + # :item2 the second time: + # + # @fruit_basket.expects.each_with_index.yields [:apple,1], [:orange,2] + # + # # (works on code that looks like:) + # @fruit_basket.each_with_index do |fruit,index| + # # ... this block invoked with fruit=:apple, index=1, + # # ... and then with fruit=:orange, index=2 + # end + # + # Arrays can be passed as arguments too... if the block + # takes a single argument and you want to pass a series of arrays into it, + # that will work as well: + # + # @list_provider.expects.each_list.yields [1,2,3], [4,5,6] + # + # # (works on code that looks like:) + # @list_provider.each_list do |list| + # # ... list is [1,2,3] the first time + # # ... list is [4,5,6] the second time + # end + # + # Return value: You can set the return value for the method that + # accepts the block like so: + # + # @cruncher.expects.do_things.yields(:bean1,:bean2).returns("The Results") + # + # Raising errors: You can set the raised exception for the method that + # accepts the block. NOTE: the error will be raised _after_ the block has + # been invoked. + # + # # :bean1 and :bean2 will be passed to the block, then an error is raised: + # @cruncher.expects.do_things.yields(:bean1,:bean2).raises("Too crunchy") + # + def yields(*items) + @options[:suppress_arguments_to_block] = true + if items.empty? + # Yield once + @options[:block] = lambda do |block| + if block.arity != 0 and block.arity != -1 + raise ExpectationError.new("The given block was expected to have no parameter count; instead, got #{block.arity} to <#{to_s}>") + end + block.call + end + else + # Yield one or more specific items + @options[:block] = lambda do |block| + items.each do |item| + if item.kind_of?(Array) + if block.arity == item.size + # Unfold the array into the block's arguments: + block.call *item + elsif block.arity == 1 + # Just pass the array in + block.call item + else + # Size mismatch + raise ExpectationError.new("Can't pass #{item.inspect} to block with arity #{block.arity} to <#{to_s}>") + end + else + if block.arity != 1 + # Size mismatch + raise ExpectationError.new("Can't pass #{item.inspect} to block with arity #{block.arity} to <#{to_s}>") + end + block.call item + end + end + end + end + self + end + + def to_s # :nodoc: + format_method_call_string(@options[:mock],@options[:method],@options[:arguments]) + end + + private + def anger(msg, mock,mname,args) + ExpectationError.new("#{msg}: expected call <#{to_s}> but was <#{format_method_call_string(mock,mname,args)}>") + end + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/hardmock/lib/hardmock/expectation_builder.rb b/flex-bison/mark1/tools/ceedling/vendor/hardmock/lib/hardmock/expectation_builder.rb new file mode 100644 index 0000000..7445fb1 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/hardmock/lib/hardmock/expectation_builder.rb @@ -0,0 +1,9 @@ +require 'hardmock/expectation' + +module Hardmock + class ExpectationBuilder #:nodoc: + def build_expectation(options) + Expectation.new(options) + end + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/hardmock/lib/hardmock/expector.rb b/flex-bison/mark1/tools/ceedling/vendor/hardmock/lib/hardmock/expector.rb new file mode 100644 index 0000000..8055460 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/hardmock/lib/hardmock/expector.rb @@ -0,0 +1,26 @@ +require 'hardmock/method_cleanout' +require 'hardmock/errors' + +module Hardmock + class Expector #:nodoc: + include MethodCleanout + + def initialize(mock,mock_control,expectation_builder) + @mock = mock + @mock_control = mock_control + @expectation_builder = expectation_builder + end + + def method_missing(mname, *args, &block) + expectation = @expectation_builder.build_expectation( + :mock => @mock, + :method => mname, + :arguments => args, + :block => block) + + @mock_control.add_expectation expectation + expectation + end + end + +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/hardmock/lib/hardmock/method_cleanout.rb b/flex-bison/mark1/tools/ceedling/vendor/hardmock/lib/hardmock/method_cleanout.rb new file mode 100644 index 0000000..51797e6 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/hardmock/lib/hardmock/method_cleanout.rb @@ -0,0 +1,33 @@ + +module Hardmock #:nodoc: + module MethodCleanout #:nodoc: + SACRED_METHODS = %w{ + __id__ + __send__ + equal? + object_id + send + nil? + class + kind_of? + respond_to? + inspect + method + to_s + instance_variables + instance_eval + == + hm_metaclass + hm_meta_eval + hm_meta_def + } + + def self.included(base) #:nodoc: + base.class_eval do + instance_methods.each do |m| + undef_method m unless SACRED_METHODS.include?(m.to_s) + end + end + end + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/hardmock/lib/hardmock/mock.rb b/flex-bison/mark1/tools/ceedling/vendor/hardmock/lib/hardmock/mock.rb new file mode 100644 index 0000000..928c432 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/hardmock/lib/hardmock/mock.rb @@ -0,0 +1,180 @@ + +module Hardmock + # Mock is used to set expectations in your test. Most of the time you'll use + # #expects to create expectations. + # + # Aside from the scant few control methods (like +expects+, +trap+ and +_verify+) + # all calls made on a Mock instance will be immediately applied to the internal + # expectation mechanism. + # + # * If the method call was expected and all the parameters match properly, execution continues + # * If the expectation was configured with an expectation block, the block is invoked + # * If the expectation was set up to raise an error, the error is raised now + # * If the expectation was set up to return a value, it is returned + # * If the method call was _not_ expected, or the parameter values are wrong, an ExpectationError is raised. + class Mock + include Hardmock::MethodCleanout + + # Create a new Mock instance with a name and a MockControl to support it. + # If not given, a MockControl is made implicitly for this Mock alone; this means + # expectations for this mock are not tied to other expectations in your test. + # + # It's not recommended to use a Mock directly; see Hardmock and + # Hardmock#create_mocks for the more wholistic approach. + def initialize(name, mock_control=nil) + @name = name + @control = mock_control || MockControl.new + @expectation_builder = ExpectationBuilder.new + end + + def inspect + "" + end + + # Begin declaring an expectation for this Mock. + # + # == Simple Examples + # Expect the +customer+ to be queried for +account+, and return "The + # Account": + # @customer.expects.account.returns "The Account" + # + # Expect the +withdraw+ method to be called, and raise an exception when it + # is (see Expectation#raises for more info): + # @cash_machine.expects.withdraw(20,:dollars).raises("not enough money") + # + # Expect +customer+ to have its +user_name+ set + # @customer.expects.user_name = 'Big Boss' + # + # Expect +customer+ to have its +user_name+ set, and raise a RuntimeException when + # that happens: + # @customer.expects('user_name=', "Big Boss").raises "lost connection" + # + # Expect +evaluate+ to be passed a block, and when that happens, pass a value + # to the block (see Expectation#yields for more info): + # @cruncher.expects.evaluate.yields("some data").returns("some results") + # + # + # == Expectation Blocks + # To do special handling of expected method calls when they occur, you + # may pass a block to your expectation, like: + # @page_scraper.expects.handle_content do |address,request,status| + # assert_not_nil address, "Can't abide nil addresses" + # assert_equal "http-get", request.method, "Can only handle GET" + # assert status > 200 and status < 300, status, "Failed status" + # "Simulated results #{request.content.downcase}" + # end + # In this example, when page_scraper.handle_content is called, its + # three arguments are passed to the expectation block and evaluated + # using the above assertions. The last value in the block will be used + # as the return value for +handle_content+ + # + # You may specify arguments to the expected method call, just like any normal + # expectation, and those arguments will be pre-validated before being passed + # to the expectation block. This is useful when you know all of the + # expected values but still need to do something programmatic. + # + # If the method being invoked on the mock accepts a block, that block will be + # passed to your expectation block as the last (or only) argument. Eg, the + # convenience method +yields+ can be replaced with the more explicit: + # @cruncher.expects.evaluate do |block| + # block.call "some data" + # "some results" + # end + # + # The result value of the expectation block becomes the return value for the + # expected method call. This can be overidden by using the +returns+ method: + # @cruncher.expects.evaluate do |block| + # block.call "some data" + # "some results" + # end.returns("the actual value") + # + # Additionally, the resulting value of the expectation block is stored + # in the +block_value+ field on the expectation. If you've saved a reference + # to your expectation, you may retrieve the block value once the expectation + # has been met. + # + # evaluation_event = @cruncher.expects.evaluate do |block| + # block.call "some data" + # "some results" + # end.returns("the actual value") + # + # result = @cruncher.evaluate do |input| + # puts input # => 'some data' + # end + # # result is 'the actual value' + # + # evaluation_event.block_value # => 'some results' + # + def expects(*args, &block) + expector = Expector.new(self,@control,@expectation_builder) + # If there are no args, we return the Expector + return expector if args.empty? + # If there ARE args, we set up the expectation right here and return it + expector.send(args.shift.to_sym, *args, &block) + end + alias_method :expect, :expects + alias_method :should_receive, :expects + + # Special-case convenience: #trap sets up an expectation for a method + # that will take a block. That block, when sent to the expected method, will + # be trapped and stored in the expectation's +block_value+ field. + # The Expectation#trigger method may then be used to invoke that block. + # + # Like +expects+, the +trap+ mechanism can be followed by +raises+ or +returns+. + # + # _Unlike_ +expects+, you may not use an expectation block with +trap+. If + # the expected method takes arguments in addition to the block, they must + # be specified in the arguments to the +trap+ call itself. + # + # == Example + # + # create_mocks :address_book, :editor_form + # + # # Expect a subscription on the :person_added event for @address_book: + # person_event = @address_book.trap.subscribe(:person_added) + # + # # The runtime code would look like: + # @address_book.subscribe :person_added do |person_name| + # @editor_form.name = person_name + # end + # + # # At this point, the expectation for 'subscribe' is met and the + # # block has been captured. But we're not done: + # @editor_form.expects.name = "David" + # + # # Now invoke the block we trapped earlier: + # person_event.trigger "David" + # + # verify_mocks + def trap(*args) + Trapper.new(self,@control,ExpectationBuilder.new) + end + + def method_missing(mname,*args) #:nodoc: + block = nil + block = Proc.new if block_given? + @control.apply_method_call(self,mname,args,block) + end + + + def _control #:nodoc: + @control + end + + def _name #:nodoc: + @name + end + + # Verify that all expectations are fulfilled. NOTE: this method triggers + # validation on the _control_ for this mock, so all Mocks that share the + # MockControl with this instance will be included in the verification. + # + # Only use this method if you are managing your own Mocks and their controls. + # + # Normal usage of Hardmock doesn't require you to call this; let + # Hardmock#verify_mocks do it for you. + def _verify + @control.verify + end + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/hardmock/lib/hardmock/mock_control.rb b/flex-bison/mark1/tools/ceedling/vendor/hardmock/lib/hardmock/mock_control.rb new file mode 100644 index 0000000..302ebce --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/hardmock/lib/hardmock/mock_control.rb @@ -0,0 +1,53 @@ +require 'hardmock/utils' + +module Hardmock + class MockControl #:nodoc: + include Utils + attr_accessor :name + + def initialize + clear_expectations + end + + def happy? + @expectations.empty? + end + + def disappointed? + @disappointed + end + + def add_expectation(expectation) +# puts "MockControl #{self.object_id.to_s(16)} adding expectation: #{expectation}" + @expectations << expectation + end + + def apply_method_call(mock,mname,args,block) + # Are we even expecting any sort of call? + if happy? + @disappointed = true + raise ExpectationError.new("Surprise call to #{format_method_call_string(mock,mname,args)}") + end + + begin + @expectations.shift.apply_method_call(mock,mname,args,block) + rescue Exception => ouch + @disappointed = true + raise ouch + end + end + + def verify +# puts "MockControl #{self.object_id.to_s(16)} verify: happy? #{happy?}" + @disappointed = !happy? + raise VerifyError.new("Unmet expectations", @expectations) unless happy? + end + + def clear_expectations + @expectations = [] + @disappointed = false + end + + end + +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/hardmock/lib/hardmock/stubbing.rb b/flex-bison/mark1/tools/ceedling/vendor/hardmock/lib/hardmock/stubbing.rb new file mode 100644 index 0000000..0f8a293 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/hardmock/lib/hardmock/stubbing.rb @@ -0,0 +1,210 @@ + + +# Stubbing support +# +# Stubs methods on classes and instances +# + +# Why's "metaid.rb" stuff crunched down: +class Object #:nodoc:# + def hm_metaclass #:nodoc:# + class << self + self + end + end + + def hm_meta_eval(&blk) #:nodoc:# + hm_metaclass.instance_eval(&blk) + end + + def hm_meta_def(name, &blk) #:nodoc:# + hm_meta_eval { define_method name, &blk } + end +end + + + +module Hardmock + + # == Hardmock: Stubbing and Mocking Concrete Methods + # + # Hardmock lets you stub and/or mock methods on concrete classes or objects. + # + # * To "stub" a concrete method is to rig it to return the same thing always, disregarding any arguments. + # * To "mock" a concrete method is to surplant its funcionality by delegating to a mock object who will cover this behavior. + # + # Mocked methods have their expectations considered along with all other mock object expectations. + # + # If you use stubbing or concrete mocking in the absence (or before creation) of other mocks, you need to invoke prepare_hardmock_control. + # Once verify_mocks or clear_expectaions is called, the overriden behavior in the target objects is restored. + # + # == Examples + # + # River.stubs!(:sounds_like).returns("gurgle") + # + # River.expects!(:jump).returns("splash") + # + # rogue.stubs!(:sounds_like).returns("pshshsh") + # + # rogue.expects!(:rawhide_tanning_solvents).returns("giant snapping turtles") + # + module Stubbing + # Exists only for documentation + end + + class ReplacedMethod #:nodoc:# + attr_reader :target, :method_name + + def initialize(target, method_name) + @target = target + @method_name = method_name + + Hardmock.track_replaced_method self + end + end + + class StubbedMethod < ReplacedMethod #:nodoc:# + def invoke(args) + raise @raises if @raises + @return_value + end + + def returns(stubbed_return) + @return_value = stubbed_return + end + + def raises(err) + err = RuntimeError.new(err) unless err.kind_of?(Exception) + @raises = err + end + end + + class ::Object + def stubs!(method_name) + method_name = method_name.to_s + already_stubbed = Hardmock.has_replaced_method?(self, method_name) + + stubbed_method = Hardmock::StubbedMethod.new(self, method_name) + + + unless _is_mock? or already_stubbed + if methods.include?(method_name.to_s) + hm_meta_eval do + alias_method "_hardmock_original_#{method_name}".to_sym, method_name.to_sym + end + end + end + + hm_meta_def method_name do |*args| + stubbed_method.invoke(args) + end + + stubbed_method + end + + def expects!(method_name, *args, &block) + if self._is_mock? + raise Hardmock::StubbingError, "Cannot use 'expects!(:#{method_name})' on a Mock object; try 'expects' instead" + end + + method_name = method_name.to_s + + @_my_mock = Mock.new(_my_name, $main_mock_control) if @_my_mock.nil? + + unless Hardmock.has_replaced_method?(self, method_name) + # Track the method as replaced + Hardmock::ReplacedMethod.new(self, method_name) + + # Preserver original implementation of the method by aliasing it away + if methods.include?(method_name) + hm_meta_eval do + alias_method "_hardmock_original_#{method_name}".to_sym, method_name.to_sym + end + end + + # Re-define the method to utilize our patron mock instance. + # (This global-temp-var thing is hokey but I was having difficulty generating + # code for the meta class.) + begin + $method_text_temp = %{ + def #{method_name}(*args,&block) + @_my_mock.__send__(:#{method_name}, *args, &block) + end + } + class << self + eval $method_text_temp + end + ensure + $method_text_temp = nil + end + end + + return @_my_mock.expects(method_name, *args, &block) + end + + def _is_mock? + self.kind_of?(Mock) + end + + def _my_name + self.kind_of?(Class) ? self.name : self.class.name + end + + def _clear_mock + @_my_mock = nil + end + + end + + class ::NilClass + # Use this only if you really mean it + alias_method :intentionally_stubs!, :stubs! + + # Use this only if you really mean it + alias_method :intentionally_expects!, :expects! + + # Overridden to protect against accidental nil reference self delusion + def stubs!(mname) + raise StubbingError, "Cannot stub #{mname} method on nil. (If you really mean to, try 'intentionally_stubs!')" + end + + # Overridden to protect against accidental nil reference self delusion + def expects!(mname, *args) + raise StubbingError, "Cannot mock #{mname} method on nil. (If you really mean to, try 'intentionally_expects!')" + end + end + + class << self + def track_replaced_method(replaced_method) + all_replaced_methods << replaced_method + end + + def all_replaced_methods + $all_replaced_methods ||= [] + end + + def has_replaced_method?(obj, method_name) + hits = all_replaced_methods.select do |replaced| + (replaced.target.object_id == obj.object_id) and (replaced.method_name.to_s == method_name.to_s) + end + return !hits.empty? + end + + def restore_all_replaced_methods + all_replaced_methods.each do |replaced| + unless replaced.target._is_mock? + backed_up = "_hardmock_original_#{replaced.method_name}" + if replaced.target.methods.include?(backed_up) + replaced.target.hm_meta_eval do + alias_method replaced.method_name.to_sym, backed_up.to_sym + end + end + replaced.target._clear_mock + end + end + all_replaced_methods.clear + end + end + +end + diff --git a/flex-bison/mark1/tools/ceedling/vendor/hardmock/lib/hardmock/trapper.rb b/flex-bison/mark1/tools/ceedling/vendor/hardmock/lib/hardmock/trapper.rb new file mode 100644 index 0000000..6aab176 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/hardmock/lib/hardmock/trapper.rb @@ -0,0 +1,31 @@ +require 'test/unit/assertions' +require 'hardmock/errors' + +module Hardmock + class Trapper #:nodoc: + include Hardmock::MethodCleanout + + def initialize(mock,mock_control,expectation_builder) + @mock = mock + @mock_control = mock_control + @expectation_builder = expectation_builder + end + + def method_missing(mname, *args) + if block_given? + raise ExpectationError.new("Don't pass blocks when using 'trap' (setting exepectations for '#{mname}')") + end + + the_block = lambda { |target_block| target_block } + expectation = @expectation_builder.build_expectation( + :mock => @mock, + :method => mname, + :arguments => args, + :suppress_arguments_to_block => true, + :block => the_block) + + @mock_control.add_expectation expectation + expectation + end + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/hardmock/lib/hardmock/utils.rb b/flex-bison/mark1/tools/ceedling/vendor/hardmock/lib/hardmock/utils.rb new file mode 100644 index 0000000..1740577 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/hardmock/lib/hardmock/utils.rb @@ -0,0 +1,9 @@ + +module Hardmock + module Utils #:nodoc: + def format_method_call_string(mock,mname,args) + arg_string = args.map { |a| a.inspect }.join(', ') + call_text = "#{mock._name}.#{mname}(#{arg_string})" + end + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/hardmock/lib/test_unit_before_after.rb b/flex-bison/mark1/tools/ceedling/vendor/hardmock/lib/test_unit_before_after.rb new file mode 100644 index 0000000..0499e39 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/hardmock/lib/test_unit_before_after.rb @@ -0,0 +1,169 @@ +require 'test/unit' +require 'test/unit/testcase' +require 'test/unit/assertions' + +module Test #:nodoc:# + module Unit #:nodoc:# + + # == TestCase Modifications + # + # Monkey-patch to provide a formal mechanism for appending actions to be executed after teardown. + # Use after_teardown to define one or more actions to be executed after teardown for ALL tests. + # + # COMING SOON? + # * (maybe?) Hooks for before_teardown, after_setup, on_error + # * (maybe?) Options for positional control, eg, after_teardown :before_other_actions + # * (maybe?) Provide tagging/filtering so action execution can be controlled specifically? + # + # == Usage + # + # Invoke TestCase.after_teardown with optional parameter, which will be invoked with a reference + # to the test instance that has just been torn down. + # + # Example: + # + # Test::Unit::TestCase.after_teardown do |test| + # test.verify_mocks + # end + # + # == Justification + # + # There are a number of tools and libraries that play fast-n-loose with setup and teardown by + # wrapping them, and by overriding method_added as a means of upholding special setup/teardown + # behavior, usually by re-wrapping newly defined user-level setup/teardown methods. + # mocha and active_record/fixtures (and previously, hardmock) will fight for this + # territory with often unpredictable results. + # + # We wouldn't have to battle if Test::Unit provided a formal pre- and post- hook mechanism. + # + class TestCase + + class << self + + # Define an action to be run after teardown. Subsequent calls result in + # multiple actions. The block will be given a reference to the test + # being executed. + # + # Example: + # + # Test::Unit::TestCase.after_teardown do |test| + # test.verify_mocks + # end + def after_teardown(&block) + post_teardown_actions << block + end + + # Used internally. Access the list of post teardown actions for to be + # used by all tests. + def post_teardown_actions + @@post_teardown_actions ||= [] + end + + # Define an action to be run before setup. Subsequent calls result in + # multiple actions, EACH BEING PREPENDED TO THE PREVIOUS. + # The block will be given a reference to the test being executed. + # + # Example: + # + # Test::Unit::TestCase.before_setup do |test| + # test.prepare_hardmock_control + # end + def before_setup(&block) + pre_setup_actions.unshift block + end + + # Used internally. Access the list of post teardown actions for to be + # used by all tests. + def pre_setup_actions + @@pre_setup_actions ||= [] + end + end + + # OVERRIDE: This is a reimplementation of the default "run", updated to + # execute actions after teardown. + def run(result) + yield(STARTED, name) + @_result = result + begin + execute_pre_setup_actions(self) + setup + __send__(@method_name) + rescue Test::Unit::AssertionFailedError => e + add_failure(e.message, auxiliary_backtrace_filter(e.backtrace)) + rescue Exception + raise if should_passthru_exception($!) # See implementation; this is for pre-1.8.6 compat + add_error($!) + ensure + begin + teardown + rescue Test::Unit::AssertionFailedError => e + add_failure(e.message, auxiliary_backtrace_filter(e.backtrace)) + rescue Exception + raise if should_passthru_exception($!) # See implementation; this is for pre-1.8.6 compat + add_error($!) + ensure + execute_post_teardown_actions(self) + end + end + result.add_run + yield(FINISHED, name) + end + + private + + # Run through the after_teardown actions, treating failures and errors + # in the same way that "run" does: they are reported, and the remaining + # actions are executed. + def execute_post_teardown_actions(test_instance) + self.class.post_teardown_actions.each do |action| + begin + action.call test_instance + rescue Test::Unit::AssertionFailedError => e + add_failure(e.message, auxiliary_backtrace_filter(e.backtrace)) + rescue Exception + raise if should_passthru_exception($!) + add_error($!) + end + end + end + + # Run through the before_setup actions. + # Failures or errors cause execution to stop. + def execute_pre_setup_actions(test_instance) + self.class.pre_setup_actions.each do |action| +# begin + action.call test_instance +# rescue Test::Unit::AssertionFailedError => e +# add_failure(e.message, auxiliary_backtrace_filter(e.backtrace)) +# rescue Exception +# raise if should_passthru_exception($!) +# add_error($!) +# end + end + end + + # Make sure that this extension doesn't show up in failure backtraces + def auxiliary_backtrace_filter(trace) + trace.reject { |x| x =~ /test_unit_before_after/ } + end + + # Is the given error of the type that we allow to fly out (rather than catching it)? + def should_passthru_exception(ex) + return passthrough_exception_types.include?($!.class) + end + + # Provide a list of exception types that are to be allowed to explode out. + # Pre-ruby-1.8.6 doesn't use this functionality, so the PASSTHROUGH_EXCEPTIONS + # constant won't be defined. This methods defends against that and returns + # an empty list instead. + def passthrough_exception_types + begin + return PASSTHROUGH_EXCEPTIONS + rescue NameError + # older versions of test/unit do not have PASSTHROUGH_EXCEPTIONS constant + return [] + end + end + end + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/hardmock/rake_tasks/rdoc.rake b/flex-bison/mark1/tools/ceedling/vendor/hardmock/rake_tasks/rdoc.rake new file mode 100644 index 0000000..6a6d79f --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/hardmock/rake_tasks/rdoc.rake @@ -0,0 +1,19 @@ +require 'rake/rdoctask' +require File.expand_path(File.dirname(__FILE__) + "/rdoc_options.rb") + +namespace :doc do + + desc "Generate RDoc documentation" + Rake::RDocTask.new { |rdoc| + rdoc.rdoc_dir = 'doc' + rdoc.title = "Hardmock: Strict expectation-based mock object library " + add_rdoc_options(rdoc.options) + rdoc.rdoc_files.include('lib/**/*.rb', 'README','CHANGES','LICENSE') + } + + task :show => [ 'doc:rerdoc' ] do + sh "open doc/index.html" + end + +end + diff --git a/flex-bison/mark1/tools/ceedling/vendor/hardmock/rake_tasks/rdoc_options.rb b/flex-bison/mark1/tools/ceedling/vendor/hardmock/rake_tasks/rdoc_options.rb new file mode 100644 index 0000000..85bf4ce --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/hardmock/rake_tasks/rdoc_options.rb @@ -0,0 +1,4 @@ + +def add_rdoc_options(options) + options << '--line-numbers' << '--inline-source' << '--main' << 'README' << '--title' << 'Hardmock' +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/hardmock/rake_tasks/test.rake b/flex-bison/mark1/tools/ceedling/vendor/hardmock/rake_tasks/test.rake new file mode 100644 index 0000000..85a3753 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/hardmock/rake_tasks/test.rake @@ -0,0 +1,22 @@ +require 'rake/testtask' + +namespace :test do + + desc "Run unit tests" + Rake::TestTask.new("units") { |t| + t.libs << "test" + t.pattern = 'test/unit/*_test.rb' + t.verbose = true + } + + desc "Run functional tests" + Rake::TestTask.new("functional") { |t| + t.libs << "test" + t.pattern = 'test/functional/*_test.rb' + t.verbose = true + } + + desc "Run all the tests" + task :all => [ 'test:units', 'test:functional' ] + +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/hardmock/test/functional/assert_error_test.rb b/flex-bison/mark1/tools/ceedling/vendor/hardmock/test/functional/assert_error_test.rb new file mode 100644 index 0000000..e4b35cf --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/hardmock/test/functional/assert_error_test.rb @@ -0,0 +1,52 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'assert_error' + +class AssertErrorTest < Test::Unit::TestCase + + it "specfies an error type and message that should be raised" do + assert_error RuntimeError, "Too funky" do + raise RuntimeError.new("Too funky") + end + end + + it "flunks if the error message is wrong" do + err = assert_raise Test::Unit::AssertionFailedError do + assert_error RuntimeError, "not good" do + raise RuntimeError.new("Too funky") + end + end + assert_match(/not good/i, err.message) + assert_match(/too funky/i, err.message) + end + + it "flunks if the error type is wrong" do + err = assert_raise Test::Unit::AssertionFailedError do + assert_error StandardError, "Too funky" do + raise RuntimeError.new("Too funky") + end + end + assert_match(/StandardError/i, err.message) + assert_match(/RuntimeError/i, err.message) + end + + it "can match error message text using a series of Regexps" do + assert_error StandardError, /too/i, /funky/i do + raise StandardError.new("Too funky") + end + end + + it "flunks if the error message doesn't match all the Regexps" do + err = assert_raise Test::Unit::AssertionFailedError do + assert_error StandardError, /way/i, /too/i, /funky/i do + raise StandardError.new("Too funky") + end + end + assert_match(/way/i, err.message) + end + + it "can operate without any message specification" do + assert_error StandardError do + raise StandardError.new("ooof") + end + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/hardmock/test/functional/auto_verify_test.rb b/flex-bison/mark1/tools/ceedling/vendor/hardmock/test/functional/auto_verify_test.rb new file mode 100644 index 0000000..1b005bd --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/hardmock/test/functional/auto_verify_test.rb @@ -0,0 +1,178 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'fileutils' + +class AutoVerifyTest < Test::Unit::TestCase + + def setup + @expect_unmet_expectations = true + end + + def teardown + remove_temp_test_file + end + + # + # TESTS + # + + it "auto-verifies all mocks in teardown" do + write_and_execute_test + end + + it "auto-verifies even if user defines own teardown" do + @teardown_code =<<-EOM + def teardown + # just in the way + end + EOM + write_and_execute_test + end + + should "not obscure normal failures when verification fails" do + @test_code =<<-EOM + def test_setup_doomed_expectation + create_mock :automobile + @automobile.expects.start + flunk "natural failure" + end + EOM + @expect_failures = 1 + write_and_execute_test + end + + should "not skip user-defined teardown when verification fails" do + @teardown_code =<<-EOM + def teardown + puts "User teardown" + end + EOM + write_and_execute_test + assert_output_contains(/User teardown/) + end + + it "is quiet when verification is ok" do + @test_code =<<-EOM + def test_ok + create_mock :automobile + @automobile.expects.start + @automobile.start + end + EOM + @teardown_code =<<-EOM + def teardown + puts "User teardown" + end + EOM + @expect_unmet_expectations = false + @expect_failures = 0 + @expect_errors = 0 + write_and_execute_test + assert_output_contains(/User teardown/) + end + + should "auto-verify even if user teardown explodes" do + @teardown_code =<<-EOM + def teardown + raise "self destruct" + end + EOM + @expect_errors = 2 + write_and_execute_test + assert_output_contains(/self destruct/) + end + + it "plays nice with inherited teardown methods" do + @full_code ||=<<-EOTEST + require File.expand_path(File.dirname(__FILE__) + "/../test_helper") + require 'hardmock' + class Test::Unit::TestCase + def teardown + puts "Test helper teardown" + end + end + class DummyTest < Test::Unit::TestCase + def test_prepare_to_die + create_mock :automobile + @automobile.expects.start + end + end + EOTEST + write_and_execute_test + assert_output_contains(/Test helper teardown/) + end + + # + # HELPERS + # + + def temp_test_file + File.expand_path(File.dirname(__FILE__) + "/tear_down_verification_test.rb") + end + + def run_test(tbody) + File.open(temp_test_file,"w") { |f| f.print(tbody) } + @test_output = `ruby #{temp_test_file} 2>&1` + end + + def formatted_test_output + if @test_output + @test_output.split(/\n/).map { |line| "> #{line}" }.join("\n") + else + "(NO TEST OUTPUT!)" + end + end + + def remove_temp_test_file + FileUtils::rm_f temp_test_file + end + + def assert_results(h) + if @test_output !~ /#{h[:tests]} tests, [0-9]+ assertions, #{h[:failures]} failures, #{h[:errors]} errors/ + flunk "Test results didn't match #{h.inspect}:\n#{formatted_test_output}" + end + end + + def assert_output_contains(*patterns) + patterns.each do |pattern| + if @test_output !~ pattern + flunk "Test output didn't match #{pattern.inspect}:\n#{formatted_test_output}" + end + end + end + + def assert_output_doesnt_contain(*patterns) + patterns.each do |pattern| + assert @test_output !~ pattern, "Output shouldn't match #{pattern.inspect} but it does." + end + end + + def write_and_execute_test + @test_code ||=<<-EOM + def test_setup_doomed_expectation + create_mock :automobile + @automobile.expects.start + end + EOM + @full_code ||=<<-EOTEST + require File.expand_path(File.dirname(__FILE__) + "/../test_helper") + require 'hardmock' + class DummyTest < Test::Unit::TestCase + #{@teardown_code} + #{@test_code} + end + EOTEST + run_test @full_code + + if @expect_unmet_expectations + assert_output_contains(/unmet expectations/i, /automobile/, /start/) + else + assert_output_doesnt_contain(/unmet expectations/i, /automobile/, /start/) + end + + @expect_tests ||= 1 + @expect_failures ||= 0 + @expect_errors ||= 1 + assert_results :tests => @expect_tests, :failures => @expect_failures, :errors => @expect_errors + end + +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/hardmock/test/functional/direct_mock_usage_test.rb b/flex-bison/mark1/tools/ceedling/vendor/hardmock/test/functional/direct_mock_usage_test.rb new file mode 100644 index 0000000..dcf2b2a --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/hardmock/test/functional/direct_mock_usage_test.rb @@ -0,0 +1,396 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock' + +class DirectMockUsageTest < Test::Unit::TestCase + + def setup + @bird = Mock.new('bird') + end + + def teardown + end + + # + # TESTS + # + + it "raises VerifyError if expected method not called" do + @bird.expects.flap_flap + + err = assert_raise VerifyError do + @bird._verify + end + assert_match(/unmet expectations/i, err.message) + end + + should "not raise when expected calls are made in order" do + @bird.expects.flap_flap + @bird.expects.bang + @bird.expects.plop + + @bird.flap_flap + @bird.bang + @bird.plop + + @bird._verify + end + + it "raises ExpectationError when unexpected method are called" do + @bird.expects.flap_flap + + err = assert_raise ExpectationError do + @bird.shoot + end + assert_match(/wrong method/i, err.message) + end + + it "raises ExpectationError on bad arguments" do + @bird.expects.flap_flap(:swoosh) + + err = assert_raise ExpectationError do + @bird.flap_flap(:rip) + end + assert_match(/wrong arguments/i, err.message) + end + + it "raises VerifyError when not all expected methods are called" do + @bird.expects.flap_flap + @bird.expects.bang + @bird.expects.plop + + @bird.flap_flap + + err = assert_raise VerifyError do + @bird._verify + end + assert_match(/unmet expectations/i, err.message) + end + + it "raises ExpectationError when calls are made out of order" do + @bird.expects.flap_flap + @bird.expects.bang + @bird.expects.plop + + @bird.flap_flap + err = assert_raise ExpectationError do + @bird.plop + end + assert_match(/wrong method/i, err.message) + end + + it "returns the configured value" do + @bird.expects.plop.returns(':P') + assert_equal ':P', @bird.plop + @bird._verify + + @bird.expects.plop.returns(':x') + assert_equal ':x', @bird.plop + @bird._verify + end + + it "returns nil when no return is specified" do + @bird.expects.plop + assert_nil @bird.plop + @bird._verify + end + + it "raises the configured exception" do + err = RuntimeError.new('shaq') + @bird.expects.plop.raises(err) + actual_err = assert_raise RuntimeError do + @bird.plop + end + assert_same err, actual_err, 'should be the same error' + @bird._verify + end + + it "raises a RuntimeError when told to 'raise' a string" do + @bird.expects.plop.raises('shaq') + err = assert_raise RuntimeError do + @bird.plop + end + assert_match(/shaq/i, err.message) + @bird._verify + end + + it "raises a default RuntimeError" do + @bird.expects.plop.raises + err = assert_raise RuntimeError do + @bird.plop + end + assert_match(/error/i, err.message) + @bird._verify + end + + it "is quiet when correct arguments given" do + thing = Object.new + @bird.expects.plop(:big,'one',thing) + @bird.plop(:big,'one',thing) + @bird._verify + end + + it "raises ExpectationError when wrong number of arguments specified" do + thing = Object.new + @bird.expects.plop(:big,'one',thing) + err = assert_raise ExpectationError do + # more + @bird.plop(:big,'one',thing,:other) + end + assert_match(/wrong arguments/i, err.message) + @bird._verify + + @bird.expects.plop(:big,'one',thing) + err = assert_raise ExpectationError do + # less + @bird.plop(:big,'one') + end + assert_match(/wrong arguments/i, err.message) + @bird._verify + + @bird.expects.plop + err = assert_raise ExpectationError do + # less + @bird.plop(:big) + end + assert_match(/wrong arguments/i, err.message) + @bird._verify + end + + it "raises ExpectationError when arguments don't match" do + thing = Object.new + @bird.expects.plop(:big,'one',thing) + err = assert_raise ExpectationError do + @bird.plop(:big,'two',thing,:other) + end + assert_match(/wrong arguments/i, err.message) + @bird._verify + end + + it "can use a block for custom reactions" do + mitt = nil + @bird.expects.plop { mitt = :ball } + assert_nil mitt + @bird.plop + assert_equal :ball, mitt, 'didnt catch the ball' + @bird._verify + + @bird.expects.plop { raise 'ball' } + err = assert_raise RuntimeError do + @bird.plop + end + assert_match(/ball/i, err.message) + @bird._verify + end + + it "passes mock-call arguments to the expectation block" do + ball = nil + mitt = nil + @bird.expects.plop {|arg1,arg2| + ball = arg1 + mitt = arg2 + } + assert_nil ball + assert_nil mitt + @bird.plop(:ball,:mitt) + assert_equal :ball, ball + assert_equal :mitt, mitt + @bird._verify + end + + it "validates arguments if specified in addition to a block" do + ball = nil + mitt = nil + @bird.expects.plop(:ball,:mitt) {|arg1,arg2| + ball = arg1 + mitt = arg2 + } + assert_nil ball + assert_nil mitt + @bird.plop(:ball,:mitt) + assert_equal :ball, ball + assert_equal :mitt, mitt + @bird._verify + + ball = nil + mitt = nil + @bird.expects.plop(:bad,:stupid) {|arg1,arg2| + ball = arg1 + mitt = arg2 + } + assert_nil ball + assert_nil mitt + err = assert_raise ExpectationError do + @bird.plop(:ball,:mitt) + end + assert_match(/wrong arguments/i, err.message) + assert_nil ball + assert_nil mitt + @bird._verify + + ball = nil + mitt = nil + @bird.expects.plop(:ball,:mitt) {|arg1,arg2| + ball = arg1 + mitt = arg2 + } + assert_nil ball + assert_nil mitt + err = assert_raise ExpectationError do + @bird.plop(:ball) + end + assert_match(/wrong arguments/i, err.message) + assert_nil ball + assert_nil mitt + @bird._verify + end + + it "passes runtime blocks to the expectation block as the final argument" do + runtime_block_called = false + got_arg = nil + + # Eg, bird expects someone to subscribe to :tweet using the 'when' method + @bird.expects.when(:tweet) { |arg1, block| + got_arg = arg1 + block.call + } + + @bird.when(:tweet) do + runtime_block_called = true + end + + assert_equal :tweet, got_arg, "Wrong arg" + assert runtime_block_called, "The runtime block should have been invoked by the user block" + + @bird.expects.when(:warnk) { |e,blk| } + + err = assert_raise ExpectationError do + @bird.when(:honk) { } + end + assert_match(/wrong arguments/i, err.message) + + @bird._verify + end + + it "passes the runtime block to the expectation block as sole argument if no other args come into play" do + runtime_block_called = false + @bird.expects.subscribe { |block| block.call } + @bird.subscribe do + runtime_block_called = true + end + assert runtime_block_called, "The runtime block should have been invoked by the user block" + end + + it "provides nil as final argument if expectation block seems to want a block" do + invoked = false + @bird.expects.kablam(:scatter) { |shot,block| + assert_equal :scatter, shot, "Wrong shot" + assert_nil block, "The expectation block should get a nil block when user neglects to pass one" + invoked = true + } + @bird.kablam :scatter + assert invoked, "Expectation block not invoked" + + @bird._verify + end + + it "can set explicit return after an expectation block" do + got = nil + @bird.expects.kablam(:scatter) { |shot| + got = shot + }.returns(:death) + + val = @bird.kablam :scatter + assert_equal :death, val, "Wrong return value" + assert_equal :scatter, got, "Wrong argument" + @bird._verify + end + + it "can raise after an expectation block" do + got = nil + @bird.expects.kablam(:scatter) do |shot| + got = shot + end.raises "hell" + + err = assert_raise RuntimeError do + @bird.kablam :scatter + end + assert_match(/hell/i, err.message) + + @bird._verify + end + + it "stores the semantic value of the expectation block after it executes" do + expectation = @bird.expects.kablam(:slug) { |shot| + "The shot was #{shot}" + } + + assert_not_nil expectation, "Expectation nil" + assert_nil expectation.block_value, "Block value should start out nil" + + ret_val = @bird.kablam :slug + + assert_equal "The shot was slug", expectation.block_value + assert_equal "The shot was slug", ret_val, "Block value should also be used for return" + + @bird._verify + end + + + it "uses the value of the expectation block as the default return value" do + @bird.expects.kablam(:scatter) { |shot| + "The shot was #{shot}" + } + val = @bird.kablam :scatter + assert_equal "The shot was scatter", val, "Wrong return value" + @bird._verify + end + + it "returns the Expectation even if 'returns' is used" do + expectation = @bird.expects.kablam(:slug) { |shot| + "The shot was #{shot}" + }.returns :hosed + + assert_not_nil expectation, "Expectation nil" + assert_nil expectation.block_value, "Block value should start out nil" + + ret_val = @bird.kablam :slug + + assert_equal "The shot was slug", expectation.block_value + assert_equal :hosed, ret_val, "Block value should also be used for return" + + @bird._verify + end + + it "returns the Expectation even if 'raises' is used" do + expectation = @bird.expects.kablam(:slug) { |shot| + "The shot was #{shot}" + }.raises "aiee!" + + assert_not_nil expectation, "Expectation nil" + assert_nil expectation.block_value, "Block value should start out nil" + + err = assert_raise RuntimeError do + @bird.kablam :slug + end + assert_match(/aiee!/i, err.message) + assert_equal "The shot was slug", expectation.block_value + @bird._verify + end + + + it "supports assignment-style methods" do + @bird.expects.size = "large" + @bird.size = "large" + @bird._verify + end + + it "supports assignments and raising (using explicit-method syntax)" do + @bird.expects('size=','large').raises "boom" + + err = assert_raise RuntimeError do + @bird.size = "large" + end + assert_match(/boom/i, err.message) + end + +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/hardmock/test/functional/hardmock_test.rb b/flex-bison/mark1/tools/ceedling/vendor/hardmock/test/functional/hardmock_test.rb new file mode 100644 index 0000000..159d369 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/hardmock/test/functional/hardmock_test.rb @@ -0,0 +1,434 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock' +require 'assert_error' + +class HardmockTest < Test::Unit::TestCase + + # + # TESTS + # + + it "conveniently creates mocks using create_mock and create_mocks" do + + h = create_mock :donkey + assert_equal [ :donkey ], h.keys + + assert_mock_exists :donkey + assert_same @donkey, h[:donkey] + + assert_equal [ :donkey ], @all_mocks.keys, "Wrong keyset for @all_mocks" + + h2 = create_mocks :cat, 'dog' # symbol/string indifference at this level + assert_equal [:cat,:dog].to_set, h2.keys.to_set, "Wrong keyset for second hash" + assert_equal [:cat,:dog,:donkey].to_set, @all_mocks.keys.to_set, "@all_mocks wrong" + + assert_mock_exists :cat + assert_same @cat, h2[:cat] + assert_mock_exists :dog + assert_same @dog, h2[:dog] + + assert_mock_exists :donkey + end + + it "provides literal 'expects' syntax" do + assert_nil @order, "Should be no @order yet" + create_mock :order + assert_not_nil @order, "@order should be built" + + # Setup an expectation + @order.expects.update_stuff :key1 => 'val1', :key2 => 'val2' + + # Use the mock + @order.update_stuff :key1 => 'val1', :key2 => 'val2' + + # Verify + verify_mocks + + # See that it's ok to do it again + verify_mocks + end + + it "supports 'with' for specifying argument expectations" do + create_mocks :car + @car.expects(:fill).with('gas','booze') + @car.fill('gas', 'booze') + verify_mocks + end + + it "supports several mocks at once" do + create_mocks :order_builder, :order, :customer + + @order_builder.expects.create_new_order.returns @order + @customer.expects.account_number.returns(1234) + @order.expects.account_no = 1234 + @order.expects.save! + + # Run "the code" + o = @order_builder.create_new_order + o.account_no = @customer.account_number + o.save! + + verify_mocks + end + + it "enforces inter-mock call ordering" do + create_mocks :order_builder, :order, :customer + + @order_builder.expects.create_new_order.returns @order + @customer.expects.account_number.returns(1234) + @order.expects.account_no = 1234 + @order.expects.save! + + # Run "the code" + o = @order_builder.create_new_order + err = assert_raise ExpectationError do + o.save! + end + assert_match(/wrong object/i, err.message) + assert_match(/order.save!/i, err.message) + assert_match(/customer.account_number/i, err.message) + + assert_error VerifyError, /unmet expectations/i do + verify_mocks + end + end + + class UserPresenter + def initialize(args) + view = args[:view] + model = args[:model] + model.when :data_changes do + view.user_name = model.user_name + end + view.when :user_edited do + model.user_name = view.user_name + end + end + end + + it "makes MVP testing simple" do + mox = create_mocks :model, :view + + data_change = @model.expects.when(:data_changes) { |evt,block| block } + user_edit = @view.expects.when(:user_edited) { |evt,block| block } + + UserPresenter.new mox + + # Expect user name transfer from model to view + @model.expects.user_name.returns 'Da Croz' + @view.expects.user_name = 'Da Croz' + # Trigger data change event in model + data_change.block_value.call + + # Expect user name transfer from view to model + @view.expects.user_name.returns '6:8' + @model.expects.user_name = '6:8' + # Trigger edit event in view + user_edit.block_value.call + + verify_mocks + end + + it "continues to function after verify, if verification error is controlled" do + mox = create_mocks :model, :view + data_change = @model.expects.when(:data_changes) { |evt,block| block } + user_edit = @view.expects.when(:user_edited) { |evt,block| block } + UserPresenter.new mox + + # Expect user name transfer from model to view + @model.expects.user_name.returns 'Da Croz' + @view.expects.user_name = 'Da Croz' + + assert_error ExpectationError, /model.monkey_wrench/i do + @model.monkey_wrench + end + + # This should raise because of unmet expectations + assert_error VerifyError, /unmet expectations/i, /user_name/i do + verify_mocks + end + + # See that the non-forced verification remains quiet + assert_nothing_raised VerifyError do + verify_mocks(false) + end + + @model.expects.never_gonna_happen + + assert_error VerifyError, /unmet expectations/i, /never_gonna_happen/i do + verify_mocks + end + end + + class UserPresenterBroken + def initialize(args) + view = args[:view] + model = args[:model] + model.when :data_changes do + view.user_name = model.user_name + end + # no view stuff, will break appropriately + end + end + + it "flunks for typical Presenter constructor wiring failure" do + mox = create_mocks :model, :view + + data_change = @model.expects.when(:data_changes) { |evt,block| block } + user_edit = @view.expects.when(:user_edited) { |evt,block| block } + + UserPresenterBroken.new mox + + err = assert_raise VerifyError do + verify_mocks + end + assert_match(/unmet expectations/i, err.message) + assert_match(/view.when\(:user_edited\)/i, err.message) + + end + + it "provides convenient event-subscription trap syntax for MVP testing" do + mox = create_mocks :model, :view + + data_change = @model.trap.when(:data_changes) + user_edit = @view.trap.when(:user_edited) + + UserPresenter.new mox + + # Expect user name transfer from model to view + @model.expects.user_name.returns 'Da Croz' + @view.expects.user_name = 'Da Croz' + # Trigger data change event in model + data_change.trigger + + # Expect user name transfer from view to model + @view.expects.user_name.returns '6:8' + @model.expects.user_name = '6:8' + # Trigger edit event in view + user_edit.trigger + + verify_mocks + end + + it "raises if you try to pass an expectation block to 'trap'" do + create_mock :model + assert_error Hardmock::ExpectationError, /blocks/i, /trap/i do + @model.trap.when(:some_event) do raise "huh?" end + end + end + + class Grinder + def initialize(objects) + @chute = objects[:chute] + @bucket = objects[:bucket] + @blade = objects[:blade] + end + + def grind(slot) + @chute.each_bean(slot) do |bean| + @bucket << @blade.chop(bean) + end + end + end + + it "lets you write clear iteration-oriented expectations" do + grinder = Grinder.new create_mocks(:blade, :chute, :bucket) + + # Style 1: assertions on method args is done explicitly in block + @chute.expects.each_bean { |slot,block| + assert_equal :side_slot, slot, "Wrong slot" + block.call :bean1 + block.call :bean2 + } + + @blade.expects.chop(:bean1).returns(:grounds1) + @bucket.expects('<<', :grounds1) + + @blade.expects.chop(:bean2).returns(:grounds2) + @bucket.expects('<<', :grounds2) + + # Run "the code" + grinder.grind(:side_slot) + + verify_mocks + + # Style 2: assertions on method arguments done implicitly in the expectation code + @chute.expects.each_bean(:main_slot) { |slot,block| + block.call :bean3 + } + @blade.expects.chop(:bean3).returns(:grounds3) + @bucket.expects('<<', :grounds3) + grinder.grind :main_slot + verify_mocks + end + + it "further supports iteration testing using 'yield'" do + grinder = Grinder.new create_mocks(:blade, :chute, :bucket) + + @chute.expects.each_bean(:side_slot).yields :bean1, :bean2 + + @blade.expects.chop(:bean1).returns(:grounds1) + @bucket.expects('<<', :grounds1) + + @blade.expects.chop(:bean2).returns(:grounds2) + @bucket.expects('<<', :grounds2) + + grinder.grind :side_slot + + verify_mocks + end + + class HurtLocker + attr_reader :caught + def initialize(opts) + @locker = opts[:locker] + @store = opts[:store] + end + + def do_the_thing(area,data) + @locker.with_lock(area) do + @store.eat(data) + end + rescue => oops + @caught = oops + end + end + + it "makes mutex-style locking scenarios easy to test" do + hurt = HurtLocker.new create_mocks(:locker, :store) + + @locker.expects.with_lock(:main).yields + @store.expects.eat("some info") + + hurt.do_the_thing(:main, "some info") + + verify_mocks + end + + it "makes it easy to simulate error in mutex-style locking scenarios" do + hurt = HurtLocker.new create_mocks(:locker, :store) + err = StandardError.new('fmshooop') + @locker.expects.with_lock(:main).yields + @store.expects.eat("some info").raises(err) + + hurt.do_the_thing(:main, "some info") + + assert_same err, hurt.caught, "Expected that error to be handled internally" + verify_mocks + end + + it "actually returns 'false' instead of nil when mocking boolean return values" do + create_mock :car + @car.expects.ignition_on?.returns(true) + assert_equal true, @car.ignition_on?, "Should be true" + @car.expects.ignition_on?.returns(false) + assert_equal false, @car.ignition_on?, "Should be false" + end + + it "can mock most methods inherited from object using literal syntax" do + target_methods = %w|id clone display dup eql? ==| + create_mock :foo + target_methods.each do |m| + eval %{@foo.expects(m, "some stuff")} + eval %{@foo.#{m} "some stuff"} + end + end + + it "provides 'expect' as an alias for 'expects'" do + create_mock :foo + @foo.expect.boomboom + @foo.boomboom + verify_mocks + end + + it "provides 'should_receive' as an alias for 'expects'" do + create_mock :foo + @foo.should_receive.boomboom + @foo.boomboom + verify_mocks + end + + it "provides 'and_return' as an alias for 'returns'" do + create_mock :foo + @foo.expects(:boomboom).and_return :brick + assert_equal :brick, @foo.boomboom + verify_mocks + end + + it "does not interfere with a core subset of Object methods" do + create_mock :foo + @foo.method(:inspect) + @foo.inspect + @foo.to_s + @foo.instance_variables + @foo.instance_eval("") + verify_mocks + end + + it "can raise errors from within an expectation block" do + create_mock :cat + @cat.expects.meow do |arg| + assert_equal "mix", arg + raise 'HAIRBALL' + end + assert_error RuntimeError, 'HAIRBALL' do + @cat.meow("mix") + end + end + + it "can raise errors AFTER an expectation block" do + create_mock :cat + @cat.expects.meow do |arg| + assert_equal "mix", arg + end.raises('HAIRBALL') + assert_error RuntimeError, 'HAIRBALL' do + @cat.meow("mix") + end + end + + it "raises an immediate error if a mock is created with a nil name (common mistake: create_mock @cat)" do + # I make this mistake all the time: Typing in an instance var name instead of a symbol in create_mocks. + # When you do that, you're effectively passing nil(s) in as mock names. + assert_error ArgumentError, /'nil' is not a valid name for a mock/ do + create_mocks @apples, @oranges + end + end + + it "overrides 'inspect' to make nice output" do + create_mock :hay_bailer + assert_equal "", @hay_bailer.inspect, "Wrong output from 'inspect'" + end + + it "raises if prepare_hardmock_control is invoked after create_mocks, or more than once" do + create_mock :hi_there + create_mocks :another, :one + assert_error RuntimeError, /already setup/ do + prepare_hardmock_control + end + end + + should "support alias verify_hardmocks" do + create_mock :tree + @tree.expects(:grow) + assert_error VerifyError, /unmet/i do + verify_hardmocks + end + end + + # + # HELPERS + # + + def assert_mock_exists(name) + assert_not_nil @all_mocks, "@all_mocks not here yet" + mo = @all_mocks[name] + assert_not_nil mo, "Mock '#{name}' not in @all_mocks" + assert_kind_of Mock, mo, "Wrong type of object, wanted a Mock" + assert_equal name.to_s, mo._name, "Mock '#{name}' had wrong name" + ivar = self.instance_variable_get("@#{name}") + assert_not_nil ivar, "Mock '#{name}' not set as ivar" + assert_same mo, ivar, "Mock '#{name}' ivar not same as instance in @all_mocks" + assert_same @main_mock_control, mo._control, "Mock '#{name}' doesn't share the main mock control" + end +end + diff --git a/flex-bison/mark1/tools/ceedling/vendor/hardmock/test/functional/stubbing_test.rb b/flex-bison/mark1/tools/ceedling/vendor/hardmock/test/functional/stubbing_test.rb new file mode 100644 index 0000000..f07a670 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/hardmock/test/functional/stubbing_test.rb @@ -0,0 +1,479 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock' +require 'assert_error' + +class StubbingTest < Test::Unit::TestCase + + # + # TESTS + # + + it "stubs a class method (and un-stubs after reset_stubs)" do + assert_equal "stones and gravel", Concrete.pour + assert_equal "glug glug", Jug.pour + + Concrete.stubs!(:pour).returns("dust and plaster") + + 3.times do + assert_equal "dust and plaster", Concrete.pour + end + + assert_equal "glug glug", Jug.pour, "Jug's 'pour' method broken" + assert_equal "stones and gravel", Concrete._hardmock_original_pour, "Original 'pour' method not aliased" + + assert_equal "For roads", Concrete.describe, "'describe' method broken" + + reset_stubs + + assert_equal "stones and gravel", Concrete.pour, "'pour' method not restored" + assert_equal "For roads", Concrete.describe, "'describe' method broken after verify" + + end + + it "stubs several class methods" do + Concrete.stubs!(:pour).returns("sludge") + Concrete.stubs!(:describe).returns("awful") + Jug.stubs!(:pour).returns("milk") + + assert_equal "sludge", Concrete.pour + assert_equal "awful", Concrete.describe + assert_equal "milk", Jug.pour + + reset_stubs + + assert_equal "stones and gravel", Concrete.pour + assert_equal "For roads", Concrete.describe + assert_equal "glug glug", Jug.pour + end + + it "stubs instance methods" do + slab = Concrete.new + assert_equal "bonk", slab.hit + + slab.stubs!(:hit).returns("slap") + assert_equal "slap", slab.hit, "'hit' not stubbed" + + reset_stubs + + assert_equal "bonk", slab.hit, "'hit' not restored" + end + + it "stubs instance methods without breaking class methods or other instances" do + slab = Concrete.new + scrape = Concrete.new + assert_equal "an instance", slab.describe + assert_equal "an instance", scrape.describe + assert_equal "For roads", Concrete.describe + + slab.stubs!(:describe).returns("new instance describe") + assert_equal "new instance describe", slab.describe, "'describe' on instance not stubbed" + assert_equal "an instance", scrape.describe, "'describe' on 'scrape' instance broken" + assert_equal "For roads", Concrete.describe, "'describe' class method broken" + + reset_stubs + + assert_equal "an instance", slab.describe, "'describe' instance method not restored" + assert_equal "an instance", scrape.describe, "'describe' on 'scrape' instance broken after restore" + assert_equal "For roads", Concrete.describe, "'describe' class method broken after restore" + end + + should "allow stubbing of nonexistant class methods" do + Concrete.stubs!(:funky).returns('juice') + assert_equal 'juice', Concrete.funky + end + + should "allow stubbing of nonexistant instance methods" do + chunk = Concrete.new + chunk.stubs!(:shark).returns('bite') + assert_equal 'bite', chunk.shark + end + + should "allow re-stubbing" do + Concrete.stubs!(:pour).returns("one") + assert_equal "one", Concrete.pour + + Concrete.stubs!(:pour).raises("hell") + assert_error RuntimeError, /hell/ do + Concrete.pour + end + + Concrete.stubs!(:pour).returns("two") + assert_equal "two", Concrete.pour + + reset_stubs + + assert_equal "stones and gravel", Concrete.pour + end + + it "does nothing with a runtime block when simply stubbing" do + slab = Concrete.new + slab.stubs!(:hit) do |nothing| + raise "BOOOMM!" + end + slab.hit + reset_stubs + end + + it "can raise errors from a stubbed method" do + Concrete.stubs!(:pour).raises(StandardError.new("no!")) + assert_error StandardError, /no!/ do + Concrete.pour + end + end + + it "provides string syntax for convenient raising of RuntimeErrors" do + Concrete.stubs!(:pour).raises("never!") + assert_error RuntimeError, /never!/ do + Concrete.pour + end + end + + + # + # Per-method mocking on classes or instances + # + + it "mocks specific methods on existing classes, and returns the class method to normal after verification" do + + assert_equal "stones and gravel", Concrete.pour, "Concrete.pour is already messed up" + + Concrete.expects!(:pour).returns("ALIGATORS") + assert_equal "ALIGATORS", Concrete.pour + + verify_mocks + assert_equal "stones and gravel", Concrete.pour, "Concrete.pour not restored" + end + + it "flunks if expected class method is not invoked" do + + Concrete.expects!(:pour).returns("ALIGATORS") + assert_error(Hardmock::VerifyError, /Concrete.pour/, /unmet expectations/i) do + verify_mocks + end + clear_expectations + end + + it "supports all normal mock functionality for class methods" do + + Concrete.expects!(:pour, "two tons").returns("mice") + Concrete.expects!(:pour, "three tons").returns("cats") + Concrete.expects!(:pour, "four tons").raises("Can't do it") + Concrete.expects!(:pour) do |some, args| + "==#{some}+#{args}==" + end + + assert_equal "mice", Concrete.pour("two tons") + assert_equal "cats", Concrete.pour("three tons") + assert_error(RuntimeError, /Can't do it/) do + Concrete.pour("four tons") + end + assert_equal "==first+second==", Concrete.pour("first","second") + end + + + it "enforces inter-mock ordering when mocking class methods" do + create_mocks :truck, :foreman + + @truck.expects.backup + Concrete.expects!(:pour, "something") + @foreman.expects.shout + + @truck.backup + assert_error Hardmock::ExpectationError, /wrong/i, /expected call/i, /Concrete.pour/ do + @foreman.shout + end + assert_error Hardmock::VerifyError, /unmet expectations/i, /foreman.shout/ do + verify_mocks + end + clear_expectations + end + + should "allow mocking non-existant class methods" do + Concrete.expects!(:something).returns("else") + assert_equal "else", Concrete.something + end + + it "mocks specific methods on existing instances, then restore them after verify" do + + slab = Concrete.new + assert_equal "bonk", slab.hit + + slab.expects!(:hit).returns("slap") + assert_equal "slap", slab.hit, "'hit' not stubbed" + + verify_mocks + assert_equal "bonk", slab.hit, "'hit' not restored" + end + + it "flunks if expected instance method is not invoked" do + + slab = Concrete.new + slab.expects!(:hit) + + assert_error Hardmock::VerifyError, /unmet expectations/i, /Concrete.hit/ do + verify_mocks + end + clear_expectations + end + + it "supports all normal mock functionality for instance methods" do + + slab = Concrete.new + + slab.expects!(:hit, "soft").returns("hey") + slab.expects!(:hit, "hard").returns("OOF") + slab.expects!(:hit).raises("stoppit") + slab.expects!(:hit) do |some, args| + "==#{some}+#{args}==" + end + + assert_equal "hey", slab.hit("soft") + assert_equal "OOF", slab.hit("hard") + assert_error(RuntimeError, /stoppit/) do + slab.hit + end + assert_equal "==first+second==", slab.hit("first","second") + + end + + it "enforces inter-mock ordering when mocking instance methods" do + create_mocks :truck, :foreman + slab1 = Concrete.new + slab2 = Concrete.new + + @truck.expects.backup + slab1.expects!(:hit) + @foreman.expects.shout + slab2.expects!(:hit) + @foreman.expects.whatever + + @truck.backup + slab1.hit + @foreman.shout + assert_error Hardmock::ExpectationError, /wrong/i, /expected call/i, /Concrete.hit/ do + @foreman.whatever + end + assert_error Hardmock::VerifyError, /unmet expectations/i, /foreman.whatever/ do + verify_mocks + end + clear_expectations + end + + should "allow mocking non-existant instance methods" do + slab = Concrete.new + slab.expects!(:wholly).returns('happy') + assert_equal 'happy', slab.wholly + end + + should "support concrete expectations that deal with runtime blocks" do + + Concrete.expects!(:pour, "a lot") do |how_much, block| + assert_equal "a lot", how_much, "Wrong how_much arg" + assert_not_nil block, "nil runtime block" + assert_equal "the block value", block.call, "Wrong runtime block value" + end + + Concrete.pour("a lot") do + "the block value" + end + + end + + it "can stub methods on mock objects" do + create_mock :horse + @horse.stubs!(:speak).returns("silence") + @horse.stubs!(:hello).returns("nothing") + @horse.expects(:canter).returns("clip clop") + + assert_equal "silence", @horse.speak + assert_equal "clip clop", @horse.canter + assert_equal "silence", @horse.speak + assert_equal "silence", @horse.speak + assert_equal "nothing", @horse.hello + assert_equal "nothing", @horse.hello + + verify_mocks + reset_stubs + end + + it "can stub the new method and return values" do + Concrete.stubs!(:new).returns("this value") + assert_equal "this value", Concrete.new, "did not properly stub new class method" + reset_stubs + end + + it "can mock the new method and return values" do + Concrete.expects!(:new).with("foo").returns("hello") + Concrete.expects!(:new).with("bar").returns("world") + + assert_equal "hello", Concrete.new("foo"), "did not properly mock out new class method" + assert_equal "world", Concrete.new("bar"), "did not properly mock out new class method" + + verify_mocks + reset_stubs + end + + it "can mock several different class methods at once" do + sim_code = lambda do |input| + record = Multitool.find_record(input) + report = Multitool.generate_report(record) + Multitool.format_output(report) + end + + @identifier = "the id" + @record = "the record" + @report = "the report" + @output = "the output" + + Multitool.expects!(:find_record).with(@identifier).returns(@record) + Multitool.expects!(:generate_report).with(@record).returns(@report) + Multitool.expects!(:format_output).with(@report).returns(@output) + + result = sim_code.call(@identifier) + assert_equal @output, result, "Wrong output" + end + + it "can handle a mix of different and repeat class method mock calls" do + prep = lambda { + Multitool.expects!(:find_record).with("A").returns("1") + Multitool.expects!(:generate_report).with("1") + Multitool.expects!(:find_record).with("B").returns("2") + Multitool.expects!(:generate_report).with("2") + } + + prep[] + Multitool.generate_report(Multitool.find_record("A")) + Multitool.generate_report(Multitool.find_record("B")) + + prep[] + Multitool.generate_report(Multitool.find_record("A")) + assert_error Hardmock::ExpectationError, /Wrong arguments/, /find_record\("B"\)/, /find_record\("C"\)/ do + Multitool.generate_report(Multitool.find_record("C")) + end + clear_expectations + end + + it "can mock several concrete instance methods at once" do + inst = OtherMultitool.new + sim_code = lambda do |input| + record = inst.find_record(input) + report = inst.generate_report(record) + inst.format_output(report) + end + + @identifier = "the id" + @record = "the record" + @report = "the report" + @output = "the output" + + inst.expects!(:find_record).with(@identifier).returns(@record) + inst.expects!(:generate_report).with(@record).returns(@report) + inst.expects!(:format_output).with(@report).returns(@output) + + result = sim_code.call(@identifier) + assert_equal @output, result, "Wrong output" + end + + it "verifies all concrete expects! from several different expectations" do + Multitool.expects!(:find_record) + Multitool.expects!(:generate_report) + Multitool.expects!(:format_output) + + Multitool.find_record + Multitool.generate_report + + assert_error Hardmock::VerifyError, /unmet expectations/i, /format_output/i do + verify_mocks + end + end + + it "will not allow expects! to be used on a mock object" do + create_mock :cow + assert_error Hardmock::StubbingError, /expects!/, /mock/i, /something/ do + @cow.expects!(:something) + end + end + + it "does not allow stubbing on nil objects" do + [ nil, @this_is_nil ].each do |nil_obj| + assert_error Hardmock::StubbingError, /cannot/i, /nil/i, /intentionally/ do + nil_obj.stubs!(:wont_work) + end + end + end + + it "does not allow concrete method mocking on nil objects" do + [ nil, @this_is_nil ].each do |nil_obj| + assert_error Hardmock::StubbingError, /cannot/i, /nil/i, /intentionally/ do + nil_obj.expects!(:wont_work) + end + end + end + + it "provides an alternate method for stubbing on nil objects" do + @this_is_nil.intentionally_stubs!(:bogus).returns('output') + assert_equal 'output', @this_is_nil.bogus + end + + it "provides an alternate method for mocking concreate methods on nil objects" do + @this_is_nil.intentionally_expects!(:bogus).returns('output') + assert_error Hardmock::VerifyError, /unmet expectations/i, /NilClass.bogus/ do + verify_mocks + end + end + + # + # HELPERS + # + + class Concrete + def initialize; end + def self.pour + "stones and gravel" + end + + def self.describe + "For roads" + end + + def hit + "bonk" + end + + def describe + "an instance" + end + end + + class Jug + def self.pour + "glug glug" + end + end + + class Multitool + def self.find_record(*a) + raise "The real Multitool.find_record was called with #{a.inspect}" + end + def self.generate_report(*a) + raise "The real Multitool.generate_report was called with #{a.inspect}" + end + def self.format_output(*a) + raise "The real Multitool.format_output was called with #{a.inspect}" + end + end + + class OtherMultitool + def find_record(*a) + raise "The real OtherMultitool#find_record was called with #{a.inspect}" + end + def generate_report(*a) + raise "The real OtherMultitool#generate_report was called with #{a.inspect}" + end + def format_output(*a) + raise "The real OtherMultitool#format_output was called with #{a.inspect}" + end + end + +end + diff --git a/flex-bison/mark1/tools/ceedling/vendor/hardmock/test/test_helper.rb b/flex-bison/mark1/tools/ceedling/vendor/hardmock/test/test_helper.rb new file mode 100644 index 0000000..af159a4 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/hardmock/test/test_helper.rb @@ -0,0 +1,43 @@ +here = File.expand_path(File.dirname(__FILE__)) +$: << here + +require "#{here}/../config/environment" +require 'test/unit' +require 'fileutils' +require 'logger' +require 'find' +require 'yaml' +require 'set' +require 'ostruct' + +class Test::Unit::TestCase + include FileUtils + + def poll(time_limit) + (time_limit * 10).to_i.times do + return true if yield + sleep 0.1 + end + return false + end + + def self.it(str, &block) + make_test_case "it", str, &block + end + + def self.should(str, &block) + make_test_case "should", str, &block + end + + def self.make_test_case(prefix, str, &block) + tname = self.name.sub(/Test$/,'') + if block + define_method "test #{prefix} #{str}" do + instance_eval &block + end + else + puts ">>> UNIMPLEMENTED CASE: #{tname}: #{str}" + end + end + +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/hardmock/test/unit/expectation_builder_test.rb b/flex-bison/mark1/tools/ceedling/vendor/hardmock/test/unit/expectation_builder_test.rb new file mode 100644 index 0000000..f689f98 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/hardmock/test/unit/expectation_builder_test.rb @@ -0,0 +1,19 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/expectation_builder' + +class ExpectationBuilderTest < Test::Unit::TestCase + include Hardmock + + def test_build_expectation + builder = ExpectationBuilder.new + + ex = builder.build_expectation( :stuff => 'inside' ) + assert_not_nil ex, "Didn't build an expectation" + assert_kind_of Expectation, ex, "Wrong type!" + + # Shhhh... fragile, yes, whatever. The functional tests do the + # real testing of this anyway + assert_equal({:stuff => 'inside'}, ex.instance_variable_get('@options'), "Hash not sent to SimpleExpectation constructor") + end + +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/hardmock/test/unit/expectation_test.rb b/flex-bison/mark1/tools/ceedling/vendor/hardmock/test/unit/expectation_test.rb new file mode 100644 index 0000000..54bd204 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/hardmock/test/unit/expectation_test.rb @@ -0,0 +1,372 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/expectation' +require 'hardmock/errors' +require 'assert_error' + +class ExpectationTest < Test::Unit::TestCase + include Hardmock + + def setup + @mock = TheMock.new + end + # + # HELPERS + # + + class TheMock + def _name; 'the_mock'; end + end + class OtherMock + def _name; 'other_mock'; end + end + + # + # TESTS + # + + def test_to_s + ex = Expectation.new( :mock => @mock, :method => 'a_func', :arguments => [1, "two", :three, { :four => 4 }] ) + assert_equal %|the_mock.a_func(1, "two", :three, {:four=>4})|, ex.to_s + end + + def test_apply_method_call + se = Expectation.new(:mock => @mock, :method => 'some_func', + :arguments => [1,'two',:three] ) + + # Try it good: + assert_nothing_raised ExpectationError do + se.apply_method_call( @mock, 'some_func', [1,'two',:three], nil ) + end + + # Bad func name: + err = assert_raise ExpectationError do + se.apply_method_call( @mock, 'wrong_func', [1,'two',:three], nil ) + end + assert_match(/wrong method/i, err.message) + assert_match(/wrong_func/i, err.message) + assert_match(/[1, "two", :three]/i, err.message) + assert_match(/some_func/i, err.message) + assert_match(/the_mock/i, err.message) + + # Wrong mock + err = assert_raise ExpectationError do + se.apply_method_call( OtherMock.new, 'some_func', [1,'two',:three], nil ) + end + assert_match(/[1, "two", :three]/i, err.message) + assert_match(/some_func/i, err.message) + assert_match(/the_mock/i, err.message) + assert_match(/other_mock/i, err.message) + + # Wrong args + err = assert_raise ExpectationError do + se.apply_method_call( @mock, 'some_func', [1,'two',:four], nil) + end + assert_match(/[1, "two", :three]/i, err.message) + assert_match(/[1, "two", :four]/i, err.message) + assert_match(/wrong arguments/i, err.message) + assert_match(/some_func/i, err.message) + end + + def test_apply_method_call_should_call_proc_when_given + # now with a proc + thinger = nil + the_proc = Proc.new { thinger = :shaq } + se = Expectation.new(:mock => @mock, :method => 'some_func', + :block => the_proc) + + # Try it good: + assert_nil thinger + assert_nothing_raised ExpectationError do + se.apply_method_call(@mock, 'some_func', [], nil) + end + assert_equal :shaq, thinger, 'wheres shaq??' + end + + def test_apply_method_call_passes_runtime_block_as_last_argument_to_expectation_block + + passed_block = nil + exp_block_called = false + exp_block = Proc.new { |blk| + exp_block_called = true + passed_block = blk + } + + se = Expectation.new(:mock => @mock, :method => 'some_func', :block => exp_block, + :arguments => []) + + set_flag = false + runtime_block = Proc.new { set_flag = true } + + assert_nil passed_block, "Passed block should be nil" + assert !set_flag, "set_flag should be off" + + # Go + se.apply_method_call( @mock, 'some_func', [], runtime_block) + + # Examine the passed block + assert exp_block_called, "Expectation block not called" + assert_not_nil passed_block, "Should have been passed a block" + assert !set_flag, "set_flag should still be off" + passed_block.call + assert set_flag, "set_flag should be on" + end + + def test_apply_method_call_fails_when_theres_no_expectation_block_to_handle_the_runtime_block + se = Expectation.new(:mock => @mock, :method => 'some_func', :arguments => []) + runtime_block = Proc.new { set_flag = true } + err = assert_raise ExpectationError do + se.apply_method_call( @mock, 'some_func', [], runtime_block) + end + assert_match(/unexpected block/i, err.message) + assert_match(/the_mock.some_func()/i, err.message) + end + + def test_returns + se = Expectation.new(:mock => @mock, :method => 'some_func', + :arguments => [1,'two',:three]) + + se.returns "A value" + + assert_equal "A value", se.apply_method_call(@mock, 'some_func', [1,'two',:three], nil) + end + + def test_apply_method_call_captures_block_value + the_proc = lambda { "in the block" } + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => [], :block => the_proc) + + assert_nil se.block_value, "Block value starts out nil" + + se.apply_method_call(@mock, 'do_it', [], nil) + + assert_equal "in the block", se.block_value, "Block value not captured" + end + + def test_trigger + # convenience method for block_value.call + target = false + inner_proc = lambda { target = true } + the_proc = lambda { inner_proc } + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => [], :block => the_proc) + + assert_nil se.block_value, "Block value starts out nil" + se.apply_method_call(@mock, 'do_it', [], nil) + assert_not_nil se.block_value, "Block value not set" + + assert !target, "Target should still be false" + se.trigger + assert target, "Target not true!" + end + + def test_trigger_with_arguments + # convenience method for block_value.call + target = nil + inner_proc = lambda { |one,two| target = [one,two] } + the_proc = lambda { inner_proc } + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => [], :block => the_proc) + + assert_nil se.block_value, "Block value starts out nil" + se.apply_method_call(@mock, 'do_it', [], nil) + assert_not_nil se.block_value, "Block value not set" + + assert_nil target, "target should still be nil" + se.trigger 'cat','dog' + assert_equal ['cat','dog'], target + end + + def test_trigger_nil_block_value + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => []) + + assert_nil se.block_value, "Block value starts out nil" + se.apply_method_call(@mock, 'do_it', [], nil) + assert_nil se.block_value, "Block value should still be nil" + + err = assert_raise ExpectationError do + se.trigger + end + assert_match(/do_it/i, err.message) + assert_match(/block value/i, err.message) + end + + def test_trigger_non_proc_block_value + the_block = lambda { "woops" } + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => [], :block => the_block) + + se.apply_method_call(@mock, 'do_it', [], nil) + assert_equal "woops", se.block_value + + err = assert_raise ExpectationError do + se.trigger + end + assert_match(/do_it/i, err.message) + assert_match(/trigger/i, err.message) + assert_match(/woops/i, err.message) + end + + + + def test_proc_used_for_return + the_proc = lambda { "in the block" } + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => [], :block => the_proc) + + assert_equal "in the block", se.apply_method_call(@mock, 'do_it', [], nil) + assert_equal "in the block", se.block_value, "Captured block value affected wrongly" + end + + def test_explicit_return_overrides_proc_return + the_proc = lambda { "in the block" } + se = Expectation.new(:mock => @mock, :method => 'do_it', :arguments => [], :block => the_proc) + se.returns "the override" + assert_equal "the override", se.apply_method_call(@mock, 'do_it', [], nil) + assert_equal "in the block", se.block_value, "Captured block value affected wrongly" + end + + def test_yields + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] ) + se.yields :bean1, :bean2 + + things = [] + a_block = lambda { |thinger| things << thinger } + + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + assert_equal [:bean1,:bean2], things, "Wrong things" + end + + def test_yields_block_takes_no_arguments + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] ) + se.yields + + things = [] + a_block = lambda { things << 'OOF' } + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + assert_equal ['OOF'], things + end + + def test_yields_params_to_block_takes_no_arguments + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] ) + se.yields :wont_fit + + things = [] + a_block = lambda { things << 'WUP' } + + err = assert_raise ExpectationError do + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + end + assert_match(/wont_fit/i, err.message) + assert_match(/arity -1/i, err.message) + assert_equal [], things, "Wrong things" + end + + def test_yields_with_returns + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] , + :returns => 'the results') + + exp = se.yields :bean1, :bean2 + assert_same se, exp, "'yields' needs to return a reference to the expectation" + things = [] + a_block = lambda { |thinger| things << thinger } + returned = se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + assert_equal [:bean1,:bean2], things, "Wrong things" + assert_equal 'the results', returned, "Wrong return value" + end + + def test_yields_with_raises + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot], + :raises => RuntimeError.new("kerboom")) + + exp = se.yields :bean1, :bean2 + assert_same se, exp, "'yields' needs to return a reference to the expectation" + things = [] + a_block = lambda { |thinger| things << thinger } + err = assert_raise RuntimeError do + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + end + assert_match(/kerboom/i, err.message) + assert_equal [:bean1,:bean2], things, "Wrong things" + end + + def test_yields_and_inner_block_explodes + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot]) + + exp = se.yields :bean1, :bean2 + assert_same se, exp, "'yields' needs to return a reference to the expectation" + things = [] + a_block = lambda { |thinger| + things << thinger + raise "nasty" + } + err = assert_raise RuntimeError do + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + end + assert_match(/nasty/i, err.message) + assert_equal [:bean1], things, "Wrong things" + end + + def test_yields_with_several_arrays + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] ) + se.yields ['a','b'], ['c','d'] + + things = [] + a_block = lambda { |thinger| things << thinger } + + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + assert_equal [ ['a','b'], ['c','d'] ], things, "Wrong things" + end + + def test_yields_tuples + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] ) + se.yields ['a','b','c'], ['d','e','f'] + + things = [] + a_block = lambda { |left,mid,right| + things << { :left => left, :mid => mid, :right => right } + } + + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + assert_equal [ + {:left => 'a', :mid => 'b', :right => 'c' }, + {:left => 'd', :mid => 'e', :right => 'f' }, + ], things, "Wrong things" + end + + def test_yields_tuples_size_mismatch + se = Expectation.new(:mock => @mock, :method => 'each_bean', :arguments => [:side_slot] ) + se.yields ['a','b','c'], ['d','e','f'] + + things = [] + a_block = lambda { |left,mid| + things << { :left => left, :mid => mid } + } + + err = assert_raise ExpectationError do + se.apply_method_call(@mock,'each_bean',[:side_slot],a_block) + end + assert_match(/arity/i, err.message) + assert_match(/the_mock.each_bean/i, err.message) + assert_match(/"a", "b", "c"/i, err.message) + assert_equal [], things, "Wrong things" + end + + def test_yields_bad_block_arity + se = Expectation.new(:mock => @mock, :method => 'do_later', :arguments => [] ) + se.yields + + assert_error Hardmock::ExpectationError, /block/i, /expected/i, /no param/i, /got 2/i do + se.apply_method_call(@mock,'do_later',[],lambda { |doesnt,match| raise "Surprise!" } ) + end + end + + def test_that_arguments_can_be_added_to_expectation + expectation = Expectation.new(:mock => @mock, :method => "each_bean") + assert_same expectation, expectation.with("jello", "for", "cosby"), "should have returned the same expectation" + + err = assert_raise ExpectationError do + expectation.apply_method_call(@mock, 'each_bean', [], nil) + end + assert_match(/wrong arguments/i, err.message) + + assert_nothing_raised(ExpectationError) do + expectation.apply_method_call(@mock, 'each_bean', ["jello", "for", "cosby"], nil) + end + end + +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/hardmock/test/unit/expector_test.rb b/flex-bison/mark1/tools/ceedling/vendor/hardmock/test/unit/expector_test.rb new file mode 100644 index 0000000..f420db2 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/hardmock/test/unit/expector_test.rb @@ -0,0 +1,57 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/expector' + +class ExpectorTest < Test::Unit::TestCase + include Hardmock + + class MyControl + attr_reader :added + def add_expectation(expectation) + @added ||= [] + @added << expectation + end + end + + class ExpBuilder + attr_reader :options + def build_expectation(options) + @options = options + "dummy expectation" + end + end + + def try_it_with(method_name) + mock = Object.new + mock_control = MyControl.new + builder = ExpBuilder.new + + exp = Expector.new(mock, mock_control, builder) + output = exp.send(method_name,:with, 1, 'sauce') + + assert_same mock, builder.options[:mock] + assert_equal method_name, builder.options[:method].to_s + assert_equal [:with,1,'sauce'], builder.options[:arguments] + assert_nil builder.options[:block] + assert_equal [ "dummy expectation" ], mock_control.added, + "Wrong expectation added to control" + + assert_equal "dummy expectation", output, "Expectation should have been returned" + end + + # + # TESTS + # + def test_method_missing + try_it_with 'wonder_bread' + try_it_with 'whatever' + end + + def test_methods_that_wont_trigger_method_missing + mock = Object.new + mock_control = MyControl.new + builder = ExpBuilder.new + + exp = Expector.new(mock, mock_control, builder) + assert_equal mock, exp.instance_eval("@mock") + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/hardmock/test/unit/method_cleanout_test.rb b/flex-bison/mark1/tools/ceedling/vendor/hardmock/test/unit/method_cleanout_test.rb new file mode 100644 index 0000000..7aa6293 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/hardmock/test/unit/method_cleanout_test.rb @@ -0,0 +1,36 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/method_cleanout' + +class MethodCleanoutTest < Test::Unit::TestCase + class Victim + OriginalMethods = instance_methods + include Hardmock::MethodCleanout + end + + def setup + @victim = Victim.new + end + + def test_should_remove_most_methods_from_a_class + expect_removed = Victim::OriginalMethods.reject { |m| + Hardmock::MethodCleanout::SACRED_METHODS.include?(m) + } + expect_removed.each do |m| + assert !@victim.respond_to?(m), "should not have method #{m}" + end + end + + def test_should_leave_the_sacred_methods_defined + Hardmock::MethodCleanout::SACRED_METHODS.each do |m| + next if m =~ /^hm_/ + assert @victim.respond_to?(m), "Sacred method '#{m}' was removed unexpectedly" + end + end + + def test_should_include_certain_important_methods_in_the_sacred_methods_list + %w|__id__ __send__ equal? object_id send nil? class kind_of? respond_to? inspect method to_s instance_variables instance_eval|.each do |m| + assert Hardmock::MethodCleanout::SACRED_METHODS.include?(m), "important method #{m} is not included in SACRED_METHODS" + end + end + +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/hardmock/test/unit/mock_control_test.rb b/flex-bison/mark1/tools/ceedling/vendor/hardmock/test/unit/mock_control_test.rb new file mode 100644 index 0000000..3c52db6 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/hardmock/test/unit/mock_control_test.rb @@ -0,0 +1,175 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/utils' +require 'hardmock/errors' +require 'hardmock/mock_control' + +class MockControlTest < Test::Unit::TestCase + include Hardmock + + def setup + @unmock = OpenStruct.new( :_name => 'fakemock' ) + + @control = MockControl.new + assert @control.happy?, "Control should start out happy" + end + + def teardown + end + + # + # HELPERS + # + + class MyExp + attr_reader :mock, :mname, :args, :block + def apply_method_call(mock, mname, args, block) + @mock = mock + @mname = mname + @args = args + @block = block + end + end + + class BoomExp < MyExp + def apply_method_call(mock, mname, args, block) + super + raise "BOOM" + end + end + + # + # TESTS + # + + def test_add_exepectation_and_apply_method_call + e1 = MyExp.new + + @control.add_expectation e1 + assert !@control.happy? + + @control.apply_method_call @unmock, 'some_func', [ 'the', :args ], nil + assert @control.happy? + + assert_same @unmock, e1.mock, "Wrong mock" + assert_equal 'some_func', e1.mname, "Wrong method" + assert_equal [ 'the', :args ], e1.args, "Wrong args" + + @control.verify + end + + def test_add_exepectation_and_apply_method_call_with_block + e1 = MyExp.new + + @control.add_expectation e1 + assert !@control.happy? + + runtime_block = Proc.new { "hello" } + @control.apply_method_call @unmock, 'some_func', [ 'the', :args ], runtime_block + assert @control.happy? + + assert_same @unmock, e1.mock, "Wrong mock" + assert_equal 'some_func', e1.mname, "Wrong method" + assert_equal [ 'the', :args ], e1.args, "Wrong args" + assert_equal "hello", e1.block.call, "Wrong block in expectation" + + @control.verify + end + + def test_add_expectation_then_verify + e1 = MyExp.new + + @control.add_expectation e1 + assert !@control.happy?, "Shoudn't be happy" + err = assert_raise VerifyError do + @control.verify + end + assert_match(/unmet expectations/i, err.message) + + @control.apply_method_call @unmock, 'some_func', [ 'the', :args ], nil + assert @control.happy? + + assert_same @unmock, e1.mock, "Wrong mock" + assert_equal 'some_func', e1.mname, "Wrong method" + assert_equal [ 'the', :args ], e1.args, "Wrong args" + + @control.verify + end + + def test_expectation_explosion + be1 = BoomExp.new + + @control.add_expectation be1 + + err = assert_raise RuntimeError do + @control.apply_method_call @unmock, 'a func', [:arg], nil + end + assert_match(/BOOM/i, err.message) + + assert_same @unmock, be1.mock + assert_equal 'a func', be1.mname + assert_equal [:arg], be1.args + end + + def test_disappointment_on_bad_verify + @control.add_expectation MyExp.new + assert !@control.happy?, "Shouldn't be happy" + assert !@control.disappointed?, "too early to be disappointed" + + # See verify fails + err = assert_raise VerifyError do + @control.verify + end + assert_match(/unmet expectations/i, err.message) + + assert !@control.happy?, "Still have unmet expectation" + assert @control.disappointed?, "We should be disappointed following that failure" + + @control.apply_method_call @unmock, 'something', [], nil + assert @control.happy?, "Should be happy" + assert @control.disappointed?, "We should be skeptical" + + @control.verify + + assert !@control.disappointed?, "Should be non-disappointed" + end + + def test_disappointment_from_surprise_calls + assert @control.happy?, "Should be happy" + assert !@control.disappointed?, "too early to be disappointed" + + # See verify fails + err = assert_raise ExpectationError do + @control.apply_method_call @unmock, "something", [], nil + end + assert_match(/surprise/i, err.message) + + assert @control.happy?, "Happiness is an empty list of expectations" + assert @control.disappointed?, "We should be disappointed following that failure" + + @control.verify + assert !@control.disappointed?, "Disappointment should be gone" + end + + def test_disappointment_from_bad_calls + be1 = BoomExp.new + assert !@control.disappointed?, "Shouldn't be disappointed" + @control.add_expectation be1 + assert !@control.disappointed?, "Shouldn't be disappointed" + + err = assert_raise RuntimeError do + @control.apply_method_call @unmock, 'a func', [:arg], nil + end + assert_match(/BOOM/i, err.message) + assert @control.disappointed?, "Should be disappointed" + + assert_same @unmock, be1.mock + assert_equal 'a func', be1.mname + assert_equal [:arg], be1.args + + assert @control.happy?, "Happiness is an empty list of expectations" + @control.verify + assert !@control.disappointed?, "Disappointment should be gone" + end + + +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/hardmock/test/unit/mock_test.rb b/flex-bison/mark1/tools/ceedling/vendor/hardmock/test/unit/mock_test.rb new file mode 100644 index 0000000..2579bcc --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/hardmock/test/unit/mock_test.rb @@ -0,0 +1,279 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/method_cleanout' +require 'hardmock/mock' +require 'hardmock/mock_control' +require 'hardmock/expectation_builder' +require 'hardmock/expector' +require 'hardmock/trapper' + +class MockTest < Test::Unit::TestCase + include Hardmock + + def test_build_with_control + mc1 = MockControl.new + mock = Mock.new('hi', mc1) + assert_equal 'hi', mock._name, "Wrong name" + assert_same mc1, mock._control, "Wrong contol" + end + + def test_basics + mock = Mock.new('a name') + assert_equal 'a name', mock._name, "Wrong name for mock" + assert_not_nil mock._control, "Nil control in mock" + end + + def test_expects + mock = Mock.new('order') + control = mock._control + assert control.happy?, "Mock should start out satisfied" + + mock.expects.absorb_something(:location, 'garbage') + assert !control.happy?, "mock control should be unhappy" + + # Do the call + mock.absorb_something(:location, 'garbage') + assert control.happy?, "mock control should be happy again" + + # Verify + assert_nothing_raised Exception do + mock._verify + end + end + + def test_expects_using_arguments_for_method_and_arguments + mock = Mock.new('order') + mock.expects(:absorb_something, :location, 'garbage') + mock.absorb_something(:location, 'garbage') + mock._verify + end + + def test_expects_using_arguments_for_method_and_arguments_with_block + mock = Mock.new('order') + mock.expects(:absorb_something, :location, 'garbage') { |a,b,block| + assert_equal :location, a, "Wrong 'a' argument" + assert_equal 'garbage', b, "Wrong 'b' argument" + assert_equal 'innards', block.call, "Wrong block" + } + mock.absorb_something(:location, 'garbage') do "innards" end + mock._verify + end + + def test_expects_using_string_method_name + mock = Mock.new('order') + mock.expects('absorb_something', :location, 'garbage') + mock.absorb_something(:location, 'garbage') + mock._verify + end + + + def test_expects_assignment + mock = Mock.new('order') + mock.expects.account_number = 1234 + + mock.account_number = 1234 + + mock._verify + end + + def test_expects_assigment_using_arguments_for_method_and_arguments + mock = Mock.new('order') + mock.expects(:account_number=, 1234) + mock.account_number = 1234 + mock._verify + end + + def test_expects_assigment_using_string_method_name + mock = Mock.new('order') + mock.expects('account_number=', 1234) + mock.account_number = 1234 + mock._verify + end + + def test_expects_assignment_and_return_is_overruled_by_ruby_syntax + # Prove that we can set up a return but that it doesn't mean much, + # because ruby's parser will 'do the right thing' as regards semantic + # values for assignment. (That is, the rvalue of the assignment) + mock = Mock.new('order') + mock.expects(:account_number=, 1234).returns "gold" + got = mock.account_number = 1234 + mock._verify + assert_equal 1234, got, "Expected rvalue" + end + + def test_expects_assignment_and_raise + mock = Mock.new('order') + mock.expects(:account_number=, 1234).raises StandardError.new("kaboom") + err = assert_raise StandardError do + mock.account_number = 1234 + end + assert_match(/kaboom/i, err.message) + mock._verify + end + + + def test_expects_multiple + mock = Mock.new('order') + control = mock._control + + assert control.happy? + + mock.expects.one_thing :hi, { :goose => 'neck' } + mock.expects.another 5,6,7 + assert !control.happy? + + mock.one_thing :hi, { :goose => 'neck' } + assert !control.happy? + + mock.another 5,6,7 + assert control.happy? + end + + def test_surprise_call + mock = Mock.new('order') + err = assert_raise ExpectationError do + mock.uh_oh + end + assert_match(/surprise/i, err.message) + assert_match(/uh_oh/i, err.message) + + err = assert_raise ExpectationError do + mock.whoa :horse + end + assert_match(/surprise/i, err.message) + assert_match(/order\.whoa\(:horse\)/i, err.message) + end + + def test_wrong_call + mock = Mock.new('order') + mock.expects.pig 'arse' + err = assert_raise ExpectationError do + mock.whoa :horse + end + assert_match(/wrong method/i, err.message) + assert_match(/order\.whoa\(:horse\)/i, err.message) + assert_match(/order\.pig\("arse"\)/i, err.message) + end + + def test_wrong_arguments + mock = Mock.new('order') + mock.expects.go_fast(:a, 1, 'three') + + err = assert_raise ExpectationError do + mock.go_fast :a, 1, 'not right' + end + assert_match(/wrong argument/i, err.message) + assert_match(/order\.go_fast\(:a, 1, "three"\)/i, err.message) + assert_match(/order\.go_fast\(:a, 1, "not right"\)/i, err.message) + end + + def test_expects_and_return + mock = Mock.new('order') + mock.expects.delivery_date.returns Date.today + assert_equal Date.today, mock.delivery_date + mock._verify + end + + def test_expects_and_return_with_arguments + mock = Mock.new('order') + mock.expects.delivery_date(:arf,14).returns(Date.today) + assert_equal Date.today, mock.delivery_date(:arf,14) + mock._verify + end + + def test_expects_and_raise + mock = Mock.new('order') + mock.expects.delivery_date.raises StandardError.new("bloof") + + err = assert_raise StandardError do + mock.delivery_date + end + assert_match(/bloof/i, err.message) + + mock._verify + + # Try convenience argument String + mock.expects.pow.raises "hell" + err = assert_raise RuntimeError do + mock.pow + end + assert_match(/hell/i, err.message) + + mock._verify + + # Try convenience argument nothing + mock.expects.pow.raises + err = assert_raise RuntimeError do + mock.pow + end + assert_match(/an error/i, err.message) + + mock._verify + end + + def test_expects_a_runtime_block + mock = Mock.new('order') + got_val = nil + + mock.expects.when(:something) { |e,block| + got_val = block.call + } + + mock.when :something do "hi there" end + + assert_equal "hi there", got_val, "Expectation block not invoked" + mock._verify + end + + def test_trap_block + mock = Mock.new('order') + exp = mock.trap.observe + + # use it + mock.observe { "burp" } + + assert_equal "burp", exp.block_value.call + end + + def test_trap_arguments_and_block + mock = Mock.new('order') + exp = mock.trap.subscribe(:data_changed) + + # use it + mock.subscribe(:data_changed) { "burp" } + assert_equal "burp", exp.block_value.call + mock._verify + end + + def test_trap_arguments_and_block_wrong_num_args + mock = Mock.new('order') + exp = mock.trap.subscribe(:data_changed) + + assert_raise ExpectationError do + mock.subscribe(:data_changed,1) { "burp" } + end + mock._verify + end + + def test_trap_arguments_and_block_wrong_args + mock = Mock.new('order') + exp = mock.trap.subscribe(:data_changed) + + assert_raise ExpectationError do + mock.subscribe("no good") { "burp" } + end + + mock._verify + end + + def test_trap_is_not_leniant_about_arguments + mock = Mock.new('order') + exp = mock.trap.subscribe + + assert_raise ExpectationError do + mock.subscribe("no good") { "burp" } + end + + mock._verify + end + +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/hardmock/test/unit/test_unit_before_after_test.rb b/flex-bison/mark1/tools/ceedling/vendor/hardmock/test/unit/test_unit_before_after_test.rb new file mode 100644 index 0000000..172f527 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/hardmock/test/unit/test_unit_before_after_test.rb @@ -0,0 +1,452 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") + +class TestUnitBeforeAfter < Test::Unit::TestCase + + # + # after_teardown + # + + it "adds TestCase.after_teardown hook for appending post-teardown actions" do + write_and_run_test :use_after_teardown => true + + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "THE TEARDOWN", + "1st after_teardown", + "2nd after_teardown", + "Finished in" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 0 + end + + should "execute all after_teardowns, even if the main teardown flunks" do + write_and_run_test :use_after_teardown => true, :flunk_in_teardown => true + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "F", + "1st after_teardown", + "2nd after_teardown", + "Finished in", + "1) Failure:", + "test_something(MyExampleTest) [_test_file_temp.rb:20]:", + "FLUNK IN TEARDOWN" + see_results :tests => 1, :assertions => 1, :failures => 1, :errors => 0 + end + + should "execute all after_teardowns, even if the main teardown explodes" do + write_and_run_test :use_after_teardown => true, :raise_in_teardown => true + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "E", + "1st after_teardown", + "2nd after_teardown", + "Finished in", + "RuntimeError: ERROR IN TEARDOWN" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 1 + end + + should "execute all after_teardowns, even if some of them flunk" do + write_and_run_test :use_after_teardown => true, :flunk_in_after_teardown => true + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "THE TEARDOWN", + "1st after_teardown", + "F", + "2nd after_teardown", + "Finished in", + "1) Failure:", + "test_something(MyExampleTest) [_test_file_temp.rb:7]:", + "Flunk in first after_teardown", + "2) Failure:", + "test_something(MyExampleTest) [_test_file_temp.rb:10]:", + "Flunk in second after_teardown" + see_results :tests => 1, :assertions => 2, :failures => 2, :errors => 0 + end + + should "execute all after_teardowns, even if some of them explode" do + write_and_run_test :use_after_teardown => true, :raise_in_after_teardown => true + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "THE TEARDOWN", + "1st after_teardown", + "E", + "2nd after_teardown", + "Finished in", + "RuntimeError: Error in first after_teardown", + "RuntimeError: Error in second after_teardown" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 2 + end + + it "will run after_teardowns in the absence of a regular teardown" do + write_and_run_test :omit_teardown => true, :use_after_teardown => true + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "1st after_teardown", + "2nd after_teardown", + "Finished in" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 0 + end + + should "not interfere with normal test writing" do + write_and_run_test + see_in_order "Loaded suite", + "THE SETUP", + "A TEST", + "THE TEARDOWN", + "Finished in" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 0 + end + + it "provides a cleaned-up backtrace" do + write_and_run_test :with_failure => true + see_in_order "Loaded suite", + "THE SETUP", + "A FAILING TEST", + "F", "THE TEARDOWN", + "Finished in", + "1) Failure:", + "test_something(MyExampleTest) [_test_file_temp.rb:17]:", + "Instrumented failure.", + " is not true." + see_results :tests => 1, :assertions => 1, :failures => 1, :errors => 0 + end + + it "provides a cleaned-up backtrace, but not TOO cleaned up" do + write_and_run_test :with_failure => true, :use_helpers => true + see_in_order "Loaded suite", + "THE SETUP", + "A FAILING TEST", + "F", "THE TEARDOWN", + "Finished in", + "1) Failure:", + "test_something(MyExampleTest)\n", + "[_test_file_temp.rb:25:in `tripwire'", + "_test_file_temp.rb:21:in `my_helper'", + "_test_file_temp.rb:17:in `test_something']:", + "Instrumented failure.", + " is not true." + see_results :tests => 1, :assertions => 1, :failures => 1, :errors => 0 + end + + should "not interfere with passthrough exception types" do + if is_modern_test_unit? + write_and_run_test :raise_nasty_in_test => true + see_in_no_particular_order "Loaded suite", + "THE TEARDOWN", + "_test_file_temp.rb:16:in `test_something': NASTY ERROR (NoMemoryError)" + see_no_results + end + end + + # + # before_setup + # + + it "adds TestCase.before_setup hook for prepending pre-setup actions" do + write_and_run_test :use_before_setup => true + see_in_order "Loaded suite", + "3rd before_setup", + "2nd before_setup", + "1st before_setup", + "THE SETUP", + "A TEST", + "THE TEARDOWN", + "Finished in" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 0 + end + + should "stop executing the test on the first failure withing a before_setup action" do + write_and_run_test :use_before_setup => true, :flunk_in_before_setup => true + see_in_order "Loaded suite", + "3rd before_setup", + "2nd before_setup", + "FTHE TEARDOWN", + "1) Failure:", + "test_something(MyExampleTest) [_test_file_temp.rb:10]:", + "Flunk in 2nd before_setup." + see_results :tests => 1, :assertions => 1, :failures => 1, :errors => 0 + end + + should "stop executing the test on the first error within a before_setup action" do + write_and_run_test :use_before_setup => true, :raise_in_before_setup => true + see_in_order "Loaded suite", + "3rd before_setup", + "2nd before_setup", + "ETHE TEARDOWN", + "Finished in", + "test_something(MyExampleTest):", + "RuntimeError: Error in 2nd before_setup", + "_test_file_temp.rb:10", + "/hardmock/lib/test_unit_before_after.rb:", ":in `call'" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 1 + end + + it "will run before_setup actions in the absence of a regular setup" do + write_and_run_test :omit_setup => true, :use_before_setup => true + see_in_order "Loaded suite", + "3rd before_setup", + "2nd before_setup", + "1st before_setup", + "A TEST", + "THE TEARDOWN", + "Finished in" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 0 + end + + it "allows before_setup and after_teardown to be used at the same time" do + write_and_run_test :use_before_setup => true, :use_after_teardown => true + see_in_order "Loaded suite", + "3rd before_setup", + "2nd before_setup", + "1st before_setup", + "A TEST", + "THE TEARDOWN", + "1st after_teardown", + "2nd after_teardown", + "Finished in" + see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 0 + end + + # + # HELPERS + # + + def teardown + remove_test + end + + def test_filename + "_test_file_temp.rb" + end + + def remove_test + rm_f test_filename + end + + def write_and_run_test(opts={}) + write(test_filename, generate_test_code(opts)) + run_test + end + + def run_test + @output = `ruby #{test_filename} 2>&1` + end + + + def write(fname, code) + File.open(fname,"w") do |f| + f.print code + end + end + + def show_output + puts "-- BEGIN TEST OUTPUT" + puts @output + puts "-- END TEST OUTPUT" + end + + def see_in_order(*phrases) + idx = 0 + phrases.each do |txt| + idx = @output.index(txt, idx) + if idx.nil? + if @output.index(txt) + flunk "Phrase '#{txt}' is out-of-order in test output:\n#{@output}" + else + flunk "Phrase '#{txt}' not found in test output:\n#{@output}" + end + end + end + end + + def see_in_no_particular_order(*phrases) + phrases.each do |txt| + assert_not_nil @output.index(txt), "Didn't see '#{txt}' in test output:\n#{@output}" + end + end + + def see_results(opts) + if @output =~ /(\d+) tests, (\d+) assertions, (\d+) failures, (\d+) errors/ + tests, assertions, failures, errors = [ $1, $2, $3, $4 ] + [:tests, :assertions, :failures, :errors].each do |key| + eval %{assert_equal(opts[:#{key}].to_s, #{key}, "Wrong number of #{key} in report") if opts[:#{key}]} + end + else + flunk "Didn't see the test results report line" + end + end + + def see_no_results + if @output =~ /\d+ tests, \d+ assertions, \d+ failures, \d+ errors/ + flunk "Should not have had a results line:\n#{@output}" + end + end + + def lib_dir + File.expand_path(File.dirname(__FILE__) + "/../../lib") + end + + def generate_test_code(opts={}) + + if opts[:with_failure] or opts[:raise_nasty_in_test] + test_method_code = generate_failing_test("test_something", opts) + else + test_method_code = generate_passing_test("test_something") + end + + + requires_for_ext = '' + if opts[:use_before_setup] or opts[:use_after_teardown] + requires_for_ext =<<-RFE + $: << "#{lib_dir}" + require 'test_unit_before_after' + RFE + end + + before_setups = '' + if opts[:use_before_setup] + add_on_two = "" + if opts[:flunk_in_before_setup] + add_on_two = %{; test.flunk "Flunk in 2nd before_setup"} + elsif opts[:raise_in_before_setup] + add_on_two = %{; raise "Error in 2nd before_setup"} + end + before_setups =<<-BSTS + Test::Unit::TestCase.before_setup do |test| + puts "1st before_setup" + end + Test::Unit::TestCase.before_setup do |test| + puts "2nd before_setup" #{add_on_two} + end + Test::Unit::TestCase.before_setup do |test| + puts "3rd before_setup" + end + + BSTS + end + + + setup_code =<<-SC + def setup + puts "THE SETUP" + end + SC + if opts[:omit_setup] + setup_code = "" + end + + after_teardowns = '' + if opts[:use_after_teardown] + add_on_one = "" + add_on_two = "" + if opts[:flunk_in_after_teardown] + add_on_one = %{; test.flunk "Flunk in first after_teardown"} + add_on_two = %{; test.flunk "Flunk in second after_teardown"} + elsif opts[:raise_in_after_teardown] + add_on_one = %{; raise "Error in first after_teardown"} + add_on_two = %{; raise "Error in second after_teardown"} + end + after_teardowns =<<-ATDS + Test::Unit::TestCase.after_teardown do |test| + puts "1st after_teardown" #{add_on_one} + end + Test::Unit::TestCase.after_teardown do |test| + puts "2nd after_teardown" #{add_on_two} + end + ATDS + end + + teardown_code =<<-TDC + def teardown + puts "THE TEARDOWN" + end + TDC + if opts[:flunk_in_teardown] + teardown_code =<<-TDC + def teardown + flunk "FLUNK IN TEARDOWN" + end + TDC + elsif opts[:raise_in_teardown] + teardown_code =<<-TDC + def teardown + raise "ERROR IN TEARDOWN" + end + TDC + end + if opts[:omit_teardown] + teardown_code = "" + end + + str = <<-TCODE + require 'test/unit' + #{requires_for_ext} + + #{before_setups} #{after_teardowns} + + class MyExampleTest < Test::Unit::TestCase + #{setup_code} + #{teardown_code} + #{test_method_code} + end + TCODE + end + + def generate_passing_test(tname) + str = <<-TMETH + def #{tname} + puts "A TEST" + end + TMETH + end + + def generate_failing_test(tname, opts={}) + str = "NOT DEFINED?" + if opts[:raise_nasty_in_test] + str = <<-TMETH + def #{tname} + raise NoMemoryError, "NASTY ERROR" + end + TMETH + + elsif opts[:use_helpers] + str = <<-TMETH + def #{tname} + puts "A FAILING TEST" + my_helper + end + + def my_helper + tripwire + end + + def tripwire + assert false, "Instrumented failure" + end + TMETH + else + str = <<-TMETH + def #{tname} + puts "A FAILING TEST" + assert false, "Instrumented failure" + end + TMETH + end + return str + end + + def is_modern_test_unit? + begin + Test::Unit::TestCase::PASSTHROUGH_EXCEPTIONS + return true + rescue NameError + return false + end + end + +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/hardmock/test/unit/trapper_test.rb b/flex-bison/mark1/tools/ceedling/vendor/hardmock/test/unit/trapper_test.rb new file mode 100644 index 0000000..f7d4114 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/hardmock/test/unit/trapper_test.rb @@ -0,0 +1,62 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/method_cleanout' +require 'hardmock/trapper' + +class TrapperTest < Test::Unit::TestCase + include Hardmock + + def setup + @mock = Object.new + @mock_control = MyControl.new + @builder = ExpBuilder.new + @trapper = Trapper.new(@mock, @mock_control, @builder) + end + + # + # HELPERS + # + + class MyControl + attr_reader :added + def add_expectation(expectation) + @added ||= [] + @added << expectation + end + end + + class ExpBuilder + attr_reader :options + def build_expectation(options) + @options = options + "dummy expectation" + end + end + + # + # TESTS + # + + def test_method_missing + + output = @trapper.change(:less) + + assert_same @mock, @builder.options[:mock] + assert_equal :change, @builder.options[:method] + assert_equal [:less], @builder.options[:arguments] + assert_not_nil @builder.options[:block] + assert @builder.options[:suppress_arguments_to_block], ":suppress_arguments_to_block should be set" + assert_equal [ "dummy expectation" ], @mock_control.added, + "Wrong expectation added to control" + + assert_equal "dummy expectation", output, "Expectation should have been returned" + + # Examine the block. It should take one argument and simply return + # that argument. because of the 'suppress arguments to block' + # setting, the argument can only end up being a block, in practice. + trapper_block = @builder.options[:block] + assert_equal "the argument", trapper_block.call("the argument"), + "The block should merely return the passed argument" + end + + +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/hardmock/test/unit/verify_error_test.rb b/flex-bison/mark1/tools/ceedling/vendor/hardmock/test/unit/verify_error_test.rb new file mode 100644 index 0000000..ecd23fd --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/hardmock/test/unit/verify_error_test.rb @@ -0,0 +1,40 @@ +require File.expand_path(File.dirname(__FILE__) + "/../test_helper") +require 'hardmock/method_cleanout' +require 'hardmock/mock_control' +require 'hardmock/errors' +require 'hardmock/expectation_builder' +require 'hardmock/expectation' +require 'hardmock/mock' + +class VerifyErrorTest < Test::Unit::TestCase + include Hardmock + + # + # TESTS + # + + def test_formatted_list_of_unmet_expectations + mock1 = Mock.new('mock1') + mock2 = Mock.new('mock2') + exp1 = Expectation.new( :mock => mock1, :method => 'send_parts', :arguments => [1,2,:a] ) + exp2 = Expectation.new( :mock => mock2, :method => 'grind_it', :arguments => [] ) + + exp_list = [ exp1, exp2 ] + + err = VerifyError.new("This is the error", exp_list) + assert_equal "This is the error:\n * #{exp1.to_s}\n * #{exp2.to_s}", err.message + end + + def test_empty_list_of_expectations + # this is not a normal case; not spending a lot of time to make this better + exp_list = [] + err = VerifyError.new("This is the error:\n", exp_list) + end + + def test_nil_expectation_list + # this is not a normal case; not spending a lot of time to make this better + exp_list = [] + err = VerifyError.new("This is the error:\n", exp_list) + end + +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/auto/colour_prompt.rb b/flex-bison/mark1/tools/ceedling/vendor/unity/auto/colour_prompt.rb new file mode 100644 index 0000000..81003dd --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/auto/colour_prompt.rb @@ -0,0 +1,94 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +if RUBY_PLATFORM =~/(win|w)32$/ + begin + require 'Win32API' + rescue LoadError + puts "ERROR! \"Win32API\" library not found" + puts "\"Win32API\" is required for colour on a windows machine" + puts " try => \"gem install Win32API\" on the command line" + puts + end + # puts + # puts 'Windows Environment Detected...' + # puts 'Win32API Library Found.' + # puts +end + +class ColourCommandLine + def initialize + if RUBY_PLATFORM =~/(win|w)32$/ + get_std_handle = Win32API.new("kernel32", "GetStdHandle", ['L'], 'L') + @set_console_txt_attrb = + Win32API.new("kernel32","SetConsoleTextAttribute",['L','N'], 'I') + @hout = get_std_handle.call(-11) + end + end + + def change_to(new_colour) + if RUBY_PLATFORM =~/(win|w)32$/ + @set_console_txt_attrb.call(@hout,self.win32_colour(new_colour)) + else + "\033[30;#{posix_colour(new_colour)};22m" + end + end + + def win32_colour(colour) + case colour + when :black then 0 + when :dark_blue then 1 + when :dark_green then 2 + when :dark_cyan then 3 + when :dark_red then 4 + when :dark_purple then 5 + when :dark_yellow, :narrative then 6 + when :default_white, :default, :dark_white then 7 + when :silver then 8 + when :blue then 9 + when :green, :success then 10 + when :cyan, :output then 11 + when :red, :failure then 12 + when :purple then 13 + when :yellow then 14 + when :white then 15 + else + 0 + end + end + + def posix_colour(colour) + case colour + when :black then 30 + when :red, :failure then 31 + when :green, :success then 32 + when :yellow then 33 + when :blue, :narrative then 34 + when :purple, :magenta then 35 + when :cyan, :output then 36 + when :white, :default_white, :default then 37 + else + 30 + end + end + + def out_c(mode, colour, str) + case RUBY_PLATFORM + when /(win|w)32$/ + change_to(colour) + $stdout.puts str if mode == :puts + $stdout.print str if mode == :print + change_to(:default_white) + else + $stdout.puts("#{change_to(colour)}#{str}\033[0m") if mode == :puts + $stdout.print("#{change_to(colour)}#{str}\033[0m") if mode == :print + end + end +end # ColourCommandLine + +def colour_puts(role,str) ColourCommandLine.new.out_c(:puts, role, str) end +def colour_print(role,str) ColourCommandLine.new.out_c(:print, role, str) end + diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/auto/colour_reporter.rb b/flex-bison/mark1/tools/ceedling/vendor/unity/auto/colour_reporter.rb new file mode 100644 index 0000000..5aa1d27 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/auto/colour_reporter.rb @@ -0,0 +1,39 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require "#{File.expand_path(File.dirname(__FILE__))}/colour_prompt" + +$colour_output = true + +def report(message) + if not $colour_output + $stdout.puts(message) + else + message = message.join('\n') if (message.class == Array) + message.each_line do |line| + line.chomp! + colour = case(line) + when /(?:total\s+)?tests:?\s+(\d+)\s+(?:total\s+)?failures:?\s+\d+\s+Ignored:?/i + ($1.to_i == 0) ? :green : :red + when /PASS/ + :green + when /^OK$/ + :green + when /(?:FAIL|ERROR)/ + :red + when /IGNORE/ + :yellow + when /^(?:Creating|Compiling|Linking)/ + :white + else + :silver + end + colour_puts(colour, line) + end + end + $stdout.flush + $stderr.flush +end \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/auto/generate_config.yml b/flex-bison/mark1/tools/ceedling/vendor/unity/auto/generate_config.yml new file mode 100644 index 0000000..4a5e474 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/auto/generate_config.yml @@ -0,0 +1,36 @@ +#this is a sample configuration file for generate_module +#you would use it by calling generate_module with the -ygenerate_config.yml option +#files like this are useful for customizing generate_module to your environment +:generate_module: + :defaults: + #these defaults are used in place of any missing options at the command line + :path_src: ../src/ + :path_inc: ../src/ + :path_tst: ../test/ + :update_svn: true + :includes: + #use [] for no additional includes, otherwise list the includes on separate lines + :src: + - Defs.h + - Board.h + :inc: [] + :tst: + - Defs.h + - Board.h + - Exception.h + :boilerplates: + #these are inserted at the top of generated files. + #just comment out or remove if not desired. + #use %1$s where you would like the file name to appear (path/extension not included) + :src: | + //------------------------------------------- + // %1$s.c + //------------------------------------------- + :inc: | + //------------------------------------------- + // %1$s.h + //------------------------------------------- + :tst: | + //------------------------------------------- + // Test%1$s.c : Units tests for %1$s.c + //------------------------------------------- diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/auto/generate_module.rb b/flex-bison/mark1/tools/ceedling/vendor/unity/auto/generate_module.rb new file mode 100644 index 0000000..3db1a98 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/auto/generate_module.rb @@ -0,0 +1,202 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +# This script creates all the files with start code necessary for a new module. +# A simple module only requires a source file, header file, and test file. +# Triad modules require a source, header, and test file for each triad type (like model, conductor, and hardware). + +require 'rubygems' +require 'fileutils' + +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +#help text when requested +HELP_TEXT = [ "\nGENERATE MODULE\n-------- ------", + "\nUsage: ruby generate_module [options] module_name", + " -i\"include\" sets the path to output headers to 'include' (DEFAULT ../src)", + " -s\"../src\" sets the path to output source to '../src' (DEFAULT ../src)", + " -t\"C:/test\" sets the path to output source to 'C:/test' (DEFAULT ../test)", + " -p\"MCH\" sets the output pattern to MCH.", + " dh - driver hardware.", + " dih - driver interrupt hardware.", + " mch - model conductor hardware.", + " mvp - model view presenter.", + " src - just a single source module. (DEFAULT)", + " -d destroy module instead of creating it.", + " -u update subversion too (requires subversion command line)", + " -y\"my.yml\" selects a different yaml config file for module generation", + "" ].join("\n") + +#Built in patterns +PATTERNS = { 'src' => {'' => { :inc => [] } }, + 'dh' => {'Driver' => { :inc => ['%1$sHardware.h'] }, + 'Hardware' => { :inc => [] } + }, + 'dih' => {'Driver' => { :inc => ['%1$sHardware.h', '%1$sInterrupt.h'] }, + 'Interrupt'=> { :inc => ['%1$sHardware.h'] }, + 'Hardware' => { :inc => [] } + }, + 'mch' => {'Model' => { :inc => [] }, + 'Conductor'=> { :inc => ['%1$sModel.h', '%1$sHardware.h'] }, + 'Hardware' => { :inc => [] } + }, + 'mvp' => {'Model' => { :inc => [] }, + 'Presenter'=> { :inc => ['%1$sModel.h', '%1$sView.h'] }, + 'View' => { :inc => [] } + } + } + +#TEMPLATE_TST +TEMPLATE_TST = %q[#include "unity.h" +%2$s#include "%1$s.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void test_%1$s_NeedToImplement(void) +{ + TEST_IGNORE(); +} +] + +#TEMPLATE_SRC +TEMPLATE_SRC = %q[%2$s#include "%1$s.h" +] + +#TEMPLATE_INC +TEMPLATE_INC = %q[#ifndef _%3$s_H +#define _%3$s_H%2$s + +#endif // _%3$s_H +] + +# Parse the command line parameters. +ARGV.each do |arg| + case(arg) + when /^-d/ then @destroy = true + when /^-u/ then @update_svn = true + when /^-p(\w+)/ then @pattern = $1 + when /^-s(.+)/ then @path_src = $1 + when /^-i(.+)/ then @path_inc = $1 + when /^-t(.+)/ then @path_tst = $1 + when /^-y(.+)/ then @yaml_config = $1 + when /^(\w+)/ + raise "ERROR: You can't have more than one Module name specified!" unless @module_name.nil? + @module_name = arg + when /^-(h|-help)/ + puts HELP_TEXT + exit + else + raise "ERROR: Unknown option specified '#{arg}'" + end +end +raise "ERROR: You must have a Module name specified! (use option -h for help)" if @module_name.nil? + +#load yaml file if one was requested +if @yaml_config + require 'yaml' + cfg = YAML.load_file(HERE + @yaml_config)[:generate_module] + @path_src = cfg[:defaults][:path_src] if @path_src.nil? + @path_inc = cfg[:defaults][:path_inc] if @path_inc.nil? + @path_tst = cfg[:defaults][:path_tst] if @path_tst.nil? + @update_svn = cfg[:defaults][:update_svn] if @update_svn.nil? + @extra_inc = cfg[:includes] + @boilerplates = cfg[:boilerplates] +else + @boilerplates = {} +end + +# Create default file paths if none were provided +@path_src = HERE + "../src/" if @path_src.nil? +@path_inc = @path_src if @path_inc.nil? +@path_tst = HERE + "../test/" if @path_tst.nil? +@path_src += '/' unless (@path_src[-1] == 47) +@path_inc += '/' unless (@path_inc[-1] == 47) +@path_tst += '/' unless (@path_tst[-1] == 47) +@pattern = 'src' if @pattern.nil? +@includes = { :src => [], :inc => [], :tst => [] } +@includes.merge!(@extra_inc) unless @extra_inc.nil? + +#create triad definition +TRIAD = [ { :ext => '.c', :path => @path_src, :template => TEMPLATE_SRC, :inc => :src, :boilerplate => @boilerplates[:src] }, + { :ext => '.h', :path => @path_inc, :template => TEMPLATE_INC, :inc => :inc, :boilerplate => @boilerplates[:inc] }, + { :ext => '.c', :path => @path_tst+'Test', :template => TEMPLATE_TST, :inc => :tst, :boilerplate => @boilerplates[:tst] }, + ] + +#prepare the pattern for use +@patterns = PATTERNS[@pattern.downcase] +raise "ERROR: The design pattern specified isn't one that I recognize!" if @patterns.nil? + +# Assemble the path/names of the files we need to work with. +files = [] +TRIAD.each do |triad| + @patterns.each_pair do |pattern_file, pattern_traits| + files << { + :path => "#{triad[:path]}#{@module_name}#{pattern_file}#{triad[:ext]}", + :name => "#{@module_name}#{pattern_file}", + :template => triad[:template], + :boilerplate => triad[:boilerplate], + :includes => case(triad[:inc]) + when :src then @includes[:src] | pattern_traits[:inc].map{|f| f % [@module_name]} + when :inc then @includes[:inc] + when :tst then @includes[:tst] | pattern_traits[:inc].map{|f| "Mock#{f}"% [@module_name]} + end + } + end +end + +# destroy files if that was what was requested +if @destroy + files.each do |filespec| + file = filespec[:path] + if File.exist?(file) + if @update_svn + `svn delete \"#{file}\" --force` + puts "File #{file} deleted and removed from source control" + else + FileUtils.remove(file) + puts "File #{file} deleted" + end + else + puts "File #{file} does not exist so cannot be removed." + end + end + puts "Destroy Complete" + exit +end + +#Abort if any module already exists +files.each do |file| + raise "ERROR: File #{file[:name]} already exists. Exiting." if File.exist?(file[:path]) +end + +# Create Source Modules +files.each_with_index do |file, i| + File.open(file[:path], 'w') do |f| + f.write(file[:boilerplate] % [file[:name]]) unless file[:boilerplate].nil? + f.write(file[:template] % [ file[:name], + file[:includes].map{|f| "#include \"#{f}\"\n"}.join, + file[:name].upcase ] + ) + end + if (@update_svn) + `svn add \"#{file[:path]}\"` + if $?.exitstatus == 0 + puts "File #{file[:path]} created and added to source control" + else + puts "File #{file[:path]} created but FAILED adding to source control!" + end + else + puts "File #{file[:path]} created" + end +end + +puts 'Generate Complete' diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/auto/generate_test_runner.rb b/flex-bison/mark1/tools/ceedling/vendor/unity/auto/generate_test_runner.rb new file mode 100644 index 0000000..aff5053 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/auto/generate_test_runner.rb @@ -0,0 +1,303 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +File.expand_path(File.join(File.dirname(__FILE__),'colour_prompt')) + +class UnityTestRunnerGenerator + + def initialize(options = nil) + @options = { :includes => [], :plugins => [], :framework => :unity } + case(options) + when NilClass then @options + when String then @options.merge!(UnityTestRunnerGenerator.grab_config(options)) + when Hash then @options.merge!(options) + else raise "If you specify arguments, it should be a filename or a hash of options" + end + end + + def self.grab_config(config_file) + options = { :includes => [], :plugins => [], :framework => :unity } + unless (config_file.nil? or config_file.empty?) + require 'yaml' + yaml_guts = YAML.load_file(config_file) + options.merge!(yaml_guts[:unity] ? yaml_guts[:unity] : yaml_guts[:cmock]) + raise "No :unity or :cmock section found in #{config_file}" unless options + end + return(options) + end + + def run(input_file, output_file, options=nil) + tests = [] + includes = [] + used_mocks = [] + + @options.merge!(options) unless options.nil? + module_name = File.basename(input_file) + + #pull required data from source file + File.open(input_file, 'r') do |input| + tests = find_tests(input) + includes = find_includes(input) + used_mocks = find_mocks(includes) + end + + #build runner file + File.open(output_file, 'w') do |output| + create_header(output, used_mocks) + create_externs(output, tests, used_mocks) + create_mock_management(output, used_mocks) + create_suite_setup_and_teardown(output) + create_reset(output, used_mocks) + create_main(output, input_file, tests) + end + + all_files_used = [input_file, output_file] + all_files_used += includes.map {|filename| filename + '.c'} unless includes.empty? + all_files_used += @options[:includes] unless @options[:includes].empty? + return all_files_used.uniq + end + + def find_tests(input_file) + tests_raw = [] + tests_args = [] + tests_and_line_numbers = [] + + input_file.rewind + source_raw = input_file.read + source_scrubbed = source_raw.gsub(/\/\/.*$/, '') # remove line comments + source_scrubbed = source_scrubbed.gsub(/\/\*.*?\*\//m, '') # remove block comments + lines = source_scrubbed.split(/(^\s*\#.*$) # Treat preprocessor directives as a logical line + | (;|\{|\}) /x) # Match ;, {, and } as end of lines + + lines.each_with_index do |line, index| + #find tests + if line =~ /^((?:\s*TEST_CASE\s*\(.*?\)\s*)*)\s*void\s+(test.*?)\s*\(\s*(.*)\s*\)/ + arguments = $1 + name = $2 + call = $3 + args = nil + if (@options[:use_param_tests] and !arguments.empty?) + args = [] + arguments.scan(/\s*TEST_CASE\s*\((.*)\)\s*$/) {|a| args << a[0]} + end + tests_and_line_numbers << { :name => name, :args => args, :call => call, :line_number => 0 } + tests_args = [] + end + end + + #determine line numbers and create tests to run + source_lines = source_raw.split("\n") + source_index = 0; + tests_and_line_numbers.size.times do |i| + source_lines[source_index..-1].each_with_index do |line, index| + if (line =~ /#{tests_and_line_numbers[i][:name]}/) + source_index += index + tests_and_line_numbers[i][:line_number] = source_index + 1 + break + end + end + end + + return tests_and_line_numbers + end + + def find_includes(input_file) + input_file.rewind + includes = [] + input_file.readlines.each do |line| + scan_results = line.scan(/^\s*#include\s+\"\s*(.+)\.[hH]\s*\"/) + includes << scan_results[0][0] if (scan_results.size > 0) + end + return includes + end + + def find_mocks(includes) + mock_headers = [] + includes.each do |include_file| + mock_headers << File.basename(include_file) if (include_file =~ /^mock/i) + end + return mock_headers + end + + def create_header(output, mocks) + output.puts('/* AUTOGENERATED FILE. DO NOT EDIT. */') + create_runtest(output, mocks) + output.puts("\n//=======Automagically Detected Files To Include=====") + output.puts("#include \"#{@options[:framework].to_s}.h\"") + output.puts('#include "cmock.h"') unless (mocks.empty?) + @options[:includes].flatten.uniq.compact.each do |inc| + output.puts("#include #{inc.include?('<') ? inc : "\"#{inc.gsub('.h','')}.h\""}") + end + output.puts('#include ') + output.puts('#include ') + output.puts('#include "CException.h"') if @options[:plugins].include?(:cexception) + mocks.each do |mock| + output.puts("#include \"#{mock.gsub('.h','')}.h\"") + end + if @options[:enforce_strict_ordering] + output.puts('') + output.puts('int GlobalExpectCount;') + output.puts('int GlobalVerifyOrder;') + output.puts('char* GlobalOrderError;') + end + end + + def create_externs(output, tests, mocks) + output.puts("\n//=======External Functions This Runner Calls=====") + output.puts("extern void setUp(void);") + output.puts("extern void tearDown(void);") + tests.each do |test| + output.puts("extern void #{test[:name]}(#{test[:call]});") + end + output.puts('') + end + + def create_mock_management(output, mocks) + unless (mocks.empty?) + output.puts("\n//=======Mock Management=====") + output.puts("static void CMock_Init(void)") + output.puts("{") + if @options[:enforce_strict_ordering] + output.puts(" GlobalExpectCount = 0;") + output.puts(" GlobalVerifyOrder = 0;") + output.puts(" GlobalOrderError = NULL;") + end + mocks.each do |mock| + output.puts(" #{mock}_Init();") + end + output.puts("}\n") + + output.puts("static void CMock_Verify(void)") + output.puts("{") + mocks.each do |mock| + output.puts(" #{mock}_Verify();") + end + output.puts("}\n") + + output.puts("static void CMock_Destroy(void)") + output.puts("{") + mocks.each do |mock| + output.puts(" #{mock}_Destroy();") + end + output.puts("}\n") + end + end + + def create_suite_setup_and_teardown(output) + unless (@options[:suite_setup].nil?) + output.puts("\n//=======Suite Setup=====") + output.puts("static int suite_setup(void)") + output.puts("{") + output.puts(@options[:suite_setup]) + output.puts("}") + end + unless (@options[:suite_teardown].nil?) + output.puts("\n//=======Suite Teardown=====") + output.puts("static int suite_teardown(int num_failures)") + output.puts("{") + output.puts(@options[:suite_teardown]) + output.puts("}") + end + end + + def create_runtest(output, used_mocks) + cexception = @options[:plugins].include? :cexception + va_args1 = @options[:use_param_tests] ? ', ...' : '' + va_args2 = @options[:use_param_tests] ? '__VA_ARGS__' : '' + output.puts("\n//=======Test Runner Used To Run Each Test Below=====") + output.puts("#define RUN_TEST_NO_ARGS") if @options[:use_param_tests] + output.puts("#define RUN_TEST(TestFunc, TestLineNum#{va_args1}) \\") + output.puts("{ \\") + output.puts(" Unity.CurrentTestName = #TestFunc#{va_args2.empty? ? '' : " \"(\" ##{va_args2} \")\""}; \\") + output.puts(" Unity.CurrentTestLineNumber = TestLineNum; \\") + output.puts(" Unity.NumberOfTests++; \\") + output.puts(" if (TEST_PROTECT()) \\") + output.puts(" { \\") + output.puts(" CEXCEPTION_T e; \\") if cexception + output.puts(" Try { \\") if cexception + output.puts(" CMock_Init(); \\") unless (used_mocks.empty?) + output.puts(" setUp(); \\") + output.puts(" TestFunc(#{va_args2}); \\") + output.puts(" CMock_Verify(); \\") unless (used_mocks.empty?) + output.puts(" } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, \"Unhandled Exception!\"); } \\") if cexception + output.puts(" } \\") + output.puts(" CMock_Destroy(); \\") unless (used_mocks.empty?) + output.puts(" if (TEST_PROTECT() && !TEST_IS_IGNORED) \\") + output.puts(" { \\") + output.puts(" tearDown(); \\") + output.puts(" } \\") + output.puts(" UnityConcludeTest(); \\") + output.puts("}\n") + end + + def create_reset(output, used_mocks) + output.puts("\n//=======Test Reset Option=====") + output.puts("void resetTest()") + output.puts("{") + output.puts(" CMock_Verify();") unless (used_mocks.empty?) + output.puts(" CMock_Destroy();") unless (used_mocks.empty?) + output.puts(" tearDown();") + output.puts(" CMock_Init();") unless (used_mocks.empty?) + output.puts(" setUp();") + output.puts("}") + end + + def create_main(output, filename, tests) + output.puts("\n\n//=======MAIN=====") + output.puts("int main(void)") + output.puts("{") + output.puts(" suite_setup();") unless @options[:suite_setup].nil? + output.puts(" Unity.TestFile = \"#{filename}\";") + output.puts(" UnityBegin();") + if (@options[:use_param_tests]) + tests.each do |test| + if ((test[:args].nil?) or (test[:args].empty?)) + output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]}, RUN_TEST_NO_ARGS);") + else + test[:args].each {|args| output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]}, #{args});")} + end + end + else + tests.each { |test| output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]});") } + end + output.puts() + output.puts(" return #{@options[:suite_teardown].nil? ? "" : "suite_teardown"}(UnityEnd());") + output.puts("}") + end +end + + +if ($0 == __FILE__) + options = { :includes => [] } + yaml_file = nil + + #parse out all the options first + ARGV.reject! do |arg| + case(arg) + when '-cexception' + options[:plugins] = [:cexception]; true + when /\.*\.yml/ + options = UnityTestRunnerGenerator.grab_config(arg); true + else false + end + end + + #make sure there is at least one parameter left (the input file) + if !ARGV[0] + puts ["usage: ruby #{__FILE__} (yaml) (options) input_test_file output_test_runner (includes)", + " blah.yml - will use config options in the yml file (see docs)", + " -cexception - include cexception support"].join("\n") + exit 1 + end + + #create the default test runner name if not specified + ARGV[1] = ARGV[0].gsub(".c","_Runner.c") if (!ARGV[1]) + + #everything else is an include file + options[:includes] ||= (ARGV.slice(2..-1).flatten.compact) if (ARGV.size > 2) + + UnityTestRunnerGenerator.new(options).run(ARGV[0], ARGV[1]) +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/auto/test_file_filter.rb b/flex-bison/mark1/tools/ceedling/vendor/unity/auto/test_file_filter.rb new file mode 100644 index 0000000..3dbc26a --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/auto/test_file_filter.rb @@ -0,0 +1,23 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require'yaml' + +module RakefileHelpers + class TestFileFilter + def initialize(all_files = false) + @all_files = all_files + if not @all_files == true + if File.exist?('test_file_filter.yml') + filters = YAML.load_file( 'test_file_filter.yml' ) + @all_files, @only_files, @exclude_files = + filters[:all_files], filters[:only_files], filters[:exclude_files] + end + end + end + attr_accessor :all_files, :only_files, :exclude_files + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/auto/unity_test_summary.rb b/flex-bison/mark1/tools/ceedling/vendor/unity/auto/unity_test_summary.rb new file mode 100644 index 0000000..69ec2e8 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/auto/unity_test_summary.rb @@ -0,0 +1,126 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +#!/usr/bin/ruby +# +# unity_test_summary.rb +# +require 'fileutils' +require 'set' + +class UnityTestSummary + include FileUtils::Verbose + + attr_reader :report, :total_tests, :failures, :ignored + + def initialize + @report = '' + @total_tests = 0 + @failures = 0 + @ignored = 0 + end + + def run + # Clean up result file names + results = @targets.map {|target| target.gsub(/\\/,'/')} + + # Dig through each result file, looking for details on pass/fail: + failure_output = [] + ignore_output = [] + + results.each do |result_file| + lines = File.readlines(result_file).map { |line| line.chomp } + if lines.length == 0 + raise "Empty test result file: #{result_file}" + else + output = get_details(result_file, lines) + failure_output << output[:failures] unless output[:failures].empty? + ignore_output << output[:ignores] unless output[:ignores].empty? + tests,failures,ignored = parse_test_summary(lines) + @total_tests += tests + @failures += failures + @ignored += ignored + end + end + + if @ignored > 0 + @report += "\n" + @report += "--------------------------\n" + @report += "UNITY IGNORED TEST SUMMARY\n" + @report += "--------------------------\n" + @report += ignore_output.flatten.join("\n") + end + + if @failures > 0 + @report += "\n" + @report += "--------------------------\n" + @report += "UNITY FAILED TEST SUMMARY\n" + @report += "--------------------------\n" + @report += failure_output.flatten.join("\n") + end + + @report += "\n" + @report += "--------------------------\n" + @report += "OVERALL UNITY TEST SUMMARY\n" + @report += "--------------------------\n" + @report += "#{@total_tests} TOTAL TESTS #{@failures} TOTAL FAILURES #{@ignored} IGNORED\n" + @report += "\n" + end + + def set_targets(target_array) + @targets = target_array + end + + def set_root_path(path) + @root = path + end + + def usage(err_msg=nil) + puts err_msg if err_msg + puts "Usage: unity_test_summary.rb" + exit 1 + end + + protected + + @@targets=nil + @@path=nil + @@root=nil + + def get_details(result_file, lines) + results = { :failures => [], :ignores => [], :successes => [] } + lines.each do |line| + src_file,src_line,test_name,status,msg = line.split(/:/) + line_out = ((@root and (@root != 0)) ? "#{@root}#{line}" : line ).gsub(/\//, "\\") + case(status) + when 'IGNORE' then results[:ignores] << line_out + when 'FAIL' then results[:failures] << line_out + when 'PASS' then results[:successes] << line_out + end + end + return results + end + + def parse_test_summary(summary) + if summary[-3..-1].join("\n") =~ /(\d+) Tests (\d+) Failures (\d+) Ignored/ + [$1.to_i,$2.to_i,$3.to_i] + else + raise "Couldn't parse test results: #{summary}" + end + end + + def here; File.expand_path(File.dirname(__FILE__)); end + +end + +if $0 == __FILE__ + script = UnityTestSummary.new + begin + script.run + rescue Exception => e + script.usage e.message + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/docs/Unity Summary.odt b/flex-bison/mark1/tools/ceedling/vendor/unity/docs/Unity Summary.odt new file mode 100644 index 0000000..f699661 Binary files /dev/null and b/flex-bison/mark1/tools/ceedling/vendor/unity/docs/Unity Summary.odt differ diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/docs/Unity Summary.pdf b/flex-bison/mark1/tools/ceedling/vendor/unity/docs/Unity Summary.pdf new file mode 100644 index 0000000..ad1a956 Binary files /dev/null and b/flex-bison/mark1/tools/ceedling/vendor/unity/docs/Unity Summary.pdf differ diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/docs/Unity Summary.txt b/flex-bison/mark1/tools/ceedling/vendor/unity/docs/Unity Summary.txt new file mode 100644 index 0000000..e0b179d --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/docs/Unity Summary.txt @@ -0,0 +1,217 @@ +============== +Unity Test API +============== + +[Copyright (c) 2007 - Unity Project by Mike Karlesky, Mark VanderVoord, and Greg Williams] + +------------- +Running Tests +------------- + +RUN_TEST(func, linenum) + +Each Test is run within the macro RUN_TEST. This macro performs necessary setup before the test is called and handles cleanup and result tabulation afterwards. + +-------------- +Ignoring Tests +-------------- + +There are times when a test is incomplete or not valid for some reason. At these times, TEST_IGNORE can be called. Control will immediately be returned to the caller of the test, and no failures will be returned. + +TEST_IGNORE() + +Ignore this test and return immediately + +TEST_IGNORE_MESSAGE (message) + +Ignore this test and return immediately. Output a message stating why the test was ignored. + +-------------- +Aborting Tests +-------------- + +There are times when a test will contain an infinite loop on error conditions, or there may be reason to escape from the test early without executing the rest of the test. A pair of macros support this functionality in Unity. The first (TEST_PROTECT) sets up the feature, and handles emergency abort cases. TEST_ABORT can then be used at any time within the tests to return to the last TEST_PROTECT call. + +TEST_PROTECT() + +Setup and Catch macro + +TEST_ABORT() + +Abort Test macro + +Example: + +main() +{ + if (TEST_PROTECT() == 0) + { + MyTest(); + } +} + +If MyTest calls TEST_ABORT, program control will immediately return to TEST_PROTECT with a non-zero return value. + + +======================= +Unity Assertion Summary +======================= + +-------------------- +Basic Validity Tests +-------------------- + +TEST_ASSERT_TRUE(condition) + +Evaluates whatever code is in condition and fails if it evaluates to false + +TEST_ASSERT_FALSE(condition) + +Evaluates whatever code is in condition and fails if it evaluates to true + +TEST_ASSERT(condition) + +Another way of calling TEST_ASSERT_TRUE + +TEST_ASSERT_UNLESS(condition) + +Another way of calling TEST_ASSERT_FALSE + +TEST_FAIL() +TEST_FAIL_MESSAGE(message) + +This test is automatically marked as a failure. The message is output stating why. + +------------------------------ +Numerical Assertions: Integers +------------------------------ + +TEST_ASSERT_EQUAL_INT(expected, actual) +TEST_ASSERT_EQUAL_INT8(expected, actual) +TEST_ASSERT_EQUAL_INT16(expected, actual) +TEST_ASSERT_EQUAL_INT32(expected, actual) +TEST_ASSERT_EQUAL_INT64(expected, actual) + +Compare two integers for equality and display errors as signed integers. A cast will be performed +to your natural integer size so often this can just be used. When you need to specify the exact size, +like when comparing arrays, you can use a specific version: + + + +TEST_ASSERT_EQUAL_UINT(expected, actual) + +Compare two integers for equality and display errors as unsigned integers. Like INT, there are +variants for different sizes also. + + + +TEST_ASSERT_EQUAL_HEX(expected, actual) + +Compares two integers for equality and display errors as hexadecimal. Like the other integer comparisons, +you can specify the size... here the size will also effect how many nibbles are shown (for example, HEX16 +will show 4 nibbles). + +_ARRAY + +You can append _ARRAY to any of these macros to make an array comparison of that type. Here you will +need to care a bit more about the actual size of the value being checked. You will also specify an +additional argument which is the number of elements to compare. For example: + +TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, elements) + + +TEST_ASSERT_EQUAL(expected, actual) + +Another way of calling TEST_ASSERT_EQUAL_INT + + + +TEST_ASSERT_INT_WITHIN(delta, expected, actual) + +Asserts that the actual value is within plus or minus delta of the expected value. This also comes in +size specific variants. + + +----------------------------- +Numerical Assertions: Bitwise +----------------------------- + +TEST_ASSERT_BITS(mask, expected, actual) + +Use an integer mask to specify which bits should be compared between two other integers. High bits in the mask are compared, low bits ignored. + +TEST_ASSERT_BITS_HIGH(mask, actual) + +Use an integer mask to specify which bits should be inspected to determine if they are all set high. High bits in the mask are compared, low bits ignored. + +TEST_ASSERT_BITS_LOW(mask, actual) + +Use an integer mask to specify which bits should be inspected to determine if they are all set low. High bits in the mask are compared, low bits ignored. + +TEST_ASSERT_BIT_HIGH(bit, actual) + +Test a single bit and verify that it is high. The bit is specified 0-31 for a 32-bit integer. + +TEST_ASSERT_BIT_LOW(bit, actual) + +Test a single bit and verify that it is low. The bit is specified 0-31 for a 32-bit integer. + +---------------------------- +Numerical Assertions: Floats +---------------------------- + +TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual) + +Asserts that the actual value is within plus or minus delta of the expected value. + +TEST_ASSERT_EQUAL_FLOAT(expected, actual) + +Asserts that two floating point values are "equal" within a small % delta of the expected value. + +----------------- +String Assertions +----------------- + +TEST_ASSERT_EQUAL_STRING(expected, actual) + +Compare two null-terminate strings. Fail if any character is different or if the lengths are different. + +TEST_ASSERT_EQUAL_STRING_MESSAGE(expected, actual, message) + +Compare two null-terminate strings. Fail if any character is different or if the lengths are different. Output a custom message on failure. + +------------------ +Pointer Assertions +------------------ + +Most pointer operations can be performed by simply using the integer comparisons above. However, a couple of special cases are added for clarity. + +TEST_ASSERT_NULL(pointer) + +Fails if the pointer is not equal to NULL + +TEST_ASSERT_NOT_NULL(pointer) + +Fails if the pointer is equal to NULL + + +----------------- +Memory Assertions +----------------- + +TEST_ASSERT_EQUAL_MEMORY(expected, actual, len) + +Compare two blocks of memory. This is a good generic assertion for types that can't be coerced into acting like +standard types... but since it's a memory compare, you have to be careful that your data types are packed. + +-------- +_MESSAGE +-------- + +you can append _MESSAGE to any of the macros to make them take an additional argument. This argument +is a string that will be printed at the end of the failure strings. This is useful for specifying more +information about the problem. + + + + diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/docs/license.txt b/flex-bison/mark1/tools/ceedling/vendor/unity/docs/license.txt new file mode 100644 index 0000000..c42e330 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/docs/license.txt @@ -0,0 +1,31 @@ + Copyright (c) 2007-2010 Mike Karlesky, Mark VanderVoord, Greg Williams + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + The end-user documentation included with the redistribution, if + any, must include the following acknowledgment: "This product + includes software developed for the Unity Project, by Mike Karlesky, + Mark VanderVoord, and Greg Williams and other contributors", in + the same place and form as other third-party acknowledgments. + Alternately, this acknowledgment may appear in the software + itself, in the same form and location as other such third-party + acknowledgments. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/examples/helper/UnityHelper.c b/flex-bison/mark1/tools/ceedling/vendor/unity/examples/helper/UnityHelper.c new file mode 100644 index 0000000..9cf42c6 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/examples/helper/UnityHelper.c @@ -0,0 +1,10 @@ +#include "unity.h" +#include "UnityHelper.h" +#include +#include + +void AssertEqualExampleStruct(const EXAMPLE_STRUCT_T expected, const EXAMPLE_STRUCT_T actual, const unsigned short line) +{ + UNITY_TEST_ASSERT_EQUAL_INT(expected.x, actual.x, line, "Example Struct Failed For Field x"); + UNITY_TEST_ASSERT_EQUAL_INT(expected.y, actual.y, line, "Example Struct Failed For Field y"); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/examples/helper/UnityHelper.h b/flex-bison/mark1/tools/ceedling/vendor/unity/examples/helper/UnityHelper.h new file mode 100644 index 0000000..1516111 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/examples/helper/UnityHelper.h @@ -0,0 +1,12 @@ +#ifndef _TESTHELPER_H +#define _TESTHELPER_H + +#include "Types.h" + +void AssertEqualExampleStruct(const EXAMPLE_STRUCT_T expected, const EXAMPLE_STRUCT_T actual, const unsigned short line); + +#define UNITY_TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(expected, actual, line, message) AssertEqualExampleStruct(expected, actual, line); + +#define TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(expected, actual) UNITY_TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(expected, actual, __LINE__, NULL); + +#endif // _TESTHELPER_H diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/examples/makefile b/flex-bison/mark1/tools/ceedling/vendor/unity/examples/makefile new file mode 100644 index 0000000..723d390 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/examples/makefile @@ -0,0 +1,40 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +C_COMPILER=gcc +TARGET_BASE1=test1 +TARGET_BASE2=test2 +ifeq ($(OS),Windows_NT) + TARGET_EXTENSION=.exe +else + TARGET_EXTENSION=.out +endif +TARGET1 = $(TARGET_BASE1)$(TARGET_EXTENSION) +TARGET2 = $(TARGET_BASE2)$(TARGET_EXTENSION) +SRC_FILES1=../src/unity.c src/ProductionCode.c test/TestProductionCode.c test/no_ruby/TestProductionCode_Runner.c +SRC_FILES2=../src/unity.c src/ProductionCode2.c test/TestProductionCode2.c test/no_ruby/TestProductionCode2_Runner.c +INC_DIRS=-Isrc -I../src +SYMBOLS=-DTEST + +ifeq ($(OS),Windows_NT) + CLEANUP = del /F /Q build\* && del /F /Q $(TARGET1) && del /F /Q $(TARGET2) +else + CLEANUP = rm -f build/*.o ; rm -f $(TARGET1) ; rm -f $(TARGET2) +endif + +all: clean default + +default: +# ruby auto/generate_test_runner.rb test/TestProductionCode.c test/no_ruby/TestProductionCode_Runner.c +# ruby auto/generate_test_runner.rb test/TestProductionCode2.c test/no_ruby/TestProductionCode2_Runner.c + $(C_COMPILER) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES1) -o $(TARGET1) + $(C_COMPILER) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES2) -o $(TARGET2) + $(TARGET1) + $(TARGET2) + +clean: + $(CLEANUP) + diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/examples/rakefile.rb b/flex-bison/mark1/tools/ceedling/vendor/unity/examples/rakefile.rb new file mode 100644 index 0000000..0905b4b --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/examples/rakefile.rb @@ -0,0 +1,32 @@ +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require HERE+'rakefile_helper' + +include RakefileHelpers + +# Load default configuration, for now +DEFAULT_CONFIG_FILE = 'gcc.yml' +configure_toolchain(DEFAULT_CONFIG_FILE) + +task :unit do + run_tests get_unit_test_files +end + +desc "Generate test summary" +task :summary do + report_summary +end + +desc "Build and test Unity" +task :all => [:clean, :unit, :summary] +task :default => [:clobber, :all] +task :ci => [:default] +task :cruise => [:default] + +desc "Load configuration" +task :config, :config_file do |t, args| + configure_toolchain(args[:config_file]) +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/examples/rakefile_helper.rb b/flex-bison/mark1/tools/ceedling/vendor/unity/examples/rakefile_helper.rb new file mode 100644 index 0000000..0127d69 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/examples/rakefile_helper.rb @@ -0,0 +1,260 @@ +require 'yaml' +require 'fileutils' +require HERE+'../auto/unity_test_summary' +require HERE+'../auto/generate_test_runner' +require HERE+'../auto/colour_reporter' + +module RakefileHelpers + + C_EXTENSION = '.c' + + def load_configuration(config_file) + $cfg_file = "../targets/#{config_file}" + $cfg = YAML.load(File.read($cfg_file)) + end + + def configure_clean + CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil? + end + + def configure_toolchain(config_file=DEFAULT_CONFIG_FILE) + config_file += '.yml' unless config_file =~ /\.yml$/ + load_configuration('../targets/'+config_file) + configure_clean + end + + def get_unit_test_files + path = $cfg['compiler']['unit_tests_path'] + 'Test*' + C_EXTENSION + path.gsub!(/\\/, '/') + FileList.new(path) + end + + def get_local_include_dirs + include_dirs = $cfg['compiler']['includes']['items'].dup + include_dirs.delete_if {|dir| dir.is_a?(Array)} + return include_dirs + end + + def extract_headers(filename) + includes = [] + lines = File.readlines(filename) + lines.each do |line| + m = line.match(/^\s*#include\s+\"\s*(.+\.[hH])\s*\"/) + if not m.nil? + includes << m[1] + end + end + return includes + end + + def find_source_file(header, paths) + paths.each do |dir| + src_file = dir + header.ext(C_EXTENSION) + if (File.exists?(src_file)) + return src_file + end + end + return nil + end + + def tackit(strings) + if strings.is_a?(Array) + result = "\"#{strings.join}\"" + else + result = strings + end + return result + end + + def squash(prefix, items) + result = '' + items.each { |item| result += " #{prefix}#{tackit(item)}" } + return result + end + + def build_compiler_fields + command = tackit($cfg['compiler']['path']) + if $cfg['compiler']['defines']['items'].nil? + defines = '' + else + defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items']) + end + options = squash('', $cfg['compiler']['options']) + includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :defines => defines, :options => options, :includes => includes} + end + + def compile(file, defines=[]) + compiler = build_compiler_fields + cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{file} " + + "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" + + "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" + execute(cmd_str) + end + + def build_linker_fields + command = tackit($cfg['linker']['path']) + if $cfg['linker']['options'].nil? + options = '' + else + options = squash('', $cfg['linker']['options']) + end + if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?) + includes = '' + else + includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) + end + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :options => options, :includes => includes} + end + + def link(exe_name, obj_list) + linker = build_linker_fields + cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + + (obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).join + + $cfg['linker']['bin_files']['prefix'] + ' ' + + $cfg['linker']['bin_files']['destination'] + + exe_name + $cfg['linker']['bin_files']['extension'] + execute(cmd_str) + end + + def build_simulator_fields + return nil if $cfg['simulator'].nil? + if $cfg['simulator']['path'].nil? + command = '' + else + command = (tackit($cfg['simulator']['path']) + ' ') + end + if $cfg['simulator']['pre_support'].nil? + pre_support = '' + else + pre_support = squash('', $cfg['simulator']['pre_support']) + end + if $cfg['simulator']['post_support'].nil? + post_support = '' + else + post_support = squash('', $cfg['simulator']['post_support']) + end + return {:command => command, :pre_support => pre_support, :post_support => post_support} + end + + def execute(command_string, verbose=true, raise_on_fail=true) + report command_string + output = `#{command_string}`.chomp + report(output) if (verbose && !output.nil? && (output.length > 0)) + if (($?.exitstatus != 0) and (raise_on_fail)) + raise "Command failed. (Returned #{$?.exitstatus})" + end + return output + end + + def report_summary + summary = UnityTestSummary.new + summary.set_root_path(HERE) + results_glob = "#{$cfg['compiler']['build_path']}*.test*" + results_glob.gsub!(/\\/, '/') + results = Dir[results_glob] + summary.set_targets(results) + summary.run + fail_out "FAIL: There were failures" if (summary.failures > 0) + end + + def run_tests(test_files) + + report 'Running system tests...' + + # Tack on TEST define for compiling unit tests + load_configuration($cfg_file) + test_defines = ['TEST'] + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + $cfg['compiler']['defines']['items'] << 'TEST' + + include_dirs = get_local_include_dirs + + # Build and execute each unit test + test_files.each do |test| + obj_list = [] + + # Detect dependencies and build required required modules + extract_headers(test).each do |header| + # Compile corresponding source file if it exists + src_file = find_source_file(header, include_dirs) + if !src_file.nil? + compile(src_file, test_defines) + obj_list << header.ext($cfg['compiler']['object_files']['extension']) + end + end + + # Build the test runner (generate if configured to do so) + test_base = File.basename(test, C_EXTENSION) + runner_name = test_base + '_Runner.c' + if $cfg['compiler']['runner_path'].nil? + runner_path = $cfg['compiler']['build_path'] + runner_name + test_gen = UnityTestRunnerGenerator.new($cfg_file) + test_gen.run(test, runner_path) + else + runner_path = $cfg['compiler']['runner_path'] + runner_name + end + + compile(runner_path, test_defines) + obj_list << runner_name.ext($cfg['compiler']['object_files']['extension']) + + # Build the test module + compile(test, test_defines) + obj_list << test_base.ext($cfg['compiler']['object_files']['extension']) + + # Link the test executable + link(test_base, obj_list) + + # Execute unit test and generate results file + simulator = build_simulator_fields + executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] + if simulator.nil? + cmd_str = executable + else + cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" + end + output = execute(cmd_str, true, false) + test_results = $cfg['compiler']['build_path'] + test_base + if output.match(/OK$/m).nil? + test_results += '.testfail' + else + test_results += '.testpass' + end + File.open(test_results, 'w') { |f| f.print output } + end + end + + def build_application(main) + + report "Building application..." + + obj_list = [] + load_configuration($cfg_file) + main_path = $cfg['compiler']['source_path'] + main + C_EXTENSION + + # Detect dependencies and build required required modules + include_dirs = get_local_include_dirs + extract_headers(main_path).each do |header| + src_file = find_source_file(header, include_dirs) + if !src_file.nil? + compile(src_file) + obj_list << header.ext($cfg['compiler']['object_files']['extension']) + end + end + + # Build the main source file + main_base = File.basename(main_path, C_EXTENSION) + compile(main_path) + obj_list << main_base.ext($cfg['compiler']['object_files']['extension']) + + # Create the executable + link(main_base, obj_list) + end + + def fail_out(msg) + puts msg + exit(-1) + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/examples/readme.txt b/flex-bison/mark1/tools/ceedling/vendor/unity/examples/readme.txt new file mode 100644 index 0000000..6c7780e --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/examples/readme.txt @@ -0,0 +1,18 @@ +Example Project + +This example project gives an example of some passing, ignored, and failing tests. +It's simple and meant for you to look over and get an idea for what all of this stuff does. + +You can build and test using the makefile if you have gcc installed (you may need to tweak +the locations of some tools in the makefile). Otherwise, the rake version will let you +test with gcc or a couple versions of IAR. You can tweak the yaml files to get those versions +running. + +Ruby is required if you're using the rake version (obviously). This version shows off most of +Unity's advanced features (automatically creating test runners, fancy summaries, etc.) + +The makefile version doesn't require anything outside of your normal build tools, but won't do the +extras for you. So that you can test right away, we've written the test runners for you and +put them in the test\no_ruby subdirectory. If you make changes to the tests or source, you might +need to update these (like when you add or remove tests). Do that for a while and you'll learn +why you really want to start using the Ruby tools. \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/examples/src/ProductionCode.c b/flex-bison/mark1/tools/ceedling/vendor/unity/examples/src/ProductionCode.c new file mode 100644 index 0000000..500b44b --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/examples/src/ProductionCode.c @@ -0,0 +1,24 @@ + +#include "ProductionCode.h" + +int Counter = 0; +int NumbersToFind[9] = { 0, 34, 55, 66, 32, 11, 1, 77, 888 }; //some obnoxious array to search that is 1-based indexing instead of 0. + +// This function is supposed to search through NumbersToFind and find a particular number. +// If it finds it, the index is returned. Otherwise 0 is returned which sorta makes sense since +// NumbersToFind is indexed from 1. Unfortunately it's broken +// (and should therefore be caught by our tests) +int FindFunction_WhichIsBroken(int NumberToFind) +{ + int i = 0; + while (i <= 8) //Notice I should have been in braces + i++; + if (NumbersToFind[i] == NumberToFind) //Yikes! I'm getting run after the loop finishes instead of during it! + return i; + return 0; +} + +int FunctionWhichReturnsLocalVariable(void) +{ + return Counter; +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/examples/src/ProductionCode.h b/flex-bison/mark1/tools/ceedling/vendor/unity/examples/src/ProductionCode.h new file mode 100644 index 0000000..250ca0d --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/examples/src/ProductionCode.h @@ -0,0 +1,3 @@ + +int FindFunction_WhichIsBroken(int NumberToFind); +int FunctionWhichReturnsLocalVariable(void); diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/examples/src/ProductionCode2.c b/flex-bison/mark1/tools/ceedling/vendor/unity/examples/src/ProductionCode2.c new file mode 100644 index 0000000..a8c72e1 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/examples/src/ProductionCode2.c @@ -0,0 +1,9 @@ + +#include "ProductionCode2.h" + +char* ThisFunctionHasNotBeenTested(int Poor, char* LittleFunction) +{ + //Since There Are No Tests Yet, This Function Could Be Empty For All We Know. + // Which isn't terribly useful... but at least we put in a TEST_IGNORE so we won't forget + return (char*)0; +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/examples/src/ProductionCode2.h b/flex-bison/mark1/tools/ceedling/vendor/unity/examples/src/ProductionCode2.h new file mode 100644 index 0000000..34ae980 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/examples/src/ProductionCode2.h @@ -0,0 +1,2 @@ + +char* ThisFunctionHasNotBeenTested(int Poor, char* LittleFunction); diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/examples/test/TestProductionCode.c b/flex-bison/mark1/tools/ceedling/vendor/unity/examples/test/TestProductionCode.c new file mode 100644 index 0000000..28a5581 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/examples/test/TestProductionCode.c @@ -0,0 +1,62 @@ + +#include "ProductionCode.h" +#include "unity.h" + +//sometimes you may want to get at local data in a module. +//for example: If you plan to pass by reference, this could be useful +//however, it should often be avoided +extern int Counter; + +void setUp(void) +{ + //This is run before EACH TEST + Counter = 0x5a5a; +} + +void tearDown(void) +{ +} + +void test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode(void) +{ + //All of these should pass + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(78)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(1)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(33)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(999)); + TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(-1)); +} + +void test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken(void) +{ + // You should see this line fail in your test summary + TEST_ASSERT_EQUAL(1, FindFunction_WhichIsBroken(34)); + + // Notice the rest of these didn't get a chance to run because the line above failed. + // Unit tests abort each test function on the first sign of trouble. + // Then NEXT test function runs as normal. + TEST_ASSERT_EQUAL(8, FindFunction_WhichIsBroken(8888)); +} + +void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue(void) +{ + //This should be true because setUp set this up for us before this test + TEST_ASSERT_EQUAL_HEX(0x5a5a, FunctionWhichReturnsLocalVariable()); + + //This should be true because we can still change our answer + Counter = 0x1234; + TEST_ASSERT_EQUAL_HEX(0x1234, FunctionWhichReturnsLocalVariable()); +} + +void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain(void) +{ + //This should be true again because setup was rerun before this test (and after we changed it to 0x1234) + TEST_ASSERT_EQUAL_HEX(0x5a5a, FunctionWhichReturnsLocalVariable()); +} + +void test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed(void) +{ + //Sometimes you get the test wrong. When that happens, you get a failure too... and a quick look should tell + // you what actually happened...which in this case was a failure to setup the initial condition. + TEST_ASSERT_EQUAL_HEX(0x1234, FunctionWhichReturnsLocalVariable()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/examples/test/TestProductionCode2.c b/flex-bison/mark1/tools/ceedling/vendor/unity/examples/test/TestProductionCode2.c new file mode 100644 index 0000000..20c9251 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/examples/test/TestProductionCode2.c @@ -0,0 +1,26 @@ + +#include "ProductionCode2.h" +#include "unity.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void test_IgnoredTest(void) +{ + TEST_IGNORE_MESSAGE("This Test Was Ignored On Purpose"); +} + +void test_AnotherIgnoredTest(void) +{ + TEST_IGNORE_MESSAGE("These Can Be Useful For Leaving Yourself Notes On What You Need To Do Yet"); +} + +void test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented(void) +{ + TEST_IGNORE(); //Like This +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/examples/test/no_ruby/TestProductionCode2_Runner.c b/flex-bison/mark1/tools/ceedling/vendor/unity/examples/test/no_ruby/TestProductionCode2_Runner.c new file mode 100644 index 0000000..56515ae --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/examples/test/no_ruby/TestProductionCode2_Runner.c @@ -0,0 +1,46 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ +#include "unity.h" +#include +#include + +char MessageBuffer[50]; + +extern void setUp(void); +extern void tearDown(void); + +extern void test_IgnoredTest(void); +extern void test_AnotherIgnoredTest(void); +extern void test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented(void); + +static void runTest(UnityTestFunction test) +{ + if (TEST_PROTECT()) + { + setUp(); + test(); + } + if (TEST_PROTECT() && !TEST_IS_IGNORED) + { + tearDown(); + } +} +void resetTest() +{ + tearDown(); + setUp(); +} + + +int main(void) +{ + Unity.TestFile = "test/TestProductionCode2.c"; + UnityBegin(); + + // RUN_TEST calls runTest + RUN_TEST(test_IgnoredTest, 13); + RUN_TEST(test_AnotherIgnoredTest, 18); + RUN_TEST(test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented, 23); + + UnityEnd(); + return 0; +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/examples/test/no_ruby/TestProductionCode_Runner.c b/flex-bison/mark1/tools/ceedling/vendor/unity/examples/test/no_ruby/TestProductionCode_Runner.c new file mode 100644 index 0000000..64112f3 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/examples/test/no_ruby/TestProductionCode_Runner.c @@ -0,0 +1,50 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ +#include "unity.h" +#include +#include + +char MessageBuffer[50]; + +extern void setUp(void); +extern void tearDown(void); + +extern void test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode(void); +extern void test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken(void); +extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue(void); +extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain(void); +extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed(void); + +static void runTest(UnityTestFunction test) +{ + if (TEST_PROTECT()) + { + setUp(); + test(); + } + if (TEST_PROTECT() && !TEST_IS_IGNORED) + { + tearDown(); + } +} +void resetTest() +{ + tearDown(); + setUp(); +} + + +int main(void) +{ + Unity.TestFile = "test/TestProductionCode.c"; + UnityBegin(); + + // RUN_TEST calls runTest + RUN_TEST(test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode, 20); + RUN_TEST(test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken, 30); + RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue, 41); + RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain, 51); + RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed, 57); + + UnityEnd(); + return 0; +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/extras/fixture/build/MakefileWorker.mk b/flex-bison/mark1/tools/ceedling/vendor/unity/extras/fixture/build/MakefileWorker.mk new file mode 100644 index 0000000..9948751 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/extras/fixture/build/MakefileWorker.mk @@ -0,0 +1,331 @@ +#--------- +# +# MakefileWorker.mk +# +# Include this helper file in your makefile +# It makes +# A static library holding the application objs +# A test executable +# +# See this example for parameter settings +# examples/Makefile +# +#---------- +# Inputs - these variables describe what to build +# +# INCLUDE_DIRS - Directories used to search for include files. +# This generates a -I for each directory +# SRC_DIRS - Directories containing source file to built into the library +# SRC_FILES - Specific source files to build into library. Helpful when not all code +# in a directory can be built for test (hopefully a temporary situation) +# TEST_SRC_DIRS - Directories containing unit test code build into the unit test runner +# These do not go in a library. They are explicitly included in the test runner +# MOCKS_SRC_DIRS - Directories containing mock source files to build into the test runner +# These do not go in a library. They are explicitly included in the test runner +#---------- +# You can adjust these variables to influence how to build the test target +# and where to put and name outputs +# See below to determine defaults +# COMPONENT_NAME - the name of the thing being built +# UNITY_HOME - where Unity home dir found +# UNITY_BUILD_HOME - place for scripts +# UNITY_OBJS_DIR - a directory where o and d files go +# UNITY_LIB_DIR - a directory where libs go +# UNITY_ENABLE_DEBUG - build for debug +# UNITY_USE_MEM_LEAK_DETECTION - Links with overridden new and delete +# UNITY_USE_STD_CPP_LIB - Set to N to keep the standard C++ library out +# of the test harness +# UNITY_USE_GCOV - Turn on coverage analysis +# Clean then build with this flag set to Y, then 'make gcov' +# UNITY_TEST_RUNNER_FLAGS +# None by default +# UNITY_MAPFILE - generate a map file +# UNITY_WARNINGFLAGS - overly picky by default +# OTHER_MAKEFILE_TO_INCLUDE - a hook to use this makefile to make +# other targets. Like CSlim, which is part of fitnesse +#---------- +# +# Other flags users can initialize to sneak in their settings +# UNITY_CFLAGS - C complier +# UNITY_LDFLAGS - Linker flags +#---------- + + +ifndef COMPONENT_NAME + COMPONENT_NAME = name_this_in_the_makefile +endif + +# Debug on by default +ifndef UNITY_ENABLE_DEBUG + UNITY_ENABLE_DEBUG = Y +endif + +# new and delete for memory leak detection on by default +ifndef UNITY_USE_MEM_LEAK_DETECTION + UNITY_USE_MEM_LEAK_DETECTION = Y +endif + +# Use gcov, off by default +ifndef UNITY_USE_GCOV + UNITY_USE_GCOV = N +endif + +# Default warnings +ifndef UNITY_WARNINGFLAGS + UNITY_WARNINGFLAGS = -Wall -Werror -Wshadow -Wswitch-default +endif + +# Default dir for temporary files (d, o) +ifndef UNITY_OBJS_DIR + UNITY_OBJS_DIR = objs +endif + +# Default dir for the outout library +ifndef UNITY_LIB_DIR + UNITY_LIB_DIR = lib +endif + +# No map by default +ifndef UNITY_MAP_FILE + UNITY_MAP_FILE = N +endif + +#Not verbose by deafult +ifdef VERBOSE + UNITY_TEST_RUNNER_FLAGS += -v +endif + +ifdef GROUP + UNITY_TEST_RUNNER_FLAGS += -g $(GROUP) +endif + +ifdef NAME + UNITY_TEST_RUNNER_FLAGS += -n $(NAME) +endif + +ifdef REPEAT + UNITY_TEST_RUNNER_FLAGS += -r $(REPEAT) +endif + + +# -------------------------------------- +# derived flags in the following area +# -------------------------------------- +ifeq ($(UNITY_USE_MEM_LEAK_DETECTION), N) + UNITY_CFLAGS += -DUNITY_MEM_LEAK_DETECTION_DISABLED +else + UNITY_MEMLEAK_DETECTOR_MALLOC_MACRO_FILE = -include $(UNITY_HOME)/extras/fixture/src/unity_fixture_malloc_overrides.h +endif + +ifeq ($(UNITY_ENABLE_DEBUG), Y) + UNITY_CFLAGS += -g +endif + +ifeq ($(UNITY_USE_GCOV), Y) + UNITY_CFLAGS += -fprofile-arcs -ftest-coverage +endif + +UNITY_CFLAGS += $(UNITY_MEMLEAK_DETECTOR_MALLOC_MACRO_FILE) + +TARGET_MAP = $(COMPONENT_NAME).map.txt +ifeq ($(UNITY_MAP_FILE), Y) + UNITY_LDFLAGS += -Wl,-map,$(TARGET_MAP) +endif + +LD_LIBRARIES += -lgcov + +TARGET_LIB = \ + $(UNITY_LIB_DIR)/lib$(COMPONENT_NAME).a + +TEST_TARGET = \ + $(COMPONENT_NAME)_tests + +#Helper Functions +get_src_from_dir = $(wildcard $1/*.cpp) $(wildcard $1/*.c) +get_dirs_from_dirspec = $(wildcard $1) +get_src_from_dir_list = $(foreach dir, $1, $(call get_src_from_dir,$(dir))) +__src_to = $(subst .c,$1, $(subst .cpp,$1,$2)) +src_to = $(addprefix $(UNITY_OBJS_DIR)/,$(call __src_to,$1,$2)) +src_to_o = $(call src_to,.o,$1) +src_to_d = $(call src_to,.d,$1) +src_to_gcda = $(call src_to,.gcda,$1) +src_to_gcno = $(call src_to,.gcno,$1) +make_dotdot_a_subdir = $(subst ..,_dot_dot, $1) +time = $(shell date +%s) +delta_t = $(eval minus, $1, $2) +debug_print_list = $(foreach word,$1,echo " $(word)";) echo; + +#Derived +STUFF_TO_CLEAN += $(TEST_TARGET) $(TEST_TARGET).exe $(TARGET_LIB) $(TARGET_MAP) + +SRC += $(call get_src_from_dir_list, $(SRC_DIRS)) $(SRC_FILES) +OBJ = $(call src_to_o,$(SRC)) +OBJ2 = $(call make_dotdot_a_subdir. $(OBJ)) + +STUFF_TO_CLEAN += $(OBJ) + +TEST_SRC = $(call get_src_from_dir_list, $(TEST_SRC_DIRS)) +TEST_OBJS = $(call src_to_o,$(TEST_SRC)) +STUFF_TO_CLEAN += $(TEST_OBJS) + + +MOCKS_SRC = $(call get_src_from_dir_list, $(MOCKS_SRC_DIRS)) +MOCKS_OBJS = $(call src_to_o,$(MOCKS_SRC)) +STUFF_TO_CLEAN += $(MOCKS_OBJS) + +ALL_SRC = $(SRC) $(TEST_SRC) $(MOCKS_SRC) + +#Test coverage with gcov +GCOV_OUTPUT = gcov_output.txt +GCOV_REPORT = gcov_report.txt +GCOV_ERROR = gcov_error.txt +GCOV_GCDA_FILES = $(call src_to_gcda, $(ALL_SRC)) +GCOV_GCNO_FILES = $(call src_to_gcno, $(ALL_SRC)) +TEST_OUTPUT = $(TEST_TARGET).txt +STUFF_TO_CLEAN += \ + $(GCOV_OUTPUT)\ + $(GCOV_REPORT)\ + $(GCOV_REPORT).html\ + $(GCOV_ERROR)\ + $(GCOV_GCDA_FILES)\ + $(GCOV_GCNO_FILES)\ + $(TEST_OUTPUT) + + +#The gcda files for gcov need to be deleted before each run +#To avoid annoying messages. +GCOV_CLEAN = $(SILENCE)rm -f $(GCOV_GCDA_FILES) $(GCOV_OUTPUT) $(GCOV_REPORT) $(GCOV_ERROR) +RUN_TEST_TARGET = $(SILENCE) $(GCOV_CLEAN) ; echo "Running $(TEST_TARGET)"; ./$(TEST_TARGET) $(UNITY_TEST_RUNNER_FLAGS) + +INCLUDES_DIRS_EXPANDED = $(call get_dirs_from_dirspec, $(INCLUDE_DIRS)) +INCLUDES += $(foreach dir, $(INCLUDES_DIRS_EXPANDED), -I$(dir)) +MOCK_DIRS_EXPANDED = $(call get_dirs_from_dirspec, $(MOCKS_SRC_DIRS)) +INCLUDES += $(foreach dir, $(MOCK_DIRS_EXPANDED), -I$(dir)) + + +DEP_FILES = $(call src_to_d, $(ALL_SRC)) +STUFF_TO_CLEAN += $(DEP_FILES) $(PRODUCTION_CODE_START) $(PRODUCTION_CODE_END) +STUFF_TO_CLEAN += $(STDLIB_CODE_START) $(MAP_FILE) cpputest_*.xml junit_run_output + +# We'll use the UNITY_CFLAGS etc so that you can override AND add to the CppUTest flags +CFLAGS = $(UNITY_CFLAGS) $(UNITY_ADDITIONAL_CFLAGS) $(INCLUDES) $(UNITY_WARNINGFLAGS) +LDFLAGS = $(UNITY_LDFLAGS) $(UNITY_ADDITIONAL_LDFLAGS) + +# Targets + +.PHONY: all +all: start $(TEST_TARGET) + $(RUN_TEST_TARGET) + +.PHONY: start +start: $(TEST_TARGET) + $(SILENCE)START_TIME=$(call time) + +.PHONY: all_no_tests +all_no_tests: $(TEST_TARGET) + +.PHONY: flags +flags: + @echo + @echo "Compile C source with CFLAGS:" + @$(call debug_print_list,$(CFLAGS)) + @echo "Link with LDFLAGS:" + @$(call debug_print_list,$(LDFLAGS)) + @echo "Link with LD_LIBRARIES:" + @$(call debug_print_list,$(LD_LIBRARIES)) + @echo "Create libraries with ARFLAGS:" + @$(call debug_print_list,$(ARFLAGS)) + @echo "OBJ files:" + @$(call debug_print_list,$(OBJ2)) + + +$(TEST_TARGET): $(TEST_OBJS) $(MOCKS_OBJS) $(PRODUCTION_CODE_START) $(TARGET_LIB) $(USER_LIBS) $(PRODUCTION_CODE_END) $(STDLIB_CODE_START) + $(SILENCE)echo Linking $@ + $(SILENCE)$(LINK.o) -o $@ $^ $(LD_LIBRARIES) + +$(TARGET_LIB): $(OBJ) + $(SILENCE)echo Building archive $@ + $(SILENCE)mkdir -p lib + $(SILENCE)$(AR) $(ARFLAGS) $@ $^ + $(SILENCE)ranlib $@ + +test: $(TEST_TARGET) + $(RUN_TEST_TARGET) | tee $(TEST_OUTPUT) + +vtest: $(TEST_TARGET) + $(RUN_TEST_TARGET) -v | tee $(TEST_OUTPUT) + +$(UNITY_OBJS_DIR)/%.o: %.cpp + @echo compiling $(notdir $<) + $(SILENCE)mkdir -p $(dir $@) + $(SILENCE)$(COMPILE.cpp) -MMD -MP $(OUTPUT_OPTION) $< + +$(UNITY_OBJS_DIR)/%.o: %.c + @echo compiling $(notdir $<) + $(SILENCE)mkdir -p $(dir $@) + $(SILENCE)$(COMPILE.c) -MMD -MP $(OUTPUT_OPTION) $< + +ifneq "$(MAKECMDGOALS)" "clean" +-include $(DEP_FILES) +endif + +.PHONY: clean +clean: + $(SILENCE)echo Making clean + $(SILENCE)$(RM) $(STUFF_TO_CLEAN) + $(SILENCE)rm -rf gcov $(UNITY_OBJS_DIR) + $(SILENCE)find . -name "*.gcno" | xargs rm -f + $(SILENCE)find . -name "*.gcda" | xargs rm -f + +#realclean gets rid of all gcov, o and d files in the directory tree +#not just the ones made by this makefile +.PHONY: realclean +realclean: clean + $(SILENCE)rm -rf gcov + $(SILENCE)find . -name "*.gdcno" | xargs rm -f + $(SILENCE)find . -name "*.[do]" | xargs rm -f + +gcov: test + $(SILENCE)for d in $(SRC_DIRS) ; do \ + gcov --object-directory $(UNITY_OBJS_DIR)/$$d $$d/*.c $$d/*.cpp >> $(GCOV_OUTPUT) 2>>$(GCOV_ERROR) ; \ + done + $(SILENCE)for f in $(SRC_FILES) ; do \ + gcov --object-directory $(UNITY_OBJS_DIR)/$$f $$f >> $(GCOV_OUTPUT) 2>>$(GCOV_ERROR) ; \ + done + $(UNITY_BUILD_HOME)/filterGcov.sh $(GCOV_OUTPUT) $(GCOV_ERROR) $(GCOV_REPORT) $(TEST_OUTPUT) + $(SILENCE)cat $(GCOV_REPORT) + $(SILENCE)mkdir -p gcov + $(SILENCE)mv *.gcov gcov + $(SILENCE)mv gcov_* gcov + $(SILENCE)echo "See gcov directory for details" + +debug: + @echo + @echo "Target Source files:" + @$(call debug_print_list,$(SRC)) + @echo "Target Object files:" + @$(call debug_print_list,$(OBJ)) + @echo "Test Source files:" + @$(call debug_print_list,$(TEST_SRC)) + @echo "Test Object files:" + @$(call debug_print_list,$(TEST_OBJS)) + @echo "Mock Source files:" + @$(call debug_print_list,$(MOCKS_SRC)) + @echo "Mock Object files:" + @$(call debug_print_list,$(MOCKS_OBJS)) + @echo "All Input Dependency files:" + @$(call debug_print_list,$(DEP_FILES)) + @echo Stuff to clean: + @$(call debug_print_list,$(STUFF_TO_CLEAN)) + @echo Includes: + @$(call debug_print_list,$(INCLUDES)) + +ifneq "$(OTHER_MAKEFILE_TO_INCLUDE)" "" +-include $(OTHER_MAKEFILE_TO_INCLUDE) +endif + + + +st,$(TEST_SRC)) + @echo "Test Object files:" + @$(call debug_print \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/extras/fixture/build/filterGcov.sh b/flex-bison/mark1/tools/ceedling/vendor/unity/extras/fixture/build/filterGcov.sh new file mode 100644 index 0000000..a861cf6 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/extras/fixture/build/filterGcov.sh @@ -0,0 +1,61 @@ +#!/bin/bash +INPUT_FILE=$1 +TEMP_FILE1=${INPUT_FILE}1.tmp +TEMP_FILE2=${INPUT_FILE}2.tmp +TEMP_FILE3=${INPUT_FILE}3.tmp +ERROR_FILE=$2 +OUTPUT_FILE=$3 +HTML_OUTPUT_FILE=$3.html +TEST_RESULTS=$4 + +flattenGcovOutput() { +while read line1 +do + read line2 + echo $line2 " " $line1 + read junk + read junk +done < ${INPUT_FILE} +} + +getRidOfCruft() { +sed '-e s/^Lines.*://g' \ + '-e s/^[0-9]\./ &/g' \ + '-e s/^[0-9][0-9]\./ &/g' \ + '-e s/of.*File/ /g' \ + "-e s/'//g" \ + '-e s/^.*\/usr\/.*$//g' \ + '-e s/^.*\.$//g' +} + +getFileNameRootFromErrorFile() { +sed '-e s/gc..:cannot open .* file//g' ${ERROR_FILE} +} + +writeEachNoTestCoverageFile() { +while read line +do + echo " 0.00% " ${line} +done +} + +createHtmlOutput() { + echo "" + echo "" + sed "-e s/.*% /
CoverageFile
&<\/td>/" \ + "-e s/[a-zA-Z0-9_]*\.[ch][a-z]*/&<\/a><\/td><\/tr>/" + echo "
" + sed "-e s/.*/&
/g" < ${TEST_RESULTS} +} + + +flattenGcovOutput | getRidOfCruft > ${TEMP_FILE1} +getFileNameRootFromErrorFile | writeEachNoTestCoverageFile > ${TEMP_FILE2} +cat ${TEMP_FILE1} ${TEMP_FILE2} | sort | uniq > ${OUTPUT_FILE} +createHtmlOutput < ${OUTPUT_FILE} > ${HTML_OUTPUT_FILE} +rm -f ${TEMP_FILE1} ${TEMP_FILE2} +erageFile" + sed "-e s/.*% /&<\/td>/" \ + "-e s/[a-zA-Z0-9_]*\.[ch][a-z]*/&<\/a><\/td><\/tr>/" + echo "" + sed "-e s/.*/&
/g" < ${TEST_RESULTS \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/extras/fixture/rakefile.rb b/flex-bison/mark1/tools/ceedling/vendor/unity/extras/fixture/rakefile.rb new file mode 100644 index 0000000..6181707 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/extras/fixture/rakefile.rb @@ -0,0 +1,37 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require HERE + 'rakefile_helper' + +include RakefileHelpers + +# Load default configuration, for now +DEFAULT_CONFIG_FILE = 'gcc.yml' +configure_toolchain(DEFAULT_CONFIG_FILE) + +task :unit do + run_tests +end + +desc "Build and test Unity Framework" +task :all => [:clean, :unit] +task :default => [:clobber, :all] +task :ci => [:no_color, :default] +task :cruise => [:no_color, :default] + +desc "Load configuration" +task :config, :config_file do |t, args| + configure_toolchain(args[:config_file]) +end + +task :no_color do + $colour_output = false +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/extras/fixture/rakefile_helper.rb b/flex-bison/mark1/tools/ceedling/vendor/unity/extras/fixture/rakefile_helper.rb new file mode 100644 index 0000000..a7f6a28 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/extras/fixture/rakefile_helper.rb @@ -0,0 +1,178 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require 'yaml' +require 'fileutils' +require HERE+'../../auto/unity_test_summary' +require HERE+'../../auto/generate_test_runner' +require HERE+'../../auto/colour_reporter' + +module RakefileHelpers + + C_EXTENSION = '.c' + + def load_configuration(config_file) + unless ($configured) + $cfg_file = HERE+"../../targets/#{config_file}" unless (config_file =~ /[\\|\/]/) + $cfg = YAML.load(File.read($cfg_file)) + $colour_output = false unless $cfg['colour'] + $configured = true if (config_file != DEFAULT_CONFIG_FILE) + end + end + + def configure_clean + CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil? + end + + def configure_toolchain(config_file=DEFAULT_CONFIG_FILE) + config_file += '.yml' unless config_file =~ /\.yml$/ + config_file = config_file unless config_file =~ /[\\|\/]/ + load_configuration(config_file) + configure_clean + end + + def tackit(strings) + if strings.is_a?(Array) + result = "\"#{strings.join}\"" + else + result = strings + end + return result + end + + def squash(prefix, items) + result = '' + items.each { |item| result += " #{prefix}#{tackit(item)}" } + return result + end + + def build_compiler_fields + command = tackit($cfg['compiler']['path']) + if $cfg['compiler']['defines']['items'].nil? + defines = '' + else + defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items'] + ['UNITY_OUTPUT_CHAR=UnityOutputCharSpy_OutputChar']) + end + options = squash('', $cfg['compiler']['options']) + includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :defines => defines, :options => options, :includes => includes} + end + + def compile(file, defines=[]) + compiler = build_compiler_fields + unity_include = $cfg['compiler']['includes']['prefix']+'../../src' + cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{unity_include} #{file} " + + "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" + + "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" + execute(cmd_str) + end + + def build_linker_fields + command = tackit($cfg['linker']['path']) + if $cfg['linker']['options'].nil? + options = '' + else + options = squash('', $cfg['linker']['options']) + end + if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?) + includes = '' + else + includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) + end + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :options => options, :includes => includes} + end + + def link(exe_name, obj_list) + linker = build_linker_fields + cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + + (obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).join + + $cfg['linker']['bin_files']['prefix'] + ' ' + + $cfg['linker']['bin_files']['destination'] + + exe_name + $cfg['linker']['bin_files']['extension'] + execute(cmd_str) + end + + def build_simulator_fields + return nil if $cfg['simulator'].nil? + if $cfg['simulator']['path'].nil? + command = '' + else + command = (tackit($cfg['simulator']['path']) + ' ') + end + if $cfg['simulator']['pre_support'].nil? + pre_support = '' + else + pre_support = squash('', $cfg['simulator']['pre_support']) + end + if $cfg['simulator']['post_support'].nil? + post_support = '' + else + post_support = squash('', $cfg['simulator']['post_support']) + end + return {:command => command, :pre_support => pre_support, :post_support => post_support} + end + + def execute(command_string, verbose=true) + report command_string + output = `#{command_string}`.chomp + report(output) if (verbose && !output.nil? && (output.length > 0)) + if ($?.exitstatus != 0) + raise "Command failed. (Returned #{$?.exitstatus})" + end + return output + end + + def report_summary + summary = UnityTestSummary.new + summary.set_root_path(HERE) + results_glob = "#{$cfg['compiler']['build_path']}*.test*" + results_glob.gsub!(/\\/, '/') + results = Dir[results_glob] + summary.set_targets(results) + summary.run + end + + def run_tests + report 'Running Unity system tests...' + + # Tack on TEST define for compiling unit tests + load_configuration($cfg_file) + test_defines = ['TEST'] + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + + # Get a list of all source files needed + src_files = Dir[HERE+'src/*.c'] + src_files += Dir[HERE+'test/*.c'] + src_files << '../../src/Unity.c' + + # Build object files + src_files.each { |f| compile(f, test_defines) } + obj_list = src_files.map {|f| File.basename(f.ext($cfg['compiler']['object_files']['extension'])) } + + # Link the test executable + test_base = "framework_test" + link(test_base, obj_list) + + # Execute unit test and generate results file + simulator = build_simulator_fields + executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] + if simulator.nil? + cmd_str = executable + " -v -r" + else + cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" + end + output = execute(cmd_str) + test_results = $cfg['compiler']['build_path'] + test_base + if output.match(/OK$/m).nil? + test_results += '.testfail' + else + test_results += '.testpass' + end + File.open(test_results, 'w') { |f| f.print output } + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/extras/fixture/readme.txt b/flex-bison/mark1/tools/ceedling/vendor/unity/extras/fixture/readme.txt new file mode 100644 index 0000000..6b9a78c --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/extras/fixture/readme.txt @@ -0,0 +1,9 @@ +Copyright (c) 2010 James Grenning and Contributed to Unity Project + +Unity Project - A Test Framework for C +Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +[Released under MIT License. Please refer to license.txt for details] + +This Framework is an optional add-on to Unity. By including unity_framework.h in place of unity.h, +you may now work with Unity in a manner similar to CppUTest. This framework adds the concepts of +test groups and gives finer control of your tests over the command line. \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/extras/fixture/src/unity_fixture.c b/flex-bison/mark1/tools/ceedling/vendor/unity/extras/fixture/src/unity_fixture.c new file mode 100644 index 0000000..1ba3e9a --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/extras/fixture/src/unity_fixture.c @@ -0,0 +1,381 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" +#include "unity_internals.h" +#include + +UNITY_FIXTURE_T UnityFixture; + +//If you decide to use the function pointer approach. +int (*outputChar)(int) = putchar; + +int verbose = 0; + +void setUp(void) { /*does nothing*/ } +void tearDown(void) { /*does nothing*/ } + +void announceTestRun(int runNumber) +{ + UnityPrint("Unity test run "); + UnityPrintNumber(runNumber+1); + UnityPrint(" of "); + UnityPrintNumber(UnityFixture.RepeatCount); + UNITY_OUTPUT_CHAR('\n'); +} + +int UnityMain(int argc, char* argv[], void (*runAllTests)()) +{ + int result = UnityGetCommandLineOptions(argc, argv); + int r; + if (result != 0) + return result; + + for (r = 0; r < UnityFixture.RepeatCount; r++) + { + announceTestRun(r); + UnityBegin(); + runAllTests(); + UNITY_OUTPUT_CHAR('\n'); + UnityEnd(); + } + + return UnityFailureCount(); +} + +static int selected(const char * filter, const char * name) +{ + if (filter == 0) + return 1; + return strstr(name, filter) ? 1 : 0; +} + +static int testSelected(const char* test) +{ + return selected(UnityFixture.NameFilter, test); +} + +static int groupSelected(const char* group) +{ + return selected(UnityFixture.GroupFilter, group); +} + +static void runTestCase() +{ + +} + +void UnityTestRunner(unityfunction* setup, + unityfunction* testBody, + unityfunction* teardown, + const char * printableName, + const char * group, + const char * name, + const char * file, int line) +{ + if (testSelected(name) && groupSelected(group)) + { + Unity.CurrentTestFailed = 0; + Unity.TestFile = file; + Unity.CurrentTestName = printableName; + Unity.CurrentTestLineNumber = line; + if (!UnityFixture.Verbose) + UNITY_OUTPUT_CHAR('.'); + else + UnityPrint(printableName); + + Unity.NumberOfTests++; + UnityMalloc_StartTest(); + UnityPointer_Init(); + + runTestCase(); + if (TEST_PROTECT()) + { + setup(); + testBody(); + } + if (TEST_PROTECT()) + { + teardown(); + } + if (TEST_PROTECT()) + { + UnityPointer_UndoAllSets(); + if (!Unity.CurrentTestFailed) + UnityMalloc_EndTest(); + UnityConcludeFixtureTest(); + } + else + { + //aborting - jwg - di i need these for the other TEST_PROTECTS? + } + } +} + +void UnityIgnoreTest() +{ + Unity.NumberOfTests++; + Unity.CurrentTestIgnored = 1; + UNITY_OUTPUT_CHAR('!'); +} + + +//------------------------------------------------- +//Malloc and free stuff +// +#define MALLOC_DONT_FAIL -1 +static int malloc_count; +static int malloc_fail_countdown = MALLOC_DONT_FAIL; + +void UnityMalloc_StartTest() +{ + malloc_count = 0; + malloc_fail_countdown = MALLOC_DONT_FAIL; +} + +void UnityMalloc_EndTest() +{ + malloc_fail_countdown = MALLOC_DONT_FAIL; + if (malloc_count != 0) + { + TEST_FAIL_MESSAGE("This test leaks!"); + } +} + +void UnityMalloc_MakeMallocFailAfterCount(int countdown) +{ + malloc_fail_countdown = countdown; +} + +#ifdef malloc +#undef malloc +#endif + +#ifdef free +#undef free +#endif + +#include +#include + +typedef struct GuardBytes +{ + int size; + char guard[sizeof(int)]; +} Guard; + + +static const char * end = "END"; + +void * unity_malloc(size_t size) +{ + char* mem; + Guard* guard; + + if (malloc_fail_countdown != MALLOC_DONT_FAIL) + { + if (malloc_fail_countdown == 0) + return 0; + malloc_fail_countdown--; + } + + malloc_count++; + + guard = (Guard*)malloc(size + sizeof(Guard) + 4); + guard->size = size; + mem = (char*)&(guard[1]); + memcpy(&mem[size], end, strlen(end) + 1); + + return (void*)mem; +} + +static int isOverrun(void * mem) +{ + Guard* guard = (Guard*)mem; + char* memAsChar = (char*)mem; + guard--; + + return strcmp(&memAsChar[guard->size], end) != 0; +} + +static void release_memory(void * mem) +{ + Guard* guard = (Guard*)mem; + guard--; + + malloc_count--; + free(guard); +} + +void unity_free(void * mem) +{ + int overrun = isOverrun(mem);//strcmp(&memAsChar[guard->size], end) != 0; + release_memory(mem); + if (overrun) + { + TEST_FAIL_MESSAGE("Buffer overrun detected during free()"); + } +} + +void* unity_calloc(size_t num, size_t size) +{ + void* mem = unity_malloc(num * size); + memset(mem, 0, num*size); + return mem; +} + +void* unity_realloc(void * oldMem, size_t size) +{ + Guard* guard = (Guard*)oldMem; +// char* memAsChar = (char*)oldMem; + void* newMem; + + if (oldMem == 0) + return unity_malloc(size); + + guard--; + if (isOverrun(oldMem)) + { + release_memory(oldMem); + TEST_FAIL_MESSAGE("Buffer overrun detected during realloc()"); + } + + if (size == 0) + { + release_memory(oldMem); + return 0; + } + + if (guard->size >= size) + return oldMem; + + newMem = unity_malloc(size); + memcpy(newMem, oldMem, size); + unity_free(oldMem); + return newMem; +} + + +//-------------------------------------------------------- +//Automatic pointer restoration functions +typedef struct _PointerPair +{ + struct _PointerPair * next; + void ** pointer; + void * old_value; +} PointerPair; + +enum {MAX_POINTERS=50}; +static PointerPair pointer_store[MAX_POINTERS]; +static int pointer_index = 0; + +void UnityPointer_Init() +{ + pointer_index = 0; +} + +void UnityPointer_Set(void ** pointer, void * newValue) +{ + if (pointer_index >= MAX_POINTERS) + TEST_FAIL_MESSAGE("Too many pointers set"); + + pointer_store[pointer_index].pointer = pointer; + pointer_store[pointer_index].old_value = *pointer; + *pointer = newValue; + pointer_index++; +} + +void UnityPointer_UndoAllSets() +{ + while (pointer_index > 0) + { + pointer_index--; + *(pointer_store[pointer_index].pointer) = + pointer_store[pointer_index].old_value; + + } +} + +int UnityFailureCount() +{ + return Unity.TestFailures; +} + +int UnityGetCommandLineOptions(int argc, char* argv[]) +{ + int i; + UnityFixture.Verbose = 0; + UnityFixture.GroupFilter = 0; + UnityFixture.NameFilter = 0; + UnityFixture.RepeatCount = 1; + + if (argc == 1) + return 0; + + for (i = 1; i < argc; ) + { + if (strcmp(argv[i], "-v") == 0) + { + UnityFixture.Verbose = 1; + i++; + } + else if (strcmp(argv[i], "-g") == 0) + { + i++; + if (i >= argc) + return 1; + UnityFixture.GroupFilter = argv[i]; + i++; + } + else if (strcmp(argv[i], "-n") == 0) + { + i++; + if (i >= argc) + return 1; + UnityFixture.NameFilter = argv[i]; + i++; + } + else if (strcmp(argv[i], "-r") == 0) + { + UnityFixture.RepeatCount = 2; + i++; + if (i < argc) + { + if (*(argv[i]) >= '0' && *(argv[i]) <= '9') + { + UnityFixture.RepeatCount = atoi(argv[i]); + i++; + } + } + } + } + return 0; +} + +void UnityConcludeFixtureTest() +{ + if (Unity.CurrentTestIgnored) + { + Unity.TestIgnores++; + } + else if (!Unity.CurrentTestFailed) + { + if (UnityFixture.Verbose) + { + UnityPrint(" PASS"); + UNITY_OUTPUT_CHAR('\n'); + } + } + else if (Unity.CurrentTestFailed) + { + Unity.TestFailures++; + } + + Unity.CurrentTestFailed = 0; + Unity.CurrentTestIgnored = 0; +} + diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/extras/fixture/src/unity_fixture.h b/flex-bison/mark1/tools/ceedling/vendor/unity/extras/fixture/src/unity_fixture.h new file mode 100644 index 0000000..da1f871 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/extras/fixture/src/unity_fixture.h @@ -0,0 +1,81 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FIXTURE_H_ +#define UNITY_FIXTURE_H_ + +#include "unity.h" +#include "unity_internals.h" +#include "unity_fixture_malloc_overrides.h" +#include "unity_fixture_internals.h" + +int UnityMain(int argc, char* argv[], void (*runAllTests)()); + + +#define TEST_GROUP(group)\ + int TEST_GROUP_##group = 0 + +#define TEST_SETUP(group) void TEST_##group##_SETUP() + +#define TEST_TEAR_DOWN(group) void TEST_##group##_TEAR_DOWN() + + +#define TEST(group, name) \ + void TEST_##group##_##name##_();\ + void TEST_##group##_##name##_run()\ + {\ + UnityTestRunner(TEST_##group##_SETUP,\ + TEST_##group##_##name##_,\ + TEST_##group##_TEAR_DOWN,\ + "TEST(" #group ", " #name ")",\ + #group, #name,\ + __FILE__, __LINE__);\ + }\ + void TEST_##group##_##name##_() + +#define IGNORE_TEST(group, name) \ + void TEST_##group##_##name##_();\ + void TEST_##group##_##name##_run()\ + {\ + UnityIgnoreTest();\ + }\ + void TEST_##group##_##name##_() + +#define DECLARE_TEST_CASE(group, name) \ + void TEST_##group##_##name##_run() + +#define RUN_TEST_CASE(group, name) \ + DECLARE_TEST_CASE(group, name);\ + TEST_##group##_##name##_run(); + +//This goes at the bottom of each test file or in a separate c file +#define TEST_GROUP_RUNNER(group)\ + void TEST_##group##_GROUP_RUNNER_runAll();\ + void TEST_##group##_GROUP_RUNNER()\ + {\ + TEST_##group##_GROUP_RUNNER_runAll();\ + }\ + void TEST_##group##_GROUP_RUNNER_runAll() + +//Call this from main +#define RUN_TEST_GROUP(group)\ + void TEST_##group##_GROUP_RUNNER();\ + TEST_##group##_GROUP_RUNNER(); + +//CppUTest Compatibility Macros +#define UT_PTR_SET(ptr, newPointerValue) UnityPointer_Set((void**)&ptr, (void*)newPointerValue) +#define TEST_ASSERT_POINTERS_EQUAL(expected, actual) TEST_ASSERT_EQUAL_PTR(expected, actual) +#define TEST_ASSERT_BYTES_EQUAL(expected, actual) TEST_ASSERT_EQUAL_HEX8(0xff & (expected), 0xff & (actual)) +#define FAIL(message) TEST_FAIL((message)) +#define CHECK(condition) TEST_ASSERT_TRUE((condition)) +#define LONGS_EQUAL(expected, actual) TEST_ASSERT_EQUAL_INT((expected), (actual)) +#define STRCMP_EQUAL(expected, actual) TEST_ASSERT_EQUAL_STRING((expected), (actual)) +#define DOUBLES_EQUAL(expected, actual, delta) TEST_ASSERT_FLOAT_WITHIN(((expected), (actual), (delta)) + +void UnityMalloc_MakeMallocFailAfterCount(int count); + +#endif /* UNITY_FIXTURE_H_ */ diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/extras/fixture/src/unity_fixture_internals.h b/flex-bison/mark1/tools/ceedling/vendor/unity/extras/fixture/src/unity_fixture_internals.h new file mode 100644 index 0000000..db23f67 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/extras/fixture/src/unity_fixture_internals.h @@ -0,0 +1,44 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FIXTURE_INTERNALS_H_ +#define UNITY_FIXTURE_INTERNALS_H_ + +typedef struct _UNITY_FIXTURE_T +{ + int Verbose; + unsigned int RepeatCount; + const char* NameFilter; + const char* GroupFilter; +} UNITY_FIXTURE_T; + +typedef void unityfunction(); +void UnityTestRunner(unityfunction * setup, + unityfunction * body, + unityfunction * teardown, + const char * printableName, + const char * group, + const char * name, + const char * file, int line); + +void UnityIgnoreTest(); +void UnityMalloc_StartTest(); +void UnityMalloc_EndTest(); +int UnityFailureCount(); +int UnityGetCommandLineOptions(int argc, char* argv[]); +void UnityConcludeFixtureTest(); + +void UnityPointer_Set(void ** ptr, void * newValue); +void UnityPointer_UndoAllSets(); +void UnityPointer_Init(); + +void UnityAssertEqualPointer(const void * expected, + const void * actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +#endif /* UNITY_FIXTURE_INTERNALS_H_ */ diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h b/flex-bison/mark1/tools/ceedling/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h new file mode 100644 index 0000000..38f8e34 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h @@ -0,0 +1,16 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FIXTURE_MALLOC_OVERRIDES_H_ +#define UNITY_FIXTURE_MALLOC_OVERRIDES_H_ + +#define malloc unity_malloc +#define calloc unity_calloc +#define realloc unity_realloc +#define free unity_free + +#endif /* UNITY_FIXTURE_MALLOC_OVERRIDES_H_ */ diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/extras/fixture/test/main/AllTests.c b/flex-bison/mark1/tools/ceedling/vendor/unity/extras/fixture/test/main/AllTests.c new file mode 100644 index 0000000..ccb775b --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/extras/fixture/test/main/AllTests.c @@ -0,0 +1,21 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" + +static void runAllTests() +{ + RUN_TEST_GROUP(UnityFixture); + RUN_TEST_GROUP(UnityCommandOptions); + RUN_TEST_GROUP(LeakDetection) +} + +int main(int argc, char* argv[]) +{ + return UnityMain(argc, argv, runAllTests); +} + diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/extras/fixture/test/testunity_fixture.c b/flex-bison/mark1/tools/ceedling/vendor/unity/extras/fixture/test/testunity_fixture.c new file mode 100644 index 0000000..de0c04c --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/extras/fixture/test/testunity_fixture.c @@ -0,0 +1,39 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" + +static int data = -1; + +TEST_GROUP(mygroup); + +TEST_SETUP(mygroup) +{ + data = 0; +} + +TEST_TEAR_DOWN(mygroup) +{ + data = -1; +} + +TEST(mygroup, test1) +{ + TEST_ASSERT_EQUAL_INT(0, data); +} + +TEST(mygroup, test2) +{ + TEST_ASSERT_EQUAL_INT(0, data); + data = 5; +} + +TEST(mygroup, test3) +{ + data = 7; + TEST_ASSERT_EQUAL_INT(7, data); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/extras/fixture/test/unity_fixture_Test.c b/flex-bison/mark1/tools/ceedling/vendor/unity/extras/fixture/test/unity_fixture_Test.c new file mode 100644 index 0000000..b8b4524 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/extras/fixture/test/unity_fixture_Test.c @@ -0,0 +1,321 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" +#include "unity_output_Spy.h" +#include +#include + +extern UNITY_FIXTURE_T UnityFixture; + +TEST_GROUP(UnityFixture); + +TEST_SETUP(UnityFixture) +{ +} + +TEST_TEAR_DOWN(UnityFixture) +{ +} + +int my_int; +int* pointer1 = 0; +int* pointer2 = (int*)2; +int* pointer3 = (int*)3; +int int1; +int int2; +int int3; +int int4; + +TEST(UnityFixture, PointerSetting) +{ + TEST_ASSERT_POINTERS_EQUAL(pointer1, 0); + UT_PTR_SET(pointer1, &int1); + UT_PTR_SET(pointer2, &int2); + UT_PTR_SET(pointer3, &int3); + TEST_ASSERT_POINTERS_EQUAL(pointer1, &int1); + TEST_ASSERT_POINTERS_EQUAL(pointer2, &int2); + TEST_ASSERT_POINTERS_EQUAL(pointer3, &int3); + UT_PTR_SET(pointer1, &int4); + UnityPointer_UndoAllSets(); + TEST_ASSERT_POINTERS_EQUAL(pointer1, 0); + TEST_ASSERT_POINTERS_EQUAL(pointer2, (int*)2); + TEST_ASSERT_POINTERS_EQUAL(pointer3, (int*)3); +} + +TEST(UnityFixture, ForceMallocFail) +{ + UnityMalloc_MakeMallocFailAfterCount(1); + void* m = malloc(10); + CHECK(m); + void* mfails = malloc(10); + TEST_ASSERT_POINTERS_EQUAL(0, mfails); + free(m); +} + +TEST(UnityFixture, ReallocSmallerIsUnchanged) +{ + void* m1 = malloc(10); + void* m2 = realloc(m1, 5); + TEST_ASSERT_POINTERS_EQUAL(m1, m2); + free(m2); +} + +TEST(UnityFixture, ReallocSameIsUnchanged) +{ + void* m1 = malloc(10); + void* m2 = realloc(m1, 10); + TEST_ASSERT_POINTERS_EQUAL(m1, m2); + free(m2); +} + +TEST(UnityFixture, ReallocLargerNeeded) +{ + void* m1 = malloc(10); + strcpy((char*)m1, "123456789"); + void* m2 = realloc(m1, 15); + CHECK(m1 != m2); + STRCMP_EQUAL("123456789", m2); + free(m2); +} + +TEST(UnityFixture, ReallocNullPointerIsLikeMalloc) +{ + void* m = realloc(0, 15); + CHECK(m != 0); + free(m); +} + +TEST(UnityFixture, ReallocSizeZeroFreesMemAndReturnsNullPointer) +{ + void* m1 = malloc(10); + void* m2 = realloc(m1, 0); + TEST_ASSERT_POINTERS_EQUAL(0, m2); +} + +TEST(UnityFixture, CallocFillsWithZero) +{ + void* m = calloc(3, sizeof(char)); + char* s = (char*)m; + TEST_ASSERT_BYTES_EQUAL(0, s[0]); + TEST_ASSERT_BYTES_EQUAL(0, s[1]); + TEST_ASSERT_BYTES_EQUAL(0, s[2]); + free(m); +} + +char *p1; +char *p2; + +TEST(UnityFixture, PointerSet) +{ + char c1; + char c2; + char newC1; + char newC2; + p1 = &c1; + p2 = &c2; + + UnityPointer_Init(10); + UT_PTR_SET(p1, &newC1); + UT_PTR_SET(p2, &newC2); + TEST_ASSERT_POINTERS_EQUAL(&newC1, p1); + TEST_ASSERT_POINTERS_EQUAL(&newC2, p2); + UnityPointer_UndoAllSets(); + TEST_ASSERT_POINTERS_EQUAL(&c1, p1); + TEST_ASSERT_POINTERS_EQUAL(&c2, p2); +} + +//------------------------------------------------------------ + +TEST_GROUP(UnityCommandOptions); + +int savedVerbose; +int savedRepeat; +const char* savedName; +const char* savedGroup; + +TEST_SETUP(UnityCommandOptions) +{ + savedVerbose = UnityFixture.Verbose; + savedRepeat = UnityFixture.RepeatCount; + savedName = UnityFixture.NameFilter; + savedGroup = UnityFixture.GroupFilter; +} + +TEST_TEAR_DOWN(UnityCommandOptions) +{ + UnityFixture.Verbose = savedVerbose; + UnityFixture.RepeatCount= savedRepeat; + UnityFixture.NameFilter = savedName; + UnityFixture.GroupFilter = savedGroup; +} + + +static char* noOptions[] = { + "testrunner.exe" +}; + +TEST(UnityCommandOptions, DefaultOptions) +{ + UnityGetCommandLineOptions(1, noOptions); + TEST_ASSERT_EQUAL(0, UnityFixture.Verbose); + TEST_ASSERT_POINTERS_EQUAL(0, UnityFixture.GroupFilter); + TEST_ASSERT_POINTERS_EQUAL(0, UnityFixture.NameFilter); + TEST_ASSERT_EQUAL(1, UnityFixture.RepeatCount); +} + +static char* verbose[] = { + "testrunner.exe", + "-v" +}; + +TEST(UnityCommandOptions, OptionVerbose) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(2, verbose)); + TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); +} + +static char* group[] = { + "testrunner.exe", + "-g", "groupname" +}; + +TEST(UnityCommandOptions, OptionSelectTestByGroup) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, group)); + STRCMP_EQUAL("groupname", UnityFixture.GroupFilter); +} + +static char* name[] = { + "testrunner.exe", + "-n", "testname" +}; + +TEST(UnityCommandOptions, OptionSelectTestByName) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, name)); + STRCMP_EQUAL("testname", UnityFixture.NameFilter); +} + +static char* repeat[] = { + "testrunner.exe", + "-r", "99" +}; + +TEST(UnityCommandOptions, OptionSelectRepeatTestsDefaultCount) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(2, repeat)); + TEST_ASSERT_EQUAL(2, UnityFixture.RepeatCount); +} + +TEST(UnityCommandOptions, OptionSelectRepeatTestsSpecificCount) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, repeat)); + TEST_ASSERT_EQUAL(99, UnityFixture.RepeatCount); +} + +static char* multiple[] = { + "testrunner.exe", + "-v", + "-g", "groupname", + "-n", "testname", + "-r", "98" +}; + +TEST(UnityCommandOptions, MultipleOptions) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(8, multiple)); + TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); + STRCMP_EQUAL("groupname", UnityFixture.GroupFilter); + STRCMP_EQUAL("testname", UnityFixture.NameFilter); + TEST_ASSERT_EQUAL(98, UnityFixture.RepeatCount); +} + +static char* dashRNotLast[] = { + "testrunner.exe", + "-v", + "-g", "gggg", + "-r", + "-n", "tttt", +}; + +TEST(UnityCommandOptions, MultipleOptionsDashRNotLastAndNoValueSpecified) +{ + TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(7, dashRNotLast)); + TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); + STRCMP_EQUAL("gggg", UnityFixture.GroupFilter); + STRCMP_EQUAL("tttt", UnityFixture.NameFilter); + TEST_ASSERT_EQUAL(2, UnityFixture.RepeatCount); +} + + +//------------------------------------------------------------ + +TEST_GROUP(LeakDetection); + +TEST_SETUP(LeakDetection) +{ + UnityOutputCharSpy_Create(1000); +} + +TEST_TEAR_DOWN(LeakDetection) +{ + UnityOutputCharSpy_Destroy(); +} + +#define EXPECT_ABORT_BEGIN \ + { \ + jmp_buf TestAbortFrame; \ + memcpy(TestAbortFrame, Unity.AbortFrame, sizeof(jmp_buf)); \ + if (TEST_PROTECT()) \ + { + +#define EXPECT_ABORT_END \ + } \ + memcpy(Unity.AbortFrame, TestAbortFrame, sizeof(jmp_buf)); \ + } + +TEST(LeakDetection, DetectsLeak) +{ + void* m = malloc(10); + UnityOutputCharSpy_Enable(1); + EXPECT_ABORT_BEGIN + UnityMalloc_EndTest(); + EXPECT_ABORT_END + UnityOutputCharSpy_Enable(0); + CHECK(strstr(UnityOutputCharSpy_Get(), "This test leaks!")); + free(m); + Unity.CurrentTestFailed = 0; +} + +TEST(LeakDetection, BufferOverrunFoundDuringFree) +{ + void* m = malloc(10); + char* s = (char*)m; + s[10] = (char)0xFF; + UnityOutputCharSpy_Enable(1); + EXPECT_ABORT_BEGIN + free(m); + EXPECT_ABORT_END + UnityOutputCharSpy_Enable(0); + CHECK(strstr(UnityOutputCharSpy_Get(), "Buffer overrun detected during free()")); + Unity.CurrentTestFailed = 0; +} + +TEST(LeakDetection, BufferOverrunFoundDuringRealloc) +{ + void* m = malloc(10); + char* s = (char*)m; + s[10] = (char)0xFF; + UnityOutputCharSpy_Enable(1); + EXPECT_ABORT_BEGIN + m = realloc(m, 100); + EXPECT_ABORT_END + UnityOutputCharSpy_Enable(0); + CHECK(strstr(UnityOutputCharSpy_Get(), "Buffer overrun detected during realloc()")); + Unity.CurrentTestFailed = 0; +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c b/flex-bison/mark1/tools/ceedling/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c new file mode 100644 index 0000000..80fec09 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c @@ -0,0 +1,40 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity_fixture.h" + +TEST_GROUP_RUNNER(UnityFixture) +{ + RUN_TEST_CASE(UnityFixture, PointerSetting); + RUN_TEST_CASE(UnityFixture, ForceMallocFail); + RUN_TEST_CASE(UnityFixture, ReallocSmallerIsUnchanged); + RUN_TEST_CASE(UnityFixture, ReallocSameIsUnchanged); + RUN_TEST_CASE(UnityFixture, ReallocLargerNeeded); + RUN_TEST_CASE(UnityFixture, ReallocNullPointerIsLikeMalloc); + RUN_TEST_CASE(UnityFixture, ReallocSizeZeroFreesMemAndReturnsNullPointer); + RUN_TEST_CASE(UnityFixture, CallocFillsWithZero); + RUN_TEST_CASE(UnityFixture, PointerSet); +} + +TEST_GROUP_RUNNER(UnityCommandOptions) +{ + RUN_TEST_CASE(UnityCommandOptions, DefaultOptions); + RUN_TEST_CASE(UnityCommandOptions, OptionVerbose); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectTestByGroup); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectTestByName); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectRepeatTestsDefaultCount); + RUN_TEST_CASE(UnityCommandOptions, OptionSelectRepeatTestsSpecificCount); + RUN_TEST_CASE(UnityCommandOptions, MultipleOptions); + RUN_TEST_CASE(UnityCommandOptions, MultipleOptionsDashRNotLastAndNoValueSpecified); +} + +TEST_GROUP_RUNNER(LeakDetection) +{ + RUN_TEST_CASE(LeakDetection, DetectsLeak); + RUN_TEST_CASE(LeakDetection, BufferOverrunFoundDuringFree); + RUN_TEST_CASE(LeakDetection, BufferOverrunFoundDuringRealloc); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/extras/fixture/test/unity_output_Spy.c b/flex-bison/mark1/tools/ceedling/vendor/unity/extras/fixture/test/unity_output_Spy.c new file mode 100644 index 0000000..16faefa --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/extras/fixture/test/unity_output_Spy.c @@ -0,0 +1,56 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + + +#include "unity_output_Spy.h" +#include +#include +#include + +static int size; +static int count; +static char* buffer; +static int spy_enable; + +void UnityOutputCharSpy_Create(int s) +{ + size = s; + count = 0; + spy_enable = 0; + buffer = malloc(size); + memset(buffer, 0, size); +} + +void UnityOutputCharSpy_Destroy() +{ + size = 0; + free(buffer); +} + +int UnityOutputCharSpy_OutputChar(int c) +{ + if (spy_enable) + { + if (count < (size-1)) + buffer[count++] = c; + } + else + { + putchar(c); + } + return c; +} + +const char * UnityOutputCharSpy_Get() +{ + return buffer; +} + +void UnityOutputCharSpy_Enable(int enable) +{ + spy_enable = enable; +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/extras/fixture/test/unity_output_Spy.h b/flex-bison/mark1/tools/ceedling/vendor/unity/extras/fixture/test/unity_output_Spy.h new file mode 100644 index 0000000..7c1590e --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/extras/fixture/test/unity_output_Spy.h @@ -0,0 +1,17 @@ +//- Copyright (c) 2010 James Grenning and Contributed to Unity Project +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef D_unity_output_Spy_H +#define D_unity_output_Spy_H + +void UnityOutputCharSpy_Create(int s); +void UnityOutputCharSpy_Destroy(); +int UnityOutputCharSpy_OutputChar(int c); +const char * UnityOutputCharSpy_Get(); +void UnityOutputCharSpy_Enable(int enable); + +#endif diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/makefile b/flex-bison/mark1/tools/ceedling/vendor/unity/makefile new file mode 100644 index 0000000..8c8444b --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/makefile @@ -0,0 +1,35 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +C_COMPILER=gcc +TARGET_BASE = testunity +ifeq ($(OS),Windows_NT) + TARGET_EXTENSION=.exe +else + TARGET_EXTENSION=.out +endif +TARGET = $(TARGET_BASE)$(TARGET_EXTENSION) +OUT_FILE=-o $(TARGET) +SRC_FILES=src/unity.c test/testunity.c build/testunity_Runner.c +INC_DIRS=-Isrc +SYMBOLS=-DTEST -DUNITY_SUPPORT_64 + +ifeq ($(OS),Windows_NT) + CLEANUP = del /F /Q build\* && del /F /Q $(TARGET) +else + CLEANUP = rm -f build/*.o ; rm -f $(TARGET) +endif + +all: clean default + +default: + ruby auto/generate_test_runner.rb test/testunity.c build/testunity_Runner.c + $(C_COMPILER) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES) $(OUT_FILE) + $(TARGET) + +clean: + $(CLEANUP) + diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/rakefile.rb b/flex-bison/mark1/tools/ceedling/vendor/unity/rakefile.rb new file mode 100644 index 0000000..3ec5d5a --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/rakefile.rb @@ -0,0 +1,48 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +HERE = File.expand_path(File.dirname(__FILE__)) + '/' + +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require HERE + 'rakefile_helper' + +include RakefileHelpers + +# Load default configuration, for now +DEFAULT_CONFIG_FILE = 'gcc.yml' +configure_toolchain(DEFAULT_CONFIG_FILE) + +desc "Test unity with its own unit tests" +task :unit do + run_tests get_unit_test_files +end + +Rake::TestTask.new(:scripts) do |t| + t.pattern = 'test/test_*.rb' + t.verbose = true +end + +desc "Generate test summary" +task :summary do + report_summary +end + +desc "Build and test Unity" +task :all => [:clean, :scripts, :unit, :summary] +task :default => [:clobber, :all] +task :ci => [:no_color, :default] +task :cruise => [:no_color, :default] + +desc "Load configuration" +task :config, :config_file do |t, args| + configure_toolchain(args[:config_file]) +end + +task :no_color do + $colour_output = false +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/rakefile_helper.rb b/flex-bison/mark1/tools/ceedling/vendor/unity/rakefile_helper.rb new file mode 100644 index 0000000..218fcaa --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/rakefile_helper.rb @@ -0,0 +1,243 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require 'yaml' +require 'fileutils' +require HERE+'auto/unity_test_summary' +require HERE+'auto/generate_test_runner' +require HERE+'auto/colour_reporter' + +module RakefileHelpers + + C_EXTENSION = '.c' + + def load_configuration(config_file) + unless ($configured) + $cfg_file = "targets/#{config_file}" unless (config_file =~ /[\\|\/]/) + $cfg = YAML.load(File.read($cfg_file)) + $colour_output = false unless $cfg['colour'] + $configured = true if (config_file != DEFAULT_CONFIG_FILE) + end + end + + def configure_clean + CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil? + end + + def configure_toolchain(config_file=DEFAULT_CONFIG_FILE) + config_file += '.yml' unless config_file =~ /\.yml$/ + config_file = config_file unless config_file =~ /[\\|\/]/ + load_configuration(config_file) + configure_clean + end + + def get_unit_test_files + path = $cfg['compiler']['unit_tests_path'] + 'test*' + C_EXTENSION + path.gsub!(/\\/, '/') + FileList.new(path) + end + + def get_local_include_dirs + include_dirs = $cfg['compiler']['includes']['items'].dup + include_dirs.delete_if {|dir| dir.is_a?(Array)} + return include_dirs + end + + def extract_headers(filename) + includes = [] + lines = File.readlines(filename) + lines.each do |line| + m = line.match(/^\s*#include\s+\"\s*(.+\.[hH])\s*\"/) + if not m.nil? + includes << m[1] + end + end + return includes + end + + def find_source_file(header, paths) + paths.each do |dir| + src_file = dir + header.ext(C_EXTENSION) + if (File.exists?(src_file)) + return src_file + end + end + return nil + end + + def tackit(strings) + if strings.is_a?(Array) + result = "\"#{strings.join}\"" + else + result = strings + end + return result + end + + def squash(prefix, items) + result = '' + items.each { |item| result += " #{prefix}#{tackit(item)}" } + return result + end + + def build_compiler_fields + command = tackit($cfg['compiler']['path']) + if $cfg['compiler']['defines']['items'].nil? + defines = '' + else + defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items']) + end + options = squash('', $cfg['compiler']['options']) + includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :defines => defines, :options => options, :includes => includes} + end + + def compile(file, defines=[]) + compiler = build_compiler_fields + cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{file} " + + "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" + + "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" + execute(cmd_str) + end + + def build_linker_fields + command = tackit($cfg['linker']['path']) + if $cfg['linker']['options'].nil? + options = '' + else + options = squash('', $cfg['linker']['options']) + end + if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?) + includes = '' + else + includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) + end + includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + return {:command => command, :options => options, :includes => includes} + end + + def link(exe_name, obj_list) + linker = build_linker_fields + cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + + (obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).join + + $cfg['linker']['bin_files']['prefix'] + ' ' + + $cfg['linker']['bin_files']['destination'] + + exe_name + $cfg['linker']['bin_files']['extension'] + execute(cmd_str) + end + + def build_simulator_fields + return nil if $cfg['simulator'].nil? + if $cfg['simulator']['path'].nil? + command = '' + else + command = (tackit($cfg['simulator']['path']) + ' ') + end + if $cfg['simulator']['pre_support'].nil? + pre_support = '' + else + pre_support = squash('', $cfg['simulator']['pre_support']) + end + if $cfg['simulator']['post_support'].nil? + post_support = '' + else + post_support = squash('', $cfg['simulator']['post_support']) + end + return {:command => command, :pre_support => pre_support, :post_support => post_support} + end + + def execute(command_string, verbose=true) + report command_string + output = `#{command_string}`.chomp + report(output) if (verbose && !output.nil? && (output.length > 0)) + if $?.exitstatus != 0 + raise "Command failed. (Returned #{$?.exitstatus})" + end + return output + end + + def report_summary + summary = UnityTestSummary.new + summary.set_root_path(HERE) + results_glob = "#{$cfg['compiler']['build_path']}*.test*" + results_glob.gsub!(/\\/, '/') + results = Dir[results_glob] + summary.set_targets(results) + summary.run + end + + def run_tests(test_files) + report 'Running Unity system tests...' + + # Tack on TEST define for compiling unit tests + load_configuration($cfg_file) + test_defines = ['TEST'] + $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? + $cfg['compiler']['defines']['items'] << 'TEST' + + include_dirs = get_local_include_dirs + + # Build and execute each unit test + test_files.each do |test| + obj_list = [] + + # Detect dependencies and build required modules + extract_headers(test).each do |header| + # Compile corresponding source file if it exists + src_file = find_source_file(header, include_dirs) + if !src_file.nil? + compile(src_file, test_defines) + obj_list << header.ext($cfg['compiler']['object_files']['extension']) + end + end + + # Build the test runner (generate if configured to do so) + test_base = File.basename(test, C_EXTENSION) + + runner_name = test_base + '_Runner.c' + runner_path = '' + + if $cfg['compiler']['runner_path'].nil? + runner_path = $cfg['compiler']['build_path'] + runner_name + else + runner_path = $cfg['compiler']['runner_path'] + runner_name + end + + options = $cfg[:unity] + options[:use_param_tests] = (test =~ /parameterized/) ? true : false + UnityTestRunnerGenerator.new(options).run(test, runner_path) + + compile(runner_path, test_defines) + obj_list << runner_name.ext($cfg['compiler']['object_files']['extension']) + + # Build the test module + compile(test, test_defines) + obj_list << test_base.ext($cfg['compiler']['object_files']['extension']) + + # Link the test executable + link(test_base, obj_list) + + # Execute unit test and generate results file + simulator = build_simulator_fields + executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] + if simulator.nil? + cmd_str = executable + else + cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" + end + output = execute(cmd_str) + test_results = $cfg['compiler']['build_path'] + test_base + if output.match(/OK$/m).nil? + test_results += '.testfail' + else + test_results += '.testpass' + end + File.open(test_results, 'w') { |f| f.print output } + + end + end +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/release/build.info b/flex-bison/mark1/tools/ceedling/vendor/unity/release/build.info new file mode 100644 index 0000000..7871b21 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/release/build.info @@ -0,0 +1,2 @@ +118 + diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/release/version.info b/flex-bison/mark1/tools/ceedling/vendor/unity/release/version.info new file mode 100644 index 0000000..0d71c08 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/release/version.info @@ -0,0 +1,2 @@ +2.0 + diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/src/unity.c b/flex-bison/mark1/tools/ceedling/vendor/unity/src/unity.c new file mode 100644 index 0000000..fa712c7 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/src/unity.c @@ -0,0 +1,855 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include "unity.h" +#include +#include + +#define UNITY_FAIL_AND_BAIL { Unity.CurrentTestFailed = 1; UNITY_OUTPUT_CHAR('\n'); longjmp(Unity.AbortFrame, 1); } +#define UNITY_IGNORE_AND_BAIL { Unity.CurrentTestIgnored = 1; UNITY_OUTPUT_CHAR('\n'); longjmp(Unity.AbortFrame, 1); } +/// return prematurely if we are already in failure or ignore state +#define UNITY_SKIP_EXECUTION { if ((Unity.CurrentTestFailed != 0) || (Unity.CurrentTestIgnored != 0)) {return;} } +#define UNITY_PRINT_EOL { UNITY_OUTPUT_CHAR('\n'); } + +struct _Unity Unity = { 0 }; + +const char* UnityStrNull = "NULL"; +const char* UnityStrSpacer = ". "; +const char* UnityStrExpected = " Expected "; +const char* UnityStrWas = " Was "; +const char* UnityStrTo = " To "; +const char* UnityStrElement = " Element "; +const char* UnityStrMemory = " Memory Mismatch"; +const char* UnityStrDelta = " Values Not Within Delta "; +const char* UnityStrPointless= " You Asked Me To Compare Nothing, Which Was Pointless."; +const char* UnityStrNullPointerForExpected= " Expected pointer to be NULL"; +const char* UnityStrNullPointerForActual = " Actual pointer was NULL"; + +const _U_UINT UnitySizeMask[] = +{ + 255, + 65535, + 65535, + 4294967295u, + 4294967295u, + 4294967295u, + 4294967295u +#ifdef UNITY_SUPPORT_64 + ,0xFFFFFFFFFFFFFFFF +#endif +}; + +//----------------------------------------------- +// Pretty Printers & Test Result Output Handlers +//----------------------------------------------- + +void UnityPrint(const char* string) +{ + const char* pch = string; + + if (pch != NULL) + { + while (*pch) + { + // printable characters plus CR & LF are printed + if ((*pch <= 126) && (*pch >= 32)) + { + UNITY_OUTPUT_CHAR(*pch); + } + //write escaped carriage returns + else if (*pch == 13) + { + UNITY_OUTPUT_CHAR('\\'); + UNITY_OUTPUT_CHAR('r'); + } + //write escaped line feeds + else if (*pch == 10) + { + UNITY_OUTPUT_CHAR('\\'); + UNITY_OUTPUT_CHAR('n'); + } + // unprintable characters are shown as codes + else + { + UNITY_OUTPUT_CHAR('\\'); + UnityPrintNumberHex((_U_SINT)*pch, 2); + } + pch++; + } + } +} + +//----------------------------------------------- +void UnityPrintNumberByStyle(const _U_SINT number, const UNITY_DISPLAY_STYLE_T style) +{ + if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT) + { + UnityPrintNumber(number); + } + else if ((style & UNITY_DISPLAY_RANGE_UINT) == UNITY_DISPLAY_RANGE_UINT) + { + UnityPrintNumberUnsigned( (_U_UINT)number & UnitySizeMask[((_U_UINT)style & (_U_UINT)0x0F) - 1] ); + } + else + { + UnityPrintNumberHex((_U_UINT)number, (style & 0x000F) << 1); + } +} + +//----------------------------------------------- +/// basically do an itoa using as little ram as possible +void UnityPrintNumber(const _U_SINT number_to_print) +{ + _U_SINT divisor = 1; + _U_SINT next_divisor; + _U_SINT number = number_to_print; + + if (number < 0) + { + UNITY_OUTPUT_CHAR('-'); + number = -number; + } + + // figure out initial divisor + while (number / divisor > 9) + { + next_divisor = divisor * 10; + if (next_divisor > divisor) + divisor = next_divisor; + else + break; + } + + // now mod and print, then divide divisor + do + { + UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10))); + divisor /= 10; + } + while (divisor > 0); +} + +//----------------------------------------------- +/// basically do an itoa using as little ram as possible +void UnityPrintNumberUnsigned(const _U_UINT number) +{ + _U_UINT divisor = 1; + _U_UINT next_divisor; + + // figure out initial divisor + while (number / divisor > 9) + { + next_divisor = divisor * 10; + if (next_divisor > divisor) + divisor = next_divisor; + else + break; + } + + // now mod and print, then divide divisor + do + { + UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10))); + divisor /= 10; + } + while (divisor > 0); +} + +//----------------------------------------------- +void UnityPrintNumberHex(const _U_UINT number, const char nibbles_to_print) +{ + _U_UINT nibble; + char nibbles = nibbles_to_print; + UNITY_OUTPUT_CHAR('0'); + UNITY_OUTPUT_CHAR('x'); + + while (nibbles > 0) + { + nibble = (number >> (--nibbles << 2)) & 0x0000000F; + if (nibble <= 9) + { + UNITY_OUTPUT_CHAR((char)('0' + nibble)); + } + else + { + UNITY_OUTPUT_CHAR((char)('A' - 10 + nibble)); + } + } +} + +//----------------------------------------------- +void UnityPrintMask(const _U_UINT mask, const _U_UINT number) +{ + _U_UINT current_bit = (_U_UINT)1 << (UNITY_INT_WIDTH - 1); + _US32 i; + + for (i = 0; i < UNITY_INT_WIDTH; i++) + { + if (current_bit & mask) + { + if (current_bit & number) + { + UNITY_OUTPUT_CHAR('1'); + } + else + { + UNITY_OUTPUT_CHAR('0'); + } + } + else + { + UNITY_OUTPUT_CHAR('X'); + } + current_bit = current_bit >> 1; + } +} + +//----------------------------------------------- +#ifdef UNITY_FLOAT_VERBOSE +void UnityPrintFloat(_UF number) +{ + char TempBuffer[32]; + sprintf(TempBuffer, "%.6f", number); + UnityPrint(TempBuffer); +} +#endif + +//----------------------------------------------- +void UnityTestResultsBegin(const char* file, const UNITY_LINE_TYPE line) +{ + UnityPrint(file); + UNITY_OUTPUT_CHAR(':'); + UnityPrintNumber(line); + UNITY_OUTPUT_CHAR(':'); + UnityPrint(Unity.CurrentTestName); + UNITY_OUTPUT_CHAR(':'); +} + +//----------------------------------------------- +void UnityTestResultsFailBegin(const UNITY_LINE_TYPE line) +{ + UnityTestResultsBegin(Unity.TestFile, line); + UnityPrint("FAIL:"); +} + +//----------------------------------------------- +void UnityConcludeTest(void) +{ + if (Unity.CurrentTestIgnored) + { + Unity.TestIgnores++; + } + else if (!Unity.CurrentTestFailed) + { + UnityTestResultsBegin(Unity.TestFile, Unity.CurrentTestLineNumber); + UnityPrint("PASS"); + UNITY_PRINT_EOL; + } + else + { + Unity.TestFailures++; + } + + Unity.CurrentTestFailed = 0; + Unity.CurrentTestIgnored = 0; +} + +//----------------------------------------------- +void UnityAddMsgIfSpecified(const char* msg) +{ + if (msg) + { + UnityPrint(UnityStrSpacer); + UnityPrint(msg); + } +} + +//----------------------------------------------- +void UnityPrintExpectedAndActualStrings(const char* expected, const char* actual) +{ + UnityPrint(UnityStrExpected); + if (expected != NULL) + { + UNITY_OUTPUT_CHAR('\''); + UnityPrint(expected); + UNITY_OUTPUT_CHAR('\''); + } + else + { + UnityPrint(UnityStrNull); + } + UnityPrint(UnityStrWas); + if (actual != NULL) + { + UNITY_OUTPUT_CHAR('\''); + UnityPrint(actual); + UNITY_OUTPUT_CHAR('\''); + } + else + { + UnityPrint(UnityStrNull); + } +} + +//----------------------------------------------- +// Assertion & Control Helpers +//----------------------------------------------- + +int UnityCheckArraysForNull(const void* expected, const void* actual, const UNITY_LINE_TYPE lineNumber, const char* msg) +{ + //return true if they are both NULL + if ((expected == NULL) && (actual == NULL)) + return 1; + + //throw error if just expected is NULL + if (expected == NULL) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrNullPointerForExpected); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + //throw error if just actual is NULL + if (actual == NULL) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrNullPointerForActual); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + //return false if neither is NULL + return 0; +} + +//----------------------------------------------- +// Assertion Functions +//----------------------------------------------- + +void UnityAssertBits(const _U_SINT mask, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + UNITY_SKIP_EXECUTION; + + if ((mask & expected) != (mask & actual)) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrExpected); + UnityPrintMask(mask, expected); + UnityPrint(UnityStrWas); + UnityPrintMask(mask, actual); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualNumber(const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style) +{ + UNITY_SKIP_EXECUTION; + + if (expected != actual) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(expected, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(actual, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualIntArray(const _U_SINT* expected, + const _U_SINT* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style) +{ + _UU32 elements = num_elements; + const _US8* ptr_exp = (_US8*)expected; + const _US8* ptr_act = (_US8*)actual; + + UNITY_SKIP_EXECUTION; + + if (elements == 0) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + switch(style) + { + case UNITY_DISPLAY_STYLE_HEX8: + case UNITY_DISPLAY_STYLE_INT8: + case UNITY_DISPLAY_STYLE_UINT8: + while (elements--) + { + if (*ptr_exp != *ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 1; + ptr_act += 1; + } + break; + case UNITY_DISPLAY_STYLE_HEX16: + case UNITY_DISPLAY_STYLE_INT16: + case UNITY_DISPLAY_STYLE_UINT16: + while (elements--) + { + if (*(_US16*)ptr_exp != *(_US16*)ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*(_US16*)ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*(_US16*)ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 2; + ptr_act += 2; + } + break; +#ifdef UNITY_SUPPORT_64 + case UNITY_DISPLAY_STYLE_HEX64: + case UNITY_DISPLAY_STYLE_INT64: + case UNITY_DISPLAY_STYLE_UINT64: + while (elements--) + { + if (*(_US64*)ptr_exp != *(_US64*)ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*(_US64*)ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*(_US64*)ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 8; + ptr_act += 8; + } + break; +#endif + default: + while (elements--) + { + if (*(_US32*)ptr_exp != *(_US32*)ptr_act) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(*(_US32*)ptr_exp, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(*(_US32*)ptr_act, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_exp += 4; + ptr_act += 4; + } + break; + } +} + +//----------------------------------------------- +#ifndef UNITY_EXCLUDE_FLOAT +void UnityAssertEqualFloatArray(const _UF* expected, + const _UF* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UU32 elements = num_elements; + const _UF* ptr_expected = expected; + const _UF* ptr_actual = actual; + _UF diff, tol; + + UNITY_SKIP_EXECUTION; + + if (elements == 0) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + while (elements--) + { + diff = *ptr_expected - *ptr_actual; + if (diff < 0.0) + diff = 0.0 - diff; + tol = UNITY_FLOAT_PRECISION * *ptr_expected; + if (tol < 0.0) + tol = 0.0 - tol; + if (diff > tol) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); +#ifdef UNITY_FLOAT_VERBOSE + UnityPrint(UnityStrExpected); + UnityPrintFloat(*ptr_expected); + UnityPrint(UnityStrWas); + UnityPrintFloat(*ptr_actual); +#else + UnityPrint(UnityStrDelta); +#endif + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + ptr_expected++; + ptr_actual++; + } +} + +//----------------------------------------------- +void UnityAssertFloatsWithin(const _UF delta, + const _UF expected, + const _UF actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UF diff = actual - expected; + _UF pos_delta = delta; + + UNITY_SKIP_EXECUTION; + + if (diff < 0) + { + diff = 0.0f - diff; + } + if (pos_delta < 0) + { + pos_delta = 0.0f - pos_delta; + } + + if (pos_delta < diff) + { + UnityTestResultsFailBegin(lineNumber); +#ifdef UNITY_FLOAT_VERBOSE + UnityPrint(UnityStrExpected); + UnityPrintFloat(expected); + UnityPrint(UnityStrWas); + UnityPrintFloat(actual); +#else + UnityPrint(UnityStrDelta); +#endif + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} +#endif + +//----------------------------------------------- +void UnityAssertNumbersWithin( const _U_SINT delta, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style) +{ + UNITY_SKIP_EXECUTION; + + if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT) + { + if (actual > expected) + Unity.CurrentTestFailed = ((actual - expected) > delta); + else + Unity.CurrentTestFailed = ((expected - actual) > delta); + } + else + { + if ((_U_UINT)actual > (_U_UINT)expected) + Unity.CurrentTestFailed = ((_U_UINT)(actual - expected) > (_U_UINT)delta); + else + Unity.CurrentTestFailed = ((_U_UINT)(expected - actual) > (_U_UINT)delta); + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrDelta); + UnityPrintNumberByStyle(delta, style); + UnityPrint(UnityStrExpected); + UnityPrintNumberByStyle(expected, style); + UnityPrint(UnityStrWas); + UnityPrintNumberByStyle(actual, style); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualString(const char* expected, + const char* actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UU32 i; + + UNITY_SKIP_EXECUTION; + + // if both pointers not null compare the strings + if (expected && actual) + { + for (i = 0; expected[i] || actual[i]; i++) + { + if (expected[i] != actual[i]) + { + Unity.CurrentTestFailed = 1; + break; + } + } + } + else + { // handle case of one pointers being null (if both null, test should pass) + if (expected != actual) + { + Unity.CurrentTestFailed = 1; + } + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrintExpectedAndActualStrings(expected, actual); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +void UnityAssertEqualStringArray( const char** expected, + const char** actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + _UU32 i, j = 0; + + UNITY_SKIP_EXECUTION; + + // if no elements, it's an error + if (num_elements == 0) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + do + { + // if both pointers not null compare the strings + if (expected[j] && actual[j]) + { + for (i = 0; expected[j][i] || actual[j][i]; i++) + { + if (expected[j][i] != actual[j][i]) + { + Unity.CurrentTestFailed = 1; + break; + } + } + } + else + { // handle case of one pointers being null (if both null, test should pass) + if (expected[j] != actual[j]) + { + Unity.CurrentTestFailed = 1; + } + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + if (num_elements > 1) + { + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - j - 1), UNITY_DISPLAY_STYLE_UINT); + } + UnityPrintExpectedAndActualStrings((const char*)(expected[j]), (const char*)(actual[j])); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + } while (++j < num_elements); +} + +//----------------------------------------------- +void UnityAssertEqualMemory( const void* expected, + const void* actual, + _UU32 length, + _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber) +{ + unsigned char* expected_ptr = (unsigned char*)expected; + unsigned char* actual_ptr = (unsigned char*)actual; + _UU32 elements = num_elements; + + UNITY_SKIP_EXECUTION; + + if ((elements == 0) || (length == 0)) + { + UnityTestResultsFailBegin(lineNumber); + UnityPrint(UnityStrPointless); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } + + if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1) + return; + + while (elements--) + { + if (memcmp((const void*)expected_ptr, (const void*)actual_ptr, length) != 0) + { + Unity.CurrentTestFailed = 1; + break; + } + expected_ptr += length; + actual_ptr += length; + } + + if (Unity.CurrentTestFailed) + { + UnityTestResultsFailBegin(lineNumber); + if (num_elements > 1) + { + UnityPrint(UnityStrElement); + UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT); + } + UnityPrint(UnityStrMemory); + UnityAddMsgIfSpecified(msg); + UNITY_FAIL_AND_BAIL; + } +} + +//----------------------------------------------- +// Control Functions +//----------------------------------------------- + +void UnityFail(const char* msg, const UNITY_LINE_TYPE line) +{ + UNITY_SKIP_EXECUTION; + + UnityTestResultsBegin(Unity.TestFile, line); + UnityPrint("FAIL"); + if (msg != NULL) + { + UNITY_OUTPUT_CHAR(':'); + if (msg[0] != ' ') + { + UNITY_OUTPUT_CHAR(' '); + } + UnityPrint(msg); + } + UNITY_FAIL_AND_BAIL; +} + +//----------------------------------------------- +void UnityIgnore(const char* msg, const UNITY_LINE_TYPE line) +{ + UNITY_SKIP_EXECUTION; + + UnityTestResultsBegin(Unity.TestFile, line); + UnityPrint("IGNORE"); + if (msg != NULL) + { + UNITY_OUTPUT_CHAR(':'); + UNITY_OUTPUT_CHAR(' '); + UnityPrint(msg); + } + UNITY_IGNORE_AND_BAIL; +} + +//----------------------------------------------- +void setUp(void); +void tearDown(void); +void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum) +{ + Unity.CurrentTestName = FuncName; + Unity.CurrentTestLineNumber = FuncLineNum; + Unity.NumberOfTests++; + if (TEST_PROTECT()) + { + setUp(); + Func(); + } + if (TEST_PROTECT() && !(Unity.CurrentTestIgnored)) + { + tearDown(); + } + UnityConcludeTest(); +} + +//----------------------------------------------- +void UnityBegin(void) +{ + Unity.NumberOfTests = 0; +} + +//----------------------------------------------- +int UnityEnd(void) +{ + UnityPrint("-----------------------"); + UNITY_PRINT_EOL; + UnityPrintNumber(Unity.NumberOfTests); + UnityPrint(" Tests "); + UnityPrintNumber(Unity.TestFailures); + UnityPrint(" Failures "); + UnityPrintNumber(Unity.TestIgnores); + UnityPrint(" Ignored"); + UNITY_PRINT_EOL; + if (Unity.TestFailures == 0U) + { + UnityPrint("OK"); + } + else + { + UnityPrint("FAIL"); + } + UNITY_PRINT_EOL; + return Unity.TestFailures; +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/src/unity.h b/flex-bison/mark1/tools/ceedling/vendor/unity/src/unity.h new file mode 100644 index 0000000..0b1b187 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/src/unity.h @@ -0,0 +1,213 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_FRAMEWORK_H +#define UNITY_FRAMEWORK_H + +#define UNITY + +#include "unity_internals.h" + +//------------------------------------------------------- +// Configuration Options +//------------------------------------------------------- + +// Integers +// - Unity assumes 32 bit integers by default +// - If your compiler treats ints of a different size, define UNITY_INT_WIDTH + +// Floats +// - define UNITY_EXCLUDE_FLOAT to disallow floating point comparisons +// - define UNITY_FLOAT_PRECISION to specify the precision to use when doing TEST_ASSERT_EQUAL_FLOAT +// - define UNITY_FLOAT_TYPE to specify doubles instead of single precision floats +// - define UNITY_FLOAT_VERBOSE to print floating point values in errors (uses sprintf) + +// Output +// - by default, Unity prints to standard out with putchar. define UNITY_OUTPUT_CHAR(a) with a different function if desired + +// Optimization +// - by default, line numbers are stored in unsigned shorts. Define UNITY_LINE_TYPE with a different type if your files are huge +// - by default, test and failure counters are unsigned shorts. Define UNITY_COUNTER_TYPE with a different type if you want to save space or have more than 65535 Tests. + +// Test Cases +// - define UNITY_SUPPORT_TEST_CASES to include the TEST_CASE macro, though really it's mostly about the runner generator script + +// Parameterized Tests +// - you'll want to create a define of TEST_CASE(...) which basically evaluates to nothing + +//------------------------------------------------------- +// Test Running Macros +//------------------------------------------------------- + +#define TEST_PROTECT() (setjmp(Unity.AbortFrame) == 0) + +#define TEST_ABORT() {longjmp(Unity.AbortFrame, 1);} + +#ifndef RUN_TEST +#define RUN_TEST(func, line_num) UnityDefaultTestRun(func, #func, line_num) +#endif + +#define TEST_LINE_NUM (Unity.CurrentTestLineNumber) +#define TEST_IS_IGNORED (Unity.CurrentTestIgnored) + +//------------------------------------------------------- +// Basic Fail and Ignore +//------------------------------------------------------- + +#define TEST_FAIL_MESSAGE(message) UNITY_TEST_FAIL(__LINE__, message) +#define TEST_FAIL() UNITY_TEST_FAIL(__LINE__, NULL) +#define TEST_IGNORE_MESSAGE(message) UNITY_TEST_IGNORE(__LINE__, message) +#define TEST_IGNORE() UNITY_TEST_IGNORE(__LINE__, NULL) +#define TEST_ONLY() + +//------------------------------------------------------- +// Test Asserts (simple) +//------------------------------------------------------- + +//Boolean +#define TEST_ASSERT(condition) UNITY_TEST_ASSERT( (condition), __LINE__, " Expression Evaluated To FALSE") +#define TEST_ASSERT_TRUE(condition) UNITY_TEST_ASSERT( (condition), __LINE__, " Expected TRUE Was FALSE") +#define TEST_ASSERT_UNLESS(condition) UNITY_TEST_ASSERT( !(condition), __LINE__, " Expression Evaluated To TRUE") +#define TEST_ASSERT_FALSE(condition) UNITY_TEST_ASSERT( !(condition), __LINE__, " Expected FALSE Was TRUE") +#define TEST_ASSERT_NULL(pointer) UNITY_TEST_ASSERT_NULL( (pointer), __LINE__, " Expected NULL") +#define TEST_ASSERT_NOT_NULL(pointer) UNITY_TEST_ASSERT_NOT_NULL((pointer), __LINE__, " Expected Non-NULL") + +//Integers (of all sizes) +#define TEST_ASSERT_EQUAL_INT(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT8(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT8((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT16(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT16((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT32(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT32((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT64(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT64((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_NOT_EQUAL(expected, actual) UNITY_TEST_ASSERT(((expected) != (actual)), __LINE__, " Expected Not-Equal") +#define TEST_ASSERT_EQUAL_UINT(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT8(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT8( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT16(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT16( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT32(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT32( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT64(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT64( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX8(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX8( (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX16(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX16((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX32(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX64(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX64((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_BITS(mask, expected, actual) UNITY_TEST_ASSERT_BITS((mask), (expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_BITS_HIGH(mask, actual) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(-1), (actual), __LINE__, NULL) +#define TEST_ASSERT_BITS_LOW(mask, actual) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(0), (actual), __LINE__, NULL) +#define TEST_ASSERT_BIT_HIGH(bit, actual) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(-1), (actual), __LINE__, NULL) +#define TEST_ASSERT_BIT_LOW(bit, actual) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(0), (actual), __LINE__, NULL) + +//Integer Ranges (of all sizes) +#define TEST_ASSERT_INT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_UINT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX8_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX16_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX32_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_HEX64_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, __LINE__, NULL) + +//Structs and Strings +#define TEST_ASSERT_EQUAL_PTR(expected, actual) UNITY_TEST_ASSERT_EQUAL_PTR((expected), (actual), __LINE__, NULL) +#define TEST_ASSERT_EQUAL_STRING(expected, actual) UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_MEMORY(expected, actual, len) UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, __LINE__, NULL) + +//Arrays +#define TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements) UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, __LINE__, NULL) + +//Floating Point (If Enabled) +#define TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_FLOAT(expected, actual) UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, __LINE__, NULL) +#define TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, __LINE__, NULL) + +//------------------------------------------------------- +// Test Asserts (with additional messages) +//------------------------------------------------------- + +//Boolean +#define TEST_ASSERT_MESSAGE(condition, message) UNITY_TEST_ASSERT( (condition), __LINE__, message) +#define TEST_ASSERT_TRUE_MESSAGE(condition, message) UNITY_TEST_ASSERT( (condition), __LINE__, message) +#define TEST_ASSERT_UNLESS_MESSAGE(condition, message) UNITY_TEST_ASSERT( !(condition), __LINE__, message) +#define TEST_ASSERT_FALSE_MESSAGE(condition, message) UNITY_TEST_ASSERT( !(condition), __LINE__, message) +#define TEST_ASSERT_NULL_MESSAGE(pointer, message) UNITY_TEST_ASSERT_NULL( (pointer), __LINE__, message) +#define TEST_ASSERT_NOT_NULL_MESSAGE(pointer, message) UNITY_TEST_ASSERT_NOT_NULL((pointer), __LINE__, message) + +//Integers (of all sizes) +#define TEST_ASSERT_EQUAL_INT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT8((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT16((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT32((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_INT64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT64((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, message) +#define TEST_ASSERT_NOT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT(((expected) != (actual)), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT8( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT16( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT32( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT64( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX8( (expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX16((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX64((expected), (actual), __LINE__, message) +#define TEST_ASSERT_BITS_MESSAGE(mask, expected, actual, message) UNITY_TEST_ASSERT_BITS((mask), (expected), (actual), __LINE__, message) +#define TEST_ASSERT_BITS_HIGH_MESSAGE(mask, actual, message) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(-1), (actual), __LINE__, message) +#define TEST_ASSERT_BITS_LOW_MESSAGE(mask, actual, message) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(0), (actual), __LINE__, message) +#define TEST_ASSERT_BIT_HIGH_MESSAGE(bit, actual, message) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(-1), (actual), __LINE__, message) +#define TEST_ASSERT_BIT_LOW_MESSAGE(bit, actual, message) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(0), (actual), __LINE__, message) + +//Integer Ranges (of all sizes) +#define TEST_ASSERT_INT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_UINT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX8_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX16_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX32_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_HEX64_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, __LINE__, message) + +//Structs and Strings +#define TEST_ASSERT_EQUAL_PTR_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_PTR(expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_STRING_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_MEMORY_MESSAGE(expected, actual, len, message) UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, __LINE__, message) + +//Arrays +#define TEST_ASSERT_EQUAL_INT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_INT64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_UINT64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_HEX64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_STRING_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, __LINE__, message) +#define TEST_ASSERT_EQUAL_MEMORY_ARRAY_MESSAGE(expected, actual, len, num_elements, message) UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, __LINE__, message) + +//Floating Point (If Enabled) +#define TEST_ASSERT_FLOAT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_FLOAT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, __LINE__, message) +#define TEST_ASSERT_EQUAL_FLOAT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, __LINE__, message) +#endif diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/src/unity_internals.h b/flex-bison/mark1/tools/ceedling/vendor/unity/src/unity_internals.h new file mode 100644 index 0000000..29c9d1d --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/src/unity_internals.h @@ -0,0 +1,355 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#ifndef UNITY_INTERNALS_H +#define UNITY_INTERNALS_H + +#include +#include + +//------------------------------------------------------- +// Int Support +//------------------------------------------------------- + +#ifndef UNITY_INT_WIDTH +#define UNITY_INT_WIDTH (32) +#endif + +#ifndef UNITY_LONG_WIDTH +#define UNITY_LONG_WIDTH (32) +#endif + +#if (UNITY_INT_WIDTH == 32) + typedef unsigned char _UU8; + typedef unsigned short _UU16; + typedef unsigned int _UU32; + typedef signed char _US8; + typedef signed short _US16; + typedef signed int _US32; +#elif (UNITY_INT_WIDTH == 16) + typedef unsigned char _UU8; + typedef unsigned int _UU16; + typedef unsigned long _UU32; + typedef signed char _US8; + typedef signed int _US16; + typedef signed long _US32; +#else + #error Invalid UNITY_INT_WIDTH specified! (16 or 32 are supported) +#endif + +//------------------------------------------------------- +// 64-bit Support +//------------------------------------------------------- + +#ifndef UNITY_SUPPORT_64 + +//No 64-bit Support +typedef _UU32 _U_UINT; +typedef _US32 _U_SINT; + +#else + +//64-bit Support +#if (UNITY_LONG_WIDTH == 32) + typedef unsigned long long _UU64; + typedef signed long long _US64; +#elif (UNITY_LONG_WIDTH == 64) + typedef unsigned long _UU64; + typedef signed long _US64; +#else + #error Invalid UNITY_LONG_WIDTH specified! (32 or 64 are supported) +#endif +typedef _UU64 _U_UINT; +typedef _US64 _U_SINT; + +#endif + +//------------------------------------------------------- +// Pointer Support +//------------------------------------------------------- + +#ifndef UNITY_POINTER_WIDTH +#define UNITY_POINTER_WIDTH (32) +#endif + +#if (UNITY_POINTER_WIDTH == 32) + typedef _UU32 _UP; +#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX32 +#elif (UNITY_POINTER_WIDTH == 64) + typedef _UU64 _UP; +#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX64 +#elif (UNITY_POINTER_WIDTH == 16) + typedef _UU16 _UP; +#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX16 +#else + #error Invalid UNITY_POINTER_WIDTH specified! (16, 32 or 64 are supported) +#endif + +//------------------------------------------------------- +// Float Support +//------------------------------------------------------- + +#ifdef UNITY_EXCLUDE_FLOAT + +//No Floating Point Support +#undef UNITY_FLOAT_PRECISION +#undef UNITY_FLOAT_TYPE +#undef UNITY_FLOAT_VERBOSE + +#else + +//Floating Point Support +#ifndef UNITY_FLOAT_PRECISION +#define UNITY_FLOAT_PRECISION (0.00001f) +#endif +#ifndef UNITY_FLOAT_TYPE +#define UNITY_FLOAT_TYPE float +#endif +typedef UNITY_FLOAT_TYPE _UF; + +#endif + +//------------------------------------------------------- +// Output Method +//------------------------------------------------------- + +#ifndef UNITY_OUTPUT_CHAR +//Default to using putchar, which is defined in stdio.h above +#define UNITY_OUTPUT_CHAR(a) putchar(a) +#else +//If defined as something else, make sure we declare it here so it's ready for use +extern int UNITY_OUTPUT_CHAR(int); +#endif + +//------------------------------------------------------- +// Footprint +//------------------------------------------------------- + +#ifndef UNITY_LINE_TYPE +#define UNITY_LINE_TYPE unsigned short +#endif + +#ifndef UNITY_COUNTER_TYPE +#define UNITY_COUNTER_TYPE unsigned short +#endif + +//------------------------------------------------------- +// Internal Structs Needed +//------------------------------------------------------- + +typedef void (*UnityTestFunction)(void); + +#define UNITY_DISPLAY_RANGE_INT (0x10) +#define UNITY_DISPLAY_RANGE_UINT (0x20) +#define UNITY_DISPLAY_RANGE_HEX (0x40) +#define UNITY_DISPLAY_RANGE_AUTO (0x80) + +typedef enum +{ + UNITY_DISPLAY_STYLE_INT = 4 + UNITY_DISPLAY_RANGE_INT + UNITY_DISPLAY_RANGE_AUTO, + UNITY_DISPLAY_STYLE_INT8 = 1 + UNITY_DISPLAY_RANGE_INT, + UNITY_DISPLAY_STYLE_INT16 = 2 + UNITY_DISPLAY_RANGE_INT, + UNITY_DISPLAY_STYLE_INT32 = 4 + UNITY_DISPLAY_RANGE_INT, +#ifdef UNITY_SUPPORT_64 + UNITY_DISPLAY_STYLE_INT64 = 8 + UNITY_DISPLAY_RANGE_INT, +#endif + UNITY_DISPLAY_STYLE_UINT = 4 + UNITY_DISPLAY_RANGE_UINT + UNITY_DISPLAY_RANGE_AUTO, + UNITY_DISPLAY_STYLE_UINT8 = 1 + UNITY_DISPLAY_RANGE_UINT, + UNITY_DISPLAY_STYLE_UINT16 = 2 + UNITY_DISPLAY_RANGE_UINT, + UNITY_DISPLAY_STYLE_UINT32 = 4 + UNITY_DISPLAY_RANGE_UINT, +#ifdef UNITY_SUPPORT_64 + UNITY_DISPLAY_STYLE_UINT64 = 8 + UNITY_DISPLAY_RANGE_UINT, +#endif + UNITY_DISPLAY_STYLE_HEX8 = 1 + UNITY_DISPLAY_RANGE_HEX, + UNITY_DISPLAY_STYLE_HEX16 = 2 + UNITY_DISPLAY_RANGE_HEX, + UNITY_DISPLAY_STYLE_HEX32 = 4 + UNITY_DISPLAY_RANGE_HEX, +#ifdef UNITY_SUPPORT_64 + UNITY_DISPLAY_STYLE_HEX64 = 8 + UNITY_DISPLAY_RANGE_HEX, +#endif +} UNITY_DISPLAY_STYLE_T; + +struct _Unity +{ + const char* TestFile; + const char* CurrentTestName; + _UU32 CurrentTestLineNumber; + UNITY_COUNTER_TYPE NumberOfTests; + UNITY_COUNTER_TYPE TestFailures; + UNITY_COUNTER_TYPE TestIgnores; + UNITY_COUNTER_TYPE CurrentTestFailed; + UNITY_COUNTER_TYPE CurrentTestIgnored; + jmp_buf AbortFrame; +}; + +extern struct _Unity Unity; + +//------------------------------------------------------- +// Test Suite Management +//------------------------------------------------------- + +void UnityBegin(void); +int UnityEnd(void); +void UnityConcludeTest(void); +void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum); + +//------------------------------------------------------- +// Test Output +//------------------------------------------------------- + +void UnityPrint(const char* string); +void UnityPrintMask(const _U_UINT mask, const _U_UINT number); +void UnityPrintNumberByStyle(const _U_SINT number, const UNITY_DISPLAY_STYLE_T style); +void UnityPrintNumber(const _U_SINT number); +void UnityPrintNumberUnsigned(const _U_UINT number); +void UnityPrintNumberHex(const _U_UINT number, const char nibbles); + +#ifdef UNITY_FLOAT_VERBOSE +void UnityPrintFloat(const _UF number); +#endif + +//------------------------------------------------------- +// Test Assertion Fuctions +//------------------------------------------------------- +// Use the macros below this section instead of calling +// these directly. The macros have a consistent naming +// convention and will pull in file and line information +// for you. + +void UnityAssertEqualNumber(const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style); + +void UnityAssertEqualIntArray(const _U_SINT* expected, + const _U_SINT* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style); + +void UnityAssertBits(const _U_SINT mask, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualString(const char* expected, + const char* actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualStringArray( const char** expected, + const char** actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualMemory( const void* expected, + const void* actual, + const _UU32 length, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertNumbersWithin(const _U_SINT delta, + const _U_SINT expected, + const _U_SINT actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber, + const UNITY_DISPLAY_STYLE_T style); + +void UnityFail(const char* message, const UNITY_LINE_TYPE line); + +void UnityIgnore(const char* message, const UNITY_LINE_TYPE line); + +#ifndef UNITY_EXCLUDE_FLOAT +void UnityAssertFloatsWithin(const _UF delta, + const _UF expected, + const _UF actual, + const char* msg, + const UNITY_LINE_TYPE lineNumber); + +void UnityAssertEqualFloatArray(const _UF* expected, + const _UF* actual, + const _UU32 num_elements, + const char* msg, + const UNITY_LINE_TYPE lineNumber); +#endif + +//------------------------------------------------------- +// Basic Fail and Ignore +//------------------------------------------------------- + +#define UNITY_TEST_FAIL(line, message) UnityFail( (message), (UNITY_LINE_TYPE)line); +#define UNITY_TEST_IGNORE(line, message) UnityIgnore( (message), (UNITY_LINE_TYPE)line); + +//------------------------------------------------------- +// Test Asserts +//------------------------------------------------------- + +#define UNITY_TEST_ASSERT(condition, line, message) if (condition) {} else {UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, message);} +#define UNITY_TEST_ASSERT_NULL(pointer, line, message) UNITY_TEST_ASSERT(((pointer) == NULL), (UNITY_LINE_TYPE)line, message) +#define UNITY_TEST_ASSERT_NOT_NULL(pointer, line, message) UNITY_TEST_ASSERT(((pointer) != NULL), (UNITY_LINE_TYPE)line, message) + +#define UNITY_TEST_ASSERT_EQUAL_INT(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_UINT(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_HEX8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX8) +#define UNITY_TEST_ASSERT_EQUAL_HEX16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX16) +#define UNITY_TEST_ASSERT_EQUAL_HEX32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX32) +#define UNITY_TEST_ASSERT_BITS(mask, expected, actual, line, message) UnityAssertBits((_U_SINT)(mask), (_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line) + +#define UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX8) +#define UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX16) +#define UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX32) +#define UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64) + +#define UNITY_TEST_ASSERT_EQUAL_PTR(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(_UP)(expected), (_U_SINT)(_UP)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_POINTER) +#define UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, line, message) UnityAssertEqualString((const char*)(expected), (const char*)(actual), (message), (UNITY_LINE_TYPE)line) +#define UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, line, message) UnityAssertEqualMemory((void*)(expected), (void*)(actual), (_UU32)(len), 1, (message), (UNITY_LINE_TYPE)line) + +#define UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT) +#define UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT8) +#define UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT16) +#define UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT32) +#define UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT) +#define UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT8) +#define UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT16) +#define UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT32) +#define UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX8) +#define UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX16) +#define UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX32) +#define UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualStringArray((const char**)(expected), (const char**)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line) +#define UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, line, message) UnityAssertEqualMemory((void*)(expected), (void*)(actual), (_UU32)(len), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line) + +#ifdef UNITY_SUPPORT_64 +#define UNITY_TEST_ASSERT_EQUAL_INT64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT64) +#define UNITY_TEST_ASSERT_EQUAL_UINT64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT64) +#define UNITY_TEST_ASSERT_EQUAL_HEX64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64) +#define UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT64) +#define UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT64) +#define UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((const _U_SINT*)(expected), (const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64) +#endif + +#ifdef UNITY_EXCLUDE_FLOAT +#define UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled") +#define UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled") +#define UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled") +#else +#define UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, line, message) UnityAssertFloatsWithin((_UF)(delta), (_UF)(expected), (_UF)(actual), (message), (UNITY_LINE_TYPE)line) +#define UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, line, message) UNITY_TEST_ASSERT_FLOAT_WITHIN((_UF)(expected) * (_UF)UNITY_FLOAT_PRECISION, (_UF)expected, (_UF)actual, (UNITY_LINE_TYPE)line, message) +#define UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualFloatArray((_UF*)(expected), (_UF*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line) +#endif + +#endif diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/targets/gcc.yml b/flex-bison/mark1/tools/ceedling/vendor/unity/targets/gcc.yml new file mode 100644 index 0000000..0f18c6c --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/targets/gcc.yml @@ -0,0 +1,42 @@ +compiler: + path: gcc + source_path: 'src/' + unit_tests_path: &unit_tests_path 'test/' + build_path: &build_path 'build/' + options: + - '-c' + - '-Wall' + - '-Wno-address' + - '-std=c99' + - '-pedantic' + includes: + prefix: '-I' + items: + - 'src/' + - '../src/' + - *unit_tests_path + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - UNITY_SUPPORT_TEST_CASES + object_files: + prefix: '-o' + extension: '.o' + destination: *build_path +linker: + path: gcc + options: + - -lm + includes: + prefix: '-I' + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.exe' + destination: *build_path +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/targets/gcc_64.yml b/flex-bison/mark1/tools/ceedling/vendor/unity/targets/gcc_64.yml new file mode 100644 index 0000000..97cb958 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/targets/gcc_64.yml @@ -0,0 +1,43 @@ +compiler: + path: gcc + source_path: 'src/' + unit_tests_path: &unit_tests_path 'test/' + build_path: &build_path 'build/' + options: + - '-c' + - '-Wall' + - '-Wno-address' + - '-std=c99' + - '-pedantic' + includes: + prefix: '-I' + items: + - 'src/' + - '../src/' + - *unit_tests_path + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - UNITY_SUPPORT_TEST_CASES + - 'UNITY_POINTER_WIDTH=64' + object_files: + prefix: '-o' + extension: '.o' + destination: *build_path +linker: + path: gcc + options: + - -lm + includes: + prefix: '-I' + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.exe' + destination: *build_path +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/targets/hitech_picc18.yml b/flex-bison/mark1/tools/ceedling/vendor/unity/targets/hitech_picc18.yml new file mode 100644 index 0000000..210d944 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/targets/hitech_picc18.yml @@ -0,0 +1,101 @@ +# rumor has it that this yaml file works for the standard edition of the +# hitech PICC18 compiler, but not the pro version. +# +compiler: + path: cd build && picc18 + source_path: 'c:\Projects\NexGen\Prototypes\CMockTest\src\' + unit_tests_path: &unit_tests_path 'c:\Projects\NexGen\Prototypes\CMockTest\test\' + build_path: &build_path 'c:\Projects\NexGen\Prototypes\CMockTest\build\' + options: + - --chip=18F87J10 + - --ide=hitide + - --q #quiet please + - --asmlist + - --codeoffset=0 + - --emi=wordwrite # External memory interface protocol + - --warn=0 # allow all normal warning messages + - --errors=10 # Number of errors before aborting compile + - --char=unsigned + - -Bl # Large memory model + - -G # generate symbol file + - --cp=16 # 16-bit pointers + - --double=24 + - -N255 # 255-char symbol names + - --opt=none # Do not use any compiler optimziations + - -c # compile only + - -M + includes: + prefix: '-I' + items: + - 'c:/Projects/NexGen/Prototypes/CMockTest/src/' + - 'c:/Projects/NexGen/Prototypes/CMockTest/mocks/' + - 'c:/CMock/src/' + - 'c:/CMock/examples/src/' + - 'c:/CMock/vendor/unity/src/' + - 'c:/CMock/vendor/unity/examples/helper/' + - *unit_tests_path + defines: + prefix: '-D' + items: + - UNITY_INT_WIDTH=16 + - UNITY_POINTER_WIDTH=16 + - CMOCK_MEM_STATIC + - CMOCK_MEM_SIZE=3000 + - UNITY_SUPPORT_TEST_CASES + - _PICC18 + object_files: + # prefix: '-O' # Hi-Tech doesn't want a prefix. They key off of filename .extensions, instead + extension: '.obj' + destination: *build_path + +linker: + path: cd build && picc18 + options: + - --chip=18F87J10 + - --ide=hitide + - --cp=24 # 24-bit pointers. Is this needed for linker?? + - --double=24 # Is this needed for linker?? + - -Lw # Scan the pic87*w.lib in the lib/ of the compiler installation directory + - --summary=mem,file # info listing + - --summary=+psect + - --summary=+hex + - --output=+intel + - --output=+mcof + - --runtime=+init # Directs startup code to copy idata, ibigdata and ifardata psects from ROM to RAM. + - --runtime=+clear # Directs startup code to clear bss, bigbss, rbss and farbss psects + - --runtime=+clib # link in the c-runtime + - --runtime=+keep # Keep the generated startup src after its obj is linked + - -G # Generate src-level symbol file + - -MIWasTheLastToBuild.map + - --warn=0 # allow all normal warning messages + - -Bl # Large memory model (probably not needed for linking) + includes: + prefix: '-I' + object_files: + path: *build_path + extension: '.obj' + bin_files: + prefix: '-O' + extension: '.hex' + destination: *build_path + +simulator: + path: + pre_support: + - 'java -client -jar ' # note space + - ['C:\Program Files\HI-TECH Software\HI-TIDE\3.15\lib\', 'simpic18.jar'] + - 18F87J10 + post_support: + +:cmock: + :plugins: [] + :includes: + - Types.h + :suite_teardown: | + if (num_failures) + _FAILED_TEST(); + else + _PASSED_TESTS(); + return 0; + +colour: true \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/targets/iar_arm_v4.yml b/flex-bison/mark1/tools/ceedling/vendor/unity/targets/iar_arm_v4.yml new file mode 100644 index 0000000..c2e7f18 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/targets/iar_arm_v4.yml @@ -0,0 +1,89 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 4.0 Kickstart\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\lib\dl4tptinl8n.h'] + - -z3 + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian little + - --cpu ARM7TDMI + - --stack_align 4 + - --interwork + - -e + - --silent + - --warnings_are_errors + - --fpu None + - --diag_suppress Pa050 + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'common\bin\xlink.exe'] + options: + - -rt + - [*tools_root, 'arm\lib\dl4tptinl8n.r79'] + - -D_L_EXTMEM_START=0 + - -D_L_EXTMEM_SIZE=0 + - -D_L_HEAP_SIZE=120 + - -D_L_STACK_SIZE=32 + - -e_small_write=_formatted_write + - -s + - __program_start + - -f + - [*tools_root, '\arm\config\lnkarm.xcl'] + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\config\'] + - [*tools_root, 'arm\lib\'] + object_files: + path: *build_path + extension: '.r79' + bin_files: + prefix: '-o' + extension: '.d79' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\ioat91sam7X256.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/targets/iar_arm_v5.yml b/flex-bison/mark1/tools/ceedling/vendor/unity/targets/iar_arm_v5.yml new file mode 100644 index 0000000..0549d8e --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/targets/iar_arm_v5.yml @@ -0,0 +1,79 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian=little + - --cpu=ARM7TDMI + - --interwork + - --warnings_are_errors + - --fpu=None + - --diag_suppress=Pa050 + - --diag_suppress=Pe111 + - -e + - -On + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\debugger\atmel\ioat91sam7X256.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/targets/iar_arm_v5_3.yml b/flex-bison/mark1/tools/ceedling/vendor/unity/targets/iar_arm_v5_3.yml new file mode 100644 index 0000000..0549d8e --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/targets/iar_arm_v5_3.yml @@ -0,0 +1,79 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian=little + - --cpu=ARM7TDMI + - --interwork + - --warnings_are_errors + - --fpu=None + - --diag_suppress=Pa050 + - --diag_suppress=Pe111 + - -e + - -On + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\debugger\atmel\ioat91sam7X256.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml b/flex-bison/mark1/tools/ceedling/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml new file mode 100644 index 0000000..eb0785c --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml @@ -0,0 +1,93 @@ +#Default tool path for IAR 5.4 on Windows XP 64bit +tools_root: &tools_root 'C:\Program Files (x86)\IAR Systems\Embedded Workbench 5.4 Kickstart\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --diag_suppress=Pa050 + #- --diag_suppress=Pe111 + - --debug + - --endian=little + - --cpu=Cortex-M3 + - --no_path_in_file_macros + - -e + - --fpu=None + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + #- --preinclude --preinclude C:\Vss\T2 Working\common\system.h + - --interwork + - --warnings_are_errors +# - Ohz + - -Oh +# - --no_cse +# - --no_unroll +# - --no_inline +# - --no_code_motion +# - --no_tbaa +# - --no_clustering +# - --no_scheduling + + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - ewarm + - PART_LM3S9B92 + - TARGET_IS_TEMPEST_RB1 + - USE_ROM_DRIVERS + - UART_BUFFERED + - UNITY_SUPPORT_64 + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic.icf'] +# - ['C:\Temp\lm3s9b92.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + #- --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim2.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - --endian=little + - --cpu=Cortex-M3 + - --fpu=None + - -p + - [*tools_root, 'arm\config\debugger\TexasInstruments\iolm3sxxxx.ddf'] + - --semihosting + - --device=LM3SxBxx + #- -d + #- sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/targets/iar_cortexm3_v5.yml b/flex-bison/mark1/tools/ceedling/vendor/unity/targets/iar_cortexm3_v5.yml new file mode 100644 index 0000000..cf0d1d0 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/targets/iar_cortexm3_v5.yml @@ -0,0 +1,83 @@ +# unit testing under iar compiler / simulator for STM32 Cortex-M3 + +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.4\' +compiler: + path: [*tools_root, 'arm\bin\iccarm.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_clustering + - --no_scheduling + - --debug + - --cpu_mode thumb + - --endian=little + - --cpu=Cortex-M3 + - --interwork + - --warnings_are_errors + - --fpu=None + - --diag_suppress=Pa050 + - --diag_suppress=Pe111 + - -e + - -On + includes: + prefix: '-I' + items: + - [*tools_root, 'arm\inc\'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + - 'iar\iar_v5\incIAR\' + defines: + prefix: '-D' + items: + - 'IAR' + - 'UNITY_SUPPORT_64' + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r79' + destination: *build_path +linker: + path: [*tools_root, 'arm\bin\ilinkarm.exe'] + options: + - --redirect _Printf=_PrintfLarge + - --redirect _Scanf=_ScanfSmall + - --semihosting + - --entry __iar_program_start + - --config + - [*tools_root, 'arm\config\generic_cortex.icf'] + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'arm\bin\armproc.dll'] + - [*tools_root, 'arm\bin\armsim.dll'] + post_support: + - --plugin + - [*tools_root, 'arm\bin\armbat.dll'] + - --backend + - -B + - -p + - [*tools_root, 'arm\config\debugger\ST\iostm32f107xx.ddf'] + - --cpu=Cortex-M3 + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/targets/iar_msp430.yml b/flex-bison/mark1/tools/ceedling/vendor/unity/targets/iar_msp430.yml new file mode 100644 index 0000000..e022647 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/targets/iar_msp430.yml @@ -0,0 +1,94 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3 MSP430\' +core_root: &core_root [*tools_root, '430\'] +core_bin: &core_bin [*core_root, 'bin\'] +core_config: &core_config [*core_root, 'config\'] +core_lib: &core_lib [*core_root, 'lib\'] +core_inc: &core_inc [*core_root, 'inc\'] +core_config: &core_config [*core_root, 'config\'] + +compiler: + path: [*core_bin, 'icc430.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - --dlib_config + - [*core_lib, 'dlib\dl430fn.h'] + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --debug + - -e + - -Ol + - --multiplier=16 + - --double=32 + - --diag_suppress Pa050 + - --diag_suppress Pe111 + includes: + prefix: '-I' + items: + - *core_inc + - [*core_inc, 'dlib'] + - [*core_lib, 'dlib'] + - 'src\' + - '../src/' + - *unit_tests_path + - 'vendor\unity\src' + defines: + prefix: '-D' + items: + - '__MSP430F149__' + - 'INT_WIDTH=16' + - 'UNITY_EXCLUDE_FLOAT' + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.r43' + destination: *build_path +linker: + path: [*core_bin, 'xlink.exe'] + options: + - -rt + - [*core_lib, 'dlib\dl430fn.r43'] + - -e_PrintfTiny=_Printf + - -e_ScanfSmall=_Scanf + - -s __program_start + - -D_STACK_SIZE=50 + - -D_DATA16_HEAP_SIZE=50 + - -D_DATA20_HEAP_SIZE=50 + - -f + - [*core_config, 'lnk430f5438.xcl'] + - -f + - [*core_config, 'multiplier.xcl'] + includes: + prefix: '-I' + items: + - *core_config + - *core_lib + - [*core_lib, 'dlib'] + object_files: + path: *build_path + extension: '.r79' + bin_files: + prefix: '-o' + extension: '.d79' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*core_bin, '430proc.dll'] + - [*core_bin, '430sim.dll'] + post_support: + - --plugin + - [*core_bin, '430bat.dll'] + - --backend -B + - --cpu MSP430F5438 + - -p + - [*core_config, 'MSP430F5438.ddf'] + - -d sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/targets/iar_sh2a_v6.yml b/flex-bison/mark1/tools/ceedling/vendor/unity/targets/iar_sh2a_v6.yml new file mode 100644 index 0000000..ddc5603 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/targets/iar_sh2a_v6.yml @@ -0,0 +1,85 @@ +tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 6.0\' +compiler: + path: [*tools_root, 'sh\bin\iccsh.exe'] + source_path: 'src\' + unit_tests_path: &unit_tests_path 'test\' + build_path: &build_path 'build\' + options: + - -e + - --char_is_signed + - -Ol + - --no_cse + - --no_unroll + - --no_inline + - --no_code_motion + - --no_tbaa + - --no_scheduling + - --no_clustering + - --debug + - --dlib_config + - [*tools_root, 'sh\inc\DLib_Product.h'] + - --double=32 + - --code_model=huge + - --data_model=huge + - --core=sh2afpu + - --warnings_affect_exit_code + - --warnings_are_errors + - --mfc + - --use_unix_directory_separators + - --diag_suppress=Pe161 + includes: + prefix: '-I' + items: + - [*tools_root, 'sh\inc\'] + - [*tools_root, 'sh\inc\c'] + - 'src\' + - '..\src\' + - *unit_tests_path + - 'vendor\unity\src\' + defines: + prefix: '-D' + items: + - UNITY_SUPPORT_64 + - 'UNITY_SUPPORT_TEST_CASES' + object_files: + prefix: '-o' + extension: '.o' + destination: *build_path +linker: + path: [*tools_root, 'sh\bin\ilinksh.exe'] + options: + - --redirect __Printf=__PrintfSmall + - --redirect __Scanf=__ScanfSmall + - --config + - [*tools_root, 'sh\config\generic.icf'] + - --config_def _CSTACK_SIZE=0x800 + - --config_def _HEAP_SIZE=0x800 + - --config_def _INT_TABLE=0x10 + - --entry __iar_program_start + - --debug_lib + object_files: + path: *build_path + extension: '.o' + bin_files: + prefix: '-o' + extension: '.out' + destination: *build_path +simulator: + path: [*tools_root, 'common\bin\CSpyBat.exe'] + pre_support: + - --silent + - [*tools_root, 'sh\bin\shproc.dll'] + - [*tools_root, 'sh\bin\shsim.dll'] + post_support: + - --plugin + - [*tools_root, 'sh\bin\shbat.dll'] + - --backend + - -B + - --core sh2afpu + - -p + - [*tools_root, 'sh\config\debugger\io7264.ddf'] + - -d + - sim +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/test/expectdata/testsample_cmd.c b/flex-bison/mark1/tools/ceedling/vendor/unity/test/expectdata/testsample_cmd.c new file mode 100644 index 0000000..42841d8 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/test/expectdata/testsample_cmd.c @@ -0,0 +1,54 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include +#include "CException.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/test/expectdata/testsample_def.c b/flex-bison/mark1/tools/ceedling/vendor/unity/test/expectdata/testsample_def.c new file mode 100644 index 0000000..8280804 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/test/expectdata/testsample_def.c @@ -0,0 +1,50 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_cmd.c b/flex-bison/mark1/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_cmd.c new file mode 100644 index 0000000..e47b31c --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_cmd.c @@ -0,0 +1,76 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_def.c b/flex-bison/mark1/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_def.c new file mode 100644 index 0000000..3ca9dba --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_def.c @@ -0,0 +1,72 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_new1.c b/flex-bison/mark1/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_new1.c new file mode 100644 index 0000000..a7cbcd8 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_new1.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + GlobalExpectCount = 0; + GlobalVerifyOrder = 0; + GlobalOrderError = NULL; + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_new2.c b/flex-bison/mark1/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_new2.c new file mode 100644 index 0000000..2c76bf2 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_new2.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_param.c b/flex-bison/mark1/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_param.c new file mode 100644 index 0000000..23c04f4 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_param.c @@ -0,0 +1,73 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST_NO_ARGS +#define RUN_TEST(TestFunc, TestLineNum, ...) \ +{ \ + Unity.CurrentTestName = #TestFunc "(" #__VA_ARGS__ ")"; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(__VA_ARGS__); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21, RUN_TEST_NO_ARGS); + RUN_TEST(test_TheSecondThingToTest, 43, RUN_TEST_NO_ARGS); + + return (UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_run1.c b/flex-bison/mark1/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_run1.c new file mode 100644 index 0000000..a7cbcd8 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_run1.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + GlobalExpectCount = 0; + GlobalVerifyOrder = 0; + GlobalOrderError = NULL; + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_run2.c b/flex-bison/mark1/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_run2.c new file mode 100644 index 0000000..2c76bf2 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_run2.c @@ -0,0 +1,85 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include +#include +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_yaml.c b/flex-bison/mark1/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_yaml.c new file mode 100644 index 0000000..68b545a --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/test/expectdata/testsample_mock_yaml.c @@ -0,0 +1,86 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + CMock_Init(); \ + setUp(); \ + TestFunc(); \ + CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + CMock_Destroy(); \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "cmock.h" +#include "two.h" +#include "three.h" +#include +#include +#include +#include "CException.h" +#include "Mockstanky.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Mock Management===== +static void CMock_Init(void) +{ + Mockstanky_Init(); +} +static void CMock_Verify(void) +{ + Mockstanky_Verify(); +} +static void CMock_Destroy(void) +{ + Mockstanky_Destroy(); +} + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_yaml_setup(); +} + +//=======Test Reset Option===== +void resetTest() +{ + CMock_Verify(); + CMock_Destroy(); + tearDown(); + CMock_Init(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/mocksample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/test/expectdata/testsample_new1.c b/flex-bison/mark1/tools/ceedling/vendor/unity/test/expectdata/testsample_new1.c new file mode 100644 index 0000000..e5bcac2 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/test/expectdata/testsample_new1.c @@ -0,0 +1,60 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/test/expectdata/testsample_new2.c b/flex-bison/mark1/tools/ceedling/vendor/unity/test/expectdata/testsample_new2.c new file mode 100644 index 0000000..b7c7e5b --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/test/expectdata/testsample_new2.c @@ -0,0 +1,63 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/test/expectdata/testsample_param.c b/flex-bison/mark1/tools/ceedling/vendor/unity/test/expectdata/testsample_param.c new file mode 100644 index 0000000..4157007 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/test/expectdata/testsample_param.c @@ -0,0 +1,51 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST_NO_ARGS +#define RUN_TEST(TestFunc, TestLineNum, ...) \ +{ \ + Unity.CurrentTestName = #TestFunc "(" #__VA_ARGS__ ")"; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(__VA_ARGS__); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21, RUN_TEST_NO_ARGS); + RUN_TEST(test_TheSecondThingToTest, 43, RUN_TEST_NO_ARGS); + + return (UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/test/expectdata/testsample_run1.c b/flex-bison/mark1/tools/ceedling/vendor/unity/test/expectdata/testsample_run1.c new file mode 100644 index 0000000..e5bcac2 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/test/expectdata/testsample_run1.c @@ -0,0 +1,60 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "one.h" +#include "two.h" +#include +#include +#include "CException.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/test/expectdata/testsample_run2.c b/flex-bison/mark1/tools/ceedling/vendor/unity/test/expectdata/testsample_run2.c new file mode 100644 index 0000000..b7c7e5b --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/test/expectdata/testsample_run2.c @@ -0,0 +1,63 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_custom_setup(); +} + +//=======Suite Teardown===== +static int suite_teardown(int num_failures) +{ +a_custom_teardown(); +} + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return suite_teardown(UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/test/expectdata/testsample_yaml.c b/flex-bison/mark1/tools/ceedling/vendor/unity/test/expectdata/testsample_yaml.c new file mode 100644 index 0000000..d109287 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/test/expectdata/testsample_yaml.c @@ -0,0 +1,64 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + CEXCEPTION_T e; \ + Try { \ + setUp(); \ + TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include "two.h" +#include "three.h" +#include +#include +#include +#include "CException.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_TheFirstThingToTest(void); +extern void test_TheSecondThingToTest(void); + + +//=======Suite Setup===== +static int suite_setup(void) +{ +a_yaml_setup(); +} + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + + +//=======MAIN===== +int main(void) +{ + suite_setup(); + Unity.TestFile = "test/testdata/testsample.c"; + UnityBegin(); + RUN_TEST(test_TheFirstThingToTest, 21); + RUN_TEST(test_TheSecondThingToTest, 43); + + return (UnityEnd()); +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/test/test_generate_test_runner.rb b/flex-bison/mark1/tools/ceedling/vendor/unity/test/test_generate_test_runner.rb new file mode 100644 index 0000000..61c8df9 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/test/test_generate_test_runner.rb @@ -0,0 +1,94 @@ +# ========================================== +# CMock Project - Automatic Mock Generation for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +ruby_version = RUBY_VERSION.split('.') +if (ruby_version[1].to_i == 9) and (ruby_version[2].to_i > 1) + require 'rubygems' + gem 'test-unit' +end +require 'test/unit' +require './auto/generate_test_runner.rb' + +TEST_FILE = 'test/testdata/testsample.c' +TEST_MOCK = 'test/testdata/mocksample.c' +OUT_FILE = 'build/testsample_' +EXP_FILE = 'test/expectdata/testsample_' + +class TestGenerateTestRunner < Test::Unit::TestCase + def setup + end + + def teardown + end + + def verify_output_equal(subtest) + expected = File.read(EXP_FILE + subtest + '.c').gsub(/\r\n/,"\n") + actual = File.read(OUT_FILE + subtest + '.c').gsub(/\r\n/,"\n") + assert_equal(expected, actual, "Generated File Sub-Test '#{subtest}' Failed") + end + + def test_ShouldGenerateARunnerByCreatingRunnerWithOptions + sets = { 'def' => nil, + 'new1' => { :plugins => [:cexception], :includes => ['one.h', 'two.h'], :enforce_strict_ordering => true }, + 'new2' => { :plugins => [:ignore], :suite_setup => "a_custom_setup();", :suite_teardown => "a_custom_teardown();" } + } + + sets.each_pair do |subtest, options| + UnityTestRunnerGenerator.new(options).run(TEST_FILE, OUT_FILE + subtest + '.c') + verify_output_equal(subtest) + UnityTestRunnerGenerator.new(options).run(TEST_MOCK, OUT_FILE + 'mock_' + subtest + '.c') + verify_output_equal('mock_' + subtest) + end + end + + def test_ShouldGenerateARunnerByRunningRunnerWithOptions + sets = { 'run1' => { :plugins => [:cexception], :includes => ['one.h', 'two.h'], :enforce_strict_ordering => true }, + 'run2' => { :plugins => [:ignore], :suite_setup => "a_custom_setup();", :suite_teardown => "a_custom_teardown();" } + } + + sets.each_pair do |subtest, options| + UnityTestRunnerGenerator.new.run(TEST_FILE, OUT_FILE + subtest + '.c', options) + verify_output_equal(subtest) + UnityTestRunnerGenerator.new.run(TEST_MOCK, OUT_FILE + 'mock_' + subtest + '.c', options) + verify_output_equal('mock_' + subtest) + end + end + + def test_ShouldGenerateARunnerByPullingYamlOptions + subtest = 'yaml' + cmdstr = "ruby auto/generate_test_runner.rb test/testdata/sample.yml \"#{TEST_FILE}\" \"#{OUT_FILE + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal(subtest) + + cmdstr = "ruby auto/generate_test_runner.rb test/testdata/sample.yml \"#{TEST_MOCK}\" \"#{OUT_FILE + 'mock_' + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal('mock_' + subtest) + end + + def test_ShouldGenerateARunnerByPullingCommandlineOptions + subtest = 'cmd' + cmdstr = "ruby auto/generate_test_runner.rb -cexception \"#{TEST_FILE}\" \"#{OUT_FILE + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal(subtest) + + cmdstr = "ruby auto/generate_test_runner.rb -cexception \"#{TEST_MOCK}\" \"#{OUT_FILE + 'mock_' + subtest + '.c'}\"" + `#{cmdstr}` + verify_output_equal('mock_' + subtest) + end + + def test_ShouldGenerateARunnerThatUsesParameterizedTests + sets = { 'param' => { :plugins => [:ignore], :use_param_tests => true } + } + + sets.each_pair do |subtest, options| + UnityTestRunnerGenerator.new(options).run(TEST_FILE, OUT_FILE + subtest + '.c') + verify_output_equal(subtest) + UnityTestRunnerGenerator.new(options).run(TEST_MOCK, OUT_FILE + 'mock_' + subtest + '.c') + verify_output_equal('mock_' + subtest) + end + end + +end diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/test/testdata/mocksample.c b/flex-bison/mark1/tools/ceedling/vendor/unity/test/testdata/mocksample.c new file mode 100644 index 0000000..b709438 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/test/testdata/mocksample.c @@ -0,0 +1,51 @@ +// This is just a sample test file to be used to test the generator script +#ifndef TEST_SAMPLE_H +#define TEST_SAMPLE_H + +#include +#include "unity.h" +#include "funky.h" +#include "Mockstanky.h" + +void setUp(void) +{ + CustomSetupStuff(); +} + +void tearDown(void) +{ + CustomTeardownStuff +} + +//Yup, nice comment +void test_TheFirstThingToTest(void) +{ + TEST_ASSERT(1); + + TEST_ASSERT_TRUE(1); +} + +/* +void test_ShouldBeIgnored(void) +{ + DoesStuff(); +} +*/ + +//void test_ShouldAlsoNotBeTested(void) +//{ +// Call_An_Expect(); +// +// CallAFunction(); +// test_CallAFunctionThatLooksLikeATest(); +//} + +void test_TheSecondThingToTest(void) +{ + Call_An_Expect(); + + CallAFunction(); + test_CallAFunctionThatLooksLikeATest(); +} + +#endif //TEST_SAMPLE_H diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/test/testdata/sample.yml b/flex-bison/mark1/tools/ceedling/vendor/unity/test/testdata/sample.yml new file mode 100644 index 0000000..9e5eece --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/test/testdata/sample.yml @@ -0,0 +1,9 @@ +:unity: + :includes: + - two.h + - three.h + - + :plugins: + - :cexception + :suite_setup: | + a_yaml_setup(); \ No newline at end of file diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/test/testdata/testsample.c b/flex-bison/mark1/tools/ceedling/vendor/unity/test/testdata/testsample.c new file mode 100644 index 0000000..4f30ec7 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/test/testdata/testsample.c @@ -0,0 +1,51 @@ +// This is just a sample test file to be used to test the generator script +#ifndef TEST_SAMPLE_H +#define TEST_SAMPLE_H + +#include +#include "unity.h" +#include "funky.h" +#include "stanky.h" + +void setUp(void) +{ + CustomSetupStuff(); +} + +void tearDown(void) +{ + CustomTeardownStuff +} + +//Yup, nice comment +void test_TheFirstThingToTest(void) +{ + TEST_ASSERT(1); + + TEST_ASSERT_TRUE(1); +} + +/* +void test_ShouldBeIgnored(void) +{ + DoesStuff(); +} +*/ + +//void test_ShouldAlsoNotBeTested(void) +//{ +// Call_An_Expect(); +// +// CallAFunction(); +// test_CallAFunctionThatLooksLikeATest(); +//} + +void test_TheSecondThingToTest(void) +{ + Call_An_Expect(); + + CallAFunction(); + test_CallAFunctionThatLooksLikeATest(); +} + +#endif //TEST_SAMPLE_H diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/test/testparameterized.c b/flex-bison/mark1/tools/ceedling/vendor/unity/test/testparameterized.c new file mode 100644 index 0000000..037cd21 --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/test/testparameterized.c @@ -0,0 +1,101 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include +#include "unity.h" + +#define TEST_CASE(...) + +#define EXPECT_ABORT_BEGIN \ + if (TEST_PROTECT()) \ + { + +#define VERIFY_FAILS_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestFailed == 1) ? 0 : 1; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Failed But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +#define VERIFY_IGNORES_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestIgnored == 1) ? 0 : 1; \ + Unity.CurrentTestIgnored = 0; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Ignored But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +int SetToOneToFailInTearDown; +int SetToOneMeanWeAlreadyCheckedThisGuy; + +void setUp(void) +{ + SetToOneToFailInTearDown = 0; + SetToOneMeanWeAlreadyCheckedThisGuy = 0; +} + +void tearDown(void) +{ + if (SetToOneToFailInTearDown == 1) + TEST_FAIL_MESSAGE("<= Failed in tearDown"); + if ((SetToOneMeanWeAlreadyCheckedThisGuy == 0) && (Unity.CurrentTestFailed > 0)) + { + UnityPrint("[[[[ Previous Test Should Have Passed But Did Not ]]]]"); + UNITY_OUTPUT_CHAR('\n'); + } +} + +TEST_CASE(0) +TEST_CASE(44) +TEST_CASE((90)+9) +void test_TheseShouldAllPass(int Num) +{ + TEST_ASSERT_TRUE(Num < 100); +} + +TEST_CASE(3) +TEST_CASE(77) +TEST_CASE( (99) + 1 - (1)) +void test_TheseShouldAllFail(int Num) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(Num > 100); + VERIFY_FAILS_END +} + +TEST_CASE(1) +TEST_CASE(44) +TEST_CASE(99) +TEST_CASE(98) +void test_TheseAreEveryOther(int Num) +{ + if (Num & 1) + { + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(Num > 100); + VERIFY_FAILS_END + } + else + { + TEST_ASSERT_TRUE(Num < 100); + } +} + +void test_NormalPassesStillWork(void) +{ + TEST_ASSERT_TRUE(1); +} + +void test_NormalFailsStillWork(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(0); + VERIFY_FAILS_END +} diff --git a/flex-bison/mark1/tools/ceedling/vendor/unity/test/testunity.c b/flex-bison/mark1/tools/ceedling/vendor/unity/test/testunity.c new file mode 100644 index 0000000..9f826dc --- /dev/null +++ b/flex-bison/mark1/tools/ceedling/vendor/unity/test/testunity.c @@ -0,0 +1,1510 @@ +/* ========================================== + Unity Project - A Test Framework for C + Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams + [Released under MIT License. Please refer to license.txt for details] +========================================== */ + +#include +#include "unity.h" + +#define EXPECT_ABORT_BEGIN \ + if (TEST_PROTECT()) \ + { + +#define VERIFY_FAILS_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestFailed == 1) ? 0 : 1; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Failed But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +#define VERIFY_IGNORES_END \ + } \ + Unity.CurrentTestFailed = (Unity.CurrentTestIgnored == 1) ? 0 : 1; \ + Unity.CurrentTestIgnored = 0; \ + if (Unity.CurrentTestFailed == 1) { \ + SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ + UnityPrint("[[[[ Previous Test Should Have Ignored But Did Not ]]]]"); \ + UNITY_OUTPUT_CHAR('\n'); \ + } + +int SetToOneToFailInTearDown; +int SetToOneMeanWeAlreadyCheckedThisGuy; + +void setUp(void) +{ + SetToOneToFailInTearDown = 0; + SetToOneMeanWeAlreadyCheckedThisGuy = 0; +} + +void tearDown(void) +{ + if (SetToOneToFailInTearDown == 1) + TEST_FAIL_MESSAGE("<= Failed in tearDown"); + if ((SetToOneMeanWeAlreadyCheckedThisGuy == 0) && (Unity.CurrentTestFailed > 0)) + { + UnityPrint("[[[[ Previous Test Should Have Passed But Did Not ]]]]"); + UNITY_OUTPUT_CHAR('\n'); + } +} + +void testTrue(void) +{ + TEST_ASSERT(1); + + TEST_ASSERT_TRUE(1); +} + +void testFalse(void) +{ + TEST_ASSERT_FALSE(0); + + TEST_ASSERT_UNLESS(0); +} + +void testPreviousPass(void) +{ + TEST_ASSERT_EQUAL_INT(0U, Unity.TestFailures); +} + +void testNotVanilla(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT(0); + VERIFY_FAILS_END +} + +void testNotTrue(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_TRUE(0); + VERIFY_FAILS_END +} + +void testNotFalse(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_FALSE(1); + VERIFY_FAILS_END +} + +void testNotUnless(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UNLESS(1); + VERIFY_FAILS_END +} + +void testNotNotEqual(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_NOT_EQUAL(10, 10); + VERIFY_FAILS_END +} + +void testFail(void) +{ + EXPECT_ABORT_BEGIN + TEST_FAIL_MESSAGE("Expected for testing"); + VERIFY_FAILS_END +} + +void testIsNull(void) +{ + char* ptr1 = NULL; + char* ptr2 = "hello"; + + TEST_ASSERT_NULL(ptr1); + TEST_ASSERT_NOT_NULL(ptr2); +} + +void testIsNullShouldFailIfNot(void) +{ + char* ptr1 = "hello"; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_NULL(ptr1); + VERIFY_FAILS_END +} + +void testNotNullShouldFailIfNULL(void) +{ + char* ptr1 = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_NOT_NULL(ptr1); + VERIFY_FAILS_END +} + +void testIgnore(void) +{ + EXPECT_ABORT_BEGIN + TEST_IGNORE(); + TEST_FAIL_MESSAGE("This should not be reached"); + VERIFY_IGNORES_END +} + +void testIgnoreMessage(void) +{ + EXPECT_ABORT_BEGIN + TEST_IGNORE_MESSAGE("This is an expected TEST_IGNORE_MESSAGE string!"); + TEST_FAIL_MESSAGE("This should not be reached"); + VERIFY_IGNORES_END +} + +void testNotEqualInts(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT(3982, 3983); + VERIFY_FAILS_END +} + +void testNotEqualInt8s(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT8(-127, -126); + VERIFY_FAILS_END +} + +void testNotEqualInt16s(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT16(-16383, -16382); + VERIFY_FAILS_END +} + +void testNotEqualInt32s(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT32(-2147483647, -2147483646); + VERIFY_FAILS_END +} + +void testNotEqualBits(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_BITS(0xFF00, 0x5555, 0x5A55); + VERIFY_FAILS_END +} + +void testNotEqualUInts(void) +{ + _UU16 v0, v1; + + v0 = 9000; + v1 = 9001; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualUInt8s(void) +{ + _UU8 v0, v1; + + v0 = 254; + v1 = 255; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT8(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualUInt16s(void) +{ + _UU16 v0, v1; + + v0 = 65535; + v1 = 65534; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualUInt32s(void) +{ + _UU32 v0, v1; + + v0 = 4294967295; + v1 = 4294967294; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT32(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex8s(void) +{ + _UU8 v0, v1; + + v0 = 0x23; + v1 = 0x22; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex8sIfSigned(void) +{ + _US8 v0, v1; + + v0 = -2; + v1 = 2; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex16s(void) +{ + _UU16 v0, v1; + + v0 = 0x1234; + v1 = 0x1235; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex16sIfSigned(void) +{ + _US16 v0, v1; + + v0 = -1024; + v1 = -1028; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex32s(void) +{ + _UU32 v0, v1; + + v0 = 900000; + v1 = 900001; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex32sIfSigned(void) +{ + _US32 v0, v1; + + v0 = -900000; + v1 = 900001; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32(v0, v1); + VERIFY_FAILS_END +} + +void testEqualInts(void) +{ + int v0, v1; + int *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(1837, 1837); + TEST_ASSERT_EQUAL_INT(-27365, -27365); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(19467, v1); + TEST_ASSERT_EQUAL_INT(v0, 19467); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 19467); +} + +void testEqualUints(void) +{ + unsigned int v0, v1; + unsigned int *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_UINT(1837, 1837); + TEST_ASSERT_EQUAL_UINT(v0, v1); + TEST_ASSERT_EQUAL_UINT(19467, v1); + TEST_ASSERT_EQUAL_UINT(v0, 19467); + TEST_ASSERT_EQUAL_UINT(*p0, v1); + TEST_ASSERT_EQUAL_UINT(*p0, *p1); + TEST_ASSERT_EQUAL_UINT(*p0, 19467); + TEST_ASSERT_EQUAL_UINT(60872u, 60872u); +} + +void testNotEqual(void) +{ + TEST_ASSERT_NOT_EQUAL(0, 1); + TEST_ASSERT_NOT_EQUAL(1, 0); + TEST_ASSERT_NOT_EQUAL(100, 101); + TEST_ASSERT_NOT_EQUAL(0, -1); + TEST_ASSERT_NOT_EQUAL(65535, -65535); + TEST_ASSERT_NOT_EQUAL(75, 900); + TEST_ASSERT_NOT_EQUAL(-100, -101); +} + +void testEqualHex8s(void) +{ + _UU8 v0, v1; + _UU8 *p0, *p1; + + v0 = 0x22; + v1 = 0x22; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX8(0x22, 0x22); + TEST_ASSERT_EQUAL_HEX8(v0, v1); + TEST_ASSERT_EQUAL_HEX8(0x22, v1); + TEST_ASSERT_EQUAL_HEX8(v0, 0x22); + TEST_ASSERT_EQUAL_HEX8(*p0, v1); + TEST_ASSERT_EQUAL_HEX8(*p0, *p1); + TEST_ASSERT_EQUAL_HEX8(*p0, 0x22); +} + +void testEqualHex8sNegatives(void) +{ + _UU8 v0, v1; + _UU8 *p0, *p1; + + v0 = 0xDD; + v1 = 0xDD; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX8(0xDD, 0xDD); + TEST_ASSERT_EQUAL_HEX8(v0, v1); + TEST_ASSERT_EQUAL_HEX8(0xDD, v1); + TEST_ASSERT_EQUAL_HEX8(v0, 0xDD); + TEST_ASSERT_EQUAL_HEX8(*p0, v1); + TEST_ASSERT_EQUAL_HEX8(*p0, *p1); + TEST_ASSERT_EQUAL_HEX8(*p0, 0xDD); +} + +void testEqualHex16s(void) +{ + _UU16 v0, v1; + _UU16 *p0, *p1; + + v0 = 0x9876; + v1 = 0x9876; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX16(0x9876, 0x9876); + TEST_ASSERT_EQUAL_HEX16(v0, v1); + TEST_ASSERT_EQUAL_HEX16(0x9876, v1); + TEST_ASSERT_EQUAL_HEX16(v0, 0x9876); + TEST_ASSERT_EQUAL_HEX16(*p0, v1); + TEST_ASSERT_EQUAL_HEX16(*p0, *p1); + TEST_ASSERT_EQUAL_HEX16(*p0, 0x9876); +} + +void testEqualHex32s(void) +{ + _UU32 v0, v1; + _UU32 *p0, *p1; + + v0 = 0x98765432ul; + v1 = 0x98765432ul; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX32(0x98765432ul, 0x98765432ul); + TEST_ASSERT_EQUAL_HEX32(v0, v1); + TEST_ASSERT_EQUAL_HEX32(0x98765432ul, v1); + TEST_ASSERT_EQUAL_HEX32(v0, 0x98765432ul); + TEST_ASSERT_EQUAL_HEX32(*p0, v1); + TEST_ASSERT_EQUAL_HEX32(*p0, *p1); + TEST_ASSERT_EQUAL_HEX32(*p0, 0x98765432ul); +} + +void testEqualBits(void) +{ + _UU32 v0 = 0xFF55AA00; + _UU32 v1 = 0x55550000; + + TEST_ASSERT_BITS(v1, v0, 0x55550000); + TEST_ASSERT_BITS(v1, v0, 0xFF55CC00); + TEST_ASSERT_BITS(0xFFFFFFFF, v0, 0xFF55AA00); + TEST_ASSERT_BITS(0xFFFFFFFF, v0, v0); + TEST_ASSERT_BITS(0xF0F0F0F0, v0, 0xFC5DAE0F); + TEST_ASSERT_BITS_HIGH(v1, v0); + TEST_ASSERT_BITS_LOW(0x000055FF, v0); + TEST_ASSERT_BIT_HIGH(30, v0); + TEST_ASSERT_BIT_LOW(5, v0); +} + +void testEqualShorts(void) +{ + short v0, v1; + short *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(1837, 1837); + TEST_ASSERT_EQUAL_INT(-2987, -2987); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(19467, v1); + TEST_ASSERT_EQUAL_INT(v0, 19467); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 19467); +} + +void testEqualUShorts(void) +{ + unsigned short v0, v1; + unsigned short *p0, *p1; + + v0 = 19467; + v1 = 19467; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_UINT(1837, 1837); + TEST_ASSERT_EQUAL_UINT(2987, 2987); + TEST_ASSERT_EQUAL_UINT(v0, v1); + TEST_ASSERT_EQUAL_UINT(19467, v1); + TEST_ASSERT_EQUAL_UINT(v0, 19467); + TEST_ASSERT_EQUAL_UINT(*p0, v1); + TEST_ASSERT_EQUAL_UINT(*p0, *p1); + TEST_ASSERT_EQUAL_UINT(*p0, 19467); +} + +void testEqualChars(void) +{ + signed char v0, v1; + signed char *p0, *p1; + + v0 = 109; + v1 = 109; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(42, 42); + TEST_ASSERT_EQUAL_INT(-116, -116); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(109, v1); + TEST_ASSERT_EQUAL_INT(v0, 109); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 109); +} + +void testEqualUChars(void) +{ + unsigned char v0, v1; + unsigned char *p0, *p1; + + v0 = 251; + v1 = 251; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_INT(42, 42); + TEST_ASSERT_EQUAL_INT(v0, v1); + TEST_ASSERT_EQUAL_INT(251, v1); + TEST_ASSERT_EQUAL_INT(v0, 251); + TEST_ASSERT_EQUAL_INT(*p0, v1); + TEST_ASSERT_EQUAL_INT(*p0, *p1); + TEST_ASSERT_EQUAL_INT(*p0, 251); +} + +void testEqualPointers(void) +{ + int v0, v1; + int *p0, *p1, *p2; + + v0 = 19467; + v1 = 18271; + p0 = &v0; + p1 = &v1; + p2 = &v1; + + TEST_ASSERT_EQUAL_PTR(p0, &v0); + TEST_ASSERT_EQUAL_PTR(&v1, p1); + TEST_ASSERT_EQUAL_PTR(p2, p1); + TEST_ASSERT_EQUAL_PTR(&v0, &v0); +} + +void testNotEqualPointers(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_PTR(0x12345678, 0x12345677); + VERIFY_FAILS_END +} + +void testIntsWithinDelta(void) +{ + TEST_ASSERT_INT_WITHIN(1, 5000, 5001); + TEST_ASSERT_INT_WITHIN(5, 5000, 4996); + TEST_ASSERT_INT_WITHIN(5, 5000, 5005); + TEST_ASSERT_INT_WITHIN(500, 50, -440); + + TEST_ASSERT_INT_WITHIN(2, -1, -1); + TEST_ASSERT_INT_WITHIN(5, 1, -1); + TEST_ASSERT_INT_WITHIN(5, -1, 1); +} + +void testIntsNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_INT_WITHIN(5, 5000, 5006); + VERIFY_FAILS_END +} + +void testUIntsWithinDelta(void) +{ + TEST_ASSERT_UINT_WITHIN(1, 5000, 5001); + TEST_ASSERT_UINT_WITHIN(5, 5000, 4996); + TEST_ASSERT_UINT_WITHIN(5, 5000, 5005); +} + +void testUIntsNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UINT_WITHIN(1, 2147483647u, 2147483649u); + VERIFY_FAILS_END +} + +void testUIntsNotWithinDeltaEvenThoughASignedIntWouldPassSmallFirst(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UINT_WITHIN(5, 1, -1); + VERIFY_FAILS_END +} + +void testUIntsNotWithinDeltaEvenThoughASignedIntWouldPassBigFirst(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_UINT_WITHIN(5, -1, 1); + VERIFY_FAILS_END +} + +void testHEX32sWithinDelta(void) +{ + TEST_ASSERT_HEX32_WITHIN(1, 5000, 5001); + TEST_ASSERT_HEX32_WITHIN(5, 5000, 4996); + TEST_ASSERT_HEX32_WITHIN(5, 5000, 5005); +} + +void testHEX32sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX32_WITHIN(1, 2147483647u, 2147483649u); + VERIFY_FAILS_END +} + +void testHEX32sNotWithinDeltaEvenThoughASignedIntWouldPass(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX32_WITHIN(5, 1, -1); + VERIFY_FAILS_END +} + +void testHEX16sWithinDelta(void) +{ + TEST_ASSERT_HEX16_WITHIN(1, 5000, 5001); + TEST_ASSERT_HEX16_WITHIN(5, 5000, 4996); + TEST_ASSERT_HEX16_WITHIN(5, 5000, 5005); +} + +void testHEX16sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX16_WITHIN(2, 65535, 0); + VERIFY_FAILS_END +} + +void testHEX8sWithinDelta(void) +{ + TEST_ASSERT_HEX8_WITHIN(1, 254, 255); + TEST_ASSERT_HEX8_WITHIN(5, 251, 255); + TEST_ASSERT_HEX8_WITHIN(5, 1, 4); +} + +void testHEX8sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX8_WITHIN(2, 255, 0); + VERIFY_FAILS_END +} + +void testEqualStrings(void) +{ + const char *testString = "foo"; + + TEST_ASSERT_EQUAL_STRING(testString, testString); + TEST_ASSERT_EQUAL_STRING("foo", "foo"); + TEST_ASSERT_EQUAL_STRING("foo", testString); + TEST_ASSERT_EQUAL_STRING(testString, "foo"); + TEST_ASSERT_EQUAL_STRING("", ""); +} + +void testEqualStringsWithCarriageReturnsAndLineFeeds(void) +{ + const char *testString = "foo\r\nbar"; + + TEST_ASSERT_EQUAL_STRING(testString, testString); + TEST_ASSERT_EQUAL_STRING("foo\r\nbar", "foo\r\nbar"); + TEST_ASSERT_EQUAL_STRING("foo\r\nbar", testString); + TEST_ASSERT_EQUAL_STRING(testString, "foo\r\nbar"); + TEST_ASSERT_EQUAL_STRING("", ""); +} + +void testNotEqualString1(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("foo", "bar"); + VERIFY_FAILS_END +} + +void testNotEqualString2(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("foo", ""); + VERIFY_FAILS_END +} + +void testNotEqualString3(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("", "bar"); + VERIFY_FAILS_END +} + +void testNotEqualString4(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("bar\r", "bar\n"); + VERIFY_FAILS_END +} + +void testNotEqualString5(void) +{ + const char str1[] = { 0x41, 0x42, 0x03, 0x00 }; + const char str2[] = { 0x41, 0x42, 0x04, 0x00 }; + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING(str1, str2); + VERIFY_FAILS_END +} + +void testNotEqualString_ExpectedStringIsNull(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING(NULL, "bar"); + VERIFY_FAILS_END +} + +void testNotEqualString_ActualStringIsNull(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING("foo", NULL); + VERIFY_FAILS_END +} + +void testEqualStringArrays(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, expStrings, 3); + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 3); + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 2); + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 1); +} + +void testNotEqualStringArray1(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray2(void) +{ + const char *testStrings[] = { "zoo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", "boo", "woo", "moo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray3(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", NULL }; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray4(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "moo" }; + const char *expStrings[] = { "foo", NULL, "woo", "moo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray5(void) +{ + const char **testStrings = NULL; + const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testNotEqualStringArray6(void) +{ + const char *testStrings[] = { "foo", "boo", "woo", "zoo" }; + const char **expStrings = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); + VERIFY_FAILS_END +} + +void testEqualStringArrayIfBothNulls(void) +{ + const char **testStrings = NULL; + const char **expStrings = NULL; + + TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); +} + +void testEqualMemory(void) +{ + const char *testString = "whatever"; + + TEST_ASSERT_EQUAL_MEMORY(testString, testString, 8); + TEST_ASSERT_EQUAL_MEMORY("whatever", "whatever", 8); + TEST_ASSERT_EQUAL_MEMORY("whatever", testString, 8); + TEST_ASSERT_EQUAL_MEMORY(testString, "whatever", 8); + TEST_ASSERT_EQUAL_MEMORY(testString, "whatever", 2); + TEST_ASSERT_EQUAL_MEMORY(NULL, NULL, 1); +} + +void testNotEqualMemory1(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY("foo", "bar", 3); + VERIFY_FAILS_END +} + +void testNotEqualMemory2(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY("fool", "food", 4); + VERIFY_FAILS_END +} + +void testNotEqualMemory3(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY(NULL, "food", 4); + VERIFY_FAILS_END +} + +void testNotEqualMemory4(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY("fool", NULL, 4); + VERIFY_FAILS_END +} + +void testEqualIntArrays(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, -2}; + int p2[] = {1, 8, 987, 2}; + int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p3, 1); +} + +void testNotEqualIntArraysNullExpected(void) +{ + int* p0 = NULL; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArraysNullActual(void) +{ + int* p1 = NULL; + int p0[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArrays1(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArrays2(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {2, 8, 987, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualIntArrays3(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 986, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualInt8Arrays(void) +{ + _US8 p0[] = {1, 8, 117, -2}; + _US8 p1[] = {1, 8, 117, -2}; + _US8 p2[] = {1, 8, 117, 2}; + _US8 p3[] = {1, 50, 60, 70}; + + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p3, 1); +} + +void testNotEqualInt8Arrays(void) +{ + _US8 p0[] = {1, 8, 127, -2}; + _US8 p1[] = {1, 8, 127, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualUIntArrays(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65132u}; + unsigned int p2[] = {1, 8, 987, 2}; + unsigned int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p3, 1); +} + +void testNotEqualUIntArrays1(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUIntArrays2(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUIntArrays3(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualInt16Arrays(void) +{ + _UU16 p0[] = {1, 8, 117, 3}; + _UU16 p1[] = {1, 8, 117, 3}; + _UU16 p2[] = {1, 8, 117, 2}; + _UU16 p3[] = {1, 50, 60, 70}; + + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p3, 1); +} + +void testNotEqualInt16Arrays(void) +{ + _UU16 p0[] = {1, 8, 127, 3}; + _UU16 p1[] = {1, 8, 127, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualUINT16Arrays(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65132u}; + unsigned short p2[] = {1, 8, 987, 2}; + unsigned short p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p3, 1); +} + +void testNotEqualUINT16Arrays1(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUINT16Arrays2(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualUINT16Arrays3(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualHEXArrays(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65132u}; + unsigned int p2[] = {1, 8, 987, 2}; + unsigned int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p3, 1); +} + +void testNotEqualHEXArrays1(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEXArrays2(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEXArrays3(void) +{ + unsigned int p0[] = {1, 8, 987, 65132u}; + unsigned int p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualHEX16Arrays(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65132u}; + unsigned short p2[] = {1, 8, 987, 2}; + unsigned short p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p3, 1); +} + +void testNotEqualHEX16Arrays1(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX16Arrays2(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX16Arrays3(void) +{ + unsigned short p0[] = {1, 8, 987, 65132u}; + unsigned short p1[] = {1, 8, 986, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualHEX8Arrays(void) +{ + unsigned short p0[] = {1, 8, 254u, 123}; + unsigned short p1[] = {1, 8, 254u, 123}; + unsigned short p2[] = {1, 8, 254u, 2}; + unsigned short p3[] = {1, 23, 25, 26}; + + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p3, 1); +} + +void testNotEqualHEX8Arrays1(void) +{ + unsigned char p0[] = {1, 8, 254u, 253u}; + unsigned char p1[] = {1, 8, 254u, 252u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX8Arrays2(void) +{ + unsigned char p0[] = {1, 8, 254u, 253u}; + unsigned char p1[] = {2, 8, 254u, 253u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX8Arrays3(void) +{ + unsigned char p0[] = {1, 8, 254u, 253u}; + unsigned char p1[] = {1, 8, 255u, 253u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testEqualMemoryArrays(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, -2}; + int p2[] = {1, 8, 987, 2}; + int p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p0, 4, 1); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p0, 4, 4); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p2, 4, 3); + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p3, 4, 1); +} + +void testNotEqualMemoryArraysExpectedNull(void) +{ + int* p0 = NULL; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArraysActualNull(void) +{ + int p0[] = {1, 8, 987, -2}; + int* p1 = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArrays1(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 987, 2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArrays2(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {2, 8, 987, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testNotEqualMemoryArrays3(void) +{ + int p0[] = {1, 8, 987, -2}; + int p1[] = {1, 8, 986, -2}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4); + VERIFY_FAILS_END +} + +void testProtection(void) +{ + volatile int mask = 0; + + if (TEST_PROTECT()) + { + mask |= 1; + TEST_ABORT(); + } + else + { + Unity.CurrentTestFailed = 0; + mask |= 2; + } + + TEST_ASSERT_EQUAL(3, mask); +} + +void testIgnoredAndThenFailInTearDown(void) +{ + SetToOneToFailInTearDown = 1; + TEST_IGNORE(); +} + +// ===================== THESE TEST WILL RUN IF YOUR CONFIG INCLUDES 64 BIT SUPPORT ================== +#ifdef UNITY_SUPPORT_64 + +void testEqualHex64s(void) +{ + _UU64 v0, v1; + _UU64 *p0, *p1; + + v0 = 0x9876543201234567; + v1 = 0x9876543201234567; + p0 = &v0; + p1 = &v1; + + TEST_ASSERT_EQUAL_HEX64(0x9876543201234567, 0x9876543201234567); + TEST_ASSERT_EQUAL_HEX64(v0, v1); + TEST_ASSERT_EQUAL_HEX64(0x9876543201234567, v1); + TEST_ASSERT_EQUAL_HEX64(v0, 0x9876543201234567); + TEST_ASSERT_EQUAL_HEX64(*p0, v1); + TEST_ASSERT_EQUAL_HEX64(*p0, *p1); + TEST_ASSERT_EQUAL_HEX64(*p0, 0x9876543201234567); +} + +void testNotEqualHex64s(void) +{ + _UU64 v0, v1; + + v0 = 9000000000; + v1 = 9100000000; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64(v0, v1); + VERIFY_FAILS_END +} + +void testNotEqualHex64sIfSigned(void) +{ + _US64 v0, v1; + + v0 = -9000000000; + v1 = 9000000000; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64(v0, v1); + VERIFY_FAILS_END +} + +void testHEX64sWithinDelta(void) +{ + TEST_ASSERT_HEX64_WITHIN(1, 0x7FFFFFFFFFFFFFFF,0x7FFFFFFFFFFFFFFE); + TEST_ASSERT_HEX64_WITHIN(5, 5000, 4996); + TEST_ASSERT_HEX64_WITHIN(5, 5000, 5005); +} + +void testHEX64sNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX64_WITHIN(1, 0x7FFFFFFFFFFFFFFF, 0x7FFFFFFFFFFFFFFC); + VERIFY_FAILS_END +} + +void testHEX64sNotWithinDeltaEvenThoughASignedIntWouldPass(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_HEX64_WITHIN(5, 1, -1); + VERIFY_FAILS_END +} + +void testEqualHEX64Arrays(void) +{ + _UU64 p0[] = {1, 8, 987, 65132u}; + _UU64 p1[] = {1, 8, 987, 65132u}; + _UU64 p2[] = {1, 8, 987, 2}; + _UU64 p3[] = {1, 500, 600, 700}; + + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p3, 1); +} + +void testNotEqualHEX64Arrays1(void) +{ + _UU64 p0[] = {1, 8, 987, 65132u}; + _UU64 p1[] = {1, 8, 987, 65131u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualHEX64Arrays2(void) +{ + _UU64 p0[] = {1, 8, 987, 65132u}; + _UU64 p1[] = {2, 8, 987, 65132u}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +#endif //64-bit SUPPORT + +// ===================== THESE TEST WILL RUN IF YOUR CONFIG INCLUDES FLOAT SUPPORT ================== +#ifndef UNITY_EXCLUDE_FLOAT + +void testFloatsWithinDelta(void) +{ + TEST_ASSERT_FLOAT_WITHIN(0.00003f, 187245.03485f, 187245.03488f); + TEST_ASSERT_FLOAT_WITHIN(1.0f, 187245.0f, 187246.0f); + TEST_ASSERT_FLOAT_WITHIN(0.05f, 9273.2549f, 9273.2049f); + TEST_ASSERT_FLOAT_WITHIN(0.007f, -726.93724f, -726.94424f); +} + +void testFloatsNotWithinDelta(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_FLOAT_WITHIN(0.05f, 9273.2649f, 9273.2049f); + VERIFY_FAILS_END +} + +void testFloatsEqual(void) +{ + TEST_ASSERT_EQUAL_FLOAT(187245.0f, 187246.0f); + TEST_ASSERT_EQUAL_FLOAT(18724.5f, 18724.6f); + TEST_ASSERT_EQUAL_FLOAT(9273.2549f, 9273.2599f); + TEST_ASSERT_EQUAL_FLOAT(-726.93724f, -726.9374f); +} + +void testFloatsNotEqual(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT(9273.9649f, 9273.0049f); + VERIFY_FAILS_END +} + +void testFloatsNotEqualNegative1(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT(-9273.9649f, -9273.0049f); + VERIFY_FAILS_END +} + +void testFloatsNotEqualNegative2(void) +{ + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT(-9273.0049f, -9273.9649f); + VERIFY_FAILS_END +} + +void testEqualFloatArrays(void) +{ + float p0[] = {1.0, -8.0, 25.4, -0.123}; + float p1[] = {1.0, -8.0, 25.4, -0.123}; + float p2[] = {1.0, -8.0, 25.4, -0.2}; + float p3[] = {1.0, -23.0, 25.0, -0.26}; + + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p0, 1); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p0, 4); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p2, 3); + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p3, 1); +} + +void testNotEqualFloatArraysExpectedNull(void) +{ + float* p0 = NULL; + float p1[] = {1.0, 8.0, 25.4, 0.252}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysActualNull(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float* p1 = NULL; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArrays1(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float p1[] = {1.0, 8.0, 25.4, 0.252}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArrays2(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float p1[] = {2.0, 8.0, 25.4, 0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArrays3(void) +{ + float p0[] = {1.0, 8.0, 25.4, 0.253}; + float p1[] = {1.0, 8.0, 25.5, 0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysNegative1(void) +{ + float p0[] = {-1.0, -8.0, -25.4, -0.253}; + float p1[] = {-1.0, -8.0, -25.4, -0.252}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysNegative2(void) +{ + float p0[] = {-1.0, -8.0, -25.4, -0.253}; + float p1[] = {-2.0, -8.0, -25.4, -0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +void testNotEqualFloatArraysNegative3(void) +{ + float p0[] = {-1.0, -8.0, -25.4, -0.253}; + float p1[] = {-1.0, -8.0, -25.5, -0.253}; + + EXPECT_ABORT_BEGIN + TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); + VERIFY_FAILS_END +} + +#endif //FLOAT SUPPORT diff --git a/flex-bison/mark1/tools/scripts/generate_ast_graph.bat b/flex-bison/mark1/tools/scripts/generate_ast_graph.bat new file mode 100644 index 0000000..9bcb43a --- /dev/null +++ b/flex-bison/mark1/tools/scripts/generate_ast_graph.bat @@ -0,0 +1,3 @@ +@echo off +echo %* | parser.exe | dot -Tbmp > test.bmp +test.bmp diff --git a/flex-bison/mark1/tools/scripts/parse_file.bat b/flex-bison/mark1/tools/scripts/parse_file.bat new file mode 100644 index 0000000..5129684 --- /dev/null +++ b/flex-bison/mark1/tools/scripts/parse_file.bat @@ -0,0 +1,3 @@ +@echo off +cat %* | parser.exe | dot -Tbmp > test.bmp +test.bmp